From 6e85928cd49667ec14e254126c1e8a28f27feeba Mon Sep 17 00:00:00 2001 From: Adam Kondraciuk Date: Thu, 20 Feb 2025 16:17:38 +0100 Subject: [PATCH 0001/2141] [nrf fromtree] ipc: ipc_service: Parametrize workqueue stack size Add `IPC_SERVICE_BACKEND_ICBMSG_EP_BOUND_WORK_Q_STACK_SIZE` config and parametrize its value depending on the optimization level. Signed-off-by: Adam Kondraciuk (cherry picked from commit 31689690c925749cf64d0874be7856a3506a6baa) --- subsys/ipc/ipc_service/backends/Kconfig.icbmsg | 8 ++++++++ subsys/ipc/ipc_service/backends/ipc_icbmsg.c | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/subsys/ipc/ipc_service/backends/Kconfig.icbmsg b/subsys/ipc/ipc_service/backends/Kconfig.icbmsg index e31b5cadd77a..3a34c63c06c7 100644 --- a/subsys/ipc/ipc_service/backends/Kconfig.icbmsg +++ b/subsys/ipc/ipc_service/backends/Kconfig.icbmsg @@ -23,6 +23,14 @@ config IPC_SERVICE_BACKEND_ICBMSG_NUM_EP backend. The number of endpoints are applied to all the instances, so this value should be maximum number among all the instances. +config IPC_SERVICE_BACKEND_ICBMSG_EP_BOUND_WORK_Q_STACK_SIZE + int "Workqueue stack size" + default 1024 if NO_OPTIMIZATIONS + default 512 + help + Workqueue stack size for bounding processing + (this configuration is not optimized). + module = IPC_SERVICE_BACKEND_ICBMSG module-str = ICMSG backend with separate buffers module-help = Sets log level for ICMsg backend with buffers diff --git a/subsys/ipc/ipc_service/backends/ipc_icbmsg.c b/subsys/ipc/ipc_service/backends/ipc_icbmsg.c index 46ecfe1233ff..312642aafeb9 100644 --- a/subsys/ipc/ipc_service/backends/ipc_icbmsg.c +++ b/subsys/ipc/ipc_service/backends/ipc_icbmsg.c @@ -118,7 +118,8 @@ LOG_MODULE_REGISTER(ipc_icbmsg, #define FLAG_EPT_COUNT_MASK 0xFFFF /** Workqueue stack size for bounding processing (this configuration is not optimized). */ -#define EP_BOUND_WORK_Q_STACK_SIZE (512U) +#define EP_BOUND_WORK_Q_STACK_SIZE \ + (CONFIG_IPC_SERVICE_BACKEND_ICBMSG_EP_BOUND_WORK_Q_STACK_SIZE) /** Workqueue priority for bounding processing. */ #define EP_BOUND_WORK_Q_PRIORITY (CONFIG_SYSTEM_WORKQUEUE_PRIORITY) From ec41d056fa9183df05c3d8b2c6047f75b00c2fde Mon Sep 17 00:00:00 2001 From: Adam Kondraciuk Date: Thu, 20 Feb 2025 16:23:00 +0100 Subject: [PATCH 0002/2141] [nrf fromtree] Revert "tests: arm_thread_swap: Add overlay for nRF54H20" This reverts commit 28bd478a0b709774534adbec8060097bd87cf28c. This commit can be reverted as the cause of test failure has been removed in ipc service by increasing workqueue stack size. Signed-off-by: Adam Kondraciuk (cherry picked from commit bdab748bcf48db624b4919e25b6eb5d17acbf631) --- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 tests/arch/arm/arm_thread_swap/boards/nrf54h20dk_nrf54h20_cpuapp.overlay diff --git a/tests/arch/arm/arm_thread_swap/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/arch/arm/arm_thread_swap/boards/nrf54h20dk_nrf54h20_cpuapp.overlay deleted file mode 100644 index f9615d1b35ec..000000000000 --- a/tests/arch/arm/arm_thread_swap/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ /dev/null @@ -1,9 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - -&cpusec_cpuapp_ipc { - status = "disabled"; -}; - -&cpusec_bellboard { - status = "disabled"; -}; From e40777b62489c1a5ce62df81c22d7eb95845af8b Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Mon, 10 Mar 2025 15:43:24 +0100 Subject: [PATCH 0003/2141] [nrf fromtree] cmake: add tfm / tfa image information to build info Support for list of images in build info was added with commit 4061311da3ee2ad8f048bf3e94cfb42a8681b6b1 and is used by sysbuild. Zephyr itself also uses CMake's External Project feature when including TF-M or TF-A in a Zephyr build. Populate build info with TF-M / TF-A information when said image is included in the build. Signed-off-by: Torsten Rasmussen (cherry picked from commit 2d5a81035ad64e2d20ad047ca8f720990e48797d) --- modules/trusted-firmware-a/CMakeLists.txt | 3 +++ modules/trusted-firmware-m/CMakeLists.txt | 3 +++ 2 files changed, 6 insertions(+) diff --git a/modules/trusted-firmware-a/CMakeLists.txt b/modules/trusted-firmware-a/CMakeLists.txt index 72c1ea5c75af..0c0230174f09 100644 --- a/modules/trusted-firmware-a/CMakeLists.txt +++ b/modules/trusted-firmware-a/CMakeLists.txt @@ -8,6 +8,9 @@ if (CONFIG_BUILD_WITH_TFA) include(ExternalProject) + set(tfa_image_info MAP "name: tfa, source-dir: ${ZEPHYR_TRUSTED_FIRMWARE_A_MODULE_DIR}") + build_info(images VALUE ${tfa_image_info}) + ExternalProject_Add( tfa SOURCE_DIR ${ZEPHYR_TRUSTED_FIRMWARE_A_MODULE_DIR} diff --git a/modules/trusted-firmware-m/CMakeLists.txt b/modules/trusted-firmware-m/CMakeLists.txt index 9130f9629789..c76812198a32 100644 --- a/modules/trusted-firmware-m/CMakeLists.txt +++ b/modules/trusted-firmware-m/CMakeLists.txt @@ -315,6 +315,9 @@ if (CONFIG_BUILD_WITH_TFM) # threads. Which is num_cores+2 on Ninja and MAKEFLAGS with Make. endif() + set(tfm_image_info MAP "name: tfm, source-dir: ${ZEPHYR_TRUSTED_FIRMWARE_M_MODULE_DIR}") + build_info(images VALUE ${tfm_image_info}) + ExternalProject_Add( tfm SOURCE_DIR ${ZEPHYR_TRUSTED_FIRMWARE_M_MODULE_DIR} From a83d5969b2e2f3dbff5df6870177fe1f2468497f Mon Sep 17 00:00:00 2001 From: Adam Kondraciuk Date: Tue, 25 Feb 2025 11:18:58 +0100 Subject: [PATCH 0004/2141] [nrf fromtree] dts: nordic: Add channels property for local DPPI Add number of channels implemented by the local DPPIC instances. Signed-off-by: Adam Kondraciuk (cherry picked from commit 8cc7c2992a250e409e41daf2e70c4f564415e98b) --- dts/bindings/misc/nordic,nrf-dppic-local.yaml | 6 ++++++ dts/vendor/nordic/nrf54h20.dtsi | 1 + dts/vendor/nordic/nrf9280.dtsi | 1 + 3 files changed, 8 insertions(+) diff --git a/dts/bindings/misc/nordic,nrf-dppic-local.yaml b/dts/bindings/misc/nordic,nrf-dppic-local.yaml index 41029bb30621..a96b5a994c9e 100644 --- a/dts/bindings/misc/nordic,nrf-dppic-local.yaml +++ b/dts/bindings/misc/nordic,nrf-dppic-local.yaml @@ -11,3 +11,9 @@ description: | compatible: "nordic,nrf-dppic-local" include: ["nordic,nrf-dppic.yaml", "nordic,nrf-dppic-links.yaml"] + +properties: + channels: + type: int + required: true + description: Number of channels implemented by the DPPIC instance. diff --git a/dts/vendor/nordic/nrf54h20.dtsi b/dts/vendor/nordic/nrf54h20.dtsi index 32f126dddfdd..96d4ff53af1c 100644 --- a/dts/vendor/nordic/nrf54h20.dtsi +++ b/dts/vendor/nordic/nrf54h20.dtsi @@ -366,6 +366,7 @@ dppic020: dppic@22000 { compatible = "nordic,nrf-dppic-local"; reg = <0x22000 0x1000>; + channels = <32>; status = "disabled"; }; diff --git a/dts/vendor/nordic/nrf9280.dtsi b/dts/vendor/nordic/nrf9280.dtsi index d7c20e855c16..06e0a3a15145 100644 --- a/dts/vendor/nordic/nrf9280.dtsi +++ b/dts/vendor/nordic/nrf9280.dtsi @@ -250,6 +250,7 @@ dppic020: dppic@22000 { compatible = "nordic,nrf-dppic-local"; reg = <0x22000 0x1000>; + channels = <32>; status = "disabled"; }; From 73bd5efabec5b88e745b12b2387154c2510ffe6b Mon Sep 17 00:00:00 2001 From: Adam Kondraciuk Date: Mon, 17 Feb 2025 09:00:25 +0100 Subject: [PATCH 0005/2141] [nrf fromtree] modules: hal_nordic: nrfx: Use owned-channels property for DPPIC The `owned-channels` property specifies which channels are assigned to a given target. Additionally, the `source-channels` or `sink-channels` property defines channels that can be used to forward an event outside the DPPI domain, otherwise they can only be used within it. Signed-off-by: Adam Kondraciuk (cherry picked from commit d2c392310697f0c1bb14cf0d746854b71b8f16df) --- modules/hal_nordic/nrfx/nrfx_zephyr_utils.h | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/modules/hal_nordic/nrfx/nrfx_zephyr_utils.h b/modules/hal_nordic/nrfx/nrfx_zephyr_utils.h index e1fa4d4c321a..a7f05ca372d8 100644 --- a/modules/hal_nordic/nrfx/nrfx_zephyr_utils.h +++ b/modules/hal_nordic/nrfx/nrfx_zephyr_utils.h @@ -34,7 +34,7 @@ * definitions required by the interconnect/apb layer: * - NRFX_DPPI_PUB_CONFIG_ALLOWED_CHANNELS_MASK_BY_INST_NUM(inst_num) * - NRFX_DPPI_SUB_CONFIG_ALLOWED_CHANNELS_MASK_BY_INST_NUM(inst_num) - * - NRFX_DPPI_PUB_OR_SUB_MASK(inst_num) + * - NRFX_DPPI_OWNED_MASK(inst_num) * - NRFX_DPPI_CHANNELS_SINGLE_VAR_NAME_BY_INST_NUM(inst_num) * - NRFX_INTERCONNECT_APB_GLOBAL_DPPI_DEFINE * - NRFX_INTERCONNECT_APB_LOCAL_DPPI_DEFINE @@ -42,6 +42,14 @@ */ #if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_dppic_global) || \ DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_dppic_local) + +/* Channels masks generation. */ +#define NRFX_CONFIG_DPPI_MASK_DT(node_id) \ + COND_CODE_1(DT_NODE_HAS_PROP(node_id, owned_channels), \ + (NRFX_CONFIG_MASK_DT(node_id, owned_channels)), \ + (COND_CODE_1(DT_NODE_HAS_COMPAT(node_id, nordic_nrf_dppic_local), \ + (BIT64_MASK(DT_PROP(node_id, channels))), (0)))) + /* Source (publish) channels masks generation. */ #define NRFX_DPPI_PUB_CONFIG_ALLOWED_CHANNELS_MASK_BY_INST_NUM(inst_num) \ NRFX_CONFIG_MASK_DT(DT_NODELABEL(_CONCAT(dppic, inst_num)), source_channels) @@ -50,9 +58,9 @@ #define NRFX_DPPI_SUB_CONFIG_ALLOWED_CHANNELS_MASK_BY_INST_NUM(inst_num) \ NRFX_CONFIG_MASK_DT(DT_NODELABEL(_CONCAT(dppic, inst_num)), sink_channels) -#define NRFX_DPPI_PUB_OR_SUB_MASK(inst_num) \ - UTIL_OR(DT_NODE_HAS_PROP(DT_NODELABEL(_CONCAT(dppic, inst_num)), source_channels), \ - DT_NODE_HAS_PROP(DT_NODELABEL(_CONCAT(dppic, inst_num)), sink_channels)) +#define NRFX_DPPI_OWNED_MASK(inst_num) \ + UTIL_OR(DT_NODE_HAS_PROP(DT_NODELABEL(_CONCAT(dppic, inst_num)), owned_channels), \ + DT_NODE_HAS_PROP(DT_NODELABEL(_CONCAT(dppic, inst_num)), channels)) /* Variables names generation. */ #define NRFX_CONFIG_DPPI_CHANNELS_ENTRY_NAME(node_id) _CONCAT(_CONCAT(m_, node_id), _channels) @@ -62,9 +70,7 @@ /* Variables entries generation. */ #define NRFX_CONFIG_DPPI_CHANNELS_ENTRY(node_id) \ static nrfx_atomic_t NRFX_CONFIG_DPPI_CHANNELS_ENTRY_NAME(node_id) \ - __attribute__((used)) = \ - NRFX_CONFIG_MASK_DT(node_id, source_channels) | \ - NRFX_CONFIG_MASK_DT(node_id, sink_channels); + __attribute__((used)) = (uint32_t)NRFX_CONFIG_DPPI_MASK_DT(node_id); #define NRFX_INTERCONNECT_APB_GLOBAL_DPPI_DEFINE \ DT_FOREACH_STATUS_OKAY(nordic_nrf_dppic_global, NRFX_CONFIG_DPPI_CHANNELS_ENTRY) #define NRFX_INTERCONNECT_APB_LOCAL_DPPI_DEFINE \ From eb17e7d76ef3971680fdd62e8717fb026132f792 Mon Sep 17 00:00:00 2001 From: Adam Kondraciuk Date: Tue, 18 Mar 2025 15:55:26 +0100 Subject: [PATCH 0006/2141] [nrf fromlist] Revert "soc: nordic: s2ram: Align s2ram marking procedures" The marking procedures can be reverted, since at this stage it is already allowed to use the stack. The MSP is temporairly set to interrupt stack in `reset.S` file before calling s2ram procedures.. Upstream PR #: 87304 Signed-off-by: Adam Kondraciuk This reverts commit e68d110f7c175f2a9275659d023c9d37d1e4b4f1. (cherry picked from commit 68b238df42e7cc935f419e30a5c2406fcff4c7b1) --- soc/nordic/nrf54h/pm_s2ram.c | 49 ++++++++++-------------------------- 1 file changed, 13 insertions(+), 36 deletions(-) diff --git a/soc/nordic/nrf54h/pm_s2ram.c b/soc/nordic/nrf54h/pm_s2ram.c index c18c9650cdce..3ebd0a2f6bb2 100644 --- a/soc/nordic/nrf54h/pm_s2ram.c +++ b/soc/nordic/nrf54h/pm_s2ram.c @@ -180,48 +180,25 @@ int soc_s2ram_suspend(pm_s2ram_system_off_fn_t system_off) return ret; } -void __attribute__((naked)) pm_s2ram_mark_set(void) +void pm_s2ram_mark_set(void) { /* empty */ - __asm__ volatile("bx lr\n"); } -bool __attribute__((naked)) pm_s2ram_mark_check_and_clear(void) +bool pm_s2ram_mark_check_and_clear(void) { - __asm__ volatile( - /* Set return value to 0 */ - "mov r0, #0\n" + bool unretained_wake; + bool restore_valid; + uint32_t reset_reason = nrf_resetinfo_resetreas_local_get(NRF_RESETINFO); - /* Load and check RESETREAS register */ - "ldr r3, [%[resetinfo_addr], %[resetreas_offs]]\n" - "cmp r3, %[resetreas_unretained_mask]\n" - - "bne exit\n" - - /* Clear RESETREAS register */ - "str r0, [%[resetinfo_addr], %[resetreas_offs]]\n" - - /* Load RESTOREVALID register */ - "ldr r3, [%[resetinfo_addr], %[restorevalid_offs]]\n" - - /* Clear RESTOREVALID */ - "str r0, [%[resetinfo_addr], %[restorevalid_offs]]\n" - - /* Check RESTOREVALID register */ - "cmp r3, %[restorevalid_present_mask]\n" - "bne exit\n" - - /* Set return value to 1 */ - "mov r0, #1\n" + if (reset_reason != NRF_RESETINFO_RESETREAS_LOCAL_UNRETAINED_MASK) { + return false; + } + unretained_wake = reset_reason & NRF_RESETINFO_RESETREAS_LOCAL_UNRETAINED_MASK; + nrf_resetinfo_resetreas_local_set(NRF_RESETINFO, 0); - "exit:\n" - "bx lr\n" - : - : [resetinfo_addr] "r"(NRF_RESETINFO), - [resetreas_offs] "r"(offsetof(NRF_RESETINFO_Type, RESETREAS.LOCAL)), - [resetreas_unretained_mask] "r"(NRF_RESETINFO_RESETREAS_LOCAL_UNRETAINED_MASK), - [restorevalid_offs] "r"(offsetof(NRF_RESETINFO_Type, RESTOREVALID)), - [restorevalid_present_mask] "r"(RESETINFO_RESTOREVALID_RESTOREVALID_Msk) + restore_valid = nrf_resetinfo_restore_valid_check(NRF_RESETINFO); + nrf_resetinfo_restore_valid_set(NRF_RESETINFO, false); - : "r0", "r1", "r3", "r4", "memory"); + return (unretained_wake & restore_valid) ? true : false; } From 80b7b93c475b80e11d2cfd90ed33c2b99c5f24f6 Mon Sep 17 00:00:00 2001 From: Adam Kondraciuk Date: Tue, 18 Mar 2025 16:38:37 +0100 Subject: [PATCH 0007/2141] [nrf fromlist] soc: nordic: s2ram: Optimize s2am marking functions Optimize `pm_s2ram_mark_check_and_clear()` function. Upstream PR #: 87304 Signed-off-by: Adam Kondraciuk (cherry picked from commit 8a849bd77d3c10fb3277f39f6fa06e3a9b972496) --- soc/nordic/nrf54h/pm_s2ram.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/soc/nordic/nrf54h/pm_s2ram.c b/soc/nordic/nrf54h/pm_s2ram.c index 3ebd0a2f6bb2..1ec5da4aa199 100644 --- a/soc/nordic/nrf54h/pm_s2ram.c +++ b/soc/nordic/nrf54h/pm_s2ram.c @@ -187,18 +187,16 @@ void pm_s2ram_mark_set(void) bool pm_s2ram_mark_check_and_clear(void) { - bool unretained_wake; bool restore_valid; uint32_t reset_reason = nrf_resetinfo_resetreas_local_get(NRF_RESETINFO); if (reset_reason != NRF_RESETINFO_RESETREAS_LOCAL_UNRETAINED_MASK) { return false; } - unretained_wake = reset_reason & NRF_RESETINFO_RESETREAS_LOCAL_UNRETAINED_MASK; nrf_resetinfo_resetreas_local_set(NRF_RESETINFO, 0); restore_valid = nrf_resetinfo_restore_valid_check(NRF_RESETINFO); nrf_resetinfo_restore_valid_set(NRF_RESETINFO, false); - return (unretained_wake & restore_valid) ? true : false; + return restore_valid ? true : false; } From 7cad1bb6b8455a7fde871e1302b4ffe03a868d27 Mon Sep 17 00:00:00 2001 From: Ravi Dondaputi Date: Tue, 15 Apr 2025 17:32:28 +0530 Subject: [PATCH 0008/2141] [nrf fromlist] net: lib: wifi_credentials: Add support for Enterprise security Add support for configuring enterprise mode security. Fixes SHEL-3573. Upstream PR #: 88653 Signed-off-by: Ravi Dondaputi (cherry picked from commit 8b0ef98754f3c9d2cf471db7ace65dd35cffe832) --- subsys/net/lib/wifi_credentials/Kconfig | 26 ++ .../wifi_credentials/wifi_credentials_shell.c | 224 ++++++++++++++++-- 2 files changed, 234 insertions(+), 16 deletions(-) diff --git a/subsys/net/lib/wifi_credentials/Kconfig b/subsys/net/lib/wifi_credentials/Kconfig index f50e210b080a..d0843d689a28 100644 --- a/subsys/net/lib/wifi_credentials/Kconfig +++ b/subsys/net/lib/wifi_credentials/Kconfig @@ -73,6 +73,32 @@ config WIFI_CREDENTIALS_CONNECT_STORED_CONNECTION_TIMEOUT help Wait period before falling back to the next entry in the list of stored SSIDs. + +if WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE + +config WIFI_CREDENTIALS_RUNTIME_CERTIFICATES + bool "Provide Wi-Fi enterprise security certificates at run-time" + select TLS_CREDENTIALS + select TLS_CREDENTIALS_SHELL + select BASE64 + default y if WIFI_SHELL_RUNTIME_CERTIFICATES + help + This option enables providing Wi-Fi enterprise security certificates at run-time. + Uses the TLS credentials subsystem to store and manage the certificates. + +if WIFI_CREDENTIALS_RUNTIME_CERTIFICATES + +config HEAP_MEM_POOL_ADD_SIZE_WIFI_CERT + int "Wi-Fi enterprise security certificates memory pool size" + # STA - 6 certs and each assume 1500 bytes + default 12000 + help + The size of the memory pool used by the Wi-Fi enterprise security certificates. + +endif # WIFI_CREDENTIALS_RUNTIME_CERTIFICATES + +endif # WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE + endif # WIFI_CREDENTIALS_CONNECT_STORED endif # WIFI_CREDENTIALS diff --git a/subsys/net/lib/wifi_credentials/wifi_credentials_shell.c b/subsys/net/lib/wifi_credentials/wifi_credentials_shell.c index 4a51de48e121..c5b8c2a88a39 100644 --- a/subsys/net/lib/wifi_credentials/wifi_credentials_shell.c +++ b/subsys/net/lib/wifi_credentials/wifi_credentials_shell.c @@ -22,10 +22,33 @@ #include +LOG_MODULE_REGISTER(wifi_credentials_shell, CONFIG_WIFI_CREDENTIALS_LOG_LEVEL); + #define MAX_BANDS_STR_LEN 64 #define MACSTR "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx" #ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE +#ifdef CONFIG_WIFI_CREDENTIALS_RUNTIME_CERTIFICATES +#include +enum wifi_enterprise_cert_sec_tags { + WIFI_CERT_CA_SEC_TAG = 0x1020001, + WIFI_CERT_CLIENT_KEY_SEC_TAG, + WIFI_CERT_SERVER_KEY_SEC_TAG, + WIFI_CERT_CLIENT_SEC_TAG, + WIFI_CERT_SERVER_SEC_TAG, + /* Phase 2 */ + WIFI_CERT_CA_P2_SEC_TAG, + WIFI_CERT_CLIENT_KEY_P2_SEC_TAG, + WIFI_CERT_CLIENT_P2_SEC_TAG, +}; + +struct wifi_cert_data { + enum tls_credential_type type; + uint32_t sec_tag; + uint8_t **data; + size_t *len; +}; +#else static const char ca_cert_test[] = { #include '\0' @@ -52,25 +75,184 @@ static const char client_cert2_test[] = { static const char client_key2_test[] = { #include '\0'}; +#endif /* CONFIG_WIFI_CREDENTIALS_RUNTIME_CERTIFICATES */ #endif /* CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE */ #if defined CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE -static int cmd_wifi_set_enterprise_creds(const struct shell *sh, struct net_if *iface) +#ifdef CONFIG_WIFI_CREDENTIALS_RUNTIME_CERTIFICATES + +struct wifi_enterprise_creds_params enterprise_creds_params; + +static int process_certificates(struct wifi_cert_data *certs, size_t cert_count) +{ + for (size_t i = 0; i < cert_count; i++) { + int err; + size_t len = 0; + uint8_t *cert_tmp; + + err = tls_credential_get(certs[i].sec_tag, certs[i].type, NULL, &len); + if (err != -EFBIG) { + LOG_ERR("Failed to get credential tag: %d length, err: %d", + certs[i].sec_tag, err); + return err; + } + + cert_tmp = k_malloc(len); + if (!cert_tmp) { + LOG_ERR("Failed to allocate memory for credential tag: %d", + certs[i].sec_tag); + return -ENOMEM; + } + + err = tls_credential_get(certs[i].sec_tag, certs[i].type, cert_tmp, &len); + if (err) { + LOG_ERR("Failed to get credential tag: %d", certs[i].sec_tag); + k_free(cert_tmp); + return err; + } + + *certs[i].data = cert_tmp; + *certs[i].len = len; + } + + return 0; +} + +static void set_enterprise_creds_params(struct wifi_enterprise_creds_params *params, + bool is_ap) +{ + struct wifi_cert_data certs_common[] = { + { + .type = TLS_CREDENTIAL_CA_CERTIFICATE, + .sec_tag = WIFI_CERT_CA_SEC_TAG, + .data = ¶ms->ca_cert, + .len = ¶ms->ca_cert_len, + }, + }; + + struct wifi_cert_data certs_sta[] = { + { + .type = TLS_CREDENTIAL_PRIVATE_KEY, + .sec_tag = WIFI_CERT_CLIENT_KEY_SEC_TAG, + .data = ¶ms->client_key, + .len = ¶ms->client_key_len, + }, + { + .type = TLS_CREDENTIAL_PUBLIC_CERTIFICATE, + .sec_tag = WIFI_CERT_CLIENT_SEC_TAG, + .data = ¶ms->client_cert, + .len = ¶ms->client_cert_len, + }, + { + .type = TLS_CREDENTIAL_CA_CERTIFICATE, + .sec_tag = WIFI_CERT_CA_P2_SEC_TAG, + .data = ¶ms->ca_cert2, + .len = ¶ms->ca_cert2_len, + }, + { + .type = TLS_CREDENTIAL_PRIVATE_KEY, + .sec_tag = WIFI_CERT_CLIENT_KEY_P2_SEC_TAG, + .data = ¶ms->client_key2, + .len = ¶ms->client_key2_len, + }, + { + .type = TLS_CREDENTIAL_PUBLIC_CERTIFICATE, + .sec_tag = WIFI_CERT_CLIENT_P2_SEC_TAG, + .data = ¶ms->client_cert2, + .len = ¶ms->client_cert2_len, + }, + }; + + memset(params, 0, sizeof(*params)); + + /* Process common certificates */ + if (process_certificates(certs_common, ARRAY_SIZE(certs_common)) != 0) { + goto cleanup; + } + + /* Process STA-specific certificates */ + if (!is_ap) { + if (process_certificates(certs_sta, ARRAY_SIZE(certs_sta)) != 0) { + goto cleanup; + } + } + + memcpy(&enterprise_creds_params, params, sizeof(*params)); + return; + +cleanup: + for (size_t i = 0; i < ARRAY_SIZE(certs_common); i++) { + if (certs_common[i].data) { + k_free(*certs_common[i].data); + *certs_common[i].data = NULL; + } + } + + if (!is_ap) { + for (size_t i = 0; i < ARRAY_SIZE(certs_sta); i++) { + if (certs_sta[i].data) { + k_free(*certs_sta[i].data); + *certs_sta[i].data = NULL; + } + } + } + +} + +static void clear_enterprise_creds_params(struct wifi_enterprise_creds_params *params) +{ + if (params == NULL) { + return; + } + + const uint8_t *certs[] = { + params->ca_cert, + params->client_cert, + params->client_key, + params->ca_cert2, + params->client_cert2, + params->client_key2, + }; + + for (size_t i = 0; i < ARRAY_SIZE(certs); i++) { + k_free((void *)certs[i]); + } + memset(params, 0, sizeof(*params)); +} +#else +static void set_enterprise_creds_params(struct wifi_enterprise_creds_params *params, + bool is_ap) +{ + params->ca_cert = (uint8_t *)ca_cert_test; + params->ca_cert_len = ARRAY_SIZE(ca_cert_test); + + if (!is_ap) { + params->client_cert = (uint8_t *)client_cert_test; + params->client_cert_len = ARRAY_SIZE(client_cert_test); + params->client_key = (uint8_t *)client_key_test; + params->client_key_len = ARRAY_SIZE(client_key_test); + params->ca_cert2 = (uint8_t *)ca_cert2_test; + params->ca_cert2_len = ARRAY_SIZE(ca_cert2_test); + params->client_cert2 = (uint8_t *)client_cert2_test; + params->client_cert2_len = ARRAY_SIZE(client_cert2_test); + params->client_key2 = (uint8_t *)client_key2_test; + params->client_key2_len = ARRAY_SIZE(client_key2_test); + + return; + } +} +#endif /* CONFIG_WIFI_CREDENTIALS_RUNTIME_CERTIFICATES */ + +static int wifi_set_enterprise_creds(const struct shell *sh, struct net_if *iface, + bool is_ap) { struct wifi_enterprise_creds_params params = {0}; - params.ca_cert = (uint8_t *)ca_cert_test; - params.ca_cert_len = ARRAY_SIZE(ca_cert_test); - params.client_cert = (uint8_t *)client_cert_test; - params.client_cert_len = ARRAY_SIZE(client_cert_test); - params.client_key = (uint8_t *)client_key_test; - params.client_key_len = ARRAY_SIZE(client_key_test); - params.ca_cert2 = (uint8_t *)ca_cert2_test; - params.ca_cert2_len = ARRAY_SIZE(ca_cert2_test); - params.client_cert2 = (uint8_t *)client_cert2_test; - params.client_cert2_len = ARRAY_SIZE(client_cert2_test); - params.client_key2 = (uint8_t *)client_key2_test; - params.client_key2_len = ARRAY_SIZE(client_key2_test); +#ifdef CONFIG_WIFI_SHELL_RUNTIME_CERTIFICATES + clear_enterprise_creds_params(&enterprise_creds_params); +#endif /* CONFIG_WIFI_SHELL_RUNTIME_CERTIFICATES */ + + set_enterprise_creds_params(¶ms, is_ap); if (net_mgmt(NET_REQUEST_WIFI_ENTERPRISE_CREDS, iface, ¶ms, sizeof(params))) { shell_warn(sh, "Set enterprise credentials failed\n"); @@ -340,7 +522,7 @@ static int cmd_add_network(const struct shell *sh, size_t argc, char *argv[]) } #ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE - struct net_if *iface = net_if_get_first_by_type(&NET_L2_GET_NAME(ETHERNET)); + struct net_if *iface = net_if_get_wifi_sta(); /* Load the enterprise credentials if needed */ if (creds.header.type == WIFI_SECURITY_TYPE_EAP_TLS || @@ -348,7 +530,7 @@ static int cmd_add_network(const struct shell *sh, size_t argc, char *argv[]) creds.header.type == WIFI_SECURITY_TYPE_EAP_PEAP_GTC || creds.header.type == WIFI_SECURITY_TYPE_EAP_TTLS_MSCHAPV2 || creds.header.type == WIFI_SECURITY_TYPE_EAP_PEAP_TLS) { - cmd_wifi_set_enterprise_creds(sh, iface); + wifi_set_enterprise_creds(sh, iface, 0); } #endif /* CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE */ @@ -368,6 +550,12 @@ static int cmd_delete_network(const struct shell *sh, size_t argc, char *argv[]) } shell_print(sh, "\tDeleting network ssid: \"%s\", ssid_len: %d", argv[1], strlen(argv[1])); + +#ifdef CONFIG_WIFI_SHELL_RUNTIME_CERTIFICATES + /* Clear the certificates */ + clear_enterprise_creds_params(&enterprise_creds_params); +#endif /* CONFIG_WIFI_SHELL_RUNTIME_CERTIFICATES */ + return wifi_credentials_delete_by_ssid(argv[1], strlen(argv[1])); } @@ -381,7 +569,11 @@ static int cmd_list_networks(const struct shell *sh, size_t argc, char *argv[]) static int cmd_auto_connect(const struct shell *sh, size_t argc, char *argv[]) { - struct net_if *iface = net_if_get_first_by_type(&NET_L2_GET_NAME(ETHERNET)); + struct net_if *iface = net_if_get_wifi_sta(); + +#ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE + wifi_set_enterprise_creds(sh, iface, 0); +#endif /* CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE */ int rc = net_mgmt(NET_REQUEST_WIFI_CONNECT_STORED, iface, NULL, 0); if (rc) { From 737ba8dd6f199a785641c3c19b5244b922c615c7 Mon Sep 17 00:00:00 2001 From: Adam Kondraciuk Date: Thu, 24 Apr 2025 16:45:51 +0200 Subject: [PATCH 0009/2141] [nrf fromtree] samples: boards: nordic: system_off fixes For reasons other than system off, the retained data should be cleared. Signed-off-by: Adam Kondraciuk (cherry picked from commit df700410ac29b9a36344de21b0c74a77c827a393) --- samples/boards/nordic/system_off/sample.yaml | 6 +++--- samples/boards/nordic/system_off/src/main.c | 20 +++++++++++++++----- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/samples/boards/nordic/system_off/sample.yaml b/samples/boards/nordic/system_off/sample.yaml index 81c2f0f262b6..6e17223e12b4 100644 --- a/samples/boards/nordic/system_off/sample.yaml +++ b/samples/boards/nordic/system_off/sample.yaml @@ -42,7 +42,7 @@ tests: ordered: true regex: - "system off demo" - - "Retained data: INVALID" + - "Retained data: valid" - "Boot count: 1" - "Off count: 0" - "Active Ticks:" @@ -87,7 +87,7 @@ tests: ordered: true regex: - "system off demo" - - "Retained data: INVALID" + - "Retained data: valid" - "Boot count: 1" - "Off count: 0" - "Active Ticks:" @@ -134,7 +134,7 @@ tests: ordered: true regex: - "system off demo" - - "Retained data: INVALID" + - "Retained data: valid" - "Boot count: 1" - "Off count: 0" - "Active Ticks:" diff --git a/samples/boards/nordic/system_off/src/main.c b/samples/boards/nordic/system_off/src/main.c index 0b0cbf3cb0bb..d119eff87dac 100644 --- a/samples/boards/nordic/system_off/src/main.c +++ b/samples/boards/nordic/system_off/src/main.c @@ -18,6 +18,8 @@ #include #include +#define NON_WAKEUP_RESET_REASON (RESET_PIN | RESET_SOFTWARE | RESET_POR | RESET_DEBUG) + #if defined(CONFIG_GRTC_WAKEUP_ENABLE) #include #define DEEP_SLEEP_TIME_S 2 @@ -29,15 +31,14 @@ static const struct gpio_dt_spec sw0 = GPIO_DT_SPEC_GET(DT_ALIAS(sw0), gpios); static const struct device *comp_dev = DEVICE_DT_GET(DT_NODELABEL(comp)); #endif -void print_reset_cause(void) +void print_reset_cause(uint32_t reset_cause) { - uint32_t reset_cause; - - hwinfo_get_reset_cause(&reset_cause); if (reset_cause & RESET_DEBUG) { printf("Reset by debugger.\n"); } else if (reset_cause & RESET_CLOCK) { printf("Wakeup from System OFF by GRTC.\n"); + } else if (reset_cause & RESET_LOW_POWER_WAKE) { + printf("Wakeup from System OFF by GPIO.\n"); } else { printf("Other wake up cause 0x%08X.\n", reset_cause); } @@ -46,6 +47,7 @@ void print_reset_cause(void) int main(void) { int rc; + uint32_t reset_cause; const struct device *const cons = DEVICE_DT_GET(DT_CHOSEN(zephyr_console)); if (!device_is_ready(cons)) { @@ -54,11 +56,19 @@ int main(void) } printf("\n%s system off demo\n", CONFIG_BOARD); - print_reset_cause(); + hwinfo_get_reset_cause(&reset_cause); + print_reset_cause(reset_cause); if (IS_ENABLED(CONFIG_APP_USE_RETAINED_MEM)) { bool retained_ok = retained_validate(); + if (reset_cause & NON_WAKEUP_RESET_REASON) { + retained.boots = 0; + retained.off_count = 0; + retained.uptime_sum = 0; + retained.uptime_latest = 0; + retained_ok = true; + } /* Increment for this boot attempt and update. */ retained.boots += 1; retained_update(); From 8d09c7c8284bba85a80683baac288357a7c36f9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Ku=C5=BAnia?= Date: Thu, 29 May 2025 11:20:24 +0200 Subject: [PATCH 0010/2141] [nrf fromlist] modules: hal_nordic: nrf_802154: CCA threshold config in dBm MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The nrf-802154 component of hal_nordic is updated. The CCA threshold configuration is now done in dBm units, instead of hardware-dependent scale. Fixed a bug, where the CONFIG_NRF_802154_CCA_ED_THRESHOLD units were different from the NRF_802154_CCA_ED_THRESHOLD units. Now all configuration is done in dBm. Upstream PR #: 90795 Signed-off-by: Rafał Kuźnia (cherry picked from commit c57600347c45650b15af426ec0755f3da62657b2) --- modules/hal_nordic/Kconfig | 8 ++++---- modules/hal_nordic/nrf_802154/CMakeLists.txt | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/hal_nordic/Kconfig b/modules/hal_nordic/Kconfig index 8053017170e6..665fe2cc95b0 100644 --- a/modules/hal_nordic/Kconfig +++ b/modules/hal_nordic/Kconfig @@ -163,12 +163,12 @@ config NRF_802154_CCA_MODE_CARRIER_OR_ED endchoice -config NRF_802154_CCA_ED_THRESHOLD - int "nRF IEEE 802.15.4 CCA Energy Detection threshold" - default 45 +config NRF_802154_CCA_ED_THRESHOLD_DBM + int "nRF IEEE 802.15.4 CCA Energy Detection threshold in dBm" + default -75 help If energy detected in a given channel is above the value then the - channel is deemed busy. The unit is defined as per 802.15.4-2006 spec. + channel is deemed busy. The unit is dBm. config NRF_802154_CCA_CORR_THRESHOLD int "nRF IEEE 802.15.4 CCA Correlator threshold" diff --git a/modules/hal_nordic/nrf_802154/CMakeLists.txt b/modules/hal_nordic/nrf_802154/CMakeLists.txt index 1fc5c85ec0b1..957019ff1e67 100644 --- a/modules/hal_nordic/nrf_802154/CMakeLists.txt +++ b/modules/hal_nordic/nrf_802154/CMakeLists.txt @@ -52,7 +52,7 @@ target_compile_definitions(zephyr-802154-interface # CCA mode options NRF_802154_CCA_CORR_LIMIT_DEFAULT=${CONFIG_NRF_802154_CCA_CORR_LIMIT} NRF_802154_CCA_CORR_THRESHOLD_DEFAULT=${CONFIG_NRF_802154_CCA_CORR_THRESHOLD} - NRF_802154_CCA_ED_THRESHOLD_DEFAULT=${CONFIG_NRF_802154_CCA_ED_THRESHOLD} + NRF_802154_CCA_ED_THRESHOLD_DBM_DEFAULT=${CONFIG_NRF_802154_CCA_ED_THRESHOLD_DBM} # Key storage size NRF_802154_SECURITY_KEY_STORAGE_SIZE=${CONFIG_NRF_802154_SECURITY_KEY_STORAGE_SIZE} From fced75e9087afccf7964ff8fe4bc2c9000aab2d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Stasiak?= Date: Fri, 30 May 2025 15:19:19 +0200 Subject: [PATCH 0011/2141] [nrf fromtree] test: drivers: clock_control_api: Fix conf file application MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CONF_FILE parameter in testcase.yaml overwrites board specific configurations. Change it to EXTRA_CONF_FILE to apply both configurations. Signed-off-by: Michał Stasiak (cherry picked from commit 72623f98f7536b2bfe46f49e30f621aa227dc8ce) --- tests/drivers/clock_control/clock_control_api/testcase.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/drivers/clock_control/clock_control_api/testcase.yaml b/tests/drivers/clock_control/clock_control_api/testcase.yaml index 847e4d41ddf7..d624b61fe7c3 100644 --- a/tests/drivers/clock_control/clock_control_api/testcase.yaml +++ b/tests/drivers/clock_control/clock_control_api/testcase.yaml @@ -38,4 +38,4 @@ tests: - ophelia4ev/nrf54l15/cpuapp integration_platforms: - nrf51dk/nrf51822 - extra_args: CONF_FILE="nrf_lfclk_rc.conf" + extra_args: EXTRA_CONF_FILE="nrf_lfclk_rc.conf" From 6648c9d3821ea9f7b8e1e5cad31e83d129daef7b Mon Sep 17 00:00:00 2001 From: Nikodem Kastelik Date: Mon, 2 Jun 2025 14:25:48 +0200 Subject: [PATCH 0012/2141] [nrf fromtree] manifest: update hal_nordic revision to integrate nrfx 3.12.0 New nrfx release contains MDK 8.71.1 and various fixes for nRF devices. Signed-off-by: Nikodem Kastelik (cherry picked from commit f46798fa55881e6e24bb121d867c7753d4c6b775) --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 72255ca8b119..b8b35cb5ef8b 100644 --- a/west.yml +++ b/west.yml @@ -200,7 +200,7 @@ manifest: groups: - hal - name: hal_nordic - revision: 4eafaa44a55a557595e529f8cbdfc8dc1248da36 + revision: 1f169d927e367eb1e161972e9504da5aa1f10c42 path: modules/hal/nordic groups: - hal From 27c091a6ab28bf77e5a3e2e1ac5c7e1d1c044256 Mon Sep 17 00:00:00 2001 From: Nikodem Kastelik Date: Mon, 2 Jun 2025 15:55:00 +0200 Subject: [PATCH 0013/2141] [nrf fromtree] drivers: adc: nrf: align to channel-wide burst configuration Some nRF devices allow to configure burst setting per channel while others globally. Signed-off-by: Nikodem Kastelik (cherry picked from commit 5abf43c7ddc22362715868afbc5d2bc857ac85f1) --- drivers/adc/adc_nrfx_saadc.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/drivers/adc/adc_nrfx_saadc.c b/drivers/adc/adc_nrfx_saadc.c index 8d8c6a01ad30..d627dd250e35 100644 --- a/drivers/adc/adc_nrfx_saadc.c +++ b/drivers/adc/adc_nrfx_saadc.c @@ -220,7 +220,9 @@ static int adc_nrfx_channel_setup(const struct device *dev, .resistor_p = NRF_SAADC_RESISTOR_DISABLED, .resistor_n = NRF_SAADC_RESISTOR_DISABLED, #endif +#if NRF_SAADC_HAS_CH_BURST .burst = NRF_SAADC_BURST_DISABLED, +#endif }; uint8_t channel_id = channel_cfg->channel_id; uint32_t input_negative = channel_cfg->input_negative; @@ -530,6 +532,7 @@ static int start_read(const struct device *dev, uint8_t resolution = sequence->resolution; uint8_t active_channels; uint8_t channel_id; + nrf_saadc_burst_t burst; /* Signal an error if channel selection is invalid (no channels or * a non-existing one is selected). @@ -581,10 +584,13 @@ static int start_read(const struct device *dev, * is not used (hence, the multiple channel sampling is * possible), the burst mode have to be deactivated. */ - nrf_saadc_burst_set(NRF_SAADC, channel_id, - (sequence->oversampling != 0U ? - NRF_SAADC_BURST_ENABLED : - NRF_SAADC_BURST_DISABLED)); + burst = (sequence->oversampling != 0U ? + NRF_SAADC_BURST_ENABLED : NRF_SAADC_BURST_DISABLED); +#if NRF_SAADC_HAS_CH_BURST + nrf_saadc_channel_burst_set(NRF_SAADC, channel_id, burst); +#else + nrf_saadc_burst_set(NRF_SAADC, burst); +#endif nrf_saadc_channel_pos_input_set( NRF_SAADC, channel_id, @@ -596,10 +602,12 @@ static int start_read(const struct device *dev, ); ++active_channels; } else { - nrf_saadc_burst_set( - NRF_SAADC, - channel_id, - NRF_SAADC_BURST_DISABLED); + burst = NRF_SAADC_BURST_DISABLED; +#if NRF_SAADC_HAS_CH_BURST + nrf_saadc_channel_burst_set(NRF_SAADC, channel_id, burst); +#else + nrf_saadc_burst_set(NRF_SAADC, burst); +#endif nrf_saadc_channel_pos_input_set( NRF_SAADC, channel_id, From e6cec3ed74f1e5c9f5ced466d3a97a6aeefb671e Mon Sep 17 00:00:00 2001 From: Nikodem Kastelik Date: Tue, 3 Jun 2025 08:25:49 +0200 Subject: [PATCH 0014/2141] [nrf fromtree] drivers: adc: nrf: align to non-gain configuration Some nRF devices do not allow to configure gain. Signed-off-by: Nikodem Kastelik (cherry picked from commit 647477c8511713e731d100b9f26480c92c9de1e1) --- drivers/adc/adc_nrfx_saadc.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/adc/adc_nrfx_saadc.c b/drivers/adc/adc_nrfx_saadc.c index d627dd250e35..8072e0c7eafd 100644 --- a/drivers/adc/adc_nrfx_saadc.c +++ b/drivers/adc/adc_nrfx_saadc.c @@ -65,7 +65,9 @@ static const uint32_t saadc_psels[NRF_SAADC_DVDD + 1] = { [NRF_SAADC_AIN6] = NRF_PIN_PORT_TO_PIN_NUMBER(4U, 1), [NRF_SAADC_AIN7] = NRF_PIN_PORT_TO_PIN_NUMBER(3U, 1), [NRF_SAADC_VDD] = NRF_SAADC_INPUT_VDD, +#if defined(NRF_SAADC_INPUT_AVDD) [NRF_SAADC_AVDD] = NRF_SAADC_INPUT_AVDD, +#endif [NRF_SAADC_DVDD] = NRF_SAADC_INPUT_DVDD, }; #endif @@ -231,6 +233,7 @@ static int adc_nrfx_channel_setup(const struct device *dev, return -EINVAL; } +#if NRF_SAADC_HAS_CH_GAIN switch (channel_cfg->gain) { #if defined(SAADC_CH_CONFIG_GAIN_Gain1_6) case ADC_GAIN_1_6: @@ -284,6 +287,9 @@ static int adc_nrfx_channel_setup(const struct device *dev, break; #endif default: +#else + if (channel_cfg->gain != ADC_GAIN_1) { +#endif /* defined(NRF_SAADC_HAS_CH_GAIN) */ LOG_ERR("Selected ADC gain is not valid"); return -EINVAL; } From 29c0626e5120f3795f31ee7cae3f57f1dba47d9b Mon Sep 17 00:00:00 2001 From: Nikodem Kastelik Date: Mon, 9 Jun 2025 15:35:18 +0200 Subject: [PATCH 0015/2141] [nrf fromtree] manifest: update hal_nordic revision to integrate nrfx 3.12.1 New nrfx release contains fixes for SPIM and GRTC driver. Signed-off-by: Nikodem Kastelik (cherry picked from commit 59334fa41efa452995989fd46895fd35b27d411f) --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index b8b35cb5ef8b..53b29c849ca5 100644 --- a/west.yml +++ b/west.yml @@ -200,7 +200,7 @@ manifest: groups: - hal - name: hal_nordic - revision: 1f169d927e367eb1e161972e9504da5aa1f10c42 + revision: 6e39d4f2b078afaebdb84875089486152fcacb9c path: modules/hal/nordic groups: - hal From d324d762445ac06a7d59fbec0407685419ed5ab3 Mon Sep 17 00:00:00 2001 From: Tomasz Chyrowicz Date: Mon, 26 May 2025 16:47:50 +0200 Subject: [PATCH 0016/2141] [nrf fromtree] sysbuild: Allow to use file suffix DTS overlays Allow to add an image-specific DTS overlay, that is applied based on the FILE_SUFFIX. Up to this point, it was possible to specify such Kconfig files (sysbuild/_.conf), but it did not work with dts overlays (sysbuild/_.overlay). This commit aligns the logic of finding configuration files for both scenarios mentioned above. Ref: NCSDK-NONE Signed-off-by: Tomasz Chyrowicz (cherry picked from commit 13a0f0504c6d1a04b7cc658613e313af6bed6cd9) --- .../cmake/modules/sysbuild_extensions.cmake | 27 +++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/share/sysbuild/cmake/modules/sysbuild_extensions.cmake b/share/sysbuild/cmake/modules/sysbuild_extensions.cmake index db6e60f9ab7c..75778f655a86 100644 --- a/share/sysbuild/cmake/modules/sysbuild_extensions.cmake +++ b/share/sysbuild/cmake/modules/sysbuild_extensions.cmake @@ -261,7 +261,7 @@ function(ExternalZephyrProject_Add) set(sysbuild_image_conf_dir ${APP_DIR}/sysbuild) set(sysbuild_image_name_conf_dir ${APP_DIR}/sysbuild/${ZBUILD_APPLICATION}) # User defined `-D_CONF_FILE=` takes precedence over anything else. - if (NOT ${ZBUILD_APPLICATION}_CONF_FILE) + if(NOT ${ZBUILD_APPLICATION}_CONF_FILE) if(EXISTS ${sysbuild_image_name_conf_dir}) set(${ZBUILD_APPLICATION}_APPLICATION_CONFIG_DIR ${sysbuild_image_name_conf_dir} CACHE INTERNAL "Application configuration dir controlled by sysbuild" @@ -275,7 +275,7 @@ function(ExternalZephyrProject_Add) NAMES ${ZBUILD_APPLICATION}.conf SUFFIX ${FILE_SUFFIX} ) - if (NOT (${ZBUILD_APPLICATION}_OVERLAY_CONFIG OR ${ZBUILD_APPLICATION}_EXTRA_CONF_FILE) + if(NOT (${ZBUILD_APPLICATION}_OVERLAY_CONFIG OR ${ZBUILD_APPLICATION}_EXTRA_CONF_FILE) AND EXISTS ${sysbuild_image_conf_fragment} ) set(${ZBUILD_APPLICATION}_EXTRA_CONF_FILE ${sysbuild_image_conf_fragment} @@ -283,12 +283,23 @@ function(ExternalZephyrProject_Add) ) endif() - # Check for overlay named .overlay. - set(sysbuild_image_dts_overlay ${sysbuild_image_conf_dir}/${ZBUILD_APPLICATION}.overlay) - if (NOT ${ZBUILD_APPLICATION}_DTC_OVERLAY_FILE AND EXISTS ${sysbuild_image_dts_overlay}) - set(${ZBUILD_APPLICATION}_DTC_OVERLAY_FILE ${sysbuild_image_dts_overlay} - CACHE INTERNAL "devicetree overlay file defined by main application" - ) + if(NOT ${ZBUILD_APPLICATION}_DTC_OVERLAY_FILE) + # Check for overlay named .overlay. + set(sysbuild_image_dts_overlay_files ${sysbuild_image_conf_dir}/${ZBUILD_APPLICATION}.overlay) + + # Check for overlay named _.overlay. + if(FILE_SUFFIX) + list(PREPEND sysbuild_image_dts_overlay_files ${sysbuild_image_conf_dir}/${ZBUILD_APPLICATION}_${FILE_SUFFIX}.overlay) + endif() + + foreach(overlay_file ${sysbuild_image_dts_overlay_files}) + if(EXISTS ${overlay_file}) + set(${ZBUILD_APPLICATION}_DTC_OVERLAY_FILE ${overlay_file} + CACHE INTERNAL "devicetree overlay file defined by main application" + ) + break() + endif() + endforeach() endif() endif() From 9d98e46b5b4c49c9f86f2b2db4dc01bacdf571f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Stasiak?= Date: Wed, 11 Jun 2025 09:17:05 +0200 Subject: [PATCH 0017/2141] [nrf fromtree] tests: boards: nrf: i2c_slave: allow more instances MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Allow more TWIS instances to be tested. Signed-off-by: Michał Stasiak (cherry picked from commit f9be8753f5187bef7d9c2c84428b4ef13d3e1499) --- tests/boards/nrf/i2c/i2c_slave/src/main.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/boards/nrf/i2c/i2c_slave/src/main.c b/tests/boards/nrf/i2c/i2c_slave/src/main.c index 1de4b16bc2c6..403c85682908 100644 --- a/tests/boards/nrf/i2c/i2c_slave/src/main.c +++ b/tests/boards/nrf/i2c/i2c_slave/src/main.c @@ -21,8 +21,14 @@ #define I2C_S_INSTANCE 1 #elif CONFIG_NRFX_TWIS2 #define I2C_S_INSTANCE 2 +#elif CONFIG_NRFX_TWIS20 +#define I2C_S_INSTANCE 20 +#elif CONFIG_NRFX_TWIS21 +#define I2C_S_INSTANCE 21 #elif CONFIG_NRFX_TWIS22 #define I2C_S_INSTANCE 22 +#elif CONFIG_NRFX_TWIS30 +#define I2C_S_INSTANCE 30 #elif CONFIG_NRFX_TWIS131 #define I2C_S_INSTANCE 131 #else From 0ef6cddb84188c85bdd22d50f18fe75cfbf65872 Mon Sep 17 00:00:00 2001 From: Adam Kondraciuk Date: Wed, 4 Jun 2025 11:08:29 +0200 Subject: [PATCH 0018/2141] [nrf fromtree] tests: kernel: timer: cycle64: Add support for GRTC For GRTC timer a longer timeout is required: (2 ^ 32) * 2 * 1us Signed-off-by: Adam Kondraciuk (cherry picked from commit d0785ce58fb77425858d234aa60bef6304ed53e1) --- tests/kernel/timer/cycle64/testcase.yaml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/kernel/timer/cycle64/testcase.yaml b/tests/kernel/timer/cycle64/testcase.yaml index f1a65dbb00a0..1598c07337be 100644 --- a/tests/kernel/timer/cycle64/testcase.yaml +++ b/tests/kernel/timer/cycle64/testcase.yaml @@ -14,7 +14,7 @@ tests: tags: - kernel - timer - filter: CONFIG_TIMER_HAS_64BIT_CYCLE_COUNTER + filter: CONFIG_TIMER_HAS_64BIT_CYCLE_COUNTER and not CONFIG_NRF_GRTC_TIMER arch_exclude: posix timeout: 140 slow: true @@ -22,5 +22,13 @@ tests: tags: - kernel - timer - filter: CONFIG_TIMER_HAS_64BIT_CYCLE_COUNTER + filter: CONFIG_TIMER_HAS_64BIT_CYCLE_COUNTER and not CONFIG_NRF_GRTC_TIMER arch_allow: posix + kernel.timer.cycle64.grtc: + tags: + - kernel + - timer + filter: CONFIG_TIMER_HAS_64BIT_CYCLE_COUNTER and CONFIG_NRF_GRTC_TIMER + arch_exclude: posix + timeout: 8600 + slow: true From 4d99f0a7a308498ddd97c4828f5ed2bcf21191dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Ku=C5=BAnia?= Date: Tue, 3 Jun 2025 13:15:15 +0200 Subject: [PATCH 0019/2141] [nrf fromlist] boards: nordic: nRF54L15DK: set HFXO clock latency to 854 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The HFXO used on nRF54L15 DK has the typical startup latency of 854us. Upstream PR #: 90795 Signed-off-by: Rafał Kuźnia (cherry picked from commit 488f4283923aa239d27d98f74bbcaf0c4198164d) --- boards/nordic/nrf54l15dk/nrf54l15dk_common.dtsi | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/boards/nordic/nrf54l15dk/nrf54l15dk_common.dtsi b/boards/nordic/nrf54l15dk/nrf54l15dk_common.dtsi index c030c2c55189..6740544b524a 100644 --- a/boards/nordic/nrf54l15dk/nrf54l15dk_common.dtsi +++ b/boards/nordic/nrf54l15dk/nrf54l15dk_common.dtsi @@ -108,5 +108,9 @@ pinctrl-names = "default", "sleep"; }; +&hfxo { + startup-time-us = <854>; +}; + /* Get a node label for wi-fi spi to use in shield files */ wifi_spi: &spi22 {}; From f75eb49bc4b2c7af71e81af488dcc3e268f36d79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Ku=C5=BAnia?= Date: Tue, 3 Jun 2025 13:15:23 +0200 Subject: [PATCH 0020/2141] [nrf fromlist] modules: hal_nordic: nrf_802154: set clock startup latency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The clock startup latency is now obtained from the clock driver and the nrf-802154 is now set to a value that matches hardware capabilities. Upstream PR #: 90795 Signed-off-by: Rafał Kuźnia (cherry picked from commit e40310a19b63f6df7d78f8133644bd809ebce53d) --- .../sl_opensource/platform/nrf_802154_clock_zephyr.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/hal_nordic/nrf_802154/sl_opensource/platform/nrf_802154_clock_zephyr.c b/modules/hal_nordic/nrf_802154/sl_opensource/platform/nrf_802154_clock_zephyr.c index 87aa85261e98..1ade977118e1 100644 --- a/modules/hal_nordic/nrf_802154/sl_opensource/platform/nrf_802154_clock_zephyr.c +++ b/modules/hal_nordic/nrf_802154/sl_opensource/platform/nrf_802154_clock_zephyr.c @@ -18,7 +18,11 @@ static bool hfclk_is_running; void nrf_802154_clock_init(void) { - /* Intentionally empty. */ +#ifdef NRF54L_SERIES + uint32_t clock_latency_us = z_nrf_clock_bt_ctlr_hf_get_startup_time_us(); + + nrf_802154_clock_hfclk_latency_set(clock_latency_us); +#endif } void nrf_802154_clock_deinit(void) From ecabf6ad9cc204ae103798776d8e49f0f25dea72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Stasiak?= Date: Fri, 13 Jun 2025 14:26:08 +0200 Subject: [PATCH 0021/2141] [nrf fromlist] drivers: Extend analog pins mapping for nRF54L. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Extended analog pins mappings for more nRF54L targets. Upstream PR #: 91581 Signed-off-by: Michał Stasiak (cherry picked from commit 4d7191c1485d8e3d2e3f19bc8dd17bf2ec914e4c) --- drivers/adc/adc_nrfx_saadc.c | 17 ++++++++++++++--- drivers/comparator/comparator_nrf_common.h | 11 ++++++++++- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/drivers/adc/adc_nrfx_saadc.c b/drivers/adc/adc_nrfx_saadc.c index 8072e0c7eafd..a9cc1c4f36b9 100644 --- a/drivers/adc/adc_nrfx_saadc.c +++ b/drivers/adc/adc_nrfx_saadc.c @@ -54,7 +54,7 @@ static const uint32_t saadc_psels[NRF_SAADC_DVDD + 1] = { [NRF_SAADC_AVDD] = NRF_SAADC_INPUT_AVDD, [NRF_SAADC_DVDD] = NRF_SAADC_INPUT_DVDD, }; -#elif defined(CONFIG_SOC_COMPATIBLE_NRF54LX) +#elif defined(NRF54LM20A_ENGA_XXAA) static const uint32_t saadc_psels[NRF_SAADC_DVDD + 1] = { [NRF_SAADC_AIN0] = NRF_PIN_PORT_TO_PIN_NUMBER(0U, 1), [NRF_SAADC_AIN1] = NRF_PIN_PORT_TO_PIN_NUMBER(31U, 1), @@ -65,9 +65,20 @@ static const uint32_t saadc_psels[NRF_SAADC_DVDD + 1] = { [NRF_SAADC_AIN6] = NRF_PIN_PORT_TO_PIN_NUMBER(4U, 1), [NRF_SAADC_AIN7] = NRF_PIN_PORT_TO_PIN_NUMBER(3U, 1), [NRF_SAADC_VDD] = NRF_SAADC_INPUT_VDD, -#if defined(NRF_SAADC_INPUT_AVDD) [NRF_SAADC_AVDD] = NRF_SAADC_INPUT_AVDD, -#endif + [NRF_SAADC_DVDD] = NRF_SAADC_INPUT_DVDD, +}; +#elif defined(NRF54LV10A_ENGA_XXAA) +static const uint32_t saadc_psels[NRF_SAADC_DVDD + 1] = { + [NRF_SAADC_AIN0] = NRF_PIN_PORT_TO_PIN_NUMBER(0U, 1), + [NRF_SAADC_AIN1] = NRF_PIN_PORT_TO_PIN_NUMBER(1U, 1), + [NRF_SAADC_AIN2] = NRF_PIN_PORT_TO_PIN_NUMBER(2U, 1), + [NRF_SAADC_AIN3] = NRF_PIN_PORT_TO_PIN_NUMBER(3U, 1), + [NRF_SAADC_AIN4] = NRF_PIN_PORT_TO_PIN_NUMBER(7U, 1), + [NRF_SAADC_AIN5] = NRF_PIN_PORT_TO_PIN_NUMBER(10U, 1), + [NRF_SAADC_AIN6] = NRF_PIN_PORT_TO_PIN_NUMBER(11U, 1), + [NRF_SAADC_AIN7] = NRF_PIN_PORT_TO_PIN_NUMBER(12U, 1), + [NRF_SAADC_VDD] = NRF_SAADC_INPUT_VDD, [NRF_SAADC_DVDD] = NRF_SAADC_INPUT_DVDD, }; #endif diff --git a/drivers/comparator/comparator_nrf_common.h b/drivers/comparator/comparator_nrf_common.h index c45e6676e2d8..e86fc9f63692 100644 --- a/drivers/comparator/comparator_nrf_common.h +++ b/drivers/comparator/comparator_nrf_common.h @@ -28,7 +28,7 @@ static const uint32_t shim_nrf_comp_ain_map[] = { NRF_PIN_PORT_TO_PIN_NUMBER(12U, 1), NRF_PIN_PORT_TO_PIN_NUMBER(13U, 1), NRF_PIN_PORT_TO_PIN_NUMBER(14U, 1), -#elif defined(CONFIG_SOC_COMPATIBLE_NRF54LX) +#elif defined(NRF54LM20A_ENGA_XXAA) NRF_PIN_PORT_TO_PIN_NUMBER(0U, 1), NRF_PIN_PORT_TO_PIN_NUMBER(31U, 1), NRF_PIN_PORT_TO_PIN_NUMBER(30U, 1), @@ -37,6 +37,15 @@ static const uint32_t shim_nrf_comp_ain_map[] = { NRF_PIN_PORT_TO_PIN_NUMBER(5U, 1), NRF_PIN_PORT_TO_PIN_NUMBER(4U, 1), NRF_PIN_PORT_TO_PIN_NUMBER(3U, 1), +#elif defined(NRF54LV10A_ENGA_XXAA) + NRF_PIN_PORT_TO_PIN_NUMBER(0U, 1), + NRF_PIN_PORT_TO_PIN_NUMBER(1U, 1), + NRF_PIN_PORT_TO_PIN_NUMBER(2U, 1), + NRF_PIN_PORT_TO_PIN_NUMBER(3U, 1), + NRF_PIN_PORT_TO_PIN_NUMBER(7U, 1), + NRF_PIN_PORT_TO_PIN_NUMBER(10U, 1), + NRF_PIN_PORT_TO_PIN_NUMBER(11U, 1), + NRF_PIN_PORT_TO_PIN_NUMBER(12U, 1), #endif }; #endif From 11286f42e1bf5693860408640524645675027666 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Wed, 4 Jun 2025 15:03:36 +0200 Subject: [PATCH 0022/2141] [nrf fromtree] drivers: spi_nrfx_spim: Fix SPIM_REQUESTS_CLOCK() and calls to it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a follow-up to commit a0687091713431eda8b02ec737c1c1ad87bfd7da. As the SPIM_REQUESTS_CLOCK() macro changed the type of its parameter, all of the calls to it need to be updated accordingly. Also the call to DT_NODELABEL() needs to be removed from that macro as DT_CLOCKS_CTLR() already returns a node identifier. Signed-off-by: Andrzej Głąbek (cherry picked from commit ec06e638f2d39b0a096a9cecea808a1bc37a0e87) --- drivers/spi/spi_nrfx_spim.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/spi/spi_nrfx_spim.c b/drivers/spi/spi_nrfx_spim.c index 21a454c5ff8f..dcfee1c5ede2 100644 --- a/drivers/spi/spi_nrfx_spim.c +++ b/drivers/spi/spi_nrfx_spim.c @@ -45,7 +45,7 @@ LOG_MODULE_REGISTER(spi_nrfx_spim, CONFIG_SPI_LOG_LEVEL); #if defined(CONFIG_CLOCK_CONTROL_NRF2_GLOBAL_HSFLL) #define SPIM_REQUESTS_CLOCK(node) \ - DT_NODE_HAS_COMPAT(DT_NODELABEL(DT_CLOCKS_CTLR(node)), nordic_nrf_hsfll_global) + DT_NODE_HAS_COMPAT(DT_CLOCKS_CTLR(node), nordic_nrf_hsfll_global) #define SPIM_REQUESTS_CLOCK_OR(node) SPIM_REQUESTS_CLOCK(node) || #if (DT_FOREACH_STATUS_OKAY(nordic_nrf_spim, SPIM_REQUESTS_CLOCK_OR) 0) #define USE_CLOCK_REQUESTS 1 @@ -56,7 +56,7 @@ LOG_MODULE_REGISTER(spi_nrfx_spim, CONFIG_SPI_LOG_LEVEL); BUILD_ASSERT(!IS_ENABLED(CONFIG_PM_DEVICE_SYSTEM_MANAGED)); #endif #else -#define SPIM_REQUESTS_CLOCK(idx) 0 +#define SPIM_REQUESTS_CLOCK(node) 0 #endif struct spi_nrfx_data { @@ -799,7 +799,7 @@ static int spi_nrfx_init(const struct device *dev) #if defined(CONFIG_CLOCK_CONTROL_NRF2_GLOBAL_HSFLL_INIT_PRIORITY) && \ CONFIG_SPI_INIT_PRIORITY < CONFIG_CLOCK_CONTROL_NRF2_GLOBAL_HSFLL_INIT_PRIORITY #define SPIM_INIT_PRIORITY(idx) \ - COND_CODE_1(SPIM_REQUESTS_CLOCK(idx), \ + COND_CODE_1(SPIM_REQUESTS_CLOCK(SPIM(idx)), \ (UTIL_INC(CONFIG_CLOCK_CONTROL_NRF2_GLOBAL_HSFLL_INIT_PRIORITY)), \ (CONFIG_SPI_INIT_PRIORITY)) #else @@ -858,8 +858,8 @@ static int spi_nrfx_init(const struct device *dev) .wake_gpiote = WAKE_GPIOTE_INSTANCE(SPIM(idx)), \ IF_ENABLED(CONFIG_DCACHE, \ (.mem_attr = SPIM_GET_MEM_ATTR(idx),)) \ - IF_ENABLED(USE_CLOCK_REQUESTS, \ - (.clk_dev = SPIM_REQUESTS_CLOCK(idx) \ + IF_ENABLED(USE_CLOCK_REQUESTS, \ + (.clk_dev = SPIM_REQUESTS_CLOCK(SPIM(idx)) \ ? DEVICE_DT_GET(DT_CLOCKS_CTLR(SPIM(idx))) \ : NULL, \ .clk_spec = { \ From 364eba60a02157520c5a2c1155ecc221528a6fcf Mon Sep 17 00:00:00 2001 From: Carles Cufi Date: Thu, 5 Jun 2025 16:52:30 +0200 Subject: [PATCH 0023/2141] [nrf fromtree] include: sys_clock: Fix compilation when SYS_CLOCK_EXISTS is disabled If `CONFIG_SYS_CLOCK_EXISTS=n`, then `CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC` will likely not be defined at all. Fix the compilation by moving the check for it being `== 0` to a separate preprocessor #if statement. Signed-off-by: Carles Cufi (cherry picked from commit 03f46db8591e191eaf8744ab36f8401aac102def) --- include/zephyr/sys_clock.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/zephyr/sys_clock.h b/include/zephyr/sys_clock.h index 6c3589a51028..5f31d585ff13 100644 --- a/include/zephyr/sys_clock.h +++ b/include/zephyr/sys_clock.h @@ -162,10 +162,11 @@ typedef struct { /** @endcond */ #ifndef CONFIG_TIMER_READS_ITS_FREQUENCY_AT_RUNTIME -#if defined(CONFIG_SYS_CLOCK_EXISTS) && \ - (CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC == 0) +#if defined(CONFIG_SYS_CLOCK_EXISTS) +#if CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC == 0 #error "SYS_CLOCK_HW_CYCLES_PER_SEC must be non-zero!" -#endif +#endif /* CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC == 0 */ +#endif /* CONFIG_SYS_CLOCK_EXISTS */ #endif /* CONFIG_TIMER_READS_ITS_FREQUENCY_AT_RUNTIME */ /* kernel clocks */ From 7038ae2f234221e3cda6c35becc3eb09bc36f19b Mon Sep 17 00:00:00 2001 From: Aleksandr Khromykh Date: Mon, 2 Jun 2025 14:14:16 +0200 Subject: [PATCH 0024/2141] [nrf fromtree] tests: bluetooth: tester: fix configuration to use max fwid length Commit sets max possible number of tx and rx segments to not adapt them anymore. Signed-off-by: Aleksandr Khromykh (cherry picked from commit a046f25fe79e02902b61c15c963064080d3e22d5) --- tests/bluetooth/tester/overlay-mesh.conf | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/bluetooth/tester/overlay-mesh.conf b/tests/bluetooth/tester/overlay-mesh.conf index 04e6c074e214..9def34c62acf 100644 --- a/tests/bluetooth/tester/overlay-mesh.conf +++ b/tests/bluetooth/tester/overlay-mesh.conf @@ -19,9 +19,9 @@ CONFIG_BT_MESH_CFG_CLI=y CONFIG_BT_MESH_HEALTH_CLI=y CONFIG_BT_MESH_FRIEND=y CONFIG_BT_MESH_FRIEND_QUEUE_SIZE=32 -CONFIG_BT_MESH_RX_SEG_MAX=13 -CONFIG_BT_MESH_TX_SEG_MAX=8 -CONFIG_BT_MESH_TX_SEG_MSG_COUNT=3 +CONFIG_BT_MESH_RX_SEG_MAX=32 +CONFIG_BT_MESH_TX_SEG_MAX=32 +CONFIG_BT_MESH_TX_SEG_MSG_COUNT=10 CONFIG_BT_MESH_LPN_POLL_TIMEOUT=100 CONFIG_BT_MESH_PROVISIONER=y CONFIG_BT_MESH_CDB=y @@ -38,7 +38,6 @@ CONFIG_BT_MESH_LARGE_COMP_DATA_CLI=y CONFIG_BT_MESH_LARGE_COMP_DATA_SRV=y CONFIG_BT_MESH_SAR_CFG_SRV=y CONFIG_BT_MESH_SAR_CFG_CLI=y -CONFIG_BT_MESH_TX_SEG_MSG_COUNT=10 CONFIG_BT_MESH_RPR_SRV=y CONFIG_BT_MESH_RPR_CLI=y CONFIG_BT_MESH_RPR_AD_TYPES_MAX=2 From 576de35b2fe8ec34351cf0b2bc05d1332ade2b80 Mon Sep 17 00:00:00 2001 From: Aleksandr Khromykh Date: Mon, 2 Jun 2025 14:15:47 +0200 Subject: [PATCH 0025/2141] [nrf fromtree] bluetooth: mesh: clarify mesh dfu fwid max length Commit changes BT_MESH_DFU_FWID_MAXLEN option to be compliant with BLE Mesh specification. Signed-off-by: Aleksandr Khromykh (cherry picked from commit 2411238196eaba0f201a9e842c9e9a9f1b8670d7) --- subsys/bluetooth/mesh/Kconfig | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index b876e88dae69..e51ad2ccac0e 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -1085,10 +1085,15 @@ menu "Firmware Update model configuration" config BT_MESH_DFU_FWID_MAXLEN int "DFU FWID max length" - default 16 + default 106 range 0 106 help - This value defines the maximum length of an image's firmware ID. + This value defines the maximum length of the vendor-specific version information + that the mesh stack can manage, describing the image. Please note that + only 106 octets size allows the device to be compliant with + the Bluetooth Mesh DFU specification. If smaller than 106 octets are set, + then the device will fail with managing firmware images that have + a longer vendor-specific version information. config BT_MESH_DFU_METADATA_MAXLEN int "DFU metadata max length" From abcf8fc2c12403f5912344a41f5af259615f110a Mon Sep 17 00:00:00 2001 From: Carles Cufi Date: Fri, 6 Jun 2025 10:53:21 +0200 Subject: [PATCH 0026/2141] [nrf fromtree] kernel: Guard SYS_CLOCK_HW_CYCLES_PER_SEC to avoid spurious empty macro MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If SYS_CLOCK_EXISTS is not enabled, then the SYS_CLOCK_HW_CYCLES_PER_SEC still gets created, but with no value. This causes the code generation in misc/generated/CMakeLists.txt to create an empty assembly macro: `.equ  CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC,` which then causes a build error. Disable SYS_CLOCK_HW_CYCLES_PER_SEC entirely when SYS_CLOCK_EXISTS is disabled to fix this. This is a follow-up to 03f46db8591e191eaf8744ab36f8401aac102def. Signed-off-by: Carles Cufi (cherry picked from commit 61cdcb33839c3177db528a0869532b639819aea4) --- kernel/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/Kconfig b/kernel/Kconfig index 6e7058ffc431..536a6624f522 100644 --- a/kernel/Kconfig +++ b/kernel/Kconfig @@ -828,6 +828,7 @@ config SYS_CLOCK_TICKS_PER_SEC config SYS_CLOCK_HW_CYCLES_PER_SEC int "System clock's h/w timer frequency" default 0 if TIMER_READS_ITS_FREQUENCY_AT_RUNTIME + depends on SYS_CLOCK_EXISTS help This option specifies the frequency of the hardware timer used for the system clock (in Hz). This option is set by the SOC's or board's Kconfig file From d58d68a1c7b22fbb7d79313bb749b9a1fc4d85ee Mon Sep 17 00:00:00 2001 From: Arunmani Alagarsamy Date: Fri, 6 Jun 2025 12:05:00 +0530 Subject: [PATCH 0027/2141] [nrf fromtree] net: l2: wifi: Fix mode change issue in Wi-Fi shell The help message for the wifi mode -s command indicates it sets the Wi-Fi mode to station. However, the Zephyr Wi-Fi shell subsystem was incorrectly using a get operation instead of set. This commit corrects the behavior to properly set the Wi-Fi mode, aligning the implementation with the help message. Signed-off-by: Arunmani Alagarsamy (cherry picked from commit 0faba15717fbee8ac6a78a77b2658a152cd30a1e) --- subsys/net/l2/wifi/wifi_shell.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 0b8257695dd9..c5dc9d889770 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -2865,11 +2865,11 @@ void parse_mode_args_to_params(const struct shell *sh, int argc, {"monitor", no_argument, 0, 'm'}, {"ap", no_argument, 0, 'a'}, {"softap", no_argument, 0, 'k'}, - {"get", no_argument, 0, 'g'}, {"help", no_argument, 0, 'h'}, {0, 0, 0, 0}}; - while ((opt = getopt_long(argc, argv, "i:smtpakgh", + mode->oper = WIFI_MGMT_GET; + while ((opt = getopt_long(argc, argv, "i:smtpakh", long_options, &opt_index)) != -1) { state = getopt_state_get(); switch (opt) { @@ -2889,10 +2889,6 @@ void parse_mode_args_to_params(const struct shell *sh, int argc, mode->mode |= WIFI_SOFTAP_MODE; opt_num++; break; - case 'g': - mode->oper = WIFI_MGMT_GET; - opt_num++; - break; case 'i': mode->if_index = (uint8_t)atoi(state->optarg); /* Don't count iface as it's common for both get and set */ @@ -2908,7 +2904,7 @@ void parse_mode_args_to_params(const struct shell *sh, int argc, } } - if (opt_num == 0) { + if (opt_num != 0) { mode->oper = WIFI_MGMT_SET; } } @@ -4064,9 +4060,8 @@ SHELL_SUBCMD_ADD((wifi), mode, NULL, "[-a, --ap] : AP mode\n" "[-k, --softap] : Softap mode\n" "[-h, --help] : Help\n" - "[-g, --get] : Get current mode for a specific interface index\n" "Usage: Get operation example for interface index 1\n" - "wifi mode -g -i1\n" + "wifi mode -i1\n" "Set operation example for interface index 1 - set station+promiscuous\n" "wifi mode -i1 -sp.\n", cmd_wifi_mode, From 2335e7f94853e6850bf9254b82d43a8a8243dc59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Mon, 9 Jun 2025 07:32:16 +0200 Subject: [PATCH 0028/2141] [nrf fromtree] soc: nordic: common: Fix HAS_HW_NRF_NFCT condition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Include nordic,nrf-nfct-v2 compatible in the option. Signed-off-by: Krzysztof Chruściński (cherry picked from commit 2d82970710d1f8da131b9f10d77bc0c60e544cca) --- soc/nordic/common/Kconfig.peripherals | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/soc/nordic/common/Kconfig.peripherals b/soc/nordic/common/Kconfig.peripherals index 5a6e820efcb9..ce91800a6150 100644 --- a/soc/nordic/common/Kconfig.peripherals +++ b/soc/nordic/common/Kconfig.peripherals @@ -118,7 +118,8 @@ config HAS_HW_NRF_MWU def_bool $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF_MWU)) config HAS_HW_NRF_NFCT - def_bool $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF_NFCT)) + def_bool $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF_NFCT)) || \ + $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF_NFCT_V2)) config HAS_HW_NRF_NVMC_PE def_bool $(dt_nodelabel_bool_prop,flash_controller,partial-erase) From 9ae44c864700b51d8dc4e3bdabf994420b5c4d66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Thu, 12 Jun 2025 10:23:27 +0200 Subject: [PATCH 0029/2141] [nrf fromtree] dts: vendor: nordic: Fix nfct compatible MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use nordic,nrf-nfct-v2 compatible in the main nrf54h20 devicetree description. Signed-off-by: Krzysztof Chruściński (cherry picked from commit b84dd5b600e0749f7fdcaa372dd05b22944f1916) --- dts/arm/nordic/nrf54h20_cpuapp.dtsi | 4 ---- dts/vendor/nordic/nrf54h20.dtsi | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/dts/arm/nordic/nrf54h20_cpuapp.dtsi b/dts/arm/nordic/nrf54h20_cpuapp.dtsi index 15eac9c5d197..c56df42ddd5b 100644 --- a/dts/arm/nordic/nrf54h20_cpuapp.dtsi +++ b/dts/arm/nordic/nrf54h20_cpuapp.dtsi @@ -59,7 +59,3 @@ wdt011: &cpuapp_wdt011 {}; &grtc { interrupts = <109 NRF_DEFAULT_IRQ_PRIORITY>; }; - -&nfct { - compatible = "nordic,nrf-nfct-v2"; -}; diff --git a/dts/vendor/nordic/nrf54h20.dtsi b/dts/vendor/nordic/nrf54h20.dtsi index 96d4ff53af1c..5fcb941aaae2 100644 --- a/dts/vendor/nordic/nrf54h20.dtsi +++ b/dts/vendor/nordic/nrf54h20.dtsi @@ -918,7 +918,7 @@ }; nfct: nfct@985000 { - compatible = "nordic,nrf-nfct"; + compatible = "nordic,nrf-nfct-v2"; reg = <0x985000 0x1000>; status = "disabled"; interrupts = <389 NRF_DEFAULT_IRQ_PRIORITY>; From b0f414596b7e6ebfa0d86537e5b1e63bb76bf36c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Thu, 12 Jun 2025 10:21:42 +0200 Subject: [PATCH 0030/2141] [nrf fromtree] soc: nordic: nrf54h: Allow using NFCT pins as gpios on cpurad MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit NFCT is by default assigned to application so DT node does not need to be enabled or reserved in DT to have access to NFCT registers. On cpurad NFCT must be reserved to enable register access and then antenna pins can be configured as gpios. Signed-off-by: Krzysztof Chruściński (cherry picked from commit 1dc42fc22709ed1d1bf5d5ea0f0c5b2c59ac2d5a) --- soc/nordic/nrf54h/soc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/soc/nordic/nrf54h/soc.c b/soc/nordic/nrf54h/soc.c index c1849ab3a239..e053953b821e 100644 --- a/soc/nordic/nrf54h/soc.c +++ b/soc/nordic/nrf54h/soc.c @@ -153,7 +153,9 @@ void soc_early_init_hook(void) nrf_spu_periph_perm_dmasec_set(spu, nrf_address_slave_get(ccm030_addr), true); #endif - if (DT_NODE_HAS_STATUS(DT_NODELABEL(nfct), disabled) && + if (((IS_ENABLED(CONFIG_SOC_NRF54H20_CPUAPP) && + DT_NODE_HAS_STATUS(DT_NODELABEL(nfct), disabled)) || + DT_NODE_HAS_STATUS(DT_NODELABEL(nfct), reserved)) && DT_PROP_OR(DT_NODELABEL(nfct), nfct_pins_as_gpios, 0)) { nrf_nfct_pad_config_enable_set(NRF_NFCT, false); } From 1f9b5b32f8b2d9db4273e30e7e82c82c4de77262 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Thu, 12 Jun 2025 10:28:36 +0200 Subject: [PATCH 0031/2141] [nrf fromtree] dts: bindings: nordic-nrf-nfct-v2: Extend description MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add information about nfct node status. For cpuapp status is irrelevant because NFCT is by default assigned to cpuapp but for cpurad node needs to have reserved status. Signed-off-by: Krzysztof Chruściński (cherry picked from commit 9caab5b23f3cd34d318cb3ea13c187ef75364325) --- dts/bindings/net/wireless/nordic,nrf-nfct-v2.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dts/bindings/net/wireless/nordic,nrf-nfct-v2.yaml b/dts/bindings/net/wireless/nordic,nrf-nfct-v2.yaml index e6b34aff3ecc..f7602739114c 100644 --- a/dts/bindings/net/wireless/nordic,nrf-nfct-v2.yaml +++ b/dts/bindings/net/wireless/nordic,nrf-nfct-v2.yaml @@ -12,7 +12,8 @@ properties: type: boolean description: | When enabled this property will configure pins dedicated to NFCT - peripheral as regular GPIOs. This property must be applied in cpuapp - if NFCT pins are intended to be used as regular GPIOs by any core. + peripheral as regular GPIOs. If this property is applied in cpuapp then node + can be disabled or reserved (because NFCT is by default assigned to cpuapp). + If property is applied in cpurad CPU then node must be reserved. NFC pins in nRF54H series: P2.10 and P2.11 From e3a33ba9b8c3147958c82d3e0298f45edee73062 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Fri, 6 Jun 2025 15:08:10 +0200 Subject: [PATCH 0032/2141] [nrf fromtree] net: mqtt: Allow to bind client to a specific interface Add a new "if_name" pointer to the transport configuration structure, allowing the application to bind MQTT client to a specific network interface. Signed-off-by: Robert Lubos (cherry picked from commit 35af68b840d7778afbe7e0566ab45d1c0c511937) --- include/zephyr/net/mqtt.h | 5 +++++ .../net/lib/mqtt/mqtt_transport_socket_tcp.c | 22 +++++++++++++++++-- .../net/lib/mqtt/mqtt_transport_socket_tls.c | 18 +++++++++++++++ 3 files changed, 43 insertions(+), 2 deletions(-) diff --git a/include/zephyr/net/mqtt.h b/include/zephyr/net/mqtt.h index d5dce240230a..b992714afd32 100644 --- a/include/zephyr/net/mqtt.h +++ b/include/zephyr/net/mqtt.h @@ -809,6 +809,11 @@ struct mqtt_transport { */ enum mqtt_transport_type type; + /** Name of the interface that the MQTT client instance should be bound to. + * Leave as NULL if not specified. + */ + const char *if_name; + /** Use either unsecured TCP or secured TLS transport */ union { /** TCP socket transport for MQTT */ diff --git a/subsys/net/lib/mqtt/mqtt_transport_socket_tcp.c b/subsys/net/lib/mqtt/mqtt_transport_socket_tcp.c index ffb8bcdb6830..58f37857bb22 100644 --- a/subsys/net/lib/mqtt/mqtt_transport_socket_tcp.c +++ b/subsys/net/lib/mqtt/mqtt_transport_socket_tcp.c @@ -29,6 +29,26 @@ int mqtt_client_tcp_connect(struct mqtt_client *client) return -errno; } + NET_DBG("Created socket %d", client->transport.tcp.sock); + + if (client->transport.if_name != NULL) { + struct ifreq ifname = { 0 }; + + strncpy(ifname.ifr_name, client->transport.if_name, + sizeof(ifname.ifr_name) - 1); + + ret = zsock_setsockopt(client->transport.tcp.sock, SOL_SOCKET, + SO_BINDTODEVICE, &ifname, + sizeof(struct ifreq)); + if (ret < 0) { + NET_ERR("Failed to bind ot interface %s error (%d)", + ifname.ifr_name, -errno); + goto error; + } + + NET_DBG("Bound to interface %s", ifname.ifr_name); + } + #if defined(CONFIG_SOCKS) if (client->transport.proxy.addrlen != 0) { ret = setsockopt(client->transport.tcp.sock, @@ -41,8 +61,6 @@ int mqtt_client_tcp_connect(struct mqtt_client *client) } #endif - NET_DBG("Created socket %d", client->transport.tcp.sock); - size_t peer_addr_size = sizeof(struct sockaddr_in6); if (broker->sa_family == AF_INET) { diff --git a/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c b/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c index a33cee5aecfd..2ff337eef343 100644 --- a/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c +++ b/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c @@ -32,6 +32,24 @@ int mqtt_client_tls_connect(struct mqtt_client *client) NET_DBG("Created socket %d", client->transport.tls.sock); + if (client->transport.if_name != NULL) { + struct ifreq ifname = { 0 }; + + strncpy(ifname.ifr_name, client->transport.if_name, + sizeof(ifname.ifr_name) - 1); + + ret = zsock_setsockopt(client->transport.tls.sock, SOL_SOCKET, + SO_BINDTODEVICE, &ifname, + sizeof(struct ifreq)); + if (ret < 0) { + NET_ERR("Failed to bind ot interface %s error (%d)", + ifname.ifr_name, -errno); + goto error; + } + + NET_DBG("Bound to interface %s", ifname.ifr_name); + } + #if defined(CONFIG_SOCKS) if (client->transport.proxy.addrlen != 0) { ret = setsockopt(client->transport.tls.sock, From cc1ccd035ce8e4836d26ec1d65c1c322b5e12d94 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Mon, 9 Jun 2025 11:34:42 +0200 Subject: [PATCH 0033/2141] [nrf fromtree] net: sockets_offload: Allow to enable/disable DNS offload at runtime Add new socket offloading functions, allowing to enable/disable offloaded DNS implementation at runtime. This may be useful if there is a mix of offloaded/native network interfaces in the system, so the application can choose which DNS backend to use. Signed-off-by: Robert Lubos (cherry picked from commit b18bc7cc3e484e8988142a5986d4fc712a326859) --- include/zephyr/net/socket_offload.h | 33 +++++++++++++++++++++++++ subsys/net/lib/sockets/getaddrinfo.c | 4 +-- subsys/net/lib/sockets/socket_offload.c | 30 +++++++++++++++++++++- 3 files changed, 64 insertions(+), 3 deletions(-) diff --git a/include/zephyr/net/socket_offload.h b/include/zephyr/net/socket_offload.h index 988d0fb686b3..4dcf27250b44 100644 --- a/include/zephyr/net/socket_offload.h +++ b/include/zephyr/net/socket_offload.h @@ -41,6 +41,39 @@ struct socket_dns_offload { */ void socket_offload_dns_register(const struct socket_dns_offload *ops); +/** + * @brief Deregister an offloaded socket DNS API interface. + * + * @param ops A pointer to the offloaded socket DNS API interface. + * + * @retval 0 On success + * @retval -EINVAL Offloaded DNS API was not regsitered. + */ +int socket_offload_dns_deregister(const struct socket_dns_offload *ops); + +/** + * @brief Enable/disable DNS offloading at runtime. + * + * @param enable Whether to enable or disable the DNS offloading. + */ +void socket_offload_dns_enable(bool enable); + +/** + * @brief Check if DNS offloading is enabled. + * + * @retval true DNS offloaded API is registered and enabled. + * @retval false DNS offloading is disabled. + */ +#if defined(CONFIG_NET_SOCKETS_OFFLOAD) +bool socket_offload_dns_is_enabled(void); +#else +static inline bool socket_offload_dns_is_enabled(void) +{ + return false; +} +#endif /* defined(CONFIG_NET_SOCKETS_OFFLOAD) */ + + /** @cond INTERNAL_HIDDEN */ int socket_offload_getaddrinfo(const char *node, const char *service, diff --git a/subsys/net/lib/sockets/getaddrinfo.c b/subsys/net/lib/sockets/getaddrinfo.c index 86ee417d929e..a53f3a005a47 100644 --- a/subsys/net/lib/sockets/getaddrinfo.c +++ b/subsys/net/lib/sockets/getaddrinfo.c @@ -433,7 +433,7 @@ int zsock_getaddrinfo(const char *host, const char *service, const struct zsock_addrinfo *hints, struct zsock_addrinfo **res) { - if (IS_ENABLED(CONFIG_NET_SOCKETS_OFFLOAD)) { + if (socket_offload_dns_is_enabled()) { return socket_offload_getaddrinfo(host, service, hints, res); } @@ -471,7 +471,7 @@ int zsock_getaddrinfo(const char *host, const char *service, void zsock_freeaddrinfo(struct zsock_addrinfo *ai) { - if (IS_ENABLED(CONFIG_NET_SOCKETS_OFFLOAD)) { + if (socket_offload_dns_is_enabled()) { socket_offload_freeaddrinfo(ai); return; } diff --git a/subsys/net/lib/sockets/socket_offload.c b/subsys/net/lib/sockets/socket_offload.c index b6c2ef4fd64a..3e4ea3b8bbec 100644 --- a/subsys/net/lib/sockets/socket_offload.c +++ b/subsys/net/lib/sockets/socket_offload.c @@ -12,7 +12,8 @@ LOG_MODULE_REGISTER(net_socket_offload, CONFIG_NET_SOCKETS_LOG_LEVEL); #include "sockets_internal.h" -const struct socket_dns_offload *dns_offload; +static const struct socket_dns_offload *dns_offload; +static bool dns_offload_enabled; void socket_offload_dns_register(const struct socket_dns_offload *ops) { @@ -20,6 +21,33 @@ void socket_offload_dns_register(const struct socket_dns_offload *ops) __ASSERT_NO_MSG(dns_offload == NULL); dns_offload = ops; + + socket_offload_dns_enable(true); +} + +int socket_offload_dns_deregister(const struct socket_dns_offload *ops) +{ + __ASSERT_NO_MSG(ops != NULL); + + if (dns_offload != ops) { + return -EINVAL; + } + + dns_offload = NULL; + + socket_offload_dns_enable(false); + + return 0; +} + +void socket_offload_dns_enable(bool enable) +{ + dns_offload_enabled = enable; +} + +bool socket_offload_dns_is_enabled(void) +{ + return (dns_offload != NULL) && dns_offload_enabled; } int socket_offload_getaddrinfo(const char *node, const char *service, From 263a1a8fcdcbecdce7bb3a1129f75b4b988b1ec7 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Tue, 10 Jun 2025 14:52:49 +0200 Subject: [PATCH 0034/2141] [nrf fromtree] net: stats: Use correct format specifiers when printing stats net_stats_t type is an unsigned type, therefore %u should be used instead of %d when printing values of this type, otherwise negative values will be printer if INT32_MAX is exceeded. Signed-off-by: Robert Lubos (cherry picked from commit b877d2c1fe4649aaee3432ca6a0844aab9495d51) --- samples/net/stats/src/main.c | 36 ++++++++++---------- subsys/net/ip/net_stats.c | 42 +++++++++++------------ subsys/net/lib/shell/stats.c | 64 ++++++++++++++++++------------------ 3 files changed, 71 insertions(+), 71 deletions(-) diff --git a/samples/net/stats/src/main.c b/samples/net/stats/src/main.c index fdfb7e4339c1..c91ad4e15f27 100644 --- a/samples/net/stats/src/main.c +++ b/samples/net/stats/src/main.c @@ -32,25 +32,25 @@ static void print_stats(struct net_if *iface, struct net_stats *data) } #if defined(CONFIG_NET_IPV6) - printk("IPv6 recv %d\tsent\t%d\tdrop\t%d\tforwarded\t%d\n", + printk("IPv6 recv %u\tsent\t%u\tdrop\t%u\tforwarded\t%u\n", GET_STAT(iface, ipv6.recv), GET_STAT(iface, ipv6.sent), GET_STAT(iface, ipv6.drop), GET_STAT(iface, ipv6.forwarded)); #if defined(CONFIG_NET_IPV6_ND) - printk("IPv6 ND recv %d\tsent\t%d\tdrop\t%d\n", + printk("IPv6 ND recv %u\tsent\t%u\tdrop\t%u\n", GET_STAT(iface, ipv6_nd.recv), GET_STAT(iface, ipv6_nd.sent), GET_STAT(iface, ipv6_nd.drop)); #endif /* CONFIG_NET_IPV6_ND */ #if defined(CONFIG_NET_IPV6_PMTU) - printk("IPv6 PMTU recv %d\tsent\t%d\tdrop\t%d\n", + printk("IPv6 PMTU recv %u\tsent\t%u\tdrop\t%u\n", GET_STAT(iface, ipv6_pmtu.recv), GET_STAT(iface, ipv6_pmtu.sent), GET_STAT(iface, ipv6_pmtu.drop)); #endif /* CONFIG_NET_IPV6_PMTU */ #if defined(CONFIG_NET_STATISTICS_MLD) - printk("IPv6 MLD recv %d\tsent\t%d\tdrop\t%d\n", + printk("IPv6 MLD recv %u\tsent\t%u\tdrop\t%u\n", GET_STAT(iface, ipv6_mld.recv), GET_STAT(iface, ipv6_mld.sent), GET_STAT(iface, ipv6_mld.drop)); @@ -58,70 +58,70 @@ static void print_stats(struct net_if *iface, struct net_stats *data) #endif /* CONFIG_NET_IPV6 */ #if defined(CONFIG_NET_IPV4) - printk("IPv4 recv %d\tsent\t%d\tdrop\t%d\tforwarded\t%d\n", + printk("IPv4 recv %u\tsent\t%u\tdrop\t%u\tforwarded\t%u\n", GET_STAT(iface, ipv4.recv), GET_STAT(iface, ipv4.sent), GET_STAT(iface, ipv4.drop), GET_STAT(iface, ipv4.forwarded)); #endif /* CONFIG_NET_IPV4 */ - printk("IP vhlerr %d\thblener\t%d\tlblener\t%d\n", + printk("IP vhlerr %u\thblener\t%u\tlblener\t%u\n", GET_STAT(iface, ip_errors.vhlerr), GET_STAT(iface, ip_errors.hblenerr), GET_STAT(iface, ip_errors.lblenerr)); - printk("IP fragerr %d\tchkerr\t%d\tprotoer\t%d\n", + printk("IP fragerr %u\tchkerr\t%u\tprotoer\t%u\n", GET_STAT(iface, ip_errors.fragerr), GET_STAT(iface, ip_errors.chkerr), GET_STAT(iface, ip_errors.protoerr)); #if defined(CONFIG_NET_IPV4_PMTU) - printk("IPv4 PMTU recv %d\tsent\t%d\tdrop\t%d\n", + printk("IPv4 PMTU recv %u\tsent\t%u\tdrop\t%u\n", GET_STAT(iface, ipv4_pmtu.recv), GET_STAT(iface, ipv4_pmtu.sent), GET_STAT(iface, ipv4_pmtu.drop)); #endif /* CONFIG_NET_IPV4_PMTU */ - printk("ICMP recv %d\tsent\t%d\tdrop\t%d\n", + printk("ICMP recv %u\tsent\t%u\tdrop\t%u\n", GET_STAT(iface, icmp.recv), GET_STAT(iface, icmp.sent), GET_STAT(iface, icmp.drop)); - printk("ICMP typeer %d\tchkerr\t%d\n", + printk("ICMP typeer %u\tchkerr\t%u\n", GET_STAT(iface, icmp.typeerr), GET_STAT(iface, icmp.chkerr)); #if defined(CONFIG_NET_UDP) - printk("UDP recv %d\tsent\t%d\tdrop\t%d\n", + printk("UDP recv %u\tsent\t%u\tdrop\t%u\n", GET_STAT(iface, udp.recv), GET_STAT(iface, udp.sent), GET_STAT(iface, udp.drop)); - printk("UDP chkerr %d\n", + printk("UDP chkerr %u\n", GET_STAT(iface, udp.chkerr)); #endif #if defined(CONFIG_NET_STATISTICS_TCP) - printk("TCP bytes recv %u\tsent\t%d\n", + printk("TCP bytes recv %u\tsent\t%u\n", GET_STAT(iface, tcp.bytes.received), GET_STAT(iface, tcp.bytes.sent)); - printk("TCP seg recv %d\tsent\t%d\tdrop\t%d\n", + printk("TCP seg recv %u\tsent\t%u\tdrop\t%u\n", GET_STAT(iface, tcp.recv), GET_STAT(iface, tcp.sent), GET_STAT(iface, tcp.drop)); - printk("TCP seg resent %d\tchkerr\t%d\tackerr\t%d\n", + printk("TCP seg resent %u\tchkerr\t%u\tackerr\t%u\n", GET_STAT(iface, tcp.resent), GET_STAT(iface, tcp.chkerr), GET_STAT(iface, tcp.ackerr)); - printk("TCP seg rsterr %d\trst\t%d\tre-xmit\t%d\n", + printk("TCP seg rsterr %u\trst\t%u\tre-xmit\t%u\n", GET_STAT(iface, tcp.rsterr), GET_STAT(iface, tcp.rst), GET_STAT(iface, tcp.rexmit)); - printk("TCP conn drop %d\tconnrst\t%d\n", + printk("TCP conn drop %u\tconnrst\t%u\n", GET_STAT(iface, tcp.conndrop), GET_STAT(iface, tcp.connrst)); #endif printk("Bytes received %u\n", GET_STAT(iface, bytes.received)); printk("Bytes sent %u\n", GET_STAT(iface, bytes.sent)); - printk("Processing err %d\n", GET_STAT(iface, processing_error)); + printk("Processing err %u\n", GET_STAT(iface, processing_error)); } #if defined(CONFIG_NET_STATISTICS_PER_INTERFACE) diff --git a/subsys/net/ip/net_stats.c b/subsys/net/ip/net_stats.c index 3f9df8c8cf1c..3f9352922a00 100644 --- a/subsys/net/ip/net_stats.c +++ b/subsys/net/ip/net_stats.c @@ -85,25 +85,25 @@ static inline void stats(struct net_if *iface) } #if defined(CONFIG_NET_STATISTICS_IPV6) - NET_INFO("IPv6 recv %d\tsent\t%d\tdrop\t%d\tforwarded\t%d", + NET_INFO("IPv6 recv %u\tsent\t%u\tdrop\t%u\tforwarded\t%u", GET_STAT(iface, ipv6.recv), GET_STAT(iface, ipv6.sent), GET_STAT(iface, ipv6.drop), GET_STAT(iface, ipv6.forwarded)); #if defined(CONFIG_NET_STATISTICS_IPV6_ND) - NET_INFO("IPv6 ND recv %d\tsent\t%d\tdrop\t%d", + NET_INFO("IPv6 ND recv %u\tsent\t%u\tdrop\t%u", GET_STAT(iface, ipv6_nd.recv), GET_STAT(iface, ipv6_nd.sent), GET_STAT(iface, ipv6_nd.drop)); #endif /* CONFIG_NET_STATISTICS_IPV6_ND */ #if defined(CONFIG_NET_STATISTICS_IPV6_PMTU) - NET_INFO("IPv6 PMTU recv %d\tsent\t%d\tdrop\t%d", + NET_INFO("IPv6 PMTU recv %u\tsent\t%u\tdrop\t%u", GET_STAT(iface, ipv6_pmtu.recv), GET_STAT(iface, ipv6_pmtu.sent), GET_STAT(iface, ipv6_pmtu.drop)); #endif /* CONFIG_NET_STATISTICS_IPV6_PMTU */ #if defined(CONFIG_NET_STATISTICS_MLD) - NET_INFO("IPv6 MLD recv %d\tsent\t%d\tdrop\t%d", + NET_INFO("IPv6 MLD recv %u\tsent\t%u\tdrop\t%u", GET_STAT(iface, ipv6_mld.recv), GET_STAT(iface, ipv6_mld.sent), GET_STAT(iface, ipv6_mld.drop)); @@ -111,70 +111,70 @@ static inline void stats(struct net_if *iface) #endif /* CONFIG_NET_STATISTICS_IPV6 */ #if defined(CONFIG_NET_STATISTICS_IPV4) - NET_INFO("IPv4 recv %d\tsent\t%d\tdrop\t%d\tforwarded\t%d", + NET_INFO("IPv4 recv %u\tsent\t%u\tdrop\t%u\tforwarded\t%u", GET_STAT(iface, ipv4.recv), GET_STAT(iface, ipv4.sent), GET_STAT(iface, ipv4.drop), GET_STAT(iface, ipv4.forwarded)); #endif /* CONFIG_NET_STATISTICS_IPV4 */ - NET_INFO("IP vhlerr %d\thblener\t%d\tlblener\t%d", + NET_INFO("IP vhlerr %u\thblener\t%u\tlblener\t%u", GET_STAT(iface, ip_errors.vhlerr), GET_STAT(iface, ip_errors.hblenerr), GET_STAT(iface, ip_errors.lblenerr)); - NET_INFO("IP fragerr %d\tchkerr\t%d\tprotoer\t%d", + NET_INFO("IP fragerr %u\tchkerr\t%u\tprotoer\t%u", GET_STAT(iface, ip_errors.fragerr), GET_STAT(iface, ip_errors.chkerr), GET_STAT(iface, ip_errors.protoerr)); #if defined(CONFIG_NET_STATISTICS_IPV4_PMTU) - NET_INFO("IPv4 PMTU recv %d\tsent\t%d\tdrop\t%d", + NET_INFO("IPv4 PMTU recv %u\tsent\t%u\tdrop\t%u", GET_STAT(iface, ipv4_pmtu.recv), GET_STAT(iface, ipv4_pmtu.sent), GET_STAT(iface, ipv4_pmtu.drop)); #endif /* CONFIG_NET_STATISTICS_IPV4_PMTU */ - NET_INFO("ICMP recv %d\tsent\t%d\tdrop\t%d", + NET_INFO("ICMP recv %u\tsent\t%u\tdrop\t%u", GET_STAT(iface, icmp.recv), GET_STAT(iface, icmp.sent), GET_STAT(iface, icmp.drop)); - NET_INFO("ICMP typeer %d\tchkerr\t%d", + NET_INFO("ICMP typeer %u\tchkerr\t%u", GET_STAT(iface, icmp.typeerr), GET_STAT(iface, icmp.chkerr)); #if defined(CONFIG_NET_STATISTICS_UDP) - NET_INFO("UDP recv %d\tsent\t%d\tdrop\t%d", + NET_INFO("UDP recv %u\tsent\t%u\tdrop\t%u", GET_STAT(iface, udp.recv), GET_STAT(iface, udp.sent), GET_STAT(iface, udp.drop)); - NET_INFO("UDP chkerr %d", + NET_INFO("UDP chkerr %u", GET_STAT(iface, udp.chkerr)); #endif #if defined(CONFIG_NET_STATISTICS_TCP) - NET_INFO("TCP bytes recv %u\tsent\t%d", + NET_INFO("TCP bytes recv %u\tsent\t%u", GET_STAT(iface, tcp.bytes.received), GET_STAT(iface, tcp.bytes.sent)); - NET_INFO("TCP seg recv %d\tsent\t%d\tdrop\t%d", + NET_INFO("TCP seg recv %u\tsent\t%u\tdrop\t%u", GET_STAT(iface, tcp.recv), GET_STAT(iface, tcp.sent), GET_STAT(iface, tcp.drop)); - NET_INFO("TCP seg resent %d\tchkerr\t%d\tackerr\t%d", + NET_INFO("TCP seg resent %u\tchkerr\t%u\tackerr\t%u", GET_STAT(iface, tcp.resent), GET_STAT(iface, tcp.chkerr), GET_STAT(iface, tcp.ackerr)); - NET_INFO("TCP seg rsterr %d\trst\t%d\tre-xmit\t%d", + NET_INFO("TCP seg rsterr %u\trst\t%u\tre-xmit\t%u", GET_STAT(iface, tcp.rsterr), GET_STAT(iface, tcp.rst), GET_STAT(iface, tcp.rexmit)); - NET_INFO("TCP conn drop %d\tconnrst\t%d", + NET_INFO("TCP conn drop %u\tconnrst\t%u", GET_STAT(iface, tcp.conndrop), GET_STAT(iface, tcp.connrst)); #endif NET_INFO("Bytes received %u", GET_STAT(iface, bytes.received)); NET_INFO("Bytes sent %u", GET_STAT(iface, bytes.sent)); - NET_INFO("Processing err %d", + NET_INFO("Processing err %u", GET_STAT(iface, processing_error)); #if NET_TC_COUNT > 1 @@ -183,7 +183,7 @@ static inline void stats(struct net_if *iface) NET_INFO("TC Priority\tSent pkts\tbytes"); for (i = 0; i < NET_TC_TX_COUNT; i++) { - NET_INFO("[%d] %s (%d)\t%d\t\t%d", i, + NET_INFO("[%d] %s (%u)\t%u\t\t%u", i, priority2str(GET_STAT(iface, tc.sent[i].priority)), GET_STAT(iface, tc.sent[i].priority), @@ -197,7 +197,7 @@ static inline void stats(struct net_if *iface) NET_INFO("TC Priority\tRecv pkts\tbytes"); for (i = 0; i < NET_TC_RX_COUNT; i++) { - NET_INFO("[%d] %s (%d)\t%d\t\t%d", i, + NET_INFO("[%d] %s (%u)\t%u\t\t%u", i, priority2str(GET_STAT(iface, tc.recv[i].priority)), GET_STAT(iface, tc.recv[i].priority), @@ -213,7 +213,7 @@ static inline void stats(struct net_if *iface) NET_INFO("Power management statistics:"); NET_INFO("Last suspend time: %u ms", GET_STAT(iface, pm.last_suspend_time)); - NET_INFO("Got suspended %d times", + NET_INFO("Got suspended %u times", GET_STAT(iface, pm.suspend_count)); NET_INFO("Average suspend time: %u ms", (uint32_t)(GET_STAT(iface, pm.overall_suspend_time) / diff --git a/subsys/net/lib/shell/stats.c b/subsys/net/lib/shell/stats.c index 64256bc7473a..e73cbf614104 100644 --- a/subsys/net/lib/shell/stats.c +++ b/subsys/net/lib/shell/stats.c @@ -315,13 +315,13 @@ static void print_tc_tx_stats(const struct shell *sh, struct net_if *iface) net_stats_t count = GET_STAT(iface, tc.sent[i].tx_time.count); if (count == 0) { - PR("[%d] %s (%d)\t%d\t\t%d\t-\n", i, + PR("[%d] %s (%u)\t%u\t\t%u\t-\n", i, priority2str(GET_STAT(iface, tc.sent[i].priority)), GET_STAT(iface, tc.sent[i].priority), GET_STAT(iface, tc.sent[i].pkts), GET_STAT(iface, tc.sent[i].bytes)); } else { - PR("[%d] %s (%d)\t%d\t\t%d\t%u us%s\n", i, + PR("[%d] %s (%u)\t%u\t\t%u\t%u us%s\n", i, priority2str(GET_STAT(iface, tc.sent[i].priority)), GET_STAT(iface, tc.sent[i].priority), GET_STAT(iface, tc.sent[i].pkts), @@ -336,7 +336,7 @@ static void print_tc_tx_stats(const struct shell *sh, struct net_if *iface) PR("TC Priority\tSent pkts\tbytes\n"); for (i = 0; i < NET_TC_TX_COUNT; i++) { - PR("[%d] %s (%d)\t%d\t\t%d\n", i, + PR("[%d] %s (%u)\t%u\t\t%u\n", i, priority2str(GET_STAT(iface, tc.sent[i].priority)), GET_STAT(iface, tc.sent[i].priority), GET_STAT(iface, tc.sent[i].pkts), @@ -374,14 +374,14 @@ static void print_tc_rx_stats(const struct shell *sh, struct net_if *iface) net_stats_t count = GET_STAT(iface, tc.recv[i].rx_time.count); if (count == 0) { - PR("[%d] %s (%d)\t%d\t%d\t\t%d\t-\n", i, + PR("[%d] %s (%u)\t%u\t%u\t\t%u\t-\n", i, priority2str(GET_STAT(iface, tc.recv[i].priority)), GET_STAT(iface, tc.recv[i].priority), GET_STAT(iface, tc.recv[i].pkts), GET_STAT(iface, tc.recv[i].dropped), GET_STAT(iface, tc.recv[i].bytes)); } else { - PR("[%d] %s (%d)\t%d\t%d\t\t%d\t%u us%s\n", i, + PR("[%d] %s (%u)\t%u\t%u\t\t%u\t%u us%s\n", i, priority2str(GET_STAT(iface, tc.recv[i].priority)), GET_STAT(iface, tc.recv[i].priority), GET_STAT(iface, tc.recv[i].pkts), @@ -397,7 +397,7 @@ static void print_tc_rx_stats(const struct shell *sh, struct net_if *iface) PR("TC Priority\tRecv pkts\tDrop pkts\tbytes\n"); for (i = 0; i < NET_TC_RX_COUNT; i++) { - PR("[%d] %s (%d)\t%d\t%d\t\t%d\n", i, + PR("[%d] %s (%u)\t%u\t%u\t\t%u\n", i, priority2str(GET_STAT(iface, tc.recv[i].priority)), GET_STAT(iface, tc.recv[i].priority), GET_STAT(iface, tc.recv[i].pkts), @@ -459,25 +459,25 @@ static void net_shell_print_statistics(struct net_if *iface, void *user_data) } #if defined(CONFIG_NET_STATISTICS_IPV6) && defined(CONFIG_NET_NATIVE_IPV6) - PR("IPv6 recv %d\tsent\t%d\tdrop\t%d\tforwarded\t%d\n", + PR("IPv6 recv %u\tsent\t%u\tdrop\t%u\tforwarded\t%u\n", GET_STAT(iface, ipv6.recv), GET_STAT(iface, ipv6.sent), GET_STAT(iface, ipv6.drop), GET_STAT(iface, ipv6.forwarded)); #if defined(CONFIG_NET_STATISTICS_IPV6_ND) - PR("IPv6 ND recv %d\tsent\t%d\tdrop\t%d\n", + PR("IPv6 ND recv %u\tsent\t%u\tdrop\t%u\n", GET_STAT(iface, ipv6_nd.recv), GET_STAT(iface, ipv6_nd.sent), GET_STAT(iface, ipv6_nd.drop)); #endif /* CONFIG_NET_STATISTICS_IPV6_ND */ #if defined(CONFIG_NET_STATISTICS_IPV6_PMTU) - PR("IPv6 PMTU recv %d\tsent\t%d\tdrop\t%d\n", + PR("IPv6 PMTU recv %u\tsent\t%u\tdrop\t%u\n", GET_STAT(iface, ipv6_pmtu.recv), GET_STAT(iface, ipv6_pmtu.sent), GET_STAT(iface, ipv6_pmtu.drop)); #endif /* CONFIG_NET_STATISTICS_IPV6_PMTU */ #if defined(CONFIG_NET_STATISTICS_MLD) - PR("IPv6 MLD recv %d\tsent\t%d\tdrop\t%d\n", + PR("IPv6 MLD recv %u\tsent\t%u\tdrop\t%u\n", GET_STAT(iface, ipv6_mld.recv), GET_STAT(iface, ipv6_mld.sent), GET_STAT(iface, ipv6_mld.drop)); @@ -485,86 +485,86 @@ static void net_shell_print_statistics(struct net_if *iface, void *user_data) #endif /* CONFIG_NET_STATISTICS_IPV6 */ #if defined(CONFIG_NET_STATISTICS_IPV4) && defined(CONFIG_NET_NATIVE_IPV4) - PR("IPv4 recv %d\tsent\t%d\tdrop\t%d\tforwarded\t%d\n", + PR("IPv4 recv %u\tsent\t%u\tdrop\t%u\tforwarded\t%u\n", GET_STAT(iface, ipv4.recv), GET_STAT(iface, ipv4.sent), GET_STAT(iface, ipv4.drop), GET_STAT(iface, ipv4.forwarded)); #endif /* CONFIG_NET_STATISTICS_IPV4 */ - PR("IP vhlerr %d\thblener\t%d\tlblener\t%d\n", + PR("IP vhlerr %u\thblener\t%u\tlblener\t%u\n", GET_STAT(iface, ip_errors.vhlerr), GET_STAT(iface, ip_errors.hblenerr), GET_STAT(iface, ip_errors.lblenerr)); - PR("IP fragerr %d\tchkerr\t%d\tprotoer\t%d\n", + PR("IP fragerr %u\tchkerr\t%u\tprotoer\t%u\n", GET_STAT(iface, ip_errors.fragerr), GET_STAT(iface, ip_errors.chkerr), GET_STAT(iface, ip_errors.protoerr)); #if defined(CONFIG_NET_STATISTICS_IPV4_PMTU) - PR("IPv4 PMTU recv %d\tsent\t%d\tdrop\t%d\n", + PR("IPv4 PMTU recv %u\tsent\t%u\tdrop\t%u\n", GET_STAT(iface, ipv4_pmtu.recv), GET_STAT(iface, ipv4_pmtu.sent), GET_STAT(iface, ipv4_pmtu.drop)); #endif /* CONFIG_NET_STATISTICS_IPV4_PMTU */ #if defined(CONFIG_NET_STATISTICS_ICMP) && defined(CONFIG_NET_NATIVE_IPV4) - PR("ICMP recv %d\tsent\t%d\tdrop\t%d\n", + PR("ICMP recv %u\tsent\t%u\tdrop\t%u\n", GET_STAT(iface, icmp.recv), GET_STAT(iface, icmp.sent), GET_STAT(iface, icmp.drop)); - PR("ICMP typeer %d\tchkerr\t%d\n", + PR("ICMP typeer %u\tchkerr\t%u\n", GET_STAT(iface, icmp.typeerr), GET_STAT(iface, icmp.chkerr)); #endif #if defined(CONFIG_NET_STATISTICS_IGMP) - PR("IGMP recv %d\tsent\t%d\tdrop\t%d\n", + PR("IGMP recv %u\tsent\t%u\tdrop\t%u\n", GET_STAT(iface, ipv4_igmp.recv), GET_STAT(iface, ipv4_igmp.sent), GET_STAT(iface, ipv4_igmp.drop)); #endif /* CONFIG_NET_STATISTICS_IGMP */ #if defined(CONFIG_NET_STATISTICS_UDP) && defined(CONFIG_NET_NATIVE_UDP) - PR("UDP recv %d\tsent\t%d\tdrop\t%d\n", + PR("UDP recv %u\tsent\t%u\tdrop\t%u\n", GET_STAT(iface, udp.recv), GET_STAT(iface, udp.sent), GET_STAT(iface, udp.drop)); - PR("UDP chkerr %d\n", + PR("UDP chkerr %u\n", GET_STAT(iface, udp.chkerr)); #endif #if defined(CONFIG_NET_STATISTICS_TCP) && defined(CONFIG_NET_NATIVE_TCP) - PR("TCP bytes recv %u\tsent\t%d\tresent\t%d\n", + PR("TCP bytes recv %u\tsent\t%u\tresent\t%u\n", GET_STAT(iface, tcp.bytes.received), GET_STAT(iface, tcp.bytes.sent), GET_STAT(iface, tcp.resent)); - PR("TCP seg recv %d\tsent\t%d\tdrop\t%d\n", + PR("TCP seg recv %u\tsent\t%u\tdrop\t%u\n", GET_STAT(iface, tcp.recv), GET_STAT(iface, tcp.sent), GET_STAT(iface, tcp.seg_drop)); - PR("TCP seg resent %d\tchkerr\t%d\tackerr\t%d\n", + PR("TCP seg resent %u\tchkerr\t%u\tackerr\t%u\n", GET_STAT(iface, tcp.rexmit), GET_STAT(iface, tcp.chkerr), GET_STAT(iface, tcp.ackerr)); - PR("TCP seg rsterr %d\trst\t%d\n", + PR("TCP seg rsterr %u\trst\t%u\n", GET_STAT(iface, tcp.rsterr), GET_STAT(iface, tcp.rst)); - PR("TCP conn drop %d\tconnrst\t%d\n", + PR("TCP conn drop %u\tconnrst\t%u\n", GET_STAT(iface, tcp.conndrop), GET_STAT(iface, tcp.connrst)); - PR("TCP pkt drop %d\n", GET_STAT(iface, tcp.drop)); + PR("TCP pkt drop %u\n", GET_STAT(iface, tcp.drop)); #endif #if defined(CONFIG_NET_STATISTICS_DNS) - PR("DNS recv %d\tsent\t%d\tdrop\t%d\n", + PR("DNS recv %u\tsent\t%u\tdrop\t%u\n", GET_STAT(iface, dns.recv), GET_STAT(iface, dns.sent), GET_STAT(iface, dns.drop)); #endif /* CONFIG_NET_STATISTICS_DNS */ #if defined(CONFIG_NET_STATISTICS_PKT_FILTER) - PR("Filter drop rx %d" - IF_ENABLED(CONFIG_NET_PKT_FILTER_IPV4_HOOK, ("\tIPv4\t%d")) - IF_ENABLED(CONFIG_NET_PKT_FILTER_IPV6_HOOK, ("\tIPv6\t%d")) - IF_ENABLED(CONFIG_NET_PKT_FILTER_LOCAL_IN_HOOK, ("\tlocal\t%d")) - "\ttx\t%d\n", + PR("Filter drop rx %u" + IF_ENABLED(CONFIG_NET_PKT_FILTER_IPV4_HOOK, ("\tIPv4\t%u")) + IF_ENABLED(CONFIG_NET_PKT_FILTER_IPV6_HOOK, ("\tIPv6\t%u")) + IF_ENABLED(CONFIG_NET_PKT_FILTER_LOCAL_IN_HOOK, ("\tlocal\t%u")) + "\ttx\t%u\n", GET_STAT(iface, pkt_filter.rx.drop), IF_ENABLED(CONFIG_NET_PKT_FILTER_IPV4_HOOK, (GET_STAT(iface, pkt_filter.rx.ipv4_drop),)) @@ -577,7 +577,7 @@ static void net_shell_print_statistics(struct net_if *iface, void *user_data) PR("Bytes received %u\n", GET_STAT(iface, bytes.received)); PR("Bytes sent %u\n", GET_STAT(iface, bytes.sent)); - PR("Processing err %d\n", GET_STAT(iface, processing_error)); + PR("Processing err %u\n", GET_STAT(iface, processing_error)); print_tc_tx_stats(sh, iface); print_tc_rx_stats(sh, iface); From 44066038087d8ccdffb677f8c693c37069741c7b Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Tue, 10 Jun 2025 15:12:22 +0200 Subject: [PATCH 0035/2141] [nrf fromtree] net: stats: Make byte counters 64-bit In high throughput tests it's fairly easy to overflow the current 32-bit byte counters in net statistics (it's just over 4 GB of data). Therefore, make the byte counters 64-bit to prevent overflows. Rearrange some fields to avoid padding. Signed-off-by: Robert Lubos (cherry picked from commit 86244a9c543aed48e5305174c7dd42cb89456009) --- include/zephyr/net/net_stats.h | 18 +++++++++--------- samples/net/stats/src/main.c | 10 +++++----- subsys/net/ip/net_stats.c | 10 +++++----- subsys/net/l2/wifi/wifi_shell.c | 4 ++-- subsys/net/lib/shell/stats.c | 22 +++++++++++----------- 5 files changed, 32 insertions(+), 32 deletions(-) diff --git a/include/zephyr/net/net_stats.h b/include/zephyr/net/net_stats.h index 1a5531a1a271..de95b35fbb72 100644 --- a/include/zephyr/net/net_stats.h +++ b/include/zephyr/net/net_stats.h @@ -49,9 +49,9 @@ typedef uint32_t net_stats_t; */ struct net_stats_bytes { /** Number of bytes sent */ - net_stats_t sent; + uint64_t sent; /** Number of bytes received */ - net_stats_t received; + uint64_t received; }; /** @@ -319,6 +319,8 @@ struct net_stats_rx_time { struct net_stats_tc { /** TX statistics for each traffic class */ struct { + /** Number of bytes sent for this traffic class */ + uint64_t bytes; /** Helper for calculating average TX time statistics */ struct net_stats_tx_time tx_time; #if defined(CONFIG_NET_PKT_TXTIME_STATS_DETAIL) @@ -330,14 +332,14 @@ struct net_stats_tc { net_stats_t pkts; /** Number of packets dropped for this traffic class */ net_stats_t dropped; - /** Number of bytes sent for this traffic class */ - net_stats_t bytes; /** Priority of this traffic class */ uint8_t priority; } sent[NET_TC_TX_STATS_COUNT]; /** RX statistics for each traffic class */ struct { + /** Number of bytes received for this traffic class */ + uint64_t bytes; /** Helper for calculating average RX time statistics */ struct net_stats_rx_time rx_time; #if defined(CONFIG_NET_PKT_RXTIME_STATS_DETAIL) @@ -349,8 +351,6 @@ struct net_stats_tc { net_stats_t pkts; /** Number of packets dropped for this traffic class */ net_stats_t dropped; - /** Number of bytes received for this traffic class */ - net_stats_t bytes; /** Priority of this traffic class */ uint8_t priority; } recv[NET_TC_RX_STATS_COUNT]; @@ -404,15 +404,15 @@ struct net_stats_pkt_filter { * @brief All network statistics in one struct. */ struct net_stats { - /** Count of malformed packets or packets we do not have handler for */ - net_stats_t processing_error; - /** * This calculates amount of data transferred through all the * network interfaces. */ struct net_stats_bytes bytes; + /** Count of malformed packets or packets we do not have handler for */ + net_stats_t processing_error; + /** IP layer errors */ struct net_stats_ip_errors ip_errors; diff --git a/samples/net/stats/src/main.c b/samples/net/stats/src/main.c index c91ad4e15f27..7b3d1a844aa0 100644 --- a/samples/net/stats/src/main.c +++ b/samples/net/stats/src/main.c @@ -99,7 +99,7 @@ static void print_stats(struct net_if *iface, struct net_stats *data) #endif #if defined(CONFIG_NET_STATISTICS_TCP) - printk("TCP bytes recv %u\tsent\t%u\n", + printk("TCP bytes recv %llu\tsent\t%llu\n", GET_STAT(iface, tcp.bytes.received), GET_STAT(iface, tcp.bytes.sent)); printk("TCP seg recv %u\tsent\t%u\tdrop\t%u\n", @@ -119,8 +119,8 @@ static void print_stats(struct net_if *iface, struct net_stats *data) GET_STAT(iface, tcp.connrst)); #endif - printk("Bytes received %u\n", GET_STAT(iface, bytes.received)); - printk("Bytes sent %u\n", GET_STAT(iface, bytes.sent)); + printk("Bytes received %llu\n", GET_STAT(iface, bytes.received)); + printk("Bytes sent %llu\n", GET_STAT(iface, bytes.sent)); printk("Processing err %u\n", GET_STAT(iface, processing_error)); } @@ -141,8 +141,8 @@ static void print_eth_stats(struct net_if *iface, struct net_stats_eth *data) printk("Statistics for Ethernet interface %p [%d]\n", iface, net_if_get_by_iface(iface)); - printk("Bytes received : %u\n", data->bytes.received); - printk("Bytes sent : %u\n", data->bytes.sent); + printk("Bytes received : %llu\n", data->bytes.received); + printk("Bytes sent : %llu\n", data->bytes.sent); printk("Packets received : %u\n", data->pkts.rx); printk("Packets sent : %u\n", data->pkts.tx); printk("Bcast received : %u\n", data->broadcast.rx); diff --git a/subsys/net/ip/net_stats.c b/subsys/net/ip/net_stats.c index 3f9352922a00..5da625faeb6d 100644 --- a/subsys/net/ip/net_stats.c +++ b/subsys/net/ip/net_stats.c @@ -152,7 +152,7 @@ static inline void stats(struct net_if *iface) #endif #if defined(CONFIG_NET_STATISTICS_TCP) - NET_INFO("TCP bytes recv %u\tsent\t%u", + NET_INFO("TCP bytes recv %llu\tsent\t%llu", GET_STAT(iface, tcp.bytes.received), GET_STAT(iface, tcp.bytes.sent)); NET_INFO("TCP seg recv %u\tsent\t%u\tdrop\t%u", @@ -172,8 +172,8 @@ static inline void stats(struct net_if *iface) GET_STAT(iface, tcp.connrst)); #endif - NET_INFO("Bytes received %u", GET_STAT(iface, bytes.received)); - NET_INFO("Bytes sent %u", GET_STAT(iface, bytes.sent)); + NET_INFO("Bytes received %llu", GET_STAT(iface, bytes.received)); + NET_INFO("Bytes sent %llu", GET_STAT(iface, bytes.sent)); NET_INFO("Processing err %u", GET_STAT(iface, processing_error)); @@ -183,7 +183,7 @@ static inline void stats(struct net_if *iface) NET_INFO("TC Priority\tSent pkts\tbytes"); for (i = 0; i < NET_TC_TX_COUNT; i++) { - NET_INFO("[%d] %s (%u)\t%u\t\t%u", i, + NET_INFO("[%d] %s (%u)\t%u\t\t%llu", i, priority2str(GET_STAT(iface, tc.sent[i].priority)), GET_STAT(iface, tc.sent[i].priority), @@ -197,7 +197,7 @@ static inline void stats(struct net_if *iface) NET_INFO("TC Priority\tRecv pkts\tbytes"); for (i = 0; i < NET_TC_RX_COUNT; i++) { - NET_INFO("[%d] %s (%u)\t%u\t\t%u", i, + NET_INFO("[%d] %s (%u)\t%u\t\t%llu", i, priority2str(GET_STAT(iface, tc.recv[i].priority)), GET_STAT(iface, tc.recv[i].priority), diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index c5dc9d889770..af0db05855fa 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1562,8 +1562,8 @@ static void print_wifi_stats(struct net_if *iface, struct net_stats_wifi *data, PR("Statistics for Wi-Fi interface %p [%d]\n", iface, net_if_get_by_iface(iface)); - PR("Bytes received : %u\n", data->bytes.received); - PR("Bytes sent : %u\n", data->bytes.sent); + PR("Bytes received : %llu\n", data->bytes.received); + PR("Bytes sent : %llu\n", data->bytes.sent); PR("Packets received : %u\n", data->pkts.rx); PR("Packets sent : %u\n", data->pkts.tx); PR("Receive errors : %u\n", data->errors.rx); diff --git a/subsys/net/lib/shell/stats.c b/subsys/net/lib/shell/stats.c index e73cbf614104..1c31f56ec8f1 100644 --- a/subsys/net/lib/shell/stats.c +++ b/subsys/net/lib/shell/stats.c @@ -50,8 +50,8 @@ static void print_eth_stats(struct net_if *iface, struct net_stats_eth *data, PR("Statistics for Ethernet interface %p [%d]\n", iface, net_if_get_by_iface(iface)); - PR("Bytes received : %u\n", data->bytes.received); - PR("Bytes sent : %u\n", data->bytes.sent); + PR("Bytes received : %llu\n", data->bytes.received); + PR("Bytes sent : %llu\n", data->bytes.sent); PR("Packets received : %u\n", data->pkts.rx); PR("Packets sent : %u\n", data->pkts.tx); PR("Bcast received : %u\n", data->broadcast.rx); @@ -315,13 +315,13 @@ static void print_tc_tx_stats(const struct shell *sh, struct net_if *iface) net_stats_t count = GET_STAT(iface, tc.sent[i].tx_time.count); if (count == 0) { - PR("[%d] %s (%u)\t%u\t\t%u\t-\n", i, + PR("[%d] %s (%u)\t%u\t\t%llu\t-\n", i, priority2str(GET_STAT(iface, tc.sent[i].priority)), GET_STAT(iface, tc.sent[i].priority), GET_STAT(iface, tc.sent[i].pkts), GET_STAT(iface, tc.sent[i].bytes)); } else { - PR("[%d] %s (%u)\t%u\t\t%u\t%u us%s\n", i, + PR("[%d] %s (%u)\t%u\t\t%llu\t%u us%s\n", i, priority2str(GET_STAT(iface, tc.sent[i].priority)), GET_STAT(iface, tc.sent[i].priority), GET_STAT(iface, tc.sent[i].pkts), @@ -336,7 +336,7 @@ static void print_tc_tx_stats(const struct shell *sh, struct net_if *iface) PR("TC Priority\tSent pkts\tbytes\n"); for (i = 0; i < NET_TC_TX_COUNT; i++) { - PR("[%d] %s (%u)\t%u\t\t%u\n", i, + PR("[%d] %s (%u)\t%u\t\t%llu\n", i, priority2str(GET_STAT(iface, tc.sent[i].priority)), GET_STAT(iface, tc.sent[i].priority), GET_STAT(iface, tc.sent[i].pkts), @@ -374,14 +374,14 @@ static void print_tc_rx_stats(const struct shell *sh, struct net_if *iface) net_stats_t count = GET_STAT(iface, tc.recv[i].rx_time.count); if (count == 0) { - PR("[%d] %s (%u)\t%u\t%u\t\t%u\t-\n", i, + PR("[%d] %s (%u)\t%u\t%u\t\t%llu\t-\n", i, priority2str(GET_STAT(iface, tc.recv[i].priority)), GET_STAT(iface, tc.recv[i].priority), GET_STAT(iface, tc.recv[i].pkts), GET_STAT(iface, tc.recv[i].dropped), GET_STAT(iface, tc.recv[i].bytes)); } else { - PR("[%d] %s (%u)\t%u\t%u\t\t%u\t%u us%s\n", i, + PR("[%d] %s (%u)\t%u\t%u\t\t%llu\t%u us%s\n", i, priority2str(GET_STAT(iface, tc.recv[i].priority)), GET_STAT(iface, tc.recv[i].priority), GET_STAT(iface, tc.recv[i].pkts), @@ -397,7 +397,7 @@ static void print_tc_rx_stats(const struct shell *sh, struct net_if *iface) PR("TC Priority\tRecv pkts\tDrop pkts\tbytes\n"); for (i = 0; i < NET_TC_RX_COUNT; i++) { - PR("[%d] %s (%u)\t%u\t%u\t\t%u\n", i, + PR("[%d] %s (%u)\t%u\t%u\t\t%llu\n", i, priority2str(GET_STAT(iface, tc.recv[i].priority)), GET_STAT(iface, tc.recv[i].priority), GET_STAT(iface, tc.recv[i].pkts), @@ -533,7 +533,7 @@ static void net_shell_print_statistics(struct net_if *iface, void *user_data) #endif #if defined(CONFIG_NET_STATISTICS_TCP) && defined(CONFIG_NET_NATIVE_TCP) - PR("TCP bytes recv %u\tsent\t%u\tresent\t%u\n", + PR("TCP bytes recv %llu\tsent\t%llu\tresent\t%u\n", GET_STAT(iface, tcp.bytes.received), GET_STAT(iface, tcp.bytes.sent), GET_STAT(iface, tcp.resent)); @@ -575,8 +575,8 @@ static void net_shell_print_statistics(struct net_if *iface, void *user_data) GET_STAT(iface, pkt_filter.tx.drop)); #endif /* CONFIG_NET_STATISTICS_DNS */ - PR("Bytes received %u\n", GET_STAT(iface, bytes.received)); - PR("Bytes sent %u\n", GET_STAT(iface, bytes.sent)); + PR("Bytes received %llu\n", GET_STAT(iface, bytes.received)); + PR("Bytes sent %llu\n", GET_STAT(iface, bytes.sent)); PR("Processing err %u\n", GET_STAT(iface, processing_error)); print_tc_tx_stats(sh, iface); From 5307c307d683219c13cb49d739bd314f1a9dee7b Mon Sep 17 00:00:00 2001 From: Tomasz Chyrowicz Date: Wed, 14 May 2025 14:04:35 +0200 Subject: [PATCH 0036/2141] [nrf fromtree] boards: nrf54h20_iron: Allow radio updates Add necessary changes to provide a simple, updateable radio image. Signed-off-by: Tomasz Chyrowicz (cherry picked from commit 5e541005513b75382670034b486c093a017d7388) --- boards/nordic/nrf54h20dk/Kconfig.defconfig | 7 +++++++ .../nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_iron.dts | 8 ++++++++ .../nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_iron.dts | 8 ++++++++ modules/Kconfig.mcuboot | 1 + soc/nordic/nrf54h/soc.c | 3 ++- 5 files changed, 26 insertions(+), 1 deletion(-) diff --git a/boards/nordic/nrf54h20dk/Kconfig.defconfig b/boards/nordic/nrf54h20dk/Kconfig.defconfig index 60c9345eb045..4023f3b02320 100644 --- a/boards/nordic/nrf54h20dk/Kconfig.defconfig +++ b/boards/nordic/nrf54h20dk/Kconfig.defconfig @@ -27,3 +27,10 @@ config FLASH_LOAD_OFFSET default 0x2c000 if !USE_DT_CODE_PARTITION endif # BOARD_NRF54H20DK_NRF54H20_CPUAPP_IRON + +if BOARD_NRF54H20DK_NRF54H20_CPURAD_IRON + +config ROM_START_OFFSET + default 0x800 if BOOTLOADER_MCUBOOT + +endif # BOARD_NRF54H20DK_NRF54H20_CPURAD_IRON diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_iron.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_iron.dts index d455e200b0b9..e822cf2c9119 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_iron.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_iron.dts @@ -35,3 +35,11 @@ slot0_partition: &cpuapp_slot0_partition { slot1_partition: &cpuapp_slot1_partition { label = "image-1"; }; + +slot2_partition: &cpurad_slot0_partition { + label = "image-2"; +}; + +slot3_partition: &cpurad_slot1_partition { + label = "image-3"; +}; diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_iron.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_iron.dts index 669143a79dac..16b599f554e4 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_iron.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_iron.dts @@ -19,3 +19,11 @@ mbox-names = "tx", "rx"; status = "okay"; }; + +slot0_partition: &cpurad_slot0_partition { + label = "image-0"; +}; + +slot1_partition: &cpurad_slot1_partition { + label = "image-1"; +}; diff --git a/modules/Kconfig.mcuboot b/modules/Kconfig.mcuboot index 2c4dbfa930de..c02ee43f5eb8 100644 --- a/modules/Kconfig.mcuboot +++ b/modules/Kconfig.mcuboot @@ -227,6 +227,7 @@ config MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP config MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP_WITH_REVERT bool "MCUboot has been configured for DirectXIP with revert" + select MCUBOOT_BOOTUTIL_LIB select MCUBOOT_BOOTUTIL_LIB_FOR_DIRECT_XIP select MCUBOOT_BOOTLOADER_MODE_HAS_NO_DOWNGRADE select MCUBOOT_BOOTLOADER_NO_DOWNGRADE diff --git a/soc/nordic/nrf54h/soc.c b/soc/nordic/nrf54h/soc.c index e053953b821e..e55f56242b90 100644 --- a/soc/nordic/nrf54h/soc.c +++ b/soc/nordic/nrf54h/soc.c @@ -175,7 +175,8 @@ void soc_late_init_hook(void) void *radiocore_address = (void *)(DT_REG_ADDR(DT_GPARENT(DT_NODELABEL_CPURAD_SLOT0_PARTITION)) + - DT_REG_ADDR(DT_NODELABEL_CPURAD_SLOT0_PARTITION)); + DT_REG_ADDR(DT_NODELABEL_CPURAD_SLOT0_PARTITION) + + CONFIG_ROM_START_OFFSET); /* Don't wait as this is not yet supported. */ bool cpu_wait = false; From 287ea0179242ae064dd013a1d7bbfd9258c9f0be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Wed, 11 Jun 2025 14:44:27 +0200 Subject: [PATCH 0037/2141] [nrf fromtree] drivers: spi: Support spim23 and spim24 instances MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Extend SPI driver with possibility to use - spim23, spim24, - spis23, spis24. Signed-off-by: Sebastian Głąb (cherry picked from commit c0a28ab561d18167c240a9f1d05a7eb90d843c93) --- drivers/spi/Kconfig.nrfx | 4 ++++ modules/hal_nordic/nrfx/Kconfig | 20 ++++++++++++++++++++ modules/hal_nordic/nrfx/nrfx_kconfig.h | 12 ++++++++++++ soc/nordic/common/Kconfig.peripherals | 12 ++++++++++++ soc/nordic/validate_base_addresses.c | 2 ++ 5 files changed, 50 insertions(+) diff --git a/drivers/spi/Kconfig.nrfx b/drivers/spi/Kconfig.nrfx index d3debe5a5de6..f3afa79c4c37 100644 --- a/drivers/spi/Kconfig.nrfx +++ b/drivers/spi/Kconfig.nrfx @@ -31,6 +31,8 @@ config SPI_NRFX_SPIM select NRFX_SPIM20 if HAS_HW_NRF_SPIM20 select NRFX_SPIM21 if HAS_HW_NRF_SPIM21 select NRFX_SPIM22 if HAS_HW_NRF_SPIM22 + select NRFX_SPIM23 if HAS_HW_NRF_SPIM23 + select NRFX_SPIM24 if HAS_HW_NRF_SPIM24 select NRFX_SPIM30 if HAS_HW_NRF_SPIM30 select NRFX_SPIM120 if HAS_HW_NRF_SPIM120 select NRFX_SPIM121 if HAS_HW_NRF_SPIM121 @@ -55,6 +57,8 @@ config SPI_NRFX_SPIS select NRFX_SPIS20 if HAS_HW_NRF_SPIS20 select NRFX_SPIS21 if HAS_HW_NRF_SPIS21 select NRFX_SPIS22 if HAS_HW_NRF_SPIS22 + select NRFX_SPIS23 if HAS_HW_NRF_SPIS23 + select NRFX_SPIS24 if HAS_HW_NRF_SPIS24 select NRFX_SPIS30 if HAS_HW_NRF_SPIS30 select NRFX_SPIS120 if HAS_HW_NRF_SPIS120 select NRFX_SPIS130 if HAS_HW_NRF_SPIS130 diff --git a/modules/hal_nordic/nrfx/Kconfig b/modules/hal_nordic/nrfx/Kconfig index ceccf25997ca..3ce57f1e4de7 100644 --- a/modules/hal_nordic/nrfx/Kconfig +++ b/modules/hal_nordic/nrfx/Kconfig @@ -562,6 +562,16 @@ config NRFX_SPIM22 depends on $(dt_nodelabel_exists,spi22) select NRFX_SPIM +config NRFX_SPIM23 + bool "SPIM23 driver instance" + depends on $(dt_nodelabel_exists,spi23) + select NRFX_SPIM + +config NRFX_SPIM24 + bool "SPIM24 driver instance" + depends on $(dt_nodelabel_exists,spi24) + select NRFX_SPIM + config NRFX_SPIM30 bool "SPIM30 driver instance" depends on $(dt_nodelabel_exists,spi30) @@ -660,6 +670,16 @@ config NRFX_SPIS22 depends on $(dt_nodelabel_exists,spi22) select NRFX_SPIS +config NRFX_SPIS23 + bool "SPIS23 driver instance" + depends on $(dt_nodelabel_exists,spi23) + select NRFX_SPIS + +config NRFX_SPIS24 + bool "SPIS24 driver instance" + depends on $(dt_nodelabel_exists,spi24) + select NRFX_SPIS + config NRFX_SPIS30 bool "SPIS30 driver instance" depends on $(dt_nodelabel_exists,spi30) diff --git a/modules/hal_nordic/nrfx/nrfx_kconfig.h b/modules/hal_nordic/nrfx/nrfx_kconfig.h index 73a26272d4da..3ba891f60ec1 100644 --- a/modules/hal_nordic/nrfx/nrfx_kconfig.h +++ b/modules/hal_nordic/nrfx/nrfx_kconfig.h @@ -512,6 +512,12 @@ #ifdef CONFIG_NRFX_SPIM22 #define NRFX_SPIM22_ENABLED 1 #endif +#ifdef CONFIG_NRFX_SPIM23 +#define NRFX_SPIM23_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_SPIM24 +#define NRFX_SPIM24_ENABLED 1 +#endif #ifdef CONFIG_NRFX_SPIM30 #define NRFX_SPIM30_ENABLED 1 #endif @@ -576,6 +582,12 @@ #ifdef CONFIG_NRFX_SPIS22 #define NRFX_SPIS22_ENABLED 1 #endif +#ifdef CONFIG_NRFX_SPIS23 +#define NRFX_SPIS23_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_SPIS24 +#define NRFX_SPIS24_ENABLED 1 +#endif #ifdef CONFIG_NRFX_SPIS30 #define NRFX_SPIS30_ENABLED 1 #endif diff --git a/soc/nordic/common/Kconfig.peripherals b/soc/nordic/common/Kconfig.peripherals index ce91800a6150..900effed1416 100644 --- a/soc/nordic/common/Kconfig.peripherals +++ b/soc/nordic/common/Kconfig.peripherals @@ -280,6 +280,12 @@ config HAS_HW_NRF_SPIM21 config HAS_HW_NRF_SPIM22 def_bool $(dt_nodelabel_enabled_with_compat,spi22,$(DT_COMPAT_NORDIC_NRF_SPIM)) +config HAS_HW_NRF_SPIM23 + def_bool $(dt_nodelabel_enabled_with_compat,spi23,$(DT_COMPAT_NORDIC_NRF_SPIM)) + +config HAS_HW_NRF_SPIM24 + def_bool $(dt_nodelabel_enabled_with_compat,spi24,$(DT_COMPAT_NORDIC_NRF_SPIM)) + config HAS_HW_NRF_SPIM30 def_bool $(dt_nodelabel_enabled_with_compat,spi30,$(DT_COMPAT_NORDIC_NRF_SPIM)) @@ -337,6 +343,12 @@ config HAS_HW_NRF_SPIS21 config HAS_HW_NRF_SPIS22 def_bool $(dt_nodelabel_enabled_with_compat,spi22,$(DT_COMPAT_NORDIC_NRF_SPIS)) +config HAS_HW_NRF_SPIS23 + def_bool $(dt_nodelabel_enabled_with_compat,spi23,$(DT_COMPAT_NORDIC_NRF_SPIS)) + +config HAS_HW_NRF_SPIS24 + def_bool $(dt_nodelabel_enabled_with_compat,spi24,$(DT_COMPAT_NORDIC_NRF_SPIS)) + config HAS_HW_NRF_SPIS30 def_bool $(dt_nodelabel_enabled_with_compat,spi30,$(DT_COMPAT_NORDIC_NRF_SPIS)) diff --git a/soc/nordic/validate_base_addresses.c b/soc/nordic/validate_base_addresses.c index 9de947a5c7f6..6acefccdfec1 100644 --- a/soc/nordic/validate_base_addresses.c +++ b/soc/nordic/validate_base_addresses.c @@ -266,6 +266,8 @@ CHECK_DT_REG(spi00, NRF_SPIM00); CHECK_DT_REG(spi20, NRF_SPIM20); CHECK_DT_REG(spi21, NRF_SPIM21); CHECK_DT_REG(spi22, NRF_SPIM22); +CHECK_DT_REG(spi23, NRF_SPIM23); +CHECK_DT_REG(spi24, NRF_SPIM24); CHECK_DT_REG(spi30, NRF_SPIM30); CHECK_DT_REG(spi120, NRF_SPIM120); CHECK_DT_REG(spi121, NRF_SPIM121); From d03f1689ee5cbfe7abfffee9a65771495055a22e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Thu, 12 Jun 2025 08:55:17 +0200 Subject: [PATCH 0038/2141] [nrf fromtree] modules: hal_nordic: nrfx: Add mising UARTE23/24 Kconfigs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add UARTE23 and UARTE24 missing Kconfig options and their translation to NRFX configuration macros. Signed-off-by: Sebastian Głąb (cherry picked from commit 2b4f64522e0dbc8b1114bfe8f26cbdc94e70d299) --- modules/hal_nordic/nrfx/Kconfig | 10 ++++++++++ modules/hal_nordic/nrfx/nrfx_kconfig.h | 6 ++++++ soc/nordic/validate_base_addresses.c | 2 ++ 3 files changed, 18 insertions(+) diff --git a/modules/hal_nordic/nrfx/Kconfig b/modules/hal_nordic/nrfx/Kconfig index 3ce57f1e4de7..08c5df625990 100644 --- a/modules/hal_nordic/nrfx/Kconfig +++ b/modules/hal_nordic/nrfx/Kconfig @@ -1105,6 +1105,16 @@ config NRFX_UARTE22 depends on $(dt_nodelabel_exists,uart22) select NRFX_UARTE +config NRFX_UARTE23 + bool "UARTE23 driver instance" + depends on $(dt_nodelabel_exists,uart23) + select NRFX_UARTE + +config NRFX_UARTE24 + bool "UARTE24 driver instance" + depends on $(dt_nodelabel_exists,uart24) + select NRFX_UARTE + config NRFX_UARTE30 bool "UARTE30 driver instance" depends on $(dt_nodelabel_exists,uart30) diff --git a/modules/hal_nordic/nrfx/nrfx_kconfig.h b/modules/hal_nordic/nrfx/nrfx_kconfig.h index 3ba891f60ec1..ed1948a3931d 100644 --- a/modules/hal_nordic/nrfx/nrfx_kconfig.h +++ b/modules/hal_nordic/nrfx/nrfx_kconfig.h @@ -891,6 +891,12 @@ #ifdef CONFIG_NRFX_UARTE22 #define NRFX_UARTE22_ENABLED 1 #endif +#ifdef CONFIG_NRFX_UARTE23 +#define NRFX_UARTE23_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_UARTE24 +#define NRFX_UARTE24_ENABLED 1 +#endif #ifdef CONFIG_NRFX_UARTE30 #define NRFX_UARTE30_ENABLED 1 #endif diff --git a/soc/nordic/validate_base_addresses.c b/soc/nordic/validate_base_addresses.c index 6acefccdfec1..02413e3f174a 100644 --- a/soc/nordic/validate_base_addresses.c +++ b/soc/nordic/validate_base_addresses.c @@ -321,6 +321,8 @@ CHECK_DT_REG(uart00, NRF_UARTE00); CHECK_DT_REG(uart20, NRF_UARTE20); CHECK_DT_REG(uart21, NRF_UARTE21); CHECK_DT_REG(uart22, NRF_UARTE22); +CHECK_DT_REG(uart23, NRF_UARTE23); +CHECK_DT_REG(uart24, NRF_UARTE24); CHECK_DT_REG(uart30, NRF_UARTE30); CHECK_DT_REG(uart120, NRF_UARTE120); CHECK_DT_REG(uart130, NRF_UARTE130); From 8c6c814d571bc9df6092d44a040d0ae308238a49 Mon Sep 17 00:00:00 2001 From: Piotr Kosycarz Date: Thu, 29 May 2025 12:13:34 +0200 Subject: [PATCH 0039/2141] [nrf fromtree] tests: drivers: spi: spi_loopback: configure spi latency expectation Allow to customize scaling factor used to compare ideal spi transfer and measured one. Signed-off-by: Piotr Kosycarz (cherry picked from commit d7006195ac793de9dd354fa59159b77443c6321e) --- tests/drivers/spi/spi_loopback/Kconfig | 4 ++++ .../spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuapp.conf | 1 + .../spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpurad.conf | 1 + tests/drivers/spi/spi_loopback/src/spi.c | 6 ++++-- 4 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuapp.conf create mode 100644 tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpurad.conf diff --git a/tests/drivers/spi/spi_loopback/Kconfig b/tests/drivers/spi/spi_loopback/Kconfig index f3d89bf7317e..b1d81eb13aa1 100644 --- a/tests/drivers/spi/spi_loopback/Kconfig +++ b/tests/drivers/spi/spi_loopback/Kconfig @@ -11,6 +11,10 @@ config SPI_LARGE_BUFFER_SIZE int "Large buffer size" default 8192 +config SPI_IDEAL_TRANSFER_DURATION_SCALING + int "Scaling factor to compare ideal and measured SPI transfer duration" + default 8 + if SOC_SERIES_STM32H7X config SPI_LOOPBACK_16BITS_FRAMES diff --git a/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuapp.conf b/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuapp.conf new file mode 100644 index 000000000000..ad922ab8d26f --- /dev/null +++ b/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuapp.conf @@ -0,0 +1 @@ +CONFIG_SPI_IDEAL_TRANSFER_DURATION_SCALING=12 diff --git a/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpurad.conf b/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpurad.conf new file mode 100644 index 000000000000..ad922ab8d26f --- /dev/null +++ b/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpurad.conf @@ -0,0 +1 @@ +CONFIG_SPI_IDEAL_TRANSFER_DURATION_SCALING=12 diff --git a/tests/drivers/spi/spi_loopback/src/spi.c b/tests/drivers/spi/spi_loopback/src/spi.c index f00a720677a3..64649ce7566b 100644 --- a/tests/drivers/spi/spi_loopback/src/spi.c +++ b/tests/drivers/spi/spi_loopback/src/spi.c @@ -327,7 +327,7 @@ ZTEST(spi_loopback, test_spi_complete_multiple_timed) /* Fail if transfer is faster than theoretically possible */ zassert_true(time_spent_us >= minimum_transfer_time_us, - "Transfer faster than theoretically possible"); + "Transfer faster than theoretically possible"); /* handle overflow for print statement */ latency_measurement = time_spent_us - expected_transfer_time_us; @@ -337,7 +337,9 @@ ZTEST(spi_loopback, test_spi_complete_multiple_timed) TC_PRINT("Latency measurement: %llu us\n", latency_measurement); /* Allow some overhead, but not too much */ - zassert_true(time_spent_us <= expected_transfer_time_us * 8, "Very high latency"); + zassert_true(time_spent_us <= + expected_transfer_time_us * CONFIG_SPI_IDEAL_TRANSFER_DURATION_SCALING, + "Very high latency"); spi_loopback_compare_bufs(buffer_tx, buffer_rx, BUF_SIZE, buffer_print_tx, buffer_print_rx); From 524d8073b4caa3d49beda3020fbc7b69459392d9 Mon Sep 17 00:00:00 2001 From: Bartosz Miller Date: Fri, 13 Jun 2025 12:41:58 +0200 Subject: [PATCH 0040/2141] [nrf fromtree] tests: boards: nrf: i2c: Fix nrf52 and nrf53 pin assignment Fix the i2c loopbacks pins assignments for nrf52 and nrf53 to allow automated testing. Signed-off-by: Bartosz Miller (cherry picked from commit 8aa6557c95c10f388d3fd98e5ba94bdc3f2ec13d) --- .../boards/nrf52840dk_nrf52840.overlay | 18 ++++++++---------- .../boards/nrf5340dk_nrf5340_cpuapp.overlay | 14 ++++++-------- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/tests/boards/nrf/i2c/i2c_slave/boards/nrf52840dk_nrf52840.overlay b/tests/boards/nrf/i2c/i2c_slave/boards/nrf52840dk_nrf52840.overlay index 40c74354e30e..121ac01b7a7d 100644 --- a/tests/boards/nrf/i2c/i2c_slave/boards/nrf52840dk_nrf52840.overlay +++ b/tests/boards/nrf/i2c/i2c_slave/boards/nrf52840dk_nrf52840.overlay @@ -7,33 +7,31 @@ &pinctrl { i2c0_default_alt: i2c0_default_alt { group1 { - psels = , - ; + psels = , + ; }; }; i2c0_sleep_alt: i2c0_sleep_alt { group1 { - psels = , - ; + psels = , + ; low-power-enable; }; }; i2c1_default_alt: i2c1_default_alt { group1 { -/* Temporary workaround as it is currently not possible - * to configure pins for TWIS with pinctrl. */ - psels = , - ; + psels = , + ; bias-pull-up; }; }; i2c1_sleep_alt: i2c1_sleep_alt { group1 { - psels = , - ; + psels = , + ; low-power-enable; }; }; diff --git a/tests/boards/nrf/i2c/i2c_slave/boards/nrf5340dk_nrf5340_cpuapp.overlay b/tests/boards/nrf/i2c/i2c_slave/boards/nrf5340dk_nrf5340_cpuapp.overlay index 48577a5a8edf..2ccac66dc723 100644 --- a/tests/boards/nrf/i2c/i2c_slave/boards/nrf5340dk_nrf5340_cpuapp.overlay +++ b/tests/boards/nrf/i2c/i2c_slave/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -8,32 +8,30 @@ i2c1_default_alt: i2c1_default_alt { group1 { psels = , - ; + ; }; }; i2c1_sleep_alt: i2c1_sleep_alt { group1 { psels = , - ; + ; low-power-enable; }; }; i2c2_default_alt: i2c2_default_alt { group1 { -/* Temporary workaround as it is currently not possible - * to configure pins for TWIS with pinctrl. */ - psels = , - ; + psels = , + ; bias-pull-up; }; }; i2c2_sleep_alt: i2c2_sleep_alt { group1 { - psels = , - ; + psels = , + ; low-power-enable; }; }; From 3613ade88e9b997a565c3adf1a26357c31d88d22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Stasiak?= Date: Mon, 16 Jun 2025 12:11:23 +0200 Subject: [PATCH 0041/2141] [nrf fromtree] drivers: adc: adc_nrfx_saadc: Extend internal reference values MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Current target-reference mapping does not cover all cases. Signed-off-by: Michał Stasiak (cherry picked from commit 4d6585488b423db43cea272146a2fb184252b575) --- drivers/adc/adc_nrfx_saadc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/adc/adc_nrfx_saadc.c b/drivers/adc/adc_nrfx_saadc.c index a9cc1c4f36b9..986cca49af8f 100644 --- a/drivers/adc/adc_nrfx_saadc.c +++ b/drivers/adc/adc_nrfx_saadc.c @@ -754,7 +754,9 @@ static DEVICE_API(adc, adc_nrfx_driver_api) = { #ifdef CONFIG_ADC_ASYNC .read_async = adc_nrfx_read_async, #endif -#if defined(CONFIG_SOC_COMPATIBLE_NRF54LX) +#if defined(NRF54LV10A_ENGA_XXAA) + .ref_internal = 1300, +#elif defined(CONFIG_SOC_COMPATIBLE_NRF54LX) .ref_internal = 900, #elif defined(CONFIG_NRF_PLATFORM_HALTIUM) .ref_internal = 1024, From 6b5f7ae654a14942896d7165b0efe69ed2af0e0a Mon Sep 17 00:00:00 2001 From: Adam Kondraciuk Date: Thu, 12 Jun 2025 12:34:01 +0200 Subject: [PATCH 0042/2141] [nrf fromlist] tests: drivers: timer: nrf_grtc_timer: Align tests with uptime changes Update GRTC tests to reflect uptime reset at startup. Upstream PR #: 91432 Signed-off-by: Adam Kondraciuk (cherry picked from commit 442eaf618fdc2c47a5dbfc6155e09130d2fe6ac3) --- tests/drivers/timer/nrf_grtc_timer/src/main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/drivers/timer/nrf_grtc_timer/src/main.c b/tests/drivers/timer/nrf_grtc_timer/src/main.c index f53188841bdb..cede54f026f1 100644 --- a/tests/drivers/timer/nrf_grtc_timer/src/main.c +++ b/tests/drivers/timer/nrf_grtc_timer/src/main.c @@ -28,6 +28,7 @@ ZTEST(nrf_grtc_timer, test_get_ticks) { k_timeout_t t = K_MSEC(1); + uint64_t grtc_start_value = z_nrf_grtc_timer_startup_value_get(); uint64_t exp_ticks = z_nrf_grtc_timer_read() + t.ticks * CYC_PER_TICK; int64_t ticks; @@ -51,6 +52,7 @@ ZTEST(nrf_grtc_timer, test_get_ticks) curr_tick2 = sys_clock_tick_get(); } while (curr_tick != curr_tick2); + curr_tick += (grtc_start_value / CYC_PER_TICK); t = Z_TIMEOUT_TICKS(Z_TICK_ABS(curr_tick - K_MSEC(1).ticks)); exp_ticks = curr_grtc_tick - K_MSEC(1).ticks * CYC_PER_TICK; @@ -69,6 +71,7 @@ ZTEST(nrf_grtc_timer, test_get_ticks) curr_tick2 = sys_clock_tick_get(); } while (curr_tick != curr_tick2); + curr_tick += (grtc_start_value / CYC_PER_TICK); t = Z_TIMEOUT_TICKS(Z_TICK_ABS(curr_tick + K_MSEC(10).ticks)); exp_ticks = curr_grtc_tick + K_MSEC(10).ticks * CYC_PER_TICK; ticks = z_nrf_grtc_timer_get_ticks(t); From 47939c23763333f501a79764f2aff9eaf56fe962 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Wed, 28 May 2025 11:23:30 +0200 Subject: [PATCH 0043/2141] [nrf fromtree] tests: drivers: i2s: Add i2s_additional tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Extend I2S testing with additional test cases that verify I2S/TDM driver operation at various configurations. Check: - word sizes of 8, 16, 24, 32 and 48 bits; - one, two, four and eight audio channels configuration; - data format I2S, Left Justified, Right Justified, PCM Long, PCM Short; - data order MSB and LSB first; - bit clock and frame clock inversion; - block size of 6 bytes; - bit clock continuous and gated; - internal loopback; - pingpong option. Signed-off-by: Sebastian Głąb (cherry picked from commit a58684db38e7821b96bc27c3bde79145c3ea473c) --- .../drivers/i2s/i2s_additional/CMakeLists.txt | 9 + tests/drivers/i2s/i2s_additional/Kconfig | 168 ++++ .../boards/nrf52840dk_nrf52840.conf | 1 + .../boards/nrf52840dk_nrf52840.overlay | 28 + .../boards/nrf5340dk_nrf5340_cpuapp.overlay | 32 + .../nrf5340dk_nrf5340_cpuapp_aclk.overlay | 9 + .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 31 + .../boards/nrf54l15dk_nrf54l15_cpuapp.overlay | 30 + tests/drivers/i2s/i2s_additional/prj.conf | 2 + tests/drivers/i2s/i2s_additional/src/main.c | 850 ++++++++++++++++++ .../drivers/i2s/i2s_additional/testcase.yaml | 39 + 11 files changed, 1199 insertions(+) create mode 100644 tests/drivers/i2s/i2s_additional/CMakeLists.txt create mode 100644 tests/drivers/i2s/i2s_additional/Kconfig create mode 100644 tests/drivers/i2s/i2s_additional/boards/nrf52840dk_nrf52840.conf create mode 100644 tests/drivers/i2s/i2s_additional/boards/nrf52840dk_nrf52840.overlay create mode 100644 tests/drivers/i2s/i2s_additional/boards/nrf5340dk_nrf5340_cpuapp.overlay create mode 100644 tests/drivers/i2s/i2s_additional/boards/nrf5340dk_nrf5340_cpuapp_aclk.overlay create mode 100644 tests/drivers/i2s/i2s_additional/boards/nrf54h20dk_nrf54h20_cpuapp.overlay create mode 100644 tests/drivers/i2s/i2s_additional/boards/nrf54l15dk_nrf54l15_cpuapp.overlay create mode 100644 tests/drivers/i2s/i2s_additional/prj.conf create mode 100644 tests/drivers/i2s/i2s_additional/src/main.c create mode 100644 tests/drivers/i2s/i2s_additional/testcase.yaml diff --git a/tests/drivers/i2s/i2s_additional/CMakeLists.txt b/tests/drivers/i2s/i2s_additional/CMakeLists.txt new file mode 100644 index 000000000000..490a0ddb7d68 --- /dev/null +++ b/tests/drivers/i2s/i2s_additional/CMakeLists.txt @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) + +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(i2s_additional) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/drivers/i2s/i2s_additional/Kconfig b/tests/drivers/i2s/i2s_additional/Kconfig new file mode 100644 index 000000000000..3c80dba48532 --- /dev/null +++ b/tests/drivers/i2s/i2s_additional/Kconfig @@ -0,0 +1,168 @@ +# +# Copyright (c) 2025 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 +# + +mainmenu "I2S Additional Test" + +source "Kconfig.zephyr" + +config I2S_TEST_USE_GPIO_LOOPBACK + bool "Use GPIO loopback" + default y if DT_HAS_NORDIC_NRF_I2S_ENABLED || DT_HAS_NORDIC_NRF_TDM_ENABLED + help + Use wiring between the data-out and data-in pins for looping back + data. This option is intended to be used for devices that do not + provide the internal loopback functionality. + +config I2S_TEST_ALLOWED_DATA_OFFSET + int "Allowed offset in received data" + default 2 if DT_HAS_NORDIC_NRF_I2S_ENABLED || DT_HAS_NORDIC_NRF_TDM_ENABLED + default 0 + help + Maximum allowed offset between sent and received samples. Non-zero + value of this option may be needed when GPIO loopback is used. + +config I2S_TEST_WORD_SIZE_8_BIT_UNSUPPORTED + bool "8 bit word size is not supported by the driver" + help + When set to 'y', test will check that i2s_configure() returns -EINVAL. + When set to 'n', test will do the transmission. + +config I2S_TEST_WORD_SIZE_16_BIT_UNSUPPORTED + bool "16 bit word size is not supported by the driver" + help + When set to 'y', test will check that i2s_configure() returns -EINVAL. + When set to 'n', test will do the transmission. + +config I2S_TEST_WORD_SIZE_24_BIT_UNSUPPORTED + bool "24 bit word size is not supported by the driver" + help + When set to 'y', test will check that i2s_configure() returns -EINVAL. + When set to 'n', test will do the transmission. + +config I2S_TEST_WORD_SIZE_32_BIT_UNSUPPORTED + bool "32 bit word size is not supported by the driver" + help + When set to 'y', test will check that i2s_configure() returns -EINVAL. + When set to 'n', test will do the transmission. + +config I2S_TEST_WORD_SIZE_48_BIT_UNSUPPORTED + bool "48 bit word size is not supported by the driver" + default y if DT_HAS_NORDIC_NRF_I2S_ENABLED || DT_HAS_NORDIC_NRF_TDM_ENABLED + help + When set to 'y', test will check that i2s_configure() returns -EINVAL. + When set to 'n', test will do the transmission. + +config I2S_TEST_ONE_CHANNEL_UNSUPPORTED + bool "Single audio channel is not supported by the driver" + help + When set to 'y', test will check that i2s_configure() returns -EINVAL. + When set to 'n', test will do the transmission. + +config I2S_TEST_FOUR_CHANNELS_UNSUPPORTED + bool "Four audio channels are not supported by the driver" + default y if DT_HAS_NORDIC_NRF_I2S_ENABLED + help + When set to 'y', test will check that i2s_configure() returns -EINVAL. + When set to 'n', test will do the transmission. + +config I2S_TEST_EIGHT_CHANNELS_UNSUPPORTED + bool "Eight audio channels are not supported by the driver" + default y if DT_HAS_NORDIC_NRF_I2S_ENABLED + help + When set to 'y', test will check that i2s_configure() returns -EINVAL. + When set to 'n', test will do the transmission. + +config I2S_TEST_DATA_FORMAT_I2S_UNSUPPORTED + bool "I2S_FMT_DATA_FORMAT_I2S is not supported by the driver" + help + When set to 'y', test will check that i2s_configure() returns -EINVAL. + When set to 'n', test will do the transmission. + +config I2S_TEST_DATA_FORMAT_LEFT_JUSTIFIED_UNSUPPORTED + bool "I2S_FMT_DATA_FORMAT_LEFT_JUSTIFIED is not supported by the driver" + help + When set to 'y', test will check that i2s_configure() returns -EINVAL. + When set to 'n', test will do the transmission. + +config I2S_TEST_DATA_FORMAT_RIGHT_JUSTIFIED_UNSUPPORTED + bool "I2S_FMT_DATA_FORMAT_RIGHT_JUSTIFIED is not supported by the driver" + help + When set to 'y', test will check that i2s_configure() returns -EINVAL. + When set to 'n', test will do the transmission. + +config I2S_TEST_DATA_FORMAT_PCM_LONG_UNSUPPORTED + bool "I2S_FMT_DATA_FORMAT_PCM_LONG is not supported by the driver" + default y if DT_HAS_NORDIC_NRF_I2S_ENABLED + help + When set to 'y', test will check that i2s_configure() returns -EINVAL. + When set to 'n', test will do the transmission. + +config I2S_TEST_DATA_FORMAT_PCM_SHORT_UNSUPPORTED + bool "I2S_FMT_DATA_FORMAT_PCM_SHORT is not supported by the driver" + default y if DT_HAS_NORDIC_NRF_I2S_ENABLED + help + When set to 'y', test will check that i2s_configure() returns -EINVAL. + When set to 'n', test will do the transmission. + +config I2S_TEST_DATA_ORDER_MSB_UNSUPPORTED + bool "I2S_FMT_DATA_ORDER_MSB is not supported by the driver" + help + When set to 'y', test will check that i2s_configure() returns -EINVAL. + When set to 'n', test will do the transmission. + +config I2S_TEST_DATA_ORDER_LSB_UNSUPPORTED + bool "I2S_FMT_DATA_ORDER_LSB is not supported by the driver" + default y if DT_HAS_NORDIC_NRF_I2S_ENABLED || DT_HAS_NORDIC_NRF_TDM_ENABLED + help + When set to 'y', test will check that i2s_configure() returns -EINVAL. + When set to 'n', test will do the transmission. + +config I2S_TEST_BIT_CLK_INV_UNSUPPORTED + bool "I2S_FMT_BIT_CLK_INV is not supported by the driver" + default y if DT_HAS_NORDIC_NRF_I2S_ENABLED || DT_HAS_NORDIC_NRF_TDM_ENABLED + help + When set to 'y', test will check that i2s_configure() returns -EINVAL. + When set to 'n', test will do the transmission. + +config I2S_TEST_FRAME_CLK_INV_UNSUPPORTED + bool "I2S_FMT_FRAME_CLK_INV is not supported by the driver" + default y if DT_HAS_NORDIC_NRF_I2S_ENABLED || DT_HAS_NORDIC_NRF_TDM_ENABLED + help + When set to 'y', test will check that i2s_configure() returns -EINVAL. + When set to 'n', test will do the transmission. + +config I2S_TEST_BLOCK_SIZE_6_UNSUPPORTED + bool "Block_size of 6 is not supported by the driver" + default y if DT_HAS_NORDIC_NRF_I2S_ENABLED || DT_HAS_NORDIC_NRF_TDM_ENABLED + help + When set to 'y', test will check that i2s_configure() returns -EINVAL. + When set to 'n', test will do the transmission. + +config I2S_TEST_OPTIONS_BIT_CLK_CONT_UNSUPPORTED + bool "I2S_OPT_BIT_CLK_CONT is not supported by the driver" + help + When set to 'y', test will check that i2s_configure() returns -EINVAL. + When set to 'n', test will do the transmission. + +config I2S_TEST_OPTIONS_BIT_CLK_GATED_UNSUPPORTED + bool "I2S_OPT_BIT_CLK_GATED is not supported by the driver" + help + When set to 'y', test will check that i2s_configure() returns -EINVAL. + When set to 'n', test will do the transmission. + +config I2S_TEST_OPTIONS_LOOPBACK_UNSUPPORTED + bool "I2S_OPT_LOOPBACK is not supported by the driver" + default y if DT_HAS_NORDIC_NRF_I2S_ENABLED || DT_HAS_NORDIC_NRF_TDM_ENABLED + help + When set to 'y', test will check that i2s_configure() returns -EINVAL. + When set to 'n', test will do the transmission. + +config I2S_TEST_OPTIONS_PINGPONG_UNSUPPORTED + bool "I2S_OPT_PINGPONG is not supported by the driver" + default y if DT_HAS_NORDIC_NRF_I2S_ENABLED || DT_HAS_NORDIC_NRF_TDM_ENABLED + help + When set to 'y', test will check that i2s_configure() returns -EINVAL. + When set to 'n', test will do the transmission. diff --git a/tests/drivers/i2s/i2s_additional/boards/nrf52840dk_nrf52840.conf b/tests/drivers/i2s/i2s_additional/boards/nrf52840dk_nrf52840.conf new file mode 100644 index 000000000000..8ed6ee234db2 --- /dev/null +++ b/tests/drivers/i2s/i2s_additional/boards/nrf52840dk_nrf52840.conf @@ -0,0 +1 @@ +CONFIG_I2S_TEST_WORD_SIZE_32_BIT_UNSUPPORTED=y diff --git a/tests/drivers/i2s/i2s_additional/boards/nrf52840dk_nrf52840.overlay b/tests/drivers/i2s/i2s_additional/boards/nrf52840dk_nrf52840.overlay new file mode 100644 index 000000000000..ca21135bca4f --- /dev/null +++ b/tests/drivers/i2s/i2s_additional/boards/nrf52840dk_nrf52840.overlay @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + aliases { + i2s-node0 = &i2s0; + }; +}; + +&pinctrl { + i2s0_default_alt: i2s0_default_alt { + group1 { + psels = , + , + , + ; + }; + }; +}; + +&i2s0 { + status = "okay"; + pinctrl-0 = <&i2s0_default_alt>; + pinctrl-names = "default"; +}; diff --git a/tests/drivers/i2s/i2s_additional/boards/nrf5340dk_nrf5340_cpuapp.overlay b/tests/drivers/i2s/i2s_additional/boards/nrf5340dk_nrf5340_cpuapp.overlay new file mode 100644 index 000000000000..a4c595b1bcdb --- /dev/null +++ b/tests/drivers/i2s/i2s_additional/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + aliases { + i2s-node0 = &i2s0; + }; +}; + +&pinctrl { + i2s0_default_alt: i2s0_default_alt { + group1 { + psels = , + , + , + ; + }; + }; +}; + +&uart1 { + status = "disabled"; +}; + +&i2s0 { + status = "okay"; + pinctrl-0 = <&i2s0_default_alt>; + pinctrl-names = "default"; +}; diff --git a/tests/drivers/i2s/i2s_additional/boards/nrf5340dk_nrf5340_cpuapp_aclk.overlay b/tests/drivers/i2s/i2s_additional/boards/nrf5340dk_nrf5340_cpuapp_aclk.overlay new file mode 100644 index 000000000000..e262ca8d8a87 --- /dev/null +++ b/tests/drivers/i2s/i2s_additional/boards/nrf5340dk_nrf5340_cpuapp_aclk.overlay @@ -0,0 +1,9 @@ +/* Drive i2s peripheral from ACLK. */ + +&clock { + hfclkaudio-frequency = <11289600>; +}; + +&i2s0 { + clock-source = "ACLK"; +}; diff --git a/tests/drivers/i2s/i2s_additional/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/i2s/i2s_additional/boards/nrf54h20dk_nrf54h20_cpuapp.overlay new file mode 100644 index 000000000000..7734b5cf284f --- /dev/null +++ b/tests/drivers/i2s/i2s_additional/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* i2s-node0 is the transmitter/receiver */ + +/ { + aliases { + i2s-node0 = &tdm130; + }; +}; + +&pinctrl { + tdm130_default_alt: tdm130_default_alt { + group1 { + psels = , + , + , + ; + }; + }; +}; + +&tdm130 { + status = "okay"; + pinctrl-0 = <&tdm130_default_alt>; + pinctrl-names = "default"; + memory-regions = <&cpuapp_dma_region>; +}; diff --git a/tests/drivers/i2s/i2s_additional/boards/nrf54l15dk_nrf54l15_cpuapp.overlay b/tests/drivers/i2s/i2s_additional/boards/nrf54l15dk_nrf54l15_cpuapp.overlay new file mode 100644 index 000000000000..c8ede4b8c2b1 --- /dev/null +++ b/tests/drivers/i2s/i2s_additional/boards/nrf54l15dk_nrf54l15_cpuapp.overlay @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* i2s-node0 is the transmitter/receiver */ + +/ { + aliases { + i2s-node0 = &i2s20; + }; +}; + +&pinctrl { + i2s20_default_alt: i2s20_default_alt { + group1 { + psels = , + , + , + ; + }; + }; +}; + +&i2s20 { + status = "okay"; + pinctrl-0 = <&i2s20_default_alt>; + pinctrl-names = "default"; +}; diff --git a/tests/drivers/i2s/i2s_additional/prj.conf b/tests/drivers/i2s/i2s_additional/prj.conf new file mode 100644 index 000000000000..99ff252406a1 --- /dev/null +++ b/tests/drivers/i2s/i2s_additional/prj.conf @@ -0,0 +1,2 @@ +CONFIG_I2S=y +CONFIG_ZTEST=y diff --git a/tests/drivers/i2s/i2s_additional/src/main.c b/tests/drivers/i2s/i2s_additional/src/main.c new file mode 100644 index 000000000000..e8852850cee5 --- /dev/null +++ b/tests/drivers/i2s/i2s_additional/src/main.c @@ -0,0 +1,850 @@ +/* + * Copyright (c) 2017 comsuisse AG + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include + +#include +LOG_MODULE_REGISTER(i2s_add, LOG_LEVEL_INF); + +#define I2S_DEV_NODE DT_ALIAS(i2s_node0) + +#define WORD_SIZE 16U +#define NUMBER_OF_CHANNELS 2 +#define FRAME_CLK_FREQ 44100 + +#define NUM_BLOCKS 20 +#define TIMEOUT 1000 + +#define SAMPLES_COUNT 64 + +/* The data_l represent a sine wave */ +static int16_t data_l[SAMPLES_COUNT] = { + 3211, 6392, 9511, 12539, 15446, 18204, 20787, 23169, + 25329, 27244, 28897, 30272, 31356, 32137, 32609, 32767, + 32609, 32137, 31356, 30272, 28897, 27244, 25329, 23169, + 20787, 18204, 15446, 12539, 9511, 6392, 3211, 0, + -3212, -6393, -9512, -12540, -15447, -18205, -20788, -23170, + -25330, -27245, -28898, -30273, -31357, -32138, -32610, -32767, + -32610, -32138, -31357, -30273, -28898, -27245, -25330, -23170, + -20788, -18205, -15447, -12540, -9512, -6393, -3212, -1, +}; + +/* The data_r represent a sine wave shifted by 90 deg to data_l sine wave */ +static int16_t data_r[SAMPLES_COUNT] = { + 32609, 32137, 31356, 30272, 28897, 27244, 25329, 23169, + 20787, 18204, 15446, 12539, 9511, 6392, 3211, 0, + -3212, -6393, -9512, -12540, -15447, -18205, -20788, -23170, + -25330, -27245, -28898, -30273, -31357, -32138, -32610, -32767, + -32610, -32138, -31357, -30273, -28898, -27245, -25330, -23170, + -20788, -18205, -15447, -12540, -9512, -6393, -3212, -1, + 3211, 6392, 9511, 12539, 15446, 18204, 20787, 23169, + 25329, 27244, 28897, 30272, 31356, 32137, 32609, 32767, +}; + +#define BLOCK_SIZE (2 * sizeof(data_l)) + +#ifdef CONFIG_NOCACHE_MEMORY + #define MEM_SLAB_CACHE_ATTR __nocache +#else + #define MEM_SLAB_CACHE_ATTR +#endif /* CONFIG_NOCACHE_MEMORY */ + +/* + * NUM_BLOCKS is the number of blocks used by the test. Some of the drivers, + * permanently keep ownership of a few RX buffers. Add a two more + * RX blocks to satisfy this requirement + */ +static char MEM_SLAB_CACHE_ATTR __aligned(WB_UP(32)) + _k_mem_slab_buf_rx_0_mem_slab[(NUM_BLOCKS + 2) * WB_UP(BLOCK_SIZE)]; +STRUCT_SECTION_ITERABLE(k_mem_slab, rx_0_mem_slab) = + Z_MEM_SLAB_INITIALIZER(rx_0_mem_slab, _k_mem_slab_buf_rx_0_mem_slab, + WB_UP(BLOCK_SIZE), NUM_BLOCKS + 2); + +static char MEM_SLAB_CACHE_ATTR __aligned(WB_UP(32)) + _k_mem_slab_buf_tx_0_mem_slab[(NUM_BLOCKS) * WB_UP(BLOCK_SIZE)]; +STRUCT_SECTION_ITERABLE(k_mem_slab, tx_0_mem_slab) = + Z_MEM_SLAB_INITIALIZER(tx_0_mem_slab, _k_mem_slab_buf_tx_0_mem_slab, + WB_UP(BLOCK_SIZE), NUM_BLOCKS); + +static const struct device *dev_i2s; + +static const struct i2s_config default_i2s_cfg = { + .word_size = WORD_SIZE, + .channels = NUMBER_OF_CHANNELS, + .format = I2S_FMT_DATA_FORMAT_I2S, + .frame_clk_freq = FRAME_CLK_FREQ, + .block_size = BLOCK_SIZE, + .timeout = TIMEOUT, +#if defined(CONFIG_I2S_TEST_USE_GPIO_LOOPBACK) + .options = I2S_OPT_FRAME_CLK_MASTER | I2S_OPT_BIT_CLK_MASTER, +#else + .options = I2S_OPT_FRAME_CLK_MASTER | I2S_OPT_BIT_CLK_MASTER | I2S_OPT_LOOPBACK, +#endif + .mem_slab = &tx_0_mem_slab, +}; + +#if (CONFIG_I2S_TEST_ALLOWED_DATA_OFFSET > 0) +/* Data offset may differ when test uses I2S with different configuration. */ +static int offset; +static int16_t word_size_bytes; +static int16_t sample_in_bytes; +#endif + +/* Fill in TX buffer with test samples. */ +static void fill_buf(int16_t *tx_block, uint8_t word_size) +{ + + /* Technically, this is correct for word_size of 16 bits only + * (incorrect for word_size of 8, 24 and 32 bit). + * However, tests checks if received bytes are identical to + * the transmitted ones. Meaning of transmitted data is irrelevant. + */ + if (word_size == 24) { + int8_t *tx_block_8bit = (int8_t *) tx_block; + int8_t *data_l_8bit = (int8_t *) &data_l; + int8_t *data_r_8bit = (int8_t *) &data_r; + int16_t tx_cnt = 0; + int16_t l_cnt = 0; + int16_t r_cnt = 0; + + while (tx_cnt < BLOCK_SIZE) { + tx_block_8bit[tx_cnt++] = data_l_8bit[l_cnt++]; + tx_block_8bit[tx_cnt++] = data_l_8bit[l_cnt++]; + tx_block_8bit[tx_cnt++] = data_l_8bit[l_cnt++]; + tx_block_8bit[tx_cnt++] = 0; + tx_block_8bit[tx_cnt++] = data_r_8bit[r_cnt++]; + tx_block_8bit[tx_cnt++] = data_r_8bit[r_cnt++]; + tx_block_8bit[tx_cnt++] = data_r_8bit[r_cnt++]; + tx_block_8bit[tx_cnt++] = 0; + } + } else { + for (int i = 0; i < SAMPLES_COUNT; i++) { + tx_block[2 * i] = data_l[i]; + tx_block[2 * i + 1] = data_r[i]; + } + } +} + +static int verify_buf(int16_t *rx_block, uint8_t word_size, uint8_t channels) +{ + int sample_no = SAMPLES_COUNT; + bool same = true; + +/* Find offset. + * This doesn't handle correctly situation when + * word_size is 8 bit and offset is odd. + */ +#if (CONFIG_I2S_TEST_ALLOWED_DATA_OFFSET > 0) + /* Offset -1 means that offset has to be detected. */ + if (offset < 0) { + LOG_HEXDUMP_DBG(rx_block, BLOCK_SIZE, "Received"); + + /* When word_size is: + * 8 bit, it occupies 8/8 = 1 byte, + * 16 bit, it occupies 16/8 = 2 bytes, + * 24 bit, it occupies 4 bytes, + * 32 bit, it occupies 32/8 = 4 bytes, + * in TX/RX buffers. + */ + word_size_bytes = (word_size == 24) ? 4 : word_size / 8; + LOG_DBG("word_size_bytes = %u", word_size_bytes); + + /* Offset is in 'samples'. + * + * One 'sample' is data for all channels: + * two channels, 8 bit word -> sample is 2 bytes + * two channels, 16 bit word -> sample is 4 bytes + * two channels, 24 bit word -> sample is 8 bytes (24 bit extended to 32 bit) + * two channels, 32 bit word -> sample is 8 bytes + */ + sample_in_bytes = channels * word_size_bytes; + LOG_DBG("sample_in_bytes = %u", sample_in_bytes); + + do { + ++offset; + if (offset > CONFIG_I2S_TEST_ALLOWED_DATA_OFFSET) { + TC_PRINT("Allowed data offset (%d) exceeded\n", + CONFIG_I2S_TEST_ALLOWED_DATA_OFFSET); + return -TC_FAIL; + } + } while (rx_block[offset * sample_in_bytes / 2] != data_l[0]); + TC_PRINT("Using data offset: %d (%u bytes)\n", offset, + offset * sample_in_bytes); + } + + /* Divided by 2 because rx_block is uint16 */ + rx_block += (offset * sample_in_bytes / 2); + sample_no -= (offset * word_size_bytes / 2); + LOG_DBG("sample_no = %u", sample_no); +#endif + + /* Compare received data with sent values. */ + if (word_size == 24) { + int8_t *rx_block_8bit = (int8_t *) rx_block; + int8_t *data_l_8bit = (int8_t *) &data_l; + int8_t *data_r_8bit = (int8_t *) &data_r; + int16_t rx_cnt = 0; + int16_t temp = 0; + int8_t expected = 0; + + while (rx_cnt < (BLOCK_SIZE - offset * sample_in_bytes)) { +/* Map byte number from RX array to channel array + * + * rx_cnt | l_index | r_index || rx_cnt/8 | rx_cnt%4 | (rx_cnt/8)*3+(rx_cnt%4) + * 0 | 0 | || 0 | 0 | 0*3+0 = 0 data_l + * 1 | 1 | || 0 | 1 | 0*3+1 = 1 data_l + * 2 | 2 | || 0 | 2 | 0*3+2 = 2 data_l + * 3 | - | || 0 | 3 | 0*3+3 = 3 ignore + * 4 | | 0 || 0 | 0 | 0*3+0 = 0 data_r + * 5 | | 1 || 0 | 1 | 0*3+1 = 1 data_r + * 6 | | 2 || 0 | 2 | 0*3+2 = 2 data_r + * 7 | | - || 0 | 3 | 0*3+3 = 3 ignore + * + * 8 | 3 | || 1 | 0 | 1*3+0 = 3 data_l + * 9 | 4 | || 1 | 1 | 1*3+1 = 4 data_l + * 10 | 5 | || 1 | 2 | 1*3+2 = 5 data_l + * 11 | - | || 1 | 3 | 1*3+3 = 6 ignore + * 12 | | 3 || 1 | 0 | 1*3+0 = 3 data_r + * 13 | | 4 || 1 | 1 | 1*3+1 = 4 data_r + * 14 | | 5 || 1 | 2 | 1*3+2 = 5 data_r + * 15 | | - || 1 | 3 | 1*3+3 = 6 ignore + * + * 16 | 6 | || 2 | 0 | 2*3+0 = 6 data_l + * ... + */ + temp = ((rx_cnt / 8) * 3) + (rx_cnt % 4); + + if ((rx_cnt % 8) < 4) { + /* Compare with left channel. */ + expected = data_l_8bit[temp]; + } else { + /* Compare with right channel. */ + expected = data_r_8bit[temp]; + } + + if ((rx_cnt % 4) == 3) { + /* Ignore every fourth byte */ + } else { + /* Compare received data with expected value. */ + if (rx_block_8bit[rx_cnt] != expected) { + TC_PRINT("Index %d, expected 0x%x, actual 0x%x\n", + rx_cnt, expected, rx_block_8bit[rx_cnt]); + same = false; + } + } + /* Move to next received byte. */ + rx_cnt++; + } + + } else { + for (int i = 0; i < sample_no; i++) { + if (rx_block[2 * i] != data_l[i]) { + TC_PRINT("data_l, index %d, expected 0x%x, actual 0x%x\n", + i, data_l[i], rx_block[2 * i]); + same = false; + } + if (rx_block[2 * i + 1] != data_r[i]) { + TC_PRINT("data_r, index %d, expected 0x%x, actual 0x%x\n", + i, data_r[i], rx_block[2 * i + 1]); + same = false; + } + } + } + + if (!same) { + return -TC_FAIL; + } else { + return TC_PASS; + } +} + +static int configure_stream(const struct device *dev, enum i2s_dir dir, + struct i2s_config *i2s_cfg) +{ + int ret; + + if (dir == I2S_DIR_TX) { + /* Configure the Transmit port as Master */ + i2s_cfg->options = I2S_OPT_FRAME_CLK_MASTER + | I2S_OPT_BIT_CLK_MASTER; + } else if (dir == I2S_DIR_RX) { + /* Configure the Receive port as Slave */ + i2s_cfg->options = I2S_OPT_FRAME_CLK_SLAVE + | I2S_OPT_BIT_CLK_SLAVE; + } else { /* dir == I2S_DIR_BOTH */ + i2s_cfg->options = I2S_OPT_FRAME_CLK_MASTER + | I2S_OPT_BIT_CLK_MASTER; + } + + if (dir == I2S_DIR_TX || dir == I2S_DIR_BOTH) { + i2s_cfg->mem_slab = &tx_0_mem_slab; + ret = i2s_configure(dev, I2S_DIR_TX, i2s_cfg); + if (ret < 0) { + TC_PRINT("Failed to configure I2S TX stream (%d)\n", + ret); + return -TC_FAIL; + } + } + + if (dir == I2S_DIR_RX || dir == I2S_DIR_BOTH) { + i2s_cfg->mem_slab = &rx_0_mem_slab; + ret = i2s_configure(dev, I2S_DIR_RX, i2s_cfg); + if (ret < 0) { + TC_PRINT("Failed to configure I2S RX stream (%d)\n", + ret); + return -TC_FAIL; + } + } + + return TC_PASS; +} + +static void i2s_dir_both_transfer_long(struct i2s_config *i2s_cfg) +{ + void *rx_block[NUM_BLOCKS]; + void *tx_block[NUM_BLOCKS]; + size_t rx_size; + int tx_idx; + int rx_idx = 0; + int num_verified; + int ret; + + /* Configure I2S Dir Both transfer. */ + ret = configure_stream(dev_i2s, I2S_DIR_BOTH, i2s_cfg); + zassert_equal(ret, TC_PASS); + + /* Prepare TX data blocks */ + for (tx_idx = 0; tx_idx < NUM_BLOCKS; tx_idx++) { + ret = k_mem_slab_alloc(&tx_0_mem_slab, &tx_block[tx_idx], + K_FOREVER); + zassert_equal(ret, 0); + fill_buf((uint16_t *)tx_block[tx_idx], i2s_cfg->word_size); + } + + LOG_HEXDUMP_DBG(tx_block[0], BLOCK_SIZE, "transmitted"); + + tx_idx = 0; + + /* Prefill TX queue */ + ret = i2s_write(dev_i2s, tx_block[tx_idx++], BLOCK_SIZE); + zassert_equal(ret, 0); + + ret = i2s_write(dev_i2s, tx_block[tx_idx++], BLOCK_SIZE); + zassert_equal(ret, 0); + + ret = i2s_trigger(dev_i2s, I2S_DIR_BOTH, I2S_TRIGGER_START); + zassert_equal(ret, 0, "RX/TX START trigger failed\n"); + + while (tx_idx < NUM_BLOCKS) { + ret = i2s_write(dev_i2s, tx_block[tx_idx++], BLOCK_SIZE); + zassert_equal(ret, 0); + + ret = i2s_read(dev_i2s, &rx_block[rx_idx++], &rx_size); + zassert_equal(ret, 0, "Got unexpected %d", ret); + zassert_equal(rx_size, BLOCK_SIZE); + } + + /* All data written, drain TX queue and stop both streams. */ + ret = i2s_trigger(dev_i2s, I2S_DIR_BOTH, I2S_TRIGGER_DRAIN); + zassert_equal(ret, 0, "RX/TX DRAIN trigger failed"); + + ret = i2s_read(dev_i2s, &rx_block[rx_idx++], &rx_size); + zassert_equal(ret, 0); + zassert_equal(rx_size, BLOCK_SIZE); + + ret = i2s_read(dev_i2s, &rx_block[rx_idx++], &rx_size); + zassert_equal(ret, 0); + zassert_equal(rx_size, BLOCK_SIZE); + + TC_PRINT("%d TX blocks sent\n", tx_idx); + TC_PRINT("%d RX blocks received\n", rx_idx); + + /* Verify received data */ + num_verified = 0; + for (rx_idx = 0; rx_idx < NUM_BLOCKS; rx_idx++) { + ret = verify_buf((uint16_t *)rx_block[rx_idx], + i2s_cfg->word_size, i2s_cfg->channels); + if (ret != 0) { + TC_PRINT("%d RX block invalid\n", rx_idx); + } else { + num_verified++; + } + k_mem_slab_free(&rx_0_mem_slab, rx_block[rx_idx]); + } + zassert_equal(num_verified, NUM_BLOCKS, "Invalid RX blocks received"); +} + +/** @brief Test I2S transfer with word_size_8bit + */ +ZTEST(i2s_additional, test_01a_word_size_08bit) +{ + struct i2s_config i2s_cfg = default_i2s_cfg; + + i2s_cfg.word_size = 8; + +#if defined(CONFIG_I2S_TEST_WORD_SIZE_8_BIT_UNSUPPORTED) + int ret; + + ret = i2s_configure(dev_i2s, I2S_DIR_TX, &i2s_cfg); + zassert_equal(ret, -EINVAL, "Unexpected result %d", ret); +#else + i2s_dir_both_transfer_long(&i2s_cfg); +#endif +} + +/** @brief Test I2S transfer with word_size_16bit + */ +ZTEST(i2s_additional, test_01b_word_size_16bit) +{ + struct i2s_config i2s_cfg = default_i2s_cfg; + + i2s_cfg.word_size = 16; + +#if defined(CONFIG_I2S_TEST_WORD_SIZE_16_BIT_UNSUPPORTED) + int ret; + + ret = i2s_configure(dev_i2s, I2S_DIR_TX, &i2s_cfg); + zassert_equal(ret, -EINVAL, "Unexpected result %d", ret); +#else + i2s_dir_both_transfer_long(&i2s_cfg); +#endif +} + +/** @brief Test I2S transfer with word_size_24bit + */ +ZTEST(i2s_additional, test_01c_word_size_24bit) +{ + struct i2s_config i2s_cfg = default_i2s_cfg; + + i2s_cfg.word_size = 24; + +#if defined(CONFIG_I2S_TEST_WORD_SIZE_24_BIT_UNSUPPORTED) + int ret; + + ret = i2s_configure(dev_i2s, I2S_DIR_TX, &i2s_cfg); + zassert_equal(ret, -EINVAL, "Unexpected result %d", ret); +#else + i2s_dir_both_transfer_long(&i2s_cfg); +#endif +} + +/** @brief Test I2S transfer with word_size_32bit + */ +ZTEST(i2s_additional, test_01d_word_size_32bit) +{ + struct i2s_config i2s_cfg = default_i2s_cfg; + + i2s_cfg.word_size = 32; + +#if defined(CONFIG_I2S_TEST_WORD_SIZE_32_BIT_UNSUPPORTED) + int ret; + + ret = i2s_configure(dev_i2s, I2S_DIR_TX, &i2s_cfg); + zassert_equal(ret, -EINVAL, "Unexpected result %d", ret); +#else + i2s_dir_both_transfer_long(&i2s_cfg); +#endif +} + +/** @brief Test I2S transfer with word_size_48bit + */ +ZTEST(i2s_additional, test_01e_word_size_48bit) +{ + struct i2s_config i2s_cfg = default_i2s_cfg; + + i2s_cfg.word_size = 48; + +#if defined(CONFIG_I2S_TEST_WORD_SIZE_48_BIT_UNSUPPORTED) + int ret; + + ret = i2s_configure(dev_i2s, I2S_DIR_TX, &i2s_cfg); + zassert_equal(ret, -EINVAL, "Unexpected result %d", ret); +#else + i2s_dir_both_transfer_long(&i2s_cfg); +#endif +} + +/** @brief Test I2S transfer with one channel. + */ +ZTEST(i2s_additional, test_02a_one_channel) +{ + struct i2s_config i2s_cfg = default_i2s_cfg; + + i2s_cfg.channels = 1; + +#if defined(CONFIG_I2S_TEST_ONE_CHANNEL_UNSUPPORTED) + int ret; + + ret = i2s_configure(dev_i2s, I2S_DIR_TX, &i2s_cfg); + zassert_equal(ret, -EINVAL, "Unexpected result %d", ret); +#else + i2s_dir_both_transfer_long(&i2s_cfg); +#endif +} + +/** @brief Test I2S transfer with four channels. + */ +ZTEST(i2s_additional, test_02b_four_channels) +{ + struct i2s_config i2s_cfg = default_i2s_cfg; + + i2s_cfg.channels = 4; + +#if defined(CONFIG_I2S_TEST_FOUR_CHANNELS_UNSUPPORTED) + int ret; + + ret = i2s_configure(dev_i2s, I2S_DIR_TX, &i2s_cfg); + zassert_equal(ret, -EINVAL, "Unexpected result %d", ret); +#else /* CONFIG_I2S_TEST_FOUR_CHANNELS_UNSUPPORTED */ + + /* Select format that supports four channels. */ +#if !defined(CONFIG_I2S_TEST_DATA_FORMAT_PCM_LONG_UNSUPPORTED) + i2s_cfg.format = I2S_FMT_DATA_FORMAT_PCM_LONG; + TC_PRINT("Selected format is I2S_FMT_DATA_FORMAT_PCM_LONG\n"); +#elif !defined(CONFIG_I2S_TEST_DATA_FORMAT_PCM_SHORT_UNSUPPORTED) + i2s_cfg.format = I2S_FMT_DATA_FORMAT_PCM_SHORT; + TC_PRINT("Selected format is I2S_FMT_DATA_FORMAT_PCM_SHORT\n"); +#else +#error "Don't know what format supports four channels." +#endif + + i2s_dir_both_transfer_long(&i2s_cfg); +#endif /* CONFIG_I2S_TEST_FOUR_CHANNELS_UNSUPPORTED */ +} + +/** @brief Test I2S transfer with eight channels. + */ +ZTEST(i2s_additional, test_02c_eight_channels) +{ + struct i2s_config i2s_cfg = default_i2s_cfg; + + i2s_cfg.channels = 8; + +#if defined(CONFIG_I2S_TEST_EIGHT_CHANNELS_UNSUPPORTED) + int ret; + + ret = i2s_configure(dev_i2s, I2S_DIR_TX, &i2s_cfg); + zassert_equal(ret, -EINVAL, "Unexpected result %d", ret); +#else /* CONFIG_I2S_TEST_EIGHT_CHANNELS_UNSUPPORTED */ + + /* Select format that supports eight channels. */ +#if !defined(CONFIG_I2S_TEST_DATA_FORMAT_PCM_LONG_UNSUPPORTED) + i2s_cfg.format = I2S_FMT_DATA_FORMAT_PCM_LONG; + TC_PRINT("Selected format is I2S_FMT_DATA_FORMAT_PCM_LONG\n"); +#elif !defined(CONFIG_I2S_TEST_DATA_FORMAT_PCM_SHORT_UNSUPPORTED) + i2s_cfg.format = I2S_FMT_DATA_FORMAT_PCM_SHORT; + TC_PRINT("Selected format is I2S_FMT_DATA_FORMAT_PCM_SHORT\n"); +#else +#error "Don't know what format supports eight channels." +#endif + + i2s_dir_both_transfer_long(&i2s_cfg); +#endif /* CONFIG_I2S_TEST_EIGHT_CHANNELS_UNSUPPORTED */ +} + +/** @brief Test I2S transfer with format I2S_FMT_DATA_FORMAT_I2S + */ +ZTEST(i2s_additional, test_03a_format_i2s) +{ + struct i2s_config i2s_cfg = default_i2s_cfg; + + i2s_cfg.format = I2S_FMT_DATA_FORMAT_I2S; + +#if defined(CONFIG_I2S_TEST_DATA_FORMAT_I2S_UNSUPPORTED) + int ret; + + ret = i2s_configure(dev_i2s, I2S_DIR_TX, &i2s_cfg); + zassert_equal(ret, -EINVAL, "Unexpected result %d", ret); +#else + i2s_dir_both_transfer_long(&i2s_cfg); +#endif +} + +/** @brief Test I2S transfer with format I2S_FMT_DATA_FORMAT_LEFT_JUSTIFIED + */ +ZTEST(i2s_additional, test_03b_format_left_justified) +{ + struct i2s_config i2s_cfg = default_i2s_cfg; + + i2s_cfg.format = I2S_FMT_DATA_FORMAT_LEFT_JUSTIFIED; + +#if defined(CONFIG_I2S_TEST_DATA_FORMAT_LEFT_JUSTIFIED_UNSUPPORTED) + int ret; + + ret = i2s_configure(dev_i2s, I2S_DIR_TX, &i2s_cfg); + zassert_equal(ret, -EINVAL, "Unexpected result %d", ret); +#else + i2s_dir_both_transfer_long(&i2s_cfg); +#endif +} + +/** @brief Test I2S transfer with format I2S_FMT_DATA_FORMAT_RIGHT_JUSTIFIED + */ +ZTEST(i2s_additional, test_03c_format_right_justified) +{ + struct i2s_config i2s_cfg = default_i2s_cfg; + + i2s_cfg.format = I2S_FMT_DATA_FORMAT_RIGHT_JUSTIFIED; + +#if defined(CONFIG_I2S_TEST_DATA_FORMAT_RIGHT_JUSTIFIED_UNSUPPORTED) + int ret; + + ret = i2s_configure(dev_i2s, I2S_DIR_TX, &i2s_cfg); + zassert_equal(ret, -EINVAL, "Unexpected result %d", ret); +#else + i2s_dir_both_transfer_long(&i2s_cfg); +#endif +} + +/** @brief Test I2S transfer with format I2S_FMT_DATA_FORMAT_PCM_LONG + */ +ZTEST(i2s_additional, test_03d_format_pcm_long) +{ + struct i2s_config i2s_cfg = default_i2s_cfg; + + i2s_cfg.format = I2S_FMT_DATA_FORMAT_PCM_LONG; + +#if defined(CONFIG_I2S_TEST_DATA_FORMAT_PCM_LONG_UNSUPPORTED) + int ret; + + ret = i2s_configure(dev_i2s, I2S_DIR_TX, &i2s_cfg); + zassert_equal(ret, -EINVAL, "Unexpected result %d", ret); +#else + i2s_dir_both_transfer_long(&i2s_cfg); +#endif +} + +/** @brief Test I2S transfer with format I2S_FMT_DATA_FORMAT_PCM_SHORT + */ +ZTEST(i2s_additional, test_03e_format_pcm_short) +{ + struct i2s_config i2s_cfg = default_i2s_cfg; + + i2s_cfg.format = I2S_FMT_DATA_FORMAT_PCM_SHORT; + +#if defined(CONFIG_I2S_TEST_DATA_FORMAT_PCM_SHORT_UNSUPPORTED) + int ret; + + ret = i2s_configure(dev_i2s, I2S_DIR_TX, &i2s_cfg); + zassert_equal(ret, -EINVAL, "Unexpected result %d", ret); +#else + i2s_dir_both_transfer_long(&i2s_cfg); +#endif +} + +/** @brief Test I2S transfer with format I2S_FMT_DATA_ORDER_MSB + */ +ZTEST(i2s_additional, test_04a_format_data_order_MSB) +{ + struct i2s_config i2s_cfg = default_i2s_cfg; + + i2s_cfg.format |= I2S_FMT_DATA_ORDER_MSB; + +#if defined(CONFIG_I2S_TEST_DATA_ORDER_MSB_UNSUPPORTED) + int ret; + + ret = i2s_configure(dev_i2s, I2S_DIR_TX, &i2s_cfg); + zassert_equal(ret, -EINVAL, "Unexpected result %d", ret); +#else + i2s_dir_both_transfer_long(&i2s_cfg); +#endif +} + +/** @brief Test I2S transfer with format I2S_FMT_DATA_ORDER_LSB + */ +ZTEST(i2s_additional, test_04b_format_data_order_LSB) +{ + struct i2s_config i2s_cfg = default_i2s_cfg; + + i2s_cfg.format |= I2S_FMT_DATA_ORDER_LSB; + +#if defined(CONFIG_I2S_TEST_DATA_ORDER_LSB_UNSUPPORTED) + int ret; + + ret = i2s_configure(dev_i2s, I2S_DIR_TX, &i2s_cfg); + zassert_equal(ret, -EINVAL, "Unexpected result %d", ret); +#else + i2s_dir_both_transfer_long(&i2s_cfg); +#endif +} + +/** @brief Test I2S transfer with format I2S_FMT_BIT_CLK_INV + */ +ZTEST(i2s_additional, test_05a_format_bit_clk_inv) +{ + struct i2s_config i2s_cfg = default_i2s_cfg; + + i2s_cfg.format |= I2S_FMT_BIT_CLK_INV; + +#if defined(CONFIG_I2S_TEST_BIT_CLK_INV_UNSUPPORTED) + int ret; + + ret = i2s_configure(dev_i2s, I2S_DIR_TX, &i2s_cfg); + zassert_equal(ret, -EINVAL, "Unexpected result %d", ret); +#else + i2s_dir_both_transfer_long(&i2s_cfg); +#endif +} + +/** @brief Test I2S transfer with format I2S_FMT_FRAME_CLK_INV + */ +ZTEST(i2s_additional, test_05b_format_frame_clk_inv) +{ + struct i2s_config i2s_cfg = default_i2s_cfg; + + i2s_cfg.format |= I2S_FMT_FRAME_CLK_INV; + +#if defined(CONFIG_I2S_TEST_FRAME_CLK_INV_UNSUPPORTED) + int ret; + + ret = i2s_configure(dev_i2s, I2S_DIR_TX, &i2s_cfg); + zassert_equal(ret, -EINVAL, "Unexpected result %d", ret); +#else + i2s_dir_both_transfer_long(&i2s_cfg); +#endif +} + +/** @brief Test I2S transfer with block_size set to 6. + */ +ZTEST(i2s_additional, test_06_block_size_6) +{ + struct i2s_config i2s_cfg = default_i2s_cfg; + + i2s_cfg.block_size = 6; + +#if defined(CONFIG_I2S_TEST_BLOCK_SIZE_6_UNSUPPORTED) + int ret; + + ret = i2s_configure(dev_i2s, I2S_DIR_TX, &i2s_cfg); + zassert_equal(ret, -EINVAL, "Unexpected result %d", ret); +#else + i2s_dir_both_transfer_long(&i2s_cfg); +#endif +} + +/** @brief Test I2S transfer with I2S_OPT_BIT_CLK_CONT. + */ +ZTEST(i2s_additional, test_07a_options_bit_clk_cont) +{ + struct i2s_config i2s_cfg = default_i2s_cfg; + + i2s_cfg.options |= I2S_OPT_BIT_CLK_CONT; + +#if defined(CONFIG_I2S_TEST_OPTIONS_BIT_CLK_CONT_UNSUPPORTED) + int ret; + + ret = i2s_configure(dev_i2s, I2S_DIR_TX, &i2s_cfg); + zassert_equal(ret, -EINVAL, "Unexpected result %d", ret); +#else + i2s_dir_both_transfer_long(&i2s_cfg); +#endif +} + +/** @brief Test I2S transfer with I2S_OPT_BIT_CLK_GATED. + */ +ZTEST(i2s_additional, test_07b_options_bit_clk_gated) +{ + struct i2s_config i2s_cfg = default_i2s_cfg; + + i2s_cfg.options |= I2S_OPT_BIT_CLK_GATED; + +#if defined(CONFIG_I2S_TEST_OPTIONS_BIT_CLK_GATED_UNSUPPORTED) + int ret; + + ret = i2s_configure(dev_i2s, I2S_DIR_TX, &i2s_cfg); + zassert_equal(ret, -EINVAL, "Unexpected result %d", ret); +#else + i2s_dir_both_transfer_long(&i2s_cfg); +#endif +} + +/** @brief Check error when I2S is configured with unsupported + * combination of bit CLK and frame CLK options. + */ +ZTEST(i2s_additional, test_08_options_bit_frame_clk_mixed) +{ + struct i2s_config i2s_cfg = default_i2s_cfg; + int ret; + + i2s_cfg.options = I2S_OPT_FRAME_CLK_MASTER | I2S_OPT_BIT_CLK_SLAVE; + + ret = i2s_configure(dev_i2s, I2S_DIR_TX, &i2s_cfg); + zassert_equal(ret, -EINVAL, "Unexpected result %d", ret); + + i2s_cfg.options = I2S_OPT_FRAME_CLK_SLAVE | I2S_OPT_BIT_CLK_MASTER; + + ret = i2s_configure(dev_i2s, I2S_DIR_TX, &i2s_cfg); + zassert_equal(ret, -EINVAL, "Unexpected result %d", ret); +} + +/** @brief Test I2S transfer with I2S_OPT_LOOPBACK. + */ +ZTEST(i2s_additional, test_09a_options_loopback) +{ + struct i2s_config i2s_cfg = default_i2s_cfg; + + i2s_cfg.options |= I2S_OPT_LOOPBACK; + +#if defined(CONFIG_I2S_TEST_OPTIONS_LOOPBACK_UNSUPPORTED) + int ret; + + ret = i2s_configure(dev_i2s, I2S_DIR_TX, &i2s_cfg); + zassert_equal(ret, -EINVAL, "Unexpected result %d", ret); +#else + i2s_dir_both_transfer_long(&i2s_cfg); +#endif +} + +/** @brief Test I2S transfer with I2S_OPT_PINGPONG. + */ +ZTEST(i2s_additional, test_09b_options_pingpong) +{ + struct i2s_config i2s_cfg = default_i2s_cfg; + + i2s_cfg.options |= I2S_OPT_PINGPONG; + +#if defined(CONFIG_I2S_TEST_OPTIONS_LOOPBACK_UNSUPPORTED) + int ret; + + ret = i2s_configure(dev_i2s, I2S_DIR_TX, &i2s_cfg); + zassert_equal(ret, -EINVAL, "Unexpected result %d", ret); +#else + i2s_dir_both_transfer_long(&i2s_cfg); +#endif +} + +static void *suite_setup(void) +{ + /* Check I2S Device. */ + dev_i2s = DEVICE_DT_GET_OR_NULL(I2S_DEV_NODE); + zassert_not_null(dev_i2s, "I2S device not found"); + zassert(device_is_ready(dev_i2s), "I2S device not ready"); + + LOG_HEXDUMP_DBG(&data_l, 2 * SAMPLES_COUNT, "data_l"); + LOG_HEXDUMP_DBG(&data_r, 2 * SAMPLES_COUNT, "data_r"); + TC_PRINT("===================================================================\n"); + + return 0; +} + +static void before(void *not_used) +{ + ARG_UNUSED(not_used); + +#if (CONFIG_I2S_TEST_ALLOWED_DATA_OFFSET > 0) + /* Data offset may differ when test uses I2S + * with different configuration. + * Force offset callculation for every test. + */ + offset = -1; +#endif +} + +ZTEST_SUITE(i2s_additional, NULL, suite_setup, before, NULL, NULL); diff --git a/tests/drivers/i2s/i2s_additional/testcase.yaml b/tests/drivers/i2s/i2s_additional/testcase.yaml new file mode 100644 index 000000000000..c45a5482b7f4 --- /dev/null +++ b/tests/drivers/i2s/i2s_additional/testcase.yaml @@ -0,0 +1,39 @@ +common: + tags: + - drivers + - i2s + depends_on: + - i2s + - gpio + filter: CONFIG_I2S_TEST_USE_GPIO_LOOPBACK + harness: ztest + +tests: + drivers.i2s.additional.gpio_loopback: + harness_config: + fixture: gpio_loopback + platform_allow: + - nrf52840dk/nrf52840 + - nrf5340dk/nrf5340/cpuapp + - nrf54l15dk/nrf54l15/cpuapp + integration_platforms: + - nrf52840dk/nrf52840 + - nrf5340dk/nrf5340/cpuapp + - nrf54l15dk/nrf54l15/cpuapp + + drivers.i2s.additional.gpio_loopback.54h: + harness_config: + fixture: i2s_loopback + platform_allow: + - nrf54h20dk/nrf54h20/cpuapp + integration_platforms: + - nrf54h20dk/nrf54h20/cpuapp + + drivers.i2s.additional.gpio_loopback.aclk: + harness_config: + fixture: gpio_loopback + extra_args: EXTRA_DTC_OVERLAY_FILE="boards/nrf5340dk_nrf5340_cpuapp_aclk.overlay" + platform_allow: + - nrf5340dk/nrf5340/cpuapp + integration_platforms: + - nrf5340dk/nrf5340/cpuapp From c4d342e3dd69d38adf8795022ddcbff4796cddfd Mon Sep 17 00:00:00 2001 From: Nikodem Kastelik Date: Mon, 16 Jun 2025 12:38:11 +0200 Subject: [PATCH 0044/2141] [nrf fromlist] manifest: update hal_nordic for errata 55 on nRF54LV10A Eng A Errata 55 applies to nRF54LV10A Eng A as well. Upstream PR #: 91682 Signed-off-by: Nikodem Kastelik (cherry picked from commit 237a857a628aca0eb5daa233eac06fabc5ae1c65) --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 53b29c849ca5..609c9f20a4f9 100644 --- a/west.yml +++ b/west.yml @@ -200,7 +200,7 @@ manifest: groups: - hal - name: hal_nordic - revision: 6e39d4f2b078afaebdb84875089486152fcacb9c + revision: 71308dc6d8c021887ce5d98a36cafe9517375a91 path: modules/hal/nordic groups: - hal From 19af3cf53098543f5a88cce7d89a924b49fa7944 Mon Sep 17 00:00:00 2001 From: Grzegorz Chwierut Date: Thu, 29 May 2025 15:49:29 +0200 Subject: [PATCH 0045/2141] [nrf fromtree] west: runners: Add ncs-provision to west flash command Added automatic KMU key provisioning, when keyfile.json file exists in the build directory. This enables automated key provisioning during the flashing process to enable testing nRF54L aplications using Twister. Only applicable on nrfutil runner. Signed-off-by: Grzegorz Chwierut (cherry picked from commit db3c344af9eb395a3dcd65e623d1b12436fefb5e) --- scripts/west_commands/runners/nrf_common.py | 8 ++++++++ scripts/west_commands/runners/nrfutil.py | 2 ++ 2 files changed, 10 insertions(+) diff --git a/scripts/west_commands/runners/nrf_common.py b/scripts/west_commands/runners/nrf_common.py index af4f8286722b..a6af477c61a9 100644 --- a/scripts/west_commands/runners/nrf_common.py +++ b/scripts/west_commands/runners/nrf_common.py @@ -469,6 +469,14 @@ def program_hex(self): core = "Application" self.op_program(self.hex_, erase_arg, ext_mem_erase_opt, defer=True, core=core) + + if self.erase or self.recover: + # provision keys if keyfile.json exists in the build directory + keyfile = Path(self.cfg.build_dir).parent / 'keyfile.json' + if keyfile.exists(): + self.logger.info(f'Provisioning key file: {keyfile}') + self.exec_op('x-provision-keys', keyfile=str(keyfile), defer=True) + self.flush(force=False) diff --git a/scripts/west_commands/runners/nrfutil.py b/scripts/west_commands/runners/nrfutil.py index 1fb44949507f..f11d2a7ad133 100644 --- a/scripts/west_commands/runners/nrfutil.py +++ b/scripts/west_commands/runners/nrfutil.py @@ -147,6 +147,8 @@ def _append_batch(self, op, json_file): cmd += ['--reset-kind', _op['kind']] elif op_type == 'erase': cmd.append(f'--{_op["kind"]}') + elif op_type == 'x-provision-keys': + cmd += ['--key-file', _op['keyfile']] cmd += ['--core', op['core']] if op.get('core') else [] cmd += ['--x-family', f'{self.family}'] From 513fef7af575b82f46db08646f453368c8bb5785 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Fri, 23 May 2025 17:23:59 +0530 Subject: [PATCH 0046/2141] [nrf fromtree] manifest: nrf_wifi: Pull TX optimization Pull fix to free TX packets early once handed over to nRF70. Signed-off-by: Chaitanya Tata (cherry picked from commit f4b58982e7029ab01d614131035aa9e9aba50317) --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 609c9f20a4f9..1509f37e62b2 100644 --- a/west.yml +++ b/west.yml @@ -328,7 +328,7 @@ manifest: revision: c6296f600a6851bd652f207ab4908d339e1ce705 path: modules/bsim_hw_models/nrf_hw_models - name: nrf_wifi - revision: 0cd7f28d34a5279cd839940c199658a294165722 + revision: 1c1a7003ce90e492590c4a8a604eb9881bc8c5c1 path: modules/lib/nrf_wifi - name: open-amp revision: f7f4d083c7909a39d86e217376c69b416ec4faf3 From bce4d0f565ee8af9b43219a62c3d25c1069b3ad5 Mon Sep 17 00:00:00 2001 From: Karun Kumar Eagalapati Date: Thu, 12 Jun 2025 18:24:55 +0530 Subject: [PATCH 0047/2141] [nrf fromtree] manifest: Update nrf_wifi for dynamic bandwidth signal controlling Update nrf_wifi for dynamic bandwidth signal controlling through command init. Signed-off-by: Karun Kumar Eagalapati (cherry picked from commit 3c6cd1965ce7017562921760c73993c478a43201) --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 1509f37e62b2..5105d7c83f67 100644 --- a/west.yml +++ b/west.yml @@ -328,7 +328,7 @@ manifest: revision: c6296f600a6851bd652f207ab4908d339e1ce705 path: modules/bsim_hw_models/nrf_hw_models - name: nrf_wifi - revision: 1c1a7003ce90e492590c4a8a604eb9881bc8c5c1 + revision: 294314b8622bfa582f43b229504d42201e1a3443 path: modules/lib/nrf_wifi - name: open-amp revision: f7f4d083c7909a39d86e217376c69b416ec4faf3 From 5924412ad01bbc394672058d1eb3952164158c3e Mon Sep 17 00:00:00 2001 From: Kapil Bhatt Date: Tue, 17 Jun 2025 08:36:19 +0000 Subject: [PATCH 0048/2141] [nrf fromtree] drivers: nrf_wifi: Add Kconfig for Dynamic Bandwidth Signalling Add Kconfig to enable/disable Dynamic Bandwidth Signalling. Signed-off-by: Kapil Bhatt (cherry picked from commit 1037a0cca63d2410406c46df6e79d70738f654a9) --- drivers/wifi/nrf_wifi/Kconfig.nrfwifi | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/wifi/nrf_wifi/Kconfig.nrfwifi b/drivers/wifi/nrf_wifi/Kconfig.nrfwifi index ade3b5de5cf4..e0a39f2123e1 100644 --- a/drivers/wifi/nrf_wifi/Kconfig.nrfwifi +++ b/drivers/wifi/nrf_wifi/Kconfig.nrfwifi @@ -908,4 +908,9 @@ config NRF_WIFI_RX_STBC_HT help Receive packets encoded with STBC (Space-Time Block Coding) in HT (Wi-Fi4) mode. + +config NRF_WIFI_DYNAMIC_BANDWIDTH_SIGNALLING + bool "Dynamic bandwidth signalling for Wi-Fi" + help + This option enables support for dynamic bandwidth signalling. endif # WIFI_NRF70 From b3c8104b597559980411045606fb8faf2243673f Mon Sep 17 00:00:00 2001 From: Karun Kumar Eagalapati Date: Wed, 18 Jun 2025 11:09:34 +0530 Subject: [PATCH 0049/2141] [nrf fromlist] manifest: Update nrf_wifi for dynamic ED control Update nrf_wifi for dynamic ED controlling through command init. Upstream PR #: 91806 Signed-off-by: Karun Kumar Eagalapati (cherry picked from commit ed8d8a9a388132c1992c1d7a25da798974ec1bb1) --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 5105d7c83f67..76ca9284ec89 100644 --- a/west.yml +++ b/west.yml @@ -328,7 +328,7 @@ manifest: revision: c6296f600a6851bd652f207ab4908d339e1ce705 path: modules/bsim_hw_models/nrf_hw_models - name: nrf_wifi - revision: 294314b8622bfa582f43b229504d42201e1a3443 + revision: 7cb2f44f46dfc86e4f97477ee90022944e138dd8 path: modules/lib/nrf_wifi - name: open-amp revision: f7f4d083c7909a39d86e217376c69b416ec4faf3 From e69c07a1c917de8a5827f0cb77704226e9b015a4 Mon Sep 17 00:00:00 2001 From: Kapil Bhatt Date: Thu, 19 Jun 2025 09:12:24 +0000 Subject: [PATCH 0050/2141] [nrf fromlist] drivers: nrf_wifi: Add Kconfig for Dynamic ED Add Kconfig to enable/disable Dynamic ED which add support for proprietary algorithm to enhance performance in high-traffic channels. Upstream PR #: 91806 Signed-off-by: Kapil Bhatt (cherry picked from commit 39150f284e0288de0c00f24c1e81bc73181186f2) --- drivers/wifi/nrf_wifi/Kconfig.nrfwifi | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/wifi/nrf_wifi/Kconfig.nrfwifi b/drivers/wifi/nrf_wifi/Kconfig.nrfwifi index e0a39f2123e1..8980cce82052 100644 --- a/drivers/wifi/nrf_wifi/Kconfig.nrfwifi +++ b/drivers/wifi/nrf_wifi/Kconfig.nrfwifi @@ -913,4 +913,10 @@ config NRF_WIFI_DYNAMIC_BANDWIDTH_SIGNALLING bool "Dynamic bandwidth signalling for Wi-Fi" help This option enables support for dynamic bandwidth signalling. + +config NRF_WIFI_DYNAMIC_ED + bool "Dynamic ED" + help + This option enables support for proprietary algorithm to + enhance performance in high-traffic channels. endif # WIFI_NRF70 From bd14c2e7fe86abcccaf178f70005607cb98508cf Mon Sep 17 00:00:00 2001 From: Travis Lam Date: Tue, 27 May 2025 17:48:17 +0200 Subject: [PATCH 0051/2141] [nrf fromtree] drivers: cache: nrf: Resolve NRF_CACHE_HAS_LINEADDR issue Add new function called _cache_all_check that cache all if NRF_CACHE has no LINEADDR. Signed-off-by: Travis Lam (cherry picked from commit 10f35d741f4c6ab05bf73e22d5fb63d509315e3c) --- drivers/cache/cache_nrf.c | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/drivers/cache/cache_nrf.c b/drivers/cache/cache_nrf.c index 3cf798978749..6a9a4b6b49e4 100644 --- a/drivers/cache/cache_nrf.c +++ b/drivers/cache/cache_nrf.c @@ -94,6 +94,7 @@ static inline int _cache_all(NRF_CACHE_Type *cache, enum k_nrf_cache_op op) return 0; } +#if NRF_CACHE_HAS_LINEADDR static inline void _cache_line(NRF_CACHE_Type *cache, enum k_nrf_cache_op op, uintptr_t line_addr) { do { @@ -160,7 +161,7 @@ static inline int _cache_checks(NRF_CACHE_Type *cache, enum k_nrf_cache_op op, v size_t size, bool is_range) { /* Check if the cache is enabled */ - if (!(cache->ENABLE & CACHE_ENABLE_ENABLE_Enabled)) { + if (!nrf_cache_enable_check(cache)) { return -EAGAIN; } @@ -175,6 +176,16 @@ static inline int _cache_checks(NRF_CACHE_Type *cache, enum k_nrf_cache_op op, v return _cache_range(cache, op, addr, size); } +#else +static inline int _cache_all_checks(NRF_CACHE_Type *cache, enum k_nrf_cache_op op) +{ + /* Check if the cache is enabled */ + if (!nrf_cache_enable_check(cache)) { + return -EAGAIN; + } + return _cache_all(cache, op); +} +#endif /* NRF_CACHE_HAS_LINEADDR */ #if defined(NRF_DCACHE) && NRF_CACHE_HAS_TASKS @@ -296,7 +307,11 @@ void cache_instr_disable(void) int cache_instr_flush_all(void) { #if NRF_CACHE_HAS_TASK_CLEAN +#if NRF_CACHE_HAS_LINEADDR return _cache_checks(NRF_ICACHE, K_NRF_CACHE_CLEAN, NULL, 0, false); +#else + return _cache_all_checks(NRF_ICACHE, K_NRF_CACHE_CLEAN); +#endif #else return -ENOTSUP; #endif @@ -304,13 +319,21 @@ int cache_instr_flush_all(void) int cache_instr_invd_all(void) { +#if NRF_CACHE_HAS_LINEADDR return _cache_checks(NRF_ICACHE, K_NRF_CACHE_INVD, NULL, 0, false); +#else + return _cache_all_checks(NRF_ICACHE, K_NRF_CACHE_INVD); +#endif } int cache_instr_flush_and_invd_all(void) { #if NRF_CACHE_HAS_TASK_FLUSH +#if NRF_CACHE_HAS_LINEADDR return _cache_checks(NRF_ICACHE, K_NRF_CACHE_FLUSH, NULL, 0, false); +#else + return _cache_all_checks(NRF_ICACHE, K_NRF_CACHE_FLUSH); +#endif #else return -ENOTSUP; #endif @@ -318,7 +341,7 @@ int cache_instr_flush_and_invd_all(void) int cache_instr_flush_range(void *addr, size_t size) { -#if NRF_CACHE_HAS_TASK_CLEAN +#if NRF_CACHE_HAS_TASK_CLEAN && NRF_CACHE_HAS_LINEADDR return _cache_checks(NRF_ICACHE, K_NRF_CACHE_CLEAN, addr, size, true); #else return -ENOTSUP; @@ -327,12 +350,16 @@ int cache_instr_flush_range(void *addr, size_t size) int cache_instr_invd_range(void *addr, size_t size) { +#if NRF_CACHE_HAS_LINEADDR return _cache_checks(NRF_ICACHE, K_NRF_CACHE_INVD, addr, size, true); +#else + return -ENOTSUP; +#endif } int cache_instr_flush_and_invd_range(void *addr, size_t size) { -#if NRF_CACHE_HAS_TASK_FLUSH +#if NRF_CACHE_HAS_TASK_FLUSH && NRF_CACHE_HAS_LINEADDR return _cache_checks(NRF_ICACHE, K_NRF_CACHE_FLUSH, addr, size, true); #else return -ENOTSUP; From 08ad1f291223f24d71a6345574f1d858f101e32c Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Mon, 16 Jun 2025 10:14:05 +0200 Subject: [PATCH 0052/2141] [nrf fromtree] net: sockets_offload: Fix build error with NO_OPTIMIZATIONS When CONFIG_NO_OPTIMIZATIONS the compiler will not inline socket_offload_dns_is_enabled(), which means calls to socket_offload* remain, and the linker will fail with in function `zsock_getaddrinfo': undefined reference to `socket_offload_getaddrinfo' in function `zsock_freeaddrinfo': undefined reference to `socket_offload_freeaddrinfo' Instead of relaying on that function being inlined and the if'ed code being removed, let's just use the preprocessor. Signed-off-by: Alberto Escolar Piedras (cherry picked from commit dc24583858b68c1119d99e03c410db53a8b04335) Signed-off-by: Robert Lubos --- include/zephyr/net/socket_offload.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/include/zephyr/net/socket_offload.h b/include/zephyr/net/socket_offload.h index 4dcf27250b44..ad86de887f3d 100644 --- a/include/zephyr/net/socket_offload.h +++ b/include/zephyr/net/socket_offload.h @@ -67,10 +67,7 @@ void socket_offload_dns_enable(bool enable); #if defined(CONFIG_NET_SOCKETS_OFFLOAD) bool socket_offload_dns_is_enabled(void); #else -static inline bool socket_offload_dns_is_enabled(void) -{ - return false; -} +#define socket_offload_dns_is_enabled() false #endif /* defined(CONFIG_NET_SOCKETS_OFFLOAD) */ From 68df545336a99b9a7db9bc193d537c636ea989ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Fri, 7 Feb 2025 16:01:36 +0100 Subject: [PATCH 0053/2141] [nrf fromtree] drivers: serial: nrfx_uarte: Add workaround for FRAMETIMEOUT corner case MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When reception is restarted (STARTRX after ENDRX but no STOPRX) it is possible that FRAMETIMEOUT countdown counter will not be started by the first received byte if byte was already being transmitted when STARTRX was called. If that is the only byte then it is expected that timeout will be triggered but since FRAMETIMEOUT counter is not started there is no FRAMETIMEOUT event which has short to STOPRX. This situation will happen in case short buffers are used (< 5 bytes) because then short ENDRX_STARTRX is not used then. Signed-off-by: Krzysztof Chruściński (cherry picked from commit 94d355a0bdb232479d75db1026f5017ed0fb4dff) --- drivers/serial/uart_nrfx_uarte.c | 47 ++++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/drivers/serial/uart_nrfx_uarte.c b/drivers/serial/uart_nrfx_uarte.c index 05ffa4535706..55aea85f3d39 100644 --- a/drivers/serial/uart_nrfx_uarte.c +++ b/drivers/serial/uart_nrfx_uarte.c @@ -95,6 +95,17 @@ LOG_MODULE_REGISTER(uart_nrfx_uarte, CONFIG_UART_LOG_LEVEL); #define UARTE_HAS_FRAME_TIMEOUT 1 #endif +/* Frame timeout has a bug that countdown counter may not be triggered in some + * specific condition. It may happen if RX is manually started after ENDRX (STOPRX + * task was not triggered) and there is ongoing reception of a byte. RXDRDY event + * triggered by the reception of that byte may not trigger frame timeout counter. + * If this is the last byte of a transfer then without the workaround there will + * be no expected RX timeout. + */ +#ifdef UARTE_HAS_FRAME_TIMEOUT +#define RX_FRAMETIMEOUT_WORKAROUND 1 +#endif + #define INSTANCE_NEEDS_CACHE_MGMT(unused, prefix, i, prop) UARTE_IS_CACHEABLE(prefix##i) #if UARTE_FOR_EACH_INSTANCE(INSTANCE_NEEDS_CACHE_MGMT, (+), (0), _) @@ -251,6 +262,8 @@ struct uarte_nrfx_data { #define UARTE_FLAG_LOW_POWER (UARTE_FLAG_LOW_POWER_TX | UARTE_FLAG_LOW_POWER_RX) #define UARTE_FLAG_TRIG_RXTO BIT(2) #define UARTE_FLAG_POLL_OUT BIT(3) +/* Flag indicating that a workaround for not working frame timeout is active. */ +#define UARTE_FLAG_FTIMEOUT_WATCH BIT(4) /* If enabled then ENDTX is PPI'ed to TXSTOP */ #define UARTE_CFG_FLAG_PPI_ENDTX BIT(0) @@ -1317,9 +1330,22 @@ static void rx_timeout(struct k_timer *timer) NRF_UARTE_Type *uarte = get_uarte_instance(dev); #ifdef UARTE_HAS_FRAME_TIMEOUT - if (!nrf_uarte_event_check(uarte, NRF_UARTE_EVENT_RXDRDY)) { - nrf_uarte_task_trigger(uarte, NRF_UARTE_TASK_STOPRX); + struct uarte_nrfx_data *data = dev->data; + struct uarte_async_rx *async_rx = &data->async->rx; + bool rxdrdy = nrf_uarte_event_check(uarte, NRF_UARTE_EVENT_RXDRDY); + + if (IS_ENABLED(RX_FRAMETIMEOUT_WORKAROUND) && + (atomic_and(&data->flags, ~UARTE_FLAG_FTIMEOUT_WATCH) & UARTE_FLAG_FTIMEOUT_WATCH)) { + if (rxdrdy) { + nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_RXDRDY); + k_timer_start(&async_rx->timer, async_rx->timeout, K_NO_WAIT); + } + } else { + if (!rxdrdy) { + nrf_uarte_task_trigger(uarte, NRF_UARTE_TASK_STOPRX); + } } + return; #else /* UARTE_HAS_FRAME_TIMEOUT */ struct uarte_nrfx_data *data = dev->data; @@ -1545,6 +1571,7 @@ static void endrx_isr(const struct device *dev) async_rx->offset = 0; if (async_rx->enabled) { + bool start_timeout = false; /* If there is a next buffer, then STARTRX will have already been * invoked by the short (the next buffer will be filling up already) * and here we just do the swap of which buffer the driver is following, @@ -1570,6 +1597,11 @@ static void endrx_isr(const struct device *dev) */ if (!nrf_uarte_event_check(uarte, NRF_UARTE_EVENT_RXSTARTED)) { nrf_uarte_task_trigger(uarte, NRF_UARTE_TASK_STARTRX); + nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_RXTO); + if (IS_ENABLED(RX_FRAMETIMEOUT_WORKAROUND)) { + data->flags |= UARTE_FLAG_FTIMEOUT_WATCH; + start_timeout = true; + } } /* Remove the short until the subsequent next buffer is setup */ nrf_uarte_shorts_disable(uarte, NRF_UARTE_SHORT_ENDRX_STARTRX); @@ -1578,6 +1610,11 @@ static void endrx_isr(const struct device *dev) } irq_unlock(key); + if (IS_ENABLED(UARTE_HAS_FRAME_TIMEOUT)) { + if (start_timeout && !K_TIMEOUT_EQ(async_rx->timeout, K_NO_WAIT)) { + k_timer_start(&async_rx->timer, async_rx->timeout, K_NO_WAIT); + } + } } #if !defined(CONFIG_UART_NRFX_UARTE_ENHANCED_RX) @@ -1635,6 +1672,12 @@ static void rxto_isr(const struct device *dev) struct uarte_nrfx_data *data = dev->data; struct uarte_async_rx *async_rx = &data->async->rx; + if (IS_ENABLED(RX_FRAMETIMEOUT_WORKAROUND)) { + if (atomic_test_and_clear_bit(&data->flags, UARTE_FLAG_FTIMEOUT_WATCH)) { + k_timer_stop(&async_rx->timer); + } + } + if (async_rx->buf) { #ifdef CONFIG_HAS_NORDIC_DMM (void)dmm_buffer_in_release(config->mem_reg, async_rx->usr_buf, 0, async_rx->buf); From 7c93a60e3b88af43e5af9b92b432067623a55768 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Thu, 22 May 2025 13:16:45 +0200 Subject: [PATCH 0054/2141] [nrf fromtree] drivers: clock_control: nrf_clock_control: introduce resolve API Introduce API which allows users to determine what the actual minimum spec will be resulting from a requested minimum spec. This is useful for optimizing code as the requested minimum may be way worse than what will actually be applied. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit b1a5588c7914d95ea197569c1335937adfc08369) --- .../drivers/clock_control/nrf_clock_control.h | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/include/zephyr/drivers/clock_control/nrf_clock_control.h b/include/zephyr/drivers/clock_control/nrf_clock_control.h index bbc581f96c49..a50128cad43c 100644 --- a/include/zephyr/drivers/clock_control/nrf_clock_control.h +++ b/include/zephyr/drivers/clock_control/nrf_clock_control.h @@ -204,6 +204,9 @@ __subsystem struct nrf_clock_control_driver_api { int (*cancel_or_release)(const struct device *dev, const struct nrf_clock_spec *spec, struct onoff_client *cli); + int (*resolve)(const struct device *dev, + const struct nrf_clock_spec *req_spec, + struct nrf_clock_spec *res_spec); }; /** @@ -324,6 +327,30 @@ int nrf_clock_control_cancel_or_release(const struct device *dev, return api->cancel_or_release(dev, spec, cli); } +/** + * @brief Resolve a requested clock spec to resulting spec. + * + * @param dev Device structure. + * @param req_spec The requested clock specification. + * @param res_spec Destination for the resulting clock specification. + * + * @retval Successful if successful. + * @retval -errno code if failure + */ +static inline int nrf_clock_control_resolve(const struct device *dev, + const struct nrf_clock_spec *req_spec, + struct nrf_clock_spec *res_spec) +{ + const struct nrf_clock_control_driver_api *api = + (const struct nrf_clock_control_driver_api *)dev->api; + + if (api->resolve == NULL) { + return -ENOSYS; + } + + return api->resolve(dev, req_spec, res_spec); +} + /** @brief Request the HFXO from Zero Latency Interrupt context. * * Function is optimized for use in Zero Latency Interrupt context. From a73cec112a62c1e7bd66b7bb0e2d9a5d0b910824 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Thu, 22 May 2025 13:18:54 +0200 Subject: [PATCH 0055/2141] [nrf fromtree] drivers: clock_control: nrf_clock_control: introduce startup time Introduce get_startup_time API which allows users to request clocks specs to be met in time for an event. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit 6aeca71a4df1286fb7f9287e9a42c43df57dc426) --- .../drivers/clock_control/nrf_clock_control.h | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/include/zephyr/drivers/clock_control/nrf_clock_control.h b/include/zephyr/drivers/clock_control/nrf_clock_control.h index a50128cad43c..d12dca3c074f 100644 --- a/include/zephyr/drivers/clock_control/nrf_clock_control.h +++ b/include/zephyr/drivers/clock_control/nrf_clock_control.h @@ -207,6 +207,9 @@ __subsystem struct nrf_clock_control_driver_api { int (*resolve)(const struct device *dev, const struct nrf_clock_spec *req_spec, struct nrf_clock_spec *res_spec); + int (*get_startup_time)(const struct device *dev, + const struct nrf_clock_spec *spec, + uint32_t *startup_time_us); }; /** @@ -351,6 +354,29 @@ static inline int nrf_clock_control_resolve(const struct device *dev, return api->resolve(dev, req_spec, res_spec); } +/** + * @brief Get the startup timme of a clock. + * + * @param dev Device structure. + * @param startup_time_us Destination for startup time in microseconds. + * + * @retval Successful if successful. + * @retval -errno code if failure. + */ +static inline int nrf_clock_control_get_startup_time(const struct device *dev, + const struct nrf_clock_spec *spec, + uint32_t *startup_time_us) +{ + const struct nrf_clock_control_driver_api *api = + (const struct nrf_clock_control_driver_api *)dev->api; + + if (api->get_startup_time == NULL) { + return -ENOSYS; + } + + return api->get_startup_time(dev, spec, startup_time_us); +} + /** @brief Request the HFXO from Zero Latency Interrupt context. * * Function is optimized for use in Zero Latency Interrupt context. From 4c363f3cf6f0294fb2ace3eafccb610dd3c1a444 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Thu, 22 May 2025 17:17:23 +0200 Subject: [PATCH 0056/2141] [nrf fromtree] drivers: clock_control: nrf2_hfxo: impl resolve and startup_time Implement nrf_clock_control_resolve() and nrf_clock_control_get_startup_time_us() APIs. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit 54d86e8f38a58ed3d0bc34b5d9a301ee2b9585ca) --- .../clock_control/clock_control_nrf2_hfxo.c | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/drivers/clock_control/clock_control_nrf2_hfxo.c b/drivers/clock_control/clock_control_nrf2_hfxo.c index 21d3d33f7e8d..1c8d6f8ed181 100644 --- a/drivers/clock_control/clock_control_nrf2_hfxo.c +++ b/drivers/clock_control/clock_control_nrf2_hfxo.c @@ -271,6 +271,39 @@ static int init_hfxo(const struct device *dev) return 0; } +static int api_resolve(const struct device *dev, + const struct nrf_clock_spec *req_spec, + struct nrf_clock_spec *res_spec) +{ + const struct dev_config_hfxo *dev_config = dev->config; + + if (!is_clock_spec_valid(dev, req_spec)) { + return -EINVAL; + } + + res_spec->frequency = dev_config->fixed_frequency; + res_spec->accuracy = dev_config->fixed_accuracy; + res_spec->precision = NRF_CLOCK_CONTROL_PRECISION_HIGH; + return 0; +} + +static int api_get_startup_time(const struct device *dev, + const struct nrf_clock_spec *spec, + uint32_t *startup_time_us) +{ + if (!is_clock_spec_valid(dev, spec)) { + return -EINVAL; + } + + *startup_time_us = nrf_bicr_hfxo_startup_time_us_get(BICR); + + if (*startup_time_us == NRF_BICR_HFXO_STARTUP_TIME_UNCONFIGURED) { + return -EINVAL; + } + + return 0; +} + static DEVICE_API(nrf_clock_control, drv_api_hfxo) = { .std_api = { .on = api_nosys_on_off, @@ -280,6 +313,8 @@ static DEVICE_API(nrf_clock_control, drv_api_hfxo) = { .request = api_request_hfxo, .release = api_release_hfxo, .cancel_or_release = api_cancel_or_release_hfxo, + .resolve = api_resolve, + .get_startup_time = api_get_startup_time, }; static struct dev_data_hfxo data_hfxo; From 3bc9d24a1b307971397199da2b7ffcb3769a115b Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Thu, 22 May 2025 18:28:08 +0200 Subject: [PATCH 0057/2141] [nrf fromtree] drivers: clock_control: nrf2_lfclk: impl resolve and startup_time Implement nrf_clock_control_resolve() and nrf_clock_control_get_startup_time_us() APIs. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit b20a233b05966368bdb3f98e659fc7082a258cf1) --- .../clock_control/clock_control_nrf2_lfclk.c | 152 +++++++++++++++--- dts/bindings/clock/nordic,nrf-fll16m.yaml | 3 +- dts/bindings/clock/nordic,nrf-lfclk.yaml | 10 ++ dts/vendor/nordic/nrf54h20.dtsi | 2 + 4 files changed, 146 insertions(+), 21 deletions(-) diff --git a/drivers/clock_control/clock_control_nrf2_lfclk.c b/drivers/clock_control/clock_control_nrf2_lfclk.c index c5f70c1497ba..6be9deee6576 100644 --- a/drivers/clock_control/clock_control_nrf2_lfclk.c +++ b/drivers/clock_control/clock_control_nrf2_lfclk.c @@ -22,6 +22,8 @@ BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) == 1, #define LFCLK_LFLPRC_ACCURACY DT_INST_PROP(0, lflprc_accuracy_ppm) #define LFCLK_LFRC_ACCURACY DT_INST_PROP(0, lfrc_accuracy_ppm) #define LFCLK_HFXO_ACCURACY DT_PROP(LFCLK_HFXO_NODE, accuracy_ppm) +#define LFCLK_LFLPRC_STARTUP_TIME_US DT_INST_PROP(0, lflprc_startup_time_us) +#define LFCLK_LFRC_STARTUP_TIME_US DT_INST_PROP(0, lfrc_startup_time_us) #define LFCLK_MAX_OPTS 5 #define LFCLK_DEF_OPTS 3 @@ -59,6 +61,8 @@ struct lfclk_dev_data { struct k_timer timer; uint16_t max_accuracy; uint8_t clock_options_cnt; + uint32_t hfxo_startup_time_us; + uint32_t lfxo_startup_time_us; }; struct lfclk_dev_config { @@ -105,45 +109,108 @@ static void lfclk_work_handler(struct k_work *work) } } -static struct onoff_manager *lfclk_find_mgr(const struct device *dev, - const struct nrf_clock_spec *spec) +static int lfclk_resolve_spec_to_idx(const struct device *dev, + const struct nrf_clock_spec *req_spec) { struct lfclk_dev_data *dev_data = dev->data; const struct lfclk_dev_config *dev_config = dev->config; - uint16_t accuracy; + uint16_t req_accuracy; - if (!spec) { - return &dev_data->clk_cfg.onoff[0].mgr; - } - - if (spec->frequency > dev_config->fixed_frequency) { + if (req_spec->frequency > dev_config->fixed_frequency) { LOG_ERR("invalid frequency"); - return NULL; + return -EINVAL; } - accuracy = spec->accuracy == NRF_CLOCK_CONTROL_ACCURACY_MAX - ? dev_data->max_accuracy - : spec->accuracy; + req_accuracy = req_spec->accuracy == NRF_CLOCK_CONTROL_ACCURACY_MAX + ? dev_data->max_accuracy + : req_spec->accuracy; for (int i = 0; i < dev_data->clock_options_cnt; ++i) { - if ((accuracy && - accuracy < clock_options[i].accuracy) || - spec->precision > clock_options[i].precision) { + if ((req_accuracy && + req_accuracy < clock_options[i].accuracy) || + req_spec->precision > clock_options[i].precision) { continue; } - return &dev_data->clk_cfg.onoff[i].mgr; + return i; } LOG_ERR("invalid accuracy or precision"); - return NULL; + return -EINVAL; +} + +static void lfclk_get_spec_by_idx(const struct device *dev, + uint8_t idx, + struct nrf_clock_spec *spec) +{ + const struct lfclk_dev_config *dev_config = dev->config; + + spec->frequency = dev_config->fixed_frequency; + spec->accuracy = clock_options[idx].accuracy; + spec->precision = clock_options[idx].precision; +} + +static struct onoff_manager *lfclk_get_mgr_by_idx(const struct device *dev, uint8_t idx) +{ + struct lfclk_dev_data *dev_data = dev->data; + + return &dev_data->clk_cfg.onoff[idx].mgr; +} + +static int lfclk_get_startup_time_by_idx(const struct device *dev, + uint8_t idx, + uint32_t *startup_time_us) +{ + struct lfclk_dev_data *dev_data = dev->data; + nrfs_clock_src_t src = clock_options[idx].src; + + switch (src) { + case NRFS_CLOCK_SRC_LFCLK_LFLPRC: + *startup_time_us = LFCLK_LFLPRC_STARTUP_TIME_US; + return 0; + + case NRFS_CLOCK_SRC_LFCLK_LFRC: + *startup_time_us = LFCLK_LFRC_STARTUP_TIME_US; + return 0; + + case NRFS_CLOCK_SRC_LFCLK_XO_PIXO: + case NRFS_CLOCK_SRC_LFCLK_XO_PIERCE: + case NRFS_CLOCK_SRC_LFCLK_XO_EXT_SINE: + case NRFS_CLOCK_SRC_LFCLK_XO_EXT_SQUARE: + case NRFS_CLOCK_SRC_LFCLK_XO_PIERCE_HP: + case NRFS_CLOCK_SRC_LFCLK_XO_EXT_SINE_HP: + *startup_time_us = dev_data->lfxo_startup_time_us; + return 0; + + case NRFS_CLOCK_SRC_LFCLK_SYNTH: + *startup_time_us = dev_data->hfxo_startup_time_us; + return 0; + + default: + break; + } + + return -EINVAL; +} + +static struct onoff_manager *lfclk_find_mgr_by_spec(const struct device *dev, + const struct nrf_clock_spec *spec) +{ + int idx; + + if (!spec) { + return lfclk_get_mgr_by_idx(dev, 0); + } + + idx = lfclk_resolve_spec_to_idx(dev, spec); + return idx < 0 ? NULL : lfclk_get_mgr_by_idx(dev, idx); } static int api_request_lfclk(const struct device *dev, const struct nrf_clock_spec *spec, struct onoff_client *cli) { - struct onoff_manager *mgr = lfclk_find_mgr(dev, spec); + struct onoff_manager *mgr = lfclk_find_mgr_by_spec(dev, spec); if (mgr) { return clock_config_request(mgr, cli); @@ -155,7 +222,7 @@ static int api_request_lfclk(const struct device *dev, static int api_release_lfclk(const struct device *dev, const struct nrf_clock_spec *spec) { - struct onoff_manager *mgr = lfclk_find_mgr(dev, spec); + struct onoff_manager *mgr = lfclk_find_mgr_by_spec(dev, spec); if (mgr) { return onoff_release(mgr); @@ -168,7 +235,7 @@ static int api_cancel_or_release_lfclk(const struct device *dev, const struct nrf_clock_spec *spec, struct onoff_client *cli) { - struct onoff_manager *mgr = lfclk_find_mgr(dev, spec); + struct onoff_manager *mgr = lfclk_find_mgr_by_spec(dev, spec); if (mgr) { return onoff_cancel_or_release(mgr, cli); @@ -177,6 +244,36 @@ static int api_cancel_or_release_lfclk(const struct device *dev, return -EINVAL; } + +static int api_resolve(const struct device *dev, + const struct nrf_clock_spec *req_spec, + struct nrf_clock_spec *res_spec) +{ + int idx; + + idx = lfclk_resolve_spec_to_idx(dev, req_spec); + if (idx < 0) { + return -EINVAL; + } + + lfclk_get_spec_by_idx(dev, idx, res_spec); + return 0; +} + +static int api_get_startup_time(const struct device *dev, + const struct nrf_clock_spec *spec, + uint32_t *startup_time_us) +{ + int idx; + + idx = lfclk_resolve_spec_to_idx(dev, spec); + if (idx < 0) { + return -EINVAL; + } + + return lfclk_get_startup_time_by_idx(dev, idx, startup_time_us); +} + static int api_get_rate_lfclk(const struct device *dev, clock_control_subsys_t sys, uint32_t *rate) @@ -251,6 +348,19 @@ static int lfclk_init(const struct device *dev) LOG_ERR("Unexpected LFOSC mode"); return -EINVAL; } + + dev_data->lfxo_startup_time_us = nrf_bicr_lfosc_startup_time_ms_get(BICR) + * USEC_PER_MSEC; + if (dev_data->lfxo_startup_time_us == NRF_BICR_LFOSC_STARTUP_TIME_UNCONFIGURED) { + LOG_ERR("BICR LFXO startup time invalid"); + return -ENODEV; + } + } + + dev_data->hfxo_startup_time_us = nrf_bicr_hfxo_startup_time_us_get(BICR); + if (dev_data->hfxo_startup_time_us == NRF_BICR_HFXO_STARTUP_TIME_UNCONFIGURED) { + LOG_ERR("BICR HFXO startup time invalid"); + return -ENODEV; } k_timer_init(&dev_data->timer, lfclk_update_timeout_handler, NULL); @@ -269,6 +379,8 @@ static DEVICE_API(nrf_clock_control, lfclk_drv_api) = { .request = api_request_lfclk, .release = api_release_lfclk, .cancel_or_release = api_cancel_or_release_lfclk, + .resolve = api_resolve, + .get_startup_time = api_get_startup_time, }; static struct lfclk_dev_data lfclk_data; diff --git a/dts/bindings/clock/nordic,nrf-fll16m.yaml b/dts/bindings/clock/nordic,nrf-fll16m.yaml index 8c7187965ae5..4f23a7a1de1b 100644 --- a/dts/bindings/clock/nordic,nrf-fll16m.yaml +++ b/dts/bindings/clock/nordic,nrf-fll16m.yaml @@ -32,4 +32,5 @@ properties: open-loop-accuracy-ppm: type: int - description: Clock accuracy in parts per million if open-loop clock source is used. + description: Clock accuracy in parts per million + required: true diff --git a/dts/bindings/clock/nordic,nrf-lfclk.yaml b/dts/bindings/clock/nordic,nrf-lfclk.yaml index f7df4d8a435e..a0f95d6c9277 100644 --- a/dts/bindings/clock/nordic,nrf-lfclk.yaml +++ b/dts/bindings/clock/nordic,nrf-lfclk.yaml @@ -21,6 +21,8 @@ description: | lfclk { lfrc-accuracy-ppm = <500>; lflprc-accuracy-ppm = <1000>; + lfrc-startup-time-us = <400>; + lflprc-startup-time-us = <400>; clocks = <&hfxo>, <&lfxo>; clock-names = "hfxo", "lfxo"; }; @@ -40,3 +42,11 @@ properties: lflprc-accuracy-ppm: type: int description: Clock accuracy in parts per million if LFLPRC clock source is used. + + lfrc-startup-time-us: + type: int + description: Clock startup time in microseconds if LFRC clock source is used. + + lflprc-startup-time-us: + type: int + description: Clock startup time in microseconds if LFLPRC clock source is used. diff --git a/dts/vendor/nordic/nrf54h20.dtsi b/dts/vendor/nordic/nrf54h20.dtsi index 5fcb941aaae2..3db33dd3c5a9 100644 --- a/dts/vendor/nordic/nrf54h20.dtsi +++ b/dts/vendor/nordic/nrf54h20.dtsi @@ -199,6 +199,8 @@ status = "okay"; lfrc-accuracy-ppm = <500>; lflprc-accuracy-ppm = <1000>; + lfrc-startup-time-us = <200>; /* To be measured */ + lflprc-startup-time-us = <200>; /* To be measured */ clocks = <&hfxo>, <&lfxo>; clock-names = "hfxo", "lfxo"; }; From 4346d85612360baac5de171aa1131bf4e65aa823 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Thu, 22 May 2025 19:29:12 +0200 Subject: [PATCH 0058/2141] [nrf fromtree] drivers: clock_control: nrf2_fll16m: impl resolve and startup_time Implement nrf_clock_control_resolve() and nrf_clock_control_get_startup_time_us() APIs. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit 9983222cd7acb92f24aa7b1c1ece7cc469d7cd70) --- .../clock_control/clock_control_nrf2_fll16m.c | 132 +++++++++++++++--- dts/bindings/clock/nordic,nrf-fll16m.yaml | 6 + dts/vendor/nordic/nrf54h20.dtsi | 1 + 3 files changed, 117 insertions(+), 22 deletions(-) diff --git a/drivers/clock_control/clock_control_nrf2_fll16m.c b/drivers/clock_control/clock_control_nrf2_fll16m.c index 7bb10263d5b6..92b09804b8a7 100644 --- a/drivers/clock_control/clock_control_nrf2_fll16m.c +++ b/drivers/clock_control/clock_control_nrf2_fll16m.c @@ -34,6 +34,7 @@ BUILD_ASSERT(FLL16M_MODE_CLOSED_LOOP == NRF_LRCCONF_CLK_SRC_CLOSED_LOOP); #define FLL16M_HFXO_ACCURACY DT_PROP(FLL16M_HFXO_NODE, accuracy_ppm) #define FLL16M_OPEN_LOOP_ACCURACY DT_INST_PROP(0, open_loop_accuracy_ppm) #define FLL16M_MAX_ACCURACY FLL16M_HFXO_ACCURACY +#define FLL16M_OPEN_LOOP_STARTUP_TIME_US DT_INST_PROP(0, open_loop_startup_time_us) #define BICR (NRF_BICR_Type *)DT_REG_ADDR(DT_NODELABEL(bicr)) @@ -57,6 +58,7 @@ struct fll16m_dev_data { STRUCT_CLOCK_CONFIG(fll16m, ARRAY_SIZE(clock_options)) clk_cfg; struct onoff_client hfxo_cli; sys_snode_t fll16m_node; + uint32_t bypass_startup_time_us; }; struct fll16m_dev_config { @@ -133,49 +135,98 @@ static void fll16m_work_handler(struct k_work *work) } } -static struct onoff_manager *fll16m_find_mgr(const struct device *dev, - const struct nrf_clock_spec *spec) +static int fll16m_resolve_spec_to_idx(const struct device *dev, + const struct nrf_clock_spec *req_spec) { - struct fll16m_dev_data *dev_data = dev->data; const struct fll16m_dev_config *dev_config = dev->config; - uint16_t accuracy; - - if (!spec) { - return &dev_data->clk_cfg.onoff[0].mgr; - } + uint16_t req_accuracy; - if (spec->frequency > dev_config->fixed_frequency) { + if (req_spec->frequency > dev_config->fixed_frequency) { LOG_ERR("invalid frequency"); - return NULL; + return -EINVAL; } - if (spec->precision) { + if (req_spec->precision) { LOG_ERR("invalid precision"); - return NULL; + return -EINVAL; } - accuracy = spec->accuracy == NRF_CLOCK_CONTROL_ACCURACY_MAX - ? FLL16M_MAX_ACCURACY - : spec->accuracy; + req_accuracy = req_spec->accuracy == NRF_CLOCK_CONTROL_ACCURACY_MAX + ? FLL16M_MAX_ACCURACY + : req_spec->accuracy; for (int i = 0; i < ARRAY_SIZE(clock_options); ++i) { - if (accuracy && - accuracy < clock_options[i].accuracy) { + if (req_accuracy && + req_accuracy < clock_options[i].accuracy) { continue; } - return &dev_data->clk_cfg.onoff[i].mgr; + return i; } LOG_ERR("invalid accuracy"); - return NULL; + return -EINVAL; +} + +static void fll16m_get_spec_by_idx(const struct device *dev, + uint8_t idx, + struct nrf_clock_spec *spec) +{ + const struct fll16m_dev_config *dev_config = dev->config; + + spec->frequency = dev_config->fixed_frequency; + spec->accuracy = clock_options[idx].accuracy; + spec->precision = NRF_CLOCK_CONTROL_PRECISION_DEFAULT; +} + +static int fll16m_get_startup_time_by_idx(const struct device *dev, + uint8_t idx, + uint32_t *startup_time_us) +{ + const struct fll16m_dev_data *dev_data = dev->data; + uint8_t mode = clock_options[idx].mode; + + switch (mode) { + case FLL16M_MODE_OPEN_LOOP: + *startup_time_us = FLL16M_OPEN_LOOP_STARTUP_TIME_US; + return 0; + + case FLL16M_MODE_BYPASS: + *startup_time_us = dev_data->bypass_startup_time_us; + return 0; + + default: + break; + } + + return -EINVAL; +} + +static struct onoff_manager *fll16m_get_mgr_by_idx(const struct device *dev, uint8_t idx) +{ + struct fll16m_dev_data *dev_data = dev->data; + + return &dev_data->clk_cfg.onoff[idx].mgr; +} + +static struct onoff_manager *fll16m_find_mgr_by_spec(const struct device *dev, + const struct nrf_clock_spec *spec) +{ + int idx; + + if (!spec) { + return fll16m_get_mgr_by_idx(dev, 0); + } + + idx = fll16m_resolve_spec_to_idx(dev, spec); + return idx < 0 ? NULL : fll16m_get_mgr_by_idx(dev, idx); } static int api_request_fll16m(const struct device *dev, const struct nrf_clock_spec *spec, struct onoff_client *cli) { - struct onoff_manager *mgr = fll16m_find_mgr(dev, spec); + struct onoff_manager *mgr = fll16m_find_mgr_by_spec(dev, spec); if (mgr) { return clock_config_request(mgr, cli); @@ -187,7 +238,7 @@ static int api_request_fll16m(const struct device *dev, static int api_release_fll16m(const struct device *dev, const struct nrf_clock_spec *spec) { - struct onoff_manager *mgr = fll16m_find_mgr(dev, spec); + struct onoff_manager *mgr = fll16m_find_mgr_by_spec(dev, spec); if (mgr) { return onoff_release(mgr); @@ -200,7 +251,7 @@ static int api_cancel_or_release_fll16m(const struct device *dev, const struct nrf_clock_spec *spec, struct onoff_client *cli) { - struct onoff_manager *mgr = fll16m_find_mgr(dev, spec); + struct onoff_manager *mgr = fll16m_find_mgr_by_spec(dev, spec); if (mgr) { return onoff_cancel_or_release(mgr, cli); @@ -222,10 +273,45 @@ static int api_get_rate_fll16m(const struct device *dev, return 0; } +static int api_resolve(const struct device *dev, + const struct nrf_clock_spec *req_spec, + struct nrf_clock_spec *res_spec) +{ + int idx; + + idx = fll16m_resolve_spec_to_idx(dev, req_spec); + if (idx < 0) { + return -EINVAL; + } + + fll16m_get_spec_by_idx(dev, idx, res_spec); + return 0; +} + +static int api_get_startup_time(const struct device *dev, + const struct nrf_clock_spec *spec, + uint32_t *startup_time_us) +{ + int idx; + + idx = fll16m_resolve_spec_to_idx(dev, spec); + if (idx < 0) { + return -EINVAL; + } + + return fll16m_get_startup_time_by_idx(dev, idx, startup_time_us); +} + static int fll16m_init(const struct device *dev) { struct fll16m_dev_data *dev_data = dev->data; + dev_data->bypass_startup_time_us = nrf_bicr_hfxo_startup_time_us_get(BICR); + if (dev_data->bypass_startup_time_us == NRF_BICR_HFXO_STARTUP_TIME_UNCONFIGURED) { + LOG_ERR("BICR HFXO startup time invalid"); + return -ENODEV; + } + return clock_config_init(&dev_data->clk_cfg, ARRAY_SIZE(dev_data->clk_cfg.onoff), fll16m_work_handler); @@ -240,6 +326,8 @@ static DEVICE_API(nrf_clock_control, fll16m_drv_api) = { .request = api_request_fll16m, .release = api_release_fll16m, .cancel_or_release = api_cancel_or_release_fll16m, + .resolve = api_resolve, + .get_startup_time = api_get_startup_time, }; static struct fll16m_dev_data fll16m_data; diff --git a/dts/bindings/clock/nordic,nrf-fll16m.yaml b/dts/bindings/clock/nordic,nrf-fll16m.yaml index 4f23a7a1de1b..cfbbb0c40932 100644 --- a/dts/bindings/clock/nordic,nrf-fll16m.yaml +++ b/dts/bindings/clock/nordic,nrf-fll16m.yaml @@ -18,6 +18,7 @@ description: | fll16m { open-loop-accuracy-ppm = <20000>; + open-loop-startup-time-us = <400>; clocks = <&hfxo>, <&lfxo>; clock-names = "hfxo", "lfxo"; }; @@ -34,3 +35,8 @@ properties: type: int description: Clock accuracy in parts per million required: true + + open-loop-startup-time-us: + type: int + description: Clock startup time if open-loop clock source is used. + required: true diff --git a/dts/vendor/nordic/nrf54h20.dtsi b/dts/vendor/nordic/nrf54h20.dtsi index 3db33dd3c5a9..37a6a3f394bb 100644 --- a/dts/vendor/nordic/nrf54h20.dtsi +++ b/dts/vendor/nordic/nrf54h20.dtsi @@ -177,6 +177,7 @@ #clock-cells = <0>; clock-frequency = ; open-loop-accuracy-ppm = <20000>; + open-loop-startup-time-us = <200>; /* To be measured */ clocks = <&hfxo>, <&lfxo>; clock-names = "hfxo", "lfxo"; }; From 6398757ca7aa7350a2591c28ca9e2ecc9cd29528 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Fri, 23 May 2025 15:25:29 +0200 Subject: [PATCH 0059/2141] [nrf fromtree] drivers: clock_control: nrf2_hsfll: impl resolve Implement nrf_clock_control_resolve() API. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit c950c56fe05558448096a32ed832fe2f3f1fa7c8) --- .../clock_control/clock_control_nrf2_hsfll.c | 79 ++++++++++++++----- 1 file changed, 60 insertions(+), 19 deletions(-) diff --git a/drivers/clock_control/clock_control_nrf2_hsfll.c b/drivers/clock_control/clock_control_nrf2_hsfll.c index eb2dfde989c7..e8f8449b24d0 100644 --- a/drivers/clock_control/clock_control_nrf2_hsfll.c +++ b/drivers/clock_control/clock_control_nrf2_hsfll.c @@ -100,35 +100,56 @@ static void hsfll_work_handler(struct k_work *work) k_timer_start(&dev_data->timer, NRFS_DVFS_TIMEOUT, K_NO_WAIT); } -static struct onoff_manager *hsfll_find_mgr(const struct device *dev, - const struct nrf_clock_spec *spec) +static int hsfll_resolve_spec_to_idx(const struct nrf_clock_spec *req_spec) { - struct hsfll_dev_data *dev_data = dev->data; - uint32_t frequency; - - if (!spec) { - return &dev_data->clk_cfg.onoff[0].mgr; - } + uint32_t req_frequency; - if (spec->accuracy || spec->precision) { + if (req_spec->accuracy || req_spec->precision) { LOG_ERR("invalid specification of accuracy or precision"); - return NULL; + return -EINVAL; } - frequency = spec->frequency == NRF_CLOCK_CONTROL_FREQUENCY_MAX - ? HSFLL_FREQ_HIGH - : spec->frequency; + req_frequency = req_spec->frequency == NRF_CLOCK_CONTROL_FREQUENCY_MAX + ? HSFLL_FREQ_HIGH + : req_spec->frequency; for (int i = 0; i < ARRAY_SIZE(clock_options); ++i) { - if (frequency > clock_options[i].frequency) { + if (req_frequency > clock_options[i].frequency) { continue; } - return &dev_data->clk_cfg.onoff[i].mgr; + return i; } LOG_ERR("invalid frequency"); - return NULL; + return -EINVAL; +} + +static void hsfll_get_spec_by_idx(uint8_t idx, struct nrf_clock_spec *spec) +{ + spec->frequency = clock_options[idx].frequency; + spec->accuracy = 0; + spec->precision = 0; +} + +static struct onoff_manager *hsfll_get_mgr_by_idx(const struct device *dev, uint8_t idx) +{ + struct hsfll_dev_data *dev_data = dev->data; + + return &dev_data->clk_cfg.onoff[idx].mgr; +} + +static struct onoff_manager *hsfll_find_mgr_by_spec(const struct device *dev, + const struct nrf_clock_spec *spec) +{ + int idx; + + if (!spec) { + return hsfll_get_mgr_by_idx(dev, 0); + } + + idx = hsfll_resolve_spec_to_idx(spec); + return idx < 0 ? NULL : hsfll_get_mgr_by_idx(dev, idx); } #endif /* CONFIG_NRFS_DVFS_LOCAL_DOMAIN */ @@ -137,7 +158,7 @@ static int api_request_hsfll(const struct device *dev, struct onoff_client *cli) { #ifdef CONFIG_NRFS_DVFS_LOCAL_DOMAIN - struct onoff_manager *mgr = hsfll_find_mgr(dev, spec); + struct onoff_manager *mgr = hsfll_find_mgr_by_spec(dev, spec); if (mgr) { return clock_config_request(mgr, cli); @@ -153,7 +174,7 @@ static int api_release_hsfll(const struct device *dev, const struct nrf_clock_spec *spec) { #ifdef CONFIG_NRFS_DVFS_LOCAL_DOMAIN - struct onoff_manager *mgr = hsfll_find_mgr(dev, spec); + struct onoff_manager *mgr = hsfll_find_mgr_by_spec(dev, spec); if (mgr) { return onoff_release(mgr); @@ -170,7 +191,7 @@ static int api_cancel_or_release_hsfll(const struct device *dev, struct onoff_client *cli) { #ifdef CONFIG_NRFS_DVFS_LOCAL_DOMAIN - struct onoff_manager *mgr = hsfll_find_mgr(dev, spec); + struct onoff_manager *mgr = hsfll_find_mgr_by_spec(dev, spec); if (mgr) { return onoff_cancel_or_release(mgr, cli); @@ -182,6 +203,25 @@ static int api_cancel_or_release_hsfll(const struct device *dev, #endif } +static int api_resolve_hsfll(const struct device *dev, + const struct nrf_clock_spec *req_spec, + struct nrf_clock_spec *res_spec) +{ +#ifdef CONFIG_NRFS_DVFS_LOCAL_DOMAIN + int idx; + + idx = hsfll_resolve_spec_to_idx(req_spec); + if (idx < 0) { + return -EINVAL; + } + + hsfll_get_spec_by_idx(idx, res_spec); + return 0; +#else + return -ENOTSUP; +#endif +} + static int hsfll_init(const struct device *dev) { #ifdef CONFIG_NRFS_DVFS_LOCAL_DOMAIN @@ -212,6 +252,7 @@ static DEVICE_API(nrf_clock_control, hsfll_drv_api) = { .request = api_request_hsfll, .release = api_release_hsfll, .cancel_or_release = api_cancel_or_release_hsfll, + .resolve = api_resolve_hsfll, }; #ifdef CONFIG_NRFS_DVFS_LOCAL_DOMAIN From 542922847fcbded7337b25062b75607fe5330d92 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Fri, 23 May 2025 15:38:38 +0200 Subject: [PATCH 0060/2141] [nrf fromtree] drivers: clock_control: nrf2_global_hsfll: impl resolve Implement nrf_clock_control_resolve() API. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit 077ff2bae9eb3d4d673794cc9557b3b8bd4e51bf) --- .../clock_control_nrf2_global_hsfll.c | 80 ++++++++++++++----- 1 file changed, 61 insertions(+), 19 deletions(-) diff --git a/drivers/clock_control/clock_control_nrf2_global_hsfll.c b/drivers/clock_control/clock_control_nrf2_global_hsfll.c index 50f3396429c1..30a64ea9fdc2 100644 --- a/drivers/clock_control/clock_control_nrf2_global_hsfll.c +++ b/drivers/clock_control/clock_control_nrf2_global_hsfll.c @@ -62,43 +62,69 @@ static uint32_t global_hsfll_get_max_clock_frequency(const struct device *dev) return dev_config->clock_frequencies[ARRAY_SIZE(dev_config->clock_frequencies) - 1]; } -static struct onoff_manager *global_hsfll_find_mgr(const struct device *dev, - const struct nrf_clock_spec *spec) +static int global_hsfll_resolve_spec_to_idx(const struct device *dev, + const struct nrf_clock_spec *req_spec) { - struct global_hsfll_dev_data *dev_data = dev->data; const struct global_hsfll_dev_config *dev_config = dev->config; - uint32_t frequency; - - if (!spec) { - return &dev_data->clk_cfg.onoff[0].mgr; - } + uint32_t req_frequency; - if (spec->accuracy || spec->precision) { + if (req_spec->accuracy || req_spec->precision) { LOG_ERR("invalid specification of accuracy or precision"); - return NULL; + return -EINVAL; } - frequency = spec->frequency == NRF_CLOCK_CONTROL_FREQUENCY_MAX - ? global_hsfll_get_max_clock_frequency(dev) - : spec->frequency; + req_frequency = req_spec->frequency == NRF_CLOCK_CONTROL_FREQUENCY_MAX + ? global_hsfll_get_max_clock_frequency(dev) + : req_spec->frequency; for (uint8_t i = 0; i < ARRAY_SIZE(dev_config->clock_frequencies); i++) { - if (dev_config->clock_frequencies[i] < frequency) { + if (dev_config->clock_frequencies[i] < req_frequency) { continue; } - return &dev_data->clk_cfg.onoff[i].mgr; + return i; } LOG_ERR("invalid frequency"); - return NULL; + return -EINVAL; +} + +static void global_hsfll_get_spec_by_idx(const struct device *dev, + uint8_t idx, + struct nrf_clock_spec *spec) +{ + const struct global_hsfll_dev_config *dev_config = dev->config; + + spec->frequency = dev_config->clock_frequencies[idx]; + spec->accuracy = 0; + spec->precision = 0; +} + +static struct onoff_manager *global_hsfll_get_mgr_by_idx(const struct device *dev, uint8_t idx) +{ + struct global_hsfll_dev_data *dev_data = dev->data; + + return &dev_data->clk_cfg.onoff[idx].mgr; +} + +static struct onoff_manager *global_hsfll_find_mgr_by_spec(const struct device *dev, + const struct nrf_clock_spec *spec) +{ + int idx; + + if (!spec) { + return global_hsfll_get_mgr_by_idx(dev, 0); + } + + idx = global_hsfll_resolve_spec_to_idx(dev, spec); + return idx < 0 ? NULL : global_hsfll_get_mgr_by_idx(dev, idx); } static int api_request_global_hsfll(const struct device *dev, const struct nrf_clock_spec *spec, struct onoff_client *cli) { - struct onoff_manager *mgr = global_hsfll_find_mgr(dev, spec); + struct onoff_manager *mgr = global_hsfll_find_mgr_by_spec(dev, spec); if (mgr) { return clock_config_request(mgr, cli); @@ -110,7 +136,7 @@ static int api_request_global_hsfll(const struct device *dev, static int api_release_global_hsfll(const struct device *dev, const struct nrf_clock_spec *spec) { - struct onoff_manager *mgr = global_hsfll_find_mgr(dev, spec); + struct onoff_manager *mgr = global_hsfll_find_mgr_by_spec(dev, spec); if (mgr) { return onoff_release(mgr); @@ -123,7 +149,7 @@ static int api_cancel_or_release_global_hsfll(const struct device *dev, const struct nrf_clock_spec *spec, struct onoff_client *cli) { - struct onoff_manager *mgr = global_hsfll_find_mgr(dev, spec); + struct onoff_manager *mgr = global_hsfll_find_mgr_by_spec(dev, spec); if (mgr) { return onoff_cancel_or_release(mgr, cli); @@ -132,6 +158,21 @@ static int api_cancel_or_release_global_hsfll(const struct device *dev, return -EINVAL; } +static int api_resolve_global_hsfll(const struct device *dev, + const struct nrf_clock_spec *req_spec, + struct nrf_clock_spec *res_spec) +{ + int idx; + + idx = global_hsfll_resolve_spec_to_idx(dev, req_spec); + if (idx < 0) { + return -EINVAL; + } + + global_hsfll_get_spec_by_idx(dev, idx, res_spec); + return 0; +} + static DEVICE_API(nrf_clock_control, driver_api) = { .std_api = { .on = api_nosys_on_off, @@ -140,6 +181,7 @@ static DEVICE_API(nrf_clock_control, driver_api) = { .request = api_request_global_hsfll, .release = api_release_global_hsfll, .cancel_or_release = api_cancel_or_release_global_hsfll, + .resolve = api_resolve_global_hsfll, }; static enum gdfs_frequency_setting global_hsfll_freq_idx_to_nrfs_freq(const struct device *dev, From d052f3e3f9f168b02efc9621430d0546598023cb Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Fri, 23 May 2025 11:54:35 +0200 Subject: [PATCH 0061/2141] [nrf fromtree] samples: boards: nordic: clock_control: add resolve and startup time Add resolving the requested clock spec and getting the startup time of the clock for given clock spec to the nordic specific clock_control sample. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit da3b4bc4adfc176c027b7fb89bbfc3eb71781411) --- .../boards/nordic/clock_control/src/main.c | 39 +++++++++++++++---- 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/samples/boards/nordic/clock_control/src/main.c b/samples/boards/nordic/clock_control/src/main.c index ebaaa0cecbd6..d2823db92ac4 100644 --- a/samples/boards/nordic/clock_control/src/main.c +++ b/samples/boards/nordic/clock_control/src/main.c @@ -45,6 +45,13 @@ int main(void) int res; int64_t req_start_uptime; int64_t req_stop_uptime; + struct nrf_clock_spec res_spec; + const struct nrf_clock_spec req_spec = { + .frequency = CONFIG_SAMPLE_CLOCK_FREQUENCY_HZ, + .accuracy = CONFIG_SAMPLE_CLOCK_ACCURACY_PPM, + .precision = CONFIG_SAMPLE_CLOCK_PRECISION, + }; + uint32_t startup_time_us; printk("\n"); printk("clock name: %s\n", SAMPLE_CLOCK_NAME); @@ -52,11 +59,29 @@ int main(void) printk("minimum accuracy request: %uPPM\n", CONFIG_SAMPLE_CLOCK_ACCURACY_PPM); printk("minimum precision request: %u\n", CONFIG_SAMPLE_CLOCK_PRECISION); - const struct nrf_clock_spec spec = { - .frequency = CONFIG_SAMPLE_CLOCK_FREQUENCY_HZ, - .accuracy = CONFIG_SAMPLE_CLOCK_ACCURACY_PPM, - .precision = CONFIG_SAMPLE_CLOCK_PRECISION, - }; + printk("\n"); + ret = nrf_clock_control_resolve(sample_clock_dev, &req_spec, &res_spec); + if (ret == 0) { + printk("resolved frequency request: %uHz\n", res_spec.frequency); + printk("resolved accuracy request: %uPPM\n", res_spec.accuracy); + printk("resolved precision request: %u\n", res_spec.precision); + } else if (ret == -ENOSYS) { + printk("resolve not supported\n"); + } else { + printk("minimum clock specs could not be resolved\n"); + return 0; + } + + printk("\n"); + ret = nrf_clock_control_get_startup_time(sample_clock_dev, &req_spec, &startup_time_us); + if (ret == 0) { + printk("startup time for requested spec: %uus\n", startup_time_us); + } else if (ret == -ENOSYS) { + printk("get startup time not supported\n"); + } else { + printk("failed to get startup time\n"); + return 0; + } sys_notify_init_callback(&cli.notify, sample_notify_cb); @@ -65,7 +90,7 @@ int main(void) printk("\n"); printk("requesting minimum clock specs\n"); req_start_uptime = k_uptime_get(); - ret = nrf_clock_control_request(sample_clock_dev, &spec, &cli); + ret = nrf_clock_control_request(sample_clock_dev, &req_spec, &cli); if (ret < 0) { printk("minimum clock specs could not be met\n"); return 0; @@ -95,7 +120,7 @@ int main(void) printk("\n"); printk("releasing requested clock specs\n"); - ret = nrf_clock_control_release(sample_clock_dev, &spec); + ret = nrf_clock_control_release(sample_clock_dev, &req_spec); if (ret < 0) { printk("failed to release requested clock specs\n"); return 0; From bd5002b5d9c8b224f6a730aa6a69ec264017cf71 Mon Sep 17 00:00:00 2001 From: Johann Fischer Date: Tue, 10 Jun 2025 11:41:11 +0200 Subject: [PATCH 0062/2141] [nrf fromtree] usb: device_next: fix the null pointer dereference on FS devices With the commit fe3c001eeb8c ("usb: device_next: disable high-speed USB device descriptor if not used") there is no high-speed device descriptor by default. Signed-off-by: Johann Fischer (cherry picked from commit 569f4d6d182e9802b3db9fc4ae58ec33f64e10e1) --- subsys/usb/device_next/usbd_ch9.c | 17 +++++++++++------ subsys/usb/device_next/usbd_device.c | 10 ++++++++++ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/subsys/usb/device_next/usbd_ch9.c b/subsys/usb/device_next/usbd_ch9.c index c9f806960d75..3adb3574f0cb 100644 --- a/subsys/usb/device_next/usbd_ch9.c +++ b/subsys/usb/device_next/usbd_ch9.c @@ -683,12 +683,6 @@ static int sreq_get_dev_qualifier(struct usbd_context *const uds_ctx, struct usb_device_qualifier_descriptor q_desc = { .bLength = sizeof(struct usb_device_qualifier_descriptor), .bDescriptorType = USB_DESC_DEVICE_QUALIFIER, - .bcdUSB = d_desc->bcdUSB, - .bDeviceClass = d_desc->bDeviceClass, - .bDeviceSubClass = d_desc->bDeviceSubClass, - .bDeviceProtocol = d_desc->bDeviceProtocol, - .bMaxPacketSize0 = d_desc->bMaxPacketSize0, - .bNumConfigurations = d_desc->bNumConfigurations, .bReserved = 0U, }; size_t len; @@ -703,6 +697,17 @@ static int sreq_get_dev_qualifier(struct usbd_context *const uds_ctx, return 0; } + if (d_desc == NULL) { + return -EINVAL; + } + + q_desc.bcdUSB = d_desc->bcdUSB; + q_desc.bDeviceClass = d_desc->bDeviceClass; + q_desc.bDeviceSubClass = d_desc->bDeviceSubClass; + q_desc.bDeviceProtocol = d_desc->bDeviceProtocol; + q_desc.bMaxPacketSize0 = d_desc->bMaxPacketSize0; + q_desc.bNumConfigurations = d_desc->bNumConfigurations; + LOG_DBG("Get Device Qualifier"); len = MIN(setup->wLength, net_buf_tailroom(buf)); net_buf_add_mem(buf, &q_desc, MIN(len, q_desc.bLength)); diff --git a/subsys/usb/device_next/usbd_device.c b/subsys/usb/device_next/usbd_device.c index bb011e0731c7..fcb689a5c567 100644 --- a/subsys/usb/device_next/usbd_device.c +++ b/subsys/usb/device_next/usbd_device.c @@ -66,6 +66,11 @@ int usbd_device_set_bcd_usb(struct usbd_context *const uds_ctx, } desc = get_device_descriptor(uds_ctx, speed); + if (desc == NULL) { + ret = -EINVAL; + goto set_bcd_exit; + } + desc->bcdUSB = sys_cpu_to_le16(bcd); set_bcd_exit: @@ -167,6 +172,11 @@ int usbd_device_set_code_triple(struct usbd_context *const uds_ctx, } desc = get_device_descriptor(uds_ctx, speed); + if (desc == NULL) { + ret = -EINVAL; + goto set_code_triple_exit; + } + desc->bDeviceClass = base_class; desc->bDeviceSubClass = subclass; desc->bDeviceProtocol = protocol; From eef332c0fd5bcd7e5902f7802b7d9a1fe467de64 Mon Sep 17 00:00:00 2001 From: Johann Fischer Date: Tue, 17 Jun 2025 22:48:07 +0200 Subject: [PATCH 0063/2141] [nrf fromtree] usb: device: fix Bluetooth buffer handling In both implementation, when comparing received data length take into account that the buffer obtained from bt_buf_get_tx() stores the type at the top. The buffer types are H:4 and in the TX path we need to check for BT_HCI_H4_* types not BT_BUF_*. In the legacy implementation, the hci_acl_pkt_len() function obtains the length from the USB transaction buffer, which does not contain a buffer type at the top. In the new implementation, partially revert the changes and restore hci_pkt_get_len(), this will be required for any further changes anyway. Fixes commit f85d63a6cc63 ("Bluetooth: Remove USB H4 mode support"). Signed-off-by: Johann Fischer (cherry picked from commit 96422f262ed8cdcd4792a239d3ad6938831f67db) --- subsys/usb/device/class/bluetooth.c | 12 +++--- subsys/usb/device_next/class/bt_hci.c | 56 ++++++++++++++++++++------- 2 files changed, 49 insertions(+), 19 deletions(-) diff --git a/subsys/usb/device/class/bluetooth.c b/subsys/usb/device/class/bluetooth.c index 33774eef90d7..7edd4792749b 100644 --- a/subsys/usb/device/class/bluetooth.c +++ b/subsys/usb/device/class/bluetooth.c @@ -154,20 +154,20 @@ static void hci_tx_thread(void *p1, void *p2, void *p3) type = net_buf_pull_u8(buf); switch (type) { - case BT_BUF_EVT: + case BT_HCI_H4_EVT: usb_transfer_sync( bluetooth_ep_data[HCI_INT_EP_IDX].ep_addr, buf->data, buf->len, USB_TRANS_WRITE | USB_TRANS_NO_ZLP); break; - case BT_BUF_ACL_IN: + case BT_HCI_H4_ACL: usb_transfer_sync( bluetooth_ep_data[HCI_IN_EP_IDX].ep_addr, buf->data, buf->len, USB_TRANS_WRITE); break; default: - LOG_ERR("Unknown type %u", type); + LOG_ERR("Unsupported type %u", type); break; } @@ -200,11 +200,11 @@ static uint16_t hci_acl_pkt_len(const uint8_t *data, size_t data_len) struct bt_hci_acl_hdr *acl_hdr; size_t hdr_len = sizeof(*acl_hdr); - if (data_len - 1 < hdr_len) { + if (data_len < hdr_len) { return 0; } - acl_hdr = (struct bt_hci_acl_hdr *)(data + 1); + acl_hdr = (struct bt_hci_acl_hdr *)data; return sys_le16_to_cpu(acl_hdr->len) + hdr_len; } @@ -250,7 +250,7 @@ static void acl_read_cb(uint8_t ep, int size, void *priv) LOG_DBG("len %u, chunk %u", buf->len, size); } - if (buf != NULL && pkt_len == buf->len) { + if (buf != NULL && pkt_len == buf->len - 1) { k_fifo_put(&rx_queue, buf); LOG_DBG("put"); buf = NULL; diff --git a/subsys/usb/device_next/class/bt_hci.c b/subsys/usb/device_next/class/bt_hci.c index 13665c78a1df..c78e64bbfe1f 100644 --- a/subsys/usb/device_next/class/bt_hci.c +++ b/subsys/usb/device_next/class/bt_hci.c @@ -210,14 +210,14 @@ static void bt_hci_tx_thread(void *p1, void *p2, void *p3) type = net_buf_pull_u8(bt_buf); switch (type) { - case BT_BUF_EVT: + case BT_HCI_H4_EVT: ep = bt_hci_get_int_in(c_data); break; - case BT_BUF_ACL_IN: + case BT_HCI_H4_ACL: ep = bt_hci_get_bulk_in(c_data); break; default: - LOG_ERR("Unknown type %u", type); + LOG_ERR("Unsupported type %u", type); continue; } @@ -273,19 +273,43 @@ static int bt_hci_acl_out_start(struct usbd_class_data *const c_data) return ret; } -static uint16_t hci_acl_pkt_len(struct net_buf *const buf) +static uint16_t hci_pkt_get_len(const uint8_t h4_type, + const uint8_t *data, const size_t size) { - struct bt_hci_acl_hdr *acl_hdr; - size_t hdr_len; + size_t hdr_len = 0; + uint16_t len = 0; - hdr_len = sizeof(*acl_hdr); - if (buf->len - 1 < hdr_len) { - return 0; + switch (h4_type) { + case BT_HCI_H4_CMD: { + struct bt_hci_cmd_hdr *cmd_hdr; + + hdr_len = sizeof(*cmd_hdr); + cmd_hdr = (struct bt_hci_cmd_hdr *)data; + len = cmd_hdr->param_len + hdr_len; + break; + } + case BT_HCI_H4_ACL: { + struct bt_hci_acl_hdr *acl_hdr; + + hdr_len = sizeof(*acl_hdr); + acl_hdr = (struct bt_hci_acl_hdr *)data; + len = sys_le16_to_cpu(acl_hdr->len) + hdr_len; + break; } + case BT_HCI_H4_ISO: { + struct bt_hci_iso_hdr *iso_hdr; - acl_hdr = (struct bt_hci_acl_hdr *)(buf->data + 1); + hdr_len = sizeof(*iso_hdr); + iso_hdr = (struct bt_hci_iso_hdr *)data; + len = bt_iso_hdr_len(sys_le16_to_cpu(iso_hdr->len)) + hdr_len; + break; + } + default: + LOG_ERR("Unknown H4 buffer type"); + return 0; + } - return sys_le16_to_cpu(acl_hdr->len) + hdr_len; + return (size < hdr_len) ? 0 : len; } static int bt_hci_acl_out_cb(struct usbd_class_data *const c_data, @@ -305,7 +329,9 @@ static int bt_hci_acl_out_cb(struct usbd_class_data *const c_data, goto restart_out_transfer; } - hci_data->acl_len = hci_acl_pkt_len(hci_data->acl_buf); + hci_data->acl_len = hci_pkt_get_len(BT_HCI_H4_ACL, + buf->data, + buf->len); LOG_DBG("acl_len %u, chunk %u", hci_data->acl_len, buf->len); @@ -330,7 +356,11 @@ static int bt_hci_acl_out_cb(struct usbd_class_data *const c_data, LOG_INF("len %u, chunk %u", hci_data->acl_buf->len, buf->len); } - if (hci_data->acl_buf != NULL && hci_data->acl_len == hci_data->acl_buf->len) { + /* + * The buffer obtained from bt_buf_get_tx() stores the type at the top. + * Take this into account when comparing received data length. + */ + if (hci_data->acl_buf != NULL && hci_data->acl_len == hci_data->acl_buf->len - 1) { k_fifo_put(&bt_hci_rx_queue, hci_data->acl_buf); hci_data->acl_buf = NULL; hci_data->acl_len = 0; From ed400c8eb9edfa1a894d9526c7d1105e1b4bd7e5 Mon Sep 17 00:00:00 2001 From: Johann Fischer Date: Tue, 17 Jun 2025 23:54:16 +0200 Subject: [PATCH 0064/2141] [nrf fromtree] usb: device_next: bt_hci: do not take semaphore if transfer enqueue fail Do not take semaphore if transfer enqueue fails. Signed-off-by: Johann Fischer (cherry picked from commit d2e42c99ac8090502125365b7eca45d002af27da) --- subsys/usb/device_next/class/bt_hci.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/subsys/usb/device_next/class/bt_hci.c b/subsys/usb/device_next/class/bt_hci.c index c78e64bbfe1f..7a2dc6da5985 100644 --- a/subsys/usb/device_next/class/bt_hci.c +++ b/subsys/usb/device_next/class/bt_hci.c @@ -189,8 +189,12 @@ static void bt_hci_tx_sync_in(struct usbd_class_data *const c_data, } net_buf_add_mem(buf, bt_buf->data, bt_buf->len); - usbd_ep_enqueue(c_data, buf); - k_sem_take(&hci_data->sync_sem, K_FOREVER); + if (usbd_ep_enqueue(c_data, buf)) { + LOG_ERR("Failed to enqueue transfer"); + } else { + k_sem_take(&hci_data->sync_sem, K_FOREVER); + } + net_buf_unref(buf); } From 89d7a6fbd5a773a985fee7315de82922c3ceaf2a Mon Sep 17 00:00:00 2001 From: Johann Fischer Date: Fri, 6 Jun 2025 23:23:07 +0200 Subject: [PATCH 0065/2141] [nrf fromtree] usb: device_next: allow to use label as interface string descriptor The intention was to use the "interface-name" string property in the interface string descriptor, but using the label property is acceptable again. Therefore, allow the use of the DT label property string in the interface string descriptor. Follow exactly the same approach as in the CDC ACM implementation introduced in the commit b0791400f61f ("usb: device_next: cdc_acm: allow setting the interface description"). Signed-off-by: Johann Fischer (cherry picked from commit 79a80730b272f37292ca6743f058d5af55bfcea3) --- dts/bindings/usb/zephyr,hid-device.yaml | 7 +++--- samples/subsys/usb/hid-keyboard/app.overlay | 2 +- .../usb/hid-keyboard/large_in_report.overlay | 2 +- .../subsys/usb/hid-mouse/usbd_next.overlay | 2 +- subsys/usb/device_next/class/usbd_hid.c | 23 +++++++++++++++++++ 5 files changed, 29 insertions(+), 7 deletions(-) diff --git a/dts/bindings/usb/zephyr,hid-device.yaml b/dts/bindings/usb/zephyr,hid-device.yaml index 2d20b450986b..1b055cf18d2a 100644 --- a/dts/bindings/usb/zephyr,hid-device.yaml +++ b/dts/bindings/usb/zephyr,hid-device.yaml @@ -8,11 +8,10 @@ compatible: "zephyr,hid-device" include: base.yaml properties: - interface-name: - type: string + label: description: | - HID device name. When this property is present, a USB device will use it - as the string descriptor of the interface. + The string defined by the label property is also used for the USB device + interface string descriptor. protocol-code: type: string diff --git a/samples/subsys/usb/hid-keyboard/app.overlay b/samples/subsys/usb/hid-keyboard/app.overlay index 0d3d2ee7bd85..0905e8850bfd 100644 --- a/samples/subsys/usb/hid-keyboard/app.overlay +++ b/samples/subsys/usb/hid-keyboard/app.overlay @@ -7,7 +7,7 @@ / { hid_dev_0: hid_dev_0 { compatible = "zephyr,hid-device"; - interface-name = "HID0"; + label = "HID0"; protocol-code = "keyboard"; in-report-size = <64>; in-polling-period-us = <1000>; diff --git a/samples/subsys/usb/hid-keyboard/large_in_report.overlay b/samples/subsys/usb/hid-keyboard/large_in_report.overlay index 93b47691a77f..548342f4b3ea 100644 --- a/samples/subsys/usb/hid-keyboard/large_in_report.overlay +++ b/samples/subsys/usb/hid-keyboard/large_in_report.overlay @@ -7,7 +7,7 @@ / { hid_dev_0: hid_dev_0 { compatible = "zephyr,hid-device"; - interface-name = "HID0"; + label = "HID0"; in-report-size = <256>; in-polling-period-us = <1000>; }; diff --git a/samples/subsys/usb/hid-mouse/usbd_next.overlay b/samples/subsys/usb/hid-mouse/usbd_next.overlay index ce74aa518796..86365a94ae54 100644 --- a/samples/subsys/usb/hid-mouse/usbd_next.overlay +++ b/samples/subsys/usb/hid-mouse/usbd_next.overlay @@ -7,7 +7,7 @@ / { hid_dev_0: hid_dev_0 { compatible = "zephyr,hid-device"; - interface-name = "HID0"; + label = "HID0"; protocol-code = "none"; in-polling-period-us = <1000>; in-report-size = <64>; diff --git a/subsys/usb/device_next/class/usbd_hid.c b/subsys/usb/device_next/class/usbd_hid.c index fd10eba3c850..d5476a88ed69 100644 --- a/subsys/usb/device_next/class/usbd_hid.c +++ b/subsys/usb/device_next/class/usbd_hid.c @@ -65,6 +65,7 @@ struct hid_device_config { struct usbd_class_data *c_data; struct net_buf_pool *pool_out; struct net_buf_pool *pool_in; + struct usbd_desc_node *const if_desc_data; const struct usb_desc_header **fs_desc; const struct usb_desc_header **hs_desc; }; @@ -488,8 +489,21 @@ static void *usbd_hid_get_desc(struct usbd_class_data *const c_data, static int usbd_hid_init(struct usbd_class_data *const c_data) { + struct usbd_context *uds_ctx = usbd_class_get_ctx(c_data); + const struct device *dev = usbd_class_get_private(c_data); + const struct hid_device_config *dcfg = dev->config; + struct usbd_hid_descriptor *const desc = dcfg->desc; + LOG_DBG("HID class %s init", c_data->name); + if (dcfg->if_desc_data != NULL && desc->if0.iInterface == 0) { + if (usbd_add_descriptor(uds_ctx, dcfg->if_desc_data)) { + LOG_ERR("Failed to add interface string descriptor"); + } else { + desc->if0.iInterface = usbd_str_desc_get_idx(dcfg->if_desc_data); + } + } + return 0; } @@ -750,6 +764,12 @@ static const struct hid_device_driver_api hid_device_api = { HID_OUT_POOL_DEFINE(n); \ USBD_HID_INTERFACE_DEFINE(n); \ \ + IF_ENABLED(DT_INST_NODE_HAS_PROP(n, label), ( \ + USBD_DESC_STRING_DEFINE(hid_if_desc_data_##n, \ + DT_INST_PROP(n, label), \ + USBD_DUT_STRING_INTERFACE); \ + )) \ + \ USBD_DEFINE_CLASS(hid_##n, \ &usbd_hid_api, \ (void *)DEVICE_DT_GET(DT_DRV_INST(n)), NULL); \ @@ -761,6 +781,9 @@ static const struct hid_device_driver_api hid_device_api = { .pool_out = HID_OUT_POOL_ADDR(n), \ .fs_desc = hid_fs_desc_##n, \ .hs_desc = hid_hs_desc_##n, \ + IF_ENABLED(DT_INST_NODE_HAS_PROP(n, label), ( \ + .if_desc_data = &hid_if_desc_data_##n, \ + )) \ }; \ \ static struct hid_device_data hid_data_##n; \ From 1535701627fddf03bcb01f90e9c003d2156db25f Mon Sep 17 00:00:00 2001 From: Aymen LAOUINI Date: Fri, 6 Jun 2025 14:20:18 +0300 Subject: [PATCH 0066/2141] [nrf fromtree] soc: nordic: add support of 'iron' variant to application - use early init hook instead of nrf92_init. - add config flag for iron variant. Signed-off-by: Aymen LAOUINI (cherry picked from commit dab414ff82dc7325528fd6b9580c4d10d194e552) --- soc/nordic/nrf92/Kconfig | 4 ++++ soc/nordic/nrf92/Kconfig.soc | 5 +++++ soc/nordic/nrf92/soc.c | 6 +----- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/soc/nordic/nrf92/Kconfig b/soc/nordic/nrf92/Kconfig index 7fdf57d61c39..a7769c00b6f2 100644 --- a/soc/nordic/nrf92/Kconfig +++ b/soc/nordic/nrf92/Kconfig @@ -7,6 +7,7 @@ config SOC_SERIES_NRF92X select HAS_NRFS select HAS_NRFX select HAS_NORDIC_DRIVERS + select SOC_EARLY_INIT_HOOK if ARM select NRF_PLATFORM_HALTIUM config SOC_NRF9230_ENGB_CPUAPP @@ -48,3 +49,6 @@ config SOC_NRF9230_ENGB_CPURAD config SOC_NRF9230_ENGB_CPUPPR select RISCV_CORE_NORDIC_VPR + +config SOC_NRF9280_IRON + select EXPERIMENTAL if MCUBOOT diff --git a/soc/nordic/nrf92/Kconfig.soc b/soc/nordic/nrf92/Kconfig.soc index 99fc28643b74..49891687a297 100644 --- a/soc/nordic/nrf92/Kconfig.soc +++ b/soc/nordic/nrf92/Kconfig.soc @@ -62,5 +62,10 @@ config SOC_NRF9280_CPUPPR help nRF9280 CPUPPR +config SOC_NRF9280_IRON + bool + help + Indicates that local domain firmware is compatible with Nordic IRONside SE. + config SOC default "nrf9280" if SOC_NRF9280 diff --git a/soc/nordic/nrf92/soc.c b/soc/nordic/nrf92/soc.c index d9a54e4f1aa6..3652b554711a 100644 --- a/soc/nordic/nrf92/soc.c +++ b/soc/nordic/nrf92/soc.c @@ -84,7 +84,7 @@ static int trim_hsfll(void) return 0; } -static int nordicsemi_nrf92_init(void) +void soc_early_init_hook(void) { sys_cache_instr_enable(); sys_cache_data_enable(); @@ -102,13 +102,9 @@ static int nordicsemi_nrf92_init(void) nrf_spu_periph_perm_dmasec_set(spu, nrf_address_slave_get(ccm030_addr), true); #endif - - return 0; } void arch_busy_wait(uint32_t time_us) { nrfx_coredep_delay_us(time_us); } - -SYS_INIT(nordicsemi_nrf92_init, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); From 00e6cd3c040bf4379627057ea3fe413508e3f5ff Mon Sep 17 00:00:00 2001 From: Aymen LAOUINI Date: Fri, 6 Jun 2025 14:24:10 +0300 Subject: [PATCH 0067/2141] [nrf fromtree] boards: nordic: add 'iron' board variant to application - Add support of next generation secure firmware to nrf92 application core. Signed-off-by: Aymen LAOUINI (cherry picked from commit 7ec82ad0bd0309115cf56d69fda8085872f9d9c0) --- boards/nordic/nrf9280pdk/Kconfig.defconfig | 10 +++ boards/nordic/nrf9280pdk/Kconfig.nrf9280pdk | 8 +- boards/nordic/nrf9280pdk/board.yml | 2 + .../nrf9280pdk_nrf9280-ipc_conf_iron.dtsi | 30 +++++++ .../nrf9280pdk_nrf9280-memory_map_iron.dtsi | 79 +++++++++++++++++++ .../nrf9280pdk_nrf9280_cpuapp_iron.dts | 41 ++++++++++ .../nrf9280pdk_nrf9280_cpuapp_iron.yaml | 23 ++++++ .../nrf9280pdk_nrf9280_cpuapp_iron_defconfig | 29 +++++++ 8 files changed, 219 insertions(+), 3 deletions(-) create mode 100644 boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280-ipc_conf_iron.dtsi create mode 100644 boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280-memory_map_iron.dtsi create mode 100644 boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp_iron.dts create mode 100644 boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp_iron.yaml create mode 100644 boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp_iron_defconfig diff --git a/boards/nordic/nrf9280pdk/Kconfig.defconfig b/boards/nordic/nrf9280pdk/Kconfig.defconfig index d1252a0a3a2e..ae7cb48cbc3b 100644 --- a/boards/nordic/nrf9280pdk/Kconfig.defconfig +++ b/boards/nordic/nrf9280pdk/Kconfig.defconfig @@ -19,3 +19,13 @@ config ASSERT default n if ZTEST endif # BOARD_NRF9280PDK_NRF9280_CPUPPR + +if BOARD_NRF9280PDK_NRF9280_CPUAPP_IRON + +config ROM_START_OFFSET + default 0x800 if BOOTLOADER_MCUBOOT + +config FLASH_LOAD_OFFSET + default $(dt_nodelabel_reg_addr_hex,cpuapp_boot_partition) if !USE_DT_CODE_PARTITION + +endif # BOARD_NRF9280PDK_NRF9280_CPUAPP_IRON diff --git a/boards/nordic/nrf9280pdk/Kconfig.nrf9280pdk b/boards/nordic/nrf9280pdk/Kconfig.nrf9280pdk index 54865a1b235e..d66fe31da884 100644 --- a/boards/nordic/nrf9280pdk/Kconfig.nrf9280pdk +++ b/boards/nordic/nrf9280pdk/Kconfig.nrf9280pdk @@ -2,7 +2,9 @@ # SPDX-License-Identifier: Apache-2.0 config BOARD_NRF9280PDK - select SOC_NRF9280_CPUAPP if BOARD_NRF9280PDK_NRF9280_CPUAPP + select SOC_NRF9280_CPUAPP if (BOARD_NRF9280PDK_NRF9280_CPUAPP || \ + BOARD_NRF9280PDK_NRF9280_CPUAPP_IRON) select SOC_NRF9280_CPURAD if BOARD_NRF9280PDK_NRF9280_CPURAD - select SOC_NRF9280_CPUPPR if BOARD_NRF9280PDK_NRF9280_CPUPPR || \ - BOARD_NRF9280PDK_NRF9280_CPUPPR_XIP + select SOC_NRF9280_CPUPPR if (BOARD_NRF9280PDK_NRF9280_CPUPPR || \ + BOARD_NRF9280PDK_NRF9280_CPUPPR_XIP) + select SOC_NRF9280_IRON if BOARD_NRF9280PDK_NRF9280_CPUAPP_IRON diff --git a/boards/nordic/nrf9280pdk/board.yml b/boards/nordic/nrf9280pdk/board.yml index 963eae59ba0f..2cce133d95c3 100644 --- a/boards/nordic/nrf9280pdk/board.yml +++ b/boards/nordic/nrf9280pdk/board.yml @@ -7,3 +7,5 @@ board: variants: - name: xip cpucluster: cpuppr + - name: iron + cpucluster: cpuapp diff --git a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280-ipc_conf_iron.dtsi b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280-ipc_conf_iron.dtsi new file mode 100644 index 000000000000..a44db40538d2 --- /dev/null +++ b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280-ipc_conf_iron.dtsi @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* This file is to be merged with the original ipc_conf.dtsi in the future. */ + +/ { + ipc { + /delete-node/ ipc-1-2; + /delete-node/ ipc-1-3; + + cpusec_cpuapp_ipc: ipc-1-2 { + compatible = "nordic,ironside-call"; + memory-region = <&cpusec_cpuapp_ipc_shm>; + mboxes = <&cpusec_bellboard 12>, + <&cpuapp_bellboard 0>; + status = "disabled"; + }; + + cpusec_cpurad_ipc: ipc-1-3 { + compatible = "nordic,ironside-call"; + memory-region = <&cpusec_cpurad_ipc_shm>; + mboxes = <&cpusec_bellboard 18>, + <&cpurad_bellboard 0>; + status = "disabled"; + }; + }; +}; diff --git a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280-memory_map_iron.dtsi b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280-memory_map_iron.dtsi new file mode 100644 index 000000000000..aa95021d887c --- /dev/null +++ b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280-memory_map_iron.dtsi @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* This file is to be merged with the original memory_map.dtsi in the future. + * The following nodes will be replaced: + */ +/delete-node/ &cpuapp_cpusys_ipc_shm; +/delete-node/ &cpusec_cpuapp_ipc_shm; +/delete-node/ &cpusys_cpuapp_ipc_shm; +/delete-node/ &cpuapp_rw_partitions; +/delete-node/ &cpuapp_rx_partitions; +/delete-node/ &cpurad_rx_partitions; + +/ { + reserved-memory { + cpuapp_cpusys_ipc_shm: memory@2f88f600 { + reg = <0x2f88f600 0x80>; + }; + + cpusys_cpuapp_ipc_shm: memory@2f88f680 { + reg = <0x2f88f680 0x80>; + }; + + cpusec_cpuapp_ipc_shm: memory@2f88fb80 { + reg = <0x2f88fb80 0x80>; + }; + + cpuapp_ironside_se_event_report: memory@2f88fc00 { + reg = <0x2f88fc00 0x100>; + }; + + cpuapp_ironside_se_boot_report: memory@2f88fd00 { + reg = <0x2f88fd00 0x200>; + }; + }; +}; + +&mram1x { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + cpuapp_boot_partition: partition@312000 { + reg = <0x312000 DT_SIZE_K(64)>; + }; + + cpuapp_slot0_partition: partition@322000 { + reg = <0x322000 DT_SIZE_K(336)>; + }; + + cpuapp_slot1_partition: partition@376000 { + reg = <0x376000 DT_SIZE_K(440)>; + }; + + cpuppr_code_partition: partition@3E4000 { + reg = <0x3E4000 DT_SIZE_K(64)>; + }; + + cpuflpr_code_partition: partition@3F4000 { + reg = <0x3F4000 DT_SIZE_K(48)>; + }; + + cpurad_slot0_partition: partition@400000 { + reg = <0x400000 DT_SIZE_K(336)>; + }; + + cpurad_slot1_partition: partition@454000 { + reg = <0x454000 DT_SIZE_K(336)>; + }; + + storage_partition: partition@600000 { + reg = <0x600000 DT_SIZE_K(40)>; + }; + }; +}; diff --git a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp_iron.dts b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp_iron.dts new file mode 100644 index 000000000000..a3ca908f59de --- /dev/null +++ b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp_iron.dts @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "nrf9280pdk_nrf9280_cpuapp.dts" +#include "nrf9280pdk_nrf9280-ipc_conf_iron.dtsi" +#include "nrf9280pdk_nrf9280-memory_map_iron.dtsi" + +/delete-node/ &cpusec_cpurad_ipc; + +/ { + chosen { + zephyr,code-partition = &slot0_partition; + zephyr,uart-mcumgr = &uart136; + }; +}; + +&cpusec_bellboard { + status = "okay"; +}; + +&cpusec_cpuapp_ipc { + mbox-names = "tx", "rx"; + status = "okay"; +}; + +ironside_se_boot_report: &cpuapp_ironside_se_boot_report {}; + +boot_partition: &cpuapp_boot_partition { + label = "mcuboot"; +}; + +slot0_partition: &cpuapp_slot0_partition { + label = "image-0"; +}; + +slot1_partition: &cpuapp_slot1_partition { + label = "image-1"; +}; diff --git a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp_iron.yaml b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp_iron.yaml new file mode 100644 index 000000000000..029f133993bf --- /dev/null +++ b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp_iron.yaml @@ -0,0 +1,23 @@ +# Copyright (c) 2025 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +identifier: nrf9280pdk/nrf9280/cpuapp/iron +name: nRF9280-DK-nRF9280-Application +type: mcu +arch: arm +toolchain: + - gnuarmemb + - xtools + - zephyr +sysbuild: true +ram: 512 +flash: 1024 +supported: + - adc + - counter + - gpio + - i2c + - pwm + - spi + - watchdog + - usbd diff --git a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp_iron_defconfig b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp_iron_defconfig new file mode 100644 index 000000000000..01f3bec39321 --- /dev/null +++ b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp_iron_defconfig @@ -0,0 +1,29 @@ +# Copyright (c) 2025 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +# Enable UART driver +CONFIG_SERIAL=y + +# Enable console +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y + +# Enable MPU +CONFIG_ARM_MPU=y + +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y + +# MPU-based null-pointer dereferencing detection cannot be applied +# as the (0x0 - 0x400) region is unmapped for this target. +CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y + +# Enable cache +CONFIG_CACHE_MANAGEMENT=y +CONFIG_EXTERNAL_CACHE=y + +# Enable GPIO +CONFIG_GPIO=y + +# UICR generation is not supported, and when reintroduced will not use nrf-regtool. +CONFIG_NRF_REGTOOL_GENERATE_UICR=n From dd8cf228f04843ffc655974343ef877466858e19 Mon Sep 17 00:00:00 2001 From: Aymen LAOUINI Date: Fri, 6 Jun 2025 14:25:52 +0300 Subject: [PATCH 0068/2141] [nrf fromtree] drivers: firmware: nrf_ironside: Update doxygen header for API. - Message is written to the boot report of core. Signed-off-by: Aymen LAOUINI (cherry picked from commit de41047aefa6499951296dc5e61c4584889c0e84) --- include/zephyr/drivers/firmware/nrf_ironside/cpuconf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/zephyr/drivers/firmware/nrf_ironside/cpuconf.h b/include/zephyr/drivers/firmware/nrf_ironside/cpuconf.h index e6f2150b6e22..d769a319def7 100644 --- a/include/zephyr/drivers/firmware/nrf_ironside/cpuconf.h +++ b/include/zephyr/drivers/firmware/nrf_ironside/cpuconf.h @@ -53,7 +53,7 @@ BUILD_ASSERT(IRONSIDE_CPUCONF_NUM_ARGS <= NRF_IRONSIDE_CALL_NUM_ARGS); * @param cpu The CPU to be booted * @param vector_table Pointer to the vector table used to boot the CPU. * @param cpu_wait When this is true, the CPU will WAIT even if the CPU has clock. - * @param msg A message that can be placed in radiocore's boot report. + * @param msg A message that can be placed in cpu's boot report. * @param msg_size Size of the message in bytes. * * @note cpu_wait is only intended to be enabled for debug purposes From 822c4d9ab28a5dccf531c406cea9c0848b73db1e Mon Sep 17 00:00:00 2001 From: Aymen LAOUINI Date: Mon, 16 Jun 2025 16:42:05 +0300 Subject: [PATCH 0069/2141] [nrf fromtree] samples: watchdog: Add nrf9280 iron to sample Added overlay for nrf9280 cpuapp iron board. Signed-off-by: Aymen LAOUINI (cherry picked from commit eac65a2acdd6e9b5d2a7d6424be2052e4f91bcf8) --- .../boards/nrf9280pdk_nrf9280_cpuapp_iron.overlay | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 samples/drivers/watchdog/boards/nrf9280pdk_nrf9280_cpuapp_iron.overlay diff --git a/samples/drivers/watchdog/boards/nrf9280pdk_nrf9280_cpuapp_iron.overlay b/samples/drivers/watchdog/boards/nrf9280pdk_nrf9280_cpuapp_iron.overlay new file mode 100644 index 000000000000..102abfc8ef27 --- /dev/null +++ b/samples/drivers/watchdog/boards/nrf9280pdk_nrf9280_cpuapp_iron.overlay @@ -0,0 +1,8 @@ +/* + * Copyright 2025 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +&wdt010 { + status = "okay"; +}; From 485f9d333cadafa94088b7119e43685edd41937c Mon Sep 17 00:00:00 2001 From: Aymen LAOUINI Date: Mon, 16 Jun 2025 16:43:39 +0300 Subject: [PATCH 0070/2141] [nrf fromtree] tests: drivers: watchdog: Enable watchdog test for nrf9280 iron Added overlay for nrf9280 cpuapp iron board. Signed-off-by: Aymen LAOUINI (cherry picked from commit 96fa61fc78f8ea9ebc3bb8468d905c205914b872) --- .../boards/nrf9280pdk_nrf9280_cpuapp_iron.overlay | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 tests/drivers/watchdog/wdt_basic_api/boards/nrf9280pdk_nrf9280_cpuapp_iron.overlay diff --git a/tests/drivers/watchdog/wdt_basic_api/boards/nrf9280pdk_nrf9280_cpuapp_iron.overlay b/tests/drivers/watchdog/wdt_basic_api/boards/nrf9280pdk_nrf9280_cpuapp_iron.overlay new file mode 100644 index 000000000000..102abfc8ef27 --- /dev/null +++ b/tests/drivers/watchdog/wdt_basic_api/boards/nrf9280pdk_nrf9280_cpuapp_iron.overlay @@ -0,0 +1,8 @@ +/* + * Copyright 2025 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +&wdt010 { + status = "okay"; +}; From b45da2ee2795c53540503bd7850193237dc30183 Mon Sep 17 00:00:00 2001 From: Aymen LAOUINI Date: Mon, 16 Jun 2025 16:44:38 +0300 Subject: [PATCH 0071/2141] [nrf fromtree] tests: drivers: adc: Enable adc test for nrf9280 iron Added overlay for nrf9280 cpuapp iron board. Modified overlay for nrf9280 cpuapp board to use common dtsi. Signed-off-by: Aymen LAOUINI (cherry picked from commit 3befde741f9be0a03fa38cc7c912d0cfc11bc2e6) --- .../boards/nrf9280pdk_nrf9280_common.dtsi | 43 +++++++++++++++++++ .../boards/nrf9280pdk_nrf9280_cpuapp.overlay | 40 +---------------- .../nrf9280pdk_nrf9280_cpuapp_iron.overlay | 7 +++ 3 files changed, 52 insertions(+), 38 deletions(-) create mode 100644 tests/drivers/adc/adc_api/boards/nrf9280pdk_nrf9280_common.dtsi create mode 100644 tests/drivers/adc/adc_api/boards/nrf9280pdk_nrf9280_cpuapp_iron.overlay diff --git a/tests/drivers/adc/adc_api/boards/nrf9280pdk_nrf9280_common.dtsi b/tests/drivers/adc/adc_api/boards/nrf9280pdk_nrf9280_common.dtsi new file mode 100644 index 000000000000..d90e7fc93c17 --- /dev/null +++ b/tests/drivers/adc/adc_api/boards/nrf9280pdk_nrf9280_common.dtsi @@ -0,0 +1,43 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2025 Nordic Semiconductor ASA + */ + +/ { + zephyr,user { + io-channels = <&adc 0>, <&adc 1>, <&adc 2>; + }; +}; + +&adc { + #address-cells = <1>; + #size-cells = <0>; + + channel@0 { + reg = <0>; + zephyr,gain = "ADC_GAIN_1_2"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,input-positive = ; + zephyr,resolution = <10>; + }; + + channel@1 { + reg = <1>; + zephyr,gain = "ADC_GAIN_2"; + zephyr,reference = "ADC_REF_EXTERNAL0"; + zephyr,acquisition-time = ; + zephyr,input-positive = ; + zephyr,resolution = <10>; + }; + + channel@2 { + reg = <2>; + zephyr,gain = "ADC_GAIN_2_3"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,input-positive = ; + zephyr,resolution = <10>; + }; +}; diff --git a/tests/drivers/adc/adc_api/boards/nrf9280pdk_nrf9280_cpuapp.overlay b/tests/drivers/adc/adc_api/boards/nrf9280pdk_nrf9280_cpuapp.overlay index d9c1f965addb..cd9ca89b82a3 100644 --- a/tests/drivers/adc/adc_api/boards/nrf9280pdk_nrf9280_cpuapp.overlay +++ b/tests/drivers/adc/adc_api/boards/nrf9280pdk_nrf9280_cpuapp.overlay @@ -1,43 +1,7 @@ /* * SPDX-License-Identifier: Apache-2.0 * - * Copyright (c) 2024 Nordic Semiconductor ASA + * Copyright (c) 2025 Nordic Semiconductor ASA */ -/ { - zephyr,user { - io-channels = <&adc 0>, <&adc 1>, <&adc 2>; - }; -}; - -&adc { - #address-cells = <1>; - #size-cells = <0>; - - channel@0 { - reg = <0>; - zephyr,gain = "ADC_GAIN_1_2"; - zephyr,reference = "ADC_REF_INTERNAL"; - zephyr,acquisition-time = ; - zephyr,input-positive = ; - zephyr,resolution = <10>; - }; - - channel@1 { - reg = <1>; - zephyr,gain = "ADC_GAIN_2"; - zephyr,reference = "ADC_REF_EXTERNAL0"; - zephyr,acquisition-time = ; - zephyr,input-positive = ; - zephyr,resolution = <10>; - }; - - channel@2 { - reg = <2>; - zephyr,gain = "ADC_GAIN_1_2"; - zephyr,reference = "ADC_REF_INTERNAL"; - zephyr,acquisition-time = ; - zephyr,input-positive = ; - zephyr,resolution = <10>; - }; -}; +#include "nrf9280pdk_nrf9280_common.dtsi" diff --git a/tests/drivers/adc/adc_api/boards/nrf9280pdk_nrf9280_cpuapp_iron.overlay b/tests/drivers/adc/adc_api/boards/nrf9280pdk_nrf9280_cpuapp_iron.overlay new file mode 100644 index 000000000000..cd9ca89b82a3 --- /dev/null +++ b/tests/drivers/adc/adc_api/boards/nrf9280pdk_nrf9280_cpuapp_iron.overlay @@ -0,0 +1,7 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2025 Nordic Semiconductor ASA + */ + +#include "nrf9280pdk_nrf9280_common.dtsi" From 49a70a2233f3d16691aaf928264bda4736d8e328 Mon Sep 17 00:00:00 2001 From: Aymen LAOUINI Date: Wed, 18 Jun 2025 17:26:00 +0300 Subject: [PATCH 0072/2141] [nrf fromtree] tests: kernel: gen_isr_table: Add ISR offset definitions for nrf9280 - Correct test by adding ISR offset definitions for nrf9280 ppr and flrp. Signed-off-by: Aymen LAOUINI (cherry picked from commit 07d9f151e71f3960ab1ea0dd81afd86775d522dc) --- tests/kernel/gen_isr_table/src/main.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/kernel/gen_isr_table/src/main.c b/tests/kernel/gen_isr_table/src/main.c index d6b92731fc53..d3e3291573a7 100644 --- a/tests/kernel/gen_isr_table/src/main.c +++ b/tests/kernel/gen_isr_table/src/main.c @@ -31,6 +31,11 @@ extern uintptr_t _irq_vector_table[]; #define ISR3_OFFSET 15 #define ISR5_OFFSET 16 #define TRIG_CHECK_SIZE 17 +#elif defined(CONFIG_SOC_NRF9280_CPUPPR) +#define ISR1_OFFSET 14 +#define ISR3_OFFSET 15 +#define ISR5_OFFSET 16 +#define TRIG_CHECK_SIZE 17 #else #error "Target not supported" #endif From 23857cc300e7708a267e08a08be75ae9318cd5ee Mon Sep 17 00:00:00 2001 From: Aymen LAOUINI Date: Mon, 23 Jun 2025 14:13:55 +0300 Subject: [PATCH 0073/2141] [nrf fromtree] tests: kernel: interrupt: Add ISR offset definitions for nrf9280 - Correct test by adding ISR offset definitions for nrf9280 ppr. Signed-off-by: Aymen LAOUINI (cherry picked from commit 8b4a29f1eddb0d5913c7d844f399d4c3a7ed7b46) --- tests/kernel/interrupt/src/nested_irq.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/kernel/interrupt/src/nested_irq.c b/tests/kernel/interrupt/src/nested_irq.c index 3e6a798e6042..e1edfc3442fe 100644 --- a/tests/kernel/interrupt/src/nested_irq.c +++ b/tests/kernel/interrupt/src/nested_irq.c @@ -66,6 +66,12 @@ #define IRQ0_LINE 14 #define IRQ1_LINE 15 +#define IRQ0_PRIO 1 +#define IRQ1_PRIO 2 +#elif defined(CONFIG_SOC_NRF9280_CPUPPR) +#define IRQ0_LINE 14 +#define IRQ1_LINE 15 + #define IRQ0_PRIO 1 #define IRQ1_PRIO 2 #else From 3a87edf0416b7d0bcff8beb90dc1b576f3d36092 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Wed, 4 Jun 2025 14:41:04 +0200 Subject: [PATCH 0074/2141] [nrf fromtree] manifest: Update nRF hw models to latest Update the HW models module to: 9eb489fdcde23d4f69ded78bca872bfc31b5ee79 Including the following: 9eb489f CLOCK (54): Add test interfaces to control duration and to fail tuning 787d8c8 CLOCK (52,53): Add test interface control start duration 8bd3a5f NHW_54_AAR_CCM_ECB: Do not inform about the ECB being already stopped ca72ca7 RADIO: Add CodedPhy to old comment mentioning what is supported Signed-off-by: Alberto Escolar Piedras (cherry picked from commit e6e59856132f8dd40143a7bf2ed21202d1a7ad8e) Signed-off-by: Rubin Gerritsen --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 76ca9284ec89..c394b576621f 100644 --- a/west.yml +++ b/west.yml @@ -325,7 +325,7 @@ manifest: groups: - tools - name: nrf_hw_models - revision: c6296f600a6851bd652f207ab4908d339e1ce705 + revision: 9eb489fdcde23d4f69ded78bca872bfc31b5ee79 path: modules/bsim_hw_models/nrf_hw_models - name: nrf_wifi revision: 7cb2f44f46dfc86e4f97477ee90022944e138dd8 From e5563ce2e0c022280b3feaa450e64afb935764e0 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Wed, 18 Jun 2025 14:02:51 +0200 Subject: [PATCH 0075/2141] [nrf fromtree] manifest: Update nRF hw models to latest Update the HW models module to: 968d55ff22579080466bf2f482596dd6e35361c6 Including the following: 968d55f 54LM20: Also build CRACEN RNG 2c6d49d CRACEN RNG: Add model of the new version of the IP 914b475 54LM20: Add first version fb68cc6 grtc hal replacement: Remove pointless macro use ef2f63e Fix wrong NRF_UARTE register reference 63a2e85 README: Clarify the models are not perfect, and correct links Signed-off-by: Alberto Escolar Piedras (cherry picked from commit 5aa9e2578a19b770a1d712b364bbe047c60bc7df) Signed-off-by: Rubin Gerritsen --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index c394b576621f..594f7db44b4e 100644 --- a/west.yml +++ b/west.yml @@ -325,7 +325,7 @@ manifest: groups: - tools - name: nrf_hw_models - revision: 9eb489fdcde23d4f69ded78bca872bfc31b5ee79 + revision: 968d55ff22579080466bf2f482596dd6e35361c6 path: modules/bsim_hw_models/nrf_hw_models - name: nrf_wifi revision: 7cb2f44f46dfc86e4f97477ee90022944e138dd8 From ea07de464e8e94723feab6389c418037660b6eba Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Wed, 18 Jun 2025 15:12:03 +0200 Subject: [PATCH 0076/2141] [nrf fromtree] manifest: Update bsim to version v2.7 Main changes since v2.6: * ext_2G4_phy_v1: Runtime performance optimizations * ext_2G4_libPhyComv1: Add BT LE HDT support * ext_2G4_channel_Indoorv1: Add BT LE HDT support Note: Like before, bsim remains fully backwards compatible Signed-off-by: Alberto Escolar Piedras (cherry picked from commit e48569e745afc917859f93fa4f2ad33e9d4d505e) Signed-off-by: Rubin Gerritsen --- west.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/west.yml b/west.yml index 594f7db44b4e..d3a70e368671 100644 --- a/west.yml +++ b/west.yml @@ -37,7 +37,7 @@ manifest: remote: babblesim repo-path: base path: tools/bsim/components - revision: d562cd57317d33531ee3655d84660c57b8dc64c9 + revision: 2cfac3dca2071452ae481d115d8541880568753d groups: - babblesim - name: babblesim_ext_2G4_channel_NtNcable @@ -79,7 +79,7 @@ manifest: remote: babblesim repo-path: ext_2G4_libPhyComv1 path: tools/bsim/components/ext_2G4_libPhyComv1 - revision: 15ae0f87fa049e04cbec48a866f3bc37d903f950 + revision: e18e41e8e3fa9f996559ed98b9238a5702dcdd36 groups: - babblesim - name: babblesim_ext_2G4_modem_BLE_simple @@ -100,7 +100,7 @@ manifest: remote: babblesim repo-path: ext_2G4_phy_v1 path: tools/bsim/components/ext_2G4_phy_v1 - revision: dbfd6b068f3bde8e56dcea58b4e686a8efc01cbe + revision: 8964ed1eb94606c2ea555340907bdc5171793e65 groups: - babblesim - name: babblesim_ext_libCryptov1 @@ -112,7 +112,7 @@ manifest: - babblesim - name: bsim repo-path: babblesim-manifest - revision: 193b8ba94cdc6ecbc3bb7fe80b87dee456e5eab0 + revision: 2ba22a0608ad9f46da1b96ee5121af357053c791 path: tools/bsim groups: - babblesim From 5e6a0881d299c6417eadb7198caf000248961550 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Tue, 24 Jun 2025 13:02:05 +0200 Subject: [PATCH 0077/2141] [nrf fromtree] drivers: i2c: Support i2c23 and i2c24 instances MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Extend I2C driver with possibility to use - TWIM23, TWIM24, - TWIS23, TWIS24. Signed-off-by: Sebastian Głąb (cherry picked from commit 031040872ef65fbe50c60a4e5b605b6c272fe6c7) --- drivers/i2c/Kconfig.nrfx | 4 ++++ drivers/i2c/i2c_nrfx_twim.c | 8 ++++++++ drivers/i2c/i2c_nrfx_twim_rtio.c | 8 ++++++++ drivers/i2c/i2c_nrfx_twis.c | 8 ++++++++ modules/hal_nordic/nrfx/Kconfig | 20 ++++++++++++++++++++ modules/hal_nordic/nrfx/nrfx_kconfig.h | 12 ++++++++++++ soc/nordic/common/Kconfig.peripherals | 12 ++++++++++++ soc/nordic/validate_base_addresses.c | 2 ++ 8 files changed, 74 insertions(+) diff --git a/drivers/i2c/Kconfig.nrfx b/drivers/i2c/Kconfig.nrfx index 2213175d5d60..54d533636747 100644 --- a/drivers/i2c/Kconfig.nrfx +++ b/drivers/i2c/Kconfig.nrfx @@ -30,6 +30,8 @@ config I2C_NRFX_TWIM select NRFX_TWIM20 if HAS_HW_NRF_TWIM20 select NRFX_TWIM21 if HAS_HW_NRF_TWIM21 select NRFX_TWIM22 if HAS_HW_NRF_TWIM22 + select NRFX_TWIM23 if HAS_HW_NRF_TWIM23 + select NRFX_TWIM24 if HAS_HW_NRF_TWIM24 select NRFX_TWIM30 if HAS_HW_NRF_TWIM30 select NRFX_TWIM120 if HAS_HW_NRF_TWIM120 select NRFX_TWIM130 if HAS_HW_NRF_TWIM130 @@ -61,6 +63,8 @@ config I2C_NRFX_TWIS select NRFX_TWIS20 if HAS_HW_NRF_TWIS20 select NRFX_TWIS21 if HAS_HW_NRF_TWIS21 select NRFX_TWIS22 if HAS_HW_NRF_TWIS22 + select NRFX_TWIS23 if HAS_HW_NRF_TWIS23 + select NRFX_TWIS24 if HAS_HW_NRF_TWIS24 select NRFX_TWIS30 if HAS_HW_NRF_TWIS30 select NRFX_TWIS130 if HAS_HW_NRF_TWIS130 select NRFX_TWIS131 if HAS_HW_NRF_TWIS131 diff --git a/drivers/i2c/i2c_nrfx_twim.c b/drivers/i2c/i2c_nrfx_twim.c index 953a03a7b73d..d5b619bfc5ac 100644 --- a/drivers/i2c/i2c_nrfx_twim.c +++ b/drivers/i2c/i2c_nrfx_twim.c @@ -323,6 +323,14 @@ I2C_NRFX_TWIM_DEVICE(21); I2C_NRFX_TWIM_DEVICE(22); #endif +#ifdef CONFIG_HAS_HW_NRF_TWIM23 +I2C_NRFX_TWIM_DEVICE(23); +#endif + +#ifdef CONFIG_HAS_HW_NRF_TWIM24 +I2C_NRFX_TWIM_DEVICE(24); +#endif + #ifdef CONFIG_HAS_HW_NRF_TWIM30 I2C_NRFX_TWIM_DEVICE(30); #endif diff --git a/drivers/i2c/i2c_nrfx_twim_rtio.c b/drivers/i2c/i2c_nrfx_twim_rtio.c index 68d93a3a06e5..6a7504dbd628 100644 --- a/drivers/i2c/i2c_nrfx_twim_rtio.c +++ b/drivers/i2c/i2c_nrfx_twim_rtio.c @@ -314,6 +314,14 @@ I2C_NRFX_TWIM_RTIO_DEVICE(21); I2C_NRFX_TWIM_RTIO_DEVICE(22); #endif +#ifdef CONFIG_HAS_HW_NRF_TWIM23 +I2C_NRFX_TWIM_RTIO_DEVICE(23); +#endif + +#ifdef CONFIG_HAS_HW_NRF_TWIM24 +I2C_NRFX_TWIM_RTIO_DEVICE(24); +#endif + #ifdef CONFIG_HAS_HW_NRF_TWIM30 I2C_NRFX_TWIM_RTIO_DEVICE(30); #endif diff --git a/drivers/i2c/i2c_nrfx_twis.c b/drivers/i2c/i2c_nrfx_twis.c index 9e2b0759f2a3..c37c51ddd745 100644 --- a/drivers/i2c/i2c_nrfx_twis.c +++ b/drivers/i2c/i2c_nrfx_twis.c @@ -362,6 +362,14 @@ SHIM_NRF_TWIS_DEVICE_DEFINE(21); SHIM_NRF_TWIS_DEVICE_DEFINE(22); #endif +#ifdef CONFIG_HAS_HW_NRF_TWIS23 +SHIM_NRF_TWIS_DEVICE_DEFINE(23); +#endif + +#ifdef CONFIG_HAS_HW_NRF_TWIS24 +SHIM_NRF_TWIS_DEVICE_DEFINE(24); +#endif + #ifdef CONFIG_HAS_HW_NRF_TWIS30 SHIM_NRF_TWIS_DEVICE_DEFINE(30); #endif diff --git a/modules/hal_nordic/nrfx/Kconfig b/modules/hal_nordic/nrfx/Kconfig index 08c5df625990..80610599e60b 100644 --- a/modules/hal_nordic/nrfx/Kconfig +++ b/modules/hal_nordic/nrfx/Kconfig @@ -921,6 +921,16 @@ config NRFX_TWIM22 depends on $(dt_nodelabel_exists,i2c22) select NRFX_TWIM +config NRFX_TWIM23 + bool "TWIM23 driver instance" + depends on $(dt_nodelabel_exists,i2c23) + select NRFX_TWIM + +config NRFX_TWIM24 + bool "TWIM24 driver instance" + depends on $(dt_nodelabel_exists,i2c24) + select NRFX_TWIM + config NRFX_TWIM30 bool "TWIM30 driver instance" depends on $(dt_nodelabel_exists,i2c30) @@ -1009,6 +1019,16 @@ config NRFX_TWIS22 depends on $(dt_nodelabel_exists,i2c22) select NRFX_TWIS +config NRFX_TWIS23 + bool "TWIS23 driver instance" + depends on $(dt_nodelabel_exists,i2c23) + select NRFX_TWIS + +config NRFX_TWIS24 + bool "TWIS24 driver instance" + depends on $(dt_nodelabel_exists,i2c24) + select NRFX_TWIS + config NRFX_TWIS30 bool "TWIS30 driver instance" depends on $(dt_nodelabel_exists,i2c30) diff --git a/modules/hal_nordic/nrfx/nrfx_kconfig.h b/modules/hal_nordic/nrfx/nrfx_kconfig.h index ed1948a3931d..191855b3ff0e 100644 --- a/modules/hal_nordic/nrfx/nrfx_kconfig.h +++ b/modules/hal_nordic/nrfx/nrfx_kconfig.h @@ -759,6 +759,12 @@ #ifdef CONFIG_NRFX_TWIM22 #define NRFX_TWIM22_ENABLED 1 #endif +#ifdef CONFIG_NRFX_TWIM23 +#define NRFX_TWIM23_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_TWIM24 +#define NRFX_TWIM24_ENABLED 1 +#endif #ifdef CONFIG_NRFX_TWIM30 #define NRFX_TWIM30_ENABLED 1 #endif @@ -823,6 +829,12 @@ #ifdef CONFIG_NRFX_TWIS22 #define NRFX_TWIS22_ENABLED 1 #endif +#ifdef CONFIG_NRFX_TWIS23 +#define NRFX_TWIS23_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_TWIS24 +#define NRFX_TWIS24_ENABLED 1 +#endif #ifdef CONFIG_NRFX_TWIS30 #define NRFX_TWIS30_ENABLED 1 #endif diff --git a/soc/nordic/common/Kconfig.peripherals b/soc/nordic/common/Kconfig.peripherals index 900effed1416..083fcc4e0891 100644 --- a/soc/nordic/common/Kconfig.peripherals +++ b/soc/nordic/common/Kconfig.peripherals @@ -514,6 +514,12 @@ config HAS_HW_NRF_TWIM21 config HAS_HW_NRF_TWIM22 def_bool $(dt_nodelabel_enabled_with_compat,i2c22,$(DT_COMPAT_NORDIC_NRF_TWIM)) +config HAS_HW_NRF_TWIM23 + def_bool $(dt_nodelabel_enabled_with_compat,i2c23,$(DT_COMPAT_NORDIC_NRF_TWIM)) + +config HAS_HW_NRF_TWIM24 + def_bool $(dt_nodelabel_enabled_with_compat,i2c24,$(DT_COMPAT_NORDIC_NRF_TWIM)) + config HAS_HW_NRF_TWIM30 def_bool $(dt_nodelabel_enabled_with_compat,i2c30,$(DT_COMPAT_NORDIC_NRF_TWIM)) @@ -565,6 +571,12 @@ config HAS_HW_NRF_TWIS21 config HAS_HW_NRF_TWIS22 def_bool $(dt_nodelabel_enabled_with_compat,i2c22,$(DT_COMPAT_NORDIC_NRF_TWIS)) +config HAS_HW_NRF_TWIS23 + def_bool $(dt_nodelabel_enabled_with_compat,i2c23,$(DT_COMPAT_NORDIC_NRF_TWIS)) + +config HAS_HW_NRF_TWIS24 + def_bool $(dt_nodelabel_enabled_with_compat,i2c24,$(DT_COMPAT_NORDIC_NRF_TWIS)) + config HAS_HW_NRF_TWIS30 def_bool $(dt_nodelabel_enabled_with_compat,i2c30,$(DT_COMPAT_NORDIC_NRF_TWIS)) diff --git a/soc/nordic/validate_base_addresses.c b/soc/nordic/validate_base_addresses.c index 02413e3f174a..1c5c39f74ec1 100644 --- a/soc/nordic/validate_base_addresses.c +++ b/soc/nordic/validate_base_addresses.c @@ -199,6 +199,8 @@ CHECK_DT_REG(i2c3, NRF_TWIM3); CHECK_DT_REG(i2c20, NRF_TWIM20); CHECK_DT_REG(i2c21, NRF_TWIM21); CHECK_DT_REG(i2c22, NRF_TWIM22); +CHECK_DT_REG(i2c23, NRF_TWIM23); +CHECK_DT_REG(i2c24, NRF_TWIM24); CHECK_DT_REG(i2c30, NRF_TWIM30); CHECK_DT_REG(i2c130, NRF_TWIM130); CHECK_DT_REG(i2c131, NRF_TWIM131); From 6aacec8e810878e82b5395254e0bbf4d4c5f3eb0 Mon Sep 17 00:00:00 2001 From: Adam Kondraciuk Date: Thu, 5 Jun 2025 14:30:23 +0200 Subject: [PATCH 0078/2141] [nrf fromtree] tests: drivers: i2s: Run I2S tests on nRF54H20 Enable test execution on nRF54H20 target. Signed-off-by: Adam Kondraciuk (cherry picked from commit 645fb266701c7c6755f0f829e6de5fb95e62ac95) --- tests/drivers/i2s/i2s_api/testcase.yaml | 13 +++++++++++++ tests/drivers/i2s/i2s_speed/testcase.yaml | 15 +++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/tests/drivers/i2s/i2s_api/testcase.yaml b/tests/drivers/i2s/i2s_api/testcase.yaml index 1932607d6552..5b36b91c8fe7 100644 --- a/tests/drivers/i2s/i2s_api/testcase.yaml +++ b/tests/drivers/i2s/i2s_api/testcase.yaml @@ -10,6 +10,7 @@ tests: - mcx_n9xx_evk/mcxn947/cpu0 - mimxrt595_evk/mimxrt595s/cm33 - mimxrt685_evk/mimxrt685s/cm33 + - nrf54h20dk/nrf54h20/cpuapp drivers.i2s.gpio_loopback: depends_on: - i2s @@ -24,5 +25,17 @@ tests: - mcx_n9xx_evk/mcxn947/cpu0 - mimxrt595_evk/mimxrt595s/cm33 - mimxrt685_evk/mimxrt685s/cm33 + - nrf54h20dk/nrf54h20/cpuapp harness_config: fixture: gpio_loopback + drivers.i2s.gpio_loopback.nrf54h: + depends_on: i2s + tags: + - drivers + - userspace + harness_config: + fixture: i2s_loopback + platform_allow: + - nrf54h20dk/nrf54h20/cpuapp + integration_platforms: + - nrf54h20dk/nrf54h20/cpuapp diff --git a/tests/drivers/i2s/i2s_speed/testcase.yaml b/tests/drivers/i2s/i2s_speed/testcase.yaml index 6bc15a413645..56065f5ef628 100644 --- a/tests/drivers/i2s/i2s_speed/testcase.yaml +++ b/tests/drivers/i2s/i2s_speed/testcase.yaml @@ -5,6 +5,8 @@ tests: - drivers - i2s filter: not CONFIG_I2S_TEST_USE_GPIO_LOOPBACK + platform_exclude: + - nrf54h20dk/nrf54h20/cpuapp drivers.i2s.speed.gpio_loopback: depends_on: - i2s @@ -13,6 +15,8 @@ tests: - drivers - i2s filter: CONFIG_I2S_TEST_USE_GPIO_LOOPBACK + platform_exclude: + - nrf54h20dk/nrf54h20/cpuapp harness: ztest harness_config: fixture: gpio_loopback @@ -29,3 +33,14 @@ tests: fixture: gpio_loopback extra_args: EXTRA_DTC_OVERLAY_FILE="boards/nrf5340dk_nrf5340_cpuapp_aclk.overlay" platform_allow: nrf5340dk/nrf5340/cpuapp + drivers.i2s.speed.gpio_loopback.nrf54h: + depends_on: i2s + tags: + - drivers + - i2s + harness_config: + fixture: i2s_loopback + platform_allow: + - nrf54h20dk/nrf54h20/cpuapp + integration_platforms: + - nrf54h20dk/nrf54h20/cpuapp From 2b67e55872094d6df44748974c5c0928bbe2b68d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Duda?= Date: Tue, 24 Jun 2025 15:34:32 +0200 Subject: [PATCH 0079/2141] [nrf fromtree] net: openthread: Add missing include for logging in diag.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit adds logging.h header to the diag.c file to ensure all symbols are declared. Signed-off-by: Łukasz Duda (cherry picked from commit 2f8a8f72ea2b3149ea484c78c0ee537fde75c1e6) --- modules/openthread/platform/diag.c | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/openthread/platform/diag.c b/modules/openthread/platform/diag.c index 74781cad4a1d..afa09c7e68d5 100644 --- a/modules/openthread/platform/diag.c +++ b/modules/openthread/platform/diag.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include "platform-zephyr.h" From 542b84305fd05720a37f1d323eb75e33f07a2607 Mon Sep 17 00:00:00 2001 From: Markus Lassila Date: Mon, 23 Jun 2025 09:34:57 +0300 Subject: [PATCH 0080/2141] [nrf fromtree] drivers: gpio_nrfx: Free channel when changing mode Fix an issue where calling gpio_pin_interrupt_configure with edge mode and later calling it with level mode, did not release the allocated gpiote channel. Repeating the above sequence caused us to run out of gpiote channels. Signed-off-by: Markus Lassila (cherry picked from commit 581f75656d01f37aec6280326a1924d7d80f2d30) --- drivers/gpio/gpio_nrfx.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/gpio/gpio_nrfx.c b/drivers/gpio/gpio_nrfx.c index 39377d7b7776..b6548ed22d53 100644 --- a/drivers/gpio/gpio_nrfx.c +++ b/drivers/gpio/gpio_nrfx.c @@ -444,6 +444,15 @@ static int gpio_nrfx_pin_interrupt_configure(const struct device *port, } trigger_config.p_in_channel = &ch; + } else { + /* If edge mode with channel was previously used and we are changing to sense or + * level triggered, we must free the channel. + */ + err = nrfx_gpiote_channel_get(&cfg->gpiote, abs_pin, &ch); + if (err == NRFX_SUCCESS) { + err = nrfx_gpiote_channel_free(&cfg->gpiote, ch); + __ASSERT_NO_MSG(err == NRFX_SUCCESS); + } } err = nrfx_gpiote_input_configure(&cfg->gpiote, abs_pin, &input_pin_config); From e9002cf6ad6d7a04662395d55e25b846baa5adbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Fri, 23 May 2025 09:32:58 +0200 Subject: [PATCH 0081/2141] [nrf fromtree] drivers: flash: nrf_qspi_nor: Handle properly multiple XIP users MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add reference counting in nrf_qspi_nor_xip_enable() so that XIP is kept enabled as long as there is at least one user that needs it (boot time enabling done with CONFIG_NORDIC_QSPI_NOR_XIP also counts). Signed-off-by: Andrzej Głąbek (cherry picked from commit 2d9ede38528392974217bae4208595f7cfa24f78) --- drivers/flash/nrf_qspi_nor.c | 65 +++++++++++++++++++++++------------- 1 file changed, 42 insertions(+), 23 deletions(-) diff --git a/drivers/flash/nrf_qspi_nor.c b/drivers/flash/nrf_qspi_nor.c index 12eeb3f4a3e2..34b36b4d7e31 100644 --- a/drivers/flash/nrf_qspi_nor.c +++ b/drivers/flash/nrf_qspi_nor.c @@ -41,7 +41,7 @@ struct qspi_nor_data { */ volatile bool ready; #endif /* CONFIG_MULTITHREADING */ - bool xip_enabled; + uint32_t xip_users; }; struct qspi_nor_config { @@ -313,7 +313,7 @@ static void qspi_acquire(const struct device *dev) qspi_lock(dev); - if (!dev_data->xip_enabled) { + if (dev_data->xip_users == 0) { qspi_clock_div_change(); pm_device_busy_set(dev); @@ -331,7 +331,7 @@ static void qspi_release(const struct device *dev) deactivate = atomic_dec(&dev_data->usage_count) == 1; #endif - if (!dev_data->xip_enabled) { + if (dev_data->xip_users == 0) { qspi_clock_div_restore(); if (deactivate) { @@ -1344,35 +1344,54 @@ static int qspi_nor_pm_action(const struct device *dev, } #endif /* CONFIG_PM_DEVICE */ +static void on_xip_enable(const struct device *dev) +{ +#if NRF_QSPI_HAS_XIPEN + nrf_qspi_xip_set(NRF_QSPI, true); +#endif + (void)nrfx_qspi_activate(false); +} + +static void on_xip_disable(const struct device *dev) +{ + /* It turns out that when the QSPI peripheral is deactivated + * after a XIP transaction, it cannot be later successfully + * reactivated and an attempt to perform another XIP transaction + * results in the CPU being hung; even a debug session cannot be + * started then and the SoC has to be recovered. + * As a workaround, at least until the cause of such behavior + * is fully clarified, perform a simple non-XIP transaction + * (a read of the status register) before deactivating the QSPI. + * This prevents the issue from occurring. + */ + (void)qspi_rdsr(dev, 1); + +#if NRF_QSPI_HAS_XIPEN + nrf_qspi_xip_set(NRF_QSPI, false); +#endif +} + void z_impl_nrf_qspi_nor_xip_enable(const struct device *dev, bool enable) { struct qspi_nor_data *dev_data = dev->data; - if (dev_data->xip_enabled == enable) { - return; - } - qspi_acquire(dev); -#if NRF_QSPI_HAS_XIPEN - nrf_qspi_xip_set(NRF_QSPI, enable); -#endif if (enable) { - (void)nrfx_qspi_activate(false); + if (dev_data->xip_users == 0) { + on_xip_enable(dev); + } + + ++dev_data->xip_users; + } else if (dev_data->xip_users == 0) { + LOG_ERR("Unbalanced XIP disabling"); } else { - /* It turns out that when the QSPI peripheral is deactivated - * after a XIP transaction, it cannot be later successfully - * reactivated and an attempt to perform another XIP transaction - * results in the CPU being hung; even a debug session cannot be - * started then and the SoC has to be recovered. - * As a workaround, at least until the cause of such behavior - * is fully clarified, perform a simple non-XIP transaction - * (a read of the status register) before deactivating the QSPI. - * This prevents the issue from occurring. - */ - (void)qspi_rdsr(dev, 1); + --dev_data->xip_users; + + if (dev_data->xip_users == 0) { + on_xip_disable(dev); + } } - dev_data->xip_enabled = enable; qspi_release(dev); } From f8b7ffa66d60f44a590d0f22da2f65b5117a2917 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Wed, 18 Jun 2025 14:44:19 +0200 Subject: [PATCH 0082/2141] [nrf fromtree] drivers: flash_mspi_nor: Omit quad_enable_set() when QER is set to NONE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the quad-enable-requirements property is set to "NONE" or is not present, no Quad Enable operation should be performed. This fixes an issue with the mx25uw6345g flash chip that is present on the nRF54h20 DK and supports the Single I/O mode, but cannot be used in that mode. Signed-off-by: Andrzej Głąbek (cherry picked from commit 8415f7f7a75111dd85b84743e691799d68659e42) --- drivers/flash/flash_mspi_nor.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/drivers/flash/flash_mspi_nor.c b/drivers/flash/flash_mspi_nor.c index e297b01f5d98..b7ca6341d3ae 100644 --- a/drivers/flash/flash_mspi_nor.c +++ b/drivers/flash/flash_mspi_nor.c @@ -567,15 +567,20 @@ static int default_io_mode(const struct device *dev) enum mspi_io_mode io_mode = dev_config->mspi_nor_cfg.io_mode; int rc = 0; - /* For Quad 1-1-4 and 1-4-4, entering or leaving mode is defined in JEDEC216 BFP DW15 QER */ - if (io_mode == MSPI_IO_MODE_SINGLE) { - rc = quad_enable_set(dev, false); - } else if ((io_mode == MSPI_IO_MODE_QUAD_1_1_4) || (io_mode == MSPI_IO_MODE_QUAD_1_4_4)) { - rc = quad_enable_set(dev, true); - } + if (dev_config->dw15_qer != JESD216_DW15_QER_VAL_NONE) { + /* For Quad 1-1-4 and 1-4-4, entering or leaving mode is defined + * in JEDEC216 BFP DW15 QER + */ + if (io_mode == MSPI_IO_MODE_SINGLE) { + rc = quad_enable_set(dev, false); + } else if (io_mode == MSPI_IO_MODE_QUAD_1_1_4 || + io_mode == MSPI_IO_MODE_QUAD_1_4_4) { + rc = quad_enable_set(dev, true); + } - if (rc < 0) { - LOG_ERR("Failed to modify Quad Enable bit: %d", rc); + if (rc < 0) { + LOG_ERR("Failed to modify Quad Enable bit: %d", rc); + } } if ((dev_config->quirks != NULL) && (dev_config->quirks->post_switch_mode != NULL)) { @@ -646,8 +651,10 @@ static int flash_chip_init(const struct device *dev) /* Some chips reuse RESET pin for data in Quad modes: * force single line mode before resetting. */ - if ((io_mode == MSPI_IO_MODE_SINGLE) || (io_mode == MSPI_IO_MODE_QUAD_1_1_4) || - (io_mode == MSPI_IO_MODE_QUAD_1_4_4)) { + if (dev_config->dw15_qer != JESD216_DW15_QER_VAL_NONE && + (io_mode == MSPI_IO_MODE_SINGLE || + io_mode == MSPI_IO_MODE_QUAD_1_1_4 || + io_mode == MSPI_IO_MODE_QUAD_1_4_4)) { rc = quad_enable_set(dev, false); if (rc < 0) { From 58efe6efd66b05a54b62406ed4ba759f06060938 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Tue, 10 Jun 2025 12:38:06 +0200 Subject: [PATCH 0083/2141] [nrf fromtree] drivers: mspi_dw: Apply a few minor corrections MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - replace %d with %u in two error log message format strings - add checks for maximum supported address length - correct *_WAIT_CYCLES_MAX macros used in XIP handling routines (although their values are valid, they belong to different SSI registers) - remove one unnecessary use of SPI_CTRLR0_WAIT_CYCLES_MASK - remove doubled definitions of the XIP_CTRL register bit fields Signed-off-by: Andrzej Głąbek (cherry picked from commit 8b67b36f4164dd9defbb97c2fb990c629313c0a9) --- drivers/mspi/mspi_dw.c | 21 +++++++++++++++------ drivers/mspi/mspi_dw.h | 15 --------------- 2 files changed, 15 insertions(+), 21 deletions(-) diff --git a/drivers/mspi/mspi_dw.c b/drivers/mspi/mspi_dw.c index 39cf463f4bee..21088ad1bf6c 100644 --- a/drivers/mspi/mspi_dw.c +++ b/drivers/mspi/mspi_dw.c @@ -372,7 +372,7 @@ static bool apply_cmd_length(struct mspi_dw_data *dev_data, uint32_t cmd_length) SPI_CTRLR0_INST_L16); break; default: - LOG_ERR("Command length %d not supported", cmd_length); + LOG_ERR("Command length %u not supported", cmd_length); return false; } @@ -382,6 +382,11 @@ static bool apply_cmd_length(struct mspi_dw_data *dev_data, uint32_t cmd_length) static bool apply_addr_length(struct mspi_dw_data *dev_data, uint32_t addr_length) { + if (addr_length > 4) { + LOG_ERR("Address length %u not supported", addr_length); + return false; + } + dev_data->spi_ctrlr0 |= FIELD_PREP(SPI_CTRLR0_ADDR_L_MASK, addr_length * 2); @@ -493,7 +498,7 @@ static bool apply_xip_cmd_length(const struct mspi_dw_data *dev_data, XIP_WRITE_CTRL_INST_L16); break; default: - LOG_ERR("Command length %d not supported", cmd_length); + LOG_ERR("Command length %u not supported", cmd_length); return false; } @@ -505,6 +510,11 @@ static bool apply_xip_addr_length(const struct mspi_dw_data *dev_data, { uint8_t addr_length = dev_data->xip_params_active.addr_length; + if (addr_length > 4) { + LOG_ERR("Address length %u not supported", addr_length); + return false; + } + ctrl->read |= FIELD_PREP(XIP_CTRL_ADDR_L_MASK, addr_length * 2); ctrl->write |= FIELD_PREP(XIP_WRITE_CTRL_ADDR_L_MASK, addr_length * 2); @@ -970,8 +980,7 @@ static int _api_transceive(const struct device *dev, struct mspi_dw_data *dev_data = dev->data; int rc; - dev_data->spi_ctrlr0 &= ~SPI_CTRLR0_WAIT_CYCLES_MASK - & ~SPI_CTRLR0_INST_L_MASK + dev_data->spi_ctrlr0 &= ~SPI_CTRLR0_INST_L_MASK & ~SPI_CTRLR0_ADDR_L_MASK; if (!apply_cmd_length(dev_data, req->cmd_length) || @@ -1091,8 +1100,8 @@ static int _api_xip_config(const struct device *dev, return -EINVAL; } - if (params->rx_dummy > SPI_CTRLR0_WAIT_CYCLES_MAX || - params->tx_dummy > SPI_CTRLR0_WAIT_CYCLES_MAX) { + if (params->rx_dummy > XIP_CTRL_WAIT_CYCLES_MAX || + params->tx_dummy > XIP_WRITE_CTRL_WAIT_CYCLES_MAX) { LOG_ERR("Unsupported RX (%u) or TX (%u) dummy cycles", params->rx_dummy, params->tx_dummy); return -EINVAL; diff --git a/drivers/mspi/mspi_dw.h b/drivers/mspi/mspi_dw.h index bd81d061e09a..a3c6329bd87d 100644 --- a/drivers/mspi/mspi_dw.h +++ b/drivers/mspi/mspi_dw.h @@ -127,21 +127,6 @@ #define XIP_CTRL_FRF_QUAD 2UL #define XIP_CTRL_FRF_OCTAL 3UL -/* XIP_CTRL - XIP Control Register */ -#define XIP_CTRL_XIP_PREFETCH_EN_BIT BIT(28) -#define XIP_CTRL_XIP_MBL_MASK GENMASK(27, 26) -#define XIP_CTRL_XIP_MBL_2 0UL -#define XIP_CTRL_XIP_MBL_4 1UL -#define XIP_CTRL_XIP_MBL_8 2UL -#define XIP_CTRL_XIP_MBL_16 3UL -#define XIP_CTRL_XIP_HYBERBUS_EN_BIT BIT(24) -#define XIP_CTRL_CONT_XFER_EN_BIT BIT(23) -#define XIP_CTRL_INST_EN_BIT BIT(22) -#define XIP_CTRL_RXDS_EN_BIT BIT(21) -#define XIP_CTRL_INST_DDR_EN_BIT BIT(20) -#define XIP_CTRL_DDR_EN_BIT BIT(19) -#define XIP_CTRL_DFS_HC_BIT BIT(18) - /* XIP_WRITE_CTRL - XIP Write Control Register */ #define XIP_WRITE_CTRL_WAIT_CYCLES_MASK GENMASK(20, 16) #define XIP_WRITE_CTRL_WAIT_CYCLES_MAX BIT_MASK(5) From 2c537a2b6664163e0894dcf14ae83c1e0bb245eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Tue, 10 Jun 2025 12:53:10 +0200 Subject: [PATCH 0084/2141] [nrf fromtree] drivers: mspi_dw: Add waiting for clock in nRF EXMIF specific resume MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After the START task is triggered, the clock that drives the SSI core needs some time to become ready. Before that, writes to SSI registers may be unsuccessful. Add a loop that performs test writes to one of the registers after the EXMIF peripheral is resumed to ensure that it is fully operable. Signed-off-by: Andrzej Głąbek (cherry picked from commit 6ddb616a2341896ddba6a8bcc9bdff9e127360dc) --- drivers/mspi/mspi_dw.c | 3 ++- drivers/mspi/mspi_dw_vendor_specific.h | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/mspi/mspi_dw.c b/drivers/mspi/mspi_dw.c index 21088ad1bf6c..3254458d81d5 100644 --- a/drivers/mspi/mspi_dw.c +++ b/drivers/mspi/mspi_dw.c @@ -16,7 +16,6 @@ #include #include "mspi_dw.h" -#include "mspi_dw_vendor_specific.h" LOG_MODULE_REGISTER(mspi_dw, CONFIG_MSPI_LOG_LEVEL); @@ -116,6 +115,8 @@ DEFINE_MM_REG_WR(xip_write_wrap_inst, 0x144) DEFINE_MM_REG_WR(xip_write_ctrl, 0x148) #endif +#include "mspi_dw_vendor_specific.h" + static void tx_data(const struct device *dev, const struct mspi_xfer_packet *packet) { diff --git a/drivers/mspi/mspi_dw_vendor_specific.h b/drivers/mspi/mspi_dw_vendor_specific.h index 4913e536c92d..e34d8a5db60b 100644 --- a/drivers/mspi/mspi_dw_vendor_specific.h +++ b/drivers/mspi/mspi_dw_vendor_specific.h @@ -33,6 +33,17 @@ static inline void vendor_specific_resume(const struct device *dev) ARG_UNUSED(dev); NRF_EXMIF->TASKS_START = 1; + + /* Try to write an SSI register and wait until the write is successful + * to ensure that the clock that drives the SSI core is ready. + */ + uint32_t rxftlr = read_rxftlr(dev); + uint32_t rxftlr_mod = rxftlr ^ 1; + + do { + write_rxftlr(dev, rxftlr_mod); + rxftlr = read_rxftlr(dev); + } while (rxftlr != rxftlr_mod); } static inline void vendor_specific_irq_clear(const struct device *dev) From 5b212c6e473fb7b2d89d59a7f4db9316111bce93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Tue, 10 Jun 2025 15:04:00 +0200 Subject: [PATCH 0085/2141] [nrf fromtree] drivers: mspi_dw: Improve transfer handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - use separate code paths for TX and RX in ISR - make sending of dummy bytes in the single line mode (Standard SPI) more consistent so it can be easily extended - use value 0 instead of 0xAA for dummy bytes as there is normally no point in making noise one the MOSI line when only receiving data (it can only be useful in debugging transfers) - move all writing of data in the TX FIFO to ISR to avoid broken transfers in the single line mode (where the clock stretching is not available) when the driver is preempted right before it enables interrupts - use the TX FIFO start level also for transfers without data, so that it's not possible that the TX FIFO gets emptied between the writes of command and address fields in the single line mode - add a few comments to explain better how transfers are handled Signed-off-by: Andrzej Głąbek (cherry picked from commit e4dc74452cd77a50128b54c8c0e8c0e324349c5d) --- drivers/mspi/mspi_dw.c | 172 +++++++++++++++++++++++++---------------- 1 file changed, 106 insertions(+), 66 deletions(-) diff --git a/drivers/mspi/mspi_dw.c b/drivers/mspi/mspi_dw.c index 3254458d81d5..7df0cdd8a094 100644 --- a/drivers/mspi/mspi_dw.c +++ b/drivers/mspi/mspi_dw.c @@ -19,8 +19,6 @@ LOG_MODULE_REGISTER(mspi_dw, CONFIG_MSPI_LOG_LEVEL); -#define DUMMY_BYTE 0xAA - #if defined(CONFIG_MSPI_XIP) struct xip_params { uint32_t read_cmd; @@ -151,6 +149,9 @@ static void tx_data(const struct device *dev, write_dr(dev, data); if (buf_pos >= buf_end) { + /* Set the threshold to 0 to get the next interrupt + * when the FIFO is completely emptied. + */ write_txftlr(dev, 0); break; } @@ -164,35 +165,38 @@ static void tx_data(const struct device *dev, dev_data->buf_pos = (uint8_t *)buf_pos; } -static bool make_rx_cycles(const struct device *dev) +static bool tx_dummy_bytes(const struct device *dev) { struct mspi_dw_data *dev_data = dev->data; const struct mspi_dw_config *dev_config = dev->config; + uint8_t fifo_room = dev_config->tx_fifo_depth_minus_1 + 1 + - FIELD_GET(TXFLR_TXTFL_MASK, read_txflr(dev)); uint16_t dummy_bytes = dev_data->dummy_bytes; - /* See tx_data(). */ - uint32_t room = 1; - uint8_t tx_fifo_depth = dev_config->tx_fifo_depth_minus_1 + 1; + const uint8_t dummy_val = 0; - do { - write_dr(dev, DUMMY_BYTE); + if (dummy_bytes > fifo_room) { + dev_data->dummy_bytes = dummy_bytes - fifo_room; - --dummy_bytes; - if (!dummy_bytes) { - dev_data->dummy_bytes = 0; - return true; - } + do { + write_dr(dev, dummy_val); + } while (--fifo_room); - if (--room == 0) { - room = tx_fifo_depth - - FIELD_GET(TXFLR_TXTFL_MASK, read_txflr(dev)); - } - } while (room); + return false; + } - dev_data->dummy_bytes = dummy_bytes; - return false; + do { + write_dr(dev, dummy_val); + } while (--dummy_bytes); + + /* Set the threshold to 0 to get the next interrupt when the FIFO is + * completely emptied. + */ + write_txftlr(dev, 0); + + return true; } -static void read_rx_fifo(const struct device *dev, +static bool read_rx_fifo(const struct device *dev, const struct mspi_xfer_packet *packet) { struct mspi_dw_data *dev_data = dev->data; @@ -223,9 +227,8 @@ static void read_rx_fifo(const struct device *dev, } if (buf_pos >= buf_end) { - dev_data->bytes_to_discard = bytes_to_discard; dev_data->buf_pos = buf_pos; - return; + return true; } } @@ -242,6 +245,7 @@ static void read_rx_fifo(const struct device *dev, dev_data->bytes_to_discard = bytes_to_discard; dev_data->buf_pos = buf_pos; + return false; } static void mspi_dw_isr(const struct device *dev) @@ -249,32 +253,49 @@ static void mspi_dw_isr(const struct device *dev) struct mspi_dw_data *dev_data = dev->data; const struct mspi_xfer_packet *packet = &dev_data->xfer.packets[dev_data->packets_done]; - uint32_t int_status = read_isr(dev); + bool finished = false; - if (int_status & ISR_RXFIS_BIT) { - read_rx_fifo(dev, packet); - } + if (packet->dir == MSPI_TX) { + if (dev_data->buf_pos < dev_data->buf_end) { + tx_data(dev, packet); + } else { + /* It may happen that at this point the controller is + * still shifting out the last frame (the last interrupt + * occurs when the TX FIFO is empty). Wait if it signals + * that it is busy. + */ + while (read_sr(dev) & SR_BUSY_BIT) { + } - if (dev_data->buf_pos >= dev_data->buf_end) { - write_imr(dev, 0); - /* It may happen that at this point the controller is still - * shifting out the last frame (the last interrupt occurs when - * the TX FIFO is empty). Wait if it signals that it is busy. - */ - while (read_sr(dev) & SR_BUSY_BIT) { + finished = true; } - - k_sem_give(&dev_data->finished); } else { - if (int_status & ISR_TXEIS_BIT) { - if (dev_data->dummy_bytes) { - if (make_rx_cycles(dev)) { + uint32_t int_status = read_isr(dev); + + do { + if (int_status & ISR_RXFIS_BIT) { + if (read_rx_fifo(dev, packet)) { + finished = true; + break; + } + + int_status = read_isr(dev); + } + + if (int_status & ISR_TXEIS_BIT) { + if (tx_dummy_bytes(dev)) { write_imr(dev, IMR_RXFIM_BIT); } - } else { - tx_data(dev, packet); + + int_status = read_isr(dev); } - } + } while (int_status); + } + + if (finished) { + write_imr(dev, 0); + + k_sem_give(&dev_data->finished); } vendor_specific_irq_clear(dev); @@ -749,7 +770,6 @@ static int start_next_packet(const struct device *dev, k_timeout_t timeout) (dev_data->xip_enabled != 0), (false)); unsigned int key; - uint8_t tx_fifo_threshold; uint32_t packet_frames; uint32_t imr; int rc = 0; @@ -761,6 +781,7 @@ static int start_next_packet(const struct device *dev, k_timeout_t timeout) } dev_data->dummy_bytes = 0; + dev_data->bytes_to_discard = 0; dev_data->ctrlr0 &= ~CTRLR0_TMOD_MASK & ~CTRLR0_DFS_MASK; @@ -801,7 +822,6 @@ static int start_next_packet(const struct device *dev, k_timeout_t timeout) dev_data->xfer.tx_dummy); write_rxftlr(dev, 0); - tx_fifo_threshold = dev_config->tx_fifo_threshold; } else { uint32_t tmod; uint8_t rx_fifo_threshold; @@ -828,14 +848,12 @@ static int start_next_packet(const struct device *dev, k_timeout_t timeout) imr = IMR_TXEIM_BIT | IMR_RXFIM_BIT; tmod = CTRLR0_TMOD_TX_RX; - tx_fifo_threshold = dev_config->tx_fifo_threshold; /* For standard SPI, only 1-byte frames are used. */ rx_fifo_threshold = MIN(rx_total_bytes - 1, dev_config->rx_fifo_threshold); } else { imr = IMR_RXFIM_BIT; tmod = CTRLR0_TMOD_RX; - tx_fifo_threshold = 0; rx_fifo_threshold = MIN(packet_frames - 1, dev_config->rx_fifo_threshold); } @@ -881,23 +899,49 @@ static int start_next_packet(const struct device *dev, k_timeout_t timeout) dev_data->buf_pos = packet->data_buf; dev_data->buf_end = &packet->data_buf[packet->num_bytes]; - if ((imr & IMR_TXEIM_BIT) && dev_data->buf_pos < dev_data->buf_end) { - uint32_t start_level = tx_fifo_threshold; + /* Set the TX FIFO threshold and its transmit start level. */ + if (packet->num_bytes) { + /* If there is some data to send/receive, set the threshold to + * the value configured for the driver instance and the start + * level to the maximum possible value (it will be updated later + * in tx_fifo() or tx_dummy_bytes() when TX is to be finished). + * This helps avoid a situation when the TX FIFO becomes empty + * before the transfer is complete and the SSI core finishes the + * transaction and deactivates the CE line. This could occur + * right before the data phase in enhanced SPI modes, when the + * clock stretching feature does not work yet, or in Standard + * SPI mode, where the clock stretching is not available at all. + */ + write_txftlr(dev, FIELD_PREP(TXFTLR_TXFTHR_MASK, + dev_config->tx_fifo_depth_minus_1) | + FIELD_PREP(TXFTLR_TFT_MASK, + dev_config->tx_fifo_threshold)); + } else { + uint32_t total_tx_entries = 0; - if (dev_data->dummy_bytes) { - uint32_t tx_total = dev_data->bytes_to_discard - + dev_data->dummy_bytes; + /* It the whole transfer is to contain only the command and/or + * address, set up the transfer to start right after entries + * for those appear in the TX FIFO, and the threshold to 0, + * so that the interrupt occurs when the TX FIFO gets emptied. + */ + if (dev_data->xfer.cmd_length) { + if (dev_data->standard_spi) { + total_tx_entries += dev_data->xfer.cmd_length; + } else { + total_tx_entries += 1; + } + } - if (start_level > tx_total - 1) { - start_level = tx_total - 1; + if (dev_data->xfer.addr_length) { + if (dev_data->standard_spi) { + total_tx_entries += dev_data->xfer.addr_length; + } else { + total_tx_entries += 1; } } - write_txftlr(dev, - FIELD_PREP(TXFTLR_TXFTHR_MASK, start_level) | - FIELD_PREP(TXFTLR_TFT_MASK, tx_fifo_threshold)); - } else { - write_txftlr(dev, 0); + write_txftlr(dev, FIELD_PREP(TXFTLR_TXFTHR_MASK, + total_tx_entries - 1)); } /* Ensure that there will be no interrupt from the controller yet. */ @@ -905,6 +949,10 @@ static int start_next_packet(const struct device *dev, k_timeout_t timeout) /* Enable the controller. This must be done before DR is written. */ write_ssienr(dev, SSIENR_SSIC_EN_BIT); + /* Since the FIFO depth in SSI is always at least 8, it can be safely + * assumed that the command and address fields (max. 2 and 4 bytes, + * respectively) can be written here before the TX FIFO gets filled up. + */ if (dev_data->standard_spi) { if (dev_data->xfer.cmd_length) { tx_control_field(dev, packet->cmd, @@ -925,14 +973,6 @@ static int start_next_packet(const struct device *dev, k_timeout_t timeout) } } - if (dev_data->dummy_bytes) { - if (make_rx_cycles(dev)) { - imr = IMR_RXFIM_BIT; - } - } else if (packet->dir == MSPI_TX && packet->num_bytes) { - tx_data(dev, packet); - } - /* Enable interrupts now and wait until the packet is done. */ write_imr(dev, imr); From c8e872bd549ef01bb9ba3d45e3f0e888365e606c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Tue, 10 Jun 2025 13:13:22 +0200 Subject: [PATCH 0086/2141] [nrf fromtree] drivers: mspi_dw: Add error reporting on RX FIFO overflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Immediately finish an RX transfer when the RX FIFO overflow is encountered and return the -EIO error code, which better indicates the problem than -ETIMEDOUT that was returned previously in such case. Signed-off-by: Andrzej Głąbek (cherry picked from commit 28dafe36e3ae61fd0af3cfd35d4abea430e3e23a) --- drivers/mspi/mspi_dw.c | 12 +++++++++++- drivers/mspi/mspi_dw.h | 13 +++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/drivers/mspi/mspi_dw.c b/drivers/mspi/mspi_dw.c index 7df0cdd8a094..019f613218ee 100644 --- a/drivers/mspi/mspi_dw.c +++ b/drivers/mspi/mspi_dw.c @@ -101,6 +101,7 @@ DEFINE_MM_REG_RD(rxflr, 0x24) DEFINE_MM_REG_RD(sr, 0x28) DEFINE_MM_REG_WR(imr, 0x2c) DEFINE_MM_REG_RD(isr, 0x30) +DEFINE_MM_REG_RD(risr, 0x34) DEFINE_MM_REG_RD_WR(dr, 0x60) DEFINE_MM_REG_WR(spi_ctrlr0, 0xf4) @@ -279,6 +280,11 @@ static void mspi_dw_isr(const struct device *dev) break; } + if (read_risr(dev) & RISR_RXOIR_BIT) { + finished = true; + break; + } + int_status = read_isr(dev); } @@ -977,7 +983,11 @@ static int start_next_packet(const struct device *dev, k_timeout_t timeout) write_imr(dev, imr); rc = k_sem_take(&dev_data->finished, timeout); - if (rc < 0) { + if (read_risr(dev) & RISR_RXOIR_BIT) { + LOG_ERR("RX FIFO overflow occurred"); + rc = -EIO; + } else if (rc < 0) { + LOG_ERR("Transfer timed out"); rc = -ETIMEDOUT; } diff --git a/drivers/mspi/mspi_dw.h b/drivers/mspi/mspi_dw.h index a3c6329bd87d..c35778cb1c59 100644 --- a/drivers/mspi/mspi_dw.h +++ b/drivers/mspi/mspi_dw.h @@ -66,6 +66,19 @@ #define ISR_RXFIS_BIT BIT(4) #define ISR_MSTIS_BIT BIT(5) +/* RISR - Raw Interrupt Status Register */ +#define RISR_TXEIR_BIT BIT(0) +#define RISR_TXOIR_BIT BIT(1) +#define RISR_RXUIR_BIT BIT(2) +#define RISR_RXOIR_BIT BIT(3) +#define RISR_RXFIR_BIT BIT(4) +#define RISR_MSTIR_BIT BIT(5) +#define RISR_XRXOIR_BIT BIT(6) +#define RISR_TXUIR_BIT BIT(7) +#define RISR_AXIER_BIT BIT(8) +#define RISR_SPITER_BIT BIT(10) +#define RISR_DONER_BIT BIT(11) + /* SPI_CTRLR0 - SPI Control Register */ #define SPI_CTRLR0_CLK_STRETCH_EN_BIT BIT(30) #define SPI_CTRLR0_XIP_PREFETCH_EN_BIT BIT(29) From 0b6756bc2976b0e120e0dfee4b4f4a2910e07412 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Tue, 10 Jun 2025 15:04:51 +0200 Subject: [PATCH 0087/2141] [nrf fromtree] drivers: mspi_dw: Add support for RX dummy cycles in single line mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Support for 8 dummy cycles in a single line RX transaction is required for the standard JEDEC Read SFDP command. The SSI controller does not support dummy cycles in Standard SPI mode, but the driver can simulate those by just sending a dummy data byte. Signed-off-by: Andrzej Głąbek (cherry picked from commit e78729609dbdf598fa2f6459a983fd856fc28a8b) --- drivers/mspi/mspi_dw.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/drivers/mspi/mspi_dw.c b/drivers/mspi/mspi_dw.c index 019f613218ee..adc59e765b11 100644 --- a/drivers/mspi/mspi_dw.c +++ b/drivers/mspi/mspi_dw.c @@ -844,13 +844,16 @@ static int start_next_packet(const struct device *dev, k_timeout_t timeout) (dev_data->xfer.cmd_length != 0 || dev_data->xfer.addr_length != 0)) { uint32_t rx_total_bytes; + uint32_t dummy_cycles = dev_data->xfer.rx_dummy; dev_data->bytes_to_discard = dev_data->xfer.cmd_length - + dev_data->xfer.addr_length; + + dev_data->xfer.addr_length + + dummy_cycles / 8; rx_total_bytes = dev_data->bytes_to_discard + packet->num_bytes; - dev_data->dummy_bytes = packet->num_bytes; + dev_data->dummy_bytes = dummy_cycles / 8 + + packet->num_bytes; imr = IMR_TXEIM_BIT | IMR_RXFIM_BIT; tmod = CTRLR0_TMOD_TX_RX; @@ -862,11 +865,13 @@ static int start_next_packet(const struct device *dev, k_timeout_t timeout) tmod = CTRLR0_TMOD_RX; rx_fifo_threshold = MIN(packet_frames - 1, dev_config->rx_fifo_threshold); + + dev_data->spi_ctrlr0 |= + FIELD_PREP(SPI_CTRLR0_WAIT_CYCLES_MASK, + dev_data->xfer.rx_dummy); } dev_data->ctrlr0 |= FIELD_PREP(CTRLR0_TMOD_MASK, tmod); - dev_data->spi_ctrlr0 |= FIELD_PREP(SPI_CTRLR0_WAIT_CYCLES_MASK, - dev_data->xfer.rx_dummy); write_rxftlr(dev, FIELD_PREP(RXFTLR_RFT_MASK, rx_fifo_threshold)); @@ -1039,10 +1044,15 @@ static int _api_transceive(const struct device *dev, return -EINVAL; } - if (dev_data->standard_spi && - (req->rx_dummy != 0 || req->tx_dummy != 0)) { - LOG_ERR("Dummy cycles unsupported in single line mode"); - return -EINVAL; + if (dev_data->standard_spi) { + if (req->tx_dummy) { + LOG_ERR("TX dummy cycles unsupported in single line mode"); + return -EINVAL; + } + if (req->rx_dummy % 8) { + LOG_ERR("Unsupported RX (%u) dummy cycles", req->rx_dummy); + return -EINVAL; + } } else if (req->rx_dummy > SPI_CTRLR0_WAIT_CYCLES_MAX || req->tx_dummy > SPI_CTRLR0_WAIT_CYCLES_MAX) { LOG_ERR("Unsupported RX (%u) or TX (%u) dummy cycles", From 82427548eac12f540c46f00404ed8fcbf622ef8f Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Tue, 10 Jun 2025 23:14:58 +0200 Subject: [PATCH 0088/2141] [nrf fromtree] clock_control: nrf: fix nrf_clock_control_get_startup_time desc Fix the description of nrf_clock_control_get_startup_time which was missing documentation of the spec param and had a spelling mistake in it. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit 73773abb4a5b9c603c0690837586590516a305e9) --- include/zephyr/drivers/clock_control/nrf_clock_control.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/zephyr/drivers/clock_control/nrf_clock_control.h b/include/zephyr/drivers/clock_control/nrf_clock_control.h index d12dca3c074f..7ef524dd4dc9 100644 --- a/include/zephyr/drivers/clock_control/nrf_clock_control.h +++ b/include/zephyr/drivers/clock_control/nrf_clock_control.h @@ -355,9 +355,10 @@ static inline int nrf_clock_control_resolve(const struct device *dev, } /** - * @brief Get the startup timme of a clock. + * @brief Get the startup time of a clock. * * @param dev Device structure. + * @param spec Clock specification to get startup time for. * @param startup_time_us Destination for startup time in microseconds. * * @retval Successful if successful. From ac70df046a1e7004f4482dce95c3bf0ac4dc0b19 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Fri, 6 Jun 2025 12:17:06 +0200 Subject: [PATCH 0089/2141] [nrf fromtree] drivers: clock_control: nrf2: align with hw binding names Currently there is a mismatch between the naming of the hardware and the drivers targetting the hardware. nrf2_ is used instead of the actual bindings names, like nrf2_audiopll instead of nrfs_audiopll. This makes it hard to map drivers to the hardware they are targetting. There is historical reason for some of this, namely the same binding name was used for different hardware, which is why nrf2_ was used on newer platforms. This is no longer the case though, so drivers and configs can be named according to the hardware without conflict. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit 979a5652890687d6ba1fe0408a3cfb3db8760f70) --- drivers/audio/dmic_nrfx_pdm.c | 8 ++++---- drivers/clock_control/CMakeLists.txt | 12 +++++------ drivers/clock_control/Kconfig.nrf | 20 +++++++++---------- ...rf2_hfxo.c => clock_control_nrf54h_hfxo.c} | 0 ...f2_fll16m.c => clock_control_nrf_fll16m.c} | 0 ...fll.c => clock_control_nrf_hsfll_global.c} | 6 +++--- ...sfll.c => clock_control_nrf_hsfll_local.c} | 4 ++-- ...nrf2_lfclk.c => clock_control_nrf_lfclk.c} | 2 +- ...diopll.c => clock_control_nrfs_audiopll.c} | 0 drivers/counter/counter_nrfx_timer.c | 2 +- drivers/i2s/i2s_nrf_tdm.c | 4 ++-- drivers/pwm/pwm_nrfx.c | 8 ++++---- drivers/serial/uart_nrfx_uarte.c | 2 +- drivers/spi/spi_nrfx_spim.c | 8 ++++---- .../boards/nordic/clock_control/sample.yaml | 2 +- 15 files changed, 39 insertions(+), 39 deletions(-) rename drivers/clock_control/{clock_control_nrf2_hfxo.c => clock_control_nrf54h_hfxo.c} (100%) rename drivers/clock_control/{clock_control_nrf2_fll16m.c => clock_control_nrf_fll16m.c} (100%) rename drivers/clock_control/{clock_control_nrf2_global_hsfll.c => clock_control_nrf_hsfll_global.c} (98%) rename drivers/clock_control/{clock_control_nrf2_hsfll.c => clock_control_nrf_hsfll_local.c} (97%) rename drivers/clock_control/{clock_control_nrf2_lfclk.c => clock_control_nrf_lfclk.c} (99%) rename drivers/clock_control/{clock_control_nrf2_audiopll.c => clock_control_nrfs_audiopll.c} (100%) diff --git a/drivers/audio/dmic_nrfx_pdm.c b/drivers/audio/dmic_nrfx_pdm.c index 2e8d71b0a93c..b2fcb7abb868 100644 --- a/drivers/audio/dmic_nrfx_pdm.c +++ b/drivers/audio/dmic_nrfx_pdm.c @@ -30,7 +30,7 @@ struct dmic_nrfx_pdm_drv_data { const nrfx_pdm_t *pdm; #if CONFIG_CLOCK_CONTROL_NRF struct onoff_manager *clk_mgr; -#elif CONFIG_CLOCK_CONTROL_NRF2_AUDIOPLL +#elif CONFIG_CLOCK_CONTROL_NRFS_AUDIOPLL const struct device *audiopll_dev; #endif struct onoff_client clk_cli; @@ -75,7 +75,7 @@ static int request_clock(struct dmic_nrfx_pdm_drv_data *drv_data) } #if CONFIG_CLOCK_CONTROL_NRF return onoff_request(drv_data->clk_mgr, &drv_data->clk_cli); -#elif CONFIG_CLOCK_CONTROL_NRF2_AUDIOPLL +#elif CONFIG_CLOCK_CONTROL_NRFS_AUDIOPLL return nrf_clock_control_request(drv_data->audiopll_dev, NULL, &drv_data->clk_cli); #else return -ENOTSUP; @@ -90,7 +90,7 @@ static int release_clock(struct dmic_nrfx_pdm_drv_data *drv_data) #if CONFIG_CLOCK_CONTROL_NRF return onoff_release(drv_data->clk_mgr); -#elif CONFIG_CLOCK_CONTROL_NRF2_AUDIOPLL +#elif CONFIG_CLOCK_CONTROL_NRFS_AUDIOPLL return nrf_clock_control_release(drv_data->audiopll_dev, NULL); #else return -ENOTSUP; @@ -673,7 +673,7 @@ static void init_clock_manager(const struct device *dev) drv_data->clk_mgr = z_nrf_clock_control_get_onoff(subsys); __ASSERT_NO_MSG(drv_data->clk_mgr != NULL); -#elif CONFIG_CLOCK_CONTROL_NRF2_AUDIOPLL +#elif CONFIG_CLOCK_CONTROL_NRFS_AUDIOPLL struct dmic_nrfx_pdm_drv_data *drv_data = dev->data; drv_data->audiopll_dev = DEVICE_DT_GET(DT_NODELABEL(audiopll)); diff --git a/drivers/clock_control/CMakeLists.txt b/drivers/clock_control/CMakeLists.txt index 886c92b63578..bc70784ebecd 100644 --- a/drivers/clock_control/CMakeLists.txt +++ b/drivers/clock_control/CMakeLists.txt @@ -45,17 +45,17 @@ zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_RENESAS_RZ_CPG clock_cont zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_AMBIQ clock_control_ambiq.c) zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_PWM clock_control_pwm.c) zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_RPI_PICO clock_control_rpi_pico.c) -zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF2_GLOBAL_HSFLL clock_control_nrf2_global_hsfll.c) +zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF_HSFLL_GLOBAL clock_control_nrf_hsfll_global.c) zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_RTS5912_SCCON clock_control_rts5912_sccon.c) -zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF2_AUDIOPLL clock_control_nrf2_audiopll.c) +zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRFS_AUDIOPLL clock_control_nrfs_audiopll.c) zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_IT51XXX clock_control_it51xxx.c) if(CONFIG_CLOCK_CONTROL_NRF2) zephyr_library_sources(clock_control_nrf2_common.c) - zephyr_library_sources(clock_control_nrf2_fll16m.c) - zephyr_library_sources(clock_control_nrf2_hfxo.c) - zephyr_library_sources(clock_control_nrf2_hsfll.c) - zephyr_library_sources(clock_control_nrf2_lfclk.c) + zephyr_library_sources(clock_control_nrf_fll16m.c) + zephyr_library_sources(clock_control_nrf54h_hfxo.c) + zephyr_library_sources(clock_control_nrf_hsfll_local.c) + zephyr_library_sources(clock_control_nrf_lfclk.c) endif() if(CONFIG_CLOCK_CONTROL_RENESAS_RZA2M_CPG) diff --git a/drivers/clock_control/Kconfig.nrf b/drivers/clock_control/Kconfig.nrf index 07ee365603b6..a1b61e941a46 100644 --- a/drivers/clock_control/Kconfig.nrf +++ b/drivers/clock_control/Kconfig.nrf @@ -212,32 +212,32 @@ config CLOCK_CONTROL_NRF2 if CLOCK_CONTROL_NRF2 -config CLOCK_CONTROL_NRF2_HSFLL_REQ_LOW_FREQ +config CLOCK_CONTROL_NRF_HSFLL_LOCAL_REQ_LOW_FREQ bool "Local domain scale down after init" default y if NRFS_DVFS_LOCAL_DOMAIN help Request the lowest operating point after DVFS initialization. -config CLOCK_CONTROL_NRF2_NRFS_DVFS_TIMEOUT_MS +config CLOCK_CONTROL_NRF_HSFLL_LOCAL_NRFS_DVFS_TIMEOUT_MS int "Timeout waiting for nrfs dvfs service callback in milliseconds" default 2000 -config CLOCK_CONTROL_NRF2_NRFS_CLOCK_TIMEOUT_MS +config CLOCK_CONTROL_NRF_LFCLK_CLOCK_TIMEOUT_MS int "Timeout waiting for nrfs clock service callback in milliseconds" default 1000 -config CLOCK_CONTROL_NRF2_GLOBAL_HSFLL +config CLOCK_CONTROL_NRF_HSFLL_GLOBAL bool "Clock control for global HSFLL" depends on NRFS_GDFS_SERVICE_ENABLED default y -if CLOCK_CONTROL_NRF2_GLOBAL_HSFLL +if CLOCK_CONTROL_NRF_HSFLL_GLOBAL -config CLOCK_CONTROL_NRF2_GLOBAL_HSFLL_TIMEOUT_MS +config CLOCK_CONTROL_NRF_HSFLL_GLOBAL_TIMEOUT_MS int "Frequency request timeout in milliseconds" default 10000 -config CLOCK_CONTROL_NRF2_GLOBAL_HSFLL_REQ_LOW_FREQ +config CLOCK_CONTROL_NRF_HSFLL_GLOBAL_REQ_LOW_FREQ bool "Request LOW frequency on init" default y help @@ -251,15 +251,15 @@ config CLOCK_CONTROL_NRF2_GLOBAL_HSFLL_REQ_LOW_FREQ unnecessary HIGH -> LOW -> HIGH cycle given some module will request a HIGH frequency on init anyway. -config CLOCK_CONTROL_NRF2_GLOBAL_HSFLL_INIT_PRIORITY +config CLOCK_CONTROL_NRF_HSFLL_GLOBAL_INIT_PRIORITY int "Init priority of global HSFLL device driver" default 52 help Must be higher than NRFS backend -endif # CLOCK_CONTROL_NRF2_GLOBAL_HSFLL +endif # CLOCK_CONTROL_NRF_HSFLL_GLOBAL -config CLOCK_CONTROL_NRF2_AUDIOPLL +config CLOCK_CONTROL_NRFS_AUDIOPLL bool "NRFS AudioPLL driver support" depends on DT_HAS_NORDIC_NRFS_AUDIOPLL_ENABLED depends on NRFS_AUDIOPLL_SERVICE_ENABLED diff --git a/drivers/clock_control/clock_control_nrf2_hfxo.c b/drivers/clock_control/clock_control_nrf54h_hfxo.c similarity index 100% rename from drivers/clock_control/clock_control_nrf2_hfxo.c rename to drivers/clock_control/clock_control_nrf54h_hfxo.c diff --git a/drivers/clock_control/clock_control_nrf2_fll16m.c b/drivers/clock_control/clock_control_nrf_fll16m.c similarity index 100% rename from drivers/clock_control/clock_control_nrf2_fll16m.c rename to drivers/clock_control/clock_control_nrf_fll16m.c diff --git a/drivers/clock_control/clock_control_nrf2_global_hsfll.c b/drivers/clock_control/clock_control_nrf_hsfll_global.c similarity index 98% rename from drivers/clock_control/clock_control_nrf2_global_hsfll.c rename to drivers/clock_control/clock_control_nrf_hsfll_global.c index 30a64ea9fdc2..605b788b5399 100644 --- a/drivers/clock_control/clock_control_nrf2_global_hsfll.c +++ b/drivers/clock_control/clock_control_nrf_hsfll_global.c @@ -23,10 +23,10 @@ LOG_MODULE_DECLARE(clock_control_nrf2, CONFIG_CLOCK_CONTROL_LOG_LEVEL); DT_INST_PROP_LEN(0, supported_clock_frequencies) #define GLOBAL_HSFLL_FREQ_REQ_TIMEOUT \ - K_MSEC(CONFIG_CLOCK_CONTROL_NRF2_GLOBAL_HSFLL_TIMEOUT_MS) + K_MSEC(CONFIG_CLOCK_CONTROL_NRF_HSFLL_GLOBAL_TIMEOUT_MS) #define GLOBAL_HSFLL_INIT_LOW_REQ \ - CONFIG_CLOCK_CONTROL_NRF2_GLOBAL_HSFLL_REQ_LOW_FREQ + CONFIG_CLOCK_CONTROL_NRF_HSFLL_GLOBAL_REQ_LOW_FREQ BUILD_ASSERT(GLOBAL_HSFLL_CLOCK_FREQUENCIES_SIZE == 4); BUILD_ASSERT(GLOBAL_HSFLL_CLOCK_FREQUENCIES_IDX(0) == 64000000); @@ -339,6 +339,6 @@ DEVICE_DT_INST_DEFINE( &driver_data, &driver_config, POST_KERNEL, - CONFIG_CLOCK_CONTROL_NRF2_GLOBAL_HSFLL_INIT_PRIORITY, + CONFIG_CLOCK_CONTROL_NRF_HSFLL_GLOBAL_INIT_PRIORITY, &driver_api ); diff --git a/drivers/clock_control/clock_control_nrf2_hsfll.c b/drivers/clock_control/clock_control_nrf_hsfll_local.c similarity index 97% rename from drivers/clock_control/clock_control_nrf2_hsfll.c rename to drivers/clock_control/clock_control_nrf_hsfll_local.c index e8f8449b24d0..ab2cab3b9203 100644 --- a/drivers/clock_control/clock_control_nrf2_hsfll.c +++ b/drivers/clock_control/clock_control_nrf_hsfll_local.c @@ -25,7 +25,7 @@ BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) == 1, #define HSFLL_FREQ_MEDLOW MHZ(128) #define HSFLL_FREQ_HIGH MHZ(320) -#define NRFS_DVFS_TIMEOUT K_MSEC(CONFIG_CLOCK_CONTROL_NRF2_NRFS_DVFS_TIMEOUT_MS) +#define NRFS_DVFS_TIMEOUT K_MSEC(CONFIG_CLOCK_CONTROL_NRF_HSFLL_LOCAL_NRFS_DVFS_TIMEOUT_MS) /* Clock options sorted from lowest to highest frequency */ static const struct clock_options { @@ -262,7 +262,7 @@ static struct hsfll_dev_data hsfll_data; #ifdef CONFIG_CLOCK_CONTROL_NRF2_HSFLL_REQ_LOW_FREQ static int dvfs_low_init(void) { - static const k_timeout_t timeout = K_MSEC(CONFIG_CLOCK_CONTROL_NRF2_NRFS_DVFS_TIMEOUT_MS); + static const k_timeout_t timeout = NRFS_DVFS_TIMEOUT; static const struct device *hsfll_dev = DEVICE_DT_GET(DT_CLOCKS_CTLR(DT_NODELABEL(cpu))); static const struct nrf_clock_spec clk_spec = { .frequency = HSFLL_FREQ_LOW diff --git a/drivers/clock_control/clock_control_nrf2_lfclk.c b/drivers/clock_control/clock_control_nrf_lfclk.c similarity index 99% rename from drivers/clock_control/clock_control_nrf2_lfclk.c rename to drivers/clock_control/clock_control_nrf_lfclk.c index 6be9deee6576..fcdb8bd573bc 100644 --- a/drivers/clock_control/clock_control_nrf2_lfclk.c +++ b/drivers/clock_control/clock_control_nrf_lfclk.c @@ -28,7 +28,7 @@ BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) == 1, #define LFCLK_MAX_OPTS 5 #define LFCLK_DEF_OPTS 3 -#define NRFS_CLOCK_TIMEOUT K_MSEC(CONFIG_CLOCK_CONTROL_NRF2_NRFS_CLOCK_TIMEOUT_MS) +#define NRFS_CLOCK_TIMEOUT K_MSEC(CONFIG_CLOCK_CONTROL_NRF_LFCLK_CLOCK_TIMEOUT_MS) #define BICR (NRF_BICR_Type *)DT_REG_ADDR(DT_NODELABEL(bicr)) diff --git a/drivers/clock_control/clock_control_nrf2_audiopll.c b/drivers/clock_control/clock_control_nrfs_audiopll.c similarity index 100% rename from drivers/clock_control/clock_control_nrf2_audiopll.c rename to drivers/clock_control/clock_control_nrfs_audiopll.c diff --git a/drivers/counter/counter_nrfx_timer.c b/drivers/counter/counter_nrfx_timer.c index 52e525717a9b..71f7f7edd331 100644 --- a/drivers/counter/counter_nrfx_timer.c +++ b/drivers/counter/counter_nrfx_timer.c @@ -481,7 +481,7 @@ static DEVICE_API(counter, counter_nrfx_driver_api) = { */ #define TIMER_INIT_PRIO(idx) \ COND_CODE_1(INSTANCE_IS_FAST(idx), \ - (UTIL_INC(CONFIG_CLOCK_CONTROL_NRF2_GLOBAL_HSFLL_INIT_PRIORITY)), \ + (UTIL_INC(CONFIG_CLOCK_CONTROL_NRF_HSFLL_GLOBAL_INIT_PRIORITY)), \ (CONFIG_COUNTER_INIT_PRIORITY)) /* diff --git a/drivers/i2s/i2s_nrf_tdm.c b/drivers/i2s/i2s_nrf_tdm.c index f61c5c8849b1..f8fa4773d37e 100644 --- a/drivers/i2s/i2s_nrf_tdm.c +++ b/drivers/i2s/i2s_nrf_tdm.c @@ -127,7 +127,7 @@ static int audio_clock_request(struct tdm_drv_data *drv_data) { #if DT_NODE_HAS_STATUS_OKAY(NODE_ACLK) && CONFIG_CLOCK_CONTROL_NRF return onoff_request(drv_data->clk_mgr, &drv_data->clk_cli); -#elif DT_NODE_HAS_STATUS_OKAY(NODE_ACLK) && CONFIG_CLOCK_CONTROL_NRF2_AUDIOPLL +#elif DT_NODE_HAS_STATUS_OKAY(NODE_ACLK) && CONFIG_CLOCK_CONTROL_NRFS_AUDIOPLL return nrf_clock_control_request(audiopll, &aclk_spec, &drv_data->clk_cli); #else (void)drv_data; @@ -140,7 +140,7 @@ static int audio_clock_release(struct tdm_drv_data *drv_data) { #if DT_NODE_HAS_STATUS_OKAY(NODE_ACLK) && CONFIG_CLOCK_CONTROL_NRF return onoff_release(drv_data->clk_mgr); -#elif DT_NODE_HAS_STATUS_OKAY(NODE_ACLK) && CONFIG_CLOCK_CONTROL_NRF2_AUDIOPLL +#elif DT_NODE_HAS_STATUS_OKAY(NODE_ACLK) && CONFIG_CLOCK_CONTROL_NRFS_AUDIOPLL (void)drv_data; return nrf_clock_control_release(audiopll, &aclk_spec); diff --git a/drivers/pwm/pwm_nrfx.c b/drivers/pwm/pwm_nrfx.c index bab8b0f003e7..ec55bef69604 100644 --- a/drivers/pwm/pwm_nrfx.c +++ b/drivers/pwm/pwm_nrfx.c @@ -55,7 +55,7 @@ LOG_MODULE_REGISTER(pwm_nrfx, CONFIG_PWM_LOG_LEVEL); BUILD_ASSERT(!IS_ENABLED(CONFIG_PM_DEVICE_SYSTEM_MANAGED)); #endif -#if defined(PWM_NRFX_FAST_PRESENT) && CONFIG_CLOCK_CONTROL_NRF2_GLOBAL_HSFLL +#if defined(PWM_NRFX_FAST_PRESENT) && CONFIG_CLOCK_CONTROL_NRF_HSFLL_GLOBAL #define PWM_NRFX_USE_CLOCK_CONTROL 1 #endif @@ -493,11 +493,11 @@ static int pwm_nrfx_init(const struct device *dev) * must be initialized after that controller driver, hence the default PWM * initialization priority may be too early for them. */ -#if defined(CONFIG_CLOCK_CONTROL_NRF2_GLOBAL_HSFLL_INIT_PRIORITY) && \ - CONFIG_PWM_INIT_PRIORITY < CONFIG_CLOCK_CONTROL_NRF2_GLOBAL_HSFLL_INIT_PRIORITY +#if defined(CONFIG_CLOCK_CONTROL_NRF_HSFLL_GLOBAL_INIT_PRIORITY) && \ + CONFIG_PWM_INIT_PRIORITY < CONFIG_CLOCK_CONTROL_NRF_HSFLL_GLOBAL_INIT_PRIORITY #define PWM_INIT_PRIORITY(idx) \ COND_CODE_1(PWM_NRFX_IS_FAST(_, /*empty*/, idx, _), \ - (UTIL_INC(CONFIG_CLOCK_CONTROL_NRF2_GLOBAL_HSFLL_INIT_PRIORITY)), \ + (UTIL_INC(CONFIG_CLOCK_CONTROL_NRF_HSFLL_GLOBAL_INIT_PRIORITY)), \ (CONFIG_PWM_INIT_PRIORITY)) #else #define PWM_INIT_PRIORITY(idx) CONFIG_PWM_INIT_PRIORITY diff --git a/drivers/serial/uart_nrfx_uarte.c b/drivers/serial/uart_nrfx_uarte.c index 55aea85f3d39..80e296cc51d2 100644 --- a/drivers/serial/uart_nrfx_uarte.c +++ b/drivers/serial/uart_nrfx_uarte.c @@ -2587,7 +2587,7 @@ static int uarte_instance_init(const struct device *dev, */ #define UARTE_INIT_PRIO(idx) \ COND_CODE_1(INSTANCE_IS_FAST_PD(_, /*empty*/, idx, _), \ - (UTIL_INC(CONFIG_CLOCK_CONTROL_NRF2_GLOBAL_HSFLL_INIT_PRIORITY)), \ + (UTIL_INC(CONFIG_CLOCK_CONTROL_NRF_HSFLL_GLOBAL_INIT_PRIORITY)), \ (CONFIG_SERIAL_INIT_PRIORITY)) /* Macro for setting nRF specific configuration structures. */ diff --git a/drivers/spi/spi_nrfx_spim.c b/drivers/spi/spi_nrfx_spim.c index dcfee1c5ede2..c77e256a7fed 100644 --- a/drivers/spi/spi_nrfx_spim.c +++ b/drivers/spi/spi_nrfx_spim.c @@ -43,7 +43,7 @@ LOG_MODULE_REGISTER(spi_nrfx_spim, CONFIG_SPI_LOG_LEVEL); #define SPI_BUFFER_IN_RAM 1 #endif -#if defined(CONFIG_CLOCK_CONTROL_NRF2_GLOBAL_HSFLL) +#if defined(CONFIG_CLOCK_CONTROL_NRF_HSFLL_GLOBAL) #define SPIM_REQUESTS_CLOCK(node) \ DT_NODE_HAS_COMPAT(DT_CLOCKS_CTLR(node), nordic_nrf_hsfll_global) #define SPIM_REQUESTS_CLOCK_OR(node) SPIM_REQUESTS_CLOCK(node) || @@ -796,11 +796,11 @@ static int spi_nrfx_init(const struct device *dev) * must be initialized after that controller driver, hence the default SPI * initialization priority may be too early for them. */ -#if defined(CONFIG_CLOCK_CONTROL_NRF2_GLOBAL_HSFLL_INIT_PRIORITY) && \ - CONFIG_SPI_INIT_PRIORITY < CONFIG_CLOCK_CONTROL_NRF2_GLOBAL_HSFLL_INIT_PRIORITY +#if defined(CONFIG_CLOCK_CONTROL_NRF_HSFLL_GLOBAL_INIT_PRIORITY) && \ + CONFIG_SPI_INIT_PRIORITY < CONFIG_CLOCK_CONTROL_NRF_HSFLL_GLOBAL_INIT_PRIORITY #define SPIM_INIT_PRIORITY(idx) \ COND_CODE_1(SPIM_REQUESTS_CLOCK(SPIM(idx)), \ - (UTIL_INC(CONFIG_CLOCK_CONTROL_NRF2_GLOBAL_HSFLL_INIT_PRIORITY)), \ + (UTIL_INC(CONFIG_CLOCK_CONTROL_NRF_HSFLL_GLOBAL_INIT_PRIORITY)), \ (CONFIG_SPI_INIT_PRIORITY)) #else #define SPIM_INIT_PRIORITY(idx) CONFIG_SPI_INIT_PRIORITY diff --git a/samples/boards/nordic/clock_control/sample.yaml b/samples/boards/nordic/clock_control/sample.yaml index ee63e7c518ed..6e455d29ebc0 100644 --- a/samples/boards/nordic/clock_control/sample.yaml +++ b/samples/boards/nordic/clock_control/sample.yaml @@ -37,7 +37,7 @@ tests: sample.boards.nrf.clock_control.global_hsfll.req_low_freq_n: filter: dt_nodelabel_enabled("hsfll120") extra_configs: - - CONFIG_CLOCK_CONTROL_NRF2_GLOBAL_HSFLL_REQ_LOW_FREQ=n + - CONFIG_CLOCK_CONTROL_NRF_HSFLL_GLOBAL_REQ_LOW_FREQ=n extra_args: - CONF_FILE="configs/global_hsfll.conf" - DTC_OVERLAY_FILE="configs/global_hsfll.overlay" From 1b2f57c6d8db7a638012805108681ae949cb3752 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Fri, 6 Jun 2025 12:43:00 +0200 Subject: [PATCH 0090/2141] [nrf fromtree] drivers: clock_control: nrf2: split configs per driver Currently the config CLOCK_CONTROL_NRF2 is used as a GLOB style config which includes all "NRF2" drivers and related configs. With NRF2, clocks are treated as individidual devices with individual device drivers. This commit split the CLOCK_CONTROL_NRF2 config into device specific configs and ifdefs. With this, drivers are selected individually based on devicetree state as is common for most devices drivers, and dependencies like NRFS and specific NRFS services are selected by the specific driver which nees it. Checks for CLOCK_CONTROL_NRF2 are updated to check for existance of the clocks instead. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit 8a27773247ac02d0db51cc0f34edc0fc513f505d) --- drivers/clock_control/CMakeLists.txt | 13 ++- drivers/clock_control/Kconfig.nrf | 83 +++++++++++++------ .../clock_control_nrf_hsfll_local.c | 2 +- .../drivers/clock_control/nrf_clock_control.h | 5 -- .../platform/nrf_802154_clock_zephyr.c | 3 +- 5 files changed, 65 insertions(+), 41 deletions(-) diff --git a/drivers/clock_control/CMakeLists.txt b/drivers/clock_control/CMakeLists.txt index bc70784ebecd..b1dbe1911975 100644 --- a/drivers/clock_control/CMakeLists.txt +++ b/drivers/clock_control/CMakeLists.txt @@ -49,14 +49,11 @@ zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF_HSFLL_GLOBAL clock_cont zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_RTS5912_SCCON clock_control_rts5912_sccon.c) zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRFS_AUDIOPLL clock_control_nrfs_audiopll.c) zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_IT51XXX clock_control_it51xxx.c) - -if(CONFIG_CLOCK_CONTROL_NRF2) - zephyr_library_sources(clock_control_nrf2_common.c) - zephyr_library_sources(clock_control_nrf_fll16m.c) - zephyr_library_sources(clock_control_nrf54h_hfxo.c) - zephyr_library_sources(clock_control_nrf_hsfll_local.c) - zephyr_library_sources(clock_control_nrf_lfclk.c) -endif() +zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF2_COMMON clock_control_nrf2_common.c) +zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF_FLL16M clock_control_nrf_fll16m.c) +zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF54H_HFXO clock_control_nrf54h_hfxo.c) +zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF_HSFLL_LOCAL clock_control_nrf_hsfll_local.c) +zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF_LFCLK clock_control_nrf_lfclk.c) if(CONFIG_CLOCK_CONTROL_RENESAS_RZA2M_CPG) zephyr_library_sources(clock_control_renesas_rza2m_cpg.c) diff --git a/drivers/clock_control/Kconfig.nrf b/drivers/clock_control/Kconfig.nrf index a1b61e941a46..bbd4a86f5a9b 100644 --- a/drivers/clock_control/Kconfig.nrf +++ b/drivers/clock_control/Kconfig.nrf @@ -201,34 +201,16 @@ config CLOCK_CONTROL_NRF_ACCURACY endif # CLOCK_CONTROL_NRF -config CLOCK_CONTROL_NRF2 - bool "nRF clock control support" - default y - depends on SOC_SERIES_NRF54HX && !RISCV_CORE_NORDIC_VPR +config CLOCK_CONTROL_NRF2_COMMON + bool "NRF2 clock control common framework" select ONOFF - select NRFS if HAS_NRFS - help - Support for nRF clock control devices. - -if CLOCK_CONTROL_NRF2 - -config CLOCK_CONTROL_NRF_HSFLL_LOCAL_REQ_LOW_FREQ - bool "Local domain scale down after init" - default y if NRFS_DVFS_LOCAL_DOMAIN - help - Request the lowest operating point after DVFS initialization. - -config CLOCK_CONTROL_NRF_HSFLL_LOCAL_NRFS_DVFS_TIMEOUT_MS - int "Timeout waiting for nrfs dvfs service callback in milliseconds" - default 2000 - -config CLOCK_CONTROL_NRF_LFCLK_CLOCK_TIMEOUT_MS - int "Timeout waiting for nrfs clock service callback in milliseconds" - default 1000 config CLOCK_CONTROL_NRF_HSFLL_GLOBAL bool "Clock control for global HSFLL" - depends on NRFS_GDFS_SERVICE_ENABLED + depends on DT_HAS_NORDIC_NRF_HSFLL_GLOBAL_ENABLED + select NRFS + select NRFS_GDFS_SERVICE_ENABLED + select CLOCK_CONTROL_NRF2_COMMON default y if CLOCK_CONTROL_NRF_HSFLL_GLOBAL @@ -262,7 +244,56 @@ endif # CLOCK_CONTROL_NRF_HSFLL_GLOBAL config CLOCK_CONTROL_NRFS_AUDIOPLL bool "NRFS AudioPLL driver support" depends on DT_HAS_NORDIC_NRFS_AUDIOPLL_ENABLED - depends on NRFS_AUDIOPLL_SERVICE_ENABLED + select NRFS + select NRFS_AUDIOPLL_SERVICE_ENABLED + select CLOCK_CONTROL_NRF2_COMMON + default y + +config CLOCK_CONTROL_NRF_FLL16M + bool "NRF FLL16M driver support" + depends on DT_HAS_NORDIC_NRF_FLL16M_ENABLED + select CLOCK_CONTROL_NRF2_COMMON + default y + +config CLOCK_CONTROL_NRF54H_HFXO + bool "NRF54H HFXO driver support" + depends on DT_HAS_NORDIC_NRF54H_HFXO_ENABLED + select CLOCK_CONTROL_NRF2_COMMON default y -endif # CLOCK_CONTROL_NRF2 +config CLOCK_CONTROL_NRF_HSFLL_LOCAL + bool "NRF HSFLL LOCAL driver support" + depends on DT_HAS_NORDIC_NRF_HSFLL_LOCAL_ENABLED + select NRFS + select NRFS_DVFS_LOCAL_DOMAIN + select CLOCK_CONTROL_NRF2_COMMON + default y + +if CLOCK_CONTROL_NRF_HSFLL_LOCAL + +config CLOCK_CONTROL_NRF_HSFLL_LOCAL_REQ_LOW_FREQ + bool "Local domain scale down after init" + help + Request the lowest operating point after DVFS initialization. + +config CLOCK_CONTROL_NRF_HSFLL_LOCAL_NRFS_DVFS_TIMEOUT_MS + int "Timeout waiting for nrfs dvfs service callback in milliseconds" + default 2000 + +endif # CLOCK_CONTROL_NRF_HSFLL_LOCAL + +config CLOCK_CONTROL_NRF_LFCLK + bool "NRF LFCLK driver support" + depends on DT_HAS_NORDIC_NRF_LFCLK_ENABLED + select NRFS + select NRFS_CLOCK_SERVICE_ENABLED + select CLOCK_CONTROL_NRF2_COMMON + default y + +if CLOCK_CONTROL_NRF_LFCLK + +config CLOCK_CONTROL_NRF_LFCLK_CLOCK_TIMEOUT_MS + int "Timeout waiting for nrfs clock service callback in milliseconds" + default 1000 + +endif # CLOCK_CONTROL_NRF_LFCLK diff --git a/drivers/clock_control/clock_control_nrf_hsfll_local.c b/drivers/clock_control/clock_control_nrf_hsfll_local.c index ab2cab3b9203..942f16ed4447 100644 --- a/drivers/clock_control/clock_control_nrf_hsfll_local.c +++ b/drivers/clock_control/clock_control_nrf_hsfll_local.c @@ -259,7 +259,7 @@ static DEVICE_API(nrf_clock_control, hsfll_drv_api) = { static struct hsfll_dev_data hsfll_data; #endif -#ifdef CONFIG_CLOCK_CONTROL_NRF2_HSFLL_REQ_LOW_FREQ +#ifdef CONFIG_CLOCK_CONTROL_NRF_HSFLL_LOCAL_REQ_LOW_FREQ static int dvfs_low_init(void) { static const k_timeout_t timeout = NRFS_DVFS_TIMEOUT; diff --git a/include/zephyr/drivers/clock_control/nrf_clock_control.h b/include/zephyr/drivers/clock_control/nrf_clock_control.h index 7ef524dd4dc9..f407be61d4db 100644 --- a/include/zephyr/drivers/clock_control/nrf_clock_control.h +++ b/include/zephyr/drivers/clock_control/nrf_clock_control.h @@ -171,9 +171,6 @@ uint32_t z_nrf_clock_bt_ctlr_hf_get_startup_time_us(void); #endif /* defined(CONFIG_CLOCK_CONTROL_NRF) */ - -#if defined(CONFIG_CLOCK_CONTROL_NRF2) - /* Specifies to use the maximum available frequency for a given clock. */ #define NRF_CLOCK_CONTROL_FREQUENCY_MAX UINT32_MAX @@ -402,8 +399,6 @@ void nrf_clock_control_hfxo_request(void); */ void nrf_clock_control_hfxo_release(void); -#endif /* defined(CONFIG_CLOCK_CONTROL_NRF2) */ - #ifdef __cplusplus } #endif diff --git a/modules/hal_nordic/nrf_802154/sl_opensource/platform/nrf_802154_clock_zephyr.c b/modules/hal_nordic/nrf_802154/sl_opensource/platform/nrf_802154_clock_zephyr.c index 1ade977118e1..1dcf724b0e52 100644 --- a/modules/hal_nordic/nrf_802154/sl_opensource/platform/nrf_802154_clock_zephyr.c +++ b/modules/hal_nordic/nrf_802154/sl_opensource/platform/nrf_802154_clock_zephyr.c @@ -88,7 +88,8 @@ void nrf_802154_clock_hfclk_stop(void) hfclk_is_running = false; } -#elif defined(CONFIG_CLOCK_CONTROL_NRF2) +#elif DT_NODE_HAS_STATUS(DT_NODELABEL(hfxo), okay) && \ + DT_NODE_HAS_COMPAT(DT_NODELABEL(hfxo), nordic_nrf54h_hfxo) void nrf_802154_clock_hfclk_start(void) { From 6e376b0661c92c7b629d6a24ee4b805005a26cc9 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Fri, 6 Jun 2025 17:06:27 +0200 Subject: [PATCH 0091/2141] [nrf fromtree] drivers: serial: nrfx: remove deprecated config The UART_NRFX_UARTE_USE_CLOCK_CONTROL is no longer used and incorrectly selects CLOCK_CONTROL if UARTE120 exists. Remove it. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit 020e99c14747d5cd062eb56f1910073934d0f389) --- drivers/serial/Kconfig.nrfx | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/serial/Kconfig.nrfx b/drivers/serial/Kconfig.nrfx index 3fb1f0fd1203..0bac5150a24b 100644 --- a/drivers/serial/Kconfig.nrfx +++ b/drivers/serial/Kconfig.nrfx @@ -135,11 +135,6 @@ rsource "Kconfig.nrfx_uart_instance" endif if HAS_HW_NRF_UARTE120 - -config UART_NRFX_UARTE_USE_CLOCK_CONTROL - def_bool y - select CLOCK_CONTROL - nrfx_uart_num = 120 rsource "Kconfig.nrfx_uart_instance" endif From 69ba6b5cc9cb0293ec29d401528c3ed7cbdc172f Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Tue, 10 Jun 2025 21:33:16 +0200 Subject: [PATCH 0092/2141] [nrf fromtree] drivers: serial: nrfx_uarte: assert clock control enabled clock control is required for "fast instances" so assert clock is enabled alongside PM DEVICE RUNTIME. Update UART tests to reflect this requirenment. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit b41feb9abcfb34dc3b07c9d9e56db6e632842b5f) --- drivers/serial/uart_nrfx_uarte.c | 5 +++-- .../uart_async_dual/boards/nrf54h20dk_nrf54h20_cpuapp.conf | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/serial/uart_nrfx_uarte.c b/drivers/serial/uart_nrfx_uarte.c index 80e296cc51d2..46c5a8b83d2e 100644 --- a/drivers/serial/uart_nrfx_uarte.c +++ b/drivers/serial/uart_nrfx_uarte.c @@ -129,10 +129,11 @@ LOG_MODULE_REGISTER(uart_nrfx_uarte, CONFIG_UART_LOG_LEVEL); (0))), (0)) #if UARTE_FOR_EACH_INSTANCE(INSTANCE_IS_FAST_PD, (||), (0)) -/* Instance in fast power domain (PD) requires special PM treatment so device runtime PM must - * be enabled. +/* Instance in fast power domain (PD) requires special PM treatment and clock control, so + * device runtime PM and clock control must be enabled. */ BUILD_ASSERT(IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)); +BUILD_ASSERT(IS_ENABLED(CONFIG_CLOCK_CONTROL)); #define UARTE_ANY_FAST_PD 1 #endif #endif diff --git a/tests/drivers/uart/uart_async_dual/boards/nrf54h20dk_nrf54h20_cpuapp.conf b/tests/drivers/uart/uart_async_dual/boards/nrf54h20dk_nrf54h20_cpuapp.conf index 74cc8d7691e1..6dffc1fe4e19 100644 --- a/tests/drivers/uart/uart_async_dual/boards/nrf54h20dk_nrf54h20_cpuapp.conf +++ b/tests/drivers/uart/uart_async_dual/boards/nrf54h20dk_nrf54h20_cpuapp.conf @@ -1,2 +1,3 @@ CONFIG_PM_DEVICE=y CONFIG_PM_DEVICE_RUNTIME=y +CONFIG_CLOCK_CONTROL=y From 2322f1f389d4ae9039438f41def0ea175ce017f3 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Mon, 16 Jun 2025 11:28:52 +0200 Subject: [PATCH 0093/2141] [nrf fromtree] dts: vendor: nordic: nrf54h20.dtsi: disable cpurad_hsfll The cpurad_hsfll is not yet supported by the NRFS DVFS service, disable it to prevent driver from being loaded. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit 4c3671aea336fe638c1d4bee94f088e38129b8ed) --- dts/vendor/nordic/nrf54h20.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/dts/vendor/nordic/nrf54h20.dtsi b/dts/vendor/nordic/nrf54h20.dtsi index 37a6a3f394bb..c12ea5f1ead5 100644 --- a/dts/vendor/nordic/nrf54h20.dtsi +++ b/dts/vendor/nordic/nrf54h20.dtsi @@ -336,6 +336,7 @@ compatible = "nordic,nrf-hsfll-local"; #clock-cells = <0>; reg = <0xd000 0x1000>; + status = "disabled"; clocks = <&fll16m>; clock-frequency = ; nordic,ficrs = From fb23f7c4c115395816a466fdbad37663b62e1349 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Mon, 16 Jun 2025 11:40:23 +0200 Subject: [PATCH 0094/2141] [nrf fromtree] drivers: nrfx: help select clock control when needed CLOCK_CONTROL is required for fast instances of UART and COUNTER, help select it when possible. The fast instances are UARTE120, TIMER120 and TIMER121, and CLOCK_CONTROL is not supported for CPUFLPR and CPUPPR even when the fast instances are used. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit 0829c2bb8c7a9c5aa045a9634bdf6f75d40a1bd3) --- drivers/counter/Kconfig.nrfx | 3 ++- drivers/serial/Kconfig.nrfx | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/counter/Kconfig.nrfx b/drivers/counter/Kconfig.nrfx index 775406a5198c..ed02411de261 100644 --- a/drivers/counter/Kconfig.nrfx +++ b/drivers/counter/Kconfig.nrfx @@ -12,7 +12,8 @@ config COUNTER_NRF_RTC config COUNTER_NRFX_TIMER_USE_CLOCK_CONTROL def_bool y depends on $(dt_nodelabel_enabled,timer120) || \ - $(dt_nodelabel_enabled,timer121) + $(dt_nodelabel_enabled,timer121) + depends on !SOC_NRF54H20_CPUFLPR && !SOC_NRF54H20_CPUPPR select CLOCK_CONTROL # Internal flag which detects if PPI wrap feature is enabled for any instance diff --git a/drivers/serial/Kconfig.nrfx b/drivers/serial/Kconfig.nrfx index 0bac5150a24b..f91980c058b5 100644 --- a/drivers/serial/Kconfig.nrfx +++ b/drivers/serial/Kconfig.nrfx @@ -28,6 +28,13 @@ config UART_NRFX_UARTE imply NRFX_UARTE_CONFIG_SKIP_PSEL_CONFIG if !UART_NRFX_UARTE_LEGACY_SHIM imply NRFX_UARTE_CONFIG_SKIP_GPIO_CONFIG if !UART_NRFX_UARTE_LEGACY_SHIM +config UART_NRFX_UARTE_USE_CLOCK_CONTROL + def_bool y + depends on UART_NRFX_UARTE + depends on $(dt_nodelabel_enabled,uart120) + depends on !SOC_NRF54H20_CPUFLPR && !SOC_NRF54H20_CPUPPR + select CLOCK_CONTROL + config UART_NRFX_UARTE_NO_IRQ bool "Polling without interrupt" depends on UART_NRFX_UARTE From f328a81a2b2200142aa352824a5eb9e009cfca8a Mon Sep 17 00:00:00 2001 From: Piotr Koziar Date: Fri, 27 Jun 2025 16:26:34 +0200 Subject: [PATCH 0095/2141] [nrf fromlist] soc: nordic: nrf54l: add Kconfig to control whether to apply Errata 56 Adds config option that allows configuration workaround 56. Upstream PR #: 92315 Signed-off-by: Piotr Koziar (cherry picked from commit 7400163517bd4fbafaf9e00530e87eb9f17fa734) --- modules/hal_nordic/nrfx/CMakeLists.txt | 1 + soc/nordic/nrf54l/Kconfig | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/modules/hal_nordic/nrfx/CMakeLists.txt b/modules/hal_nordic/nrfx/CMakeLists.txt index d1972356fccf..5d7b4d942b3b 100644 --- a/modules/hal_nordic/nrfx/CMakeLists.txt +++ b/modules/hal_nordic/nrfx/CMakeLists.txt @@ -197,6 +197,7 @@ endif() zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54LX_SKIP_CLOCK_CONFIG NRF_SKIP_CLOCK_CONFIGURATION) zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54LX_DISABLE_FICR_TRIMCNF NRF_DISABLE_FICR_TRIMCNF) zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54LX_SKIP_GLITCHDETECTOR_DISABLE NRF_SKIP_GLITCHDETECTOR_DISABLE) +zephyr_compile_definitions_ifndef(CONFIG_SOC_NRF54L_ANOMALY_56_WORKAROUND NRF54L_CONFIGURATION_56_ENABLE=0) # Inject code to skip TAMPC setup for nRF54L20 and nRF54L09. It is not supported for now. # It needs to be removed when support is provided. diff --git a/soc/nordic/nrf54l/Kconfig b/soc/nordic/nrf54l/Kconfig index 6dc5e9f13cd3..19131154b5bb 100644 --- a/soc/nordic/nrf54l/Kconfig +++ b/soc/nordic/nrf54l/Kconfig @@ -84,4 +84,10 @@ config SOC_NRF_FORCE_CONSTLAT of base resources on while in sleep. The advantage of having a constant and predictable latency will be at the cost of having increased power consumption. +config SOC_NRF54L_ANOMALY_56_WORKAROUND + bool "Apply workaround 56 for nRF54L SoCs" + default y + help + This option enables configuration workaround 56 for nRF54L Series SoCs. + endif # SOC_SERIES_NRF54LX From a2838ea67c96a21cbf0e44a756699df586cbafc5 Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Fri, 13 Jun 2025 10:00:17 +0200 Subject: [PATCH 0096/2141] [nrf fromtree] scripts: kconfig: Add hex variants of arithmetic functions Functions like `add` and `sub` can only return base 10 integers, which means they can't really be used to define Kconfig symbols of type `hex`. For the same reason, there already exist pairs of devicetree functions named e.g., `dt_node_reg_addr_(int|hex)` after different return types. Introduce `add_hex`, `sub_hex`, and friends. To avoid confusion, it should be possible for those new functions to accept arguments in base 16 as well. It's actually easier to let all arithmetic functions take their inputs in "any" base, by leveraging Python's built-in: `int(..., base=0)`. Signed-off-by: Grzegorz Swiderski (cherry picked from commit 64bb8b6796a560d9b89f58f3a381214c0a6e8e88) --- doc/build/kconfig/preprocessor-functions.rst | 11 +++++ scripts/kconfig/kconfigfunctions.py | 35 +++++++++++-- tests/kconfig/functions/Kconfig | 52 ++++++++++---------- tests/kconfig/functions/src/main.c | 4 +- 4 files changed, 70 insertions(+), 32 deletions(-) diff --git a/doc/build/kconfig/preprocessor-functions.rst b/doc/build/kconfig/preprocessor-functions.rst index 9de5110bfdbc..e3ed5f406366 100644 --- a/doc/build/kconfig/preprocessor-functions.rst +++ b/doc/build/kconfig/preprocessor-functions.rst @@ -81,18 +81,29 @@ Integer functions The functions listed below can be used to do arithmetic operations on integer variables, such as addition, subtraction and more. +Functions with and without the ``_hex`` suffix in their names +return hexadecimal and decimal values respectively. .. code-block:: none $(add,[,value]...) + $(add_hex,[,value]...) $(dec,[,value]...) + $(dec_hex,[,value]...) $(div,[,value]...) + $(div_hex,[,value]...) $(inc,[,value]...) + $(inc_hex,[,value]...) $(max,[,value]...) + $(max_hex,[,value]...) $(min,[,value]...) + $(min_hex,[,value]...) $(mod,[,value]...) + $(mod_hex,[,value]...) $(mul,[,value]...) + $(mul_hex,[,value]...) $(sub,[,value]...) + $(sub_hex,[,value]...) String functions diff --git a/scripts/kconfig/kconfigfunctions.py b/scripts/kconfig/kconfigfunctions.py index ce4ce2aa6c28..4b42ce30cef4 100644 --- a/scripts/kconfig/kconfigfunctions.py +++ b/scripts/kconfig/kconfigfunctions.py @@ -983,8 +983,8 @@ def arith(kconf, name, *args): the operation on the first two arguments and operates the same operation as the result and the following argument. For interoperability with inc and dec, - if there is only one argument, it will be split with a comma and processed - as a sequence of numbers. + each argument can be a single number or a comma-separated list of numbers, + but all numbers are processed as if they were individual arguments. Examples in Kconfig: @@ -1008,22 +1008,36 @@ def arith(kconf, name, *args): $(div, $(dec, 1, 1)) # Error (0 div 0) """ - intarray = map(int, args if len(args) > 1 else args[0].split(",")) + intarray = (int(val, base=0) for arg in args for val in arg.split(",")) if name == "add": return str(int(functools.reduce(operator.add, intarray))) + elif name == "add_hex": + return hex(int(functools.reduce(operator.add, intarray))) elif name == "sub": return str(int(functools.reduce(operator.sub, intarray))) + elif name == "sub_hex": + return hex(int(functools.reduce(operator.sub, intarray))) elif name == "mul": return str(int(functools.reduce(operator.mul, intarray))) + elif name == "mul_hex": + return hex(int(functools.reduce(operator.mul, intarray))) elif name == "div": return str(int(functools.reduce(operator.truediv, intarray))) + elif name == "div_hex": + return hex(int(functools.reduce(operator.truediv, intarray))) elif name == "mod": return str(int(functools.reduce(operator.mod, intarray))) + elif name == "mod_hex": + return hex(int(functools.reduce(operator.mod, intarray))) elif name == "max": return str(int(functools.reduce(max, intarray))) + elif name == "max_hex": + return hex(int(functools.reduce(max, intarray))) elif name == "min": return str(int(functools.reduce(min, intarray))) + elif name == "min_hex": + return hex(int(functools.reduce(min, intarray))) else: assert False @@ -1034,12 +1048,16 @@ def inc_dec(kconf, name, *args): Returns a string that concatenates numbers with a comma as a separator. """ - intarray = map(int, args if len(args) > 1 else args[0].split(",")) + intarray = (int(val, base=0) for arg in args for val in arg.split(",")) if name == "inc": return ",".join(map(lambda a: str(a + 1), intarray)) + if name == "inc_hex": + return ",".join(map(lambda a: hex(a + 1), intarray)) elif name == "dec": return ",".join(map(lambda a: str(a - 1), intarray)) + elif name == "dec_hex": + return ",".join(map(lambda a: hex(a - 1), intarray)) else: assert False @@ -1106,12 +1124,21 @@ def inc_dec(kconf, name, *args): "shields_list_contains": (shields_list_contains, 1, 1), "substring": (substring, 2, 3), "add": (arith, 1, 255), + "add_hex": (arith, 1, 255), "sub": (arith, 1, 255), + "sub_hex": (arith, 1, 255), "mul": (arith, 1, 255), + "mul_hex": (arith, 1, 255), "div": (arith, 1, 255), + "div_hex": (arith, 1, 255), "mod": (arith, 1, 255), + "mod_hex": (arith, 1, 255), "max": (arith, 1, 255), + "max_hex": (arith, 1, 255), "min": (arith, 1, 255), + "min_hex": (arith, 1, 255), "inc": (inc_dec, 1, 255), + "inc_hex": (inc_dec, 1, 255), "dec": (inc_dec, 1, 255), + "dec_hex": (inc_dec, 1, 255), } diff --git a/tests/kconfig/functions/Kconfig b/tests/kconfig/functions/Kconfig index 50868eb7b6ae..1e46730c98a0 100644 --- a/tests/kconfig/functions/Kconfig +++ b/tests/kconfig/functions/Kconfig @@ -6,60 +6,60 @@ config KCONFIG_ARITHMETIC_ADD_10 default $(add, 10) config KCONFIG_ARITHMETIC_ADD_10_3 - int - default $(add, 10, 3) + hex + default $(add_hex, 10, 3) config KCONFIG_ARITHMETIC_ADD_10_3_2 int - default $(add, 10, 3, 2) + default $(add, 0xa, 3, 0b10) config KCONFIG_ARITHMETIC_SUB_10 int default $(sub, 10) config KCONFIG_ARITHMETIC_SUB_10_3 - int - default $(sub, 10, 3) + hex + default $(sub_hex, 10, 3) config KCONFIG_ARITHMETIC_SUB_10_3_2 int - default $(sub, 10, 3, 2) + default $(sub, 0xa, 3, 0b10) config KCONFIG_ARITHMETIC_MUL_10 int default $(mul, 10) config KCONFIG_ARITHMETIC_MUL_10_3 - int - default $(mul, 10, 3) + hex + default $(mul_hex, 10, 3) config KCONFIG_ARITHMETIC_MUL_10_3_2 int - default $(mul, 10, 3, 2) + default $(mul, 0xa, 3, 0b10) config KCONFIG_ARITHMETIC_DIV_10 int default $(div, 10) config KCONFIG_ARITHMETIC_DIV_10_3 - int - default $(div, 10, 3) + hex + default $(div_hex, 10, 3) config KCONFIG_ARITHMETIC_DIV_10_3_2 int - default $(div, 10, 3, 2) + default $(div, 0xa, 3, 0b10) config KCONFIG_ARITHMETIC_MOD_10 int default $(mod, 10) config KCONFIG_ARITHMETIC_MOD_10_3 - int - default $(mod, 10, 3) + hex + default $(mod_hex, 10, 3) config KCONFIG_ARITHMETIC_MOD_10_3_2 int - default $(mod, 10, 3, 2) + default $(mod, 0xa, 3, 0b10) config KCONFIG_ARITHMETIC_INC_1 int @@ -67,11 +67,11 @@ config KCONFIG_ARITHMETIC_INC_1 config KCONFIG_ARITHMETIC_INC_1_1 string - default "$(inc, 1, 1)" + default "$(inc_hex, 1, 1)" config KCONFIG_ARITHMETIC_INC_INC_1_1 string - default "$(inc, $(inc, 1, 1))" + default "$(inc, $(inc_hex, 0x1, 0b1))" config KCONFIG_ARITHMETIC_DEC_1 int @@ -79,38 +79,38 @@ config KCONFIG_ARITHMETIC_DEC_1 config KCONFIG_ARITHMETIC_DEC_1_1 string - default "$(dec, 1, 1)" + default "$(dec_hex, 1, 1)" config KCONFIG_ARITHMETIC_DEC_DEC_1_1 string - default "$(dec, $(dec, 1, 1))" + default "$(dec, $(dec_hex, 0x1, 0b1))" config KCONFIG_ARITHMETIC_ADD_INC_1_1 int - default $(add, $(inc, 1, 1)) + default $(add, $(inc_hex, 1, 1)) config KCONFIG_MIN_10 int default $(min, 10) config KCONFIG_MIN_10_3 - int - default $(min, 10, 3) + hex + default $(min_hex, 10, 3) config KCONFIG_MIN_10_3_2 int - default $(min, 10, 3, 2) + default $(min, 0xa, 3, 0b10) config KCONFIG_MAX_10 int default $(max, 10) config KCONFIG_MAX_10_3 - int - default $(max, 10, 3) + hex + default $(max_hex, 10, 3) config KCONFIG_MAX_10_3_2 int - default $(max, 10, 3, 2) + default $(max, 0xa, 3, 0b10) source "Kconfig.zephyr" diff --git a/tests/kconfig/functions/src/main.c b/tests/kconfig/functions/src/main.c index 39962c2a4f8c..7492e3b5b93a 100644 --- a/tests/kconfig/functions/src/main.c +++ b/tests/kconfig/functions/src/main.c @@ -27,10 +27,10 @@ ZTEST(test_kconfig_functions, test_arithmetic) zassert_equal(CONFIG_KCONFIG_ARITHMETIC_MOD_10_3, 10 % 3); zassert_equal(CONFIG_KCONFIG_ARITHMETIC_MOD_10_3_2, 10 % 3 % 2); zassert_equal(CONFIG_KCONFIG_ARITHMETIC_INC_1, 1 + 1); - zassert_str_equal(CONFIG_KCONFIG_ARITHMETIC_INC_1_1, "2,2"); + zassert_str_equal(CONFIG_KCONFIG_ARITHMETIC_INC_1_1, "0x2,0x2"); zassert_str_equal(CONFIG_KCONFIG_ARITHMETIC_INC_INC_1_1, "3,3"); zassert_equal(CONFIG_KCONFIG_ARITHMETIC_DEC_1, 1 - 1); - zassert_str_equal(CONFIG_KCONFIG_ARITHMETIC_DEC_1_1, "0,0"); + zassert_str_equal(CONFIG_KCONFIG_ARITHMETIC_DEC_1_1, "0x0,0x0"); zassert_str_equal(CONFIG_KCONFIG_ARITHMETIC_DEC_DEC_1_1, "-1,-1"); zassert_equal(CONFIG_KCONFIG_ARITHMETIC_ADD_INC_1_1, (1 + 1) + (1 + 1)); } From 68e055a660fc7907cb92da5870b4bbeafa8d0f31 Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Tue, 24 Jun 2025 06:12:35 +0200 Subject: [PATCH 0097/2141] [nrf fromlist] tests: kernel: interrupt: Fix for nRF54H20 FLPR Upstream PR #: 91826 Use designated IRQ numbers, instead of generic defaults. Signed-off-by: Grzegorz Swiderski (cherry picked from commit 1b5dff6bd1774124a70c9be136846f3f75e5e06f) --- tests/kernel/interrupt/src/nested_irq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/kernel/interrupt/src/nested_irq.c b/tests/kernel/interrupt/src/nested_irq.c index e1edfc3442fe..6bfc81b8965c 100644 --- a/tests/kernel/interrupt/src/nested_irq.c +++ b/tests/kernel/interrupt/src/nested_irq.c @@ -56,7 +56,8 @@ */ #define IRQ0_PRIO IRQ_DEFAULT_PRIORITY #define IRQ1_PRIO 0x0 -#elif defined(CONFIG_SOC_SERIES_NRF54LX) && defined(CONFIG_RISCV_CORE_NORDIC_VPR) +#elif (defined(CONFIG_SOC_SERIES_NRF54LX) || defined(CONFIG_SOC_NRF54H20_CPUFLPR)) && \ + defined(CONFIG_RISCV_CORE_NORDIC_VPR) #define IRQ0_LINE 16 #define IRQ1_LINE 17 From 2d0c2aac414b48c5e8514d1b3b0c945038e599f0 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Fri, 6 Jun 2025 14:59:15 +0200 Subject: [PATCH 0098/2141] [nrf fromtree] tests: spi: loopback: use CONFIG_ZTEST_STACK_SIZE for thread stacks The spi_loopback test suite creates three internal threads. The stack sizes for these threads is hardcoded to 512, which is to little for some socs, namely the nrf54h20 cpuapp if pm device runtime is enabled. Instead, determine the stack sizes the same way ztest stack sizes are determined. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit 5163b8c96aee6922a90cd3f7f11e80d2e82f1235) --- tests/drivers/spi/spi_loopback/src/spi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/drivers/spi/spi_loopback/src/spi.c b/tests/drivers/spi/spi_loopback/src/spi.c index 64649ce7566b..5419a7493518 100644 --- a/tests/drivers/spi/spi_loopback/src/spi.c +++ b/tests/drivers/spi/spi_loopback/src/spi.c @@ -693,7 +693,8 @@ ZTEST(spi_loopback, test_spi_word_size_32) sizeof(buffer_tx_32), &spec_copies[4], 32); } -static K_THREAD_STACK_DEFINE(thread_stack[3], 512); +static K_THREAD_STACK_DEFINE(thread_stack[3], CONFIG_ZTEST_STACK_SIZE + + CONFIG_TEST_EXTRA_STACK_SIZE); static struct k_thread thread[3]; static K_SEM_DEFINE(thread_sem, 0, 3); From dec4c5b99a995f15afbb7551424a00a6ec8f0530 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Pl=C3=B6ger?= Date: Tue, 24 Jun 2025 14:48:19 +0200 Subject: [PATCH 0099/2141] [nrf fromtree] libc: minimal: Add "prohibit_lto" flag to avoid problems with LTO MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The compiler requires that much of the C library be built without using LTO so that various symbols are available for use by generated code, including things like memset and memcpy. Add the "prohibit_lto" CMake target compiler property to avoid LTO when activated. Signed-off-by: Matthias Plöger (cherry picked from commit 4a0539af3646c3c1d756b6a127fcb6c1129c6c05) --- lib/libc/minimal/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/libc/minimal/CMakeLists.txt b/lib/libc/minimal/CMakeLists.txt index 10610b855c84..29f2db74367b 100644 --- a/lib/libc/minimal/CMakeLists.txt +++ b/lib/libc/minimal/CMakeLists.txt @@ -12,6 +12,7 @@ set(GEN_DIR ${ZEPHYR_BINARY_DIR}/include/generated) set(STRERROR_TABLE_H ${GEN_DIR}/libc/minimal/strerror_table.h) zephyr_library_compile_options($) +zephyr_library_compile_options($) zephyr_library_sources( source/stdlib/atoi.c From d2a01f5b5c5f399878b5ba0df407b4624ae2b0a1 Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Tue, 15 Apr 2025 18:17:12 +1000 Subject: [PATCH 0100/2141] [nrf fromtree] regulator: npm1300: configure active discharge Configure the active discharge feature for both the BUCK and LDO/LDSW blocks through the appropriate registers. Signed-off-by: Jordan Yates (cherry picked from commit 5dcaf077e797da8c98072e84977b6e90dce8cb42) --- drivers/regulator/regulator_npm1300.c | 50 ++++++++++++++++--- .../regulator/nordic,npm1300-regulator.yaml | 5 ++ 2 files changed, 49 insertions(+), 6 deletions(-) diff --git a/drivers/regulator/regulator_npm1300.c b/drivers/regulator/regulator_npm1300.c index 8b5b64572c45..19d8a2a179e3 100644 --- a/drivers/regulator/regulator_npm1300.c +++ b/drivers/regulator/regulator_npm1300.c @@ -62,16 +62,20 @@ enum npm1300_gpio_type { /* nPM1300 ship register offsets */ #define SHIP_OFFSET_SHIP 0x02U -#define BUCK1_ON_MASK 0x04U -#define BUCK2_ON_MASK 0x40U +#define BUCK1_ON_MASK 0x04U +#define BUCK2_ON_MASK 0x40U +#define BUCK1_EN_PULLDOWN_MASK BIT(2) +#define BUCK2_EN_PULLDOWN_MASK BIT(3) #define LDSW1_ON_MASK 0x03U #define LDSW2_ON_MASK 0x0CU -#define LDSW1_SOFTSTART_MASK 0x0CU -#define LDSW1_SOFTSTART_SHIFT 2U -#define LDSW2_SOFTSTART_MASK 0x30U -#define LDSW2_SOFTSTART_SHIFT 4U +#define LDSW1_SOFTSTART_MASK 0x0CU +#define LDSW1_SOFTSTART_SHIFT 2U +#define LDSW1_ACTIVE_DISCHARGE_MASK BIT(6) +#define LDSW2_SOFTSTART_MASK 0x30U +#define LDSW2_SOFTSTART_SHIFT 4U +#define LDSW2_ACTIVE_DISCHARGE_MASK BIT(7) #define NPM1300_GPIO_UNUSED UINT8_MAX @@ -94,6 +98,7 @@ struct regulator_npm1300_config { struct npm1300_gpio_info retention_gpios; struct npm1300_gpio_info pwm_gpios; uint8_t soft_start; + bool active_discharge; bool ldo_disable_workaround; }; @@ -603,6 +608,32 @@ static int soft_start_set(const struct device *dev, uint8_t soft_start) } } +static int active_discharge_set(const struct device *dev, bool enabled) +{ + const struct regulator_npm1300_config *config = dev->config; + + switch (config->source) { + case NPM1300_SOURCE_BUCK1: + return mfd_npm1300_reg_update(config->mfd, BUCK_BASE, BUCK_OFFSET_CTRL0, + enabled ? BUCK1_EN_PULLDOWN_MASK : 0, + BUCK1_EN_PULLDOWN_MASK); + case NPM1300_SOURCE_BUCK2: + return mfd_npm1300_reg_update(config->mfd, BUCK_BASE, BUCK_OFFSET_CTRL0, + enabled ? BUCK2_EN_PULLDOWN_MASK : 0, + BUCK2_EN_PULLDOWN_MASK); + case NPM1300_SOURCE_LDO1: + return mfd_npm1300_reg_update(config->mfd, LDSW_BASE, LDSW_OFFSET_CONFIG, + enabled ? LDSW1_ACTIVE_DISCHARGE_MASK : 0, + LDSW1_ACTIVE_DISCHARGE_MASK); + case NPM1300_SOURCE_LDO2: + return mfd_npm1300_reg_update(config->mfd, LDSW_BASE, LDSW_OFFSET_CONFIG, + enabled ? LDSW2_ACTIVE_DISCHARGE_MASK : 0, + LDSW2_ACTIVE_DISCHARGE_MASK); + default: + return -ENODEV; + } +} + int regulator_npm1300_init(const struct device *dev) { const struct regulator_npm1300_config *config = dev->config; @@ -639,6 +670,12 @@ int regulator_npm1300_init(const struct device *dev) } } + /* Configure active discharge */ + ret = active_discharge_set(dev, config->active_discharge); + if (ret != 0) { + return ret; + } + /* Configure GPIO pin control */ ret = regulator_npm1300_set_pin_ctrl(dev, &config->enable_gpios, NPM1300_GPIO_TYPE_ENABLE); if (ret != 0) { @@ -690,6 +727,7 @@ static DEVICE_API(regulator, api) = { .enable_gpios = GPIO_CONFIG_DEFINE(node_id, enable_gpio_config), \ .retention_gpios = GPIO_CONFIG_DEFINE(node_id, retention_gpio_config), \ .pwm_gpios = GPIO_CONFIG_DEFINE(node_id, pwm_gpio_config), \ + .active_discharge = DT_PROP(node_id, active_discharge), \ .ldo_disable_workaround = DT_PROP(node_id, nordic_anomaly38_disable_workaround)}; \ \ DEVICE_DT_DEFINE(node_id, regulator_npm1300_init, NULL, &data_##id, &config_##id, \ diff --git a/dts/bindings/regulator/nordic,npm1300-regulator.yaml b/dts/bindings/regulator/nordic,npm1300-regulator.yaml index 28b50dd34b79..1b77f6c1ab43 100644 --- a/dts/bindings/regulator/nordic,npm1300-regulator.yaml +++ b/dts/bindings/regulator/nordic,npm1300-regulator.yaml @@ -97,6 +97,11 @@ child-binding: description: | Soft start current limit in microamps. + active-discharge: + type: boolean + description: | + Enable active-discharge on the BUCK/LDO/LDSW output when disabled. + nordic,anomaly38-disable-workaround: type: boolean description: | From df84dcade739b4f0b2e7b158921820dfc052d3e6 Mon Sep 17 00:00:00 2001 From: Sergei Ovchinnikov Date: Thu, 24 Apr 2025 10:29:50 +0200 Subject: [PATCH 0101/2141] [nrf fromtree] drivers: npm1300: rename to npm13xx Rename npm1300 drivers and header files to npm13xx to allow for usage with other nPM13xx product variants. Signed-off-by: Sergei Ovchinnikov (cherry picked from commit fb007db50af04f3b0acd92245af83db565335bd7) --- boards/shields/npm1300_ek/npm1300_ek.overlay | 2 +- drivers/gpio/CMakeLists.txt | 2 +- drivers/gpio/Kconfig | 2 +- drivers/gpio/{Kconfig.npm1300 => Kconfig.npm13xx} | 0 drivers/gpio/{gpio_npm1300.c => gpio_npm13xx.c} | 4 ++-- drivers/led/CMakeLists.txt | 2 +- drivers/led/Kconfig | 2 +- drivers/led/{Kconfig.npm1300 => Kconfig.npm13xx} | 0 drivers/led/{led_npm1300.c => led_npm13xx.c} | 2 +- drivers/mfd/CMakeLists.txt | 2 +- drivers/mfd/Kconfig | 2 +- drivers/mfd/{Kconfig.npm1300 => Kconfig.npm13xx} | 0 drivers/mfd/{mfd_npm1300.c => mfd_npm13xx.c} | 2 +- drivers/regulator/CMakeLists.txt | 2 +- drivers/regulator/Kconfig | 2 +- drivers/regulator/{Kconfig.npm1300 => Kconfig.npm13xx} | 0 .../regulator/{regulator_npm1300.c => regulator_npm13xx.c} | 4 ++-- drivers/sensor/nordic/CMakeLists.txt | 2 +- drivers/sensor/nordic/Kconfig | 2 +- .../{npm1300_charger => npm13xx_charger}/CMakeLists.txt | 2 +- .../nordic/{npm1300_charger => npm13xx_charger}/Kconfig | 0 .../npm1300_charger.c => npm13xx_charger/npm13xx_charger.c} | 4 ++-- drivers/watchdog/CMakeLists.txt | 2 +- drivers/watchdog/Kconfig | 2 +- drivers/watchdog/{Kconfig.npm1300 => Kconfig.npm13xx} | 0 drivers/watchdog/{wdt_npm1300.c => wdt_npm13xx.c} | 4 ++-- include/zephyr/drivers/mfd/{npm1300.h => npm13xx.h} | 6 +++--- .../drivers/sensor/{npm1300_charger.h => npm13xx_charger.h} | 4 ++-- .../gpio/{nordic-npm1300-gpio.h => nordic-npm13xx-gpio.h} | 6 +++--- .../zephyr/dt-bindings/regulator/{npm1300.h => npm13xx.h} | 6 +++--- samples/shields/npm1300_ek/src/main.c | 6 +++--- 31 files changed, 38 insertions(+), 38 deletions(-) rename drivers/gpio/{Kconfig.npm1300 => Kconfig.npm13xx} (100%) rename drivers/gpio/{gpio_npm1300.c => gpio_npm13xx.c} (98%) rename drivers/led/{Kconfig.npm1300 => Kconfig.npm13xx} (100%) rename drivers/led/{led_npm1300.c => led_npm13xx.c} (98%) rename drivers/mfd/{Kconfig.npm1300 => Kconfig.npm13xx} (100%) rename drivers/mfd/{mfd_npm1300.c => mfd_npm13xx.c} (99%) rename drivers/regulator/{Kconfig.npm1300 => Kconfig.npm13xx} (100%) rename drivers/regulator/{regulator_npm1300.c => regulator_npm13xx.c} (99%) rename drivers/sensor/nordic/{npm1300_charger => npm13xx_charger}/CMakeLists.txt (71%) rename drivers/sensor/nordic/{npm1300_charger => npm13xx_charger}/Kconfig (100%) rename drivers/sensor/nordic/{npm1300_charger/npm1300_charger.c => npm13xx_charger/npm13xx_charger.c} (99%) rename drivers/watchdog/{Kconfig.npm1300 => Kconfig.npm13xx} (100%) rename drivers/watchdog/{wdt_npm1300.c => wdt_npm13xx.c} (97%) rename include/zephyr/drivers/mfd/{npm1300.h => npm13xx.h} (97%) rename include/zephyr/drivers/sensor/{npm1300_charger.h => npm13xx_charger.h} (86%) rename include/zephyr/dt-bindings/gpio/{nordic-npm1300-gpio.h => nordic-npm13xx-gpio.h} (91%) rename include/zephyr/dt-bindings/regulator/{npm1300.h => npm13xx.h} (81%) diff --git a/boards/shields/npm1300_ek/npm1300_ek.overlay b/boards/shields/npm1300_ek/npm1300_ek.overlay index 592aa55f1243..d0a9b0eda228 100644 --- a/boards/shields/npm1300_ek/npm1300_ek.overlay +++ b/boards/shields/npm1300_ek/npm1300_ek.overlay @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include +#include #include &arduino_i2c { diff --git a/drivers/gpio/CMakeLists.txt b/drivers/gpio/CMakeLists.txt index 728a883e1093..8a5ea48cb65b 100644 --- a/drivers/gpio/CMakeLists.txt +++ b/drivers/gpio/CMakeLists.txt @@ -67,7 +67,7 @@ zephyr_library_sources_ifdef(CONFIG_GPIO_NCT38XX gpio_nct38xx_port.c) zephyr_library_sources_ifdef(CONFIG_GPIO_NCT38XX_ALERT gpio_nct38xx_alert.c) zephyr_library_sources_ifdef(CONFIG_GPIO_NEORV32 gpio_neorv32.c) zephyr_library_sources_ifdef(CONFIG_GPIO_NPCX gpio_npcx.c) -zephyr_library_sources_ifdef(CONFIG_GPIO_NPM1300 gpio_npm1300.c) +zephyr_library_sources_ifdef(CONFIG_GPIO_NPM1300 gpio_npm13xx.c) zephyr_library_sources_ifdef(CONFIG_GPIO_NPM2100 gpio_npm2100.c) zephyr_library_sources_ifdef(CONFIG_GPIO_NPM6001 gpio_npm6001.c) zephyr_library_sources_ifdef(CONFIG_GPIO_NRFX gpio_nrfx.c) diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index e95aded5613a..dcf5a8c043c6 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig @@ -153,7 +153,7 @@ source "drivers/gpio/Kconfig.mspm0" source "drivers/gpio/Kconfig.nct38xx" source "drivers/gpio/Kconfig.neorv32" source "drivers/gpio/Kconfig.npcx" -source "drivers/gpio/Kconfig.npm1300" +source "drivers/gpio/Kconfig.npm13xx" source "drivers/gpio/Kconfig.npm2100" source "drivers/gpio/Kconfig.npm6001" source "drivers/gpio/Kconfig.nrfx" diff --git a/drivers/gpio/Kconfig.npm1300 b/drivers/gpio/Kconfig.npm13xx similarity index 100% rename from drivers/gpio/Kconfig.npm1300 rename to drivers/gpio/Kconfig.npm13xx diff --git a/drivers/gpio/gpio_npm1300.c b/drivers/gpio/gpio_npm13xx.c similarity index 98% rename from drivers/gpio/gpio_npm1300.c rename to drivers/gpio/gpio_npm13xx.c index a941e1f3f6f9..40c5aaf10985 100644 --- a/drivers/gpio/gpio_npm1300.c +++ b/drivers/gpio/gpio_npm13xx.c @@ -9,8 +9,8 @@ #include #include -#include -#include +#include +#include #include #include diff --git a/drivers/led/CMakeLists.txt b/drivers/led/CMakeLists.txt index 73a808d7d5a2..c4c0752b2550 100644 --- a/drivers/led/CMakeLists.txt +++ b/drivers/led/CMakeLists.txt @@ -12,7 +12,7 @@ zephyr_library_sources_ifdef(CONFIG_IS31FL3733 is31fl3733.c) zephyr_library_sources_ifdef(CONFIG_LED_AXP192_AXP2101 led_axp192.c) zephyr_library_sources_ifdef(CONFIG_LED_DAC led_dac.c) zephyr_library_sources_ifdef(CONFIG_LED_GPIO led_gpio.c) -zephyr_library_sources_ifdef(CONFIG_LED_NPM1300 led_npm1300.c) +zephyr_library_sources_ifdef(CONFIG_LED_NPM1300 led_npm13xx.c) zephyr_library_sources_ifdef(CONFIG_LED_PWM led_pwm.c) zephyr_library_sources_ifdef(CONFIG_LED_XEC led_mchp_xec.c) zephyr_library_sources_ifdef(CONFIG_LP3943 lp3943.c) diff --git a/drivers/led/Kconfig b/drivers/led/Kconfig index bac815242c39..0e411ce21f04 100644 --- a/drivers/led/Kconfig +++ b/drivers/led/Kconfig @@ -40,7 +40,7 @@ source "drivers/led/Kconfig.lp5562" source "drivers/led/Kconfig.lp5569" source "drivers/led/Kconfig.modulino" source "drivers/led/Kconfig.ncp5623" -source "drivers/led/Kconfig.npm1300" +source "drivers/led/Kconfig.npm13xx" source "drivers/led/Kconfig.pca9633" source "drivers/led/Kconfig.pwm" source "drivers/led/Kconfig.tlc59108" diff --git a/drivers/led/Kconfig.npm1300 b/drivers/led/Kconfig.npm13xx similarity index 100% rename from drivers/led/Kconfig.npm1300 rename to drivers/led/Kconfig.npm13xx diff --git a/drivers/led/led_npm1300.c b/drivers/led/led_npm13xx.c similarity index 98% rename from drivers/led/led_npm1300.c rename to drivers/led/led_npm13xx.c index f23fde1dfa28..9052159e7392 100644 --- a/drivers/led/led_npm1300.c +++ b/drivers/led/led_npm13xx.c @@ -9,7 +9,7 @@ #include #include -#include +#include /* nPM1300 LED base address */ #define NPM_LED_BASE 0x0AU diff --git a/drivers/mfd/CMakeLists.txt b/drivers/mfd/CMakeLists.txt index 8560a10655f0..24a1c698e768 100644 --- a/drivers/mfd/CMakeLists.txt +++ b/drivers/mfd/CMakeLists.txt @@ -6,7 +6,7 @@ zephyr_library() zephyr_library_sources_ifdef(CONFIG_MFD_ADP5585 mfd_adp5585.c) zephyr_library_sources_ifdef(CONFIG_MFD_MAX20335 mfd_max20335.c) zephyr_library_sources_ifdef(CONFIG_MFD_NCT38XX mfd_nct38xx.c) -zephyr_library_sources_ifdef(CONFIG_MFD_NPM1300 mfd_npm1300.c) +zephyr_library_sources_ifdef(CONFIG_MFD_NPM1300 mfd_npm13xx.c) zephyr_library_sources_ifdef(CONFIG_MFD_NPM2100 mfd_npm2100.c) zephyr_library_sources_ifdef(CONFIG_MFD_NPM6001 mfd_npm6001.c) zephyr_library_sources_ifdef(CONFIG_MFD_AXP192_AXP2101 mfd_axp192.c) diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 325e29c864ae..86a11a72b410 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -30,7 +30,7 @@ source "drivers/mfd/Kconfig.max31790" source "drivers/mfd/Kconfig.maxq10xx" source "drivers/mfd/Kconfig.mchp_sam" source "drivers/mfd/Kconfig.nct38xx" -source "drivers/mfd/Kconfig.npm1300" +source "drivers/mfd/Kconfig.npm13xx" source "drivers/mfd/Kconfig.npm2100" source "drivers/mfd/Kconfig.npm6001" source "drivers/mfd/Kconfig.pf1550" diff --git a/drivers/mfd/Kconfig.npm1300 b/drivers/mfd/Kconfig.npm13xx similarity index 100% rename from drivers/mfd/Kconfig.npm1300 rename to drivers/mfd/Kconfig.npm13xx diff --git a/drivers/mfd/mfd_npm1300.c b/drivers/mfd/mfd_npm13xx.c similarity index 99% rename from drivers/mfd/mfd_npm1300.c rename to drivers/mfd/mfd_npm13xx.c index 2ea0818faeec..21961b1696a6 100644 --- a/drivers/mfd/mfd_npm1300.c +++ b/drivers/mfd/mfd_npm13xx.c @@ -12,7 +12,7 @@ #include #include #include -#include +#include #define TIME_BASE 0x07U #define MAIN_BASE 0x00U diff --git a/drivers/regulator/CMakeLists.txt b/drivers/regulator/CMakeLists.txt index ed5a1996da9b..817518d9b2f9 100644 --- a/drivers/regulator/CMakeLists.txt +++ b/drivers/regulator/CMakeLists.txt @@ -13,7 +13,7 @@ zephyr_library_sources_ifdef(CONFIG_REGULATOR_FIXED regulator_fixed.c) zephyr_library_sources_ifdef(CONFIG_REGULATOR_GPIO regulator_gpio.c) zephyr_library_sources_ifdef(CONFIG_REGULATOR_MAX20335 regulator_max20335.c) zephyr_library_sources_ifdef(CONFIG_REGULATOR_NPM1100 regulator_npm1100.c) -zephyr_library_sources_ifdef(CONFIG_REGULATOR_NPM1300 regulator_npm1300.c) +zephyr_library_sources_ifdef(CONFIG_REGULATOR_NPM1300 regulator_npm13xx.c) zephyr_library_sources_ifdef(CONFIG_REGULATOR_NPM2100 regulator_npm2100.c) zephyr_library_sources_ifdef(CONFIG_REGULATOR_NPM6001 regulator_npm6001.c) zephyr_library_sources_ifdef(CONFIG_REGULATOR_PCA9420 regulator_pca9420.c) diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig index dc331b2139d3..ca2bf41ae895 100644 --- a/drivers/regulator/Kconfig +++ b/drivers/regulator/Kconfig @@ -35,7 +35,7 @@ source "drivers/regulator/Kconfig.fixed" source "drivers/regulator/Kconfig.gpio" source "drivers/regulator/Kconfig.max20335" source "drivers/regulator/Kconfig.npm1100" -source "drivers/regulator/Kconfig.npm1300" +source "drivers/regulator/Kconfig.npm13xx" source "drivers/regulator/Kconfig.npm2100" source "drivers/regulator/Kconfig.npm6001" source "drivers/regulator/Kconfig.pca9420" diff --git a/drivers/regulator/Kconfig.npm1300 b/drivers/regulator/Kconfig.npm13xx similarity index 100% rename from drivers/regulator/Kconfig.npm1300 rename to drivers/regulator/Kconfig.npm13xx diff --git a/drivers/regulator/regulator_npm1300.c b/drivers/regulator/regulator_npm13xx.c similarity index 99% rename from drivers/regulator/regulator_npm1300.c rename to drivers/regulator/regulator_npm13xx.c index 19d8a2a179e3..913f51456af4 100644 --- a/drivers/regulator/regulator_npm1300.c +++ b/drivers/regulator/regulator_npm13xx.c @@ -10,8 +10,8 @@ #include #include -#include -#include +#include +#include #include #include diff --git a/drivers/sensor/nordic/CMakeLists.txt b/drivers/sensor/nordic/CMakeLists.txt index 49a0a48d7fd9..cfda4b85b474 100644 --- a/drivers/sensor/nordic/CMakeLists.txt +++ b/drivers/sensor/nordic/CMakeLists.txt @@ -3,7 +3,7 @@ # zephyr-keep-sorted-start add_subdirectory(temp) -add_subdirectory_ifdef(CONFIG_NPM1300_CHARGER npm1300_charger) +add_subdirectory_ifdef(CONFIG_NPM1300_CHARGER npm13xx_charger) add_subdirectory_ifdef(CONFIG_NPM2100_VBAT npm2100_vbat) add_subdirectory_ifdef(CONFIG_QDEC_NRFX qdec_nrfx) # zephyr-keep-sorted-stop diff --git a/drivers/sensor/nordic/Kconfig b/drivers/sensor/nordic/Kconfig index 0cdbaaf41e71..717c941973f9 100644 --- a/drivers/sensor/nordic/Kconfig +++ b/drivers/sensor/nordic/Kconfig @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 # zephyr-keep-sorted-start -source "drivers/sensor/nordic/npm1300_charger/Kconfig" +source "drivers/sensor/nordic/npm13xx_charger/Kconfig" source "drivers/sensor/nordic/npm2100_vbat/Kconfig" source "drivers/sensor/nordic/qdec_nrfx/Kconfig" source "drivers/sensor/nordic/temp/Kconfig" diff --git a/drivers/sensor/nordic/npm1300_charger/CMakeLists.txt b/drivers/sensor/nordic/npm13xx_charger/CMakeLists.txt similarity index 71% rename from drivers/sensor/nordic/npm1300_charger/CMakeLists.txt rename to drivers/sensor/nordic/npm13xx_charger/CMakeLists.txt index 51083775eff7..512e0f9eecd4 100644 --- a/drivers/sensor/nordic/npm1300_charger/CMakeLists.txt +++ b/drivers/sensor/nordic/npm13xx_charger/CMakeLists.txt @@ -4,4 +4,4 @@ zephyr_library() -zephyr_library_sources(npm1300_charger.c) +zephyr_library_sources(npm13xx_charger.c) diff --git a/drivers/sensor/nordic/npm1300_charger/Kconfig b/drivers/sensor/nordic/npm13xx_charger/Kconfig similarity index 100% rename from drivers/sensor/nordic/npm1300_charger/Kconfig rename to drivers/sensor/nordic/npm13xx_charger/Kconfig diff --git a/drivers/sensor/nordic/npm1300_charger/npm1300_charger.c b/drivers/sensor/nordic/npm13xx_charger/npm13xx_charger.c similarity index 99% rename from drivers/sensor/nordic/npm1300_charger/npm1300_charger.c rename to drivers/sensor/nordic/npm13xx_charger/npm13xx_charger.c index a5b2a0b1054b..829ce6a2265b 100644 --- a/drivers/sensor/nordic/npm1300_charger/npm1300_charger.c +++ b/drivers/sensor/nordic/npm13xx_charger/npm13xx_charger.c @@ -7,10 +7,10 @@ #include #include -#include +#include #include #include -#include +#include struct npm1300_charger_config { const struct device *mfd; diff --git a/drivers/watchdog/CMakeLists.txt b/drivers/watchdog/CMakeLists.txt index e7264362e3f4..4d6f75e4d9e5 100644 --- a/drivers/watchdog/CMakeLists.txt +++ b/drivers/watchdog/CMakeLists.txt @@ -28,7 +28,7 @@ zephyr_library_sources_ifdef(CONFIG_WDT_MCUX_WDOG wdt_mcux_wdog.c) zephyr_library_sources_ifdef(CONFIG_WDT_MCUX_WDOG32 wdt_mcux_wdog32.c) zephyr_library_sources_ifdef(CONFIG_WDT_MCUX_WWDT wdt_mcux_wwdt.c) zephyr_library_sources_ifdef(CONFIG_WDT_NPCX wdt_npcx.c) -zephyr_library_sources_ifdef(CONFIG_WDT_NPM1300 wdt_npm1300.c) +zephyr_library_sources_ifdef(CONFIG_WDT_NPM1300 wdt_npm13xx.c) zephyr_library_sources_ifdef(CONFIG_WDT_NPM2100 wdt_npm2100.c) zephyr_library_sources_ifdef(CONFIG_WDT_NPM6001 wdt_npm6001.c) zephyr_library_sources_ifdef(CONFIG_WDT_NRFX wdt_nrfx.c) diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index bd445bda94f9..4fed392fd223 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig @@ -107,7 +107,7 @@ source "drivers/watchdog/Kconfig.rpi_pico" source "drivers/watchdog/Kconfig.gd32" -source "drivers/watchdog/Kconfig.npm1300" +source "drivers/watchdog/Kconfig.npm13xx" source "drivers/watchdog/Kconfig.npm2100" diff --git a/drivers/watchdog/Kconfig.npm1300 b/drivers/watchdog/Kconfig.npm13xx similarity index 100% rename from drivers/watchdog/Kconfig.npm1300 rename to drivers/watchdog/Kconfig.npm13xx diff --git a/drivers/watchdog/wdt_npm1300.c b/drivers/watchdog/wdt_npm13xx.c similarity index 97% rename from drivers/watchdog/wdt_npm1300.c rename to drivers/watchdog/wdt_npm13xx.c index 71002875af0c..6dc9f2d49ea4 100644 --- a/drivers/watchdog/wdt_npm1300.c +++ b/drivers/watchdog/wdt_npm13xx.c @@ -10,8 +10,8 @@ #include #include #include -#include -#include +#include +#include /* nPM1300 TIMER base address */ #define TIME_BASE 0x07U diff --git a/include/zephyr/drivers/mfd/npm1300.h b/include/zephyr/drivers/mfd/npm13xx.h similarity index 97% rename from include/zephyr/drivers/mfd/npm1300.h rename to include/zephyr/drivers/mfd/npm13xx.h index 4dd03fa2ec31..a1b941a4fb73 100644 --- a/include/zephyr/drivers/mfd/npm1300.h +++ b/include/zephyr/drivers/mfd/npm13xx.h @@ -3,8 +3,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -#ifndef ZEPHYR_INCLUDE_DRIVERS_MFD_NPM1300_H_ -#define ZEPHYR_INCLUDE_DRIVERS_MFD_NPM1300_H_ +#ifndef ZEPHYR_INCLUDE_DRIVERS_MFD_NPM13XX_H_ +#define ZEPHYR_INCLUDE_DRIVERS_MFD_NPM13XX_H_ #ifdef __cplusplus extern "C" { @@ -163,4 +163,4 @@ int mfd_npm1300_remove_callback(const struct device *dev, struct gpio_callback * } #endif -#endif /* ZEPHYR_INCLUDE_DRIVERS_MFD_NPM1300_H_ */ +#endif /* ZEPHYR_INCLUDE_DRIVERS_MFD_NPM13XX_H_ */ diff --git a/include/zephyr/drivers/sensor/npm1300_charger.h b/include/zephyr/drivers/sensor/npm13xx_charger.h similarity index 86% rename from include/zephyr/drivers/sensor/npm1300_charger.h rename to include/zephyr/drivers/sensor/npm13xx_charger.h index d2a166340d15..05176b361226 100644 --- a/include/zephyr/drivers/sensor/npm1300_charger.h +++ b/include/zephyr/drivers/sensor/npm13xx_charger.h @@ -3,8 +3,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -#ifndef ZEPHYR_INCLUDE_DRIVERS_SENSOR_NPM1300_CHARGER_H_ -#define ZEPHYR_INCLUDE_DRIVERS_SENSOR_NPM1300_CHARGER_H_ +#ifndef ZEPHYR_INCLUDE_DRIVERS_SENSOR_NPM13XX_CHARGER_H_ +#define ZEPHYR_INCLUDE_DRIVERS_SENSOR_NPM13XX_CHARGER_H_ #include diff --git a/include/zephyr/dt-bindings/gpio/nordic-npm1300-gpio.h b/include/zephyr/dt-bindings/gpio/nordic-npm13xx-gpio.h similarity index 91% rename from include/zephyr/dt-bindings/gpio/nordic-npm1300-gpio.h rename to include/zephyr/dt-bindings/gpio/nordic-npm13xx-gpio.h index fed166e651a2..8e99213702b7 100644 --- a/include/zephyr/dt-bindings/gpio/nordic-npm1300-gpio.h +++ b/include/zephyr/dt-bindings/gpio/nordic-npm13xx-gpio.h @@ -3,8 +3,8 @@ * * SPDX-License-Identifier: Apache-2.0 */ -#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_GPIO_NORDIC_NPM1300_GPIO_H_ -#define ZEPHYR_INCLUDE_DT_BINDINGS_GPIO_NORDIC_NPM1300_GPIO_H_ +#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_GPIO_NORDIC_NPM13XX_GPIO_H_ +#define ZEPHYR_INCLUDE_DT_BINDINGS_GPIO_NORDIC_NPM13XX_GPIO_H_ /** * @brief nPM1300-specific GPIO Flags @@ -96,4 +96,4 @@ /** @} */ -#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_GPIO_NORDIC_NPM1300_GPIO_H_ */ +#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_GPIO_NORDIC_NPM13XX_GPIO_H_ */ diff --git a/include/zephyr/dt-bindings/regulator/npm1300.h b/include/zephyr/dt-bindings/regulator/npm13xx.h similarity index 81% rename from include/zephyr/dt-bindings/regulator/npm1300.h rename to include/zephyr/dt-bindings/regulator/npm13xx.h index bf3f8cfa3ee9..e24283dceaba 100644 --- a/include/zephyr/dt-bindings/regulator/npm1300.h +++ b/include/zephyr/dt-bindings/regulator/npm13xx.h @@ -4,8 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_REGULATOR_NPM1300_H_ -#define ZEPHYR_INCLUDE_DT_BINDINGS_REGULATOR_NPM1300_H_ +#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_REGULATOR_NPM13XX_H_ +#define ZEPHYR_INCLUDE_DT_BINDINGS_REGULATOR_NPM13XX_H_ /** * @defgroup regulator_npm1300 NPM1300 Devicetree helpers. @@ -38,4 +38,4 @@ /** @} */ -#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_REGULATOR_NPM1300_H_*/ +#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_REGULATOR_NPM13XX_H_*/ diff --git a/samples/shields/npm1300_ek/src/main.c b/samples/shields/npm1300_ek/src/main.c index 7ced01456628..ac2a6ca245b1 100644 --- a/samples/shields/npm1300_ek/src/main.c +++ b/samples/shields/npm1300_ek/src/main.c @@ -9,10 +9,10 @@ #include #include #include -#include +#include #include -#include -#include +#include +#include #include #include From b74ed06cdb8e394718bdf2220b6bb2ed80cc0265 Mon Sep 17 00:00:00 2001 From: Sergei Ovchinnikov Date: Mon, 28 Apr 2025 09:11:30 +0200 Subject: [PATCH 0102/2141] [nrf fromtree] drivers: npm13xx: rename npm1300 to npm13xx Rename npm1300 to npm13xx in function names, documentation, etc. where applicable for all the npm13xx drivers Signed-off-by: Sergei Ovchinnikov (cherry picked from commit 89b838363381c8c6517c2dd98774cf86db22be3a) --- .../nrf9131ek/nrf9131ek_nrf9131_ns_defconfig | 1 - drivers/gpio/CMakeLists.txt | 2 +- drivers/gpio/Kconfig.npm13xx | 14 +- drivers/gpio/gpio_npm13xx.c | 150 +++---- drivers/led/CMakeLists.txt | 2 +- drivers/led/Kconfig.npm13xx | 6 +- drivers/led/led_npm13xx.c | 54 +-- drivers/mfd/CMakeLists.txt | 2 +- drivers/mfd/Kconfig.npm13xx | 14 +- drivers/mfd/mfd_npm13xx.c | 126 +++--- drivers/regulator/CMakeLists.txt | 2 +- drivers/regulator/Kconfig.npm13xx | 22 +- drivers/regulator/regulator_npm13xx.c | 376 +++++++++--------- drivers/sensor/nordic/CMakeLists.txt | 2 +- drivers/sensor/nordic/npm13xx_charger/Kconfig | 6 +- .../nordic/npm13xx_charger/npm13xx_charger.c | 158 ++++---- drivers/watchdog/CMakeLists.txt | 2 +- drivers/watchdog/Kconfig.npm13xx | 16 +- drivers/watchdog/wdt_npm13xx.c | 72 ++-- include/zephyr/drivers/mfd/npm13xx.h | 94 ++--- .../zephyr/drivers/sensor/npm13xx_charger.h | 26 +- .../dt-bindings/gpio/nordic-npm13xx-gpio.h | 44 +- .../zephyr/dt-bindings/regulator/npm13xx.h | 26 +- .../npm1300_ek/nrf52dk_nrf52832.overlay | 4 +- samples/shields/npm1300_ek/src/main.c | 12 +- 25 files changed, 616 insertions(+), 617 deletions(-) diff --git a/boards/nordic/nrf9131ek/nrf9131ek_nrf9131_ns_defconfig b/boards/nordic/nrf9131ek/nrf9131ek_nrf9131_ns_defconfig index 5690c239b7ba..d15d371416bc 100644 --- a/boards/nordic/nrf9131ek/nrf9131ek_nrf9131_ns_defconfig +++ b/boards/nordic/nrf9131ek/nrf9131ek_nrf9131_ns_defconfig @@ -26,4 +26,3 @@ CONFIG_UART_CONSOLE=y CONFIG_I2C=y CONFIG_REGULATOR=y CONFIG_SENSOR=y -CONFIG_NPM1300_CHARGER=y diff --git a/drivers/gpio/CMakeLists.txt b/drivers/gpio/CMakeLists.txt index 8a5ea48cb65b..08adaf2d640f 100644 --- a/drivers/gpio/CMakeLists.txt +++ b/drivers/gpio/CMakeLists.txt @@ -67,7 +67,7 @@ zephyr_library_sources_ifdef(CONFIG_GPIO_NCT38XX gpio_nct38xx_port.c) zephyr_library_sources_ifdef(CONFIG_GPIO_NCT38XX_ALERT gpio_nct38xx_alert.c) zephyr_library_sources_ifdef(CONFIG_GPIO_NEORV32 gpio_neorv32.c) zephyr_library_sources_ifdef(CONFIG_GPIO_NPCX gpio_npcx.c) -zephyr_library_sources_ifdef(CONFIG_GPIO_NPM1300 gpio_npm13xx.c) +zephyr_library_sources_ifdef(CONFIG_GPIO_NPM13XX gpio_npm13xx.c) zephyr_library_sources_ifdef(CONFIG_GPIO_NPM2100 gpio_npm2100.c) zephyr_library_sources_ifdef(CONFIG_GPIO_NPM6001 gpio_npm6001.c) zephyr_library_sources_ifdef(CONFIG_GPIO_NRFX gpio_nrfx.c) diff --git a/drivers/gpio/Kconfig.npm13xx b/drivers/gpio/Kconfig.npm13xx index 65cb81a36868..828b4e1382f3 100644 --- a/drivers/gpio/Kconfig.npm13xx +++ b/drivers/gpio/Kconfig.npm13xx @@ -1,19 +1,19 @@ # Copyright (c) 2023 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -config GPIO_NPM1300 - bool "nPM1300 GPIO driver" +config GPIO_NPM13XX + bool "nPM13xx GPIO driver" default y depends on DT_HAS_NORDIC_NPM1300_GPIO_ENABLED select I2C select MFD help - Enable the nPM1300 GPIO driver. + Enable the nPM13xx GPIO driver. -config GPIO_NPM1300_INIT_PRIORITY - int "nPM1300 GPIO driver initialization priority" - depends on GPIO_NPM1300 +config GPIO_NPM13XX_INIT_PRIORITY + int "nPM13xx GPIO driver initialization priority" + depends on GPIO_NPM13XX default 85 help - Initialization priority for the nPM1300 GPIO driver. It must be + Initialization priority for the nPM13xx GPIO driver. It must be greater than the I2C controller init priority. diff --git a/drivers/gpio/gpio_npm13xx.c b/drivers/gpio/gpio_npm13xx.c index 40c5aaf10985..c74fc244d937 100644 --- a/drivers/gpio/gpio_npm13xx.c +++ b/drivers/gpio/gpio_npm13xx.c @@ -14,10 +14,10 @@ #include #include -/* nPM1300 GPIO base address */ +/* nPM13xx GPIO base address */ #define NPM_GPIO_BASE 0x06U -/* nPM1300 GPIO registers offsets */ +/* nPM13xx GPIO registers offsets */ #define NPM_GPIO_OFFSET_MODE 0x00U #define NPM_GPIO_OFFSET_DRIVE 0x05U #define NPM_GPIO_OFFSET_PULLUP 0x0AU @@ -26,36 +26,36 @@ #define NPM_GPIO_OFFSET_DEBOUNCE 0x19U #define NPM_GPIO_OFFSET_STATUS 0x1EU -/* nPM1300 Channel counts */ -#define NPM1300_GPIO_PINS 5U - -#define NPM1300_GPIO_GPIINPUT 0 -#define NPM1300_GPIO_GPILOGIC1 1 -#define NPM1300_GPIO_GPILOGIC0 2 -#define NPM1300_GPIO_GPIEVENTRISE 3 -#define NPM1300_GPIO_GPIEVENTFALL 4 -#define NPM1300_GPIO_GPOIRQ 5 -#define NPM1300_GPIO_GPORESET 6 -#define NPM1300_GPIO_GPOPWRLOSSWARN 7 -#define NPM1300_GPIO_GPOLOGIC1 8 -#define NPM1300_GPIO_GPOLOGIC0 9 - -struct gpio_npm1300_config { +/* nPM13xx Channel counts */ +#define NPM13XX_GPIO_PINS 5U + +#define NPM13XX_GPIO_GPIINPUT 0 +#define NPM13XX_GPIO_GPILOGIC1 1 +#define NPM13XX_GPIO_GPILOGIC0 2 +#define NPM13XX_GPIO_GPIEVENTRISE 3 +#define NPM13XX_GPIO_GPIEVENTFALL 4 +#define NPM13XX_GPIO_GPOIRQ 5 +#define NPM13XX_GPIO_GPORESET 6 +#define NPM13XX_GPIO_GPOPWRLOSSWARN 7 +#define NPM13XX_GPIO_GPOLOGIC1 8 +#define NPM13XX_GPIO_GPOLOGIC0 9 + +struct gpio_npm13xx_config { struct gpio_driver_config common; const struct device *mfd; }; -struct gpio_npm1300_data { +struct gpio_npm13xx_data { struct gpio_driver_data common; }; -static int gpio_npm1300_port_get_raw(const struct device *dev, uint32_t *value) +static int gpio_npm13xx_port_get_raw(const struct device *dev, uint32_t *value) { - const struct gpio_npm1300_config *config = dev->config; + const struct gpio_npm13xx_config *config = dev->config; int ret; uint8_t data; - ret = mfd_npm1300_reg_read(config->mfd, NPM_GPIO_BASE, NPM_GPIO_OFFSET_STATUS, &data); + ret = mfd_npm13xx_reg_read(config->mfd, NPM_GPIO_BASE, NPM_GPIO_OFFSET_STATUS, &data); if (ret < 0) { return ret; @@ -66,22 +66,22 @@ static int gpio_npm1300_port_get_raw(const struct device *dev, uint32_t *value) return 0; } -static int gpio_npm1300_port_set_masked_raw(const struct device *dev, gpio_port_pins_t mask, +static int gpio_npm13xx_port_set_masked_raw(const struct device *dev, gpio_port_pins_t mask, gpio_port_value_t value) { - const struct gpio_npm1300_config *config = dev->config; + const struct gpio_npm13xx_config *config = dev->config; int ret = 0; - for (size_t idx = 0; idx < NPM1300_GPIO_PINS; idx++) { + for (size_t idx = 0; idx < NPM13XX_GPIO_PINS; idx++) { if ((mask & BIT(idx)) != 0U) { if ((value & BIT(idx)) != 0U) { - ret = mfd_npm1300_reg_write(config->mfd, NPM_GPIO_BASE, + ret = mfd_npm13xx_reg_write(config->mfd, NPM_GPIO_BASE, NPM_GPIO_OFFSET_MODE + idx, - NPM1300_GPIO_GPOLOGIC1); + NPM13XX_GPIO_GPOLOGIC1); } else { - ret = mfd_npm1300_reg_write(config->mfd, NPM_GPIO_BASE, + ret = mfd_npm13xx_reg_write(config->mfd, NPM_GPIO_BASE, NPM_GPIO_OFFSET_MODE + idx, - NPM1300_GPIO_GPOLOGIC0); + NPM13XX_GPIO_GPOLOGIC0); } if (ret != 0U) { return ret; @@ -92,53 +92,53 @@ static int gpio_npm1300_port_set_masked_raw(const struct device *dev, gpio_port_ return ret; } -static int gpio_npm1300_port_set_bits_raw(const struct device *dev, gpio_port_pins_t pins) +static int gpio_npm13xx_port_set_bits_raw(const struct device *dev, gpio_port_pins_t pins) { - return gpio_npm1300_port_set_masked_raw(dev, pins, pins); + return gpio_npm13xx_port_set_masked_raw(dev, pins, pins); } -static int gpio_npm1300_port_clear_bits_raw(const struct device *dev, gpio_port_pins_t pins) +static int gpio_npm13xx_port_clear_bits_raw(const struct device *dev, gpio_port_pins_t pins) { - return gpio_npm1300_port_set_masked_raw(dev, pins, 0U); + return gpio_npm13xx_port_set_masked_raw(dev, pins, 0U); } -static inline int gpio_npm1300_configure(const struct device *dev, gpio_pin_t pin, +static inline int gpio_npm13xx_configure(const struct device *dev, gpio_pin_t pin, gpio_flags_t flags) { - const struct gpio_npm1300_config *config = dev->config; + const struct gpio_npm13xx_config *config = dev->config; int ret = 0; if (k_is_in_isr()) { return -EWOULDBLOCK; } - if (pin >= NPM1300_GPIO_PINS) { + if (pin >= NPM13XX_GPIO_PINS) { return -EINVAL; } /* Configure mode */ if ((flags & GPIO_INPUT) != 0U) { if (flags & GPIO_ACTIVE_LOW) { - ret = mfd_npm1300_reg_write(config->mfd, NPM_GPIO_BASE, + ret = mfd_npm13xx_reg_write(config->mfd, NPM_GPIO_BASE, NPM_GPIO_OFFSET_MODE + pin, - NPM1300_GPIO_GPIEVENTFALL); + NPM13XX_GPIO_GPIEVENTFALL); } else { - ret = mfd_npm1300_reg_write(config->mfd, NPM_GPIO_BASE, + ret = mfd_npm13xx_reg_write(config->mfd, NPM_GPIO_BASE, NPM_GPIO_OFFSET_MODE + pin, - NPM1300_GPIO_GPIEVENTRISE); + NPM13XX_GPIO_GPIEVENTRISE); } - } else if ((flags & NPM1300_GPIO_WDT_RESET_ON) != 0U) { - ret = mfd_npm1300_reg_write(config->mfd, NPM_GPIO_BASE, NPM_GPIO_OFFSET_MODE + pin, - NPM1300_GPIO_GPORESET); - } else if ((flags & NPM1300_GPIO_PWRLOSSWARN_ON) != 0U) { - ret = mfd_npm1300_reg_write(config->mfd, NPM_GPIO_BASE, NPM_GPIO_OFFSET_MODE + pin, - NPM1300_GPIO_GPOPWRLOSSWARN); + } else if ((flags & NPM13XX_GPIO_WDT_RESET_ON) != 0U) { + ret = mfd_npm13xx_reg_write(config->mfd, NPM_GPIO_BASE, NPM_GPIO_OFFSET_MODE + pin, + NPM13XX_GPIO_GPORESET); + } else if ((flags & NPM13XX_GPIO_PWRLOSSWARN_ON) != 0U) { + ret = mfd_npm13xx_reg_write(config->mfd, NPM_GPIO_BASE, NPM_GPIO_OFFSET_MODE + pin, + NPM13XX_GPIO_GPOPWRLOSSWARN); } else if ((flags & GPIO_OUTPUT_INIT_HIGH) != 0U) { - ret = mfd_npm1300_reg_write(config->mfd, NPM_GPIO_BASE, NPM_GPIO_OFFSET_MODE + pin, - NPM1300_GPIO_GPOLOGIC1); + ret = mfd_npm13xx_reg_write(config->mfd, NPM_GPIO_BASE, NPM_GPIO_OFFSET_MODE + pin, + NPM13XX_GPIO_GPOLOGIC1); } else if ((flags & GPIO_OUTPUT) != 0U) { - ret = mfd_npm1300_reg_write(config->mfd, NPM_GPIO_BASE, NPM_GPIO_OFFSET_MODE + pin, - NPM1300_GPIO_GPOLOGIC0); + ret = mfd_npm13xx_reg_write(config->mfd, NPM_GPIO_BASE, NPM_GPIO_OFFSET_MODE + pin, + NPM13XX_GPIO_GPOLOGIC0); } if (ret < 0) { @@ -146,64 +146,64 @@ static inline int gpio_npm1300_configure(const struct device *dev, gpio_pin_t pi } /* Configure open drain */ - ret = mfd_npm1300_reg_write(config->mfd, NPM_GPIO_BASE, NPM_GPIO_OFFSET_OPENDRAIN + pin, + ret = mfd_npm13xx_reg_write(config->mfd, NPM_GPIO_BASE, NPM_GPIO_OFFSET_OPENDRAIN + pin, !!(flags & GPIO_SINGLE_ENDED)); if (ret < 0) { return ret; } /* Configure pulls */ - ret = mfd_npm1300_reg_write(config->mfd, NPM_GPIO_BASE, NPM_GPIO_OFFSET_PULLUP + pin, + ret = mfd_npm13xx_reg_write(config->mfd, NPM_GPIO_BASE, NPM_GPIO_OFFSET_PULLUP + pin, !!(flags & GPIO_PULL_UP)); if (ret < 0) { return ret; } - ret = mfd_npm1300_reg_write(config->mfd, NPM_GPIO_BASE, NPM_GPIO_OFFSET_PULLDOWN + pin, + ret = mfd_npm13xx_reg_write(config->mfd, NPM_GPIO_BASE, NPM_GPIO_OFFSET_PULLDOWN + pin, !!(flags & GPIO_PULL_DOWN)); if (ret < 0) { return ret; } /* Configure drive strength and debounce */ - ret = mfd_npm1300_reg_write(config->mfd, NPM_GPIO_BASE, NPM_GPIO_OFFSET_DRIVE + pin, - !!(flags & NPM1300_GPIO_DRIVE_6MA)); + ret = mfd_npm13xx_reg_write(config->mfd, NPM_GPIO_BASE, NPM_GPIO_OFFSET_DRIVE + pin, + !!(flags & NPM13XX_GPIO_DRIVE_6MA)); if (ret < 0) { return ret; } - ret = mfd_npm1300_reg_write(config->mfd, NPM_GPIO_BASE, NPM_GPIO_OFFSET_DEBOUNCE + pin, - !!(flags & NPM1300_GPIO_DEBOUNCE_ON)); + ret = mfd_npm13xx_reg_write(config->mfd, NPM_GPIO_BASE, NPM_GPIO_OFFSET_DEBOUNCE + pin, + !!(flags & NPM13XX_GPIO_DEBOUNCE_ON)); return ret; } -static int gpio_npm1300_port_toggle_bits(const struct device *dev, gpio_port_pins_t pins) +static int gpio_npm13xx_port_toggle_bits(const struct device *dev, gpio_port_pins_t pins) { int ret; uint32_t value; - ret = gpio_npm1300_port_get_raw(dev, &value); + ret = gpio_npm13xx_port_get_raw(dev, &value); if (ret < 0) { return ret; } - return gpio_npm1300_port_set_masked_raw(dev, pins, ~value); + return gpio_npm13xx_port_set_masked_raw(dev, pins, ~value); } -static DEVICE_API(gpio, gpio_npm1300_api) = { - .pin_configure = gpio_npm1300_configure, - .port_get_raw = gpio_npm1300_port_get_raw, - .port_set_masked_raw = gpio_npm1300_port_set_masked_raw, - .port_set_bits_raw = gpio_npm1300_port_set_bits_raw, - .port_clear_bits_raw = gpio_npm1300_port_clear_bits_raw, - .port_toggle_bits = gpio_npm1300_port_toggle_bits, +static DEVICE_API(gpio, gpio_npm13xx_api) = { + .pin_configure = gpio_npm13xx_configure, + .port_get_raw = gpio_npm13xx_port_get_raw, + .port_set_masked_raw = gpio_npm13xx_port_set_masked_raw, + .port_set_bits_raw = gpio_npm13xx_port_set_bits_raw, + .port_clear_bits_raw = gpio_npm13xx_port_clear_bits_raw, + .port_toggle_bits = gpio_npm13xx_port_toggle_bits, }; -static int gpio_npm1300_init(const struct device *dev) +static int gpio_npm13xx_init(const struct device *dev) { - const struct gpio_npm1300_config *config = dev->config; + const struct gpio_npm13xx_config *config = dev->config; if (!device_is_ready(config->mfd)) { return -ENODEV; @@ -212,18 +212,18 @@ static int gpio_npm1300_init(const struct device *dev) return 0; } -#define GPIO_NPM1300_DEFINE(n) \ - static const struct gpio_npm1300_config gpio_npm1300_config##n = { \ +#define GPIO_NPM13XX_DEFINE(n) \ + static const struct gpio_npm13xx_config gpio_npm13xx_config##n = { \ .common = \ { \ .port_pin_mask = GPIO_PORT_PIN_MASK_FROM_DT_INST(n), \ }, \ .mfd = DEVICE_DT_GET(DT_INST_PARENT(n))}; \ \ - static struct gpio_npm1300_data gpio_npm1300_data##n; \ + static struct gpio_npm13xx_data gpio_npm13xx_data##n; \ \ - DEVICE_DT_INST_DEFINE(n, gpio_npm1300_init, NULL, &gpio_npm1300_data##n, \ - &gpio_npm1300_config##n, POST_KERNEL, \ - CONFIG_GPIO_NPM1300_INIT_PRIORITY, &gpio_npm1300_api); + DEVICE_DT_INST_DEFINE(n, gpio_npm13xx_init, NULL, &gpio_npm13xx_data##n, \ + &gpio_npm13xx_config##n, POST_KERNEL, \ + CONFIG_GPIO_NPM13XX_INIT_PRIORITY, &gpio_npm13xx_api); -DT_INST_FOREACH_STATUS_OKAY(GPIO_NPM1300_DEFINE) +DT_INST_FOREACH_STATUS_OKAY(GPIO_NPM13XX_DEFINE) diff --git a/drivers/led/CMakeLists.txt b/drivers/led/CMakeLists.txt index c4c0752b2550..1d8b9d2aa960 100644 --- a/drivers/led/CMakeLists.txt +++ b/drivers/led/CMakeLists.txt @@ -12,7 +12,7 @@ zephyr_library_sources_ifdef(CONFIG_IS31FL3733 is31fl3733.c) zephyr_library_sources_ifdef(CONFIG_LED_AXP192_AXP2101 led_axp192.c) zephyr_library_sources_ifdef(CONFIG_LED_DAC led_dac.c) zephyr_library_sources_ifdef(CONFIG_LED_GPIO led_gpio.c) -zephyr_library_sources_ifdef(CONFIG_LED_NPM1300 led_npm13xx.c) +zephyr_library_sources_ifdef(CONFIG_LED_NPM13XX led_npm13xx.c) zephyr_library_sources_ifdef(CONFIG_LED_PWM led_pwm.c) zephyr_library_sources_ifdef(CONFIG_LED_XEC led_mchp_xec.c) zephyr_library_sources_ifdef(CONFIG_LP3943 lp3943.c) diff --git a/drivers/led/Kconfig.npm13xx b/drivers/led/Kconfig.npm13xx index e5180aa1dd1d..e3f40f42a193 100644 --- a/drivers/led/Kconfig.npm13xx +++ b/drivers/led/Kconfig.npm13xx @@ -1,11 +1,11 @@ # Copyright (c) 2023 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -config LED_NPM1300 - bool "nPM1300 LED driver" +config LED_NPM13XX + bool "nPM13xx LED driver" default y depends on DT_HAS_NORDIC_NPM1300_LED_ENABLED select I2C select MFD help - Enable the nPM1300 LED driver. + Enable the nPM13xx LED driver. diff --git a/drivers/led/led_npm13xx.c b/drivers/led/led_npm13xx.c index 9052159e7392..eed9b1256bec 100644 --- a/drivers/led/led_npm13xx.c +++ b/drivers/led/led_npm13xx.c @@ -11,30 +11,30 @@ #include #include -/* nPM1300 LED base address */ +/* nPM13xx LED base address */ #define NPM_LED_BASE 0x0AU -/* nPM1300 LED register offsets */ +/* nPM13xx LED register offsets */ #define NPM_LED_OFFSET_MODE 0x00U #define NPM_LED_OFFSET_SET 0x03U #define NPM_LED_OFFSET_CLR 0x04U -/* nPM1300 Channel counts */ -#define NPM1300_LED_PINS 3U +/* nPM13xx Channel counts */ +#define NPM13XX_LED_PINS 3U -/* nPM1300 LED modes */ +/* nPM13xx LED modes */ #define NPM_LED_HOST 2U -struct led_npm1300_config { +struct led_npm13xx_config { const struct device *mfd; - uint8_t mode[NPM1300_LED_PINS]; + uint8_t mode[NPM13XX_LED_PINS]; }; -static int led_npm1300_on(const struct device *dev, uint32_t led) +static int led_npm13xx_on(const struct device *dev, uint32_t led) { - const struct led_npm1300_config *config = dev->config; + const struct led_npm13xx_config *config = dev->config; - if (led >= NPM1300_LED_PINS) { + if (led >= NPM13XX_LED_PINS) { return -EINVAL; } @@ -42,15 +42,15 @@ static int led_npm1300_on(const struct device *dev, uint32_t led) return -EPERM; } - return mfd_npm1300_reg_write(config->mfd, NPM_LED_BASE, NPM_LED_OFFSET_SET + (led * 2U), + return mfd_npm13xx_reg_write(config->mfd, NPM_LED_BASE, NPM_LED_OFFSET_SET + (led * 2U), 1U); } -static int led_npm1300_off(const struct device *dev, uint32_t led) +static int led_npm13xx_off(const struct device *dev, uint32_t led) { - const struct led_npm1300_config *config = dev->config; + const struct led_npm13xx_config *config = dev->config; - if (led >= NPM1300_LED_PINS) { + if (led >= NPM13XX_LED_PINS) { return -EINVAL; } @@ -58,25 +58,25 @@ static int led_npm1300_off(const struct device *dev, uint32_t led) return -EPERM; } - return mfd_npm1300_reg_write(config->mfd, NPM_LED_BASE, NPM_LED_OFFSET_CLR + (led * 2U), + return mfd_npm13xx_reg_write(config->mfd, NPM_LED_BASE, NPM_LED_OFFSET_CLR + (led * 2U), 1U); } -static DEVICE_API(led, led_npm1300_api) = { - .on = led_npm1300_on, - .off = led_npm1300_off, +static DEVICE_API(led, led_npm13xx_api) = { + .on = led_npm13xx_on, + .off = led_npm13xx_off, }; -static int led_npm1300_init(const struct device *dev) +static int led_npm13xx_init(const struct device *dev) { - const struct led_npm1300_config *config = dev->config; + const struct led_npm13xx_config *config = dev->config; if (!device_is_ready(config->mfd)) { return -ENODEV; } - for (uint8_t led = 0U; led < NPM1300_LED_PINS; led++) { - int ret = mfd_npm1300_reg_write(config->mfd, NPM_LED_BASE, + for (uint8_t led = 0U; led < NPM13XX_LED_PINS; led++) { + int ret = mfd_npm13xx_reg_write(config->mfd, NPM_LED_BASE, NPM_LED_OFFSET_MODE + led, config->mode[led]); if (ret < 0) { @@ -87,14 +87,14 @@ static int led_npm1300_init(const struct device *dev) return 0; } -#define LED_NPM1300_DEFINE(n) \ - static const struct led_npm1300_config led_npm1300_config##n = { \ +#define LED_NPM13XX_DEFINE(n) \ + static const struct led_npm13xx_config led_npm13xx_config##n = { \ .mfd = DEVICE_DT_GET(DT_INST_PARENT(n)), \ .mode = {DT_INST_ENUM_IDX(n, nordic_led0_mode), \ DT_INST_ENUM_IDX(n, nordic_led1_mode), \ DT_INST_ENUM_IDX(n, nordic_led2_mode)}}; \ \ - DEVICE_DT_INST_DEFINE(n, &led_npm1300_init, NULL, NULL, &led_npm1300_config##n, \ - POST_KERNEL, CONFIG_LED_INIT_PRIORITY, &led_npm1300_api); + DEVICE_DT_INST_DEFINE(n, &led_npm13xx_init, NULL, NULL, &led_npm13xx_config##n, \ + POST_KERNEL, CONFIG_LED_INIT_PRIORITY, &led_npm13xx_api); -DT_INST_FOREACH_STATUS_OKAY(LED_NPM1300_DEFINE) +DT_INST_FOREACH_STATUS_OKAY(LED_NPM13XX_DEFINE) diff --git a/drivers/mfd/CMakeLists.txt b/drivers/mfd/CMakeLists.txt index 24a1c698e768..3c477fc7da86 100644 --- a/drivers/mfd/CMakeLists.txt +++ b/drivers/mfd/CMakeLists.txt @@ -6,7 +6,7 @@ zephyr_library() zephyr_library_sources_ifdef(CONFIG_MFD_ADP5585 mfd_adp5585.c) zephyr_library_sources_ifdef(CONFIG_MFD_MAX20335 mfd_max20335.c) zephyr_library_sources_ifdef(CONFIG_MFD_NCT38XX mfd_nct38xx.c) -zephyr_library_sources_ifdef(CONFIG_MFD_NPM1300 mfd_npm13xx.c) +zephyr_library_sources_ifdef(CONFIG_MFD_NPM13XX mfd_npm13xx.c) zephyr_library_sources_ifdef(CONFIG_MFD_NPM2100 mfd_npm2100.c) zephyr_library_sources_ifdef(CONFIG_MFD_NPM6001 mfd_npm6001.c) zephyr_library_sources_ifdef(CONFIG_MFD_AXP192_AXP2101 mfd_axp192.c) diff --git a/drivers/mfd/Kconfig.npm13xx b/drivers/mfd/Kconfig.npm13xx index 56a54f3005ab..63f18ac9a3b3 100644 --- a/drivers/mfd/Kconfig.npm13xx +++ b/drivers/mfd/Kconfig.npm13xx @@ -1,17 +1,17 @@ # Copyright (c) 2023 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -config MFD_NPM1300 - bool "nPM1300 PMIC multi-function device driver" +config MFD_NPM13XX + bool "nPM13xx PMIC multi-function device driver" default y depends on DT_HAS_NORDIC_NPM1300_ENABLED select I2C help - Enable the Nordic nPM1300 PMIC multi-function device driver + Enable the Nordic nPM13xx PMIC multi-function device driver -config MFD_NPM1300_INIT_PRIORITY - int "nPM1300 MFD initialization priority" +config MFD_NPM13XX_INIT_PRIORITY + int "nPM13xx MFD initialization priority" default MFD_INIT_PRIORITY - depends on MFD_NPM1300 + depends on MFD_NPM13XX help - Multi-function device initialization priority for nPM1300. + Multi-function device initialization priority for nPM13xx. diff --git a/drivers/mfd/mfd_npm13xx.c b/drivers/mfd/mfd_npm13xx.c index 21961b1696a6..9847e4a9e495 100644 --- a/drivers/mfd/mfd_npm13xx.c +++ b/drivers/mfd/mfd_npm13xx.c @@ -42,7 +42,7 @@ #define GPIO_MODE_GPOIRQ 5 -struct mfd_npm1300_config { +struct mfd_npm13xx_config { struct i2c_dt_spec i2c; struct gpio_dt_spec host_int_gpios; uint8_t pmic_int_pin; @@ -50,7 +50,7 @@ struct mfd_npm1300_config { uint8_t lp_reset; }; -struct mfd_npm1300_data { +struct mfd_npm13xx_data { struct k_mutex mutex; const struct device *dev; struct gpio_callback gpio_cb; @@ -63,51 +63,51 @@ struct event_reg_t { uint8_t mask; }; -static const struct event_reg_t event_reg[NPM1300_EVENT_MAX] = { - [NPM1300_EVENT_CHG_COMPLETED] = {0x0AU, 0x10U}, - [NPM1300_EVENT_CHG_ERROR] = {0x0AU, 0x20U}, - [NPM1300_EVENT_BATTERY_DETECTED] = {0x0EU, 0x01U}, - [NPM1300_EVENT_BATTERY_REMOVED] = {0x0EU, 0x02U}, - [NPM1300_EVENT_SHIPHOLD_PRESS] = {0x12U, 0x01U}, - [NPM1300_EVENT_SHIPHOLD_RELEASE] = {0x12U, 0x02U}, - [NPM1300_EVENT_WATCHDOG_WARN] = {0x12U, 0x08U}, - [NPM1300_EVENT_VBUS_DETECTED] = {0x16U, 0x01U}, - [NPM1300_EVENT_VBUS_REMOVED] = {0x16U, 0x02U}, - [NPM1300_EVENT_GPIO0_EDGE] = {0x22U, 0x01U}, - [NPM1300_EVENT_GPIO1_EDGE] = {0x22U, 0x02U}, - [NPM1300_EVENT_GPIO2_EDGE] = {0x22U, 0x04U}, - [NPM1300_EVENT_GPIO3_EDGE] = {0x22U, 0x08U}, - [NPM1300_EVENT_GPIO4_EDGE] = {0x22U, 0x10U}, +static const struct event_reg_t event_reg[NPM13XX_EVENT_MAX] = { + [NPM13XX_EVENT_CHG_COMPLETED] = {0x0AU, 0x10U}, + [NPM13XX_EVENT_CHG_ERROR] = {0x0AU, 0x20U}, + [NPM13XX_EVENT_BATTERY_DETECTED] = {0x0EU, 0x01U}, + [NPM13XX_EVENT_BATTERY_REMOVED] = {0x0EU, 0x02U}, + [NPM13XX_EVENT_SHIPHOLD_PRESS] = {0x12U, 0x01U}, + [NPM13XX_EVENT_SHIPHOLD_RELEASE] = {0x12U, 0x02U}, + [NPM13XX_EVENT_WATCHDOG_WARN] = {0x12U, 0x08U}, + [NPM13XX_EVENT_VBUS_DETECTED] = {0x16U, 0x01U}, + [NPM13XX_EVENT_VBUS_REMOVED] = {0x16U, 0x02U}, + [NPM13XX_EVENT_GPIO0_EDGE] = {0x22U, 0x01U}, + [NPM13XX_EVENT_GPIO1_EDGE] = {0x22U, 0x02U}, + [NPM13XX_EVENT_GPIO2_EDGE] = {0x22U, 0x04U}, + [NPM13XX_EVENT_GPIO3_EDGE] = {0x22U, 0x08U}, + [NPM13XX_EVENT_GPIO4_EDGE] = {0x22U, 0x10U}, }; static void gpio_callback(const struct device *dev, struct gpio_callback *cb, uint32_t pins) { - struct mfd_npm1300_data *data = CONTAINER_OF(cb, struct mfd_npm1300_data, gpio_cb); + struct mfd_npm13xx_data *data = CONTAINER_OF(cb, struct mfd_npm13xx_data, gpio_cb); k_work_submit(&data->work); } static void work_callback(struct k_work *work) { - struct mfd_npm1300_data *data = CONTAINER_OF(work, struct mfd_npm1300_data, work); - const struct mfd_npm1300_config *config = data->dev->config; + struct mfd_npm13xx_data *data = CONTAINER_OF(work, struct mfd_npm13xx_data, work); + const struct mfd_npm13xx_config *config = data->dev->config; uint8_t buf[MAIN_SIZE]; int ret; /* Read all MAIN registers into temporary buffer */ - ret = mfd_npm1300_reg_read_burst(data->dev, MAIN_BASE, 0U, buf, sizeof(buf)); + ret = mfd_npm13xx_reg_read_burst(data->dev, MAIN_BASE, 0U, buf, sizeof(buf)); if (ret < 0) { k_work_submit(&data->work); return; } - for (int i = 0; i < NPM1300_EVENT_MAX; i++) { + for (int i = 0; i < NPM13XX_EVENT_MAX; i++) { int offset = event_reg[i].offset + MAIN_OFFSET_CLR; if ((buf[offset] & event_reg[i].mask) != 0U) { gpio_fire_callbacks(&data->callbacks, data->dev, BIT(i)); - ret = mfd_npm1300_reg_write(data->dev, MAIN_BASE, offset, + ret = mfd_npm13xx_reg_write(data->dev, MAIN_BASE, offset, event_reg[i].mask); if (ret < 0) { k_work_submit(&data->work); @@ -122,10 +122,10 @@ static void work_callback(struct k_work *work) } } -static int mfd_npm1300_init(const struct device *dev) +static int mfd_npm13xx_init(const struct device *dev) { - const struct mfd_npm1300_config *config = dev->config; - struct mfd_npm1300_data *mfd_data = dev->data; + const struct mfd_npm13xx_config *config = dev->config; + struct mfd_npm13xx_data *mfd_data = dev->data; int ret; if (!i2c_is_ready_dt(&config->i2c)) { @@ -138,7 +138,7 @@ static int mfd_npm1300_init(const struct device *dev) if (config->host_int_gpios.port != NULL) { /* Set specified PMIC pin to be interrupt output */ - ret = mfd_npm1300_reg_write(dev, GPIO_BASE, GPIO_OFFSET_MODE + config->pmic_int_pin, + ret = mfd_npm13xx_reg_write(dev, GPIO_BASE, GPIO_OFFSET_MODE + config->pmic_int_pin, GPIO_MODE_GPOIRQ); if (ret < 0) { return ret; @@ -171,64 +171,64 @@ static int mfd_npm1300_init(const struct device *dev) } } - ret = mfd_npm1300_reg_write(dev, SHIP_BASE, SHIP_OFFSET_CONFIG, config->active_time); + ret = mfd_npm13xx_reg_write(dev, SHIP_BASE, SHIP_OFFSET_CONFIG, config->active_time); if (ret < 0) { return ret; } - ret = mfd_npm1300_reg_write(dev, SHIP_BASE, SHIP_OFFSET_LPCONFIG, config->lp_reset); + ret = mfd_npm13xx_reg_write(dev, SHIP_BASE, SHIP_OFFSET_LPCONFIG, config->lp_reset); if (ret < 0) { return ret; } - return mfd_npm1300_reg_write(dev, SHIP_BASE, SHIP_OFFSET_CFGSTROBE, 1U); + return mfd_npm13xx_reg_write(dev, SHIP_BASE, SHIP_OFFSET_CFGSTROBE, 1U); } -int mfd_npm1300_reg_read_burst(const struct device *dev, uint8_t base, uint8_t offset, void *data, +int mfd_npm13xx_reg_read_burst(const struct device *dev, uint8_t base, uint8_t offset, void *data, size_t len) { - const struct mfd_npm1300_config *config = dev->config; + const struct mfd_npm13xx_config *config = dev->config; uint8_t buff[] = {base, offset}; return i2c_write_read_dt(&config->i2c, buff, sizeof(buff), data, len); } -int mfd_npm1300_reg_read(const struct device *dev, uint8_t base, uint8_t offset, uint8_t *data) +int mfd_npm13xx_reg_read(const struct device *dev, uint8_t base, uint8_t offset, uint8_t *data) { - return mfd_npm1300_reg_read_burst(dev, base, offset, data, 1U); + return mfd_npm13xx_reg_read_burst(dev, base, offset, data, 1U); } -int mfd_npm1300_reg_write(const struct device *dev, uint8_t base, uint8_t offset, uint8_t data) +int mfd_npm13xx_reg_write(const struct device *dev, uint8_t base, uint8_t offset, uint8_t data) { - const struct mfd_npm1300_config *config = dev->config; + const struct mfd_npm13xx_config *config = dev->config; uint8_t buff[] = {base, offset, data}; return i2c_write_dt(&config->i2c, buff, sizeof(buff)); } -int mfd_npm1300_reg_write2(const struct device *dev, uint8_t base, uint8_t offset, uint8_t data1, +int mfd_npm13xx_reg_write2(const struct device *dev, uint8_t base, uint8_t offset, uint8_t data1, uint8_t data2) { - const struct mfd_npm1300_config *config = dev->config; + const struct mfd_npm13xx_config *config = dev->config; uint8_t buff[] = {base, offset, data1, data2}; return i2c_write_dt(&config->i2c, buff, sizeof(buff)); } -int mfd_npm1300_reg_update(const struct device *dev, uint8_t base, uint8_t offset, uint8_t data, +int mfd_npm13xx_reg_update(const struct device *dev, uint8_t base, uint8_t offset, uint8_t data, uint8_t mask) { - struct mfd_npm1300_data *mfd_data = dev->data; + struct mfd_npm13xx_data *mfd_data = dev->data; uint8_t reg; int ret; k_mutex_lock(&mfd_data->mutex, K_FOREVER); - ret = mfd_npm1300_reg_read(dev, base, offset, ®); + ret = mfd_npm13xx_reg_read(dev, base, offset, ®); if (ret == 0) { reg = (reg & ~mask) | (data & mask); - ret = mfd_npm1300_reg_write(dev, base, offset, reg); + ret = mfd_npm13xx_reg_write(dev, base, offset, reg); } k_mutex_unlock(&mfd_data->mutex); @@ -236,9 +236,9 @@ int mfd_npm1300_reg_update(const struct device *dev, uint8_t base, uint8_t offse return ret; } -int mfd_npm1300_set_timer(const struct device *dev, uint32_t time_ms) +int mfd_npm13xx_set_timer(const struct device *dev, uint32_t time_ms) { - const struct mfd_npm1300_config *config = dev->config; + const struct mfd_npm13xx_config *config = dev->config; uint8_t buff[5] = {TIME_BASE, TIME_OFFSET_TIMER}; uint32_t ticks = time_ms / TIMER_PRESCALER_MS; @@ -254,34 +254,34 @@ int mfd_npm1300_set_timer(const struct device *dev, uint32_t time_ms) return ret; } - return mfd_npm1300_reg_write(dev, TIME_BASE, TIME_OFFSET_LOAD, 1U); + return mfd_npm13xx_reg_write(dev, TIME_BASE, TIME_OFFSET_LOAD, 1U); } -int mfd_npm1300_reset(const struct device *dev) +int mfd_npm13xx_reset(const struct device *dev) { - return mfd_npm1300_reg_write(dev, MAIN_BASE, MAIN_OFFSET_RESET, 1U); + return mfd_npm13xx_reg_write(dev, MAIN_BASE, MAIN_OFFSET_RESET, 1U); } -int mfd_npm1300_hibernate(const struct device *dev, uint32_t time_ms) +int mfd_npm13xx_hibernate(const struct device *dev, uint32_t time_ms) { - int ret = mfd_npm1300_set_timer(dev, time_ms); + int ret = mfd_npm13xx_set_timer(dev, time_ms); if (ret != 0) { return ret; } - return mfd_npm1300_reg_write(dev, SHIP_BASE, SHIP_OFFSET_HIBERNATE, 1U); + return mfd_npm13xx_reg_write(dev, SHIP_BASE, SHIP_OFFSET_HIBERNATE, 1U); } -int mfd_npm1300_add_callback(const struct device *dev, struct gpio_callback *callback) +int mfd_npm13xx_add_callback(const struct device *dev, struct gpio_callback *callback) { - struct mfd_npm1300_data *data = dev->data; + struct mfd_npm13xx_data *data = dev->data; /* Enable interrupts for specified events */ - for (int i = 0; i < NPM1300_EVENT_MAX; i++) { + for (int i = 0; i < NPM13XX_EVENT_MAX; i++) { if ((callback->pin_mask & BIT(i)) != 0U) { /* Clear pending interrupt */ - int ret = mfd_npm1300_reg_write(data->dev, MAIN_BASE, + int ret = mfd_npm13xx_reg_write(data->dev, MAIN_BASE, event_reg[i].offset + MAIN_OFFSET_CLR, event_reg[i].mask); @@ -289,7 +289,7 @@ int mfd_npm1300_add_callback(const struct device *dev, struct gpio_callback *cal return ret; } - ret = mfd_npm1300_reg_write(data->dev, MAIN_BASE, + ret = mfd_npm13xx_reg_write(data->dev, MAIN_BASE, event_reg[i].offset + MAIN_OFFSET_INTENSET, event_reg[i].mask); if (ret < 0) { @@ -301,17 +301,17 @@ int mfd_npm1300_add_callback(const struct device *dev, struct gpio_callback *cal return gpio_manage_callback(&data->callbacks, callback, true); } -int mfd_npm1300_remove_callback(const struct device *dev, struct gpio_callback *callback) +int mfd_npm13xx_remove_callback(const struct device *dev, struct gpio_callback *callback) { - struct mfd_npm1300_data *data = dev->data; + struct mfd_npm13xx_data *data = dev->data; return gpio_manage_callback(&data->callbacks, callback, false); } -#define MFD_NPM1300_DEFINE(inst) \ - static struct mfd_npm1300_data data_##inst; \ +#define MFD_NPM13XX_DEFINE(inst) \ + static struct mfd_npm13xx_data data_##inst; \ \ - static const struct mfd_npm1300_config config##inst = { \ + static const struct mfd_npm13xx_config config##inst = { \ .i2c = I2C_DT_SPEC_INST_GET(inst), \ .host_int_gpios = GPIO_DT_SPEC_INST_GET_OR(inst, host_int_gpios, {0}), \ .pmic_int_pin = DT_INST_PROP_OR(inst, pmic_int_pin, 0), \ @@ -319,7 +319,7 @@ int mfd_npm1300_remove_callback(const struct device *dev, struct gpio_callback * .lp_reset = DT_INST_ENUM_IDX_OR(inst, long_press_reset, 0), \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, mfd_npm1300_init, NULL, &data_##inst, &config##inst, \ - POST_KERNEL, CONFIG_MFD_NPM1300_INIT_PRIORITY, NULL); + DEVICE_DT_INST_DEFINE(inst, mfd_npm13xx_init, NULL, &data_##inst, &config##inst, \ + POST_KERNEL, CONFIG_MFD_NPM13XX_INIT_PRIORITY, NULL); -DT_INST_FOREACH_STATUS_OKAY(MFD_NPM1300_DEFINE) +DT_INST_FOREACH_STATUS_OKAY(MFD_NPM13XX_DEFINE) diff --git a/drivers/regulator/CMakeLists.txt b/drivers/regulator/CMakeLists.txt index 817518d9b2f9..283fd976de73 100644 --- a/drivers/regulator/CMakeLists.txt +++ b/drivers/regulator/CMakeLists.txt @@ -13,7 +13,7 @@ zephyr_library_sources_ifdef(CONFIG_REGULATOR_FIXED regulator_fixed.c) zephyr_library_sources_ifdef(CONFIG_REGULATOR_GPIO regulator_gpio.c) zephyr_library_sources_ifdef(CONFIG_REGULATOR_MAX20335 regulator_max20335.c) zephyr_library_sources_ifdef(CONFIG_REGULATOR_NPM1100 regulator_npm1100.c) -zephyr_library_sources_ifdef(CONFIG_REGULATOR_NPM1300 regulator_npm13xx.c) +zephyr_library_sources_ifdef(CONFIG_REGULATOR_NPM13XX regulator_npm13xx.c) zephyr_library_sources_ifdef(CONFIG_REGULATOR_NPM2100 regulator_npm2100.c) zephyr_library_sources_ifdef(CONFIG_REGULATOR_NPM6001 regulator_npm6001.c) zephyr_library_sources_ifdef(CONFIG_REGULATOR_PCA9420 regulator_pca9420.c) diff --git a/drivers/regulator/Kconfig.npm13xx b/drivers/regulator/Kconfig.npm13xx index 19adee0ebab2..4d243b8cdf84 100644 --- a/drivers/regulator/Kconfig.npm13xx +++ b/drivers/regulator/Kconfig.npm13xx @@ -1,29 +1,29 @@ # Copyright (c) 2023 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -config REGULATOR_NPM1300 - bool "nPM1300 PMIC regulator driver" +config REGULATOR_NPM13XX + bool "nPM13xx PMIC regulator driver" default y depends on DT_HAS_NORDIC_NPM1300_REGULATOR_ENABLED select I2C select MFD help - Enable the Nordic nPM1300 PMIC regulator driver + Enable the Nordic nPM13xx PMIC regulator driver -if REGULATOR_NPM1300 +if REGULATOR_NPM13XX -config REGULATOR_NPM1300_COMMON_INIT_PRIORITY - int "nPM1300 regulator driver init priority (common part)" +config REGULATOR_NPM13XX_COMMON_INIT_PRIORITY + int "nPM13xx regulator driver init priority (common part)" default 85 help - Init priority for the Nordic nPM1300 regulator driver (common part). + Init priority for the Nordic nPM13xx regulator driver (common part). It must be greater than I2C init priority. -config REGULATOR_NPM1300_INIT_PRIORITY - int "nPM1300 regulator driver init priority" +config REGULATOR_NPM13XX_INIT_PRIORITY + int "nPM13xx regulator driver init priority" default 86 help - Init priority for the Nordic nPM1300 regulator driver. It must be - greater than REGULATOR_NPM1300_COMMON_INIT_PRIORITY. + Init priority for the Nordic nPM13xx regulator driver. It must be + greater than REGULATOR_NPM13XX_COMMON_INIT_PRIORITY. endif diff --git a/drivers/regulator/regulator_npm13xx.c b/drivers/regulator/regulator_npm13xx.c index 913f51456af4..89ee1993ed39 100644 --- a/drivers/regulator/regulator_npm13xx.c +++ b/drivers/regulator/regulator_npm13xx.c @@ -15,27 +15,27 @@ #include #include -/* nPM1300 voltage sources */ -enum npm1300_sources { - NPM1300_SOURCE_BUCK1, - NPM1300_SOURCE_BUCK2, - NPM1300_SOURCE_LDO1, - NPM1300_SOURCE_LDO2, +/* nPM13xx voltage sources */ +enum npm13xx_sources { + NPM13XX_SOURCE_BUCK1, + NPM13XX_SOURCE_BUCK2, + NPM13XX_SOURCE_LDO1, + NPM13XX_SOURCE_LDO2, }; -/* nPM1300 gpio control channels */ -enum npm1300_gpio_type { - NPM1300_GPIO_TYPE_ENABLE, - NPM1300_GPIO_TYPE_RETENTION, - NPM1300_GPIO_TYPE_PWM +/* nPM13xx gpio control channels */ +enum npm13xx_gpio_type { + NPM13XX_GPIO_TYPE_ENABLE, + NPM13XX_GPIO_TYPE_RETENTION, + NPM13XX_GPIO_TYPE_PWM }; -/* nPM1300 regulator base addresses */ +/* nPM13xx regulator base addresses */ #define BUCK_BASE 0x04U #define LDSW_BASE 0x08U #define SHIP_BASE 0x0BU -/* nPM1300 regulator register offsets */ +/* nPM13xx regulator register offsets */ #define BUCK_OFFSET_EN_SET 0x00U #define BUCK_OFFSET_EN_CLR 0x01U #define BUCK_OFFSET_PWM_SET 0x04U @@ -50,7 +50,7 @@ enum npm1300_gpio_type { #define BUCK_OFFSET_CTRL0 0x15U #define BUCK_OFFSET_STATUS 0x34U -/* nPM1300 ldsw register offsets */ +/* nPM13xx ldsw register offsets */ #define LDSW_OFFSET_EN_SET 0x00U #define LDSW_OFFSET_EN_CLR 0x01U #define LDSW_OFFSET_STATUS 0x04U @@ -59,7 +59,7 @@ enum npm1300_gpio_type { #define LDSW_OFFSET_LDOSEL 0x08U #define LDSW_OFFSET_VOUTSEL 0x0CU -/* nPM1300 ship register offsets */ +/* nPM13xx ship register offsets */ #define SHIP_OFFSET_SHIP 0x02U #define BUCK1_ON_MASK 0x04U @@ -77,62 +77,62 @@ enum npm1300_gpio_type { #define LDSW2_SOFTSTART_SHIFT 4U #define LDSW2_ACTIVE_DISCHARGE_MASK BIT(7) -#define NPM1300_GPIO_UNUSED UINT8_MAX +#define NPM13XX_GPIO_UNUSED UINT8_MAX -struct npm1300_gpio_info { +struct npm13xx_gpio_info { uint8_t pin; bool invert; }; -struct regulator_npm1300_pconfig { +struct regulator_npm13xx_pconfig { const struct device *mfd; struct gpio_dt_spec dvs_state_pins[5]; }; -struct regulator_npm1300_config { +struct regulator_npm13xx_config { struct regulator_common_config common; const struct device *mfd; uint8_t source; int32_t retention_uv; - struct npm1300_gpio_info enable_gpios; - struct npm1300_gpio_info retention_gpios; - struct npm1300_gpio_info pwm_gpios; + struct npm13xx_gpio_info enable_gpios; + struct npm13xx_gpio_info retention_gpios; + struct npm13xx_gpio_info pwm_gpios; uint8_t soft_start; bool active_discharge; bool ldo_disable_workaround; }; -struct regulator_npm1300_data { +struct regulator_npm13xx_data { struct regulator_common_data data; }; /* Linear range for output voltage, common for all bucks and LDOs on this device */ static const struct linear_range buckldo_range = LINEAR_RANGE_INIT(1000000, 100000, 0U, 23U); -unsigned int regulator_npm1300_count_voltages(const struct device *dev) +unsigned int regulator_npm13xx_count_voltages(const struct device *dev) { - const struct regulator_npm1300_config *config = dev->config; + const struct regulator_npm13xx_config *config = dev->config; switch (config->source) { - case NPM1300_SOURCE_BUCK1: - case NPM1300_SOURCE_BUCK2: - case NPM1300_SOURCE_LDO1: - case NPM1300_SOURCE_LDO2: + case NPM13XX_SOURCE_BUCK1: + case NPM13XX_SOURCE_BUCK2: + case NPM13XX_SOURCE_LDO1: + case NPM13XX_SOURCE_LDO2: return linear_range_values_count(&buckldo_range); default: return 0; } } -int regulator_npm1300_list_voltage(const struct device *dev, unsigned int idx, int32_t *volt_uv) +int regulator_npm13xx_list_voltage(const struct device *dev, unsigned int idx, int32_t *volt_uv) { - const struct regulator_npm1300_config *config = dev->config; + const struct regulator_npm13xx_config *config = dev->config; switch (config->source) { - case NPM1300_SOURCE_BUCK1: - case NPM1300_SOURCE_BUCK2: - case NPM1300_SOURCE_LDO1: - case NPM1300_SOURCE_LDO2: + case NPM13XX_SOURCE_BUCK1: + case NPM13XX_SOURCE_BUCK2: + case NPM13XX_SOURCE_LDO1: + case NPM13XX_SOURCE_LDO2: return linear_range_get_value(&buckldo_range, idx, volt_uv); default: return -EINVAL; @@ -141,16 +141,16 @@ int regulator_npm1300_list_voltage(const struct device *dev, unsigned int idx, i static int retention_set_voltage(const struct device *dev, int32_t retention_uv) { - const struct regulator_npm1300_config *config = dev->config; + const struct regulator_npm13xx_config *config = dev->config; uint16_t idx; uint8_t chan; int ret; switch (config->source) { - case NPM1300_SOURCE_BUCK1: + case NPM13XX_SOURCE_BUCK1: chan = 0U; break; - case NPM1300_SOURCE_BUCK2: + case NPM13XX_SOURCE_BUCK2: chan = 1U; break; default: @@ -163,17 +163,17 @@ static int retention_set_voltage(const struct device *dev, int32_t retention_uv) return ret; } - return mfd_npm1300_reg_write(config->mfd, BUCK_BASE, BUCK_OFFSET_VOUT_RET + (chan * 2U), + return mfd_npm13xx_reg_write(config->mfd, BUCK_BASE, BUCK_OFFSET_VOUT_RET + (chan * 2U), idx); } static int buck_get_voltage_index(const struct device *dev, uint8_t chan, uint8_t *idx) { - const struct regulator_npm1300_config *config = dev->config; + const struct regulator_npm13xx_config *config = dev->config; uint8_t sel; int ret; - ret = mfd_npm1300_reg_read(config->mfd, BUCK_BASE, BUCK_OFFSET_SW_CTRL, &sel); + ret = mfd_npm13xx_reg_read(config->mfd, BUCK_BASE, BUCK_OFFSET_SW_CTRL, &sel); if (ret < 0) { return ret; @@ -181,17 +181,17 @@ static int buck_get_voltage_index(const struct device *dev, uint8_t chan, uint8_ if ((sel >> chan) & 1U) { /* SW control */ - return mfd_npm1300_reg_read(config->mfd, BUCK_BASE, + return mfd_npm13xx_reg_read(config->mfd, BUCK_BASE, BUCK_OFFSET_VOUT_NORM + (chan * 2U), idx); } /* VSET pin control */ - return mfd_npm1300_reg_read(config->mfd, BUCK_BASE, BUCK_OFFSET_VOUT_STAT + chan, idx); + return mfd_npm13xx_reg_read(config->mfd, BUCK_BASE, BUCK_OFFSET_VOUT_STAT + chan, idx); } static int buck_set_voltage(const struct device *dev, uint8_t chan, int32_t min_uv, int32_t max_uv) { - const struct regulator_npm1300_config *config = dev->config; + const struct regulator_npm13xx_config *config = dev->config; uint8_t mask; uint8_t curr_idx; uint16_t idx; @@ -210,7 +210,7 @@ static int buck_set_voltage(const struct device *dev, uint8_t chan, int32_t min_ return ret; } - ret = mfd_npm1300_reg_write(config->mfd, BUCK_BASE, BUCK_OFFSET_VOUT_NORM + (chan * 2U), + ret = mfd_npm13xx_reg_write(config->mfd, BUCK_BASE, BUCK_OFFSET_VOUT_NORM + (chan * 2U), idx); if (ret < 0) { @@ -219,12 +219,12 @@ static int buck_set_voltage(const struct device *dev, uint8_t chan, int32_t min_ /* Enable SW control of buck output */ mask = BIT(chan); - return mfd_npm1300_reg_update(config->mfd, BUCK_BASE, BUCK_OFFSET_SW_CTRL, mask, mask); + return mfd_npm13xx_reg_update(config->mfd, BUCK_BASE, BUCK_OFFSET_SW_CTRL, mask, mask); } static int ldo_set_voltage(const struct device *dev, uint8_t chan, int32_t min_uv, int32_t max_uv) { - const struct regulator_npm1300_config *config = dev->config; + const struct regulator_npm13xx_config *config = dev->config; uint16_t idx; int ret; @@ -234,21 +234,21 @@ static int ldo_set_voltage(const struct device *dev, uint8_t chan, int32_t min_u return ret; } - return mfd_npm1300_reg_write(config->mfd, LDSW_BASE, LDSW_OFFSET_VOUTSEL + chan, idx); + return mfd_npm13xx_reg_write(config->mfd, LDSW_BASE, LDSW_OFFSET_VOUTSEL + chan, idx); } -int regulator_npm1300_set_voltage(const struct device *dev, int32_t min_uv, int32_t max_uv) +int regulator_npm13xx_set_voltage(const struct device *dev, int32_t min_uv, int32_t max_uv) { - const struct regulator_npm1300_config *config = dev->config; + const struct regulator_npm13xx_config *config = dev->config; switch (config->source) { - case NPM1300_SOURCE_BUCK1: + case NPM13XX_SOURCE_BUCK1: return buck_set_voltage(dev, 0, min_uv, max_uv); - case NPM1300_SOURCE_BUCK2: + case NPM13XX_SOURCE_BUCK2: return buck_set_voltage(dev, 1, min_uv, max_uv); - case NPM1300_SOURCE_LDO1: + case NPM13XX_SOURCE_LDO1: return ldo_set_voltage(dev, 0, min_uv, max_uv); - case NPM1300_SOURCE_LDO2: + case NPM13XX_SOURCE_LDO2: return ldo_set_voltage(dev, 1, min_uv, max_uv); default: return -ENODEV; @@ -271,11 +271,11 @@ static int buck_get_voltage(const struct device *dev, uint8_t chan, int32_t *vol static int ldo_get_voltage(const struct device *dev, uint8_t chan, int32_t *volt_uv) { - const struct regulator_npm1300_config *config = dev->config; + const struct regulator_npm13xx_config *config = dev->config; uint8_t idx; int ret; - ret = mfd_npm1300_reg_read(config->mfd, LDSW_BASE, LDSW_OFFSET_VOUTSEL + chan, &idx); + ret = mfd_npm13xx_reg_read(config->mfd, LDSW_BASE, LDSW_OFFSET_VOUTSEL + chan, &idx); if (ret < 0) { return ret; @@ -284,18 +284,18 @@ static int ldo_get_voltage(const struct device *dev, uint8_t chan, int32_t *volt return linear_range_get_value(&buckldo_range, idx, volt_uv); } -int regulator_npm1300_get_voltage(const struct device *dev, int32_t *volt_uv) +int regulator_npm13xx_get_voltage(const struct device *dev, int32_t *volt_uv) { - const struct regulator_npm1300_config *config = dev->config; + const struct regulator_npm13xx_config *config = dev->config; switch (config->source) { - case NPM1300_SOURCE_BUCK1: + case NPM13XX_SOURCE_BUCK1: return buck_get_voltage(dev, 0, volt_uv); - case NPM1300_SOURCE_BUCK2: + case NPM13XX_SOURCE_BUCK2: return buck_get_voltage(dev, 1, volt_uv); - case NPM1300_SOURCE_LDO1: + case NPM13XX_SOURCE_LDO1: return ldo_get_voltage(dev, 0, volt_uv); - case NPM1300_SOURCE_LDO2: + case NPM13XX_SOURCE_LDO2: return ldo_get_voltage(dev, 1, volt_uv); default: return -ENODEV; @@ -304,22 +304,22 @@ int regulator_npm1300_get_voltage(const struct device *dev, int32_t *volt_uv) static int set_buck_mode(const struct device *dev, uint8_t chan, regulator_mode_t mode) { - const struct regulator_npm1300_config *config = dev->config; + const struct regulator_npm13xx_config *config = dev->config; uint8_t pfm_mask = BIT(chan); uint8_t pfm_data; uint8_t pwm_reg; int ret; switch (mode) { - case NPM1300_BUCK_MODE_PWM: + case NPM13XX_BUCK_MODE_PWM: pfm_data = 0U; pwm_reg = BUCK_OFFSET_PWM_SET; break; - case NPM1300_BUCK_MODE_AUTO: + case NPM13XX_BUCK_MODE_AUTO: pfm_data = 0U; pwm_reg = BUCK_OFFSET_PWM_CLR; break; - case NPM1300_BUCK_MODE_PFM: + case NPM13XX_BUCK_MODE_PFM: pfm_data = pfm_mask; pwm_reg = BUCK_OFFSET_PWM_CLR; break; @@ -327,61 +327,61 @@ static int set_buck_mode(const struct device *dev, uint8_t chan, regulator_mode_ return -ENOTSUP; } - ret = mfd_npm1300_reg_update(config->mfd, BUCK_BASE, BUCK_OFFSET_CTRL0, pfm_data, pfm_mask); + ret = mfd_npm13xx_reg_update(config->mfd, BUCK_BASE, BUCK_OFFSET_CTRL0, pfm_data, pfm_mask); if (ret < 0) { return ret; } - return mfd_npm1300_reg_write(config->mfd, BUCK_BASE, pwm_reg + (chan * 2U), 1U); + return mfd_npm13xx_reg_write(config->mfd, BUCK_BASE, pwm_reg + (chan * 2U), 1U); } static int set_ldsw_mode(const struct device *dev, uint8_t chan, regulator_mode_t mode) { - const struct regulator_npm1300_config *config = dev->config; + const struct regulator_npm13xx_config *config = dev->config; switch (mode) { - case NPM1300_LDSW_MODE_LDO: - return mfd_npm1300_reg_write(config->mfd, LDSW_BASE, LDSW_OFFSET_LDOSEL + chan, 1U); - case NPM1300_LDSW_MODE_LDSW: - return mfd_npm1300_reg_write(config->mfd, LDSW_BASE, LDSW_OFFSET_LDOSEL + chan, 0U); + case NPM13XX_LDSW_MODE_LDO: + return mfd_npm13xx_reg_write(config->mfd, LDSW_BASE, LDSW_OFFSET_LDOSEL + chan, 1U); + case NPM13XX_LDSW_MODE_LDSW: + return mfd_npm13xx_reg_write(config->mfd, LDSW_BASE, LDSW_OFFSET_LDOSEL + chan, 0U); default: return -ENOTSUP; } } -int regulator_npm1300_set_mode(const struct device *dev, regulator_mode_t mode) +int regulator_npm13xx_set_mode(const struct device *dev, regulator_mode_t mode) { - const struct regulator_npm1300_config *config = dev->config; + const struct regulator_npm13xx_config *config = dev->config; switch (config->source) { - case NPM1300_SOURCE_BUCK1: + case NPM13XX_SOURCE_BUCK1: return set_buck_mode(dev, 0, mode); - case NPM1300_SOURCE_BUCK2: + case NPM13XX_SOURCE_BUCK2: return set_buck_mode(dev, 1, mode); - case NPM1300_SOURCE_LDO1: + case NPM13XX_SOURCE_LDO1: return set_ldsw_mode(dev, 0, mode); - case NPM1300_SOURCE_LDO2: + case NPM13XX_SOURCE_LDO2: return set_ldsw_mode(dev, 1, mode); default: return -ENOTSUP; } } -int regulator_npm1300_enable(const struct device *dev) +int regulator_npm13xx_enable(const struct device *dev) { - const struct regulator_npm1300_config *config = dev->config; + const struct regulator_npm13xx_config *config = dev->config; int ret; switch (config->source) { - case NPM1300_SOURCE_BUCK1: - return mfd_npm1300_reg_write(config->mfd, BUCK_BASE, BUCK_OFFSET_EN_SET, 1U); - case NPM1300_SOURCE_BUCK2: - return mfd_npm1300_reg_write(config->mfd, BUCK_BASE, BUCK_OFFSET_EN_SET + 2U, 1U); - case NPM1300_SOURCE_LDO1: - ret = mfd_npm1300_reg_write(config->mfd, LDSW_BASE, LDSW_OFFSET_EN_SET, 1U); + case NPM13XX_SOURCE_BUCK1: + return mfd_npm13xx_reg_write(config->mfd, BUCK_BASE, BUCK_OFFSET_EN_SET, 1U); + case NPM13XX_SOURCE_BUCK2: + return mfd_npm13xx_reg_write(config->mfd, BUCK_BASE, BUCK_OFFSET_EN_SET + 2U, 1U); + case NPM13XX_SOURCE_LDO1: + ret = mfd_npm13xx_reg_write(config->mfd, LDSW_BASE, LDSW_OFFSET_EN_SET, 1U); break; - case NPM1300_SOURCE_LDO2: - ret = mfd_npm1300_reg_write(config->mfd, LDSW_BASE, LDSW_OFFSET_EN_SET + 2U, 1U); + case NPM13XX_SOURCE_LDO2: + ret = mfd_npm13xx_reg_write(config->mfd, LDSW_BASE, LDSW_OFFSET_EN_SET + 2U, 1U); break; default: return 0; @@ -395,35 +395,35 @@ int regulator_npm1300_enable(const struct device *dev) uint8_t unused; k_msleep(2); - return mfd_npm1300_reg_read(config->mfd, LDSW_BASE, LDSW_OFFSET_STATUS, &unused); + return mfd_npm13xx_reg_read(config->mfd, LDSW_BASE, LDSW_OFFSET_STATUS, &unused); } return ret; } -int regulator_npm1300_disable(const struct device *dev) +int regulator_npm13xx_disable(const struct device *dev) { - const struct regulator_npm1300_config *config = dev->config; + const struct regulator_npm13xx_config *config = dev->config; switch (config->source) { - case NPM1300_SOURCE_BUCK1: - return mfd_npm1300_reg_write(config->mfd, BUCK_BASE, BUCK_OFFSET_EN_CLR, 1U); - case NPM1300_SOURCE_BUCK2: - return mfd_npm1300_reg_write(config->mfd, BUCK_BASE, BUCK_OFFSET_EN_CLR + 2U, 1U); - case NPM1300_SOURCE_LDO1: - return mfd_npm1300_reg_write(config->mfd, LDSW_BASE, LDSW_OFFSET_EN_CLR, 1U); - case NPM1300_SOURCE_LDO2: - return mfd_npm1300_reg_write(config->mfd, LDSW_BASE, LDSW_OFFSET_EN_CLR + 2U, 1U); + case NPM13XX_SOURCE_BUCK1: + return mfd_npm13xx_reg_write(config->mfd, BUCK_BASE, BUCK_OFFSET_EN_CLR, 1U); + case NPM13XX_SOURCE_BUCK2: + return mfd_npm13xx_reg_write(config->mfd, BUCK_BASE, BUCK_OFFSET_EN_CLR + 2U, 1U); + case NPM13XX_SOURCE_LDO1: + return mfd_npm13xx_reg_write(config->mfd, LDSW_BASE, LDSW_OFFSET_EN_CLR, 1U); + case NPM13XX_SOURCE_LDO2: + return mfd_npm13xx_reg_write(config->mfd, LDSW_BASE, LDSW_OFFSET_EN_CLR + 2U, 1U); default: return 0; } } -static int regulator_npm1300_set_buck_pin_ctrl(const struct device *dev, uint8_t chan, - const struct npm1300_gpio_info *pin_info, - enum npm1300_gpio_type type) +static int regulator_npm13xx_set_buck_pin_ctrl(const struct device *dev, uint8_t chan, + const struct npm13xx_gpio_info *pin_info, + enum npm13xx_gpio_type type) { - const struct regulator_npm1300_config *config = dev->config; + const struct regulator_npm13xx_config *config = dev->config; uint8_t inv = pin_info->invert ? 1 : 0; uint8_t ctrl; uint8_t mask; @@ -444,63 +444,63 @@ static int regulator_npm1300_set_buck_pin_ctrl(const struct device *dev, uint8_t } switch (type) { - case NPM1300_GPIO_TYPE_ENABLE: - return mfd_npm1300_reg_update(config->mfd, BUCK_BASE, BUCK_OFFSET_EN_CTRL, ctrl, + case NPM13XX_GPIO_TYPE_ENABLE: + return mfd_npm13xx_reg_update(config->mfd, BUCK_BASE, BUCK_OFFSET_EN_CTRL, ctrl, mask); - case NPM1300_GPIO_TYPE_PWM: - return mfd_npm1300_reg_update(config->mfd, BUCK_BASE, BUCK_OFFSET_PWM_CTRL, ctrl, + case NPM13XX_GPIO_TYPE_PWM: + return mfd_npm13xx_reg_update(config->mfd, BUCK_BASE, BUCK_OFFSET_PWM_CTRL, ctrl, mask); - case NPM1300_GPIO_TYPE_RETENTION: - return mfd_npm1300_reg_update(config->mfd, BUCK_BASE, BUCK_OFFSET_VRET_CTRL, ctrl, + case NPM13XX_GPIO_TYPE_RETENTION: + return mfd_npm13xx_reg_update(config->mfd, BUCK_BASE, BUCK_OFFSET_VRET_CTRL, ctrl, mask); default: return -ENOTSUP; } } -static int regulator_npm1300_set_ldsw_pin_ctrl(const struct device *dev, uint8_t chan, - const struct npm1300_gpio_info *pin_info, - enum npm1300_gpio_type type) +static int regulator_npm13xx_set_ldsw_pin_ctrl(const struct device *dev, uint8_t chan, + const struct npm13xx_gpio_info *pin_info, + enum npm13xx_gpio_type type) { - const struct regulator_npm1300_config *config = dev->config; + const struct regulator_npm13xx_config *config = dev->config; uint8_t inv = pin_info->invert ? 1 : 0; uint8_t ctrl; - if (type != NPM1300_GPIO_TYPE_ENABLE) { + if (type != NPM13XX_GPIO_TYPE_ENABLE) { return -ENOTSUP; } ctrl = (pin_info->pin + 1U) | (inv << 3U); - return mfd_npm1300_reg_write(config->mfd, LDSW_BASE, LDSW_OFFSET_GPISEL + chan, ctrl); + return mfd_npm13xx_reg_write(config->mfd, LDSW_BASE, LDSW_OFFSET_GPISEL + chan, ctrl); } -int regulator_npm1300_set_pin_ctrl(const struct device *dev, const struct npm1300_gpio_info *info, - enum npm1300_gpio_type type) +int regulator_npm13xx_set_pin_ctrl(const struct device *dev, const struct npm13xx_gpio_info *info, + enum npm13xx_gpio_type type) { - const struct regulator_npm1300_config *config = dev->config; + const struct regulator_npm13xx_config *config = dev->config; - if (info->pin == NPM1300_GPIO_UNUSED) { + if (info->pin == NPM13XX_GPIO_UNUSED) { return 0; } switch (config->source) { - case NPM1300_SOURCE_BUCK1: - return regulator_npm1300_set_buck_pin_ctrl(dev, 0, info, type); - case NPM1300_SOURCE_BUCK2: - return regulator_npm1300_set_buck_pin_ctrl(dev, 1, info, type); - case NPM1300_SOURCE_LDO1: - return regulator_npm1300_set_ldsw_pin_ctrl(dev, 0, info, type); - case NPM1300_SOURCE_LDO2: - return regulator_npm1300_set_ldsw_pin_ctrl(dev, 1, info, type); + case NPM13XX_SOURCE_BUCK1: + return regulator_npm13xx_set_buck_pin_ctrl(dev, 0, info, type); + case NPM13XX_SOURCE_BUCK2: + return regulator_npm13xx_set_buck_pin_ctrl(dev, 1, info, type); + case NPM13XX_SOURCE_LDO1: + return regulator_npm13xx_set_ldsw_pin_ctrl(dev, 0, info, type); + case NPM13XX_SOURCE_LDO2: + return regulator_npm13xx_set_ldsw_pin_ctrl(dev, 1, info, type); default: return -ENODEV; } } -int regulator_npm1300_dvs_state_set(const struct device *dev, regulator_dvs_state_t state) +int regulator_npm13xx_dvs_state_set(const struct device *dev, regulator_dvs_state_t state) { - const struct regulator_npm1300_pconfig *pconfig = dev->config; + const struct regulator_npm13xx_pconfig *pconfig = dev->config; const struct gpio_dt_spec *spec; int ret; @@ -519,21 +519,21 @@ int regulator_npm1300_dvs_state_set(const struct device *dev, regulator_dvs_stat return 0; } -int regulator_npm1300_ship_mode(const struct device *dev) +int regulator_npm13xx_ship_mode(const struct device *dev) { - const struct regulator_npm1300_pconfig *pconfig = dev->config; + const struct regulator_npm13xx_pconfig *pconfig = dev->config; - return mfd_npm1300_reg_write(pconfig->mfd, SHIP_BASE, SHIP_OFFSET_SHIP, 1U); + return mfd_npm13xx_reg_write(pconfig->mfd, SHIP_BASE, SHIP_OFFSET_SHIP, 1U); } static DEVICE_API(regulator_parent, parent_api) = { - .dvs_state_set = regulator_npm1300_dvs_state_set, - .ship_mode = regulator_npm1300_ship_mode, + .dvs_state_set = regulator_npm13xx_dvs_state_set, + .ship_mode = regulator_npm13xx_ship_mode, }; -int regulator_npm1300_common_init(const struct device *dev) +int regulator_npm13xx_common_init(const struct device *dev) { - const struct regulator_npm1300_pconfig *pconfig = dev->config; + const struct regulator_npm13xx_pconfig *pconfig = dev->config; const struct gpio_dt_spec *spec; int ret; @@ -558,10 +558,10 @@ int regulator_npm1300_common_init(const struct device *dev) static int get_enabled_reg(const struct device *dev, uint8_t base, uint8_t offset, uint8_t mask, bool *enabled) { - const struct regulator_npm1300_config *config = dev->config; + const struct regulator_npm13xx_config *config = dev->config; uint8_t data; - int ret = mfd_npm1300_reg_read(config->mfd, base, offset, &data); + int ret = mfd_npm13xx_reg_read(config->mfd, base, offset, &data); if (ret < 0) { return ret; @@ -574,16 +574,16 @@ static int get_enabled_reg(const struct device *dev, uint8_t base, uint8_t offse static int get_enabled(const struct device *dev, bool *enabled) { - const struct regulator_npm1300_config *config = dev->config; + const struct regulator_npm13xx_config *config = dev->config; switch (config->source) { - case NPM1300_SOURCE_BUCK1: + case NPM13XX_SOURCE_BUCK1: return get_enabled_reg(dev, BUCK_BASE, BUCK_OFFSET_STATUS, BUCK1_ON_MASK, enabled); - case NPM1300_SOURCE_BUCK2: + case NPM13XX_SOURCE_BUCK2: return get_enabled_reg(dev, BUCK_BASE, BUCK_OFFSET_STATUS, BUCK2_ON_MASK, enabled); - case NPM1300_SOURCE_LDO1: + case NPM13XX_SOURCE_LDO1: return get_enabled_reg(dev, LDSW_BASE, LDSW_OFFSET_STATUS, LDSW1_ON_MASK, enabled); - case NPM1300_SOURCE_LDO2: + case NPM13XX_SOURCE_LDO2: return get_enabled_reg(dev, LDSW_BASE, LDSW_OFFSET_STATUS, LDSW2_ON_MASK, enabled); default: return -ENODEV; @@ -592,15 +592,15 @@ static int get_enabled(const struct device *dev, bool *enabled) static int soft_start_set(const struct device *dev, uint8_t soft_start) { - const struct regulator_npm1300_config *config = dev->config; + const struct regulator_npm13xx_config *config = dev->config; switch (config->source) { - case NPM1300_SOURCE_LDO1: - return mfd_npm1300_reg_update(config->mfd, LDSW_BASE, LDSW_OFFSET_CONFIG, + case NPM13XX_SOURCE_LDO1: + return mfd_npm13xx_reg_update(config->mfd, LDSW_BASE, LDSW_OFFSET_CONFIG, soft_start << LDSW1_SOFTSTART_SHIFT, LDSW1_SOFTSTART_MASK); - case NPM1300_SOURCE_LDO2: - return mfd_npm1300_reg_update(config->mfd, LDSW_BASE, LDSW_OFFSET_CONFIG, + case NPM13XX_SOURCE_LDO2: + return mfd_npm13xx_reg_update(config->mfd, LDSW_BASE, LDSW_OFFSET_CONFIG, soft_start << LDSW2_SOFTSTART_SHIFT, LDSW2_SOFTSTART_MASK); default: @@ -610,23 +610,23 @@ static int soft_start_set(const struct device *dev, uint8_t soft_start) static int active_discharge_set(const struct device *dev, bool enabled) { - const struct regulator_npm1300_config *config = dev->config; + const struct regulator_npm13xx_config *config = dev->config; switch (config->source) { - case NPM1300_SOURCE_BUCK1: - return mfd_npm1300_reg_update(config->mfd, BUCK_BASE, BUCK_OFFSET_CTRL0, + case NPM13XX_SOURCE_BUCK1: + return mfd_npm13xx_reg_update(config->mfd, BUCK_BASE, BUCK_OFFSET_CTRL0, enabled ? BUCK1_EN_PULLDOWN_MASK : 0, BUCK1_EN_PULLDOWN_MASK); - case NPM1300_SOURCE_BUCK2: - return mfd_npm1300_reg_update(config->mfd, BUCK_BASE, BUCK_OFFSET_CTRL0, + case NPM13XX_SOURCE_BUCK2: + return mfd_npm13xx_reg_update(config->mfd, BUCK_BASE, BUCK_OFFSET_CTRL0, enabled ? BUCK2_EN_PULLDOWN_MASK : 0, BUCK2_EN_PULLDOWN_MASK); - case NPM1300_SOURCE_LDO1: - return mfd_npm1300_reg_update(config->mfd, LDSW_BASE, LDSW_OFFSET_CONFIG, + case NPM13XX_SOURCE_LDO1: + return mfd_npm13xx_reg_update(config->mfd, LDSW_BASE, LDSW_OFFSET_CONFIG, enabled ? LDSW1_ACTIVE_DISCHARGE_MASK : 0, LDSW1_ACTIVE_DISCHARGE_MASK); - case NPM1300_SOURCE_LDO2: - return mfd_npm1300_reg_update(config->mfd, LDSW_BASE, LDSW_OFFSET_CONFIG, + case NPM13XX_SOURCE_LDO2: + return mfd_npm13xx_reg_update(config->mfd, LDSW_BASE, LDSW_OFFSET_CONFIG, enabled ? LDSW2_ACTIVE_DISCHARGE_MASK : 0, LDSW2_ACTIVE_DISCHARGE_MASK); default: @@ -634,9 +634,9 @@ static int active_discharge_set(const struct device *dev, bool enabled) } } -int regulator_npm1300_init(const struct device *dev) +int regulator_npm13xx_init(const struct device *dev) { - const struct regulator_npm1300_config *config = dev->config; + const struct regulator_npm13xx_config *config = dev->config; bool enabled; int ret = 0; @@ -677,18 +677,18 @@ int regulator_npm1300_init(const struct device *dev) } /* Configure GPIO pin control */ - ret = regulator_npm1300_set_pin_ctrl(dev, &config->enable_gpios, NPM1300_GPIO_TYPE_ENABLE); + ret = regulator_npm13xx_set_pin_ctrl(dev, &config->enable_gpios, NPM13XX_GPIO_TYPE_ENABLE); if (ret != 0) { return ret; } - ret = regulator_npm1300_set_pin_ctrl(dev, &config->retention_gpios, - NPM1300_GPIO_TYPE_RETENTION); + ret = regulator_npm13xx_set_pin_ctrl(dev, &config->retention_gpios, + NPM13XX_GPIO_TYPE_RETENTION); if (ret != 0) { return ret; } - ret = regulator_npm1300_set_pin_ctrl(dev, &config->pwm_gpios, NPM1300_GPIO_TYPE_PWM); + ret = regulator_npm13xx_set_pin_ctrl(dev, &config->pwm_gpios, NPM13XX_GPIO_TYPE_PWM); if (ret != 0) { return ret; } @@ -697,28 +697,28 @@ int regulator_npm1300_init(const struct device *dev) } static DEVICE_API(regulator, api) = { - .enable = regulator_npm1300_enable, - .disable = regulator_npm1300_disable, - .count_voltages = regulator_npm1300_count_voltages, - .list_voltage = regulator_npm1300_list_voltage, - .set_voltage = regulator_npm1300_set_voltage, - .get_voltage = regulator_npm1300_get_voltage, - .set_mode = regulator_npm1300_set_mode, + .enable = regulator_npm13xx_enable, + .disable = regulator_npm13xx_disable, + .count_voltages = regulator_npm13xx_count_voltages, + .list_voltage = regulator_npm13xx_list_voltage, + .set_voltage = regulator_npm13xx_set_voltage, + .get_voltage = regulator_npm13xx_get_voltage, + .set_mode = regulator_npm13xx_set_mode, }; #define GPIO_CONFIG_DEFINE(node_id, prop) \ COND_CODE_1(DT_NODE_HAS_PROP(node_id, prop), \ ({DT_PROP_BY_IDX(node_id, prop, 0), \ !!(DT_PROP_BY_IDX(node_id, prop, 1) & GPIO_ACTIVE_LOW)}), \ - ({NPM1300_GPIO_UNUSED, false})) + ({NPM13XX_GPIO_UNUSED, false})) -#define REGULATOR_NPM1300_DEFINE(node_id, id, _source) \ +#define REGULATOR_NPM13XX_DEFINE(node_id, id, _source) \ BUILD_ASSERT(DT_PROP_LEN_OR(node_id, enable_gpio_config, 2) == 2); \ BUILD_ASSERT(DT_PROP_LEN_OR(node_id, retention_gpio_config, 2) == 2); \ BUILD_ASSERT(DT_PROP_LEN_OR(node_id, pwm_gpio_config, 2) == 2); \ - static struct regulator_npm1300_data data_##id; \ + static struct regulator_npm13xx_data data_##id; \ \ - static const struct regulator_npm1300_config config_##id = { \ + static const struct regulator_npm13xx_config config_##id = { \ .common = REGULATOR_DT_COMMON_CONFIG_INIT(node_id), \ .mfd = DEVICE_DT_GET(DT_GPARENT(node_id)), \ .source = _source, \ @@ -730,16 +730,16 @@ static DEVICE_API(regulator, api) = { .active_discharge = DT_PROP(node_id, active_discharge), \ .ldo_disable_workaround = DT_PROP(node_id, nordic_anomaly38_disable_workaround)}; \ \ - DEVICE_DT_DEFINE(node_id, regulator_npm1300_init, NULL, &data_##id, &config_##id, \ - POST_KERNEL, CONFIG_REGULATOR_NPM1300_INIT_PRIORITY, &api); + DEVICE_DT_DEFINE(node_id, regulator_npm13xx_init, NULL, &data_##id, &config_##id, \ + POST_KERNEL, CONFIG_REGULATOR_NPM13XX_INIT_PRIORITY, &api); -#define REGULATOR_NPM1300_DEFINE_COND(inst, child, source) \ +#define REGULATOR_NPM13XX_DEFINE_COND(inst, child, source) \ COND_CODE_1(DT_NODE_EXISTS(DT_INST_CHILD(inst, child)), \ - (REGULATOR_NPM1300_DEFINE(DT_INST_CHILD(inst, child), child##inst, source)), \ + (REGULATOR_NPM13XX_DEFINE(DT_INST_CHILD(inst, child), child##inst, source)), \ ()) -#define REGULATOR_NPM1300_DEFINE_ALL(inst) \ - static const struct regulator_npm1300_pconfig config_##inst = { \ +#define REGULATOR_NPM13XX_DEFINE_ALL(inst) \ + static const struct regulator_npm13xx_pconfig config_##inst = { \ .mfd = DEVICE_DT_GET(DT_INST_PARENT(inst)), \ .dvs_state_pins = {GPIO_DT_SPEC_INST_GET_BY_IDX_OR(inst, dvs_gpios, 0, {0}), \ GPIO_DT_SPEC_INST_GET_BY_IDX_OR(inst, dvs_gpios, 1, {0}), \ @@ -747,13 +747,13 @@ static DEVICE_API(regulator, api) = { GPIO_DT_SPEC_INST_GET_BY_IDX_OR(inst, dvs_gpios, 3, {0}), \ GPIO_DT_SPEC_INST_GET_BY_IDX_OR(inst, dvs_gpios, 4, {0})}}; \ \ - DEVICE_DT_INST_DEFINE(inst, regulator_npm1300_common_init, NULL, NULL, &config_##inst, \ - POST_KERNEL, CONFIG_REGULATOR_NPM1300_COMMON_INIT_PRIORITY, \ + DEVICE_DT_INST_DEFINE(inst, regulator_npm13xx_common_init, NULL, NULL, &config_##inst, \ + POST_KERNEL, CONFIG_REGULATOR_NPM13XX_COMMON_INIT_PRIORITY, \ &parent_api); \ \ - REGULATOR_NPM1300_DEFINE_COND(inst, buck1, NPM1300_SOURCE_BUCK1) \ - REGULATOR_NPM1300_DEFINE_COND(inst, buck2, NPM1300_SOURCE_BUCK2) \ - REGULATOR_NPM1300_DEFINE_COND(inst, ldo1, NPM1300_SOURCE_LDO1) \ - REGULATOR_NPM1300_DEFINE_COND(inst, ldo2, NPM1300_SOURCE_LDO2) + REGULATOR_NPM13XX_DEFINE_COND(inst, buck1, NPM13XX_SOURCE_BUCK1) \ + REGULATOR_NPM13XX_DEFINE_COND(inst, buck2, NPM13XX_SOURCE_BUCK2) \ + REGULATOR_NPM13XX_DEFINE_COND(inst, ldo1, NPM13XX_SOURCE_LDO1) \ + REGULATOR_NPM13XX_DEFINE_COND(inst, ldo2, NPM13XX_SOURCE_LDO2) -DT_INST_FOREACH_STATUS_OKAY(REGULATOR_NPM1300_DEFINE_ALL) +DT_INST_FOREACH_STATUS_OKAY(REGULATOR_NPM13XX_DEFINE_ALL) diff --git a/drivers/sensor/nordic/CMakeLists.txt b/drivers/sensor/nordic/CMakeLists.txt index cfda4b85b474..bd72ded9ccc2 100644 --- a/drivers/sensor/nordic/CMakeLists.txt +++ b/drivers/sensor/nordic/CMakeLists.txt @@ -3,7 +3,7 @@ # zephyr-keep-sorted-start add_subdirectory(temp) -add_subdirectory_ifdef(CONFIG_NPM1300_CHARGER npm13xx_charger) +add_subdirectory_ifdef(CONFIG_NPM13XX_CHARGER npm13xx_charger) add_subdirectory_ifdef(CONFIG_NPM2100_VBAT npm2100_vbat) add_subdirectory_ifdef(CONFIG_QDEC_NRFX qdec_nrfx) # zephyr-keep-sorted-stop diff --git a/drivers/sensor/nordic/npm13xx_charger/Kconfig b/drivers/sensor/nordic/npm13xx_charger/Kconfig index abafa5309504..e511e393fa24 100644 --- a/drivers/sensor/nordic/npm13xx_charger/Kconfig +++ b/drivers/sensor/nordic/npm13xx_charger/Kconfig @@ -2,12 +2,12 @@ # # SPDX-License-Identifier: Apache-2.0 -config NPM1300_CHARGER - bool "NPM1300 Charger" +config NPM13XX_CHARGER + bool "nPM13xx Charger" default y depends on DT_HAS_NORDIC_NPM1300_CHARGER_ENABLED select I2C select MFD select REQUIRES_FULL_LIBC help - Enable NPM1300 charger driver. + Enable nPM13xx charger driver. diff --git a/drivers/sensor/nordic/npm13xx_charger/npm13xx_charger.c b/drivers/sensor/nordic/npm13xx_charger/npm13xx_charger.c index 829ce6a2265b..bf5afe2d3f4e 100644 --- a/drivers/sensor/nordic/npm13xx_charger/npm13xx_charger.c +++ b/drivers/sensor/nordic/npm13xx_charger/npm13xx_charger.c @@ -12,7 +12,7 @@ #include #include -struct npm1300_charger_config { +struct npm13xx_charger_config { const struct device *mfd; int32_t term_microvolt; int32_t term_warm_microvolt; @@ -32,7 +32,7 @@ struct npm1300_charger_config { bool disable_recharge; }; -struct npm1300_charger_data { +struct npm13xx_charger_data { uint16_t voltage; uint16_t current; uint16_t temp; @@ -43,12 +43,12 @@ struct npm1300_charger_data { uint8_t vbus_stat; }; -/* nPM1300 base addresses */ +/* nPM13xx base addresses */ #define CHGR_BASE 0x03U #define ADC_BASE 0x05U #define VBUS_BASE 0x02U -/* nPM1300 charger register offsets */ +/* nPM13xx charger register offsets */ #define CHGR_OFFSET_ERR_CLR 0x00U #define CHGR_OFFSET_EN_SET 0x04U #define CHGR_OFFSET_EN_CLR 0x05U @@ -65,7 +65,7 @@ struct npm1300_charger_data { #define CHGR_OFFSET_ERR_REASON 0x36U #define CHGR_OFFSET_VBATLOW_EN 0x50U -/* nPM1300 ADC register offsets */ +/* nPM13xx ADC register offsets */ #define ADC_OFFSET_TASK_VBAT 0x00U #define ADC_OFFSET_TASK_TEMP 0x01U #define ADC_OFFSET_TASK_DIE 0x02U @@ -75,7 +75,7 @@ struct npm1300_charger_data { #define ADC_OFFSET_RESULTS 0x10U #define ADC_OFFSET_IBAT_EN 0x24U -/* nPM1300 VBUS register offsets */ +/* nPM13xx VBUS register offsets */ #define VBUS_OFFSET_ILIMUPDATE 0x00U #define VBUS_OFFSET_ILIM 0x01U #define VBUS_OFFSET_ILIMSTARTUP 0x02U @@ -149,7 +149,7 @@ static const uint16_t discharge_limits[] = {84U, 415U}; /* Linear range for vbusin current limit */ static const struct linear_range vbus_current_range = LINEAR_RANGE_INIT(100000, 100000, 1U, 15U); -static void calc_temp(const struct npm1300_charger_config *const config, uint16_t code, +static void calc_temp(const struct npm13xx_charger_config *const config, uint16_t code, struct sensor_value *valp) { /* Ref: PS v1.2 Section 7.1.4: Battery temperature (Kelvin) */ @@ -161,7 +161,7 @@ static void calc_temp(const struct npm1300_charger_config *const config, uint16_ (void)sensor_value_from_float(valp, temp); } -static void calc_dietemp(const struct npm1300_charger_config *const config, uint16_t code, +static void calc_dietemp(const struct npm13xx_charger_config *const config, uint16_t code, struct sensor_value *valp) { /* Ref: PS v1.2 Section 7.1.4: Die temperature (Celsius) */ @@ -171,7 +171,7 @@ static void calc_dietemp(const struct npm1300_charger_config *const config, uint (void)sensor_value_from_milli(valp, temp); } -static uint32_t calc_ntc_res(const struct npm1300_charger_config *const config, int32_t temp_mdegc) +static uint32_t calc_ntc_res(const struct npm13xx_charger_config *const config, int32_t temp_mdegc) { float inv_t0 = 1.f / 298.15f; float temp = (float)temp_mdegc / 1000.f; @@ -187,8 +187,8 @@ static uint16_t adc_get_res(uint8_t msb, uint8_t lsb, uint16_t lsb_shift) return ((uint16_t)msb << ADC_MSB_SHIFT) | ((lsb >> lsb_shift) & ADC_LSB_MASK); } -static void calc_current(const struct npm1300_charger_config *const config, - struct npm1300_charger_data *const data, struct sensor_value *valp) +static void calc_current(const struct npm13xx_charger_config *const config, + struct npm13xx_charger_data *const data, struct sensor_value *valp) { int32_t full_scale_ua; int32_t current_ua; @@ -232,11 +232,11 @@ static void calc_current(const struct npm1300_charger_config *const config, (void)sensor_value_from_micro(valp, current_ua); } -int npm1300_charger_channel_get(const struct device *dev, enum sensor_channel chan, +int npm13xx_charger_channel_get(const struct device *dev, enum sensor_channel chan, struct sensor_value *valp) { - const struct npm1300_charger_config *const config = dev->config; - struct npm1300_charger_data *const data = dev->data; + const struct npm13xx_charger_config *const config = dev->config; + struct npm13xx_charger_data *const data = dev->data; switch ((uint32_t)chan) { case SENSOR_CHAN_GAUGE_VOLTAGE: @@ -251,11 +251,11 @@ int npm1300_charger_channel_get(const struct device *dev, enum sensor_channel ch case SENSOR_CHAN_GAUGE_AVG_CURRENT: calc_current(config, data, valp); break; - case SENSOR_CHAN_NPM1300_CHARGER_STATUS: + case SENSOR_CHAN_NPM13XX_CHARGER_STATUS: valp->val1 = data->status; valp->val2 = 0; break; - case SENSOR_CHAN_NPM1300_CHARGER_ERROR: + case SENSOR_CHAN_NPM13XX_CHARGER_ERROR: valp->val1 = data->error; valp->val2 = 0; break; @@ -268,7 +268,7 @@ int npm1300_charger_channel_get(const struct device *dev, enum sensor_channel ch case SENSOR_CHAN_DIE_TEMP: calc_dietemp(config, data->dietemp, valp); break; - case SENSOR_CHAN_NPM1300_CHARGER_VBUS_STATUS: + case SENSOR_CHAN_NPM13XX_CHARGER_VBUS_STATUS: valp->val1 = data->vbus_stat; valp->val2 = 0; break; @@ -279,26 +279,26 @@ int npm1300_charger_channel_get(const struct device *dev, enum sensor_channel ch return 0; } -int npm1300_charger_sample_fetch(const struct device *dev, enum sensor_channel chan) +int npm13xx_charger_sample_fetch(const struct device *dev, enum sensor_channel chan) { - const struct npm1300_charger_config *const config = dev->config; - struct npm1300_charger_data *data = dev->data; + const struct npm13xx_charger_config *const config = dev->config; + struct npm13xx_charger_data *data = dev->data; struct adc_results_t results; int ret; /* Read charge status and error reason */ - ret = mfd_npm1300_reg_read(config->mfd, CHGR_BASE, CHGR_OFFSET_CHG_STAT, &data->status); + ret = mfd_npm13xx_reg_read(config->mfd, CHGR_BASE, CHGR_OFFSET_CHG_STAT, &data->status); if (ret != 0) { return ret; } - ret = mfd_npm1300_reg_read(config->mfd, CHGR_BASE, CHGR_OFFSET_ERR_REASON, &data->error); + ret = mfd_npm13xx_reg_read(config->mfd, CHGR_BASE, CHGR_OFFSET_ERR_REASON, &data->error); if (ret != 0) { return ret; } /* Read adc results */ - ret = mfd_npm1300_reg_read_burst(config->mfd, ADC_BASE, ADC_OFFSET_RESULTS, &results, + ret = mfd_npm13xx_reg_read_burst(config->mfd, ADC_BASE, ADC_OFFSET_RESULTS, &results, sizeof(results)); if (ret != 0) { return ret; @@ -311,19 +311,19 @@ int npm1300_charger_sample_fetch(const struct device *dev, enum sensor_channel c data->ibat_stat = results.ibat_stat; /* Trigger ntc and die temperature measurements */ - ret = mfd_npm1300_reg_write2(config->mfd, ADC_BASE, ADC_OFFSET_TASK_TEMP, 1U, 1U); + ret = mfd_npm13xx_reg_write2(config->mfd, ADC_BASE, ADC_OFFSET_TASK_TEMP, 1U, 1U); if (ret != 0) { return ret; } /* Trigger current and voltage measurement */ - ret = mfd_npm1300_reg_write(config->mfd, ADC_BASE, ADC_OFFSET_TASK_VBAT, 1U); + ret = mfd_npm13xx_reg_write(config->mfd, ADC_BASE, ADC_OFFSET_TASK_VBAT, 1U); if (ret != 0) { return ret; } /* Read vbus status */ - ret = mfd_npm1300_reg_read(config->mfd, VBUS_BASE, VBUS_OFFSET_STATUS, &data->vbus_stat); + ret = mfd_npm13xx_reg_read(config->mfd, VBUS_BASE, VBUS_OFFSET_STATUS, &data->vbus_stat); if (ret != 0) { return ret; } @@ -331,7 +331,7 @@ int npm1300_charger_sample_fetch(const struct device *dev, enum sensor_channel c return ret; } -static int set_ntc_thresholds(const struct npm1300_charger_config *const config) +static int set_ntc_thresholds(const struct npm13xx_charger_config *const config) { for (uint8_t idx = 0U; idx < 4U; idx++) { if (config->temp_thresholds[idx] < INT32_MAX) { @@ -340,7 +340,7 @@ static int set_ntc_thresholds(const struct npm1300_charger_config *const config) /* Ref: Datasheet Figure 14: Equation for battery temperature */ uint16_t code = (1024 * res) / (res + config->thermistor_ohms); - int ret = mfd_npm1300_reg_write2( + int ret = mfd_npm13xx_reg_write2( config->mfd, CHGR_BASE, CHGR_OFFSET_NTC_TEMPS + (idx * 2U), code >> NTCTEMP_MSB_SHIFT, code & NTCTEMP_LSB_MASK); @@ -353,7 +353,7 @@ static int set_ntc_thresholds(const struct npm1300_charger_config *const config) return 0; } -static int set_dietemp_thresholds(const struct npm1300_charger_config *const config) +static int set_dietemp_thresholds(const struct npm13xx_charger_config *const config) { for (uint8_t idx = 0U; idx < 2U; idx++) { if (config->dietemp_thresholds[idx] < INT32_MAX) { @@ -363,7 +363,7 @@ static int set_dietemp_thresholds(const struct npm1300_charger_config *const con DIETEMP_FACTOR_DIV; uint16_t code = DIV_ROUND_CLOSEST(numerator, DIETEMP_FACTOR_MUL); - int ret = mfd_npm1300_reg_write2( + int ret = mfd_npm13xx_reg_write2( config->mfd, CHGR_BASE, CHGR_OFFSET_DIE_TEMPS + (idx * 2U), code >> DIETEMP_MSB_SHIFT, code & DIETEMP_LSB_MASK); @@ -376,10 +376,10 @@ static int set_dietemp_thresholds(const struct npm1300_charger_config *const con return 0; } -static int npm1300_charger_attr_get(const struct device *dev, enum sensor_channel chan, +static int npm13xx_charger_attr_get(const struct device *dev, enum sensor_channel chan, enum sensor_attribute attr, struct sensor_value *val) { - const struct npm1300_charger_config *const config = dev->config; + const struct npm13xx_charger_config *const config = dev->config; uint8_t data; int ret; @@ -389,7 +389,7 @@ static int npm1300_charger_attr_get(const struct device *dev, enum sensor_channe return -ENOTSUP; } - ret = mfd_npm1300_reg_read(config->mfd, CHGR_BASE, CHGR_OFFSET_EN_SET, &data); + ret = mfd_npm13xx_reg_read(config->mfd, CHGR_BASE, CHGR_OFFSET_EN_SET, &data); if (ret == 0) { val->val1 = data; val->val2 = 0U; @@ -401,7 +401,7 @@ static int npm1300_charger_attr_get(const struct device *dev, enum sensor_channe return -ENOTSUP; } - ret = mfd_npm1300_reg_read(config->mfd, VBUS_BASE, VBUS_OFFSET_DETECT, &data); + ret = mfd_npm13xx_reg_read(config->mfd, VBUS_BASE, VBUS_OFFSET_DETECT, &data); if (ret < 0) { return ret; } @@ -418,29 +418,29 @@ static int npm1300_charger_attr_get(const struct device *dev, enum sensor_channe return 0; - case SENSOR_CHAN_NPM1300_CHARGER_VBUS_STATUS: - ret = mfd_npm1300_reg_read(config->mfd, VBUS_BASE, VBUS_OFFSET_STATUS, &data); + case SENSOR_CHAN_NPM13XX_CHARGER_VBUS_STATUS: + ret = mfd_npm13xx_reg_read(config->mfd, VBUS_BASE, VBUS_OFFSET_STATUS, &data); if (ret < 0) { return ret; } - switch ((enum sensor_attribute_npm1300_charger)attr) { - case SENSOR_ATTR_NPM1300_CHARGER_VBUS_PRESENT: + switch ((enum sensor_attribute_npm13xx_charger)attr) { + case SENSOR_ATTR_NPM13XX_CHARGER_VBUS_PRESENT: val->val1 = (data & STATUS_PRESENT_MASK) != 0; break; - case SENSOR_ATTR_NPM1300_CHARGER_VBUS_CUR_LIMIT: + case SENSOR_ATTR_NPM13XX_CHARGER_VBUS_CUR_LIMIT: val->val1 = (data & STATUS_CUR_LIMIT_MASK) != 0; break; - case SENSOR_ATTR_NPM1300_CHARGER_VBUS_OVERVLT_PROT: + case SENSOR_ATTR_NPM13XX_CHARGER_VBUS_OVERVLT_PROT: val->val1 = (data & STATUS_OVERVLT_PROT_MASK) != 0; break; - case SENSOR_ATTR_NPM1300_CHARGER_VBUS_UNDERVLT: + case SENSOR_ATTR_NPM13XX_CHARGER_VBUS_UNDERVLT: val->val1 = (data & STATUS_UNDERVLT_MASK) != 0; break; - case SENSOR_ATTR_NPM1300_CHARGER_VBUS_SUSPENDED: + case SENSOR_ATTR_NPM13XX_CHARGER_VBUS_SUSPENDED: val->val1 = (data & STATUS_SUSPENDED_MASK) != 0; break; - case SENSOR_ATTR_NPM1300_CHARGER_VBUS_BUSOUT: + case SENSOR_ATTR_NPM13XX_CHARGER_VBUS_BUSOUT: val->val1 = (data & STATUS_BUSOUT_MASK) != 0; break; default: @@ -454,10 +454,10 @@ static int npm1300_charger_attr_get(const struct device *dev, enum sensor_channe } } -static int npm1300_charger_attr_set(const struct device *dev, enum sensor_channel chan, +static int npm13xx_charger_attr_set(const struct device *dev, enum sensor_channel chan, enum sensor_attribute attr, const struct sensor_value *val) { - const struct npm1300_charger_config *const config = dev->config; + const struct npm13xx_charger_config *const config = dev->config; int ret; if (attr != SENSOR_ATTR_CONFIGURATION) { @@ -468,16 +468,16 @@ static int npm1300_charger_attr_set(const struct device *dev, enum sensor_channe case SENSOR_CHAN_GAUGE_DESIRED_CHARGING_CURRENT: if (val->val1 == 0) { /* Disable charging */ - return mfd_npm1300_reg_write(config->mfd, CHGR_BASE, CHGR_OFFSET_EN_CLR, + return mfd_npm13xx_reg_write(config->mfd, CHGR_BASE, CHGR_OFFSET_EN_CLR, 1U); } /* Clear any errors and enable charging */ - ret = mfd_npm1300_reg_write(config->mfd, CHGR_BASE, CHGR_OFFSET_ERR_CLR, 1U); + ret = mfd_npm13xx_reg_write(config->mfd, CHGR_BASE, CHGR_OFFSET_ERR_CLR, 1U); if (ret != 0) { return ret; } - return mfd_npm1300_reg_write(config->mfd, CHGR_BASE, CHGR_OFFSET_EN_SET, 1U); + return mfd_npm13xx_reg_write(config->mfd, CHGR_BASE, CHGR_OFFSET_EN_SET, 1U); case SENSOR_CHAN_CURRENT: /* Set vbus current limit */ @@ -490,22 +490,22 @@ static int npm1300_charger_attr_set(const struct device *dev, enum sensor_channe return ret; } - ret = mfd_npm1300_reg_write(config->mfd, VBUS_BASE, VBUS_OFFSET_ILIM, idx); + ret = mfd_npm13xx_reg_write(config->mfd, VBUS_BASE, VBUS_OFFSET_ILIM, idx); if (ret != 0) { return ret; } /* Switch to new current limit, this will be reset automatically on USB removal */ - return mfd_npm1300_reg_write(config->mfd, VBUS_BASE, VBUS_OFFSET_ILIMUPDATE, 1U); + return mfd_npm13xx_reg_write(config->mfd, VBUS_BASE, VBUS_OFFSET_ILIMUPDATE, 1U); default: return -ENOTSUP; } } -int npm1300_charger_init(const struct device *dev) +int npm13xx_charger_init(const struct device *dev) { - const struct npm1300_charger_config *const config = dev->config; + const struct npm13xx_charger_config *const config = dev->config; uint16_t idx; uint8_t byte = 0U; int ret; @@ -515,7 +515,7 @@ int npm1300_charger_init(const struct device *dev) } /* Configure temperature thresholds */ - ret = mfd_npm1300_reg_write(config->mfd, ADC_BASE, ADC_OFFSET_NTCR_SEL, + ret = mfd_npm13xx_reg_write(config->mfd, ADC_BASE, ADC_OFFSET_NTCR_SEL, config->thermistor_idx); if (ret != 0) { return ret; @@ -538,7 +538,7 @@ int npm1300_charger_init(const struct device *dev) if (ret == -EINVAL) { return ret; } - ret = mfd_npm1300_reg_write(config->mfd, CHGR_BASE, CHGR_OFFSET_VTERM, idx); + ret = mfd_npm13xx_reg_write(config->mfd, CHGR_BASE, CHGR_OFFSET_VTERM, idx); if (ret != 0) { return ret; } @@ -550,7 +550,7 @@ int npm1300_charger_init(const struct device *dev) return ret; } - ret = mfd_npm1300_reg_write(config->mfd, CHGR_BASE, CHGR_OFFSET_VTERM_R, idx); + ret = mfd_npm13xx_reg_write(config->mfd, CHGR_BASE, CHGR_OFFSET_VTERM_R, idx); if (ret != 0) { return ret; } @@ -563,13 +563,13 @@ int npm1300_charger_init(const struct device *dev) return ret; } - ret = mfd_npm1300_reg_write2(config->mfd, CHGR_BASE, CHGR_OFFSET_ISET, idx / 2U, idx & 1U); + ret = mfd_npm13xx_reg_write2(config->mfd, CHGR_BASE, CHGR_OFFSET_ISET, idx / 2U, idx & 1U); if (ret != 0) { return ret; } /* Set discharge limit */ - ret = mfd_npm1300_reg_write2(config->mfd, CHGR_BASE, CHGR_OFFSET_ISET_DISCHG, + ret = mfd_npm13xx_reg_write2(config->mfd, CHGR_BASE, CHGR_OFFSET_ISET_DISCHG, discharge_limits[config->dischg_limit_idx] / 2U, discharge_limits[config->dischg_limit_idx] & 1U); if (ret != 0) { @@ -582,52 +582,52 @@ int npm1300_charger_init(const struct device *dev) if (ret == -EINVAL) { return ret; } - ret = mfd_npm1300_reg_write(config->mfd, VBUS_BASE, VBUS_OFFSET_ILIMSTARTUP, idx); + ret = mfd_npm13xx_reg_write(config->mfd, VBUS_BASE, VBUS_OFFSET_ILIMSTARTUP, idx); if (ret != 0) { return ret; } /* Configure trickle voltage threshold */ - ret = mfd_npm1300_reg_write(config->mfd, CHGR_BASE, CHGR_OFFSET_TRICKLE_SEL, + ret = mfd_npm13xx_reg_write(config->mfd, CHGR_BASE, CHGR_OFFSET_TRICKLE_SEL, config->trickle_sel); if (ret != 0) { return ret; } /* Configure termination current */ - ret = mfd_npm1300_reg_write(config->mfd, CHGR_BASE, CHGR_OFFSET_ITERM_SEL, + ret = mfd_npm13xx_reg_write(config->mfd, CHGR_BASE, CHGR_OFFSET_ITERM_SEL, config->iterm_sel); if (ret != 0) { return ret; } /* Enable current measurement */ - ret = mfd_npm1300_reg_write(config->mfd, ADC_BASE, ADC_OFFSET_IBAT_EN, 1U); + ret = mfd_npm13xx_reg_write(config->mfd, ADC_BASE, ADC_OFFSET_IBAT_EN, 1U); if (ret != 0) { return ret; } /* Trigger current and voltage measurement */ - ret = mfd_npm1300_reg_write(config->mfd, ADC_BASE, ADC_OFFSET_TASK_VBAT, 1U); + ret = mfd_npm13xx_reg_write(config->mfd, ADC_BASE, ADC_OFFSET_TASK_VBAT, 1U); if (ret != 0) { return ret; } /* Trigger ntc and die temperature measurements */ - ret = mfd_npm1300_reg_write2(config->mfd, ADC_BASE, ADC_OFFSET_TASK_TEMP, 1U, 1U); + ret = mfd_npm13xx_reg_write2(config->mfd, ADC_BASE, ADC_OFFSET_TASK_TEMP, 1U, 1U); if (ret != 0) { return ret; } /* Enable automatic temperature measurements during charging */ - ret = mfd_npm1300_reg_write(config->mfd, ADC_BASE, ADC_OFFSET_TASK_AUTO, 1U); + ret = mfd_npm13xx_reg_write(config->mfd, ADC_BASE, ADC_OFFSET_TASK_AUTO, 1U); if (ret != 0) { return ret; } /* Enable charging at low battery if configured */ if (config->vbatlow_charge_enable) { - ret = mfd_npm1300_reg_write(config->mfd, CHGR_BASE, CHGR_OFFSET_VBATLOW_EN, 1U); + ret = mfd_npm13xx_reg_write(config->mfd, CHGR_BASE, CHGR_OFFSET_VBATLOW_EN, 1U); if (ret != 0) { return ret; } @@ -643,14 +643,14 @@ int npm1300_charger_init(const struct device *dev) WRITE_BIT(byte, 1U, true); } - ret = mfd_npm1300_reg_write(config->mfd, CHGR_BASE, CHGR_OFFSET_DIS_SET, byte); + ret = mfd_npm13xx_reg_write(config->mfd, CHGR_BASE, CHGR_OFFSET_DIS_SET, byte); if (ret != 0) { return ret; } /* Enable charging if configured */ if (config->charging_enable) { - ret = mfd_npm1300_reg_write(config->mfd, CHGR_BASE, CHGR_OFFSET_EN_SET, 1U); + ret = mfd_npm13xx_reg_write(config->mfd, CHGR_BASE, CHGR_OFFSET_EN_SET, 1U); if (ret != 0) { return ret; } @@ -659,19 +659,19 @@ int npm1300_charger_init(const struct device *dev) return 0; } -static DEVICE_API(sensor, npm1300_charger_battery_driver_api) = { - .sample_fetch = npm1300_charger_sample_fetch, - .channel_get = npm1300_charger_channel_get, - .attr_set = npm1300_charger_attr_set, - .attr_get = npm1300_charger_attr_get, +static DEVICE_API(sensor, npm13xx_charger_battery_driver_api) = { + .sample_fetch = npm13xx_charger_sample_fetch, + .channel_get = npm13xx_charger_channel_get, + .attr_set = npm13xx_charger_attr_set, + .attr_get = npm13xx_charger_attr_get, }; -#define NPM1300_CHARGER_INIT(n) \ +#define NPM13XX_CHARGER_INIT(n) \ BUILD_ASSERT(DT_INST_ENUM_IDX(n, dischg_limit_microamp) < ARRAY_SIZE(discharge_limits)); \ \ - static struct npm1300_charger_data npm1300_charger_data_##n; \ + static struct npm13xx_charger_data npm13xx_charger_data_##n; \ \ - static const struct npm1300_charger_config npm1300_charger_config_##n = { \ + static const struct npm13xx_charger_config npm13xx_charger_config_##n = { \ .mfd = DEVICE_DT_GET(DT_INST_PARENT(n)), \ .term_microvolt = DT_INST_PROP(n, term_microvolt), \ .term_warm_microvolt = \ @@ -696,9 +696,9 @@ static DEVICE_API(sensor, npm1300_charger_battery_driver_api) = { DT_INST_PROP_OR(n, thermistor_warm_millidegrees, INT32_MAX), \ DT_INST_PROP_OR(n, thermistor_hot_millidegrees, INT32_MAX)}}; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(n, &npm1300_charger_init, NULL, &npm1300_charger_data_##n, \ - &npm1300_charger_config_##n, POST_KERNEL, \ + SENSOR_DEVICE_DT_INST_DEFINE(n, &npm13xx_charger_init, NULL, &npm13xx_charger_data_##n, \ + &npm13xx_charger_config_##n, POST_KERNEL, \ CONFIG_SENSOR_INIT_PRIORITY, \ - &npm1300_charger_battery_driver_api); + &npm13xx_charger_battery_driver_api); -DT_INST_FOREACH_STATUS_OKAY(NPM1300_CHARGER_INIT) +DT_INST_FOREACH_STATUS_OKAY(NPM13XX_CHARGER_INIT) diff --git a/drivers/watchdog/CMakeLists.txt b/drivers/watchdog/CMakeLists.txt index 4d6f75e4d9e5..e247de4e9fe0 100644 --- a/drivers/watchdog/CMakeLists.txt +++ b/drivers/watchdog/CMakeLists.txt @@ -28,7 +28,7 @@ zephyr_library_sources_ifdef(CONFIG_WDT_MCUX_WDOG wdt_mcux_wdog.c) zephyr_library_sources_ifdef(CONFIG_WDT_MCUX_WDOG32 wdt_mcux_wdog32.c) zephyr_library_sources_ifdef(CONFIG_WDT_MCUX_WWDT wdt_mcux_wwdt.c) zephyr_library_sources_ifdef(CONFIG_WDT_NPCX wdt_npcx.c) -zephyr_library_sources_ifdef(CONFIG_WDT_NPM1300 wdt_npm13xx.c) +zephyr_library_sources_ifdef(CONFIG_WDT_NPM13XX wdt_npm13xx.c) zephyr_library_sources_ifdef(CONFIG_WDT_NPM2100 wdt_npm2100.c) zephyr_library_sources_ifdef(CONFIG_WDT_NPM6001 wdt_npm6001.c) zephyr_library_sources_ifdef(CONFIG_WDT_NRFX wdt_nrfx.c) diff --git a/drivers/watchdog/Kconfig.npm13xx b/drivers/watchdog/Kconfig.npm13xx index b18e4b69b13a..2318349c85e3 100644 --- a/drivers/watchdog/Kconfig.npm13xx +++ b/drivers/watchdog/Kconfig.npm13xx @@ -1,19 +1,19 @@ # Copyright (c) 2023 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -config WDT_NPM1300 - bool "nPM1300 Watchdog driver" +config WDT_NPM13XX + bool "nPM13xx Watchdog driver" default y depends on DT_HAS_NORDIC_NPM1300_WDT_ENABLED select I2C select MFD help - Enable nPM1300 Watchdog driver + Enable nPM13xx Watchdog driver -config WDT_NPM1300_INIT_PRIORITY - int "nPM1300 Watchdog driver initialization priority" - depends on WDT_NPM1300 +config WDT_NPM13XX_INIT_PRIORITY + int "nPM13xx Watchdog driver initialization priority" + depends on WDT_NPM13XX default 85 help - Initialization priority for the nPM1300 Watchdog driver. - It must be greater than GPIO_NPM1300_INIT_PRIORITY. + Initialization priority for the nPM13xx Watchdog driver. + It must be greater than GPIO_NPM13XX_INIT_PRIORITY. diff --git a/drivers/watchdog/wdt_npm13xx.c b/drivers/watchdog/wdt_npm13xx.c index 6dc9f2d49ea4..cfbee7f33982 100644 --- a/drivers/watchdog/wdt_npm13xx.c +++ b/drivers/watchdog/wdt_npm13xx.c @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -#define DT_DRV_COMPAT nordic_npm1300_wdt +#define DT_DRV_COMPAT nordic_npm13xx_wdt #include @@ -13,49 +13,49 @@ #include #include -/* nPM1300 TIMER base address */ +/* nPM13xx TIMER base address */ #define TIME_BASE 0x07U -/* nPM1300 timer register offsets */ +/* nPM13xx timer register offsets */ #define TIME_OFFSET_START 0x00U #define TIME_OFFSET_STOP 0x01U #define TIME_OFFSET_WDOG_KICK 0x04U #define TIME_OFFSET_MODE 0x05U -/* nPM1300 timer modes */ +/* nPM13xx timer modes */ #define TIME_MODE_BOOT 0x00U #define TIME_MODE_WARN 0x01U #define TIME_MODE_RESET 0x02U #define TIME_MODE_GEN 0x03U -struct wdt_npm1300_config { +struct wdt_npm13xx_config { const struct device *mfd; struct gpio_dt_spec reset_gpios; }; -struct wdt_npm1300_data { +struct wdt_npm13xx_data { bool timeout_valid; }; -static int wdt_npm1300_setup(const struct device *dev, uint8_t options) +static int wdt_npm13xx_setup(const struct device *dev, uint8_t options) { - const struct wdt_npm1300_config *config = dev->config; - struct wdt_npm1300_data *data = dev->data; + const struct wdt_npm13xx_config *config = dev->config; + struct wdt_npm13xx_data *data = dev->data; if (!data->timeout_valid) { return -EINVAL; } - return mfd_npm1300_reg_write(config->mfd, TIME_BASE, TIME_OFFSET_START, 1U); + return mfd_npm13xx_reg_write(config->mfd, TIME_BASE, TIME_OFFSET_START, 1U); } -static int wdt_npm1300_disable(const struct device *dev) +static int wdt_npm13xx_disable(const struct device *dev) { - const struct wdt_npm1300_config *config = dev->config; - struct wdt_npm1300_data *data = dev->data; + const struct wdt_npm13xx_config *config = dev->config; + struct wdt_npm13xx_data *data = dev->data; int ret; - ret = mfd_npm1300_reg_write(config->mfd, TIME_BASE, TIME_OFFSET_STOP, 1U); + ret = mfd_npm13xx_reg_write(config->mfd, TIME_BASE, TIME_OFFSET_STOP, 1U); if (ret < 0) { return ret; } @@ -65,11 +65,11 @@ static int wdt_npm1300_disable(const struct device *dev) return 0; } -static int wdt_npm1300_install_timeout(const struct device *dev, +static int wdt_npm13xx_install_timeout(const struct device *dev, const struct wdt_timeout_cfg *timeout) { - const struct wdt_npm1300_config *config = dev->config; - struct wdt_npm1300_data *data = dev->data; + const struct wdt_npm13xx_config *config = dev->config; + struct wdt_npm13xx_data *data = dev->data; uint8_t mode; int ret; @@ -81,7 +81,7 @@ static int wdt_npm1300_install_timeout(const struct device *dev, return -EINVAL; } - ret = mfd_npm1300_set_timer(config->mfd, timeout->window.max); + ret = mfd_npm13xx_set_timer(config->mfd, timeout->window.max); if (ret < 0) { return ret; } @@ -103,7 +103,7 @@ static int wdt_npm1300_install_timeout(const struct device *dev, return -EINVAL; } - ret = mfd_npm1300_reg_write(config->mfd, TIME_BASE, TIME_OFFSET_MODE, mode); + ret = mfd_npm13xx_reg_write(config->mfd, TIME_BASE, TIME_OFFSET_MODE, mode); if (ret < 0) { return ret; } @@ -113,27 +113,27 @@ static int wdt_npm1300_install_timeout(const struct device *dev, return 0; } -static int wdt_npm1300_feed(const struct device *dev, int channel_id) +static int wdt_npm13xx_feed(const struct device *dev, int channel_id) { - const struct wdt_npm1300_config *config = dev->config; + const struct wdt_npm13xx_config *config = dev->config; if (channel_id != 0) { return -EINVAL; } - return mfd_npm1300_reg_write(config->mfd, TIME_BASE, TIME_OFFSET_WDOG_KICK, 1U); + return mfd_npm13xx_reg_write(config->mfd, TIME_BASE, TIME_OFFSET_WDOG_KICK, 1U); } -static DEVICE_API(wdt, wdt_npm1300_api) = { - .setup = wdt_npm1300_setup, - .disable = wdt_npm1300_disable, - .install_timeout = wdt_npm1300_install_timeout, - .feed = wdt_npm1300_feed, +static DEVICE_API(wdt, wdt_npm13xx_api) = { + .setup = wdt_npm13xx_setup, + .disable = wdt_npm13xx_disable, + .install_timeout = wdt_npm13xx_install_timeout, + .feed = wdt_npm13xx_feed, }; -static int wdt_npm1300_init(const struct device *dev) +static int wdt_npm13xx_init(const struct device *dev) { - const struct wdt_npm1300_config *config = dev->config; + const struct wdt_npm13xx_config *config = dev->config; int ret; if (!device_is_ready(config->mfd)) { @@ -145,7 +145,7 @@ static int wdt_npm1300_init(const struct device *dev) return -ENODEV; } - ret = gpio_pin_configure_dt(&config->reset_gpios, NPM1300_GPIO_WDT_RESET_ON); + ret = gpio_pin_configure_dt(&config->reset_gpios, NPM13XX_GPIO_WDT_RESET_ON); if (ret != 0) { return ret; } @@ -154,15 +154,15 @@ static int wdt_npm1300_init(const struct device *dev) return 0; } -#define WDT_NPM1300_DEFINE(n) \ - static struct wdt_npm1300_data data##n; \ +#define WDT_NPM13XX_DEFINE(n) \ + static struct wdt_npm13xx_data data##n; \ \ - static const struct wdt_npm1300_config config##n = { \ + static const struct wdt_npm13xx_config config##n = { \ .mfd = DEVICE_DT_GET(DT_INST_PARENT(n)), \ .reset_gpios = GPIO_DT_SPEC_INST_GET_OR(n, reset_gpios, {0}), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, &wdt_npm1300_init, NULL, &data##n, &config##n, POST_KERNEL, \ - CONFIG_WDT_NPM1300_INIT_PRIORITY, &wdt_npm1300_api); + DEVICE_DT_INST_DEFINE(n, &wdt_npm13xx_init, NULL, &data##n, &config##n, POST_KERNEL, \ + CONFIG_WDT_NPM13XX_INIT_PRIORITY, &wdt_npm13xx_api); -DT_INST_FOREACH_STATUS_OKAY(WDT_NPM1300_DEFINE) +DT_INST_FOREACH_STATUS_OKAY(WDT_NPM13XX_DEFINE) diff --git a/include/zephyr/drivers/mfd/npm13xx.h b/include/zephyr/drivers/mfd/npm13xx.h index a1b941a4fb73..b9e6d5120f67 100644 --- a/include/zephyr/drivers/mfd/npm13xx.h +++ b/include/zephyr/drivers/mfd/npm13xx.h @@ -11,7 +11,7 @@ extern "C" { #endif /** - * @defgroup mdf_interface_npm1300 MFD NPM1300 Interface + * @defgroup mfd_interface_npm13xx MFD NPM13XX Interface * @ingroup mfd_interfaces * @{ */ @@ -22,28 +22,28 @@ extern "C" { #include #include -enum mfd_npm1300_event_t { - NPM1300_EVENT_CHG_COMPLETED, - NPM1300_EVENT_CHG_ERROR, - NPM1300_EVENT_BATTERY_DETECTED, - NPM1300_EVENT_BATTERY_REMOVED, - NPM1300_EVENT_SHIPHOLD_PRESS, - NPM1300_EVENT_SHIPHOLD_RELEASE, - NPM1300_EVENT_WATCHDOG_WARN, - NPM1300_EVENT_VBUS_DETECTED, - NPM1300_EVENT_VBUS_REMOVED, - NPM1300_EVENT_GPIO0_EDGE, - NPM1300_EVENT_GPIO1_EDGE, - NPM1300_EVENT_GPIO2_EDGE, - NPM1300_EVENT_GPIO3_EDGE, - NPM1300_EVENT_GPIO4_EDGE, - NPM1300_EVENT_MAX +enum mfd_npm13xx_event_t { + NPM13XX_EVENT_CHG_COMPLETED, + NPM13XX_EVENT_CHG_ERROR, + NPM13XX_EVENT_BATTERY_DETECTED, + NPM13XX_EVENT_BATTERY_REMOVED, + NPM13XX_EVENT_SHIPHOLD_PRESS, + NPM13XX_EVENT_SHIPHOLD_RELEASE, + NPM13XX_EVENT_WATCHDOG_WARN, + NPM13XX_EVENT_VBUS_DETECTED, + NPM13XX_EVENT_VBUS_REMOVED, + NPM13XX_EVENT_GPIO0_EDGE, + NPM13XX_EVENT_GPIO1_EDGE, + NPM13XX_EVENT_GPIO2_EDGE, + NPM13XX_EVENT_GPIO3_EDGE, + NPM13XX_EVENT_GPIO4_EDGE, + NPM13XX_EVENT_MAX }; /** - * @brief Read multiple registers from npm1300 + * @brief Read multiple registers from npm13xx * - * @param dev npm1300 mfd device + * @param dev npm13xx mfd device * @param base Register base address (bits 15..8 of 16-bit address) * @param offset Register offset address (bits 7..0 of 16-bit address) * @param data Pointer to buffer for received data @@ -51,37 +51,37 @@ enum mfd_npm1300_event_t { * @retval 0 If successful * @retval -errno In case of any bus error (see i2c_write_read_dt()) */ -int mfd_npm1300_reg_read_burst(const struct device *dev, uint8_t base, uint8_t offset, void *data, +int mfd_npm13xx_reg_read_burst(const struct device *dev, uint8_t base, uint8_t offset, void *data, size_t len); /** - * @brief Read single register from npm1300 + * @brief Read single register from npm13xx * - * @param dev npm1300 mfd device + * @param dev npm13xx mfd device * @param base Register base address (bits 15..8 of 16-bit address) * @param offset Register offset address (bits 7..0 of 16-bit address) * @param data Pointer to buffer for received data * @retval 0 If successful * @retval -errno In case of any bus error (see i2c_write_read_dt()) */ -int mfd_npm1300_reg_read(const struct device *dev, uint8_t base, uint8_t offset, uint8_t *data); +int mfd_npm13xx_reg_read(const struct device *dev, uint8_t base, uint8_t offset, uint8_t *data); /** - * @brief Write single register to npm1300 + * @brief Write single register to npm13xx * - * @param dev npm1300 mfd device + * @param dev npm13xx mfd device * @param base Register base address (bits 15..8 of 16-bit address) * @param offset Register offset address (bits 7..0 of 16-bit address) * @param data data to write * @retval 0 If successful * @retval -errno In case of any bus error (see i2c_write_dt()) */ -int mfd_npm1300_reg_write(const struct device *dev, uint8_t base, uint8_t offset, uint8_t data); +int mfd_npm13xx_reg_write(const struct device *dev, uint8_t base, uint8_t offset, uint8_t data); /** - * @brief Write two registers to npm1300 + * @brief Write two registers to npm13xx * - * @param dev npm1300 mfd device + * @param dev npm13xx mfd device * @param base Register base address (bits 15..8 of 16-bit address) * @param offset Register offset address (bits 7..0 of 16-bit address) * @param data1 first byte of data to write @@ -89,13 +89,13 @@ int mfd_npm1300_reg_write(const struct device *dev, uint8_t base, uint8_t offset * @retval 0 If successful * @retval -errno In case of any bus error (see i2c_write_dt()) */ -int mfd_npm1300_reg_write2(const struct device *dev, uint8_t base, uint8_t offset, uint8_t data1, +int mfd_npm13xx_reg_write2(const struct device *dev, uint8_t base, uint8_t offset, uint8_t data1, uint8_t data2); /** - * @brief Update selected bits in npm1300 register + * @brief Update selected bits in npm13xx register * - * @param dev npm1300 mfd device + * @param dev npm13xx mfd device * @param base Register base address (bits 15..8 of 16-bit address) * @param offset Register offset address (bits 7..0 of 16-bit address) * @param data data to write @@ -103,59 +103,59 @@ int mfd_npm1300_reg_write2(const struct device *dev, uint8_t base, uint8_t offse * @retval 0 If successful * @retval -errno In case of any bus error (see i2c_write_read_dt(), i2c_write_dt()) */ -int mfd_npm1300_reg_update(const struct device *dev, uint8_t base, uint8_t offset, uint8_t data, +int mfd_npm13xx_reg_update(const struct device *dev, uint8_t base, uint8_t offset, uint8_t data, uint8_t mask); /** - * @brief Write npm1300 timer register + * @brief Write npm13xx timer register * - * @param dev npm1300 mfd device + * @param dev npm13xx mfd device * @param time_ms timer value in ms * @retval 0 If successful * @retval -EINVAL if time value is too large * @retval -errno In case of any bus error (see i2c_write_dt()) */ -int mfd_npm1300_set_timer(const struct device *dev, uint32_t time_ms); +int mfd_npm13xx_set_timer(const struct device *dev, uint32_t time_ms); /** - * @brief npm1300 full power reset + * @brief npm13xx full power reset * - * @param dev npm1300 mfd device + * @param dev npm13xx mfd device * @retval 0 If successful * @retval -errno In case of any bus error (see i2c_write_dt()) */ -int mfd_npm1300_reset(const struct device *dev); +int mfd_npm13xx_reset(const struct device *dev); /** - * @brief npm1300 hibernate + * @brief npm13xx hibernate * * Enters low power state, and wakes after specified time * - * @param dev npm1300 mfd device + * @param dev npm13xx mfd device * @param time_ms timer value in ms * @retval 0 If successful * @retval -EINVAL if time value is too large * @retval -errno In case of any bus error (see i2c_write_dt()) */ -int mfd_npm1300_hibernate(const struct device *dev, uint32_t time_ms); +int mfd_npm13xx_hibernate(const struct device *dev, uint32_t time_ms); /** - * @brief Add npm1300 event callback + * @brief Add npm13xx event callback * - * @param dev npm1300 mfd device + * @param dev npm13xx mfd device * @param callback callback * @return 0 on success, -errno on failure */ -int mfd_npm1300_add_callback(const struct device *dev, struct gpio_callback *callback); +int mfd_npm13xx_add_callback(const struct device *dev, struct gpio_callback *callback); /** - * @brief Remove npm1300 event callback + * @brief Remove npm13xx event callback * - * @param dev npm1300 mfd device + * @param dev npm13xx mfd device * @param callback callback * @return 0 on success, -errno on failure */ -int mfd_npm1300_remove_callback(const struct device *dev, struct gpio_callback *callback); +int mfd_npm13xx_remove_callback(const struct device *dev, struct gpio_callback *callback); /** @} */ diff --git a/include/zephyr/drivers/sensor/npm13xx_charger.h b/include/zephyr/drivers/sensor/npm13xx_charger.h index 05176b361226..b3319096dd19 100644 --- a/include/zephyr/drivers/sensor/npm13xx_charger.h +++ b/include/zephyr/drivers/sensor/npm13xx_charger.h @@ -8,21 +8,21 @@ #include -/* NPM1300 charger specific channels */ -enum sensor_channel_npm1300_charger { - SENSOR_CHAN_NPM1300_CHARGER_STATUS = SENSOR_CHAN_PRIV_START, - SENSOR_CHAN_NPM1300_CHARGER_ERROR, - SENSOR_CHAN_NPM1300_CHARGER_VBUS_STATUS, +/* NPM13XX charger specific channels */ +enum sensor_channel_npm13xx_charger { + SENSOR_CHAN_NPM13XX_CHARGER_STATUS = SENSOR_CHAN_PRIV_START, + SENSOR_CHAN_NPM13XX_CHARGER_ERROR, + SENSOR_CHAN_NPM13XX_CHARGER_VBUS_STATUS, }; -/* NPM1300 charger specific attributes */ -enum sensor_attribute_npm1300_charger { - SENSOR_ATTR_NPM1300_CHARGER_VBUS_PRESENT = SENSOR_ATTR_PRIV_START, - SENSOR_ATTR_NPM1300_CHARGER_VBUS_CUR_LIMIT, - SENSOR_ATTR_NPM1300_CHARGER_VBUS_OVERVLT_PROT, - SENSOR_ATTR_NPM1300_CHARGER_VBUS_UNDERVLT, - SENSOR_ATTR_NPM1300_CHARGER_VBUS_SUSPENDED, - SENSOR_ATTR_NPM1300_CHARGER_VBUS_BUSOUT, +/* NPM13XX charger specific attributes */ +enum sensor_attribute_npm13xx_charger { + SENSOR_ATTR_NPM13XX_CHARGER_VBUS_PRESENT = SENSOR_ATTR_PRIV_START, + SENSOR_ATTR_NPM13XX_CHARGER_VBUS_CUR_LIMIT, + SENSOR_ATTR_NPM13XX_CHARGER_VBUS_OVERVLT_PROT, + SENSOR_ATTR_NPM13XX_CHARGER_VBUS_UNDERVLT, + SENSOR_ATTR_NPM13XX_CHARGER_VBUS_SUSPENDED, + SENSOR_ATTR_NPM13XX_CHARGER_VBUS_BUSOUT, }; #endif diff --git a/include/zephyr/dt-bindings/gpio/nordic-npm13xx-gpio.h b/include/zephyr/dt-bindings/gpio/nordic-npm13xx-gpio.h index 8e99213702b7..41097b741b26 100644 --- a/include/zephyr/dt-bindings/gpio/nordic-npm13xx-gpio.h +++ b/include/zephyr/dt-bindings/gpio/nordic-npm13xx-gpio.h @@ -7,8 +7,8 @@ #define ZEPHYR_INCLUDE_DT_BINDINGS_GPIO_NORDIC_NPM13XX_GPIO_H_ /** - * @brief nPM1300-specific GPIO Flags - * @defgroup gpio_interface_npm1300 nPM1300-specific GPIO Flags + * @brief nPM13xx-specific GPIO Flags + * @defgroup gpio_interface_npm13xx nPM13xx-specific GPIO Flags * * The drive flags are encoded in the 8 upper bits of @ref gpio_dt_flags_t as * follows: @@ -23,74 +23,74 @@ */ /** - * @name nPM1300 GPIO drive strength flags - * @brief nPM1300 GPIO drive strength flags + * @name nPM13xx GPIO drive strength flags + * @brief nPM13xx GPIO drive strength flags * @{ */ /** @cond INTERNAL_HIDDEN */ /** Drive mode field mask */ -#define NPM1300_GPIO_DRIVE_MSK 0x0100U +#define NPM13XX_GPIO_DRIVE_MSK 0x0100U /** @endcond */ /** 1mA drive */ -#define NPM1300_GPIO_DRIVE_1MA (0U << 8U) +#define NPM13XX_GPIO_DRIVE_1MA (0U << 8U) /** 6mA drive */ -#define NPM1300_GPIO_DRIVE_6MA (1U << 8U) +#define NPM13XX_GPIO_DRIVE_6MA (1U << 8U) /** @} */ /** - * @name nPM1300 GPIO debounce flags - * @brief nPM1300 GPIO debounce flags + * @name nPM13xx GPIO debounce flags + * @brief nPM13xx GPIO debounce flags * @{ */ /** @cond INTERNAL_HIDDEN */ /** Debounce field mask */ -#define NPM1300_GPIO_DEBOUNCE_MSK 0x0200U +#define NPM13XX_GPIO_DEBOUNCE_MSK 0x0200U /** @endcond */ /** Normal drive */ -#define NPM1300_GPIO_DEBOUNCE_OFF (0U << 9U) +#define NPM13XX_GPIO_DEBOUNCE_OFF (0U << 9U) /** High drive */ -#define NPM1300_GPIO_DEBOUNCE_ON (1U << 9U) +#define NPM13XX_GPIO_DEBOUNCE_ON (1U << 9U) /** @} */ /** - * @name nPM1300 GPIO watchdog reset flags - * @brief nPM1300 GPIO watchdog reset flags + * @name nPM13xx GPIO watchdog reset flags + * @brief nPM13xx GPIO watchdog reset flags * @{ */ /** @cond INTERNAL_HIDDEN */ /** watchdog reset field mask */ -#define NPM1300_GPIO_WDT_RESET_MSK 0x0400U +#define NPM13XX_GPIO_WDT_RESET_MSK 0x0400U /** @endcond */ /** Off */ -#define NPM1300_GPIO_WDT_RESET_OFF (0U << 10U) +#define NPM13XX_GPIO_WDT_RESET_OFF (0U << 10U) /** On */ -#define NPM1300_GPIO_WDT_RESET_ON (1U << 10U) +#define NPM13XX_GPIO_WDT_RESET_ON (1U << 10U) /** @} */ /** - * @name nPM1300 GPIO power loss warning flags - * @brief nPM1300 GPIO power loss warning flags + * @name nPM13xx GPIO power loss warning flags + * @brief nPM13xx GPIO power loss warning flags * @{ */ /** @cond INTERNAL_HIDDEN */ /** power loss warning field mask */ -#define NPM1300_GPIO_PWRLOSSWARN_MSK 0x0800U +#define NPM13XX_GPIO_PWRLOSSWARN_MSK 0x0800U /** @endcond */ /** Off */ -#define NPM1300_GPIO_PWRLOSSWARN_OFF (0U << 11U) +#define NPM13XX_GPIO_PWRLOSSWARN_OFF (0U << 11U) /** On */ -#define NPM1300_GPIO_PWRLOSSWARN_ON (1U << 11U) +#define NPM13XX_GPIO_PWRLOSSWARN_ON (1U << 11U) /** @} */ diff --git a/include/zephyr/dt-bindings/regulator/npm13xx.h b/include/zephyr/dt-bindings/regulator/npm13xx.h index e24283dceaba..19890261b8a8 100644 --- a/include/zephyr/dt-bindings/regulator/npm13xx.h +++ b/include/zephyr/dt-bindings/regulator/npm13xx.h @@ -8,31 +8,31 @@ #define ZEPHYR_INCLUDE_DT_BINDINGS_REGULATOR_NPM13XX_H_ /** - * @defgroup regulator_npm1300 NPM1300 Devicetree helpers. + * @defgroup regulator_npm13xx nPM13xx Devicetree helpers. * @ingroup regulator_interface * @{ */ /** - * @name NPM1300 Regulator modes + * @name nPM13xx Regulator modes * @{ */ /* Buck modes */ -#define NPM1300_BUCK_MODE_AUTO 0x00U -#define NPM1300_BUCK_MODE_PWM 0x01U -#define NPM1300_BUCK_MODE_PFM 0x04U +#define NPM13XX_BUCK_MODE_AUTO 0x00U +#define NPM13XX_BUCK_MODE_PWM 0x01U +#define NPM13XX_BUCK_MODE_PFM 0x04U /* LDSW / LDO modes */ -#define NPM1300_LDSW_MODE_LDO 0x02U -#define NPM1300_LDSW_MODE_LDSW 0x03U +#define NPM13XX_LDSW_MODE_LDO 0x02U +#define NPM13XX_LDSW_MODE_LDSW 0x03U /* GPIO control configuration */ -#define NPM1300_GPIO_CHAN_NONE 0x00U -#define NPM1300_GPIO_CHAN_0 0x01U -#define NPM1300_GPIO_CHAN_1 0x02U -#define NPM1300_GPIO_CHAN_2 0x03U -#define NPM1300_GPIO_CHAN_3 0x04U -#define NPM1300_GPIO_CHAN_4 0x05U +#define NPM13XX_GPIO_CHAN_NONE 0x00U +#define NPM13XX_GPIO_CHAN_0 0x01U +#define NPM13XX_GPIO_CHAN_1 0x02U +#define NPM13XX_GPIO_CHAN_2 0x03U +#define NPM13XX_GPIO_CHAN_3 0x04U +#define NPM13XX_GPIO_CHAN_4 0x05U /** @} */ diff --git a/samples/shields/npm1300_ek/nrf52dk_nrf52832.overlay b/samples/shields/npm1300_ek/nrf52dk_nrf52832.overlay index 7bcc1bef5a46..e4f2cca20ce5 100644 --- a/samples/shields/npm1300_ek/nrf52dk_nrf52832.overlay +++ b/samples/shields/npm1300_ek/nrf52dk_nrf52832.overlay @@ -26,12 +26,12 @@ }; &npm1300_ek_ldo1 { - regulator-initial-mode = ; + regulator-initial-mode = ; enable-gpio-config = <2 GPIO_ACTIVE_LOW>; }; &npm1300_ek_ldo2 { - regulator-initial-mode = ; + regulator-initial-mode = ; enable-gpio-config = <2 GPIO_ACTIVE_LOW>; }; diff --git a/samples/shields/npm1300_ek/src/main.c b/samples/shields/npm1300_ek/src/main.c index ac2a6ca245b1..9ecffb69e219 100644 --- a/samples/shields/npm1300_ek/src/main.c +++ b/samples/shields/npm1300_ek/src/main.c @@ -68,9 +68,9 @@ void configure_events(void) /* Setup callback for shiphold button press */ static struct gpio_callback event_cb; - gpio_init_callback(&event_cb, event_callback, BIT(NPM1300_EVENT_SHIPHOLD_PRESS)); + gpio_init_callback(&event_cb, event_callback, BIT(NPM13XX_EVENT_SHIPHOLD_PRESS)); - mfd_npm1300_add_callback(pmic, &event_cb); + mfd_npm13xx_add_callback(pmic, &event_cb); } void read_sensors(void) @@ -86,11 +86,11 @@ void read_sensors(void) sensor_channel_get(charger, SENSOR_CHAN_GAUGE_VOLTAGE, &volt); sensor_channel_get(charger, SENSOR_CHAN_GAUGE_AVG_CURRENT, ¤t); sensor_channel_get(charger, SENSOR_CHAN_GAUGE_TEMP, &temp); - sensor_channel_get(charger, (enum sensor_channel)SENSOR_CHAN_NPM1300_CHARGER_STATUS, + sensor_channel_get(charger, (enum sensor_channel)SENSOR_CHAN_NPM13XX_CHARGER_STATUS, &status); - sensor_channel_get(charger, (enum sensor_channel)SENSOR_CHAN_NPM1300_CHARGER_ERROR, &error); - sensor_attr_get(charger, (enum sensor_channel)SENSOR_CHAN_NPM1300_CHARGER_VBUS_STATUS, - (enum sensor_attribute)SENSOR_ATTR_NPM1300_CHARGER_VBUS_PRESENT, + sensor_channel_get(charger, (enum sensor_channel)SENSOR_CHAN_NPM13XX_CHARGER_ERROR, &error); + sensor_attr_get(charger, (enum sensor_channel)SENSOR_CHAN_NPM13XX_CHARGER_VBUS_STATUS, + (enum sensor_attribute)SENSOR_ATTR_NPM13XX_CHARGER_VBUS_PRESENT, &vbus_present); printk("V: %d.%03d ", volt.val1, volt.val2 / 1000); From 0ebf53410c2f811c93db101ee17a1e2914261ee8 Mon Sep 17 00:00:00 2001 From: Sergei Ovchinnikov Date: Tue, 29 Apr 2025 07:58:33 +0200 Subject: [PATCH 0103/2141] [nrf fromtree] dts: bindings: add npm1304 extracting common from npm1300 Add nPM1304 device tree bindings. Extract the properties common to nPM1300 and nPM1304 into npm13xx-common files. Signed-off-by: Sergei Ovchinnikov (cherry picked from commit 34188c4336cf3ea74d2e01a93cb37a3022591e57) --- dts/bindings/gpio/nordic,npm1304-gpio.yaml | 12 +++ dts/bindings/led/nordic,npm1300-led.yaml | 28 +------ dts/bindings/led/nordic,npm1304-led.yaml | 13 +++ .../led/nordic,npm13xx-led-common.yaml | 32 +++++++ dts/bindings/mfd/nordic,npm1300.yaml | 38 +-------- dts/bindings/mfd/nordic,npm1304.yaml | 8 ++ dts/bindings/mfd/nordic,npm13xx-common.yaml | 42 ++++++++++ .../regulator/nordic,npm1300-regulator.yaml | 80 +----------------- .../regulator/nordic,npm1304-regulator.yaml | 35 ++++++++ .../nordic,npm13xx-regulator-common.yaml | 84 +++++++++++++++++++ .../sensor/nordic,npm1300-charger.yaml | 79 +---------------- .../sensor/nordic,npm1304-charger.yaml | 48 +++++++++++ .../sensor/nordic,npm13xx-charger-common.yaml | 83 ++++++++++++++++++ dts/bindings/watchdog/nordic,npm1304-wdt.yaml | 13 +++ 14 files changed, 374 insertions(+), 221 deletions(-) create mode 100644 dts/bindings/gpio/nordic,npm1304-gpio.yaml create mode 100644 dts/bindings/led/nordic,npm1304-led.yaml create mode 100644 dts/bindings/led/nordic,npm13xx-led-common.yaml create mode 100644 dts/bindings/mfd/nordic,npm1304.yaml create mode 100644 dts/bindings/mfd/nordic,npm13xx-common.yaml create mode 100644 dts/bindings/regulator/nordic,npm1304-regulator.yaml create mode 100644 dts/bindings/regulator/nordic,npm13xx-regulator-common.yaml create mode 100644 dts/bindings/sensor/nordic,npm1304-charger.yaml create mode 100644 dts/bindings/sensor/nordic,npm13xx-charger-common.yaml create mode 100644 dts/bindings/watchdog/nordic,npm1304-wdt.yaml diff --git a/dts/bindings/gpio/nordic,npm1304-gpio.yaml b/dts/bindings/gpio/nordic,npm1304-gpio.yaml new file mode 100644 index 000000000000..a6ff1a4656c3 --- /dev/null +++ b/dts/bindings/gpio/nordic,npm1304-gpio.yaml @@ -0,0 +1,12 @@ +# Copyright (c) 2025 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: nPM1304 GPIO Controller + +compatible: "nordic,npm1304-gpio" + +include: gpio-controller.yaml + +gpio-cells: + - pin + - flags diff --git a/dts/bindings/led/nordic,npm1300-led.yaml b/dts/bindings/led/nordic,npm1300-led.yaml index 90c420832f9d..3c240a94e35f 100644 --- a/dts/bindings/led/nordic,npm1300-led.yaml +++ b/dts/bindings/led/nordic,npm1300-led.yaml @@ -10,30 +10,4 @@ description: | compatible: "nordic,npm1300-led" -properties: - nordic,led0-mode: - type: string - required: true - enum: - - error - - charging - - host - description: LED 0 mode - - nordic,led1-mode: - type: string - required: true - enum: - - error - - charging - - host - description: LED 1 mode - - nordic,led2-mode: - type: string - required: true - enum: - - error - - charging - - host - description: LED 2 mode +include: "nordic,npm13xx-led-common.yaml" diff --git a/dts/bindings/led/nordic,npm1304-led.yaml b/dts/bindings/led/nordic,npm1304-led.yaml new file mode 100644 index 000000000000..d0e66857465e --- /dev/null +++ b/dts/bindings/led/nordic,npm1304-led.yaml @@ -0,0 +1,13 @@ +# Copyright (c) 2025 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: | + Nordic nPM1304 LED controller + + The nPM1304 has three LED outputs. + Each LED can automatically display error or charging status, + or be controlled by software. + +compatible: "nordic,npm1304-led" + +include: "nordic,npm13xx-led-common.yaml" diff --git a/dts/bindings/led/nordic,npm13xx-led-common.yaml b/dts/bindings/led/nordic,npm13xx-led-common.yaml new file mode 100644 index 000000000000..6171258d7853 --- /dev/null +++ b/dts/bindings/led/nordic,npm13xx-led-common.yaml @@ -0,0 +1,32 @@ +# Copyright (c) 2025 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: Nordic nPM13xx LED controller common properties + +properties: + nordic,led0-mode: + type: string + required: true + enum: + - error + - charging + - host + description: LED 0 mode + + nordic,led1-mode: + type: string + required: true + enum: + - error + - charging + - host + description: LED 1 mode + + nordic,led2-mode: + type: string + required: true + enum: + - error + - charging + - host + description: LED 2 mode diff --git a/dts/bindings/mfd/nordic,npm1300.yaml b/dts/bindings/mfd/nordic,npm1300.yaml index 1fdfb42ef93b..accd7887c95c 100644 --- a/dts/bindings/mfd/nordic,npm1300.yaml +++ b/dts/bindings/mfd/nordic,npm1300.yaml @@ -5,40 +5,4 @@ description: Nordic nPM1300 compatible: "nordic,npm1300" -include: i2c-device.yaml - -properties: - reg: - required: true - - host-int-gpios: - type: phandle-array - description: Host pin for interrupt input - - pmic-int-pin: - type: int - description: Pmic pin number for interrupt output - - ship-to-active-time-ms: - type: int - description: | - Press duration required to wake from ship / hibernate in ms. - The default is the device powerup value. - enum: - - 16 - - 32 - - 64 - - 96 - - 304 - - 608 - - 1008 - - 3008 - default: 96 - - long-press-reset: - type: string - description: Long press reset configuration - enum: - - "one-button" - - "disabled" - - "two-button" +include: "nordic,npm13xx-common.yaml" diff --git a/dts/bindings/mfd/nordic,npm1304.yaml b/dts/bindings/mfd/nordic,npm1304.yaml new file mode 100644 index 000000000000..a861cd79e486 --- /dev/null +++ b/dts/bindings/mfd/nordic,npm1304.yaml @@ -0,0 +1,8 @@ +# Copyright (c) 2025 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: Nordic nPM1304 + +compatible: "nordic,npm1304" + +include: nordic,npm13xx-common.yaml diff --git a/dts/bindings/mfd/nordic,npm13xx-common.yaml b/dts/bindings/mfd/nordic,npm13xx-common.yaml new file mode 100644 index 000000000000..ed2bf7cbf684 --- /dev/null +++ b/dts/bindings/mfd/nordic,npm13xx-common.yaml @@ -0,0 +1,42 @@ +# Copyright (c) 2025 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: Nordic nPM13xx common properties + +include: i2c-device.yaml + +properties: + reg: + required: true + + host-int-gpios: + type: phandle-array + description: Host pin for interrupt input + + pmic-int-pin: + type: int + description: Pmic pin number for interrupt output + + ship-to-active-time-ms: + type: int + description: | + Press duration required to wake from ship / hibernate in ms. + The default is the device powerup value. + enum: + - 16 + - 32 + - 64 + - 96 + - 304 + - 608 + - 1008 + - 3008 + default: 96 + + long-press-reset: + type: string + description: Long press reset configuration + enum: + - "one-button" + - "disabled" + - "two-button" diff --git a/dts/bindings/regulator/nordic,npm1300-regulator.yaml b/dts/bindings/regulator/nordic,npm1300-regulator.yaml index 1b77f6c1ab43..e42199b68ddf 100644 --- a/dts/bindings/regulator/nordic,npm1300-regulator.yaml +++ b/dts/bindings/regulator/nordic,npm1300-regulator.yaml @@ -32,82 +32,4 @@ description: | compatible: "nordic,npm1300-regulator" -include: base.yaml - -properties: - dvs-gpios: - type: phandle-array - description: | - List of SOC GPIOs connected to PMIC GPIOs. - Set_dvs_mode will drive these pins as follows: - DVS mode 1 will enable the first pin - DVS mode 2 will enable the second pin - DVS mode 3 will drive the first and second pins - etc. - The effect of the mode change is defined by the enable-gpios - and pwm_gpios fields for each of the regulator blocks. - -child-binding: - include: - - name: regulator.yaml - property-allowlist: - - regulator-always-on - - regulator-boot-on - - regulator-boot-off - - regulator-min-microvolt - - regulator-max-microvolt - - regulator-init-microvolt - - regulator-allowed-modes - - regulator-initial-mode - - regulator-min-microamp - - regulator-max-microamp - - startup-delay-us - - off-on-delay-us - - properties: - retention-microvolt: - type: int - description: | - Retention mode voltage in microvolts. - - enable-gpio-config: - type: array - description: | - Regulator enable controlled by specified GPIO pin . - When set regulator must be enabled/disabled using set_dvs_mode. - - pwm-gpio-config: - type: array - description: | - Regulator enable controlled by specified GPIO pin . - When set regulator must be enabled/disabled using set_dvs_mode. - - retention-gpio-config: - type: array - description: | - Retention mode controlled by specified GPIO pin . - - soft-start-microamp: - type: int - enum: - - 10000 - - 20000 - - 35000 - - 50000 - description: | - Soft start current limit in microamps. - - active-discharge: - type: boolean - description: | - Enable active-discharge on the BUCK/LDO/LDSW output when disabled. - - nordic,anomaly38-disable-workaround: - type: boolean - description: | - Disable the SW workaround for nPM1300 anomaly #38. - When nPM1300 is in ULP mode, LDO is supplied from VSYS and - then LDO is enabled, it can take long time until the LDO - output has reached its target voltage. To avoid this, an i2c - read is performed shortly after an LDO is enabled. - See nPM1300 Errata manual for more details. +include: "nordic,npm13xx-regulator-common.yaml" diff --git a/dts/bindings/regulator/nordic,npm1304-regulator.yaml b/dts/bindings/regulator/nordic,npm1304-regulator.yaml new file mode 100644 index 000000000000..51ae13e675b5 --- /dev/null +++ b/dts/bindings/regulator/nordic,npm1304-regulator.yaml @@ -0,0 +1,35 @@ +# Copyright (c) 2025 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: | + Nordic nPM1304 PMIC + + The PMIC has two buck converters and two LDOs. + The regulators need to be defined as child nodes, strictly following the + BUCK1,2 LDO1..2, node names. For + example: + + pmic@6b { + reg = <0x6b>; + ... + regulators { + compatible = "nordic,npm1304-regulator"; + + BUCK1 { + /* all properties for BUCK1 */ + }; + BUCK2 { + /* all properties for BUCK2 */ + }; + LDO1 { + /* all properties for LDO1 */ + }; + LDO2 { + /* all properties for LDO2 */ + }; + }; + }; + +compatible: "nordic,npm1304-regulator" + +include: "nordic,npm13xx-regulator-common.yaml" diff --git a/dts/bindings/regulator/nordic,npm13xx-regulator-common.yaml b/dts/bindings/regulator/nordic,npm13xx-regulator-common.yaml new file mode 100644 index 000000000000..35900c7ba373 --- /dev/null +++ b/dts/bindings/regulator/nordic,npm13xx-regulator-common.yaml @@ -0,0 +1,84 @@ +# Copyright (c) 2025 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: Nordic nPM13xx PMIC regulators common properties + +include: base.yaml + +properties: + dvs-gpios: + type: phandle-array + description: | + List of SOC GPIOs connected to PMIC GPIOs. + Set_dvs_mode will drive these pins as follows: + DVS mode 1 will enable the first pin + DVS mode 2 will enable the second pin + DVS mode 3 will drive the first and second pins + etc. + The effect of the mode change is defined by the enable-gpios + and pwm_gpios fields for each of the regulator blocks. + +child-binding: + include: + - name: regulator.yaml + property-allowlist: + - regulator-always-on + - regulator-boot-on + - regulator-boot-off + - regulator-min-microvolt + - regulator-max-microvolt + - regulator-init-microvolt + - regulator-allowed-modes + - regulator-initial-mode + - regulator-min-microamp + - regulator-max-microamp + - startup-delay-us + - off-on-delay-us + + properties: + retention-microvolt: + type: int + description: | + Retention mode voltage in microvolts. + + enable-gpio-config: + type: array + description: | + Regulator enable controlled by specified GPIO pin . + When set regulator must be enabled/disabled using set_dvs_mode. + + pwm-gpio-config: + type: array + description: | + Regulator enable controlled by specified GPIO pin . + When set regulator must be enabled/disabled using set_dvs_mode. + + retention-gpio-config: + type: array + description: | + Retention mode controlled by specified GPIO pin . + + soft-start-microamp: + type: int + enum: + - 10000 + - 20000 + - 35000 + - 50000 + description: | + Soft start current limit in microamps. + + active-discharge: + type: boolean + description: | + Enable active-discharge on the BUCK/LDO/LDSW output when disabled. + + nordic,anomaly38-disable-workaround: + type: boolean + description: | + Disable the SW workaround for nPM13xx anomaly #38. + When nPM13xx is in ULP mode, LDO is supplied from VSYS and + then LDO is enabled, it can take long time until the LDO + output has reached its target voltage. To avoid this, an i2c + read is performed shortly after an LDO is enabled. + See nPM13xx Errata manual for more details. diff --git a/dts/bindings/sensor/nordic,npm1300-charger.yaml b/dts/bindings/sensor/nordic,npm1300-charger.yaml index 3fb83a85174a..af825cc59705 100644 --- a/dts/bindings/sensor/nordic,npm1300-charger.yaml +++ b/dts/bindings/sensor/nordic,npm1300-charger.yaml @@ -8,7 +8,7 @@ description: NPM1300 PMIC Charger compatible: "nordic,npm1300-charger" -include: [sensor-device.yaml] +include: "nordic,npm13xx-charger-common.yaml" properties: term-microvolt: @@ -31,7 +31,6 @@ properties: description: | Charge current in uA. Available range is 32 mA to 800 mA in 2mA steps. - The value specified will be rounded down to the closest implemented value. dischg-limit-microamp: type: int @@ -43,60 +42,6 @@ properties: Discharge current limit in uA. Available values are 200 mA and 1000 mA. - vbus-limit-microamp: - type: int - required: true - description: | - Vbus current limit in uA. - Available range is 100 mA to 1500 mA in 100 mA steps. - - thermistor-ohms: - type: int - required: true - enum: - - 0 - - 10000 - - 47000 - - 100000 - description: Thermistor nominal resistance type in ohms. - - thermistor-beta: - type: int - required: true - description: Beta value of selected thermistor. - - thermistor-cold-millidegrees: - type: int - description: Thermistor cold threshold in milli-degrees - - thermistor-cool-millidegrees: - type: int - description: Thermistor cool threshold in milli-degrees - - thermistor-warm-millidegrees: - type: int - description: Thermistor warm threshold in milli-degrees - - thermistor-hot-millidegrees: - type: int - description: Thermistor hot threshold in milli-degrees - - charging-enable: - type: boolean - description: | - Enable charging. - - trickle-microvolt: - type: int - enum: - - 2900000 - - 2500000 - default: 2900000 - description: | - Trickle voltage threshold in uV. - Trickle charging is enabled below this value. - If omitted the device default of 2.9V is used. - term-current-percent: type: int enum: @@ -107,25 +52,3 @@ properties: Termination current, as a percentage of current-microamp. Charge completes when the charge current falls below this value. If omitted the device default of 10% is used. - - vbatlow-charge-enable: - type: boolean - description: | - Allow charging when below the vbatlow threshold. - - disable-recharge: - type: boolean - description: | - Disable automatic recharge. - - dietemp-stop-millidegrees: - type: int - description: | - Die temperature halt threshold in milli-degrees. - When die temperature exceeds this threshold, charging will be inhibited. - - dietemp-resume-millidegrees: - type: int - description: | - Die temperature resume threshold in milli-degrees. - When die temperature falls below this threshold, charging will be permitted. diff --git a/dts/bindings/sensor/nordic,npm1304-charger.yaml b/dts/bindings/sensor/nordic,npm1304-charger.yaml new file mode 100644 index 000000000000..70a1a754b814 --- /dev/null +++ b/dts/bindings/sensor/nordic,npm1304-charger.yaml @@ -0,0 +1,48 @@ +# Copyright (c) 2025 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: nPM1304 PMIC Charger + +compatible: "nordic,npm1304-charger" + +include: "nordic,npm13xx-charger-common.yaml" + +properties: + term-microvolt: + type: int + required: true + description: | + Charge termination voltage in uV. + Available range is 3.6 V to 3.65 V and 4.0 V to 4.65 V in 50 mV steps. + + term-warm-microvolt: + type: int + description: | + Charge termination voltage when warm in uV. + Available range is 3.6 V to 3.65 V and 4.0 V to 4.65 V in 50 mV steps. + If omitted, the term-microvolt value will be used. + + current-microamp: + type: int + required: true + description: | + Charge current in uA. + Available range is 4 mA to 100 mA in 0.5 mA steps. + + dischg-limit-microamp: + type: int + const: 125000 + default: 125000 + description: | + Discharge current limit in uA. Fixed to 125 mA on nPM1304. + + term-current-percent: + type: int + enum: + - 10 + - 5 + default: 10 + description: | + Termination current, as a percentage of current-microamp. + Charge completes when the charge current falls below this value. + If omitted the device default of 10% is used. diff --git a/dts/bindings/sensor/nordic,npm13xx-charger-common.yaml b/dts/bindings/sensor/nordic,npm13xx-charger-common.yaml new file mode 100644 index 000000000000..c24f279c7b22 --- /dev/null +++ b/dts/bindings/sensor/nordic,npm13xx-charger-common.yaml @@ -0,0 +1,83 @@ +# Copyright (c) 2025 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: nPM13xx PMIC Charger common properties + +include: sensor-device.yaml + +properties: + vbus-limit-microamp: + type: int + required: true + description: | + Vbus current limit in uA. + Available range is 100 mA to 1500 mA in 100 mA steps. + + thermistor-ohms: + type: int + required: true + enum: + - 0 + - 10000 + - 47000 + - 100000 + description: Thermistor nominal resistance type in ohms. + + thermistor-beta: + type: int + required: true + description: Beta value of selected thermistor. + + thermistor-cold-millidegrees: + type: int + description: Thermistor cold threshold in milli-degrees + + thermistor-cool-millidegrees: + type: int + description: Thermistor cool threshold in milli-degrees + + thermistor-warm-millidegrees: + type: int + description: Thermistor warm threshold in milli-degrees + + thermistor-hot-millidegrees: + type: int + description: Thermistor hot threshold in milli-degrees + + charging-enable: + type: boolean + description: | + Enable charging. + + trickle-microvolt: + type: int + enum: + - 2900000 + - 2500000 + default: 2900000 + description: | + Trickle voltage threshold in uV. + Trickle charging is enabled below this value. + If omitted the device default of 2.9V is used. + + vbatlow-charge-enable: + type: boolean + description: | + Allow charging when below the vbatlow threshold. + + disable-recharge: + type: boolean + description: | + Disable automatic recharge. + + dietemp-stop-millidegrees: + type: int + description: | + Die temperature halt threshold in milli-degrees. + When die temperature exceeds this threshold, charging will be inhibited. + + dietemp-resume-millidegrees: + type: int + description: | + Die temperature resume threshold in milli-degrees. + When die temperature falls below this threshold, charging will be permitted. diff --git a/dts/bindings/watchdog/nordic,npm1304-wdt.yaml b/dts/bindings/watchdog/nordic,npm1304-wdt.yaml new file mode 100644 index 000000000000..0fc81437199c --- /dev/null +++ b/dts/bindings/watchdog/nordic,npm1304-wdt.yaml @@ -0,0 +1,13 @@ +# Copyright (c) 2025 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: nPM1304 Watchdog + +compatible: "nordic,npm1304-wdt" + +include: base.yaml + +properties: + reset-gpios: + type: phandle-array + description: nPM1304 pin used as NRESETOUT From 37b7c9f56998b1b8d9def06a9d7421803edb3c71 Mon Sep 17 00:00:00 2001 From: Sergei Ovchinnikov Date: Tue, 29 Apr 2025 13:29:20 +0200 Subject: [PATCH 0104/2141] [nrf fromtree] drivers: npm13xx: add support for nPM1304 Add support for nPM1304 in the npm13xx drivers. The nPM1304 supports different voltage and current ranges which are handled through the initialization macros. Signed-off-by: Sergei Ovchinnikov (cherry picked from commit 645159dc2677c4be91c5a3662907ab595aacfb8c) --- drivers/gpio/Kconfig.npm13xx | 2 +- drivers/gpio/gpio_npm13xx.c | 21 +-- drivers/led/Kconfig.npm13xx | 2 +- drivers/led/led_npm13xx.c | 17 ++- drivers/mfd/Kconfig.npm13xx | 2 +- drivers/mfd/mfd_npm13xx.c | 32 +++-- drivers/regulator/Kconfig.npm13xx | 2 +- drivers/regulator/regulator_npm13xx.c | 60 ++++---- drivers/sensor/nordic/npm13xx_charger/Kconfig | 2 +- .../nordic/npm13xx_charger/npm13xx_charger.c | 133 +++++++++++------- drivers/watchdog/Kconfig.npm13xx | 2 +- drivers/watchdog/wdt_npm13xx.c | 20 ++- 12 files changed, 177 insertions(+), 118 deletions(-) diff --git a/drivers/gpio/Kconfig.npm13xx b/drivers/gpio/Kconfig.npm13xx index 828b4e1382f3..1d3bade047db 100644 --- a/drivers/gpio/Kconfig.npm13xx +++ b/drivers/gpio/Kconfig.npm13xx @@ -4,7 +4,7 @@ config GPIO_NPM13XX bool "nPM13xx GPIO driver" default y - depends on DT_HAS_NORDIC_NPM1300_GPIO_ENABLED + depends on DT_HAS_NORDIC_NPM1300_GPIO_ENABLED || DT_HAS_NORDIC_NPM1304_GPIO_ENABLED select I2C select MFD help diff --git a/drivers/gpio/gpio_npm13xx.c b/drivers/gpio/gpio_npm13xx.c index c74fc244d937..d6eeb4b73b01 100644 --- a/drivers/gpio/gpio_npm13xx.c +++ b/drivers/gpio/gpio_npm13xx.c @@ -3,8 +3,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -#define DT_DRV_COMPAT nordic_npm1300_gpio - #include #include @@ -212,18 +210,25 @@ static int gpio_npm13xx_init(const struct device *dev) return 0; } -#define GPIO_NPM13XX_DEFINE(n) \ - static const struct gpio_npm13xx_config gpio_npm13xx_config##n = { \ +#define GPIO_NPM13XX_DEFINE(partno, n) \ + static const struct gpio_npm13xx_config gpio_##partno##_config##n = { \ .common = \ { \ .port_pin_mask = GPIO_PORT_PIN_MASK_FROM_DT_INST(n), \ }, \ .mfd = DEVICE_DT_GET(DT_INST_PARENT(n))}; \ \ - static struct gpio_npm13xx_data gpio_npm13xx_data##n; \ + static struct gpio_npm13xx_data gpio_##partno##_data##n; \ \ - DEVICE_DT_INST_DEFINE(n, gpio_npm13xx_init, NULL, &gpio_npm13xx_data##n, \ - &gpio_npm13xx_config##n, POST_KERNEL, \ + DEVICE_DT_INST_DEFINE(n, gpio_npm13xx_init, NULL, &gpio_##partno##_data##n, \ + &gpio_##partno##_config##n, POST_KERNEL, \ CONFIG_GPIO_NPM13XX_INIT_PRIORITY, &gpio_npm13xx_api); -DT_INST_FOREACH_STATUS_OKAY(GPIO_NPM13XX_DEFINE) +#define DT_DRV_COMPAT nordic_npm1300_gpio +#define GPIO_NPM1300_DEFINE(n) GPIO_NPM13XX_DEFINE(npm1300, n) +DT_INST_FOREACH_STATUS_OKAY(GPIO_NPM1300_DEFINE) + +#undef DT_DRV_COMPAT +#define DT_DRV_COMPAT nordic_npm1304_gpio +#define GPIO_NPM1304_DEFINE(n) GPIO_NPM13XX_DEFINE(npm1304, n) +DT_INST_FOREACH_STATUS_OKAY(GPIO_NPM1304_DEFINE) diff --git a/drivers/led/Kconfig.npm13xx b/drivers/led/Kconfig.npm13xx index e3f40f42a193..5431c7c8326f 100644 --- a/drivers/led/Kconfig.npm13xx +++ b/drivers/led/Kconfig.npm13xx @@ -4,7 +4,7 @@ config LED_NPM13XX bool "nPM13xx LED driver" default y - depends on DT_HAS_NORDIC_NPM1300_LED_ENABLED + depends on DT_HAS_NORDIC_NPM1300_LED_ENABLED || DT_HAS_NORDIC_NPM1304_LED_ENABLED select I2C select MFD help diff --git a/drivers/led/led_npm13xx.c b/drivers/led/led_npm13xx.c index eed9b1256bec..f00864fc74a6 100644 --- a/drivers/led/led_npm13xx.c +++ b/drivers/led/led_npm13xx.c @@ -3,8 +3,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -#define DT_DRV_COMPAT nordic_npm1300_led - #include #include @@ -87,14 +85,21 @@ static int led_npm13xx_init(const struct device *dev) return 0; } -#define LED_NPM13XX_DEFINE(n) \ - static const struct led_npm13xx_config led_npm13xx_config##n = { \ +#define LED_NPM13XX_DEFINE(partno, n) \ + static const struct led_npm13xx_config led_##partno##_config##n = { \ .mfd = DEVICE_DT_GET(DT_INST_PARENT(n)), \ .mode = {DT_INST_ENUM_IDX(n, nordic_led0_mode), \ DT_INST_ENUM_IDX(n, nordic_led1_mode), \ DT_INST_ENUM_IDX(n, nordic_led2_mode)}}; \ \ - DEVICE_DT_INST_DEFINE(n, &led_npm13xx_init, NULL, NULL, &led_npm13xx_config##n, \ + DEVICE_DT_INST_DEFINE(n, &led_npm13xx_init, NULL, NULL, &led_##partno##_config##n, \ POST_KERNEL, CONFIG_LED_INIT_PRIORITY, &led_npm13xx_api); -DT_INST_FOREACH_STATUS_OKAY(LED_NPM13XX_DEFINE) +#define DT_DRV_COMPAT nordic_npm1300_led +#define LED_NPM1300_DEFINE(n) LED_NPM13XX_DEFINE(npm1300, n) +DT_INST_FOREACH_STATUS_OKAY(LED_NPM1300_DEFINE) + +#undef DT_DRV_COMPAT +#define DT_DRV_COMPAT nordic_npm1304_led +#define LED_NPM1304_DEFINE(n) LED_NPM13XX_DEFINE(npm1304, n) +DT_INST_FOREACH_STATUS_OKAY(LED_NPM1304_DEFINE) diff --git a/drivers/mfd/Kconfig.npm13xx b/drivers/mfd/Kconfig.npm13xx index 63f18ac9a3b3..6170c074aa8a 100644 --- a/drivers/mfd/Kconfig.npm13xx +++ b/drivers/mfd/Kconfig.npm13xx @@ -4,7 +4,7 @@ config MFD_NPM13XX bool "nPM13xx PMIC multi-function device driver" default y - depends on DT_HAS_NORDIC_NPM1300_ENABLED + depends on DT_HAS_NORDIC_NPM1300_ENABLED || DT_HAS_NORDIC_NPM1304_ENABLED select I2C help Enable the Nordic nPM13xx PMIC multi-function device driver diff --git a/drivers/mfd/mfd_npm13xx.c b/drivers/mfd/mfd_npm13xx.c index 9847e4a9e495..0d0b8e89f5f9 100644 --- a/drivers/mfd/mfd_npm13xx.c +++ b/drivers/mfd/mfd_npm13xx.c @@ -3,8 +3,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -#define DT_DRV_COMPAT nordic_npm1300 - #include #include @@ -308,18 +306,26 @@ int mfd_npm13xx_remove_callback(const struct device *dev, struct gpio_callback * return gpio_manage_callback(&data->callbacks, callback, false); } -#define MFD_NPM13XX_DEFINE(inst) \ - static struct mfd_npm13xx_data data_##inst; \ +#define MFD_NPM13XX_DEFINE(partno, n) \ + static struct mfd_npm13xx_data mfd_##partno##_data##n; \ \ - static const struct mfd_npm13xx_config config##inst = { \ - .i2c = I2C_DT_SPEC_INST_GET(inst), \ - .host_int_gpios = GPIO_DT_SPEC_INST_GET_OR(inst, host_int_gpios, {0}), \ - .pmic_int_pin = DT_INST_PROP_OR(inst, pmic_int_pin, 0), \ - .active_time = DT_INST_ENUM_IDX(inst, ship_to_active_time_ms), \ - .lp_reset = DT_INST_ENUM_IDX_OR(inst, long_press_reset, 0), \ + static const struct mfd_npm13xx_config mfd_##partno##_config##n = { \ + .i2c = I2C_DT_SPEC_INST_GET(n), \ + .host_int_gpios = GPIO_DT_SPEC_INST_GET_OR(n, host_int_gpios, {0}), \ + .pmic_int_pin = DT_INST_PROP_OR(n, pmic_int_pin, 0), \ + .active_time = DT_INST_ENUM_IDX(n, ship_to_active_time_ms), \ + .lp_reset = DT_INST_ENUM_IDX_OR(n, long_press_reset, 0), \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, mfd_npm13xx_init, NULL, &data_##inst, &config##inst, \ - POST_KERNEL, CONFIG_MFD_NPM13XX_INIT_PRIORITY, NULL); + DEVICE_DT_INST_DEFINE(n, mfd_npm13xx_init, NULL, &mfd_##partno##_data##n, \ + &mfd_##partno##_config##n, POST_KERNEL, \ + CONFIG_MFD_NPM13XX_INIT_PRIORITY, NULL); + +#define DT_DRV_COMPAT nordic_npm1300 +#define MFD_NPM1300_DEFINE(n) MFD_NPM13XX_DEFINE(npm1300, n) +DT_INST_FOREACH_STATUS_OKAY(MFD_NPM1300_DEFINE) -DT_INST_FOREACH_STATUS_OKAY(MFD_NPM13XX_DEFINE) +#undef DT_DRV_COMPAT +#define DT_DRV_COMPAT nordic_npm1304 +#define MFD_NPM1304_DEFINE(n) MFD_NPM13XX_DEFINE(npm1304, n) +DT_INST_FOREACH_STATUS_OKAY(MFD_NPM1304_DEFINE) diff --git a/drivers/regulator/Kconfig.npm13xx b/drivers/regulator/Kconfig.npm13xx index 4d243b8cdf84..a075ca72dc7c 100644 --- a/drivers/regulator/Kconfig.npm13xx +++ b/drivers/regulator/Kconfig.npm13xx @@ -4,7 +4,7 @@ config REGULATOR_NPM13XX bool "nPM13xx PMIC regulator driver" default y - depends on DT_HAS_NORDIC_NPM1300_REGULATOR_ENABLED + depends on DT_HAS_NORDIC_NPM1300_REGULATOR_ENABLED || DT_HAS_NORDIC_NPM1304_REGULATOR_ENABLED select I2C select MFD help diff --git a/drivers/regulator/regulator_npm13xx.c b/drivers/regulator/regulator_npm13xx.c index 89ee1993ed39..c07970bb5c64 100644 --- a/drivers/regulator/regulator_npm13xx.c +++ b/drivers/regulator/regulator_npm13xx.c @@ -3,8 +3,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -#define DT_DRV_COMPAT nordic_npm1300_regulator - #include #include @@ -689,9 +687,6 @@ int regulator_npm13xx_init(const struct device *dev) } ret = regulator_npm13xx_set_pin_ctrl(dev, &config->pwm_gpios, NPM13XX_GPIO_TYPE_PWM); - if (ret != 0) { - return ret; - } return ret; } @@ -712,13 +707,13 @@ static DEVICE_API(regulator, api) = { !!(DT_PROP_BY_IDX(node_id, prop, 1) & GPIO_ACTIVE_LOW)}), \ ({NPM13XX_GPIO_UNUSED, false})) -#define REGULATOR_NPM13XX_DEFINE(node_id, id, _source) \ +#define REGULATOR_NPM13XX_DEFINE(partno, node_id, id, _source) \ BUILD_ASSERT(DT_PROP_LEN_OR(node_id, enable_gpio_config, 2) == 2); \ BUILD_ASSERT(DT_PROP_LEN_OR(node_id, retention_gpio_config, 2) == 2); \ BUILD_ASSERT(DT_PROP_LEN_OR(node_id, pwm_gpio_config, 2) == 2); \ - static struct regulator_npm13xx_data data_##id; \ + static struct regulator_npm13xx_data regulator_##partno##_data_##id; \ \ - static const struct regulator_npm13xx_config config_##id = { \ + static const struct regulator_npm13xx_config regulator_##partno##_config_##id = { \ .common = REGULATOR_DT_COMMON_CONFIG_INIT(node_id), \ .mfd = DEVICE_DT_GET(DT_GPARENT(node_id)), \ .source = _source, \ @@ -730,30 +725,39 @@ static DEVICE_API(regulator, api) = { .active_discharge = DT_PROP(node_id, active_discharge), \ .ldo_disable_workaround = DT_PROP(node_id, nordic_anomaly38_disable_workaround)}; \ \ - DEVICE_DT_DEFINE(node_id, regulator_npm13xx_init, NULL, &data_##id, &config_##id, \ - POST_KERNEL, CONFIG_REGULATOR_NPM13XX_INIT_PRIORITY, &api); + DEVICE_DT_DEFINE(node_id, regulator_npm13xx_init, NULL, ®ulator_##partno##_data_##id, \ + ®ulator_##partno##_config_##id, POST_KERNEL, \ + CONFIG_REGULATOR_NPM13XX_INIT_PRIORITY, &api); -#define REGULATOR_NPM13XX_DEFINE_COND(inst, child, source) \ - COND_CODE_1(DT_NODE_EXISTS(DT_INST_CHILD(inst, child)), \ - (REGULATOR_NPM13XX_DEFINE(DT_INST_CHILD(inst, child), child##inst, source)), \ +#define REGULATOR_NPM13XX_DEFINE_COND(partno, n, child, source) \ + COND_CODE_1(DT_NODE_EXISTS(DT_INST_CHILD(n, child)), \ + (REGULATOR_NPM13XX_DEFINE(partno, DT_INST_CHILD(n, child), child##n, source)), \ ()) -#define REGULATOR_NPM13XX_DEFINE_ALL(inst) \ - static const struct regulator_npm13xx_pconfig config_##inst = { \ - .mfd = DEVICE_DT_GET(DT_INST_PARENT(inst)), \ - .dvs_state_pins = {GPIO_DT_SPEC_INST_GET_BY_IDX_OR(inst, dvs_gpios, 0, {0}), \ - GPIO_DT_SPEC_INST_GET_BY_IDX_OR(inst, dvs_gpios, 1, {0}), \ - GPIO_DT_SPEC_INST_GET_BY_IDX_OR(inst, dvs_gpios, 2, {0}), \ - GPIO_DT_SPEC_INST_GET_BY_IDX_OR(inst, dvs_gpios, 3, {0}), \ - GPIO_DT_SPEC_INST_GET_BY_IDX_OR(inst, dvs_gpios, 4, {0})}}; \ +#define REGULATOR_NPM13XX_DEFINE_ALL(partno, n) \ + static const struct regulator_npm13xx_pconfig regulator_##partno##_config##n = { \ + .mfd = DEVICE_DT_GET(DT_INST_PARENT(n)), \ + .dvs_state_pins = {GPIO_DT_SPEC_INST_GET_BY_IDX_OR(n, dvs_gpios, 0, {0}), \ + GPIO_DT_SPEC_INST_GET_BY_IDX_OR(n, dvs_gpios, 1, {0}), \ + GPIO_DT_SPEC_INST_GET_BY_IDX_OR(n, dvs_gpios, 2, {0}), \ + GPIO_DT_SPEC_INST_GET_BY_IDX_OR(n, dvs_gpios, 3, {0}), \ + GPIO_DT_SPEC_INST_GET_BY_IDX_OR(n, dvs_gpios, 4, {0})}}; \ \ - DEVICE_DT_INST_DEFINE(inst, regulator_npm13xx_common_init, NULL, NULL, &config_##inst, \ - POST_KERNEL, CONFIG_REGULATOR_NPM13XX_COMMON_INIT_PRIORITY, \ + DEVICE_DT_INST_DEFINE(n, regulator_npm13xx_common_init, NULL, NULL, \ + ®ulator_##partno##_config##n, POST_KERNEL, \ + CONFIG_REGULATOR_NPM13XX_COMMON_INIT_PRIORITY, \ &parent_api); \ \ - REGULATOR_NPM13XX_DEFINE_COND(inst, buck1, NPM13XX_SOURCE_BUCK1) \ - REGULATOR_NPM13XX_DEFINE_COND(inst, buck2, NPM13XX_SOURCE_BUCK2) \ - REGULATOR_NPM13XX_DEFINE_COND(inst, ldo1, NPM13XX_SOURCE_LDO1) \ - REGULATOR_NPM13XX_DEFINE_COND(inst, ldo2, NPM13XX_SOURCE_LDO2) + REGULATOR_NPM13XX_DEFINE_COND(partno, n, buck1, NPM13XX_SOURCE_BUCK1) \ + REGULATOR_NPM13XX_DEFINE_COND(partno, n, buck2, NPM13XX_SOURCE_BUCK2) \ + REGULATOR_NPM13XX_DEFINE_COND(partno, n, ldo1, NPM13XX_SOURCE_LDO1) \ + REGULATOR_NPM13XX_DEFINE_COND(partno, n, ldo2, NPM13XX_SOURCE_LDO2) + +#define DT_DRV_COMPAT nordic_npm1300_regulator +#define REGULATOR_NPM1300_DEFINE_ALL(n) REGULATOR_NPM13XX_DEFINE_ALL(npm1300, n) +DT_INST_FOREACH_STATUS_OKAY(REGULATOR_NPM1300_DEFINE_ALL) -DT_INST_FOREACH_STATUS_OKAY(REGULATOR_NPM13XX_DEFINE_ALL) +#undef DT_DRV_COMPAT +#define DT_DRV_COMPAT nordic_npm1304_regulator +#define REGULATOR_NPM1304_DEFINE_ALL(n) REGULATOR_NPM13XX_DEFINE_ALL(npm1304, n) +DT_INST_FOREACH_STATUS_OKAY(REGULATOR_NPM1304_DEFINE_ALL) diff --git a/drivers/sensor/nordic/npm13xx_charger/Kconfig b/drivers/sensor/nordic/npm13xx_charger/Kconfig index e511e393fa24..a113a4ede474 100644 --- a/drivers/sensor/nordic/npm13xx_charger/Kconfig +++ b/drivers/sensor/nordic/npm13xx_charger/Kconfig @@ -5,7 +5,7 @@ config NPM13XX_CHARGER bool "nPM13xx Charger" default y - depends on DT_HAS_NORDIC_NPM1300_CHARGER_ENABLED + depends on DT_HAS_NORDIC_NPM1300_CHARGER_ENABLED || DT_HAS_NORDIC_NPM1304_CHARGER_ENABLED select I2C select MFD select REQUIRES_FULL_LIBC diff --git a/drivers/sensor/nordic/npm13xx_charger/npm13xx_charger.c b/drivers/sensor/nordic/npm13xx_charger/npm13xx_charger.c index bf5afe2d3f4e..08e2763e6558 100644 --- a/drivers/sensor/nordic/npm13xx_charger/npm13xx_charger.c +++ b/drivers/sensor/nordic/npm13xx_charger/npm13xx_charger.c @@ -3,8 +3,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -#define DT_DRV_COMPAT nordic_npm1300_charger - #include #include #include @@ -16,7 +14,10 @@ struct npm13xx_charger_config { const struct device *mfd; int32_t term_microvolt; int32_t term_warm_microvolt; + const struct linear_range term_volt_ranges[2U]; int32_t current_microamp; + const struct linear_range current_range; + const int32_t full_scale_discharge_factors[2U]; int32_t dischg_limit_microamp; uint8_t dischg_limit_idx; int32_t vbus_limit_microamp; @@ -137,14 +138,22 @@ struct adc_results_t { #define DIETEMP_FACTOR_DIV 5000 /* Linear range for charger terminal voltage */ -static const struct linear_range charger_volt_ranges[] = { - LINEAR_RANGE_INIT(3500000, 50000, 0U, 3U), LINEAR_RANGE_INIT(4000000, 50000, 4U, 13U)}; +#define NPM1300_CHARGER_VOLT_RANGES \ + {LINEAR_RANGE_INIT(3500000, 50000, 0U, 3U), LINEAR_RANGE_INIT(4000000, 50000, 4U, 13U)} +#define NPM1304_CHARGER_VOLT_RANGES \ + {LINEAR_RANGE_INIT(3600000, 50000, 0U, 1U), LINEAR_RANGE_INIT(4000000, 50000, 2U, 15U)} /* Linear range for charger current */ -static const struct linear_range charger_current_range = LINEAR_RANGE_INIT(32000, 2000, 16U, 400U); +#define NPM1300_CHARGER_CURRENT_RANGE LINEAR_RANGE_INIT(32000, 2000, 16U, 400U) +#define NPM1304_CHARGER_CURRENT_RANGE LINEAR_RANGE_INIT(4000, 500, 8U, 200U) + +/* Full-scale factors for calculating current */ +#define NPM1300_FULL_SCALE_DISCHARGE_FACTORS {112, 100} +#define NPM1304_FULL_SCALE_DISCHARGE_FACTORS {415, 400} +static const int32_t full_scale_charge_factors[] = {125, 100}; /* Allowed values for discharge limit */ -static const uint16_t discharge_limits[] = {84U, 415U}; +static const uint16_t npm1300_discharge_limits[] = {84U, 415U}; /* Linear range for vbusin current limit */ static const struct linear_range vbus_current_range = LINEAR_RANGE_INIT(100000, 100000, 1U, 15U); @@ -193,41 +202,49 @@ static void calc_current(const struct npm13xx_charger_config *const config, int32_t full_scale_ua; int32_t current_ua; - /* Largest value of discharge limit and charge limit is 1A. - * We can therefore guarantee that multiplying the uA by 1000 does not overflow. - * 1000 * 1'000'000 uA < 2**31 - * 1000000000 < 2147483648 - */ switch (data->ibat_stat) { case IBAT_STAT_DISCHARGE: - /* Ref: PS v1.2 Section 7.1.7: Full scale multiplied by 1.12 */ - full_scale_ua = -(1000 * config->dischg_limit_microamp) / 893; + /* nPM1300: Largest discharge limit is 1A. Multiplying it by 112 will not overflow. + * 112 * -1_000_000 > INT32_MIN + * -112_000_000 > -2_147_483_648 + * nPM1304: Discharge limit is 125mA. Multiplying it by 415 will not overflow. + * 415 * -125_000 > INT32_MIN + * -51_875_000 > -2_147_483_648 + */ + full_scale_ua = -config->dischg_limit_microamp * + config->full_scale_discharge_factors[0] / + config->full_scale_discharge_factors[1]; break; case IBAT_STAT_CHARGE_TRICKLE: /* Fallthrough */ case IBAT_STAT_CHARGE_COOL: /* Fallthrough */ case IBAT_STAT_CHARGE_NORMAL: - /* Ref: PS v1.2 Section 7.1.7: Full scale multiplied by 1.25 */ - full_scale_ua = (1000 * config->current_microamp) / 800; + /* nPM1300: Largest charge limit is 800mA. Multiplying it by 125 will not overflow. + * 125 * 800_000 < INT32_MAX + * 100_000_000 < 2_147_483_647 + * nPM1304: Largest charge limit is even lower - no overflow. + */ + full_scale_ua = config->current_microamp * full_scale_charge_factors[0] / + full_scale_charge_factors[1]; break; default: full_scale_ua = 0; break; } - /* Largest possible value for data->current is 1023 - * Limits for full_scale_ua are -1'119'820 and 1'000'000 - * 1023 * -1119820 > -2**31 - * -1145575860 > -2147483648 - * 1023 * 1000000 < 2**31 - * 1023000000 < 2147483648 + /* Largest possible value for data->current is 1023 (10-bit ADC) + * Limits for full_scale_ua are -1_120_000 and 1_000_000 + * 1023 * -1_120_000 > INT32_MIN + * -1_145_760_000 > -2_147_483_648 + * 1023 * 1_000_000 < INT32_MAX + * 1_023_000_000 < 2_147_483_647 */ __ASSERT_NO_MSG(data->current <= 1023); __ASSERT_NO_MSG(full_scale_ua <= 1000000); - __ASSERT_NO_MSG(full_scale_ua >= -1119820); + __ASSERT_NO_MSG(full_scale_ua >= -1120000); - current_ua = (data->current * full_scale_ua) / 1024; + current_ua = (data->current * full_scale_ua) / 1023; (void)sensor_value_from_micro(valp, current_ua); } @@ -324,9 +341,6 @@ int npm13xx_charger_sample_fetch(const struct device *dev, enum sensor_channel c /* Read vbus status */ ret = mfd_npm13xx_reg_read(config->mfd, VBUS_BASE, VBUS_OFFSET_STATUS, &data->vbus_stat); - if (ret != 0) { - return ret; - } return ret; } @@ -532,9 +546,9 @@ int npm13xx_charger_init(const struct device *dev) } /* Configure termination voltages */ - ret = linear_range_group_get_win_index(charger_volt_ranges, ARRAY_SIZE(charger_volt_ranges), - config->term_microvolt, config->term_microvolt, - &idx); + ret = linear_range_group_get_win_index( + config->term_volt_ranges, ARRAY_SIZE(config->term_volt_ranges), + config->term_microvolt, config->term_microvolt, &idx); if (ret == -EINVAL) { return ret; } @@ -543,9 +557,9 @@ int npm13xx_charger_init(const struct device *dev) return ret; } - ret = linear_range_group_get_win_index(charger_volt_ranges, ARRAY_SIZE(charger_volt_ranges), - config->term_warm_microvolt, - config->term_warm_microvolt, &idx); + ret = linear_range_group_get_win_index( + config->term_volt_ranges, ARRAY_SIZE(config->term_volt_ranges), + config->term_warm_microvolt, config->term_warm_microvolt, &idx); if (ret == -EINVAL) { return ret; } @@ -556,22 +570,29 @@ int npm13xx_charger_init(const struct device *dev) } /* Set current, allow rounding down to closest value */ - ret = linear_range_get_win_index(&charger_current_range, - config->current_microamp - charger_current_range.step, + ret = linear_range_get_win_index(&config->current_range, + config->current_microamp - config->current_range.step + 1, config->current_microamp, &idx); if (ret == -EINVAL) { return ret; } - ret = mfd_npm13xx_reg_write2(config->mfd, CHGR_BASE, CHGR_OFFSET_ISET, idx / 2U, idx & 1U); - if (ret != 0) { - return ret; - } + if (config->dischg_limit_idx == UINT8_MAX) { + /* Set only charge current MSB for nPM1304 */ + ret = mfd_npm13xx_reg_write(config->mfd, CHGR_BASE, CHGR_OFFSET_ISET, idx); + } else { + /* Set charge current MSB and LSB and discharge limit for nPM1300 */ + ret = mfd_npm13xx_reg_write2(config->mfd, CHGR_BASE, CHGR_OFFSET_ISET, idx / 2U, + idx & 1U); + if (ret != 0) { + return ret; + } - /* Set discharge limit */ - ret = mfd_npm13xx_reg_write2(config->mfd, CHGR_BASE, CHGR_OFFSET_ISET_DISCHG, - discharge_limits[config->dischg_limit_idx] / 2U, - discharge_limits[config->dischg_limit_idx] & 1U); + ret = mfd_npm13xx_reg_write2( + config->mfd, CHGR_BASE, CHGR_OFFSET_ISET_DISCHG, + npm1300_discharge_limits[config->dischg_limit_idx] / 2U, + npm1300_discharge_limits[config->dischg_limit_idx] & 1U); + } if (ret != 0) { return ret; } @@ -666,19 +687,23 @@ static DEVICE_API(sensor, npm13xx_charger_battery_driver_api) = { .attr_get = npm13xx_charger_attr_get, }; -#define NPM13XX_CHARGER_INIT(n) \ - BUILD_ASSERT(DT_INST_ENUM_IDX(n, dischg_limit_microamp) < ARRAY_SIZE(discharge_limits)); \ +#define NPM13XX_CHARGER_INIT(partno, n) \ + BUILD_ASSERT(DT_INST_ENUM_IDX_OR(n, dischg_limit_microamp, 0) < \ + ARRAY_SIZE(npm1300_discharge_limits)); \ \ - static struct npm13xx_charger_data npm13xx_charger_data_##n; \ + static struct npm13xx_charger_data charger_##partno##_data##n; \ \ - static const struct npm13xx_charger_config npm13xx_charger_config_##n = { \ + static const struct npm13xx_charger_config charger_##partno##_config##n = { \ .mfd = DEVICE_DT_GET(DT_INST_PARENT(n)), \ .term_microvolt = DT_INST_PROP(n, term_microvolt), \ .term_warm_microvolt = \ DT_INST_PROP_OR(n, term_warm_microvolt, DT_INST_PROP(n, term_microvolt)), \ + .term_volt_ranges = partno##_CHARGER_VOLT_RANGES, \ .current_microamp = DT_INST_PROP(n, current_microamp), \ + .current_range = partno##_CHARGER_CURRENT_RANGE, \ + .full_scale_discharge_factors = partno##_FULL_SCALE_DISCHARGE_FACTORS, \ .dischg_limit_microamp = DT_INST_PROP(n, dischg_limit_microamp), \ - .dischg_limit_idx = DT_INST_ENUM_IDX(n, dischg_limit_microamp), \ + .dischg_limit_idx = DT_INST_ENUM_IDX_OR(n, dischg_limit_microamp, UINT8_MAX), \ .vbus_limit_microamp = DT_INST_PROP(n, vbus_limit_microamp), \ .thermistor_ohms = DT_INST_PROP(n, thermistor_ohms), \ .thermistor_idx = DT_INST_ENUM_IDX(n, thermistor_ohms), \ @@ -696,9 +721,17 @@ static DEVICE_API(sensor, npm13xx_charger_battery_driver_api) = { DT_INST_PROP_OR(n, thermistor_warm_millidegrees, INT32_MAX), \ DT_INST_PROP_OR(n, thermistor_hot_millidegrees, INT32_MAX)}}; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(n, &npm13xx_charger_init, NULL, &npm13xx_charger_data_##n, \ - &npm13xx_charger_config_##n, POST_KERNEL, \ + SENSOR_DEVICE_DT_INST_DEFINE(n, &npm13xx_charger_init, NULL, &charger_##partno##_data##n, \ + &charger_##partno##_config##n, POST_KERNEL, \ CONFIG_SENSOR_INIT_PRIORITY, \ &npm13xx_charger_battery_driver_api); -DT_INST_FOREACH_STATUS_OKAY(NPM13XX_CHARGER_INIT) +#undef DT_DRV_COMPAT +#define DT_DRV_COMPAT nordic_npm1300_charger +#define NPM1300_CHARGER_INIT(n) NPM13XX_CHARGER_INIT(NPM1300, n) +DT_INST_FOREACH_STATUS_OKAY(NPM1300_CHARGER_INIT) + +#undef DT_DRV_COMPAT +#define DT_DRV_COMPAT nordic_npm1304_charger +#define NPM1304_CHARGER_INIT(n) NPM13XX_CHARGER_INIT(NPM1304, n) +DT_INST_FOREACH_STATUS_OKAY(NPM1304_CHARGER_INIT) diff --git a/drivers/watchdog/Kconfig.npm13xx b/drivers/watchdog/Kconfig.npm13xx index 2318349c85e3..910da6574a93 100644 --- a/drivers/watchdog/Kconfig.npm13xx +++ b/drivers/watchdog/Kconfig.npm13xx @@ -4,7 +4,7 @@ config WDT_NPM13XX bool "nPM13xx Watchdog driver" default y - depends on DT_HAS_NORDIC_NPM1300_WDT_ENABLED + depends on DT_HAS_NORDIC_NPM1300_WDT_ENABLED || DT_HAS_NORDIC_NPM1304_WDT_ENABLED select I2C select MFD help diff --git a/drivers/watchdog/wdt_npm13xx.c b/drivers/watchdog/wdt_npm13xx.c index cfbee7f33982..351da6b7d5a8 100644 --- a/drivers/watchdog/wdt_npm13xx.c +++ b/drivers/watchdog/wdt_npm13xx.c @@ -3,8 +3,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -#define DT_DRV_COMPAT nordic_npm13xx_wdt - #include #include @@ -154,15 +152,23 @@ static int wdt_npm13xx_init(const struct device *dev) return 0; } -#define WDT_NPM13XX_DEFINE(n) \ - static struct wdt_npm13xx_data data##n; \ +#define WDT_NPM13XX_DEFINE(partno, n) \ + static struct wdt_npm13xx_data wdt_##partno##_data##n; \ \ - static const struct wdt_npm13xx_config config##n = { \ + static const struct wdt_npm13xx_config wdt_##partno##_config##n = { \ .mfd = DEVICE_DT_GET(DT_INST_PARENT(n)), \ .reset_gpios = GPIO_DT_SPEC_INST_GET_OR(n, reset_gpios, {0}), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, &wdt_npm13xx_init, NULL, &data##n, &config##n, POST_KERNEL, \ + DEVICE_DT_INST_DEFINE(n, &wdt_npm13xx_init, NULL, &wdt_##partno##_data##n, \ + &wdt_##partno##_config##n, POST_KERNEL, \ CONFIG_WDT_NPM13XX_INIT_PRIORITY, &wdt_npm13xx_api); -DT_INST_FOREACH_STATUS_OKAY(WDT_NPM13XX_DEFINE) +#define DT_DRV_COMPAT nordic_npm1300_wdt +#define WDT_NPM1300_DEFINE(n) WDT_NPM13XX_DEFINE(npm1300, n) +DT_INST_FOREACH_STATUS_OKAY(WDT_NPM1300_DEFINE) + +#undef DT_DRV_COMPAT +#define DT_DRV_COMPAT nordic_npm1304_wdt +#define WDT_NPM1304_DEFINE(n) WDT_NPM13XX_DEFINE(npm1304, n) +DT_INST_FOREACH_STATUS_OKAY(WDT_NPM1304_DEFINE) From 393d9d8dec4a106532cf156c51e4500ca8303eb3 Mon Sep 17 00:00:00 2001 From: Sergei Ovchinnikov Date: Fri, 23 May 2025 13:46:18 +0200 Subject: [PATCH 0105/2141] [nrf fromtree] doc: release: migration-guide-4.2: add npm13xx changes Add notes about change in API and file locations from npm1300 to npm13xx Signed-off-by: Sergei Ovchinnikov (cherry picked from commit 1bfeaba6f4ca2a869581c292cd65e9e80ef4d529) --- doc/releases/migration-guide-4.2.rst | 40 ++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/doc/releases/migration-guide-4.2.rst b/doc/releases/migration-guide-4.2.rst index e643142e0ba0..faad669e379e 100644 --- a/doc/releases/migration-guide-4.2.rst +++ b/doc/releases/migration-guide-4.2.rst @@ -212,6 +212,11 @@ GPIO * ``arduino-nano-header-r3`` is renamed to :dtcompatible:`arduino-nano-header`. Because the R3 comes from the Arduino UNO R3, which has changed the connector from the former version, and is unrelated to the Arduino Nano. +* Moved file ``include/zephyr/dt-bindings/gpio/nordic-npm1300-gpio.h`` to + :zephyr_file:`include/zephyr/dt-bindings/gpio/nordic-npm13xx-gpio.h` and renamed all instances of + ``NPM1300`` to ``NPM13XX`` in the defines +* Renamed ``CONFIG_GPIO_NPM1300`` to :kconfig:option:`CONFIG_GPIO_NPM13XX`, + ``CONFIG_GPIO_NPM1300_INIT_PRIORITY`` to :kconfig:option:`CONFIG_GPIO_NPM13XX_INIT_PRIORITY` I2S === @@ -219,6 +224,30 @@ I2S * configure the MCLK signal as an output. Older driver versions used the macro * ``I2S_OPT_BIT_CLK_SLAVE`` to configure the MCLK signal direction. (:github:`88554`) +LED +=== + +* Renamed ``CONFIG_LED_NPM1300`` to :kconfig:option:`CONFIG_LED_NPM13XX` + +MFD +=== + +* Moved file ``include/zephyr/drivers/mfd/npm1300.h`` to :zephyr_file:`include/zephyr/drivers/mfd/npm13xx.h` + and renamed all instances of ``npm1300``/``NPM1300`` to ``npm13xx``/``NPM13XX`` in the enums and + function names +* Renamed ``CONFIG_MFD_NPM1300`` to :kconfig:option:`CONFIG_MFD_NPM13XX`, + ``CONFIG_MFD_NPM1300_INIT_PRIORITY`` to :kconfig:option:`CONFIG_MFD_NPM13XX_INIT_PRIORITY` + +Regulator +========= + +* Moved file ``include/zephyr/dt-bindings/regulator/npm1300.h`` to + :zephyr_file:`include/zephyr/dt-bindings/regulator/npm13xx.h` and renamed all instances of + ``NPM1300`` to ``NPM13XX`` in the defines +* Renamed ``CONFIG_REGULATOR_NPM1300`` to :kconfig:option:`CONFIG_REGULATOR_NPM13XX`, + ``CONFIG_REGULATOR_NPM1300_COMMON_INIT_PRIORITY`` to :kconfig:option:`REGULATOR_NPM13XX_COMMON_INIT_PRIORITY`, + ``CONFIG_REGULATOR_NPM1300_INIT_PRIORITY`` to :kconfig:option:`CONFIG_REGULATOR_NPM13XX_INIT_PRIORITY` + Sensors ======= @@ -255,6 +284,12 @@ Sensors * The binding file for :dtcompatible:`raspberrypi,pico-temp.yaml` has been renamed to have a name matching the compatible string. +* Moved file ``include/zephyr/drivers/sensor/npm1300_charger.h`` to + :zephyr_file:`include/zephyr/drivers/sensor/npm13xx_charger.h` and renamed all instances of + ``NPM1300`` to ``NPM13XX`` in the enums + +* Renamed ``CONFIG_NPM1300_CHARGER`` to :kconfig:option:`CONFIG_NPM13XX_CHARGER` + Serial ======= @@ -304,6 +339,11 @@ Timer reg-names = "mtime", "mtimecmp"; }; +Watchdog +======== +* Renamed ``CONFIG_WDT_NPM1300`` to :kconfig:option:`CONFIG_WDT_NPM13XX`, + ``CONFIG_WDT_NPM1300_INIT_PRIORITY`` to :kconfig:option:`CONFIG_WDT_NPM13XX_INIT_PRIORITY` + Modem ===== From 99296da29b10237f76ac26359f50475b31cfffcb Mon Sep 17 00:00:00 2001 From: Sergei Ovchinnikov Date: Fri, 23 May 2025 13:49:53 +0200 Subject: [PATCH 0106/2141] [nrf fromtree] tests: drivers: build_all: add npm1300 and npm1304 devices Add the npm1300 and npm1304 devices tests to the appropriate build_all Signed-off-by: Sergei Ovchinnikov (cherry picked from commit 3b035954f292867c0f8f00f025e486904cee30cd) --- tests/drivers/build_all/gpio/app.overlay | 24 +++++++++++++++ tests/drivers/build_all/led/app.overlay | 24 +++++++++++++++ tests/drivers/build_all/regulator/i2c.dtsi | 14 +++++++++ tests/drivers/build_all/sensor/i2c.dtsi | 29 +++++++++++++++++++ .../build_all/watchdog/i2c_devices.overlay | 18 ++++++++++++ 5 files changed, 109 insertions(+) diff --git a/tests/drivers/build_all/gpio/app.overlay b/tests/drivers/build_all/gpio/app.overlay index ccb794dd8477..367455b5f0db 100644 --- a/tests/drivers/build_all/gpio/app.overlay +++ b/tests/drivers/build_all/gpio/app.overlay @@ -413,6 +413,30 @@ ngpios = <16>; int-gpios = <&test_gpio 0 0>; }; + + test_i2c_npm1300: pmic@1d { + compatible = "nordic,npm1300"; + reg = <0x1d>; + + npm1300_gpio: gpio-controller { + compatible = "nordic,npm1300-gpio"; + gpio-controller; + #gpio-cells = <2>; + ngpios = <5>; + }; + }; + + test_i2c_npm1304: pmic@1e { + compatible = "nordic,npm1304"; + reg = <0x1e>; + + npm1304_gpio: gpio-controller { + compatible = "nordic,npm1304-gpio"; + gpio-controller; + #gpio-cells = <2>; + ngpios = <5>; + }; + }; }; nct3807_alert_1 { diff --git a/tests/drivers/build_all/led/app.overlay b/tests/drivers/build_all/led/app.overlay index e25825064a8a..6a48cc3d9054 100644 --- a/tests/drivers/build_all/led/app.overlay +++ b/tests/drivers/build_all/led/app.overlay @@ -168,6 +168,30 @@ x-powers,mode = "by-reg"; }; }; + + pmic@13 { + compatible = "nordic,npm1300"; + reg = <0x13>; + + leds { + compatible = "nordic,npm1300-led"; + nordic,led0-mode = "error"; + nordic,led1-mode = "charging"; + nordic,led2-mode = "host"; + }; + }; + + pmic@14 { + compatible = "nordic,npm1304"; + reg = <0x14>; + + leds { + compatible = "nordic,npm1304-led"; + nordic,led0-mode = "error"; + nordic,led1-mode = "charging"; + nordic,led2-mode = "host"; + }; + }; }; }; }; diff --git a/tests/drivers/build_all/regulator/i2c.dtsi b/tests/drivers/build_all/regulator/i2c.dtsi index ea81c2c3886f..4c8cb31958a5 100644 --- a/tests/drivers/build_all/regulator/i2c.dtsi +++ b/tests/drivers/build_all/regulator/i2c.dtsi @@ -143,3 +143,17 @@ npm2100@8 { LDOSW {}; }; }; + +npm1304@9 { + compatible = "nordic,npm1304"; + reg = <0x9>; + + regulators { + compatible = "nordic,npm1304-regulator"; + + BUCK1 {}; + BUCK2 {}; + LDO1 {}; + LDO2 {}; + }; +}; diff --git a/tests/drivers/build_all/sensor/i2c.dtsi b/tests/drivers/build_all/sensor/i2c.dtsi index 6ebced542043..64edbec396a2 100644 --- a/tests/drivers/build_all/sensor/i2c.dtsi +++ b/tests/drivers/build_all/sensor/i2c.dtsi @@ -1331,3 +1331,32 @@ test_i2c_bh1730: bh1730@b4 { compatible = "rohm,bh1730"; reg = <0xb4>; }; + +test_i2c_npm1300: npm1300@b5 { + compatible = "nordic,npm1300"; + reg = <0xb5>; + + charger { + compatible = "nordic,npm1300-charger"; + vbus-limit-microamp = <1000000>; + thermistor-ohms = <10000>; + thermistor-beta = <3380>; + term-microvolt = <4150000>; + current-microamp = <150000>; + dischg-limit-microamp = <1000000>; + }; +}; + +test_i2c_npm1304: npm1304@b6 { + compatible = "nordic,npm1304"; + reg = <0xb6>; + + charger { + compatible = "nordic,npm1304-charger"; + vbus-limit-microamp = <1000000>; + thermistor-ohms = <10000>; + thermistor-beta = <3380>; + term-microvolt = <4150000>; + current-microamp = <10000>; + }; +}; diff --git a/tests/drivers/build_all/watchdog/i2c_devices.overlay b/tests/drivers/build_all/watchdog/i2c_devices.overlay index fcecf91a1228..0c709d30b06c 100644 --- a/tests/drivers/build_all/watchdog/i2c_devices.overlay +++ b/tests/drivers/build_all/watchdog/i2c_devices.overlay @@ -41,6 +41,24 @@ compatible = "nordic,npm2100-wdt"; }; }; + + npm1300_pmic: pmic@2 { + compatible = "nordic,npm1300"; + reg = <0x2>; + + npm1300_wdt: watchdog { + compatible = "nordic,npm1300-wdt"; + }; + }; + + npm1304_pmic: pmic@3 { + compatible = "nordic,npm1304"; + reg = <0x3>; + + npm1304_wdt: watchdog { + compatible = "nordic,npm1304-wdt"; + }; + }; }; }; }; From bcb3484d592a8a1537652467e56361bb23080fd9 Mon Sep 17 00:00:00 2001 From: Juha Ylinen Date: Thu, 26 Jun 2025 13:12:00 +0300 Subject: [PATCH 0107/2141] [nrf fromtree] net: http_client: Fix handling of POLLHUP POLLHUP event may be returned even if there is still data to read and POLLIN is set. To ensure all data is consumed, check for POLLHUP after handling POLLIN. https://man7.org/linux/man-pages/man2/poll.2.html Signed-off-by: Juha Ylinen (cherry picked from commit ed79675199c321132ebb484895bba85400cad34b) --- subsys/net/lib/http/http_client.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/subsys/net/lib/http/http_client.c b/subsys/net/lib/http/http_client.c index fe00609322ed..01cf8fb134e4 100644 --- a/subsys/net/lib/http/http_client.c +++ b/subsys/net/lib/http/http_client.c @@ -517,9 +517,6 @@ static int http_wait_data(int sock, struct http_request *req, const k_timepoint_ } else if (fds[0].revents & ZSOCK_POLLNVAL) { ret = -EBADF; goto error; - } else if (fds[0].revents & ZSOCK_POLLHUP) { - /* Connection closed */ - goto closed; } else if (fds[0].revents & ZSOCK_POLLIN) { received = zsock_recv(sock, req->internal.response.recv_buf + offset, req->internal.response.recv_buf_len - offset, 0); @@ -593,6 +590,9 @@ static int http_wait_data(int sock, struct http_request *req, const k_timepoint_ req->internal.response.recv_buf + processed, offset); } + } else if (fds[0].revents & ZSOCK_POLLHUP) { + /* Connection closed */ + goto closed; } } while (!req->internal.response.message_complete); From 27f9e51b1794e4d491e22d77b472e4ed4b845b22 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Mon, 12 May 2025 15:16:39 +0200 Subject: [PATCH 0108/2141] [nrf fromtree] samples: Bluetooth: BAP: BA: Reset states and modify error checking Modify the reset function to also reset the connection and PA sync states. Modify and add missing checks for mutex locks to use ASSERT when using K_FOREVER, as they should never fail/timeout. Cleanup some text and error checks. Ensure that the add_src_param is reset for each loop iteration as well. Modify so that we use K_FOREVER fewer places. Signed-off-by: Emil Gydesen (cherry picked from commit 117dca089ab5a5504b059b397fceb1524f787715) --- .../bap_broadcast_assistant/src/main.c | 151 +++++++++++------- 1 file changed, 89 insertions(+), 62 deletions(-) diff --git a/samples/bluetooth/bap_broadcast_assistant/src/main.c b/samples/bluetooth/bap_broadcast_assistant/src/main.c index a0471f2ee6f0..6458bfe60fe3 100644 --- a/samples/bluetooth/bap_broadcast_assistant/src/main.c +++ b/samples/bluetooth/bap_broadcast_assistant/src/main.c @@ -1,11 +1,12 @@ /* * Copyright (c) 2024 Demant A/S - * Copyright (c) 2024 Nordic Semiconductor ASA + * Copyright (c) 2024-2025 Nordic Semiconductor ASA * * SPDX-License-Identifier: Apache-2.0 */ #include +#include #include #include #include @@ -24,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -33,6 +35,8 @@ #define PA_SYNC_SKIP 5 #define PA_SYNC_INTERVAL_TO_TIMEOUT_RATIO 20 /* Set the timeout relative to interval */ /* Broadcast IDs are 24bit, so this is out of valid range */ +/* Default semaphore timeout when waiting for an action */ +#define SEM_TIMEOUT K_SECONDS(10) static void scan_for_broadcast_sink(void); @@ -68,6 +72,7 @@ static K_SEM_DEFINE(sem_sink_disconnected, 0, 1); static K_SEM_DEFINE(sem_security_updated, 0, 1); static K_SEM_DEFINE(sem_bass_discovered, 0, 1); static K_SEM_DEFINE(sem_pa_synced, 0, 1); +static K_SEM_DEFINE(sem_pa_sync_terminted, 0, 1); static K_SEM_DEFINE(sem_received_base_subgroups, 0, 1); static bool device_found(struct bt_data *data, void *user_data) @@ -147,6 +152,7 @@ static bool base_store(struct bt_data *data, void *user_data) const struct bt_bap_base *base = bt_bap_base_get_base_from_ad(data); int base_size; int base_subgroup_count; + int err; /* Base is NULL if the data does not contain a valid BASE */ if (base == NULL) { @@ -168,13 +174,19 @@ static bool base_store(struct bt_data *data, void *user_data) } /* Compare BASE and copy if different */ - k_mutex_lock(&base_store_mutex, K_FOREVER); + err = k_mutex_lock(&base_store_mutex, K_MSEC(100)); + if (err != 0) { + /* Could not get BASE mutex, wait for new to avoid blocking */ + return false; + } + if ((size_t)base_size != received_base_size || memcmp(base, received_base, (size_t)base_size) != 0) { (void)memcpy(received_base, base, base_size); received_base_size = (size_t)base_size; } - k_mutex_unlock(&base_store_mutex); + err = k_mutex_unlock(&base_store_mutex); + __ASSERT_NO_MSG(err == 0); /* Stop parsing */ k_sem_give(&sem_received_base_subgroups); @@ -419,9 +431,7 @@ static void scan_for_broadcast_source(void) printk("Scanning for Broadcast Source successfully started\n"); err = k_sem_take(&sem_source_discovered, K_FOREVER); - if (err != 0) { - printk("Failed to take sem_source_discovered (err %d)\n", err); - } + __ASSERT_NO_MSG(err == 0); } static void scan_for_broadcast_sink(void) @@ -439,9 +449,7 @@ static void scan_for_broadcast_sink(void) printk("Scanning for Broadcast Sink successfully started\n"); err = k_sem_take(&sem_sink_discovered, K_FOREVER); - if (err != 0) { - printk("Failed to take sem_sink_discovered (err %d)\n", err); - } + __ASSERT_NO_MSG(err == 0); } static void connected(struct bt_conn *conn, uint8_t err) @@ -528,6 +536,16 @@ static void pa_sync_synced_cb(struct bt_le_per_adv_sync *sync, k_sem_give(&sem_pa_synced); } } +static void pa_sync_term_cb(struct bt_le_per_adv_sync *sync, + const struct bt_le_per_adv_sync_term_info *info) +{ + if (sync == pa_sync) { + printk("PA sync %p terminated with reason %u\n", sync, info->reason); + + k_sem_give(&sem_pa_sync_terminted); + pa_sync = NULL; + } +} static struct bt_bap_broadcast_assistant_cb ba_cbs = { .discover = bap_broadcast_assistant_discover_cb, @@ -536,14 +554,49 @@ static struct bt_bap_broadcast_assistant_cb ba_cbs = { static struct bt_le_per_adv_sync_cb pa_synced_cb = { .synced = pa_sync_synced_cb, + .term = pa_sync_term_cb, .recv = pa_recv, }; static void reset(void) { - printk("\n\nReset...\n\n"); + int err; + + printk("\n\nResetting...\n\n"); + + if (broadcast_sink_conn != NULL) { + err = bt_conn_disconnect(broadcast_sink_conn, BT_HCI_ERR_LOCALHOST_TERM_CONN); + + if (err != 0) { + printk("bt_conn_disconnect failed with %d\n", err); + } else { + if (k_sem_take(&sem_sink_disconnected, SEM_TIMEOUT) != 0) { + /* This should not happen */ + + __ASSERT_NO_MSG(false); + } + } + __ASSERT_NO_MSG(err == 0); + } + + /* Ignore return value as scanning may already be stopped */ + (void)bt_le_scan_stop(); + + if (pa_sync != NULL) { + err = bt_le_per_adv_sync_delete(pa_sync); + + if (err != 0) { + printk("bt_le_per_adv_sync_delete failed with %d\n", err); + } else { + if (k_sem_take(&sem_pa_sync_terminted, SEM_TIMEOUT) != 0) { + /* This should not happen */ + + __ASSERT_NO_MSG(false); + } + } + __ASSERT_NO_MSG(err == 0); + } - broadcast_sink_conn = NULL; selected_broadcast_id = BT_BAP_INVALID_BROADCAST_ID; selected_sid = 0; selected_pa_interval = 0; @@ -568,7 +621,6 @@ BT_CONN_CB_DEFINE(conn_callbacks) = { int main(void) { int err; - struct bt_bap_broadcast_assistant_add_src_param param = { 0 }; err = bt_enable(NULL); if (err) { @@ -585,45 +637,33 @@ int main(void) k_mutex_init(&base_store_mutex); while (true) { + struct bt_bap_broadcast_assistant_add_src_param param = {0}; + + reset(); + scan_for_broadcast_sink(); - err = k_sem_take(&sem_sink_connected, K_FOREVER); + err = k_sem_take(&sem_sink_connected, SEM_TIMEOUT); if (err != 0) { printk("Failed to take sem_sink_connected (err %d)\n", err); + continue; } err = bt_bap_broadcast_assistant_discover(broadcast_sink_conn); if (err != 0) { printk("Failed to discover BASS on the sink (err %d)\n", err); + continue; } - err = k_sem_take(&sem_security_updated, K_SECONDS(10)); + err = k_sem_take(&sem_security_updated, SEM_TIMEOUT); if (err != 0) { - printk("Failed to take sem_security_updated (err %d), resetting\n", err); - bt_conn_disconnect(broadcast_sink_conn, BT_HCI_ERR_AUTH_FAIL); - - if (k_sem_take(&sem_sink_disconnected, K_SECONDS(10)) != 0) { - /* This should not happen */ - return -ETIMEDOUT; - } - - reset(); + printk("Failed to take sem_security_updated (err %d)\n", err); continue; } - err = k_sem_take(&sem_bass_discovered, K_SECONDS(10)); + err = k_sem_take(&sem_bass_discovered, SEM_TIMEOUT); if (err != 0) { - if (err == -EAGAIN) { - printk("Failed to take sem_bass_discovered (err %d)\n", err); - } - bt_conn_disconnect(broadcast_sink_conn, BT_HCI_ERR_UNSUPP_REMOTE_FEATURE); - - if (k_sem_take(&sem_sink_disconnected, K_SECONDS(10)) != 0) { - /* This should not happen */ - return -ETIMEDOUT; - } - - reset(); + printk("Failed to take sem_bass_discovered (err %d)\n", err); continue; } @@ -636,19 +676,19 @@ int main(void) scan_for_broadcast_source(); - printk("Scan stopped, attempting to PA sync to the broadcaster with id 0x%06X\n", + printk("Attempting to PA sync to the broadcaster with id 0x%06X\n", selected_broadcast_id); err = pa_sync_create(); if (err != 0) { - printk("Could not create Broadcast PA sync: %d, resetting\n", err); - return -ETIMEDOUT; + printk("Could not create Broadcast PA sync: %d\n", err); + continue; } printk("Waiting for PA synced\n"); - err = k_sem_take(&sem_pa_synced, K_FOREVER); + err = k_sem_take(&sem_pa_synced, SEM_TIMEOUT); if (err != 0) { - printk("sem_pa_synced timed out, resetting\n"); - return err; + printk("Failed to take sem_pa_synced (err %d)\n", err); + continue; } memset(bass_subgroups, 0, sizeof(bass_subgroups)); @@ -661,42 +701,29 @@ int main(void) /* Wait to receive subgroups */ err = k_sem_take(&sem_received_base_subgroups, K_FOREVER); - if (err != 0) { - printk("Failed to take sem_received_base_subgroups (err %d)\n", err); - return err; - } + __ASSERT_NO_MSG(err == 0); - k_mutex_lock(&base_store_mutex, K_FOREVER); + err = k_mutex_lock(&base_store_mutex, K_FOREVER); + __ASSERT_NO_MSG(err == 0); err = bt_bap_base_foreach_subgroup((const struct bt_bap_base *)received_base, add_pa_sync_base_subgroup_cb, ¶m); - k_mutex_unlock(&base_store_mutex); + err = k_mutex_unlock(&base_store_mutex); + __ASSERT_NO_MSG(err == 0); - if (err < 0) { + if (err != 0) { printk("Could not add BASE to params %d\n", err); continue; } err = bt_bap_broadcast_assistant_add_src(broadcast_sink_conn, ¶m); - if (err) { + if (err != 0) { printk("Failed to add source: %d\n", err); - bt_conn_disconnect(broadcast_sink_conn, BT_HCI_ERR_UNSUPP_REMOTE_FEATURE); - - if (k_sem_take(&sem_sink_disconnected, K_SECONDS(10)) != 0) { - /* This should not happen */ - return -ETIMEDOUT; - } - - reset(); continue; } /* Reset if the sink disconnects */ err = k_sem_take(&sem_sink_disconnected, K_FOREVER); - if (err != 0) { - printk("Failed to take sem_sink_disconnected (err %d)\n", err); - } - - reset(); + __ASSERT_NO_MSG(err == 0); } return 0; From 723be97ffae963033c55d6edc2e7e439d5c15e8a Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Tue, 24 Jun 2025 12:37:25 +0200 Subject: [PATCH 0109/2141] [nrf fromtree] drivers: gpio: nrfx: extend pin retain to every pin The usage of nrf_gpio_port_retain_disable/_enable, in cases where the soc pins support retention, every pin must be retained/unretained regardless of what power domain the pad is in. This patch ensures retain is applied to all pins in all domains by the gpio_nrfx device driver, not only pins specifically in the fast_active_1 domain. Without this patch, pinctrl will correctly retain pins, while gpio_nrfx will fail to unretain them when again. We no longer check the output state either, which was passed with the flags arg of gpio_nrfx_gpd_retain_set() so this arg has been removed. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit 691b3356f8fceb5d58600e43140dba55dbe1581d) --- drivers/gpio/gpio_nrfx.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/drivers/gpio/gpio_nrfx.c b/drivers/gpio/gpio_nrfx.c index b6548ed22d53..0a94b84c67fd 100644 --- a/drivers/gpio/gpio_nrfx.c +++ b/drivers/gpio/gpio_nrfx.c @@ -64,20 +64,15 @@ static nrf_gpio_pin_pull_t get_pull(gpio_flags_t flags) return NRF_GPIO_PIN_NOPULL; } -static void gpio_nrfx_gpd_retain_set(const struct device *port, uint32_t mask, gpio_flags_t flags) +static void gpio_nrfx_gpd_retain_set(const struct device *port, uint32_t mask) { #ifdef CONFIG_SOC_NRF54H20_GPD const struct gpio_nrfx_cfg *cfg = get_port_cfg(port); - if (cfg->pad_pd != NRF_GPD_FAST_ACTIVE1 || !(flags & GPIO_OUTPUT)) { - return; - } - nrf_gpio_port_retain_enable(cfg->port, mask); #else ARG_UNUSED(port); ARG_UNUSED(mask); - ARG_UNUSED(flags); #endif } @@ -86,10 +81,6 @@ static void gpio_nrfx_gpd_retain_clear(const struct device *port, uint32_t mask) #ifdef CONFIG_SOC_NRF54H20_GPD const struct gpio_nrfx_cfg *cfg = get_port_cfg(port); - if (cfg->pad_pd != NRF_GPD_FAST_ACTIVE1) { - return; - } - nrf_gpio_port_retain_disable(cfg->port, mask); #else ARG_UNUSED(port); @@ -225,7 +216,7 @@ static int gpio_nrfx_pin_configure(const struct device *port, gpio_pin_t pin, } end: - gpio_nrfx_gpd_retain_set(port, BIT(pin), flags); + gpio_nrfx_gpd_retain_set(port, BIT(pin)); return pm_device_runtime_put(port); } @@ -329,7 +320,7 @@ static int gpio_nrfx_port_set_masked_raw(const struct device *port, gpio_nrfx_gpd_retain_clear(port, mask); nrf_gpio_port_out_set(reg, set_mask); nrf_gpio_port_out_clear(reg, clear_mask); - gpio_nrfx_gpd_retain_set(port, mask, GPIO_OUTPUT); + gpio_nrfx_gpd_retain_set(port, mask); return pm_device_runtime_put(port); } @@ -346,7 +337,7 @@ static int gpio_nrfx_port_set_bits_raw(const struct device *port, gpio_nrfx_gpd_retain_clear(port, mask); nrf_gpio_port_out_set(reg, mask); - gpio_nrfx_gpd_retain_set(port, mask, GPIO_OUTPUT); + gpio_nrfx_gpd_retain_set(port, mask); return pm_device_runtime_put(port); } @@ -363,7 +354,7 @@ static int gpio_nrfx_port_clear_bits_raw(const struct device *port, gpio_nrfx_gpd_retain_clear(port, mask); nrf_gpio_port_out_clear(reg, mask); - gpio_nrfx_gpd_retain_set(port, mask, GPIO_OUTPUT); + gpio_nrfx_gpd_retain_set(port, mask); return pm_device_runtime_put(port); } @@ -384,7 +375,7 @@ static int gpio_nrfx_port_toggle_bits(const struct device *port, gpio_nrfx_gpd_retain_clear(port, mask); nrf_gpio_port_out_set(reg, set_mask); nrf_gpio_port_out_clear(reg, clear_mask); - gpio_nrfx_gpd_retain_set(port, mask, GPIO_OUTPUT); + gpio_nrfx_gpd_retain_set(port, mask); return pm_device_runtime_put(port); } From 971e2e3c7d69adb685d35d3050767064927f7ebf Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Wed, 25 Jun 2025 15:55:03 +0200 Subject: [PATCH 0110/2141] [nrf fromtree] drivers: pinctrl: nrf: patch pin retain to follow lp mode Pins can be configured to retain their config even when the power domain they belong to is suspended. Update pinctrl_nrf to enable retain only if the pin has been configured and is not in use (pincnf is low-power/sleep), disable retain otherwise. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit 652635fab9d41d763716cd188414b45f4049c7a9) --- drivers/pinctrl/pinctrl_nrf.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/pinctrl/pinctrl_nrf.c b/drivers/pinctrl/pinctrl_nrf.c index 3744abf80313..07941fcb5ad5 100644 --- a/drivers/pinctrl/pinctrl_nrf.c +++ b/drivers/pinctrl/pinctrl_nrf.c @@ -483,9 +483,13 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, } gpd_requested = true; } - - nrf_gpio_pin_retain_disable(pin); } + + /* + * Pad power domain now on, retain no longer needed + * as pad config will be persists as pad is powered. + */ + nrf_gpio_pin_retain_disable(pin); #endif /* CONFIG_SOC_NRF54H20_GPD */ if (write != NO_WRITE) { @@ -504,7 +508,13 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, nrf_gpio_pin_clock_set(pin, NRF_GET_CLOCKPIN_ENABLE(pins[i])); #endif #ifdef CONFIG_SOC_NRF54H20_GPD - if (NRF_GET_GPD_FAST_ACTIVE1(pins[i]) == 1U) { + if (NRF_GET_LP(pins[i]) == NRF_LP_ENABLE) { + /* + * Pad power domain may be turned off, and pad is not + * actively used as pincnf is low-power. Enable retain + * to ensure pad output and config persists if pad + * power domain is suspended. + */ nrf_gpio_pin_retain_enable(pin); } #endif /* CONFIG_SOC_NRF54H20_GPD */ From 7d657f646c8ae7d4a4404b4bc1635d94329eff7b Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Fri, 9 May 2025 12:44:01 +0200 Subject: [PATCH 0111/2141] [nrf fromtree] drivers: spi: add DEINIT_ variants of SPI_DEVICE_ macros Add DEVICE_DEINIT variants of SPI_DEVICE_ macros. These include - SPI_DEVICE_DT_DEINIT_DEFINE() - SPI_DEVICE_DT_INST_DEINIT_DEFINE() Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit 1663253de65a9c0196581685c53de1f4b4e244a5) --- include/zephyr/drivers/spi.h | 56 +++++++++++++++++++++++++++++------- 1 file changed, 46 insertions(+), 10 deletions(-) diff --git a/include/zephyr/drivers/spi.h b/include/zephyr/drivers/spi.h index 8e8cdb5a9941..08a3f03137bc 100644 --- a/include/zephyr/drivers/spi.h +++ b/include/zephyr/drivers/spi.h @@ -657,16 +657,16 @@ struct spi_device_state { } /** @endcond */ -#define SPI_DEVICE_DT_DEFINE(node_id, init_fn, pm_device, \ - data_ptr, cfg_ptr, level, prio, \ - api_ptr, ...) \ +#define SPI_DEVICE_DT_DEINIT_DEFINE(node_id, init_fn, deinit_fn, \ + pm_device, data_ptr, cfg_ptr, \ + level, prio, api_ptr, ...) \ Z_SPI_DEVICE_STATE_DEFINE(Z_DEVICE_DT_DEV_ID(node_id)); \ Z_SPI_INIT_FN(Z_DEVICE_DT_DEV_ID(node_id), init_fn) \ Z_DEVICE_DEFINE(node_id, Z_DEVICE_DT_DEV_ID(node_id), \ DEVICE_DT_NAME(node_id), \ &UTIL_CAT(Z_DEVICE_DT_DEV_ID(node_id), _init), \ - NULL, Z_DEVICE_DT_FLAGS(node_id), pm_device, \ - data_ptr, cfg_ptr, level, prio, \ + deinit_fn, Z_DEVICE_DT_FLAGS(node_id), \ + pm_device, data_ptr, cfg_ptr, level, prio, \ api_ptr, \ &(Z_DEVICE_STATE_NAME(Z_DEVICE_DT_DEV_ID(node_id)).devstate), \ __VA_ARGS__) @@ -700,8 +700,9 @@ static inline void spi_transceive_stats(const struct device *dev, int error, * @name SPI DT Device Macros * @{ */ + /** - * @brief Like DEVICE_DT_DEFINE() with SPI specifics. + * @brief Like DEVICE_DT_DEINIT_DEFINE() with SPI specifics. * * @details Defines a device which implements the SPI API. May * generate a custom device_state container struct and init_fn @@ -709,6 +710,7 @@ static inline void spi_transceive_stats(const struct device *dev, int error, * * @param node_id The devicetree node identifier. * @param init_fn Name of the init function of the driver. + * @param deinit_fn Name of the deinit function of the driver. * @param pm PM device resources reference (NULL if device does not use PM). * @param data Pointer to the device's private data. * @param config The address to the structure containing the configuration @@ -719,16 +721,16 @@ static inline void spi_transceive_stats(const struct device *dev, int error, * @param api Provides an initial pointer to the API function struct used by * the driver. Can be NULL. */ -#define SPI_DEVICE_DT_DEFINE(node_id, init_fn, pm, \ - data, config, level, prio, \ - api, ...) \ +#define SPI_DEVICE_DT_DEINIT_DEFINE(node_id, init_fn, deinit_fn, pm, data, \ + config, level, prio, api, ...) \ Z_DEVICE_STATE_DEFINE(Z_DEVICE_DT_DEV_ID(node_id)); \ Z_DEVICE_DEFINE(node_id, Z_DEVICE_DT_DEV_ID(node_id), \ - DEVICE_DT_NAME(node_id), init_fn, NULL, \ + DEVICE_DT_NAME(node_id), init_fn, deinit_fn, \ Z_DEVICE_DT_FLAGS(node_id), pm, data, config, \ level, prio, api, \ &Z_DEVICE_STATE_NAME(Z_DEVICE_DT_DEV_ID(node_id)), \ __VA_ARGS__) + /** @} */ #define SPI_STATS_RX_BYTES_INC(dev_) @@ -739,6 +741,40 @@ static inline void spi_transceive_stats(const struct device *dev, int error, #endif /*CONFIG_SPI_STATS*/ +/** + * @brief Like DEVICE_DT_DEINIT_DEFINE() without deinit function. + * + * @details Defines a device which implements the SPI API. May + * generate a custom device_state container struct and init_fn + * wrapper when needed depending on SPI @kconfig{CONFIG_SPI_STATS}. + * + * @param node_id The devicetree node identifier. + * @param init_fn Name of the init function of the driver. + * @param pm PM device resources reference (NULL if device does not use PM). + * @param data Pointer to the device's private data. + * @param config The address to the structure containing the configuration + * information for this instance of the driver. + * @param level The initialization level. See SYS_INIT() for details. + * @param prio Priority within the selected initialization level. See SYS_INIT() + * for details. + * @param api Provides an initial pointer to the API function struct used by + * the driver. Can be NULL. + */ +#define SPI_DEVICE_DT_DEFINE(node_id, init_fn, pm, data, config, level, prio, \ + api, ...) \ + SPI_DEVICE_DT_DEINIT_DEFINE(node_id, init_fn, NULL, pm, data, config, \ + level, prio, api, __VA_ARGS__) + +/** + * @brief Like SPI_DEVICE_DT_DEINIT_DEFINE(), but uses an instance of a `DT_DRV_COMPAT` + * compatible instead of a node identifier. + * + * @param inst Instance number. The `node_id` argument to SPI_DEVICE_DT_DEINIT_DEFINE() is + * set to `DT_DRV_INST(inst)`. + * @param ... Other parameters as expected by SPI_DEVICE_DT_DEFINE(). + */ +#define SPI_DEVICE_DT_INST_DEINIT_DEFINE(inst, ...) \ + SPI_DEVICE_DT_DEINIT_DEFINE(DT_DRV_INST(inst), __VA_ARGS__) /** * @brief Like SPI_DEVICE_DT_DEFINE(), but uses an instance of a `DT_DRV_COMPAT` From 6bf1032959a3f081be41895ee7612bf8507c11d6 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Fri, 9 May 2025 16:18:33 +0200 Subject: [PATCH 0112/2141] [nrf fromtree] drivers: spi: nrfx spim: impl device deinit Implement device deinit for nRF SPIM device driver. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit 2609cfbf4a9558146d6970cf3222dde7480cb4ad) --- drivers/spi/spi_nrfx_spim.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi_nrfx_spim.c b/drivers/spi/spi_nrfx_spim.c index c77e256a7fed..a5c4e30f190e 100644 --- a/drivers/spi/spi_nrfx_spim.c +++ b/drivers/spi/spi_nrfx_spim.c @@ -765,6 +765,28 @@ static int spi_nrfx_init(const struct device *dev) #endif return pm_device_driver_init(dev, spim_nrfx_pm_action); } + +static int spi_nrfx_deinit(const struct device *dev) +{ +#if defined(CONFIG_PM_DEVICE) + enum pm_device_state state; + + /* + * PM must have suspended the device before driver can + * be deinitialized + */ + (void)pm_device_state_get(dev, &state); + return state == PM_DEVICE_STATE_SUSPENDED || + state == PM_DEVICE_STATE_OFF ? + 0 : -EBUSY; +#else + /* PM suspend implementation does everything we need */ + spim_suspend(dev); +#endif + + return 0; +} + /* * We use NODELABEL here because the nrfx API requires us to call * functions which are named according to SoC peripheral instance @@ -870,8 +892,9 @@ static int spi_nrfx_init(const struct device *dev) !(DT_GPIO_FLAGS(SPIM(idx), wake_gpios) & GPIO_ACTIVE_LOW),\ "WAKE line must be configured as active high"); \ PM_DEVICE_DT_DEFINE(SPIM(idx), spim_nrfx_pm_action); \ - SPI_DEVICE_DT_DEFINE(SPIM(idx), \ + SPI_DEVICE_DT_DEINIT_DEFINE(SPIM(idx), \ spi_nrfx_init, \ + spi_nrfx_deinit, \ PM_DEVICE_DT_GET(SPIM(idx)), \ &spi_##idx##_data, \ &spi_##idx##z_config, \ From 188ea59e2d785838c365a31910d0b74d4cc696e6 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Tue, 24 Jun 2025 14:02:57 +0200 Subject: [PATCH 0113/2141] [nrf fromtree] tests: drivers: spi: loopback: test device_deinit Introduce test for device_deinit() which deinitializes the spi bus, then configures miso as input, mosi as output using gpio, utilizing the loopback to test directly controlling the pins. Then reinit the spi device. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit ecb5457898d748dbd906778044d058df2a15b53c) --- tests/drivers/spi/spi_loopback/src/spi.c | 33 +++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/tests/drivers/spi/spi_loopback/src/spi.c b/tests/drivers/spi/spi_loopback/src/spi.c index 5419a7493518..fd2302a4ec0b 100644 --- a/tests/drivers/spi/spi_loopback/src/spi.c +++ b/tests/drivers/spi/spi_loopback/src/spi.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -56,7 +57,8 @@ static int spec_idx; */ struct spi_dt_spec spec_copies[5]; - +const struct gpio_dt_spec miso_pin = GPIO_DT_SPEC_GET_OR(DT_PATH(zephyr_user), miso_gpios, {}); +const struct gpio_dt_spec mosi_pin = GPIO_DT_SPEC_GET_OR(DT_PATH(zephyr_user), mosi_gpios, {}); /* ******************** @@ -807,6 +809,35 @@ ZTEST(spi_loopback, test_spi_concurrent_transfer_different_spec) test_spi_concurrent_transfer_helper(specs); } +ZTEST(spi_loopback, test_spi_deinit) +{ + struct spi_dt_spec *spec = loopback_specs[0]; + const struct device *dev = spec->bus; + int ret; + + if (miso_pin.port == NULL || mosi_pin.port == NULL) { + TC_PRINT(" zephyr,user miso-gpios or mosi-gpios are not defined\n"); + ztest_test_skip(); + } + + ret = device_deinit(dev); + if (ret == -ENOTSUP) { + TC_PRINT(" device deinit not supported\n"); + ztest_test_skip(); + } + + zassert_ok(ret); + zassert_ok(gpio_pin_configure_dt(&miso_pin, GPIO_INPUT)); + zassert_ok(gpio_pin_configure_dt(&mosi_pin, GPIO_OUTPUT_INACTIVE)); + zassert_equal(gpio_pin_get_dt(&miso_pin), 0); + zassert_ok(gpio_pin_set_dt(&mosi_pin, 1)); + zassert_equal(gpio_pin_get_dt(&miso_pin), 1); + zassert_ok(gpio_pin_set_dt(&mosi_pin, 0)); + zassert_equal(gpio_pin_get_dt(&miso_pin), 0); + zassert_ok(gpio_pin_configure_dt(&mosi_pin, GPIO_INPUT)); + zassert_ok(device_init(dev)); +} + #if (CONFIG_SPI_ASYNC) static struct k_poll_signal async_sig = K_POLL_SIGNAL_INITIALIZER(async_sig); static struct k_poll_event async_evt = From 722d5bce6a113aa94319e2c15d32d82a34950221 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Tue, 24 Jun 2025 15:00:30 +0200 Subject: [PATCH 0114/2141] [nrf fromtree] tests: drivers: spi: loopback: extend nrf overlays with miso/mosi Add miso-gpios and mosi-gpios to nrf overlays required for device_deinit testing. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit 160c196435b4e38dc97d49ad4fd64b1505915a61) --- .../spi_loopback/boards/nrf54h20dk_nrf54h20_common.dtsi | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_common.dtsi b/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_common.dtsi index 33170beda44e..5111257a557d 100644 --- a/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_common.dtsi +++ b/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_common.dtsi @@ -4,6 +4,15 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include + +/ { + zephyr,user { + miso-gpios = <&gpio0 6 GPIO_ACTIVE_HIGH>; + mosi-gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>; + }; +}; + &pinctrl { spi130_default: spi130_default { group1 { From 8881b5d8c2c10de06737d27947cd247975814850 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Thu, 19 Jun 2025 15:46:40 +0200 Subject: [PATCH 0115/2141] [nrf fromtree] drivers: i2c: add I2C_DEVICE_DT_DEINIT macros Add device deinit variants of the I2C_DEVICE_DT_*_DEFINE macros. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit 8a928ea1d7f57880a63693619cac99a6e673d18f) --- include/zephyr/drivers/i2c.h | 37 ++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/include/zephyr/drivers/i2c.h b/include/zephyr/drivers/i2c.h index 09640e3275d3..c1972782660c 100644 --- a/include/zephyr/drivers/i2c.h +++ b/include/zephyr/drivers/i2c.h @@ -635,7 +635,7 @@ static inline void i2c_xfer_stats(const struct device *dev, struct i2c_msg *msgs /** @endcond */ /** - * @brief Like DEVICE_DT_DEFINE() with I2C specifics. + * @brief Like DEVICE_DT_DEINIT_DEFINE() with I2C specifics. * * @details Defines a device which implements the I2C API. May * generate a custom device_state container struct and init_fn @@ -645,6 +645,8 @@ static inline void i2c_xfer_stats(const struct device *dev, struct i2c_msg *msgs * * @param init_fn Name of the init function of the driver. Can be `NULL`. * + * @param deinit_fn Name of the deinit function of the driver. Can be `NULL`. + * * @param pm PM device resources reference (NULL if device does not use PM). * * @param data Pointer to the device's private data. @@ -661,14 +663,14 @@ static inline void i2c_xfer_stats(const struct device *dev, struct i2c_msg *msgs * @param api Provides an initial pointer to the API function struct * used by the driver. Can be NULL. */ -#define I2C_DEVICE_DT_DEFINE(node_id, init_fn, pm, data, config, level, \ - prio, api, ...) \ +#define I2C_DEVICE_DT_DEINIT_DEFINE(node_id, init_fn, deinit_fn, pm, \ + data, config, level, prio, api, ...)\ Z_I2C_DEVICE_STATE_DEFINE(Z_DEVICE_DT_DEV_ID(node_id)); \ Z_I2C_INIT_FN(Z_DEVICE_DT_DEV_ID(node_id), init_fn) \ Z_DEVICE_DEFINE(node_id, Z_DEVICE_DT_DEV_ID(node_id), \ DEVICE_DT_NAME(node_id), \ &UTIL_CAT(Z_DEVICE_DT_DEV_ID(node_id), _init), \ - NULL, Z_DEVICE_DT_FLAGS(node_id), pm, data, \ + deinit_fn, Z_DEVICE_DT_FLAGS(node_id), pm, data,\ config, level, prio, api, \ &(Z_DEVICE_STATE_NAME(Z_DEVICE_DT_DEV_ID(node_id)).devstate), \ __VA_ARGS__) @@ -683,12 +685,32 @@ static inline void i2c_xfer_stats(const struct device *dev, struct i2c_msg *msgs ARG_UNUSED(num_msgs); } +#define I2C_DEVICE_DT_DEINIT_DEFINE(node_id, init_fn, deinit_fn, pm, \ + data, config, level, prio, api, ...)\ + DEVICE_DT_DEINIT_DEFINE(node_id, init_fn, deinit_fn, pm, data, \ + config, level, prio, api, __VA_ARGS__) + +#endif /* CONFIG_I2C_STATS */ + +/** + * @brief Like I2C_DEVICE_DT_DEINIT_DEFINE() but without deinit_fn + */ #define I2C_DEVICE_DT_DEFINE(node_id, init_fn, pm, data, config, level, \ prio, api, ...) \ - DEVICE_DT_DEFINE(node_id, init_fn, pm, data, config, level, \ - prio, api, __VA_ARGS__) + I2C_DEVICE_DT_DEINIT_DEFINE(node_id, init_fn, NULL, pm, data, \ + config, level, prio, api, \ + __VA_ARGS__) -#endif /* CONFIG_I2C_STATS */ +/** + * @brief Like I2C_DEVICE_DT_DEINIT_DEFINE() for an instance of a DT_DRV_COMPAT compatible + * + * @param inst instance number. This is replaced by + * DT_DRV_COMPAT(inst) in the call to I2C_DEVICE_DT_DEINIT_DEFINE(). + * + * @param ... other parameters as expected by I2C_DEVICE_DT_DEINIT_DEFINE(). + */ +#define I2C_DEVICE_DT_INST_DEINIT_DEFINE(inst, ...) \ + I2C_DEVICE_DT_DEINIT_DEFINE(DT_DRV_INST(inst), __VA_ARGS__) /** * @brief Like I2C_DEVICE_DT_DEFINE() for an instance of a DT_DRV_COMPAT compatible @@ -701,7 +723,6 @@ static inline void i2c_xfer_stats(const struct device *dev, struct i2c_msg *msgs #define I2C_DEVICE_DT_INST_DEFINE(inst, ...) \ I2C_DEVICE_DT_DEFINE(DT_DRV_INST(inst), __VA_ARGS__) - /** * @brief Configure operation of a host controller. * From 68e71ff2c42d6d0254fb981a21954d4a491e00c1 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Thu, 19 Jun 2025 15:49:20 +0200 Subject: [PATCH 0116/2141] [nrf fromtree] drivers: i2c: nrfx_twim: impl device deinit Implement device deinit for the nRF TWIM device drivers. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit bd73c739b4d22fcb2bc6d09bc988941d8b962568) --- drivers/i2c/i2c_nrfx_twim.c | 8 ++++- drivers/i2c/i2c_nrfx_twim_common.c | 50 +++++++++++++++++++++++++++--- drivers/i2c/i2c_nrfx_twim_common.h | 1 + drivers/i2c/i2c_nrfx_twim_rtio.c | 14 ++++++--- 4 files changed, 63 insertions(+), 10 deletions(-) diff --git a/drivers/i2c/i2c_nrfx_twim.c b/drivers/i2c/i2c_nrfx_twim.c index d5b619bfc5ac..b6c37f455dc1 100644 --- a/drivers/i2c/i2c_nrfx_twim.c +++ b/drivers/i2c/i2c_nrfx_twim.c @@ -224,6 +224,11 @@ static int i2c_nrfx_twim_init(const struct device *dev) return i2c_nrfx_twim_common_init(dev); } +static int i2c_nrfx_twim_deinit(const struct device *dev) +{ + return i2c_nrfx_twim_common_deinit(dev); +} + static DEVICE_API(i2c, i2c_nrfx_twim_driver_api) = { .configure = i2c_nrfx_twim_configure, .transfer = i2c_nrfx_twim_transfer, @@ -280,8 +285,9 @@ static DEVICE_API(i2c, i2c_nrfx_twim_driver_api) = { }; \ PM_DEVICE_DT_DEFINE(I2C(idx), twim_nrfx_pm_action, \ PM_DEVICE_ISR_SAFE); \ - I2C_DEVICE_DT_DEFINE(I2C(idx), \ + I2C_DEVICE_DT_DEINIT_DEFINE(I2C(idx), \ i2c_nrfx_twim_init, \ + i2c_nrfx_twim_deinit, \ PM_DEVICE_DT_GET(I2C(idx)), \ &twim_##idx##_data, \ &twim_##idx##z_config, \ diff --git a/drivers/i2c/i2c_nrfx_twim_common.c b/drivers/i2c/i2c_nrfx_twim_common.c index 1539d7c90ddd..f7fd0d097b0a 100644 --- a/drivers/i2c/i2c_nrfx_twim_common.c +++ b/drivers/i2c/i2c_nrfx_twim_common.c @@ -102,18 +102,30 @@ int i2c_nrfx_twim_msg_transfer(const struct device *dev, uint8_t flags, uint8_t return ret; } -int twim_nrfx_pm_action(const struct device *dev, enum pm_device_action action) +void twim_nrfx_pm_resume(const struct device *dev) { const struct i2c_nrfx_twim_common_config *config = dev->config; + (void)pinctrl_apply_state(config->pcfg, PINCTRL_STATE_DEFAULT); + nrfx_twim_enable(&config->twim); +} + +void twim_nrfx_pm_suspend(const struct device *dev) +{ + const struct i2c_nrfx_twim_common_config *config = dev->config; + + nrfx_twim_disable(&config->twim); + (void)pinctrl_apply_state(config->pcfg, PINCTRL_STATE_SLEEP); +} + +int twim_nrfx_pm_action(const struct device *dev, enum pm_device_action action) +{ switch (action) { case PM_DEVICE_ACTION_RESUME: - (void)pinctrl_apply_state(config->pcfg, PINCTRL_STATE_DEFAULT); - nrfx_twim_enable(&config->twim); + twim_nrfx_pm_resume(dev); break; case PM_DEVICE_ACTION_SUSPEND: - nrfx_twim_disable(&config->twim); - (void)pinctrl_apply_state(config->pcfg, PINCTRL_STATE_SLEEP); + twim_nrfx_pm_suspend(dev); break; default: return -ENOTSUP; @@ -138,3 +150,31 @@ int i2c_nrfx_twim_common_init(const struct device *dev) return pm_device_driver_init(dev, twim_nrfx_pm_action); } + +int i2c_nrfx_twim_common_deinit(const struct device *dev) +{ + const struct i2c_nrfx_twim_common_config *config = dev->config; +#if CONFIG_PM_DEVICE + enum pm_device_state state; +#endif + +#if CONFIG_PM_DEVICE + /* + * PM must have suspended the device before driver can + * be deinitialized + */ + (void)pm_device_state_get(dev, &state); + if (state != PM_DEVICE_STATE_SUSPENDED && + state != PM_DEVICE_STATE_OFF) { + LOG_ERR("device active"); + return -EBUSY; + } +#else + /* Suspend device */ + twim_nrfx_pm_suspend(dev); +#endif + + /* Uninit device hardware */ + nrfx_twim_uninit(&config->twim); + return 0; +} diff --git a/drivers/i2c/i2c_nrfx_twim_common.h b/drivers/i2c/i2c_nrfx_twim_common.h index ba7fa72f0198..3c5c82311bae 100644 --- a/drivers/i2c/i2c_nrfx_twim_common.h +++ b/drivers/i2c/i2c_nrfx_twim_common.h @@ -43,6 +43,7 @@ struct i2c_nrfx_twim_common_config { }; int i2c_nrfx_twim_common_init(const struct device *dev); +int i2c_nrfx_twim_common_deinit(const struct device *dev); int i2c_nrfx_twim_configure(const struct device *dev, uint32_t i2c_config); int i2c_nrfx_twim_recover_bus(const struct device *dev); int i2c_nrfx_twim_msg_transfer(const struct device *dev, uint8_t flags, uint8_t *buf, diff --git a/drivers/i2c/i2c_nrfx_twim_rtio.c b/drivers/i2c/i2c_nrfx_twim_rtio.c index 6a7504dbd628..5eef549ba2e7 100644 --- a/drivers/i2c/i2c_nrfx_twim_rtio.c +++ b/drivers/i2c/i2c_nrfx_twim_rtio.c @@ -203,7 +203,7 @@ static DEVICE_API(i2c, i2c_nrfx_twim_driver_api) = { .iodev_submit = i2c_nrfx_twim_rtio_submit, }; -int i2c_nrfx_twim_rtio_init(const struct device *dev) +static int i2c_nrfx_twim_rtio_init(const struct device *dev) { const struct i2c_nrfx_twim_rtio_config *config = dev->config; @@ -211,6 +211,11 @@ int i2c_nrfx_twim_rtio_init(const struct device *dev) return i2c_nrfx_twim_common_init(dev); } +static int i2c_nrfx_twim_rtio_deinit(const struct device *dev) +{ + return i2c_nrfx_twim_common_deinit(dev); +} + #define CONCAT_BUF_SIZE(idx) \ COND_CODE_1(DT_NODE_HAS_PROP(I2C(idx), zephyr_concat_buf_size), \ (DT_PROP(I2C(idx), zephyr_concat_buf_size)), (0)) @@ -282,9 +287,10 @@ int i2c_nrfx_twim_rtio_init(const struct device *dev) .ctx = &_i2c##idx##_twim_rtio, \ }; \ PM_DEVICE_DT_DEFINE(I2C(idx), twim_nrfx_pm_action, PM_DEVICE_ISR_SAFE); \ - I2C_DEVICE_DT_DEFINE(I2C(idx), i2c_nrfx_twim_rtio_init, PM_DEVICE_DT_GET(I2C(idx)), \ - &twim_##idx##z_data, &twim_##idx##z_config, POST_KERNEL, \ - CONFIG_I2C_INIT_PRIORITY, &i2c_nrfx_twim_driver_api); + I2C_DEVICE_DT_DEINIT_DEFINE(I2C(idx), i2c_nrfx_twim_rtio_init, i2c_nrfx_twim_rtio_deinit, \ + PM_DEVICE_DT_GET(I2C(idx)), &twim_##idx##z_data, \ + &twim_##idx##z_config, POST_KERNEL, CONFIG_I2C_INIT_PRIORITY, \ + &i2c_nrfx_twim_driver_api); #ifdef CONFIG_HAS_HW_NRF_TWIM0 I2C_NRFX_TWIM_RTIO_DEVICE(0); From ab2858aaedf70d82c4ac33c605591eb562bc8235 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Thu, 19 Jun 2025 15:48:31 +0200 Subject: [PATCH 0117/2141] [nrf fromtree] drivers: i2c: nrfx_twis: impl device deinit Implement device deinit hooks for nRF TWIS device driver. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit f22ffee5c3e48dddeb2f0631ffe84e0d6c988770) --- drivers/i2c/i2c_nrfx_twis.c | 43 +++++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/i2c_nrfx_twis.c b/drivers/i2c/i2c_nrfx_twis.c index c37c51ddd745..dca3a457cf22 100644 --- a/drivers/i2c/i2c_nrfx_twis.c +++ b/drivers/i2c/i2c_nrfx_twis.c @@ -73,6 +73,15 @@ static bool shim_nrf_twis_is_resumed(const struct device *dev) (void)pm_device_state_get(dev, &state); return state == PM_DEVICE_STATE_ACTIVE; } + +static bool shim_nrf_twis_is_suspended(const struct device *dev) +{ + enum pm_device_state state; + + (void)pm_device_state_get(dev, &state); + return state == PM_DEVICE_STATE_SUSPENDED || + state == PM_DEVICE_STATE_OFF; +} #else static bool shim_nrf_twis_is_resumed(const struct device *dev) { @@ -199,7 +208,7 @@ static int shim_nrf_twis_pm_action_cb(const struct device *dev, #if CONFIG_PM_DEVICE case PM_DEVICE_ACTION_SUSPEND: - shim_nrf_twis_disable(); + shim_nrf_twis_disable(dev); break; #endif @@ -283,6 +292,35 @@ static int shim_nrf_twis_init(const struct device *dev) return pm_device_driver_init(dev, shim_nrf_twis_pm_action_cb); } +static int shim_nrf_twis_deinit(const struct device *dev) +{ + const struct shim_nrf_twis_config *dev_config = dev->config; + struct shim_nrf_twis_data *dev_data = dev->data; + + if (dev_data->target_config != NULL) { + LOG_ERR("target registered"); + return -EPERM; + } + +#if CONFIG_PM_DEVICE + /* + * PM must have suspended the device before driver can + * be deinitialized + */ + if (!shim_nrf_twis_is_suspended(dev)) { + LOG_ERR("device active"); + return -EBUSY; + } +#else + /* Suspend device */ + shim_nrf_twis_disable(dev); +#endif + + /* Uninit device hardware */ + nrfx_twis_uninit(&dev_config->twis); + return 0; +} + #define SHIM_NRF_TWIS_NAME(id, name) \ _CONCAT_4(shim_nrf_twis_, name, _, id) @@ -323,9 +361,10 @@ static int shim_nrf_twis_init(const struct device *dev) shim_nrf_twis_pm_action_cb, \ ); \ \ - DEVICE_DT_DEFINE( \ + DEVICE_DT_DEINIT_DEFINE( \ SHIM_NRF_TWIS_NODE(id), \ shim_nrf_twis_init, \ + shim_nrf_twis_deinit, \ PM_DEVICE_DT_GET(SHIM_NRF_TWIS_NODE(id)), \ &SHIM_NRF_TWIS_NAME(id, data), \ &SHIM_NRF_TWIS_NAME(id, config), \ From a6a50c344e61ba4ae47af2be7e8ae882b9ad93d0 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Tue, 24 Jun 2025 16:09:46 +0200 Subject: [PATCH 0118/2141] [nrf fromtree] tests: drivers: i2c: target_api: add device_deinit test case Add device_deinit test case which, in case there are two devices using gpio loopbacks, deinits both controller and target devices, then uses gpio to configure and toggle the pins of the bus, then reinitializes both devices. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit db1f14e79a8bd427b7873f85ddb4b9981b3d889e) --- tests/drivers/i2c/i2c_target_api/src/main.c | 57 +++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/tests/drivers/i2c/i2c_target_api/src/main.c b/tests/drivers/i2c/i2c_target_api/src/main.c index 5c1540e3e79a..b249daae90bd 100644 --- a/tests/drivers/i2c/i2c_target_api/src/main.c +++ b/tests/drivers/i2c/i2c_target_api/src/main.c @@ -16,6 +16,7 @@ #include #include +#include #include @@ -166,6 +167,62 @@ static int run_program_read(const struct device *i2c, uint8_t addr, return 0; } +ZTEST(i2c_eeprom_target, test_deinit) +{ + const struct device *const i2c_0 = DEVICE_DT_GET(DT_BUS(NODE_EP0)); + const struct device *const i2c_1 = DEVICE_DT_GET(DT_BUS(NODE_EP1)); + const struct gpio_dt_spec sda_pin_0 = + GPIO_DT_SPEC_GET_OR(DT_PATH(zephyr_user), sda0_gpios, {}); + const struct gpio_dt_spec scl_pin_0 = + GPIO_DT_SPEC_GET_OR(DT_PATH(zephyr_user), scl0_gpios, {}); + const struct gpio_dt_spec sda_pin_1 = + GPIO_DT_SPEC_GET_OR(DT_PATH(zephyr_user), sda1_gpios, {}); + const struct gpio_dt_spec scl_pin_1 = + GPIO_DT_SPEC_GET_OR(DT_PATH(zephyr_user), scl1_gpios, {}); + int ret; + + if (i2c_0 == i2c_1) { + TC_PRINT(" gpio loopback required for test\n"); + ztest_test_skip(); + } + + if (scl_pin_0.port == NULL || sda_pin_0.port == NULL || + scl_pin_1.port == NULL || sda_pin_1.port == NULL) { + TC_PRINT(" bus gpios not specified in zephyr,path\n"); + ztest_test_skip(); + } + + ret = device_deinit(i2c_0); + if (ret == -ENOTSUP) { + TC_PRINT(" device deinit not supported\n"); + ztest_test_skip(); + } + + zassert_ok(ret); + + ret = device_deinit(i2c_1); + if (ret == -ENOTSUP) { + TC_PRINT(" device deinit not supported\n"); + zassert_ok(device_init(i2c_0)); + ztest_test_skip(); + } + + zassert_ok(gpio_pin_configure_dt(&sda_pin_0, GPIO_INPUT)); + zassert_ok(gpio_pin_configure_dt(&sda_pin_1, GPIO_OUTPUT_INACTIVE)); + zassert_ok(gpio_pin_configure_dt(&scl_pin_0, GPIO_INPUT)); + zassert_ok(gpio_pin_configure_dt(&scl_pin_1, GPIO_OUTPUT_INACTIVE)); + zassert_equal(gpio_pin_get_dt(&sda_pin_0), 0); + zassert_equal(gpio_pin_get_dt(&scl_pin_0), 0); + zassert_ok(gpio_pin_set_dt(&sda_pin_1, 1)); + zassert_ok(gpio_pin_set_dt(&scl_pin_1, 1)); + zassert_equal(gpio_pin_get_dt(&sda_pin_0), 1); + zassert_equal(gpio_pin_get_dt(&scl_pin_0), 1); + zassert_ok(gpio_pin_configure_dt(&sda_pin_1, GPIO_INPUT)); + zassert_ok(gpio_pin_configure_dt(&scl_pin_1, GPIO_INPUT)); + zassert_ok(device_init(i2c_0)); + zassert_ok(device_init(i2c_1)); +} + ZTEST(i2c_eeprom_target, test_eeprom_target) { const struct device *const eeprom_0 = DEVICE_DT_GET(NODE_EP0); From 9c2f8a63dfe3768ab9ce230d1ccf1a89ae902b58 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Tue, 24 Jun 2025 16:11:29 +0200 Subject: [PATCH 0119/2141] [nrf fromtree] tests: drivers: i2c: target_api: extend nrf overlays with bus gpios Add bus gpios to zephyr,user node in nrf overlays to enable testing device_deinit test case. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit e0fa444b8dbff03a05a7942825dca8c5bd0109a9) --- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/drivers/i2c/i2c_target_api/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/i2c/i2c_target_api/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index 2fc033d534a6..9390af2b5cd1 100644 --- a/tests/drivers/i2c/i2c_target_api/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/tests/drivers/i2c/i2c_target_api/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -9,6 +9,23 @@ * SCL = P1.2 and P1.3 */ +/ { + zephyr,user { + sda0-gpios = <&gpio2 8 0>; + scl0-gpios = <&gpio1 2 0>; + sda1-gpios = <&gpio2 9 0>; + scl1-gpios = <&gpio1 3 0>; + }; +}; + +&gpio1 { + status = "okay"; +}; + +&gpio2 { + status = "okay"; +}; + &pinctrl { i2c130_default: i2c130_default { group1 { From f06d47ec54bffb50b5e47ac5f33256926f88c01d Mon Sep 17 00:00:00 2001 From: Camille BAUD Date: Mon, 19 May 2025 23:02:55 +0200 Subject: [PATCH 0120/2141] [nrf fromtree] drivers: clock_control: Introduce bl60x clock driver This introduces a clock_control driver for bl60x Signed-off-by: Camille BAUD (cherry picked from commit 46b5d05ae1cebc0a8e772648758bf19e36e0ebe5) --- drivers/clock_control/CMakeLists.txt | 1 + drivers/clock_control/Kconfig | 2 + drivers/clock_control/Kconfig.bflb | 7 + drivers/clock_control/clock_control_bl60x.c | 913 ++++++++++++++++++ dts/bindings/clock/bflb,bclk.yaml | 19 + .../clock/bflb,bl60x-clock-controller.yaml | 15 + dts/bindings/clock/bflb,bl60x-pll.yaml | 20 + dts/bindings/clock/bflb,bl60x-root-clk.yaml | 23 + dts/bindings/clock/bflb,clock-controller.yaml | 8 + .../dt-bindings/clock/bflb_bl60x_clock.h | 23 + .../dt-bindings/clock/bflb_clock_common.h | 20 + 11 files changed, 1051 insertions(+) create mode 100644 drivers/clock_control/Kconfig.bflb create mode 100644 drivers/clock_control/clock_control_bl60x.c create mode 100644 dts/bindings/clock/bflb,bclk.yaml create mode 100644 dts/bindings/clock/bflb,bl60x-clock-controller.yaml create mode 100644 dts/bindings/clock/bflb,bl60x-pll.yaml create mode 100644 dts/bindings/clock/bflb,bl60x-root-clk.yaml create mode 100644 dts/bindings/clock/bflb,clock-controller.yaml create mode 100644 include/zephyr/dt-bindings/clock/bflb_bl60x_clock.h create mode 100644 include/zephyr/dt-bindings/clock/bflb_clock_common.h diff --git a/drivers/clock_control/CMakeLists.txt b/drivers/clock_control/CMakeLists.txt index b1dbe1911975..9acbda0e5dd8 100644 --- a/drivers/clock_control/CMakeLists.txt +++ b/drivers/clock_control/CMakeLists.txt @@ -54,6 +54,7 @@ zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF_FLL16M clock_cont zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF54H_HFXO clock_control_nrf54h_hfxo.c) zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF_HSFLL_LOCAL clock_control_nrf_hsfll_local.c) zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF_LFCLK clock_control_nrf_lfclk.c) +zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_BOUFFALOLAB_BL60X clock_control_bl60x.c) if(CONFIG_CLOCK_CONTROL_RENESAS_RZA2M_CPG) zephyr_library_sources(clock_control_renesas_rza2m_cpg.c) diff --git a/drivers/clock_control/Kconfig b/drivers/clock_control/Kconfig index f528aa2dad32..82fa462ee717 100644 --- a/drivers/clock_control/Kconfig +++ b/drivers/clock_control/Kconfig @@ -32,6 +32,8 @@ source "drivers/clock_control/Kconfig.stm32" source "drivers/clock_control/Kconfig.beetle" +source "drivers/clock_control/Kconfig.bflb" + source "drivers/clock_control/Kconfig.fixed" source "drivers/clock_control/Kconfig.lpc11u6x" diff --git a/drivers/clock_control/Kconfig.bflb b/drivers/clock_control/Kconfig.bflb new file mode 100644 index 000000000000..dd89dbdf4f80 --- /dev/null +++ b/drivers/clock_control/Kconfig.bflb @@ -0,0 +1,7 @@ +# Copyright (c) 2025 MASSDRIVER EI (massdriver.space) +# SPDX-License-Identifier: Apache-2.0 + +config CLOCK_CONTROL_BOUFFALOLAB_BL60X + bool "Bouffalolab BL60x Clock Control" + default y + depends on DT_HAS_BFLB_BL60X_CLOCK_CONTROLLER_ENABLED diff --git a/drivers/clock_control/clock_control_bl60x.c b/drivers/clock_control/clock_control_bl60x.c new file mode 100644 index 000000000000..eb81b04eec88 --- /dev/null +++ b/drivers/clock_control/clock_control_bl60x.c @@ -0,0 +1,913 @@ +/* + * Copyright (c) 2025 MASSDRIVER EI (massdriver.space) + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#define DT_DRV_COMPAT bflb_bl60x_clock_controller + +#include +#include +#include +#include +#include +#include +LOG_MODULE_REGISTER(clock_control_bl60x, CONFIG_CLOCK_CONTROL_LOG_LEVEL); + +#include +#include +#include +#include +#include +#include +#include + +#define CLK_SRC_IS(clk, src) \ + DT_SAME_NODE(DT_CLOCKS_CTLR_BY_IDX(DT_INST_CLOCKS_CTLR_BY_NAME(0, clk), 0), \ + DT_INST_CLOCKS_CTLR_BY_NAME(0, src)) + +#define CLOCK_TIMEOUT 1024 +#define EFUSE_RC32M_TRIM_OFFSET 0x0C +#define EFUSE_RC32M_TRIM_EN_POS 19 +#define EFUSE_RC32M_TRIM_PARITY_POS 18 +#define EFUSE_RC32M_TRIM_POS 10 +#define EFUSE_RC32M_TRIM_MSK 0x3FC00 + +#define CRYSTAL_ID_FREQ_32000000 0 +#define CRYSTAL_ID_FREQ_24000000 1 +#define CRYSTAL_ID_FREQ_38400000 2 +#define CRYSTAL_ID_FREQ_40000000 3 +#define CRYSTAL_ID_FREQ_26000000 4 + +#define CRYSTAL_FREQ_TO_ID(freq) CONCAT(CRYSTAL_ID_FREQ_, freq) + +enum bl60x_clkid { + bl60x_clkid_clk_root = BL60X_CLKID_CLK_ROOT, + bl60x_clkid_clk_rc32m = BL60X_CLKID_CLK_RC32M, + bl60x_clkid_clk_crystal = BL60X_CLKID_CLK_CRYSTAL, + bl60x_clkid_clk_pll = BL60X_CLKID_CLK_PLL, + bl60x_clkid_clk_bclk = BL60X_CLKID_CLK_BCLK, +}; + +struct clock_control_bl60x_pll_config { + enum bl60x_clkid source; + bool overclock; +}; + +struct clock_control_bl60x_root_config { + enum bl60x_clkid source; + uint8_t pll_select; + uint8_t divider; +}; + +struct clock_control_bl60x_bclk_config { + uint8_t divider; +}; + +struct clock_control_bl60x_config { + uint32_t crystal_id; +}; + +struct clock_control_bl60x_data { + bool crystal_enabled; + bool pll_enabled; + struct clock_control_bl60x_pll_config pll; + struct clock_control_bl60x_root_config root; + struct clock_control_bl60x_bclk_config bclk; +}; + +const static uint32_t clock_control_bl60x_crystal_SDMIN_table[5] = { + /* 32M */ + 0x3C0000, + /* 24M */ + 0x500000, + /* 38.4M */ + 0x320000, + /* 40M */ + 0x300000, + /* 26M */ + 0x49D39D, +}; + +static inline void clock_control_bl60x_clock_settle(void) +{ + __asm__ volatile(".rept 15 ; nop ; .endr"); +} + +/* 32 Mhz Oscillator: 0 + * crystal: 1 + * PLL and 32M: 2 + * PLL and crystal: 3 + */ +static void clock_control_bl60x_set_root_clock(uint32_t clock) +{ + uint32_t tmp; + + /* invalid value, fallback to internal 32M */ + if (clock > 3) { + clock = 0; + } + tmp = sys_read32(HBN_BASE + HBN_GLB_OFFSET); + tmp = (tmp & HBN_ROOT_CLK_SEL_UMSK) | (clock << HBN_ROOT_CLK_SEL_POS); + sys_write32(tmp, HBN_BASE + HBN_GLB_OFFSET); + + clock_control_bl60x_clock_settle(); +} + +static uint32_t clock_control_bl60x_get_root_clock(void) +{ + uint32_t tmp; + + tmp = sys_read32(HBN_BASE + HBN_GLB_OFFSET); + return (((tmp & HBN_ROOT_CLK_SEL_MSK) >> HBN_ROOT_CLK_SEL_POS) & 0x3); +} + +static int clock_control_bl60x_deinit_crystal(void) +{ + uint32_t tmp; + + /* unpower crystal */ + tmp = sys_read32(AON_BASE + AON_RF_TOP_AON_OFFSET); + tmp = tmp & AON_PU_XTAL_AON_UMSK; + tmp = tmp & AON_PU_XTAL_BUF_AON_UMSK; + sys_write32(tmp, AON_BASE + AON_RF_TOP_AON_OFFSET); + + clock_control_bl60x_clock_settle(); + return 0; +} + +static int clock_control_bl60x_init_crystal(void) +{ + uint32_t tmp; + int count = CLOCK_TIMEOUT; + + /* power crystal */ + tmp = sys_read32(AON_BASE + AON_RF_TOP_AON_OFFSET); + tmp = (tmp & AON_PU_XTAL_AON_UMSK) | (1U << AON_PU_XTAL_AON_POS); + tmp = (tmp & AON_PU_XTAL_BUF_AON_UMSK) | (1U << AON_PU_XTAL_BUF_AON_POS); + sys_write32(tmp, AON_BASE + AON_RF_TOP_AON_OFFSET); + + /* wait for crystal to be powered on */ + do { + clock_control_bl60x_clock_settle(); + tmp = sys_read32(AON_BASE + AON_TSEN_OFFSET); + count--; + } while (!(tmp & AON_XTAL_RDY_MSK) && count > 0); + + clock_control_bl60x_clock_settle(); + if (count < 1) { + return -1; + } + return 0; +} + +/* HCLK is the core clock */ +static int clock_control_bl60x_set_root_clock_dividers(uint32_t hclk_div, uint32_t bclk_div) +{ + uint32_t tmp; + uint32_t old_rootclk; + + old_rootclk = clock_control_bl60x_get_root_clock(); + + /* security RC32M */ + if (old_rootclk > 1) { + clock_control_bl60x_set_root_clock(0); + } + + /* set dividers */ + tmp = sys_read32(GLB_BASE + GLB_CLK_CFG0_OFFSET); + tmp = (tmp & GLB_REG_HCLK_DIV_UMSK) | (hclk_div << GLB_REG_HCLK_DIV_POS); + tmp = (tmp & GLB_REG_BCLK_DIV_UMSK) | (bclk_div << GLB_REG_BCLK_DIV_POS); + sys_write32(tmp, GLB_BASE + GLB_CLK_CFG0_OFFSET); + + /* do something undocumented, probably acknowledging clock change by disabling then + * reenabling bclk + */ + sys_write32(0x00000001, 0x40000FFC); + sys_write32(0x00000000, 0x40000FFC); + + clock_control_bl60x_clock_settle(); + + /* enable clocks */ + tmp = sys_read32(GLB_BASE + GLB_CLK_CFG0_OFFSET); + tmp = (tmp & GLB_REG_BCLK_EN_UMSK) | (1U << GLB_REG_BCLK_EN_POS); + tmp = (tmp & GLB_REG_HCLK_EN_UMSK) | (1U << GLB_REG_HCLK_EN_POS); + sys_write32(tmp, GLB_BASE + GLB_CLK_CFG0_OFFSET); + + clock_control_bl60x_set_root_clock(old_rootclk); + clock_control_bl60x_clock_settle(); + + return 0; +} + +static void clock_control_bl60x_set_machine_timer_clock_enable(bool enable) +{ + uint32_t tmp; + + tmp = sys_read32(GLB_BASE + GLB_CPU_CLK_CFG_OFFSET); + if (enable) { + tmp = (tmp & GLB_CPU_RTC_EN_UMSK) | (1U << GLB_CPU_RTC_EN_POS); + } else { + tmp = (tmp & GLB_CPU_RTC_EN_UMSK) | (0U << GLB_CPU_RTC_EN_POS); + } + sys_write32(tmp, GLB_BASE + GLB_CPU_CLK_CFG_OFFSET); +} + +/* clock: + * 0: BCLK + * 1: 32Khz Oscillator (RC32*K*) + */ +static void clock_control_bl60x_set_machine_timer_clock(bool enable, uint32_t clock, + uint32_t divider) +{ + uint32_t tmp; + + if (divider > 0x1FFFF) { + divider = 0x1FFFF; + } + if (clock > 1) { + clock = 1; + } + + /* disable first, then set div */ + clock_control_bl60x_set_machine_timer_clock_enable(false); + + tmp = sys_read32(GLB_BASE + GLB_CPU_CLK_CFG_OFFSET); + tmp = (tmp & GLB_CPU_RTC_SEL_UMSK) | (clock << GLB_CPU_RTC_SEL_POS); + tmp = (tmp & GLB_CPU_RTC_DIV_UMSK) | (divider << GLB_CPU_RTC_DIV_POS); + sys_write32(tmp, GLB_BASE + GLB_CPU_CLK_CFG_OFFSET); + + clock_control_bl60x_set_machine_timer_clock_enable(enable); +} + +static void clock_control_bl60x_deinit_pll(void) +{ + uint32_t tmp; + + /* PLL Off */ + tmp = sys_read32(PDS_BASE + PDS_PU_RST_CLKPLL_OFFSET); + tmp = (tmp & PDS_PU_CLKPLL_SFREG_UMSK) | (0U << PDS_PU_CLKPLL_SFREG_POS); + tmp = (tmp & PDS_PU_CLKPLL_UMSK) | (0U << PDS_PU_CLKPLL_POS); + sys_write32(tmp, PDS_BASE + PDS_PU_RST_CLKPLL_OFFSET); + + /* needs 2 steps ? */ + tmp = sys_read32(PDS_BASE + PDS_PU_RST_CLKPLL_OFFSET); + tmp = (tmp & PDS_CLKPLL_PU_CP_UMSK) | (0U << PDS_CLKPLL_PU_CP_POS); + tmp = (tmp & PDS_CLKPLL_PU_PFD_UMSK) | (0U << PDS_CLKPLL_PU_PFD_POS); + tmp = (tmp & PDS_CLKPLL_PU_FBDV_UMSK) | (0U << PDS_CLKPLL_PU_FBDV_POS); + tmp = (tmp & PDS_CLKPLL_PU_POSTDIV_UMSK) | (0U << PDS_CLKPLL_PU_POSTDIV_POS); + sys_write32(tmp, PDS_BASE + PDS_PU_RST_CLKPLL_OFFSET); +} + +/* RC32M : 0 + * XTAL : 1 + */ +static void clock_control_bl60x_set_pll_source(uint32_t source) +{ + uint32_t tmp; + + tmp = sys_read32(PDS_BASE + PDS_CLKPLL_TOP_CTRL_OFFSET); + if (source > 0) { + tmp = (tmp & PDS_CLKPLL_REFCLK_SEL_UMSK) | (1U << PDS_CLKPLL_REFCLK_SEL_POS); + tmp = (tmp & PDS_CLKPLL_XTAL_RC32M_SEL_UMSK) | + (0U << PDS_CLKPLL_XTAL_RC32M_SEL_POS); + } else { + tmp = (tmp & PDS_CLKPLL_REFCLK_SEL_UMSK) | (0U << PDS_CLKPLL_REFCLK_SEL_POS); + tmp = (tmp & PDS_CLKPLL_XTAL_RC32M_SEL_UMSK) | + (1U << PDS_CLKPLL_XTAL_RC32M_SEL_POS); + } + sys_write32(tmp, PDS_BASE + PDS_CLKPLL_TOP_CTRL_OFFSET); +} + +static void clock_control_bl60x_init_pll(enum bl60x_clkid source, uint32_t crystal_id) +{ + uint32_t tmp; + uint32_t old_rootclk; + + old_rootclk = clock_control_bl60x_get_root_clock(); + + /* security RC32M */ + if (old_rootclk > 1) { + clock_control_bl60x_set_root_clock(0); + } + + clock_control_bl60x_deinit_pll(); + + if (source == BL60X_CLKID_CLK_CRYSTAL) { + clock_control_bl60x_set_pll_source(1); + } else { + clock_control_bl60x_set_pll_source(0); + } + + /* 26M special treatment */ + tmp = sys_read32(PDS_BASE + PDS_CLKPLL_CP_OFFSET); + if (crystal_id == CRYSTAL_ID_FREQ_26000000) { + tmp = (tmp & PDS_CLKPLL_ICP_1U_UMSK) | (1U << PDS_CLKPLL_ICP_1U_POS); + tmp = (tmp & PDS_CLKPLL_ICP_5U_UMSK) | (0U << PDS_CLKPLL_ICP_5U_POS); + tmp = (tmp & PDS_CLKPLL_INT_FRAC_SW_UMSK) | (1U << PDS_CLKPLL_INT_FRAC_SW_POS); + } else { + tmp = (tmp & PDS_CLKPLL_ICP_1U_UMSK) | (0U << PDS_CLKPLL_ICP_1U_POS); + tmp = (tmp & PDS_CLKPLL_ICP_5U_UMSK) | (2U << PDS_CLKPLL_ICP_5U_POS); + tmp = (tmp & PDS_CLKPLL_INT_FRAC_SW_UMSK) | (0U << PDS_CLKPLL_INT_FRAC_SW_POS); + } + sys_write32(tmp, PDS_BASE + PDS_CLKPLL_CP_OFFSET); + + /* More 26M special treatment */ + tmp = sys_read32(PDS_BASE + PDS_CLKPLL_RZ_OFFSET); + if (crystal_id == CRYSTAL_ID_FREQ_26000000) { + tmp = (tmp & PDS_CLKPLL_C3_UMSK) | (2U << PDS_CLKPLL_C3_POS); + tmp = (tmp & PDS_CLKPLL_CZ_UMSK) | (2U << PDS_CLKPLL_CZ_POS); + tmp = (tmp & PDS_CLKPLL_RZ_UMSK) | (5U << PDS_CLKPLL_RZ_POS); + tmp = (tmp & PDS_CLKPLL_R4_SHORT_UMSK) | (0U << PDS_CLKPLL_R4_SHORT_POS); + } else { + tmp = (tmp & PDS_CLKPLL_C3_UMSK) | (3U << PDS_CLKPLL_C3_POS); + tmp = (tmp & PDS_CLKPLL_CZ_UMSK) | (1U << PDS_CLKPLL_CZ_POS); + tmp = (tmp & PDS_CLKPLL_RZ_UMSK) | (1U << PDS_CLKPLL_RZ_POS); + tmp = (tmp & PDS_CLKPLL_R4_SHORT_UMSK) | (1U << PDS_CLKPLL_R4_SHORT_POS); + } + tmp = (tmp & PDS_CLKPLL_R4_UMSK) | (2U << PDS_CLKPLL_R4_POS); + sys_write32(tmp, PDS_BASE + PDS_CLKPLL_RZ_OFFSET); + + /* set pll dividers */ + tmp = sys_read32(PDS_BASE + PDS_CLKPLL_TOP_CTRL_OFFSET); + tmp = (tmp & PDS_CLKPLL_POSTDIV_UMSK) | ((uint32_t)(0x14) << PDS_CLKPLL_POSTDIV_POS); + tmp = (tmp & PDS_CLKPLL_REFDIV_RATIO_UMSK) | (2U << PDS_CLKPLL_REFDIV_RATIO_POS); + sys_write32(tmp, PDS_BASE + PDS_CLKPLL_TOP_CTRL_OFFSET); + + /* set SDMIN */ + tmp = sys_read32(PDS_BASE + PDS_CLKPLL_SDM_OFFSET); + if (source == BL60X_CLKID_CLK_CRYSTAL) { + tmp = (tmp & PDS_CLKPLL_SDMIN_UMSK) | + (clock_control_bl60x_crystal_SDMIN_table[crystal_id] + << PDS_CLKPLL_SDMIN_POS); + } else { + tmp = (tmp & PDS_CLKPLL_SDMIN_UMSK) | + (clock_control_bl60x_crystal_SDMIN_table[CRYSTAL_ID_FREQ_32000000] + << PDS_CLKPLL_SDMIN_POS); + } + sys_write32(tmp, PDS_BASE + PDS_CLKPLL_SDM_OFFSET); + + /* phase comparator settings? */ + tmp = sys_read32(PDS_BASE + PDS_CLKPLL_FBDV_OFFSET); + tmp = (tmp & PDS_CLKPLL_SEL_FB_CLK_UMSK) | (1U << PDS_CLKPLL_SEL_FB_CLK_POS); + tmp = (tmp & PDS_CLKPLL_SEL_SAMPLE_CLK_UMSK) | (1U << PDS_CLKPLL_SEL_SAMPLE_CLK_POS); + sys_write32(tmp, PDS_BASE + PDS_CLKPLL_FBDV_OFFSET); + + tmp = sys_read32(PDS_BASE + PDS_PU_RST_CLKPLL_OFFSET); + tmp = (tmp & PDS_PU_CLKPLL_SFREG_UMSK) | (1U << PDS_PU_CLKPLL_SFREG_POS); + sys_write32(tmp, PDS_BASE + PDS_PU_RST_CLKPLL_OFFSET); + clock_control_bl60x_clock_settle(); + + /* enable PPL clock actual? */ + tmp = sys_read32(PDS_BASE + PDS_PU_RST_CLKPLL_OFFSET); + tmp = (tmp & PDS_PU_CLKPLL_UMSK) | (1U << PDS_PU_CLKPLL_POS); + sys_write32(tmp, PDS_BASE + PDS_PU_RST_CLKPLL_OFFSET); + + /* More power up sequencing*/ + tmp = sys_read32(PDS_BASE + PDS_PU_RST_CLKPLL_OFFSET); + tmp = (tmp & PDS_CLKPLL_PU_CP_UMSK) | (1U << PDS_CLKPLL_PU_CP_POS); + tmp = (tmp & PDS_CLKPLL_PU_PFD_UMSK) | (1U << PDS_CLKPLL_PU_PFD_POS); + tmp = (tmp & PDS_CLKPLL_PU_FBDV_UMSK) | (1U << PDS_CLKPLL_PU_FBDV_POS); + tmp = (tmp & PDS_CLKPLL_PU_POSTDIV_UMSK) | (1U << PDS_CLKPLL_PU_POSTDIV_POS); + sys_write32(tmp, PDS_BASE + PDS_PU_RST_CLKPLL_OFFSET); + + clock_control_bl60x_clock_settle(); + + /* reset couple things one by one? */ + tmp = sys_read32(PDS_BASE + PDS_PU_RST_CLKPLL_OFFSET); + tmp = (tmp & PDS_CLKPLL_SDM_RESET_UMSK) | (1U << PDS_CLKPLL_SDM_RESET_POS); + sys_write32(tmp, PDS_BASE + PDS_PU_RST_CLKPLL_OFFSET); + + tmp = sys_read32(PDS_BASE + PDS_PU_RST_CLKPLL_OFFSET); + tmp = (tmp & PDS_CLKPLL_RESET_FBDV_UMSK) | (1U << PDS_CLKPLL_RESET_FBDV_POS); + sys_write32(tmp, PDS_BASE + PDS_PU_RST_CLKPLL_OFFSET); + + tmp = sys_read32(PDS_BASE + PDS_PU_RST_CLKPLL_OFFSET); + tmp = (tmp & PDS_CLKPLL_RESET_FBDV_UMSK) | (0U << PDS_CLKPLL_RESET_FBDV_POS); + sys_write32(tmp, PDS_BASE + PDS_PU_RST_CLKPLL_OFFSET); + + tmp = sys_read32(PDS_BASE + PDS_PU_RST_CLKPLL_OFFSET); + tmp = (tmp & PDS_CLKPLL_SDM_RESET_UMSK) | (0U << PDS_CLKPLL_SDM_RESET_POS); + sys_write32(tmp, PDS_BASE + PDS_PU_RST_CLKPLL_OFFSET); + + clock_control_bl60x_set_root_clock(old_rootclk); + clock_control_bl60x_clock_settle(); +} + +/* + * 0: 48M + * 1: 120M + * 2: 160M + * 3: 192M + */ +static void clock_control_bl60x_select_PLL(uint8_t pll) +{ + uint32_t tmp; + + tmp = sys_read32(GLB_BASE + GLB_CLK_CFG0_OFFSET); + tmp = (tmp & GLB_REG_PLL_SEL_UMSK) | (pll << GLB_REG_PLL_SEL_POS); + sys_write32(tmp, GLB_BASE + GLB_CLK_CFG0_OFFSET); +} + +static int clock_control_bl60x_clock_trim_32M(void) +{ + uint32_t tmp; + int err; + uint32_t trim, trim_parity; + const struct device *efuse = DEVICE_DT_GET_ONE(bflb_efuse); + + err = syscon_read_reg(efuse, EFUSE_RC32M_TRIM_OFFSET, &trim); + if (err < 0) { + LOG_ERR("Error: Couldn't read efuses: err: %d.\n", err); + return err; + } + if (!((trim >> EFUSE_RC32M_TRIM_EN_POS) & 1)) { + LOG_ERR("RC32M trim disabled!"); + return -EINVAL; + } + + trim_parity = (trim >> EFUSE_RC32M_TRIM_PARITY_POS) & 1; + trim = (trim & EFUSE_RC32M_TRIM_MSK) >> EFUSE_RC32M_TRIM_POS; + + if (trim_parity != (POPCOUNT(trim) & 1)) { + LOG_ERR("Bad trim parity"); + return -EINVAL; + } + + tmp = sys_read32(PDS_BASE + PDS_RC32M_CTRL0_OFFSET); + tmp = (tmp & PDS_RC32M_EXT_CODE_EN_UMSK) | 1 << PDS_RC32M_EXT_CODE_EN_POS; + tmp = (tmp & PDS_RC32M_CODE_FR_EXT_UMSK) | trim << PDS_RC32M_CODE_FR_EXT_POS; + sys_write32(tmp, PDS_BASE + PDS_RC32M_CTRL0_OFFSET); + + clock_control_bl60x_clock_settle(); + + return 0; +} + +/* source for most clocks, either XTAL or RC32M */ +static uint32_t clock_control_bl60x_get_xclk(const struct device *dev) +{ + uint32_t tmp; + + tmp = sys_read32(HBN_BASE + HBN_GLB_OFFSET); + tmp &= HBN_ROOT_CLK_SEL_MSK; + tmp = tmp >> HBN_ROOT_CLK_SEL_POS; + tmp &= 1; + if (tmp == 0) { + return BFLB_RC32M_FREQUENCY; + } else if (tmp == 1) { + return DT_PROP(DT_INST_CLOCKS_CTLR_BY_NAME(0, crystal), clock_frequency); + } else { + return 0; + } +} + +static uint32_t clock_control_bl60x_get_clk(const struct device *dev) +{ + uint32_t tmp; + uint32_t hclk_div; + + hclk_div = sys_read32(GLB_BASE + GLB_CLK_CFG0_OFFSET); + hclk_div = (hclk_div & GLB_REG_HCLK_DIV_MSK) >> GLB_REG_HCLK_DIV_POS; + + tmp = sys_read32(HBN_BASE + HBN_GLB_OFFSET); + tmp &= HBN_ROOT_CLK_SEL_MSK; + tmp = (tmp >> HBN_ROOT_CLK_SEL_POS) >> 1; + tmp &= 1; + + if (tmp == 0) { + return clock_control_bl60x_get_xclk(dev) / (hclk_div + 1); + } + tmp = sys_read32(GLB_BASE + GLB_CLK_CFG0_OFFSET); + tmp = (tmp & GLB_REG_PLL_SEL_MSK) >> GLB_REG_PLL_SEL_POS; + if (tmp == 3) { + return MHZ(192) / (hclk_div + 1); + } else if (tmp == 2) { + return MHZ(160) / (hclk_div + 1); + } else if (tmp == 1) { + return MHZ(120) / (hclk_div + 1); + } else if (tmp == 0) { + return MHZ(48) / (hclk_div + 1); + } + return 0; +} + +/* most peripherals clock */ +static uint32_t clock_control_bl60x_get_bclk(const struct device *dev) +{ + uint32_t tmp; + uint32_t clock_id; + + tmp = sys_read32(GLB_BASE + GLB_CLK_CFG0_OFFSET); + tmp = (tmp & GLB_REG_BCLK_DIV_MSK) >> GLB_REG_BCLK_DIV_POS; + clock_id = clock_control_bl60x_get_clk(dev); + return clock_id / (tmp + 1); +} + +static uint32_t clock_control_bl60x_mtimer_get_clk_src_div(const struct device *dev) +{ + return clock_control_bl60x_get_bclk(dev) / 1000 / 1000 - 1; +} + +static void clock_control_bl60x_cache_2T(bool yes) +{ + uint32_t tmp; + + tmp = sys_read32(L1C_BASE + L1C_CONFIG_OFFSET); + + if (yes) { + tmp |= L1C_IROM_2T_ACCESS_MSK; + } else { + tmp &= ~L1C_IROM_2T_ACCESS_MSK; + } + + sys_write32(tmp, L1C_BASE + L1C_CONFIG_OFFSET); +} + +/* HCLK: 0 + * PLL120M: 1 + */ +static void clock_control_bl60x_set_PKA_clock(uint32_t pka_clock) +{ + uint32_t tmp; + + tmp = sys_read32(GLB_BASE + GLB_SWRST_CFG2_OFFSET); + tmp = (tmp & GLB_PKA_CLK_SEL_UMSK) | (pka_clock << GLB_PKA_CLK_SEL_POS); + sys_write32(tmp, GLB_BASE + GLB_SWRST_CFG2_OFFSET); +} + +static void clock_control_bl60x_init_root_as_pll(const struct device *dev) +{ + struct clock_control_bl60x_data *data = dev->data; + const struct clock_control_bl60x_config *config = dev->config; + uint32_t tmp; + + clock_control_bl60x_init_pll(data->pll.source, config->crystal_id); + + /* enable all 'PDS' clocks */ + tmp = sys_read32(PDS_BASE + PDS_CLKPLL_OUTPUT_EN_OFFSET); + tmp |= 0x1FF; + sys_write32(tmp, PDS_BASE + PDS_CLKPLL_OUTPUT_EN_OFFSET); + + /* glb enable pll actual? */ + tmp = sys_read32(GLB_BASE + GLB_CLK_CFG0_OFFSET); + tmp = (tmp & GLB_REG_PLL_EN_UMSK) | (1U << GLB_REG_PLL_EN_POS); + sys_write32(tmp, GLB_BASE + GLB_CLK_CFG0_OFFSET); + + clock_control_bl60x_select_PLL(data->root.pll_select); + + if (data->pll.source == bl60x_clkid_clk_crystal) { + clock_control_bl60x_set_root_clock(3); + } else { + clock_control_bl60x_set_root_clock(2); + } + + if (clock_control_bl60x_get_clk(dev) > MHZ(120)) { + clock_control_bl60x_cache_2T(true); + } + + sys_write32(clock_control_bl60x_get_clk(dev), CORECLOCKREGISTER); + clock_control_bl60x_set_PKA_clock(1); +} + +static void clock_control_bl60x_init_root_as_crystal(const struct device *dev) +{ + clock_control_bl60x_set_root_clock(1); + sys_write32(clock_control_bl60x_get_clk(dev), CORECLOCKREGISTER); +} + +static int clock_control_bl60x_update_root(const struct device *dev) +{ + struct clock_control_bl60x_data *data = dev->data; + uint32_t tmp; + int ret; + + /* make sure all clocks are enabled */ + tmp = sys_read32(GLB_BASE + GLB_CLK_CFG0_OFFSET); + tmp = (tmp & GLB_REG_BCLK_EN_UMSK) | (1U << GLB_REG_BCLK_EN_POS); + tmp = (tmp & GLB_REG_HCLK_EN_UMSK) | (1U << GLB_REG_HCLK_EN_POS); + tmp = (tmp & GLB_REG_FCLK_EN_UMSK) | (1U << GLB_REG_FCLK_EN_POS); + sys_write32(tmp, GLB_BASE + GLB_CLK_CFG0_OFFSET); + + /* set root clock to internal 32MHz Oscillator as failsafe */ + clock_control_bl60x_set_root_clock(0); + if (clock_control_bl60x_set_root_clock_dividers(0, 0) != 0) { + return -EIO; + } + sys_write32(BFLB_RC32M_FREQUENCY, CORECLOCKREGISTER); + + clock_control_bl60x_set_PKA_clock(0); + + if (data->crystal_enabled) { + if (clock_control_bl60x_init_crystal() < 0) { + return -EIO; + } + } else { + clock_control_bl60x_deinit_crystal(); + } + + ret = clock_control_bl60x_set_root_clock_dividers(data->root.divider - 1, + data->bclk.divider - 1); + if (ret < 0) { + return ret; + } + + if (data->root.source == bl60x_clkid_clk_pll) { + clock_control_bl60x_init_root_as_pll(dev); + } else if (data->root.source == bl60x_clkid_clk_crystal) { + clock_control_bl60x_init_root_as_crystal(dev); + } else { + /* Root clock already setup as RC32M */ + } + + ret = clock_control_bl60x_clock_trim_32M(); + if (ret < 0) { + return ret; + } + clock_control_bl60x_set_machine_timer_clock( + 1, 0, clock_control_bl60x_mtimer_get_clk_src_div(dev)); + + clock_control_bl60x_clock_settle(); + + return ret; +} + +static void clock_control_bl60x_uart_set_clock_enable(bool enable) +{ + uint32_t tmp; + + tmp = sys_read32(GLB_BASE + GLB_CLK_CFG2_OFFSET); + if (enable) { + tmp = (tmp & GLB_UART_CLK_EN_UMSK) | (1U << GLB_UART_CLK_EN_POS); + } else { + tmp = (tmp & GLB_UART_CLK_EN_UMSK) | (0U << GLB_UART_CLK_EN_POS); + } + sys_write32(tmp, GLB_BASE + GLB_CLK_CFG2_OFFSET); +} + +/* Clock: + * FCLK: 0 + * 160 Mhz PLL: 1 + * When using PLL root clock, we can use either setting, when using the 32Mhz Oscillator with a + * uninitialized PLL, only FCLK will be available. + */ +static void clock_control_bl60x_uart_set_clock(bool enable, uint32_t clock, uint32_t divider) +{ + uint32_t tmp; + + if (divider > 0x7) { + divider = 0x7; + } + if (clock > 1) { + clock = 1; + } + /* disable uart clock */ + clock_control_bl60x_uart_set_clock_enable(false); + + tmp = sys_read32(GLB_BASE + GLB_CLK_CFG2_OFFSET); + tmp = (tmp & GLB_UART_CLK_DIV_UMSK) | (divider << GLB_UART_CLK_DIV_POS); + sys_write32(tmp, GLB_BASE + GLB_CLK_CFG2_OFFSET); + + tmp = sys_read32(HBN_BASE + HBN_GLB_OFFSET); + tmp = (tmp & HBN_UART_CLK_SEL_UMSK) | (clock << HBN_UART_CLK_SEL_POS); + sys_write32(tmp, HBN_BASE + HBN_GLB_OFFSET); + + clock_control_bl60x_uart_set_clock_enable(enable); +} + +/* Simple function to enable all peripherals for now */ +static void clock_control_bl60x_peripheral_clock_init(void) +{ + uint32_t regval = sys_read32(GLB_BASE + GLB_CGEN_CFG1_OFFSET); + + /* enable ADC clock routing */ + regval |= (1 << 2); + /* enable UART0 clock routing */ + regval |= (1 << 16); + /* enable I2C0 clock routing */ + regval |= (1 << 19); + + sys_write32(regval, GLB_BASE + GLB_CGEN_CFG1_OFFSET); + + clock_control_bl60x_uart_set_clock(1, 0, 0); +} + +static int clock_control_bl60x_on(const struct device *dev, clock_control_subsys_t sys) +{ + struct clock_control_bl60x_data *data = dev->data; + int ret = -EINVAL; + uint32_t key; + enum bl60x_clkid oldroot; + + key = irq_lock(); + + if ((enum bl60x_clkid)sys == bl60x_clkid_clk_crystal) { + if (data->crystal_enabled) { + ret = 0; + } else { + data->crystal_enabled = true; + ret = clock_control_bl60x_update_root(dev); + if (ret < 0) { + data->crystal_enabled = false; + } + } + } else if ((enum bl60x_clkid)sys == bl60x_clkid_clk_pll) { + if (data->pll_enabled) { + ret = 0; + } else { + data->pll_enabled = true; + ret = clock_control_bl60x_update_root(dev); + if (ret < 0) { + data->pll_enabled = false; + } + } + } else if ((int)sys == BFLB_FORCE_ROOT_RC32M) { + if (data->root.source == bl60x_clkid_clk_rc32m) { + ret = 0; + } else { + /* Cannot fail to set root to rc32m */ + data->root.source = bl60x_clkid_clk_rc32m; + ret = clock_control_bl60x_update_root(dev); + } + } else if ((int)sys == BFLB_FORCE_ROOT_CRYSTAL) { + if (data->root.source == bl60x_clkid_clk_crystal) { + ret = 0; + } else { + oldroot = data->root.source; + data->root.source = bl60x_clkid_clk_crystal; + ret = clock_control_bl60x_update_root(dev); + if (ret < 0) { + data->root.source = oldroot; + } + } + } else if ((int)sys == BFLB_FORCE_ROOT_PLL) { + if (data->root.source == bl60x_clkid_clk_pll) { + ret = 0; + } else { + oldroot = data->root.source; + data->root.source = bl60x_clkid_clk_pll; + ret = clock_control_bl60x_update_root(dev); + if (ret < 0) { + data->root.source = oldroot; + } + } + } + + irq_unlock(key); + return ret; +} + +static int clock_control_bl60x_off(const struct device *dev, clock_control_subsys_t sys) +{ + struct clock_control_bl60x_data *data = dev->data; + int ret = -EINVAL; + uint32_t key; + + key = irq_lock(); + + if ((enum bl60x_clkid)sys == bl60x_clkid_clk_crystal) { + if (!data->crystal_enabled) { + ret = 0; + } else { + data->crystal_enabled = false; + ret = clock_control_bl60x_update_root(dev); + if (ret < 0) { + data->crystal_enabled = true; + } + } + } else if ((enum bl60x_clkid)sys == bl60x_clkid_clk_pll) { + if (!data->pll_enabled) { + ret = 0; + } else { + data->pll_enabled = false; + ret = clock_control_bl60x_update_root(dev); + if (ret < 0) { + data->pll_enabled = true; + } + } + } + + irq_unlock(key); + return ret; +} + +static enum clock_control_status clock_control_bl60x_get_status(const struct device *dev, + clock_control_subsys_t sys) +{ + struct clock_control_bl60x_data *data = dev->data; + + switch ((enum bl60x_clkid)sys) { + case bl60x_clkid_clk_root: + case bl60x_clkid_clk_bclk: + case bl60x_clkid_clk_rc32m: + return CLOCK_CONTROL_STATUS_ON; + case bl60x_clkid_clk_crystal: + if (data->crystal_enabled) { + return CLOCK_CONTROL_STATUS_ON; + } + return CLOCK_CONTROL_STATUS_OFF; + case bl60x_clkid_clk_pll: + if (data->pll_enabled) { + return CLOCK_CONTROL_STATUS_ON; + } + return CLOCK_CONTROL_STATUS_OFF; + default: + return CLOCK_CONTROL_STATUS_UNKNOWN; + } +} + +static int clock_control_bl60x_get_rate(const struct device *dev, clock_control_subsys_t sys, + uint32_t *rate) +{ + if ((enum bl60x_clkid)sys == bl60x_clkid_clk_root) { + *rate = clock_control_bl60x_get_clk(dev); + } else if ((enum bl60x_clkid)sys == bl60x_clkid_clk_bclk) { + *rate = clock_control_bl60x_get_bclk(dev); + } else if ((enum bl60x_clkid)sys == bl60x_clkid_clk_crystal) { + *rate = DT_PROP(DT_INST_CLOCKS_CTLR_BY_NAME(0, crystal), clock_frequency); + } else if ((enum bl60x_clkid)sys == bl60x_clkid_clk_rc32m) { + *rate = BFLB_RC32M_FREQUENCY; + } else { + return -EINVAL; + } + return 0; +} + +static int clock_control_bl60x_init(const struct device *dev) +{ + int ret; + uint32_t key; + + key = irq_lock(); + + ret = clock_control_bl60x_update_root(dev); + if (ret < 0) { + irq_unlock(key); + return ret; + } + + clock_control_bl60x_peripheral_clock_init(); + + irq_unlock(key); + + return 0; +} + +static DEVICE_API(clock_control, clock_control_bl60x_api) = { + .on = clock_control_bl60x_on, + .off = clock_control_bl60x_off, + .get_rate = clock_control_bl60x_get_rate, + .get_status = clock_control_bl60x_get_status, +}; + +static const struct clock_control_bl60x_config clock_control_bl60x_config = { + .crystal_id = CRYSTAL_FREQ_TO_ID(DT_PROP(DT_INST_CLOCKS_CTLR_BY_NAME(0, crystal), + clock_frequency)), +}; + +static struct clock_control_bl60x_data clock_control_bl60x_data = { + .crystal_enabled = DT_NODE_HAS_STATUS_OKAY(DT_INST_CLOCKS_CTLR_BY_NAME(0, crystal)), + .pll_enabled = DT_NODE_HAS_STATUS_OKAY(DT_INST_CLOCKS_CTLR_BY_NAME(0, pll_192)), + + .root = { +#if CLK_SRC_IS(root, pll_192) + .source = bl60x_clkid_clk_pll, + .pll_select = DT_CLOCKS_CELL(DT_INST_CLOCKS_CTLR_BY_NAME(0, root), select), +#elif CLK_SRC_IS(root, crystal) + .source = bl60x_clkid_clk_crystal, +#else + .source = bl60x_clkid_clk_rc32m, +#endif + .divider = DT_PROP(DT_INST_CLOCKS_CTLR_BY_NAME(0, root), divider), + }, + + .pll = { +#if CLK_SRC_IS(pll_192, crystal) + .source = bl60x_clkid_clk_crystal, +#else + .source = bl60x_clkid_clk_rc32m, +#endif + }, + + .bclk = { + .divider = DT_PROP(DT_INST_CLOCKS_CTLR_BY_NAME(0, bclk), divider), + }, +}; + +BUILD_ASSERT(CLK_SRC_IS(pll_192, crystal) || CLK_SRC_IS(root, crystal) + ? DT_NODE_HAS_STATUS_OKAY(DT_INST_CLOCKS_CTLR_BY_NAME(0, crystal)) + : 1, + "Crystal must be enabled to use it"); + +BUILD_ASSERT(CLK_SRC_IS(root, pll_192) ? + DT_NODE_HAS_STATUS_OKAY(DT_INST_CLOCKS_CTLR_BY_NAME(0, pll_192)) : 1, + "PLL must be enabled to use it"); + +BUILD_ASSERT(DT_NODE_HAS_STATUS_OKAY(DT_INST_CLOCKS_CTLR_BY_NAME(0, rc32m)), "RC32M is always on"); + +BUILD_ASSERT(DT_PROP(DT_INST_CLOCKS_CTLR_BY_NAME(0, rc32m), clock_frequency) + == BFLB_RC32M_FREQUENCY, "RC32M must be 32M"); + +DEVICE_DT_INST_DEFINE(0, clock_control_bl60x_init, NULL, &clock_control_bl60x_data, + &clock_control_bl60x_config, PRE_KERNEL_1, CONFIG_CLOCK_CONTROL_INIT_PRIORITY, + &clock_control_bl60x_api); diff --git a/dts/bindings/clock/bflb,bclk.yaml b/dts/bindings/clock/bflb,bclk.yaml new file mode 100644 index 000000000000..343c5831ed05 --- /dev/null +++ b/dts/bindings/clock/bflb,bclk.yaml @@ -0,0 +1,19 @@ +# Copyright (c) 2025 MASSDRIVER EI (massdriver.space) +# SPDX-License-Identifier: Apache-2.0 + +description: | + The BCLK clock, or peripheral clock + Source Clock -> Root Clock -> / divider -> BCLK + +compatible: "bflb,bclk" + +include: [base.yaml, clock-controller.yaml] + +properties: + divider: + type: int + required: true + description: Divide root clock by this 8-bits value + + "#clock-cells": + const: 0 diff --git a/dts/bindings/clock/bflb,bl60x-clock-controller.yaml b/dts/bindings/clock/bflb,bl60x-clock-controller.yaml new file mode 100644 index 000000000000..a9c02425a9ff --- /dev/null +++ b/dts/bindings/clock/bflb,bl60x-clock-controller.yaml @@ -0,0 +1,15 @@ +# Copyright (c) 2025 MASSDRIVER EI (massdriver.space) +# SPDX-License-Identifier: Apache-2.0 + +description: Bouffalolab BL60x Clock Controller + +compatible: "bflb,bl60x-clock-controller" + +include: [base.yaml, clock-controller.yaml] + +properties: + "#clock-cells": + const: 1 + +clock-cells: + - id diff --git a/dts/bindings/clock/bflb,bl60x-pll.yaml b/dts/bindings/clock/bflb,bl60x-pll.yaml new file mode 100644 index 000000000000..a1c9719ea3f0 --- /dev/null +++ b/dts/bindings/clock/bflb,bl60x-pll.yaml @@ -0,0 +1,20 @@ +# Copyright (c) 2025 MASSDRIVER EI (massdriver.space) +# SPDX-License-Identifier: Apache-2.0 + +description: The BL60x PLL + +compatible: "bflb,bl60x-pll" + +include: [base.yaml, clock-controller.yaml] + +properties: + clocks: + type: phandle-array + required: true + description: source + + "#clock-cells": + const: 1 + +clock-cells: + - select diff --git a/dts/bindings/clock/bflb,bl60x-root-clk.yaml b/dts/bindings/clock/bflb,bl60x-root-clk.yaml new file mode 100644 index 000000000000..9e1bb7948f6a --- /dev/null +++ b/dts/bindings/clock/bflb,bl60x-root-clk.yaml @@ -0,0 +1,23 @@ +# Copyright (c) 2025 MASSDRIVER EI (massdriver.space) +# SPDX-License-Identifier: Apache-2.0 + +description: | + The BL60x Root Clock + +compatible: "bflb,bl60x-root-clk" + +include: [base.yaml, clock-controller.yaml] + +properties: + clocks: + type: phandle-array + required: true + description: source + + divider: + type: int + required: true + description: Divide source clock by this 8-bits value. Typically 1. + + "#clock-cells": + const: 0 diff --git a/dts/bindings/clock/bflb,clock-controller.yaml b/dts/bindings/clock/bflb,clock-controller.yaml new file mode 100644 index 000000000000..c0a63a066566 --- /dev/null +++ b/dts/bindings/clock/bflb,clock-controller.yaml @@ -0,0 +1,8 @@ +# Copyright (c) 2025 MASSDRIVER EI (massdriver.space) +# SPDX-License-Identifier: Apache-2.0 + +description: Bouffalolab Clock Controller for Drivers + +compatible: "bflb,clock-controller" + +include: [base.yaml, clock-controller.yaml] diff --git a/include/zephyr/dt-bindings/clock/bflb_bl60x_clock.h b/include/zephyr/dt-bindings/clock/bflb_bl60x_clock.h new file mode 100644 index 000000000000..a08db84b082d --- /dev/null +++ b/include/zephyr/dt-bindings/clock/bflb_bl60x_clock.h @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2025 MASSDRIVER EI (massdriver.space) + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_BFLB_BL60X_CLOCK_H_ +#define ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_BFLB_BL60X_CLOCK_H_ + +#include "bflb_clock_common.h" + +#define BL60X_CLKID_CLK_ROOT BFLB_CLKID_CLK_ROOT +#define BL60X_CLKID_CLK_RC32M BFLB_CLKID_CLK_RC32M +#define BL60X_CLKID_CLK_CRYSTAL BFLB_CLKID_CLK_CRYSTAL +#define BL60X_CLKID_CLK_BCLK BFLB_CLKID_CLK_BCLK +#define BL60X_CLKID_CLK_PLL 4 + +#define BL60X_PLL_48MHz 0 +#define BL60X_PLL_120MHz 1 +#define BL60X_PLL_160MHz 2 +#define BL60X_PLL_192MHz 3 + +#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_BFLB_BL60X_CLOCK_H_ */ diff --git a/include/zephyr/dt-bindings/clock/bflb_clock_common.h b/include/zephyr/dt-bindings/clock/bflb_clock_common.h new file mode 100644 index 000000000000..203bac3d434a --- /dev/null +++ b/include/zephyr/dt-bindings/clock/bflb_clock_common.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2025 MASSDRIVER EI (massdriver.space) + * + * SPDX-License-Identifier: Apache-2.0 + */ +#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_BFLB_CLOCK_COMMON_H_ +#define ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_BFLB_CLOCK_COMMON_H_ + +#define BFLB_CLKID_CLK_ROOT 0 +#define BFLB_CLKID_CLK_RC32M 1 +#define BFLB_CLKID_CLK_CRYSTAL 2 +#define BFLB_CLKID_CLK_BCLK 3 + +#define BFLB_FORCE_ROOT_RC32M 10 +#define BFLB_FORCE_ROOT_CRYSTAL 11 +#define BFLB_FORCE_ROOT_PLL 12 + +#define BFLB_RC32M_FREQUENCY 32000000 + +#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_BFLB_CLOCK_COMMON_H_ */ From 5b55f2e0efc9766463845ea0c14512eea23b39ea Mon Sep 17 00:00:00 2001 From: David Jewsbury Date: Fri, 23 May 2025 14:35:41 +0000 Subject: [PATCH 0121/2141] [nrf fromtree] dts: bindings: clock: add nordic,nrf-auxpll Introduce Nordic NRF AUXPLL binding include. Signed-off-by: David Jewsbury (cherry picked from commit 8b5ff6ab368243809452592663d331538cab2918) --- dts/bindings/clock/nordic,nrf-auxpll.yaml | 2 +- include/zephyr/dt-bindings/clock/nrf-auxpll.h | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 include/zephyr/dt-bindings/clock/nrf-auxpll.h diff --git a/dts/bindings/clock/nordic,nrf-auxpll.yaml b/dts/bindings/clock/nordic,nrf-auxpll.yaml index 6eec285f39eb..9555995f0b4d 100644 --- a/dts/bindings/clock/nordic,nrf-auxpll.yaml +++ b/dts/bindings/clock/nordic,nrf-auxpll.yaml @@ -43,7 +43,7 @@ properties: required: true description: | Value used to set the fractional PLL divider ratio (can be set between - divider ratios 4 to 5). Valid values range from 0 to 65535. + divider ratios 4 to 5). Valid values shown in dt-bindings/clock/nrf-auxpll.h. nordic,out-div: type: int diff --git a/include/zephyr/dt-bindings/clock/nrf-auxpll.h b/include/zephyr/dt-bindings/clock/nrf-auxpll.h new file mode 100644 index 000000000000..a07c96997597 --- /dev/null +++ b/include/zephyr/dt-bindings/clock/nrf-auxpll.h @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + + +#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_NRF_AUXPLL_H_ +#define ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_NRF_AUXPLL_H_ + +#define NRF_AUXPLL_FREQ_DIV_MIN 0 +#define NRF_AUXPLL_FREQ_DIV_AUDIO_44K1 15309 +#define NRF_AUXPLL_FREQ_DIV_USB24M 32768 +#define NRF_AUXPLL_FREQ_DIV_AUDIO_48K 39845 +#define NRF_AUXPLL_FREQ_DIV_MAX 65535 + +#endif /* #define ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_NRF_AUXPLL_H_ */ From d4e4d6377f22b1bd4d89ab971fa9b2ba30b5f05b Mon Sep 17 00:00:00 2001 From: David Jewsbury Date: Fri, 23 May 2025 14:36:15 +0000 Subject: [PATCH 0122/2141] [nrf fromtree] dts: vendor: nordic: nrf54h20 update canpll to use auxpll binding Added new binding for macros of possible auxpll frequency settings. Will be used in future products also. Signed-off-by: David Jewsbury (cherry picked from commit b4a9b8e3deb726e670955099c5daf1632d55cbba) --- dts/vendor/nordic/nrf54h20.dtsi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dts/vendor/nordic/nrf54h20.dtsi b/dts/vendor/nordic/nrf54h20.dtsi index c12ea5f1ead5..f907dd7fa2e3 100644 --- a/dts/vendor/nordic/nrf54h20.dtsi +++ b/dts/vendor/nordic/nrf54h20.dtsi @@ -9,6 +9,7 @@ #include #include +#include #include #include #include @@ -562,7 +563,7 @@ clocks = <&hfxo>; #clock-cells = <0>; nordic,ficrs = <&ficr NRF_FICR_TRIM_GLOBAL_CANPLL_TRIM_CTUNE>; - nordic,frequency = <0>; + nordic,frequency = ; nordic,out-div = <2>; nordic,out-drive = <0>; nordic,current-tune = <6>; From c1d603e49d8b7cb2ff7927a0de20c59c86d68a43 Mon Sep 17 00:00:00 2001 From: David Jewsbury Date: Wed, 4 Jun 2025 14:28:35 +0100 Subject: [PATCH 0123/2141] [nrf fromtree] drivers: clock_control: refactor nrf_auxpll driver to nrf2 Refactor of previous clock_control_nrf_auxpll.c to use the nrf2 clock control API Signed-off-by: David Jewsbury (cherry picked from commit 49b0f1abb8b43dc429fea65230b79271bbb6ee6e) --- drivers/clock_control/CMakeLists.txt | 2 +- drivers/clock_control/Kconfig | 2 - drivers/clock_control/Kconfig.nrf | 6 + drivers/clock_control/Kconfig.nrf_auxpll | 9 - .../clock_control/clock_control_nrf_auxpll.c | 157 ++++++++++++++---- 5 files changed, 131 insertions(+), 45 deletions(-) delete mode 100644 drivers/clock_control/Kconfig.nrf_auxpll diff --git a/drivers/clock_control/CMakeLists.txt b/drivers/clock_control/CMakeLists.txt index 9acbda0e5dd8..0bf5e0075ebf 100644 --- a/drivers/clock_control/CMakeLists.txt +++ b/drivers/clock_control/CMakeLists.txt @@ -54,6 +54,7 @@ zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF_FLL16M clock_cont zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF54H_HFXO clock_control_nrf54h_hfxo.c) zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF_HSFLL_LOCAL clock_control_nrf_hsfll_local.c) zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF_LFCLK clock_control_nrf_lfclk.c) +zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF_AUXPLL clock_control_nrf_auxpll.c) zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_BOUFFALOLAB_BL60X clock_control_bl60x.c) if(CONFIG_CLOCK_CONTROL_RENESAS_RZA2M_CPG) @@ -116,5 +117,4 @@ endif() zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_AST10X0 clock_control_ast10x0.c) zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_MAX32 clock_control_max32.c) -zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF_AUXPLL clock_control_nrf_auxpll.c) zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_WCH_RCC clock_control_wch_rcc.c) diff --git a/drivers/clock_control/Kconfig b/drivers/clock_control/Kconfig index 82fa462ee717..05a2a7fb8fa6 100644 --- a/drivers/clock_control/Kconfig +++ b/drivers/clock_control/Kconfig @@ -104,8 +104,6 @@ source "drivers/clock_control/Kconfig.pwm" source "drivers/clock_control/Kconfig.rpi_pico" -source "drivers/clock_control/Kconfig.nrf_auxpll" - source "drivers/clock_control/Kconfig.arm_scmi" source "drivers/clock_control/Kconfig.silabs" diff --git a/drivers/clock_control/Kconfig.nrf b/drivers/clock_control/Kconfig.nrf index bbd4a86f5a9b..a7c1be10a126 100644 --- a/drivers/clock_control/Kconfig.nrf +++ b/drivers/clock_control/Kconfig.nrf @@ -297,3 +297,9 @@ config CLOCK_CONTROL_NRF_LFCLK_CLOCK_TIMEOUT_MS default 1000 endif # CLOCK_CONTROL_NRF_LFCLK + +config CLOCK_CONTROL_NRF_AUXPLL + bool "nRF Auxiliary PLL driver" + default y + depends on DT_HAS_NORDIC_NRF_AUXPLL_ENABLED + select CLOCK_CONTROL_NRF2_COMMON diff --git a/drivers/clock_control/Kconfig.nrf_auxpll b/drivers/clock_control/Kconfig.nrf_auxpll deleted file mode 100644 index 413452c1ac49..000000000000 --- a/drivers/clock_control/Kconfig.nrf_auxpll +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -config CLOCK_CONTROL_NRF_AUXPLL - bool "nRF Auxiliary PLL driver" - default y - depends on DT_HAS_NORDIC_NRF_AUXPLL_ENABLED - help - Driver for nRF Auxiliary PLL. diff --git a/drivers/clock_control/clock_control_nrf_auxpll.c b/drivers/clock_control/clock_control_nrf_auxpll.c index 19dee8c44938..d048f4ed1c7e 100644 --- a/drivers/clock_control/clock_control_nrf_auxpll.c +++ b/drivers/clock_control/clock_control_nrf_auxpll.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Nordic Semiconductor ASA + * Copyright (c) 2025 Nordic Semiconductor ASA * SPDX-License-Identifier: Apache-2.0 */ @@ -9,55 +9,65 @@ #include #include -#include #include -#include -#include +#include #include #include +#include +#include "clock_control_nrf2_common.h" #include -/* maximum lock time in ms, >10x time observed experimentally */ -#define AUXPLL_LOCK_TIME_MAX_MS 20 -/* lock wait step in ms*/ -#define AUXPLL_LOCK_WAIT_STEP_MS 1 + +/* Check dt-bindings match MDK frequency division definitions*/ +BUILD_ASSERT(NRF_AUXPLL_FREQ_DIV_MIN == NRF_AUXPLL_FREQUENCY_DIV_MIN, + "Different AUXPLL_FREQ_DIV_MIN definition in MDK and devicetree binding"); +BUILD_ASSERT(NRF_AUXPLL_FREQ_DIV_AUDIO_44K1 == NRF_AUXPLL_FREQUENCY_AUDIO_44K1, + "Different AUXPLL_FREQ_DIV_AUDIO_44K1 definition in MDK and devicetree binding"); +BUILD_ASSERT(NRF_AUXPLL_FREQ_DIV_USB24M == NRF_AUXPLL_FREQUENCY_USB_24M, + "Different AUXPLL_FREQ_DIV_USB24M definition in MDK and devicetree binding"); +BUILD_ASSERT(NRF_AUXPLL_FREQ_DIV_AUDIO_48K == NRF_AUXPLL_FREQUENCY_AUDIO_48K, + "Different AUXPLL_FREQ_DIV_AUDIO_48K definition in MDK and devicetree binding"); +BUILD_ASSERT(NRF_AUXPLL_FREQ_DIV_MAX == NRF_AUXPLL_FREQUENCY_DIV_MAX, + "Different AUXPLL_FREQ_DIV_MAX definition in MDK and devicetree binding"); + +/* maximum lock time in us, >10x time observed experimentally */ +#define AUXPLL_LOCK_TIME_MAX_US 20000 +/* lock wait step in us*/ +#define AUXPLL_LOCK_WAIT_STEP_US 1000 + +struct dev_data_auxpll { + struct onoff_manager mgr; + onoff_notify_fn notify; + const struct device *dev; +}; struct clock_control_nrf_auxpll_config { NRF_AUXPLL_Type *auxpll; uint32_t ref_clk_hz; uint32_t ficr_ctune; nrf_auxpll_config_t cfg; - uint16_t frequency; + nrf_auxpll_freq_div_ratio_t frequency; nrf_auxpll_ctrl_outsel_t out_div; }; -static int clock_control_nrf_auxpll_on(const struct device *dev, clock_control_subsys_t sys) +static int clock_control_nrf_auxpll_on(struct dev_data_auxpll *dev_data) { - const struct clock_control_nrf_auxpll_config *config = dev->config; + const struct clock_control_nrf_auxpll_config *config = dev_data->dev->config; bool locked; - unsigned int wait = 0U; - - ARG_UNUSED(sys); nrf_auxpll_task_trigger(config->auxpll, NRF_AUXPLL_TASK_START); - do { - locked = nrf_auxpll_mode_locked_check(config->auxpll); - if (!locked) { - k_msleep(AUXPLL_LOCK_WAIT_STEP_MS); - wait += AUXPLL_LOCK_WAIT_STEP_MS; - } - } while (wait < AUXPLL_LOCK_TIME_MAX_MS && !locked); + NRFX_WAIT_FOR(nrf_auxpll_mode_locked_check(config->auxpll), + AUXPLL_LOCK_TIME_MAX_US / AUXPLL_LOCK_WAIT_STEP_US, + AUXPLL_LOCK_WAIT_STEP_US, locked); return locked ? 0 : -ETIMEDOUT; } -static int clock_control_nrf_auxpll_off(const struct device *dev, clock_control_subsys_t sys) +static int clock_control_nrf_auxpll_off(struct dev_data_auxpll *dev_data) { - const struct clock_control_nrf_auxpll_config *config = dev->config; - - ARG_UNUSED(sys); + const struct clock_control_nrf_auxpll_config *config = dev_data->dev->config; nrf_auxpll_task_trigger(config->auxpll, NRF_AUXPLL_TASK_STOP); @@ -67,6 +77,58 @@ static int clock_control_nrf_auxpll_off(const struct device *dev, clock_control_ return 0; } +static void onoff_start_auxpll(struct onoff_manager *mgr, onoff_notify_fn notify) +{ + struct dev_data_auxpll *dev_data = + CONTAINER_OF(mgr, struct dev_data_auxpll, mgr); + + int ret = clock_control_nrf_auxpll_on(dev_data); + + notify(&dev_data->mgr, ret); + +} + +static void onoff_stop_auxpll(struct onoff_manager *mgr, onoff_notify_fn notify) +{ + struct dev_data_auxpll *dev_data = + CONTAINER_OF(mgr, struct dev_data_auxpll, mgr); + + clock_control_nrf_auxpll_off(dev_data); + notify(mgr, 0); +} + +static int api_request_auxpll(const struct device *dev, + const struct nrf_clock_spec *spec, + struct onoff_client *cli) +{ + struct dev_data_auxpll *dev_data = dev->data; + + ARG_UNUSED(spec); + + return onoff_request(&dev_data->mgr, cli); +} + +static int api_release_auxpll(const struct device *dev, + const struct nrf_clock_spec *spec) +{ + struct dev_data_auxpll *dev_data = dev->data; + + ARG_UNUSED(spec); + + return onoff_release(&dev_data->mgr); +} + +static int api_cancel_or_release_auxpll(const struct device *dev, + const struct nrf_clock_spec *spec, + struct onoff_client *cli) +{ + struct dev_data_auxpll *dev_data = dev->data; + + ARG_UNUSED(spec); + + return onoff_cancel_or_release(&dev_data->mgr, cli); +} + static int clock_control_nrf_auxpll_get_rate(const struct device *dev, clock_control_subsys_t sys, uint32_t *rate) { @@ -99,16 +161,21 @@ static enum clock_control_status clock_control_nrf_auxpll_get_status(const struc return CLOCK_CONTROL_STATUS_OFF; } -static DEVICE_API(clock_control, clock_control_nrf_auxpll_api) = { - .on = clock_control_nrf_auxpll_on, - .off = clock_control_nrf_auxpll_off, - .get_rate = clock_control_nrf_auxpll_get_rate, - .get_status = clock_control_nrf_auxpll_get_status, +static const struct onoff_transitions transitions = { + .start = onoff_start_auxpll, + .stop = onoff_stop_auxpll }; static int clock_control_nrf_auxpll_init(const struct device *dev) { + struct dev_data_auxpll *dev_data = dev->data; const struct clock_control_nrf_auxpll_config *config = dev->config; + int rc; + + rc = onoff_manager_init(&dev_data->mgr, &transitions); + if (rc < 0) { + return rc; + } nrf_auxpll_ctrl_frequency_set(config->auxpll, config->frequency); @@ -123,7 +190,31 @@ static int clock_control_nrf_auxpll_init(const struct device *dev) return 0; } +static DEVICE_API(nrf_clock_control, drv_api_auxpll) = { + .std_api = { + .on = api_nosys_on_off, + .off = api_nosys_on_off, + .get_rate = clock_control_nrf_auxpll_get_rate, + .get_status = clock_control_nrf_auxpll_get_status, + }, + .request = api_request_auxpll, + .release = api_release_auxpll, + .cancel_or_release = api_cancel_or_release_auxpll, +}; + #define CLOCK_CONTROL_NRF_AUXPLL_DEFINE(n) \ + BUILD_ASSERT( \ + DT_INST_PROP(n, nordic_frequency) == NRF_AUXPLL_FREQUENCY_DIV_MIN || \ + DT_INST_PROP(n, nordic_frequency) == NRF_AUXPLL_FREQUENCY_AUDIO_44K1 || \ + DT_INST_PROP(n, nordic_frequency) == NRF_AUXPLL_FREQUENCY_USB_24M || \ + DT_INST_PROP(n, nordic_frequency) == NRF_AUXPLL_FREQUENCY_AUDIO_48K || \ + DT_INST_PROP(n, nordic_frequency) == NRF_AUXPLL_FREQUENCY_DIV_MAX, \ + "Invalid nordic,frequency value in DeviceTree for AUXPLL instance " #n); \ + BUILD_ASSERT(DT_INST_PROP(n, nordic_out_div) > 0, \ + "nordic,out_div must be greater than 0 for AUXPLL instance " #n); \ + static struct dev_data_auxpll data_auxpll##n = { \ + .dev = DEVICE_DT_INST_GET(n), \ + }; \ static const struct clock_control_nrf_auxpll_config config##n = { \ .auxpll = (NRF_AUXPLL_Type *)DT_INST_REG_ADDR(n), \ .ref_clk_hz = DT_PROP(DT_INST_CLOCKS_CTLR(n), clock_frequency), \ @@ -140,9 +231,9 @@ static int clock_control_nrf_auxpll_init(const struct device *dev) .frequency = DT_INST_PROP(n, nordic_frequency), \ .out_div = DT_INST_PROP(n, nordic_out_div), \ }; \ - \ - DEVICE_DT_INST_DEFINE(n, clock_control_nrf_auxpll_init, NULL, NULL, &config##n, \ + \ + DEVICE_DT_INST_DEFINE(n, clock_control_nrf_auxpll_init, NULL, &data_auxpll##n, &config##n, \ PRE_KERNEL_1, CONFIG_CLOCK_CONTROL_INIT_PRIORITY, \ - &clock_control_nrf_auxpll_api); + &drv_api_auxpll); DT_INST_FOREACH_STATUS_OKAY(CLOCK_CONTROL_NRF_AUXPLL_DEFINE) From 23b235915a3bc20407e7a753680107720b636e8d Mon Sep 17 00:00:00 2001 From: David Jewsbury Date: Wed, 4 Jun 2025 14:30:39 +0100 Subject: [PATCH 0124/2141] [nrf fromtree] drivers: can: update clock control to use nrf2_auxpll Auxpll driver has been refactored to use nrf2 API instead. Signed-off-by: David Jewsbury (cherry picked from commit 9087e82c9fb8e57f68f94cc84b042ee4c7168476) --- drivers/can/can_nrf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/can/can_nrf.c b/drivers/can/can_nrf.c index c538291ecb40..f8c037835a83 100644 --- a/drivers/can/can_nrf.c +++ b/drivers/can/can_nrf.c @@ -171,7 +171,7 @@ static int can_nrf_init(const struct device *dev) return ret; } - ret = clock_control_on(config->auxpll, NULL); + ret = nrf_clock_control_request_sync(config->auxpll, NULL, K_FOREVER); if (ret < 0) { return ret; } From b10d266342b77fc4a8e44afff305eaaa6bd3890b Mon Sep 17 00:00:00 2001 From: David Jewsbury Date: Wed, 4 Jun 2025 14:34:04 +0100 Subject: [PATCH 0125/2141] [nrf fromtree] tests: drivers: Update nrf2 clock control tests for nrf2_auxpll driver Test added for new nrf2_auxpll driver. Frequency checks are against known usecases of the auxpll (USB, CAN and AUDIO). Also update test to be more modular, only running certain tests if in the devicetree. Signed-off-by: David Jewsbury (cherry picked from commit bd5aefb58bdb86713549bc4b7e405d66c648d7ef) --- .../nrf_clock_control/src/main.c | 69 +++++++++++++++++-- 1 file changed, 64 insertions(+), 5 deletions(-) diff --git a/tests/drivers/clock_control/nrf_clock_control/src/main.c b/tests/drivers/clock_control/nrf_clock_control/src/main.c index 87778bbaae59..8db19d382003 100644 --- a/tests/drivers/clock_control/nrf_clock_control/src/main.c +++ b/tests/drivers/clock_control/nrf_clock_control/src/main.c @@ -9,6 +9,7 @@ #include #include #include +#include struct test_clk_context { const struct device *clk_dev; @@ -16,6 +17,7 @@ struct test_clk_context { size_t clk_specs_size; }; +#if defined(CONFIG_CLOCK_CONTROL_NRF_HSFLL_LOCAL) const struct nrf_clock_spec test_clk_specs_hsfll[] = { { .frequency = MHZ(128), @@ -33,6 +35,7 @@ const struct nrf_clock_spec test_clk_specs_hsfll[] = { .precision = NRF_CLOCK_CONTROL_PRECISION_DEFAULT, }, }; +#endif #if CONFIG_BOARD_NRF54H20DK_NRF54H20_CPUAPP const struct nrf_clock_spec test_clk_specs_fll16m[] = { @@ -99,6 +102,7 @@ static const struct test_clk_context cpurad_hsfll_test_clk_contexts[] = { }; #endif +#if defined(CONFIG_CLOCK_CONTROL_NRF_HSFLL_GLOBAL) const struct nrf_clock_spec test_clk_specs_global_hsfll[] = { { .frequency = MHZ(320), @@ -121,7 +125,9 @@ static const struct test_clk_context global_hsfll_test_clk_contexts[] = { .clk_specs_size = ARRAY_SIZE(test_clk_specs_global_hsfll), }, }; +#endif +#if defined(CONFIG_CLOCK_CONTROL_NRF_LFCLK) const struct nrf_clock_spec test_clk_specs_lfclk[] = { { .frequency = 32768, @@ -147,6 +153,44 @@ static const struct test_clk_context lfclk_test_clk_contexts[] = { .clk_specs_size = ARRAY_SIZE(test_clk_specs_lfclk), }, }; +#endif + +#if defined(CONFIG_CLOCK_CONTROL_NRF_AUXPLL) + +#define AUXPLL_COMPAT nordic_nrf_auxpll +#define AUXPLL_NODE DT_INST(0, AUXPLL_COMPAT) +#define AUXPLL_FREQ DT_PROP(AUXPLL_NODE, nordic_frequency) + +/* Gets selected AUXPLL DIV and selects the expected frequency */ +#if AUXPLL_FREQ == NRF_AUXPLL_FREQUENCY_DIV_MIN +#define AUXPLL_FREQ_OUT 80000000 +#elif AUXPLL_FREQ == NRF_AUXPLL_FREQ_DIV_AUDIO_44K1 +#define AUXPLL_FREQ_OUT 11289591 +#elif AUXPLL_FREQ == NRF_AUXPLL_FREQ_DIV_USB_24M +#define AUXPLL_FREQ_OUT 24000000 +#elif AUXPLL_FREQ == NRF_AUXPLL_FREQ_DIV_AUDIO_48K +#define AUXPLL_FREQ_OUT 12287963 +#else +/*No use case for NRF_AUXPLL_FREQ_DIV_MAX or others yet*/ +#error "Unsupported AUXPLL frequency selection" +#endif + +const struct nrf_clock_spec test_clk_specs_auxpll[] = { + { + .frequency = AUXPLL_FREQ_OUT, + .accuracy = 0, + .precision = NRF_CLOCK_CONTROL_PRECISION_DEFAULT, + }, +}; + +static const struct test_clk_context auxpll_test_clk_contexts[] = { + { + .clk_dev = DEVICE_DT_GET(AUXPLL_NODE), + .clk_specs = test_clk_specs_auxpll, + .clk_specs_size = ARRAY_SIZE(test_clk_specs_auxpll), + }, +}; +#endif static void test_request_release_clock_spec(const struct device *clk_dev, const struct nrf_clock_spec *clk_spec) @@ -266,18 +310,23 @@ ZTEST(nrf2_clock_control, test_cpurad_hsfll_control) } #endif -ZTEST(nrf2_clock_control, test_lfclk_control) -{ - TC_PRINT("LFCLK test\n"); - test_clock_control_request(lfclk_test_clk_contexts, ARRAY_SIZE(lfclk_test_clk_contexts)); -} + +#if defined(CONFIG_CLOCK_CONTROL_NRF_HSFLL_GLOBAL) ZTEST(nrf2_clock_control, test_global_hsfll_control) { TC_PRINT("Global HSFLL test\n"); test_clock_control_request(global_hsfll_test_clk_contexts, ARRAY_SIZE(global_hsfll_test_clk_contexts)); } +#endif + +#if defined(CONFIG_CLOCK_CONTROL_NRF_LFCLK) +ZTEST(nrf2_clock_control, test_lfclk_control) +{ + TC_PRINT("LFCLK test\n"); + test_clock_control_request(lfclk_test_clk_contexts, ARRAY_SIZE(lfclk_test_clk_contexts)); +} ZTEST(nrf2_clock_control, test_safe_request_cancellation) { @@ -303,6 +352,16 @@ ZTEST(nrf2_clock_control, test_safe_request_cancellation) TC_PRINT("Clock control safe cancellation return value: %d\n", ret); zassert_between_inclusive(ret, ONOFF_STATE_ON, ONOFF_STATE_TO_ON); } +#endif + +#if defined(CONFIG_CLOCK_CONTROL_NRF_AUXPLL) +ZTEST(nrf2_clock_control, test_auxpll_control) +{ + TC_PRINT("AUXPLL control test\n"); + test_clock_control_request(auxpll_test_clk_contexts, + ARRAY_SIZE(auxpll_test_clk_contexts)); +} +#endif static void *setup(void) { From 010f7c7102ee2e8f6df2748533772e852768fefa Mon Sep 17 00:00:00 2001 From: David Jewsbury Date: Mon, 9 Jun 2025 15:57:27 +0100 Subject: [PATCH 0126/2141] [nrf fromtree] drivers: clock_control: update nrf2 lfosc_get_accuracy Move lfosc_get_accuracy away from common library as not all devices need this function. Signed-off-by: David Jewsbury (cherry picked from commit 0285cf4235cec506e0c7d4e1f9e63d2de5fca783) --- .../clock_control/clock_control_nrf2_common.c | 37 ------------------- .../clock_control/clock_control_nrf2_common.h | 10 ----- .../clock_control/clock_control_nrf_lfclk.c | 34 +++++++++++++++++ 3 files changed, 34 insertions(+), 47 deletions(-) diff --git a/drivers/clock_control/clock_control_nrf2_common.c b/drivers/clock_control/clock_control_nrf2_common.c index f070d5d7b698..c2657f454782 100644 --- a/drivers/clock_control/clock_control_nrf2_common.c +++ b/drivers/clock_control/clock_control_nrf2_common.c @@ -5,7 +5,6 @@ #include "clock_control_nrf2_common.h" #include -#include #include LOG_MODULE_REGISTER(clock_control_nrf2, CONFIG_CLOCK_CONTROL_LOG_LEVEL); @@ -20,8 +19,6 @@ LOG_MODULE_REGISTER(clock_control_nrf2, CONFIG_CLOCK_CONTROL_LOG_LEVEL); (idx * sizeof(array[0])) - \ offsetof(type, array[0])) -#define BICR (NRF_BICR_Type *)DT_REG_ADDR(DT_NODELABEL(bicr)) - /* * Definition of `struct clock_config_generic`. * Used to access `clock_config_*` structures in a common way. @@ -92,40 +89,6 @@ static inline uint8_t get_index_of_highest_bit(uint32_t value) return value ? (uint8_t)(31 - __builtin_clz(value)) : 0; } -int lfosc_get_accuracy(uint16_t *accuracy) -{ - switch (nrf_bicr_lfosc_accuracy_get(BICR)) { - case NRF_BICR_LFOSC_ACCURACY_500PPM: - *accuracy = 500U; - break; - case NRF_BICR_LFOSC_ACCURACY_250PPM: - *accuracy = 250U; - break; - case NRF_BICR_LFOSC_ACCURACY_150PPM: - *accuracy = 150U; - break; - case NRF_BICR_LFOSC_ACCURACY_100PPM: - *accuracy = 100U; - break; - case NRF_BICR_LFOSC_ACCURACY_75PPM: - *accuracy = 75U; - break; - case NRF_BICR_LFOSC_ACCURACY_50PPM: - *accuracy = 50U; - break; - case NRF_BICR_LFOSC_ACCURACY_30PPM: - *accuracy = 30U; - break; - case NRF_BICR_LFOSC_ACCURACY_20PPM: - *accuracy = 20U; - break; - default: - return -EINVAL; - } - - return 0; -} - int clock_config_init(void *clk_cfg, uint8_t onoff_cnt, k_work_handler_t update_work_handler) { struct clock_config_generic *cfg = clk_cfg; diff --git a/drivers/clock_control/clock_control_nrf2_common.h b/drivers/clock_control/clock_control_nrf2_common.h index 7f934fdac5b8..4b1c7fe000e4 100644 --- a/drivers/clock_control/clock_control_nrf2_common.h +++ b/drivers/clock_control/clock_control_nrf2_common.h @@ -36,16 +36,6 @@ struct clock_onoff { struct clock_onoff onoff[_onoff_cnt]; \ } -/** - * @brief Obtain LFOSC accuracy in ppm. - * - * @param[out] accuracy Accuracy in ppm. - * - * @retval 0 On success - * @retval -EINVAL If accuracy is not configured. - */ -int lfosc_get_accuracy(uint16_t *accuracy); - /** * @brief Initializes a clock configuration structure. * diff --git a/drivers/clock_control/clock_control_nrf_lfclk.c b/drivers/clock_control/clock_control_nrf_lfclk.c index fcdb8bd573bc..829416f662cb 100644 --- a/drivers/clock_control/clock_control_nrf_lfclk.c +++ b/drivers/clock_control/clock_control_nrf_lfclk.c @@ -69,6 +69,40 @@ struct lfclk_dev_config { uint32_t fixed_frequency; }; +static int lfosc_get_accuracy(uint16_t *accuracy) +{ + switch (nrf_bicr_lfosc_accuracy_get(BICR)) { + case NRF_BICR_LFOSC_ACCURACY_500PPM: + *accuracy = 500U; + break; + case NRF_BICR_LFOSC_ACCURACY_250PPM: + *accuracy = 250U; + break; + case NRF_BICR_LFOSC_ACCURACY_150PPM: + *accuracy = 150U; + break; + case NRF_BICR_LFOSC_ACCURACY_100PPM: + *accuracy = 100U; + break; + case NRF_BICR_LFOSC_ACCURACY_75PPM: + *accuracy = 75U; + break; + case NRF_BICR_LFOSC_ACCURACY_50PPM: + *accuracy = 50U; + break; + case NRF_BICR_LFOSC_ACCURACY_30PPM: + *accuracy = 30U; + break; + case NRF_BICR_LFOSC_ACCURACY_20PPM: + *accuracy = 20U; + break; + default: + return -EINVAL; + } + + return 0; +} + static void clock_evt_handler(nrfs_clock_evt_t const *p_evt, void *context) { struct lfclk_dev_data *dev_data = context; From 62f83d9365def0fd199599358889034765cce051 Mon Sep 17 00:00:00 2001 From: Carles Cufi Date: Wed, 18 Jun 2025 15:30:11 +0200 Subject: [PATCH 0127/2141] [nrf fromtree] cmake: Add a new no_deprecation_warning compiler flag Commit be40d854c2ccacf14ca3fcfb01bffdc9b075c6c9 introduced the ability of building Zephyr with deprecation warnings enabled, by making COMPILER_WARNINGS_AS_ERRORS depend on the newly added DEPRECATION_TEST Kconfig option. This has the downside of disabling **all** warnings, not only the deprecation ones. This patch instead makes DEPRECATION_TEST disable only the deprecation warning, but leaves COMPILER_WARNINGS_AS_ERRORS enabled. This has the advantage of being able to see other unrelated warnings (and fail if they appear) but has the disadvantage of not printing out the deprecation warnings themselves (since they are disabled). Signed-off-by: Carles Cufi (cherry picked from commit 892ac07a4a388187d4faf0d6e5f7bc53c1a86c32) --- CMakeLists.txt | 8 +++++++- Kconfig.zephyr | 1 - cmake/compiler/compiler_flags_template.cmake | 3 +++ cmake/compiler/gcc/compiler_flags.cmake | 4 ++++ include/zephyr/toolchain/gcc.h | 4 +++- include/zephyr/toolchain/iar/iccarm.h | 6 +++++- tests/kernel/pipe/deprecated/pipe/CMakeLists.txt | 1 - tests/kernel/workq/work/src/main.c | 5 ----- tests/kernel/workq/work_queue/src/main.c | 5 ----- 9 files changed, 22 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0effc0c381cd..3157813d65c9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -159,13 +159,19 @@ zephyr_compile_options($<$:$:$>) # Extra warnings options for twister run -if (CONFIG_COMPILER_WARNINGS_AS_ERRORS) +if(CONFIG_COMPILER_WARNINGS_AS_ERRORS) zephyr_compile_options($<$:$>) zephyr_compile_options($<$:$>) zephyr_compile_options($<$:$>) zephyr_link_libraries($) endif() +if(CONFIG_DEPRECATION_TEST) + zephyr_compile_options($<$:$>) + zephyr_compile_options($<$:$>) + zephyr_compile_options($<$:$>) +endif() + # @Intent: Set compiler flags to enable buffer overflow checks in libc functions # @details: # Kconfig.zephyr "Detect buffer overflows in libc calls" is a kconfig choice, diff --git a/Kconfig.zephyr b/Kconfig.zephyr index 070b4231eee8..9baae3922090 100644 --- a/Kconfig.zephyr +++ b/Kconfig.zephyr @@ -542,7 +542,6 @@ config LTO config COMPILER_WARNINGS_AS_ERRORS bool "Treat warnings as errors" - depends on !DEPRECATION_TEST help Turn on "warning as error" toolchain flags diff --git a/cmake/compiler/compiler_flags_template.cmake b/cmake/compiler/compiler_flags_template.cmake index 34acddfa3624..6050c46d3854 100644 --- a/cmake/compiler/compiler_flags_template.cmake +++ b/cmake/compiler/compiler_flags_template.cmake @@ -76,6 +76,9 @@ set_compiler_property(PROPERTY no_strict_aliasing) set_property(TARGET compiler PROPERTY warnings_as_errors) set_property(TARGET asm PROPERTY warnings_as_errors) +set_property(TARGET compiler PROPERTY no_deprecation_warning) +set_property(TARGET asm PROPERTY no_deprecation_warning) + # Flag for disabling exceptions in C++ set_property(TARGET compiler-cpp PROPERTY no_exceptions) diff --git a/cmake/compiler/gcc/compiler_flags.cmake b/cmake/compiler/gcc/compiler_flags.cmake index 9d4989fea47e..c3b8c113d42d 100644 --- a/cmake/compiler/gcc/compiler_flags.cmake +++ b/cmake/compiler/gcc/compiler_flags.cmake @@ -153,6 +153,10 @@ set_compiler_property(PROPERTY no_strict_aliasing -fno-strict-aliasing) set_property(TARGET compiler PROPERTY warnings_as_errors -Werror) set_property(TARGET asm PROPERTY warnings_as_errors -Werror -Wa,--fatal-warnings) +# Deprecation warning +set_property(TARGET compiler PROPERTY no_deprecation_warning -Wno-deprecated-declarations) +set_property(TARGET asm PROPERTY no_deprecation_warning -Wno-deprecated-declarations) + # Disable exceptions flag in C++ set_property(TARGET compiler-cpp PROPERTY no_exceptions "-fno-exceptions") diff --git a/include/zephyr/toolchain/gcc.h b/include/zephyr/toolchain/gcc.h index 58aa13e0a3ef..4d3d85858d3d 100644 --- a/include/zephyr/toolchain/gcc.h +++ b/include/zephyr/toolchain/gcc.h @@ -334,11 +334,13 @@ do { \ #define __WARN1(s) _Pragma(#s) /* Generic message */ -#ifndef __DEPRECATED_MACRO +#ifndef CONFIG_DEPRECATION_TEST #define __DEPRECATED_MACRO __WARN("Macro is deprecated") /* When adding this, remember to follow the instructions in * https://docs.zephyrproject.org/latest/develop/api/api_lifecycle.html#deprecated */ +#else +#define __DEPRECATED_MACRO #endif /* These macros allow having ARM asm functions callable from thumb */ diff --git a/include/zephyr/toolchain/iar/iccarm.h b/include/zephyr/toolchain/iar/iccarm.h index 746554d2e129..e6a3cb96d3b2 100644 --- a/include/zephyr/toolchain/iar/iccarm.h +++ b/include/zephyr/toolchain/iar/iccarm.h @@ -243,10 +243,14 @@ do { \ #define __WARN1(s) __PRAGMA(message = #s) /* Generic message */ -#ifndef __DEPRECATED_MACRO +#ifndef CONFIG_DEPRECATION_TEST #define __DEPRECATED_MACRO __WARN("Macro is deprecated") +#else +#define __DEPRECATED_MACRO #endif + + /* These macros allow having ARM asm functions callable from thumb */ #if defined(_ASMLANGUAGE) diff --git a/tests/kernel/pipe/deprecated/pipe/CMakeLists.txt b/tests/kernel/pipe/deprecated/pipe/CMakeLists.txt index 2624f4be400f..ac8bc4dee462 100644 --- a/tests/kernel/pipe/deprecated/pipe/CMakeLists.txt +++ b/tests/kernel/pipe/deprecated/pipe/CMakeLists.txt @@ -1,7 +1,6 @@ # SPDX-License-Identifier: Apache-2.0 cmake_minimum_required(VERSION 3.20.0) -set(CMAKE_C_FLAGS "-D__deprecated=\"/* deprecated */\" -D__DEPRECATED_MACRO=\"/* deprecated_macro*/\"") find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) project(pipe) diff --git a/tests/kernel/workq/work/src/main.c b/tests/kernel/workq/work/src/main.c index ce327cee4052..11ae39db2a84 100644 --- a/tests/kernel/workq/work/src/main.c +++ b/tests/kernel/workq/work/src/main.c @@ -8,11 +8,6 @@ * about the use of that API. */ #include -#undef __deprecated -#define __deprecated -#undef __DEPRECATED_MACRO -#define __DEPRECATED_MACRO - #include #define STACK_SIZE (1024 + CONFIG_TEST_EXTRA_STACK_SIZE) diff --git a/tests/kernel/workq/work_queue/src/main.c b/tests/kernel/workq/work_queue/src/main.c index b14d28787171..f97f202bcee9 100644 --- a/tests/kernel/workq/work_queue/src/main.c +++ b/tests/kernel/workq/work_queue/src/main.c @@ -10,11 +10,6 @@ * about the use of that API. */ #include -#undef __deprecated -#define __deprecated -#undef __DEPRECATED_MACRO -#define __DEPRECATED_MACRO - #include #include #include From 4d4633050d9de0724b4a9c9b1136f2133d2777ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Katarzyna=20Gi=C4=85d=C5=82a?= Date: Wed, 14 May 2025 15:37:40 +0200 Subject: [PATCH 0128/2141] [nrf fromtree] twister: Enable gathering footprint if test plan exists MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If test plan is used, memory usage metrics are overridden. Result of this operation is missing memory footprint. This change removes redundand metrics update and fixes described inconvenience. Signed-off-by: Katarzyna Giądła (cherry picked from commit bec789d364bf24d5b1a6604bc1d6cd37c06cecf3) --- scripts/pylib/twister/twisterlib/runner.py | 1 - scripts/tests/twister/test_runner.py | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/scripts/pylib/twister/twisterlib/runner.py b/scripts/pylib/twister/twisterlib/runner.py index 5b1a782eca9c..9d050ca30a88 100644 --- a/scripts/pylib/twister/twisterlib/runner.py +++ b/scripts/pylib/twister/twisterlib/runner.py @@ -1895,7 +1895,6 @@ def run(self): except queue.Empty: break else: - inst.metrics.update(self.instances[inst.name].metrics) inst.metrics["handler_time"] = inst.execution_time self.instances[inst.name] = inst diff --git a/scripts/tests/twister/test_runner.py b/scripts/tests/twister/test_runner.py index 0e6227acefeb..e689095fc7c1 100644 --- a/scripts/tests/twister/test_runner.py +++ b/scripts/tests/twister/test_runner.py @@ -2530,7 +2530,7 @@ def mock_client_from_environ(jobs): pipeline_q = queue.LifoQueue() done_q = queue.LifoQueue() done_instance = mock.Mock( - metrics={'k2': 'v2'}, + metrics={'k': 'v2'}, execution_time=30 ) done_instance.name='dummy instance' @@ -2568,8 +2568,7 @@ def iteration_increment(value=1, decrement=False): assert tr.jobserver.name == expected_jobserver assert tr.instances['dummy instance'].metrics == { - 'k': 'v', - 'k2': 'v2', + 'k': 'v2', 'handler_time': 30 } From fc8b05e81ad1cd5ad4c62ead0d4ed96d034913f4 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Thu, 3 Jul 2025 13:07:05 +0100 Subject: [PATCH 0129/2141] [nrf fromlist] sysbuild: cmake: kconfig: Fix missing sysbuild Kconfig paths Fixes an issue where external sysbuild Kconfig path variables were not provided and meant they could not be overwritten Upstream PR #: 92591 Signed-off-by: Jamie McCrae (cherry picked from commit 1e9016c290bc7e2e14445b77520fbab979f93e63) --- share/sysbuild/cmake/modules/sysbuild_kconfig.cmake | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/share/sysbuild/cmake/modules/sysbuild_kconfig.cmake b/share/sysbuild/cmake/modules/sysbuild_kconfig.cmake index f366c66dbde0..f0e4c29fcadc 100644 --- a/share/sysbuild/cmake/modules/sysbuild_kconfig.cmake +++ b/share/sysbuild/cmake/modules/sysbuild_kconfig.cmake @@ -102,6 +102,17 @@ set(shield_conf_files) list(APPEND ZEPHYR_KCONFIG_MODULES_DIR BOARD=${BOARD}) set(KCONFIG_NAMESPACE SB_CONFIG) +foreach(module_name ${ZEPHYR_MODULE_NAMES}) + zephyr_string(SANITIZE TOUPPER MODULE_NAME_UPPER ${module_name}) + + if(SYSBUILD_${MODULE_NAME_UPPER}_KCONFIG) + list(APPEND + ZEPHYR_KCONFIG_MODULES_DIR + "SYSBUILD_${MODULE_NAME_UPPER}_KCONFIG=${SYSBUILD_${MODULE_NAME_UPPER}_KCONFIG}" + ) + endif() +endforeach() + if(EXISTS ${APP_DIR}/Kconfig.sysbuild) set(KCONFIG_ROOT ${APP_DIR}/Kconfig.sysbuild) endif() From 01ea3eec543b3fe31fbdb86b30ee4cf9d4f8b91d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karol=20Laso=C5=84czyk?= Date: Mon, 23 Jun 2025 16:26:24 +0200 Subject: [PATCH 0130/2141] [nrf fromtree] soc: nrf: Add nRF54LM20A device MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adding nRF54LM20A device. Signed-off-by: Karol Lasończyk Signed-off-by: Sebastian Głąb (cherry picked from commit 387520c867eeb6bc6048471f9d61c769d82e35fe) --- dts/arm/nordic/nrf54lm20a_enga_cpuapp.dtsi | 125 +++ dts/riscv/nordic/nrf54lm20a_enga_cpuflpr.dtsi | 67 ++ dts/vendor/nordic/nrf54lm20a.dtsi | 879 ++++++++++++++++++ modules/hal_nordic/nrfx/CMakeLists.txt | 7 +- snippets/nordic-flpr/snippet.yml | 3 + .../nordic-flpr/soc/nrf54lm20a_cpuapp.overlay | 39 + soc/nordic/nrf54l/Kconfig | 6 + .../Kconfig.defconfig.nrf54lm20a_enga_cpuapp | 15 + .../Kconfig.defconfig.nrf54lm20a_enga_cpuflpr | 11 + soc/nordic/nrf54l/Kconfig.soc | 25 + soc/nordic/nrf54l/Kconfig.sysbuild | 2 +- soc/nordic/soc.yml | 13 + 12 files changed, 1190 insertions(+), 2 deletions(-) create mode 100644 dts/arm/nordic/nrf54lm20a_enga_cpuapp.dtsi create mode 100644 dts/riscv/nordic/nrf54lm20a_enga_cpuflpr.dtsi create mode 100644 dts/vendor/nordic/nrf54lm20a.dtsi create mode 100644 snippets/nordic-flpr/soc/nrf54lm20a_cpuapp.overlay create mode 100644 soc/nordic/nrf54l/Kconfig.defconfig.nrf54lm20a_enga_cpuapp create mode 100644 soc/nordic/nrf54l/Kconfig.defconfig.nrf54lm20a_enga_cpuflpr diff --git a/dts/arm/nordic/nrf54lm20a_enga_cpuapp.dtsi b/dts/arm/nordic/nrf54lm20a_enga_cpuapp.dtsi new file mode 100644 index 000000000000..fa5ee3252bf7 --- /dev/null +++ b/dts/arm/nordic/nrf54lm20a_enga_cpuapp.dtsi @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +cpu: &cpuapp {}; +systick: &cpuapp_systick {}; +nvic: &cpuapp_nvic {}; + +/delete-node/ &cpuflpr; +/delete-node/ &cpuflpr_rram; +/delete-node/ &cpuflpr_sram; +/delete-node/ &cpuflpr_clic; + +/ { + chosen { + zephyr,entropy = &prng; + }; + + soc { + compatible = "simple-bus"; + interrupt-parent = <&cpuapp_nvic>; + ranges; + }; + + psa_rng: psa-rng { + compatible = "zephyr,psa-crypto-rng"; + status = "disabled"; + }; + + prng: prng { + compatible = "nordic,entropy-prng"; + status = "okay"; + }; +}; + +&cpuflpr_vpr { + cpuapp_vevif_rx: mailbox@1 { + compatible = "nordic,nrf-vevif-event-rx"; + reg = <0x0 0x1000>; + status = "disabled"; + interrupts = <76 NRF_DEFAULT_IRQ_PRIORITY>; + #mbox-cells = <1>; + nordic,events = <1>; + nordic,events-mask = <0x00100000>; + }; + + cpuapp_vevif_tx: mailbox@0 { + compatible = "nordic,nrf-vevif-task-tx"; + reg = <0x0 0x1000>; + #mbox-cells = <1>; + nordic,tasks = <7>; + nordic,tasks-mask = <0x007f0000>; + status = "disabled"; + }; +}; + +&cpuapp_ppb { + compatible = "simple-bus"; + ranges; +}; + +&grtc { + interrupts = <228 NRF_DEFAULT_IRQ_PRIORITY>, + <229 NRF_DEFAULT_IRQ_PRIORITY>; /* reserved for Zero Latency IRQs */ +}; + +&gpiote20 { + interrupts = <219 NRF_DEFAULT_IRQ_PRIORITY>; +}; + +&gpiote30 { + interrupts = <269 NRF_DEFAULT_IRQ_PRIORITY>; +}; + +&dppic00 { + status = "okay"; +}; + +&dppic10 { + status = "okay"; +}; + +&dppic20 { + status = "okay"; +}; + +&dppic30 { + status = "okay"; +}; + +&ppib00 { + status = "okay"; +}; + +&ppib01 { + status = "okay"; +}; + +&ppib10 { + status = "okay"; +}; + +&ppib11 { + status = "okay"; +}; + +&ppib20 { + status = "okay"; +}; + +&ppib21 { + status = "okay"; +}; + +&ppib22 { + status = "okay"; +}; + +&ppib30 { + status = "okay"; +}; diff --git a/dts/riscv/nordic/nrf54lm20a_enga_cpuflpr.dtsi b/dts/riscv/nordic/nrf54lm20a_enga_cpuflpr.dtsi new file mode 100644 index 000000000000..82f1b17b2b17 --- /dev/null +++ b/dts/riscv/nordic/nrf54lm20a_enga_cpuflpr.dtsi @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +cpu: &cpuflpr {}; +clic: &cpuflpr_clic {}; + +/delete-node/ &cpuapp; +/delete-node/ &cpuapp_rram; +/delete-node/ &cpuapp_ppb; +/delete-node/ &cpuapp_sram; + +/ { + soc { + compatible = "simple-bus"; + interrupt-parent = <&cpuflpr_clic>; + ranges; + }; +}; + +&cpuflpr { + cpuflpr_vevif_rx: mailbox { + compatible = "nordic,nrf-vevif-task-rx"; + status = "disabled"; + interrupt-parent = <&cpuflpr_clic>; + interrupts = <16 NRF_DEFAULT_IRQ_PRIORITY>, + <17 NRF_DEFAULT_IRQ_PRIORITY>, + <18 NRF_DEFAULT_IRQ_PRIORITY>, + <19 NRF_DEFAULT_IRQ_PRIORITY>, + <20 NRF_DEFAULT_IRQ_PRIORITY>, + <21 NRF_DEFAULT_IRQ_PRIORITY>, + <22 NRF_DEFAULT_IRQ_PRIORITY>; + #mbox-cells = <1>; + nordic,tasks = <7>; + nordic,tasks-mask = <0x007f0000>; + }; +}; + +&cpuflpr_vpr { + cpuflpr_vevif_tx: mailbox { + compatible = "nordic,nrf-vevif-event-tx"; + #mbox-cells = <1>; + nordic,events = <1>; + nordic,events-mask = <0x00100000>; + status = "disabled"; + }; +}; + +&cpuflpr_clic { + status = "okay"; +}; + +&grtc { + interrupts = <226 NRF_DEFAULT_IRQ_PRIORITY>; +}; + +&gpiote20 { + interrupts = <218 NRF_DEFAULT_IRQ_PRIORITY>; +}; + +&gpiote30 { + interrupts = <268 NRF_DEFAULT_IRQ_PRIORITY>; +}; diff --git a/dts/vendor/nordic/nrf54lm20a.dtsi b/dts/vendor/nordic/nrf54lm20a.dtsi new file mode 100644 index 000000000000..d673ae94e509 --- /dev/null +++ b/dts/vendor/nordic/nrf54lm20a.dtsi @@ -0,0 +1,879 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include + +/delete-node/ &sw_pwm; + +/* Domain IDs. Can be used to specify channel links in IPCT nodes. */ +#define NRF_DOMAIN_ID_APPLICATION 0 +#define NRF_DOMAIN_ID_FLPR 1 + +/ { + #address-cells = <1>; + #size-cells = <1>; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpuapp: cpu@0 { + compatible = "arm,cortex-m33f"; + reg = <0>; + device_type = "cpu"; + clocks = <&hfpll>; + #address-cells = <1>; + #size-cells = <1>; + + itm: itm@e0000000 { + compatible = "arm,armv8m-itm"; + reg = <0xe0000000 0x1000>; + swo-ref-frequency = ; + }; + }; + + cpuflpr: cpu@1 { + compatible = "nordic,vpr"; + reg = <1>; + device_type = "cpu"; + riscv,isa = "rv32emc"; + nordic,bus-width = <32>; + }; + }; + + clocks { + pclk: pclk { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = ; + }; + + pclk32m: pclk32m { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = ; + }; + + lfxo: lfxo { + compatible = "nordic,nrf54l-lfxo"; + #clock-cells = <0>; + clock-frequency = <32768>; + }; + + hfxo: hfxo { + compatible = "nordic,nrf54l-hfxo"; + #clock-cells = <0>; + clock-frequency = ; + startup-time-us = <1650>; + }; + + hfpll: hfpll { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = ; + }; + + aclk: aclk { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = ; + }; + }; + + soc { + #address-cells = <1>; + #size-cells = <1>; + + ficr: ficr@ffc000 { + compatible = "nordic,nrf-ficr"; + reg = <0xffc000 0x1000>; + #nordic,ficr-cells = <1>; + }; + + uicr: uicr@ffd000 { + compatible = "nordic,nrf-uicr"; + reg = <0xffd000 0x1000>; + }; + + cpuapp_sram: memory@20000000 { + compatible = "mmio-sram"; + reg = <0x20000000 DT_SIZE_K(511)>; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x20000000 DT_SIZE_K(511)>; + }; + + cpuflpr_sram: memory@20067c00 { + compatible = "mmio-sram"; + reg = <0x20067c00 DT_SIZE_K(96)>; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x20067c00 DT_SIZE_K(96)>; + }; + + global_peripherals: peripheral@50000000 { + ranges = <0x0 0x50000000 0x10000000>; + #address-cells = <1>; + #size-cells = <1>; + + dppic00: dppic@42000 { + compatible = "nordic,nrf-dppic"; + reg = <0x42000 0x808>; + status = "disabled"; + }; + + ppib00: ppib@44000 { + compatible = "nordic,nrf-ppib"; + reg = <0x44000 0x1000>; + status = "disabled"; + }; + + ppib01: ppib@45000 { + compatible = "nordic,nrf-ppib"; + reg = <0x45000 0x1000>; + status = "disabled"; + }; + + cpuflpr_vpr: vpr@4c000 { + compatible = "nordic,nrf-vpr-coprocessor"; + reg = <0x4c000 0x1000>; + ranges = <0x0 0x4c000 0x1000>; + #address-cells = <1>; + #size-cells = <1>; + status = "disabled"; + enable-secure; + + cpuflpr_clic: interrupt-controller@f0000000 { + compatible = "nordic,nrf-clic"; + reg = <0xf0000000 0x143c>; + interrupt-controller; + #interrupt-cells = <2>; + #address-cells = <1>; + status = "disabled"; + }; + }; + + spi00: spi@4d000 { + /* + * This spi node can be either SPIM or SPIS, + * for the user to pick: + * compatible = "nordic,nrf-spim" or + * "nordic,nrf-spis". + */ + compatible = "nordic,nrf-spim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x4d000 0x1000>; + interrupts = <77 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + easydma-maxcnt-bits = <16>; + rx-delay-supported; + rx-delay = <1>; + status = "disabled"; + }; + + uart00: uart@4d000 { + compatible = "nordic,nrf-uarte"; + reg = <0x4d000 0x1000>; + interrupts = <77 NRF_DEFAULT_IRQ_PRIORITY>; + clocks = <&hfpll>; + status = "disabled"; + endtx-stoptx-supported; + frame-timeout-supported; + }; + + gpio2: gpio@50400 { + compatible = "nordic,nrf-gpio"; + gpio-controller; + reg = <0x50400 0x300>; + #gpio-cells = <2>; + ngpios = <11>; + status = "disabled"; + port = <2>; + }; + + timer00: timer@55000 { + compatible = "nordic,nrf-timer"; + status = "disabled"; + reg = <0x55000 0x1000>; + cc-num = <6>; + max-bit-width = <32>; + interrupts = <85 NRF_DEFAULT_IRQ_PRIORITY>; + clocks = <&hfpll>; + prescaler = <0>; + }; + + usbhs: usbhs@5a000 { + compatible = "nordic,nrf-usbhs-nrf54l", "snps,dwc2"; + reg = <0x5a000 0x1000>, <0x50020000 0x1a000>; + reg-names = "wrapper", "core"; + interrupts = <90 NRF_DEFAULT_IRQ_PRIORITY>; + num-in-eps = <16>; + num-out-eps = <16>; + ghwcfg1 = <0x0>; + ghwcfg2 = <0x22affc52>; + ghwcfg4 = <0x3e10aa60>; + status = "disabled"; + }; + + dppic10: dppic@82000 { + compatible = "nordic,nrf-dppic"; + reg = <0x82000 0x808>; + status = "disabled"; + }; + + ppib10: ppib@83000 { + compatible = "nordic,nrf-ppib"; + reg = <0x83000 0x1000>; + status = "disabled"; + }; + + ppib11: ppib@84000 { + compatible = "nordic,nrf-ppib"; + reg = <0x84000 0x1000>; + status = "disabled"; + }; + + timer10: timer@85000 { + compatible = "nordic,nrf-timer"; + status = "disabled"; + reg = <0x85000 0x1000>; + cc-num = <8>; + max-bit-width = <32>; + interrupts = <133 NRF_DEFAULT_IRQ_PRIORITY>; + clocks = <&hfxo>; + prescaler = <0>; + }; + + egu10: egu@87000 { + compatible = "nordic,nrf-egu"; + reg = <0x87000 0x1000>; + interrupts = <135 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + + radio: radio@8a000 { + compatible = "nordic,nrf-radio"; + reg = <0x8a000 0x1000>; + interrupts = <138 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + dfe-supported; + ieee802154-supported; + ble-2mbps-supported; + ble-coded-phy-supported; + cs-supported; + + ieee802154: ieee802154 { + compatible = "nordic,nrf-ieee802154"; + status = "disabled"; + }; + + /* Note: In the nRF Connect SDK the SoftDevice Controller + * is added and set as the default Bluetooth Controller. + */ + bt_hci_sdc: bt_hci_sdc { + compatible = "nordic,bt-hci-sdc"; + status = "disabled"; + }; + + bt_hci_controller: bt_hci_controller { + compatible = "zephyr,bt-hci-ll-sw-split"; + status = "disabled"; + }; + }; + + dppic20: dppic@c2000 { + compatible = "nordic,nrf-dppic"; + reg = <0xc2000 0x808>; + status = "disabled"; + }; + + ppib20: ppib@c3000 { + compatible = "nordic,nrf-ppib"; + reg = <0xc3000 0x1000>; + status = "disabled"; + }; + + ppib21: ppib@c4000 { + compatible = "nordic,nrf-ppib"; + reg = <0xc4000 0x1000>; + status = "disabled"; + }; + + ppib22: ppib@c5000 { + compatible = "nordic,nrf-ppib"; + reg = <0xc5000 0x1000>; + status = "disabled"; + }; + + i2c20: i2c@c6000 { + compatible = "nordic,nrf-twim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xc6000 0x1000>; + interrupts = <198 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <16>; + status = "disabled"; + zephyr,pm-device-runtime-auto; + }; + + spi20: spi@c6000 { + /* + * This spi node can be either SPIM or SPIS, + * for the user to pick: + * compatible = "nordic,nrf-spim" or + * "nordic,nrf-spis". + */ + compatible = "nordic,nrf-spim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xc6000 0x1000>; + interrupts = <198 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + easydma-maxcnt-bits = <16>; + rx-delay-supported; + rx-delay = <1>; + status = "disabled"; + }; + + uart20: uart@c6000 { + compatible = "nordic,nrf-uarte"; + reg = <0xc6000 0x1000>; + interrupts = <198 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + endtx-stoptx-supported; + frame-timeout-supported; + }; + + i2c21: i2c@c7000 { + compatible = "nordic,nrf-twim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xc7000 0x1000>; + interrupts = <199 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <16>; + status = "disabled"; + zephyr,pm-device-runtime-auto; + }; + + spi21: spi@c7000 { + /* + * This spi node can be either SPIM or SPIS, + * for the user to pick: + * compatible = "nordic,nrf-spim" or + * "nordic,nrf-spis". + */ + compatible = "nordic,nrf-spim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xc7000 0x1000>; + interrupts = <199 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + easydma-maxcnt-bits = <16>; + rx-delay-supported; + rx-delay = <1>; + status = "disabled"; + }; + + uart21: uart@c7000 { + compatible = "nordic,nrf-uarte"; + reg = <0xc7000 0x1000>; + interrupts = <199 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + endtx-stoptx-supported; + frame-timeout-supported; + }; + + i2c22: i2c@c8000 { + compatible = "nordic,nrf-twim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xc8000 0x1000>; + interrupts = <200 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <16>; + status = "disabled"; + zephyr,pm-device-runtime-auto; + }; + + spi22: spi@c8000 { + /* + * This spi node can be either SPIM or SPIS, + * for the user to pick: + * compatible = "nordic,nrf-spim" or + * "nordic,nrf-spis". + */ + compatible = "nordic,nrf-spim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xc8000 0x1000>; + interrupts = <200 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + easydma-maxcnt-bits = <16>; + rx-delay-supported; + rx-delay = <1>; + status = "disabled"; + }; + + uart22: uart@c8000 { + compatible = "nordic,nrf-uarte"; + reg = <0xc8000 0x1000>; + interrupts = <200 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + endtx-stoptx-supported; + frame-timeout-supported; + }; + + egu20: egu@c9000 { + compatible = "nordic,nrf-egu"; + reg = <0xc9000 0x1000>; + interrupts = <201 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + + timer20: timer@ca000 { + compatible = "nordic,nrf-timer"; + status = "disabled"; + reg = <0xca000 0x1000>; + cc-num = <6>; + max-bit-width = <32>; + interrupts = <202 NRF_DEFAULT_IRQ_PRIORITY>; + prescaler = <0>; + }; + + timer21: timer@cb000 { + compatible = "nordic,nrf-timer"; + status = "disabled"; + reg = <0xcb000 0x1000>; + cc-num = <6>; + max-bit-width = <32>; + interrupts = <203 NRF_DEFAULT_IRQ_PRIORITY>; + prescaler = <0>; + }; + + timer22: timer@cc000 { + compatible = "nordic,nrf-timer"; + status = "disabled"; + reg = <0xcc000 0x1000>; + cc-num = <6>; + max-bit-width = <32>; + interrupts = <204 NRF_DEFAULT_IRQ_PRIORITY>; + prescaler = <0>; + }; + + timer23: timer@cd000 { + compatible = "nordic,nrf-timer"; + status = "disabled"; + reg = <0xcd000 0x1000>; + cc-num = <6>; + max-bit-width = <32>; + interrupts = <205 NRF_DEFAULT_IRQ_PRIORITY>; + prescaler = <0>; + }; + + timer24: timer@ce000 { + compatible = "nordic,nrf-timer"; + status = "disabled"; + reg = <0xce000 0x1000>; + cc-num = <6>; + max-bit-width = <32>; + interrupts = <206 NRF_DEFAULT_IRQ_PRIORITY>; + prescaler = <0>; + }; + + pdm20: pdm@d0000 { + compatible = "nordic,nrf-pdm"; + status = "disabled"; + reg = <0xd0000 0x1000>; + interrupts = <208 NRF_DEFAULT_IRQ_PRIORITY>; + }; + + pdm21: pdm@d1000 { + compatible = "nordic,nrf-pdm"; + status = "disabled"; + reg = <0xd1000 0x1000>; + interrupts = <209 NRF_DEFAULT_IRQ_PRIORITY>; + }; + + pwm20: pwm@d2000 { + compatible = "nordic,nrf-pwm"; + status = "disabled"; + reg = <0xd2000 0x1000>; + interrupts = <210 NRF_DEFAULT_IRQ_PRIORITY>; + #pwm-cells = <3>; + }; + + pwm21: pwm@d3000 { + compatible = "nordic,nrf-pwm"; + status = "disabled"; + reg = <0xd3000 0x1000>; + interrupts = <211 NRF_DEFAULT_IRQ_PRIORITY>; + #pwm-cells = <3>; + }; + + pwm22: pwm@d4000 { + compatible = "nordic,nrf-pwm"; + status = "disabled"; + reg = <0xd4000 0x1000>; + interrupts = <212 NRF_DEFAULT_IRQ_PRIORITY>; + #pwm-cells = <3>; + }; + + adc: adc@d5000 { + compatible = "nordic,nrf-saadc"; + reg = <0xd5000 0x1000>; + interrupts = <213 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + #io-channel-cells = <1>; + zephyr,pm-device-runtime-auto; + }; + + nfct: nfct@d6000 { + compatible = "nordic,nrf-nfct"; + reg = <0xd6000 0x1000>; + interrupts = <214 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + + temp: temp@d7000 { + compatible = "nordic,nrf-temp"; + reg = <0xd7000 0x1000>; + interrupts = <215 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + + gpio1: gpio@d8200 { + compatible = "nordic,nrf-gpio"; + gpio-controller; + reg = <0xd8200 0x300>; + #gpio-cells = <2>; + ngpios = <32>; + status = "disabled"; + port = <1>; + gpiote-instance = <&gpiote20>; + }; + + gpio3: gpio@d8600 { + compatible = "nordic,nrf-gpio"; + gpio-controller; + reg = <0xd8600 0x300>; + #gpio-cells = <2>; + ngpios = <13>; + status = "disabled"; + port = <3>; + gpiote-instance = <&gpiote20>; + }; + + gpiote20: gpiote@da000 { + compatible = "nordic,nrf-gpiote"; + reg = <0xda000 0x1000>; + status = "disabled"; + instance = <20>; + }; + + qdec20: qdec@e0000 { + compatible = "nordic,nrf-qdec"; + reg = <0xe0000 0x1000>; + interrupts = <224 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + + qdec21: qdec@e1000 { + compatible = "nordic,nrf-qdec"; + reg = <0xe1000 0x1000>; + interrupts = <225 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + + grtc: grtc@e2000 { + compatible = "nordic,nrf-grtc"; + reg = <0xe2000 0x1000>; + cc-num = <12>; + clocks = <&lfxo>, <&pclk>; + clock-names = "lfclock", "hfclock"; + status = "disabled"; + }; + + tdm: tdm@e8000 { + compatible = "nordic,nrf-tdm"; + easydma-maxcnt-bits = <15>; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xe8000 0x1000>; + interrupts = <232 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + clocks = <&pclk32m>; + nordic,clockpin-enable = , + ; + }; + + i2c23: i2c@ed000 { + compatible = "nordic,nrf-twim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xed000 0x1000>; + interrupts = <237 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <16>; + status = "disabled"; + zephyr,pm-device-runtime-auto; + }; + + spi23: spi@ed000 { + /* + * This spi node can be either SPIM or SPIS, + * for the user to pick: + * compatible = "nordic,nrf-spim" or + * "nordic,nrf-spis". + */ + compatible = "nordic,nrf-spim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xed000 0x1000>; + interrupts = <237 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + easydma-maxcnt-bits = <16>; + rx-delay-supported; + rx-delay = <1>; + status = "disabled"; + }; + + uart23: uart@ed000 { + compatible = "nordic,nrf-uarte"; + reg = <0xed000 0x1000>; + interrupts = <237 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + endtx-stoptx-supported; + frame-timeout-supported; + }; + + i2c24: i2c@ee000 { + compatible = "nordic,nrf-twim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xee000 0x1000>; + interrupts = <238 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <16>; + status = "disabled"; + zephyr,pm-device-runtime-auto; + }; + + spi24: spi@ee000 { + /* + * This spi node can be either SPIM or SPIS, + * for the user to pick: + * compatible = "nordic,nrf-spim" or + * "nordic,nrf-spis". + */ + compatible = "nordic,nrf-spim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xee000 0x1000>; + interrupts = <238 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + easydma-maxcnt-bits = <16>; + rx-delay-supported; + rx-delay = <1>; + status = "disabled"; + }; + + uart24: uart@ee000 { + compatible = "nordic,nrf-uarte"; + reg = <0xee000 0x1000>; + interrupts = <238 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + endtx-stoptx-supported; + frame-timeout-supported; + }; + + dppic30: dppic@102000 { + compatible = "nordic,nrf-dppic"; + reg = <0x102000 0x808>; + status = "disabled"; + }; + + ppib30: ppib@103000 { + compatible = "nordic,nrf-ppib"; + reg = <0x103000 0x1000>; + status = "disabled"; + }; + + i2c30: i2c@104000 { + compatible = "nordic,nrf-twim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x104000 0x1000>; + interrupts = <260 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <16>; + status = "disabled"; + zephyr,pm-device-runtime-auto; + }; + + spi30: spi@104000 { + /* + * This spi node can be either SPIM or SPIS, + * for the user to pick: + * compatible = "nordic,nrf-spim" or + * "nordic,nrf-spis". + */ + compatible = "nordic,nrf-spim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x104000 0x1000>; + interrupts = <260 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + easydma-maxcnt-bits = <16>; + rx-delay-supported; + rx-delay = <1>; + status = "disabled"; + }; + + uart30: uart@104000 { + compatible = "nordic,nrf-uarte"; + reg = <0x104000 0x1000>; + interrupts = <260 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + endtx-stoptx-supported; + frame-timeout-supported; + }; + + comp: comparator@106000 { + /* + * Use compatible "nordic,nrf-comp" to configure as COMP + * Use compatible "nordic,nrf-lpcomp" to configure as LPCOMP + */ + compatible = "nordic,nrf-comp"; + reg = <0x106000 0x1000>; + status = "disabled"; + interrupts = <262 NRF_DEFAULT_IRQ_PRIORITY>; + }; + + wdt30: watchdog@108000 { + compatible = "nordic,nrf-wdt"; + reg = <0x108000 0x620>; + interrupts = <264 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + + wdt31: watchdog@109000 { + compatible = "nordic,nrf-wdt"; + reg = <0x109000 0x620>; + interrupts = <265 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + + gpio0: gpio@10a000 { + compatible = "nordic,nrf-gpio"; + gpio-controller; + reg = <0x10a000 0x300>; + #gpio-cells = <2>; + ngpios = <10>; + status = "disabled"; + port = <0>; + gpiote-instance = <&gpiote30>; + }; + + gpiote30: gpiote@10c000 { + compatible = "nordic,nrf-gpiote"; + reg = <0x10c000 0x1000>; + status = "disabled"; + instance = <30>; + }; + + clock: clock@10e000 { + compatible = "nordic,nrf-clock"; + reg = <0x10e000 0x1000>; + interrupts = <270 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + + power: power@10e000 { + compatible = "nordic,nrf-power"; + reg = <0x10e000 0x1000>; + ranges = <0x0 0x10e000 0x1000>; + interrupts = <270 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + #address-cells = <1>; + #size-cells = <1>; + + gpregret1: gpregret1@51c { + #address-cells = <1>; + #size-cells = <1>; + compatible = "nordic,nrf-gpregret"; + reg = <0x51c 0x1>; + status = "disabled"; + }; + + gpregret2: gpregret2@520 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "nordic,nrf-gpregret"; + reg = <0x520 0x1>; + status = "disabled"; + }; + }; + + regulators: regulator@120000 { + compatible = "nordic,nrf54l-regulators"; + reg = <0x120000 0x1000>; + status = "disabled"; + #address-cells = <1>; + #size-cells = <1>; + + vregmain: regulator@120600 { + compatible = "nordic,nrf5x-regulator"; + reg = <0x120600 0x1>; + status = "disabled"; + regulator-name = "VREGMAIN"; + regulator-initial-mode = ; + }; + }; + }; + + rram_controller: rram-controller@5004e000 { + compatible = "nordic,rram-controller"; + reg = <0x5004e000 0x1000>; + interrupts = <78 NRF_DEFAULT_IRQ_PRIORITY>; + #address-cells = <1>; + #size-cells = <1>; + + cpuapp_rram: rram@0 { + compatible = "soc-nv-flash"; + reg = <0x0 DT_SIZE_K(2036)>; + erase-block-size = <4096>; + write-block-size = <16>; + }; + + cpuflpr_rram: rram@1e5000 { + compatible = "soc-nv-flash"; + reg = <0x1e5000 DT_SIZE_K(96)>; + erase-block-size = <4096>; + write-block-size = <16>; + }; + }; + + cpuapp_ppb: cpuapp-ppb-bus { + #address-cells = <1>; + #size-cells = <1>; + + cpuapp_nvic: interrupt-controller@e000e100 { + #address-cells = <1>; + compatible = "arm,v8m-nvic"; + reg = <0xe000e100 0xc00>; + arm,num-irq-priority-bits = <3>; + interrupt-controller; + #interrupt-cells = <2>; + }; + + cpuapp_systick: timer@e000e010 { + compatible = "arm,armv8m-systick"; + reg = <0xe000e010 0x10>; + status = "disabled"; + }; + }; + }; +}; diff --git a/modules/hal_nordic/nrfx/CMakeLists.txt b/modules/hal_nordic/nrfx/CMakeLists.txt index 5d7b4d942b3b..1d18d708d747 100644 --- a/modules/hal_nordic/nrfx/CMakeLists.txt +++ b/modules/hal_nordic/nrfx/CMakeLists.txt @@ -63,6 +63,9 @@ zephyr_compile_definitions_ifdef(CONFIG_SOC_COMPATIBLE_NRF54L15_CPUAPP NRF_APPLI zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54L20_ENGA NRF54LM20A_ENGA_XXAA) zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54L20_ENGA_CPUAPP NRF_APPLICATION) zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54L20_ENGA_CPUFLPR NRF_FLPR) +zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54LM20A_ENGA NRF54LM20A_ENGA_XXAA) +zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54LM20A_ENGA_CPUAPP NRF_APPLICATION) +zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54LM20A_ENGA_CPUFLPR NRF_FLPR) zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF9120 NRF9120_XXAA) zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF9160 NRF9160_XXAA) @@ -201,7 +204,7 @@ zephyr_compile_definitions_ifndef(CONFIG_SOC_NRF54L_ANOMALY_56_WORKAROUND NRF54L # Inject code to skip TAMPC setup for nRF54L20 and nRF54L09. It is not supported for now. # It needs to be removed when support is provided. -if(CONFIG_SOC_NRF54L20_ENGA_CPUAPP OR CONFIG_SOC_NRF54L09_ENGA_CPUAPP) +if(CONFIG_SOC_NRF54L20_ENGA_CPUAPP OR CONFIG_SOC_NRF54LM20A_ENGA_CPUAPP OR CONFIG_SOC_NRF54L09_ENGA_CPUAPP) zephyr_compile_definitions(NRF_SKIP_TAMPC_SETUP) endif() @@ -247,6 +250,8 @@ mdk_svd_ifdef(CONFIG_SOC_NRF54L15_CPUAPP nrf54l15_application.svd) mdk_svd_ifdef(CONFIG_SOC_NRF54L15_CPUFLPR nrf54l15_flpr.svd) mdk_svd_ifdef(CONFIG_SOC_NRF54L20_ENGA_CPUAPP nrf54lm20a_enga_application.svd) mdk_svd_ifdef(CONFIG_SOC_NRF54L20_ENGA_CPUFLPR nrf54lm20a_enga_flpr.svd) +mdk_svd_ifdef(CONFIG_SOC_NRF54LM20A_ENGA_CPUAPP nrf54lm20a_enga_application.svd) +mdk_svd_ifdef(CONFIG_SOC_NRF54LM20A_ENGA_CPUFLPR nrf54lm20a_enga_flpr.svd) mdk_svd_ifdef(CONFIG_SOC_NRF9120 nrf9120.svd) mdk_svd_ifdef(CONFIG_SOC_NRF9160 nrf9160.svd) mdk_svd_ifdef(CONFIG_SOC_NRF9230_ENGB_CPUAPP nrf9230_engb_application.svd) diff --git a/snippets/nordic-flpr/snippet.yml b/snippets/nordic-flpr/snippet.yml index e6f6a41e252d..d35c45810846 100644 --- a/snippets/nordic-flpr/snippet.yml +++ b/snippets/nordic-flpr/snippet.yml @@ -15,3 +15,6 @@ boards: /.*/nrf54l20/cpuapp/: append: EXTRA_DTC_OVERLAY_FILE: soc/nrf54l20_cpuapp.overlay + /.*/nrf54lm20a/cpuapp/: + append: + EXTRA_DTC_OVERLAY_FILE: soc/nrf54lm20a_cpuapp.overlay diff --git a/snippets/nordic-flpr/soc/nrf54lm20a_cpuapp.overlay b/snippets/nordic-flpr/soc/nrf54lm20a_cpuapp.overlay new file mode 100644 index 000000000000..1d36ba5ac488 --- /dev/null +++ b/snippets/nordic-flpr/soc/nrf54lm20a_cpuapp.overlay @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + soc { + reserved-memory { + #address-cells = <1>; + #size-cells = <1>; + + cpuflpr_code_partition: image@1ed000 { + /* FLPR core code partition */ + reg = <0x1ed000 DT_SIZE_K(64)>; + }; + }; + + cpuflpr_sram_code_data: memory@2006fc00 { + compatible = "mmio-sram"; + reg = <0x2006fc00 DT_SIZE_K(64)>; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x2006fc00 0x10000>; + }; + }; +}; + +&uart30 { + status = "reserved"; +}; + +&cpuflpr_vpr { + execution-memory = <&cpuflpr_sram_code_data>; + source-memory = <&cpuflpr_code_partition>; +}; + +&cpuapp_vevif_tx { + status = "okay"; +}; diff --git a/soc/nordic/nrf54l/Kconfig b/soc/nordic/nrf54l/Kconfig index 19131154b5bb..2d968a57bbe5 100644 --- a/soc/nordic/nrf54l/Kconfig +++ b/soc/nordic/nrf54l/Kconfig @@ -38,6 +38,9 @@ config SOC_NRF54L15_CPUAPP config SOC_NRF54L20_ENGA_CPUAPP select SOC_NRF54L_CPUAPP_COMMON +config SOC_NRF54LM20A_ENGA_CPUAPP + select SOC_NRF54L_CPUAPP_COMMON + config SOC_NRF54L05_CPUFLPR select RISCV_CORE_NORDIC_VPR @@ -53,6 +56,9 @@ config SOC_NRF54L15_CPUFLPR config SOC_NRF54L20_ENGA_CPUFLPR select RISCV_CORE_NORDIC_VPR +config SOC_NRF54LM20A_ENGA_CPUFLPR + select RISCV_CORE_NORDIC_VPR + if SOC_SERIES_NRF54LX config SOC_NRF54LX_SKIP_CLOCK_CONFIG diff --git a/soc/nordic/nrf54l/Kconfig.defconfig.nrf54lm20a_enga_cpuapp b/soc/nordic/nrf54l/Kconfig.defconfig.nrf54lm20a_enga_cpuapp new file mode 100644 index 000000000000..c6c083bd7e63 --- /dev/null +++ b/soc/nordic/nrf54l/Kconfig.defconfig.nrf54lm20a_enga_cpuapp @@ -0,0 +1,15 @@ +# Nordic Semiconductor nRF54LM20A MCU + +# Copyright (c) 2025 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + + +if SOC_NRF54LM20A_ENGA_CPUAPP + +config NUM_IRQS + default 290 + +config UART_NRFX_UARTE_SPURIOUS_RXTO_WORKAROUND + default y + +endif # SOC_NRF54LM20A_ENGA_CPUAPP diff --git a/soc/nordic/nrf54l/Kconfig.defconfig.nrf54lm20a_enga_cpuflpr b/soc/nordic/nrf54l/Kconfig.defconfig.nrf54lm20a_enga_cpuflpr new file mode 100644 index 000000000000..b8065044a5f5 --- /dev/null +++ b/soc/nordic/nrf54l/Kconfig.defconfig.nrf54lm20a_enga_cpuflpr @@ -0,0 +1,11 @@ +# Nordic Semiconductor nRF54LM20A MCU + +# Copyright (c) 2025 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +if SOC_NRF54LM20A_ENGA_CPUFLPR + +config NUM_IRQS + default 287 + +endif # SOC_NRF54LM20A_ENGA_CPUFLPR diff --git a/soc/nordic/nrf54l/Kconfig.soc b/soc/nordic/nrf54l/Kconfig.soc index 5fd8260b9bbb..c7ddfc8bb393 100644 --- a/soc/nordic/nrf54l/Kconfig.soc +++ b/soc/nordic/nrf54l/Kconfig.soc @@ -105,9 +105,34 @@ config SOC_NRF54L20_ENGA_CPUFLPR help NRF54L20 ENGA CPUFLPR +config SOC_NRF54LM20A + bool + select SOC_SERIES_NRF54LX + help + NRF54LM20A + +config SOC_NRF54LM20A_ENGA + bool + select SOC_NRF54LM20A + help + NRF54LM20A ENGA + +config SOC_NRF54LM20A_ENGA_CPUAPP + bool + select SOC_NRF54LM20A_ENGA + help + NRF54LM20A ENGA CPUAPP + +config SOC_NRF54LM20A_ENGA_CPUFLPR + bool + select SOC_NRF54LM20A_ENGA + help + NRF54LM20A ENGA CPUFLPR + config SOC default "nrf54l05" if SOC_NRF54L05 default "nrf54l09" if SOC_NRF54L09 default "nrf54l10" if SOC_NRF54L10 default "nrf54l15" if SOC_NRF54L15 default "nrf54l20" if SOC_NRF54L20 + default "nrf54lm20a" if SOC_NRF54LM20A diff --git a/soc/nordic/nrf54l/Kconfig.sysbuild b/soc/nordic/nrf54l/Kconfig.sysbuild index 7ad3f9b4f9ee..1517f62bb389 100644 --- a/soc/nordic/nrf54l/Kconfig.sysbuild +++ b/soc/nordic/nrf54l/Kconfig.sysbuild @@ -1,7 +1,7 @@ # Copyright (c) 2025 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -if SOC_NRF54L09_ENGA_CPUFLPR || SOC_NRF54L15_CPUFLPR || SOC_NRF54L20_ENGA_CPUFLPR +if SOC_NRF54L09_ENGA_CPUFLPR || SOC_NRF54L15_CPUFLPR || SOC_NRF54L20_ENGA_CPUFLPR || SOC_NRF54LM20A_ENGA_CPUFLPR config HAS_NORDIC_VPR_LAUNCHER_IMAGE default y diff --git a/soc/nordic/soc.yml b/soc/nordic/soc.yml index 923403f05303..97e5a0d5a633 100644 --- a/soc/nordic/soc.yml +++ b/soc/nordic/soc.yml @@ -41,6 +41,10 @@ family: cpuclusters: - name: cpuapp - name: cpuflpr + - name: nrf54lm20a + cpuclusters: + - name: cpuapp + - name: cpuflpr - name: nrf54h socs: - name: nrf54h20 @@ -124,6 +128,9 @@ runners: - qualifiers: - nrf54l20/cpuapp - nrf54l20/cpuflpr + - qualifiers: + - nrf54lm20a/cpuapp + - nrf54lm20a/cpuflpr - qualifiers: - nrf54h20/cpuapp - nrf54h20/cpurad @@ -190,6 +197,9 @@ runners: - qualifiers: - nrf54l20/cpuapp - nrf54l20/cpuflpr + - qualifiers: + - nrf54lm20a/cpuapp + - nrf54lm20a/cpuflpr - qualifiers: - nrf54h20/cpuapp - nrf54h20/cpurad @@ -256,6 +266,9 @@ runners: - qualifiers: - nrf54l20/cpuapp - nrf54l20/cpuflpr + - qualifiers: + - nrf54lm20a/cpuapp + - nrf54lm20a/cpuflpr - qualifiers: - nrf54h20/cpuapp - nrf54h20/cpurad From de8218a621c401af2849ab4ab32014f7435c43ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karol=20Laso=C5=84czyk?= Date: Mon, 23 Jun 2025 16:27:22 +0200 Subject: [PATCH 0131/2141] [nrf fromtree] board: nrf: Add nRF54LM20DK board MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adding board for nRF54LM20A device. Signed-off-by: Karol Lasończyk Signed-off-by: Sebastian Głąb (cherry picked from commit 3d1fa8b333e821f8be173c411f73fd437b6e2afc) --- boards/nordic/nrf54lm20dk/Kconfig.defconfig | 9 + boards/nordic/nrf54lm20dk/Kconfig.nrf54lm20dk | 6 + boards/nordic/nrf54lm20dk/board.cmake | 11 ++ boards/nordic/nrf54lm20dk/board.yml | 43 +++++ boards/nordic/nrf54lm20dk/doc/index.rst | 102 +++++++++++ .../nrf54lm20dk/nrf54lm20a_cpuapp_common.dtsi | 170 ++++++++++++++++++ .../nrf54lm20dk_nrf54lm20a-common.dtsi | 109 +++++++++++ .../nrf54lm20dk_nrf54lm20a-pinctrl.dtsi | 97 ++++++++++ .../nrf54lm20dk_nrf54lm20a_cpuapp.dts | 30 ++++ .../nrf54lm20dk_nrf54lm20a_cpuapp.yaml | 23 +++ .../nrf54lm20dk_nrf54lm20a_cpuapp_defconfig | 29 +++ .../nrf54lm20dk_nrf54lm20a_cpuflpr.dts | 68 +++++++ .../nrf54lm20dk_nrf54lm20a_cpuflpr.yaml | 16 ++ .../nrf54lm20dk_nrf54lm20a_cpuflpr_defconfig | 19 ++ 14 files changed, 732 insertions(+) create mode 100644 boards/nordic/nrf54lm20dk/Kconfig.defconfig create mode 100644 boards/nordic/nrf54lm20dk/Kconfig.nrf54lm20dk create mode 100644 boards/nordic/nrf54lm20dk/board.cmake create mode 100644 boards/nordic/nrf54lm20dk/board.yml create mode 100644 boards/nordic/nrf54lm20dk/doc/index.rst create mode 100644 boards/nordic/nrf54lm20dk/nrf54lm20a_cpuapp_common.dtsi create mode 100644 boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a-common.dtsi create mode 100644 boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a-pinctrl.dtsi create mode 100644 boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp.dts create mode 100644 boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp.yaml create mode 100644 boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp_defconfig create mode 100644 boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuflpr.dts create mode 100644 boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuflpr.yaml create mode 100644 boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuflpr_defconfig diff --git a/boards/nordic/nrf54lm20dk/Kconfig.defconfig b/boards/nordic/nrf54lm20dk/Kconfig.defconfig new file mode 100644 index 000000000000..266f0f7c13d4 --- /dev/null +++ b/boards/nordic/nrf54lm20dk/Kconfig.defconfig @@ -0,0 +1,9 @@ +# Copyright (c) 2025 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +if BOARD_NRF54LM20DK_NRF54LM20A_CPUAPP + +config ROM_START_OFFSET + default 0x800 if BOOTLOADER_MCUBOOT + +endif # BOARD_NRF54LM20DK_NRF54LM20A_CPUAPP diff --git a/boards/nordic/nrf54lm20dk/Kconfig.nrf54lm20dk b/boards/nordic/nrf54lm20dk/Kconfig.nrf54lm20dk new file mode 100644 index 000000000000..83b3842211f3 --- /dev/null +++ b/boards/nordic/nrf54lm20dk/Kconfig.nrf54lm20dk @@ -0,0 +1,6 @@ +# Copyright (c) 2025 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_NRF54LM20DK + select SOC_NRF54LM20A_ENGA_CPUAPP if BOARD_NRF54LM20DK_NRF54LM20A_CPUAPP + select SOC_NRF54LM20A_ENGA_CPUFLPR if BOARD_NRF54LM20DK_NRF54LM20A_CPUFLPR diff --git a/boards/nordic/nrf54lm20dk/board.cmake b/boards/nordic/nrf54lm20dk/board.cmake new file mode 100644 index 000000000000..e487ecfb476f --- /dev/null +++ b/boards/nordic/nrf54lm20dk/board.cmake @@ -0,0 +1,11 @@ +# Copyright (c) 2025 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +if(CONFIG_SOC_NRF54LM20A_ENGA_CPUAPP) + board_runner_args(jlink "--device=cortex-m33" "--speed=4000") +elseif(CONFIG_SOC_NRF54LM20A_ENGA_CPUFLPR) + board_runner_args(jlink "--speed=4000") +endif() + +include(${ZEPHYR_BASE}/boards/common/nrfutil.board.cmake) +include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) diff --git a/boards/nordic/nrf54lm20dk/board.yml b/boards/nordic/nrf54lm20dk/board.yml new file mode 100644 index 000000000000..2930f9d3dfbd --- /dev/null +++ b/boards/nordic/nrf54lm20dk/board.yml @@ -0,0 +1,43 @@ +board: + name: nrf54lm20dk + full_name: nRF54LM20 DK + vendor: nordic + socs: + - name: nrf54lm20a + variants: + - name: xip + cpucluster: cpuflpr +runners: + run_once: + '--recover': + - runners: + - nrfjprog + - nrfutil + run: first + groups: + - boards: + - nrf54lm20dk/nrf54lm20a/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuflpr + - nrf54lm20dk/nrf54lm20a/cpuflpr/xip + '--erase': + - runners: + - nrfjprog + - jlink + - nrfutil + run: first + groups: + - boards: + - nrf54lm20dk/nrf54lm20a/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuflpr + - nrf54lm20dk/nrf54lm20a/cpuflpr/xip + '--reset': + - runners: + - nrfjprog + - jlink + - nrfutil + run: last + groups: + - boards: + - nrf54lm20dk/nrf54lm20a/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuflpr + - nrf54lm20dk/nrf54lm20a/cpuflpr/xip diff --git a/boards/nordic/nrf54lm20dk/doc/index.rst b/boards/nordic/nrf54lm20dk/doc/index.rst new file mode 100644 index 000000000000..007074c5cc53 --- /dev/null +++ b/boards/nordic/nrf54lm20dk/doc/index.rst @@ -0,0 +1,102 @@ +.. zephyr:board:: nrf54lm20dk + +Overview +******** + +The nRF54LM20 Development Kit hardware provides support for the Nordic Semiconductor +nRF54LM20A Arm Cortex-M33 CPU and the following devices: + +* :abbr:`SAADC (Successive Approximation Analog to Digital Converter)` +* CLOCK +* RRAM +* :abbr:`GPIO (General Purpose Input Output)` +* :abbr:`TWIM (I2C-compatible two-wire interface master with EasyDMA)` +* MEMCONF +* :abbr:`MPU (Memory Protection Unit)` +* :abbr:`NVIC (Nested Vectored Interrupt Controller)` +* :abbr:`PWM (Pulse Width Modulation)` +* :abbr:`GRTC (Global real-time counter)` +* Segger RTT (RTT Console) +* :abbr:`SPI (Serial Peripheral Interface)` +* :abbr:`UARTE (Universal asynchronous receiver-transmitter)` +* :abbr:`WDT (Watchdog Timer)` + +Hardware +******** + +nRF54LM20 DK has two crystal oscillators: + +* High-frequency 32 MHz crystal oscillator (HFXO) +* Low-frequency 32.768 kHz crystal oscillator (LFXO) + +The crystal oscillators can be configured to use either +internal or external capacitors. + +Supported Features +================== + +.. zephyr:board-supported-hw:: + +Programming and Debugging +************************* + +.. zephyr:board-supported-runners:: + +Applications for the ``nrf54lm20dk/nrf54lm20a/cpuapp`` board target can be +built, flashed, and debugged in the usual way. See +:ref:`build_an_application` and :ref:`application_run` for more details on +building and running. + +Applications for the ``nrf54lm20dk/nrf54lm20a/cpuflpr`` board target need +to be built using sysbuild to include the ``vpr_launcher`` image for the application core. + +Enter the following command to compile ``hello_world`` for the FLPR core: + +.. code-block:: console + + west build -p -b nrf54lm20dk/nrf54lm20a/cpuflpr --sysbuild + + +Flashing +======== + +As an example, this section shows how to build and flash the :zephyr:code-sample:`hello_world` +application. + +.. warning:: + + When programming the device, you might get an error similar to the following message:: + + ERROR: The operation attempted is unavailable due to readback protection in + ERROR: your device. Please use --recover to unlock the device. + + This error occurs when readback protection is enabled. + To disable the readback protection, you must *recover* your device. + + Enter the following command to recover the core:: + + west flash --recover + + The ``--recover`` command erases the flash memory and then writes a small binary into + the recovered flash memory. + This binary prevents the readback protection from enabling itself again after a pin + reset or power cycle. + +Follow the instructions in the :ref:`nordic_segger` page to install +and configure all the necessary software. Further information can be +found in :ref:`nordic_segger_flashing`. + +To build and program the sample to the nRF54LM20 DK, complete the following steps: + +First, connect the nRF54LM20 DK to you computer using the IMCU USB port on the DK. +Next, build the sample by running the following command: + +.. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: nrf54lm20dk/nrf54lm20a/cpuapp + :goals: build flash + +Testing the LEDs and buttons in the nRF54LM20 DK +************************************************ + +Test the nRF54LM20 DK with a :zephyr:code-sample:`blinky` sample. diff --git a/boards/nordic/nrf54lm20dk/nrf54lm20a_cpuapp_common.dtsi b/boards/nordic/nrf54lm20dk/nrf54lm20a_cpuapp_common.dtsi new file mode 100644 index 000000000000..3591a8009486 --- /dev/null +++ b/boards/nordic/nrf54lm20dk/nrf54lm20a_cpuapp_common.dtsi @@ -0,0 +1,170 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* This file is common to the secure and non-secure domain */ + +#include +#include "nrf54lm20dk_nrf54lm20a-common.dtsi" + +/ { + chosen { + zephyr,console = &uart20; + zephyr,shell-uart = &uart20; + zephyr,uart-mcumgr = &uart20; + zephyr,bt-mon-uart = &uart20; + zephyr,bt-c2h-uart = &uart20; + zephyr,flash-controller = &rram_controller; + zephyr,flash = &cpuapp_rram; + zephyr,bt-hci = &bt_hci_sdc; + zephyr,ieee802154 = &ieee802154; + }; +}; + +&cpuapp_sram { + status = "okay"; +}; + +&hfpll { + clock-frequency = ; +}; + +&lfxo { + load-capacitors = "internal"; + load-capacitance-femtofarad = <17000>; +}; + +&hfxo { + load-capacitors = "internal"; + load-capacitance-femtofarad = <15000>; +}; + +&vregmain { + status = "okay"; + regulator-initial-mode = ; +}; + +&grtc { + owned-channels = <0 1 2 3 4 5 6 7 8 9 10 11>; + /* Channels 7-11 reserved for Zero Latency IRQs, 3-4 for FLPR */ + child-owned-channels = <3 4 7 8 9 10 11>; + status = "okay"; +}; + +&cpuapp_rram { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x0 DT_SIZE_K(64)>; + }; + + slot0_partition: partition@10000 { + label = "image-0"; + reg = <0x10000 DT_SIZE_K(449)>; + }; + + slot0_ns_partition: partition@80400 { + label = "image-0-nonsecure"; + reg = <0x80400 DT_SIZE_K(449)>; + }; + + slot1_partition: partition@f0800 { + label = "image-1"; + reg = <0xf0800 DT_SIZE_K(449)>; + }; + + slot1_ns_partition: partition@160c00 { + label = "image-1-nonsecure"; + reg = <0x160c00 DT_SIZE_K(449)>; + }; + + storage_partition: partition@1d1000 { + label = "storage"; + reg = <0x1d1000 DT_SIZE_K(36)>; + }; + }; +}; + +&uart20 { + status = "okay"; +}; + +&nfct { + status = "okay"; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + +&gpio2 { + status = "okay"; +}; + +&gpiote20 { + status = "okay"; +}; + +&gpiote30 { + status = "okay"; +}; + +&radio { + status = "okay"; +}; + +&temp { + status = "okay"; +}; + +&clock { + status = "okay"; +}; + +&bt_hci_controller { + status = "okay"; +}; + +&ieee802154 { + status = "okay"; +}; + +zephyr_udc0: &usbhs { + status = "okay"; +}; + +&spi00 { + status = "okay"; + cs-gpios = <&gpio2 5 GPIO_ACTIVE_LOW>; + pinctrl-0 = <&spi00_default>; + pinctrl-1 = <&spi00_sleep>; + pinctrl-names = "default", "sleep"; + + mx25r64: mx25r6435f@0 { + compatible = "jedec,spi-nor"; + status = "disabled"; + reg = <0>; + spi-max-frequency = <8000000>; + jedec-id = [c2 28 17]; + sfdp-bfp = [ + e5 20 f1 ff ff ff ff 03 44 eb 08 6b 08 3b 04 bb + ee ff ff ff ff ff 00 ff ff ff 00 ff 0c 20 0f 52 + 10 d8 00 ff 23 72 f5 00 82 ed 04 cc 44 83 48 44 + 30 b0 30 b0 f7 c4 d5 5c 00 be 29 ff f0 d0 ff ff + ]; + size = <67108864>; + has-dpd; + t-enter-dpd = <10000>; + t-exit-dpd = <35000>; + }; +}; diff --git a/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a-common.dtsi b/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a-common.dtsi new file mode 100644 index 000000000000..525a3a5fdc0e --- /dev/null +++ b/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a-common.dtsi @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "nrf54lm20dk_nrf54lm20a-pinctrl.dtsi" + +/ { + leds { + compatible = "gpio-leds"; + + led0: led_0 { + gpios = <&gpio1 22 GPIO_ACTIVE_HIGH>; + label = "Green LED 0"; + }; + + led1: led_1 { + gpios = <&gpio1 25 GPIO_ACTIVE_HIGH>; + label = "Green LED 1"; + }; + + led2: led_2 { + gpios = <&gpio1 27 GPIO_ACTIVE_HIGH>; + label = "Green LED 2"; + }; + + led3: led_3 { + gpios = <&gpio1 28 GPIO_ACTIVE_HIGH>; + label = "Green LED 3"; + }; + }; + + pwmleds { + compatible = "pwm-leds"; + + /* + * PWM signal can be exposed on GPIO pin only within same domain. + * There is only one domain which contains both PWM and GPIO: + * PWM20/21/22 and GPIO Port P1/P3. + * Only LEDs connected to P1/P3 can work with PWM, for example LED1. + */ + pwm_led1: pwm_led_1 { + pwms = <&pwm20 0 PWM_MSEC(20) PWM_POLARITY_NORMAL>; + }; + }; + + buttons { + compatible = "gpio-keys"; + + button0: button_0 { + gpios = <&gpio1 26 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + label = "Push button 0"; + zephyr,code = ; + }; + + button1: button_1 { + gpios = <&gpio1 9 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + label = "Push button 1"; + zephyr,code = ; + }; + + button2: button_2 { + gpios = <&gpio1 8 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + label = "Push button 2"; + zephyr,code = ; + }; + + button3: button_3 { + gpios = <&gpio0 5 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + label = "Push button 3"; + zephyr,code = ; + }; + }; + + aliases { + led0 = &led0; + led1 = &led1; + led2 = &led2; + led3 = &led3; + pwm-led0 = &pwm_led1; + sw0 = &button0; + sw1 = &button1; + sw2 = &button2; + sw3 = &button3; + watchdog0 = &wdt31; + }; +}; + +&uart20 { + current-speed = <115200>; + pinctrl-0 = <&uart20_default>; + pinctrl-1 = <&uart20_sleep>; + pinctrl-names = "default", "sleep"; +}; + +&uart30 { + current-speed = <115200>; + pinctrl-0 = <&uart30_default>; + pinctrl-1 = <&uart30_sleep>; + pinctrl-names = "default", "sleep"; +}; + +&pwm20 { + status = "okay"; + pinctrl-0 = <&pwm20_default>; + pinctrl-1 = <&pwm20_sleep>; + pinctrl-names = "default", "sleep"; +}; diff --git a/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a-pinctrl.dtsi b/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a-pinctrl.dtsi new file mode 100644 index 000000000000..ec1c81e4f8d4 --- /dev/null +++ b/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a-pinctrl.dtsi @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + /omit-if-no-ref/ uart20_default: uart20_default { + group1 { + psels = , + ; + }; + + group2 { + psels = , + ; + bias-pull-up; + }; + }; + + /omit-if-no-ref/ uart20_sleep: uart20_sleep { + group1 { + psels = , + , + , + ; + low-power-enable; + }; + }; + + /omit-if-no-ref/ pwm20_default: pwm20_default { + group1 { + psels = ; + }; + }; + + /omit-if-no-ref/ pwm20_sleep: pwm20_sleep { + group1 { + psels = ; + low-power-enable; + }; + }; + + /omit-if-no-ref/ uart30_default: uart30_default { + group1 { + psels = , + ; + }; + + group2 { + psels = , + ; + bias-pull-up; + }; + }; + + /omit-if-no-ref/ uart30_sleep: uart30_sleep { + group1 { + psels = , + , + , + ; + low-power-enable; + }; + }; + + /omit-if-no-ref/ spi00_default: spi00_default { + group1 { + psels = , + , + ; + }; + }; + + /omit-if-no-ref/ spi00_sleep: spi00_sleep { + group1 { + psels = , + , + ; + low-power-enable; + }; + }; + + /omit-if-no-ref/ grtc_default: grtc_default { + group1 { + psels = , + ; + }; + }; + + /omit-if-no-ref/ grtc_sleep: grtc_sleep { + group1 { + psels = , + ; + low-power-enable; + }; + }; +}; diff --git a/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp.dts b/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp.dts new file mode 100644 index 000000000000..29d616b5ece5 --- /dev/null +++ b/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp.dts @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include "nrf54lm20a_cpuapp_common.dtsi" + +/ { + compatible = "nordic,nrf54lm20dk_nrf54lm20a-cpuapp"; + model = "Nordic nRF54LM20 DK nRF54LM20A Application MCU"; + + chosen { + zephyr,code-partition = &slot0_partition; + zephyr,sram = &cpuapp_sram; + }; +}; + +&bt_hci_sdc { + status = "okay"; +}; + +&bt_hci_controller { + status = "disabled"; +}; + +/* Get a node label for wi-fi spi to use in shield files */ +wifi_spi: &spi22 {}; diff --git a/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp.yaml b/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp.yaml new file mode 100644 index 000000000000..765845fa27f0 --- /dev/null +++ b/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp.yaml @@ -0,0 +1,23 @@ +# Copyright (c) 2025 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +identifier: nrf54lm20dk/nrf54lm20a/cpuapp +name: nRF54LM20-DK-nRF54LM20A-Application +type: mcu +arch: arm +toolchain: + - gnuarmemb + - zephyr +sysbuild: true +ram: 512 +flash: 449 +supported: + - adc + - counter + - dmic + - gpio + - i2c + - i2s + - pwm + - spi + - watchdog diff --git a/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp_defconfig b/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp_defconfig new file mode 100644 index 000000000000..8424e66c571d --- /dev/null +++ b/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp_defconfig @@ -0,0 +1,29 @@ +# Copyright (c) 2025 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +# Enable UART driver +CONFIG_SERIAL=y + +# Enable console +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y + +# Enable GPIO +CONFIG_GPIO=y + +# Enable MPU +CONFIG_ARM_MPU=y + +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y + +# MPU-based null-pointer dereferencing detection cannot +# be applied as the (0x0 - 0x400) is unmapped for this target. +CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y + +# Enable Cache +CONFIG_CACHE_MANAGEMENT=y +CONFIG_EXTERNAL_CACHE=y + +# Start SYSCOUNTER on driver init +CONFIG_NRF_GRTC_START_SYSCOUNTER=y diff --git a/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuflpr.dts b/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuflpr.dts new file mode 100644 index 000000000000..3097d3f2775e --- /dev/null +++ b/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuflpr.dts @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; +#include +#include "nrf54lm20dk_nrf54lm20a-common.dtsi" + +/ { + model = "Nordic nRF54LM20 DK nRF54LM20A FLPR MCU"; + compatible = "nordic,nrf54lm20dk_nrf54lm20a-cpuflpr"; + + chosen { + zephyr,console = &uart30; + zephyr,shell-uart = &uart30; + zephyr,code-partition = &cpuflpr_code_partition; + zephyr,flash = &cpuflpr_rram; + zephyr,sram = &cpuflpr_sram; + }; +}; + +&cpuflpr_sram { + status = "okay"; +}; + +&cpuflpr_rram { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + cpuflpr_code_partition: partition@0 { + label = "image-0"; + reg = <0x0 DT_SIZE_K(96)>; + }; + }; +}; + +&grtc { + owned-channels = <3 4>; + status = "okay"; +}; + +&uart30 { + status = "okay"; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + +&gpio2 { + status = "okay"; +}; + +&gpiote20 { + status = "okay"; +}; + +&gpiote30 { + status = "okay"; +}; diff --git a/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuflpr.yaml b/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuflpr.yaml new file mode 100644 index 000000000000..b99d167bcdfe --- /dev/null +++ b/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuflpr.yaml @@ -0,0 +1,16 @@ +# Copyright (c) 2025 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +identifier: nrf54lm20dk/nrf54lm20a/cpuflpr +name: nRF54LM20-DK-nRF54LM20A-Fast-Lightweight-Peripheral-Processor +type: mcu +arch: riscv +toolchain: + - zephyr +sysbuild: true +ram: 96 +flash: 96 +supported: + - counter + - gpio + - watchdog diff --git a/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuflpr_defconfig b/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuflpr_defconfig new file mode 100644 index 000000000000..75f7c4386e3f --- /dev/null +++ b/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuflpr_defconfig @@ -0,0 +1,19 @@ +# Copyright (c) 2025 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +# Enable UART driver +CONFIG_SERIAL=y + +# Enable console +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y + +# Enable GPIO +CONFIG_GPIO=y + +CONFIG_USE_DT_CODE_PARTITION=y + +# Execute from SRAM +CONFIG_XIP=n + +CONFIG_RISCV_ALWAYS_SWITCH_THROUGH_ECALL=y From bc3b447553c016664e41b65972daa4a28344acdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karol=20Laso=C5=84czyk?= Date: Mon, 23 Jun 2025 16:41:27 +0200 Subject: [PATCH 0132/2141] [nrf fromtree] tests: samples: Extend support for nRF54LM20A MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Extends support and adds new overlays. Signed-off-by: Karol Lasończyk Signed-off-by: Bjarki Arge Andreasen Signed-off-by: Sebastian Głąb (cherry picked from commit 061036f9e352bf96e4808ab1cb209aac2747dafd) --- .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 25 ++++++ samples/boards/nordic/system_off/sample.yaml | 4 + .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 21 +++++ .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 9 +++ samples/drivers/mbox/CMakeLists.txt | 1 + samples/drivers/mbox/Kconfig.sysbuild | 1 + .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 20 +++++ samples/drivers/mbox/remote/CMakeLists.txt | 1 + .../nrf54lm20dk_nrf54lm20a_cpuflpr.overlay | 24 ++++++ samples/drivers/mbox/sample.yaml | 4 + .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 8 ++ .../nrf54lm20dk_nrf54lm20a_cpuflpr.overlay | 8 ++ .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 9 +++ .../nrf/hwinfo/reset_cause/testcase.yaml | 1 + .../boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf | 1 + .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 67 +++++++++++++++ tests/boards/nrf/i2c/i2c_slave/testcase.yaml | 2 + .../boards/nrf54lm20dk_nrf54lm20_common.dtsi | 60 ++++++++++++++ .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 6 ++ .../nrf54lm20dk_nrf54lm20a_cpuflpr.overlay | 6 ++ tests/boards/nrf/qdec/testcase.yaml | 2 + .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 44 ++++++++++ .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 15 ++++ .../drivers/adc/adc_error_cases/testcase.yaml | 1 + .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 31 +++++++ .../boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf | 1 + .../clock_control_api/testcase.yaml | 2 + .../nrf_clock_calibration/testcase.yaml | 1 + .../nrf_lf_clock_start/testcase.yaml | 8 ++ .../drivers/clock_control/onoff/testcase.yaml | 1 + .../boards/nrf54lm20dk_nrf54lm20_common.dtsi | 36 +++++++++ .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 3 + .../nrf54lm20dk_nrf54lm20a_cpuflpr.overlay | 3 + .../boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf | 4 + tests/drivers/flash/common/testcase.yaml | 1 + .../flash/negative_tests/testcase.yaml | 1 + .../nrf54lm20dk_nrf54lm20_common.overlay | 21 +++++ .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 7 ++ .../nrf54lm20dk_nrf54lm20a_cpuflpr.overlay | 7 ++ .../boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf | 1 + .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 68 ++++++++++++++++ .../drivers/i2c/i2c_target_api/testcase.yaml | 1 + .../nrf54lm20pdk_nrf54lm20a_cpuapp.overlay | 30 +++++++ .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 30 +++++++ .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 30 +++++++ .../boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf | 1 + .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 25 ++++++ tests/drivers/retained_mem/api/testcase.yaml | 1 + .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 9 +++ .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 81 +++++++++++++++++++ .../spi_controller_peripheral/testcase.yaml | 3 + .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 81 +++++++++++++++++++ .../drivers/spi/spi_error_cases/testcase.yaml | 1 + .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 51 ++++++++++++ tests/drivers/spi/spi_loopback/testcase.yaml | 4 + .../timer/nrf_grtc_timer/testcase.yaml | 3 + .../boards/nrf54lm20dk_nrf54lm20_common.dtsi | 28 +++++++ .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 1 + .../nrf54lm20dk_nrf54lm20a_cpuflpr.overlay | 1 + .../boards/nrf54lm20dk_nrf54lm20_common.dtsi | 29 +++++++ .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 1 + .../nrf54lm20dk_nrf54lm20a_cpuflpr.overlay | 1 + .../nrf54lm20dk_nrf54lm20a_dual_uart.overlay | 49 +++++++++++ .../uart/uart_elementary/testcase.yaml | 6 ++ .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 54 +++++++++++++ tests/drivers/uart/uart_errors/testcase.yaml | 2 + .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 43 ++++++++++ .../uart/uart_mix_fifo_poll/testcase.yaml | 1 + .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 36 +++++++++ tests/drivers/uart/uart_pm/testcase.yaml | 5 ++ .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 9 +++ .../nrf54lm20dk_nrf54lm20a_cpuflpr.overlay | 9 +++ .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 9 +++ .../watchdog/wdt_error_cases/testcase.yaml | 1 + .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 9 +++ .../watchdog/wdt_variables/testcase.yaml | 1 + .../boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf | 1 + tests/subsys/fs/fcb/testcase.yaml | 1 + 78 files changed, 1184 insertions(+) create mode 100644 samples/boards/nordic/system_off/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay create mode 100644 samples/drivers/audio/dmic/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay create mode 100644 samples/drivers/counter/alarm/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay create mode 100644 samples/drivers/mbox/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay create mode 100644 samples/drivers/mbox/remote/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay create mode 100644 samples/drivers/watchdog/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay create mode 100644 samples/drivers/watchdog/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay create mode 100644 tests/boards/nrf/hwinfo/reset_cause/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay create mode 100644 tests/boards/nrf/i2c/i2c_slave/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf create mode 100644 tests/boards/nrf/i2c/i2c_slave/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay create mode 100644 tests/boards/nrf/qdec/boards/nrf54lm20dk_nrf54lm20_common.dtsi create mode 100644 tests/boards/nrf/qdec/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay create mode 100644 tests/boards/nrf/qdec/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay create mode 100644 tests/drivers/adc/adc_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay create mode 100644 tests/drivers/adc/adc_error_cases/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay create mode 100644 tests/drivers/audio/dmic_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay create mode 100644 tests/drivers/clock_control/clock_control_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf create mode 100644 tests/drivers/counter/counter_basic_api/boards/nrf54lm20dk_nrf54lm20_common.dtsi create mode 100644 tests/drivers/counter/counter_basic_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay create mode 100644 tests/drivers/counter/counter_basic_api/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay create mode 100644 tests/drivers/flash/common/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf create mode 100644 tests/drivers/gpio/gpio_basic_api/boards/nrf54lm20dk_nrf54lm20_common.overlay create mode 100644 tests/drivers/gpio/gpio_basic_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay create mode 100644 tests/drivers/gpio/gpio_basic_api/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay create mode 100644 tests/drivers/i2c/i2c_target_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf create mode 100644 tests/drivers/i2c/i2c_target_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay create mode 100644 tests/drivers/i2s/i2s_additional/boards/nrf54lm20pdk_nrf54lm20a_cpuapp.overlay create mode 100644 tests/drivers/i2s/i2s_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay create mode 100644 tests/drivers/i2s/i2s_speed/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay create mode 100644 tests/drivers/retained_mem/api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf create mode 100644 tests/drivers/retained_mem/api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay create mode 100644 tests/drivers/sensor/temp_sensor/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay create mode 100644 tests/drivers/spi/spi_controller_peripheral/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay create mode 100644 tests/drivers/spi/spi_error_cases/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay create mode 100644 tests/drivers/spi/spi_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay create mode 100644 tests/drivers/uart/uart_async_api/boards/nrf54lm20dk_nrf54lm20_common.dtsi create mode 100644 tests/drivers/uart/uart_async_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay create mode 100644 tests/drivers/uart/uart_async_api/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay create mode 100644 tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20_common.dtsi create mode 100644 tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay create mode 100644 tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay create mode 100644 tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20a_dual_uart.overlay create mode 100644 tests/drivers/uart/uart_errors/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay create mode 100644 tests/drivers/uart/uart_mix_fifo_poll/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay create mode 100644 tests/drivers/uart/uart_pm/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay create mode 100644 tests/drivers/watchdog/wdt_basic_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay create mode 100644 tests/drivers/watchdog/wdt_basic_api/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay create mode 100644 tests/drivers/watchdog/wdt_error_cases/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay create mode 100644 tests/drivers/watchdog/wdt_variables/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay create mode 100644 tests/kernel/timer/timer_behavior/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf diff --git a/samples/boards/nordic/system_off/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/samples/boards/nordic/system_off/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay new file mode 100644 index 000000000000..3a79636a4833 --- /dev/null +++ b/samples/boards/nordic/system_off/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -0,0 +1,25 @@ +/ { + cpuapp_sram@2007ec00 { + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0x2007ec00 DT_SIZE_K(4)>; + zephyr,memory-region = "RetainedMem"; + status = "okay"; + + retainedmem0: retainedmem { + compatible = "zephyr,retained-ram"; + status = "okay"; + }; + }; + + aliases { + retainedmemdevice = &retainedmem0; + }; +}; + +&cpuapp_sram { + /* Shrink SRAM size to avoid overlap with retained memory region: + * 511 - 4 = 507KB = 0x7ec00 + */ + reg = <0x20000000 DT_SIZE_K(507)>; + ranges = <0x0 0x20000000 0x7ec00>; +}; diff --git a/samples/boards/nordic/system_off/sample.yaml b/samples/boards/nordic/system_off/sample.yaml index 6e17223e12b4..9b0e39a6cea1 100644 --- a/samples/boards/nordic/system_off/sample.yaml +++ b/samples/boards/nordic/system_off/sample.yaml @@ -15,6 +15,7 @@ tests: - nrf54l15dk/nrf54l10/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp harness: console harness_config: type: multi_line @@ -34,6 +35,7 @@ tests: - nrf54l15dk/nrf54l10/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp extra_configs: - CONFIG_APP_USE_RETAINED_MEM=y harness: console @@ -53,6 +55,7 @@ tests: - nrf54l15dk/nrf54l10/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp extra_configs: - CONFIG_GRTC_WAKEUP_ENABLE=y - CONFIG_GPIO_WAKEUP_ENABLE=n @@ -77,6 +80,7 @@ tests: - nrf54l15dk/nrf54l10/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp extra_configs: - CONFIG_APP_USE_RETAINED_MEM=y - CONFIG_GRTC_WAKEUP_ENABLE=y diff --git a/samples/drivers/audio/dmic/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/samples/drivers/audio/dmic/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay new file mode 100644 index 000000000000..c850cede53d0 --- /dev/null +++ b/samples/drivers/audio/dmic/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + pdm20_default_alt: pdm20_default_alt { + group1 { + psels = , + ; + }; + }; +}; + +dmic_dev: &pdm20 { + status = "okay"; + pinctrl-0 = <&pdm20_default_alt>; + pinctrl-names = "default"; + clock-source = "PCLK32M"; +}; diff --git a/samples/drivers/counter/alarm/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/samples/drivers/counter/alarm/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay new file mode 100644 index 000000000000..0847233437ba --- /dev/null +++ b/samples/drivers/counter/alarm/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -0,0 +1,9 @@ +/ { + chosen { + counter = &timer24; + }; +}; + +&timer24 { + status = "okay"; +}; diff --git a/samples/drivers/mbox/CMakeLists.txt b/samples/drivers/mbox/CMakeLists.txt index 3b154d9afcae..696b2317aa7c 100644 --- a/samples/drivers/mbox/CMakeLists.txt +++ b/samples/drivers/mbox/CMakeLists.txt @@ -28,6 +28,7 @@ if(CONFIG_BOARD_NRF5340DK_NRF5340_CPUAPP OR CONFIG_BOARD_NRF54L09PDK_NRF54L09_CPUAPP OR CONFIG_BOARD_NRF54L15DK_NRF54L15_CPUAPP OR CONFIG_BOARD_NRF54L20PDK_NRF54L20_CPUAPP OR + CONFIG_BOARD_NRF54LM20DK_NRF54LM20A_CPUAPP OR CONFIG_BOARD_STM32H747I_DISCO_STM32H747XX_M7 OR CONFIG_BOARD_BL54L15_DVK_NRF54L15_CPUAPP OR CONFIG_BOARD_BL54L15U_DVK_NRF54L15_CPUAPP) diff --git a/samples/drivers/mbox/Kconfig.sysbuild b/samples/drivers/mbox/Kconfig.sysbuild index 1c0d77b7ded3..97402056c14e 100644 --- a/samples/drivers/mbox/Kconfig.sysbuild +++ b/samples/drivers/mbox/Kconfig.sysbuild @@ -22,6 +22,7 @@ config REMOTE_BOARD default "nrf54l09pdk/nrf54l09/cpuflpr" if $(BOARD) = "nrf54l09pdk" default "nrf54l15dk/nrf54l15/cpuflpr" if $(BOARD) = "nrf54l15dk" default "nrf54l20pdk/nrf54l20/cpuflpr" if $(BOARD) = "nrf54l20pdk" + default "nrf54lm20dk/nrf54lm20a/cpuflpr" if $(BOARD) = "nrf54lm20dk" default "ophelia4ev/cpuflpr" if $(BOARD) = "ophelia4ev" default "stm32h747i_disco/stm32h747xx/m4" if $(BOARD) = "stm32h747i_disco" default "esp32_devkitc/esp32/appcpu" if "$(BOARD)${BOARD_QUALIFIERS}" = "esp32_devkitc/esp32/procpu" diff --git a/samples/drivers/mbox/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/samples/drivers/mbox/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay new file mode 100644 index 000000000000..fd2f23402f5e --- /dev/null +++ b/samples/drivers/mbox/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -0,0 +1,20 @@ +/* + * Copyright 2025 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + mbox-consumer { + compatible = "vnd,mbox-consumer"; + mboxes = <&cpuapp_vevif_rx 20>, <&cpuapp_vevif_tx 21>; + mbox-names = "rx", "tx"; + }; +}; + +&cpuapp_vevif_rx { + status = "okay"; +}; + +&cpuapp_vevif_tx { + status = "okay"; +}; diff --git a/samples/drivers/mbox/remote/CMakeLists.txt b/samples/drivers/mbox/remote/CMakeLists.txt index baa0e22ff359..48df8f0cb5b2 100644 --- a/samples/drivers/mbox/remote/CMakeLists.txt +++ b/samples/drivers/mbox/remote/CMakeLists.txt @@ -27,6 +27,7 @@ if(CONFIG_BOARD_NRF5340DK_NRF5340_CPUNET OR CONFIG_BOARD_NRF54L09PDK_NRF54L09_CPUFLPR OR CONFIG_BOARD_NRF54L15DK_NRF54L15_CPUFLPR OR CONFIG_BOARD_NRF54L20PDK_NRF54L20_CPUFLPR OR + CONFIG_BOARD_NRF54LM20DK_NRF54LM20A_CPUFLPR OR CONFIG_BOARD_STM32H747I_DISCO_STM32H747XX_M4 OR CONFIG_BOARD_BL54L15_DVK_NRF54L15_CPUFLPR OR CONFIG_BOARD_BL54L15U_DVK_NRF54L15_CPUFLPR) diff --git a/samples/drivers/mbox/remote/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay b/samples/drivers/mbox/remote/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay new file mode 100644 index 000000000000..ea88120ad065 --- /dev/null +++ b/samples/drivers/mbox/remote/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay @@ -0,0 +1,24 @@ +/* + * Copyright 2025 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + mbox-consumer { + compatible = "vnd,mbox-consumer"; + mboxes = <&cpuflpr_vevif_rx 21>, <&cpuflpr_vevif_tx 20>; + mbox-names = "rx", "tx"; + }; +}; + +&cpuflpr_vevif_rx { + status = "okay"; +}; + +&cpuflpr_vevif_tx { + status = "okay"; +}; + +&uart30 { + /delete-property/ hw-flow-control; +}; diff --git a/samples/drivers/mbox/sample.yaml b/samples/drivers/mbox/sample.yaml index f1a1e56e771f..1aee77b1c677 100644 --- a/samples/drivers/mbox/sample.yaml +++ b/samples/drivers/mbox/sample.yaml @@ -13,6 +13,7 @@ tests: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp integration_platforms: - nrf5340bsim/nrf5340/cpuapp harness: console @@ -78,6 +79,7 @@ tests: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp integration_platforms: - nrf54l15dk/nrf54l15/cpuapp extra_args: mbox_SNIPPET=nordic-flpr @@ -95,6 +97,7 @@ tests: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp integration_platforms: - nrf54l15dk/nrf54l15/cpuapp extra_args: @@ -115,6 +118,7 @@ tests: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp integration_platforms: - nrf54l15dk/nrf54l15/cpuapp extra_args: diff --git a/samples/drivers/watchdog/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/samples/drivers/watchdog/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay new file mode 100644 index 000000000000..cfb41e09b99e --- /dev/null +++ b/samples/drivers/watchdog/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -0,0 +1,8 @@ +/* + * Copyright 2025 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +&wdt31 { + status = "okay"; +}; diff --git a/samples/drivers/watchdog/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay b/samples/drivers/watchdog/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay new file mode 100644 index 000000000000..cfb41e09b99e --- /dev/null +++ b/samples/drivers/watchdog/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay @@ -0,0 +1,8 @@ +/* + * Copyright 2025 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +&wdt31 { + status = "okay"; +}; diff --git a/tests/boards/nrf/hwinfo/reset_cause/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/boards/nrf/hwinfo/reset_cause/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay new file mode 100644 index 000000000000..dc1ea1a9ddc9 --- /dev/null +++ b/tests/boards/nrf/hwinfo/reset_cause/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&wdt31 { + status = "okay"; +}; diff --git a/tests/boards/nrf/hwinfo/reset_cause/testcase.yaml b/tests/boards/nrf/hwinfo/reset_cause/testcase.yaml index 8837f999bdb1..9fd5911c2846 100644 --- a/tests/boards/nrf/hwinfo/reset_cause/testcase.yaml +++ b/tests/boards/nrf/hwinfo/reset_cause/testcase.yaml @@ -39,5 +39,6 @@ tests: - nrf54h20dk/nrf54h20/cpurad - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp integration_platforms: - nrf54h20dk/nrf54h20/cpuapp diff --git a/tests/boards/nrf/i2c/i2c_slave/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf b/tests/boards/nrf/i2c/i2c_slave/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf new file mode 100644 index 000000000000..b01af3b36a7b --- /dev/null +++ b/tests/boards/nrf/i2c/i2c_slave/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf @@ -0,0 +1 @@ +CONFIG_NRFX_TWIS22=y diff --git a/tests/boards/nrf/i2c/i2c_slave/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/boards/nrf/i2c/i2c_slave/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay new file mode 100644 index 000000000000..029c9830186b --- /dev/null +++ b/tests/boards/nrf/i2c/i2c_slave/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -0,0 +1,67 @@ +/* + * Two loopbacks are required: + * P1.13 - P1.14 + * P1.23 - P1.24 + */ + + +/ { + aliases { + i2c-slave = &i2c22; + }; +}; + +&pinctrl { + i2c21_default_alt: i2c21_default_alt { + group1 { + psels = , + ; + }; + }; + + i2c21_sleep_alt: i2c21_sleep_alt { + group1 { + psels = , + ; + low-power-enable; + }; + }; + + i2c22_default_alt: i2c22_default_alt { + group1 { +/* Temporary workaround as it is currently not possible + * to configure pins for TWIS with pinctrl. + */ + psels = , + ; + bias-pull-up; + }; + }; + + i2c22_sleep_alt: i2c22_sleep_alt { + group1 { + psels = , + ; + low-power-enable; + }; + }; +}; + +dut_twim: &i2c21 { + compatible = "nordic,nrf-twim"; + status = "okay"; + pinctrl-0 = <&i2c21_default_alt>; + pinctrl-1 = <&i2c21_sleep_alt>; + pinctrl-names = "default", "sleep"; + sensor: sensor@54 { + reg = <0x54>; + }; +}; + +&i2c22 { + compatible = "nordic,nrf-twis"; + status = "okay"; + pinctrl-0 = <&i2c22_default_alt>; + pinctrl-1 = <&i2c22_sleep_alt>; + pinctrl-names = "default", "sleep"; +}; diff --git a/tests/boards/nrf/i2c/i2c_slave/testcase.yaml b/tests/boards/nrf/i2c/i2c_slave/testcase.yaml index c264c2f30c80..e125548a49ac 100644 --- a/tests/boards/nrf/i2c/i2c_slave/testcase.yaml +++ b/tests/boards/nrf/i2c/i2c_slave/testcase.yaml @@ -14,6 +14,7 @@ tests: - nrf5340dk/nrf5340/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - nrf54h20dk/nrf54h20/cpuapp - nrf54h20dk/nrf54h20/cpuppr integration_platforms: @@ -28,6 +29,7 @@ tests: - nrf5340dk/nrf5340/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - nrf54h20dk/nrf54h20/cpuapp - nrf54h20dk/nrf54h20/cpuppr integration_platforms: diff --git a/tests/boards/nrf/qdec/boards/nrf54lm20dk_nrf54lm20_common.dtsi b/tests/boards/nrf/qdec/boards/nrf54lm20dk_nrf54lm20_common.dtsi new file mode 100644 index 000000000000..84e7b1dbc30f --- /dev/null +++ b/tests/boards/nrf/qdec/boards/nrf54lm20dk_nrf54lm20_common.dtsi @@ -0,0 +1,60 @@ +/* + * Copyright 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * Two loopbacks are required: + * P1.13 - P1.14 + * P1.23 - P1.24 + */ + +/ { + aliases { + qdec0 = &qdec20; + qenca = &phase_a; + qencb = &phase_b; + }; + + encoder-emulate { + compatible = "gpio-leds"; + phase_a: phase_a { + gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>; + }; + phase_b: phase_b { + gpios = <&gpio1 23 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&pinctrl { + qdec_pinctrl: qdec_pinctrl { + group1 { + psels = , + ; + }; + }; + + qdec_sleep_pinctrl: qdec_sleep_pinctrl { + group1 { + psels = , + ; + low-power-enable; + }; + }; +}; + +&gpio1 { + status = "okay"; +}; + +&qdec20 { + status = "okay"; + pinctrl-0 = <&qdec_pinctrl>; + pinctrl-1 = <&qdec_sleep_pinctrl>; + pinctrl-names = "default", "sleep"; + steps = <127>; + led-pre = <500>; + zephyr,pm-device-runtime-auto; +}; diff --git a/tests/boards/nrf/qdec/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/boards/nrf/qdec/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay new file mode 100644 index 000000000000..646d6b633111 --- /dev/null +++ b/tests/boards/nrf/qdec/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -0,0 +1,6 @@ +/* + * Copyright 2025 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "nrf54lm20dk_nrf54lm20_common.dtsi" diff --git a/tests/boards/nrf/qdec/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay b/tests/boards/nrf/qdec/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay new file mode 100644 index 000000000000..646d6b633111 --- /dev/null +++ b/tests/boards/nrf/qdec/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay @@ -0,0 +1,6 @@ +/* + * Copyright 2025 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "nrf54lm20dk_nrf54lm20_common.dtsi" diff --git a/tests/boards/nrf/qdec/testcase.yaml b/tests/boards/nrf/qdec/testcase.yaml index 1518a86660fc..312761b44596 100644 --- a/tests/boards/nrf/qdec/testcase.yaml +++ b/tests/boards/nrf/qdec/testcase.yaml @@ -6,7 +6,9 @@ common: - nrf54l15dk/nrf54l15/cpuapp - nrf54l15dk/nrf54l15/cpuflpr - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - nrf54l20pdk/nrf54l20/cpuflpr + - nrf54lm20dk/nrf54lm20a/cpuflpr integration_platforms: - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp diff --git a/tests/drivers/adc/adc_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/adc/adc_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay new file mode 100644 index 000000000000..f11e7ea0317c --- /dev/null +++ b/tests/drivers/adc/adc_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -0,0 +1,44 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2025 Nordic Semiconductor ASA + */ + +/ { + zephyr,user { + io-channels = <&adc 0>, <&adc 1> , <&adc 2>; + }; +}; + +&adc { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + channel@0 { + reg = <0>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,input-positive = ; /* P1.31 */ + zephyr,resolution = <10>; + }; + + channel@1 { + reg = <1>; + zephyr,gain = "ADC_GAIN_1_4"; + zephyr,reference = "ADC_REF_EXTERNAL0"; + zephyr,acquisition-time = ; + zephyr,input-positive = ; /* P1.30 */ + zephyr,resolution = <12>; + }; + + channel@2 { + reg = <2>; + zephyr,gain = "ADC_GAIN_2_3"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,input-positive = ; /* P1.06 */ + zephyr,resolution = <10>; + }; +}; diff --git a/tests/drivers/adc/adc_error_cases/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/adc/adc_error_cases/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay new file mode 100644 index 000000000000..c50279ce8f64 --- /dev/null +++ b/tests/drivers/adc/adc_error_cases/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -0,0 +1,15 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2025 Nordic Semiconductor ASA + */ + +/ { + aliases { + adc = &adc; + }; +}; + +&adc { + status = "okay"; +}; diff --git a/tests/drivers/adc/adc_error_cases/testcase.yaml b/tests/drivers/adc/adc_error_cases/testcase.yaml index e5c0225b28c0..f902aa21af02 100644 --- a/tests/drivers/adc/adc_error_cases/testcase.yaml +++ b/tests/drivers/adc/adc_error_cases/testcase.yaml @@ -10,5 +10,6 @@ tests: - nrf52840dk/nrf52840 - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - nrf54h20dk/nrf54h20/cpuapp - ophelia4ev/nrf54l15/cpuapp diff --git a/tests/drivers/audio/dmic_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/audio/dmic_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay new file mode 100644 index 000000000000..ebe43a7c825e --- /dev/null +++ b/tests/drivers/audio/dmic_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* Test requires loopback between P1.23 and P1.24. + * For best performance, PDM_CLK shall be on 'Clock pin'. + */ + +/ { + aliases { + dmic-dev = &pdm20; + }; +}; + +&pinctrl { + pdm20_default_alt: pdm20_default_alt { + group1 { + psels = , + ; + }; + }; +}; + +dmic_dev: &pdm20 { + status = "okay"; + pinctrl-0 = <&pdm20_default_alt>; + pinctrl-names = "default"; + clock-source = "PCLK32M"; +}; diff --git a/tests/drivers/clock_control/clock_control_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf b/tests/drivers/clock_control/clock_control_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf new file mode 100644 index 000000000000..11d42321cbc3 --- /dev/null +++ b/tests/drivers/clock_control/clock_control_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf @@ -0,0 +1 @@ +CONFIG_TEST_NRF_HF_STARTUP_TIME_US=1000 diff --git a/tests/drivers/clock_control/clock_control_api/testcase.yaml b/tests/drivers/clock_control/clock_control_api/testcase.yaml index d624b61fe7c3..98f8920e162a 100644 --- a/tests/drivers/clock_control/clock_control_api/testcase.yaml +++ b/tests/drivers/clock_control/clock_control_api/testcase.yaml @@ -24,6 +24,7 @@ tests: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: - nrf51dk/nrf51822 @@ -35,6 +36,7 @@ tests: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: - nrf51dk/nrf51822 diff --git a/tests/drivers/clock_control/nrf_clock_calibration/testcase.yaml b/tests/drivers/clock_control/nrf_clock_calibration/testcase.yaml index 756a92a98e3e..3cdc785cbc74 100644 --- a/tests/drivers/clock_control/nrf_clock_calibration/testcase.yaml +++ b/tests/drivers/clock_control/nrf_clock_calibration/testcase.yaml @@ -10,6 +10,7 @@ tests: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: - nrf51dk/nrf51822 diff --git a/tests/drivers/clock_control/nrf_lf_clock_start/testcase.yaml b/tests/drivers/clock_control/nrf_lf_clock_start/testcase.yaml index eeb034a8ec0c..94cc046d6963 100644 --- a/tests/drivers/clock_control/nrf_lf_clock_start/testcase.yaml +++ b/tests/drivers/clock_control/nrf_lf_clock_start/testcase.yaml @@ -16,6 +16,7 @@ tests: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp extra_configs: - CONFIG_SYSTEM_CLOCK_WAIT_FOR_STABILITY=y @@ -34,6 +35,7 @@ tests: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp extra_configs: - CONFIG_SYSTEM_CLOCK_WAIT_FOR_AVAILABILITY=y @@ -67,6 +69,7 @@ tests: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: - nrf51dk/nrf51822 @@ -84,6 +87,7 @@ tests: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: - nrf51dk/nrf51822 @@ -101,6 +105,7 @@ tests: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: - nrf51dk/nrf51822 @@ -118,6 +123,7 @@ tests: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: - nrf51dk/nrf51822 @@ -135,6 +141,7 @@ tests: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: - nrf51dk/nrf51822 @@ -152,6 +159,7 @@ tests: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: - nrf51dk/nrf51822 diff --git a/tests/drivers/clock_control/onoff/testcase.yaml b/tests/drivers/clock_control/onoff/testcase.yaml index f24dce72a7a2..51c263dad29a 100644 --- a/tests/drivers/clock_control/onoff/testcase.yaml +++ b/tests/drivers/clock_control/onoff/testcase.yaml @@ -10,6 +10,7 @@ tests: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - nrf9160dk/nrf9160 - ophelia4ev/nrf54l15/cpuapp integration_platforms: diff --git a/tests/drivers/counter/counter_basic_api/boards/nrf54lm20dk_nrf54lm20_common.dtsi b/tests/drivers/counter/counter_basic_api/boards/nrf54lm20dk_nrf54lm20_common.dtsi new file mode 100644 index 000000000000..729416752870 --- /dev/null +++ b/tests/drivers/counter/counter_basic_api/boards/nrf54lm20dk_nrf54lm20_common.dtsi @@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +&timer00 { + prescaler = <6>; + status = "okay"; +}; + +&timer10 { + prescaler = <4>; + status = "okay"; +}; + +&timer20 { + prescaler = <4>; + status = "okay"; +}; + +&timer21 { + prescaler = <4>; + status = "okay"; +}; + +&timer22 { + prescaler = <4>; + status = "okay"; +}; + +&timer23 { + prescaler = <4>; + status = "okay"; +}; + +&timer24 { + prescaler = <4>; + status = "okay"; +}; diff --git a/tests/drivers/counter/counter_basic_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/counter/counter_basic_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay new file mode 100644 index 000000000000..03676317e382 --- /dev/null +++ b/tests/drivers/counter/counter_basic_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -0,0 +1,3 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +#include "nrf54lm20dk_nrf54lm20_common.dtsi" diff --git a/tests/drivers/counter/counter_basic_api/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay b/tests/drivers/counter/counter_basic_api/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay new file mode 100644 index 000000000000..03676317e382 --- /dev/null +++ b/tests/drivers/counter/counter_basic_api/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay @@ -0,0 +1,3 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +#include "nrf54lm20dk_nrf54lm20_common.dtsi" diff --git a/tests/drivers/flash/common/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf b/tests/drivers/flash/common/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf new file mode 100644 index 000000000000..821a5e77e5b5 --- /dev/null +++ b/tests/drivers/flash/common/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf @@ -0,0 +1,4 @@ +CONFIG_FCB=y +CONFIG_FLASH_MAP=y +CONFIG_SETTINGS=y +CONFIG_SETTINGS_FCB=y diff --git a/tests/drivers/flash/common/testcase.yaml b/tests/drivers/flash/common/testcase.yaml index c1adeeeaabad..a46ecb50e11d 100644 --- a/tests/drivers/flash/common/testcase.yaml +++ b/tests/drivers/flash/common/testcase.yaml @@ -47,6 +47,7 @@ tests: - nrf54l15dk/nrf54l10/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - nrf54h20dk/nrf54h20/cpuapp - ophelia4ev/nrf54l15/cpuapp drivers.flash.common.tfm_ns: diff --git a/tests/drivers/flash/negative_tests/testcase.yaml b/tests/drivers/flash/negative_tests/testcase.yaml index 5d2441f002ee..3321a0273ba4 100644 --- a/tests/drivers/flash/negative_tests/testcase.yaml +++ b/tests/drivers/flash/negative_tests/testcase.yaml @@ -8,5 +8,6 @@ tests: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - nrf54h20dk/nrf54h20/cpuapp - ophelia4ev/nrf54l15/cpuapp diff --git a/tests/drivers/gpio/gpio_basic_api/boards/nrf54lm20dk_nrf54lm20_common.overlay b/tests/drivers/gpio/gpio_basic_api/boards/nrf54lm20dk_nrf54lm20_common.overlay new file mode 100644 index 000000000000..bb1ce76c876c --- /dev/null +++ b/tests/drivers/gpio/gpio_basic_api/boards/nrf54lm20dk_nrf54lm20_common.overlay @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + resources { + compatible = "test-gpio-basic-api"; + out-gpios = <&gpio1 30 0>; + in-gpios = <&gpio1 31 0>; + }; +}; + +&gpiote20 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; diff --git a/tests/drivers/gpio/gpio_basic_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/gpio/gpio_basic_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay new file mode 100644 index 000000000000..093894d675a9 --- /dev/null +++ b/tests/drivers/gpio/gpio_basic_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -0,0 +1,7 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "nrf54lm20dk_nrf54lm20_common.overlay" diff --git a/tests/drivers/gpio/gpio_basic_api/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay b/tests/drivers/gpio/gpio_basic_api/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay new file mode 100644 index 000000000000..093894d675a9 --- /dev/null +++ b/tests/drivers/gpio/gpio_basic_api/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay @@ -0,0 +1,7 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "nrf54lm20dk_nrf54lm20_common.overlay" diff --git a/tests/drivers/i2c/i2c_target_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf b/tests/drivers/i2c/i2c_target_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf new file mode 100644 index 000000000000..2510d6673c1b --- /dev/null +++ b/tests/drivers/i2c/i2c_target_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf @@ -0,0 +1 @@ +CONFIG_I2C_NRFX_TWIS_BUF_SIZE=256 diff --git a/tests/drivers/i2c/i2c_target_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/i2c/i2c_target_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay new file mode 100644 index 000000000000..3459599351ba --- /dev/null +++ b/tests/drivers/i2c/i2c_target_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -0,0 +1,68 @@ +/* + * SDA = P1.13 and P1.14 + * SCL = P1.23 and P1.24 + */ + +&pinctrl { + i2c21_default: i2c21_default { + group1 { + psels = , + ; + bias-pull-up; + }; + }; + + i2c21_sleep: i2c21_sleep { + group1 { + psels = , + ; + low-power-enable; + }; + }; + + i2c22_default: i2c22_default { + group1 { + psels = , + ; + bias-pull-up; + }; + }; + + i2c22_sleep: i2c22_sleep { + group1 { + psels = , + ; + low-power-enable; + }; + }; +}; + +&i2c21 { + pinctrl-0 = <&i2c21_default>; + pinctrl-1 = <&i2c21_sleep>; + pinctrl-names = "default", "sleep"; + zephyr,concat-buf-size = <256>; + status = "okay"; + + eeprom1: eeprom@56 { + compatible = "zephyr,i2c-target-eeprom"; + reg = <0x56>; + address-width = <8>; + size = <256>; + }; +}; + +&i2c22 { + compatible = "nordic,nrf-twis"; + pinctrl-0 = <&i2c22_default>; + pinctrl-1 = <&i2c22_sleep>; + pinctrl-names = "default", "sleep"; + status = "okay"; + + eeprom0: eeprom@54 { + compatible = "zephyr,i2c-target-eeprom"; + reg = <0x54>; + address-width = <8>; + size = <256>; + }; +}; diff --git a/tests/drivers/i2c/i2c_target_api/testcase.yaml b/tests/drivers/i2c/i2c_target_api/testcase.yaml index e36ab87d4ef1..7f888f95e123 100644 --- a/tests/drivers/i2c/i2c_target_api/testcase.yaml +++ b/tests/drivers/i2c/i2c_target_api/testcase.yaml @@ -65,6 +65,7 @@ tests: - nrf54h20dk/nrf54h20/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: - max32690evkit/max32690/m4 diff --git a/tests/drivers/i2s/i2s_additional/boards/nrf54lm20pdk_nrf54lm20a_cpuapp.overlay b/tests/drivers/i2s/i2s_additional/boards/nrf54lm20pdk_nrf54lm20a_cpuapp.overlay new file mode 100644 index 000000000000..e93f6df8fd8c --- /dev/null +++ b/tests/drivers/i2s/i2s_additional/boards/nrf54lm20pdk_nrf54lm20a_cpuapp.overlay @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* i2s-node0 is the transmitter/receiver */ + +/ { + aliases { + i2s-node0 = &tdm; + }; +}; + +&pinctrl { + tdm_default_alt: tdm_default_alt { + group1 { + psels = , + , + , + ; + }; + }; +}; + +&tdm { + status = "okay"; + pinctrl-0 = <&tdm_default_alt>; + pinctrl-names = "default"; +}; diff --git a/tests/drivers/i2s/i2s_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/i2s/i2s_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay new file mode 100644 index 000000000000..ef680d4b4105 --- /dev/null +++ b/tests/drivers/i2s/i2s_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* i2s-node0 is the transmitter/receiver */ + +/ { + aliases { + i2s-node0 = &tdm; + }; +}; + +&pinctrl { + tdm_default_alt: tdm_default_alt { + group1 { + psels = , + , + , /* TDM_SDOUT shorted to TDM_SDIN */ + ; + }; + }; +}; + +&tdm { + status = "okay"; + pinctrl-0 = <&tdm_default_alt>; + pinctrl-names = "default"; +}; diff --git a/tests/drivers/i2s/i2s_speed/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/i2s/i2s_speed/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay new file mode 100644 index 000000000000..ef680d4b4105 --- /dev/null +++ b/tests/drivers/i2s/i2s_speed/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* i2s-node0 is the transmitter/receiver */ + +/ { + aliases { + i2s-node0 = &tdm; + }; +}; + +&pinctrl { + tdm_default_alt: tdm_default_alt { + group1 { + psels = , + , + , /* TDM_SDOUT shorted to TDM_SDIN */ + ; + }; + }; +}; + +&tdm { + status = "okay"; + pinctrl-0 = <&tdm_default_alt>; + pinctrl-names = "default"; +}; diff --git a/tests/drivers/retained_mem/api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf b/tests/drivers/retained_mem/api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf new file mode 100644 index 000000000000..c15ba3ed96da --- /dev/null +++ b/tests/drivers/retained_mem/api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf @@ -0,0 +1 @@ +CONFIG_POWEROFF=y diff --git a/tests/drivers/retained_mem/api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/retained_mem/api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay new file mode 100644 index 000000000000..dc81069eca5f --- /dev/null +++ b/tests/drivers/retained_mem/api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -0,0 +1,25 @@ +/ { + cpuapp_sram@2007ec00 { + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0x2007ec00 DT_SIZE_K(4)>; + zephyr,memory-region = "RetainedMem"; + status = "okay"; + + retainedmem0: retainedmem { + compatible = "zephyr,retained-ram"; + status = "okay"; + }; + }; + + aliases { + retainedmemtestdevice = &retainedmem0; + }; +}; + +&cpuapp_sram { + /* Shrink SRAM size to avoid overlap with retained memory region: + * 511 - 4 = 507KB = 0x7ec00 + */ + reg = <0x20000000 DT_SIZE_K(507)>; + ranges = <0x0 0x20000000 0x7ec00>; +}; diff --git a/tests/drivers/retained_mem/api/testcase.yaml b/tests/drivers/retained_mem/api/testcase.yaml index 7852742241b4..ddcc005a16ac 100644 --- a/tests/drivers/retained_mem/api/testcase.yaml +++ b/tests/drivers/retained_mem/api/testcase.yaml @@ -15,6 +15,7 @@ tests: - nrf54l15dk/nrf54l10/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: - qemu_cortex_m3 diff --git a/tests/drivers/sensor/temp_sensor/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/sensor/temp_sensor/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay new file mode 100644 index 000000000000..b1f2a2b9ec59 --- /dev/null +++ b/tests/drivers/sensor/temp_sensor/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +temp_sensor: &temp { + status = "okay"; +}; diff --git a/tests/drivers/spi/spi_controller_peripheral/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/spi/spi_controller_peripheral/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay new file mode 100644 index 000000000000..541fdbb96dee --- /dev/null +++ b/tests/drivers/spi/spi_controller_peripheral/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* Test requires following loopbacks: + * SCK: P1.23 - P1.24 + * MISO: P1.30 - P1.31 + * MOSI: P1.13 - P1.14 + * CS: P1.03 - P1.04 + */ + +&pinctrl { + spi22_default_alt: spi22_default_alt { + group1 { + psels = , + , + ; + }; + }; + + spi22_sleep_alt: spi22_sleep_alt { + group1 { + psels = , + , + ; + low-power-enable; + }; + }; + + spi21_default_alt: spi21_default_alt { + group1 { + psels = , + , + , + ; + }; + }; + + spi21_sleep_alt: spi21_sleep_alt { + group1 { + psels = , + , + , + ; + low-power-enable; + }; + }; +}; + + +&gpio1 { + status = "okay"; +}; + +&spi22 { + status = "okay"; + pinctrl-0 = <&spi22_default_alt>; + pinctrl-1 = <&spi22_sleep_alt>; + pinctrl-names = "default", "sleep"; + overrun-character = <0x00>; + cs-gpios = <&gpio1 3 GPIO_ACTIVE_LOW>; + zephyr,pm-device-runtime-auto; + dut_spi_dt: test-spi-dev@0 { + compatible = "vnd,spi-device"; + reg = <0>; + spi-max-frequency = ; + }; +}; + +dut_spis: &spi21 { + compatible = "nordic,nrf-spis"; + status = "okay"; + def-char = <0x00>; + pinctrl-0 = <&spi21_default_alt>; + pinctrl-1 = <&spi21_sleep_alt>; + pinctrl-names = "default", "sleep"; + /delete-property/rx-delay-supported; + /delete-property/rx-delay; +}; diff --git a/tests/drivers/spi/spi_controller_peripheral/testcase.yaml b/tests/drivers/spi/spi_controller_peripheral/testcase.yaml index c06c1c077fe9..56f3545235e7 100644 --- a/tests/drivers/spi/spi_controller_peripheral/testcase.yaml +++ b/tests/drivers/spi/spi_controller_peripheral/testcase.yaml @@ -10,6 +10,7 @@ common: - nrf52840dk/nrf52840 - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - nrf54h20dk/nrf54h20/cpuapp - nrf54h20dk/nrf54h20/cpurad - nrf54h20dk/nrf54h20/cpuppr @@ -66,6 +67,7 @@ tests: - nrf54h20dk/nrf54h20/cpurad - nrf54h20dk/nrf54h20/cpuppr - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp drivers.spi.spis_fast: @@ -79,6 +81,7 @@ tests: - nrf54h20dk/nrf54h20/cpurad - nrf54h20dk/nrf54h20/cpuppr - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp drivers.spi.pm_runtime: diff --git a/tests/drivers/spi/spi_error_cases/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/spi/spi_error_cases/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay new file mode 100644 index 000000000000..541fdbb96dee --- /dev/null +++ b/tests/drivers/spi/spi_error_cases/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* Test requires following loopbacks: + * SCK: P1.23 - P1.24 + * MISO: P1.30 - P1.31 + * MOSI: P1.13 - P1.14 + * CS: P1.03 - P1.04 + */ + +&pinctrl { + spi22_default_alt: spi22_default_alt { + group1 { + psels = , + , + ; + }; + }; + + spi22_sleep_alt: spi22_sleep_alt { + group1 { + psels = , + , + ; + low-power-enable; + }; + }; + + spi21_default_alt: spi21_default_alt { + group1 { + psels = , + , + , + ; + }; + }; + + spi21_sleep_alt: spi21_sleep_alt { + group1 { + psels = , + , + , + ; + low-power-enable; + }; + }; +}; + + +&gpio1 { + status = "okay"; +}; + +&spi22 { + status = "okay"; + pinctrl-0 = <&spi22_default_alt>; + pinctrl-1 = <&spi22_sleep_alt>; + pinctrl-names = "default", "sleep"; + overrun-character = <0x00>; + cs-gpios = <&gpio1 3 GPIO_ACTIVE_LOW>; + zephyr,pm-device-runtime-auto; + dut_spi_dt: test-spi-dev@0 { + compatible = "vnd,spi-device"; + reg = <0>; + spi-max-frequency = ; + }; +}; + +dut_spis: &spi21 { + compatible = "nordic,nrf-spis"; + status = "okay"; + def-char = <0x00>; + pinctrl-0 = <&spi21_default_alt>; + pinctrl-1 = <&spi21_sleep_alt>; + pinctrl-names = "default", "sleep"; + /delete-property/rx-delay-supported; + /delete-property/rx-delay; +}; diff --git a/tests/drivers/spi/spi_error_cases/testcase.yaml b/tests/drivers/spi/spi_error_cases/testcase.yaml index 2f097fb072c8..8e5ae335edd3 100644 --- a/tests/drivers/spi/spi_error_cases/testcase.yaml +++ b/tests/drivers/spi/spi_error_cases/testcase.yaml @@ -13,6 +13,7 @@ tests: - nrf54l15dk/nrf54l15/cpuapp - nrf54h20dk/nrf54h20/cpuapp - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: - nrf52840dk/nrf52840 diff --git a/tests/drivers/spi/spi_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/spi/spi_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay new file mode 100644 index 000000000000..d6e037cdbdfd --- /dev/null +++ b/tests/drivers/spi/spi_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* Test requires following loopback: + * P1.13 - P1.14 + */ + +&pinctrl { + spi21_default: spi21_default { + group1 { + psels = , + , + ; + }; + }; + + spi21_sleep: spi21_sleep { + group1 { + psels = , + , + ; + low-power-enable; + }; + }; +}; + +&spi21 { + status = "okay"; + pinctrl-0 = <&spi21_default>; + pinctrl-1 = <&spi21_sleep>; + pinctrl-names = "default", "sleep"; + overrun-character = <0x00>; + zephyr,pm-device-runtime-auto; + slow@0 { + compatible = "test-spi-loopback-slow"; + reg = <0>; + spi-max-frequency = ; + }; + dut_fast: fast@0 { + compatible = "test-spi-loopback-fast"; + reg = <0>; + spi-max-frequency = ; + }; +}; + +&gpio1 { + status = "okay"; +}; diff --git a/tests/drivers/spi/spi_loopback/testcase.yaml b/tests/drivers/spi/spi_loopback/testcase.yaml index 6eb098c3dcf6..ab3322a8d1fa 100644 --- a/tests/drivers/spi/spi_loopback/testcase.yaml +++ b/tests/drivers/spi/spi_loopback/testcase.yaml @@ -273,6 +273,7 @@ tests: platform_allow: - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp harness: console harness_config: fixture: spi_loopback @@ -284,18 +285,21 @@ tests: platform_allow: - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp drivers.spi.nrf54l_16mhz: extra_args: EXTRA_DTC_OVERLAY_FILE="boards/nrf_at_16mhz.overlay" platform_allow: - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp drivers.spi.nrf54l_32mhz: extra_args: EXTRA_DTC_OVERLAY_FILE="boards/nrf_at_32mhz.overlay" platform_allow: - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp drivers.spi.ke1xz_flexio_spi.loopback: extra_args: DTC_OVERLAY_FILE="boards/frdm_ke1xz_flexio_spi.overlay" diff --git a/tests/drivers/timer/nrf_grtc_timer/testcase.yaml b/tests/drivers/timer/nrf_grtc_timer/testcase.yaml index ece1358741ab..cd4f99daede0 100644 --- a/tests/drivers/timer/nrf_grtc_timer/testcase.yaml +++ b/tests/drivers/timer/nrf_grtc_timer/testcase.yaml @@ -11,8 +11,11 @@ tests: - nrf54h20dk/nrf54h20/cpurad - nrf54h20dk/nrf54h20/cpuppr - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - nrf54l20pdk/nrf54l20/cpuflpr + - nrf54lm20dk/nrf54lm20a/cpuflpr - ophelia4ev/nrf54l15/cpuapp - ophelia4ev/nrf54l15/cpuflpr integration_platforms: - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp diff --git a/tests/drivers/uart/uart_async_api/boards/nrf54lm20dk_nrf54lm20_common.dtsi b/tests/drivers/uart/uart_async_api/boards/nrf54lm20dk_nrf54lm20_common.dtsi new file mode 100644 index 000000000000..ec39ed93ecf4 --- /dev/null +++ b/tests/drivers/uart/uart_async_api/boards/nrf54lm20dk_nrf54lm20_common.dtsi @@ -0,0 +1,28 @@ +/* Test requires following loopback: + * P1.13 - P1.14 + */ + +&pinctrl { + uart21_default_alt: uart21_default_alt { + group1 { + psels = , + ; + }; + }; + + uart21_sleep_alt: uart21_sleep_alt { + group1 { + psels = , + ; + low-power-enable; + }; + }; +}; + +dut: &uart21 { + status = "okay"; + pinctrl-0 = <&uart21_default_alt>; + pinctrl-1 = <&uart21_sleep_alt>; + pinctrl-names = "default", "sleep"; + current-speed = <115200>; +}; diff --git a/tests/drivers/uart/uart_async_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/uart/uart_async_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay new file mode 100644 index 000000000000..5210e41ef553 --- /dev/null +++ b/tests/drivers/uart/uart_async_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -0,0 +1 @@ +#include "nrf54lm20dk_nrf54lm20_common.dtsi" diff --git a/tests/drivers/uart/uart_async_api/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay b/tests/drivers/uart/uart_async_api/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay new file mode 100644 index 000000000000..5210e41ef553 --- /dev/null +++ b/tests/drivers/uart/uart_async_api/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay @@ -0,0 +1 @@ +#include "nrf54lm20dk_nrf54lm20_common.dtsi" diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20_common.dtsi b/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20_common.dtsi new file mode 100644 index 000000000000..dd9f0b93be04 --- /dev/null +++ b/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20_common.dtsi @@ -0,0 +1,29 @@ +&pinctrl { + uart21_default: uart21_default { + group1 { + psels = , + , + , + ; + }; + }; + + uart21_sleep: uart21_sleep { + group1 { + psels = , + , + , + ; + low-power-enable; + }; + }; +}; + +dut: &uart21 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart21_default>; + pinctrl-1 = <&uart21_sleep>; + pinctrl-names = "default", "sleep"; + hw-flow-control; +}; diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay new file mode 100644 index 000000000000..5210e41ef553 --- /dev/null +++ b/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -0,0 +1 @@ +#include "nrf54lm20dk_nrf54lm20_common.dtsi" diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay b/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay new file mode 100644 index 000000000000..5210e41ef553 --- /dev/null +++ b/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay @@ -0,0 +1 @@ +#include "nrf54lm20dk_nrf54lm20_common.dtsi" diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20a_dual_uart.overlay b/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20a_dual_uart.overlay new file mode 100644 index 000000000000..0dcede29d924 --- /dev/null +++ b/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20a_dual_uart.overlay @@ -0,0 +1,49 @@ +&pinctrl { + uart21_default: uart21_default { + group1 { + psels = , + ; + bias-pull-up; + }; + }; + + uart21_sleep: uart21_sleep { + group1 { + psels = , + ; + low-power-enable; + }; + }; + + uart22_default: uart22_default { + group1 { + psels = , + ; + bias-pull-up; + }; + }; + + uart22_sleep: uart22_sleep { + group1 { + psels = , + ; + low-power-enable; + }; + }; +}; + +dut: &uart21 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart21_default>; + pinctrl-1 = <&uart21_sleep>; + pinctrl-names = "default", "sleep"; +}; + +dut_aux: &uart22 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart22_default>; + pinctrl-1 = <&uart22_sleep>; + pinctrl-names = "default", "sleep"; +}; diff --git a/tests/drivers/uart/uart_elementary/testcase.yaml b/tests/drivers/uart/uart_elementary/testcase.yaml index 9c6fea77b627..83aba78e8282 100644 --- a/tests/drivers/uart/uart_elementary/testcase.yaml +++ b/tests/drivers/uart/uart_elementary/testcase.yaml @@ -16,7 +16,9 @@ tests: - nrf54l15dk/nrf54l15/cpuapp - nrf54l15dk/nrf54l15/cpuflpr - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - nrf54l20pdk/nrf54l20/cpuflpr + - nrf54lm20dk/nrf54lm20a/cpuflpr - nrf5340dk/nrf5340/cpuapp - ophelia4ev/nrf54l15/cpuapp - ophelia4ev/nrf54l15/cpuflpr @@ -57,6 +59,7 @@ tests: platform_allow: - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp extra_args: DTC_OVERLAY_FILE="boards/nrf54l15dk_nrf54l15_cpuapp_dual_uart.overlay" extra_configs: @@ -66,6 +69,7 @@ tests: platform_allow: - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp extra_args: DTC_OVERLAY_FILE="boards/nrf54l15dk_nrf54l15_cpuapp_dual_uart.overlay" extra_configs: @@ -76,6 +80,7 @@ tests: platform_allow: - nrf54l15dk/nrf54l15/cpuflpr - nrf54l20pdk/nrf54l20/cpuflpr + - nrf54lm20dk/nrf54lm20a/cpuflpr - ophelia4ev/nrf54l15/cpuflpr extra_args: DTC_OVERLAY_FILE="boards/nrf54l15dk_nrf54l15_cpuflpr_dual_uart.overlay" extra_configs: @@ -85,6 +90,7 @@ tests: platform_allow: - nrf54l15dk/nrf54l15/cpuflpr - nrf54l20pdk/nrf54l20/cpuflpr + - nrf54lm20dk/nrf54lm20a/cpuflpr - ophelia4ev/nrf54l15/cpuflpr extra_args: DTC_OVERLAY_FILE="boards/nrf54l15dk_nrf54l15_cpuflpr_dual_uart.overlay" extra_configs: diff --git a/tests/drivers/uart/uart_errors/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/uart/uart_errors/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay new file mode 100644 index 000000000000..4cc6508c1d18 --- /dev/null +++ b/tests/drivers/uart/uart_errors/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -0,0 +1,54 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +&pinctrl { + uart21_default: uart21_default { + group1 { + psels = , + ; + }; + }; + + uart21_sleep: uart21_sleep { + group1 { + psels = , + ; + low-power-enable; + }; + }; + + uart22_default: uart22_default { + group1 { + psels = + ; + bias-pull-up; + }; + group2 { + psels = ; + }; + }; + + uart22_sleep: uart22_sleep { + group1 { + psels = , + ; + low-power-enable; + }; + }; +}; + +dut: &uart21 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart21_default>; + pinctrl-1 = <&uart21_sleep>; + pinctrl-names = "default", "sleep"; +}; + +dut_aux: &uart22 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart22_default>; + pinctrl-1 = <&uart22_sleep>; + pinctrl-names = "default", "sleep"; + disable-rx; +}; diff --git a/tests/drivers/uart/uart_errors/testcase.yaml b/tests/drivers/uart/uart_errors/testcase.yaml index d303c73b6004..522935adccaf 100644 --- a/tests/drivers/uart/uart_errors/testcase.yaml +++ b/tests/drivers/uart/uart_errors/testcase.yaml @@ -13,6 +13,7 @@ tests: - nrf54h20dk/nrf54h20/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - nrf5340dk/nrf5340/cpuapp - ophelia4ev/nrf54l15/cpuapp drivers.uart.uart_errors.async: @@ -21,6 +22,7 @@ tests: - nrf54h20dk/nrf54h20/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - nrf5340dk/nrf5340/cpuapp - ophelia4ev/nrf54l15/cpuapp extra_configs: diff --git a/tests/drivers/uart/uart_mix_fifo_poll/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/uart/uart_mix_fifo_poll/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay new file mode 100644 index 000000000000..d335a12e8562 --- /dev/null +++ b/tests/drivers/uart/uart_mix_fifo_poll/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + uart21_default: uart21_default { + group1 { + psels = , + , + , + ; + }; + }; + + uart21_sleep: uart21_sleep { + group1 { + psels = , + , + , + ; + low-power-enable; + }; + }; +}; + +dut: &uart21 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart21_default>; + pinctrl-1 = <&uart21_sleep>; + pinctrl-names = "default", "sleep"; + hw-flow-control; +}; + +counter_dev: &timer00 { + status = "okay"; +}; + +&grtc { + interrupts = <228 2>; +}; diff --git a/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml b/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml index 0ff023748d22..a901abda9e43 100644 --- a/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml +++ b/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml @@ -12,6 +12,7 @@ common: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - nrf54l15bsim/nrf54l15/cpuapp - nrf54h20dk/nrf54h20/cpuapp - nrf54h20dk/nrf54h20/cpurad diff --git a/tests/drivers/uart/uart_pm/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/uart/uart_pm/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay new file mode 100644 index 000000000000..758cb69bd3c5 --- /dev/null +++ b/tests/drivers/uart/uart_pm/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + uart21_default: uart21_default { + group1 { + psels = , + ; + }; + }; + + uart21_sleep: uart21_sleep { + group1 { + psels = , + ; + low-power-enable; + }; + }; +}; + +/ { + chosen { + zephyr,console = &uart20; + }; +}; + +dut: &uart21 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart21_default>; + pinctrl-1 = <&uart21_sleep>; + pinctrl-names = "default", "sleep"; +}; diff --git a/tests/drivers/uart/uart_pm/testcase.yaml b/tests/drivers/uart/uart_pm/testcase.yaml index 329b5546b8b7..9bb360677577 100644 --- a/tests/drivers/uart/uart_pm/testcase.yaml +++ b/tests/drivers/uart/uart_pm/testcase.yaml @@ -8,6 +8,7 @@ common: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - nrf54l15bsim/nrf54l15/cpuapp - nrf54h20dk/nrf54h20/cpuapp - nrf52_bsim @@ -35,6 +36,7 @@ tests: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - nrf54l15bsim/nrf54l15/cpuapp - nrf54h20dk/nrf54h20/cpuapp - nrf52_bsim @@ -50,6 +52,7 @@ tests: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - nrf54h20dk/nrf54h20/cpuapp - ophelia4ev/nrf54l15/cpuapp @@ -70,6 +73,7 @@ tests: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - nrf54h20dk/nrf54h20/cpuapp - ophelia4ev/nrf54l15/cpuapp @@ -90,5 +94,6 @@ tests: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - nrf54h20dk/nrf54h20/cpuapp - ophelia4ev/nrf54l15/cpuapp diff --git a/tests/drivers/watchdog/wdt_basic_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/watchdog/wdt_basic_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay new file mode 100644 index 000000000000..dc1ea1a9ddc9 --- /dev/null +++ b/tests/drivers/watchdog/wdt_basic_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&wdt31 { + status = "okay"; +}; diff --git a/tests/drivers/watchdog/wdt_basic_api/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay b/tests/drivers/watchdog/wdt_basic_api/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay new file mode 100644 index 000000000000..dc1ea1a9ddc9 --- /dev/null +++ b/tests/drivers/watchdog/wdt_basic_api/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&wdt31 { + status = "okay"; +}; diff --git a/tests/drivers/watchdog/wdt_error_cases/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/watchdog/wdt_error_cases/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay new file mode 100644 index 000000000000..dc1ea1a9ddc9 --- /dev/null +++ b/tests/drivers/watchdog/wdt_error_cases/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&wdt31 { + status = "okay"; +}; diff --git a/tests/drivers/watchdog/wdt_error_cases/testcase.yaml b/tests/drivers/watchdog/wdt_error_cases/testcase.yaml index c31e4e7b76dc..951afe9034e0 100644 --- a/tests/drivers/watchdog/wdt_error_cases/testcase.yaml +++ b/tests/drivers/watchdog/wdt_error_cases/testcase.yaml @@ -12,6 +12,7 @@ tests: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - nrf54h20dk/nrf54h20/cpuapp - nrf54h20dk/nrf54h20/cpurad - nrf9280pdk/nrf9280/cpuapp diff --git a/tests/drivers/watchdog/wdt_variables/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/watchdog/wdt_variables/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay new file mode 100644 index 000000000000..dc1ea1a9ddc9 --- /dev/null +++ b/tests/drivers/watchdog/wdt_variables/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&wdt31 { + status = "okay"; +}; diff --git a/tests/drivers/watchdog/wdt_variables/testcase.yaml b/tests/drivers/watchdog/wdt_variables/testcase.yaml index 3ed2ad90b110..d033e4f255e4 100644 --- a/tests/drivers/watchdog/wdt_variables/testcase.yaml +++ b/tests/drivers/watchdog/wdt_variables/testcase.yaml @@ -17,6 +17,7 @@ tests: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: - nrf54l15dk/nrf54l15/cpuapp diff --git a/tests/kernel/timer/timer_behavior/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf b/tests/kernel/timer/timer_behavior/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf new file mode 100644 index 000000000000..4b13bc80c7f3 --- /dev/null +++ b/tests/kernel/timer/timer_behavior/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf @@ -0,0 +1 @@ +CONFIG_SYS_CLOCK_TICKS_PER_SEC=10000 diff --git a/tests/subsys/fs/fcb/testcase.yaml b/tests/subsys/fs/fcb/testcase.yaml index c8351b8dcf21..bd5067ecccec 100644 --- a/tests/subsys/fs/fcb/testcase.yaml +++ b/tests/subsys/fs/fcb/testcase.yaml @@ -15,6 +15,7 @@ tests: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp - native_sim integration_platforms: From 4de017d6d816812dcefb8f540e4cee5c41d739e4 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Mon, 30 Jun 2025 12:16:40 +0200 Subject: [PATCH 0133/2141] [nrf fromtree] soc nrf54lm20a: Fix entropy source MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit nordic,entropy-prng does not exist in Zephyr (it is part of NCS) but we have in both the nordic,nrf-cracen-ctrdrbg which is an actual source of true entropy and works with this SOC. Let's use that instead. Fixes failures to build targeting the nrf54lm20dk any test/sample which uses the entropy driver. Signed-off-by: Alberto Escolar Piedras Signed-off-by: Sebastian Głąb (cherry picked from commit 0903efa88221925ba94d9ca12050ddb3be75ef19) --- dts/arm/nordic/nrf54lm20a_enga_cpuapp.dtsi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dts/arm/nordic/nrf54lm20a_enga_cpuapp.dtsi b/dts/arm/nordic/nrf54lm20a_enga_cpuapp.dtsi index fa5ee3252bf7..dc13fb40d6aa 100644 --- a/dts/arm/nordic/nrf54lm20a_enga_cpuapp.dtsi +++ b/dts/arm/nordic/nrf54lm20a_enga_cpuapp.dtsi @@ -17,7 +17,7 @@ nvic: &cpuapp_nvic {}; / { chosen { - zephyr,entropy = &prng; + zephyr,entropy = &rng; }; soc { @@ -31,9 +31,9 @@ nvic: &cpuapp_nvic {}; status = "disabled"; }; - prng: prng { - compatible = "nordic,entropy-prng"; + rng: rng { status = "okay"; + compatible = "nordic,nrf-cracen-ctrdrbg"; }; }; From 05d5faf2d55560f396567c321f89b46acb026b6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Tue, 1 Jul 2025 11:07:37 +0200 Subject: [PATCH 0134/2141] [nrf fromlist] snippets: nordic-flpr: Fix nRF54LM20A memory layout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes wrongly set memory space for FLPR core. Upstream PR #: 92437 Signed-off-by: Karol Lasończyk Signed-off-by: Sebastian Głąb (cherry picked from commit 101cff9874cb0ce004e193ab7d842665cfa9b574) --- .../nordic-flpr/soc/nrf54lm20a_cpuapp.overlay | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/snippets/nordic-flpr/soc/nrf54lm20a_cpuapp.overlay b/snippets/nordic-flpr/soc/nrf54lm20a_cpuapp.overlay index 1d36ba5ac488..071241cf03d7 100644 --- a/snippets/nordic-flpr/soc/nrf54lm20a_cpuapp.overlay +++ b/snippets/nordic-flpr/soc/nrf54lm20a_cpuapp.overlay @@ -9,22 +9,27 @@ #address-cells = <1>; #size-cells = <1>; - cpuflpr_code_partition: image@1ed000 { + cpuflpr_code_partition: image@1e5000 { /* FLPR core code partition */ - reg = <0x1ed000 DT_SIZE_K(64)>; + reg = <0x1e5000 DT_SIZE_K(96)>; }; }; - cpuflpr_sram_code_data: memory@2006fc00 { + cpuflpr_sram_code_data: memory@20067c00 { compatible = "mmio-sram"; - reg = <0x2006fc00 DT_SIZE_K(64)>; + reg = <0x20067c00 DT_SIZE_K(96)>; #address-cells = <1>; #size-cells = <1>; - ranges = <0x0 0x2006fc00 0x10000>; + ranges = <0x0 0x20067c00 DT_SIZE_K(96)>; }; }; }; +&cpuapp_sram { + reg = <0x20000000 DT_SIZE_K(415)>; + ranges = <0x0 0x20000000 DT_SIZE_K(415)>; +}; + &uart30 { status = "reserved"; }; From 117ae970f79bf156af9175ecc6c98f2a495cbfab Mon Sep 17 00:00:00 2001 From: Kapil Bhatt Date: Tue, 17 Jun 2025 10:48:34 +0000 Subject: [PATCH 0135/2141] [nrf fromtree] doc: networking: Add wifi credentials library document Add document for wifi credentials library, which use to load and store credentials. Signed-off-by: Kapil Bhatt (cherry picked from commit 900a7a915f8d96a18e10c2087b28ca25e18d99f0) --- doc/connectivity/networking/api/net_tech.rst | 1 + .../networking/api/wifi_credentials.rst | 100 ++++++++++++++++++ 2 files changed, 101 insertions(+) create mode 100644 doc/connectivity/networking/api/wifi_credentials.rst diff --git a/doc/connectivity/networking/api/net_tech.rst b/doc/connectivity/networking/api/net_tech.rst index 910ec4e0cce5..616a69921767 100644 --- a/doc/connectivity/networking/api/net_tech.rst +++ b/doc/connectivity/networking/api/net_tech.rst @@ -11,3 +11,4 @@ Networking Technologies thread.rst ppp.rst wifi.rst + wifi_credentials.rst diff --git a/doc/connectivity/networking/api/wifi_credentials.rst b/doc/connectivity/networking/api/wifi_credentials.rst new file mode 100644 index 000000000000..6713f29729bb --- /dev/null +++ b/doc/connectivity/networking/api/wifi_credentials.rst @@ -0,0 +1,100 @@ +.. _lib_wifi_credentials: + +Wi-Fi credentials Library +######################### + +.. contents:: + :local: + :depth: 2 + +The Wi-Fi credentials library provides means to load and store Wi-Fi® network credentials. + +Overview +******** + +This library uses either Zephyr's settings subsystem or Platform Security Architecture (PSA) Internal Trusted Storage (ITS) to store credentials. +It also holds a list of SSIDs in RAM to provide dictionary-like access using SSIDs as keys. + +Configuration +************* + +To use the Wi-Fi credentials library, enable the :kconfig:option:`CONFIG_WIFI_CREDENTIALS` Kconfig option. + +You can pick the backend using the following options: + +* :kconfig:option:`CONFIG_WIFI_CREDENTIALS_BACKEND_PSA` - Default option for non-secure targets, which includes a TF-M partition (non-minimal TF-M profile type). +* :kconfig:option:`CONFIG_WIFI_CREDENTIALS_BACKEND_SETTINGS` - Default option for secure targets. + +To configure the maximum number of networks, use the :kconfig:option:`CONFIG_WIFI_CREDENTIALS_MAX_ENTRIES` Kconfig option. + +The IEEE 802.11 standard does not specify the maximum length of SAE passwords. +To change the default, use the :kconfig:option:`CONFIG_WIFI_CREDENTIALS_SAE_PASSWORD_LENGTH` Kconfig option. + +Adding credentials +****************** + +You can add credentials using the :c:func:`wifi_credentials_set_personal` and :c:func:`wifi_credentials_set_personal_struct` functions. +The former will build the internally used struct from given fields, while the latter takes the struct directly. +If you add credentials with the same SSID twice, the older entry will be overwritten. + +Querying credentials +******************** + +With an SSID, you can query credentials using the :c:func:`wifi_credentials_get_by_ssid_personal` and :c:func:`wifi_credentials_get_by_ssid_personal_struct` functions. + +You can iterate over all stored credentials with the :c:func:`wifi_credentials_for_each_ssid` function. +Deleting or overwriting credentials while iterating is allowed, since these operations do not change internal indices. + +Removing credentials +******************** + +You can remove credentials using the :c:func:`wifi_credentials_delete_by_ssid` function. + +Shell commands +************** + +``wifi cred`` is an extension to the Wi-Fi command line. It adds the following subcommands to interact with the Wi-Fi credentials library: + +.. list-table:: Wi-Fi credentials shell subcommands + :header-rows: 1 + + * - Subcommands + - Description + * - add + - | Add a network to the credentials storage with following parameters: + | <-s --ssid \"\">: SSID. + | [-c --channel]: Channel that needs to be scanned for connection. 0:any channel + | [-b, --band] 0: any band (2:2.4GHz, 5:5GHz, 6:6GHz) + | [-p, --passphrase]: Passphrase (valid only for secure SSIDs) + | [-k, --key-mgmt]: Key management type. + | 0:None, 1:WPA2-PSK, 2:WPA2-PSK-256, 3:SAE-HNP, 4:SAE-H2E, 5:SAE-AUTO, 6:WAPI," + | " 7:EAP-TLS, 8:WEP, 9: WPA-PSK, 10: WPA-Auto-Personal, 11: DPP + | [-w, --ieee-80211w]: MFP (optional: needs security type to be specified) + | : 0:Disable, 1:Optional, 2:Required. + | [-m, --bssid]: MAC address of the AP (BSSID). + | [-t, --timeout]: Duration after which connection attempt needs to fail. + | [-a, --identity]: Identity for enterprise mode. + | [-K, --key-passwd]: Private key passwd for enterprise mode. + | [-h, --help]: Print out the help for the connect command. + * - delete + - Removes network from credentials storage. + * - list + - Lists networks in credential storage. + * - auto_connect + - Automatically connects to any stored network. + +Limitations +*********** + +The library has the following limitations: + +* Although permitted by the IEEE 802.11 standard, this library does not support zero-length SSIDs. +* Wi-Fi Protected Access (WPA) Enterprise credentials are only partially supported. +* The number of networks stored is fixed compile time. + +API documentation +***************** + +The following section provides an overview and reference for the Wi-Fi credentials API available in Zephyr: + +.. doxygengroup:: wifi_credentials From 941422278681e8db7cbccf28e25f047392aebbfe Mon Sep 17 00:00:00 2001 From: Kapil Bhatt Date: Tue, 24 Jun 2025 12:26:47 +0000 Subject: [PATCH 0136/2141] [nrf fromtree] doc: networking: Add doc for EAP methods Add commands to connect with EAP-TTLS and EAP-PEAP security modes. Signed-off-by: Kapil Bhatt (cherry picked from commit 15cf0c518eacdac95e7102f1e1f4e7e78b7d2c3e) --- doc/connectivity/networking/api/wifi.rst | 32 ++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/doc/connectivity/networking/api/wifi.rst b/doc/connectivity/networking/api/wifi.rst index ad7825b5ace4..473bcf8afcae 100644 --- a/doc/connectivity/networking/api/wifi.rst +++ b/doc/connectivity/networking/api/wifi.rst @@ -97,15 +97,43 @@ To facilitate installation of the certificates, a helper script is provided, see The script will install the certificates in the ``rsa2k`` directory to the TLS credentials store in the device over UART and using TLS credentials shell commands. -To initiate Wi-Fi connection, the following command can be used: +To initiate Wi-Fi connection using enterprise security, use one of the following commands depending on the EAP method: + +**EAP-TLS** + +.. code-block:: console + + uart:~$ wifi connect -s -c -k 7 -w 2 -a --key1-pwd --key2-pwd + +**EAP-TTLS-MSCHAPV2** + +.. code-block:: console + + uart:~$ wifi connect -s -c -k 14 -K --eap-id1 --eap-pwd1 -a + +**EAP-PEAP-MSCHAPV2** .. code-block:: console - uart:~$ wifi connect -s -c 149 -k 7 -w 2 -a client1 --key1-pwd whatever --key2-pwd whatever + uart:~$ wifi connect -s -c -k 12 -K --eap-id1 --eap-pwd1 -a Server certificate is also provided in the same directory for testing purposes. Any AAA server can be used for testing purposes, for example, ``FreeRADIUS`` or ``hostapd``. +Certificate requirements for EAP methods +---------------------------------------- + +Different EAP methods require different certificates on the client side: + +* **EAP-TLS**: + Requires both a client certificate (and private key) and the CA certificate on the client. The client authenticates itself to the server using its certificate. + +* **EAP-TTLS-MSCHAPV2**: + Requires only the CA certificate on the client. The client authenticates to the server using a username and password (MSCHAPV2) inside the TLS tunnel. No client certificate is needed. + +* **EAP-PEAP-MSCHAPV2**: + Requires only the CA certificate on the client. Like TTLS, the client uses a username and password (MSCHAPV2) inside the TLS tunnel and does not need a client certificate. + .. note:: The certificates are for testing purposes only and should not be used in production. From 43f25b65d518ff59eaa4e27115db6b395dd93913 Mon Sep 17 00:00:00 2001 From: Kapil Bhatt Date: Wed, 2 Jul 2025 05:39:22 +0000 Subject: [PATCH 0137/2141] [nrf fromtree] doc: networking: Modify the wifi documents Modify the wifi documents for better format. Signed-off-by: Kapil Bhatt (cherry picked from commit 81ba3dfa92f48391dbdef71ea46826433dfa25ce) --- doc/connectivity/networking/api/wifi.rst | 35 ++++++++++--------- .../networking/api/wifi_credentials.rst | 3 +- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/doc/connectivity/networking/api/wifi.rst b/doc/connectivity/networking/api/wifi.rst index 473bcf8afcae..ebf58bb6722e 100644 --- a/doc/connectivity/networking/api/wifi.rst +++ b/doc/connectivity/networking/api/wifi.rst @@ -97,25 +97,25 @@ To facilitate installation of the certificates, a helper script is provided, see The script will install the certificates in the ``rsa2k`` directory to the TLS credentials store in the device over UART and using TLS credentials shell commands. -To initiate Wi-Fi connection using enterprise security, use one of the following commands depending on the EAP method: +To initiate a Wi-Fi connection using enterprise security, use one of the following commands depending on the EAP method: -**EAP-TLS** +* EAP-TLS -.. code-block:: console + .. code-block:: console - uart:~$ wifi connect -s -c -k 7 -w 2 -a --key1-pwd --key2-pwd + uart:~$ wifi connect -s -c -k 7 -w 2 -a --key1-pwd --key2-pwd -**EAP-TTLS-MSCHAPV2** +* EAP-TTLS-MSCHAPV2 -.. code-block:: console + .. code-block:: console - uart:~$ wifi connect -s -c -k 14 -K --eap-id1 --eap-pwd1 -a + uart:~$ wifi connect -s -c -k 14 -K --eap-id1 --eap-pwd1 -a -**EAP-PEAP-MSCHAPV2** +* EAP-PEAP-MSCHAPV2 -.. code-block:: console + .. code-block:: console - uart:~$ wifi connect -s -c -k 12 -K --eap-id1 --eap-pwd1 -a + uart:~$ wifi connect -s -c -k 12 -K --eap-id1 --eap-pwd1 -a Server certificate is also provided in the same directory for testing purposes. Any AAA server can be used for testing purposes, for example, ``FreeRADIUS`` or ``hostapd``. @@ -123,16 +123,17 @@ Any AAA server can be used for testing purposes, for example, ``FreeRADIUS`` or Certificate requirements for EAP methods ---------------------------------------- -Different EAP methods require different certificates on the client side: +Different EAP methods have varying client-side certificate requirements, as outlined below: -* **EAP-TLS**: - Requires both a client certificate (and private key) and the CA certificate on the client. The client authenticates itself to the server using its certificate. +* EAP-TLS - Requires both a client certificate (and its private key) and a CA certificate on the client. + The client authenticates itself to the server using its certificate. -* **EAP-TTLS-MSCHAPV2**: - Requires only the CA certificate on the client. The client authenticates to the server using a username and password (MSCHAPV2) inside the TLS tunnel. No client certificate is needed. +* EAP-TTLS-MSCHAPV2 - Requires only the CA certificate on the client. + The client authenticates to the server using a username and password inside the TLS tunnel. + No client certificate is needed. -* **EAP-PEAP-MSCHAPV2**: - Requires only the CA certificate on the client. Like TTLS, the client uses a username and password (MSCHAPV2) inside the TLS tunnel and does not need a client certificate. +* EAP-PEAP-MSCHAPV2 - Requires only the CA certificate on the client. + Like TTLS, the client uses a username and password inside the TLS tunnel and does not require a client certificate. .. note:: diff --git a/doc/connectivity/networking/api/wifi_credentials.rst b/doc/connectivity/networking/api/wifi_credentials.rst index 6713f29729bb..d13a7d6608bf 100644 --- a/doc/connectivity/networking/api/wifi_credentials.rst +++ b/doc/connectivity/networking/api/wifi_credentials.rst @@ -53,7 +53,8 @@ You can remove credentials using the :c:func:`wifi_credentials_delete_by_ssid` f Shell commands ************** -``wifi cred`` is an extension to the Wi-Fi command line. It adds the following subcommands to interact with the Wi-Fi credentials library: +``wifi cred`` is an extension to the Wi-Fi command line. +It adds the following subcommands to interact with the Wi-Fi credentials library: .. list-table:: Wi-Fi credentials shell subcommands :header-rows: 1 From 76772c89184fdb0b51b49a540fff5dc236754d9b Mon Sep 17 00:00:00 2001 From: Aleksandr Khromykh Date: Mon, 7 Jul 2025 14:12:11 +0200 Subject: [PATCH 0138/2141] [nrf fromlist] bluetooth: mesh: remove persisted psa key if mesh does not own it Commit adds destruction of the persisted in PSA ITS key if mesh does not own it (zero bit in the bitmap of persisted keys). This is not standard mesh behavior, but might happen if something happens between removing key data in mesh and in the crypto library (for example power off in bettwen). Previously, mesh wasn't able to import key with gotten stuck key id. The current fix reproduces more robust behavior. Upstream PR #: 92780 Signed-off-by: Aleksandr Khromykh (cherry picked from commit 2de979d10247b56ad831318641f1b0808b9b18b8) --- subsys/bluetooth/mesh/crypto_psa.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/subsys/bluetooth/mesh/crypto_psa.c b/subsys/bluetooth/mesh/crypto_psa.c index 8d95ed912ec1..dcefb18565cd 100644 --- a/subsys/bluetooth/mesh/crypto_psa.c +++ b/subsys/bluetooth/mesh/crypto_psa.c @@ -452,9 +452,14 @@ int bt_mesh_key_import(enum bt_mesh_key_type type, const uint8_t in[16], struct psa_set_key_bits(&key_attributes, 128); status = psa_import_key(&key_attributes, in, 16, &out->key); - err = status == PSA_SUCCESS ? 0 : - status == PSA_ERROR_ALREADY_EXISTS ? -EALREADY : -EIO; + if (status == PSA_ERROR_ALREADY_EXISTS) { + LOG_WRN("Key with ID 0x%4x already exists (desync between mesh and PSA ITS)", + key_id); + (void)psa_destroy_key(key_id); + status = psa_import_key(&key_attributes, in, 16, &out->key); + } + err = status == PSA_SUCCESS ? 0 : -EIO; if (err && key_id != PSA_KEY_ID_NULL) { keyid_free(key_id); } From f9ace89cf705f1dadf8ddcdb4a9cfc267e3d8078 Mon Sep 17 00:00:00 2001 From: Magdalena Pastula Date: Mon, 7 Jul 2025 17:06:31 +0200 Subject: [PATCH 0139/2141] [nrf fromlist] tests: drivers: mspi: api: make test generic Add definition of MSPI_PORT for other platforms to make the test generic. Upstream PR #: 92790 Signed-off-by: Magdalena Pastula (cherry picked from commit 7830f6cb65cd7fdaa5f7b10b159ed602ed6eac41) --- tests/drivers/mspi/api/src/main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/drivers/mspi/api/src/main.c b/tests/drivers/mspi/api/src/main.c index 883993f9b3e2..148439df6d66 100644 --- a/tests/drivers/mspi/api/src/main.c +++ b/tests/drivers/mspi/api/src/main.c @@ -23,6 +23,8 @@ typedef enum mspi_timing_param mspi_timing_param; typedef struct mspi_ambiq_timing_cfg mspi_timing_cfg; typedef enum mspi_ambiq_timing_param mspi_timing_param; #define MSPI_PORT ((DT_REG_ADDR(MSPI_BUS_NODE) - MSPI0_BASE) / (MSPI1_BASE - MSPI0_BASE)) +#else +#define MSPI_PORT 0 #endif static const struct device *mspi_devices[] = { From c8fe297f3863a6b4f865cb45c12ebc3fea3838cf Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Thu, 12 Jun 2025 12:51:17 +0100 Subject: [PATCH 0140/2141] [nrf fromtree] mgmt: mcumgr: grp: os_mgmt: Add optional boot mode for reset Adds an optional boot mode field which can be used to boot into a specific image or mode using MCUmgr's OS mgmt reset command Signed-off-by: Jamie McCrae (cherry picked from commit 0adcf2e66d2f0ea6fcca179921c6755ccfc2bf15) --- .../mcumgr/grp/os_mgmt/os_mgmt_callbacks.h | 5 ++ subsys/mgmt/mcumgr/grp/os_mgmt/Kconfig | 8 +++ subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c | 54 ++++++++++++++++++- 3 files changed, 65 insertions(+), 2 deletions(-) diff --git a/include/zephyr/mgmt/mcumgr/grp/os_mgmt/os_mgmt_callbacks.h b/include/zephyr/mgmt/mcumgr/grp/os_mgmt/os_mgmt_callbacks.h index c9f7259fa40e..458b70626c35 100644 --- a/include/zephyr/mgmt/mcumgr/grp/os_mgmt/os_mgmt_callbacks.h +++ b/include/zephyr/mgmt/mcumgr/grp/os_mgmt/os_mgmt_callbacks.h @@ -26,6 +26,11 @@ extern "C" { struct os_mgmt_reset_data { /** Contains the value of the force parameter. */ bool force; + +#if defined(CONFIG_MCUMGR_GRP_OS_RESET_BOOT_MODE) || defined(__DOXYGEN__) + /** Contains the value of the boot_mode parameter. */ + uint8_t boot_mode; +#endif }; /** diff --git a/subsys/mgmt/mcumgr/grp/os_mgmt/Kconfig b/subsys/mgmt/mcumgr/grp/os_mgmt/Kconfig index afd2e0d37403..36b727c76201 100644 --- a/subsys/mgmt/mcumgr/grp/os_mgmt/Kconfig +++ b/subsys/mgmt/mcumgr/grp/os_mgmt/Kconfig @@ -43,6 +43,14 @@ config MCUMGR_GRP_OS_RESET_HOOK and will allow the application to perform any required operations before accepting or declining the reset request. +config MCUMGR_GRP_OS_RESET_BOOT_MODE + bool "Boot mode" + depends on RETENTION_BOOT_MODE + help + Allows applications to set the boot mode using the retention boot mode module which + allows for booting other images e.g. as part of a bootloader. This is done with an + optional field in the reset command which specifies the value of the boot mode. + endif config MCUMGR_GRP_OS_TASKSTAT diff --git a/subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c b/subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c index 54ee7e70ed21..360385a1b95c 100644 --- a/subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c +++ b/subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c @@ -55,12 +55,17 @@ #endif #endif +#ifdef CONFIG_MCUMGR_GRP_OS_RESET_BOOT_MODE +#include +#include +#endif + LOG_MODULE_REGISTER(mcumgr_os_grp, CONFIG_MCUMGR_GRP_OS_LOG_LEVEL); #if defined(CONFIG_REBOOT) && defined(CONFIG_MULTITHREADING) static void os_mgmt_reset_work_handler(struct k_work *work); -K_WORK_DELAYABLE_DEFINE(os_mgmt_reset_work, os_mgmt_reset_work_handler); +static K_WORK_DELAYABLE_DEFINE(os_mgmt_reset_work, os_mgmt_reset_work_handler); #endif /* This is passed to zcbor_map_start/end_endcode as a number of @@ -373,18 +378,38 @@ static int os_mgmt_reset(struct smp_streamer *ctxt) int32_t err_rc; uint16_t err_group; +#ifdef CONFIG_MCUMGR_GRP_OS_RESET_BOOT_MODE + uint32_t boot_mode = BOOT_MODE_TYPE_NORMAL; +#endif + struct os_mgmt_reset_data reboot_data = { .force = false }; struct zcbor_map_decode_key_val reset_decode[] = { ZCBOR_MAP_DECODE_KEY_DECODER("force", zcbor_bool_decode, &reboot_data.force), +#ifdef CONFIG_MCUMGR_GRP_OS_RESET_BOOT_MODE + ZCBOR_MAP_DECODE_KEY_DECODER("boot_mode", zcbor_uint32_decode, &boot_mode), +#endif }; /* Since this is a core command, if we fail to decode the data, ignore the error and - * continue with the default parameter of force being false. + * continue with the default parameters. */ (void)zcbor_map_decode_bulk(zsd, reset_decode, ARRAY_SIZE(reset_decode), &decoded); + +#ifdef CONFIG_MCUMGR_GRP_OS_RESET_BOOT_MODE + if (zcbor_map_decode_bulk_key_found(reset_decode, ARRAY_SIZE(reset_decode), "boot_mode")) { + if (boot_mode > UCHAR_MAX) { + return MGMT_ERR_EINVAL; + } + + reboot_data.boot_mode = (uint8_t)boot_mode; + } else { + reboot_data.boot_mode = BOOT_MODE_TYPE_NORMAL; + } +#endif + status = mgmt_callback_notify(MGMT_EVT_OP_OS_MGMT_RESET, &reboot_data, sizeof(reboot_data), &err_rc, &err_group); @@ -398,6 +423,31 @@ static int os_mgmt_reset(struct smp_streamer *ctxt) ok = smp_add_cmd_err(zse, err_group, (uint16_t)err_rc); return ok ? MGMT_ERR_EOK : MGMT_ERR_EMSGSIZE; } +#elif defined(CONFIG_MCUMGR_GRP_OS_RESET_BOOT_MODE) + zcbor_state_t *zsd = ctxt->reader->zs; + size_t decoded; + uint32_t boot_mode; + + struct zcbor_map_decode_key_val reset_decode[] = { + ZCBOR_MAP_DECODE_KEY_DECODER("boot_mode", zcbor_uint32_decode, &boot_mode), + }; + + /* Since this is a core command, if we fail to decode the data, ignore the error and + * continue with the default parameters. + */ + (void)zcbor_map_decode_bulk(zsd, reset_decode, ARRAY_SIZE(reset_decode), &decoded); + + if (zcbor_map_decode_bulk_key_found(reset_decode, ARRAY_SIZE(reset_decode), "boot_mode")) { + if (boot_mode > UCHAR_MAX) { + return MGMT_ERR_EINVAL; + } + } +#endif + +#if defined(CONFIG_MCUMGR_GRP_OS_RESET_BOOT_MODE) + if (zcbor_map_decode_bulk_key_found(reset_decode, ARRAY_SIZE(reset_decode), "boot_mode")) { + (void)bootmode_set((uint8_t)boot_mode); + } #endif #ifdef CONFIG_MULTITHREADING From acf6e051ccfb830a8bfc5fff4a5109e730d171e0 Mon Sep 17 00:00:00 2001 From: Tomasz Chyrowicz Date: Mon, 7 Jul 2025 16:03:30 +0200 Subject: [PATCH 0141/2141] [nrf fromlist] soc: Enable radio core if BT is selected Automatically enable booting radio core if BT HCI interface is enabled. Upstream PR #: 92787 Signed-off-by: Tomasz Chyrowicz (cherry picked from commit b48277124014f0394e8f2566ba4eb5fa0b0edd08) --- soc/nordic/nrf54h/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soc/nordic/nrf54h/Kconfig b/soc/nordic/nrf54h/Kconfig index c0e619cd1e2d..ed9fc86f2fc9 100644 --- a/soc/nordic/nrf54h/Kconfig +++ b/soc/nordic/nrf54h/Kconfig @@ -69,7 +69,7 @@ config SOC_NRF54H20_CPURAD_COMMON config SOC_NRF54H20_CPURAD_ENABLE bool "Boot the nRF54H20 Radio core" - default y if NRF_802154_SER_HOST + default y if NRF_802154_SER_HOST || BT_HCI_HOST depends on SOC_NRF54H20_CPUAPP select NRF_IRONSIDE_CPUCONF_SERVICE help From a0036ce12512bfb3edb095a41bb39ddebb3c1c92 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Wed, 18 Jun 2025 22:01:39 +0300 Subject: [PATCH 0142/2141] [nrf fromtree] Bluetooth: Host: Introduce bt_hci_cmd_alloc() Introduce a new bt_hci_cmd_alloc() API which only allocates a command buffer and reserves sufficient headroom for H:4 and command headers, but doesn't actually encode any of those headers into the buffer. Additionally, modify bt_hci_cmd_send() and bt_hci_cmd_send_sync() so that they handle such buffers and perform the header encoding correctly. To avoid duplication, bt_hci_cmd_send_sync() now builds upon (i.e. calls internally) the bt_hci_cmd_send() API. Signed-off-by: Johan Hedberg (cherry picked from commit b530b261d9620bccc3d5e5693bc2051b60c395a4) --- include/zephyr/bluetooth/hci.h | 14 ++++++++ subsys/bluetooth/host/hci_core.c | 60 +++++++++++++++++++++++++------- 2 files changed, 61 insertions(+), 13 deletions(-) diff --git a/include/zephyr/bluetooth/hci.h b/include/zephyr/bluetooth/hci.h index 590ea55a84ac..dd9c60c8ae80 100644 --- a/include/zephyr/bluetooth/hci.h +++ b/include/zephyr/bluetooth/hci.h @@ -63,6 +63,20 @@ static inline const char *bt_hci_err_to_str(uint8_t hci_err) */ struct net_buf *bt_hci_cmd_create(uint16_t opcode, uint8_t param_len); +/** Allocate an HCI command buffer. + * + * This function allocates a new buffer for an HCI command. Upon successful + * return the buffer is ready to have the command parameters encoded into it. + * Sufficient headroom gets automatically reserved in the buffer, allowing + * the actual command and H:4 headers to be encoded later, as part of + * calling bt_hci_cmd_send() or bt_hci_cmd_send_sync(). + * + * @param timeout Timeout for the allocation. + * + * @return Newly allocated buffer or NULL if allocation failed. + */ +struct net_buf *bt_hci_cmd_alloc(k_timeout_t timeout); + /** Send a HCI command asynchronously. * * This function is used for sending a HCI command asynchronously. It can diff --git a/subsys/bluetooth/host/hci_core.c b/subsys/bluetooth/host/hci_core.c index 335fdc642a34..6742a2fc7abc 100644 --- a/subsys/bluetooth/host/hci_core.c +++ b/subsys/bluetooth/host/hci_core.c @@ -351,8 +351,27 @@ struct net_buf *bt_hci_cmd_create(uint16_t opcode, uint8_t param_len) LOG_DBG("opcode 0x%04x param_len %u", opcode, param_len); - /* net_buf_alloc(K_FOREVER) can fail when run from the syswq */ - buf = net_buf_alloc(&hci_cmd_pool, K_FOREVER); + buf = bt_hci_cmd_alloc(K_FOREVER); + if (!buf) { + return NULL; + } + + LOG_DBG("buf %p", buf); + + hdr = net_buf_push(buf, sizeof(*hdr)); + hdr->opcode = sys_cpu_to_le16(opcode); + hdr->param_len = param_len; + + net_buf_push_u8(buf, BT_HCI_H4_CMD); + + return buf; +} + +struct net_buf *bt_hci_cmd_alloc(k_timeout_t timeout) +{ + struct net_buf *buf; + + buf = net_buf_alloc(&hci_cmd_pool, timeout); if (!buf) { LOG_DBG("Unable to allocate a command buffer"); return NULL; @@ -360,29 +379,41 @@ struct net_buf *bt_hci_cmd_create(uint16_t opcode, uint8_t param_len) LOG_DBG("buf %p", buf); - net_buf_add_u8(buf, BT_HCI_H4_CMD); + /* Reserve H:4 header and HCI command header */ + net_buf_reserve(buf, sizeof(uint8_t) + sizeof(struct bt_hci_cmd_hdr)); - cmd(buf)->opcode = opcode; + cmd(buf)->opcode = 0; cmd(buf)->sync = NULL; cmd(buf)->state = NULL; - hdr = net_buf_add(buf, sizeof(*hdr)); - hdr->opcode = sys_cpu_to_le16(opcode); - hdr->param_len = param_len; - return buf; } int bt_hci_cmd_send(uint16_t opcode, struct net_buf *buf) { + struct bt_hci_cmd_hdr *hdr; + if (!buf) { - buf = bt_hci_cmd_create(opcode, 0); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } } - LOG_DBG("opcode 0x%04x len %u", opcode, buf->len); + LOG_DBG("opcode 0x%04x param_len %u", opcode, buf->len); + + cmd(buf)->opcode = opcode; + + /* TODO: Remove this condition when bt_hci_cmd_create() has been removed (after its + * deprecation period) + */ + if (net_buf_headroom(buf) >= sizeof(uint8_t) + sizeof(*hdr)) { + hdr = net_buf_push(buf, sizeof(*hdr)); + hdr->opcode = sys_cpu_to_le16(opcode); + hdr->param_len = buf->len - sizeof(*hdr); + + net_buf_push_u8(buf, BT_HCI_H4_CMD); + } /* Host Number of Completed Packets can ignore the ncmd value * and does not generate any cmd complete/status events. @@ -414,7 +445,7 @@ int bt_hci_cmd_send_sync(uint16_t opcode, struct net_buf *buf, int err; if (!buf) { - buf = bt_hci_cmd_create(opcode, 0); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -435,8 +466,11 @@ int bt_hci_cmd_send_sync(uint16_t opcode, struct net_buf *buf, k_sem_init(&sync_sem, 0, 1); cmd(buf)->sync = &sync_sem; - k_fifo_put(&bt_dev.cmd_tx_queue, net_buf_ref(buf)); - bt_tx_irq_raise(); + err = bt_hci_cmd_send(opcode, net_buf_ref(buf)); + if (err) { + net_buf_unref(buf); + return err; + } /* TODO: disallow sending sync commands from syswq altogether */ From bd698bf422b26ee8db9782a06d68334686e81c8c Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Wed, 18 Jun 2025 22:04:45 +0300 Subject: [PATCH 0143/2141] [nrf fromtree] Bluetooth: Host: CS: Fix test HCI command encoding The command buffer was incorrectly encoded due to the recent change to H:4 encoding. Instead of fixing the header offset, just use the newly introduced bt_hci_cmd_alloc() API, since that takes care of correctly encoding the command header when it gets sent. Signed-off-by: Johan Hedberg (cherry picked from commit 6c61c8c42850e9069eb8dbcc5b50d467245632da) --- subsys/bluetooth/host/cs.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/subsys/bluetooth/host/cs.c b/subsys/bluetooth/host/cs.c index ec274f7ab9f9..a7bdefa77a12 100644 --- a/subsys/bluetooth/host/cs.c +++ b/subsys/bluetooth/host/cs.c @@ -522,7 +522,7 @@ int bt_le_cs_start_test(const struct bt_le_cs_test_param *params) struct bt_hci_op_le_cs_test *cp; struct net_buf *buf; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_CS_TEST, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -617,10 +617,6 @@ int bt_le_cs_start_test(const struct bt_le_cs_test_param *params) cp->override_parameters_length = override_parameters_length; - struct bt_hci_cmd_hdr *hdr = (struct bt_hci_cmd_hdr *)buf->data; - - hdr->param_len += override_parameters_length; - return bt_hci_cmd_send_sync(BT_HCI_OP_LE_CS_TEST, buf, NULL); } #endif /* CONFIG_BT_CHANNEL_SOUNDING_TEST */ From 4276146948cd29be8bca54b5489c276ecfad871e Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Thu, 19 Jun 2025 03:03:49 +0300 Subject: [PATCH 0144/2141] [nrf fromtree] Bluetooth: Host: core: Use bt_hci_cmd_alloc() Use bt_hci_cmd_alloc() instead of the soon to be deprecated bt_hci_cmd_create(). Signed-off-by: Johan Hedberg (cherry picked from commit 2ea960538074d9db1767232c3a815f8efdbc0976) --- subsys/bluetooth/host/hci_core.c | 69 +++++++++++++------------------- 1 file changed, 28 insertions(+), 41 deletions(-) diff --git a/subsys/bluetooth/host/hci_core.c b/subsys/bluetooth/host/hci_core.c index 6742a2fc7abc..3a866c6346d6 100644 --- a/subsys/bluetooth/host/hci_core.c +++ b/subsys/bluetooth/host/hci_core.c @@ -268,8 +268,7 @@ void bt_send_one_host_num_completed_packets(uint16_t handle) LOG_DBG("Reporting completed packet for handle %u", handle); - buf = bt_hci_cmd_create(BT_HCI_OP_HOST_NUM_COMPLETED_PACKETS, - sizeof(*cp) + sizeof(*hc)); + buf = bt_hci_cmd_alloc(K_FOREVER); BT_ASSERT_MSG(buf, "Unable to alloc for Host NCP"); cp = net_buf_add(buf, sizeof(*cp)); @@ -326,8 +325,7 @@ void bt_hci_host_num_completed_packets(struct net_buf *buf) LOG_DBG("Reporting completed packet for handle %u", handle); - buf = bt_hci_cmd_create(BT_HCI_OP_HOST_NUM_COMPLETED_PACKETS, - sizeof(*cp) + sizeof(*hc)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { LOG_ERR("Unable to allocate new HCI command"); return; @@ -778,8 +776,7 @@ int bt_le_create_conn_ext(const struct bt_conn *conn) ((bt_dev.create_param.options & BT_CONN_LE_OPT_CODED) ? 1 : 0); - buf = bt_hci_cmd_create(BT_HCI_OP_LE_EXT_CREATE_CONN, sizeof(*cp) + - num_phys * sizeof(*phy)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -849,7 +846,7 @@ int bt_le_create_conn_synced(const struct bt_conn *conn, const struct bt_le_ext_ } /* There shall only be one Initiating_PHYs */ - buf = bt_hci_cmd_create(BT_HCI_OP_LE_EXT_CREATE_CONN_V2, sizeof(*cp) + sizeof(*phy)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -899,7 +896,7 @@ static int bt_le_create_conn_legacy(const struct bt_conn *conn) return err; } - buf = bt_hci_cmd_create(BT_HCI_OP_LE_CREATE_CONN, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -954,7 +951,7 @@ int bt_le_create_conn_cancel(void) struct net_buf *buf; struct bt_hci_cmd_state_set state; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_CREATE_CONN_CANCEL, 0); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -971,7 +968,7 @@ int bt_hci_disconnect(uint16_t handle, uint8_t reason) struct net_buf *buf; struct bt_hci_cp_disconnect *disconn; - buf = bt_hci_cmd_create(BT_HCI_OP_DISCONNECT, sizeof(*disconn)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -1109,8 +1106,7 @@ int bt_hci_le_read_remote_features(struct bt_conn *conn) struct bt_hci_cp_le_read_remote_features *cp; struct net_buf *buf; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_READ_REMOTE_FEATURES, - sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -1135,8 +1131,7 @@ int bt_hci_read_remote_version(struct bt_conn *conn) return 0; } - buf = bt_hci_cmd_create(BT_HCI_OP_READ_REMOTE_VERSION_INFO, - sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -1156,7 +1151,7 @@ int bt_le_set_data_len(struct bt_conn *conn, uint16_t tx_octets, uint16_t tx_tim struct bt_hci_cp_le_set_data_len *cp; struct net_buf *buf; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_DATA_LEN, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -1177,7 +1172,7 @@ static int hci_le_read_phy(struct bt_conn *conn) struct net_buf *buf, *rsp; int err; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_READ_PHY, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -1205,7 +1200,7 @@ int bt_le_set_phy(struct bt_conn *conn, uint8_t all_phys, struct bt_hci_cp_le_set_phy *cp; struct net_buf *buf; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_PHY, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -1908,8 +1903,7 @@ static void le_conn_param_neg_reply(uint16_t handle, uint8_t reason) struct bt_hci_cp_le_conn_param_req_neg_reply *cp; struct net_buf *buf; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_CONN_PARAM_REQ_NEG_REPLY, - sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { LOG_ERR("Unable to allocate buffer"); return; @@ -1928,7 +1922,7 @@ static int le_conn_param_req_reply(uint16_t handle, struct bt_hci_cp_le_conn_param_req_reply *cp; struct net_buf *buf; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_CONN_PARAM_REQ_REPLY, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -2063,8 +2057,7 @@ static int set_flow_control(void) return 0; } - buf = bt_hci_cmd_create(BT_HCI_OP_HOST_BUFFER_SIZE, - sizeof(*hbs)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -2079,7 +2072,7 @@ static int set_flow_control(void) return err; } - buf = bt_hci_cmd_create(BT_HCI_OP_SET_CTL_TO_HOST_FLOW, 1); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -2403,7 +2396,7 @@ static void le_ltk_neg_reply(uint16_t handle) struct bt_hci_cp_le_ltk_req_neg_reply *cp; struct net_buf *buf; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_LTK_REQ_NEG_REPLY, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { LOG_ERR("Out of command buffers"); @@ -2421,8 +2414,7 @@ static void le_ltk_reply(uint16_t handle, uint8_t *ltk) struct bt_hci_cp_le_ltk_req_reply *cp; struct net_buf *buf; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_LTK_REQ_REPLY, - sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { LOG_ERR("Out of command buffers"); return; @@ -3257,7 +3249,7 @@ static int le_set_host_feature(uint8_t bit_number, uint8_t bit_value) struct bt_hci_cp_le_set_host_feature *cp; struct net_buf *buf; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_HOST_FEATURE, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -3384,7 +3376,7 @@ static int le_set_event_mask(void) uint64_t mask = 0U; /* Set LE event mask */ - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_EVENT_MASK, sizeof(*cp_mask)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -3638,8 +3630,7 @@ static int le_init(void) #endif /* CONFIG_BT_BROADCASTER */ if (BT_FEAT_BREDR(bt_dev.features)) { - buf = bt_hci_cmd_create(BT_HCI_OP_LE_WRITE_LE_HOST_SUPP, - sizeof(*cp_le)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -3680,8 +3671,7 @@ static int le_init(void) return err; } - buf = bt_hci_cmd_create(BT_HCI_OP_LE_WRITE_DEFAULT_DATA_LEN, - sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -3702,8 +3692,7 @@ static int le_init(void) #if defined(CONFIG_BT_PRIVACY) struct bt_hci_cp_le_set_rpa_timeout *cp; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_RPA_TIMEOUT, - sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -3798,7 +3787,7 @@ static int set_event_mask(void) struct net_buf *buf; uint64_t mask = 0U; - buf = bt_hci_cmd_create(BT_HCI_OP_SET_EVENT_MASK, sizeof(*ev)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -4652,7 +4641,7 @@ int bt_le_filter_accept_list_add(const bt_addr_le_t *addr) return -EAGAIN; } - buf = bt_hci_cmd_create(BT_HCI_OP_LE_ADD_DEV_TO_FAL, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -4680,7 +4669,7 @@ int bt_le_filter_accept_list_remove(const bt_addr_le_t *addr) return -EAGAIN; } - buf = bt_hci_cmd_create(BT_HCI_OP_LE_REM_DEV_FROM_FAL, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -4730,8 +4719,7 @@ int bt_le_set_chan_map(uint8_t chan_map[5]) return -ENOTSUP; } - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_HOST_CHAN_CLASSIF, - sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -4772,8 +4760,7 @@ int bt_configure_data_path(uint8_t dir, uint8_t id, uint8_t vs_config_len, struct net_buf *buf; int err; - buf = bt_hci_cmd_create(BT_HCI_OP_CONFIGURE_DATA_PATH, sizeof(*cp) + - vs_config_len); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } From a813bd28a864a6d3ace2087b2340d3bd36c99f0c Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Thu, 19 Jun 2025 03:44:37 +0300 Subject: [PATCH 0145/2141] [nrf fromtree] Bluetooth: Host: adv: Use bt_hci_cmd_alloc() Use bt_hci_cmd_alloc() instead of the soon to be deprecated bt_hci_cmd_create(). Signed-off-by: Johan Hedberg (cherry picked from commit 47fa056fb6ef801fa4fff228ba1f613f5ef91ab5) --- subsys/bluetooth/host/adv.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/subsys/bluetooth/host/adv.c b/subsys/bluetooth/host/adv.c index 0694c2ce54b3..25a538614e3a 100644 --- a/subsys/bluetooth/host/adv.c +++ b/subsys/bluetooth/host/adv.c @@ -335,7 +335,7 @@ int bt_le_adv_set_enable_legacy(struct bt_le_ext_adv *adv, bool enable) struct bt_hci_cmd_state_set state; int err; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_ADV_ENABLE, 1); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -364,7 +364,7 @@ int bt_le_adv_set_enable_ext(struct bt_le_ext_adv *adv, struct bt_hci_cmd_state_set state; int err; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_EXT_ADV_ENABLE, 6); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -551,7 +551,7 @@ static int hci_set_ad(uint16_t hci_op, const struct bt_ad *ad, size_t ad_len) struct net_buf *buf; int err; - buf = bt_hci_cmd_create(hci_op, sizeof(*set_data)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -585,7 +585,7 @@ static int hci_set_adv_ext_complete(struct bt_le_ext_adv *adv, uint16_t hci_op, cmd_size = sizeof(*set_data) + total_data_len; - buf = bt_hci_cmd_create(hci_op, cmd_size); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -625,7 +625,7 @@ static int hci_set_adv_ext_fragmented(struct bt_le_ext_adv *adv, uint16_t hci_op const size_t data_len = MIN(BT_HCI_LE_EXT_ADV_FRAG_MAX_LEN, stream.remaining_size); const size_t cmd_size = sizeof(*set_data) + data_len; - buf = bt_hci_cmd_create(hci_op, cmd_size); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -738,7 +738,7 @@ static int hci_set_per_adv_data(const struct bt_le_ext_adv *adv, const size_t data_len = MIN(BT_HCI_LE_PER_ADV_FRAG_MAX_LEN, stream.remaining_size); const size_t cmd_size = sizeof(*set_data) + data_len; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_PER_ADV_DATA, cmd_size); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -1056,7 +1056,7 @@ int bt_le_adv_start_legacy(struct bt_le_ext_adv *adv, set_param.type = BT_HCI_ADV_NONCONN_IND; } - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_ADV_PARAM, sizeof(set_param)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -1168,7 +1168,7 @@ static int le_ext_adv_param_set(struct bt_le_ext_adv *adv, size = sizeof(struct bt_hci_cp_le_set_ext_adv_param); } - buf = bt_hci_cmd_create(opcode, size); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -1821,7 +1821,7 @@ int bt_le_ext_adv_delete(struct bt_le_ext_adv *adv) return -EINVAL; } - buf = bt_hci_cmd_create(BT_HCI_OP_LE_REMOVE_ADV_SET, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { LOG_WRN("No HCI buffers"); return -ENOBUFS; @@ -1920,7 +1920,7 @@ int bt_le_per_adv_set_param(struct bt_le_ext_adv *adv, return -ENOTSUP; } - buf = bt_hci_cmd_create(opcode, size); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -2029,7 +2029,7 @@ int bt_le_per_adv_set_subevent_data(const struct bt_le_ext_adv *adv, uint8_t num return -EINVAL; } - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_PER_ADV_SUBEVENT_DATA, (uint8_t)cmd_length); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -2076,7 +2076,7 @@ static int bt_le_per_adv_enable(struct bt_le_ext_adv *adv, bool enable) return -EALREADY; } - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_PER_ADV_ENABLE, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -2230,8 +2230,7 @@ int bt_le_per_adv_set_info_transfer(const struct bt_le_ext_adv *adv, return -ENOTSUP; } - buf = bt_hci_cmd_create(BT_HCI_OP_LE_PER_ADV_SET_INFO_TRANSFER, - sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } From 1d58fa2bbf3e31d061035479d72a8138e429f88e Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Thu, 19 Jun 2025 03:47:48 +0300 Subject: [PATCH 0146/2141] [nrf fromtree] Bluetooth: Host: Classic: Use bt_hci_cmd_alloc() Use bt_hci_cmd_alloc() instead of the soon to be deprecated bt_hci_cmd_create(). Signed-off-by: Johan Hedberg (cherry picked from commit fa0aece2fa7c5c65ac567950044a0f21f07f9070) --- subsys/bluetooth/host/classic/br.c | 38 ++++++++++++------------- subsys/bluetooth/host/classic/conn_br.c | 4 +-- subsys/bluetooth/host/classic/sco.c | 4 +-- subsys/bluetooth/host/classic/ssp.c | 25 ++++++++-------- 4 files changed, 34 insertions(+), 37 deletions(-) diff --git a/subsys/bluetooth/host/classic/br.c b/subsys/bluetooth/host/classic/br.c index abbd345b44b1..994fcfbd22c7 100644 --- a/subsys/bluetooth/host/classic/br.c +++ b/subsys/bluetooth/host/classic/br.c @@ -41,7 +41,7 @@ static int reject_conn(const bt_addr_t *bdaddr, uint8_t reason) struct net_buf *buf; int err; - buf = bt_hci_cmd_create(BT_HCI_OP_REJECT_CONN_REQ, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -64,7 +64,7 @@ static int accept_conn(const bt_addr_t *bdaddr) struct net_buf *buf; int err; - buf = bt_hci_cmd_create(BT_HCI_OP_ACCEPT_CONN_REQ, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -118,7 +118,7 @@ static bool br_sufficient_key_size(struct bt_conn *conn) uint8_t key_size; int err; - buf = bt_hci_cmd_create(BT_HCI_OP_READ_ENCRYPTION_KEY_SIZE, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { LOG_ERR("Failed to allocate command buffer"); return false; @@ -254,7 +254,7 @@ void bt_hci_conn_complete(struct net_buf *buf) bt_conn_unref(conn); - buf = bt_hci_cmd_create(BT_HCI_OP_READ_REMOTE_FEATURES, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return; } @@ -270,7 +270,7 @@ static int request_name(const bt_addr_t *addr, uint8_t pscan, uint16_t offset) struct bt_hci_cp_remote_name_request *cp; struct net_buf *buf; - buf = bt_hci_cmd_create(BT_HCI_OP_REMOTE_NAME_REQUEST, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -637,7 +637,7 @@ void bt_hci_read_remote_features_complete(struct net_buf *buf) goto done; } - buf = bt_hci_cmd_create(BT_HCI_OP_READ_REMOTE_EXT_FEATURES, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { goto done; } @@ -711,7 +711,7 @@ static int read_ext_features(void) struct net_buf *buf, *rsp; int err; - buf = bt_hci_cmd_create(BT_HCI_OP_READ_LOCAL_EXT_FEATURES, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -800,7 +800,6 @@ int bt_br_init(void) struct bt_hci_cp_write_ssp_mode *ssp_cp; struct bt_hci_cp_write_inquiry_mode *inq_cp; struct bt_hci_write_local_name *name_cp; - struct bt_hci_cp_write_class_of_device *cod; int err; /* Read extended local features */ @@ -824,7 +823,7 @@ int bt_br_init(void) net_buf_unref(buf); /* Set SSP mode */ - buf = bt_hci_cmd_create(BT_HCI_OP_WRITE_SSP_MODE, sizeof(*ssp_cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -837,7 +836,7 @@ int bt_br_init(void) } /* Enable Inquiry results with RSSI or extended Inquiry */ - buf = bt_hci_cmd_create(BT_HCI_OP_WRITE_INQUIRY_MODE, sizeof(*inq_cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -850,7 +849,7 @@ int bt_br_init(void) } /* Set local name */ - buf = bt_hci_cmd_create(BT_HCI_OP_WRITE_LOCAL_NAME, sizeof(*name_cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -864,7 +863,7 @@ int bt_br_init(void) } /* Set Class of device */ - buf = bt_hci_cmd_create(BT_HCI_OP_WRITE_CLASS_OF_DEVICE, sizeof(*cod)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -877,7 +876,7 @@ int bt_br_init(void) } /* Set page timeout*/ - buf = bt_hci_cmd_create(BT_HCI_OP_WRITE_PAGE_TIMEOUT, sizeof(uint16_t)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -893,7 +892,7 @@ int bt_br_init(void) if (BT_FEAT_SC(bt_dev.features)) { struct bt_hci_cp_write_sc_host_supp *sc_cp; - buf = bt_hci_cmd_create(BT_HCI_OP_WRITE_SC_HOST_SUPP, sizeof(*sc_cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -916,7 +915,7 @@ static int br_start_inquiry(const struct bt_br_discovery_param *param) struct bt_hci_op_inquiry *cp; struct net_buf *buf; - buf = bt_hci_cmd_create(BT_HCI_OP_INQUIRY, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -1005,7 +1004,7 @@ int bt_br_discovery_stop(void) continue; } - buf = bt_hci_cmd_create(BT_HCI_OP_REMOTE_NAME_CANCEL, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { continue; } @@ -1042,7 +1041,7 @@ static int write_scan_enable(uint8_t scan) LOG_DBG("type %u", scan); - buf = bt_hci_cmd_create(BT_HCI_OP_WRITE_SCAN_ENABLE, 1); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -1090,7 +1089,7 @@ static int bt_br_write_current_iac_lap(bool limited) param_len = sizeof(*iac_lap) + (num_current_iac * sizeof(struct bt_hci_iac_lap)); - buf = bt_hci_cmd_create(BT_HCI_OP_WRITE_CURRENT_IAC_LAP, param_len); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -1142,8 +1141,7 @@ static int bt_br_write_cod(uint32_t cod) struct net_buf *buf; /* Set Class of device */ - buf = bt_hci_cmd_create(BT_HCI_OP_WRITE_CLASS_OF_DEVICE, - sizeof(struct bt_hci_cp_write_class_of_device)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } diff --git a/subsys/bluetooth/host/classic/conn_br.c b/subsys/bluetooth/host/classic/conn_br.c index 27f6dbb7d8b8..582d560c4df3 100644 --- a/subsys/bluetooth/host/classic/conn_br.c +++ b/subsys/bluetooth/host/classic/conn_br.c @@ -73,7 +73,7 @@ struct bt_conn *bt_conn_create_br(const bt_addr_t *peer, return NULL; } - buf = bt_hci_cmd_create(BT_HCI_OP_CONNECT, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { bt_conn_unref(conn); return NULL; @@ -107,7 +107,7 @@ int bt_hci_connect_br_cancel(struct bt_conn *conn) struct net_buf *buf, *rsp; int err; - buf = bt_hci_cmd_create(BT_HCI_OP_CONNECT_CANCEL, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } diff --git a/subsys/bluetooth/host/classic/sco.c b/subsys/bluetooth/host/classic/sco.c index 9157caaf941b..baee819b42be 100644 --- a/subsys/bluetooth/host/classic/sco.c +++ b/subsys/bluetooth/host/classic/sco.c @@ -258,7 +258,7 @@ static int accept_sco_conn(const bt_addr_t *bdaddr, struct bt_conn *sco_conn) return err; } - buf = bt_hci_cmd_create(BT_HCI_OP_ACCEPT_SYNC_CONN_REQ, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -334,7 +334,7 @@ static int sco_setup_sync_conn(struct bt_conn *sco_conn) struct bt_hci_cp_setup_sync_conn *cp; int err; - buf = bt_hci_cmd_create(BT_HCI_OP_SETUP_SYNC_CONN, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } diff --git a/subsys/bluetooth/host/classic/ssp.c b/subsys/bluetooth/host/classic/ssp.c index 1064165a5a18..722ac09cbb84 100644 --- a/subsys/bluetooth/host/classic/ssp.c +++ b/subsys/bluetooth/host/classic/ssp.c @@ -50,7 +50,7 @@ static int pin_code_neg_reply(const bt_addr_t *bdaddr) LOG_DBG(""); - buf = bt_hci_cmd_create(BT_HCI_OP_PIN_CODE_NEG_REPLY, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -68,7 +68,7 @@ static int pin_code_reply(struct bt_conn *conn, const char *pin, uint8_t len) LOG_DBG(""); - buf = bt_hci_cmd_create(BT_HCI_OP_PIN_CODE_REPLY, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -186,7 +186,7 @@ static int ssp_confirm_reply(struct bt_conn *conn) LOG_DBG(""); - buf = bt_hci_cmd_create(BT_HCI_OP_USER_CONFIRM_REPLY, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -204,7 +204,7 @@ static int ssp_confirm_neg_reply(struct bt_conn *conn) LOG_DBG(""); - buf = bt_hci_cmd_create(BT_HCI_OP_USER_CONFIRM_NEG_REPLY, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -313,7 +313,7 @@ static int ssp_passkey_reply(struct bt_conn *conn, unsigned int passkey) LOG_DBG(""); - buf = bt_hci_cmd_create(BT_HCI_OP_USER_PASSKEY_REPLY, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -332,7 +332,7 @@ static int ssp_passkey_neg_reply(struct bt_conn *conn) LOG_DBG(""); - buf = bt_hci_cmd_create(BT_HCI_OP_USER_PASSKEY_NEG_REPLY, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -351,7 +351,7 @@ static int conn_auth(struct bt_conn *conn) LOG_DBG(""); - buf = bt_hci_cmd_create(BT_HCI_OP_AUTH_REQUESTED, sizeof(*auth)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -539,7 +539,7 @@ void link_key_neg_reply(const bt_addr_t *bdaddr) LOG_DBG(""); - buf = bt_hci_cmd_create(BT_HCI_OP_LINK_KEY_NEG_REPLY, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { LOG_ERR("Out of command buffers"); return; @@ -557,7 +557,7 @@ void link_key_reply(const bt_addr_t *bdaddr, const uint8_t *lk) LOG_DBG(""); - buf = bt_hci_cmd_create(BT_HCI_OP_LINK_KEY_REPLY, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { LOG_ERR("Out of command buffers"); return; @@ -613,8 +613,7 @@ void io_capa_neg_reply(const bt_addr_t *bdaddr, const uint8_t reason) struct bt_hci_cp_io_capability_neg_reply *cp; struct net_buf *resp_buf; - resp_buf = bt_hci_cmd_create(BT_HCI_OP_IO_CAPABILITY_NEG_REPLY, - sizeof(*cp)); + resp_buf = bt_hci_cmd_alloc(K_FOREVER); if (!resp_buf) { LOG_ERR("Out of command buffers"); return; @@ -769,7 +768,7 @@ void bt_hci_io_capa_req(struct net_buf *buf) conn->br.local_auth = auth; - resp_buf = bt_hci_cmd_create(BT_HCI_OP_IO_CAPABILITY_REPLY, sizeof(*cp)); + resp_buf = bt_hci_cmd_alloc(K_FOREVER); if (!resp_buf) { LOG_ERR("Out of command buffers"); bt_conn_unref(conn); @@ -865,7 +864,7 @@ static void link_encr(const uint16_t handle) LOG_DBG(""); - buf = bt_hci_cmd_create(BT_HCI_OP_SET_CONN_ENCRYPT, sizeof(*encr)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { LOG_ERR("Out of command buffers"); return; From c2cdce7a7c21fe85d8303aa609ee8f4f78c1cdb9 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Thu, 19 Jun 2025 03:52:00 +0300 Subject: [PATCH 0147/2141] [nrf fromtree] Bluetooth: Host: conn: Use bt_hci_cmd_alloc() Use bt_hci_cmd_alloc() instead of the soon to be deprecated bt_hci_cmd_create(). Signed-off-by: Johan Hedberg (cherry picked from commit 0d475565424a61ad29bcf27338821c81b5411e55) --- subsys/bluetooth/host/conn.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/subsys/bluetooth/host/conn.c b/subsys/bluetooth/host/conn.c index a7aca69fa9d9..0c34dc0b6160 100644 --- a/subsys/bluetooth/host/conn.c +++ b/subsys/bluetooth/host/conn.c @@ -2472,7 +2472,7 @@ int bt_conn_le_start_encryption(struct bt_conn *conn, uint8_t rand[8], return -EINVAL; } - buf = bt_hci_cmd_create(BT_HCI_OP_LE_START_ENCRYPTION, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -2511,8 +2511,7 @@ uint8_t bt_conn_enc_key_size(const struct bt_conn *conn) struct net_buf *rsp; uint8_t key_size; - buf = bt_hci_cmd_create(BT_HCI_OP_READ_ENCRYPTION_KEY_SIZE, - sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return 0; } @@ -2978,7 +2977,7 @@ static int bt_conn_get_tx_power_level(struct bt_conn *conn, uint8_t type, struct bt_hci_cp_read_tx_power_level *cp; struct net_buf *buf; - buf = bt_hci_cmd_create(BT_HCI_OP_READ_TX_POWER_LEVEL, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -3037,7 +3036,7 @@ int bt_conn_le_enhanced_get_tx_power_level(struct bt_conn *conn, return -EINVAL; } - buf = bt_hci_cmd_create(BT_HCI_OP_LE_ENH_READ_TX_POWER_LEVEL, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -3075,7 +3074,7 @@ int bt_conn_le_get_remote_tx_power_level(struct bt_conn *conn, return -EINVAL; } - buf = bt_hci_cmd_create(BT_HCI_OP_LE_READ_REMOTE_TX_POWER_LEVEL, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -3099,7 +3098,7 @@ int bt_conn_le_set_tx_power_report_enable(struct bt_conn *conn, return -EINVAL; } - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_TX_POWER_REPORT_ENABLE, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -3175,7 +3174,7 @@ int bt_conn_le_set_path_loss_mon_param(struct bt_conn *conn, return -EINVAL; } - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_PATH_LOSS_REPORTING_PARAMETERS, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -3201,7 +3200,7 @@ int bt_conn_le_set_path_loss_mon_enable(struct bt_conn *conn, bool reporting_ena return -EINVAL; } - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_PATH_LOSS_REPORTING_ENABLE, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -3276,7 +3275,7 @@ int bt_conn_le_subrate_set_defaults(const struct bt_conn_le_subrate_param *param return -EINVAL; } - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_DEFAULT_SUBRATE, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -3306,7 +3305,7 @@ int bt_conn_le_subrate_request(struct bt_conn *conn, return -EINVAL; } - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SUBRATE_REQUEST, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -3936,8 +3935,7 @@ int bt_conn_le_conn_update(struct bt_conn *conn, struct hci_cp_le_conn_update *conn_update; struct net_buf *buf; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_CONN_UPDATE, - sizeof(*conn_update)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } From ce112c5db40f97a8db4328f12f949a00cd978b9b Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Thu, 19 Jun 2025 03:52:47 +0300 Subject: [PATCH 0148/2141] [nrf fromtree] Bluetooth: Host: cs: Use bt_hci_cmd_alloc() Use bt_hci_cmd_alloc() instead of the soon to be deprecated bt_hci_cmd_create(). Signed-off-by: Johan Hedberg (cherry picked from commit e23d5a080121fe8a862e23dcfe69da96f57e7ecb) --- subsys/bluetooth/host/cs.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/subsys/bluetooth/host/cs.c b/subsys/bluetooth/host/cs.c index a7bdefa77a12..baad4204bc64 100644 --- a/subsys/bluetooth/host/cs.c +++ b/subsys/bluetooth/host/cs.c @@ -296,7 +296,7 @@ int bt_le_cs_read_remote_supported_capabilities(struct bt_conn *conn) struct bt_hci_cp_le_read_remote_supported_capabilities *cp; struct net_buf *buf; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_CS_READ_REMOTE_SUPPORTED_CAPABILITIES, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -439,7 +439,7 @@ int bt_le_cs_set_default_settings(struct bt_conn *conn, struct bt_hci_cp_le_cs_set_default_settings *cp; struct net_buf *buf; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_CS_SET_DEFAULT_SETTINGS, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -466,7 +466,7 @@ int bt_le_cs_read_remote_fae_table(struct bt_conn *conn) struct bt_hci_cp_le_read_remote_fae_table *cp; struct net_buf *buf; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_CS_READ_REMOTE_FAE_TABLE, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -884,7 +884,7 @@ int bt_le_cs_create_config(struct bt_conn *conn, struct bt_le_cs_create_config_p struct bt_hci_cp_le_cs_create_config *cp; struct net_buf *buf; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_CS_CREATE_CONFIG, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -917,7 +917,7 @@ int bt_le_cs_remove_config(struct bt_conn *conn, uint8_t config_id) struct bt_hci_cp_le_cs_remove_config *cp; struct net_buf *buf; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_CS_REMOVE_CONFIG, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -934,7 +934,7 @@ int bt_le_cs_security_enable(struct bt_conn *conn) struct bt_hci_cp_le_security_enable *cp; struct net_buf *buf; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_CS_SECURITY_ENABLE, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -951,7 +951,7 @@ int bt_le_cs_procedure_enable(struct bt_conn *conn, struct bt_hci_cp_le_procedure_enable *cp; struct net_buf *buf; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_CS_PROCEDURE_ENABLE, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -970,7 +970,7 @@ int bt_le_cs_set_procedure_parameters(struct bt_conn *conn, struct bt_hci_cp_le_set_procedure_parameters *cp; struct net_buf *buf; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_CS_SET_PROCEDURE_PARAMETERS, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -999,7 +999,7 @@ int bt_le_cs_set_channel_classification(uint8_t channel_classification[10]) uint8_t *cp; struct net_buf *buf; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_CS_SET_CHANNEL_CLASSIFICATION, 10); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -1111,9 +1111,7 @@ int bt_le_cs_write_cached_remote_supported_capabilities( struct bt_hci_cp_le_write_cached_remote_supported_capabilities *cp; struct net_buf *buf; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_CS_WRITE_CACHED_REMOTE_SUPPORTED_CAPABILITIES, - sizeof(*cp)); - + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -1210,7 +1208,7 @@ int bt_le_cs_write_cached_remote_fae_table(struct bt_conn *conn, int8_t remote_f struct bt_hci_cp_le_write_cached_remote_fae_table *cp; struct net_buf *buf; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_CS_WRITE_CACHED_REMOTE_FAE_TABLE, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -1308,7 +1306,7 @@ int bt_le_cs_stop_test(void) { struct net_buf *buf; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_CS_TEST_END, 0); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } From 511df0acc1befe800bf0677b6270e7466b10f803 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Thu, 19 Jun 2025 03:58:05 +0300 Subject: [PATCH 0149/2141] [nrf fromtree] Bluetooth: Host: direction: Use bt_hci_cmd_alloc() Use bt_hci_cmd_alloc() instead of the soon to be deprecated bt_hci_cmd_create(). Signed-off-by: Johan Hedberg (cherry picked from commit 6f2643638dc2d897b9cfdaa5fc8f1bc1fa55c005) --- subsys/bluetooth/host/direction.c | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/subsys/bluetooth/host/direction.c b/subsys/bluetooth/host/direction.c index a59cbdada37a..73a196a8e20b 100644 --- a/subsys/bluetooth/host/direction.c +++ b/subsys/bluetooth/host/direction.c @@ -129,8 +129,7 @@ static int hci_df_set_cl_cte_tx_params(const struct bt_le_ext_adv *adv, return -EINVAL; } - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_CL_CTE_TX_PARAMS, - sizeof(*cp) + params->num_ant_ids); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -216,7 +215,7 @@ static int hci_df_set_adv_cte_tx_enable(struct bt_le_ext_adv *adv, struct bt_hci_cmd_state_set state; struct net_buf *buf; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_CL_CTE_TX_ENABLE, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -296,9 +295,7 @@ prepare_cl_cte_rx_enable_cmd_params(struct net_buf **buf, struct bt_le_per_adv_s /* If CTE Rx is enabled, command parameters total length must include * antenna ids, so command size if extended by num_and_ids. */ - *buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_CL_CTE_SAMPLING_ENABLE, - (sizeof(struct bt_hci_cp_le_set_cl_cte_sampling_enable) + - (enable ? switch_pattern_len : 0))); + *buf = bt_hci_cmd_alloc(K_FOREVER); if (!(*buf)) { return -ENOBUFS; } @@ -528,7 +525,6 @@ static int hci_df_set_conn_cte_tx_param(struct bt_conn *conn, struct bt_hci_rp_le_set_conn_cte_tx_params *rp; struct bt_hci_cmd_state_set state; struct net_buf *buf, *rsp; - uint8_t num_ant_ids; int err; /* If AoD is not enabled, ant_ids are ignored by controller: @@ -538,11 +534,7 @@ static int hci_df_set_conn_cte_tx_param(struct bt_conn *conn, return -EINVAL; } - num_ant_ids = ((params->cte_types & (BT_DF_CTE_TYPE_AOD_1US | BT_DF_CTE_TYPE_AOD_2US)) ? - params->num_ant_ids : 0); - - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_CONN_CTE_TX_PARAMS, - sizeof(struct bt_hci_cp_le_set_conn_cte_tx_params) + num_ant_ids); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -587,9 +579,7 @@ static int prepare_conn_cte_rx_enable_cmd_params(struct net_buf **buf, struct bt /* If CTE Rx is enabled, command parameters total length must include * antenna ids, so command size if extended by num_and_ids. */ - *buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_CONN_CTE_RX_PARAMS, - (sizeof(struct bt_hci_cp_le_set_conn_cte_rx_params) + - (enable ? switch_pattern_len : 0))); + *buf = bt_hci_cmd_alloc(K_FOREVER); if (!(*buf)) { return -ENOBUFS; } @@ -823,8 +813,7 @@ static int hci_df_set_conn_cte_req_enable(struct bt_conn *conn, bool enable, return -EINVAL; } - buf = bt_hci_cmd_create(BT_HCI_OP_LE_CONN_CTE_REQ_ENABLE, - sizeof(struct bt_hci_cp_le_conn_cte_req_enable)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -909,8 +898,7 @@ static int hci_df_set_conn_cte_rsp_enable(struct bt_conn *conn, bool enable) struct net_buf *buf, *rsp; int err; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_CONN_CTE_RSP_ENABLE, - sizeof(struct bt_hci_cp_le_conn_cte_rsp_enable)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } From b4964932862ac9744cce05e6ed3b11642d177db4 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Thu, 19 Jun 2025 03:59:02 +0300 Subject: [PATCH 0150/2141] [nrf fromtree] Bluetooth: Host: id: Use bt_hci_cmd_alloc() Use bt_hci_cmd_alloc() instead of the soon to be deprecated bt_hci_cmd_create(). Signed-off-by: Johan Hedberg (cherry picked from commit 354e75d479dbb675e8df317e94654c61b12f36ec) --- subsys/bluetooth/host/id.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/subsys/bluetooth/host/id.c b/subsys/bluetooth/host/id.c index 926175f8b33b..af5176574eb0 100644 --- a/subsys/bluetooth/host/id.c +++ b/subsys/bluetooth/host/id.c @@ -142,7 +142,7 @@ static int set_random_address(const bt_addr_t *addr) return 0; } - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_RANDOM_ADDRESS, sizeof(*addr)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -193,8 +193,7 @@ int bt_id_set_adv_random_addr(struct bt_le_ext_adv *adv, return 0; } - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_ADV_SET_RANDOM_ADDR, - sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -314,8 +313,7 @@ static void le_rpa_timeout_update(void) struct net_buf *buf; struct bt_hci_cp_le_set_rpa_timeout *cp; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_RPA_TIMEOUT, - sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { LOG_ERR("Failed to create HCI RPA timeout command"); err = -ENOBUFS; @@ -850,7 +848,7 @@ static int le_set_privacy_mode(const bt_addr_le_t *addr, uint8_t mode) bt_addr_le_copy(&cp.id_addr, addr); cp.mode = mode; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_PRIVACY_MODE, sizeof(cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -871,7 +869,7 @@ static int addr_res_enable(uint8_t enable) LOG_DBG("%s", enable ? "enabled" : "disabled"); - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_ADDR_RES_ENABLE, 1); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -893,7 +891,7 @@ static int hci_id_add(uint8_t id, const bt_addr_le_t *addr, uint8_t peer_irk[16] LOG_DBG("addr %s", bt_addr_le_str(addr)); - buf = bt_hci_cmd_create(BT_HCI_OP_LE_ADD_DEV_TO_RL, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -1141,7 +1139,7 @@ static int hci_id_del(const bt_addr_le_t *addr) LOG_DBG("addr %s", bt_addr_le_str(addr)); - buf = bt_hci_cmd_create(BT_HCI_OP_LE_REM_DEV_FROM_RL, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } From 54cabb79364154bcff27f93c7bef20e6dc8a4e0c Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Thu, 19 Jun 2025 04:00:11 +0300 Subject: [PATCH 0151/2141] [nrf fromtree] Bluetooth: Host: iso: Use bt_hci_cmd_alloc() Use bt_hci_cmd_alloc() instead of the soon to be deprecated bt_hci_cmd_create(). Signed-off-by: Johan Hedberg (cherry picked from commit e9f06126ea334e6a7febfdc237be865c15e3b16f) --- subsys/bluetooth/host/iso.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/subsys/bluetooth/host/iso.c b/subsys/bluetooth/host/iso.c index ffdf3ec07364..eb6eaa783504 100644 --- a/subsys/bluetooth/host/iso.c +++ b/subsys/bluetooth/host/iso.c @@ -196,7 +196,7 @@ static int hci_le_setup_iso_data_path(const struct bt_conn *iso, uint8_t dir, uint8_t *cc; int err; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SETUP_ISO_PATH, sizeof(*cp) + path->cc_len); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -345,7 +345,7 @@ static int hci_le_remove_iso_data_path(struct bt_conn *iso, uint8_t dir) struct net_buf *buf, *rsp; int err; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_REMOVE_ISO_PATH, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -1061,7 +1061,7 @@ int bt_iso_chan_get_tx_sync(const struct bt_iso_chan *chan, struct bt_iso_tx_inf return -ENOTCONN; } - buf = bt_hci_cmd_create(BT_HCI_OP_LE_READ_ISO_TX_SYNC, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOMEM; } @@ -1491,7 +1491,7 @@ static int hci_le_reject_cis(uint16_t handle, uint8_t reason) struct net_buf *buf; int err; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_REJECT_CIS, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -1514,7 +1514,7 @@ static int hci_le_accept_cis(uint16_t handle) struct net_buf *buf; int err; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_ACCEPT_CIS, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -1683,7 +1683,7 @@ static int hci_le_remove_cig(uint8_t cig_id) struct bt_hci_cp_le_remove_cig *req; struct net_buf *buf; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_REMOVE_CIG, sizeof(*req)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -1706,8 +1706,7 @@ static struct net_buf *hci_le_set_cig_params(const struct bt_iso_cig *cig, struct net_buf *rsp; int i, err; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_CIG_PARAMS, - sizeof(*req) + sizeof(*cis_param) * param->num_cis); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return NULL; } @@ -1795,8 +1794,7 @@ static struct net_buf *hci_le_set_cig_test_params(const struct bt_iso_cig *cig, struct net_buf *rsp; int err; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_CIG_PARAMS_TEST, - sizeof(*req) + sizeof(*cis_param) * param->num_cis); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return NULL; } @@ -2444,7 +2442,7 @@ static int hci_le_create_cis(const struct bt_iso_connect_param *param, size_t co struct bt_hci_cp_le_create_cis *req; struct net_buf *buf; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_CREATE_CIS, sizeof(*req) + sizeof(*cis) * count); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -2784,7 +2782,7 @@ static int hci_le_create_big(struct bt_le_ext_adv *padv, struct bt_iso_big *big, int err; struct bt_iso_chan *bis; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_CREATE_BIG, sizeof(*req)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; @@ -2844,7 +2842,7 @@ static int hci_le_create_big_test(const struct bt_le_ext_adv *padv, struct bt_is struct net_buf *buf; int err; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_CREATE_BIG_TEST, sizeof(*req)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; @@ -3198,7 +3196,7 @@ static int hci_le_terminate_big(struct bt_iso_big *big) struct bt_hci_cp_le_terminate_big *req; struct net_buf *buf; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_TERMINATE_BIG, sizeof(*req)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -3218,7 +3216,7 @@ static int hci_le_big_sync_term(struct bt_iso_big *big) struct net_buf *rsp; int err; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_BIG_TERMINATE_SYNC, sizeof(*req)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -3391,7 +3389,7 @@ static int hci_le_big_create_sync(const struct bt_le_per_adv_sync *sync, struct int err; uint8_t bit_idx = 0; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_BIG_CREATE_SYNC, sizeof(*req) + big->num_bis); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } From d635e8cb47e837af0bc2eefd9da5eb0902b601f0 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Thu, 19 Jun 2025 04:01:52 +0300 Subject: [PATCH 0152/2141] [nrf fromtree] Bluetooth: Host: scan: Use bt_hci_cmd_alloc() Use bt_hci_cmd_alloc() instead of the soon to be deprecated bt_hci_cmd_create(). Signed-off-by: Johan Hedberg (cherry picked from commit 896212933a0bff7ee8b03adff874b00a35bc18ba) --- subsys/bluetooth/host/scan.c | 42 +++++++++++++----------------------- 1 file changed, 15 insertions(+), 27 deletions(-) diff --git a/subsys/bluetooth/host/scan.c b/subsys/bluetooth/host/scan.c index 7094ebd664de..b154729438a0 100644 --- a/subsys/bluetooth/host/scan.c +++ b/subsys/bluetooth/host/scan.c @@ -133,7 +133,7 @@ static int cmd_le_set_ext_scan_enable(bool enable, bool filter_duplicates, uint1 struct net_buf *buf; int err; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_EXT_SCAN_ENABLE, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -163,7 +163,7 @@ static int cmd_le_set_scan_enable_legacy(bool enable, bool filter_duplicates) struct net_buf *buf; int err; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_SCAN_ENABLE, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -252,10 +252,7 @@ static int start_le_scan_ext(struct bt_le_scan_param *scan_param) return err; } - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_EXT_SCAN_PARAM, - sizeof(*set_param) + - (phy_1m ? sizeof(*phy_1m) : 0) + - (phy_coded ? sizeof(*phy_coded) : 0)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -322,7 +319,7 @@ static int start_le_scan_legacy(struct bt_le_scan_param *param) return err; } - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_SCAN_PARAM, sizeof(set_param)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -1166,8 +1163,7 @@ static int per_adv_sync_terminate(uint16_t handle) struct bt_hci_cp_le_per_adv_terminate_sync *cp; struct net_buf *buf; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_PER_ADV_TERMINATE_SYNC, - sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -1359,9 +1355,7 @@ int bt_le_per_adv_sync_subevent(struct bt_le_per_adv_sync *per_adv_sync, return -EINVAL; } - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_PER_ADV_SYNC_SUBEVENT, - sizeof(*cp) + params->num_subevents); - + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -1399,9 +1393,7 @@ int bt_le_per_adv_set_response_data(struct bt_le_per_adv_sync *per_adv_sync, return -EINVAL; } - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_PER_ADV_RESPONSE_DATA, - sizeof(*cp) + data->len); - + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -1927,7 +1919,7 @@ int bt_le_per_adv_sync_create(const struct bt_le_per_adv_sync_param *param, return -ENOMEM; } - buf = bt_hci_cmd_create(BT_HCI_OP_LE_PER_ADV_CREATE_SYNC, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { per_adv_sync_delete(per_adv_sync); return -ENOBUFS; @@ -2034,7 +2026,7 @@ static int bt_le_per_adv_sync_create_cancel( return err; } - buf = bt_hci_cmd_create(BT_HCI_OP_LE_PER_ADV_CREATE_SYNC_CANCEL, 0); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -2130,8 +2122,7 @@ static int bt_le_set_per_adv_recv_enable( return -EALREADY; } - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_PER_ADV_RECV_ENABLE, - sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -2189,8 +2180,7 @@ int bt_le_per_adv_sync_transfer(const struct bt_le_per_adv_sync *per_adv_sync, return -ENOTSUP; } - buf = bt_hci_cmd_create(BT_HCI_OP_LE_PER_ADV_SYNC_TRANSFER, - sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -2230,7 +2220,7 @@ static int past_param_set(const struct bt_conn *conn, uint8_t mode, struct bt_hci_cp_le_past_param *cp; struct net_buf *buf; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_PAST_PARAM, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -2253,7 +2243,7 @@ static int default_past_param_set(uint8_t mode, uint16_t skip, uint16_t timeout, struct bt_hci_cp_le_default_past_param *cp; struct net_buf *buf; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_DEFAULT_PAST_PARAM, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -2381,8 +2371,7 @@ int bt_le_per_adv_list_add(const bt_addr_le_t *addr, uint8_t sid) return -EAGAIN; } - buf = bt_hci_cmd_create(BT_HCI_OP_LE_ADD_DEV_TO_PER_ADV_LIST, - sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -2412,8 +2401,7 @@ int bt_le_per_adv_list_remove(const bt_addr_le_t *addr, uint8_t sid) return -EAGAIN; } - buf = bt_hci_cmd_create(BT_HCI_OP_LE_REM_DEV_FROM_PER_ADV_LIST, - sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } From 897c84fbb48364300b9815282c150691b23a4f80 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Thu, 19 Jun 2025 04:03:11 +0300 Subject: [PATCH 0153/2141] [nrf fromtree] Bluetooth: Host: shell: Use bt_hci_cmd_alloc() Use bt_hci_cmd_alloc() instead of the soon to be deprecated bt_hci_cmd_create(). Signed-off-by: Johan Hedberg (cherry picked from commit 3056d0773eac3c1680bf1ecebdce52eaa04920bd) --- subsys/bluetooth/host/shell/bt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/bluetooth/host/shell/bt.c b/subsys/bluetooth/host/shell/bt.c index 206cae5c0c6e..1550644018ef 100644 --- a/subsys/bluetooth/host/shell/bt.c +++ b/subsys/bluetooth/host/shell/bt.c @@ -1432,7 +1432,7 @@ static int cmd_hci_cmd(const struct shell *sh, size_t argc, char *argv[]) return -ENOEXEC; } - buf = bt_hci_cmd_create(BT_OP(ogf, ocf), len); + buf = bt_hci_cmd_alloc(K_FOREVER); if (buf == NULL) { shell_error(sh, "Unable to allocate HCI buffer"); return -ENOMEM; From 74d6f3751bd1a4211bee990b83e249e4018120b6 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Thu, 19 Jun 2025 04:04:28 +0300 Subject: [PATCH 0154/2141] [nrf fromtree] Bluetooth: Mesh: shell: Use bt_hci_cmd_alloc() Use bt_hci_cmd_alloc() instead of the soon to be deprecated bt_hci_cmd_create(). Signed-off-by: Johan Hedberg (cherry picked from commit 58fe2ab5e6ae9b15d09b75704e6fac5f68cec4df) --- subsys/bluetooth/mesh/shell/hci.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/subsys/bluetooth/mesh/shell/hci.c b/subsys/bluetooth/mesh/shell/hci.c index 6192f3b07b74..191a47c24115 100644 --- a/subsys/bluetooth/mesh/shell/hci.c +++ b/subsys/bluetooth/mesh/shell/hci.c @@ -30,9 +30,7 @@ int cmd_mesh_adv(const struct shell *sh, size_t argc, char *argv[]) if (!strcmp(argv[1], "on")) { struct bt_hci_cp_mesh_advertise *cp; - buf = bt_hci_cmd_create(BT_HCI_OP_VS_MESH, - sizeof(struct bt_hci_cp_mesh) + - sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -58,9 +56,7 @@ int cmd_mesh_adv(const struct shell *sh, size_t argc, char *argv[]) } else if (!strcmp(argv[1], "off")) { struct bt_hci_cp_mesh_advertise_cancel *cp; - buf = bt_hci_cmd_create(BT_HCI_OP_VS_MESH, - sizeof(struct bt_hci_cp_mesh) + - sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } From 11d4a59f344c0b2d6dd026d231dbfd33bdb08b0d Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Thu, 19 Jun 2025 04:10:03 +0300 Subject: [PATCH 0155/2141] [nrf fromtree] Bluetooth: samples: Use bt_hci_cmd_alloc() Use bt_hci_cmd_alloc() instead of the soon to be deprecated bt_hci_cmd_create(). Signed-off-by: Johan Hedberg (cherry picked from commit 187ec7012d76f4ad792d0892ad359a5945b4f226) --- samples/bluetooth/hci_pwr_ctrl/src/main.c | 8 +++----- samples/bluetooth/hci_vs_scan_req/src/main.c | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/samples/bluetooth/hci_pwr_ctrl/src/main.c b/samples/bluetooth/hci_pwr_ctrl/src/main.c index 137943284892..ef6ca0bbbb27 100644 --- a/samples/bluetooth/hci_pwr_ctrl/src/main.c +++ b/samples/bluetooth/hci_pwr_ctrl/src/main.c @@ -57,7 +57,7 @@ static void read_conn_rssi(uint16_t handle, int8_t *rssi) int err; - buf = bt_hci_cmd_create(BT_HCI_OP_READ_RSSI, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { printk("Unable to allocate command buffer\n"); return; @@ -86,8 +86,7 @@ static void set_tx_power(uint8_t handle_type, uint16_t handle, int8_t tx_pwr_lvl struct net_buf *buf, *rsp = NULL; int err; - buf = bt_hci_cmd_create(BT_HCI_OP_VS_WRITE_TX_POWER_LEVEL, - sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { printk("Unable to allocate command buffer\n"); return; @@ -119,8 +118,7 @@ static void get_tx_power(uint8_t handle_type, uint16_t handle, int8_t *tx_pwr_lv int err; *tx_pwr_lvl = 0xFF; - buf = bt_hci_cmd_create(BT_HCI_OP_VS_READ_TX_POWER_LEVEL, - sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { printk("Unable to allocate command buffer\n"); return; diff --git a/samples/bluetooth/hci_vs_scan_req/src/main.c b/samples/bluetooth/hci_vs_scan_req/src/main.c index 6e1c4cb6b770..7682c469edfe 100644 --- a/samples/bluetooth/hci_vs_scan_req/src/main.c +++ b/samples/bluetooth/hci_vs_scan_req/src/main.c @@ -65,7 +65,7 @@ static void enable_legacy_adv_scan_request_event(bool enable) struct net_buf *buf; int err; - buf = bt_hci_cmd_create(BT_HCI_OP_VS_SET_SCAN_REQ_REPORTS, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { printk("%s: Unable to allocate HCI command buffer\n", __func__); return; From e4961a8246a8b176941969962f8d2eb7afed179c Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Thu, 19 Jun 2025 10:36:14 +0300 Subject: [PATCH 0156/2141] [nrf fromtree] Bluetooth: tests: Use bt_hci_cmd_alloc() Use bt_hci_cmd_alloc() instead of the soon to be deprecated bt_hci_cmd_create(). Signed-off-by: Johan Hedberg (cherry picked from commit b0bed23fd27a274e53343c6e30c224732b5d8f8d) --- .../src/test_cte_req_enable.c | 2 +- .../src/test_cte_set_rx_params.c | 2 +- .../src/test_set_conn_cte_tx_params.c | 3 +-- .../src/test_set_iq_sampling_enable.c | 3 +-- .../df/connectionless_cte_tx/src/common.c | 3 +-- .../src/test_set_cl_cte_tx_enable.c | 2 +- .../src/test_set_cl_cte_tx_param.c | 3 +-- tests/bluetooth/hci_codecs_info/src/main.c | 4 ++-- tests/bluetooth/host/conn/mocks/hci_core.c | 2 +- tests/bluetooth/host/conn/mocks/hci_core.h | 4 ++-- tests/bluetooth/host/cs/mocks/hci_core.c | 2 +- tests/bluetooth/host/cs/mocks/hci_core.h | 4 ++-- tests/bluetooth/host/id/bt_id_add/src/main.c | 6 +++--- tests/bluetooth/host/id/bt_id_del/src/main.c | 8 ++++---- .../test_suite_setup_static_random_identity.c | 2 +- .../src/test_suite_invalid_cases.c | 4 ++-- .../id/bt_id_set_adv_random_addr/src/main.c | 10 +++++----- .../src/test_suite_invalid_cases.c | 12 ++++++------ .../src/test_suite_invalid_inputs.c | 2 +- .../src/test_suite_invalid_cases.c | 2 +- .../src/test_suite_invalid_inputs.c | 2 +- tests/bluetooth/host/id/mocks/hci_core.c | 2 +- tests/bluetooth/host/id/mocks/hci_core.h | 4 ++-- .../bluetooth/host/id/mocks/hci_core_expects.c | 17 ++++++----------- .../bluetooth/host/id/mocks/hci_core_expects.h | 12 ++++++------ tests/bsim/bluetooth/host/central/src/main.c | 2 +- 26 files changed, 55 insertions(+), 64 deletions(-) diff --git a/tests/bluetooth/df/connection_cte_req/src/test_cte_req_enable.c b/tests/bluetooth/df/connection_cte_req/src/test_cte_req_enable.c index f9f10d5ccabe..e44db418cac6 100644 --- a/tests/bluetooth/df/connection_cte_req/src/test_cte_req_enable.c +++ b/tests/bluetooth/df/connection_cte_req/src/test_cte_req_enable.c @@ -63,7 +63,7 @@ int send_conn_cte_req_enable(uint16_t conn_handle, struct bt_hci_cp_le_conn_cte_req_enable *cp; struct net_buf *buf; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_CONN_CTE_REQ_ENABLE, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } diff --git a/tests/bluetooth/df/connection_cte_req/src/test_cte_set_rx_params.c b/tests/bluetooth/df/connection_cte_req/src/test_cte_set_rx_params.c index 72a0786193d3..e3d4eced1f73 100644 --- a/tests/bluetooth/df/connection_cte_req/src/test_cte_set_rx_params.c +++ b/tests/bluetooth/df/connection_cte_req/src/test_cte_set_rx_params.c @@ -48,7 +48,7 @@ int send_set_conn_cte_rx_params(uint16_t conn_handle, uint8_t ant_ids_num = (params != NULL ? params->switch_pattern_len : 0); - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_CONN_CTE_RX_PARAMS, sizeof(*cp) + ant_ids_num); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } diff --git a/tests/bluetooth/df/connection_cte_tx_params/src/test_set_conn_cte_tx_params.c b/tests/bluetooth/df/connection_cte_tx_params/src/test_set_conn_cte_tx_params.c index 11cbf937a393..89fef224ebcc 100644 --- a/tests/bluetooth/df/connection_cte_tx_params/src/test_set_conn_cte_tx_params.c +++ b/tests/bluetooth/df/connection_cte_tx_params/src/test_set_conn_cte_tx_params.c @@ -59,8 +59,7 @@ static int send_set_conn_cte_tx_params(uint16_t conn_handle, uint8_t *dest_ant_ids; struct net_buf *buf; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_CONN_CTE_TX_PARAMS, - sizeof(*cp) + params->switch_pattern_len); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } diff --git a/tests/bluetooth/df/connectionless_cte_rx/src/test_set_iq_sampling_enable.c b/tests/bluetooth/df/connectionless_cte_rx/src/test_set_iq_sampling_enable.c index c29cc168ecbb..8a924c0a49cf 100644 --- a/tests/bluetooth/df/connectionless_cte_rx/src/test_set_iq_sampling_enable.c +++ b/tests/bluetooth/df/connectionless_cte_rx/src/test_set_iq_sampling_enable.c @@ -56,8 +56,7 @@ int send_set_scan_cte_rx_enable(uint16_t sync_handle, struct bt_hci_cp_le_set_cl_cte_sampling_enable *cp; struct net_buf *buf; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_CL_CTE_SAMPLING_ENABLE, - sizeof(*cp) + params->num_ant_ids); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } diff --git a/tests/bluetooth/df/connectionless_cte_tx/src/common.c b/tests/bluetooth/df/connectionless_cte_tx/src/common.c index f00f96d55ad5..3e65132ccbc5 100644 --- a/tests/bluetooth/df/connectionless_cte_tx/src/common.c +++ b/tests/bluetooth/df/connectionless_cte_tx/src/common.c @@ -59,8 +59,7 @@ void common_set_cl_cte_tx_params(void) struct net_buf *buf; int err; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_CL_CTE_TX_PARAMS, - sizeof(*cp) + ARRAY_SIZE(ant_ids)); + buf = bt_hci_cmd_alloc(K_FOREVER); zassert_not_null(buf, "Failed to create HCI cmd object"); cp = net_buf_add(buf, sizeof(*cp)); diff --git a/tests/bluetooth/df/connectionless_cte_tx/src/test_set_cl_cte_tx_enable.c b/tests/bluetooth/df/connectionless_cte_tx/src/test_set_cl_cte_tx_enable.c index 35267739edd1..e5bec0a1d4c8 100644 --- a/tests/bluetooth/df/connectionless_cte_tx/src/test_set_cl_cte_tx_enable.c +++ b/tests/bluetooth/df/connectionless_cte_tx/src/test_set_cl_cte_tx_enable.c @@ -35,7 +35,7 @@ int send_set_cl_cte_tx_enable(uint8_t adv_handle, atomic_t *adv_flags, struct bt_hci_cmd_state_set state; struct net_buf *buf; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_CL_CTE_TX_ENABLE, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } diff --git a/tests/bluetooth/df/connectionless_cte_tx/src/test_set_cl_cte_tx_param.c b/tests/bluetooth/df/connectionless_cte_tx/src/test_set_cl_cte_tx_param.c index e539730f9641..2c2d65ccabf7 100644 --- a/tests/bluetooth/df/connectionless_cte_tx/src/test_set_cl_cte_tx_param.c +++ b/tests/bluetooth/df/connectionless_cte_tx/src/test_set_cl_cte_tx_param.c @@ -54,8 +54,7 @@ int send_set_cl_cte_tx_params(uint8_t adv_handle, uint8_t cte_len, struct bt_hci_cp_le_set_cl_cte_tx_params *cp; struct net_buf *buf; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_CL_CTE_TX_PARAMS, - sizeof(*cp) + switch_pattern_len); + buf = bt_hci_cmd_alloc(K_FOREVER); zassert_not_null(buf, "Failed to create HCI cmd object"); cp = net_buf_add(buf, sizeof(*cp)); diff --git a/tests/bluetooth/hci_codecs_info/src/main.c b/tests/bluetooth/hci_codecs_info/src/main.c index 1d2937a21e7d..5226f6dd3f46 100644 --- a/tests/bluetooth/hci_codecs_info/src/main.c +++ b/tests/bluetooth/hci_codecs_info/src/main.c @@ -185,7 +185,7 @@ ZTEST(test_hci_codecs_info, test_read_codec_capabilities) bt_enable(NULL); /* Read Local Supported Codec Capabilities */ - buf = bt_hci_cmd_create(BT_HCI_OP_READ_CODEC_CAPABILITIES, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); cp = net_buf_add(buf, sizeof(*cp)); cp->codec_id.coding_format = READ_CAPABS_CODING_FMT; @@ -268,7 +268,7 @@ ZTEST(test_hci_codecs_info, test_read_ctlr_delay) bt_enable(NULL); /* Read Local Supported Controller Delay */ - buf = bt_hci_cmd_create(BT_HCI_OP_READ_CTLR_DELAY, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); cp = net_buf_add(buf, sizeof(*cp) + sizeof(read_delay_codec_config)); cp->codec_id.coding_format = READ_DELAY_CODING_FMT; diff --git a/tests/bluetooth/host/conn/mocks/hci_core.c b/tests/bluetooth/host/conn/mocks/hci_core.c index 363108dd3c0c..3ba21db49a61 100644 --- a/tests/bluetooth/host/conn/mocks/hci_core.c +++ b/tests/bluetooth/host/conn/mocks/hci_core.c @@ -11,7 +11,7 @@ #include "hci_core.h" -DEFINE_FAKE_VALUE_FUNC(struct net_buf *, bt_hci_cmd_create, uint16_t, uint8_t); +DEFINE_FAKE_VALUE_FUNC(struct net_buf *, bt_hci_cmd_alloc, k_timeout_t); DEFINE_FAKE_VALUE_FUNC(int, bt_hci_cmd_send_sync, uint16_t, struct net_buf *, struct net_buf **); DEFINE_FAKE_VALUE_FUNC(int, bt_hci_le_read_remote_features, struct bt_conn *); DEFINE_FAKE_VALUE_FUNC(int, bt_hci_disconnect, uint16_t, uint8_t); diff --git a/tests/bluetooth/host/conn/mocks/hci_core.h b/tests/bluetooth/host/conn/mocks/hci_core.h index abc609c58ceb..a12185a537ff 100644 --- a/tests/bluetooth/host/conn/mocks/hci_core.h +++ b/tests/bluetooth/host/conn/mocks/hci_core.h @@ -9,7 +9,7 @@ /* List of fakes used by this unit tester */ #define HCI_CORE_MOCKS_FFF_FAKES_LIST(FAKE) \ - FAKE(bt_hci_cmd_create) \ + FAKE(bt_hci_cmd_alloc) \ FAKE(bt_hci_cmd_send_sync) \ FAKE(bt_hci_le_read_remote_features) \ FAKE(bt_hci_disconnect) \ @@ -24,7 +24,7 @@ FAKE(bt_lookup_id_addr) \ FAKE(bt_le_set_phy) -DECLARE_FAKE_VALUE_FUNC(struct net_buf *, bt_hci_cmd_create, uint16_t, uint8_t); +DECLARE_FAKE_VALUE_FUNC(struct net_buf *, bt_hci_cmd_alloc, k_timeout_t); DECLARE_FAKE_VALUE_FUNC(int, bt_hci_cmd_send_sync, uint16_t, struct net_buf *, struct net_buf **); DECLARE_FAKE_VALUE_FUNC(int, bt_hci_le_read_remote_features, struct bt_conn *); DECLARE_FAKE_VALUE_FUNC(int, bt_hci_disconnect, uint16_t, uint8_t); diff --git a/tests/bluetooth/host/cs/mocks/hci_core.c b/tests/bluetooth/host/cs/mocks/hci_core.c index 5830c302a475..cb5bbd4acbd7 100644 --- a/tests/bluetooth/host/cs/mocks/hci_core.c +++ b/tests/bluetooth/host/cs/mocks/hci_core.c @@ -9,5 +9,5 @@ #include #include -DEFINE_FAKE_VALUE_FUNC(struct net_buf *, bt_hci_cmd_create, uint16_t, uint8_t); +DEFINE_FAKE_VALUE_FUNC(struct net_buf *, bt_hci_cmd_alloc, k_timeout_t); DEFINE_FAKE_VALUE_FUNC(int, bt_hci_cmd_send_sync, uint16_t, struct net_buf *, struct net_buf **); diff --git a/tests/bluetooth/host/cs/mocks/hci_core.h b/tests/bluetooth/host/cs/mocks/hci_core.h index 8dc28890755a..f754a111d6cb 100644 --- a/tests/bluetooth/host/cs/mocks/hci_core.h +++ b/tests/bluetooth/host/cs/mocks/hci_core.h @@ -9,8 +9,8 @@ /* List of fakes used by this unit tester */ #define HCI_CORE_FFF_FAKES_LIST(FAKE) \ - FAKE(bt_hci_cmd_create) \ + FAKE(bt_hci_cmd_alloc) \ FAKE(bt_hci_cmd_send_sync) -DECLARE_FAKE_VALUE_FUNC(struct net_buf *, bt_hci_cmd_create, uint16_t, uint8_t); +DECLARE_FAKE_VALUE_FUNC(struct net_buf *, bt_hci_cmd_alloc, k_timeout_t); DECLARE_FAKE_VALUE_FUNC(int, bt_hci_cmd_send_sync, uint16_t, struct net_buf *, struct net_buf **); diff --git a/tests/bluetooth/host/id/bt_id_add/src/main.c b/tests/bluetooth/host/id/bt_id_add/src/main.c index 2806414aeb16..840dc2bd0343 100644 --- a/tests/bluetooth/host/id/bt_id_add/src/main.c +++ b/tests/bluetooth/host/id/bt_id_add/src/main.c @@ -218,7 +218,7 @@ ZTEST(bt_id_add, test_conn_lookup_returns_null_broadcaster_no_ext_adv) bt_conn_lookup_state_le_fake.return_val = NULL; /* This makes addr_res_enable() succeeds and returns 0 */ - bt_hci_cmd_create_fake.return_val = &net_buff; + bt_hci_cmd_alloc_fake.return_val = &net_buff; bt_hci_cmd_send_sync_fake.return_val = 0; bt_id_add(&keys); @@ -268,7 +268,7 @@ ZTEST(bt_id_add, test_conn_lookup_returns_null_no_ext_adv_no_resolving_entries) /* This makes hci_id_add() succeeds and returns 0 */ net_buf_simple_add_fake.return_val = &cp; - bt_hci_cmd_create_fake.return_val = &net_buff; + bt_hci_cmd_alloc_fake.return_val = &net_buff; bt_hci_cmd_send_sync_fake.return_val = 0; bt_id_add(&keys); @@ -326,7 +326,7 @@ ZTEST(bt_id_add, test_scan_re_enabled_observer_enabled_ext_adv) /* This makes hci_id_add() succeeds and returns 0 */ net_buf_simple_add_fake.return_val = &cp; - bt_hci_cmd_create_fake.return_val = &net_buff; + bt_hci_cmd_alloc_fake.return_val = &net_buff; bt_hci_cmd_send_sync_fake.return_val = 0; bt_id_add(&keys); diff --git a/tests/bluetooth/host/id/bt_id_del/src/main.c b/tests/bluetooth/host/id/bt_id_del/src/main.c index 55332b3c01c1..ac37caf3678c 100644 --- a/tests/bluetooth/host/id/bt_id_del/src/main.c +++ b/tests/bluetooth/host/id/bt_id_del/src/main.c @@ -232,7 +232,7 @@ ZTEST(bt_id_del, test_conn_lookup_returns_null_broadcaster_no_ext_adv) keys.state |= BT_KEYS_ID_ADDED; /* This makes addr_res_enable() succeeds and returns 0 */ - bt_hci_cmd_create_fake.return_val = &net_buff; + bt_hci_cmd_alloc_fake.return_val = &net_buff; bt_hci_cmd_send_sync_fake.return_val = 0; bt_id_del(&keys); @@ -284,7 +284,7 @@ ZTEST(bt_id_del, test_conn_lookup_returns_null_broadcaster_no_ext_adv_privacy_en keys.state |= BT_KEYS_ID_ADDED; /* This makes addr_res_enable() succeeds and returns 0 */ - bt_hci_cmd_create_fake.return_val = &net_buff; + bt_hci_cmd_alloc_fake.return_val = &net_buff; bt_hci_cmd_send_sync_fake.return_val = 0; bt_id_del(&keys); @@ -333,7 +333,7 @@ ZTEST(bt_id_del, test_send_hci_id_del) /* This makes hci_id_del() succeeds and returns 0 */ net_buf_simple_add_fake.return_val = &cp; - bt_hci_cmd_create_fake.return_val = &net_buff; + bt_hci_cmd_alloc_fake.return_val = &net_buff; bt_hci_cmd_send_sync_fake.return_val = 0; bt_id_del(&keys); @@ -388,7 +388,7 @@ ZTEST(bt_id_del, test_scan_re_enabled_observer_enabled_ext_adv) /* This makes hci_id_del() succeeds and returns 0 */ net_buf_simple_add_fake.return_val = &cp; - bt_hci_cmd_create_fake.return_val = &net_buff; + bt_hci_cmd_alloc_fake.return_val = &net_buff; bt_hci_cmd_send_sync_fake.return_val = 0; bt_id_del(&keys); diff --git a/tests/bluetooth/host/id/bt_id_init/src/test_suite_setup_static_random_identity.c b/tests/bluetooth/host/id/bt_id_init/src/test_suite_setup_static_random_identity.c index 81934d79d7dc..67c9e110c9bb 100644 --- a/tests/bluetooth/host/id/bt_id_init/src/test_suite_setup_static_random_identity.c +++ b/tests/bluetooth/host/id/bt_id_init/src/test_suite_setup_static_random_identity.c @@ -202,7 +202,7 @@ ZTEST(bt_id_init_setup_static_random_identity, test_init_dev_identity_set_random rp->num_addrs * sizeof(struct bt_hci_vs_static_addr); /* This will make set_random_address() returns a negative number error code */ - bt_hci_cmd_create_fake.return_val = NULL; + bt_hci_cmd_alloc_fake.return_val = NULL; bt_hci_cmd_send_sync_fake.custom_fake = bt_hci_cmd_send_sync_custom_fake; err = bt_id_init(); diff --git a/tests/bluetooth/host/id/bt_id_set_adv_private_addr/src/test_suite_invalid_cases.c b/tests/bluetooth/host/id/bt_id_set_adv_private_addr/src/test_suite_invalid_cases.c index fbc13c41ebfa..1fd7fe2c1853 100644 --- a/tests/bluetooth/host/id/bt_id_set_adv_private_addr/src/test_suite_invalid_cases.c +++ b/tests/bluetooth/host/id/bt_id_set_adv_private_addr/src/test_suite_invalid_cases.c @@ -86,7 +86,7 @@ ZTEST(bt_id_set_adv_private_addr_invalid_cases, test_set_adv_address_set_adv_ran bt_rand_fake.custom_fake = bt_rand_custom_fake; /* This will make set_random_address() returns a negative number error code */ - bt_hci_cmd_create_fake.return_val = NULL; + bt_hci_cmd_alloc_fake.return_val = NULL; err = bt_id_set_adv_private_addr(&adv_param); @@ -158,7 +158,7 @@ ZTEST(bt_id_set_adv_private_addr_invalid_cases, test_set_adv_address_if_set_adv_ /* This will make bt_id_set_adv_random_addr() returns a negative number error code */ atomic_set_bit(adv_param.flags, BT_ADV_PARAMS_SET); - bt_hci_cmd_create_fake.return_val = NULL; + bt_hci_cmd_alloc_fake.return_val = NULL; err = bt_id_set_adv_private_addr(&adv_param); diff --git a/tests/bluetooth/host/id/bt_id_set_adv_random_addr/src/main.c b/tests/bluetooth/host/id/bt_id_set_adv_random_addr/src/main.c index 8d8b7cf03e3f..aeef2b1fc23d 100644 --- a/tests/bluetooth/host/id/bt_id_set_adv_random_addr/src/main.c +++ b/tests/bluetooth/host/id/bt_id_set_adv_random_addr/src/main.c @@ -52,7 +52,7 @@ ZTEST(bt_id_set_adv_random_addr, test_no_ext_adv) err = bt_id_set_adv_random_addr(&adv_param, &BT_RPA_LE_ADDR->a); - expect_not_called_bt_hci_cmd_create(); + expect_not_called_bt_hci_cmd_alloc(); expect_not_called_bt_hci_cmd_send_sync(); expect_not_called_net_buf_simple_add(); @@ -82,7 +82,7 @@ ZTEST(bt_id_set_adv_random_addr, test_ext_adv_enabled) err = bt_id_set_adv_random_addr(&adv_param, &BT_RPA_LE_ADDR->a); - expect_not_called_bt_hci_cmd_create(); + expect_not_called_bt_hci_cmd_alloc(); expect_not_called_bt_hci_cmd_send_sync(); expect_not_called_net_buf_simple_add(); @@ -102,7 +102,7 @@ ZTEST(bt_id_set_adv_random_addr, test_ext_adv_enabled) * Constraints: * - 'CONFIG_BT_EXT_ADV' is enabled * - 'BT_ADV_PARAMS_SET' flag in advertising parameters reference is set - * - bt_hci_cmd_create() returns a valid buffer pointer + * - bt_hci_cmd_alloc() returns a valid buffer pointer * - bt_hci_cmd_send_sync() returns 0 (success) * * Expected behaviour: @@ -120,13 +120,13 @@ ZTEST(bt_id_set_adv_random_addr, test_ext_adv_enabled_hci_set_adv_set_random_add atomic_set_bit(adv_param.flags, BT_ADV_PARAMS_SET); net_buf_simple_add_fake.return_val = &cp; - bt_hci_cmd_create_fake.return_val = &net_buff; + bt_hci_cmd_alloc_fake.return_val = &net_buff; bt_hci_cmd_send_sync_fake.return_val = 0; err = bt_id_set_adv_random_addr(&adv_param, &BT_RPA_LE_ADDR->a); expect_single_call_net_buf_simple_add(&net_buff.b, sizeof(cp)); - expect_single_call_bt_hci_cmd_create(BT_HCI_OP_LE_SET_ADV_SET_RANDOM_ADDR, sizeof(cp)); + expect_single_call_bt_hci_cmd_alloc(); expect_single_call_bt_hci_cmd_send_sync(BT_HCI_OP_LE_SET_ADV_SET_RANDOM_ADDR); zassert_ok(err, "Unexpected error code '%d' was returned", err); diff --git a/tests/bluetooth/host/id/bt_id_set_adv_random_addr/src/test_suite_invalid_cases.c b/tests/bluetooth/host/id/bt_id_set_adv_random_addr/src/test_suite_invalid_cases.c index a23bf02039a8..b9df7be3f9b4 100644 --- a/tests/bluetooth/host/id/bt_id_set_adv_random_addr/src/test_suite_invalid_cases.c +++ b/tests/bluetooth/host/id/bt_id_set_adv_random_addr/src/test_suite_invalid_cases.c @@ -73,17 +73,17 @@ ZTEST(bt_id_set_adv_random_addr_invalid_cases, test_null_arguments) /* * Test setting advertising random address while 'CONFIG_BT_EXT_ADV' is enabled * and 'BT_ADV_PARAMS_SET' flag in advertising parameters reference is set. - * bt_hci_cmd_create() fails to allocate buffers and returns NULL. + * bt_hci_cmd_alloc() fails to allocate buffers and returns NULL. * * Constraints: * - 'CONFIG_BT_EXT_ADV' is enabled * - 'BT_ADV_PARAMS_SET' flag in advertising parameters reference is set - * - bt_hci_cmd_create() returns null + * - bt_hci_cmd_alloc() returns null * * Expected behaviour: * - bt_id_set_adv_random_addr() returns a negative error code (failure) */ -ZTEST(bt_id_set_adv_random_addr_invalid_cases, test_bt_hci_cmd_create_returns_null) +ZTEST(bt_id_set_adv_random_addr_invalid_cases, test_bt_hci_cmd_alloc_returns_null) { int err; struct bt_le_ext_adv adv_param = {0}; @@ -92,7 +92,7 @@ ZTEST(bt_id_set_adv_random_addr_invalid_cases, test_bt_hci_cmd_create_returns_nu atomic_set_bit(adv_param.flags, BT_ADV_PARAMS_SET); - bt_hci_cmd_create_fake.return_val = NULL; + bt_hci_cmd_alloc_fake.return_val = NULL; err = bt_id_set_adv_random_addr(&adv_param, &BT_RPA_LE_ADDR->a); @@ -107,7 +107,7 @@ ZTEST(bt_id_set_adv_random_addr_invalid_cases, test_bt_hci_cmd_create_returns_nu * Constraints: * - 'CONFIG_BT_EXT_ADV' is enabled * - 'BT_ADV_PARAMS_SET' flag in advertising parameters reference is set - * - bt_hci_cmd_create() returns a valid buffer pointer + * - bt_hci_cmd_alloc() returns a valid buffer pointer * - bt_hci_cmd_send_sync() fails and returns a negative error code. * * Expected behaviour: @@ -125,7 +125,7 @@ ZTEST(bt_id_set_adv_random_addr_invalid_cases, test_bt_hci_cmd_send_sync_fails) atomic_set_bit(adv_param.flags, BT_ADV_PARAMS_SET); net_buf_simple_add_fake.return_val = &cp; - bt_hci_cmd_create_fake.return_val = &net_buff; + bt_hci_cmd_alloc_fake.return_val = &net_buff; bt_hci_cmd_send_sync_fake.return_val = -1; err = bt_id_set_adv_random_addr(&adv_param, &BT_RPA_LE_ADDR->a); diff --git a/tests/bluetooth/host/id/bt_id_set_create_conn_own_addr/src/test_suite_invalid_inputs.c b/tests/bluetooth/host/id/bt_id_set_create_conn_own_addr/src/test_suite_invalid_inputs.c index 2c9fe4abf120..adc035eed4b4 100644 --- a/tests/bluetooth/host/id/bt_id_set_create_conn_own_addr/src/test_suite_invalid_inputs.c +++ b/tests/bluetooth/host/id/bt_id_set_create_conn_own_addr/src/test_suite_invalid_inputs.c @@ -59,7 +59,7 @@ ZTEST(bt_id_set_create_conn_own_addr_invalid_inputs, test_set_random_address_fai bt_addr_le_copy(&bt_dev.id_addr[BT_ID_DEFAULT], BT_RPA_LE_ADDR); /* This will cause set_random_address() to return (-ENOBUFS) */ - bt_hci_cmd_create_fake.return_val = NULL; + bt_hci_cmd_alloc_fake.return_val = NULL; err = bt_id_set_create_conn_own_addr(false, &own_addr_type); diff --git a/tests/bluetooth/host/id/bt_id_set_private_addr/src/test_suite_invalid_cases.c b/tests/bluetooth/host/id/bt_id_set_private_addr/src/test_suite_invalid_cases.c index c6968f3cecb4..fba9f9af9f71 100644 --- a/tests/bluetooth/host/id/bt_id_set_private_addr/src/test_suite_invalid_cases.c +++ b/tests/bluetooth/host/id/bt_id_set_private_addr/src/test_suite_invalid_cases.c @@ -110,7 +110,7 @@ ZTEST(bt_id_set_private_addr_invalid_cases, test_setting_address_set_random_addr } /* This will make set_random_address() returns a negative number error code */ - bt_hci_cmd_create_fake.return_val = NULL; + bt_hci_cmd_alloc_fake.return_val = NULL; err = bt_id_set_private_addr(BT_ID_DEFAULT); diff --git a/tests/bluetooth/host/id/bt_id_set_scan_own_addr/src/test_suite_invalid_inputs.c b/tests/bluetooth/host/id/bt_id_set_scan_own_addr/src/test_suite_invalid_inputs.c index 367cf3296a33..0942ae9ca17d 100644 --- a/tests/bluetooth/host/id/bt_id_set_scan_own_addr/src/test_suite_invalid_inputs.c +++ b/tests/bluetooth/host/id/bt_id_set_scan_own_addr/src/test_suite_invalid_inputs.c @@ -91,7 +91,7 @@ ZTEST(bt_id_set_scan_own_addr_invalid_inputs, test_set_random_address_fails) bt_addr_le_copy(&bt_dev.id_addr[BT_ID_DEFAULT], BT_RPA_LE_ADDR); /* This will cause set_random_address() to return (-ENOBUFS) */ - bt_hci_cmd_create_fake.return_val = NULL; + bt_hci_cmd_alloc_fake.return_val = NULL; err = bt_id_set_scan_own_addr(false, &own_addr_type); diff --git a/tests/bluetooth/host/id/mocks/hci_core.c b/tests/bluetooth/host/id/mocks/hci_core.c index bb274e4f75df..dedaf5f9dc19 100644 --- a/tests/bluetooth/host/id/mocks/hci_core.c +++ b/tests/bluetooth/host/id/mocks/hci_core.c @@ -16,5 +16,5 @@ struct bt_dev bt_dev = { }; DEFINE_FAKE_VALUE_FUNC(int, bt_unpair, uint8_t, const bt_addr_le_t *); -DEFINE_FAKE_VALUE_FUNC(struct net_buf *, bt_hci_cmd_create, uint16_t, uint8_t); +DEFINE_FAKE_VALUE_FUNC(struct net_buf *, bt_hci_cmd_alloc, k_timeout_t); DEFINE_FAKE_VALUE_FUNC(int, bt_hci_cmd_send_sync, uint16_t, struct net_buf *, struct net_buf **); diff --git a/tests/bluetooth/host/id/mocks/hci_core.h b/tests/bluetooth/host/id/mocks/hci_core.h index 1e30830dcc20..94de9ca882e6 100644 --- a/tests/bluetooth/host/id/mocks/hci_core.h +++ b/tests/bluetooth/host/id/mocks/hci_core.h @@ -11,9 +11,9 @@ /* List of fakes used by this unit tester */ #define HCI_CORE_FFF_FAKES_LIST(FAKE) \ FAKE(bt_unpair) \ - FAKE(bt_hci_cmd_create) \ + FAKE(bt_hci_cmd_alloc) \ FAKE(bt_hci_cmd_send_sync) DECLARE_FAKE_VALUE_FUNC(int, bt_unpair, uint8_t, const bt_addr_le_t *); -DECLARE_FAKE_VALUE_FUNC(struct net_buf *, bt_hci_cmd_create, uint16_t, uint8_t); +DECLARE_FAKE_VALUE_FUNC(struct net_buf *, bt_hci_cmd_alloc, k_timeout_t); DECLARE_FAKE_VALUE_FUNC(int, bt_hci_cmd_send_sync, uint16_t, struct net_buf *, struct net_buf **); diff --git a/tests/bluetooth/host/id/mocks/hci_core_expects.c b/tests/bluetooth/host/id/mocks/hci_core_expects.c index 8e4deea9c0c1..af8a1ea13cd3 100644 --- a/tests/bluetooth/host/id/mocks/hci_core_expects.c +++ b/tests/bluetooth/host/id/mocks/hci_core_expects.c @@ -35,24 +35,19 @@ void expect_not_called_bt_unpair(void) zassert_equal(bt_unpair_fake.call_count, 0, "'%s()' was called unexpectedly", func_name); } -void expect_single_call_bt_hci_cmd_create(uint16_t opcode, uint8_t param_len) +void expect_single_call_bt_hci_cmd_alloc(void) { - const char *func_name = "bt_hci_cmd_create"; + const char *func_name = "bt_hci_cmd_alloc"; - zassert_equal(bt_hci_cmd_create_fake.call_count, 1, "'%s()' was called more than once", + zassert_equal(bt_hci_cmd_alloc_fake.call_count, 1, "'%s()' was called more than once", func_name); - - zassert_equal(bt_hci_cmd_create_fake.arg0_val, opcode, - "'%s()' was called with incorrect '%s' value", func_name, "opcode"); - zassert_equal(bt_hci_cmd_create_fake.arg1_val, param_len, - "'%s()' was called with incorrect '%s' value", func_name, "param_len"); } -void expect_not_called_bt_hci_cmd_create(void) +void expect_not_called_bt_hci_cmd_alloc(void) { - const char *func_name = "bt_hci_cmd_create"; + const char *func_name = "bt_hci_cmd_alloc"; - zassert_equal(bt_hci_cmd_create_fake.call_count, 0, "'%s()' was called unexpectedly", + zassert_equal(bt_hci_cmd_alloc_fake.call_count, 0, "'%s()' was called unexpectedly", func_name); } diff --git a/tests/bluetooth/host/id/mocks/hci_core_expects.h b/tests/bluetooth/host/id/mocks/hci_core_expects.h index f87342f1f795..018747837c00 100644 --- a/tests/bluetooth/host/id/mocks/hci_core_expects.h +++ b/tests/bluetooth/host/id/mocks/hci_core_expects.h @@ -23,20 +23,20 @@ void expect_single_call_bt_unpair(uint8_t id, const bt_addr_le_t *addr); void expect_not_called_bt_unpair(void); /* - * Validate expected behaviour when bt_hci_cmd_create() is called + * Validate expected behaviour when bt_hci_cmd_alloc() is called * * Expected behaviour: - * - bt_hci_cmd_create() to be called once with correct parameters + * - bt_hci_cmd_alloc() to be called once with correct parameters */ -void expect_single_call_bt_hci_cmd_create(uint16_t opcode, uint8_t param_len); +void expect_single_call_bt_hci_cmd_alloc(void); /* - * Validate expected behaviour when bt_hci_cmd_create() isn't called + * Validate expected behaviour when bt_hci_cmd_alloc() isn't called * * Expected behaviour: - * - bt_hci_cmd_create() isn't called at all + * - bt_hci_cmd_alloc() isn't called at all */ -void expect_not_called_bt_hci_cmd_create(void); +void expect_not_called_bt_hci_cmd_alloc(void); /* * Validate expected behaviour when bt_hci_cmd_send_sync() is called diff --git a/tests/bsim/bluetooth/host/central/src/main.c b/tests/bsim/bluetooth/host/central/src/main.c index dd12fd91a5bd..03bd40397edc 100644 --- a/tests/bsim/bluetooth/host/central/src/main.c +++ b/tests/bsim/bluetooth/host/central/src/main.c @@ -78,7 +78,7 @@ static void test_central_connect_timeout_with_timeout(uint32_t timeout_ms, bool if (stack_load) { /* Claim all the buffers so that the stack cannot handle the timeout */ for (int i = 0; i < BT_BUF_CMD_TX_COUNT; i++) { - bufs[i] = bt_hci_cmd_create(BT_HCI_LE_ADV_ENABLE, 0); + bufs[i] = bt_hci_cmd_alloc(K_FOREVER); TEST_ASSERT(bufs[i] != NULL, "Failed to claim all command buffers"); } /* Hold all the buffers until after we expect the connection to timeout */ From b704c93b2db67b37885c5f5724a9db5f756b68b2 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Thu, 19 Jun 2025 10:42:02 +0300 Subject: [PATCH 0157/2141] [nrf fromtree] tests: bsim: bluetooth: Remove bt_hci_cmd_create() usage These tests have some sort of simple host implementation, which reuses the bt_hci_cmd_create() API name, but the implementation is actually local and something that can be made static. Change the function to be static and rename it to be more in line with other internal functions. Signed-off-by: Johan Hedberg (cherry picked from commit 978614abfb0bb1392e9900c3a82a5f2a053723e7) --- .../host/att/pipeline/tester/src/main.c | 14 +++++++------- .../host/att/sequential/tester/src/main.c | 14 +++++++------- .../host/l2cap/reassembly/peer/src/peer.c | 16 ++++++++-------- .../bluetooth/host/l2cap/split/tester/src/main.c | 14 +++++++------- .../host/misc/disconnect/tester/src/main.c | 14 +++++++------- .../host/misc/hfc_multilink/tester/src/tester.c | 16 ++++++++-------- 6 files changed, 44 insertions(+), 44 deletions(-) diff --git a/tests/bsim/bluetooth/host/att/pipeline/tester/src/main.c b/tests/bsim/bluetooth/host/att/pipeline/tester/src/main.c index 5ad05dfdff1f..08320f4b6cec 100644 --- a/tests/bsim/bluetooth/host/att/pipeline/tester/src/main.c +++ b/tests/bsim/bluetooth/host/att/pipeline/tester/src/main.c @@ -66,7 +66,7 @@ static uint16_t conn_handle; static volatile uint16_t active_opcode = 0xFFFF; static struct net_buf *cmd_rsp; -struct net_buf *bt_hci_cmd_create(uint16_t opcode, uint8_t param_len) +static struct net_buf *create_cmd(uint16_t opcode, uint8_t param_len) { struct bt_hci_cmd_hdr *hdr; struct net_buf *buf; @@ -349,7 +349,7 @@ static void send_cmd(uint16_t opcode, struct net_buf *cmd, struct net_buf **rsp) LOG_DBG("opcode %x", opcode); if (!cmd) { - cmd = bt_hci_cmd_create(opcode, 0); + cmd = create_cmd(opcode, 0); } k_sem_take(&cmd_sem, K_FOREVER); @@ -420,7 +420,7 @@ static void read_max_data_len(uint16_t *tx_octets, uint16_t *tx_time) static void write_default_data_len(uint16_t tx_octets, uint16_t tx_time) { struct bt_hci_cp_le_write_default_data_len *cp; - struct net_buf *buf = bt_hci_cmd_create(BT_HCI_OP_LE_WRITE_DEFAULT_DATA_LEN, sizeof(*cp)); + struct net_buf *buf = create_cmd(BT_HCI_OP_LE_WRITE_DEFAULT_DATA_LEN, sizeof(*cp)); TEST_ASSERT_NO_MSG(buf); @@ -446,7 +446,7 @@ static void set_event_mask(uint16_t opcode) uint64_t mask = 0U; /* The two commands have the same length/params */ - buf = bt_hci_cmd_create(opcode, sizeof(*cp_mask)); + buf = create_cmd(opcode, sizeof(*cp_mask)); TEST_ASSERT_NO_MSG(buf); /* Forward all events */ @@ -464,7 +464,7 @@ static void set_random_address(void) LOG_DBG("%s", bt_addr_str(&addr.a)); - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_RANDOM_ADDRESS, sizeof(addr.a)); + buf = create_cmd(BT_HCI_OP_LE_SET_RANDOM_ADDRESS, sizeof(addr.a)); TEST_ASSERT_NO_MSG(buf); net_buf_add_mem(buf, &addr.a, sizeof(addr.a)); @@ -487,12 +487,12 @@ void start_adv(void) set_param.own_addr_type = BT_HCI_OWN_ADDR_RANDOM; /* configure */ - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_ADV_PARAM, sizeof(set_param)); + buf = create_cmd(BT_HCI_OP_LE_SET_ADV_PARAM, sizeof(set_param)); net_buf_add_mem(buf, &set_param, sizeof(set_param)); send_cmd(BT_HCI_OP_LE_SET_ADV_PARAM, buf, NULL); /* start */ - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_ADV_ENABLE, 1); + buf = create_cmd(BT_HCI_OP_LE_SET_ADV_ENABLE, 1); net_buf_add_u8(buf, BT_HCI_LE_ADV_ENABLE); send_cmd(BT_HCI_OP_LE_SET_ADV_ENABLE, buf, NULL); } diff --git a/tests/bsim/bluetooth/host/att/sequential/tester/src/main.c b/tests/bsim/bluetooth/host/att/sequential/tester/src/main.c index a3622c956c8b..6059b906bcaa 100644 --- a/tests/bsim/bluetooth/host/att/sequential/tester/src/main.c +++ b/tests/bsim/bluetooth/host/att/sequential/tester/src/main.c @@ -61,7 +61,7 @@ static uint16_t conn_handle; static volatile uint16_t active_opcode = 0xFFFF; static struct net_buf *cmd_rsp; -struct net_buf *bt_hci_cmd_create(uint16_t opcode, uint8_t param_len) +static struct net_buf *create_cmd(uint16_t opcode, uint8_t param_len) { struct bt_hci_cmd_hdr *hdr; struct net_buf *buf; @@ -326,7 +326,7 @@ static void send_cmd(uint16_t opcode, struct net_buf *cmd, struct net_buf **rsp) LOG_DBG("opcode %x", opcode); if (!cmd) { - cmd = bt_hci_cmd_create(opcode, 0); + cmd = create_cmd(opcode, 0); } k_sem_take(&cmd_sem, K_FOREVER); @@ -397,7 +397,7 @@ static void read_max_data_len(uint16_t *tx_octets, uint16_t *tx_time) static void write_default_data_len(uint16_t tx_octets, uint16_t tx_time) { struct bt_hci_cp_le_write_default_data_len *cp; - struct net_buf *buf = bt_hci_cmd_create(BT_HCI_OP_LE_WRITE_DEFAULT_DATA_LEN, sizeof(*cp)); + struct net_buf *buf = create_cmd(BT_HCI_OP_LE_WRITE_DEFAULT_DATA_LEN, sizeof(*cp)); TEST_ASSERT_NO_MSG(buf); @@ -423,7 +423,7 @@ static void set_event_mask(uint16_t opcode) uint64_t mask = 0U; /* The two commands have the same length/params */ - buf = bt_hci_cmd_create(opcode, sizeof(*cp_mask)); + buf = create_cmd(opcode, sizeof(*cp_mask)); TEST_ASSERT_NO_MSG(buf); /* Forward all events */ @@ -441,7 +441,7 @@ static void set_random_address(void) LOG_DBG("%s", bt_addr_str(&addr.a)); - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_RANDOM_ADDRESS, sizeof(addr.a)); + buf = create_cmd(BT_HCI_OP_LE_SET_RANDOM_ADDRESS, sizeof(addr.a)); TEST_ASSERT_NO_MSG(buf); net_buf_add_mem(buf, &addr.a, sizeof(addr.a)); @@ -464,12 +464,12 @@ void start_adv(void) set_param.own_addr_type = BT_HCI_OWN_ADDR_RANDOM; /* configure */ - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_ADV_PARAM, sizeof(set_param)); + buf = create_cmd(BT_HCI_OP_LE_SET_ADV_PARAM, sizeof(set_param)); net_buf_add_mem(buf, &set_param, sizeof(set_param)); send_cmd(BT_HCI_OP_LE_SET_ADV_PARAM, buf, NULL); /* start */ - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_ADV_ENABLE, 1); + buf = create_cmd(BT_HCI_OP_LE_SET_ADV_ENABLE, 1); net_buf_add_u8(buf, BT_HCI_LE_ADV_ENABLE); send_cmd(BT_HCI_OP_LE_SET_ADV_ENABLE, buf, NULL); } diff --git a/tests/bsim/bluetooth/host/l2cap/reassembly/peer/src/peer.c b/tests/bsim/bluetooth/host/l2cap/reassembly/peer/src/peer.c index 8c9532718841..a3e7c20d715a 100644 --- a/tests/bsim/bluetooth/host/l2cap/reassembly/peer/src/peer.c +++ b/tests/bsim/bluetooth/host/l2cap/reassembly/peer/src/peer.c @@ -57,7 +57,7 @@ static uint16_t conn_handle; static volatile uint16_t active_opcode = 0xFFFF; static struct net_buf *cmd_rsp; -struct net_buf *bt_hci_cmd_create(uint16_t opcode, uint8_t param_len) +static struct net_buf *create_cmd(uint16_t opcode, uint8_t param_len) { struct bt_hci_cmd_hdr *hdr; struct net_buf *buf; @@ -279,7 +279,7 @@ static void send_cmd(uint16_t opcode, struct net_buf *cmd, struct net_buf **rsp) LOG_DBG("opcode %x", opcode); if (!cmd) { - cmd = bt_hci_cmd_create(opcode, 0); + cmd = create_cmd(opcode, 0); } k_sem_take(&cmd_sem, K_FOREVER); @@ -352,7 +352,7 @@ static void set_event_mask(uint16_t opcode) uint64_t mask = 0U; /* The two commands have the same length/params */ - buf = bt_hci_cmd_create(opcode, sizeof(*cp_mask)); + buf = create_cmd(opcode, sizeof(*cp_mask)); TEST_ASSERT_NO_MSG(buf); /* Forward all events */ @@ -370,7 +370,7 @@ static void set_random_address(void) LOG_DBG("%s", bt_addr_str(&addr.a)); - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_RANDOM_ADDRESS, sizeof(addr.a)); + buf = create_cmd(BT_HCI_OP_LE_SET_RANDOM_ADDRESS, sizeof(addr.a)); TEST_ASSERT_NO_MSG(buf); net_buf_add_mem(buf, &addr.a, sizeof(addr.a)); @@ -392,7 +392,7 @@ static void start_adv(uint16_t interval, const char *name, size_t name_len) data.data[1] = BT_DATA_NAME_COMPLETE; memcpy(&data.data[2], name, name_len); - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_ADV_DATA, sizeof(data)); + buf = create_cmd(BT_HCI_OP_LE_SET_ADV_DATA, sizeof(data)); __ASSERT_NO_MSG(buf); net_buf_add_mem(buf, &data, sizeof(data)); send_cmd(BT_HCI_OP_LE_SET_ADV_DATA, buf, NULL); @@ -405,13 +405,13 @@ static void start_adv(uint16_t interval, const char *name, size_t name_len) set_param.type = BT_HCI_ADV_IND; set_param.own_addr_type = BT_HCI_OWN_ADDR_RANDOM; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_ADV_PARAM, sizeof(set_param)); + buf = create_cmd(BT_HCI_OP_LE_SET_ADV_PARAM, sizeof(set_param)); __ASSERT_NO_MSG(buf); net_buf_add_mem(buf, &set_param, sizeof(set_param)); send_cmd(BT_HCI_OP_LE_SET_ADV_PARAM, buf, NULL); - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_ADV_ENABLE, 1); + buf = create_cmd(BT_HCI_OP_LE_SET_ADV_ENABLE, 1); __ASSERT_NO_MSG(buf); net_buf_add_u8(buf, BT_HCI_LE_ADV_ENABLE); @@ -427,7 +427,7 @@ static void disconnect(void) LOG_INF("Disconnecting"); - buf = bt_hci_cmd_create(BT_HCI_OP_DISCONNECT, sizeof(*disconn)); + buf = create_cmd(BT_HCI_OP_DISCONNECT, sizeof(*disconn)); TEST_ASSERT(buf); disconn = net_buf_add(buf, sizeof(*disconn)); diff --git a/tests/bsim/bluetooth/host/l2cap/split/tester/src/main.c b/tests/bsim/bluetooth/host/l2cap/split/tester/src/main.c index dc7e72d91d0e..e7c559b83a23 100644 --- a/tests/bsim/bluetooth/host/l2cap/split/tester/src/main.c +++ b/tests/bsim/bluetooth/host/l2cap/split/tester/src/main.c @@ -49,7 +49,7 @@ static uint16_t conn_handle; static uint16_t active_opcode = 0xFFFF; static struct net_buf *cmd_rsp; -struct net_buf *bt_hci_cmd_create(uint16_t opcode, uint8_t param_len) +static struct net_buf *create_cmd(uint16_t opcode, uint8_t param_len) { struct bt_hci_cmd_hdr *hdr; struct net_buf *buf; @@ -306,7 +306,7 @@ static void send_cmd(uint16_t opcode, struct net_buf *cmd, struct net_buf **rsp) LOG_DBG("opcode %x", opcode); if (!cmd) { - cmd = bt_hci_cmd_create(opcode, 0); + cmd = create_cmd(opcode, 0); } k_sem_take(&cmd_sem, K_FOREVER); @@ -377,7 +377,7 @@ static void read_max_data_len(uint16_t *tx_octets, uint16_t *tx_time) static void write_default_data_len(uint16_t tx_octets, uint16_t tx_time) { struct bt_hci_cp_le_write_default_data_len *cp; - struct net_buf *buf = bt_hci_cmd_create(BT_HCI_OP_LE_WRITE_DEFAULT_DATA_LEN, sizeof(*cp)); + struct net_buf *buf = create_cmd(BT_HCI_OP_LE_WRITE_DEFAULT_DATA_LEN, sizeof(*cp)); __ASSERT_NO_MSG(buf); @@ -403,7 +403,7 @@ static void set_event_mask(uint16_t opcode) uint64_t mask = 0U; /* The two commands have the same length/params */ - buf = bt_hci_cmd_create(opcode, sizeof(*cp_mask)); + buf = create_cmd(opcode, sizeof(*cp_mask)); __ASSERT_NO_MSG(buf); /* Forward all events */ @@ -421,7 +421,7 @@ static void set_random_address(void) LOG_DBG("%s", bt_addr_str(&addr.a)); - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_RANDOM_ADDRESS, sizeof(addr.a)); + buf = create_cmd(BT_HCI_OP_LE_SET_RANDOM_ADDRESS, sizeof(addr.a)); __ASSERT_NO_MSG(buf); net_buf_add_mem(buf, &addr.a, sizeof(addr.a)); @@ -442,13 +442,13 @@ void start_adv(uint16_t interval) set_param.type = BT_HCI_ADV_IND; set_param.own_addr_type = BT_HCI_OWN_ADDR_RANDOM; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_ADV_PARAM, sizeof(set_param)); + buf = create_cmd(BT_HCI_OP_LE_SET_ADV_PARAM, sizeof(set_param)); __ASSERT_NO_MSG(buf); net_buf_add_mem(buf, &set_param, sizeof(set_param)); send_cmd(BT_HCI_OP_LE_SET_ADV_PARAM, buf, NULL); - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_ADV_ENABLE, 1); + buf = create_cmd(BT_HCI_OP_LE_SET_ADV_ENABLE, 1); __ASSERT_NO_MSG(buf); net_buf_add_u8(buf, BT_HCI_LE_ADV_ENABLE); diff --git a/tests/bsim/bluetooth/host/misc/disconnect/tester/src/main.c b/tests/bsim/bluetooth/host/misc/disconnect/tester/src/main.c index a4fdb5ab1496..32189870581d 100644 --- a/tests/bsim/bluetooth/host/misc/disconnect/tester/src/main.c +++ b/tests/bsim/bluetooth/host/misc/disconnect/tester/src/main.c @@ -59,7 +59,7 @@ static uint16_t conn_handle; static volatile uint16_t active_opcode = 0xFFFF; static struct net_buf *cmd_rsp; -struct net_buf *bt_hci_cmd_create(uint16_t opcode, uint8_t param_len) +static struct net_buf *create_cmd(uint16_t opcode, uint8_t param_len) { struct bt_hci_cmd_hdr *hdr; struct net_buf *buf; @@ -303,7 +303,7 @@ static void send_cmd(uint16_t opcode, struct net_buf *cmd, struct net_buf **rsp) LOG_DBG("opcode %x", opcode); if (!cmd) { - cmd = bt_hci_cmd_create(opcode, 0); + cmd = create_cmd(opcode, 0); } k_sem_take(&cmd_sem, K_FOREVER); @@ -374,7 +374,7 @@ static void read_max_data_len(uint16_t *tx_octets, uint16_t *tx_time) static void write_default_data_len(uint16_t tx_octets, uint16_t tx_time) { struct bt_hci_cp_le_write_default_data_len *cp; - struct net_buf *buf = bt_hci_cmd_create(BT_HCI_OP_LE_WRITE_DEFAULT_DATA_LEN, sizeof(*cp)); + struct net_buf *buf = create_cmd(BT_HCI_OP_LE_WRITE_DEFAULT_DATA_LEN, sizeof(*cp)); TEST_ASSERT_NO_MSG(buf); @@ -400,7 +400,7 @@ static void set_event_mask(uint16_t opcode) uint64_t mask = 0U; /* The two commands have the same length/params */ - buf = bt_hci_cmd_create(opcode, sizeof(*cp_mask)); + buf = create_cmd(opcode, sizeof(*cp_mask)); TEST_ASSERT_NO_MSG(buf); /* Forward all events */ @@ -418,7 +418,7 @@ static void set_random_address(void) LOG_DBG("%s", bt_addr_str(&addr.a)); - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_RANDOM_ADDRESS, sizeof(addr.a)); + buf = create_cmd(BT_HCI_OP_LE_SET_RANDOM_ADDRESS, sizeof(addr.a)); TEST_ASSERT_NO_MSG(buf); net_buf_add_mem(buf, &addr.a, sizeof(addr.a)); @@ -441,12 +441,12 @@ void start_adv(void) set_param.own_addr_type = BT_HCI_OWN_ADDR_RANDOM; /* configure */ - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_ADV_PARAM, sizeof(set_param)); + buf = create_cmd(BT_HCI_OP_LE_SET_ADV_PARAM, sizeof(set_param)); net_buf_add_mem(buf, &set_param, sizeof(set_param)); send_cmd(BT_HCI_OP_LE_SET_ADV_PARAM, buf, NULL); /* start */ - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_ADV_ENABLE, 1); + buf = create_cmd(BT_HCI_OP_LE_SET_ADV_ENABLE, 1); net_buf_add_u8(buf, BT_HCI_LE_ADV_ENABLE); send_cmd(BT_HCI_OP_LE_SET_ADV_ENABLE, buf, NULL); } diff --git a/tests/bsim/bluetooth/host/misc/hfc_multilink/tester/src/tester.c b/tests/bsim/bluetooth/host/misc/hfc_multilink/tester/src/tester.c index a06a5af9b92c..f4f38fedc15c 100644 --- a/tests/bsim/bluetooth/host/misc/hfc_multilink/tester/src/tester.c +++ b/tests/bsim/bluetooth/host/misc/hfc_multilink/tester/src/tester.c @@ -50,7 +50,7 @@ static uint16_t conn_handle; static uint16_t active_opcode = 0xFFFF; static struct net_buf *cmd_rsp; -struct net_buf *bt_hci_cmd_create(uint16_t opcode, uint8_t param_len) +static struct net_buf *create_cmd(uint16_t opcode, uint8_t param_len) { struct bt_hci_cmd_hdr *hdr; struct net_buf *buf; @@ -317,7 +317,7 @@ static void send_cmd(uint16_t opcode, struct net_buf *cmd, struct net_buf **rsp) LOG_DBG("opcode %x", opcode); if (!cmd) { - cmd = bt_hci_cmd_create(opcode, 0); + cmd = create_cmd(opcode, 0); } k_sem_take(&cmd_sem, K_FOREVER); @@ -388,7 +388,7 @@ static void read_max_data_len(uint16_t *tx_octets, uint16_t *tx_time) static void write_default_data_len(uint16_t tx_octets, uint16_t tx_time) { struct bt_hci_cp_le_write_default_data_len *cp; - struct net_buf *buf = bt_hci_cmd_create(BT_HCI_OP_LE_WRITE_DEFAULT_DATA_LEN, sizeof(*cp)); + struct net_buf *buf = create_cmd(BT_HCI_OP_LE_WRITE_DEFAULT_DATA_LEN, sizeof(*cp)); __ASSERT_NO_MSG(buf); @@ -414,7 +414,7 @@ static void set_event_mask(uint16_t opcode) uint64_t mask = 0U; /* The two commands have the same length/params */ - buf = bt_hci_cmd_create(opcode, sizeof(*cp_mask)); + buf = create_cmd(opcode, sizeof(*cp_mask)); __ASSERT_NO_MSG(buf); /* Forward all events */ @@ -435,7 +435,7 @@ static void set_random_address(void) LOG_DBG("%s", bt_addr_str(&addr.a)); - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_RANDOM_ADDRESS, sizeof(addr.a)); + buf = create_cmd(BT_HCI_OP_LE_SET_RANDOM_ADDRESS, sizeof(addr.a)); __ASSERT_NO_MSG(buf); net_buf_add_mem(buf, &addr.a, sizeof(addr.a)); @@ -457,7 +457,7 @@ static void start_adv(uint16_t interval, const char *name, size_t name_len) data.data[1] = BT_DATA_NAME_COMPLETE; memcpy(&data.data[2], name, name_len); - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_ADV_DATA, sizeof(data)); + buf = create_cmd(BT_HCI_OP_LE_SET_ADV_DATA, sizeof(data)); __ASSERT_NO_MSG(buf); net_buf_add_mem(buf, &data, sizeof(data)); send_cmd(BT_HCI_OP_LE_SET_ADV_DATA, buf, NULL); @@ -470,13 +470,13 @@ static void start_adv(uint16_t interval, const char *name, size_t name_len) set_param.type = BT_HCI_ADV_IND; set_param.own_addr_type = BT_HCI_OWN_ADDR_RANDOM; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_ADV_PARAM, sizeof(set_param)); + buf = create_cmd(BT_HCI_OP_LE_SET_ADV_PARAM, sizeof(set_param)); __ASSERT_NO_MSG(buf); net_buf_add_mem(buf, &set_param, sizeof(set_param)); send_cmd(BT_HCI_OP_LE_SET_ADV_PARAM, buf, NULL); - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_ADV_ENABLE, 1); + buf = create_cmd(BT_HCI_OP_LE_SET_ADV_ENABLE, 1); __ASSERT_NO_MSG(buf); net_buf_add_u8(buf, BT_HCI_LE_ADV_ENABLE); From c890bf3f332b38e6a53969c5ab1198fc394ff727 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Fri, 27 Jun 2025 14:28:52 +0530 Subject: [PATCH 0158/2141] [nrf fromtree] modules: nrf_wifi: Implement new Raw TX APIs The new raw TX handling relies on these APIs, so, implement them for Zephyr shim. Signed-off-by: Chaitanya Tata (cherry picked from commit b8d31f10d9e7052bbcdad7f68522340d8af17399) --- modules/nrf_wifi/os/shim.c | 57 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/modules/nrf_wifi/os/shim.c b/modules/nrf_wifi/os/shim.c index b892d50df7f4..29b72203b552 100644 --- a/modules/nrf_wifi/os/shim.c +++ b/modules/nrf_wifi/os/shim.c @@ -275,6 +275,9 @@ struct nwb { void (*cleanup_cb)(); unsigned char priority; bool chksum_done; +#ifdef CONFIG_NRF70_RAW_DATA_TX + void *raw_tx_hdr; +#endif /* CONFIG_NRF70_RAW_DATA_TX */ #ifdef CONFIG_NRF_WIFI_ZERO_COPY_TX struct net_pkt *pkt; #endif @@ -400,6 +403,55 @@ static void zep_shim_nbuf_set_chksum_done(void *nbuf, unsigned char chksum_done) nwb->chksum_done = (bool)chksum_done; } +#ifdef CONFIG_NRF70_RAW_DATA_TX +static void *zep_shim_nbuf_set_raw_tx_hdr(void *nbuf, unsigned short raw_hdr_len) +{ + struct nwb *nwb = (struct nwb *)nbuf; + + if (!nwb) { + LOG_ERR("%s: Received network buffer is NULL", __func__); + return NULL; + } + + nwb->raw_tx_hdr = zep_shim_nbuf_data_get(nwb); + if (!nwb->raw_tx_hdr) { + LOG_ERR("%s: Unable to set raw Tx header in network buffer", __func__); + return NULL; + } + + zep_shim_nbuf_data_pull(nwb, raw_hdr_len); + + return nwb->raw_tx_hdr; +} + +static void *zep_shim_nbuf_get_raw_tx_hdr(void *nbuf) +{ + struct nwb *nwb = (struct nwb *)nbuf; + + if (!nwb) { + LOG_ERR("%s: Received network buffer is NULL", __func__); + return NULL; + } + + return nwb->raw_tx_hdr; +} + +static bool zep_shim_nbuf_is_raw_tx(void *nbuf) +{ + struct nwb *nwb = (struct nwb *)nbuf; + + if (!nwb) { + LOG_ERR("%s: Received network buffer is NULL", __func__); + return false; + } + + return (nwb->raw_tx_hdr != NULL); +} +#endif /* CONFIG_NRF70_RAW_DATA_TX */ + + + + #include #include @@ -1192,6 +1244,11 @@ const struct nrf_wifi_osal_ops nrf_wifi_os_zep_ops = { .nbuf_get_priority = zep_shim_nbuf_get_priority, .nbuf_get_chksum_done = zep_shim_nbuf_get_chksum_done, .nbuf_set_chksum_done = zep_shim_nbuf_set_chksum_done, +#ifdef CONFIG_NRF70_RAW_DATA_TX + .nbuf_set_raw_tx_hdr = zep_shim_nbuf_set_raw_tx_hdr, + .nbuf_get_raw_tx_hdr = zep_shim_nbuf_get_raw_tx_hdr, + .nbuf_is_raw_tx = zep_shim_nbuf_is_raw_tx, +#endif /* CONFIG_NRF70_RAW_DATA_TX */ .tasklet_alloc = zep_shim_work_alloc, .tasklet_free = zep_shim_work_free, From 8e678b1e03730e0876608a8b6431ff6a8a1adcd4 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Mon, 30 Jun 2025 02:15:45 +0530 Subject: [PATCH 0159/2141] [nrf fromtree] manifest: nrf_wifi: Pull new raw TX handling Fixes the issue of leave the packets in the pending queue till a new TX comes. Signed-off-by: Chaitanya Tata (cherry picked from commit ae198b8169601fc5a55e0423c04ffdf0fb013bdd) --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index d3a70e368671..9807058ac13b 100644 --- a/west.yml +++ b/west.yml @@ -328,7 +328,7 @@ manifest: revision: 968d55ff22579080466bf2f482596dd6e35361c6 path: modules/bsim_hw_models/nrf_hw_models - name: nrf_wifi - revision: 7cb2f44f46dfc86e4f97477ee90022944e138dd8 + revision: 52286f111b4765e0dd40f43124e7bb5c14758dff path: modules/lib/nrf_wifi - name: open-amp revision: f7f4d083c7909a39d86e217376c69b416ec4faf3 From d8c362172b5a281113bd285540f6eadd4ca40280 Mon Sep 17 00:00:00 2001 From: Olivier Lesage Date: Tue, 8 Jul 2025 10:43:32 +0200 Subject: [PATCH 0160/2141] [nrf fromtree] bluetooth: host: Fix uninitialized own_addr_type for legacy scan+adv In 25c993e5b74562137c2951db01c8a8d200e98d3d a new case was introduced where own_addr_type is not set by bt_id_set_scan_own_addr properly. This led to issues for users where increasing their zephyr version led to failures to start scanning after advertising in the case where CONFIG_BT_SCAN_WITH_IDENTITY=n and legacy advertising commands are used. Signed-off-by: Olivier Lesage (cherry picked from commit 43223a166118007f9658e1763502e9abe35e5928) --- subsys/bluetooth/host/id.c | 54 ++++++++++--- .../id/bt_id_set_scan_own_addr/src/main.c | 77 +++++++++++++++++++ .../id/bt_id_set_scan_own_addr/testcase.yaml | 4 + 3 files changed, 123 insertions(+), 12 deletions(-) diff --git a/subsys/bluetooth/host/id.c b/subsys/bluetooth/host/id.c index af5176574eb0..96c2f4e988ae 100644 --- a/subsys/bluetooth/host/id.c +++ b/subsys/bluetooth/host/id.c @@ -1778,7 +1778,7 @@ int bt_id_set_create_conn_own_addr(bool use_filter, uint8_t *own_addr_type) #endif /* defined(CONFIG_BT_CENTRAL) */ #if defined(CONFIG_BT_OBSERVER) -static bool is_adv_using_rand_addr(void) +static bool is_legacy_adv_enabled(void) { struct bt_le_ext_adv *adv; @@ -1794,7 +1794,27 @@ static bool is_adv_using_rand_addr(void) adv = bt_le_adv_lookup_legacy(); - return adv && atomic_test_bit(adv->flags, BT_ADV_ENABLED); + return adv != NULL && atomic_test_bit(adv->flags, BT_ADV_ENABLED); +} + +static bool is_legacy_adv_using_id_addr(void) +{ + struct bt_le_ext_adv *adv; + + if (!IS_ENABLED(CONFIG_BT_BROADCASTER) || + (IS_ENABLED(CONFIG_BT_EXT_ADV) && + BT_DEV_FEAT_LE_EXT_ADV(bt_dev.le.features))) { + /* When advertising is not enabled or is using extended + * advertising HCI commands then only the scanner uses the set + * random address command. + */ + return false; + } + + adv = bt_le_adv_lookup_legacy(); + + return adv != NULL && atomic_test_bit(adv->flags, BT_ADV_ENABLED) + && atomic_test_bit(adv->flags, BT_ADV_USE_IDENTITY); } int bt_id_set_scan_own_addr(bool active_scan, uint8_t *own_addr_type) @@ -1827,20 +1847,30 @@ int bt_id_set_scan_own_addr(bool active_scan, uint8_t *own_addr_type) * (through Kconfig). * Use same RPA as legacy advertiser if advertising. */ - if (!IS_ENABLED(CONFIG_BT_SCAN_WITH_IDENTITY) && - !is_adv_using_rand_addr()) { - err = bt_id_set_private_addr(BT_ID_DEFAULT); - if (err) { - if (active_scan || !is_adv_using_rand_addr()) { + if (!IS_ENABLED(CONFIG_BT_SCAN_WITH_IDENTITY)) { + /* When using legacy advertising commands, the scanner and advertiser + * share the same address, so we cannot change it. + * When using extended advertising commands, however, the advertising + * sets have their own addresses, so we can always change the scanner + * address here. + */ + if (is_legacy_adv_using_id_addr()) { + if (bt_dev.id_addr[BT_ID_DEFAULT].type == BT_ADDR_LE_RANDOM) { + *own_addr_type = BT_HCI_OWN_ADDR_RANDOM; + } else { + *own_addr_type = BT_HCI_OWN_ADDR_PUBLIC; + } + } else if (is_legacy_adv_enabled()) { + *own_addr_type = BT_HCI_OWN_ADDR_RANDOM; + } else { + err = bt_id_set_private_addr(BT_ID_DEFAULT); + if (err) { return err; } - LOG_WRN("Ignoring failure to set address for passive scan (%d)", - err); + *own_addr_type = BT_HCI_OWN_ADDR_RANDOM; } - - *own_addr_type = BT_HCI_OWN_ADDR_RANDOM; - } else if (IS_ENABLED(CONFIG_BT_SCAN_WITH_IDENTITY)) { + } else { if (bt_dev.id_addr[BT_ID_DEFAULT].type == BT_ADDR_LE_RANDOM) { /* If scanning with Identity Address we must set the * random identity address for both active and passive diff --git a/tests/bluetooth/host/id/bt_id_set_scan_own_addr/src/main.c b/tests/bluetooth/host/id/bt_id_set_scan_own_addr/src/main.c index c39411897cd9..2c1fbc675d71 100644 --- a/tests/bluetooth/host/id/bt_id_set_scan_own_addr/src/main.c +++ b/tests/bluetooth/host/id/bt_id_set_scan_own_addr/src/main.c @@ -7,6 +7,8 @@ #include "mocks/crypto.h" #include "mocks/hci_core.h" #include "mocks/rpa.h" +#include "mocks/adv.h" +#include "mocks/adv_expects.h" #include "testing_common_defs.h" #include @@ -75,6 +77,81 @@ ZTEST(bt_id_set_scan_own_addr, test_set_nrpa_scan_address_no_privacy) "Address type reference was incorrectly set"); } +/* + * Test setting scan own address while 'CONFIG_BT_PRIVACY' isn't enabled. + * Advertising is ongoing and uses a random device address. + * + * Constraints: + * - bt_id_set_private_addr() succeeds and returns 0 + * - 'CONFIG_BT_SCAN_WITH_IDENTITY' isn't enabled + * - 'CONFIG_BT_PRIVACY' isn't enabled + * + * Expected behaviour: + * - bt_id_set_scan_own_addr() returns 0 + * - Address type reference is updated + */ +ZTEST(bt_id_set_scan_own_addr, test_set_nrpa_scan_address_no_privacy_adv_ongoing_random_identity) +{ + int err; + struct bt_le_ext_adv *adv = &bt_dev.adv; + uint8_t own_addr_type = BT_ADDR_LE_ANONYMOUS; + + Z_TEST_SKIP_IFDEF(CONFIG_BT_PRIVACY); + Z_TEST_SKIP_IFDEF(CONFIG_BT_SCAN_WITH_IDENTITY); + Z_TEST_SKIP_IFNDEF(CONFIG_BT_BROADCASTER); + + bt_rand_fake.custom_fake = bt_rand_custom_fake; + bt_le_adv_lookup_legacy_fake.return_val = adv; + + bt_addr_le_copy(&bt_dev.id_addr[BT_ID_DEFAULT], BT_STATIC_RANDOM_LE_ADDR_1); + + atomic_set_bit(adv->flags, BT_ADV_ENABLED); + + err = bt_id_set_scan_own_addr(false, &own_addr_type); + + zassert_ok(err, "Unexpected error code '%d' was returned", err); + zassert_true(own_addr_type == BT_HCI_OWN_ADDR_RANDOM, + "Address type reference was incorrectly set"); +} + +/* + * Test setting scan own address while 'CONFIG_BT_PRIVACY' isn't enabled. + * Advertising is ongoing and uses a public device address. + * + * Constraints: + * - bt_id_set_private_addr() succeeds and returns 0 + * - 'CONFIG_BT_SCAN_WITH_IDENTITY' isn't enabled + * - 'CONFIG_BT_PRIVACY' isn't enabled + * + * Expected behaviour: + * - bt_id_set_scan_own_addr() returns 0 + * - Address type reference is updated + */ +ZTEST(bt_id_set_scan_own_addr, test_set_nrpa_scan_address_no_privacy_adv_ongoing_public_identity) +{ + int err; + struct bt_le_ext_adv *adv = &bt_dev.adv; + uint8_t own_addr_type = BT_ADDR_LE_ANONYMOUS; + + Z_TEST_SKIP_IFDEF(CONFIG_BT_PRIVACY); + Z_TEST_SKIP_IFDEF(CONFIG_BT_SCAN_WITH_IDENTITY); + Z_TEST_SKIP_IFNDEF(CONFIG_BT_BROADCASTER); + + bt_rand_fake.custom_fake = bt_rand_custom_fake; + bt_le_adv_lookup_legacy_fake.return_val = adv; + + bt_addr_le_copy(&bt_dev.id_addr[BT_ID_DEFAULT], BT_LE_ADDR); + + atomic_set_bit(adv->flags, BT_ADV_ENABLED); + atomic_set_bit(adv->flags, BT_ADV_USE_IDENTITY); + + err = bt_id_set_scan_own_addr(false, &own_addr_type); + + zassert_ok(err, "Unexpected error code '%d' was returned", err); + zassert_true(own_addr_type == BT_HCI_OWN_ADDR_PUBLIC, + "Address type reference was incorrectly set"); +} + /* * Test setting scan own address while 'CONFIG_BT_PRIVACY' isn't enabled. * If 'CONFIG_BT_SCAN_WITH_IDENTITY' is enabled and the default identity has an RPA address of type diff --git a/tests/bluetooth/host/id/bt_id_set_scan_own_addr/testcase.yaml b/tests/bluetooth/host/id/bt_id_set_scan_own_addr/testcase.yaml index 4198d2bf91b4..7e3cab5ce37e 100644 --- a/tests/bluetooth/host/id/bt_id_set_scan_own_addr/testcase.yaml +++ b/tests/bluetooth/host/id/bt_id_set_scan_own_addr/testcase.yaml @@ -20,3 +20,7 @@ tests: - CONFIG_BT_SCAN_WITH_IDENTITY=y - CONFIG_BT_SMP=y - CONFIG_BT_PRIVACY=y + bluetooth.host.bt_id_set_scan_own_addr.scan_while_advertising: + type: unit + extra_configs: + - CONFIG_BT_BROADCASTER=y From 2d8cdbbd2959dc284e61966e3cbbaf6309374604 Mon Sep 17 00:00:00 2001 From: Olivier Lesage Date: Tue, 17 Jun 2025 13:08:46 +0200 Subject: [PATCH 0161/2141] [nrf fromtree] bluetooth: host: rename bool scan_enabled -> scan_disabled It represents whether scanning was disabled as part of this flow. Signed-off-by: Olivier Lesage (cherry picked from commit 11782dbbc032a7516125c5a797e396b9765689e6) --- subsys/bluetooth/host/id.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/subsys/bluetooth/host/id.c b/subsys/bluetooth/host/id.c index 96c2f4e988ae..e791516e74c8 100644 --- a/subsys/bluetooth/host/id.c +++ b/subsys/bluetooth/host/id.c @@ -1986,13 +1986,13 @@ int bt_id_set_adv_own_addr(struct bt_le_ext_adv *adv, uint32_t options, * problem. */ #if defined(CONFIG_BT_OBSERVER) - bool scan_enabled = false; + bool scan_disabled = false; /* If active scan with NRPA is ongoing refresh NRPA */ if (!IS_ENABLED(CONFIG_BT_PRIVACY) && !IS_ENABLED(CONFIG_BT_SCAN_WITH_IDENTITY) && atomic_test_bit(bt_dev.flags, BT_DEV_SCANNING)) { - scan_enabled = true; + scan_disabled = true; bt_le_scan_set_enable(BT_HCI_LE_SCAN_DISABLE); } #endif /* defined(CONFIG_BT_OBSERVER) */ @@ -2000,7 +2000,7 @@ int bt_id_set_adv_own_addr(struct bt_le_ext_adv *adv, uint32_t options, *own_addr_type = BT_HCI_OWN_ADDR_RANDOM; #if defined(CONFIG_BT_OBSERVER) - if (scan_enabled) { + if (scan_disabled) { bt_le_scan_set_enable(BT_HCI_LE_SCAN_ENABLE); } #endif /* defined(CONFIG_BT_OBSERVER) */ From 3abc5c2cc2a78873ddc7f5971a82207b3ad6c619 Mon Sep 17 00:00:00 2001 From: Olivier Lesage Date: Wed, 2 Jul 2025 08:52:33 +0200 Subject: [PATCH 0162/2141] [nrf fromtree] bluetooth: host: Do not try to set NRPA when scanning with identity Attempting this would fail (assuming the controller is implemented correctly) because when using legacy commands it is not allowed to change the device address while scanning. It also did not make sense. If we have configured the scanner to use the identity address as own_addr, because the advertiser and scanner addresses are shared when using legacy commands, setting the adv NRPA here would overwrite the identity address used by the scanner, which I assume is not the intention. Signed-off-by: Olivier Lesage (cherry picked from commit ef7ede64cce712b7cae1e8dde0d078b9cf55c3ca) --- subsys/bluetooth/host/id.c | 26 ++++- .../host/id/bt_id_set_adv_own_addr/src/main.c | 102 ++++++++++++++++++ .../id/bt_id_set_adv_own_addr/testcase.yaml | 4 + 3 files changed, 127 insertions(+), 5 deletions(-) diff --git a/subsys/bluetooth/host/id.c b/subsys/bluetooth/host/id.c index e791516e74c8..12e8e823aaaa 100644 --- a/subsys/bluetooth/host/id.c +++ b/subsys/bluetooth/host/id.c @@ -1987,22 +1987,38 @@ int bt_id_set_adv_own_addr(struct bt_le_ext_adv *adv, uint32_t options, */ #if defined(CONFIG_BT_OBSERVER) bool scan_disabled = false; + bool dev_scanning = atomic_test_bit(bt_dev.flags, + BT_DEV_SCANNING); /* If active scan with NRPA is ongoing refresh NRPA */ if (!IS_ENABLED(CONFIG_BT_PRIVACY) && !IS_ENABLED(CONFIG_BT_SCAN_WITH_IDENTITY) && - atomic_test_bit(bt_dev.flags, BT_DEV_SCANNING)) { + dev_scanning) { scan_disabled = true; bt_le_scan_set_enable(BT_HCI_LE_SCAN_DISABLE); } -#endif /* defined(CONFIG_BT_OBSERVER) */ - err = bt_id_set_adv_private_addr(adv); - *own_addr_type = BT_HCI_OWN_ADDR_RANDOM; -#if defined(CONFIG_BT_OBSERVER) + /* If we are scanning with the identity address, it does + * not make sense to set an NRPA. + */ + if (!IS_ENABLED(CONFIG_BT_SCAN_WITH_IDENTITY) || + !dev_scanning) { + err = bt_id_set_adv_private_addr(adv); + *own_addr_type = BT_HCI_OWN_ADDR_RANDOM; + } else { + if (id_addr->type == BT_ADDR_LE_RANDOM) { + *own_addr_type = BT_HCI_OWN_ADDR_RANDOM; + } else if (id_addr->type == BT_ADDR_LE_PUBLIC) { + *own_addr_type = BT_HCI_OWN_ADDR_PUBLIC; + } + } + if (scan_disabled) { bt_le_scan_set_enable(BT_HCI_LE_SCAN_ENABLE); } +#else + err = bt_id_set_adv_private_addr(adv); + *own_addr_type = BT_HCI_OWN_ADDR_RANDOM; #endif /* defined(CONFIG_BT_OBSERVER) */ } else { err = bt_id_set_adv_private_addr(adv); diff --git a/tests/bluetooth/host/id/bt_id_set_adv_own_addr/src/main.c b/tests/bluetooth/host/id/bt_id_set_adv_own_addr/src/main.c index 29c500e9840c..8304906d37e3 100644 --- a/tests/bluetooth/host/id/bt_id_set_adv_own_addr/src/main.c +++ b/tests/bluetooth/host/id/bt_id_set_adv_own_addr/src/main.c @@ -7,6 +7,10 @@ #include "mocks/crypto.h" #include "mocks/scan.h" #include "mocks/scan_expects.h" +#include "mocks/hci_core.h" +#include "mocks/hci_core_expects.h" +#include "mocks/net_buf.h" +#include "mocks/net_buf_expects.h" #include "testing_common_defs.h" #include @@ -24,6 +28,7 @@ static void fff_reset_rule_before(const struct ztest_unit_test *test, void *fixt memset(&bt_dev, 0x00, sizeof(struct bt_dev)); CRYPTO_FFF_FAKES_LIST(RESET_FAKE); + HCI_CORE_FFF_FAKES_LIST(RESET_FAKE); } ZTEST_RULE(fff_reset_rule, fff_reset_rule_before, NULL); @@ -232,6 +237,7 @@ ZTEST(bt_id_set_adv_own_addr, test_observer_scanning_re_enabled_after_updating_a Z_TEST_SKIP_IFDEF(CONFIG_BT_PRIVACY); Z_TEST_SKIP_IFDEF(CONFIG_BT_EXT_ADV); + Z_TEST_SKIP_IFDEF(CONFIG_BT_SCAN_WITH_IDENTITY); Z_TEST_SKIP_IFNDEF(CONFIG_BT_OBSERVER); options &= ~BT_LE_ADV_OPT_CONN; @@ -241,6 +247,102 @@ ZTEST(bt_id_set_adv_own_addr, test_observer_scanning_re_enabled_after_updating_a atomic_set_bit(bt_dev.flags, BT_DEV_SCANNING); bt_id_set_adv_own_addr(&adv, options, true, &own_addr_type); + zassert_true(own_addr_type == BT_HCI_OWN_ADDR_RANDOM, + "Address type reference was incorrectly set"); expect_call_count_bt_le_scan_set_enable(2, expected_args_history); } + +/* + * Test setting the advertiser address while 'CONFIG_BT_SCAN_WITH_IDENTITY' is enabled + * and scanning is ongoing. The scanner is using a random identity address. + * + * Constraints: + * - Options 'BT_LE_ADV_OPT_CONN' bit isn't set + * + * Expected behaviour: + * - Scanning is not disabled. + * - The advertiser doesn't attempt to change the identity addr with bt_id_set_adv_private_addr() + * - The advertiser uses the same identity address as the scanner. + */ +ZTEST(bt_id_set_adv_own_addr, test_set_adv_own_addr_while_scanning_with_identity_random) +{ + uint32_t options = 0; + struct bt_le_ext_adv adv = {0}; + struct net_buf net_buff; + int err; + uint8_t scan_own_addr_type = BT_ADDR_LE_ANONYMOUS; + uint8_t adv_own_addr_type = BT_ADDR_LE_ANONYMOUS; + + Z_TEST_SKIP_IFDEF(CONFIG_BT_PRIVACY); + Z_TEST_SKIP_IFDEF(CONFIG_BT_EXT_ADV); + Z_TEST_SKIP_IFNDEF(CONFIG_BT_OBSERVER); + Z_TEST_SKIP_IFNDEF(CONFIG_BT_SCAN_WITH_IDENTITY); + + bt_hci_cmd_alloc_fake.return_val = &net_buff; + bt_hci_cmd_send_sync_fake.return_val = 0; + + options &= ~BT_LE_ADV_OPT_CONN; + bt_addr_le_copy(&bt_dev.id_addr[BT_ID_DEFAULT], BT_STATIC_RANDOM_LE_ADDR_1); + + err = bt_id_set_scan_own_addr(false, &scan_own_addr_type); + + expect_single_call_bt_hci_cmd_alloc(); + expect_single_call_bt_hci_cmd_send_sync(BT_HCI_OP_LE_SET_RANDOM_ADDRESS); + + zassert_ok(err, "Unexpected error code '%d' was returned", err); + zassert_true(scan_own_addr_type == BT_HCI_OWN_ADDR_RANDOM, + "Address type reference was incorrectly set"); + + atomic_set_bit(bt_dev.flags, BT_DEV_SCANNING); + + bt_id_set_adv_own_addr(&adv, options, true, &adv_own_addr_type); + zassert_true(adv_own_addr_type == BT_HCI_OWN_ADDR_RANDOM, + "Address type reference was incorrectly set"); + + expect_call_count_bt_le_scan_set_enable(0, NULL); +} + +/* + * Test setting the advertiser address while 'CONFIG_BT_SCAN_WITH_IDENTITY' is enabled + * and scanning is ongoing. The scanner is using a public identity address. + * + * Constraints: + * - Options 'BT_LE_ADV_OPT_CONN' bit isn't set + * + * Expected behaviour: + * - Scanning is not disabled. + * - The advertiser doesn't attempt to change the identity addr with bt_id_set_adv_private_addr() + * - The advertiser uses the same identity address as the scanner. + */ +ZTEST(bt_id_set_adv_own_addr, test_set_adv_own_addr_while_scanning_with_identity_public) +{ + uint32_t options = 0; + struct bt_le_ext_adv adv = {0}; + int err; + uint8_t scan_own_addr_type = BT_ADDR_LE_ANONYMOUS; + uint8_t adv_own_addr_type = BT_ADDR_LE_ANONYMOUS; + + Z_TEST_SKIP_IFDEF(CONFIG_BT_PRIVACY); + Z_TEST_SKIP_IFDEF(CONFIG_BT_EXT_ADV); + Z_TEST_SKIP_IFNDEF(CONFIG_BT_OBSERVER); + Z_TEST_SKIP_IFNDEF(CONFIG_BT_SCAN_WITH_IDENTITY); + + options &= ~BT_LE_ADV_OPT_CONN; + + bt_addr_le_copy(&bt_dev.id_addr[BT_ID_DEFAULT], BT_LE_ADDR); + + err = bt_id_set_scan_own_addr(false, &scan_own_addr_type); + + zassert_ok(err, "Unexpected error code '%d' was returned", err); + zassert_true(scan_own_addr_type == BT_HCI_OWN_ADDR_PUBLIC, + "Address type reference was incorrectly set"); + + atomic_set_bit(bt_dev.flags, BT_DEV_SCANNING); + + bt_id_set_adv_own_addr(&adv, options, true, &adv_own_addr_type); + zassert_true(adv_own_addr_type == BT_HCI_OWN_ADDR_PUBLIC, + "Address type reference was incorrectly set"); + + expect_call_count_bt_le_scan_set_enable(0, NULL); +} diff --git a/tests/bluetooth/host/id/bt_id_set_adv_own_addr/testcase.yaml b/tests/bluetooth/host/id/bt_id_set_adv_own_addr/testcase.yaml index 145096d0ce78..d5ab3e4ef858 100644 --- a/tests/bluetooth/host/id/bt_id_set_adv_own_addr/testcase.yaml +++ b/tests/bluetooth/host/id/bt_id_set_adv_own_addr/testcase.yaml @@ -14,3 +14,7 @@ tests: extra_configs: - CONFIG_BT_SMP=y - CONFIG_BT_PRIVACY=y + bluetooth.host.bt_id_set_adv_own_addr.scan_with_identity: + type: unit + extra_configs: + - CONFIG_BT_SCAN_WITH_IDENTITY=y From 6453478e6c8af1d28036f0cb1bd94bf4a994d0c8 Mon Sep 17 00:00:00 2001 From: Olivier Lesage Date: Wed, 2 Jul 2025 08:03:14 +0200 Subject: [PATCH 0163/2141] [nrf fromtree] bluetooth: host: Handle failure to disable scan when updating own_addr It wasn't taken into account that bt_le_scan_set_enable() has a return value. It's not likely that the controller rejects the command when BT_DEV_SCANNING is set, however. Signed-off-by: Olivier Lesage (cherry picked from commit aa4e6ac0ddedd3a1a3a30f0481ffec234fc9cd7c) --- subsys/bluetooth/host/id.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subsys/bluetooth/host/id.c b/subsys/bluetooth/host/id.c index 12e8e823aaaa..e52294cf5386 100644 --- a/subsys/bluetooth/host/id.c +++ b/subsys/bluetooth/host/id.c @@ -1994,8 +1994,8 @@ int bt_id_set_adv_own_addr(struct bt_le_ext_adv *adv, uint32_t options, if (!IS_ENABLED(CONFIG_BT_PRIVACY) && !IS_ENABLED(CONFIG_BT_SCAN_WITH_IDENTITY) && dev_scanning) { - scan_disabled = true; - bt_le_scan_set_enable(BT_HCI_LE_SCAN_DISABLE); + err = bt_le_scan_set_enable(BT_HCI_LE_SCAN_DISABLE); + scan_disabled = err == 0; } /* If we are scanning with the identity address, it does From 7dfaa46a277101953232c2bfbe71f257ad3ca271 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Thu, 29 May 2025 08:09:09 +0200 Subject: [PATCH 0164/2141] [nrf fromtree] dts: pwm: nordic: Add idleout-supported property MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add property which indicates that PWM instance supports IDLEOUT feature. Add property to all instances that supports it. Signed-off-by: Krzysztof Chruściński (cherry picked from commit 28cfb3fecd09ee804cdbf984461ceac70e5305fb) --- dts/bindings/pwm/nordic,nrf-pwm.yaml | 5 +++++ dts/vendor/nordic/nrf54h20.dtsi | 5 +++++ dts/vendor/nordic/nrf54l20.dtsi | 3 +++ dts/vendor/nordic/nrf54l_05_10_15.dtsi | 3 +++ dts/vendor/nordic/nrf9280.dtsi | 5 +++++ 5 files changed, 21 insertions(+) diff --git a/dts/bindings/pwm/nordic,nrf-pwm.yaml b/dts/bindings/pwm/nordic,nrf-pwm.yaml index 8f481d8971c5..e5adfc6ede9a 100644 --- a/dts/bindings/pwm/nordic,nrf-pwm.yaml +++ b/dts/bindings/pwm/nordic,nrf-pwm.yaml @@ -18,6 +18,11 @@ properties: type: boolean description: Set this to use center-aligned (up and down) counter mode. + idleout-supported: + type: boolean + description: | + Indicates if the PWM instance has the IDLEOUT register. + "#pwm-cells": const: 3 diff --git a/dts/vendor/nordic/nrf54h20.dtsi b/dts/vendor/nordic/nrf54h20.dtsi index f907dd7fa2e3..042725a16171 100644 --- a/dts/vendor/nordic/nrf54h20.dtsi +++ b/dts/vendor/nordic/nrf54h20.dtsi @@ -659,6 +659,7 @@ clocks = <&hsfll120>; power-domains = <&gpd NRF_GPD_FAST_ACTIVE1>; #pwm-cells = <3>; + idleout-supported; }; spis120: spi@8e5000 { @@ -1011,6 +1012,7 @@ clocks = <&fll16m>; power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; #pwm-cells = <3>; + idleout-supported; }; i2c130: i2c@9a5000 { @@ -1144,6 +1146,7 @@ clocks = <&fll16m>; power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; #pwm-cells = <3>; + idleout-supported; }; i2c132: i2c@9b5000 { @@ -1277,6 +1280,7 @@ clocks = <&fll16m>; #pwm-cells = <3>; power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; + idleout-supported; }; i2c134: i2c@9c5000 { @@ -1410,6 +1414,7 @@ clocks = <&fll16m>; #pwm-cells = <3>; power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; + idleout-supported; }; i2c136: i2c@9d5000 { diff --git a/dts/vendor/nordic/nrf54l20.dtsi b/dts/vendor/nordic/nrf54l20.dtsi index 4a4e90e75b4e..de63a005c1de 100644 --- a/dts/vendor/nordic/nrf54l20.dtsi +++ b/dts/vendor/nordic/nrf54l20.dtsi @@ -488,6 +488,7 @@ reg = <0xd2000 0x1000>; interrupts = <210 NRF_DEFAULT_IRQ_PRIORITY>; #pwm-cells = <3>; + idleout-supported; }; pwm21: pwm@d3000 { @@ -496,6 +497,7 @@ reg = <0xd3000 0x1000>; interrupts = <211 NRF_DEFAULT_IRQ_PRIORITY>; #pwm-cells = <3>; + idleout-supported; }; pwm22: pwm@d4000 { @@ -504,6 +506,7 @@ reg = <0xd4000 0x1000>; interrupts = <212 NRF_DEFAULT_IRQ_PRIORITY>; #pwm-cells = <3>; + idleout-supported; }; adc: adc@d5000 { diff --git a/dts/vendor/nordic/nrf54l_05_10_15.dtsi b/dts/vendor/nordic/nrf54l_05_10_15.dtsi index 336d642afedf..004454191f01 100644 --- a/dts/vendor/nordic/nrf54l_05_10_15.dtsi +++ b/dts/vendor/nordic/nrf54l_05_10_15.dtsi @@ -477,6 +477,7 @@ reg = <0xd2000 0x1000>; interrupts = <210 NRF_DEFAULT_IRQ_PRIORITY>; #pwm-cells = <3>; + idleout-supported; }; pwm21: pwm@d3000 { @@ -485,6 +486,7 @@ reg = <0xd3000 0x1000>; interrupts = <211 NRF_DEFAULT_IRQ_PRIORITY>; #pwm-cells = <3>; + idleout-supported; }; pwm22: pwm@d4000 { @@ -493,6 +495,7 @@ reg = <0xd4000 0x1000>; interrupts = <212 NRF_DEFAULT_IRQ_PRIORITY>; #pwm-cells = <3>; + idleout-supported; }; adc: adc@d5000 { diff --git a/dts/vendor/nordic/nrf9280.dtsi b/dts/vendor/nordic/nrf9280.dtsi index 06e0a3a15145..fb27488e9dc4 100644 --- a/dts/vendor/nordic/nrf9280.dtsi +++ b/dts/vendor/nordic/nrf9280.dtsi @@ -479,6 +479,7 @@ status = "disabled"; interrupts = <228 NRF_DEFAULT_IRQ_PRIORITY>; #pwm-cells = <3>; + idleout-supported; }; spi120: spi@8e6000 { @@ -767,6 +768,7 @@ status = "disabled"; interrupts = <420 NRF_DEFAULT_IRQ_PRIORITY>; #pwm-cells = <3>; + idleout-supported; }; i2c130: i2c@9a5000 { @@ -881,6 +883,7 @@ status = "disabled"; interrupts = <436 NRF_DEFAULT_IRQ_PRIORITY>; #pwm-cells = <3>; + idleout-supported; }; i2c132: i2c@9b5000 { @@ -995,6 +998,7 @@ status = "disabled"; interrupts = <452 NRF_DEFAULT_IRQ_PRIORITY>; #pwm-cells = <3>; + idleout-supported; }; i2c134: i2c@9c5000 { @@ -1109,6 +1113,7 @@ status = "disabled"; interrupts = <468 NRF_DEFAULT_IRQ_PRIORITY>; #pwm-cells = <3>; + idleout-supported; }; i2c136: i2c@9d5000 { From c1d7194e05c3798e2acc6a461247eb20e5d27a0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Thu, 29 May 2025 08:25:32 +0200 Subject: [PATCH 0165/2141] [nrf fromtree] drivers: pwm: nrfx: Add option to glitch free 100% duty cycle MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit IDLEOUT presence in PWM means that there are 3 sources from which PWM pin can be driven: - GPIO setting when PWM peripheral is disabled. - IDLEOUT setting when PWM is enabled. - PWM Sequence when it is in use. IDLEOUT setting cannot be changed after enabling PWM so it is configured to the initial state of the pin. It means that if duty cycle is 100%, GPIO output is set to 1 but initial pin state was 0 (IDLEOUT setting) there will be a glitch between disabling a PWM sequence and disabling a PWM peripheral. By default, PWM driver tries to disable PWM peripheral if all channels are 0% or 100% duty cycle to safe power. When IDLEOUT feature is present there will be a short glitch on channels with 100% duty cycle. In order to avoid that CONFIG_PWM_NRFX_NO_GLITCH_DUTY_100 option is added (enabled by default). When option is enabled 100% duty cycle is achieved by PWM sequence and not by driving a GPIO pin. It will consume more power in cases where all channels are 0% or 100% with at least one channel set to 100% duty cycle. Signed-off-by: Krzysztof Chruściński (cherry picked from commit 0261d7d96d90e24e01a5125a3bdc9a19eff8d627) --- drivers/pwm/Kconfig.nrfx | 10 ++++++++++ drivers/pwm/pwm_nrfx.c | 19 +++++-------------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/drivers/pwm/Kconfig.nrfx b/drivers/pwm/Kconfig.nrfx index 933fe7cb29c3..d99b5aaf3ab8 100644 --- a/drivers/pwm/Kconfig.nrfx +++ b/drivers/pwm/Kconfig.nrfx @@ -20,3 +20,13 @@ config PWM_NRFX select PINCTRL help Enable support for nrfx Hardware PWM driver for nRF52 MCU series. + +config PWM_NRFX_NO_GLITCH_DUTY_100 + bool "No glitches when using 100% duty" + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_NORDIC_NRF_PWM),idleout-supported,True) + default y + help + Due to how IDLEOUT feature in PWM works it is possible to see a glitch on a channel + with 100% duty cycle when all other channels switches to 0% or 100%. Enabling this + option ensures that there are no glitches but it also means that 100% duty cycle + on any channels requires PWM peripheral to be active. diff --git a/drivers/pwm/pwm_nrfx.c b/drivers/pwm/pwm_nrfx.c index ec55bef69604..6a106c128412 100644 --- a/drivers/pwm/pwm_nrfx.c +++ b/drivers/pwm/pwm_nrfx.c @@ -240,6 +240,9 @@ static int pwm_nrfx_set_cycles(const struct device *dev, uint32_t channel, /* Constantly active (duty 100%). */ /* This value is always greater than or equal to COUNTERTOP. */ compare_value = PWM_NRFX_CH_COMPARE_MASK; + needs_pwm = pwm_is_fast(config) || + (IS_ENABLED(NRF_PWM_HAS_IDLEOUT) && + IS_ENABLED(CONFIG_PWM_NRFX_NO_GLITCH_DUTY_100)); } else { /* PWM generation needed. Check if the requested period matches * the one that is currently set, or the PWM peripheral can be @@ -279,20 +282,8 @@ static int pwm_nrfx_set_cycles(const struct device *dev, uint32_t channel, if (inverted) { out_level ^= 1; } - /* Output of fast PWM instance is directly connected to GPIO pads, - * thus it cannot controlled by GPIO. Use regular 0%/100% duty cycle - * playback instead. - */ -#ifdef PWM_NRFX_FAST_PRESENT - if (pwm_is_fast(config)) { - nrfx_pwm_simple_playback(&config->pwm, &config->seq, 1, - NRFX_PWM_FLAG_NO_EVT_FINISHED); - } else { -#else - { -#endif - nrf_gpio_pin_write(psel, out_level); - } + + nrf_gpio_pin_write(psel, out_level); } data->pwm_needed &= ~BIT(channel); From 0ca49a1fe554cfb10a969aadefe84455069f20c5 Mon Sep 17 00:00:00 2001 From: Tomi Fontanilles Date: Wed, 9 Jul 2025 14:03:34 +0300 Subject: [PATCH 0166/2141] [nrf fromtree] dts: nordic: remove nordic,cryptocell compatible It's unused. Signed-off-by: Tomi Fontanilles (cherry picked from commit e4e88701804580f61c1a36b792bfdb7c9113796e) --- dts/arm/nordic/nrf52840.dtsi | 2 +- dts/arm/nordic/nrf5340_cpuapp.dtsi | 2 +- dts/arm/nordic/nrf91.dtsi | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dts/arm/nordic/nrf52840.dtsi b/dts/arm/nordic/nrf52840.dtsi index 7c5337eed990..dab5f7620585 100644 --- a/dts/arm/nordic/nrf52840.dtsi +++ b/dts/arm/nordic/nrf52840.dtsi @@ -568,7 +568,7 @@ }; cryptocell: crypto@5002a000 { - compatible = "nordic,cryptocell", "arm,cryptocell-310"; + compatible = "arm,cryptocell-310"; reg = <0x5002a000 0x1000>, <0x5002b000 0x1000>; reg-names = "wrapper", "core"; interrupts = <42 NRF_DEFAULT_IRQ_PRIORITY>; diff --git a/dts/arm/nordic/nrf5340_cpuapp.dtsi b/dts/arm/nordic/nrf5340_cpuapp.dtsi index 1b04be61248e..30aaf9c99479 100644 --- a/dts/arm/nordic/nrf5340_cpuapp.dtsi +++ b/dts/arm/nordic/nrf5340_cpuapp.dtsi @@ -100,7 +100,7 @@ }; cryptocell: crypto@50844000 { - compatible = "nordic,cryptocell", "arm,cryptocell-312"; + compatible = "arm,cryptocell-312"; reg = <0x50844000 0x1000>, <0x50845000 0x1000>; reg-names = "wrapper", "core"; interrupts = <68 NRF_DEFAULT_IRQ_PRIORITY>; diff --git a/dts/arm/nordic/nrf91.dtsi b/dts/arm/nordic/nrf91.dtsi index 9a64ed922294..1747dcea74a9 100644 --- a/dts/arm/nordic/nrf91.dtsi +++ b/dts/arm/nordic/nrf91.dtsi @@ -47,7 +47,7 @@ /* Additional Secure peripherals */ cryptocell: crypto@50840000 { - compatible = "nordic,cryptocell", "arm,cryptocell-310"; + compatible = "arm,cryptocell-310"; reg = <0x50840000 0x1000>, <0x50841000 0x1000>; reg-names = "wrapper", "core"; interrupts = <64 NRF_DEFAULT_IRQ_PRIORITY>; From 602b2c4b75a0c934db61f9666a4f98f6dad9857e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mo=C5=84?= Date: Thu, 15 May 2025 12:14:35 +0200 Subject: [PATCH 0167/2141] [nrf fromtree] samples: usb: uac2: Leave cache management up to drivers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Do not call cache management functions in sample because it does not work properly if driver uses bounce buffers. Signed-off-by: Tomasz Moń (cherry picked from commit 810118d2c64dc56d4cbcceded5bfd9cbb7dcadea) --- samples/subsys/usb/uac2_explicit_feedback/src/main.c | 2 -- samples/subsys/usb/uac2_implicit_feedback/src/main.c | 5 ----- 2 files changed, 7 deletions(-) diff --git a/samples/subsys/usb/uac2_explicit_feedback/src/main.c b/samples/subsys/usb/uac2_explicit_feedback/src/main.c index e448416c745d..3f4f596f35c2 100644 --- a/samples/subsys/usb/uac2_explicit_feedback/src/main.c +++ b/samples/subsys/usb/uac2_explicit_feedback/src/main.c @@ -10,7 +10,6 @@ #include #include "feedback.h" -#include #include #include #include @@ -117,7 +116,6 @@ static void uac2_data_recv_cb(const struct device *dev, uint8_t terminal, */ size = BLOCK_SIZE; memset(buf, 0, size); - sys_cache_data_flush_range(buf, size); } LOG_DBG("Received %d data to input terminal %d", size, terminal); diff --git a/samples/subsys/usb/uac2_implicit_feedback/src/main.c b/samples/subsys/usb/uac2_implicit_feedback/src/main.c index f52d12271025..a41f4b3814dd 100644 --- a/samples/subsys/usb/uac2_implicit_feedback/src/main.c +++ b/samples/subsys/usb/uac2_implicit_feedback/src/main.c @@ -10,7 +10,6 @@ #include #include "feedback.h" -#include #include #include #include @@ -164,7 +163,6 @@ static void uac2_data_recv_cb(const struct device *dev, uint8_t terminal, size = SAMPLES_PER_SOF * BYTES_PER_SLOT; } memset(buf, 0, size); - sys_cache_data_flush_range(buf, size); } LOG_DBG("Received %d data to input terminal %d", size, terminal); @@ -259,7 +257,6 @@ static void process_mic_data(const struct device *dev, struct usb_i2s_ctx *ctx) /* No data available, I2S will restart soon */ return; } - sys_cache_data_invd_range(rx_block, num_bytes); /* I2S operates on 2 channels (stereo) */ rx_samples = num_bytes / (BYTES_PER_SAMPLE * 2); @@ -314,7 +311,6 @@ static void process_mic_data(const struct device *dev, struct usb_i2s_ctx *ctx) ctx->pending_mic_samples = mic_samples; return; } - sys_cache_data_invd_range(rx_block, num_bytes); src = rx_block; rx_samples = num_bytes / (BYTES_PER_SAMPLE * 2); @@ -424,7 +420,6 @@ static void process_mic_data(const struct device *dev, struct usb_i2s_ctx *ctx) } /* Finally send the microphone samples to host */ - sys_cache_data_flush_range(mic_buf, mic_samples * BYTES_PER_SAMPLE); if (usbd_uac2_send(dev, MICROPHONE_IN_TERMINAL_ID, mic_buf, mic_samples * BYTES_PER_SAMPLE) < 0) { k_mem_slab_free(&i2s_rx_slab, mic_buf); From 50ba46ecf17f40ea9c1d324b3019ae89c27d0708 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mo=C5=84?= Date: Thu, 15 May 2025 12:18:19 +0200 Subject: [PATCH 0168/2141] [nrf fromtree] samples: usb: uac2: Make I2S buffers UDC compliant MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change I2S mem slabs to adhere to UDC padding and alignment requirements. Signed-off-by: Tomasz Moń (cherry picked from commit 45f1222474dd3b5a70dd8de166bf4c0aa517e8b6) --- samples/subsys/usb/uac2_implicit_feedback/src/main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/samples/subsys/usb/uac2_implicit_feedback/src/main.c b/samples/subsys/usb/uac2_implicit_feedback/src/main.c index a41f4b3814dd..b7720fe03317 100644 --- a/samples/subsys/usb/uac2_implicit_feedback/src/main.c +++ b/samples/subsys/usb/uac2_implicit_feedback/src/main.c @@ -37,8 +37,10 @@ LOG_MODULE_REGISTER(uac2_sample, LOG_LEVEL_INF); * errors when USB host decides to perform rapid terminal enable/disable cycles. */ #define I2S_BLOCKS 7 -K_MEM_SLAB_DEFINE_STATIC(i2s_tx_slab, MAX_BLOCK_SIZE, I2S_BLOCKS, 4); -K_MEM_SLAB_DEFINE_STATIC(i2s_rx_slab, MAX_BLOCK_SIZE, I2S_BLOCKS, 4); +K_MEM_SLAB_DEFINE_STATIC(i2s_tx_slab, ROUND_UP(MAX_BLOCK_SIZE, UDC_BUF_GRANULARITY), + I2S_BLOCKS, UDC_BUF_ALIGN); +K_MEM_SLAB_DEFINE_STATIC(i2s_rx_slab, ROUND_UP(MAX_BLOCK_SIZE, UDC_BUF_GRANULARITY), + I2S_BLOCKS, UDC_BUF_ALIGN); struct usb_i2s_ctx { const struct device *i2s_dev; From da47bd000e764bfee47ada326729877fbff2a805 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mo=C5=84?= Date: Thu, 15 May 2025 08:34:09 +0200 Subject: [PATCH 0169/2141] [nrf fromtree] samples: usb: uac2: Implement feedback on nRF54H20 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add configuration and feedback implementation necessary to run UAC2 samples on nRF54H20. Limit nRF54H20 to Full-Speed only operation because the samples currently don't have necessary logic to support High-Speed. Signed-off-by: Tomasz Moń (cherry picked from commit e0c2372eebc7400676cfbc30838f2a84c9bcbca3) --- .../usb/uac2_explicit_feedback/CMakeLists.txt | 4 +- .../subsys/usb/uac2_explicit_feedback/Kconfig | 2 + .../boards/nrf54h20dk_nrf54h20_cpuapp.conf | 8 +++ .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 72 +++++++++++++++++++ .../usb/uac2_explicit_feedback/sample.yaml | 4 +- .../src/{feedback_nrf53.c => feedback_nrf.c} | 59 ++++++++++++--- .../usb/uac2_implicit_feedback/CMakeLists.txt | 4 +- .../boards/nrf54h20dk_nrf54h20_cpuapp.conf | 7 ++ .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 67 +++++++++++++++++ .../usb/uac2_implicit_feedback/sample.yaml | 4 +- .../src/{feedback_nrf53.c => feedback_nrf.c} | 43 +++++++++-- 11 files changed, 253 insertions(+), 21 deletions(-) create mode 100644 samples/subsys/usb/uac2_explicit_feedback/boards/nrf54h20dk_nrf54h20_cpuapp.conf create mode 100644 samples/subsys/usb/uac2_explicit_feedback/boards/nrf54h20dk_nrf54h20_cpuapp.overlay rename samples/subsys/usb/uac2_explicit_feedback/src/{feedback_nrf53.c => feedback_nrf.c} (89%) create mode 100644 samples/subsys/usb/uac2_implicit_feedback/boards/nrf54h20dk_nrf54h20_cpuapp.conf create mode 100644 samples/subsys/usb/uac2_implicit_feedback/boards/nrf54h20dk_nrf54h20_cpuapp.overlay rename samples/subsys/usb/uac2_implicit_feedback/src/{feedback_nrf53.c => feedback_nrf.c} (85%) diff --git a/samples/subsys/usb/uac2_explicit_feedback/CMakeLists.txt b/samples/subsys/usb/uac2_explicit_feedback/CMakeLists.txt index 26ce264c4217..56bba10717c0 100644 --- a/samples/subsys/usb/uac2_explicit_feedback/CMakeLists.txt +++ b/samples/subsys/usb/uac2_explicit_feedback/CMakeLists.txt @@ -7,8 +7,8 @@ project(usb_audio_async_i2s) include(${ZEPHYR_BASE}/samples/subsys/usb/common/common.cmake) target_sources(app PRIVATE src/main.c) -if (CONFIG_SOC_COMPATIBLE_NRF5340_CPUAPP) - target_sources(app PRIVATE src/feedback_nrf53.c) +if (CONFIG_SOC_COMPATIBLE_NRF5340_CPUAPP OR CONFIG_SOC_SERIES_NRF54HX) + target_sources(app PRIVATE src/feedback_nrf.c) else() target_sources(app PRIVATE src/feedback_dummy.c) endif() diff --git a/samples/subsys/usb/uac2_explicit_feedback/Kconfig b/samples/subsys/usb/uac2_explicit_feedback/Kconfig index bee6118a00d6..76373b614695 100644 --- a/samples/subsys/usb/uac2_explicit_feedback/Kconfig +++ b/samples/subsys/usb/uac2_explicit_feedback/Kconfig @@ -9,6 +9,8 @@ config APP_USE_I2S_LRCLK_EDGES_COUNTER Use this to use I2S LRCLK edge counting for calculating feedback. On nRF53 this option requires externally connecting I2S LRCLK back to separate GPIOTE input pin (P1.09). + On nRF54 this option requires externally connecting TDM FSYNC back to + separate GPIOTE input pin (P0.08). endmenu # Source common USB sample options used to initialize new experimental USB diff --git a/samples/subsys/usb/uac2_explicit_feedback/boards/nrf54h20dk_nrf54h20_cpuapp.conf b/samples/subsys/usb/uac2_explicit_feedback/boards/nrf54h20dk_nrf54h20_cpuapp.conf new file mode 100644 index 000000000000..0e35fa1f491e --- /dev/null +++ b/samples/subsys/usb/uac2_explicit_feedback/boards/nrf54h20dk_nrf54h20_cpuapp.conf @@ -0,0 +1,8 @@ +# Enable timer for asynchronous feedback +CONFIG_NRFX_GPPI=y +CONFIG_NRFX_TIMER131=y +CONFIG_NRFX_GPIOTE130=y + +# Sample is Full-Speed only, prevent High-Speed enumeration +CONFIG_UDC_DRIVER_HIGH_SPEED_SUPPORT_ENABLED=n +CONFIG_USBD_MAX_SPEED_FULL=y diff --git a/samples/subsys/usb/uac2_explicit_feedback/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/samples/subsys/usb/uac2_explicit_feedback/boards/nrf54h20dk_nrf54h20_cpuapp.overlay new file mode 100644 index 000000000000..0e6b18cbae91 --- /dev/null +++ b/samples/subsys/usb/uac2_explicit_feedback/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "../app.overlay" + +&pinctrl { + tdm130_default_alt: tdm130_default_alt { + group1 { + psels = , + , + ; + }; + }; +}; + +i2s_tx: &tdm130 { + status = "okay"; + pinctrl-0 = <&tdm130_default_alt>; + pinctrl-names = "default"; + memory-regions = <&cpuapp_dma_region>; + mck-clock-source = "ACLK"; + sck-clock-source = "ACLK"; +}; + +&audiopll { + frequency = ; + status = "okay"; +}; + +&cpuapp_dma_region { + status = "okay"; +}; + +/* PPI channel 0 for TDM130 MAXCNT */ +&dppic132 { + compatible = "nordic,nrf-dppic-global"; + owned-channels = <0>; + source-channels = <0>; + nonsecure-channels = <0>; + status = "okay"; +}; + +/* PPI channel 1 for GPIOTE used for feedback in edge counter mode */ +&gpiote130 { + status = "okay"; + owned-channels = <1>; +}; + +/* GPIOTE130 and TDM130 PPI needs routing to TIMER131 through main APB */ +&dppic130 { + compatible = "nordic,nrf-dppic-global"; + owned-channels = <0 1>; + sink-channels = <0 1>; + source-channels = <0 1>; + nonsecure-channels = <0 1>; + status = "okay"; +}; + +/* TIMER131 PPI channel 2 is used for SOF */ +&dppic133 { + compatible = "nordic,nrf-dppic-global"; + owned-channels = <0 1 2>; + sink-channels = <0 1 2>; + status = "okay"; +}; + +&timer131 { + status = "okay"; +}; diff --git a/samples/subsys/usb/uac2_explicit_feedback/sample.yaml b/samples/subsys/usb/uac2_explicit_feedback/sample.yaml index bc0797a9812a..9a58d1b64439 100644 --- a/samples/subsys/usb/uac2_explicit_feedback/sample.yaml +++ b/samples/subsys/usb/uac2_explicit_feedback/sample.yaml @@ -8,5 +8,7 @@ tests: tags: - usb - i2s - platform_allow: nrf5340dk/nrf5340/cpuapp + platform_allow: + - nrf5340dk/nrf5340/cpuapp + - nrf54h20dk/nrf54h20/cpuapp harness: TBD diff --git a/samples/subsys/usb/uac2_explicit_feedback/src/feedback_nrf53.c b/samples/subsys/usb/uac2_explicit_feedback/src/feedback_nrf.c similarity index 89% rename from samples/subsys/usb/uac2_explicit_feedback/src/feedback_nrf53.c rename to samples/subsys/usb/uac2_explicit_feedback/src/feedback_nrf.c index 7e949d612117..62a7ad05ef9c 100644 --- a/samples/subsys/usb/uac2_explicit_feedback/src/feedback_nrf53.c +++ b/samples/subsys/usb/uac2_explicit_feedback/src/feedback_nrf.c @@ -12,18 +12,56 @@ #include #include #include -#include -#include #include LOG_MODULE_REGISTER(feedback, LOG_LEVEL_INF); -static const nrfx_gpiote_t gpiote = NRFX_GPIOTE_INSTANCE(0); +#define FEEDBACK_TIMER_USBD_SOF_CAPTURE 0 +#define FEEDBACK_TIMER_I2S_FRAMESTART_CAPTURE 1 + +#if IS_ENABLED(CONFIG_SOC_COMPATIBLE_NRF5340_CPUAPP) + +#include +#include #define FEEDBACK_PIN NRF_GPIO_PIN_MAP(1, 9) +#define FEEDBACK_GPIOTE_INSTANCE_NUMBER 0 #define FEEDBACK_TIMER_INSTANCE_NUMBER 2 -#define FEEDBACK_TIMER_USBD_SOF_CAPTURE 0 -#define FEEDBACK_TIMER_I2S_FRAMESTART_CAPTURE 1 +#define USB_SOF_EVENT_ADDRESS nrf_usbd_event_address_get(NRF_USBD, NRF_USBD_EVENT_SOF) +#define I2S_FRAMESTART_EVENT_ADDRESS nrf_i2s_event_address_get(NRF_I2S0, NRF_I2S_EVENT_FRAMESTART) + +static inline void feedback_target_init(void) +{ + if (IS_ENABLED(CONFIG_APP_USE_I2S_LRCLK_EDGES_COUNTER)) { + /* App core is using feedback pin */ + nrf_gpio_pin_control_select(FEEDBACK_PIN, NRF_GPIO_PIN_SEL_APP); + } +} + +#elif IS_ENABLED(CONFIG_SOC_SERIES_NRF54HX) + +#include + +#define FEEDBACK_PIN NRF_GPIO_PIN_MAP(0, 8) +#define FEEDBACK_GPIOTE_INSTANCE_NUMBER 130 +#define FEEDBACK_TIMER_INSTANCE_NUMBER 131 +#define USB_SOF_EVENT_ADDRESS nrf_timer_event_address_get(NRF_TIMER131, NRF_TIMER_EVENT_COMPARE5) +#define I2S_FRAMESTART_EVENT_ADDRESS nrf_tdm_event_address_get(NRF_TDM130, NRF_TDM_EVENT_MAXCNT) + +static inline void feedback_target_init(void) +{ + /* Enable Start-of-Frame workaround in TIMER131 */ + *(volatile uint32_t *)0x5F9A3C04 = 0x00000002; + *(volatile uint32_t *)0x5F9A3C04 = 0x00000003; + *(volatile uint32_t *)0x5F9A3C80 = 0x00000082; +} + +#else +#error "Unsupported target" +#endif + +static const nrfx_gpiote_t gpiote = + NRFX_GPIOTE_INSTANCE(FEEDBACK_GPIOTE_INSTANCE_NUMBER); static const nrfx_timer_t feedback_timer_instance = NRFX_TIMER_INSTANCE(FEEDBACK_TIMER_INSTANCE_NUMBER); @@ -80,13 +118,12 @@ static nrfx_err_t feedback_edge_counter_setup(void) .trigger = NRFX_GPIOTE_TRIGGER_TOGGLE, .p_in_channel = &feedback_gpiote_channel, }; + nrf_gpio_pin_pull_t pull = NRF_GPIO_PIN_PULLUP; nrfx_gpiote_input_pin_config_t input_pin_config = { + .p_pull_config = &pull, .p_trigger_config = &trigger_config, }; - /* App core is using feedback pin */ - nrf_gpio_pin_control_select(FEEDBACK_PIN, NRF_GPIO_PIN_SEL_APP); - err = nrfx_gpiote_channel_alloc(&gpiote, &feedback_gpiote_channel); if (err != NRFX_SUCCESS) { return err; @@ -151,6 +188,8 @@ struct feedback_ctx *feedback_init(void) uint8_t usbd_sof_gppi_channel; uint8_t i2s_framestart_gppi_channel; + feedback_target_init(); + feedback_reset_ctx(&fb_ctx); if (IS_ENABLED(CONFIG_APP_USE_I2S_LRCLK_EDGES_COUNTER)) { @@ -171,7 +210,7 @@ struct feedback_ctx *feedback_init(void) } nrfx_gppi_channel_endpoints_setup(usbd_sof_gppi_channel, - nrf_usbd_event_address_get(NRF_USBD, NRF_USBD_EVENT_SOF), + USB_SOF_EVENT_ADDRESS, nrfx_timer_capture_task_address_get(&feedback_timer_instance, FEEDBACK_TIMER_USBD_SOF_CAPTURE)); nrfx_gppi_fork_endpoint_setup(usbd_sof_gppi_channel, @@ -188,7 +227,7 @@ struct feedback_ctx *feedback_init(void) } nrfx_gppi_channel_endpoints_setup(i2s_framestart_gppi_channel, - nrf_i2s_event_address_get(NRF_I2S0, NRF_I2S_EVENT_FRAMESTART), + I2S_FRAMESTART_EVENT_ADDRESS, nrfx_timer_capture_task_address_get(&feedback_timer_instance, FEEDBACK_TIMER_I2S_FRAMESTART_CAPTURE)); diff --git a/samples/subsys/usb/uac2_implicit_feedback/CMakeLists.txt b/samples/subsys/usb/uac2_implicit_feedback/CMakeLists.txt index 26ce264c4217..56bba10717c0 100644 --- a/samples/subsys/usb/uac2_implicit_feedback/CMakeLists.txt +++ b/samples/subsys/usb/uac2_implicit_feedback/CMakeLists.txt @@ -7,8 +7,8 @@ project(usb_audio_async_i2s) include(${ZEPHYR_BASE}/samples/subsys/usb/common/common.cmake) target_sources(app PRIVATE src/main.c) -if (CONFIG_SOC_COMPATIBLE_NRF5340_CPUAPP) - target_sources(app PRIVATE src/feedback_nrf53.c) +if (CONFIG_SOC_COMPATIBLE_NRF5340_CPUAPP OR CONFIG_SOC_SERIES_NRF54HX) + target_sources(app PRIVATE src/feedback_nrf.c) else() target_sources(app PRIVATE src/feedback_dummy.c) endif() diff --git a/samples/subsys/usb/uac2_implicit_feedback/boards/nrf54h20dk_nrf54h20_cpuapp.conf b/samples/subsys/usb/uac2_implicit_feedback/boards/nrf54h20dk_nrf54h20_cpuapp.conf new file mode 100644 index 000000000000..1b1edb40666c --- /dev/null +++ b/samples/subsys/usb/uac2_implicit_feedback/boards/nrf54h20dk_nrf54h20_cpuapp.conf @@ -0,0 +1,7 @@ +# Enable timer for asynchronous feedback +CONFIG_NRFX_GPPI=y +CONFIG_NRFX_TIMER131=y + +# Sample is Full-Speed only, prevent High-Speed enumeration +CONFIG_UDC_DRIVER_HIGH_SPEED_SUPPORT_ENABLED=n +CONFIG_USBD_MAX_SPEED_FULL=y diff --git a/samples/subsys/usb/uac2_implicit_feedback/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/samples/subsys/usb/uac2_implicit_feedback/boards/nrf54h20dk_nrf54h20_cpuapp.overlay new file mode 100644 index 000000000000..7fec156ff7e5 --- /dev/null +++ b/samples/subsys/usb/uac2_implicit_feedback/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "../app.overlay" + +&pinctrl { + tdm130_default_alt: tdm130_default_alt { + group1 { + psels = , + , + , + ; + }; + }; +}; + +i2s_rxtx: &tdm130 { + status = "okay"; + pinctrl-0 = <&tdm130_default_alt>; + pinctrl-names = "default"; + memory-regions = <&cpuapp_dma_region>; + mck-clock-source = "ACLK"; + sck-clock-source = "ACLK"; +}; + +&audiopll { + frequency = ; + status = "okay"; +}; + +&cpuapp_dma_region { + status = "okay"; +}; + +/* PPI channel 0 for TDM130 MAXCNT */ +&dppic132 { + compatible = "nordic,nrf-dppic-global"; + owned-channels = <0>; + source-channels = <0>; + nonsecure-channels = <0>; + status = "okay"; +}; + +/* TDM130 PPI needs routing to TIMER131 through main APB */ +&dppic130 { + compatible = "nordic,nrf-dppic-global"; + owned-channels = <0>; + sink-channels = <0>; + source-channels = <0>; + nonsecure-channels = <0>; + status = "okay"; +}; + +/* TIMER131 PPI channel 1 is used for SOF */ +&dppic133 { + compatible = "nordic,nrf-dppic-global"; + owned-channels = <0 1>; + sink-channels = <0 1>; + status = "okay"; +}; + +&timer131 { + status = "okay"; +}; diff --git a/samples/subsys/usb/uac2_implicit_feedback/sample.yaml b/samples/subsys/usb/uac2_implicit_feedback/sample.yaml index 6682ac0ed831..03cf7145e89a 100644 --- a/samples/subsys/usb/uac2_implicit_feedback/sample.yaml +++ b/samples/subsys/usb/uac2_implicit_feedback/sample.yaml @@ -8,5 +8,7 @@ tests: tags: - usb - i2s - platform_allow: nrf5340dk/nrf5340/cpuapp + platform_allow: + - nrf5340dk/nrf5340/cpuapp + - nrf54h20dk/nrf54h20/cpuapp harness: TBD diff --git a/samples/subsys/usb/uac2_implicit_feedback/src/feedback_nrf53.c b/samples/subsys/usb/uac2_implicit_feedback/src/feedback_nrf.c similarity index 85% rename from samples/subsys/usb/uac2_implicit_feedback/src/feedback_nrf53.c rename to samples/subsys/usb/uac2_implicit_feedback/src/feedback_nrf.c index ecc59f1a35a6..a7dfad370b87 100644 --- a/samples/subsys/usb/uac2_implicit_feedback/src/feedback_nrf53.c +++ b/samples/subsys/usb/uac2_implicit_feedback/src/feedback_nrf.c @@ -10,16 +10,47 @@ #include #include -#include -#include #include LOG_MODULE_REGISTER(feedback, LOG_LEVEL_INF); -#define FEEDBACK_TIMER_INSTANCE_NUMBER 2 #define FEEDBACK_TIMER_USBD_SOF_CAPTURE 0 #define FEEDBACK_TIMER_I2S_FRAMESTART_CAPTURE 1 +#if IS_ENABLED(CONFIG_SOC_COMPATIBLE_NRF5340_CPUAPP) + +#include +#include + +#define FEEDBACK_TIMER_INSTANCE_NUMBER 2 +#define USB_SOF_EVENT_ADDRESS nrf_usbd_event_address_get(NRF_USBD, NRF_USBD_EVENT_SOF) +#define I2S_FRAMESTART_EVENT_ADDRESS nrf_i2s_event_address_get(NRF_I2S0, NRF_I2S_EVENT_FRAMESTART) + +static inline void feedback_target_init(void) +{ + /* No target specific init necessary */ +} + +#elif IS_ENABLED(CONFIG_SOC_SERIES_NRF54HX) + +#include + +#define FEEDBACK_TIMER_INSTANCE_NUMBER 131 +#define USB_SOF_EVENT_ADDRESS nrf_timer_event_address_get(NRF_TIMER131, NRF_TIMER_EVENT_COMPARE5) +#define I2S_FRAMESTART_EVENT_ADDRESS nrf_tdm_event_address_get(NRF_TDM130, NRF_TDM_EVENT_MAXCNT) + +static inline void feedback_target_init(void) +{ + /* Enable Start-of-Frame workaround in TIMER131 */ + *(volatile uint32_t *)0x5F9A3C04 = 0x00000002; + *(volatile uint32_t *)0x5F9A3C04 = 0x00000003; + *(volatile uint32_t *)0x5F9A3C80 = 0x00000082; +} + +#else +#error "Unsupported target" +#endif + static const nrfx_timer_t feedback_timer_instance = NRFX_TIMER_INSTANCE(FEEDBACK_TIMER_INSTANCE_NUMBER); @@ -57,6 +88,8 @@ struct feedback_ctx *feedback_init(void) .p_context = NULL, }; + feedback_target_init(); + feedback_reset_ctx(&fb_ctx); err = nrfx_timer_init(&feedback_timer_instance, &cfg, NULL); @@ -73,7 +106,7 @@ struct feedback_ctx *feedback_init(void) } nrfx_gppi_channel_endpoints_setup(usbd_sof_gppi_channel, - nrf_usbd_event_address_get(NRF_USBD, NRF_USBD_EVENT_SOF), + USB_SOF_EVENT_ADDRESS, nrfx_timer_capture_task_address_get(&feedback_timer_instance, FEEDBACK_TIMER_USBD_SOF_CAPTURE)); nrfx_gppi_fork_endpoint_setup(usbd_sof_gppi_channel, @@ -90,7 +123,7 @@ struct feedback_ctx *feedback_init(void) } nrfx_gppi_channel_endpoints_setup(i2s_framestart_gppi_channel, - nrf_i2s_event_address_get(NRF_I2S0, NRF_I2S_EVENT_FRAMESTART), + I2S_FRAMESTART_EVENT_ADDRESS, nrfx_timer_capture_task_address_get(&feedback_timer_instance, FEEDBACK_TIMER_I2S_FRAMESTART_CAPTURE)); From 70ef15a212ab88bb942822923fdb101ce1fb83ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mo=C5=84?= Date: Thu, 29 May 2025 14:23:06 +0200 Subject: [PATCH 0170/2141] [nrf fromtree] drivers: udc_dwc2: Inline vendor quirks if possible MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Constify vendor quirks structure to not keep it in RAM. Use constified vendor quirks structure directly if there is only one snps,dwc2 instance to allow compiler inlining quirk implementation. Signed-off-by: Tomasz Moń Signed-off-by: Johann Fischer (cherry picked from commit 46b11f1fb2d0d463342487049a9d52775faf9f95) --- drivers/usb/udc/udc_dwc2.c | 10 ++-------- drivers/usb/udc/udc_dwc2.h | 16 +++++++++++++--- drivers/usb/udc/udc_dwc2_vendor_quirks.h | 17 +++++++---------- 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/drivers/usb/udc/udc_dwc2.c b/drivers/usb/udc/udc_dwc2.c index 269dfd56ee56..02652e0bfc11 100644 --- a/drivers/usb/udc/udc_dwc2.c +++ b/drivers/usb/udc/udc_dwc2.c @@ -4,6 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ +#define DT_DRV_COMPAT snps_dwc2 + #include "udc_common.h" #include "udc_dwc2.h" @@ -22,7 +24,6 @@ #include LOG_MODULE_REGISTER(udc_dwc2, CONFIG_UDC_DRIVER_LOG_LEVEL); -#include "udc_dwc2_vendor_quirks.h" enum dwc2_drv_event_type { /* USB connection speed determined after bus reset */ @@ -3196,13 +3197,6 @@ static const struct udc_api udc_dwc2_api = { .ep_dequeue = udc_dwc2_ep_dequeue, }; -#define DT_DRV_COMPAT snps_dwc2 - -#define UDC_DWC2_VENDOR_QUIRK_GET(n) \ - COND_CODE_1(DT_NODE_VENDOR_HAS_IDX(DT_DRV_INST(n), 1), \ - (&dwc2_vendor_quirks_##n), \ - (NULL)) - #define UDC_DWC2_DT_INST_REG_ADDR(n) \ COND_CODE_1(DT_NUM_REGS(DT_DRV_INST(n)), (DT_INST_REG_ADDR(n)), \ (DT_INST_REG_ADDR_BY_NAME(n, core))) diff --git a/drivers/usb/udc/udc_dwc2.h b/drivers/usb/udc/udc_dwc2.h index 87e71f818991..77be96adaa5f 100644 --- a/drivers/usb/udc/udc_dwc2.h +++ b/drivers/usb/udc/udc_dwc2.h @@ -46,7 +46,7 @@ struct udc_dwc2_config { /* Pointer to pin control configuration or NULL */ struct pinctrl_dev_config *const pcfg; /* Pointer to vendor quirks or NULL */ - struct dwc2_vendor_quirks *const quirks; + const struct dwc2_vendor_quirks *const quirks; void (*make_thread)(const struct device *dev); void (*irq_enable_func)(const struct device *dev); void (*irq_disable_func)(const struct device *dev); @@ -55,13 +55,23 @@ struct udc_dwc2_config { uint32_t ghwcfg4; }; +#include "udc_dwc2_vendor_quirks.h" + +#define UDC_DWC2_VENDOR_QUIRK_GET(n) \ + COND_CODE_1(DT_NODE_VENDOR_HAS_IDX(DT_DRV_INST(n), 1), \ + (&dwc2_vendor_quirks_##n), \ + (NULL)) + #define DWC2_QUIRK_FUNC_DEFINE(fname) \ static inline int dwc2_quirk_##fname(const struct device *dev) \ { \ const struct udc_dwc2_config *const config = dev->config; \ - struct dwc2_vendor_quirks *quirks = config->quirks; \ + const struct dwc2_vendor_quirks *const quirks = \ + COND_CODE_1(IS_EQ(DT_NUM_INST_STATUS_OKAY(snps_dwc2), 1), \ + (UDC_DWC2_VENDOR_QUIRK_GET(0); ARG_UNUSED(config);), \ + (config->quirks;)) \ \ - if (quirks != NULL && config->quirks->fname != NULL) { \ + if (quirks != NULL && quirks->fname != NULL) { \ return quirks->fname(dev); \ } \ \ diff --git a/drivers/usb/udc/udc_dwc2_vendor_quirks.h b/drivers/usb/udc/udc_dwc2_vendor_quirks.h index 0a1021881399..f5a70063c2e2 100644 --- a/drivers/usb/udc/udc_dwc2_vendor_quirks.h +++ b/drivers/usb/udc/udc_dwc2_vendor_quirks.h @@ -25,8 +25,6 @@ struct usb_dw_stm32_clk { size_t pclken_len; }; -#define DT_DRV_COMPAT snps_dwc2 - static inline int stm32f4_fsotg_enable_clk(const struct usb_dw_stm32_clk *const clk) { int ret; @@ -94,7 +92,7 @@ static inline int stm32f4_fsotg_disable_phy(const struct device *dev) return stm32f4_fsotg_enable_clk(&stm32f4_clk_##n); \ } \ \ - struct dwc2_vendor_quirks dwc2_vendor_quirks_##n = { \ + const struct dwc2_vendor_quirks dwc2_vendor_quirks_##n = { \ .pre_enable = stm32f4_fsotg_enable_clk_##n, \ .post_enable = stm32f4_fsotg_enable_phy, \ .disable = stm32f4_fsotg_disable_phy, \ @@ -104,14 +102,11 @@ static inline int stm32f4_fsotg_disable_phy(const struct device *dev) DT_INST_FOREACH_STATUS_OKAY(QUIRK_STM32F4_FSOTG_DEFINE) -#undef DT_DRV_COMPAT - #endif /*DT_HAS_COMPAT_STATUS_OKAY(st_stm32f4_fsotg) */ #if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_usbhs) -#define DT_DRV_COMPAT snps_dwc2 - +#include #include #include @@ -129,6 +124,7 @@ static K_EVENT_DEFINE(usbhs_events); static void usbhs_vbus_handler(nrfs_usb_evt_t const *p_evt, void *const context) { + LOG_MODULE_DECLARE(udc_dwc2, CONFIG_UDC_DRIVER_LOG_LEVEL); const struct device *dev = context; switch (p_evt->type) { @@ -156,6 +152,7 @@ static void usbhs_vbus_handler(nrfs_usb_evt_t const *p_evt, void *const context) static inline int usbhs_enable_nrfs_service(const struct device *dev) { + LOG_MODULE_DECLARE(udc_dwc2, CONFIG_UDC_DRIVER_LOG_LEVEL); nrfs_err_t nrfs_err; int err; @@ -182,6 +179,7 @@ static inline int usbhs_enable_nrfs_service(const struct device *dev) static inline int usbhs_enable_core(const struct device *dev) { + LOG_MODULE_DECLARE(udc_dwc2, CONFIG_UDC_DRIVER_LOG_LEVEL); NRF_USBHS_Type *wrapper = USBHS_DT_WRAPPER_REG_ADDR(0); k_timeout_t timeout = K_FOREVER; @@ -229,6 +227,7 @@ static inline int usbhs_disable_core(const struct device *dev) static inline int usbhs_disable_nrfs_service(const struct device *dev) { + LOG_MODULE_DECLARE(udc_dwc2, CONFIG_UDC_DRIVER_LOG_LEVEL); nrfs_err_t nrfs_err; nrfs_err = nrfs_usb_disable_request((void *)dev); @@ -297,7 +296,7 @@ static inline int usbhs_pre_hibernation_exit(const struct device *dev) } #define QUIRK_NRF_USBHS_DEFINE(n) \ - struct dwc2_vendor_quirks dwc2_vendor_quirks_##n = { \ + const struct dwc2_vendor_quirks dwc2_vendor_quirks_##n = { \ .init = usbhs_enable_nrfs_service, \ .pre_enable = usbhs_enable_core, \ .disable = usbhs_disable_core, \ @@ -311,8 +310,6 @@ static inline int usbhs_pre_hibernation_exit(const struct device *dev) DT_INST_FOREACH_STATUS_OKAY(QUIRK_NRF_USBHS_DEFINE) -#undef DT_DRV_COMPAT - #endif /*DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_usbhs) */ /* Add next vendor quirks definition above this line */ From 105b0e521217db2470538c6c80ca38c46d33b96c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mo=C5=84?= Date: Mon, 9 Jun 2025 10:14:11 +0200 Subject: [PATCH 0171/2141] [nrf fromtree] drivers: udc_dwc2: Disable control IN endpoint on SETUP MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit New control transfer is started prematurely from device perspective when host timeout occurs. Any data transfer from previous control transfer have to be cancelled prior to handling SETUP data. Unconditionally disable control IN endpoint to prevent race for enqueued buffer between udc_buf_get_all() called in dwc2_handle_evt_setup() and udc_buf_peek() called in dwc2_handle_in_xfercompl(). Signed-off-by: Tomasz Moń (cherry picked from commit 89a81e3c1f9d17eaea403cc5329fcec9d48febbf) --- drivers/usb/udc/udc_dwc2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/udc/udc_dwc2.c b/drivers/usb/udc/udc_dwc2.c index 02652e0bfc11..856324942d03 100644 --- a/drivers/usb/udc/udc_dwc2.c +++ b/drivers/usb/udc/udc_dwc2.c @@ -824,6 +824,7 @@ static int dwc2_handle_evt_setup(const struct device *dev) * transfer beforehand. In Buffer DMA the SETUP can be copied to any EP0 * OUT buffer. If there is any buffer queued, it is obsolete now. */ + udc_dwc2_ep_disable(dev, cfg_in, false); atomic_and(&priv->xfer_finished, ~(BIT(0) | BIT(16))); buf = udc_buf_get_all(cfg_out); @@ -833,7 +834,6 @@ static int dwc2_handle_evt_setup(const struct device *dev) buf = udc_buf_get_all(cfg_in); if (buf) { - udc_dwc2_ep_disable(dev, cfg_in, false); net_buf_unref(buf); } From ab54afcda7afe12408f1dbb636a231894e085606 Mon Sep 17 00:00:00 2001 From: Johann Fischer Date: Tue, 22 Apr 2025 10:36:02 +0200 Subject: [PATCH 0172/2141] [nrf fromtree] drivers: udc: add SOF Kconfig option and SOF event helper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add helper to handle SOF interrupts/events and new Kconfig option to disable SOF interrupt. Signed-off-by: Johann Fischer (cherry picked from commit 2d7995747e3a8ee6e894dc8f5dfae62a38bed03c) Signed-off-by: Tomasz Moń --- drivers/usb/udc/Kconfig | 6 ++++++ drivers/usb/udc/udc_common.h | 23 +++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/drivers/usb/udc/Kconfig b/drivers/usb/udc/Kconfig index b6c49e6b3e7a..b2c646343156 100644 --- a/drivers/usb/udc/Kconfig +++ b/drivers/usb/udc/Kconfig @@ -42,6 +42,12 @@ config UDC_BUF_FORCE_NOCACHE Place the buffer pools in the nocache memory region if the driver cannot handle buffers in cached memory. +config UDC_ENABLE_SOF + bool "SOF interrupt processing" + help + Enabled SoF interrupts can cause a very high CPU load on high-speed + controllers because the interrupt rate would be 125 µs. + config UDC_WORKQUEUE bool "Use a dedicate work queue for UDC drivers" help diff --git a/drivers/usb/udc/udc_common.h b/drivers/usb/udc/udc_common.h index 8cad6b6dd1c5..ed6712e95ae8 100644 --- a/drivers/usb/udc/udc_common.h +++ b/drivers/usb/udc/udc_common.h @@ -156,6 +156,29 @@ int udc_submit_event(const struct device *dev, int udc_submit_ep_event(const struct device *dev, struct net_buf *const buf, const int err); + +/** + * @brief Helper function to send UDC SOF event to a higher level. + * + * Type of this event is hardcoded to UDC_EVT_SOF. + * + * @param[in] dev Pointer to device struct of the driver instance + */ +#if defined(CONFIG_UDC_ENABLE_SOF) +static inline void udc_submit_sof_event(const struct device *dev) +{ + struct udc_data *data = dev->data; + struct udc_event drv_evt = { + .type = UDC_EVT_SOF, + .dev = dev, + }; + + (void)data->event_cb(dev, &drv_evt); +} +#else +#define udc_submit_sof_event(dev) ARG_UNUSED(dev) +#endif + /** * @brief Helper function to enable endpoint. * From ddd6b2e7af03aa6a520fa4cf65f22576c1018651 Mon Sep 17 00:00:00 2001 From: Johann Fischer Date: Wed, 2 Apr 2025 10:43:02 +0200 Subject: [PATCH 0173/2141] [nrf fromtree] drivers: udc: disable SOF interrupt by default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the new Kconfig option is disabled, no SOF events are passed to the higher layer. Signed-off-by: Johann Fischer (cherry picked from commit 7b287ec133cccf0649bc2989d20977b4a310e771) Signed-off-by: Tomasz Moń --- drivers/usb/udc/udc_ambiq.c | 7 ++++--- drivers/usb/udc/udc_dwc2.c | 20 ++++++++++++-------- drivers/usb/udc/udc_it82xx2.c | 9 +++------ drivers/usb/udc/udc_kinetis.c | 4 ++-- drivers/usb/udc/udc_max32.c | 2 +- drivers/usb/udc/udc_mcux_ehci.c | 2 +- drivers/usb/udc/udc_mcux_ip3511.c | 2 +- drivers/usb/udc/udc_nrf.c | 4 ++-- drivers/usb/udc/udc_numaker.c | 6 ++++-- drivers/usb/udc/udc_renesas_ra.c | 2 +- drivers/usb/udc/udc_rpi_pico.c | 4 ++-- drivers/usb/udc/udc_sam0.c | 2 +- drivers/usb/udc/udc_skeleton.c | 4 ++++ drivers/usb/udc/udc_stm32.c | 2 +- subsys/usb/device_next/class/Kconfig.uac2 | 1 + tests/drivers/udc/prj.conf | 1 + tests/subsys/usb/device_next/prj.conf | 1 + 17 files changed, 42 insertions(+), 31 deletions(-) diff --git a/drivers/usb/udc/udc_ambiq.c b/drivers/usb/udc/udc_ambiq.c index 6e5f2603edd5..9b2fdc0addbd 100644 --- a/drivers/usb/udc/udc_ambiq.c +++ b/drivers/usb/udc/udc_ambiq.c @@ -156,8 +156,9 @@ static void udc_ambiq_evt_callback(const struct device *dev, am_hal_usb_dev_even case AM_HAL_USB_DEV_EVT_BUS_RESET: /* enable usb bus interrupts */ am_hal_usb_intr_usb_enable(priv->usb_handle, - USB_CFG2_SOFE_Msk | USB_CFG2_ResumeE_Msk | - USB_CFG2_SuspendE_Msk | USB_CFG2_ResetE_Msk); + IF_ENABLED(CONFIG_UDC_ENABLE_SOF, (USB_CFG2_SOFE_Msk |)) + USB_CFG2_ResumeE_Msk | + USB_CFG2_SuspendE_Msk | USB_CFG2_ResetE_Msk); /* init the endpoint */ am_hal_usb_ep_init(priv->usb_handle, 0, 0, EP0_MPS); /* Set USB device speed to HAL */ @@ -174,7 +175,7 @@ static void udc_ambiq_evt_callback(const struct device *dev, am_hal_usb_dev_even udc_submit_event(dev, UDC_EVT_RESUME, 0); break; case AM_HAL_USB_DEV_EVT_SOF: - udc_submit_event(dev, UDC_EVT_SOF, 0); + udc_submit_sof_event(dev); break; case AM_HAL_USB_DEV_EVT_SUSPEND: /* Handle USB Suspend event, then set device state to suspended */ diff --git a/drivers/usb/udc/udc_dwc2.c b/drivers/usb/udc/udc_dwc2.c index 856324942d03..cb52f711fcbe 100644 --- a/drivers/usb/udc/udc_dwc2.c +++ b/drivers/usb/udc/udc_dwc2.c @@ -2163,11 +2163,12 @@ static int udc_dwc2_init_controller(const struct device *dev) } /* Unmask interrupts */ - sys_write32(USB_DWC2_GINTSTS_OEPINT | USB_DWC2_GINTSTS_IEPINT | + sys_write32(IF_ENABLED(CONFIG_UDC_ENABLE_SOF, (USB_DWC2_GINTSTS_SOF | + USB_DWC2_GINTSTS_INCOMPISOOUT | + USB_DWC2_GINTSTS_INCOMPISOIN |)) + USB_DWC2_GINTSTS_OEPINT | USB_DWC2_GINTSTS_IEPINT | USB_DWC2_GINTSTS_ENUMDONE | USB_DWC2_GINTSTS_USBRST | - USB_DWC2_GINTSTS_WKUPINT | USB_DWC2_GINTSTS_USBSUSP | - USB_DWC2_GINTSTS_INCOMPISOOUT | USB_DWC2_GINTSTS_INCOMPISOIN | - USB_DWC2_GINTSTS_SOF, + USB_DWC2_GINTSTS_WKUPINT | USB_DWC2_GINTSTS_USBSUSP, (mem_addr_t)&base->gintmsk); return 0; @@ -2891,7 +2892,8 @@ static void udc_dwc2_isr_handler(const struct device *dev) LOG_DBG("GINTSTS 0x%x", int_status); - if (int_status & USB_DWC2_GINTSTS_SOF) { + if (IS_ENABLED(CONFIG_UDC_ENABLE_SOF) && + int_status & USB_DWC2_GINTSTS_SOF) { uint32_t dsts; /* Clear USB SOF interrupt. */ @@ -2899,7 +2901,7 @@ static void udc_dwc2_isr_handler(const struct device *dev) dsts = sys_read32((mem_addr_t)&base->dsts); priv->sof_num = usb_dwc2_get_dsts_soffn(dsts); - udc_submit_event(dev, UDC_EVT_SOF, 0); + udc_submit_sof_event(dev); } if (int_status & USB_DWC2_GINTSTS_USBRST) { @@ -2942,11 +2944,13 @@ static void udc_dwc2_isr_handler(const struct device *dev) dwc2_handle_oepint(dev); } - if (int_status & USB_DWC2_GINTSTS_INCOMPISOIN) { + if (IS_ENABLED(CONFIG_UDC_ENABLE_SOF) && + int_status & USB_DWC2_GINTSTS_INCOMPISOIN) { dwc2_handle_incompisoin(dev); } - if (int_status & USB_DWC2_GINTSTS_INCOMPISOOUT) { + if (IS_ENABLED(CONFIG_UDC_ENABLE_SOF) && + int_status & USB_DWC2_GINTSTS_INCOMPISOOUT) { dwc2_handle_incompisoout(dev); } diff --git a/drivers/usb/udc/udc_it82xx2.c b/drivers/usb/udc/udc_it82xx2.c index 85ec9431c635..6b41cb162d49 100644 --- a/drivers/usb/udc/udc_it82xx2.c +++ b/drivers/usb/udc/udc_it82xx2.c @@ -17,9 +17,6 @@ LOG_MODULE_REGISTER(udc_it82xx2, CONFIG_UDC_DRIVER_LOG_LEVEL); #define DT_DRV_COMPAT ite_it82xx2_usb -/* TODO: Replace this definition by Kconfig option */ -#define USB_DEVICE_CONFIG_SOF_NOTIFICATIONS (0U) - #define IT8XXX2_IS_EXTEND_ENDPOINT(n) (USB_EP_GET_IDX(n) >= 4) #define IT82xx2_STATE_OUT_SHARED_FIFO_BUSY 0 @@ -1357,11 +1354,11 @@ static void it82xx2_usb_dc_isr(const void *arg) /* sof received */ if (status & DC_SOF_RECEIVED) { - if (!USB_DEVICE_CONFIG_SOF_NOTIFICATIONS) { + if (!IS_ENABLED(CONFIG_UDC_ENABLE_SOF)) { it82xx2_enable_sof_int(dev, false); } else { usb_regs->dc_interrupt_status = DC_SOF_RECEIVED; - udc_submit_event(dev, UDC_EVT_SOF, 0); + udc_submit_sof_event(dev); } it82xx2_enable_resume_int(dev, false); emit_resume_event(dev); @@ -1411,7 +1408,7 @@ static void suspended_handler(struct k_work *item) it82xx2_enable_resume_int(dev, true); - if (!USB_DEVICE_CONFIG_SOF_NOTIFICATIONS) { + if (!IS_ENABLED(CONFIG_UDC_ENABLE_SOF)) { it82xx2_enable_sof_int(dev, true); } diff --git a/drivers/usb/udc/udc_kinetis.c b/drivers/usb/udc/udc_kinetis.c index 8858ee129c4f..7d2273016039 100644 --- a/drivers/usb/udc/udc_kinetis.c +++ b/drivers/usb/udc/udc_kinetis.c @@ -653,7 +653,7 @@ static void usbfsotg_isr_handler(const struct device *dev) } if (istatus == USB_ISTAT_SOFTOK_MASK) { - udc_submit_event(dev, UDC_EVT_SOF, 0); + udc_submit_sof_event(dev); } if (istatus == USB_ISTAT_ERROR_MASK) { @@ -1016,7 +1016,7 @@ static int usbfsotg_init(const struct device *dev) base->INTEN = (USB_INTEN_SLEEPEN_MASK | USB_INTEN_STALLEN_MASK | USB_INTEN_TOKDNEEN_MASK | - USB_INTEN_SOFTOKEN_MASK | + IF_ENABLED(CONFIG_UDC_ENABLE_SOF, (USB_INTEN_SOFTOKEN_MASK |)) USB_INTEN_ERROREN_MASK | USB_INTEN_USBRSTEN_MASK); diff --git a/drivers/usb/udc/udc_max32.c b/drivers/usb/udc/udc_max32.c index 1e09f5ef7c6d..526a49b8ba91 100644 --- a/drivers/usb/udc/udc_max32.c +++ b/drivers/usb/udc/udc_max32.c @@ -533,7 +533,7 @@ static int udc_max32_event_callback(maxusb_event_t event, void *cbdata) case MAXUSB_EVENT_DPACT: LOG_DBG("DPACT event occurred"); udc_set_suspended(dev, false); - udc_submit_event(dev, UDC_EVT_SOF, 0); + udc_submit_sof_event(dev); break; case MAXUSB_EVENT_BRST: LOG_DBG("BRST event occurred"); diff --git a/drivers/usb/udc/udc_mcux_ehci.c b/drivers/usb/udc/udc_mcux_ehci.c index fc95f7a91d7e..041f9b759b19 100644 --- a/drivers/usb/udc/udc_mcux_ehci.c +++ b/drivers/usb/udc/udc_mcux_ehci.c @@ -531,7 +531,7 @@ usb_status_t USB_DeviceNotificationTrigger(void *handle, void *msg) udc_submit_event(dev, UDC_EVT_VBUS_READY, 0); break; case kUSB_DeviceNotifySOF: - udc_submit_event(dev, UDC_EVT_SOF, 0); + udc_submit_sof_event(dev); break; default: udc_mcux_event_submit(dev, mcux_msg); diff --git a/drivers/usb/udc/udc_mcux_ip3511.c b/drivers/usb/udc/udc_mcux_ip3511.c index 312acae17845..c6aab0d0bb1b 100644 --- a/drivers/usb/udc/udc_mcux_ip3511.c +++ b/drivers/usb/udc/udc_mcux_ip3511.c @@ -531,7 +531,7 @@ usb_status_t USB_DeviceNotificationTrigger(void *handle, void *msg) udc_submit_event(dev, UDC_EVT_VBUS_READY, 0); break; case kUSB_DeviceNotifySOF: - udc_submit_event(dev, UDC_EVT_SOF, 0); + udc_submit_sof_event(dev); break; default: udc_mcux_event_submit(dev, mcux_msg); diff --git a/drivers/usb/udc/udc_nrf.c b/drivers/usb/udc/udc_nrf.c index 71eebbd70d3e..7b18862fa596 100644 --- a/drivers/usb/udc/udc_nrf.c +++ b/drivers/usb/udc/udc_nrf.c @@ -436,7 +436,7 @@ static void ev_sof_handler(void) m_ep_armed &= ~USBD_EPISO_BIT_MASK; - udc_submit_event(udc_nrf_dev, UDC_EVT_SOF, 0); + udc_submit_sof_event(udc_nrf_dev); } static void usbd_in_packet_sent(uint8_t ep) @@ -1547,7 +1547,7 @@ static void udc_nrf_power_handler(nrfx_power_usb_evt_t pwr_evt) break; case NRFX_POWER_USB_EVT_READY: LOG_DBG("POWER event ready"); - nrf_usbd_legacy_start(true); + nrf_usbd_legacy_start(IS_ENABLED(CONFIG_UDC_ENABLE_SOF)); break; case NRFX_POWER_USB_EVT_REMOVED: LOG_DBG("POWER event removed"); diff --git a/drivers/usb/udc/udc_numaker.c b/drivers/usb/udc/udc_numaker.c index bbc016ecf706..43630010caa2 100644 --- a/drivers/usb/udc/udc_numaker.c +++ b/drivers/usb/udc/udc_numaker.c @@ -171,7 +171,9 @@ static inline void numaker_usbd_sw_connect(const struct device *dev) base->INTSTS = base->INTSTS; /* Enable relevant interrupts */ - base->INTEN = USBD_INT_BUS | USBD_INT_USB | USBD_INT_FLDET | USBD_INT_WAKEUP | USBD_INT_SOF; + base->INTEN = USBD_INT_BUS | USBD_INT_USB | USBD_INT_FLDET | + IF_ENABLED(CONFIG_UDC_ENABLE_SOF, (USBD_INT_SOF |)) + USBD_INT_WAKEUP; /* Clear SE0 for connect */ base->SE0 &= ~USBD_DRVSE0; @@ -1298,7 +1300,7 @@ static void numaker_udbd_isr(const struct device *dev) base->INTSTS = USBD_INTSTS_SOFIF_Msk; /* UDC stack would handle bottom-half processing */ - udc_submit_event(dev, UDC_EVT_SOF, 0); + udc_submit_sof_event(dev); } /* USB Setup/EP */ diff --git a/drivers/usb/udc/udc_renesas_ra.c b/drivers/usb/udc/udc_renesas_ra.c index fa98fda46ace..4a3123ec2b9c 100644 --- a/drivers/usb/udc/udc_renesas_ra.c +++ b/drivers/usb/udc/udc_renesas_ra.c @@ -79,7 +79,7 @@ static void udc_renesas_ra_event_handler(usbd_callback_arg_t *p_args) break; case USBD_EVENT_SOF: - udc_submit_event(dev, UDC_EVT_SOF, 0); + udc_submit_sof_event(dev); break; default: diff --git a/drivers/usb/udc/udc_rpi_pico.c b/drivers/usb/udc/udc_rpi_pico.c index 31561f6fce6b..70ebf047399d 100644 --- a/drivers/usb/udc/udc_rpi_pico.c +++ b/drivers/usb/udc/udc_rpi_pico.c @@ -678,7 +678,7 @@ static void rpi_pico_isr_handler(const struct device *dev) if (status & USB_INTS_DEV_SOF_BITS) { handled |= USB_INTS_DEV_SOF_BITS; - sys_read32((mm_reg_t)&base->sof_rd); + udc_submit_sof_event(dev); } if (status & USB_INTS_DEV_CONN_DIS_BITS) { @@ -1048,7 +1048,7 @@ static int udc_rpi_pico_enable(const struct device *dev) sys_write32(USB_SIE_CTRL_EP0_INT_1BUF_BITS, (mm_reg_t)&base->sie_ctrl); /* Enable interrupts */ - sys_write32(USB_INTE_DEV_SOF_BITS | + sys_write32(IF_ENABLED(CONFIG_UDC_ENABLE_SOF, (USB_INTE_DEV_SOF_BITS |)) USB_INTE_SETUP_REQ_BITS | USB_INTE_DEV_RESUME_FROM_HOST_BITS | USB_INTE_DEV_SUSPEND_BITS | diff --git a/drivers/usb/udc/udc_sam0.c b/drivers/usb/udc/udc_sam0.c index dab462a03faf..e351c98e284b 100644 --- a/drivers/usb/udc/udc_sam0.c +++ b/drivers/usb/udc/udc_sam0.c @@ -693,7 +693,7 @@ static void sam0_isr_handler(const struct device *dev) base->INTFLAG.reg = intflag; if (intflag & USB_DEVICE_INTFLAG_SOF) { - udc_submit_event(dev, UDC_EVT_SOF, 0); + udc_submit_sof_event(dev); } if (intflag & USB_DEVICE_INTFLAG_EORST) { diff --git a/drivers/usb/udc/udc_skeleton.c b/drivers/usb/udc/udc_skeleton.c index c808cc98ad85..2c9be371dec2 100644 --- a/drivers/usb/udc/udc_skeleton.c +++ b/drivers/usb/udc/udc_skeleton.c @@ -233,6 +233,10 @@ static int udc_skeleton_init(const struct device *dev) return -EIO; } + if (IS_ENABLED(CONFIG_UDC_ENABLE_SOF)) { + LOG_INF("Enable SOF interrupt"); + } + return 0; } diff --git a/drivers/usb/udc/udc_stm32.c b/drivers/usb/udc/udc_stm32.c index 6cc8c4add1c7..f773a1c641db 100644 --- a/drivers/usb/udc/udc_stm32.c +++ b/drivers/usb/udc/udc_stm32.c @@ -182,7 +182,7 @@ void HAL_PCD_SOFCallback(PCD_HandleTypeDef *hpcd) { struct udc_stm32_data *priv = hpcd2data(hpcd); - udc_submit_event(priv->dev, UDC_EVT_SOF, 0); + udc_submit_sof_event(priv->dev); } static int usbd_ctrl_feed_dout(const struct device *dev, const size_t length) diff --git a/subsys/usb/device_next/class/Kconfig.uac2 b/subsys/usb/device_next/class/Kconfig.uac2 index ad6fb54b38a8..5c19e0542c3e 100644 --- a/subsys/usb/device_next/class/Kconfig.uac2 +++ b/subsys/usb/device_next/class/Kconfig.uac2 @@ -4,6 +4,7 @@ config USBD_AUDIO2_CLASS bool "USB Audio 2 class support [EXPERIMENTAL]" + select UDC_ENABLE_SOF help USB Audio 2 device class support. diff --git a/tests/drivers/udc/prj.conf b/tests/drivers/udc/prj.conf index 380d5e74b996..975887e579c1 100644 --- a/tests/drivers/udc/prj.conf +++ b/tests/drivers/udc/prj.conf @@ -5,6 +5,7 @@ CONFIG_LOG=y CONFIG_ZTEST=y CONFIG_UDC_DRIVER=y +CONFIG_UDC_ENABLE_SOF=y CONFIG_UDC_BUF_COUNT=16 CONFIG_UDC_BUF_POOL_SIZE=16384 CONFIG_UDC_DRIVER_LOG_LEVEL_INF=y diff --git a/tests/subsys/usb/device_next/prj.conf b/tests/subsys/usb/device_next/prj.conf index 54321edc9523..05fc7b0b0287 100644 --- a/tests/subsys/usb/device_next/prj.conf +++ b/tests/subsys/usb/device_next/prj.conf @@ -6,6 +6,7 @@ CONFIG_ZTEST=y CONFIG_USB_DEVICE_STACK_NEXT=y CONFIG_USBD_LOOPBACK_CLASS=y +CONFIG_UDC_ENABLE_SOF=y CONFIG_UHC_DRIVER=y CONFIG_USB_HOST_STACK=y From b5d478d14b7ae33545de5e96ca9873366c458061 Mon Sep 17 00:00:00 2001 From: Johann Fischer Date: Thu, 12 Jun 2025 18:59:44 +0200 Subject: [PATCH 0174/2141] [nrf fromtree] usb: device_next: add the missing const qualifier and save some RAM MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In the USBD_DESC_STRING_DEFINE macro defenition the const qualifier is missing. Also, do not reserve room for the UTF16LE conversion, as this is done on the fly in the stack. Signed-off-by: Johann Fischer (cherry picked from commit 0e127e6b106fab5018f5f0122133ca7aef623212) Signed-off-by: Tomasz Moń --- include/zephyr/usb/usbd.h | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/include/zephyr/usb/usbd.h b/include/zephyr/usb/usbd.h index 1545af66c81c..27b684101b1e 100644 --- a/include/zephyr/usb/usbd.h +++ b/include/zephyr/usb/usbd.h @@ -43,18 +43,6 @@ extern "C" { /* Maximum bulk max packet size the stack supports */ #define USBD_MAX_BULK_MPS COND_CODE_1(USBD_SUPPORTS_HIGH_SPEED, (512), (64)) -/* - * The USB Unicode bString is encoded in UTF16LE, which means it takes up - * twice the amount of bytes than the same string encoded in ASCII7. - * Use this macro to determine the length of the bString array. - * - * bString length without null character: - * bString_length = (sizeof(initializer_string) - 1) * 2 - * or: - * bString_length = sizeof(initializer_string) * 2 - 2 - */ -#define USB_BSTRING_LENGTH(s) (sizeof(s) * 2 - 2) - /* * The length of the string descriptor (bLength) is calculated from the * size of the two octets bLength and bDescriptorType plus the @@ -574,7 +562,7 @@ static inline void *usbd_class_get_private(const struct usbd_class_data *const c * @param name Language string descriptor node identifier. */ #define USBD_DESC_LANG_DEFINE(name) \ - static uint16_t langid_##name = sys_cpu_to_le16(0x0409); \ + static const uint16_t langid_##name = sys_cpu_to_le16(0x0409); \ static struct usbd_desc_node name = { \ .str = { \ .idx = 0, \ @@ -597,7 +585,7 @@ static inline void *usbd_class_get_private(const struct usbd_class_data *const c * @param d_utype String descriptor usage type */ #define USBD_DESC_STRING_DEFINE(d_name, d_string, d_utype) \ - static uint8_t ascii_##d_name[USB_BSTRING_LENGTH(d_string)] = d_string; \ + static const uint8_t ascii_##d_name[sizeof(d_string)] = d_string; \ static struct usbd_desc_node d_name = { \ .str = { \ .utype = d_utype, \ From 368aac815f1339735603ff4d5b7c862d2df43765 Mon Sep 17 00:00:00 2001 From: Johann Fischer Date: Mon, 16 Jun 2025 17:03:11 +0200 Subject: [PATCH 0175/2141] [nrf fromtree] usb: device_next: hide Kconfig option USBD_MSG_SLAB_COUNT if not used MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If deferred mode is not being used, hide the USBD_MSG_SLAB_COUNT option. Signed-off-by: Johann Fischer (cherry picked from commit 452a53ba1a28747ca48a86e16a77ea3d8e1e7185) Signed-off-by: Tomasz Moń --- subsys/usb/device_next/Kconfig | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/subsys/usb/device_next/Kconfig b/subsys/usb/device_next/Kconfig index 987ef5e546ee..b72de53f0b34 100644 --- a/subsys/usb/device_next/Kconfig +++ b/subsys/usb/device_next/Kconfig @@ -74,13 +74,6 @@ config USBD_MAX_UDC_MSG help Maximum number of USB device controller events that can be queued. -config USBD_MSG_SLAB_COUNT - int "Maximum number of USB device notification messages" - range 4 64 - default 8 - help - Maximum number of USB device notification messages that can be queued. - config USBD_MSG_DEFERRED_MODE bool "Execute message callback from system workqueue" default y @@ -88,6 +81,13 @@ config USBD_MSG_DEFERRED_MODE Execute message callback from system workqueue. If disabled, message callback will be executed in the device stack context. +config USBD_MSG_SLAB_COUNT + int "Maximum number of USB device notification messages" if USBD_MSG_DEFERRED_MODE + range 4 64 + default 8 + help + Maximum number of USB device notification messages that can be queued. + config USBD_MSG_WORK_DELAY int "USB device notification messages work delay" if USBD_MSG_DEFERRED_MODE range 1 100 From b622ad0225f08c7412f3a52b1bbce006375252ca Mon Sep 17 00:00:00 2001 From: Johann Fischer Date: Tue, 17 Jun 2025 10:20:46 +0200 Subject: [PATCH 0176/2141] [nrf fromtree] usb: device_next: allow to limit number or digits in serial number MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add Kconfig option to limit the length requested from HWINFO to a meaningful number of digits. Also, check the length returned by the HWINFO driver and rename the variables to a more suitable name. Signed-off-by: Johann Fischer (cherry picked from commit 76579d21abb2ae22a7e19be1dd71af9cad10da4f) Signed-off-by: Tomasz Moń --- subsys/usb/device_next/Kconfig | 10 ++++++++++ subsys/usb/device_next/usbd_ch9.c | 25 +++++++++++++------------ 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/subsys/usb/device_next/Kconfig b/subsys/usb/device_next/Kconfig index b72de53f0b34..18b6860b0e6a 100644 --- a/subsys/usb/device_next/Kconfig +++ b/subsys/usb/device_next/Kconfig @@ -96,6 +96,16 @@ config USBD_MSG_WORK_DELAY Message work may need to be delayed because the device stack is not yet ready to publish the message. The delay unit is milliseconds. +config USBD_HWINFO_DEVID_LENGTH + int "The length of the device ID requested from HWINFO in bytes" + depends on HWINFO + range 8 128 + default 16 + help + Each byte represents two digits in the serial number string + descriptor. This option can be used to limit the length requested + from HWINFO to a meaningful number of digits. + rsource "class/Kconfig" rsource "app/Kconfig.cdc_acm_serial" diff --git a/subsys/usb/device_next/usbd_ch9.c b/subsys/usb/device_next/usbd_ch9.c index 3adb3574f0cb..599eb1611788 100644 --- a/subsys/usb/device_next/usbd_ch9.c +++ b/subsys/usb/device_next/usbd_ch9.c @@ -533,13 +533,13 @@ static int sreq_get_desc_cfg(struct usbd_context *const uds_ctx, return 0; } -#define USBD_HWID_SN_MAX 32U +#define USBD_SN_ASCII7_LENGTH (CONFIG_USBD_HWINFO_DEVID_LENGTH * 2) /* Generate valid USB device serial number from hwid */ -static ssize_t get_sn_from_hwid(uint8_t sn[static USBD_HWID_SN_MAX]) +static ssize_t get_sn_from_hwid(uint8_t sn[static USBD_SN_ASCII7_LENGTH]) { static const char hex[] = "0123456789ABCDEF"; - uint8_t hwid[USBD_HWID_SN_MAX / 2U]; + uint8_t hwid[USBD_SN_ASCII7_LENGTH / 2U]; ssize_t hwid_len = -ENOSYS; if (IS_ENABLED(CONFIG_HWINFO)) { @@ -554,36 +554,37 @@ static ssize_t get_sn_from_hwid(uint8_t sn[static USBD_HWID_SN_MAX]) return hwid_len; } - for (ssize_t i = 0; i < hwid_len; i++) { + for (ssize_t i = 0; i < MIN(hwid_len, sizeof(hwid)); i++) { sn[i * 2] = hex[hwid[i] >> 4]; sn[i * 2 + 1] = hex[hwid[i] & 0xF]; } - return hwid_len * 2; + return MIN(hwid_len, sizeof(hwid)) * 2; } /* Copy and convert ASCII-7 string descriptor to UTF16-LE */ static void string_ascii7_to_utf16le(struct usbd_desc_node *const dn, struct net_buf *const buf, const uint16_t wLength) { - uint8_t hwid_sn[USBD_HWID_SN_MAX]; + uint8_t sn_ascii7_str[USBD_SN_ASCII7_LENGTH]; struct usb_desc_header head = { .bDescriptorType = dn->bDescriptorType, }; - uint8_t *ascii7_str; + const uint8_t *ascii7_str; size_t len; size_t i; - if (dn->str.utype == USBD_DUT_STRING_SERIAL_NUMBER && dn->str.use_hwinfo) { - ssize_t hwid_len = get_sn_from_hwid(hwid_sn); + if (IS_ENABLED(CONFIG_HWINFO) && + dn->str.utype == USBD_DUT_STRING_SERIAL_NUMBER && dn->str.use_hwinfo) { + ssize_t sn_ascii7_str_len = get_sn_from_hwid(sn_ascii7_str); - if (hwid_len < 0) { + if (sn_ascii7_str_len < 0) { errno = -ENOTSUP; return; } - head.bLength = sizeof(head) + hwid_len * 2; - ascii7_str = hwid_sn; + head.bLength = sizeof(head) + sn_ascii7_str_len * 2; + ascii7_str = sn_ascii7_str; } else { head.bLength = dn->bLength; ascii7_str = (uint8_t *)dn->ptr; From e91055fb1e804a6914f6a04e54b0e5b0edb24a1a Mon Sep 17 00:00:00 2001 From: Johann Fischer Date: Tue, 17 Jun 2025 13:30:18 +0200 Subject: [PATCH 0177/2141] [nrf fromtree] usb: update USBD_DESC_SERIAL_NUMBER_DEFINE macro description MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update USBD_DESC_SERIAL_NUMBER_DEFINE macro description. Signed-off-by: Johann Fischer (cherry picked from commit c7b364e99a3646959c8ebeb2cecfb80764f620d7) Signed-off-by: Tomasz Moń --- include/zephyr/usb/usbd.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/include/zephyr/usb/usbd.h b/include/zephyr/usb/usbd.h index 27b684101b1e..029741f076d0 100644 --- a/include/zephyr/usb/usbd.h +++ b/include/zephyr/usb/usbd.h @@ -629,8 +629,11 @@ static inline void *usbd_class_get_private(const struct usbd_class_data *const c * * This macro defines a descriptor node that, when added to the device context, * is automatically used as the serial number string descriptor. A valid serial - * number is generated from HWID (HWINFO= whenever this string descriptor is - * requested. + * number is obtained from @ref hwinfo_interface whenever this string + * descriptor is requested. + * + * @note The HWINFO driver must be available and the Kconfig option HWINFO + * enabled. * * @param d_name String descriptor node identifier. */ From 7f1894c15968cbd2ff32861243b12132210c6409 Mon Sep 17 00:00:00 2001 From: Johann Fischer Date: Thu, 12 Jun 2025 12:46:48 +0200 Subject: [PATCH 0178/2141] [nrf fromtree] usb: device_next: rework CDC ACM serial for flash usage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Allow optimization if high speed is not supported. Unify strings for error logging. Allow the application to enable/disable the USB device. Signed-off-by: Johann Fischer (cherry picked from commit 09752374c5522644f9cd23991dc84e04bc64d98f) Signed-off-by: Tomasz Moń --- .../device_next/app/Kconfig.cdc_acm_serial | 7 ++++++ subsys/usb/device_next/app/cdc_acm_serial.c | 25 +++++++++++-------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/subsys/usb/device_next/app/Kconfig.cdc_acm_serial b/subsys/usb/device_next/app/Kconfig.cdc_acm_serial index dba212ba9baf..5192d5636d9e 100644 --- a/subsys/usb/device_next/app/Kconfig.cdc_acm_serial +++ b/subsys/usb/device_next/app/Kconfig.cdc_acm_serial @@ -16,6 +16,13 @@ menuconfig CDC_ACM_SERIAL_INITIALIZE_AT_BOOT if CDC_ACM_SERIAL_INITIALIZE_AT_BOOT +config CDC_ACM_SERIAL_ENABLE_AT_BOOT + bool "USB device will be enabled at boot" + default y + help + When disabled, the application is responsible for enabling/disabling + the USB device. + config CDC_ACM_SERIAL_MANUFACTURER_STRING string "USB device manufacturer string descriptor" default "Zephyr Project" diff --git a/subsys/usb/device_next/app/cdc_acm_serial.c b/subsys/usb/device_next/app/cdc_acm_serial.c index 6f8e64b3c8cf..af0814693030 100644 --- a/subsys/usb/device_next/app/cdc_acm_serial.c +++ b/subsys/usb/device_next/app/cdc_acm_serial.c @@ -12,7 +12,7 @@ #include #include -LOG_MODULE_REGISTER(cdc_acm_serial, LOG_LEVEL_DBG); +LOG_MODULE_REGISTER(cdc_acm_serial, CONFIG_USBD_LOG_LEVEL); /* * This is intended for use with cdc-acm-snippet or as a default serial backend @@ -79,19 +79,19 @@ static int cdc_acm_serial_init_device(void) err = usbd_add_descriptor(&cdc_acm_serial, &cdc_acm_serial_lang); if (err) { - LOG_ERR("Failed to initialize language descriptor (%d)", err); + LOG_ERR("Failed to initialize %s (%d)", "language descriptor", err); return err; } err = usbd_add_descriptor(&cdc_acm_serial, &cdc_acm_serial_mfr); if (err) { - LOG_ERR("Failed to initialize manufacturer descriptor (%d)", err); + LOG_ERR("Failed to initialize %s (%d)", "manufacturer descriptor", err); return err; } err = usbd_add_descriptor(&cdc_acm_serial, &cdc_acm_serial_product); if (err) { - LOG_ERR("Failed to initialize product descriptor (%d)", err); + LOG_ERR("Failed to initialize %s (%d)", "product descriptor", err); return err; } @@ -99,11 +99,12 @@ static int cdc_acm_serial_init_device(void) err = usbd_add_descriptor(&cdc_acm_serial, &cdc_acm_serial_sn); )) if (err) { - LOG_ERR("Failed to initialize SN descriptor (%d)", err); + LOG_ERR("Failed to initialize %s (%d)", "SN descriptor", err); return err; } - if (usbd_caps_speed(&cdc_acm_serial) == USBD_SPEED_HS) { + if (USBD_SUPPORTS_HIGH_SPEED && + usbd_caps_speed(&cdc_acm_serial) == USBD_SPEED_HS) { err = register_cdc_acm_0(&cdc_acm_serial, USBD_SPEED_HS); if (err) { return err; @@ -117,14 +118,16 @@ static int cdc_acm_serial_init_device(void) err = usbd_init(&cdc_acm_serial); if (err) { - LOG_ERR("Failed to initialize device support"); + LOG_ERR("Failed to initialize %s (%d)", "device support", err); return err; } - err = usbd_enable(&cdc_acm_serial); - if (err) { - LOG_ERR("Failed to enable device support"); - return err; + if (IS_ENABLED(CONFIG_CDC_ACM_SERIAL_ENABLE_AT_BOOT)) { + err = usbd_enable(&cdc_acm_serial); + if (err) { + LOG_ERR("Failed to enable %s (%d)", "device support", err); + return err; + } } return 0; From 089285f9ae55d10ace5a5e4c25f84e52ecf3c223 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mo=C5=84?= Date: Tue, 10 Jun 2025 12:37:55 +0200 Subject: [PATCH 0179/2141] [nrf fromtree] drivers: udc_dwc2: Use spin lock for synchronization MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace irq_lock() with spin lock which is proper synchronization primitive that should be used. Because non-SMP implementations are allowed to optimize spin lock to just locking interrupts the resulting code is the same on all currently supported DWC2 targets. Signed-off-by: Tomasz Moń (cherry picked from commit 70cd0ab56720f973255111ff38e4696669b4f936) --- drivers/usb/udc/udc_dwc2.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/usb/udc/udc_dwc2.c b/drivers/usb/udc/udc_dwc2.c index cb52f711fcbe..bebe7973a487 100644 --- a/drivers/usb/udc/udc_dwc2.c +++ b/drivers/usb/udc/udc_dwc2.c @@ -102,6 +102,7 @@ struct dwc2_reg_backup { /* Driver private data per instance */ struct udc_dwc2_data { + struct k_spinlock lock; struct k_thread thread_data; /* Main events the driver thread waits for */ struct k_event drv_evt; @@ -462,7 +463,7 @@ static int dwc2_tx_fifo_write(const struct device *dev, uint32_t max_xfersize, max_pktcnt, pktcnt; const uint32_t addnl = USB_MPS_ADDITIONAL_TRANSACTIONS(cfg->mps); const size_t d = sizeof(uint32_t); - unsigned int key; + k_spinlock_key_t key; uint32_t len; const bool is_periodic = dwc2_ep_is_periodic(cfg); const bool is_iso = dwc2_ep_is_iso(cfg); @@ -537,7 +538,7 @@ static int dwc2_tx_fifo_write(const struct device *dev, priv->tx_len[ep_idx] = len; /* Lock and write to endpoint FIFO */ - key = irq_lock(); + key = k_spin_lock(&priv->lock); /* Set number of packets and transfer size */ sys_write32((is_periodic ? usb_dwc2_set_dieptsizn_mc(1 + addnl) : 0) | @@ -549,7 +550,7 @@ static int dwc2_tx_fifo_write(const struct device *dev, /* Cannot continue unless buffer is bounced. Device will * cease to function. Is fatal error appropriate here? */ - irq_unlock(key); + k_spin_unlock(&priv->lock, key); return -ENOTSUP; } @@ -565,7 +566,7 @@ static int dwc2_tx_fifo_write(const struct device *dev, * no fifo is assigned to inactive endpoint and therefore it is * possible that the write will corrupt other endpoint fifo. */ - irq_unlock(key); + k_spin_unlock(&priv->lock, key); return -ENOENT; } @@ -615,7 +616,7 @@ static int dwc2_tx_fifo_write(const struct device *dev, } } - irq_unlock(key); + k_spin_unlock(&priv->lock, key); return 0; } From 77e2d806340cc9d6a33beed45f596572d30130fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mo=C5=84?= Date: Tue, 10 Jun 2025 15:29:41 +0200 Subject: [PATCH 0180/2141] [nrf fromtree] drivers: udc_dwc2: Optimize incomplete iso handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit At High-Speed there is at most 25 us handling window for incomplete iso IN/OUT and therefore determining which endpoints are isochronous is too wasteful. Add lookup variable holding which isochronous endpoints are enabled and limit the search to only enabled endpoints. For applications with just one OUT and one IN isochronous endpoint this is optimal. The lookup variable is updated only when mutex is held. Interrupt handler accesses the variable read-only and in general there is no problem is incomplete iso handling interrupt hits when the lookup variable is updated, because: * when endpoint is just activated, it cannot be source of incomplete iso interrupt because the endpoint is not armed yet * when endpoint is just deactivated, it was first disabled If there is more than one isochronous endpoint same direction then just relying on endpoint enabled is not necessarily optimal. However, in order to be able to limit the search to only armed endpoints, the lookup variable would have to be updated on every transfer preparation and completion which would require more time-expensive synchronization. Signed-off-by: Tomasz Moń (cherry picked from commit 9aff5da68abd9870ab1ee244aeb9633492c34c2c) --- drivers/usb/udc/udc_dwc2.c | 100 +++++++++++++++++++++---------------- 1 file changed, 57 insertions(+), 43 deletions(-) diff --git a/drivers/usb/udc/udc_dwc2.c b/drivers/usb/udc/udc_dwc2.c index bebe7973a487..779600321e16 100644 --- a/drivers/usb/udc/udc_dwc2.c +++ b/drivers/usb/udc/udc_dwc2.c @@ -116,6 +116,8 @@ struct udc_dwc2_data { uint32_t max_pktcnt; uint32_t tx_len[16]; uint32_t rx_siz[16]; + /* Isochronous endpoint enabled (IN on bits 0-15, OUT on bits 16-31) */ + uint32_t iso_enabled; uint16_t txf_set; uint16_t pending_tx_flush; uint16_t dfifodepth; @@ -1475,6 +1477,12 @@ static int udc_dwc2_ep_activate(const struct device *dev, dwc2_set_epint(dev, cfg, true); sys_write32(dxepctl, dxepctl_reg); + if (dwc2_ep_is_iso(cfg)) { + uint8_t ep_bit = ep_idx + (USB_EP_DIR_IS_OUT(cfg->addr) ? 16 : 0); + + priv->iso_enabled |= BIT(ep_bit); + } + for (uint8_t i = 1U; i < priv->ineps; i++) { LOG_DBG("DIEPTXF%u %08x DIEPCTL%u %08x", i, sys_read32((mem_addr_t)&base->dieptxf[i - 1U]), i, dxepctl); @@ -1668,6 +1676,7 @@ static void udc_dwc2_ep_disable(const struct device *dev, static int udc_dwc2_ep_deactivate(const struct device *dev, struct udc_ep_config *const cfg) { + struct udc_dwc2_data *const priv = udc_get_private(dev); uint8_t ep_idx = USB_EP_GET_IDX(cfg->addr); mem_addr_t dxepctl_reg; uint32_t dxepctl; @@ -1696,6 +1705,12 @@ static int udc_dwc2_ep_deactivate(const struct device *dev, sys_write32(dxepctl, dxepctl_reg); dwc2_set_epint(dev, cfg, false); + if (dwc2_ep_is_iso(cfg)) { + uint8_t ep_bit = ep_idx + (USB_EP_DIR_IS_OUT(cfg->addr) ? 16 : 0); + + priv->iso_enabled &= ~BIT(ep_bit); + } + return 0; } @@ -2306,6 +2321,7 @@ static int dwc2_driver_preinit(const struct device *dev) k_event_init(&priv->drv_evt); atomic_clear(&priv->xfer_new); atomic_clear(&priv->xfer_finished); + priv->iso_enabled = 0; data->caps.rwup = true; data->caps.addr_before_status = true; @@ -2762,38 +2778,37 @@ static void dwc2_handle_incompisoin(const struct device *dev) USB_DWC2_DEPCTL_EPENA | usb_dwc2_set_depctl_eptype(USB_DWC2_DEPCTL_EPTYPE_ISO) | USB_DWC2_DEPCTL_USBACTEP; + uint32_t eps = priv->iso_enabled & 0x0000FFFFUL; - for (uint8_t i = 1U; i < priv->numdeveps; i++) { - uint32_t epdir = usb_dwc2_get_ghwcfg1_epdir(priv->ghwcfg1, i); - - if (epdir == USB_DWC2_GHWCFG1_EPDIR_IN || - epdir == USB_DWC2_GHWCFG1_EPDIR_BDIR) { - mem_addr_t diepctl_reg = dwc2_get_dxepctl_reg(dev, i | USB_EP_DIR_IN); - uint32_t diepctl; + while (eps) { + uint8_t i = find_lsb_set(eps) - 1; + mem_addr_t diepctl_reg = dwc2_get_dxepctl_reg(dev, i | USB_EP_DIR_IN); + uint32_t diepctl; - diepctl = sys_read32(diepctl_reg); + diepctl = sys_read32(diepctl_reg); - /* Check if endpoint didn't receive ISO OUT data */ - if ((diepctl & mask) == val) { - struct udc_ep_config *cfg; - struct net_buf *buf; + /* Check if endpoint didn't receive ISO IN data */ + if ((diepctl & mask) == val) { + struct udc_ep_config *cfg; + struct net_buf *buf; - cfg = udc_get_ep_cfg(dev, i | USB_EP_DIR_IN); - __ASSERT_NO_MSG(cfg && cfg->stat.enabled && - dwc2_ep_is_iso(cfg)); + cfg = udc_get_ep_cfg(dev, i | USB_EP_DIR_IN); + __ASSERT_NO_MSG(cfg && cfg->stat.enabled && + dwc2_ep_is_iso(cfg)); - udc_dwc2_ep_disable(dev, cfg, false); + udc_dwc2_ep_disable(dev, cfg, false); - buf = udc_buf_get(cfg); - if (buf) { - /* Data is no longer relevant */ - udc_submit_ep_event(dev, buf, 0); + buf = udc_buf_get(cfg); + if (buf) { + /* Data is no longer relevant */ + udc_submit_ep_event(dev, buf, 0); - /* Try to queue next packet before SOF */ - dwc2_handle_xfer_next(dev, cfg); - } + /* Try to queue next packet before SOF */ + dwc2_handle_xfer_next(dev, cfg); } } + + eps &= ~BIT(i); } sys_write32(USB_DWC2_GINTSTS_INCOMPISOIN, gintsts_reg); @@ -2817,34 +2832,33 @@ static void dwc2_handle_incompisoout(const struct device *dev) usb_dwc2_set_depctl_eptype(USB_DWC2_DEPCTL_EPTYPE_ISO) | ((priv->sof_num & 1) ? USB_DWC2_DEPCTL_DPID : 0) | USB_DWC2_DEPCTL_USBACTEP; + uint32_t eps = (priv->iso_enabled & 0xFFFF0000UL) >> 16; - for (uint8_t i = 1U; i < priv->numdeveps; i++) { - uint32_t epdir = usb_dwc2_get_ghwcfg1_epdir(priv->ghwcfg1, i); + while (eps) { + uint8_t i = find_lsb_set(eps) - 1; + mem_addr_t doepctl_reg = dwc2_get_dxepctl_reg(dev, i); + uint32_t doepctl; - if (epdir == USB_DWC2_GHWCFG1_EPDIR_OUT || - epdir == USB_DWC2_GHWCFG1_EPDIR_BDIR) { - mem_addr_t doepctl_reg = dwc2_get_dxepctl_reg(dev, i); - uint32_t doepctl; - - doepctl = sys_read32(doepctl_reg); + doepctl = sys_read32(doepctl_reg); - /* Check if endpoint didn't receive ISO OUT data */ - if ((doepctl & mask) == val) { - struct udc_ep_config *cfg; - struct net_buf *buf; + /* Check if endpoint didn't receive ISO OUT data */ + if ((doepctl & mask) == val) { + struct udc_ep_config *cfg; + struct net_buf *buf; - cfg = udc_get_ep_cfg(dev, i); - __ASSERT_NO_MSG(cfg && cfg->stat.enabled && - dwc2_ep_is_iso(cfg)); + cfg = udc_get_ep_cfg(dev, i); + __ASSERT_NO_MSG(cfg && cfg->stat.enabled && + dwc2_ep_is_iso(cfg)); - udc_dwc2_ep_disable(dev, cfg, false); + udc_dwc2_ep_disable(dev, cfg, false); - buf = udc_buf_get(cfg); - if (buf) { - udc_submit_ep_event(dev, buf, 0); - } + buf = udc_buf_get(cfg); + if (buf) { + udc_submit_ep_event(dev, buf, 0); } } + + eps &= ~BIT(i); } sys_write32(USB_DWC2_GINTSTS_INCOMPISOOUT, gintsts_reg); From fb42c976235d7724f895bd9ad2a310877ff203fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mo=C5=84?= Date: Mon, 20 Jan 2025 11:31:59 +0100 Subject: [PATCH 0181/2141] [nrf fromtree] drivers: udc_dwc2: Disable endpoints asynchronously MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Do not synchronously wait for endpoint interrupt bits when disarming endpoints. Introduce ep_disabled k_event that makes it possible for application to wait for the action to take effect which is necessary when handling SetFeature(ENDPOINT_HALT) or SetInterface() requests. This change improves incomplete iso IN and OUT handling performance, especially when there are multiple isochronous endpoints that need servicing. Signed-off-by: Tomasz Moń (cherry picked from commit d29719e27ed3615842d8df2d9aff30f63d2f384d) --- drivers/usb/udc/udc_dwc2.c | 230 +++++++++++++++++++++++-------------- 1 file changed, 146 insertions(+), 84 deletions(-) diff --git a/drivers/usb/udc/udc_dwc2.c b/drivers/usb/udc/udc_dwc2.c index 779600321e16..09ed5aaa0141 100644 --- a/drivers/usb/udc/udc_dwc2.c +++ b/drivers/usb/udc/udc_dwc2.c @@ -106,6 +106,8 @@ struct udc_dwc2_data { struct k_thread thread_data; /* Main events the driver thread waits for */ struct k_event drv_evt; + /* Endpoint is considered disabled when there is no active transfer */ + struct k_event ep_disabled; /* Transfer triggers (IN on bits 0-15, OUT on bits 16-31) */ atomic_t xfer_new; /* Finished transactions (IN on bits 0-15, OUT on bits 16-31) */ @@ -118,6 +120,9 @@ struct udc_dwc2_data { uint32_t rx_siz[16]; /* Isochronous endpoint enabled (IN on bits 0-15, OUT on bits 16-31) */ uint32_t iso_enabled; + uint16_t iso_in_rearm; + uint16_t ep_out_disable; + uint16_t ep_out_stall; uint16_t txf_set; uint16_t pending_tx_flush; uint16_t dfifodepth; @@ -145,7 +150,8 @@ struct udc_dwc2_data { }; static void udc_dwc2_ep_disable(const struct device *dev, - struct udc_ep_config *const cfg, bool stall); + struct udc_ep_config *const cfg, + bool stall, bool wait); #if defined(CONFIG_PINCTRL) #include @@ -618,6 +624,7 @@ static int dwc2_tx_fifo_write(const struct device *dev, } } + k_event_clear(&priv->ep_disabled, BIT(ep_idx)); k_spin_unlock(&priv->lock, key); return 0; @@ -761,6 +768,8 @@ static void dwc2_prep_rx(const struct device *dev, struct net_buf *buf, sys_write32(doepctl, doepctl_reg); + k_event_clear(&priv->ep_disabled, BIT(16 + ep_idx)); + LOG_INF("Prepare RX 0x%02x doeptsiz 0x%x", cfg->addr, doeptsiz); } @@ -827,7 +836,7 @@ static int dwc2_handle_evt_setup(const struct device *dev) * transfer beforehand. In Buffer DMA the SETUP can be copied to any EP0 * OUT buffer. If there is any buffer queued, it is obsolete now. */ - udc_dwc2_ep_disable(dev, cfg_in, false); + udc_dwc2_ep_disable(dev, cfg_in, false, true); atomic_and(&priv->xfer_finished, ~(BIT(0) | BIT(16))); buf = udc_buf_get_all(cfg_out); @@ -1522,16 +1531,19 @@ static int dwc2_unset_dedicated_fifo(const struct device *dev, * incoming OUT data (or HS PING) even if there is space available in RxFIFO. * * Set stall parameter to true if caller wants to send STALL instead of NAK. + * Set wait parameter to true to caller wants the function to return only after + * the requested operation is effective (or after 100 ms timeout). */ static void udc_dwc2_ep_disable(const struct device *dev, - struct udc_ep_config *const cfg, bool stall) + struct udc_ep_config *const cfg, + bool stall, bool wait) { struct udc_dwc2_data *const priv = udc_get_private(dev); struct usb_dwc2_reg *const base = dwc2_get_base(dev); uint8_t ep_idx = USB_EP_GET_IDX(cfg->addr); + uint8_t ep_bit = ep_idx + (USB_EP_DIR_IS_OUT(cfg->addr) ? 16 : 0); mem_addr_t dxepctl_reg; uint32_t dxepctl; - const bool is_iso = dwc2_ep_is_iso(cfg); dxepctl_reg = dwc2_get_dxepctl_reg(dev, cfg->addr); dxepctl = sys_read32(dxepctl_reg); @@ -1567,104 +1579,55 @@ static void udc_dwc2_ep_disable(const struct device *dev, priv->pending_tx_flush |= BIT(usb_dwc2_get_depctl_txfnum(dxepctl)); } + k_event_post(&priv->ep_disabled, BIT(ep_bit)); udc_ep_set_busy(cfg, false); return; } - if (!is_iso && (dxepctl & USB_DWC2_DEPCTL_NAKSTS) && - !(dxepctl & USB_DWC2_DEPCTL_EPENA)) { - /* Endpoint already sends forced NAKs. STALL if necessary. */ + if (k_event_test(&priv->ep_disabled, BIT(ep_bit))) { + /* There is no active transfer, STALL if necessary */ if (stall) { dxepctl |= USB_DWC2_DEPCTL_STALL; sys_write32(dxepctl, dxepctl_reg); } + /* Do not start pending transfers (if any) */ + atomic_clear_bit(&priv->xfer_new, ep_bit); + return; } - /* FIXME: This function needs to be changed to not synchronously wait - * for the events to happen because the actions here are racing against - * the USB host packets. It is possible that the IN token or OUT DATA - * gets sent shortly before this function disables the endpoint. If this - * happens, the XferCompl would be set and driver will incorrectly think - * that either: - * * never queued transfer finished, OR - * * transfer queued in incompisoin handler finished (before it really - * does and then it'll "double"-finish when it actually finishes) - * - * For the time being XferCompl is cleared as a workaround. - */ - if (USB_EP_DIR_IS_OUT(cfg->addr)) { - mem_addr_t dctl_reg, gintsts_reg, doepint_reg; - uint32_t dctl; - - dctl_reg = (mem_addr_t)&base->dctl; - gintsts_reg = (mem_addr_t)&base->gintsts; - doepint_reg = (mem_addr_t)&base->out_ep[ep_idx].doepint; - - dctl = sys_read32(dctl_reg); - - if (sys_read32(gintsts_reg) & USB_DWC2_GINTSTS_GOUTNAKEFF) { - LOG_ERR("GOUTNAKEFF already active"); - } else { - dctl |= USB_DWC2_DCTL_SGOUTNAK; - sys_write32(dctl, dctl_reg); - dctl &= ~USB_DWC2_DCTL_SGOUTNAK; - } - - dwc2_wait_for_bit(dev, gintsts_reg, USB_DWC2_GINTSTS_GOUTNAKEFF); - - /* The application cannot disable control OUT endpoint 0. */ - if (ep_idx != 0) { - dxepctl |= USB_DWC2_DEPCTL_EPENA | USB_DWC2_DEPCTL_EPDIS; - } + k_spinlock_key_t key = k_spin_lock(&priv->lock); + priv->ep_out_disable |= BIT(ep_idx); if (stall) { - /* For OUT endpoints STALL is set instead of SNAK */ - dxepctl |= USB_DWC2_DEPCTL_STALL; - } else { - dxepctl |= USB_DWC2_DEPCTL_SNAK; + priv->ep_out_stall |= BIT(ep_idx); } - sys_write32(dxepctl, dxepctl_reg); - if (ep_idx != 0) { - dwc2_wait_for_bit(dev, doepint_reg, USB_DWC2_DOEPINT_EPDISBLD); - } + sys_set_bits((mem_addr_t)&base->dctl, USB_DWC2_DCTL_SGOUTNAK); - /* Clear Endpoint Disabled interrupt */ - sys_write32(USB_DWC2_DOEPINT_EPDISBLD | USB_DWC2_DOEPINT_XFERCOMPL, doepint_reg); + k_spin_unlock(&priv->lock, key); - dctl |= USB_DWC2_DCTL_CGOUTNAK; - sys_write32(dctl, dctl_reg); + /* Endpoint gets disabled in GOUTNAKEFF handler */ } else { - mem_addr_t diepint_reg; - - diepint_reg = (mem_addr_t)&base->in_ep[ep_idx].diepint; - - dxepctl |= USB_DWC2_DEPCTL_EPENA | USB_DWC2_DEPCTL_SNAK; + dxepctl |= USB_DWC2_DEPCTL_SNAK; if (stall) { /* For IN endpoints STALL is set in addition to SNAK */ dxepctl |= USB_DWC2_DEPCTL_STALL; } sys_write32(dxepctl, dxepctl_reg); - dwc2_wait_for_bit(dev, diepint_reg, USB_DWC2_DIEPINT_INEPNAKEFF); - - dxepctl |= USB_DWC2_DEPCTL_EPENA | USB_DWC2_DEPCTL_EPDIS; - sys_write32(dxepctl, dxepctl_reg); - - dwc2_wait_for_bit(dev, diepint_reg, USB_DWC2_DIEPINT_EPDISBLD); + /* Endpoint gets disabled in INEPNAKEFF handler */ + } - /* Clear Endpoint Disabled interrupt */ - sys_write32(USB_DWC2_DIEPINT_EPDISBLD | USB_DWC2_DIEPINT_XFERCOMPL, diepint_reg); + if (wait) { + uint32_t ret; - /* TODO: Read DIEPTSIZn here? Programming Guide suggest it to - * let application know how many bytes of interrupted transfer - * were transferred to the host. - */ - - dwc2_flush_tx_fifo(dev, usb_dwc2_get_depctl_txfnum(dxepctl)); + ret = k_event_wait(&priv->ep_disabled, BIT(ep_bit), false, K_MSEC(100)); + if (ret == 0) { + LOG_ERR("Endpoint 0x%02x disable timeout", cfg->addr); + } } udc_ep_set_busy(cfg, false); @@ -1688,7 +1651,7 @@ static int udc_dwc2_ep_deactivate(const struct device *dev, LOG_DBG("Disable ep 0x%02x DxEPCTL%u %x", cfg->addr, ep_idx, dxepctl); - udc_dwc2_ep_disable(dev, cfg, false); + udc_dwc2_ep_disable(dev, cfg, false, true); dxepctl = sys_read32(dxepctl_reg); dxepctl &= ~USB_DWC2_DEPCTL_USBACTEP; @@ -1719,7 +1682,7 @@ static int udc_dwc2_ep_set_halt(const struct device *dev, { uint8_t ep_idx = USB_EP_GET_IDX(cfg->addr); - udc_dwc2_ep_disable(dev, cfg, true); + udc_dwc2_ep_disable(dev, cfg, true, true); LOG_DBG("Set halt ep 0x%02x", cfg->addr); if (ep_idx != 0) { @@ -1794,7 +1757,7 @@ static int udc_dwc2_ep_dequeue(const struct device *dev, { struct net_buf *buf; - udc_dwc2_ep_disable(dev, cfg, false); + udc_dwc2_ep_disable(dev, cfg, false, true); buf = udc_buf_get_all(cfg); if (buf) { @@ -2184,7 +2147,8 @@ static int udc_dwc2_init_controller(const struct device *dev) USB_DWC2_GINTSTS_INCOMPISOIN |)) USB_DWC2_GINTSTS_OEPINT | USB_DWC2_GINTSTS_IEPINT | USB_DWC2_GINTSTS_ENUMDONE | USB_DWC2_GINTSTS_USBRST | - USB_DWC2_GINTSTS_WKUPINT | USB_DWC2_GINTSTS_USBSUSP, + USB_DWC2_GINTSTS_WKUPINT | USB_DWC2_GINTSTS_USBSUSP | + USB_DWC2_GINTSTS_GOUTNAKEFF, (mem_addr_t)&base->gintmsk); return 0; @@ -2321,6 +2285,10 @@ static int dwc2_driver_preinit(const struct device *dev) k_event_init(&priv->drv_evt); atomic_clear(&priv->xfer_new); atomic_clear(&priv->xfer_finished); + k_event_init(&priv->ep_disabled); + k_event_set(&priv->ep_disabled, UINT32_MAX); + priv->ep_out_disable = 0; + priv->ep_out_stall = 0; priv->iso_enabled = 0; data->caps.rwup = true; @@ -2439,6 +2407,7 @@ static void dwc2_on_bus_reset(const struct device *dev) struct usb_dwc2_reg *const base = dwc2_get_base(dev); struct udc_dwc2_data *const priv = udc_get_private(dev); uint32_t doepmsk; + uint32_t diepmsk; /* Set the NAK bit for all OUT endpoints */ for (uint8_t i = 0U; i < priv->numdeveps; i++) { @@ -2453,13 +2422,16 @@ static void dwc2_on_bus_reset(const struct device *dev) } } - doepmsk = USB_DWC2_DOEPINT_SETUP | USB_DWC2_DOEPINT_XFERCOMPL; + doepmsk = USB_DWC2_DOEPINT_SETUP | USB_DWC2_DOEPINT_EPDISBLD | USB_DWC2_DOEPINT_XFERCOMPL; if (dwc2_in_buffer_dma_mode(dev)) { doepmsk |= USB_DWC2_DOEPINT_STSPHSERCVD; } sys_write32(doepmsk, (mem_addr_t)&base->doepmsk); - sys_set_bits((mem_addr_t)&base->diepmsk, USB_DWC2_DIEPINT_XFERCOMPL); + + diepmsk = USB_DWC2_DIEPINT_INEPNAKEFF | USB_DWC2_DIEPINT_EPDISBLD | + USB_DWC2_DIEPINT_XFERCOMPL; + sys_write32(diepmsk, (mem_addr_t)&base->diepmsk); /* Software has to handle RxFLvl interrupt only in Completer mode */ if (dwc2_in_completer_mode(dev)) { @@ -2583,11 +2555,13 @@ static inline void dwc2_handle_in_xfercompl(const struct device *dev, } atomic_set_bit(&priv->xfer_finished, ep_idx); + k_event_post(&priv->ep_disabled, BIT(ep_idx)); k_event_post(&priv->drv_evt, BIT(DWC2_DRV_EVT_EP_FINISHED)); } static inline void dwc2_handle_iepint(const struct device *dev) { + struct udc_dwc2_data *const priv = udc_get_private(dev); struct usb_dwc2_reg *const base = dwc2_get_base(dev); uint32_t diepmsk; uint32_t epint; @@ -2598,6 +2572,7 @@ static inline void dwc2_handle_iepint(const struct device *dev) while (epint) { uint8_t n = find_lsb_set(epint) - 1; mem_addr_t diepint_reg = (mem_addr_t)&base->in_ep[n].diepint; + mem_addr_t diepctl_reg = (mem_addr_t)&base->in_ep[n].diepctl; uint32_t diepint; uint32_t status; @@ -2613,6 +2588,33 @@ static inline void dwc2_handle_iepint(const struct device *dev) dwc2_handle_in_xfercompl(dev, n); } + if (status & USB_DWC2_DIEPINT_INEPNAKEFF) { + sys_set_bits(diepctl_reg, USB_DWC2_DEPCTL_EPDIS); + } + + if (status & USB_DWC2_DIEPINT_EPDISBLD) { + uint32_t diepctl = sys_read32(diepctl_reg); + + k_event_post(&priv->ep_disabled, BIT(n)); + + /* TODO: Read DIEPTSIZn here? Programming Guide suggest it to + * let application know how many bytes of interrupted transfer + * were transferred to the host. + */ + + dwc2_flush_tx_fifo(dev, usb_dwc2_get_depctl_txfnum(diepctl)); + + if ((usb_dwc2_get_depctl_eptype(diepctl) == USB_DWC2_DEPCTL_EPTYPE_ISO) && + (priv->iso_in_rearm & BIT(n))) { + struct udc_ep_config *cfg = udc_get_ep_cfg(dev, n | USB_EP_DIR_IN); + + /* Try to queue next packet before SOF */ + dwc2_handle_xfer_next(dev, cfg); + + priv->iso_in_rearm &= ~BIT(n); + } + } + epint &= ~BIT(n); } @@ -2688,6 +2690,7 @@ static inline void dwc2_handle_out_xfercompl(const struct device *dev, dwc2_prep_rx(dev, buf, ep_cfg); } else { atomic_set_bit(&priv->xfer_finished, 16 + ep_idx); + k_event_post(&priv->ep_disabled, BIT(16 + ep_idx)); k_event_post(&priv->drv_evt, BIT(DWC2_DRV_EVT_EP_FINISHED)); } } @@ -2754,6 +2757,10 @@ static inline void dwc2_handle_oepint(const struct device *dev) dwc2_handle_out_xfercompl(dev, n); } + if (status & USB_DWC2_DOEPINT_EPDISBLD) { + k_event_post(&priv->ep_disabled, BIT(16 + n)); + } + epint &= ~BIT(n); } @@ -2779,6 +2786,7 @@ static void dwc2_handle_incompisoin(const struct device *dev) usb_dwc2_set_depctl_eptype(USB_DWC2_DEPCTL_EPTYPE_ISO) | USB_DWC2_DEPCTL_USBACTEP; uint32_t eps = priv->iso_enabled & 0x0000FFFFUL; + uint16_t rearm = 0; while (eps) { uint8_t i = find_lsb_set(eps) - 1; @@ -2796,21 +2804,23 @@ static void dwc2_handle_incompisoin(const struct device *dev) __ASSERT_NO_MSG(cfg && cfg->stat.enabled && dwc2_ep_is_iso(cfg)); - udc_dwc2_ep_disable(dev, cfg, false); + udc_dwc2_ep_disable(dev, cfg, false, false); buf = udc_buf_get(cfg); if (buf) { /* Data is no longer relevant */ udc_submit_ep_event(dev, buf, 0); - /* Try to queue next packet before SOF */ - dwc2_handle_xfer_next(dev, cfg); + rearm |= BIT(i); } } eps &= ~BIT(i); } + /* Mark endpoints to re-arm in EPDISBLD handler */ + priv->iso_in_rearm = rearm; + sys_write32(USB_DWC2_GINTSTS_INCOMPISOIN, gintsts_reg); } @@ -2850,7 +2860,7 @@ static void dwc2_handle_incompisoout(const struct device *dev) __ASSERT_NO_MSG(cfg && cfg->stat.enabled && dwc2_ep_is_iso(cfg)); - udc_dwc2_ep_disable(dev, cfg, false); + udc_dwc2_ep_disable(dev, cfg, false, false); buf = udc_buf_get(cfg); if (buf) { @@ -2864,6 +2874,51 @@ static void dwc2_handle_incompisoout(const struct device *dev) sys_write32(USB_DWC2_GINTSTS_INCOMPISOOUT, gintsts_reg); } +static void dwc2_handle_goutnakeff(const struct device *dev) +{ + const struct udc_dwc2_config *const config = dev->config; + struct usb_dwc2_reg *const base = config->base; + struct udc_dwc2_data *const priv = udc_get_private(dev); + k_spinlock_key_t key; + mem_addr_t doepctl_reg; + uint32_t doepctl; + + key = k_spin_lock(&priv->lock); + + while (priv->ep_out_disable) { + uint8_t ep_idx = find_lsb_set(priv->ep_out_disable) - 1; + + priv->ep_out_disable &= ~BIT(ep_idx); + + doepctl_reg = (mem_addr_t)&base->out_ep[ep_idx].doepctl; + doepctl = sys_read32(doepctl_reg); + + /* The application cannot disable control OUT endpoint 0. */ + if (ep_idx != 0) { + doepctl |= USB_DWC2_DEPCTL_EPDIS; + } + + if (priv->ep_out_stall & BIT(ep_idx)) { + /* For OUT endpoints STALL is set instead of SNAK */ + doepctl |= USB_DWC2_DEPCTL_STALL; + priv->ep_out_stall &= ~BIT(ep_idx); + } else { + doepctl |= USB_DWC2_DEPCTL_SNAK; + } + + sys_write32(doepctl, doepctl_reg); + + if (ep_idx == 0) { + /* Consider endpoint to be disabled */ + k_event_post(&priv->ep_disabled, BIT(16)); + } + } + + sys_set_bits((mem_addr_t)&base->dctl, USB_DWC2_DCTL_CGOUTNAK); + + k_spin_unlock(&priv->lock, key); +} + static void udc_dwc2_isr_handler(const struct device *dev) { const struct udc_dwc2_config *const config = dev->config; @@ -2969,6 +3024,13 @@ static void udc_dwc2_isr_handler(const struct device *dev) dwc2_handle_incompisoout(dev); } + if (int_status & USB_DWC2_GINTSTS_GOUTNAKEFF) { + /* Clear Global OUT NAK Effective interrupt. */ + sys_write32(USB_DWC2_GINTSTS_GOUTNAKEFF, gintsts_reg); + + dwc2_handle_goutnakeff(dev); + } + if (int_status & USB_DWC2_GINTSTS_USBSUSP) { /* Clear USB Suspend interrupt. */ sys_write32(USB_DWC2_GINTSTS_USBSUSP, gintsts_reg); From ab18a04cfb8d294e15b3e075a04f9d2d10d9f66c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mo=C5=84?= Date: Tue, 24 Jun 2025 14:47:44 +0200 Subject: [PATCH 0182/2141] [nrf fromtree] usb: device_next: uac2: Do not leak double buffered endpoint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit UDC drivers use udc_buf_get_all() when dequeueing endpoint. On drivers that require double buffering for isochronous IN endpoint, the dequeue on interface disable will result in class request API called on net_buf with frags set. Call release callback on the buffer pointed in frags because it was passed in using usbd_uac2_send(). Signed-off-by: Tomasz Moń (cherry picked from commit b3e80c5faadda64e1082fcbc492d78cc64a3c185) --- subsys/usb/device_next/class/usbd_uac2.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/subsys/usb/device_next/class/usbd_uac2.c b/subsys/usb/device_next/class/usbd_uac2.c index 2e55a9a017af..efa3fd6cdf32 100644 --- a/subsys/usb/device_next/class/usbd_uac2.c +++ b/subsys/usb/device_next/class/usbd_uac2.c @@ -816,6 +816,9 @@ static int uac2_request(struct usbd_class_data *const c_data, struct net_buf *bu ctx->user_data); } else if (!is_feedback) { ctx->ops->buf_release_cb(dev, terminal, buf->__buf, ctx->user_data); + if (buf->frags) { + ctx->ops->buf_release_cb(dev, terminal, buf->frags->__buf, ctx->user_data); + } } usbd_ep_buf_free(uds_ctx, buf); From a35a0bb0c2519a9921b4f6a396886a85b2c953f1 Mon Sep 17 00:00:00 2001 From: Johann Fischer Date: Tue, 1 Jul 2025 17:15:43 +0200 Subject: [PATCH 0183/2141] [nrf fromtree] drivers: udc_dwc2: do not throw error when FIFO settings can be reused MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the endpoint is re-enabled, check if the current FIFO settings can be reused. Further work is needed to improve FIFO memory handling for more advanced interface configurations. Signed-off-by: Johann Fischer (cherry picked from commit 56b359b8f52bbc90e7f31692ace488c9d68083a2) Signed-off-by: Tomasz Moń --- drivers/usb/udc/udc_dwc2.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/drivers/usb/udc/udc_dwc2.c b/drivers/usb/udc/udc_dwc2.c index 09ed5aaa0141..5a47a23294c8 100644 --- a/drivers/usb/udc/udc_dwc2.c +++ b/drivers/usb/udc/udc_dwc2.c @@ -1328,12 +1328,6 @@ static int dwc2_set_dedicated_fifo(const struct device *dev, dwc2_unset_unused_fifo(dev); } - if (priv->txf_set & ~BIT_MASK(ep_idx)) { - LOG_WRN("Some of the FIFOs higher than %u are set, %lx", - ep_idx, priv->txf_set & ~BIT_MASK(ep_idx)); - return -EIO; - } - if ((ep_idx - 1) != 0U) { txfaddr = dwc2_get_txfdep(dev, ep_idx - 2) + dwc2_get_txfaddr(dev, ep_idx - 2); @@ -1342,8 +1336,21 @@ static int dwc2_set_dedicated_fifo(const struct device *dev, MIN(UDC_DWC2_FIFO0_DEPTH, priv->max_txfifo_depth[0]); } + if (priv->txf_set & BIT(ep_idx)) { + uint32_t curaddr; + + curaddr = dwc2_get_txfaddr(dev, ep_idx - 1); + txfdep = dwc2_get_txfdep(dev, ep_idx - 1); + if (txfaddr != curaddr || reqdep > txfdep) { + LOG_ERR("FIFO%u cannot be reused, new addr 0x%04x depth %u", + ep_idx, txfaddr, reqdep); + return -ENOMEM; + } + } else { + txfdep = reqdep; + } + /* Make sure to not set TxFIFO greater than hardware allows */ - txfdep = reqdep; if (txfdep > priv->max_txfifo_depth[ep_idx]) { return -ENOMEM; } From a16e4ca655e5a04b30f58e0dc54aa1810d5c2db1 Mon Sep 17 00:00:00 2001 From: Victor Brzeski Date: Fri, 20 Jun 2025 16:16:01 -0700 Subject: [PATCH 0184/2141] [nrf fromtree] include: kernel: add macros to enable allocation from specific sections MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This change adds two macros that allow the user to specify the section the memslab buffer should be allocated from. This is useful for systems where memory must reside in DMA-able memory like USB. Signed-off-by: Victor Brzeski (cherry picked from commit 3c47f91be4f879c9f1eac4c2be0a1bdd2de426ff) Signed-off-by: Tomasz Moń --- include/zephyr/kernel.h | 84 +++++++++++++++++++++++++++++++++-------- 1 file changed, 69 insertions(+), 15 deletions(-) diff --git a/include/zephyr/kernel.h b/include/zephyr/kernel.h index a407678bcaa4..e7968bd2f851 100644 --- a/include/zephyr/kernel.h +++ b/include/zephyr/kernel.h @@ -5440,6 +5440,41 @@ struct k_mem_slab { * @{ */ +/** + * @brief Statically define and initialize a memory slab in a user-provided memory section with + * public (non-static) scope. + * + * The memory slab's buffer contains @a slab_num_blocks memory blocks + * that are @a slab_block_size bytes long. The buffer is aligned to a + * @a slab_align -byte boundary. To ensure that each memory block is similarly + * aligned to this boundary, @a slab_block_size must also be a multiple of + * @a slab_align. + * + * The memory slab can be accessed outside the module where it is defined + * using: + * + * @code extern struct k_mem_slab ; @endcode + * + * @note This macro cannot be used together with a static keyword. + * If such a use-case is desired, use @ref K_MEM_SLAB_DEFINE_IN_SECT_STATIC + * instead. + * + * @param name Name of the memory slab. + * @param in_section Section attribute specifier such as Z_GENERIC_SECTION. + * @param slab_block_size Size of each memory block (in bytes). + * @param slab_num_blocks Number memory blocks. + * @param slab_align Alignment of the memory slab's buffer (power of 2). + */ +#define K_MEM_SLAB_DEFINE_IN_SECT(name, in_section, slab_block_size, slab_num_blocks, slab_align) \ + BUILD_ASSERT(((slab_block_size) % (slab_align)) == 0, \ + "slab_block_size must be a multiple of slab_align"); \ + BUILD_ASSERT((((slab_align) & ((slab_align) - 1)) == 0), \ + "slab_align must be a power of 2"); \ + char in_section __aligned(WB_UP( \ + slab_align)) _k_mem_slab_buf_##name[(slab_num_blocks) * WB_UP(slab_block_size)]; \ + STRUCT_SECTION_ITERABLE(k_mem_slab, name) = Z_MEM_SLAB_INITIALIZER( \ + name, _k_mem_slab_buf_##name, WB_UP(slab_block_size), slab_num_blocks) + /** * @brief Statically define and initialize a memory slab in a public (non-static) scope. * @@ -5463,13 +5498,36 @@ struct k_mem_slab { * @param slab_num_blocks Number memory blocks. * @param slab_align Alignment of the memory slab's buffer (power of 2). */ -#define K_MEM_SLAB_DEFINE(name, slab_block_size, slab_num_blocks, slab_align) \ - char __noinit_named(k_mem_slab_buf_##name) \ - __aligned(WB_UP(slab_align)) \ - _k_mem_slab_buf_##name[(slab_num_blocks) * WB_UP(slab_block_size)]; \ - STRUCT_SECTION_ITERABLE(k_mem_slab, name) = \ - Z_MEM_SLAB_INITIALIZER(name, _k_mem_slab_buf_##name, \ - WB_UP(slab_block_size), slab_num_blocks) +#define K_MEM_SLAB_DEFINE(name, slab_block_size, slab_num_blocks, slab_align) \ + K_MEM_SLAB_DEFINE_IN_SECT(name, __noinit_named(k_mem_slab_buf_##name), slab_block_size, \ + slab_num_blocks, slab_align) + +/** + * @brief Statically define and initialize a memory slab in a user-provided memory section with + * private (static) scope. + * + * The memory slab's buffer contains @a slab_num_blocks memory blocks + * that are @a slab_block_size bytes long. The buffer is aligned to a + * @a slab_align -byte boundary. To ensure that each memory block is similarly + * aligned to this boundary, @a slab_block_size must also be a multiple of + * @a slab_align. + * + * @param name Name of the memory slab. + * @param in_section Section attribute specifier such as Z_GENERIC_SECTION. + * @param slab_block_size Size of each memory block (in bytes). + * @param slab_num_blocks Number memory blocks. + * @param slab_align Alignment of the memory slab's buffer (power of 2). + */ +#define K_MEM_SLAB_DEFINE_IN_SECT_STATIC(name, in_section, slab_block_size, slab_num_blocks, \ + slab_align) \ + BUILD_ASSERT(((slab_block_size) % (slab_align)) == 0, \ + "slab_block_size must be a multiple of slab_align"); \ + BUILD_ASSERT((((slab_align) & ((slab_align) - 1)) == 0), \ + "slab_align must be a power of 2"); \ + static char in_section __aligned(WB_UP( \ + slab_align)) _k_mem_slab_buf_##name[(slab_num_blocks) * WB_UP(slab_block_size)]; \ + static STRUCT_SECTION_ITERABLE(k_mem_slab, name) = Z_MEM_SLAB_INITIALIZER( \ + name, _k_mem_slab_buf_##name, WB_UP(slab_block_size), slab_num_blocks) /** * @brief Statically define and initialize a memory slab in a private (static) scope. @@ -5485,13 +5543,9 @@ struct k_mem_slab { * @param slab_num_blocks Number memory blocks. * @param slab_align Alignment of the memory slab's buffer (power of 2). */ -#define K_MEM_SLAB_DEFINE_STATIC(name, slab_block_size, slab_num_blocks, slab_align) \ - static char __noinit_named(k_mem_slab_buf_##name) \ - __aligned(WB_UP(slab_align)) \ - _k_mem_slab_buf_##name[(slab_num_blocks) * WB_UP(slab_block_size)]; \ - static STRUCT_SECTION_ITERABLE(k_mem_slab, name) = \ - Z_MEM_SLAB_INITIALIZER(name, _k_mem_slab_buf_##name, \ - WB_UP(slab_block_size), slab_num_blocks) +#define K_MEM_SLAB_DEFINE_STATIC(name, slab_block_size, slab_num_blocks, slab_align) \ + K_MEM_SLAB_DEFINE_IN_SECT_STATIC(name, __noinit_named(k_mem_slab_buf_##name), \ + slab_block_size, slab_num_blocks, slab_align) /** * @brief Initialize a memory slab. @@ -5790,7 +5844,7 @@ void k_heap_free(struct k_heap *h, void *mem) __attribute_nonnull(1); * * @param name Symbol name for the struct k_heap object * @param bytes Size of memory region, in bytes - * @param in_section __attribute__((section(name)) + * @param in_section Section attribute specifier such as Z_GENERIC_SECTION. */ #define Z_HEAP_DEFINE_IN_SECT(name, bytes, in_section) \ char in_section \ From 45800f7e4d9ce35db917872b53dd6b794daced46 Mon Sep 17 00:00:00 2001 From: Victor Brzeski Date: Tue, 24 Jun 2025 21:47:06 -0700 Subject: [PATCH 0185/2141] [nrf fromtree] include: usb_ch9: fix USB_FS_ISO_EP_INTERVAL calculation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Per section 5.6.4 of the USB 2.0 standard, Isochronous Endpoints are derived by the (2^(bInterval-1) * F) formula. The current implementation uses the formula intended for Interrupt Endpoints. Signed-off-by: Victor Brzeski (cherry picked from commit d9c7b19ae06ed134ab2150971e000ead42c32e7f) Signed-off-by: Tomasz Moń --- include/zephyr/usb/usb_ch9.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/zephyr/usb/usb_ch9.h b/include/zephyr/usb/usb_ch9.h index 8ecadf64bd8c..0c4a3ac06086 100644 --- a/include/zephyr/usb/usb_ch9.h +++ b/include/zephyr/usb/usb_ch9.h @@ -354,8 +354,8 @@ struct usb_association_descriptor { /** Calculate high speed interrupt endpoint bInterval from a value in microseconds */ #define USB_HS_INT_EP_INTERVAL(us) CLAMP((ilog2((us) / 125U) + 1U), 1U, 16U) -/** Calculate high speed isochronous endpoint bInterval from a value in microseconds */ -#define USB_FS_ISO_EP_INTERVAL(us) CLAMP(((us) / 1000U), 1U, 16U) +/** Calculate full speed isochronous endpoint bInterval from a value in microseconds */ +#define USB_FS_ISO_EP_INTERVAL(us) CLAMP((ilog2((us) / 1000U) + 1U), 1U, 16U) /** Calculate high speed isochronous endpoint bInterval from a value in microseconds */ #define USB_HS_ISO_EP_INTERVAL(us) CLAMP((ilog2((us) / 125U) + 1U), 1U, 16U) From 254f1019ad0bb6c9fe93fbd564fd644768f1e101 Mon Sep 17 00:00:00 2001 From: Victor Brzeski Date: Tue, 24 Jun 2025 22:47:45 -0700 Subject: [PATCH 0186/2141] [nrf fromtree] usb: device_next: uac2: support higher bInterval values MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit adds a device-tree prop for the audio streaming terminals to specify the bInterval values for the Isochronous endpoints. Signed-off-by: Victor Brzeski (cherry picked from commit e8638befaf05604550865f3c4c6cecddbb1a409f) Signed-off-by: Tomasz Moń --- .../usb/uac2/zephyr,uac2-audio-streaming.yaml | 8 ++++++++ .../usb/device_next/class/usbd_uac2_macros.h | 20 +++++++++++++------ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/dts/bindings/usb/uac2/zephyr,uac2-audio-streaming.yaml b/dts/bindings/usb/uac2/zephyr,uac2-audio-streaming.yaml index 6e661d1c73d8..d17423448557 100644 --- a/dts/bindings/usb/uac2/zephyr,uac2-audio-streaming.yaml +++ b/dts/bindings/usb/uac2/zephyr,uac2-audio-streaming.yaml @@ -78,3 +78,11 @@ properties: type: int description: | Number of effectively used bits in audio subslot. + + polling-period-us: + type: int + description: | + Input or output endpoint polling period in microseconds. For USB full + speed this could be clamped to 1ms or 32768ms depending on the value. For + USB high speed this could be clamped to 125us or 4096ms depending on the + value. diff --git a/subsys/usb/device_next/class/usbd_uac2_macros.h b/subsys/usb/device_next/class/usbd_uac2_macros.h index a31278d9cf8a..bd83a3c42a27 100644 --- a/subsys/usb/device_next/class/usbd_uac2_macros.h +++ b/subsys/usb/device_next/class/usbd_uac2_macros.h @@ -707,14 +707,22 @@ #define AS_BYTES_PER_SAMPLE(node) \ DT_PROP(node, subslot_size) +#define AS_FS_DATA_EP_BINTERVAL(node) \ + USB_FS_ISO_EP_INTERVAL(DT_PROP_OR(node, polling_period_us, 1000)) + +#define AS_HS_DATA_EP_BINTERVAL(node) \ + USB_HS_ISO_EP_INTERVAL(DT_PROP_OR(node, polling_period_us, 125)) + /* Asynchronous endpoints needs space for 1 extra sample */ #define AS_SAMPLES_PER_FRAME(node) \ - ((ROUND_UP(AS_CLK_MAX_FREQUENCY(node), 1000) / 1000) + \ - UTIL_NOT(AS_IS_SOF_SYNCHRONIZED(node))) + (((ROUND_UP(AS_CLK_MAX_FREQUENCY(node), 1000) / 1000) \ + << (AS_FS_DATA_EP_BINTERVAL(node) - 1)) + \ + UTIL_NOT(AS_IS_SOF_SYNCHRONIZED(node))) #define AS_SAMPLES_PER_MICROFRAME(node) \ - ((ROUND_UP(AS_CLK_MAX_FREQUENCY(node), 8000) / 8000) + \ - UTIL_NOT(AS_IS_SOF_SYNCHRONIZED(node))) + (((ROUND_UP(AS_CLK_MAX_FREQUENCY(node), 8000) / 8000) \ + << (AS_HS_DATA_EP_BINTERVAL(node) - 1)) + \ + UTIL_NOT(AS_IS_SOF_SYNCHRONIZED(node))) #define AS_DATA_EP_SYNC_TYPE(node) \ COND_CODE_1(AS_IS_SOF_SYNCHRONIZED(node), (0x3 << 2), (0x1 << 2)) @@ -745,7 +753,7 @@ AS_DATA_EP_ADDR(node), /* bEndpointAddress */ \ AS_DATA_EP_ATTR(node), /* bmAttributes */ \ U16_LE(AS_FS_DATA_EP_MAX_PACKET_SIZE(node)), /* wMaxPacketSize */ \ - 0x01, /* bInterval */ + AS_FS_DATA_EP_BINTERVAL(node), /* bInterval */ #define AS_ISOCHRONOUS_DATA_ENDPOINT_FS_DESCRIPTORS_ARRAYS(node) \ static uint8_t DESCRIPTOR_NAME(fs_std_data_ep, node)[] = { \ @@ -758,7 +766,7 @@ AS_DATA_EP_ADDR(node), /* bEndpointAddress */ \ AS_DATA_EP_ATTR(node), /* bmAttributes */ \ U16_LE(AS_HS_DATA_EP_MAX_PACKET_SIZE(node)), /* wMaxPacketSize */ \ - 0x01, /* bInterval */ + AS_HS_DATA_EP_BINTERVAL(node), /* bInterval */ #define AS_ISOCHRONOUS_DATA_ENDPOINT_HS_DESCRIPTORS_ARRAYS(node) \ static uint8_t DESCRIPTOR_NAME(hs_std_data_ep, node)[] = { \ From da8201be36b725769def0f7fa11267d05ac110b2 Mon Sep 17 00:00:00 2001 From: Zak Essadaoui Date: Thu, 26 Jun 2025 15:19:02 -0700 Subject: [PATCH 0187/2141] [nrf fromtree] usb: hid: Define sensor page usages IDs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit adds the following: * Sensor related usage IDs in the Sensors' page of the HID standard. * A HID usage macro that works with IDs of 2 bytes. * A macro to define the exponent in a report descriptor. The values and naming came from the following document: https://www.usb.org/sites/default/files/hutrr39b_0.pdf Signed-off-by: Zak Essadaoui (cherry picked from commit 41a83bd3a0a7216d6f1ce1d06f61060d4f66b590) Signed-off-by: Tomasz Moń --- include/zephyr/usb/class/hid.h | 49 +++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/include/zephyr/usb/class/hid.h b/include/zephyr/usb/class/hid.h index 96bb8271ed75..c9561e750c7d 100644 --- a/include/zephyr/usb/class/hid.h +++ b/include/zephyr/usb/class/hid.h @@ -141,6 +141,8 @@ extern "C" { #define HID_USAGE_GEN_LEDS 0x08 /** HID Button Usage page */ #define HID_USAGE_GEN_BUTTON 0x09 +/** HID Sensors Usage page */ +#define HID_USAGE_SENSORS 0x20 /** HID Generic Desktop Undefined Usage ID */ #define HID_USAGE_GEN_DESKTOP_UNDEFINED 0x00 @@ -163,6 +165,33 @@ extern "C" { /** HID Generic Desktop Wheel Usage ID */ #define HID_USAGE_GEN_DESKTOP_WHEEL 0x38 +/** HID Sensors Collection Usage ID */ +#define HID_USAGE_SENSOR_TYPE_COLLECTION 0x001 +/** HID Sensors Environmental Temperature Type Usage ID */ +#define HID_USAGE_SENSORS_TYPE_ENVIRONMENTAL_TEMPERATURE 0x033 +/** HID Sensors Event Sensor State Usage ID */ +#define HID_USAGE_SENSORS_EVENT_SENSOR_STATE 0x201 +/** HID Sensors Friendly Name Property Usage ID */ +#define HID_USAGE_SENSORS_PROPERTY_FRIENDLY_NAME 0x301 +/** HID Sensors Enviromental Temperature Data Usage ID */ +#define HID_USAGE_SENSORS_DATA_ENVIRONMENTAL_TEMPERATURE 0x434 +/** HID Sensors Timestamp Property Usage ID */ +#define HID_USAGE_SENSORS_PROPERTY_TIMESTAMP 0x529 +/** HID Sensors Sensor State Undefined Usage ID */ +#define HID_USAGE_SENSORS_SENSOR_STATE_UNDEFINED 0x800 +/** HID Sensors Sensor State Ready Usage ID */ +#define HID_USAGE_SENSORS_SENSOR_STATE_READY 0x801 +/** HID Sensors Sensor State Not Available Usage ID */ +#define HID_USAGE_SENSORS_SENSOR_STATE_NOT_AVAILABLE 0x802 +/** HID Sensors Sensor State No Data Usage ID */ +#define HID_USAGE_SENSORS_SENSOR_STATE_NO_DATA 0x803 +/** HID Sensors Sensor State Initializing Usage ID */ +#define HID_USAGE_SENSORS_SENSOR_STATE_INITIALIZING 0x804 +/** HID Sensors Sensor State Access Denied Usage ID */ +#define HID_USAGE_SENSORS_SENSOR_STATE_ACCESS_DENIED 0x805 +/** HID Sensors Sensor State Error Usage ID */ +#define HID_USAGE_SENSORS_SENSOR_STATE_ERROR 0x806 + /** * @} */ @@ -357,12 +386,21 @@ extern "C" { * For usage examples, see @ref HID_MOUSE_REPORT_DESC(), * @ref HID_KEYBOARD_REPORT_DESC() * - * @param idx Number of data fields included in the report + * @param idx HID Usage ID per the HID Usage Table * @return HID Usage Index item */ #define HID_USAGE(idx) \ HID_ITEM(HID_ITEM_TAG_USAGE, HID_ITEM_TYPE_LOCAL, 1), idx +/** + * @brief Define HID Usage Index item with the data length of two bytes. + * + * @param idx HID Usage ID per the HID Usage Table + * @return HID Usage Index item + */ +#define HID_USAGE16(idx) \ + HID_ITEM(HID_ITEM_TAG_USAGE, HID_ITEM_TYPE_LOCAL, 2), (uint8_t)idx, (idx >> 8) + /** * @brief Define HID Usage Minimum item with the data length of one byte. * @@ -413,6 +451,15 @@ extern "C" { #define HID_USAGE_MAX16(a, b) \ HID_ITEM(HID_ITEM_TAG_USAGE_MAX, HID_ITEM_TYPE_LOCAL, 2), a, b +/** + * @brief Define HID Unit Exponent item. + * + * @param exp Unit exponent, refer to the HID Unit Exponent table + * in the specification for usage + * @return HID Unit Exponent item + */ +#define HID_UNIT_EXPONENT(exp) HID_ITEM(HID_ITEM_TAG_UNIT_EXPONENT, HID_ITEM_TYPE_GLOBAL, 1), exp + /** * @} */ From 22814fb13bf17cd999ab26035bd150e842de1a83 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Mon, 23 Jun 2025 11:50:44 +0200 Subject: [PATCH 0188/2141] [nrf fromtree] drivers: clock_control: nrf: add support for HFCLK24M MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add support for the HFCLK24M clock to the clock_control_nrf device driver. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit bb319603fddcd088a0b93606551d546f00f589a2) Signed-off-by: Tomasz Moń --- drivers/clock_control/clock_control_nrf.c | 25 ++++++++++++++++++- .../drivers/clock_control/nrf_clock_control.h | 5 ++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/drivers/clock_control/clock_control_nrf.c b/drivers/clock_control/clock_control_nrf.c index d148cd49e4e5..3d5d0951d325 100644 --- a/drivers/clock_control/clock_control_nrf.c +++ b/drivers/clock_control/clock_control_nrf.c @@ -329,6 +329,18 @@ static void hfclk_stop(void) nrfx_clock_hfclk_stop(); } +#if NRF_CLOCK_HAS_HFCLK24M +static void hfclk24m_start(void) +{ + nrfx_clock_start(NRF_CLOCK_DOMAIN_HFCLK24M); +} + +static void hfclk24m_stop(void) +{ + nrfx_clock_stop(NRF_CLOCK_DOMAIN_HFCLK24M); +} +#endif + #if NRF_CLOCK_HAS_HFCLK192M static void hfclk192m_start(void) { @@ -714,7 +726,11 @@ static void clock_event_handler(nrfx_clock_evt_type_t event) break; } #endif - +#if NRF_CLOCK_HAS_HFCLK24M + case NRFX_CLOCK_EVT_HFCLK24M_STARTED: + clkstarted_handle(dev, CLOCK_CONTROL_NRF_TYPE_HFCLK24M); + break; +#endif #if NRF_CLOCK_HAS_HFCLK192M case NRFX_CLOCK_EVT_HFCLK192M_STARTED: clkstarted_handle(dev, CLOCK_CONTROL_NRF_TYPE_HFCLK192M); @@ -843,6 +859,13 @@ static const struct nrf_clock_control_config config = { .stop = lfclk_stop, IF_ENABLED(CONFIG_LOG, (.name = "lfclk",)) }, +#if NRF_CLOCK_HAS_HFCLK24M + [CLOCK_CONTROL_NRF_TYPE_HFCLK24M] = { + .start = hfclk24m_start, + .stop = hfclk24m_stop, + IF_ENABLED(CONFIG_LOG, (.name = "hfclk24m",)) + }, +#endif #if NRF_CLOCK_HAS_HFCLK192M [CLOCK_CONTROL_NRF_TYPE_HFCLK192M] = { .start = hfclk192m_start, diff --git a/include/zephyr/drivers/clock_control/nrf_clock_control.h b/include/zephyr/drivers/clock_control/nrf_clock_control.h index f407be61d4db..31c1dea047b9 100644 --- a/include/zephyr/drivers/clock_control/nrf_clock_control.h +++ b/include/zephyr/drivers/clock_control/nrf_clock_control.h @@ -27,6 +27,9 @@ extern "C" { enum clock_control_nrf_type { CLOCK_CONTROL_NRF_TYPE_HFCLK, CLOCK_CONTROL_NRF_TYPE_LFCLK, +#if NRF_CLOCK_HAS_HFCLK24M + CLOCK_CONTROL_NRF_TYPE_HFCLK24M, +#endif #if NRF_CLOCK_HAS_HFCLK192M CLOCK_CONTROL_NRF_TYPE_HFCLK192M, #endif @@ -43,6 +46,8 @@ enum clock_control_nrf_type { ((clock_control_subsys_t)CLOCK_CONTROL_NRF_TYPE_HFCLK) #define CLOCK_CONTROL_NRF_SUBSYS_LF \ ((clock_control_subsys_t)CLOCK_CONTROL_NRF_TYPE_LFCLK) +#define CLOCK_CONTROL_NRF_SUBSYS_HF24M \ + ((clock_control_subsys_t)CLOCK_CONTROL_NRF_TYPE_HFCLK24M) #define CLOCK_CONTROL_NRF_SUBSYS_HF192M \ ((clock_control_subsys_t)CLOCK_CONTROL_NRF_TYPE_HFCLK192M) #define CLOCK_CONTROL_NRF_SUBSYS_HFAUDIO \ From a536263ad8e0b09ad1c11d9cdba10a17d4f31a71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mo=C5=84?= Date: Thu, 26 Jun 2025 10:31:27 +0200 Subject: [PATCH 0189/2141] [nrf fromtree] drivers: udc_dwc2: Set EP0 IN CNAK only when necessary MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adhere to Programming Guide with regards to when the DIEPCTL0.CNAK is set. This allows the driver to survive abusive control transfers with extremely short host timeouts. Signed-off-by: Tomasz Moń (cherry picked from commit d590d27ec9902c1f9020221587ae344ad8597cc6) --- drivers/usb/udc/udc_dwc2.c | 72 ++++++++++++++++++++++++++++++++++---- 1 file changed, 66 insertions(+), 6 deletions(-) diff --git a/drivers/usb/udc/udc_dwc2.c b/drivers/usb/udc/udc_dwc2.c index 5a47a23294c8..8995ce295e28 100644 --- a/drivers/usb/udc/udc_dwc2.c +++ b/drivers/usb/udc/udc_dwc2.c @@ -139,6 +139,7 @@ struct udc_dwc2_data { unsigned int hibernated : 1; unsigned int enumdone : 1; unsigned int enumspd : 2; + unsigned int pending_dout_feed : 1; enum dwc2_suspend_type suspend_type; /* Number of endpoints including control endpoint */ uint8_t numdeveps; @@ -428,10 +429,28 @@ static void dwc2_ensure_setup_ready(const struct device *dev) if (dwc2_in_completer_mode(dev)) { /* In Completer mode EP0 can always receive SETUP data */ return; + } else { + struct udc_dwc2_data *const priv = udc_get_private(dev); + + /* Enable EP0 OUT only if there is no pending EP0 IN transfer + * after which the stack has to enable EP0 OUT. + */ + if (!priv->pending_dout_feed) { + dwc2_ctrl_feed_dout(dev, 8); + } } +} - if (!udc_buf_peek(udc_get_ep_cfg(dev, USB_CONTROL_EP_IN))) { - dwc2_ctrl_feed_dout(dev, 8); +static void dwc2_clear_control_in_nak(const struct device *dev) +{ + struct usb_dwc2_reg *const base = dwc2_get_base(dev); + mem_addr_t diepctl_reg = (mem_addr_t)&base->in_ep[0].diepctl; + uint32_t diepctl = sys_read32(diepctl_reg); + + if (diepctl & USB_DWC2_DEPCTL_NAKSTS) { + diepctl &= ~USB_DWC2_DEPCTL_EPENA; + diepctl |= USB_DWC2_DEPCTL_CNAK; + sys_write32(diepctl, diepctl_reg); } } @@ -590,7 +609,11 @@ static int dwc2_tx_fifo_write(const struct device *dev, } /* Clear NAK and set endpoint enable */ - diepctl |= USB_DWC2_DEPCTL_EPENA | USB_DWC2_DEPCTL_CNAK; + diepctl |= USB_DWC2_DEPCTL_EPENA; + if (cfg->addr != USB_CONTROL_EP_IN) { + /* Non-control endpoint, set CNAK for all transfers */ + diepctl |= USB_DWC2_DEPCTL_CNAK; + } sys_write32(diepctl, diepctl_reg); /* Clear IN Endpoint NAK Effective interrupt in case it was set */ @@ -776,6 +799,7 @@ static void dwc2_prep_rx(const struct device *dev, struct net_buf *buf, static void dwc2_handle_xfer_next(const struct device *dev, struct udc_ep_config *const cfg) { + struct udc_dwc2_data *const priv = udc_get_private(dev); struct net_buf *buf; buf = udc_buf_peek(cfg); @@ -803,7 +827,8 @@ static void dwc2_handle_xfer_next(const struct device *dev, * avoid race condition where the next Control Write * Transfer Data Stage is received into the buffer. */ - if (dwc2_in_buffer_dma_mode(dev)) { + if (dwc2_in_buffer_dma_mode(dev) && priv->pending_dout_feed) { + priv->pending_dout_feed = 0; dwc2_ctrl_feed_dout(dev, 8); } } @@ -872,6 +897,19 @@ static int dwc2_handle_evt_setup(const struct device *dev) /* Allocate and feed buffer for data OUT stage */ LOG_DBG("s:%p|feed for -out-", buf); + priv->pending_dout_feed = 0; + + if (dwc2_in_completer_mode(dev)) { + /* Programming Guide does not clearly describe to clear + * control IN endpoint NAK for Control Write Transfers + * when operating in Completer mode. Set CNAK here, + * because IN endpoint is not armed at this point and + * forced NAKs are not necessary. IN Status stage will + * only finish after IN endpoint is armed. + */ + dwc2_clear_control_in_nak(dev); + } + err = dwc2_ctrl_feed_dout(dev, udc_data_stage_length(buf)); if (err == -ENOMEM) { err = udc_submit_ep_event(dev, buf, err); @@ -879,11 +917,19 @@ static int dwc2_handle_evt_setup(const struct device *dev) } else if (udc_ctrl_stage_is_data_in(dev)) { LOG_DBG("s:%p|feed for -in-status", buf); + dwc2_clear_control_in_nak(dev); + err = udc_ctrl_submit_s_in_status(dev); + + priv->pending_dout_feed = 1; } else { LOG_DBG("s:%p|feed >setup", buf); + dwc2_clear_control_in_nak(dev); + err = udc_ctrl_submit_s_status(dev); + + priv->pending_dout_feed = 1; } return err; @@ -892,6 +938,7 @@ static int dwc2_handle_evt_setup(const struct device *dev) static inline int dwc2_handle_evt_dout(const struct device *dev, struct udc_ep_config *const cfg) { + struct udc_dwc2_data *const priv = udc_get_private(dev); struct udc_data *data = dev->data; struct net_buf *buf; int err = 0; @@ -924,6 +971,8 @@ static inline int dwc2_handle_evt_dout(const struct device *dev, if (udc_ctrl_stage_is_status_in(dev)) { err = udc_ctrl_submit_s_out_status(dev, buf); + + priv->pending_dout_feed = 1; } if (data->stage == CTRL_PIPE_STAGE_ERROR) { @@ -1623,6 +1672,15 @@ static void udc_dwc2_ep_disable(const struct device *dev, /* For IN endpoints STALL is set in addition to SNAK */ dxepctl |= USB_DWC2_DEPCTL_STALL; } + + /* EP0 status stage enabled, but CNAK not yet written. + * Set EPDIS to prevent timeout. + */ + if ((dxepctl & USB_DWC2_DEPCTL_NAKSTS) && + (dxepctl & USB_DWC2_DEPCTL_EPENA)) { + dxepctl |= USB_DWC2_DEPCTL_EPDIS; + } + sys_write32(dxepctl, dxepctl_reg); /* Endpoint gets disabled in INEPNAKEFF handler */ @@ -2751,13 +2809,15 @@ static inline void dwc2_handle_oepint(const struct device *dev) } if (status & USB_DWC2_DOEPINT_STSPHSERCVD) { - /* Driver doesn't need any special handling, but it is - * mandatory that the bit is cleared in Buffer DMA mode. + /* Allow IN Status stage after control transfer with + * data stage from device to host. Clear the CNAK and + * this interrupt bit is mandatory in Buffer DMA mode. * If the bit is not cleared (i.e. when this interrupt * bit is masked), then SETUP interrupts will cease * after first control transfer with data stage from * device to host. */ + dwc2_clear_control_in_nak(dev); } if (status & USB_DWC2_DOEPINT_XFERCOMPL) { From e2d2d6ff7435c4f76826c0d11faea6b028f5bf8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mo=C5=84?= Date: Tue, 8 Apr 2025 15:34:37 +0200 Subject: [PATCH 0190/2141] [nrf fromlist] drivers: udc_dwc2: Add nRF54LM20A vendor quirks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Initial implementation of nRF54L quirks necessary for nRF54LM20A. Upstream PR #: 92842 Signed-off-by: Tomasz Moń Signed-off-by: Johann Fischer (cherry picked from commit fb56bce91b7ba22e6fd9ad1c83b1b4e6ed7c9f0b) --- drivers/usb/udc/udc_dwc2_vendor_quirks.h | 198 +++++++++++++++++++++++ 1 file changed, 198 insertions(+) diff --git a/drivers/usb/udc/udc_dwc2_vendor_quirks.h b/drivers/usb/udc/udc_dwc2_vendor_quirks.h index f5a70063c2e2..330ff8d113f1 100644 --- a/drivers/usb/udc/udc_dwc2_vendor_quirks.h +++ b/drivers/usb/udc/udc_dwc2_vendor_quirks.h @@ -312,6 +312,204 @@ DT_INST_FOREACH_STATUS_OKAY(QUIRK_NRF_USBHS_DEFINE) #endif /*DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_usbhs) */ +#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_usbhs_nrf54l) + +#define USBHS_DT_WRAPPER_REG_ADDR(n) UINT_TO_POINTER(DT_INST_REG_ADDR_BY_NAME(n, wrapper)) + +#include +#include +#include +#include + +#define NRF_DEFAULT_IRQ_PRIORITY 1 + +/* + * On USBHS, we cannot access the DWC2 register until VBUS is detected and + * valid. If the user tries to force usbd_enable() and the corresponding + * udc_enable() without a "VBUS ready" notification, the event wait will block + * until a valid VBUS signal is detected or until the + * CONFIG_UDC_DWC2_USBHS_VBUS_READY_TIMEOUT timeout expires. + */ +static K_EVENT_DEFINE(usbhs_events); +#define USBHS_VBUS_READY BIT(0) + +static struct onoff_manager *pclk24m_mgr; +static struct onoff_client pclk24m_cli; + +static void vregusb_isr(const void *arg) +{ + const struct device *dev = arg; + + if (NRF_VREGUSB->EVENTS_VBUSDETECTED) { + NRF_VREGUSB->EVENTS_VBUSDETECTED = 0; + k_event_post(&usbhs_events, USBHS_VBUS_READY); + udc_submit_event(dev, UDC_EVT_VBUS_READY, 0); + } + + if (NRF_VREGUSB->EVENTS_VBUSREMOVED) { + NRF_VREGUSB->EVENTS_VBUSREMOVED = 0; + k_event_set_masked(&usbhs_events, 0, USBHS_VBUS_READY); + udc_submit_event(dev, UDC_EVT_VBUS_REMOVED, 0); + } +} + +static inline int usbhs_init_vreg_and_clock(const struct device *dev) +{ + IRQ_CONNECT(VREGUSB_IRQn, NRF_DEFAULT_IRQ_PRIORITY, + vregusb_isr, DEVICE_DT_INST_GET(0), 0); + + NRF_VREGUSB->INTEN = VREGUSB_INTEN_VBUSDETECTED_Msk | + VREGUSB_INTEN_VBUSREMOVED_Msk; + NRF_VREGUSB->TASKS_START = 1; + + /* TODO: Determine conditions when VBUSDETECTED is not generated */ + if (sys_read32((mem_addr_t)NRF_VREGUSB + 0x400) & BIT(2)) { + k_event_post(&usbhs_events, USBHS_VBUS_READY); + udc_submit_event(dev, UDC_EVT_VBUS_READY, 0); + } + + irq_enable(VREGUSB_IRQn); + pclk24m_mgr = z_nrf_clock_control_get_onoff(CLOCK_CONTROL_NRF_SUBSYS_HF24M); + + return 0; +} + +static inline int usbhs_enable_core(const struct device *dev) +{ + LOG_MODULE_DECLARE(udc_dwc2, CONFIG_UDC_DRIVER_LOG_LEVEL); + NRF_USBHS_Type *wrapper = USBHS_DT_WRAPPER_REG_ADDR(0); + k_timeout_t timeout = K_FOREVER; + int err; + + if (!k_event_wait(&usbhs_events, USBHS_VBUS_READY, false, K_NO_WAIT)) { + LOG_WRN("VBUS is not ready, block udc_enable()"); + if (!k_event_wait(&usbhs_events, USBHS_VBUS_READY, false, timeout)) { + return -ETIMEDOUT; + } + } + + /* Request PCLK24M using clock control driver */ + sys_notify_init_spinwait(&pclk24m_cli.notify); + err = onoff_request(pclk24m_mgr, &pclk24m_cli); + if (err < 0) { + LOG_ERR("Failed to start PCLK24M %d", err); + return err; + } + + /* Power up peripheral */ + wrapper->ENABLE = USBHS_ENABLE_CORE_Msk; + + /* Set ID to Device and force D+ pull-up off for now */ + wrapper->PHY.OVERRIDEVALUES = (1 << 31); + wrapper->PHY.INPUTOVERRIDE = (1 << 31) | USBHS_PHY_INPUTOVERRIDE_VBUSVALID_Msk; + + /* Release PHY power-on reset */ + wrapper->ENABLE = USBHS_ENABLE_PHY_Msk | USBHS_ENABLE_CORE_Msk; + + /* Wait for PHY clock to start */ + k_busy_wait(45); + + /* Release DWC2 reset */ + wrapper->TASKS_START = 1UL; + + /* Wait for clock to start to avoid hang on too early register read */ + k_busy_wait(1); + + /* DWC2 opmode is now guaranteed to be Non-Driving, allow D+ pull-up to + * become active once driver clears DCTL SftDiscon bit. + */ + wrapper->PHY.INPUTOVERRIDE = (1 << 31); + + return 0; +} + +static inline int usbhs_disable_core(const struct device *dev) +{ + LOG_MODULE_DECLARE(udc_dwc2, CONFIG_UDC_DRIVER_LOG_LEVEL); + NRF_USBHS_Type *wrapper = USBHS_DT_WRAPPER_REG_ADDR(0); + int err; + + /* Set ID to Device and forcefully disable D+ pull-up */ + wrapper->PHY.OVERRIDEVALUES = (1 << 31); + wrapper->PHY.INPUTOVERRIDE = (1 << 31) | USBHS_PHY_INPUTOVERRIDE_VBUSVALID_Msk; + + wrapper->ENABLE = 0UL; + + /* Release PCLK24M using clock control driver */ + err = onoff_cancel_or_release(pclk24m_mgr, &pclk24m_cli); + if (err < 0) { + LOG_ERR("Failed to stop PCLK24M %d", err); + return err; + } + + return 0; +} + +static inline int usbhs_disable_vreg(const struct device *dev) +{ + NRF_VREGUSB->INTEN = 0; + NRF_VREGUSB->TASKS_STOP = 1; + + return 0; +} + +static inline int usbhs_init_caps(const struct device *dev) +{ + struct udc_data *data = dev->data; + + data->caps.can_detect_vbus = true; + data->caps.hs = true; + + return 0; +} + +static inline int usbhs_is_phy_clk_off(const struct device *dev) +{ + return !k_event_test(&usbhs_events, USBHS_VBUS_READY); +} + +static inline int usbhs_post_hibernation_entry(const struct device *dev) +{ + const struct udc_dwc2_config *const config = dev->config; + struct usb_dwc2_reg *const base = config->base; + NRF_USBHS_Type *wrapper = USBHS_DT_WRAPPER_REG_ADDR(0); + + sys_set_bits((mem_addr_t)&base->pcgcctl, USB_DWC2_PCGCCTL_GATEHCLK); + + wrapper->TASKS_STOP = 1; + + return 0; +} + +static inline int usbhs_pre_hibernation_exit(const struct device *dev) +{ + const struct udc_dwc2_config *const config = dev->config; + struct usb_dwc2_reg *const base = config->base; + NRF_USBHS_Type *wrapper = USBHS_DT_WRAPPER_REG_ADDR(0); + + sys_clear_bits((mem_addr_t)&base->pcgcctl, USB_DWC2_PCGCCTL_GATEHCLK); + + wrapper->TASKS_START = 1; + + return 0; +} + +#define QUIRK_NRF_USBHS_DEFINE(n) \ + struct dwc2_vendor_quirks dwc2_vendor_quirks_##n = { \ + .init = usbhs_init_vreg_and_clock, \ + .pre_enable = usbhs_enable_core, \ + .disable = usbhs_disable_core, \ + .shutdown = usbhs_disable_vreg, \ + .caps = usbhs_init_caps, \ + .is_phy_clk_off = usbhs_is_phy_clk_off, \ + .post_hibernation_entry = usbhs_post_hibernation_entry, \ + .pre_hibernation_exit = usbhs_pre_hibernation_exit, \ + }; + +DT_INST_FOREACH_STATUS_OKAY(QUIRK_NRF_USBHS_DEFINE) + +#endif /*DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_usbhs_nrf54l) */ + /* Add next vendor quirks definition above this line */ #endif /* ZEPHYR_DRIVERS_USB_UDC_DWC2_VENDOR_QUIRKS_H */ From dc8356f2f7a1f2e7fcfd1018154a3dff9030e79d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mo=C5=84?= Date: Mon, 14 Jul 2025 15:15:29 +0200 Subject: [PATCH 0191/2141] [nrf fromlist] drivers: udc_dwc2: Arm control out endpoint in DMA mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It was observed that device ceases to work in Buffer DMA mode after GET DEVICE QUALIFIER request is STALLed (when USB stack is limited to Full-Speed only operation). The issue is due to missing dout feed. Clear pending dout feed flag after bus reset (enumeration done) and after stalled control read transfer to allow dout to be feed when necessary. Upstream PR #: 93103 Signed-off-by: Tomasz Moń (cherry picked from commit 16bd613b68580b8efbfdd08d6019e957df0c9eb7) --- drivers/usb/udc/udc_dwc2.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/usb/udc/udc_dwc2.c b/drivers/usb/udc/udc_dwc2.c index 8995ce295e28..fca8f607ec74 100644 --- a/drivers/usb/udc/udc_dwc2.c +++ b/drivers/usb/udc/udc_dwc2.c @@ -1753,7 +1753,10 @@ static int udc_dwc2_ep_set_halt(const struct device *dev, if (ep_idx != 0) { cfg->stat.halted = true; } else { + struct udc_dwc2_data *const priv = udc_get_private(dev); + /* Data/Status stage is STALLed, allow receiving next SETUP */ + priv->pending_dout_feed = 0; dwc2_ensure_setup_ready(dev); } @@ -3320,6 +3323,8 @@ static ALWAYS_INLINE void dwc2_thread_handler(void *const arg) if (evt & BIT(DWC2_DRV_EVT_ENUM_DONE)) { k_event_clear(&priv->drv_evt, BIT(DWC2_DRV_EVT_ENUM_DONE)); + /* Any potential transfer on control IN endpoint is cancelled */ + priv->pending_dout_feed = 0; dwc2_ensure_setup_ready(dev); } From a75db6afe2b83976f8baa9a6eaa67fb810ac7403 Mon Sep 17 00:00:00 2001 From: Michal Frankiewicz Date: Thu, 10 Jul 2025 09:16:30 +0200 Subject: [PATCH 0192/2141] [nrf fromlist] drivers: spi: nrfx_spim: Add support for non standard frequencies Disabled frequency set approximation algorithm for spim's with prescaler. Upstream PR #: 92436 Signed-off-by: Michal Frankiewicz (cherry picked from commit d06292e16883c299f3a2f11a021d84970fe42e54) --- drivers/spi/spi_nrfx_spim.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi_nrfx_spim.c b/drivers/spi/spi_nrfx_spim.c index a5c4e30f190e..0646c67b4a33 100644 --- a/drivers/spi/spi_nrfx_spim.c +++ b/drivers/spi/spi_nrfx_spim.c @@ -170,11 +170,14 @@ static inline void finalize_spi_transaction(const struct device *dev, bool deact static inline uint32_t get_nrf_spim_frequency(uint32_t frequency) { + if (NRF_SPIM_HAS_PRESCALER) { + return frequency; + } /* Get the highest supported frequency not exceeding the requested one. */ - if (frequency >= MHZ(32) && (NRF_SPIM_HAS_32_MHZ_FREQ || NRF_SPIM_HAS_PRESCALER)) { + if (frequency >= MHZ(32) && NRF_SPIM_HAS_32_MHZ_FREQ) { return MHZ(32); - } else if (frequency >= MHZ(16) && (NRF_SPIM_HAS_16_MHZ_FREQ || NRF_SPIM_HAS_PRESCALER)) { + } else if (frequency >= MHZ(16) && NRF_SPIM_HAS_16_MHZ_FREQ) { return MHZ(16); } else if (frequency >= MHZ(8)) { return MHZ(8); From db1ed59e7a9498328e6fdd8d4aea2c846cc3d544 Mon Sep 17 00:00:00 2001 From: Michal Frankiewicz Date: Tue, 15 Jul 2025 11:30:28 +0200 Subject: [PATCH 0193/2141] [nrf fromlist] tests: drivers: spi: Add test cases for non standard frequencies. Added test cases for nrf chips for non standard frequencies. Upstream PR #: 92436 Signed-off-by: Michal Frankiewicz (cherry picked from commit 3649ff7acfc6961e4ee6152b123f482c545aedbd) --- .../boards/1m333333hz.overlay | 9 +++++++++ .../boards/2m666666hz.overlay | 9 +++++++++ .../spi/spi_controller_peripheral/testcase.yaml | 16 ++++++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 tests/drivers/spi/spi_controller_peripheral/boards/1m333333hz.overlay create mode 100644 tests/drivers/spi/spi_controller_peripheral/boards/2m666666hz.overlay diff --git a/tests/drivers/spi/spi_controller_peripheral/boards/1m333333hz.overlay b/tests/drivers/spi/spi_controller_peripheral/boards/1m333333hz.overlay new file mode 100644 index 000000000000..5a35648b7527 --- /dev/null +++ b/tests/drivers/spi/spi_controller_peripheral/boards/1m333333hz.overlay @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&dut_spi_dt { + spi-max-frequency = <1333333>; +}; diff --git a/tests/drivers/spi/spi_controller_peripheral/boards/2m666666hz.overlay b/tests/drivers/spi/spi_controller_peripheral/boards/2m666666hz.overlay new file mode 100644 index 000000000000..642a3e18e952 --- /dev/null +++ b/tests/drivers/spi/spi_controller_peripheral/boards/2m666666hz.overlay @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&dut_spi_dt { + spi-max-frequency = <2666666>; +}; diff --git a/tests/drivers/spi/spi_controller_peripheral/testcase.yaml b/tests/drivers/spi/spi_controller_peripheral/testcase.yaml index 56f3545235e7..cfcf7c149f00 100644 --- a/tests/drivers/spi/spi_controller_peripheral/testcase.yaml +++ b/tests/drivers/spi/spi_controller_peripheral/testcase.yaml @@ -45,6 +45,22 @@ tests: integration_platforms: - nrf52840dk/nrf52840 + drivers.spi.spi_1M333333Hz: + extra_configs: + - CONFIG_TESTED_SPI_MODE=0 + extra_args: EXTRA_DTC_OVERLAY_FILE="boards/1m333333hz.overlay" + integration_platforms: + - nrf54l15dk/nrf54l15/cpuapp + - nrf54h20dk/nrf54h20/cpuapp + + drivers.spi.spi_2M666666Hz: + extra_configs: + - CONFIG_TESTED_SPI_MODE=0 + extra_args: EXTRA_DTC_OVERLAY_FILE="boards/2m666666hz.overlay" + integration_platforms: + - nrf54l15dk/nrf54l15/cpuapp + - nrf54h20dk/nrf54h20/cpuapp + drivers.spi.spi_4MHz: extra_configs: - CONFIG_TESTED_SPI_MODE=2 From 96414e4802cb3d4ae08dd497ced5956a1510a502 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Wed, 9 Jul 2025 10:43:46 +0100 Subject: [PATCH 0194/2141] [nrf fromlist] settings: Only use mutexes when multithreading is enabled Allows usage of settings when multithreading is disabled Upstream PR #: 92886 Signed-off-by: Jamie McCrae (cherry picked from commit 7a777773eeacd074f10088671da562f3870e4c6d) --- subsys/settings/src/settings.c | 23 +++++++++++++++++++---- subsys/settings/src/settings_init.c | 7 +++---- subsys/settings/src/settings_priv.h | 6 ++++++ subsys/settings/src/settings_store.c | 21 ++++++++++----------- 4 files changed, 38 insertions(+), 19 deletions(-) diff --git a/subsys/settings/src/settings.c b/subsys/settings/src/settings.c index dde6135a4119..74f97bc79e54 100644 --- a/subsys/settings/src/settings.c +++ b/subsys/settings/src/settings.c @@ -23,8 +23,9 @@ LOG_MODULE_REGISTER(settings, CONFIG_SETTINGS_LOG_LEVEL); sys_slist_t settings_handlers; #endif /* CONFIG_SETTINGS_DYNAMIC_HANDLERS */ -K_MUTEX_DEFINE(settings_lock); - +#ifdef CONFIG_MULTITHREADING +static K_MUTEX_DEFINE(settings_lock); +#endif void settings_store_init(void); @@ -47,7 +48,7 @@ int settings_register_with_cprio(struct settings_handler *handler, int cprio) } } - k_mutex_lock(&settings_lock, K_FOREVER); + settings_lock_take(); struct settings_handler *ch; SYS_SLIST_FOR_EACH_CONTAINER(&settings_handlers, ch, node) { @@ -61,7 +62,7 @@ int settings_register_with_cprio(struct settings_handler *handler, int cprio) sys_slist_append(&settings_handlers, &handler->node); end: - k_mutex_unlock(&settings_lock); + settings_lock_release(); return rc; } @@ -319,3 +320,17 @@ int settings_commit_subtree(const char *subtree) return rc; } + +void settings_lock_take(void) +{ +#ifdef CONFIG_MULTITHREADING + k_mutex_lock(&settings_lock, K_FOREVER); +#endif +} + +void settings_lock_release(void) +{ +#ifdef CONFIG_MULTITHREADING + k_mutex_unlock(&settings_lock); +#endif +} diff --git a/subsys/settings/src/settings_init.c b/subsys/settings/src/settings_init.c index 7a478c8707b9..a77152d712f6 100644 --- a/subsys/settings/src/settings_init.c +++ b/subsys/settings/src/settings_init.c @@ -14,8 +14,7 @@ #include #include "settings/settings_file.h" #include - -extern struct k_mutex settings_lock; +#include "settings_priv.h" bool settings_subsys_initialized; @@ -28,7 +27,7 @@ int settings_subsys_init(void) int err = 0; - k_mutex_lock(&settings_lock, K_FOREVER); + settings_lock_take(); if (!settings_subsys_initialized) { settings_init(); @@ -40,7 +39,7 @@ int settings_subsys_init(void) } } - k_mutex_unlock(&settings_lock); + settings_lock_release(); return err; } diff --git a/subsys/settings/src/settings_priv.h b/subsys/settings/src/settings_priv.h index b732bcef2d8b..93b47b9b789e 100644 --- a/subsys/settings/src/settings_priv.h +++ b/subsys/settings/src/settings_priv.h @@ -111,6 +111,12 @@ extern sys_slist_t settings_load_srcs; extern sys_slist_t settings_handlers; extern struct settings_store *settings_save_dst; +/** Takes the settings mutex lock (if multithreading is enabled) */ +void settings_lock_take(void); + +/** Releases the settings mutex lock (if multithreading is enabled) */ +void settings_lock_release(void); + #ifdef __cplusplus } #endif diff --git a/subsys/settings/src/settings_store.c b/subsys/settings/src/settings_store.c index 4dcdb80b78f2..cb5b8a0e5bd1 100644 --- a/subsys/settings/src/settings_store.c +++ b/subsys/settings/src/settings_store.c @@ -22,7 +22,6 @@ LOG_MODULE_DECLARE(settings, CONFIG_SETTINGS_LOG_LEVEL); sys_slist_t settings_load_srcs; struct settings_store *settings_save_dst; -extern struct k_mutex settings_lock; void settings_src_register(struct settings_store *cs) { @@ -53,12 +52,12 @@ int settings_load_subtree(const char *subtree) * apply config * commit all */ - k_mutex_lock(&settings_lock, K_FOREVER); + settings_lock_take(); SYS_SLIST_FOR_EACH_CONTAINER(&settings_load_srcs, cs, cs_next) { cs->cs_itf->csi_load(cs, &arg); } rc = settings_commit_subtree(subtree); - k_mutex_unlock(&settings_lock); + settings_lock_release(); return rc; } @@ -80,11 +79,11 @@ int settings_load_subtree_direct( * apply config * commit all */ - k_mutex_lock(&settings_lock, K_FOREVER); + settings_lock_take(); SYS_SLIST_FOR_EACH_CONTAINER(&settings_load_srcs, cs, cs_next) { cs->cs_itf->csi_load(cs, &arg); } - k_mutex_unlock(&settings_lock); + settings_lock_release(); return 0; } @@ -144,7 +143,7 @@ ssize_t settings_get_val_len(const char *name) * for every config store that supports this function * get the value's length. */ - k_mutex_lock(&settings_lock, K_FOREVER); + settings_lock_take(); SYS_SLIST_FOR_EACH_CONTAINER(&settings_load_srcs, cs, cs_next) { if (cs->cs_itf->csi_get_val_len) { val_len = cs->cs_itf->csi_get_val_len(cs, name); @@ -157,7 +156,7 @@ ssize_t settings_get_val_len(const char *name) rc = cs->cs_itf->csi_load(cs, &arg); } } - k_mutex_unlock(&settings_lock); + settings_lock_release(); if (rc >= 0) { return val_len; @@ -177,7 +176,7 @@ ssize_t settings_load_one(const char *name, void *buf, size_t buf_len) * For every config store that defines csi_load_one() function use it. * Otherwise, use the csi_load() function to load the key/value pair */ - k_mutex_lock(&settings_lock, K_FOREVER); + settings_lock_take(); SYS_SLIST_FOR_EACH_CONTAINER(&settings_load_srcs, cs, cs_next) { if (cs->cs_itf->csi_load_one) { rc = cs->cs_itf->csi_load_one(cs, name, (char *)buf, buf_len); @@ -196,7 +195,7 @@ ssize_t settings_load_one(const char *name, void *buf, size_t buf_len) rc = cs->cs_itf->csi_load(cs, &arg); } } - k_mutex_unlock(&settings_lock); + settings_lock_release(); if (rc >= 0) { return val_len; @@ -217,11 +216,11 @@ int settings_save_one(const char *name, const void *value, size_t val_len) return -ENOENT; } - k_mutex_lock(&settings_lock, K_FOREVER); + settings_lock_take(); rc = cs->cs_itf->csi_save(cs, name, (char *)value, val_len); - k_mutex_unlock(&settings_lock); + settings_lock_release(); return rc; } From 5a3c2365ad0a6d399b26731b568cc2a1f898d87c Mon Sep 17 00:00:00 2001 From: Nirav Agrawal Date: Fri, 6 Jun 2025 10:30:11 +0530 Subject: [PATCH 0195/2141] [nrf fromtree] drivers: bluetooth: add BT-CAL data load for NXP IW612/IW416 SoC - Add support for default Annex-55 Bluetooth calibration data load for both IW612 and IW416 SoC. - Add support for default Annex-100 Bluetooth calibration data load for both IW612 and IW416 SoC. Signed-off-by: Nirav Agrawal (cherry picked from commit ffe8daa767b876a3d5a8c86352c6924aa48162d9) --- drivers/bluetooth/hci/Kconfig.nxp | 8 +- drivers/bluetooth/hci/hci_nxp_setup.c | 216 +++++++++++++++++++++++++- 2 files changed, 217 insertions(+), 7 deletions(-) diff --git a/drivers/bluetooth/hci/Kconfig.nxp b/drivers/bluetooth/hci/Kconfig.nxp index 1f6983ee9894..9fb0850fa8ed 100644 --- a/drivers/bluetooth/hci/Kconfig.nxp +++ b/drivers/bluetooth/hci/Kconfig.nxp @@ -13,14 +13,14 @@ config HCI_NXP_ENABLE_AUTO_SLEEP message to the Controller as the Host will need to wake it up. config HCI_NXP_SET_CAL_DATA - bool "BLE Controller calibration data" + bool "Bluetooth Controller calibration data" help - If enabled, the Host will send calibration data to the BLE Controller during HCI init. + If enabled, the Host will send calibration data to the Bluetooth Controller during HCI init. config HCI_NXP_SET_CAL_DATA_ANNEX100 - bool "BLE Controller calibration data annex 100" + bool "Bluetooth Controller calibration data annex 100" help - If enabled, the Host will send calibration data annex 100 to the BLE Controller during HCI + If enabled, the Host will send calibration data annex 100 to the Bluetooth Controller during HCI init. config HCI_NXP_RX_THREAD diff --git a/drivers/bluetooth/hci/hci_nxp_setup.c b/drivers/bluetooth/hci/hci_nxp_setup.c index 6fa34d0a24eb..a217ffc53bd4 100644 --- a/drivers/bluetooth/hci/hci_nxp_setup.c +++ b/drivers/bluetooth/hci/hci_nxp_setup.c @@ -29,13 +29,25 @@ LOG_MODULE_REGISTER(bt_nxp_ctlr); #define DT_DRV_COMPAT nxp_bt_hci_uart -#define FW_UPLOAD_CHANGE_TIMEOUT_RETRY_COUNT 6 +#define FW_UPLOAD_CHANGE_TIMEOUT_RETRY_COUNT 6 +#define HCI_CMD_STORE_BT_CAL_DATA_ANNEX100_OCF 0xFF +#define HCI_CMD_STORE_BT_CAL_DATA_PARAM_ANNEX100_LENGTH 16 +#define HCI_CMD_STORE_BT_CAL_DATA_OCF 0x61 +#define HCI_CMD_STORE_BT_CAL_DATA_PARAM_LENGTH 32 extern const unsigned char *bt_fw_bin; extern const unsigned int bt_fw_bin_len; static const struct device *uart_dev = DEVICE_DT_GET(DT_INST_GPARENT(0)); +#if !defined(CONFIG_HCI_NXP_SET_CAL_DATA) +#define bt_nxp_set_calibration_data_annex55() 0 +#endif + +#if !defined(CONFIG_HCI_NXP_SET_CAL_DATA_ANNEX100) +#define bt_nxp_set_calibration_data_annex100() 0 +#endif + #if DT_NODE_HAS_PROP(DT_DRV_INST(0), sdio_reset_gpios) struct gpio_dt_spec sdio_reset = GPIO_DT_SPEC_GET(DT_DRV_INST(0), sdio_reset_gpios); #endif /* DT_NODE_HAS_PROP(DT_DRV_INST(0), sdio_reset_gpios) */ @@ -1171,6 +1183,189 @@ static int bt_nxp_ctlr_init(void) return 0; } +#if defined(CONFIG_HCI_NXP_SET_CAL_DATA) + +static int bt_nxp_set_calibration_data_annex55(void) +{ + int ret = 0; + uint16_t opcode = BT_OP(BT_OGF_VS, HCI_CMD_STORE_BT_CAL_DATA_OCF); + + const uint8_t hci_cal_data_annex55[HCI_CMD_STORE_BT_CAL_DATA_PARAM_LENGTH] = { +#if defined(CONFIG_BT_NXP_NW612) + 0x00, /* Sequence Number : 0x00 */ + 0x01, /* Action : 0x01 */ + 0x01, /* Type : Not use CheckSum */ + 0x1C, /* File Length : 0x1C */ + 0x37, /* BT Annex Type : BT CFG */ + 0x33, /* Checksum : 0x71 */ + 0x1C, /* Annex Length LSB: 0x001C */ + 0x00, /* Annex Length MSB: 0x001C */ + 0x00, /* Pointer For Next Annex[0] : 0x00000000 */ + 0x00, /* Pointer For Next Annex[1] : 0x00000000 */ + 0x00, /* Pointer For Next Annex[2] : 0x00000000 */ + 0x00, /* Pointer For Next Annex[3] : 0x00000000 */ + 0x01, /* Annex Version : 0x01 */ + 0x81, /* External Xtal Calibration Value : 0x7d */ + 0x0D, /* Initial TX Power : 13 */ + 0x07, /* Front End Loss : 0x07 */ + 0x28, /* BT Options : */ + /* BIT[0] Force Class 2 operation = 0 */ + /* BIT[1] Disable Pwr-ctrl for class 2=0 */ + /* BIT[2] MiscFlg(to indicate ext.XTAL)=0 */ + /* BIT[3] Used Internal Sleep Clock = 1 */ + /* BIT[4] BT AOA location support = 0 */ + /* BIT[5] Force Class 1 mode = 1 */ + /* BIT[7:6] Reserved */ + 0x00, /* AOANumberOfAntennas: 0x00 */ + 0x00, /* RSSI Golden Low : 0 */ + 0x00, /* RSSI Golden High : 0 */ + 0xC0, /* UART Baud Rate[0] : 0x002DC6C0(3000000) */ + 0xC6, /* UART Baud Rate[1] : 0x002DC6C0(3000000) */ + 0x2D, /* UART Baud Rate[2] : 0x002DC6C0(3000000) */ + 0x00, /* UART Baud Rate[3] : 0x002DC6C0(3000000) */ + 0x00, /* BdAddress[0] : 0x000000000000 */ + 0x00, /* BdAddress[1] : 0x000000000000 */ + 0x00, /* BdAddress[2] : 0x000000000000 */ + 0x00, /* BdAddress[3] : 0x000000000000 */ + 0x00, /* BdAddress[4] : 0x000000000000 */ + 0x00, /* BdAddress[5] : 0x000000000000 */ + 0xF0, /* Encr_Key_Len[3:0]: MinEncrKeyLen = 0x0 */ + /* ExEncrKeyLen = 0xF */ + 0x00, /* RegionCode : 0x00 */ +#elif defined(CONFIG_BT_NXP_IW416) + 0x00, /* Sequence Number : 0x00 */ + 0x01, /* Action : 0x01 */ + 0x01, /* Type : Not use CheckSum */ + 0x1C, /* File Length : 0x1C */ + 0x37, /* BT Annex Type : BT CFG */ + 0x33, /* Checksum : 0x71 */ + 0x1C, /* Annex Length LSB: 0x001C */ + 0x00, /* Annex Length MSB: 0x001C */ + 0x00, /* Pointer For Next Annex[0] : 0x00000000 */ + 0x00, /* Pointer For Next Annex[1] : 0x00000000 */ + 0x00, /* Pointer For Next Annex[2] : 0x00000000 */ + 0x00, /* Pointer For Next Annex[3] : 0x00000000 */ + 0x01, /* Annex Version : 0x01 */ + 0x00, /* External Xtal Calibration Value */ + 0x03, /* Initial TX Power : 0x03 */ + 0x03, /* Front End Loss : 0x03 */ + 0x00, /* BT Options : */ + /* BIT[0] Force Class 2 operation = 0 */ + /* BIT[1] Disable Pwr Ctrl for class 2=0 */ + /* BIT[2] MiscFlg(to indicate ext.XTAL)=0 */ + /* BIT[3] Used Internal Sleep Clock = 0 */ + /* BIT[4] BT AOA localtion support = 0 */ + /* BIT[5] Force Class 1 mode = 0 */ + /* BIT[7:6] Reserved */ + 0x00, /* AOANumberOfAntennas: 0x00 */ + 0xBA, /* RSSI Golden Low : 0 */ + 0xCE, /* RSSI Golden High : 0 */ + 0xC0, /* UART Baud Rate[0] : 0x002DC6C0(3000000) */ + 0xC6, /* UART Baud Rate[1] : 0x002DC6C0(3000000) */ + 0x2D, /* UART Baud Rate[2] : 0x002DC6C0(3000000) */ + 0x00, /* UART Baud Rate[3] : 0x002DC6C0(3000000) */ + 0x00, /* BdAddress[0] : 0x000000000000 */ + 0x00, /* BdAddress[1] : 0x000000000000 */ + 0x00, /* BdAddress[2] : 0x000000000000 */ + 0x00, /* BdAddress[3] : 0x000000000000 */ + 0x00, /* BdAddress[4] : 0x000000000000 */ + 0x00, /* BdAddress[5] : 0x000000000000 */ + 0xF0, /* Encr_Key_Len[3:0]: MinEncrKeyLen = 0x0 */ + /* ExEncrKeyLen = 0xF */ + 0x00, /* RegionCode : 0x00 */ +#else +#error "BT Calibration data (annex-55) is not given for selected chipset" +#endif + }; + + if (IS_ENABLED(CONFIG_BT_HCI_HOST)) { + struct net_buf *buf; + + buf = bt_hci_cmd_create(opcode, HCI_CMD_STORE_BT_CAL_DATA_PARAM_LENGTH); + if (buf == NULL) { + LOG_ERR("Unable to allocate command buffer"); + return -ENOMEM; + } + + net_buf_add_mem(buf, hci_cal_data_annex55, HCI_CMD_STORE_BT_CAL_DATA_PARAM_LENGTH); + + ret = bt_hci_cmd_send_sync(opcode, buf, NULL); + if (ret) { + LOG_ERR("Failed to send set-calibration cmd (err %d)", ret); + return ret; + } + + (void)k_msleep(CONFIG_BT_H4_NXP_CTLR_WAIT_TIME_AFTER_BAUDRATE_UPDATE); + } + + return ret; +} +#endif /*CONFIG_HCI_NXP_SET_CAL_DATA*/ + +#if defined(CONFIG_HCI_NXP_SET_CAL_DATA_ANNEX100) + +static int bt_nxp_set_calibration_data_annex100(void) +{ + int ret = 0; + const uint8_t hci_cal_data_annex100[HCI_CMD_STORE_BT_CAL_DATA_PARAM_ANNEX100_LENGTH] = { +#if defined(CONFIG_BT_NXP_NW612) + 0x64, /* Annex Type : 0x64 */ + 0x83, /* Checksum */ + 0x10, 0x00, /* Length */ + 0x00, 0x00, 0x00, 0x00, /* Pointer for next Annex-Structure */ + 0x01, /* Ext PA Present (1 bit) + */ + /* Ext. PA Gain (7 bits) */ + 0x00, /* Ext Antenna Gain(1 bit) + */ + /* Ext. Antenna Gain Val(4 bits) */ + 0x04, 0x00, /* BT / LE Ext PA FEM CTRL Bitmask */ + 0x01, /* Ext LNA Present (1 bit) + */ + /* Ext LNA Gain (7 bits) */ + 0x00, /* Reserved */ + 0x04, 0x00 /* BT / LE Ext LNA FEM CTRL Bitmask */ +#elif defined(CONFIG_BT_NXP_IW416) + 0x64, /* Annex Type : 0x64 */ + 0x83, /* Checksum */ + 0x10, 0x00, /* Length */ + 0x00, 0x00, 0x00, 0x00, /* Pointer for next Annex-Structure */ + 0x01, /* Ext PA Present (1 bit) + */ + /* Ext. PA Gain (7 bits) */ + 0x00, /* Ext Antenna Gain(1 bit) + */ + /* Ext. Antenna Gain Val (4 bits) */ + 0x0C, 0x00, /* BT / LE Ext PA FEM CTRL Bitmask */ + 0x01, /* Ext LNA Present (1 bit) + */ + /* Ext LNA Gain (7 bits) */ + 0x00, /* Reserved */ + 0x0C, 0x00 /* BT/LE Ext LNA FEM CTRL Bitmask */ +#else +#error "BT Calibration data (annex-100) is not given for selected chipset" +#endif + }; + + uint16_t opcode = BT_OP(BT_OGF_VS, HCI_CMD_STORE_BT_CAL_DATA_ANNEX100_OCF); + + if (IS_ENABLED(CONFIG_BT_HCI_HOST)) { + struct net_buf *buf; + + buf = bt_hci_cmd_create(opcode, HCI_CMD_STORE_BT_CAL_DATA_PARAM_ANNEX100_LENGTH); + if (buf == NULL) { + LOG_ERR("Unable to allocate command buffer"); + return -ENOMEM; + } + + net_buf_add_mem(buf, hci_cal_data_annex100, + HCI_CMD_STORE_BT_CAL_DATA_PARAM_ANNEX100_LENGTH); + + ret = bt_hci_cmd_send_sync(opcode, buf, NULL); + if (ret) { + LOG_ERR("Failed to send set-calibration cmd (err %d)", ret); + return ret; + } + } + + return ret; +} +#endif /* defined(CONFIG_HCI_NXP_SET_CAL_DATA_ANNEX100) */ + int bt_hci_transport_setup(const struct device *dev) { int ret = 0; @@ -1231,6 +1426,7 @@ int bt_h4_vnd_setup(const struct device *dev) flowcontrol_of_hci = (bool)DT_PROP_OR(DT_DRV_INST(0), hw_flow_control, false); if (operation_speed == default_speed) { + fw_upload.is_setup_done = true; return 0; } @@ -1240,7 +1436,7 @@ int bt_h4_vnd_setup(const struct device *dev) return err; } - /* BT waiting time after controller bandrate updated */ + /* BT waiting time after controller bandrate updated */ (void)k_msleep(CONFIG_BT_H4_NXP_CTLR_WAIT_TIME_AFTER_BAUDRATE_UPDATE); } @@ -1250,7 +1446,21 @@ int bt_h4_vnd_setup(const struct device *dev) return err; } - fw_upload.is_setup_done = true; + if (!fw_upload.is_setup_done) { + err = bt_nxp_set_calibration_data_annex55(); + if (err) { + LOG_ERR("Fail to load annex-55 calibration data"); + return err; + } + + err = bt_nxp_set_calibration_data_annex100(); + if (err) { + LOG_ERR("Fail to load annex-100 calibration data"); + return err; + } + + fw_upload.is_setup_done = true; + } return 0; } From 61b354b92c5a4f4d82e8190d89b4c0708df26f43 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Thu, 19 Jun 2025 04:08:29 +0300 Subject: [PATCH 0196/2141] [nrf fromtree] Bluetooth: drivers: Use bt_hci_cmd_alloc() Use bt_hci_cmd_alloc() instead of the soon to be deprecated bt_hci_cmd_create(). Signed-off-by: Johan Hedberg (cherry picked from commit c186a3110c01c5bd3ad4cc0721f0e579298a4c21) --- drivers/bluetooth/hci/apollox_blue.c | 3 +-- drivers/bluetooth/hci/h4_ifx_cyw43xxx.c | 5 ++--- drivers/bluetooth/hci/hci_ifx_cyw208xx.c | 6 +++--- drivers/bluetooth/hci/hci_ifx_psoc6_bless.c | 2 +- drivers/bluetooth/hci/hci_nxp.c | 2 +- drivers/bluetooth/hci/hci_nxp_setup.c | 7 +++---- drivers/bluetooth/hci/hci_spi_st.c | 2 +- drivers/bluetooth/hci/hci_stm32wba.c | 2 +- drivers/bluetooth/hci/ipm_stm32wb.c | 5 ++--- 9 files changed, 15 insertions(+), 19 deletions(-) diff --git a/drivers/bluetooth/hci/apollox_blue.c b/drivers/bluetooth/hci/apollox_blue.c index 1fb2ab33fb10..9a4bf5440d87 100644 --- a/drivers/bluetooth/hci/apollox_blue.c +++ b/drivers/bluetooth/hci/apollox_blue.c @@ -396,8 +396,7 @@ static int bt_apollo_set_nvds(void) #else uint8_t *p; - buf = bt_hci_cmd_create(HCI_VSC_UPDATE_NVDS_CFG_CMD_OPCODE, - HCI_VSC_UPDATE_NVDS_CFG_CMD_LENGTH); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } diff --git a/drivers/bluetooth/hci/h4_ifx_cyw43xxx.c b/drivers/bluetooth/hci/h4_ifx_cyw43xxx.c index 6bc563fb9f20..e115ea92b47b 100644 --- a/drivers/bluetooth/hci/h4_ifx_cyw43xxx.c +++ b/drivers/bluetooth/hci/h4_ifx_cyw43xxx.c @@ -122,8 +122,7 @@ static int bt_update_controller_baudrate(const struct device *bt_uart_dev, uint3 /* Allocate buffer for update uart baudrate command. * It will be BT_HCI_OP_RESET with extra parameters. */ - buf = bt_hci_cmd_create(BT_HCI_VND_OP_UPDATE_BAUDRATE, - HCI_VSC_UPDATE_BAUD_RATE_LENGTH); + buf = bt_hci_cmd_alloc(K_FOREVER); if (buf == NULL) { LOG_ERR("Unable to allocate command buffer"); return -ENOMEM; @@ -172,7 +171,7 @@ static int bt_firmware_download(const uint8_t *firmware_image, uint32_t size) uint16_t op_code = *(uint16_t *)data; /* Allocate buffer for hci_write_ram/hci_launch_ram command. */ - buf = bt_hci_cmd_create(op_code, data_length); + buf = bt_hci_cmd_alloc(K_FOREVER); if (buf == NULL) { LOG_ERR("Unable to allocate command buffer"); return err; diff --git a/drivers/bluetooth/hci/hci_ifx_cyw208xx.c b/drivers/bluetooth/hci/hci_ifx_cyw208xx.c index 1fee53436a6e..913d19d514c1 100644 --- a/drivers/bluetooth/hci/hci_ifx_cyw208xx.c +++ b/drivers/bluetooth/hci/hci_ifx_cyw208xx.c @@ -146,7 +146,7 @@ static int cyw208xx_bt_firmware_download(const uint8_t *firmware_image, uint32_t } /* Allocate buffer for hci_write_ram/hci_launch_ram command. */ - buf = bt_hci_cmd_create(op_code, data_length); + buf = bt_hci_cmd_alloc(K_FOREVER); if (buf == NULL) { LOG_ERR("Unable to allocate command buffer"); return -ENOBUFS; @@ -211,7 +211,7 @@ static int cyw208xx_setup(const struct device *dev, const struct bt_hci_setup_pa cybt_platform_hci_wait_for_boot_fully_up(false); /* Set public address */ - buf = bt_hci_cmd_create(BT_HCI_VND_OP_SET_LOCAL_DEV_ADDR, BTM_SET_LOCAL_DEV_ADDR_LENGTH); + buf = bt_hci_cmd_alloc(K_FOREVER); if (buf == NULL) { LOG_ERR("Unable to allocate command buffer"); cyhal_syspm_unlock_deepsleep(); @@ -375,7 +375,7 @@ wiced_bt_dev_vendor_specific_command(uint16_t opcode, uint8_t param_len, uint8_t struct net_buf *buf = NULL; /* Allocate a HCI command buffer */ - buf = bt_hci_cmd_create(opcode, param_len); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { LOG_ERR("Unable to allocate buffer"); return WICED_NO_MEMORY; diff --git a/drivers/bluetooth/hci/hci_ifx_psoc6_bless.c b/drivers/bluetooth/hci/hci_ifx_psoc6_bless.c index db50091c8ae0..531a3439d911 100644 --- a/drivers/bluetooth/hci/hci_ifx_psoc6_bless.c +++ b/drivers/bluetooth/hci/hci_ifx_psoc6_bless.c @@ -203,7 +203,7 @@ static int psoc6_bless_setup(const struct device *dev, const struct bt_hci_setup addr[5], addr[4], addr[3], addr[2], addr[1], addr[0], BT_ADDR_LE_PUBLIC, }; - buf = bt_hci_cmd_create(PSOC6_BLESS_OP_SET_PUBLIC_ADDR, sizeof(hci_data)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (buf == NULL) { LOG_ERR("Unable to allocate command buffer"); return -ENOMEM; diff --git a/drivers/bluetooth/hci/hci_nxp.c b/drivers/bluetooth/hci/hci_nxp.c index 2cd5511e7c7d..a540e264ac0b 100644 --- a/drivers/bluetooth/hci/hci_nxp.c +++ b/drivers/bluetooth/hci/hci_nxp.c @@ -94,7 +94,7 @@ static int nxp_bt_send_vs_command(uint16_t opcode, const uint8_t *params, uint8_ struct net_buf *buf; /* Allocate buffer for the hci command */ - buf = bt_hci_cmd_create(opcode, params_len); + buf = bt_hci_cmd_alloc(K_FOREVER); if (buf == NULL) { LOG_ERR("Unable to allocate command buffer"); return -ENOMEM; diff --git a/drivers/bluetooth/hci/hci_nxp_setup.c b/drivers/bluetooth/hci/hci_nxp_setup.c index a217ffc53bd4..a89e1ede6778 100644 --- a/drivers/bluetooth/hci/hci_nxp_setup.c +++ b/drivers/bluetooth/hci/hci_nxp_setup.c @@ -1281,7 +1281,7 @@ static int bt_nxp_set_calibration_data_annex55(void) if (IS_ENABLED(CONFIG_BT_HCI_HOST)) { struct net_buf *buf; - buf = bt_hci_cmd_create(opcode, HCI_CMD_STORE_BT_CAL_DATA_PARAM_LENGTH); + buf = bt_hci_cmd_alloc(K_FOREVER); if (buf == NULL) { LOG_ERR("Unable to allocate command buffer"); return -ENOMEM; @@ -1346,7 +1346,7 @@ static int bt_nxp_set_calibration_data_annex100(void) if (IS_ENABLED(CONFIG_BT_HCI_HOST)) { struct net_buf *buf; - buf = bt_hci_cmd_create(opcode, HCI_CMD_STORE_BT_CAL_DATA_PARAM_ANNEX100_LENGTH); + buf = bt_hci_cmd_alloc(K_FOREVER); if (buf == NULL) { LOG_ERR("Unable to allocate command buffer"); return -ENOMEM; @@ -1387,8 +1387,7 @@ static int bt_hci_baudrate_update(const struct device *dev, uint32_t baudrate) int err; struct net_buf *buf; - buf = bt_hci_cmd_create(BT_HCI_VSC_BAUDRATE_UPDATE_OPCODE, - BT_HCI_VSC_BAUDRATE_UPDATE_LENGTH); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { LOG_ERR("Fail to allocate buffer"); return -ENOBUFS; diff --git a/drivers/bluetooth/hci/hci_spi_st.c b/drivers/bluetooth/hci/hci_spi_st.c index e6201ec04758..ebed8ae1ff49 100644 --- a/drivers/bluetooth/hci/hci_spi_st.c +++ b/drivers/bluetooth/hci/hci_spi_st.c @@ -335,7 +335,7 @@ static int bt_spi_send_aci_config(uint8_t offset, const uint8_t *value, size_t v hdr.param_len = data_len; buf = bt_buf_get_tx(BT_BUF_CMD, K_NO_WAIT, &hdr, sizeof(hdr)); #else - buf = bt_hci_cmd_create(BLUENRG_ACI_WRITE_CONFIG_DATA, data_len); + buf = bt_hci_cmd_alloc(K_FOREVER); #endif /* CONFIG_BT_HCI_RAW */ if (!buf) { diff --git a/drivers/bluetooth/hci/hci_stm32wba.c b/drivers/bluetooth/hci/hci_stm32wba.c index 77654e16bea5..57bc54c231ab 100644 --- a/drivers/bluetooth/hci/hci_stm32wba.c +++ b/drivers/bluetooth/hci/hci_stm32wba.c @@ -432,7 +432,7 @@ static int bt_hci_stm32wba_setup(const struct device *dev, return -ENOMSG; } - buf = bt_hci_cmd_create(ACI_HAL_WRITE_CONFIG_DATA, sizeof(*param)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } diff --git a/drivers/bluetooth/hci/ipm_stm32wb.c b/drivers/bluetooth/hci/ipm_stm32wb.c index 3e0dee023dcd..0f61f7c36f78 100644 --- a/drivers/bluetooth/hci/ipm_stm32wb.c +++ b/drivers/bluetooth/hci/ipm_stm32wb.c @@ -433,8 +433,7 @@ static int bt_ipm_set_addr(void) return -ENOMSG; } - buf = bt_hci_cmd_create(ACI_HAL_WRITE_CONFIG_DATA, sizeof(*param)); - + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -468,7 +467,7 @@ static int bt_ipm_ble_init(void) LOG_ERR("Can't set BLE UID addr"); } /* Send ACI_WRITE_SET_TX_POWER_LEVEL */ - buf = bt_hci_cmd_create(ACI_WRITE_SET_TX_POWER_LEVEL, 3); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } From 08772c54d733713295930c4820ea0edf876b2160 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Thu, 19 Jun 2025 11:06:11 +0300 Subject: [PATCH 0197/2141] [nrf fromtree] Bluetooth: Host: Mark bt_hci_cmd_create() as deprecated Mark bt_hci_cmd_create() as deprecated (superceded by bt_hci_cmd_alloc()), and update any references to the new function. Signed-off-by: Johan Hedberg (cherry picked from commit a22a4b1ae432ca8c99d43619099ae67b2c48bf45) --- include/zephyr/bluetooth/hci.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/include/zephyr/bluetooth/hci.h b/include/zephyr/bluetooth/hci.h index dd9c60c8ae80..cc0843fb7e39 100644 --- a/include/zephyr/bluetooth/hci.h +++ b/include/zephyr/bluetooth/hci.h @@ -56,12 +56,14 @@ static inline const char *bt_hci_err_to_str(uint8_t hci_err) * of the parameters. Upon successful return the buffer is ready to have * the parameters encoded into it. * + * @deprecated Use bt_hci_cmd_alloc() instead. + * * @param opcode Command OpCode. * @param param_len Length of command parameters. * * @return Newly allocated buffer. */ -struct net_buf *bt_hci_cmd_create(uint16_t opcode, uint8_t param_len); +__deprecated struct net_buf *bt_hci_cmd_create(uint16_t opcode, uint8_t param_len); /** Allocate an HCI command buffer. * @@ -80,7 +82,7 @@ struct net_buf *bt_hci_cmd_alloc(k_timeout_t timeout); /** Send a HCI command asynchronously. * * This function is used for sending a HCI command asynchronously. It can - * either be called for a buffer created using bt_hci_cmd_create(), or + * either be called for a buffer created using bt_hci_cmd_alloc(), or * if the command has no parameters a NULL can be passed instead. The * sending of the command will happen asynchronously, i.e. upon successful * return from this function the caller only knows that it was queued @@ -99,7 +101,7 @@ int bt_hci_cmd_send(uint16_t opcode, struct net_buf *buf); /** Send a HCI command synchronously. * * This function is used for sending a HCI command synchronously. It can - * either be called for a buffer created using bt_hci_cmd_create(), or + * either be called for a buffer created using bt_hci_cmd_alloc(), or * if the command has no parameters a NULL can be passed instead. * * The function will block until a Command Status or a Command Complete From 4a63d05e821f80a547e4c3ae058dcc4545b23793 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Thu, 19 Jun 2025 11:10:21 +0300 Subject: [PATCH 0198/2141] [nrf fromtree] doc: migration-guide-4.2: Add note about bt_hci_cmd_create() Add a note about bt_hci_cmd_create() deprecation and which API should be used instead. Signed-off-by: Johan Hedberg (cherry picked from commit 607ff8520fef2ce42cdd9642e5184e40e75656f3) --- doc/releases/migration-guide-4.2.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/releases/migration-guide-4.2.rst b/doc/releases/migration-guide-4.2.rst index faad669e379e..08a2a3d0e33d 100644 --- a/doc/releases/migration-guide-4.2.rst +++ b/doc/releases/migration-guide-4.2.rst @@ -410,6 +410,10 @@ Bluetooth HCI have been deprecated, but are still usable, with the exception that they can only be called once per buffer. +* The :c:func:`bt_hci_cmd_create` function has been depracated and the new :c:func:`bt_hci_cmd_alloc` + function should be used instead. The new function takes no parameters because the command + sending functions have been updated to do the command header encoding. + Bluetooth Host ============== From 2c7ce49379167eeb4a89d655f78cdf0cd7275262 Mon Sep 17 00:00:00 2001 From: Piotr Krzyzanowski Date: Tue, 15 Jul 2025 12:32:29 +0200 Subject: [PATCH 0199/2141] [nrf fromlist] tests: drivers: nrf_clock_control: Test extended API Add the resolve and get_startup_time call Upstream PR #: 93141 Signed-off-by: Piotr Krzyzanowski (cherry picked from commit e03ee7a76c5589f7f3cb7a31758258f371bc7547) --- .../nrf_clock_control/src/main.c | 45 +++++++++++++++---- 1 file changed, 37 insertions(+), 8 deletions(-) diff --git a/tests/drivers/clock_control/nrf_clock_control/src/main.c b/tests/drivers/clock_control/nrf_clock_control/src/main.c index 8db19d382003..395e6a0fc000 100644 --- a/tests/drivers/clock_control/nrf_clock_control/src/main.c +++ b/tests/drivers/clock_control/nrf_clock_control/src/main.c @@ -225,10 +225,13 @@ static void test_request_release_clock_spec(const struct device *clk_dev, static void test_clock_control_request(const struct test_clk_context *clk_contexts, size_t contexts_size) { + int ret; const struct test_clk_context *clk_context; size_t clk_specs_size; const struct device *clk_dev; - const struct nrf_clock_spec *clk_spec; + const struct nrf_clock_spec *req_spec; + struct nrf_clock_spec res_spec; + uint32_t startup_time_us; for (size_t i = 0; i < contexts_size; i++) { clk_context = &clk_contexts[i]; @@ -236,16 +239,42 @@ static void test_clock_control_request(const struct test_clk_context *clk_contex for (size_t u = 0; u < clk_specs_size; u++) { clk_dev = clk_context->clk_dev; - clk_spec = &clk_context->clk_specs[u]; + req_spec = &clk_context->clk_specs[u]; - zassert_true(device_is_ready(clk_dev), - "%s is not ready", clk_dev->name); + zassert_true(device_is_ready(clk_dev), "%s is not ready", clk_dev->name); - TC_PRINT("Applying clock (%s) spec: frequency %d, accuracy %d, precision " + TC_PRINT("Requested clock (%s) spec: frequency %d, accuracy %d, precision " "%d\n", - clk_dev->name, clk_spec->frequency, clk_spec->accuracy, - clk_spec->precision); - test_request_release_clock_spec(clk_dev, clk_spec); + clk_dev->name, req_spec->frequency, req_spec->accuracy, + req_spec->precision); + + ret = nrf_clock_control_resolve(clk_dev, req_spec, &res_spec); + zassert(ret == 0 || ret == -ENOSYS, + "minimum clock specs could not be resolved"); + if (ret == 0) { + TC_PRINT("Resolved spec: frequency %d, accuracy %d, precision " + "%d\n", + res_spec.frequency, res_spec.accuracy, res_spec.precision); + } else if (ret == -ENOSYS) { + TC_PRINT("resolve not supported\n"); + res_spec.frequency = req_spec->frequency; + res_spec.accuracy = req_spec->accuracy; + res_spec.precision = req_spec->precision; + } + + ret = nrf_clock_control_get_startup_time(clk_dev, &res_spec, + &startup_time_us); + zassert(ret == 0 || ret == -ENOSYS, "failed to get startup time"); + if (ret == 0) { + TC_PRINT("startup time for resloved spec: %uus\n", startup_time_us); + } else if (ret == -ENOSYS) { + TC_PRINT("get startup time not supported\n"); + } + + TC_PRINT("Applying spec: frequency %d, accuracy %d, precision " + "%d\n", + res_spec.frequency, res_spec.accuracy, res_spec.precision); + test_request_release_clock_spec(clk_dev, &res_spec); } } } From aacc6227ce25ae298045d791bd95b8c4f0a7ff76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 27 Jun 2025 22:15:33 +0200 Subject: [PATCH 0200/2141] [nrf fromtree] net: lib: ptp: fix memory slab alignment issues MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit 3c47f91be4f879c9f1eac4c2be0a1bdd2de426ff introduced alignment validation in K_MEM_SLAB_DEFINE macros. A couple PTP message slabs wer using alignment 8, while the size of the elements wasn't a multiple of 8, causing a static assertion failure. Fix by changing the alignment from 8 to 4 bytes. Signed-off-by: Benjamin Cabé (cherry picked from commit 222a601b21e41af101bc82df4f34c6b813fc0c6e) Signed-off-by: Robert Lubos --- subsys/net/lib/ptp/msg.c | 2 +- subsys/net/lib/ptp/port.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/subsys/net/lib/ptp/msg.c b/subsys/net/lib/ptp/msg.c index e0b7f14229d0..3fb78a40edb4 100644 --- a/subsys/net/lib/ptp/msg.c +++ b/subsys/net/lib/ptp/msg.c @@ -19,7 +19,7 @@ LOG_MODULE_REGISTER(ptp_msg, CONFIG_PTP_LOG_LEVEL); static struct k_mem_slab msg_slab; -K_MEM_SLAB_DEFINE_STATIC(msg_slab, sizeof(struct ptp_msg), CONFIG_PTP_MSG_POLL_SIZE, 8); +K_MEM_SLAB_DEFINE_STATIC(msg_slab, sizeof(struct ptp_msg), CONFIG_PTP_MSG_POLL_SIZE, 4); static const char *msg_type_str(struct ptp_msg *msg) { diff --git a/subsys/net/lib/ptp/port.c b/subsys/net/lib/ptp/port.c index ef3e19c43e0b..24abec002c8d 100644 --- a/subsys/net/lib/ptp/port.c +++ b/subsys/net/lib/ptp/port.c @@ -38,7 +38,7 @@ BUILD_ASSERT(CONFIG_PTP_FOREIGN_TIME_TRANSMITTER_RECORD_SIZE >= 5 * CONFIG_PTP_N K_MEM_SLAB_DEFINE_STATIC(foreign_tts_slab, sizeof(struct ptp_foreign_tt_clock), CONFIG_PTP_FOREIGN_TIME_TRANSMITTER_RECORD_SIZE, - 8); + 4); #endif char str_port_id[] = "FF:FF:FF:FF:FF:FF:FF:FF-FFFF"; From dc5dda3496b940d36f61cd9099bf4a3034e16dbc Mon Sep 17 00:00:00 2001 From: Adam Kondraciuk Date: Wed, 11 Jun 2025 13:37:19 +0200 Subject: [PATCH 0201/2141] [nrf fromtree] drivers: timer: nrf_grtc_timer: add last_count initialization The GRTC counter is not cleared at startup, therefore the `last_count` variable needs to be initialized accordingly. This change: - Prevents overflow of the `sys_clock_announce()` int32_t parameter - Ensures the correct uptime value, which should be reset during initialization Signed-off-by: Adam Kondraciuk (cherry picked from commit e77f942cff5516140f7db48bb42eda49522c1c7a) --- drivers/timer/nrf_grtc_timer.c | 8 ++++++++ include/zephyr/drivers/timer/nrf_grtc_timer.h | 11 +++++++++++ 2 files changed, 19 insertions(+) diff --git a/drivers/timer/nrf_grtc_timer.c b/drivers/timer/nrf_grtc_timer.c index 285e48a57fd2..2809d8b3d608 100644 --- a/drivers/timer/nrf_grtc_timer.c +++ b/drivers/timer/nrf_grtc_timer.c @@ -66,6 +66,7 @@ static struct k_spinlock lock; static uint64_t last_count; /* Time (SYSCOUNTER value) @last sys_clock_announce() */ static atomic_t int_mask; static uint8_t ext_channels_allocated; +static uint64_t grtc_start_value; static nrfx_grtc_channel_t system_clock_channel_data = { .handler = sys_clock_timeout_handler, .p_context = NULL, @@ -358,6 +359,11 @@ int z_nrf_grtc_timer_capture_read(int32_t chan, uint64_t *captured_time) return 0; } +uint64_t z_nrf_grtc_timer_startup_value_get(void) +{ + return grtc_start_value; +} + #if defined(CONFIG_POWEROFF) && defined(CONFIG_NRF_GRTC_START_SYSCOUNTER) int z_nrf_grtc_wakeup_prepare(uint64_t wake_time_us) { @@ -485,6 +491,8 @@ static int sys_clock_driver_init(void) } #endif /* CONFIG_NRF_GRTC_START_SYSCOUNTER */ + last_count = (counter() / CYC_PER_TICK) * CYC_PER_TICK; + grtc_start_value = last_count; int_mask = NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK; if (!IS_ENABLED(CONFIG_TICKLESS_KERNEL)) { system_timeout_set_relative(CYC_PER_TICK); diff --git a/include/zephyr/drivers/timer/nrf_grtc_timer.h b/include/zephyr/drivers/timer/nrf_grtc_timer.h index f8b69d7ddf02..5a51df217442 100644 --- a/include/zephyr/drivers/timer/nrf_grtc_timer.h +++ b/include/zephyr/drivers/timer/nrf_grtc_timer.h @@ -189,6 +189,17 @@ int z_nrf_grtc_timer_capture_read(int32_t chan, uint64_t *captured_time); */ int z_nrf_grtc_wakeup_prepare(uint64_t wake_time_us); +/** @brief Get the GRTC counter value latched at startup. + * + * @note The GRTC timer is not cleared by software at startup, + * while the system tick starts counting from zero. + * In some cases, it may be necessary to compare the system tick + * with the GRTC value — in such situations, this offset can be useful. + * + * @return GRTC value latched during system clock initialization. + */ +uint64_t z_nrf_grtc_timer_startup_value_get(void); + /** * @brief Initialize the GRTC clock timer driver from an application- * defined function. From 6bbe5d64f72b0843ed16f9ef01704759e4e76cff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Mon, 19 May 2025 15:42:20 +0200 Subject: [PATCH 0202/2141] [nrf fromlist] tests: drivers: timer: nrf_grtc_timer: Add stress test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add stress test that randomly starts and aborts multiple timers from various contexts. Test checks if timers do not expire prematurely. Upstream PR #: 87944 Signed-off-by: Krzysztof Chruściński (cherry picked from commit 8af4f9f53d90c24ce275dc364aa035eb544a155e) --- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 17 ++ .../boards/nrf54l15dk_nrf54l15_cpuapp.overlay | 32 +++ .../nrf54l15dk_nrf54l15_cpuflpr.overlay | 32 +++ tests/drivers/timer/nrf_grtc_timer/prj.conf | 6 + tests/drivers/timer/nrf_grtc_timer/src/main.c | 247 ++++++++++++++++++ .../timer/nrf_grtc_timer/testcase.yaml | 43 +-- 6 files changed, 357 insertions(+), 20 deletions(-) create mode 100644 tests/drivers/timer/nrf_grtc_timer/boards/nrf54l15dk_nrf54l15_cpuapp.overlay create mode 100644 tests/drivers/timer/nrf_grtc_timer/boards/nrf54l15dk_nrf54l15_cpuflpr.overlay diff --git a/tests/drivers/timer/nrf_grtc_timer/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/timer/nrf_grtc_timer/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index 04580b71480b..7ae959267039 100644 --- a/tests/drivers/timer/nrf_grtc_timer/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/tests/drivers/timer/nrf_grtc_timer/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -2,4 +2,21 @@ &grtc { /delete-property/ child-owned-channels; + interrupts = <109 2>; +}; + +test_timer: &timer131 { + status = "okay"; + interrupts = <419 1>; +}; + +&timer130 { + status = "okay"; + prescaler = <0>; +}; + +/ { + chosen { + zephyr,cpu-load-counter = &timer130; + }; }; diff --git a/tests/drivers/timer/nrf_grtc_timer/boards/nrf54l15dk_nrf54l15_cpuapp.overlay b/tests/drivers/timer/nrf_grtc_timer/boards/nrf54l15dk_nrf54l15_cpuapp.overlay new file mode 100644 index 000000000000..7bcede529b0e --- /dev/null +++ b/tests/drivers/timer/nrf_grtc_timer/boards/nrf54l15dk_nrf54l15_cpuapp.overlay @@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +&grtc { + interrupts = <228 2>; +}; + +test_timer: &timer21 { + status = "okay"; + interrupts = <203 1>; +}; + +&timer20 { + status = "okay"; + interrupts = <202 0>; +}; + +&timer00 { + status = "okay"; + prescaler = <0>; +}; + +/ { + chosen { + zephyr,cpu-load-counter = &timer00; + }; + + busy-sim { + compatible = "vnd,busy-sim"; + status = "okay"; + counter = <&timer20>; + }; +}; diff --git a/tests/drivers/timer/nrf_grtc_timer/boards/nrf54l15dk_nrf54l15_cpuflpr.overlay b/tests/drivers/timer/nrf_grtc_timer/boards/nrf54l15dk_nrf54l15_cpuflpr.overlay new file mode 100644 index 000000000000..cfa72ed02736 --- /dev/null +++ b/tests/drivers/timer/nrf_grtc_timer/boards/nrf54l15dk_nrf54l15_cpuflpr.overlay @@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +&grtc { + /*interrupts = <226 2>;*/ +}; + +test_timer: &timer21 { + status = "okay"; + /*interrupts = <203 2>;*/ +}; + +&timer20 { + status = "okay"; + interrupts = <202 0>; +}; + +&timer00 { + status = "okay"; + prescaler = <0>; +}; + +/ { + chosen { + zephyr,cpu-load-counter = &timer00; + }; + + busy-sim { + compatible = "vnd,busy-sim"; + status = "okay"; + counter = <&timer20>; + }; +}; diff --git a/tests/drivers/timer/nrf_grtc_timer/prj.conf b/tests/drivers/timer/nrf_grtc_timer/prj.conf index dea03477519d..93926f090b7e 100644 --- a/tests/drivers/timer/nrf_grtc_timer/prj.conf +++ b/tests/drivers/timer/nrf_grtc_timer/prj.conf @@ -1,2 +1,8 @@ CONFIG_ZTEST=y CONFIG_NRF_GRTC_TIMER=y +CONFIG_COUNTER=y +CONFIG_TEST_RANDOM_GENERATOR=y +CONFIG_XOSHIRO_RANDOM_GENERATOR=y +CONFIG_LOG_PRINTK=y +CONFIG_CPU_LOAD=y +CONFIG_CPU_LOAD_USE_COUNTER=y diff --git a/tests/drivers/timer/nrf_grtc_timer/src/main.c b/tests/drivers/timer/nrf_grtc_timer/src/main.c index cede54f026f1..9de554256b41 100644 --- a/tests/drivers/timer/nrf_grtc_timer/src/main.c +++ b/tests/drivers/timer/nrf_grtc_timer/src/main.c @@ -5,7 +5,15 @@ */ #include #include +#include +#include +#include +#include +#include +#include +#include #include +LOG_MODULE_REGISTER(test, 1); #define GRTC_SLEW_TICKS 10 #define NUMBER_OF_TRIES 2000 @@ -153,4 +161,243 @@ ZTEST(nrf_grtc_timer, test_timer_abort_in_compare_mode) z_nrf_grtc_timer_chan_free(channel); } +enum test_timer_state { + TIMER_IDLE, + TIMER_PREPARE, + TIMER_ACTIVE +}; + +enum test_ctx { + TEST_HIGH_PRI, + TEST_TIMER_CB, + TEST_THREAD +}; + +struct test_grtc_timer { + struct k_timer timer; + uint32_t ticks; + uint32_t expire; + uint32_t start_cnt; + uint32_t expire_cnt; + uint32_t abort_cnt; + uint32_t exp_expire; + int max_late; + int min_late; + int avg_late; + uint32_t early_cnt; + enum test_timer_state state; +}; + +static atomic_t test_active_cnt; +static struct test_grtc_timer timers[8]; +static uint32_t test_end; +static k_tid_t test_tid; +static volatile bool test_run; +static uint32_t ctx_cnt[3]; +static const char *const ctx_name[] = { "HIGH PRIO ISR", "TIMER CALLBACK", "THREAD" }; + +static bool stress_test_action(int ctx, int id) +{ + struct test_grtc_timer *timer = &timers[id]; + + ctx_cnt[ctx]++; + if (timer->state == TIMER_ACTIVE) { + /* Aborting soon to expire timers from higher interrupt priority may lead + * to test failures. + */ + if (ctx == 0 && (k_timer_remaining_get(&timer->timer) < 5)) { + return true; + } + + if (timer->abort_cnt < timer->expire_cnt / 2) { + bool any_active; + + timer->state = TIMER_PREPARE; + k_timer_stop(&timer->timer); + timer->abort_cnt++; + any_active = atomic_dec(&test_active_cnt) > 1; + timer->state = TIMER_IDLE; + + return any_active; + } + } else if (timer->state == TIMER_IDLE) { + int ticks = 10 + (sys_rand32_get() & 0x3F); + k_timeout_t t = K_TICKS(ticks); + + timer->exp_expire = k_ticks_to_cyc_floor32(sys_clock_tick_get_32() + ticks); + timer->state = TIMER_PREPARE; + timer->ticks = ticks; + k_timer_start(&timer->timer, t, K_NO_WAIT); + atomic_inc(&test_active_cnt); + timer->start_cnt++; + timer->state = TIMER_ACTIVE; + } + + return true; +} + +static void stress_test_actions(int ctx) +{ + uint32_t r = sys_rand32_get(); + int action_cnt = Z_MAX(r & 0x3, 1); + int tmr_id = (r >> 8) % ARRAY_SIZE(timers); + + /* Occasionally wake thread context from which timer actions are also executed. */ + if ((((r >> 2) & 0x3) == 0) || test_active_cnt < 2) { + LOG_DBG("ctx:%d thread wakeup", ctx); + k_wakeup(test_tid); + } + + for (int i = 0; i < action_cnt; i++) { + if (stress_test_action(ctx, tmr_id) == false) { + stress_test_action(ctx, tmr_id); + } + } +} + +static void timer_cb(struct k_timer *timer) +{ + struct test_grtc_timer *test_timer = CONTAINER_OF(timer, struct test_grtc_timer, timer); + uint32_t now = k_cycle_get_32(); + int diff = now - test_timer->exp_expire; + + atomic_dec(&test_active_cnt); + zassert_true(diff >= 0); + test_timer->max_late = MAX(diff, test_timer->max_late); + test_timer->min_late = MIN(diff, test_timer->min_late); + + if (test_timer->expire_cnt == 0) { + test_timer->avg_late = diff; + } else { + test_timer->avg_late = (test_timer->avg_late * test_timer->expire_cnt + diff) / + (test_timer->expire_cnt + 1); + } + + test_timer->expire_cnt++; + test_timer->state = TIMER_IDLE; + + if (test_run) { + stress_test_actions(TEST_TIMER_CB); + } +} + +static void counter_set(const struct device *dev, struct counter_alarm_cfg *cfg) +{ + int err; + uint32_t us = 150 + (sys_rand32_get() & 0x3F); + + cfg->ticks = counter_us_to_ticks(dev, us); + err = counter_set_channel_alarm(dev, 0, cfg); + zassert_equal(err, 0); +} + +static void counter_cb(const struct device *dev, uint8_t chan_id, uint32_t ticks, void *user_data) +{ + struct counter_alarm_cfg *config = user_data; + + if (test_run) { + stress_test_actions(TEST_HIGH_PRI); + counter_set(dev, config); + } +} + +static void report_progress(uint32_t start, uint32_t end) +{ + static uint32_t next_report; + static uint32_t step; + static uint32_t progress; + + if (next_report == 0) { + step = (end - start) / 10; + next_report = start + step; + } + + if (k_uptime_get_32() > next_report) { + next_report += step; + progress += 10; + printk("%d%%\r", progress); + } +} + +static void grtc_stress_test(bool busy_sim_en) +{ + static struct counter_alarm_cfg alarm_cfg; +#if DT_NODE_EXISTS(DT_NODELABEL(test_timer)) && DT_NODE_HAS_STATUS(DT_NODELABEL(test_timer), okay) + const struct device *const counter_dev = DEVICE_DT_GET(DT_NODELABEL(test_timer)); +#else + const struct device *const counter_dev = NULL; +#endif + uint32_t test_ms = 5000; + uint32_t test_start = k_uptime_get_32(); + uint32_t load; + + test_end = k_cycle_get_32() + k_ms_to_cyc_floor32(test_ms); + test_tid = k_current_get(); + + for (size_t i = 0; i < ARRAY_SIZE(timers); i++) { + k_timer_init(&timers[i].timer, timer_cb, NULL); + } + + if (IS_ENABLED(CONFIG_CPU_LOAD)) { + (void)cpu_load_get(true); + } + + if (counter_dev) { + counter_start(counter_dev); + } + + alarm_cfg.callback = counter_cb; + alarm_cfg.user_data = &alarm_cfg; + test_run = true; + + if (counter_dev) { + counter_set(counter_dev, &alarm_cfg); + } + + if (busy_sim_en) { + busy_sim_start(500, 200, 1000, 400, NULL); + } + + LOG_DBG("Starting test, will end at %d", test_end); + while (k_cycle_get_32() < test_end) { + report_progress(test_start, test_start + test_ms); + stress_test_actions(TEST_THREAD); + k_sleep(K_MSEC(test_ms)); + } + + load = IS_ENABLED(CONFIG_CPU_LOAD) ? cpu_load_get(true) : 0; + + test_run = false; + k_msleep(50); + + for (size_t i = 0; i < ARRAY_SIZE(timers); i++) { + zassert_equal(timers[i].state, TIMER_IDLE, "Unexpected timer %d state:%d", + i, timers[i].state); + TC_PRINT("Timer%d (%p)\r\n\tstart_cnt:%d abort_cnt:%d expire_cnt:%d\n", + i, &timers[i], timers[i].start_cnt, timers[i].abort_cnt, + timers[i].expire_cnt); + TC_PRINT("\tavarage late:%d ticks, max late:%d, min late:%d early:%d\n", + timers[i].avg_late, timers[i].max_late, timers[i].min_late, + timers[i].early_cnt); + } + + for (size_t i = 0; i < ARRAY_SIZE(ctx_cnt); i++) { + TC_PRINT("Context: %s executed %d times\n", ctx_name[i], ctx_cnt[i]); + } + TC_PRINT("CPU load during test:%d.%d\n", load / 10, load % 10); + + if (busy_sim_en) { + busy_sim_stop(); + } + + if (counter_dev) { + counter_stop(counter_dev); + } +} + +ZTEST(nrf_grtc_timer, test_stress) +{ + grtc_stress_test(false); +} + ZTEST_SUITE(nrf_grtc_timer, NULL, NULL, NULL, NULL, NULL); diff --git a/tests/drivers/timer/nrf_grtc_timer/testcase.yaml b/tests/drivers/timer/nrf_grtc_timer/testcase.yaml index cd4f99daede0..57835bc386a5 100644 --- a/tests/drivers/timer/nrf_grtc_timer/testcase.yaml +++ b/tests/drivers/timer/nrf_grtc_timer/testcase.yaml @@ -1,21 +1,24 @@ +common: + tags: + - drivers + platform_allow: + - nrf54l15dk/nrf54l15/cpuapp + - nrf54l15dk/nrf54l15/cpuflpr + - nrf54l15bsim/nrf54l15/cpuapp + - nrf54h20dk/nrf54h20/cpuapp + - nrf54h20dk/nrf54h20/cpurad + - nrf54h20dk/nrf54h20/cpuppr + - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp + - nrf54l20pdk/nrf54l20/cpuflpr + - nrf54lm20dk/nrf54lm20a/cpuflpr + - ophelia4ev/nrf54l15/cpuapp + - ophelia4ev/nrf54l15/cpuflpr + integration_platforms: + - nrf54l15dk/nrf54l15/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp tests: - drivers.timer.nrf_grtc_timer: - tags: drivers - platform_allow: - - nrf54l09pdk/nrf54l09/cpuapp - - nrf54l09pdk/nrf54l09/cpuflpr - - nrf54l15dk/nrf54l15/cpuapp - - nrf54l15dk/nrf54l15/cpuflpr - - nrf54l15bsim/nrf54l15/cpuapp - - nrf54h20dk/nrf54h20/cpuapp - - nrf54h20dk/nrf54h20/cpurad - - nrf54h20dk/nrf54h20/cpuppr - - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - - nrf54l20pdk/nrf54l20/cpuflpr - - nrf54lm20dk/nrf54lm20a/cpuflpr - - ophelia4ev/nrf54l15/cpuapp - - ophelia4ev/nrf54l15/cpuflpr - integration_platforms: - - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp + drivers.timer.nrf_grtc_timer: {} + drivers.timer.nrf_grtc_timer.no_assert: + extra_configs: + - CONFIG_ASSERT=n From 8f4bffb7a02cbaaa78588bc234f4d9bc3678920b Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Tue, 15 Jul 2025 14:16:10 +0100 Subject: [PATCH 0203/2141] [nrf fromlist] settings: Add retention backend Adds a retention backend for settings Upstream PR #: 93151 Signed-off-by: Jamie McCrae (cherry picked from commit 3231e583a020eee256eec0bfb27ef7cdbb3eda59) --- subsys/settings/Kconfig | 14 ++ subsys/settings/src/CMakeLists.txt | 1 + subsys/settings/src/settings_retention.c | 303 +++++++++++++++++++++++ 3 files changed, 318 insertions(+) create mode 100644 subsys/settings/src/settings_retention.c diff --git a/subsys/settings/Kconfig b/subsys/settings/Kconfig index fdb3c4bb3ce2..5b6a76052b20 100644 --- a/subsys/settings/Kconfig +++ b/subsys/settings/Kconfig @@ -30,12 +30,20 @@ config SETTINGS_DYNAMIC_HANDLERS config SETTINGS_ENCODE_LEN bool +DT_CHOSEN_ZEPHYR_SETTINGS_PARTITION := zephyr,settings-partition +DT_ZEPHYR_RETENTION := zephyr,retention + +config SETTINGS_SUPPORTED_RETENTION + bool + default y if RETENTION && $(dt_chosen_has_compat,$(DT_CHOSEN_ZEPHYR_SETTINGS_PARTITION),$(DT_ZEPHYR_RETENTION)) + choice SETTINGS_BACKEND prompt "Storage back-end" default SETTINGS_ZMS if ZMS default SETTINGS_NVS if NVS default SETTINGS_FCB if FCB default SETTINGS_FILE if FILE_SYSTEM + default SETTINGS_RETENTION if SETTINGS_SUPPORTED_RETENTION default SETTINGS_NONE help Storage back-end to be used by the settings subsystem. @@ -104,6 +112,12 @@ config SETTINGS_NVS_NAME_CACHE_SIZE endif # SETTINGS_NVS +config SETTINGS_RETENTION + bool "Retention storage support" + depends on SETTINGS_SUPPORTED_RETENTION + help + Enables retention storage support (bulk load/save supported only). + config SETTINGS_CUSTOM bool "CUSTOM" help diff --git a/subsys/settings/src/CMakeLists.txt b/subsys/settings/src/CMakeLists.txt index 4aa797fbb350..705fd3dc77d4 100644 --- a/subsys/settings/src/CMakeLists.txt +++ b/subsys/settings/src/CMakeLists.txt @@ -14,3 +14,4 @@ zephyr_sources_ifdef(CONFIG_SETTINGS_NVS settings_nvs.c) zephyr_sources_ifdef(CONFIG_SETTINGS_NONE settings_none.c) zephyr_sources_ifdef(CONFIG_SETTINGS_SHELL settings_shell.c) zephyr_sources_ifdef(CONFIG_SETTINGS_ZMS settings_zms.c) +zephyr_sources_ifdef(CONFIG_SETTINGS_RETENTION settings_retention.c) diff --git a/subsys/settings/src/settings_retention.c b/subsys/settings/src/settings_retention.c new file mode 100644 index 000000000000..931bf02cb9f1 --- /dev/null +++ b/subsys/settings/src/settings_retention.c @@ -0,0 +1,303 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include + +#include +#include +#include +#include "settings_priv.h" + +LOG_MODULE_DECLARE(settings, CONFIG_SETTINGS_LOG_LEVEL); + +#if !DT_HAS_CHOSEN(zephyr_settings_partition) +#error "Missing zephyr,settings-partition chosen node" +#elif !DT_NODE_HAS_COMPAT(DT_CHOSEN(zephyr_settings_partition), zephyr_retention) +#error "zephyr,settings-partition must be a zephyr,retention node" +#endif + +/* + * Retention storage stores each setting in the following format: + * uint16_t length_name + * uint16_t length_value + * uint8_t name[...] + * uint8_t value[...] + * + * Each setting is placed sequentially into the retention memory area, it is assumed that the + * checksum feature is used to ensure data validity upon loading settings from the retained + * memory though this is optional. + * + * Upon saving settings, the whole retention area is cleared first, then settings are written + * one-by-one, it is only supported to save/load all settings in one go. + */ + +/** Retention settings context object */ +struct settings_retention { + /** Settings storage */ + struct settings_store cf_store; + + /** Retention device */ + const struct device *cf_retention; + + /** Last write position when setting was saved */ + uint32_t last_write_pos; +}; + +/** Length of name and value object, used when reading/saving settings */ +struct settings_retention_lengths { + /** Length of name */ + uint16_t length_name; + + /** Length of value */ + uint16_t length_value; + + /* Name and value byte arrays follow past this point... */ +}; + +BUILD_ASSERT(sizeof(struct settings_retention_lengths) == sizeof(uint16_t) + sizeof(uint16_t)); + +/** Used with read callback */ +struct settings_retention_read_arg { + /** Retention device */ + const struct device *cf_retention; + + /** Offset to read from */ + uint32_t offset; +}; + +static int settings_retention_load(struct settings_store *cs, const struct settings_load_arg *arg); +static int settings_retention_save(struct settings_store *cs, const char *name, const char *value, + size_t val_len); +static void *settings_retention_storage_get(struct settings_store *cs); +static int settings_retention_save_start(struct settings_store *cs); + +static const struct device *storage_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_settings_partition)); + +static const struct settings_store_itf settings_retention_itf = { + .csi_load = settings_retention_load, + .csi_save = settings_retention_save, + .csi_storage_get = settings_retention_storage_get, + .csi_save_start = settings_retention_save_start, +}; + +static int settings_retention_src(struct settings_retention *cf) +{ + if (!retention_is_valid(cf->cf_retention)) { + return -EIO; + } + + cf->cf_store.cs_itf = &settings_retention_itf; + settings_src_register(&cf->cf_store); + + return 0; +} + +static int settings_retention_dst(struct settings_retention *cf) +{ + cf->cf_store.cs_itf = &settings_retention_itf; + settings_dst_register(&cf->cf_store); + + return 0; +} + +static int settings_retention_read_value(void *cb_arg, void *data, size_t len) +{ + int rc; + struct settings_retention_read_arg *ctx = cb_arg; + + rc = retention_read(ctx->cf_retention, ctx->offset, data, len); + + if (rc != 0) { + return rc; + } + + return len; +} + +static int settings_retention_load(struct settings_store *cs, const struct settings_load_arg *arg) +{ + int rc; + uint32_t pos = 0; + struct settings_retention *cf = CONTAINER_OF(cs, struct settings_retention, cf_store); + uint32_t max_pos = retention_size(cf->cf_retention); + struct settings_retention_read_arg read_arg = { + .cf_retention = cf->cf_retention, + }; + + while (pos < max_pos) { + struct settings_retention_lengths lengths; + char name[SETTINGS_MAX_NAME_LEN + SETTINGS_EXTRA_LEN + 1]; + + if ((pos + sizeof(lengths)) >= max_pos) { + return -EIO; + } + + /* Read lengths and check validity */ + rc = retention_read(cf->cf_retention, pos, (uint8_t *)&lengths, sizeof(lengths)); + + if (rc != 0) { + return rc; + } + + if ((lengths.length_name == 0 && lengths.length_value == 0) || + (lengths.length_name == USHRT_MAX && lengths.length_value == USHRT_MAX)) { + /* Empty data, finished loading */ + LOG_DBG("Finished loading retentions settings, size: 0x%x", pos); + break; + } else if (lengths.length_name > SETTINGS_MAX_NAME_LEN) { + LOG_ERR("Invalid name length: %d, max supported: %d", + lengths.length_name, SETTINGS_MAX_NAME_LEN); + return -EIO; + } else if (lengths.length_value > SETTINGS_MAX_VAL_LEN) { + LOG_ERR("Invalid value length: %d, max supported: %d", + lengths.length_name, SETTINGS_MAX_VAL_LEN); + return -EIO; + } else if ((lengths.length_name + lengths.length_value + pos) > max_pos) { + LOG_ERR("Data length goes beyond retention area: 0x%x, max size: 0x%x", + (lengths.length_name + lengths.length_value + pos), max_pos); + return -EIO; + } + + /* Read values */ + pos += sizeof(lengths); + rc = retention_read(cf->cf_retention, pos, name, lengths.length_name); + + if (rc != 0) { + return rc; + } + + name[lengths.length_name] = '\0'; + pos += lengths.length_name; + read_arg.offset = pos; + + rc = settings_call_set_handler(name, lengths.length_value, + &settings_retention_read_value, &read_arg, arg); + + if (rc != 0) { + return rc; + } + + pos += lengths.length_value; + } + + return 0; +} + +static int settings_retention_save(struct settings_store *cs, const char *name, const char *value, + size_t val_len) +{ + struct settings_retention *cf = CONTAINER_OF(cs, struct settings_retention, cf_store); + struct settings_retention_lengths lengths; + uint32_t off = cf->last_write_pos; + int rc = -EINVAL; + + if (name == NULL || (value == NULL && val_len > 0)) { + return -EINVAL; + } + + lengths.length_name = (uint16_t)strlen(name); + lengths.length_value = (uint16_t)val_len; + + if (lengths.length_name == 0) { + return -EINVAL; + } else if ((cf->last_write_pos + sizeof(lengths) + lengths.length_name + val_len) > + retention_size(cf->cf_retention)) { + return -E2BIG; + } + + /* Write data before writing length header to ensure that if something happens before one + * is written then the data is not wrongly seen as valid upon reading, as would be the + * case if it was partially written + */ + off += sizeof(lengths); + rc = retention_write(cf->cf_retention, off, name, lengths.length_name); + + if (rc != 0) { + return rc; + } + + off += lengths.length_name; + rc = retention_write(cf->cf_retention, off, value, val_len); + + if (rc != 0) { + goto tidy; + } + + rc = retention_write(cf->cf_retention, cf->last_write_pos, (uint8_t *)&lengths, + sizeof(lengths)); + + if (rc != 0) { + goto tidy; + } + + off += val_len; + cf->last_write_pos = off; + +tidy: + if (rc != 0) { + /* Attempt to clear data header that was partially written */ + uint8_t empty_data[sizeof(lengths)] = { 0x00 }; + uint8_t l = sizeof(lengths) + lengths.length_name + val_len; + uint8_t i = 0; + + while (i < l) { + uint8_t write_len = (i + sizeof(empty_data)) > l ? (l - i) : + sizeof(empty_data); + + rc = retention_write(cf->cf_retention, (cf->last_write_pos + i), + empty_data, write_len); + + if (rc != 0) { + break; + } + + i += write_len; + } + } + + return rc; +} + +static int settings_retention_save_start(struct settings_store *cs) +{ + struct settings_retention *cf = CONTAINER_OF(cs, struct settings_retention, cf_store); + + cf->last_write_pos = 0; + + return retention_clear(cf->cf_retention); +} + +int settings_backend_init(void) +{ + int rc; + static struct settings_retention config_init_settings_retention; + + if (!device_is_ready(storage_dev)) { + return -ENOENT; + } + + config_init_settings_retention.cf_retention = storage_dev; + config_init_settings_retention.last_write_pos = 0; + + rc = settings_retention_src(&config_init_settings_retention); + + if (rc != 0 && rc != -EIO) { + return rc; + } + + rc = settings_retention_dst(&config_init_settings_retention); + + return rc; +} + +static void *settings_retention_storage_get(struct settings_store *cs) +{ + struct settings_retention *cf = CONTAINER_OF(cs, struct settings_retention, cf_store); + + return &cf->cf_retention; +} From a5a9f4aab7adcbcc5c763c39a3e526c08f02e6da Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Tue, 15 Jul 2025 14:17:04 +0100 Subject: [PATCH 0204/2141] [nrf fromlist] tests: settings: Add retention test A clone of the zms test, using the retention backend, with support for nrf52840dk and qemu_cortex_m3 Upstream PR #: 93151 Signed-off-by: Jamie McCrae (cherry picked from commit c4b9f6bb2c57707514afb625843f737ec3a7e49e) --- .../subsys/settings/retention/CMakeLists.txt | 7 + .../boards/nrf52840dk_nrf52840.overlay | 39 ++++++ .../retention/boards/qemu_cortex_m3.overlay | 35 +++++ tests/subsys/settings/retention/prj.conf | 7 + .../settings/retention/src/CMakeLists.txt | 12 ++ tests/subsys/settings/retention/src/main.c | 130 ++++++++++++++++++ .../settings/retention/src/settings_test.h | 42 ++++++ tests/subsys/settings/retention/testcase.yaml | 9 ++ 8 files changed, 281 insertions(+) create mode 100644 tests/subsys/settings/retention/CMakeLists.txt create mode 100644 tests/subsys/settings/retention/boards/nrf52840dk_nrf52840.overlay create mode 100644 tests/subsys/settings/retention/boards/qemu_cortex_m3.overlay create mode 100644 tests/subsys/settings/retention/prj.conf create mode 100644 tests/subsys/settings/retention/src/CMakeLists.txt create mode 100644 tests/subsys/settings/retention/src/main.c create mode 100644 tests/subsys/settings/retention/src/settings_test.h create mode 100644 tests/subsys/settings/retention/testcase.yaml diff --git a/tests/subsys/settings/retention/CMakeLists.txt b/tests/subsys/settings/retention/CMakeLists.txt new file mode 100644 index 000000000000..315cbacf5947 --- /dev/null +++ b/tests/subsys/settings/retention/CMakeLists.txt @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(settings_retention) + +add_subdirectory(./src zms_test_bindir) diff --git a/tests/subsys/settings/retention/boards/nrf52840dk_nrf52840.overlay b/tests/subsys/settings/retention/boards/nrf52840dk_nrf52840.overlay new file mode 100644 index 000000000000..e7806a54b853 --- /dev/null +++ b/tests/subsys/settings/retention/boards/nrf52840dk_nrf52840.overlay @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + chosen { + /delete-property/ zephyr,boot-mode; + }; + + sram@2003F000 { + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0x2003F000 DT_SIZE_K(4)>; + zephyr,memory-region = "RetainedMem"; + status = "okay"; + + retainedmem { + compatible = "zephyr,retained-ram"; + status = "okay"; + #address-cells = <1>; + #size-cells = <1>; + + settings_partition0: settings_partition@0 { + compatible = "zephyr,retention"; + status = "okay"; + reg = <0x0 0x1000>; + }; + }; + }; + + chosen { + zephyr,settings-partition = &settings_partition0; + }; +}; + +&sram0 { + reg = <0x20000000 DT_SIZE_K(252)>; +}; diff --git a/tests/subsys/settings/retention/boards/qemu_cortex_m3.overlay b/tests/subsys/settings/retention/boards/qemu_cortex_m3.overlay new file mode 100644 index 000000000000..fe9bab6b727c --- /dev/null +++ b/tests/subsys/settings/retention/boards/qemu_cortex_m3.overlay @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + sram@2000F000 { + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0x2000F000 0x1000>; + zephyr,memory-region = "RetainedMem"; + status = "okay"; + + retainedmem { + compatible = "zephyr,retained-ram"; + status = "okay"; + #address-cells = <1>; + #size-cells = <1>; + + settings_partition0: settings_partition@0 { + compatible = "zephyr,retention"; + status = "okay"; + reg = <0x0 0x1000>; + }; + }; + }; + + chosen { + zephyr,settings-partition = &settings_partition0; + }; +}; + +&sram0 { + reg = <0x20000000 0xf000>; +}; diff --git a/tests/subsys/settings/retention/prj.conf b/tests/subsys/settings/retention/prj.conf new file mode 100644 index 000000000000..ae8afe82d746 --- /dev/null +++ b/tests/subsys/settings/retention/prj.conf @@ -0,0 +1,7 @@ +CONFIG_ZTEST=y +CONFIG_RETAINED_MEM=y +CONFIG_RETENTION=y + +CONFIG_SETTINGS=y +CONFIG_SETTINGS_RUNTIME=y +CONFIG_SETTINGS_RETENTION=y diff --git a/tests/subsys/settings/retention/src/CMakeLists.txt b/tests/subsys/settings/retention/src/CMakeLists.txt new file mode 100644 index 000000000000..b2897bddcf91 --- /dev/null +++ b/tests/subsys/settings/retention/src/CMakeLists.txt @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright (c) 2024 BayLibre SAS + +zephyr_include_directories( + ${ZEPHYR_BASE}/subsys/settings/include + ${ZEPHYR_BASE}/subsys/settings/src + ${ZEPHYR_BASE}/tests/subsys/settings/zms/src + ) + +target_sources(app PRIVATE main.c) + +add_subdirectory(../../src settings_test_bindir) diff --git a/tests/subsys/settings/retention/src/main.c b/tests/subsys/settings/retention/src/main.c new file mode 100644 index 000000000000..3673e0b9810a --- /dev/null +++ b/tests/subsys/settings/retention/src/main.c @@ -0,0 +1,130 @@ +/* + * Copyright (c) 2024 BayLibre SAS + * + * SPDX-License-Identifier: Apache-2.0 + */ +#include +#include + +#include "settings_priv.h" +#include "settings_test.h" + +uint8_t val8; +uint8_t val8_un; +uint32_t val32; +uint64_t val64; + +int test_get_called; +int test_set_called; +int test_commit_called; +int test_export_block; + +int c1_handle_get(const char *name, char *val, int val_len_max); +int c1_handle_set(const char *name, size_t len, settings_read_cb read_cb, void *cb_arg); +int c1_handle_commit(void); +int c1_handle_export(int (*cb)(const char *name, const void *value, size_t val_len)); + +struct settings_handler c_test_handlers[] = { + {.name = "myfoo", + .h_get = c1_handle_get, + .h_set = c1_handle_set, + .h_commit = c1_handle_commit, + .h_export = c1_handle_export}, +}; + +int c1_handle_get(const char *name, char *val, int val_len_max) +{ + const char *next; + + if (val_len_max < 0) { + return -EINVAL; + } + + test_get_called = 1; + + if (settings_name_steq(name, "mybar", &next) && !next) { + val_len_max = MIN(val_len_max, sizeof(val8)); + memcpy(val, &val8, MIN(val_len_max, sizeof(val8))); + return val_len_max; + } + + if (settings_name_steq(name, "mybar64", &next) && !next) { + val_len_max = MIN(val_len_max, sizeof(val64)); + memcpy(val, &val64, MIN(val_len_max, sizeof(val64))); + return val_len_max; + } + + return -ENOENT; +} + +int c1_handle_set(const char *name, size_t len, settings_read_cb read_cb, void *cb_arg) +{ + size_t val_len; + int rc; + const char *next; + + test_set_called = 1; + if (settings_name_steq(name, "mybar", &next) && !next) { + rc = read_cb(cb_arg, &val8, sizeof(val8)); + zassert_true(rc >= 0, "SETTINGS_VALUE_SET callback"); + return 0; + } + + if (settings_name_steq(name, "mybar64", &next) && !next) { + rc = read_cb(cb_arg, &val64, sizeof(val64)); + zassert_true(rc >= 0, "SETTINGS_VALUE_SET callback"); + return 0; + } + + if (settings_name_steq(name, "unaligned", &next) && !next) { + val_len = len; + zassert_equal(val_len, sizeof(val8_un), "value length: %zd, ought equal 1", + val_len); + rc = read_cb(cb_arg, &val8_un, sizeof(val8_un)); + zassert_true(rc >= 0, "SETTINGS_VALUE_SET callback"); + return 0; + } + + return -ENOENT; +} + +int c1_handle_commit(void) +{ + test_commit_called = 1; + return 0; +} + +int c1_handle_export(int (*cb)(const char *name, const void *value, size_t val_len)) +{ + if (test_export_block) { + return 0; + } + + (void)cb("myfoo/mybar", &val8, sizeof(val8)); + + (void)cb("myfoo/mybar64", &val64, sizeof(val64)); + + (void)cb("myfoo/unaligned", &val8_un, sizeof(val8_un)); + + return 0; +} + +void ctest_clear_call_state(void) +{ + test_get_called = 0; + test_set_called = 0; + test_commit_called = 0; +} + +int ctest_get_call_state(void) +{ + return test_get_called + test_set_called + test_commit_called; +} + +void config_wipe_srcs(void) +{ + sys_slist_init(&settings_load_srcs); + settings_save_dst = NULL; +} + +ZTEST_SUITE(settings_config, NULL, settings_config_setup, NULL, NULL, settings_config_teardown); diff --git a/tests/subsys/settings/retention/src/settings_test.h b/tests/subsys/settings/retention/src/settings_test.h new file mode 100644 index 000000000000..6a53260e1d44 --- /dev/null +++ b/tests/subsys/settings/retention/src/settings_test.h @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 BayLibre SAS + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef _SETTINGS_TEST_H +#define _SETTINGS_TEST_H + +#include +#include +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +extern uint8_t val8; +extern uint8_t val8_un; +extern uint32_t val32; +extern uint64_t val64; + +extern int test_get_called; +extern int test_set_called; +extern int test_commit_called; +extern int test_export_block; + +extern struct settings_handler c_test_handlers[]; + +void ctest_clear_call_state(void); +int ctest_get_call_state(void); + +void config_wipe_srcs(void); +void *settings_config_setup(void); +void settings_config_teardown(void *fixture); + +#ifdef __cplusplus +} +#endif +#endif /* _SETTINGS_TEST_H */ diff --git a/tests/subsys/settings/retention/testcase.yaml b/tests/subsys/settings/retention/testcase.yaml new file mode 100644 index 000000000000..adbd61e4701a --- /dev/null +++ b/tests/subsys/settings/retention/testcase.yaml @@ -0,0 +1,9 @@ +tests: + settings.retention: + platform_allow: + - nrf52840dk/nrf52840 + - qemu_cortex_m3 + min_ram: 8 + tags: + - settings + - retention From aca65d1339cb0f97bc41772e612f6972bca082bb Mon Sep 17 00:00:00 2001 From: Joakim Andersson Date: Fri, 4 Jul 2025 09:57:07 +0200 Subject: [PATCH 0205/2141] [nrf fromtree] cmake: kconfig: Add APP_DIR to kconfig environment Add APP_DIR as a kconfig environment variable. This is useful in cases where you want to set a config path relative to the directory of the application. An example of this is how many sysbuild.cmake files sets the source directory like this: ExternalZephyrProject_Add( APPLICATION remote SOURCE_DIR ${APP_DIR}/remote BOARD ${SB_CONFIG_REMOTE_BOARD} ) The same however cannot be done in Kconfig.sysbuild: config NETCORE_IMAGE_PATH default "${APP_DIR}/" if NETCORE_ABC Instead they must use ZEPHYR_MY_MODULE_MODULE_DIR, however not all applications are part of a zephyr module. Signed-off-by: Joakim Andersson (cherry picked from commit 12fdde6694e7a1be065d65c335aeadf7129e34bf) --- cmake/modules/kconfig.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmake/modules/kconfig.cmake b/cmake/modules/kconfig.cmake index 65b3bbb0382c..def17f16ae63 100644 --- a/cmake/modules/kconfig.cmake +++ b/cmake/modules/kconfig.cmake @@ -135,6 +135,9 @@ else() set(_local_TOOLCHAIN_HAS_PICOLIBC n) endif() +# APP_DIR: Path to the main image (sysbuild) or synonym for APPLICATION_SOURCE_DIR (non-sysbuild) +zephyr_get(APP_DIR VAR APP_DIR APPLICATION_SOURCE_DIR) + set(COMMON_KCONFIG_ENV_SETTINGS PYTHON_EXECUTABLE=${PYTHON_EXECUTABLE} srctree=${ZEPHYR_BASE} @@ -142,6 +145,7 @@ set(COMMON_KCONFIG_ENV_SETTINGS APPVERSION=${APP_VERSION_STRING} APP_VERSION_EXTENDED_STRING=${APP_VERSION_EXTENDED_STRING} APP_VERSION_TWEAK_STRING=${APP_VERSION_TWEAK_STRING} + APP_DIR=${APP_DIR} CONFIG_=${KCONFIG_NAMESPACE}_ KCONFIG_CONFIG=${DOTCONFIG} KCONFIG_BOARD_DIR=${KCONFIG_BOARD_DIR} From f53524cf05bca32d2ef8f243383309dfa3d5405b Mon Sep 17 00:00:00 2001 From: Adam Kondraciuk Date: Thu, 26 Jun 2025 15:39:25 +0200 Subject: [PATCH 0206/2141] [nrf fromlist] soc: nordic: nrf54h: s2ram: Add FPU retention Add FPU power management for suspend to RAM procedures. Add FPU save/restore procedures when `FPU_SHARING` feature is disabled. Upstream PR #: 92264 Signed-off-by: Adam Kondraciuk (cherry picked from commit 237ef2e9225a5130047a24f368650c279b676f0b) --- soc/nordic/nrf54h/pm_s2ram.c | 99 +++++++++++++++++++++++++++++++----- 1 file changed, 86 insertions(+), 13 deletions(-) diff --git a/soc/nordic/nrf54h/pm_s2ram.c b/soc/nordic/nrf54h/pm_s2ram.c index 1ec5da4aa199..c9be93ff5c9c 100644 --- a/soc/nordic/nrf54h/pm_s2ram.c +++ b/soc/nordic/nrf54h/pm_s2ram.c @@ -15,6 +15,13 @@ #define NVIC_MEMBER_SIZE(member) ARRAY_SIZE(((NVIC_Type *)0)->member) +/* Coprocessor Power Control Register Definitions */ +#define SCnSCB_CPPWR_SU11_Pos 22U /*!< CPPWR: SU11 Position */ +#define SCnSCB_CPPWR_SU11_Msk (1UL << SCnSCB_CPPWR_SU11_Pos) /*!< CPPWR: SU11 Mask */ + +#define SCnSCB_CPPWR_SU10_Pos 20U /*!< CPPWR: SU10 Position */ +#define SCnSCB_CPPWR_SU10_Msk (1UL << SCnSCB_CPPWR_SU10_Pos) /*!< CPPWR: SU10 Mask */ + /* Currently dynamic regions are only used in case of userspace or stack guard and * stack guard is not used by default on Cortex-M33 because there is a dedicated * mechanism for stack overflow detection. Unless those condition change we don't @@ -55,12 +62,25 @@ typedef struct { uint32_t MMFAR; uint32_t BFAR; uint32_t AFSR; + uint32_t CPACR; } _scb_context_t; +#if defined(CONFIG_FPU) && !defined(CONFIG_FPU_SHARING) +typedef struct { + uint32_t FPCCR; + uint32_t FPCAR; + uint32_t FPDSCR; + uint32_t S[32]; +} _fpu_context_t; +#endif + struct backup { _nvic_context_t nvic_context; _mpu_context_t mpu_context; _scb_context_t scb_context; +#if defined(CONFIG_FPU) && !defined(CONFIG_FPU_SHARING) + _fpu_context_t fpu_context; +#endif }; static __noinit struct backup backup_data; @@ -71,7 +91,7 @@ extern int z_arm_mpu_init(void); /* MPU registers cannot be simply copied because content of RBARx RLARx registers * depends on region which is selected by RNR register. */ -static void mpu_suspend(_mpu_context_t *backup) +static void mpu_save(_mpu_context_t *backup) { if (!MPU_USE_DYNAMIC_REGIONS) { return; @@ -89,7 +109,7 @@ static void mpu_suspend(_mpu_context_t *backup) backup->CTRL = MPU->CTRL; } -static void mpu_resume(_mpu_context_t *backup) +static void mpu_restore(_mpu_context_t *backup) { if (!MPU_USE_DYNAMIC_REGIONS) { z_arm_mpu_init(); @@ -111,21 +131,21 @@ static void mpu_resume(_mpu_context_t *backup) MPU->CTRL = backup->CTRL; } -static void nvic_suspend(_nvic_context_t *backup) +static void nvic_save(_nvic_context_t *backup) { memcpy(backup->ISER, (uint32_t *)NVIC->ISER, sizeof(NVIC->ISER)); memcpy(backup->ISPR, (uint32_t *)NVIC->ISPR, sizeof(NVIC->ISPR)); memcpy(backup->IPR, (uint32_t *)NVIC->IPR, sizeof(NVIC->IPR)); } -static void nvic_resume(_nvic_context_t *backup) +static void nvic_restore(_nvic_context_t *backup) { memcpy((uint32_t *)NVIC->ISER, backup->ISER, sizeof(NVIC->ISER)); memcpy((uint32_t *)NVIC->ISPR, backup->ISPR, sizeof(NVIC->ISPR)); memcpy((uint32_t *)NVIC->IPR, backup->IPR, sizeof(NVIC->IPR)); } -static void scb_suspend(_scb_context_t *backup) +static void scb_save(_scb_context_t *backup) { backup->ICSR = SCB->ICSR; backup->VTOR = SCB->VTOR; @@ -140,9 +160,10 @@ static void scb_suspend(_scb_context_t *backup) backup->MMFAR = SCB->MMFAR; backup->BFAR = SCB->BFAR; backup->AFSR = SCB->AFSR; + backup->CPACR = SCB->CPACR; } -static void scb_resume(_scb_context_t *backup) +static void scb_restore(_scb_context_t *backup) { SCB->ICSR = backup->ICSR; SCB->VTOR = backup->VTOR; @@ -157,25 +178,77 @@ static void scb_resume(_scb_context_t *backup) SCB->MMFAR = backup->MMFAR; SCB->BFAR = backup->BFAR; SCB->AFSR = backup->AFSR; + SCB->CPACR = backup->CPACR; +} + +#if defined(CONFIG_FPU) +static void fpu_power_down(void) +{ + SCB->CPACR &= (~(CPACR_CP10_Msk | CPACR_CP11_Msk)); + SCnSCB->CPPWR |= (SCnSCB_CPPWR_SU11_Msk | SCnSCB_CPPWR_SU10_Msk); + __DSB(); + __ISB(); +} + +static void fpu_power_up(void) +{ + SCnSCB->CPPWR &= (~(SCnSCB_CPPWR_SU11_Msk | SCnSCB_CPPWR_SU10_Msk)); + SCB->CPACR |= (CPACR_CP10_Msk | CPACR_CP11_Msk); + __DSB(); + __ISB(); +} + +#if !defined(CONFIG_FPU_SHARING) +static void fpu_save(_fpu_context_t *backup) +{ + backup->FPCCR = FPU->FPCCR; + backup->FPCAR = FPU->FPCAR; + backup->FPDSCR = FPU->FPDSCR; + + __asm__ volatile("vstmia %0, {s0-s31}\n" : : "r"(backup->S) : "memory"); +} + +static void fpu_restore(_fpu_context_t *backup) +{ + FPU->FPCCR = backup->FPCCR; + FPU->FPCAR = backup->FPCAR; + FPU->FPDSCR = backup->FPDSCR; + + __asm__ volatile("vldmia %0, {s0-s31}\n" : : "r"(backup->S) : "memory"); } +#endif /* !defined(CONFIG_FPU_SHARING) */ +#endif /* defined(CONFIG_FPU) */ int soc_s2ram_suspend(pm_s2ram_system_off_fn_t system_off) { int ret; - scb_suspend(&backup_data.scb_context); - nvic_suspend(&backup_data.nvic_context); - mpu_suspend(&backup_data.mpu_context); + scb_save(&backup_data.scb_context); +#if defined(CONFIG_FPU) +#if !defined(CONFIG_FPU_SHARING) + fpu_save(&backup_data.fpu_context); +#endif + fpu_power_down(); +#endif + nvic_save(&backup_data.nvic_context); + mpu_save(&backup_data.mpu_context); ret = arch_pm_s2ram_suspend(system_off); - /* Cache is powered down so power up is needed even if s2ram failed. */ + /* Cache and FPU are powered down so power up is needed even if s2ram failed. */ nrf_power_up_cache(); +#if defined(CONFIG_FPU) + fpu_power_up(); +#if !defined(CONFIG_FPU_SHARING) + /* Also the FPU content might be lost. */ + fpu_restore(&backup_data.fpu_context); +#endif +#endif if (ret < 0) { return ret; } - mpu_resume(&backup_data.mpu_context); - nvic_resume(&backup_data.nvic_context); - scb_resume(&backup_data.scb_context); + mpu_restore(&backup_data.mpu_context); + nvic_restore(&backup_data.nvic_context); + scb_restore(&backup_data.scb_context); return ret; } From 2241a25a0c4590dc1210be14e8f9c3553b1c09dd Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Mon, 14 Jul 2025 12:38:09 +0100 Subject: [PATCH 0207/2141] [nrf fromlist] boards: nordic: nrf54l15dk: Add button/LED aliases Adds aliases so that these devices can use MCUboot serial recovery Upstream PR #: 93090 Signed-off-by: Jamie McCrae (cherry picked from commit 587776675ddc6fbfe97e36eb5177130e38c826a0) --- boards/nordic/nrf54l15dk/nrf54l_05_10_15_cpuapp_common.dtsi | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/boards/nordic/nrf54l15dk/nrf54l_05_10_15_cpuapp_common.dtsi b/boards/nordic/nrf54l15dk/nrf54l_05_10_15_cpuapp_common.dtsi index 6962fc4b087f..46f9d797b61a 100644 --- a/boards/nordic/nrf54l15dk/nrf54l_05_10_15_cpuapp_common.dtsi +++ b/boards/nordic/nrf54l15dk/nrf54l_05_10_15_cpuapp_common.dtsi @@ -20,6 +20,11 @@ zephyr,ieee802154 = &ieee802154; zephyr,boot-mode = &boot_mode0; }; + + aliases { + mcuboot-button0 = &button0; + mcuboot-led0 = &led0; + }; }; &cpuapp_sram { From 31c3a0f03010aa84b972fa6711a409ff6c028b0d Mon Sep 17 00:00:00 2001 From: Tomi Fontanilles Date: Tue, 15 Jul 2025 15:12:35 +0300 Subject: [PATCH 0208/2141] [nrf fromlist] secure_storage: increase stack sizes of tests Certain implementations require more stack to operate. Increase the stack size to avoid overflows. Signed-off-by: Tomi Fontanilles Upstream PR #: 93147 Signed-off-by: Tomi Fontanilles (cherry picked from commit 0638daef5aa925f525751dffdeedf3bddf95ba3c) --- samples/psa/its/overlay-secure_storage.conf | 4 ++-- samples/psa/persistent_key/overlay-secure_storage.conf | 4 ++-- .../secure_storage/psa/crypto/overlay-secure_storage.conf | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/samples/psa/its/overlay-secure_storage.conf b/samples/psa/its/overlay-secure_storage.conf index 9265b38ccc7c..b3fcab84205f 100644 --- a/samples/psa/its/overlay-secure_storage.conf +++ b/samples/psa/its/overlay-secure_storage.conf @@ -3,9 +3,9 @@ CONFIG_MBEDTLS=y CONFIG_MBEDTLS_PSA_CRYPTO_C=y -# The default stack size (1024) is not enough for the PSA Crypto core. +# The default stack size is not enough for the PSA Crypto core. # On top of that, the ITS implementation uses the stack for buffers. -CONFIG_MAIN_STACK_SIZE=3072 +CONFIG_MAIN_STACK_SIZE=4096 CONFIG_SECURE_STORAGE=y CONFIG_SECURE_STORAGE_ITS_STORE_IMPLEMENTATION_SETTINGS=y diff --git a/samples/psa/persistent_key/overlay-secure_storage.conf b/samples/psa/persistent_key/overlay-secure_storage.conf index c5cff5f364ac..0b68451db29c 100644 --- a/samples/psa/persistent_key/overlay-secure_storage.conf +++ b/samples/psa/persistent_key/overlay-secure_storage.conf @@ -5,9 +5,9 @@ CONFIG_MBEDTLS_PSA_CRYPTO_C=y CONFIG_MBEDTLS_ENABLE_HEAP=y CONFIG_MBEDTLS_HEAP_SIZE=1024 -# The default stack size (1024) is not enough for the PSA Crypto core. +# The default stack size is not enough for the PSA Crypto core. # On top of that, the ITS implementation uses the stack for buffers. -CONFIG_MAIN_STACK_SIZE=3072 +CONFIG_MAIN_STACK_SIZE=4096 CONFIG_SECURE_STORAGE=y CONFIG_SECURE_STORAGE_ITS_STORE_IMPLEMENTATION_SETTINGS=y diff --git a/tests/subsys/secure_storage/psa/crypto/overlay-secure_storage.conf b/tests/subsys/secure_storage/psa/crypto/overlay-secure_storage.conf index 6df091015bed..97594a4ac445 100644 --- a/tests/subsys/secure_storage/psa/crypto/overlay-secure_storage.conf +++ b/tests/subsys/secure_storage/psa/crypto/overlay-secure_storage.conf @@ -1,5 +1,5 @@ -CONFIG_ZTEST_STACK_SIZE=3072 -CONFIG_MAIN_STACK_SIZE=2048 +CONFIG_ZTEST_STACK_SIZE=4096 +CONFIG_MAIN_STACK_SIZE=3072 CONFIG_MBEDTLS=y CONFIG_ENTROPY_GENERATOR=y From df96a8e0ac8f959d8f60fbc640ed6dcbbda77079 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Mon, 31 Mar 2025 13:41:18 +0200 Subject: [PATCH 0209/2141] [nrf fromlist] drivers: timer: nrf_grtc_timer: Optimize to reduce register access MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Speed up execution of the interrupt handler and sys_clock_set_timeout(). Sys_clock_set_timeout() can be called in two scenarios: from previous timeout expiration handler or freely. If the former case fast path can be used since CC value in the GRTC register just expired and it can be used as a reference for CCADD setting. This is only a single register write so it's much faster. In the latter a longer procedure is applied which also happens in two variants. If value which is set in CC is further in the future (e.g. K_FOREVER was set before) then CC can be safely overwritten with a new value without a risk of triggering unexpected COMPARE event. If value in CC is earlier than the new CC value (if earlier timeout was aborted) then there is a risk of COMPARE event happening while it is being overwritten. That case requires long and safer procedure of setting CC. Update hal_nordic with changes in the nrfx_grtc driver which are needed for nrf_grtc_timer changes. Upstream PR #: 87944 Signed-off-by: Krzysztof Chruściński (cherry picked from commit 8cba1f6198f880ce025d6f69625e42cdfdb0d4d0) --- drivers/timer/nrf_grtc_timer.c | 94 +++++++++++++++++++++++----------- 1 file changed, 63 insertions(+), 31 deletions(-) diff --git a/drivers/timer/nrf_grtc_timer.c b/drivers/timer/nrf_grtc_timer.c index 2809d8b3d608..43f6e8e97caa 100644 --- a/drivers/timer/nrf_grtc_timer.c +++ b/drivers/timer/nrf_grtc_timer.c @@ -49,21 +49,27 @@ #define COUNTER_SPAN (GRTC_SYSCOUNTERL_VALUE_Msk | ((uint64_t)GRTC_SYSCOUNTERH_VALUE_Msk << 32)) #define MAX_ABS_TICKS (COUNTER_SPAN / CYC_PER_TICK) -#define MAX_TICKS \ - (((COUNTER_SPAN / CYC_PER_TICK) > INT_MAX) ? INT_MAX : (COUNTER_SPAN / CYC_PER_TICK)) - -#define MAX_CYCLES (MAX_TICKS * CYC_PER_TICK) +/* To allow use of CCADD we need to limit max cycles to 31 bits. */ +#define MAX_REL_CYCLES BIT_MASK(31) +#define MAX_REL_TICKS (MAX_REL_CYCLES / CYC_PER_TICK) #define LFCLK_FREQUENCY_HZ DT_PROP(LFCLK_NODE, clock_frequency) +/* Threshold used to determine if there is a risk of unexpected GRTC COMPARE event coming + * from previous CC value. + */ +#define LATENCY_THR_TICKS 200 + #if defined(CONFIG_TEST) const int32_t z_sys_timer_irq_for_test = DT_IRQN(GRTC_NODE); #endif static void sys_clock_timeout_handler(int32_t id, uint64_t cc_val, void *p_context); -static struct k_spinlock lock; static uint64_t last_count; /* Time (SYSCOUNTER value) @last sys_clock_announce() */ +static uint32_t last_elapsed; +static uint64_t cc_value; /* Value that is expected to be in CC register. */ +static uint64_t expired_cc; /* Value that is expected to be in CC register. */ static atomic_t int_mask; static uint8_t ext_channels_allocated; static uint64_t grtc_start_value; @@ -146,17 +152,13 @@ static void compare_int_unlock(int32_t chan, bool key) static void sys_clock_timeout_handler(int32_t id, uint64_t cc_val, void *p_context) { ARG_UNUSED(id); + ARG_UNUSED(cc_val); ARG_UNUSED(p_context); - uint64_t dticks; - uint64_t now = counter(); - - if (unlikely(now < cc_val)) { - return; - } + uint32_t dticks; dticks = counter_sub(cc_val, last_count) / CYC_PER_TICK; - - last_count += dticks * CYC_PER_TICK; + last_count += (dticks * CYC_PER_TICK); + expired_cc = cc_val; if (!IS_ENABLED(CONFIG_TICKLESS_KERNEL)) { /* protection is not needed because we are in the GRTC interrupt @@ -165,6 +167,7 @@ static void sys_clock_timeout_handler(int32_t id, uint64_t cc_val, void *p_conte system_timeout_set_abs(last_count + CYC_PER_TICK); } + last_elapsed = 0; sys_clock_announce((int32_t)dticks); } @@ -368,6 +371,7 @@ uint64_t z_nrf_grtc_timer_startup_value_get(void) int z_nrf_grtc_wakeup_prepare(uint64_t wake_time_us) { nrfx_err_t err_code; + static struct k_spinlock lock; static uint8_t systemoff_channel; uint64_t now = counter(); nrfx_grtc_sleep_config_t sleep_cfg; @@ -430,20 +434,12 @@ int z_nrf_grtc_wakeup_prepare(uint64_t wake_time_us) uint32_t sys_clock_cycle_get_32(void) { - k_spinlock_key_t key = k_spin_lock(&lock); - uint32_t ret = (uint32_t)counter(); - - k_spin_unlock(&lock, key); - return ret; + return nrf_grtc_sys_counter_low_get(NRF_GRTC); } uint64_t sys_clock_cycle_get_64(void) { - k_spinlock_key_t key = k_spin_lock(&lock); - uint64_t ret = counter(); - - k_spin_unlock(&lock, key); - return ret; + return counter(); } uint32_t sys_clock_elapsed(void) @@ -452,7 +448,9 @@ uint32_t sys_clock_elapsed(void) return 0; } - return (uint32_t)(counter_sub(counter(), last_count) / CYC_PER_TICK); + last_elapsed = (uint32_t)counter_sub(counter(), last_count); + + return last_elapsed / CYC_PER_TICK; } static int sys_clock_driver_init(void) @@ -493,6 +491,10 @@ static int sys_clock_driver_init(void) last_count = (counter() / CYC_PER_TICK) * CYC_PER_TICK; grtc_start_value = last_count; + expired_cc = UINT64_MAX; + nrfx_grtc_channel_callback_set(system_clock_channel_data.channel, + sys_clock_timeout_handler, NULL); + int_mask = NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK; if (!IS_ENABLED(CONFIG_TICKLESS_KERNEL)) { system_timeout_set_relative(CYC_PER_TICK); @@ -551,18 +553,48 @@ void sys_clock_set_timeout(int32_t ticks, bool idle) return; } - ticks = (ticks == K_TICKS_FOREVER) ? MAX_TICKS : MIN(MAX_TICKS, MAX(ticks, 0)); + uint32_t ch = system_clock_channel_data.channel; + + if ((cc_value == expired_cc) && (ticks < MAX_REL_TICKS)) { + uint32_t cyc = ticks * CYC_PER_TICK; + + if (cyc == 0) { + /* GRTC will expire anyway since HW ensures that past value triggers an + * event but we need to ensure to always progress the cc_value as this + * if condition expects that cc_value will change after each call to + * set_timeout function. + */ + cyc = 1; + } - uint64_t delta_time = ticks * CYC_PER_TICK; + /* If it's the first timeout setting after previous expiration and timeout + * is short so fast method can be used which utilizes relative CC configuration. + */ + cc_value += cyc; + nrfx_grtc_syscounter_cc_rel_set(ch, cyc, NRFX_GRTC_CC_RELATIVE_COMPARE); + return; + } - uint64_t target_time = counter() + delta_time; + uint64_t cyc = (uint64_t)ticks * CYC_PER_TICK; + bool safe_setting = false; + int64_t prev_cc_val = cc_value; - /* Rounded down target_time to the tick boundary - * (but not less than one tick after the last) + cc_value = last_count + last_elapsed + cyc; + + /* In case of timeout abort it may happen that CC is being set to a value + * that later than previous CC. If previous CC value is not far in the + * future, there is a risk that COMPARE event will be triggered for that + * previous CC value. If there is such risk safe procedure must be applied + * which is more time consuming but ensures that there will be no spurious + * event. */ - target_time = MAX((target_time - last_count)/CYC_PER_TICK, 1)*CYC_PER_TICK + last_count; + if (prev_cc_val < cc_value) { + int64_t now = last_count + last_elapsed; + + safe_setting = (prev_cc_val - now) < LATENCY_THR_TICKS; + } - system_timeout_set_abs(target_time); + nrfx_grtc_syscounter_cc_abs_set(ch, cc_value, safe_setting); } #if defined(CONFIG_NRF_GRTC_TIMER_APP_DEFINED_INIT) From e76c1955413736a44380ff0e304b053834d18456 Mon Sep 17 00:00:00 2001 From: Ravi Dondaputi Date: Mon, 14 Jul 2025 17:05:09 +0530 Subject: [PATCH 0210/2141] [nrf fromlist] snippets: wifi-enterprise: Increase MBEDTLS heap size With NRF security, higher heap requirement is seen for operating with RSA-3072 based certificates. Add a NRF SoC specific conf in snippets to handle this. Upstream PR #: 93096 Signed-off-by: Ravi Dondaputi (cherry picked from commit fefd6d0c51a223868bc15175b355f3f072eb2c5e) --- snippets/wifi-enterprise/snippet.yml | 5 +++++ snippets/wifi-enterprise/wifi-enterprise-nrf.conf | 3 +++ 2 files changed, 8 insertions(+) create mode 100644 snippets/wifi-enterprise/wifi-enterprise-nrf.conf diff --git a/snippets/wifi-enterprise/snippet.yml b/snippets/wifi-enterprise/snippet.yml index 6a4f73d38b42..f88b23ec2a4d 100644 --- a/snippets/wifi-enterprise/snippet.yml +++ b/snippets/wifi-enterprise/snippet.yml @@ -1,3 +1,8 @@ name: wifi-enterprise append: EXTRA_CONF_FILE: wifi-enterprise.conf + +boards: + /.*/nrf.*/cpuapp/: + append: + EXTRA_CONF_FILE: wifi-enterprise-nrf.conf diff --git a/snippets/wifi-enterprise/wifi-enterprise-nrf.conf b/snippets/wifi-enterprise/wifi-enterprise-nrf.conf new file mode 100644 index 000000000000..a52390c1687c --- /dev/null +++ b/snippets/wifi-enterprise/wifi-enterprise-nrf.conf @@ -0,0 +1,3 @@ +# For TLS and X.509 processing MbedTLS needs large heap size and using separate heap +# for MbedTLS gives us more control over the heap size. +CONFIG_MBEDTLS_HEAP_SIZE=75000 From 3aaa9ad1615befbde020a5545c33e12788d4cf53 Mon Sep 17 00:00:00 2001 From: Ravi Dondaputi Date: Mon, 14 Jul 2025 17:14:29 +0530 Subject: [PATCH 0211/2141] [nrf fromlist] samples: net: wifi: Add AES-only certificates Add AES-only cipher certificates. Useful for systems which have only AES support and DES is not enabled. Upstream PR #: 93096 Signed-off-by: Ravi Dondaputi (cherry picked from commit 7d10cc215fbf7b47ec4975326b2119341c5f876f) --- .../net/wifi/test_certs/rsa2k_no_des/ca.pem | 24 +++++++++++++++ .../net/wifi/test_certs/rsa2k_no_des/ca2.pem | 24 +++++++++++++++ .../test_certs/rsa2k_no_des/client-key.pem | 30 +++++++++++++++++++ .../test_certs/rsa2k_no_des/client-key2.pem | 30 +++++++++++++++++++ .../wifi/test_certs/rsa2k_no_des/client.pem | 22 ++++++++++++++ .../wifi/test_certs/rsa2k_no_des/client2.pem | 22 ++++++++++++++ .../test_certs/rsa2k_no_des/server-key.pem | 30 +++++++++++++++++++ .../wifi/test_certs/rsa2k_no_des/server.pem | 22 ++++++++++++++ 8 files changed, 204 insertions(+) create mode 100644 samples/net/wifi/test_certs/rsa2k_no_des/ca.pem create mode 100644 samples/net/wifi/test_certs/rsa2k_no_des/ca2.pem create mode 100644 samples/net/wifi/test_certs/rsa2k_no_des/client-key.pem create mode 100644 samples/net/wifi/test_certs/rsa2k_no_des/client-key2.pem create mode 100644 samples/net/wifi/test_certs/rsa2k_no_des/client.pem create mode 100644 samples/net/wifi/test_certs/rsa2k_no_des/client2.pem create mode 100644 samples/net/wifi/test_certs/rsa2k_no_des/server-key.pem create mode 100644 samples/net/wifi/test_certs/rsa2k_no_des/server.pem diff --git a/samples/net/wifi/test_certs/rsa2k_no_des/ca.pem b/samples/net/wifi/test_certs/rsa2k_no_des/ca.pem new file mode 100644 index 000000000000..2b872d2e30da --- /dev/null +++ b/samples/net/wifi/test_certs/rsa2k_no_des/ca.pem @@ -0,0 +1,24 @@ +-----BEGIN CERTIFICATE----- +MIIEBzCCAu+gAwIBAgIUK8+d+8IOzeX+DP3VSvdF3lHiCdcwDQYJKoZIhvcNAQEL +BQAwgZIxCzAJBgNVBAYTAkZSMQ8wDQYDVQQIDAZSYWRpdXMxEjAQBgNVBAcMCVNv +bWV3aGVyZTEUMBIGA1UECgwLRXhhbXBsZSBJbmMxJjAkBgNVBAMMHUV4YW1wbGUg +Q2VydGlmaWNhdGUgQXV0aG9yaXR5MSAwHgYJKoZIhvcNAQkBFhFhZG1pbkBleGFt +cGxlLm9yZzAeFw0yNDEwMDgxMDI0MDZaFw0zNDEwMDYxMDI0MDZaMIGSMQswCQYD +VQQGEwJGUjEPMA0GA1UECAwGUmFkaXVzMRIwEAYDVQQHDAlTb21ld2hlcmUxFDAS +BgNVBAoMC0V4YW1wbGUgSW5jMSYwJAYDVQQDDB1FeGFtcGxlIENlcnRpZmljYXRl +IEF1dGhvcml0eTEgMB4GCSqGSIb3DQEJARYRYWRtaW5AZXhhbXBsZS5vcmcwggEi +MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCWKIwjdRIp9IrpZELN/ZsN13Xj +qQI6n086PNJ7BZfLi0+tD164rmxFk2eukNNksFCPhvMkqUxouGhc4mJjeivvrZxR +oT3cblOQIkkdEci6iTKC2E1a20W/Ur7cTXoIsnKwjiUjXk+cujkrZu4fcHX+O4vy +wTd5tEbhmifT/4u5nN8U2vBcEZqkGHOCp30VZSxtlGwqp4lc+tVziF3uFViW9MXk +3bVt+s1E7ztwG7+WBgVlLYe3CNSWkMxfyYBafH/l7iep6AFjoTn1z3AAjYi7IUNN +0JkW8MTgafRQIu4QsV5luq/Tiar2vwAm/GNgUJdSzUKARsfQzb/XTIgnLQqtAgMB +AAGjUzBRMB0GA1UdDgQWBBSijSC03/Thi6EOdM91V33zsbQpgzAfBgNVHSMEGDAW +gBSijSC03/Thi6EOdM91V33zsbQpgzAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3 +DQEBCwUAA4IBAQAvKEfmCDoMTKC6bfP6DSs+MSAGc5tCr6w6cz2AKNJ2fOMhkq55 +JF47oBBGm9SdTB6Jqo6c109Ps69/+LMtEEGwvzL0RL0WAuTYGo6sudm9hj/jDHZh +pAqi/2BQQeVgTa6oW0jtNPFe+/cobXo9TJ7wECGrhvVbmfl5ZPc0YVOIjjR0/LhL +q7lqPAlJ5vx0WvsX+QReN97we8vD0x1D3mCySJTi3Irh+grE0yJOSN2fa7cyqi9+ +vSiNUB1eUgQwrO+S8ZazYNvAZXC2Xf4WB4SOifJD73pYPAdwOejc0FA+zfEKa/6/ +vTUs8cIhlmDWO+BEoc9wygMKMmhT5s7/T5Bv +-----END CERTIFICATE----- diff --git a/samples/net/wifi/test_certs/rsa2k_no_des/ca2.pem b/samples/net/wifi/test_certs/rsa2k_no_des/ca2.pem new file mode 100644 index 000000000000..2b872d2e30da --- /dev/null +++ b/samples/net/wifi/test_certs/rsa2k_no_des/ca2.pem @@ -0,0 +1,24 @@ +-----BEGIN CERTIFICATE----- +MIIEBzCCAu+gAwIBAgIUK8+d+8IOzeX+DP3VSvdF3lHiCdcwDQYJKoZIhvcNAQEL +BQAwgZIxCzAJBgNVBAYTAkZSMQ8wDQYDVQQIDAZSYWRpdXMxEjAQBgNVBAcMCVNv +bWV3aGVyZTEUMBIGA1UECgwLRXhhbXBsZSBJbmMxJjAkBgNVBAMMHUV4YW1wbGUg +Q2VydGlmaWNhdGUgQXV0aG9yaXR5MSAwHgYJKoZIhvcNAQkBFhFhZG1pbkBleGFt +cGxlLm9yZzAeFw0yNDEwMDgxMDI0MDZaFw0zNDEwMDYxMDI0MDZaMIGSMQswCQYD +VQQGEwJGUjEPMA0GA1UECAwGUmFkaXVzMRIwEAYDVQQHDAlTb21ld2hlcmUxFDAS +BgNVBAoMC0V4YW1wbGUgSW5jMSYwJAYDVQQDDB1FeGFtcGxlIENlcnRpZmljYXRl +IEF1dGhvcml0eTEgMB4GCSqGSIb3DQEJARYRYWRtaW5AZXhhbXBsZS5vcmcwggEi +MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCWKIwjdRIp9IrpZELN/ZsN13Xj +qQI6n086PNJ7BZfLi0+tD164rmxFk2eukNNksFCPhvMkqUxouGhc4mJjeivvrZxR +oT3cblOQIkkdEci6iTKC2E1a20W/Ur7cTXoIsnKwjiUjXk+cujkrZu4fcHX+O4vy +wTd5tEbhmifT/4u5nN8U2vBcEZqkGHOCp30VZSxtlGwqp4lc+tVziF3uFViW9MXk +3bVt+s1E7ztwG7+WBgVlLYe3CNSWkMxfyYBafH/l7iep6AFjoTn1z3AAjYi7IUNN +0JkW8MTgafRQIu4QsV5luq/Tiar2vwAm/GNgUJdSzUKARsfQzb/XTIgnLQqtAgMB +AAGjUzBRMB0GA1UdDgQWBBSijSC03/Thi6EOdM91V33zsbQpgzAfBgNVHSMEGDAW +gBSijSC03/Thi6EOdM91V33zsbQpgzAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3 +DQEBCwUAA4IBAQAvKEfmCDoMTKC6bfP6DSs+MSAGc5tCr6w6cz2AKNJ2fOMhkq55 +JF47oBBGm9SdTB6Jqo6c109Ps69/+LMtEEGwvzL0RL0WAuTYGo6sudm9hj/jDHZh +pAqi/2BQQeVgTa6oW0jtNPFe+/cobXo9TJ7wECGrhvVbmfl5ZPc0YVOIjjR0/LhL +q7lqPAlJ5vx0WvsX+QReN97we8vD0x1D3mCySJTi3Irh+grE0yJOSN2fa7cyqi9+ +vSiNUB1eUgQwrO+S8ZazYNvAZXC2Xf4WB4SOifJD73pYPAdwOejc0FA+zfEKa/6/ +vTUs8cIhlmDWO+BEoc9wygMKMmhT5s7/T5Bv +-----END CERTIFICATE----- diff --git a/samples/net/wifi/test_certs/rsa2k_no_des/client-key.pem b/samples/net/wifi/test_certs/rsa2k_no_des/client-key.pem new file mode 100644 index 000000000000..6ab70da24524 --- /dev/null +++ b/samples/net/wifi/test_certs/rsa2k_no_des/client-key.pem @@ -0,0 +1,30 @@ +-----BEGIN ENCRYPTED PRIVATE KEY----- +MIIFLTBXBgkqhkiG9w0BBQ0wSjApBgkqhkiG9w0BBQwwHAQILVdWyEWhWU0CAggA +MAwGCCqGSIb3DQIJBQAwHQYJYIZIAWUDBAEqBBDMFReIusCg7gSkoUQZV2flBIIE +0BIFQH7+0dc7wHIQQ1y0ao90rrK3ExtCABH6xp4OAHUNPR1549zSEak/9Ba6WLBp +YE0m/lpLz4oUJE4Kd3rg4ekSZk4mapZoW7g5ax4qAEblmM6rqmyjiU0Q6tsAb8n1 +x+RyjUILlgTH1HDmeNA53QNMCw++xIMIJPN29SvFN6vkU2Fd2f74/TuZRSaCEPLO +LKtNMwWCMTrlv0UewEryOvZegPQuEF/Ewmmw/9l5VfkPp6zAtZKzWsfk4jUo5tv2 +5dPoHR+RKjNNVwetnCq59QYMS2My6KLqX4Vzqnbu8K1nlbm85ZHnvLGi8cDn8EB7 +QtRL+Ev5IwcwYJgV5AMojouJLQdR655jeITWI1Gsohz28YG8c1qYX4ZN6albSd1G +fd1tMOWkeu4uEzJ7ijLDfnCzrklnLuAZx8yLzyrOa7i9AwwJmdgUEdbWWsru3L6C +zDJ45rpA0FobdlTem4kpoE9yiyHkIhf3wmI3X+0aodC11pdbHP260KIC8E1K9FUh +s/IoEQCYrBp8UltNTlezwq/E5uOuIu4EpfjEgH1Z3+hSDbnmMAXNX4DbL234x7iy +3Y256DtOeHSElnRz3kDnZVNtM1Kd5fgEYJ1ptYRPYaWyJka7/hC/0UObuM9w+QeO +OlG0QgumQFloyhDa9anPBK4sYJp4g1fK8golUDW4AdpFPNOJvvgOvQUzhPpHjr+N +lpZ75Y6I3JSSKJ/UMlSCOqjak8oZtMtJNMfbx1lgwwDtgjDSJvSdl735gI9VmXXH +qnlGEtyiQ7k1Z1a4HxiY2/CiDHvkymClir/Ik8gt+wmyT9c/9BcehLRf6PxMsDVy +PCkty1LlzN+5tSZJtJnOiTlgsRn/w49Ohp74ITheSdb30/6PnFI+o8rcJHmrjN4d +t3z/bCyWAeC8mS7m0wtXlyBeG9xvdyT8dDHAFOnqxX30dEwEbjNj58kWGAgRf9i3 +HlOAP8yRy7LAV7A4HEPnEzXBxYpsROUw/8d3Jtmr2nAp2hfKP339DYZPHZpRLjJr +WQlJasHHLxHKKjSsuM06WsCO+Tt2FTSgGJuU6nFVK75fssmmJYzj9qMHVM6YSjfY +sT0ZIWRgO9NLFx5O3QxY1wgMLhhv1FREy9NVnMU0W3A1u0F7dwHywZGha2IqEXgu ++UyWIJnePMvluV/s66AN/OpIxKU48c0B4l7XzXkHHd43tDUG3ztfRuPbWCHipuRO +eo+vHGD01iBLSE1ZhrYLHKQhJvIKx/PIEaqJHP/Vy35AD/2/GH09TiIBHzX9aXie +TiKFs30FQv7SpLNHNE7jUxsYGNUbYa70S/Vgn3wkKATcXpCc749XQV4OUbFoqkDm +vuZOjkIOlm/OtZkUuDWmk96mgoVG/gWSEJPynJHUpmWdu/BCdYOgxBk/bmPa1leS +Z5NbO0fGMnNhDMXYA5rqmVzABcNSYhgYw5aciWpBlgYHEYrPxZvCxWftIyb24oEk +wdHEaFbIYbOoVZqo7Ym2hrvVrJb8Qdukf1BmUgfSSSc7BFoSrBUO4SNFtZI55NOB +OM4rnkqfoYR0IpnxzPIpxpsWljG9QsgnTaffStDgIGXiAtBWJFy+44f1IS4EoC6B ++we1Q6atPwYSyPtG8mn4Ce0BNxLDUoFDLMQ7Bt8QBMeX +-----END ENCRYPTED PRIVATE KEY----- diff --git a/samples/net/wifi/test_certs/rsa2k_no_des/client-key2.pem b/samples/net/wifi/test_certs/rsa2k_no_des/client-key2.pem new file mode 100644 index 000000000000..6ab70da24524 --- /dev/null +++ b/samples/net/wifi/test_certs/rsa2k_no_des/client-key2.pem @@ -0,0 +1,30 @@ +-----BEGIN ENCRYPTED PRIVATE KEY----- +MIIFLTBXBgkqhkiG9w0BBQ0wSjApBgkqhkiG9w0BBQwwHAQILVdWyEWhWU0CAggA +MAwGCCqGSIb3DQIJBQAwHQYJYIZIAWUDBAEqBBDMFReIusCg7gSkoUQZV2flBIIE +0BIFQH7+0dc7wHIQQ1y0ao90rrK3ExtCABH6xp4OAHUNPR1549zSEak/9Ba6WLBp +YE0m/lpLz4oUJE4Kd3rg4ekSZk4mapZoW7g5ax4qAEblmM6rqmyjiU0Q6tsAb8n1 +x+RyjUILlgTH1HDmeNA53QNMCw++xIMIJPN29SvFN6vkU2Fd2f74/TuZRSaCEPLO +LKtNMwWCMTrlv0UewEryOvZegPQuEF/Ewmmw/9l5VfkPp6zAtZKzWsfk4jUo5tv2 +5dPoHR+RKjNNVwetnCq59QYMS2My6KLqX4Vzqnbu8K1nlbm85ZHnvLGi8cDn8EB7 +QtRL+Ev5IwcwYJgV5AMojouJLQdR655jeITWI1Gsohz28YG8c1qYX4ZN6albSd1G +fd1tMOWkeu4uEzJ7ijLDfnCzrklnLuAZx8yLzyrOa7i9AwwJmdgUEdbWWsru3L6C +zDJ45rpA0FobdlTem4kpoE9yiyHkIhf3wmI3X+0aodC11pdbHP260KIC8E1K9FUh +s/IoEQCYrBp8UltNTlezwq/E5uOuIu4EpfjEgH1Z3+hSDbnmMAXNX4DbL234x7iy +3Y256DtOeHSElnRz3kDnZVNtM1Kd5fgEYJ1ptYRPYaWyJka7/hC/0UObuM9w+QeO +OlG0QgumQFloyhDa9anPBK4sYJp4g1fK8golUDW4AdpFPNOJvvgOvQUzhPpHjr+N +lpZ75Y6I3JSSKJ/UMlSCOqjak8oZtMtJNMfbx1lgwwDtgjDSJvSdl735gI9VmXXH +qnlGEtyiQ7k1Z1a4HxiY2/CiDHvkymClir/Ik8gt+wmyT9c/9BcehLRf6PxMsDVy +PCkty1LlzN+5tSZJtJnOiTlgsRn/w49Ohp74ITheSdb30/6PnFI+o8rcJHmrjN4d +t3z/bCyWAeC8mS7m0wtXlyBeG9xvdyT8dDHAFOnqxX30dEwEbjNj58kWGAgRf9i3 +HlOAP8yRy7LAV7A4HEPnEzXBxYpsROUw/8d3Jtmr2nAp2hfKP339DYZPHZpRLjJr +WQlJasHHLxHKKjSsuM06WsCO+Tt2FTSgGJuU6nFVK75fssmmJYzj9qMHVM6YSjfY +sT0ZIWRgO9NLFx5O3QxY1wgMLhhv1FREy9NVnMU0W3A1u0F7dwHywZGha2IqEXgu ++UyWIJnePMvluV/s66AN/OpIxKU48c0B4l7XzXkHHd43tDUG3ztfRuPbWCHipuRO +eo+vHGD01iBLSE1ZhrYLHKQhJvIKx/PIEaqJHP/Vy35AD/2/GH09TiIBHzX9aXie +TiKFs30FQv7SpLNHNE7jUxsYGNUbYa70S/Vgn3wkKATcXpCc749XQV4OUbFoqkDm +vuZOjkIOlm/OtZkUuDWmk96mgoVG/gWSEJPynJHUpmWdu/BCdYOgxBk/bmPa1leS +Z5NbO0fGMnNhDMXYA5rqmVzABcNSYhgYw5aciWpBlgYHEYrPxZvCxWftIyb24oEk +wdHEaFbIYbOoVZqo7Ym2hrvVrJb8Qdukf1BmUgfSSSc7BFoSrBUO4SNFtZI55NOB +OM4rnkqfoYR0IpnxzPIpxpsWljG9QsgnTaffStDgIGXiAtBWJFy+44f1IS4EoC6B ++we1Q6atPwYSyPtG8mn4Ce0BNxLDUoFDLMQ7Bt8QBMeX +-----END ENCRYPTED PRIVATE KEY----- diff --git a/samples/net/wifi/test_certs/rsa2k_no_des/client.pem b/samples/net/wifi/test_certs/rsa2k_no_des/client.pem new file mode 100644 index 000000000000..9e815474cd8d --- /dev/null +++ b/samples/net/wifi/test_certs/rsa2k_no_des/client.pem @@ -0,0 +1,22 @@ +-----BEGIN CERTIFICATE----- +MIIDojCCAooCFGZ4UJXBKG70aewILFtsy4mbvaYZMA0GCSqGSIb3DQEBCwUAMIGS +MQswCQYDVQQGEwJGUjEPMA0GA1UECAwGUmFkaXVzMRIwEAYDVQQHDAlTb21ld2hl +cmUxFDASBgNVBAoMC0V4YW1wbGUgSW5jMSYwJAYDVQQDDB1FeGFtcGxlIENlcnRp +ZmljYXRlIEF1dGhvcml0eTEgMB4GCSqGSIb3DQEJARYRYWRtaW5AZXhhbXBsZS5v +cmcwHhcNMjQxMDA4MTAyNjI1WhcNMzQxMDA2MTAyNjI1WjCBhzELMAkGA1UEBhMC +RlIxDzANBgNVBAgMBlJhZGl1czESMBAGA1UEBwwJU29tZXdoZXJlMRQwEgYDVQQK +DAtFeGFtcGxlIEluYzEbMBkGA1UEAwwSY2xpZW50LmV4YW1wbGUub3JnMSAwHgYJ +KoZIhvcNAQkBFhFhZG1pbkBleGFtcGxlLm9yZzCCASIwDQYJKoZIhvcNAQEBBQAD +ggEPADCCAQoCggEBAMu3HXJvi2Q4hQnLL4v/sCyEr5x+ZtBcSi2yETMViaf2EStW +UOs1A1pmCQbO7nadLQcWaX4tzefQCRrs1X4hIQuDIqRPNi6h6G1g5HEtqBWZhvwu +hDbmFiX8/Vtw/P0/9sox2DzyLG0mjJUAYAbKtyC1kQalybVBtrSaazyyAyh6oOuU +chAb7SmmNDsRB959TWM/mp+6yCcFGzCDKNBwlwthB6Uw92d3SfOyXEnZm8rPf0hV +4ICL5iB+xEYBv1LKmznFK/4UAyKpxAygc5fxKVWwlSsq8MrES5ak0n6H71wViaXK +BrH5yh9jEkK9XSeaUwg8C9eOOexyx/5JDY3TTE8CAwEAATANBgkqhkiG9w0BAQsF +AAOCAQEAUNddNiRUlJH0acJJv8ztXNWjNewd17tAk1BBHp6yyGAD8b52p6QbDAdS +xO3WsSc2bqSy599jp4GshO27TMQsBRMfoggCG21Aj6sIs0Hd4shTE4T0GUBEBxC2 +/HReuD+cGIzzKMYlvK8RPSaGLPvPw5SryvmOnjD368V0KCHwT04Z14i4sMxlkd5q +wB7fxTkVla9MR4uWObX62mJykmqT86chScJpldtBpRh8wrEa3Gt9FZoi/eqP0De8 +oCxmCZDrozGTZ4IIaNzchx3Ensh1RQwvvxd6ATerYdUjq4V2TlTksDRdCXtj+uNJ +FnB32sUHiIouxudAsqDf8UL9/99RCw== +-----END CERTIFICATE----- diff --git a/samples/net/wifi/test_certs/rsa2k_no_des/client2.pem b/samples/net/wifi/test_certs/rsa2k_no_des/client2.pem new file mode 100644 index 000000000000..9e815474cd8d --- /dev/null +++ b/samples/net/wifi/test_certs/rsa2k_no_des/client2.pem @@ -0,0 +1,22 @@ +-----BEGIN CERTIFICATE----- +MIIDojCCAooCFGZ4UJXBKG70aewILFtsy4mbvaYZMA0GCSqGSIb3DQEBCwUAMIGS +MQswCQYDVQQGEwJGUjEPMA0GA1UECAwGUmFkaXVzMRIwEAYDVQQHDAlTb21ld2hl +cmUxFDASBgNVBAoMC0V4YW1wbGUgSW5jMSYwJAYDVQQDDB1FeGFtcGxlIENlcnRp +ZmljYXRlIEF1dGhvcml0eTEgMB4GCSqGSIb3DQEJARYRYWRtaW5AZXhhbXBsZS5v +cmcwHhcNMjQxMDA4MTAyNjI1WhcNMzQxMDA2MTAyNjI1WjCBhzELMAkGA1UEBhMC +RlIxDzANBgNVBAgMBlJhZGl1czESMBAGA1UEBwwJU29tZXdoZXJlMRQwEgYDVQQK +DAtFeGFtcGxlIEluYzEbMBkGA1UEAwwSY2xpZW50LmV4YW1wbGUub3JnMSAwHgYJ +KoZIhvcNAQkBFhFhZG1pbkBleGFtcGxlLm9yZzCCASIwDQYJKoZIhvcNAQEBBQAD +ggEPADCCAQoCggEBAMu3HXJvi2Q4hQnLL4v/sCyEr5x+ZtBcSi2yETMViaf2EStW +UOs1A1pmCQbO7nadLQcWaX4tzefQCRrs1X4hIQuDIqRPNi6h6G1g5HEtqBWZhvwu +hDbmFiX8/Vtw/P0/9sox2DzyLG0mjJUAYAbKtyC1kQalybVBtrSaazyyAyh6oOuU +chAb7SmmNDsRB959TWM/mp+6yCcFGzCDKNBwlwthB6Uw92d3SfOyXEnZm8rPf0hV +4ICL5iB+xEYBv1LKmznFK/4UAyKpxAygc5fxKVWwlSsq8MrES5ak0n6H71wViaXK +BrH5yh9jEkK9XSeaUwg8C9eOOexyx/5JDY3TTE8CAwEAATANBgkqhkiG9w0BAQsF +AAOCAQEAUNddNiRUlJH0acJJv8ztXNWjNewd17tAk1BBHp6yyGAD8b52p6QbDAdS +xO3WsSc2bqSy599jp4GshO27TMQsBRMfoggCG21Aj6sIs0Hd4shTE4T0GUBEBxC2 +/HReuD+cGIzzKMYlvK8RPSaGLPvPw5SryvmOnjD368V0KCHwT04Z14i4sMxlkd5q +wB7fxTkVla9MR4uWObX62mJykmqT86chScJpldtBpRh8wrEa3Gt9FZoi/eqP0De8 +oCxmCZDrozGTZ4IIaNzchx3Ensh1RQwvvxd6ATerYdUjq4V2TlTksDRdCXtj+uNJ +FnB32sUHiIouxudAsqDf8UL9/99RCw== +-----END CERTIFICATE----- diff --git a/samples/net/wifi/test_certs/rsa2k_no_des/server-key.pem b/samples/net/wifi/test_certs/rsa2k_no_des/server-key.pem new file mode 100644 index 000000000000..5f032cad701d --- /dev/null +++ b/samples/net/wifi/test_certs/rsa2k_no_des/server-key.pem @@ -0,0 +1,30 @@ +-----BEGIN ENCRYPTED PRIVATE KEY----- +MIIFLTBXBgkqhkiG9w0BBQ0wSjApBgkqhkiG9w0BBQwwHAQIjI78fcZSH7oCAggA +MAwGCCqGSIb3DQIJBQAwHQYJYIZIAWUDBAEqBBDfF676hRrL290F0MgMDZiuBIIE +0Hkz7skRV8Ox0SoX5N8GsOPfN4PS1cLyHgokY6dUhJPU5vUzOn9iSiGQSEzSguQ7 +11mssjRC2T45wB/95VK2EPtRw1f/6VOUR6RJnnGb0PV1Rydp/x5TZ6vzcXpakqly +eljJR/20fIJClsZzhw0iu5la9fkF6G8WYFEkqex5jALSiN4qVLvkiqcTnh5+amem +8+OCKgvgooKD2ids4/0GGfJRQSC6DFf3kuxNl+MMvmDXmz/vrD85ONnyXzKXDA3N +3vRgL/YT6GzwIXb+7/c/tIMpnacxPAdbNOs3DY5ss4xcK68L5PwpM2BljzBa5dGw +Smgf2VRaYRVzmrte5j280QjfrlHRU2cHaxm0GCu2AOTGwMXcSNYMXfDNuxc57oQJ +vHXMeZD4K5lACbhYdZ5lJNFvv29YI7dZ7QOGu6nXlAuhZfbdc/cgT0som7eG8xpT +pERllhQ5ych9sP9nAccN6VUsWgmlF73lbSptBek1ccYkp9LIYCteJUPl2qPcz6zl +A7zrZ54f3Lg0fOm2pCtg+qKBiw1nd3MR/YbRCgyvudyZE2cCN/ZspWqxsavbGYOz +JOfIFNnyAcOYtEv1n1BGLfMa1THW2bDV8XmHVHUtM0k4z250QAmLygWLY2166iUF +qotBkvctKKdulzGdT4nVer1UEKTqcxhDf0dRiHN5spZtFrOee0uGIoQWHt2oecaK +pJovW+i0qO/1DG5spfU2m1bz6jR2u6nxi340oRrMSoe1ELVg3l1/wmM8yzh07GuK +pshzxwqAG/FnaKCvcKGUG2EfnAvOcbMgSa2w3GvyRkcDPn00arvX9nuXj0gkRDBi +eoVMkKKTeeYSGQ4ik+ja3xkgHcxh5W8aoezLvBbmUq206cmhLwfnYMhnvFTs6EBK +E0ENpCHwF/qoVBIzRCijG/eeCuf3a1YkJsWlvEeVrPeOmDFeDft3SSGOzHxE2A/7 +HWmHbWTm7dPOfgsU4zf+HglnBjN3kYU7StyM0EGxmB4lfB2BiWiL/3R13ERHQZfa +oOqa4/hOFXOXfTQk6ufXtBx8L9BemBqh36zbs2xVvIizJKeRMruoRblWZkHhUKR8 +K5GA7FYkU9ZPPP0UPKsO94xzwfbevi+7nWeUZoqcqAUy8Jt5aD2QpvFVbPBBOz17 +PGaubeVn/Ry8swPvkpddtmJ4mgF+3SVctmzY+EE/oN1XS8wa+XeuaThzk89Lvrfa +606nRWrNw3PSKjYoEEtRLhPeJCi9uOVenbOjtclio9mV5Sugwurolczvq8DAGpMG +W4WgALgOWDjQAudiNH5dtcMGkBONbYywkJc7cT2OZFmzkCbchPPWlKGopuaFGAoU +SPj7C9SenHmOWAFRX5jJrOZAuVqkdKN3ShWZUL+cDkOCCQlZ0E31u0m9yozY1MeO +Sx42GtZaSGff37FGYeMZM2ztlutw2zmv2B1g52SBHTjCqQU/ud2Q6/U0kUzjbsdF +/0KQY9wgZRdOvbnA2lBirN1rXzLWPdduOZ5QImfHfvToN+oOlEqVvvWG12DdA4e5 +y4Dumx00lfKEsGutjF3oKgE6jsjwqAwCoYEAFHTtsvA0hKPisQwNHZmpjGARvR56 +yMEmXynKvgyVGvVP2a9VdqBXSpstL24HfDIu+nlyEWGQ +-----END ENCRYPTED PRIVATE KEY----- diff --git a/samples/net/wifi/test_certs/rsa2k_no_des/server.pem b/samples/net/wifi/test_certs/rsa2k_no_des/server.pem new file mode 100644 index 000000000000..d8f82faf6dd3 --- /dev/null +++ b/samples/net/wifi/test_certs/rsa2k_no_des/server.pem @@ -0,0 +1,22 @@ +-----BEGIN CERTIFICATE----- +MIIDojCCAooCFCPQcj7ej5jhr6/mLlAoLYgfgsYcMA0GCSqGSIb3DQEBCwUAMIGS +MQswCQYDVQQGEwJGUjEPMA0GA1UECAwGUmFkaXVzMRIwEAYDVQQHDAlTb21ld2hl +cmUxFDASBgNVBAoMC0V4YW1wbGUgSW5jMSYwJAYDVQQDDB1FeGFtcGxlIENlcnRp +ZmljYXRlIEF1dGhvcml0eTEgMB4GCSqGSIb3DQEJARYRYWRtaW5AZXhhbXBsZS5v +cmcwHhcNMjQxMDA4MTAyNTI5WhcNMzQxMDA2MTAyNTI5WjCBhzELMAkGA1UEBhMC +RlIxDzANBgNVBAgMBlJhZGl1czESMBAGA1UEBwwJU29tZXdoZXJlMRQwEgYDVQQK +DAtFeGFtcGxlIEluYzEbMBkGA1UEAwwSc2VydmVyLmV4YW1wbGUub3JnMSAwHgYJ +KoZIhvcNAQkBFhFhZG1pbkBleGFtcGxlLm9yZzCCASIwDQYJKoZIhvcNAQEBBQAD +ggEPADCCAQoCggEBANcE/OPHQK/y1b6UsIktNK7WIZB528HECY7Bz18EGba0uHod +91RbzHSJ1qI3iQyldI1UW/kY5oYjBW3lhLH0BkD/EsqvNYCV+3YzAM3ITtdOdEU9 +CqjgXttehQHfXvc7jQlF8Q2gYPUz2dDLo/gcTkz1d+mCr6nQUjT8Kq/nG54T0NnD +k8udchjUlNaQsvx/WVs3TUYxMbWzQRtpJIbv99rAWq7YgQbkNZnSYC1VgrU/BiuQ +0KrP6rfkxvBCGwIh2JXIL3FV4N8AsgGZvjXQ3zXKXwuPhxWdSmjKWlioVM3mha2A +/1e1gX6nFY/uk46D60XWxcJ6tHGHoafU7EtN3zMCAwEAATANBgkqhkiG9w0BAQsF +AAOCAQEAWwdTMphD0jxLtYO0iq/+fMtq2R96ZUN9wprZ7qg1evUNQjqLR4jKX306 +ZJX5uw+6r5Ve/k368qvcSF/sSfvBm8yd3JcegTl5t8T2/Aks8o3sfyuS0uyJC1rS +zTrd7FmJG9YMosU1BqYobda64MXq7g+6MyrQoZ6fVdPvC6Sox3+a4fl9xjdm4CTY +MsWqBJMe26LptvRIJ01/B6PjVTvsn/fxxj7rHmnJ/j63AIiBntm0vV/85cwYy/4o +HlPH/Qjvn3hZjUlBcveiYat998F+s9gH2usvCkG3kly/n1/667LLCymmCHxtH8ka +7tF3siO1EANureFY8qj6ZvlKeTkZ6g== +-----END CERTIFICATE----- From e505b90960f1a45ba0c5579b75f24ae7afadf7c3 Mon Sep 17 00:00:00 2001 From: Ravi Dondaputi Date: Wed, 16 Jul 2025 15:50:15 +0530 Subject: [PATCH 0212/2141] [nrf fromlist] snippets: wifi-enterprise: Store certificates in Protected storage Add config options required for storing certificates in protected storage, and to free up space of ROM to accommodate the additional features that are enabled for TFM. Upstream PR #: 93096 Signed-off-by: Ravi Dondaputi (cherry picked from commit 5c199816110c84be905f3d0fcf3b243a967a669c) --- snippets/wifi-enterprise/snippet.yml | 3 +++ snippets/wifi-enterprise/wifi-enterprise-nrf-ns.conf | 8 ++++++++ 2 files changed, 11 insertions(+) create mode 100644 snippets/wifi-enterprise/wifi-enterprise-nrf-ns.conf diff --git a/snippets/wifi-enterprise/snippet.yml b/snippets/wifi-enterprise/snippet.yml index f88b23ec2a4d..ae2fbd2953b5 100644 --- a/snippets/wifi-enterprise/snippet.yml +++ b/snippets/wifi-enterprise/snippet.yml @@ -6,3 +6,6 @@ boards: /.*/nrf.*/cpuapp/: append: EXTRA_CONF_FILE: wifi-enterprise-nrf.conf + /.*/nrf.*/cpuapp/ns/: + append: + EXTRA_CONF_FILE: wifi-enterprise-nrf-ns.conf diff --git a/snippets/wifi-enterprise/wifi-enterprise-nrf-ns.conf b/snippets/wifi-enterprise/wifi-enterprise-nrf-ns.conf new file mode 100644 index 000000000000..dd33192d180d --- /dev/null +++ b/snippets/wifi-enterprise/wifi-enterprise-nrf-ns.conf @@ -0,0 +1,8 @@ +# For TLS and X.509 processing MbedTLS needs large heap size and using separate heap +# for MbedTLS gives us more control over the heap size. +CONFIG_MBEDTLS_HEAP_SIZE=75000 +CONFIG_LTO=y +CONFIG_ISR_TABLES_LOCAL_DECLARATION=y +CONFIG_WIFI_CREDENTIALS_RUNTIME_CERTIFICATES=y +CONFIG_WIFI_SHELL_RUNTIME_CERTIFICATES=y +CONFIG_TLS_CREDENTIALS_BACKEND_PROTECTED_STORAGE=y From ebd81dcf098e1183990fe999e32135d932ef3886 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Mon, 16 Jun 2025 20:40:22 +0200 Subject: [PATCH 0213/2141] [nrf fromtree] drivers: nrf_wifi: put driver ops in flash MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add const qualifiers to the driver ops to save on RAM usage. Signed-off-by: Benjamin Cabé (cherry picked from commit 8d6316c5b70dc3923c5a187152c4fd014718d41b) --- drivers/wifi/nrf_wifi/src/fmac_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/wifi/nrf_wifi/src/fmac_main.c b/drivers/wifi/nrf_wifi/src/fmac_main.c index b218bc13adde..72055fb02993 100644 --- a/drivers/wifi/nrf_wifi/src/fmac_main.c +++ b/drivers/wifi/nrf_wifi/src/fmac_main.c @@ -852,7 +852,7 @@ static int nrf_wifi_drv_main_zep(const struct device *dev) #ifndef CONFIG_NRF70_RADIO_TEST #ifdef CONFIG_NET_L2_WIFI_MGMT -static struct wifi_mgmt_ops nrf_wifi_mgmt_ops = { +static const struct wifi_mgmt_ops nrf_wifi_mgmt_ops = { .scan = nrf_wifi_disp_scan_zep, #ifdef CONFIG_NET_STATISTICS_WIFI .get_stats = nrf_wifi_stats_get, @@ -881,7 +881,7 @@ static struct wifi_mgmt_ops nrf_wifi_mgmt_ops = { #ifdef CONFIG_NRF70_STA_MODE -static struct zep_wpa_supp_dev_ops wpa_supp_ops = { +static const struct zep_wpa_supp_dev_ops wpa_supp_ops = { .init = nrf_wifi_wpa_supp_dev_init, .deinit = nrf_wifi_wpa_supp_dev_deinit, .scan2 = nrf_wifi_wpa_supp_scan2, From fd5e07f6c0f095b358d6f07bf80c035eb91c8297 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Tue, 17 Jun 2025 22:01:04 +0530 Subject: [PATCH 0214/2141] [nrf fromtree] modules: nrf_wifi: Improve power down sequence Swap the order, IOVDD should be powered first and then BUCKEN. Signed-off-by: Chaitanya Tata (cherry picked from commit 9cd933e5b010bd76ac5a2f17b23cef00a861ad44) --- modules/nrf_wifi/bus/rpu_hw_if.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/nrf_wifi/bus/rpu_hw_if.c b/modules/nrf_wifi/bus/rpu_hw_if.c index 5dd71a86de2b..62291251fb78 100644 --- a/modules/nrf_wifi/bus/rpu_hw_if.c +++ b/modules/nrf_wifi/bus/rpu_hw_if.c @@ -260,15 +260,15 @@ static int rpu_pwroff(void) { int ret; - ret = gpio_pin_set_dt(&bucken_spec, 0); /* BUCKEN = 0 */ + ret = gpio_pin_set_dt(&iovdd_ctrl_spec, 0); /* IOVDD CNTRL = 0 */ if (ret) { - LOG_ERR("BUCKEN GPIO set failed..."); + LOG_ERR("IOVDD GPIO set failed..."); return ret; } - ret = gpio_pin_set_dt(&iovdd_ctrl_spec, 0); /* IOVDD CNTRL = 0 */ + ret = gpio_pin_set_dt(&bucken_spec, 0); /* BUCKEN = 0 */ if (ret) { - LOG_ERR("IOVDD GPIO set failed..."); + LOG_ERR("BUCKEN GPIO set failed..."); return ret; } From 06422b585b9a49a79b012ed04a5c5f43b6ff6024 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Tue, 17 Jun 2025 22:06:06 +0530 Subject: [PATCH 0215/2141] [nrf fromtree] modules: nrf_wifi: Remove co-ex GPIOs first Before powering off remove co-ex GPIOs. Signed-off-by: Chaitanya Tata (cherry picked from commit 2b0876c850017f95c92d472daed616b9ac49d7c7) --- modules/nrf_wifi/bus/rpu_hw_if.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/modules/nrf_wifi/bus/rpu_hw_if.c b/modules/nrf_wifi/bus/rpu_hw_if.c index 62291251fb78..39525211486b 100644 --- a/modules/nrf_wifi/bus/rpu_hw_if.c +++ b/modules/nrf_wifi/bus/rpu_hw_if.c @@ -503,21 +503,23 @@ int rpu_disable(void) { int ret; - ret = rpu_pwroff(); + #ifdef CONFIG_NRF70_SR_COEX_RF_SWITCH + ret = sr_gpio_remove(); if (ret) { goto out; } - ret = rpu_gpio_remove(); +#endif + + ret = rpu_pwroff(); if (ret) { goto out; } - -#ifdef CONFIG_NRF70_SR_COEX_RF_SWITCH - ret = sr_gpio_remove(); + ret = rpu_gpio_remove(); if (ret) { goto out; } -#endif + + qdev = NULL; cfg = NULL; From 80ca34db0140ea6a6d251ee5b84f043792c20851 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Tue, 17 Jun 2025 22:12:13 +0530 Subject: [PATCH 0216/2141] [nrf fromtree] modules: nrf_wifi: Implement QSPI deinit By default QSPI is uninitialized after every transaction, so, deinit is a no-op, but if QSPI_LOW_POWER is disabled, then we need to uninitialize the QSPI in the deinit. Signed-off-by: Chaitanya Tata (cherry picked from commit 4eb7b9f06bdb1daba8d0638e62abfb1a65fb343e) --- modules/nrf_wifi/bus/qspi_if.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/modules/nrf_wifi/bus/qspi_if.c b/modules/nrf_wifi/bus/qspi_if.c index 6107a5c4157f..ad0534a95a37 100644 --- a/modules/nrf_wifi/bus/qspi_if.c +++ b/modules/nrf_wifi/bus/qspi_if.c @@ -528,14 +528,10 @@ static int qspi_device_init(const struct device *dev) return ret; } -static void qspi_device_uninit(const struct device *dev) +static void _qspi_device_uninit(const struct device *dev) { bool last = true; - if (!IS_ENABLED(CONFIG_NRF70_QSPI_LOW_POWER)) { - return; - } - qspi_lock(dev); #ifdef CONFIG_MULTITHREADING @@ -568,6 +564,15 @@ static void qspi_device_uninit(const struct device *dev) qspi_unlock(dev); } +static void qspi_device_uninit(const struct device *dev) +{ + if (!IS_ENABLED(CONFIG_NRF70_QSPI_LOW_POWER)) { + return; + } + + _qspi_device_uninit(dev); +} + /* QSPI send custom command. * * If this is used for both send and receive the buffer sizes must be @@ -1191,7 +1196,7 @@ struct device qspi_perip = { int qspi_deinit(void) { - LOG_DBG("TODO : %s", __func__); + _qspi_device_uninit(&qspi_perip); return 0; } From c9c0f975aa75d7756b3b9d6ebffa8ac9107e0521 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Tue, 17 Jun 2025 22:17:11 +0530 Subject: [PATCH 0217/2141] [nrf fromtree] modules: nrf_wifi: Implement SPI deinit Release the SPI during the deinit to put respective GPIOs in low-power state or disconnected. Signed-off-by: Chaitanya Tata (cherry picked from commit 945ddf0acbafa6e0bca3fc145e0a39a408903546) --- modules/nrf_wifi/bus/spi_if.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/modules/nrf_wifi/bus/spi_if.c b/modules/nrf_wifi/bus/spi_if.c index 7ef1694da58b..641e1322899f 100644 --- a/modules/nrf_wifi/bus/spi_if.c +++ b/modules/nrf_wifi/bus/spi_if.c @@ -263,9 +263,7 @@ int spim_init(struct qspi_config *config) int spim_deinit(void) { - LOG_DBG("TODO : %s", __func__); - - return 0; + return spi_release_dt(&spi_spec); } static void spim_addr_check(unsigned int addr, const void *data, unsigned int len) From b0e4801ac20650a9c73b8ec11bf4ae097b4449b1 Mon Sep 17 00:00:00 2001 From: Ravi Dondaputi Date: Tue, 25 Mar 2025 17:03:43 +0530 Subject: [PATCH 0218/2141] [nrf fromtree] drivers: wifi: Introduce option to use K_HEAP Provide option to revert to K_HEAP instead of using dedicated heaps in Wi-Fi driver. Signed-off-by: Ravi Dondaputi (cherry picked from commit 11a39692218c7c0a6a0222c3b0066b7e6c515f84) --- drivers/wifi/nrf_wifi/Kconfig.nrfwifi | 16 ++++++++++++++++ modules/nrf_wifi/os/shim.c | 24 ++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/drivers/wifi/nrf_wifi/Kconfig.nrfwifi b/drivers/wifi/nrf_wifi/Kconfig.nrfwifi index 8980cce82052..bfc1ce0c7f08 100644 --- a/drivers/wifi/nrf_wifi/Kconfig.nrfwifi +++ b/drivers/wifi/nrf_wifi/Kconfig.nrfwifi @@ -570,6 +570,21 @@ config NRF70_RSSI_STALE_TIMEOUT_MS value as the driver does not store it and requires RPU to provide the information. +config NRF_WIFI_GLOBAL_HEAP + bool "Use Zephyr kernel heap for Wi-Fi driver" + depends on KERNEL_MEM_POOL && ((HEAP_MEM_POOL_SIZE > 0) || HEAP_MEM_POOL_IGNORE_MIN) + help + Enable this option to use K_HEAP for memory allocations in Wi-Fi driver. + +if NRF_WIFI_GLOBAL_HEAP +config HEAP_MEM_POOL_ADD_SIZE_NRF70 + # Use a maximum that works for typical use cases and boards, each sample/app can override + # this value if needed by using CONFIG_HEAP_MEM_POOL_IGNORE_MIN + def_int 25000 if NRF70_SCAN_ONLY + def_int 150000 +endif # NRF_WIFI_GLOBAL_HEAP + +if !NRF_WIFI_GLOBAL_HEAP config NRF_WIFI_CTRL_HEAP_SIZE int "Dedicated memory pool for control plane" default 20000 @@ -580,6 +595,7 @@ config NRF_WIFI_DATA_HEAP_SIZE default 8000 if NRF70_SCAN_ONLY default 110000 if !SOC_FAMILY_NORDIC_NRF default 130000 +endif if NETWORKING # Finetune defaults for certain system components used by the driver diff --git a/modules/nrf_wifi/os/shim.c b/modules/nrf_wifi/os/shim.c index 29b72203b552..14107f139288 100644 --- a/modules/nrf_wifi/os/shim.c +++ b/modules/nrf_wifi/os/shim.c @@ -33,6 +33,8 @@ #include "common/hal_structs_common.h" LOG_MODULE_REGISTER(wifi_nrf, CONFIG_WIFI_NRF70_LOG_LEVEL); + +#if !defined(CONFIG_NRF_WIFI_GLOBAL_HEAP) #if defined(CONFIG_NOCACHE_MEMORY) K_HEAP_DEFINE_NOCACHE(wifi_drv_ctrl_mem_pool, CONFIG_NRF_WIFI_CTRL_HEAP_SIZE); K_HEAP_DEFINE_NOCACHE(wifi_drv_data_mem_pool, CONFIG_NRF_WIFI_DATA_HEAP_SIZE); @@ -40,6 +42,8 @@ K_HEAP_DEFINE_NOCACHE(wifi_drv_data_mem_pool, CONFIG_NRF_WIFI_DATA_HEAP_SIZE); K_HEAP_DEFINE(wifi_drv_ctrl_mem_pool, CONFIG_NRF_WIFI_CTRL_HEAP_SIZE); K_HEAP_DEFINE(wifi_drv_data_mem_pool, CONFIG_NRF_WIFI_DATA_HEAP_SIZE); #endif /* CONFIG_NOCACHE_MEMORY */ +#endif /* CONFIG_NRF_WIFI_GLOBAL_HEAP */ + #define WORD_SIZE 4 struct zep_shim_intr_priv *intr_priv; @@ -48,14 +52,22 @@ static void *zep_shim_mem_alloc(size_t size) { size_t size_aligned = ROUND_UP(size, 4); +#if defined(CONFIG_NRF_WIFI_GLOBAL_HEAP) + return k_malloc(size_aligned); +#else /* CONFIG_NRF_WIFI_GLOBAL_HEAP */ return k_heap_aligned_alloc(&wifi_drv_ctrl_mem_pool, WORD_SIZE, size_aligned, K_FOREVER); +#endif /* CONFIG_NRF_WIFI_GLOBAL_HEAP */ } static void *zep_shim_data_mem_alloc(size_t size) { size_t size_aligned = ROUND_UP(size, 4); +#if defined(CONFIG_NRF_WIFI_GLOBAL_HEAP) + return k_malloc(size_aligned); +#else /* CONFIG_NRF_WIFI_GLOBAL_HEAP */ return k_heap_aligned_alloc(&wifi_drv_data_mem_pool, WORD_SIZE, size_aligned, K_FOREVER); +#endif /* CONFIG_NRF_WIFI_GLOBAL_HEAP */ } static void *zep_shim_mem_zalloc(size_t size) @@ -99,14 +111,22 @@ static void *zep_shim_data_mem_zalloc(size_t size) static void zep_shim_mem_free(void *buf) { if (buf) { +#if defined(CONFIG_NRF_WIFI_GLOBAL_HEAP) + k_free(buf); +#else /* CONFIG_NRF_WIFI_GLOBAL_HEAP */ k_heap_free(&wifi_drv_ctrl_mem_pool, buf); +#endif /* CONFIG_NRF_WIFI_GLOBAL_HEAP */ } } static void zep_shim_data_mem_free(void *buf) { if (buf) { +#if defined(CONFIG_NRF_WIFI_GLOBAL_HEAP) + k_free(buf); +#else /* CONFIG_NRF_WIFI_GLOBAL_HEAP */ k_heap_free(&wifi_drv_data_mem_pool, buf); +#endif /* CONFIG_NRF_WIFI_GLOBAL_HEAP */ } } @@ -197,7 +217,11 @@ static void *zep_shim_spinlock_alloc(void) static void zep_shim_spinlock_free(void *lock) { +#if defined(CONFIG_NRF_WIFI_GLOBAL_HEAP) + k_free(lock); +#else /* CONFIG_NRF_WIFI_GLOBAL_HEAP */ k_heap_free(&wifi_drv_ctrl_mem_pool, lock); +#endif /* CONFIG_NRF_WIFI_GLOBAL_HEAP */ } static void zep_shim_spinlock_init(void *lock) From d6054d8c397d181d900c59373e0e261ad8eca41a Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Tue, 1 Jul 2025 03:24:00 +0530 Subject: [PATCH 0219/2141] [nrf fromtree] modules: nrf_wifi: Fix interface down hang When QSPI LPM is enabled, QSPI will already be uninitialized, and during deinit if uninitialized is being called again then it leads to a hang as it waits for mem busy check to pass which it won't. Fix by checking if the device is initialized before calling uninitialize. Signed-off-by: Chaitanya Tata (cherry picked from commit 1fb2c56e86f2518b67ed56bae1736396afd791c6) --- modules/nrf_wifi/bus/qspi_if.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/nrf_wifi/bus/qspi_if.c b/modules/nrf_wifi/bus/qspi_if.c index ad0534a95a37..949aa591274a 100644 --- a/modules/nrf_wifi/bus/qspi_if.c +++ b/modules/nrf_wifi/bus/qspi_if.c @@ -1196,7 +1196,9 @@ struct device qspi_perip = { int qspi_deinit(void) { - _qspi_device_uninit(&qspi_perip); + if (nrfx_qspi_init_check()) { + _qspi_device_uninit(&qspi_perip); + } return 0; } From b14fd1f61249852f0d2c8e2b07dc2126bad24e76 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Sun, 29 Jun 2025 20:58:44 +0530 Subject: [PATCH 0220/2141] [nrf fromtree] modules: nrf_wifi: Fix accuracy of microseconds API Using ms and converting to us is a bad idea as we still get ms granualrity in us units. Use the proper API to get us granularity. Signed-off-by: Chaitanya Tata (cherry picked from commit 54573e2a678e607a1367438637bddc0d0ced66ee) --- modules/nrf_wifi/os/shim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/nrf_wifi/os/shim.c b/modules/nrf_wifi/os/shim.c index 14107f139288..df460d5ab53e 100644 --- a/modules/nrf_wifi/os/shim.c +++ b/modules/nrf_wifi/os/shim.c @@ -854,7 +854,7 @@ static void zep_shim_work_kill(void *item) static unsigned long zep_shim_time_get_curr_us(void) { - return k_uptime_get() * USEC_PER_MSEC; + return k_ticks_to_us_floor64(k_uptime_ticks()); } static unsigned int zep_shim_time_elapsed_us(unsigned long start_time_us) From c237966b7fbacfaaa7e584492b0e720c5cb19ef0 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Sun, 29 Jun 2025 22:48:43 +0530 Subject: [PATCH 0221/2141] [nrf fromtree] wifi: nrf70: Fix system work queue stack size override Defaults cannot be overidden (even with configdefault extension), they only work if the original symbol is defined after the override e.g., "drivers and then subsys/net" but for kernel symbols,the default value overrides don't work due "kernel and drivers" order, the kernel defines the original symbol with the default and then it cannot be overridden. Move the kernel symbol override to the original definition to make it affect. Else any sample that uses nRF70 but doesn't enable WPA supplicant ends up with 1024 and crashes. Signed-off-by: Chaitanya Tata (cherry picked from commit 4bd1d39c67dfb4860fbd4f9ccc17e084aa32d763) --- drivers/wifi/nrf_wifi/Kconfig.nrfwifi | 6 ++---- kernel/Kconfig | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/wifi/nrf_wifi/Kconfig.nrfwifi b/drivers/wifi/nrf_wifi/Kconfig.nrfwifi index bfc1ce0c7f08..8d414276038e 100644 --- a/drivers/wifi/nrf_wifi/Kconfig.nrfwifi +++ b/drivers/wifi/nrf_wifi/Kconfig.nrfwifi @@ -599,10 +599,8 @@ endif if NETWORKING # Finetune defaults for certain system components used by the driver - -config SYSTEM_WORKQUEUE_STACK_SIZE - default 4096 - +# Note: These will take effect only if the symbol is not defined already +# (i.e., the original symbol is processed after "drivers/Kconfig") config NET_TX_STACK_SIZE default 4096 diff --git a/kernel/Kconfig b/kernel/Kconfig index 536a6624f522..838d44afbf9e 100644 --- a/kernel/Kconfig +++ b/kernel/Kconfig @@ -577,7 +577,7 @@ rsource "Kconfig.obj_core" menu "System Work Queue Options" config SYSTEM_WORKQUEUE_STACK_SIZE int "System workqueue stack size" - default 4096 if COVERAGE_GCOV + default 4096 if COVERAGE_GCOV || WIFI_NRF70 default 2560 if WIFI_NM_WPA_SUPPLICANT default 1024 From 1aa5abe53df33898e935d99ce5b905a07144aacf Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Fri, 4 Jul 2025 00:34:36 +0530 Subject: [PATCH 0222/2141] [nrf fromtree] drivers: nrf_wifi: Fix TX drop statistics In case FMAC API fails, increment the TX drop counter, helpful in debug. Signed-off-by: Chaitanya Tata (cherry picked from commit e728f804165e9f8ceb578af2b632aabe530828d7) --- drivers/wifi/nrf_wifi/src/net_if.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/wifi/nrf_wifi/src/net_if.c b/drivers/wifi/nrf_wifi/src/net_if.c index 19101fab442e..9108a0dab3b2 100644 --- a/drivers/wifi/nrf_wifi/src/net_if.c +++ b/drivers/wifi/nrf_wifi/src/net_if.c @@ -429,6 +429,10 @@ int nrf_wifi_if_send(const struct device *dev, #ifdef CONFIG_NRF70_RAW_DATA_TX } #endif /* CONFIG_NRF70_RAW_DATA_TX */ + if (ret == NRF_WIFI_STATUS_FAIL) { + /* FMAC API takes care of freeing the nbuf */ + host_stats->total_tx_drop_pkts++; + } goto unlock; drop: if (host_stats != NULL) { From 2e97bb1307104ce40f56aefac27eacd17a6105ce Mon Sep 17 00:00:00 2001 From: Gaetan Perrot Date: Tue, 8 Jul 2025 14:09:56 +0900 Subject: [PATCH 0223/2141] [nrf fromtree] drivers: wifi: nrf_wifi: wifi_mgmt: remove redundant null check Deleted a redundant check for 'rpu_ctx_zep' pointer after it was already dereferenced. Clarifies code logic in nrf_wifi_get_power_save_config function. Signed-off-by: Gaetan Perrot (cherry picked from commit bac20e419eabf36625c073a366008f1384fcc272) --- drivers/wifi/nrf_wifi/src/wifi_mgmt.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/wifi/nrf_wifi/src/wifi_mgmt.c b/drivers/wifi/nrf_wifi/src/wifi_mgmt.c index 875ce786b570..64003b8ff253 100644 --- a/drivers/wifi/nrf_wifi/src/wifi_mgmt.c +++ b/drivers/wifi/nrf_wifi/src/wifi_mgmt.c @@ -202,11 +202,6 @@ int nrf_wifi_get_power_save_config(const struct device *dev, fmac_dev_ctx = rpu_ctx_zep->rpu_ctx; - if (!rpu_ctx_zep) { - LOG_ERR("%s: rpu_ctx_zep is NULL", __func__); - goto out; - } - vif_ctx_zep->ps_info = ps_config; vif_ctx_zep->ps_config_info_evnt = false; From 420a5b5c0eed0a9daf45459b0d89ebe5d15abf57 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Sun, 13 Jul 2025 01:32:37 +0530 Subject: [PATCH 0224/2141] [nrf fromtree] drivers: nrf_wifi: Fix return codes for xmit Return proper error codes for xmit instead of generic -1. Signed-off-by: Chaitanya Tata (cherry picked from commit 001f34d84c647d15d76480cb64fc6efce6ea736f) --- drivers/wifi/nrf_wifi/src/net_if.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/wifi/nrf_wifi/src/net_if.c b/drivers/wifi/nrf_wifi/src/net_if.c index 9108a0dab3b2..f94dc5a1e214 100644 --- a/drivers/wifi/nrf_wifi/src/net_if.c +++ b/drivers/wifi/nrf_wifi/src/net_if.c @@ -363,7 +363,7 @@ enum ethernet_hw_caps nrf_wifi_if_caps_get(const struct device *dev) int nrf_wifi_if_send(const struct device *dev, struct net_pkt *pkt) { - int ret = -1; + int ret = -EINVAL; #ifdef CONFIG_NRF70_DATA_TX struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; @@ -404,6 +404,7 @@ int nrf_wifi_if_send(const struct device *dev, if (nbuf == NULL) { LOG_ERR("%s: allocation failed", __func__); + ret = -ENOMEM; goto drop; } @@ -420,6 +421,7 @@ int nrf_wifi_if_send(const struct device *dev, #endif /* CONFIG_NRF70_RAW_DATA_TX */ if ((vif_ctx_zep->if_carr_state != NRF_WIFI_FMAC_IF_CARR_STATE_ON) || (!vif_ctx_zep->authorized && !is_eapol(pkt))) { + ret = -EPERM; goto drop; } @@ -432,6 +434,8 @@ int nrf_wifi_if_send(const struct device *dev, if (ret == NRF_WIFI_STATUS_FAIL) { /* FMAC API takes care of freeing the nbuf */ host_stats->total_tx_drop_pkts++; + /* Could be many reasons, but likely no space in the queue */ + ret = -ENOBUFS; } goto unlock; drop: From 453bc099f598fcd2bdd0ffe65096a81883f7214d Mon Sep 17 00:00:00 2001 From: Kapil Bhatt Date: Fri, 11 Jul 2025 06:59:19 +0000 Subject: [PATCH 0225/2141] [nrf fromtree] drivers: nrf_wifi: Fix rpu recovery debug info Rpu recovey debug stats are stored in hal_dev_ctx which is not persistent in case of interface is brought down/up. Need to add in nrf_wifi_ctx_zep and update before interface goes down. Signed-off-by: Kapil Bhatt (cherry picked from commit dd7413d269d69e2d0c8ee10c3d03929703e7efb1) --- drivers/wifi/nrf_wifi/inc/fmac_main.h | 2 ++ drivers/wifi/nrf_wifi/src/net_if.c | 16 ++++++++++++++++ drivers/wifi/nrf_wifi/src/wifi_util.c | 23 +++++++++++++++-------- 3 files changed, 33 insertions(+), 8 deletions(-) diff --git a/drivers/wifi/nrf_wifi/inc/fmac_main.h b/drivers/wifi/nrf_wifi/inc/fmac_main.h index 23f96089eb63..8c1d8a1851b5 100644 --- a/drivers/wifi/nrf_wifi/inc/fmac_main.h +++ b/drivers/wifi/nrf_wifi/inc/fmac_main.h @@ -118,6 +118,8 @@ struct nrf_wifi_ctx_zep { unsigned int rpu_recovery_retries; int rpu_recovery_success; int rpu_recovery_failure; + int wdt_irq_received; + int wdt_irq_ignored; #endif /* CONFIG_NRF_WIFI_RPU_RECOVERY */ }; diff --git a/drivers/wifi/nrf_wifi/src/net_if.c b/drivers/wifi/nrf_wifi/src/net_if.c index f94dc5a1e214..82945ff55c27 100644 --- a/drivers/wifi/nrf_wifi/src/net_if.c +++ b/drivers/wifi/nrf_wifi/src/net_if.c @@ -72,6 +72,8 @@ static void nrf_wifi_rpu_recovery_work_handler(struct k_work *work) struct nrf_wifi_vif_ctx_zep, nrf_wifi_rpu_recovery_work); struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; + struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx = NULL; + struct nrf_wifi_hal_dev_ctx *hal_dev_ctx = NULL; int ret; if (!vif_ctx_zep) { @@ -90,6 +92,18 @@ static void nrf_wifi_rpu_recovery_work_handler(struct k_work *work) return; } + fmac_dev_ctx = rpu_ctx_zep->rpu_ctx; + if (!fmac_dev_ctx) { + LOG_ERR("%s: fmac_dev_ctx is NULL", __func__); + return; + } + + hal_dev_ctx = fmac_dev_ctx->hal_dev_ctx; + if (!hal_dev_ctx) { + LOG_ERR("%s: hal_dev_ctx is NULL", __func__); + return; + } + if (rpu_ctx_zep->rpu_recovery_in_progress) { #ifdef CONFIG_NRF_WIFI_RPU_RECOVERY_DEBUG LOG_ERR("%s: RPU recovery already in progress", __func__); @@ -134,6 +148,8 @@ static void nrf_wifi_rpu_recovery_work_handler(struct k_work *work) } #endif rpu_ctx_zep->rpu_recovery_in_progress = true; + rpu_ctx_zep->wdt_irq_received += hal_dev_ctx->wdt_irq_received; + rpu_ctx_zep->wdt_irq_ignored += hal_dev_ctx->wdt_irq_ignored; #ifdef CONFIG_NRF_WIFI_RPU_RECOVERY_DEBUG LOG_ERR("%s: Bringing the interface down", __func__); #else diff --git a/drivers/wifi/nrf_wifi/src/wifi_util.c b/drivers/wifi/nrf_wifi/src/wifi_util.c index 4a31cae8121a..57bda1f4ff4f 100644 --- a/drivers/wifi/nrf_wifi/src/wifi_util.c +++ b/drivers/wifi/nrf_wifi/src/wifi_util.c @@ -938,10 +938,20 @@ static int nrf_wifi_util_rpu_recovery_info(const struct shell *sh, } fmac_dev_ctx = ctx->rpu_ctx; + if (!fmac_dev_ctx) { + shell_fprintf(sh, SHELL_ERROR, "FMAC context not initialized\n"); + ret = -ENOEXEC; + goto unlock; + } + hal_dev_ctx = fmac_dev_ctx->hal_dev_ctx; + if (!hal_dev_ctx) { + shell_fprintf(sh, SHELL_ERROR, "HAL context not initialized\n"); + ret = -ENOEXEC; + goto unlock; + } - shell_fprintf(sh, - SHELL_INFO, + shell_fprintf(sh, SHELL_INFO, "wdt_irq_received: %d\n" "wdt_irq_ignored: %d\n" "last_wakeup_now_asserted_time_ms: %lu milliseconds\n" @@ -950,14 +960,11 @@ static int nrf_wifi_util_rpu_recovery_info(const struct shell *sh, "current time: %lu milliseconds\n" "rpu_recovery_success: %d\n" "rpu_recovery_failure: %d\n\n", - hal_dev_ctx->wdt_irq_received, - hal_dev_ctx->wdt_irq_ignored, + ctx->wdt_irq_received, ctx->wdt_irq_ignored, hal_dev_ctx->last_wakeup_now_asserted_time_ms, hal_dev_ctx->last_wakeup_now_deasserted_time_ms, - hal_dev_ctx->last_rpu_sleep_opp_time_ms, - current_time_ms, - ctx->rpu_recovery_success, - ctx->rpu_recovery_failure); + hal_dev_ctx->last_rpu_sleep_opp_time_ms, current_time_ms, + ctx->rpu_recovery_success, ctx->rpu_recovery_failure); ret = 0; unlock: From 4369dc944b2c59a0eeee61b98d53611aaf66f951 Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Sun, 29 Jun 2025 20:01:59 +1000 Subject: [PATCH 0226/2141] [nrf fromtree] wifi: nrf_wifi: ignore interface if TX disabled Automatically hide the nRF7x interface from the connection manager if the TX path is disabled (scan only mode). This prevents function calls like `conn_mgr_all_if_up(true)` from bringing up the interface which can never result in a connection. Signed-off-by: Jordan Yates (cherry picked from commit 79edfc012803572b1c75a4667f03bfbb4fa9b6b0) --- drivers/wifi/nrf_wifi/src/net_if.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/wifi/nrf_wifi/src/net_if.c b/drivers/wifi/nrf_wifi/src/net_if.c index 82945ff55c27..a49fdc164983 100644 --- a/drivers/wifi/nrf_wifi/src/net_if.c +++ b/drivers/wifi/nrf_wifi/src/net_if.c @@ -18,6 +18,7 @@ #include LOG_MODULE_DECLARE(wifi_nrf, CONFIG_WIFI_NRF70_LOG_LEVEL); +#include #include #include "net_private.h" @@ -702,6 +703,11 @@ void nrf_wifi_if_init_zep(struct net_if *iface) nrf_wifi_net_iface_work_handler); #endif /* CONFIG_NRF70_DATA_TX */ +#ifdef CONFIG_NRF70_SCAN_ONLY + /* In scan only mode this interface should be ignored by the connectivity manager */ + conn_mgr_ignore_iface(iface); +#endif /* CONFIG_NRF70_SCAN_ONLY */ + #ifdef CONFIG_NRF_WIFI_RPU_RECOVERY k_work_init(&vif_ctx_zep->nrf_wifi_rpu_recovery_work, nrf_wifi_rpu_recovery_work_handler); From 193b571ff33dfe73941617c4b40b0144476edeed Mon Sep 17 00:00:00 2001 From: Kapil Bhatt Date: Thu, 26 Jun 2025 09:06:31 +0000 Subject: [PATCH 0227/2141] [nrf fromlist] drivers: nrf_wifi: Remove station mode from monitor mode Monitor mode doesn't require station mode. Disabling station mode require necessary changes to work monitor mode. Upstream PR #: 92226 Signed-off-by: Kapil Bhatt (cherry picked from commit fc9ee42b2960e102259546895adf831d5e955fb3) --- drivers/wifi/nrf_wifi/inc/fmac_main.h | 4 +- drivers/wifi/nrf_wifi/inc/wifi_mgmt.h | 2 + drivers/wifi/nrf_wifi/src/fmac_main.c | 10 ++-- drivers/wifi/nrf_wifi/src/net_if.c | 66 +++++++++++++-------------- drivers/wifi/nrf_wifi/src/wifi_mgmt.c | 2 + 5 files changed, 46 insertions(+), 38 deletions(-) diff --git a/drivers/wifi/nrf_wifi/inc/fmac_main.h b/drivers/wifi/nrf_wifi/inc/fmac_main.h index 8c1d8a1851b5..2f49ed8b055f 100644 --- a/drivers/wifi/nrf_wifi/inc/fmac_main.h +++ b/drivers/wifi/nrf_wifi/inc/fmac_main.h @@ -62,6 +62,9 @@ struct nrf_wifi_vif_ctx_zep { #ifdef CONFIG_NET_STATISTICS_ETHERNET struct net_stats_eth eth_stats; #endif /* CONFIG_NET_STATISTICS_ETHERNET */ +#if defined(CONFIG_NRF70_STA_MODE) || defined(CONFIG_NRF70_RAW_DATA_RX) + bool authorized; +#endif #ifdef CONFIG_NRF70_STA_MODE unsigned int assoc_freq; enum nrf_wifi_fmac_if_carr_state if_carr_state; @@ -72,7 +75,6 @@ struct nrf_wifi_vif_ctx_zep { unsigned char twt_flow_in_progress_map; struct wifi_ps_config *ps_info; bool ps_config_info_evnt; - bool authorized; bool cookie_resp_received; #ifdef CONFIG_NRF70_DATA_TX struct k_work nrf_wifi_net_iface_work; diff --git a/drivers/wifi/nrf_wifi/inc/wifi_mgmt.h b/drivers/wifi/nrf_wifi/inc/wifi_mgmt.h index e2aa91caa483..a4ae20302100 100644 --- a/drivers/wifi/nrf_wifi/inc/wifi_mgmt.h +++ b/drivers/wifi/nrf_wifi/inc/wifi_mgmt.h @@ -22,6 +22,7 @@ #define WIFI_MGMT_DATA_CTRL_FILTER_SETTING 0xE #define WIFI_ALL_FILTER_SETTING 0xF +#ifdef CONFIG_NRF70_STA_MODE struct twt_interval_float { unsigned short mantissa; unsigned char exponent; @@ -54,6 +55,7 @@ int nrf_wifi_get_power_save_config(const struct device *dev, void nrf_wifi_event_proc_get_power_save_info(void *vif_ctx, struct nrf_wifi_umac_event_power_save_info *ps_info, unsigned int event_len); +#endif /* CONFIG_NRF70_STA_MODE */ #ifdef CONFIG_NRF70_SYSTEM_WITH_RAW_MODES int nrf_wifi_mode(const struct device *dev, diff --git a/drivers/wifi/nrf_wifi/src/fmac_main.c b/drivers/wifi/nrf_wifi/src/fmac_main.c index 72055fb02993..92a58be9a099 100644 --- a/drivers/wifi/nrf_wifi/src/fmac_main.c +++ b/drivers/wifi/nrf_wifi/src/fmac_main.c @@ -350,7 +350,7 @@ int nrf_wifi_reg_domain(const struct device *dev, struct wifi_reg_domain *reg_do goto out; } -#ifdef CONFIG_NRF70_SCAN_ONLY +#if defined(CONFIG_NRF70_SCAN_ONLY) || defined(CONFIG_NRF70_RAW_DATA_RX) if (reg_domain->oper == WIFI_MGMT_SET) { memcpy(reg_domain_info.alpha2, reg_domain->country_code, WIFI_COUNTRY_CODE_LEN); @@ -739,10 +739,10 @@ static int nrf_wifi_drv_main_zep(const struct device *dev) data_config.rate_protection_type = rate_protection_type; callbk_fns.if_carr_state_chg_callbk_fn = nrf_wifi_if_carr_state_chg; callbk_fns.rx_frm_callbk_fn = nrf_wifi_if_rx_frm; +#endif #if defined(CONFIG_NRF70_RAW_DATA_RX) || defined(CONFIG_NRF70_PROMISC_DATA_RX) callbk_fns.sniffer_callbk_fn = nrf_wifi_if_sniffer_rx_frm; #endif /* CONFIG_NRF70_RAW_DATA_RX || CONFIG_NRF70_PROMISC_DATA_RX */ -#endif rx_buf_pools[0].num_bufs = rx1_num_bufs; rx_buf_pools[1].num_bufs = rx2_num_bufs; rx_buf_pools[2].num_bufs = rx3_num_bufs; @@ -756,6 +756,7 @@ static int nrf_wifi_drv_main_zep(const struct device *dev) callbk_fns.scan_start_callbk_fn = nrf_wifi_event_proc_scan_start_zep; callbk_fns.scan_done_callbk_fn = nrf_wifi_event_proc_scan_done_zep; callbk_fns.reg_change_callbk_fn = reg_change_callbk_fn; + callbk_fns.event_get_reg = nrf_wifi_event_get_reg_zep; #ifdef CONFIG_NET_L2_WIFI_MGMT callbk_fns.disp_scan_res_callbk_fn = nrf_wifi_event_proc_disp_scan_res_zep; #endif /* CONFIG_NET_L2_WIFI_MGMT */ @@ -769,7 +770,6 @@ static int nrf_wifi_drv_main_zep(const struct device *dev) callbk_fns.twt_config_callbk_fn = nrf_wifi_event_proc_twt_setup_zep; callbk_fns.twt_teardown_callbk_fn = nrf_wifi_event_proc_twt_teardown_zep; callbk_fns.twt_sleep_callbk_fn = nrf_wifi_event_proc_twt_sleep_zep; - callbk_fns.event_get_reg = nrf_wifi_event_get_reg_zep; callbk_fns.event_get_ps_info = nrf_wifi_event_proc_get_power_save_info; callbk_fns.cookie_rsp_callbk_fn = nrf_wifi_event_proc_cookie_rsp; callbk_fns.process_rssi_from_rx = nrf_wifi_process_rssi_from_rx; @@ -858,10 +858,12 @@ static const struct wifi_mgmt_ops nrf_wifi_mgmt_ops = { .get_stats = nrf_wifi_stats_get, .reset_stats = nrf_wifi_stats_reset, #endif /* CONFIG_NET_STATISTICS_WIFI */ +#if defined(CONFIG_NRF70_STA_MODE) || defined(CONFIG_NRF70_RAW_DATA_RX) + .reg_domain = nrf_wifi_reg_domain, +#endif #ifdef CONFIG_NRF70_STA_MODE .set_power_save = nrf_wifi_set_power_save, .set_twt = nrf_wifi_set_twt, - .reg_domain = nrf_wifi_reg_domain, .get_power_save_config = nrf_wifi_get_power_save_config, .set_rts_threshold = nrf_wifi_set_rts_threshold, .get_rts_threshold = nrf_wifi_get_rts_threshold, diff --git a/drivers/wifi/nrf_wifi/src/net_if.c b/drivers/wifi/nrf_wifi/src/net_if.c index a49fdc164983..4830d63c9d15 100644 --- a/drivers/wifi/nrf_wifi/src/net_if.c +++ b/drivers/wifi/nrf_wifi/src/net_if.c @@ -256,39 +256,6 @@ static void nrf_wifi_net_iface_work_handler(struct k_work *work) } } -#if defined(CONFIG_NRF70_RAW_DATA_RX) || defined(CONFIG_NRF70_PROMISC_DATA_RX) -void nrf_wifi_if_sniffer_rx_frm(void *os_vif_ctx, void *frm, - struct raw_rx_pkt_header *raw_rx_hdr, - bool pkt_free) -{ - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = os_vif_ctx; - struct net_if *iface = vif_ctx_zep->zep_net_if_ctx; - struct net_pkt *pkt; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx = rpu_ctx_zep->rpu_ctx; - struct nrf_wifi_sys_fmac_dev_ctx *sys_dev_ctx = NULL; - int ret; - - sys_dev_ctx = wifi_dev_priv(fmac_dev_ctx); - - pkt = net_raw_pkt_from_nbuf(iface, frm, sizeof(struct raw_rx_pkt_header), - raw_rx_hdr, - pkt_free); - if (!pkt) { - LOG_DBG("Failed to allocate net_pkt"); - return; - } - - net_capture_pkt(iface, pkt); - - ret = net_recv_data(iface, pkt); - if (ret < 0) { - LOG_DBG("RCV Packet dropped by NET stack: %d", ret); - net_pkt_unref(pkt); - } -} -#endif /* CONFIG_NRF70_RAW_DATA_RX || CONFIG_NRF70_PROMISC_DATA_RX */ - void nrf_wifi_if_rx_frm(void *os_vif_ctx, void *frm) { struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = os_vif_ctx; @@ -358,6 +325,39 @@ static bool is_eapol(struct net_pkt *pkt) } #endif /* CONFIG_NRF70_DATA_TX */ +#if defined(CONFIG_NRF70_RAW_DATA_RX) || defined(CONFIG_NRF70_PROMISC_DATA_RX) +void nrf_wifi_if_sniffer_rx_frm(void *os_vif_ctx, void *frm, + struct raw_rx_pkt_header *raw_rx_hdr, + bool pkt_free) +{ + struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = os_vif_ctx; + struct net_if *iface = vif_ctx_zep->zep_net_if_ctx; + struct net_pkt *pkt; + struct nrf_wifi_ctx_zep *rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; + struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx = rpu_ctx_zep->rpu_ctx; + struct nrf_wifi_sys_fmac_dev_ctx *sys_dev_ctx = NULL; + int ret; + + sys_dev_ctx = wifi_dev_priv(fmac_dev_ctx); + + pkt = net_raw_pkt_from_nbuf(iface, frm, sizeof(struct raw_rx_pkt_header), + raw_rx_hdr, + pkt_free); + if (!pkt) { + LOG_DBG("Failed to allocate net_pkt"); + return; + } + + net_capture_pkt(iface, pkt); + + ret = net_recv_data(iface, pkt); + if (ret < 0) { + LOG_DBG("RCV Packet dropped by NET stack: %d", ret); + net_pkt_unref(pkt); + } +} +#endif /* CONFIG_NRF70_RAW_DATA_RX || CONFIG_NRF70_PROMISC_DATA_RX */ + enum ethernet_hw_caps nrf_wifi_if_caps_get(const struct device *dev) { enum ethernet_hw_caps caps = (ETHERNET_LINK_10BASE | diff --git a/drivers/wifi/nrf_wifi/src/wifi_mgmt.c b/drivers/wifi/nrf_wifi/src/wifi_mgmt.c index 64003b8ff253..a323faf21dd6 100644 --- a/drivers/wifi/nrf_wifi/src/wifi_mgmt.c +++ b/drivers/wifi/nrf_wifi/src/wifi_mgmt.c @@ -25,6 +25,7 @@ LOG_MODULE_DECLARE(wifi_nrf, CONFIG_WIFI_NRF70_LOG_LEVEL); extern struct nrf_wifi_drv_priv_zep rpu_drv_priv_zep; +#ifdef CONFIG_NRF70_STA_MODE int nrf_wifi_set_power_save(const struct device *dev, struct wifi_ps_params *params) { @@ -743,6 +744,7 @@ void nrf_wifi_event_proc_twt_sleep_zep(void *vif_ctx, out: k_mutex_unlock(&vif_ctx_zep->vif_lock); } +#endif /* CONFIG_NRF70_STA_MODE */ #ifdef CONFIG_NRF70_SYSTEM_WITH_RAW_MODES int nrf_wifi_mode(const struct device *dev, From b6af6cb6ac232d31d5431693633010c36b256809 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Thu, 3 Jul 2025 21:37:14 +0530 Subject: [PATCH 0228/2141] [nrf fromtree] manifest: nrf_wifi: Pull fix for raw TX memory leak Fixes memory leak seen during continuous raw TX transmission. Signed-off-by: Chaitanya Tata (cherry picked from commit d5c7cb171b21049758f2907ec4b5a85ac73b43eb) --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 9807058ac13b..9e29918fb21b 100644 --- a/west.yml +++ b/west.yml @@ -328,7 +328,7 @@ manifest: revision: 968d55ff22579080466bf2f482596dd6e35361c6 path: modules/bsim_hw_models/nrf_hw_models - name: nrf_wifi - revision: 52286f111b4765e0dd40f43124e7bb5c14758dff + revision: 5f59c2336c69f28ae83f93812a1d726f9fceabfe path: modules/lib/nrf_wifi - name: open-amp revision: f7f4d083c7909a39d86e217376c69b416ec4faf3 From bdc2044a028c6df716cdf015c5d08e1a9a32b907 Mon Sep 17 00:00:00 2001 From: Ravi Dondaputi Date: Tue, 15 Apr 2025 17:32:48 +0530 Subject: [PATCH 0229/2141] [nrf fromtree] net: wifi: shell: Enable Wi-Fi credentials support Add a snippet for Wi-Fi credentials support. Update the heap sizes as required for enterprise mode. Signed-off-by: Ravi Dondaputi (cherry picked from commit 4c14c618f69e8ae0d5ee95a6abbc8a1d5f89afac) --- modules/hostap/Kconfig | 1 + snippets/wifi-credentials/README.rst | 29 +++++++++++++++++++ snippets/wifi-credentials/snippet.yml | 3 ++ .../wifi-credentials/wifi-credentials.conf | 8 +++++ 4 files changed, 41 insertions(+) create mode 100644 snippets/wifi-credentials/README.rst create mode 100644 snippets/wifi-credentials/snippet.yml create mode 100644 snippets/wifi-credentials/wifi-credentials.conf diff --git a/modules/hostap/Kconfig b/modules/hostap/Kconfig index 95dd2531503e..1dfe35410177 100644 --- a/modules/hostap/Kconfig +++ b/modules/hostap/Kconfig @@ -25,6 +25,7 @@ if WIFI_NM_WPA_SUPPLICANT config HEAP_MEM_POOL_ADD_SIZE_HOSTAP def_int 66560 if WIFI_NM_HOSTAPD_AP + def_int 55000 if WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE && WIFI_CREDENTIALS def_int 48000 if WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE def_int 41808 if WIFI_NM_WPA_SUPPLICANT_AP # 30K is mandatory, but might need more for long duration use cases diff --git a/snippets/wifi-credentials/README.rst b/snippets/wifi-credentials/README.rst new file mode 100644 index 000000000000..283bc3958585 --- /dev/null +++ b/snippets/wifi-credentials/README.rst @@ -0,0 +1,29 @@ +.. _snippet-wifi-credentials: + +Wi-Fi Credentials Snippet (wifi-credential) +########################################### + +.. code-block:: console + + west build -S wifi-credentials [...] + +Can also be used along with the :ref:`snippet-wifi-enterprise` snippet. + +.. code-block:: console + + west build -S "wifi-enterprise,wifi-credentials" [...] + +Overview +******** + +This snippet enables Wi-Fi credentials support. + +Requirements +************ + +Hardware support for: + +- :kconfig:option:`CONFIG_WIFI` +- :kconfig:option:`CONFIG_WIFI_USE_NATIVE_NETWORKING` +- :kconfig:option:`CONFIG_WIFI_NM_WPA_SUPPLICANT` +- :kconfig:option:`CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE` diff --git a/snippets/wifi-credentials/snippet.yml b/snippets/wifi-credentials/snippet.yml new file mode 100644 index 000000000000..6046c0865dc2 --- /dev/null +++ b/snippets/wifi-credentials/snippet.yml @@ -0,0 +1,3 @@ +name: wifi-credentials +append: + EXTRA_CONF_FILE: wifi-credentials.conf diff --git a/snippets/wifi-credentials/wifi-credentials.conf b/snippets/wifi-credentials/wifi-credentials.conf new file mode 100644 index 000000000000..4ac281698255 --- /dev/null +++ b/snippets/wifi-credentials/wifi-credentials.conf @@ -0,0 +1,8 @@ +# For use with Wi-Fi Credentials +CONFIG_WIFI_CREDENTIALS=y +CONFIG_FLASH=y +CONFIG_FLASH_PAGE_LAYOUT=y +CONFIG_FLASH_MAP=y +CONFIG_NVS=y +CONFIG_SETTINGS=y +CONFIG_SETTINGS_NVS=y From c1a5f870cd59abf4b796f8bd8f48783de25484ea Mon Sep 17 00:00:00 2001 From: Qiankun Li Date: Tue, 22 Apr 2025 14:50:51 +0530 Subject: [PATCH 0230/2141] [nrf fromtree] modules: hostap: Fix getting error stations twt capability issue. 1. When external station connects to soft ap, zephyr hostap will fill sta_info before sending mgmt event to l2 wifi layer. sta_info.twt_capable should be filled with external station capability rather than soft ap self. 2. Rename hapd_is_twt_capable to hapd_get_sta_he_twt_capable. Try to get twt_capa form capability of external station rather than soft ap. Signed-off-by: Qiankun Li (cherry picked from commit 7ffc538d135379ff673d5b5ae80fa790f5f67051) --- modules/hostap/src/hapd_events.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/modules/hostap/src/hapd_events.c b/modules/hostap/src/hapd_events.c index c71015f7f920..2d297b71aff6 100644 --- a/modules/hostap/src/hapd_events.c +++ b/modules/hostap/src/hapd_events.c @@ -35,10 +35,17 @@ static enum wifi_link_mode hapd_get_sta_link_mode(struct hostapd_iface *iface, } } -static bool hapd_is_twt_capable(struct hostapd_iface *iface, struct sta_info *sta) +#define HE_MACCAP_TWT_REQUESTER BIT(1) + +static bool hapd_get_sta_he_twt_capable(struct hostapd_iface *iface, struct sta_info *sta) { #ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_11AX - return hostapd_get_he_twt_responder(iface->bss[0], IEEE80211_MODE_AP); + if (sta->flags & WLAN_STA_HE) { + return (sta->he_capab->he_mac_capab_info[0] + & HE_MACCAP_TWT_REQUESTER ? true : false); + } else { + return false; + } #else return false; #endif @@ -73,7 +80,7 @@ int hostapd_send_wifi_mgmt_ap_sta_event(struct hostapd_iface *ap_ctx, if (event == NET_EVENT_WIFI_CMD_AP_STA_CONNECTED) { sta_info.link_mode = hapd_get_sta_link_mode(ap_ctx, sta); - sta_info.twt_capable = hapd_is_twt_capable(ap_ctx, sta); + sta_info.twt_capable = hapd_get_sta_he_twt_capable(ap_ctx, sta); } return supplicant_send_wifi_mgmt_event(ifname, From b567a543af1492984c401af6bc10b2cb8f326e2c Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Wed, 21 May 2025 13:25:21 +0300 Subject: [PATCH 0231/2141] [nrf fromtree] hostap: Replace wifi event mechanism by k_fifo Earlier we had socketpair to pass wifi event information from wpa_supplicant side to zephyr adaption layer. This is now replaced by k_fifo to save some RAM. Signed-off-by: Jukka Rissanen (cherry picked from commit 96818f45a91472cb0eabd5cfe42b5b256860f6a5) --- modules/hostap/Kconfig | 3 +- modules/hostap/src/supp_main.c | 171 +++++++++++++++++---------------- subsys/net/lib/sockets/Kconfig | 5 - 3 files changed, 92 insertions(+), 87 deletions(-) diff --git a/modules/hostap/Kconfig b/modules/hostap/Kconfig index 1dfe35410177..11feefbb42d9 100644 --- a/modules/hostap/Kconfig +++ b/modules/hostap/Kconfig @@ -13,11 +13,12 @@ config WIFI_NM_WPA_SUPPLICANT select XSI_SINGLE_PROCESS select NET_SOCKETS select NET_SOCKETS_PACKET - select NET_SOCKETPAIR select NET_L2_WIFI_MGMT select WIFI_NM select EXPERIMENTAL select COMMON_LIBC_MALLOC + select ZVFS + select ZVFS_EVENTFD help WPA supplicant as a network management backend for WIFI_NM. diff --git a/modules/hostap/src/supp_main.c b/modules/hostap/src/supp_main.c index 5ba2ef5b10ce..c2a4866b9218 100644 --- a/modules/hostap/src/supp_main.c +++ b/modules/hostap/src/supp_main.c @@ -11,6 +11,7 @@ LOG_MODULE_REGISTER(wifi_supplicant, CONFIG_WIFI_NM_WPA_SUPPLICANT_LOG_LEVEL); #include #include #include +#include #if !defined(CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_NONE) && !defined(CONFIG_MBEDTLS_ENABLE_HEAP) #include @@ -44,6 +45,7 @@ static K_THREAD_STACK_DEFINE(iface_wq_stack, CONFIG_WIFI_NM_WPA_SUPPLICANT_WQ_ST #include "fst/fst.h" #include "includes.h" #include "wpa_cli_zephyr.h" +#include "ctrl_iface_zephyr.h" #ifdef CONFIG_WIFI_NM_HOSTAPD_AP #include "hostapd.h" #include "hapd_main.h" @@ -109,7 +111,8 @@ struct supplicant_context { struct net_mgmt_event_callback cb; struct net_if *iface; char if_name[CONFIG_NET_INTERFACE_NAME_LEN + 1]; - int event_socketpair[2]; + struct k_fifo fifo; + int sock; struct k_work iface_work; struct k_work_q iface_wq; int (*iface_handler)(struct supplicant_context *ctx, struct net_if *iface); @@ -139,39 +142,25 @@ struct k_work_q *get_workq(void) return &get_default_context()->iface_wq; } +/* found in hostap/wpa_supplicant/ctrl_iface_zephyr.c */ +extern int send_data(struct k_fifo *fifo, int sock, const char *buf, size_t len, int flags); + int zephyr_wifi_send_event(const struct wpa_supplicant_event_msg *msg) { struct supplicant_context *ctx; - struct pollfd fds[1]; int ret; /* TODO: Fix this to get the correct container */ ctx = get_default_context(); - if (ctx->event_socketpair[1] < 0) { + if (ctx->sock < 0) { ret = -ENOENT; goto out; } - fds[0].fd = ctx->event_socketpair[0]; - fds[0].events = POLLOUT; - fds[0].revents = 0; - - ret = zsock_poll(fds, 1, WRITE_TIMEOUT); - if (ret < 0) { - ret = -errno; - LOG_ERR("Cannot write event (%d)", ret); - goto out; - } - - ret = zsock_send(ctx->event_socketpair[1], msg, sizeof(*msg), 0); - if (ret < 0) { - ret = -errno; - LOG_WRN("Event send failed (%d)", ret); - goto out; - } - - if (ret != sizeof(*msg)) { + ret = send_data(&ctx->fifo, ctx->sock, + (const char *)msg, sizeof(*msg), 0); + if (ret != 0) { ret = -EMSGSIZE; LOG_WRN("Event partial send (%d)", ret); goto out; @@ -562,84 +551,105 @@ static int setup_interface_monitoring(struct supplicant_context *ctx, struct net static void event_socket_handler(int sock, void *eloop_ctx, void *user_data) { struct supplicant_context *ctx = user_data; - struct wpa_supplicant_event_msg msg; - int ret; + struct wpa_supplicant_event_msg event_msg; + struct zephyr_msg *msg; + zvfs_eventfd_t value; ARG_UNUSED(eloop_ctx); - ARG_UNUSED(ctx); - ret = zsock_recv(sock, &msg, sizeof(msg), 0); - if (ret < 0) { - LOG_ERR("Failed to recv the message (%d)", -errno); - return; - } + do { + zvfs_eventfd_read(sock, &value); - if (ret != sizeof(msg)) { - LOG_ERR("Received incomplete message: got: %d, expected:%d", - ret, sizeof(msg)); - return; - } + msg = k_fifo_get(&ctx->fifo, K_NO_WAIT); + if (msg == NULL) { + LOG_ERR("fifo(event): %s", "empty"); + return; + } - LOG_DBG("Passing message %d to wpa_supplicant", msg.event); + if (msg->data == NULL) { + LOG_ERR("fifo(event): %s", "no data"); + goto out; + } - if (msg.global) { - wpa_supplicant_event_global(msg.ctx, msg.event, msg.data); + if (msg->len != sizeof(event_msg)) { + LOG_ERR("Received incomplete message: got: %d, expected:%d", + msg->len, sizeof(event_msg)); + goto out; + } + + memcpy(&event_msg, msg->data, sizeof(event_msg)); + + LOG_DBG("Passing message %d to wpa_supplicant", event_msg.event); + + if (event_msg.global) { + wpa_supplicant_event_global(event_msg.ctx, event_msg.event, + event_msg.data); #ifdef CONFIG_WIFI_NM_HOSTAPD_AP - } else if (msg.hostapd) { - hostapd_event(msg.ctx, msg.event, msg.data); + } else if (event_msg.hostapd) { + hostapd_event(event_msg.ctx, event_msg.event, event_msg.data); #endif - } else { - wpa_supplicant_event(msg.ctx, msg.event, msg.data); - } - - if (msg.data) { - union wpa_event_data *data = msg.data; - - /* Free up deep copied data */ - if (msg.event == EVENT_AUTH) { - os_free((char *)data->auth.ies); - } else if (msg.event == EVENT_RX_MGMT) { - os_free((char *)data->rx_mgmt.frame); - } else if (msg.event == EVENT_TX_STATUS) { - os_free((char *)data->tx_status.data); - } else if (msg.event == EVENT_ASSOC) { - os_free((char *)data->assoc_info.addr); - os_free((char *)data->assoc_info.req_ies); - os_free((char *)data->assoc_info.resp_ies); - os_free((char *)data->assoc_info.resp_frame); - } else if (msg.event == EVENT_ASSOC_REJECT) { - os_free((char *)data->assoc_reject.bssid); - os_free((char *)data->assoc_reject.resp_ies); - } else if (msg.event == EVENT_DEAUTH) { - os_free((char *)data->deauth_info.addr); - os_free((char *)data->deauth_info.ie); - } else if (msg.event == EVENT_DISASSOC) { - os_free((char *)data->disassoc_info.addr); - os_free((char *)data->disassoc_info.ie); - } else if (msg.event == EVENT_UNPROT_DEAUTH) { - os_free((char *)data->unprot_deauth.sa); - os_free((char *)data->unprot_deauth.da); - } else if (msg.event == EVENT_UNPROT_DISASSOC) { - os_free((char *)data->unprot_disassoc.sa); - os_free((char *)data->unprot_disassoc.da); + } else { + wpa_supplicant_event(event_msg.ctx, event_msg.event, event_msg.data); } - os_free(msg.data); - } + if (event_msg.data) { + union wpa_event_data *data = event_msg.data; + + /* Free up deep copied data */ + if (event_msg.event == EVENT_AUTH) { + os_free((char *)data->auth.ies); + } else if (event_msg.event == EVENT_RX_MGMT) { + os_free((char *)data->rx_mgmt.frame); + } else if (event_msg.event == EVENT_TX_STATUS) { + os_free((char *)data->tx_status.data); + } else if (event_msg.event == EVENT_ASSOC) { + os_free((char *)data->assoc_info.addr); + os_free((char *)data->assoc_info.req_ies); + os_free((char *)data->assoc_info.resp_ies); + os_free((char *)data->assoc_info.resp_frame); + } else if (event_msg.event == EVENT_ASSOC_REJECT) { + os_free((char *)data->assoc_reject.bssid); + os_free((char *)data->assoc_reject.resp_ies); + } else if (event_msg.event == EVENT_DEAUTH) { + os_free((char *)data->deauth_info.addr); + os_free((char *)data->deauth_info.ie); + } else if (event_msg.event == EVENT_DISASSOC) { + os_free((char *)data->disassoc_info.addr); + os_free((char *)data->disassoc_info.ie); + } else if (event_msg.event == EVENT_UNPROT_DEAUTH) { + os_free((char *)data->unprot_deauth.sa); + os_free((char *)data->unprot_deauth.da); + } else if (event_msg.event == EVENT_UNPROT_DISASSOC) { + os_free((char *)data->unprot_disassoc.sa); + os_free((char *)data->unprot_disassoc.da); + } + + os_free(event_msg.data); + } + +out: + os_free(msg->data); + os_free(msg); + + } while (!k_fifo_is_empty(&ctx->fifo)); } static int register_supplicant_event_socket(struct supplicant_context *ctx) { int ret; - ret = socketpair(AF_UNIX, SOCK_STREAM, 0, ctx->event_socketpair); + ret = zvfs_eventfd(0, ZVFS_EFD_NONBLOCK); if (ret < 0) { ret = -errno; LOG_ERR("Failed to initialize socket (%d)", ret); return ret; } - eloop_register_read_sock(ctx->event_socketpair[0], event_socket_handler, NULL, ctx); + ctx->sock = ret; + + k_fifo_init(&ctx->fifo); + + eloop_register_read_sock(ctx->sock, event_socket_handler, NULL, ctx); return 0; } @@ -707,7 +717,7 @@ static void handler(void) supplicant_generate_state_event(ctx->if_name, NET_EVENT_SUPPLICANT_CMD_NOT_READY, 0); - eloop_unregister_read_sock(ctx->event_socketpair[0]); + eloop_unregister_read_sock(ctx->sock); zephyr_global_wpa_ctrl_deinit(); @@ -716,8 +726,7 @@ static void handler(void) out: wpa_supplicant_deinit(ctx->supplicant); - zsock_close(ctx->event_socketpair[0]); - zsock_close(ctx->event_socketpair[1]); + close(ctx->sock); err: os_free(params.pid_file); diff --git a/subsys/net/lib/sockets/Kconfig b/subsys/net/lib/sockets/Kconfig index 6662582aed88..791fc464d38e 100644 --- a/subsys/net/lib/sockets/Kconfig +++ b/subsys/net/lib/sockets/Kconfig @@ -350,7 +350,6 @@ if NET_SOCKETPAIR config NET_SOCKETPAIR_BUFFER_SIZE int "Size of the intermediate buffer, in bytes" - default 1024 if WIFI_NM_WPA_SUPPLICANT default 64 range 1 4096 help @@ -372,8 +371,6 @@ if NET_SOCKETPAIR_STATIC config NET_SOCKETPAIR_MAX int "How many socketpairs to pre-allocate" - default 6 if WIFI_NM_HOSTAPD_AP - default 4 if WIFI_NM_WPA_SUPPLICANT default 1 endif # NET_SOCKETPAIR_STATIC @@ -382,8 +379,6 @@ if NET_SOCKETPAIR_HEAP config HEAP_MEM_POOL_ADD_SIZE_SOCKETPAIR int - default 9136 if WIFI_NM_HOSTAPD_AP - default 6852 if WIFI_NM_WPA_SUPPLICANT default 296 endif # NET_SOCKETPAIR_HEAP From a53d104799903cdfa61a39af955a1dd260753b97 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Fri, 27 Jun 2025 16:31:15 +0530 Subject: [PATCH 0232/2141] [nrf fromtree] modules: hostap: Fix EAP dependencies In case anyone enabled EAP_*_ALL explicitly without enabling the Enterprise then it leads to a build error. Fix by adding the dependency. Signed-off-by: Chaitanya Tata (cherry picked from commit 014dee722bcd63391e4a6b95a5f82bf8bc8fa580) --- modules/hostap/Kconfig | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/hostap/Kconfig b/modules/hostap/Kconfig index 11feefbb42d9..6c8d88483cb2 100644 --- a/modules/hostap/Kconfig +++ b/modules/hostap/Kconfig @@ -200,6 +200,7 @@ config WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE select MBEDTLS_TLS_VERSION_1_2 depends on !WIFI_NM_WPA_SUPPLICANT_CRYPTO_NONE +if WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE config EAP_TLS bool "EAP-TLS support" @@ -258,7 +259,8 @@ config EAP_ALL select EAP_GTC select EAP_TTLS select EAP_MSCHAPV2 - default y if WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE + default y +endif # WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE config WIFI_NM_WPA_SUPPLICANT_WPA3 bool "WPA3 support" @@ -302,6 +304,7 @@ config WIFI_NM_HOSTAPD_CRYPTO_ENTERPRISE bool "Hostapd crypto enterprise support" depends on WIFI_NM_HOSTAPD_AP +if WIFI_NM_HOSTAPD_CRYPTO_ENTERPRISE config EAP_SERVER_TLS bool "EAP-TLS server support" @@ -330,7 +333,9 @@ config EAP_SERVER_ALL select EAP_SERVER_PEAP select EAP_SERVER_GTC select EAP_SERVER_TTLS - default y if WIFI_NM_HOSTAPD_CRYPTO_ENTERPRISE + default y + +endif # WIFI_NM_HOSTAPD_CRYPTO_ENTERPRISE config WIFI_NM_WPA_SUPPLICANT_BSS_MAX_IDLE_TIME int "BSS max idle timeout in seconds" From 6cc5f638cf2d9653887140b4d4166c1dd2735f60 Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Mon, 7 Jul 2025 12:06:01 +1000 Subject: [PATCH 0233/2141] [nrf fromtree] modules: hostap: fix connection termination report If the disconnect event is raised before the network has been connected, report the connection result as `WIFI_STATUS_CONN_FAIL`, instead of as `WIFI_REASON_DISCONN_SUCCESS`, which is interpretted as `WIFI_STATUS_CONN_SUCCESS`. Signed-off-by: Jordan Yates (cherry picked from commit 9245f58b4ccf32b261341fdfc09e993b7eba74f0) --- modules/hostap/src/supp_events.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/hostap/src/supp_events.c b/modules/hostap/src/supp_events.c index 596ffa6ff560..f13552e8416b 100644 --- a/modules/hostap/src/supp_events.c +++ b/modules/hostap/src/supp_events.c @@ -224,20 +224,24 @@ int supplicant_send_wifi_mgmt_conn_event(void *ctx, int status_code) int supplicant_send_wifi_mgmt_disc_event(void *ctx, int reason_code) { struct wpa_supplicant *wpa_s = ctx; - int status = wpas_to_wifi_mgmt_disconn_status(reason_code); enum net_event_wifi_cmd event; + int status; if (!wpa_s || !wpa_s->current_ssid) { return -EINVAL; } if (wpa_s->wpa_state >= WPA_COMPLETED) { + /* Disconnect event code & status */ + status = wpas_to_wifi_mgmt_disconn_status(reason_code); if (wpa_s->current_ssid->mode == WPAS_MODE_AP) { event = NET_EVENT_WIFI_CMD_AP_DISABLE_RESULT; } else { event = NET_EVENT_WIFI_CMD_DISCONNECT_RESULT; } } else { + /* Connect event code & status */ + status = WIFI_STATUS_CONN_FAIL; if (wpa_s->current_ssid->mode == WPAS_MODE_AP) { event = NET_EVENT_WIFI_CMD_AP_ENABLE_RESULT; } else { From 8c78f8c69f3dec9b128228cf9478ff633eca06a4 Mon Sep 17 00:00:00 2001 From: Flavio Ceolin Date: Tue, 8 Jul 2025 10:26:20 -0700 Subject: [PATCH 0234/2141] [nrf fromtree] hostap: Set enterprise crypto insecure Set enterprise crypto insecure because certifcate validation is disabled. Signed-off-by: Flavio Ceolin (cherry picked from commit 979fcc0b6e57f0a41ee84ea89045744825c977b1) --- modules/hostap/Kconfig | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/hostap/Kconfig b/modules/hostap/Kconfig index 6c8d88483cb2..743cbf372047 100644 --- a/modules/hostap/Kconfig +++ b/modules/hostap/Kconfig @@ -198,7 +198,12 @@ config WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE select MBEDTLS_SERVER_NAME_INDICATION if MBEDTLS_BUILTIN select MBEDTLS_X509_CRL_PARSE_C select MBEDTLS_TLS_VERSION_1_2 + select NOT_SECURE depends on !WIFI_NM_WPA_SUPPLICANT_CRYPTO_NONE + help + Enable Enterprise Crypto support for WiFi. This feature + is considered NOT SECURE due the lack of certificate + validation. if WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE config EAP_TLS From a6ffe954d7c1bead7465efbb33dc1ef1d7407e6f Mon Sep 17 00:00:00 2001 From: Gaetan Perrot Date: Tue, 8 Jul 2025 15:51:11 +0900 Subject: [PATCH 0235/2141] [nrf fromtree] modules: hostap: supp_api: Fix possible null deference Ensure 'params' is not NULL before accessing its fields. Prevents possible null pointer dereference when calling strlen(params->ssid). Delay access to ssid->ssid and ssid->ssid_len until after null check. Prevents potential crash if wpa_s->current_ssid is NULL. Signed-off-by: Gaetan Perrot (cherry picked from commit b6a5202e55cf0f010d523f31f642dc5ebf66eeea) --- modules/hostap/src/supp_api.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/modules/hostap/src/supp_api.c b/modules/hostap/src/supp_api.c index f58a9f7f78aa..c459171329b9 100644 --- a/modules/hostap/src/supp_api.c +++ b/modules/hostap/src/supp_api.c @@ -1287,8 +1287,8 @@ int supplicant_status(const struct device *dev, struct wifi_iface_status *status struct wpa_ssid *ssid = wpa_s->current_ssid; u8 channel; struct signal_poll_resp signal_poll; - u8 *_ssid = ssid->ssid; - size_t ssid_len = ssid->ssid_len; + u8 *_ssid; + size_t ssid_len; struct status_resp cli_status; int proto; int key_mgmt; @@ -1299,6 +1299,8 @@ int supplicant_status(const struct device *dev, struct wifi_iface_status *status goto out; } + _ssid = ssid->ssid; + ssid_len = ssid->ssid_len; proto = ssid->proto; key_mgmt = ssid->key_mgmt; sae_pwe = wpa_s->conf->sae_pwe; @@ -1489,9 +1491,15 @@ int supplicant_11k_cfg(const struct device *dev, struct wifi_11k_params *params) int supplicant_11k_neighbor_request(const struct device *dev, struct wifi_11k_params *params) { - int ssid_len = strlen(params->ssid); + int ssid_len; - if (params != NULL && ssid_len > 0) { + if (params == NULL) { + return -1; + } + + ssid_len = strlen(params->ssid); + + if (ssid_len > 0) { if (ssid_len > WIFI_SSID_MAX_LEN) { wpa_printf(MSG_ERROR, "%s: ssid too long %u", __func__, ssid_len); From 938330eeffad4f051e5e05bf30e20c6d0a0e2839 Mon Sep 17 00:00:00 2001 From: Flavio Ceolin Date: Tue, 8 Jul 2025 09:45:23 -0700 Subject: [PATCH 0236/2141] [nrf fromtree] build: kconfig: Add support for warning insecure features Add a new promptless Kconfig symbol (INSECURE). This symbols must be selected by any setting which is used to enable an insecure feature. Signed-off-by: Flavio Ceolin (cherry picked from commit 674fd094aa67b31d1d54b1f318adce8ed2faddd6) --- Kconfig.zephyr | 6 ++++++ scripts/kconfig/kconfig.py | 12 ++++++++++++ share/sysbuild/Kconfig | 6 ++++++ 3 files changed, 24 insertions(+) diff --git a/Kconfig.zephyr b/Kconfig.zephyr index 9baae3922090..4993e56c8b24 100644 --- a/Kconfig.zephyr +++ b/Kconfig.zephyr @@ -1030,6 +1030,12 @@ config WARN_EXPERIMENTAL Print a warning when the Kconfig tree is parsed if any experimental features are enabled. +config NOT_SECURE + bool + help + Symbol to be selected by a feature to inidicate that feature is + not secure. + config TAINT bool help diff --git a/scripts/kconfig/kconfig.py b/scripts/kconfig/kconfig.py index feb0b447a884..74f8513138f0 100755 --- a/scripts/kconfig/kconfig.py +++ b/scripts/kconfig/kconfig.py @@ -93,6 +93,8 @@ def main(): if kconf.syms.get('WARN_EXPERIMENTAL', kconf.y).tri_value == 2: check_experimental(kconf) + check_not_secure(kconf) + # Hack: Force all symbols to be evaluated, to catch warnings generated # during evaluation. Wait till the end to write the actual output files, so # that we don't generate any output if there are warnings-turned-errors. @@ -266,6 +268,16 @@ def check_experimental(kconf): selector_name = split_expr(selector, AND)[0].name warn(f'Experimental symbol {selector_name} is enabled.') +def check_not_secure(kconf): + not_secure = kconf.syms.get('NOT_SECURE') + dep_expr = kconf.n if not_secure is None else not_secure.rev_dep + + if dep_expr is not kconf.n: + selectors = [s for s in split_expr(dep_expr, OR) if expr_value(s) == 2] + for selector in selectors: + selector_name = split_expr(selector, AND)[0].name + warn(f'Not secure symbol {selector_name} is enabled.') + def promptless(sym): # Returns True if 'sym' has no prompt. Since the symbol might be defined in diff --git a/share/sysbuild/Kconfig b/share/sysbuild/Kconfig index e2076941380a..5f689e07399a 100644 --- a/share/sysbuild/Kconfig +++ b/share/sysbuild/Kconfig @@ -69,6 +69,12 @@ config WARN_DEPRECATED Print a warning when the Kconfig tree is parsed if any deprecated features are enabled. +config NOT_SECURE + bool + help + Symbol to be selected by a feature to inidicate that feature is + not secure. + rsource "images/Kconfig" menu "Build options" From bd413c5868af9b981d8ca6c6d81e562d86dc2b8b Mon Sep 17 00:00:00 2001 From: Gaetan Perrot Date: Tue, 8 Jul 2025 16:27:20 +0900 Subject: [PATCH 0237/2141] [nrf fromtree] modules: hostap: hapd_events: Fix possible null deference Move usage of ap_ctx pointers after null checks to prevent potential crashes. Signed-off-by: Gaetan Perrot (cherry picked from commit cd855104f24d06707373b70cd6fa73e645d8e4ce) --- modules/hostap/src/hapd_events.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/hostap/src/hapd_events.c b/modules/hostap/src/hapd_events.c index 2d297b71aff6..deb4c1705de6 100644 --- a/modules/hostap/src/hapd_events.c +++ b/modules/hostap/src/hapd_events.c @@ -69,13 +69,15 @@ int hostapd_send_wifi_mgmt_ap_sta_event(struct hostapd_iface *ap_ctx, void *data) { struct sta_info *sta = data; - char *ifname = ap_ctx->bss[0]->conf->iface; + char *ifname; struct wifi_ap_sta_info sta_info = { 0 }; if (!ap_ctx || !sta) { return -EINVAL; } + ifname = ap_ctx->bss[0]->conf->iface; + memcpy(sta_info.mac, sta->addr, sizeof(sta_info.mac)); if (event == NET_EVENT_WIFI_CMD_AP_STA_CONNECTED) { From 0e4a96918d01cbb7b09a745c3e70fb1a6c550dbb Mon Sep 17 00:00:00 2001 From: Gaetan Perrot Date: Tue, 8 Jul 2025 16:29:09 +0900 Subject: [PATCH 0238/2141] [nrf fromtree] modules: hostap: supp_events: Fix possible null deference Move usage of ap_ctx pointers after null checks to prevent potential crashes. Signed-off-by: Gaetan Perrot (cherry picked from commit 8a565c0a2b8c12b1ea0298367a0ff525c1ae20b8) --- modules/hostap/src/supp_events.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/hostap/src/supp_events.c b/modules/hostap/src/supp_events.c index f13552e8416b..c4175a416bea 100644 --- a/modules/hostap/src/supp_events.c +++ b/modules/hostap/src/supp_events.c @@ -304,13 +304,15 @@ int supplicant_send_wifi_mgmt_ap_sta_event(void *ctx, { struct sta_info *sta = data; struct wpa_supplicant *ap_ctx = ctx; - char *ifname = ap_ctx->ifname; + char *ifname; struct wifi_ap_sta_info sta_info = { 0 }; if (!ap_ctx || !sta) { return -EINVAL; } + ifname = ap_ctx->ifname; + memcpy(sta_info.mac, sta->addr, sizeof(sta_info.mac)); if (event == NET_EVENT_WIFI_CMD_AP_STA_CONNECTED) { From 7b47aaad615c6ffa50d4c2c9a20654c320f4180d Mon Sep 17 00:00:00 2001 From: Triveni Danda Date: Mon, 14 Jul 2025 19:27:11 +0530 Subject: [PATCH 0239/2141] [nrf fromtree] modules: hostap: Set default stack size for softAP mode This change is needed to handle to stack overflow issues when using SPIM. Signed-off-by: Triveni Danda (cherry picked from commit 0dcb5a4923f1bf07229e1695d726edb990064572) --- modules/hostap/Kconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/hostap/Kconfig b/modules/hostap/Kconfig index 743cbf372047..2056a43e8729 100644 --- a/modules/hostap/Kconfig +++ b/modules/hostap/Kconfig @@ -37,6 +37,8 @@ config WIFI_NM_WPA_SUPPLICANT_THREAD_STACK_SIZE # TODO: Providing higher stack size for Enterprise mode to fix stack # overflow issues. Need to identify the cause for higher stack usage. default 8192 if WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE + # This is needed to handle stack overflow issues on nRF Wi-Fi drivers. + default 5900 if WIFI_NM_WPA_SUPPLICANT_AP default 5800 config WIFI_NM_WPA_SUPPLICANT_WQ_STACK_SIZE From 00420dcf6bbbd37e0e43e26c5dae2dbe20289a2e Mon Sep 17 00:00:00 2001 From: Gang Li Date: Fri, 11 Jul 2025 12:05:36 +0200 Subject: [PATCH 0240/2141] [nrf fromtree] modules: hostap: set the cipher suites for WPA2 & WPA3 SAE mode When the external AP is in WPA3 SAE mode, the group cipher uses TKIP and the pairwise cipher uses TKIP and CCMP. Should not connect to the AP. For WPA2 & WPA3 SAE & WPA2/WPA3 mixed mode, set group cipher to CCMP, pairwise cipher to CCMP. Signed-off-by: Gang Li (cherry picked from commit c8fa5e5899575fe5c0a0a6c3013fdc4527d2cdb4) --- modules/hostap/src/supp_api.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/modules/hostap/src/supp_api.c b/modules/hostap/src/supp_api.c index c459171329b9..cde1ef95f478 100644 --- a/modules/hostap/src/supp_api.c +++ b/modules/hostap/src/supp_api.c @@ -752,6 +752,14 @@ static int wpas_add_and_config_network(struct wpa_supplicant *wpa_s, goto out; } } + + if (!wpa_cli_cmd_v("set_network %d group CCMP", resp.network_id)) { + goto out; + } + + if (!wpa_cli_cmd_v("set_network %d pairwise CCMP", resp.network_id)) { + goto out; + } } else if (params->security == WIFI_SECURITY_TYPE_PSK_SHA256) { if (!wpa_cli_cmd_v("set_network %d psk \"%s\"", resp.network_id, psk_null_terminated)) { @@ -762,6 +770,14 @@ static int wpas_add_and_config_network(struct wpa_supplicant *wpa_s, resp.network_id)) { goto out; } + + if (!wpa_cli_cmd_v("set_network %d group CCMP", resp.network_id)) { + goto out; + } + + if (!wpa_cli_cmd_v("set_network %d pairwise CCMP", resp.network_id)) { + goto out; + } } else if (params->security == WIFI_SECURITY_TYPE_PSK || params->security == WIFI_SECURITY_TYPE_WPA_PSK) { if (!wpa_cli_cmd_v("set_network %d psk \"%s\"", @@ -779,6 +795,15 @@ static int wpas_add_and_config_network(struct wpa_supplicant *wpa_s, resp.network_id)) { goto out; } + } else { + if (!wpa_cli_cmd_v("set_network %d group CCMP", resp.network_id)) { + goto out; + } + + if (!wpa_cli_cmd_v("set_network %d pairwise CCMP", + resp.network_id)) { + goto out; + } } } else if (params->security == WIFI_SECURITY_TYPE_WPA_AUTO_PERSONAL) { if (!wpa_cli_cmd_v("set_network %d psk \"%s\"", resp.network_id, @@ -806,6 +831,14 @@ static int wpas_add_and_config_network(struct wpa_supplicant *wpa_s, resp.network_id)) { goto out; } + + if (!wpa_cli_cmd_v("set_network %d group CCMP", resp.network_id)) { + goto out; + } + + if (!wpa_cli_cmd_v("set_network %d pairwise CCMP", resp.network_id)) { + goto out; + } #ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE } else if (is_eap_valid_security(params->security)) { if (process_cipher_config(params, &cipher_config)) { From 99b2e349decfd5a91294552de7c253aa540e86ad Mon Sep 17 00:00:00 2001 From: Qingling Wu Date: Fri, 30 May 2025 02:29:20 -0700 Subject: [PATCH 0241/2141] [nrf fromtree] manifest: hostap: sync for coverity fix sync for coverity fix in hostap Signed-off-by: Qingling Wu (cherry picked from commit f089959651d8894243ae9cd25f7d32b5d6d1b859) --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 9e29918fb21b..c7f54a8dda81 100644 --- a/west.yml +++ b/west.yml @@ -281,7 +281,7 @@ manifest: - hal - name: hostap path: modules/lib/hostap - revision: 8412f4b23b6267ee6035d25515a23aaf243f6ad7 + revision: cf270006050cf944af699301c7f4de2b427cd862 - name: liblc3 revision: 48bbd3eacd36e99a57317a0a4867002e0b09e183 path: modules/lib/liblc3 From 7e7af912181ef1558dc827f28b41f2bc42925e29 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Thu, 22 May 2025 11:21:26 +0300 Subject: [PATCH 0242/2141] [nrf fromtree] manifest: Use k_fifo for IPC in hostap Make sure to use k_fifo for IPC in hostap to save memory. Signed-off-by: Jukka Rissanen (cherry picked from commit 03ad3a32a27da098fc697376e2932c36b85c3509) --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index c7f54a8dda81..e1ff77d7c2be 100644 --- a/west.yml +++ b/west.yml @@ -281,7 +281,7 @@ manifest: - hal - name: hostap path: modules/lib/hostap - revision: cf270006050cf944af699301c7f4de2b427cd862 + revision: bc5d22f5838d017b889d1452a5854f9a32895414 - name: liblc3 revision: 48bbd3eacd36e99a57317a0a4867002e0b09e183 path: modules/lib/liblc3 From f602a47bdf6ea3a2ee4374fdf731887c55cc43ba Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Wed, 9 Jul 2025 18:13:28 +0530 Subject: [PATCH 0243/2141] [nrf fromtree] manifest: hostap: Pull fix for warning in interface down Fix a warning seen during interface down. Signed-off-by: Chaitanya Tata (cherry picked from commit a869c3e3a31afa893a8c88f8761f8f206769ee27) --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index e1ff77d7c2be..d15e692caa4d 100644 --- a/west.yml +++ b/west.yml @@ -281,7 +281,7 @@ manifest: - hal - name: hostap path: modules/lib/hostap - revision: bc5d22f5838d017b889d1452a5854f9a32895414 + revision: e942f86e865d5b24bbbe8b0c333f030cbbe62bfb - name: liblc3 revision: 48bbd3eacd36e99a57317a0a4867002e0b09e183 path: modules/lib/liblc3 From ee7e5ec43237eccdf624b22e5833dd3b209aa635 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Fri, 18 Jul 2025 12:08:10 +0530 Subject: [PATCH 0244/2141] [nrf fromlist] modules: nrf_wifi: Fix bustest QSPI crash Commit 5e25283821a("drivers: wifi: Create dedicated mem pool for Wi-Fi driver") introduced OSAL dependecy in the Zephyr QSPI driver for HL read, but in bustest we don't enable nrf_wifi OS module, so, it crashes here. And we should not be using OSAL APIs in Zephyr code anyway. And in this case we don't even need to use the heap, so, move the rx buffer to stack. Upstream PR #: 93303 Signed-off-by: Chaitanya Tata (cherry picked from commit 107a77efda485ea5b2dfe6da9eb9a76faae8dca4) --- .../zephyr/drivers/wifi/nrf_wifi/bus/rpu_hw_if.h | 5 +++++ modules/nrf_wifi/bus/qspi_if.c | 15 ++++++--------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/include/zephyr/drivers/wifi/nrf_wifi/bus/rpu_hw_if.h b/include/zephyr/drivers/wifi/nrf_wifi/bus/rpu_hw_if.h index 2524b64ab505..2fecce9cdc7f 100644 --- a/include/zephyr/drivers/wifi/nrf_wifi/bus/rpu_hw_if.h +++ b/include/zephyr/drivers/wifi/nrf_wifi/bus/rpu_hw_if.h @@ -31,6 +31,11 @@ enum { NUM_MEM_BLOCKS }; +/* Keeping it higher to avoid changing it ofter, but modify this value + * if rpu_7002_memmap is changed. + */ +#define NRF_WIFI_QSPI_SLAVE_MAX_LATENCY 4 + extern char blk_name[][15]; extern uint32_t rpu_7002_memmap[][3]; diff --git a/modules/nrf_wifi/bus/qspi_if.c b/modules/nrf_wifi/bus/qspi_if.c index 949aa591274a..97bab6335c44 100644 --- a/modules/nrf_wifi/bus/qspi_if.c +++ b/modules/nrf_wifi/bus/qspi_if.c @@ -23,8 +23,8 @@ #include #include +#include #include "spi_nor.h" -#include "osal_api.h" /* The QSPI bus node which the NRF70 is on */ #define QSPI_IF_BUS_NODE DT_NODELABEL(qspi) @@ -1290,15 +1290,14 @@ int qspi_read(unsigned int addr, void *data, int len) int qspi_hl_readw(unsigned int addr, void *data) { int status; - uint8_t *rxb = NULL; uint32_t len = 4; + uint8_t rxb[4 + (NRF_WIFI_QSPI_SLAVE_MAX_LATENCY * 4)]; - len = len + (4 * qspi_cfg->qspi_slave_latency); + len += (4 * qspi_cfg->qspi_slave_latency); - rxb = nrf_wifi_osal_mem_alloc(len); - - if (rxb == NULL) { - LOG_ERR("%s: ERROR ENOMEM line %d", __func__, __LINE__); + if (len > sizeof(rxb)) { + LOG_ERR("%s: len exceeded, check NRF_WIFI_QSPI_SLAVE_MAX_LATENCY (len=%u, rxb=%zu)", + __func__, (unsigned int)len, sizeof(rxb)); return -ENOMEM; } @@ -1314,8 +1313,6 @@ int qspi_hl_readw(unsigned int addr, void *data) *(uint32_t *)data = *(uint32_t *)(rxb + (len - 4)); - nrf_wifi_osal_mem_free(rxb); - return status; } From 6ec35ab31bc406a96f282cd0520aff5fba8ca664 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Sun, 20 Jul 2025 13:43:25 +0530 Subject: [PATCH 0245/2141] [nrf fromlist] drivers: nrf_wifi: Fix deadlock in display scan and recovery When running Zperf traffic + scan in the background eventual we hit a deadlock: * sysworkq: recovery->stop_zep->vif_lock->hal_disable->wait lock_rx * nrf70_bh_wq: event_tasklet->lock_rx->disp_scan_done-> disp_scan_res_get_zep-> waiting on vif_lock The traffic triggers recovery (another bug) and conflicts with display scan. Fix by moving scan results processing to system workqueue instead of doing it in the FMAC event callback context, this is how supplicant scan also works. Upstream PR #: 93377 Signed-off-by: Chaitanya Tata (cherry picked from commit 5a516ec053a6973c98778f582dd646f44df260f5) --- drivers/wifi/nrf_wifi/inc/fmac_main.h | 1 + drivers/wifi/nrf_wifi/src/fmac_main.c | 30 +++++++++++++++++++++------ 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/drivers/wifi/nrf_wifi/inc/fmac_main.h b/drivers/wifi/nrf_wifi/inc/fmac_main.h index 2f49ed8b055f..c193515ae2dd 100644 --- a/drivers/wifi/nrf_wifi/inc/fmac_main.h +++ b/drivers/wifi/nrf_wifi/inc/fmac_main.h @@ -52,6 +52,7 @@ struct nrf_wifi_vif_ctx_zep { uint16_t max_bss_cnt; unsigned int scan_res_cnt; struct k_work_delayable scan_timeout_work; + struct k_work disp_scan_res_work; struct net_eth_addr mac_addr; int if_type; diff --git a/drivers/wifi/nrf_wifi/src/fmac_main.c b/drivers/wifi/nrf_wifi/src/fmac_main.c index 92a58be9a099..379c3242b182 100644 --- a/drivers/wifi/nrf_wifi/src/fmac_main.c +++ b/drivers/wifi/nrf_wifi/src/fmac_main.c @@ -171,12 +171,8 @@ void nrf_wifi_event_proc_scan_done_zep(void *vif_ctx, switch (vif_ctx_zep->scan_type) { #ifdef CONFIG_NET_L2_WIFI_MGMT case SCAN_DISPLAY: - status = nrf_wifi_disp_scan_res_get_zep(vif_ctx_zep); - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: nrf_wifi_disp_scan_res_get_zep failed", __func__); - return; - } - vif_ctx_zep->scan_in_progress = false; + /* Schedule scan result processing in system workqueue to avoid deadlock */ + k_work_submit(&vif_ctx_zep->disp_scan_res_work); break; #endif /* CONFIG_NET_L2_WIFI_MGMT */ #ifdef CONFIG_NRF70_STA_MODE @@ -242,6 +238,26 @@ void nrf_wifi_scan_timeout_work(struct k_work *work) vif_ctx_zep->scan_in_progress = false; } +void nrf_wifi_disp_scan_res_work_handler(struct k_work *work) +{ + struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; + enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; + + vif_ctx_zep = CONTAINER_OF(work, struct nrf_wifi_vif_ctx_zep, disp_scan_res_work); + + if (!vif_ctx_zep) { + LOG_ERR("%s: vif_ctx_zep is NULL", __func__); + return; + } + + status = nrf_wifi_disp_scan_res_get_zep(vif_ctx_zep); + if (status != NRF_WIFI_STATUS_SUCCESS) { + LOG_ERR("%s: nrf_wifi_disp_scan_res_get_zep failed", __func__); + return; + } + vif_ctx_zep->scan_in_progress = false; +} + #ifdef CONFIG_NRF70_STA_MODE static void nrf_wifi_process_rssi_from_rx(void *vif_ctx, signed short signal) @@ -837,6 +853,8 @@ static int nrf_wifi_drv_main_zep(const struct device *dev) #else k_work_init_delayable(&vif_ctx_zep->scan_timeout_work, nrf_wifi_scan_timeout_work); + k_work_init(&vif_ctx_zep->disp_scan_res_work, + nrf_wifi_disp_scan_res_work_handler); #endif /* CONFIG_NRF70_RADIO_TEST */ k_mutex_init(&rpu_drv_priv_zep.rpu_ctx_zep.rpu_lock); From 7393d5b087e428f72bcedecd9da7260744ee01f9 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 9 Jun 2025 09:29:14 +0300 Subject: [PATCH 0246/2141] [nrf fromtree] lib: zvfs: Add default eventfd count for hostap hostap needs more eventfd to function so set a proper default value. Signed-off-by: Jukka Rissanen (cherry picked from commit 410afbaf198902077c3884257b34b333999c944b) --- lib/os/zvfs/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/os/zvfs/Kconfig b/lib/os/zvfs/Kconfig index 101e2cce0864..a9c9518a1d5d 100644 --- a/lib/os/zvfs/Kconfig +++ b/lib/os/zvfs/Kconfig @@ -26,6 +26,7 @@ if ZVFS_EVENTFD config ZVFS_EVENTFD_MAX int "Maximum number of ZVFS eventfd's" + default 8 if WIFI_NM_WPA_SUPPLICANT default 1 range 1 4096 help From 14324541dbc20b242c6d6e5ff0a16acdd10a06fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Ku=C5=BAnia?= Date: Wed, 16 Jul 2025 14:44:03 +0200 Subject: [PATCH 0247/2141] [nrf fromtree] drivers: ieee802154: nrf5: drop packets that are too long MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There was an observed situation where the assert checking frame length is below 128 bytes was hit. While the nrf-802154 checks that the frame does not exceed that size, there might exists code paths that allow such packets to pass through. The change removes the assert and drops the packet instead. An error is also printed to allow for further debugging. Signed-off-by: Rafał Kuźnia (cherry picked from commit 5925d718eff7324a5925e4b07885753c3ae80513) --- drivers/ieee802154/ieee802154_nrf5.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/ieee802154/ieee802154_nrf5.c b/drivers/ieee802154/ieee802154_nrf5.c index 25ec35961c79..e5051e731f43 100644 --- a/drivers/ieee802154/ieee802154_nrf5.c +++ b/drivers/ieee802154/ieee802154_nrf5.c @@ -179,7 +179,12 @@ static void nrf5_rx_thread(void *arg1, void *arg2, void *arg3) } #if defined(CONFIG_NET_BUF_DATA_SIZE) - __ASSERT_NO_MSG(pkt_len <= CONFIG_NET_BUF_DATA_SIZE); + if (pkt_len > CONFIG_NET_BUF_DATA_SIZE) { + LOG_ERR("Received a frame exceeding the buffer size (%u): %u", + CONFIG_NET_BUF_DATA_SIZE, pkt_len); + LOG_HEXDUMP_ERR(rx_frame->psdu, rx_frame->psdu[0] + 1, "Received PSDU"); + goto drop; + } #endif LOG_DBG("Frame received"); @@ -232,7 +237,9 @@ static void nrf5_rx_thread(void *arg1, void *arg2, void *arg3) rx_frame->psdu = NULL; nrf_802154_buffer_free_raw(psdu); - net_pkt_unref(pkt); + if (pkt) { + net_pkt_unref(pkt); + } } } From 7fe19a72a85c5e1389250ef76db13b7fff5f9883 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Ku=C5=BAnia?= Date: Mon, 14 Jul 2025 14:51:13 +0200 Subject: [PATCH 0248/2141] [nrf fromtree] drivers: ieee802154: nrf5: prevent negative timestamps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The nrf-802154 driver may be unable to acquire a valid timestamp under rare conditions. In such case, the nrf_802154_received_timestamp_raw reports time=NRF_802154_NO_TIMESTAMP. The shim implementation must not calculate the PHR timestamp when receiving this value, because doing so results in an assert in ptp_packet.h due to a negative time value. When the driver is unable to capture the timestamp, the packet is assigned zero as its timestamp. Signed-off-by: Rafał Kuźnia (cherry picked from commit 3cccfa5f6494677e821255ca162e452285607378) --- drivers/ieee802154/ieee802154_nrf5.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/ieee802154/ieee802154_nrf5.c b/drivers/ieee802154/ieee802154_nrf5.c index e5051e731f43..aa67a1f99e15 100644 --- a/drivers/ieee802154/ieee802154_nrf5.c +++ b/drivers/ieee802154/ieee802154_nrf5.c @@ -1121,8 +1121,12 @@ void nrf_802154_received_timestamp_raw(uint8_t *data, int8_t power, uint8_t lqi, nrf5_data.rx_frames[i].lqi = lqi; #if defined(CONFIG_NET_PKT_TIMESTAMP) - nrf5_data.rx_frames[i].time = - nrf_802154_timestamp_end_to_phr_convert(time, data[0]); + if (time != NRF_802154_NO_TIMESTAMP) { + nrf5_data.rx_frames[i].time = + nrf_802154_timestamp_end_to_phr_convert(time, data[0]); + } else { + nrf5_data.rx_frames[i].time = 0; + } #endif nrf5_data.rx_frames[i].ack_fpb = nrf5_data.last_frame_ack_fpb; From 196735ca2526e9ae81282be1953e6cfc9d74b331 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Mon, 7 Jul 2025 09:13:24 +0200 Subject: [PATCH 0249/2141] [nrf fromtree] samples: boards: nordic: system_off: Cleanup after nRF54LM20 rename MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove duplicated test configuration after nrf54l20pdk/nrf54l20/cpuxxx was renamed to nrf54lm20dk/nrf54lm20a/cpuxxx. Signed-off-by: Sebastian Głąb (cherry picked from commit 1c221bc73256d0db27e2c0f4cf7f50a6ab09b6aa) --- .../nrf54l20pdk_nrf54l20_cpuapp.overlay | 25 ------------------- samples/boards/nordic/system_off/sample.yaml | 4 --- 2 files changed, 29 deletions(-) delete mode 100644 samples/boards/nordic/system_off/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay diff --git a/samples/boards/nordic/system_off/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/samples/boards/nordic/system_off/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay deleted file mode 100644 index 3a79636a4833..000000000000 --- a/samples/boards/nordic/system_off/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay +++ /dev/null @@ -1,25 +0,0 @@ -/ { - cpuapp_sram@2007ec00 { - compatible = "zephyr,memory-region", "mmio-sram"; - reg = <0x2007ec00 DT_SIZE_K(4)>; - zephyr,memory-region = "RetainedMem"; - status = "okay"; - - retainedmem0: retainedmem { - compatible = "zephyr,retained-ram"; - status = "okay"; - }; - }; - - aliases { - retainedmemdevice = &retainedmem0; - }; -}; - -&cpuapp_sram { - /* Shrink SRAM size to avoid overlap with retained memory region: - * 511 - 4 = 507KB = 0x7ec00 - */ - reg = <0x20000000 DT_SIZE_K(507)>; - ranges = <0x0 0x20000000 0x7ec00>; -}; diff --git a/samples/boards/nordic/system_off/sample.yaml b/samples/boards/nordic/system_off/sample.yaml index 9b0e39a6cea1..b11f3439e7f6 100644 --- a/samples/boards/nordic/system_off/sample.yaml +++ b/samples/boards/nordic/system_off/sample.yaml @@ -14,7 +14,6 @@ tests: - nrf54l15dk/nrf54l05/cpuapp - nrf54l15dk/nrf54l10/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp harness: console harness_config: @@ -34,7 +33,6 @@ tests: - nrf54l15dk/nrf54l05/cpuapp - nrf54l15dk/nrf54l10/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp extra_configs: - CONFIG_APP_USE_RETAINED_MEM=y @@ -54,7 +52,6 @@ tests: - nrf54l15dk/nrf54l05/cpuapp - nrf54l15dk/nrf54l10/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp extra_configs: - CONFIG_GRTC_WAKEUP_ENABLE=y @@ -79,7 +76,6 @@ tests: - nrf54l15dk/nrf54l05/cpuapp - nrf54l15dk/nrf54l10/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp extra_configs: - CONFIG_APP_USE_RETAINED_MEM=y From 23fb232f5a3357992357380c75db1f52d065d7ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Mon, 7 Jul 2025 09:16:10 +0200 Subject: [PATCH 0250/2141] [nrf fromtree] samples: drivers: adc: adc_dt: Enable sample on nrf54lm20dk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add overlay required to run the sample on nrf54lm20dk/nrf54lm20a/cpuapp. Signed-off-by: Sebastian Głąb (cherry picked from commit 8892550b21721f071dd168adf4560e04f671f7bd) --- .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 56 +++++++++++++++++++ samples/drivers/adc/adc_dt/sample.yaml | 3 +- 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 samples/drivers/adc/adc_dt/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay diff --git a/samples/drivers/adc/adc_dt/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/samples/drivers/adc/adc_dt/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay new file mode 100644 index 000000000000..8953de6a5475 --- /dev/null +++ b/samples/drivers/adc/adc_dt/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +/ { + zephyr,user { + io-channels = <&adc 0>, <&adc 1>, <&adc 2>, <&adc 7>; + }; +}; + +&adc { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + channel@0 { + reg = <0>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,input-positive = ; /* P1.06 */ + zephyr,resolution = <10>; + }; + + channel@1 { + reg = <1>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,input-positive = ; /* P1.30 */ + zephyr,resolution = <12>; + zephyr,oversampling = <8>; + }; + + channel@2 { + reg = <2>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,input-positive = ; + zephyr,resolution = <12>; + zephyr,oversampling = <8>; + }; + + channel@7 { + reg = <7>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,input-positive = ; /* P1.04 */ + zephyr,input-negative = ; /* P1.03 */ + zephyr,resolution = <12>; + }; +}; diff --git a/samples/drivers/adc/adc_dt/sample.yaml b/samples/drivers/adc/adc_dt/sample.yaml index 1592685e9f72..2a32be6983b2 100644 --- a/samples/drivers/adc/adc_dt/sample.yaml +++ b/samples/drivers/adc/adc_dt/sample.yaml @@ -15,8 +15,9 @@ tests: - stm32h735g_disco - nrf51dk/nrf51822 - nrf52840dk/nrf52840 - - nrf54l15dk/nrf54l15/cpuapp - nrf54h20dk/nrf54h20/cpuapp + - nrf54l15dk/nrf54l15/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp - mec172xevb_assy6906 - gd32f350r_eval From 8a76c39ec17e3b7672d120ade2d2c89543075a17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Mon, 16 Jun 2025 08:35:22 +0200 Subject: [PATCH 0251/2141] [nrf fromtree] samples: drivers: adc_sequence: Remove misleading parts of nRF overlays MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove parts of overlays for nRF targets that were just copied from the adc_dt sample but are not used by the adc_sequence sample and only generate confusion here. Signed-off-by: Andrzej Głąbek (cherry picked from commit dea8a3e73256dbb8f05188a446c842794ebdefd6) --- .../adc_sequence/boards/nrf52840dk_nrf52840.overlay | 1 - .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 12 ------------ .../boards/nrf54l15dk_nrf54l15_cpuapp.overlay | 12 ------------ 3 files changed, 25 deletions(-) diff --git a/samples/drivers/adc/adc_sequence/boards/nrf52840dk_nrf52840.overlay b/samples/drivers/adc/adc_sequence/boards/nrf52840dk_nrf52840.overlay index 34107d84748e..99a0e7089ca7 100644 --- a/samples/drivers/adc/adc_sequence/boards/nrf52840dk_nrf52840.overlay +++ b/samples/drivers/adc/adc_sequence/boards/nrf52840dk_nrf52840.overlay @@ -28,6 +28,5 @@ zephyr,reference = "ADC_REF_INTERNAL"; zephyr,acquisition-time = ; zephyr,input-positive = ; - zephyr,oversampling = <8>; }; }; diff --git a/samples/drivers/adc/adc_sequence/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/samples/drivers/adc/adc_sequence/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index 24cce679375a..d4f9e8db7c2b 100644 --- a/samples/drivers/adc/adc_sequence/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/samples/drivers/adc/adc_sequence/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -10,12 +10,6 @@ }; }; -/ { - zephyr,user { - io-channels = <&adc 0>, <&adc 1>, <&adc 2>, <&adc 7>; - }; -}; - &adc { #address-cells = <1>; #size-cells = <0>; @@ -26,7 +20,6 @@ zephyr,reference = "ADC_REF_INTERNAL"; zephyr,acquisition-time = ; zephyr,input-positive = ; /* P1.01 */ - zephyr,resolution = <10>; }; channel@1 { @@ -35,8 +28,6 @@ zephyr,reference = "ADC_REF_INTERNAL"; zephyr,acquisition-time = ; zephyr,input-positive = ; /* P1.02 */ - zephyr,resolution = <12>; - zephyr,oversampling = <8>; }; channel@2 { @@ -46,8 +37,6 @@ zephyr,acquisition-time = ; zephyr,input-positive = ; /* P9.01 */ zephyr,vref-mv = <3686>; /* 3.6V * 1024 */ - zephyr,resolution = <12>; - zephyr,oversampling = <8>; }; channel@7 { @@ -57,6 +46,5 @@ zephyr,acquisition-time = ; zephyr,input-positive = ; /* P1.03 */ zephyr,input-negative = ; /* P1.07 */ - zephyr,resolution = <12>; }; }; diff --git a/samples/drivers/adc/adc_sequence/boards/nrf54l15dk_nrf54l15_cpuapp.overlay b/samples/drivers/adc/adc_sequence/boards/nrf54l15dk_nrf54l15_cpuapp.overlay index 7fedbe52ad2f..87b8e373f1db 100644 --- a/samples/drivers/adc/adc_sequence/boards/nrf54l15dk_nrf54l15_cpuapp.overlay +++ b/samples/drivers/adc/adc_sequence/boards/nrf54l15dk_nrf54l15_cpuapp.overlay @@ -4,12 +4,6 @@ * Copyright (c) 2024 Nordic Semiconductor ASA */ -/ { - zephyr,user { - io-channels = <&adc 0>, <&adc 1>, <&adc 2>, <&adc 7>; - }; -}; - / { aliases { adc0 = &adc; @@ -26,7 +20,6 @@ zephyr,reference = "ADC_REF_INTERNAL"; zephyr,acquisition-time = ; zephyr,input-positive = ; /* P1.11 */ - zephyr,resolution = <10>; }; channel@1 { @@ -35,8 +28,6 @@ zephyr,reference = "ADC_REF_INTERNAL"; zephyr,acquisition-time = ; zephyr,input-positive = ; /* P1.06 */ - zephyr,resolution = <12>; - zephyr,oversampling = <8>; }; channel@2 { @@ -45,8 +36,6 @@ zephyr,reference = "ADC_REF_INTERNAL"; zephyr,acquisition-time = ; zephyr,input-positive = ; /* 0.9 V internal */ - zephyr,resolution = <12>; - zephyr,oversampling = <8>; }; channel@7 { @@ -56,6 +45,5 @@ zephyr,acquisition-time = ; zephyr,input-positive = ; /* P1.13 */ zephyr,input-negative = ; /* P1.14 */ - zephyr,resolution = <12>; }; }; From 7babfb39f48bd4eebadd5dee62567fefb25111cb Mon Sep 17 00:00:00 2001 From: Jakub Zymelka Date: Wed, 28 May 2025 13:38:02 +0200 Subject: [PATCH 0252/2141] [nrf fromtree] samples: drivers: adc: Add variant for 8-bit resolution on nRF54x Add sample variant to run code in 8-bit resolution on nRF54x series. Signed-off-by: Jakub Zymelka (cherry picked from commit 7c14d7e6c672f20239cb3fc575874506cb18d33a) --- samples/drivers/adc/adc_sequence/sample.yaml | 31 +++++++++++++------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/samples/drivers/adc/adc_sequence/sample.yaml b/samples/drivers/adc/adc_sequence/sample.yaml index 9a824045d130..09edd4cc03ce 100644 --- a/samples/drivers/adc/adc_sequence/sample.yaml +++ b/samples/drivers/adc/adc_sequence/sample.yaml @@ -1,10 +1,19 @@ sample: name: ADC driver sequence sample +common: + tags: + - adc + depends_on: adc + harness: console + timeout: 10 + harness_config: + type: multi_line + regex: + - "ADC sequence reading \\[\\d+\\]:" + - "- .+, channel \\d+, \\d+ sequence samples:" + - "- - \\d+ (= \\d+mV)|(\\(value in mV not available\\))" tests: sample.drivers.adc.adc_sequence: - tags: - - adc - depends_on: adc platform_allow: - cy8cproto_063_ble - cy8cproto_062_4343w @@ -18,11 +27,11 @@ tests: - stm32f3_disco integration_platforms: - nrf52840dk/nrf52840 - harness: console - timeout: 10 - harness_config: - type: multi_line - regex: - - "ADC sequence reading \\[\\d+\\]:" - - "- .+, channel \\d+, \\d+ sequence samples:" - - "- - \\d+ (= \\d+mV)|(\\(value in mV not available\\))" + sample.drivers.adc.adc_sequence.8bit: + platform_allow: + - nrf54l15dk/nrf54l15/cpuapp + - nrf54h20dk/nrf54h20/cpuapp + integration_platforms: + - nrf54l15dk/nrf54l15/cpuapp + extra_configs: + - CONFIG_SEQUENCE_RESOLUTION=8 From 0c5e5ca00cbb8239f73e1f6afcd44b5781b58f20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Mon, 7 Jul 2025 09:39:28 +0200 Subject: [PATCH 0253/2141] [nrf fromtree] samples: drivers: adc: adc_sequence: Enable sample on nrf54lm20dk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add overlay required to run the sample on nrf54lm20dk/nrf54lm20a/cpuapp. Signed-off-by: Sebastian Głąb (cherry picked from commit 3c9368bc506666c50335f3f81604fcbf48382ed7) --- .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 50 +++++++++++++++++++ samples/drivers/adc/adc_sequence/sample.yaml | 6 ++- 2 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 samples/drivers/adc/adc_sequence/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay diff --git a/samples/drivers/adc/adc_sequence/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/samples/drivers/adc/adc_sequence/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay new file mode 100644 index 000000000000..a85e9e7e611c --- /dev/null +++ b/samples/drivers/adc/adc_sequence/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +/ { + aliases { + adc0 = &adc; + }; +}; + +&adc { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + channel@0 { + reg = <0>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,input-positive = ; /* P1.06 */ + }; + + channel@1 { + reg = <1>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,input-positive = ; /* P1.30 */ + }; + + channel@2 { + reg = <2>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,input-positive = ; /* 0.9 V internal */ + }; + + channel@7 { + reg = <7>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,input-positive = ; /* P1.04 */ + zephyr,input-negative = ; /* P1.03 */ + }; +}; diff --git a/samples/drivers/adc/adc_sequence/sample.yaml b/samples/drivers/adc/adc_sequence/sample.yaml index 09edd4cc03ce..affa120345ba 100644 --- a/samples/drivers/adc/adc_sequence/sample.yaml +++ b/samples/drivers/adc/adc_sequence/sample.yaml @@ -18,8 +18,9 @@ tests: - cy8cproto_063_ble - cy8cproto_062_4343w - nrf52840dk/nrf52840 - - nrf54l15dk/nrf54l15/cpuapp - nrf54h20dk/nrf54h20/cpuapp + - nrf54l15dk/nrf54l15/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp - raytac_an54l15q_db/nrf54l15/cpuapp - ucans32k1sic @@ -29,8 +30,9 @@ tests: - nrf52840dk/nrf52840 sample.drivers.adc.adc_sequence.8bit: platform_allow: - - nrf54l15dk/nrf54l15/cpuapp - nrf54h20dk/nrf54h20/cpuapp + - nrf54l15dk/nrf54l15/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp integration_platforms: - nrf54l15dk/nrf54l15/cpuapp extra_configs: From 8032459514ca951644ab1a2fff64bd3f918a3ad0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Mon, 7 Jul 2025 09:40:54 +0200 Subject: [PATCH 0254/2141] [nrf fromtree] samples: drivers: audio: dmic: Cleanup after nRF54LM20 rename MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove duplicated test configuration after nrf54l20pdk/nrf54l20/cpuxxx was renamed to nrf54lm20dk/nrf54lm20a/cpuxxx. Signed-off-by: Sebastian Głąb (cherry picked from commit 94d35ec0ce7b588e2388b68cb42ec83e3990ad24) --- .../nrf54l20pdk_nrf54l20_cpuapp.overlay | 21 ------------------- .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 4 ++++ 2 files changed, 4 insertions(+), 21 deletions(-) delete mode 100644 samples/drivers/audio/dmic/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay diff --git a/samples/drivers/audio/dmic/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/samples/drivers/audio/dmic/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay deleted file mode 100644 index 3699a9e9563e..000000000000 --- a/samples/drivers/audio/dmic/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&pinctrl { - pdm20_default_alt: pdm20_default_alt { - group1 { - psels = , - ; - }; - }; -}; - -dmic_dev: &pdm20 { - status = "okay"; - pinctrl-0 = <&pdm20_default_alt>; - pinctrl-names = "default"; - clock-source = "PCLK32M"; -}; diff --git a/samples/drivers/audio/dmic/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/samples/drivers/audio/dmic/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay index c850cede53d0..b3e08098722d 100644 --- a/samples/drivers/audio/dmic/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ b/samples/drivers/audio/dmic/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -4,6 +4,10 @@ * SPDX-License-Identifier: Apache-2.0 */ +/* Test requires loopback between P1.23 and P1.24. + * For best performance, PDM_CLK shall be on 'Clock pin'. + */ + &pinctrl { pdm20_default_alt: pdm20_default_alt { group1 { From 7584dae8ce9f9269b8301340f3f8cdb91ddf8bbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Mon, 7 Jul 2025 09:42:20 +0200 Subject: [PATCH 0255/2141] [nrf fromtree] samples: drivers: counter: alarm: Cleanup platform_allow for nrf54* MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove duplicated test configuration after nrf54l20pdk/nrf54l20/cpuxxx was renamed to nrf54lm20dk/nrf54lm20a/cpuxxx. Extend platform_allow with other nrf54* targets (overlays for these targets already exist in the boards directory). Signed-off-by: Sebastian Głąb (cherry picked from commit 589c85dc973cb17b74abf16c31b17833477e8672) --- .../alarm/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay | 9 --------- samples/drivers/counter/alarm/sample.yaml | 7 +++++++ 2 files changed, 7 insertions(+), 9 deletions(-) delete mode 100644 samples/drivers/counter/alarm/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay diff --git a/samples/drivers/counter/alarm/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/samples/drivers/counter/alarm/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay deleted file mode 100644 index 0847233437ba..000000000000 --- a/samples/drivers/counter/alarm/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay +++ /dev/null @@ -1,9 +0,0 @@ -/ { - chosen { - counter = &timer24; - }; -}; - -&timer24 { - status = "okay"; -}; diff --git a/samples/drivers/counter/alarm/sample.yaml b/samples/drivers/counter/alarm/sample.yaml index c3f141f680d1..1b4c34b9146f 100644 --- a/samples/drivers/counter/alarm/sample.yaml +++ b/samples/drivers/counter/alarm/sample.yaml @@ -21,6 +21,13 @@ tests: - nrf51dk/nrf51822 - nrf52dk/nrf52832 - nrf52840dk/nrf52840 + - nrf54h20dk/nrf54h20/cpuapp + - nrf54h20dk/nrf54h20/cpuflpr + - nrf54h20dk/nrf54h20/cpuppr + - nrf54h20dk/nrf54h20/cpurad + - nrf54l15dk/nrf54l15/cpuapp + - nrf54l15dk/nrf54l15/cpuflpr + - nrf54lm20dk/nrf54lm20a/cpuapp - nrf9160dk/nrf9160 - samd20_xpro - bl5340_dvk/nrf5340/cpuapp From 315cc6e208e4f1eccf5159d6623389573dd45361 Mon Sep 17 00:00:00 2001 From: Etienne Carriere Date: Thu, 19 Jun 2025 13:13:38 +0200 Subject: [PATCH 0256/2141] [nrf fromtree] samples: drivers: i2c: rtio_loopback: add nucleo_f401re/nucleo_h503rb Add nucleo_f401re and nucleo_h503rb boards to rtio_loopback tests on the I2C driver. Signed-off-by: Etienne Carriere (cherry picked from commit f32cd9330b696243096e84abb26c2419d81c6c37) --- .../boards/nucleo_f401re.overlay | 18 +++++++++++ .../boards/nucleo_h503rb.overlay | 32 +++++++++++++++++++ samples/drivers/i2c/rtio_loopback/sample.yaml | 2 ++ 3 files changed, 52 insertions(+) create mode 100644 samples/drivers/i2c/rtio_loopback/boards/nucleo_f401re.overlay create mode 100644 samples/drivers/i2c/rtio_loopback/boards/nucleo_h503rb.overlay diff --git a/samples/drivers/i2c/rtio_loopback/boards/nucleo_f401re.overlay b/samples/drivers/i2c/rtio_loopback/boards/nucleo_f401re.overlay new file mode 100644 index 000000000000..ffd09691a216 --- /dev/null +++ b/samples/drivers/i2c/rtio_loopback/boards/nucleo_f401re.overlay @@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +/* I2C bus pins are exposed on the ST morpho and Arduino headers. + * + * Bus SDA SCL + * Pin Hdr Pin Hdr + * i2c1 PB9 CN5:9 PB8 CN5:10 + * i2c3 PC9 CN10:1 PA8 CN9:8 + * + * Short Pin PB9 to PC9, and PB8 to PA8, for the test to pass. + */ + +/ { + aliases { + i2c-controller = &i2c1; + i2c-controller-target = &i2c3; + }; +}; diff --git a/samples/drivers/i2c/rtio_loopback/boards/nucleo_h503rb.overlay b/samples/drivers/i2c/rtio_loopback/boards/nucleo_h503rb.overlay new file mode 100644 index 000000000000..b53a0560eb64 --- /dev/null +++ b/samples/drivers/i2c/rtio_loopback/boards/nucleo_h503rb.overlay @@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +/* I2C bus pins are exposed on the ST morpho and Arduino headers. + * + * Bus SDA SCL + * Pin Hdr Pin Hdr + * i2c1 PB7 CN5:9 PB6 CN5:10/CN10:3 + * i2c2 PB4 CN9:6/CN10:27 PB5 CN9:5/CN10:29 + * + * Short Pin PB7 to PB4, and PB6 to PB5, for the test to pass. + */ + +/ { + aliases { + i2c-controller = &i2c1; + i2c-controller-target = &i2c2; + }; +}; + +&i2c1 { + pinctrl-0 = <&i2c1_scl_pb6 &i2c1_sda_pb7>; + pinctrl-names = "default"; + clock-frequency = ; + status = "okay"; +}; + +&i2c2 { + pinctrl-0 = <&i2c2_scl_pb5 &i2c2_sda_pb4>; + pinctrl-names = "default"; + clock-frequency = ; + status = "okay"; +}; diff --git a/samples/drivers/i2c/rtio_loopback/sample.yaml b/samples/drivers/i2c/rtio_loopback/sample.yaml index cf081c7670c7..a18bfb940703 100644 --- a/samples/drivers/i2c/rtio_loopback/sample.yaml +++ b/samples/drivers/i2c/rtio_loopback/sample.yaml @@ -16,4 +16,6 @@ tests: - nrf5340dk/nrf5340/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54h20dk/nrf54h20/cpuapp + - nucleo_f401re + - nucleo_h503rb - ophelia4ev/nrf54l15/cpuapp From 0d0d6409cad69af02fb9e716a3d439cbb04cd4a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Mon, 7 Jul 2025 09:44:07 +0200 Subject: [PATCH 0257/2141] [nrf fromtree] samples: drivers: i2c: rtio_loopback: Enable sample on nrf54lm20dk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add overlay required to run the sample on nrf54lm20dk/nrf54lm20a/cpuapp. Signed-off-by: Sebastian Głąb (cherry picked from commit fc164f43a0e00ff8b2633e7e67d3956e5f677f77) --- .../boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf | 4 ++ .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 67 +++++++++++++++++++ samples/drivers/i2c/rtio_loopback/sample.yaml | 3 +- 3 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 samples/drivers/i2c/rtio_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf create mode 100644 samples/drivers/i2c/rtio_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay diff --git a/samples/drivers/i2c/rtio_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf b/samples/drivers/i2c/rtio_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf new file mode 100644 index 000000000000..7dfef7da2839 --- /dev/null +++ b/samples/drivers/i2c/rtio_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf @@ -0,0 +1,4 @@ +# Copyright (c) 2025 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_I2C_NRFX_TWIS_BUF_SIZE=256 diff --git a/samples/drivers/i2c/rtio_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/samples/drivers/i2c/rtio_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay new file mode 100644 index 000000000000..1fc56cc63298 --- /dev/null +++ b/samples/drivers/i2c/rtio_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * SDA = P1.13 and P1.14 + * SCL = P1.23 and P1.24 + */ + +/ { + aliases { + i2c-controller = &i2c21; + i2c-controller-target = &i2c22; + }; +}; + +&pinctrl { + i2c21_default: i2c21_default { + group1 { + psels = , + ; + bias-pull-up; + }; + }; + + i2c21_sleep: i2c21_sleep { + group1 { + psels = , + ; + low-power-enable; + }; + }; + + i2c22_default: i2c22_default { + group1 { + psels = , + ; + bias-pull-up; + }; + }; + + i2c22_sleep: i2c22_sleep { + group1 { + psels = , + ; + low-power-enable; + }; + }; +}; + +&i2c21 { + pinctrl-0 = <&i2c21_default>; + pinctrl-1 = <&i2c21_sleep>; + pinctrl-names = "default", "sleep"; + zephyr,concat-buf-size = <256>; + status = "okay"; +}; + +&i2c22 { + compatible = "nordic,nrf-twis"; + pinctrl-0 = <&i2c22_default>; + pinctrl-1 = <&i2c22_sleep>; + pinctrl-names = "default", "sleep"; + status = "okay"; +}; diff --git a/samples/drivers/i2c/rtio_loopback/sample.yaml b/samples/drivers/i2c/rtio_loopback/sample.yaml index a18bfb940703..a356a2697fdd 100644 --- a/samples/drivers/i2c/rtio_loopback/sample.yaml +++ b/samples/drivers/i2c/rtio_loopback/sample.yaml @@ -14,8 +14,9 @@ tests: platform_allow: - b_u585i_iot02a - nrf5340dk/nrf5340/cpuapp - - nrf54l15dk/nrf54l15/cpuapp - nrf54h20dk/nrf54h20/cpuapp + - nrf54l15dk/nrf54l15/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - nucleo_f401re - nucleo_h503rb - ophelia4ev/nrf54l15/cpuapp From 542d6893b1e9517667c6a964069ca5e40d0623b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Mon, 7 Jul 2025 09:45:42 +0200 Subject: [PATCH 0258/2141] [nrf fromtree] samples: drivers: jesd216: Enable sample on nrf54lm20dk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add overlay required to run the sample on nrf54lm20dk/nrf54lm20a/cpuapp. Signed-off-by: Sebastian Głąb (cherry picked from commit c25e0302ee6b756f8f6d547820e05a7680db8635) --- .../boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 9 +++++++++ samples/drivers/jesd216/sample.yaml | 13 +++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 samples/drivers/jesd216/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay diff --git a/samples/drivers/jesd216/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/samples/drivers/jesd216/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay new file mode 100644 index 000000000000..8a5afda2ab00 --- /dev/null +++ b/samples/drivers/jesd216/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&mx25r64 { + status = "okay"; +}; diff --git a/samples/drivers/jesd216/sample.yaml b/samples/drivers/jesd216/sample.yaml index 4be5e5defbbe..a5b661c492ce 100644 --- a/samples/drivers/jesd216/sample.yaml +++ b/samples/drivers/jesd216/sample.yaml @@ -21,6 +21,7 @@ tests: - hifive_unmatched/fu740/u74 - mimxrt1170_evk/mimxrt1176/cm7 - mimxrt1170_evk/mimxrt1176/cm4 + - nrf54lm20dk/nrf54lm20a/cpuapp filter: dt_compat_enabled("jedec,spi-nor") or dt_compat_enabled("jedec,mspi-nor") depends_on: spi sample.drivers.jesd216.nrf52840dk_spi: @@ -29,6 +30,18 @@ tests: platform_allow: nrf52840dk/nrf52840 integration_platforms: - nrf52840dk/nrf52840 + sample.drivers.jesd216.nrf54lm20: + platform_allow: + - nrf54lm20dk/nrf54lm20a/cpuapp + integration_platforms: + - nrf54lm20dk/nrf54lm20a/cpuapp + harness_config: + fixture: external_flash + type: multi_line + ordered: true + regex: + - "sfdp-bfp =" + - "jedec-id =" sample.drivers.stm32.jesd216: filter: dt_compat_enabled("st,stm32-xspi-nor") or dt_compat_enabled("st,stm32-ospi-nor") From 44b8333b73f517fa9bc4bc6fa07b1d6266f88854 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Mon, 7 Jul 2025 09:54:44 +0200 Subject: [PATCH 0259/2141] [nrf fromtree] samples: drivers: mbox: Cleanup after nRF54LM20 rename MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove duplicated test configuration after nrf54l20pdk/nrf54l20/cpuxxx was renamed to nrf54lm20dk/nrf54lm20a/cpuxxx. Signed-off-by: Sebastian Głąb (cherry picked from commit 537b1ef4e72ebb0a4792bc09fa427566c050101a) --- samples/drivers/mbox/CMakeLists.txt | 1 - samples/drivers/mbox/Kconfig.sysbuild | 1 - .../nrf54l20pdk_nrf54l20_cpuapp.overlay | 20 ---------------- samples/drivers/mbox/remote/CMakeLists.txt | 1 - .../nrf54l20pdk_nrf54l20_cpuflpr.overlay | 24 ------------------- samples/drivers/mbox/sample.yaml | 4 ---- samples/drivers/mbox/sysbuild.cmake | 1 + 7 files changed, 1 insertion(+), 51 deletions(-) delete mode 100644 samples/drivers/mbox/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay delete mode 100644 samples/drivers/mbox/remote/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay diff --git a/samples/drivers/mbox/CMakeLists.txt b/samples/drivers/mbox/CMakeLists.txt index 696b2317aa7c..d6bada1a50ed 100644 --- a/samples/drivers/mbox/CMakeLists.txt +++ b/samples/drivers/mbox/CMakeLists.txt @@ -27,7 +27,6 @@ if(CONFIG_BOARD_NRF5340DK_NRF5340_CPUAPP OR CONFIG_BOARD_NRF54H20DK_NRF54H20_CPURAD OR CONFIG_BOARD_NRF54L09PDK_NRF54L09_CPUAPP OR CONFIG_BOARD_NRF54L15DK_NRF54L15_CPUAPP OR - CONFIG_BOARD_NRF54L20PDK_NRF54L20_CPUAPP OR CONFIG_BOARD_NRF54LM20DK_NRF54LM20A_CPUAPP OR CONFIG_BOARD_STM32H747I_DISCO_STM32H747XX_M7 OR CONFIG_BOARD_BL54L15_DVK_NRF54L15_CPUAPP OR diff --git a/samples/drivers/mbox/Kconfig.sysbuild b/samples/drivers/mbox/Kconfig.sysbuild index 97402056c14e..76d3d240abce 100644 --- a/samples/drivers/mbox/Kconfig.sysbuild +++ b/samples/drivers/mbox/Kconfig.sysbuild @@ -21,7 +21,6 @@ config REMOTE_BOARD default "nrf54h20dk/nrf54h20/cpuapp" if "$(BOARD)${BOARD_QUALIFIERS}" = "nrf54h20dk/nrf54h20/cpurad" default "nrf54l09pdk/nrf54l09/cpuflpr" if $(BOARD) = "nrf54l09pdk" default "nrf54l15dk/nrf54l15/cpuflpr" if $(BOARD) = "nrf54l15dk" - default "nrf54l20pdk/nrf54l20/cpuflpr" if $(BOARD) = "nrf54l20pdk" default "nrf54lm20dk/nrf54lm20a/cpuflpr" if $(BOARD) = "nrf54lm20dk" default "ophelia4ev/cpuflpr" if $(BOARD) = "ophelia4ev" default "stm32h747i_disco/stm32h747xx/m4" if $(BOARD) = "stm32h747i_disco" diff --git a/samples/drivers/mbox/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/samples/drivers/mbox/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay deleted file mode 100644 index fd2f23402f5e..000000000000 --- a/samples/drivers/mbox/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2025 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - mbox-consumer { - compatible = "vnd,mbox-consumer"; - mboxes = <&cpuapp_vevif_rx 20>, <&cpuapp_vevif_tx 21>; - mbox-names = "rx", "tx"; - }; -}; - -&cpuapp_vevif_rx { - status = "okay"; -}; - -&cpuapp_vevif_tx { - status = "okay"; -}; diff --git a/samples/drivers/mbox/remote/CMakeLists.txt b/samples/drivers/mbox/remote/CMakeLists.txt index 48df8f0cb5b2..c84efec11977 100644 --- a/samples/drivers/mbox/remote/CMakeLists.txt +++ b/samples/drivers/mbox/remote/CMakeLists.txt @@ -26,7 +26,6 @@ if(CONFIG_BOARD_NRF5340DK_NRF5340_CPUNET OR CONFIG_BOARD_NRF54H20DK_NRF54H20_CPUAPP OR CONFIG_BOARD_NRF54L09PDK_NRF54L09_CPUFLPR OR CONFIG_BOARD_NRF54L15DK_NRF54L15_CPUFLPR OR - CONFIG_BOARD_NRF54L20PDK_NRF54L20_CPUFLPR OR CONFIG_BOARD_NRF54LM20DK_NRF54LM20A_CPUFLPR OR CONFIG_BOARD_STM32H747I_DISCO_STM32H747XX_M4 OR CONFIG_BOARD_BL54L15_DVK_NRF54L15_CPUFLPR OR diff --git a/samples/drivers/mbox/remote/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay b/samples/drivers/mbox/remote/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay deleted file mode 100644 index ea88120ad065..000000000000 --- a/samples/drivers/mbox/remote/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2025 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - mbox-consumer { - compatible = "vnd,mbox-consumer"; - mboxes = <&cpuflpr_vevif_rx 21>, <&cpuflpr_vevif_tx 20>; - mbox-names = "rx", "tx"; - }; -}; - -&cpuflpr_vevif_rx { - status = "okay"; -}; - -&cpuflpr_vevif_tx { - status = "okay"; -}; - -&uart30 { - /delete-property/ hw-flow-control; -}; diff --git a/samples/drivers/mbox/sample.yaml b/samples/drivers/mbox/sample.yaml index 1aee77b1c677..809d5e091dc4 100644 --- a/samples/drivers/mbox/sample.yaml +++ b/samples/drivers/mbox/sample.yaml @@ -12,7 +12,6 @@ tests: - nrf54h20dk/nrf54h20/cpurad - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp integration_platforms: - nrf5340bsim/nrf5340/cpuapp @@ -78,7 +77,6 @@ tests: platform_allow: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp integration_platforms: - nrf54l15dk/nrf54l15/cpuapp @@ -96,7 +94,6 @@ tests: platform_allow: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp integration_platforms: - nrf54l15dk/nrf54l15/cpuapp @@ -117,7 +114,6 @@ tests: platform_allow: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp integration_platforms: - nrf54l15dk/nrf54l15/cpuapp diff --git a/samples/drivers/mbox/sysbuild.cmake b/samples/drivers/mbox/sysbuild.cmake index 318027335147..0644500ca486 100644 --- a/samples/drivers/mbox/sysbuild.cmake +++ b/samples/drivers/mbox/sysbuild.cmake @@ -14,6 +14,7 @@ ExternalZephyrProject_Add( APPLICATION ${REMOTE_APP} SOURCE_DIR ${APP_DIR}/${REMOTE_APP} BOARD ${SB_CONFIG_REMOTE_BOARD} + BOARD_REVISION ${BOARD_REVISION} ) native_simulator_set_child_images(${DEFAULT_IMAGE} ${REMOTE_APP}) From 3bd1cb452c9ba417d68845bb1da4209402d934d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Mon, 7 Jul 2025 09:56:51 +0200 Subject: [PATCH 0260/2141] [nrf fromtree] samples: drivers: spi_bitbang: Enable sample on nrf54* targets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add overlays required to run the sample on - nrf54h20dk/nrf54h20/cpuapp, - nrf54l15dk/nrf54l15/cpuapp, - nrf54lm20dk/nrf54lm20a/cpuapp. Signed-off-by: Sebastian Głąb (cherry picked from commit e314eb649ac1131db7c91c5215685d13531cadeb) --- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 23 +++++++++++++++++++ .../boards/nrf54l15dk_nrf54l15_cpuapp.overlay | 23 +++++++++++++++++++ .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 23 +++++++++++++++++++ samples/drivers/spi_bitbang/sample.yaml | 9 +++++++- 4 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 samples/drivers/spi_bitbang/boards/nrf54h20dk_nrf54h20_cpuapp.overlay create mode 100644 samples/drivers/spi_bitbang/boards/nrf54l15dk_nrf54l15_cpuapp.overlay create mode 100644 samples/drivers/spi_bitbang/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay diff --git a/samples/drivers/spi_bitbang/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/samples/drivers/spi_bitbang/boards/nrf54h20dk_nrf54h20_cpuapp.overlay new file mode 100644 index 000000000000..255834ffd9a5 --- /dev/null +++ b/samples/drivers/spi_bitbang/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * Test requires loopback between P0.06 and P0.07. + * No other driver on SPI_CLK and SPI_CS. + */ + +/ { + spibb0: spibb0 { + compatible = "zephyr,spi-bitbang"; + status="okay"; + #address-cells = <1>; + #size-cells = <0>; + clk-gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>; + mosi-gpios = <&gpio0 6 GPIO_ACTIVE_HIGH>; + miso-gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>; + cs-gpios = <&gpio0 8 GPIO_ACTIVE_LOW>; + }; +}; diff --git a/samples/drivers/spi_bitbang/boards/nrf54l15dk_nrf54l15_cpuapp.overlay b/samples/drivers/spi_bitbang/boards/nrf54l15dk_nrf54l15_cpuapp.overlay new file mode 100644 index 000000000000..6a35bb70f9ec --- /dev/null +++ b/samples/drivers/spi_bitbang/boards/nrf54l15dk_nrf54l15_cpuapp.overlay @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * Test requires loopback between P1.10 and P1.11 + * No other driver on SPI_CLK and SPI_CS. + */ + +/ { + spibb0: spibb0 { + compatible = "zephyr,spi-bitbang"; + status="okay"; + #address-cells = <1>; + #size-cells = <0>; + clk-gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>; + mosi-gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>; + miso-gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>; + cs-gpios = <&gpio1 14 GPIO_ACTIVE_LOW>; + }; +}; diff --git a/samples/drivers/spi_bitbang/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/samples/drivers/spi_bitbang/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay new file mode 100644 index 000000000000..9a27384fc40d --- /dev/null +++ b/samples/drivers/spi_bitbang/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * Test requires loopback between P1.13 and P1.14 + * No other driver on SPI_CLK and SPI_CS. + */ + +/ { + spibb0: spibb0 { + compatible = "zephyr,spi-bitbang"; + status="okay"; + #address-cells = <1>; + #size-cells = <0>; + clk-gpios = <&gpio1 23 GPIO_ACTIVE_HIGH>; + mosi-gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>; + miso-gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>; + cs-gpios = <&gpio1 30 GPIO_ACTIVE_LOW>; + }; +}; diff --git a/samples/drivers/spi_bitbang/sample.yaml b/samples/drivers/spi_bitbang/sample.yaml index 57fb178b0930..c90f02313f2b 100644 --- a/samples/drivers/spi_bitbang/sample.yaml +++ b/samples/drivers/spi_bitbang/sample.yaml @@ -6,7 +6,14 @@ tests: - drivers - spi - gpio - platform_allow: nrf52840dk/nrf52840 + platform_allow: + - nrf52840dk/nrf52840 + - nrf54h20dk/nrf54h20/cpuapp + - nrf54l15dk/nrf54l15/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp + integration_platforms: + - nrf52840dk/nrf52840 + - nrf54l15dk/nrf54l15/cpuapp depends_on: gpio harness: console harness_config: From 55e6d51591bf0cbbf461c7d708ab72a60937c63d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Mon, 7 Jul 2025 09:58:24 +0200 Subject: [PATCH 0261/2141] [nrf fromtree] samples: drivers: spi_flash: Enable sample on nrf54lm20dk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add overlay required to run the sample on nrf54lm20dk/nrf54lm20a/cpuapp. Signed-off-by: Sebastian Głąb (cherry picked from commit 231b663495a883a6ae4be7bc2eb51479df66ca4c) --- .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 9 +++++++ samples/drivers/spi_flash/sample.yaml | 26 ++++++++++++++++--- 2 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 samples/drivers/spi_flash/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay diff --git a/samples/drivers/spi_flash/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/samples/drivers/spi_flash/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay new file mode 100644 index 000000000000..8a5afda2ab00 --- /dev/null +++ b/samples/drivers/spi_flash/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&mx25r64 { + status = "okay"; +}; diff --git a/samples/drivers/spi_flash/sample.yaml b/samples/drivers/spi_flash/sample.yaml index 351e33997a0b..39d94c905da1 100644 --- a/samples/drivers/spi_flash/sample.yaml +++ b/samples/drivers/spi_flash/sample.yaml @@ -1,16 +1,19 @@ sample: name: SPI Flash Sample +common: + tags: + - spi + - flash + depends_on: spi tests: sample.drivers.spi.flash: - tags: - - spi - - flash filter: dt_compat_enabled("jedec,spi-nor") or dt_compat_enabled("st,stm32-qspi-nor") or dt_compat_enabled("st,stm32-ospi-nor") or dt_compat_enabled("st,stm32-xspi-nor") or dt_compat_enabled("nordic,qspi-nor") or dt_compat_enabled("jedec,mspi-nor") platform_exclude: - hifive_unmatched/fu740/s7 - hifive_unmatched/fu740/u74 + - nrf54lm20dk/nrf54lm20a/cpuapp harness: console harness_config: type: multi_line @@ -21,4 +24,19 @@ tests: - "Test 2: Flash write" - "Attempting to write 4 bytes" - "Data read matches data written. Good!!" - depends_on: spi + sample.drivers.spi.flash.nrf54lm20: + platform_allow: + - nrf54lm20dk/nrf54lm20a/cpuapp + integration_platforms: + - nrf54lm20dk/nrf54lm20a/cpuapp + harness: console + harness_config: + fixture: external_flash + type: multi_line + ordered: true + regex: + - "Test 1: Flash erase" + - "Flash erase succeeded!" + - "Test 2: Flash write" + - "Attempting to write 4 bytes" + - "Data read matches data written. Good!!" From bd2f8097d51ae5b0e9a6fb46b16a982c42529355 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Mon, 7 Jul 2025 09:59:43 +0200 Subject: [PATCH 0262/2141] [nrf fromtree] samples: drivers: watchdog: Cleanup after nRF54LM20 rename MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove duplicated test configuration after nrf54l20pdk/nrf54l20/cpuxxx was renamed to nrf54lm20dk/nrf54lm20a/cpuxxx. Signed-off-by: Sebastian Głąb (cherry picked from commit 3cf784c5578e0989fbf4be98db0cc22792ff8745) --- .../watchdog/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay | 8 -------- .../watchdog/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay | 8 -------- 2 files changed, 16 deletions(-) delete mode 100644 samples/drivers/watchdog/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay delete mode 100644 samples/drivers/watchdog/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay diff --git a/samples/drivers/watchdog/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/samples/drivers/watchdog/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay deleted file mode 100644 index 5c765a8a8963..000000000000 --- a/samples/drivers/watchdog/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright 2024 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -&wdt31 { - status = "okay"; -}; diff --git a/samples/drivers/watchdog/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay b/samples/drivers/watchdog/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay deleted file mode 100644 index cfb41e09b99e..000000000000 --- a/samples/drivers/watchdog/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright 2025 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -&wdt31 { - status = "okay"; -}; From 607e1be8d008fad2d610fba7eb573bd36b1fa660 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Mon, 7 Jul 2025 10:26:35 +0200 Subject: [PATCH 0263/2141] [nrf fromtree] samples: sensor: qdec: Enable sample on nrf54lm20dk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add overlay required to run the sample on nrf54lm20dk/nrf54lm20a/cpuapp. Signed-off-by: Sebastian Głąb (cherry picked from commit 9f0dc127c0728c78f00f7e34d0cccf169e6a8c76) --- .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 49 +++++++++++++++++++ samples/sensor/qdec/sample.yaml | 6 ++- 2 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 samples/sensor/qdec/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay diff --git a/samples/sensor/qdec/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/samples/sensor/qdec/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay new file mode 100644 index 000000000000..d7045779d8a0 --- /dev/null +++ b/samples/sensor/qdec/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -0,0 +1,49 @@ +/* + * Copyright 2025 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * Two loopbacks are required: + * P1.13 - P1.14 + * P1.23 - P1.24 + */ + +/ { + aliases { + qdec0 = &qdec20; + qenca = &phase_a; + qencb = &phase_b; + }; + + encoder-emulate { + compatible = "gpio-leds"; + phase_a: phase_a { + gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>; + }; + phase_b: phase_b { + gpios = <&gpio1 23 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&pinctrl { + qdec_pinctrl: qdec_pinctrl { + group1 { + psels = , + ; + }; + }; +}; + +&gpio1 { + status = "okay"; +}; + +&qdec20 { + status = "okay"; + pinctrl-0 = <&qdec_pinctrl>; + pinctrl-names = "default"; + steps = <120>; + led-pre = <500>; +}; diff --git a/samples/sensor/qdec/sample.yaml b/samples/sensor/qdec/sample.yaml index 8fe374bc8b58..fbff236caf1d 100644 --- a/samples/sensor/qdec/sample.yaml +++ b/samples/sensor/qdec/sample.yaml @@ -31,14 +31,16 @@ tests: platform_allow: - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp - - nrf54l15dk/nrf54l15/cpuapp - nrf54h20dk/nrf54h20/cpuapp + - nrf54l15dk/nrf54l15/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp - - nrf54l15dk/nrf54l15/cpuapp - nrf54h20dk/nrf54h20/cpuapp + - nrf54l15dk/nrf54l15/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp harness_config: fixture: gpio_loopback From a201385108cd3dfd2a78116a419fce9158e0d476 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Thu, 10 Jul 2025 07:56:02 +0200 Subject: [PATCH 0264/2141] [nrf fromtree] tests: boards: nrf: comp: Enable test on nrf54lm20dk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add overlay required to run the test on nrf54lm20dk/nrf54lm20a/cpuapp. Signed-off-by: Sebastian Głąb (cherry picked from commit cd26bd78c5ef9305a39f49405ad146b68f848737) --- .../boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf | 4 +++ .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 33 +++++++++++++++++++ tests/boards/nrf/comp/testcase.yaml | 1 + 3 files changed, 38 insertions(+) create mode 100644 tests/boards/nrf/comp/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf create mode 100644 tests/boards/nrf/comp/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay diff --git a/tests/boards/nrf/comp/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf b/tests/boards/nrf/comp/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf new file mode 100644 index 000000000000..3a7f6a038761 --- /dev/null +++ b/tests/boards/nrf/comp/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf @@ -0,0 +1,4 @@ +CONFIG_TEST_COMP_SE_PSEL_AIN_INDEX=1 +CONFIG_TEST_COMP_SE_EXTREFSEL_AIN_INDEX=4 +CONFIG_TEST_COMP_DIFF_PSEL_AIN_INDEX=6 +CONFIG_TEST_COMP_DIFF_EXTREFSEL_AIN_INDEX=5 diff --git a/tests/boards/nrf/comp/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/boards/nrf/comp/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay new file mode 100644 index 000000000000..55d1937a4fee --- /dev/null +++ b/tests/boards/nrf/comp/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -0,0 +1,33 @@ +/* Two loopbacks are used + * Each loopback is between analog input and GPIO. + * first-gpios (P1.03) -> AIN6 (P1.04) + * second-gpios (P1.30, AIN2) -> AIN1 (P1.31) + * AIN4 (P1.06) tied to VDD + */ + +/ { + aliases { + test-comp = ∁ + }; + + zephyr,user { + first-gpios = <&gpio1 3 GPIO_ACTIVE_HIGH>; + second-gpios = <&gpio1 30 GPIO_ACTIVE_HIGH>; + }; +}; + +&gpio1 { + status = "okay"; +}; + +&comp { + status = "okay"; + psel = "AIN4"; + refsel = "AREF"; + extrefsel= "AIN3"; + sp-mode = "NORMAL"; + th-up = <36>; + th-down = <30>; + isource = "DISABLED"; + enable-hyst; +}; diff --git a/tests/boards/nrf/comp/testcase.yaml b/tests/boards/nrf/comp/testcase.yaml index d5ac3d9c267f..6d158d284eea 100644 --- a/tests/boards/nrf/comp/testcase.yaml +++ b/tests/boards/nrf/comp/testcase.yaml @@ -12,3 +12,4 @@ tests: platform_allow: - nrf54h20dk/nrf54h20/cpuapp - nrf54l15dk/nrf54l15/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp From b3c198515bb63fc4a79219ed98d6190f575d1976 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Thu, 10 Jul 2025 07:57:26 +0200 Subject: [PATCH 0265/2141] [nrf fromtree] tests: boards: nrf: hwinfo: Cleanup after nRF54LM20 rename MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove duplicated test configuration after nrf54l20pdk/nrf54l20/cpuxxx was renamed to nrf54lm20dk/nrf54lm20a/cpuxxx. Signed-off-by: Sebastian Głąb (cherry picked from commit 591ff8155c828b3994173f3156d0373f0da38f54) --- .../boards/nrf54l20pdk_nrf54l20_cpuapp.overlay | 9 --------- tests/boards/nrf/hwinfo/reset_cause/testcase.yaml | 1 - 2 files changed, 10 deletions(-) delete mode 100644 tests/boards/nrf/hwinfo/reset_cause/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay diff --git a/tests/boards/nrf/hwinfo/reset_cause/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/tests/boards/nrf/hwinfo/reset_cause/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay deleted file mode 100644 index dc1ea1a9ddc9..000000000000 --- a/tests/boards/nrf/hwinfo/reset_cause/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&wdt31 { - status = "okay"; -}; diff --git a/tests/boards/nrf/hwinfo/reset_cause/testcase.yaml b/tests/boards/nrf/hwinfo/reset_cause/testcase.yaml index 9fd5911c2846..da37f9ef614d 100644 --- a/tests/boards/nrf/hwinfo/reset_cause/testcase.yaml +++ b/tests/boards/nrf/hwinfo/reset_cause/testcase.yaml @@ -38,7 +38,6 @@ tests: - nrf54h20dk/nrf54h20/cpuapp - nrf54h20dk/nrf54h20/cpurad - nrf54l15dk/nrf54l15/cpuapp - - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp integration_platforms: - nrf54h20dk/nrf54h20/cpuapp From 0b46bef7e934ffdaa3e7d69f419342919934080a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Thu, 10 Jul 2025 07:59:36 +0200 Subject: [PATCH 0266/2141] [nrf fromtree] tests: boards: nrf: i2c: i2c_slave: Cleanup after nRF54LM20 rename MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove duplicated test configuration after nrf54l20pdk/nrf54l20/cpuxxx was renamed to nrf54lm20dk/nrf54lm20a/cpuxxx. Signed-off-by: Sebastian Głąb (cherry picked from commit 02722305428d387a4b60c37193f5c82264451aa1) --- .../boards/nrf54l20pdk_nrf54l20_cpuapp.conf | 1 - .../nrf54l20pdk_nrf54l20_cpuapp.overlay | 61 ------------------- .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 7 ++- tests/boards/nrf/i2c/i2c_slave/testcase.yaml | 16 ++--- 4 files changed, 14 insertions(+), 71 deletions(-) delete mode 100644 tests/boards/nrf/i2c/i2c_slave/boards/nrf54l20pdk_nrf54l20_cpuapp.conf delete mode 100644 tests/boards/nrf/i2c/i2c_slave/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay diff --git a/tests/boards/nrf/i2c/i2c_slave/boards/nrf54l20pdk_nrf54l20_cpuapp.conf b/tests/boards/nrf/i2c/i2c_slave/boards/nrf54l20pdk_nrf54l20_cpuapp.conf deleted file mode 100644 index b01af3b36a7b..000000000000 --- a/tests/boards/nrf/i2c/i2c_slave/boards/nrf54l20pdk_nrf54l20_cpuapp.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_NRFX_TWIS22=y diff --git a/tests/boards/nrf/i2c/i2c_slave/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/tests/boards/nrf/i2c/i2c_slave/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay deleted file mode 100644 index 0003711755d3..000000000000 --- a/tests/boards/nrf/i2c/i2c_slave/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay +++ /dev/null @@ -1,61 +0,0 @@ -/ { - aliases { - i2c-slave = &i2c22; - }; -}; - -&pinctrl { - i2c21_default_alt: i2c21_default_alt { - group1 { - psels = , - ; - }; - }; - - i2c21_sleep_alt: i2c21_sleep_alt { - group1 { - psels = , - ; - low-power-enable; - }; - }; - - i2c22_default_alt: i2c22_default_alt { - group1 { -/* Temporary workaround as it is currently not possible - * to configure pins for TWIS with pinctrl. - */ - psels = , - ; - bias-pull-up; - }; - }; - - i2c22_sleep_alt: i2c22_sleep_alt { - group1 { - psels = , - ; - low-power-enable; - }; - }; -}; - -dut_twim: &i2c21 { - compatible = "nordic,nrf-twim"; - status = "okay"; - pinctrl-0 = <&i2c21_default_alt>; - pinctrl-1 = <&i2c21_sleep_alt>; - pinctrl-names = "default", "sleep"; - clock-frequency = ; - sensor: sensor@54 { - reg = <0x54>; - }; -}; - -&i2c22 { - compatible = "nordic,nrf-twis"; - status = "okay"; - pinctrl-0 = <&i2c22_default_alt>; - pinctrl-1 = <&i2c22_sleep_alt>; - pinctrl-names = "default", "sleep"; -}; diff --git a/tests/boards/nrf/i2c/i2c_slave/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/boards/nrf/i2c/i2c_slave/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay index 029c9830186b..3767afee0e7c 100644 --- a/tests/boards/nrf/i2c/i2c_slave/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ b/tests/boards/nrf/i2c/i2c_slave/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -1,10 +1,14 @@ +/* + * Copyright 2025 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + /* * Two loopbacks are required: * P1.13 - P1.14 * P1.23 - P1.24 */ - / { aliases { i2c-slave = &i2c22; @@ -53,6 +57,7 @@ dut_twim: &i2c21 { pinctrl-0 = <&i2c21_default_alt>; pinctrl-1 = <&i2c21_sleep_alt>; pinctrl-names = "default", "sleep"; + sensor: sensor@54 { reg = <0x54>; }; diff --git a/tests/boards/nrf/i2c/i2c_slave/testcase.yaml b/tests/boards/nrf/i2c/i2c_slave/testcase.yaml index e125548a49ac..02a2ee5f7518 100644 --- a/tests/boards/nrf/i2c/i2c_slave/testcase.yaml +++ b/tests/boards/nrf/i2c/i2c_slave/testcase.yaml @@ -12,32 +12,32 @@ tests: platform_allow: - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp - - nrf54l15dk/nrf54l15/cpuapp - - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - nrf54h20dk/nrf54h20/cpuapp - nrf54h20dk/nrf54h20/cpuppr + - nrf54l15dk/nrf54l15/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp integration_platforms: - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp - - nrf54l15dk/nrf54l15/cpuapp - nrf54h20dk/nrf54h20/cpuapp - nrf54h20dk/nrf54h20/cpuppr + - nrf54l15dk/nrf54l15/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp boards.nrf.i2c.i2c_slave.fast: platform_allow: - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp - - nrf54l15dk/nrf54l15/cpuapp - - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - nrf54h20dk/nrf54h20/cpuapp - nrf54h20dk/nrf54h20/cpuppr + - nrf54l15dk/nrf54l15/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp integration_platforms: - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp - - nrf54l15dk/nrf54l15/cpuapp - nrf54h20dk/nrf54h20/cpuapp - nrf54h20dk/nrf54h20/cpuppr + - nrf54l15dk/nrf54l15/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp extra_args: - EXTRA_DTC_OVERLAY_FILE="boards/i2c_speed_fast.overlay" boards.nrf.i2c.i2c_slave.fast_plus: From 3c1254d4a06fa56f5db845df4b43f12ee99d38d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Thu, 10 Jul 2025 08:01:19 +0200 Subject: [PATCH 0267/2141] [nrf fromtree] tests: boards: nrf: qdec: Cleanup after nRF54LM20 rename MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove duplicated test configuration after nrf54l20pdk/nrf54l20/cpuxxx was renamed to nrf54lm20dk/nrf54lm20a/cpuxxx. Signed-off-by: Sebastian Głąb (cherry picked from commit dcd1a144ed62c6cba64c103df6a83c296b6bebd1) --- .../boards/nrf54l20pdk_nrf54l20_common.dtsi | 53 ------------------- .../nrf54l20pdk_nrf54l20_cpuapp.overlay | 6 --- .../nrf54l20pdk_nrf54l20_cpuflpr.overlay | 6 --- tests/boards/nrf/qdec/testcase.yaml | 4 +- 4 files changed, 2 insertions(+), 67 deletions(-) delete mode 100644 tests/boards/nrf/qdec/boards/nrf54l20pdk_nrf54l20_common.dtsi delete mode 100644 tests/boards/nrf/qdec/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay delete mode 100644 tests/boards/nrf/qdec/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay diff --git a/tests/boards/nrf/qdec/boards/nrf54l20pdk_nrf54l20_common.dtsi b/tests/boards/nrf/qdec/boards/nrf54l20pdk_nrf54l20_common.dtsi deleted file mode 100644 index f7810df33c04..000000000000 --- a/tests/boards/nrf/qdec/boards/nrf54l20pdk_nrf54l20_common.dtsi +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2025 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - aliases { - qdec0 = &qdec20; - qenca = &phase_a; - qencb = &phase_b; - }; - - encoder-emulate { - compatible = "gpio-leds"; - phase_a: phase_a { - gpios = <&gpio1 9 GPIO_ACTIVE_HIGH>; - }; - phase_b: phase_b { - gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>; - }; - }; -}; - -&pinctrl { - qdec_pinctrl: qdec_pinctrl { - group1 { - psels = , - ; - }; - }; - - qdec_sleep_pinctrl: qdec_sleep_pinctrl { - group1 { - psels = , - ; - low-power-enable; - }; - }; -}; - -&gpio1 { - status = "okay"; -}; - -&qdec20 { - status = "okay"; - pinctrl-0 = <&qdec_pinctrl>; - pinctrl-1 = <&qdec_sleep_pinctrl>; - pinctrl-names = "default", "sleep"; - steps = <127>; - led-pre = <500>; - zephyr,pm-device-runtime-auto; -}; diff --git a/tests/boards/nrf/qdec/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/tests/boards/nrf/qdec/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay deleted file mode 100644 index a16bac11f177..000000000000 --- a/tests/boards/nrf/qdec/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright 2024 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -#include "nrf54l20pdk_nrf54l20_common.dtsi" diff --git a/tests/boards/nrf/qdec/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay b/tests/boards/nrf/qdec/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay deleted file mode 100644 index 638d63e5c544..000000000000 --- a/tests/boards/nrf/qdec/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright 2025 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -#include "nrf54l20pdk_nrf54l20_common.dtsi" diff --git a/tests/boards/nrf/qdec/testcase.yaml b/tests/boards/nrf/qdec/testcase.yaml index 312761b44596..2908a68a6d14 100644 --- a/tests/boards/nrf/qdec/testcase.yaml +++ b/tests/boards/nrf/qdec/testcase.yaml @@ -5,9 +5,7 @@ common: - nrf54h20dk/nrf54h20/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l15dk/nrf54l15/cpuflpr - - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - - nrf54l20pdk/nrf54l20/cpuflpr - nrf54lm20dk/nrf54lm20a/cpuflpr integration_platforms: - nrf52840dk/nrf52840 @@ -15,6 +13,8 @@ common: - nrf54h20dk/nrf54h20/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l15dk/nrf54l15/cpuflpr + - nrf54lm20dk/nrf54lm20a/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuflpr harness: ztest harness_config: fixture: gpio_loopback From 84e9367b1eb4f048008669e179937cab3116eed0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Thu, 10 Jul 2025 08:02:51 +0200 Subject: [PATCH 0268/2141] [nrf fromtree] tests: drivers: adc: adc_accuracy_test: Enable test on nrf54lm20dk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add overlay required to run the test on nrf54lm20dk/nrf54lm20a/cpuapp. Signed-off-by: Sebastian Głąb (cherry picked from commit cc3b92e1b636f91e18cb0491f7a94ff3f426aadc) --- .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 32 +++++++++++++++++++ .../adc/adc_accuracy_test/testcase.yaml | 4 ++- 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 tests/drivers/adc/adc_accuracy_test/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay diff --git a/tests/drivers/adc/adc_accuracy_test/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/adc/adc_accuracy_test/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay new file mode 100644 index 000000000000..bc68f3c8d34f --- /dev/null +++ b/tests/drivers/adc/adc_accuracy_test/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +/* + * Test requires loopback P1.06 to VDDIO + */ + +/ { + zephyr,user { + io-channels = <&adc 0>; + reference-mv = <1800>; + expected-accuracy = <64>; + }; +}; + +&adc { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + channel@0 { + reg = <0>; + zephyr,gain = "ADC_GAIN_1_2"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,input-positive = ; /* P1.06 */ + zephyr,resolution = <14>; + }; +}; diff --git a/tests/drivers/adc/adc_accuracy_test/testcase.yaml b/tests/drivers/adc/adc_accuracy_test/testcase.yaml index 51a4cd53e2a4..b3179bfd5ed1 100644 --- a/tests/drivers/adc/adc_accuracy_test/testcase.yaml +++ b/tests/drivers/adc/adc_accuracy_test/testcase.yaml @@ -21,8 +21,9 @@ tests: - frdm_mcxc242 - frdm_mcxc444 - nrf52840dk/nrf52840 - - nrf54l15dk/nrf54l15/cpuapp - nrf54h20dk/nrf54h20/cpuapp + - nrf54l15dk/nrf54l15/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp - ek_ra8d1 - mck_ra8t1 @@ -44,3 +45,4 @@ tests: - xg29_rb4412a integration_platforms: - frdm_kl25z + - nrf54l15dk/nrf54l15/cpuapp From 9aff91b9c2ba1748cfe9f1f9e056515f25f490e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Thu, 10 Jul 2025 08:04:14 +0200 Subject: [PATCH 0269/2141] [nrf fromtree] tests: drivers: adc: adc_api: Cleanup after nRF54LM20 rename MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove duplicated test configuration after nrf54l20pdk/nrf54l20/cpuxxx was renamed to nrf54lm20dk/nrf54lm20a/cpuxxx. Signed-off-by: Sebastian Głąb (cherry picked from commit d096e83ce12c37c839af816736604d2095b9756c) --- .../nrf54l20pdk_nrf54l20_cpuapp.overlay | 44 ------------------- 1 file changed, 44 deletions(-) delete mode 100644 tests/drivers/adc/adc_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay diff --git a/tests/drivers/adc/adc_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/tests/drivers/adc/adc_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay deleted file mode 100644 index e1ca1190b33a..000000000000 --- a/tests/drivers/adc/adc_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay +++ /dev/null @@ -1,44 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * Copyright (c) 2025 Nordic Semiconductor ASA - */ - -/ { - zephyr,user { - io-channels = <&adc 0>, <&adc 1> , <&adc 2>; - }; -}; - -&adc { - #address-cells = <1>; - #size-cells = <0>; - status = "okay"; - - channel@0 { - reg = <0>; - zephyr,gain = "ADC_GAIN_1"; - zephyr,reference = "ADC_REF_INTERNAL"; - zephyr,acquisition-time = ; - zephyr,input-positive = ; - zephyr,resolution = <10>; - }; - - channel@1 { - reg = <1>; - zephyr,gain = "ADC_GAIN_1_4"; - zephyr,reference = "ADC_REF_EXTERNAL0"; - zephyr,acquisition-time = ; - zephyr,input-positive = ; - zephyr,resolution = <12>; - }; - - channel@2 { - reg = <2>; - zephyr,gain = "ADC_GAIN_2_3"; - zephyr,reference = "ADC_REF_INTERNAL"; - zephyr,acquisition-time = ; - zephyr,input-positive = ; - zephyr,resolution = <10>; - }; -}; From fb16e9c77041d0afcfd31c747a3e8185d4e14d70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Thu, 10 Jul 2025 08:05:37 +0200 Subject: [PATCH 0270/2141] [nrf fromtree] tests: drivers: adc: adc_error_cases: Cleanup after nRF54LM20 rename MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove duplicated test configuration after nrf54l20pdk/nrf54l20/cpuxxx was renamed to nrf54lm20dk/nrf54lm20a/cpuxxx. Signed-off-by: Sebastian Głąb (cherry picked from commit 85f4925d2802d4e1175755c739230dde609bf51b) --- .../boards/nrf54l20pdk_nrf54l20_cpuapp.overlay | 15 --------------- tests/drivers/adc/adc_error_cases/testcase.yaml | 1 - 2 files changed, 16 deletions(-) delete mode 100644 tests/drivers/adc/adc_error_cases/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay diff --git a/tests/drivers/adc/adc_error_cases/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/tests/drivers/adc/adc_error_cases/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay deleted file mode 100644 index c50279ce8f64..000000000000 --- a/tests/drivers/adc/adc_error_cases/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay +++ /dev/null @@ -1,15 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * Copyright (c) 2025 Nordic Semiconductor ASA - */ - -/ { - aliases { - adc = &adc; - }; -}; - -&adc { - status = "okay"; -}; diff --git a/tests/drivers/adc/adc_error_cases/testcase.yaml b/tests/drivers/adc/adc_error_cases/testcase.yaml index f902aa21af02..d9d389ab78ad 100644 --- a/tests/drivers/adc/adc_error_cases/testcase.yaml +++ b/tests/drivers/adc/adc_error_cases/testcase.yaml @@ -9,7 +9,6 @@ tests: platform_allow: - nrf52840dk/nrf52840 - nrf54l15dk/nrf54l15/cpuapp - - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - nrf54h20dk/nrf54h20/cpuapp - ophelia4ev/nrf54l15/cpuapp From d56d138cfdcb54a3d7f0e7b34d21c1d849c84817 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Thu, 10 Jul 2025 08:07:41 +0200 Subject: [PATCH 0271/2141] [nrf fromtree] tests: drivers: audio: dmic_api: Cleanup after nRF54LM20 rename MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove duplicated test configuration after nrf54l20pdk/nrf54l20/cpuxxx was renamed to nrf54lm20dk/nrf54lm20a/cpuxxx. Signed-off-by: Sebastian Głąb (cherry picked from commit 6b70d35dbc9d2644eee77f0e0ca113d48b0fa92f) --- .../nrf54l20pdk_nrf54l20_cpuapp.overlay | 27 ------------------- 1 file changed, 27 deletions(-) delete mode 100644 tests/drivers/audio/dmic_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay diff --git a/tests/drivers/audio/dmic_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/tests/drivers/audio/dmic_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay deleted file mode 100644 index 440ef9828ae8..000000000000 --- a/tests/drivers/audio/dmic_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - aliases { - dmic-dev = &pdm20; - }; -}; - -&pinctrl { - pdm20_default_alt: pdm20_default_alt { - group1 { - psels = , - ; - }; - }; -}; - -dmic_dev: &pdm20 { - status = "okay"; - pinctrl-0 = <&pdm20_default_alt>; - pinctrl-names = "default"; - clock-source = "PCLK32M"; -}; From 5f066f4842297dde8eb22e10fe6a021679c2f828 Mon Sep 17 00:00:00 2001 From: Yunshao Chiang Date: Thu, 23 Jan 2025 15:29:53 +0800 Subject: [PATCH 0272/2141] [nrf fromtree] drivers: comparator: add it51xxx_evb analog comparator driver Add analog comparator driver for ITE it51xxx chip. Signed-off-by: Yunshao Chiang (cherry picked from commit 5a2765da260501371063c6500dcb8d6a1992e53e) --- boards/ite/it515xx_evb/it515xx_evb.dts | 8 + drivers/comparator/CMakeLists.txt | 1 + drivers/comparator/Kconfig | 1 + drivers/comparator/Kconfig.it51xxx_vcmp | 15 + drivers/comparator/comparator_it51xxx_vcmp.c | 408 ++++++++++++++++++ dts/bindings/comparator/ite,it51xxx-vcmp.yaml | 65 +++ dts/riscv/ite/it51xxx.dtsi | 33 +- .../dt-bindings/comparator/it51xxx-vcmp.h | 21 + .../gpio_loopback/boards/it515xx_evb.conf | 4 + .../gpio_loopback/boards/it515xx_evb.overlay | 24 ++ 10 files changed, 579 insertions(+), 1 deletion(-) create mode 100644 drivers/comparator/Kconfig.it51xxx_vcmp create mode 100644 drivers/comparator/comparator_it51xxx_vcmp.c create mode 100644 dts/bindings/comparator/ite,it51xxx-vcmp.yaml create mode 100644 include/zephyr/dt-bindings/comparator/it51xxx-vcmp.h create mode 100644 tests/drivers/comparator/gpio_loopback/boards/it515xx_evb.conf create mode 100644 tests/drivers/comparator/gpio_loopback/boards/it515xx_evb.overlay diff --git a/boards/ite/it515xx_evb/it515xx_evb.dts b/boards/ite/it515xx_evb/it515xx_evb.dts index 926c93bd921f..08c99ca1ebcb 100644 --- a/boards/ite/it515xx_evb/it515xx_evb.dts +++ b/boards/ite/it515xx_evb/it515xx_evb.dts @@ -153,3 +153,11 @@ &sha256 { status = "okay"; }; + +/* voltage comparator for test */ +&vcmp1 { + status = "okay"; + threshold-mv = <1500>; + scan-period = <0x4>; + io-channels = <&adc0 3>; +}; diff --git a/drivers/comparator/CMakeLists.txt b/drivers/comparator/CMakeLists.txt index 5d8ef0554616..bdbc9ce815cc 100644 --- a/drivers/comparator/CMakeLists.txt +++ b/drivers/comparator/CMakeLists.txt @@ -8,6 +8,7 @@ zephyr_library() zephyr_library_sources_ifdef(CONFIG_USERSPACE comparator_handlers.c) zephyr_library_sources_ifdef(CONFIG_COMPARATOR_SILABS_ACMP comparator_silabs_acmp.c) zephyr_library_sources_ifdef(CONFIG_COMPARATOR_FAKE_COMP comparator_fake_comp.c) +zephyr_library_sources_ifdef(CONFIG_COMPARATOR_IT51XXX_VCMP comparator_it51xxx_vcmp.c) zephyr_library_sources_ifdef(CONFIG_COMPARATOR_MCUX_ACMP comparator_mcux_acmp.c) zephyr_library_sources_ifdef(CONFIG_COMPARATOR_NRF_COMP comparator_nrf_comp.c) zephyr_library_sources_ifdef(CONFIG_COMPARATOR_NRF_LPCOMP comparator_nrf_lpcomp.c) diff --git a/drivers/comparator/Kconfig b/drivers/comparator/Kconfig index 2cc02c240851..07707385b05d 100644 --- a/drivers/comparator/Kconfig +++ b/drivers/comparator/Kconfig @@ -20,6 +20,7 @@ config COMPARATOR_INIT_PRIORITY rsource "Kconfig.fake_comp" rsource "Kconfig.silabs_acmp" +rsource "Kconfig.it51xxx_vcmp" rsource "Kconfig.mcux_acmp" rsource "Kconfig.nrf_comp" rsource "Kconfig.nrf_lpcomp" diff --git a/drivers/comparator/Kconfig.it51xxx_vcmp b/drivers/comparator/Kconfig.it51xxx_vcmp new file mode 100644 index 000000000000..2881beb779ac --- /dev/null +++ b/drivers/comparator/Kconfig.it51xxx_vcmp @@ -0,0 +1,15 @@ +# ITE Voltage Comparator driver configuration options + +# Copyright (c) 2025 ITE Technology Corporation. +# SPDX-License-Identifier: Apache-2.0 + +config COMPARATOR_IT51XXX_VCMP + bool "ITE it51xxx Voltage Comparator" + default y + depends on ADC_ITE_IT51XXX + depends on DT_HAS_ITE_IT51XXX_VCMP_ENABLED + depends on DYNAMIC_INTERRUPTS + help + This option enables the ITE it51xxx voltage comparator, + it51xxx supports three 10-bit threshold voltage comparator + channels, and the input of each comparator comes from ADC pin. diff --git a/drivers/comparator/comparator_it51xxx_vcmp.c b/drivers/comparator/comparator_it51xxx_vcmp.c new file mode 100644 index 000000000000..e0a3e11b0c0d --- /dev/null +++ b/drivers/comparator/comparator_it51xxx_vcmp.c @@ -0,0 +1,408 @@ +/* + * Copyright (c) 2025 ITE Technology Corporation. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#define DT_DRV_COMPAT ite_it51xxx_vcmp + +#include +#include +#include +#include +#include +#include + +#include + +#include +LOG_MODULE_REGISTER(comparator_it51xxx_vcmp, CONFIG_COMPARATOR_LOG_LEVEL); + +#define VCMP_CHANNEL_ID_REG_MASK GENMASK(2, 0) +#define VCMP_THRESHOLD BIT(10) +#ifdef CONFIG_ADC_IT51XXX_VOL_FULL_SCALE +#define VCMP_MAX_MVOLT 3300 +#else +#define VCMP_MAX_MVOLT 3000 +#endif + +/* 0x20, 0x28, 0x2c: Voltage Comparator n Control Register (VCMPnCTL) (n=0 to 2) */ +#define REG_VCMP_VCMP0CTL 0x20 +#define REG_VCMP_VCMP1CTL 0x28 +#define REG_VCMP_VCMP2CTL 0x2C +#define VCMP_CMPEN BIT(7) +#define VCMP_CMPINTEN BIT(6) +#define VCMP_GREATER_THRESHOLD BIT(5) +#define VCMP_CMP_EDGE_SENSED_MODE BIT(4) +const uint8_t vcmp_ctrl_reg[VCMP_CHANNEL_CNT] = {REG_VCMP_VCMP0CTL, REG_VCMP_VCMP1CTL, + REG_VCMP_VCMP2CTL}; + +/* 0x21, 0x29, 0x2D: Voltage Comparator n Status and Control Register (VCMPnSCTL) (n=0 to 2) */ +#define REG_VCMP_VCMP0SCTL 0x21 +#define REG_VCMP_VCMP1SCTL 0x29 +#define REG_VCMP_VCMP2SCTL 0x2D +#define VCMP_CMPXRTIS BIT(6) +const uint8_t vcmp_status_ctrl_reg[VCMP_CHANNEL_CNT] = {REG_VCMP_VCMP0SCTL, REG_VCMP_VCMP1SCTL, + REG_VCMP_VCMP2SCTL}; + +/* 0x22, 0x2A, 0x2E: Voltage Comparator 0~2 MSB Threshold Data Buffer (10-bit resolution) */ +#define REG_VCMP_CH_THRDATM 0x02 + +/* 0x23, 0x2B, 0x2F: Voltage Comparator 0~2 LSB Threshold Data Buffer (10-bit resolution) */ +#define REG_VCMP_CH_THRDATL 0x03 + +/* 0x33: Voltage Comparator Scan Period 2 (VCMPSCP2) */ +#define REG_VCMP_VCMPSCP2 0x33 +#define SCAN_PERIOD_MASK GENMASK(7, 4) + +/* Device config */ +struct vcmp_it51xxx_config { + /* Voltage comparator channel base address */ + uintptr_t base_ch; + /* Voltage comparator base address */ + uintptr_t reg_base; + /* Voltage comparator module irq */ + int irq; + /* Voltage comparator channel */ + int vcmp_ch; + /* Comparator 0/1/2 Scan Period */ + uint8_t scan_period; + /* Threshold assert value in mv */ + int32_t threshold_mv; + /* Pointer of ADC device that will be performing measurement */ + const struct device *adc; + /* Channel identifier */ + uint8_t channel_id; +}; + +/* Driver data */ +struct vcmp_it51xxx_data { + /* ADC channel config */ + struct adc_channel_cfg adc_ch_cfg; + comparator_callback_t user_cb; + void *user_cb_data; + uint8_t interrupt_mask; + atomic_t triggered; + /* Pointer of voltage comparator device */ + const struct device *vcmp; +}; +/* + * Because all the three voltage comparators use the same interrupt number, the + * 'irq_connect_dynamic' call in the driver init function sets the passed-in dev pointer in isr + * function to the first instantiated voltage comparator. + * + * For example, when setting vcmp2 and vcmp3 to 'status = "okay";' in dts file, each time an + * interrupt is triggered,the passed-in 'const struct device *dev' argument in isr function always + * points to vcmp2 device. + * + * To access the 'struct vcmp_it51xxx_data' of respective voltage comparator instance, we + * use a array to store their address. + */ +static struct vcmp_it51xxx_data *vcmp_data[VCMP_CHANNEL_CNT]; + +static void vcmp_irq_handler(const struct device *dev) +{ + struct vcmp_it51xxx_data *const data = dev->data; + + if (data->user_cb == NULL) { + atomic_set_bit(&data->triggered, 0); + return; + } + + data->user_cb(dev, data->user_cb_data); + atomic_clear_bit(&data->triggered, 0); +} + +static void clear_vcmp_status(const struct device *dev, int channel) +{ + const struct vcmp_it51xxx_config *const cfg = dev->config; + const uintptr_t reg_base = cfg->reg_base; + + sys_write8(sys_read8(reg_base + vcmp_status_ctrl_reg[channel]), + reg_base + vcmp_status_ctrl_reg[channel]); +} + +static int vcmp_set_threshold(const struct device *dev, int32_t threshold_mv) +{ + const struct vcmp_it51xxx_config *const cfg = dev->config; + const uintptr_t base_ch = cfg->base_ch; + int32_t reg_val; + + /* + * Tranfrom threshold from mv to raw + * NOTE: CMPXTHRDAT[9:0] = threshold(mv) * 1024 / 3000(mv) + */ + reg_val = (threshold_mv * VCMP_THRESHOLD / VCMP_MAX_MVOLT); + + if (reg_val >= VCMP_THRESHOLD) { + LOG_ERR("Vcmp%d threshold only support 10-bits", cfg->vcmp_ch); + return -ENOTSUP; + } + + /* Set threshold raw value */ + sys_write8(reg_val & 0xff, base_ch + REG_VCMP_CH_THRDATL); + sys_write8((reg_val >> 8) & 0xff, base_ch + REG_VCMP_CH_THRDATM); + + return 0; +} + +static void vcmp_set_attr(const struct device *dev, enum comparator_trigger trigger) +{ + const struct vcmp_it51xxx_config *const cfg = dev->config; + const uintptr_t base_ch = cfg->base_ch; + + /* Set lower or higher threshold */ + if (trigger == COMPARATOR_TRIGGER_RISING_EDGE) { + sys_write8(sys_read8(base_ch) | VCMP_GREATER_THRESHOLD, base_ch); + } else { + sys_write8(sys_read8(base_ch) & ~VCMP_GREATER_THRESHOLD, base_ch); + } +} + +static void vcmp_enable(const struct device *dev, bool enable) +{ + const struct vcmp_it51xxx_config *const cfg = dev->config; + const uintptr_t base_ch = cfg->base_ch; + + if (enable) { + /* Enable voltage comparator interrupt */ + sys_write8(sys_read8(base_ch) | VCMP_CMPINTEN, base_ch); + /* Start voltage comparator */ + sys_write8(sys_read8(base_ch) | VCMP_CMPEN, base_ch); + } else { + /* Disable voltage comparator interrupt */ + sys_write8(sys_read8(base_ch) & ~VCMP_CMPINTEN, base_ch); + /* Stop voltage comparator */ + sys_write8(sys_read8(base_ch) & ~VCMP_CMPEN, base_ch); + } +} + +static int it51xxx_vcmp_get_output(const struct device *dev) +{ + ARG_UNUSED(dev); + + LOG_ERR("Unsupported function: %s", __func__); + + return -ENOTSUP; +} + +static int it51xxx_vcmp_set_trigger(const struct device *dev, enum comparator_trigger trigger) +{ + const struct vcmp_it51xxx_config *cfg = dev->config; + struct vcmp_it51xxx_data *data = dev->data; + + /* Disable VCMP interrupt */ + vcmp_enable(dev, false); + + /* W/C voltage comparator specific channel interrupt status */ + clear_vcmp_status(dev, cfg->vcmp_ch); + + switch (trigger) { + case COMPARATOR_TRIGGER_BOTH_EDGES: + LOG_ERR("Unsupported trigger: COMPARATOR_TRIGGER_BOTH_EDGES"); + return -ENOTSUP; + case COMPARATOR_TRIGGER_RISING_EDGE: + data->interrupt_mask = COMPARATOR_TRIGGER_RISING_EDGE; + vcmp_set_attr(dev, COMPARATOR_TRIGGER_RISING_EDGE); + break; + case COMPARATOR_TRIGGER_FALLING_EDGE: + data->interrupt_mask = COMPARATOR_TRIGGER_FALLING_EDGE; + vcmp_set_attr(dev, COMPARATOR_TRIGGER_FALLING_EDGE); + break; + case COMPARATOR_TRIGGER_NONE: + data->interrupt_mask = 0; + break; + default: + return -EINVAL; + } + + if (data->interrupt_mask) { + vcmp_enable(dev, true); + } + + return 0; +} + +static int it51xxx_vcmp_set_trigger_callback(const struct device *dev, + comparator_callback_t callback, void *user_data) +{ + struct vcmp_it51xxx_data *data = dev->data; + + /* Disable voltage comparator and interrupt */ + vcmp_enable(dev, false); + + data->user_cb = callback; + data->user_cb_data = user_data; + + if (callback != NULL && atomic_test_and_clear_bit(&data->triggered, 0)) { + callback(dev, user_data); + } + + /* Re-enable currently set VCMP interrupt */ + if (data->interrupt_mask) { + vcmp_enable(dev, true); + } + + return 0; +} + +static int it51xxx_vcmp_trigger_is_pending(const struct device *dev) +{ + struct vcmp_it51xxx_data *data = dev->data; + + return atomic_test_and_clear_bit(&data->triggered, 0); +} + +/* + * All voltage comparator channels share one irq interrupt, so we + * need to handle all channels, when the interrupt fired. + */ +static void vcmp_it51xxx_isr(const struct device *dev) +{ + const struct vcmp_it51xxx_config *const cfg = dev->config; + const uintptr_t reg_base = cfg->reg_base; + /* + * Comparator n Trigger Mode (CMPnTMOD) + * false (0): Less than or equal to CMPnTHRDAT [9:0] + * true (1): Greater than CMPnTHRDAT [9:0] + */ + bool comparator_mode; + + /* Find out which voltage comparator triggered */ + for (int idx = VCMP_CHANNEL_0; idx < VCMP_CHANNEL_CNT; idx++) { + if (sys_read8(reg_base + vcmp_status_ctrl_reg[idx]) & VCMP_CMPXRTIS) { + struct vcmp_it51xxx_data *data = vcmp_data[idx]; + + comparator_mode = + sys_read8(reg_base + vcmp_ctrl_reg[idx]) & VCMP_GREATER_THRESHOLD; + + if ((comparator_mode && data && + data->interrupt_mask == COMPARATOR_TRIGGER_RISING_EDGE) || + (!comparator_mode && data && + data->interrupt_mask == COMPARATOR_TRIGGER_FALLING_EDGE)) { + + vcmp_irq_handler(data->vcmp); + } + + if (comparator_mode) { + sys_write8(sys_read8(reg_base + vcmp_ctrl_reg[idx]) & + ~VCMP_GREATER_THRESHOLD, + reg_base + vcmp_ctrl_reg[idx]); + } else { + sys_write8(sys_read8(reg_base + vcmp_ctrl_reg[idx]) | + VCMP_GREATER_THRESHOLD, + reg_base + vcmp_ctrl_reg[idx]); + } + + /* W/C voltage comparator specific channel interrupt status */ + clear_vcmp_status(dev, idx); + } + } + + /* W/C voltage comparator irq interrupt status */ + ite_intc_isr_clear(cfg->irq); +} + +static int vcmp_it51xxx_init(const struct device *dev) +{ + const struct vcmp_it51xxx_config *const cfg = dev->config; + struct vcmp_it51xxx_data *const data = dev->data; + uintptr_t base_ch = cfg->base_ch; + uintptr_t reg_vcmpscp2 = cfg->reg_base + REG_VCMP_VCMPSCP2; + uint8_t reg_value; + int err; + + data->adc_ch_cfg.gain = ADC_GAIN_1; + data->adc_ch_cfg.reference = ADC_REF_INTERNAL; + data->adc_ch_cfg.acquisition_time = ADC_ACQ_TIME_DEFAULT; + data->adc_ch_cfg.channel_id = cfg->channel_id; + + /* Disable voltage comparator and interrupt */ + vcmp_enable(dev, false); + + /* + * ADC channel signal output to voltage comparator, + * so we need to set ADC channel to alternate mode first. + */ + if (!device_is_ready(cfg->adc)) { + LOG_ERR("ADC device not ready"); + return -ENODEV; + } + + err = adc_channel_setup(cfg->adc, &data->adc_ch_cfg); + if (err) { + return err; + } + + /* Select which ADC channel output voltage into comparator */ + reg_value = FIELD_PREP(GENMASK(7, 3), sys_read8(base_ch)); + reg_value |= data->adc_ch_cfg.channel_id & VCMP_CHANNEL_ID_REG_MASK; + sys_write8(reg_value, base_ch); + + /* Set VCMP to Edge Sense Mode */ + sys_write8(sys_read8(base_ch) | VCMP_CMP_EDGE_SENSED_MODE, base_ch); + + /* Store the address of driver data for later access in ISR function*/ + if (cfg->vcmp_ch >= VCMP_CHANNEL_CNT) { + LOG_ERR("invalid volt comparator channel setting(%d)", cfg->vcmp_ch); + return -EINVAL; + } + vcmp_data[cfg->vcmp_ch] = dev->data; + + /* + * Set minimum scan period for "all" voltage comparator + * Three voltage comparators share a scan period setting and use the fastest one + */ + if (cfg->scan_period < FIELD_GET(SCAN_PERIOD_MASK, sys_read8(reg_vcmpscp2))) { + sys_write8(FIELD_PREP(SCAN_PERIOD_MASK, cfg->scan_period), reg_vcmpscp2); + } + + /* Data must keep device reference for later access in ISR function */ + data->vcmp = dev; + + err = vcmp_set_threshold(dev, cfg->threshold_mv); + if (err) { + return err; + } + + /* + * All voltage comparator channels share one irq interrupt, + * so if the irq is enabled before, we needn't to enable again. + * And we will figure out the triggered channel in vcmp_it51xxx_isr(). + */ + if (!irq_is_enabled(cfg->irq)) { + ite_intc_isr_clear(cfg->irq); + irq_connect_dynamic(cfg->irq, 0, (void (*)(const void *))vcmp_it51xxx_isr, + (const void *)dev, 0); + irq_enable(cfg->irq); + } + + return 0; +} + +static DEVICE_API(comparator, it51xxx_vcmp_api) = { + .get_output = it51xxx_vcmp_get_output, + .set_trigger = it51xxx_vcmp_set_trigger, + .set_trigger_callback = it51xxx_vcmp_set_trigger_callback, + .trigger_is_pending = it51xxx_vcmp_trigger_is_pending, +}; + +#define VCMP_IT51XXX_INIT(inst) \ + static const struct vcmp_it51xxx_config vcmp_it51xxx_cfg_##inst = { \ + .base_ch = DT_INST_REG_ADDR_BY_IDX(inst, 0), \ + .reg_base = DT_INST_REG_ADDR_BY_IDX(inst, 1), \ + .irq = DT_INST_IRQN(inst), \ + .vcmp_ch = DT_INST_PROP(inst, vcmp_ch), \ + .scan_period = DT_INST_PROP(inst, scan_period), \ + .threshold_mv = DT_INST_PROP(inst, threshold_mv), \ + .adc = DEVICE_DT_GET(DT_INST_IO_CHANNELS_CTLR(inst)), \ + .channel_id = (uint8_t)DT_INST_IO_CHANNELS_INPUT(inst), \ + }; \ + \ + static struct vcmp_it51xxx_data vcmp_it51xxx_data_##inst; \ + \ + DEVICE_DT_INST_DEFINE(inst, vcmp_it51xxx_init, NULL, &vcmp_it51xxx_data_##inst, \ + &vcmp_it51xxx_cfg_##inst, POST_KERNEL, \ + CONFIG_COMPARATOR_INIT_PRIORITY, &it51xxx_vcmp_api); + +DT_INST_FOREACH_STATUS_OKAY(VCMP_IT51XXX_INIT) diff --git a/dts/bindings/comparator/ite,it51xxx-vcmp.yaml b/dts/bindings/comparator/ite,it51xxx-vcmp.yaml new file mode 100644 index 000000000000..08fd821f7984 --- /dev/null +++ b/dts/bindings/comparator/ite,it51xxx-vcmp.yaml @@ -0,0 +1,65 @@ +# Copyright (c) 2025 ITE Technology Corporation. +# SPDX-License-Identifier: Apache-2.0 + +description: ITE, it51xxx Voltage Comparator node + +compatible: "ite,it51xxx-vcmp" + +include: base.yaml + +properties: + reg: + required: true + + interrupts: + required: true + + vcmp-ch: + type: int + required: true + description: | + Voltage comparator channel. + Check include/zephyr/dt-bindings/comparator/it51xxx-vcmp.h file for + pre-defined values. + + threshold-mv: + type: int + required: true + description: | + 16-bit value in milli-volts present on ADC data as threshold assert. + + io-channels: + type: phandle-array + required: true + description: | + ADC channel that will perform measurement. + + scan-period: + type: int + description: | + 0x1: Set comparator scan period to 100US + 0x2: Set comparator scan period to 200US + 0x3: Set comparator scan period to 400US + 0x4: Set comparator scan period to 600US + 0x5: Set comparator scan period to 800US + 0x6: Set comparator scan period to 1MS + 0x7: Set comparator scan period to 1.5MS + 0x8: Set comparator scan period to 2MS + 0x9: Set comparator scan period to 2.5MS + 0xA: Set comparator scan period to 3MS + 0xB: Set comparator scan period to 4MS + 0xC: Set comparator scan period to 5MS + default: 0x4 + enum: + - 0x1 + - 0x2 + - 0x3 + - 0x4 + - 0x5 + - 0x6 + - 0x7 + - 0x8 + - 0x9 + - 0xA + - 0xB + - 0xC diff --git a/dts/riscv/ite/it51xxx.dtsi b/dts/riscv/ite/it51xxx.dtsi index 8f3b008276ef..16633f3c6b22 100644 --- a/dts/riscv/ite/it51xxx.dtsi +++ b/dts/riscv/ite/it51xxx.dtsi @@ -6,9 +6,10 @@ #include #include +#include #include +#include #include -#include #include #include #include @@ -84,6 +85,36 @@ #io-channel-cells = <1>; }; + vcmp0: vcmp@f04520 { + compatible = "ite,it51xxx-vcmp"; + interrupt-parent = <&intc>; + interrupts = ; + reg = <0xf04520 0x08 + 0xf04500 0xc1>; /* vcmp base address */ + vcmp-ch = ; + status = "disabled"; + }; + + vcmp1: vcmp@f04528 { + compatible = "ite,it51xxx-vcmp"; + interrupt-parent = <&intc>; + interrupts = ; + reg = <0xf04528 0x08 + 0xf04500 0xc1>; /* vcmp base address */ + vcmp-ch = ; + status = "disabled"; + }; + + vcmp2: vcmp@f0452c { + compatible = "ite,it51xxx-vcmp"; + interrupt-parent = <&intc>; + interrupts = ; + reg = <0xf0452c 0x08 + 0xf04500 0xc1>; /* vcmp base address */ + vcmp-ch = ; + status = "disabled"; + }; + gpiogcr: gpio-gcr@f01600 { compatible = "ite,it51xxx-gpiogcr"; reg = <0x00f01600 0x100>; diff --git a/include/zephyr/dt-bindings/comparator/it51xxx-vcmp.h b/include/zephyr/dt-bindings/comparator/it51xxx-vcmp.h new file mode 100644 index 000000000000..1296a8d5b319 --- /dev/null +++ b/include/zephyr/dt-bindings/comparator/it51xxx-vcmp.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2025 ITE Corporation. + * + * SPDX-License-Identifier: Apache-2.0 + */ +#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_COMPARATOR_IT51XXX_VCMP_H_ +#define ZEPHYR_INCLUDE_DT_BINDINGS_COMPARATOR_IT51XXX_VCMP_H_ + +/** + * @name it51xxx voltage comparator channel references + * @{ + */ + +#define VCMP_CHANNEL_0 0 +#define VCMP_CHANNEL_1 1 +#define VCMP_CHANNEL_2 2 +#define VCMP_CHANNEL_CNT 3 + +/** @} */ + +#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_COMPARATOR_IT51XXX_VCMP_H_ */ diff --git a/tests/drivers/comparator/gpio_loopback/boards/it515xx_evb.conf b/tests/drivers/comparator/gpio_loopback/boards/it515xx_evb.conf new file mode 100644 index 000000000000..a51e33c8c63f --- /dev/null +++ b/tests/drivers/comparator/gpio_loopback/boards/it515xx_evb.conf @@ -0,0 +1,4 @@ +# Copyright (c) 2025 ITE Technology Corporation +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_ADC=y diff --git a/tests/drivers/comparator/gpio_loopback/boards/it515xx_evb.overlay b/tests/drivers/comparator/gpio_loopback/boards/it515xx_evb.overlay new file mode 100644 index 000000000000..6c119b300177 --- /dev/null +++ b/tests/drivers/comparator/gpio_loopback/boards/it515xx_evb.overlay @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 ITE Technology Corporation + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +/ { + aliases { + test-comp = &vcmp1; + }; + + zephyr,user { + test-gpios = <&gpioa 1 GPIO_ACTIVE_HIGH>; + }; +}; + +&vcmp1 { + status = "okay"; + threshold-mv = <1500>; + scan-period = <0x4>; + io-channels = <&adc0 3>; +}; From 6708442e4a60dfd78779a55068ff331262f97580 Mon Sep 17 00:00:00 2001 From: Khoa Nguyen Date: Mon, 2 Jun 2025 11:24:59 +0700 Subject: [PATCH 0273/2141] [nrf fromtree] tests: drivers: comparator: Add support gpio_loopback for ek_ra8p1 Add support test app `gpio_loopback` for Renesas ek_ra8p1 board Signed-off-by: Khoa Nguyen (cherry picked from commit 3367bd46dd2df1819e4b33334cbf989cd69f519b) --- .../ek_ra8p1_r7ka8p1kflcac_cm85.overlay | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 tests/drivers/comparator/gpio_loopback/boards/ek_ra8p1_r7ka8p1kflcac_cm85.overlay diff --git a/tests/drivers/comparator/gpio_loopback/boards/ek_ra8p1_r7ka8p1kflcac_cm85.overlay b/tests/drivers/comparator/gpio_loopback/boards/ek_ra8p1_r7ka8p1kflcac_cm85.overlay new file mode 100644 index 000000000000..cccbaf04e932 --- /dev/null +++ b/tests/drivers/comparator/gpio_loopback/boards/ek_ra8p1_r7ka8p1kflcac_cm85.overlay @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2025 Renesas Electronics Corporation + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +/ { + aliases { + test-comp = &acmphs0; + }; + + zephyr,user { + test-gpios = <&ioport6 0 GPIO_ACTIVE_HIGH>; + }; +}; + +&pinctrl { + acmphs0_ivcmp0: acmphs0_ivcmp0 { + group1 { + /* CH0 IVCMP0 */ + psels = ; + renesas,analog-enable; + }; + }; +}; + +&acmphs_global { + status = "okay"; + + acmphs0 { + pinctrl-0 = <&acmphs0_ivcmp0>; + pinctrl-names = "default"; + interrupts = <90 12>; + interrupt-names = "hs"; + reference-input-source = "ivref2"; + compare-input-source = "ivcmp0"; + noise-filter = <1>; + status = "okay"; + }; +}; From df2fdfe5be6749b681f3ce45e2685fbd58170cd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Thu, 10 Jul 2025 08:16:42 +0200 Subject: [PATCH 0274/2141] [nrf fromtree] tests: drivers: comparator: gpio_loopback: Enable test on nrf54lm20dk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add overlay required to run the test on nrf54lm20dk/nrf54lm20a/cpuapp. Signed-off-by: Sebastian Głąb (cherry picked from commit e8a5802c9077d6eb01fabe1c95789b5bbb0c6bde) --- .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 25 +++++++++++++++++++ .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 16 ++++++++++++ .../snippets/nrf_comp/snippet.yml | 9 ++++--- .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 12 +++++++++ .../snippets/nrf_lpcomp/snippet.yml | 9 ++++--- .../comparator/gpio_loopback/testcase.yaml | 6 +++-- 6 files changed, 69 insertions(+), 8 deletions(-) create mode 100644 tests/drivers/comparator/gpio_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay create mode 100644 tests/drivers/comparator/gpio_loopback/snippets/nrf_comp/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay create mode 100644 tests/drivers/comparator/gpio_loopback/snippets/nrf_lpcomp/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay diff --git a/tests/drivers/comparator/gpio_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/comparator/gpio_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay new file mode 100644 index 000000000000..831e235d4c7a --- /dev/null +++ b/tests/drivers/comparator/gpio_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +/* + * P1.30 looped back to P1.31 (AIN1) + */ + +/ { + aliases { + test-comp = ∁ + }; + + zephyr,user { + test-gpios = <&gpio1 30 GPIO_ACTIVE_HIGH>; + }; +}; + +&gpio1 { + status = "okay"; +}; diff --git a/tests/drivers/comparator/gpio_loopback/snippets/nrf_comp/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/comparator/gpio_loopback/snippets/nrf_comp/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay new file mode 100644 index 000000000000..2709df531950 --- /dev/null +++ b/tests/drivers/comparator/gpio_loopback/snippets/nrf_comp/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&comp { + main-mode = "SE"; + psel = "AIN1"; /* P1.31 */ + refsel = "INT_1V2"; + sp-mode = "HIGH"; + th-up = <63>; + th-down = <59>; + isource = "DISABLED"; + status = "okay"; +}; diff --git a/tests/drivers/comparator/gpio_loopback/snippets/nrf_comp/snippet.yml b/tests/drivers/comparator/gpio_loopback/snippets/nrf_comp/snippet.yml index 79fffefe7f4c..9d876bfded03 100644 --- a/tests/drivers/comparator/gpio_loopback/snippets/nrf_comp/snippet.yml +++ b/tests/drivers/comparator/gpio_loopback/snippets/nrf_comp/snippet.yml @@ -4,15 +4,18 @@ name: gpio_loopback_nrf_comp boards: + nrf5340dk/nrf5340/cpuapp: + append: + EXTRA_DTC_OVERLAY_FILE: boards/nrf5340dk_nrf5340_cpuapp.overlay nrf54h20dk/nrf54h20/cpuapp: append: EXTRA_DTC_OVERLAY_FILE: boards/nrf54h20dk_nrf54h20_cpuapp.overlay nrf54l15dk/nrf54l15/cpuapp: append: EXTRA_DTC_OVERLAY_FILE: boards/nrf54l15dk_nrf54l15_cpuapp.overlay + nrf54lm20dk/nrf54lm20a/cpuapp: + append: + EXTRA_DTC_OVERLAY_FILE: boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay ophelia4ev/nrf54l15/cpuapp: append: EXTRA_DTC_OVERLAY_FILE: boards/nrf54l15dk_nrf54l15_cpuapp.overlay - nrf5340dk/nrf5340/cpuapp: - append: - EXTRA_DTC_OVERLAY_FILE: boards/nrf5340dk_nrf5340_cpuapp.overlay diff --git a/tests/drivers/comparator/gpio_loopback/snippets/nrf_lpcomp/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/comparator/gpio_loopback/snippets/nrf_lpcomp/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay new file mode 100644 index 000000000000..0f51a9951a16 --- /dev/null +++ b/tests/drivers/comparator/gpio_loopback/snippets/nrf_lpcomp/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&comp { + compatible = "nordic,nrf-lpcomp"; + psel = "AIN1"; /* P1.31 */ + refsel = "VDD_4_8"; + status = "okay"; +}; diff --git a/tests/drivers/comparator/gpio_loopback/snippets/nrf_lpcomp/snippet.yml b/tests/drivers/comparator/gpio_loopback/snippets/nrf_lpcomp/snippet.yml index 82a32cb517ef..c2a2005af4d3 100644 --- a/tests/drivers/comparator/gpio_loopback/snippets/nrf_lpcomp/snippet.yml +++ b/tests/drivers/comparator/gpio_loopback/snippets/nrf_lpcomp/snippet.yml @@ -4,15 +4,18 @@ name: gpio_loopback_nrf_lpcomp boards: + nrf5340dk/nrf5340/cpuapp: + append: + EXTRA_DTC_OVERLAY_FILE: boards/nrf5340dk_nrf5340_cpuapp.overlay nrf54h20dk/nrf54h20/cpuapp: append: EXTRA_DTC_OVERLAY_FILE: boards/nrf54h20dk_nrf54h20_cpuapp.overlay nrf54l15dk/nrf54l15/cpuapp: append: EXTRA_DTC_OVERLAY_FILE: boards/nrf54l15dk_nrf54l15_cpuapp.overlay + nrf54lm20dk/nrf54lm20a/cpuapp: + append: + EXTRA_DTC_OVERLAY_FILE: boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay ophelia4ev/nrf54l15/cpuapp: append: EXTRA_DTC_OVERLAY_FILE: boards/nrf54l15dk_nrf54l15_cpuapp.overlay - nrf5340dk/nrf5340/cpuapp: - append: - EXTRA_DTC_OVERLAY_FILE: boards/nrf5340dk_nrf5340_cpuapp.overlay diff --git a/tests/drivers/comparator/gpio_loopback/testcase.yaml b/tests/drivers/comparator/gpio_loopback/testcase.yaml index cfeeabe3a691..bf0e7d127a0c 100644 --- a/tests/drivers/comparator/gpio_loopback/testcase.yaml +++ b/tests/drivers/comparator/gpio_loopback/testcase.yaml @@ -20,15 +20,17 @@ tests: extra_args: - SNIPPET="gpio_loopback_nrf_comp" platform_allow: + - nrf5340dk/nrf5340/cpuapp - nrf54h20dk/nrf54h20/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf5340dk/nrf5340/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp drivers.comparator.gpio_loopback.nrf_lpcomp: extra_args: - SNIPPET="gpio_loopback_nrf_lpcomp" platform_allow: + - nrf5340dk/nrf5340/cpuapp - nrf54h20dk/nrf54h20/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf5340dk/nrf5340/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp From 72768a79687f96c2d11144165a53953ca2cfe865 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Thu, 10 Jul 2025 08:17:41 +0200 Subject: [PATCH 0275/2141] [nrf fromtree] tests: drivers: counter: counter_basic_api: Cleanup after nRF54LM20 rename MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove duplicated test configuration after nrf54l20pdk/nrf54l20/cpuxxx was renamed to nrf54lm20dk/nrf54lm20a/cpuxxx. Signed-off-by: Sebastian Głąb (cherry picked from commit e275eeaefb51cc3df0c546ce48495916a09b5882) --- .../boards/nrf54l20pdk_nrf54l20_common.dtsi | 36 ------------------- .../nrf54l20pdk_nrf54l20_cpuapp.overlay | 3 -- .../nrf54l20pdk_nrf54l20_cpuflpr.overlay | 3 -- 3 files changed, 42 deletions(-) delete mode 100644 tests/drivers/counter/counter_basic_api/boards/nrf54l20pdk_nrf54l20_common.dtsi delete mode 100644 tests/drivers/counter/counter_basic_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay delete mode 100644 tests/drivers/counter/counter_basic_api/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay diff --git a/tests/drivers/counter/counter_basic_api/boards/nrf54l20pdk_nrf54l20_common.dtsi b/tests/drivers/counter/counter_basic_api/boards/nrf54l20pdk_nrf54l20_common.dtsi deleted file mode 100644 index 729416752870..000000000000 --- a/tests/drivers/counter/counter_basic_api/boards/nrf54l20pdk_nrf54l20_common.dtsi +++ /dev/null @@ -1,36 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - -&timer00 { - prescaler = <6>; - status = "okay"; -}; - -&timer10 { - prescaler = <4>; - status = "okay"; -}; - -&timer20 { - prescaler = <4>; - status = "okay"; -}; - -&timer21 { - prescaler = <4>; - status = "okay"; -}; - -&timer22 { - prescaler = <4>; - status = "okay"; -}; - -&timer23 { - prescaler = <4>; - status = "okay"; -}; - -&timer24 { - prescaler = <4>; - status = "okay"; -}; diff --git a/tests/drivers/counter/counter_basic_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/tests/drivers/counter/counter_basic_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay deleted file mode 100644 index 42b2852a09f8..000000000000 --- a/tests/drivers/counter/counter_basic_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay +++ /dev/null @@ -1,3 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - -#include "nrf54l20pdk_nrf54l20_common.dtsi" diff --git a/tests/drivers/counter/counter_basic_api/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay b/tests/drivers/counter/counter_basic_api/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay deleted file mode 100644 index 42b2852a09f8..000000000000 --- a/tests/drivers/counter/counter_basic_api/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay +++ /dev/null @@ -1,3 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - -#include "nrf54l20pdk_nrf54l20_common.dtsi" From 876fd2b657036090816aebce0b9acb19d087965d Mon Sep 17 00:00:00 2001 From: Khoa Nguyen Date: Tue, 22 Apr 2025 14:14:43 +0700 Subject: [PATCH 0276/2141] [nrf fromtree] tests: drivers: flash: Add support "common" for Renesas OSPI_B Add support test app "flash/common" for testing Renesas RA OSPI_B on ek_ra8m1, ek_ra8d1 Signed-off-by: Khoa Nguyen (cherry picked from commit a545e19c5cc42b6d3a09dd53841f97c679cf06a3) --- tests/drivers/flash/common/boards/ek_ra8d1.overlay | 4 ++++ .../flash/common/boards/ek_ra8d1_ospi_b_nor.conf | 4 ++++ .../flash/common/boards/ek_ra8d1_ospi_b_nor.overlay | 10 ++++++++++ tests/drivers/flash/common/boards/ek_ra8m1.overlay | 4 ++++ .../flash/common/boards/ek_ra8m1_ospi_b_nor.conf | 4 ++++ .../flash/common/boards/ek_ra8m1_ospi_b_nor.overlay | 10 ++++++++++ tests/drivers/flash/common/src/main.c | 10 +++++++++- tests/drivers/flash/common/testcase.yaml | 7 +++++++ 8 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 tests/drivers/flash/common/boards/ek_ra8d1_ospi_b_nor.conf create mode 100644 tests/drivers/flash/common/boards/ek_ra8d1_ospi_b_nor.overlay create mode 100644 tests/drivers/flash/common/boards/ek_ra8m1_ospi_b_nor.conf create mode 100644 tests/drivers/flash/common/boards/ek_ra8m1_ospi_b_nor.overlay diff --git a/tests/drivers/flash/common/boards/ek_ra8d1.overlay b/tests/drivers/flash/common/boards/ek_ra8d1.overlay index 8e42c66387c7..ee45617b0097 100644 --- a/tests/drivers/flash/common/boards/ek_ra8d1.overlay +++ b/tests/drivers/flash/common/boards/ek_ra8d1.overlay @@ -18,3 +18,7 @@ }; }; }; + +&s28hl512t { + status = "disabled"; +}; diff --git a/tests/drivers/flash/common/boards/ek_ra8d1_ospi_b_nor.conf b/tests/drivers/flash/common/boards/ek_ra8d1_ospi_b_nor.conf new file mode 100644 index 000000000000..349d703d783c --- /dev/null +++ b/tests/drivers/flash/common/boards/ek_ra8d1_ospi_b_nor.conf @@ -0,0 +1,4 @@ +# Copyright (c) 2025 Renesas Electronics Corporation +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_TEST_DRIVER_FLASH_SIZE=67108864 diff --git a/tests/drivers/flash/common/boards/ek_ra8d1_ospi_b_nor.overlay b/tests/drivers/flash/common/boards/ek_ra8d1_ospi_b_nor.overlay new file mode 100644 index 000000000000..cb05c656afaa --- /dev/null +++ b/tests/drivers/flash/common/boards/ek_ra8d1_ospi_b_nor.overlay @@ -0,0 +1,10 @@ +/* + * Copyright (c) 2025 Renesas Electronics Corporation + * SPDX-License-Identifier: Apache-2.0 + */ + +/delete-node/ &storage_partition; + +&s28hl512t { + status = "okay"; +}; diff --git a/tests/drivers/flash/common/boards/ek_ra8m1.overlay b/tests/drivers/flash/common/boards/ek_ra8m1.overlay index 8e42c66387c7..ee45617b0097 100644 --- a/tests/drivers/flash/common/boards/ek_ra8m1.overlay +++ b/tests/drivers/flash/common/boards/ek_ra8m1.overlay @@ -18,3 +18,7 @@ }; }; }; + +&s28hl512t { + status = "disabled"; +}; diff --git a/tests/drivers/flash/common/boards/ek_ra8m1_ospi_b_nor.conf b/tests/drivers/flash/common/boards/ek_ra8m1_ospi_b_nor.conf new file mode 100644 index 000000000000..349d703d783c --- /dev/null +++ b/tests/drivers/flash/common/boards/ek_ra8m1_ospi_b_nor.conf @@ -0,0 +1,4 @@ +# Copyright (c) 2025 Renesas Electronics Corporation +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_TEST_DRIVER_FLASH_SIZE=67108864 diff --git a/tests/drivers/flash/common/boards/ek_ra8m1_ospi_b_nor.overlay b/tests/drivers/flash/common/boards/ek_ra8m1_ospi_b_nor.overlay new file mode 100644 index 000000000000..cb05c656afaa --- /dev/null +++ b/tests/drivers/flash/common/boards/ek_ra8m1_ospi_b_nor.overlay @@ -0,0 +1,10 @@ +/* + * Copyright (c) 2025 Renesas Electronics Corporation + * SPDX-License-Identifier: Apache-2.0 + */ + +/delete-node/ &storage_partition; + +&s28hl512t { + status = "okay"; +}; diff --git a/tests/drivers/flash/common/src/main.c b/tests/drivers/flash/common/src/main.c index fa2fd053fd81..03b3c08a6cf9 100644 --- a/tests/drivers/flash/common/src/main.c +++ b/tests/drivers/flash/common/src/main.c @@ -12,6 +12,8 @@ #if defined(CONFIG_NORDIC_QSPI_NOR) #define TEST_AREA_DEV_NODE DT_INST(0, nordic_qspi_nor) +#elif defined(CONFIG_FLASH_RENESAS_RA_OSPI_B) +#define TEST_AREA_DEV_NODE DT_INST(0, renesas_ra_ospi_b_nor) #elif defined(CONFIG_SPI_NOR) #define TEST_AREA_DEV_NODE DT_INST(0, jedec_spi_nor) #elif defined(CONFIG_FLASH_MSPI_NOR) @@ -32,12 +34,18 @@ #elif defined(TEST_AREA_DEV_NODE) #define TEST_AREA_DEVICE DEVICE_DT_GET(TEST_AREA_DEV_NODE) +#if defined CONFIG_FLASH_RENESAS_RA_OSPI_B +#define TEST_AREA_OFFSET 0x40000 +#else #define TEST_AREA_OFFSET 0xff000 +#endif #if DT_NODE_HAS_PROP(TEST_AREA_DEV_NODE, size_in_bytes) #define TEST_AREA_MAX DT_PROP(TEST_AREA_DEV_NODE, size_in_bytes) -#else +#elif DT_NODE_HAS_PROP(TEST_AREA_DEV_NODE, size) #define TEST_AREA_MAX (DT_PROP(TEST_AREA_DEV_NODE, size) / 8) +#else +#define TEST_AREA_MAX DT_REG_SIZE(TEST_AREA_DEV_NODE) #endif #else diff --git a/tests/drivers/flash/common/testcase.yaml b/tests/drivers/flash/common/testcase.yaml index a46ecb50e11d..cabd1ffa0c66 100644 --- a/tests/drivers/flash/common/testcase.yaml +++ b/tests/drivers/flash/common/testcase.yaml @@ -139,3 +139,10 @@ tests: filter: dt_compat_enabled("soc-nv-flash") and dt_compat_enabled("jedec,spi-nor") extra_args: - CONFIG_SPI_NOR=n + drivers.flash.common.ra_ospi_b_nor: + platform_allow: + - ek_ra8m1 + - ek_ra8d1 + extra_args: + - DTC_OVERLAY_FILE="./boards/${BOARD}_ospi_b_nor.overlay" + - CONF_FILE="./prj.conf ./boards/${BOARD}_ospi_b_nor.conf" From a0452de0058be9ce382626ac65bbe559f380f458 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Mon, 26 May 2025 10:50:50 +0200 Subject: [PATCH 0277/2141] [nrf fromtree] tests: drivers: flash: common: Fix page size when no erase is required MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When no flash device requires erase, this test does not retrieve flash page size with flash_get_page_info_by_offs(), but instead it takes an arbitrary page size based on the test area length. Since the test_flash_copy routine needs to use two pages, the test area needs to be split into at least two parts. Correct the related code and add a check if test_flash_copy requirements are met. Signed-off-by: Andrzej Głąbek (cherry picked from commit fb94343ce45d1324189fbf2ff0fffc52e4a9a525) --- tests/drivers/flash/common/src/main.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/drivers/flash/common/src/main.c b/tests/drivers/flash/common/src/main.c index 03b3c08a6cf9..ab0e63bb6092 100644 --- a/tests/drivers/flash/common/src/main.c +++ b/tests/drivers/flash/common/src/main.c @@ -87,7 +87,8 @@ static void flash_driver_before(void *arg) TC_PRINT("No devices with erase requirement present\n"); erase_value = 0x55; page_info.start_offset = TEST_AREA_OFFSET; - page_info.size = TEST_AREA_MAX - TEST_AREA_OFFSET; + /* test_flash_copy uses 2 pages, so split the test area */ + page_info.size = (TEST_AREA_MAX - TEST_AREA_OFFSET) / 2; } @@ -111,6 +112,10 @@ static void flash_driver_before(void *arg) zassert_true((TEST_AREA_OFFSET + EXPECTED_SIZE) <= TEST_AREA_MAX, "Test area exceeds flash size"); + /* Check if test region is suitable for test_flash_copy */ + zassert_true((TEST_AREA_OFFSET + 2 * page_info.size) <= TEST_AREA_MAX, + "test_flash_copy needs 2 flash pages"); + /* Check if flash is cleared */ if (IS_ENABLED(CONFIG_FLASH_HAS_EXPLICIT_ERASE) && ebw_required) { bool is_buf_clear = true; From 9c2ac9b66ba71b50e330f8ada6ed7a6f30b8c8e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Thu, 10 Jul 2025 08:22:56 +0200 Subject: [PATCH 0278/2141] [nrf fromtree] tests: drivers: flash: common: Cleanup after nRF54LM20 rename MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove duplicated test configuration after nrf54l20pdk/nrf54l20/cpuxxx was renamed to nrf54lm20dk/nrf54lm20a/cpuxxx. Enable external memory node. Use separate test configuration as external memory works only on nRF54LM20 DKs with `external_flash` fixture. Signed-off-by: Sebastian Głąb (cherry picked from commit 6d03831708244d0f7b855efca9b9d3948465b619) --- .../flash/common/boards/nrf54l20pdk_nrf54l20_cpuapp.conf | 4 ---- .../common/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 9 +++++++++ tests/drivers/flash/common/testcase.yaml | 9 +++++++-- 3 files changed, 16 insertions(+), 6 deletions(-) delete mode 100644 tests/drivers/flash/common/boards/nrf54l20pdk_nrf54l20_cpuapp.conf create mode 100644 tests/drivers/flash/common/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay diff --git a/tests/drivers/flash/common/boards/nrf54l20pdk_nrf54l20_cpuapp.conf b/tests/drivers/flash/common/boards/nrf54l20pdk_nrf54l20_cpuapp.conf deleted file mode 100644 index 821a5e77e5b5..000000000000 --- a/tests/drivers/flash/common/boards/nrf54l20pdk_nrf54l20_cpuapp.conf +++ /dev/null @@ -1,4 +0,0 @@ -CONFIG_FCB=y -CONFIG_FLASH_MAP=y -CONFIG_SETTINGS=y -CONFIG_SETTINGS_FCB=y diff --git a/tests/drivers/flash/common/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/flash/common/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay new file mode 100644 index 000000000000..8a5afda2ab00 --- /dev/null +++ b/tests/drivers/flash/common/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&mx25r64 { + status = "okay"; +}; diff --git a/tests/drivers/flash/common/testcase.yaml b/tests/drivers/flash/common/testcase.yaml index cabd1ffa0c66..0433d024ff15 100644 --- a/tests/drivers/flash/common/testcase.yaml +++ b/tests/drivers/flash/common/testcase.yaml @@ -37,6 +37,8 @@ tests: filter: ((CONFIG_FLASH_HAS_DRIVER_ENABLED and not CONFIG_TRUSTED_EXECUTION_NONSECURE) and (dt_label_with_parent_compat_enabled("storage_partition", "fixed-partitions") or dt_label_with_parent_compat_enabled("storage_partition", "nordic,owned-partitions"))) + platform_exclude: + - nrf54lm20dk/nrf54lm20a/cpuapp integration_platforms: - qemu_x86 - mimxrt1060_evk/mimxrt1062/qspi @@ -46,10 +48,13 @@ tests: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l10/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - nrf54h20dk/nrf54h20/cpuapp - ophelia4ev/nrf54l15/cpuapp + drivers.flash.common.nrf54lm20a: + platform_allow: + - nrf54lm20dk/nrf54lm20a/cpuapp + harness_config: + fixture: external_flash drivers.flash.common.tfm_ns: build_only: true filter: (CONFIG_FLASH_HAS_DRIVER_ENABLED and CONFIG_TRUSTED_EXECUTION_NONSECURE From 7961ea2e40a08554222ee5d3d720030f81ac1b9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Thu, 10 Jul 2025 08:24:15 +0200 Subject: [PATCH 0279/2141] [nrf fromtree] tests: drivers: flash: negative_tests: Cleanup after nRF54LM20 rename MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove duplicated test configuration after nrf54l20pdk/nrf54l20/cpuxxx was renamed to nrf54lm20dk/nrf54lm20a/cpuxxx. Signed-off-by: Sebastian Głąb (cherry picked from commit dd932f22567eab7abb1379c32f0fe27313d8e5f6) --- tests/drivers/flash/negative_tests/testcase.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/drivers/flash/negative_tests/testcase.yaml b/tests/drivers/flash/negative_tests/testcase.yaml index 3321a0273ba4..7a55212aa3f5 100644 --- a/tests/drivers/flash/negative_tests/testcase.yaml +++ b/tests/drivers/flash/negative_tests/testcase.yaml @@ -5,9 +5,8 @@ common: tests: drivers.flash.negative_tests: platform_allow: + - nrf54h20dk/nrf54h20/cpuapp - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - - nrf54h20dk/nrf54h20/cpuapp - ophelia4ev/nrf54l15/cpuapp From 05bc31c35dd033829b327518ef8237699a95ee31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Thu, 10 Jul 2025 08:28:11 +0200 Subject: [PATCH 0280/2141] [nrf fromtree] tests: drivers: gpio: gpio_basic_api: Cleanup after nRF54LM20 rename MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove duplicated test configuration after nrf54l20pdk/nrf54l20/cpuxxx was renamed to nrf54lm20dk/nrf54lm20a/cpuxxx. Signed-off-by: Sebastian Głąb (cherry picked from commit 942e2a81950749526c1220f0d2be313c352e0c88) --- .../nrf54l20pdk_nrf54l20_common.overlay | 21 ------------------- .../nrf54l20pdk_nrf54l20_cpuapp.overlay | 7 ------- .../nrf54l20pdk_nrf54l20_cpuflpr.overlay | 7 ------- 3 files changed, 35 deletions(-) delete mode 100644 tests/drivers/gpio/gpio_basic_api/boards/nrf54l20pdk_nrf54l20_common.overlay delete mode 100644 tests/drivers/gpio/gpio_basic_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay delete mode 100644 tests/drivers/gpio/gpio_basic_api/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay diff --git a/tests/drivers/gpio/gpio_basic_api/boards/nrf54l20pdk_nrf54l20_common.overlay b/tests/drivers/gpio/gpio_basic_api/boards/nrf54l20pdk_nrf54l20_common.overlay deleted file mode 100644 index 8eb1b3c9f9ff..000000000000 --- a/tests/drivers/gpio/gpio_basic_api/boards/nrf54l20pdk_nrf54l20_common.overlay +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - resources { - compatible = "test-gpio-basic-api"; - out-gpios = <&gpio1 10 0>; - in-gpios = <&gpio1 11 0>; - }; -}; - -&gpiote20 { - status = "okay"; -}; - -&gpio1 { - status = "okay"; -}; diff --git a/tests/drivers/gpio/gpio_basic_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/tests/drivers/gpio/gpio_basic_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay deleted file mode 100644 index 3ed56c4a6c81..000000000000 --- a/tests/drivers/gpio/gpio_basic_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay +++ /dev/null @@ -1,7 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include "nrf54l20pdk_nrf54l20_common.overlay" diff --git a/tests/drivers/gpio/gpio_basic_api/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay b/tests/drivers/gpio/gpio_basic_api/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay deleted file mode 100644 index 91c033f0f941..000000000000 --- a/tests/drivers/gpio/gpio_basic_api/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay +++ /dev/null @@ -1,7 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include "nrf54l20pdk_nrf54l20_common.overlay" From ce520ebeb547e1c31d0fe079a39b1658811612ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Thu, 10 Jul 2025 08:32:23 +0200 Subject: [PATCH 0281/2141] [nrf fromtree] tests: drivers: i2c: i2c_target_api: Cleanup after nRF54LM20 rename MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove duplicated test configuration after nrf54l20pdk/nrf54l20/cpuxxx was renamed to nrf54lm20dk/nrf54lm20a/cpuxxx. Signed-off-by: Sebastian Głąb (cherry picked from commit 9a8988d292c439019208ec855b66ae4534697249) --- .../boards/nrf54l20pdk_nrf54l20_cpuapp.conf | 1 - .../nrf54l20pdk_nrf54l20_cpuapp.overlay | 68 ------------------- .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 6 ++ .../drivers/i2c/i2c_target_api/testcase.yaml | 2 +- 4 files changed, 7 insertions(+), 70 deletions(-) delete mode 100644 tests/drivers/i2c/i2c_target_api/boards/nrf54l20pdk_nrf54l20_cpuapp.conf delete mode 100644 tests/drivers/i2c/i2c_target_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay diff --git a/tests/drivers/i2c/i2c_target_api/boards/nrf54l20pdk_nrf54l20_cpuapp.conf b/tests/drivers/i2c/i2c_target_api/boards/nrf54l20pdk_nrf54l20_cpuapp.conf deleted file mode 100644 index 2510d6673c1b..000000000000 --- a/tests/drivers/i2c/i2c_target_api/boards/nrf54l20pdk_nrf54l20_cpuapp.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_I2C_NRFX_TWIS_BUF_SIZE=256 diff --git a/tests/drivers/i2c/i2c_target_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/tests/drivers/i2c/i2c_target_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay deleted file mode 100644 index f04022cf8f35..000000000000 --- a/tests/drivers/i2c/i2c_target_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay +++ /dev/null @@ -1,68 +0,0 @@ -/* - * SDA = P1.8 and P1.9 - * SCL = P1.14 and P1.15 - */ - -&pinctrl { - i2c21_default: i2c21_default { - group1 { - psels = , - ; - bias-pull-up; - }; - }; - - i2c21_sleep: i2c21_sleep { - group1 { - psels = , - ; - low-power-enable; - }; - }; - - i2c22_default: i2c22_default { - group1 { - psels = , - ; - bias-pull-up; - }; - }; - - i2c22_sleep: i2c22_sleep { - group1 { - psels = , - ; - low-power-enable; - }; - }; -}; - -&i2c21 { - pinctrl-0 = <&i2c21_default>; - pinctrl-1 = <&i2c21_sleep>; - pinctrl-names = "default", "sleep"; - zephyr,concat-buf-size = <256>; - status = "okay"; - - eeprom1: eeprom@56 { - compatible = "zephyr,i2c-target-eeprom"; - reg = <0x56>; - address-width = <8>; - size = <256>; - }; -}; - -&i2c22 { - compatible = "nordic,nrf-twis"; - pinctrl-0 = <&i2c22_default>; - pinctrl-1 = <&i2c22_sleep>; - pinctrl-names = "default", "sleep"; - status = "okay"; - - eeprom0: eeprom@54 { - compatible = "zephyr,i2c-target-eeprom"; - reg = <0x54>; - address-width = <8>; - size = <256>; - }; -}; diff --git a/tests/drivers/i2c/i2c_target_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/i2c/i2c_target_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay index 3459599351ba..f6d76c7253c2 100644 --- a/tests/drivers/i2c/i2c_target_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ b/tests/drivers/i2c/i2c_target_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -1,3 +1,9 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + /* * SDA = P1.13 and P1.14 * SCL = P1.23 and P1.24 diff --git a/tests/drivers/i2c/i2c_target_api/testcase.yaml b/tests/drivers/i2c/i2c_target_api/testcase.yaml index 7f888f95e123..8c95390a72c0 100644 --- a/tests/drivers/i2c/i2c_target_api/testcase.yaml +++ b/tests/drivers/i2c/i2c_target_api/testcase.yaml @@ -64,8 +64,8 @@ tests: - nrf5340dk/nrf5340/cpuapp - nrf54h20dk/nrf54h20/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: - max32690evkit/max32690/m4 + - nrf54l15dk/nrf54l15/cpuapp From ecc4c9dd57394f4b7de062b8d1aa58cae266434c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Thu, 10 Jul 2025 08:33:41 +0200 Subject: [PATCH 0282/2141] [nrf fromtree] tests: drivers: i2s: i2s_additional: Enable test on nrf54lm20dk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add overlay required to run the test on nrf54lm20dk/nrf54lm20a/cpuapp. Signed-off-by: Sebastian Głąb (cherry picked from commit a850089d6b3f57c1b3bdbe2919ff118e81f47a42) --- ...20a_cpuapp.overlay => nrf54lm20dk_nrf54lm20a_cpuapp.overlay} | 0 tests/drivers/i2s/i2s_additional/testcase.yaml | 2 ++ 2 files changed, 2 insertions(+) rename tests/drivers/i2s/i2s_additional/boards/{nrf54lm20pdk_nrf54lm20a_cpuapp.overlay => nrf54lm20dk_nrf54lm20a_cpuapp.overlay} (100%) diff --git a/tests/drivers/i2s/i2s_additional/boards/nrf54lm20pdk_nrf54lm20a_cpuapp.overlay b/tests/drivers/i2s/i2s_additional/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay similarity index 100% rename from tests/drivers/i2s/i2s_additional/boards/nrf54lm20pdk_nrf54lm20a_cpuapp.overlay rename to tests/drivers/i2s/i2s_additional/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay diff --git a/tests/drivers/i2s/i2s_additional/testcase.yaml b/tests/drivers/i2s/i2s_additional/testcase.yaml index c45a5482b7f4..9dcb82d61f3f 100644 --- a/tests/drivers/i2s/i2s_additional/testcase.yaml +++ b/tests/drivers/i2s/i2s_additional/testcase.yaml @@ -16,10 +16,12 @@ tests: - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp - nrf54l15dk/nrf54l15/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp integration_platforms: - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp - nrf54l15dk/nrf54l15/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp drivers.i2s.additional.gpio_loopback.54h: harness_config: From c33da1a26e8fc434bc6f907f74371ffd98c5dc4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Thu, 10 Jul 2025 08:34:44 +0200 Subject: [PATCH 0283/2141] [nrf fromtree] tests: drivers: i2s: i2s_api: Cleanup after nRF54LM20 rename MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove duplicated test configuration after nrf54l20pdk/nrf54l20/cpuxxx was renamed to nrf54lm20dk/nrf54lm20a/cpuxxx. Signed-off-by: Sebastian Głąb (cherry picked from commit 98443a87f96f9a4e03bc67614098c312dbca1d5d) --- .../nrf54l20pdk_nrf54l20_cpuapp.overlay | 30 ------------------- 1 file changed, 30 deletions(-) delete mode 100644 tests/drivers/i2s/i2s_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay diff --git a/tests/drivers/i2s/i2s_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/tests/drivers/i2s/i2s_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay deleted file mode 100644 index 09a2cb0459c8..000000000000 --- a/tests/drivers/i2s/i2s_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/* i2s-node0 is the transmitter/receiver */ - -/ { - aliases { - i2s-node0 = &tdm; - }; -}; - -&pinctrl { - tdm_default_alt: tdm_default_alt { - group1 { - psels = , - , - , - ; - }; - }; -}; - -&tdm { - status = "okay"; - pinctrl-0 = <&tdm_default_alt>; - pinctrl-names = "default"; -}; From e97e2089ee0d97a22c1d27109418d0cae0397450 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Thu, 10 Jul 2025 08:35:48 +0200 Subject: [PATCH 0284/2141] [nrf fromtree] tests: drivers: i2s: i2s_speed: Cleanup after nRF54LM20 rename MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove duplicated test configuration after nrf54l20pdk/nrf54l20/cpuxxx was renamed to nrf54lm20dk/nrf54lm20a/cpuxxx. Signed-off-by: Sebastian Głąb (cherry picked from commit 796adb60caddbca0103cfcd5400cea97aa3133b5) --- .../nrf54l20pdk_nrf54l20_cpuapp.overlay | 30 ------------------- 1 file changed, 30 deletions(-) delete mode 100644 tests/drivers/i2s/i2s_speed/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay diff --git a/tests/drivers/i2s/i2s_speed/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/tests/drivers/i2s/i2s_speed/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay deleted file mode 100644 index 09a2cb0459c8..000000000000 --- a/tests/drivers/i2s/i2s_speed/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/* i2s-node0 is the transmitter/receiver */ - -/ { - aliases { - i2s-node0 = &tdm; - }; -}; - -&pinctrl { - tdm_default_alt: tdm_default_alt { - group1 { - psels = , - , - , - ; - }; - }; -}; - -&tdm { - status = "okay"; - pinctrl-0 = <&tdm_default_alt>; - pinctrl-names = "default"; -}; From a61cbeb6ea3be414cf12154fc0a012e6aa51a6cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Thu, 10 Jul 2025 08:40:01 +0200 Subject: [PATCH 0285/2141] [nrf fromtree] tests: drivers: pwm: pwm_gpio_loopback: Enable test on nrf54lm20dk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add overlay required to run the test on nrf54lm20dk/nrf54lm20a/cpuapp. Signed-off-by: Sebastian Głąb (cherry picked from commit 25b90acc70dca3c5fe65c712ee4d3cf6702d8a42) --- .../boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf | 1 + .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 36 +++++++++++++++++++ .../pwm/pwm_gpio_loopback/testcase.yaml | 1 + 3 files changed, 38 insertions(+) create mode 100644 tests/drivers/pwm/pwm_gpio_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf create mode 100644 tests/drivers/pwm/pwm_gpio_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay diff --git a/tests/drivers/pwm/pwm_gpio_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf b/tests/drivers/pwm/pwm_gpio_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf new file mode 100644 index 000000000000..795414a504ab --- /dev/null +++ b/tests/drivers/pwm/pwm_gpio_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf @@ -0,0 +1 @@ +CONFIG_SKIP_EDGE_NUM=4 diff --git a/tests/drivers/pwm/pwm_gpio_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/pwm/pwm_gpio_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay new file mode 100644 index 000000000000..89ff80dcb677 --- /dev/null +++ b/tests/drivers/pwm/pwm_gpio_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + * + * Test requires jumper between: + * - PWM20 OUT[0] at P1.29 <-> GPIO input at P1.00 + */ + +/ { + zephyr,user { + pwms = <&pwm20 0 160000 PWM_POLARITY_NORMAL>; + gpios = <&gpio1 0 GPIO_ACTIVE_HIGH>; + }; +}; + +&pinctrl { + pwm20_alt: pwm20_alt { + group1 { + psels = ; + }; + }; + + pwm20_alt_sleep: pwm20_alt_sleep { + group1 { + psels = ; + low-power-enable; + }; + }; +}; + +&pwm20 { + status = "okay"; + pinctrl-0 = <&pwm20_alt>; + pinctrl-1 = <&pwm20_alt_sleep>; + pinctrl-names = "default", "sleep"; +}; diff --git a/tests/drivers/pwm/pwm_gpio_loopback/testcase.yaml b/tests/drivers/pwm/pwm_gpio_loopback/testcase.yaml index 7173c8c27206..99e22b54374b 100644 --- a/tests/drivers/pwm/pwm_gpio_loopback/testcase.yaml +++ b/tests/drivers/pwm/pwm_gpio_loopback/testcase.yaml @@ -20,4 +20,5 @@ tests: platform_allow: - nrf54h20dk/nrf54h20/cpuapp - nrf54l15dk/nrf54l15/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp From 7afa0ecf6f992b1e741b31629c644c1f7cafcd43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Thu, 10 Jul 2025 08:41:15 +0200 Subject: [PATCH 0286/2141] [nrf fromtree] tests: drivers: retianed_mem: api: Cleanup after nRF54LM20 rename MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove duplicated test configuration after nrf54l20pdk/nrf54l20/cpuxxx was renamed to nrf54lm20dk/nrf54lm20a/cpuxxx. Signed-off-by: Sebastian Głąb (cherry picked from commit cb3a94acc13fd62bae6da3b0822989d102134649) --- .../boards/nrf54l20pdk_nrf54l20_cpuapp.conf | 1 - .../nrf54l20pdk_nrf54l20_cpuapp.overlay | 25 ------------------- tests/drivers/retained_mem/api/testcase.yaml | 1 - 3 files changed, 27 deletions(-) delete mode 100644 tests/drivers/retained_mem/api/boards/nrf54l20pdk_nrf54l20_cpuapp.conf delete mode 100644 tests/drivers/retained_mem/api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay diff --git a/tests/drivers/retained_mem/api/boards/nrf54l20pdk_nrf54l20_cpuapp.conf b/tests/drivers/retained_mem/api/boards/nrf54l20pdk_nrf54l20_cpuapp.conf deleted file mode 100644 index c15ba3ed96da..000000000000 --- a/tests/drivers/retained_mem/api/boards/nrf54l20pdk_nrf54l20_cpuapp.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_POWEROFF=y diff --git a/tests/drivers/retained_mem/api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/tests/drivers/retained_mem/api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay deleted file mode 100644 index dc81069eca5f..000000000000 --- a/tests/drivers/retained_mem/api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay +++ /dev/null @@ -1,25 +0,0 @@ -/ { - cpuapp_sram@2007ec00 { - compatible = "zephyr,memory-region", "mmio-sram"; - reg = <0x2007ec00 DT_SIZE_K(4)>; - zephyr,memory-region = "RetainedMem"; - status = "okay"; - - retainedmem0: retainedmem { - compatible = "zephyr,retained-ram"; - status = "okay"; - }; - }; - - aliases { - retainedmemtestdevice = &retainedmem0; - }; -}; - -&cpuapp_sram { - /* Shrink SRAM size to avoid overlap with retained memory region: - * 511 - 4 = 507KB = 0x7ec00 - */ - reg = <0x20000000 DT_SIZE_K(507)>; - ranges = <0x0 0x20000000 0x7ec00>; -}; diff --git a/tests/drivers/retained_mem/api/testcase.yaml b/tests/drivers/retained_mem/api/testcase.yaml index ddcc005a16ac..88bd6ae16ff4 100644 --- a/tests/drivers/retained_mem/api/testcase.yaml +++ b/tests/drivers/retained_mem/api/testcase.yaml @@ -14,7 +14,6 @@ tests: - nrf54l15dk/nrf54l05/cpuapp - nrf54l15dk/nrf54l10/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: From be29496b415f11167ec1a79b5a59fbfc963d269d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Thu, 10 Jul 2025 08:43:57 +0200 Subject: [PATCH 0287/2141] [nrf fromtree] tests: drivers: sensor: temp_sensor: Cleanup after nRF54LM20 rename MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove duplicated test configuration after nrf54l20pdk/nrf54l20/cpuxxx was renamed to nrf54lm20dk/nrf54lm20a/cpuxxx. Signed-off-by: Sebastian Głąb (cherry picked from commit a32ca2b3604cc08ebca90063043046b9f3b920bd) --- .../boards/nrf54l20pdk_nrf54l20_cpuapp.overlay | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 tests/drivers/sensor/temp_sensor/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay diff --git a/tests/drivers/sensor/temp_sensor/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/tests/drivers/sensor/temp_sensor/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay deleted file mode 100644 index b1f2a2b9ec59..000000000000 --- a/tests/drivers/sensor/temp_sensor/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -temp_sensor: &temp { - status = "okay"; -}; From c0c66df803c8cd341275a719c2f7d76c6138bc15 Mon Sep 17 00:00:00 2001 From: Khoa Nguyen Date: Tue, 15 Apr 2025 18:05:12 +0700 Subject: [PATCH 0288/2141] [nrf fromtree] tests: drivers: spi: Add support spi_controller_peripheral for RA Add support test app support spi_controller_peripheral for Renesas RA boards: ek_ra6m5, ek_ra6m4, ek_ra6m3, ek_ra6m2, ek_ra6m1, ek_ra6e2, fpb_ra6e2, ek_ra4m1, ek_ra2a1 Signed-off-by: Khoa Nguyen (cherry picked from commit 291860e193f7e648a73dda2e1199045805918478) --- .../boards/ek_ra2a1.conf | 6 +++ .../boards/ek_ra2a1.overlay | 50 +++++++++++++++++ .../boards/ek_ra4m1.conf | 6 +++ .../boards/ek_ra4m1.overlay | 50 +++++++++++++++++ .../boards/ek_ra6e2.conf | 6 +++ .../boards/ek_ra6e2.overlay | 52 ++++++++++++++++++ .../boards/ek_ra6m1.conf | 6 +++ .../boards/ek_ra6m1.overlay | 54 +++++++++++++++++++ .../boards/ek_ra6m2.conf | 6 +++ .../boards/ek_ra6m2.overlay | 54 +++++++++++++++++++ .../boards/ek_ra6m3.conf | 6 +++ .../boards/ek_ra6m3.overlay | 54 +++++++++++++++++++ .../boards/ek_ra6m4.conf | 6 +++ .../boards/ek_ra6m4.overlay | 52 ++++++++++++++++++ .../boards/ek_ra6m5.conf | 6 +++ .../boards/ek_ra6m5.overlay | 52 ++++++++++++++++++ .../boards/fpb_ra6e2.conf | 6 +++ .../boards/fpb_ra6e2.overlay | 52 ++++++++++++++++++ 18 files changed, 524 insertions(+) create mode 100644 tests/drivers/spi/spi_controller_peripheral/boards/ek_ra2a1.conf create mode 100644 tests/drivers/spi/spi_controller_peripheral/boards/ek_ra2a1.overlay create mode 100644 tests/drivers/spi/spi_controller_peripheral/boards/ek_ra4m1.conf create mode 100644 tests/drivers/spi/spi_controller_peripheral/boards/ek_ra4m1.overlay create mode 100644 tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6e2.conf create mode 100644 tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6e2.overlay create mode 100644 tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m1.conf create mode 100644 tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m1.overlay create mode 100644 tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m2.conf create mode 100644 tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m2.overlay create mode 100644 tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m3.conf create mode 100644 tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m3.overlay create mode 100644 tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m4.conf create mode 100644 tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m4.overlay create mode 100644 tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m5.conf create mode 100644 tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m5.overlay create mode 100644 tests/drivers/spi/spi_controller_peripheral/boards/fpb_ra6e2.conf create mode 100644 tests/drivers/spi/spi_controller_peripheral/boards/fpb_ra6e2.overlay diff --git a/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra2a1.conf b/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra2a1.conf new file mode 100644 index 000000000000..d241d5b09565 --- /dev/null +++ b/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra2a1.conf @@ -0,0 +1,6 @@ +# Copyright (c) 2025 Renesas Electronics Corporation +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_SPI_INTERRUPT=y +CONFIG_SPI_RA_DTC=y +CONFIG_TESTED_SPI_MODE=1 diff --git a/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra2a1.overlay b/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra2a1.overlay new file mode 100644 index 000000000000..d9660d950ac9 --- /dev/null +++ b/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra2a1.overlay @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2025 Renesas Electronics Corporation + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + spi0_default_alt: spi0_default_alt { + group1 { + /* MISO MOSI RSPCK */ + psels = , + , + ; + }; + }; + + spi1_default_alt: spi1_default_alt { + group1 { + /* MISO MOSI RSPCK */ + psels = , + , + ; + }; + }; +}; + +&spi0 { + rx-dtc; + tx-dtc; + status = "okay"; + pinctrl-0 = <&spi0_default_alt>; + pinctrl-names = "default"; + cs-gpios = <&ioport1 12 GPIO_ACTIVE_LOW>; + interrupts = <24 1>, <25 1>, <26 1>, <27 1>; + interrupt-names = "rxi", "txi", "tei", "eri"; + + dut_spi_dt: test-spi-dev@0 { + compatible = "vnd,spi-device"; + reg = <0>; + spi-max-frequency = <1000000>; + }; +}; + +dut_spis: &spi1 { + rx-dtc; + tx-dtc; + status = "okay"; + pinctrl-0 = <&spi1_default_alt>; + pinctrl-names = "default"; + cs-gpios = <&ioport2 6 GPIO_ACTIVE_LOW>; +}; diff --git a/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra4m1.conf b/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra4m1.conf new file mode 100644 index 000000000000..d241d5b09565 --- /dev/null +++ b/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra4m1.conf @@ -0,0 +1,6 @@ +# Copyright (c) 2025 Renesas Electronics Corporation +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_SPI_INTERRUPT=y +CONFIG_SPI_RA_DTC=y +CONFIG_TESTED_SPI_MODE=1 diff --git a/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra4m1.overlay b/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra4m1.overlay new file mode 100644 index 000000000000..8efced0263c8 --- /dev/null +++ b/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra4m1.overlay @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2025 Renesas Electronics Corporation + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + spi0_default_alt: spi0_default_alt { + group1 { + /* MISO MOSI RSPCK */ + psels = , + , + ; + }; + }; + + spi1_default_alt: spi1_default_alt { + group1 { + /* MISO MOSI RSPCK SSL */ + psels = , + , + , + ; + }; + }; +}; + +&spi0 { + rx-dtc; + tx-dtc; + status = "okay"; + pinctrl-0 = <&spi0_default_alt>; + pinctrl-names = "default"; + cs-gpios = <&ioport4 13 GPIO_ACTIVE_LOW>; + interrupts = <23 1>, <24 1>, <25 1>, <26 1>; + interrupt-names = "rxi", "txi", "tei", "eri"; + + dut_spi_dt: test-spi-dev@0 { + compatible = "vnd,spi-device"; + reg = <0>; + spi-max-frequency = <1000000>; + }; +}; + +dut_spis: &spi1 { + rx-dtc; + tx-dtc; + status = "okay"; + pinctrl-0 = <&spi1_default_alt>; + pinctrl-names = "default"; +}; diff --git a/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6e2.conf b/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6e2.conf new file mode 100644 index 000000000000..d241d5b09565 --- /dev/null +++ b/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6e2.conf @@ -0,0 +1,6 @@ +# Copyright (c) 2025 Renesas Electronics Corporation +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_SPI_INTERRUPT=y +CONFIG_SPI_RA_DTC=y +CONFIG_TESTED_SPI_MODE=1 diff --git a/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6e2.overlay b/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6e2.overlay new file mode 100644 index 000000000000..e58fa671a9ac --- /dev/null +++ b/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6e2.overlay @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2025 Renesas Electronics Corporation + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + spi0_default_alt: spi0_default_alt { + group1 { + /* MISO MOSI RSPCK */ + psels = , + , + ; + }; + }; + + spi1_default_alt: spi1_default_alt { + group1 { + /* MISO MOSI RSPCK SSL */ + psels = , + , + , + ; + }; + }; +}; + +&ioport1 { + status = "okay"; +}; + +&spi0 { + rx-dtc; + tx-dtc; + status = "okay"; + pinctrl-0 = <&spi0_default_alt>; + pinctrl-names = "default"; + cs-gpios = <&ioport3 1 GPIO_ACTIVE_LOW>; + + dut_spi_dt: test-spi-dev@0 { + compatible = "vnd,spi-device"; + reg = <0>; + spi-max-frequency = <1000000>; + }; +}; + +dut_spis: &spi1 { + rx-dtc; + tx-dtc; + status = "okay"; + pinctrl-0 = <&spi1_default_alt>; + pinctrl-names = "default"; +}; diff --git a/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m1.conf b/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m1.conf new file mode 100644 index 000000000000..d241d5b09565 --- /dev/null +++ b/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m1.conf @@ -0,0 +1,6 @@ +# Copyright (c) 2025 Renesas Electronics Corporation +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_SPI_INTERRUPT=y +CONFIG_SPI_RA_DTC=y +CONFIG_TESTED_SPI_MODE=1 diff --git a/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m1.overlay b/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m1.overlay new file mode 100644 index 000000000000..521edfef0678 --- /dev/null +++ b/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m1.overlay @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2025 Renesas Electronics Corporation + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + spi0_default_alt: spi0_default_alt { + group1 { + /* MISO MOSI RSPCK */ + psels = , + , + ; + }; + }; + + spi1_default_alt: spi1_default_alt { + group1 { + /* MISO MOSI RSPCK SSL */ + psels = , + , + , + ; + }; + }; +}; + +&ioport1 { + status = "okay"; +}; + +&spi0 { + rx-dtc; + tx-dtc; + status = "okay"; + pinctrl-0 = <&spi0_default_alt>; + pinctrl-names = "default"; + cs-gpios = <&ioport1 3 GPIO_ACTIVE_LOW>; + + dut_spi_dt: test-spi-dev@0 { + compatible = "vnd,spi-device"; + reg = <0>; + spi-max-frequency = <1000000>; + }; +}; + +dut_spis: &spi1 { + rx-dtc; + tx-dtc; + status = "okay"; + pinctrl-0 = <&spi1_default_alt>; + pinctrl-names = "default"; + interrupts = <92 1>, <93 1>, <94 1>, <95 1>; + interrupt-names = "rxi", "txi", "tei", "eri"; +}; diff --git a/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m2.conf b/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m2.conf new file mode 100644 index 000000000000..d241d5b09565 --- /dev/null +++ b/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m2.conf @@ -0,0 +1,6 @@ +# Copyright (c) 2025 Renesas Electronics Corporation +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_SPI_INTERRUPT=y +CONFIG_SPI_RA_DTC=y +CONFIG_TESTED_SPI_MODE=1 diff --git a/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m2.overlay b/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m2.overlay new file mode 100644 index 000000000000..521edfef0678 --- /dev/null +++ b/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m2.overlay @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2025 Renesas Electronics Corporation + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + spi0_default_alt: spi0_default_alt { + group1 { + /* MISO MOSI RSPCK */ + psels = , + , + ; + }; + }; + + spi1_default_alt: spi1_default_alt { + group1 { + /* MISO MOSI RSPCK SSL */ + psels = , + , + , + ; + }; + }; +}; + +&ioport1 { + status = "okay"; +}; + +&spi0 { + rx-dtc; + tx-dtc; + status = "okay"; + pinctrl-0 = <&spi0_default_alt>; + pinctrl-names = "default"; + cs-gpios = <&ioport1 3 GPIO_ACTIVE_LOW>; + + dut_spi_dt: test-spi-dev@0 { + compatible = "vnd,spi-device"; + reg = <0>; + spi-max-frequency = <1000000>; + }; +}; + +dut_spis: &spi1 { + rx-dtc; + tx-dtc; + status = "okay"; + pinctrl-0 = <&spi1_default_alt>; + pinctrl-names = "default"; + interrupts = <92 1>, <93 1>, <94 1>, <95 1>; + interrupt-names = "rxi", "txi", "tei", "eri"; +}; diff --git a/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m3.conf b/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m3.conf new file mode 100644 index 000000000000..d241d5b09565 --- /dev/null +++ b/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m3.conf @@ -0,0 +1,6 @@ +# Copyright (c) 2025 Renesas Electronics Corporation +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_SPI_INTERRUPT=y +CONFIG_SPI_RA_DTC=y +CONFIG_TESTED_SPI_MODE=1 diff --git a/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m3.overlay b/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m3.overlay new file mode 100644 index 000000000000..03de19136a13 --- /dev/null +++ b/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m3.overlay @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2025 Renesas Electronics Corporation + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + spi0_default_alt: spi0_default_alt { + group1 { + /* MISO MOSI RSPCK */ + psels = , + , + ; + }; + }; + + spi1_default_alt: spi1_default_alt { + group1 { + /* MISO MOSI RSPCK SSL */ + psels = , + , + , + ; + }; + }; +}; + +&ioport1 { + status = "okay"; +}; + +&spi0 { + rx-dtc; + tx-dtc; + status = "okay"; + pinctrl-0 = <&spi0_default_alt>; + pinctrl-names = "default"; + cs-gpios = <&ioport1 3 GPIO_ACTIVE_LOW>; + + dut_spi_dt: test-spi-dev@0 { + compatible = "vnd,spi-device"; + reg = <0>; + spi-max-frequency = <1000000>; + }; +}; + +dut_spis: &spi1 { + rx-dtc; + tx-dtc; + status = "okay"; + pinctrl-0 = <&spi1_default_alt>; + pinctrl-names = "default"; + interrupts = <92 1>, <93 1>, <94 1>, <95 1>; + interrupt-names = "rxi", "txi", "tei", "eri"; +}; diff --git a/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m4.conf b/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m4.conf new file mode 100644 index 000000000000..d241d5b09565 --- /dev/null +++ b/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m4.conf @@ -0,0 +1,6 @@ +# Copyright (c) 2025 Renesas Electronics Corporation +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_SPI_INTERRUPT=y +CONFIG_SPI_RA_DTC=y +CONFIG_TESTED_SPI_MODE=1 diff --git a/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m4.overlay b/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m4.overlay new file mode 100644 index 000000000000..1cf25c94f2b7 --- /dev/null +++ b/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m4.overlay @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2025 Renesas Electronics Corporation + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + spi0_default_alt: spi0_default_alt { + group1 { + /* MISO MOSI RSPCK */ + psels = , + , + ; + }; + }; + + spi1_default_alt: spi1_default_alt { + group1 { + /* MISO MOSI RSPCK SSL */ + psels = , + , + , + ; + }; + }; +}; + +&ioport1 { + status = "okay"; +}; + +&spi0 { + rx-dtc; + tx-dtc; + status = "okay"; + pinctrl-0 = <&spi0_default_alt>; + pinctrl-names = "default"; + cs-gpios = <&ioport1 8 GPIO_ACTIVE_LOW>; + + dut_spi_dt: test-spi-dev@0 { + compatible = "vnd,spi-device"; + reg = <0>; + spi-max-frequency = <1000000>; + }; +}; + +dut_spis: &spi1 { + rx-dtc; + tx-dtc; + status = "okay"; + pinctrl-0 = <&spi1_default_alt>; + pinctrl-names = "default"; +}; diff --git a/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m5.conf b/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m5.conf new file mode 100644 index 000000000000..d241d5b09565 --- /dev/null +++ b/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m5.conf @@ -0,0 +1,6 @@ +# Copyright (c) 2025 Renesas Electronics Corporation +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_SPI_INTERRUPT=y +CONFIG_SPI_RA_DTC=y +CONFIG_TESTED_SPI_MODE=1 diff --git a/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m5.overlay b/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m5.overlay new file mode 100644 index 000000000000..1cf25c94f2b7 --- /dev/null +++ b/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m5.overlay @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2025 Renesas Electronics Corporation + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + spi0_default_alt: spi0_default_alt { + group1 { + /* MISO MOSI RSPCK */ + psels = , + , + ; + }; + }; + + spi1_default_alt: spi1_default_alt { + group1 { + /* MISO MOSI RSPCK SSL */ + psels = , + , + , + ; + }; + }; +}; + +&ioport1 { + status = "okay"; +}; + +&spi0 { + rx-dtc; + tx-dtc; + status = "okay"; + pinctrl-0 = <&spi0_default_alt>; + pinctrl-names = "default"; + cs-gpios = <&ioport1 8 GPIO_ACTIVE_LOW>; + + dut_spi_dt: test-spi-dev@0 { + compatible = "vnd,spi-device"; + reg = <0>; + spi-max-frequency = <1000000>; + }; +}; + +dut_spis: &spi1 { + rx-dtc; + tx-dtc; + status = "okay"; + pinctrl-0 = <&spi1_default_alt>; + pinctrl-names = "default"; +}; diff --git a/tests/drivers/spi/spi_controller_peripheral/boards/fpb_ra6e2.conf b/tests/drivers/spi/spi_controller_peripheral/boards/fpb_ra6e2.conf new file mode 100644 index 000000000000..d241d5b09565 --- /dev/null +++ b/tests/drivers/spi/spi_controller_peripheral/boards/fpb_ra6e2.conf @@ -0,0 +1,6 @@ +# Copyright (c) 2025 Renesas Electronics Corporation +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_SPI_INTERRUPT=y +CONFIG_SPI_RA_DTC=y +CONFIG_TESTED_SPI_MODE=1 diff --git a/tests/drivers/spi/spi_controller_peripheral/boards/fpb_ra6e2.overlay b/tests/drivers/spi/spi_controller_peripheral/boards/fpb_ra6e2.overlay new file mode 100644 index 000000000000..e58fa671a9ac --- /dev/null +++ b/tests/drivers/spi/spi_controller_peripheral/boards/fpb_ra6e2.overlay @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2025 Renesas Electronics Corporation + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + spi0_default_alt: spi0_default_alt { + group1 { + /* MISO MOSI RSPCK */ + psels = , + , + ; + }; + }; + + spi1_default_alt: spi1_default_alt { + group1 { + /* MISO MOSI RSPCK SSL */ + psels = , + , + , + ; + }; + }; +}; + +&ioport1 { + status = "okay"; +}; + +&spi0 { + rx-dtc; + tx-dtc; + status = "okay"; + pinctrl-0 = <&spi0_default_alt>; + pinctrl-names = "default"; + cs-gpios = <&ioport3 1 GPIO_ACTIVE_LOW>; + + dut_spi_dt: test-spi-dev@0 { + compatible = "vnd,spi-device"; + reg = <0>; + spi-max-frequency = <1000000>; + }; +}; + +dut_spis: &spi1 { + rx-dtc; + tx-dtc; + status = "okay"; + pinctrl-0 = <&spi1_default_alt>; + pinctrl-names = "default"; +}; From f71141c302d80ed541476f14498d998b0a50eb23 Mon Sep 17 00:00:00 2001 From: Declan Snyder Date: Fri, 14 Mar 2025 07:57:11 -0500 Subject: [PATCH 0289/2141] [nrf fromtree] tests: spi: Add overlay for frdm_mcxa156 dual test Add an overlay to the spi_controller_peripheral test for the frdm_mcxa156. Since this IP has multiple CS, need to introduce a way to configure the correct CS to the test; just going to use zephyr,user for now instead of refactoring to be less nordic-specific, keeping the usage optional. Signed-off-by: Declan Snyder (cherry picked from commit 6aa46f40191f9c0aa6e778bf9de751d41647dffa) --- .../boards/frdm_mcxa156.overlay | 31 +++++++++++++++++++ .../spi/spi_controller_peripheral/src/main.c | 3 +- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 tests/drivers/spi/spi_controller_peripheral/boards/frdm_mcxa156.overlay diff --git a/tests/drivers/spi/spi_controller_peripheral/boards/frdm_mcxa156.overlay b/tests/drivers/spi/spi_controller_peripheral/boards/frdm_mcxa156.overlay new file mode 100644 index 000000000000..c533c11b4fd0 --- /dev/null +++ b/tests/drivers/spi/spi_controller_peripheral/boards/frdm_mcxa156.overlay @@ -0,0 +1,31 @@ +/* + * Copyright 2025 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +/ { + zephyr,user { + peripheral-cs = <1>; + }; +}; + +&lpspi0 { + dut_spi_dt: test-spi-dev@0 { + compatible = "vnd,spi-device"; + reg = <0>; + spi-max-frequency = <10000000>; + }; + transfer-delay = <100>; + sck-pcs-delay = <10>; + pcs-sck-delay = <10>; + /* lower the master interrupt priority so slave can interrupt */ + interrupts = <28 1>; + label = "spi_master"; +}; + +dut_spis: &lpspi1 { + label = "spi_slave"; +}; diff --git a/tests/drivers/spi/spi_controller_peripheral/src/main.c b/tests/drivers/spi/spi_controller_peripheral/src/main.c index 997e6f5f91f4..04c6c27d11a7 100644 --- a/tests/drivers/spi/spi_controller_peripheral/src/main.c +++ b/tests/drivers/spi/spi_controller_peripheral/src/main.c @@ -28,7 +28,8 @@ static struct spi_dt_spec spim = SPI_DT_SPEC_GET(DT_NODELABEL(dut_spi_dt), SPIM_OP, 0); static const struct device *spis_dev = DEVICE_DT_GET(DT_NODELABEL(dut_spis)); static const struct spi_config spis_config = { - .operation = SPIS_OP + .operation = SPIS_OP, + .slave = DT_PROP_OR(DT_PATH(zephyr_user), peripheral_cs, 0), }; static struct k_poll_signal async_sig = K_POLL_SIGNAL_INITIALIZER(async_sig); From ffefffbb4bc65810f9e3e505671e275ed272b297 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Thu, 10 Jul 2025 08:48:47 +0200 Subject: [PATCH 0290/2141] [nrf fromtree] tests: drivers: spi: spi_controller_peripheral: Disable on nRF54L20pdk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove duplicated test configuration after nrf54l20pdk/nrf54l20/cpuxxx was renamed to nrf54lm20dk/nrf54lm20a/cpuxxx. Signed-off-by: Sebastian Głąb (cherry picked from commit 49734bfd0310935b427bd8128c1b0e87109a59d7) --- .../nrf54l20pdk_nrf54l20_cpuapp.overlay | 79 ------------------- .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 1 + .../spi_controller_peripheral/testcase.yaml | 11 +-- 3 files changed, 5 insertions(+), 86 deletions(-) delete mode 100644 tests/drivers/spi/spi_controller_peripheral/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay diff --git a/tests/drivers/spi/spi_controller_peripheral/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/tests/drivers/spi/spi_controller_peripheral/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay deleted file mode 100644 index fe004aa76959..000000000000 --- a/tests/drivers/spi/spi_controller_peripheral/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&pinctrl { - spi22_default_alt: spi22_default_alt { - group1 { - psels = , - , - ; - }; - }; - - spi22_sleep_alt: spi22_sleep_alt { - group1 { - psels = , - , - ; - low-power-enable; - }; - }; - - spi21_default_alt: spi21_default_alt { - group1 { - psels = , - , - , - ; - }; - }; - - spi21_sleep_alt: spi21_sleep_alt { - group1 { - psels = , - , - , - ; - low-power-enable; - }; - }; - -}; - - -&gpio1 { - status = "okay"; -}; - -&spi22 { - status = "okay"; - pinctrl-0 = <&spi22_default_alt>; - pinctrl-1 = <&spi22_sleep_alt>; - pinctrl-names = "default", "sleep"; - overrun-character = <0x00>; - cs-gpios = <&gpio1 0 GPIO_ACTIVE_LOW>; - zephyr,pm-device-runtime-auto; - dut_spi_dt: test-spi-dev@0 { - compatible = "vnd,spi-device"; - reg = <0>; - spi-max-frequency = ; - }; -}; - -dut_spis: &spi21 { - compatible = "nordic,nrf-spis"; - status = "okay"; - def-char = <0x00>; - pinctrl-0 = <&spi21_default_alt>; - pinctrl-1 = <&spi21_sleep_alt>; - pinctrl-names = "default", "sleep"; - /delete-property/rx-delay-supported; - /delete-property/rx-delay; -}; - -&uicr { - nfct-pins-as-gpios; -}; diff --git a/tests/drivers/spi/spi_controller_peripheral/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/spi/spi_controller_peripheral/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay index 541fdbb96dee..25d68cd4dfa6 100644 --- a/tests/drivers/spi/spi_controller_peripheral/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ b/tests/drivers/spi/spi_controller_peripheral/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -62,6 +62,7 @@ overrun-character = <0x00>; cs-gpios = <&gpio1 3 GPIO_ACTIVE_LOW>; zephyr,pm-device-runtime-auto; + dut_spi_dt: test-spi-dev@0 { compatible = "vnd,spi-device"; reg = <0>; diff --git a/tests/drivers/spi/spi_controller_peripheral/testcase.yaml b/tests/drivers/spi/spi_controller_peripheral/testcase.yaml index cfcf7c149f00..10365d8014dc 100644 --- a/tests/drivers/spi/spi_controller_peripheral/testcase.yaml +++ b/tests/drivers/spi/spi_controller_peripheral/testcase.yaml @@ -8,12 +8,11 @@ common: fixture: gpio_spi_loopback platform_allow: - nrf52840dk/nrf52840 - - nrf54l15dk/nrf54l15/cpuapp - - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - nrf54h20dk/nrf54h20/cpuapp - nrf54h20dk/nrf54h20/cpurad - nrf54h20dk/nrf54h20/cpuppr + - nrf54l15dk/nrf54l15/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp tests: @@ -79,10 +78,9 @@ tests: extra_args: DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_fast.overlay" platform_exclude: - nrf52840dk/nrf52840 - - nrf54l15dk/nrf54l15/cpuapp - nrf54h20dk/nrf54h20/cpurad - nrf54h20dk/nrf54h20/cpuppr - - nrf54l20pdk/nrf54l20/cpuapp + - nrf54l15dk/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp @@ -93,10 +91,9 @@ tests: extra_args: DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_fast_spis.overlay" platform_exclude: - nrf52840dk/nrf52840 - - nrf54l15dk/nrf54l15/cpuapp - nrf54h20dk/nrf54h20/cpurad - nrf54h20dk/nrf54h20/cpuppr - - nrf54l20pdk/nrf54l20/cpuapp + - nrf54l15dk/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp From 78dfbbb4bdd608fedd4ed855b0c44e8fcd10d9ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Thu, 10 Jul 2025 08:49:55 +0200 Subject: [PATCH 0291/2141] [nrf fromtree] tests: drivers: spi: spi_error_cases: Cleanup after nRF54LM20 rename MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove duplicated test configuration after nrf54l20pdk/nrf54l20/cpuxxx was renamed to nrf54lm20dk/nrf54lm20a/cpuxxx. Signed-off-by: Sebastian Głąb (cherry picked from commit 467fac1574f31804e5ef4d8bef0b7c01e557b564) --- .../nrf54l20pdk_nrf54l20_cpuapp.overlay | 78 ------------------- .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 1 + .../drivers/spi/spi_error_cases/testcase.yaml | 2 +- 3 files changed, 2 insertions(+), 79 deletions(-) delete mode 100644 tests/drivers/spi/spi_error_cases/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay diff --git a/tests/drivers/spi/spi_error_cases/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/tests/drivers/spi/spi_error_cases/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay deleted file mode 100644 index c723ff2cbd27..000000000000 --- a/tests/drivers/spi/spi_error_cases/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&pinctrl { - spi22_default_alt: spi22_default_alt { - group1 { - psels = , - , - ; - }; - }; - - spi22_sleep_alt: spi22_sleep_alt { - group1 { - psels = , - , - ; - low-power-enable; - }; - }; - - spi21_default_alt: spi21_default_alt { - group1 { - psels = , - , - , - ; - }; - }; - - spi21_sleep_alt: spi21_sleep_alt { - group1 { - psels = , - , - , - ; - low-power-enable; - }; - }; - -}; - - -&gpio1 { - status = "okay"; -}; - -&spi22 { - status = "okay"; - pinctrl-0 = <&spi22_default_alt>; - pinctrl-1 = <&spi22_sleep_alt>; - pinctrl-names = "default", "sleep"; - overrun-character = <0x00>; - cs-gpios = <&gpio1 0 GPIO_ACTIVE_LOW>; - dut_spi_dt: test-spi-dev@0 { - compatible = "vnd,spi-device"; - reg = <0>; - spi-max-frequency = <4000000>; - }; -}; - -dut_spis: &spi21 { - compatible = "nordic,nrf-spis"; - status = "okay"; - def-char = <0x00>; - pinctrl-0 = <&spi21_default_alt>; - pinctrl-1 = <&spi21_sleep_alt>; - pinctrl-names = "default", "sleep"; - /delete-property/rx-delay-supported; - /delete-property/rx-delay; -}; - -&uicr { - nfct-pins-as-gpios; -}; diff --git a/tests/drivers/spi/spi_error_cases/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/spi/spi_error_cases/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay index 541fdbb96dee..25d68cd4dfa6 100644 --- a/tests/drivers/spi/spi_error_cases/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ b/tests/drivers/spi/spi_error_cases/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -62,6 +62,7 @@ overrun-character = <0x00>; cs-gpios = <&gpio1 3 GPIO_ACTIVE_LOW>; zephyr,pm-device-runtime-auto; + dut_spi_dt: test-spi-dev@0 { compatible = "vnd,spi-device"; reg = <0>; diff --git a/tests/drivers/spi/spi_error_cases/testcase.yaml b/tests/drivers/spi/spi_error_cases/testcase.yaml index 8e5ae335edd3..9ad509baddb0 100644 --- a/tests/drivers/spi/spi_error_cases/testcase.yaml +++ b/tests/drivers/spi/spi_error_cases/testcase.yaml @@ -6,13 +6,13 @@ common: harness: ztest harness_config: fixture: gpio_spi_loopback + timeout: 30 tests: drivers.spi.spi_error_cases: platform_allow: - nrf52840dk/nrf52840 - nrf54l15dk/nrf54l15/cpuapp - nrf54h20dk/nrf54h20/cpuapp - - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: From fd0737fb29668f75a520d45d82e10693890e757c Mon Sep 17 00:00:00 2001 From: Raffael Rostagno Date: Mon, 19 May 2025 16:06:20 -0300 Subject: [PATCH 0292/2141] [nrf fromtree] tests: drivers: spi_loopback: Fix NULL rx buff testcase Fixes setup of TX buffer, which shouldn't be NULL in the RX NULL tescase. Signed-off-by: Raffael Rostagno (cherry picked from commit d8358b29a0fcb67f296f99d264d4647103b78666) --- tests/drivers/spi/spi_loopback/src/spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/drivers/spi/spi_loopback/src/spi.c b/tests/drivers/spi/spi_loopback/src/spi.c index fd2302a4ec0b..4a744bf35547 100644 --- a/tests/drivers/spi/spi_loopback/src/spi.c +++ b/tests/drivers/spi/spi_loopback/src/spi.c @@ -559,7 +559,7 @@ ZTEST(spi_loopback, test_spi_null_rx_buf_set) { struct spi_dt_spec *spec = loopback_specs[spec_idx]; const struct spi_buf_set tx = spi_loopback_setup_xfer(tx_bufs_pool, 1, - NULL, BUF_SIZE); + buffer_tx, BUF_SIZE); spi_loopback_transceive(spec, &tx, NULL); } From 3bdeaeaa7108ed383e4db88730c5df1c26a93036 Mon Sep 17 00:00:00 2001 From: Duy Nguyen Date: Wed, 18 Dec 2024 06:38:32 +0700 Subject: [PATCH 0293/2141] [nrf fromtree] tests: drivers: spi: Add configuration for SPI test on RX130 Add device tree overlay for spi test on RSKRX130 board Signed-off-by: Duy Nguyen (cherry picked from commit 9e5aa827bb58a40132edae32907b96cc2acab30b) --- .../spi_loopback/boards/rsk_rx130_512kb.overlay | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 tests/drivers/spi/spi_loopback/boards/rsk_rx130_512kb.overlay diff --git a/tests/drivers/spi/spi_loopback/boards/rsk_rx130_512kb.overlay b/tests/drivers/spi/spi_loopback/boards/rsk_rx130_512kb.overlay new file mode 100644 index 000000000000..ae5393b88116 --- /dev/null +++ b/tests/drivers/spi/spi_loopback/boards/rsk_rx130_512kb.overlay @@ -0,0 +1,17 @@ +/* + * Copyright (c) 2025 Renesas Electronics Corporation + * SPDX-License-Identifier: Apache-2.0 + */ + +&rspi0 { + slow@0 { + compatible = "test-spi-loopback-slow"; + reg = <0>; + spi-max-frequency = <1000000>; + }; + fast@0 { + compatible = "test-spi-loopback-fast"; + reg = <0>; + spi-max-frequency = <3000000>; + }; +}; From 5336faa47576ef444d8dd58c8ad00310a427bae3 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Fri, 6 Jun 2025 15:04:02 +0200 Subject: [PATCH 0294/2141] [nrf fromtree] tests: spi: loopback: get spi controller before timed transfer The test which measures and validates transfer times is using the helper spi_loopback_transceive() to perform the transfer. This helper internally gets the spi controller, which is useful for most tests, but for this one, it means the time to get and put the spi controller is included in the transfer time measurement. This commit gets the spi controller before calling spi_loopback_transceive() which results in only the actual transfer time being measured. Before this commit, on the nrf54h20: START - test_spi_complete_multiple_timed Transfer took 745 us vs theoretical minimum 108 us Latency measurement: 637 us PASS - test_spi_complete_multiple_timed in 0.008 seconds START - test_spi_complete_multiple_timed Transfer took 700 us vs theoretical minimum 54 us Latency measurement: 646 us Assertion failed at ... Very high latency FAIL - test_spi_complete_multiple_timed in 0.027 seconds After this commit: START - test_spi_complete_multiple_timed Transfer took 250 us vs theoretical minimum 108 us Latency measurement: 142 us PASS - test_spi_complete_multiple_timed in 0.008 seconds START - test_spi_complete_multiple_timed Transfer took 204 us vs theoretical minimum 54 us Latency measurement: 150 us PASS - test_spi_complete_multiple_timed in 0.008 seconds Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit 39233656b2f60ae6e6a70e9d89ebcf4e7c8b8cf5) --- tests/drivers/spi/spi_loopback/src/spi.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/drivers/spi/spi_loopback/src/spi.c b/tests/drivers/spi/spi_loopback/src/spi.c index 4a744bf35547..39a2efb94647 100644 --- a/tests/drivers/spi/spi_loopback/src/spi.c +++ b/tests/drivers/spi/spi_loopback/src/spi.c @@ -293,11 +293,19 @@ ZTEST(spi_loopback, test_spi_complete_multiple_timed) uint32_t start_time, end_time, cycles_spent; uint64_t time_spent_us, expected_transfer_time_us, latency_measurement; + /* + * spi_loopback_transceive() does an inline pm_device_runtime_get(), but since we are + * timing the transfer, we need to get the SPI controller before we start the measurement. + */ + zassert_ok(pm_device_runtime_get(spec->bus)); + /* since this is a test program, there shouldn't be much to interfere with measurement */ start_time = k_cycle_get_32(); spi_loopback_transceive(spec, &tx, &rx); end_time = k_cycle_get_32(); + zassert_ok(pm_device_runtime_put(spec->bus)); + if (end_time >= start_time) { cycles_spent = end_time - start_time; } else { From fb2fba2bdbeb9c5e128f1ac0cb597163cef0c8df Mon Sep 17 00:00:00 2001 From: Piotr Krzyzanowski Date: Tue, 27 May 2025 22:54:15 +0200 Subject: [PATCH 0295/2141] [nrf fromtree] tests: drivers: spi: spi_loopback: Add NULL spi_buf_set test Add the test_spi_null_tx_rx_buf_set Signed-off-by: Piotr Krzyzanowski (cherry picked from commit c67db3fd36113da61abb45da0409705163bf5340) --- tests/drivers/spi/spi_loopback/src/spi.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/drivers/spi/spi_loopback/src/spi.c b/tests/drivers/spi/spi_loopback/src/spi.c index 39a2efb94647..1e6b99ae9477 100644 --- a/tests/drivers/spi/spi_loopback/src/spi.c +++ b/tests/drivers/spi/spi_loopback/src/spi.c @@ -572,6 +572,13 @@ ZTEST(spi_loopback, test_spi_null_rx_buf_set) spi_loopback_transceive(spec, &tx, NULL); } +ZTEST(spi_loopback, test_spi_null_tx_rx_buf_set) +{ + struct spi_dt_spec *spec = loopback_specs[spec_idx]; + + spi_loopback_transceive(spec, NULL, NULL); +} + ZTEST(spi_loopback, test_nop_nil_bufs) { struct spi_dt_spec *spec = loopback_specs[spec_idx]; From 3591996aab8a02ed34945283da4fac64fb72fec9 Mon Sep 17 00:00:00 2001 From: Fabrice DJIATSA Date: Tue, 3 Jun 2025 09:41:14 +0200 Subject: [PATCH 0296/2141] [nrf fromtree] tests: drivers: spi: spi_loopback: enable nucleo_c071rb to run test again Due to RAM overflow by 3200 bytes, decrease size of SPI_LARGE_BUFFER. signed-off-by: Fabrice DJIATSA (cherry picked from commit c5f5fc1fa8efd24ad79ba5e474dd885ca1486816) --- tests/drivers/spi/spi_loopback/boards/nucleo_c071rb.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/drivers/spi/spi_loopback/boards/nucleo_c071rb.conf b/tests/drivers/spi/spi_loopback/boards/nucleo_c071rb.conf index 5e05f18f57a0..895eddcb0c02 100644 --- a/tests/drivers/spi/spi_loopback/boards/nucleo_c071rb.conf +++ b/tests/drivers/spi/spi_loopback/boards/nucleo_c071rb.conf @@ -1 +1 @@ -CONFIG_SPI_LARGE_BUFFER_SIZE=8000 +CONFIG_SPI_LARGE_BUFFER_SIZE=4500 From 9f79c54364bb75b24ccc7ada1de620da21bbf945 Mon Sep 17 00:00:00 2001 From: Fabrice DJIATSA Date: Fri, 30 May 2025 16:09:28 +0200 Subject: [PATCH 0297/2141] [nrf fromtree] tests: drivers: spi_loopback: add latency tolerance for some boards Set a convenient latency for each platform, since each platform reacts differently to the driver. Signed-off-by: Fabrice DJIATSA (cherry picked from commit 5daad8f7c13c3c6996c95e39cf616d836a8c4956) --- tests/drivers/spi/spi_loopback/boards/nucleo_c071rb.conf | 1 + tests/drivers/spi/spi_loopback/boards/nucleo_f746zg.conf | 1 + tests/drivers/spi/spi_loopback/boards/nucleo_wb55rg.conf | 1 + tests/drivers/spi/spi_loopback/boards/nucleo_wba55cg.conf | 1 + tests/drivers/spi/spi_loopback/boards/nucleo_wl55jc.conf | 1 + tests/drivers/spi/spi_loopback/boards/stm32f3_disco.conf | 1 + 6 files changed, 6 insertions(+) create mode 100644 tests/drivers/spi/spi_loopback/boards/nucleo_wb55rg.conf create mode 100644 tests/drivers/spi/spi_loopback/boards/nucleo_wba55cg.conf create mode 100644 tests/drivers/spi/spi_loopback/boards/nucleo_wl55jc.conf diff --git a/tests/drivers/spi/spi_loopback/boards/nucleo_c071rb.conf b/tests/drivers/spi/spi_loopback/boards/nucleo_c071rb.conf index 895eddcb0c02..093e1f09d89d 100644 --- a/tests/drivers/spi/spi_loopback/boards/nucleo_c071rb.conf +++ b/tests/drivers/spi/spi_loopback/boards/nucleo_c071rb.conf @@ -1 +1,2 @@ CONFIG_SPI_LARGE_BUFFER_SIZE=4500 +CONFIG_SPI_IDEAL_TRANSFER_DURATION_SCALING=20 diff --git a/tests/drivers/spi/spi_loopback/boards/nucleo_f746zg.conf b/tests/drivers/spi/spi_loopback/boards/nucleo_f746zg.conf index c448e14811f7..72f647378205 100644 --- a/tests/drivers/spi/spi_loopback/boards/nucleo_f746zg.conf +++ b/tests/drivers/spi/spi_loopback/boards/nucleo_f746zg.conf @@ -1 +1,2 @@ CONFIG_NOCACHE_MEMORY=y +CONFIG_SPI_IDEAL_TRANSFER_DURATION_SCALING=10 diff --git a/tests/drivers/spi/spi_loopback/boards/nucleo_wb55rg.conf b/tests/drivers/spi/spi_loopback/boards/nucleo_wb55rg.conf new file mode 100644 index 000000000000..a527ab8f28d1 --- /dev/null +++ b/tests/drivers/spi/spi_loopback/boards/nucleo_wb55rg.conf @@ -0,0 +1 @@ +CONFIG_SPI_IDEAL_TRANSFER_DURATION_SCALING=22 diff --git a/tests/drivers/spi/spi_loopback/boards/nucleo_wba55cg.conf b/tests/drivers/spi/spi_loopback/boards/nucleo_wba55cg.conf new file mode 100644 index 000000000000..1753e2d75c3c --- /dev/null +++ b/tests/drivers/spi/spi_loopback/boards/nucleo_wba55cg.conf @@ -0,0 +1 @@ +CONFIG_SPI_IDEAL_TRANSFER_DURATION_SCALING=50 diff --git a/tests/drivers/spi/spi_loopback/boards/nucleo_wl55jc.conf b/tests/drivers/spi/spi_loopback/boards/nucleo_wl55jc.conf new file mode 100644 index 000000000000..725924348b53 --- /dev/null +++ b/tests/drivers/spi/spi_loopback/boards/nucleo_wl55jc.conf @@ -0,0 +1 @@ +CONFIG_SPI_IDEAL_TRANSFER_DURATION_SCALING=15 diff --git a/tests/drivers/spi/spi_loopback/boards/stm32f3_disco.conf b/tests/drivers/spi/spi_loopback/boards/stm32f3_disco.conf index 469620fed4e2..016bb0000d97 100644 --- a/tests/drivers/spi/spi_loopback/boards/stm32f3_disco.conf +++ b/tests/drivers/spi/spi_loopback/boards/stm32f3_disco.conf @@ -1 +1,2 @@ CONFIG_SPI_LOOPBACK_MODE_LOOP=y +CONFIG_SPI_IDEAL_TRANSFER_DURATION_SCALING=15 From af7a24bd8ce22d3c3a8e382f400e0dbaa664dd1f Mon Sep 17 00:00:00 2001 From: Fabrice DJIATSA Date: Thu, 5 Jun 2025 14:14:45 +0200 Subject: [PATCH 0298/2141] [nrf fromtree] tests: drivers: spi: spi_loopback: handle rx/tx buffers nocache memory Place transfer buffers in non-cacheable memory when CONFIG_NOCACHE_MEMORY=y. This change ensures that DMA transfer buffers are allocated in non-cacheable memory on platforms where CONFIG_NOCACHE_MEMORY is enabled. This avoids potential cache coherence issues that are not handled by the SPI driver. Signed-off-by: Fabrice DJIATSA (cherry picked from commit cc4e2f526ab73e5e5e4f60e92a0985e0f265dca1) --- tests/drivers/spi/spi_loopback/src/spi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/drivers/spi/spi_loopback/src/spi.c b/tests/drivers/spi/spi_loopback/src/spi.c index 1e6b99ae9477..d3d44d79f466 100644 --- a/tests/drivers/spi/spi_loopback/src/spi.c +++ b/tests/drivers/spi/spi_loopback/src/spi.c @@ -717,8 +717,8 @@ static struct k_thread thread[3]; static K_SEM_DEFINE(thread_sem, 0, 3); static K_SEM_DEFINE(sync_sem, 0, 1); -static uint8_t __aligned(32) tx_buffer[3][32]; -static uint8_t __aligned(32) rx_buffer[3][32]; +static uint8_t __aligned(32) tx_buffer[3][32] __NOCACHE; +static uint8_t __aligned(32) rx_buffer[3][32] __NOCACHE; atomic_t thread_test_fails; From d72989085916b3200a8421ff3562b041be8cbeea Mon Sep 17 00:00:00 2001 From: Fabrice DJIATSA Date: Fri, 13 Jun 2025 11:47:58 +0200 Subject: [PATCH 0299/2141] [nrf fromtree] tests: drivers: spi: remove useless files and testcases - with the updates made to the spi_ll_stm32 driver, we no longer need to configure the 16-bit frame/word size in the DTS overlay file. The test_spi_word_size_16 testsuite helps us verify the 16-bit frame mode supported on the ST platform. - remove testcases that use thoses files in testcase.yaml Signed-off-by: Fabrice DJIATSA (cherry picked from commit 746d60b0f89eef9c5dbdcd9909757149c0681bf0) --- ...y-stm32-spi-16bits-dma-dt-nocache-mem.conf | 14 ------ .../overlay-stm32-spi-16bits-dma.conf | 11 ----- .../overlay-stm32-spi-16bits.conf | 6 --- .../overlay-stm32-spi-16bits.overlay | 43 ------------------- tests/drivers/spi/spi_loopback/testcase.yaml | 34 --------------- 5 files changed, 108 deletions(-) delete mode 100644 tests/drivers/spi/spi_loopback/overlay-stm32-spi-16bits-dma-dt-nocache-mem.conf delete mode 100644 tests/drivers/spi/spi_loopback/overlay-stm32-spi-16bits-dma.conf delete mode 100644 tests/drivers/spi/spi_loopback/overlay-stm32-spi-16bits.conf delete mode 100644 tests/drivers/spi/spi_loopback/overlay-stm32-spi-16bits.overlay diff --git a/tests/drivers/spi/spi_loopback/overlay-stm32-spi-16bits-dma-dt-nocache-mem.conf b/tests/drivers/spi/spi_loopback/overlay-stm32-spi-16bits-dma-dt-nocache-mem.conf deleted file mode 100644 index 4bb96e35f58f..000000000000 --- a/tests/drivers/spi/spi_loopback/overlay-stm32-spi-16bits-dma-dt-nocache-mem.conf +++ /dev/null @@ -1,14 +0,0 @@ -# -# Copyright (c) 2023 Graphcore Ltd, All rights reserved. -# -# SPDX-License-Identifier: Apache-2.0 -# - -# enable DMA mode for SPI loopback test -CONFIG_SPI_STM32_DMA=y -CONFIG_SPI_STM32_INTERRUPT=n -CONFIG_SPI_ASYNC=n -CONFIG_NOCACHE_MEMORY=n -CONFIG_DT_DEFINED_NOCACHE=y -CONFIG_DT_DEFINED_NOCACHE_NAME="SRAM2" -CONFIG_SPI_LOOPBACK_16BITS_FRAMES=y diff --git a/tests/drivers/spi/spi_loopback/overlay-stm32-spi-16bits-dma.conf b/tests/drivers/spi/spi_loopback/overlay-stm32-spi-16bits-dma.conf deleted file mode 100644 index c49efea868aa..000000000000 --- a/tests/drivers/spi/spi_loopback/overlay-stm32-spi-16bits-dma.conf +++ /dev/null @@ -1,11 +0,0 @@ -# -# Copyright (c) 2023 Graphcore Ltd, All rights reserved. -# -# SPDX-License-Identifier: Apache-2.0 -# - -# enable DMA mode for SPI loopback test -CONFIG_SPI_STM32_DMA=y -CONFIG_SPI_STM32_INTERRUPT=n -CONFIG_SPI_ASYNC=n -CONFIG_SPI_LOOPBACK_16BITS_FRAMES=y diff --git a/tests/drivers/spi/spi_loopback/overlay-stm32-spi-16bits.conf b/tests/drivers/spi/spi_loopback/overlay-stm32-spi-16bits.conf deleted file mode 100644 index 00ca04782b48..000000000000 --- a/tests/drivers/spi/spi_loopback/overlay-stm32-spi-16bits.conf +++ /dev/null @@ -1,6 +0,0 @@ -# -# Copyright (c) 2023 Graphcore Ltd, All rights reserved. -# -# SPDX-License-Identifier: Apache-2.0 -# -CONFIG_SPI_LOOPBACK_16BITS_FRAMES=y diff --git a/tests/drivers/spi/spi_loopback/overlay-stm32-spi-16bits.overlay b/tests/drivers/spi/spi_loopback/overlay-stm32-spi-16bits.overlay deleted file mode 100644 index b2df25ac8609..000000000000 --- a/tests/drivers/spi/spi_loopback/overlay-stm32-spi-16bits.overlay +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2023 Graphcore Ltd, All rights reserved. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/* Set div-q to get test clk freq into acceptable SPI freq range */ -&pll { - /delete-property/ div-q; - div-q = <8>; -}; - -&sram2 { - zephyr,memory-attr = < DT_MEM_ARM(ATTR_MPU_RAM_NOCACHE) >; -}; - -&spi1 { - dmas = <&dmamux1 0 38 (STM32_DMA_PERIPH_TX | STM32_DMA_PRIORITY_HIGH | STM32_DMA_MEM_16BITS | STM32_DMA_PERIPH_16BITS) - &dmamux1 1 37 (STM32_DMA_PERIPH_RX | STM32_DMA_PRIORITY_HIGH | STM32_DMA_MEM_16BITS | STM32_DMA_PERIPH_16BITS)>; - dma-names = "tx", "rx"; - slow@0 { - compatible = "test-spi-loopback-slow"; - reg = <0>; - spi-max-frequency = <500000>; - }; - fast@0 { - compatible = "test-spi-loopback-fast"; - reg = <0>; - spi-max-frequency = <16000000>; - }; -}; - -&dma1 { - status = "okay"; -}; - -&dma2 { - status = "okay"; -}; - -&dmamux1 { - status = "okay"; -}; diff --git a/tests/drivers/spi/spi_loopback/testcase.yaml b/tests/drivers/spi/spi_loopback/testcase.yaml index ab3322a8d1fa..c92c763ec571 100644 --- a/tests/drivers/spi/spi_loopback/testcase.yaml +++ b/tests/drivers/spi/spi_loopback/testcase.yaml @@ -51,17 +51,6 @@ tests: - robokit1 integration_platforms: - sam_e70_xplained/same70q21 - drivers.spi.stm32_spi_16bits_frames.loopback: - extra_args: - - EXTRA_CONF_FILE="overlay-stm32-spi-16bits.conf" - - DTC_OVERLAY_FILE="overlay-stm32-spi-16bits.overlay" - platform_allow: - - nucleo_h743zi - - nucleo_h753zi - - nucleo_h745zi_q/stm32h745xx/m4 - - nucleo_h745zi_q/stm32h745xx/m7 - integration_platforms: - - nucleo_h743zi drivers.spi.stm32_spi_dma.loopback: extra_args: EXTRA_CONF_FILE="overlay-stm32-spi-dma.conf" platform_allow: @@ -98,29 +87,6 @@ tests: - nucleo_h745zi_q/stm32h745xx/m7 integration_platforms: - nucleo_h743zi - drivers.spi.stm32_spi_16bits_frames_dma.loopback: - extra_args: - - EXTRA_CONF_FILE="overlay-stm32-spi-16bits-dma.conf" - - DTC_OVERLAY_FILE="overlay-stm32-spi-16bits.overlay" - platform_allow: - - nucleo_h743zi - - nucleo_h753zi - - nucleo_h745zi_q/stm32h745xx/m4 - - nucleo_h745zi_q/stm32h745xx/m7 - integration_platforms: - - nucleo_h743zi - drivers.spi.stm32_spi_16bits_frames_dma_dt_nocache_mem.loopback: - extra_args: - - EXTRA_CONF_FILE="overlay-stm32-spi-16bits-dma-dt-nocache-mem.conf" - - DTC_OVERLAY_FILE="overlay-stm32-spi-16bits.overlay" - filter: CONFIG_CPU_HAS_DCACHE - platform_allow: - - nucleo_h743zi - - nucleo_h753zi - - nucleo_h745zi_q/stm32h745xx/m4 - - nucleo_h745zi_q/stm32h745xx/m7 - integration_platforms: - - nucleo_h743zi drivers.spi.stm32_spi_interrupt.loopback: extra_args: EXTRA_CONF_FILE="overlay-stm32-spi-interrupt.conf" platform_allow: From 0bf0e5f93631b88423352d666464e05a5aa41b77 Mon Sep 17 00:00:00 2001 From: Sai Santhosh Malae Date: Fri, 13 Jun 2025 18:49:08 +0530 Subject: [PATCH 0300/2141] [nrf fromtree] tests: spi: siwx91x: board config file update Update CONFIG_SPI_IDEAL_TRANSFER_DURATION_SCALING value for testcase to pass for higher transfer speeds. Signed-off-by: Sai Santhosh Malae (cherry picked from commit d29fd6fcba2a2080fea42005eebc62f8ec5a730f) --- tests/drivers/spi/spi_loopback/boards/siwx917_rb4338a.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/drivers/spi/spi_loopback/boards/siwx917_rb4338a.conf b/tests/drivers/spi/spi_loopback/boards/siwx917_rb4338a.conf index 368ff560c98f..940add570e6f 100644 --- a/tests/drivers/spi/spi_loopback/boards/siwx917_rb4338a.conf +++ b/tests/drivers/spi/spi_loopback/boards/siwx917_rb4338a.conf @@ -1 +1,2 @@ CONFIG_SPI_SILABS_SIWX91X_GSPI_DMA=y +CONFIG_SPI_IDEAL_TRANSFER_DURATION_SCALING=24 From 7d1b3d22d979ddfee148236d6664ac7e1d2f3202 Mon Sep 17 00:00:00 2001 From: Thao Luong Date: Fri, 23 May 2025 19:25:07 +0700 Subject: [PATCH 0301/2141] [nrf fromtree] tests: drivers: spi: Add support ek_ra2l1 for spi_loopback test Add support for ek_ra2l1 on spi_loopback. Signed-off-by: Thao Luong (cherry picked from commit e2267bd59e4055ccc7b60021a30e47b3c047e312) --- .../spi/spi_loopback/boards/ek_ra2l1.conf | 3 ++ .../spi/spi_loopback/boards/ek_ra2l1.overlay | 45 +++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 tests/drivers/spi/spi_loopback/boards/ek_ra2l1.conf create mode 100644 tests/drivers/spi/spi_loopback/boards/ek_ra2l1.overlay diff --git a/tests/drivers/spi/spi_loopback/boards/ek_ra2l1.conf b/tests/drivers/spi/spi_loopback/boards/ek_ra2l1.conf new file mode 100644 index 000000000000..65750ba31314 --- /dev/null +++ b/tests/drivers/spi/spi_loopback/boards/ek_ra2l1.conf @@ -0,0 +1,3 @@ +CONFIG_SPI_LOOPBACK_MODE_LOOP=y +CONFIG_SPI_INTERRUPT=y +CONFIG_SPI_RA_DTC=y diff --git a/tests/drivers/spi/spi_loopback/boards/ek_ra2l1.overlay b/tests/drivers/spi/spi_loopback/boards/ek_ra2l1.overlay new file mode 100644 index 000000000000..b87c78182093 --- /dev/null +++ b/tests/drivers/spi/spi_loopback/boards/ek_ra2l1.overlay @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2025 Renesas Electronics Corporation + * SPDX-License-Identifier: Apache-2.0 + */ + +&spi0 { + rx-dtc; + tx-dtc; + + slow@0 { + compatible = "test-spi-loopback-slow"; + reg = <0>; + spi-max-frequency = <2000000>; + }; + + fast@0 { + compatible = "test-spi-loopback-fast"; + reg = <0>; + spi-max-frequency = <3000000>; + }; +}; + +&pinctrl { + spi0_default: spi0_default { + group1 { + /* MISO MOSI RSPCK */ + psels = , + , + ; + }; + }; +}; + +&spi0 { + pinctrl-0 = <&spi0_default>; + pinctrl-names = "default"; + cs-gpios = <&ioport1 3 GPIO_ACTIVE_LOW>; + interrupts = <8 1>, <9 1>, <10 1>, <19 1>; + interrupt-names = "rxi", "txi", "tei", "eri"; + status = "okay"; +}; + +&ioport1 { + status = "okay"; +}; From ee516c959a47e42c62ff8504b475b0f400fc6faf Mon Sep 17 00:00:00 2001 From: Khoa Nguyen Date: Wed, 2 Apr 2025 15:49:20 +0700 Subject: [PATCH 0302/2141] [nrf fromtree] tests: drivers: spi: Add support spi_loopback for ek_ra8p1 Add support test app spi_loopback for Renesas ek_ra8p1 Signed-off-by: Khoa Nguyen (cherry picked from commit c6f237ed0be16d27659e25ce96ff5bbcb12d5122) --- .../boards/ek_ra8p1_r7ka8p1kflcac_cm85.conf | 6 +++++ .../ek_ra8p1_r7ka8p1kflcac_cm85.overlay | 23 +++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 tests/drivers/spi/spi_loopback/boards/ek_ra8p1_r7ka8p1kflcac_cm85.conf create mode 100644 tests/drivers/spi/spi_loopback/boards/ek_ra8p1_r7ka8p1kflcac_cm85.overlay diff --git a/tests/drivers/spi/spi_loopback/boards/ek_ra8p1_r7ka8p1kflcac_cm85.conf b/tests/drivers/spi/spi_loopback/boards/ek_ra8p1_r7ka8p1kflcac_cm85.conf new file mode 100644 index 000000000000..9c7b8ccf32d3 --- /dev/null +++ b/tests/drivers/spi/spi_loopback/boards/ek_ra8p1_r7ka8p1kflcac_cm85.conf @@ -0,0 +1,6 @@ +# Copyright (c) 2025 Renesas Electronics Corporation +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_SPI_LOOPBACK_MODE_LOOP=y +CONFIG_SPI_B_INTERRUPT=y +CONFIG_SPI_B_RA_DTC=y diff --git a/tests/drivers/spi/spi_loopback/boards/ek_ra8p1_r7ka8p1kflcac_cm85.overlay b/tests/drivers/spi/spi_loopback/boards/ek_ra8p1_r7ka8p1kflcac_cm85.overlay new file mode 100644 index 000000000000..69a4204a1ab9 --- /dev/null +++ b/tests/drivers/spi/spi_loopback/boards/ek_ra8p1_r7ka8p1kflcac_cm85.overlay @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2025 Renesas Electronics Corporation + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +&spi1 { + rx-dtc; + tx-dtc; + + slow@0 { + compatible = "test-spi-loopback-slow"; + reg = <0>; + spi-max-frequency = <2000000>; + }; + + fast@0 { + compatible = "test-spi-loopback-fast"; + reg = <0>; + spi-max-frequency = <3000000>; + }; +}; From b5096ac80acf422a7312627b56ee0319f511fa83 Mon Sep 17 00:00:00 2001 From: Abderrahmane JARMOUNI Date: Fri, 2 May 2025 16:58:03 +0200 Subject: [PATCH 0303/2141] [nrf fromtree] tests: drivers: spi_loopback: fix buffers alignment size Size given to __aligned() is in bytes. Align following DCACHE line size, or default to 32-byte alignment Signed-off-by: Abderrahmane JARMOUNI (cherry picked from commit da62b1c19d5ab1f2ac38ef577a1a6d338940b1c1) --- tests/drivers/spi/spi_loopback/src/spi.c | 39 +++++++++++++++--------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/tests/drivers/spi/spi_loopback/src/spi.c b/tests/drivers/spi/spi_loopback/src/spi.c index d3d44d79f466..9d6c8718472c 100644 --- a/tests/drivers/spi/spi_loopback/src/spi.c +++ b/tests/drivers/spi/spi_loopback/src/spi.c @@ -66,40 +66,49 @@ const struct gpio_dt_spec mosi_pin = GPIO_DT_SPEC_GET_OR(DT_PATH(zephyr_user), m ******************** */ -#if CONFIG_NOCACHE_MEMORY +#ifdef CONFIG_NOCACHE_MEMORY #define __NOCACHE __attribute__((__section__(".nocache"))) #elif defined(CONFIG_DT_DEFINED_NOCACHE) #define __NOCACHE __attribute__((__section__(CONFIG_DT_DEFINED_NOCACHE_NAME))) #else /* CONFIG_NOCACHE_MEMORY */ #define __NOCACHE +#if CONFIG_DCACHE_LINE_SIZE != 0 +#define __BUF_ALIGN __aligned(CONFIG_DCACHE_LINE_SIZE) +#else +#define __BUF_ALIGN __aligned(DT_PROP_OR(DT_PATH(cpus, cpu_0), d_cache_line_size, 32)) +#endif #endif /* CONFIG_NOCACHE_MEMORY */ +#ifndef __BUF_ALIGN +#define __BUF_ALIGN __aligned(32) +#endif + #define BUF_SIZE 18 static const char tx_data[BUF_SIZE] = "0123456789abcdef-\0"; -static __aligned(32) char buffer_tx[BUF_SIZE] __NOCACHE; -static __aligned(32) char buffer_rx[BUF_SIZE] __NOCACHE; +static __BUF_ALIGN char buffer_tx[BUF_SIZE] __NOCACHE; +static __BUF_ALIGN char buffer_rx[BUF_SIZE] __NOCACHE; #define BUF2_SIZE 36 static const char tx2_data[BUF2_SIZE] = "Thequickbrownfoxjumpsoverthelazydog\0"; -static __aligned(32) char buffer2_tx[BUF2_SIZE] __NOCACHE; -static __aligned(32) char buffer2_rx[BUF2_SIZE] __NOCACHE; +static __BUF_ALIGN char buffer2_tx[BUF2_SIZE] __NOCACHE; +static __BUF_ALIGN char buffer2_rx[BUF2_SIZE] __NOCACHE; #define BUF3_SIZE CONFIG_SPI_LARGE_BUFFER_SIZE static const char large_tx_data[BUF3_SIZE] = "Thequickbrownfoxjumpsoverthelazydog\0"; -static __aligned(32) char large_buffer_tx[BUF3_SIZE] __NOCACHE; -static __aligned(32) char large_buffer_rx[BUF3_SIZE] __NOCACHE; +static __BUF_ALIGN char large_buffer_tx[BUF3_SIZE] __NOCACHE; +static __BUF_ALIGN char large_buffer_rx[BUF3_SIZE] __NOCACHE; #define BUFWIDE_SIZE 12 static const uint16_t tx_data_16[] = {0x1234, 0x5678, 0x9ABC, 0xDEF0, 0xFF00, 0x00FF, 0xAAAA, 0x5555, 0xF0F0, 0x0F0F, 0xA5A5, 0x5A5A}; -static __aligned(32) uint16_t buffer_tx_16[BUFWIDE_SIZE] __NOCACHE; -static __aligned(32) uint16_t buffer_rx_16[BUFWIDE_SIZE] __NOCACHE; +static __BUF_ALIGN uint16_t buffer_tx_16[BUFWIDE_SIZE] __NOCACHE; +static __BUF_ALIGN uint16_t buffer_rx_16[BUFWIDE_SIZE] __NOCACHE; static const uint32_t tx_data_32[] = {0x12345678, 0x56781234, 0x9ABCDEF0, 0xDEF09ABC, 0xFFFF0000, 0x0000FFFF, 0x00FF00FF, 0xFF00FF00, 0xAAAA5555, 0x5555AAAA, 0xAA55AA55, 0x55AA55AA}; -static __aligned(32) uint32_t buffer_tx_32[BUFWIDE_SIZE] __NOCACHE; -static __aligned(32) uint32_t buffer_rx_32[BUFWIDE_SIZE] __NOCACHE; +static __BUF_ALIGN uint32_t buffer_tx_32[BUFWIDE_SIZE] __NOCACHE; +static __BUF_ALIGN uint32_t buffer_rx_32[BUFWIDE_SIZE] __NOCACHE; /* ******************** @@ -667,7 +676,7 @@ ZTEST(spi_loopback, test_spi_word_size_9) { struct spi_dt_spec *spec = loopback_specs[spec_idx]; - static __aligned(32) uint16_t tx_data_9[BUFWIDE_SIZE]; + static __BUF_ALIGN uint16_t tx_data_9[BUFWIDE_SIZE]; for (int i = 0; i < BUFWIDE_SIZE; i++) { tx_data_9[i] = tx_data_16[i] & 0x1FF; @@ -691,7 +700,7 @@ ZTEST(spi_loopback, test_spi_word_size_24) { struct spi_dt_spec *spec = loopback_specs[spec_idx]; - static __aligned(32) uint32_t tx_data_24[BUFWIDE_SIZE]; + static __BUF_ALIGN uint32_t tx_data_24[BUFWIDE_SIZE]; for (int i = 0; i < BUFWIDE_SIZE; i++) { tx_data_24[i] = tx_data_32[i] & 0xFFFFFF; @@ -717,8 +726,8 @@ static struct k_thread thread[3]; static K_SEM_DEFINE(thread_sem, 0, 3); static K_SEM_DEFINE(sync_sem, 0, 1); -static uint8_t __aligned(32) tx_buffer[3][32] __NOCACHE; -static uint8_t __aligned(32) rx_buffer[3][32] __NOCACHE; +static uint8_t __BUF_ALIGN tx_buffer[3][32] __NOCACHE; +static uint8_t __BUF_ALIGN rx_buffer[3][32] __NOCACHE; atomic_t thread_test_fails; From b2c404f595d756b94d5f94f6d46ceebbf3de434a Mon Sep 17 00:00:00 2001 From: Raymond Lei Date: Fri, 7 Mar 2025 14:26:40 -0600 Subject: [PATCH 0304/2141] [nrf fromtree] drivers: spi: nxp: fix PCS broken issue and PCS_HOLD_ON support Different LPSPI IPs are used for RT11xx and MCXN. On a older version of LPSPI, a transmit command or a TX data need to be issued to end a frame. On a new version, no such requirement. Based on above information, we have to make DMA transfers "cascade" in the DMA ISR to keep CS asserted during the whole SPI transfer. PCS_HOLD_ON is a feature to keep CS asserted during multi SPI transfers. It is implemented and supported on new LPSPI IP but it is impossible to be supported on an older version like RT11xx. Signed-off-by: Raymond Lei (cherry picked from commit 0d2935218c5ee623f2fd0ea4fc1f5a3b9c14d72c) --- drivers/spi/spi_nxp_lpspi/spi_nxp_lpspi_dma.c | 264 ++++++++++++------ .../mimxrt1060_evk_mimxrt1062_qspi_C.overlay | 1 + .../mimxrt1170_evk_mimxrt1176_cm7_A.overlay | 3 +- 3 files changed, 185 insertions(+), 83 deletions(-) diff --git a/drivers/spi/spi_nxp_lpspi/spi_nxp_lpspi_dma.c b/drivers/spi/spi_nxp_lpspi/spi_nxp_lpspi_dma.c index 5b14a66fc19c..0213a808afa7 100644 --- a/drivers/spi/spi_nxp_lpspi/spi_nxp_lpspi_dma.c +++ b/drivers/spi/spi_nxp_lpspi/spi_nxp_lpspi_dma.c @@ -1,5 +1,5 @@ /* - * Copyright 2018, 2024 NXP + * Copyright 2018, 2024-2025 NXP * * SPDX-License-Identifier: Apache-2.0 */ @@ -12,6 +12,19 @@ LOG_MODULE_DECLARE(spi_lpspi, CONFIG_SPI_LOG_LEVEL); #include #include "spi_nxp_lpspi_priv.h" +/* These states indicate what's the status of RX and TX, also synchronization + * status of DMA size of the next DMA transfer. + */ +typedef enum { + LPSPI_TRANSFER_STATE_NULL, + LPSPI_TRANSFER_STATE_ONGOING, + LPSPI_TRANSFER_STATE_NEXT_DMA_SIZE_UPDATED, + LPSPI_TRANSFER_STATE_TX_DONE, + LPSPI_TRANSFER_STATE_RX_DONE, + LPSPI_TRANSFER_STATE_RX_TX_DONE, + LPSPI_TRANSFER_STATE_INVALID = 0xFFFFFFFFUL, +} lpspi_transfer_state_t; + /* dummy memory used for transferring NOP when tx buf is null */ static uint32_t tx_nop_val; /* check compliance says no init to 0, but should be 0 in bss */ /* dummy memory for transferring to when RX buf is null */ @@ -22,17 +35,58 @@ struct spi_dma_stream { uint32_t channel; struct dma_config dma_cfg; struct dma_block_config dma_blk_cfg; - bool chunk_done; }; struct spi_nxp_dma_data { struct spi_dma_stream dma_rx; struct spi_dma_stream dma_tx; + + lpspi_transfer_state_t state; + /* This DMA size is used in callback function for RX and TX context update. + * because of old LPSPI IP limitation, RX complete depend on next TX DMA transfer start, + * so TX and RX not always start at the same time while we can only calculate DMA transfer + * size once and update the buffer pointers at the same time. + */ + size_t synchronize_dma_size; }; +/* + * Issue a TCR (Transmit Command Register) command to properly end RX DMA transfers + * on certain LPSPI versions. The behavior depends on: + * + * 1. LPSPI Hardware Version: + * - Version 1 (RT1170, RT10xx, Kinetis K series): TCR issue always required + * - Version 2 (RT1180, MCXN, RT700, K32W, S32K3xx, MCXL10): TCR issue not needed + * + * 2. SPI_HOLD_ON_CS Configuration: + * - If enabled: Keeps chip select (PCS) asserted between transfers + * - If disabled: Deasserts PCS after each transfer + * + * This function checks the LPSPI version and SPI_HOLD_ON_CS setting to determine + * if a TCR command is needed. For version 1, TCR is always issued. For version 2, + * TCR is only issued if SPI_HOLD_ON_CS is not set. Therefore, SPI_HOLD_ON_CS is not + * supported for version 1. + * + * The LPSPI version can be read from the VERID register, which is typically the + * first register in the memory map. + */ +static void spi_mcux_issue_TCR(const struct device *dev) +{ + LPSPI_Type *base = (LPSPI_Type *)DEVICE_MMIO_NAMED_GET(dev, reg_base); + const struct spi_config *spi_cfg = DEV_DATA(dev)->ctx.config; + uint8_t major_ver = (base->VERID & LPSPI_VERID_MAJOR_MASK) >> LPSPI_VERID_MAJOR_SHIFT; + + /* On old LPSPI versions, we always have to issue TCR, or transaction will never end. + * On a newer LPSPI version, only issue TCR when hold on CS feature is disabled. + */ + if (major_ver < 2 || !(spi_cfg->operation & SPI_HOLD_ON_CS)) { + base->TCR &= ~LPSPI_TCR_CONTC_MASK; + } +} + static struct dma_block_config *lpspi_dma_common_load(struct spi_dma_stream *stream, - const struct device *dev, - const uint8_t *buf, size_t len) + const struct device *dev, const uint8_t *buf, + size_t len) { struct dma_block_config *blk_cfg = &stream->dma_blk_cfg; @@ -91,30 +145,35 @@ static int lpspi_dma_rx_load(const struct device *dev, uint8_t *buf, size_t len) return dma_config(stream->dma_dev, stream->channel, &stream->dma_cfg); } -static inline int lpspi_dma_rxtx_load(const struct device *dev) +/* Return values: + * positive value if a data chunk is loaded successfully and return the data chunk size loaded; + * negative value if error happens and return the error code; + * 0 if no data is loaded; + */ +static int lpspi_dma_rxtx_load(const struct device *dev) { struct lpspi_data *data = dev->data; struct spi_nxp_dma_data *dma_data = (struct spi_nxp_dma_data *)data->driver_data; struct spi_dma_stream *rx = &dma_data->dma_rx; struct spi_dma_stream *tx = &dma_data->dma_tx; struct spi_context *ctx = &data->ctx; - size_t next_chunk_size = spi_context_max_continuous_chunk(ctx); + size_t dma_size = spi_context_max_continuous_chunk(ctx); int ret = 0; - if (next_chunk_size == 0) { + if (dma_size == 0) { /* In case both buffers are 0 length, we should not even be here * and attempting to set up a DMA transfer like this will cause * errors that lock up the system in some cases with eDMA. */ - return -ENODATA; + return 0; } - ret = lpspi_dma_tx_load(dev, ctx->tx_buf, next_chunk_size); + ret = lpspi_dma_tx_load(dev, ctx->tx_buf, dma_size); if (ret != 0) { return ret; } - ret = lpspi_dma_rx_load(dev, ctx->rx_buf, next_chunk_size); + ret = lpspi_dma_rx_load(dev, ctx->rx_buf, dma_size); if (ret != 0) { return ret; } @@ -124,24 +183,17 @@ static inline int lpspi_dma_rxtx_load(const struct device *dev) return ret; } - return dma_start(tx->dma_dev, tx->channel); -} - -static int lpspi_dma_next_fill(const struct device *dev) -{ - struct lpspi_data *data = (struct lpspi_data *)dev->data; - struct spi_nxp_dma_data *dma_data = (struct spi_nxp_dma_data *)data->driver_data; - struct spi_dma_stream *rx = &dma_data->dma_rx; - struct spi_dma_stream *tx = &dma_data->dma_tx; - - rx->chunk_done = false; - tx->chunk_done = false; + ret = dma_start(tx->dma_dev, tx->channel); + if (ret != 0) { + return ret; + } - return lpspi_dma_rxtx_load(dev); + return dma_size; } static void spi_mcux_dma_callback(const struct device *dev, void *arg, uint32_t channel, int status) { + /* arg directly holds the spi device */ const struct device *spi_dev = arg; LPSPI_Type *base = (LPSPI_Type *)DEVICE_MMIO_NAMED_GET(spi_dev, reg_base); struct lpspi_data *data = (struct lpspi_data *)spi_dev->data; @@ -149,63 +201,98 @@ static void spi_mcux_dma_callback(const struct device *dev, void *arg, uint32_t struct spi_dma_stream *rx = &dma_data->dma_rx; struct spi_dma_stream *tx = &dma_data->dma_tx; struct spi_context *ctx = &data->ctx; - char debug_char; + char debug_char = (channel == dma_data->dma_tx.channel) ? 'T' : 'R'; + int ret = 0; if (status < 0) { + ret = status; goto error; - } else { - /* don't care about positive values, normalize to "okay" = 0 */ - status = 0; } - if (channel == rx->channel) { - spi_context_update_rx(ctx, 1, rx->dma_blk_cfg.block_size); - debug_char = 'R'; - rx->chunk_done = true; - } else if (channel == tx->channel) { - spi_context_update_tx(ctx, 1, tx->dma_blk_cfg.block_size); - debug_char = 'T'; - tx->chunk_done = true; - } else { - /* invalid channel */ - status = -EIO; + if (channel != dma_data->dma_tx.channel && channel != dma_data->dma_rx.channel) { + ret = -EIO; goto error; } - LOG_DBG("DMA %cX Block Complete", debug_char); - - /* wait for the other channel to finish if needed */ - if (!rx->chunk_done || !tx->chunk_done) { - return; - } - - - while ((IS_ENABLED(CONFIG_SOC_FAMILY_NXP_IMXRT) || - IS_ENABLED(CONFIG_SOC_FAMILY_KINETIS)) && - (base->SR & LPSPI_SR_MBF_MASK)) { - /* wait until module is idle */ - } - - if (spi_context_max_continuous_chunk(ctx) == 0) { - goto done; - } - - status = lpspi_dma_next_fill(spi_dev); - if (status) { + switch (dma_data->state) { + case LPSPI_TRANSFER_STATE_ONGOING: + spi_context_update_tx(ctx, 1, tx->dma_blk_cfg.block_size); + spi_context_update_rx(ctx, 1, rx->dma_blk_cfg.block_size); + /* Calculate next DMA transfer size */ + dma_data->synchronize_dma_size = spi_context_max_continuous_chunk(ctx); + LOG_DBG("tx len:%d rx len:%d next dma size:%d", ctx->tx_len, ctx->rx_len, + dma_data->synchronize_dma_size); + if (dma_data->synchronize_dma_size > 0) { + ret = (channel == dma_data->dma_tx.channel) + ? lpspi_dma_tx_load(spi_dev, ctx->tx_buf, + dma_data->synchronize_dma_size) + : lpspi_dma_rx_load(spi_dev, ctx->rx_buf, + dma_data->synchronize_dma_size); + + if (ret != 0) { + goto error; + } + + ret = dma_start(dev, channel); + if (ret != 0) { + goto error; + } + dma_data->state = LPSPI_TRANSFER_STATE_NEXT_DMA_SIZE_UPDATED; + } else { + ret = dma_stop(dev, channel); + if (ret != 0) { + goto error; + } + /* This is the end of the transfer. */ + if (channel == dma_data->dma_tx.channel) { + spi_mcux_issue_TCR(spi_dev); + dma_data->state = LPSPI_TRANSFER_STATE_TX_DONE; + base->DER &= ~LPSPI_DER_TDDE_MASK; + } else { + dma_data->state = LPSPI_TRANSFER_STATE_RX_DONE; + base->DER &= ~LPSPI_DER_RDDE_MASK; + } + } + break; + case LPSPI_TRANSFER_STATE_NEXT_DMA_SIZE_UPDATED: + ret = (channel == dma_data->dma_tx.channel) + ? lpspi_dma_tx_load(spi_dev, ctx->tx_buf, + dma_data->synchronize_dma_size) + : lpspi_dma_rx_load(spi_dev, ctx->rx_buf, + dma_data->synchronize_dma_size); + dma_data->synchronize_dma_size = 0; + + if (ret != 0) { + goto error; + } + + ret = dma_start(dev, channel); + if (ret != 0) { + goto error; + } + dma_data->state = LPSPI_TRANSFER_STATE_ONGOING; + break; + + case LPSPI_TRANSFER_STATE_TX_DONE: + case LPSPI_TRANSFER_STATE_RX_DONE: + dma_data->state = LPSPI_TRANSFER_STATE_RX_TX_DONE; + /* TX and RX both done here. */ + spi_context_complete(ctx, spi_dev, 0); + spi_context_cs_control(ctx, false); + break; + + default: + LOG_ERR("unknown spi stransfer state:%d", dma_data->state); + ret = -EIO; goto error; } + LOG_DBG("DMA %cX Block Complete", debug_char); return; error: - LOG_ERR("DMA callback error with channel %d err %d.", channel, status); -done: - base->DER &= ~(LPSPI_DER_TDDE_MASK | LPSPI_DER_RDDE_MASK); - base->TCR &= ~LPSPI_TCR_CONT_MASK; - lpspi_wait_tx_fifo_empty(spi_dev); + LOG_ERR("DMA callback error with channel %d.", channel); + spi_context_complete(ctx, spi_dev, ret); spi_context_cs_control(ctx, false); - base->CR |= LPSPI_CR_RTF_MASK | LPSPI_CR_RRF_MASK; - spi_context_complete(ctx, spi_dev, status); - spi_context_release(ctx, status); } static int transceive_dma(const struct device *dev, const struct spi_config *spi_cfg, @@ -214,7 +301,9 @@ static int transceive_dma(const struct device *dev, const struct spi_config *spi { LPSPI_Type *base = (LPSPI_Type *)DEVICE_MMIO_NAMED_GET(dev, reg_base); struct lpspi_data *data = dev->data; + struct spi_nxp_dma_data *dma_data = (struct spi_nxp_dma_data *)data->driver_data; struct spi_context *ctx = &data->ctx; + uint8_t major_ver = (base->VERID & LPSPI_VERID_MAJOR_MASK) >> LPSPI_VERID_MAJOR_SHIFT; int ret; spi_context_lock(ctx, asynchronous, cb, userdata, spi_cfg); @@ -224,30 +313,41 @@ static int transceive_dma(const struct device *dev, const struct spi_config *spi goto out; } - spi_context_buffers_setup(ctx, tx_bufs, rx_bufs, 1); - - ret = lpspi_dma_next_fill(dev); - if (ret == -ENODATA) { - /* No transfer to do? So just exit */ - ret = 0; - goto out; - } else if (ret) { - goto out; + /* Check CS hold on feature for DMA mode, it is not supported on some platform. */ + if ((spi_cfg->operation & SPI_HOLD_ON_CS) && major_ver < 2) { + LOG_ERR("SPI CS hold on feature is not supported on this platform."); + return -ENOTSUP; } - if (!(IS_ENABLED(CONFIG_SOC_FAMILY_NXP_IMXRT) || IS_ENABLED(CONFIG_SOC_FAMILY_KINETIS))) { - base->TCR |= LPSPI_TCR_CONT_MASK; - } + /* Always use continuous mode to satisfy SPI API requirements. */ + base->TCR |= LPSPI_TCR_CONT_MASK | LPSPI_TCR_CONTC_MASK; - spi_context_cs_control(ctx, true); + /* Please set both watermarks as 0 because there are some synchronize requirements + * between RX and TX on RT platform. TX and RX DMA callback must be called in interleaved + * mode, a none-zero TX watermark may break this. + */ + base->FCR = LPSPI_FCR_TXWATER(0) | LPSPI_FCR_RXWATER(0); + spi_context_buffers_setup(&data->ctx, tx_bufs, rx_bufs, 1); - base->CR |= LPSPI_CR_RTF_MASK | LPSPI_CR_RRF_MASK; + /* Set next dma size is invalid. */ + dma_data->synchronize_dma_size = 0; + dma_data->state = LPSPI_TRANSFER_STATE_NULL; + /* Load dma block */ + ret = lpspi_dma_rxtx_load(dev); + if (ret <= 0) { + goto out; + } + + dma_data->state = LPSPI_TRANSFER_STATE_ONGOING; + /* Set CS line just before DMA transfer. */ + spi_context_cs_control(ctx, true); + /* Enable DMA Requests */ base->DER |= LPSPI_DER_TDDE_MASK | LPSPI_DER_RDDE_MASK; ret = spi_context_wait_for_completion(ctx); - if (ret >= 0) { - return ret; + if (ret) { + spi_context_cs_control(ctx, false); } out: spi_context_release(ctx, ret); diff --git a/tests/drivers/spi/spi_loopback/boards/mimxrt1060_evk_mimxrt1062_qspi_C.overlay b/tests/drivers/spi/spi_loopback/boards/mimxrt1060_evk_mimxrt1062_qspi_C.overlay index 979062e18d9e..328dd4198e0c 100644 --- a/tests/drivers/spi/spi_loopback/boards/mimxrt1060_evk_mimxrt1062_qspi_C.overlay +++ b/tests/drivers/spi/spi_loopback/boards/mimxrt1060_evk_mimxrt1062_qspi_C.overlay @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +/* Short J17-pin4 and J17-pin5, populate R356, R350,R346, R362 to enable Pins for SPI1. */ &lpspi1 { slow@0 { compatible = "test-spi-loopback-slow"; diff --git a/tests/drivers/spi/spi_loopback/boards/mimxrt1170_evk_mimxrt1176_cm7_A.overlay b/tests/drivers/spi/spi_loopback/boards/mimxrt1170_evk_mimxrt1176_cm7_A.overlay index bbddef98ad63..57f6c86b644d 100644 --- a/tests/drivers/spi/spi_loopback/boards/mimxrt1170_evk_mimxrt1176_cm7_A.overlay +++ b/tests/drivers/spi/spi_loopback/boards/mimxrt1170_evk_mimxrt1176_cm7_A.overlay @@ -1,9 +1,10 @@ /* - * Copyright 2023 NXP + * Copyright 2023, 2025 NXP * * SPDX-License-Identifier: Apache-2.0 */ +/* Short J10-pin8 and J10-pin10. */ &lpspi1 { dmas = <&edma0 0 36>, <&edma0 1 37>; dma-names = "rx", "tx"; From 3a1c2e37328d2be463d89734500f3cecff60881a Mon Sep 17 00:00:00 2001 From: Julien Panis Date: Tue, 17 Jun 2025 09:43:27 +0200 Subject: [PATCH 0305/2141] [nrf fromtree] tests: drivers: spi: spi_loopback: Add testcase for cc23x0 Enable DMA for the test. Signed-off-by: Julien Panis (cherry picked from commit a631df5cd8c85af29537966c556f3e8f04de4516) --- .../spi_loopback/boards/lp_em_cc2340r5.conf | 1 + .../spi_loopback/boards/lp_em_cc2340r5.overlay | 18 ++++++++++++++++++ tests/drivers/spi/spi_loopback/testcase.yaml | 7 +++++++ 3 files changed, 26 insertions(+) create mode 100644 tests/drivers/spi/spi_loopback/boards/lp_em_cc2340r5.conf create mode 100644 tests/drivers/spi/spi_loopback/boards/lp_em_cc2340r5.overlay diff --git a/tests/drivers/spi/spi_loopback/boards/lp_em_cc2340r5.conf b/tests/drivers/spi/spi_loopback/boards/lp_em_cc2340r5.conf new file mode 100644 index 000000000000..469620fed4e2 --- /dev/null +++ b/tests/drivers/spi/spi_loopback/boards/lp_em_cc2340r5.conf @@ -0,0 +1 @@ +CONFIG_SPI_LOOPBACK_MODE_LOOP=y diff --git a/tests/drivers/spi/spi_loopback/boards/lp_em_cc2340r5.overlay b/tests/drivers/spi/spi_loopback/boards/lp_em_cc2340r5.overlay new file mode 100644 index 000000000000..98594dcc472d --- /dev/null +++ b/tests/drivers/spi/spi_loopback/boards/lp_em_cc2340r5.overlay @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2024 BayLibre, SAS + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&spi0 { + slow@0 { + compatible = "test-spi-loopback-slow"; + reg = <0>; + spi-max-frequency = <2000000>; + }; + fast@0 { + compatible = "test-spi-loopback-fast"; + reg = <0>; + spi-max-frequency = <3000000>; + }; +}; diff --git a/tests/drivers/spi/spi_loopback/testcase.yaml b/tests/drivers/spi/spi_loopback/testcase.yaml index c92c763ec571..e64aa8cdbf3e 100644 --- a/tests/drivers/spi/spi_loopback/testcase.yaml +++ b/tests/drivers/spi/spi_loopback/testcase.yaml @@ -314,3 +314,10 @@ tests: filter: CONFIG_SOC_FAMILY_SILABS_SIWX91X platform_allow: - siwx917_rb4338a + drivers.spi.cc23x0.loopback.dma.no_async: + filter: CONFIG_SOC_FAMILY_TI_SIMPLELINK + platform_allow: + - lp_em_cc2340r5 + extra_configs: + - CONFIG_SPI_CC23X0_DMA_DRIVEN=y + - CONFIG_SPI_ASYNC=n From 435493aecb400ded359d5026f3398357824d9227 Mon Sep 17 00:00:00 2001 From: Mert Ekren Date: Tue, 4 Jun 2024 13:31:32 +0300 Subject: [PATCH 0306/2141] [nrf fromtree] tests: drivers: spi: Add MAX32657 overlay files Enable 'spi_loopback' test for MAX32657 boards. Signed-off-by: Mert Ekren (cherry picked from commit e7dd1e507a25c80fe905d5563c0cbf09bf59532e) --- .../boards/max32657evkit_max32657.conf | 6 +++++ .../boards/max32657evkit_max32657.overlay | 25 +++++++++++++++++++ .../boards/max32657evkit_max32657_ns.conf | 6 +++++ .../boards/max32657evkit_max32657_ns.overlay | 18 +++++++++++++ 4 files changed, 55 insertions(+) create mode 100644 tests/drivers/spi/spi_loopback/boards/max32657evkit_max32657.conf create mode 100644 tests/drivers/spi/spi_loopback/boards/max32657evkit_max32657.overlay create mode 100644 tests/drivers/spi/spi_loopback/boards/max32657evkit_max32657_ns.conf create mode 100644 tests/drivers/spi/spi_loopback/boards/max32657evkit_max32657_ns.overlay diff --git a/tests/drivers/spi/spi_loopback/boards/max32657evkit_max32657.conf b/tests/drivers/spi/spi_loopback/boards/max32657evkit_max32657.conf new file mode 100644 index 000000000000..87c673fcdaff --- /dev/null +++ b/tests/drivers/spi/spi_loopback/boards/max32657evkit_max32657.conf @@ -0,0 +1,6 @@ +# +# Copyright (c) 2024 Analog Devices, Inc. +# +# SPDX-License-Identifier: Apache-2.0 +# +CONFIG_SPI_MAX32_INTERRUPT=y diff --git a/tests/drivers/spi/spi_loopback/boards/max32657evkit_max32657.overlay b/tests/drivers/spi/spi_loopback/boards/max32657evkit_max32657.overlay new file mode 100644 index 000000000000..83a4a0b60da6 --- /dev/null +++ b/tests/drivers/spi/spi_loopback/boards/max32657evkit_max32657.overlay @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2024 Analog Devices, Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&dma1 { + status = "okay"; +}; + +&spi0 { + dmas = <&dma1 1 MAX32_DMA_SLOT_SPI_TX>, <&dma1 2 MAX32_DMA_SLOT_SPI_RX>; + dma-names = "tx", "rx"; + + slow@1 { + compatible = "test-spi-loopback-slow"; + reg = <1>; + spi-max-frequency = <128000>; + }; + fast@1 { + compatible = "test-spi-loopback-fast"; + reg = <1>; + spi-max-frequency = <500000>; + }; +}; diff --git a/tests/drivers/spi/spi_loopback/boards/max32657evkit_max32657_ns.conf b/tests/drivers/spi/spi_loopback/boards/max32657evkit_max32657_ns.conf new file mode 100644 index 000000000000..87c673fcdaff --- /dev/null +++ b/tests/drivers/spi/spi_loopback/boards/max32657evkit_max32657_ns.conf @@ -0,0 +1,6 @@ +# +# Copyright (c) 2024 Analog Devices, Inc. +# +# SPDX-License-Identifier: Apache-2.0 +# +CONFIG_SPI_MAX32_INTERRUPT=y diff --git a/tests/drivers/spi/spi_loopback/boards/max32657evkit_max32657_ns.overlay b/tests/drivers/spi/spi_loopback/boards/max32657evkit_max32657_ns.overlay new file mode 100644 index 000000000000..ee529c8bf487 --- /dev/null +++ b/tests/drivers/spi/spi_loopback/boards/max32657evkit_max32657_ns.overlay @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2024 Analog Devices, Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&spi0 { + slow@1 { + compatible = "test-spi-loopback-slow"; + reg = <1>; + spi-max-frequency = <128000>; + }; + fast@1 { + compatible = "test-spi-loopback-fast"; + reg = <1>; + spi-max-frequency = <500000>; + }; +}; From d18433fbd8c74ffb1a4dd0234730fca12f322c81 Mon Sep 17 00:00:00 2001 From: Declan Snyder Date: Tue, 1 Jul 2025 10:41:31 -0500 Subject: [PATCH 0307/2141] [nrf fromtree] tests: spi_loopback: skip hold_on_cs test if not supported This early exit section is only reached if there is an error. In the case of not supported, the ret variable will be 0 and zassert won't happen. This is because the test was meant to be skipped, not passed or failed, in this case. So add the skip call. Signed-off-by: Declan Snyder (cherry picked from commit 0574ac7e845876c8e9fee0c8f3974d519a7ce086) --- tests/drivers/spi/spi_loopback/src/spi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/drivers/spi/spi_loopback/src/spi.c b/tests/drivers/spi/spi_loopback/src/spi.c index 9d6c8718472c..e3ad4043c169 100644 --- a/tests/drivers/spi/spi_loopback/src/spi.c +++ b/tests/drivers/spi/spi_loopback/src/spi.c @@ -1017,6 +1017,8 @@ ZTEST(spi_extra_api_features, test_spi_hold_on_cs) early_exit: hold_spec->config.operation &= ~SPI_HOLD_ON_CS; zassert_false(ret, "SPI transceive failed, code %d", ret); + /* if there was no error then it was meant to be a skip at this point */ + ztest_test_skip(); } /* From ab75d58b5309dcf789dc5e8c044d0c2e6fc84d46 Mon Sep 17 00:00:00 2001 From: Declan Snyder Date: Tue, 1 Jul 2025 11:24:12 -0500 Subject: [PATCH 0308/2141] [nrf fromtree] tests: spi_loopback: Fix same_buf_cmd test The tests was written wrong. It was meant to test using same spi bufs for both rx and tx, as in tree many sensor and other spi device drivers use this paradigm. But the 2nd buf setup call was overwriting the first. Fix by not using the helper function for this case. And for the write back test, test using same spi_buf_set. Signed-off-by: Declan Snyder (cherry picked from commit f7853dfb161a849f466026c35f02f0a025413719) --- tests/drivers/spi/spi_loopback/src/spi.c | 33 ++++++++++++++---------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/tests/drivers/spi/spi_loopback/src/spi.c b/tests/drivers/spi/spi_loopback/src/spi.c index e3ad4043c169..bb8b9d283b28 100644 --- a/tests/drivers/spi/spi_loopback/src/spi.c +++ b/tests/drivers/spi/spi_loopback/src/spi.c @@ -599,18 +599,17 @@ ZTEST(spi_loopback, test_nop_nil_bufs) /* nothing really to check here, check is done in spi_loopback_transceive */ } -/* test using the same buffer for RX and TX will write same data back */ +/* test using the same buffer set for RX and TX will write same data back */ ZTEST(spi_loopback, test_spi_write_back) { struct spi_dt_spec *spec = loopback_specs[spec_idx]; - const struct spi_buf_set tx = spi_loopback_setup_xfer(rx_bufs_pool, 1, - buffer_rx, BUF_SIZE); - const struct spi_buf_set rx = spi_loopback_setup_xfer(rx_bufs_pool, 1, - buffer_rx, BUF_SIZE); + + struct spi_buf buf = {.buf = buffer_rx, .len = BUF_SIZE}; + struct spi_buf_set set = {.buffers = &buf, .count = 1}; memcpy(buffer_rx, tx_data, sizeof(tx_data)); - spi_loopback_transceive(spec, &tx, &rx); + spi_loopback_transceive(spec, &set, &set); spi_loopback_compare_bufs(tx_data, buffer_rx, BUF_SIZE, buffer_print_tx, buffer_print_rx); @@ -620,19 +619,25 @@ ZTEST(spi_loopback, test_spi_write_back) ZTEST(spi_loopback, test_spi_same_buf_cmd) { struct spi_dt_spec *spec = loopback_specs[spec_idx]; - const struct spi_buf_set tx = spi_loopback_setup_xfer(rx_bufs_pool, 2, - buffer_rx, 1, - NULL, BUF_SIZE - 1); - const struct spi_buf_set rx = spi_loopback_setup_xfer(rx_bufs_pool, 1, - NULL, BUF_SIZE - 1, - buffer_rx+(BUF_SIZE - 1), 1); - memcpy(buffer_rx, tx_data, sizeof(tx_data)); + struct spi_buf buf[2] = { + {.buf = buffer_rx, .len = 1}, + {.buf = buffer_rx+1, .len = BUF_SIZE - 1} + }; + + const struct spi_buf_set tx = {.buffers = buf, .count = 1}; + const struct spi_buf_set rx = {.buffers = buf, .count = 2}; + + memcpy(buffer_rx, tx_data, BUF_SIZE); spi_loopback_transceive(spec, &tx, &rx); - spi_loopback_compare_bufs(tx_data, buffer_rx, BUF_SIZE, + spi_loopback_compare_bufs(tx_data, buffer_rx, 1, buffer_print_tx, buffer_print_rx); + + char zeros[BUF_SIZE - 1] = {0}; + + zassert_ok(memcmp(buffer_rx+1, zeros, BUF_SIZE - 1)); } From 90758227e5cb1fd6bc8a07c714b871ec9bfb9d61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Thu, 10 Jul 2025 09:26:25 +0200 Subject: [PATCH 0309/2141] [nrf fromtree] tests: drivers: spi: spi_loopback: Cleanup after nRF54LM20 rename MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove duplicated test configuration after nrf54l20pdk/nrf54l20/cpuxxx was renamed to nrf54lm20dk/nrf54lm20a/cpuxxx. Run test with 16MHz/32MHz bitrate using spi00 instance (spi2x instances support up to 16MHz/2). Signed-off-by: Sebastian Głąb (cherry picked from commit 31e8326e611aca31a9b8bb7a468f1361c9a106bb) --- .../boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf | 1 + .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 2 ++ ...f54lm20dk_nrf54lm20a_cpuapp_spi00.overlay} | 26 +++++++++++++------ tests/drivers/spi/spi_loopback/testcase.yaml | 15 ++++++----- 4 files changed, 29 insertions(+), 15 deletions(-) create mode 100644 tests/drivers/spi/spi_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf rename tests/drivers/spi/spi_loopback/boards/{nrf54l20pdk_nrf54l20_cpuapp.overlay => nrf54lm20dk_nrf54lm20a_cpuapp_spi00.overlay} (59%) diff --git a/tests/drivers/spi/spi_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf b/tests/drivers/spi/spi_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf new file mode 100644 index 000000000000..ad922ab8d26f --- /dev/null +++ b/tests/drivers/spi/spi_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf @@ -0,0 +1 @@ +CONFIG_SPI_IDEAL_TRANSFER_DURATION_SCALING=12 diff --git a/tests/drivers/spi/spi_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/spi/spi_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay index d6e037cdbdfd..1dcb91c0f5be 100644 --- a/tests/drivers/spi/spi_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ b/tests/drivers/spi/spi_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -34,11 +34,13 @@ pinctrl-names = "default", "sleep"; overrun-character = <0x00>; zephyr,pm-device-runtime-auto; + slow@0 { compatible = "test-spi-loopback-slow"; reg = <0>; spi-max-frequency = ; }; + dut_fast: fast@0 { compatible = "test-spi-loopback-fast"; reg = <0>; diff --git a/tests/drivers/spi/spi_loopback/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/tests/drivers/spi/spi_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp_spi00.overlay similarity index 59% rename from tests/drivers/spi/spi_loopback/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay rename to tests/drivers/spi/spi_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp_spi00.overlay index 48840969d8e6..2d1015eaf24b 100644 --- a/tests/drivers/spi/spi_loopback/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay +++ b/tests/drivers/spi/spi_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp_spi00.overlay @@ -4,20 +4,28 @@ * SPDX-License-Identifier: Apache-2.0 */ +/* Test requires following loopback: + * P2.02 - P2.04 + */ + &pinctrl { spi00_default: spi00_default { group1 { - psels = , - , - ; + psels = ; + }; + + group2 { + psels = , + ; + nordic,drive-mode = ; }; }; spi00_sleep: spi00_sleep { group1 { - psels = , - , - ; + psels = , + , + ; low-power-enable; }; }; @@ -30,15 +38,17 @@ pinctrl-names = "default", "sleep"; overrun-character = <0x00>; zephyr,pm-device-runtime-auto; + slow@0 { compatible = "test-spi-loopback-slow"; reg = <0>; - spi-max-frequency = ; + spi-max-frequency = ; }; + dut_fast: fast@0 { compatible = "test-spi-loopback-fast"; reg = <0>; - spi-max-frequency = ; + spi-max-frequency = ; }; }; diff --git a/tests/drivers/spi/spi_loopback/testcase.yaml b/tests/drivers/spi/spi_loopback/testcase.yaml index e64aa8cdbf3e..746cc03c81a8 100644 --- a/tests/drivers/spi/spi_loopback/testcase.yaml +++ b/tests/drivers/spi/spi_loopback/testcase.yaml @@ -238,8 +238,6 @@ tests: extra_args: EXTRA_DTC_OVERLAY_FILE="boards/nrf_at_1mhz.overlay" platform_allow: - nrf54l15dk/nrf54l15/cpuapp - - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp harness: console harness_config: fixture: spi_loopback @@ -250,23 +248,26 @@ tests: extra_args: EXTRA_DTC_OVERLAY_FILE="boards/nrf_at_8mhz.overlay" platform_allow: - nrf54l15dk/nrf54l15/cpuapp - - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp drivers.spi.nrf54l_16mhz: extra_args: EXTRA_DTC_OVERLAY_FILE="boards/nrf_at_16mhz.overlay" platform_allow: - nrf54l15dk/nrf54l15/cpuapp - - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp drivers.spi.nrf54l_32mhz: extra_args: EXTRA_DTC_OVERLAY_FILE="boards/nrf_at_32mhz.overlay" platform_allow: - nrf54l15dk/nrf54l15/cpuapp - - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp + drivers.spi.nrf54lm20_16mhz_32mhz: + harness: ztest + harness_config: + fixture: spi_fast_loopback + extra_args: + - DTC_OVERLAY_FILE="boards/nrf54lm20dk_nrf54lm20a_cpuapp_spi00.overlay" + platform_allow: + - nrf54lm20dk/nrf54lm20a/cpuapp drivers.spi.ke1xz_flexio_spi.loopback: extra_args: DTC_OVERLAY_FILE="boards/frdm_ke1xz_flexio_spi.overlay" filter: CONFIG_DT_HAS_NXP_FLEXIO_ENABLED and From 097c8a28d1888f416411c9948d67806960d4fd93 Mon Sep 17 00:00:00 2001 From: Jerzy Kasenberg Date: Mon, 10 Feb 2025 13:11:01 +0100 Subject: [PATCH 0310/2141] [nrf fromtree] tests: drivers: uart: async_api: Fix chain write This fixes the case where uart_tx() called from tx callback fill UART output fifo and immediately execute callback again. This can happen when hardware does not have interrupt for output FIFO empty and there is no non-blocking way to tell that transfer finished. For such case as soon as output FIFO is filled there is interrupt that informs that more data can be transmitted. For hardware with 32 byte fifo callback was seen to be executed recursively 3 times. That would not be a problem if chained_write_next_buf was set BEFORE next call uart_tx(). Additionally semaphore max value is increased to 2 to accommodate such case. Signed-off-by: Jerzy Kasenberg (cherry picked from commit fea8ee47dab30559eb486ae0d23dc711639ef786) --- tests/drivers/uart/uart_async_api/src/test_uart_async.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/drivers/uart/uart_async_api/src/test_uart_async.c b/tests/drivers/uart/uart_async_api/src/test_uart_async.c index e08616566430..4feec039001f 100644 --- a/tests/drivers/uart/uart_async_api/src/test_uart_async.c +++ b/tests/drivers/uart/uart_async_api/src/test_uart_async.c @@ -17,7 +17,7 @@ #define NOCACHE_MEM 0 #endif /* CONFIG_NOCACHE_MEMORY */ -K_SEM_DEFINE(tx_done, 0, 1); +K_SEM_DEFINE(tx_done, 0, 2); K_SEM_DEFINE(tx_aborted, 0, 1); K_SEM_DEFINE(rx_rdy, 0, 1); K_SEM_DEFINE(rx_buf_coherency, 0, 255); @@ -833,8 +833,8 @@ static void test_chained_write_callback(const struct device *dev, switch (evt->type) { case UART_TX_DONE: if (chained_write_next_buf) { - uart_tx(dev, chained_write_tx_bufs[1], 10, 100 * USEC_PER_MSEC); chained_write_next_buf = false; + uart_tx(dev, chained_write_tx_bufs[1], 10, 100 * USEC_PER_MSEC); } tx_sent = 1; k_sem_give(&tx_done); From 276b5c7731a477e390486cb57d97b75b5303c00a Mon Sep 17 00:00:00 2001 From: Khaoula Bidani Date: Mon, 16 Jun 2025 09:50:44 +0200 Subject: [PATCH 0311/2141] [nrf fromtree] tests: drivers: uart: async_api: add stm32u3 boards overlays Add UART test overlays for Nucleo U385RG-Q board. Remove non serial boot conf file since they are now unnecessary. Signed-off-by: Khaoula Bidani (cherry picked from commit 065900b11f55bceedf159dee3524a6a92f4d391a) --- .../uart_async_api/boards/nucleo_u385rg_q.overlay | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 tests/drivers/uart/uart_async_api/boards/nucleo_u385rg_q.overlay diff --git a/tests/drivers/uart/uart_async_api/boards/nucleo_u385rg_q.overlay b/tests/drivers/uart/uart_async_api/boards/nucleo_u385rg_q.overlay new file mode 100644 index 000000000000..87bd131e1ca6 --- /dev/null +++ b/tests/drivers/uart/uart_async_api/boards/nucleo_u385rg_q.overlay @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2025 STMicroelectronics + * + * SPDX-License-Identifier: Apache-2.0 + */ + +dut: &lpuart1 { + dmas = <&gpdma1 0 35 STM32_DMA_PERIPH_TX + &gpdma1 1 34 STM32_DMA_PERIPH_RX>; + dma-names = "tx", "rx"; +}; + +&gpdma1 { + status = "okay"; +}; From cb99f75b590c542056fa95e10a9d4d548a0b5542 Mon Sep 17 00:00:00 2001 From: Khoa Nguyen Date: Wed, 2 Apr 2025 13:12:02 +0700 Subject: [PATCH 0312/2141] [nrf fromtree] tests: drivers: uart: Add support test uart_async for ek_ra8p1 Add support test uart_async_api for Renesas ek_ra8p1 Signed-off-by: Khoa Nguyen (cherry picked from commit e6f9cd35bffdc9ea9992e78e9bb96671837b9b6b) --- .../ek_ra8p1_r7ka8p1kflcac_cm85.overlay | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 tests/drivers/uart/uart_async_api/boards/ek_ra8p1_r7ka8p1kflcac_cm85.overlay diff --git a/tests/drivers/uart/uart_async_api/boards/ek_ra8p1_r7ka8p1kflcac_cm85.overlay b/tests/drivers/uart/uart_async_api/boards/ek_ra8p1_r7ka8p1kflcac_cm85.overlay new file mode 100644 index 000000000000..ac9bd7768dd0 --- /dev/null +++ b/tests/drivers/uart/uart_async_api/boards/ek_ra8p1_r7ka8p1kflcac_cm85.overlay @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Renesas Electronics Corporation + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + sci2_default: sci2_default { + group1 { + /* tx */ + psels = ; + drive-strength = "medium"; + }; + + group2 { + /* rx */ + psels = ; + }; + }; +}; + +&sci2 { + interrupts = <30 1>, <31 1>, <32 1>, <33 1>; + interrupt-names = "rxi", "txi", "tei", "eri"; + pinctrl-0 = <&sci2_default>; + pinctrl-names = "default"; + status = "okay"; + + dut: uart { + current-speed = <115200>; + status = "okay"; + }; +}; From 33d8754094c1c047300546f2a3bdb2f9bf32f1b1 Mon Sep 17 00:00:00 2001 From: Fabrice DJIATSA Date: Fri, 6 Jun 2025 11:44:20 +0200 Subject: [PATCH 0313/2141] [nrf fromtree] tests: drivers: uart_async_api: add tx buffer in nocache memory Since nucleo_f746zg has NOCACHE_MEM defined (related to test cases drivers.uart.async_api.nocache_mem and drivers.uart.async_api.nocache_mem_dt.nucleo_f746zg), the TX buffer should be placed in a non-cacheable memory region for the uart_async_var_buf_length testsuite to pass. Signed-off-by: Fabrice DJIATSA (cherry picked from commit 28c766b95705452b2f94e45e4ad87df03109b123) --- tests/drivers/uart/uart_async_api/src/test_uart_async.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/drivers/uart/uart_async_api/src/test_uart_async.c b/tests/drivers/uart/uart_async_api/src/test_uart_async.c index 4feec039001f..936600c96fcb 100644 --- a/tests/drivers/uart/uart_async_api/src/test_uart_async.c +++ b/tests/drivers/uart/uart_async_api/src/test_uart_async.c @@ -1068,7 +1068,12 @@ static void *var_buf_length_setup(void) static void test_uart_async_var_buf(size_t buf_len, size_t tx_len) { int ret; - uint8_t tx_buffer[VAR_LENGTH_TX_BUF_SIZE]; + +#if NOCACHE_MEM +static __aligned(sizeof(void *)) uint8_t tx_buffer[VAR_LENGTH_TX_BUF_SIZE] __used __NOCACHE; +#else +static ZTEST_BMEM uint8_t tx_buffer[VAR_LENGTH_TX_BUF_SIZE]; +#endif /* NOCACHE_MEM */ for (size_t i = 0; i < VAR_LENGTH_TX_BUF_SIZE; ++i) { tx_buffer[i] = tx_len; From a835e255dbba7ab851e96432b55413f56c5a0c74 Mon Sep 17 00:00:00 2001 From: Fabrice DJIATSA Date: Fri, 20 Jun 2025 09:36:35 +0200 Subject: [PATCH 0314/2141] [nrf fromtree] tests: drivers: uart: async_api: update wba55cg clock frequency With the current configuration, we encounter a user setting error during the test with the log: "Wrong number of bytes received, got: 2, expected: 3." Workaround: Increase the clock frequency to enable faster data transmission and avoid user setting errors. Signed-off-by: Fabrice DJIATSA (cherry picked from commit 7900f8d4ee7b318c0813c9a5629d000cdae7b06c) --- .../uart/uart_async_api/boards/nucleo_wba55cg.overlay | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/drivers/uart/uart_async_api/boards/nucleo_wba55cg.overlay b/tests/drivers/uart/uart_async_api/boards/nucleo_wba55cg.overlay index 9fc34bb26a2b..df1b3856c1a8 100644 --- a/tests/drivers/uart/uart_async_api/boards/nucleo_wba55cg.overlay +++ b/tests/drivers/uart/uart_async_api/boards/nucleo_wba55cg.overlay @@ -4,6 +4,11 @@ * SPDX-License-Identifier: Apache-2.0 */ +&rcc { + clocks = <&clk_hsi>; + clock-frequency = ; +}; + dut: &lpuart1 { dmas = <&gpdma1 0 16 STM32_DMA_PERIPH_TX &gpdma1 1 15 STM32_DMA_PERIPH_RX>; From 7ef16031c7ea9b925876bfff45746859f3927b79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Thu, 10 Jul 2025 09:34:41 +0200 Subject: [PATCH 0315/2141] [nrf fromtree] tests: drivers: uart: uart_async_api: Cleanup after nRF54LM20 rename MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove duplicated test configuration after nrf54l20pdk/nrf54l20/cpuxxx was renamed to nrf54lm20dk/nrf54lm20a/cpuxxx. Add test on fast instance uart00 on nrf54lm20dk. Signed-off-by: Sebastian Głąb (cherry picked from commit e5a9c35a994449cd01438ac0754073d395440f3c) --- .../nrf54l20pdk_nrf54l20_cpuapp.overlay | 26 ------------ .../boards/nrf54lm20dk_nrf54lm20_common.dtsi | 6 +++ .../boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf | 1 + ...f54lm20dk_nrf54lm20a_cpuapp_uart00.overlay | 42 +++++++++++++++++++ .../drivers/uart/uart_async_api/testcase.yaml | 8 ++++ 5 files changed, 57 insertions(+), 26 deletions(-) delete mode 100644 tests/drivers/uart/uart_async_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay create mode 100644 tests/drivers/uart/uart_async_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf create mode 100644 tests/drivers/uart/uart_async_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp_uart00.overlay diff --git a/tests/drivers/uart/uart_async_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/tests/drivers/uart/uart_async_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay deleted file mode 100644 index ed4a2de1891c..000000000000 --- a/tests/drivers/uart/uart_async_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay +++ /dev/null @@ -1,26 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - -&pinctrl { - uart21_default_alt: uart21_default_alt { - group1 { - psels = , - ; - }; - }; - - uart21_sleep_alt: uart21_sleep_alt { - group1 { - psels = , - ; - low-power-enable; - }; - }; -}; - -dut: &uart21 { - status = "okay"; - pinctrl-0 = <&uart21_default_alt>; - pinctrl-1 = <&uart21_sleep_alt>; - pinctrl-names = "default", "sleep"; - current-speed = <115200>; -}; diff --git a/tests/drivers/uart/uart_async_api/boards/nrf54lm20dk_nrf54lm20_common.dtsi b/tests/drivers/uart/uart_async_api/boards/nrf54lm20dk_nrf54lm20_common.dtsi index ec39ed93ecf4..8a8a0363b652 100644 --- a/tests/drivers/uart/uart_async_api/boards/nrf54lm20dk_nrf54lm20_common.dtsi +++ b/tests/drivers/uart/uart_async_api/boards/nrf54lm20dk_nrf54lm20_common.dtsi @@ -1,3 +1,9 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + /* Test requires following loopback: * P1.13 - P1.14 */ diff --git a/tests/drivers/uart/uart_async_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf b/tests/drivers/uart/uart_async_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf new file mode 100644 index 000000000000..d70069646c93 --- /dev/null +++ b/tests/drivers/uart/uart_async_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf @@ -0,0 +1 @@ +CONFIG_VAR_LENGTH_BUFFER_TEST_BUADRATE_LIMIT=57600 diff --git a/tests/drivers/uart/uart_async_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp_uart00.overlay b/tests/drivers/uart/uart_async_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp_uart00.overlay new file mode 100644 index 000000000000..5f129663e55e --- /dev/null +++ b/tests/drivers/uart/uart_async_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp_uart00.overlay @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* Test requires following loopback: + * P2.02 - P2.00 + */ + +&pinctrl { + uart00_default_alt: uart00_default_alt { + group1 { + psels = ; + }; + + group2 { + psels = ; + bias-pull-up; + }; + }; + + uart00_sleep_alt: uart00_sleep_alt { + group1 { + psels = , + ; + low-power-enable; + }; + }; +}; + +dut: &uart00 { + status = "okay"; + pinctrl-0 = <&uart00_default_alt>; + pinctrl-1 = <&uart00_sleep_alt>; + pinctrl-names = "default", "sleep"; + current-speed = <4000000>; +}; + +&gpio2 { + status = "okay"; +}; diff --git a/tests/drivers/uart/uart_async_api/testcase.yaml b/tests/drivers/uart/uart_async_api/testcase.yaml index efcf3af94534..3e6c28ddd390 100644 --- a/tests/drivers/uart/uart_async_api/testcase.yaml +++ b/tests/drivers/uart/uart_async_api/testcase.yaml @@ -18,6 +18,14 @@ tests: - platform:mimxrt685_evk/mimxrt685s/cm33:"DTC_OVERLAY_FILE=nxp/dut_flexcomm4.overlay" - platform:mimxrt595_evk/mimxrt595s/cm33:"DTC_OVERLAY_FILE=nxp/dut_flexcomm12.overlay" - platform:frdm_rw612/rw612:"DTC_OVERLAY_FILE=nxp/dut_lpc_flexcomm0.overlay" + drivers.uart.async_api.fast: + harness: ztest + harness_config: + fixture: uart_fast_loopback + platform_allow: + - nrf54lm20dk/nrf54lm20a/cpuapp + extra_args: + - DTC_OVERLAY_FILE="boards/nrf54lm20dk_nrf54lm20a_cpuapp_uart00.overlay" drivers.uart.wide: filter: CONFIG_SERIAL_SUPPORT_ASYNC and not CONFIG_UART_MCUX_LPUART harness: ztest From 2b3435759b7c0fdf036c5b8deea3645429e59f7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Thu, 10 Jul 2025 09:36:53 +0200 Subject: [PATCH 0316/2141] [nrf fromtree] tests: drivers: uart: uart_elementary: Cleanup after nRF54LM20 rename MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove duplicated test configuration after nrf54l20pdk/nrf54l20/cpuxxx was renamed to nrf54lm20dk/nrf54lm20a/cpuxxx. Reorganize testcase.yaml to make it easier to maintain. Signed-off-by: Sebastian Głąb (cherry picked from commit 207c662e11784671143d62818565170a3e950405) --- ...54l15dk_nrf54l15_cpuflpr_dual_uart.overlay | 51 -------------- ... => nrf54l15dk_nrf54l15_dual_uart.overlay} | 0 .../nrf54l20pdk_nrf54l20_cpuapp.overlay | 31 -------- .../nrf54l20pdk_nrf54l20_cpuflpr.overlay | 31 -------- .../boards/nrf54lm20dk_nrf54lm20_common.dtsi | 7 ++ .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 2 + .../nrf54lm20dk_nrf54lm20a_cpuflpr.overlay | 2 + .../nrf54lm20dk_nrf54lm20a_dual_uart.overlay | 7 ++ .../uart/uart_elementary/testcase.yaml | 70 +++++++------------ 9 files changed, 45 insertions(+), 156 deletions(-) delete mode 100644 tests/drivers/uart/uart_elementary/boards/nrf54l15dk_nrf54l15_cpuflpr_dual_uart.overlay rename tests/drivers/uart/uart_elementary/boards/{nrf54l15dk_nrf54l15_cpuapp_dual_uart.overlay => nrf54l15dk_nrf54l15_dual_uart.overlay} (100%) delete mode 100644 tests/drivers/uart/uart_elementary/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay delete mode 100644 tests/drivers/uart/uart_elementary/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54l15dk_nrf54l15_cpuflpr_dual_uart.overlay b/tests/drivers/uart/uart_elementary/boards/nrf54l15dk_nrf54l15_cpuflpr_dual_uart.overlay deleted file mode 100644 index 2031f7a24441..000000000000 --- a/tests/drivers/uart/uart_elementary/boards/nrf54l15dk_nrf54l15_cpuflpr_dual_uart.overlay +++ /dev/null @@ -1,51 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - -&pinctrl { - uart21_default: uart21_default { - group1 { - psels = , - ; - bias-pull-up; - }; - }; - - uart21_sleep: uart21_sleep { - group1 { - psels = , - ; - low-power-enable; - }; - }; - - uart22_default: uart22_default { - group1 { - psels = , - ; - bias-pull-up; - }; - }; - - uart22_sleep: uart22_sleep { - group1 { - psels = , - ; - low-power-enable; - }; - }; -}; - -dut: &uart21 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart21_default>; - pinctrl-1 = <&uart21_sleep>; - pinctrl-names = "default", "sleep"; -}; - -dut_aux: &uart22 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart22_default>; - pinctrl-1 = <&uart22_sleep>; - pinctrl-names = "default", "sleep"; -}; diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54l15dk_nrf54l15_cpuapp_dual_uart.overlay b/tests/drivers/uart/uart_elementary/boards/nrf54l15dk_nrf54l15_dual_uart.overlay similarity index 100% rename from tests/drivers/uart/uart_elementary/boards/nrf54l15dk_nrf54l15_cpuapp_dual_uart.overlay rename to tests/drivers/uart/uart_elementary/boards/nrf54l15dk_nrf54l15_dual_uart.overlay diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/tests/drivers/uart/uart_elementary/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay deleted file mode 100644 index cf481b7a1614..000000000000 --- a/tests/drivers/uart/uart_elementary/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay +++ /dev/null @@ -1,31 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - -&pinctrl { - uart21_default: uart21_default { - group1 { - psels = , - , - , - ; - }; - }; - - uart21_sleep: uart21_sleep { - group1 { - psels = , - , - , - ; - low-power-enable; - }; - }; -}; - -dut: &uart21 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart21_default>; - pinctrl-1 = <&uart21_sleep>; - pinctrl-names = "default", "sleep"; - hw-flow-control; -}; diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay b/tests/drivers/uart/uart_elementary/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay deleted file mode 100644 index cf481b7a1614..000000000000 --- a/tests/drivers/uart/uart_elementary/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay +++ /dev/null @@ -1,31 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - -&pinctrl { - uart21_default: uart21_default { - group1 { - psels = , - , - , - ; - }; - }; - - uart21_sleep: uart21_sleep { - group1 { - psels = , - , - , - ; - low-power-enable; - }; - }; -}; - -dut: &uart21 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart21_default>; - pinctrl-1 = <&uart21_sleep>; - pinctrl-names = "default", "sleep"; - hw-flow-control; -}; diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20_common.dtsi b/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20_common.dtsi index dd9f0b93be04..33d060d30ced 100644 --- a/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20_common.dtsi +++ b/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20_common.dtsi @@ -1,3 +1,10 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +/* Test requires loopbacks: + * P1.13 - P1.14 + * P1.23 - P1.24 + */ + &pinctrl { uart21_default: uart21_default { group1 { diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay index 5210e41ef553..03676317e382 100644 --- a/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ b/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -1 +1,3 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + #include "nrf54lm20dk_nrf54lm20_common.dtsi" diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay b/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay index 5210e41ef553..03676317e382 100644 --- a/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay +++ b/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay @@ -1 +1,3 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + #include "nrf54lm20dk_nrf54lm20_common.dtsi" diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20a_dual_uart.overlay b/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20a_dual_uart.overlay index 0dcede29d924..72e7e968d0b7 100644 --- a/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20a_dual_uart.overlay +++ b/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20a_dual_uart.overlay @@ -1,3 +1,10 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +/* Test requires loopbacks: + * P1.13 - P1.14 + * P1.23 - P1.24 + */ + &pinctrl { uart21_default: uart21_default { group1 { diff --git a/tests/drivers/uart/uart_elementary/testcase.yaml b/tests/drivers/uart/uart_elementary/testcase.yaml index 83aba78e8282..de3d18a50eea 100644 --- a/tests/drivers/uart/uart_elementary/testcase.yaml +++ b/tests/drivers/uart/uart_elementary/testcase.yaml @@ -15,9 +15,7 @@ tests: - nrf54l09pdk/nrf54l09/cpuflpr - nrf54l15dk/nrf54l15/cpuapp - nrf54l15dk/nrf54l15/cpuflpr - - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - - nrf54l20pdk/nrf54l20/cpuflpr - nrf54lm20dk/nrf54lm20a/cpuflpr - nrf5340dk/nrf5340/cpuapp - ophelia4ev/nrf54l15/cpuapp @@ -57,59 +55,45 @@ tests: drivers.uart.uart_elementary_dual_nrf54l: filter: CONFIG_SERIAL_SUPPORT_INTERRUPT platform_allow: + - nrf54l09pdk/nrf54l09/cpuapp + - nrf54l09pdk/nrf54l09/cpuflpr - nrf54l15dk/nrf54l15/cpuapp - - nrf54l20pdk/nrf54l20/cpuapp + - nrf54l15dk/nrf54l15/cpuflpr - nrf54lm20dk/nrf54lm20a/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuflpr - ophelia4ev/nrf54l15/cpuapp - extra_args: DTC_OVERLAY_FILE="boards/nrf54l15dk_nrf54l15_cpuapp_dual_uart.overlay" + - ophelia4ev/nrf54l15/cpuflpr + extra_args: + - platform:nrf54l09pdk/nrf54l09/cpuapp:"DTC_OVERLAY_FILE=boards/nrf54l09pdk_nrf54l09_dual_uart.overlay" + - platform:nrf54l09pdk/nrf54l09/cpuflpr:"DTC_OVERLAY_FILE=boards/nrf54l09pdk_nrf54l09_dual_uart.overlay" + - platform:nrf54l15dk/nrf54l15/cpuapp:"DTC_OVERLAY_FILE=boards/nrf54l15dk_nrf54l15_dual_uart.overlay" + - platform:nrf54l15dk/nrf54l15/cpuflpr:"DTC_OVERLAY_FILE=boards/nrf54l15dk_nrf54l15_dual_uart.overlay" + - platform:nrf54lm20dk/nrf54lm20a/cpuapp:"DTC_OVERLAY_FILE=boards/nrf54lm20dk_nrf54lm20a_dual_uart.overlay" + - platform:nrf54lm20dk/nrf54lm20a/cpuflpr:"DTC_OVERLAY_FILE=boards/nrf54lm20dk_nrf54lm20a_dual_uart.overlay" + - platform:ophelia4ev/nrf54l15/cpuapp:"DTC_OVERLAY_FILE=boards/nrf54l15dk_nrf54l15_dual_uart.overlay" + - platform:ophelia4ev/nrf54l15/cpuflpr:"DTC_OVERLAY_FILE=boards/nrf54l15dk_nrf54l15_dual_uart.overlay" extra_configs: - CONFIG_DUAL_UART_TEST=y drivers.uart.uart_elementary_dual_setup_mismatch_nrf54l: filter: CONFIG_SERIAL_SUPPORT_INTERRUPT platform_allow: + - nrf54l09pdk/nrf54l09/cpuapp + - nrf54l09pdk/nrf54l09/cpuflpr - nrf54l15dk/nrf54l15/cpuapp - - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - - ophelia4ev/nrf54l15/cpuapp - extra_args: DTC_OVERLAY_FILE="boards/nrf54l15dk_nrf54l15_cpuapp_dual_uart.overlay" - extra_configs: - - CONFIG_DUAL_UART_TEST=y - - CONFIG_SETUP_MISMATCH_TEST=y - drivers.uart.uart_elementary_dual_nrf54l_cpuflpr: - filter: CONFIG_SERIAL_SUPPORT_INTERRUPT - platform_allow: - - nrf54l15dk/nrf54l15/cpuflpr - - nrf54l20pdk/nrf54l20/cpuflpr - - nrf54lm20dk/nrf54lm20a/cpuflpr - - ophelia4ev/nrf54l15/cpuflpr - extra_args: DTC_OVERLAY_FILE="boards/nrf54l15dk_nrf54l15_cpuflpr_dual_uart.overlay" - extra_configs: - - CONFIG_DUAL_UART_TEST=y - drivers.uart.uart_elementary_dual_setup_mismatch_nrf54l_cpuflpr: - filter: CONFIG_SERIAL_SUPPORT_INTERRUPT - platform_allow: - nrf54l15dk/nrf54l15/cpuflpr - - nrf54l20pdk/nrf54l20/cpuflpr + - nrf54lm20dk/nrf54lm20a/cpuapp - nrf54lm20dk/nrf54lm20a/cpuflpr + - ophelia4ev/nrf54l15/cpuapp - ophelia4ev/nrf54l15/cpuflpr - extra_args: DTC_OVERLAY_FILE="boards/nrf54l15dk_nrf54l15_cpuflpr_dual_uart.overlay" - extra_configs: - - CONFIG_DUAL_UART_TEST=y - - CONFIG_SETUP_MISMATCH_TEST=y - drivers.uart.uart_elementary_dual_nrf54l09: - filter: CONFIG_SERIAL_SUPPORT_INTERRUPT - platform_allow: - - nrf54l09pdk/nrf54l09/cpuapp - - nrf54l09pdk/nrf54l09/cpuflpr - extra_args: DTC_OVERLAY_FILE="boards/nrf54l09pdk_nrf54l09_dual_uart.overlay" - extra_configs: - - CONFIG_DUAL_UART_TEST=y - drivers.uart.uart_elementary_dual_setup_mismatch_nrf54l09: - filter: CONFIG_SERIAL_SUPPORT_INTERRUPT - platform_allow: - - nrf54l09pdk/nrf54l09/cpuapp - - nrf54l09pdk/nrf54l09/cpuflpr - extra_args: DTC_OVERLAY_FILE="boards/nrf54l09pdk_nrf54l09_dual_uart.overlay" + extra_args: + - platform:nrf54l09pdk/nrf54l09/cpuapp:"DTC_OVERLAY_FILE=boards/nrf54l09pdk_nrf54l09_dual_uart.overlay" + - platform:nrf54l09pdk/nrf54l09/cpuflpr:"DTC_OVERLAY_FILE=boards/nrf54l09pdk_nrf54l09_dual_uart.overlay" + - platform:nrf54l15dk/nrf54l15/cpuapp:"DTC_OVERLAY_FILE=boards/nrf54l15dk_nrf54l15_dual_uart.overlay" + - platform:nrf54l15dk/nrf54l15/cpuflpr:"DTC_OVERLAY_FILE=boards/nrf54l15dk_nrf54l15_dual_uart.overlay" + - platform:nrf54lm20dk/nrf54lm20a/cpuapp:"DTC_OVERLAY_FILE=boards/nrf54lm20dk_nrf54lm20a_dual_uart.overlay" + - platform:nrf54lm20dk/nrf54lm20a/cpuflpr:"DTC_OVERLAY_FILE=boards/nrf54lm20dk_nrf54lm20a_dual_uart.overlay" + - platform:ophelia4ev/nrf54l15/cpuapp:"DTC_OVERLAY_FILE=boards/nrf54l15dk_nrf54l15_dual_uart.overlay" + - platform:ophelia4ev/nrf54l15/cpuflpr:"DTC_OVERLAY_FILE=boards/nrf54l15dk_nrf54l15_dual_uart.overlay" extra_configs: - CONFIG_DUAL_UART_TEST=y - CONFIG_SETUP_MISMATCH_TEST=y From 35f8205ac7fc9d506f1bbcdae6dbfec3e655cdd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Thu, 10 Jul 2025 09:38:00 +0200 Subject: [PATCH 0317/2141] [nrf fromtree] tests: drivers: uart: uart_errors: Cleanup after nRF54LM20 rename MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove duplicated test configuration after nrf54l20pdk/nrf54l20/cpuxxx was renamed to nrf54lm20dk/nrf54lm20a/cpuxxx. Signed-off-by: Sebastian Głąb (cherry picked from commit d05c971350c9bfa1024d9be1fb747a9fb6257ccb) --- .../nrf54l20pdk_nrf54l20_cpuapp.overlay | 54 ------------------- tests/drivers/uart/uart_errors/testcase.yaml | 3 +- 2 files changed, 1 insertion(+), 56 deletions(-) delete mode 100644 tests/drivers/uart/uart_errors/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay diff --git a/tests/drivers/uart/uart_errors/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/tests/drivers/uart/uart_errors/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay deleted file mode 100644 index babbc740133f..000000000000 --- a/tests/drivers/uart/uart_errors/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay +++ /dev/null @@ -1,54 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - -&pinctrl { - uart21_default: uart21_default { - group1 { - psels = , - ; - }; - }; - - uart21_sleep: uart21_sleep { - group1 { - psels = , - ; - low-power-enable; - }; - }; - - uart22_default: uart22_default { - group1 { - psels = - ; - bias-pull-up; - }; - group2 { - psels = ; - }; - }; - - uart22_sleep: uart22_sleep { - group1 { - psels = , - ; - low-power-enable; - }; - }; -}; - -dut: &uart21 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart21_default>; - pinctrl-1 = <&uart21_sleep>; - pinctrl-names = "default", "sleep"; -}; - -dut_aux: &uart22 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart22_default>; - pinctrl-1 = <&uart22_sleep>; - pinctrl-names = "default", "sleep"; - disable-rx; -}; diff --git a/tests/drivers/uart/uart_errors/testcase.yaml b/tests/drivers/uart/uart_errors/testcase.yaml index 522935adccaf..c17f071b8535 100644 --- a/tests/drivers/uart/uart_errors/testcase.yaml +++ b/tests/drivers/uart/uart_errors/testcase.yaml @@ -6,13 +6,13 @@ common: harness: ztest harness_config: fixture: gpio_loopback + timeout: 30 tests: drivers.uart.uart_errors.int_driven: filter: CONFIG_SERIAL_SUPPORT_INTERRUPT platform_allow: - nrf54h20dk/nrf54h20/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - nrf5340dk/nrf5340/cpuapp - ophelia4ev/nrf54l15/cpuapp @@ -21,7 +21,6 @@ tests: platform_allow: - nrf54h20dk/nrf54h20/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - nrf5340dk/nrf5340/cpuapp - ophelia4ev/nrf54l15/cpuapp From a3ec88e69598522ba08afcf25547c25516001e69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Thu, 10 Jul 2025 09:43:58 +0200 Subject: [PATCH 0318/2141] [nrf fromtree] tests: drivers: watchodg: Cleanup after nRF54LM20 rename MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove duplicated test configuration after nrf54l20pdk/nrf54l20/cpuxxx was renamed to nrf54lm20dk/nrf54lm20a/cpuxxx. Signed-off-by: Sebastian Głąb (cherry picked from commit a918256659084ee6fbd3178989e6b982c990a45d) --- .../boards/nrf54l20pdk_nrf54l20_cpuapp.overlay | 9 --------- .../boards/nrf54l20pdk_nrf54l20_cpuapp.overlay | 9 --------- tests/drivers/watchdog/wdt_error_cases/testcase.yaml | 5 ++--- .../boards/nrf54l20pdk_nrf54l20_cpuapp.overlay | 9 --------- .../boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay} | 0 tests/drivers/watchdog/wdt_variables/testcase.yaml | 2 +- 6 files changed, 3 insertions(+), 31 deletions(-) delete mode 100644 tests/drivers/watchdog/wdt_basic_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay delete mode 100644 tests/drivers/watchdog/wdt_error_cases/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay delete mode 100644 tests/drivers/watchdog/wdt_variables/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay rename tests/drivers/watchdog/{wdt_basic_api/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay => wdt_variables/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay} (100%) diff --git a/tests/drivers/watchdog/wdt_basic_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/tests/drivers/watchdog/wdt_basic_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay deleted file mode 100644 index 8d3dce3b3800..000000000000 --- a/tests/drivers/watchdog/wdt_basic_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&wdt31 { - status = "okay"; -}; diff --git a/tests/drivers/watchdog/wdt_error_cases/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/tests/drivers/watchdog/wdt_error_cases/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay deleted file mode 100644 index 8d3dce3b3800..000000000000 --- a/tests/drivers/watchdog/wdt_error_cases/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&wdt31 { - status = "okay"; -}; diff --git a/tests/drivers/watchdog/wdt_error_cases/testcase.yaml b/tests/drivers/watchdog/wdt_error_cases/testcase.yaml index 951afe9034e0..f8da32ca72de 100644 --- a/tests/drivers/watchdog/wdt_error_cases/testcase.yaml +++ b/tests/drivers/watchdog/wdt_error_cases/testcase.yaml @@ -10,11 +10,10 @@ tests: platform_allow: - nrf5340dk/nrf5340/cpuapp - nrf54l09pdk/nrf54l09/cpuapp - - nrf54l15dk/nrf54l15/cpuapp - - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - nrf54h20dk/nrf54h20/cpuapp - nrf54h20dk/nrf54h20/cpurad + - nrf54l15dk/nrf54l15/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - nrf9280pdk/nrf9280/cpuapp - nrf9280pdk/nrf9280/cpurad - ophelia4ev/nrf54l15/cpuapp diff --git a/tests/drivers/watchdog/wdt_variables/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/tests/drivers/watchdog/wdt_variables/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay deleted file mode 100644 index dc1ea1a9ddc9..000000000000 --- a/tests/drivers/watchdog/wdt_variables/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&wdt31 { - status = "okay"; -}; diff --git a/tests/drivers/watchdog/wdt_basic_api/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay b/tests/drivers/watchdog/wdt_variables/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay similarity index 100% rename from tests/drivers/watchdog/wdt_basic_api/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay rename to tests/drivers/watchdog/wdt_variables/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay diff --git a/tests/drivers/watchdog/wdt_variables/testcase.yaml b/tests/drivers/watchdog/wdt_variables/testcase.yaml index d033e4f255e4..b504cb5b6b8d 100644 --- a/tests/drivers/watchdog/wdt_variables/testcase.yaml +++ b/tests/drivers/watchdog/wdt_variables/testcase.yaml @@ -16,8 +16,8 @@ tests: - nrf54h20dk/nrf54h20/cpuppr - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuflpr - ophelia4ev/nrf54l15/cpuapp integration_platforms: - nrf54l15dk/nrf54l15/cpuapp From 3c191f9f52ef07855029ccb2153a7cdfbf60f870 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Thu, 10 Jul 2025 09:44:57 +0200 Subject: [PATCH 0319/2141] [nrf fromtree] tests: kernel: timer: timer_behavior: Cleanup after nRF54LM20 rename MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove duplicated test configuration after nrf54l20pdk/nrf54l20/cpuxxx was renamed to nrf54lm20dk/nrf54lm20a/cpuxxx. Signed-off-by: Sebastian Głąb (cherry picked from commit 1cf511edd9004505f5bba07e4cf88490a2a39acc) --- .../timer/timer_behavior/boards/nrf54l20pdk_nrf54l20_cpuapp.conf | 1 - 1 file changed, 1 deletion(-) delete mode 100644 tests/kernel/timer/timer_behavior/boards/nrf54l20pdk_nrf54l20_cpuapp.conf diff --git a/tests/kernel/timer/timer_behavior/boards/nrf54l20pdk_nrf54l20_cpuapp.conf b/tests/kernel/timer/timer_behavior/boards/nrf54l20pdk_nrf54l20_cpuapp.conf deleted file mode 100644 index 4b13bc80c7f3..000000000000 --- a/tests/kernel/timer/timer_behavior/boards/nrf54l20pdk_nrf54l20_cpuapp.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_SYS_CLOCK_TICKS_PER_SEC=10000 From 87b5ed75aa56c17bf53178e58aa0eb05600df061 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Thu, 10 Jul 2025 09:46:03 +0200 Subject: [PATCH 0320/2141] [nrf fromtree] tests: subsys: fs: fcb: Cleanup after nRF54LM20 rename MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove duplicated test configuration after nrf54l20pdk/nrf54l20/cpuxxx was renamed to nrf54lm20dk/nrf54lm20a/cpuxxx. Signed-off-by: Sebastian Głąb (cherry picked from commit c537fa765eb784ddd3d14fd8835b34bfd4df2743) --- tests/subsys/fs/fcb/testcase.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/subsys/fs/fcb/testcase.yaml b/tests/subsys/fs/fcb/testcase.yaml index bd5067ecccec..c915dd56840b 100644 --- a/tests/subsys/fs/fcb/testcase.yaml +++ b/tests/subsys/fs/fcb/testcase.yaml @@ -14,7 +14,6 @@ tests: platform_allow: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp - native_sim From 00bd8639325531cb110d9469bc31fff8147c428c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Wed, 9 Jul 2025 09:04:29 +0200 Subject: [PATCH 0321/2141] [nrf fromtree] tests: drivers: clock_control: Cleanup after nRF54LM20 rename MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove duplicated test configuration after nrf54l20pdk/nrf54l20/cpuxxx was renamed to nrf54lm20dk/nrf54lm20a/cpuxxx. Signed-off-by: Sebastian Głąb (cherry picked from commit ebdbc243d4efa84099402a9847c1455b2a784451) --- .../boards/nrf54l20pdk_nrf54l20_cpuapp.conf | 1 - .../clock_control/clock_control_api/testcase.yaml | 2 -- .../clock_control/nrf_clock_calibration/testcase.yaml | 2 +- .../clock_control/nrf_lf_clock_start/testcase.yaml | 9 +-------- tests/drivers/clock_control/onoff/testcase.yaml | 2 +- 5 files changed, 3 insertions(+), 13 deletions(-) delete mode 100644 tests/drivers/clock_control/clock_control_api/boards/nrf54l20pdk_nrf54l20_cpuapp.conf diff --git a/tests/drivers/clock_control/clock_control_api/boards/nrf54l20pdk_nrf54l20_cpuapp.conf b/tests/drivers/clock_control/clock_control_api/boards/nrf54l20pdk_nrf54l20_cpuapp.conf deleted file mode 100644 index 11d42321cbc3..000000000000 --- a/tests/drivers/clock_control/clock_control_api/boards/nrf54l20pdk_nrf54l20_cpuapp.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_TEST_NRF_HF_STARTUP_TIME_US=1000 diff --git a/tests/drivers/clock_control/clock_control_api/testcase.yaml b/tests/drivers/clock_control/clock_control_api/testcase.yaml index 98f8920e162a..4a192e5e3a72 100644 --- a/tests/drivers/clock_control/clock_control_api/testcase.yaml +++ b/tests/drivers/clock_control/clock_control_api/testcase.yaml @@ -23,7 +23,6 @@ tests: - nrf9160dk/nrf9160 - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: @@ -35,7 +34,6 @@ tests: - nrf52840dk/nrf52840 - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: diff --git a/tests/drivers/clock_control/nrf_clock_calibration/testcase.yaml b/tests/drivers/clock_control/nrf_clock_calibration/testcase.yaml index 3cdc785cbc74..4600202f0f1b 100644 --- a/tests/drivers/clock_control/nrf_clock_calibration/testcase.yaml +++ b/tests/drivers/clock_control/nrf_clock_calibration/testcase.yaml @@ -1,5 +1,6 @@ tests: drivers.clock.nrf5_clock_calibration: + timeout: 30 tags: - drivers - clock_control @@ -9,7 +10,6 @@ tests: - nrf52840dk/nrf52840 - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: diff --git a/tests/drivers/clock_control/nrf_lf_clock_start/testcase.yaml b/tests/drivers/clock_control/nrf_lf_clock_start/testcase.yaml index 94cc046d6963..2a4bba57a711 100644 --- a/tests/drivers/clock_control/nrf_lf_clock_start/testcase.yaml +++ b/tests/drivers/clock_control/nrf_lf_clock_start/testcase.yaml @@ -4,6 +4,7 @@ common: - clock_control integration_platforms: - nrf51dk/nrf51822 + timeout: 30 tests: drivers.clock.nrf_lf_clock_start_xtal_stable: platform_allow: @@ -15,7 +16,6 @@ tests: - nrf5340dk/nrf5340/cpunet - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp extra_configs: @@ -34,7 +34,6 @@ tests: - nrf5340dk/nrf5340/cpunet - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp extra_configs: @@ -68,7 +67,6 @@ tests: - nrf5340dk/nrf5340/cpunet - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: @@ -86,7 +84,6 @@ tests: - nrf5340dk/nrf5340/cpunet - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: @@ -104,7 +101,6 @@ tests: - nrf5340dk/nrf5340/cpunet - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: @@ -122,7 +118,6 @@ tests: - nrf5340dk/nrf5340/cpunet - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: @@ -140,7 +135,6 @@ tests: - nrf5340dk/nrf5340/cpunet - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: @@ -158,7 +152,6 @@ tests: - nrf5340dk/nrf5340/cpunet - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: diff --git a/tests/drivers/clock_control/onoff/testcase.yaml b/tests/drivers/clock_control/onoff/testcase.yaml index 51c263dad29a..c26eeca5e3d1 100644 --- a/tests/drivers/clock_control/onoff/testcase.yaml +++ b/tests/drivers/clock_control/onoff/testcase.yaml @@ -9,9 +9,9 @@ tests: - nrf52840dk/nrf52840 - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - nrf9160dk/nrf9160 - ophelia4ev/nrf54l15/cpuapp integration_platforms: - nrf51dk/nrf51822 + timeout: 30 From aa5352afba7a4843dbb0f9f36974d5b30ad850a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Fri, 18 Jul 2025 14:21:27 +0200 Subject: [PATCH 0322/2141] [nrf fromtree] tests: kernel: timer: timer_behavior: Fix max_stddev calculation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit max_stddev calculation was previously patched to be more at least 1 system clock cycle to cover for platforms that use higher frequency system clock (32kHz). On that platform (nRF52) system clock frequency was the same as tick frequency but on nRF54x that is no longer true. Initially, the intention was to use 1 system tick and not cycle. Fixing it now. Signed-off-by: Krzysztof Chruściński (cherry picked from commit 26fe43dd363838e6cfe9c928e72c2af481b84e47) --- tests/kernel/timer/timer_behavior/src/jitter_drift.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/kernel/timer/timer_behavior/src/jitter_drift.c b/tests/kernel/timer/timer_behavior/src/jitter_drift.c index 82e178fb6020..c3e06b024688 100644 --- a/tests/kernel/timer/timer_behavior/src/jitter_drift.c +++ b/tests/kernel/timer/timer_behavior/src/jitter_drift.c @@ -237,8 +237,8 @@ static void do_test_using(void (*sample_collection_fn)(void), const char *mechan - expected_time_drift_us; double time_diff_us_abs = time_diff_us >= 0.0 ? time_diff_us : -time_diff_us; - /* If max stddev is lower than a single clock cycle then round it up. */ - uint32_t max_stddev = MAX(k_cyc_to_us_ceil32(1), CONFIG_TIMER_TEST_MAX_STDDEV); + /* If max stddev is lower than a single clock tick then round it up. */ + uint32_t max_stddev = MAX(k_ticks_to_us_ceil32(1), CONFIG_TIMER_TEST_MAX_STDDEV); TC_PRINT("timer clock rate %u, kernel tick rate %d\n", sys_clock_hw_cycles_per_sec(), CONFIG_SYS_CLOCK_TICKS_PER_SEC); From 424e7a54749ab3564bfdbebc24d047294771f087 Mon Sep 17 00:00:00 2001 From: Travis Lam Date: Fri, 13 Jun 2025 17:57:44 +0200 Subject: [PATCH 0323/2141] [nrf fromtree] drivers: flash: nordic: Introduce nrf_mramc driver Add SHIM layer for nrfx_mramc driver for zephyr Signed-off-by: Travis Lam (cherry picked from commit f94a45c27616622642dd0edbeada24302799d4d4) --- drivers/flash/CMakeLists.txt | 1 + drivers/flash/Kconfig | 1 + drivers/flash/Kconfig.nrf_mramc | 26 +++ drivers/flash/soc_flash_nrf_mramc.c | 221 ++++++++++++++++++ .../flash_controller/nordic,nrf-mramc.yaml | 16 ++ modules/hal_nordic/nrfx/CMakeLists.txt | 1 + modules/hal_nordic/nrfx/Kconfig | 4 + modules/hal_nordic/nrfx/Kconfig.logging | 4 + modules/hal_nordic/nrfx/nrfx_kconfig.h | 7 + 9 files changed, 281 insertions(+) create mode 100644 drivers/flash/Kconfig.nrf_mramc create mode 100644 drivers/flash/soc_flash_nrf_mramc.c create mode 100644 dts/bindings/flash_controller/nordic,nrf-mramc.yaml diff --git a/drivers/flash/CMakeLists.txt b/drivers/flash/CMakeLists.txt index b72aa37a3608..9c82932b5243 100644 --- a/drivers/flash/CMakeLists.txt +++ b/drivers/flash/CMakeLists.txt @@ -53,6 +53,7 @@ zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_MAX32 flash_max32.c) zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_MCUX soc_flash_mcux.c) zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_NRF soc_flash_nrf.c) zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_NRF_MRAM soc_flash_nrf_mram.c) +zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_NRF_MRAMC soc_flash_nrf_mramc.c) zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_NRF_RRAM soc_flash_nrf_rram.c) zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_NUMAKER soc_flash_numaker.c) zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_NUMAKER_RMC soc_flash_numaker_rmc.c) diff --git a/drivers/flash/Kconfig b/drivers/flash/Kconfig index cfa34d3e1c41..8e18b2deef69 100644 --- a/drivers/flash/Kconfig +++ b/drivers/flash/Kconfig @@ -186,6 +186,7 @@ source "drivers/flash/Kconfig.nordic_qspi_nor" source "drivers/flash/Kconfig.npcx_fiu" source "drivers/flash/Kconfig.nrf" source "drivers/flash/Kconfig.nrf_mram" +source "drivers/flash/Kconfig.nrf_mramc" source "drivers/flash/Kconfig.nrf_rram" source "drivers/flash/Kconfig.numaker" source "drivers/flash/Kconfig.numaker_rmc" diff --git a/drivers/flash/Kconfig.nrf_mramc b/drivers/flash/Kconfig.nrf_mramc new file mode 100644 index 000000000000..1637baec8969 --- /dev/null +++ b/drivers/flash/Kconfig.nrf_mramc @@ -0,0 +1,26 @@ +# +# Copyright (c) 2025 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 +# + +config SOC_FLASH_NRF_MRAMC + bool "Nordic Semiconductor flash driver for MRAM using MRAM Controller" + default y + depends on DT_HAS_NORDIC_NRF_MRAMC_ENABLED + select NRFX_MRAMC + select FLASH_HAS_DRIVER_ENABLED + select FLASH_HAS_PAGE_LAYOUT + select FLASH_HAS_NO_EXPLICIT_ERASE + select SOC_FLASH_NRF_MRAMC_FLUSH_CACHE + imply MPU_ALLOW_FLASH_WRITE if ARM_MPU + help + Enables Nordic Semiconductor flash driver for MRAMC in direct write mode. + +config SOC_FLASH_NRF_MRAMC_FLUSH_CACHE + bool "Invalidate MRAM cache after erase operations" + default y + depends on SOC_FLASH_NRF_MRAMC + help + Enables invalidation of the MRAM cache after write and erase operations to + ensure data read consistency. diff --git a/drivers/flash/soc_flash_nrf_mramc.c b/drivers/flash/soc_flash_nrf_mramc.c new file mode 100644 index 000000000000..c08f8f32851c --- /dev/null +++ b/drivers/flash/soc_flash_nrf_mramc.c @@ -0,0 +1,221 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + + #include + + #include + #include + #include + #if defined(CONFIG_SOC_FLASH_NRF_MRAMC_FLUSH_CACHE) + #include + #endif + +LOG_MODULE_REGISTER(flash_nrf_mramc, CONFIG_FLASH_LOG_LEVEL); + +#define DT_DRV_COMPAT nordic_nrf_mramc + +#define _ADD_SIZE(node_id) + DT_REG_SIZE(node_id) +#define _WBS(node_id) DT_PROP(node_id, write_block_size), +#define _EBS(node_id) DT_PROP(node_id, erase_block_size), + +#define MRAM_SIZE (0 DT_INST_FOREACH_CHILD_STATUS_OKAY(0, _ADD_SIZE)) +#define ERASE_VALUE (uint8_t)NRFY_MRAMC_WORD_AFTER_ERASED + +/* Use DT_FOREACH_CHILD_STATUS_OKAY of mramc with _FIRST() helper + * macro to get the write block size and erase block size from + * the first child node. + */ +#define WBS_LIST DT_INST_FOREACH_CHILD_STATUS_OKAY(0, _WBS) +#define EBS_LIST DT_INST_FOREACH_CHILD_STATUS_OKAY(0, _EBS) + +#define _FIRST_HELPER(first, ...) first +#define _FIRST(...) _FIRST_HELPER(__VA_ARGS__) + +#define WRITE_BLOCK_SIZE _FIRST(WBS_LIST) +#define ERASE_BLOCK_SIZE _FIRST(EBS_LIST) + +BUILD_ASSERT((ERASE_BLOCK_SIZE % WRITE_BLOCK_SIZE) == 0, + "erase-block-size expected to be a multiple of write-block-size"); + +/** + * @param[in] addr Address of mram memory. + * @param[in] len Number of bytes for the intended operation. + * @param[in] must_align Require MRAM word alignment, if applicable. + * + * @return true if the address and length are valid, false otherwise. + */ +static bool validate_action(uint32_t addr, size_t len, bool must_align) +{ + if (!nrfx_mramc_valid_address_check(addr, true)) { + LOG_ERR("Invalid address: %x", addr); + return false; + } + + if (!nrfx_mramc_fits_memory_check(addr, true, len)) { + LOG_ERR("Address %x with length %zu exceeds MRAM size", addr, len); + return false; + } + + if (must_align && !(nrfx_is_word_aligned((void const *)addr))) { + LOG_ERR("Address %x is not word aligned", addr); + return false; + } + + return true; +} + +static int nrf_mramc_read(const struct device *dev, off_t offset, void *data, size_t len) +{ + ARG_UNUSED(dev); + uint32_t addr = NRFX_MRAMC_MAP_TO_ADDR(offset); + + if (data == NULL) { + LOG_ERR("Data pointer is NULL"); + return -EINVAL; + } + + /* Validate addr and length in the range */ + if (!validate_action(addr, len, false)) { + return -EINVAL; + } + + LOG_DBG("read: %x:%zu", addr, len); + + /* Buffer read number of bytes and store in data pointer. + */ + nrfx_mramc_buffer_read(data, addr, len); + return 0; +} + +static int nrf_mramc_write(const struct device *dev, off_t offset, + const void *data, size_t len) +{ + ARG_UNUSED(dev); + uint32_t addr = NRFX_MRAMC_MAP_TO_ADDR(offset); + + if (data == NULL) { + LOG_ERR("Data pointer is NULL"); + return -EINVAL; + } + + /* Validate addr and length in the range */ + if (!validate_action(addr, len, true)) { + return -EINVAL; + } + + LOG_DBG("write: %x:%zu", addr, len); + + /* Words write function takes second argument as number of write blocks + * and not number of bytes + */ + nrfx_mramc_words_write(addr, data, len / WRITE_BLOCK_SIZE); +#if defined(CONFIG_SOC_FLASH_NRF_MRAMC_FLUSH_CACHE) + if (nrf_cache_enable_check(NRF_ICACHE)) { + while (nrf_cache_busy_check(NRF_ICACHE)) { + } + nrf_cache_invalidate(NRF_ICACHE); + } +#endif + return 0; +} + +static int nrf_mramc_erase(const struct device *dev, off_t offset, size_t size) +{ + ARG_UNUSED(dev); + uint32_t addr = NRFX_MRAMC_MAP_TO_ADDR(offset); + + /* Validate addr and length in the range */ + if (size == 0) { + LOG_DBG("No data to erase"); + return 0; + } + + if (!validate_action(addr, size, true)) { + return -EINVAL; + } + + LOG_DBG("erase: %p:%zu", (void *)addr, size); + + /* Erase function takes second argument as number of write blocks + * and not number of bytes + */ + nrfx_mramc_area_erase(addr, size / WRITE_BLOCK_SIZE); +#if defined(CONFIG_SOC_FLASH_NRF_MRAMC_FLUSH_CACHE) + if (nrf_cache_enable_check(NRF_ICACHE)) { + while (nrf_cache_busy_check(NRF_ICACHE)) { + } + nrf_cache_invalidate(NRF_ICACHE); + } +#endif + return 0; +} + +static int nrf_mramc_get_size(const struct device *dev, uint64_t *size) +{ + ARG_UNUSED(dev); + *size = nrfx_mramc_memory_size_get(); + return 0; +} + +static const struct flash_parameters *nrf_mramc_get_parameters(const struct device *dev) +{ + ARG_UNUSED(dev); + + static const struct flash_parameters parameters = { + .write_block_size = WRITE_BLOCK_SIZE, + .erase_value = ERASE_VALUE, + .caps = { + .no_explicit_erase = true, + }, + }; + + return ¶meters; +} + +#if defined(CONFIG_FLASH_PAGE_LAYOUT) +static void nrf_mramc_page_layout(const struct device *dev, + const struct flash_pages_layout **layout, size_t *layout_size) +{ + ARG_UNUSED(dev); + + static const struct flash_pages_layout pages_layout = { + .pages_count = MRAM_SIZE / (ERASE_BLOCK_SIZE), + .pages_size = ERASE_BLOCK_SIZE, + }; + + *layout = &pages_layout; + *layout_size = 1; +} +#endif + +static int mramc_sys_init(const struct device *dev) +{ + ARG_UNUSED(dev); + + nrfx_mramc_config_t config = NRFX_MRAMC_DEFAULT_CONFIG(); + nrfx_err_t err = nrfx_mramc_init(&config, NULL); + + if (err != NRFX_SUCCESS) { + LOG_ERR("Failed to initialize MRAMC: %d", err); + return -EIO; + } + LOG_DBG("MRAMC initialized successfully"); + return 0; +} + +static DEVICE_API(flash, nrf_mram_api) = { + .read = nrf_mramc_read, + .write = nrf_mramc_write, + .erase = nrf_mramc_erase, + .get_size = nrf_mramc_get_size, + .get_parameters = nrf_mramc_get_parameters, +#if defined(CONFIG_FLASH_PAGE_LAYOUT) + .page_layout = nrf_mramc_page_layout, +#endif +}; + +DEVICE_DT_INST_DEFINE(0, mramc_sys_init, NULL, NULL, NULL, POST_KERNEL, CONFIG_FLASH_INIT_PRIORITY, + &nrf_mram_api); diff --git a/dts/bindings/flash_controller/nordic,nrf-mramc.yaml b/dts/bindings/flash_controller/nordic,nrf-mramc.yaml new file mode 100644 index 000000000000..0afef7563b36 --- /dev/null +++ b/dts/bindings/flash_controller/nordic,nrf-mramc.yaml @@ -0,0 +1,16 @@ +# +# Copyright (c) 2025 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 +# + +description: | + Nordic MRAMC (Magnetoresistive Random Access Memory Controller) + + The Magnetoresistive random access memory controller (MRAMC) is used for writing + the internal MRAM memory, the secure information configuration registers (SICR), + and the user information configuration registers (UICR). + +compatible: "nordic,nrf-mramc" + +include: base.yaml diff --git a/modules/hal_nordic/nrfx/CMakeLists.txt b/modules/hal_nordic/nrfx/CMakeLists.txt index 1d18d708d747..35c46e235f25 100644 --- a/modules/hal_nordic/nrfx/CMakeLists.txt +++ b/modules/hal_nordic/nrfx/CMakeLists.txt @@ -135,6 +135,7 @@ zephyr_library_sources_ifdef(CONFIG_NRFX_GRTC ${SRC_DIR}/nrfx_grtc.c) zephyr_library_sources_ifdef(CONFIG_NRFX_I2S ${SRC_DIR}/nrfx_i2s.c) zephyr_library_sources_ifdef(CONFIG_NRFX_IPC ${SRC_DIR}/nrfx_ipc.c) zephyr_library_sources_ifdef(CONFIG_NRFX_LPCOMP ${SRC_DIR}/nrfx_lpcomp.c) +zephyr_library_sources_ifdef(CONFIG_NRFX_MRAMC ${SRC_DIR}/nrfx_mramc.c) zephyr_library_sources_ifdef(CONFIG_NRFX_NFCT ${SRC_DIR}/nrfx_nfct.c) zephyr_library_sources_ifdef(CONFIG_NRFX_NVMC ${SRC_DIR}/nrfx_nvmc.c) zephyr_library_sources_ifdef(CONFIG_NRFX_PDM ${SRC_DIR}/nrfx_pdm.c) diff --git a/modules/hal_nordic/nrfx/Kconfig b/modules/hal_nordic/nrfx/Kconfig index 80610599e60b..b918a2023c37 100644 --- a/modules/hal_nordic/nrfx/Kconfig +++ b/modules/hal_nordic/nrfx/Kconfig @@ -265,6 +265,10 @@ config NRFX_LPCOMP bool "LPCOMP driver" depends on $(dt_nodelabel_exists,comp) && !SOC_NRF52810 && !SOC_NRF52811 && !SOC_NRF52820 +config NRFX_MRAMC + bool "MRAMC driver" + depends on $(dt_has_compat,$(DT_COMPAT_NORDIC_NRF_MRAMC)) + config NRFX_NFCT bool "NFCT driver" depends on $(dt_nodelabel_exists,nfct) diff --git a/modules/hal_nordic/nrfx/Kconfig.logging b/modules/hal_nordic/nrfx/Kconfig.logging index 2bf247218807..322660f40d1a 100644 --- a/modules/hal_nordic/nrfx/Kconfig.logging +++ b/modules/hal_nordic/nrfx/Kconfig.logging @@ -44,6 +44,10 @@ config NRFX_LPCOMP_LOG bool "LPCOMP driver logging" depends on NRFX_LPCOMP +config NRFX_MRAMC_LOG + bool "MRAMC driver logging" + depends on NRFX_MRAMC + config NRFX_NFCT_LOG bool "NFCT driver logging" depends on NRFX_NFCT diff --git a/modules/hal_nordic/nrfx/nrfx_kconfig.h b/modules/hal_nordic/nrfx/nrfx_kconfig.h index 191855b3ff0e..5aa856f22997 100644 --- a/modules/hal_nordic/nrfx/nrfx_kconfig.h +++ b/modules/hal_nordic/nrfx/nrfx_kconfig.h @@ -239,6 +239,13 @@ #define NRFX_LPCOMP_CONFIG_LOG_ENABLED 1 #endif +#ifdef CONFIG_NRFX_MRAMC +#define NRFX_MRAMC_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_MRAMC_LOG +#define NRFX_MRAMC_CONFIG_LOG_ENABLED 1 +#endif + #ifdef CONFIG_NRFX_NFCT #define NRFX_NFCT_ENABLED 1 #endif From 96ad8409c0241431894720b6539ee28b63a8f175 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Wed, 23 Jul 2025 15:28:03 +0530 Subject: [PATCH 0324/2141] [nrf fromlist] nrf_wifi: Fix the DTS compat for nRF71 Use specific chipset for compat instead of a generic Series. Upstream PR #: 93567 Signed-off-by: Chaitanya Tata (cherry picked from commit bc6d4d7b667e68d807901fcd31413cf6aa3c0b19) --- drivers/wifi/nrf_wifi/Kconfig.nrfwifi | 2 +- modules/nrf_wifi/bus/Kconfig | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/wifi/nrf_wifi/Kconfig.nrfwifi b/drivers/wifi/nrf_wifi/Kconfig.nrfwifi index 8d414276038e..414900f581b9 100644 --- a/drivers/wifi/nrf_wifi/Kconfig.nrfwifi +++ b/drivers/wifi/nrf_wifi/Kconfig.nrfwifi @@ -6,7 +6,7 @@ # # TODO: Use DTS generated Kconfig once the board support is added -DT_COMPAT_NORDIC_WIFI71 := nordic,wifi71 +DT_COMPAT_NORDIC_WIFI71 := nordic,nrf7120 menuconfig WIFI_NRF70 bool "nRF70 driver" diff --git a/modules/nrf_wifi/bus/Kconfig b/modules/nrf_wifi/bus/Kconfig index fe6b0f345537..3fed449bb809 100644 --- a/modules/nrf_wifi/bus/Kconfig +++ b/modules/nrf_wifi/bus/Kconfig @@ -10,7 +10,7 @@ DT_COMPAT_NORDIC_NRF7001_QSPI := nordic,nrf7001-qspi DT_COMPAT_NORDIC_NRF7001_SPI := nordic,nrf7001-spi DT_COMPAT_NORDIC_NRF7000_QSPI := nordic,nrf7000-qspi DT_COMPAT_NORDIC_NRF7000_SPI := nordic,nrf7000-spi -DT_COMPAT_NORDIC_WIFI71 := nordic,wifi71 +DT_COMPAT_NORDIC_WIFI71 := nordic,nrf7120 menuconfig NRF70_BUSLIB bool "NRF70 Bus Library" From c5a57b4b22ed8b55093ea43eb97928d461570497 Mon Sep 17 00:00:00 2001 From: Kapil Bhatt Date: Mon, 21 Jul 2025 10:23:02 +0000 Subject: [PATCH 0325/2141] [nrf fromtree] hostap: Add CONFIG_HS20 Kconfig for Hotspot 2.0 The Kconfig CONFIG_HS20 was undefined in zephyr hostap. Need to add config for Hotspot 2.0 feature. Signed-off-by: Kapil Bhatt (cherry picked from commit d6c2ebd5f9375af12b1fc7db69eb81840cc4a3b6) --- modules/hostap/Kconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/hostap/Kconfig b/modules/hostap/Kconfig index 2056a43e8729..199f38d23862 100644 --- a/modules/hostap/Kconfig +++ b/modules/hostap/Kconfig @@ -564,6 +564,9 @@ config ACS config IEEE80211AC bool +config HS20 + bool + config IEEE80211R bool depends on !WIFI_NM_WPA_SUPPLICANT_CRYPTO_NONE From ae694c3e15d6fa771c6303615dab81ae4b4a3a5a Mon Sep 17 00:00:00 2001 From: Kapil Bhatt Date: Tue, 15 Jul 2025 06:51:42 +0000 Subject: [PATCH 0326/2141] [nrf fromlist] wifi: Fix fractional part of Tx rate by converting to float The Tx rate was previously stored as an integer, which caused loss of precision for rates like 8.6 Mbps or 34.4 Mbps due to integer division. The change will update data type to float. Upstream PR #: 93085 Signed-off-by: Kapil Bhatt (cherry picked from commit c714074fee99930d6a5b01496c24dceb63d516c4) --- include/zephyr/net/wifi_mgmt.h | 2 +- subsys/net/l2/wifi/wifi_shell.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index 8c6654f3ef5f..5477b6a3c0e9 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -672,7 +672,7 @@ struct wifi_iface_status { /** is TWT capable? */ bool twt_capable; /** The current 802.11 PHY TX data rate (in Mbps) */ - int current_phy_tx_rate; + float current_phy_tx_rate; }; /** @brief Wi-Fi power save parameters */ diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index af0db05855fa..346b68e1dae7 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1484,7 +1484,7 @@ static int cmd_wifi_status(const struct shell *sh, size_t argc, char *argv[]) PR("DTIM: %d\n", status.dtim_period); PR("TWT: %s\n", status.twt_capable ? "Supported" : "Not supported"); - PR("Current PHY TX rate (Mbps) : %d\n", status.current_phy_tx_rate); + PR("Current PHY TX rate (Mbps) : %.1f\n", (double)status.current_phy_tx_rate); } return 0; From c4fd75aff63a850f9e97af5da2b2b101554f0a95 Mon Sep 17 00:00:00 2001 From: Ravi Dondaputi Date: Mon, 30 Dec 2024 15:18:53 +0530 Subject: [PATCH 0327/2141] [nrf fromlist] modules: hostap: Define dedicated heap for supplicant Create dedicated heap for supplicant operations and define the heap size. Upstream PR #: 93085 Signed-off-by: Ravi Dondaputi (cherry picked from commit 4c2f1ff234b80ed9f285bc54451318be06d6e4ad) --- modules/hostap/Kconfig | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/modules/hostap/Kconfig b/modules/hostap/Kconfig index 199f38d23862..f900fea0e85e 100644 --- a/modules/hostap/Kconfig +++ b/modules/hostap/Kconfig @@ -24,6 +24,24 @@ config WIFI_NM_WPA_SUPPLICANT if WIFI_NM_WPA_SUPPLICANT +config WIFI_NM_WPA_SUPPLICANT_GLOBAL_HEAP + bool "Use Zephyr kernel heap for Wi-Fi driver" + default y + help + Enable this option to use K_HEAP for memory allocations in supplicant. + +if !WIFI_NM_WPA_SUPPLICANT_GLOBAL_HEAP +config WIFI_NM_WPA_SUPPLICANT_HEAP + int "Dedicated memory pool for wpa_supplicant" + def_int 66560 if WIFI_NM_HOSTAPD_AP + def_int 55000 if WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE && WIFI_CREDENTIALS + def_int 48000 if WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE + def_int 41808 if WIFI_NM_WPA_SUPPLICANT_AP + # 30K is mandatory, but might need more for long duration use cases + def_int 30000 +endif # !WIFI_NM_WPA_SUPPLICANT_GLOBAL_HEAP + +if WIFI_NM_WPA_SUPPLICANT_GLOBAL_HEAP config HEAP_MEM_POOL_ADD_SIZE_HOSTAP def_int 66560 if WIFI_NM_HOSTAPD_AP def_int 55000 if WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE && WIFI_CREDENTIALS @@ -31,6 +49,8 @@ config HEAP_MEM_POOL_ADD_SIZE_HOSTAP def_int 41808 if WIFI_NM_WPA_SUPPLICANT_AP # 30K is mandatory, but might need more for long duration use cases def_int 30000 +endif # WIFI_NM_WPA_SUPPLICANT_GLOBAL_HEAP + config WIFI_NM_WPA_SUPPLICANT_THREAD_STACK_SIZE int "Stack size for wpa_supplicant thread" From b1410c56652b1ab9182a3529ebc8b1add1d4a741 Mon Sep 17 00:00:00 2001 From: Triveni Danda Date: Mon, 14 Jul 2025 10:36:28 +0530 Subject: [PATCH 0328/2141] [nrf fromlist] net: l2: wifi: Refactor certificates processing code into common file Refactor certificate processing code to eliminate duplication and enable reuse across modules that require enterprise support. Upstream PR #: 93085 Signed-off-by: Triveni Danda (cherry picked from commit 13a034f828a61439ffea4719122b18c7059ee166) --- include/zephyr/net/wifi_certs.h | 38 ++ modules/hostap/Kconfig | 2 + subsys/net/l2/wifi/CMakeLists.txt | 1 + subsys/net/l2/wifi/Kconfig | 5 + subsys/net/l2/wifi/wifi_certs.c | 366 ++++++++++++++++++ subsys/net/l2/wifi/wifi_shell.c | 292 +------------- .../wifi_credentials/wifi_credentials_shell.c | 246 +----------- 7 files changed, 425 insertions(+), 525 deletions(-) create mode 100644 include/zephyr/net/wifi_certs.h create mode 100644 subsys/net/l2/wifi/wifi_certs.c diff --git a/include/zephyr/net/wifi_certs.h b/include/zephyr/net/wifi_certs.h new file mode 100644 index 000000000000..ea9e02cf104c --- /dev/null +++ b/include/zephyr/net/wifi_certs.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef WIFI_CERTS_H__ +#define WIFI_CERTS_H__ + +#include +#include +#include + +/** + * Set Wi-Fi Enterprise credentials. + * + * Sets up the required credentials for Enterprise mode in both + * Access Point and Station modes. + * + * Certificates typically used: + * - CA certificate + * - Client certificate + * - Client private key + * - Server certificate and server key (for AP mode) + * + * @param iface Network interface + * @param is_ap AP or Station mode + * + * @return 0 if ok, < 0 if error + */ +int wifi_set_enterprise_credentials(struct net_if *iface, bool is_ap); + +/** + * Clear Wi-Fi enterprise credentials + */ +void wifi_clear_enterprise_credentials(void); + +#endif /* WIFI_CERTS_H__ */ diff --git a/modules/hostap/Kconfig b/modules/hostap/Kconfig index f900fea0e85e..8e5f7d348a8a 100644 --- a/modules/hostap/Kconfig +++ b/modules/hostap/Kconfig @@ -221,6 +221,7 @@ config WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE select MBEDTLS_X509_CRL_PARSE_C select MBEDTLS_TLS_VERSION_1_2 select NOT_SECURE + select WIFI_CERTIFICATE_LIB depends on !WIFI_NM_WPA_SUPPLICANT_CRYPTO_NONE help Enable Enterprise Crypto support for WiFi. This feature @@ -329,6 +330,7 @@ config WIFI_NM_HOSTAPD_AP config WIFI_NM_HOSTAPD_CRYPTO_ENTERPRISE bool "Hostapd crypto enterprise support" + select WIFI_CERTIFICATE_LIB depends on WIFI_NM_HOSTAPD_AP if WIFI_NM_HOSTAPD_CRYPTO_ENTERPRISE diff --git a/subsys/net/l2/wifi/CMakeLists.txt b/subsys/net/l2/wifi/CMakeLists.txt index e1e9606bfd2a..63fb98fa6cf3 100644 --- a/subsys/net/l2/wifi/CMakeLists.txt +++ b/subsys/net/l2/wifi/CMakeLists.txt @@ -13,6 +13,7 @@ zephyr_library_include_directories_ifdef( ) zephyr_library_sources_ifdef(CONFIG_NET_L2_WIFI_MGMT wifi_mgmt.c) +zephyr_library_sources_ifdef(CONFIG_WIFI_CERTIFICATE_LIB wifi_certs.c) zephyr_library_sources_ifdef(CONFIG_NET_L2_WIFI_SHELL wifi_shell.c) zephyr_library_sources_ifdef(CONFIG_WIFI_NM wifi_nm.c) zephyr_library_sources_ifdef(CONFIG_NET_L2_WIFI_UTILS wifi_utils.c) diff --git a/subsys/net/l2/wifi/Kconfig b/subsys/net/l2/wifi/Kconfig index a2e029a592be..4b1d309066c3 100644 --- a/subsys/net/l2/wifi/Kconfig +++ b/subsys/net/l2/wifi/Kconfig @@ -126,6 +126,11 @@ config WIFI_ENT_IDENTITY_MAX_USERS help This option defines the maximum number of identity users allowed connection. +config WIFI_CERTIFICATE_LIB + bool + help + Enable this option to process certificates in enterprise mode. + if WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE config WIFI_SHELL_RUNTIME_CERTIFICATES diff --git a/subsys/net/l2/wifi/wifi_certs.c b/subsys/net/l2/wifi/wifi_certs.c new file mode 100644 index 000000000000..545010cbf77a --- /dev/null +++ b/subsys/net/l2/wifi/wifi_certs.c @@ -0,0 +1,366 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +LOG_MODULE_REGISTER(net_wifi_certs, CONFIG_NET_L2_WIFI_MGMT_LOG_LEVEL); + +#include +#include +#include +#include +#include +#include + +static struct wifi_enterprise_creds_params enterprise_creds_params = { 0 }; + +#ifdef CONFIG_WIFI_SHELL_RUNTIME_CERTIFICATES +#include +enum wifi_enterprise_cert_sec_tags { + WIFI_CERT_CA_SEC_TAG = 0x1020001, + WIFI_CERT_CLIENT_KEY_SEC_TAG, + WIFI_CERT_SERVER_KEY_SEC_TAG, + WIFI_CERT_CLIENT_SEC_TAG, + WIFI_CERT_SERVER_SEC_TAG, + /* Phase 2 */ + WIFI_CERT_CA_P2_SEC_TAG, + WIFI_CERT_CLIENT_KEY_P2_SEC_TAG, + WIFI_CERT_CLIENT_P2_SEC_TAG, +}; + +struct wifi_cert_data { + enum tls_credential_type type; + uint32_t sec_tag; + uint8_t **data; + size_t *len; +}; +#else +static const char ca_cert_test[] = { + #include + '\0' +}; + +static const char client_cert_test[] = { + #include + '\0' +}; + +static const char client_key_test[] = { + #include + '\0' +}; + +static const char ca_cert2_test[] = { + #include + '\0'}; + +static const char client_cert2_test[] = { + #include + '\0'}; + +static const char client_key2_test[] = { + #include + '\0'}; + +static const char server_cert_test[] = { + #include + '\0' +}; + +static const char server_key_test[] = { + #include + '\0' +}; +#endif /* CONFIG_WIFI_SHELL_RUNTIME_CERTIFICATES */ + +#ifdef CONFIG_WIFI_SHELL_RUNTIME_CERTIFICATES +static int process_certificates(struct wifi_cert_data *certs, size_t cert_count) +{ + for (size_t i = 0; i < cert_count; i++) { + int err; + size_t len = 0; + uint8_t *cert_tmp; + + err = tls_credential_get(certs[i].sec_tag, certs[i].type, NULL, &len); + if (err != -EFBIG) { + LOG_ERR("Failed to get credential tag: %d length, err: %d", + certs[i].sec_tag, err); + return err; + } + + cert_tmp = k_malloc(len); + if (!cert_tmp) { + LOG_ERR("Failed to allocate memory for credential tag: %d", + certs[i].sec_tag); + return -ENOMEM; + } + + err = tls_credential_get(certs[i].sec_tag, certs[i].type, cert_tmp, &len); + if (err) { + LOG_ERR("Failed to get credential tag: %d", certs[i].sec_tag); + k_free(cert_tmp); + return err; + } + + *certs[i].data = cert_tmp; + *certs[i].len = len; + } + + return 0; +} + +static void set_enterprise_creds_params(bool is_ap) +{ + struct wifi_cert_data certs_common[] = { + { + .type = TLS_CREDENTIAL_CA_CERTIFICATE, + .sec_tag = WIFI_CERT_CA_SEC_TAG, + .data = &enterprise_creds_params.ca_cert, + .len = &enterprise_creds_params.ca_cert_len, + }, + }; + struct wifi_cert_data certs_sta[] = { + { + .type = TLS_CREDENTIAL_PRIVATE_KEY, + .sec_tag = WIFI_CERT_CLIENT_KEY_SEC_TAG, + .data = &enterprise_creds_params.client_key, + .len = &enterprise_creds_params.client_key_len, + }, + { + .type = TLS_CREDENTIAL_PUBLIC_CERTIFICATE, + .sec_tag = WIFI_CERT_CLIENT_SEC_TAG, + .data = &enterprise_creds_params.client_cert, + .len = &enterprise_creds_params.client_cert_len, + }, + { + .type = TLS_CREDENTIAL_CA_CERTIFICATE, + .sec_tag = WIFI_CERT_CA_P2_SEC_TAG, + .data = &enterprise_creds_params.ca_cert2, + .len = &enterprise_creds_params.ca_cert2_len, + }, + { + .type = TLS_CREDENTIAL_PRIVATE_KEY, + .sec_tag = WIFI_CERT_CLIENT_KEY_P2_SEC_TAG, + .data = &enterprise_creds_params.client_key2, + .len = &enterprise_creds_params.client_key2_len, + }, + { + .type = TLS_CREDENTIAL_PUBLIC_CERTIFICATE, + .sec_tag = WIFI_CERT_CLIENT_P2_SEC_TAG, + .data = &enterprise_creds_params.client_cert2, + .len = &enterprise_creds_params.client_cert2_len, + }, + }; + + struct wifi_cert_data certs_ap[] = { + { + .type = TLS_CREDENTIAL_PUBLIC_CERTIFICATE, + .sec_tag = WIFI_CERT_SERVER_SEC_TAG, + .data = &enterprise_creds_params.server_cert, + .len = &enterprise_creds_params.server_cert_len, + }, + { + .type = TLS_CREDENTIAL_PRIVATE_KEY, + .sec_tag = WIFI_CERT_SERVER_KEY_SEC_TAG, + .data = &enterprise_creds_params.server_key, + .len = &enterprise_creds_params.server_key_len, + }, + }; + + memset(&enterprise_creds_params, 0, sizeof(struct wifi_enterprise_creds_params)); + + /* Process common certificates */ + if (process_certificates(certs_common, ARRAY_SIZE(certs_common)) != 0) { + goto cleanup; + } + + /* Process STA-specific certificates */ + if (!is_ap) { + if (process_certificates(certs_sta, ARRAY_SIZE(certs_sta)) != 0) { + goto cleanup; + } + } + + /* Process AP-specific certificates if is_ap is true */ + if (is_ap) { + if (process_certificates(certs_ap, ARRAY_SIZE(certs_ap)) != 0) { + goto cleanup; + } + } + + return; + +cleanup: + for (size_t i = 0; i < ARRAY_SIZE(certs_common); i++) { + if (certs_common[i].data) { + k_free(*certs_common[i].data); + } + } + + if (!is_ap) { + for (size_t i = 0; i < ARRAY_SIZE(certs_sta); i++) { + if (certs_sta[i].data) { + k_free(*certs_sta[i].data); + } + } + } + + if (is_ap) { + for (size_t i = 0; i < ARRAY_SIZE(certs_ap); i++) { + if (certs_ap[i].data) { + k_free(*certs_ap[i].data); + } + } + } +} + +void wifi_clear_enterprise_credentials(void) +{ + size_t i; + + const uint8_t *certs[] = { + enterprise_creds_params.ca_cert, + enterprise_creds_params.client_cert, + enterprise_creds_params.client_key, + enterprise_creds_params.server_cert, + enterprise_creds_params.server_key, + enterprise_creds_params.ca_cert2, + enterprise_creds_params.client_cert2, + enterprise_creds_params.client_key2, + }; + + for (i = 0; i < ARRAY_SIZE(certs); i++) { + k_free((void *)certs[i]); + } + memset(&enterprise_creds_params, 0, sizeof(struct wifi_enterprise_creds_params)); +} +#else +int config_process_blob(struct wpa_config *config, char *name, uint8_t *data, + uint32_t data_len) +{ + struct wpa_config_blob *blob; + + if (!data || !data_len) { + return -1; + } + + blob = os_zalloc(sizeof(*blob)); + if (blob == NULL) { + return -1; + } + + blob->data = os_zalloc(data_len); + if (blob->data == NULL) { + os_free(blob); + return -1; + } + + blob->name = os_strdup(name); + + if (blob->name == NULL) { + wpa_config_free_blob(blob); + return -1; + } + + os_memcpy(blob->data, data, data_len); + blob->len = data_len; + + wpa_config_set_blob(config, blob); + + return 0; +} + +int process_certificates(void) +{ + struct wpa_supplicant *wpa_s; + int ret; + char if_name[CONFIG_NET_INTERFACE_NAME_LEN + 1]; + struct net_if *iface = net_if_get_wifi_sta(); + + ret = net_if_get_name(iface, if_name, sizeof(if_name)); + if (!ret) { + LOG_ERR("Cannot get interface name (%d)", ret); + return -1; + } + + wpa_s = zephyr_get_handle_by_ifname(if_name); + if (!wpa_s) { + LOG_ERR("Unable to find the interface: %s, quitting", if_name); + return -1; + } + + wifi_set_enterprise_credentials(iface, 0); + + if (config_process_blob(wpa_s->conf, "ca_cert", + enterprise_creds_params.ca_cert, + enterprise_creds_params.ca_cert_len)) { + return -1; + } + + if (config_process_blob(wpa_s->conf, "client_cert", + enterprise_creds_params.client_cert, + enterprise_creds_params.client_cert_len)) { + return -1; + } + + if (config_process_blob(wpa_s->conf, "private_key", + enterprise_creds_params.client_key, + enterprise_creds_params.client_key_len)) { + return -1; + } + + return 0; +} + +static void set_enterprise_creds_params(bool is_ap) +{ + enterprise_creds_params.ca_cert = (uint8_t *)ca_cert_test; + enterprise_creds_params.ca_cert_len = ARRAY_SIZE(ca_cert_test); + + if (!is_ap) { + enterprise_creds_params.client_cert = (uint8_t *)client_cert_test; + enterprise_creds_params.client_cert_len = ARRAY_SIZE(client_cert_test); + enterprise_creds_params.client_key = (uint8_t *)client_key_test; + enterprise_creds_params.client_key_len = ARRAY_SIZE(client_key_test); + enterprise_creds_params.ca_cert2 = (uint8_t *)ca_cert2_test; + enterprise_creds_params.ca_cert2_len = ARRAY_SIZE(ca_cert2_test); + enterprise_creds_params.client_cert2 = (uint8_t *)client_cert2_test; + enterprise_creds_params.client_cert2_len = ARRAY_SIZE(client_cert2_test); + enterprise_creds_params.client_key2 = (uint8_t *)client_key2_test; + enterprise_creds_params.client_key2_len = ARRAY_SIZE(client_key2_test); + + return; + } + + enterprise_creds_params.server_cert = (uint8_t *)server_cert_test; + enterprise_creds_params.server_cert_len = ARRAY_SIZE(server_cert_test); + enterprise_creds_params.server_key = (uint8_t *)server_key_test; + enterprise_creds_params.server_key_len = ARRAY_SIZE(server_key_test); +} + +void wifi_clear_enterprise_credentials(void) +{ + /** + * No operation needed because Wi-Fi credentials + * are statically configured at build time and + * no dynamic memory needs to be freed. + */ +} +#endif /* CONFIG_WIFI_SHELL_RUNTIME_CERTIFICATES */ + +int wifi_set_enterprise_credentials(struct net_if *iface, bool is_ap) +{ +#ifdef CONFIG_WIFI_SHELL_RUNTIME_CERTIFICATES + wifi_clear_enterprise_credentials(); +#endif /* CONFIG_WIFI_SHELL_RUNTIME_CERTIFICATES */ + set_enterprise_creds_params(is_ap); + if (net_mgmt(NET_REQUEST_WIFI_ENTERPRISE_CREDS, iface, + &enterprise_creds_params, sizeof(enterprise_creds_params))) { + LOG_WRN("Set enterprise credentials failed\n"); + return -1; + } + + return 0; +} diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 346b68e1dae7..07514b53a336 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -30,67 +30,10 @@ LOG_MODULE_REGISTER(net_wifi_shell, LOG_LEVEL_INF); #include "net_shell_private.h" #include -#if defined CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE || \ - defined CONFIG_WIFI_NM_HOSTAPD_CRYPTO_ENTERPRISE -#ifdef CONFIG_WIFI_SHELL_RUNTIME_CERTIFICATES -#include -enum wifi_enterprise_cert_sec_tags { - WIFI_CERT_CA_SEC_TAG = 0x1020001, - WIFI_CERT_CLIENT_KEY_SEC_TAG, - WIFI_CERT_SERVER_KEY_SEC_TAG, - WIFI_CERT_CLIENT_SEC_TAG, - WIFI_CERT_SERVER_SEC_TAG, - /* Phase 2 */ - WIFI_CERT_CA_P2_SEC_TAG, - WIFI_CERT_CLIENT_KEY_P2_SEC_TAG, - WIFI_CERT_CLIENT_P2_SEC_TAG, -}; - -struct wifi_cert_data { - enum tls_credential_type type; - uint32_t sec_tag; - uint8_t **data; - size_t *len; -}; -#else -static const char ca_cert_test[] = { - #include - '\0' -}; - -static const char client_cert_test[] = { - #include - '\0' -}; - -static const char client_key_test[] = { - #include - '\0' -}; - -static const char ca_cert2_test[] = { - #include - '\0'}; - -static const char client_cert2_test[] = { - #include - '\0'}; -static const char client_key2_test[] = { - #include - '\0'}; - -static const char server_cert_test[] = { - #include - '\0' -}; - -static const char server_key_test[] = { - #include - '\0' -}; -#endif /* CONFIG_WIFI_SHELL_RUNTIME_CERTIFICATES */ -#endif /* CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE */ +#ifdef CONFIG_WIFI_CERTIFICATE_LIB +#include +#endif #define WIFI_SHELL_MODULE "wifi" @@ -128,12 +71,6 @@ static struct { }; uint8_t all; }; -#if defined CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE || \ - defined CONFIG_WIFI_NM_HOSTAPD_CRYPTO_ENTERPRISE -#ifdef CONFIG_WIFI_SHELL_RUNTIME_CERTIFICATES - struct wifi_enterprise_creds_params enterprise_creds_params; -#endif /* CONFIG_WIFI_SHELL_RUNTIME_CERTIFICATES */ -#endif /* CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE */ } context; static struct net_mgmt_event_callback wifi_shell_mgmt_cb; @@ -201,223 +138,6 @@ static struct net_if *get_iface(enum iface_type type, int argc, char *argv[]) return iface; } -#if defined CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE || \ - defined CONFIG_WIFI_NM_HOSTAPD_CRYPTO_ENTERPRISE -#ifdef CONFIG_WIFI_SHELL_RUNTIME_CERTIFICATES -static int process_certificates(struct wifi_cert_data *certs, size_t cert_count) -{ - for (size_t i = 0; i < cert_count; i++) { - int err; - size_t len = 0; - uint8_t *cert_tmp; - - err = tls_credential_get(certs[i].sec_tag, certs[i].type, NULL, &len); - if (err != -EFBIG) { - LOG_ERR("Failed to get credential tag: %d length, err: %d", - certs[i].sec_tag, err); - return err; - } - - cert_tmp = k_malloc(len); - if (!cert_tmp) { - LOG_ERR("Failed to allocate memory for credential tag: %d", - certs[i].sec_tag); - return -ENOMEM; - } - - err = tls_credential_get(certs[i].sec_tag, certs[i].type, cert_tmp, &len); - if (err) { - LOG_ERR("Failed to get credential tag: %d", certs[i].sec_tag); - k_free(cert_tmp); - return err; - } - - *certs[i].data = cert_tmp; - *certs[i].len = len; - } - - return 0; -} - -static void set_enterprise_creds_params(struct wifi_enterprise_creds_params *params, - bool is_ap) -{ - struct wifi_cert_data certs_common[] = { - { - .type = TLS_CREDENTIAL_CA_CERTIFICATE, - .sec_tag = WIFI_CERT_CA_SEC_TAG, - .data = ¶ms->ca_cert, - .len = ¶ms->ca_cert_len, - }, - }; - - struct wifi_cert_data certs_sta[] = { - { - .type = TLS_CREDENTIAL_PRIVATE_KEY, - .sec_tag = WIFI_CERT_CLIENT_KEY_SEC_TAG, - .data = ¶ms->client_key, - .len = ¶ms->client_key_len, - }, - { - .type = TLS_CREDENTIAL_PUBLIC_CERTIFICATE, - .sec_tag = WIFI_CERT_CLIENT_SEC_TAG, - .data = ¶ms->client_cert, - .len = ¶ms->client_cert_len, - }, - { - .type = TLS_CREDENTIAL_CA_CERTIFICATE, - .sec_tag = WIFI_CERT_CA_P2_SEC_TAG, - .data = ¶ms->ca_cert2, - .len = ¶ms->ca_cert2_len, - }, - { - .type = TLS_CREDENTIAL_PRIVATE_KEY, - .sec_tag = WIFI_CERT_CLIENT_KEY_P2_SEC_TAG, - .data = ¶ms->client_key2, - .len = ¶ms->client_key2_len, - }, - { - .type = TLS_CREDENTIAL_PUBLIC_CERTIFICATE, - .sec_tag = WIFI_CERT_CLIENT_P2_SEC_TAG, - .data = ¶ms->client_cert2, - .len = ¶ms->client_cert2_len, - }, - }; - - struct wifi_cert_data certs_ap[] = { - { - .type = TLS_CREDENTIAL_PUBLIC_CERTIFICATE, - .sec_tag = WIFI_CERT_SERVER_SEC_TAG, - .data = ¶ms->server_cert, - .len = ¶ms->server_cert_len, - }, - { - .type = TLS_CREDENTIAL_PRIVATE_KEY, - .sec_tag = WIFI_CERT_SERVER_KEY_SEC_TAG, - .data = ¶ms->server_key, - .len = ¶ms->server_key_len, - }, - }; - - memset(params, 0, sizeof(*params)); - - /* Process common certificates */ - if (process_certificates(certs_common, ARRAY_SIZE(certs_common)) != 0) { - goto cleanup; - } - - /* Process STA-specific certificates */ - if (!is_ap) { - if (process_certificates(certs_sta, ARRAY_SIZE(certs_sta)) != 0) { - goto cleanup; - } - } - - /* Process AP-specific certificates if is_ap is true */ - if (is_ap) { - if (process_certificates(certs_ap, ARRAY_SIZE(certs_ap)) != 0) { - goto cleanup; - } - } - - memcpy(&context.enterprise_creds_params, params, sizeof(*params)); - return; - -cleanup: - for (size_t i = 0; i < ARRAY_SIZE(certs_common); i++) { - if (certs_common[i].data) { - k_free(*certs_common[i].data); - } - } - - if (!is_ap) { - for (size_t i = 0; i < ARRAY_SIZE(certs_sta); i++) { - if (certs_sta[i].data) { - k_free(*certs_sta[i].data); - } - } - } - - if (is_ap) { - for (size_t i = 0; i < ARRAY_SIZE(certs_ap); i++) { - if (certs_ap[i].data) { - k_free(*certs_ap[i].data); - } - } - } -} - -static void clear_enterprise_creds_params(struct wifi_enterprise_creds_params *params) -{ - size_t i; - - if (!params) { - return; - } - - const uint8_t *certs[] = { - params->ca_cert, - params->client_cert, - params->client_key, - params->server_cert, - params->server_key, - params->ca_cert2, - params->client_cert2, - params->client_key2, - }; - - for (i = 0; i < ARRAY_SIZE(certs); i++) { - k_free((void *)certs[i]); - } - memset(params, 0, sizeof(*params)); -} -#else -static void set_enterprise_creds_params(struct wifi_enterprise_creds_params *params, - bool is_ap) -{ - params->ca_cert = (uint8_t *)ca_cert_test; - params->ca_cert_len = ARRAY_SIZE(ca_cert_test); - - if (!is_ap) { - params->client_cert = (uint8_t *)client_cert_test; - params->client_cert_len = ARRAY_SIZE(client_cert_test); - params->client_key = (uint8_t *)client_key_test; - params->client_key_len = ARRAY_SIZE(client_key_test); - params->ca_cert2 = (uint8_t *)ca_cert2_test; - params->ca_cert2_len = ARRAY_SIZE(ca_cert2_test); - params->client_cert2 = (uint8_t *)client_cert2_test; - params->client_cert2_len = ARRAY_SIZE(client_cert2_test); - params->client_key2 = (uint8_t *)client_key2_test; - params->client_key2_len = ARRAY_SIZE(client_key2_test); - - return; - } - - params->server_cert = (uint8_t *)server_cert_test; - params->server_cert_len = ARRAY_SIZE(server_cert_test); - params->server_key = (uint8_t *)server_key_test; - params->server_key_len = ARRAY_SIZE(server_key_test); -} -#endif /* CONFIG_WIFI_SHELL_RUNTIME_CERTIFICATES */ - -static int wifi_set_enterprise_creds(const struct shell *sh, struct net_if *iface, - bool is_ap) -{ - struct wifi_enterprise_creds_params params = {0}; - -#ifdef CONFIG_WIFI_SHELL_RUNTIME_CERTIFICATES - clear_enterprise_creds_params(&context.enterprise_creds_params); -#endif /* CONFIG_WIFI_SHELL_RUNTIME_CERTIFICATES */ - set_enterprise_creds_params(¶ms, is_ap); - if (net_mgmt(NET_REQUEST_WIFI_ENTERPRISE_CREDS, iface, ¶ms, sizeof(params))) { - PR_WARNING("Set enterprise credentials failed\n"); - return -1; - } - - return 0; -} -#endif - static bool parse_number(const struct shell *sh, long *param, char *str, char *pname, long min, long max) { @@ -1234,7 +954,7 @@ static int cmd_wifi_connect(const struct shell *sh, size_t argc, cnx_params.security == WIFI_SECURITY_TYPE_EAP_PEAP_GTC || cnx_params.security == WIFI_SECURITY_TYPE_EAP_TTLS_MSCHAPV2 || cnx_params.security == WIFI_SECURITY_TYPE_EAP_PEAP_TLS) { - wifi_set_enterprise_creds(sh, iface, 0); + wifi_set_enterprise_credentials(iface, 0); } #endif @@ -1278,7 +998,7 @@ static int cmd_wifi_disconnect(const struct shell *sh, size_t argc, #ifdef CONFIG_WIFI_SHELL_RUNTIME_CERTIFICATES /* Clear the certificates */ - clear_enterprise_creds_params(&context.enterprise_creds_params); + wifi_clear_enterprise_credentials(); #endif /* CONFIG_WIFI_SHELL_RUNTIME_CERTIFICATES */ return 0; @@ -2291,7 +2011,7 @@ static int cmd_wifi_ap_disable(const struct shell *sh, size_t argc, #ifdef CONFIG_WIFI_SHELL_RUNTIME_CERTIFICATES /* Clear the certificates */ - clear_enterprise_creds_params(&context.enterprise_creds_params); + wifi_clear_enterprise_credentials(); #endif /* CONFIG_WIFI_SHELL_RUNTIME_CERTIFICATES */ return 0; diff --git a/subsys/net/lib/wifi_credentials/wifi_credentials_shell.c b/subsys/net/lib/wifi_credentials/wifi_credentials_shell.c index c5b8c2a88a39..3966a2404bcb 100644 --- a/subsys/net/lib/wifi_credentials/wifi_credentials_shell.c +++ b/subsys/net/lib/wifi_credentials/wifi_credentials_shell.c @@ -22,247 +22,15 @@ #include +#ifdef CONFIG_WIFI_CERTIFICATE_LIB +#include +#endif + LOG_MODULE_REGISTER(wifi_credentials_shell, CONFIG_WIFI_CREDENTIALS_LOG_LEVEL); #define MAX_BANDS_STR_LEN 64 #define MACSTR "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx" -#ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE -#ifdef CONFIG_WIFI_CREDENTIALS_RUNTIME_CERTIFICATES -#include -enum wifi_enterprise_cert_sec_tags { - WIFI_CERT_CA_SEC_TAG = 0x1020001, - WIFI_CERT_CLIENT_KEY_SEC_TAG, - WIFI_CERT_SERVER_KEY_SEC_TAG, - WIFI_CERT_CLIENT_SEC_TAG, - WIFI_CERT_SERVER_SEC_TAG, - /* Phase 2 */ - WIFI_CERT_CA_P2_SEC_TAG, - WIFI_CERT_CLIENT_KEY_P2_SEC_TAG, - WIFI_CERT_CLIENT_P2_SEC_TAG, -}; - -struct wifi_cert_data { - enum tls_credential_type type; - uint32_t sec_tag; - uint8_t **data; - size_t *len; -}; -#else -static const char ca_cert_test[] = { - #include - '\0' -}; - -static const char client_cert_test[] = { - #include - '\0' -}; - -static const char client_key_test[] = { - #include - '\0' -}; - -static const char ca_cert2_test[] = { - #include - '\0'}; - -static const char client_cert2_test[] = { - #include - '\0'}; - -static const char client_key2_test[] = { - #include - '\0'}; -#endif /* CONFIG_WIFI_CREDENTIALS_RUNTIME_CERTIFICATES */ -#endif /* CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE */ - -#if defined CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE -#ifdef CONFIG_WIFI_CREDENTIALS_RUNTIME_CERTIFICATES - -struct wifi_enterprise_creds_params enterprise_creds_params; - -static int process_certificates(struct wifi_cert_data *certs, size_t cert_count) -{ - for (size_t i = 0; i < cert_count; i++) { - int err; - size_t len = 0; - uint8_t *cert_tmp; - - err = tls_credential_get(certs[i].sec_tag, certs[i].type, NULL, &len); - if (err != -EFBIG) { - LOG_ERR("Failed to get credential tag: %d length, err: %d", - certs[i].sec_tag, err); - return err; - } - - cert_tmp = k_malloc(len); - if (!cert_tmp) { - LOG_ERR("Failed to allocate memory for credential tag: %d", - certs[i].sec_tag); - return -ENOMEM; - } - - err = tls_credential_get(certs[i].sec_tag, certs[i].type, cert_tmp, &len); - if (err) { - LOG_ERR("Failed to get credential tag: %d", certs[i].sec_tag); - k_free(cert_tmp); - return err; - } - - *certs[i].data = cert_tmp; - *certs[i].len = len; - } - - return 0; -} - -static void set_enterprise_creds_params(struct wifi_enterprise_creds_params *params, - bool is_ap) -{ - struct wifi_cert_data certs_common[] = { - { - .type = TLS_CREDENTIAL_CA_CERTIFICATE, - .sec_tag = WIFI_CERT_CA_SEC_TAG, - .data = ¶ms->ca_cert, - .len = ¶ms->ca_cert_len, - }, - }; - - struct wifi_cert_data certs_sta[] = { - { - .type = TLS_CREDENTIAL_PRIVATE_KEY, - .sec_tag = WIFI_CERT_CLIENT_KEY_SEC_TAG, - .data = ¶ms->client_key, - .len = ¶ms->client_key_len, - }, - { - .type = TLS_CREDENTIAL_PUBLIC_CERTIFICATE, - .sec_tag = WIFI_CERT_CLIENT_SEC_TAG, - .data = ¶ms->client_cert, - .len = ¶ms->client_cert_len, - }, - { - .type = TLS_CREDENTIAL_CA_CERTIFICATE, - .sec_tag = WIFI_CERT_CA_P2_SEC_TAG, - .data = ¶ms->ca_cert2, - .len = ¶ms->ca_cert2_len, - }, - { - .type = TLS_CREDENTIAL_PRIVATE_KEY, - .sec_tag = WIFI_CERT_CLIENT_KEY_P2_SEC_TAG, - .data = ¶ms->client_key2, - .len = ¶ms->client_key2_len, - }, - { - .type = TLS_CREDENTIAL_PUBLIC_CERTIFICATE, - .sec_tag = WIFI_CERT_CLIENT_P2_SEC_TAG, - .data = ¶ms->client_cert2, - .len = ¶ms->client_cert2_len, - }, - }; - - memset(params, 0, sizeof(*params)); - - /* Process common certificates */ - if (process_certificates(certs_common, ARRAY_SIZE(certs_common)) != 0) { - goto cleanup; - } - - /* Process STA-specific certificates */ - if (!is_ap) { - if (process_certificates(certs_sta, ARRAY_SIZE(certs_sta)) != 0) { - goto cleanup; - } - } - - memcpy(&enterprise_creds_params, params, sizeof(*params)); - return; - -cleanup: - for (size_t i = 0; i < ARRAY_SIZE(certs_common); i++) { - if (certs_common[i].data) { - k_free(*certs_common[i].data); - *certs_common[i].data = NULL; - } - } - - if (!is_ap) { - for (size_t i = 0; i < ARRAY_SIZE(certs_sta); i++) { - if (certs_sta[i].data) { - k_free(*certs_sta[i].data); - *certs_sta[i].data = NULL; - } - } - } - -} - -static void clear_enterprise_creds_params(struct wifi_enterprise_creds_params *params) -{ - if (params == NULL) { - return; - } - - const uint8_t *certs[] = { - params->ca_cert, - params->client_cert, - params->client_key, - params->ca_cert2, - params->client_cert2, - params->client_key2, - }; - - for (size_t i = 0; i < ARRAY_SIZE(certs); i++) { - k_free((void *)certs[i]); - } - memset(params, 0, sizeof(*params)); -} -#else -static void set_enterprise_creds_params(struct wifi_enterprise_creds_params *params, - bool is_ap) -{ - params->ca_cert = (uint8_t *)ca_cert_test; - params->ca_cert_len = ARRAY_SIZE(ca_cert_test); - - if (!is_ap) { - params->client_cert = (uint8_t *)client_cert_test; - params->client_cert_len = ARRAY_SIZE(client_cert_test); - params->client_key = (uint8_t *)client_key_test; - params->client_key_len = ARRAY_SIZE(client_key_test); - params->ca_cert2 = (uint8_t *)ca_cert2_test; - params->ca_cert2_len = ARRAY_SIZE(ca_cert2_test); - params->client_cert2 = (uint8_t *)client_cert2_test; - params->client_cert2_len = ARRAY_SIZE(client_cert2_test); - params->client_key2 = (uint8_t *)client_key2_test; - params->client_key2_len = ARRAY_SIZE(client_key2_test); - - return; - } -} -#endif /* CONFIG_WIFI_CREDENTIALS_RUNTIME_CERTIFICATES */ - -static int wifi_set_enterprise_creds(const struct shell *sh, struct net_if *iface, - bool is_ap) -{ - struct wifi_enterprise_creds_params params = {0}; - -#ifdef CONFIG_WIFI_SHELL_RUNTIME_CERTIFICATES - clear_enterprise_creds_params(&enterprise_creds_params); -#endif /* CONFIG_WIFI_SHELL_RUNTIME_CERTIFICATES */ - - set_enterprise_creds_params(¶ms, is_ap); - - if (net_mgmt(NET_REQUEST_WIFI_ENTERPRISE_CREDS, iface, ¶ms, sizeof(params))) { - shell_warn(sh, "Set enterprise credentials failed\n"); - return -1; - } - - return 0; -} -#endif /* CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE */ - static void print_network_info(void *cb_arg, const char *ssid, size_t ssid_len) { int ret = 0; @@ -530,7 +298,7 @@ static int cmd_add_network(const struct shell *sh, size_t argc, char *argv[]) creds.header.type == WIFI_SECURITY_TYPE_EAP_PEAP_GTC || creds.header.type == WIFI_SECURITY_TYPE_EAP_TTLS_MSCHAPV2 || creds.header.type == WIFI_SECURITY_TYPE_EAP_PEAP_TLS) { - wifi_set_enterprise_creds(sh, iface, 0); + wifi_set_enterprise_credentials(iface, 0); } #endif /* CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE */ @@ -553,7 +321,7 @@ static int cmd_delete_network(const struct shell *sh, size_t argc, char *argv[]) #ifdef CONFIG_WIFI_SHELL_RUNTIME_CERTIFICATES /* Clear the certificates */ - clear_enterprise_creds_params(&enterprise_creds_params); + wifi_clear_enterprise_credentials(); #endif /* CONFIG_WIFI_SHELL_RUNTIME_CERTIFICATES */ return wifi_credentials_delete_by_ssid(argv[1], strlen(argv[1])); @@ -572,7 +340,7 @@ static int cmd_auto_connect(const struct shell *sh, size_t argc, char *argv[]) struct net_if *iface = net_if_get_wifi_sta(); #ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE - wifi_set_enterprise_creds(sh, iface, 0); + wifi_set_enterprise_credentials(iface, 0); #endif /* CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE */ int rc = net_mgmt(NET_REQUEST_WIFI_CONNECT_STORED, iface, NULL, 0); From 7a76eef93b6f5222a92fa820c39f7099465c0f05 Mon Sep 17 00:00:00 2001 From: Ajay Parida Date: Tue, 22 Jul 2025 18:54:55 +0530 Subject: [PATCH 0329/2141] [nrf fromlist] drivers: wifi: Pass the connection type Firmware needs to know the connection type to be established. use the wpa_proto field to derive the connection type. Upstream PR #: 93085 Signed-off-by: Ajay Parida (cherry picked from commit ca9dfd1403b1ea157c0f6a757fa8f204fe1bae59) --- drivers/wifi/nrf_wifi/src/wpa_supp_if.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/wifi/nrf_wifi/src/wpa_supp_if.c b/drivers/wifi/nrf_wifi/src/wpa_supp_if.c index d06f0792fa28..22aa04165507 100644 --- a/drivers/wifi/nrf_wifi/src/wpa_supp_if.c +++ b/drivers/wifi/nrf_wifi/src/wpa_supp_if.c @@ -935,6 +935,11 @@ int nrf_wifi_wpa_supp_associate(void *if_priv, struct wpa_driver_associate_param assoc_info.bss_max_idle_time = params->bss_max_idle_period; } + assoc_info.conn_type = NRF_WIFI_CONN_TYPE_OPEN; + if (!(params->key_mgmt_suite & WPA_KEY_MGMT_NONE)) { + assoc_info.conn_type = NRF_WIFI_CONN_TYPE_SECURE; + } + status = nrf_wifi_sys_fmac_assoc(rpu_ctx_zep->rpu_ctx, vif_ctx_zep->vif_idx, &assoc_info); if (status != NRF_WIFI_STATUS_SUCCESS) { From b4f0e223669f1a0ea7dca1088254455fabe43e21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Fri, 4 Jul 2025 14:53:18 +0200 Subject: [PATCH 0330/2141] [nrf fromtree] Revert "drivers: serial: nrfx_uarte: Deprecate CONFIG_UART_x_NRF_HW_ASYNC" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 384e940c6665332d06aa939de15c7fc1479e79d7. Signed-off-by: Krzysztof Chruściński (cherry picked from commit 3c9389650e2e6cbd38456d995b745fa12e672816) --- drivers/serial/Kconfig.nrfx | 2 +- drivers/serial/Kconfig.nrfx_uart_instance | 7 +------ samples/net/cellular_modem/boards/nrf9160dk_nrf52840.conf | 3 +++ .../net/cellular_modem/boards/nrf9160dk_nrf9160_ns.conf | 3 +++ .../uart_async_api/boards/nrf5340bsim_nrf5340_cpuapp.conf | 2 ++ .../uart_async_api/boards/nrf5340dk_nrf5340_cpuapp.conf | 2 ++ .../uart/uart_async_api/boards/nrf9160dk_nrf9160.conf | 2 ++ .../uart/uart_errors/boards/nrf5340dk_nrf5340_cpuapp.conf | 2 ++ tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml | 3 +++ tests/drivers/uart/uart_pm/testcase.yaml | 6 ++++++ 10 files changed, 25 insertions(+), 7 deletions(-) create mode 100644 tests/drivers/uart/uart_async_api/boards/nrf5340bsim_nrf5340_cpuapp.conf create mode 100644 tests/drivers/uart/uart_errors/boards/nrf5340dk_nrf5340_cpuapp.conf diff --git a/drivers/serial/Kconfig.nrfx b/drivers/serial/Kconfig.nrfx index f91980c058b5..8bcb9e49b662 100644 --- a/drivers/serial/Kconfig.nrfx +++ b/drivers/serial/Kconfig.nrfx @@ -60,7 +60,7 @@ config UART_NRFX_UARTE_ENHANCED_RX bool "Enhanced RX handling" depends on UART_ASYNC_API depends on UART_NRFX_UARTE_LEGACY_SHIM - default y + default y if !(UART_0_NRF_HW_ASYNC || UART_1_NRF_HW_ASYNC || UART_2_NRF_HW_ASYNC) help Enable RX handling mode which is switching buffers on timeout. This is an enhancement compared to other two modes (default and hardware assisted). diff --git a/drivers/serial/Kconfig.nrfx_uart_instance b/drivers/serial/Kconfig.nrfx_uart_instance index fa93a8144828..b1a68d691c45 100644 --- a/drivers/serial/Kconfig.nrfx_uart_instance +++ b/drivers/serial/Kconfig.nrfx_uart_instance @@ -49,23 +49,18 @@ config UART_$(nrfx_uart_num)_NRF_TX_BUFFER_SIZE particular SoC. config UART_$(nrfx_uart_num)_NRF_HW_ASYNC - bool "[DEPRECATED] Use hardware RX byte counting" + bool "Use hardware RX byte counting" depends on HAS_HW_NRF_UARTE$(nrfx_uart_num) depends on UART_ASYNC_API depends on UART_NRFX_UARTE_LEGACY_SHIM - depends on !UART_NRFX_UARTE_ENHANCED_RX depends on HAS_HW_NRF_PPI || HAS_HW_NRF_DPPIC select NRFX_GPPI - select DEPRECATED help If default driver uses interrupts to count incoming bytes, it is possible that with higher speeds and/or high cpu load some data can be lost. It is recommended to use hardware byte counting in such scenarios. Hardware RX byte counting requires timer instance and one PPI channel. - This options is deprecated. Use UART_NRFX_UARTE_ENHANCED_RX which supports - reliable byte counting without additional HW resources (TIMER and (D)PPI). - config UART_$(nrfx_uart_num)_NRF_ASYNC_LOW_POWER bool "Low power mode" depends on HAS_HW_NRF_UARTE$(nrfx_uart_num) diff --git a/samples/net/cellular_modem/boards/nrf9160dk_nrf52840.conf b/samples/net/cellular_modem/boards/nrf9160dk_nrf52840.conf index 226ce728a19a..6cf67ab5f984 100644 --- a/samples/net/cellular_modem/boards/nrf9160dk_nrf52840.conf +++ b/samples/net/cellular_modem/boards/nrf9160dk_nrf52840.conf @@ -1,6 +1,9 @@ CONFIG_UART_ASYNC_API=y CONFIG_UART_1_ASYNC=y CONFIG_UART_1_INTERRUPT_DRIVEN=n +# Enable HW RX byte counting. This especially matters at higher baud rates. +CONFIG_UART_1_NRF_HW_ASYNC=y +CONFIG_UART_1_NRF_HW_ASYNC_TIMER=1 # Align with the Serial LTE Modem (SLM) application. CONFIG_MODEM_CELLULAR_UART_BUFFER_SIZES=6000 diff --git a/samples/net/cellular_modem/boards/nrf9160dk_nrf9160_ns.conf b/samples/net/cellular_modem/boards/nrf9160dk_nrf9160_ns.conf index 907cc9baed1f..a3cfb7919db5 100644 --- a/samples/net/cellular_modem/boards/nrf9160dk_nrf9160_ns.conf +++ b/samples/net/cellular_modem/boards/nrf9160dk_nrf9160_ns.conf @@ -1,6 +1,9 @@ CONFIG_UART_ASYNC_API=y CONFIG_UART_1_ASYNC=y CONFIG_UART_1_INTERRUPT_DRIVEN=n +# Enable HW RX byte counting. This especially matters at higher baud rates. +CONFIG_UART_1_NRF_HW_ASYNC=y +CONFIG_UART_1_NRF_HW_ASYNC_TIMER=1 # Align with the Serial LTE Modem (SLM) application. CONFIG_MODEM_CELLULAR_UART_BUFFER_SIZES=6000 diff --git a/tests/drivers/uart/uart_async_api/boards/nrf5340bsim_nrf5340_cpuapp.conf b/tests/drivers/uart/uart_async_api/boards/nrf5340bsim_nrf5340_cpuapp.conf new file mode 100644 index 000000000000..e7a460fde6bb --- /dev/null +++ b/tests/drivers/uart/uart_async_api/boards/nrf5340bsim_nrf5340_cpuapp.conf @@ -0,0 +1,2 @@ +CONFIG_UART_1_NRF_HW_ASYNC_TIMER=1 +CONFIG_UART_NRFX_UARTE_ENHANCED_RX=y diff --git a/tests/drivers/uart/uart_async_api/boards/nrf5340dk_nrf5340_cpuapp.conf b/tests/drivers/uart/uart_async_api/boards/nrf5340dk_nrf5340_cpuapp.conf index d70069646c93..396d23ba5ae3 100644 --- a/tests/drivers/uart/uart_async_api/boards/nrf5340dk_nrf5340_cpuapp.conf +++ b/tests/drivers/uart/uart_async_api/boards/nrf5340dk_nrf5340_cpuapp.conf @@ -1 +1,3 @@ +CONFIG_UART_1_NRF_HW_ASYNC=y +CONFIG_UART_1_NRF_HW_ASYNC_TIMER=1 CONFIG_VAR_LENGTH_BUFFER_TEST_BUADRATE_LIMIT=57600 diff --git a/tests/drivers/uart/uart_async_api/boards/nrf9160dk_nrf9160.conf b/tests/drivers/uart/uart_async_api/boards/nrf9160dk_nrf9160.conf index 83e126780f99..4f738f955e10 100644 --- a/tests/drivers/uart/uart_async_api/boards/nrf9160dk_nrf9160.conf +++ b/tests/drivers/uart/uart_async_api/boards/nrf9160dk_nrf9160.conf @@ -1,2 +1,4 @@ CONFIG_ARM_MPU=n CONFIG_VAR_LENGTH_BUFFER_TEST_BUADRATE_LIMIT=57600 +CONFIG_UART_1_NRF_HW_ASYNC=y +CONFIG_UART_1_NRF_HW_ASYNC_TIMER=2 diff --git a/tests/drivers/uart/uart_errors/boards/nrf5340dk_nrf5340_cpuapp.conf b/tests/drivers/uart/uart_errors/boards/nrf5340dk_nrf5340_cpuapp.conf new file mode 100644 index 000000000000..025b92361475 --- /dev/null +++ b/tests/drivers/uart/uart_errors/boards/nrf5340dk_nrf5340_cpuapp.conf @@ -0,0 +1,2 @@ +CONFIG_UART_1_NRF_HW_ASYNC=y +CONFIG_UART_1_NRF_HW_ASYNC_TIMER=1 diff --git a/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml b/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml index a901abda9e43..1ad54eb0dc5b 100644 --- a/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml +++ b/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml @@ -78,6 +78,9 @@ tests: - CONFIG_UART_0_INTERRUPT_DRIVEN=n - CONFIG_UART_0_ASYNC=y - CONFIG_UART_0_ENHANCED_POLL_OUT=y + - CONFIG_UART_0_NRF_HW_ASYNC=y + - CONFIG_UART_0_NRF_HW_ASYNC_TIMER=2 + - CONFIG_NRFX_TIMER2=y platform_allow: - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp diff --git a/tests/drivers/uart/uart_pm/testcase.yaml b/tests/drivers/uart/uart_pm/testcase.yaml index 9bb360677577..8385db6bf866 100644 --- a/tests/drivers/uart/uart_pm/testcase.yaml +++ b/tests/drivers/uart/uart_pm/testcase.yaml @@ -82,6 +82,9 @@ tests: - CONFIG_UART_INTERRUPT_DRIVEN=n - CONFIG_UART_ASYNC_API=y - CONFIG_UART_0_ASYNC=y + - CONFIG_UART_0_NRF_HW_ASYNC=y + - CONFIG_UART_0_NRF_HW_ASYNC_TIMER=2 + - CONFIG_NRFX_TIMER2=y - CONFIG_UART_0_ENHANCED_POLL_OUT=n drivers.uart.pm.async.enhanced_poll: @@ -89,6 +92,9 @@ tests: - CONFIG_UART_INTERRUPT_DRIVEN=n - CONFIG_UART_ASYNC_API=y - CONFIG_UART_0_ASYNC=y + - CONFIG_UART_0_NRF_HW_ASYNC=y + - CONFIG_UART_0_NRF_HW_ASYNC_TIMER=2 + - CONFIG_NRFX_TIMER2=y - CONFIG_UART_0_ENHANCED_POLL_OUT=y platform_exclude: - nrf54l09pdk/nrf54l09/cpuapp From aea9e183d4168ddf5994ab74759ba48b141621de Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Wed, 25 Jun 2025 15:00:04 +0200 Subject: [PATCH 0331/2141] [nrf fromtree] tests/drivers/uart/: Add overlays for the nrf54lm20bsim This target can also run this tests, we just overlays including the ones for the real boards. Signed-off-by: Alberto Escolar Piedras (cherry picked from commit ebd69cac45feb037f89ec0be0d21cd00f73e1a99) --- .../boards/nrf54lm20bsim_nrf54lm20a_cpuapp.overlay | 3 +++ .../boards/nrf54lm20bsim_nrf54lm20a_cpuapp.overlay | 7 +++++++ tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml | 1 + .../uart_pm/boards/nrf54lm20bsim_nrf54lm20a_cpuapp.overlay | 3 +++ tests/drivers/uart/uart_pm/testcase.yaml | 2 ++ 5 files changed, 16 insertions(+) create mode 100644 tests/drivers/uart/uart_async_api/boards/nrf54lm20bsim_nrf54lm20a_cpuapp.overlay create mode 100644 tests/drivers/uart/uart_mix_fifo_poll/boards/nrf54lm20bsim_nrf54lm20a_cpuapp.overlay create mode 100644 tests/drivers/uart/uart_pm/boards/nrf54lm20bsim_nrf54lm20a_cpuapp.overlay diff --git a/tests/drivers/uart/uart_async_api/boards/nrf54lm20bsim_nrf54lm20a_cpuapp.overlay b/tests/drivers/uart/uart_async_api/boards/nrf54lm20bsim_nrf54lm20a_cpuapp.overlay new file mode 100644 index 000000000000..aef400ac2b1f --- /dev/null +++ b/tests/drivers/uart/uart_async_api/boards/nrf54lm20bsim_nrf54lm20a_cpuapp.overlay @@ -0,0 +1,3 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +#include "nrf54lm20dk_nrf54lm20a_cpuapp.overlay" diff --git a/tests/drivers/uart/uart_mix_fifo_poll/boards/nrf54lm20bsim_nrf54lm20a_cpuapp.overlay b/tests/drivers/uart/uart_mix_fifo_poll/boards/nrf54lm20bsim_nrf54lm20a_cpuapp.overlay new file mode 100644 index 000000000000..8e7299a0d758 --- /dev/null +++ b/tests/drivers/uart/uart_mix_fifo_poll/boards/nrf54lm20bsim_nrf54lm20a_cpuapp.overlay @@ -0,0 +1,7 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "nrf54lm20dk_nrf54lm20a_cpuapp.overlay" diff --git a/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml b/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml index 1ad54eb0dc5b..5a85af65735e 100644 --- a/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml +++ b/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml @@ -13,6 +13,7 @@ common: - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp + - nrf54lm20bsim/nrf54lm20a/cpuapp - nrf54l15bsim/nrf54l15/cpuapp - nrf54h20dk/nrf54h20/cpuapp - nrf54h20dk/nrf54h20/cpurad diff --git a/tests/drivers/uart/uart_pm/boards/nrf54lm20bsim_nrf54lm20a_cpuapp.overlay b/tests/drivers/uart/uart_pm/boards/nrf54lm20bsim_nrf54lm20a_cpuapp.overlay new file mode 100644 index 000000000000..aef400ac2b1f --- /dev/null +++ b/tests/drivers/uart/uart_pm/boards/nrf54lm20bsim_nrf54lm20a_cpuapp.overlay @@ -0,0 +1,3 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +#include "nrf54lm20dk_nrf54lm20a_cpuapp.overlay" diff --git a/tests/drivers/uart/uart_pm/testcase.yaml b/tests/drivers/uart/uart_pm/testcase.yaml index 8385db6bf866..767e56b45926 100644 --- a/tests/drivers/uart/uart_pm/testcase.yaml +++ b/tests/drivers/uart/uart_pm/testcase.yaml @@ -9,6 +9,7 @@ common: - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp + - nrf54lm20bsim/nrf54lm20a/cpuapp - nrf54l15bsim/nrf54l15/cpuapp - nrf54h20dk/nrf54h20/cpuapp - nrf52_bsim @@ -37,6 +38,7 @@ tests: - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp + - nrf54lm20bsim/nrf54lm20a/cpuapp - nrf54l15bsim/nrf54l15/cpuapp - nrf54h20dk/nrf54h20/cpuapp - nrf52_bsim From 096eef02e4213cc668a08ba62670f393778f0c6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Wed, 9 Jul 2025 14:41:26 +0200 Subject: [PATCH 0332/2141] [nrf fromtree] tests: drivers: uart: uart_pm: Cleanup after nRF54LM20 rename MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove duplicated test configuration after nrf54l20pdk/nrf54l20/cpuxxx was renamed to nrf54lm20dk/nrf54lm20a/cpuxxx. Signed-off-by: Sebastian Głąb (cherry picked from commit f0c143eace6e7c9cc2f7d13addc6c5059a46425d) --- .../nrf54l20pdk_nrf54l20_cpuapp.overlay | 36 ------------------- tests/drivers/uart/uart_pm/testcase.yaml | 27 ++++++-------- 2 files changed, 11 insertions(+), 52 deletions(-) delete mode 100644 tests/drivers/uart/uart_pm/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay diff --git a/tests/drivers/uart/uart_pm/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/tests/drivers/uart/uart_pm/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay deleted file mode 100644 index 033aab401ac0..000000000000 --- a/tests/drivers/uart/uart_pm/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&pinctrl { - uart21_default: uart21_default { - group1 { - psels = , - ; - }; - }; - - uart21_sleep: uart21_sleep { - group1 { - psels = , - ; - low-power-enable; - }; - }; -}; - -/ { - chosen { - zephyr,console = &uart20; - }; -}; - -dut: &uart21 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart21_default>; - pinctrl-1 = <&uart21_sleep>; - pinctrl-names = "default", "sleep"; -}; diff --git a/tests/drivers/uart/uart_pm/testcase.yaml b/tests/drivers/uart/uart_pm/testcase.yaml index 767e56b45926..d775e30ae71d 100644 --- a/tests/drivers/uart/uart_pm/testcase.yaml +++ b/tests/drivers/uart/uart_pm/testcase.yaml @@ -4,16 +4,15 @@ common: - uart harness: ztest platform_allow: + - nrf52_bsim - nrf52840dk/nrf52840 + - nrf5340bsim/nrf5340/cpuapp + - nrf54h20dk/nrf54h20/cpuapp - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf54l20pdk/nrf54l20/cpuapp + - nrf54l15bsim/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - nrf54lm20bsim/nrf54lm20a/cpuapp - - nrf54l15bsim/nrf54l15/cpuapp - - nrf54h20dk/nrf54h20/cpuapp - - nrf52_bsim - - nrf5340bsim/nrf5340/cpuapp - ophelia4ev/nrf54l15/cpuapp harness_config: fixture: gpio_loopback @@ -34,15 +33,14 @@ tests: - CONFIG_UART_0_ENHANCED_POLL_OUT=n extra_args: DTC_OVERLAY_FILE="boards/nrf52840dk_nrf52840.overlay;nrf_rx_disable.overlay" platform_exclude: + - nrf52_bsim + - nrf5340bsim/nrf5340/cpuapp + - nrf54h20dk/nrf54h20/cpuapp - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf54l20pdk/nrf54l20/cpuapp + - nrf54l15bsim/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - nrf54lm20bsim/nrf54lm20a/cpuapp - - nrf54l15bsim/nrf54l15/cpuapp - - nrf54h20dk/nrf54h20/cpuapp - - nrf52_bsim - - nrf5340bsim/nrf5340/cpuapp - ophelia4ev/nrf54l15/cpuapp drivers.uart.pm.enhanced_poll: @@ -51,11 +49,10 @@ tests: - CONFIG_UART_ASYNC_API=n - CONFIG_UART_0_ENHANCED_POLL_OUT=y platform_exclude: + - nrf54h20dk/nrf54h20/cpuapp - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - - nrf54h20dk/nrf54h20/cpuapp - ophelia4ev/nrf54l15/cpuapp drivers.uart.pm.int_driven: @@ -72,11 +69,10 @@ tests: - CONFIG_UART_ASYNC_API=n - CONFIG_UART_0_ENHANCED_POLL_OUT=y platform_exclude: + - nrf54h20dk/nrf54h20/cpuapp - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - - nrf54h20dk/nrf54h20/cpuapp - ophelia4ev/nrf54l15/cpuapp drivers.uart.pm.async: @@ -99,9 +95,8 @@ tests: - CONFIG_NRFX_TIMER2=y - CONFIG_UART_0_ENHANCED_POLL_OUT=y platform_exclude: + - nrf54h20dk/nrf54h20/cpuapp - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - - nrf54h20dk/nrf54h20/cpuapp - ophelia4ev/nrf54l15/cpuapp From a8f8ee87de2906fccb6e9954b71c68908a9d0b29 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Fri, 13 Jun 2025 17:15:46 +0200 Subject: [PATCH 0333/2141] [nrf fromtree] boards nrf_bsim: Add a new nrf54lm20bsim target Add a new simulated nrf54lm20 cpuapp target Signed-off-by: Alberto Escolar Piedras (cherry picked from commit 542874333ce0536d4837358780716dd979711f1d) --- boards/native/nrf_bsim/Kconfig | 10 ++ boards/native/nrf_bsim/Kconfig.nrf54lm20bsim | 5 + boards/native/nrf_bsim/board.yml | 5 + boards/native/nrf_bsim/board_soc.h | 2 +- .../nrf54lm20bsim_nrf54lm20a_cpuapp.dts | 144 ++++++++++++++++++ .../nrf54lm20bsim_nrf54lm20a_cpuapp.yaml | 17 +++ .../nrf54lm20bsim_nrf54lm20a_cpuapp_defconfig | 8 + modules/hal_nordic/nrfx/CMakeLists.txt | 2 + 8 files changed, 192 insertions(+), 1 deletion(-) create mode 100644 boards/native/nrf_bsim/Kconfig.nrf54lm20bsim create mode 100644 boards/native/nrf_bsim/nrf54lm20bsim_nrf54lm20a_cpuapp.dts create mode 100644 boards/native/nrf_bsim/nrf54lm20bsim_nrf54lm20a_cpuapp.yaml create mode 100644 boards/native/nrf_bsim/nrf54lm20bsim_nrf54lm20a_cpuapp_defconfig diff --git a/boards/native/nrf_bsim/Kconfig b/boards/native/nrf_bsim/Kconfig index a8865941d741..3596ccec0240 100644 --- a/boards/native/nrf_bsim/Kconfig +++ b/boards/native/nrf_bsim/Kconfig @@ -45,6 +45,16 @@ config BOARD_NRF54L15BSIM_NRF54L15_CPUAPP Will produce a console Linux process which can be executed natively. It needs the BabbleSim simulator both in compile time and to execute +config BOARD_NRF54LM20BSIM_NRF54LM20A_CPUAPP + bool + select SOC_SERIES_BSIM_NRF54LX + select SOC_COMPATIBLE_NRF54LM20A + select SOC_COMPATIBLE_NRF54LM20A_CPUAPP + select CLOCK_CONTROL + help + Simulated NRF54LM20 Application core + Will produce a console Linux process which can be executed natively. + It needs the BabbleSim simulator both in compile time and to execute if SOC_SERIES_BSIM_NRFXX diff --git a/boards/native/nrf_bsim/Kconfig.nrf54lm20bsim b/boards/native/nrf_bsim/Kconfig.nrf54lm20bsim new file mode 100644 index 000000000000..f5d8f6400971 --- /dev/null +++ b/boards/native/nrf_bsim/Kconfig.nrf54lm20bsim @@ -0,0 +1,5 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_NRF54LM20BSIM + select SOC_POSIX diff --git a/boards/native/nrf_bsim/board.yml b/boards/native/nrf_bsim/board.yml index 0ba40b336773..0a94a177d500 100644 --- a/boards/native/nrf_bsim/board.yml +++ b/boards/native/nrf_bsim/board.yml @@ -14,5 +14,10 @@ boards: vendor: zephyr socs: - name: nrf54l15 +- name: nrf54lm20bsim + full_name: nRF54LM20 simulated boards (BabbleSim) + vendor: zephyr + socs: + - name: nrf54lm20a # Note the 53 and 54 are referring to the real SOC yamls, but we only use their name and cpu-cluster # definitions. In practice these board uses the same native SOC (SOC_POSIX) as the nrf52_bsim diff --git a/boards/native/nrf_bsim/board_soc.h b/boards/native/nrf_bsim/board_soc.h index e0b1cb60a594..ee77478caabb 100644 --- a/boards/native/nrf_bsim/board_soc.h +++ b/boards/native/nrf_bsim/board_soc.h @@ -38,7 +38,7 @@ #define OFFLOAD_SW_IRQ EGU0_IRQn #elif defined(CONFIG_BOARD_NRF5340BSIM_NRF5340_CPUNET) #define OFFLOAD_SW_IRQ SWI0_IRQn -#elif defined(CONFIG_BOARD_NRF54L15BSIM) +#elif defined(CONFIG_SOC_SERIES_BSIM_NRF54LX) #define OFFLOAD_SW_IRQ SWI00_IRQn #endif diff --git a/boards/native/nrf_bsim/nrf54lm20bsim_nrf54lm20a_cpuapp.dts b/boards/native/nrf_bsim/nrf54lm20bsim_nrf54lm20a_cpuapp.dts new file mode 100644 index 000000000000..bd424f2e15ec --- /dev/null +++ b/boards/native/nrf_bsim/nrf54lm20bsim_nrf54lm20a_cpuapp.dts @@ -0,0 +1,144 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include +#include +#include <../boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a-pinctrl.dtsi> + +/ { + model = "Nordic NRF54LM20 BSIM NRF54LM20A Application MCU"; + compatible = "bsim,nrf54lm20-bsim-nrf54lm20a-cpuapp", "bsim,nrf54"; + + chosen { + zephyr,console = &uart20; + zephyr,entropy = &rng; + zephyr,bt-c2h-uart = &uart20; + zephyr,flash-controller = &rram_controller; + zephyr,flash = &cpuapp_rram; + }; + + /delete-node/ cpus; + /delete-node/ sw-pwm; + + soc { + /delete-node/ memory@20000000; + /delete-node/ memory@20067c00; + + peripheral@50000000 { + /delete-node/ vpr@4c000; + /delete-node/ interrupt-controller@f0000000; + /delete-node/spi@4d000; + /delete-node/usbhs@5a000; + /delete-node/i2c@c6000; + /delete-node/spi@c6000; + /delete-node/i2c@c7000; + /delete-node/spi@c7000; + /delete-node/i2c@c8000; + /delete-node/spi@c8000; + /delete-node/pdm@d0000; + /delete-node/pdm@d1000; + /delete-node/pwm@d2000; + /delete-node/pwm@d3000; + /delete-node/pwm@d4000; + /delete-node/adc@d5000; + /delete-node/nfct@d6000; + /delete-node/qdec@e0000; + /delete-node/qdec@e1000; + /delete-node/tdm@e8000; + /delete-node/i2c@ed000; + /delete-node/spi@ed000; + /delete-node/i2c@ee000; + /delete-node/spi@ee000; + /delete-node/i2c@104000; + /delete-node/spi@104000; + /delete-node/comparator@106000; + /delete-node/watchdog@108000; + /delete-node/watchdog@109000; + /delete-node/regulator@120000; + }; + }; + + rng: rng { + status = "okay"; + compatible = "nordic,nrf-cracen-ctrdrbg"; + }; + + psa_rng: psa-rng { + status = "disabled"; + }; +}; + +&grtc { + owned-channels = <0 1 2 3 4 5 6 7 8 9 10 11>; + /* Channels 7-11 reserved for Zero Latency IRQs, 3-4 for FLPR */ + child-owned-channels = <3 4 7 8 9 10 11>; + status = "okay"; +}; + +&cpuapp_rram { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + storage_partition: partition@0 { + label = "storage"; + reg = <0x0 DT_SIZE_K(500)>; + }; + }; +}; + +&uart20 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart20_default>; + pinctrl-1 = <&uart20_sleep>; + pinctrl-names = "default", "sleep"; +}; + +&uart30 { + current-speed = <115200>; + pinctrl-0 = <&uart30_default>; + pinctrl-1 = <&uart30_sleep>; + pinctrl-names = "default", "sleep"; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + +&gpio2 { + status = "okay"; +}; + +&gpiote20 { + status = "okay"; +}; + +&gpiote30 { + status = "okay"; +}; + +&temp { + status = "okay"; +}; + +&radio { + status = "okay"; + /* These features are not yet supported by the RADIO model */ + /delete-property/ dfe-supported; + /delete-property/ cs-supported; +}; + +&clock { + status = "okay"; +}; diff --git a/boards/native/nrf_bsim/nrf54lm20bsim_nrf54lm20a_cpuapp.yaml b/boards/native/nrf_bsim/nrf54lm20bsim_nrf54lm20a_cpuapp.yaml new file mode 100644 index 000000000000..7941cd317ee5 --- /dev/null +++ b/boards/native/nrf_bsim/nrf54lm20bsim_nrf54lm20a_cpuapp.yaml @@ -0,0 +1,17 @@ +identifier: nrf54lm20bsim/nrf54lm20a/cpuapp +name: NRF54LM20 BabbleSim - Application Core target +type: native +arch: posix +simulation: + - name: native +env: + - BSIM_OUT_PATH +toolchain: + - zephyr +supported: + - counter + - gpio +testing: + ignore_tags: + - modem + - bsim_skip_CI diff --git a/boards/native/nrf_bsim/nrf54lm20bsim_nrf54lm20a_cpuapp_defconfig b/boards/native/nrf_bsim/nrf54lm20bsim_nrf54lm20a_cpuapp_defconfig new file mode 100644 index 000000000000..0fde4e01b583 --- /dev/null +++ b/boards/native/nrf_bsim/nrf54lm20bsim_nrf54lm20a_cpuapp_defconfig @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright (c) 2023 Nordic Semiconductor ASA + +CONFIG_CONSOLE=y +CONFIG_NO_OPTIMIZATIONS=y + +# Start SYSCOUNTER on driver init +CONFIG_NRF_GRTC_START_SYSCOUNTER=y diff --git a/modules/hal_nordic/nrfx/CMakeLists.txt b/modules/hal_nordic/nrfx/CMakeLists.txt index 35c46e235f25..d063046cfa86 100644 --- a/modules/hal_nordic/nrfx/CMakeLists.txt +++ b/modules/hal_nordic/nrfx/CMakeLists.txt @@ -66,6 +66,8 @@ zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54L20_ENGA_CPUFLPR NRF_FLPR) zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54LM20A_ENGA NRF54LM20A_ENGA_XXAA) zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54LM20A_ENGA_CPUAPP NRF_APPLICATION) zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54LM20A_ENGA_CPUFLPR NRF_FLPR) +zephyr_compile_definitions_ifdef(CONFIG_SOC_COMPATIBLE_NRF54LM20A NRF54LM20A_ENGA_XXAA) +zephyr_compile_definitions_ifdef(CONFIG_SOC_COMPATIBLE_NRF54LM20A_CPUAPP NRF_APPLICATION) zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF9120 NRF9120_XXAA) zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF9160 NRF9160_XXAA) From 8b197fdd0a5472489d603d8d3e53323d7977ed0a Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Fri, 13 Jun 2025 17:13:18 +0200 Subject: [PATCH 0334/2141] [nrf fromtree] soc: Add SOC_COMPATIBLE_NRF54LM20* options In preparation for simulated nRF54LM20 targets, let's add kconfig options aking to the ones we have for the nRF54L15 devices. Signed-off-by: Alberto Escolar Piedras (cherry picked from commit 65fb246df1c39cb18844be509e4197422d6cc21c) --- soc/Kconfig | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/soc/Kconfig b/soc/Kconfig index a1ea1f97896b..cf1bde8aa4d4 100644 --- a/soc/Kconfig +++ b/soc/Kconfig @@ -49,6 +49,12 @@ config SOC_COMPATIBLE_NRF54L15 config SOC_COMPATIBLE_NRF54L15_CPUAPP bool +config SOC_COMPATIBLE_NRF54LM20A + bool + +config SOC_COMPATIBLE_NRF54LM20A_CPUAPP + bool + config SOC_DEPRECATED_RELEASE string help From 56d98e478ea766904b728c243e0999f500b6ed22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Wed, 9 Jul 2025 14:35:56 +0200 Subject: [PATCH 0335/2141] [nrf fromtree] tests: drivers: uart: uart_mix_fifo_poll: Cleanup after nRF54LM20 rename MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove duplicated test configuration after nrf54l20pdk/nrf54l20/cpuxxx was renamed to nrf54lm20dk/nrf54lm20a/cpuxxx. Signed-off-by: Sebastian Głąb (cherry picked from commit 8791fcf34d981183afab8ab4c109ccdd4a2746e4) --- .../nrf54l20pdk_nrf54l20_cpuapp.overlay | 43 ------------------- .../uart/uart_mix_fifo_poll/testcase.yaml | 9 ++-- 2 files changed, 4 insertions(+), 48 deletions(-) delete mode 100644 tests/drivers/uart/uart_mix_fifo_poll/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay diff --git a/tests/drivers/uart/uart_mix_fifo_poll/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/tests/drivers/uart/uart_mix_fifo_poll/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay deleted file mode 100644 index 945b8628e7a6..000000000000 --- a/tests/drivers/uart/uart_mix_fifo_poll/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&pinctrl { - uart21_default: uart21_default { - group1 { - psels = , - , - , - ; - }; - }; - - uart21_sleep: uart21_sleep { - group1 { - psels = , - , - , - ; - low-power-enable; - }; - }; -}; - -dut: &uart21 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart21_default>; - pinctrl-1 = <&uart21_sleep>; - pinctrl-names = "default", "sleep"; - hw-flow-control; -}; - -counter_dev: &timer00 { - status = "okay"; -}; - -&grtc { - interrupts = <228 2>; -}; diff --git a/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml b/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml index 5a85af65735e..fee2d1f46463 100644 --- a/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml +++ b/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml @@ -5,20 +5,19 @@ common: depends_on: gpio harness: ztest platform_allow: + - nrf52_bsim - nrf52840dk/nrf52840 - nrf9160dk/nrf9160 - nrf5340dk/nrf5340/cpuapp - nrf5340bsim/nrf5340/cpuapp + - nrf54h20dk/nrf54h20/cpuapp + - nrf54h20dk/nrf54h20/cpurad - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf54l20pdk/nrf54l20/cpuapp + - nrf54l15bsim/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - nrf54lm20bsim/nrf54lm20a/cpuapp - - nrf54l15bsim/nrf54l15/cpuapp - - nrf54h20dk/nrf54h20/cpuapp - - nrf54h20dk/nrf54h20/cpurad - ophelia4ev/nrf54l15/cpuapp - - nrf52_bsim integration_platforms: - nrf52840dk/nrf52840 harness_config: From 75441a0dfc0eba138ff390837cf4762a44968ab7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Fri, 4 Jul 2025 14:55:55 +0200 Subject: [PATCH 0336/2141] [nrf fromtree] drivers: serial: nrfx_uarte: use ifdef instead of IS_ENABLED MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In certain configurations timeout field is not present in the data structure so preprocessor ifdef must be used instead of compiler check. Signed-off-by: Krzysztof Chruściński (cherry picked from commit eb996924fbaa5804253eb439ae19d5c18767f92a) --- drivers/serial/uart_nrfx_uarte.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/serial/uart_nrfx_uarte.c b/drivers/serial/uart_nrfx_uarte.c index 46c5a8b83d2e..cd8aab9a4753 100644 --- a/drivers/serial/uart_nrfx_uarte.c +++ b/drivers/serial/uart_nrfx_uarte.c @@ -1611,11 +1611,11 @@ static void endrx_isr(const struct device *dev) } irq_unlock(key); - if (IS_ENABLED(UARTE_HAS_FRAME_TIMEOUT)) { - if (start_timeout && !K_TIMEOUT_EQ(async_rx->timeout, K_NO_WAIT)) { - k_timer_start(&async_rx->timer, async_rx->timeout, K_NO_WAIT); - } +#ifdef UARTE_HAS_FRAME_TIMEOUT + if (start_timeout && !K_TIMEOUT_EQ(async_rx->timeout, K_NO_WAIT)) { + k_timer_start(&async_rx->timer, async_rx->timeout, K_NO_WAIT); } +#endif } #if !defined(CONFIG_UART_NRFX_UARTE_ENHANCED_RX) From cfacaa878a05971309d67ad2133c763c22057842 Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Thu, 17 Jul 2025 17:27:55 +1000 Subject: [PATCH 0337/2141] [nrf fromtree] serial: nrfx_uarte: initial pin state to SLEEP Configure the initial pin state of the UARTE peripheral to SLEEP, not left uninitialised. This fixes the pin configuration not being set until the interface is used if `zephyr,pm-device-runtime-auto` is enabled. Signed-off-by: Jordan Yates (cherry picked from commit 69acc016eb71b6e3020d8005710063624c214bd6) --- drivers/serial/uart_nrfx_uarte.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/serial/uart_nrfx_uarte.c b/drivers/serial/uart_nrfx_uarte.c index cd8aab9a4753..1c75f4432280 100644 --- a/drivers/serial/uart_nrfx_uarte.c +++ b/drivers/serial/uart_nrfx_uarte.c @@ -2490,6 +2490,11 @@ static int uarte_instance_init(const struct device *dev, ((struct pinctrl_dev_config *)cfg->pcfg)->reg = (uintptr_t)cfg->uarte_regs; } + /* Apply sleep state by default. + * If PM is disabled, the default state will be applied in pm_device_driver_init. + */ + (void)pinctrl_apply_state(cfg->pcfg, PINCTRL_STATE_SLEEP); + #ifdef CONFIG_UART_USE_RUNTIME_CONFIGURE err = uarte_nrfx_configure(dev, &((struct uarte_nrfx_data *)dev->data)->uart_config); if (err) { From 09917ddd26f3eae14126804fdf093e6bef790785 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Wed, 23 Jul 2025 15:31:09 +0200 Subject: [PATCH 0338/2141] [nrf fromtree] tests: drivers: clock_control: nrf_lf_clock_start: Run on nrf54lm20dk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix mistake where one of test configurations was skipped on nrf54lm20dk board. Signed-off-by: Sebastian Głąb (cherry picked from commit 8e881b046e8a021840797da6f26ebd0c94ce0a8f) --- tests/drivers/clock_control/nrf_lf_clock_start/testcase.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/drivers/clock_control/nrf_lf_clock_start/testcase.yaml b/tests/drivers/clock_control/nrf_lf_clock_start/testcase.yaml index 2a4bba57a711..0b1f9ae3c931 100644 --- a/tests/drivers/clock_control/nrf_lf_clock_start/testcase.yaml +++ b/tests/drivers/clock_control/nrf_lf_clock_start/testcase.yaml @@ -51,6 +51,7 @@ tests: - nrf5340dk/nrf5340/cpuapp - nrf5340dk/nrf5340/cpunet - nrf54l15dk/nrf54l15/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: - nrf51dk/nrf51822 From 720dc042525938bf5bf340c6ddf0b9d697eb5c9c Mon Sep 17 00:00:00 2001 From: "Mike J. Chen" Date: Wed, 5 Mar 2025 16:39:00 -0800 Subject: [PATCH 0339/2141] [nrf fromtree] bluetooth: fix bug when destroying tx queue buffers on disconnect Channel tx_queue purging on disconnect was inconsistently handled by the different channels: iso, l2cap, l2cap_br. iso channels handled purging in the tx_data_pull hook. l2cap and l2cap_br did the purging in channel delete functions and did not expect tx_data_pull to be called for a disconnected channel. Their data_pull functions could return a ptr to a net_buf that was still on the tx_queue, which is problematic when the conn tx_processor unrefs the returned buffer resulting in multiple calls to the buf destroy function. To make things consistent and correct, remove the code that tries to purge tx_queues in the tx_processor and only do purging in the channels themselves when they are deleted/disconnected. Also refactor and clarify referencing of the net_buf returned by tx_data_pull. It was confusing who had a reference and when, which could vary depending on the length of the original buffer. There are three cases: the buffer length is less than the tx.mps, greater the mps but less than the mtu so requiring segementation but not fragmentation, or greater than both mps and mtu so requiring both segmentation and fragmentation. The conn layer would increase the refcnt if the length was greater than the mtu, but not have any awareness of whether the net_buf was still on the tx_queue or not. Now it is the tx_data_pull callbacks responsibitity to increment the reference count if it is returning a pointer to a net_buf that it is still keeping on the tx_queue for segmentation purposes. The conn layer will now always transfer that reference into a fragment view and not conditional it on the length relative to the mtu, and always decrement the reference to the parent when the fragment is destroyed. So there is no risk of decrementing a reference to a net buf that might still be on a tx_queue, which simplifies error handling in particular. Also add error handling paths for when asserts are not enabled. Signed-off-by: Mike J. Chen (cherry picked from commit a392c33c60286574b74fe708e1a182dd99666c8d) --- subsys/bluetooth/host/classic/l2cap_br.c | 16 +++- subsys/bluetooth/host/conn.c | 111 ++++++++--------------- subsys/bluetooth/host/conn_internal.h | 14 ++- subsys/bluetooth/host/iso.c | 31 ++++--- subsys/bluetooth/host/l2cap.c | 30 +++--- 5 files changed, 98 insertions(+), 104 deletions(-) diff --git a/subsys/bluetooth/host/classic/l2cap_br.c b/subsys/bluetooth/host/classic/l2cap_br.c index 66343aa512df..1d8616013e99 100644 --- a/subsys/bluetooth/host/classic/l2cap_br.c +++ b/subsys/bluetooth/host/classic/l2cap_br.c @@ -1574,6 +1574,8 @@ struct net_buf *l2cap_br_data_pull(struct bt_conn *conn, size_t amount, size_t * return NULL; } + __ASSERT_NO_MSG(conn->state == BT_CONN_CONNECTED); + struct bt_l2cap_br_chan *br_chan; br_chan = CONTAINER_OF(pdu_ready, struct bt_l2cap_br_chan, _pdu_ready); @@ -1591,13 +1593,15 @@ struct net_buf *l2cap_br_data_pull(struct bt_conn *conn, size_t amount, size_t * __ASSERT(tx_pdu, "signaled ready but no PDUs in the TX queue"); - struct net_buf *pdu = CONTAINER_OF(tx_pdu, struct net_buf, node); + struct net_buf *q_pdu = CONTAINER_OF(tx_pdu, struct net_buf, node); - if (bt_buf_has_view(pdu)) { - LOG_ERR("already have view on %p", pdu); + if (bt_buf_has_view(q_pdu)) { + LOG_ERR("already have view on %p", q_pdu); return NULL; } + struct net_buf *pdu = net_buf_ref(q_pdu); + /* We can't interleave ACL fragments from different channels for the * same ACL conn -> we have to wait until a full L2 PDU is transferred * before switching channels. @@ -1605,13 +1609,15 @@ struct net_buf *l2cap_br_data_pull(struct bt_conn *conn, size_t amount, size_t * bool last_frag = amount >= pdu->len; if (last_frag) { - LOG_DBG("last frag, removing %p", pdu); + LOG_DBG("last frag, removing %p", q_pdu); __maybe_unused bool found; - found = sys_slist_find_and_remove(&br_chan->_pdu_tx_queue, &pdu->node); + found = sys_slist_find_and_remove(&br_chan->_pdu_tx_queue, &q_pdu->node); __ASSERT_NO_MSG(found); + net_buf_unref(q_pdu); + LOG_DBG("chan %p done", br_chan); lower_data_ready(br_chan); diff --git a/subsys/bluetooth/host/conn.c b/subsys/bluetooth/host/conn.c index 0c34dc0b6160..9e9f18c040a0 100644 --- a/subsys/bluetooth/host/conn.c +++ b/subsys/bluetooth/host/conn.c @@ -649,7 +649,7 @@ static bool is_acl_conn(struct bt_conn *conn) } static int send_buf(struct bt_conn *conn, struct net_buf *buf, - size_t len, void *cb, void *ud) + size_t len, bt_conn_tx_cb_t cb, void *ud) { struct net_buf *frag = NULL; struct bt_conn_tx *tx = NULL; @@ -659,13 +659,15 @@ static int send_buf(struct bt_conn *conn, struct net_buf *buf, if (buf->len == 0) { __ASSERT_NO_MSG(0); - return -EMSGSIZE; + err = -EMSGSIZE; + goto error_return; } if (bt_buf_has_view(buf)) { __ASSERT_NO_MSG(0); - return -EIO; + err = -EIO; + goto error_return; } LOG_DBG("conn %p buf %p len %zu buf->len %u cb %p ud %p", @@ -680,7 +682,8 @@ static int send_buf(struct bt_conn *conn, struct net_buf *buf, */ __ASSERT(0, "No controller bufs"); - return -ENOMEM; + err = -ENOMEM; + goto error_return; } /* Allocate and set the TX context */ @@ -689,8 +692,9 @@ static int send_buf(struct bt_conn *conn, struct net_buf *buf, /* See big comment above */ if (!tx) { __ASSERT(0, "No TX context"); - - return -ENOMEM; + k_sem_give(bt_conn_get_pkts(conn)); + err = -ENOMEM; + goto error_return; } tx->cb = cb; @@ -698,18 +702,17 @@ static int send_buf(struct bt_conn *conn, struct net_buf *buf, uint16_t frag_len = MIN(conn_mtu(conn), len); - __ASSERT_NO_MSG(buf->ref == 1); + /* Check that buf->ref is 1 or 2. It would be 1 if this + * was the only reference (e.g. buf was removed + * from the conn tx_queue). It would be 2 if the + * tx_data_pull kept it on the tx_queue for segmentation. + */ + __ASSERT_NO_MSG((buf->ref == 1) || (buf->ref == 2)); - if (buf->len > frag_len) { - LOG_DBG("keep %p around", buf); - frag = get_data_frag(net_buf_ref(buf), frag_len); - } else { - LOG_DBG("move %p ref in", buf); - /* Move the ref into `frag` for the last TX. That way `buf` will - * get destroyed when `frag` is destroyed. - */ - frag = get_data_frag(buf, frag_len); - } + /* The reference is always transferred to the frag, so when + * the frag is destroyed, the parent reference is decremented. + */ + frag = get_data_frag(buf, frag_len); /* Caller is supposed to check we have all resources to send */ __ASSERT_NO_MSG(frag != NULL); @@ -723,7 +726,7 @@ static int send_buf(struct bt_conn *conn, struct net_buf *buf, conn->next_is_frag = false; } - LOG_DBG("send frag: buf %p len %d", buf, frag_len); + LOG_DBG("send frag: buf %p len %d", frag, frag_len); /* At this point, the buffer is either a fragment or a full HCI packet. * The flags are also valid. @@ -766,15 +769,26 @@ static int send_buf(struct bt_conn *conn, struct net_buf *buf, */ net_buf_unref(frag); - /* `buf` might not get destroyed right away, and its `tx` - * pointer will still be reachable. Make sure that we don't try - * to use the destroyed context later. + /* `buf` might not get destroyed right away because it may + * still be on a conn tx_queue, and its `tx` pointer will still + * be reachable. Make sure that we don't try to use the + * destroyed context later. */ conn_tx_destroy(conn, tx); k_sem_give(bt_conn_get_pkts(conn)); /* Merge HCI driver errors */ return -EIO; + +error_return: + /* Runtime handling of fatal errors when ASSERTS are disabled. + * Unref the buf and invoke callback with the error. + */ + net_buf_unref(buf); + if (cb) { + cb(conn, ud, err); + } + return err; } static struct k_poll_signal conn_change = @@ -956,8 +970,8 @@ struct bt_conn *get_conn_ready(void) sys_slist_remove(&bt_dev.le.conn_ready, prev, &conn->_conn_ready); (void)atomic_set(&conn->_conn_ready_lock, 0); - /* Append connection to list if it still has data */ - if (conn->has_data(conn)) { + /* Append connection to list if it is connected and still has data */ + if (conn->has_data(conn) && (conn->state == BT_CONN_CONNECTED)) { LOG_DBG("appending %p to back of TX queue", conn); bt_conn_data_ready(conn); } @@ -985,30 +999,6 @@ static void acl_get_and_clear_cb(struct bt_conn *conn, struct net_buf *buf, } #endif /* defined(CONFIG_BT_CONN) */ -/* Acts as a "null-routed" bt_send(). This fn will decrease the refcount of - * `buf` and call the user callback with an error code. - */ -static void destroy_and_callback(struct bt_conn *conn, - struct net_buf *buf, - bt_conn_tx_cb_t cb, - void *ud) -{ - if (!cb) { - conn->get_and_clear_cb(conn, buf, &cb, &ud); - } - - LOG_DBG("pop: cb %p userdata %p", cb, ud); - - /* bt_send() would've done an unref. Do it here also, so the buffer is - * hopefully destroyed and the user callback can allocate a new one. - */ - net_buf_unref(buf); - - if (cb) { - cb(conn, ud, -ESHUTDOWN); - } -} - static volatile bool _suspend_tx; #if defined(CONFIG_BT_TESTING) @@ -1051,17 +1041,7 @@ void bt_conn_tx_processor(void) if (conn->state != BT_CONN_CONNECTED) { LOG_WRN("conn %p: not connected", conn); - - /* Call the user callbacks & destroy (final-unref) the buffers - * we were supposed to send. - */ - buf = conn->tx_data_pull(conn, SIZE_MAX, &buf_len); - while (buf) { - destroy_and_callback(conn, buf, cb, ud); - buf = conn->tx_data_pull(conn, SIZE_MAX, &buf_len); - } - - goto exit; + goto raise_and_exit; } /* now that we are guaranteed resources, we can pull data from the upper @@ -1095,25 +1075,12 @@ void bt_conn_tx_processor(void) int err = send_buf(conn, buf, buf_len, cb, ud); if (err) { - /* -EIO means `unrecoverable error`. It can be an assertion that - * failed or an error from the HCI driver. - * - * -ENOMEM means we thought we had all the resources to send the - * buf (ie. TX context + controller buffer) but one of them was - * not available. This is likely due to a failure of - * assumption, likely that we have been pre-empted somehow and - * that `tx_processor()` has been re-entered. - * - * In both cases, we destroy the buffer and mark the connection - * as dead. - */ LOG_ERR("Fatal error (%d). Disconnecting %p", err, conn); - destroy_and_callback(conn, buf, cb, ud); bt_conn_disconnect(conn, BT_HCI_ERR_REMOTE_USER_TERM_CONN); - goto exit; } +raise_and_exit: /* Always kick the TX work. It will self-suspend if it doesn't get * resources or there is nothing left to send. */ diff --git a/subsys/bluetooth/host/conn_internal.h b/subsys/bluetooth/host/conn_internal.h index 41f396a1aeed..909c0ebd22ef 100644 --- a/subsys/bluetooth/host/conn_internal.h +++ b/subsys/bluetooth/host/conn_internal.h @@ -288,10 +288,22 @@ struct bt_conn { #endif /* Callback into the higher-layers (L2CAP / ISO) to return a buffer for - * sending `amount` of bytes to HCI. + * sending `amount` of bytes to HCI. Will only be called when + * the state is connected. The higher-layer is responsible for purging + * the remaining buffers on disconnect. * * Scheduling from which channel to pull (e.g. for L2CAP) is done at the * upper layer's discretion. + * + * Details about the returned net_buf when it is not NULL: + * - If the net_buf->len <= *length, then the net_buf has been removed + * from the tx_queue of the connection and the caller is now the + * owner of the only reference to the net_buf. + * - Otherwise, the net_buf is still on the tx_queue of the connection, + * and the callback has incremented the reference count to account + * for it having a reference still. + * - The caller must consume *length bytes from the net_buf before + * calling this function again. */ struct net_buf * (*tx_data_pull)(struct bt_conn *conn, size_t amount, diff --git a/subsys/bluetooth/host/iso.c b/subsys/bluetooth/host/iso.c index eb6eaa783504..a59158a43d31 100644 --- a/subsys/bluetooth/host/iso.c +++ b/subsys/bluetooth/host/iso.c @@ -454,10 +454,18 @@ void bt_iso_connected(struct bt_conn *iso) static void bt_iso_chan_disconnected(struct bt_iso_chan *chan, uint8_t reason) { const uint8_t conn_type = chan->iso->iso.info.type; + struct net_buf *buf; + LOG_DBG("%p, reason 0x%02x", chan, reason); __ASSERT(chan->iso != NULL, "NULL conn for iso chan %p", chan); + /* release buffers from tx_queue */ + while ((buf = k_fifo_get(&chan->iso->iso.txq, K_NO_WAIT))) { + __ASSERT_NO_MSG(!bt_buf_has_view(buf)); + net_buf_unref(buf); + } + bt_iso_chan_set_state(chan, BT_ISO_STATE_DISCONNECTED); bt_conn_set_state(chan->iso, BT_CONN_DISCONNECT_COMPLETE); @@ -775,7 +783,8 @@ void bt_iso_recv(struct bt_conn *iso, struct net_buf *buf, uint8_t flags) static bool iso_has_data(struct bt_conn *conn) { #if defined(CONFIG_BT_ISO_TX) - return !k_fifo_is_empty(&conn->iso.txq); + return ((conn->iso.chan->state == BT_ISO_STATE_CONNECTED) && + !k_fifo_is_empty(&conn->iso.txq)); #else /* !CONFIG_BT_ISO_TX */ return false; #endif /* CONFIG_BT_ISO_TX */ @@ -789,9 +798,9 @@ static struct net_buf *iso_data_pull(struct bt_conn *conn, size_t amount, size_t /* Leave the PDU buffer in the queue until we have sent all its * fragments. */ - struct net_buf *frag = k_fifo_peek_head(&conn->iso.txq); + struct net_buf *q_frag = k_fifo_peek_head(&conn->iso.txq); - if (!frag) { + if (!q_frag) { BT_ISO_DATA_DBG("signaled ready but no frag available"); /* Service other connections */ bt_tx_irq_raise(); @@ -799,13 +808,10 @@ static struct net_buf *iso_data_pull(struct bt_conn *conn, size_t amount, size_t return NULL; } - if (conn->iso.chan->state != BT_ISO_STATE_CONNECTED) { - __maybe_unused struct net_buf *b = k_fifo_get(&conn->iso.txq, K_NO_WAIT); + __ASSERT_NO_MSG(conn->state == BT_CONN_CONNECTED); + if (conn->iso.chan->state != BT_ISO_STATE_CONNECTED) { LOG_DBG("channel has been disconnected"); - __ASSERT_NO_MSG(b == frag); - - net_buf_unref(b); /* Service other connections */ bt_tx_irq_raise(); @@ -813,7 +819,7 @@ static struct net_buf *iso_data_pull(struct bt_conn *conn, size_t amount, size_t return NULL; } - if (bt_buf_has_view(frag)) { + if (bt_buf_has_view(q_frag)) { /* This should not happen. conn.c should wait until the view is * destroyed before requesting more data. */ @@ -821,13 +827,16 @@ static struct net_buf *iso_data_pull(struct bt_conn *conn, size_t amount, size_t return NULL; } + struct net_buf *frag = net_buf_ref(q_frag); bool last_frag = amount >= frag->len; if (last_frag) { - __maybe_unused struct net_buf *b = k_fifo_get(&conn->iso.txq, K_NO_WAIT); + q_frag = k_fifo_get(&conn->iso.txq, K_NO_WAIT); BT_ISO_DATA_DBG("last frag, pop buf"); - __ASSERT_NO_MSG(b == frag); + __ASSERT_NO_MSG(q_frag == frag); + + net_buf_unref(q_frag); } *length = frag->len; diff --git a/subsys/bluetooth/host/l2cap.c b/subsys/bluetooth/host/l2cap.c index 433eb8faef09..ac6fc60dbad6 100644 --- a/subsys/bluetooth/host/l2cap.c +++ b/subsys/bluetooth/host/l2cap.c @@ -83,11 +83,6 @@ NET_BUF_POOL_FIXED_DEFINE(disc_pool, 1, #define l2cap_remove_ident(conn, ident) __l2cap_lookup_ident(conn, ident, true) static sys_slist_t servers = SYS_SLIST_STATIC_INIT(&servers); - -static void l2cap_tx_buf_destroy(struct bt_conn *conn, struct net_buf *buf, int err) -{ - net_buf_unref(buf); -} #endif /* CONFIG_BT_L2CAP_DYNAMIC_CHANNEL */ /* L2CAP signalling channel specific context */ @@ -257,6 +252,7 @@ void bt_l2cap_chan_del(struct bt_l2cap_chan *chan) { const struct bt_l2cap_chan_ops *ops = chan->ops; struct bt_l2cap_le_chan *le_chan = BT_L2CAP_LE_CHAN(chan); + struct net_buf *buf; LOG_DBG("conn %p chan %p", chan->conn, chan); @@ -269,9 +265,7 @@ void bt_l2cap_chan_del(struct bt_l2cap_chan *chan) /* Remove buffers on the PDU TX queue. We can't do that in * `l2cap_chan_destroy()` as it is not called for fixed channels. */ - while (chan_has_data(le_chan)) { - struct net_buf *buf = k_fifo_get(&le_chan->tx_queue, K_NO_WAIT); - + while ((buf = k_fifo_get(&le_chan->tx_queue, K_NO_WAIT))) { net_buf_unref(buf); } @@ -919,20 +913,22 @@ struct net_buf *l2cap_data_pull(struct bt_conn *conn, * For SDUs we do the same, we keep it in the queue until all the * segments have been sent, adding the PDU headers just-in-time. */ - struct net_buf *pdu = k_fifo_peek_head(&lechan->tx_queue); + struct net_buf *fifo_pdu = k_fifo_peek_head(&lechan->tx_queue); /* We don't have anything to send for the current channel. We could * however have something to send on another channel that is attached to * the same ACL connection. Re-trigger the TX processor: it will call us * again and this time we will select another channel to pull data from. */ - if (!pdu) { + if (!fifo_pdu) { bt_tx_irq_raise(); return NULL; } - if (bt_buf_has_view(pdu)) { - LOG_ERR("already have view on %p", pdu); + __ASSERT_NO_MSG(conn->state == BT_CONN_CONNECTED); + + if (bt_buf_has_view(fifo_pdu)) { + LOG_ERR("already have view on %p", fifo_pdu); return NULL; } @@ -946,6 +942,8 @@ struct net_buf *l2cap_data_pull(struct bt_conn *conn, return NULL; } + struct net_buf *pdu = net_buf_ref(fifo_pdu); + /* Add PDU header */ if (lechan->_pdu_remaining == 0) { struct bt_l2cap_hdr *hdr; @@ -975,9 +973,11 @@ struct net_buf *l2cap_data_pull(struct bt_conn *conn, if (last_frag && last_seg) { LOG_DBG("last frag of last seg, dequeuing %p", pdu); - __maybe_unused struct net_buf *b = k_fifo_get(&lechan->tx_queue, K_NO_WAIT); + fifo_pdu = k_fifo_get(&lechan->tx_queue, K_NO_WAIT); - __ASSERT_NO_MSG(b == pdu); + __ASSERT_NO_MSG(fifo_pdu == pdu); + + net_buf_unref(fifo_pdu); } if (last_frag && L2CAP_LE_CID_IS_DYN(lechan->tx.cid)) { @@ -2290,7 +2290,7 @@ static void l2cap_chan_shutdown(struct bt_l2cap_chan *chan) /* Remove buffers on the TX queue */ while ((buf = k_fifo_get(&le_chan->tx_queue, K_NO_WAIT))) { - l2cap_tx_buf_destroy(chan->conn, buf, -ESHUTDOWN); + net_buf_unref(buf); } /* Remove buffers on the RX queue */ From 4c20b69ea6d6358ed106feaabb635892dfd10896 Mon Sep 17 00:00:00 2001 From: "Mike J. Chen" Date: Mon, 9 Jun 2025 16:10:44 -0700 Subject: [PATCH 0340/2141] [nrf fromtree] tests: bsim: add early disconnect tests for iso and l2cap Add early_disconnect test cases for iso/cis and l2cap/stress to test the bluetooth stack handling of disconnects while transmit is still in progress. Signed-off-by: Mike J. Chen (cherry picked from commit 93997dab8eaa4777351d6d00df49695a35d41c76) --- tests/bsim/bluetooth/host/iso/cis/prj.conf | 1 + .../bluetooth/host/iso/cis/src/cis_central.c | 18 +- .../host/iso/cis/src/cis_peripheral.c | 36 ++++ .../cis/tests_scripts/cis_early_disconnect.sh | 29 +++ .../stress/overlay-early-disconnect.conf | 1 + .../bluetooth/host/l2cap/stress/src/main.c | 203 +++++++++++++++++- .../bluetooth/host/l2cap/stress/testcase.yaml | 4 + .../tests_scripts/l2cap_early_disconnect.sh | 47 ++++ 8 files changed, 327 insertions(+), 12 deletions(-) create mode 100755 tests/bsim/bluetooth/host/iso/cis/tests_scripts/cis_early_disconnect.sh create mode 100644 tests/bsim/bluetooth/host/l2cap/stress/overlay-early-disconnect.conf create mode 100755 tests/bsim/bluetooth/host/l2cap/stress/tests_scripts/l2cap_early_disconnect.sh diff --git a/tests/bsim/bluetooth/host/iso/cis/prj.conf b/tests/bsim/bluetooth/host/iso/cis/prj.conf index 4ad0a0fd319a..06f028232967 100644 --- a/tests/bsim/bluetooth/host/iso/cis/prj.conf +++ b/tests/bsim/bluetooth/host/iso/cis/prj.conf @@ -16,6 +16,7 @@ CONFIG_BT_ISO_TX_MTU=200 CONFIG_BT_ISO_RX_MTU=200 CONFIG_BT_ISO_LOG_LEVEL_DBG=y +CONFIG_NET_BUF_POOL_USAGE=y # Controller Connected ISO configs CONFIG_BT_CTLR_CENTRAL_ISO=y diff --git a/tests/bsim/bluetooth/host/iso/cis/src/cis_central.c b/tests/bsim/bluetooth/host/iso/cis/src/cis_central.c index dc7d46100a9e..e3b6ee9284fe 100644 --- a/tests/bsim/bluetooth/host/iso/cis/src/cis_central.c +++ b/tests/bsim/bluetooth/host/iso/cis/src/cis_central.c @@ -154,6 +154,11 @@ static void iso_disconnected(struct bt_iso_chan *chan, uint8_t reason) err = bt_iso_remove_data_path(chan, BT_HCI_DATAPATH_DIR_HOST_TO_CTLR); TEST_ASSERT(err == 0, "Failed to remove ISO data path: %d", err); + + if (seq_num < 100) { + printk("Channel disconnected early, bumping seq_num to 1000 to end test\n"); + seq_num = 1000; + } } static void sdu_sent_cb(struct bt_iso_chan *chan) @@ -462,9 +467,16 @@ static void test_main(void) k_sleep(K_USEC(interval_us)); } - disconnect_cis(); - disconnect_acl(); - terminate_cig(); + if (seq_num == 100) { + disconnect_cis(); + disconnect_acl(); + terminate_cig(); + } + + /* check that all buffers returned to pool */ + TEST_ASSERT(atomic_get(&tx_pool.avail_count) == ENQUEUE_COUNT, + "tx_pool has non returned buffers, should be %u but is %u", + ENQUEUE_COUNT, atomic_get(&tx_pool.avail_count)); TEST_PASS("Test passed"); } diff --git a/tests/bsim/bluetooth/host/iso/cis/src/cis_peripheral.c b/tests/bsim/bluetooth/host/iso/cis/src/cis_peripheral.c index 96b8865c1f4e..e8b3ff37a9d5 100644 --- a/tests/bsim/bluetooth/host/iso/cis/src/cis_peripheral.c +++ b/tests/bsim/bluetooth/host/iso/cis/src/cis_peripheral.c @@ -35,6 +35,9 @@ static const struct bt_data ad[] = { }; static struct bt_iso_chan iso_chan; +static size_t disconnect_after_recv_cnt; +static size_t iso_recv_cnt; + /** Print data as d_0 d_1 d_2 ... d_(n-2) d_(n-1) d_(n) to show the 3 first and 3 last octets * * Examples: @@ -72,14 +75,26 @@ static void iso_print_data(uint8_t *data, size_t data_len) printk("\t %s\n", data_str); } +static void disconnect_device(struct bt_conn *conn, void *data) +{ + int err = bt_conn_disconnect(conn, BT_HCI_ERR_REMOTE_USER_TERM_CONN); + + TEST_ASSERT(!err, "Failed to initate disconnect (err %d)", err); +} + static void iso_recv(struct bt_iso_chan *chan, const struct bt_iso_recv_info *info, struct net_buf *buf) { + iso_recv_cnt++; if (info->flags & BT_ISO_FLAGS_VALID) { printk("Incoming data channel %p len %u\n", chan, buf->len); iso_print_data(buf->data, buf->len); SET_FLAG(flag_data_received); } + if (disconnect_after_recv_cnt && (iso_recv_cnt >= disconnect_after_recv_cnt)) { + printk("Disconnecting\n"); + bt_conn_foreach(BT_CONN_TYPE_LE, disconnect_device, NULL); + } } static void iso_connected(struct bt_iso_chan *chan) @@ -189,12 +204,33 @@ static void test_main(void) } } +static void test_main_early_disconnect(void) +{ + init(); + + disconnect_after_recv_cnt = 10; + + while (true) { + adv_connect(); + bt_testlib_conn_wait_free(); + + if (IS_FLAG_SET(flag_data_received)) { + TEST_PASS("Test passed"); + } + } +} + static const struct bst_test_instance test_def[] = { { .test_id = "peripheral", .test_descr = "Peripheral", .test_main_f = test_main, }, + { + .test_id = "peripheral_early_disconnect", + .test_descr = "Peripheral that tests early disconnect", + .test_main_f = test_main_early_disconnect, + }, BSTEST_END_MARKER, }; diff --git a/tests/bsim/bluetooth/host/iso/cis/tests_scripts/cis_early_disconnect.sh b/tests/bsim/bluetooth/host/iso/cis/tests_scripts/cis_early_disconnect.sh new file mode 100755 index 000000000000..bac2c2e82a11 --- /dev/null +++ b/tests/bsim/bluetooth/host/iso/cis/tests_scripts/cis_early_disconnect.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash +# Copyright (c) 2025 Google LLC +# SPDX-License-Identifier: Apache-2.0 + +source ${ZEPHYR_BASE}/tests/bsim/sh_common.source + +# Tests cleanup within the ble stack for ISO connections when +# peripheral disconnects early while the central still has +# buffers queued for sending. Using the base code, which +# has the central sending 100 ISO packets, the peripheral +# triggers a disconnect after receiving 10 packets. +# The central checks that all tx_pool buffers have been +# returned to the pool after the disconnect. +simulation_id="iso_cis_early_disconnect" +verbosity_level=2 +EXECUTE_TIMEOUT=120 + +cd ${BSIM_OUT_PATH}/bin + +Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_host_iso_cis_prj_conf \ + -v=${verbosity_level} -s=${simulation_id} -d=0 -testid=central + +Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_host_iso_cis_prj_conf \ + -v=${verbosity_level} -s=${simulation_id} -d=1 -testid=peripheral_early_disconnect + +Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s=${simulation_id} \ + -D=2 -sim_length=30e6 $@ + +wait_for_background_jobs diff --git a/tests/bsim/bluetooth/host/l2cap/stress/overlay-early-disconnect.conf b/tests/bsim/bluetooth/host/l2cap/stress/overlay-early-disconnect.conf new file mode 100644 index 000000000000..94dfb1ed30d0 --- /dev/null +++ b/tests/bsim/bluetooth/host/l2cap/stress/overlay-early-disconnect.conf @@ -0,0 +1 @@ +CONFIG_BT_L2CAP_SEG_RECV=y diff --git a/tests/bsim/bluetooth/host/l2cap/stress/src/main.c b/tests/bsim/bluetooth/host/l2cap/stress/src/main.c index d05f4e4f0a74..a411354bb791 100644 --- a/tests/bsim/bluetooth/host/l2cap/stress/src/main.c +++ b/tests/bsim/bluetooth/host/l2cap/stress/src/main.c @@ -17,6 +17,7 @@ #include #include "babblekit/testcase.h" #include "babblekit/flags.h" +#include "bsim_args_runner.h" #define LOG_MODULE_NAME main #include @@ -31,6 +32,18 @@ DEFINE_FLAG_STATIC(flag_l2cap_connected); #define SDU_LEN 3000 #define RESCHEDULE_DELAY K_MSEC(100) +/* The early_disconnect test has the peripheral disconnect at various + * times: + * + * Peripheral 1: disconnects after all 20 SDUs as before + * Peripheral 2: disconnects immediately before receiving anything + * Peripheral 3: disconnects after receiving first SDU + * Peripheral 4: disconnects after receiving first PDU in second SDU + * Peripheral 5: disconnects after receiving third PDU in third SDU + * Peripheral 6: disconnects atfer receiving tenth PDU in tenth SDU + */ +static unsigned int device_nbr; + static void sdu_destroy(struct net_buf *buf) { LOG_DBG("%p", buf); @@ -56,7 +69,7 @@ NET_BUF_POOL_DEFINE(sdu_rx_pool, 8, rx_destroy); static uint8_t tx_data[SDU_LEN]; -static uint16_t rx_cnt; +static uint16_t sdu_rx_cnt; static uint8_t disconnect_counter; struct test_ctx { @@ -138,10 +151,66 @@ void sent_cb(struct bt_l2cap_chan *chan) continue_sending(ctx); } +#ifdef CONFIG_BT_L2CAP_SEG_RECV +static void disconnect_device_no_wait(struct bt_conn *conn, void *data) +{ + int err; + + err = bt_conn_disconnect(conn, BT_HCI_ERR_REMOTE_USER_TERM_CONN); + TEST_ASSERT(!err, "Failed to initate disconnect (err %d)", err); + + UNSET_FLAG(is_connected); +} + +static void seg_recv_cb(struct bt_l2cap_chan *chan, size_t sdu_len, off_t seg_offset, + struct net_buf_simple *seg) +{ + static size_t pdu_rx_cnt; + + if ((seg_offset + seg->len) == sdu_len) { + /* last segment/PDU of a SDU */ + LOG_DBG("len %d", seg->len); + sdu_rx_cnt++; + pdu_rx_cnt = 0; + } else { + LOG_DBG("SDU %u, pdu %u at seg_offset %u, len %u", + sdu_rx_cnt, pdu_rx_cnt, seg_offset, seg->len); + pdu_rx_cnt++; + } + + /* Verify SDU data matches TX'd data. */ + int pos = memcmp(seg->data, &tx_data[seg_offset], seg->len); + + if (pos != 0) { + LOG_ERR("RX data doesn't match TX: pos %d", seg_offset); + LOG_HEXDUMP_ERR(seg->data, seg->len, "RX data"); + LOG_HEXDUMP_INF(tx_data, seg->len, "TX data"); + + for (uint16_t p = 0; p < seg->len; p++) { + __ASSERT(seg->data[p] == tx_data[p + seg_offset], + "Failed rx[%d]=%x != expect[%d]=%x", + p, seg->data[p], p, tx_data[p + seg_offset]); + } + } + + if (((device_nbr == 4) && (sdu_rx_cnt >= 1) && (pdu_rx_cnt == 1)) || + ((device_nbr == 5) && (sdu_rx_cnt >= 2) && (pdu_rx_cnt == 3)) || + ((device_nbr == 6) && (sdu_rx_cnt >= 9) && (pdu_rx_cnt == 10))) { + LOG_INF("disconnecting after receiving PDU %u of SDU %u", + pdu_rx_cnt - 1, sdu_rx_cnt); + bt_conn_foreach(BT_CONN_TYPE_LE, disconnect_device_no_wait, NULL); + return; + } + + if (is_connected) { + bt_l2cap_chan_give_credits(chan, 1); + } +} +#else /* CONFIG_BT_L2CAP_SEG_RECV */ int recv_cb(struct bt_l2cap_chan *chan, struct net_buf *buf) { LOG_DBG("len %d", buf->len); - rx_cnt++; + sdu_rx_cnt++; /* Verify SDU data matches TX'd data. */ int pos = memcmp(buf->data, tx_data, buf->len); @@ -160,6 +229,7 @@ int recv_cb(struct bt_l2cap_chan *chan, struct net_buf *buf) return 0; } +#endif /* CONFIG_BT_L2CAP_SEG_RECV */ void l2cap_chan_connected_cb(struct bt_l2cap_chan *l2cap_chan) { @@ -167,25 +237,41 @@ void l2cap_chan_connected_cb(struct bt_l2cap_chan *l2cap_chan) CONTAINER_OF(l2cap_chan, struct bt_l2cap_le_chan, chan); SET_FLAG(flag_l2cap_connected); - LOG_DBG("%x (tx mtu %d mps %d) (tx mtu %d mps %d)", + LOG_DBG("%x (tx mtu %d mps %d cr %ld) (tx mtu %d mps %d cr %ld)", l2cap_chan, chan->tx.mtu, chan->tx.mps, + atomic_get(&chan->tx.credits), chan->rx.mtu, - chan->rx.mps); + chan->rx.mps, + atomic_get(&chan->rx.credits)); } -void l2cap_chan_disconnected_cb(struct bt_l2cap_chan *chan) +void l2cap_chan_disconnected_cb(struct bt_l2cap_chan *l2cap_chan) { UNSET_FLAG(flag_l2cap_connected); - LOG_DBG("%p", chan); + LOG_DBG("%p", l2cap_chan); + for (int i = 0; i < L2CAP_CHANS; i++) { + if (&contexts[i].le_chan == CONTAINER_OF(l2cap_chan, + struct bt_l2cap_le_chan, chan)) { + if (contexts[i].tx_left > 0) { + LOG_INF("setting tx_left to 0 because of disconnect"); + contexts[i].tx_left = 0; + } + break; + } + } } static struct bt_l2cap_chan_ops ops = { .connected = l2cap_chan_connected_cb, .disconnected = l2cap_chan_disconnected_cb, .alloc_buf = alloc_buf_cb, +#ifdef CONFIG_BT_L2CAP_SEG_RECV + .seg_recv = seg_recv_cb, +#else .recv = recv_cb, +#endif .sent = sent_cb, }; @@ -234,6 +320,10 @@ int server_accept_cb(struct bt_conn *conn, struct bt_l2cap_server *server, memset(le_chan, 0, sizeof(*le_chan)); le_chan->chan.ops = &ops; le_chan->rx.mtu = SDU_LEN; +#ifdef CONFIG_BT_L2CAP_SEG_RECV + le_chan->rx.mps = BT_L2CAP_RX_MTU; + le_chan->rx.credits = CONFIG_BT_BUF_ACL_RX_COUNT_EXTRA; +#endif *chan = &le_chan->chan; return 0; @@ -335,15 +425,93 @@ static void test_peripheral_main(void) LOG_DBG("Registered server PSM %x", psm); LOG_DBG("Peripheral waiting for transfer completion"); - while (rx_cnt < SDU_NUM) { + while (sdu_rx_cnt < SDU_NUM) { + k_msleep(100); + } + + bt_conn_foreach(BT_CONN_TYPE_LE, disconnect_device, NULL); + + WAIT_FOR_FLAG_UNSET(is_connected); + LOG_INF("Total received: %d", sdu_rx_cnt); + + /* check that all buffers returned to pool */ + TEST_ASSERT(atomic_get(&sdu_tx_pool.avail_count) == CONFIG_BT_MAX_CONN, + "sdu_tx_pool has non returned buffers, should be %u but is %u", + CONFIG_BT_MAX_CONN, atomic_get(&sdu_tx_pool.avail_count)); + TEST_ASSERT(atomic_get(&sdu_rx_pool.avail_count) == CONFIG_BT_MAX_CONN, + "sdu_rx_pool has non returned buffers, should be %u but is %u", + CONFIG_BT_MAX_CONN, atomic_get(&sdu_rx_pool.avail_count)); + + TEST_PASS("L2CAP STRESS Peripheral passed"); +} + +static void test_peripheral_early_disconnect_main(void) +{ + device_nbr = bsim_args_get_global_device_nbr(); + LOG_DBG("*L2CAP STRESS EARLY DISCONNECT Peripheral started*"); + int err; + + /* Prepare tx_data */ + for (size_t i = 0; i < sizeof(tx_data); i++) { + tx_data[i] = (uint8_t)i; + } + + err = bt_enable(NULL); + if (err) { + TEST_FAIL("Can't enable Bluetooth (err %d)", err); + return; + } + + LOG_DBG("Peripheral Bluetooth initialized."); + LOG_DBG("Connectable advertising..."); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, NULL, 0, NULL, 0); + if (err) { + TEST_FAIL("Advertising failed to start (err %d)", err); + return; + } + + LOG_DBG("Advertising started."); + LOG_DBG("Peripheral waiting for connection..."); + WAIT_FOR_FLAG(is_connected); + LOG_DBG("Peripheral Connected."); + + int psm = l2cap_server_register(BT_SECURITY_L1); + + LOG_DBG("Registered server PSM %x", psm); + + if (device_nbr == 2) { + LOG_INF("disconnecting before receiving any SDU"); + k_msleep(1000); + goto disconnect; + } + + LOG_DBG("Peripheral waiting for transfer completion"); + while (sdu_rx_cnt < SDU_NUM) { + if ((device_nbr == 3) && (sdu_rx_cnt >= 1)) { + LOG_INF("disconnecting after receiving SDU %u", sdu_rx_cnt); + break; + } + k_msleep(100); + if (!is_connected) { + goto done; + } } +disconnect: bt_conn_foreach(BT_CONN_TYPE_LE, disconnect_device, NULL); +done: + WAIT_FOR_FLAG_UNSET(is_connected); - LOG_INF("Total received: %d", rx_cnt); + LOG_INF("Total received: %d", sdu_rx_cnt); - TEST_ASSERT(rx_cnt == SDU_NUM, "Did not receive expected no of SDUs"); + /* check that all buffers returned to pool */ + TEST_ASSERT(atomic_get(&sdu_tx_pool.avail_count) == CONFIG_BT_MAX_CONN, + "sdu_tx_pool has non returned buffers, should be %u but is %u", + CONFIG_BT_MAX_CONN, atomic_get(&sdu_tx_pool.avail_count)); + TEST_ASSERT(atomic_get(&sdu_rx_pool.avail_count) == CONFIG_BT_MAX_CONN, + "sdu_rx_pool has non returned buffers, should be %u but is %u", + CONFIG_BT_MAX_CONN, atomic_get(&sdu_rx_pool.avail_count)); TEST_PASS("L2CAP STRESS Peripheral passed"); } @@ -405,6 +573,10 @@ static void connect_l2cap_channel(struct bt_conn *conn, void *data) le_chan->chan.ops = &ops; le_chan->rx.mtu = SDU_LEN; +#ifdef CONFIG_BT_L2CAP_SEG_RECV + le_chan->rx.mps = BT_L2CAP_RX_MTU; + le_chan->rx.credits = CONFIG_BT_BUF_ACL_RX_COUNT_EXTRA; +#endif UNSET_FLAG(flag_l2cap_connected); @@ -461,6 +633,14 @@ static void test_central_main(void) } LOG_DBG("All peripherals disconnected."); + /* check that all buffers returned to pool */ + TEST_ASSERT(atomic_get(&sdu_tx_pool.avail_count) == CONFIG_BT_MAX_CONN, + "sdu_tx_pool has non returned buffers, should be %u but is %u", + CONFIG_BT_MAX_CONN, atomic_get(&sdu_tx_pool.avail_count)); + TEST_ASSERT(atomic_get(&sdu_rx_pool.avail_count) == CONFIG_BT_MAX_CONN, + "sdu_rx_pool has non returned buffers, should be %u but is %u", + CONFIG_BT_MAX_CONN, atomic_get(&sdu_rx_pool.avail_count)); + TEST_PASS("L2CAP STRESS Central passed"); } @@ -470,6 +650,11 @@ static const struct bst_test_instance test_def[] = { .test_descr = "Peripheral L2CAP STRESS", .test_main_f = test_peripheral_main }, + { + .test_id = "peripheral_early_disconnect", + .test_descr = "Peripheral L2CAP STRESS EARLY DISCONNECT", + .test_main_f = test_peripheral_early_disconnect_main, + }, { .test_id = "central", .test_descr = "Central L2CAP STRESS", diff --git a/tests/bsim/bluetooth/host/l2cap/stress/testcase.yaml b/tests/bsim/bluetooth/host/l2cap/stress/testcase.yaml index f872f5873dae..8fbe85a3b646 100644 --- a/tests/bsim/bluetooth/host/l2cap/stress/testcase.yaml +++ b/tests/bsim/bluetooth/host/l2cap/stress/testcase.yaml @@ -10,6 +10,10 @@ tests: bluetooth.host.l2cap.stress: harness_config: bsim_exe_name: tests_bsim_bluetooth_host_l2cap_stress_prj_conf + bluetooth.host.l2cap.stress_early_disconnect: + harness_config: + bsim_exe_name: tests_bsim_bluetooth_host_l2cap_stress_prj_conf_overlay-early-disc_conf + extra_args: EXTRA_CONF_FILE="overlay-early-disconnect.conf" bluetooth.host.l2cap.stress_nofrag: harness_config: bsim_exe_name: tests_bsim_bluetooth_host_l2cap_stress_prj_conf_overlay-nofrag_conf diff --git a/tests/bsim/bluetooth/host/l2cap/stress/tests_scripts/l2cap_early_disconnect.sh b/tests/bsim/bluetooth/host/l2cap/stress/tests_scripts/l2cap_early_disconnect.sh new file mode 100755 index 000000000000..8741839e762f --- /dev/null +++ b/tests/bsim/bluetooth/host/l2cap/stress/tests_scripts/l2cap_early_disconnect.sh @@ -0,0 +1,47 @@ +#!/usr/bin/env bash +# Copyright (c) 2025 Google LLC +# SPDX-License-Identifier: Apache-2.0 + +source ${ZEPHYR_BASE}/tests/bsim/sh_common.source + +# Tests cleanup within the ble stack for L2CAP connections when +# peripheral disconnects early while the central still has +# buffers queued for sending. Using the base code, which +# has the central sending 20 SDUs to 6 different peripherals, +# the test has the peripherals disconnect as follows: +# +# Peripheral 1: disconnects after all 20 SDUs as before +# Peripheral 2: disconnects immediately before receiving anything +# Peripheral 3: disconnects after receiving first SDU +# Peripheral 4: disconnects after receiving first PDU in second SDU +# Peripheral 5: disconnects after receiving third PDU in third SDU +# Peripheral 6: disconnects atfer receiving tenth PDU in tenth SDU +# +# The central and peripherals check that all tx_pool and rx_pool +# buffers have been returned after the disconnect. +simulation_id="l2cap_stress_early_disconnect" +verbosity_level=2 +EXECUTE_TIMEOUT=240 + +bsim_exe=./bs_${BOARD_TS}_tests_bsim_bluetooth_host_l2cap_stress_prj_conf_overlay-early-disc_conf + +cd ${BSIM_OUT_PATH}/bin + +Execute "${bsim_exe}" -v=${verbosity_level} -s=${simulation_id} -d=0 -testid=central -rs=43 + +Execute "${bsim_exe}" -v=${verbosity_level} -s=${simulation_id} -d=1 \ + -testid=peripheral_early_disconnect -rs=42 +Execute "${bsim_exe}" -v=${verbosity_level} -s=${simulation_id} -d=2 \ + -testid=peripheral_early_disconnect -rs=10 +Execute "${bsim_exe}" -v=${verbosity_level} -s=${simulation_id} -d=3 \ + -testid=peripheral_early_disconnect -rs=23 +Execute "${bsim_exe}" -v=${verbosity_level} -s=${simulation_id} -d=4 \ + -testid=peripheral_early_disconnect -rs=7884 +Execute "${bsim_exe}" -v=${verbosity_level} -s=${simulation_id} -d=5 \ + -testid=peripheral_early_disconnect -rs=230 +Execute "${bsim_exe}" -v=${verbosity_level} -s=${simulation_id} -d=6 \ + -testid=peripheral_early_disconnect -rs=9 + +Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s=${simulation_id} -D=7 -sim_length=400e6 $@ + +wait_for_background_jobs From 1c01e1ddefa29efcab98de30f52c8e4ae994cb01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Thu, 24 Jul 2025 07:19:48 +0200 Subject: [PATCH 0341/2141] [nrf fromtree] samples: drivers: adc: Fix License in board overlays MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Board overlays were moved from downstream to upstream. By mistake, License was left unchanged. Change License type to match with the upstream. Signed-off-by: Sebastian Głąb (cherry picked from commit 35a170fb9009dd0c81ad49d2fcaa06d0a731af94) --- .../adc/adc_dt/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 2 +- .../adc_sequence/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/drivers/adc/adc_dt/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/samples/drivers/adc/adc_dt/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay index 8953de6a5475..a93e578fca7a 100644 --- a/samples/drivers/adc/adc_dt/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ b/samples/drivers/adc/adc_dt/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -1,7 +1,7 @@ /* * Copyright (c) 2025 Nordic Semiconductor ASA * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + * SPDX-License-Identifier: Apache-2.0 */ / { diff --git a/samples/drivers/adc/adc_sequence/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/samples/drivers/adc/adc_sequence/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay index a85e9e7e611c..a83d64e864e5 100644 --- a/samples/drivers/adc/adc_sequence/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ b/samples/drivers/adc/adc_sequence/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -1,7 +1,7 @@ /* * Copyright (c) 2025 Nordic Semiconductor ASA * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + * SPDX-License-Identifier: Apache-2.0 */ / { From f18ae796f22bc1f12a1ed8a73484b4a4d8019eb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Thu, 24 Jul 2025 07:24:14 +0200 Subject: [PATCH 0342/2141] [nrf fromtree] tests: drivers: adc: Fix License in board overlay MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Board overlay was moved from downstream to upstream. By mistake, License was left unchanged. Change License type to match with the upstream. Signed-off-by: Sebastian Głąb (cherry picked from commit b3949e3526e903a5521da9646a6c15298068ec7e) --- .../boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/drivers/adc/adc_accuracy_test/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/adc/adc_accuracy_test/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay index bc68f3c8d34f..b11dcebc3d3e 100644 --- a/tests/drivers/adc/adc_accuracy_test/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ b/tests/drivers/adc/adc_accuracy_test/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -1,7 +1,7 @@ /* * Copyright (c) 2025 Nordic Semiconductor ASA * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + * SPDX-License-Identifier: Apache-2.0 */ /* From 24d020f2f5652ee4e9110c190210e25a9078d969 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Tue, 24 Jun 2025 11:27:58 +0200 Subject: [PATCH 0343/2141] [nrf fromtree] manifest: Update hal_nordic with updated cracen hal and rng driver Update with the latest nordic hal which includes an updated CRACEN driver which supports the 54LM20 and newer devices Signed-off-by: Alberto Escolar Piedras (cherry picked from commit ce0d65a35c0e0fdd89c7b697708615e09c04c70c) --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index d15e692caa4d..20d4800519a9 100644 --- a/west.yml +++ b/west.yml @@ -200,7 +200,7 @@ manifest: groups: - hal - name: hal_nordic - revision: 71308dc6d8c021887ce5d98a36cafe9517375a91 + revision: 9587b1dcb83d24ab74e89837843a5f7d573f7059 path: modules/hal/nordic groups: - hal From 79a29d4e2fc05a59ff10f8287a7f79f36c452b54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Mon, 16 Jun 2025 07:53:43 +0200 Subject: [PATCH 0344/2141] [nrf fromtree] drivers: adc_nrfx_saadc: Remove dead and misleading code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For a long time (since version 3.3.0) nrfx contained an incorrectly defined symbol NRF_SAADC_8BIT_SAMPLE_WIDTH that was set to 8 for nRF54L and nRF54H Series SoCs, which was probably only true for very early engineering revisions of those. Based on this, the adc_nrfx_saadc driver was incorrectly writing consecutive 8-bit samples in supplied buffers, cutting off the highest 8 bits of the results. And for sequences with multiple channels, it was even causing that the results written as 16-bit words by hardware were partially overwritten in next iteration. In nrfx 3.12.0 (see commit f46798fa55881e6e24bb121d867c7753d4c6b775) this was finally corrected - the symbol is now deprecated and it is always set to 16. This commit is a follow-up to the above and removes parts of adc_nrfx_saadc that now became dead code to prevent further confusion regarding 8-bit sampling. Signed-off-by: Andrzej Głąbek (cherry picked from commit 616ec7522ccee368b1f6c5c1d27ad54a999279fe) --- drivers/adc/adc_nrfx_saadc.c | 31 +++++-------------------------- 1 file changed, 5 insertions(+), 26 deletions(-) diff --git a/drivers/adc/adc_nrfx_saadc.c b/drivers/adc/adc_nrfx_saadc.c index 986cca49af8f..54719a1136df 100644 --- a/drivers/adc/adc_nrfx_saadc.c +++ b/drivers/adc/adc_nrfx_saadc.c @@ -141,12 +141,8 @@ static struct driver_data m_data = { }; /* Helper function to convert number of samples to the byte representation. */ -static uint32_t samples_to_bytes(const struct adc_sequence *sequence, uint16_t number_of_samples) +static uint32_t samples_to_bytes(uint16_t number_of_samples) { - if (NRF_SAADC_8BIT_SAMPLE_WIDTH == 8 && sequence->resolution == 8) { - return number_of_samples; - } - return number_of_samples * 2; } @@ -410,11 +406,11 @@ static void adc_context_update_buffer_pointer(struct adc_context *ctx, if (!repeat) { #if defined(ADC_BUFFER_IN_RAM) m_data.user_buffer = (uint8_t *)m_data.user_buffer + - samples_to_bytes(&ctx->sequence, nrfy_saadc_amount_get(NRF_SAADC)); + samples_to_bytes(nrfy_saadc_amount_get(NRF_SAADC)); #else nrf_saadc_value_t *buffer = (uint8_t *)nrf_saadc_buffer_pointer_get(NRF_SAADC) + - samples_to_bytes(&ctx->sequence, nrfy_saadc_amount_get(NRF_SAADC)); + samples_to_bytes(nrfy_saadc_amount_get(NRF_SAADC)); nrfy_saadc_buffer_pointer_set(NRF_SAADC, buffer); #endif } @@ -501,7 +497,7 @@ static int check_buffer_size(const struct adc_sequence *sequence, { size_t needed_buffer_size; - needed_buffer_size = samples_to_bytes(sequence, active_channels); + needed_buffer_size = samples_to_bytes(active_channels); if (sequence->options) { needed_buffer_size *= (1 + sequence->options->extra_samplings); @@ -546,7 +542,6 @@ static int start_read(const struct device *dev, { int error; uint32_t selected_channels = sequence->channels; - uint8_t resolution = sequence->resolution; uint8_t active_channels; uint8_t channel_id; nrf_saadc_burst_t burst; @@ -576,22 +571,6 @@ static int start_read(const struct device *dev, channel_id); return -EINVAL; } - /* Signal an error if the channel is configured as - * single ended with a resolution which is identical - * to the sample bit size. The SAADC's "single ended" - * mode is really differential mode with the - * negative input tied to ground. We can therefore - * observe negative values if the positive input falls - * below ground. If the sample bitsize is larger than - * the resolution, we can detect negative values and - * correct them to 0 after the sequencen has ended. - */ - if ((m_data.single_ended_channels & BIT(channel_id)) && - (NRF_SAADC_8BIT_SAMPLE_WIDTH == 8 && resolution == 8)) { - LOG_ERR("Channel %u invalid single ended resolution", - channel_id); - return -EINVAL; - } /* When oversampling is used, the burst mode needs to * be activated. Unfortunately, this mode cannot be * activated permanently in the channel setup, because @@ -713,7 +692,7 @@ static void saadc_irq_handler(const struct device *dev) #if defined(ADC_BUFFER_IN_RAM) memcpy(m_data.user_buffer, m_data.samples_buffer, - samples_to_bytes(&m_data.ctx.sequence, m_data.active_channels)); + samples_to_bytes(m_data.active_channels)); #endif adc_context_on_sampling_done(&m_data.ctx, dev); From 52154394a286dddc16b522599f2f5f144b38bec6 Mon Sep 17 00:00:00 2001 From: Jakub Zymelka Date: Mon, 16 Jun 2025 15:03:37 +0200 Subject: [PATCH 0345/2141] [nrf fromtree] modules: hal_nordic: nrfx: Update NRFX API version to 3.12 Update NRFX_CONFIG_API_VER_MINOR to 12, to be compatible with latest SAADC driver changes. Signed-off-by: Jakub Zymelka (cherry picked from commit be8c61ab809faa793609cabe2201edd38c2c77a4) --- modules/hal_nordic/nrfx/nrfx_config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index 4a2d5af18b64..fac2341c1c55 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -9,7 +9,7 @@ /* Define nrfx API version used in Zephyr. */ #define NRFX_CONFIG_API_VER_MAJOR 3 -#define NRFX_CONFIG_API_VER_MINOR 8 +#define NRFX_CONFIG_API_VER_MINOR 12 #define NRFX_CONFIG_API_VER_MICRO 0 /* Macros used in zephyr-specific config files. */ From 812e93bc9f8fc0a0721b46fd94f4b69f78a379fd Mon Sep 17 00:00:00 2001 From: Jakub Zymelka Date: Tue, 27 May 2025 11:57:13 +0200 Subject: [PATCH 0346/2141] [nrf fromtree] drivers: adc: rework Nordic SAADC driver SHIM Nordic modification for the ADC driver controlling the SAADC peripheral. Replaced HAL based implementation in favor of nrfx driver. As a next step, it is planned to implement a feature that will allow the peripheral SAADC timer to be used for sampling, and for this it is necessary to use the nrfx driver in this SHIM. This will allow more accurate and faster sampling than the kernel mechanism currently provides. Signed-off-by: Jakub Zymelka (cherry picked from commit f3d250742377ac24af0bc4bf78dd61afaefc2479) --- drivers/adc/Kconfig.nrfx | 1 + drivers/adc/adc_nrfx_saadc.c | 518 +++++++++++++++-------------------- 2 files changed, 222 insertions(+), 297 deletions(-) diff --git a/drivers/adc/Kconfig.nrfx b/drivers/adc/Kconfig.nrfx index d411d5c99e10..0a602f5b97bf 100644 --- a/drivers/adc/Kconfig.nrfx +++ b/drivers/adc/Kconfig.nrfx @@ -27,5 +27,6 @@ config ADC_NRFX_SAADC default y depends on DT_HAS_NORDIC_NRF_SAADC_ENABLED select ADC_CONFIGURABLE_INPUTS + select NRFX_SAADC help Enable support for nrfx SAADC driver. diff --git a/drivers/adc/adc_nrfx_saadc.c b/drivers/adc/adc_nrfx_saadc.c index 54719a1136df..f9f136f25093 100644 --- a/drivers/adc/adc_nrfx_saadc.c +++ b/drivers/adc/adc_nrfx_saadc.c @@ -6,18 +6,15 @@ #define ADC_CONTEXT_USES_KERNEL_TIMER #include "adc_context.h" -#include +#include #include #include #include #include -#include -#include - -#define LOG_LEVEL CONFIG_ADC_LOG_LEVEL #include #include -LOG_MODULE_REGISTER(adc_nrfx_saadc); + +LOG_MODULE_REGISTER(adc_nrfx_saadc, CONFIG_ADC_LOG_LEVEL); #define DT_DRV_COMPAT nordic_nrf_saadc @@ -103,16 +100,9 @@ BUILD_ASSERT((NRF_SAADC_AIN0 == NRF_SAADC_INPUT_AIN0) && #endif #if defined(CONFIG_NRF_PLATFORM_HALTIUM) - +#include /* Haltium devices always use bounce buffers in RAM */ - -#define SAADC_MEMORY_SECTION \ - COND_CODE_1(DT_NODE_HAS_PROP(DT_NODELABEL(adc), memory_regions), \ - (__attribute__((__section__(LINKER_DT_NODE_REGION_NAME( \ - DT_PHANDLE(DT_NODELABEL(adc), memory_regions)))))), \ - ()) - -static uint16_t adc_samples_buffer[SAADC_CH_NUM] SAADC_MEMORY_SECTION; +static uint16_t adc_samples_buffer[SAADC_CH_NUM] DMM_MEMORY_SECTION(DT_NODELABEL(adc)); #define ADC_BUFFER_IN_RAM @@ -120,14 +110,13 @@ static uint16_t adc_samples_buffer[SAADC_CH_NUM] SAADC_MEMORY_SECTION; struct driver_data { struct adc_context ctx; - - uint8_t positive_inputs[SAADC_CH_NUM]; uint8_t single_ended_channels; + nrf_saadc_value_t *buffer; /* Pointer to the buffer with converted samples. */ + uint8_t active_channel_cnt; #if defined(ADC_BUFFER_IN_RAM) void *samples_buffer; void *user_buffer; - uint8_t active_channels; #endif }; @@ -140,41 +129,37 @@ static struct driver_data m_data = { #endif }; -/* Helper function to convert number of samples to the byte representation. */ -static uint32_t samples_to_bytes(uint16_t number_of_samples) -{ - return number_of_samples * 2; -} +/* Forward declaration */ +static void event_handler(const nrfx_saadc_evt_t *event); /* Helper function to convert acquisition time to register TACQ value. */ -static int adc_convert_acq_time(uint16_t acquisition_time, nrf_saadc_acqtime_t *p_tacq_val) +static int acq_time_set(nrf_saadc_channel_config_t *ch_cfg, uint16_t acquisition_time) { - int result = 0; - #if NRF_SAADC_HAS_ACQTIME_ENUM switch (acquisition_time) { case ADC_ACQ_TIME(ADC_ACQ_TIME_MICROSECONDS, 3): - *p_tacq_val = NRF_SAADC_ACQTIME_3US; + ch_cfg->acq_time = NRF_SAADC_ACQTIME_3US; break; case ADC_ACQ_TIME(ADC_ACQ_TIME_MICROSECONDS, 5): - *p_tacq_val = NRF_SAADC_ACQTIME_5US; + ch_cfg->acq_time = NRF_SAADC_ACQTIME_5US; break; case ADC_ACQ_TIME_DEFAULT: case ADC_ACQ_TIME(ADC_ACQ_TIME_MICROSECONDS, 10): - *p_tacq_val = NRF_SAADC_ACQTIME_10US; + ch_cfg->acq_time = NRF_SAADC_ACQTIME_10US; break; case ADC_ACQ_TIME(ADC_ACQ_TIME_MICROSECONDS, 15): - *p_tacq_val = NRF_SAADC_ACQTIME_15US; + ch_cfg->acq_time = NRF_SAADC_ACQTIME_15US; break; case ADC_ACQ_TIME(ADC_ACQ_TIME_MICROSECONDS, 20): - *p_tacq_val = NRF_SAADC_ACQTIME_20US; + ch_cfg->acq_time = NRF_SAADC_ACQTIME_20US; break; case ADC_ACQ_TIME_MAX: case ADC_ACQ_TIME(ADC_ACQ_TIME_MICROSECONDS, 40): - *p_tacq_val = NRF_SAADC_ACQTIME_40US; + ch_cfg->acq_time = NRF_SAADC_ACQTIME_40US; break; default: - result = -EINVAL; + LOG_ERR("Selected ADC acquisition time is not valid"); + return -EINVAL; } #else #define MINIMUM_ACQ_TIME_IN_NS 125 @@ -191,130 +176,138 @@ static int adc_convert_acq_time(uint16_t acquisition_time, nrf_saadc_acqtime_t * tacq = (nrf_saadc_acqtime_t)(acq_time / MINIMUM_ACQ_TIME_IN_NS) - 1; if ((tacq > NRF_SAADC_ACQTIME_MAX) || (acq_time < MINIMUM_ACQ_TIME_IN_NS)) { - result = -EINVAL; + LOG_ERR("Selected ADC acquisition time is not valid"); + return -EINVAL; } else { - *p_tacq_val = tacq; + ch_cfg->acq_time = tacq; } #endif - return result; + LOG_DBG("ADC acquisition_time: %d", acquisition_time); + + return 0; } -static int saadc_pm_hook(const struct device *dev, enum pm_device_action action) +static int input_assign(nrf_saadc_input_t *pin_p, + nrf_saadc_input_t *pin_n, + const struct adc_channel_cfg *channel_cfg) { - ARG_UNUSED(dev); - - switch (action) { - case PM_DEVICE_ACTION_SUSPEND: - nrf_saadc_disable(NRF_SAADC); - return 0; +#if (NRF_SAADC_HAS_AIN_AS_PIN) + if (channel_cfg->input_positive > ARRAY_SIZE(saadc_psels) || + channel_cfg->input_positive < NRF_SAADC_AIN0) { + LOG_ERR("Invalid analog positive input number: %d", channel_cfg->input_positive); + return -EINVAL; + } - case PM_DEVICE_ACTION_RESUME: - nrf_saadc_enable(NRF_SAADC); - return 0; + *pin_p = saadc_psels[channel_cfg->input_positive]; - default: - break; + if (channel_cfg->differential) { + if (channel_cfg->input_negative > ARRAY_SIZE(saadc_psels) || + channel_cfg->input_negative < NRF_SAADC_AIN0 || + (IS_ENABLED(CONFIG_NRF_PLATFORM_HALTIUM) && + (channel_cfg->input_positive > NRF_SAADC_AIN7) != + (channel_cfg->input_negative > NRF_SAADC_AIN7))) { + LOG_ERR("Invalid analog negative input number: %d", + channel_cfg->input_negative); + return -EINVAL; + } + *pin_n = saadc_psels[channel_cfg->input_negative]; + } else { + *pin_n = NRF_SAADC_INPUT_DISABLED; } +#else + *pin_p = channel_cfg->input_positive; + *pin_n = channel_cfg->differential ? channel_cfg->input_negative + : NRF_SAADC_INPUT_DISABLED; +#endif + LOG_DBG("ADC positive input: %d", *pin_p); + LOG_DBG("ADC negative input: %d", *pin_n); - return -ENOTSUP; + return 0; } -/* Implementation of the ADC driver API function: adc_channel_setup. */ -static int adc_nrfx_channel_setup(const struct device *dev, - const struct adc_channel_cfg *channel_cfg) +static int gain_set(nrf_saadc_channel_config_t *ch_cfg, enum adc_gain gain) { - nrf_saadc_channel_config_t config = { -#if NRF_SAADC_HAS_CH_CONFIG_RES - .resistor_p = NRF_SAADC_RESISTOR_DISABLED, - .resistor_n = NRF_SAADC_RESISTOR_DISABLED, -#endif -#if NRF_SAADC_HAS_CH_BURST - .burst = NRF_SAADC_BURST_DISABLED, -#endif - }; - uint8_t channel_id = channel_cfg->channel_id; - uint32_t input_negative = channel_cfg->input_negative; - - if (channel_id >= SAADC_CH_NUM) { - return -EINVAL; - } - #if NRF_SAADC_HAS_CH_GAIN - switch (channel_cfg->gain) { + switch (gain) { #if defined(SAADC_CH_CONFIG_GAIN_Gain1_6) case ADC_GAIN_1_6: - config.gain = NRF_SAADC_GAIN1_6; + ch_cfg->gain = NRF_SAADC_GAIN1_6; break; #endif #if defined(SAADC_CH_CONFIG_GAIN_Gain1_5) case ADC_GAIN_1_5: - config.gain = NRF_SAADC_GAIN1_5; + ch_cfg->gain = NRF_SAADC_GAIN1_5; break; #endif #if defined(SAADC_CH_CONFIG_GAIN_Gain1_4) || defined(SAADC_CH_CONFIG_GAIN_Gain2_8) case ADC_GAIN_1_4: - config.gain = NRF_SAADC_GAIN1_4; + ch_cfg->gain = NRF_SAADC_GAIN1_4; break; #endif #if defined(SAADC_CH_CONFIG_GAIN_Gain2_7) case ADC_GAIN_2_7: - config.gain = NRF_SAADC_GAIN2_7; + ch_cfg->gain = NRF_SAADC_GAIN2_7; break; #endif #if defined(SAADC_CH_CONFIG_GAIN_Gain1_3) || defined(SAADC_CH_CONFIG_GAIN_Gain2_6) case ADC_GAIN_1_3: - config.gain = NRF_SAADC_GAIN1_3; + ch_cfg->gain = NRF_SAADC_GAIN1_3; break; #endif #if defined(SAADC_CH_CONFIG_GAIN_Gain2_5) case ADC_GAIN_2_5: - config.gain = NRF_SAADC_GAIN2_5; + ch_cfg->gain = NRF_SAADC_GAIN2_5; break; #endif #if defined(SAADC_CH_CONFIG_GAIN_Gain1_2) || defined(SAADC_CH_CONFIG_GAIN_Gain2_4) case ADC_GAIN_1_2: - config.gain = NRF_SAADC_GAIN1_2; + ch_cfg->gain = NRF_SAADC_GAIN1_2; break; #endif #if defined(SAADC_CH_CONFIG_GAIN_Gain2_3) case ADC_GAIN_2_3: - config.gain = NRF_SAADC_GAIN2_3; + ch_cfg->gain = NRF_SAADC_GAIN2_3; break; #endif case ADC_GAIN_1: - config.gain = NRF_SAADC_GAIN1; + ch_cfg->gain = NRF_SAADC_GAIN1; break; case ADC_GAIN_2: - config.gain = NRF_SAADC_GAIN2; + ch_cfg->gain = NRF_SAADC_GAIN2; break; #if defined(SAADC_CH_CONFIG_GAIN_Gain4) case ADC_GAIN_4: - config.gain = NRF_SAADC_GAIN4; + ch_cfg->gain = NRF_SAADC_GAIN4; break; #endif default: #else - if (channel_cfg->gain != ADC_GAIN_1) { + if (ch_cfg->gain != ADC_GAIN_1) { #endif /* defined(NRF_SAADC_HAS_CH_GAIN) */ LOG_ERR("Selected ADC gain is not valid"); return -EINVAL; } - switch (channel_cfg->reference) { + return 0; +} + +static int reference_set(nrf_saadc_channel_config_t *ch_cfg, enum adc_reference reference) +{ + switch (reference) { #if defined(SAADC_CH_CONFIG_REFSEL_Internal) case ADC_REF_INTERNAL: - config.reference = NRF_SAADC_REFERENCE_INTERNAL; + ch_cfg->reference = NRF_SAADC_REFERENCE_INTERNAL; break; #endif #if defined(SAADC_CH_CONFIG_REFSEL_VDD1_4) case ADC_REF_VDD_1_4: - config.reference = NRF_SAADC_REFERENCE_VDD4; + ch_cfg->reference = NRF_SAADC_REFERENCE_VDD4; break; #endif #if defined(SAADC_CH_CONFIG_REFSEL_External) case ADC_REF_EXTERNAL0: - config.reference = NRF_SAADC_REFERENCE_EXTERNAL; + ch_cfg->reference = NRF_SAADC_REFERENCE_EXTERNAL; break; #endif default: @@ -322,133 +315,130 @@ static int adc_nrfx_channel_setup(const struct device *dev, return -EINVAL; } - int ret = adc_convert_acq_time(channel_cfg->acquisition_time, &config.acq_time); + return 0; +} - if (ret) { - LOG_ERR("Selected ADC acquisition time is not valid"); +/* Implementation of the ADC driver API function: adc_channel_setup. */ +static int adc_nrfx_channel_setup(const struct device *dev, + const struct adc_channel_cfg *channel_cfg) +{ + int err; + nrf_saadc_channel_config_t *ch_cfg; + nrfx_saadc_channel_t cfg = { + .channel_config = { +#if NRF_SAADC_HAS_CH_CONFIG_RES + .resistor_p = NRF_SAADC_RESISTOR_DISABLED, + .resistor_n = NRF_SAADC_RESISTOR_DISABLED, +#endif +#if NRF_SAADC_HAS_CH_BURST + .burst = NRF_SAADC_BURST_DISABLED, +#endif + }, + .channel_index = channel_cfg->channel_id, + }; + + if (channel_cfg->channel_id >= SAADC_CH_NUM) { + LOG_ERR("Invalid channel ID: %d", channel_cfg->channel_id); return -EINVAL; } + ch_cfg = &cfg.channel_config; + + err = input_assign(&cfg.pin_p, &cfg.pin_n, channel_cfg); + if (err != 0) { + return err; + } + + err = gain_set(ch_cfg, channel_cfg->gain); + if (err != 0) { + return err; + } + + err = reference_set(ch_cfg, channel_cfg->reference); + if (err != 0) { + return err; + } + + err = acq_time_set(ch_cfg, channel_cfg->acquisition_time); + if (err != 0) { + return err; + } + /* Store channel mode to allow correcting negative readings in single-ended mode * after ADC sequence ends. */ if (channel_cfg->differential) { - config.mode = NRF_SAADC_MODE_DIFFERENTIAL; + ch_cfg->mode = NRF_SAADC_MODE_DIFFERENTIAL; m_data.single_ended_channels &= ~BIT(channel_cfg->channel_id); } else { - config.mode = NRF_SAADC_MODE_SINGLE_ENDED; + ch_cfg->mode = NRF_SAADC_MODE_SINGLE_ENDED; m_data.single_ended_channels |= BIT(channel_cfg->channel_id); } -#if (NRF_SAADC_HAS_AIN_AS_PIN) - if ((channel_cfg->input_positive >= ARRAY_SIZE(saadc_psels)) || - (channel_cfg->input_positive < NRF_SAADC_AIN0)) { - return -EINVAL; - } - - if (config.mode == NRF_SAADC_MODE_DIFFERENTIAL) { -#if defined(CONFIG_NRF_PLATFORM_HALTIUM) - if ((input_negative > NRF_SAADC_AIN7) != - (channel_cfg->input_positive > NRF_SAADC_AIN7)) { -#else - if (input_negative > NRF_SAADC_AIN7 || - input_negative < NRF_SAADC_AIN0) { -#endif - return -EINVAL; - } + nrfx_err_t ret = nrfx_saadc_channel_config(&cfg); - input_negative = saadc_psels[input_negative]; - } else { - input_negative = NRF_SAADC_INPUT_DISABLED; + if (ret != NRFX_SUCCESS) { + LOG_ERR("Cannot configure channel %d: %d", channel_cfg->channel_id, ret); + return -EINVAL; } -#endif - /* Store the positive input selection in a dedicated array, - * to get it later when the channel is selected for a sampling - * and to mark the channel as configured (ready to be selected). - */ - m_data.positive_inputs[channel_id] = channel_cfg->input_positive; - - nrf_saadc_channel_init(NRF_SAADC, channel_id, &config); - /* Keep the channel disabled in hardware (set positive input to - * NRF_SAADC_INPUT_DISABLED) until it is selected to be included - * in a sampling sequence. - */ - nrf_saadc_channel_input_set(NRF_SAADC, - channel_id, - NRF_SAADC_INPUT_DISABLED, - input_negative); return 0; } static void adc_context_start_sampling(struct adc_context *ctx) { -#if defined(CONFIG_PM_DEVICE_RUNTIME) - pm_device_runtime_get(DEVICE_DT_INST_GET(0)); -#else - nrf_saadc_enable(NRF_SAADC); -#endif - if (ctx->sequence.calibrate) { - nrf_saadc_task_trigger(NRF_SAADC, - NRF_SAADC_TASK_CALIBRATEOFFSET); + nrfx_saadc_offset_calibrate(event_handler); } else { - nrf_saadc_task_trigger(NRF_SAADC, NRF_SAADC_TASK_START); - nrf_saadc_task_trigger(NRF_SAADC, NRF_SAADC_TASK_SAMPLE); + nrfx_err_t ret = nrfx_saadc_mode_trigger(); + + if (ret != NRFX_SUCCESS) { + LOG_ERR("Cannot start sampling: 0x%08x", ret); + adc_context_complete(&m_data.ctx, -EIO); + } } } -static void adc_context_update_buffer_pointer(struct adc_context *ctx, - bool repeat) +static void adc_context_update_buffer_pointer(struct adc_context *ctx, bool repeat) { - ARG_UNUSED(ctx); - if (!repeat) { #if defined(ADC_BUFFER_IN_RAM) - m_data.user_buffer = (uint8_t *)m_data.user_buffer + - samples_to_bytes(nrfy_saadc_amount_get(NRF_SAADC)); + m_data.user_buffer = (uint16_t *)m_data.user_buffer + m_data.active_channel_cnt; #else - nrf_saadc_value_t *buffer = - (uint8_t *)nrf_saadc_buffer_pointer_get(NRF_SAADC) + - samples_to_bytes(nrfy_saadc_amount_get(NRF_SAADC)); - nrfy_saadc_buffer_pointer_set(NRF_SAADC, buffer); + nrf_saadc_value_t *buffer = (uint16_t *)m_data.buffer + m_data.active_channel_cnt; + + nrfx_saadc_buffer_set(buffer, m_data.active_channel_cnt); #endif } } -static int set_resolution(const struct adc_sequence *sequence) +static int get_resolution(const struct adc_sequence *sequence, nrf_saadc_resolution_t *resolution) { - nrf_saadc_resolution_t nrf_resolution; - switch (sequence->resolution) { - case 8: - nrf_resolution = NRF_SAADC_RESOLUTION_8BIT; + case 8: + *resolution = NRF_SAADC_RESOLUTION_8BIT; break; case 10: - nrf_resolution = NRF_SAADC_RESOLUTION_10BIT; + *resolution = NRF_SAADC_RESOLUTION_10BIT; break; case 12: - nrf_resolution = NRF_SAADC_RESOLUTION_12BIT; + *resolution = NRF_SAADC_RESOLUTION_12BIT; break; case 14: - nrf_resolution = NRF_SAADC_RESOLUTION_14BIT; + *resolution = NRF_SAADC_RESOLUTION_14BIT; break; default: - LOG_ERR("ADC resolution value %d is not valid", - sequence->resolution); + LOG_ERR("ADC resolution value %d is not valid", sequence->resolution); return -EINVAL; } - nrf_saadc_resolution_set(NRF_SAADC, nrf_resolution); return 0; } -static int set_oversampling(const struct adc_sequence *sequence, - uint8_t active_channels) +static int get_oversampling(const struct adc_sequence *sequence, uint8_t active_channel_cnt, + nrf_saadc_oversample_t *oversampling) { - nrf_saadc_oversample_t nrf_oversampling; - - if ((active_channels > 1) && (sequence->oversampling > 0)) { + if ((active_channel_cnt > 1) && (sequence->oversampling > 0)) { LOG_ERR( "Oversampling is supported for single channel only"); return -EINVAL; @@ -456,48 +446,45 @@ static int set_oversampling(const struct adc_sequence *sequence, switch (sequence->oversampling) { case 0: - nrf_oversampling = NRF_SAADC_OVERSAMPLE_DISABLED; + *oversampling = NRF_SAADC_OVERSAMPLE_DISABLED; break; case 1: - nrf_oversampling = NRF_SAADC_OVERSAMPLE_2X; + *oversampling = NRF_SAADC_OVERSAMPLE_2X; break; case 2: - nrf_oversampling = NRF_SAADC_OVERSAMPLE_4X; + *oversampling = NRF_SAADC_OVERSAMPLE_4X; break; case 3: - nrf_oversampling = NRF_SAADC_OVERSAMPLE_8X; + *oversampling = NRF_SAADC_OVERSAMPLE_8X; break; case 4: - nrf_oversampling = NRF_SAADC_OVERSAMPLE_16X; + *oversampling = NRF_SAADC_OVERSAMPLE_16X; break; case 5: - nrf_oversampling = NRF_SAADC_OVERSAMPLE_32X; + *oversampling = NRF_SAADC_OVERSAMPLE_32X; break; case 6: - nrf_oversampling = NRF_SAADC_OVERSAMPLE_64X; + *oversampling = NRF_SAADC_OVERSAMPLE_64X; break; case 7: - nrf_oversampling = NRF_SAADC_OVERSAMPLE_128X; + *oversampling = NRF_SAADC_OVERSAMPLE_128X; break; case 8: - nrf_oversampling = NRF_SAADC_OVERSAMPLE_256X; + *oversampling = NRF_SAADC_OVERSAMPLE_256X; break; default: - LOG_ERR("Oversampling value %d is not valid", - sequence->oversampling); + LOG_ERR("Oversampling value %d is not valid", sequence->oversampling); return -EINVAL; } - nrf_saadc_oversample_set(NRF_SAADC, nrf_oversampling); return 0; } -static int check_buffer_size(const struct adc_sequence *sequence, - uint8_t active_channels) +static int check_buffer_size(const struct adc_sequence *sequence, uint8_t active_channel_cnt) { size_t needed_buffer_size; - needed_buffer_size = samples_to_bytes(active_channels); + needed_buffer_size = NRFX_SAADC_SAMPLES_TO_BYTES(active_channel_cnt); if (sequence->options) { needed_buffer_size *= (1 + sequence->options->extra_samplings); @@ -505,7 +492,7 @@ static int check_buffer_size(const struct adc_sequence *sequence, if (sequence->buffer_size < needed_buffer_size) { LOG_ERR("Provided buffer is too small (%u/%u)", - sequence->buffer_size, needed_buffer_size); + sequence->buffer_size, needed_buffer_size); return -ENOMEM; } @@ -522,7 +509,7 @@ static void correct_single_ended(const struct adc_sequence *sequence) uint16_t channel_bit = BIT(0); uint8_t selected_channels = sequence->channels; uint8_t single_ended_channels = m_data.single_ended_channels; - int16_t *sample = nrf_saadc_buffer_pointer_get(NRF_SAADC); + int16_t *sample = (int16_t *)m_data.buffer; while (channel_bit <= single_ended_channels) { if (channel_bit & selected_channels) { @@ -540,11 +527,13 @@ static void correct_single_ended(const struct adc_sequence *sequence) static int start_read(const struct device *dev, const struct adc_sequence *sequence) { + nrfx_err_t nrfx_err; int error; uint32_t selected_channels = sequence->channels; - uint8_t active_channels; - uint8_t channel_id; - nrf_saadc_burst_t burst; + nrf_saadc_resolution_t resolution; + nrf_saadc_oversample_t oversampling; + uint8_t active_channel_cnt = 0U; + uint8_t channel_id = 0U; /* Signal an error if channel selection is invalid (no channels or * a non-existing one is selected). @@ -555,88 +544,55 @@ static int start_read(const struct device *dev, return -EINVAL; } - active_channels = 0U; - - /* Enable only the channels selected for the pointed sequence. - * Disable all the rest. - */ - channel_id = 0U; do { if (selected_channels & BIT(channel_id)) { - /* Signal an error if a selected channel has not been - * configured yet. - */ - if (m_data.positive_inputs[channel_id] == 0U) { - LOG_ERR("Channel %u not configured", - channel_id); + /* Signal an error if a selected channel has not been configured yet. */ + if (0 == (nrfx_saadc_channels_configured_get() & BIT(channel_id))) { + LOG_ERR("Channel %u not configured", channel_id); return -EINVAL; } - /* When oversampling is used, the burst mode needs to - * be activated. Unfortunately, this mode cannot be - * activated permanently in the channel setup, because - * then the multiple channel sampling fails (the END - * event is not generated) after switching to a single - * channel sampling and back. Thus, when oversampling - * is not used (hence, the multiple channel sampling is - * possible), the burst mode have to be deactivated. - */ - burst = (sequence->oversampling != 0U ? - NRF_SAADC_BURST_ENABLED : NRF_SAADC_BURST_DISABLED); -#if NRF_SAADC_HAS_CH_BURST - nrf_saadc_channel_burst_set(NRF_SAADC, channel_id, burst); -#else - nrf_saadc_burst_set(NRF_SAADC, burst); -#endif - nrf_saadc_channel_pos_input_set( - NRF_SAADC, - channel_id, -#if NRF_SAADC_HAS_AIN_AS_PIN - saadc_psels[m_data.positive_inputs[channel_id]] -#else - m_data.positive_inputs[channel_id] -#endif - ); - ++active_channels; - } else { - burst = NRF_SAADC_BURST_DISABLED; -#if NRF_SAADC_HAS_CH_BURST - nrf_saadc_channel_burst_set(NRF_SAADC, channel_id, burst); -#else - nrf_saadc_burst_set(NRF_SAADC, burst); -#endif - nrf_saadc_channel_pos_input_set( - NRF_SAADC, - channel_id, - NRF_SAADC_INPUT_DISABLED); + ++active_channel_cnt; } } while (++channel_id < SAADC_CH_NUM); - error = set_resolution(sequence); + if (active_channel_cnt == 0) { + LOG_ERR("No channel configured"); + return -EINVAL; + } + + error = get_resolution(sequence, &resolution); if (error) { return error; } - error = set_oversampling(sequence, active_channels); + error = get_oversampling(sequence, active_channel_cnt, &oversampling); if (error) { return error; } - error = check_buffer_size(sequence, active_channels); + nrfx_err = nrfx_saadc_simple_mode_set(selected_channels, + resolution, + oversampling, + event_handler); + if (nrfx_err != NRFX_SUCCESS) { + return -EINVAL; + } + + error = check_buffer_size(sequence, active_channel_cnt); if (error) { return error; } + m_data.active_channel_cnt = active_channel_cnt; #if defined(ADC_BUFFER_IN_RAM) m_data.user_buffer = sequence->buffer; - m_data.active_channels = active_channels; - nrf_saadc_buffer_init(NRF_SAADC, - (nrf_saadc_value_t *)m_data.samples_buffer, - active_channels); + nrfx_saadc_buffer_set(m_data.samples_buffer, active_channel_cnt); #else - nrf_saadc_buffer_init(NRF_SAADC, - (nrf_saadc_value_t *)sequence->buffer, - active_channels); + /* Buffer is filled in chunks, each chunk composed of number of samples equal to number + * of active channels. Buffer pointer is advanced and reloaded after each chunk. + */ + nrfx_saadc_buffer_set(sequence->buffer, active_channel_cnt); #endif adc_context_start_read(&m_data.ctx, sequence); @@ -673,18 +629,12 @@ static int adc_nrfx_read_async(const struct device *dev, } #endif /* CONFIG_ADC_ASYNC */ -static void saadc_irq_handler(const struct device *dev) +static void event_handler(const nrfx_saadc_evt_t *event) { - if (nrf_saadc_event_check(NRF_SAADC, NRF_SAADC_EVENT_END)) { - nrf_saadc_event_clear(NRF_SAADC, NRF_SAADC_EVENT_END); + nrfx_err_t err; - nrf_saadc_task_trigger(NRF_SAADC, NRF_SAADC_TASK_STOP); - -#if defined(CONFIG_PM_DEVICE_RUNTIME) - pm_device_runtime_put(DEVICE_DT_INST_GET(0)); -#else - nrf_saadc_disable(NRF_SAADC); -#endif + if (event->type == NRFX_SAADC_EVT_DONE) { + m_data.buffer = event->data.done.p_buffer; if (has_single_ended(&m_data.ctx.sequence)) { correct_single_ended(&m_data.ctx.sequence); @@ -692,39 +642,35 @@ static void saadc_irq_handler(const struct device *dev) #if defined(ADC_BUFFER_IN_RAM) memcpy(m_data.user_buffer, m_data.samples_buffer, - samples_to_bytes(m_data.active_channels)); + NRFX_SAADC_SAMPLES_TO_BYTES(m_data.active_channel_cnt)); #endif - adc_context_on_sampling_done(&m_data.ctx, dev); - } else if (nrf_saadc_event_check(NRF_SAADC, - NRF_SAADC_EVENT_CALIBRATEDONE)) { - nrf_saadc_event_clear(NRF_SAADC, NRF_SAADC_EVENT_CALIBRATEDONE); - - /* - * The workaround for Nordic nRF52832 anomalies 86 and - * 178 is an explicit STOP after CALIBRATEOFFSET - * before issuing START. - */ - nrf_saadc_task_trigger(NRF_SAADC, NRF_SAADC_TASK_STOP); - nrf_saadc_task_trigger(NRF_SAADC, NRF_SAADC_TASK_START); - nrf_saadc_task_trigger(NRF_SAADC, NRF_SAADC_TASK_SAMPLE); + adc_context_on_sampling_done(&m_data.ctx, DEVICE_DT_INST_GET(0)); + } else if (event->type == NRFX_SAADC_EVT_CALIBRATEDONE) { + err = nrfx_saadc_mode_trigger(); + if (err != NRFX_SUCCESS) { + LOG_ERR("Cannot start sampling: 0x%08x", err); + adc_context_complete(&m_data.ctx, -EIO); + } } } static int init_saadc(const struct device *dev) { - nrf_saadc_event_clear(NRF_SAADC, NRF_SAADC_EVENT_END); - nrf_saadc_event_clear(NRF_SAADC, NRF_SAADC_EVENT_CALIBRATEDONE); - nrf_saadc_int_enable(NRF_SAADC, - NRF_SAADC_INT_END | NRF_SAADC_INT_CALIBRATEDONE); - NRFX_IRQ_ENABLE(DT_INST_IRQN(0)); + nrfx_err_t err; + + /* The priority value passed here is ignored (see nrfx_glue.h). */ + err = nrfx_saadc_init(0); + if (err != NRFX_SUCCESS) { + LOG_ERR("Failed to initialize device: %s", dev->name); + return -EIO; + } - IRQ_CONNECT(DT_INST_IRQN(0), DT_INST_IRQ(0, priority), - saadc_irq_handler, DEVICE_DT_INST_GET(0), 0); + IRQ_CONNECT(DT_INST_IRQN(0), DT_INST_IRQ(0, priority), nrfx_isr, nrfx_saadc_irq_handler, 0); adc_context_unlock_unconditionally(&m_data.ctx); - return pm_device_driver_init(dev, saadc_pm_hook); + return 0; } static DEVICE_API(adc, adc_nrfx_driver_api) = { @@ -763,29 +709,7 @@ static DEVICE_API(adc, adc_nrfx_driver_api) = { "1v8 inputs cannot be mixed with 3v3 inputs"); /* Validate configuration of all channels. */ -#define VALIDATE_CHANNELS_CONFIG(inst) DT_FOREACH_CHILD(DT_DRV_INST(inst), VALIDATE_CHANNEL_CONFIG) +DT_FOREACH_CHILD(DT_DRV_INST(0), VALIDATE_CHANNEL_CONFIG) -/* - * There is only one instance on supported SoCs, so inst is guaranteed - * to be 0 if any instance is okay. (We use adc_0 above, so the driver - * is relying on the numeric instance value in a way that happens to - * be safe.) - * - * Just in case that assumption becomes invalid in the future, we use - * a BUILD_ASSERT(). - */ -#define SAADC_INIT(inst) \ - BUILD_ASSERT((inst) == 0, \ - "multiple instances not supported"); \ - VALIDATE_CHANNELS_CONFIG(inst) \ - PM_DEVICE_DT_INST_DEFINE(0, saadc_pm_hook, 1); \ - DEVICE_DT_INST_DEFINE(0, \ - init_saadc, \ - PM_DEVICE_DT_INST_GET(0), \ - NULL, \ - NULL, \ - POST_KERNEL, \ - CONFIG_ADC_INIT_PRIORITY, \ - &adc_nrfx_driver_api); - -DT_INST_FOREACH_STATUS_OKAY(SAADC_INIT) +DEVICE_DT_INST_DEFINE(0, init_saadc, NULL, NULL, NULL, POST_KERNEL, + CONFIG_ADC_INIT_PRIORITY, &adc_nrfx_driver_api); From 9f47f6c1b7315fa2d1f189c8867269605a222891 Mon Sep 17 00:00:00 2001 From: Jakub Zymelka Date: Mon, 14 Jul 2025 15:04:00 +0200 Subject: [PATCH 0347/2141] [nrf fromtree] drivers: adc: nrfx_saadc: Fix SAADC shim for nRF54LV10A GAIN field is not present on LV10A, so instead we need to check the input value to the function. Signed-off-by: Jakub Zymelka (cherry picked from commit 35044b64e4878169d1bb95a5c560337b0ecb41a6) --- drivers/adc/adc_nrfx_saadc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/adc/adc_nrfx_saadc.c b/drivers/adc/adc_nrfx_saadc.c index f9f136f25093..bb0b4d5ab0ab 100644 --- a/drivers/adc/adc_nrfx_saadc.c +++ b/drivers/adc/adc_nrfx_saadc.c @@ -283,7 +283,7 @@ static int gain_set(nrf_saadc_channel_config_t *ch_cfg, enum adc_gain gain) #endif default: #else - if (ch_cfg->gain != ADC_GAIN_1) { + if (gain != ADC_GAIN_1) { #endif /* defined(NRF_SAADC_HAS_CH_GAIN) */ LOG_ERR("Selected ADC gain is not valid"); return -EINVAL; From 2ca44cd5586e5362976046cbbe6531efe2947801 Mon Sep 17 00:00:00 2001 From: Nikodem Kastelik Date: Fri, 18 Jul 2025 12:33:00 +0200 Subject: [PATCH 0348/2141] [nrf fromlist] manifest: update hal_nordic revision to integrate nrfx 3.13.0 New nrfx release contains MDK 8.72.1 and various fixes for nRF devices. Upstream PR #: 93316 Signed-off-by: Nikodem Kastelik (cherry picked from commit 4fb07f5fc355ad51df6dbca39a506c3b217932a9) --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 20d4800519a9..acf99c65b106 100644 --- a/west.yml +++ b/west.yml @@ -200,7 +200,7 @@ manifest: groups: - hal - name: hal_nordic - revision: 9587b1dcb83d24ab74e89837843a5f7d573f7059 + revision: 2f5d4e5868ab573eac932fa4bc142565073c3c04 path: modules/hal/nordic groups: - hal From 19ec391a40c62bafb3ac6e3afc249d23f0f57773 Mon Sep 17 00:00:00 2001 From: Nikodem Kastelik Date: Tue, 22 Jul 2025 23:39:44 +0200 Subject: [PATCH 0349/2141] [nrf fromlist] drivers: adc: nrfx_saadc: remove VDD and DVDD inputs for nRF54LV10A MDK 8.72.1 does not specify VDD and DVDD internal analog inputs for this SoC. Upstream PR #: 93316 Signed-off-by: Nikodem Kastelik (cherry picked from commit 5e6b62366f207b8f35ba163be3a81ec0aaea8437) --- drivers/adc/adc_nrfx_saadc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/adc/adc_nrfx_saadc.c b/drivers/adc/adc_nrfx_saadc.c index bb0b4d5ab0ab..274a43157e04 100644 --- a/drivers/adc/adc_nrfx_saadc.c +++ b/drivers/adc/adc_nrfx_saadc.c @@ -66,7 +66,7 @@ static const uint32_t saadc_psels[NRF_SAADC_DVDD + 1] = { [NRF_SAADC_DVDD] = NRF_SAADC_INPUT_DVDD, }; #elif defined(NRF54LV10A_ENGA_XXAA) -static const uint32_t saadc_psels[NRF_SAADC_DVDD + 1] = { +static const uint32_t saadc_psels[NRF_SAADC_AIN7 + 1] = { [NRF_SAADC_AIN0] = NRF_PIN_PORT_TO_PIN_NUMBER(0U, 1), [NRF_SAADC_AIN1] = NRF_PIN_PORT_TO_PIN_NUMBER(1U, 1), [NRF_SAADC_AIN2] = NRF_PIN_PORT_TO_PIN_NUMBER(2U, 1), @@ -75,8 +75,6 @@ static const uint32_t saadc_psels[NRF_SAADC_DVDD + 1] = { [NRF_SAADC_AIN5] = NRF_PIN_PORT_TO_PIN_NUMBER(10U, 1), [NRF_SAADC_AIN6] = NRF_PIN_PORT_TO_PIN_NUMBER(11U, 1), [NRF_SAADC_AIN7] = NRF_PIN_PORT_TO_PIN_NUMBER(12U, 1), - [NRF_SAADC_VDD] = NRF_SAADC_INPUT_VDD, - [NRF_SAADC_DVDD] = NRF_SAADC_INPUT_DVDD, }; #endif From adb6384b92f3f31900197975a37a936eac5e4483 Mon Sep 17 00:00:00 2001 From: Nikodem Kastelik Date: Wed, 23 Jul 2025 18:30:10 +0200 Subject: [PATCH 0350/2141] [nrf fromlist] tests: nrf: comp: fix VDD reference dependency Some SoCs might not have any VDD reference available. Use internal 1.2V reference derived from VDD in this case. Upstream PR #: 93316 Signed-off-by: Nikodem Kastelik (cherry picked from commit 6736396885e1d194efac22e04dc56b2f45774a6d) --- tests/boards/nrf/comp/src/test.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/boards/nrf/comp/src/test.c b/tests/boards/nrf/comp/src/test.c index 2195f0e1ea94..1d1876e76faa 100644 --- a/tests/boards/nrf/comp/src/test.c +++ b/tests/boards/nrf/comp/src/test.c @@ -93,8 +93,11 @@ ZTEST(comparator_runtime_configure, test_comp_config_se_vdd) #ifdef COMP_REFSEL_REFSEL_AVDDAO1V8 conf.refsel = COMP_NRF_COMP_REFSEL_AVDDAO1V8; -#else +#elif defined(COMP_REFSEL_REFSEL_VDD) conf.refsel = COMP_NRF_COMP_REFSEL_VDD; +#else + /* Use internal 1.2 V derived from VDD */ + conf.refsel = COMP_NRF_COMP_REFSEL_INT_1V2; #endif rc = comp_nrf_comp_configure_se(test_dev, &conf); zassert_equal(rc, 0, "Cannot configure comparator."); From 20db3ee4cf31537296f92c68cea67cb7707c8f3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Stasiak?= Date: Fri, 16 May 2025 13:55:36 +0200 Subject: [PATCH 0351/2141] [nrf fromlist] drivers: serial: nrfx_uarte: enable cross domain pins for nRF54L15 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit UARTE20 and UARTE21 instances enable usage of pins on different port, but require request for constant latency mode. Added handling of such scenario in the driver. Added testcase to cover it. Upstream PR #: 90197 Signed-off-by: Michał Stasiak (cherry picked from commit cee404d7eec9bf0e0f1a7c493306a9386598b121) --- drivers/serial/uart_nrfx_uarte.c | 82 +++++++++++++++++++ dts/bindings/serial/nordic,nrf-uarte.yaml | 10 +++ dts/vendor/nordic/nrf54l_05_10_15.dtsi | 4 + ...l15dk_nrf54l15_cpuapp_cross_domain.overlay | 31 +++++++ .../uart/uart_elementary/testcase.yaml | 9 ++ 5 files changed, 136 insertions(+) create mode 100644 tests/drivers/uart/uart_elementary/boards/nrf54l15dk_nrf54l15_cpuapp_cross_domain.overlay diff --git a/drivers/serial/uart_nrfx_uarte.c b/drivers/serial/uart_nrfx_uarte.c index 1c75f4432280..20b6cad541de 100644 --- a/drivers/serial/uart_nrfx_uarte.c +++ b/drivers/serial/uart_nrfx_uarte.c @@ -148,6 +148,27 @@ BUILD_ASSERT(IS_ENABLED(CONFIG_CLOCK_CONTROL)); */ #define UARTE_ANY_HIGH_SPEED (UARTE_FOR_EACH_INSTANCE(INSTANCE_IS_HIGH_SPEED, (||), (0))) +#define UARTE_PINS_CROSS_DOMAIN(unused, prefix, idx, _) \ + COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(UARTE(prefix##idx)), \ + (UARTE_PROP(idx, cross_domain_pins_supported)), \ + (0)) + +#if UARTE_FOR_EACH_INSTANCE(UARTE_PINS_CROSS_DOMAIN, (||), (0)) +#include +/* Certain UARTE instances support usage of cross domain pins in form of dedicated pins on + * a port different from the default one. + */ +#define UARTE_CROSS_DOMAIN_PINS_SUPPORTED 1 +#endif + +#if UARTE_CROSS_DOMAIN_PINS_SUPPORTED && defined(CONFIG_NRF_SYS_EVENT) +#include +/* To use cross domain pins, constant latency mode needs to be applied, which is + * handled via nrf_sys_event requests. + */ +#define UARTE_CROSS_DOMAIN_PINS_HANDLE 1 +#endif + #ifdef UARTE_ANY_CACHE /* uart120 instance does not retain BAUDRATE register when ENABLE=0. When this instance * is used then baudrate must be set after enabling the peripheral and not before. @@ -371,6 +392,10 @@ struct uarte_nrfx_config { #endif uint8_t *poll_out_byte; uint8_t *poll_in_byte; +#if UARTE_CROSS_DOMAIN_PINS_SUPPORTED + bool cross_domain; + int8_t default_port; +#endif }; /* Using Macro instead of static inline function to handle NO_OPTIMIZATIONS case @@ -444,6 +469,32 @@ static void uarte_disable_locked(const struct device *dev, uint32_t dis_mask) nrf_uarte_disable(get_uarte_instance(dev)); } +#if UARTE_CROSS_DOMAIN_PINS_SUPPORTED +static bool uarte_has_cross_domain_connection(const struct uarte_nrfx_config *config) +{ + const struct pinctrl_dev_config *pcfg = config->pcfg; + const struct pinctrl_state *state; + int ret; + + ret = pinctrl_lookup_state(pcfg, PINCTRL_STATE_DEFAULT, &state); + if (ret < 0) { + LOG_ERR("Unable to read pin state"); + return false; + } + + for (uint8_t i = 0U; i < state->pin_cnt; i++) { + uint32_t pin = NRF_GET_PIN(state->pins[i]); + + if ((pin != NRF_PIN_DISCONNECTED) && + (nrf_gpio_pin_port_number_extract(&pin) != config->default_port)) { + return true; + } + } + + return false; +} +#endif + #if defined(UARTE_ANY_NONE_ASYNC) && !defined(CONFIG_UART_NRFX_UARTE_NO_IRQ) /** * @brief Interrupt service routine. @@ -727,6 +778,19 @@ static void uarte_periph_enable(const struct device *dev) #ifdef CONFIG_SOC_NRF54H20_GPD nrf_gpd_retain_pins_set(config->pcfg, false); #endif +#if UARTE_CROSS_DOMAIN_PINS_SUPPORTED + if (config->cross_domain && uarte_has_cross_domain_connection(config)) { +#if UARTE_CROSS_DOMAIN_PINS_HANDLE + int err; + + err = nrf_sys_event_request_global_constlat(); + (void)err; + __ASSERT_NO_MSG(err >= 0); +#else + __ASSERT(false, "NRF_SYS_EVENT needs to be enabled to use cross domain pins.\n"); +#endif + } +#endif #if UARTE_BAUDRATE_RETENTION_WORKAROUND nrf_uarte_baudrate_set(uarte, COND_CODE_1(CONFIG_UART_USE_RUNTIME_CONFIGURE, @@ -2411,6 +2475,19 @@ static void uarte_pm_suspend(const struct device *dev) #ifdef CONFIG_SOC_NRF54H20_GPD nrf_gpd_retain_pins_set(cfg->pcfg, true); #endif +#if UARTE_CROSS_DOMAIN_PINS_SUPPORTED + if (cfg->cross_domain && uarte_has_cross_domain_connection(cfg)) { +#if UARTE_CROSS_DOMAIN_PINS_HANDLE + int err; + + err = nrf_sys_event_release_global_constlat(); + (void)err; + __ASSERT_NO_MSG(err >= 0); +#else + __ASSERT(false, "NRF_SYS_EVENT needs to be enabled to use cross domain pins.\n"); +#endif + } +#endif nrf_uarte_disable(uarte); @@ -2698,6 +2775,11 @@ static int uarte_instance_init(const struct device *dev, .accuracy = 0, \ .precision = NRF_CLOCK_CONTROL_PRECISION_DEFAULT,\ },)) \ + IF_ENABLED(UARTE_PINS_CROSS_DOMAIN(_, /*empty*/, idx, _), \ + (.cross_domain = true, \ + .default_port = \ + DT_PROP_OR(DT_PHANDLE(UARTE(idx), \ + default_gpio_port), port, -1),)) \ }; \ UARTE_DIRECT_ISR_DECLARE(idx) \ static int uarte_##idx##_init(const struct device *dev) \ diff --git a/dts/bindings/serial/nordic,nrf-uarte.yaml b/dts/bindings/serial/nordic,nrf-uarte.yaml index e6ba4c0b2147..4e9ccb0dd400 100644 --- a/dts/bindings/serial/nordic,nrf-uarte.yaml +++ b/dts/bindings/serial/nordic,nrf-uarte.yaml @@ -14,3 +14,13 @@ properties: type: boolean description: | UARTE has RX frame timeout HW feature. + + default-gpio-port: + type: phandle + description: | + UARTE default GPIO port. + + cross-domain-pins-supported: + type: boolean + description: | + UARTE allows usage of cross domain pins with constant latency mode required. diff --git a/dts/vendor/nordic/nrf54l_05_10_15.dtsi b/dts/vendor/nordic/nrf54l_05_10_15.dtsi index 004454191f01..9a41f013b3ed 100644 --- a/dts/vendor/nordic/nrf54l_05_10_15.dtsi +++ b/dts/vendor/nordic/nrf54l_05_10_15.dtsi @@ -320,6 +320,8 @@ status = "disabled"; endtx-stoptx-supported; frame-timeout-supported; + default-gpio-port = <&gpio1>; + cross-domain-pins-supported; }; i2c21: i2c@c7000 { @@ -359,6 +361,8 @@ status = "disabled"; endtx-stoptx-supported; frame-timeout-supported; + default-gpio-port = <&gpio1>; + cross-domain-pins-supported; }; i2c22: i2c@c8000 { diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54l15dk_nrf54l15_cpuapp_cross_domain.overlay b/tests/drivers/uart/uart_elementary/boards/nrf54l15dk_nrf54l15_cpuapp_cross_domain.overlay new file mode 100644 index 000000000000..493631951607 --- /dev/null +++ b/tests/drivers/uart/uart_elementary/boards/nrf54l15dk_nrf54l15_cpuapp_cross_domain.overlay @@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +&pinctrl { + uart21_default: uart21_default { + group1 { + psels = , + , + , + ; + }; + }; + + uart21_sleep: uart21_sleep { + group1 { + psels = , + , + , + ; + low-power-enable; + }; + }; +}; + +dut: &uart21 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart21_default>; + pinctrl-1 = <&uart21_sleep>; + pinctrl-names = "default", "sleep"; + hw-flow-control; +}; diff --git a/tests/drivers/uart/uart_elementary/testcase.yaml b/tests/drivers/uart/uart_elementary/testcase.yaml index de3d18a50eea..7afdc874269d 100644 --- a/tests/drivers/uart/uart_elementary/testcase.yaml +++ b/tests/drivers/uart/uart_elementary/testcase.yaml @@ -97,3 +97,12 @@ tests: extra_configs: - CONFIG_DUAL_UART_TEST=y - CONFIG_SETUP_MISMATCH_TEST=y + drivers.uart.uart_elementary_cross_domain: + filter: CONFIG_SERIAL_SUPPORT_INTERRUPT + harness_config: + fixture: uart_p1_p2_loopback + platform_allow: + - nrf54l15dk/nrf54l15/cpuapp + extra_args: DTC_OVERLAY_FILE="boards/nrf54l15dk_nrf54l15_cpuapp_cross_domain.overlay" + extra_configs: + - CONFIG_NRF_SYS_EVENT=y From 018480248f63ca34c4fd9e343be9a54f0aa30d42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Stasiak?= Date: Fri, 16 May 2025 15:57:21 +0200 Subject: [PATCH 0352/2141] [nrf fromlist] drivers: spi: nrfx_spi(m/s): enable cross domain pins for nRF54L15 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SPI(M/S)20 and SPIM(M/S)21 instances enable usage of pins on different port, but require request for constant latency mode. Added handling of such scenario in the driver. Added testcase to cover it. Upstream PR #: 90197 Signed-off-by: Michał Stasiak (cherry picked from commit 463374fb0e76672b8b5fccab9f463fca18bcd161) --- drivers/spi/spi_nrfx_spim.c | 102 +++++++++++++++-- drivers/spi/spi_nrfx_spis.c | 106 +++++++++++++++--- dts/bindings/spi/nordic,nrf-spi-common.yaml | 10 ++ dts/vendor/nordic/nrf54l_05_10_15.dtsi | 4 + ...l15dk_nrf54l15_cpuapp_cross_domain.overlay | 73 ++++++++++++ .../spi_controller_peripheral/testcase.yaml | 15 +++ 6 files changed, 288 insertions(+), 22 deletions(-) create mode 100644 tests/drivers/spi/spi_controller_peripheral/boards/nrf54l15dk_nrf54l15_cpuapp_cross_domain.overlay diff --git a/drivers/spi/spi_nrfx_spim.c b/drivers/spi/spi_nrfx_spim.c index 0646c67b4a33..f1d6f8125d67 100644 --- a/drivers/spi/spi_nrfx_spim.c +++ b/drivers/spi/spi_nrfx_spim.c @@ -43,6 +43,16 @@ LOG_MODULE_REGISTER(spi_nrfx_spim, CONFIG_SPI_LOG_LEVEL); #define SPI_BUFFER_IN_RAM 1 #endif +/* + * We use NODELABEL here because the nrfx API requires us to call + * functions which are named according to SoC peripheral instance + * being operated on. Since DT_INST() makes no guarantees about that, + * it won't work. + */ +#define SPIM(idx) DT_NODELABEL(spi##idx) +#define SPIM_PROP(idx, prop) DT_PROP(SPIM(idx), prop) +#define SPIM_HAS_PROP(idx, prop) DT_NODE_HAS_PROP(SPIM(idx), prop) + #if defined(CONFIG_CLOCK_CONTROL_NRF_HSFLL_GLOBAL) #define SPIM_REQUESTS_CLOCK(node) \ DT_NODE_HAS_COMPAT(DT_CLOCKS_CTLR(node), nordic_nrf_hsfll_global) @@ -59,6 +69,28 @@ BUILD_ASSERT(!IS_ENABLED(CONFIG_PM_DEVICE_SYSTEM_MANAGED)); #define SPIM_REQUESTS_CLOCK(node) 0 #endif +#define SPIM_PINS_CROSS_DOMAIN(unused, prefix, idx, _) \ + COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(SPIM(prefix##idx)), \ + (SPIM_PROP(idx, cross_domain_pins_supported)), \ + (0)) + +#if NRFX_FOREACH_PRESENT(SPIM, SPIM_PINS_CROSS_DOMAIN, (||), (0)) +#include +/* Certain SPIM instances support usage of cross domain pins in form of dedicated pins on + * a port different from the default one. + */ +#define SPIM_CROSS_DOMAIN_SUPPORTED 1 +#endif + +#if SPIM_CROSS_DOMAIN_SUPPORTED && defined(CONFIG_NRF_SYS_EVENT) +#include +/* To use cross domain pins, constant latency mode needs to be applied, which is + * handled via nrf_sys_event requests. + */ +#define SPIM_CROSS_DOMAIN_PINS_HANDLE 1 +#endif + + struct spi_nrfx_data { struct spi_context ctx; const struct device *dev; @@ -98,6 +130,10 @@ struct spi_nrfx_config { const struct device *clk_dev; struct nrf_clock_spec clk_spec; #endif +#if SPIM_CROSS_DOMAIN_SUPPORTED + bool cross_domain; + int8_t default_port; +#endif }; static void event_handler(const nrfx_spim_evt_t *p_event, void *p_context); @@ -147,6 +183,32 @@ static inline void release_clock(const struct device *dev) #endif } +#if SPIM_CROSS_DOMAIN_SUPPORTED +static bool spim_has_cross_domain_connection(const struct spi_nrfx_config *config) +{ + const struct pinctrl_dev_config *pcfg = config->pcfg; + const struct pinctrl_state *state; + int ret; + + ret = pinctrl_lookup_state(pcfg, PINCTRL_STATE_DEFAULT, &state); + if (ret < 0) { + LOG_ERR("Unable to read pin state"); + return false; + } + + for (uint8_t i = 0U; i < state->pin_cnt; i++) { + uint32_t pin = NRF_GET_PIN(state->pins[i]); + + if ((pin != NRF_PIN_DISCONNECTED) && + (nrf_gpio_pin_port_number_extract(&pin) != config->default_port)) { + return true; + } + } + + return false; +} +#endif + static inline void finalize_spi_transaction(const struct device *dev, bool deactivate_cs) { struct spi_nrfx_data *dev_data = dev->data; @@ -688,6 +750,19 @@ static int spim_resume(const struct device *dev) #ifdef CONFIG_SOC_NRF54H20_GPD nrf_gpd_retain_pins_set(dev_config->pcfg, false); #endif +#if SPIM_CROSS_DOMAIN_SUPPORTED + if (dev_config->cross_domain && spim_has_cross_domain_connection(dev_config)) { +#if SPIM_CROSS_DOMAIN_PINS_HANDLE + int err; + + err = nrf_sys_event_request_global_constlat(); + (void)err; + __ASSERT_NO_MSG(err >= 0); +#else + __ASSERT(false, "NRF_SYS_EVENT needs to be enabled to use cross domain pins.\n"); +#endif + } +#endif return IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME) ? request_clock(dev) : 0; } @@ -711,6 +786,19 @@ static void spim_suspend(const struct device *dev) #ifdef CONFIG_SOC_NRF54H20_GPD nrf_gpd_retain_pins_set(dev_config->pcfg, true); #endif +#if SPIM_CROSS_DOMAIN_SUPPORTED + if (dev_config->cross_domain && spim_has_cross_domain_connection(dev_config)) { +#if SPIM_CROSS_DOMAIN_PINS_HANDLE + int err; + + err = nrf_sys_event_request_global_constlat(); + (void)err; + __ASSERT_NO_MSG(err >= 0); +#else + __ASSERT(false, "NRF_SYS_EVENT needs to be enabled to use cross domain pins.\n"); +#endif + } +#endif (void)pinctrl_apply_state(dev_config->pcfg, PINCTRL_STATE_SLEEP); } @@ -790,15 +878,6 @@ static int spi_nrfx_deinit(const struct device *dev) return 0; } -/* - * We use NODELABEL here because the nrfx API requires us to call - * functions which are named according to SoC peripheral instance - * being operated on. Since DT_INST() makes no guarantees about that, - * it won't work. - */ -#define SPIM(idx) DT_NODELABEL(spi##idx) -#define SPIM_PROP(idx, prop) DT_PROP(SPIM(idx), prop) -#define SPIM_HAS_PROP(idx, prop) DT_NODE_HAS_PROP(SPIM(idx), prop) #define SPIM_MEM_REGION(idx) DT_PHANDLE(SPIM(idx), memory_regions) #define SPI_NRFX_SPIM_EXTENDED_CONFIG(idx) \ @@ -890,6 +969,11 @@ static int spi_nrfx_deinit(const struct device *dev) .clk_spec = { \ .frequency = NRF_CLOCK_CONTROL_FREQUENCY_MAX, \ },)) \ + IF_ENABLED(SPIM_PINS_CROSS_DOMAIN(_, /*empty*/, idx, _), \ + (.cross_domain = true, \ + .default_port = \ + DT_PROP_OR(DT_PHANDLE(SPIM(idx), \ + default_gpio_port), port, -1),)) \ }; \ BUILD_ASSERT(!SPIM_HAS_PROP(idx, wake_gpios) || \ !(DT_GPIO_FLAGS(SPIM(idx), wake_gpios) & GPIO_ACTIVE_LOW),\ diff --git a/drivers/spi/spi_nrfx_spis.c b/drivers/spi/spi_nrfx_spis.c index ceb479c0441f..8ab8de979555 100644 --- a/drivers/spi/spi_nrfx_spis.c +++ b/drivers/spi/spi_nrfx_spis.c @@ -36,6 +36,38 @@ LOG_MODULE_REGISTER(spi_nrfx_spis, CONFIG_SPI_LOG_LEVEL); BUILD_ASSERT(!IS_ENABLED(CONFIG_PM_DEVICE_SYSTEM_MANAGED)); #endif +/* + * Current factors requiring use of DT_NODELABEL: + * + * - HAL design (requirement of drv_inst_idx in nrfx_spis_t) + * - Name-based HAL IRQ handlers, e.g. nrfx_spis_0_irq_handler + */ +#define SPIS_NODE(idx) COND_CODE_1(SPIS_IS_FAST(idx), (spis##idx), (spi##idx)) +#define SPIS(idx) DT_NODELABEL(SPIS_NODE(idx)) +#define SPIS_PROP(idx, prop) DT_PROP(SPIS(idx), prop) +#define SPIS_HAS_PROP(idx, prop) DT_NODE_HAS_PROP(SPIS(idx), prop) + +#define SPIS_PINS_CROSS_DOMAIN(unused, prefix, idx, _) \ + COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(SPIS(prefix##idx)), \ + (SPIS_PROP(idx, cross_domain_pins_supported)), \ + (0)) + +#if NRFX_FOREACH_PRESENT(SPIS, SPIS_PINS_CROSS_DOMAIN, (||), (0)) +#include +/* Certain SPIM instances support usage of cross domain pins in form of dedicated pins on + * a port different from the default one. + */ +#define SPIS_CROSS_DOMAIN_SUPPORTED 1 +#endif + +#if SPIS_CROSS_DOMAIN_SUPPORTED && defined(CONFIG_NRF_SYS_EVENT) +#include +/* To use cross domain pins, constant latency mode needs to be applied, which is + * handled via nrf_sys_event requests. + */ +#define SPIS_CROSS_DOMAIN_PINS_HANDLE 1 +#endif + struct spi_nrfx_data { struct spi_context ctx; const struct device *dev; @@ -58,8 +90,38 @@ struct spi_nrfx_config { const struct pinctrl_dev_config *pcfg; struct gpio_dt_spec wake_gpio; void *mem_reg; +#if SPIS_CROSS_DOMAIN_SUPPORTED + bool cross_domain; + int8_t default_port; +#endif }; +#if SPIS_CROSS_DOMAIN_SUPPORTED +static bool spis_has_cross_domain_connection(const struct spi_nrfx_config *config) +{ + const struct pinctrl_dev_config *pcfg = config->pcfg; + const struct pinctrl_state *state; + int ret; + + ret = pinctrl_lookup_state(pcfg, PINCTRL_STATE_DEFAULT, &state); + if (ret < 0) { + LOG_ERR("Unable to read pin state"); + return false; + } + + for (uint8_t i = 0U; i < state->pin_cnt; i++) { + uint32_t pin = NRF_GET_PIN(state->pins[i]); + + if ((pin != NRF_PIN_DISCONNECTED) && + (nrf_gpio_pin_port_number_extract(&pin) != config->default_port)) { + return true; + } + } + + return false; +} +#endif + static inline nrf_spis_mode_t get_nrf_spis_mode(uint16_t operation) { if (SPI_MODE_GET(operation) & SPI_MODE_CPOL) { @@ -384,6 +446,19 @@ static void spi_nrfx_suspend(const struct device *dev) nrf_gpd_retain_pins_set(dev_config->pcfg, true); } #endif +#if SPIS_CROSS_DOMAIN_SUPPORTED + if (dev_config->cross_domain && spis_has_cross_domain_connection(dev_config)) { +#if SPIS_CROSS_DOMAIN_PINS_HANDLE + int err; + + err = nrf_sys_event_request_global_constlat(); + (void)err; + __ASSERT_NO_MSG(err >= 0); +#else + __ASSERT(false, "NRF_SYS_EVENT needs to be enabled to use cross domain pins.\n"); +#endif + } +#endif (void)pinctrl_apply_state(dev_config->pcfg, PINCTRL_STATE_SLEEP); } @@ -399,6 +474,19 @@ static void spi_nrfx_resume(const struct device *dev) nrf_gpd_retain_pins_set(dev_config->pcfg, false); } #endif +#if SPIS_CROSS_DOMAIN_SUPPORTED + if (dev_config->cross_domain && spis_has_cross_domain_connection(dev_config)) { +#if SPIS_CROSS_DOMAIN_PINS_HANDLE + int err; + + err = nrf_sys_event_request_global_constlat(); + (void)err; + __ASSERT_NO_MSG(err >= 0); +#else + __ASSERT(false, "NRF_SYS_EVENT needs to be enabled to use cross domain pins.\n"); +#endif + } +#endif if (dev_config->wake_gpio.port == NULL) { nrf_spis_enable(dev_config->spis.p_reg); @@ -482,19 +570,6 @@ static int spi_nrfx_init(const struct device *dev) return pm_device_driver_init(dev, spi_nrfx_pm_action); } -/* - * Current factors requiring use of DT_NODELABEL: - * - * - HAL design (requirement of drv_inst_idx in nrfx_spis_t) - * - Name-based HAL IRQ handlers, e.g. nrfx_spis_0_irq_handler - */ - -#define SPIS_NODE(idx) COND_CODE_1(SPIS_IS_FAST(idx), (spis##idx), (spi##idx)) - -#define SPIS(idx) DT_NODELABEL(SPIS_NODE(idx)) - -#define SPIS_PROP(idx, prop) DT_PROP(SPIS(idx), prop) - #define SPI_NRFX_SPIS_DEFINE(idx) \ static void irq_connect##idx(void) \ { \ @@ -533,6 +608,11 @@ static int spi_nrfx_init(const struct device *dev) NRFX_MHZ_TO_HZ(16UL),)) \ .wake_gpio = GPIO_DT_SPEC_GET_OR(SPIS(idx), wake_gpios, {0}), \ .mem_reg = DMM_DEV_TO_REG(SPIS(idx)), \ + IF_ENABLED(SPIS_PINS_CROSS_DOMAIN(_, /*empty*/, idx, _), \ + (.cross_domain = true, \ + .default_port = \ + DT_PROP_OR(DT_PHANDLE(SPIS(idx), \ + default_gpio_port), port, -1),)) \ }; \ BUILD_ASSERT(!DT_NODE_HAS_PROP(SPIS(idx), wake_gpios) || \ !(DT_GPIO_FLAGS(SPIS(idx), wake_gpios) & GPIO_ACTIVE_LOW),\ diff --git a/dts/bindings/spi/nordic,nrf-spi-common.yaml b/dts/bindings/spi/nordic,nrf-spi-common.yaml index dc81950aed3d..e76d785b2f42 100644 --- a/dts/bindings/spi/nordic,nrf-spi-common.yaml +++ b/dts/bindings/spi/nordic,nrf-spi-common.yaml @@ -61,3 +61,13 @@ properties: and SPI master again keeps the line in the low state Please note that the line must be configured and properly handled on both sides for the mechanism to work correctly. + + default-gpio-port: + type: phandle + description: | + SPI default GPIO port. + + cross-domain-pins-supported: + type: boolean + description: | + SPI allows usage of cross domain pins with constant latency mode required. diff --git a/dts/vendor/nordic/nrf54l_05_10_15.dtsi b/dts/vendor/nordic/nrf54l_05_10_15.dtsi index 9a41f013b3ed..aa259713d2fd 100644 --- a/dts/vendor/nordic/nrf54l_05_10_15.dtsi +++ b/dts/vendor/nordic/nrf54l_05_10_15.dtsi @@ -311,6 +311,8 @@ rx-delay-supported; rx-delay = <1>; status = "disabled"; + default-gpio-port = <&gpio1>; + cross-domain-pins-supported; }; uart20: uart@c6000 { @@ -352,6 +354,8 @@ rx-delay-supported; rx-delay = <1>; status = "disabled"; + default-gpio-port = <&gpio1>; + cross-domain-pins-supported; }; uart21: uart@c7000 { diff --git a/tests/drivers/spi/spi_controller_peripheral/boards/nrf54l15dk_nrf54l15_cpuapp_cross_domain.overlay b/tests/drivers/spi/spi_controller_peripheral/boards/nrf54l15dk_nrf54l15_cpuapp_cross_domain.overlay new file mode 100644 index 000000000000..f2e1ac5ce4ec --- /dev/null +++ b/tests/drivers/spi/spi_controller_peripheral/boards/nrf54l15dk_nrf54l15_cpuapp_cross_domain.overlay @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + spi21_default_alt: spi21_default_alt { + group1 { + psels = , + , + ; + }; + }; + + spi21_sleep_alt: spi21_sleep_alt { + group1 { + psels = , + , + ; + low-power-enable; + }; + }; + + spi22_default_alt: spi22_default_alt { + group1 { + psels = , + , + , + ; + }; + }; + + spi22_sleep_alt: spi22_sleep_alt { + group1 { + psels = , + , + , + ; + low-power-enable; + }; + }; +}; + +&gpio2 { + status = "okay"; +}; + +&spi21 { + status = "okay"; + pinctrl-0 = <&spi21_default_alt>; + pinctrl-1 = <&spi21_sleep_alt>; + pinctrl-names = "default", "sleep"; + overrun-character = <0x00>; + cs-gpios = <&gpio2 10 GPIO_ACTIVE_LOW>; + zephyr,pm-device-runtime-auto; + dut_spi_dt: test-spi-dev@0 { + compatible = "vnd,spi-device"; + reg = <0>; + spi-max-frequency = ; + }; +}; + +dut_spis: &spi22 { + compatible = "nordic,nrf-spis"; + status = "okay"; + def-char = <0x00>; + pinctrl-0 = <&spi22_default_alt>; + pinctrl-1 = <&spi22_sleep_alt>; + pinctrl-names = "default", "sleep"; + /delete-property/rx-delay-supported; + /delete-property/rx-delay; +}; diff --git a/tests/drivers/spi/spi_controller_peripheral/testcase.yaml b/tests/drivers/spi/spi_controller_peripheral/testcase.yaml index 10365d8014dc..f385c3073e92 100644 --- a/tests/drivers/spi/spi_controller_peripheral/testcase.yaml +++ b/tests/drivers/spi/spi_controller_peripheral/testcase.yaml @@ -102,3 +102,18 @@ tests: - CONFIG_PM_DEVICE=y - CONFIG_PM_DEVICE_RUNTIME=y filter: CONFIG_SOC_FAMILY_NORDIC_NRF + + drivers.spi.spi_cross_domain: + harness_config: + fixture: spi_p1_p2_loopback + extra_configs: + - CONFIG_TESTED_SPI_MODE=0 + - CONFIG_NRF_SYS_EVENT=y + extra_args: DTC_OVERLAY_FILE="boards/nrf54l15dk_nrf54l15_cpuapp_cross_domain.overlay" + platform_exclude: + - nrf52840dk/nrf52840 + - nrf54h20dk/nrf54h20/cpuapp + - nrf54h20dk/nrf54h20/cpurad + - nrf54h20dk/nrf54h20/cpuppr + - nrf54l20pdk/nrf54l20/cpuapp + - ophelia4ev/nrf54l15/cpuapp From 4e7cb9a82e8dcbd607868c597f07da8c0ec6d94f Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Sat, 28 Jun 2025 00:04:03 +0530 Subject: [PATCH 0353/2141] [nrf fromtree] modules: nrf_wifi: Use spinlocks Zephyr provides spinlock APIs which can be locked even during the interrupt context. Signed-off-by: Chaitanya Tata (cherry picked from commit 3e9dffbe2581e940178607a7ce5074a014c22dbb) --- modules/nrf_wifi/os/shim.c | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/modules/nrf_wifi/os/shim.c b/modules/nrf_wifi/os/shim.c index df460d5ab53e..a92720b6dce8 100644 --- a/modules/nrf_wifi/os/shim.c +++ b/modules/nrf_wifi/os/shim.c @@ -202,53 +202,66 @@ static void zep_shim_qspi_cpy_to(void *priv, unsigned long addr, const void *src } #endif /* !CONFIG_NRF71_ON_IPC */ +struct zep_shim_spinlock { + struct k_spinlock lock; + k_spinlock_key_t key; +}; + static void *zep_shim_spinlock_alloc(void) { - struct k_mutex *lock = NULL; - - lock = zep_shim_mem_zalloc(sizeof(*lock)); + struct zep_shim_spinlock *slock = NULL; - if (!lock) { + slock = k_calloc(sizeof(*slock), sizeof(char)); + if (!slock) { LOG_ERR("%s: Unable to allocate memory for spinlock", __func__); } - return lock; + return slock; } static void zep_shim_spinlock_free(void *lock) { #if defined(CONFIG_NRF_WIFI_GLOBAL_HEAP) k_free(lock); -#else /* CONFIG_NRF_WIFI_GLOBAL_HEAP */ +#else k_heap_free(&wifi_drv_ctrl_mem_pool, lock); -#endif /* CONFIG_NRF_WIFI_GLOBAL_HEAP */ +#endif } static void zep_shim_spinlock_init(void *lock) { - k_mutex_init(lock); + /* No explicit initialization needed for k_spinlock_t */ + ARG_UNUSED(lock); } static void zep_shim_spinlock_take(void *lock) { - k_mutex_lock(lock, K_FOREVER); + struct zep_shim_spinlock *slock = (struct zep_shim_spinlock *)lock; + + slock->key = k_spin_lock(&slock->lock); } static void zep_shim_spinlock_rel(void *lock) { - k_mutex_unlock(lock); + struct zep_shim_spinlock *slock = (struct zep_shim_spinlock *)lock; + + k_spin_unlock(&slock->lock, slock->key); } static void zep_shim_spinlock_irq_take(void *lock, unsigned long *flags) { + struct zep_shim_spinlock *slock = (struct zep_shim_spinlock *)lock; + ARG_UNUSED(flags); - k_mutex_lock(lock, K_FOREVER); + slock->key = k_spin_lock(&slock->lock); } static void zep_shim_spinlock_irq_rel(void *lock, unsigned long *flags) { + struct zep_shim_spinlock *slock = (struct zep_shim_spinlock *)lock; + ARG_UNUSED(flags); - k_mutex_unlock(lock); + k_spin_unlock(&slock->lock, slock->key); } static int zep_shim_pr_dbg(const char *fmt, va_list args) From 4142fcf4c635d8db389b4551e0a45700be0ae596 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Sat, 28 Jun 2025 00:43:04 +0530 Subject: [PATCH 0354/2141] [nrf fromtree] modified: nrf_wifi: Refactor heap calls Instead if littering ifdef's across the code, use a single API and initialize different pools only once. Signed-off-by: Chaitanya Tata (cherry picked from commit ab9c53138d45229a0f5b6a9d3bb05e37bac2fb36) --- modules/nrf_wifi/os/shim.c | 47 ++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 27 deletions(-) diff --git a/modules/nrf_wifi/os/shim.c b/modules/nrf_wifi/os/shim.c index a92720b6dce8..fba771284c66 100644 --- a/modules/nrf_wifi/os/shim.c +++ b/modules/nrf_wifi/os/shim.c @@ -34,7 +34,14 @@ LOG_MODULE_REGISTER(wifi_nrf, CONFIG_WIFI_NRF70_LOG_LEVEL); -#if !defined(CONFIG_NRF_WIFI_GLOBAL_HEAP) +/* Memory pool management - unified pool-based API */ +#if defined(CONFIG_NRF_WIFI_GLOBAL_HEAP) +/* Use global system heap */ +extern struct sys_heap _system_heap; +static struct k_heap * const wifi_ctrl_pool = &_system_heap; +static struct k_heap * const wifi_data_pool = &_system_heap; +#else +/* Use dedicated heaps */ #if defined(CONFIG_NOCACHE_MEMORY) K_HEAP_DEFINE_NOCACHE(wifi_drv_ctrl_mem_pool, CONFIG_NRF_WIFI_CTRL_HEAP_SIZE); K_HEAP_DEFINE_NOCACHE(wifi_drv_data_mem_pool, CONFIG_NRF_WIFI_DATA_HEAP_SIZE); @@ -42,6 +49,8 @@ K_HEAP_DEFINE_NOCACHE(wifi_drv_data_mem_pool, CONFIG_NRF_WIFI_DATA_HEAP_SIZE); K_HEAP_DEFINE(wifi_drv_ctrl_mem_pool, CONFIG_NRF_WIFI_CTRL_HEAP_SIZE); K_HEAP_DEFINE(wifi_drv_data_mem_pool, CONFIG_NRF_WIFI_DATA_HEAP_SIZE); #endif /* CONFIG_NOCACHE_MEMORY */ +static struct k_heap * const wifi_ctrl_pool = &wifi_drv_ctrl_mem_pool; +static struct k_heap * const wifi_data_pool = &wifi_drv_data_mem_pool; #endif /* CONFIG_NRF_WIFI_GLOBAL_HEAP */ #define WORD_SIZE 4 @@ -52,22 +61,14 @@ static void *zep_shim_mem_alloc(size_t size) { size_t size_aligned = ROUND_UP(size, 4); -#if defined(CONFIG_NRF_WIFI_GLOBAL_HEAP) - return k_malloc(size_aligned); -#else /* CONFIG_NRF_WIFI_GLOBAL_HEAP */ - return k_heap_aligned_alloc(&wifi_drv_ctrl_mem_pool, WORD_SIZE, size_aligned, K_FOREVER); -#endif /* CONFIG_NRF_WIFI_GLOBAL_HEAP */ + return k_heap_aligned_alloc(wifi_ctrl_pool, WORD_SIZE, size_aligned, K_FOREVER); } static void *zep_shim_data_mem_alloc(size_t size) { size_t size_aligned = ROUND_UP(size, 4); -#if defined(CONFIG_NRF_WIFI_GLOBAL_HEAP) - return k_malloc(size_aligned); -#else /* CONFIG_NRF_WIFI_GLOBAL_HEAP */ - return k_heap_aligned_alloc(&wifi_drv_data_mem_pool, WORD_SIZE, size_aligned, K_FOREVER); -#endif /* CONFIG_NRF_WIFI_GLOBAL_HEAP */ + return k_heap_aligned_alloc(wifi_data_pool, WORD_SIZE, size_aligned, K_FOREVER); } static void *zep_shim_mem_zalloc(size_t size) @@ -111,22 +112,14 @@ static void *zep_shim_data_mem_zalloc(size_t size) static void zep_shim_mem_free(void *buf) { if (buf) { -#if defined(CONFIG_NRF_WIFI_GLOBAL_HEAP) - k_free(buf); -#else /* CONFIG_NRF_WIFI_GLOBAL_HEAP */ - k_heap_free(&wifi_drv_ctrl_mem_pool, buf); -#endif /* CONFIG_NRF_WIFI_GLOBAL_HEAP */ + k_heap_free(wifi_ctrl_pool, buf); } } static void zep_shim_data_mem_free(void *buf) { if (buf) { -#if defined(CONFIG_NRF_WIFI_GLOBAL_HEAP) - k_free(buf); -#else /* CONFIG_NRF_WIFI_GLOBAL_HEAP */ - k_heap_free(&wifi_drv_data_mem_pool, buf); -#endif /* CONFIG_NRF_WIFI_GLOBAL_HEAP */ + k_heap_free(wifi_data_pool, buf); } } @@ -211,9 +204,11 @@ static void *zep_shim_spinlock_alloc(void) { struct zep_shim_spinlock *slock = NULL; - slock = k_calloc(sizeof(*slock), sizeof(char)); + slock = k_heap_aligned_alloc(wifi_ctrl_pool, WORD_SIZE, sizeof(*slock), K_FOREVER); if (!slock) { LOG_ERR("%s: Unable to allocate memory for spinlock", __func__); + } else { + memset(slock, 0, sizeof(*slock)); } return slock; @@ -221,11 +216,9 @@ static void *zep_shim_spinlock_alloc(void) static void zep_shim_spinlock_free(void *lock) { -#if defined(CONFIG_NRF_WIFI_GLOBAL_HEAP) - k_free(lock); -#else - k_heap_free(&wifi_drv_ctrl_mem_pool, lock); -#endif + if (lock) { + k_heap_free(wifi_ctrl_pool, lock); + } } static void zep_shim_spinlock_init(void *lock) From 34e6741ed4104a5eb1dd68061f4848f6ca569d3c Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Tue, 22 Jul 2025 00:19:44 +0530 Subject: [PATCH 0355/2141] [nrf fromtree] Revert "modules: nrf_wifi: Use spinlocks" This reverts commit 3e9dffbe2581e940178607a7ce5074a014c22dbb. Though this works fine, when CONFIG_ASSERT=y the spinlock validation fails as the underlying code though uses OSAL spinlock APIs is not ready * sleeping with spinlock held * multiple threads taking the same spinlock (might work on UP, but not on SMP on the same CPU) Revert this for now, till the underyling is robust. Signed-off-by: Chaitanya Tata (cherry picked from commit 9693852d9a467aef79623b9c95b596b66dcc29a2) --- modules/nrf_wifi/os/shim.c | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/modules/nrf_wifi/os/shim.c b/modules/nrf_wifi/os/shim.c index fba771284c66..6fb329cfd069 100644 --- a/modules/nrf_wifi/os/shim.c +++ b/modules/nrf_wifi/os/shim.c @@ -195,14 +195,9 @@ static void zep_shim_qspi_cpy_to(void *priv, unsigned long addr, const void *src } #endif /* !CONFIG_NRF71_ON_IPC */ -struct zep_shim_spinlock { - struct k_spinlock lock; - k_spinlock_key_t key; -}; - static void *zep_shim_spinlock_alloc(void) { - struct zep_shim_spinlock *slock = NULL; + struct k_mutex *lock = NULL; slock = k_heap_aligned_alloc(wifi_ctrl_pool, WORD_SIZE, sizeof(*slock), K_FOREVER); if (!slock) { @@ -211,7 +206,7 @@ static void *zep_shim_spinlock_alloc(void) memset(slock, 0, sizeof(*slock)); } - return slock; + return lock; } static void zep_shim_spinlock_free(void *lock) @@ -223,38 +218,29 @@ static void zep_shim_spinlock_free(void *lock) static void zep_shim_spinlock_init(void *lock) { - /* No explicit initialization needed for k_spinlock_t */ - ARG_UNUSED(lock); + k_mutex_init(lock); } static void zep_shim_spinlock_take(void *lock) { - struct zep_shim_spinlock *slock = (struct zep_shim_spinlock *)lock; - - slock->key = k_spin_lock(&slock->lock); + k_mutex_lock(lock, K_FOREVER); } static void zep_shim_spinlock_rel(void *lock) { - struct zep_shim_spinlock *slock = (struct zep_shim_spinlock *)lock; - - k_spin_unlock(&slock->lock, slock->key); + k_mutex_unlock(lock); } static void zep_shim_spinlock_irq_take(void *lock, unsigned long *flags) { - struct zep_shim_spinlock *slock = (struct zep_shim_spinlock *)lock; - ARG_UNUSED(flags); - slock->key = k_spin_lock(&slock->lock); + k_mutex_lock(lock, K_FOREVER); } static void zep_shim_spinlock_irq_rel(void *lock, unsigned long *flags) { - struct zep_shim_spinlock *slock = (struct zep_shim_spinlock *)lock; - ARG_UNUSED(flags); - k_spin_unlock(&slock->lock, slock->key); + k_mutex_unlock(lock); } static int zep_shim_pr_dbg(const char *fmt, va_list args) From 446998834133fc1ef18874055f99531700a34f6e Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Thu, 24 Jul 2025 13:20:17 +0530 Subject: [PATCH 0356/2141] [nrf fromtree] modules: nrf_wifi: Fix build error The revert for some reason didn't do a full revert, fix the lock variable. Signed-off-by: Chaitanya Tata (cherry picked from commit 1fe2369f649b366b63dc9acfcbe81515a8da405a) --- modules/nrf_wifi/os/shim.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/nrf_wifi/os/shim.c b/modules/nrf_wifi/os/shim.c index 6fb329cfd069..79137e46e13f 100644 --- a/modules/nrf_wifi/os/shim.c +++ b/modules/nrf_wifi/os/shim.c @@ -199,11 +199,11 @@ static void *zep_shim_spinlock_alloc(void) { struct k_mutex *lock = NULL; - slock = k_heap_aligned_alloc(wifi_ctrl_pool, WORD_SIZE, sizeof(*slock), K_FOREVER); - if (!slock) { + lock = k_heap_aligned_alloc(wifi_ctrl_pool, WORD_SIZE, sizeof(*lock), K_FOREVER); + if (!lock) { LOG_ERR("%s: Unable to allocate memory for spinlock", __func__); } else { - memset(slock, 0, sizeof(*slock)); + memset(lock, 0, sizeof(*lock)); } return lock; From 691b66e66d350d3e64e35f0fec1d490152cd2f53 Mon Sep 17 00:00:00 2001 From: Ajay Parida Date: Mon, 3 Jun 2024 17:31:59 +0530 Subject: [PATCH 0357/2141] [nrf noup] net: l2: wifi: Configure BSS max idle period Support to configure BSS max idle period at runtime. To avoid big churn (net_mgmt 64bit), this commit should be reverted on the next upmerge. Signed-off-by: Ajay Parida (cherry picked from commit b0331c4b29efd421ec5803115a37cdbbc09da137) --- drivers/wifi/nrf_wifi/inc/fmac_main.h | 1 + drivers/wifi/nrf_wifi/inc/wifi_mgmt.h | 3 ++ drivers/wifi/nrf_wifi/src/fmac_main.c | 4 ++ drivers/wifi/nrf_wifi/src/wifi_mgmt.c | 53 +++++++++++++++++++++++++ drivers/wifi/nrf_wifi/src/wpa_supp_if.c | 6 ++- include/zephyr/net/wifi_mgmt.h | 16 ++++++++ modules/hostap/src/supp_api.c | 13 ++++++ modules/hostap/src/supp_api.h | 8 ++++ modules/hostap/src/supp_main.c | 1 + subsys/net/l2/wifi/Kconfig | 16 ++++++++ subsys/net/l2/wifi/wifi_mgmt.c | 25 ++++++++++++ subsys/net/l2/wifi/wifi_shell.c | 32 +++++++++++++++ 12 files changed, 176 insertions(+), 2 deletions(-) diff --git a/drivers/wifi/nrf_wifi/inc/fmac_main.h b/drivers/wifi/nrf_wifi/inc/fmac_main.h index c193515ae2dd..7a863d8b614a 100644 --- a/drivers/wifi/nrf_wifi/inc/fmac_main.h +++ b/drivers/wifi/nrf_wifi/inc/fmac_main.h @@ -91,6 +91,7 @@ struct nrf_wifi_vif_ctx_zep { struct k_work_delayable nrf_wifi_rpu_recovery_bringup_work; #endif /* CONFIG_NRF_WIFI_RPU_RECOVERY */ int rts_threshold_value; + unsigned short bss_max_idle_period; }; struct nrf_wifi_vif_ctx_map { diff --git a/drivers/wifi/nrf_wifi/inc/wifi_mgmt.h b/drivers/wifi/nrf_wifi/inc/wifi_mgmt.h index a4ae20302100..9b84427cdca4 100644 --- a/drivers/wifi/nrf_wifi/inc/wifi_mgmt.h +++ b/drivers/wifi/nrf_wifi/inc/wifi_mgmt.h @@ -77,4 +77,7 @@ int nrf_wifi_set_rts_threshold(const struct device *dev, int nrf_wifi_get_rts_threshold(const struct device *dev, unsigned int *rts_threshold); + +int nrf_wifi_set_bss_max_idle_period(const struct device *dev, + unsigned short bss_max_idle_period); #endif /* __ZEPHYR_WIFI_MGMT_H__ */ diff --git a/drivers/wifi/nrf_wifi/src/fmac_main.c b/drivers/wifi/nrf_wifi/src/fmac_main.c index 379c3242b182..f2d9aa55af9f 100644 --- a/drivers/wifi/nrf_wifi/src/fmac_main.c +++ b/drivers/wifi/nrf_wifi/src/fmac_main.c @@ -858,6 +858,9 @@ static int nrf_wifi_drv_main_zep(const struct device *dev) #endif /* CONFIG_NRF70_RADIO_TEST */ k_mutex_init(&rpu_drv_priv_zep.rpu_ctx_zep.rpu_lock); +#ifndef CONFIG_NRF70_RADIO_TEST + vif_ctx_zep->bss_max_idle_period = USHRT_MAX; +#endif /* !CONFIG_NRF70_RADIO_TEST */ return 0; #ifdef CONFIG_NRF70_RADIO_TEST fmac_deinit: @@ -885,6 +888,7 @@ static const struct wifi_mgmt_ops nrf_wifi_mgmt_ops = { .get_power_save_config = nrf_wifi_get_power_save_config, .set_rts_threshold = nrf_wifi_set_rts_threshold, .get_rts_threshold = nrf_wifi_get_rts_threshold, + .set_bss_max_idle_period = nrf_wifi_set_bss_max_idle_period, #endif #ifdef CONFIG_NRF70_SYSTEM_WITH_RAW_MODES .mode = nrf_wifi_mode, diff --git a/drivers/wifi/nrf_wifi/src/wifi_mgmt.c b/drivers/wifi/nrf_wifi/src/wifi_mgmt.c index a323faf21dd6..e9755e80013e 100644 --- a/drivers/wifi/nrf_wifi/src/wifi_mgmt.c +++ b/drivers/wifi/nrf_wifi/src/wifi_mgmt.c @@ -1077,3 +1077,56 @@ int nrf_wifi_get_rts_threshold(const struct device *dev, return ret; } + +int nrf_wifi_set_bss_max_idle_period(const struct device *dev, + unsigned short bss_max_idle_period) +{ + struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; + struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; + int ret = -1; + + if (!dev) { + LOG_ERR("%s: dev is NULL", __func__); + return ret; + } + + vif_ctx_zep = dev->data; + + if (!vif_ctx_zep) { + LOG_ERR("%s: vif_ctx_zep is NULL", __func__); + return ret; + } + + rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; + + if (!rpu_ctx_zep) { + LOG_ERR("%s: rpu_ctx_zep is NULL", __func__); + return ret; + } + + + if (!rpu_ctx_zep->rpu_ctx) { + LOG_ERR("%s: RPU context not initialized", __func__); + return ret; + } + + if (((int)bss_max_idle_period < 0) || + (bss_max_idle_period > 64000)) { + /* 0 or value less than 64000 is passed to f/w. + * All other values considered as invalid. + */ + LOG_ERR("%s: Invalid max_idle_period value : %d", + __func__, (int)bss_max_idle_period); + return ret; + } + + k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); + + vif_ctx_zep->bss_max_idle_period = bss_max_idle_period; + + ret = 0; + + k_mutex_unlock(&vif_ctx_zep->vif_lock); + + return ret; +} diff --git a/drivers/wifi/nrf_wifi/src/wpa_supp_if.c b/drivers/wifi/nrf_wifi/src/wpa_supp_if.c index 22aa04165507..1ef412df7f72 100644 --- a/drivers/wifi/nrf_wifi/src/wpa_supp_if.c +++ b/drivers/wifi/nrf_wifi/src/wpa_supp_if.c @@ -931,8 +931,10 @@ int nrf_wifi_wpa_supp_associate(void *if_priv, struct wpa_driver_associate_param assoc_info.use_mfp = NRF_WIFI_MFP_REQUIRED; } - if (params->bss_max_idle_period) { - assoc_info.bss_max_idle_time = params->bss_max_idle_period; + if (vif_ctx_zep->bss_max_idle_period == USHRT_MAX) { + assoc_info.bss_max_idle_time = CONFIG_WIFI_MGMT_BSS_MAX_IDLE_TIME; + } else { + assoc_info.bss_max_idle_time = vif_ctx_zep->bss_max_idle_period; } assoc_info.conn_type = NRF_WIFI_CONN_TYPE_OPEN; diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index 5477b6a3c0e9..00c83a986ea1 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -133,6 +133,8 @@ enum net_request_wifi_cmd { NET_REQUEST_WIFI_CMD_CANDIDATE_SCAN, /** AP WPS config */ NET_REQUEST_WIFI_CMD_AP_WPS_CONFIG, + /** Configure BSS maximum idle period */ + NET_REQUEST_WIFI_CMD_BSS_MAX_IDLE_PERIOD, /** @cond INTERNAL_HIDDEN */ NET_REQUEST_WIFI_CMD_MAX /** @endcond */ @@ -317,6 +319,11 @@ NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_START_ROAMING); NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_NEIGHBOR_REP_COMPLETE); +#define NET_REQUEST_WIFI_BSS_MAX_IDLE_PERIOD \ + (NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_BSS_MAX_IDLE_PERIOD) + +NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_BSS_MAX_IDLE_PERIOD); + /** @brief Wi-Fi management events */ enum net_event_wifi_cmd { /** Scan results available */ @@ -1559,6 +1566,15 @@ struct wifi_mgmt_ops { * @return 0 if ok, < 0 if error */ int (*start_11r_roaming)(const struct device *dev); + /** Set BSS max idle period + * + * @param dev Pointer to the device structure for the driver instance. + * @param BSS max idle period value + * + * @return 0 if ok, < 0 if error + */ + int (*set_bss_max_idle_period)(const struct device *dev, + unsigned short bss_max_idle_period); }; /** Wi-Fi management offload API */ diff --git a/modules/hostap/src/supp_api.c b/modules/hostap/src/supp_api.c index cde1ef95f478..3679808b3d4b 100644 --- a/modules/hostap/src/supp_api.c +++ b/modules/hostap/src/supp_api.c @@ -1811,6 +1811,19 @@ int supplicant_legacy_roam(const struct device *dev) return ret; } +int supplicant_set_bss_max_idle_period(const struct device *dev, + unsigned short bss_max_idle_period) +{ + const struct wifi_mgmt_ops *const wifi_mgmt_api = get_wifi_mgmt_api(dev); + + if (!wifi_mgmt_api || !wifi_mgmt_api->set_bss_max_idle_period) { + wpa_printf(MSG_ERROR, "set_bss_max_idle_period is not supported"); + return -ENOTSUP; + } + + return wifi_mgmt_api->set_bss_max_idle_period(dev, bss_max_idle_period); +} + #ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_WNM int supplicant_btm_query(const struct device *dev, uint8_t reason) { diff --git a/modules/hostap/src/supp_api.h b/modules/hostap/src/supp_api.h index ddd3c3d66988..9d2b90b50fe0 100644 --- a/modules/hostap/src/supp_api.h +++ b/modules/hostap/src/supp_api.h @@ -305,6 +305,14 @@ int supplicant_get_wifi_conn_params(const struct device *dev, */ int supplicant_wps_config(const struct device *dev, struct wifi_wps_config_params *params); +/** @ Set Wi-Fi max idle period + * + * @param dev Wi-Fi interface handle to use + * @param bss_max_idle_period Maximum idle period to set + * @return 0 for OK; -1 for ERROR + */ +int supplicant_set_bss_max_idle_period(const struct device *dev, + unsigned short bss_max_idle_period); #ifdef CONFIG_AP int set_ap_bandwidth(const struct device *dev, enum wifi_frequency_bandwidths bandwidth); diff --git a/modules/hostap/src/supp_main.c b/modules/hostap/src/supp_main.c index c2a4866b9218..849ba834ec18 100644 --- a/modules/hostap/src/supp_main.c +++ b/modules/hostap/src/supp_main.c @@ -83,6 +83,7 @@ static const struct wifi_mgmt_ops mgmt_ops = { #endif .get_conn_params = supplicant_get_wifi_conn_params, .wps_config = supplicant_wps_config, + .set_bss_max_idle_period = supplicant_set_bss_max_idle_period, #ifdef CONFIG_AP .ap_enable = supplicant_ap_enable, .ap_disable = supplicant_ap_disable, diff --git a/subsys/net/l2/wifi/Kconfig b/subsys/net/l2/wifi/Kconfig index 4b1d309066c3..7728678cc979 100644 --- a/subsys/net/l2/wifi/Kconfig +++ b/subsys/net/l2/wifi/Kconfig @@ -154,3 +154,19 @@ config HEAP_MEM_POOL_ADD_SIZE_WIFI_CERT endif # WIFI_SHELL_RUNTIME_CERTIFICATES endif # WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE + +config WIFI_MGMT_BSS_MAX_IDLE_TIME + int "BSS max idle timeout in seconds" + range 0 64000 + default 30 + help + As per 802.11-2020: 11.21.13 BSS max idle period management + If dot11WirelessManagementImplemented is true, dot11BSSMaxIdlePeriod is + nonzero and dot11BSSMaxIdlePeriodIndicationByNonAPSTA is true, then a + non-S1G non-AP STA shall include a BSS Max Idle Period element + in the (Re)Association Request frame. If the BSS Max Idle Period + element is present in the (Re)Association Request frame received + by a non-S1G AP that has dot11BSSMaxIdlePeriodIndicationByNonAPSTA + equal to true, then the non-S1G AP may choose the non-AP STA’s + preferred maximum idle period. The non-S1G AP indicates its chosen + value to the non-S1G STA in the (Re)Association Response frame. diff --git a/subsys/net/l2/wifi/wifi_mgmt.c b/subsys/net/l2/wifi/wifi_mgmt.c index dc52c42a5c2f..67f1f68e5a5a 100644 --- a/subsys/net/l2/wifi/wifi_mgmt.c +++ b/subsys/net/l2/wifi/wifi_mgmt.c @@ -1403,6 +1403,31 @@ static int wifi_set_enterprise_creds(uint32_t mgmt_request, struct net_if *iface NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_ENTERPRISE_CREDS, wifi_set_enterprise_creds); #endif +static int wifi_set_bss_max_idle_period(uint32_t mgmt_request, struct net_if *iface, + void *data, size_t len) +{ + const struct device *dev = net_if_get_device(iface); + const struct wifi_mgmt_ops *const wifi_mgmt_api = get_wifi_api(iface); + unsigned short *bss_max_idle_period = data; + + if (wifi_mgmt_api == NULL || wifi_mgmt_api->set_bss_max_idle_period == NULL) { + return -ENOTSUP; + } + + if (!net_if_is_admin_up(iface)) { + return -ENETDOWN; + } + + if (!data || len != sizeof(*bss_max_idle_period)) { + return -EINVAL; + } + + return wifi_mgmt_api->set_bss_max_idle_period(dev, *bss_max_idle_period); +} + +NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_BSS_MAX_IDLE_PERIOD, + wifi_set_bss_max_idle_period); + #ifdef CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS void wifi_mgmt_raise_raw_scan_result_event(struct net_if *iface, struct wifi_raw_scan_result *raw_scan_result) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 07514b53a336..6ef17817aa45 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -3455,6 +3455,32 @@ static int cmd_wifi_pmksa_flush(const struct shell *sh, size_t argc, char *argv[ return 0; } + +static int cmd_wifi_set_bss_max_idle_period(const struct shell *sh, size_t argc, char *argv[]) +{ + struct net_if *iface = get_iface(IFACE_TYPE_STA, argc, argv); + unsigned short bss_max_idle_period = 0; + int idx = 1; + unsigned long val = 0; + + if (!parse_number(sh, &val, argv[idx++], "bss_max_idle_period", 0, USHRT_MAX)) { + return -EINVAL; + } + + bss_max_idle_period = (unsigned short)val; + + if (net_mgmt(NET_REQUEST_WIFI_BSS_MAX_IDLE_PERIOD, iface, + &bss_max_idle_period, sizeof(bss_max_idle_period))) { + shell_fprintf(sh, SHELL_WARNING, + "Setting BSS maximum idle period failed.\n"); + return -ENOEXEC; + } + + shell_fprintf(sh, SHELL_NORMAL, "BSS max idle period: %hu\n", bss_max_idle_period); + + return 0; +} + SHELL_STATIC_SUBCMD_SET_CREATE( wifi_cmd_ap, SHELL_CMD_ARG(disable, NULL, "Disable Access Point mode.\n" @@ -3930,6 +3956,12 @@ SHELL_SUBCMD_ADD((wifi), ps_exit_strategy, NULL, cmd_wifi_ps_exit_strategy, 2, 2); +SHELL_SUBCMD_ADD((wifi), bss_max_idle_period, NULL, + ".\n" + "[-i, --iface=] : Interface index.\n", + cmd_wifi_set_bss_max_idle_period, + 2, 2); + SHELL_CMD_REGISTER(wifi, &wifi_commands, "Wi-Fi commands", NULL); static int wifi_shell_init(void) From 4ba4327b0faa1db6243f111d83e4a8eb66b2754f Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Tue, 22 Jul 2025 13:16:46 +0530 Subject: [PATCH 0358/2141] [nrf noup] logging: Add ratelimited variants These are helpful for logging in data-path, not to overwhelm the console but still keep the user informed about the issues. This is similar to printk_ratelimited in Linux kernel. Add only basic build tests for now. Upstream PR #: 93536 [To avoid release notes churn, marking as noup] Signed-off-by: Chaitanya Tata (cherry picked from commit 0d71d14d2a8e3d62d0309fcf9efc2c3ab467ad25) --- doc/services/logging/index.rst | 99 +++++ include/zephyr/logging/log.h | 375 ++++++++++++++++++ subsys/logging/Kconfig | 50 +++ .../logging/log_ratelimited/CMakeLists.txt | 9 + tests/subsys/logging/log_ratelimited/prj.conf | 18 + .../log_ratelimited/test_log_ratelimited.c | 62 +++ .../logging/log_ratelimited/testcase.yaml | 23 ++ 7 files changed, 636 insertions(+) create mode 100644 tests/subsys/logging/log_ratelimited/CMakeLists.txt create mode 100644 tests/subsys/logging/log_ratelimited/prj.conf create mode 100644 tests/subsys/logging/log_ratelimited/test_log_ratelimited.c create mode 100644 tests/subsys/logging/log_ratelimited/testcase.yaml diff --git a/doc/services/logging/index.rst b/doc/services/logging/index.rst index 86f5e97d8c96..be6831616550 100644 --- a/doc/services/logging/index.rst +++ b/doc/services/logging/index.rst @@ -32,6 +32,7 @@ Summary of the logging features: - Support for logging floating point variables and long long arguments. - Built-in copying of transient strings used as arguments. - Support for multi-domain logging. +- Rate-limited logging macros to prevent log flooding when messages are generated frequently. Logging API is highly configurable at compile time as well as at run time. Using Kconfig options (see :ref:`logging_kconfig`) logs can be gradually removed from @@ -59,6 +60,16 @@ The warning level also exposes the following additional macro: - :c:macro:`LOG_WRN_ONCE` for warnings where only the first occurrence is of interest. +Rate-limited logging macros are also available for all severity levels to prevent log flooding: + +- ``LOG_X_RATELIMIT`` for rate-limited standard printf-like messages using default rate, e.g. :c:macro:`LOG_ERR_RATELIMIT`. +- ``LOG_X_RATELIMIT_RATE`` for rate-limited standard printf-like messages with custom rate, e.g. :c:macro:`LOG_ERR_RATELIMIT_RATE`. +- ``LOG_HEXDUMP_X_RATELIMIT`` for rate-limited data dumping using default rate, e.g. :c:macro:`LOG_HEXDUMP_WRN_RATELIMIT`. +- ``LOG_HEXDUMP_X_RATELIMIT_RATE`` for rate-limited data dumping with custom rate, e.g. :c:macro:`LOG_HEXDUMP_WRN_RATELIMIT_RATE`. + +The convenience macros use the default rate specified by ``CONFIG_LOG_RATELIMIT_INTERVAL_MS``, +while the explicit rate macros take a rate parameter (in milliseconds) that specifies the minimum interval between log messages. + There are two configuration categories: configurations per module and global configuration. When logging is enabled globally, it works for modules. However, modules can disable logging locally. Every module can specify its own logging @@ -341,6 +352,94 @@ If logs are processed from a thread (user or internal) then it is possible to en a feature which will wake up processing thread when certain amount of log messages are buffered (see :kconfig:option:`CONFIG_LOG_PROCESS_TRIGGER_THRESHOLD`). +.. _logging_ratelimited: + +Rate-limited logging +******************** + +Rate-limited logging macros provide a way to prevent log flooding when messages are +generated frequently. These macros ensure that log messages are not output more +frequently than a specified interval, similar to Linux's ``printk_ratelimited`` +functionality. + +The rate-limited logging system provides two types of macros: + +**Convenience macros (using default rate):** +- :c:macro:`LOG_ERR_RATELIMIT` - Rate-limited error messages +- :c:macro:`LOG_WRN_RATELIMIT` - Rate-limited warning messages +- :c:macro:`LOG_INF_RATELIMIT` - Rate-limited info messages +- :c:macro:`LOG_DBG_RATELIMIT` - Rate-limited debug messages +- :c:macro:`LOG_HEXDUMP_ERR_RATELIMIT` - Rate-limited error hexdump +- :c:macro:`LOG_HEXDUMP_WRN_RATELIMIT` - Rate-limited warning hexdump +- :c:macro:`LOG_HEXDUMP_INF_RATELIMIT` - Rate-limited info hexdump +- :c:macro:`LOG_HEXDUMP_DBG_RATELIMIT` - Rate-limited debug hexdump + +**Explicit rate macros (with custom rate):** +- :c:macro:`LOG_ERR_RATELIMIT_RATE` - Rate-limited error messages with custom rate +- :c:macro:`LOG_WRN_RATELIMIT_RATE` - Rate-limited warning messages with custom rate +- :c:macro:`LOG_INF_RATELIMIT_RATE` - Rate-limited info messages with custom rate +- :c:macro:`LOG_DBG_RATELIMIT_RATE` - Rate-limited debug messages with custom rate +- :c:macro:`LOG_HEXDUMP_ERR_RATELIMIT_RATE` - Rate-limited error hexdump with custom rate +- :c:macro:`LOG_HEXDUMP_WRN_RATELIMIT_RATE` - Rate-limited warning hexdump with custom rate +- :c:macro:`LOG_HEXDUMP_INF_RATELIMIT_RATE` - Rate-limited info hexdump with custom rate +- :c:macro:`LOG_HEXDUMP_DBG_RATELIMIT_RATE` - Rate-limited debug hexdump with custom rate + +The convenience macros use the default rate specified by :kconfig:option:`CONFIG_LOG_RATELIMIT_INTERVAL_MS` +(5000ms by default). The explicit rate macros take a rate parameter (in milliseconds) that specifies +the minimum interval between log messages. The rate limiting is per-macro-call-site, meaning +that each unique call to a rate-limited macro has its own independent rate limit. + +Example usage: + +.. code-block:: c + + #include + #include + + LOG_MODULE_REGISTER(my_module, CONFIG_LOG_DEFAULT_LEVEL); + + void process_data(void) + { + /* Convenience macros using default rate (CONFIG_LOG_RATELIMIT_INTERVAL_MS) */ + LOG_WRN_RATELIMIT("Data processing warning: %d", error_code); + LOG_ERR_RATELIMIT("Critical error occurred: %s", error_msg); + LOG_INF_RATELIMIT("Processing status: %d items", item_count); + LOG_HEXDUMP_WRN_RATELIMIT(data_buffer, data_len, "Data buffer:"); + + /* Explicit rate macros with custom intervals */ + LOG_WRN_RATELIMIT_RATE(1000, "Fast rate warning: %d", error_code); + LOG_ERR_RATELIMIT_RATE(30000, "Slow rate error: %s", error_msg); + LOG_INF_RATELIMIT_RATE(2000, "Custom rate status: %d items", item_count); + LOG_HEXDUMP_ERR_RATELIMIT_RATE(5000, data_buffer, data_len, "Error data:"); + } + +Rate-limited logging is particularly useful for: + +- Error conditions that might occur frequently but don't need to flood the logs +- Status updates in tight loops or high-frequency callbacks +- Debug information that could overwhelm the logging system +- Network or I/O operations that might fail repeatedly + +Configuration +============== + +Rate-limited logging can be configured using the following Kconfig options: + +- :kconfig:option:`CONFIG_LOG_RATELIMIT` - Master switch to enable/disable rate-limited logging +- :kconfig:option:`CONFIG_LOG_RATELIMIT_INTERVAL_MS` - Default interval for convenience macros (5000ms) + +When :kconfig:option:`CONFIG_LOG_RATELIMIT` is disabled, the behavior of rate-limited macros is controlled +by the :kconfig:option:`CONFIG_LOG_RATELIMIT_FALLBACK` choice: + +- :kconfig:option:`CONFIG_LOG_RATELIMIT_FALLBACK_LOG` - All rate-limited macros behave as regular logging macros +- :kconfig:option:`CONFIG_LOG_RATELIMIT_FALLBACK_DROP` - All rate-limited macros expand to no-ops (default) + +This allows you to control whether rate-limited log macros should always print or be completely +suppressed when rate limiting is not available. + +The rate limiting is implemented using static variables and :c:func:`k_uptime_get_32` +to track the last log time for each call site. + .. _logging_panic: Logging panic diff --git a/include/zephyr/logging/log.h b/include/zephyr/logging/log.h index 2358b332ef4e..84601af43935 100644 --- a/include/zephyr/logging/log.h +++ b/include/zephyr/logging/log.h @@ -10,6 +10,7 @@ #include #include #include +#include #if CONFIG_USERSPACE && CONFIG_LOG_ALWAYS_RUNTIME #include @@ -96,6 +97,340 @@ extern "C" { } \ } while (0) +#if defined(CONFIG_LOG_RATELIMIT) || defined(__DOXYGEN__) +/** + * @brief Core rate-limited logging macro + * + * @details Internal macro that provides rate-limited logging functionality. + * Uses atomic operations to ensure thread safety in multi-threaded environments. + * Only one thread can successfully log a message within the specified rate limit period. + * + * @param _level Log level (LOG_LEVEL_ERR, LOG_LEVEL_WRN, etc.) + * @param _rate_ms Minimum interval in milliseconds between log messages. + * @param _skipped_msg Message to show when messages are skipped. + * @param _log_func Logging function to call (Z_LOG or Z_LOG_HEXDUMP) + * @param ... Arguments to pass to the logging function. + */ +#define _LOG_RATELIMIT_CORE(_level, _rate_ms, _skipped_msg, _log_func, ...) \ + do { \ + static atomic_t __last_log_time ; \ + static atomic_t __skipped_count ; \ + uint32_t __now = k_uptime_get_32(); \ + uint32_t __last = atomic_get(&__last_log_time); \ + uint32_t __diff = __now - __last; \ + if (unlikely(__diff >= (_rate_ms))) { \ + if (atomic_cas(&__last_log_time, __last, __now)) { \ + uint32_t __skipped = atomic_clear(&__skipped_count); \ + if (__skipped > 0) { \ + Z_LOG(_level, _skipped_msg, __skipped); \ + } \ + _log_func(_level, __VA_ARGS__); \ + } else { \ + atomic_inc(&__skipped_count); \ + } \ + } else { \ + atomic_inc(&__skipped_count); \ + } \ + } while (0) + +/** + * @brief Rate-limited logging macros + * + * @details These macros provide rate-limited logging functionality to prevent + * log flooding when messages are generated frequently. Each macro ensures that + * log messages are not output more frequently than a specified interval. + * Rate limiting is per-macro-call-site, meaning each unique call has its own + * independent rate limit. + * + * The macros use atomic operations to ensure thread safety in multi-threaded + * environments. Only one thread can successfully log a message within the + * specified rate limit period. + * + * @see CONFIG_LOG_RATELIMIT_INTERVAL_MS + */ + +/** + * @brief Writes a WARNING level message to the log with rate limiting. + * + * @details It's meant for situations that warrant investigation but could clutter + * the logs if output too frequently. The message will be logged at most once + * per specified interval in milliseconds. + * + * @param _rate_ms Minimum interval in milliseconds between log messages. + * @param ... A string optionally containing printk valid conversion specifier, + * followed by as many values as specifiers. + */ +#define LOG_WRN_RATELIMIT_RATE(_rate_ms, ...) \ + _LOG_RATELIMIT_CORE(LOG_LEVEL_WRN, _rate_ms, "Skipped %d messages", Z_LOG, __VA_ARGS__) + +/** + * @brief Writes a WARNING level message to the log with rate limiting. + * + * @details It's meant for situations that warrant investigation but could clutter + * the logs if output too frequently. The message will be logged at most once + * per default interval (see CONFIG_LOG_RATELIMIT_INTERVAL_MS). + * + * @param ... A string optionally containing printk valid conversion specifier, + * followed by as many values as specifiers. + */ +#define LOG_WRN_RATELIMIT(...) \ + LOG_WRN_RATELIMIT_RATE(CONFIG_LOG_RATELIMIT_INTERVAL_MS, __VA_ARGS__) + +/** + * @brief Writes an ERROR level message to the log with rate limiting. + * + * @details It's meant to report severe errors, such as those from which it's + * not possible to recover, but with rate limiting to prevent log flooding. + * The message will be logged at most once per specified interval in milliseconds. + * + * @param _rate_ms Minimum interval in milliseconds between log messages. + * @param ... A string optionally containing printk valid conversion specifier, + * followed by as many values as specifiers. + */ +#define LOG_ERR_RATELIMIT_RATE(_rate_ms, ...) \ + _LOG_RATELIMIT_CORE(LOG_LEVEL_ERR, _rate_ms, "Skipped %d messages", Z_LOG, __VA_ARGS__) + +/** + * @brief Writes an ERROR level message to the log with rate limiting. + * + * @details It's meant to report severe errors, such as those from which it's + * not possible to recover, but with rate limiting to prevent log flooding. + * The message will be logged at most once per default interval (see + * CONFIG_LOG_RATELIMIT_INTERVAL_MS). + * + * @param ... A string optionally containing printk valid conversion specifier, + * followed by as many values as specifiers. + */ +#define LOG_ERR_RATELIMIT(...) \ + LOG_ERR_RATELIMIT_RATE(CONFIG_LOG_RATELIMIT_INTERVAL_MS, __VA_ARGS__) + +/** + * @brief Writes an INFO level message to the log with rate limiting. + * + * @details It's meant to write generic user oriented messages with rate limiting + * to prevent log flooding. The message will be logged at most once per specified + * interval in milliseconds. + * + * @param _rate_ms Minimum interval in milliseconds between log messages. + * @param ... A string optionally containing printk valid conversion specifier, + * followed by as many values as specifiers. + */ +#define LOG_INF_RATELIMIT_RATE(_rate_ms, ...) \ + _LOG_RATELIMIT_CORE(LOG_LEVEL_INF, _rate_ms, "Skipped %d messages", Z_LOG, __VA_ARGS__) + +/** + * @brief Writes an INFO level message to the log with rate limiting. + * + * @details It's meant to write generic user oriented messages with rate limiting + * to prevent log flooding. The message will be logged at most once per default + * interval (see CONFIG_LOG_RATELIMIT_INTERVAL_MS). + * + * @param ... A string optionally containing printk valid conversion specifier, + * followed by as many values as specifiers. + */ +#define LOG_INF_RATELIMIT(...) \ + LOG_INF_RATELIMIT_RATE(CONFIG_LOG_RATELIMIT_INTERVAL_MS, __VA_ARGS__) + +/** + * @brief Writes a DEBUG level message to the log with rate limiting. + * + * @details It's meant to write developer oriented information with rate limiting + * to prevent log flooding. The message will be logged at most once per specified + * interval in milliseconds. + * + * @param _rate_ms Minimum interval in milliseconds between log messages. + * @param ... A string optionally containing printk valid conversion specifier, + * followed by as many values as specifiers. + */ +#define LOG_DBG_RATELIMIT_RATE(_rate_ms, ...) \ + _LOG_RATELIMIT_CORE(LOG_LEVEL_DBG, _rate_ms, "Skipped %d messages", Z_LOG, __VA_ARGS__) + +/** + * @brief Writes a DEBUG level message to the log with rate limiting. + * + * @details It's meant to write developer oriented information with rate limiting + * to prevent log flooding. The message will be logged at most once per default + * interval (see CONFIG_LOG_RATELIMIT_INTERVAL_MS). + * + * @param ... A string optionally containing printk valid conversion specifier, + * followed by as many values as specifiers. + */ +#define LOG_DBG_RATELIMIT(...) \ + LOG_DBG_RATELIMIT_RATE(CONFIG_LOG_RATELIMIT_INTERVAL_MS, __VA_ARGS__) + +/** + * @brief Writes an ERROR level hexdump message to the log with rate limiting. + * + * @details It's meant to report severe errors, such as those from which it's + * not possible to recover, but with rate limiting to prevent log flooding. + * The message will be logged at most once per specified interval in milliseconds. + * + * @param _rate_ms Minimum interval in milliseconds between log messages. + * @param _data Pointer to the data to be logged. + * @param _length Length of data (in bytes). + * @param _str Persistent, raw string. + */ +#define LOG_HEXDUMP_ERR_RATELIMIT_RATE(_rate_ms, _data, _length, _str) \ + _LOG_RATELIMIT_CORE(LOG_LEVEL_ERR, _rate_ms, "Skipped %d hexdump messages", \ + Z_LOG_HEXDUMP, _data, _length, _str) + +/** + * @brief Writes an ERROR level hexdump message to the log with rate limiting. + * + * @details It's meant to report severe errors, such as those from which it's + * not possible to recover, but with rate limiting to prevent log flooding. + * The message will be logged at most once per default interval (see + * CONFIG_LOG_RATELIMIT_INTERVAL_MS). + * + * @param _data Pointer to the data to be logged. + * @param _length Length of data (in bytes). + * @param _str Persistent, raw string. + */ +#define LOG_HEXDUMP_ERR_RATELIMIT(_data, _length, _str) \ + LOG_HEXDUMP_ERR_RATELIMIT_RATE(CONFIG_LOG_RATELIMIT_INTERVAL_MS, _data, _length, _str) + +/** + * @brief Writes a WARNING level hexdump message to the log with rate limiting. + * + * @details It's meant to register messages related to unusual situations that + * are not necessarily errors, but with rate limiting to prevent log flooding. + * The message will be logged at most once per specified interval in milliseconds. + * + * @param _rate_ms Minimum interval in milliseconds between log messages. + * @param _data Pointer to the data to be logged. + * @param _length Length of data (in bytes). + * @param _str Persistent, raw string. + */ +#define LOG_HEXDUMP_WRN_RATELIMIT_RATE(_rate_ms, _data, _length, _str) \ + _LOG_RATELIMIT_CORE(LOG_LEVEL_WRN, _rate_ms, "Skipped %d hexdump messages", \ + Z_LOG_HEXDUMP, _data, _length, _str) + +/** + * @brief Writes a WARNING level hexdump message to the log with rate limiting. + * + * @details It's meant to register messages related to unusual situations that + * are not necessarily errors, but with rate limiting to prevent log flooding. + * The message will be logged at most once per default interval (see + * CONFIG_LOG_RATELIMIT_INTERVAL_MS). + * + * @param _data Pointer to the data to be logged. + * @param _length Length of data (in bytes). + * @param _str Persistent, raw string. + */ +#define LOG_HEXDUMP_WRN_RATELIMIT(_data, _length, _str) \ + LOG_HEXDUMP_WRN_RATELIMIT_RATE(CONFIG_LOG_RATELIMIT_INTERVAL_MS, _data, _length, _str) + +/** + * @brief Writes an INFO level hexdump message to the log with rate limiting. + * + * @details It's meant to write generic user oriented messages with rate limiting + * to prevent log flooding. The message will be logged at most once per specified + * interval in milliseconds. + * + * @param _rate_ms Minimum interval in milliseconds between log messages. + * @param _data Pointer to the data to be logged. + * @param _length Length of data (in bytes). + * @param _str Persistent, raw string. + */ +#define LOG_HEXDUMP_INF_RATELIMIT_RATE(_rate_ms, _data, _length, _str) \ + _LOG_RATELIMIT_CORE(LOG_LEVEL_INF, _rate_ms, "Skipped %d hexdump messages", \ + Z_LOG_HEXDUMP, _data, _length, _str) + +/** + * @brief Writes an INFO level hexdump message to the log with rate limiting. + * + * @details It's meant to write generic user oriented messages with rate limiting + * to prevent log flooding. The message will be logged at most once per default + * interval (see CONFIG_LOG_RATELIMIT_INTERVAL_MS). + * + * @param _data Pointer to the data to be logged. + * @param _length Length of data (in bytes). + * @param _str Persistent, raw string. + */ +#define LOG_HEXDUMP_INF_RATELIMIT(_data, _length, _str) \ + LOG_HEXDUMP_INF_RATELIMIT_RATE(CONFIG_LOG_RATELIMIT_INTERVAL_MS, _data, _length, _str) + +/** + * @brief Writes a DEBUG level hexdump message to the log with rate limiting. + * + * @details It's meant to write developer oriented information with rate limiting + * to prevent log flooding. The message will be logged at most once per specified + * interval in milliseconds. + * + * @param _rate_ms Minimum interval in milliseconds between log messages. + * @param _data Pointer to the data to be logged. + * @param _length Length of data (in bytes). + * @param _str Persistent, raw string. + */ +#define LOG_HEXDUMP_DBG_RATELIMIT_RATE(_rate_ms, _data, _length, _str) \ + _LOG_RATELIMIT_CORE(LOG_LEVEL_DBG, _rate_ms, "Skipped %d hexdump messages", \ + Z_LOG_HEXDUMP, _data, _length, _str) + +/** + * @brief Writes a DEBUG level hexdump message to the log with rate limiting. + * + * @details It's meant to write developer oriented information with rate limiting + * to prevent log flooding. The message will be logged at most once per default + * interval (see CONFIG_LOG_RATELIMIT_INTERVAL_MS). + * + * @param _data Pointer to the data to be logged. + * @param _length Length of data (in bytes). + * @param _str Persistent, raw string. + */ +#define LOG_HEXDUMP_DBG_RATELIMIT(_data, _length, _str) \ + LOG_HEXDUMP_DBG_RATELIMIT_RATE(CONFIG_LOG_RATELIMIT_INTERVAL_MS, _data, _length, _str) + +#else /* CONFIG_LOG_RATELIMIT */ + +/* Rate-limited logging macros when CONFIG_LOG_RATELIMIT is disabled */ +#if defined(CONFIG_LOG_RATELIMIT_FALLBACK_DROP) +/* Fallback: Drop all prints (no output) */ +#define LOG_WRN_RATELIMIT_RATE(_rate_ms, ...) (void)0 +#define LOG_WRN_RATELIMIT(...) (void)0 +#define LOG_ERR_RATELIMIT_RATE(_rate_ms, ...) (void)0 +#define LOG_ERR_RATELIMIT(...) (void)0 +#define LOG_INF_RATELIMIT_RATE(_rate_ms, ...) (void)0 +#define LOG_INF_RATELIMIT(...) (void)0 +#define LOG_DBG_RATELIMIT_RATE(_rate_ms, ...) (void)0 +#define LOG_DBG_RATELIMIT(...) (void)0 +#define LOG_HEXDUMP_ERR_RATELIMIT_RATE(_rate_ms, _data, _length, _str) (void)0 +#define LOG_HEXDUMP_ERR_RATELIMIT(_data, _length, _str) (void)0 +#define LOG_HEXDUMP_WRN_RATELIMIT_RATE(_rate_ms, _data, _length, _str) (void)0 +#define LOG_HEXDUMP_WRN_RATELIMIT(_data, _length, _str) (void)0 +#define LOG_HEXDUMP_INF_RATELIMIT_RATE(_rate_ms, _data, _length, _str) (void)0 +#define LOG_HEXDUMP_INF_RATELIMIT(_data, _length, _str) (void)0 +#define LOG_HEXDUMP_DBG_RATELIMIT_RATE(_rate_ms, _data, _length, _str) (void)0 +#define LOG_HEXDUMP_DBG_RATELIMIT(_data, _length, _str) (void)0 +#else /* Catch all, not just CONFIG_LOG_RATELIMIT_FALLBACK_LOG */ +/* Fallback: Log all prints (ignore rate limiting) */ +#define LOG_WRN_RATELIMIT_RATE(_rate_ms, ...) LOG_WRN(__VA_ARGS__) +#define LOG_WRN_RATELIMIT(...) LOG_WRN(__VA_ARGS__) +#define LOG_ERR_RATELIMIT_RATE(_rate_ms, ...) LOG_ERR(__VA_ARGS__) +#define LOG_ERR_RATELIMIT(...) LOG_ERR(__VA_ARGS__) +#define LOG_INF_RATELIMIT_RATE(_rate_ms, ...) LOG_INF(__VA_ARGS__) +#define LOG_INF_RATELIMIT(...) LOG_INF(__VA_ARGS__) +#define LOG_DBG_RATELIMIT_RATE(_rate_ms, ...) LOG_DBG(__VA_ARGS__) +#define LOG_DBG_RATELIMIT(...) LOG_DBG(__VA_ARGS__) +#define LOG_HEXDUMP_ERR_RATELIMIT_RATE(_rate_ms, _data, _length, _str) \ + LOG_HEXDUMP_ERR(_data, _length, _str) +#define LOG_HEXDUMP_ERR_RATELIMIT(_data, _length, _str) \ + LOG_HEXDUMP_ERR(_data, _length, _str) +#define LOG_HEXDUMP_WRN_RATELIMIT_RATE(_rate_ms, _data, _length, _str) \ + LOG_HEXDUMP_WRN(_data, _length, _str) +#define LOG_HEXDUMP_WRN_RATELIMIT(_data, _length, _str) \ + LOG_HEXDUMP_WRN(_data, _length, _str) +#define LOG_HEXDUMP_INF_RATELIMIT_RATE(_rate_ms, _data, _length, _str) \ + LOG_HEXDUMP_INF(_data, _length, _str) +#define LOG_HEXDUMP_INF_RATELIMIT(_data, _length, _str) \ + LOG_HEXDUMP_INF(_data, _length, _str) +#define LOG_HEXDUMP_DBG_RATELIMIT_RATE(_rate_ms, _data, _length, _str) \ + LOG_HEXDUMP_DBG(_data, _length, _str) +#define LOG_HEXDUMP_DBG_RATELIMIT(_data, _length, _str) \ + LOG_HEXDUMP_DBG(_data, _length, _str) +#endif + +#endif /* CONFIG_LOG_RATELIMIT */ + /** * @brief Unconditionally print raw log message. * @@ -499,6 +834,46 @@ extern struct k_mem_partition k_log_partition; #define LOG_HEXDUMP_WRN(...) (void) 0 #define LOG_HEXDUMP_DBG(...) (void) 0 #define LOG_HEXDUMP_INF(...) (void) 0 + +#undef LOG_ERR_RATELIMIT +#undef LOG_WRN_RATELIMIT +#undef LOG_INF_RATELIMIT +#undef LOG_DBG_RATELIMIT + +#undef LOG_ERR_RATELIMIT_RATE +#undef LOG_WRN_RATELIMIT_RATE +#undef LOG_INF_RATELIMIT_RATE +#undef LOG_DBG_RATELIMIT_RATE + +#undef LOG_HEXDUMP_ERR_RATELIMIT +#undef LOG_HEXDUMP_WRN_RATELIMIT +#undef LOG_HEXDUMP_INF_RATELIMIT +#undef LOG_HEXDUMP_DBG_RATELIMIT + +#undef LOG_HEXDUMP_ERR_RATELIMIT_RATE +#undef LOG_HEXDUMP_WRN_RATELIMIT_RATE +#undef LOG_HEXDUMP_INF_RATELIMIT_RATE +#undef LOG_HEXDUMP_DBG_RATELIMIT_RATE + +#define LOG_ERR_RATELIMIT(...) (void) 0 +#define LOG_WRN_RATELIMIT(...) (void) 0 +#define LOG_INF_RATELIMIT(...) (void) 0 +#define LOG_DBG_RATELIMIT(...) (void) 0 + +#define LOG_HEXDUMP_ERR_RATELIMIT(...) (void) 0 +#define LOG_HEXDUMP_WRN_RATELIMIT(...) (void) 0 +#define LOG_HEXDUMP_INF_RATELIMIT(...) (void) 0 +#define LOG_HEXDUMP_DBG_RATELIMIT(...) (void) 0 + +#define LOG_ERR_RATELIMIT_RATE(...) (void) 0 +#define LOG_WRN_RATELIMIT_RATE(...) (void) 0 +#define LOG_INF_RATELIMIT_RATE(...) (void) 0 +#define LOG_DBG_RATELIMIT_RATE(...) (void) 0 + +#define LOG_HEXDUMP_ERR_RATELIMIT_RATE(...) (void) 0 +#define LOG_HEXDUMP_WRN_RATELIMIT_RATE(...) (void) 0 +#define LOG_HEXDUMP_INF_RATELIMIT_RATE(...) (void) 0 +#define LOG_HEXDUMP_DBG_RATELIMIT_RATE(...) (void) 0 #endif /** diff --git a/subsys/logging/Kconfig b/subsys/logging/Kconfig index f7a7b32b8047..00a91f43c14c 100644 --- a/subsys/logging/Kconfig +++ b/subsys/logging/Kconfig @@ -49,6 +49,56 @@ endif rsource "Kconfig.misc" +config LOG_RATELIMIT + bool "Rate-limited logging macros" + default y + help + When enabled, provides rate-limited logging macros that prevent + log flooding when messages are generated frequently. Rate limiting + is per-macro-call-site, meaning each unique call has its own + independent rate limit. + +if LOG_RATELIMIT + +config LOG_RATELIMIT_INTERVAL_MS + int "Default rate limit interval (milliseconds)" + default 5000 + range 100 60000 + help + Default interval between rate-limited log messages. + This is used by the convenience macros LOG_*_RATELIMIT + when no explicit rate is provided. Can be overridden per call + using LOG_*_RATELIMIT_RATE macros. +endif # LOG_RATELIMIT + +if !LOG_RATELIMIT +choice LOG_RATELIMIT_FALLBACK + prompt "Fallback behavior for rate-limited logging macros" + default LOG_RATELIMIT_FALLBACK_DROP + help + Select fallback behavior for rate-limited logging macros when + LOG_RATELIMIT is disabled. + + - "Log all prints": All log prints are output, i.e., rate limiting is ignored. + - "Drop all prints": All log prints using rate-limited macros are dropped. + + This option allows you to control whether rate-limited log macros + should always print or be completely suppressed when rate limiting + is not available. + +config LOG_RATELIMIT_FALLBACK_LOG + bool "Log all prints (ignore rate limiting)" + help + All log prints using rate-limited macros are output as normal logs. + +config LOG_RATELIMIT_FALLBACK_DROP + bool "Drop all prints" + help + All log prints using rate-limited macros are dropped (no output). + +endchoice +endif # !LOG_RATELIMIT + endif # LOG config LOG_OUTPUT diff --git a/tests/subsys/logging/log_ratelimited/CMakeLists.txt b/tests/subsys/logging/log_ratelimited/CMakeLists.txt new file mode 100644 index 000000000000..29df5637b030 --- /dev/null +++ b/tests/subsys/logging/log_ratelimited/CMakeLists.txt @@ -0,0 +1,9 @@ +# Copyright (c) 2025 +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(log_ratelimited_test) + +FILE(GLOB app_sources *.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/subsys/logging/log_ratelimited/prj.conf b/tests/subsys/logging/log_ratelimited/prj.conf new file mode 100644 index 000000000000..e3621aa1a7ed --- /dev/null +++ b/tests/subsys/logging/log_ratelimited/prj.conf @@ -0,0 +1,18 @@ +CONFIG_MAIN_THREAD_PRIORITY=5 +CONFIG_ZTEST=y +CONFIG_TEST_USERSPACE=y +CONFIG_TEST_LOGGING_DEFAULTS=n +CONFIG_LOG=y +CONFIG_LOG_OUTPUT=y +CONFIG_LOG_PRINTK=n +CONFIG_LOG_BACKEND_UART=y +CONFIG_LOG_BUFFER_SIZE=768 +CONFIG_KERNEL_LOG_LEVEL_OFF=y +CONFIG_SOC_LOG_LEVEL_OFF=y +CONFIG_ARCH_LOG_LEVEL_OFF=y +CONFIG_LOG_FUNC_NAME_PREFIX_DBG=n +CONFIG_LOG_PROCESS_THREAD=n +CONFIG_ASSERT=y +CONFIG_MAIN_STACK_SIZE=4096 +CONFIG_LOG_DEFAULT_LEVEL=4 +CONFIG_LOG_RATELIMIT=y diff --git a/tests/subsys/logging/log_ratelimited/test_log_ratelimited.c b/tests/subsys/logging/log_ratelimited/test_log_ratelimited.c new file mode 100644 index 000000000000..ea22fe57964e --- /dev/null +++ b/tests/subsys/logging/log_ratelimited/test_log_ratelimited.c @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2025 + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include + +LOG_MODULE_REGISTER(test_log_ratelimited, CONFIG_LOG_DEFAULT_LEVEL); + +#ifndef CONFIG_LOG_RATELIMIT_FALLBACK_DROP +/* Test data for hexdump */ +static uint8_t test_data[] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08}; +#endif /* CONFIG_LOG_RATELIMIT_FALLBACK_DROP */ + +/** + * @brief Test compilation of all rate-limited macros. + * This test primarily checks for compilation errors and does not assert log + * counts, as log levels might filter some messages depending on Kconfig. + */ +ZTEST(log_ratelimited, test_compilation) +{ + /* This test only checks if the macros compile without errors. */ + /* Call each macro once to ensure compilation. */ + LOG_ERR_RATELIMIT("Compilation test: Error message"); + LOG_WRN_RATELIMIT("Compilation test: Warning message"); + LOG_INF_RATELIMIT("Compilation test: Info message"); + LOG_DBG_RATELIMIT("Compilation test: Debug message"); + + LOG_ERR_RATELIMIT_RATE(100, "Compilation test: Error message with rate"); + LOG_WRN_RATELIMIT_RATE(100, "Compilation test: Warning message with rate"); + LOG_INF_RATELIMIT_RATE(100, "Compilation test: Info message with rate"); + LOG_DBG_RATELIMIT_RATE(100, "Compilation test: Debug message with rate"); + + LOG_HEXDUMP_ERR_RATELIMIT(test_data, sizeof(test_data), + "Compilation test: Error hexdump"); + LOG_HEXDUMP_WRN_RATELIMIT(test_data, sizeof(test_data), + "Compilation test: Warning hexdump"); + LOG_HEXDUMP_INF_RATELIMIT(test_data, sizeof(test_data), + "Compilation test: Info hexdump"); + LOG_HEXDUMP_DBG_RATELIMIT(test_data, sizeof(test_data), + "Compilation test: Debug hexdump"); + + LOG_HEXDUMP_ERR_RATELIMIT_RATE(100, test_data, sizeof(test_data), + "Compilation test: Error hexdump with rate"); + LOG_HEXDUMP_WRN_RATELIMIT_RATE(100, test_data, sizeof(test_data), + "Compilation test: Warning hexdump with rate"); + LOG_HEXDUMP_INF_RATELIMIT_RATE(100, test_data, sizeof(test_data), + "Compilation test: Info hexdump with rate"); + LOG_HEXDUMP_DBG_RATELIMIT_RATE(100, test_data, sizeof(test_data), + "Compilation test: Debug hexdump with rate"); + + zassert_true(true, "All rate-limited macros compile successfully"); +} + + +/* Define the test suite and specify the setup function to be called before each + * test case. + */ +ZTEST_SUITE(log_ratelimited, NULL, NULL, NULL, NULL, NULL); diff --git a/tests/subsys/logging/log_ratelimited/testcase.yaml b/tests/subsys/logging/log_ratelimited/testcase.yaml new file mode 100644 index 000000000000..5fa2d18a5626 --- /dev/null +++ b/tests/subsys/logging/log_ratelimited/testcase.yaml @@ -0,0 +1,23 @@ +common: + integration_platforms: + - native_sim + tags: + - logging + platform_allow: + - native_sim + +tests: + logging.log_ratelimited: + build_only: true + extra_configs: + - CONFIG_LOG_RATELIMIT_INTERVAL_MS=1000 + logging.log_ratelimited.fallback_drop: + build_only: true + extra_configs: + - CONFIG_LOG_RATELIMIT=n + - CONFIG_LOG_RATELIMIT_FALLBACK_DROP=y + logging.log_ratelimited.fallback_log: + build_only: true + extra_configs: + - CONFIG_LOG_RATELIMIT=n + - CONFIG_LOG_RATELIMIT_FALLBACK_LOG=y From f6f6fd04956190ae9e94ea20f790430cd5aac7cf Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Fri, 25 Jul 2025 00:26:37 +0530 Subject: [PATCH 0359/2141] [nrf fromlist] net: Add ratelimited variants Add the ratelimtied variants for data path debug. Upstream PR #: 93536 Signed-off-by: Chaitanya Tata (cherry picked from commit 4a7110b11cd14379ba84d03bc7ebb0061b223561) --- include/zephyr/net/net_core.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/include/zephyr/net/net_core.h b/include/zephyr/net/net_core.h index e4b18418b3a5..505683eb139b 100644 --- a/include/zephyr/net/net_core.h +++ b/include/zephyr/net/net_core.h @@ -61,8 +61,14 @@ extern "C" { #define NET_WARN(fmt, ...) LOG_WRN(fmt, ##__VA_ARGS__) #define NET_INFO(fmt, ...) LOG_INF(fmt, ##__VA_ARGS__) -#define NET_HEXDUMP_DBG(_data, _length, _str) LOG_HEXDUMP_DBG(_data, _length, _str) -#define NET_HEXDUMP_ERR(_data, _length, _str) LOG_HEXDUMP_ERR(_data, _length, _str) +/* Rate-limited network logging macros */ +#define NET_ERR_RATELIMIT(fmt, ...) LOG_ERR_RATELIMIT(fmt, ##__VA_ARGS__) +#define NET_WARN_RATELIMIT(fmt, ...) LOG_WRN_RATELIMIT(fmt, ##__VA_ARGS__) +#define NET_INFO_RATELIMIT(fmt, ...) LOG_INF_RATELIMIT(fmt, ##__VA_ARGS__) +#define NET_DBG_RATELIMIT(fmt, ...) LOG_DBG_RATELIMIT(fmt, ##__VA_ARGS__) + +#define NET_HEXDUMP_DBG(_data, _length, _str) LOG_HEXDUMP_DBG(_data, _length, _str) +#define NET_HEXDUMP_ERR(_data, _length, _str) LOG_HEXDUMP_ERR(_data, _length, _str) #define NET_HEXDUMP_WARN(_data, _length, _str) LOG_HEXDUMP_WRN(_data, _length, _str) #define NET_HEXDUMP_INFO(_data, _length, _str) LOG_HEXDUMP_INF(_data, _length, _str) From 65087d8f5442a22df1e710eb633ce5edd590dc5a Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Tue, 22 Jul 2025 15:19:54 +0530 Subject: [PATCH 0360/2141] [nrf fromlist] net: ip: Use rate limited version As this is the hot data path, use a rate limited warning variant. Upstream PR #: 93282 Signed-off-by: Chaitanya Tata (cherry picked from commit 9476d1e10a2df81e09e38afe632d374d2cc16063) --- subsys/net/ip/net_if.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subsys/net/ip/net_if.c b/subsys/net/ip/net_if.c index b541787a0d98..8c5e7b81548f 100644 --- a/subsys/net/ip/net_if.c +++ b/subsys/net/ip/net_if.c @@ -262,8 +262,8 @@ static bool net_if_tx(struct net_if *iface, struct net_pkt *pkt) status = net_if_l2(iface)->send(iface, pkt); net_if_tx_unlock(iface); if (status < 0) { - NET_WARN("iface %d pkt %p send failure status %d", - net_if_get_by_iface(iface), pkt, status); + NET_WARN_RATELIMIT("iface %d pkt %p send failure status %d", + net_if_get_by_iface(iface), pkt, status); } if (IS_ENABLED(CONFIG_NET_PKT_TXTIME_STATS) || From 593cc07e7c9eba3954346539608deaf4073411c2 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Thu, 24 Jul 2025 16:51:30 +0530 Subject: [PATCH 0361/2141] [nrf fromlist] drivers: nrf_wifi: Fix defaults to avoid false recovery In case of a busy environment and if STA is far, then we see many retries for the frames that cause the RPU to be awake though host has de-asserted wakeup_now signal, this leads to WDT interrupt and host thinks that it has given sleep opportunity to RPU and initiates a recovery. To handle this, increase the sleep opportunity window to 5s to cover all the retries, this solves the false recovery problem. While at it, also increase the range, no reason to limit to lower window. And update the help text with the warning about power consumption. Upstream PR #: 93662 Signed-off-by: Chaitanya Tata (cherry picked from commit 7d55ed21554f65e06460c72e1ae4e4204f0524cc) --- drivers/wifi/nrf_wifi/Kconfig.nrfwifi | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/wifi/nrf_wifi/Kconfig.nrfwifi b/drivers/wifi/nrf_wifi/Kconfig.nrfwifi index 414900f581b9..af3e7827dcbf 100644 --- a/drivers/wifi/nrf_wifi/Kconfig.nrfwifi +++ b/drivers/wifi/nrf_wifi/Kconfig.nrfwifi @@ -748,11 +748,12 @@ config NRF_WIFI_RPU_RECOVERY_PS_ACTIVE_TIMEOUT_MS config NRF_WIFI_RPU_MIN_TIME_TO_ENTER_SLEEP_MS int "Minimum idle time to enter sleep in milliseconds" - range 100 5000 - default 1000 + range 100 40000 + default 5000 help Minimum time the host should de-assert WAKEUP_NOW and let RPU enter - sleep mode, assuming there is no activity. + sleep mode, assuming there is no activity. Please note that higher values + of this value may increase the power consumption. config NRF_WIFI_RPU_RECOVERY_DEBUG bool "RPU recovery debug logs" From d64be7ff9e9ceed45720ce09544d15a3c0f7400d Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Mon, 21 Jul 2025 21:35:01 +0530 Subject: [PATCH 0362/2141] [nrf fromtree] manifest: nrf_wifi: Pull fix for processing patch feature flags Pull fix to fail if no compatible feature is found. Signed-off-by: Chaitanya Tata (cherry picked from commit fcffe8f3f8e820274fb26914801622a43981eae7) --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index acf99c65b106..67424489a9a6 100644 --- a/west.yml +++ b/west.yml @@ -328,7 +328,7 @@ manifest: revision: 968d55ff22579080466bf2f482596dd6e35361c6 path: modules/bsim_hw_models/nrf_hw_models - name: nrf_wifi - revision: 5f59c2336c69f28ae83f93812a1d726f9fceabfe + revision: 00801cbaf83600ba9e39b010928401e817a93fdc path: modules/lib/nrf_wifi - name: open-amp revision: f7f4d083c7909a39d86e217376c69b416ec4faf3 From 290cf97630249480d287a76fbae8f9b1f77071a6 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Thu, 24 Jul 2025 02:10:57 +0530 Subject: [PATCH 0363/2141] [nrf fromlist] manifest: nrf_wifi: Pull fix for raw TX Pull fix for double pulling of raw TX header, fixes warnings seen during tests. Upstream PR #: 93085 Signed-off-by: Chaitanya Tata (cherry picked from commit 019c908c91d51e5ca58df0352eb7f32e25a51e23) --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 67424489a9a6..94e1638cb45f 100644 --- a/west.yml +++ b/west.yml @@ -328,7 +328,7 @@ manifest: revision: 968d55ff22579080466bf2f482596dd6e35361c6 path: modules/bsim_hw_models/nrf_hw_models - name: nrf_wifi - revision: 00801cbaf83600ba9e39b010928401e817a93fdc + revision: 787eea1a3c8dd13c86214e204a919e6f9bcebf91 path: modules/lib/nrf_wifi - name: open-amp revision: f7f4d083c7909a39d86e217376c69b416ec4faf3 From 89622e20bf7f8fe4abbcca6c3e1509f07c3f39e1 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Wed, 16 Jul 2025 12:56:34 +0530 Subject: [PATCH 0364/2141] [nrf fromtree] dts: bindings: Add missing nRF Wi-Fi interface Add missing binding to fix the device tree warning. Signed-off-by: Chaitanya Tata (cherry picked from commit 1495e2e34cf059ba20a57fb2b912d9f6bb14362f) --- dts/bindings/wifi/nordic,wlan.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 dts/bindings/wifi/nordic,wlan.yaml diff --git a/dts/bindings/wifi/nordic,wlan.yaml b/dts/bindings/wifi/nordic,wlan.yaml new file mode 100644 index 000000000000..9c704bc9586f --- /dev/null +++ b/dts/bindings/wifi/nordic,wlan.yaml @@ -0,0 +1,11 @@ +# Copyright (c) 2025 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: | + Nordic Wi-Fi network interface. + + This binding defines a Wi-Fi network interface for Nordic nRF70 series + Wi-Fi chips. The interface is used to identify and name Wi-Fi network + interfaces like wlan0. + +compatible: "nordic,wlan" From e09502fc2e6dbb07bc146f064e92fd396fd3288f Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Tue, 22 Jul 2025 01:12:23 +0530 Subject: [PATCH 0365/2141] [nrf fromtree] boards: nordic: nrf7002dk: Fix DTS warning the nRF connect device tree extension shows below warning: 'Property not mentioned in "nordic,nrf-pinctrl:child"'. Fix this by applying the property to both groups separately. Signed-off-by: Chaitanya Tata (cherry picked from commit 613ec82b192fbf5b5e96be5ab33eefc0b4c48c22) --- boards/nordic/nrf7002dk/nrf5340_cpuapp_common_pinctrl.dtsi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/boards/nordic/nrf7002dk/nrf5340_cpuapp_common_pinctrl.dtsi b/boards/nordic/nrf7002dk/nrf5340_cpuapp_common_pinctrl.dtsi index d8f78cfd40c0..08fcadc2244e 100644 --- a/boards/nordic/nrf7002dk/nrf5340_cpuapp_common_pinctrl.dtsi +++ b/boards/nordic/nrf7002dk/nrf5340_cpuapp_common_pinctrl.dtsi @@ -73,12 +73,13 @@ , ; bias-pull-down; + low-power-enable; }; group2 { psels = ; bias-pull-up; + low-power-enable; }; - low-power-enable; }; uart1_default: uart1_default { From b2334710d73e234fc16c3dfd95120d66e5d3ce93 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Tue, 22 Jul 2025 12:32:17 +0530 Subject: [PATCH 0366/2141] [nrf fromtree] boards: nordic: nrf7002dk: Fix the newline between the groups Add a newline between child nodes. Signed-off-by: Chaitanya Tata (cherry picked from commit 86690f29ab5246ea2ce45664ce05d8c6eefe09d7) --- boards/nordic/nrf7002dk/nrf5340_cpuapp_common_pinctrl.dtsi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/boards/nordic/nrf7002dk/nrf5340_cpuapp_common_pinctrl.dtsi b/boards/nordic/nrf7002dk/nrf5340_cpuapp_common_pinctrl.dtsi index 08fcadc2244e..e6bda0940dbe 100644 --- a/boards/nordic/nrf7002dk/nrf5340_cpuapp_common_pinctrl.dtsi +++ b/boards/nordic/nrf7002dk/nrf5340_cpuapp_common_pinctrl.dtsi @@ -59,6 +59,7 @@ ; bias-pull-down; }; + group2 { psels = ; bias-pull-up; @@ -75,6 +76,7 @@ bias-pull-down; low-power-enable; }; + group2 { psels = ; bias-pull-up; From c1cace5e91f5221960b61cae57188d7483759be2 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Wed, 16 Jul 2025 11:21:47 +0300 Subject: [PATCH 0367/2141] [nrf fromtree] net: ppp: ipcp: Don't request DNS if not needed When Kconfig option CONFIG_NET_L2_PPP_OPTION_DNS_USE is enabled, Zephyr should request two DNS addresses in IPCP negotiation by sending IPCP ConfReq for DNS otions using 0.0.0.0 as an address. Remote peer may offer DNS by sending IPCP ConfNak with proper address. This is explained in RFC 1332 and RFC 1877 (DNS extension). When no DNS is required, we should only send IPCP ConfReq for IP address, without having DNS fields in the same request. However, when PPP is configured to serve a DNS using Kconfig option CONFIG_NET_L2_PPP_OPTION_SERVE_DNS it should serve the DNS address in the IPCP ConfNak message and from the ipcp.peer_options structure, not from the ipcp.my_options. This might break backward compatibility outside this repository as DNS addresses used to be served from ipcp.my_options. Signed-off-by: Seppo Takalo (cherry picked from commit 5a31f3d108a5b89dec29223adcf97e094ab5c350) --- include/zephyr/net/ppp.h | 4 +++ subsys/net/l2/ppp/ipcp.c | 58 +++++++++++++++++++++------------------- 2 files changed, 35 insertions(+), 27 deletions(-) diff --git a/include/zephyr/net/ppp.h b/include/zephyr/net/ppp.h index a2b63b7dd1ec..7028e4f2d0f6 100644 --- a/include/zephyr/net/ppp.h +++ b/include/zephyr/net/ppp.h @@ -353,7 +353,11 @@ struct ppp_my_option_data { uint32_t flags; }; +#if defined(CONFIG_NET_L2_PPP_OPTION_DNS_USE) #define IPCP_NUM_MY_OPTIONS 3 +#else +#define IPCP_NUM_MY_OPTIONS 1 +#endif #define IPV6CP_NUM_MY_OPTIONS 1 enum ppp_flags { diff --git a/subsys/net/l2/ppp/ipcp.c b/subsys/net/l2/ppp/ipcp.c index b345802e68e3..afa92b293648 100644 --- a/subsys/net/l2/ppp/ipcp.c +++ b/subsys/net/l2/ppp/ipcp.c @@ -42,16 +42,6 @@ static int ipcp_add_ip_address(struct ppp_context *ctx, struct net_pkt *pkt) return ipcp_add_address(ctx, pkt, &ctx->ipcp.my_options.address); } -static int ipcp_add_dns1(struct ppp_context *ctx, struct net_pkt *pkt) -{ - return ipcp_add_address(ctx, pkt, &ctx->ipcp.my_options.dns1_address); -} - -static int ipcp_add_dns2(struct ppp_context *ctx, struct net_pkt *pkt) -{ - return ipcp_add_address(ctx, pkt, &ctx->ipcp.my_options.dns2_address); -} - static int ipcp_ack_check_address(struct net_pkt *pkt, size_t oplen, struct in_addr *addr) { @@ -81,20 +71,6 @@ static int ipcp_ack_ip_address(struct ppp_context *ctx, struct net_pkt *pkt, &ctx->ipcp.my_options.address); } -static int ipcp_ack_dns1(struct ppp_context *ctx, struct net_pkt *pkt, - uint8_t oplen) -{ - return ipcp_ack_check_address(pkt, oplen, - &ctx->ipcp.my_options.dns1_address); -} - -static int ipcp_ack_dns2(struct ppp_context *ctx, struct net_pkt *pkt, - uint8_t oplen) -{ - return ipcp_ack_check_address(pkt, oplen, - &ctx->ipcp.my_options.dns2_address); -} - static int ipcp_nak_override_address(struct net_pkt *pkt, size_t oplen, struct in_addr *addr) { @@ -112,6 +88,31 @@ static int ipcp_nak_ip_address(struct ppp_context *ctx, struct net_pkt *pkt, &ctx->ipcp.my_options.address); } +#if defined(CONFIG_NET_L2_PPP_OPTION_DNS_USE) +static int ipcp_add_dns1(struct ppp_context *ctx, struct net_pkt *pkt) +{ + return ipcp_add_address(ctx, pkt, &ctx->ipcp.my_options.dns1_address); +} + +static int ipcp_add_dns2(struct ppp_context *ctx, struct net_pkt *pkt) +{ + return ipcp_add_address(ctx, pkt, &ctx->ipcp.my_options.dns2_address); +} + +static int ipcp_ack_dns1(struct ppp_context *ctx, struct net_pkt *pkt, + uint8_t oplen) +{ + return ipcp_ack_check_address(pkt, oplen, + &ctx->ipcp.my_options.dns1_address); +} + +static int ipcp_ack_dns2(struct ppp_context *ctx, struct net_pkt *pkt, + uint8_t oplen) +{ + return ipcp_ack_check_address(pkt, oplen, + &ctx->ipcp.my_options.dns2_address); +} + static int ipcp_nak_dns1(struct ppp_context *ctx, struct net_pkt *pkt, uint8_t oplen) { @@ -125,21 +126,24 @@ static int ipcp_nak_dns2(struct ppp_context *ctx, struct net_pkt *pkt, return ipcp_nak_override_address(pkt, oplen, &ctx->ipcp.my_options.dns2_address); } +#endif /* CONFIG_NET_L2_PPP_OPTION_DNS_USE */ static const struct ppp_my_option_info ipcp_my_options[] = { PPP_MY_OPTION(IPCP_OPTION_IP_ADDRESS, ipcp_add_ip_address, ipcp_ack_ip_address, ipcp_nak_ip_address), +#if defined(CONFIG_NET_L2_PPP_OPTION_DNS_USE) PPP_MY_OPTION(IPCP_OPTION_DNS1, ipcp_add_dns1, ipcp_ack_dns1, ipcp_nak_dns1), PPP_MY_OPTION(IPCP_OPTION_DNS2, ipcp_add_dns2, ipcp_ack_dns2, ipcp_nak_dns2), +#endif }; BUILD_ASSERT(ARRAY_SIZE(ipcp_my_options) == IPCP_NUM_MY_OPTIONS); static struct net_pkt *ipcp_config_info_add(struct ppp_fsm *fsm) { - return ppp_my_options_add(fsm, 3 * IP_ADDRESS_OPTION_LEN); + return ppp_my_options_add(fsm, IPCP_NUM_MY_OPTIONS * IP_ADDRESS_OPTION_LEN); } struct ipcp_peer_option_data { @@ -232,7 +236,7 @@ static int ipcp_server_nak_dns1_address(struct ppp_fsm *fsm, CONTAINER_OF(fsm, struct ppp_context, ipcp.fsm); (void)net_pkt_write_u8(ret_pkt, IPCP_OPTION_DNS1); - ipcp_add_dns1(ctx, ret_pkt); + (void)ipcp_add_address(ctx, ret_pkt, &ctx->ipcp.peer_options.dns1_address); return 0; } @@ -245,7 +249,7 @@ static int ipcp_server_nak_dns2_address(struct ppp_fsm *fsm, CONTAINER_OF(fsm, struct ppp_context, ipcp.fsm); (void)net_pkt_write_u8(ret_pkt, IPCP_OPTION_DNS2); - ipcp_add_dns2(ctx, ret_pkt); + (void)ipcp_add_address(ctx, ret_pkt, &ctx->ipcp.peer_options.dns2_address); return 0; } From 09a153cef1d3a36e6ca5b423c97f82c1d197b059 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Wed, 16 Jul 2025 16:38:57 +0300 Subject: [PATCH 0368/2141] [nrf fromtree] net: ppp: Allow peer-options to be rejected There are cases, for example when peer is requesting two DNS addresses, but we can only give one, we should reject the secondary DNS request first, before sending NAK to acceptable options. Option parser can reject a parameter by returning -ENOTSUP and when it wants to NAK the parameter, it returns -EINVAL. On RFC 1661: Configure-Reject If some Configuration Options received in a Configure-Request are not recognizable or are not acceptable for negotiation (as configured by a network administrator), then the implementation MUST transmit a Configure-Reject. Configure-Nak If every instance of the received Configuration Options is recognizable, but some values are not acceptable, then the implementation MUST transmit a Configure-Nak. So as stated by RFC, we should start the negotiation by rejecting all parameters that we cannot configure. I added an example of rejecting DNS requests, if we don't have those. Signed-off-by: Seppo Takalo (cherry picked from commit d5f4ca3b64968469344beddfc354ef09ffaebf2d) --- subsys/net/l2/ppp/ipcp.c | 35 +++++++++++++++++++++++++++++++++-- subsys/net/l2/ppp/options.c | 30 +++++++++++++++++++++++++++++- 2 files changed, 62 insertions(+), 3 deletions(-) diff --git a/subsys/net/l2/ppp/ipcp.c b/subsys/net/l2/ppp/ipcp.c index afa92b293648..1cea54de2f39 100644 --- a/subsys/net/l2/ppp/ipcp.c +++ b/subsys/net/l2/ppp/ipcp.c @@ -228,6 +228,37 @@ static int ipcp_server_nak_ip_address(struct ppp_fsm *fsm, #endif #if defined(CONFIG_NET_L2_PPP_OPTION_SERVE_DNS) + +static int ipcp_dns1_address_parse(struct ppp_fsm *fsm, struct net_pkt *pkt, + void *user_data) +{ + struct ppp_context *ctx = + CONTAINER_OF(fsm, struct ppp_context, ipcp.fsm); + int ret; + + ret = ipcp_dns_address_parse(fsm, pkt, user_data); + + if (ret == -EINVAL && ctx->ipcp.peer_options.dns1_address.s_addr == INADDR_ANY) { + return -ENOTSUP; + } + return ret; +} + +static int ipcp_dns2_address_parse(struct ppp_fsm *fsm, struct net_pkt *pkt, + void *user_data) +{ + struct ppp_context *ctx = + CONTAINER_OF(fsm, struct ppp_context, ipcp.fsm); + int ret; + + ret = ipcp_dns_address_parse(fsm, pkt, user_data); + + if (ret == -EINVAL && ctx->ipcp.peer_options.dns2_address.s_addr == INADDR_ANY) { + return -ENOTSUP; + } + return ret; +} + static int ipcp_server_nak_dns1_address(struct ppp_fsm *fsm, struct net_pkt *ret_pkt, void *user_data) @@ -263,9 +294,9 @@ static const struct ppp_peer_option_info ipcp_peer_options[] = { PPP_PEER_OPTION(IPCP_OPTION_IP_ADDRESS, ipcp_ip_address_parse, NULL), #endif #if defined(CONFIG_NET_L2_PPP_OPTION_SERVE_DNS) - PPP_PEER_OPTION(IPCP_OPTION_DNS1, ipcp_dns_address_parse, + PPP_PEER_OPTION(IPCP_OPTION_DNS1, ipcp_dns1_address_parse, ipcp_server_nak_dns1_address), - PPP_PEER_OPTION(IPCP_OPTION_DNS2, ipcp_dns_address_parse, + PPP_PEER_OPTION(IPCP_OPTION_DNS2, ipcp_dns2_address_parse, ipcp_server_nak_dns2_address), #endif }; diff --git a/subsys/net/l2/ppp/options.c b/subsys/net/l2/ppp/options.c index 6fd8c15de6e0..694d338c9b76 100644 --- a/subsys/net/l2/ppp/options.c +++ b/subsys/net/l2/ppp/options.c @@ -144,14 +144,38 @@ static int ppp_parse_option_conf_req_supported(struct net_pkt *pkt, { struct ppp_parse_option_conf_req_data *parse_data = user_data; struct ppp_fsm *fsm = parse_data->fsm; + struct net_pkt *ret_pkt = parse_data->ret_pkt; + struct net_pkt_cursor cursor; const struct ppp_peer_option_info *option_info = ppp_peer_option_info_get(parse_data->options_info, parse_data->num_options_info, code); int ret; + net_pkt_cursor_backup(pkt, &cursor); ret = option_info->parse(fsm, pkt, parse_data->user_data); - if (ret == -EINVAL) { + if (ret == -ENOTSUP) { + net_pkt_cursor_restore(pkt, &cursor); + parse_data->rej_count++; + if (parse_data->nack_count != 0) { + /* Remove any NACKed data, if we need to reject something first */ + net_pkt_update_length(ret_pkt, 0); + net_pkt_cursor_init(ret_pkt); + parse_data->nack_count = 0; + } + net_pkt_write_u8(ret_pkt, code); + net_pkt_write_u8(ret_pkt, len + sizeof(code) + sizeof(len)); + if (len > 0) { + net_pkt_copy(ret_pkt, pkt, len); + } + return 0; + } else if (ret == -EINVAL) { + if (parse_data->rej_count != 0) { + /* If we have already rejected some options, we + * cannot NACK anything in the same packet. + */ + return 0; + } parse_data->nack_count++; ret = option_info->nack(fsm, parse_data->ret_pkt, parse_data->user_data); @@ -202,6 +226,10 @@ int ppp_config_info_req(struct ppp_fsm *fsm, return -EINVAL; } + if (parse_data.rej_count) { + return PPP_CONFIGURE_REJ; + } + if (parse_data.nack_count) { return PPP_CONFIGURE_NACK; } From 46684e34c2443deedc147edb47a9718ef9f66627 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Bainczyk?= Date: Wed, 23 Jul 2025 14:13:32 +0200 Subject: [PATCH 0369/2141] [nrf fromlist] modules: hal_nordic: nrfx: Add support for custom NRFX_DIR on Sysbuild MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add support for custom NRFX_DIR for Sysbuild builds by checking if NRFX_DIR has been defined in Sysbuild. Upstream PR #: 93583 Signed-off-by: Michał Bainczyk (cherry picked from commit 877eb0dc1588efd4a8cf24067f4415f1ce39e1a1) --- modules/hal_nordic/nrfx/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/hal_nordic/nrfx/CMakeLists.txt b/modules/hal_nordic/nrfx/CMakeLists.txt index d063046cfa86..dc31c3a13caa 100644 --- a/modules/hal_nordic/nrfx/CMakeLists.txt +++ b/modules/hal_nordic/nrfx/CMakeLists.txt @@ -5,6 +5,8 @@ zephyr_library() # The nrfx source directory can be override through the definition of the NRFX_DIR symbol # during the invocation of the build system +zephyr_get(NRFX_DIR SYSBUILD GLOBAL) + if(NOT DEFINED NRFX_DIR) set(NRFX_DIR ${ZEPHYR_CURRENT_MODULE_DIR}/nrfx CACHE PATH "nrfx Directory") endif() From b71414bca9ca54ce33c349b88487564fab5eedc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Thu, 26 Jun 2025 10:26:52 +0200 Subject: [PATCH 0370/2141] [nrf fromlist] modules: hal_nordic: Bump nrf-regtool to 9.2.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bump required version of nrf-regtool to 9.2.0. Upstream PR #: 91041 Signed-off-by: Krzysztof Chruściński (cherry picked from commit e2bff7b0c9c3e6ffbc3b62177d79f5d568b92a58) --- modules/hal_nordic/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/hal_nordic/CMakeLists.txt b/modules/hal_nordic/CMakeLists.txt index 11c28246828b..b6f352864123 100644 --- a/modules/hal_nordic/CMakeLists.txt +++ b/modules/hal_nordic/CMakeLists.txt @@ -12,7 +12,7 @@ if(CONFIG_NRF_REGTOOL_GENERATE_UICR) list(APPEND nrf_regtool_components GENERATE:UICR) endif() if(DEFINED nrf_regtool_components) - find_package(nrf-regtool 9.1.0 + find_package(nrf-regtool 9.2.0 COMPONENTS ${nrf_regtool_components} PATHS ${CMAKE_CURRENT_LIST_DIR}/nrf-regtool NO_CMAKE_PATH From 6eba812c4b9374ba0741a8fe43610f8838735728 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Tue, 3 Jun 2025 15:59:04 +0200 Subject: [PATCH 0371/2141] [nrf fromlist] dts: vendor: nordic: nrf54h20: Add gpiote0 node MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add GPIOTE0 instance in radio peripherals. Upstream PR #: 91041 Signed-off-by: Krzysztof Chruściński (cherry picked from commit a513682bb6b1e88a889c7ba8006809e5c1716dee) --- dts/vendor/nordic/nrf54h20.dtsi | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dts/vendor/nordic/nrf54h20.dtsi b/dts/vendor/nordic/nrf54h20.dtsi index 042725a16171..c72fedef84a6 100644 --- a/dts/vendor/nordic/nrf54h20.dtsi +++ b/dts/vendor/nordic/nrf54h20.dtsi @@ -391,6 +391,16 @@ interrupts = <37 NRF_DEFAULT_IRQ_PRIORITY>; }; + gpiote0: gpiote@27000 { + compatible = "nordic,nrf-gpiote"; + reg = <0x27000 0x1000>; + status = "disabled"; + interrupts = <39 NRF_DEFAULT_IRQ_PRIORITY>; + instance = <0>; + no-port-event; + fixed-channels-supported; + }; + timer020: timer@28000 { compatible = "nordic,nrf-timer"; reg = <0x28000 0x1000>; From f54a8aa973f3225c6fe3a92fa648d3c08292d270 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Tue, 3 Jun 2025 16:00:51 +0200 Subject: [PATCH 0372/2141] [nrf fromlist] dts: bindings: gpio: nrf-gpiote: Extend description MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add new feature flags to gpiote node. Include pinctrl. Pins used by GPIOTE0 on nrf54h20/cpurad require CTRLSEL configuration. Pins are listed using pinctrl and parsed by nrf-regtool to prepare UICR configuration. Upstream PR #: 91041 Signed-off-by: Krzysztof Chruściński (cherry picked from commit 36cd63ba1cf88776a3a0e27244233af9380022d4) --- dts/bindings/gpio/nordic,nrf-gpiote.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dts/bindings/gpio/nordic,nrf-gpiote.yaml b/dts/bindings/gpio/nordic,nrf-gpiote.yaml index b9180857e44f..90914c712d20 100644 --- a/dts/bindings/gpio/nordic,nrf-gpiote.yaml +++ b/dts/bindings/gpio/nordic,nrf-gpiote.yaml @@ -8,6 +8,7 @@ compatible: "nordic,nrf-gpiote" include: - base.yaml - nordic,split-channels.yaml + - pinctrl-device.yaml properties: reg: @@ -16,6 +17,17 @@ properties: interrupts: required: true + no-port-event: + type: boolean + description: | + Indicates that the GPIOTE instance does not support PORT event. + + fixed-channels-supported: + type: boolean + description: | + Indicates that the GPIOTE instance has fixed connection between pins and TE channels. + It means that a specific TE channel must be used for a given pin. + instance: type: int required: true From 033ae0fc80adb92e4a86cc97c9c58863c09e88f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Wed, 4 Jun 2025 08:17:50 +0200 Subject: [PATCH 0373/2141] [nrf fromlist] modules: hal_nordic: nrfx: Add GPIOTE config flag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add NRFX_GPIOTE_VAR_FEATURE_SUPPORT feature flag to nrfx configuration. It enables support for special GPIOTE0 instance in nrfx_gpiote driver. Upstream PR #: 91041 Signed-off-by: Krzysztof Chruściński (cherry picked from commit eb6005ccf7e8ea22549f776bdab52722b6155bdb) --- modules/hal_nordic/nrfx/Kconfig | 4 ++++ modules/hal_nordic/nrfx/nrfx_kconfig.h | 3 +++ 2 files changed, 7 insertions(+) diff --git a/modules/hal_nordic/nrfx/Kconfig b/modules/hal_nordic/nrfx/Kconfig index b918a2023c37..b7f459ea177b 100644 --- a/modules/hal_nordic/nrfx/Kconfig +++ b/modules/hal_nordic/nrfx/Kconfig @@ -226,6 +226,10 @@ config NRFX_GPIOTE131 depends on $(dt_nodelabel_exists,gpiote131) select NRFX_GPIOTE +config NRFX_GPIOTE_NONUNIFORM_INSTANCES + def_bool $(dt_nodelabel_enabled,gpiote0) + depends on $(dt_nodelabel_bool_prop,gpiote0,fixed-channels-supported) + config NRFX_GPIOTE_NUM_OF_EVT_HANDLERS int "Number of event handlers" depends on NRFX_GPIOTE diff --git a/modules/hal_nordic/nrfx/nrfx_kconfig.h b/modules/hal_nordic/nrfx/nrfx_kconfig.h index 5aa856f22997..6e3583743bc9 100644 --- a/modules/hal_nordic/nrfx/nrfx_kconfig.h +++ b/modules/hal_nordic/nrfx/nrfx_kconfig.h @@ -207,6 +207,9 @@ #ifdef CONFIG_NRFX_GPIOTE131 #define NRFX_GPIOTE131_ENABLED 1 #endif +#ifdef CONFIG_NRFX_GPIOTE_NONUNIFORM_INSTANCES +#define NRFX_GPIOTE_CONFIG_NONUNIFORM_INSTANCES 1 +#endif #ifdef CONFIG_NRFX_GPIOTE_NUM_OF_EVT_HANDLERS #define NRFX_GPIOTE_CONFIG_NUM_OF_EVT_HANDLERS CONFIG_NRFX_GPIOTE_NUM_OF_EVT_HANDLERS From 579af8877d140192461f14fbd7faf96344b1a358 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Wed, 4 Jun 2025 08:14:14 +0200 Subject: [PATCH 0374/2141] [nrf fromlist] drivers: gpio: nrfx: Add support for GPIOTE0 on cpurad MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add support for special GPIOTE0 instance on nrf54h20/cpurad. This instance requires special handling because: - there is no support for PORT event (level interrupts) - TE channels are fixed to the pin Upstream PR #: 91041 Signed-off-by: Krzysztof Chruściński (cherry picked from commit 2892fc1384b3cb62cb4be57034f30e054217bfc8) --- drivers/gpio/gpio_nrfx.c | 128 ++++++++++++++++++++++++++++++--------- 1 file changed, 101 insertions(+), 27 deletions(-) diff --git a/drivers/gpio/gpio_nrfx.c b/drivers/gpio/gpio_nrfx.c index 0a94b84c67fd..f7c57156361e 100644 --- a/drivers/gpio/gpio_nrfx.c +++ b/drivers/gpio/gpio_nrfx.c @@ -20,6 +20,26 @@ #include #endif +#define GPIOTE_PHANDLE(id) DT_INST_PHANDLE(id, gpiote_instance) +#define GPIOTE_PROP(idx, prop) DT_PROP(GPIOTE(idx), prop) + +#define IS_NO_PORT_INSTANCE(id) DT_PROP_OR(GPIOTE_PHANDLE(id), no_port_event, 0) || +#define IS_FIXED_CH_INSTANCE(id) DT_PROP_OR(GPIOTE_PHANDLE(id), fixed_channels_supported, 0) || + +#if DT_INST_FOREACH_STATUS_OKAY(IS_NO_PORT_INSTANCE) 0 +#define GPIOTE_NO_PORT_EVT_SUPPORT 1 +#endif + +#if DT_INST_FOREACH_STATUS_OKAY(IS_FIXED_CH_INSTANCE) 0 +#define GPIOTE_FIXED_CH_SUPPORT 1 +#endif + +#if defined(GPIOTE_NO_PORT_EVT_SUPPORT) || defined(GPIOTE_FIXED_CH_SUPPORT) +#define GPIOTE_FEATURE_FLAG 1 +#define GPIOTE_FLAG_NO_PORT_EVT BIT(0) +#define GPIOTE_FLAG_FIXED_CHAN BIT(1) +#endif + struct gpio_nrfx_data { /* gpio_driver_data needs to be first */ struct gpio_driver_data common; @@ -33,6 +53,9 @@ struct gpio_nrfx_cfg { uint32_t edge_sense; uint8_t port_num; nrfx_gpiote_t gpiote; +#if defined(GPIOTE_FEATURE_FLAG) + uint32_t flags; +#endif #ifdef CONFIG_SOC_NRF54H20_GPD uint8_t pad_pd; #endif @@ -180,6 +203,7 @@ static int gpio_nrfx_pin_configure(const struct device *port, gpio_pin_t pin, abs_pin, &input_pin_config); if (err != NRFX_SUCCESS) { ret = -EINVAL; + goto end; } } @@ -211,13 +235,21 @@ static int gpio_nrfx_pin_configure(const struct device *port, gpio_pin_t pin, } if (IS_ENABLED(CONFIG_GPIO_NRFX_INTERRUPT) && free_ch) { +#ifdef GPIOTE_FEATURE_FLAG + /* Fixed channel was used, no need to free. */ + if (cfg->flags & GPIOTE_FLAG_FIXED_CHAN) { + goto end; + } +#endif err = nrfx_gpiote_channel_free(&cfg->gpiote, ch); __ASSERT_NO_MSG(err == NRFX_SUCCESS); } end: gpio_nrfx_gpd_retain_set(port, BIT(pin)); - return pm_device_runtime_put(port); + int pm_ret = pm_device_runtime_put(port); + + return (ret != 0) ? ret : pm_ret; } #ifdef CONFIG_GPIO_GET_CONFIG @@ -393,6 +425,37 @@ static nrfx_gpiote_trigger_t get_trigger(enum gpio_int_mode mode, NRFX_GPIOTE_TRIGGER_LOTOHI; } +static nrfx_err_t chan_alloc(const struct gpio_nrfx_cfg *cfg, gpio_pin_t pin, uint8_t *ch) +{ +#ifdef GPIOTE_FEATURE_FLAG + if (cfg->flags & GPIOTE_FLAG_FIXED_CHAN) { + /* Currently fixed channel relation is only present in one instance (GPIOTE0 on + * cpurad). The rules are following: + * - GPIOTE0 can only be used with P1 (pins 4-11) and P2 (pins (0-11)) + * - P1: channel => pin - 4, e.g. P1.4 => channel 0, P1.5 => channel 1 + * - P2: channel => pin % 8, e.g. P2.0 => channel 0, P2.8 => channel 0 + */ + nrfx_err_t err = NRFX_SUCCESS; + + if (cfg->port_num == 1) { + if (pin < 4) { + err = NRFX_ERROR_INVALID_PARAM; + } else { + *ch = pin - 4; + } + } else if (cfg->port_num == 2) { + *ch = pin & 0x7; + } else { + err = NRFX_ERROR_INVALID_PARAM; + } + + return err; + } +#endif + + return nrfx_gpiote_channel_alloc(&cfg->gpiote, ch); +} + static int gpio_nrfx_pin_interrupt_configure(const struct device *port, gpio_pin_t pin, enum gpio_int_mode mode, @@ -428,7 +491,7 @@ static int gpio_nrfx_pin_interrupt_configure(const struct device *port, (nrf_gpio_pin_dir_get(abs_pin) == NRF_GPIO_PIN_DIR_INPUT)) { err = nrfx_gpiote_channel_get(&cfg->gpiote, abs_pin, &ch); if (err == NRFX_ERROR_INVALID_PARAM) { - err = nrfx_gpiote_channel_alloc(&cfg->gpiote, &ch); + err = chan_alloc(cfg, pin, &ch); if (err != NRFX_SUCCESS) { return -ENOMEM; } @@ -436,6 +499,11 @@ static int gpio_nrfx_pin_interrupt_configure(const struct device *port, trigger_config.p_in_channel = &ch; } else { +#ifdef GPIOTE_FEATURE_FLAG + if (cfg->flags & GPIOTE_FLAG_NO_PORT_EVT) { + return -ENOTSUP; + } +#endif /* If edge mode with channel was previously used and we are changing to sense or * level triggered, we must free the channel. */ @@ -641,7 +709,6 @@ static DEVICE_API(gpio, gpio_nrfx_drv_api_funcs) = { #endif }; -#define GPIOTE_PHANDLE(id) DT_INST_PHANDLE(id, gpiote_instance) #define GPIOTE_INST(id) DT_PROP(GPIOTE_PHANDLE(id), instance) #define GPIOTE_INSTANCE(id) \ @@ -668,30 +735,37 @@ static DEVICE_API(gpio, gpio_nrfx_drv_api_funcs) = { #define PAD_PD(inst) #endif -#define GPIO_NRF_DEVICE(id) \ - GPIOTE_CHECK(id); \ - static const struct gpio_nrfx_cfg gpio_nrfx_p##id##_cfg = { \ - .common = { \ - .port_pin_mask = \ - GPIO_PORT_PIN_MASK_FROM_DT_INST(id), \ - }, \ - .port = _CONCAT(NRF_P, DT_INST_PROP(id, port)), \ - .port_num = DT_INST_PROP(id, port), \ - .edge_sense = DT_INST_PROP_OR(id, sense_edge_mask, 0), \ - .gpiote = GPIOTE_INSTANCE(id), \ - PAD_PD(id) \ - }; \ - \ - static struct gpio_nrfx_data gpio_nrfx_p##id##_data; \ - \ - PM_DEVICE_DT_INST_DEFINE(id, gpio_nrfx_pm_hook); \ - \ - DEVICE_DT_INST_DEFINE(id, gpio_nrfx_init, \ - PM_DEVICE_DT_INST_GET(id), \ - &gpio_nrfx_p##id##_data, \ - &gpio_nrfx_p##id##_cfg, \ - PRE_KERNEL_1, \ - CONFIG_GPIO_INIT_PRIORITY, \ +#define GPIO_NRF_DEVICE(id) \ + GPIOTE_CHECK(id); \ + static const struct gpio_nrfx_cfg gpio_nrfx_p##id##_cfg = { \ + .common = { \ + .port_pin_mask = \ + GPIO_PORT_PIN_MASK_FROM_DT_INST(id), \ + }, \ + .port = _CONCAT(NRF_P, DT_INST_PROP(id, port)), \ + .port_num = DT_INST_PROP(id, port), \ + .edge_sense = DT_INST_PROP_OR(id, sense_edge_mask, 0), \ + .gpiote = GPIOTE_INSTANCE(id), \ + IF_ENABLED(GPIOTE_FEATURE_FLAG, \ + (.flags = \ + (DT_PROP_OR(GPIOTE_PHANDLE(id), no_port_event, 0) ? \ + GPIOTE_FLAG_NO_PORT_EVT : 0) | \ + (DT_PROP_OR(GPIOTE_PHANDLE(id), fixed_channels_supported, 0) ? \ + GPIOTE_FLAG_FIXED_CHAN : 0),) \ + ) \ + PAD_PD(id) \ + }; \ + \ + static struct gpio_nrfx_data gpio_nrfx_p##id##_data; \ + \ + PM_DEVICE_DT_INST_DEFINE(id, gpio_nrfx_pm_hook); \ + \ + DEVICE_DT_INST_DEFINE(id, gpio_nrfx_init, \ + PM_DEVICE_DT_INST_GET(id), \ + &gpio_nrfx_p##id##_data, \ + &gpio_nrfx_p##id##_cfg, \ + PRE_KERNEL_1, \ + CONFIG_GPIO_INIT_PRIORITY, \ &gpio_nrfx_drv_api_funcs); DT_INST_FOREACH_STATUS_OKAY(GPIO_NRF_DEVICE) From 444ba1c7294dc85618cc5c260c1498116591cd68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Tue, 3 Jun 2025 15:54:51 +0200 Subject: [PATCH 0375/2141] [nrf fromlist] tests: drivers: gpio: basic_api: Improve test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add return code checking for gpio_pin_interrupt_configure functions. Add disabling pin interrupt at the end of the test to restore pin state. Upstream PR #: 91041 Signed-off-by: Krzysztof Chruściński (cherry picked from commit 9c8cd597ac68d54bface2657078ddc37dca32516) --- .../drivers/gpio/gpio_basic_api/src/test_callback_manage.c | 7 +++++-- .../drivers/gpio/gpio_basic_api/src/test_config_trigger.c | 6 ++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/drivers/gpio/gpio_basic_api/src/test_callback_manage.c b/tests/drivers/gpio/gpio_basic_api/src/test_callback_manage.c index 4c521c8e2a0e..d302e9930324 100644 --- a/tests/drivers/gpio/gpio_basic_api/src/test_callback_manage.c +++ b/tests/drivers/gpio/gpio_basic_api/src/test_callback_manage.c @@ -66,16 +66,19 @@ static int init_callback(const struct device *dev_in, const struct device *dev_o static void trigger_callback(const struct device *dev_in, const struct device *dev_out, int enable_cb) { + int rc; + gpio_pin_set(dev_out, PIN_OUT, 0); k_sleep(K_MSEC(100)); cb_cnt[0] = 0; cb_cnt[1] = 0; if (enable_cb == 1) { - gpio_pin_interrupt_configure(dev_in, PIN_IN, GPIO_INT_EDGE_RISING); + rc = gpio_pin_interrupt_configure(dev_in, PIN_IN, GPIO_INT_EDGE_RISING); } else { - gpio_pin_interrupt_configure(dev_in, PIN_IN, GPIO_INT_DISABLE); + rc = gpio_pin_interrupt_configure(dev_in, PIN_IN, GPIO_INT_DISABLE); } + zassert_equal(rc, 0); k_sleep(K_MSEC(100)); gpio_pin_set(dev_out, PIN_OUT, 1); k_sleep(K_MSEC(1000)); diff --git a/tests/drivers/gpio/gpio_basic_api/src/test_config_trigger.c b/tests/drivers/gpio/gpio_basic_api/src/test_config_trigger.c index 881020a7281f..38c5401bcd6c 100644 --- a/tests/drivers/gpio/gpio_basic_api/src/test_config_trigger.c +++ b/tests/drivers/gpio/gpio_basic_api/src/test_config_trigger.c @@ -68,6 +68,9 @@ ZTEST(after_flash_gpio_config_trigger, test_gpio_config_twice_trigger) k_sleep(K_MSEC(10)); zassert_between_inclusive(cb_cnt, 0, 1, "Got %d interrupts", cb_cnt); + ret = gpio_pin_interrupt_configure(dev_in, PIN_IN, GPIO_INT_DISABLE); + zassert_ok(ret, "interrupt disabling failed"); + gpio_remove_callback(dev_in, &drv_data->gpio_cb); } @@ -115,5 +118,8 @@ ZTEST(after_flash_gpio_config_trigger, test_gpio_config_trigger) k_sleep(K_MSEC(10)); zassert_between_inclusive(cb_cnt, 0, 1, "Got %d interrupts", cb_cnt); + ret = gpio_pin_interrupt_configure(dev_in, PIN_IN, GPIO_INT_DISABLE); + zassert_ok(ret, "interrupt disabling failed"); + gpio_remove_callback(dev_in, &drv_data->gpio_cb); } From eb31114fcac56d0ab45f245ab8063a6d3abb200d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Wed, 4 Jun 2025 09:54:54 +0200 Subject: [PATCH 0376/2141] [nrf fromlist] tests: drivers: gpio: basic_api: Add nrf54h20/cpurad GPIOTE0 config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add configuration for testing GPIOTE0 instance on nrf54h20/cpurad. Upstream PR #: 91041 Signed-off-by: Krzysztof Chruściński (cherry picked from commit 68375c0208257577f714314e10b818025ea8ae36) --- ...nrf54h20dk_nrf54h20_cpurad_gpiote0.overlay | 28 +++++++++++++++++++ .../drivers/gpio/gpio_basic_api/testcase.yaml | 7 +++++ 2 files changed, 35 insertions(+) create mode 100644 tests/drivers/gpio/gpio_basic_api/boards/nrf54h20dk_nrf54h20_cpurad_gpiote0.overlay diff --git a/tests/drivers/gpio/gpio_basic_api/boards/nrf54h20dk_nrf54h20_cpurad_gpiote0.overlay b/tests/drivers/gpio/gpio_basic_api/boards/nrf54h20dk_nrf54h20_cpurad_gpiote0.overlay new file mode 100644 index 000000000000..0c8f7dbe06c9 --- /dev/null +++ b/tests/drivers/gpio/gpio_basic_api/boards/nrf54h20dk_nrf54h20_cpurad_gpiote0.overlay @@ -0,0 +1,28 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +&pinctrl { + gpiote0_default_alt: gpiote0_default_alt { + group1 { + psels = ; + }; + }; +}; + +/ { + resources { + compatible = "test-gpio-basic-api"; + out-gpios = <&gpio1 5 0>; + in-gpios = <&gpio1 4 0>; + }; +}; + +&gpio1 { + status = "okay"; + gpiote-instance = <&gpiote0>; +}; + +&gpiote0 { + status = "okay"; + pinctrl-0 = <&gpiote0_default_alt>; + pinctrl-names = "default"; +}; diff --git a/tests/drivers/gpio/gpio_basic_api/testcase.yaml b/tests/drivers/gpio/gpio_basic_api/testcase.yaml index 71f55e493cce..325b22efa1c0 100644 --- a/tests/drivers/gpio/gpio_basic_api/testcase.yaml +++ b/tests/drivers/gpio/gpio_basic_api/testcase.yaml @@ -111,3 +111,10 @@ tests: platform_allow: - siwx917_rb4338a extra_args: "DTC_OVERLAY_FILE=boards/siwx917_rb4338a-uulp.overlay" + drivers.gpio.2pin.nrf54h20_cpurad_gpiote0: + harness_config: + fixture: i2s_loopback # Loopback includes the pin pair needed for that test + platform_allow: + - nrf54h20dk/nrf54h20/cpurad + extra_args: + - DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpurad_gpiote0.overlay" From 15ec1e7e05122e68d24b6150f12db18b1b3d3a56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Bainczyk?= Date: Mon, 14 Jul 2025 15:30:25 +0200 Subject: [PATCH 0377/2141] [nrf fromtree] drivers: nrf: add build asserts for memory-regions property MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add build asserts for "memory-regions" property in nrf drivers which is required on targets with DMM for saadc, pdm, pwm, twim, twim_rtio, twis, tdm, uarte, spim and spis. On targets where the property is not required the assertion macro expands to nothing. Signed-off-by: Michał Bainczyk (cherry picked from commit 2e06c4ed20026c702b664b9d5b45a0d2a9589a5b) --- drivers/adc/adc_nrfx_saadc.c | 2 ++ drivers/audio/dmic_nrfx_pdm.c | 1 + drivers/i2c/i2c_nrfx_twim.c | 1 + drivers/i2c/i2c_nrfx_twim_rtio.c | 1 + drivers/i2c/i2c_nrfx_twis.c | 1 + drivers/i2s/i2s_nrf_tdm.c | 1 + drivers/pwm/pwm_nrfx.c | 1 + drivers/serial/uart_nrfx_uarte.c | 1 + drivers/spi/spi_nrfx_spim.c | 1 + drivers/spi/spi_nrfx_spis.c | 1 + soc/nordic/common/soc_nrf_common.h | 13 +++++++++++++ 11 files changed, 24 insertions(+) diff --git a/drivers/adc/adc_nrfx_saadc.c b/drivers/adc/adc_nrfx_saadc.c index 274a43157e04..2ba7b6efd008 100644 --- a/drivers/adc/adc_nrfx_saadc.c +++ b/drivers/adc/adc_nrfx_saadc.c @@ -709,5 +709,7 @@ static DEVICE_API(adc, adc_nrfx_driver_api) = { /* Validate configuration of all channels. */ DT_FOREACH_CHILD(DT_DRV_INST(0), VALIDATE_CHANNEL_CONFIG) +NRF_DT_CHECK_NODE_HAS_REQUIRED_MEMORY_REGIONS(DT_DRV_INST(0)); + DEVICE_DT_INST_DEFINE(0, init_saadc, NULL, NULL, NULL, POST_KERNEL, CONFIG_ADC_INIT_PRIORITY, &adc_nrfx_driver_api); diff --git a/drivers/audio/dmic_nrfx_pdm.c b/drivers/audio/dmic_nrfx_pdm.c index b2fcb7abb868..433aea66bbc3 100644 --- a/drivers/audio/dmic_nrfx_pdm.c +++ b/drivers/audio/dmic_nrfx_pdm.c @@ -728,6 +728,7 @@ static const struct _dmic_ops dmic_ops = { .clk_src = PDM_CLK_SRC(idx), \ .mem_reg = DMM_DEV_TO_REG(PDM(idx)), \ }; \ + NRF_DT_CHECK_NODE_HAS_REQUIRED_MEMORY_REGIONS(PDM(idx)); \ BUILD_ASSERT(PDM_CLK_SRC(idx) != ACLK || \ NRF_PDM_HAS_SELECTABLE_CLOCK, \ "Clock source ACLK is not available."); \ diff --git a/drivers/i2c/i2c_nrfx_twim.c b/drivers/i2c/i2c_nrfx_twim.c index b6c37f455dc1..e3c307231ab1 100644 --- a/drivers/i2c/i2c_nrfx_twim.c +++ b/drivers/i2c/i2c_nrfx_twim.c @@ -253,6 +253,7 @@ static DEVICE_API(i2c, i2c_nrfx_twim_driver_api) = { #define I2C_NRFX_TWIM_DEVICE(idx) \ NRF_DT_CHECK_NODE_HAS_PINCTRL_SLEEP(I2C(idx)); \ + NRF_DT_CHECK_NODE_HAS_REQUIRED_MEMORY_REGIONS(I2C(idx)); \ BUILD_ASSERT(I2C_FREQUENCY(idx) != \ I2C_NRFX_TWIM_INVALID_FREQUENCY, \ "Wrong I2C " #idx " frequency setting in dts"); \ diff --git a/drivers/i2c/i2c_nrfx_twim_rtio.c b/drivers/i2c/i2c_nrfx_twim_rtio.c index 5eef549ba2e7..0ddf5ffdd777 100644 --- a/drivers/i2c/i2c_nrfx_twim_rtio.c +++ b/drivers/i2c/i2c_nrfx_twim_rtio.c @@ -254,6 +254,7 @@ static int i2c_nrfx_twim_rtio_deinit(const struct device *dev) #define I2C_NRFX_TWIM_RTIO_DEVICE(idx) \ NRF_DT_CHECK_NODE_HAS_PINCTRL_SLEEP(I2C(idx)); \ + NRF_DT_CHECK_NODE_HAS_REQUIRED_MEMORY_REGIONS(I2C(idx)); \ BUILD_ASSERT(I2C_FREQUENCY(idx) != I2C_NRFX_TWIM_INVALID_FREQUENCY, \ "Wrong I2C " #idx " frequency setting in dts"); \ static void irq_connect##idx(void) \ diff --git a/drivers/i2c/i2c_nrfx_twis.c b/drivers/i2c/i2c_nrfx_twis.c index dca3a457cf22..be55c851f3a7 100644 --- a/drivers/i2c/i2c_nrfx_twis.c +++ b/drivers/i2c/i2c_nrfx_twis.c @@ -325,6 +325,7 @@ static int shim_nrf_twis_deinit(const struct device *dev) _CONCAT_4(shim_nrf_twis_, name, _, id) #define SHIM_NRF_TWIS_DEVICE_DEFINE(id) \ + NRF_DT_CHECK_NODE_HAS_REQUIRED_MEMORY_REGIONS(SHIM_NRF_TWIS_NODE(id)); \ static void SHIM_NRF_TWIS_NAME(id, irq_connect)(void) \ { \ IRQ_CONNECT( \ diff --git a/drivers/i2s/i2s_nrf_tdm.c b/drivers/i2s/i2s_nrf_tdm.c index f8fa4773d37e..c65edb2717bc 100644 --- a/drivers/i2s/i2s_nrf_tdm.c +++ b/drivers/i2s/i2s_nrf_tdm.c @@ -1192,6 +1192,7 @@ static DEVICE_API(i2s, tdm_nrf_drv_api) = { BUILD_ASSERT((TDM_SCK_CLK_SRC(idx) != ACLK && TDM_MCK_CLK_SRC(idx) != ACLK) || \ DT_NODE_HAS_STATUS_OKAY(NODE_ACLK), \ "Clock source ACLK requires the audiopll node."); \ + NRF_DT_CHECK_NODE_HAS_REQUIRED_MEMORY_REGIONS(TDM(idx)); \ DEVICE_DT_DEFINE(TDM(idx), tdm_nrf_init##idx, NULL, &tdm_nrf_data##idx, &tdm_nrf_cfg##idx, \ POST_KERNEL, CONFIG_I2S_INIT_PRIORITY, &tdm_nrf_drv_api); diff --git a/drivers/pwm/pwm_nrfx.c b/drivers/pwm/pwm_nrfx.c index 6a106c128412..e5a046fd9754 100644 --- a/drivers/pwm/pwm_nrfx.c +++ b/drivers/pwm/pwm_nrfx.c @@ -496,6 +496,7 @@ static int pwm_nrfx_init(const struct device *dev) #define PWM_NRFX_DEVICE(idx) \ NRF_DT_CHECK_NODE_HAS_PINCTRL_SLEEP(PWM(idx)); \ + NRF_DT_CHECK_NODE_HAS_REQUIRED_MEMORY_REGIONS(PWM(idx)); \ static struct pwm_nrfx_data pwm_nrfx_##idx##_data; \ static uint16_t pwm_##idx##_seq_values[NRF_PWM_CHANNEL_COUNT] \ PWM_MEMORY_SECTION(idx); \ diff --git a/drivers/serial/uart_nrfx_uarte.c b/drivers/serial/uart_nrfx_uarte.c index 20b6cad541de..cf864a594297 100644 --- a/drivers/serial/uart_nrfx_uarte.c +++ b/drivers/serial/uart_nrfx_uarte.c @@ -2714,6 +2714,7 @@ static int uarte_instance_init(const struct device *dev, #define UART_NRF_UARTE_DEVICE(idx) \ NRF_DT_CHECK_NODE_HAS_PINCTRL_SLEEP(UARTE(idx)); \ + NRF_DT_CHECK_NODE_HAS_REQUIRED_MEMORY_REGIONS(UARTE(idx)); \ UARTE_INT_DRIVEN(idx); \ PINCTRL_DT_DEFINE(UARTE(idx)); \ IF_ENABLED(CONFIG_UART_##idx##_ASYNC, ( \ diff --git a/drivers/spi/spi_nrfx_spim.c b/drivers/spi/spi_nrfx_spim.c index f1d6f8125d67..438a1b22999f 100644 --- a/drivers/spi/spi_nrfx_spim.c +++ b/drivers/spi/spi_nrfx_spim.c @@ -912,6 +912,7 @@ static int spi_nrfx_deinit(const struct device *dev) #define SPI_NRFX_SPIM_DEFINE(idx) \ NRF_DT_CHECK_NODE_HAS_PINCTRL_SLEEP(SPIM(idx)); \ + NRF_DT_CHECK_NODE_HAS_REQUIRED_MEMORY_REGIONS(SPIM(idx)); \ static void irq_connect##idx(void) \ { \ IRQ_CONNECT(DT_IRQN(SPIM(idx)), DT_IRQ(SPIM(idx), priority), \ diff --git a/drivers/spi/spi_nrfx_spis.c b/drivers/spi/spi_nrfx_spis.c index 8ab8de979555..daa75d7e7fff 100644 --- a/drivers/spi/spi_nrfx_spis.c +++ b/drivers/spi/spi_nrfx_spis.c @@ -571,6 +571,7 @@ static int spi_nrfx_init(const struct device *dev) } #define SPI_NRFX_SPIS_DEFINE(idx) \ + NRF_DT_CHECK_NODE_HAS_REQUIRED_MEMORY_REGIONS(SPIS(idx)); \ static void irq_connect##idx(void) \ { \ IRQ_CONNECT(DT_IRQN(SPIS(idx)), DT_IRQ(SPIS(idx), priority), \ diff --git a/soc/nordic/common/soc_nrf_common.h b/soc/nordic/common/soc_nrf_common.h index dd6fb8866bfc..e2ff929a5034 100644 --- a/soc/nordic/common/soc_nrf_common.h +++ b/soc/nordic/common/soc_nrf_common.h @@ -236,6 +236,19 @@ DT_PINCTRL_HAS_NAME(node_id, sleep), \ DT_NODE_PATH(node_id) " defined without sleep state") +/** + * Error out the build if CONFIG_HAS_NORDIC_DMM=y and memory-regions property is not defined + * or the status of the selected memory region is not "okay" + * + * @param node Devicetree node. + */ +#define NRF_DT_CHECK_NODE_HAS_REQUIRED_MEMORY_REGIONS(node_id) \ + IF_ENABLED(CONFIG_HAS_NORDIC_DMM, \ + (BUILD_ASSERT(( \ + DT_NODE_HAS_PROP(node_id, memory_regions) && \ + DT_NODE_HAS_STATUS_OKAY(DT_PHANDLE_BY_IDX(node_id, memory_regions, 0))), \ + DT_NODE_PATH(node_id) " defined without memory regions"))) + /** @brief Get clock frequency that is used for the given node. * * Macro checks if node has clock property and if yes then if clock has clock_frequency property From 446f35c7cd3690c685b006d8e6172897293091fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Bainczyk?= Date: Wed, 16 Jul 2025 08:00:26 +0200 Subject: [PATCH 0378/2141] [nrf fromtree] samples: boards: nrf: clock_control: Add memory-regions prop to uart sample MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add missing "memory-regions" property which is required for UART on NRF54H20 to clock_control sample overlay file. Signed-off-by: Michał Bainczyk (cherry picked from commit ba3662ac5d0d199325eeb4a0711f0b6d8ed69b36) --- samples/boards/nordic/clock_control/configs/uart135.overlay | 1 + 1 file changed, 1 insertion(+) diff --git a/samples/boards/nordic/clock_control/configs/uart135.overlay b/samples/boards/nordic/clock_control/configs/uart135.overlay index 0e81f4cd2aa7..51f8f5102c03 100644 --- a/samples/boards/nordic/clock_control/configs/uart135.overlay +++ b/samples/boards/nordic/clock_control/configs/uart135.overlay @@ -12,4 +12,5 @@ &uart135 { status = "okay"; + memory-regions = <&cpuapp_dma_region>; }; From b83628773c322abb2347726371b6a63441188e33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Mon, 30 Jun 2025 08:03:06 +0200 Subject: [PATCH 0379/2141] [nrf fromlist] dts: bindings: serial: nrf-uarte: Add timer property MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Timer property indicates which TIMER instance should be used for byte counting. If timer property is present then given instance is using TIMER to count received bytes. Upstream PR #: 92767 Signed-off-by: Krzysztof Chruściński (cherry picked from commit af01bdaf1501c3f2a2012499193c7acdb10e784e) --- dts/bindings/serial/nordic,nrf-uarte.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dts/bindings/serial/nordic,nrf-uarte.yaml b/dts/bindings/serial/nordic,nrf-uarte.yaml index 4e9ccb0dd400..c8eb2bbc758d 100644 --- a/dts/bindings/serial/nordic,nrf-uarte.yaml +++ b/dts/bindings/serial/nordic,nrf-uarte.yaml @@ -24,3 +24,11 @@ properties: type: boolean description: | UARTE allows usage of cross domain pins with constant latency mode required. + + timer: + type: phandle + description: | + Timer instance used to count received bytes. Due to issues with frame timeout + feature it is required to reliably receive data in cases where flow control + is not used and new byte can appear on the line when frame timeout expires + but before it is handled. From 249e3bf5abbe03e3a493915ca89b3ad585207022 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Mon, 7 Jul 2025 12:02:24 +0200 Subject: [PATCH 0380/2141] [nrf fromlist] tests: drivers: uart: async_dual: Add progress report MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add reporting about the test progress. Test lasts few seconds and progress report helps to see if test stuck or how it is progressing. Upstream PR #: 92767 Signed-off-by: Krzysztof Chruściński (cherry picked from commit 27a23396b8860f0d03fe4f2136b9e530c5146774) --- tests/drivers/uart/uart_async_dual/src/main.c | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/drivers/uart/uart_async_dual/src/main.c b/tests/drivers/uart/uart_async_dual/src/main.c index 37ce73120acb..d14e0f88a11e 100644 --- a/tests/drivers/uart/uart_async_dual/src/main.c +++ b/tests/drivers/uart/uart_async_dual/src/main.c @@ -365,6 +365,26 @@ static void config_baudrate(uint32_t rate) } } +static void report_progress(uint32_t start) +{ + static const uint32_t inc = CONFIG_UART_ASYNC_DUAL_TEST_TIMEOUT / 20; + static uint32_t next; + static uint32_t progress; + + if ((k_uptime_get_32() - start < inc) && progress) { + /* Reset state. */ + next = inc; + progress = 0; + } + + if (k_uptime_get_32() > (start + next)) { + progress += 5; + TC_PRINT("\r%d%%", progress); + next += inc; + } +} + + /* Test is running following scenario. Transmitter is sending packets which * has 1 byte header with length followed by the payload. Transmitter can send * packets in two modes: bulk where data is send in chunks without gaps between @@ -380,6 +400,7 @@ static void var_packet_hwfc(uint32_t baudrate, bool tx_packets, bool cont) { int err; uint32_t load = 0; + uint32_t start = k_uptime_get_32(); config_baudrate(baudrate); @@ -420,8 +441,10 @@ static void var_packet_hwfc(uint32_t baudrate, bool tx_packets, bool cont) while (tx_data.cont || rx_data.cont) { fill_tx(&tx_data); k_msleep(1); + report_progress(start); try_tx(tx_dev, false); } + TC_PRINT("\n"); if (IS_ENABLED(CONFIG_CPU_LOAD)) { load = cpu_load_get(true); @@ -653,6 +676,7 @@ static void hci_like_rx(void) uint8_t len; bool cont; bool explicit_pm = IS_ENABLED(CONFIG_PM_RUNTIME_IN_TEST); + uint32_t start = k_uptime_get_32(); while (1) { if (explicit_pm) { @@ -704,7 +728,9 @@ static void hci_like_rx(void) PM_CHECK(rx_dev, tx_dev, false); check_payload(rx_data.buf, len); + report_progress(start); } + TC_PRINT("\n"); } #define HCI_LIKE_TX_STACK_SIZE 2048 From bac4ea5d135b521c269cbceb231467468e0b49a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Mon, 7 Jul 2025 12:02:46 +0200 Subject: [PATCH 0381/2141] [nrf fromlist] tests: drivers: uart: async_dual: Extend testing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Extend test with a mode where HWFC is off and receiver is providing buffers on time. In that case receiver should be able to continuously receive data without losing any byte (even without HWFC). Additionally, TX data is chopped to verify that receiver does not loose bytes when new TX data collides with detected RX timeout. Upstream PR #: 92767 Signed-off-by: Krzysztof Chruściński (cherry picked from commit 82a8a549e64ef45f4967e9b3dd81863ae7d7ffeb) --- tests/drivers/uart/uart_async_dual/Kconfig | 8 + tests/drivers/uart/uart_async_dual/src/main.c | 218 ++++++++++++++---- .../uart/uart_async_dual/testcase.yaml | 15 ++ 3 files changed, 191 insertions(+), 50 deletions(-) diff --git a/tests/drivers/uart/uart_async_dual/Kconfig b/tests/drivers/uart/uart_async_dual/Kconfig index 6e80ec3a7957..f0087aa48e3b 100644 --- a/tests/drivers/uart/uart_async_dual/Kconfig +++ b/tests/drivers/uart/uart_async_dual/Kconfig @@ -16,5 +16,13 @@ config PM_RUNTIME_IN_TEST select PM_DEVICE select PM_DEVICE_RUNTIME +config TEST_CHOPPED_TX + bool "Test chopped TX data" + default y + help + When enabled then test cases that transmits TX packets in random chunks are + performed. Some driver implementation do not support case when new TX data + collides with handling of the RX timeout. + # Include Zephyr's Kconfig source "Kconfig" diff --git a/tests/drivers/uart/uart_async_dual/src/main.c b/tests/drivers/uart/uart_async_dual/src/main.c index d14e0f88a11e..c2ad5d8a0a0c 100644 --- a/tests/drivers/uart/uart_async_dual/src/main.c +++ b/tests/drivers/uart/uart_async_dual/src/main.c @@ -28,9 +28,10 @@ LOG_MODULE_REGISTER(test); #endif #define TX_TIMEOUT 100000 -#define RX_TIMEOUT 2000 +#define RX_TIMEOUT_BYTES 50 #define MAX_PACKET_LEN 128 +#define MIN_PACKET_LEN 10 struct dut_data { const struct device *dev; @@ -100,6 +101,7 @@ static const struct device *tx_dev; enum test_tx_mode { TX_BULK, TX_PACKETS, + TX_CHOPPED, }; struct test_tx_data { @@ -111,6 +113,8 @@ struct test_tx_data { volatile bool cont; volatile enum test_tx_mode mode; struct k_sem sem; + uint32_t idx; + uint32_t rx_timeout; }; enum test_rx_state { @@ -121,17 +125,21 @@ enum test_rx_state { enum test_rx_mode { RX_CONT, RX_DIS, + RX_ALL, }; struct test_rx_data { uint8_t hdr[1]; uint8_t buf[256]; uint32_t rx_cnt; + uint32_t payload_idx; enum test_rx_state state; enum test_rx_mode mode; volatile bool cont; bool buf_req; struct k_sem sem; + uint32_t timeout; + uint32_t buf_idx; }; static struct test_tx_data tx_data; @@ -143,8 +151,8 @@ static void fill_tx(struct test_tx_data *data) uint32_t len; int err; - if (data->mode == TX_PACKETS) { - err = k_sem_take(&data->sem, K_MSEC(100)); + if (data->mode != TX_BULK) { + err = k_sem_take(&data->sem, K_MSEC(200)); if (err < 0 && !data->cont) { return; } @@ -153,9 +161,10 @@ static void fill_tx(struct test_tx_data *data) uint8_t len = sys_rand8_get(); len = len % MAX_PACKET_LEN; - len = MAX(2, len); + len = MAX(MIN_PACKET_LEN, len); data->packet_len = len; + data->idx = 0; for (int i = 0; i < len; i++) { data->buf[i] = len - i; } @@ -163,12 +172,11 @@ static void fill_tx(struct test_tx_data *data) return; } - while ((len = ring_buf_put_claim(&data->rbuf, &buf, 255)) > 1) { + while ((len = ring_buf_put_claim(&data->rbuf, &buf, 255)) > 0) { uint8_t r = (sys_rand8_get() % MAX_PACKET_LEN) % len; - uint8_t packet_len = MAX(r, 2); - uint8_t rem = len - packet_len; + uint8_t packet_len = MAX(r, MIN_PACKET_LEN); - packet_len = (rem < 3) ? len : packet_len; + packet_len = (len <= MIN_PACKET_LEN) ? len : packet_len; buf[0] = packet_len; for (int i = 1; i < packet_len; i++) { buf[i] = packet_len - i; @@ -189,7 +197,7 @@ static void try_tx(const struct device *dev, bool irq) return; } - if ((tx_data.mode == TX_PACKETS) && (tx_data.packet_len > 0)) { + if (tx_data.mode == TX_PACKETS) { uint8_t len = tx_data.packet_len; tx_data.packet_len = 0; @@ -199,19 +207,50 @@ static void try_tx(const struct device *dev, bool irq) err, irq, tx_data.cont); return; } - zassert_true(tx_data.mode == TX_BULK); - if (!atomic_cas(&tx_data.busy, 0, 1)) { + if (tx_data.mode == TX_BULK) { + if (!atomic_cas(&tx_data.busy, 0, 1)) { + return; + } + + len = ring_buf_get_claim(&tx_data.rbuf, &buf, 255); + if (len > 0) { + err = uart_tx(dev, buf, len, TX_TIMEOUT); + zassert_equal(err, 0, + "Unexpected err:%d irq:%d cont:%d\n", + err, irq, tx_data.cont); + } else { + tx_data.busy = 0; + } return; } - len = ring_buf_get_claim(&tx_data.rbuf, &buf, 255); - if (len > 0) { - err = uart_tx(dev, buf, len, TX_TIMEOUT); - zassert_equal(err, 0, - "Unexpected err:%d irq:%d cont:%d\n", - err, irq, tx_data.cont); + zassert_true(tx_data.mode == TX_CHOPPED); + + uint32_t rem = tx_data.packet_len - tx_data.idx; + + if (tx_data.packet_len > 12) { + len = sys_rand8_get() % (tx_data.packet_len / 4); + } else { + len = 0; } + len = MAX(3, len); + len = MIN(rem, len); + + buf = &tx_data.buf[tx_data.idx]; + tx_data.idx += len; + + err = uart_tx(dev, buf, len, TX_TIMEOUT); + zassert_equal(err, 0, + "Unexpected err:%d irq:%d cont:%d\n", + err, irq, tx_data.cont); +} + +static void tx_backoff(uint32_t rx_timeout) +{ + uint32_t delay = (rx_timeout / 2) + (sys_rand32_get() % rx_timeout); + + k_busy_wait(delay); } static void on_tx_done(const struct device *dev, struct uart_event *evt) @@ -221,6 +260,17 @@ static void on_tx_done(const struct device *dev, struct uart_event *evt) return; } + if (tx_data.mode == TX_CHOPPED) { + if (tx_data.idx == tx_data.packet_len) { + k_sem_give(&tx_data.sem); + } else { + + tx_backoff(tx_data.rx_timeout); + try_tx(dev, true); + } + return; + } + /* Finish previous data chunk and start new if any pending. */ ring_buf_get_finish(&tx_data.rbuf, evt->data.tx.len); atomic_set(&tx_data.busy, 0); @@ -239,7 +289,16 @@ static void on_rx_rdy(const struct device *dev, struct uart_event *evt) rx_data.rx_cnt += evt->data.rx.len; if (evt->data.rx.buf == rx_data.hdr) { + if (rx_data.hdr[0] == 1) { + /* single byte packet. */ + err = uart_rx_buf_rsp(dev, rx_data.hdr, 1); + zassert_equal(err, 0); + return; + } + + zassert_equal(rx_data.payload_idx, 0); rx_data.state = RX_PAYLOAD; + rx_data.payload_idx = rx_data.hdr[0] - 1; if ((rx_data.mode == RX_CONT) && rx_data.buf_req) { size_t l = rx_data.hdr[0] - 1; @@ -248,16 +307,19 @@ static void on_rx_rdy(const struct device *dev, struct uart_event *evt) err = uart_rx_buf_rsp(dev, rx_data.buf, rx_data.hdr[0] - 1); } } else { - /* Payload received */ - rx_data.state = RX_HDR; - zassert_equal(len, rx_data.hdr[0] - 1); - for (int i = 0; i < len; i++) { - bool ok = evt->data.rx.buf[off + i] == (uint8_t)(len - i); + bool ok; + + if ((rx_data.mode == RX_ALL) && (rx_data.payload_idx == 0)) { + rx_data.payload_idx = evt->data.rx.buf[off + i]; + ok = true; + } else { + ok = evt->data.rx.buf[off + i] == (uint8_t)rx_data.payload_idx; + } if (!ok) { LOG_ERR("Unexpected data at %d, exp:%02x got:%02x", - i, len - i, evt->data.rx.buf[off + i]); + i, rx_data.payload_idx, evt->data.rx.buf[off + i]); } zassert_true(ok, "Unexpected data at %d, exp:%02x got:%02x", @@ -270,21 +332,52 @@ static void on_rx_rdy(const struct device *dev, struct uart_event *evt) */ return; } - } - if ((rx_data.mode == RX_CONT) && rx_data.buf_req) { - rx_data.buf_req = false; - err = uart_rx_buf_rsp(dev, rx_data.hdr, 1); + rx_data.payload_idx--; + if (rx_data.payload_idx == 0) { + if (rx_data.mode != RX_ALL) { + zassert_equal(i + 1, len, "len:%d i:%d", len, i); + } + rx_data.state = RX_HDR; + if ((rx_data.mode == RX_CONT) && rx_data.buf_req) { + rx_data.buf_req = false; + err = uart_rx_buf_rsp(dev, rx_data.hdr, 1); + zassert_equal(err, 0); + } + } } } } +static void on_rx_buf_req(const struct device *dev) +{ + if (rx_data.mode != RX_ALL) { + rx_data.buf_req = true; + return; + } + + size_t len = sizeof(rx_data.buf) / 2; + uint8_t *buf = &rx_data.buf[len * rx_data.buf_idx]; + + rx_data.buf_idx = (rx_data.buf_idx + 1) & 0x1; + uart_rx_buf_rsp(dev, buf, len); +} + static void on_rx_dis(const struct device *dev, struct uart_event *evt, void *user_data) { ARG_UNUSED(evt); struct test_rx_data *data = user_data; int err; - uint8_t *buf = (data->state == RX_HDR) ? data->hdr : data->buf; - uint32_t len = (data->state == RX_HDR) ? 1 : (data->hdr[0] - 1); + uint8_t *buf; + uint32_t len; + + if (data->mode == RX_ALL) { + buf = data->buf; + len = sizeof(data->buf) / 2; + } else { + buf = (data->state == RX_HDR) ? data->hdr : data->buf; + len = (data->state == RX_HDR) ? 1 : (data->hdr[0] - 1); + data->buf_idx = 1; + } data->buf_req = false; @@ -294,7 +387,7 @@ static void on_rx_dis(const struct device *dev, struct uart_event *evt, void *us zassert_true(len > 0); - err = uart_rx_enable(dev, buf, len, RX_TIMEOUT); + err = uart_rx_enable(dev, buf, len, data->timeout); zassert_equal(err, 0, "Unexpected err:%d", err); } @@ -330,8 +423,8 @@ static void uart_callback(const struct device *dev, struct uart_event *evt, void zassert_true(dev == rx_dev); break; case UART_RX_BUF_REQUEST: - rx_data.buf_req = true; zassert_true(dev == rx_dev); + on_rx_buf_req(dev); break; case UART_RX_DISABLED: zassert_true(dev == rx_dev); @@ -346,7 +439,7 @@ static void uart_callback(const struct device *dev, struct uart_event *evt, void } } -static void config_baudrate(uint32_t rate) +static void config_baudrate(uint32_t rate, bool hwfc) { struct uart_config config; int err; @@ -354,6 +447,7 @@ static void config_baudrate(uint32_t rate) err = uart_config_get(rx_dev, &config); zassert_equal(err, 0, "Unexpected err:%d", err); + config.flow_ctrl = hwfc ? UART_CFG_FLOW_CTRL_RTS_CTS : UART_CFG_FLOW_CTRL_NONE; config.baudrate = rate; err = uart_configure(rx_dev, &config); @@ -396,13 +490,14 @@ static void report_progress(uint32_t start) * * Test has busy simulator running if it is enabled in the configuration. */ -static void var_packet_hwfc(uint32_t baudrate, bool tx_packets, bool cont) +static void var_packet(uint32_t baudrate, enum test_tx_mode tx_mode, + enum test_rx_mode rx_mode, bool hwfc) { int err; uint32_t load = 0; uint32_t start = k_uptime_get_32(); - config_baudrate(baudrate); + config_baudrate(baudrate, hwfc); if (IS_ENABLED(CONFIG_TEST_BUSY_SIM)) { uint32_t active_avg = (baudrate == 1000000) ? 5 : 30; @@ -414,13 +509,15 @@ static void var_packet_hwfc(uint32_t baudrate, bool tx_packets, bool cont) memset(&tx_data, 0, sizeof(tx_data)); memset(&rx_data, 0, sizeof(rx_data)); tx_data.cont = true; - tx_data.mode = tx_packets ? TX_PACKETS : TX_BULK; - k_sem_init(&tx_data.sem, tx_packets ? 1 : 0, 1); + tx_data.mode = tx_mode; + k_sem_init(&tx_data.sem, (tx_mode != TX_BULK) ? 1 : 0, 1); + rx_data.timeout = (RX_TIMEOUT_BYTES * 1000000 * 10) / baudrate; + tx_data.rx_timeout = rx_data.timeout; rx_data.cont = true; rx_data.rx_cnt = 0; rx_data.state = RX_HDR; - rx_data.mode = cont ? RX_CONT : RX_DIS; + rx_data.mode = rx_mode; ring_buf_init(&tx_data.rbuf, sizeof(tx_data.buf), tx_data.buf); @@ -459,62 +556,82 @@ static void var_packet_hwfc(uint32_t baudrate, bool tx_packets, bool cont) /* Flush all TX data that may be already started. */ k_msleep(10); - (void)uart_rx_enable(rx_dev, rx_data.buf, sizeof(rx_data.buf), RX_TIMEOUT); + (void)uart_rx_enable(rx_dev, rx_data.buf, sizeof(rx_data.buf), rx_data.timeout); k_msleep(10); (void)uart_rx_disable(rx_dev); k_msleep(10); TC_PRINT("Received %d bytes for %d ms, CPU load:%d.%d\n", rx_data.rx_cnt, CONFIG_UART_ASYNC_DUAL_TEST_TIMEOUT, load / 10, load % 10); - zassert_true(rx_data.rx_cnt > 1000, "Unexected RX cnt: %d", rx_data.rx_cnt); + zassert_true(rx_data.rx_cnt > 1000, "Unexpected RX cnt: %d", rx_data.rx_cnt); } ZTEST(uart_async_dual, test_var_packets_tx_bulk_dis_hwfc) { /* TX in bulk mode, RX in DIS mode, 115k2 */ - var_packet_hwfc(115200, false, false); + var_packet(115200, TX_BULK, RX_DIS, true); } ZTEST(uart_async_dual, test_var_packets_tx_bulk_cont_hwfc) { /* TX in bulk mode, RX in CONT mode, 115k2 */ - var_packet_hwfc(115200, false, true); + var_packet(115200, TX_BULK, RX_CONT, true); } ZTEST(uart_async_dual, test_var_packets_tx_bulk_dis_hwfc_1m) { /* TX in bulk mode, RX in DIS mode, 1M */ - var_packet_hwfc(1000000, false, false); + var_packet(1000000, TX_BULK, RX_DIS, true); } ZTEST(uart_async_dual, test_var_packets_tx_bulk_cont_hwfc_1m) { /* TX in bulk mode, RX in CONT mode, 1M */ - var_packet_hwfc(1000000, false, true); + var_packet(1000000, TX_BULK, RX_CONT, true); } ZTEST(uart_async_dual, test_var_packets_dis_hwfc) { /* TX in packet mode, RX in DIS mode, 115k2 */ - var_packet_hwfc(115200, true, false); + var_packet(115200, TX_PACKETS, RX_DIS, true); } ZTEST(uart_async_dual, test_var_packets_cont_hwfc) { /* TX in packet mode, RX in CONT mode, 115k2 */ - var_packet_hwfc(115200, true, true); + var_packet(115200, TX_PACKETS, RX_CONT, true); } ZTEST(uart_async_dual, test_var_packets_dis_hwfc_1m) { /* TX in packet mode, RX in DIS mode, 1M */ - var_packet_hwfc(1000000, true, false); + var_packet(1000000, TX_PACKETS, RX_DIS, true); } ZTEST(uart_async_dual, test_var_packets_cont_hwfc_1m) { /* TX in packet mode, RX in CONT mode, 1M */ - var_packet_hwfc(1000000, true, true); + var_packet(1000000, TX_PACKETS, RX_CONT, true); +} + +ZTEST(uart_async_dual, test_var_packets_chopped_all) +{ + if (!IS_ENABLED(CONFIG_TEST_CHOPPED_TX)) { + ztest_test_skip(); + } + + /* TX in chopped mode, RX in receive ALL mode, 115k2 */ + var_packet(115200, TX_CHOPPED, RX_ALL, false); +} + +ZTEST(uart_async_dual, test_var_packets_chopped_all_1m) +{ + if (!IS_ENABLED(CONFIG_TEST_CHOPPED_TX)) { + ztest_test_skip(); + } + + /* TX in chopped mode, RX in receive ALL mode, 1M */ + var_packet(1000000, TX_CHOPPED, RX_ALL, false); } static void hci_like_callback(const struct device *dev, struct uart_event *evt, void *user_data) @@ -563,7 +680,7 @@ static bool rx(uint8_t *buf, size_t len) { int err; - err = uart_rx_enable(rx_dev, buf, len, RX_TIMEOUT); + err = uart_rx_enable(rx_dev, buf, len, rx_data.timeout); zassert_equal(err, 0, "Unexpected err:%d", err); err = k_sem_take(&rx_data.sem, K_MSEC(100)); @@ -751,7 +868,7 @@ static void hci_like_test(uint32_t baudrate) int err; uint32_t load = 0; - config_baudrate(baudrate); + config_baudrate(baudrate, true); if (IS_ENABLED(CONFIG_TEST_BUSY_SIM)) { uint32_t active_avg = (baudrate == 1000000) ? 10 : 50; @@ -765,6 +882,7 @@ static void hci_like_test(uint32_t baudrate) tx_data.cnt = 0; tx_data.cont = true; rx_data.cont = true; + rx_data.timeout = (RX_TIMEOUT_BYTES * 1000000 * 10) / baudrate; k_sem_init(&tx_data.sem, 1, 1); k_sem_init(&rx_data.sem, 0, 1); @@ -802,7 +920,7 @@ static void hci_like_test(uint32_t baudrate) k_msleep(10); PM_CHECK(tx_dev, rx_dev, false); - (void)uart_rx_enable(rx_dev, rx_data.buf, sizeof(rx_data.buf), RX_TIMEOUT); + (void)uart_rx_enable(rx_dev, rx_data.buf, sizeof(rx_data.buf), rx_data.timeout); k_msleep(1); (void)uart_rx_disable(rx_dev); diff --git a/tests/drivers/uart/uart_async_dual/testcase.yaml b/tests/drivers/uart/uart_async_dual/testcase.yaml index 1a2d811bbfe9..1722d5e5e7d1 100644 --- a/tests/drivers/uart/uart_async_dual/testcase.yaml +++ b/tests/drivers/uart/uart_async_dual/testcase.yaml @@ -73,3 +73,18 @@ tests: - nrf52_bsim extra_configs: - CONFIG_PM_RUNTIME_IN_TEST=y + drivers.uart.async_dual.no_tx_chopped: + harness: ztest + harness_config: + fixture: uart_loopback + depends_on: gpio + platform_allow: + - nrf54l15dk/nrf54l15/cpuapp + - nrf54h20dk/nrf54h20/cpuapp + - nrf54h20dk/nrf54h20/cpurad + - nrf54h20dk/nrf54h20/cpuppr + - nrf9160dk/nrf9160 + - nrf52_bsim + extra_configs: + - CONFIG_TEST_CHOPPED_TX=n + - CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER=n From 9880309e77a33c49f91906f9355d845f11984432 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Mon, 30 Jun 2025 08:08:26 +0200 Subject: [PATCH 0382/2141] [nrf fromlist] tests: drivers: uart: async_dual: Update configuration for nrf54l MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add timer property to the uart device under test. Add zephyr,pm-device-runtime-auto to the uart device under test. Upstream PR #: 92767 Signed-off-by: Krzysztof Chruściński (cherry picked from commit 2e28af3247badef8cc7b03c19cf96062f6d7ee9a) --- .../boards/nrf54l15dk_nrf54l15_cpuapp.overlay | 1 + .../boards/nrf54l15dk_nrf54l15_cpuapp.overlay | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/tests/drivers/uart/uart_async_api/boards/nrf54l15dk_nrf54l15_cpuapp.overlay b/tests/drivers/uart/uart_async_api/boards/nrf54l15dk_nrf54l15_cpuapp.overlay index a1e29cbf0ffc..d8995e369711 100644 --- a/tests/drivers/uart/uart_async_api/boards/nrf54l15dk_nrf54l15_cpuapp.overlay +++ b/tests/drivers/uart/uart_async_api/boards/nrf54l15dk_nrf54l15_cpuapp.overlay @@ -42,6 +42,7 @@ dut: &uart21 { pinctrl-1 = <&uart21_sleep_alt>; pinctrl-names = "default", "sleep"; current-speed = <115200>; + timer = <&timer21>; }; dut2: &uart00 { diff --git a/tests/drivers/uart/uart_async_dual/boards/nrf54l15dk_nrf54l15_cpuapp.overlay b/tests/drivers/uart/uart_async_dual/boards/nrf54l15dk_nrf54l15_cpuapp.overlay index cd0649411531..69c5c1830961 100644 --- a/tests/drivers/uart/uart_async_dual/boards/nrf54l15dk_nrf54l15_cpuapp.overlay +++ b/tests/drivers/uart/uart_async_dual/boards/nrf54l15dk_nrf54l15_cpuapp.overlay @@ -38,6 +38,10 @@ }; }; +&timer21 { + status = "reserved"; +}; + dut: &uart21 { status = "okay"; current-speed = <115200>; @@ -45,6 +49,8 @@ dut: &uart21 { pinctrl-1 = <&uart21_sleep>; pinctrl-names = "default", "sleep"; hw-flow-control; + timer = <&timer21>; + zephyr,pm-device-runtime-auto; }; dut_aux: &uart22 { @@ -54,6 +60,7 @@ dut_aux: &uart22 { pinctrl-1 = <&uart22_sleep>; pinctrl-names = "default", "sleep"; hw-flow-control; + zephyr,pm-device-runtime-auto; }; &timer20 { From 95ceeea1d07954d763c357cbe667def4ea1fd17f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Fri, 4 Jul 2025 13:02:21 +0200 Subject: [PATCH 0383/2141] [nrf fromlist] tests: drivers: uart: async_dual: Extend nrf54h20dk configuration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add workaround timer to instances that are used for reception in the test. Upstream PR #: 92767 Signed-off-by: Krzysztof Chruściński (cherry picked from commit a11529b6f1468464eaca861c3a3a503088ed3dd9) --- .../boards/nrf54h20dk_nrf54h20_common.dtsi | 22 +++++++++++++++++++ .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 12 ++++++++++ 2 files changed, 34 insertions(+) diff --git a/tests/drivers/uart/uart_async_dual/boards/nrf54h20dk_nrf54h20_common.dtsi b/tests/drivers/uart/uart_async_dual/boards/nrf54h20dk_nrf54h20_common.dtsi index 79dac0ca9607..84ad9194e62a 100644 --- a/tests/drivers/uart/uart_async_dual/boards/nrf54h20dk_nrf54h20_common.dtsi +++ b/tests/drivers/uart/uart_async_dual/boards/nrf54h20dk_nrf54h20_common.dtsi @@ -60,6 +60,16 @@ }; }; +&timer134 { + status = "reserved"; +}; + +&dppic135 { + owned-channels = <0>; + source-channels = <0>; + status = "okay"; +}; + dut: &uart134 { status = "okay"; current-speed = <115200>; @@ -67,6 +77,7 @@ dut: &uart134 { pinctrl-1 = <&uart134_alt_sleep>; pinctrl-names = "default", "sleep"; hw-flow-control; + timer = <&timer134>; zephyr,pm-device-runtime-auto; }; @@ -80,12 +91,23 @@ dut_aux: &uart137 { zephyr,pm-device-runtime-auto; }; +&dppic120 { + owned-channels = <0>; + source-channels = <0>; + status = "okay"; +}; + +&timer120 { + status = "reserved"; +}; + dut2: &uart120 { pinctrl-0 = <&uart120_default_alt>; pinctrl-1 = <&uart120_sleep_alt>; pinctrl-names = "default", "sleep"; current-speed = <115200>; hw-flow-control; + timer = <&timer120>; zephyr,pm-device-runtime-auto; }; diff --git a/tests/drivers/uart/uart_async_dual/sysbuild/vpr_launcher/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/uart/uart_async_dual/sysbuild/vpr_launcher/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index fcdc838a54e4..65a2c52016e6 100644 --- a/tests/drivers/uart/uart_async_dual/sysbuild/vpr_launcher/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/tests/drivers/uart/uart_async_dual/sysbuild/vpr_launcher/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -9,3 +9,15 @@ status = "reserved"; interrupt-parent = <&cpuppr_clic>; }; + +&timer134 { + interrupt-parent = <&cpuppr_clic>; +}; + +&dppic135 { + child-owned-channels = <0>; +}; + +&uart136 { + current-speed = <1000000>; +}; From 29526b1e69a2ac46c13da6ca44251bdaa73f14e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Fri, 11 Jul 2025 12:46:55 +0200 Subject: [PATCH 0384/2141] [nrf fromlist] tests: drivers: uart: async_dual: Optimize test data handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Stress test is executed on CPUs with slow clock (16MHz). Handling of test data in UART_RX_RDY event is optimized to reduce time spent in the interrupt context. Since payload is always a decrementing sequence, fixed array is used to compare memory which allows to use standard memcmp instead of byte by byte comparison. Upstream PR #: 92767 Signed-off-by: Krzysztof Chruściński (cherry picked from commit 0afbbc7251b6e6bee3fe8dc7411477979b2c3ad9) --- tests/drivers/uart/uart_async_dual/src/main.c | 152 +++++++++++------- 1 file changed, 94 insertions(+), 58 deletions(-) diff --git a/tests/drivers/uart/uart_async_dual/src/main.c b/tests/drivers/uart/uart_async_dual/src/main.c index c2ad5d8a0a0c..160d8c761040 100644 --- a/tests/drivers/uart/uart_async_dual/src/main.c +++ b/tests/drivers/uart/uart_async_dual/src/main.c @@ -61,6 +61,25 @@ ZTEST_DMEM struct dut_data duts[] = { #endif }; +/* Array that contains potential payload. It is used to memcmp against incoming packets. */ +static const uint8_t test_buf[256] = { + 255, 254, 253, 252, 251, 250, 249, 248, 247, 246, 245, 244, 243, 242, 241, + 240, 239, 238, 237, 236, 235, 234, 233, 232, 231, 230, 229, 228, 227, 226, + 225, 224, 223, 222, 221, 220, 219, 218, 217, 216, 215, 214, 213, 212, 211, + 210, 209, 208, 207, 206, 205, 204, 203, 202, 201, 200, 199, 198, 197, 196, + 195, 194, 193, 192, 191, 190, 189, 188, 187, 186, 185, 184, 183, 182, 181, + 180, 179, 178, 177, 176, 175, 174, 173, 172, 171, 170, 169, 168, 167, 166, + 165, 164, 163, 162, 161, 160, 159, 158, 157, 156, 155, 154, 153, 152, 151, + 150, 149, 148, 147, 146, 145, 144, 143, 142, 141, 140, 139, 138, 137, 136, + 135, 134, 133, 132, 131, 130, 129, 128, 127, 126, 125, 124, 123, 122, 121, + 120, 119, 118, 117, 116, 115, 114, 113, 112, 111, 110, 109, 108, 107, 106, + 105, 104, 103, 102, 101, 100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, + 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, + 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, + 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, + 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, + 9, 8, 7, 6, 5, 4, 3, 2, 1, 0}; + static void pm_check(const struct device *dev, const struct device *second_dev, bool exp_on, int line) { @@ -128,6 +147,8 @@ enum test_rx_mode { RX_ALL, }; +typedef bool (*test_on_rx_rdy_t)(const struct device *dev, uint8_t *buf, size_t len); + struct test_rx_data { uint8_t hdr[1]; uint8_t buf[256]; @@ -140,6 +161,7 @@ struct test_rx_data { struct k_sem sem; uint32_t timeout; uint32_t buf_idx; + test_on_rx_rdy_t on_rx_rdy; }; static struct test_tx_data tx_data; @@ -277,75 +299,86 @@ static void on_tx_done(const struct device *dev, struct uart_event *evt) try_tx(dev, true); } -static void on_rx_rdy(const struct device *dev, struct uart_event *evt) +static bool on_rx_rdy_rx_all(const struct device *dev, uint8_t *buf, size_t len) { - uint32_t len = evt->data.rx.len; - uint32_t off = evt->data.rx.offset; - int err; + bool ok; - if (!rx_data.cont) { - return; + if (rx_data.payload_idx == 0) { + rx_data.payload_idx = buf[0] - 1; + buf++; + len--; } - rx_data.rx_cnt += evt->data.rx.len; - if (evt->data.rx.buf == rx_data.hdr) { - if (rx_data.hdr[0] == 1) { - /* single byte packet. */ - err = uart_rx_buf_rsp(dev, rx_data.hdr, 1); - zassert_equal(err, 0); - return; + ok = memcmp(buf, &test_buf[256 - rx_data.payload_idx], len) == 0; + rx_data.payload_idx -= len; + + return ok; +} + +static bool on_rx_rdy_hdr(const struct device *dev, uint8_t *buf, size_t len); + +static bool on_rx_rdy_payload(const struct device *dev, uint8_t *buf, size_t len) +{ + bool ok; + int err; + + ok = memcmp(buf, &test_buf[255 - rx_data.payload_idx], len) == 0; + if (!ok) { + for (int i = 0; i < len; i++) { + if (buf[i] != test_buf[255 - rx_data.payload_idx + i]) { + zassert_true(false, "Byte %d expected: %02x got: %02x", + i, buf[i], test_buf[255 - rx_data.payload_idx + i]); + } } + rx_data.cont = false; + tx_data.cont = false; + zassert_true(ok); + return false; + } - zassert_equal(rx_data.payload_idx, 0); - rx_data.state = RX_PAYLOAD; - rx_data.payload_idx = rx_data.hdr[0] - 1; - if ((rx_data.mode == RX_CONT) && rx_data.buf_req) { - size_t l = rx_data.hdr[0] - 1; + rx_data.payload_idx -= len; - zassert_true(l > 0); + if (rx_data.payload_idx == 0) { + rx_data.state = RX_HDR; + rx_data.on_rx_rdy = on_rx_rdy_hdr; + if ((rx_data.mode == RX_CONT) && rx_data.buf_req) { rx_data.buf_req = false; - err = uart_rx_buf_rsp(dev, rx_data.buf, rx_data.hdr[0] - 1); + err = uart_rx_buf_rsp(dev, rx_data.hdr, 1); + zassert_equal(err, 0); } - } else { - for (int i = 0; i < len; i++) { - bool ok; + } - if ((rx_data.mode == RX_ALL) && (rx_data.payload_idx == 0)) { - rx_data.payload_idx = evt->data.rx.buf[off + i]; - ok = true; - } else { - ok = evt->data.rx.buf[off + i] == (uint8_t)rx_data.payload_idx; - } + return true; +} - if (!ok) { - LOG_ERR("Unexpected data at %d, exp:%02x got:%02x", - i, rx_data.payload_idx, evt->data.rx.buf[off + i]); - } +static bool on_rx_rdy_hdr(const struct device *dev, uint8_t *buf, size_t len) +{ + int err; - zassert_true(ok, "Unexpected data at %d, exp:%02x got:%02x", - i, len - i, evt->data.rx.buf[off + i]); - if (!ok) { - rx_data.cont = false; - tx_data.cont = false; - /* Avoid flood of errors as we are in the interrupt and ztest - * cannot abort from here. - */ - return; - } - rx_data.payload_idx--; - if (rx_data.payload_idx == 0) { - if (rx_data.mode != RX_ALL) { - zassert_equal(i + 1, len, "len:%d i:%d", len, i); - } - rx_data.state = RX_HDR; - if ((rx_data.mode == RX_CONT) && rx_data.buf_req) { - rx_data.buf_req = false; - err = uart_rx_buf_rsp(dev, rx_data.hdr, 1); - zassert_equal(err, 0); - } - } + zassert_equal(buf, rx_data.hdr); + zassert_equal(len, 1); + if (rx_data.hdr[0] == 1) { + /* single byte packet. */ + if ((rx_data.mode == RX_CONT) && rx_data.buf_req) { + err = uart_rx_buf_rsp(dev, rx_data.hdr, 1); + zassert_equal(err, 0); } + return true; } + + zassert_equal(rx_data.payload_idx, 0); + rx_data.on_rx_rdy = on_rx_rdy_payload; + rx_data.payload_idx = rx_data.hdr[0] - 1; + rx_data.state = RX_PAYLOAD; + if ((rx_data.mode == RX_CONT) && rx_data.buf_req) { + size_t l = rx_data.hdr[0] - 1; + + zassert_true(l > 0); + rx_data.buf_req = false; + err = uart_rx_buf_rsp(dev, rx_data.buf, buf[0] - 1); + } + + return true; } static void on_rx_buf_req(const struct device *dev) @@ -385,7 +418,6 @@ static void on_rx_dis(const struct device *dev, struct uart_event *evt, void *us return; } - zassert_true(len > 0); err = uart_rx_enable(dev, buf, len, data->timeout); zassert_equal(err, 0, "Unexpected err:%d", err); @@ -417,7 +449,11 @@ static void uart_callback(const struct device *dev, struct uart_event *evt, void break; case UART_RX_RDY: zassert_true(dev == rx_dev); - on_rx_rdy(dev, evt); + if (rx_data.cont) { + rx_data.on_rx_rdy(dev, &evt->data.rx.buf[evt->data.rx.offset], + evt->data.rx.len); + rx_data.rx_cnt += evt->data.rx.len; + } break; case UART_RX_BUF_RELEASED: zassert_true(dev == rx_dev); @@ -516,7 +552,7 @@ static void var_packet(uint32_t baudrate, enum test_tx_mode tx_mode, tx_data.rx_timeout = rx_data.timeout; rx_data.cont = true; rx_data.rx_cnt = 0; - rx_data.state = RX_HDR; + rx_data.on_rx_rdy = rx_mode == RX_ALL ? on_rx_rdy_rx_all : on_rx_rdy_hdr; rx_data.mode = rx_mode; ring_buf_init(&tx_data.rbuf, sizeof(tx_data.buf), tx_data.buf); From d3fb28f406efd0b218b85a5e749be9a95992260b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Tue, 15 Jul 2025 10:13:10 +0200 Subject: [PATCH 0385/2141] [nrf fromlist] drivers: serial: nrfx_uarte: Prepare code for extension MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rearrange code to prepare for upcoming extension that adds special receive mode. Upstream PR #: 92767 Signed-off-by: Krzysztof Chruściński (cherry picked from commit e5003ae7e75d753ecee4205431d3f82e30245afb) --- drivers/serial/uart_nrfx_uarte.c | 133 +++++++++++++++++-------------- 1 file changed, 72 insertions(+), 61 deletions(-) diff --git a/drivers/serial/uart_nrfx_uarte.c b/drivers/serial/uart_nrfx_uarte.c index cf864a594297..995d11134733 100644 --- a/drivers/serial/uart_nrfx_uarte.c +++ b/drivers/serial/uart_nrfx_uarte.c @@ -875,6 +875,78 @@ static void tx_start(const struct device *dev, const uint8_t *buf, size_t len) static void rx_timeout(struct k_timer *timer); static void tx_timeout(struct k_timer *timer); +static void user_callback(const struct device *dev, struct uart_event *evt) +{ + struct uarte_nrfx_data *data = dev->data; + + if (data->async->user_callback) { + data->async->user_callback(dev, evt, data->async->user_data); + } +} + +static void rx_buf_release(const struct device *dev, uint8_t *buf) +{ + struct uart_event evt = { + .type = UART_RX_BUF_RELEASED, + .data.rx_buf.buf = buf, + }; + + user_callback(dev, &evt); +} + +static void notify_rx_disable(const struct device *dev) +{ + const struct uarte_nrfx_config *cfg = dev->config; + struct uart_event evt = { + .type = UART_RX_DISABLED, + }; + + if (LOW_POWER_ENABLED(cfg)) { + uint32_t key = irq_lock(); + + uarte_disable_locked(dev, UARTE_FLAG_LOW_POWER_RX); + irq_unlock(key); + } + + user_callback(dev, (struct uart_event *)&evt); + + /* runtime PM is put after the callback. In case uart is re-enabled from that + * callback we avoid suspending/resuming the device. + */ + if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { + pm_device_runtime_put_async(dev, K_NO_WAIT); + } +} + +static int uarte_nrfx_rx_disable(const struct device *dev) +{ + struct uarte_nrfx_data *data = dev->data; + struct uarte_async_rx *async_rx = &data->async->rx; + NRF_UARTE_Type *uarte = get_uarte_instance(dev); + int key; + + if (async_rx->buf == NULL) { + return -EFAULT; + } + + k_timer_stop(&async_rx->timer); + + key = irq_lock(); + + if (async_rx->next_buf != NULL) { + nrf_uarte_shorts_disable(uarte, NRF_UARTE_SHORT_ENDRX_STARTRX); + nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_RXSTARTED); + } + + async_rx->enabled = false; + async_rx->discard_fifo = true; + + nrf_uarte_task_trigger(uarte, NRF_UARTE_TASK_STOPRX); + irq_unlock(key); + + return 0; +} + #if !defined(CONFIG_UART_NRFX_UARTE_ENHANCED_RX) static void timer_handler(nrf_timer_event_t event_type, void *p_context) { } @@ -1073,15 +1145,6 @@ static int uarte_nrfx_tx_abort(const struct device *dev) return 0; } -static void user_callback(const struct device *dev, struct uart_event *evt) -{ - struct uarte_nrfx_data *data = dev->data; - - if (data->async->user_callback) { - data->async->user_callback(dev, evt, data->async->user_data); - } -} - static void notify_uart_rx_rdy(const struct device *dev, size_t len) { struct uarte_nrfx_data *data = dev->data; @@ -1095,29 +1158,6 @@ static void notify_uart_rx_rdy(const struct device *dev, size_t len) user_callback(dev, &evt); } -static void rx_buf_release(const struct device *dev, uint8_t *buf) -{ - struct uart_event evt = { - .type = UART_RX_BUF_RELEASED, - .data.rx_buf.buf = buf, - }; - - user_callback(dev, &evt); -} - -static void notify_rx_disable(const struct device *dev) -{ - struct uart_event evt = { - .type = UART_RX_DISABLED, - }; - - user_callback(dev, (struct uart_event *)&evt); - - if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_put_async(dev, K_NO_WAIT); - } -} - #ifdef UARTE_HAS_FRAME_TIMEOUT static uint32_t us_to_bauds(uint32_t baudrate, int32_t timeout) { @@ -1344,35 +1384,6 @@ static int uarte_nrfx_callback_set(const struct device *dev, return 0; } -static int uarte_nrfx_rx_disable(const struct device *dev) -{ - struct uarte_nrfx_data *data = dev->data; - struct uarte_async_rx *async_rx = &data->async->rx; - NRF_UARTE_Type *uarte = get_uarte_instance(dev); - int key; - - if (async_rx->buf == NULL) { - return -EFAULT; - } - - k_timer_stop(&async_rx->timer); - - key = irq_lock(); - - if (async_rx->next_buf != NULL) { - nrf_uarte_shorts_disable(uarte, NRF_UARTE_SHORT_ENDRX_STARTRX); - nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_RXSTARTED); - } - - async_rx->enabled = false; - async_rx->discard_fifo = true; - - nrf_uarte_task_trigger(uarte, NRF_UARTE_TASK_STOPRX); - irq_unlock(key); - - return 0; -} - static void tx_timeout(struct k_timer *timer) { const struct device *dev = k_timer_user_data_get(timer); From 2b7fae8f92faf11993a2fbaee758c56f48bbd060 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Mon, 30 Jun 2025 07:48:03 +0200 Subject: [PATCH 0386/2141] [nrf fromlist] drivers: serial: nrfx_uarte: Add mode with TIMER byte counting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add mode to be used on UARTE with frame timeout which is using a bounce buffers and TIMER to count bytes. This mode shall be used to reliably receive data without HWFC as frame timeout approach is not 100% reliable because it can loose or corrupt a byte when new byte arrives after frame timeout is detected but before it is fully handled. This mode is similar to the one enabled with CONFIG_UART_x_NRF_HW_ASYNC but additional bounce buffers are used and UARTE is receiving data to internal buffers and copies data to the user buffer. Legacy apporach cannot be used because in new SoC DMA attempts to copy data in words so when byte is received it stays in the DMA internal buffer until 4 bytes are received or end of transfer happens then internal DMA buffer is flushed. Upstream PR #: 92767 Signed-off-by: Krzysztof Chruściński (cherry picked from commit a07f73b6ff7eb85041a2f643b54840fa22c6a193) --- drivers/serial/Kconfig.nrfx | 26 + drivers/serial/Kconfig.nrfx_uart_instance | 7 + drivers/serial/uart_nrfx_uarte.c | 1028 +++++++++++++++++++-- 3 files changed, 973 insertions(+), 88 deletions(-) diff --git a/drivers/serial/Kconfig.nrfx b/drivers/serial/Kconfig.nrfx index 8bcb9e49b662..7baa53b9c420 100644 --- a/drivers/serial/Kconfig.nrfx +++ b/drivers/serial/Kconfig.nrfx @@ -78,6 +78,32 @@ config UART_ASYNC_TX_CACHE_SIZE in RAM, because EasyDMA in UARTE peripherals can only transfer data from RAM. +config UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER + bool "Use TIMER to count RX bytes" + depends on UART_ASYNC_API + depends on UART_NRFX_UARTE_LEGACY_SHIM + depends on !ARCH_POSIX # Mode not supported on BSIM target + select NRFX_GPPI + +config UART_NRFX_UARTE_BOUNCE_BUF_LEN + int "RX bounce buffer size" + depends on UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER + default 256 + range 64 1024 + help + Buffer is used when workaround with bounce buffers is applied + +config UART_NRFX_UARTE_BOUNCE_BUF_SWAP_LATENCY + int "RX bounce buffer swap latency (in microseconds)" + depends on UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER + default 300 + help + Option decides how long before current bounce buffer is filled driver + attempts to swap the buffer. It must be long enough to ensure that + space following the buffer is not overwritten. Too high value results + in more frequent buffer swaps so it impacts performance. Setting should + take into account potential interrupt handling latency. + config UART_NRFX_UARTE_DIRECT_ISR bool "Use direct ISR" diff --git a/drivers/serial/Kconfig.nrfx_uart_instance b/drivers/serial/Kconfig.nrfx_uart_instance index b1a68d691c45..82ffaa10fcb9 100644 --- a/drivers/serial/Kconfig.nrfx_uart_instance +++ b/drivers/serial/Kconfig.nrfx_uart_instance @@ -18,6 +18,13 @@ config UART_$(nrfx_uart_num)_ASYNC help This option enables UART Asynchronous API support on port $(nrfx_uart_num). +config UART_$(nrfx_uart_num)_COUNT_BYTES_WITH_TIMER + bool + depends on $(dt_nodelabel_has_prop,uart$(nrfx_uart_num),timer) + depends on HAS_HW_NRF_UARTE$(nrfx_uart_num) + default y + imply UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER + config UART_$(nrfx_uart_num)_ENHANCED_POLL_OUT bool "Efficient poll out on port $(nrfx_uart_num)" depends on !$(dt_nodelabel_bool_prop,uart$(nrfx_uart_num),endtx-stoptx-supported) diff --git a/drivers/serial/uart_nrfx_uarte.c b/drivers/serial/uart_nrfx_uarte.c index 995d11134733..149a48d88b27 100644 --- a/drivers/serial/uart_nrfx_uarte.c +++ b/drivers/serial/uart_nrfx_uarte.c @@ -188,6 +188,16 @@ BUILD_ASSERT(IS_ENABLED(CONFIG_CLOCK_CONTROL)); /* Size of hardware fifo in RX path. */ #define UARTE_HW_RX_FIFO_SIZE 5 +/* TIMER CC channels for counting bytes with TIMER. */ +/* Channel used for capturing current counter value. */ +#define UARTE_TIMER_CAPTURE_CH 0 +/* Channel used to get compare event when number of received bytes reaches user buffer size. */ +#define UARTE_TIMER_USR_CNT_CH 1 +/* Channel used to get compare event when bounce buffer need to be switched. */ +#define UARTE_TIMER_BUF_SWITCH_CH 2 +/* Magic byte that is used to fill the buffer. */ +#define UARTE_MAGIC_BYTE 0xAA + #ifdef UARTE_ANY_ASYNC struct uarte_async_tx { @@ -201,6 +211,30 @@ struct uarte_async_tx { bool pending; }; +/* Structure with data for Count Bytes With Timer receiver mode (cbwt). */ +struct uarte_async_rx_cbwt { + uint8_t *curr_bounce_buf; + uint8_t *anomaly_byte_addr; + uint32_t usr_rd_off; + uint32_t usr_wr_off; + uint32_t bounce_off; + uint32_t bounce_limit; + uint32_t last_cnt; + uint32_t cc_usr; + uint32_t cc_swap; +#ifdef CONFIG_UART_USE_RUNTIME_CONFIGURE + size_t bounce_buf_swap_len; +#endif +#ifdef UARTE_ANY_CACHE + uint8_t *anomaly_byte_dst; + uint8_t anomaly_byte; +#endif + uint8_t bounce_idx; + uint8_t ppi_ch; + bool in_irq; + bool discard_fifo; +}; + struct uarte_async_rx { struct k_timer timer; #ifdef CONFIG_HAS_NORDIC_DMM @@ -212,8 +246,9 @@ struct uarte_async_rx { size_t offset; uint8_t *next_buf; size_t next_buf_len; -#ifdef CONFIG_UART_NRFX_UARTE_ENHANCED_RX -#if !defined(UARTE_HAS_FRAME_TIMEOUT) +#if defined(CONFIG_UART_NRFX_UARTE_ENHANCED_RX) || \ + defined(CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER) +#if !defined(UARTE_HAS_FRAME_TIMEOUT) || defined(CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER) uint32_t idle_cnt; #endif k_timeout_t timeout; @@ -286,6 +321,10 @@ struct uarte_nrfx_data { #define UARTE_FLAG_POLL_OUT BIT(3) /* Flag indicating that a workaround for not working frame timeout is active. */ #define UARTE_FLAG_FTIMEOUT_WATCH BIT(4) +/* Flag indicating that UART_RX_BUF_REQUEST event need to be called from the interrupt context. */ +#define UARTE_FLAG_RX_BUF_REQ BIT(5) +/* Flag indicating that CC value in TIMER was set too late. */ +#define UARTE_FLAG_LATE_CC BIT(6) /* If enabled then ENDTX is PPI'ed to TXSTOP */ #define UARTE_CFG_FLAG_PPI_ENDTX BIT(0) @@ -304,6 +343,12 @@ struct uarte_nrfx_data { /* Indicates that workaround for spurious RXTO during restart shall be applied. */ #define UARTE_CFG_FLAG_SPURIOUS_RXTO BIT(3) +/* Indicates that UARTE/TIMER interrupt priority differs from system clock (GRTC/RTC). */ +#define UARTE_CFG_FLAG_VAR_IRQ BIT(4) + +/* Indicates that instance needs special handling of BAUDRATE register. */ +#define UARTE_CFG_FLAG_VOLATILE_BAUDRATE BIT(5) + /* Formula for getting the baudrate settings is following: * 2^12 * (2^20 / (f_PCLK / desired_baudrate)) where f_PCLK is a frequency that * drives the UARTE. @@ -340,6 +385,14 @@ struct uarte_nrfx_data { (baudrate) == 921600 ? NRF_UARTE_BAUDRATE_921600 : \ (baudrate) == 1000000 ? NRF_UARTE_BAUDRATE_1000000 : 0) +#define UARTE_MIN_BUF_SWAP_LEN 10 + +#define UARTE_US_TO_BYTES(baudrate) \ + DIV_ROUND_UP((CONFIG_UART_NRFX_UARTE_BOUNCE_BUF_SWAP_LATENCY * baudrate), 10000000) + +#define UARTE_BUF_SWAP_LEN(bounce_buf_len, baudrate) \ + ((bounce_buf_len) - MAX(UARTE_MIN_BUF_SWAP_LEN, UARTE_US_TO_BYTES(baudrate))) + #define LOW_POWER_ENABLED(_config) \ (IS_ENABLED(UARTE_ANY_LOW_POWER) && \ !IS_ENABLED(CONFIG_PM_DEVICE) && \ @@ -386,6 +439,15 @@ struct uarte_nrfx_config { #endif /* CONFIG_UART_USE_RUNTIME_CONFIGURE */ #ifdef UARTE_ANY_ASYNC +#ifdef CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER + NRF_TIMER_Type * timer_regs; + IRQn_Type timer_irqn; + IRQn_Type uarte_irqn; + uint8_t *bounce_buf[2]; + size_t bounce_buf_len; + size_t bounce_buf_swap_len; + struct uarte_async_rx_cbwt *cbwt_data; +#endif nrfx_timer_t timer; uint8_t *tx_cache; uint8_t *rx_flush_buf; @@ -405,6 +467,12 @@ struct uarte_nrfx_config { (IS_ENABLED(UARTE_ANY_HW_ASYNC) ? \ (config->flags & UARTE_CFG_FLAG_HW_BYTE_COUNTING) : false) +/* Determine if instance is using an approach with counting bytes with TIMER (cbwt). */ +#define IS_CBWT(dev) \ + COND_CODE_1(CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER, \ + ((((const struct uarte_nrfx_config *)dev->config)->cbwt_data != NULL)), \ + (false)) + static inline NRF_UARTE_Type *get_uarte_instance(const struct device *dev) { const struct uarte_nrfx_config *config = dev->config; @@ -601,10 +669,23 @@ static int baudrate_set(const struct device *dev, uint32_t baudrate) return -EINVAL; } +#ifdef CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER + if (IS_CBWT(dev)) { + struct uarte_async_rx_cbwt *cbwt_data = config->cbwt_data; + + cbwt_data->bounce_buf_swap_len = UARTE_BUF_SWAP_LEN(config->bounce_buf_len, + baudrate); + } +#endif + #ifdef UARTE_BAUDRATE_RETENTION_WORKAROUND - struct uarte_nrfx_data *data = dev->data; + if (config->flags & UARTE_CFG_FLAG_VOLATILE_BAUDRATE) { + struct uarte_nrfx_data *data = dev->data; - data->nrf_baudrate = nrf_baudrate; + data->nrf_baudrate = nrf_baudrate; + } else { + nrf_uarte_baudrate_set(get_uarte_instance(dev), nrf_baudrate); + } #else nrf_uarte_baudrate_set(get_uarte_instance(dev), nrf_baudrate); #endif @@ -792,9 +873,11 @@ static void uarte_periph_enable(const struct device *dev) } #endif #if UARTE_BAUDRATE_RETENTION_WORKAROUND - nrf_uarte_baudrate_set(uarte, - COND_CODE_1(CONFIG_UART_USE_RUNTIME_CONFIGURE, - (data->nrf_baudrate), (config->nrf_baudrate))); + if (config->flags & UARTE_CFG_FLAG_VOLATILE_BAUDRATE) { + nrf_uarte_baudrate_set(uarte, + COND_CODE_1(CONFIG_UART_USE_RUNTIME_CONFIGURE, + (data->nrf_baudrate), (config->nrf_baudrate))); + } #endif #ifdef UARTE_ANY_ASYNC @@ -894,13 +977,17 @@ static void rx_buf_release(const struct device *dev, uint8_t *buf) user_callback(dev, &evt); } -static void notify_rx_disable(const struct device *dev) +static void rx_disable_finalize(const struct device *dev) { const struct uarte_nrfx_config *cfg = dev->config; + struct uarte_nrfx_data *data = dev->data; + struct uarte_async_rx *async_rx = &data->async->rx; struct uart_event evt = { .type = UART_RX_DISABLED, }; + async_rx->enabled = false; + if (LOW_POWER_ENABLED(cfg)) { uint32_t key = irq_lock(); @@ -918,28 +1005,42 @@ static void notify_rx_disable(const struct device *dev) } } -static int uarte_nrfx_rx_disable(const struct device *dev) +static int rx_disable(const struct device *dev, bool api) { struct uarte_nrfx_data *data = dev->data; struct uarte_async_rx *async_rx = &data->async->rx; NRF_UARTE_Type *uarte = get_uarte_instance(dev); int key; - if (async_rx->buf == NULL) { - return -EFAULT; - } - k_timer_stop(&async_rx->timer); key = irq_lock(); +#ifdef CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER + const struct uarte_nrfx_config *cfg = dev->config; + struct uarte_async_rx_cbwt *cbwt_data = cfg->cbwt_data; + + if (cbwt_data) { + nrf_timer_event_clear(cfg->timer_regs, + nrf_timer_compare_event_get(UARTE_TIMER_BUF_SWITCH_CH)); + nrf_timer_event_clear(cfg->timer_regs, + nrf_timer_compare_event_get(UARTE_TIMER_USR_CNT_CH)); + nrf_timer_int_disable(cfg->timer_regs, + nrf_timer_compare_int_get(UARTE_TIMER_BUF_SWITCH_CH) | + nrf_timer_compare_int_get(UARTE_TIMER_USR_CNT_CH)); + nrf_uarte_shorts_disable(cfg->uarte_regs, NRF_UARTE_SHORT_ENDRX_STARTRX); + } +#endif + if (async_rx->next_buf != NULL) { nrf_uarte_shorts_disable(uarte, NRF_UARTE_SHORT_ENDRX_STARTRX); nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_RXSTARTED); } async_rx->enabled = false; - async_rx->discard_fifo = true; + if (api) { + async_rx->discard_fifo = true; + } nrf_uarte_task_trigger(uarte, NRF_UARTE_TASK_STOPRX); irq_unlock(key); @@ -947,6 +1048,18 @@ static int uarte_nrfx_rx_disable(const struct device *dev) return 0; } +static int uarte_nrfx_rx_disable(const struct device *dev) +{ + struct uarte_nrfx_data *data = dev->data; + struct uarte_async_rx *async_rx = &data->async->rx; + + if (async_rx->buf == NULL) { + return -EFAULT; + } + + return rx_disable(dev, true); +} + #if !defined(CONFIG_UART_NRFX_UARTE_ENHANCED_RX) static void timer_handler(nrf_timer_event_t event_type, void *p_context) { } @@ -971,10 +1084,10 @@ static int uarte_nrfx_rx_counting_init(const struct device *dev) if (ret != NRFX_SUCCESS) { LOG_ERR("Timer already initialized"); return -EINVAL; - } else { - nrfx_timer_clear(&cfg->timer); } + nrfx_timer_clear(&cfg->timer); + ret = nrfx_gppi_channel_alloc(&data->async->rx.cnt.ppi); if (ret != NRFX_SUCCESS) { LOG_ERR("Failed to allocate PPI Channel"); @@ -992,6 +1105,653 @@ static int uarte_nrfx_rx_counting_init(const struct device *dev) } #endif /* !defined(CONFIG_UART_NRFX_UARTE_ENHANCED_RX) */ +#ifdef CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER + +static uint32_t get_byte_cnt(NRF_TIMER_Type *timer) +{ + nrf_timer_task_trigger(timer, nrf_timer_capture_task_get(UARTE_TIMER_CAPTURE_CH)); + + nrf_barrier_w(); + + return nrf_timer_cc_get(timer, UARTE_TIMER_CAPTURE_CH); +} + +static void rx_buf_req(const struct device *dev) +{ + struct uart_event evt = { + .type = UART_RX_BUF_REQUEST, + }; + + user_callback(dev, &evt); +} + +static bool notify_rx_rdy(const struct device *dev) +{ + const struct uarte_nrfx_config *cfg = dev->config; + struct uarte_nrfx_data *data = dev->data; + struct uarte_async_rx *async_rx = &data->async->rx; + struct uarte_async_rx_cbwt *cbwt_data = cfg->cbwt_data; + size_t len = cbwt_data->usr_wr_off - cbwt_data->usr_rd_off; + + if (len == 0) { + return async_rx->buf != NULL; + } + + struct uart_event evt = { + .type = UART_RX_RDY, + .data.rx.buf = async_rx->buf, + .data.rx.len = len, + .data.rx.offset = cbwt_data->usr_rd_off + }; + user_callback(dev, &evt); + cbwt_data->usr_rd_off += len; + + if (cbwt_data->usr_rd_off == async_rx->buf_len) { + rx_buf_release(dev, async_rx->buf); + async_rx->buf = async_rx->next_buf; + async_rx->buf_len = async_rx->next_buf_len; + async_rx->next_buf_len = 0; + async_rx->next_buf = 0; + cbwt_data->usr_rd_off = 0; + cbwt_data->usr_wr_off = 0; + + if (async_rx->buf_len == 0) { + return false; + } + + /* Set past value to ensure that event will not expire after clearing but + * before setting the new value. + */ + nrf_timer_cc_set(cfg->timer_regs, UARTE_TIMER_USR_CNT_CH, cbwt_data->cc_usr - 1); + nrf_timer_event_clear(cfg->timer_regs, + nrf_timer_compare_event_get(UARTE_TIMER_USR_CNT_CH)); + cbwt_data->cc_usr += async_rx->buf_len; + nrf_timer_cc_set(cfg->timer_regs, UARTE_TIMER_USR_CNT_CH, cbwt_data->cc_usr); + + /* Check if CC is already in the past. In that case trigger CC handling.*/ + if (cbwt_data->cc_usr <= get_byte_cnt(cfg->timer_regs)) { + atomic_or(&data->flags, UARTE_FLAG_LATE_CC); + NRFX_IRQ_PENDING_SET(cfg->timer_irqn); + } else { + atomic_and(&data->flags, ~UARTE_FLAG_LATE_CC); + } + } + + return true; +} + +static void anomaly_byte_handle(const struct device *dev) +{ + const struct uarte_nrfx_config *cfg = dev->config; + struct uarte_async_rx_cbwt *cbwt_data = cfg->cbwt_data; + uint8_t curr_byte, anomaly_byte; + uint32_t diff; + + if (cbwt_data->anomaly_byte_addr == NULL) { + return; + } + + diff = cfg->uarte_regs->DMA.RX.PTR - (uint32_t)cbwt_data->curr_bounce_buf; + /* Anomaly can be checked only if more than 1 byte is received to the current buffer. */ + if (diff < 2) { + return; + } + + if (IS_ENABLED(UARTE_ANY_CACHE) && (cfg->flags & UARTE_CFG_FLAG_CACHEABLE)) { + sys_cache_data_invd_range(cbwt_data->curr_bounce_buf, 1); + sys_cache_data_invd_range(cbwt_data->anomaly_byte_addr, 1); + } + + curr_byte = cbwt_data->curr_bounce_buf[0]; + anomaly_byte = *cbwt_data->anomaly_byte_addr; + if ((curr_byte == UARTE_MAGIC_BYTE) && (anomaly_byte != UARTE_MAGIC_BYTE)) { +#ifdef UARTE_ANY_CACHE + if (cfg->flags & UARTE_CFG_FLAG_CACHEABLE) { + /* We cannot write directly to curr_bounce_buf as it is written by + * DMA and with cache operations data may be overwritten. Copying + * need to be postponed to the moment when user buffer is filled. + */ + cbwt_data->anomaly_byte = anomaly_byte; + cbwt_data->anomaly_byte_dst = &cbwt_data->curr_bounce_buf[0]; + } else { + cbwt_data->curr_bounce_buf[0] = anomaly_byte; + } +#else + cbwt_data->curr_bounce_buf[0] = anomaly_byte; +#endif + } + + cbwt_data->anomaly_byte_addr = NULL; +} + +static uint32_t fill_usr_buf(const struct device *dev, uint32_t len) +{ + const struct uarte_nrfx_config *cfg = dev->config; + struct uarte_nrfx_data *data = dev->data; + struct uarte_async_rx *async_rx = &data->async->rx; + struct uarte_async_rx_cbwt *cbwt_data = cfg->cbwt_data; + + uint8_t *buf = cfg->bounce_buf[cbwt_data->bounce_idx]; + uint32_t usr_rem = async_rx->buf_len - cbwt_data->usr_wr_off; + uint32_t bounce_rem = cbwt_data->bounce_limit - cbwt_data->bounce_off; + uint32_t cpy_len = MIN(bounce_rem, MIN(usr_rem, len)); + + __ASSERT(cpy_len + cbwt_data->bounce_off <= cfg->bounce_buf_len, + "Exceeding the buffer cpy_len:%d off:%d limit:%d", + cpy_len, cbwt_data->bounce_off, cbwt_data->bounce_limit); + + if (IS_ENABLED(UARTE_ANY_CACHE) && (cfg->flags & UARTE_CFG_FLAG_CACHEABLE)) { + sys_cache_data_invd_range(&buf[cbwt_data->bounce_off], cpy_len); + } + + memcpy(&async_rx->buf[cbwt_data->usr_wr_off], &buf[cbwt_data->bounce_off], cpy_len); +#ifdef UARTE_ANY_CACHE + if ((buf == cbwt_data->anomaly_byte_dst) && (cbwt_data->bounce_off == 0)) { + async_rx->buf[cbwt_data->usr_wr_off] = cbwt_data->anomaly_byte; + cbwt_data->anomaly_byte_dst = NULL; + } +#endif + cbwt_data->bounce_off += cpy_len; + cbwt_data->usr_wr_off += cpy_len; + cbwt_data->last_cnt += cpy_len; + if (cbwt_data->bounce_off == cbwt_data->bounce_limit) { + /* Bounce buffer drained */ + cbwt_data->bounce_idx = cbwt_data->bounce_idx == 0 ? 1 : 0; + cbwt_data->bounce_off = 0; + cbwt_data->bounce_limit = cfg->bounce_buf_len; + } + + return cpy_len; +} + +static bool update_usr_buf(const struct device *dev, uint32_t len, bool notify_any, bool buf_req) +{ + const struct uarte_nrfx_config *cfg = dev->config; + struct uarte_nrfx_data *data = dev->data; + struct uarte_async_rx *async_rx = &data->async->rx; + struct uarte_async_rx_cbwt *cbwt_data = cfg->cbwt_data; + + anomaly_byte_handle(dev); + + do { + uint32_t cpy_len = len ? fill_usr_buf(dev, len) : 0; + bool usr_buf_full = cbwt_data->usr_wr_off == async_rx->buf_len; + + len -= cpy_len; + if (((len == 0) && notify_any) || usr_buf_full) { + if (!notify_rx_rdy(dev)) { + return false; + } + + if (usr_buf_full && buf_req) { + rx_buf_req(dev); + } + } + } while (len > 0); + + return true; +} + +static void prepare_bounce_buf(const struct device *dev, uint8_t *buf, + size_t swap_len, size_t len) +{ + const struct uarte_nrfx_config *cfg = dev->config; + + buf[0] = UARTE_MAGIC_BYTE; + for (size_t i = swap_len; i < len; i++) { + buf[i] = UARTE_MAGIC_BYTE; + } + + if (IS_ENABLED(UARTE_ANY_CACHE) && (cfg->flags & UARTE_CFG_FLAG_CACHEABLE)) { + sys_cache_data_flush_range(buf, 1); + sys_cache_data_flush_range(&buf[swap_len], len); + } +} + +/* This function is responsible for swapping the bounce buffer and it is the most + * tricky part of the solution. Receiver is continuously working and we want to + * change DMA pointer on the fly. DMA is also incrementing that pointer so there are + * moments in the reception when updating the pointer will result in different behavior. + * + * There are two main cases that need to be handled: + * 1. PTR is updated and there was no byte boundary (in the middle of a byte or there is + * no byte on the line). It is a safe spot. + * + * The most common and simplest case. PTR is update but since + * DMA already started the reception of the previous byte it means that next byte will + * be stored in the previous PTR and bytes following that byte will be stored to the + * new bounce buffer + * + * 2. Updating the pointer collided with byte boundary. + * + * RXDRDY and RXSTARTED events are used to detect if collision occurred. + * There are few scenarios that may happen and the driver must detect which one occurred. + * Detection is done by reading back the PTR register. Following cases are considered: + * + * - PTR did not change. It means that it was written after byte boundary. It is the same + * case as if PTR was updated in the safe spot. + * + * - PTR is updated by 1. There is an anomaly and it is unclear where next byte will be + * copied. PTR state indicates that it should be copied to the beginning of the new + * bounce buffer but it might be copied to the previous bounce buffer. Both locations + * are written with a magic byte (0xAA) and later on it is checked which location has + * changed and if byte was written to the previous bounce buffer it is copied to the + * start of the new bounce buffer. + * + * - PTR is not updated with the new bounce buffer location. DMA is incrementing PTR content + * and it is possible that SW writes new value between read and modify and DMA may + * overwrite value written by the driver. In that case reception continuous to the + * previous bounce buffer and swap procedure need to be repeated. + */ +static int bounce_buf_swap(const struct device *dev, uint8_t *prev_bounce_buf) +{ + const struct uarte_nrfx_config *cfg = dev->config; + struct uarte_async_rx_cbwt *cbwt_data = cfg->cbwt_data; + uint32_t prev_buf_cnt, new_cnt, cnt, ptr; + uint32_t prev_buf_inc = 1; + int key; + + key = irq_lock(); + /* Clear events that indicates byte boundary and set PTR. If events are set + * after PTR is set then we know that setting PTR collided with byte boundary. + */ + nrf_uarte_event_clear(cfg->uarte_regs, NRF_UARTE_EVENT_RXSTARTED); + nrf_uarte_event_clear(cfg->uarte_regs, NRF_UARTE_EVENT_RXDRDY); + cfg->uarte_regs->DMA.RX.PTR = (uint32_t)cbwt_data->curr_bounce_buf; + cnt = get_byte_cnt(cfg->timer_regs); + + if (!nrf_uarte_event_check(cfg->uarte_regs, NRF_UARTE_EVENT_RXDRDY) && + !nrf_uarte_event_check(cfg->uarte_regs, NRF_UARTE_EVENT_RXSTARTED)) { + /* RXDRDY did not happen when PTR was set. Safest case. PTR was updated + * correctly. Last byte will be received to the previous buffer. + */ + new_cnt = 0; + prev_buf_cnt = cnt - cbwt_data->last_cnt; + goto no_collision; + } + + /* Setting PTR collided with byte boundary we need to detect what happened. */ + while (!nrf_uarte_event_check(cfg->uarte_regs, NRF_UARTE_EVENT_RXSTARTED)) { + } + + /* Read pointer when there is no new byte coming. */ + do { + cnt = get_byte_cnt(cfg->timer_regs); + ptr = cfg->uarte_regs->DMA.RX.PTR; + } while (cnt != get_byte_cnt(cfg->timer_regs)); + + new_cnt = ptr - (uint32_t)cbwt_data->curr_bounce_buf; + prev_buf_cnt = cnt - cbwt_data->last_cnt; + + if (new_cnt == 0) { + /* New PTR is not incremented. It was written after LIST post ENDRX + * incrementation. + */ + } else if (new_cnt == 1) { + /* new_cnt == 1. New PTR incremented. It's possible that data is already + * copied to that new location or it is written to the tail of the previous + * bounce buffer. We try to detect what happens. + */ + prev_buf_inc = 0; + cbwt_data->anomaly_byte_addr = + &prev_bounce_buf[cbwt_data->bounce_off + prev_buf_cnt]; + } else if (new_cnt <= cfg->bounce_buf_len) { + prev_buf_inc = 0; + prev_buf_cnt = cnt - cbwt_data->last_cnt - (new_cnt - 1); + } else { + /* New PTR value is not set. Re-set PTR is needed. Transfer continues to + * previous buffer whole buffer swapping need to be repeat. + */ + irq_unlock(key); + return -EAGAIN; + } + +no_collision: + cbwt_data->bounce_limit = cbwt_data->bounce_off + prev_buf_cnt + prev_buf_inc; + __ASSERT(cbwt_data->bounce_limit < cfg->bounce_buf_len, + "Too high limit (%d, max:%d), increase latency", + cbwt_data->bounce_limit, cfg->bounce_buf_len); + irq_unlock(key); + + return prev_buf_cnt; +} + +static size_t get_swap_len(const struct device *dev) +{ + const struct uarte_nrfx_config *cfg = dev->config; +#ifdef CONFIG_UART_USE_RUNTIME_CONFIGURE + struct uarte_async_rx_cbwt *cbwt_data = cfg->cbwt_data; + + return cbwt_data->bounce_buf_swap_len; +#else + return cfg->bounce_buf_swap_len; +#endif +} + +static void bounce_buf_switch(const struct device *dev) +{ + const struct uarte_nrfx_config *cfg = dev->config; + struct uarte_async_rx_cbwt *cbwt_data = cfg->cbwt_data; + int new_data = cbwt_data->cc_swap - cbwt_data->last_cnt; + uint8_t *prev_bounce_buf = cbwt_data->curr_bounce_buf; + int prev_cnt; + + /* Fill user buffer with all pending data. */ + if (!update_usr_buf(dev, new_data < 0 ? 0 : new_data, false, true)) { + rx_disable(dev, false); + return; + } + + cbwt_data->curr_bounce_buf = (cbwt_data->curr_bounce_buf == cfg->bounce_buf[0]) ? + cfg->bounce_buf[1] : cfg->bounce_buf[0]; + prepare_bounce_buf(dev, cbwt_data->curr_bounce_buf, get_swap_len(dev), + cfg->bounce_buf_len); + + /* Swapping may need retry. */ + while ((prev_cnt = bounce_buf_swap(dev, prev_bounce_buf)) < 0) { + } + + /* Update user buffer with data that was received during swapping. */ + if (update_usr_buf(dev, prev_cnt, false, true)) { + /* Set compare event for next moment when bounce buffers need to be swapped. */ + cbwt_data->cc_swap += get_swap_len(dev); + __ASSERT(cbwt_data->cc_swap > get_byte_cnt(cfg->timer_regs), + "Setting CC too late next:%d cnt:%d", + cbwt_data->cc_swap, get_byte_cnt(cfg->timer_regs)); + nrf_timer_cc_set(cfg->timer_regs, UARTE_TIMER_BUF_SWITCH_CH, cbwt_data->cc_swap); + } else { + /* Stop RX. */ + rx_disable(dev, false); + } +} + +static void usr_buf_complete(const struct device *dev) +{ + const struct uarte_nrfx_config *cfg = dev->config; + struct uarte_nrfx_data *data = dev->data; + struct uarte_async_rx *async_rx = &data->async->rx; + struct uarte_async_rx_cbwt *cbwt_data = cfg->cbwt_data; + uint32_t rem = async_rx->buf_len - cbwt_data->usr_wr_off; + + __ASSERT_NO_MSG(rem <= (get_byte_cnt(cfg->timer_regs) - cbwt_data->last_cnt)); + + if (!update_usr_buf(dev, rem, true, true)) { + /* Stop RX if there is no next buffer. */ + rx_disable(dev, false); + } +} + +static void notify_new_data(const struct device *dev, bool buf_req) +{ + const struct uarte_nrfx_config *cfg = dev->config; + struct uarte_async_rx_cbwt *cbwt_data = cfg->cbwt_data; + uint32_t cnt = get_byte_cnt(cfg->timer_regs); + uint32_t new_data = cnt - cbwt_data->last_cnt; + + (void)update_usr_buf(dev, new_data, true, buf_req); +} + +static void cbwt_rx_timeout(struct k_timer *timer) +{ + const struct device *dev = k_timer_user_data_get(timer); + const struct uarte_nrfx_config *cfg = dev->config; + struct uarte_nrfx_data *data = dev->data; + struct uarte_async_rx_cbwt *cbwt_data = cfg->cbwt_data; + struct uarte_async_rx *async_rx = &data->async->rx; + + if (nrf_uarte_event_check(cfg->uarte_regs, NRF_UARTE_EVENT_RXDRDY)) { + nrf_uarte_event_clear(cfg->uarte_regs, NRF_UARTE_EVENT_RXDRDY); + async_rx->idle_cnt = 0; + } else { + async_rx->idle_cnt++; + if (async_rx->idle_cnt == (RX_TIMEOUT_DIV - 1)) { + if (cfg->flags & UARTE_CFG_FLAG_VAR_IRQ) { + if (cbwt_data->in_irq) { + /* TIMER or UARTE interrupt preempted. Lets try again + * later. + */ + k_timer_start(timer, async_rx->timeout, K_NO_WAIT); + return; + } + irq_disable(cfg->uarte_irqn); + irq_disable(cfg->timer_irqn); + } + + nrf_uarte_int_enable(cfg->uarte_regs, NRF_UARTE_INT_RXDRDY_MASK); + notify_new_data(dev, true); + + if (cfg->flags & UARTE_CFG_FLAG_VAR_IRQ) { + irq_enable(cfg->uarte_irqn); + irq_enable(cfg->timer_irqn); + } + return; + } + } + + k_timer_start(timer, async_rx->timeout, K_NO_WAIT); +} + +static void cbwt_rx_flush_handle(const struct device *dev) +{ + const struct uarte_nrfx_config *cfg = dev->config; + NRF_UARTE_Type *uarte = get_uarte_instance(dev); + struct uarte_async_rx_cbwt *cbwt_data = cfg->cbwt_data; + uint32_t rem_data = get_byte_cnt(cfg->timer_regs) - cbwt_data->last_cnt; + uint32_t bbuf_rem_data = cbwt_data->bounce_limit - cbwt_data->bounce_off; + uint32_t amount; + uint8_t *dst; + + nrf_uarte_rx_buffer_set(uarte, cfg->rx_flush_buf, UARTE_HW_RX_FIFO_SIZE); + nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_RXSTARTED); + nrf_uarte_task_trigger(uarte, NRF_UARTE_TASK_FLUSHRX); + while (!nrf_uarte_event_check(uarte, NRF_UARTE_EVENT_ENDRX)) { + /* empty */ + } + + nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_ENDRX); + if (!nrf_uarte_event_check(uarte, NRF_UARTE_EVENT_RXSTARTED)) { + /* FIFO is empty. */ + return; + } + + nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_RXSTARTED); + amount = nrf_uarte_rx_amount_get(uarte); + + if (rem_data <= bbuf_rem_data) { + /* instead of -1 it should be -amount but RXDRDY event is not generated + * for bytes following first that goes to FIFO they are generated during flushing. + */ + dst = &cfg->bounce_buf[cbwt_data->bounce_idx][cbwt_data->bounce_off + rem_data - 1]; + } else { + /* See comment in if clause. */ + dst = &cbwt_data->curr_bounce_buf[rem_data - bbuf_rem_data - 1]; + } + + if (IS_ENABLED(UARTE_ANY_CACHE) && (cfg->flags & UARTE_CFG_FLAG_CACHEABLE)) { + sys_cache_data_invd_range(cfg->rx_flush_buf, amount); + sys_cache_data_invd_range(dst, amount); + } + + memcpy(dst, cfg->rx_flush_buf, amount); +} + +static void cbwt_rxto_isr(const struct device *dev, bool do_flush) +{ + const struct uarte_nrfx_config *cfg = dev->config; + struct uarte_nrfx_data *data = dev->data; + struct uarte_async_rx *async_rx = &data->async->rx; + struct uarte_async_rx_cbwt *cbwt_data = cfg->cbwt_data; + + if (async_rx->buf) { + notify_new_data(dev, false); + } + + if (async_rx->buf) { + rx_buf_release(dev, async_rx->buf); + async_rx->buf = NULL; + } + + if (async_rx->next_buf) { + rx_buf_release(dev, async_rx->next_buf); + async_rx->next_buf = NULL; + } + + if (do_flush) { + cbwt_rx_flush_handle(dev); + } + + if (async_rx->discard_fifo) { + cbwt_data->discard_fifo = async_rx->discard_fifo; + async_rx->discard_fifo = false; + } + nrf_timer_task_trigger(cfg->timer_regs, NRF_TIMER_TASK_STOP); + rx_disable_finalize(dev); +} + +static bool timer_ch_evt_check_clear(NRF_TIMER_Type *timer, uint32_t ch) +{ + nrf_timer_event_t evt = nrf_timer_compare_event_get(ch); + + if (nrf_timer_event_check(timer, evt)) { + nrf_timer_event_clear(timer, evt); + return true; + } + + return false; +} + +static void timer_isr(const void *arg) +{ + const struct device *dev = arg; + const struct uarte_nrfx_config *cfg = dev->config; + struct uarte_nrfx_data *data = dev->data; + struct uarte_async_rx_cbwt *cbwt_data = cfg->cbwt_data; + static const uint32_t flags_to_check = UARTE_FLAG_RX_BUF_REQ | + UARTE_FLAG_TRIG_RXTO | + UARTE_FLAG_LATE_CC; + uint32_t flags = atomic_and(&data->flags, ~flags_to_check); + + cbwt_data->in_irq = true; + + if (timer_ch_evt_check_clear(cfg->timer_regs, UARTE_TIMER_USR_CNT_CH) || + (flags & UARTE_FLAG_LATE_CC)) { + usr_buf_complete(dev); + } + + /* Must be after user buf complet CC handling. */ + if (timer_ch_evt_check_clear(cfg->timer_regs, UARTE_TIMER_BUF_SWITCH_CH)) { + bounce_buf_switch(dev); + } + + if (flags & UARTE_FLAG_RX_BUF_REQ) { + rx_buf_req(dev); + } + + if (flags & UARTE_FLAG_TRIG_RXTO) { + cbwt_rxto_isr(dev, false); + } + + cbwt_data->in_irq = false; +} + +static void cbwt_rx_enable(const struct device *dev, bool with_timeout) +{ + const struct uarte_nrfx_config *cfg = dev->config; + struct uarte_nrfx_data *data = dev->data; + struct uarte_async_rx *async_rx = &data->async->rx; + struct uarte_async_rx_cbwt *cbwt_data = cfg->cbwt_data; + uint32_t rem_data; + uint32_t len = async_rx->buf_len; + uint32_t rx_int_mask = NRF_UARTE_INT_RXTO_MASK | + (with_timeout ? NRF_UARTE_INT_RXDRDY_MASK : 0); + + if (cbwt_data->discard_fifo) { + rem_data = 0; + cbwt_data->discard_fifo = false; + } else { + rem_data = get_byte_cnt(cfg->timer_regs) - cbwt_data->last_cnt; + } + + cbwt_data->usr_rd_off = 0; + cbwt_data->usr_wr_off = 0; + + if (rem_data >= len) { + atomic_or(&data->flags, UARTE_FLAG_TRIG_RXTO); + NRFX_IRQ_PENDING_SET(cfg->timer_irqn); + return; + } else if (rem_data) { + (void)update_usr_buf(dev, rem_data, false, true); + len -= rem_data; + } + + prepare_bounce_buf(dev, cfg->bounce_buf[0], get_swap_len(dev), cfg->bounce_buf_len); + + cbwt_data->last_cnt = 0; + cbwt_data->bounce_off = 0; + cbwt_data->bounce_idx = 0; + cbwt_data->curr_bounce_buf = cfg->bounce_buf[0]; + cbwt_data->bounce_limit = cfg->bounce_buf_len; + /* Enable ArrayList. */ + nrf_uarte_shorts_enable(cfg->uarte_regs, NRF_UARTE_SHORT_ENDRX_STARTRX); + nrf_uarte_event_clear(cfg->uarte_regs, NRF_UARTE_EVENT_RXDRDY); + nrf_uarte_int_enable(cfg->uarte_regs, rx_int_mask); + nrf_uarte_rx_buffer_set(cfg->uarte_regs, cbwt_data->curr_bounce_buf, 1); + + nrf_timer_event_clear(cfg->timer_regs, + nrf_timer_compare_event_get(UARTE_TIMER_BUF_SWITCH_CH)); + nrf_timer_event_clear(cfg->timer_regs, + nrf_timer_compare_event_get(UARTE_TIMER_USR_CNT_CH)); + nrf_timer_int_enable(cfg->timer_regs, + nrf_timer_compare_int_get(UARTE_TIMER_BUF_SWITCH_CH) | + nrf_timer_compare_int_get(UARTE_TIMER_USR_CNT_CH)); + nrf_timer_task_trigger(cfg->timer_regs, NRF_TIMER_TASK_CLEAR); + nrf_timer_task_trigger(cfg->timer_regs, NRF_TIMER_TASK_START); + cbwt_data->cc_usr = len; + cbwt_data->cc_swap = get_swap_len(dev); + nrf_timer_cc_set(cfg->timer_regs, UARTE_TIMER_BUF_SWITCH_CH, get_swap_len(dev)); + nrf_timer_cc_set(cfg->timer_regs, UARTE_TIMER_USR_CNT_CH, len); + + atomic_or(&data->flags, UARTE_FLAG_RX_BUF_REQ); + nrf_uarte_task_trigger(cfg->uarte_regs, NRF_UARTE_TASK_STARTRX); + NRFX_IRQ_PENDING_SET(cfg->timer_irqn); +} + +static int cbwt_uarte_async_init(const struct device *dev) +{ + /* As this approach does not use nrfx_timer driver but only HAL special setup + * function is used. + */ + const struct uarte_nrfx_config *cfg = dev->config; + struct uarte_async_rx_cbwt *cbwt_data = cfg->cbwt_data; + static const uint32_t rx_int_mask = NRF_UARTE_INT_ERROR_MASK | + NRF_UARTE_INT_RXTO_MASK; + uint32_t evt = nrf_uarte_event_address_get(cfg->uarte_regs, NRF_UARTE_EVENT_RXDRDY); + uint32_t tsk = nrf_timer_task_address_get(cfg->timer_regs, NRF_TIMER_TASK_COUNT); + nrfx_err_t ret; + + nrf_timer_mode_set(cfg->timer_regs, NRF_TIMER_MODE_COUNTER); + nrf_timer_bit_width_set(cfg->timer_regs, NRF_TIMER_BIT_WIDTH_32); + + ret = nrfx_gppi_channel_alloc(&cbwt_data->ppi_ch); + if (ret != NRFX_SUCCESS) { + return -ENOMEM; + } + + nrfx_gppi_channel_endpoints_setup(cbwt_data->ppi_ch, evt, tsk); + nrfx_gppi_channels_enable(BIT(cbwt_data->ppi_ch)); + +#ifdef CONFIG_UART_USE_RUNTIME_CONFIGURE + cbwt_data->bounce_buf_swap_len = cfg->bounce_buf_swap_len; +#endif + + /* Enable EasyDMA LIST feature (it is exposed in SPIM but not in UARTE). */ + *(volatile uint32_t *)((uint32_t)cfg->uarte_regs + 0x714) = 1; + nrf_uarte_int_enable(cfg->uarte_regs, rx_int_mask); + + return 0; +} +#endif /* CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER */ + static int uarte_async_init(const struct device *dev) { struct uarte_nrfx_data *data = dev->data; @@ -1004,6 +1764,17 @@ static int uarte_async_init(const struct device *dev) ((IS_ENABLED(CONFIG_UART_NRFX_UARTE_ENHANCED_RX) && !IS_ENABLED(UARTE_HAS_FRAME_TIMEOUT)) ? NRF_UARTE_INT_RXDRDY_MASK : 0); + k_timer_init(&data->async->rx.timer, rx_timeout, NULL); + k_timer_user_data_set(&data->async->rx.timer, (void *)dev); + k_timer_init(&data->async->tx.timer, tx_timeout, NULL); + k_timer_user_data_set(&data->async->tx.timer, (void *)dev); + +#ifdef CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER + if (IS_CBWT(dev)) { + return cbwt_uarte_async_init(dev); + } +#endif + #if !defined(CONFIG_UART_NRFX_UARTE_ENHANCED_RX) int ret = uarte_nrfx_rx_counting_init(dev); @@ -1014,11 +1785,6 @@ static int uarte_async_init(const struct device *dev) nrf_uarte_int_enable(uarte, rx_int_mask); - k_timer_init(&data->async->rx.timer, rx_timeout, NULL); - k_timer_user_data_set(&data->async->rx.timer, (void *)dev); - k_timer_init(&data->async->tx.timer, tx_timeout, NULL); - k_timer_user_data_set(&data->async->tx.timer, (void *)dev); - return 0; } @@ -1167,6 +1933,7 @@ static uint32_t us_to_bauds(uint32_t baudrate, int32_t timeout) } #endif + static int uarte_nrfx_rx_enable(const struct device *dev, uint8_t *buf, size_t len, int32_t timeout) @@ -1176,6 +1943,11 @@ static int uarte_nrfx_rx_enable(const struct device *dev, uint8_t *buf, const struct uarte_nrfx_config *cfg = dev->config; NRF_UARTE_Type *uarte = get_uarte_instance(dev); +#if defined(CONFIG_UART_NRFX_UARTE_ENHANCED_RX) || \ + defined(CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER) + bool with_timeout = timeout != SYS_FOREVER_US; +#endif + if (cfg->disable_rx) { __ASSERT(false, "TX only UARTE instance"); return -ENOTSUP; @@ -1190,35 +1962,45 @@ static int uarte_nrfx_rx_enable(const struct device *dev, uint8_t *buf, } #ifdef CONFIG_HAS_NORDIC_DMM - uint8_t *dma_buf; - int ret = 0; + if (!IS_CBWT(dev)) { + void *dma_buf; + int ret = 0; - ret = dmm_buffer_in_prepare(cfg->mem_reg, buf, len, (void **)&dma_buf); - if (ret < 0) { - return ret; - } + ret = dmm_buffer_in_prepare(cfg->mem_reg, buf, len, &dma_buf); + if (ret < 0) { + return ret; + } - async_rx->usr_buf = buf; - buf = dma_buf; + async_rx->usr_buf = buf; + buf = dma_buf; + } #endif -#ifdef CONFIG_UART_NRFX_UARTE_ENHANCED_RX +#if defined(CONFIG_UART_NRFX_UARTE_ENHANCED_RX) || \ + defined(CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER) + #ifdef UARTE_HAS_FRAME_TIMEOUT - if (timeout != SYS_FOREVER_US) { + if (!IS_CBWT(dev) && with_timeout) { uint32_t baudrate = COND_CODE_1(CONFIG_UART_USE_RUNTIME_CONFIGURE, - (data->uart_config.baudrate), (cfg->baudrate)); - - async_rx->timeout = K_USEC(timeout); + (data->uart_config.baudrate), (cfg->baudrate)); nrf_uarte_frame_timeout_set(uarte, us_to_bauds(baudrate, timeout)); nrf_uarte_shorts_enable(uarte, NRF_UARTE_SHORT_FRAME_TIMEOUT_STOPRX); + } +#endif +#if !defined(UARTE_HAS_FRAME_TIMEOUT) || defined(CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER) + async_rx->idle_cnt = 0; +#endif + + if (with_timeout) { + if (!IS_CBWT(dev) && IS_ENABLED(UARTE_HAS_FRAME_TIMEOUT)) { + async_rx->timeout = K_USEC(timeout); + } else { + async_rx->timeout = with_timeout ? + K_USEC(timeout / RX_TIMEOUT_DIV) : K_NO_WAIT; + } } else { async_rx->timeout = K_NO_WAIT; } -#else - async_rx->timeout = (timeout == SYS_FOREVER_US) ? - K_NO_WAIT : K_USEC(timeout / RX_TIMEOUT_DIV); - async_rx->idle_cnt = 0; -#endif /* UARTE_HAS_FRAME_TIMEOUT */ #else async_rx->timeout_us = timeout; async_rx->timeout_slab = timeout / RX_TIMEOUT_DIV; @@ -1246,8 +2028,20 @@ static int uarte_nrfx_rx_enable(const struct device *dev, uint8_t *buf, } } pm_device_runtime_get(dev); + } else if (LOW_POWER_ENABLED(cfg)) { + unsigned int key = irq_lock(); + + uarte_enable_locked(dev, UARTE_FLAG_LOW_POWER_RX); + irq_unlock(key); } +#ifdef CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER + if (IS_CBWT(dev)) { + cbwt_rx_enable(dev, with_timeout); + return 0; + } +#endif + if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME) || LOW_POWER_ENABLED(cfg)) { if (async_rx->flush_cnt) { int cpy_len = MIN(len, async_rx->flush_cnt); @@ -1284,7 +2078,7 @@ static int uarte_nrfx_rx_enable(const struct device *dev, uint8_t *buf, return 0; } else { #ifdef CONFIG_UART_NRFX_UARTE_ENHANCED_RX - if (!K_TIMEOUT_EQ(async_rx->timeout, K_NO_WAIT)) { + if (with_timeout) { nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_RXDRDY); k_timer_start(&async_rx->timer, async_rx->timeout, K_NO_WAIT); @@ -1309,13 +2103,6 @@ static int uarte_nrfx_rx_enable(const struct device *dev, uint8_t *buf, async_rx->enabled = true; - if (LOW_POWER_ENABLED(cfg)) { - unsigned int key = irq_lock(); - - uarte_enable_locked(dev, UARTE_FLAG_LOW_POWER_RX); - irq_unlock(key); - } - nrf_uarte_task_trigger(uarte, NRF_UARTE_TASK_STARTRX); return 0; @@ -1334,29 +2121,33 @@ static int uarte_nrfx_rx_buf_rsp(const struct device *dev, uint8_t *buf, err = -EACCES; } else if (async_rx->next_buf == NULL) { #ifdef CONFIG_HAS_NORDIC_DMM - uint8_t *dma_buf; - const struct uarte_nrfx_config *config = dev->config; + if (!IS_CBWT(dev)) { + uint8_t *dma_buf; + const struct uarte_nrfx_config *config = dev->config; - err = dmm_buffer_in_prepare(config->mem_reg, buf, len, (void **)&dma_buf); - if (err < 0) { - return err; + err = dmm_buffer_in_prepare(config->mem_reg, buf, len, (void **)&dma_buf); + if (err < 0) { + return err; + } + async_rx->next_usr_buf = buf; + buf = dma_buf; } - async_rx->next_usr_buf = buf; - buf = dma_buf; #endif async_rx->next_buf = buf; async_rx->next_buf_len = len; - nrf_uarte_rx_buffer_set(uarte, buf, len); - /* If buffer is shorter than RX FIFO then there is a risk that due - * to interrupt handling latency ENDRX event is not handled on time - * and due to ENDRX_STARTRX short data will start to be overwritten. - * In that case short is not enabled and ENDRX event handler will - * manually start RX for that buffer. Thanks to RX FIFO there is - * 5 byte time for doing that. If interrupt latency is higher and - * there is no HWFC in both cases data will be lost or corrupted. - */ - if (len >= UARTE_HW_RX_FIFO_SIZE) { - nrf_uarte_shorts_enable(uarte, NRF_UARTE_SHORT_ENDRX_STARTRX); + if (!IS_CBWT(dev)) { + nrf_uarte_rx_buffer_set(uarte, buf, len); + /* If buffer is shorter than RX FIFO then there is a risk that due + * to interrupt handling latency ENDRX event is not handled on time + * and due to ENDRX_STARTRX short data will start to be overwritten. + * In that case short is not enabled and ENDRX event handler will + * manually start RX for that buffer. Thanks to RX FIFO there is + * 5 byte time for doing that. If interrupt latency is higher and + * there is no HWFC in both cases data will be lost or corrupted. + */ + if (len >= UARTE_HW_RX_FIFO_SIZE) { + nrf_uarte_shorts_enable(uarte, NRF_UARTE_SHORT_ENDRX_STARTRX); + } } err = 0; } else { @@ -1406,6 +2197,13 @@ static void rx_timeout(struct k_timer *timer) NRF_UARTE_Type *uarte = get_uarte_instance(dev); #ifdef UARTE_HAS_FRAME_TIMEOUT +#ifdef CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER + if (IS_CBWT(dev)) { + cbwt_rx_timeout(timer); + return; + } +#endif + struct uarte_nrfx_data *data = dev->data; struct uarte_async_rx *async_rx = &data->async->rx; bool rxdrdy = nrf_uarte_event_check(uarte, NRF_UARTE_EVENT_RXDRDY); @@ -1552,7 +2350,7 @@ static void error_isr(const struct device *dev) nrf_uarte_errorsrc_clear(uarte, err); user_callback(dev, &evt); - (void) uarte_nrfx_rx_disable(dev); + (void)rx_disable(dev, false); } static void rxstarted_isr(const struct device *dev) @@ -1771,7 +2569,6 @@ static void rxto_isr(const struct device *dev) * In the second case, additionally, data from the UARTE internal RX * FIFO need to be discarded. */ - async_rx->enabled = false; if (async_rx->discard_fifo) { async_rx->discard_fifo = false; #if !defined(CONFIG_UART_NRFX_UARTE_ENHANCED_RX) @@ -1799,15 +2596,7 @@ static void rxto_isr(const struct device *dev) #endif nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_RXDRDY); #endif - - if (LOW_POWER_ENABLED(config)) { - uint32_t key = irq_lock(); - - uarte_disable_locked(dev, UARTE_FLAG_LOW_POWER_RX); - irq_unlock(key); - } - - notify_rx_disable(dev); + rx_disable_finalize(dev); } static void txstopped_isr(const struct device *dev) @@ -1897,10 +2686,12 @@ static void txstopped_isr(const struct device *dev) static void rxdrdy_isr(const struct device *dev) { -#if !defined(UARTE_HAS_FRAME_TIMEOUT) +#if !defined(UARTE_HAS_FRAME_TIMEOUT) || defined(CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER) struct uarte_nrfx_data *data = dev->data; -#if defined(CONFIG_UART_NRFX_UARTE_ENHANCED_RX) +#if defined(CONFIG_UART_NRFX_UARTE_ENHANCED_RX) || \ + defined(CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER) + NRF_UARTE_Type *uarte = get_uarte_instance(dev); data->async->rx.idle_cnt = 0; @@ -1932,8 +2723,9 @@ static void uarte_nrfx_isr_async(const void *arg) struct uarte_async_rx *async_rx = &data->async->rx; uint32_t imask = nrf_uarte_int_enable_check(uarte, UINT32_MAX); - if (!(HW_RX_COUNTING_ENABLED(config) || IS_ENABLED(UARTE_HAS_FRAME_TIMEOUT)) - && event_check_clear(uarte, NRF_UARTE_EVENT_RXDRDY, NRF_UARTE_INT_RXDRDY_MASK, imask)) { + if ((IS_CBWT(dev) || + !(HW_RX_COUNTING_ENABLED(config) || IS_ENABLED(UARTE_HAS_FRAME_TIMEOUT))) && + event_check_clear(uarte, NRF_UARTE_EVENT_RXDRDY, NRF_UARTE_INT_RXDRDY_MASK, imask)) { rxdrdy_isr(dev); } @@ -1961,6 +2753,12 @@ static void uarte_nrfx_isr_async(const void *arg) rxstarted_isr(dev); } +#ifdef CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER + if (IS_CBWT(dev) && + event_check_clear(uarte, NRF_UARTE_EVENT_RXTO, NRF_UARTE_INT_RXTO_MASK, imask)) { + cbwt_rxto_isr(dev, true); + } else +#endif /* RXTO must be handled after ENDRX which should notify the buffer. * Skip if ENDRX is set when RXTO is set. It means that * ENDRX occurred after check for ENDRX in isr which may happen when @@ -1985,7 +2783,8 @@ static void uarte_nrfx_isr_async(const void *arg) txstopped_isr(dev); } - if (atomic_and(&data->flags, ~UARTE_FLAG_TRIG_RXTO) & UARTE_FLAG_TRIG_RXTO) { + if (!IS_CBWT(dev) && + (atomic_and(&data->flags, ~UARTE_FLAG_TRIG_RXTO) & UARTE_FLAG_TRIG_RXTO)) { #ifdef CONFIG_HAS_NORDIC_DMM int ret; @@ -2000,7 +2799,7 @@ static void uarte_nrfx_isr_async(const void *arg) rx_buf_release(dev, async_rx->buf); async_rx->buf_len = 0; async_rx->buf = NULL; - notify_rx_disable(dev); + rx_disable_finalize(dev); } } @@ -2614,6 +3413,46 @@ static int uarte_instance_init(const struct device *dev, return pm_device_driver_init(dev, uarte_nrfx_pm_action); } + +#define UARTE_TIMER_REG(idx) (NRF_TIMER_Type *)DT_REG_ADDR(DT_PHANDLE(UARTE(idx), timer)) + +#define UARTE_TIMER_IRQN(idx) DT_IRQN(DT_PHANDLE(UARTE(idx), timer)) + +#define UARTE_TIMER_IRQ_PRIO(idx) DT_IRQ(DT_PHANDLE(UARTE(idx), timer), priority) + +#define UARTE_COUNT_BYTES_WITH_TIMER_CONFIG(idx) \ + IF_ENABLED(UARTE_HAS_PROP(idx, timer), \ + (.timer_regs = UARTE_TIMER_REG(idx), \ + .timer_irqn = UARTE_TIMER_IRQN(idx), \ + .uarte_irqn = DT_IRQN(UARTE(idx)), \ + .bounce_buf = { \ + uart##idx##_bounce_buf, \ + &uart##idx##_bounce_buf[sizeof(uart##idx##_bounce_buf) / 2] \ + }, \ + .bounce_buf_len = sizeof(uart##idx##_bounce_buf) / 2, \ + .bounce_buf_swap_len = UARTE_BUF_SWAP_LEN(sizeof(uart##idx##_bounce_buf) / 2,\ + UARTE_US_TO_BYTES(UARTE_PROP(idx, current_speed))), \ + .cbwt_data = &uart##idx##_bounce_data,)) + +#define UARTE_COUNT_BYTES_WITH_TIMER_VALIDATE_CONFIG(idx) \ + __ASSERT_NO_MSG(UARTE_TIMER_IRQ_PRIO(idx) == DT_IRQ(UARTE(idx), priority)) + +#define UARTE_TIMER_IRQ_CONNECT(idx, func) \ + IF_ENABLED(UTIL_AND(IS_ENABLED(CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER), \ + UARTE_HAS_PROP(idx, timer)), \ + (UARTE_COUNT_BYTES_WITH_TIMER_VALIDATE_CONFIG(idx); \ + IRQ_CONNECT(UARTE_TIMER_IRQN(idx), UARTE_TIMER_IRQ_PRIO(idx), func, \ + DEVICE_DT_GET(UARTE(idx)), 0); \ + irq_enable(UARTE_TIMER_IRQN(idx));)) + +/* Macro sets flag to indicate that uart use different interrupt priority than the system clock. */ +#define UARTE_HAS_VAR_PRIO(idx) \ + COND_CODE_1(UTIL_AND(IS_ENABLED(CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER), \ + UARTE_HAS_PROP(idx, timer)), \ + ((DT_IRQ(UARTE(idx), priority) != DT_IRQ(DT_NODELABEL(grtc), priority)) ? \ + UARTE_CFG_FLAG_VAR_IRQ : 0), (0)) + + #define UARTE_GET_ISR(idx) \ COND_CODE_1(CONFIG_UART_##idx##_ASYNC, (uarte_nrfx_isr_async), (uarte_nrfx_isr_int)) @@ -2629,16 +3468,18 @@ static int uarte_instance_init(const struct device *dev, )) /* Depending on configuration standard or direct IRQ is connected. */ -#define UARTE_IRQ_CONNECT(idx, irqn, prio) \ - COND_CODE_1(CONFIG_UART_NRFX_UARTE_NO_IRQ, (), \ - (COND_CODE_1(CONFIG_UART_NRFX_UARTE_DIRECT_ISR, \ - (IRQ_DIRECT_CONNECT(irqn, prio, uarte_##idx##_direct_isr, 0)), \ - (IRQ_CONNECT(irqn, prio, UARTE_GET_ISR(idx), DEVICE_DT_GET(UARTE(idx)), 0))))) +#define UARTE_IRQ_CONNECT(idx, irqn, prio) \ + COND_CODE_1(CONFIG_UART_NRFX_UARTE_NO_IRQ, (), \ + (COND_CODE_1(CONFIG_UART_NRFX_UARTE_DIRECT_ISR, \ + (IRQ_DIRECT_CONNECT(irqn, prio, uarte_##idx##_direct_isr, 0)), \ + (IRQ_CONNECT(irqn, prio, UARTE_GET_ISR(idx), \ + DEVICE_DT_GET(UARTE(idx)), 0))))) #define UARTE_IRQ_CONFIGURE(idx) \ do { \ UARTE_IRQ_CONNECT(idx, DT_IRQN(UARTE(idx)), DT_IRQ(UARTE(idx), priority)); \ irq_enable(DT_IRQN(UARTE(idx))); \ + UARTE_TIMER_IRQ_CONNECT(idx, timer_isr) \ } while (false) /* Low power mode is used when disable_rx is not defined or in async mode if @@ -2729,6 +3570,12 @@ static int uarte_instance_init(const struct device *dev, UARTE_INT_DRIVEN(idx); \ PINCTRL_DT_DEFINE(UARTE(idx)); \ IF_ENABLED(CONFIG_UART_##idx##_ASYNC, ( \ + IF_ENABLED(UTIL_AND(IS_ENABLED(CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER), \ + UARTE_HAS_PROP(idx, timer)), \ + (static uint8_t uart##idx##_bounce_buf[CONFIG_UART_NRFX_UARTE_BOUNCE_BUF_LEN] \ + DMM_MEMORY_SECTION(UARTE(idx)); \ + static struct uarte_async_rx_cbwt uart##idx##_bounce_data; \ + )) \ static uint8_t \ uarte##idx##_tx_cache[CONFIG_UART_ASYNC_TX_CACHE_SIZE] \ DMM_MEMORY_SECTION(UARTE(idx)); \ @@ -2770,6 +3617,10 @@ static int uarte_instance_init(const struct device *dev, (IS_ENABLED(CONFIG_UART_NRFX_UARTE_SPURIOUS_RXTO_WORKAROUND) && \ INSTANCE_IS_HIGH_SPEED(_, /*empty*/, idx, _) ? \ UARTE_CFG_FLAG_SPURIOUS_RXTO : 0) | \ + ((IS_ENABLED(UARTE_BAUDRATE_RETENTION_WORKAROUND) && \ + UARTE_IS_CACHEABLE(idx)) ? \ + UARTE_CFG_FLAG_VOLATILE_BAUDRATE : 0) | \ + UARTE_HAS_VAR_PRIO(idx) | \ USE_LOW_POWER(idx), \ UARTE_DISABLE_RX_INIT(UARTE(idx)), \ .poll_out_byte = &uarte##idx##_poll_out_byte, \ @@ -2777,6 +3628,8 @@ static int uarte_instance_init(const struct device *dev, IF_ENABLED(CONFIG_UART_##idx##_ASYNC, \ (.tx_cache = uarte##idx##_tx_cache, \ .rx_flush_buf = uarte##idx##_flush_buf,)) \ + IF_ENABLED(CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER, \ + (UARTE_COUNT_BYTES_WITH_TIMER_CONFIG(idx))) \ IF_ENABLED(CONFIG_UART_##idx##_NRF_HW_ASYNC, \ (.timer = NRFX_TIMER_INSTANCE( \ CONFIG_UART_##idx##_NRF_HW_ASYNC_TIMER),)) \ @@ -2828,5 +3681,4 @@ static int uarte_instance_init(const struct device *dev, #define COND_UART_NRF_UARTE_DEVICE(unused, prefix, i, _) \ IF_ENABLED(CONFIG_HAS_HW_NRF_UARTE##prefix##i, (UART_NRF_UARTE_DEVICE(prefix##i);)) - UARTE_FOR_EACH_INSTANCE(COND_UART_NRF_UARTE_DEVICE, (), ()) From 8ec7d71d0755163e82eec1b8e88ecd7b2f8fdfc7 Mon Sep 17 00:00:00 2001 From: Bartosz Miller Date: Wed, 23 Jul 2025 14:49:30 +0200 Subject: [PATCH 0387/2141] [nrf fromtree] tests: drivers: flash: Add MSPI flash test in single I/O mode Test external MSPI flash in single I/O mode Signed-off-by: Bartosz Miller (cherry picked from commit b78be6babafa998be2d062d2a2711b39ee3778f6) --- .../common/boards/mx25uw63_single_io.overlay | 62 +++++++++++++++++++ tests/drivers/flash/common/testcase.yaml | 5 ++ 2 files changed, 67 insertions(+) create mode 100644 tests/drivers/flash/common/boards/mx25uw63_single_io.overlay diff --git a/tests/drivers/flash/common/boards/mx25uw63_single_io.overlay b/tests/drivers/flash/common/boards/mx25uw63_single_io.overlay new file mode 100644 index 000000000000..a24ba4e54896 --- /dev/null +++ b/tests/drivers/flash/common/boards/mx25uw63_single_io.overlay @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + + /delete-node/ exmif_default; + /delete-node/ exmif_sleep; + + exmif_default: exmif_default { + group1 { + psels = , + , + , + , + , + , + , + , + , + ; + nordic,drive-mode = ; + }; + }; + + exmif_sleep: exmif_sleep { + group1 { + low-power-enable; + psels = , + , + , + , + , + , + , + , + , + ; + }; + }; + +}; + +&gpio6 { + status = "okay"; +}; + +&exmif { + status = "okay"; + pinctrl-0 = <&exmif_default>; + pinctrl-1 = <&exmif_sleep>; + pinctrl-names = "default", "sleep"; + ce-gpios = <&gpio6 3 GPIO_ACTIVE_LOW>; +}; + +&mx25uw63 { + status = "okay"; + mspi-max-frequency = ; + mspi-io-mode = "MSPI_IO_MODE_SINGLE"; +}; diff --git a/tests/drivers/flash/common/testcase.yaml b/tests/drivers/flash/common/testcase.yaml index 0433d024ff15..0a35ec04cd95 100644 --- a/tests/drivers/flash/common/testcase.yaml +++ b/tests/drivers/flash/common/testcase.yaml @@ -151,3 +151,8 @@ tests: extra_args: - DTC_OVERLAY_FILE="./boards/${BOARD}_ospi_b_nor.overlay" - CONF_FILE="./prj.conf ./boards/${BOARD}_ospi_b_nor.conf" + drivers.flash.common.mspi_single_io: + platform_allow: + - nrf54h20dk/nrf54h20/cpuapp + extra_args: + - EXTRA_DTC_OVERLAY_FILE=boards/mx25uw63_single_io.overlay From 5a47376a429951a35db9fc5d4624bd2af8c63a01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Bainczyk?= Date: Fri, 25 Jul 2025 13:19:35 +0200 Subject: [PATCH 0388/2141] [nrf fromlist] tests: drivers: gpio_basic_api: Add nrf_sense_edge test for nrf54l15dk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a testcase for nrf54l15dk with sense edge to gpio_basic_api test. Upstream PR #: 93717 Signed-off-by: Michał Bainczyk (cherry picked from commit b5b58e338f27edb1737705491f99c69db1445550) --- .../gpio/gpio_basic_api/boards/nrf54l_sense_edge.overlay | 9 +++++++++ tests/drivers/gpio/gpio_basic_api/testcase.yaml | 5 +++++ 2 files changed, 14 insertions(+) create mode 100644 tests/drivers/gpio/gpio_basic_api/boards/nrf54l_sense_edge.overlay diff --git a/tests/drivers/gpio/gpio_basic_api/boards/nrf54l_sense_edge.overlay b/tests/drivers/gpio/gpio_basic_api/boards/nrf54l_sense_edge.overlay new file mode 100644 index 000000000000..59839fa9265b --- /dev/null +++ b/tests/drivers/gpio/gpio_basic_api/boards/nrf54l_sense_edge.overlay @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&gpio1 { + sense-edge-mask = <0xC00>; +}; diff --git a/tests/drivers/gpio/gpio_basic_api/testcase.yaml b/tests/drivers/gpio/gpio_basic_api/testcase.yaml index 325b22efa1c0..805579296876 100644 --- a/tests/drivers/gpio/gpio_basic_api/testcase.yaml +++ b/tests/drivers/gpio/gpio_basic_api/testcase.yaml @@ -24,6 +24,11 @@ tests: extra_args: "DTC_OVERLAY_FILE=boards/nrf52840dk_nrf52840.overlay;\ boards/nrf52840dk_nrf52840_sense_edge.overlay" + drivers.gpio.nrf_sense_edge.nrf54l: + platform_allow: + - nrf54l15dk/nrf54l15/cpuapp + extra_args: "EXTRA_DTC_OVERLAY_FILE=boards/nrf54l_sense_edge.overlay" + drivers.gpio.mr_canhubk3_wkpu: platform_allow: mr_canhubk3 extra_args: "DTC_OVERLAY_FILE=boards/mr_canhubk3_wkpu.overlay" From 8620d6150ce43432ac3d140f8abc8c489ff0efcc Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Tue, 17 Jun 2025 07:33:54 +0100 Subject: [PATCH 0389/2141] [nrf fromtree] dts: vendor: nordic: nrf54l10: Fix wrong size of NVM Fixes the NVM size going beyond what the chip supports Signed-off-by: Jamie McCrae (cherry picked from commit 0f0c80e93120468cccae8679bb7d0c76c986e1a3) --- dts/vendor/nordic/nrf54l10.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dts/vendor/nordic/nrf54l10.dtsi b/dts/vendor/nordic/nrf54l10.dtsi index a515fbb42f53..800c4081f283 100644 --- a/dts/vendor/nordic/nrf54l10.dtsi +++ b/dts/vendor/nordic/nrf54l10.dtsi @@ -25,14 +25,14 @@ }; &cpuapp_rram { - reg = <0x0 DT_SIZE_K(960)>; + reg = <0x0 DT_SIZE_K(950)>; }; -/* 960 + 62 = 1022KB */ +/* 950 + 62 = 1012KB */ &rram_controller { - cpuflpr_rram: rram@f0000 { + cpuflpr_rram: rram@ed800 { compatible = "soc-nv-flash"; - reg = <0xf0000 DT_SIZE_K(62)>; + reg = <0xed800 DT_SIZE_K(62)>; erase-block-size = <4096>; write-block-size = <16>; }; From 9e518534b01e8d2829a3db4baed5fad0a862a479 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Tue, 17 Jun 2025 07:47:16 +0100 Subject: [PATCH 0390/2141] [nrf fromtree] boards: nordic: nrf54l10: Change to use common dts partitioning file Adds a common vendor dts file specifying the default partition layout for nRF54L10-based cpuapp board targets and updates boards to use this common file. This also drops the secure/non-secure split in the partitioning as this was reducing NVM storage that is not used by this board target and fixes the wrong flash field in twister yaml files Signed-off-by: Jamie McCrae (cherry picked from commit 9dc6040fcdf2c4c98add78e618afa7afa808732e) --- .../bl54l15_dvk_nrf54l10_cpuapp.dts | 48 +------------------ .../bl54l15_dvk_nrf54l10_cpuapp.yaml | 2 +- .../nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp.dts | 48 +------------------ .../nrf54l15dk_nrf54l10_cpuapp.yaml | 2 +- dts/vendor/nordic/nrf54l10_partition.dtsi | 38 +++++++++++++++ 5 files changed, 44 insertions(+), 94 deletions(-) create mode 100644 dts/vendor/nordic/nrf54l10_partition.dtsi diff --git a/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp.dts b/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp.dts index 3d9336bbeab9..0654c4139c5a 100644 --- a/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp.dts +++ b/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp.dts @@ -26,49 +26,5 @@ ranges = <0x0 0x20000000 DT_SIZE_K(192)>; }; -&cpuapp_rram { - reg = <0x0 DT_SIZE_K(1022)>; -}; - -/* These partition sizes assume no FLPR area in RRAM */ -&cpuapp_rram { - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - boot_partition: partition@0 { - label = "mcuboot"; - reg = <0x0 DT_SIZE_K(64)>; - }; - - slot0_partition: partition@10000 { - label = "image-0"; - reg = <0x10000 DT_SIZE_K(224)>; - }; - - slot0_ns_partition: partition@48000 { - label = "image-0-nonsecure"; - reg = <0x48000 DT_SIZE_K(224)>; - }; - - slot1_partition: partition@80000 { - label = "image-1"; - reg = <0x80000 DT_SIZE_K(224)>; - }; - - slot1_ns_partition: partition@b8000 { - label = "image-1-nonsecure"; - reg = <0xb8000 DT_SIZE_K(224)>; - }; - - /* 32K from 0xf0000 to 0xf7fff reserved for TF-M partitions */ - - storage_partition: partition@f8000 { - label = "storage"; - reg = <0xf8000 DT_SIZE_K(28)>; - }; - - /* 2K from 0xff000 to 0xff7ff unused */ - }; -}; +/* Include default memory partition configuration file */ +#include diff --git a/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp.yaml b/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp.yaml index 0a53875b7494..13bdefd1b7ed 100644 --- a/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp.yaml +++ b/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp.yaml @@ -11,7 +11,7 @@ toolchain: - zephyr sysbuild: true ram: 192 -flash: 230 +flash: 1012 supported: - adc - counter diff --git a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp.dts b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp.dts index 020fdd16af2f..e3ee6b5434fc 100644 --- a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp.dts +++ b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp.dts @@ -25,49 +25,5 @@ ranges = <0x0 0x20000000 DT_SIZE_K(192)>; }; -&cpuapp_rram { - reg = <0x0 DT_SIZE_K(1022)>; -}; - -/* These partition sizes assume no FLPR area in RRAM */ -&cpuapp_rram { - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - boot_partition: partition@0 { - label = "mcuboot"; - reg = <0x0 DT_SIZE_K(64)>; - }; - - slot0_partition: partition@10000 { - label = "image-0"; - reg = <0x10000 DT_SIZE_K(224)>; - }; - - slot0_ns_partition: partition@48000 { - label = "image-0-nonsecure"; - reg = <0x48000 DT_SIZE_K(224)>; - }; - - slot1_partition: partition@80000 { - label = "image-1"; - reg = <0x80000 DT_SIZE_K(224)>; - }; - - slot1_ns_partition: partition@b8000 { - label = "image-1-nonsecure"; - reg = <0xb8000 DT_SIZE_K(224)>; - }; - - /* 32K from 0xf0000 to 0xf7fff reserved for TF-M partitions */ - - storage_partition: partition@f8000 { - label = "storage"; - reg = <0xf8000 DT_SIZE_K(28)>; - }; - - /* 2K from 0xff000 to 0xff7ff unused */ - }; -}; +/* Include default memory partition configuration file */ +#include diff --git a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp.yaml b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp.yaml index d56468281ac4..0be5ece7d0eb 100644 --- a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp.yaml +++ b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp.yaml @@ -10,7 +10,7 @@ toolchain: - zephyr sysbuild: true ram: 192 -flash: 230 +flash: 1012 supported: - adc - counter diff --git a/dts/vendor/nordic/nrf54l10_partition.dtsi b/dts/vendor/nordic/nrf54l10_partition.dtsi new file mode 100644 index 000000000000..e73b1c5f0e3f --- /dev/null +++ b/dts/vendor/nordic/nrf54l10_partition.dtsi @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&cpuapp_rram { + reg = <0x0 DT_SIZE_K(1012)>; +}; + +/* These partition sizes assume no FLPR area in RRAM */ +&cpuapp_rram { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x0 DT_SIZE_K(64)>; + }; + + slot0_partition: partition@10000 { + label = "image-0"; + reg = <0x10000 DT_SIZE_K(456)>; + }; + + slot1_partition: partition@82000 { + label = "image-1"; + reg = <0x82000 DT_SIZE_K(456)>; + }; + + storage_partition: partition@f4000 { + label = "storage"; + reg = <0xf4000 DT_SIZE_K(36)>; + }; + }; +}; From db3708451536f016792c7e6bd7ec2002b956a068 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Tue, 17 Jun 2025 08:54:10 +0100 Subject: [PATCH 0391/2141] [nrf fromtree] boards: nordic: nrf54l10_cpuapp_ns: Add workaround for partitions Adds a workaround for partitions on nrf54l10 non-secure devices to prevent build issues, this needs to be fixed properly when a TF-M update is done which sets the partition sizes properly Signed-off-by: Jamie McCrae (cherry picked from commit 002838ab9ef526c882225504bda0ef86ff577455) --- boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp_ns.dts | 3 +++ boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns.dts | 3 +++ 2 files changed, 6 insertions(+) diff --git a/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp_ns.dts b/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp_ns.dts index 02d900390cca..39a986ae2b67 100644 --- a/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp_ns.dts +++ b/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp_ns.dts @@ -59,6 +59,9 @@ }; &cpuapp_rram { + /* TODO: revert this hack when TF-M update is available that fixes partition sizes */ + reg = <0x0 DT_SIZE_K(1022)>; + partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns.dts b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns.dts index f1aa851ed2d9..cd644d845d5e 100644 --- a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns.dts +++ b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns.dts @@ -58,6 +58,9 @@ }; &cpuapp_rram { + /* TODO: revert this hack when TF-M update is available that fixes partition sizes */ + reg = <0x0 DT_SIZE_K(1022)>; + partitions { compatible = "fixed-partitions"; #address-cells = <1>; From a72fadce3c365308402894aea22c83bf96226157 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Fri, 13 Jun 2025 12:17:30 +0100 Subject: [PATCH 0392/2141] [nrf fromtree] boards: nordic: nrf54l15: Change to use common dts partitioning file Adds a common vendor dts file specifying the default partition layout for nRF54L15-based cpuapp board targets and updates boards to use this common file. This also drops the secure/non-secure split in the partitioning as this was reducing NVM storage that is not used by this board target and fixes the wrong flash field in twister yaml files Signed-off-by: Jamie McCrae (cherry picked from commit 124a803fc4a0f3976e89e492c628ec9cae56b074) --- .../bl54l15_dvk_nrf54l15_cpuapp.dts | 40 +---------------- .../bl54l15_dvk_nrf54l15_cpuapp.yaml | 2 +- .../bl54l15u_dvk_nrf54l15_cpuapp.dts | 40 +---------------- .../bl54l15u_dvk_nrf54l15_cpuapp.yaml | 2 +- .../nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp.dts | 41 +----------------- .../nrf54l15dk_nrf54l15_cpuapp.yaml | 2 +- .../panb511evb/panb511evb_nrf54l15_cpuapp.dts | 40 +---------------- .../panb511evb_nrf54l15_cpuapp.yaml | 2 +- .../raytac_an54l15q_db_nrf54l15_cpuapp.dts | 40 +---------------- .../raytac_an54l15q_db_nrf54l15_cpuapp.yaml | 2 +- .../ophelia4ev/ophelia4ev_nrf54l15_cpuapp.dts | 43 ++----------------- .../ophelia4ev_nrf54l15_cpuapp.yaml | 2 +- dts/vendor/nordic/nrf54l15_partition.dtsi | 33 ++++++++++++++ 13 files changed, 52 insertions(+), 237 deletions(-) create mode 100644 dts/vendor/nordic/nrf54l15_partition.dtsi diff --git a/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l15_cpuapp.dts b/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l15_cpuapp.dts index ef92bda99301..50a03e2d48f7 100644 --- a/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l15_cpuapp.dts +++ b/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l15_cpuapp.dts @@ -20,41 +20,5 @@ }; }; -&cpuapp_rram { - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - boot_partition: partition@0 { - label = "mcuboot"; - reg = <0x0 DT_SIZE_K(64)>; - }; - - slot0_partition: partition@10000 { - label = "image-0"; - reg = <0x10000 DT_SIZE_K(324)>; - }; - - slot0_ns_partition: partition@61000 { - label = "image-0-nonsecure"; - reg = <0x61000 DT_SIZE_K(324)>; - }; - - slot1_partition: partition@b2000 { - label = "image-1"; - reg = <0xb2000 DT_SIZE_K(324)>; - }; - - slot1_ns_partition: partition@103000 { - label = "image-1-nonsecure"; - reg = <0x103000 DT_SIZE_K(324)>; - }; - - /* 32k from 0x154000 to 0x15bfff reserved for TF-M partitions */ - storage_partition: partition@15c000 { - label = "storage"; - reg = <0x15c000 DT_SIZE_K(36)>; - }; - }; -}; +/* Include default memory partition configuration file */ +#include diff --git a/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l15_cpuapp.yaml b/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l15_cpuapp.yaml index abcf0f54482a..066929a10a6a 100644 --- a/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l15_cpuapp.yaml +++ b/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l15_cpuapp.yaml @@ -11,7 +11,7 @@ toolchain: - zephyr sysbuild: true ram: 188 -flash: 324 +flash: 1428 supported: - adc - counter diff --git a/boards/ezurio/bl54l15u_dvk/bl54l15u_dvk_nrf54l15_cpuapp.dts b/boards/ezurio/bl54l15u_dvk/bl54l15u_dvk_nrf54l15_cpuapp.dts index 7ea5099aa3f5..00ffc3f5449c 100644 --- a/boards/ezurio/bl54l15u_dvk/bl54l15u_dvk_nrf54l15_cpuapp.dts +++ b/boards/ezurio/bl54l15u_dvk/bl54l15u_dvk_nrf54l15_cpuapp.dts @@ -20,41 +20,5 @@ }; }; -&cpuapp_rram { - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - boot_partition: partition@0 { - label = "mcuboot"; - reg = <0x0 DT_SIZE_K(64)>; - }; - - slot0_partition: partition@10000 { - label = "image-0"; - reg = <0x10000 DT_SIZE_K(324)>; - }; - - slot0_ns_partition: partition@61000 { - label = "image-0-nonsecure"; - reg = <0x61000 DT_SIZE_K(324)>; - }; - - slot1_partition: partition@b2000 { - label = "image-1"; - reg = <0xb2000 DT_SIZE_K(324)>; - }; - - slot1_ns_partition: partition@103000 { - label = "image-1-nonsecure"; - reg = <0x103000 DT_SIZE_K(324)>; - }; - - /* 32k from 0x154000 to 0x15bfff reserved for TF-M partitions */ - storage_partition: partition@15c000 { - label = "storage"; - reg = <0x15c000 DT_SIZE_K(36)>; - }; - }; -}; +/* Include default memory partition configuration file */ +#include diff --git a/boards/ezurio/bl54l15u_dvk/bl54l15u_dvk_nrf54l15_cpuapp.yaml b/boards/ezurio/bl54l15u_dvk/bl54l15u_dvk_nrf54l15_cpuapp.yaml index 264368c2baf1..d210534c8b55 100644 --- a/boards/ezurio/bl54l15u_dvk/bl54l15u_dvk_nrf54l15_cpuapp.yaml +++ b/boards/ezurio/bl54l15u_dvk/bl54l15u_dvk_nrf54l15_cpuapp.yaml @@ -11,7 +11,7 @@ toolchain: - zephyr sysbuild: true ram: 188 -flash: 324 +flash: 1428 supported: - adc - counter diff --git a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp.dts b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp.dts index b2d96daa1925..6e6629025612 100644 --- a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp.dts +++ b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp.dts @@ -19,42 +19,5 @@ }; }; -&cpuapp_rram { - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - boot_partition: partition@0 { - label = "mcuboot"; - reg = <0x0 DT_SIZE_K(64)>; - }; - - slot0_partition: partition@10000 { - label = "image-0"; - reg = <0x10000 DT_SIZE_K(324)>; - }; - - slot0_ns_partition: partition@61000 { - label = "image-0-nonsecure"; - reg = <0x61000 DT_SIZE_K(324)>; - }; - - slot1_partition: partition@b2000 { - label = "image-1"; - reg = <0xb2000 DT_SIZE_K(324)>; - }; - - slot1_ns_partition: partition@103000 { - label = "image-1-nonsecure"; - reg = <0x103000 DT_SIZE_K(324)>; - }; - - /* 32k from 0x154000 to 0x15bfff reserved for TF-M partitions */ - - storage_partition: partition@15c000 { - label = "storage"; - reg = <0x15c000 DT_SIZE_K(36)>; - }; - }; -}; +/* Include default memory partition configuration file */ +#include diff --git a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp.yaml b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp.yaml index 3fbfefe01a39..e23a2a0073a9 100644 --- a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp.yaml +++ b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp.yaml @@ -10,7 +10,7 @@ toolchain: - zephyr sysbuild: true ram: 188 -flash: 324 +flash: 1428 supported: - adc - counter diff --git a/boards/panasonic/panb511evb/panb511evb_nrf54l15_cpuapp.dts b/boards/panasonic/panb511evb/panb511evb_nrf54l15_cpuapp.dts index c79847a3b57b..04616affd146 100644 --- a/boards/panasonic/panb511evb/panb511evb_nrf54l15_cpuapp.dts +++ b/boards/panasonic/panb511evb/panb511evb_nrf54l15_cpuapp.dts @@ -19,41 +19,5 @@ }; }; -&cpuapp_rram { - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - boot_partition: partition@0 { - label = "mcuboot"; - reg = <0x0 DT_SIZE_K(64)>; - }; - - slot0_partition: partition@10000 { - label = "image-0"; - reg = <0x10000 DT_SIZE_K(324)>; - }; - - slot0_ns_partition: partition@61000 { - label = "image-0-nonsecure"; - reg = <0x61000 DT_SIZE_K(324)>; - }; - - slot1_partition: partition@b2000 { - label = "image-1"; - reg = <0xb2000 DT_SIZE_K(324)>; - }; - - slot1_ns_partition: partition@103000 { - label = "image-1-nonsecure"; - reg = <0x103000 DT_SIZE_K(324)>; - }; - - /* 32k from 0x154000 to 0x15bfff reserved for TF-M partitions */ - storage_partition: partition@15c000 { - label = "storage"; - reg = <0x15c000 DT_SIZE_K(36)>; - }; - }; -}; +/* Include default memory partition configuration file */ +#include diff --git a/boards/panasonic/panb511evb/panb511evb_nrf54l15_cpuapp.yaml b/boards/panasonic/panb511evb/panb511evb_nrf54l15_cpuapp.yaml index e911ee9e54c3..db252d56047d 100644 --- a/boards/panasonic/panb511evb/panb511evb_nrf54l15_cpuapp.yaml +++ b/boards/panasonic/panb511evb/panb511evb_nrf54l15_cpuapp.yaml @@ -10,7 +10,7 @@ toolchain: - zephyr sysbuild: true ram: 188 -flash: 324 +flash: 1428 supported: - adc - counter diff --git a/boards/raytac/an54l15q_db/raytac_an54l15q_db_nrf54l15_cpuapp.dts b/boards/raytac/an54l15q_db/raytac_an54l15q_db_nrf54l15_cpuapp.dts index d9362a6ddb0e..d347ef16ac14 100644 --- a/boards/raytac/an54l15q_db/raytac_an54l15q_db_nrf54l15_cpuapp.dts +++ b/boards/raytac/an54l15q_db/raytac_an54l15q_db_nrf54l15_cpuapp.dts @@ -21,41 +21,5 @@ }; }; -&cpuapp_rram { - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - boot_partition: partition@0 { - label = "mcuboot"; - reg = <0x0 DT_SIZE_K(64)>; - }; - - slot0_partition: partition@10000 { - label = "image-0"; - reg = <0x10000 DT_SIZE_K(324)>; - }; - - slot0_ns_partition: partition@61000 { - label = "image-0-nonsecure"; - reg = <0x61000 DT_SIZE_K(324)>; - }; - - slot1_partition: partition@b2000 { - label = "image-1"; - reg = <0xb2000 DT_SIZE_K(324)>; - }; - - slot1_ns_partition: partition@103000 { - label = "image-1-nonsecure"; - reg = <0x103000 DT_SIZE_K(324)>; - }; - - /* 32k from 0x154000 to 0x15bfff reserved for TF-M partitions */ - storage_partition: partition@15c000 { - label = "storage"; - reg = <0x15c000 DT_SIZE_K(36)>; - }; - }; -}; +/* Include default memory partition configuration file */ +#include diff --git a/boards/raytac/an54l15q_db/raytac_an54l15q_db_nrf54l15_cpuapp.yaml b/boards/raytac/an54l15q_db/raytac_an54l15q_db_nrf54l15_cpuapp.yaml index 4e3b90674758..7a5e9a84f960 100644 --- a/boards/raytac/an54l15q_db/raytac_an54l15q_db_nrf54l15_cpuapp.yaml +++ b/boards/raytac/an54l15q_db/raytac_an54l15q_db_nrf54l15_cpuapp.yaml @@ -12,7 +12,7 @@ toolchain: - zephyr sysbuild: true ram: 188 -flash: 324 +flash: 1428 supported: - adc - counter diff --git a/boards/we/ophelia4ev/ophelia4ev_nrf54l15_cpuapp.dts b/boards/we/ophelia4ev/ophelia4ev_nrf54l15_cpuapp.dts index 73b135891a8a..2380fcd5b8d3 100644 --- a/boards/we/ophelia4ev/ophelia4ev_nrf54l15_cpuapp.dts +++ b/boards/we/ophelia4ev/ophelia4ev_nrf54l15_cpuapp.dts @@ -26,46 +26,6 @@ }; }; -&cpuapp_rram { - partitions { - compatible = "fixed-partitions"; - - #address-cells = <1>; - #size-cells = <1>; - - boot_partition: partition@0 { - label = "mcuboot"; - reg = <0x0 DT_SIZE_K(64)>; - }; - - slot0_partition: partition@10000 { - label = "image-0"; - reg = <0x10000 DT_SIZE_K(324)>; - }; - - slot0_ns_partition: partition@61000 { - label = "image-0-nonsecure"; - reg = <0x61000 DT_SIZE_K(324)>; - }; - - slot1_partition: partition@b2000 { - label = "image-1"; - reg = <0xb2000 DT_SIZE_K(324)>; - }; - - slot1_ns_partition: partition@103000 { - label = "image-1-nonsecure"; - reg = <0x103000 DT_SIZE_K(324)>; - }; - - /* 32k from 0x154000 to 0x15bfff reserved for TF-M partitions */ - storage_partition: partition@15c000 { - label = "storage"; - reg = <0x15c000 DT_SIZE_K(36)>; - }; - }; -}; - &cpuapp_sram { status = "okay"; }; @@ -172,3 +132,6 @@ &adc { status = "okay"; }; + +/* Include default memory partition configuration file */ +#include diff --git a/boards/we/ophelia4ev/ophelia4ev_nrf54l15_cpuapp.yaml b/boards/we/ophelia4ev/ophelia4ev_nrf54l15_cpuapp.yaml index 87fee9c3d62b..6e8bd507277d 100644 --- a/boards/we/ophelia4ev/ophelia4ev_nrf54l15_cpuapp.yaml +++ b/boards/we/ophelia4ev/ophelia4ev_nrf54l15_cpuapp.yaml @@ -10,7 +10,7 @@ toolchain: - zephyr sysbuild: true ram: 188 -flash: 324 +flash: 1428 supported: - adc - counter diff --git a/dts/vendor/nordic/nrf54l15_partition.dtsi b/dts/vendor/nordic/nrf54l15_partition.dtsi new file mode 100644 index 000000000000..4988de3ed544 --- /dev/null +++ b/dts/vendor/nordic/nrf54l15_partition.dtsi @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&cpuapp_rram { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x0 DT_SIZE_K(64)>; + }; + + slot0_partition: partition@10000 { + label = "image-0"; + reg = <0x10000 DT_SIZE_K(664)>; + }; + + slot1_partition: partition@b6000 { + label = "image-1"; + reg = <0xb6000 DT_SIZE_K(664)>; + }; + + storage_partition: partition@15c000 { + label = "storage"; + reg = <0x15c000 DT_SIZE_K(36)>; + }; + }; +}; From 02d21dd590dbb7439d999f0bdb05ec76a9df6927 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Fri, 13 Jun 2025 13:37:31 +0100 Subject: [PATCH 0393/2141] [nrf fromtree] boards: nordic: nrf54l15_ns: Change to use common dts partitioning file Adds a common vendor dts file specifying the default partition layout for nRF54L15-based cpuapp_ns board targets and updates boards to use this common file. Signed-off-by: Jamie McCrae (cherry picked from commit e542188ce9c07e89d5d47791ea92a539eb38ab40) --- .../bl54l15_dvk_nrf54l15_cpuapp_ns.dts | 48 +------------- .../bl54l15u_dvk_nrf54l15_cpuapp_ns.dts | 48 +------------- .../nrf54l15dk_nrf54l15_cpuapp_ns.dts | 48 +------------- .../panb511evb_nrf54l15_cpuapp_ns.dts | 48 +------------- .../raytac_an54l15q_db_nrf54l15_cpuapp_ns.dts | 48 +------------- dts/vendor/nordic/nrf54l15_ns_partition.dtsi | 62 +++++++++++++++++++ 6 files changed, 77 insertions(+), 225 deletions(-) create mode 100644 dts/vendor/nordic/nrf54l15_ns_partition.dtsi diff --git a/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l15_cpuapp_ns.dts b/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l15_cpuapp_ns.dts index 38712ba70744..bca01b2b0624 100644 --- a/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l15_cpuapp_ns.dts +++ b/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l15_cpuapp_ns.dts @@ -58,51 +58,6 @@ }; }; -&cpuapp_rram { - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - /* nRF54L15 has 1524 kB of non volatile memory (RRAM) but the - * last 96kB are reserved for the FLPR MCU. - * - * This static layout needs to be the same with the upstream TF-M layout in the - * header flash_layout.h of the relevant platform. Any updates in the layout - * needs to happen both in the flash_layout.h and in this file at the same time. - */ - slot0_partition: partition@0 { - label = "image-0"; - reg = <0x0000000 DT_SIZE_K(512)>; - }; - - tfm_ps_partition: partition@80000 { - label = "tfm-ps"; - reg = <0x00080000 DT_SIZE_K(16)>; - }; - - tfm_its_partition: partition@84000 { - label = "tfm-its"; - reg = <0x00084000 DT_SIZE_K(16)>; - }; - - tfm_otp_partition: partition@88000 { - label = "tfm-otp"; - reg = <0x00088000 DT_SIZE_K(8)>; - }; - - slot0_ns_partition: partition@8A000 { - label = "image-0-nonsecure"; - reg = <0x0008A000 DT_SIZE_K(844)>; - }; - - storage_partition: partition@15D000 { - label = "storage"; - reg = <0x00015D000 DT_SIZE_K(32)>; - }; - }; -}; - &uart30 { /* Disable so that TF-M can use this UART */ status = "disabled"; @@ -112,3 +67,6 @@ pinctrl-1 = <&uart30_sleep>; pinctrl-names = "default", "sleep"; }; + +/* Include default memory partition configuration file */ +#include diff --git a/boards/ezurio/bl54l15u_dvk/bl54l15u_dvk_nrf54l15_cpuapp_ns.dts b/boards/ezurio/bl54l15u_dvk/bl54l15u_dvk_nrf54l15_cpuapp_ns.dts index f03eb6a5e810..6530b554d343 100644 --- a/boards/ezurio/bl54l15u_dvk/bl54l15u_dvk_nrf54l15_cpuapp_ns.dts +++ b/boards/ezurio/bl54l15u_dvk/bl54l15u_dvk_nrf54l15_cpuapp_ns.dts @@ -58,51 +58,6 @@ }; }; -&cpuapp_rram { - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - /* nRF54L15 has 1524 kB of non volatile memory (RRAM) but the - * last 96kB are reserved for the FLPR MCU. - * - * This static layout needs to be the same with the upstream TF-M layout in the - * header flash_layout.h of the relevant platform. Any updates in the layout - * needs to happen both in the flash_layout.h and in this file at the same time. - */ - slot0_partition: partition@0 { - label = "image-0"; - reg = <0x0000000 DT_SIZE_K(512)>; - }; - - tfm_ps_partition: partition@80000 { - label = "tfm-ps"; - reg = <0x00080000 DT_SIZE_K(16)>; - }; - - tfm_its_partition: partition@84000 { - label = "tfm-its"; - reg = <0x00084000 DT_SIZE_K(16)>; - }; - - tfm_otp_partition: partition@88000 { - label = "tfm-otp"; - reg = <0x00088000 DT_SIZE_K(8)>; - }; - - slot0_ns_partition: partition@8A000 { - label = "image-0-nonsecure"; - reg = <0x0008A000 DT_SIZE_K(844)>; - }; - - storage_partition: partition@15D000 { - label = "storage"; - reg = <0x00015D000 DT_SIZE_K(32)>; - }; - }; -}; - &uart30 { /* Disable so that TF-M can use this UART */ status = "disabled"; @@ -112,3 +67,6 @@ pinctrl-1 = <&uart30_sleep>; pinctrl-names = "default", "sleep"; }; + +/* Include default memory partition configuration file */ +#include diff --git a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp_ns.dts b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp_ns.dts index 3a7ca70eaedf..f78a1f864e2f 100644 --- a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp_ns.dts +++ b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp_ns.dts @@ -57,51 +57,6 @@ }; }; -&cpuapp_rram { - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - /* nRF54L15 has 1524 kB of non volatile memory (RRAM) but the - * last 96kB are reserved for the FLPR MCU. - * - * This static layout needs to be the same with the upstream TF-M layout in the - * header flash_layout.h of the relevant platform. Any updates in the layout - * needs to happen both in the flash_layout.h and in this file at the same time. - */ - slot0_partition: partition@0 { - label = "image-0"; - reg = <0x0000000 DT_SIZE_K(512)>; - }; - - tfm_ps_partition: partition@80000 { - label = "tfm-ps"; - reg = <0x00080000 DT_SIZE_K(16)>; - }; - - tfm_its_partition: partition@84000 { - label = "tfm-its"; - reg = <0x00084000 DT_SIZE_K(16)>; - }; - - tfm_otp_partition: partition@88000 { - label = "tfm-otp"; - reg = <0x00088000 DT_SIZE_K(8)>; - }; - - slot0_ns_partition: partition@8A000 { - label = "image-0-nonsecure"; - reg = <0x0008A000 DT_SIZE_K(844)>; - }; - - storage_partition: partition@15D000 { - label = "storage"; - reg = <0x00015D000 DT_SIZE_K(32)>; - }; - }; -}; - &uart30 { /* Disable so that TF-M can use this UART */ status = "disabled"; @@ -111,3 +66,6 @@ pinctrl-1 = <&uart30_sleep>; pinctrl-names = "default", "sleep"; }; + +/* Include default memory partition configuration file */ +#include diff --git a/boards/panasonic/panb511evb/panb511evb_nrf54l15_cpuapp_ns.dts b/boards/panasonic/panb511evb/panb511evb_nrf54l15_cpuapp_ns.dts index f4aeab933f8c..4f5ea3033165 100644 --- a/boards/panasonic/panb511evb/panb511evb_nrf54l15_cpuapp_ns.dts +++ b/boards/panasonic/panb511evb/panb511evb_nrf54l15_cpuapp_ns.dts @@ -57,51 +57,6 @@ }; }; -&cpuapp_rram { - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - /* nRF54L15 has 1524 kB of non volatile memory (RRAM) but the - * last 96kB are reserved for the FLPR MCU. - * - * This static layout needs to be the same with the upstream TF-M layout in the - * header flash_layout.h of the relevant platform. Any updates in the layout - * needs to happen both in the flash_layout.h and in this file at the same time. - */ - slot0_partition: partition@0 { - label = "image-0"; - reg = <0x0000000 DT_SIZE_K(512)>; - }; - - tfm_ps_partition: partition@80000 { - label = "tfm-ps"; - reg = <0x00080000 DT_SIZE_K(16)>; - }; - - tfm_its_partition: partition@84000 { - label = "tfm-its"; - reg = <0x00084000 DT_SIZE_K(16)>; - }; - - tfm_otp_partition: partition@88000 { - label = "tfm-otp"; - reg = <0x00088000 DT_SIZE_K(8)>; - }; - - slot0_ns_partition: partition@8A000 { - label = "image-0-nonsecure"; - reg = <0x0008A000 DT_SIZE_K(844)>; - }; - - storage_partition: partition@15D000 { - label = "storage"; - reg = <0x00015D000 DT_SIZE_K(32)>; - }; - }; -}; - &uart20 { /* Disable so that TF-M can use this UART */ status = "disabled"; @@ -111,3 +66,6 @@ pinctrl-1 = <&uart20_sleep>; pinctrl-names = "default", "sleep"; }; + +/* Include default memory partition configuration file */ +#include diff --git a/boards/raytac/an54l15q_db/raytac_an54l15q_db_nrf54l15_cpuapp_ns.dts b/boards/raytac/an54l15q_db/raytac_an54l15q_db_nrf54l15_cpuapp_ns.dts index db7a01aead83..d6395d7fd71a 100644 --- a/boards/raytac/an54l15q_db/raytac_an54l15q_db_nrf54l15_cpuapp_ns.dts +++ b/boards/raytac/an54l15q_db/raytac_an54l15q_db_nrf54l15_cpuapp_ns.dts @@ -58,51 +58,6 @@ }; }; -&cpuapp_rram { - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - /* nRF54L15 has 1524 kB of non volatile memory (RRAM) but the - * last 96kB are reserved for the FLPR MCU. - * - * This static layout needs to be the same with the upstream TF-M layout in the - * header flash_layout.h of the relevant platform. Any updates in the layout - * needs to happen both in the flash_layout.h and in this file at the same time. - */ - slot0_partition: partition@0 { - label = "image-0"; - reg = <0x0000000 DT_SIZE_K(512)>; - }; - - tfm_ps_partition: partition@80000 { - label = "tfm-ps"; - reg = <0x00080000 DT_SIZE_K(16)>; - }; - - tfm_its_partition: partition@84000 { - label = "tfm-its"; - reg = <0x00084000 DT_SIZE_K(16)>; - }; - - tfm_otp_partition: partition@88000 { - label = "tfm-otp"; - reg = <0x00088000 DT_SIZE_K(8)>; - }; - - slot0_ns_partition: partition@8A000 { - label = "image-0-nonsecure"; - reg = <0x0008A000 DT_SIZE_K(844)>; - }; - - storage_partition: partition@15D000 { - label = "storage"; - reg = <0x00015D000 DT_SIZE_K(32)>; - }; - }; -}; - &uart30 { /* Disable so that TF-M can use this UART */ status = "disabled"; @@ -111,3 +66,6 @@ pinctrl-1 = <&uart30_sleep>; pinctrl-names = "default", "sleep"; }; + +/* Include default memory partition configuration file */ +#include diff --git a/dts/vendor/nordic/nrf54l15_ns_partition.dtsi b/dts/vendor/nordic/nrf54l15_ns_partition.dtsi new file mode 100644 index 000000000000..ac15dc79f33c --- /dev/null +++ b/dts/vendor/nordic/nrf54l15_ns_partition.dtsi @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&cpuapp_rram { + /* + * Default NVM layout on NRF54L15 Application MCU without BL2: + * This layout matches (by necessity) that in the TF-M repository: + * + * 0x0000_0000 Secure image primary (512 KB) + * 0x0008_0000 Protected Storage Area (16 KB) + * 0x0008_4000 Internal Trusted Storage Area (16 KB) + * 0x0008_8000 OTP / NV counters area (8 KB) + * 0x0008_A000 Non-secure image primary (844 KB) + * 0x0015_D000 Non-secure storage, used when built with NRF_NS_STORAGE=ON, + * otherwise unused (32 KB) + */ + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + /* nRF54L15 has 1524 kB of non volatile memory (RRAM) but the + * last 96kB are reserved for the FLPR MCU. + * + * This static layout needs to be the same with the upstream TF-M layout in the + * header flash_layout.h of the relevant platform. Any updates in the layout + * needs to happen both in the flash_layout.h and in this file at the same time. + */ + slot0_partition: partition@0 { + label = "image-0"; + reg = <0x0000000 DT_SIZE_K(512)>; + }; + + tfm_ps_partition: partition@80000 { + label = "tfm-ps"; + reg = <0x00080000 DT_SIZE_K(16)>; + }; + + tfm_its_partition: partition@84000 { + label = "tfm-its"; + reg = <0x00084000 DT_SIZE_K(16)>; + }; + + tfm_otp_partition: partition@88000 { + label = "tfm-otp"; + reg = <0x00088000 DT_SIZE_K(8)>; + }; + + slot0_ns_partition: partition@8A000 { + label = "image-0-nonsecure"; + reg = <0x0008A000 DT_SIZE_K(844)>; + }; + + storage_partition: partition@15D000 { + label = "storage"; + reg = <0x00015D000 DT_SIZE_K(32)>; + }; + }; +}; From c49eabe0283c50d6f00e952ec298d3e2d3ac4435 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Tue, 17 Jun 2025 07:57:29 +0100 Subject: [PATCH 0394/2141] [nrf fromtree] boards: nordic: nrf54l05: Change to use common dts partitioning file Adds a common vendor dts file specifying the default partition layout for nRF54L05-based cpuapp board targets and updates boards to use this common file. This also drops the secure/non-secure split in the partitioning as this was reducing NVM storage that is not used by this board target and fixes the wrong flash field in twister yaml files Signed-off-by: Jamie McCrae (cherry picked from commit 5bc71e6e9b77fb6df120c3007bfe861f9036a930) --- .../nrf54l15dk/nrf54l15dk_nrf54l05_cpuapp.dts | 44 +------------------ .../nrf54l15dk_nrf54l05_cpuapp.yaml | 2 +- dts/vendor/nordic/nrf54l05_partition.dtsi | 38 ++++++++++++++++ 3 files changed, 41 insertions(+), 43 deletions(-) create mode 100644 dts/vendor/nordic/nrf54l05_partition.dtsi diff --git a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l05_cpuapp.dts b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l05_cpuapp.dts index 23ae87ccb110..2c30c7270059 100644 --- a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l05_cpuapp.dts +++ b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l05_cpuapp.dts @@ -25,45 +25,5 @@ ranges = <0x0 0x20000000 DT_SIZE_K(96)>; }; -&cpuapp_rram { - reg = <0x0 DT_SIZE_K(500)>; -}; - -/* These partition sizes assume no FLPR area in RRAM */ -&cpuapp_rram { - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - boot_partition: partition@0 { - label = "mcuboot"; - reg = <0x0 DT_SIZE_K(64)>; - }; - - slot0_partition: partition@10000 { - label = "image-0"; - reg = <0x10000 DT_SIZE_K(100)>; - }; - - slot0_ns_partition: partition@29000 { - label = "image-0-nonsecure"; - reg = <0x29000 DT_SIZE_K(100)>; - }; - - slot1_partition: partition@42000 { - label = "image-1"; - reg = <0x42000 DT_SIZE_K(100)>; - }; - - slot1_ns_partition: partition@5b000 { - label = "image-1-nonsecure"; - reg = <0x5b000 DT_SIZE_K(100)>; - }; - - storage_partition: partition@74000 { - label = "storage"; - reg = <0x74000 DT_SIZE_K(36)>; - }; - }; -}; +/* Include default memory partition configuration file */ +#include diff --git a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l05_cpuapp.yaml b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l05_cpuapp.yaml index 2a41fbf2ca10..cda8efcd610a 100644 --- a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l05_cpuapp.yaml +++ b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l05_cpuapp.yaml @@ -10,7 +10,7 @@ toolchain: - zephyr sysbuild: true ram: 96 -flash: 100 +flash: 500 supported: - adc - counter diff --git a/dts/vendor/nordic/nrf54l05_partition.dtsi b/dts/vendor/nordic/nrf54l05_partition.dtsi new file mode 100644 index 000000000000..aa2ea04bce0d --- /dev/null +++ b/dts/vendor/nordic/nrf54l05_partition.dtsi @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&cpuapp_rram { + reg = <0x0 DT_SIZE_K(500)>; +}; + +/* These partition sizes assume no FLPR area in RRAM */ +&cpuapp_rram { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x0 DT_SIZE_K(64)>; + }; + + slot0_partition: partition@10000 { + label = "image-0"; + reg = <0x10000 DT_SIZE_K(200)>; + }; + + slot1_partition: partition@42000 { + label = "image-1"; + reg = <0x42000 DT_SIZE_K(200)>; + }; + + storage_partition: partition@74000 { + label = "storage"; + reg = <0x74000 DT_SIZE_K(36)>; + }; + }; +}; From 1e7c322c576ac40b778665b12e7560eaebecd125 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Tue, 17 Jun 2025 08:57:11 +0100 Subject: [PATCH 0395/2141] [nrf fromtree] samples: fs: fs_sample: Fix nrf54l15 dts overlay files Fixes these files to no lonegr delete non-secure partitions as these no longer exist Signed-off-by: Jamie McCrae (cherry picked from commit 97e5d3321496691b1a32e974c2eb6215d39a0379) --- .../fs/fs_sample/boards/bl54l15_dvk_nrf54l15_cpuapp.overlay | 2 -- .../fs/fs_sample/boards/bl54l15u_dvk_nrf54l15_cpuapp.overlay | 2 -- .../fs/fs_sample/boards/nrf54l15dk_nrf54l15_cpuapp.overlay | 3 +-- .../fs/fs_sample/boards/ophelia4ev_nrf54l15_cpuapp.overlay | 2 -- 4 files changed, 1 insertion(+), 8 deletions(-) diff --git a/samples/subsys/fs/fs_sample/boards/bl54l15_dvk_nrf54l15_cpuapp.overlay b/samples/subsys/fs/fs_sample/boards/bl54l15_dvk_nrf54l15_cpuapp.overlay index 2311a0397029..5a063e3b862f 100644 --- a/samples/subsys/fs/fs_sample/boards/bl54l15_dvk_nrf54l15_cpuapp.overlay +++ b/samples/subsys/fs/fs_sample/boards/bl54l15_dvk_nrf54l15_cpuapp.overlay @@ -11,8 +11,6 @@ */ /delete-node/ &slot0_partition; /delete-node/ &slot1_partition; -/delete-node/ &slot0_ns_partition; -/delete-node/ &slot1_ns_partition; /delete-node/ &storage_partition; &cpuapp_rram { diff --git a/samples/subsys/fs/fs_sample/boards/bl54l15u_dvk_nrf54l15_cpuapp.overlay b/samples/subsys/fs/fs_sample/boards/bl54l15u_dvk_nrf54l15_cpuapp.overlay index 2311a0397029..5a063e3b862f 100644 --- a/samples/subsys/fs/fs_sample/boards/bl54l15u_dvk_nrf54l15_cpuapp.overlay +++ b/samples/subsys/fs/fs_sample/boards/bl54l15u_dvk_nrf54l15_cpuapp.overlay @@ -11,8 +11,6 @@ */ /delete-node/ &slot0_partition; /delete-node/ &slot1_partition; -/delete-node/ &slot0_ns_partition; -/delete-node/ &slot1_ns_partition; /delete-node/ &storage_partition; &cpuapp_rram { diff --git a/samples/subsys/fs/fs_sample/boards/nrf54l15dk_nrf54l15_cpuapp.overlay b/samples/subsys/fs/fs_sample/boards/nrf54l15dk_nrf54l15_cpuapp.overlay index 391afea75a40..b75448218933 100644 --- a/samples/subsys/fs/fs_sample/boards/nrf54l15dk_nrf54l15_cpuapp.overlay +++ b/samples/subsys/fs/fs_sample/boards/nrf54l15dk_nrf54l15_cpuapp.overlay @@ -10,8 +10,6 @@ */ /delete-node/ &slot0_partition; /delete-node/ &slot1_partition; -/delete-node/ &slot0_ns_partition; -/delete-node/ &slot1_ns_partition; /delete-node/ &storage_partition; &cpuapp_rram { @@ -23,6 +21,7 @@ slot0_partition: parition@10000 { reg = <0x00010000 DT_SIZE_K(300)>; }; + slot1_partition: partition@5b000 { reg = <0x0005b000 DT_SIZE_K(300)>; }; diff --git a/samples/subsys/fs/fs_sample/boards/ophelia4ev_nrf54l15_cpuapp.overlay b/samples/subsys/fs/fs_sample/boards/ophelia4ev_nrf54l15_cpuapp.overlay index da13128938aa..339c971683a1 100644 --- a/samples/subsys/fs/fs_sample/boards/ophelia4ev_nrf54l15_cpuapp.overlay +++ b/samples/subsys/fs/fs_sample/boards/ophelia4ev_nrf54l15_cpuapp.overlay @@ -10,8 +10,6 @@ */ /delete-node/ &slot0_partition; /delete-node/ &slot1_partition; -/delete-node/ &slot0_ns_partition; -/delete-node/ &slot1_ns_partition; /delete-node/ &storage_partition; &cpuapp_rram { From ba1a3a62b9f2f57334bf9e2691779f6d3f1f187e Mon Sep 17 00:00:00 2001 From: Sergei Ovchinnikov Date: Tue, 8 Jul 2025 09:26:13 +0200 Subject: [PATCH 0396/2141] [nrf fromtree] boards: shields: add npm1304_ek shield Add an nPM1304 EK shield, update samples/shields/npm1300_ek to support both shields, improve the sample description. Signed-off-by: Sergei Ovchinnikov (cherry picked from commit f0f2b941f0457a508872710bafc232777dc0b42e) --- boards/shields/npm1300_ek/doc/index.rst | 7 +- boards/shields/npm1304_ek/Kconfig.shield | 5 + boards/shields/npm1304_ek/doc/index.rst | 30 +++++ boards/shields/npm1304_ek/npm1304_ek.overlay | 86 ++++++++++++++ boards/shields/npm1304_ek/shield.yml | 11 ++ doc/_scripts/redirects.py | 1 + samples/shields/npm1300_ek/CMakeLists.txt | 11 -- samples/shields/npm1300_ek/doc/index.rst | 71 ----------- samples/shields/npm1300_ek/sample.yaml | 12 -- samples/shields/npm13xx_ek/CMakeLists.txt | 17 +++ .../boards/nrf52dk_nrf52832.overlay | 10 ++ samples/shields/npm13xx_ek/doc/index.rst | 110 ++++++++++++++++++ .../npm1300.overlay} | 7 +- samples/shields/npm13xx_ek/npm1304.overlay | 36 ++++++ .../{npm1300_ek => npm13xx_ek}/prj.conf | 0 samples/shields/npm13xx_ek/sample.yaml | 17 +++ .../{npm1300_ek => npm13xx_ek}/src/main.c | 30 +++-- 17 files changed, 348 insertions(+), 113 deletions(-) create mode 100644 boards/shields/npm1304_ek/Kconfig.shield create mode 100644 boards/shields/npm1304_ek/doc/index.rst create mode 100644 boards/shields/npm1304_ek/npm1304_ek.overlay create mode 100644 boards/shields/npm1304_ek/shield.yml delete mode 100644 samples/shields/npm1300_ek/CMakeLists.txt delete mode 100644 samples/shields/npm1300_ek/doc/index.rst delete mode 100644 samples/shields/npm1300_ek/sample.yaml create mode 100644 samples/shields/npm13xx_ek/CMakeLists.txt create mode 100644 samples/shields/npm13xx_ek/boards/nrf52dk_nrf52832.overlay create mode 100644 samples/shields/npm13xx_ek/doc/index.rst rename samples/shields/{npm1300_ek/nrf52dk_nrf52832.overlay => npm13xx_ek/npm1300.overlay} (88%) create mode 100644 samples/shields/npm13xx_ek/npm1304.overlay rename samples/shields/{npm1300_ek => npm13xx_ek}/prj.conf (100%) create mode 100644 samples/shields/npm13xx_ek/sample.yaml rename samples/shields/{npm1300_ek => npm13xx_ek}/src/main.c (81%) diff --git a/boards/shields/npm1300_ek/doc/index.rst b/boards/shields/npm1300_ek/doc/index.rst index 816c31a5fff3..5193523dde8c 100644 --- a/boards/shields/npm1300_ek/doc/index.rst +++ b/boards/shields/npm1300_ek/doc/index.rst @@ -22,10 +22,5 @@ Usage ***** The shield can be used in any application by setting ``--shield npm1300_ek`` -when invoking ``west build``. You can check :zephyr:code-sample:`npm1300_ek` for a +when invoking ``west build``. You can check :zephyr:code-sample:`npm13xx_ek` for a comprehensive sample. - -References -********** - -TBC diff --git a/boards/shields/npm1304_ek/Kconfig.shield b/boards/shields/npm1304_ek/Kconfig.shield new file mode 100644 index 000000000000..d86b2525d1ca --- /dev/null +++ b/boards/shields/npm1304_ek/Kconfig.shield @@ -0,0 +1,5 @@ +# Copyright (c) 2025 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config SHIELD_NPM1304_EK + def_bool $(shields_list_contains,npm1304_ek) diff --git a/boards/shields/npm1304_ek/doc/index.rst b/boards/shields/npm1304_ek/doc/index.rst new file mode 100644 index 000000000000..2c47ed1ffd60 --- /dev/null +++ b/boards/shields/npm1304_ek/doc/index.rst @@ -0,0 +1,30 @@ +.. _npm1304_ek: + +nPM1304 EK +########## + +Overview +******** + +The nPM1304 EK lets you test different functions and features of the nPM1304 +Power Management Integrated Circuit (PMIC). + +Requirements +************ + +The nPM1304 EK board is not a direct fit into an Arduino connector. However, +the Zephyr shield is expected to be connected to the Arduino shield connectors. +That is, you need to connect the I2C lines to the ``arduino_i2c`` bus. This allows to +use the shield with any host board that supports the Arduino connector. + +Usage +***** + +To use the shield in any application, build it with the following command: + +.. zephyr-app-commands:: + :board: your_board + :shield: npm1304_ek + :goals: build + +For a comprehensive sample, refer to :zephyr:code-sample:`npm13xx_ek`. diff --git a/boards/shields/npm1304_ek/npm1304_ek.overlay b/boards/shields/npm1304_ek/npm1304_ek.overlay new file mode 100644 index 000000000000..37e6961c5fdb --- /dev/null +++ b/boards/shields/npm1304_ek/npm1304_ek.overlay @@ -0,0 +1,86 @@ +/* + * Copyright (C) 2025 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include + +&arduino_i2c { + npm1304_ek_pmic: pmic@6b { + compatible = "nordic,npm1304"; + reg = <0x6b>; + + npm1304_ek_gpio: gpio-controller { + compatible = "nordic,npm1304-gpio"; + gpio-controller; + #gpio-cells = <2>; + ngpios = <5>; + }; + + npm1304_ek_regulators: regulators { + compatible = "nordic,npm1304-regulator"; + + /* limits are set to min/max allowed values */ + npm1304_ek_buck1: BUCK1 { + regulator-min-microvolt = <1000000>; + regulator-max-microvolt = <3300000>; + }; + + npm1304_ek_buck2: BUCK2 { + regulator-min-microvolt = <1000000>; + regulator-max-microvolt = <3300000>; + }; + + npm1304_ek_ldo1: LDO1 { + regulator-min-microvolt = <1000000>; + regulator-max-microvolt = <3300000>; + }; + + npm1304_ek_ldo2: LDO2 { + regulator-min-microvolt = <1000000>; + regulator-max-microvolt = <3300000>; + }; + }; + + npm1304_ek_charger: charger { + compatible = "nordic,npm1304-charger"; + term-microvolt = <4150000>; + term-warm-microvolt = <4000000>; + current-microamp = <4000>; + vbus-limit-microamp = <500000>; + thermistor-ohms = <10000>; + thermistor-beta = <3380>; + charging-enable; + }; + + npm1304_ek_buttons: buttons { + compatible = "gpio-keys"; + + pmic_button0: pmic_button_0 { + gpios = <&npm1304_ek_gpio 0 GPIO_ACTIVE_LOW>; + label = "Pmic button switch 0"; + zephyr,code = ; + }; + + pmic_button1: pmic_button_1 { + gpios = <&npm1304_ek_gpio 1 GPIO_ACTIVE_LOW>; + label = "Pmic button switch 1"; + zephyr,code = ; + }; + + pmic_button2: pmic_button_2 { + gpios = <&npm1304_ek_gpio 2 GPIO_ACTIVE_LOW>; + label = "Pmic button switch 2"; + zephyr,code = ; + }; + }; + + npm1304_ek_leds: leds { + compatible = "nordic,npm1304-led"; + nordic,led0-mode = "error"; + nordic,led1-mode = "charging"; + nordic,led2-mode = "host"; + }; + }; +}; diff --git a/boards/shields/npm1304_ek/shield.yml b/boards/shields/npm1304_ek/shield.yml new file mode 100644 index 000000000000..88e19fb84bea --- /dev/null +++ b/boards/shields/npm1304_ek/shield.yml @@ -0,0 +1,11 @@ +shield: + name: npm1304_ek + full_name: nPM1304 EK + vendor: nordic + supported_features: + - mfd + - input + - gpio + - led + - regulator + - sensor diff --git a/doc/_scripts/redirects.py b/doc/_scripts/redirects.py index 1c1e9e29942e..ba7525fbdb0b 100644 --- a/doc/_scripts/redirects.py +++ b/doc/_scripts/redirects.py @@ -302,6 +302,7 @@ ('samples/sensor/max44009/README', 'samples/sensor/light_polling/README'), ('samples/sensor/wsen_hids/README', 'samples/sensor/sensor'), ('samples/sensor/wsen_itds/README', 'samples/sensor/sensor'), + ('samples/shields/npm1300_ek/doc/index', 'samples/shields/npm13xx_ek/doc/index'), ('samples/subsys/video/capture/README', 'samples/drivers/video/capture/README'), ('samples/subsys/video/tcpserversink/README', 'samples/drivers/video/tcpserversink/README'), ('samples/subsys/video/video', 'samples/drivers/video/video'), diff --git a/samples/shields/npm1300_ek/CMakeLists.txt b/samples/shields/npm1300_ek/CMakeLists.txt deleted file mode 100644 index 09e4de1cc52e..000000000000 --- a/samples/shields/npm1300_ek/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright (c) 2023 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -cmake_minimum_required(VERSION 3.20.0) - -set(SHIELD npm1300_ek) - -find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) - -project(npm1300_ek) -target_sources(app PRIVATE src/main.c) diff --git a/samples/shields/npm1300_ek/doc/index.rst b/samples/shields/npm1300_ek/doc/index.rst deleted file mode 100644 index be2e8db34cf3..000000000000 --- a/samples/shields/npm1300_ek/doc/index.rst +++ /dev/null @@ -1,71 +0,0 @@ -.. zephyr:code-sample:: npm1300_ek - :name: nPM1300 EK - - Interact with the nPM1300 PMIC using the shell interface. - -Overview -******** - -This sample is provided for evaluation of the :ref:`npm1300_ek`. -The sample provides a shell interface to support the features of the -nPM1300 PMIC, including: - -- Regulators (BUCK1/2, LDO1/2) -- GPIO - -Requirements -************ - -The shield needs to be wired to a host board supporting the Arduino connector. - -Examples and images to follow - -Building and Running -******************** - -The sample is designed so that it can run on any platform. For example, when -building for the nRF52 DK, the following command can be used: - -.. zephyr-app-commands:: - :zephyr-app: samples/shields/npm1300_ek - :board: nrf52dk/nrf52832 - :goals: build - :compact: - -Note that this sample automatically sets ``SHIELD`` to ``npm1300_ek``. Once -flashed, you should boot into the shell interface. The ``regulator`` command is -provided to test the PMIC. Below you can find details for each subcommand. - -Regulators -========== - -The ``regulator`` shell interface provides several subcommand to test -the regulators embedded in the PMIC. Below you can find some command examples. - -.. code-block:: bash - - # list all the supported voltages by BUCK1 - regulator vlist BUCK1 - 1.000 V - 1.100 V - ... - -.. code-block:: bash - - # enable BUCK2 - regulator enable BUCK2 - # disable BUCK2 - regulator disable BUCK2 - -.. code-block:: bash - - # set BUCK2 voltage to exactly 2V - regulator vset BUCK2 2V - # obtain the actual BUCK1 configured voltage - regulator vget BUCK1 - 1.800 V - # set BUCK1 voltage to a value between 2.35V and 2.45V - regulator set BUCK1 2.35V 2.45V - # obtain the actual BUCK1 configured voltage - regulator get BUCK1 - 2.400 V diff --git a/samples/shields/npm1300_ek/sample.yaml b/samples/shields/npm1300_ek/sample.yaml deleted file mode 100644 index de89e80d79ea..000000000000 --- a/samples/shields/npm1300_ek/sample.yaml +++ /dev/null @@ -1,12 +0,0 @@ -# Copyright (c) 2023 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -sample: - name: nPM1300 EK -tests: - sample.shields.npm1300_ek: - platform_allow: nrf52dk/nrf52832 - harness: shield - tags: shield - extra_args: SHIELD=npm1300_ek - depends_on: arduino_i2c diff --git a/samples/shields/npm13xx_ek/CMakeLists.txt b/samples/shields/npm13xx_ek/CMakeLists.txt new file mode 100644 index 000000000000..f3432a12e0b6 --- /dev/null +++ b/samples/shields/npm13xx_ek/CMakeLists.txt @@ -0,0 +1,17 @@ +# Copyright (c) 2023 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) + +if(SHIELD STREQUAL "npm1300_ek") + set(EXTRA_DTC_OVERLAY_FILE npm1300.overlay) +elseif(SHIELD STREQUAL "npm1304_ek") + set(EXTRA_DTC_OVERLAY_FILE npm1304.overlay) +else() + message(FATAL_ERROR "either npm1300_ek or npm1304_ek must be selected with --shield") +endif() + +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) + +project(npm13xx_ek) +target_sources(app PRIVATE src/main.c) diff --git a/samples/shields/npm13xx_ek/boards/nrf52dk_nrf52832.overlay b/samples/shields/npm13xx_ek/boards/nrf52dk_nrf52832.overlay new file mode 100644 index 000000000000..14a68cf79128 --- /dev/null +++ b/samples/shields/npm13xx_ek/boards/nrf52dk_nrf52832.overlay @@ -0,0 +1,10 @@ +/* + * Copyright (C) 2023 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +&i2c0_default { + group1 { + bias-pull-up; + }; +}; diff --git a/samples/shields/npm13xx_ek/doc/index.rst b/samples/shields/npm13xx_ek/doc/index.rst new file mode 100644 index 000000000000..892e5f45a657 --- /dev/null +++ b/samples/shields/npm13xx_ek/doc/index.rst @@ -0,0 +1,110 @@ +.. zephyr:code-sample:: npm13xx_ek + :name: nPM13xx EK + + Interact with an nPM1300 or nPM1304 PMIC using the shell interface and buttons. + +Overview +******** + +This sample is provided for evaluation of :ref:`npm1300_ek` and :ref:`npm1304_ek`. The sample +demonstrates use of Dynamic Voltage Scaling (DVS) regulator API feature which allows to switch +between chosen voltage levels or regulator modes by toggling configured GPIOs with a single +regulator API call. + +It also provides a shell interface to support the features of the nPM1300 and nPM1304 PMICs, +including: + +- Regulators (BUCK1/2, LDO1/2) +- GPIO + +Requirements +************ + +The shield needs to be wired to a host board featuring the Arduino I2C connector. PMIC's GPIO3 acts +as an interrupt output, pins GPIO1 and GPIO2 are configured to control regulator modes (controlled +by the MCU software through DVS). + +In addition, PMIC's VDDIO pin should be connected to an appropriate voltage reference. + +E.g. for an nRF52 Series DK the wiring is as follows: + + +------------------+-------+-------+-------+-------+-------+-------+-----+ + | nPM13xx EK pins | SDA | SCL | GPIO1 | GPIO2 | GPIO3 | VDDIO | GND | + +------------------+-------+-------+-------+-------+-------+-------+-----+ + | nRF52 DK pins | P0.26 | P0.27 | P0.17 | P0.18 | P0.22 | VDD | GND | + +------------------+-------+-------+-------+-------+-------+-------+-----+ + +Building and Running +******************** + +The sample is designed so that it can run on any platform (references to host GPIOs connected to +the nPM13xx EK need to be updated in the ``npm13xx.overlay`` files to reflect chosen HW). + +For example, when building for the nRF52 DK and the nPM1300 EK, the following command can be used: + +.. zephyr-app-commands:: + :zephyr-app: samples/shields/npm13xx_ek + :board: nrf52dk/nrf52832 + :shield: npm1300_ek + :goals: build + :compact: + +Testing +******* + +After flashing the sample FW, you need to connect to the shell interface, where in case of +successful initialization you will see the nPM13xx PMIC status messages containing charger status +and battery voltage, current and temperature. Pressing and releasing the SHPHLD button on the EK +will generate interrupts and these events will also be printed in the shell. + +Pressing a dedicated button on the host DK (Button 1 on an nRF52 Series DK) will cycle DVS states. + + +-------------------------------------+----------------+---------------+---------------+ + | **DVS state** (GPIO1 | GPIO2 level) | **BUCK2 mode** | **LDO1 mode** | **LDO2 mode** | + +-------------------------------------+----------------+---------------+---------------+ + | **0** (HIGH | HIGH) | OFF | OFF | OFF | + +-------------------------------------+----------------+---------------+---------------+ + | **1** (LOW | HIGH) | ON retention | OFF | OFF | + +-------------------------------------+----------------+---------------+---------------+ + | **2** (HIGH | LOW) | OFF | ON | ON | + +-------------------------------------+----------------+---------------+---------------+ + | **3** (LOW | LOW) | ON PWM | ON | ON | + +-------------------------------------+----------------+---------------+---------------+ + +.. note:: + On an nRF52 Series DK, DVS pins are also used for the onboard LED1 and LED2, so you can observe + the DVS state pins visually: an LED lights up when the respective pin is LOW + +Regulators +********** + +The ``regulator`` shell interface provides several subcommand to test +the regulators embedded in the PMIC. Below you can find some command examples. + +.. code-block:: console + + # list all the supported voltages by BUCK1 + uart:~$ regulator vlist BUCK1 + 1.000 V + 1.100 V + ... + +.. code-block:: console + + # enable BUCK2 + uart:~$ regulator enable BUCK2 + # disable BUCK2 + uart:~$ regulator disable BUCK2 + +.. code-block:: console + + # set BUCK2 voltage to exactly 2V + uart:~$ regulator vset BUCK2 2V + # obtain the actual BUCK1 configured voltage + uart:~$ regulator vget BUCK1 + 1.800 V + # set BUCK1 voltage to a value between 2.35V and 2.45V + uart:~$ regulator set BUCK1 2.35V 2.45V + # obtain the actual BUCK1 configured voltage + uart:~$ regulator get BUCK1 + 2.400 V diff --git a/samples/shields/npm1300_ek/nrf52dk_nrf52832.overlay b/samples/shields/npm13xx_ek/npm1300.overlay similarity index 88% rename from samples/shields/npm1300_ek/nrf52dk_nrf52832.overlay rename to samples/shields/npm13xx_ek/npm1300.overlay index e4f2cca20ce5..408c1b8715d0 100644 --- a/samples/shields/npm1300_ek/nrf52dk_nrf52832.overlay +++ b/samples/shields/npm13xx_ek/npm1300.overlay @@ -1,12 +1,7 @@ /* - * Copyright (C) 2023 Nordic Semiconductor ASA + * Copyright (C) 2025 Nordic Semiconductor ASA * SPDX-License-Identifier: Apache-2.0 */ - &i2c0_default { - group1 { - bias-pull-up; - }; -}; &npm1300_ek_regulators { dvs-gpios = <&gpio0 17 GPIO_ACTIVE_LOW>, diff --git a/samples/shields/npm13xx_ek/npm1304.overlay b/samples/shields/npm13xx_ek/npm1304.overlay new file mode 100644 index 000000000000..010c7d4897a1 --- /dev/null +++ b/samples/shields/npm13xx_ek/npm1304.overlay @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2025 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +&npm1304_ek_regulators { + dvs-gpios = <&gpio0 17 GPIO_ACTIVE_LOW>, + <&gpio0 18 GPIO_ACTIVE_LOW>; +}; + +&npm1304_ek_buck1 { + regulator-init-microvolt = <2000000>; +}; + +&npm1304_ek_buck2 { + regulator-init-microvolt = <3300000>; + retention-microvolt = <2500000>; + enable-gpio-config = <1 GPIO_ACTIVE_LOW>; + retention-gpio-config = <2 GPIO_ACTIVE_HIGH>; + pwm-gpio-config = <2 GPIO_ACTIVE_LOW>; +}; + +&npm1304_ek_ldo1 { + regulator-initial-mode = ; + enable-gpio-config = <2 GPIO_ACTIVE_LOW>; +}; + +&npm1304_ek_ldo2 { + regulator-initial-mode = ; + enable-gpio-config = <2 GPIO_ACTIVE_LOW>; +}; + +&npm1304_ek_pmic { + host-int-gpios = <&gpio0 22 0>; + pmic-int-pin = <3>; +}; diff --git a/samples/shields/npm1300_ek/prj.conf b/samples/shields/npm13xx_ek/prj.conf similarity index 100% rename from samples/shields/npm1300_ek/prj.conf rename to samples/shields/npm13xx_ek/prj.conf diff --git a/samples/shields/npm13xx_ek/sample.yaml b/samples/shields/npm13xx_ek/sample.yaml new file mode 100644 index 000000000000..98c68d54e32e --- /dev/null +++ b/samples/shields/npm13xx_ek/sample.yaml @@ -0,0 +1,17 @@ +# Copyright (c) 2023 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +sample: + name: nPM13xx EK +common: + platform_allow: nrf52dk/nrf52832 + depends_on: arduino_i2c + tags: + - shield + - regulator + - sensor +tests: + sample.shields.npm1300_ek: + extra_args: SHIELD=npm1300_ek + sample.shields.npm1304_ek: + extra_args: SHIELD=npm1304_ek diff --git a/samples/shields/npm1300_ek/src/main.c b/samples/shields/npm13xx_ek/src/main.c similarity index 81% rename from samples/shields/npm1300_ek/src/main.c rename to samples/shields/npm13xx_ek/src/main.c index 9ecffb69e219..0473c5662353 100644 --- a/samples/shields/npm1300_ek/src/main.c +++ b/samples/shields/npm13xx_ek/src/main.c @@ -19,15 +19,25 @@ #define SLEEP_TIME_MS 100 #define UPDATE_TIME_MS 2000 +#if CONFIG_SHIELD_NPM1300_EK +#define SHIELD_LABEL(component) DT_NODELABEL(npm1300_ek_ ## component) +#elif CONFIG_SHIELD_NPM1304_EK +#define SHIELD_LABEL(component) DT_NODELABEL(npm1304_ek_ ## component) +#else +#error "either npm1300_ek or npm1304_ek shield should be selected" +#endif + +#define NPM13XX_DEVICE(dev) DEVICE_DT_GET(SHIELD_LABEL(dev)) + static const struct gpio_dt_spec button1 = GPIO_DT_SPEC_GET(DT_ALIAS(sw0), gpios); -static const struct device *regulators = DEVICE_DT_GET(DT_NODELABEL(npm1300_ek_regulators)); +static const struct device *regulators = NPM13XX_DEVICE(regulators); -static const struct device *charger = DEVICE_DT_GET(DT_NODELABEL(npm1300_ek_charger)); +static const struct device *charger = NPM13XX_DEVICE(charger); -static const struct device *leds = DEVICE_DT_GET(DT_NODELABEL(npm1300_ek_leds)); +static const struct device *leds = NPM13XX_DEVICE(leds); -static const struct device *pmic = DEVICE_DT_GET(DT_NODELABEL(npm1300_ek_pmic)); +static const struct device *pmic = NPM13XX_DEVICE(pmic); void configure_ui(void) { @@ -53,9 +63,14 @@ void configure_ui(void) } } -static void event_callback(const struct device *dev, struct gpio_callback *cb, uint32_t pins) +static void event_callback(const struct device *dev, struct gpio_callback *cb, uint32_t events) { - printk("Event detected\n"); + if (events & BIT(NPM13XX_EVENT_SHIPHOLD_PRESS)) { + printk("SHPHLD pressed\n"); + } + if (events & BIT(NPM13XX_EVENT_SHIPHOLD_RELEASE)) { + printk("SHPHLD released\n"); + } } void configure_events(void) @@ -68,7 +83,8 @@ void configure_events(void) /* Setup callback for shiphold button press */ static struct gpio_callback event_cb; - gpio_init_callback(&event_cb, event_callback, BIT(NPM13XX_EVENT_SHIPHOLD_PRESS)); + gpio_init_callback(&event_cb, event_callback, BIT(NPM13XX_EVENT_SHIPHOLD_PRESS) | + BIT(NPM13XX_EVENT_SHIPHOLD_RELEASE)); mfd_npm13xx_add_callback(pmic, &event_cb); } From c8aad717b270ffbf924dad0e5d358a8fbdd0d1f0 Mon Sep 17 00:00:00 2001 From: Nikodem Kastelik Date: Wed, 12 Jun 2024 13:45:18 +0200 Subject: [PATCH 0397/2141] [nrf fromlist] tests: drivers: spi: controller_peripheral: add direct variant Direct variant of this test disables intermediate buffer in the nRF SPI driver and verifies whether devices like nRF54H20, which can peform DMA transcations only from specific memory regions, are handled properly. Upstream PR #: 93487 Signed-off-by: Nikodem Kastelik (cherry picked from commit bd191d84a40e9dd1ef42d2c08d6eecc0acf22978) --- tests/drivers/spi/spi_controller_peripheral/Kconfig | 7 +++++++ .../drivers/spi/spi_controller_peripheral/src/main.c | 9 ++++++--- .../spi/spi_controller_peripheral/testcase.yaml | 11 +++++++++++ 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/tests/drivers/spi/spi_controller_peripheral/Kconfig b/tests/drivers/spi/spi_controller_peripheral/Kconfig index f6472dae4abf..c98c3a27ff20 100644 --- a/tests/drivers/spi/spi_controller_peripheral/Kconfig +++ b/tests/drivers/spi/spi_controller_peripheral/Kconfig @@ -11,4 +11,11 @@ config TESTED_SPI_MODE 2: CPOL 1 (Active low), CPHA 0 (leading) 3: CPOL 1 (Active low), CPHA 1 (trailing) +config PREALLOC_BUFFERS + bool "Preallocate buffers" + default y + help + Preallocate buffers used for transaction + using `memory-region` property. + source "Kconfig.zephyr" diff --git a/tests/drivers/spi/spi_controller_peripheral/src/main.c b/tests/drivers/spi/spi_controller_peripheral/src/main.c index 04c6c27d11a7..7e15bb325368 100644 --- a/tests/drivers/spi/spi_controller_peripheral/src/main.c +++ b/tests/drivers/spi/spi_controller_peripheral/src/main.c @@ -41,9 +41,12 @@ static struct k_poll_event async_evt_spim = K_POLL_EVENT_INITIALIZER(K_POLL_TYPE_SIGNAL, K_POLL_MODE_NOTIFY_ONLY, &async_sig_spim); #define MEMORY_SECTION(node) \ - COND_CODE_1(DT_NODE_HAS_PROP(node, memory_regions), \ - (__attribute__((__section__( \ - LINKER_DT_NODE_REGION_NAME(DT_PHANDLE(node, memory_regions)))))), \ + COND_CODE_1(IS_ENABLED(CONFIG_PREALLOC_BUFFERS), \ + (COND_CODE_1(DT_NODE_HAS_PROP(node, memory_regions), \ + (__attribute__((__section__( \ + LINKER_DT_NODE_REGION_NAME(DT_PHANDLE(node, \ + memory_regions)))))), \ + ())), \ ()) static uint8_t spim_buffer[32] MEMORY_SECTION(DT_BUS(DT_NODELABEL(dut_spi_dt))); diff --git a/tests/drivers/spi/spi_controller_peripheral/testcase.yaml b/tests/drivers/spi/spi_controller_peripheral/testcase.yaml index f385c3073e92..5f243dd6cf68 100644 --- a/tests/drivers/spi/spi_controller_peripheral/testcase.yaml +++ b/tests/drivers/spi/spi_controller_peripheral/testcase.yaml @@ -117,3 +117,14 @@ tests: - nrf54h20dk/nrf54h20/cpuppr - nrf54l20pdk/nrf54l20/cpuapp - ophelia4ev/nrf54l15/cpuapp + + drivers.spi.direct_xfer: + extra_configs: + - CONFIG_SPI_NRFX_RAM_BUFFER_SIZE=0 + filter: CONFIG_SOC_FAMILY_NORDIC_NRF + + drivers.spi.direct_xfer.no_prealloc: + extra_configs: + - CONFIG_SPI_NRFX_RAM_BUFFER_SIZE=0 + - CONFIG_PREALLOC_BUFFERS=n + filter: CONFIG_SOC_FAMILY_NORDIC_NRF From 4ce95e842d6c97dd3ae374f2e93769c45f37314b Mon Sep 17 00:00:00 2001 From: Nikodem Kastelik Date: Thu, 24 Jul 2025 16:40:01 +0200 Subject: [PATCH 0398/2141] [nrf fromlist] drivers: spi: nrfx_spis: fix buffer freeing on error Bounce buffers should be freed rather than user buffers. Upstream PR #: 93487 Signed-off-by: Nikodem Kastelik (cherry picked from commit 5769fca8d368b8a29bd86135d54a6748da0bae4f) --- drivers/spi/spi_nrfx_spis.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi_nrfx_spis.c b/drivers/spi/spi_nrfx_spis.c index daa75d7e7fff..c6e551eafc32 100644 --- a/drivers/spi/spi_nrfx_spis.c +++ b/drivers/spi/spi_nrfx_spis.c @@ -243,9 +243,9 @@ static int prepare_for_transfer(const struct device *dev, return 0; buffers_set_failed: - dmm_buffer_in_release(dev_config->mem_reg, rx_buf, rx_buf_len, rx_buf); + dmm_buffer_in_release(dev_config->mem_reg, rx_buf, rx_buf_len, dmm_rx_buf); in_alloc_failed: - dmm_buffer_out_release(dev_config->mem_reg, (void *)tx_buf); + dmm_buffer_out_release(dev_config->mem_reg, (void *)dmm_tx_buf); out_alloc_failed: return err; } From 87b4e2ceea2b1195582054a2c3d00a7db6480def Mon Sep 17 00:00:00 2001 From: Piotr Krzyzanowski Date: Mon, 28 Jul 2025 16:09:39 +0200 Subject: [PATCH 0399/2141] [nrf fromlist] tests: drivers: pwm_gpio_loopback: Test improvement Improve corss-channel test by setting different duty cycle on channels. This modification will enable detection of inter-channel effects like crosstalk. Upstream PR #: 93776 Signed-off-by: Piotr Krzyzanowski (cherry picked from commit 0878bede6478adae0faebd357ba08a61420672b6) --- .../drivers/pwm/pwm_gpio_loopback/src/main.c | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/tests/drivers/pwm/pwm_gpio_loopback/src/main.c b/tests/drivers/pwm/pwm_gpio_loopback/src/main.c index 122189906344..d1552712cafe 100644 --- a/tests/drivers/pwm/pwm_gpio_loopback/src/main.c +++ b/tests/drivers/pwm/pwm_gpio_loopback/src/main.c @@ -234,16 +234,25 @@ ZTEST(pwm_gpio_loopback, test_pwm) ZTEST(pwm_gpio_loopback, test_pwm_cross) { + uint8_t duty[TEST_PWM_COUNT]; + const int duty_step = 25; + const int duty_variations = 5; + + /* Initial sweep with increasing duty cycles */ for (int i = 0; i < TEST_PWM_COUNT; i++) { - /* Test case: [Duty: 40%] */ - test_run(&pwms_dt[i], &gpios_dt[i], 40, true); + duty[i] = (i % duty_variations) * duty_step; + test_run(&pwms_dt[i], &gpios_dt[i], duty[i], true); } - /* Set all channels and check if they retain the original - * configuration without calling pwm_set again - */ - for (int i = 0; i < TEST_PWM_COUNT; i++) { - test_run(&pwms_dt[i], &gpios_dt[i], 40, false); + /* Repeat test with persistent config checks and rotated duty cycles */ + for (int j = 1; j < duty_variations; j++) { + for (int i = 0; i < TEST_PWM_COUNT; i++) { + test_run(&pwms_dt[i], &gpios_dt[i], duty[i], false); + } + for (int i = 0; i < TEST_PWM_COUNT; i++) { + duty[i] = ((j + i) % duty_variations) * duty_step; + test_run(&pwms_dt[i], &gpios_dt[i], duty[i], true); + } } } From 9fd04855d0ec375e7608cb4fc76351505be06640 Mon Sep 17 00:00:00 2001 From: Piotr Krzyzanowski Date: Mon, 28 Jul 2025 16:09:57 +0200 Subject: [PATCH 0400/2141] [nrf fromlist] tests: drivers: pwm_gpio_loopback: Add more channels Add more channels testing nrf platforms. Upstream PR #: 93776 Signed-off-by: Piotr Krzyzanowski (cherry picked from commit 99cbbba48c6dfaa603c195965ae1001c0c041372) --- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 32 ++++++++++++------- .../boards/nrf54l15dk_nrf54l15_cpuapp.overlay | 30 +++++++++++++++-- 2 files changed, 48 insertions(+), 14 deletions(-) diff --git a/tests/drivers/pwm/pwm_gpio_loopback/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/pwm/pwm_gpio_loopback/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index 8b5846df92d2..7eb6ff84af33 100644 --- a/tests/drivers/pwm/pwm_gpio_loopback/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/tests/drivers/pwm/pwm_gpio_loopback/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -4,45 +4,55 @@ * * Test requires wire connection between: * - PWM130 OUT[0] at P0.00 <-> GPIO input at P0.01 + * - PWM130 OUT[1] at P0.02 <-> GPIO input at P0.04 + * - PWM130 OUT[2] at P0.03 <-> GPIO input at P0.05 + * - PWM130 OUT[3] at P0.06 <-> GPIO input at P0.07 * - PWM120 OUT[0] at P7.00 <-> GPIO input at P1.09 - * - PWM120 OUT[1] at P7.01 <-> GPIO input at P1.05 */ / { zephyr,user { pwms = <&pwm130 0 160000 PWM_POLARITY_NORMAL>, - <&pwm120 0 80000 PWM_POLARITY_NORMAL>, - <&pwm120 1 80000 PWM_POLARITY_NORMAL>; + <&pwm130 1 160000 PWM_POLARITY_NORMAL>, + <&pwm130 2 160000 PWM_POLARITY_NORMAL>, + <&pwm130 3 160000 PWM_POLARITY_NORMAL>, + <&pwm120 0 80000 PWM_POLARITY_NORMAL>; gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>, - <&gpio1 9 GPIO_ACTIVE_HIGH>, - <&gpio1 5 GPIO_ACTIVE_HIGH>; + <&gpio0 4 GPIO_ACTIVE_HIGH>, + <&gpio0 5 GPIO_ACTIVE_HIGH>, + <&gpio0 7 GPIO_ACTIVE_HIGH>, + <&gpio1 9 GPIO_ACTIVE_HIGH>; }; }; &pinctrl { pwm130_default: pwm130_default { group1 { - psels = ; + psels = , + , + , + ; }; }; pwm130_sleep: pwm130_sleep { group1 { - psels = ; + psels = , + , + , + ; low-power-enable; }; }; pwm120_default: pwm120_default { group1 { - psels = , - ; + psels = ; }; }; pwm120_sleep: pwm120_sleep { group1 { - psels = , - ; + psels = ; low-power-enable; }; }; diff --git a/tests/drivers/pwm/pwm_gpio_loopback/boards/nrf54l15dk_nrf54l15_cpuapp.overlay b/tests/drivers/pwm/pwm_gpio_loopback/boards/nrf54l15dk_nrf54l15_cpuapp.overlay index 4ecece178922..69b0c8c5bed6 100644 --- a/tests/drivers/pwm/pwm_gpio_loopback/boards/nrf54l15dk_nrf54l15_cpuapp.overlay +++ b/tests/drivers/pwm/pwm_gpio_loopback/boards/nrf54l15dk_nrf54l15_cpuapp.overlay @@ -3,12 +3,36 @@ * SPDX-License-Identifier: Apache-2.0 * * Test requires jumper between: - * - PWM20 OUT[0] at P1.10 <-> GPIO input at P1.11 + * - PWM20 OUT[0] at P1.08 <-> GPIO input at P1.09 + * - PWM20 OUT[1] at P1.10 <-> GPIO input at P1.11 + * - PWM20 OUT[2] at P1.12 <-> GPIO input at P1.13 */ / { zephyr,user { - pwms = <&pwm20 0 160000 PWM_POLARITY_NORMAL>; - gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>; + pwms = <&pwm20 0 160000 PWM_POLARITY_NORMAL>, + <&pwm20 1 160000 PWM_POLARITY_NORMAL>, + <&pwm20 2 160000 PWM_POLARITY_NORMAL>; + gpios = <&gpio1 9 GPIO_ACTIVE_HIGH>, + <&gpio1 11 GPIO_ACTIVE_HIGH>, + <&gpio1 13 GPIO_ACTIVE_HIGH>; + }; +}; + +&pinctrl { + pwm20_default: pwm20_default { + group1 { + psels = , + , + ; + }; + }; + + pwm20_sleep: pwm20_sleep { + group1 { + psels = , + , + ; + }; }; }; From cd96efdf9c5ce474cbb592c17aa39c6cc47a83e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mo=C5=84?= Date: Fri, 11 Jul 2025 08:26:52 +0200 Subject: [PATCH 0401/2141] [nrf fromtree] samples: usb: uac2: implicit: Stop processing micophone data MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Stop processing microphone data on error or when streaming ends. This avoids I2S read timeouts due to audio data not being available while streaming. Signed-off-by: Tomasz Moń (cherry picked from commit 943fc6fd88c89c08a47a71b6139426574f38ac20) --- samples/subsys/usb/uac2_implicit_feedback/src/main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/samples/subsys/usb/uac2_implicit_feedback/src/main.c b/samples/subsys/usb/uac2_implicit_feedback/src/main.c index b7720fe03317..12abdf4fe681 100644 --- a/samples/subsys/usb/uac2_implicit_feedback/src/main.c +++ b/samples/subsys/usb/uac2_implicit_feedback/src/main.c @@ -93,6 +93,7 @@ static void uac2_terminal_update_cb(const struct device *dev, uint8_t terminal, !ctx->microphone_enabled) { i2s_trigger(ctx->i2s_dev, I2S_DIR_BOTH, I2S_TRIGGER_DROP); ctx->i2s_started = false; + ctx->rx_started = false; ctx->i2s_counter = 0; ctx->plus_ones = ctx->minus_ones = 0; if (ctx->pending_mic_samples) { @@ -172,6 +173,7 @@ static void uac2_data_recv_cb(const struct device *dev, uint8_t terminal, ret = i2s_write(ctx->i2s_dev, buf, size); if (ret < 0) { ctx->i2s_started = false; + ctx->rx_started = false; ctx->i2s_counter = 0; ctx->plus_ones = ctx->minus_ones = 0; if (ctx->pending_mic_samples) { From b000e11ccf58bacf48f189177d79ffc2297f66de Mon Sep 17 00:00:00 2001 From: Victor Brzeski Date: Thu, 5 Jun 2025 15:51:12 -0700 Subject: [PATCH 0402/2141] [nrf fromtree] usb: device_next: hid: Fix endpoint address getters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit resolves a bug where the USB Endpoint provided by the HID driver was incorrect when in High Speed mode. Signed-off-by: Victor Brzeski (cherry picked from commit c0e1268d9f185cb844346c47466f9985eec88e9a) Signed-off-by: Tomasz Moń --- subsys/usb/device_next/class/usbd_hid.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/subsys/usb/device_next/class/usbd_hid.c b/subsys/usb/device_next/class/usbd_hid.c index d5476a88ed69..d978aea0d27c 100644 --- a/subsys/usb/device_next/class/usbd_hid.c +++ b/subsys/usb/device_next/class/usbd_hid.c @@ -84,19 +84,29 @@ struct hid_device_data { static inline uint8_t hid_get_in_ep(struct usbd_class_data *const c_data) { + struct usbd_context *uds_ctx = usbd_class_get_ctx(c_data); const struct device *dev = usbd_class_get_private(c_data); const struct hid_device_config *dcfg = dev->config; struct usbd_hid_descriptor *desc = dcfg->desc; + if (USBD_SUPPORTS_HIGH_SPEED && usbd_bus_speed(uds_ctx) == USBD_SPEED_HS) { + return desc->hs_in_ep.bEndpointAddress; + } + return desc->in_ep.bEndpointAddress; } static inline uint8_t hid_get_out_ep(struct usbd_class_data *const c_data) { + struct usbd_context *uds_ctx = usbd_class_get_ctx(c_data); const struct device *dev = usbd_class_get_private(c_data); const struct hid_device_config *dcfg = dev->config; struct usbd_hid_descriptor *desc = dcfg->desc; + if (USBD_SUPPORTS_HIGH_SPEED && usbd_bus_speed(uds_ctx) == USBD_SPEED_HS) { + return desc->hs_out_ep.bEndpointAddress; + } + return desc->out_ep.bEndpointAddress; } From 102db0ae7a983108ce5cb012560dfd3fc4788986 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mo=C5=84?= Date: Wed, 23 Jul 2025 08:18:34 +0200 Subject: [PATCH 0403/2141] [nrf fromtree] usb: device_next: uac2: Remove unnecessary plus signs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change the macros to have only one plus operator per term. This is purely stylistic change, no functional changes. Signed-off-by: Tomasz Moń (cherry picked from commit 673f32428c1374979ba12116ef6d94a8a038527d) --- subsys/usb/device_next/class/usbd_uac2.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/subsys/usb/device_next/class/usbd_uac2.c b/subsys/usb/device_next/class/usbd_uac2.c index efa3fd6cdf32..0b08673abd24 100644 --- a/subsys/usb/device_next/class/usbd_uac2.c +++ b/subsys/usb/device_next/class/usbd_uac2.c @@ -26,9 +26,9 @@ LOG_MODULE_REGISTER(usbd_uac2, CONFIG_USBD_UAC2_LOG_LEVEL); #define COUNT_UAC2_AS_ENDPOINT_BUFFERS(node) \ IF_ENABLED(DT_NODE_HAS_COMPAT(node, zephyr_uac2_audio_streaming), ( \ - + AS_HAS_ISOCHRONOUS_DATA_ENDPOINT(node) + \ - + AS_IS_USB_ISO_IN(node) /* ISO IN double buffering */ + \ - AS_HAS_EXPLICIT_FEEDBACK_ENDPOINT(node))) + + AS_HAS_ISOCHRONOUS_DATA_ENDPOINT(node) \ + + AS_IS_USB_ISO_IN(node) /* ISO IN double buffering */ \ + + AS_HAS_EXPLICIT_FEEDBACK_ENDPOINT(node))) #define COUNT_UAC2_EP_BUFFERS(i) \ + DT_PROP(DT_DRV_INST(i), interrupt_endpoint) \ DT_INST_FOREACH_CHILD(i, COUNT_UAC2_AS_ENDPOINT_BUFFERS) From bd9592bb773cc04dfc7e1b848ff95c152363fa34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mo=C5=84?= Date: Fri, 11 Jul 2025 14:49:04 +0200 Subject: [PATCH 0404/2141] [nrf fromtree] usb: device_next: uac2: Double buffering on data OUT endpoints MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Enable double buffering on data OUT endpoints to allow USB stack to enqueue next transfer as soon as possible. This is especially useful when operating at High-Speed where there is significantly less time between subsequent SOF packets. Signed-off-by: Tomasz Moń (cherry picked from commit 2f343bf572a1f05b8bf73e9a0d8a55b9cf0a8d30) --- subsys/usb/device_next/class/usbd_uac2.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/subsys/usb/device_next/class/usbd_uac2.c b/subsys/usb/device_next/class/usbd_uac2.c index 0b08673abd24..00a8fa5b826c 100644 --- a/subsys/usb/device_next/class/usbd_uac2.c +++ b/subsys/usb/device_next/class/usbd_uac2.c @@ -28,6 +28,7 @@ LOG_MODULE_REGISTER(usbd_uac2, CONFIG_USBD_UAC2_LOG_LEVEL); IF_ENABLED(DT_NODE_HAS_COMPAT(node, zephyr_uac2_audio_streaming), ( \ + AS_HAS_ISOCHRONOUS_DATA_ENDPOINT(node) \ + AS_IS_USB_ISO_IN(node) /* ISO IN double buffering */ \ + + AS_IS_USB_ISO_OUT(node) /* ISO OUT double buffering */ \ + AS_HAS_EXPLICIT_FEEDBACK_ENDPOINT(node))) #define COUNT_UAC2_EP_BUFFERS(i) \ + DT_PROP(DT_DRV_INST(i), interrupt_endpoint) \ @@ -348,6 +349,7 @@ static void schedule_iso_out_read(struct usbd_class_data *const c_data, const struct uac2_cfg *cfg = dev->config; struct uac2_ctx *ctx = dev->data; struct net_buf *buf; + atomic_t *queued_bits = &ctx->as_queued; void *data_buf; int as_idx = terminal_to_as_interface(dev, terminal); int ret; @@ -364,16 +366,19 @@ static void schedule_iso_out_read(struct usbd_class_data *const c_data, return; } - if (atomic_test_and_set_bit(&ctx->as_queued, as_idx)) { - /* Transfer already queued - do not requeue */ - return; + if (atomic_test_and_set_bit(queued_bits, as_idx)) { + queued_bits = &ctx->as_double; + if (atomic_test_and_set_bit(queued_bits, as_idx)) { + /* Transfer already double queued - nothing to do */ + return; + } } /* Prepare transfer to read audio OUT data from host */ data_buf = ctx->ops->get_recv_buf(dev, terminal, mps, ctx->user_data); if (!data_buf) { LOG_ERR("No data buffer for terminal %d", terminal); - atomic_clear_bit(&ctx->as_queued, as_idx); + atomic_clear_bit(queued_bits, as_idx); return; } @@ -386,7 +391,7 @@ static void schedule_iso_out_read(struct usbd_class_data *const c_data, */ ctx->ops->data_recv_cb(dev, terminal, data_buf, 0, ctx->user_data); - atomic_clear_bit(&ctx->as_queued, as_idx); + atomic_clear_bit(queued_bits, as_idx); return; } @@ -394,7 +399,7 @@ static void schedule_iso_out_read(struct usbd_class_data *const c_data, if (ret) { LOG_ERR("Failed to enqueue net_buf for 0x%02x", ep); net_buf_unref(buf); - atomic_clear_bit(&ctx->as_queued, as_idx); + atomic_clear_bit(queued_bits, as_idx); } } @@ -814,6 +819,10 @@ static int uac2_request(struct usbd_class_data *const c_data, struct net_buf *bu if (USB_EP_DIR_IS_OUT(ep)) { ctx->ops->data_recv_cb(dev, terminal, buf->__buf, buf->len, ctx->user_data); + if (buf->frags) { + ctx->ops->data_recv_cb(dev, terminal, buf->frags->__buf, + buf->frags->len, ctx->user_data); + } } else if (!is_feedback) { ctx->ops->buf_release_cb(dev, terminal, buf->__buf, ctx->user_data); if (buf->frags) { From d7181027a06dc72738383cb1ff38ace206d06db3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mo=C5=84?= Date: Fri, 11 Jul 2025 15:00:12 +0200 Subject: [PATCH 0405/2141] [nrf fromtree] usb: device_next: uac2: Do not leak buffer on failed enqueue MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Release receive buffer on failed endpoint enqueue. Signed-off-by: Tomasz Moń (cherry picked from commit f9ac3181ff02f738c142d8c1c5be0f403cdd3c86) --- subsys/usb/device_next/class/usbd_uac2.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/subsys/usb/device_next/class/usbd_uac2.c b/subsys/usb/device_next/class/usbd_uac2.c index 00a8fa5b826c..945970c18c51 100644 --- a/subsys/usb/device_next/class/usbd_uac2.c +++ b/subsys/usb/device_next/class/usbd_uac2.c @@ -399,6 +399,8 @@ static void schedule_iso_out_read(struct usbd_class_data *const c_data, if (ret) { LOG_ERR("Failed to enqueue net_buf for 0x%02x", ep); net_buf_unref(buf); + ctx->ops->data_recv_cb(dev, terminal, + data_buf, 0, ctx->user_data); atomic_clear_bit(queued_bits, as_idx); } } From 594ae1ce8da1737d8e5f3e4c95cbf65f4918cf46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mo=C5=84?= Date: Tue, 15 Jul 2025 11:26:56 +0200 Subject: [PATCH 0406/2141] [nrf fromtree] usb: device_next: uac2: Double buffering on feedback endpoint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Enable double buffering on isochronous feedback endpoint to avoid sending ZLP instead of feedback information. Signed-off-by: Tomasz Moń (cherry picked from commit 223d23a34d667f390a694b1b9ccccf6171c6cf88) --- subsys/usb/device_next/class/usbd_uac2.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/subsys/usb/device_next/class/usbd_uac2.c b/subsys/usb/device_next/class/usbd_uac2.c index 945970c18c51..3a53b5c5d217 100644 --- a/subsys/usb/device_next/class/usbd_uac2.c +++ b/subsys/usb/device_next/class/usbd_uac2.c @@ -29,7 +29,7 @@ LOG_MODULE_REGISTER(usbd_uac2, CONFIG_USBD_UAC2_LOG_LEVEL); + AS_HAS_ISOCHRONOUS_DATA_ENDPOINT(node) \ + AS_IS_USB_ISO_IN(node) /* ISO IN double buffering */ \ + AS_IS_USB_ISO_OUT(node) /* ISO OUT double buffering */ \ - + AS_HAS_EXPLICIT_FEEDBACK_ENDPOINT(node))) + + 2 * AS_HAS_EXPLICIT_FEEDBACK_ENDPOINT(node))) #define COUNT_UAC2_EP_BUFFERS(i) \ + DT_PROP(DT_DRV_INST(i), interrupt_endpoint) \ DT_INST_FOREACH_CHILD(i, COUNT_UAC2_AS_ENDPOINT_BUFFERS) @@ -88,6 +88,7 @@ struct uac2_ctx { atomic_t as_queued; atomic_t as_double; uint32_t fb_queued; + uint32_t fb_double; }; /* UAC2 device constant data */ @@ -441,7 +442,11 @@ static void write_explicit_feedback(struct usbd_class_data *const c_data, LOG_ERR("Failed to enqueue net_buf for 0x%02x", ep); net_buf_unref(buf); } else { - ctx->fb_queued |= BIT(as_idx); + if (ctx->fb_queued & BIT(as_idx)) { + ctx->fb_double |= BIT(as_idx); + } else { + ctx->fb_queued |= BIT(as_idx); + } } } @@ -813,7 +818,17 @@ static int uac2_request(struct usbd_class_data *const c_data, struct net_buf *bu terminal = cfg->as_terminals[as_idx]; if (is_feedback) { - ctx->fb_queued &= ~BIT(as_idx); + bool clear_double = buf->frags; + + if (ctx->fb_queued & BIT(as_idx)) { + ctx->fb_queued &= ~BIT(as_idx); + } else { + clear_double = true; + } + + if (clear_double) { + ctx->fb_double &= ~BIT(as_idx); + } } else if (!atomic_test_and_clear_bit(&ctx->as_queued, as_idx) || buf->frags) { atomic_clear_bit(&ctx->as_double, as_idx); } @@ -880,7 +895,7 @@ static void uac2_sof(struct usbd_class_data *const c_data) * for now to allow faster recovery (i.e. reduce workload to be * done during this frame). */ - if (ctx->fb_queued & BIT(as_idx)) { + if (ctx->fb_queued & ctx->fb_double & BIT(as_idx)) { continue; } From b04c3d73d9b44d3db3f82102a4a36753a942bca9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mo=C5=84?= Date: Tue, 15 Jul 2025 11:04:13 +0200 Subject: [PATCH 0407/2141] [nrf fromtree] drivers: udc_dwc2: Rearm isochronous OUT endpoints during incompisoout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rearm isochronous endpoints when handling incomplete iso out interrupt to make it possible to rearm the endpoint in time (before SOF), especially when operating at High-Speed. Signed-off-by: Tomasz Moń (cherry picked from commit 6eb2fa8eddd1a238878efb8f2dbeaf9d00d1c250) --- drivers/usb/udc/udc_dwc2.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/usb/udc/udc_dwc2.c b/drivers/usb/udc/udc_dwc2.c index fca8f607ec74..599dfcd8b5d7 100644 --- a/drivers/usb/udc/udc_dwc2.c +++ b/drivers/usb/udc/udc_dwc2.c @@ -121,6 +121,7 @@ struct udc_dwc2_data { /* Isochronous endpoint enabled (IN on bits 0-15, OUT on bits 16-31) */ uint32_t iso_enabled; uint16_t iso_in_rearm; + uint16_t iso_out_rearm; uint16_t ep_out_disable; uint16_t ep_out_stall; uint16_t txf_set; @@ -2776,6 +2777,7 @@ static inline void dwc2_handle_oepint(const struct device *dev) while (epint) { uint8_t n = find_lsb_set(epint) - 1; mem_addr_t doepint_reg = (mem_addr_t)&base->out_ep[n].doepint; + mem_addr_t doepctl_reg = (mem_addr_t)&base->out_ep[n].doepctl; uint32_t doepint; uint32_t status; @@ -2828,7 +2830,20 @@ static inline void dwc2_handle_oepint(const struct device *dev) } if (status & USB_DWC2_DOEPINT_EPDISBLD) { + uint32_t doepctl = sys_read32(doepctl_reg); + k_event_post(&priv->ep_disabled, BIT(16 + n)); + + if ((usb_dwc2_get_depctl_eptype(doepctl) == USB_DWC2_DEPCTL_EPTYPE_ISO) && + (priv->iso_out_rearm & BIT(n))) { + struct udc_ep_config *cfg; + + /* Try to queue next packet before SOF */ + cfg = udc_get_ep_cfg(dev, n | USB_EP_DIR_OUT); + dwc2_handle_xfer_next(dev, cfg); + + priv->iso_out_rearm &= ~BIT(n); + } } epint &= ~BIT(n); @@ -2913,6 +2928,7 @@ static void dwc2_handle_incompisoout(const struct device *dev) ((priv->sof_num & 1) ? USB_DWC2_DEPCTL_DPID : 0) | USB_DWC2_DEPCTL_USBACTEP; uint32_t eps = (priv->iso_enabled & 0xFFFF0000UL) >> 16; + uint16_t rearm = 0; while (eps) { uint8_t i = find_lsb_set(eps) - 1; @@ -2935,12 +2951,17 @@ static void dwc2_handle_incompisoout(const struct device *dev) buf = udc_buf_get(cfg); if (buf) { udc_submit_ep_event(dev, buf, 0); + + rearm |= BIT(i); } } eps &= ~BIT(i); } + /* Mark endpoints to re-arm in EPDISBLD handler */ + priv->iso_out_rearm = rearm; + sys_write32(USB_DWC2_GINTSTS_INCOMPISOOUT, gintsts_reg); } From 424f0f92b93334678d77e3ccb22d307c3cd2e6c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mo=C5=84?= Date: Thu, 17 Jul 2025 10:20:34 +0200 Subject: [PATCH 0408/2141] [nrf fromtree] drivers: udc_dwc2: Fix incomplete iso handling race MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Incomplete iso IN/OUT is just informative and its occurrence does not prevent the endpoint from actually transmitting/receiving data. Such "late" isochronous transfers, which are perfectly fine according to USB specification, were observed on Windows host with nRF54H20 running explicit feedback sample operating at High-Speed. The incorrect handling manifested itself with "ISO RX buffer too small" error message. The faulty scenario was: * incompISOIN handler does not find any matching endpoint * incompISOOUT handler disables endpoint, discards buffer and sets rearm flag * next DWC2 interrupt handler iteration after reading GINTSTS * XferCompl interrupt on iso IN endpoint * XferCompl interrupt on iso OUT endpoint - transfer was actually happening to the buffer discarded in incompISOOUT handler - XferCompl handler modified the next buffer * GOUTNakEff interrupt, iso OUT endpoint EPDIS bit is set * EPDisbld interrupt, rearm flag set - the buffer modified by XferCompl is used and fails because it is not large enough Modify the sequence so it accounts for host actions and the above faulty scenario no longer causes any problems. Signed-off-by: Tomasz Moń (cherry picked from commit 8d1f7b3bef5fcbb63b8dab99f85320f02835fe63) --- drivers/usb/udc/udc_dwc2.c | 98 ++++++++++++++++++++++++++++---------- 1 file changed, 74 insertions(+), 24 deletions(-) diff --git a/drivers/usb/udc/udc_dwc2.c b/drivers/usb/udc/udc_dwc2.c index 599dfcd8b5d7..4ef5dc1825cb 100644 --- a/drivers/usb/udc/udc_dwc2.c +++ b/drivers/usb/udc/udc_dwc2.c @@ -141,6 +141,7 @@ struct udc_dwc2_data { unsigned int enumdone : 1; unsigned int enumspd : 2; unsigned int pending_dout_feed : 1; + unsigned int ignore_ep0_nakeff : 1; enum dwc2_suspend_type suspend_type; /* Number of endpoints including control endpoint */ uint8_t numdeveps; @@ -485,7 +486,6 @@ static int dwc2_tx_fifo_write(const struct device *dev, mem_addr_t dieptsiz_reg = (mem_addr_t)&base->in_ep[ep_idx].dieptsiz; /* TODO: use dwc2_get_dxepctl_reg() */ mem_addr_t diepctl_reg = (mem_addr_t)&base->in_ep[ep_idx].diepctl; - mem_addr_t diepint_reg = (mem_addr_t)&base->in_ep[ep_idx].diepint; uint32_t diepctl; uint32_t max_xfersize, max_pktcnt, pktcnt; @@ -617,9 +617,6 @@ static int dwc2_tx_fifo_write(const struct device *dev, } sys_write32(diepctl, diepctl_reg); - /* Clear IN Endpoint NAK Effective interrupt in case it was set */ - sys_write32(USB_DWC2_DIEPINT_INEPNAKEFF, diepint_reg); - if (dwc2_in_completer_mode(dev)) { const uint8_t *src = buf->data; @@ -811,7 +808,20 @@ static void dwc2_handle_xfer_next(const struct device *dev, if (USB_EP_DIR_IS_OUT(cfg->addr)) { dwc2_prep_rx(dev, buf, cfg); } else { - int err = dwc2_tx_fifo_write(dev, cfg, buf); + int err; + + if (cfg->addr == USB_CONTROL_EP_IN && + udc_ctrl_stage_is_status_in(dev)) { + /* It was observed that EPENA results in INEPNAKEFF + * interrupt which leads to endpoint disable. It is not + * clear how to prevent this without violating sequence + * described in Programming Guide, so just set a flag + * for interrupt handler to ignore it. + */ + priv->ignore_ep0_nakeff = 1; + } + + err = dwc2_tx_fifo_write(dev, cfg, buf); if (cfg->addr == USB_CONTROL_EP_IN) { /* Feed a buffer for the next setup packet after arming @@ -862,6 +872,7 @@ static int dwc2_handle_evt_setup(const struct device *dev) * transfer beforehand. In Buffer DMA the SETUP can be copied to any EP0 * OUT buffer. If there is any buffer queued, it is obsolete now. */ + priv->ignore_ep0_nakeff = 0; udc_dwc2_ep_disable(dev, cfg_in, false, true); atomic_and(&priv->xfer_finished, ~(BIT(0) | BIT(16))); @@ -2658,7 +2669,21 @@ static inline void dwc2_handle_iepint(const struct device *dev) } if (status & USB_DWC2_DIEPINT_INEPNAKEFF) { - sys_set_bits(diepctl_reg, USB_DWC2_DEPCTL_EPDIS); + uint32_t diepctl = sys_read32(diepctl_reg); + + if (!(diepctl & USB_DWC2_DEPCTL_NAKSTS)) { + /* Ignore stale NAK effective interrupt */ + } else if (n == 0 && priv->ignore_ep0_nakeff) { + /* Status stage enabled endpoint. NAK will be + * cleared in STSPHSERCVD interrupt. + */ + } else if (diepctl & USB_DWC2_DEPCTL_EPENA) { + diepctl &= ~USB_DWC2_DEPCTL_EPENA; + diepctl |= USB_DWC2_DEPCTL_EPDIS; + sys_write32(diepctl, diepctl_reg); + } else if (priv->iso_in_rearm & (BIT(n))) { + priv->iso_in_rearm &= ~BIT(n); + } } if (status & USB_DWC2_DIEPINT_EPDISBLD) { @@ -2676,6 +2701,13 @@ static inline void dwc2_handle_iepint(const struct device *dev) if ((usb_dwc2_get_depctl_eptype(diepctl) == USB_DWC2_DEPCTL_EPTYPE_ISO) && (priv->iso_in_rearm & BIT(n))) { struct udc_ep_config *cfg = udc_get_ep_cfg(dev, n | USB_EP_DIR_IN); + struct net_buf *buf; + + /* Data is no longer relevant, discard it */ + buf = udc_buf_get(cfg); + if (buf) { + udc_submit_ep_event(dev, buf, 0); + } /* Try to queue next packet before SOF */ dwc2_handle_xfer_next(dev, cfg); @@ -2837,9 +2869,17 @@ static inline void dwc2_handle_oepint(const struct device *dev) if ((usb_dwc2_get_depctl_eptype(doepctl) == USB_DWC2_DEPCTL_EPTYPE_ISO) && (priv->iso_out_rearm & BIT(n))) { struct udc_ep_config *cfg; + struct net_buf *buf; - /* Try to queue next packet before SOF */ cfg = udc_get_ep_cfg(dev, n | USB_EP_DIR_OUT); + + /* Discard disabled transfer buffer */ + buf = udc_buf_get(cfg); + if (buf) { + udc_submit_ep_event(dev, buf, 0); + } + + /* Try to queue next packet before SOF */ dwc2_handle_xfer_next(dev, cfg); priv->iso_out_rearm &= ~BIT(n); @@ -2883,7 +2923,6 @@ static void dwc2_handle_incompisoin(const struct device *dev) /* Check if endpoint didn't receive ISO IN data */ if ((diepctl & mask) == val) { struct udc_ep_config *cfg; - struct net_buf *buf; cfg = udc_get_ep_cfg(dev, i | USB_EP_DIR_IN); __ASSERT_NO_MSG(cfg && cfg->stat.enabled && @@ -2891,13 +2930,7 @@ static void dwc2_handle_incompisoin(const struct device *dev) udc_dwc2_ep_disable(dev, cfg, false, false); - buf = udc_buf_get(cfg); - if (buf) { - /* Data is no longer relevant */ - udc_submit_ep_event(dev, buf, 0); - - rearm |= BIT(i); - } + rearm |= BIT(i); } eps &= ~BIT(i); @@ -2940,7 +2973,6 @@ static void dwc2_handle_incompisoout(const struct device *dev) /* Check if endpoint didn't receive ISO OUT data */ if ((doepctl & mask) == val) { struct udc_ep_config *cfg; - struct net_buf *buf; cfg = udc_get_ep_cfg(dev, i); __ASSERT_NO_MSG(cfg && cfg->stat.enabled && @@ -2948,12 +2980,7 @@ static void dwc2_handle_incompisoout(const struct device *dev) udc_dwc2_ep_disable(dev, cfg, false, false); - buf = udc_buf_get(cfg); - if (buf) { - udc_submit_ep_event(dev, buf, 0); - - rearm |= BIT(i); - } + rearm |= BIT(i); } eps &= ~BIT(i); @@ -2984,8 +3011,31 @@ static void dwc2_handle_goutnakeff(const struct device *dev) doepctl_reg = (mem_addr_t)&base->out_ep[ep_idx].doepctl; doepctl = sys_read32(doepctl_reg); - /* The application cannot disable control OUT endpoint 0. */ - if (ep_idx != 0) { + if (!(doepctl & USB_DWC2_DEPCTL_EPENA)) { + /* While endpoint was enabled when application requested + * to disable it, there is a race window between setting + * DCTL SGOUTNAK bit and it becoming effective. During + * the window, it is possible for host to actually send + * OUT DATA packet ending the transfer which disables + * the endpoint. + * + * If we arrived here due to INCOMPISOOUT, clearing + * the rearm flag is enough. + */ + if (priv->iso_out_rearm & BIT(ep_idx)) { + priv->iso_out_rearm &= ~BIT(ep_idx); + } + + /* If application requested STALL then set it here, but + * otherwise there's nothing to do. + */ + if (!(priv->ep_out_stall & BIT(ep_idx))) { + continue; + } + } else if (ep_idx != 0) { + /* Only set EPDIS if EPENA is set, but do not set it for + * endpoint 0 which cannot be disabled by application. + */ doepctl |= USB_DWC2_DEPCTL_EPDIS; } From 2dd096115023603c781939e2a4dfb2ea4be3fdc0 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Wed, 11 Jun 2025 12:58:52 +0300 Subject: [PATCH 0409/2141] [nrf fromtree] net: dns: Allow reconfiguration with network interfaces Allow user to specify which network interfaces to bind the server to when reconfiguring the DNS system. Signed-off-by: Jukka Rissanen (cherry picked from commit 2af5dba9950c36a3ccd77e0f4b03b1af2a5057e6) Signed-off-by: Robert Lubos --- include/zephyr/net/dns_resolve.h | 26 ++++++++++++++++++++++++++ subsys/net/lib/dns/resolve.c | 20 ++++++++++++++++---- 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/include/zephyr/net/dns_resolve.h b/include/zephyr/net/dns_resolve.h index 3413a0083958..49043bd1733b 100644 --- a/include/zephyr/net/dns_resolve.h +++ b/include/zephyr/net/dns_resolve.h @@ -524,6 +524,32 @@ int dns_resolve_reconfigure(struct dns_resolve_context *ctx, const char *servers_str[], const struct sockaddr *servers_sa[]); +/** + * @brief Reconfigure DNS resolving context with new server list and + * allowing servers to be specified to a specific network interface. + * + * @param ctx DNS context + * @param servers_str DNS server addresses using textual strings. The + * array is NULL terminated. The port number can be given in the string. + * Syntax for the server addresses with or without port numbers: + * IPv4 : 10.0.9.1 + * IPv4 + port : 10.0.9.1:5353 + * IPv6 : 2001:db8::22:42 + * IPv6 + port : [2001:db8::22:42]:5353 + * @param servers_sa DNS server addresses as struct sockaddr. The array + * is NULL terminated. Port numbers are optional in struct sockaddr, the + * default will be used if set to 0. + * @param interfaces Network interfaces to which the DNS servers are bound. + * This is an array of network interface indices. The array must be + * the same length as the servers_str and servers_sa arrays. + * + * @return 0 if ok, <0 if error. + */ +int dns_resolve_reconfigure_with_interfaces(struct dns_resolve_context *ctx, + const char *servers_str[], + const struct sockaddr *servers_sa[], + int interfaces[]); + /** * @brief Cancel a pending DNS query. * diff --git a/subsys/net/lib/dns/resolve.c b/subsys/net/lib/dns/resolve.c index 813b7cd8f6c4..447d0a783225 100644 --- a/subsys/net/lib/dns/resolve.c +++ b/subsys/net/lib/dns/resolve.c @@ -1877,9 +1877,10 @@ static bool dns_servers_exists(struct dns_resolve_context *ctx, return true; } -int dns_resolve_reconfigure(struct dns_resolve_context *ctx, - const char *servers[], - const struct sockaddr *servers_sa[]) +int dns_resolve_reconfigure_with_interfaces(struct dns_resolve_context *ctx, + const char *servers[], + const struct sockaddr *servers_sa[], + int interfaces[]) { int err; @@ -1909,7 +1910,8 @@ int dns_resolve_reconfigure(struct dns_resolve_context *ctx, } } - err = dns_resolve_init_locked(ctx, servers, servers_sa, &resolve_svc, 0, NULL); + err = dns_resolve_init_locked(ctx, servers, servers_sa, + &resolve_svc, 0, interfaces); unlock: k_mutex_unlock(&ctx->lock); @@ -1917,6 +1919,16 @@ int dns_resolve_reconfigure(struct dns_resolve_context *ctx, return err; } +int dns_resolve_reconfigure(struct dns_resolve_context *ctx, + const char *servers[], + const struct sockaddr *servers_sa[]) +{ + return dns_resolve_reconfigure_with_interfaces(ctx, + servers, + servers_sa, + NULL); +} + struct dns_resolve_context *dns_resolve_get_default(void) { return &dns_default_ctx; From feb37b6e1b4e4a8111b4d1a5689b587cc6240846 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Wed, 11 Jun 2025 13:47:23 +0300 Subject: [PATCH 0410/2141] [nrf fromtree] net: dhcpv4: Honor network interface for DNS servers Bind the network interface to the network interface we have received the DNS servers from. This is now the default. The previous behavior can be restored by disabling the CONFIG_NET_DHCPV4_DNS_SERVER_VIA_INTERFACE option. Signed-off-by: Jukka Rissanen (cherry picked from commit 1224c5a43ad1025d5b2d2e5abbafa3e3258d2188) Signed-off-by: Robert Lubos --- subsys/net/lib/dhcpv4/Kconfig | 17 +++++++++++++++++ subsys/net/lib/dhcpv4/dhcpv4.c | 20 +++++++++++++++++++- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/subsys/net/lib/dhcpv4/Kconfig b/subsys/net/lib/dhcpv4/Kconfig index 52dcfc099b56..cf7603ae65a0 100644 --- a/subsys/net/lib/dhcpv4/Kconfig +++ b/subsys/net/lib/dhcpv4/Kconfig @@ -96,6 +96,23 @@ config NET_DHCPV4_OPTION_PRINT_IGNORED received and ignored. If this is not set, then we print these as unknown options. +config NET_DHCPV4_DNS_SERVER_VIA_INTERFACE + bool "Make DNS servers specific to the network interface" + depends on NET_DHCPV4_OPTION_DNS_ADDRESS + default y + help + If this is set, then if the system has multiple network interfaces + and each has DHCP enabled, then assign DNS servers received from that + network interface, to that specific interface. + If this option is not set, then any interface can be used for all + the configured DNS server addresses when doing DNS queries. + Example: We receive DNS server 192.0.2.53 DHCPv4 option from Wi-Fi + interface and DNS server 198.51.100.53 from Ethernet interface. + When this option is set, the DNS resolver will use DNS server + 192.0.2.53 when sending DNS query to the Wi-Fi interface and DNS + server 198.51.100.53 when sending DNS query to the Ethernet + interface. + endif # NET_DHCPV4 config NET_DHCPV4_SERVER diff --git a/subsys/net/lib/dhcpv4/dhcpv4.c b/subsys/net/lib/dhcpv4/dhcpv4.c index f7d7447b27dc..6dedcab3cd90 100644 --- a/subsys/net/lib/dhcpv4/dhcpv4.c +++ b/subsys/net/lib/dhcpv4/dhcpv4.c @@ -1171,7 +1171,25 @@ static bool dhcpv4_parse_options(struct net_pkt *pkt, for (uint8_t i = 0; i < dns_servers_cnt; i++) { dnses[i].sin_family = AF_INET; } - status = dns_resolve_reconfigure(ctx, NULL, dns_servers); + + if (IS_ENABLED(CONFIG_NET_DHCPV4_DNS_SERVER_VIA_INTERFACE)) { + /* If we are using the interface to resolve DNS servers, + * we need to save the interface index. + */ + int ifindex = net_if_get_by_iface(iface); + int interfaces[MAX_DNS_SERVERS]; + + for (uint8_t i = 0; i < dns_servers_cnt; i++) { + interfaces[i] = ifindex; + } + + status = dns_resolve_reconfigure_with_interfaces(ctx, NULL, + dns_servers, + interfaces); + } else { + status = dns_resolve_reconfigure(ctx, NULL, dns_servers); + } + if (status < 0) { NET_DBG("options_dns, failed to set " "resolve address: %d", status); From 564862d8c0479b1bb95aecd4e9864286ac83b239 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Thu, 12 Jun 2025 12:40:43 +0300 Subject: [PATCH 0411/2141] [nrf fromtree] net: dhcpv6: Honor network interface for DNS servers Bind the network interface to the network interface we have received the DNS servers from. This is now the default. The previous behavior can be restored by disabling the CONFIG_NET_DHCPV6_DNS_SERVER_VIA_INTERFACE option. Signed-off-by: Jukka Rissanen (cherry picked from commit 248cb3d25165a87f0b72931e1e860ecefed864f0) Signed-off-by: Robert Lubos --- subsys/net/lib/dhcpv6/Kconfig | 17 +++++++++++++++++ subsys/net/lib/dhcpv6/dhcpv6.c | 20 +++++++++++++++++++- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/subsys/net/lib/dhcpv6/Kconfig b/subsys/net/lib/dhcpv6/Kconfig index dad049dac77a..7fda850ec5ee 100644 --- a/subsys/net/lib/dhcpv6/Kconfig +++ b/subsys/net/lib/dhcpv6/Kconfig @@ -31,6 +31,23 @@ config NET_DHCPV6_OPTION_DNS_ADDRESS option from the server, and if available, use obtained information to configure DNS resolver. +config NET_DHCPV6_DNS_SERVER_VIA_INTERFACE + bool "Make DNS servers specific to the network interface" + depends on NET_DHCPV6_OPTION_DNS_ADDRESS + default y + help + If this is set, then if the system has multiple network interfaces + and each has DHCP enabled, then assign DNS servers received from that + network interface, to that specific interface. + If this option is not set, then any interface can be used for all + the configured DNS server addresses when doing DNS queries. + Example: We receive DNS server 2001:db8::1:53 DHCPv6 option from Wi-Fi + interface and DNS server 2001:db8::2:53 from Ethernet interface. + When this option is set, the DNS resolver will use DNS server + 2001:db8::1:53 when sending DNS query to the Wi-Fi interface and DNS + server 2001:db8::2:53 when sending DNS query to the Ethernet + interface. + if NET_DHCPV6 module = NET_DHCPV6 module-dep = NET_LOG diff --git a/subsys/net/lib/dhcpv6/dhcpv6.c b/subsys/net/lib/dhcpv6/dhcpv6.c index 29dd652d428c..f5984273cc3d 100644 --- a/subsys/net/lib/dhcpv6/dhcpv6.c +++ b/subsys/net/lib/dhcpv6/dhcpv6.c @@ -1412,7 +1412,25 @@ static int dhcpv6_handle_dns_server_option(struct net_pkt *pkt) } ctx = dns_resolve_get_default(); - status = dns_resolve_reconfigure(ctx, NULL, dns_servers); + + if (IS_ENABLED(CONFIG_NET_DHCPV6_DNS_SERVER_VIA_INTERFACE)) { + /* If we are using the interface to resolve DNS servers, + * we need to save the interface index. + */ + int ifindex = net_if_get_by_iface(net_pkt_iface(pkt)); + int interfaces[MAX_DNS_SERVERS]; + + for (uint8_t i = 0; i < server_count; i++) { + interfaces[i] = ifindex; + } + + status = dns_resolve_reconfigure_with_interfaces(ctx, NULL, + dns_servers, + interfaces); + } else { + status = dns_resolve_reconfigure(ctx, NULL, dns_servers); + } + if (status < 0) { NET_DBG("Failed to reconfigure DNS resolver from DHCPv6 " "option: %d", status); From 4ca5fae37bd240dd1175e8e57b5cef86cdd0c0a7 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Thu, 12 Jun 2025 12:41:37 +0300 Subject: [PATCH 0412/2141] [nrf fromtree] net: dns: Properly cleanup DNS servers per network interface Make sure we cleanup only those DNS servers that belong to certain network interface when the interface goes down. Signed-off-by: Jukka Rissanen (cherry picked from commit cb9052459a5f021bdde92f2e6f1026f58e24e73f) Signed-off-by: Robert Lubos --- include/zephyr/net/dns_resolve.h | 10 + subsys/net/ip/Kconfig.stack | 1 + subsys/net/ip/ipv6_nbr.c | 6 +- subsys/net/lib/dhcpv4/dhcpv4.c | 10 + subsys/net/lib/dhcpv6/dhcpv6.c | 10 + subsys/net/lib/dns/Kconfig | 13 + subsys/net/lib/dns/resolve.c | 479 ++++++++++++++++----- tests/net/lib/dns_addremove/src/main.c | 20 +- tests/net/lib/dns_addremove/testcase.yaml | 3 + tests/net/lib/dns_dispatcher/src/main.c | 7 +- tests/net/lib/dns_dispatcher/testcase.yaml | 6 + 11 files changed, 435 insertions(+), 130 deletions(-) diff --git a/include/zephyr/net/dns_resolve.h b/include/zephyr/net/dns_resolve.h index 49043bd1733b..05ee7154d1cb 100644 --- a/include/zephyr/net/dns_resolve.h +++ b/include/zephyr/net/dns_resolve.h @@ -550,6 +550,16 @@ int dns_resolve_reconfigure_with_interfaces(struct dns_resolve_context *ctx, const struct sockaddr *servers_sa[], int interfaces[]); +/** + * @brief Remove servers from the DNS resolving context. + * + * @param ctx DNS context + * @param if_index Network interface from which the DNS servers are removed. + * + * @return 0 if ok, <0 if error. + */ +int dns_resolve_remove(struct dns_resolve_context *ctx, int if_index); + /** * @brief Cancel a pending DNS query. * diff --git a/subsys/net/ip/Kconfig.stack b/subsys/net/ip/Kconfig.stack index c02fe47bafcd..ed8853d13942 100644 --- a/subsys/net/ip/Kconfig.stack +++ b/subsys/net/ip/Kconfig.stack @@ -17,6 +17,7 @@ config NET_TX_STACK_SIZE config NET_RX_STACK_SIZE int "RX thread stack size" + default 1792 if DNS_RESOLVER default 1500 help Set the RX thread stack size in bytes. The RX thread is waiting diff --git a/subsys/net/ip/ipv6_nbr.c b/subsys/net/ip/ipv6_nbr.c index b64a73ed5378..19a0405f6ea8 100644 --- a/subsys/net/ip/ipv6_nbr.c +++ b/subsys/net/ip/ipv6_nbr.c @@ -2469,6 +2469,9 @@ static inline bool handle_ra_rdnss(struct net_pkt *pkt, uint8_t len) const struct sockaddr *dns_servers[] = { (struct sockaddr *)&dns, NULL }; + int interfaces[] = { + net_if_get_by_iface(net_pkt_iface(pkt)) + }; size_t rdnss_size; int ret; @@ -2505,7 +2508,8 @@ static inline bool handle_ra_rdnss(struct net_pkt *pkt, uint8_t len) /* TODO: Handle lifetime. */ ctx = dns_resolve_get_default(); - ret = dns_resolve_reconfigure(ctx, NULL, dns_servers); + ret = dns_resolve_reconfigure_with_interfaces(ctx, NULL, dns_servers, + interfaces); if (ret < 0) { NET_DBG("Failed to set RDNSS resolve address: %d", ret); } diff --git a/subsys/net/lib/dhcpv4/dhcpv4.c b/subsys/net/lib/dhcpv4/dhcpv4.c index 6dedcab3cd90..c475b1fb4d26 100644 --- a/subsys/net/lib/dhcpv4/dhcpv4.c +++ b/subsys/net/lib/dhcpv4/dhcpv4.c @@ -1668,6 +1668,16 @@ static void dhcpv4_iface_event_handler(struct net_mgmt_event_callback *cb, if (!net_if_ipv4_addr_rm(iface, &iface->config.dhcpv4.requested_ip)) { NET_DBG("Failed to remove addr from iface"); } + + /* Remove DNS servers as interface is gone. We only need to + * do this for this interface. If using global setting, the + * DNS servers are removed automatically when the interface + * comes back up. + */ + if (IS_ENABLED(CONFIG_NET_DHCPV4_DNS_SERVER_VIA_INTERFACE)) { + dns_resolve_remove(dns_resolve_get_default(), + net_if_get_by_iface(iface)); + } } } else if (mgmt_event == NET_EVENT_IF_UP) { NET_DBG("Interface %p coming up", iface); diff --git a/subsys/net/lib/dhcpv6/dhcpv6.c b/subsys/net/lib/dhcpv6/dhcpv6.c index f5984273cc3d..2e1441b0331e 100644 --- a/subsys/net/lib/dhcpv6/dhcpv6.c +++ b/subsys/net/lib/dhcpv6/dhcpv6.c @@ -2217,6 +2217,16 @@ static void dhcpv6_iface_event_handler(struct net_mgmt_event_callback *cb, if (mgmt_event == NET_EVENT_IF_DOWN) { NET_DBG("Interface %p going down", iface); dhcpv6_set_timeout(iface, UINT64_MAX); + + /* Remove DNS servers as interface is gone. We only need to + * do this for this interface. If using global setting, the + * DNS servers are removed automatically when the interface + * comes back up. + */ + if (IS_ENABLED(CONFIG_NET_DHCPV6_DNS_SERVER_VIA_INTERFACE)) { + dns_resolve_remove(dns_resolve_get_default(), + net_if_get_by_iface(iface)); + } } else if (mgmt_event == NET_EVENT_IF_UP) { NET_DBG("Interface %p coming up", iface); dhcpv6_enter_state(iface, NET_DHCPV6_INIT); diff --git a/subsys/net/lib/dns/Kconfig b/subsys/net/lib/dns/Kconfig index c3f3ba6bc998..a413f04f6567 100644 --- a/subsys/net/lib/dns/Kconfig +++ b/subsys/net/lib/dns/Kconfig @@ -121,6 +121,19 @@ config DNS_SERVER5 endif # DNS_SERVER_IP_ADDRESSES +config DNS_RECONFIGURE_CLEANUP + bool "Cleanup old DNS server entries when reconfiguring" + help + If calling dns_resolve_reconfigure() when new DNS servers + are being set, for example if receiving new ones from DHCP server, + remove the old entries before setting up the new ones. + If you have only one network interface, then this can be enabled. + If you have multiple network interfaces, then this should be disabled + because the later configuration update would remove the entries + set by the other network interface configuration. + The previous default in Zephyr 4.1 or earlier was to have this enabled. + The current default in Zephyr 4.2 is to disable this option. + config DNS_NUM_CONCUR_QUERIES int "Number of simultaneous DNS queries per one DNS context" default 1 diff --git a/subsys/net/lib/dns/resolve.c b/subsys/net/lib/dns/resolve.c index 447d0a783225..234d48ba8435 100644 --- a/subsys/net/lib/dns/resolve.c +++ b/subsys/net/lib/dns/resolve.c @@ -81,6 +81,7 @@ NET_BUF_POOL_DEFINE(dns_qname_pool, DNS_RESOLVER_BUF_CTR, DNS_CACHE_DEFINE(dns_cache, CONFIG_DNS_RESOLVER_CACHE_MAX_ENTRIES); #endif /* CONFIG_DNS_RESOLVER_CACHE */ +static K_MUTEX_DEFINE(lock); static int init_called; static struct dns_resolve_context dns_default_ctx; @@ -414,12 +415,86 @@ static int bind_to_iface(int sock, const struct sockaddr *addr, int if_index) return ret; } +static bool is_server_name_found(struct dns_resolve_context *ctx, + const char *server, size_t server_len, + const char *iface_str) +{ + ARRAY_FOR_EACH(ctx->servers, i) { + if (ctx->servers[i].dns_server.sa_family == AF_INET || + ctx->servers[i].dns_server.sa_family == AF_INET6) { + char addr_str[INET6_ADDRSTRLEN]; + size_t addr_len; + + if (net_addr_ntop(ctx->servers[i].dns_server.sa_family, + &net_sin(&ctx->servers[i].dns_server)->sin_addr, + addr_str, sizeof(addr_str)) < 0) { + continue; + } + + addr_len = strlen(addr_str); + if (addr_len != server_len || + strncmp(addr_str, server, server_len) != 0) { + continue; + } + + if (iface_str != NULL && ctx->servers[i].if_index > 0) { + char iface_name[IFNAMSIZ]; + + net_if_get_name(net_if_get_by_index( + ctx->servers[i].if_index), + iface_name, sizeof(iface_name)); + + if (strcmp(iface_name, iface_str) != 0) { + continue; + } + } + + return true; + } + } + + return false; +} + +static bool is_server_addr_found(struct dns_resolve_context *ctx, + const struct sockaddr *addr, + int if_index) +{ + ARRAY_FOR_EACH(ctx->servers, i) { + if (ctx->servers[i].dns_server.sa_family == addr->sa_family && + memcmp(&ctx->servers[i].dns_server, addr, + sizeof(ctx->servers[i].dns_server)) == 0) { + if (if_index == 0 || + (if_index > 0 && + ctx->servers[i].if_index != if_index)) { + continue; + } + + return true; + } + } + + return false; +} + +static int get_free_slot(struct dns_resolve_context *ctx) +{ + ARRAY_FOR_EACH(ctx->servers, i) { + if (ctx->servers[i].dns_server.sa_family == 0) { + return i; + } + } + + return -ENOENT; +} + /* Must be invoked with context lock held */ static int dns_resolve_init_locked(struct dns_resolve_context *ctx, const char *servers[], const struct sockaddr *servers_sa[], const struct net_socket_service_desc *svc, - uint16_t port, int interfaces[]) + uint16_t port, int interfaces[], + bool do_cleanup) { #if defined(CONFIG_NET_IPV6) struct sockaddr_in6 local_addr6 = { @@ -445,17 +520,20 @@ static int dns_resolve_init_locked(struct dns_resolve_context *ctx, return -ENOENT; } - if (ctx->state != DNS_RESOLVE_CONTEXT_INACTIVE) { - ret = -ENOTEMPTY; - goto fail; - } + if (do_cleanup) { + if (ctx->state != DNS_RESOLVE_CONTEXT_INACTIVE) { + ret = -ENOTEMPTY; + NET_DBG("DNS resolver context is not inactive (%d)", ctx->state); + goto fail; + } - ARRAY_FOR_EACH(ctx->servers, j) { - ctx->servers[j].sock = -1; - } + ARRAY_FOR_EACH(ctx->servers, j) { + ctx->servers[j].sock = -1; + } - ARRAY_FOR_EACH(ctx->fds, j) { - ctx->fds[j].fd = -1; + ARRAY_FOR_EACH(ctx->fds, j) { + ctx->fds[j].fd = -1; + } } /* If user has provided a list of servers in string format, then @@ -464,78 +542,146 @@ static int dns_resolve_init_locked(struct dns_resolve_context *ctx, * The interfaces parameter should point to an array that is the * the same length as the servers_sa parameter array. */ - if (servers) { - for (i = 0; idx < SERVER_COUNT && servers[i]; i++) { - const char *iface_str; - size_t server_len; - - struct sockaddr *addr = &ctx->servers[idx].dns_server; - - iface_str = strstr(servers[i], "%"); - if (iface_str) { - server_len = iface_str - servers[i]; - iface_str++; + for (i = 0; servers != NULL && idx < SERVER_COUNT && servers[i] != NULL; i++) { + const char *iface_str; + size_t server_len; + struct sockaddr *addr; + bool found; + + iface_str = strstr(servers[i], "%"); + if (iface_str != NULL) { + server_len = iface_str - servers[i]; + iface_str++; + + if (server_len == 0) { + NET_DBG("Empty server name"); + continue; + } - if (server_len == 0) { - NET_DBG("Empty server name"); - continue; - } + found = is_server_name_found(ctx, servers[i], + server_len, iface_str); + if (found) { + NET_DBG("Server %.*s already exists", + (int)server_len, servers[i]); + continue; + } - /* Skip empty interface name */ - if (iface_str[0] == '\0') { - ctx->servers[idx].if_index = 0; - iface_str = NULL; - } else { - ctx->servers[idx].if_index = - net_if_get_by_name(iface_str); - } + /* Figure out if there are free slots where to add + * the server. + */ + idx = get_free_slot(ctx); + if (idx < 0) { + NET_DBG("No free slots for server %.*s", + (int)server_len, servers[i]); + break; + } - } else { - server_len = strlen(servers[i]); + /* Skip empty interface name */ + if (iface_str[0] == '\0') { ctx->servers[idx].if_index = 0; + iface_str = NULL; + } else { + ctx->servers[idx].if_index = + net_if_get_by_name(iface_str); } - (void)memset(addr, 0, sizeof(*addr)); - - ret = net_ipaddr_parse(servers[i], server_len, addr); - if (!ret) { - if (servers[i] != NULL && servers[i][0] != '\0') { - NET_DBG("Invalid server address %.*s", - (int)server_len, servers[i]); - } + } else { + server_len = strlen(servers[i]); + if (server_len == 0) { + NET_DBG("Empty server name"); + continue; + } + found = is_server_name_found(ctx, servers[i], + server_len, NULL); + if (found) { + NET_DBG("Server %.*s already exists", + (int)server_len, servers[i]); continue; } - dns_postprocess_server(ctx, idx); + idx = get_free_slot(ctx); + if (idx < 0) { + NET_DBG("No free slots for server %.*s", + (int)server_len, servers[i]); + break; + } + } + + addr = &ctx->servers[idx].dns_server; + + (void)memset(addr, 0, sizeof(*addr)); + + ret = net_ipaddr_parse(servers[i], server_len, addr); + if (!ret) { + if (servers[i][0] != '\0') { + NET_DBG("Invalid server address %.*s", + (int)server_len, servers[i]); + } - NET_DBG("[%d] %.*s%s%s%s%s", i, (int)server_len, servers[i], - IS_ENABLED(CONFIG_MDNS_RESOLVER) ? - (ctx->servers[i].is_mdns ? " mDNS" : "") : "", - IS_ENABLED(CONFIG_LLMNR_RESOLVER) ? - (ctx->servers[i].is_llmnr ? " LLMNR" : "") : "", - iface_str != NULL ? " via " : "", - iface_str != NULL ? iface_str : ""); - idx++; + continue; } + + dns_postprocess_server(ctx, idx); + + NET_DBG("[%d] %.*s%s%s%s%s", i, (int)server_len, servers[i], + IS_ENABLED(CONFIG_MDNS_RESOLVER) ? + (ctx->servers[i].is_mdns ? " mDNS" : "") : "", + IS_ENABLED(CONFIG_LLMNR_RESOLVER) ? + (ctx->servers[i].is_llmnr ? " LLMNR" : "") : "", + iface_str != NULL ? " via " : "", + iface_str != NULL ? iface_str : ""); + idx++; } - if (servers_sa) { - for (i = 0; idx < SERVER_COUNT && servers_sa[i]; i++) { - memcpy(&ctx->servers[idx].dns_server, servers_sa[i], - sizeof(ctx->servers[idx].dns_server)); + for (i = 0; servers_sa != NULL && idx < SERVER_COUNT && servers_sa[i] != NULL; i++) { + char iface_str[IFNAMSIZ] = { 0 }; + bool found; - if (interfaces != NULL) { - ctx->servers[idx].if_index = interfaces[idx]; - } + found = is_server_addr_found(ctx, servers_sa[i], interfaces[i]); + if (found) { + NET_DBG("Server %s already exists", + net_sprint_addr(ctx->servers[i].dns_server.sa_family, + &net_sin(&ctx->servers[i].dns_server)->sin_addr)); + continue; + } - dns_postprocess_server(ctx, idx); - idx++; + /* Figure out if there are free slots where to add the server. + */ + idx = get_free_slot(ctx); + if (idx < 0) { + NET_DBG("No free slots for server %s", + net_sprint_addr(ctx->servers[i].dns_server.sa_family, + &net_sin(&ctx->servers[i].dns_server)->sin_addr)); + break; + } + + memcpy(&ctx->servers[idx].dns_server, servers_sa[i], + sizeof(ctx->servers[idx].dns_server)); + + if (interfaces != NULL) { + ctx->servers[idx].if_index = interfaces[i]; + + net_if_get_name(net_if_get_by_index(ctx->servers[idx].if_index), + iface_str, sizeof(iface_str)); } + + dns_postprocess_server(ctx, idx); + + NET_DBG("[%d] %s%s%s%s%s", i, + net_sprint_addr(servers_sa[i]->sa_family, + &net_sin(servers_sa[i])->sin_addr), + IS_ENABLED(CONFIG_MDNS_RESOLVER) ? + (ctx->servers[i].is_mdns ? " mDNS" : "") : "", + IS_ENABLED(CONFIG_LLMNR_RESOLVER) ? + (ctx->servers[i].is_llmnr ? " LLMNR" : "") : "", + interfaces != NULL ? " via " : "", + interfaces != NULL ? iface_str : ""); + idx++; } for (i = 0, count = 0; - i < SERVER_COUNT && ctx->servers[i].dns_server.sa_family; i++) { + i < SERVER_COUNT && ctx->servers[i].dns_server.sa_family != 0; i++) { if (ctx->servers[i].dns_server.sa_family == AF_INET6) { #if defined(CONFIG_NET_IPV6) @@ -571,6 +717,16 @@ static int dns_resolve_init_locked(struct dns_resolve_context *ctx, goto fail; } + if (ctx->servers[i].sock >= 0) { + /* Socket already exists, so skip it */ + NET_DBG("Socket %d already exists for %s", + ctx->servers[i].sock, + net_sprint_addr(ctx->servers[i].dns_server.sa_family, + &net_sin(&ctx->servers[i].dns_server)->sin_addr)); + count++; + continue; + } + ret = zsock_socket(ctx->servers[i].dns_server.sa_family, SOCK_DGRAM, IPPROTO_UDP); if (ret < 0) { @@ -589,6 +745,7 @@ static int dns_resolve_init_locked(struct dns_resolve_context *ctx, if (ret < 0) { zsock_close(ctx->servers[i].sock); ctx->servers[i].sock = -1; + ctx->servers[i].dns_server.sa_family = 0; continue; } @@ -637,6 +794,8 @@ static int dns_resolve_init_locked(struct dns_resolve_context *ctx, if (ret < 0) { NET_DBG("Cannot set %s to socket (%d)", "polling", ret); zsock_close(ctx->servers[i].sock); + ctx->servers[i].sock = -1; + ctx->servers[i].dns_server.sa_family = 0; continue; } @@ -695,20 +854,28 @@ int dns_resolve_init_with_svc(struct dns_resolve_context *ctx, const char *serve const struct net_socket_service_desc *svc, uint16_t port, int interfaces[]) { + int ret; + if (!ctx) { return -ENOENT; } - (void)memset(ctx, 0, sizeof(*ctx)); + k_mutex_lock(&lock, K_FOREVER); - (void)k_mutex_init(&ctx->lock); - ctx->state = DNS_RESOLVE_CONTEXT_INACTIVE; + /* Do cleanup only if we are starting the context for the first time */ + if (init_called == 0) { + (void)memset(ctx, 0, sizeof(*ctx)); - /* As this function is called only once during system init, there is no - * reason to acquire lock. - */ - return dns_resolve_init_locked(ctx, servers, servers_sa, svc, port, - interfaces); + (void)k_mutex_init(&ctx->lock); + ctx->state = DNS_RESOLVE_CONTEXT_INACTIVE; + } + + ret = dns_resolve_init_locked(ctx, servers, servers_sa, svc, port, + interfaces, true); + + k_mutex_unlock(&lock); + + return ret; } int dns_resolve_init(struct dns_resolve_context *ctx, const char *servers[], @@ -1739,10 +1906,51 @@ int dns_resolve_name(struct dns_resolve_context *ctx, user_data, timeout, true); } +static int dns_server_close(struct dns_resolve_context *ctx, + int server_idx) +{ + struct net_if *iface; + + if (ctx->servers[server_idx].sock < 0) { + return -ENOENT; + } + + (void)dns_dispatcher_unregister(&ctx->servers[server_idx].dispatcher); + + if (ctx->servers[server_idx].dns_server.sa_family == AF_INET6) { + iface = net_if_ipv6_select_src_iface( + &net_sin6(&ctx->servers[server_idx].dns_server)->sin6_addr); + } else { + iface = net_if_ipv4_select_src_iface( + &net_sin(&ctx->servers[server_idx].dns_server)->sin_addr); + } + + if (IS_ENABLED(CONFIG_NET_MGMT_EVENT_INFO)) { + net_mgmt_event_notify_with_info( + NET_EVENT_DNS_SERVER_DEL, + iface, + (void *)&ctx->servers[server_idx].dns_server, + sizeof(struct sockaddr)); + } else { + net_mgmt_event_notify(NET_EVENT_DNS_SERVER_DEL, iface); + } + + zsock_close(ctx->servers[server_idx].sock); + + ctx->servers[server_idx].sock = -1; + ctx->servers[server_idx].dns_server.sa_family = 0; + + ARRAY_FOR_EACH(ctx->fds, j) { + ctx->fds[j].fd = -1; + } + + return 0; +} + /* Must be invoked with context lock held */ static int dns_resolve_close_locked(struct dns_resolve_context *ctx) { - int i; + int i, ret; if (ctx->state != DNS_RESOLVE_CONTEXT_ACTIVE) { return -ENOENT; @@ -1762,44 +1970,10 @@ static int dns_resolve_close_locked(struct dns_resolve_context *ctx) k_mutex_unlock(&ctx->lock); for (i = 0; i < SERVER_COUNT; i++) { - struct net_if *iface; - - if (ctx->servers[i].sock < 0) { - continue; - } - - (void)dns_dispatcher_unregister(&ctx->servers[i].dispatcher); - - if (ctx->servers[i].dns_server.sa_family == AF_INET6) { - iface = net_if_ipv6_select_src_iface( - &net_sin6(&ctx->servers[i].dns_server)->sin6_addr); - } else { - iface = net_if_ipv4_select_src_iface( - &net_sin(&ctx->servers[i].dns_server)->sin_addr); - } - - if (IS_ENABLED(CONFIG_NET_MGMT_EVENT_INFO)) { - net_mgmt_event_notify_with_info( - NET_EVENT_DNS_SERVER_DEL, - iface, - (void *)&ctx->servers[i].dns_server, - sizeof(struct sockaddr)); - } else { - net_mgmt_event_notify(NET_EVENT_DNS_SERVER_DEL, - iface); - } - - zsock_close(ctx->servers[i].sock); - - ARRAY_FOR_EACH(ctx->fds, j) { - if (ctx->fds[j].fd == ctx->servers[i].sock) { - ctx->fds[j].fd = -1; - } + ret = dns_server_close(ctx, i); + if (ret < 0) { + NET_DBG("Cannot close DNS server %d (%d)", i, ret); } - - (void)dns_dispatcher_unregister(&ctx->servers[i].dispatcher); - - ctx->servers[i].sock = -1; } if (--init_called <= 0) { @@ -1877,10 +2051,11 @@ static bool dns_servers_exists(struct dns_resolve_context *ctx, return true; } -int dns_resolve_reconfigure_with_interfaces(struct dns_resolve_context *ctx, - const char *servers[], - const struct sockaddr *servers_sa[], - int interfaces[]) +static int do_dns_resolve_reconfigure(struct dns_resolve_context *ctx, + const char *servers[], + const struct sockaddr *servers_sa[], + int interfaces[], + bool do_close) { int err; @@ -1888,6 +2063,7 @@ int dns_resolve_reconfigure_with_interfaces(struct dns_resolve_context *ctx, return -ENOENT; } + k_mutex_lock(&lock, K_FOREVER); k_mutex_lock(&ctx->lock, K_FOREVER); if (dns_servers_exists(ctx, servers, servers_sa)) { @@ -1901,32 +2077,99 @@ int dns_resolve_reconfigure_with_interfaces(struct dns_resolve_context *ctx, goto unlock; } - if (ctx->state == DNS_RESOLVE_CONTEXT_ACTIVE) { + if (ctx->state == DNS_RESOLVE_CONTEXT_ACTIVE && + (do_close || init_called == 0)) { dns_resolve_cancel_all(ctx); err = dns_resolve_close_locked(ctx); if (err) { goto unlock; } + + /* Make sure we do fresh start once */ + do_close = true; } err = dns_resolve_init_locked(ctx, servers, servers_sa, - &resolve_svc, 0, interfaces); + &resolve_svc, 0, interfaces, + do_close); unlock: k_mutex_unlock(&ctx->lock); + k_mutex_unlock(&lock); return err; } +int dns_resolve_reconfigure_with_interfaces(struct dns_resolve_context *ctx, + const char *servers[], + const struct sockaddr *servers_sa[], + int interfaces[]) +{ + return do_dns_resolve_reconfigure(ctx, + servers, + servers_sa, + interfaces, + IS_ENABLED(CONFIG_DNS_RECONFIGURE_CLEANUP) ? + true : false); +} + int dns_resolve_reconfigure(struct dns_resolve_context *ctx, const char *servers[], const struct sockaddr *servers_sa[]) { - return dns_resolve_reconfigure_with_interfaces(ctx, - servers, - servers_sa, - NULL); + return do_dns_resolve_reconfigure(ctx, + servers, + servers_sa, + NULL, + IS_ENABLED(CONFIG_DNS_RECONFIGURE_CLEANUP) ? + true : false); +} + +int dns_resolve_remove(struct dns_resolve_context *ctx, int if_index) +{ + int i; + int ret = -ENOENT; + int st = 0; + + if (!ctx) { + return -ENOENT; + } + + if (if_index <= 0) { + /* If network interface index is 0, then do nothing. + * If your want to remove all the servers, then just call + * dns_resolve_close() directly. + */ + return -EINVAL; + } + + k_mutex_lock(&ctx->lock, K_FOREVER); + + for (i = 0; i < SERVER_COUNT; i++) { + if (ctx->servers[i].if_index != if_index) { + continue; + } + + ctx->servers[i].if_index = 0; + + /* See comment in dns_resolve_close_locked() about + * releasing the lock before closing the server socket. + */ + k_mutex_unlock(&ctx->lock); + + ret = dns_server_close(ctx, i); + + k_mutex_lock(&ctx->lock, K_FOREVER); + + if (ret < 0) { + st = ret; + } + } + + k_mutex_unlock(&ctx->lock); + + return st; } struct dns_resolve_context *dns_resolve_get_default(void) diff --git a/tests/net/lib/dns_addremove/src/main.c b/tests/net/lib/dns_addremove/src/main.c index eb8d25a5fa51..3ff9bb2aabe2 100644 --- a/tests/net/lib/dns_addremove/src/main.c +++ b/tests/net/lib/dns_addremove/src/main.c @@ -470,15 +470,17 @@ ZTEST(dns_addremove, test_dns_reconfigure_callback) zassert_equal(ret, 0, "Cannot reconfigure DNS server"); /* Wait for DNS removed callback after reconfiguring DNS */ - if (k_sem_take(&dns_removed, WAIT_TIME)) { - zassert_true(false, - "Timeout while waiting for DNS removed callback"); - } - - /* Wait for DNS added callback after reconfiguring DNS */ - if (k_sem_take(&dns_added, WAIT_TIME)) { - zassert_true(false, - "Timeout while waiting for DNS added callback"); + if (IS_ENABLED(CONFIG_DNS_RECONFIGURE_CLEANUP)) { + if (k_sem_take(&dns_removed, WAIT_TIME)) { + zassert_true(false, + "Timeout while waiting for DNS removed callback"); + } + + /* Wait for DNS added callback after reconfiguring DNS */ + if (k_sem_take(&dns_added, WAIT_TIME)) { + zassert_true(false, + "Timeout while waiting for DNS added callback"); + } } ret = dns_resolve_close(&resv_ipv4); diff --git a/tests/net/lib/dns_addremove/testcase.yaml b/tests/net/lib/dns_addremove/testcase.yaml index 5551a41cfbaa..a6f56003f46b 100644 --- a/tests/net/lib/dns_addremove/testcase.yaml +++ b/tests/net/lib/dns_addremove/testcase.yaml @@ -14,3 +14,6 @@ tests: net.dns.no_ipv4: extra_configs: - CONFIG_NET_IPV4=n + net.dns.addremove.reconfigure_cleanup: + extra_configs: + - CONFIG_DNS_RECONFIGURE_CLEANUP=y diff --git a/tests/net/lib/dns_dispatcher/src/main.c b/tests/net/lib/dns_dispatcher/src/main.c index 21e604660666..e0353e8ac1f7 100644 --- a/tests/net/lib/dns_dispatcher/src/main.c +++ b/tests/net/lib/dns_dispatcher/src/main.c @@ -175,11 +175,14 @@ static void *test_init(void) ZTEST(dns_dispatcher, test_dns_dispatcher) { struct dns_resolve_context *ctx; - int sock1, sock2 = -1; + int ret, sock1, sock2 = -1; ctx = dns_resolve_get_default(); - dns_resolve_init_default(ctx); + dns_resolve_close(ctx); + + ret = dns_resolve_init_default(ctx); + zassert_equal(ret, 0, "Cannot initialize DNS resolver (%d)", ret); sock1 = ctx->servers[0].sock; diff --git a/tests/net/lib/dns_dispatcher/testcase.yaml b/tests/net/lib/dns_dispatcher/testcase.yaml index 314097ece661..b3ffd7c64795 100644 --- a/tests/net/lib/dns_dispatcher/testcase.yaml +++ b/tests/net/lib/dns_dispatcher/testcase.yaml @@ -8,3 +8,9 @@ common: tests: net.dns.dispatch: min_ram: 21 + net.dns.dispatch.ctx_cleanup: + extra_configs: + - CONFIG_DNS_RECONFIGURE_CLEANUP=y + net.dns.dispatch.ctx_no_cleanup: + extra_configs: + - CONFIG_DNS_RECONFIGURE_CLEANUP=n From cfc8a779844ac270c8c99be6c288f2dd2a3174a5 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Thu, 12 Jun 2025 14:36:23 +0300 Subject: [PATCH 0413/2141] [nrf fromtree] net: dns: Add uninitialized state to resolver context Make sure that uninitialized state is 0 so that we can catch when the context is not initialized properly. Signed-off-by: Jukka Rissanen (cherry picked from commit 514cdd6b3a21e32565634316751ecc6ec72c17c6) Signed-off-by: Robert Lubos --- include/zephyr/net/dns_resolve.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/zephyr/net/dns_resolve.h b/include/zephyr/net/dns_resolve.h index 05ee7154d1cb..62781b518921 100644 --- a/include/zephyr/net/dns_resolve.h +++ b/include/zephyr/net/dns_resolve.h @@ -320,6 +320,7 @@ typedef void (*dns_resolve_cb_t)(enum dns_resolve_status status, /** @cond INTERNAL_HIDDEN */ enum dns_resolve_context_state { + DNS_RESOLVE_CONTEXT_UNINITIALIZED = 0, DNS_RESOLVE_CONTEXT_ACTIVE, DNS_RESOLVE_CONTEXT_DEACTIVATING, DNS_RESOLVE_CONTEXT_INACTIVE, From a7bc8d7f849701b991df0252373873bb85af6bfe Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Thu, 12 Jun 2025 13:18:28 +0300 Subject: [PATCH 0414/2141] [nrf fromtree] net: shell: conn: Print packet socket information correctly The "net conn" command printed AF_PACKET socket as AF_UNK(3). Fix this by printing "AF_PACKET" in this case. Signed-off-by: Jukka Rissanen (cherry picked from commit 57c452fb79a6189fb05eb9e984ad052a74d20012) Signed-off-by: Robert Lubos --- subsys/net/lib/shell/conn.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/subsys/net/lib/shell/conn.c b/subsys/net/lib/shell/conn.c index 32dc32fcf444..ca852f1d15d0 100644 --- a/subsys/net/lib/shell/conn.c +++ b/subsys/net/lib/shell/conn.c @@ -89,6 +89,8 @@ static void conn_handler_cb(struct net_conn *conn, void *user_data) } else if (conn->local_addr.sa_family == AF_UNSPEC) { snprintk(addr_local, sizeof(addr_local), "AF_UNSPEC"); + } else if (conn->local_addr.sa_family == AF_PACKET) { + snprintk(addr_local, sizeof(addr_local), "AF_PACKET"); } else { snprintk(addr_local, sizeof(addr_local), "AF_UNK(%d)", conn->local_addr.sa_family); From 939bc466cf7bf16a5339dab7f4ae19b3992a41a4 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Thu, 12 Jun 2025 16:53:49 +0300 Subject: [PATCH 0415/2141] [nrf fromtree] drivers: wifi: esp_at: Bind DNS to device net interface Make sure received DNS server information is bound to the wifi network interface. Signed-off-by: Jukka Rissanen (cherry picked from commit 0e57844b2d9544b096b9a3fa22bb4bbe91965009) Signed-off-by: Robert Lubos --- drivers/wifi/esp_at/esp.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/wifi/esp_at/esp.c b/drivers/wifi/esp_at/esp.c index c68ea98ee0f9..25c47412c4cc 100644 --- a/drivers/wifi/esp_at/esp.c +++ b/drivers/wifi/esp_at/esp.c @@ -490,18 +490,23 @@ static void esp_dns_work(struct k_work *work) struct dns_resolve_context *dnsctx; struct sockaddr_in *addrs = data->dns_addresses; const struct sockaddr *dns_servers[ESP_MAX_DNS + 1] = {}; + int interfaces[ESP_MAX_DNS]; size_t i; - int err; + int err, ifindex; + + ifindex = net_if_get_by_ifindex(data->net_iface); for (i = 0; i < ESP_MAX_DNS; i++) { if (!addrs[i].sin_addr.s_addr) { break; } dns_servers[i] = (struct sockaddr *) &addrs[i]; + interfaces[i] = ifindex; } dnsctx = dns_resolve_get_default(); - err = dns_resolve_reconfigure(dnsctx, NULL, dns_servers); + err = dns_resolve_reconfigure_with_interfaces(dnsctx, NULL, dns_servers, + interfaces); if (err) { LOG_ERR("Could not set DNS servers: %d", err); } From 1da2e9f7b65d9e013745bd2b17b22a5234396df0 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 16 Jun 2025 15:05:28 +0300 Subject: [PATCH 0416/2141] [nrf fromtree] net: ppp: Bind DNS to device ppp network interface Make sure received DNS server information is bound to the ppp network interface. Signed-off-by: Jukka Rissanen (cherry picked from commit 8704b3add72df1d1703c469b81e10ede68dce310) Signed-off-by: Robert Lubos --- subsys/net/l2/ppp/ipcp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/subsys/net/l2/ppp/ipcp.c b/subsys/net/l2/ppp/ipcp.c index 1cea54de2f39..f376a3997a3d 100644 --- a/subsys/net/l2/ppp/ipcp.c +++ b/subsys/net/l2/ppp/ipcp.c @@ -362,6 +362,8 @@ static void ipcp_set_dns_servers(struct ppp_fsm *fsm) (struct sockaddr *) &dns2, NULL }; + int ifindex = net_if_get_by_iface(ctx->iface); + int interfaces[2] = { ifindex, ifindex }; int ret; if (!dns1.sin_addr.s_addr) { @@ -373,7 +375,8 @@ static void ipcp_set_dns_servers(struct ppp_fsm *fsm) } dnsctx = dns_resolve_get_default(); - ret = dns_resolve_reconfigure(dnsctx, NULL, dns_servers); + ret = dns_resolve_reconfigure_with_interfaces(dnsctx, NULL, dns_servers, + interfaces); if (ret < 0) { NET_ERR("Could not set DNS servers"); return; From e4b17cd2922ce9e9f3fb1c708faa780c7ac1150b Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Tue, 24 Jun 2025 14:01:51 +0300 Subject: [PATCH 0417/2141] [nrf fromtree] net: dns: Save info about source when configuring DNS servers Remember which DNS server was added by a source like DHCPv4 or v6 message. This will allow system to remove DNS servers that were added by that source. Then when stopping for example DHCP, we can remove those specific DNS servers and not leaving DNS servers hanging in the system. Signed-off-by: Jukka Rissanen (cherry picked from commit cdc6c324d785742291460e742be261cb37705d65) Signed-off-by: Robert Lubos --- drivers/modem/hl7800.c | 3 +- drivers/wifi/esp_at/esp.c | 3 +- include/zephyr/net/dns_resolve.h | 38 +++++++++++++++- subsys/net/ip/ipv6_nbr.c | 3 +- subsys/net/l2/ppp/ipcp.c | 3 +- subsys/net/lib/dhcpv4/dhcpv4.c | 6 ++- subsys/net/lib/dhcpv6/dhcpv6.c | 6 ++- subsys/net/lib/dns/resolve.c | 61 +++++++++++++++++++++----- tests/net/lib/dns_addremove/src/main.c | 3 +- 9 files changed, 103 insertions(+), 23 deletions(-) diff --git a/drivers/modem/hl7800.c b/drivers/modem/hl7800.c index 58e4f663838d..330642906393 100644 --- a/drivers/modem/hl7800.c +++ b/drivers/modem/hl7800.c @@ -1966,7 +1966,8 @@ static void dns_work_cb(struct k_work *work) } } else { LOG_DBG("Reconfiguring DNS resolver"); - ret = dns_resolve_reconfigure(dnsCtx, (const char **)dns_servers_str, NULL); + ret = dns_resolve_reconfigure(dnsCtx, (const char **)dns_servers_str, NULL, + DNS_SOURCE_MANUAL); if (ret < 0) { LOG_ERR("dns_resolve_reconfigure fail (%d)", ret); retry = true; diff --git a/drivers/wifi/esp_at/esp.c b/drivers/wifi/esp_at/esp.c index 25c47412c4cc..427d548350bf 100644 --- a/drivers/wifi/esp_at/esp.c +++ b/drivers/wifi/esp_at/esp.c @@ -506,7 +506,8 @@ static void esp_dns_work(struct k_work *work) dnsctx = dns_resolve_get_default(); err = dns_resolve_reconfigure_with_interfaces(dnsctx, NULL, dns_servers, - interfaces); + interfaces, + DNS_SOURCE_MANUAL); if (err) { LOG_ERR("Could not set DNS servers: %d", err); } diff --git a/include/zephyr/net/dns_resolve.h b/include/zephyr/net/dns_resolve.h index 62781b518921..e8789e8621d0 100644 --- a/include/zephyr/net/dns_resolve.h +++ b/include/zephyr/net/dns_resolve.h @@ -42,6 +42,24 @@ enum dns_query_type { DNS_QUERY_TYPE_AAAA = 28 }; +/** + * Entity that added the DNS server. + */ +enum dns_server_source { + /** Source is unknown */ + DNS_SOURCE_UNKNOWN = 0, + /** Server information is added manually, for example by an application */ + DNS_SOURCE_MANUAL, + /** Server information is from DHCPv4 server */ + DNS_SOURCE_DHCPV4, + /** Server information is from DHCPv6 server */ + DNS_SOURCE_DHCPV6, + /** Server information is from IPv6 SLAAC (router advertisement) */ + DNS_SOURCE_IPV6_RA, + /** Server information is from PPP */ + DNS_SOURCE_PPP, +}; + /** Max size of the resolved name. */ #ifndef DNS_MAX_NAME_SIZE #define DNS_MAX_NAME_SIZE 20 @@ -345,6 +363,9 @@ struct dns_resolve_context { */ int if_index; + /** Source of the DNS server, e.g., manual, DHCPv4/6, etc. */ + enum dns_server_source source; + /** Is this server mDNS one */ uint8_t is_mdns : 1; @@ -518,12 +539,14 @@ int dns_resolve_close(struct dns_resolve_context *ctx); * @param servers_sa DNS server addresses as struct sockaddr. The array * is NULL terminated. Port numbers are optional in struct sockaddr, the * default will be used if set to 0. + * @param source Source of the DNS servers, e.g., manual, DHCPv4/6, etc. * * @return 0 if ok, <0 if error. */ int dns_resolve_reconfigure(struct dns_resolve_context *ctx, const char *servers_str[], - const struct sockaddr *servers_sa[]); + const struct sockaddr *servers_sa[], + enum dns_server_source source); /** * @brief Reconfigure DNS resolving context with new server list and @@ -543,13 +566,15 @@ int dns_resolve_reconfigure(struct dns_resolve_context *ctx, * @param interfaces Network interfaces to which the DNS servers are bound. * This is an array of network interface indices. The array must be * the same length as the servers_str and servers_sa arrays. + * @param source Source of the DNS servers, e.g., manual, DHCPv4/6, etc. * * @return 0 if ok, <0 if error. */ int dns_resolve_reconfigure_with_interfaces(struct dns_resolve_context *ctx, const char *servers_str[], const struct sockaddr *servers_sa[], - int interfaces[]); + int interfaces[], + enum dns_server_source source); /** * @brief Remove servers from the DNS resolving context. @@ -701,6 +726,15 @@ static inline int dns_cancel_addr_info(uint16_t dns_id) /** @cond INTERNAL_HIDDEN */ +/** + * @brief Get string representation of the DNS server source. + * + * @param source Source of the DNS server. + * + * @return String representation of the DNS server source. + */ +const char *dns_get_source_str(enum dns_server_source source); + /** * @brief Initialize DNS subsystem. */ diff --git a/subsys/net/ip/ipv6_nbr.c b/subsys/net/ip/ipv6_nbr.c index 19a0405f6ea8..1cf7e53ad489 100644 --- a/subsys/net/ip/ipv6_nbr.c +++ b/subsys/net/ip/ipv6_nbr.c @@ -2509,7 +2509,8 @@ static inline bool handle_ra_rdnss(struct net_pkt *pkt, uint8_t len) /* TODO: Handle lifetime. */ ctx = dns_resolve_get_default(); ret = dns_resolve_reconfigure_with_interfaces(ctx, NULL, dns_servers, - interfaces); + interfaces, + DNS_SOURCE_IPV6_RA); if (ret < 0) { NET_DBG("Failed to set RDNSS resolve address: %d", ret); } diff --git a/subsys/net/l2/ppp/ipcp.c b/subsys/net/l2/ppp/ipcp.c index f376a3997a3d..320b78a0c0c3 100644 --- a/subsys/net/l2/ppp/ipcp.c +++ b/subsys/net/l2/ppp/ipcp.c @@ -376,7 +376,8 @@ static void ipcp_set_dns_servers(struct ppp_fsm *fsm) dnsctx = dns_resolve_get_default(); ret = dns_resolve_reconfigure_with_interfaces(dnsctx, NULL, dns_servers, - interfaces); + interfaces, + DNS_SOURCE_PPP); if (ret < 0) { NET_ERR("Could not set DNS servers"); return; diff --git a/subsys/net/lib/dhcpv4/dhcpv4.c b/subsys/net/lib/dhcpv4/dhcpv4.c index c475b1fb4d26..5dce854aa905 100644 --- a/subsys/net/lib/dhcpv4/dhcpv4.c +++ b/subsys/net/lib/dhcpv4/dhcpv4.c @@ -1185,9 +1185,11 @@ static bool dhcpv4_parse_options(struct net_pkt *pkt, status = dns_resolve_reconfigure_with_interfaces(ctx, NULL, dns_servers, - interfaces); + interfaces, + DNS_SOURCE_DHCPV4); } else { - status = dns_resolve_reconfigure(ctx, NULL, dns_servers); + status = dns_resolve_reconfigure(ctx, NULL, dns_servers, + DNS_SOURCE_DHCPV4); } if (status < 0) { diff --git a/subsys/net/lib/dhcpv6/dhcpv6.c b/subsys/net/lib/dhcpv6/dhcpv6.c index 2e1441b0331e..d8b1e3d7a6dc 100644 --- a/subsys/net/lib/dhcpv6/dhcpv6.c +++ b/subsys/net/lib/dhcpv6/dhcpv6.c @@ -1426,9 +1426,11 @@ static int dhcpv6_handle_dns_server_option(struct net_pkt *pkt) status = dns_resolve_reconfigure_with_interfaces(ctx, NULL, dns_servers, - interfaces); + interfaces, + DNS_SOURCE_DHCPV6); } else { - status = dns_resolve_reconfigure(ctx, NULL, dns_servers); + status = dns_resolve_reconfigure(ctx, NULL, dns_servers, + DNS_SOURCE_DHCPV6); } if (status < 0) { diff --git a/subsys/net/lib/dns/resolve.c b/subsys/net/lib/dns/resolve.c index 234d48ba8435..2b8d6f975fb0 100644 --- a/subsys/net/lib/dns/resolve.c +++ b/subsys/net/lib/dns/resolve.c @@ -488,13 +488,34 @@ static int get_free_slot(struct dns_resolve_context *ctx) return -ENOENT; } +const char *dns_get_source_str(enum dns_server_source source) +{ + switch (source) { + case DNS_SOURCE_UNKNOWN: + return "unknown"; + case DNS_SOURCE_MANUAL: + return "manual"; + case DNS_SOURCE_DHCPV4: + __fallthrough; + case DNS_SOURCE_DHCPV6: + return "DHCP"; + case DNS_SOURCE_IPV6_RA: + return "IPv6 RA"; + case DNS_SOURCE_PPP: + return "PPP"; + } + + return ""; +} + /* Must be invoked with context lock held */ static int dns_resolve_init_locked(struct dns_resolve_context *ctx, const char *servers[], const struct sockaddr *servers_sa[], const struct net_socket_service_desc *svc, uint16_t port, int interfaces[], - bool do_cleanup) + bool do_cleanup, + enum dns_server_source source) { #if defined(CONFIG_NET_IPV6) struct sockaddr_in6 local_addr6 = { @@ -608,6 +629,8 @@ static int dns_resolve_init_locked(struct dns_resolve_context *ctx, } } + ctx->servers[idx].source = source; + addr = &ctx->servers[idx].dns_server; (void)memset(addr, 0, sizeof(*addr)); @@ -624,13 +647,16 @@ static int dns_resolve_init_locked(struct dns_resolve_context *ctx, dns_postprocess_server(ctx, idx); - NET_DBG("[%d] %.*s%s%s%s%s", i, (int)server_len, servers[i], + NET_DBG("[%d] %.*s%s%s%s%s%s%s%s", i, (int)server_len, servers[i], IS_ENABLED(CONFIG_MDNS_RESOLVER) ? (ctx->servers[i].is_mdns ? " mDNS" : "") : "", IS_ENABLED(CONFIG_LLMNR_RESOLVER) ? (ctx->servers[i].is_llmnr ? " LLMNR" : "") : "", iface_str != NULL ? " via " : "", - iface_str != NULL ? iface_str : ""); + iface_str != NULL ? iface_str : "", + source != DNS_SOURCE_UNKNOWN ? " (" : "", + source != DNS_SOURCE_UNKNOWN ? dns_get_source_str(source) : "", + source != DNS_SOURCE_UNKNOWN ? ")" : ""); idx++; } @@ -656,6 +682,8 @@ static int dns_resolve_init_locked(struct dns_resolve_context *ctx, break; } + ctx->servers[idx].source = source; + memcpy(&ctx->servers[idx].dns_server, servers_sa[i], sizeof(ctx->servers[idx].dns_server)); @@ -668,7 +696,7 @@ static int dns_resolve_init_locked(struct dns_resolve_context *ctx, dns_postprocess_server(ctx, idx); - NET_DBG("[%d] %s%s%s%s%s", i, + NET_DBG("[%d] %s%s%s%s%s%s%s%s", i, net_sprint_addr(servers_sa[i]->sa_family, &net_sin(servers_sa[i])->sin_addr), IS_ENABLED(CONFIG_MDNS_RESOLVER) ? @@ -676,7 +704,10 @@ static int dns_resolve_init_locked(struct dns_resolve_context *ctx, IS_ENABLED(CONFIG_LLMNR_RESOLVER) ? (ctx->servers[i].is_llmnr ? " LLMNR" : "") : "", interfaces != NULL ? " via " : "", - interfaces != NULL ? iface_str : ""); + interfaces != NULL ? iface_str : "", + source != DNS_SOURCE_UNKNOWN ? " (" : "", + source != DNS_SOURCE_UNKNOWN ? dns_get_source_str(source) : "", + source != DNS_SOURCE_UNKNOWN ? ")" : ""); idx++; } @@ -871,7 +902,7 @@ int dns_resolve_init_with_svc(struct dns_resolve_context *ctx, const char *serve } ret = dns_resolve_init_locked(ctx, servers, servers_sa, svc, port, - interfaces, true); + interfaces, true, DNS_SOURCE_UNKNOWN); k_mutex_unlock(&lock); @@ -2055,7 +2086,8 @@ static int do_dns_resolve_reconfigure(struct dns_resolve_context *ctx, const char *servers[], const struct sockaddr *servers_sa[], int interfaces[], - bool do_close) + bool do_close, + enum dns_server_source source) { int err; @@ -2092,7 +2124,8 @@ static int do_dns_resolve_reconfigure(struct dns_resolve_context *ctx, err = dns_resolve_init_locked(ctx, servers, servers_sa, &resolve_svc, 0, interfaces, - do_close); + do_close, + source); unlock: k_mutex_unlock(&ctx->lock); @@ -2104,26 +2137,30 @@ static int do_dns_resolve_reconfigure(struct dns_resolve_context *ctx, int dns_resolve_reconfigure_with_interfaces(struct dns_resolve_context *ctx, const char *servers[], const struct sockaddr *servers_sa[], - int interfaces[]) + int interfaces[], + enum dns_server_source source) { return do_dns_resolve_reconfigure(ctx, servers, servers_sa, interfaces, IS_ENABLED(CONFIG_DNS_RECONFIGURE_CLEANUP) ? - true : false); + true : false, + source); } int dns_resolve_reconfigure(struct dns_resolve_context *ctx, const char *servers[], - const struct sockaddr *servers_sa[]) + const struct sockaddr *servers_sa[], + enum dns_server_source source) { return do_dns_resolve_reconfigure(ctx, servers, servers_sa, NULL, IS_ENABLED(CONFIG_DNS_RECONFIGURE_CLEANUP) ? - true : false); + true : false, + source); } int dns_resolve_remove(struct dns_resolve_context *ctx, int if_index) diff --git a/tests/net/lib/dns_addremove/src/main.c b/tests/net/lib/dns_addremove/src/main.c index 3ff9bb2aabe2..1b6f55efd730 100644 --- a/tests/net/lib/dns_addremove/src/main.c +++ b/tests/net/lib/dns_addremove/src/main.c @@ -466,7 +466,8 @@ ZTEST(dns_addremove, test_dns_reconfigure_callback) "Timeout while waiting for DNS added callback"); } - ret = dns_resolve_reconfigure(&resv_ipv4, dns2_servers_str, NULL); + ret = dns_resolve_reconfigure(&resv_ipv4, dns2_servers_str, NULL, + DNS_SOURCE_MANUAL); zassert_equal(ret, 0, "Cannot reconfigure DNS server"); /* Wait for DNS removed callback after reconfiguring DNS */ From 0fff66f43b44a46715b1a9516b98fb8e05747775 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Tue, 24 Jun 2025 14:07:35 +0300 Subject: [PATCH 0418/2141] [nrf fromtree] net: dhcp: Remove only added DNS servers when stopping Make sure that we remove only the added DNS servers when the DHCP is stopped. Signed-off-by: Jukka Rissanen (cherry picked from commit 25084203c29ff5a259b4d161fce62c8c4cb2f323) Signed-off-by: Robert Lubos --- include/zephyr/net/dns_resolve.h | 13 +++++++++++++ subsys/net/lib/dhcpv4/dhcpv4.c | 11 +++++++++-- subsys/net/lib/dhcpv6/dhcpv6.c | 11 +++++++++-- subsys/net/lib/dns/resolve.c | 20 +++++++++++++++++++- 4 files changed, 50 insertions(+), 5 deletions(-) diff --git a/include/zephyr/net/dns_resolve.h b/include/zephyr/net/dns_resolve.h index e8789e8621d0..400af6b77e67 100644 --- a/include/zephyr/net/dns_resolve.h +++ b/include/zephyr/net/dns_resolve.h @@ -586,6 +586,19 @@ int dns_resolve_reconfigure_with_interfaces(struct dns_resolve_context *ctx, */ int dns_resolve_remove(struct dns_resolve_context *ctx, int if_index); +/** + * @brief Remove servers from the DNS resolving context that were added by + * a specific source. + * + * @param ctx DNS context + * @param if_index Network interface from which the DNS servers are removed. + * @param source Source of the DNS servers, e.g., manual, DHCPv4/6, etc. + * + * @return 0 if ok, <0 if error. + */ +int dns_resolve_remove_source(struct dns_resolve_context *ctx, int if_index, + enum dns_server_source source); + /** * @brief Cancel a pending DNS query. * diff --git a/subsys/net/lib/dhcpv4/dhcpv4.c b/subsys/net/lib/dhcpv4/dhcpv4.c index 5dce854aa905..2096bf330d9e 100644 --- a/subsys/net/lib/dhcpv4/dhcpv4.c +++ b/subsys/net/lib/dhcpv4/dhcpv4.c @@ -1677,8 +1677,9 @@ static void dhcpv4_iface_event_handler(struct net_mgmt_event_callback *cb, * comes back up. */ if (IS_ENABLED(CONFIG_NET_DHCPV4_DNS_SERVER_VIA_INTERFACE)) { - dns_resolve_remove(dns_resolve_get_default(), - net_if_get_by_iface(iface)); + dns_resolve_remove_source(dns_resolve_get_default(), + net_if_get_by_iface(iface), + DNS_SOURCE_DHCPV4); } } } else if (mgmt_event == NET_EVENT_IF_UP) { @@ -1944,6 +1945,12 @@ void net_dhcpv4_stop(struct net_if *iface) NET_DBG("state=%s", net_dhcpv4_state_name(iface->config.dhcpv4.state)); + if (IS_ENABLED(CONFIG_NET_DHCPV4_DNS_SERVER_VIA_INTERFACE)) { + dns_resolve_remove_source(dns_resolve_get_default(), + net_if_get_by_iface(iface), + DNS_SOURCE_DHCPV4); + } + sys_slist_find_and_remove(&dhcpv4_ifaces, &iface->config.dhcpv4.node); diff --git a/subsys/net/lib/dhcpv6/dhcpv6.c b/subsys/net/lib/dhcpv6/dhcpv6.c index d8b1e3d7a6dc..c1282c2a6f12 100644 --- a/subsys/net/lib/dhcpv6/dhcpv6.c +++ b/subsys/net/lib/dhcpv6/dhcpv6.c @@ -2226,8 +2226,9 @@ static void dhcpv6_iface_event_handler(struct net_mgmt_event_callback *cb, * comes back up. */ if (IS_ENABLED(CONFIG_NET_DHCPV6_DNS_SERVER_VIA_INTERFACE)) { - dns_resolve_remove(dns_resolve_get_default(), - net_if_get_by_iface(iface)); + dns_resolve_remove_source(dns_resolve_get_default(), + net_if_get_by_iface(iface), + DNS_SOURCE_DHCPV6); } } else if (mgmt_event == NET_EVENT_IF_UP) { NET_DBG("Interface %p coming up", iface); @@ -2323,6 +2324,12 @@ void net_dhcpv6_stop(struct net_if *iface) (void)dhcpv6_enter_state(iface, NET_DHCPV6_DISABLED); + if (IS_ENABLED(CONFIG_NET_DHCPV6_DNS_SERVER_VIA_INTERFACE)) { + dns_resolve_remove_source(dns_resolve_get_default(), + net_if_get_by_iface(iface), + DNS_SOURCE_DHCPV6); + } + sys_slist_find_and_remove(&dhcpv6_ifaces, &iface->config.dhcpv6.node); diff --git a/subsys/net/lib/dns/resolve.c b/subsys/net/lib/dns/resolve.c index 2b8d6f975fb0..9025501971ee 100644 --- a/subsys/net/lib/dns/resolve.c +++ b/subsys/net/lib/dns/resolve.c @@ -2163,7 +2163,9 @@ int dns_resolve_reconfigure(struct dns_resolve_context *ctx, source); } -int dns_resolve_remove(struct dns_resolve_context *ctx, int if_index) +static int dns_resolve_remove_and_check_source(struct dns_resolve_context *ctx, int if_index, + bool check_source, + enum dns_server_source source) { int i; int ret = -ENOENT; @@ -2188,6 +2190,10 @@ int dns_resolve_remove(struct dns_resolve_context *ctx, int if_index) continue; } + if (check_source && ctx->servers[i].source != source) { + continue; + } + ctx->servers[i].if_index = 0; /* See comment in dns_resolve_close_locked() about @@ -2209,6 +2215,18 @@ int dns_resolve_remove(struct dns_resolve_context *ctx, int if_index) return st; } +int dns_resolve_remove(struct dns_resolve_context *ctx, int if_index) +{ + return dns_resolve_remove_and_check_source(ctx, if_index, false, + DNS_SOURCE_UNKNOWN); +} + +int dns_resolve_remove_source(struct dns_resolve_context *ctx, int if_index, + enum dns_server_source source) +{ + return dns_resolve_remove_and_check_source(ctx, if_index, true, source); +} + struct dns_resolve_context *dns_resolve_get_default(void) { return &dns_default_ctx; From 340fef3ef4029059bc999aee4212bb7b879beb1d Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Tue, 24 Jun 2025 14:08:42 +0300 Subject: [PATCH 0419/2141] [nrf fromtree] net: shell: dns: Print info about DHCP added servers Print information which DNS servers were added by DHCP when listing DNS servers in "net dns" command. This helps debugging DNS server issues. Signed-off-by: Jukka Rissanen (cherry picked from commit f1a9ff97cb5694e110c4fc4ea27f6904e9d63622) Signed-off-by: Robert Lubos --- subsys/net/lib/shell/dns.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/subsys/net/lib/shell/dns.c b/subsys/net/lib/shell/dns.c index 6c6285990d88..e01b58096c3f 100644 --- a/subsys/net/lib/shell/dns.c +++ b/subsys/net/lib/shell/dns.c @@ -93,22 +93,30 @@ static void print_dns_info(const struct shell *sh, } if (ctx->servers[i].dns_server.sa_family == AF_INET) { - PR("\t%s:%u%s%s\n", + PR("\t%s:%u%s%s%s%s%s\n", net_sprint_ipv4_addr( &net_sin(&ctx->servers[i].dns_server)-> sin_addr), ntohs(net_sin(&ctx->servers[i].dns_server)->sin_port), printable_iface(iface_name, " via ", ""), - printable_iface(iface_name, iface_name, "")); + printable_iface(iface_name, iface_name, ""), + ctx->servers[i].source != DNS_SOURCE_UNKNOWN ? " (" : "", + ctx->servers[i].source != DNS_SOURCE_UNKNOWN ? + dns_get_source_str(ctx->servers[i].source) : "", + ctx->servers[i].source != DNS_SOURCE_UNKNOWN ? ")" : ""); } else if (ctx->servers[i].dns_server.sa_family == AF_INET6) { - PR("\t[%s]:%u%s%s\n", + PR("\t[%s]:%u%s%s%s%s%s\n", net_sprint_ipv6_addr( &net_sin6(&ctx->servers[i].dns_server)-> sin6_addr), ntohs(net_sin6(&ctx->servers[i].dns_server)->sin6_port), printable_iface(iface_name, " via ", ""), - printable_iface(iface_name, iface_name, "")); + printable_iface(iface_name, iface_name, ""), + ctx->servers[i].source != DNS_SOURCE_UNKNOWN ? " (" : "", + ctx->servers[i].source != DNS_SOURCE_UNKNOWN ? + dns_get_source_str(ctx->servers[i].source) : "", + ctx->servers[i].source != DNS_SOURCE_UNKNOWN ? ")" : ""); } } From 9f730b0351edec58ebd933480fd9907fe14638d2 Mon Sep 17 00:00:00 2001 From: Nikodem Kastelik Date: Wed, 12 Jun 2024 12:33:35 +0200 Subject: [PATCH 0420/2141] [nrf fromlist] drivers: spi: nrfx_spim: use dmm Some nRF SoCs (i.e. nRF54H20) can peform DMA transfers only from specific memory regions - `dmm` facilitates that. Upstream PR #: 93487 Signed-off-by: Nikodem Kastelik (cherry picked from commit 79a332371c2081a6be8a51eed294d9d10f36709c) --- drivers/spi/spi_nrfx_spim.c | 75 ++++++++++++++++++------------------- 1 file changed, 37 insertions(+), 38 deletions(-) diff --git a/drivers/spi/spi_nrfx_spim.c b/drivers/spi/spi_nrfx_spim.c index 438a1b22999f..c8a0566b68a6 100644 --- a/drivers/spi/spi_nrfx_spim.c +++ b/drivers/spi/spi_nrfx_spim.c @@ -16,6 +16,7 @@ #ifdef CONFIG_SOC_NRF54H20_GPD #include #endif +#include #ifdef CONFIG_SOC_NRF52832_ALLOW_SPIM_DESPITE_PAN_58 #include #endif @@ -123,9 +124,6 @@ struct spi_nrfx_config { #endif uint32_t wake_pin; nrfx_gpiote_t wake_gpiote; -#ifdef CONFIG_DCACHE - uint32_t mem_attr; -#endif #ifdef USE_CLOCK_REQUESTS const struct device *clk_dev; struct nrf_clock_spec clk_spec; @@ -134,6 +132,7 @@ struct spi_nrfx_config { bool cross_domain; int8_t default_port; #endif + void *mem_reg; }; static void event_handler(const nrfx_spim_evt_t *p_event, void *p_context); @@ -504,11 +503,6 @@ static void transfer_next_chunk(const struct device *dev) } memcpy(dev_data->tx_buffer, tx_buf, chunk_len); -#ifdef CONFIG_DCACHE - if (dev_config->mem_attr & DT_MEM_CACHEABLE) { - sys_cache_data_flush_range(dev_data->tx_buffer, chunk_len); - } -#endif tx_buf = dev_data->tx_buffer; } @@ -525,10 +519,20 @@ static void transfer_next_chunk(const struct device *dev) dev_data->chunk_len = chunk_len; - xfer.p_tx_buffer = tx_buf; - xfer.tx_length = spi_context_tx_buf_on(ctx) ? chunk_len : 0; - xfer.p_rx_buffer = rx_buf; - xfer.rx_length = spi_context_rx_buf_on(ctx) ? chunk_len : 0; + xfer.tx_length = spi_context_tx_buf_on(ctx) ? chunk_len : 0; + xfer.rx_length = spi_context_rx_buf_on(ctx) ? chunk_len : 0; + + error = dmm_buffer_out_prepare(dev_config->mem_reg, tx_buf, xfer.tx_length, + (void **)&xfer.p_tx_buffer); + if (error != 0) { + goto out_alloc_failed; + } + + error = dmm_buffer_in_prepare(dev_config->mem_reg, rx_buf, xfer.rx_length, + (void **)&xfer.p_rx_buffer); + if (error != 0) { + goto in_alloc_failed; + } #ifdef CONFIG_SOC_NRF52832_ALLOW_SPIM_DESPITE_PAN_58 if (xfer.rx_length == 1 && xfer.tx_length <= 1) { @@ -551,8 +555,15 @@ static void transfer_next_chunk(const struct device *dev) anomaly_58_workaround_clear(dev_data); #endif } + + /* On nrfx_spim_xfer() error */ + dmm_buffer_in_release(dev_config->mem_reg, rx_buf, xfer.rx_length, + (void **)&xfer.p_rx_buffer); +in_alloc_failed: + dmm_buffer_out_release(dev_config->mem_reg, (void **)&xfer.p_tx_buffer); } +out_alloc_failed: finish_transaction(dev, error); } @@ -560,9 +571,7 @@ static void event_handler(const nrfx_spim_evt_t *p_event, void *p_context) { const struct device *dev = p_context; struct spi_nrfx_data *dev_data = dev->data; -#ifdef CONFIG_DCACHE const struct spi_nrfx_config *dev_config = dev->config; -#endif if (p_event->type == NRFX_SPIM_EVENT_DONE) { /* Chunk length is set to 0 when a transaction is aborted @@ -576,15 +585,21 @@ static void event_handler(const nrfx_spim_evt_t *p_event, void *p_context) #ifdef CONFIG_SOC_NRF52832_ALLOW_SPIM_DESPITE_PAN_58 anomaly_58_workaround_clear(dev_data); #endif + + if (spi_context_tx_buf_on(&dev_data->ctx)) { + dmm_buffer_out_release(dev_config->mem_reg, + (void **)p_event->xfer_desc.p_tx_buffer); + } + + if (spi_context_rx_buf_on(&dev_data->ctx)) { + dmm_buffer_in_release(dev_config->mem_reg, dev_data->ctx.rx_buf, + dev_data->chunk_len, p_event->xfer_desc.p_rx_buffer); + } + #ifdef SPI_BUFFER_IN_RAM if (spi_context_rx_buf_on(&dev_data->ctx) && p_event->xfer_desc.p_rx_buffer != NULL && p_event->xfer_desc.p_rx_buffer != dev_data->ctx.rx_buf) { -#ifdef CONFIG_DCACHE - if (dev_config->mem_attr & DT_MEM_CACHEABLE) { - sys_cache_data_invd_range(dev_data->rx_buffer, dev_data->chunk_len); - } -#endif (void)memcpy(dev_data->ctx.rx_buf, dev_data->rx_buffer, dev_data->chunk_len); @@ -878,8 +893,6 @@ static int spi_nrfx_deinit(const struct device *dev) return 0; } -#define SPIM_MEM_REGION(idx) DT_PHANDLE(SPIM(idx), memory_regions) - #define SPI_NRFX_SPIM_EXTENDED_CONFIG(idx) \ IF_ENABLED(NRFX_SPIM_EXTENDED_ENABLED, \ (.dcx_pin = NRF_SPIM_PIN_NOT_CONNECTED, \ @@ -888,13 +901,6 @@ static int spi_nrfx_deinit(const struct device *dev) ()) \ )) -#define SPIM_GET_MEM_ATTR(idx) \ - COND_CODE_1(SPIM_HAS_PROP(idx, memory_regions), \ - (COND_CODE_1(DT_NODE_HAS_PROP(SPIM_MEM_REGION(idx), zephyr_memory_attr), \ - (DT_PROP(SPIM_MEM_REGION(idx), zephyr_memory_attr)), \ - (0))), \ - (0)) - /* Fast instances depend on the global HSFLL clock controller (as they need * to request the highest frequency from it to operate correctly), so they * must be initialized after that controller driver, hence the default SPI @@ -921,10 +927,10 @@ static int spi_nrfx_deinit(const struct device *dev) IF_ENABLED(SPI_BUFFER_IN_RAM, \ (static uint8_t spim_##idx##_tx_buffer \ [CONFIG_SPI_NRFX_RAM_BUFFER_SIZE] \ - SPIM_MEMORY_SECTION(idx); \ + DMM_MEMORY_SECTION(SPIM(idx)); \ static uint8_t spim_##idx##_rx_buffer \ [CONFIG_SPI_NRFX_RAM_BUFFER_SIZE] \ - SPIM_MEMORY_SECTION(idx);)) \ + DMM_MEMORY_SECTION(SPIM(idx));)) \ static struct spi_nrfx_data spi_##idx##_data = { \ IF_ENABLED(CONFIG_MULTITHREADING, \ (SPI_CONTEXT_INIT_LOCK(spi_##idx##_data, ctx),)) \ @@ -961,8 +967,6 @@ static int spi_nrfx_deinit(const struct device *dev) .wake_pin = NRF_DT_GPIOS_TO_PSEL_OR(SPIM(idx), wake_gpios, \ WAKE_PIN_NOT_USED), \ .wake_gpiote = WAKE_GPIOTE_INSTANCE(SPIM(idx)), \ - IF_ENABLED(CONFIG_DCACHE, \ - (.mem_attr = SPIM_GET_MEM_ATTR(idx),)) \ IF_ENABLED(USE_CLOCK_REQUESTS, \ (.clk_dev = SPIM_REQUESTS_CLOCK(SPIM(idx)) \ ? DEVICE_DT_GET(DT_CLOCKS_CTLR(SPIM(idx))) \ @@ -975,6 +979,7 @@ static int spi_nrfx_deinit(const struct device *dev) .default_port = \ DT_PROP_OR(DT_PHANDLE(SPIM(idx), \ default_gpio_port), port, -1),)) \ + .mem_reg = DMM_DEV_TO_REG(SPIM(idx)), \ }; \ BUILD_ASSERT(!SPIM_HAS_PROP(idx, wake_gpios) || \ !(DT_GPIO_FLAGS(SPIM(idx), wake_gpios) & GPIO_ACTIVE_LOW),\ @@ -989,12 +994,6 @@ static int spi_nrfx_deinit(const struct device *dev) POST_KERNEL, SPIM_INIT_PRIORITY(idx), \ &spi_nrfx_driver_api) -#define SPIM_MEMORY_SECTION(idx) \ - COND_CODE_1(SPIM_HAS_PROP(idx, memory_regions), \ - (__attribute__((__section__(LINKER_DT_NODE_REGION_NAME( \ - SPIM_MEM_REGION(idx)))))), \ - ()) - #define COND_NRF_SPIM_DEVICE(unused, prefix, i, _) \ IF_ENABLED(CONFIG_HAS_HW_NRF_SPIM##prefix##i, (SPI_NRFX_SPIM_DEFINE(prefix##i);)) From d02d1b4e91f6318201e909db240659347a6da515 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Mon, 28 Jul 2025 16:00:51 +0200 Subject: [PATCH 0421/2141] [nrf fromtree] drivers: mspi_dw: Prevent RX FIFO overflows in Single IO mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In Single IO mode, where the clock stretching feature is not available, the RX FIFO could get overflowed if the TX FIFO was filled with more dummy bytes than the RX FIFO could receive data items at a given moment. Such problem could be quite easy hit on nRF54H20, for example for longer RX transfers (like 8 kB) at 8 MHz. This commit limits accordingly the number of dummy bytes that can be enqueued in the TX FIFO. Signed-off-by: Andrzej Głąbek (cherry picked from commit 7b6ba5c071bfc4a54c96fea926d2dce124f2ed71) --- drivers/mspi/mspi_dw.c | 47 +++++++++++++++++++++++++++++++++++------- 1 file changed, 40 insertions(+), 7 deletions(-) diff --git a/drivers/mspi/mspi_dw.c b/drivers/mspi/mspi_dw.c index adc59e765b11..e57511b409aa 100644 --- a/drivers/mspi/mspi_dw.c +++ b/drivers/mspi/mspi_dw.c @@ -78,6 +78,13 @@ struct mspi_dw_config { const struct gpio_dt_spec *ce_gpios; uint8_t ce_gpios_len; uint8_t tx_fifo_depth_minus_1; + /* Maximum number of items allowed in the TX FIFO when transmitting + * dummy bytes; it must be at least one less than the RX FIFO depth + * to account for a byte that can be partially received (i.e. in + * the shifting register) when tx_dummy_bytes() calculates how many + * bytes can be written to the TX FIFO to not overflow the RX FIFO. + */ + uint8_t max_queued_dummy_bytes; uint8_t tx_fifo_threshold; uint8_t rx_fifo_threshold; DECLARE_REG_ACCESS(); @@ -151,7 +158,11 @@ static void tx_data(const struct device *dev, if (buf_pos >= buf_end) { /* Set the threshold to 0 to get the next interrupt - * when the FIFO is completely emptied. + * when the FIFO is completely emptied. This also sets + * the TX start level to 0, so if the transmission was + * not started so far because the FIFO was not filled + * up completely (the start level was set to maximum + * in start_next_packet()), it will be started now. */ write_txftlr(dev, 0); break; @@ -170,11 +181,22 @@ static bool tx_dummy_bytes(const struct device *dev) { struct mspi_dw_data *dev_data = dev->data; const struct mspi_dw_config *dev_config = dev->config; - uint8_t fifo_room = dev_config->tx_fifo_depth_minus_1 + 1 + uint8_t fifo_room = dev_config->max_queued_dummy_bytes - FIELD_GET(TXFLR_TXTFL_MASK, read_txflr(dev)); + uint8_t rx_fifo_items = FIELD_GET(RXFLR_RXTFL_MASK, read_rxflr(dev)); uint16_t dummy_bytes = dev_data->dummy_bytes; const uint8_t dummy_val = 0; + /* Subtract the number of items that are already stored in the RX + * FIFO to avoid overflowing it; `max_queued_dummy_bytes` accounts + * that one byte that can be partially received, thus not included + * in the value from the RXFLR register. + */ + if (fifo_room <= rx_fifo_items) { + return false; + } + fifo_room -= rx_fifo_items; + if (dummy_bytes > fifo_room) { dev_data->dummy_bytes = dummy_bytes - fifo_room; @@ -189,8 +211,10 @@ static bool tx_dummy_bytes(const struct device *dev) write_dr(dev, dummy_val); } while (--dummy_bytes); - /* Set the threshold to 0 to get the next interrupt when the FIFO is - * completely emptied. + /* Set the TX start level to 0, so that the transmission will be + * started now if it hasn't been yet. The threshold value is also + * set to 0 here, but it doesn't really matter, as the interrupt + * will be anyway disabled. */ write_txftlr(dev, 0); @@ -290,12 +314,16 @@ static void mspi_dw_isr(const struct device *dev) if (int_status & ISR_TXEIS_BIT) { if (tx_dummy_bytes(dev)) { + /* All the required dummy bytes were + * written to the FIFO; disable the TXE + * interrupt, as it's no longer needed. + */ write_imr(dev, IMR_RXFIM_BIT); } int_status = read_isr(dev); } - } while (int_status); + } while (int_status != 0); } if (finished) { @@ -923,8 +951,11 @@ static int start_next_packet(const struct device *dev, k_timeout_t timeout) * clock stretching feature does not work yet, or in Standard * SPI mode, where the clock stretching is not available at all. */ - write_txftlr(dev, FIELD_PREP(TXFTLR_TXFTHR_MASK, - dev_config->tx_fifo_depth_minus_1) | + uint8_t start_level = dev_data->dummy_bytes != 0 + ? dev_config->max_queued_dummy_bytes - 1 + : dev_config->tx_fifo_depth_minus_1; + + write_txftlr(dev, FIELD_PREP(TXFTLR_TXFTHR_MASK, start_level) | FIELD_PREP(TXFTLR_TFT_MASK, dev_config->tx_fifo_threshold)); } else { @@ -1406,6 +1437,8 @@ static DEVICE_API(mspi, drv_api) = { TX_FIFO_DEPTH(inst)) #define MSPI_DW_FIFO_PROPS(inst) \ .tx_fifo_depth_minus_1 = TX_FIFO_DEPTH(inst) - 1, \ + .max_queued_dummy_bytes = MIN(RX_FIFO_DEPTH(inst) - 1, \ + TX_FIFO_DEPTH(inst)), \ .tx_fifo_threshold = \ DT_INST_PROP_OR(inst, tx_fifo_threshold, \ 7 * TX_FIFO_DEPTH(inst) / 8 - 1), \ From f3fd75707ce42d24b2349dcd82b92040a2503c4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20St=C4=99pnicki?= Date: Thu, 22 May 2025 13:36:31 +0200 Subject: [PATCH 0422/2141] [nrf fromtree] drivers: nrf_ironside dvfs service MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added handling of new IRONside DVFS service. NRFS DVFS is now not enabled by default. Signed-off-by: Łukasz Stępnicki (cherry picked from commit a0777734de0c33a1341ce57747590fc268cf85ea) --- drivers/firmware/nrf_ironside/CMakeLists.txt | 1 + drivers/firmware/nrf_ironside/Kconfig | 17 ++ drivers/firmware/nrf_ironside/dvfs.c | 184 ++++++++++++++++++ .../drivers/firmware/nrf_ironside/dvfs.h | 92 +++++++++ modules/hal_nordic/nrfs/CMakeLists.txt | 4 +- 5 files changed, 296 insertions(+), 2 deletions(-) create mode 100644 drivers/firmware/nrf_ironside/dvfs.c create mode 100644 include/zephyr/drivers/firmware/nrf_ironside/dvfs.h diff --git a/drivers/firmware/nrf_ironside/CMakeLists.txt b/drivers/firmware/nrf_ironside/CMakeLists.txt index bc2adf842edc..ddc46bd69b1e 100644 --- a/drivers/firmware/nrf_ironside/CMakeLists.txt +++ b/drivers/firmware/nrf_ironside/CMakeLists.txt @@ -8,3 +8,4 @@ zephyr_library_sources_ifdef(CONFIG_NRF_IRONSIDE_CALL call.c) zephyr_library_sources_ifdef(CONFIG_NRF_IRONSIDE_BOOT_REPORT boot_report.c) zephyr_library_sources_ifdef(CONFIG_NRF_IRONSIDE_CPUCONF_SERVICE cpuconf.c) zephyr_library_sources_ifdef(CONFIG_NRF_IRONSIDE_UPDATE_SERVICE update.c) +zephyr_library_sources_ifdef(CONFIG_NRF_IRONSIDE_DVFS_SERVICE dvfs.c) diff --git a/drivers/firmware/nrf_ironside/Kconfig b/drivers/firmware/nrf_ironside/Kconfig index e009df4df058..13866aba52d4 100644 --- a/drivers/firmware/nrf_ironside/Kconfig +++ b/drivers/firmware/nrf_ironside/Kconfig @@ -50,4 +50,21 @@ config NRF_IRONSIDE_BOOT_REPORT help Support for parsing the Boot Report populated by Nordic IRONside firmware. +config NRF_IRONSIDE_DVFS_SERVICE + bool "IRONside DVFS service" + depends on SOC_NRF54H20_CPUAPP + select NRF_IRONSIDE_CALL + help + Service used to handle DVFS operating point requests. + +if NRF_IRONSIDE_DVFS_SERVICE + +config NRF_IRONSIDE_DVFS_OPPOINT_CHANGE_MUTEX_TIMEOUT_MS + int "IRONSside DVFS change oppoint mutex timeout" + default 100 + help + Maximum tiemout when waiting for DVFS oppoint change mutex lock. + +endif # NRF_IRONSIDE_DVFS_SERVICE + endmenu diff --git a/drivers/firmware/nrf_ironside/dvfs.c b/drivers/firmware/nrf_ironside/dvfs.c new file mode 100644 index 000000000000..89208f71fb7d --- /dev/null +++ b/drivers/firmware/nrf_ironside/dvfs.c @@ -0,0 +1,184 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ +#include +#include + +#include +#include + +static enum ironside_dvfs_oppoint current_dvfs_oppoint = IRONSIDE_DVFS_OPP_HIGH; + +struct dvfs_hsfll_data_t { + uint32_t new_f_mult; + uint32_t new_f_trim_entry; + uint32_t max_hsfll_freq; +}; + +static const struct dvfs_hsfll_data_t dvfs_hsfll_data[] = { + /* ABB oppoint 0.8V */ + { + .new_f_mult = 20, + .new_f_trim_entry = 0, + .max_hsfll_freq = 320000000, + }, + /* ABB oppoint 0.6V */ + { + .new_f_mult = 8, + .new_f_trim_entry = 2, + .max_hsfll_freq = 128000000, + }, + /* ABB oppoint 0.5V */ + { + .new_f_mult = 4, + .new_f_trim_entry = 3, + .max_hsfll_freq = 64000000, + }, +}; + +BUILD_ASSERT(ARRAY_SIZE(dvfs_hsfll_data) == (IRONSIDE_DVFS_OPPOINT_COUNT), + "dvfs_hsfll_data size must match number of DVFS oppoints"); + +/** + * @brief Check if the requested oppoint change operation is downscaling. + * + * @param target_freq_setting The target oppoint to check. + * @return true if the current oppoint is higher than the target, false otherwise. + */ +static bool ironside_dvfs_is_downscaling(enum ironside_dvfs_oppoint target_freq_setting) +{ + return current_dvfs_oppoint < target_freq_setting; +} + +/** + * @brief Configure hsfll depending on selected oppoint + * + * @param enum oppoint target operation point + */ +static void ironside_dvfs_configure_hsfll(enum ironside_dvfs_oppoint oppoint) +{ + nrf_hsfll_trim_t hsfll_trim = {}; + uint8_t freq_trim_idx = dvfs_hsfll_data[oppoint].new_f_trim_entry; + +#if defined(NRF_APPLICATION) + hsfll_trim.vsup = NRF_FICR->TRIM.APPLICATION.HSFLL.TRIM.VSUP; + hsfll_trim.coarse = NRF_FICR->TRIM.APPLICATION.HSFLL.TRIM.COARSE[freq_trim_idx]; + hsfll_trim.fine = NRF_FICR->TRIM.APPLICATION.HSFLL.TRIM.FINE[freq_trim_idx]; +#if NRF_HSFLL_HAS_TCOEF_TRIM + hsfll_trim.tcoef = NRF_FICR->TRIM.APPLICATION.HSFLL.TRIM.TCOEF; +#endif +#else +#error "Only application core is supported for DVFS" +#endif + + nrf_hsfll_clkctrl_mult_set(NRF_HSFLL, dvfs_hsfll_data[oppoint].new_f_mult); + nrf_hsfll_trim_set(NRF_HSFLL, &hsfll_trim); + nrf_barrier_w(); + + nrf_hsfll_task_trigger(NRF_HSFLL, NRF_HSFLL_TASK_FREQ_CHANGE); + /* Trigger hsfll task one more time, SEE PAC-4078 */ + nrf_hsfll_task_trigger(NRF_HSFLL, NRF_HSFLL_TASK_FREQ_CHANGE); +} + +/* Function handling steps for DVFS oppoint change. */ +static void ironside_dvfs_prepare_to_scale(enum ironside_dvfs_oppoint dvfs_oppoint) +{ + if (ironside_dvfs_is_downscaling(dvfs_oppoint)) { + ironside_dvfs_configure_hsfll(dvfs_oppoint); + } +} + +/* Update MDK variable which is used by nrfx_coredep_delay_us (k_busy_wait). */ +static void ironside_dvfs_update_core_clock(enum ironside_dvfs_oppoint dvfs_oppoint) +{ + extern uint32_t SystemCoreClock; + + SystemCoreClock = dvfs_hsfll_data[dvfs_oppoint].max_hsfll_freq; +} + +/* Perform scaling finnish procedure. */ +static void ironside_dvfs_change_oppoint_complete(enum ironside_dvfs_oppoint dvfs_oppoint) +{ + if (!ironside_dvfs_is_downscaling(dvfs_oppoint)) { + ironside_dvfs_configure_hsfll(dvfs_oppoint); + } + + current_dvfs_oppoint = dvfs_oppoint; + ironside_dvfs_update_core_clock(dvfs_oppoint); +} + +/** + * @brief Check if ABB analog part is locked. + * + * @param abb Pointer to ABB peripheral. + * + * @return true if ABB is locked, false otherwise. + */ +static inline bool ironside_dvfs_is_abb_locked(NRF_ABB_Type *abb) +{ + /* Check if ABB analog part is locked. */ + return ((abb->STATUSANA & ABB_STATUSANA_LOCKED_Msk) != 0); +} + +/** + * @brief Request DVFS oppoint change from IRONside secure domain. + * This function will send a request over IPC to the IRONside secure domain + * This function is synchronous and will return when the request is completed. + * + * @param oppoint @ref enum ironside_dvfs_oppoint + * @return int + */ +static int ironside_dvfs_req_oppoint(enum ironside_dvfs_oppoint oppoint) +{ + int err; + + struct ironside_call_buf *const buf = ironside_call_alloc(); + + buf->id = IRONSIDE_CALL_ID_DVFS_SERVICE_V0; + buf->args[IRONSIDE_DVFS_SERVICE_OPPOINT_IDX] = oppoint; + + ironside_call_dispatch(buf); + + if (buf->status == IRONSIDE_CALL_STATUS_RSP_SUCCESS) { + err = buf->args[IRONSIDE_DVFS_SERVICE_RETCODE_IDX]; + } else { + err = buf->status; + } + + ironside_call_release(buf); + + return err; +} + +int ironside_dvfs_change_oppoint(enum ironside_dvfs_oppoint dvfs_oppoint) +{ + int status = 0; + + if (!ironside_dvfs_is_oppoint_valid(dvfs_oppoint)) { + return -IRONSIDE_DVFS_ERROR_WRONG_OPPOINT; + } + + if (!ironside_dvfs_is_abb_locked(NRF_ABB)) { + return -IRONSIDE_DVFS_ERROR_BUSY; + } + + if (dvfs_oppoint == current_dvfs_oppoint) { + return status; + } + + if (k_is_in_isr()) { + return -IRONSIDE_DVFS_ERROR_ISR_NOT_ALLOWED; + } + + ironside_dvfs_prepare_to_scale(dvfs_oppoint); + + status = ironside_dvfs_req_oppoint(dvfs_oppoint); + + if (status != 0) { + return status; + } + ironside_dvfs_change_oppoint_complete(dvfs_oppoint); + + return status; +} diff --git a/include/zephyr/drivers/firmware/nrf_ironside/dvfs.h b/include/zephyr/drivers/firmware/nrf_ironside/dvfs.h new file mode 100644 index 000000000000..7d6587bb3c0c --- /dev/null +++ b/include/zephyr/drivers/firmware/nrf_ironside/dvfs.h @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_NRF_IRONSIDE_DVFS_H_ +#define ZEPHYR_INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_NRF_IRONSIDE_DVFS_H_ + +#include +#include +#include +#include + +enum ironside_dvfs_oppoint { + IRONSIDE_DVFS_OPP_HIGH = 0, + IRONSIDE_DVFS_OPP_MEDLOW = 1, + IRONSIDE_DVFS_OPP_LOW = 2 +}; + +/** + * @brief Number of DVFS oppoints supported by IRONside. + * + * This is the number of different DVFS oppoints that can be set on IRONside. + * The oppoints are defined in the `ironside_dvfs_oppoint` enum. + */ +#define IRONSIDE_DVFS_OPPOINT_COUNT (3) + +/** + * @name IRONside DVFS service error codes. + * @{ + */ + +/** The requested DVFS oppoint is not allowed. */ +#define IRONSIDE_DVFS_ERROR_WRONG_OPPOINT (1) +/** Waiting for mutex lock timed out, or hardware is busy. */ +#define IRONSIDE_DVFS_ERROR_BUSY (2) +/** There is configuration error in the DVFS service. */ +#define IRONSIDE_DVFS_ERROR_OPPOINT_DATA (3) +/** The caller does not have permission to change the DVFS oppoint. */ +#define IRONSIDE_DVFS_ERROR_PERMISSION (4) +/** The requested DVFS oppoint is already set, no change needed. */ +#define IRONSIDE_DVFS_ERROR_NO_CHANGE_NEEDED (5) +/** The operation timed out, possibly due to a hardware issue. */ +#define IRONSIDE_DVFS_ERROR_TIMEOUT (6) +/** The DVFS oppoint change operation is not allowed in the ISR context. */ +#define IRONSIDE_DVFS_ERROR_ISR_NOT_ALLOWED (7) + +/** + * @} + */ + +/* IRONside call identifiers with implicit versions. + * + * With the initial "version 0", the service ABI is allowed to break until the + * first production release of IRONside SE. + */ +#define IRONSIDE_CALL_ID_DVFS_SERVICE_V0 3 + +/* Index of the DVFS oppoint within the service buffer. */ +#define IRONSIDE_DVFS_SERVICE_OPPOINT_IDX (0) +/* Index of the return code within the service buffer. */ +#define IRONSIDE_DVFS_SERVICE_RETCODE_IDX (0) + +/** + * @brief Change the current DVFS oppoint. + * + * This function will request a change of the current DVFS oppoint to the + * specified value. It will block until the change is applied. + * + * @param dvfs_oppoint The new DVFS oppoint to set. + * @return int 0 on success, negative error code on failure. + */ +int ironside_dvfs_change_oppoint(enum ironside_dvfs_oppoint dvfs_oppoint); + +/** + * @brief Check if the given oppoint is valid. + * + * @param dvfs_oppoint The oppoint to check. + * @return true if the oppoint is valid, false otherwise. + */ +static inline bool ironside_dvfs_is_oppoint_valid(enum ironside_dvfs_oppoint dvfs_oppoint) +{ + if (dvfs_oppoint != IRONSIDE_DVFS_OPP_HIGH && + dvfs_oppoint != IRONSIDE_DVFS_OPP_MEDLOW && + dvfs_oppoint != IRONSIDE_DVFS_OPP_LOW) { + return false; + } + + return true; +} + +#endif /* ZEPHYR_INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_NRF_IRONSIDE_DVFS_H_ */ diff --git a/modules/hal_nordic/nrfs/CMakeLists.txt b/modules/hal_nordic/nrfs/CMakeLists.txt index d94c2da32a82..dcc7c340ed3e 100644 --- a/modules/hal_nordic/nrfs/CMakeLists.txt +++ b/modules/hal_nordic/nrfs/CMakeLists.txt @@ -14,12 +14,12 @@ if(CONFIG_NRFS) zephyr_include_directories(${INC_DIR}) zephyr_include_directories(${INC_DIR}/services) - zephyr_include_directories(${HELPERS_DIR}) + zephyr_include_directories_ifdef(CONFIG_NRFS_HAS_DVFS_SERVICE ${HELPERS_DIR}) zephyr_include_directories(.) zephyr_include_directories(${CMAKE_CURRENT_SOURCE_DIR}/backends) zephyr_include_directories_ifdef(CONFIG_NRFS_DVFS_LOCAL_DOMAIN ${CMAKE_CURRENT_SOURCE_DIR}/dvfs) - zephyr_library_sources(${HELPERS_DIR}/dvfs_oppoint.c) + zephyr_library_sources_ifdef(CONFIG_NRFS_HAS_DVFS_SERVICE ${HELPERS_DIR}/dvfs_oppoint.c) if(CONFIG_NRFS_LOCAL_DOMAIN) zephyr_library_sources_ifdef(CONFIG_NRFS_AUDIOPLL_SERVICE_ENABLED ${SRC_DIR}/services/nrfs_audiopll.c) From ef6adf71bfd81180aa64d785732d9abc26012c7b Mon Sep 17 00:00:00 2001 From: Aymen LAOUINI Date: Wed, 28 May 2025 18:48:07 +0300 Subject: [PATCH 0423/2141] [nrf fromtree] drivers: firmware: nrf_ironside: add nrf9280 to CPUCONF service CPUCONF service now supports application on nrf92 application cores. Signed-off-by: Aymen LAOUINI (cherry picked from commit 3851588ec3422b1511486d98971d44afbf0a3d65) --- drivers/firmware/nrf_ironside/Kconfig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/firmware/nrf_ironside/Kconfig b/drivers/firmware/nrf_ironside/Kconfig index 13866aba52d4..4c313618638e 100644 --- a/drivers/firmware/nrf_ironside/Kconfig +++ b/drivers/firmware/nrf_ironside/Kconfig @@ -3,7 +3,7 @@ config NRF_IRONSIDE bool - depends on SOC_NRF54H20_IRON + depends on SOC_NRF54H20_IRON || SOC_NRF9280_IRON help This is selected by drivers interacting with Nordic IRONside firmware. @@ -28,11 +28,11 @@ config NRF_IRONSIDE_CALL_INIT_PRIORITY endif # NRF_IRONSIDE_CALL menu "Nordic IRONside services" - depends on SOC_NRF54H20_IRON + depends on SOC_NRF54H20_IRON || SOC_NRF9280_IRON config NRF_IRONSIDE_CPUCONF_SERVICE bool "IRONside CPUCONF service" - depends on SOC_NRF54H20_CPUAPP + depends on SOC_NRF54H20_CPUAPP || SOC_NRF9280_CPUAPP select NRF_IRONSIDE_CALL help Service used to boot local domain cores. From 4d841693325072528d19cbf11d5d2820701250b1 Mon Sep 17 00:00:00 2001 From: Dave Joseph Date: Mon, 19 May 2025 14:56:47 +0530 Subject: [PATCH 0424/2141] [nrf fromtree] drivers: firmware: TISCI driver support Added TISCI driver for supported devices using the binding ti,k2g-sci. This is used to communicate via the secury proxy channel for clock, resource and power domain management. Refer: https://software-dl.ti.com/tisci/esd/latest/2_tisci_msgs/general/TISCI_header.html Signed-off-by: Dave Joseph (cherry picked from commit 95c20c338c8663cd0fc375b7791a41cbbe3160ac) --- drivers/firmware/CMakeLists.txt | 1 + drivers/firmware/Kconfig | 1 + drivers/firmware/tisci/CMakeLists.txt | 6 + drivers/firmware/tisci/Kconfig | 22 + drivers/firmware/tisci/tisci.c | 1602 +++++++++++++++ drivers/firmware/tisci/tisci.h | 1820 +++++++++++++++++ dts/bindings/firmware/ti,k2g-sci.yaml | 25 + include/zephyr/drivers/firmware/tisci/tisci.h | 1037 ++++++++++ 8 files changed, 4514 insertions(+) create mode 100644 drivers/firmware/tisci/CMakeLists.txt create mode 100644 drivers/firmware/tisci/Kconfig create mode 100644 drivers/firmware/tisci/tisci.c create mode 100644 drivers/firmware/tisci/tisci.h create mode 100644 dts/bindings/firmware/ti,k2g-sci.yaml create mode 100644 include/zephyr/drivers/firmware/tisci/tisci.h diff --git a/drivers/firmware/CMakeLists.txt b/drivers/firmware/CMakeLists.txt index 062106cf92b3..caed354c3972 100644 --- a/drivers/firmware/CMakeLists.txt +++ b/drivers/firmware/CMakeLists.txt @@ -3,4 +3,5 @@ # zephyr-keep-sorted-start add_subdirectory_ifdef(CONFIG_ARM_SCMI scmi) add_subdirectory_ifdef(CONFIG_NRF_IRONSIDE nrf_ironside) +add_subdirectory_ifdef(CONFIG_TISCI tisci) # zephyr-keep-sorted-stop diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig index 3e3afe9ffdd2..3c92ec3bb6e2 100644 --- a/drivers/firmware/Kconfig +++ b/drivers/firmware/Kconfig @@ -13,6 +13,7 @@ config ARM_SCMI # zephyr-keep-sorted-start source "drivers/firmware/nrf_ironside/Kconfig" source "drivers/firmware/scmi/Kconfig" +source "drivers/firmware/tisci/Kconfig" # zephyr-keep-sorted-stop endmenu diff --git a/drivers/firmware/tisci/CMakeLists.txt b/drivers/firmware/tisci/CMakeLists.txt new file mode 100644 index 000000000000..29d27c0f3f5f --- /dev/null +++ b/drivers/firmware/tisci/CMakeLists.txt @@ -0,0 +1,6 @@ +# Copyright (c) 2025, Texas Instruments +# SPDX-License-Identifier: Apache-2.0 + +zephyr_library() + +zephyr_library_sources_ifdef(CONFIG_TISCI tisci.c) diff --git a/drivers/firmware/tisci/Kconfig b/drivers/firmware/tisci/Kconfig new file mode 100644 index 000000000000..2cce10593419 --- /dev/null +++ b/drivers/firmware/tisci/Kconfig @@ -0,0 +1,22 @@ +# Copyright (c) 2025, Texas Instruments +# SPDX-License-Identifier: Apache-2.0 + +config TISCI + bool "TISCI Firmware driver" + default y + depends on DT_HAS_TI_K2G_SCI_ENABLED + select MBOX + help + TISCI firmware driver is a frontend interface + to TI System Controller interface firmware through + secureproxy mailbox. + +if TISCI + +config TISCI_INIT_PRIORITY + int "TISCI init priority" + default KERNEL_INIT_PRIORITY_OBJECTS + help + Init priority for the TISCI driver. + +endif diff --git a/drivers/firmware/tisci/tisci.c b/drivers/firmware/tisci/tisci.c new file mode 100644 index 000000000000..0206289bcbed --- /dev/null +++ b/drivers/firmware/tisci/tisci.c @@ -0,0 +1,1602 @@ +/* + * Copyright (c) 2025, Texas Instruments + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#define DT_DRV_COMPAT ti_k2g_sci +#include +#include +#include "tisci.h" +#include +#include +#include +#define LOG_LEVEL CONFIG_MBOX_LOG_LEVEL +#include +LOG_MODULE_REGISTER(ti_k2g_sci); + +/** + * @struct tisci_config - TISCI device configuration structure + * @mbox_tx: Mailbox transmit channel specification. + * @mbox_rx: Mailbox receive channel specification. + * @host_id: Host ID for the device. + * @max_msg_size: Maximum supported message size in bytes. + * @max_rx_timeout_ms: Maximum receive timeout in milliseconds. + */ +struct tisci_config { + struct mbox_dt_spec mbox_tx; + struct mbox_dt_spec mbox_rx; + uint32_t host_id; + int max_msg_size; + int max_rx_timeout_ms; +}; + +/** + * @struct tisci_xfer - TISCI transfer details + * @param tx_message: Transmit message + * @param rx_message: Received message + */ +struct tisci_xfer { + struct mbox_msg tx_message; + struct rx_msg rx_message; +}; + +/** + * @struct tisci_data - Runtime data for TISCI device communication + * @xfer: Structure holding the current transfer details, including buffers and status. + * @seq: Current transfer sequence number, used to track message order. + * @rx_message: Structure for storing the most recently received message. + * @data_sem: Semaphore used to synchronize access to the data structure. + */ +struct tisci_data { + struct tisci_xfer xfer; + uint8_t seq; + struct rx_msg rx_message; + struct k_sem data_sem; +}; + +/* Core/Setup Functions */ +static struct tisci_xfer *tisci_setup_one_xfer(const struct device *dev, uint16_t msg_type, + uint32_t msg_flags, void *req_buf, + size_t tx_message_size, void *resp_buf, + size_t rx_message_size) +{ + struct tisci_data *data = dev->data; + + k_sem_take(&data->data_sem, K_FOREVER); + + const struct tisci_config *config = dev->config; + struct tisci_xfer *xfer = &data->xfer; + struct tisci_msg_hdr *hdr; + + if (rx_message_size > config->max_msg_size || tx_message_size > config->max_msg_size || + (rx_message_size > 0 && rx_message_size < sizeof(*hdr)) || + tx_message_size < sizeof(*hdr)) { + return NULL; + } + + data->seq++; + + xfer->tx_message.data = req_buf; + xfer->tx_message.size = tx_message_size; + xfer->rx_message.buf = resp_buf; + xfer->rx_message.size = (uint8_t)rx_message_size; + + hdr = (struct tisci_msg_hdr *)req_buf; + hdr->seq = data->seq; + hdr->type = msg_type; + hdr->host = config->host_id; + hdr->flags = msg_flags; + + if (rx_message_size) { + hdr->flags = hdr->flags | TISCI_FLAG_REQ_ACK_ON_PROCESSED; + } + + return xfer; +} + +static void callback(const struct device *dev, mbox_channel_id_t channel_id, void *user_data, + struct mbox_msg *mbox_data) +{ + struct rx_msg *msg = user_data; + + k_sem_give(msg->response_ready_sem); +} + +static bool tisci_is_response_ack(void *r) +{ + struct tisci_msg_hdr *hdr = (struct tisci_msg_hdr *)r; + + return hdr->flags & TISCI_FLAG_RESP_GENERIC_ACK ? true : false; +} + +static int tisci_get_response(const struct device *dev, struct tisci_xfer *xfer) +{ + if (!dev) { + return -EINVAL; + } + + struct tisci_data *data = dev->data; + const struct tisci_config *config = dev->config; + struct tisci_msg_hdr *hdr; + + if (!xfer->rx_message.buf) { + LOG_ERR("No response buffer provided"); + return -EINVAL; + } + + if (k_sem_take(data->rx_message.response_ready_sem, K_MSEC(config->max_rx_timeout_ms)) != + 0) { + LOG_ERR("Timeout waiting for response"); + return -ETIMEDOUT; + } + + if (xfer->rx_message.size > config->max_msg_size) { + LOG_ERR("rx_message.size [ %d ] > max_msg_size\n", xfer->rx_message.size); + return -EINVAL; + } + + if (data->rx_message.size < xfer->rx_message.size) { + LOG_ERR("rx_message.size [ %d ] < xfer->rx_message.size\n", data->rx_message.size); + return -EINVAL; + } + + memcpy(xfer->rx_message.buf, data->rx_message.buf, xfer->rx_message.size); + hdr = (struct tisci_msg_hdr *)xfer->rx_message.buf; + + /* Sanity check for message response */ + if (hdr->seq != data->seq) { + LOG_ERR("HDR seq != data seq [%d != %d]\n", hdr->seq, data->seq); + return -EINVAL; + } + + k_sem_give(&data->data_sem); + return 0; +} + +static int tisci_do_xfer(const struct device *dev, struct tisci_xfer *xfer) +{ + if (!dev) { + return -EINVAL; + } + + const struct tisci_config *config = dev->config; + struct mbox_msg *msg = &xfer->tx_message; + int ret; + + ret = mbox_send_dt(&config->mbox_tx, msg); + if (ret < 0) { + LOG_ERR("Could not send (%d)\n", ret); + return ret; + } + + /* Get response if requested */ + if (xfer->rx_message.size) { + ret = tisci_get_response(dev, xfer); + if (ret) { + return ret; + } + if (!tisci_is_response_ack(xfer->rx_message.buf)) { + LOG_ERR("TISCI Response in NACK\n"); + return -ENODEV; + } + } + + return 0; +} + +/* Clock Management Functions */ +int tisci_cmd_get_clock_state(const struct device *dev, uint32_t dev_id, uint8_t clk_id, + uint8_t *programmed_state, uint8_t *current_state) +{ + struct tisci_msg_resp_get_clock_state resp; + struct tisci_msg_req_get_clock_state req; + struct tisci_xfer *xfer; + int ret; + + if (!programmed_state && !current_state) { + return -EINVAL; + } + + xfer = tisci_setup_one_xfer(dev, TISCI_MSG_GET_CLOCK_STATE, 0, &req, sizeof(req), &resp, + sizeof(resp)); + if (!xfer) { + LOG_ERR("Failed to setup transfer"); + return -EINVAL; + } + + req.dev_id = dev_id; + req.clk_id = clk_id; + ret = tisci_do_xfer(dev, xfer); + if (ret) { + LOG_ERR("Failed to get clock state (ret=%d)", ret); + return ret; + } + + if (programmed_state) { + *programmed_state = resp.programmed_state; + } + if (current_state) { + *current_state = resp.current_state; + } + return 0; +} + +int tisci_cmd_clk_is_auto(const struct device *dev, uint32_t dev_id, uint8_t clk_id, + bool *req_state) +{ + uint8_t state = 0; + int ret; + + if (!req_state) { + return -EINVAL; + } + + ret = tisci_cmd_get_clock_state(dev, dev_id, clk_id, &state, NULL); + if (ret) { + return ret; + } + + *req_state = (state == MSG_CLOCK_SW_STATE_AUTO); + return 0; +} + +int tisci_cmd_clk_is_on(const struct device *dev, uint32_t dev_id, uint8_t clk_id, bool *req_state, + bool *curr_state) +{ + uint8_t c_state = 0, r_state = 0; + int ret; + + if (!req_state && !curr_state) { + return -EINVAL; + } + + ret = tisci_cmd_get_clock_state(dev, dev_id, clk_id, &r_state, &c_state); + if (ret) { + return ret; + } + + if (req_state) { + *req_state = (r_state == MSG_CLOCK_SW_STATE_REQ); + } + if (curr_state) { + *curr_state = (c_state == MSG_CLOCK_HW_STATE_READY); + } + return 0; +} + +int tisci_cmd_clk_is_off(const struct device *dev, uint32_t dev_id, uint8_t clk_id, bool *req_state, + bool *curr_state) +{ + uint8_t c_state = 0, r_state = 0; + int ret; + + if (!req_state && !curr_state) { + return -EINVAL; + } + + ret = tisci_cmd_get_clock_state(dev, dev_id, clk_id, &r_state, &c_state); + if (ret) { + return ret; + } + + if (req_state) { + *req_state = (r_state == MSG_CLOCK_SW_STATE_UNREQ); + } + if (curr_state) { + *curr_state = (c_state == MSG_CLOCK_HW_STATE_NOT_READY); + } + return 0; +} + +int tisci_cmd_clk_get_match_freq(const struct device *dev, uint32_t dev_id, uint8_t clk_id, + uint64_t min_freq, uint64_t target_freq, uint64_t max_freq, + uint64_t *match_freq) +{ + struct tisci_msg_resp_query_clock_freq resp; + struct tisci_msg_req_query_clock_freq req; + struct tisci_xfer *xfer; + int ret; + + if (!match_freq) { + return -EINVAL; + } + + xfer = tisci_setup_one_xfer(dev, TISCI_MSG_QUERY_CLOCK_FREQ, 0, &req, sizeof(req), &resp, + sizeof(resp)); + if (!xfer) { + LOG_ERR("Failed to setup transfer"); + return -EINVAL; + } + + req.dev_id = dev_id; + req.clk_id = clk_id; + req.min_freq_hz = min_freq; + req.target_freq_hz = target_freq; + req.max_freq_hz = max_freq; + + ret = tisci_do_xfer(dev, xfer); + if (ret) { + LOG_ERR("Failed to get matching clock frequency (ret=%d)", ret); + return ret; + } + + *match_freq = resp.freq_hz; + + return 0; +} + +int tisci_cmd_clk_set_freq(const struct device *dev, uint32_t dev_id, uint8_t clk_id, + uint64_t min_freq, uint64_t target_freq, uint64_t max_freq) +{ + struct tisci_msg_req_set_clock_freq req; + struct tisci_msg_resp_set_clock_freq resp; + struct tisci_xfer *xfer; + int ret; + + xfer = tisci_setup_one_xfer(dev, TISCI_MSG_SET_CLOCK_FREQ, 0, &req, sizeof(req), &resp, + sizeof(resp)); + if (!xfer) { + LOG_ERR("Failed to setup transfer"); + return -EINVAL; + } + + req.dev_id = dev_id; + req.clk_id = clk_id; + req.min_freq_hz = min_freq; + req.target_freq_hz = target_freq; + req.max_freq_hz = max_freq; + + ret = tisci_do_xfer(dev, xfer); + if (ret) { + LOG_ERR("Failed to set clock frequency (ret=%d)", ret); + return ret; + } + + return 0; +} + +int tisci_cmd_clk_get_freq(const struct device *dev, uint32_t dev_id, uint8_t clk_id, + uint64_t *freq) +{ + struct tisci_msg_resp_get_clock_freq resp; + struct tisci_msg_req_get_clock_freq req; + struct tisci_xfer *xfer; + int ret; + + if (!freq) { + return -EINVAL; + } + + xfer = tisci_setup_one_xfer(dev, TISCI_MSG_GET_CLOCK_FREQ, 0, &req, sizeof(req), &resp, + sizeof(resp)); + if (!xfer) { + LOG_ERR("Failed to setup transfer"); + return -EINVAL; + } + + req.dev_id = dev_id; + req.clk_id = clk_id; + + ret = tisci_do_xfer(dev, xfer); + if (ret) { + LOG_ERR("Failed to get clock frequency (ret=%d)", ret); + return ret; + } + + *freq = resp.freq_hz; + + return 0; +} + +int tisci_set_clock_state(const struct device *dev, uint32_t dev_id, uint8_t clk_id, uint32_t flags, + uint8_t state) +{ + struct tisci_msg_req_set_clock_state req; + struct tisci_msg_resp_set_clock_state resp; + struct tisci_xfer *xfer; + int ret; + + xfer = tisci_setup_one_xfer(dev, TISCI_MSG_SET_CLOCK_STATE, flags, &req, sizeof(req), &resp, + sizeof(resp)); + if (!xfer) { + LOG_ERR("Failed to setup transfer"); + return -EINVAL; + } + + req.dev_id = dev_id; + req.clk_id = clk_id; + req.request_state = state; + + ret = tisci_do_xfer(dev, xfer); + if (ret) { + LOG_ERR("Failed to set clock state (ret=%d)", ret); + return ret; + } + + return 0; +} + +int tisci_cmd_clk_set_parent(const struct device *dev, uint32_t dev_id, uint8_t clk_id, + uint8_t parent_id) +{ + struct tisci_msg_req_set_clock_parent req; + struct tisci_msg_resp_set_clock_parent resp; + struct tisci_xfer *xfer; + int ret; + + xfer = tisci_setup_one_xfer(dev, TISCI_MSG_SET_CLOCK_PARENT, 0, &req, sizeof(req), &resp, + sizeof(resp)); + + req.dev_id = dev_id; + req.clk_id = clk_id; + req.parent_id = parent_id; + + ret = tisci_do_xfer(dev, xfer); + if (ret) { + LOG_ERR("Failed to set clock parent (ret=%d)", ret); + return ret; + } + + return 0; +} + +int tisci_cmd_clk_get_parent(const struct device *dev, uint32_t dev_id, uint8_t clk_id, + uint8_t *parent_id) +{ + struct tisci_msg_resp_get_clock_parent resp; + struct tisci_msg_req_get_clock_parent req; + struct tisci_xfer *xfer; + int ret; + + if (!parent_id) { + return -EINVAL; + } + + xfer = tisci_setup_one_xfer(dev, TISCI_MSG_GET_CLOCK_PARENT, 0, &req, sizeof(req), &resp, + sizeof(resp)); + if (!xfer) { + LOG_ERR("Failed to setup transfer"); + return -EINVAL; + } + + req.dev_id = dev_id; + req.clk_id = clk_id; + + ret = tisci_do_xfer(dev, xfer); + if (ret) { + LOG_ERR("Failed to get clock parent (ret=%d)", ret); + return ret; + } + + *parent_id = resp.parent_id; + + return 0; +} + +int tisci_cmd_clk_get_num_parents(const struct device *dev, uint32_t dev_id, uint8_t clk_id, + uint8_t *num_parents) +{ + struct tisci_msg_resp_get_clock_num_parents resp; + struct tisci_msg_req_get_clock_num_parents req; + struct tisci_xfer *xfer; + int ret; + + if (!num_parents) { + return -EINVAL; + } + + xfer = tisci_setup_one_xfer(dev, TISCI_MSG_GET_NUM_CLOCK_PARENTS, 0, &req, sizeof(req), + &resp, sizeof(resp)); + if (!xfer) { + LOG_ERR("Failed to setup transfer"); + return -EINVAL; + } + + req.dev_id = dev_id; + req.clk_id = clk_id; + + ret = tisci_do_xfer(dev, xfer); + if (ret) { + LOG_ERR("Failed to get number of clock parents (ret=%d)", ret); + return ret; + } + + *num_parents = resp.num_parents; + + return 0; +} + +int tisci_cmd_get_clock(const struct device *dev, uint32_t dev_id, uint8_t clk_id, bool needs_ssc, + bool can_change_freq, bool enable_input_term) +{ + uint32_t flags = 0; + + flags |= needs_ssc ? MSG_FLAG_CLOCK_ALLOW_SSC : 0; + flags |= can_change_freq ? MSG_FLAG_CLOCK_ALLOW_FREQ_CHANGE : 0; + flags |= enable_input_term ? MSG_FLAG_CLOCK_INPUT_TERM : 0; + + return tisci_set_clock_state(dev, dev_id, clk_id, flags, MSG_CLOCK_SW_STATE_REQ); +} + +int tisci_cmd_idle_clock(const struct device *dev, uint32_t dev_id, uint8_t clk_id) +{ + + return tisci_set_clock_state(dev, dev_id, clk_id, 0, MSG_CLOCK_SW_STATE_UNREQ); +} + +int tisci_cmd_put_clock(const struct device *dev, uint32_t dev_id, uint8_t clk_id) +{ + + return tisci_set_clock_state(dev, dev_id, clk_id, 0, MSG_CLOCK_SW_STATE_UNREQ); +} + +/* Device Management Functions */ +int tisci_set_device_state(const struct device *dev, uint32_t dev_id, uint32_t flags, uint8_t state) +{ + struct tisci_msg_req_set_device_state req; + struct tisci_msg_resp_set_device_state resp; + struct tisci_xfer *xfer; + int ret; + + xfer = tisci_setup_one_xfer(dev, TISCI_MSG_SET_DEVICE_STATE, flags, &req, sizeof(req), + &resp, sizeof(resp)); + if (!xfer) { + LOG_ERR("Failed to setup transfer"); + return -EINVAL; + } + + req.id = dev_id; + req.state = state; + + ret = tisci_do_xfer(dev, xfer); + if (ret) { + LOG_ERR("Failed to set device state (ret=%d)", ret); + return ret; + } + + return 0; +} + +int tisci_set_device_state_no_wait(const struct device *dev, uint32_t dev_id, uint32_t flags, + uint8_t state) +{ + struct tisci_msg_req_set_device_state req; + struct tisci_msg_resp_set_device_state resp; + struct tisci_xfer *xfer; + int ret; + + xfer = tisci_setup_one_xfer(dev, TISCI_MSG_SET_DEVICE_STATE, + flags | TISCI_FLAG_REQ_GENERIC_NORESPONSE, &req, sizeof(req), + &resp, sizeof(resp)); + if (!xfer) { + LOG_ERR("Failed to setup transfer"); + return -EINVAL; + } + + req.id = dev_id; + req.state = state; + + ret = tisci_do_xfer(dev, xfer); + if (ret) { + LOG_ERR("Failed to set device state without wait (ret=%d)", ret); + return ret; + } + + return 0; +} + +int tisci_get_device_state(const struct device *dev, uint32_t dev_id, uint32_t *clcnt, + uint32_t *resets, uint8_t *p_state, uint8_t *c_state) +{ + struct tisci_msg_resp_get_device_state resp; + struct tisci_msg_req_get_device_state req; + struct tisci_xfer *xfer; + int ret; + + if (!clcnt && !resets && !p_state && !c_state) { + return -EINVAL; + } + + xfer = tisci_setup_one_xfer(dev, TISCI_MSG_GET_DEVICE_STATE, 0, &req, sizeof(req), &resp, + sizeof(resp)); + if (!xfer) { + LOG_ERR("Failed to setup transfer"); + return -EINVAL; + } + + req.id = dev_id; + + ret = tisci_do_xfer(dev, xfer); + if (ret) { + LOG_ERR("Failed to get device state (ret=%d)", ret); + return ret; + } + + if (clcnt) { + *clcnt = resp.context_loss_count; + } + if (resets) { + *resets = resp.resets; + } + if (p_state) { + *p_state = resp.programmed_state; + } + if (c_state) { + *c_state = resp.current_state; + } + + return 0; +} + +int tisci_cmd_get_device(const struct device *dev, uint32_t dev_id) +{ + + return tisci_set_device_state(dev, dev_id, 0, MSG_DEVICE_SW_STATE_ON); +} + +int tisci_cmd_get_device_exclusive(const struct device *dev, uint32_t dev_id) +{ + + return tisci_set_device_state(dev, dev_id, MSG_FLAG_DEVICE_EXCLUSIVE, + MSG_DEVICE_SW_STATE_ON); +} + +int tisci_cmd_idle_device(const struct device *dev, uint32_t dev_id) +{ + + return tisci_set_device_state(dev, dev_id, 0, MSG_DEVICE_SW_STATE_RETENTION); +} + +int tisci_cmd_idle_device_exclusive(const struct device *dev, uint32_t dev_id) +{ + + return tisci_set_device_state(dev, dev_id, MSG_FLAG_DEVICE_EXCLUSIVE, + MSG_DEVICE_SW_STATE_RETENTION); +} + +int tisci_cmd_put_device(const struct device *dev, uint32_t dev_id) +{ + + return tisci_set_device_state(dev, dev_id, 0, MSG_DEVICE_SW_STATE_AUTO_OFF); +} + +int tisci_cmd_dev_is_valid(const struct device *dev, uint32_t dev_id) +{ + uint8_t unused; + + return tisci_get_device_state(dev, dev_id, NULL, NULL, NULL, &unused); +} + +int tisci_cmd_dev_get_clcnt(const struct device *dev, uint32_t dev_id, uint32_t *count) +{ + + return tisci_get_device_state(dev, dev_id, count, NULL, NULL, NULL); +} + +int tisci_cmd_dev_is_idle(const struct device *dev, uint32_t dev_id, bool *r_state) +{ + int ret; + uint8_t state; + + if (!r_state) { + return -EINVAL; + } + + ret = tisci_get_device_state(dev, dev_id, NULL, NULL, &state, NULL); + if (ret) { + return ret; + } + + *r_state = (state == MSG_DEVICE_SW_STATE_RETENTION); + + return 0; +} + +int tisci_cmd_dev_is_stop(const struct device *dev, uint32_t dev_id, bool *r_state, + bool *curr_state) +{ + int ret; + uint8_t p_state, c_state; + + if (!r_state && !curr_state) { + return -EINVAL; + } + + ret = tisci_get_device_state(dev, dev_id, NULL, NULL, &p_state, &c_state); + if (ret) { + return ret; + } + + if (r_state) { + *r_state = (p_state == MSG_DEVICE_SW_STATE_AUTO_OFF); + } + if (curr_state) { + *curr_state = (c_state == MSG_DEVICE_HW_STATE_OFF); + } + + return 0; +} + +int tisci_cmd_dev_is_on(const struct device *dev, uint32_t dev_id, bool *r_state, bool *curr_state) +{ + int ret; + uint8_t p_state, c_state; + + if (!r_state && !curr_state) { + return -EINVAL; + } + + ret = tisci_get_device_state(dev, dev_id, NULL, NULL, &p_state, &c_state); + if (ret) { + return ret; + } + + if (r_state) { + *r_state = (p_state == MSG_DEVICE_SW_STATE_ON); + } + if (curr_state) { + *curr_state = (c_state == MSG_DEVICE_HW_STATE_ON); + } + + return 0; +} + +int tisci_cmd_dev_is_trans(const struct device *dev, uint32_t dev_id, bool *curr_state) +{ + int ret; + uint8_t state; + + if (!curr_state) { + return -EINVAL; + } + + ret = tisci_get_device_state(dev, dev_id, NULL, NULL, NULL, &state); + if (ret) { + return ret; + } + + *curr_state = (state == MSG_DEVICE_HW_STATE_TRANS); + + return 0; +} + +int tisci_cmd_set_device_resets(const struct device *dev, uint32_t dev_id, uint32_t reset_state) +{ + struct tisci_msg_req_set_device_resets req; + struct tisci_msg_resp_set_device_resets resp; + struct tisci_xfer *xfer; + int ret; + + xfer = tisci_setup_one_xfer(dev, TISCI_MSG_SET_DEVICE_RESETS, 0, &req, sizeof(req), &resp, + sizeof(resp)); + if (!xfer) { + LOG_ERR("Failed to setup transfer"); + return -EINVAL; + } + + req.id = dev_id; + req.resets = reset_state; + + ret = tisci_do_xfer(dev, xfer); + if (ret) { + LOG_ERR("Failed to set device resets (ret=%d)", ret); + return ret; + } + + return 0; +} + +int tisci_cmd_get_device_resets(const struct device *dev, uint32_t dev_id, uint32_t *reset_state) +{ + + return tisci_get_device_state(dev, dev_id, NULL, reset_state, NULL, NULL); +} + +/* Processor Management Functions */ +int tisci_cmd_proc_request(const struct device *dev, uint8_t proc_id) +{ + struct tisci_msg_req_proc_request req; + struct tisci_msg_resp_proc_request resp; + struct tisci_xfer *xfer; + int ret; + + xfer = tisci_setup_one_xfer(dev, TISCI_MSG_PROC_REQUEST, 0, &req, sizeof(req), &resp, + sizeof(resp)); + if (!xfer) { + LOG_ERR("Failed to setup transfer"); + return -EINVAL; + } + + req.processor_id = proc_id; + + ret = tisci_do_xfer(dev, xfer); + if (ret) { + LOG_ERR("Failed to request processor control (ret=%d)", ret); + return ret; + } + + return 0; +} + +int tisci_cmd_proc_release(const struct device *dev, uint8_t proc_id) +{ + struct tisci_msg_req_proc_release req; + struct tisci_msg_resp_proc_release resp; + struct tisci_xfer *xfer; + int ret; + + xfer = tisci_setup_one_xfer(dev, TISCI_MSG_PROC_RELEASE, 0, &req, sizeof(req), &resp, + sizeof(resp)); + if (!xfer) { + LOG_ERR("Failed to setup transfer"); + return -EINVAL; + } + + req.processor_id = proc_id; + + ret = tisci_do_xfer(dev, xfer); + if (ret) { + LOG_ERR("Failed to release processor control (ret=%d)", ret); + return ret; + } + + return 0; +} + +int tisci_cmd_proc_handover(const struct device *dev, uint8_t proc_id, uint8_t host_id) +{ + struct tisci_msg_req_proc_handover req; + struct tisci_msg_resp_proc_handover resp; + struct tisci_xfer *xfer; + int ret; + + xfer = tisci_setup_one_xfer(dev, TISCI_MSG_PROC_HANDOVER, 0, &req, sizeof(req), &resp, + sizeof(resp)); + if (!xfer) { + LOG_ERR("Failed to setup transfer"); + return -EINVAL; + } + + req.processor_id = proc_id; + req.host_id = host_id; + + ret = tisci_do_xfer(dev, xfer); + if (ret) { + LOG_ERR("Failed to handover processor control (ret=%d)", ret); + return ret; + } + + return 0; +} + +int tisci_cmd_set_proc_boot_cfg(const struct device *dev, uint8_t proc_id, uint64_t bootvector, + uint32_t config_flags_set, uint32_t config_flags_clear) +{ + struct tisci_msg_req_set_proc_boot_config req; + struct tisci_msg_resp_set_proc_boot_config resp; + struct tisci_xfer *xfer; + int ret; + + xfer = tisci_setup_one_xfer(dev, TISCI_MSG_SET_PROC_BOOT_CONFIG, 0, &req, sizeof(req), + &resp, sizeof(resp)); + if (!xfer) { + LOG_ERR("Failed to setup transfer"); + return -EINVAL; + } + + req.processor_id = proc_id; + req.bootvector_low = bootvector & TISCI_ADDR_LOW_MASK; + req.bootvector_high = (bootvector & TISCI_ADDR_HIGH_MASK) >> TISCI_ADDR_HIGH_SHIFT; + req.config_flags_set = config_flags_set; + req.config_flags_clear = config_flags_clear; + + ret = tisci_do_xfer(dev, xfer); + if (ret) { + LOG_ERR("Failed to set processor boot configuration (ret=%d)", ret); + return ret; + } + + return 0; +} + +int tisci_cmd_set_proc_boot_ctrl(const struct device *dev, uint8_t proc_id, + uint32_t control_flags_set, uint32_t control_flags_clear) +{ + struct tisci_msg_req_set_proc_boot_ctrl req; + struct tisci_msg_resp_set_proc_boot_ctrl resp; + struct tisci_xfer *xfer; + int ret; + + xfer = tisci_setup_one_xfer(dev, TISCI_MSG_SET_PROC_BOOT_CTRL, 0, &req, sizeof(req), &resp, + sizeof(resp)); + if (!xfer) { + LOG_ERR("Failed to setup transfer"); + return -EINVAL; + } + + req.processor_id = proc_id; + req.control_flags_set = control_flags_set; + req.control_flags_clear = control_flags_clear; + + ret = tisci_do_xfer(dev, xfer); + if (ret) { + LOG_ERR("Failed to set processor boot control (ret=%d)", ret); + return ret; + } + + return 0; +} + +int tisci_cmd_proc_auth_boot_image(const struct device *dev, uint64_t *image_addr, + uint32_t *image_size) +{ + struct tisci_msg_req_proc_auth_boot_image req; + struct tisci_msg_resp_proc_auth_boot_image resp; + struct tisci_xfer *xfer; + int ret; + + if (!image_addr) { + return -EINVAL; + } + + xfer = tisci_setup_one_xfer(dev, TISCI_MSG_PROC_AUTH_BOOT_IMAGE, 0, &req, sizeof(req), + &resp, sizeof(resp)); + if (!xfer) { + LOG_ERR("Failed to setup transfer"); + return -EINVAL; + } + + req.cert_addr_low = *image_addr & TISCI_ADDR_LOW_MASK; + req.cert_addr_high = (*image_addr & TISCI_ADDR_HIGH_MASK) >> TISCI_ADDR_HIGH_SHIFT; + + ret = tisci_do_xfer(dev, xfer); + if (ret) { + LOG_ERR("Failed to authenticate boot image (ret=%d)", ret); + return ret; + } + + *image_addr = + (resp.image_addr_low & TISCI_ADDR_LOW_MASK) | + (((uint64_t)resp.image_addr_high << TISCI_ADDR_HIGH_SHIFT) & TISCI_ADDR_HIGH_MASK); + + if (image_size) { + *image_size = resp.image_size; + } + + return 0; +} + +int tisci_cmd_get_proc_boot_status(const struct device *dev, uint8_t proc_id, uint64_t *bv, + uint32_t *cfg_flags, uint32_t *ctrl_flags, uint32_t *sts_flags) +{ + struct tisci_msg_resp_get_proc_boot_status resp; + struct tisci_msg_req_get_proc_boot_status req; + struct tisci_xfer *xfer; + int ret; + + if (!bv && !cfg_flags && !ctrl_flags && !sts_flags) { + return -EINVAL; + } + + xfer = tisci_setup_one_xfer(dev, TISCI_MSG_GET_PROC_BOOT_STATUS, 0, &req, sizeof(req), + &resp, sizeof(resp)); + if (!xfer) { + LOG_ERR("Failed to setup transfer"); + return -EINVAL; + } + + req.processor_id = proc_id; + + ret = tisci_do_xfer(dev, xfer); + if (ret) { + LOG_ERR("Failed to get processor boot status (ret=%d)", ret); + return ret; + } + + if (bv) { + *bv = (resp.bootvector_low & TISCI_ADDR_LOW_MASK) | + (((uint64_t)resp.bootvector_high << TISCI_ADDR_HIGH_SHIFT) & + TISCI_ADDR_HIGH_MASK); + } + if (cfg_flags) { + *cfg_flags = resp.config_flags; + } + if (ctrl_flags) { + *ctrl_flags = resp.control_flags; + } + if (sts_flags) { + *sts_flags = resp.status_flags; + } + + return 0; +} + +/* Resource Management Functions */ +int tisci_get_resource_range(const struct device *dev, uint32_t dev_id, uint8_t subtype, + uint8_t s_host, uint16_t *range_start, uint16_t *range_num) +{ + struct tisci_msg_resp_get_resource_range resp; + struct tisci_msg_req_get_resource_range req; + struct tisci_xfer *xfer; + int ret; + + if (!s_host) { + return -EINVAL; + } + if (!range_start && !range_num) { + return -EINVAL; + } + + xfer = tisci_setup_one_xfer(dev, TISCI_MSG_GET_RESOURCE_RANGE, 0, &req, sizeof(req), &resp, + sizeof(resp)); + if (!xfer) { + LOG_ERR("Failed to setup transfer"); + return -EINVAL; + } + + req.secondary_host = s_host; + req.type = dev_id & MSG_RM_RESOURCE_TYPE_MASK; + req.subtype = subtype & MSG_RM_RESOURCE_SUBTYPE_MASK; + + ret = tisci_do_xfer(dev, xfer); + if (ret) { + LOG_ERR("Failed to get resource range (ret=%d)", ret); + return ret; + } + + if (!resp.range_start && !resp.range_num) { + return -ENODEV; + } + + if (range_start) { + *range_start = resp.range_start; + } + if (range_num) { + *range_num = resp.range_num; + } + + return 0; +} + +int tisci_cmd_get_resource_range(const struct device *dev, uint32_t dev_id, uint8_t subtype, + uint16_t *range_start, uint16_t *range_num) +{ + return tisci_get_resource_range(dev, dev_id, subtype, TISCI_IRQ_SECONDARY_HOST_INVALID, + range_start, range_num); +} + +int tisci_cmd_get_resource_range_from_shost(const struct device *dev, uint32_t dev_id, + uint8_t subtype, uint8_t s_host, uint16_t *range_start, + uint16_t *range_num) +{ + return tisci_get_resource_range(dev, dev_id, subtype, s_host, range_start, range_num); +} + +/* Board Configuration Functions */ + +int cmd_set_board_config_using_msg(const struct device *dev, uint16_t msg_type, uint64_t addr, + uint32_t size) +{ + struct tisci_msg_board_config_req req; + struct tisci_msg_board_config_resp resp; + struct tisci_xfer *xfer; + int ret; + + xfer = tisci_setup_one_xfer(dev, msg_type, 0, &req, sizeof(req), &resp, sizeof(resp)); + if (!xfer) { + LOG_ERR(" Failed to setup board config transfer"); + return -EINVAL; + } + + req.boardcfgp_high = (addr >> 32) & 0xFFFFFFFFU; + req.boardcfgp_low = addr & 0xFFFFFFFFU; + req.boardcfg_size = size; + + ret = tisci_do_xfer(dev, xfer); + if (ret) { + LOG_ERR("Board config transfer failed (ret=%d)", ret); + return ret; + } + + return 0; +} + +/* Version/Revision Function */ +int tisci_cmd_get_revision(const struct device *dev, struct tisci_version_info *ver) +{ + struct tisci_msg_hdr hdr; + struct tisci_msg_resp_version rev_info; + struct tisci_xfer *xfer; + int ret; + + if (!ver) { + return -EINVAL; + } + + xfer = tisci_setup_one_xfer(dev, TISCI_MSG_VERSION, 0, &hdr, sizeof(hdr), &rev_info, + sizeof(rev_info)); + if (!xfer) { + LOG_ERR("Failed to setup transfer"); + return -EINVAL; + } + + ret = tisci_do_xfer(dev, xfer); + if (ret) { + LOG_ERR("Failed to get version (ret=%d)", ret); + return ret; + } + + ver->abi_major = rev_info.abi_major; + ver->abi_minor = rev_info.abi_minor; + ver->firmware_revision = rev_info.firmware_revision; + strncpy(ver->firmware_description, rev_info.firmware_description, + sizeof(ver->firmware_description)); + return 0; +} + +/* System Control Functions */ + +int tisci_cmd_sys_reset(const struct device *dev) +{ + struct tisci_msg_req_reboot req; + struct tisci_msg_resp_reboot resp; + struct tisci_xfer *xfer; + int ret; + + xfer = tisci_setup_one_xfer(dev, TISCI_MSG_SYS_RESET, 0, &req, sizeof(req), &resp, + sizeof(resp)); + if (!xfer) { + LOG_ERR(" Failed to setup system reset transfer"); + return -EINVAL; + } + + req.domain = 0; + + ret = tisci_do_xfer(dev, xfer); + if (ret) { + LOG_ERR("System reset request failed (ret=%d)", ret); + return ret; + } + + return 0; +} + +/* Memory Management Functions */ + +int tisci_cmd_query_msmc(const struct device *dev, uint64_t *msmc_start, uint64_t *msmc_end) +{ + struct tisci_msg_resp_query_msmc resp; + struct tisci_msg_hdr req; + struct tisci_xfer *xfer; + int ret; + + if (!msmc_start || !msmc_end) { + return -EINVAL; + } + + xfer = tisci_setup_one_xfer(dev, TISCI_MSG_QUERY_MSMC, 0, &req, sizeof(req), &resp, + sizeof(resp)); + if (!xfer) { + LOG_ERR(" Failed to setup MSMC query transfer"); + return -EINVAL; + } + + ret = tisci_do_xfer(dev, xfer); + if (ret) { + LOG_ERR("MSMC query failed (ret=%d)", ret); + return ret; + } + + *msmc_start = + ((uint64_t)resp.msmc_start_high << TISCI_ADDR_HIGH_SHIFT) | resp.msmc_start_low; + *msmc_end = ((uint64_t)resp.msmc_end_high << TISCI_ADDR_HIGH_SHIFT) | resp.msmc_end_low; + + return 0; +} + +/* Firewall Management Functions */ + +int tisci_cmd_set_fwl_region(const struct device *dev, const struct tisci_msg_fwl_region *region) +{ + struct tisci_msg_fwl_set_firewall_region_req req; + struct tisci_msg_fwl_set_firewall_region_resp resp; + struct tisci_xfer *xfer; + int ret; + + if (!region) { + return -EINVAL; + } + + xfer = tisci_setup_one_xfer(dev, TISCI_MSG_FWL_SET, 0, &req, sizeof(req), &resp, + sizeof(resp)); + if (!xfer) { + LOG_ERR(" Failed to setup firewall config transfer"); + return -EINVAL; + } + + req.fwl_id = region->fwl_id; + req.region = region->region; + req.n_permission_regs = region->n_permission_regs; + req.control = region->control; + memcpy(req.permissions, region->permissions, sizeof(uint32_t) * FWL_MAX_PRIVID_SLOTS); + req.start_address = region->start_address; + req.end_address = region->end_address; + + ret = tisci_do_xfer(dev, xfer); + if (ret) { + LOG_ERR("Firewall config transfer failed (ret=%d)", ret); + return ret; + } + + return 0; +} + +int tisci_cmd_get_fwl_region(const struct device *dev, struct tisci_msg_fwl_region *region) +{ + struct tisci_msg_fwl_get_firewall_region_req req; + struct tisci_msg_fwl_get_firewall_region_resp resp; + struct tisci_xfer *xfer; + int ret; + + if (!region) { + return -EINVAL; + } + + xfer = tisci_setup_one_xfer(dev, TISCI_MSG_FWL_GET, 0, &req, sizeof(req), &resp, + sizeof(resp)); + if (!xfer) { + LOG_ERR(" Failed to setup firewall query transfer"); + return -EINVAL; + } + + req.fwl_id = region->fwl_id; + req.region = region->region; + req.n_permission_regs = region->n_permission_regs; + + ret = tisci_do_xfer(dev, xfer); + if (ret) { + LOG_ERR("Firewall query transfer failed (ret=%d)", ret); + return ret; + } + + region->fwl_id = resp.fwl_id; + region->region = resp.region; + region->n_permission_regs = resp.n_permission_regs; + region->control = resp.control; + memcpy(region->permissions, resp.permissions, sizeof(uint32_t) * FWL_MAX_PRIVID_SLOTS); + region->start_address = resp.start_address; + region->end_address = resp.end_address; + + return 0; +} + +int tisci_cmd_change_fwl_owner(const struct device *dev, struct tisci_msg_fwl_owner *owner) +{ + struct tisci_msg_fwl_change_owner_info_req req; + struct tisci_msg_fwl_change_owner_info_resp resp; + struct tisci_xfer *xfer; + int ret; + + if (!owner) { + return -EINVAL; + } + + xfer = tisci_setup_one_xfer(dev, TISCI_MSG_FWL_CHANGE_OWNER, 0, &req, sizeof(req), &resp, + sizeof(resp)); + if (!xfer) { + LOG_ERR(" Failed to setup firewall owner change transfer"); + return -EINVAL; + } + + req.fwl_id = owner->fwl_id; + req.region = owner->region; + req.owner_index = owner->owner_index; + + ret = tisci_do_xfer(dev, xfer); + if (ret) { + LOG_ERR("Firewall owner change failed (ret=%d)", ret); + return ret; + } + + owner->fwl_id = resp.fwl_id; + owner->region = resp.region; + owner->owner_index = resp.owner_index; + owner->owner_privid = resp.owner_privid; + owner->owner_permission_bits = resp.owner_permission_bits; + + return 0; +} + +/* UDMAP Management Functions */ + +int tisci_cmd_rm_udmap_tx_ch_cfg(const struct device *dev, + const struct tisci_msg_rm_udmap_tx_ch_cfg *params) +{ + struct tisci_msg_rm_udmap_tx_ch_cfg_req req; + struct tisci_msg_rm_udmap_tx_ch_cfg_resp resp; + struct tisci_xfer *xfer; + int ret; + + if (!params) { + return -EINVAL; + } + + xfer = tisci_setup_one_xfer(dev, TISCI_MSG_RM_UDMAP_TX_CH_CFG, 0, &req, sizeof(req), &resp, + sizeof(resp)); + if (!xfer) { + LOG_ERR(" Failed to setup UDMAP TX channel config transfer"); + return -EINVAL; + } + + /* Copy all configuration parameters */ + req.valid_params = params->valid_params; + req.nav_id = params->nav_id; + req.index = params->index; + req.tx_pause_on_err = params->tx_pause_on_err; + req.tx_filt_einfo = params->tx_filt_einfo; + req.tx_filt_pswords = params->tx_filt_pswords; + req.tx_atype = params->tx_atype; + req.tx_chan_type = params->tx_chan_type; + req.tx_supr_tdpkt = params->tx_supr_tdpkt; + req.tx_fetch_size = params->tx_fetch_size; + req.tx_credit_count = params->tx_credit_count; + req.txcq_qnum = params->txcq_qnum; + req.tx_priority = params->tx_priority; + req.tx_qos = params->tx_qos; + req.tx_orderid = params->tx_orderid; + req.fdepth = params->fdepth; + req.tx_sched_priority = params->tx_sched_priority; + req.tx_burst_size = params->tx_burst_size; + req.tx_tdtype = params->tx_tdtype; + req.extended_ch_type = params->extended_ch_type; + + ret = tisci_do_xfer(dev, xfer); + if (ret) { + LOG_ERR("UDMAP TX channel %u config failed (ret=%d)", params->index, ret); + return ret; + } + + LOG_DBG("UDMAP TX channel %u configured successfully", params->index); + return 0; +} + +int tisci_cmd_rm_udmap_rx_ch_cfg(const struct device *dev, + const struct tisci_msg_rm_udmap_rx_ch_cfg *params) +{ + struct tisci_msg_rm_udmap_rx_ch_cfg_req req; + struct tisci_msg_rm_udmap_rx_ch_cfg_resp resp; + struct tisci_xfer *xfer; + int ret; + + if (!params) { + return -EINVAL; + } + + xfer = tisci_setup_one_xfer(dev, TISCI_MSG_RM_UDMAP_RX_CH_CFG, 0, &req, sizeof(req), &resp, + sizeof(resp)); + if (!xfer) { + LOG_ERR(" Failed to setup UDMAP RX channel config transfer"); + return -EINVAL; + } + + /* Copy all configuration parameters */ + req.valid_params = params->valid_params; + req.nav_id = params->nav_id; + req.index = params->index; + req.rx_fetch_size = params->rx_fetch_size; + req.rxcq_qnum = params->rxcq_qnum; + req.rx_priority = params->rx_priority; + req.rx_qos = params->rx_qos; + req.rx_orderid = params->rx_orderid; + req.rx_sched_priority = params->rx_sched_priority; + req.flowid_start = params->flowid_start; + req.flowid_cnt = params->flowid_cnt; + req.rx_pause_on_err = params->rx_pause_on_err; + req.rx_atype = params->rx_atype; + req.rx_chan_type = params->rx_chan_type; + req.rx_ignore_short = params->rx_ignore_short; + req.rx_ignore_long = params->rx_ignore_long; + + ret = tisci_do_xfer(dev, xfer); + if (ret) { + LOG_ERR("UDMAP RX channel %u config failed (ret=%d)", params->index, ret); + return ret; + } + + LOG_DBG("UDMAP RX channel %u configured successfully", params->index); + return 0; +} + +/* PSI-L Management Functions */ + +int tisci_cmd_rm_psil_pair(const struct device *dev, uint32_t nav_id, uint32_t src_thread, + uint32_t dst_thread) +{ + struct tisci_msg_psil_pair_req req; + struct tisci_msg_psil_pair_resp resp; + struct tisci_xfer *xfer; + int ret; + + xfer = tisci_setup_one_xfer(dev, TISCI_MSG_RM_PSIL_PAIR, 0, &req, sizeof(req), &resp, + sizeof(resp)); + if (!xfer) { + LOG_ERR(" Failed to setup PSI-L pair transfer"); + return -EINVAL; + } + + req.nav_id = nav_id; + req.src_thread = src_thread; + req.dst_thread = dst_thread; + + ret = tisci_do_xfer(dev, xfer); + if (ret) { + LOG_ERR("PSI-L pair failed nav:%u %u->%u (ret=%d)", nav_id, src_thread, dst_thread, + ret); + return ret; + } + + LOG_DBG("PSI-L pair successful nav:%u %u->%u", nav_id, src_thread, dst_thread); + return 0; +} + +int tisci_cmd_rm_psil_unpair(const struct device *dev, uint32_t nav_id, uint32_t src_thread, + uint32_t dst_thread) +{ + struct tisci_msg_psil_unpair_req req; + struct tisci_msg_psil_unpair_resp resp; + struct tisci_xfer *xfer; + int ret; + + xfer = tisci_setup_one_xfer(dev, TISCI_MSG_RM_PSIL_UNPAIR, 0, &req, sizeof(req), &resp, + sizeof(resp)); + if (!xfer) { + LOG_ERR(" Failed to setup PSI-L unpair transfer"); + return -EINVAL; + } + + req.nav_id = nav_id; + req.src_thread = src_thread; + req.dst_thread = dst_thread; + + ret = tisci_do_xfer(dev, xfer); + if (ret) { + LOG_ERR("PSI-L unpair failed %u->%u (ret=%d)", src_thread, dst_thread, ret); + return ret; + } + + LOG_DBG("PSI-L unpair successful %u->%u", src_thread, dst_thread); + return 0; +} + +/* Interrupt Management Functions */ +int tisci_cmd_rm_irq_set(const struct device *dev, struct tisci_irq_set_req *client_req) +{ + struct tisci_xfer *xfer; + struct tisci_msg_rm_irq_set_resp resp = {0}; + int ret; + + if (!client_req) { + return -EINVAL; + } + + struct tisci_msg_rm_irq_set_req req = { + .hdr = {0}, + .valid_params = client_req->valid_params, + .src_id = client_req->src_id, + .src_index = client_req->src_index, + .dst_id = client_req->dst_id, + .dst_host_irq = client_req->dst_host_irq, + .ia_id = client_req->ia_id, + .vint = client_req->vint, + .global_event = client_req->global_event, + .vint_status_bit_index = client_req->vint_status_bit_index, + .secondary_host = client_req->secondary_host, + }; + + xfer = tisci_setup_one_xfer(dev, TISCI_MSG_RM_IRQ_SET, 0, &req, sizeof(req), &resp, + sizeof(resp)); + if (!xfer) { + LOG_ERR("Failed to setup transfer"); + return -EINVAL; + } + + ret = tisci_do_xfer(dev, xfer); + if (ret) { + LOG_ERR("Failed to set IRQ (ret=%d)", ret); + return ret; + } + + return 0; +} + +int tisci_cmd_rm_irq_release(const struct device *dev, struct tisci_irq_release_req *client_req) +{ + struct tisci_xfer *xfer; + struct tisci_msg_rm_irq_release_resp resp = {0}; + int ret; + + if (!client_req) { + return -EINVAL; + } + + struct tisci_msg_rm_irq_release_req req = { + .hdr = {0}, + .valid_params = client_req->valid_params, + .src_id = client_req->src_id, + .src_index = client_req->src_index, + .dst_id = client_req->dst_id, + .dst_host_irq = client_req->dst_host_irq, + .ia_id = client_req->ia_id, + .vint = client_req->vint, + .global_event = client_req->global_event, + .vint_status_bit_index = client_req->vint_status_bit_index, + .secondary_host = client_req->secondary_host, + }; + + xfer = tisci_setup_one_xfer(dev, TISCI_MSG_RM_IRQ_RELEASE, 0, &req, sizeof(req), &resp, + sizeof(resp)); + if (!xfer) { + LOG_ERR("Failed to setup transfer"); + return -EINVAL; + } + + ret = tisci_do_xfer(dev, xfer); + if (ret) { + LOG_ERR("Failed to release IRQ (ret=%d)", ret); + return ret; + } + + return 0; +} + +/* Init function */ +static int tisci_init(const struct device *dev) +{ + const struct tisci_config *config = dev->config; + struct tisci_data *data = dev->data; + int ret; + + k_sem_init(data->rx_message.response_ready_sem, 0, 1); + + ret = mbox_register_callback_dt(&config->mbox_rx, callback, &data->rx_message); + if (ret < 0) { + LOG_ERR("Could not register callback (%d)\n", ret); + return ret; + } + + ret = mbox_set_enabled_dt(&config->mbox_rx, true); + if (ret < 0) { + LOG_ERR("Could not enable RX channel (%d)\n", ret); + return ret; + } + return 0; +} + +/* Device Tree Instantiation */ +#define TISCI_DEFINE(_n) \ + static uint8_t rx_message_buf_##_n[MAILBOX_MBOX_SIZE] = {0}; \ + static struct k_sem response_ready_sem_##_n; \ + static struct tisci_data tisci_data_##_n = { \ + .seq = 0, \ + .rx_message = \ + { \ + .buf = rx_message_buf_##_n, \ + .size = sizeof(rx_message_buf_##_n), \ + .response_ready_sem = &response_ready_sem_##_n, \ + }, \ + .data_sem = Z_SEM_INITIALIZER(tisci_data_##_n.data_sem, 1, 1), \ + }; \ + static const struct tisci_config tisci_config_##_n = { \ + .mbox_tx = MBOX_DT_SPEC_INST_GET(_n, tx), \ + .mbox_rx = MBOX_DT_SPEC_INST_GET(_n, rx), \ + .host_id = DT_INST_PROP(_n, ti_host_id), \ + .max_msg_size = MAILBOX_MBOX_SIZE, \ + .max_rx_timeout_ms = 10000, \ + }; \ + DEVICE_DT_INST_DEFINE(_n, tisci_init, NULL, &tisci_data_##_n, &tisci_config_##_n, \ + PRE_KERNEL_1, CONFIG_TISCI_INIT_PRIORITY, NULL); + +DT_INST_FOREACH_STATUS_OKAY(TISCI_DEFINE) diff --git a/drivers/firmware/tisci/tisci.h b/drivers/firmware/tisci/tisci.h new file mode 100644 index 000000000000..59d3898c7c46 --- /dev/null +++ b/drivers/firmware/tisci/tisci.h @@ -0,0 +1,1820 @@ +/* + * Copyright (c) 2025, Texas Instruments + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @file + * @brief Texas Instruments System Control Interface (TISCI) Protocol + * + */ + +#ifndef INCLUDE_ZEPHYR_DRIVERS_TISCI_PROTOCOL_H_ +#define INCLUDE_ZEPHYR_DRIVERS_TISCI_PROTOCOL_H_ + +#include "zephyr/kernel.h" +#include +#include + +#ifndef __packed +#define __packed __attribute__((__packed__)) +#endif + +#define TISCI_MSG_ENABLE_WDT 0x0000 +#define TISCI_MSG_WAKE_RESET 0x0001 +#define TISCI_MSG_VERSION 0x0002 +#define TISCI_MSG_WAKE_REASON 0x0003 +#define TISCI_MSG_GOODBYE 0x0004 +#define TISCI_MSG_SYS_RESET 0x0005 +#define TISCI_MSG_BOARD_CONFIG 0x000b +#define TISCI_MSG_BOARD_CONFIG_RM 0x000c +#define TISCI_MSG_BOARD_CONFIG_SECURITY 0x000d +#define TISCI_MSG_BOARD_CONFIG_PM 0x000e +#define TISCI_MSG_QUERY_MSMC 0x0020 + +/* Device requests */ +#define TISCI_MSG_SET_DEVICE_STATE 0x0200 +#define TISCI_MSG_GET_DEVICE_STATE 0x0201 +#define TISCI_MSG_SET_DEVICE_RESETS 0x0202 + +/* Clock requests */ +#define TISCI_MSG_SET_CLOCK_STATE 0x0100 +#define TISCI_MSG_GET_CLOCK_STATE 0x0101 +#define TISCI_MSG_SET_CLOCK_PARENT 0x0102 +#define TISCI_MSG_GET_CLOCK_PARENT 0x0103 +#define TISCI_MSG_GET_NUM_CLOCK_PARENTS 0x0104 +#define TISCI_MSG_SET_CLOCK_FREQ 0x010c +#define TISCI_MSG_QUERY_CLOCK_FREQ 0x010d +#define TISCI_MSG_GET_CLOCK_FREQ 0x010e + +/* Processor Control Messages */ +#define TISCI_MSG_PROC_REQUEST 0xc000 +#define TISCI_MSG_PROC_RELEASE 0xc001 +#define TISCI_MSG_PROC_HANDOVER 0xc005 +#define TISCI_MSG_SET_PROC_BOOT_CONFIG 0xc100 +#define TISCI_MSG_SET_PROC_BOOT_CTRL 0xc101 +#define TISCI_MSG_PROC_AUTH_BOOT_IMAGE 0xc120 +#define TISCI_MSG_GET_PROC_BOOT_STATUS 0xc400 +#define TISCI_MSG_WAIT_PROC_BOOT_STATUS 0xc401 + +/* Resource Management Requests */ +/* RM TISCI message to request a resource range assignment for a host */ +#define TISCI_MSG_GET_RESOURCE_RANGE 0x1500 +/* RM TISCI message to set an IRQ between a peripheral and host processor */ +#define TISCI_MSG_RM_IRQ_SET (0x1000U) +/* RM TISCI message to release a configured IRQ */ +#define TISCI_MSG_RM_IRQ_RELEASE (0x1001U) + +/* NAVSS resource management */ +/* Ringacc requests */ +#define TISCI_MSG_RM_RING_CFG 0x1110 + +/* PSI-L requests */ +#define TISCI_MSG_RM_PSIL_PAIR 0x1280 +#define TISCI_MSG_RM_PSIL_UNPAIR 0x1281 + +#define TISCI_MSG_RM_UDMAP_TX_ALLOC 0x1200 +#define TISCI_MSG_RM_UDMAP_TX_FREE 0x1201 +#define TISCI_MSG_RM_UDMAP_RX_ALLOC 0x1210 +#define TISCI_MSG_RM_UDMAP_RX_FREE 0x1211 +#define TISCI_MSG_RM_UDMAP_FLOW_CFG 0x1220 +#define TISCI_MSG_RM_UDMAP_OPT_FLOW_CFG 0x1221 + +#define TISCI_MSG_RM_UDMAP_TX_CH_CFG 0x1205 +#define TISCI_MSG_RM_UDMAP_RX_CH_CFG 0x1215 +#define TISCI_MSG_RM_UDMAP_FLOW_SIZE_THRESH_CFG 0x1231 + +#define TISCI_MSG_FWL_SET 0x9000 +#define TISCI_MSG_FWL_GET 0x9001 +#define TISCI_MSG_FWL_CHANGE_OWNER 0x9002 + +/** + * @struct rx_msg + * @brief Received message details + * @param seq: Message sequence number + * @param size: Message size in bytes + * @param buf: Buffer for message data + * @param response_ready_sem: Semaphore to signal when a response is ready + */ +struct rx_msg { + uint8_t seq; + size_t size; + void *buf; + struct k_sem *response_ready_sem; +}; + +/** + * @struct tisci_msg_hdr + * @brief Generic Message Header for All messages and responses + * @param type: Type of messages: One of TISCI_MSG* values + * @param host: Host of the message + * @param seq: Message identifier indicating a transfer sequence + * @param flags: Flag for the message + */ +struct tisci_msg_hdr { + uint16_t type; + uint8_t host; + uint8_t seq; +#define TISCI_MSG_FLAG(val) (1 << (val)) +#define TISCI_FLAG_REQ_GENERIC_NORESPONSE 0x0 +#define TISCI_FLAG_REQ_ACK_ON_RECEIVED TISCI_MSG_FLAG(0) +#define TISCI_FLAG_REQ_ACK_ON_PROCESSED TISCI_MSG_FLAG(1) +#define TISCI_FLAG_RESP_GENERIC_NACK 0x0 +#define TISCI_FLAG_RESP_GENERIC_ACK TISCI_MSG_FLAG(1) + /* Additional Flags */ + uint32_t flags; +} __packed; + +/** + * @struct tisci_secure_msg_hdr + * @brief Header that prefixes all TISCI messages sent + * via secure transport. + * @param checksum: crc16 checksum for the entire message + * @param reserved: Reserved for future use. + */ +struct tisci_secure_msg_hdr { + uint16_t checksum; + uint16_t reserved; +} __packed; + +/** + * @struct tisci_msg_resp_version + * @brief Response for a message + * + * In general, ABI version changes follow the rule that minor version increments + * are backward compatible. Major revision changes in ABI may not be + * backward compatible. + * + * Response to a generic message with message type TISCI_MSG_VERSION + * @param hdr: Generic header + * @param firmware_description: String describing the firmware + * @param firmware_revision: Firmware revision + * @param abi_major: Major version of the ABI that firmware supports + * @param abi_minor: Minor version of the ABI that firmware supports + */ +struct tisci_msg_resp_version { + struct tisci_msg_hdr hdr; + char firmware_description[32]; + uint16_t firmware_revision; + uint8_t abi_major; + uint8_t abi_minor; +} __packed; + +/** + * @struct tisci_msg_req_reboot + * @brief Reboot the SoC + * @param hdr: Generic Header + * @param domain: Domain to be reset, 0 for full SoC reboot. + * + * Request type is TISCI_MSG_SYS_RESET, responded with a generic + * ACK/NACK message. + */ +struct tisci_msg_req_reboot { + struct tisci_msg_hdr hdr; + uint8_t domain; +} __packed; + +/** + * @struct tisci_msg_resp_reboot + * @brief Response to system reset (generic ACK/NACK) + */ +struct tisci_msg_resp_reboot { + struct tisci_msg_hdr hdr; +} __packed; + +/** + * @struct tisci_msg_board_config_req + * @brief Board configuration message + * @param hdr: Generic Header + * @param boardcfgp_low: Lower 32 bit of the pointer pointing to the board + * configuration data + * @param boardcfgp_high: Upper 32 bit of the pointer pointing to the board + * configuration data + * @param boardcfg_size: Size of board configuration data object + * Request type is TISCI_MSG_BOARD_CONFIG, responded with a generic + * ACK/NACK message. + */ +struct tisci_msg_board_config_req { + struct tisci_msg_hdr hdr; + uint32_t boardcfgp_low; + uint32_t boardcfgp_high; + uint16_t boardcfg_size; +} __packed; + +/** + * @struct tisci_msg_board_config_resp + * @brief Response to board config request (generic ACK/NACK) + * @param hdr: Generic Header + */ +struct tisci_msg_board_config_resp { + struct tisci_msg_hdr hdr; +} __packed; + +/** + * @struct tisci_msg_resp_query_msmc + * @brief Query msmc message response structure + * @param hdr: Generic Header + * @param msmc_start_low: Lower 32 bit of msmc start + * @param msmc_start_high: Upper 32 bit of msmc start + * @param msmc_end_low: Lower 32 bit of msmc end + * @param msmc_end_high: Upper 32 bit of msmc end + * + * @brief Response to a generic message with message type TISCI_MSG_QUERY_MSMC + */ +struct tisci_msg_resp_query_msmc { + struct tisci_msg_hdr hdr; + uint32_t msmc_start_low; + uint32_t msmc_start_high; + uint32_t msmc_end_low; + uint32_t msmc_end_high; +} __packed; + +/** + * @struct tisci_msg_req_set_device_state + * @brief Set the desired state of the device + * @param hdr: Generic header + * @param id: Indicates which device to modify + * @param reserved: Reserved space in message, must be 0 for backward compatibility + * @param state: The desired state of the device. + * + * Certain flags can also be set to alter the device state: + * MSG_FLAG_DEVICE_WAKE_ENABLED - Configure the device to be a wake source. + * The meaning of this flag will vary slightly from device to device and from + * SoC to SoC but it generally allows the device to wake the SoC out of deep + * suspend states. + * MSG_FLAG_DEVICE_RESET_ISO - Enable reset isolation for this device. + * MSG_FLAG_DEVICE_EXCLUSIVE - Claim this device exclusively. When passed + * with STATE_RETENTION or STATE_ON, it will claim the device exclusively. + * If another host already has this device set to STATE_RETENTION or STATE_ON, + * the message will fail. Once successful, other hosts attempting to set + * STATE_RETENTION or STATE_ON will fail. + * + * Request type is TISCI_MSG_SET_DEVICE_STATE, responded with a generic + * ACK/NACK message. + */ +struct tisci_msg_req_set_device_state { + /* Additional hdr->flags options */ +#define MSG_FLAG_DEVICE_WAKE_ENABLED TISCI_MSG_FLAG(8) +#define MSG_FLAG_DEVICE_RESET_ISO TISCI_MSG_FLAG(9) +#define MSG_FLAG_DEVICE_EXCLUSIVE TISCI_MSG_FLAG(10) + struct tisci_msg_hdr hdr; + uint32_t id; + uint32_t reserved; + +#define MSG_DEVICE_SW_STATE_AUTO_OFF 0 +#define MSG_DEVICE_SW_STATE_RETENTION 1 +#define MSG_DEVICE_SW_STATE_ON 2 + uint8_t state; +} __packed; + +/** + * @struct tisci_msg_resp_set_device_state + * @brief Response to set device state (generic ACK/NACK) + */ +struct tisci_msg_resp_set_device_state { + struct tisci_msg_hdr hdr; +} __packed; + +/** + * @struct tisci_msg_req_get_device_state + * @brief Request to get device. + * @param hdr: Generic header + * @param id: Device Identifier + * + * Request type is TISCI_MSG_GET_DEVICE_STATE, responded device state + * information + */ +struct tisci_msg_req_get_device_state { + struct tisci_msg_hdr hdr; + uint32_t id; +} __packed; + +/** + * @struct tisci_msg_resp_get_device_state + * @brief Response to get device request. + * @param hdr: Generic header + * @param context_loss_count: Indicates how many times the device has lost context. A + * driver can use this monotonic counter to determine if the device has + * lost context since the last time this message was exchanged. + * @param resets: Programmed state of the reset lines. + * @param programmed_state: The state as programmed by set_device. + * - Uses the MSG_DEVICE_SW_* macros + * @param current_state: The actual state of the hardware. + * + * Response to request TISCI_MSG_GET_DEVICE_STATE. + */ +struct tisci_msg_resp_get_device_state { + struct tisci_msg_hdr hdr; + uint32_t context_loss_count; + uint32_t resets; + uint8_t programmed_state; +#define MSG_DEVICE_HW_STATE_OFF 0 +#define MSG_DEVICE_HW_STATE_ON 1 +#define MSG_DEVICE_HW_STATE_TRANS 2 + uint8_t current_state; +} __packed; + +/** + * @struct tisci_msg_req_set_device_reset + * @brief Set the desired resets configuration of the device + * @param hdr: Generic header + * @param id: Indicates which device to modify + * @param resets: A bit field of resets for the device. The meaning, behavior, + * and usage of the reset flags are device specific. 0 for a bit + * indicates releasing the reset represented by that bit while 1 + * indicates keeping it held. + * + * Request type is TISCI_MSG_SET_DEVICE_RESETS, responded with a generic + * ACK/NACK message. + */ +struct tisci_msg_req_set_device_resets { + struct tisci_msg_hdr hdr; + uint32_t id; + uint32_t resets; +} __packed; + +/** + * @struct tisci_msg_resp_set_device_resets + * @brief Response to set device resets request (generic ACK/NACK) + */ +struct tisci_msg_resp_set_device_resets { + struct tisci_msg_hdr hdr; +} __packed; + +/** + * @struct tisci_msg_req_set_clock_state + * @brief Request to setup a Clock state + * @param hdr: Generic Header, Certain flags can be set specific to the clocks: + * MSG_FLAG_CLOCK_ALLOW_SSC: Allow this clock to be modified + * via spread spectrum clocking. + * MSG_FLAG_CLOCK_ALLOW_FREQ_CHANGE: Allow this clock's + * frequency to be changed while it is running so long as it + * is within the min/max limits. + * MSG_FLAG_CLOCK_INPUT_TERM: Enable input termination, this + * is only applicable to clock inputs on the SoC pseudo-device. + * @param dev_id: Device identifier this request is for + * @param clk_id: Clock identifier for the device for this request. + * Each device has it's own set of clock inputs. This indexes + * which clock input to modify. + * @param request_state: Request the state for the clock to be set to. + * MSG_CLOCK_SW_STATE_UNREQ: The IP does not require this clock, + * it can be disabled, regardless of the state of the device + * MSG_CLOCK_SW_STATE_AUTO: Allow the System Controller to + * automatically manage the state of this clock. If the device + * is enabled, then the clock is enabled. If the device is set + * to off or retention, then the clock is internally set as not + * being required by the device.(default) + * MSG_CLOCK_SW_STATE_REQ: Configure the clock to be enabled, + * regardless of the state of the device. + * + * Normally, all required clocks are managed by TISCI entity, this is used + * only for specific control *IF* required. Auto managed state is + * MSG_CLOCK_SW_STATE_AUTO, in other states, TISCI entity assume remote + * will explicitly control. + * + * Request type is TISCI_MSG_SET_CLOCK_STATE, response is a generic + * ACK or NACK message. + */ +struct tisci_msg_req_set_clock_state { + /* Additional hdr->flags options */ +#define MSG_FLAG_CLOCK_ALLOW_SSC TISCI_MSG_FLAG(8) +#define MSG_FLAG_CLOCK_ALLOW_FREQ_CHANGE TISCI_MSG_FLAG(9) +#define MSG_FLAG_CLOCK_INPUT_TERM TISCI_MSG_FLAG(10) + struct tisci_msg_hdr hdr; + uint32_t dev_id; + uint8_t clk_id; +#define MSG_CLOCK_SW_STATE_UNREQ 0 +#define MSG_CLOCK_SW_STATE_AUTO 1 +#define MSG_CLOCK_SW_STATE_REQ 2 + uint8_t request_state; +} __packed; + +/** + * @struct tisci_msg_resp_set_clock_state + * @brief Response to set clock state (generic ACK/NACK) + */ +struct tisci_msg_resp_set_clock_state { + struct tisci_msg_hdr hdr; +} __packed; + +/** + * @struct tisci_msg_req_get_clock_state + * @brief Request for clock state + * @param hdr: Generic Header + * @param dev_id: Device identifier this request is for + * @param clk_id: Clock identifier for the device for this request. + * Each device has it's own set of clock inputs. This indexes + * which clock input to get state of. + * + * Request type is TISCI_MSG_GET_CLOCK_STATE, response is state + * of the clock + */ +struct tisci_msg_req_get_clock_state { + struct tisci_msg_hdr hdr; + uint32_t dev_id; + uint8_t clk_id; +} __packed; + +/** + * @struct tisci_msg_resp_get_clock_state + * @brief Response to get clock state + * @param hdr: Generic Header + * @param programmed_state: Any programmed state of the clock. This is one of + * MSG_CLOCK_SW_STATE* values. + * @param current_state: Current state of the clock. This is one of: + * MSG_CLOCK_HW_STATE_NOT_READY: Clock is not ready + * MSG_CLOCK_HW_STATE_READY: Clock is ready + * + * Response to TISCI_MSG_GET_CLOCK_STATE. + */ +struct tisci_msg_resp_get_clock_state { + struct tisci_msg_hdr hdr; + uint8_t programmed_state; +#define MSG_CLOCK_HW_STATE_NOT_READY 0 +#define MSG_CLOCK_HW_STATE_READY 1 + uint8_t current_state; +} __packed; + +/** + * @struct tisci_msg_req_set_clock_parent + * @brief Set the clock parent + * @param hdr: Generic Header + * @param dev_id: Device identifier this request is for + * @param clk_id: Clock identifier for the device for this request. + * Each device has it's own set of clock inputs. This indexes + * which clock input to modify. + * @param parent_id: The new clock parent is selectable by an index via this + * parameter. + * + * Request type is TISCI_MSG_SET_CLOCK_PARENT, response is generic + * ACK / NACK message. + */ +struct tisci_msg_req_set_clock_parent { + struct tisci_msg_hdr hdr; + uint32_t dev_id; + uint8_t clk_id; + uint8_t parent_id; +} __packed; + +/** + * @struct tisci_msg_resp_set_clock_parent + * @brief Response to set clock parent (generic ACK/NACK) + */ +struct tisci_msg_resp_set_clock_parent { + struct tisci_msg_hdr hdr; +} __packed; + +/** + * @struct tisci_msg_req_get_clock_parent + * @brief Get the clock parent + * @param hdr: Generic Header + * @param dev_id: Device identifier this request is for + * @param clk_id: Clock identifier for the device for this request. + * Each device has it's own set of clock inputs. This indexes + * which clock input to get the parent for. + * + * Request type is TISCI_MSG_GET_CLOCK_PARENT, response is parent information + */ +struct tisci_msg_req_get_clock_parent { + struct tisci_msg_hdr hdr; + uint32_t dev_id; + uint8_t clk_id; +} __packed; + +/** + * @struct tisci_msg_resp_get_clock_parent + * @brief Response with clock parent + * @param hdr: Generic Header + * @param parent_id: The current clock parent + * + * Response to TISCI_MSG_GET_CLOCK_PARENT. + */ +struct tisci_msg_resp_get_clock_parent { + struct tisci_msg_hdr hdr; + uint8_t parent_id; +} __packed; + +/** + * @struct tisci_msg_req_get_clock_num_parents + * @brief Request to get clock parents + * @param hdr: Generic header + * @param dev_id: Device identifier this request is for + * @param clk_id: Clock identifier for the device for this request. + * + * This request provides information about how many clock parent options + * are available for a given clock to a device. This is typically used + * for input clocks. + * + * Request type is TISCI_MSG_GET_NUM_CLOCK_PARENTS, response is appropriate + * message, or NACK in case of inability to satisfy request. + */ +struct tisci_msg_req_get_clock_num_parents { + struct tisci_msg_hdr hdr; + uint32_t dev_id; + uint8_t clk_id; +} __packed; + +/** + * @struct tisci_msg_resp_get_clock_num_parents + * @brief Response for get clk parents + * @param hdr: Generic header + * @param num_parents: Number of clock parents + * + * Response to TISCI_MSG_GET_NUM_CLOCK_PARENTS + */ +struct tisci_msg_resp_get_clock_num_parents { + struct tisci_msg_hdr hdr; + uint8_t num_parents; +} __packed; + +/** + * @struct tisci_msg_req_query_clock_freq + * @brief Request to query a frequency + * @param hdr: Generic Header + * @param dev_id: Device identifier this request is for + * @param min_freq_hz: The minimum allowable frequency in Hz. This is the minimum + * allowable programmed frequency and does not account for clock + * tolerances and jitter. + * @param target_freq_hz: The target clock frequency. A frequency will be found + * as close to this target frequency as possible. + * @param max_freq_hz: The maximum allowable frequency in Hz. This is the maximum + * allowable programmed frequency and does not account for clock + * tolerances and jitter. + * @param clk_id: Clock identifier for the device for this request. + * + * NOTE: Normally clock frequency management is automatically done by TISCI + * entity. In case of specific requests, TISCI evaluates capability to achieve + * requested frequency within provided range and responds with + * result message. + * + * Request type is TISCI_MSG_QUERY_CLOCK_FREQ, response is appropriate message, + * or NACK in case of inability to satisfy request. + */ +struct tisci_msg_req_query_clock_freq { + struct tisci_msg_hdr hdr; + uint32_t dev_id; + uint64_t min_freq_hz; + uint64_t target_freq_hz; + uint64_t max_freq_hz; + uint8_t clk_id; +} __packed; + +/** + * @struct tisci_msg_resp_query_clock_freq + * @brief Response to a clock frequency query + * @param hdr: Generic Header + * @param freq_hz: Frequency that is the best match in Hz. + * + * Response to request type TISCI_MSG_QUERY_CLOCK_FREQ. NOTE: if the request + * cannot be satisfied, the message will be of type NACK. + */ +struct tisci_msg_resp_query_clock_freq { + struct tisci_msg_hdr hdr; + uint64_t freq_hz; +} __packed; + +/** + * @struct tisci_msg_req_set_clock_freq + * @brief Request to setup a clock frequency + * @param hdr: Generic Header + * @param dev_id: Device identifier this request is for + * @param min_freq_hz: The minimum allowable frequency in Hz. This is the minimum + * allowable programmed frequency and does not account for clock + * tolerances and jitter. + * @param target_freq_hz: The target clock frequency. The clock will be programmed + * at a rate as close to this target frequency as possible. + * @param max_freq_hz: The maximum allowable frequency in Hz. This is the maximum + * allowable programmed frequency and does not account for clock + * tolerances and jitter. + * @param clk_id: Clock identifier for the device for this request. + * + * NOTE: Normally clock frequency management is automatically done by TISCI + * entity. In case of specific requests, TISCI evaluates capability to achieve + * requested range and responds with success/failure message. + * + * This sets the desired frequency for a clock within an allowable + * range. This message will fail on an enabled clock unless + * MSG_FLAG_CLOCK_ALLOW_FREQ_CHANGE is set for the clock. Additionally, + * if other clocks have their frequency modified due to this message, + * they also must have the MSG_FLAG_CLOCK_ALLOW_FREQ_CHANGE or be disabled. + * + * Calling set frequency on a clock input to the SoC pseudo-device will + * inform the PMMC of that clock's frequency. Setting a frequency of + * zero will indicate the clock is disabled. + * + * Calling set frequency on clock outputs from the SoC pseudo-device will + * function similarly to setting the clock frequency on a device. + * + * Request type is TISCI_MSG_SET_CLOCK_FREQ, response is a generic ACK/NACK + * message. + */ +struct tisci_msg_req_set_clock_freq { + struct tisci_msg_hdr hdr; + uint32_t dev_id; + uint64_t min_freq_hz; + uint64_t target_freq_hz; + uint64_t max_freq_hz; + uint8_t clk_id; +} __packed; + +/** + * @struct tisci_msg_resp_set_clock_freq + * @brief Response to set clock frequency (generic ACK/NACK) + */ +struct tisci_msg_resp_set_clock_freq { + struct tisci_msg_hdr hdr; +} __packed; + +/** + * @struct tisci_msg_req_get_clock_freq + * @brief Request to get the clock frequency + * @param hdr: Generic Header + * @param dev_id: Device identifier this request is for + * @param clk_id: Clock identifier for the device for this request. + * + * NOTE: Normally clock frequency management is automatically done by TISCI + * entity. In some cases, clock frequencies are configured by host. + * + * Request type is TISCI_MSG_GET_CLOCK_FREQ, responded with clock frequency + * that the clock is currently at. + */ +struct tisci_msg_req_get_clock_freq { + struct tisci_msg_hdr hdr; + uint32_t dev_id; + uint8_t clk_id; +} __packed; + +/** + * @struct tisci_msg_resp_get_clock_freq + * @brief Response of clock frequency request + * @param hdr: Generic Header + * @param freq_hz: Frequency that the clock is currently on, in Hz. + * + * Response to request type TISCI_MSG_GET_CLOCK_FREQ. + */ +struct tisci_msg_resp_get_clock_freq { + struct tisci_msg_hdr hdr; + uint64_t freq_hz; +} __packed; + +#define TISCI_IRQ_SECONDARY_HOST_INVALID 0xff + +/** + * @struct tisci_msg_req_get_resource_range + * @brief Request to get a host's assigned + * range of resources. + * @param hdr: Generic Header + * @param type: Unique resource assignment type + * @param subtype: Resource assignment subtype within the resource type. + * @param secondary_host: Host processing entity to which the resources are + * allocated. This is required only when the destination + * host id id different from ti sci interface host id, + * else TISCI_IRQ_SECONDARY_HOST_INVALID can be passed. + * + * Request type is TISCI_MSG_GET_RESOURCE_RANGE. Responded with requested + * resource range which is of type TISCI_MSG_GET_RESOURCE_RANGE. + */ +struct tisci_msg_req_get_resource_range { + struct tisci_msg_hdr hdr; +#define MSG_RM_RESOURCE_TYPE_MASK GENMASK(9, 0) +#define MSG_RM_RESOURCE_SUBTYPE_MASK GENMASK(5, 0) + uint16_t type; + uint8_t subtype; + uint8_t secondary_host; +} __packed; + +/** + * @struct tisci_msg_resp_get_resource_range + * @brief Response to resource get range. + * @param hdr: Generic Header + * @param range_start: Start index of the resource range. + * @param range_num: Number of resources in the range. + * + * Response to request TISCI_MSG_GET_RESOURCE_RANGE. + */ +struct tisci_msg_resp_get_resource_range { + struct tisci_msg_hdr hdr; + uint16_t range_start; + uint16_t range_num; +} __packed; +#define TISCI_ADDR_LOW_MASK GENMASK64(31, 0) +#define TISCI_ADDR_HIGH_MASK GENMASK64(63, 32) +#define TISCI_ADDR_HIGH_SHIFT 32 + +/** + * @struct tisci_msg_req_proc_request + * @brief Request a processor + * + * @param hdr: Generic Header + * @param processor_id: ID of processor + * + * Request type is TISCI_MSG_PROC_REQUEST, response is a generic ACK/NACK + * message. + */ +struct tisci_msg_req_proc_request { + struct tisci_msg_hdr hdr; + uint8_t processor_id; +} __packed; + +/** + * @struct tisci_msg_resp_proc_request + * @brief Response to processor request (generic ACK/NACK) + */ +struct tisci_msg_resp_proc_request { + struct tisci_msg_hdr hdr; +} __packed; + +/** + * @struct tisci_msg_req_proc_release + * @brief Release a processor + * + * @param hdr: Generic Header + * @param processor_id: ID of processor + * + * Request type is TISCI_MSG_PROC_RELEASE, response is a generic ACK/NACK + * message. + */ +struct tisci_msg_req_proc_release { + struct tisci_msg_hdr hdr; + uint8_t processor_id; +} __packed; + +/** + * @struct tisci_msg_resp_proc_release + * @brief Response to processor release (generic ACK/NACK) + */ +struct tisci_msg_resp_proc_release { + struct tisci_msg_hdr hdr; +} __packed; + +/** + * @struct tisci_msg_req_proc_handover + * @brief Handover a processor to a host + * + * @param hdr: Generic Header + * @param processor_id: ID of processor + * @param host_id: New Host we want to give control to + * + * Request type is TISCI_MSG_PROC_HANDOVER, response is a generic ACK/NACK + * message. + */ +struct tisci_msg_req_proc_handover { + struct tisci_msg_hdr hdr; + uint8_t processor_id; + uint8_t host_id; +} __packed; + +/** + * @struct tisci_msg_resp_proc_handover + * @brief Response to processor handover (generic ACK/NACK) + */ +struct tisci_msg_resp_proc_handover { + struct tisci_msg_hdr hdr; +} __packed; + +/* A53 Config Flags */ +#define PROC_BOOT_CFG_FLAG_ARMV8_DBG_EN 0x00000001 +#define PROC_BOOT_CFG_FLAG_ARMV8_DBG_NIDEN 0x00000002 +#define PROC_BOOT_CFG_FLAG_ARMV8_DBG_SPIDEN 0x00000004 +#define PROC_BOOT_CFG_FLAG_ARMV8_DBG_SPNIDEN 0x00000008 +#define PROC_BOOT_CFG_FLAG_ARMV8_AARCH32 0x00000100 + +/* R5 Config Flags */ +#define PROC_BOOT_CFG_FLAG_R5_DBG_EN 0x00000001 +#define PROC_BOOT_CFG_FLAG_R5_DBG_NIDEN 0x00000002 +#define PROC_BOOT_CFG_FLAG_R5_LOCKSTEP 0x00000100 +#define PROC_BOOT_CFG_FLAG_R5_TEINIT 0x00000200 +#define PROC_BOOT_CFG_FLAG_R5_NMFI_EN 0x00000400 +#define PROC_BOOT_CFG_FLAG_R5_TCM_RSTBASE 0x00000800 +#define PROC_BOOT_CFG_FLAG_R5_BTCM_EN 0x00001000 +#define PROC_BOOT_CFG_FLAG_R5_ATCM_EN 0x00002000 + +/** + * @struct tisci_msg_req_set_proc_boot_config + * @brief Set Processor boot configuration + * @param hdr: Generic Header + * @param processor_id: ID of processor + * @param bootvector_low: Lower 32bit (Little Endian) of boot vector + * @param bootvector_high: Higher 32bit (Little Endian) of boot vector + * @param config_flags_set: Optional Processor specific Config Flags to set. + * Setting a bit here implies required bit sets to 1. + * @param config_flags_clear: Optional Processor specific Config Flags to clear. + * Setting a bit here implies required bit gets cleared. + * + * Request type is TISCI_MSG_SET_PROC_BOOT_CONFIG, response is a generic + * ACK/NACK message. + */ +struct tisci_msg_req_set_proc_boot_config { + struct tisci_msg_hdr hdr; + uint8_t processor_id; + uint32_t bootvector_low; + uint32_t bootvector_high; + uint32_t config_flags_set; + uint32_t config_flags_clear; +} __packed; + +/** + * @struct tisci_msg_resp_set_proc_boot_config + * @brief Response to set processor boot config (generic ACK/NACK) + */ +struct tisci_msg_resp_set_proc_boot_config { + struct tisci_msg_hdr hdr; +} __packed; + +/* R5 Control Flags */ +#define PROC_BOOT_CTRL_FLAG_R5_CORE_HALT 0x00000001 + +/** + * @struct tisci_msg_req_set_proc_boot_ctrl + * @brief Set Processor boot control flags + * @param hdr: Generic Header + * @param processor_id: ID of processor + * @param control_flags_set: Optional Processor specific Control Flags to set. + * Setting a bit here implies required bit sets to 1. + * @param control_flags_clear:Optional Processor specific Control Flags to clear. + * Setting a bit here implies required bit gets cleared. + * + * Request type is TISCI_MSG_SET_PROC_BOOT_CTRL, response is a generic ACK/NACK + * message. + */ +struct tisci_msg_req_set_proc_boot_ctrl { + struct tisci_msg_hdr hdr; + uint8_t processor_id; + uint32_t control_flags_set; + uint32_t control_flags_clear; +} __packed; + +/** + * @struct tisci_msg_resp_set_proc_boot_ctrl + * @brief Response to set processor boot control (generic ACK/NACK) + */ +struct tisci_msg_resp_set_proc_boot_ctrl { + struct tisci_msg_hdr hdr; +} __packed; + +/** + * @struct tisci_msg_req_proc_auth_start_image + * @brief Authenticate and start image + * @param hdr: Generic Header + * @param cert_addr_low: Lower 32bit (Little Endian) of certificate + * @param cert_addr_high: Higher 32bit (Little Endian) of certificate + * + * Request type is TISCI_MSG_PROC_AUTH_BOOT_IMAGE, response is a generic + * ACK/NACK message. + */ +struct tisci_msg_req_proc_auth_boot_image { + struct tisci_msg_hdr hdr; + uint32_t cert_addr_low; + uint32_t cert_addr_high; +} __packed; + +struct tisci_msg_resp_proc_auth_boot_image { + struct tisci_msg_hdr hdr; + uint32_t image_addr_low; + uint32_t image_addr_high; + uint32_t image_size; +} __packed; + +/** + * @struct tisci_msg_req_get_proc_boot_status + * @brief Get processor boot status + * @param hdr: Generic Header + * @param processor_id: ID of processor + * + * Request type is TISCI_MSG_GET_PROC_BOOT_STATUS, response is appropriate + * message, or NACK in case of inability to satisfy request. + */ +struct tisci_msg_req_get_proc_boot_status { + struct tisci_msg_hdr hdr; + uint8_t processor_id; +} __packed; + +/* ARMv8 Status Flags */ +#define PROC_BOOT_STATUS_FLAG_ARMV8_WFE 0x00000001 +#define PROC_BOOT_STATUS_FLAG_ARMV8_WFI 0x00000002 + +/* R5 Status Flags */ +#define PROC_BOOT_STATUS_FLAG_R5_WFE 0x00000001 +#define PROC_BOOT_STATUS_FLAG_R5_WFI 0x00000002 +#define PROC_BOOT_STATUS_FLAG_R5_CLK_GATED 0x00000004 +#define PROC_BOOT_STATUS_FLAG_R5_LOCKSTEP_PERMITTED 0x00000100 + +/** + * @struct tisci_msg_resp_get_proc_boot_status + * @brief Processor boot status response + * @param hdr: Generic Header + * @param processor_id: ID of processor + * @param bootvector_low: Lower 32bit (Little Endian) of boot vector + * @param bootvector_high: Higher 32bit (Little Endian) of boot vector + * @param config_flags: Optional Processor specific Config Flags set. + * @param control_flags: Optional Processor specific Control Flags. + * @param status_flags: Optional Processor specific Status Flags set. + * + * Response to TISCI_MSG_GET_PROC_BOOT_STATUS. + */ +struct tisci_msg_resp_get_proc_boot_status { + struct tisci_msg_hdr hdr; + uint8_t processor_id; + uint32_t bootvector_low; + uint32_t bootvector_high; + uint32_t config_flags; + uint32_t control_flags; + uint32_t status_flags; +} __packed; + +/** + * @struct tisci_msg_req_wait_proc_boot_status + * @brief Wait for a processor boot status + * @param hdr: Generic Header + * @param processor_id: ID of processor + * @param num_wait_iterations: Total number of iterations we will check before + * we will timeout and give up + * @param num_match_iterations: How many iterations should we have continued + * status to account for status bits glitching. + * This is to make sure that match occurs for + * consecutive checks. This implies that the + * worst case should consider that the stable + * time should at the worst be num_wait_iterations + * num_match_iterations to prevent timeout. + * @param delay_per_iteration_us: Specifies how long to wait (in micro seconds) + * between each status checks. This is the minimum + * duration, and overhead of register reads and + * checks are on top of this and can vary based on + * varied conditions. + * @param delay_before_iterations_us: Specifies how long to wait (in micro seconds) + * before the very first check in the first + * iteration of status check loop. This is the + * minimum duration, and overhead of register + * reads and checks are. + * @param status_flags_1_set_all_wait:If non-zero, Specifies that all bits of the + * status matching this field requested MUST be 1. + * @param status_flags_1_set_any_wait:If non-zero, Specifies that at least one of the + * bits matching this field requested MUST be 1. + * @param status_flags_1_clr_all_wait:If non-zero, Specifies that all bits of the + * status matching this field requested MUST be 0. + * @param status_flags_1_clr_any_wait:If non-zero, Specifies that at least one of the + * bits matching this field requested MUST be 0. + * + * Request type is TISCI_MSG_WAIT_PROC_BOOT_STATUS, response is appropriate + * message, or NACK in case of inability to satisfy request. + */ +struct tisci_msg_req_wait_proc_boot_status { + struct tisci_msg_hdr hdr; + uint8_t processor_id; + uint8_t num_wait_iterations; + uint8_t num_match_iterations; + uint8_t delay_per_iteration_us; + uint8_t delay_before_iterations_us; + uint32_t status_flags_1_set_all_wait; + uint32_t status_flags_1_set_any_wait; + uint32_t status_flags_1_clr_all_wait; + uint32_t status_flags_1_clr_any_wait; +} __packed; + +/** + * @struct tisci_msg_rm_ring_cfg_req + * @brief Configure a Navigator Subsystem ring + * + * Configures the non-real-time registers of a Navigator Subsystem ring. + * @param hdr: Generic Header + * @param valid_params: Bitfield defining validity of ring configuration parameters. + * The ring configuration fields are not valid, and will not be used for + * ring configuration, if their corresponding valid bit is zero. + * Valid bit usage: + * 0 - Valid bit for tisci_msg_rm_ring_cfg_req addr_lo + * 1 - Valid bit for tisci_msg_rm_ring_cfg_req addr_hi + * 2 - Valid bit for tisci_msg_rm_ring_cfg_req count + * 3 - Valid bit for tisci_msg_rm_ring_cfg_req mode + * 4 - Valid bit for tisci_msg_rm_ring_cfg_req size + * 5 - Valid bit for tisci_msg_rm_ring_cfg_req order_id + * @param nav_id: Device ID of Navigator Subsystem from which the ring is allocated + * @param index: ring index to be configured. + * @param addr_lo: 32 LSBs of ring base address to be programmed into the ring's + * RING_BA_LO register + * @param addr_hi: 16 MSBs of ring base address to be programmed into the ring's + * RING_BA_HI register. + * @param count: Number of ring elements. Must be even if mode is CREDENTIALS or QM + * modes. + * @param mode: Specifies the mode the ring is to be configured. + * @param size: Specifies encoded ring element size. To calculate the encoded size use + * the formula (log2(size_bytes) - 2), where size_bytes cannot be + * greater than 256. + * @param order_id: Specifies the ring's bus order ID. + */ +struct tisci_msg_rm_ring_cfg_req { + struct tisci_msg_hdr hdr; + uint32_t valid_params; + uint16_t nav_id; + uint16_t index; + uint32_t addr_lo; + uint32_t addr_hi; + uint32_t count; + uint8_t mode; + uint8_t size; + uint8_t order_id; +} __packed; + +/** + * @struct tisci_msg_rm_ring_cfg_resp + * @brief Response to configuring a ring. + * + * @param hdr: Generic Header + */ +struct tisci_msg_rm_ring_cfg_resp { + struct tisci_msg_hdr hdr; +} __packed; + +/** + * @struct tisci_msg_rm_ring_get_cfg_req + * @brief Get RA ring's configuration + * + * Gets the configuration of the non-real-time register fields of a ring. The + * host, or a supervisor of the host, who owns the ring must be the requesting + * host. The values of the non-real-time registers are returned in + * tisci_msg_rm_ring_get_cfg_resp. + * + * @param hdr: Generic Header + * @param nav_id: Device ID of Navigator Subsystem from which the ring is allocated + * @param index: ring index. + */ +struct tisci_msg_rm_ring_get_cfg_req { + struct tisci_msg_hdr hdr; + uint16_t nav_id; + uint16_t index; +} __packed; + +/** + * @struct tisci_msg_rm_ring_get_cfg_resp + * @brief Ring get configuration response + * + * Response received by host processor after RM has handled + * @ref tisci_msg_rm_ring_get_cfg_req. The response contains the ring's + * non-real-time register values. + * + * @param hdr: Generic Header + * @param addr_lo: Ring 32 LSBs of base address + * @param addr_hi: Ring 16 MSBs of base address. + * @param count: Ring number of elements. + * @param mode: Ring mode. + * @param size: encoded Ring element size + * @param order_id: ing order ID. + */ +struct tisci_msg_rm_ring_get_cfg_resp { + struct tisci_msg_hdr hdr; + uint32_t addr_lo; + uint32_t addr_hi; + uint32_t count; + uint8_t mode; + uint8_t size; + uint8_t order_id; +} __packed; + +/** + * @struct tisci_msg_psil_pair_req + * @brief Pairs a PSI-L source thread to a destination + * thread + * @param hdr: Generic Header + * @param nav_id: SoC Navigator Subsystem device ID whose PSI-L config proxy is + * used to pair the source and destination threads. + * @param src_thread: PSI-L source thread ID within the PSI-L System thread map. + * + * UDMAP transmit channels mapped to source threads will have their + * TCHAN_THRD_ID register programmed with the destination thread if the pairing + * is successful. + + * @param dst_thread: PSI-L destination thread ID within the PSI-L System thread map. + * PSI-L destination threads start at index 0x8000. The request is NACK'd if + * the destination thread is not greater than or equal to 0x8000. + * + * UDMAP receive channels mapped to destination threads will have their + * RCHAN_THRD_ID register programmed with the source thread if the pairing + * is successful. + * + * Request type is TISCI_MSG_RM_PSIL_PAIR, response is a generic ACK or NACK + * message. + */ +struct tisci_msg_psil_pair_req { + struct tisci_msg_hdr hdr; + uint32_t nav_id; + uint32_t src_thread; + uint32_t dst_thread; +} __packed; + +/** + * @struct tisci_msg_psil_pair_resp + * @brief Response to PSI-L thread pair request (generic ACK/NACK) + * @param hdr: Generic Header + */ +struct tisci_msg_psil_pair_resp { + struct tisci_msg_hdr hdr; +} __packed; + +/** + * @struct tisci_msg_psil_unpair_req + * @brief Unpairs a PSI-L source thread from a destination thread + * @param hdr: Generic Header + * @param nav_id: SoC Navigator Subsystem device ID whose PSI-L config proxy is + * used to unpair the source and destination threads. + * @param src_thread: PSI-L source thread ID within the PSI-L System thread map. + * + * UDMAP transmit channels mapped to source threads will have their + * TCHAN_THRD_ID register cleared if the unpairing is successful. + * + * @param dst_thread: PSI-L destination thread ID within the PSI-L System thread map. + * PSI-L destination threads start at index 0x8000. The request is NACK'd if + * the destination thread is not greater than or equal to 0x8000. + * + * UDMAP receive channels mapped to destination threads will have their + * RCHAN_THRD_ID register cleared if the unpairing is successful. + * + * Request type is TISCI_MSG_RM_PSIL_UNPAIR, response is a generic ACK or NACK + * message. + */ +struct tisci_msg_psil_unpair_req { + struct tisci_msg_hdr hdr; + uint32_t nav_id; + uint32_t src_thread; + uint32_t dst_thread; +} __packed; + +/** + * @struct tisci_msg_psil_unpair_resp + * @brief Response to PSI-L thread unpair request (generic ACK/NACK) + * @param hdr: Generic Header + */ +struct tisci_msg_psil_unpair_resp { + struct tisci_msg_hdr hdr; +} __packed; + +/** + * Configures a Navigator Subsystem UDMAP transmit channel + * + * Configures the non-real-time registers of a Navigator Subsystem UDMAP + * transmit channel. The channel index must be assigned to the host defined + * in the TISCI header via the RM board configuration resource assignment + * range list. + * + * @param hdr: Generic Header + * + * @param valid_params: Bitfield defining validity of tx channel configuration + * parameters. The tx channel configuration fields are not valid, and will not + * be used for ch configuration, if their corresponding valid bit is zero. + * Valid bit usage: + * 0 - Valid bit for tisci_msg_rm_udmap_tx_ch_cfg::tx_pause_on_err + * 1 - Valid bit for tisci_msg_rm_udmap_tx_ch_cfg::tx_atype + * 2 - Valid bit for tisci_msg_rm_udmap_tx_ch_cfg::tx_chan_type + * 3 - Valid bit for tisci_msg_rm_udmap_tx_ch_cfg::tx_fetch_size + * 4 - Valid bit for tisci_msg_rm_udmap_tx_ch_cfg::txcq_qnum + * 5 - Valid bit for tisci_msg_rm_udmap_tx_ch_cfg::tx_priority + * 6 - Valid bit for tisci_msg_rm_udmap_tx_ch_cfg::tx_qos + * 7 - Valid bit for tisci_msg_rm_udmap_tx_ch_cfg::tx_orderid + * 8 - Valid bit for tisci_msg_rm_udmap_tx_ch_cfg::tx_sched_priority + * 9 - Valid bit for tisci_msg_rm_udmap_tx_ch_cfg::tx_filt_einfo + * 10 - Valid bit for tisci_msg_rm_udmap_tx_ch_cfg::tx_filt_pswords + * 11 - Valid bit for tisci_msg_rm_udmap_tx_ch_cfg::tx_supr_tdpkt + * 12 - Valid bit for tisci_msg_rm_udmap_tx_ch_cfg::tx_credit_count + * 13 - Valid bit for tisci_msg_rm_udmap_tx_ch_cfg::fdepth + * 14 - Valid bit for tisci_msg_rm_udmap_tx_ch_cfg::tx_burst_size + * 15 - Valid bit for tisci_msg_rm_udmap_tx_ch_cfg::tx_tdtype + * 16 - Valid bit for tisci_msg_rm_udmap_tx_ch_cfg::extended_ch_type + * + * @param nav_id: SoC device ID of Navigator Subsystem where tx channel is located + * + * @param index: UDMAP transmit channel index. + * + * @param tx_pause_on_err: UDMAP transmit channel pause on error configuration to + * be programmed into the tx_pause_on_err field of the channel's TCHAN_TCFG + * register. + * + * @param tx_filt_einfo: UDMAP transmit channel extended packet information passing + * configuration to be programmed into the tx_filt_einfo field of the + * channel's TCHAN_TCFG register. + * + * @param tx_filt_pswords: UDMAP transmit channel protocol specific word passing + * configuration to be programmed into the tx_filt_pswords field of the + * channel's TCHAN_TCFG register. + * + * @param tx_atype: UDMAP transmit channel non Ring Accelerator access pointer + * interpretation configuration to be programmed into the tx_atype field of + * the channel's TCHAN_TCFG register. + * + * @param tx_chan_type: UDMAP transmit channel functional channel type and work + * passing mechanism configuration to be programmed into the tx_chan_type + * field of the channel's TCHAN_TCFG register. + * + * @param tx_supr_tdpkt: UDMAP transmit channel teardown packet generation suppression + * configuration to be programmed into the tx_supr_tdpkt field of the channel's + * TCHAN_TCFG register. + * + * @param tx_fetch_size: UDMAP transmit channel number of 32-bit descriptor words to + * fetch configuration to be programmed into the tx_fetch_size field of the + * channel's TCHAN_TCFG register. The user must make sure to set the maximum + * word count that can pass through the channel for any allowed descriptor type. + * + * @param tx_credit_count: UDMAP transmit channel transfer request credit count + * configuration to be programmed into the count field of the TCHAN_TCREDIT + * register. Specifies how many credits for complete TRs are available. + * + * @param txcq_qnum: UDMAP transmit channel completion queue configuration to be + * programmed into the txcq_qnum field of the TCHAN_TCQ register. The specified + * completion queue must be assigned to the host, or a subordinate of the host, + * requesting configuration of the transmit channel. + * + * @param tx_priority: UDMAP transmit channel transmit priority value to be programmed + * into the priority field of the channel's TCHAN_TPRI_CTRL register. + * + * @param tx_qos: UDMAP transmit channel transmit qos value to be programmed into the + * qos field of the channel's TCHAN_TPRI_CTRL register. + * + * @param tx_orderid: UDMAP transmit channel bus order id value to be programmed into + * the orderid field of the channel's TCHAN_TPRI_CTRL register. + * + * @param fdepth: UDMAP transmit channel FIFO depth configuration to be programmed + * into the fdepth field of the TCHAN_TFIFO_DEPTH register. Sets the number of + * Tx FIFO bytes which are allowed to be stored for the channel. Check the UDMAP + * section of the TRM for restrictions regarding this parameter. + * + * @param tx_sched_priority: UDMAP transmit channel tx scheduling priority + * configuration to be programmed into the priority field of the channel's + * TCHAN_TST_SCHED register. + * + * @param tx_burst_size: UDMAP transmit channel burst size configuration to be + * programmed into the tx_burst_size field of the TCHAN_TCFG register. + * + * @param tx_tdtype: UDMAP transmit channel teardown type configuration to be + * programmed into the tdtype field of the TCHAN_TCFG register: + * 0 - Return immediately + * 1 - Wait for completion message from remote peer + * + * @param extended_ch_type: Valid for BCDMA. + * 0 - the channel is split tx channel (tchan) + * 1 - the channel is block copy channel (bchan) + */ +struct tisci_msg_rm_udmap_tx_ch_cfg_req { + struct tisci_msg_hdr hdr; + uint32_t valid_params; + uint16_t nav_id; + uint16_t index; + uint8_t tx_pause_on_err; + uint8_t tx_filt_einfo; + uint8_t tx_filt_pswords; + uint8_t tx_atype; + uint8_t tx_chan_type; + uint8_t tx_supr_tdpkt; + uint16_t tx_fetch_size; + uint8_t tx_credit_count; + uint16_t txcq_qnum; + uint8_t tx_priority; + uint8_t tx_qos; + uint8_t tx_orderid; + uint16_t fdepth; + uint8_t tx_sched_priority; + uint8_t tx_burst_size; + uint8_t tx_tdtype; + uint8_t extended_ch_type; +} __packed; + +/** + * @struct tisci_msg_rm_udmap_tx_ch_cfg_resp + * @brief Response to UDMAP transmit channel configuration request (generic ACK/NACK) + * @param hdr: Generic Header + */ +struct tisci_msg_rm_udmap_tx_ch_cfg_resp { + struct tisci_msg_hdr hdr; +} __packed; + +/** + * Configures a Navigator Subsystem UDMAP receive channel + * + * Configures the non-real-time registers of a Navigator Subsystem UDMAP + * receive channel. The channel index must be assigned to the host defined + * in the TISCI header via the RM board configuration resource assignment + * range list. + * + * @param hdr: Generic Header + * + * @param valid_params: Bitfield defining validity of rx channel configuration + * parameters. + * The rx channel configuration fields are not valid, and will not be used for + * ch configuration, if their corresponding valid bit is zero. + * Valid bit usage: + * 0 - Valid bit for @ref tisci_msg_rm_udmap_rx_ch_cfg_req::rx_pause_on_err + * 1 - Valid bit for @ref tisci_msg_rm_udmap_rx_ch_cfg_req::rx_atype + * 2 - Valid bit for @ref tisci_msg_rm_udmap_rx_ch_cfg_req::rx_chan_type + * 3 - Valid bit for @ref tisci_msg_rm_udmap_rx_ch_cfg_req::rx_fetch_size + * 4 - Valid bit for @ref tisci_msg_rm_udmap_rx_ch_cfg_req::rxcq_qnum + * 5 - Valid bit for @ref tisci_msg_rm_udmap_rx_ch_cfg_req::rx_priority + * 6 - Valid bit for @ref tisci_msg_rm_udmap_rx_ch_cfg_req::rx_qos + * 7 - Valid bit for @ref tisci_msg_rm_udmap_rx_ch_cfg_req::rx_orderid + * 8 - Valid bit for @ref tisci_msg_rm_udmap_rx_ch_cfg_req::rx_sched_priority + * 9 - Valid bit for @ref tisci_msg_rm_udmap_rx_ch_cfg_req::flowid_start + * 10 - Valid bit for @ref tisci_msg_rm_udmap_rx_ch_cfg_req::flowid_cnt + * 11 - Valid bit for @ref tisci_msg_rm_udmap_rx_ch_cfg_req::rx_ignore_short + * 12 - Valid bit for @ref tisci_msg_rm_udmap_rx_ch_cfg_req::rx_ignore_long + * + * @param nav_id: SoC device ID of Navigator Subsystem where rx channel is located + * + * @param index: UDMAP receive channel index. + * + * @param rx_fetch_size: UDMAP receive channel number of 32-bit descriptor words to + * fetch configuration to be programmed into the rx_fetch_size field of the + * channel's RCHAN_RCFG register. + * + * @param rxcq_qnum: UDMAP receive channel completion queue configuration to be + * programmed into the rxcq_qnum field of the RCHAN_RCQ register. + * The specified completion queue must be assigned to the host, or a subordinate + * of the host, requesting configuration of the receive channel. + * + * @param rx_priority: UDMAP receive channel receive priority value to be programmed + * into the priority field of the channel's RCHAN_RPRI_CTRL register. + * + * @param rx_qos: UDMAP receive channel receive qos value to be programmed into the + * qos field of the channel's RCHAN_RPRI_CTRL register. + * + * @param rx_orderid: UDMAP receive channel bus order id value to be programmed into + * the orderid field of the channel's RCHAN_RPRI_CTRL register. + * + * @param rx_sched_priority: UDMAP receive channel rx scheduling priority + * configuration to be programmed into the priority field of the channel's + * RCHAN_RST_SCHED register. + * + * @param flowid_start: UDMAP receive channel additional flows starting index + * configuration to program into the flow_start field of the RCHAN_RFLOW_RNG + * register. Specifies the starting index for flow IDs the receive channel is to + * make use of beyond the default flow. flowid_start and @ref flowid_cnt must be + * set as valid and configured together. The starting flow ID set by + * @ref flowid_cnt must be a flow index within the Navigator Subsystem's subset + * of flows beyond the default flows statically mapped to receive channels. + * The additional flows must be assigned to the host, or a subordinate of the + * host, requesting configuration of the receive channel. + * + * @param flowid_cnt: UDMAP receive channel additional flows count configuration to + * program into the flowid_cnt field of the RCHAN_RFLOW_RNG register. + * This field specifies how many flow IDs are in the additional contiguous range + * of legal flow IDs for the channel. @ref flowid_start and flowid_cnt must be + * set as valid and configured together. Disabling the valid_params field bit + * for flowid_cnt indicates no flow IDs other than the default are to be + * allocated and used by the receive channel. @ref flowid_start plus flowid_cnt + * cannot be greater than the number of receive flows in the receive channel's + * Navigator Subsystem. The additional flows must be assigned to the host, or a + * subordinate of the host, requesting configuration of the receive channel. + * + * @param rx_pause_on_err: UDMAP receive channel pause on error configuration to be + * programmed into the rx_pause_on_err field of the channel's RCHAN_RCFG + * register. + * + * @param rx_atype: UDMAP receive channel non Ring Accelerator access pointer + * interpretation configuration to be programmed into the rx_atype field of the + * channel's RCHAN_RCFG register. + * + * @param rx_chan_type: UDMAP receive channel functional channel type and work passing + * mechanism configuration to be programmed into the rx_chan_type field of the + * channel's RCHAN_RCFG register. + * + * @param rx_ignore_short: UDMAP receive channel short packet treatment configuration + * to be programmed into the rx_ignore_short field of the RCHAN_RCFG register. + * + * @param rx_ignore_long: UDMAP receive channel long packet treatment configuration to + * be programmed into the rx_ignore_long field of the RCHAN_RCFG register. + */ +struct tisci_msg_rm_udmap_rx_ch_cfg_req { + struct tisci_msg_hdr hdr; + uint32_t valid_params; + uint16_t nav_id; + uint16_t index; + uint16_t rx_fetch_size; + uint16_t rxcq_qnum; + uint8_t rx_priority; + uint8_t rx_qos; + uint8_t rx_orderid; + uint8_t rx_sched_priority; + uint16_t flowid_start; + uint16_t flowid_cnt; + uint8_t rx_pause_on_err; + uint8_t rx_atype; + uint8_t rx_chan_type; + uint8_t rx_ignore_short; + uint8_t rx_ignore_long; +} __packed; + +/** + * @struct tisci_msg_rm_udmap_rx_ch_cfg_resp + * @brief Response to UDMAP receive channel configuration request (generic ACK/NACK) + * @param hdr: Generic Header + */ +struct tisci_msg_rm_udmap_rx_ch_cfg_resp { + struct tisci_msg_hdr hdr; +} __packed; + +/** + * Configures a Navigator Subsystem UDMAP receive flow + * + * Configures a Navigator Subsystem UDMAP receive flow's registers. + * Configuration does not include the flow registers which handle size-based + * free descriptor queue routing. + * + * The flow index must be assigned to the host defined in the TISCI header via + * the RM board configuration resource assignment range list. + * + * @param hdr: Standard TISCI header + * + * Valid params + * Bitfield defining validity of rx flow configuration parameters. The + * rx flow configuration fields are not valid, and will not be used for flow + * configuration, if their corresponding valid bit is zero. Valid bit usage: + * 0 - Valid bit for reftisci_msg_rm_udmap_flow_cfg_req::rx_einfo_present + * 1 - Valid bit for reftisci_msg_rm_udmap_flow_cfg_req::rx_psinfo_present + * 2 - Valid bit for reftisci_msg_rm_udmap_flow_cfg_req::rx_error_handling + * 3 - Valid bit for reftisci_msg_rm_udmap_flow_cfg_req::rx_desc_type + * 4 - Valid bit for reftisci_msg_rm_udmap_flow_cfg_req::rx_sop_offset + * 5 - Valid bit for reftisci_msg_rm_udmap_flow_cfg_req::rx_dest_qnum + * 6 - Valid bit for reftisci_msg_rm_udmap_flow_cfg_req::rx_src_tag_hi + * 7 - Valid bit for reftisci_msg_rm_udmap_flow_cfg_req::rx_src_tag_lo + * 8 - Valid bit for reftisci_msg_rm_udmap_flow_cfg_req::rx_dest_tag_hi + * 9 - Valid bit for reftisci_msg_rm_udmap_flow_cfg_req::rx_dest_tag_lo + * 10 - Valid bit for reftisci_msg_rm_udmap_flow_cfg_req::rx_src_tag_hi_sel + * 11 - Valid bit for reftisci_msg_rm_udmap_flow_cfg_req::rx_src_tag_lo_sel + * 12 - Valid bit for reftisci_msg_rm_udmap_flow_cfg_req::rx_dest_tag_hi_sel + * 13 - Valid bit for reftisci_msg_rm_udmap_flow_cfg_req::rx_dest_tag_lo_sel + * 14 - Valid bit for reftisci_msg_rm_udmap_flow_cfg_req::rx_fdq0_sz0_qnum + * 15 - Valid bit for reftisci_msg_rm_udmap_flow_cfg_req::rx_fdq1_sz0_qnum + * 16 - Valid bit for reftisci_msg_rm_udmap_flow_cfg_req::rx_fdq2_sz0_qnum + * 17 - Valid bit for reftisci_msg_rm_udmap_flow_cfg_req::rx_fdq3_sz0_qnum + * 18 - Valid bit for reftisci_msg_rm_udmap_flow_cfg_req::rx_ps_location + * + * @param nav_id: SoC device ID of Navigator Subsystem from which the receive flow is + * allocated + * + * @param flow_index: UDMAP receive flow index for non-optional configuration. + * + * @param rx_einfo_present: + * UDMAP receive flow extended packet info present configuration to be + * programmed into the rx_einfo_present field of the flow's RFLOW_RFA register. + * + * @param rx_psinfo_present: + * UDMAP receive flow PS words present configuration to be programmed into the + * rx_psinfo_present field of the flow's RFLOW_RFA register. + * + * @param rx_error_handling: + * UDMAP receive flow error handling configuration to be programmed into the + * rx_error_handling field of the flow's RFLOW_RFA register. + * + * @param rx_desc_type: + * UDMAP receive flow descriptor type configuration to be programmed into the + * rx_desc_type field field of the flow's RFLOW_RFA register. + * + * @param rx_sop_offset: + * UDMAP receive flow start of packet offset configuration to be programmed + * into the rx_sop_offset field of the RFLOW_RFA register. See the UDMAP + * section of the TRM for more information on this setting. Valid values for + * this field are 0-255 bytes. + * + * @param rx_dest_qnum: + * UDMAP receive flow destination queue configuration to be programmed into the + * rx_dest_qnum field of the flow's RFLOW_RFA register. The specified + * destination queue must be valid within the Navigator Subsystem and must be + * owned by the host, or a subordinate of the host, requesting allocation and + * configuration of the receive flow. + * + * @param rx_src_tag_hi: + * UDMAP receive flow source tag high byte constant configuration to be + * programmed into the rx_src_tag_hi field of the flow's RFLOW_RFB register. + * See the UDMAP section of the TRM for more information on this setting. + * + * @param rx_src_tag_lo: + * UDMAP receive flow source tag low byte constant configuration to be + * programmed into the rx_src_tag_lo field of the flow's RFLOW_RFB register. + * See the UDMAP section of the TRM for more information on this setting. + * + * @param rx_dest_tag_hi: + * UDMAP receive flow destination tag high byte constant configuration to be + * programmed into the rx_dest_tag_hi field of the flow's RFLOW_RFB register. + * See the UDMAP section of the TRM for more information on this setting. + * + * @param rx_dest_tag_lo: + * UDMAP receive flow destination tag low byte constant configuration to be + * programmed into the rx_dest_tag_lo field of the flow's RFLOW_RFB register. + * See the UDMAP section of the TRM for more information on this setting. + * + * @param rx_src_tag_hi_sel: + * UDMAP receive flow source tag high byte selector configuration to be + * programmed into the rx_src_tag_hi_sel field of the RFLOW_RFC register. See + * the UDMAP section of the TRM for more information on this setting. + * + * @param rx_src_tag_lo_sel: + * UDMAP receive flow source tag low byte selector configuration to be + * programmed into the rx_src_tag_lo_sel field of the RFLOW_RFC register. See + * the UDMAP section of the TRM for more information on this setting. + * + * @param rx_dest_tag_hi_sel: + * UDMAP receive flow destination tag high byte selector configuration to be + * programmed into the rx_dest_tag_hi_sel field of the RFLOW_RFC register. See + * the UDMAP section of the TRM for more information on this setting. + * + * @param rx_dest_tag_lo_sel: + * UDMAP receive flow destination tag low byte selector configuration to be + * programmed into the rx_dest_tag_lo_sel field of the RFLOW_RFC register. See + * the UDMAP section of the TRM for more information on this setting. + * + * @param rx_fdq0_sz0_qnum: + * UDMAP receive flow free descriptor queue 0 configuration to be programmed + * into the rx_fdq0_sz0_qnum field of the flow's RFLOW_RFD register. See the + * UDMAP section of the TRM for more information on this setting. The specified + * free queue must be valid within the Navigator Subsystem and must be owned + * by the host, or a subordinate of the host, requesting allocation and + * configuration of the receive flow. + * + * @param rx_fdq1_qnum: + * UDMAP receive flow free descriptor queue 1 configuration to be programmed + * into the rx_fdq1_qnum field of the flow's RFLOW_RFD register. See the + * UDMAP section of the TRM for more information on this setting. The specified + * free queue must be valid within the Navigator Subsystem and must be owned + * by the host, or a subordinate of the host, requesting allocation and + * configuration of the receive flow. + * + * @param rx_fdq2_qnum: + * UDMAP receive flow free descriptor queue 2 configuration to be programmed + * into the rx_fdq2_qnum field of the flow's RFLOW_RFE register. See the + * UDMAP section of the TRM for more information on this setting. The specified + * free queue must be valid within the Navigator Subsystem and must be owned + * by the host, or a subordinate of the host, requesting allocation and + * configuration of the receive flow. + * + * @param rx_fdq3_qnum: + * UDMAP receive flow free descriptor queue 3 configuration to be programmed + * into the rx_fdq3_qnum field of the flow's RFLOW_RFE register. See the + * UDMAP section of the TRM for more information on this setting. The specified + * free queue must be valid within the Navigator Subsystem and must be owned + * by the host, or a subordinate of the host, requesting allocation and + * configuration of the receive flow. + * + * @param rx_ps_location: + * UDMAP receive flow PS words location configuration to be programmed into the + * rx_ps_location field of the flow's RFLOW_RFA register. + */ +struct tisci_msg_rm_udmap_flow_cfg_req { + struct tisci_msg_hdr hdr; + uint32_t valid_params; + uint16_t nav_id; + uint16_t flow_index; + uint8_t rx_einfo_present; + uint8_t rx_psinfo_present; + uint8_t rx_error_handling; + uint8_t rx_desc_type; + uint16_t rx_sop_offset; + uint16_t rx_dest_qnum; + uint8_t rx_src_tag_hi; + uint8_t rx_src_tag_lo; + uint8_t rx_dest_tag_hi; + uint8_t rx_dest_tag_lo; + uint8_t rx_src_tag_hi_sel; + uint8_t rx_src_tag_lo_sel; + uint8_t rx_dest_tag_hi_sel; + uint8_t rx_dest_tag_lo_sel; + uint16_t rx_fdq0_sz0_qnum; + uint16_t rx_fdq1_qnum; + uint16_t rx_fdq2_qnum; + uint16_t rx_fdq3_qnum; + uint8_t rx_ps_location; +} __packed; + +/** + * Response to configuring a Navigator Subsystem UDMAP receive flow + * + * @param hdr: Standard TISCI header + */ +struct tisci_msg_rm_udmap_flow_cfg_resp { + struct tisci_msg_hdr hdr; +} __packed; + +#define FWL_MAX_PRIVID_SLOTS 3U + +/** + * @struct tisci_msg_fwl_set_firewall_region_req + * @brief Request for configuring the firewall permissions. + * + * @param hdr: Generic Header + * + * @param fwl_id: Firewall ID in question + * @param region: Region or channel number to set config info + * This field is unused in case of a simple firewall and must be initialized + * to zero. In case of a region based firewall, this field indicates the + * region in question. (index starting from 0) In case of a channel based + * firewall, this field indicates the channel in question (index starting + * from 0) + * @param n_permission_regs: Number of permission registers to set + * @param control: Contents of the firewall CONTROL register to set + * @param permissions: Contents of the firewall PERMISSION register to set + * @param start_address: Contents of the firewall START_ADDRESS register to set + * @param end_address: Contents of the firewall END_ADDRESS register to set + */ + +struct tisci_msg_fwl_set_firewall_region_req { + struct tisci_msg_hdr hdr; + uint16_t fwl_id; + uint16_t region; + uint32_t n_permission_regs; + uint32_t control; + uint32_t permissions[FWL_MAX_PRIVID_SLOTS]; + uint64_t start_address; + uint64_t end_address; +} __packed; + +/** + * @struct tisci_msg_fwl_set_firewall_region_resp + * @brief Response to set firewall region (generic ACK/NACK) + */ +struct tisci_msg_fwl_set_firewall_region_resp { + struct tisci_msg_hdr hdr; +} __packed; + +/** + * @struct tisci_msg_fwl_get_firewall_region_req + * @brief Request for retrieving the firewall permissions + * + * @param hdr: Generic Header + * + * @param fwl_id: Firewall ID in question + * @param region: Region or channel number to get config info + * This field is unused in case of a simple firewall and must be initialized + * to zero. In case of a region based firewall, this field indicates the + * region in question (index starting from 0). In case of a channel based + * firewall, this field indicates the channel in question (index starting + * from 0). + * @param n_permission_regs: Number of permission registers to retrieve + */ +struct tisci_msg_fwl_get_firewall_region_req { + struct tisci_msg_hdr hdr; + uint16_t fwl_id; + uint16_t region; + uint32_t n_permission_regs; +} __packed; + +/** + * @struct tisci_msg_fwl_get_firewall_region_resp + * @brief Response for retrieving the firewall permissions + * + * @param hdr: Generic Header + * + * @param fwl_id: Firewall ID in question + * @param region: Region or channel number to set config info This field is + * unused in case of a simple firewall and must be initialized to zero. In + * case of a region based firewall, this field indicates the region in + * question. (index starting from 0) In case of a channel based firewall, this + * field indicates the channel in question (index starting from 0) + * @param n_permission_regs: Number of permission registers retrieved + * @param control: Contents of the firewall CONTROL register + * @param permissions: Contents of the firewall PERMISSION registers + * @param start_address: Contents of the firewall START_ADDRESS + * register This is not applicable for + * channelized firewalls. + * @param end_address: Contents of the firewall END_ADDRESS register This is not applicable for + * channelized firewalls. + */ +struct tisci_msg_fwl_get_firewall_region_resp { + struct tisci_msg_hdr hdr; + uint16_t fwl_id; + uint16_t region; + uint32_t n_permission_regs; + uint32_t control; + uint32_t permissions[FWL_MAX_PRIVID_SLOTS]; + uint64_t start_address; + uint64_t end_address; +} __packed; + +/** + * @struct tisci_msg_fwl_change_owner_info_req + * @brief Request for a firewall owner change + * + * @param hdr: Generic Header + * + * @param fwl_id: Firewall ID in question + * @param region: Region or channel number if applicable + * @param owner_index: New owner index to transfer ownership to + */ +struct tisci_msg_fwl_change_owner_info_req { + struct tisci_msg_hdr hdr; + uint16_t fwl_id; + uint16_t region; + uint8_t owner_index; +} __packed; + +/** + * @struct tisci_msg_fwl_change_owner_info_resp + * @brief Response for a firewall owner change + * + * @param hdr: Generic Header + * + * @param fwl_id: Firewall ID specified in request + * @param region: Region or channel number specified in request + * @param owner_index: Owner index specified in request + * @param owner_privid: New owner priv-ID returned by DMSC. + * @param owner_permission_bits: New owner permission bits returned by DMSC. + */ + +struct tisci_msg_fwl_change_owner_info_resp { + struct tisci_msg_hdr hdr; + uint16_t fwl_id; + uint16_t region; + uint8_t owner_index; + uint8_t owner_privid; + uint16_t owner_permission_bits; +} __packed; + +/** + * @brief Request to set up an interrupt route. + * + * Configures peripherals within the interrupt subsystem according to the + * valid configuration provided. + * + * @param hdr Standard TISCI header. + * @param valid_params Bitfield defining validity of interrupt route set parameters. + * Each bit corresponds to a field's validity. + * @param src_id ID of interrupt source peripheral. + * @param src_index Interrupt source index within source peripheral. + * @param dst_id SoC IR device ID (valid if TISCI_MSG_VALUE_RM_DST_ID_VALID is set). + * @param dst_host_irq SoC IR output index (valid if TISCI_MSG_VALUE_RM_DST_HOST_IRQ_VALID + * is set). + * @param ia_id Device ID of interrupt aggregator (valid if + * TISCI_MSG_VALUE_RM_IA_ID_VALID is set). + * @param vint Virtual interrupt number (valid if TISCI_MSG_VALUE_RM_VINT_VALID is + * set). + * @param global_event Global event mapped to interrupt aggregator (valid if + * TISCI_MSG_VALUE_RM_GLOBAL_EVENT_VALID is set). + * @param vint_status_bit_index Virtual interrupt status bit (valid if + * TISCI_MSG_VALUE_RM_VINT_STATUS_BIT_INDEX_VALID is set). + * @param secondary_host Secondary host value (valid if + * TISCI_MSG_VALUE_RM_SECONDARY_HOST_VALID is set). + */ +struct tisci_msg_rm_irq_set_req { + struct tisci_msg_hdr hdr; + uint32_t valid_params; + uint16_t src_id; + uint16_t src_index; + uint16_t dst_id; + uint16_t dst_host_irq; + uint16_t ia_id; + uint16_t vint; + uint16_t global_event; + uint8_t vint_status_bit_index; + uint8_t secondary_host; +} __packed; + +/** + * @brief Response to setting a peripheral to processor interrupt. + * + * @param hdr Standard TISCI header. + */ +struct tisci_msg_rm_irq_set_resp { + struct tisci_msg_hdr hdr; +} __packed; + +/** + * @brief Request to release interrupt peripheral resources. + * + * Releases interrupt peripheral resources according to the valid configuration provided. + * + * @param hdr Standard TISCI header. + * @param valid_params Bitfield defining validity of interrupt route release parameters. + * Each bit corresponds to a field's validity. + * @param src_id ID of interrupt source peripheral. + * @param src_index Interrupt source index within source peripheral. + * @param dst_id SoC IR device ID (valid if TISCI_MSG_VALUE_RM_DST_ID_VALID is set). + * @param dst_host_irq SoC IR output index (valid if TISCI_MSG_VALUE_RM_DST_HOST_IRQ_VALID + * is set). + * @param ia_id Device ID of interrupt aggregator (valid if + * TISCI_MSG_VALUE_RM_IA_ID_VALID is set). + * @param vint Virtual interrupt number (valid if TISCI_MSG_VALUE_RM_VINT_VALID is + * set). + * @param global_event Global event mapped to interrupt aggregator (valid if + * TISCI_MSG_VALUE_RM_GLOBAL_EVENT_VALID is set). + * @param vint_status_bit_index Virtual interrupt status bit (valid if + * TISCI_MSG_VALUE_RM_VINT_STATUS_BIT_INDEX_VALID is set). + * @param secondary_host Secondary host value (valid if + * TISCI_MSG_VALUE_RM_SECONDARY_HOST_VALID is set). + */ +struct tisci_msg_rm_irq_release_req { + struct tisci_msg_hdr hdr; + uint32_t valid_params; + uint16_t src_id; + uint16_t src_index; + uint16_t dst_id; + uint16_t dst_host_irq; + uint16_t ia_id; + uint16_t vint; + uint16_t global_event; + uint8_t vint_status_bit_index; + uint8_t secondary_host; +} __packed; + +/** + * @brief Response to releasing a peripheral to processor interrupt. + * + * @param hdr Standard TISCI header. + */ +struct tisci_msg_rm_irq_release_resp { + struct tisci_msg_hdr hdr; +} __packed; + +#endif /* INCLUDE_ZEPHYR_DRIVERS_MISC_TISCI_H_ */ diff --git a/dts/bindings/firmware/ti,k2g-sci.yaml b/dts/bindings/firmware/ti,k2g-sci.yaml new file mode 100644 index 000000000000..ebdbcb97dd5b --- /dev/null +++ b/dts/bindings/firmware/ti,k2g-sci.yaml @@ -0,0 +1,25 @@ +# Copyright 2025 Texas Instruments Incorporated. +# SPDX-License-Identifier: Apache-2.0 + +description: TISCI Client Driver + +compatible: "ti,k2g-sci" + +include: [base.yaml] + +properties: + reg: + required: true + + ti,host-id: + type: int + required: true + description: Host ID for processor + + mboxes: + description: phandle to the MBOX controller (TX and RX are required) + required: true + + mbox-names: + description: MBOX channel names (must be called "tx" and "rx") + required: true diff --git a/include/zephyr/drivers/firmware/tisci/tisci.h b/include/zephyr/drivers/firmware/tisci/tisci.h new file mode 100644 index 000000000000..8097d6d44059 --- /dev/null +++ b/include/zephyr/drivers/firmware/tisci/tisci.h @@ -0,0 +1,1037 @@ +/* + * Copyright (c) 2025, Texas Instruments + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @file + * @brief Public APIs for the TISCI driver + * + */ + +#ifndef INCLUDE_ZEPHYR_DRIVERS_TISCI_H_ +#define INCLUDE_ZEPHYR_DRIVERS_TISCI_H_ + +#include + +#define MAILBOX_MBOX_SIZE 60 + +/** + * @struct tisci_version_info + * @brief version information structure + * @param abi_major: Major ABI version. Change here implies risk of backward + * compatibility break. + * @param abi_minor: Minor ABI version. Change here implies new feature addition, + * or compatible change in ABI. + * @param firmware_revision: Firmware revision (not usually used). + * @param firmware_description: Firmware description (not usually used). + */ +struct tisci_version_info { + uint8_t abi_major; + uint8_t abi_minor; + uint16_t firmware_revision; + char firmware_description[32]; +}; + +/** + * @struct tisci_msg_fwl_region_cfg + * @brief Request and Response for firewalls settings + * + * @param fwl_id: Firewall ID in question + * @param region: Region or channel number to set config info + * This field is unused in case of a simple firewall and must be initialized + * to zero. In case of a region based firewall, this field indicates the + * region in question. (index starting from 0) In case of a channel based + * firewall, this field indicates the channel in question (index starting + * from 0) + * @param n_permission_regs: Number of permission registers to set + * @param control: Contents of the firewall CONTROL register to set + * @param permissions: Contents of the firewall PERMISSION register to set + * @param start_address: Contents of the firewall START_ADDRESS register to set + * @param end_address: Contents of the firewall END_ADDRESS register to set + */ +struct tisci_msg_fwl_region { + uint16_t fwl_id; + uint16_t region; + uint32_t n_permission_regs; + uint32_t control; + uint32_t permissions[3]; + uint64_t start_address; + uint64_t end_address; +}; + +/** + * @brief Request and Response for firewall owner change + * @struct tisci_msg_fwl_owner + * @param fwl_id: Firewall ID in question + * @param region: Region or channel number to set config info + * This field is unused in case of a simple firewall and must be initialized + * to zero. In case of a region based firewall, this field indicates the + * region in question. (index starting from 0) In case of a channel based + * firewall, this field indicates the channel in question (index starting + * from 0) + * @param n_permission_regs: Number of permission registers <= 3 + * @param control: Control register value for this region + * @param owner_index: New owner index to change to. Owner indexes are setup in DMSC firmware boot + *configuration data + * @param owner_privid: New owner priv-id, used to lookup owner_index is not known, must be set to + *zero otherwise + * @param owner_permission_bits: New owner permission bits + */ +struct tisci_msg_fwl_owner { + uint16_t fwl_id; + uint16_t region; + uint8_t owner_index; + uint8_t owner_privid; + uint16_t owner_permission_bits; +}; + +/** + * Configures a Navigator Subsystem UDMAP transmit channel + * + * Configures a Navigator Subsystem UDMAP transmit channel registers. + * See tisci_msg_rm_udmap_tx_ch_cfg_req + */ +struct tisci_msg_rm_udmap_tx_ch_cfg { + uint32_t valid_params; +#define TISCI_MSG_VALUE_RM_UDMAP_CH_TX_FILT_EINFO_VALID BIT(9) +#define TISCI_MSG_VALUE_RM_UDMAP_CH_TX_FILT_PSWORDS_VALID BIT(10) +#define TISCI_MSG_VALUE_RM_UDMAP_CH_TX_SUPR_TDPKT_VALID BIT(11) +#define TISCI_MSG_VALUE_RM_UDMAP_CH_TX_CREDIT_COUNT_VALID BIT(12) +#define TISCI_MSG_VALUE_RM_UDMAP_CH_TX_FDEPTH_VALID BIT(13) +#define TISCI_MSG_VALUE_RM_UDMAP_CH_TX_TDTYPE_VALID BIT(15) +#define TISCI_MSG_VALUE_RM_UDMAP_CH_EXTENDED_CH_TYPE_VALID BIT(16) + uint16_t nav_id; + uint16_t index; + uint8_t tx_pause_on_err; + uint8_t tx_filt_einfo; + uint8_t tx_filt_pswords; + uint8_t tx_atype; + uint8_t tx_chan_type; + uint8_t tx_supr_tdpkt; + uint16_t tx_fetch_size; + uint8_t tx_credit_count; + uint16_t txcq_qnum; + uint8_t tx_priority; + uint8_t tx_qos; + uint8_t tx_orderid; + uint16_t fdepth; + uint8_t tx_sched_priority; + uint8_t tx_burst_size; + uint8_t tx_tdtype; + uint8_t extended_ch_type; +}; + +/** + * Configures a Navigator Subsystem UDMAP receive channel + * + * Configures a Navigator Subsystem UDMAP receive channel registers. + * See tisci_msg_rm_udmap_rx_ch_cfg_req + */ +struct tisci_msg_rm_udmap_rx_ch_cfg { + uint32_t valid_params; +#define TISCI_MSG_VALUE_RM_UDMAP_CH_RX_FLOWID_START_VALID BIT(9) +#define TISCI_MSG_VALUE_RM_UDMAP_CH_RX_FLOWID_CNT_VALID BIT(10) +#define TISCI_MSG_VALUE_RM_UDMAP_CH_RX_IGNORE_SHORT_VALID BIT(11) +#define TISCI_MSG_VALUE_RM_UDMAP_CH_RX_IGNORE_LONG_VALID BIT(12) + uint16_t nav_id; + uint16_t index; + uint16_t rx_fetch_size; + uint16_t rxcq_qnum; + uint8_t rx_priority; + uint8_t rx_qos; + uint8_t rx_orderid; + uint8_t rx_sched_priority; + uint16_t flowid_start; + uint16_t flowid_cnt; + uint8_t rx_pause_on_err; + uint8_t rx_atype; + uint8_t rx_chan_type; + uint8_t rx_ignore_short; + uint8_t rx_ignore_long; + uint8_t rx_burst_size; +}; + +#define TISCI_MSG_VALUE_RM_DST_ID_VALID (1u << 0u) +#define TISCI_MSG_VALUE_RM_DST_HOST_IRQ_VALID (1u << 1u) +#define TISCI_MSG_VALUE_RM_IA_ID_VALID (1u << 2u) +#define TISCI_MSG_VALUE_RM_VINT_VALID (1u << 3u) +#define TISCI_MSG_VALUE_RM_GLOBAL_EVENT_VALID (1u << 4u) +#define TISCI_MSG_VALUE_RM_VINT_STATUS_BIT_INDEX_VALID (1u << 5u) + +/** + * @brief Request to set up an interrupt route. + * + * Configures peripherals within the interrupt subsystem according to the + * valid configuration provided. + * + * @param valid_params Bitfield defining validity of interrupt route set parameters. + * Each bit corresponds to a field's validity. + * @param src_id ID of interrupt source peripheral. + * @param src_index Interrupt source index within source peripheral. + * @param dst_id SoC IR device ID (valid if TISCI_MSG_VALUE_RM_DST_ID_VALID is set). + * @param dst_host_irq SoC IR output index (valid if TISCI_MSG_VALUE_RM_DST_HOST_IRQ_VALID + * is set). + * @param ia_id Device ID of interrupt aggregator (valid if + * TISCI_MSG_VALUE_RM_IA_ID_VALID is set). + * @param vint Virtual interrupt number (valid if TISCI_MSG_VALUE_RM_VINT_VALID is + * set). + * @param global_event Global event mapped to interrupt aggregator (valid if + * TISCI_MSG_VALUE_RM_GLOBAL_EVENT_VALID is set). + * @param vint_status_bit_index Virtual interrupt status bit (valid if + * TISCI_MSG_VALUE_RM_VINT_STATUS_BIT_INDEX_VALID is set). + * @param secondary_host Secondary host value (valid if + * TISCI_MSG_VALUE_RM_SECONDARY_HOST_VALID is set). + */ +struct tisci_irq_set_req { + uint32_t valid_params; + uint16_t src_id; + uint16_t src_index; + uint16_t dst_id; + uint16_t dst_host_irq; + uint16_t ia_id; + uint16_t vint; + uint16_t global_event; + uint8_t vint_status_bit_index; + uint8_t secondary_host; +}; + +/** + * @brief Request to release interrupt peripheral resources. + * + * Releases interrupt peripheral resources according to the valid configuration provided. + * + * @param valid_params Bitfield defining validity of interrupt route release parameters. + * Each bit corresponds to a field's validity. + * @param src_id ID of interrupt source peripheral. + * @param src_index Interrupt source index within source peripheral. + * @param dst_id SoC IR device ID (valid if TISCI_MSG_VALUE_RM_DST_ID_VALID is set). + * @param dst_host_irq SoC IR output index (valid if TISCI_MSG_VALUE_RM_DST_HOST_IRQ_VALID + * is set). + * @param ia_id Device ID of interrupt aggregator (valid if + * TISCI_MSG_VALUE_RM_IA_ID_VALID is set). + * @param vint Virtual interrupt number (valid if TISCI_MSG_VALUE_RM_VINT_VALID is + * set). + * @param global_event Global event mapped to interrupt aggregator (valid if + * TISCI_MSG_VALUE_RM_GLOBAL_EVENT_VALID is set). + * @param vint_status_bit_index Virtual interrupt status bit (valid if + * TISCI_MSG_VALUE_RM_VINT_STATUS_BIT_INDEX_VALID is set). + * @param secondary_host Secondary host value (valid if + * TISCI_MSG_VALUE_RM_SECONDARY_HOST_VALID is set). + */ + +struct tisci_irq_release_req { + uint32_t valid_params; + uint16_t src_id; + uint16_t src_index; + uint16_t dst_id; + uint16_t dst_host_irq; + uint16_t ia_id; + uint16_t vint; + uint16_t global_event; + uint8_t vint_status_bit_index; + uint8_t secondary_host; +}; + +/* Version/Revision Functions */ + +/** + * @brief Get the revision information of the TI SCI firmware + * + * Queries the TI SCI firmware for its version and revision information. + * The retrieved information is stored in the provided @p ver structure. + * + * @param dev Pointer to the TI SCI device + * @param ver Pointer to a structure where the firmware version information will be stored + * + * @return 0 if successful, or a negative error code on failure + */ +int tisci_cmd_get_revision(const struct device *dev, struct tisci_version_info *ver); + +/* Clock Management Functions */ + +/** + * @brief Get the state of a clock + * + * @param dev Pointer to the TI SCI device + * @param dev_id Device identifier for this request + * @param clk_id Clock identifier for the device for this request + * @param programmed_state Pointer to store the requested state of the clock + * @param current_state Pointer to store the current state of the clock + * + * @return 0 if successful, or an error code + */ +int tisci_cmd_get_clock_state(const struct device *dev, uint32_t dev_id, uint8_t clk_id, + uint8_t *programmed_state, uint8_t *current_state); + +/** + * @brief Set the state of a clock + * + * @param dev Pointer to the TI SCI device + * @param dev_id Device identifier for this request + * @param clk_id Clock identifier for the device for this request + * @param flags Header flags as needed + * @param state State to request for the clock + * + * @return 0 if successful, or an error code + */ +int tisci_set_clock_state(const struct device *dev, uint32_t dev_id, uint8_t clk_id, uint32_t flags, + uint8_t state); + +/** + * @brief Check if the clock is ON + * + * @param dev Pointer to the TI SCI device + * @param dev_id Device identifier for this request + * @param clk_id Clock identifier for the device for this request + * @param req_state Pointer to store whether the clock is managed and enabled + * @param curr_state Pointer to store whether the clock is ready for operation + * + * @return 0 if successful, or an error code + */ +int tisci_cmd_clk_is_on(const struct device *dev, uint32_t dev_id, uint8_t clk_id, bool *req_state, + bool *curr_state); + +/** + * @brief Check if the clock is OFF + * + * @param dev Pointer to the TI SCI device + * @param dev_id Device identifier for this request + * @param clk_id Clock identifier for the device for this request + * @param req_state Pointer to store whether the clock is managed and disabled + * @param curr_state Pointer to store whether the clock is NOT ready for operation + * + * @return 0 if successful, or an error code + */ +int tisci_cmd_clk_is_off(const struct device *dev, uint32_t dev_id, uint8_t clk_id, bool *req_state, + bool *curr_state); + +/** + * @brief Check if the clock is being auto-managed + * + * @param dev Pointer to the TI SCI device + * @param dev_id Device identifier for this request + * @param clk_id Clock identifier for the device for this request + * @param req_state Pointer to store whether the clock is auto-managed + * + * @return 0 if successful, or an error code + */ +int tisci_cmd_clk_is_auto(const struct device *dev, uint32_t dev_id, uint8_t clk_id, + bool *req_state); + +/** + * @brief Get the current frequency of a clock + * + * @param dev Pointer to the TI SCI device + * @param dev_id Device identifier for this request + * @param clk_id Clock identifier for the device for this request + * @param freq Pointer to store the current frequency in Hz + * + * @return 0 if successful, or an error code + */ +int tisci_cmd_clk_get_freq(const struct device *dev, uint32_t dev_id, uint8_t clk_id, + uint64_t *freq); + +/** + * @brief Set a frequency for a clock + * + * @param dev Pointer to the TI SCI device + * @param dev_id Device identifier for this request + * @param clk_id Clock identifier for the device for this request + * @param min_freq Minimum allowable frequency in Hz + * @param target_freq Target clock frequency in Hz + * @param max_freq Maximum allowable frequency in Hz + * + * @return 0 if successful, or an error code + */ +int tisci_cmd_clk_set_freq(const struct device *dev, uint32_t dev_id, uint8_t clk_id, + uint64_t min_freq, uint64_t target_freq, uint64_t max_freq); + +/** + * @brief Get a matching frequency for a clock + * + * Finds a frequency that matches the requested range for a clock. + * + * @param dev Pointer to the TI SCI device + * @param dev_id Device identifier for this request + * @param clk_id Clock identifier for the device for this request + * @param min_freq Minimum allowable frequency in Hz + * @param target_freq Target clock frequency in Hz + * @param max_freq Maximum allowable frequency in Hz + * @param match_freq Pointer to store the matched frequency in Hz + * + * @return 0 if successful, or an error code + */ +int tisci_cmd_clk_get_match_freq(const struct device *dev, uint32_t dev_id, uint8_t clk_id, + uint64_t min_freq, uint64_t target_freq, uint64_t max_freq, + uint64_t *match_freq); + +/** + * @brief Set the parent clock for a clock + * + * @param dev Pointer to the TI SCI device + * @param dev_id Device identifier for this request + * @param clk_id Clock identifier for the device for this request + * @param parent_id Identifier of the parent clock to set + * + * @return 0 if successful, or an error code + */ +int tisci_cmd_clk_set_parent(const struct device *dev, uint32_t dev_id, uint8_t clk_id, + uint8_t parent_id); + +/** + * @brief Get the parent clock for a clock + * + * @param dev Pointer to the TI SCI device + * @param dev_id Device identifier for this request + * @param clk_id Clock identifier for the device for this request + * @param parent_id Pointer to store the identifier of the parent clock + * + * @return 0 if successful, or an error code + */ +int tisci_cmd_clk_get_parent(const struct device *dev, uint32_t dev_id, uint8_t clk_id, + uint8_t *parent_id); + +/** + * @brief Get the number of parent clocks for a clock + * + * @param dev Pointer to the TI SCI device + * @param dev_id Device identifier for this request + * @param clk_id Clock identifier for the device for this request + * @param num_parents Pointer to store the number of parent clocks + * + * @return 0 if successful, or an error code + */ +int tisci_cmd_clk_get_num_parents(const struct device *dev, uint32_t dev_id, uint8_t clk_id, + uint8_t *num_parents); + +/** + * @brief Get control of a clock from TI SCI + * + * @param dev Pointer to the TI SCI device + * @param dev_id Device identifier for this request + * @param clk_id Clock identifier for the device for this request + * @param needs_ssc 'true' if Spread Spectrum clock is desired, else 'false' + * @param can_change_freq 'true' if frequency change is desired, else 'false' + * @param enable_input_term 'true' if input termination is desired, else 'false' + * + * @return 0 if successful, or an error code + */ +int tisci_cmd_get_clock(const struct device *dev, uint32_t dev_id, uint8_t clk_id, bool needs_ssc, + bool can_change_freq, bool enable_input_term); + +/** + * @brief Idle a clock that is under control of TI SCI + * + * @param dev Pointer to the TI SCI device + * @param dev_id Device identifier for this request + * @param clk_id Clock identifier for the device for this request + * + * @return 0 if successful, or an error code + */ +int tisci_cmd_idle_clock(const struct device *dev, uint32_t dev_id, uint8_t clk_id); + +/** + * @brief Release a clock from control back to TI SCI + * + * @param dev Pointer to the TI SCI device + * @param dev_id Device identifier for this request + * @param clk_id Clock identifier for the device for this request + * + * @return 0 if successful, or an error code + */ +int tisci_cmd_put_clock(const struct device *dev, uint32_t dev_id, uint8_t clk_id); + +/* Device Management Functions */ + +/** + * @brief Set the state of a device + * + * @param dev Pointer to the TI SCI device + * @param dev_id Device identifier for this request + * @param flags Flags to set for the device + * @param state State to move the device to: + * - 0: Device is off + * - 1: Device is on + * - 2: Device is in retention + * - 3: Device is in reset + * + * @return 0 if successful, or an error code + */ +int tisci_set_device_state(const struct device *dev, uint32_t dev_id, uint32_t flags, + uint8_t state); + +/** + * @brief Set the state of a device without waiting for a response + * + * @param dev Pointer to the TI SCI device + * @param dev_id Device identifier for this request + * @param flags Flags to set for the device + * @param state State to move the device to: + * - 0: Device is off + * - 1: Device is on + * - 2: Device is in retention + * - 3: Device is in reset + * + * @return 0 if successful, or an error code + */ +int tisci_set_device_state_no_wait(const struct device *dev, uint32_t dev_id, uint32_t flags, + uint8_t state); + +/** + * @brief Get the state of a device + * + * @param dev Pointer to the TI SCI device + * @param dev_id Device identifier for this request + * @param clcnt Pointer to store the Context Loss Count + * @param resets Pointer to store the reset count + * @param p_state Pointer to store the programmed state + * @param c_state Pointer to store the current state + * + * @return 0 if successful, or an error code + */ +int tisci_get_device_state(const struct device *dev, uint32_t dev_id, uint32_t *clcnt, + uint32_t *resets, uint8_t *p_state, uint8_t *c_state); + +/** + * @brief Request exclusive access to a device managed by TISCI + * + * @param dev Pointer to the TI SCI device + * @param dev_id Device identifier for this request + * + * @return 0 if successful, or an error code + */ +int tisci_cmd_get_device(const struct device *dev, uint32_t dev_id); +int tisci_cmd_get_device_exclusive(const struct device *dev, uint32_t dev_id); + +/** + * @brief Command to idle a device managed by TISCI + * + * @param dev Pointer to the TI SCI device + * @param dev_id Device identifier for this request + * + * @return 0 if successful, or an error code + */ +int tisci_cmd_idle_device(const struct device *dev, uint32_t dev_id); +int tisci_cmd_idle_device_exclusive(const struct device *dev, uint32_t dev_id); + +/** + * @brief Command to release a device managed by TISCI + * + * @param dev Pointer to the TI SCI device + * @param dev_id Device identifier for this request + * + * @return 0 if successful, or an error code + */ +int tisci_cmd_put_device(const struct device *dev, uint32_t dev_id); + +/** + * @brief Check if a device ID is valid + * + * @param dev Pointer to the TI SCI device + * @param dev_id Device identifier for this request + * + * @return 0 if the device ID is valid, or an error code + */ +int tisci_cmd_dev_is_valid(const struct device *dev, uint32_t dev_id); + +/** + * @brief Get the context loss counter for a device + * + * @param dev Pointer to the TI SCI device + * @param dev_id Device identifier for this request + * @param count Pointer to store the context loss counter + * + * @return 0 if successful, or an error code + */ +int tisci_cmd_dev_get_clcnt(const struct device *dev, uint32_t dev_id, uint32_t *count); + +/** + * @brief Check if the device is requested to be idle + * + * @param dev Pointer to the TI SCI device + * @param dev_id Device identifier for this request + * @param r_state Pointer to store the result (true if requested to be idle) + * + * @return 0 if successful, or an error code + */ +int tisci_cmd_dev_is_idle(const struct device *dev, uint32_t dev_id, bool *r_state); + +/** + * @brief Check if the device is requested to be stopped + * + * @param dev Pointer to the TI SCI device + * @param dev_id Device identifier for this request + * @param r_state Pointer to store the result (true if requested to be stopped) + * @param curr_state Pointer to store the result (true if currently stopped) + * + * @return 0 if successful, or an error code + */ +int tisci_cmd_dev_is_stop(const struct device *dev, uint32_t dev_id, bool *r_state, + bool *curr_state); + +/** + * @brief Check if the device is requested to be ON + * + * @param dev Pointer to the TI SCI device + * @param dev_id Device identifier for this request + * @param r_state Pointer to store the result (true if requested to be ON) + * @param curr_state Pointer to store the result (true if currently ON and active) + * + * @return 0 if successful, or an error code + */ +int tisci_cmd_dev_is_on(const struct device *dev, uint32_t dev_id, bool *r_state, bool *curr_state); + +/** + * @brief Check if the device is currently transitioning + * + * @param dev Pointer to the TI SCI device + * @param dev_id Device identifier for this request + * @param curr_state Pointer to store the result (true if currently transitioning) + * + * @return 0 if successful, or an error code + */ +int tisci_cmd_dev_is_trans(const struct device *dev, uint32_t dev_id, bool *curr_state); + +/** + * @brief Set resets for a device managed by TISCI + * + * @param dev Pointer to the TI SCI device + * @param dev_id Device identifier for this request + * @param reset_state Device-specific reset bit field + * + * @return 0 if successful, or an error code + */ +int tisci_cmd_set_device_resets(const struct device *dev, uint32_t dev_id, uint32_t reset_state); + +/** + * @brief Get reset state for a device managed by TISCI + * + * @param dev Pointer to the TI SCI device + * @param dev_id Device identifier for this request + * @param reset_state Pointer to store the reset state + * + * @return 0 if successful, or an error code + */ +int tisci_cmd_get_device_resets(const struct device *dev, uint32_t dev_id, uint32_t *reset_state); + +/* Resource Management Functions */ + +/** + * @brief Get a range of resources assigned to a host + * + * @param dev Pointer to the TI SCI device + * @param dev_id TISCI device ID + * @param subtype Resource assignment subtype being requested + * @param s_host Host processor ID to which the resources are allocated + * @param range_start Pointer to store the start index of the resource range + * @param range_num Pointer to store the number of resources in the range + * + * @return 0 if successful, or an error code + */ +int tisci_get_resource_range(const struct device *dev, uint32_t dev_id, uint8_t subtype, + uint8_t s_host, uint16_t *range_start, uint16_t *range_num); + +/** + * @brief Get a range of resources assigned to the host + * + * @param dev Pointer to the TI SCI device + * @param dev_id TISCI device ID + * @param subtype Resource assignment subtype being requested + * @param range_start Pointer to store the start index of the resource range + * @param range_num Pointer to store the number of resources in the range + * + * @return 0 if successful, or an error code + */ +int tisci_cmd_get_resource_range(const struct device *dev, uint32_t dev_id, uint8_t subtype, + uint16_t *range_start, uint16_t *range_num); + +/** + * @brief Get a range of resources assigned to a specified host + * + * @param dev Pointer to the TI SCI device + * @param dev_id TISCI device ID + * @param subtype Resource assignment subtype being requested + * @param s_host Host processor ID to which the resources are allocated + * @param range_start Pointer to store the start index of the resource range + * @param range_num Pointer to store the number of resources in the range + * + * @return 0 if successful, or an error code + */ +int tisci_cmd_get_resource_range_from_shost(const struct device *dev, uint32_t dev_id, + uint8_t subtype, uint8_t s_host, uint16_t *range_start, + uint16_t *range_num); + +/* Processor Management Functions */ + +/** + * @brief Command to request a physical processor control + * + * @param dev Pointer to the TI SCI device + * @param proc_id Processor ID this request is for + * + * @return 0 if successful, or an error code + */ +int tisci_cmd_proc_request(const struct device *dev, uint8_t proc_id); + +/** + * @brief Command to release a physical processor control + * + * @param dev Pointer to the TI SCI device + * @param proc_id Processor ID this request is for + * + * @return 0 if successful, or an error code + */ +int tisci_cmd_proc_release(const struct device *dev, uint8_t proc_id); + +/** + * @brief Command to handover a physical processor control to a host + * in the processor's access control list + * + * @param dev Pointer to the TI SCI device + * @param proc_id Processor ID this request is for + * @param host_id Host ID to get the control of the processor + * + * @return 0 if successful, or an error code + */ +int tisci_cmd_proc_handover(const struct device *dev, uint8_t proc_id, uint8_t host_id); + +/** + * @brief Command to set the processor boot configuration flags + * + * @param dev Pointer to the TI SCI device + * @param proc_id Processor ID this request is for + * @param bootvector Boot vector address + * @param config_flags_set Configuration flags to be set + * @param config_flags_clear Configuration flags to be cleared + * + * @return 0 if successful, or an error code + */ +int tisci_cmd_set_proc_boot_cfg(const struct device *dev, uint8_t proc_id, uint64_t bootvector, + uint32_t config_flags_set, uint32_t config_flags_clear); + +/** + * @brief Command to set the processor boot control flags + * + * @param dev Pointer to the TI SCI device + * @param proc_id Processor ID this request is for + * @param control_flags_set Control flags to be set + * @param control_flags_clear Control flags to be cleared + * + * @return 0 if successful, or an error code + */ +int tisci_cmd_set_proc_boot_ctrl(const struct device *dev, uint8_t proc_id, + uint32_t control_flags_set, uint32_t control_flags_clear); + +/** + * @brief Command to authenticate and load the image, then set the processor configuration flags + * + * @param dev Pointer to the TI SCI device + * @param image_addr Pointer to the memory address of the payload image and certificate + * @param image_size Pointer to the size of the image after authentication + * + * @return 0 if successful, or an error code + */ +int tisci_cmd_proc_auth_boot_image(const struct device *dev, uint64_t *image_addr, + uint32_t *image_size); + +/** + * @brief Command to get the processor boot status + * + * @param dev Pointer to the TI SCI device + * @param proc_id Processor ID this request is for + * @param bv Pointer to store the boot vector + * @param cfg_flags Pointer to store the configuration flags + * @param ctrl_flags Pointer to store the control flags + * @param sts_flags Pointer to store the status flags + * + * @return 0 if successful, or an error code + */ +int tisci_cmd_get_proc_boot_status(const struct device *dev, uint8_t proc_id, uint64_t *bv, + uint32_t *cfg_flags, uint32_t *ctrl_flags, uint32_t *sts_flags); + +/** + * @brief Helper function to wait for a processor boot status without requesting or waiting for a + * response + * + * @param dev Pointer to the TI SCI device + * @param proc_id Processor ID this request is for + * @param num_wait_iterations Total number of iterations to check before timeout + * @param num_match_iterations Number of consecutive matches required to confirm status + * @param delay_per_iteration_us Delay in microseconds between each status check + * @param delay_before_iterations_us Delay in microseconds before the first status check + * @param status_flags_1_set_all_wait Flags that must all be set to 1 + * @param status_flags_1_set_any_wait Flags where at least one must be set to 1 + * @param status_flags_1_clr_all_wait Flags that must all be cleared to 0 + * @param status_flags_1_clr_any_wait Flags where at least one must be cleared to 0 + * + * @return 0 if successful, or an error code + */ +int tisci_proc_wait_boot_status_no_wait(const struct device *dev, uint8_t proc_id, + uint8_t num_wait_iterations, uint8_t num_match_iterations, + uint8_t delay_per_iteration_us, + uint8_t delay_before_iterations_us, + uint32_t status_flags_1_set_all_wait, + uint32_t status_flags_1_set_any_wait, + uint32_t status_flags_1_clr_all_wait, + uint32_t status_flags_1_clr_any_wait); + +/** + * @brief Command to shutdown a core without requesting or waiting for a response + * + * @param dev Pointer to the TI SCI device + * @param proc_id Processor ID this request is for + * + * @return 0 if successful, or an error code + */ +int tisci_cmd_proc_shutdown_no_wait(const struct device *dev, uint8_t proc_id); + +/* Board Configuration Functions */ + +/** + * @brief Set board configuration using a specified message type + * + * Sends a board configuration message to the TI SCI firmware with configuration + * data from a specified memory location. + * + * @param dev Pointer to the TI SCI device + * @param msg_type TISCI message type for board configuration + * @param addr Physical address of board configuration data + * @param size Size of board configuration data in bytes + * + * @return 0 if successful, or an error code + */ +int cmd_set_board_config_using_msg(const struct device *dev, uint16_t msg_type, uint64_t addr, + uint32_t size); + +/* Ring Configuration Function */ + +/** + * @brief Configure a RA ring + * + * @param dev Pointer to the TI SCI device + * @param valid_params Bitfield defining validity of ring configuration parameters + * @param nav_id Device ID of Navigator Subsystem from which the ring is allocated + * @param index Ring index + * @param addr_lo The ring base address low 32 bits + * @param addr_hi The ring base address high 32 bits + * @param count Number of ring elements + * @param mode The mode of the ring + * @param size The ring element size + * @param order_id Specifies the ring's bus order ID + * + * @return 0 if successful, or an error code + */ +int tisci_cmd_ring_config(const struct device *dev, uint32_t valid_params, uint16_t nav_id, + uint16_t index, uint32_t addr_lo, uint32_t addr_hi, uint32_t count, + uint8_t mode, uint8_t size, uint8_t order_id); + +/* System Control Functions */ + +/** + * @brief Request a system reset + * + * Commands the TI SCI firmware to perform a system reset. + * + * @param dev Pointer to the TI SCI device + * + * @return 0 if successful, or an error code + */ +int tisci_cmd_sys_reset(const struct device *dev); + +/* Memory Management Functions */ + +/** + * @brief Query the available MSMC memory range + * + * Queries the TI SCI firmware for the currently available MSMC (Multi-Standard + * Shared Memory Controller) memory range. + * + * @param dev Pointer to the TI SCI device + * @param msmc_start Pointer to store the MSMC start address + * @param msmc_end Pointer to store the MSMC end address + * + * @return 0 if successful, or an error code + */ +int tisci_cmd_query_msmc(const struct device *dev, uint64_t *msmc_start, uint64_t *msmc_end); + +/* Firewall Management Functions */ + +/** + * @brief Configure a firewall region + * + * Sets up a firewall region with the specified configuration parameters + * including permissions, addresses, and control settings. + * + * @param dev Pointer to the TI SCI device + * @param region Pointer to the firewall region configuration parameters + * + * @return 0 if successful, or an error code + */ +int tisci_cmd_set_fwl_region(const struct device *dev, const struct tisci_msg_fwl_region *region); + +/* INCLUDE_ZEPHYR_DRIVERS_TISCI_H_ */ + +/* Firewall Management Functions */ +/* ... previous firewall functions ... */ + +/** + * @brief Get firewall region configuration + * + * Retrieves the configuration of a firewall region including permissions, + * addresses, and control settings. + * + * @param dev Pointer to the TI SCI device + * @param region Pointer to store the firewall region configuration. + * The fwl_id, region, and n_permission_regs fields must be + * set before calling this function. + * + * @return 0 if successful, or an error code + */ +int tisci_cmd_get_fwl_region(const struct device *dev, struct tisci_msg_fwl_region *region); + +/* INCLUDE_ZEPHYR_DRIVERS_TISCI_H_ */ + +/* Firewall Management Functions */ +/* ... previous firewall functions ... */ + +/** + * @brief Get firewall region configuration + * + * Retrieves the configuration of a firewall region including permissions, + * addresses, and control settings. + * + * @param dev Pointer to the TI SCI device + * @param region Pointer to store the firewall region configuration. + * The fwl_id, region, and n_permission_regs fields must be + * set before calling this function. + * + * @return 0 if successful, or an error code + */ +int tisci_cmd_get_fwl_region(const struct device *dev, struct tisci_msg_fwl_region *region); + +/* Firewall Management Functions */ +/* ... previous firewall functions ... */ + +/** + * @brief Get firewall region configuration + * + * Retrieves the configuration of a firewall region including permissions, + * addresses, and control settings. + * + * @param dev Pointer to the TI SCI device + * @param region Pointer to store the firewall region configuration. + * The fwl_id, region, and n_permission_regs fields must be + * set before calling this function. + * + * @return 0 if successful, or an error code + */ +int tisci_cmd_get_fwl_region(const struct device *dev, struct tisci_msg_fwl_region *region); + +/* Firewall Management Functions */ +/* ... previous firewall functions ... */ + +/** + * @brief Change firewall region owner + * + * Changes the ownership of a firewall region and retrieves updated + * ownership information. + * + * @param dev Pointer to the TI SCI device + * @param owner Pointer to firewall owner configuration. + * On input: contains fwl_id, region, and owner_index + * On output: contains updated ownership information + * + * @return 0 if successful, or an error code + */ +int tisci_cmd_change_fwl_owner(const struct device *dev, struct tisci_msg_fwl_owner *owner); + +/* UDMAP Management Functions */ + +/** + * @brief Configure a UDMAP transmit channel + * + * Configures the non-real-time registers of a Navigator Subsystem UDMAP + * transmit channel. + * + * @param dev Pointer to the TI SCI device + * @param params Pointer to the transmit channel configuration parameters + * + * @return 0 if successful, or an error code + */ +int tisci_cmd_rm_udmap_tx_ch_cfg(const struct device *dev, + const struct tisci_msg_rm_udmap_tx_ch_cfg *params); + +/** + * @brief Configure a UDMAP receive channel + * + * Configures the non-real-time registers of a Navigator Subsystem UDMAP + * receive channel. + * + * @param dev Pointer to the TI SCI device + * @param params Pointer to the receive channel configuration parameters + * + * @return 0 if successful, or an error code + */ +int tisci_cmd_rm_udmap_rx_ch_cfg(const struct device *dev, + const struct tisci_msg_rm_udmap_rx_ch_cfg *params); + +/* PSI-L Management Functions */ + +/** + * @brief Pair PSI-L source thread to destination thread + * + * Pairs a PSI-L source thread to a destination thread in the + * Navigator Subsystem. + * + * @param dev Pointer to the TI SCI device + * @param nav_id Navigator Subsystem device ID + * @param src_thread Source thread ID + * @param dst_thread Destination thread ID + * + * @return 0 if successful, or an error code + */ +int tisci_cmd_rm_psil_pair(const struct device *dev, uint32_t nav_id, uint32_t src_thread, + uint32_t dst_thread); + +/** + * @brief Unpair PSI-L source thread from destination thread + * + * Unpairs a PSI-L source thread from a destination thread in the + * Navigator Subsystem. + * + * @param dev Pointer to the TI SCI device + * @param nav_id Navigator Subsystem device ID + * @param src_thread Source thread ID + * @param dst_thread Destination thread ID + * + * @return 0 if successful, or an error code + */ +int tisci_cmd_rm_psil_unpair(const struct device *dev, uint32_t nav_id, uint32_t src_thread, + uint32_t dst_thread); + +/** + * @brief Set a Navigator Subsystem IRQ + * + * Sets up an interrupt route in the Navigator Subsystem using the provided request structure. + * + * @param dev Pointer to the TI SCI device + * @param req Pointer to the IRQ set request structure + * + * @return 0 if successful, or an error code + */ +int tisci_cmd_rm_irq_set(const struct device *dev, struct tisci_irq_set_req *req); + +/** + * @brief Release a Navigator Subsystem IRQ + * + * Releases an interrupt route in the Navigator Subsystem using the provided request structure. + * + * @param dev Pointer to the TI SCI device + * @param req Pointer to the IRQ release request structure + * + * @return 0 if successful, or an error code + */ +int tisci_cmd_rm_irq_release(const struct device *dev, struct tisci_irq_release_req *req); +#endif From f2a9184cfbe788df5ee926fcbdc20d6d1d975d78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20St=C4=99pnicki?= Date: Fri, 27 Jun 2025 15:50:11 +0200 Subject: [PATCH 0425/2141] [nrf fromtree] drivers: nrf_ironside: dvfs abb analog status workaround MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Until register ABB->STATUSANA is visible it must be checked using defined offset to base ABB register. Signed-off-by: Łukasz Stępnicki (cherry picked from commit 24322c609f5b2ff5952b838ab95e38b527739e1d) --- drivers/firmware/nrf_ironside/dvfs.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/firmware/nrf_ironside/dvfs.c b/drivers/firmware/nrf_ironside/dvfs.c index 89208f71fb7d..c814024b3edd 100644 --- a/drivers/firmware/nrf_ironside/dvfs.c +++ b/drivers/firmware/nrf_ironside/dvfs.c @@ -10,6 +10,14 @@ static enum ironside_dvfs_oppoint current_dvfs_oppoint = IRONSIDE_DVFS_OPP_HIGH; +#if defined(CONFIG_SOC_SERIES_NRF54HX) +#define ABB_STATUSANA_LOCKED_L_Pos (0UL) +#define ABB_STATUSANA_LOCKED_L_Msk (0x1UL << ABB_STATUSANA_LOCKED_L_Pos) +#define ABB_STATUSANA_REG_OFFSET (0x102UL) +#else +#error "Unsupported SoC series for IRONside DVFS" +#endif + struct dvfs_hsfll_data_t { uint32_t new_f_mult; uint32_t new_f_trim_entry; @@ -118,7 +126,10 @@ static void ironside_dvfs_change_oppoint_complete(enum ironside_dvfs_oppoint dvf static inline bool ironside_dvfs_is_abb_locked(NRF_ABB_Type *abb) { /* Check if ABB analog part is locked. */ - return ((abb->STATUSANA & ABB_STATUSANA_LOCKED_Msk) != 0); + /* Temporary workaround until STATUSANA register is visible. */ + volatile const uint32_t *statusana = (uint32_t *)abb + ABB_STATUSANA_REG_OFFSET; + + return ((*statusana & ABB_STATUSANA_LOCKED_L_Msk) != 0); } /** From 049e7818669cd74d7ef545145376d4ed15c3161f Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Wed, 11 Jun 2025 11:07:04 +0200 Subject: [PATCH 0426/2141] [nrf fromtree] drivers: firmware: nrf_ironside: Update the spelling s/IRONside/IronSide/g Signed-off-by: Grzegorz Swiderski (cherry picked from commit 75dd614437d8a7ee0c1f903accde9d30f02fda5a) --- ...nrf54h20dk_nrf54h20_cpuapp_iron_0_9_0.yaml | 2 +- ...nrf54h20dk_nrf54h20_cpurad_iron_0_9_0.yaml | 2 +- drivers/firmware/nrf_ironside/Kconfig | 22 +++++++++---------- drivers/firmware/nrf_ironside/dvfs.c | 6 ++--- .../firmware/nordic,ironside-call.yaml | 2 +- .../firmware/nrf_ironside/boot_report.h | 14 ++++++------ .../drivers/firmware/nrf_ironside/call.h | 8 +++---- .../drivers/firmware/nrf_ironside/cpuconf.h | 2 +- .../drivers/firmware/nrf_ironside/dvfs.h | 10 ++++----- .../drivers/firmware/nrf_ironside/update.h | 12 +++++----- .../boards/nordic/nrf_ironside/update/Kconfig | 2 +- .../nordic/nrf_ironside/update/README.rst | 20 ++++++++--------- .../nordic/nrf_ironside/update/sample.yaml | 4 ++-- .../nordic/nrf_ironside/update/src/main.c | 2 +- soc/nordic/nrf54h/Kconfig.soc | 2 +- soc/nordic/nrf92/Kconfig.soc | 2 +- 16 files changed, 56 insertions(+), 56 deletions(-) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_iron_0_9_0.yaml b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_iron_0_9_0.yaml index eefca56fe0c3..563a8b4ac1b7 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_iron_0_9_0.yaml +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_iron_0_9_0.yaml @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 identifier: nrf54h20dk/nrf54h20/cpuapp/iron -name: nRF54H20-DK-nRF54H20-Application (IRONside compatible) (revision 0.9.0) +name: nRF54H20-DK-nRF54H20-Application (IronSide compatible) (revision 0.9.0) type: mcu arch: arm toolchain: diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_iron_0_9_0.yaml b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_iron_0_9_0.yaml index ef71cfa924c0..034b9f7e27dd 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_iron_0_9_0.yaml +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_iron_0_9_0.yaml @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 identifier: nrf54h20dk/nrf54h20/cpurad/iron -name: nRF54H20-DK-nRF54H20-Radio (IRONside SE compatible) (revision 0.9.0) +name: nRF54H20-DK-nRF54H20-Radio (IronSide SE compatible) (revision 0.9.0) type: mcu arch: arm toolchain: diff --git a/drivers/firmware/nrf_ironside/Kconfig b/drivers/firmware/nrf_ironside/Kconfig index 4c313618638e..8a91adf8ed0e 100644 --- a/drivers/firmware/nrf_ironside/Kconfig +++ b/drivers/firmware/nrf_ironside/Kconfig @@ -5,7 +5,7 @@ config NRF_IRONSIDE bool depends on SOC_NRF54H20_IRON || SOC_NRF9280_IRON help - This is selected by drivers interacting with Nordic IRONside firmware. + This is selected by drivers interacting with Nordic IronSide firmware. config NRF_IRONSIDE_CALL bool @@ -14,44 +14,44 @@ config NRF_IRONSIDE_CALL select EVENTS select MBOX help - This is selected by features that require support for IRONside calls. + This is selected by features that require support for IronSide calls. if NRF_IRONSIDE_CALL config NRF_IRONSIDE_CALL_INIT_PRIORITY - int "IRONside calls' initialization priority" + int "IronSide calls' initialization priority" default 41 help - Initialization priority of IRONside calls. It must be below MBOX_INIT_PRIORITY, + Initialization priority of IronSide calls. It must be below MBOX_INIT_PRIORITY, but higher than the priority of any feature that selects NRF_IRONSIDE_CALL. endif # NRF_IRONSIDE_CALL -menu "Nordic IRONside services" +menu "Nordic IronSide services" depends on SOC_NRF54H20_IRON || SOC_NRF9280_IRON config NRF_IRONSIDE_CPUCONF_SERVICE - bool "IRONside CPUCONF service" + bool "IronSide CPUCONF service" depends on SOC_NRF54H20_CPUAPP || SOC_NRF9280_CPUAPP select NRF_IRONSIDE_CALL help Service used to boot local domain cores. config NRF_IRONSIDE_UPDATE_SERVICE - bool "IRONside update service" + bool "IronSide update service" select NRF_IRONSIDE_CALL help - Service used to update the IRONside SE firmware. + Service used to update the IronSide SE firmware. config NRF_IRONSIDE_BOOT_REPORT - bool "IRONside boot report" + bool "IronSide boot report" depends on $(dt_nodelabel_exists,ironside_se_boot_report) select NRF_IRONSIDE help - Support for parsing the Boot Report populated by Nordic IRONside firmware. + Support for parsing the Boot Report populated by Nordic IronSide firmware. config NRF_IRONSIDE_DVFS_SERVICE - bool "IRONside DVFS service" + bool "IronSide DVFS service" depends on SOC_NRF54H20_CPUAPP select NRF_IRONSIDE_CALL help diff --git a/drivers/firmware/nrf_ironside/dvfs.c b/drivers/firmware/nrf_ironside/dvfs.c index c814024b3edd..dd1e64f6d346 100644 --- a/drivers/firmware/nrf_ironside/dvfs.c +++ b/drivers/firmware/nrf_ironside/dvfs.c @@ -15,7 +15,7 @@ static enum ironside_dvfs_oppoint current_dvfs_oppoint = IRONSIDE_DVFS_OPP_HIGH; #define ABB_STATUSANA_LOCKED_L_Msk (0x1UL << ABB_STATUSANA_LOCKED_L_Pos) #define ABB_STATUSANA_REG_OFFSET (0x102UL) #else -#error "Unsupported SoC series for IRONside DVFS" +#error "Unsupported SoC series for IronSide DVFS" #endif struct dvfs_hsfll_data_t { @@ -133,8 +133,8 @@ static inline bool ironside_dvfs_is_abb_locked(NRF_ABB_Type *abb) } /** - * @brief Request DVFS oppoint change from IRONside secure domain. - * This function will send a request over IPC to the IRONside secure domain + * @brief Request DVFS oppoint change from IronSide secure domain. + * This function will send a request over IPC to the IronSide secure domain * This function is synchronous and will return when the request is completed. * * @param oppoint @ref enum ironside_dvfs_oppoint diff --git a/dts/bindings/firmware/nordic,ironside-call.yaml b/dts/bindings/firmware/nordic,ironside-call.yaml index 14f39cb0b74c..a2605ff22943 100644 --- a/dts/bindings/firmware/nordic,ironside-call.yaml +++ b/dts/bindings/firmware/nordic,ironside-call.yaml @@ -1,7 +1,7 @@ # Copyright (c) 2025 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -description: IPC configuration for Nordic IRONside calls +description: IPC configuration for Nordic IronSide calls compatible: "nordic,ironside-call" diff --git a/include/zephyr/drivers/firmware/nrf_ironside/boot_report.h b/include/zephyr/drivers/firmware/nrf_ironside/boot_report.h index 8a209b8788da..509c05babcbf 100644 --- a/include/zephyr/drivers/firmware/nrf_ironside/boot_report.h +++ b/include/zephyr/drivers/firmware/nrf_ironside/boot_report.h @@ -9,14 +9,14 @@ #include #include -/** Constant used to check if an Nordic IRONside SE boot report has been written. */ +/** Constant used to check if an Nordic IronSide SE boot report has been written. */ #define IRONSIDE_BOOT_REPORT_MAGIC (0x4d69546fUL) /** Length of the local domain context buffer in bytes. */ #define IRONSIDE_BOOT_REPORT_LOCAL_DOMAIN_CONTEXT_SIZE (16UL) /** Length of the random data buffer in bytes. */ #define IRONSIDE_BOOT_REPORT_RANDOM_DATA_SIZE (32UL) -/** @brief IRONside version structure. */ +/** @brief IronSide version structure. */ struct ironside_version { /** Wrapping sequence number ranging from 1-126, incremented for each release. */ uint8_t seqnum; @@ -43,13 +43,13 @@ struct ironside_boot_report_uicr_error { } description; }; -/** @brief IRONside boot report. */ +/** @brief IronSide boot report. */ struct ironside_boot_report { /** Magic value used to identify valid boot report */ uint32_t magic; - /** Firmware version of IRONside SE. */ + /** Firmware version of IronSide SE. */ struct ironside_version ironside_se_version; - /** Firmware version of IRONside SE recovery firmware. */ + /** Firmware version of IronSide SE recovery firmware. */ struct ironside_version ironside_se_recovery_version; /** Copy of SICR.UROT.UPDATE.STATUS.*/ uint32_t ironside_update_status; @@ -64,9 +64,9 @@ struct ironside_boot_report { }; /** - * @brief Get a pointer to the IRONside boot report. + * @brief Get a pointer to the IronSide boot report. * - * @param[out] report Will be set to point to the IRONside boot report. + * @param[out] report Will be set to point to the IronSide boot report. * * @retval 0 if successful. * @retval -EFAULT if the magic field in the report is incorrect. diff --git a/include/zephyr/drivers/firmware/nrf_ironside/call.h b/include/zephyr/drivers/firmware/nrf_ironside/call.h index 178b9371cdb7..d67e97622025 100644 --- a/include/zephyr/drivers/firmware/nrf_ironside/call.h +++ b/include/zephyr/drivers/firmware/nrf_ironside/call.h @@ -8,7 +8,7 @@ #include -/** @brief Maximum number of arguments to an IRONside call. +/** @brief Maximum number of arguments to an IronSide call. * * This is chosen so that the containing message buffer size is minimal but * cache line aligned. @@ -50,7 +50,7 @@ struct ironside_call_buf { */ /** - * @brief Allocate memory for an IRONside call. + * @brief Allocate memory for an IronSide call. * * This function will block when no buffers are available, until one is * released by another thread on the client side. @@ -60,7 +60,7 @@ struct ironside_call_buf { struct ironside_call_buf *ironside_call_alloc(void); /** - * @brief Dispatch an IRONside call. + * @brief Dispatch an IronSide call. * * This function will block until a response is received from the server. * @@ -71,7 +71,7 @@ struct ironside_call_buf *ironside_call_alloc(void); void ironside_call_dispatch(struct ironside_call_buf *buf); /** - * @brief Release an IRONside call buffer. + * @brief Release an IronSide call buffer. * * This function must be called after processing the response. * diff --git a/include/zephyr/drivers/firmware/nrf_ironside/cpuconf.h b/include/zephyr/drivers/firmware/nrf_ironside/cpuconf.h index d769a319def7..bed8932868fe 100644 --- a/include/zephyr/drivers/firmware/nrf_ironside/cpuconf.h +++ b/include/zephyr/drivers/firmware/nrf_ironside/cpuconf.h @@ -63,7 +63,7 @@ BUILD_ASSERT(IRONSIDE_CPUCONF_NUM_ARGS <= NRF_IRONSIDE_CALL_NUM_ARGS); * If the given msg_size is less than that, the remaining bytes are set to zero. * * @retval 0 on success or if the CPU has already booted. - * @retval Positive non-0 error status if reported by IRONside call. + * @retval Positive non-0 error status if reported by IronSide call. * @retval -IRONSIDE_CPUCONF_ERROR_WRONG_CPU if cpu is unrecognized * @retval -IRONSIDE_CPUCONF_ERROR_MESSAGE_TOO_LARGE if msg_size is greater than * IRONSIDE_CPUCONF_SERVICE_MSG_MAX_SIZE. diff --git a/include/zephyr/drivers/firmware/nrf_ironside/dvfs.h b/include/zephyr/drivers/firmware/nrf_ironside/dvfs.h index 7d6587bb3c0c..5a80f062bd76 100644 --- a/include/zephyr/drivers/firmware/nrf_ironside/dvfs.h +++ b/include/zephyr/drivers/firmware/nrf_ironside/dvfs.h @@ -18,15 +18,15 @@ enum ironside_dvfs_oppoint { }; /** - * @brief Number of DVFS oppoints supported by IRONside. + * @brief Number of DVFS oppoints supported by IronSide. * - * This is the number of different DVFS oppoints that can be set on IRONside. + * This is the number of different DVFS oppoints that can be set on IronSide. * The oppoints are defined in the `ironside_dvfs_oppoint` enum. */ #define IRONSIDE_DVFS_OPPOINT_COUNT (3) /** - * @name IRONside DVFS service error codes. + * @name IronSide DVFS service error codes. * @{ */ @@ -49,10 +49,10 @@ enum ironside_dvfs_oppoint { * @} */ -/* IRONside call identifiers with implicit versions. +/* IronSide call identifiers with implicit versions. * * With the initial "version 0", the service ABI is allowed to break until the - * first production release of IRONside SE. + * first production release of IronSide SE. */ #define IRONSIDE_CALL_ID_DVFS_SERVICE_V0 3 diff --git a/include/zephyr/drivers/firmware/nrf_ironside/update.h b/include/zephyr/drivers/firmware/nrf_ironside/update.h index 62191b3285b3..5da02c97e6dd 100644 --- a/include/zephyr/drivers/firmware/nrf_ironside/update.h +++ b/include/zephyr/drivers/firmware/nrf_ironside/update.h @@ -30,10 +30,10 @@ /** Length of the update signature in bytes. */ #define IRONSIDE_UPDATE_SIGNATURE_LENGTH (64) -/* IRONside call identifiers with implicit versions. +/* IronSide call identifiers with implicit versions. * * With the initial "version 0", the service ABI is allowed to break until the - * first production release of IRONside SE. + * first production release of IronSide SE. */ #define IRONSIDE_CALL_ID_UPDATE_SERVICE_V0 1 @@ -43,7 +43,7 @@ #define IRONSIDE_UPDATE_SERVICE_RETCODE_IDX (0) /** - * @brief IRONside update blob. + * @brief IronSide update blob. */ struct ironside_update_blob { uint8_t manifest[IRONSIDE_UPDATE_MANIFEST_LENGTH]; @@ -53,9 +53,9 @@ struct ironside_update_blob { }; /** - * @brief Request a firmware upgrade of the IRONside SE. + * @brief Request a firmware upgrade of the IronSide SE. * - * This invokes the IRONside SE update service. The device must be restarted for the update + * This invokes the IronSide SE update service. The device must be restarted for the update * to be installed. Check the update status in the application boot report to see if the update * was successfully installed. * @@ -63,7 +63,7 @@ struct ironside_update_blob { * * @retval -IRONSIDE_UPDATE_ERROR_NOT_PERMITTED if missing access to the update candidate. * @retval -IRONSIDE_UPDATE_ERROR_SICR_WRITE_FAILED if writing update parameters to SICR failed. - * @returns Positive non-0 error status if reported by IRONside call. + * @returns Positive non-0 error status if reported by IronSide call. * @returns 0 on a successful request (although the update itself may still fail). * */ diff --git a/samples/boards/nordic/nrf_ironside/update/Kconfig b/samples/boards/nordic/nrf_ironside/update/Kconfig index 702b943ff607..12d3350ef79a 100644 --- a/samples/boards/nordic/nrf_ironside/update/Kconfig +++ b/samples/boards/nordic/nrf_ironside/update/Kconfig @@ -6,6 +6,6 @@ config UPDATE_BLOB_ADDRESS default 0xe100000 help Address of the update blob. The default value matches the placement of the - update blobs delivered with the IRONside SE firmware. + update blobs delivered with the IronSide SE firmware. source "Kconfig.zephyr" diff --git a/samples/boards/nordic/nrf_ironside/update/README.rst b/samples/boards/nordic/nrf_ironside/update/README.rst index 2f44feedf067..af72d23f3917 100644 --- a/samples/boards/nordic/nrf_ironside/update/README.rst +++ b/samples/boards/nordic/nrf_ironside/update/README.rst @@ -1,24 +1,24 @@ .. zephyr:code-sample:: nrf_ironside_update - :name: Nordic IRONside SE firmware update + :name: Nordic IronSide SE firmware update - Update the Nordic IRONside SE firmware. + Update the Nordic IronSide SE firmware. Overview ******** -The Nordic IRONside SE Update sample updates the IRONside SE firmware on a SoC that already has IRONside SE installed. -It can update both the main image and the recovery image of IRONside SE using the IRONside SE firmware release ZIP file. +The Nordic IronSide SE Update sample updates the IronSide SE firmware on a SoC that already has IronSide SE installed. +It can update both the main image and the recovery image of IronSide SE using the IronSide SE firmware release ZIP file. Update procedure **************** The update procedure works as follows: -1. The application invokes the IRONside SE update service and passes the parameters that correspond to the location of the HEX file of the IRONside SE firmware update. +1. The application invokes the IronSide SE update service and passes the parameters that correspond to the location of the HEX file of the IronSide SE firmware update. #. The application prints the return value of the service call and outputs information from the update HEX file. -#. After the service call completes, the IRONside SE firmware updates the internal state of the device. +#. After the service call completes, the IronSide SE firmware updates the internal state of the device. #. The firmware installs the update during the next device boot. This operation can take several seconds. @@ -29,9 +29,9 @@ Building and running the application for nrf54h20dk/nrf54h20/cpuapp/iron ************************************************************************ .. note:: - You can use this application only when there is already a version of IRONside SE installed on the device. + You can use this application only when there is already a version of IronSide SE installed on the device. -1. Unzip the IRONside SE release ZIP to get the update hex file: +1. Unzip the IronSide SE release ZIP to get the update hex file: .. code-block:: console @@ -39,13 +39,13 @@ Building and running the application for nrf54h20dk/nrf54h20/cpuapp/iron #. Program the appropriate update hex file from the release ZIP using one (not both) of the following commands: - a) To update IRONside SE firmware: + a) To update IronSide SE firmware: .. code-block:: console nrfutil device program --traits jlink --firmware update/ironside_se_update.hex - b) To update IRONside SE recovery firmware: + b) To update IronSide SE recovery firmware: .. code-block:: console diff --git a/samples/boards/nordic/nrf_ironside/update/sample.yaml b/samples/boards/nordic/nrf_ironside/update/sample.yaml index af3c24624b88..cc127d9eb6dd 100644 --- a/samples/boards/nordic/nrf_ironside/update/sample.yaml +++ b/samples/boards/nordic/nrf_ironside/update/sample.yaml @@ -1,6 +1,6 @@ sample: - name: Nordic IRONside SE update service - description: Demonstrates how to update the Nordic IRONside SE firmware + name: Nordic IronSide SE update service + description: Demonstrates how to update the Nordic IronSide SE firmware common: build_only: true tags: nrf_ironside diff --git a/samples/boards/nordic/nrf_ironside/update/src/main.c b/samples/boards/nordic/nrf_ironside/update/src/main.c index a06603ca9b28..17098d93d3b4 100644 --- a/samples/boards/nordic/nrf_ironside/update/src/main.c +++ b/samples/boards/nordic/nrf_ironside/update/src/main.c @@ -28,7 +28,7 @@ int main(void) LOG_HEXDUMP_INF((void *)report->random_data, sizeof(report->random_data), "random data"); err = ironside_update(update); - LOG_INF("IRONside update retval: 0x%x", err); + LOG_INF("IronSide update retval: 0x%x", err); if (err == 0) { LOG_HEXDUMP_INF(update->manifest, sizeof(update->manifest), "Update manifest:"); diff --git a/soc/nordic/nrf54h/Kconfig.soc b/soc/nordic/nrf54h/Kconfig.soc index ac9101c177ca..62d5293bfe32 100644 --- a/soc/nordic/nrf54h/Kconfig.soc +++ b/soc/nordic/nrf54h/Kconfig.soc @@ -36,7 +36,7 @@ config SOC_NRF54H20_CPUFLPR config SOC_NRF54H20_IRON bool help - Indicates that local domain firmware is compatible with Nordic IRONside SE. + Indicates that local domain firmware is compatible with Nordic IronSide SE. config SOC default "nrf54h20" if SOC_NRF54H20 diff --git a/soc/nordic/nrf92/Kconfig.soc b/soc/nordic/nrf92/Kconfig.soc index 49891687a297..6ad2fb8a0147 100644 --- a/soc/nordic/nrf92/Kconfig.soc +++ b/soc/nordic/nrf92/Kconfig.soc @@ -65,7 +65,7 @@ config SOC_NRF9280_CPUPPR config SOC_NRF9280_IRON bool help - Indicates that local domain firmware is compatible with Nordic IRONside SE. + Indicates that local domain firmware is compatible with Nordic IronSide SE. config SOC default "nrf9280" if SOC_NRF9280 From 8da799d316d7d18984b2d24229f614659ed9328b Mon Sep 17 00:00:00 2001 From: Jonathan Nilsen Date: Thu, 19 Jun 2025 09:20:30 +0200 Subject: [PATCH 0427/2141] [nrf fromtree] soc: nordic: move nrf_ironside from drivers/firmware to soc/nordic Move the IronSide APIs to soc/nordic from drivers/firmware since these are vendor specific APIs. The header files are now included from . Adjust code that uses these APIs accordingly. Also move the DT binding for "nordic,ironside-call" from bindings/firmware to bindings/misc. Signed-off-by: Jonathan Nilsen (cherry picked from commit b18c3269465716bb8217113505cc9ee0ae2c0acb) --- drivers/firmware/CMakeLists.txt | 1 - drivers/firmware/Kconfig | 1 - dts/bindings/{firmware => misc}/nordic,ironside-call.yaml | 0 samples/boards/nordic/nrf_ironside/update/src/main.c | 4 ++-- soc/nordic/CMakeLists.txt | 1 + .../nrf_ironside => soc/nordic/ironside}/CMakeLists.txt | 2 ++ .../firmware/nrf_ironside => soc/nordic/ironside}/Kconfig | 0 .../nrf_ironside => soc/nordic/ironside}/boot_report.c | 2 +- .../firmware/nrf_ironside => soc/nordic/ironside}/call.c | 2 +- .../nrf_ironside => soc/nordic/ironside}/cpuconf.c | 4 ++-- .../firmware/nrf_ironside => soc/nordic/ironside}/dvfs.c | 4 ++-- .../nordic/ironside/include}/nrf_ironside/boot_report.h | 6 +++--- .../nordic/ironside/include}/nrf_ironside/call.h | 6 +++--- .../nordic/ironside/include}/nrf_ironside/cpuconf.h | 8 ++++---- .../nordic/ironside/include}/nrf_ironside/dvfs.h | 6 +++--- .../nordic/ironside/include}/nrf_ironside/update.h | 6 +++--- .../nrf_ironside => soc/nordic/ironside}/update.c | 4 ++-- soc/nordic/nrf54h/soc.c | 2 +- 18 files changed, 30 insertions(+), 29 deletions(-) rename dts/bindings/{firmware => misc}/nordic,ironside-call.yaml (100%) rename {drivers/firmware/nrf_ironside => soc/nordic/ironside}/CMakeLists.txt (92%) rename {drivers/firmware/nrf_ironside => soc/nordic/ironside}/Kconfig (100%) rename {drivers/firmware/nrf_ironside => soc/nordic/ironside}/boot_report.c (89%) rename {drivers/firmware/nrf_ironside => soc/nordic/ironside}/call.c (98%) rename {drivers/firmware/nrf_ironside => soc/nordic/ironside}/cpuconf.c (92%) rename {drivers/firmware/nrf_ironside => soc/nordic/ironside}/dvfs.c (97%) rename {include/zephyr/drivers/firmware => soc/nordic/ironside/include}/nrf_ironside/boot_report.h (91%) rename {include/zephyr/drivers/firmware => soc/nordic/ironside/include}/nrf_ironside/call.h (91%) rename {include/zephyr/drivers/firmware => soc/nordic/ironside/include}/nrf_ironside/cpuconf.h (89%) rename {include/zephyr/drivers/firmware => soc/nordic/ironside/include}/nrf_ironside/dvfs.h (92%) rename {include/zephyr/drivers/firmware => soc/nordic/ironside/include}/nrf_ironside/update.h (90%) rename {drivers/firmware/nrf_ironside => soc/nordic/ironside}/update.c (83%) diff --git a/drivers/firmware/CMakeLists.txt b/drivers/firmware/CMakeLists.txt index caed354c3972..cb6cec899638 100644 --- a/drivers/firmware/CMakeLists.txt +++ b/drivers/firmware/CMakeLists.txt @@ -2,6 +2,5 @@ # zephyr-keep-sorted-start add_subdirectory_ifdef(CONFIG_ARM_SCMI scmi) -add_subdirectory_ifdef(CONFIG_NRF_IRONSIDE nrf_ironside) add_subdirectory_ifdef(CONFIG_TISCI tisci) # zephyr-keep-sorted-stop diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig index 3c92ec3bb6e2..8cca2f588ed2 100644 --- a/drivers/firmware/Kconfig +++ b/drivers/firmware/Kconfig @@ -11,7 +11,6 @@ config ARM_SCMI Interface (SCMI). # zephyr-keep-sorted-start -source "drivers/firmware/nrf_ironside/Kconfig" source "drivers/firmware/scmi/Kconfig" source "drivers/firmware/tisci/Kconfig" # zephyr-keep-sorted-stop diff --git a/dts/bindings/firmware/nordic,ironside-call.yaml b/dts/bindings/misc/nordic,ironside-call.yaml similarity index 100% rename from dts/bindings/firmware/nordic,ironside-call.yaml rename to dts/bindings/misc/nordic,ironside-call.yaml diff --git a/samples/boards/nordic/nrf_ironside/update/src/main.c b/samples/boards/nordic/nrf_ironside/update/src/main.c index 17098d93d3b4..11fb88245190 100644 --- a/samples/boards/nordic/nrf_ironside/update/src/main.c +++ b/samples/boards/nordic/nrf_ironside/update/src/main.c @@ -4,8 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include -#include +#include +#include #include LOG_MODULE_REGISTER(app, LOG_LEVEL_INF); diff --git a/soc/nordic/CMakeLists.txt b/soc/nordic/CMakeLists.txt index 5aec1af88200..cba58ae51875 100644 --- a/soc/nordic/CMakeLists.txt +++ b/soc/nordic/CMakeLists.txt @@ -47,3 +47,4 @@ endif() add_subdirectory(${SOC_SERIES}) add_subdirectory(common) +add_subdirectory(ironside) diff --git a/drivers/firmware/nrf_ironside/CMakeLists.txt b/soc/nordic/ironside/CMakeLists.txt similarity index 92% rename from drivers/firmware/nrf_ironside/CMakeLists.txt rename to soc/nordic/ironside/CMakeLists.txt index ddc46bd69b1e..a0a18fc94a8a 100644 --- a/drivers/firmware/nrf_ironside/CMakeLists.txt +++ b/soc/nordic/ironside/CMakeLists.txt @@ -1,6 +1,8 @@ # Copyright (c) 2025 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 +zephyr_include_directories(include) + zephyr_library() zephyr_library_sources_ifdef(CONFIG_NRF_IRONSIDE_CALL call.c) diff --git a/drivers/firmware/nrf_ironside/Kconfig b/soc/nordic/ironside/Kconfig similarity index 100% rename from drivers/firmware/nrf_ironside/Kconfig rename to soc/nordic/ironside/Kconfig diff --git a/drivers/firmware/nrf_ironside/boot_report.c b/soc/nordic/ironside/boot_report.c similarity index 89% rename from drivers/firmware/nrf_ironside/boot_report.c rename to soc/nordic/ironside/boot_report.c index ee3e5ff30423..ead0afca947f 100644 --- a/drivers/firmware/nrf_ironside/boot_report.c +++ b/soc/nordic/ironside/boot_report.c @@ -5,7 +5,7 @@ #include #include -#include +#include #define IRONSIDE_SE_BOOT_REPORT_ADDR DT_REG_ADDR(DT_NODELABEL(ironside_se_boot_report)) diff --git a/drivers/firmware/nrf_ironside/call.c b/soc/nordic/ironside/call.c similarity index 98% rename from drivers/firmware/nrf_ironside/call.c rename to soc/nordic/ironside/call.c index f120c0175490..de4f59943f6a 100644 --- a/drivers/firmware/nrf_ironside/call.c +++ b/soc/nordic/ironside/call.c @@ -3,9 +3,9 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include #include #include -#include #include #include #include diff --git a/drivers/firmware/nrf_ironside/cpuconf.c b/soc/nordic/ironside/cpuconf.c similarity index 92% rename from drivers/firmware/nrf_ironside/cpuconf.c rename to soc/nordic/ironside/cpuconf.c index a8377ae0f936..264772a09e25 100644 --- a/drivers/firmware/nrf_ironside/cpuconf.c +++ b/soc/nordic/ironside/cpuconf.c @@ -9,8 +9,8 @@ #include #include -#include -#include +#include +#include #define CPU_PARAMS_CPU_OFFSET (0) #define CPU_PARAMS_CPU_MASK (0xF) diff --git a/drivers/firmware/nrf_ironside/dvfs.c b/soc/nordic/ironside/dvfs.c similarity index 97% rename from drivers/firmware/nrf_ironside/dvfs.c rename to soc/nordic/ironside/dvfs.c index dd1e64f6d346..7793ff015b1e 100644 --- a/drivers/firmware/nrf_ironside/dvfs.c +++ b/soc/nordic/ironside/dvfs.c @@ -5,8 +5,8 @@ #include #include -#include -#include +#include +#include static enum ironside_dvfs_oppoint current_dvfs_oppoint = IRONSIDE_DVFS_OPP_HIGH; diff --git a/include/zephyr/drivers/firmware/nrf_ironside/boot_report.h b/soc/nordic/ironside/include/nrf_ironside/boot_report.h similarity index 91% rename from include/zephyr/drivers/firmware/nrf_ironside/boot_report.h rename to soc/nordic/ironside/include/nrf_ironside/boot_report.h index 509c05babcbf..7cd512675334 100644 --- a/include/zephyr/drivers/firmware/nrf_ironside/boot_report.h +++ b/soc/nordic/ironside/include/nrf_ironside/boot_report.h @@ -3,8 +3,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -#ifndef ZEPHYR_INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_NRF_IRONSIDE_BOOT_REPORT_H_ -#define ZEPHYR_INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_NRF_IRONSIDE_BOOT_REPORT_H_ +#ifndef ZEPHYR_SOC_NORDIC_IRONSIDE_INCLUDE_NRF_IRONSIDE_BOOT_REPORT_H_ +#define ZEPHYR_SOC_NORDIC_IRONSIDE_INCLUDE_NRF_IRONSIDE_BOOT_REPORT_H_ #include #include @@ -74,4 +74,4 @@ struct ironside_boot_report { */ int ironside_boot_report_get(const struct ironside_boot_report **report); -#endif /* ZEPHYR_INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_NRF_IRONSIDE_BOOT_REPORT_H_ */ +#endif /* ZEPHYR_SOC_NORDIC_IRONSIDE_INCLUDE_NRF_IRONSIDE_BOOT_REPORT_H_ */ diff --git a/include/zephyr/drivers/firmware/nrf_ironside/call.h b/soc/nordic/ironside/include/nrf_ironside/call.h similarity index 91% rename from include/zephyr/drivers/firmware/nrf_ironside/call.h rename to soc/nordic/ironside/include/nrf_ironside/call.h index d67e97622025..9a2431c7d580 100644 --- a/include/zephyr/drivers/firmware/nrf_ironside/call.h +++ b/soc/nordic/ironside/include/nrf_ironside/call.h @@ -3,8 +3,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -#ifndef ZEPHYR_INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_NRF_IRONSIDE_CALL_H_ -#define ZEPHYR_INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_NRF_IRONSIDE_CALL_H_ +#ifndef ZEPHYR_SOC_NORDIC_IRONSIDE_INCLUDE_NRF_IRONSIDE_CALL_H_ +#define ZEPHYR_SOC_NORDIC_IRONSIDE_INCLUDE_NRF_IRONSIDE_CALL_H_ #include @@ -79,4 +79,4 @@ void ironside_call_dispatch(struct ironside_call_buf *buf); */ void ironside_call_release(struct ironside_call_buf *buf); -#endif /* ZEPHYR_INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_NRF_IRONSIDE_CALL_H_ */ +#endif /* ZEPHYR_SOC_NORDIC_IRONSIDE_INCLUDE_NRF_IRONSIDE_CALL_H_ */ diff --git a/include/zephyr/drivers/firmware/nrf_ironside/cpuconf.h b/soc/nordic/ironside/include/nrf_ironside/cpuconf.h similarity index 89% rename from include/zephyr/drivers/firmware/nrf_ironside/cpuconf.h rename to soc/nordic/ironside/include/nrf_ironside/cpuconf.h index bed8932868fe..49e562b13698 100644 --- a/include/zephyr/drivers/firmware/nrf_ironside/cpuconf.h +++ b/soc/nordic/ironside/include/nrf_ironside/cpuconf.h @@ -3,14 +3,14 @@ * SPDX-License-Identifier: Apache-2.0 */ -#ifndef ZEPHYR_INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_NRF_IRONSIDE_CPUCONF_H_ -#define ZEPHYR_INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_NRF_IRONSIDE_CPUCONF_H_ +#ifndef ZEPHYR_SOC_NORDIC_IRONSIDE_INCLUDE_NRF_IRONSIDE_CPUCONF_H_ +#define ZEPHYR_SOC_NORDIC_IRONSIDE_INCLUDE_NRF_IRONSIDE_CPUCONF_H_ #include #include -#include #include #include +#include /** * @name CPUCONF service error codes. @@ -71,4 +71,4 @@ BUILD_ASSERT(IRONSIDE_CPUCONF_NUM_ARGS <= NRF_IRONSIDE_CALL_NUM_ARGS); int ironside_cpuconf(NRF_PROCESSORID_Type cpu, const void *vector_table, bool cpu_wait, const uint8_t *msg, size_t msg_size); -#endif /* ZEPHYR_INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_NRF_IRONSIDE_CPUCONF_H_ */ +#endif /* ZEPHYR_SOC_NORDIC_IRONSIDE_INCLUDE_NRF_IRONSIDE_CPUCONF_H_ */ diff --git a/include/zephyr/drivers/firmware/nrf_ironside/dvfs.h b/soc/nordic/ironside/include/nrf_ironside/dvfs.h similarity index 92% rename from include/zephyr/drivers/firmware/nrf_ironside/dvfs.h rename to soc/nordic/ironside/include/nrf_ironside/dvfs.h index 5a80f062bd76..e2cb03c249e0 100644 --- a/include/zephyr/drivers/firmware/nrf_ironside/dvfs.h +++ b/soc/nordic/ironside/include/nrf_ironside/dvfs.h @@ -3,8 +3,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -#ifndef ZEPHYR_INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_NRF_IRONSIDE_DVFS_H_ -#define ZEPHYR_INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_NRF_IRONSIDE_DVFS_H_ +#ifndef ZEPHYR_SOC_NORDIC_IRONSIDE_INCLUDE_NRF_IRONSIDE_DVFS_H_ +#define ZEPHYR_SOC_NORDIC_IRONSIDE_INCLUDE_NRF_IRONSIDE_DVFS_H_ #include #include @@ -89,4 +89,4 @@ static inline bool ironside_dvfs_is_oppoint_valid(enum ironside_dvfs_oppoint dvf return true; } -#endif /* ZEPHYR_INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_NRF_IRONSIDE_DVFS_H_ */ +#endif /* ZEPHYR_SOC_NORDIC_IRONSIDE_INCLUDE_NRF_IRONSIDE_DVFS_H_ */ diff --git a/include/zephyr/drivers/firmware/nrf_ironside/update.h b/soc/nordic/ironside/include/nrf_ironside/update.h similarity index 90% rename from include/zephyr/drivers/firmware/nrf_ironside/update.h rename to soc/nordic/ironside/include/nrf_ironside/update.h index 5da02c97e6dd..8152a77f5f7c 100644 --- a/include/zephyr/drivers/firmware/nrf_ironside/update.h +++ b/soc/nordic/ironside/include/nrf_ironside/update.h @@ -3,8 +3,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -#ifndef ZEPHYR_INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_NRF_IRONSIDE_UPDATE_H_ -#define ZEPHYR_INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_NRF_IRONSIDE_UPDATE_H_ +#ifndef ZEPHYR_SOC_NORDIC_IRONSIDE_INCLUDE_NRF_IRONSIDE_UPDATE_H_ +#define ZEPHYR_SOC_NORDIC_IRONSIDE_INCLUDE_NRF_IRONSIDE_UPDATE_H_ #include #include @@ -69,4 +69,4 @@ struct ironside_update_blob { */ int ironside_update(const struct ironside_update_blob *update); -#endif /* ZEPHYR_INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_NRF_IRONSIDE_UPDATE_H_ */ +#endif /* ZEPHYR_SOC_NORDIC_IRONSIDE_INCLUDE_NRF_IRONSIDE_UPDATE_H_ */ diff --git a/drivers/firmware/nrf_ironside/update.c b/soc/nordic/ironside/update.c similarity index 83% rename from drivers/firmware/nrf_ironside/update.c rename to soc/nordic/ironside/update.c index 8de21303b05c..a56407a3fa14 100644 --- a/drivers/firmware/nrf_ironside/update.c +++ b/soc/nordic/ironside/update.c @@ -3,8 +3,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include -#include +#include +#include int ironside_update(const struct ironside_update_blob *update) { diff --git a/soc/nordic/nrf54h/soc.c b/soc/nordic/nrf54h/soc.c index e55f56242b90..0c43c6175720 100644 --- a/soc/nordic/nrf54h/soc.c +++ b/soc/nordic/nrf54h/soc.c @@ -22,7 +22,7 @@ #include #include #include -#include +#include LOG_MODULE_REGISTER(soc, CONFIG_SOC_LOG_LEVEL); From c57026d76594a40abc9e3851c7f924e3b73f3757 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Mon, 23 Jun 2025 15:22:49 +0100 Subject: [PATCH 0428/2141] [nrf fromtree] boards: nordic: Use dts for non-secure partitions Replaces using an odd mix of Kconfig dts for partition offsets with just use dts for non-secure board targets Signed-off-by: Jamie McCrae (cherry picked from commit e68f8e31e4081e1f729c954c25ae11e8985d6afe) --- boards/nordic/nrf5340dk/Kconfig.defconfig | 26 ++++-------------- boards/nordic/nrf54l15dk/Kconfig.defconfig | 14 +++------- boards/nordic/nrf9131ek/Kconfig.defconfig | 32 ++-------------------- boards/nordic/nrf9151dk/Kconfig.defconfig | 28 ++----------------- boards/nordic/nrf9160dk/Kconfig.defconfig | 28 ++----------------- boards/nordic/nrf9161dk/Kconfig.defconfig | 28 ++----------------- 6 files changed, 18 insertions(+), 138 deletions(-) diff --git a/boards/nordic/nrf5340dk/Kconfig.defconfig b/boards/nordic/nrf5340dk/Kconfig.defconfig index b6186d4e0745..6ba50229174d 100644 --- a/boards/nordic/nrf5340dk/Kconfig.defconfig +++ b/boards/nordic/nrf5340dk/Kconfig.defconfig @@ -3,7 +3,7 @@ # Copyright (c) 2019-2020 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -if BOARD_NRF5340DK_NRF5340_CPUAPP || BOARD_NRF5340DK_NRF5340_CPUAPP_NS +if BOARD_NRF5340DK_NRF5340_CPUAPP || BOARD_NRF5340DK_NRF5340_CPUAPP_NS # Code Partition: # @@ -29,29 +29,19 @@ if BOARD_NRF5340DK_NRF5340_CPUAPP || BOARD_NRF5340DK_NRF5340_CPUAPP_NS # For the non-secure version of the board, the firmware image SRAM is # always restricted to the allocated non-secure SRAM partition. # -# Workaround for not being able to have commas in macro arguments -DT_CHOSEN_Z_CODE_PARTITION := zephyr,code-partition -DT_CHOSEN_Z_SRAM_PARTITION := zephyr,sram-secure-partition if BOARD_NRF5340DK_NRF5340_CPUAPP && TRUSTED_EXECUTION_SECURE -config FLASH_LOAD_SIZE - default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) +# Workaround for not being able to have commas in macro arguments +DT_CHOSEN_Z_SRAM_PARTITION := zephyr,sram-secure-partition config SRAM_SIZE default $(dt_chosen_reg_size_int,$(DT_CHOSEN_Z_SRAM_PARTITION),0,K) endif # BOARD_NRF5340DK_NRF5340_CPUAPP && TRUSTED_EXECUTION_SECURE -if BOARD_NRF5340DK_NRF5340_CPUAPP_NS - -config FLASH_LOAD_OFFSET - default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) - -config FLASH_LOAD_SIZE - default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) - -endif # BOARD_NRF5340DK_NRF5340_CPUAPP_NS +config BOARD_NRF5340DK + select USE_DT_CODE_PARTITION if BOARD_NRF5340DK_NRF5340_CPUAPP_NS config BT_HCI_IPC default y if BT @@ -60,8 +50,4 @@ config HEAP_MEM_POOL_ADD_SIZE_BOARD int default 4096 if BT_HCI_IPC -endif # BOARD_NRF5340DK_NRF5340_CPUAPP || BOARD_NRF5340DK_NRF5340_CPUAPP_NS - -if BOARD_NRF5340DK_NRF5340_CPUNET - -endif # BOARD_NRF5340DK_NRF5340_CPUNET +endif # BOARD_NRF5340DK_NRF5340_CPUAPP || BOARD_NRF5340DK_NRF5340_CPUAPP_NS diff --git a/boards/nordic/nrf54l15dk/Kconfig.defconfig b/boards/nordic/nrf54l15dk/Kconfig.defconfig index 9628b1fdf963..04c1d9ddc234 100644 --- a/boards/nordic/nrf54l15dk/Kconfig.defconfig +++ b/boards/nordic/nrf54l15dk/Kconfig.defconfig @@ -1,10 +1,6 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -# Workaround for not being able to have commas in macro arguments -DT_CHOSEN_Z_CODE_PARTITION := zephyr,code-partition -DT_CHOSEN_Z_SRAM_PARTITION := zephyr,sram-secure-partition - if BOARD_NRF54L15DK_NRF54L05_CPUAPP || BOARD_NRF54L15DK_NRF54L10_CPUAPP || \ BOARD_NRF54L15DK_NRF54L15_CPUAPP @@ -16,15 +12,13 @@ endif # BOARD_NRF54L15DK_NRF54L05_CPUAPP || BOARD_NRF54L15DK_NRF54L10_CPUAPP || if BOARD_NRF54L15DK_NRF54L15_CPUAPP_NS || BOARD_NRF54L15DK_NRF54L10_CPUAPP_NS +config BOARD_NRF54L15DK + select USE_DT_CODE_PARTITION if BOARD_NRF54L15DK_NRF54L15_CPUAPP_NS || \ + BOARD_NRF54L15DK_NRF54L10_CPUAPP_NS + config BT_CTLR default BT -config FLASH_LOAD_OFFSET - default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) - -config FLASH_LOAD_SIZE - default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) - # By default, if we build for a Non-Secure version of the board, # enable building with TF-M as the Secure Execution Environment. config BUILD_WITH_TFM diff --git a/boards/nordic/nrf9131ek/Kconfig.defconfig b/boards/nordic/nrf9131ek/Kconfig.defconfig index b63e7ef8d34c..3e422198078b 100644 --- a/boards/nordic/nrf9131ek/Kconfig.defconfig +++ b/boards/nordic/nrf9131ek/Kconfig.defconfig @@ -3,33 +3,5 @@ # Copyright (c) 2023 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -if BOARD_NRF9131EK_NRF9131 || BOARD_NRF9131EK_NRF9131_NS - -# 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- -# secure image (TRUSTED_EXECUTION_SECURE=y), the secure FW image shall always -# be restricted to the size of its code partition. -# For the non-secure version of the board, the firmware -# must be linked into the code-partition (non-secure) defined in DT, regardless. -# Apply this configuration below by setting the Kconfig symbols used by -# the linker according to the information extracted from DT partitions. - -# Workaround for not being able to have commas in macro arguments -DT_CHOSEN_Z_CODE_PARTITION := zephyr,code-partition - -config FLASH_LOAD_SIZE - default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) - depends on BOARD_NRF9131EK_NRF9131 && TRUSTED_EXECUTION_SECURE - -if BOARD_NRF9131EK_NRF9131_NS - -config FLASH_LOAD_OFFSET - default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) - -config FLASH_LOAD_SIZE - default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) - -endif # BOARD_NRF9131EK_NRF9131_NS - -endif # BOARD_NRF9131EK_NRF9131 || BOARD_NRF9131EK_NRF9131_NS +config BOARD_NRF9131EK + select USE_DT_CODE_PARTITION if BOARD_NRF9131EK_NRF9131_NS diff --git a/boards/nordic/nrf9151dk/Kconfig.defconfig b/boards/nordic/nrf9151dk/Kconfig.defconfig index 21f036f76079..cfdc9c5f87e6 100644 --- a/boards/nordic/nrf9151dk/Kconfig.defconfig +++ b/boards/nordic/nrf9151dk/Kconfig.defconfig @@ -5,32 +5,8 @@ if BOARD_NRF9151DK_NRF9151 || BOARD_NRF9151DK_NRF9151_NS -# 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- -# secure image (TRUSTED_EXECUTION_SECURE=y), the secure FW image shall always -# be restricted to the size of its code partition. -# For the non-secure version of the board, the firmware -# must be linked into the code-partition (non-secure) defined in DT, regardless. -# Apply this configuration below by setting the Kconfig symbols used by -# the linker according to the information extracted from DT partitions. - -# Workaround for not being able to have commas in macro arguments -DT_CHOSEN_Z_CODE_PARTITION := zephyr,code-partition - -config FLASH_LOAD_SIZE - default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) - depends on BOARD_NRF9151DK_NRF9151 && TRUSTED_EXECUTION_SECURE - -if BOARD_NRF9151DK_NRF9151_NS - -config FLASH_LOAD_OFFSET - default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) - -config FLASH_LOAD_SIZE - default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) - -endif # BOARD_NRF9151DK_NRF9151_NS +config BOARD_NRF9151DK + select USE_DT_CODE_PARTITION if BOARD_NRF9151DK_NRF9151_NS config BT_HCI_VS default y if BT diff --git a/boards/nordic/nrf9160dk/Kconfig.defconfig b/boards/nordic/nrf9160dk/Kconfig.defconfig index b26c68ef5319..b92acdd3f106 100644 --- a/boards/nordic/nrf9160dk/Kconfig.defconfig +++ b/boards/nordic/nrf9160dk/Kconfig.defconfig @@ -5,32 +5,8 @@ if BOARD_NRF9160DK_NRF9160 || BOARD_NRF9160DK_NRF9160_NS -# 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- -# secure image (TRUSTED_EXECUTION_SECURE=y), the secure FW image shall always -# be restricted to the size of its code partition. -# For the non-secure version of the board, the firmware -# must be linked into the code-partition (non-secure) defined in DT, regardless. -# Apply this configuration below by setting the Kconfig symbols used by -# the linker according to the information extracted from DT partitions. - -# Workaround for not being able to have commas in macro arguments -DT_CHOSEN_Z_CODE_PARTITION := zephyr,code-partition - -config FLASH_LOAD_SIZE - default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) - depends on BOARD_NRF9160DK_NRF9160 && TRUSTED_EXECUTION_SECURE - -if BOARD_NRF9160DK_NRF9160_NS - -config FLASH_LOAD_OFFSET - default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) - -config FLASH_LOAD_SIZE - default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) - -endif # BOARD_NRF9160DK_NRF9160_NS +config BOARD_NRF9160DK + select USE_DT_CODE_PARTITION if BOARD_NRF9160DK_NRF9160_NS config BT_HCI_VS default y if BT diff --git a/boards/nordic/nrf9161dk/Kconfig.defconfig b/boards/nordic/nrf9161dk/Kconfig.defconfig index 3790d580a295..28490a3c65d9 100644 --- a/boards/nordic/nrf9161dk/Kconfig.defconfig +++ b/boards/nordic/nrf9161dk/Kconfig.defconfig @@ -5,32 +5,8 @@ if BOARD_NRF9161DK_NRF9161 || BOARD_NRF9161DK_NRF9161_NS -# 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- -# secure image (TRUSTED_EXECUTION_SECURE=y), the secure FW image shall always -# be restricted to the size of its code partition. -# For the non-secure version of the board, the firmware -# must be linked into the code-partition (non-secure) defined in DT, regardless. -# Apply this configuration below by setting the Kconfig symbols used by -# the linker according to the information extracted from DT partitions. - -# Workaround for not being able to have commas in macro arguments -DT_CHOSEN_Z_CODE_PARTITION := zephyr,code-partition - -config FLASH_LOAD_SIZE - default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) - depends on BOARD_NRF9161DK_NRF9161 && TRUSTED_EXECUTION_SECURE - -if BOARD_NRF9161DK_NRF9161_NS - -config FLASH_LOAD_OFFSET - default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) - -config FLASH_LOAD_SIZE - default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) - -endif # BOARD_NRF9161DK_NRF9161_NS +config BOARD_NRF9161DK + select USE_DT_CODE_PARTITION if BOARD_NRF9161DK_NRF9161_NS config BT_HCI_VS default y if BT From 401d0637330a495b11e8587a83fd7c8ddea1872e Mon Sep 17 00:00:00 2001 From: Carles Cufi Date: Fri, 20 Jun 2025 15:52:06 +0200 Subject: [PATCH 0429/2141] [nrf fromtree] boards: nordic: Enable CONFIG_HW_STACK_PROTECTION conditionally All Nordic boards were enabling CONFIG_HW_STACK_PROTECTION unconditionally, which is usually not a problem except if the particular application happens to want to disable the MPU (or equivalent hardware for RISC-V). In that case, the following warning is shown: warning: HW_STACK_PROTECTION (defined at arch/Kconfig) was assigned the value 'y' but got the value 'n'. Check these unsatisfied dependencies: ARCH_HAS_STACK_PROTECTION (=n). In order to avoid this warning, conditionally enable the hardware stack protection only when the architecture supports it. Signed-off-by: Carles Cufi (cherry picked from commit 9a9ae6ffdb5b7f9d73a95bd9a281f2f0364bded7) --- boards/nordic/nrf21540dk/Kconfig.defconfig | 3 +++ .../nordic/nrf21540dk/nrf21540dk_nrf52840_defconfig | 3 --- boards/nordic/nrf52833dk/Kconfig.defconfig | 3 +++ .../nordic/nrf52833dk/nrf52833dk_nrf52820_defconfig | 3 --- .../nordic/nrf52833dk/nrf52833dk_nrf52833_defconfig | 3 --- boards/nordic/nrf52840dk/Kconfig.defconfig | 3 +++ .../nordic/nrf52840dk/nrf52840dk_nrf52811_defconfig | 3 --- .../nordic/nrf52840dk/nrf52840dk_nrf52840_defconfig | 3 --- boards/nordic/nrf52840dongle/Kconfig.defconfig | 3 +++ .../nrf52840dongle/nrf52840dongle_nrf52840_defconfig | 3 --- boards/nordic/nrf52dk/Kconfig.defconfig | 11 +++++++++++ boards/nordic/nrf52dk/nrf52dk_nrf52805_defconfig | 3 --- boards/nordic/nrf52dk/nrf52dk_nrf52810_defconfig | 3 --- boards/nordic/nrf52dk/nrf52dk_nrf52832_defconfig | 3 --- boards/nordic/nrf5340_audio_dk/Kconfig.defconfig | 3 +++ .../nrf5340_audio_dk_nrf5340_cpuapp_defconfig | 2 -- .../nrf5340_audio_dk_nrf5340_cpuapp_ns_defconfig | 2 -- .../nrf5340_audio_dk_nrf5340_cpunet_defconfig | 3 --- boards/nordic/nrf5340dk/Kconfig.defconfig | 3 +++ .../nrf5340dk/nrf5340dk_nrf5340_cpuapp_defconfig | 3 --- .../nrf5340dk/nrf5340dk_nrf5340_cpuapp_ns_defconfig | 3 --- .../nrf5340dk/nrf5340dk_nrf5340_cpunet_defconfig | 3 --- boards/nordic/nrf54h20dk/Kconfig.defconfig | 3 +++ .../nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_defconfig | 3 --- .../nrf54h20dk_nrf54h20_cpuapp_iron_defconfig | 3 --- .../nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_defconfig | 3 --- .../nrf54h20dk_nrf54h20_cpurad_iron_defconfig | 3 --- boards/nordic/nrf54l09pdk/Kconfig.defconfig | 3 +++ .../nrf54l09pdk/nrf54l09pdk_nrf54l09_cpuapp_defconfig | 3 --- boards/nordic/nrf54l15dk/Kconfig.defconfig | 3 +++ .../nrf54l15dk/nrf54l15dk_nrf54l05_cpuapp_defconfig | 3 --- .../nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_defconfig | 3 --- .../nrf54l15dk_nrf54l10_cpuapp_ns_defconfig | 1 - .../nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp_defconfig | 3 --- .../nrf54l15dk_nrf54l15_cpuapp_ns_defconfig | 1 - boards/nordic/nrf54l20pdk/Kconfig.defconfig | 3 +++ .../nrf54l20pdk/nrf54l20pdk_nrf54l20_cpuapp_defconfig | 3 --- boards/nordic/nrf7002dk/Kconfig.defconfig | 11 +++++++++++ .../nrf7002dk/nrf7002dk_nrf5340_cpuapp_defconfig | 3 --- .../nrf7002dk_nrf5340_cpuapp_nrf7001_defconfig | 3 --- .../nrf7002dk/nrf7002dk_nrf5340_cpunet_defconfig | 3 --- boards/nordic/nrf9131ek/Kconfig.defconfig | 3 +++ boards/nordic/nrf9131ek/nrf9131ek_nrf9131_defconfig | 3 --- .../nordic/nrf9131ek/nrf9131ek_nrf9131_ns_defconfig | 3 --- boards/nordic/nrf9151dk/Kconfig.defconfig | 3 +++ boards/nordic/nrf9151dk/nrf9151dk_nrf9151_defconfig | 3 --- .../nordic/nrf9151dk/nrf9151dk_nrf9151_ns_defconfig | 3 --- boards/nordic/nrf9160dk/Kconfig.defconfig | 3 +++ boards/nordic/nrf9160dk/nrf9160dk_nrf52840_defconfig | 3 --- boards/nordic/nrf9160dk/nrf9160dk_nrf9160_defconfig | 3 --- .../nordic/nrf9160dk/nrf9160dk_nrf9160_ns_defconfig | 3 --- boards/nordic/nrf9161dk/Kconfig.defconfig | 3 +++ boards/nordic/nrf9161dk/nrf9161dk_nrf9161_defconfig | 3 --- .../nordic/nrf9161dk/nrf9161dk_nrf9161_ns_defconfig | 3 --- boards/nordic/nrf9280pdk/Kconfig.defconfig | 3 +++ .../nrf9280pdk/nrf9280pdk_nrf9280_cpuapp_defconfig | 3 --- .../nrf9280pdk/nrf9280pdk_nrf9280_cpurad_defconfig | 3 --- boards/nordic/thingy52/Kconfig.defconfig | 3 +++ boards/nordic/thingy52/thingy52_nrf52832_defconfig | 3 --- boards/nordic/thingy53/Kconfig.defconfig | 3 +++ .../nordic/thingy53/thingy53_nrf5340_cpuapp_defconfig | 3 --- .../thingy53/thingy53_nrf5340_cpuapp_ns_defconfig | 3 --- .../nordic/thingy53/thingy53_nrf5340_cpunet_defconfig | 3 --- 63 files changed, 73 insertions(+), 126 deletions(-) create mode 100644 boards/nordic/nrf52dk/Kconfig.defconfig create mode 100644 boards/nordic/nrf7002dk/Kconfig.defconfig diff --git a/boards/nordic/nrf21540dk/Kconfig.defconfig b/boards/nordic/nrf21540dk/Kconfig.defconfig index 31642d144099..6f2eea3c9980 100644 --- a/boards/nordic/nrf21540dk/Kconfig.defconfig +++ b/boards/nordic/nrf21540dk/Kconfig.defconfig @@ -5,4 +5,7 @@ if BOARD_NRF21540DK +config HW_STACK_PROTECTION + default ARCH_HAS_STACK_PROTECTION + endif # BOARD_NRF21540DK diff --git a/boards/nordic/nrf21540dk/nrf21540dk_nrf52840_defconfig b/boards/nordic/nrf21540dk/nrf21540dk_nrf52840_defconfig index 14367293292d..7167aca850a0 100644 --- a/boards/nordic/nrf21540dk/nrf21540dk_nrf52840_defconfig +++ b/boards/nordic/nrf21540dk/nrf21540dk_nrf52840_defconfig @@ -3,9 +3,6 @@ # Enable MPU CONFIG_ARM_MPU=y -# Enable hardware stack protection -CONFIG_HW_STACK_PROTECTION=y - # enable GPIO CONFIG_GPIO=y diff --git a/boards/nordic/nrf52833dk/Kconfig.defconfig b/boards/nordic/nrf52833dk/Kconfig.defconfig index dc6fbbdcf3d9..d016c17667e0 100644 --- a/boards/nordic/nrf52833dk/Kconfig.defconfig +++ b/boards/nordic/nrf52833dk/Kconfig.defconfig @@ -5,4 +5,7 @@ if BOARD_NRF52833DK +config HW_STACK_PROTECTION + default ARCH_HAS_STACK_PROTECTION + endif # BOARD_NRF52833DK diff --git a/boards/nordic/nrf52833dk/nrf52833dk_nrf52820_defconfig b/boards/nordic/nrf52833dk/nrf52833dk_nrf52820_defconfig index 14367293292d..7167aca850a0 100644 --- a/boards/nordic/nrf52833dk/nrf52833dk_nrf52820_defconfig +++ b/boards/nordic/nrf52833dk/nrf52833dk_nrf52820_defconfig @@ -3,9 +3,6 @@ # Enable MPU CONFIG_ARM_MPU=y -# Enable hardware stack protection -CONFIG_HW_STACK_PROTECTION=y - # enable GPIO CONFIG_GPIO=y diff --git a/boards/nordic/nrf52833dk/nrf52833dk_nrf52833_defconfig b/boards/nordic/nrf52833dk/nrf52833dk_nrf52833_defconfig index 14367293292d..7167aca850a0 100644 --- a/boards/nordic/nrf52833dk/nrf52833dk_nrf52833_defconfig +++ b/boards/nordic/nrf52833dk/nrf52833dk_nrf52833_defconfig @@ -3,9 +3,6 @@ # Enable MPU CONFIG_ARM_MPU=y -# Enable hardware stack protection -CONFIG_HW_STACK_PROTECTION=y - # enable GPIO CONFIG_GPIO=y diff --git a/boards/nordic/nrf52840dk/Kconfig.defconfig b/boards/nordic/nrf52840dk/Kconfig.defconfig index 478445b229bc..96aa4159c27e 100644 --- a/boards/nordic/nrf52840dk/Kconfig.defconfig +++ b/boards/nordic/nrf52840dk/Kconfig.defconfig @@ -5,4 +5,7 @@ if BOARD_NRF52840DK +config HW_STACK_PROTECTION + default ARCH_HAS_STACK_PROTECTION + endif # BOARD_NRF52840DK diff --git a/boards/nordic/nrf52840dk/nrf52840dk_nrf52811_defconfig b/boards/nordic/nrf52840dk/nrf52840dk_nrf52811_defconfig index c076e7d88975..d94d5ee46d15 100644 --- a/boards/nordic/nrf52840dk/nrf52840dk_nrf52811_defconfig +++ b/boards/nordic/nrf52840dk/nrf52840dk_nrf52811_defconfig @@ -5,9 +5,6 @@ # Enable MPU CONFIG_ARM_MPU=y -# Enable hardware stack protection -CONFIG_HW_STACK_PROTECTION=y - # Enable UART CONFIG_SERIAL=y diff --git a/boards/nordic/nrf52840dk/nrf52840dk_nrf52840_defconfig b/boards/nordic/nrf52840dk/nrf52840dk_nrf52840_defconfig index 14367293292d..7167aca850a0 100644 --- a/boards/nordic/nrf52840dk/nrf52840dk_nrf52840_defconfig +++ b/boards/nordic/nrf52840dk/nrf52840dk_nrf52840_defconfig @@ -3,9 +3,6 @@ # Enable MPU CONFIG_ARM_MPU=y -# Enable hardware stack protection -CONFIG_HW_STACK_PROTECTION=y - # enable GPIO CONFIG_GPIO=y diff --git a/boards/nordic/nrf52840dongle/Kconfig.defconfig b/boards/nordic/nrf52840dongle/Kconfig.defconfig index 5bdbb6ce63bd..931786859b2d 100644 --- a/boards/nordic/nrf52840dongle/Kconfig.defconfig +++ b/boards/nordic/nrf52840dongle/Kconfig.defconfig @@ -6,6 +6,9 @@ if BOARD_NRF52840DONGLE +config HW_STACK_PROTECTION + default ARCH_HAS_STACK_PROTECTION + # To let the nRF5 bootloader load an application, the application # must be linked after Nordic MBR, that is factory-programmed on the board. diff --git a/boards/nordic/nrf52840dongle/nrf52840dongle_nrf52840_defconfig b/boards/nordic/nrf52840dongle/nrf52840dongle_nrf52840_defconfig index ffaccd75ea8b..bb029eee81eb 100644 --- a/boards/nordic/nrf52840dongle/nrf52840dongle_nrf52840_defconfig +++ b/boards/nordic/nrf52840dongle/nrf52840dongle_nrf52840_defconfig @@ -3,9 +3,6 @@ # Enable MPU CONFIG_ARM_MPU=y -# Enable hardware stack protection -CONFIG_HW_STACK_PROTECTION=y - # enable GPIO CONFIG_GPIO=y diff --git a/boards/nordic/nrf52dk/Kconfig.defconfig b/boards/nordic/nrf52dk/Kconfig.defconfig new file mode 100644 index 000000000000..fbe5fabf7590 --- /dev/null +++ b/boards/nordic/nrf52dk/Kconfig.defconfig @@ -0,0 +1,11 @@ +# nRF52 DK board configuration + +# Copyright (c) 2025 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +if BOARD_NRF52DK + +config HW_STACK_PROTECTION + default ARCH_HAS_STACK_PROTECTION + +endif # BOARD_NRF52DK diff --git a/boards/nordic/nrf52dk/nrf52dk_nrf52805_defconfig b/boards/nordic/nrf52dk/nrf52dk_nrf52805_defconfig index a4b09719b930..4e65cf49c0cb 100644 --- a/boards/nordic/nrf52dk/nrf52dk_nrf52805_defconfig +++ b/boards/nordic/nrf52dk/nrf52dk_nrf52805_defconfig @@ -3,9 +3,6 @@ # Enable MPU CONFIG_ARM_MPU=y -# Enable hardware stack protection -CONFIG_HW_STACK_PROTECTION=y - # Enable GPIO CONFIG_GPIO=y diff --git a/boards/nordic/nrf52dk/nrf52dk_nrf52810_defconfig b/boards/nordic/nrf52dk/nrf52dk_nrf52810_defconfig index a6749163af41..e721f2360a12 100644 --- a/boards/nordic/nrf52dk/nrf52dk_nrf52810_defconfig +++ b/boards/nordic/nrf52dk/nrf52dk_nrf52810_defconfig @@ -3,9 +3,6 @@ # Enable MPU CONFIG_ARM_MPU=y -# Enable hardware stack protection -CONFIG_HW_STACK_PROTECTION=y - # enable GPIO CONFIG_GPIO=y diff --git a/boards/nordic/nrf52dk/nrf52dk_nrf52832_defconfig b/boards/nordic/nrf52dk/nrf52dk_nrf52832_defconfig index 14367293292d..7167aca850a0 100644 --- a/boards/nordic/nrf52dk/nrf52dk_nrf52832_defconfig +++ b/boards/nordic/nrf52dk/nrf52dk_nrf52832_defconfig @@ -3,9 +3,6 @@ # Enable MPU CONFIG_ARM_MPU=y -# Enable hardware stack protection -CONFIG_HW_STACK_PROTECTION=y - # enable GPIO CONFIG_GPIO=y diff --git a/boards/nordic/nrf5340_audio_dk/Kconfig.defconfig b/boards/nordic/nrf5340_audio_dk/Kconfig.defconfig index 7084af10d6bf..0ba5af149073 100644 --- a/boards/nordic/nrf5340_audio_dk/Kconfig.defconfig +++ b/boards/nordic/nrf5340_audio_dk/Kconfig.defconfig @@ -3,6 +3,9 @@ # Copyright (c) 2019 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 +config HW_STACK_PROTECTION + default ARCH_HAS_STACK_PROTECTION + if BOARD_NRF5340_AUDIO_DK_NRF5340_CPUAPP || BOARD_NRF5340_AUDIO_DK_NRF5340_CPUAPP_NS # Code Partition: diff --git a/boards/nordic/nrf5340_audio_dk/nrf5340_audio_dk_nrf5340_cpuapp_defconfig b/boards/nordic/nrf5340_audio_dk/nrf5340_audio_dk_nrf5340_cpuapp_defconfig index 516f0cf7407a..13a1136435c7 100644 --- a/boards/nordic/nrf5340_audio_dk/nrf5340_audio_dk_nrf5340_cpuapp_defconfig +++ b/boards/nordic/nrf5340_audio_dk/nrf5340_audio_dk_nrf5340_cpuapp_defconfig @@ -3,8 +3,6 @@ CONFIG_ARM_MPU=y -CONFIG_HW_STACK_PROTECTION=y - CONFIG_ARM_TRUSTZONE_M=y CONFIG_GPIO=y diff --git a/boards/nordic/nrf5340_audio_dk/nrf5340_audio_dk_nrf5340_cpuapp_ns_defconfig b/boards/nordic/nrf5340_audio_dk/nrf5340_audio_dk_nrf5340_cpuapp_ns_defconfig index 5883909a4f02..604e4311a6d9 100644 --- a/boards/nordic/nrf5340_audio_dk/nrf5340_audio_dk_nrf5340_cpuapp_ns_defconfig +++ b/boards/nordic/nrf5340_audio_dk/nrf5340_audio_dk_nrf5340_cpuapp_ns_defconfig @@ -3,8 +3,6 @@ CONFIG_ARM_MPU=y -CONFIG_HW_STACK_PROTECTION=y - CONFIG_ARM_TRUSTZONE_M=y CONFIG_TRUSTED_EXECUTION_NONSECURE=y diff --git a/boards/nordic/nrf5340_audio_dk/nrf5340_audio_dk_nrf5340_cpunet_defconfig b/boards/nordic/nrf5340_audio_dk/nrf5340_audio_dk_nrf5340_cpunet_defconfig index 56940c43a096..2225f146d9be 100644 --- a/boards/nordic/nrf5340_audio_dk/nrf5340_audio_dk_nrf5340_cpunet_defconfig +++ b/boards/nordic/nrf5340_audio_dk/nrf5340_audio_dk_nrf5340_cpunet_defconfig @@ -3,9 +3,6 @@ # Enable MPU CONFIG_ARM_MPU=y -# Enable hardware stack protection -CONFIG_HW_STACK_PROTECTION=y - # Enable GPIO CONFIG_GPIO=y diff --git a/boards/nordic/nrf5340dk/Kconfig.defconfig b/boards/nordic/nrf5340dk/Kconfig.defconfig index 6ba50229174d..497113310bfa 100644 --- a/boards/nordic/nrf5340dk/Kconfig.defconfig +++ b/boards/nordic/nrf5340dk/Kconfig.defconfig @@ -3,6 +3,9 @@ # Copyright (c) 2019-2020 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 +config HW_STACK_PROTECTION + default ARCH_HAS_STACK_PROTECTION + if BOARD_NRF5340DK_NRF5340_CPUAPP || BOARD_NRF5340DK_NRF5340_CPUAPP_NS # Code Partition: diff --git a/boards/nordic/nrf5340dk/nrf5340dk_nrf5340_cpuapp_defconfig b/boards/nordic/nrf5340dk/nrf5340dk_nrf5340_cpuapp_defconfig index db40370dad01..5b38cedf4b55 100644 --- a/boards/nordic/nrf5340dk/nrf5340dk_nrf5340_cpuapp_defconfig +++ b/boards/nordic/nrf5340dk/nrf5340dk_nrf5340_cpuapp_defconfig @@ -3,9 +3,6 @@ # Enable MPU CONFIG_ARM_MPU=y -# Enable hardware stack protection -CONFIG_HW_STACK_PROTECTION=y - # Enable TrustZone-M CONFIG_ARM_TRUSTZONE_M=y diff --git a/boards/nordic/nrf5340dk/nrf5340dk_nrf5340_cpuapp_ns_defconfig b/boards/nordic/nrf5340dk/nrf5340dk_nrf5340_cpuapp_ns_defconfig index 1886b926bfd5..1da4e29c8914 100644 --- a/boards/nordic/nrf5340dk/nrf5340dk_nrf5340_cpuapp_ns_defconfig +++ b/boards/nordic/nrf5340dk/nrf5340dk_nrf5340_cpuapp_ns_defconfig @@ -3,9 +3,6 @@ # Enable MPU CONFIG_ARM_MPU=y -# Enable hardware stack protection -CONFIG_HW_STACK_PROTECTION=y - # Enable TrustZone-M CONFIG_ARM_TRUSTZONE_M=y diff --git a/boards/nordic/nrf5340dk/nrf5340dk_nrf5340_cpunet_defconfig b/boards/nordic/nrf5340dk/nrf5340dk_nrf5340_cpunet_defconfig index 394287267539..fd8622d4e368 100644 --- a/boards/nordic/nrf5340dk/nrf5340dk_nrf5340_cpunet_defconfig +++ b/boards/nordic/nrf5340dk/nrf5340dk_nrf5340_cpunet_defconfig @@ -3,9 +3,6 @@ # Enable MPU CONFIG_ARM_MPU=y -# Enable hardware stack protection -CONFIG_HW_STACK_PROTECTION=y - # enable GPIO CONFIG_GPIO=y diff --git a/boards/nordic/nrf54h20dk/Kconfig.defconfig b/boards/nordic/nrf54h20dk/Kconfig.defconfig index 4023f3b02320..3a6ba6b6d263 100644 --- a/boards/nordic/nrf54h20dk/Kconfig.defconfig +++ b/boards/nordic/nrf54h20dk/Kconfig.defconfig @@ -1,6 +1,9 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 +config HW_STACK_PROTECTION + default ARCH_HAS_STACK_PROTECTION + if BOARD_NRF54H20DK_NRF54H20_CPUAPP config BT_HCI_IPC diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_defconfig b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_defconfig index e1ba596d1358..d3ce90b8a380 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_defconfig +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_defconfig @@ -13,9 +13,6 @@ CONFIG_USE_DT_CODE_PARTITION=y # Enable MPU CONFIG_ARM_MPU=y -# Enable hardware stack protection -CONFIG_HW_STACK_PROTECTION=y - # MPU-based null-pointer dereferencing detection cannot be applied # as the (0x0 - 0x400) region is unmapped for this target. CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_iron_defconfig b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_iron_defconfig index 01f3bec39321..bf3b6ac01e47 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_iron_defconfig +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_iron_defconfig @@ -11,9 +11,6 @@ CONFIG_UART_CONSOLE=y # Enable MPU CONFIG_ARM_MPU=y -# Enable hardware stack protection -CONFIG_HW_STACK_PROTECTION=y - # MPU-based null-pointer dereferencing detection cannot be applied # as the (0x0 - 0x400) region is unmapped for this target. CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_defconfig b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_defconfig index 27df01dee128..87bdd63ea7df 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_defconfig +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_defconfig @@ -13,9 +13,6 @@ CONFIG_USE_DT_CODE_PARTITION=y # Enable MPU CONFIG_ARM_MPU=y -# Enable hardware stack protection -CONFIG_HW_STACK_PROTECTION=y - # MPU-based null-pointer dereferencing detection cannot be applied # as the (0x0 - 0x400) region is unmapped for this target. CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_iron_defconfig b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_iron_defconfig index 0ee0a96f99d7..4d247d805269 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_iron_defconfig +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_iron_defconfig @@ -13,9 +13,6 @@ CONFIG_USE_DT_CODE_PARTITION=y # Enable MPU CONFIG_ARM_MPU=y -# Enable hardware stack protection -CONFIG_HW_STACK_PROTECTION=y - # MPU-based null-pointer dereferencing detection cannot be applied # as the (0x0 - 0x400) region is unmapped for this target. CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y diff --git a/boards/nordic/nrf54l09pdk/Kconfig.defconfig b/boards/nordic/nrf54l09pdk/Kconfig.defconfig index f6c1efe188bf..22c20a6a52e7 100644 --- a/boards/nordic/nrf54l09pdk/Kconfig.defconfig +++ b/boards/nordic/nrf54l09pdk/Kconfig.defconfig @@ -3,6 +3,9 @@ if BOARD_NRF54L09PDK_NRF54L09_CPUAPP +config HW_STACK_PROTECTION + default ARCH_HAS_STACK_PROTECTION + config ROM_START_OFFSET default 0x800 if BOOTLOADER_MCUBOOT diff --git a/boards/nordic/nrf54l09pdk/nrf54l09pdk_nrf54l09_cpuapp_defconfig b/boards/nordic/nrf54l09pdk/nrf54l09pdk_nrf54l09_cpuapp_defconfig index 80996ce11ade..33481a8f2302 100644 --- a/boards/nordic/nrf54l09pdk/nrf54l09pdk_nrf54l09_cpuapp_defconfig +++ b/boards/nordic/nrf54l09pdk/nrf54l09pdk_nrf54l09_cpuapp_defconfig @@ -13,6 +13,3 @@ CONFIG_GPIO=y # Enable MPU CONFIG_ARM_MPU=y - -# Enable hardware stack protection -CONFIG_HW_STACK_PROTECTION=y diff --git a/boards/nordic/nrf54l15dk/Kconfig.defconfig b/boards/nordic/nrf54l15dk/Kconfig.defconfig index 04c1d9ddc234..0661366e911d 100644 --- a/boards/nordic/nrf54l15dk/Kconfig.defconfig +++ b/boards/nordic/nrf54l15dk/Kconfig.defconfig @@ -1,6 +1,9 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 +config HW_STACK_PROTECTION + default ARCH_HAS_STACK_PROTECTION + if BOARD_NRF54L15DK_NRF54L05_CPUAPP || BOARD_NRF54L15DK_NRF54L10_CPUAPP || \ BOARD_NRF54L15DK_NRF54L15_CPUAPP diff --git a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l05_cpuapp_defconfig b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l05_cpuapp_defconfig index 80996ce11ade..33481a8f2302 100644 --- a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l05_cpuapp_defconfig +++ b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l05_cpuapp_defconfig @@ -13,6 +13,3 @@ CONFIG_GPIO=y # Enable MPU CONFIG_ARM_MPU=y - -# Enable hardware stack protection -CONFIG_HW_STACK_PROTECTION=y diff --git a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_defconfig b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_defconfig index 80996ce11ade..33481a8f2302 100644 --- a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_defconfig +++ b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_defconfig @@ -13,6 +13,3 @@ CONFIG_GPIO=y # Enable MPU CONFIG_ARM_MPU=y - -# Enable hardware stack protection -CONFIG_HW_STACK_PROTECTION=y diff --git a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns_defconfig b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns_defconfig index 1d759be671ca..d9f869918bfe 100644 --- a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns_defconfig +++ b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns_defconfig @@ -2,7 +2,6 @@ # SPDX-License-Identifier: Apache-2.0 CONFIG_ARM_MPU=y -CONFIG_HW_STACK_PROTECTION=y CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y CONFIG_ARM_TRUSTZONE_M=y diff --git a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp_defconfig b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp_defconfig index 80996ce11ade..33481a8f2302 100644 --- a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp_defconfig +++ b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp_defconfig @@ -13,6 +13,3 @@ CONFIG_GPIO=y # Enable MPU CONFIG_ARM_MPU=y - -# Enable hardware stack protection -CONFIG_HW_STACK_PROTECTION=y diff --git a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp_ns_defconfig b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp_ns_defconfig index 1d759be671ca..d9f869918bfe 100644 --- a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp_ns_defconfig +++ b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp_ns_defconfig @@ -2,7 +2,6 @@ # SPDX-License-Identifier: Apache-2.0 CONFIG_ARM_MPU=y -CONFIG_HW_STACK_PROTECTION=y CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y CONFIG_ARM_TRUSTZONE_M=y diff --git a/boards/nordic/nrf54l20pdk/Kconfig.defconfig b/boards/nordic/nrf54l20pdk/Kconfig.defconfig index 406a65c88269..4eac6259089d 100644 --- a/boards/nordic/nrf54l20pdk/Kconfig.defconfig +++ b/boards/nordic/nrf54l20pdk/Kconfig.defconfig @@ -3,6 +3,9 @@ if BOARD_NRF54L20PDK_NRF54L20_CPUAPP +config HW_STACK_PROTECTION + default ARCH_HAS_STACK_PROTECTION + config ROM_START_OFFSET default 0x800 if BOOTLOADER_MCUBOOT diff --git a/boards/nordic/nrf54l20pdk/nrf54l20pdk_nrf54l20_cpuapp_defconfig b/boards/nordic/nrf54l20pdk/nrf54l20pdk_nrf54l20_cpuapp_defconfig index 80996ce11ade..33481a8f2302 100644 --- a/boards/nordic/nrf54l20pdk/nrf54l20pdk_nrf54l20_cpuapp_defconfig +++ b/boards/nordic/nrf54l20pdk/nrf54l20pdk_nrf54l20_cpuapp_defconfig @@ -13,6 +13,3 @@ CONFIG_GPIO=y # Enable MPU CONFIG_ARM_MPU=y - -# Enable hardware stack protection -CONFIG_HW_STACK_PROTECTION=y diff --git a/boards/nordic/nrf7002dk/Kconfig.defconfig b/boards/nordic/nrf7002dk/Kconfig.defconfig new file mode 100644 index 000000000000..48510d6e24f8 --- /dev/null +++ b/boards/nordic/nrf7002dk/Kconfig.defconfig @@ -0,0 +1,11 @@ +# nRF7002 DK board configuration + +# Copyright (c) 2025 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +if BOARD_NRF7002DK + +config HW_STACK_PROTECTION + default ARCH_HAS_STACK_PROTECTION + +endif # BOARD_NRF7002DK diff --git a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_defconfig b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_defconfig index 49f3e03e2632..a3e0cd632513 100644 --- a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_defconfig +++ b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_defconfig @@ -3,9 +3,6 @@ # Enable MPU CONFIG_ARM_MPU=y -# Enable hardware stack protection -CONFIG_HW_STACK_PROTECTION=y - # Enable TrustZone-M CONFIG_ARM_TRUSTZONE_M=y diff --git a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_defconfig b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_defconfig index 33a414dc3805..e9003b078914 100644 --- a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_defconfig +++ b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_defconfig @@ -4,9 +4,6 @@ # Enable MPU CONFIG_ARM_MPU=y -# Enable hardware stack protection -CONFIG_HW_STACK_PROTECTION=y - # Enable TrustZone-M CONFIG_ARM_TRUSTZONE_M=y diff --git a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpunet_defconfig b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpunet_defconfig index 56940c43a096..2225f146d9be 100644 --- a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpunet_defconfig +++ b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpunet_defconfig @@ -3,9 +3,6 @@ # Enable MPU CONFIG_ARM_MPU=y -# Enable hardware stack protection -CONFIG_HW_STACK_PROTECTION=y - # Enable GPIO CONFIG_GPIO=y diff --git a/boards/nordic/nrf9131ek/Kconfig.defconfig b/boards/nordic/nrf9131ek/Kconfig.defconfig index 3e422198078b..e1d8de241c0a 100644 --- a/boards/nordic/nrf9131ek/Kconfig.defconfig +++ b/boards/nordic/nrf9131ek/Kconfig.defconfig @@ -3,5 +3,8 @@ # Copyright (c) 2023 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 +config HW_STACK_PROTECTION + default ARCH_HAS_STACK_PROTECTION + config BOARD_NRF9131EK select USE_DT_CODE_PARTITION if BOARD_NRF9131EK_NRF9131_NS diff --git a/boards/nordic/nrf9131ek/nrf9131ek_nrf9131_defconfig b/boards/nordic/nrf9131ek/nrf9131ek_nrf9131_defconfig index c486d8323821..dc9001bd6108 100644 --- a/boards/nordic/nrf9131ek/nrf9131ek_nrf9131_defconfig +++ b/boards/nordic/nrf9131ek/nrf9131ek_nrf9131_defconfig @@ -3,9 +3,6 @@ # Enable MPU CONFIG_ARM_MPU=y -# Enable hardware stack protection -CONFIG_HW_STACK_PROTECTION=y - # Enable TrustZone-M CONFIG_ARM_TRUSTZONE_M=y diff --git a/boards/nordic/nrf9131ek/nrf9131ek_nrf9131_ns_defconfig b/boards/nordic/nrf9131ek/nrf9131ek_nrf9131_ns_defconfig index d15d371416bc..0699ae4a7857 100644 --- a/boards/nordic/nrf9131ek/nrf9131ek_nrf9131_ns_defconfig +++ b/boards/nordic/nrf9131ek/nrf9131ek_nrf9131_ns_defconfig @@ -3,9 +3,6 @@ # Enable MPU CONFIG_ARM_MPU=y -# Enable hardware stack protection -CONFIG_HW_STACK_PROTECTION=y - # Enable TrustZone-M CONFIG_ARM_TRUSTZONE_M=y diff --git a/boards/nordic/nrf9151dk/Kconfig.defconfig b/boards/nordic/nrf9151dk/Kconfig.defconfig index cfdc9c5f87e6..308f6f7441e5 100644 --- a/boards/nordic/nrf9151dk/Kconfig.defconfig +++ b/boards/nordic/nrf9151dk/Kconfig.defconfig @@ -2,6 +2,9 @@ # Copyright (c) 2023 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 +# +config HW_STACK_PROTECTION + default ARCH_HAS_STACK_PROTECTION if BOARD_NRF9151DK_NRF9151 || BOARD_NRF9151DK_NRF9151_NS diff --git a/boards/nordic/nrf9151dk/nrf9151dk_nrf9151_defconfig b/boards/nordic/nrf9151dk/nrf9151dk_nrf9151_defconfig index c486d8323821..dc9001bd6108 100644 --- a/boards/nordic/nrf9151dk/nrf9151dk_nrf9151_defconfig +++ b/boards/nordic/nrf9151dk/nrf9151dk_nrf9151_defconfig @@ -3,9 +3,6 @@ # Enable MPU CONFIG_ARM_MPU=y -# Enable hardware stack protection -CONFIG_HW_STACK_PROTECTION=y - # Enable TrustZone-M CONFIG_ARM_TRUSTZONE_M=y diff --git a/boards/nordic/nrf9151dk/nrf9151dk_nrf9151_ns_defconfig b/boards/nordic/nrf9151dk/nrf9151dk_nrf9151_ns_defconfig index 2a74dd56f414..244b153235f5 100644 --- a/boards/nordic/nrf9151dk/nrf9151dk_nrf9151_ns_defconfig +++ b/boards/nordic/nrf9151dk/nrf9151dk_nrf9151_ns_defconfig @@ -3,9 +3,6 @@ # Enable MPU CONFIG_ARM_MPU=y -# Enable hardware stack protection -CONFIG_HW_STACK_PROTECTION=y - # Enable TrustZone-M CONFIG_ARM_TRUSTZONE_M=y diff --git a/boards/nordic/nrf9160dk/Kconfig.defconfig b/boards/nordic/nrf9160dk/Kconfig.defconfig index b92acdd3f106..f27b36a40d16 100644 --- a/boards/nordic/nrf9160dk/Kconfig.defconfig +++ b/boards/nordic/nrf9160dk/Kconfig.defconfig @@ -3,6 +3,9 @@ # Copyright (c) 2018-2020 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 +config HW_STACK_PROTECTION + default ARCH_HAS_STACK_PROTECTION + if BOARD_NRF9160DK_NRF9160 || BOARD_NRF9160DK_NRF9160_NS config BOARD_NRF9160DK diff --git a/boards/nordic/nrf9160dk/nrf9160dk_nrf52840_defconfig b/boards/nordic/nrf9160dk/nrf9160dk_nrf52840_defconfig index cfe82dd26781..1863ff54588a 100644 --- a/boards/nordic/nrf9160dk/nrf9160dk_nrf52840_defconfig +++ b/boards/nordic/nrf9160dk/nrf9160dk_nrf52840_defconfig @@ -3,9 +3,6 @@ # Enable MPU CONFIG_ARM_MPU=y -# Enable hardware stack protection -CONFIG_HW_STACK_PROTECTION=y - # Enable UART driver CONFIG_SERIAL=y diff --git a/boards/nordic/nrf9160dk/nrf9160dk_nrf9160_defconfig b/boards/nordic/nrf9160dk/nrf9160dk_nrf9160_defconfig index c486d8323821..dc9001bd6108 100644 --- a/boards/nordic/nrf9160dk/nrf9160dk_nrf9160_defconfig +++ b/boards/nordic/nrf9160dk/nrf9160dk_nrf9160_defconfig @@ -3,9 +3,6 @@ # Enable MPU CONFIG_ARM_MPU=y -# Enable hardware stack protection -CONFIG_HW_STACK_PROTECTION=y - # Enable TrustZone-M CONFIG_ARM_TRUSTZONE_M=y diff --git a/boards/nordic/nrf9160dk/nrf9160dk_nrf9160_ns_defconfig b/boards/nordic/nrf9160dk/nrf9160dk_nrf9160_ns_defconfig index 624f98b1da39..786906c85fca 100644 --- a/boards/nordic/nrf9160dk/nrf9160dk_nrf9160_ns_defconfig +++ b/boards/nordic/nrf9160dk/nrf9160dk_nrf9160_ns_defconfig @@ -3,9 +3,6 @@ # Enable MPU CONFIG_ARM_MPU=y -# Enable hardware stack protection -CONFIG_HW_STACK_PROTECTION=y - # Enable TrustZone-M CONFIG_ARM_TRUSTZONE_M=y diff --git a/boards/nordic/nrf9161dk/Kconfig.defconfig b/boards/nordic/nrf9161dk/Kconfig.defconfig index 28490a3c65d9..52e4067ecfa7 100644 --- a/boards/nordic/nrf9161dk/Kconfig.defconfig +++ b/boards/nordic/nrf9161dk/Kconfig.defconfig @@ -3,6 +3,9 @@ # Copyright (c) 2023 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 +config HW_STACK_PROTECTION + default ARCH_HAS_STACK_PROTECTION + if BOARD_NRF9161DK_NRF9161 || BOARD_NRF9161DK_NRF9161_NS config BOARD_NRF9161DK diff --git a/boards/nordic/nrf9161dk/nrf9161dk_nrf9161_defconfig b/boards/nordic/nrf9161dk/nrf9161dk_nrf9161_defconfig index c486d8323821..dc9001bd6108 100644 --- a/boards/nordic/nrf9161dk/nrf9161dk_nrf9161_defconfig +++ b/boards/nordic/nrf9161dk/nrf9161dk_nrf9161_defconfig @@ -3,9 +3,6 @@ # Enable MPU CONFIG_ARM_MPU=y -# Enable hardware stack protection -CONFIG_HW_STACK_PROTECTION=y - # Enable TrustZone-M CONFIG_ARM_TRUSTZONE_M=y diff --git a/boards/nordic/nrf9161dk/nrf9161dk_nrf9161_ns_defconfig b/boards/nordic/nrf9161dk/nrf9161dk_nrf9161_ns_defconfig index 2a74dd56f414..244b153235f5 100644 --- a/boards/nordic/nrf9161dk/nrf9161dk_nrf9161_ns_defconfig +++ b/boards/nordic/nrf9161dk/nrf9161dk_nrf9161_ns_defconfig @@ -3,9 +3,6 @@ # Enable MPU CONFIG_ARM_MPU=y -# Enable hardware stack protection -CONFIG_HW_STACK_PROTECTION=y - # Enable TrustZone-M CONFIG_ARM_TRUSTZONE_M=y diff --git a/boards/nordic/nrf9280pdk/Kconfig.defconfig b/boards/nordic/nrf9280pdk/Kconfig.defconfig index ae7cb48cbc3b..24669fc7f1e6 100644 --- a/boards/nordic/nrf9280pdk/Kconfig.defconfig +++ b/boards/nordic/nrf9280pdk/Kconfig.defconfig @@ -1,6 +1,9 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 +config HW_STACK_PROTECTION + default ARCH_HAS_STACK_PROTECTION + if BOARD_NRF9280PDK_NRF9280_CPUAPP config BT_HCI_IPC diff --git a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp_defconfig b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp_defconfig index e1ba596d1358..d3ce90b8a380 100644 --- a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp_defconfig +++ b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp_defconfig @@ -13,9 +13,6 @@ CONFIG_USE_DT_CODE_PARTITION=y # Enable MPU CONFIG_ARM_MPU=y -# Enable hardware stack protection -CONFIG_HW_STACK_PROTECTION=y - # MPU-based null-pointer dereferencing detection cannot be applied # as the (0x0 - 0x400) region is unmapped for this target. CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y diff --git a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpurad_defconfig b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpurad_defconfig index 27df01dee128..87bdd63ea7df 100644 --- a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpurad_defconfig +++ b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpurad_defconfig @@ -13,9 +13,6 @@ CONFIG_USE_DT_CODE_PARTITION=y # Enable MPU CONFIG_ARM_MPU=y -# Enable hardware stack protection -CONFIG_HW_STACK_PROTECTION=y - # MPU-based null-pointer dereferencing detection cannot be applied # as the (0x0 - 0x400) region is unmapped for this target. CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y diff --git a/boards/nordic/thingy52/Kconfig.defconfig b/boards/nordic/thingy52/Kconfig.defconfig index 9e50838b5c2e..f9902cf481d3 100644 --- a/boards/nordic/thingy52/Kconfig.defconfig +++ b/boards/nordic/thingy52/Kconfig.defconfig @@ -5,4 +5,7 @@ if BOARD_THINGY52 +config HW_STACK_PROTECTION + default ARCH_HAS_STACK_PROTECTION + endif # BOARD_THINGY52 diff --git a/boards/nordic/thingy52/thingy52_nrf52832_defconfig b/boards/nordic/thingy52/thingy52_nrf52832_defconfig index 401a71ab47a5..d142c1ed38e2 100644 --- a/boards/nordic/thingy52/thingy52_nrf52832_defconfig +++ b/boards/nordic/thingy52/thingy52_nrf52832_defconfig @@ -7,9 +7,6 @@ CONFIG_REGULATOR=y # Enable MPU CONFIG_ARM_MPU=y -# Enable hardware stack protection -CONFIG_HW_STACK_PROTECTION=y - # Enable RTT CONFIG_USE_SEGGER_RTT=y diff --git a/boards/nordic/thingy53/Kconfig.defconfig b/boards/nordic/thingy53/Kconfig.defconfig index d149d360f859..c1139f0dca10 100644 --- a/boards/nordic/thingy53/Kconfig.defconfig +++ b/boards/nordic/thingy53/Kconfig.defconfig @@ -3,6 +3,9 @@ # Copyright (c) 2021 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 +config HW_STACK_PROTECTION + default ARCH_HAS_STACK_PROTECTION + if BOARD_THINGY53_NRF5340_CPUAPP || BOARD_THINGY53_NRF5340_CPUAPP_NS # Code Partition: diff --git a/boards/nordic/thingy53/thingy53_nrf5340_cpuapp_defconfig b/boards/nordic/thingy53/thingy53_nrf5340_cpuapp_defconfig index de1c1fd59643..7aac6819966d 100644 --- a/boards/nordic/thingy53/thingy53_nrf5340_cpuapp_defconfig +++ b/boards/nordic/thingy53/thingy53_nrf5340_cpuapp_defconfig @@ -3,9 +3,6 @@ # Enable MPU CONFIG_ARM_MPU=y -# Enable hardware stack protection -CONFIG_HW_STACK_PROTECTION=y - # Enable TrustZone-M CONFIG_ARM_TRUSTZONE_M=y diff --git a/boards/nordic/thingy53/thingy53_nrf5340_cpuapp_ns_defconfig b/boards/nordic/thingy53/thingy53_nrf5340_cpuapp_ns_defconfig index 39dc91517e07..f831ec5148ed 100644 --- a/boards/nordic/thingy53/thingy53_nrf5340_cpuapp_ns_defconfig +++ b/boards/nordic/thingy53/thingy53_nrf5340_cpuapp_ns_defconfig @@ -3,9 +3,6 @@ # Enable MPU CONFIG_ARM_MPU=y -# Enable hardware stack protection -CONFIG_HW_STACK_PROTECTION=y - # Enable TrustZone-M CONFIG_ARM_TRUSTZONE_M=y diff --git a/boards/nordic/thingy53/thingy53_nrf5340_cpunet_defconfig b/boards/nordic/thingy53/thingy53_nrf5340_cpunet_defconfig index c115d16a9d05..341b44317281 100644 --- a/boards/nordic/thingy53/thingy53_nrf5340_cpunet_defconfig +++ b/boards/nordic/thingy53/thingy53_nrf5340_cpunet_defconfig @@ -3,8 +3,5 @@ # Enable MPU CONFIG_ARM_MPU=y -# Enable hardware stack protection -CONFIG_HW_STACK_PROTECTION=y - # Enable GPIO CONFIG_GPIO=y From 66adbc0343e431f68c12690588692bb3016238f8 Mon Sep 17 00:00:00 2001 From: Tomasz Chyrowicz Date: Mon, 23 Jun 2025 14:02:58 +0200 Subject: [PATCH 0430/2141] [nrf fromtree] soc: Boot matching radio slot If the application uses slot 1 (i.e. in Direct XIP mode), boot radio slot 1 instead of slot 0. Signed-off-by: Tomasz Chyrowicz (cherry picked from commit 9dd514cadee105e8d3a95a831727c510b34af1c0) --- soc/nordic/nrf54h/soc.c | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/soc/nordic/nrf54h/soc.c b/soc/nordic/nrf54h/soc.c index 0c43c6175720..cdff23103555 100644 --- a/soc/nordic/nrf54h/soc.c +++ b/soc/nordic/nrf54h/soc.c @@ -32,6 +32,15 @@ LOG_MODULE_REGISTER(soc, CONFIG_SOC_LOG_LEVEL); #define HSFLL_NODE DT_NODELABEL(cpurad_hsfll) #endif +#ifdef CONFIG_USE_DT_CODE_PARTITION +#define FLASH_LOAD_OFFSET DT_REG_ADDR(DT_CHOSEN(zephyr_code_partition)) +#elif defined(CONFIG_FLASH_LOAD_OFFSET) +#define FLASH_LOAD_OFFSET CONFIG_FLASH_LOAD_OFFSET +#endif + +#define PARTITION_IS_RUNNING_APP_PARTITION(label) \ + (DT_REG_ADDR(DT_NODELABEL(label)) == FLASH_LOAD_OFFSET) + sys_snode_t soc_node; #define FICR_ADDR_GET(node_id, name) \ @@ -44,8 +53,6 @@ sys_snode_t soc_node; ADDRESS_DOMAIN_Msk | \ ADDRESS_BUS_Msk))) -#define DT_NODELABEL_CPURAD_SLOT0_PARTITION DT_NODELABEL(cpurad_slot0_partition) - static void power_domain_init(void) { /* @@ -172,11 +179,26 @@ void soc_late_init_hook(void) */ uint8_t *msg = NULL; size_t msg_size = 0; - - void *radiocore_address = - (void *)(DT_REG_ADDR(DT_GPARENT(DT_NODELABEL_CPURAD_SLOT0_PARTITION)) + - DT_REG_ADDR(DT_NODELABEL_CPURAD_SLOT0_PARTITION) + + void *radiocore_address = NULL; + +#if DT_NODE_EXISTS(DT_NODELABEL(cpurad_slot1_partition)) + if (PARTITION_IS_RUNNING_APP_PARTITION(slot1_partition)) { + radiocore_address = + (void *)(DT_REG_ADDR(DT_GPARENT(DT_NODELABEL(cpurad_slot1_partition))) + + DT_REG_ADDR(DT_NODELABEL(cpurad_slot1_partition)) + + CONFIG_ROM_START_OFFSET); + } else { + radiocore_address = + (void *)(DT_REG_ADDR(DT_GPARENT(DT_NODELABEL(cpurad_slot0_partition))) + + DT_REG_ADDR(DT_NODELABEL(cpurad_slot0_partition)) + + CONFIG_ROM_START_OFFSET); + } +#else + radiocore_address = + (void *)(DT_REG_ADDR(DT_GPARENT(DT_NODELABEL(cpurad_slot0_partition))) + + DT_REG_ADDR(DT_NODELABEL(cpurad_slot0_partition)) + CONFIG_ROM_START_OFFSET); +#endif /* Don't wait as this is not yet supported. */ bool cpu_wait = false; From bff309cc23e793fdb8efc94eceedf1983c29a7e2 Mon Sep 17 00:00:00 2001 From: Jonathan Nilsen Date: Wed, 18 Jun 2025 12:26:36 +0200 Subject: [PATCH 0431/2141] [nrf fromtree] samples: drivers: mbox: switch nrf54h20 cpuapp and cpurad remotes Switch which board is the remote in the test case for mbox communication between nrf54h20dk/nrf54h20/cpuapp and nrf54h20dk/nrf54h20/cpurad, making cpurad the remote instead. This is done to prepare the sample for executing with IronSide SE, where using cpurad as the main board doesn't make as much sense, since cpuapp has to start cpurad. Signed-off-by: Jonathan Nilsen (cherry picked from commit d6673e1acd3ecae99a188775caafe0b4d06f02a0) --- samples/drivers/mbox/CMakeLists.txt | 1 - samples/drivers/mbox/Kconfig.sysbuild | 1 - .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 0 samples/drivers/mbox/remote/CMakeLists.txt | 2 +- .../boards/nrf54h20dk_nrf54h20_cpurad.overlay | 0 samples/drivers/mbox/sample.yaml | 12 +++++++----- .../mbox/sysbuild/nrf54h20dk_nrf54h20_cpurad.conf | 1 + 7 files changed, 9 insertions(+), 8 deletions(-) rename samples/drivers/mbox/{remote => }/boards/nrf54h20dk_nrf54h20_cpuapp.overlay (100%) rename samples/drivers/mbox/{ => remote}/boards/nrf54h20dk_nrf54h20_cpurad.overlay (100%) create mode 100644 samples/drivers/mbox/sysbuild/nrf54h20dk_nrf54h20_cpurad.conf diff --git a/samples/drivers/mbox/CMakeLists.txt b/samples/drivers/mbox/CMakeLists.txt index d6bada1a50ed..e5d5e612c79d 100644 --- a/samples/drivers/mbox/CMakeLists.txt +++ b/samples/drivers/mbox/CMakeLists.txt @@ -24,7 +24,6 @@ if(CONFIG_BOARD_NRF5340DK_NRF5340_CPUAPP OR CONFIG_BOARD_ESP32_DEVKITC_ESP32_PROCPU OR CONFIG_BOARD_ESP32S3_DEVKITM_ESP32S3_PROCPU OR CONFIG_BOARD_NRF54H20DK_NRF54H20_CPUAPP OR - CONFIG_BOARD_NRF54H20DK_NRF54H20_CPURAD OR CONFIG_BOARD_NRF54L09PDK_NRF54L09_CPUAPP OR CONFIG_BOARD_NRF54L15DK_NRF54L15_CPUAPP OR CONFIG_BOARD_NRF54LM20DK_NRF54LM20A_CPUAPP OR diff --git a/samples/drivers/mbox/Kconfig.sysbuild b/samples/drivers/mbox/Kconfig.sysbuild index 76d3d240abce..2a79840f389b 100644 --- a/samples/drivers/mbox/Kconfig.sysbuild +++ b/samples/drivers/mbox/Kconfig.sysbuild @@ -18,7 +18,6 @@ config REMOTE_BOARD default "lpcxpresso55s69/lpc55s69/cpu1" if $(BOARD) = "lpcxpresso55s69" default "frdm_mcxn947/mcxn947/cpu1" if $(BOARD) = "frdm_mcxn947" default "mcx_n9xx_evk/mcxn947/cpu1" if $(BOARD) = "mcx_n9xx_evk" - default "nrf54h20dk/nrf54h20/cpuapp" if "$(BOARD)${BOARD_QUALIFIERS}" = "nrf54h20dk/nrf54h20/cpurad" default "nrf54l09pdk/nrf54l09/cpuflpr" if $(BOARD) = "nrf54l09pdk" default "nrf54l15dk/nrf54l15/cpuflpr" if $(BOARD) = "nrf54l15dk" default "nrf54lm20dk/nrf54lm20a/cpuflpr" if $(BOARD) = "nrf54lm20dk" diff --git a/samples/drivers/mbox/remote/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/samples/drivers/mbox/boards/nrf54h20dk_nrf54h20_cpuapp.overlay similarity index 100% rename from samples/drivers/mbox/remote/boards/nrf54h20dk_nrf54h20_cpuapp.overlay rename to samples/drivers/mbox/boards/nrf54h20dk_nrf54h20_cpuapp.overlay diff --git a/samples/drivers/mbox/remote/CMakeLists.txt b/samples/drivers/mbox/remote/CMakeLists.txt index c84efec11977..bd4c9e2e20e5 100644 --- a/samples/drivers/mbox/remote/CMakeLists.txt +++ b/samples/drivers/mbox/remote/CMakeLists.txt @@ -23,7 +23,7 @@ if(CONFIG_BOARD_NRF5340DK_NRF5340_CPUNET OR CONFIG_BOARD_ESP32S3_DEVKITM_ESP32S3_APPCPU OR CONFIG_BOARD_NRF54H20DK_NRF54H20_CPUPPR OR CONFIG_BOARD_NRF54H20DK_NRF54H20_CPUFLPR OR - CONFIG_BOARD_NRF54H20DK_NRF54H20_CPUAPP OR + CONFIG_BOARD_NRF54H20DK_NRF54H20_CPURAD OR CONFIG_BOARD_NRF54L09PDK_NRF54L09_CPUFLPR OR CONFIG_BOARD_NRF54L15DK_NRF54L15_CPUFLPR OR CONFIG_BOARD_NRF54LM20DK_NRF54LM20A_CPUFLPR OR diff --git a/samples/drivers/mbox/boards/nrf54h20dk_nrf54h20_cpurad.overlay b/samples/drivers/mbox/remote/boards/nrf54h20dk_nrf54h20_cpurad.overlay similarity index 100% rename from samples/drivers/mbox/boards/nrf54h20dk_nrf54h20_cpurad.overlay rename to samples/drivers/mbox/remote/boards/nrf54h20dk_nrf54h20_cpurad.overlay diff --git a/samples/drivers/mbox/sample.yaml b/samples/drivers/mbox/sample.yaml index 809d5e091dc4..8a25dc0b3bf7 100644 --- a/samples/drivers/mbox/sample.yaml +++ b/samples/drivers/mbox/sample.yaml @@ -59,19 +59,21 @@ tests: - "Ping \\(on channel 16\\)" - "Pong \\(on channel 14\\)" - sample.drivers.mbox.nrf54h20_rad_app: + sample.drivers.mbox.nrf54h20_app_rad: platform_allow: - - nrf54h20dk/nrf54h20/cpurad + - nrf54h20dk/nrf54h20/cpuapp integration_platforms: - - nrf54h20dk/nrf54h20/cpurad + - nrf54h20dk/nrf54h20/cpuapp + extra_args: + - SB_CONF_FILE=sysbuild/nrf54h20dk_nrf54h20_cpurad.conf sysbuild: true harness: console harness_config: type: multi_line ordered: false regex: - - "Ping \\(on channel 18\\)" - - "Pong \\(on channel 12\\)" + - "Ping \\(on channel 12\\)" + - "Pong \\(on channel 18\\)" sample.drivers.mbox.nrf54l: platform_allow: diff --git a/samples/drivers/mbox/sysbuild/nrf54h20dk_nrf54h20_cpurad.conf b/samples/drivers/mbox/sysbuild/nrf54h20dk_nrf54h20_cpurad.conf new file mode 100644 index 000000000000..dd863e78d993 --- /dev/null +++ b/samples/drivers/mbox/sysbuild/nrf54h20dk_nrf54h20_cpurad.conf @@ -0,0 +1 @@ +SB_CONFIG_REMOTE_BOARD="nrf54h20dk/nrf54h20/cpurad" From dd86ab537cee1ac7917810a8c48a51aaf29a69f0 Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Tue, 24 Jun 2025 06:12:36 +0200 Subject: [PATCH 0432/2141] [nrf fromtree] tests: boards: nrf: nrfs: Build main image for app core only Update this multi-core test to always run the `main` and `remote` images on cpuapp and cpurad respectively. This is to prepare the test for running with IronSide SE, in which case keeping cpurad as the main board target wouldn't make as much sense, because cpurad would have to be started by cpuapp. Signed-off-by: Grzegorz Swiderski (cherry picked from commit 559ace1cdf54bb033d3e1de6b9e9bbcd0cd902b6) --- tests/boards/nrf/nrfs/Kconfig.sysbuild | 1 - tests/boards/nrf/nrfs/testcase.yaml | 2 -- 2 files changed, 3 deletions(-) diff --git a/tests/boards/nrf/nrfs/Kconfig.sysbuild b/tests/boards/nrf/nrfs/Kconfig.sysbuild index f281257725fc..6cc7dc9575af 100644 --- a/tests/boards/nrf/nrfs/Kconfig.sysbuild +++ b/tests/boards/nrf/nrfs/Kconfig.sysbuild @@ -6,4 +6,3 @@ source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" config REMOTE_BOARD string default "$(BOARD)/nrf54h20/cpurad" if SOC_NRF54H20_CPUAPP - default "$(BOARD)/nrf54h20/cpuapp" if SOC_NRF54H20_CPURAD diff --git a/tests/boards/nrf/nrfs/testcase.yaml b/tests/boards/nrf/nrfs/testcase.yaml index 315c3cf7f375..d1974f00d7c0 100644 --- a/tests/boards/nrf/nrfs/testcase.yaml +++ b/tests/boards/nrf/nrfs/testcase.yaml @@ -1,10 +1,8 @@ common: platform_allow: - nrf54h20dk/nrf54h20/cpuapp - - nrf54h20dk/nrf54h20/cpurad integration_platforms: - nrf54h20dk/nrf54h20/cpuapp - - nrf54h20dk/nrf54h20/cpurad tags: - nrfs harness: ztest From 738229c484b65c98a33b991daa0436bc7469b443 Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Wed, 11 Jun 2025 11:07:04 +0200 Subject: [PATCH 0433/2141] [nrf fromtree] boards: nrf54h20dk: Merge iron variants into the base variants This replaces the legacy SDFW compatible board configuration with the IronSide SE compatible one, thus removing support for running samples and tests on nRF54H20 devices with the old firmware. All applications are expected to work on `nrf54h20dk/nrf54h20/cpuapp` out of the box. For other board targets, all applications are expected to boot, but may require additional peripheral configuration in UICR. Build system support for the new UICR format is to be added separately. Co-authored-by: Jonathan Nilsen Signed-off-by: Jonathan Nilsen Signed-off-by: Grzegorz Swiderski (cherry picked from commit b4c18e8999d6425c3b70da14c4c67ff2ba3b2396) --- boards/nordic/nrf54h20dk/Kconfig.defconfig | 28 +++-- boards/nordic/nrf54h20dk/Kconfig.nrf54h20dk | 8 +- boards/nordic/nrf54h20dk/board.cmake | 7 +- boards/nordic/nrf54h20dk/board.yml | 4 - .../nrf54h20dk_nrf54h20-ipc_conf.dtsi | 8 +- .../nrf54h20dk_nrf54h20-ipc_conf_iron.dtsi | 30 ----- .../nrf54h20dk_nrf54h20-memory_map.dtsi | 98 ++++++++--------- .../nrf54h20dk_nrf54h20-memory_map_iron.dtsi | 104 ------------------ .../nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 27 +++-- .../nrf54h20dk_nrf54h20_cpuapp_defconfig | 2 - .../nrf54h20dk_nrf54h20_cpuapp_iron.dts | 45 -------- ...nrf54h20dk_nrf54h20_cpuapp_iron_0_9_0.yaml | 25 ----- .../nrf54h20dk_nrf54h20_cpuapp_iron_defconfig | 26 ----- .../nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts | 11 +- .../nrf54h20dk_nrf54h20_cpurad_iron.dts | 29 ----- ...nrf54h20dk_nrf54h20_cpurad_iron_0_9_0.yaml | 20 ---- .../nrf54h20dk_nrf54h20_cpurad_iron_defconfig | 25 ----- dts/vendor/nordic/nrf54h20.dtsi | 4 - .../nordic/nrf_ironside/update/README.rst | 6 +- .../nordic/nrf_ironside/update/sample.yaml | 4 +- .../nrf54h20dk_nrf54h20_cpuapp_iron.overlay | 3 - samples/drivers/mbox/sample.yaml | 1 + .../nrf54h20dk_nrf54h20_cpuapp_iron.overlay | 8 -- .../subsys/mgmt/mcumgr/smp_svr/sample.yaml | 2 +- .../nrf54h20dk_nrf54h20_cpuapp_iron.conf | 4 - samples/sysbuild/hello_world/sample.yaml | 10 +- .../nrf54h20dk_nrf54h20_cpurad_iron.conf | 1 - scripts/west_commands/runners/nrf_common.py | 6 +- soc/nordic/ironside/Kconfig | 4 +- soc/nordic/nrf54h/Kconfig | 4 +- .../nrf54h/Kconfig.defconfig.nrf54h20_cpuapp | 3 - .../nrf54h/Kconfig.defconfig.nrf54h20_cpurad | 3 - soc/nordic/nrf54h/Kconfig.soc | 5 - tests/boards/nrf/nrfs/prj.conf | 2 + .../nrf54h20dk_nrf54h20_cpuapp_iron.overlay | 6 - .../nrf54h20dk_nrf54h20_cpuapp_iron.conf | 2 - .../nrf54h20dk_nrf54h20_cpuapp_iron.overlay | 8 -- tests/subsys/ipc/ipc_sessions/testcase.yaml | 1 + 38 files changed, 115 insertions(+), 469 deletions(-) delete mode 100644 boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf_iron.dtsi delete mode 100644 boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map_iron.dtsi delete mode 100644 boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_iron.dts delete mode 100644 boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_iron_0_9_0.yaml delete mode 100644 boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_iron_defconfig delete mode 100644 boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_iron.dts delete mode 100644 boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_iron_0_9_0.yaml delete mode 100644 boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_iron_defconfig delete mode 100644 samples/drivers/counter/alarm/boards/nrf54h20dk_nrf54h20_cpuapp_iron.overlay delete mode 100644 samples/drivers/watchdog/boards/nrf54h20dk_nrf54h20_cpuapp_iron.overlay delete mode 100644 samples/sysbuild/hello_world/boards/nrf54h20dk_nrf54h20_cpuapp_iron.conf delete mode 100644 samples/sysbuild/hello_world/sysbuild/nrf54h20dk_nrf54h20_cpurad_iron.conf delete mode 100644 tests/drivers/adc/adc_api/boards/nrf54h20dk_nrf54h20_cpuapp_iron.overlay delete mode 100644 tests/drivers/watchdog/wdt_basic_api/boards/nrf54h20dk_nrf54h20_cpuapp_iron.conf delete mode 100644 tests/drivers/watchdog/wdt_basic_api/boards/nrf54h20dk_nrf54h20_cpuapp_iron.overlay diff --git a/boards/nordic/nrf54h20dk/Kconfig.defconfig b/boards/nordic/nrf54h20dk/Kconfig.defconfig index 3a6ba6b6d263..1800fb1775fb 100644 --- a/boards/nordic/nrf54h20dk/Kconfig.defconfig +++ b/boards/nordic/nrf54h20dk/Kconfig.defconfig @@ -12,28 +12,26 @@ config BT_HCI_IPC config MAX_THREAD_BYTES default 3 if USERSPACE -endif # BOARD_NRF54H20DK_NRF54H20_CPUAPP - -if BOARD_NRF54H20DK_NRF54H20_CPURAD - -config MAX_THREAD_BYTES - default 3 if USERSPACE - -endif # BOARD_NRF54H20DK_NRF54H20_CPURAD - -if BOARD_NRF54H20DK_NRF54H20_CPUAPP_IRON - config ROM_START_OFFSET default 0x800 if BOOTLOADER_MCUBOOT +if !USE_DT_CODE_PARTITION + +# Application core firmware must start at this offset when not using MCUboot. +# However, the default 'zephyr,code-partition' in DT is set for MCUboot. config FLASH_LOAD_OFFSET - default 0x2c000 if !USE_DT_CODE_PARTITION + default $(dt_nodelabel_reg_addr_hex,cpuapp_boot_partition) -endif # BOARD_NRF54H20DK_NRF54H20_CPUAPP_IRON +endif # !USE_DT_CODE_PARTITION -if BOARD_NRF54H20DK_NRF54H20_CPURAD_IRON +endif # BOARD_NRF54H20DK_NRF54H20_CPUAPP + +if BOARD_NRF54H20DK_NRF54H20_CPURAD + +config MAX_THREAD_BYTES + default 3 if USERSPACE config ROM_START_OFFSET default 0x800 if BOOTLOADER_MCUBOOT -endif # BOARD_NRF54H20DK_NRF54H20_CPURAD_IRON +endif # BOARD_NRF54H20DK_NRF54H20_CPURAD diff --git a/boards/nordic/nrf54h20dk/Kconfig.nrf54h20dk b/boards/nordic/nrf54h20dk/Kconfig.nrf54h20dk index c509f968db6d..62ad7a0d21c1 100644 --- a/boards/nordic/nrf54h20dk/Kconfig.nrf54h20dk +++ b/boards/nordic/nrf54h20dk/Kconfig.nrf54h20dk @@ -2,13 +2,9 @@ # SPDX-License-Identifier: Apache-2.0 config BOARD_NRF54H20DK - select SOC_NRF54H20_CPUAPP if (BOARD_NRF54H20DK_NRF54H20_CPUAPP || \ - BOARD_NRF54H20DK_NRF54H20_CPUAPP_IRON) - select SOC_NRF54H20_CPURAD if (BOARD_NRF54H20DK_NRF54H20_CPURAD || \ - BOARD_NRF54H20DK_NRF54H20_CPURAD_IRON) + select SOC_NRF54H20_CPUAPP if BOARD_NRF54H20DK_NRF54H20_CPUAPP + select SOC_NRF54H20_CPURAD if BOARD_NRF54H20DK_NRF54H20_CPURAD select SOC_NRF54H20_CPUPPR if (BOARD_NRF54H20DK_NRF54H20_CPUPPR || \ BOARD_NRF54H20DK_NRF54H20_CPUPPR_XIP) select SOC_NRF54H20_CPUFLPR if (BOARD_NRF54H20DK_NRF54H20_CPUFLPR || \ BOARD_NRF54H20DK_NRF54H20_CPUFLPR_XIP) - select SOC_NRF54H20_IRON if (BOARD_NRF54H20DK_NRF54H20_CPUAPP_IRON || \ - BOARD_NRF54H20DK_NRF54H20_CPURAD_IRON) diff --git a/boards/nordic/nrf54h20dk/board.cmake b/boards/nordic/nrf54h20dk/board.cmake index 093155e93222..b9383042b0c7 100644 --- a/boards/nordic/nrf54h20dk/board.cmake +++ b/boards/nordic/nrf54h20dk/board.cmake @@ -2,10 +2,7 @@ include(${ZEPHYR_BASE}/boards/common/nrfutil.board.cmake) -if(CONFIG_BOARD_NRF54H20DK_NRF54H20_CPUAPP OR - CONFIG_BOARD_NRF54H20DK_NRF54H20_CPURAD OR - CONFIG_BOARD_NRF54H20DK_NRF54H20_CPUAPP_IRON OR - CONFIG_BOARD_NRF54H20DK_NRF54H20_CPURAD_IRON) +if(CONFIG_BOARD_NRF54H20DK_NRF54H20_CPUAPP OR CONFIG_BOARD_NRF54H20DK_NRF54H20_CPURAD) if(CONFIG_SOC_NRF54H20_CPUAPP) set(JLINKSCRIPTFILE ${CMAKE_CURRENT_LIST_DIR}/support/nrf54h20_cpuapp.JLinkScript) else() @@ -17,7 +14,7 @@ if(CONFIG_BOARD_NRF54H20DK_NRF54H20_CPUAPP OR endif() if(CONFIG_BOARD_NRF54H20DK_NRF54H20_CPUPPR OR CONFIG_BOARD_NRF54H20DK_NRF54H20_CPUFLPR) - if(CONFIG_BOARD_NRF54H20DK_NRF54H20_CPUPPR) + if(CONFIG_SOC_NRF54H20_CPUPPR) set(JLINKSCRIPTFILE ${CMAKE_CURRENT_LIST_DIR}/support/nrf54h20_cpuppr.JLinkScript) else() set(JLINKSCRIPTFILE ${CMAKE_CURRENT_LIST_DIR}/support/nrf54h20_cpuflpr.JLinkScript) diff --git a/boards/nordic/nrf54h20dk/board.yml b/boards/nordic/nrf54h20dk/board.yml index a54cf1ae549f..2d3d40c20e0b 100644 --- a/boards/nordic/nrf54h20dk/board.yml +++ b/boards/nordic/nrf54h20dk/board.yml @@ -9,10 +9,6 @@ board: cpucluster: cpuppr - name: xip cpucluster: cpuflpr - - name: iron - cpucluster: cpuapp - - name: iron - cpucluster: cpurad revision: format: major.minor.patch default: "0.9.0" diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf.dtsi b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf.dtsi index 94cda5e8ee2e..f31d909b6f94 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf.dtsi +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf.dtsi @@ -7,17 +7,17 @@ / { ipc { cpusec_cpuapp_ipc: ipc-1-2 { - compatible = "zephyr,ipc-icmsg"; + compatible = "nordic,ironside-call"; status = "disabled"; - dcache-alignment = <32>; + memory-region = <&cpusec_cpuapp_ipc_shm>; mboxes = <&cpusec_bellboard 12>, <&cpuapp_bellboard 0>; }; cpusec_cpurad_ipc: ipc-1-3 { - compatible = "zephyr,ipc-icmsg"; + compatible = "nordic,ironside-call"; status = "disabled"; - dcache-alignment = <32>; + memory-region = <&cpusec_cpurad_ipc_shm>; mboxes = <&cpusec_bellboard 18>, <&cpurad_bellboard 0>; }; diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf_iron.dtsi b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf_iron.dtsi deleted file mode 100644 index a44db40538d2..000000000000 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf_iron.dtsi +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/* This file is to be merged with the original ipc_conf.dtsi in the future. */ - -/ { - ipc { - /delete-node/ ipc-1-2; - /delete-node/ ipc-1-3; - - cpusec_cpuapp_ipc: ipc-1-2 { - compatible = "nordic,ironside-call"; - memory-region = <&cpusec_cpuapp_ipc_shm>; - mboxes = <&cpusec_bellboard 12>, - <&cpuapp_bellboard 0>; - status = "disabled"; - }; - - cpusec_cpurad_ipc: ipc-1-3 { - compatible = "nordic,ironside-call"; - memory-region = <&cpusec_cpurad_ipc_shm>; - mboxes = <&cpusec_bellboard 18>, - <&cpurad_bellboard 0>; - status = "disabled"; - }; - }; -}; diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi index f29374025540..cd595d6cd5dd 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi @@ -16,14 +16,6 @@ #size-cells = <1>; ranges = <0x0 0x2f010000 0x41000>; - cpusec_cpuapp_ipc_shm: memory@0 { - reg = <0x0 DT_SIZE_K(2)>; - }; - - cpuapp_cpusec_ipc_shm: memory@800 { - reg = <0x800 DT_SIZE_K(2)>; - }; - cpuapp_data: memory@1000 { reg = <0x1000 DT_SIZE_K(256)>; }; @@ -37,14 +29,6 @@ #address-cells = <1>; #size-cells = <1>; ranges = <0x0 0x2f051000 0x1000>; - - cpusec_cpurad_ipc_shm: memory@0 { - reg = <0x0 DT_SIZE_K(2)>; - }; - - cpurad_cpusec_ipc_shm: memory@800 { - reg = <0x800 DT_SIZE_K(2)>; - }; }; etr_buf_ram0x_region: memory@2f0be000 { @@ -81,20 +65,44 @@ }; }; - cpuapp_cpusys_ipc_shm: memory@2f88fce0 { - reg = <0x2f88fce0 0x80>; + cpuapp_cpusys_ipc_shm: memory@2f88f600 { + reg = <0x2f88f600 0x80>; + }; + + cpusys_cpuapp_ipc_shm: memory@2f88f680 { + reg = <0x2f88f680 0x80>; + }; + + cpurad_cpusys_ipc_shm: memory@2f88f700 { + reg = <0x2f88f700 0x80>; }; - cpusys_cpuapp_ipc_shm: memory@2f88fd60 { - reg = <0x2f88fd60 0x80>; + cpusys_cpurad_ipc_shm: memory@2f88f780 { + reg = <0x2f88f780 0x80>; }; - cpurad_cpusys_ipc_shm: memory@2f88fe00 { - reg = <0x2f88fe00 0x80>; + cpusec_cpurad_ipc_shm: memory@2f88f800 { + reg = <0x2f88f800 0x80>; }; - cpusys_cpurad_ipc_shm: memory@2f88fe80 { - reg = <0x2f88fe80 0x80>; + cpurad_ironside_se_event_report: memory@2f88f880 { + reg = <0x2f88f880 0x100>; + }; + + cpurad_ironside_se_boot_report: memory@2f88f980 { + reg = <0x2f88f980 0x200>; + }; + + cpusec_cpuapp_ipc_shm: memory@2f88fb80 { + reg = <0x2f88fb80 0x80>; + }; + + cpuapp_ironside_se_event_report: memory@2f88fc00 { + reg = <0x2f88fc00 0x100>; + }; + + cpuapp_ironside_se_boot_report: memory@2f88fd00 { + reg = <0x2f88fd00 0x200>; }; /* @@ -187,27 +195,21 @@ }; &mram1x { - cpurad_rx_partitions: cpurad-rx-partitions { - compatible = "nordic,owned-partitions", "fixed-partitions"; - status = "disabled"; - nordic,access = ; + partitions { + compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; - cpurad_slot0_partition: partition@54000 { - reg = <0x54000 DT_SIZE_K(256)>; + cpuapp_boot_partition: partition@2c000 { + reg = <0x2c000 DT_SIZE_K(64)>; }; - }; - cpuapp_rx_partitions: cpuapp-rx-partitions { - compatible = "nordic,owned-partitions", "fixed-partitions"; - status = "disabled"; - nordic,access = ; - #address-cells = <1>; - #size-cells = <1>; + cpuapp_slot0_partition: partition@3c000 { + reg = <0x3c000 DT_SIZE_K(336)>; + }; - cpuapp_slot0_partition: partition@94000 { - reg = <0x94000 DT_SIZE_K(320)>; + cpurad_slot0_partition: partition@90000 { + reg = <0x90000 DT_SIZE_K(336)>; }; cpuppr_code_partition: partition@e4000 { @@ -217,21 +219,17 @@ cpuflpr_code_partition: partition@f4000 { reg = <0xf4000 DT_SIZE_K(48)>; }; - }; - cpuapp_rw_partitions: cpuapp-rw-partitions { - compatible = "nordic,owned-partitions", "fixed-partitions"; - status = "disabled"; - nordic,access = ; - #address-cells = <1>; - #size-cells = <1>; + cpuapp_slot1_partition: partition@100000 { + reg = <0x100000 DT_SIZE_K(336)>; + }; - dfu_partition: partition@100000 { - reg = < 0x100000 DT_SIZE_K(908) >; + cpurad_slot1_partition: partition@154000 { + reg = <0x154000 DT_SIZE_K(336)>; }; - storage_partition: partition@1e3000 { - reg = < 0x1e3000 DT_SIZE_K(40) >; + storage_partition: partition@1a8000 { + reg = <0x1a8000 DT_SIZE_K(40)>; }; }; }; diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map_iron.dtsi b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map_iron.dtsi deleted file mode 100644 index 2977e83758b4..000000000000 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map_iron.dtsi +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/* This file is to be merged with the original memory_map.dtsi in the future. - * The following nodes will be replaced: - */ -/delete-node/ &cpuapp_cpusec_ipc_shm; -/delete-node/ &cpuapp_cpusys_ipc_shm; -/delete-node/ &cpurad_cpusec_ipc_shm; -/delete-node/ &cpurad_cpusys_ipc_shm; -/delete-node/ &cpusec_cpuapp_ipc_shm; -/delete-node/ &cpusec_cpurad_ipc_shm; -/delete-node/ &cpusys_cpuapp_ipc_shm; -/delete-node/ &cpusys_cpurad_ipc_shm; -/delete-node/ &cpuapp_rw_partitions; -/delete-node/ &cpuapp_rx_partitions; -/delete-node/ &cpurad_rx_partitions; - -/ { - reserved-memory { - cpuapp_cpusys_ipc_shm: memory@2f88f600 { - reg = <0x2f88f600 0x80>; - }; - - cpusys_cpuapp_ipc_shm: memory@2f88f680 { - reg = <0x2f88f680 0x80>; - }; - - cpurad_cpusys_ipc_shm: memory@2f88f700 { - reg = <0x2f88f700 0x80>; - }; - - cpusys_cpurad_ipc_shm: memory@2f88f780 { - reg = <0x2f88f780 0x80>; - }; - - cpusec_cpurad_ipc_shm: memory@2f88f800 { - reg = <0x2f88f800 0x80>; - }; - - cpurad_ironside_se_event_report: memory@2f88f880 { - reg = <0x2f88f880 0x100>; - }; - - cpurad_ironside_se_boot_report: memory@2f88f980 { - reg = <0x2f88f980 0x200>; - }; - - cpusec_cpuapp_ipc_shm: memory@2f88fb80 { - reg = <0x2f88fb80 0x80>; - }; - - cpuapp_ironside_se_event_report: memory@2f88fc00 { - reg = <0x2f88fc00 0x100>; - }; - - cpuapp_ironside_se_boot_report: memory@2f88fd00 { - reg = <0x2f88fd00 0x200>; - }; - }; -}; - -&mram1x { - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cpuapp_boot_partition: partition@2c000 { - reg = <0x2c000 DT_SIZE_K(64)>; - }; - - cpuapp_slot0_partition: partition@3c000 { - reg = <0x3c000 DT_SIZE_K(336)>; - }; - - cpurad_slot0_partition: partition@90000 { - reg = <0x90000 DT_SIZE_K(336)>; - }; - - cpuppr_code_partition: partition@e4000 { - reg = <0xe4000 DT_SIZE_K(64)>; - }; - - cpuflpr_code_partition: partition@f4000 { - reg = <0xf4000 DT_SIZE_K(48)>; - }; - - cpuapp_slot1_partition: partition@100000 { - reg = <0x100000 DT_SIZE_K(336)>; - }; - - cpurad_slot1_partition: partition@154000 { - reg = <0x154000 DT_SIZE_K(336)>; - }; - - storage_partition: partition@1a8000 { - reg = <0x1a8000 DT_SIZE_K(40)>; - }; - }; -}; diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index 9cbc9035d4f8..16c573d127e1 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -18,10 +18,11 @@ chosen { zephyr,console = &uart136; - zephyr,code-partition = &cpuapp_slot0_partition; + zephyr,code-partition = &slot0_partition; zephyr,flash = &mram1x; zephyr,sram = &cpuapp_data; zephyr,shell-uart = &uart136; + zephyr,uart-mcumgr = &uart136; zephyr,ieee802154 = &cpuapp_ieee802154; zephyr,bt-hci = &bt_hci_ipc0; nordic,802154-spinel-ipc = &ipc0; @@ -145,8 +146,6 @@ &cpusec_cpuapp_ipc { status = "okay"; mbox-names = "tx", "rx"; - tx-region = <&cpuapp_cpusec_ipc_shm>; - rx-region = <&cpusec_cpuapp_ipc_shm>; }; &cpusec_bellboard { @@ -190,12 +189,26 @@ ipc0: &cpuapp_cpurad_ipc { status = "okay"; }; -&cpuapp_rx_partitions { - status = "okay"; +ironside_se_boot_report: &cpuapp_ironside_se_boot_report {}; + +boot_partition: &cpuapp_boot_partition { + label = "mcuboot"; }; -&cpuapp_rw_partitions { - status = "okay"; +slot0_partition: &cpuapp_slot0_partition { + label = "image-0"; +}; + +slot1_partition: &cpuapp_slot1_partition { + label = "image-1"; +}; + +slot2_partition: &cpurad_slot0_partition { + label = "image-2"; +}; + +slot3_partition: &cpurad_slot1_partition { + label = "image-3"; }; &cpuppr_vpr { diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_defconfig b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_defconfig index d3ce90b8a380..5b27932f7855 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_defconfig +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_defconfig @@ -8,8 +8,6 @@ CONFIG_SERIAL=y CONFIG_CONSOLE=y CONFIG_UART_CONSOLE=y -CONFIG_USE_DT_CODE_PARTITION=y - # Enable MPU CONFIG_ARM_MPU=y diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_iron.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_iron.dts deleted file mode 100644 index e822cf2c9119..000000000000 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_iron.dts +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include "nrf54h20dk_nrf54h20_cpuapp.dts" -#include "nrf54h20dk_nrf54h20-ipc_conf_iron.dtsi" -#include "nrf54h20dk_nrf54h20-memory_map_iron.dtsi" - -/delete-node/ &cpusec_cpurad_ipc; - -/ { - chosen { - zephyr,code-partition = &slot0_partition; - zephyr,uart-mcumgr = &uart136; - }; -}; - -&cpusec_cpuapp_ipc { - mbox-names = "tx", "rx"; - status = "okay"; -}; - -ironside_se_boot_report: &cpuapp_ironside_se_boot_report {}; - -boot_partition: &cpuapp_boot_partition { - label = "mcuboot"; -}; - -slot0_partition: &cpuapp_slot0_partition { - label = "image-0"; -}; - -slot1_partition: &cpuapp_slot1_partition { - label = "image-1"; -}; - -slot2_partition: &cpurad_slot0_partition { - label = "image-2"; -}; - -slot3_partition: &cpurad_slot1_partition { - label = "image-3"; -}; diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_iron_0_9_0.yaml b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_iron_0_9_0.yaml deleted file mode 100644 index 563a8b4ac1b7..000000000000 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_iron_0_9_0.yaml +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright (c) 2025 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -identifier: nrf54h20dk/nrf54h20/cpuapp/iron -name: nRF54H20-DK-nRF54H20-Application (IronSide compatible) (revision 0.9.0) -type: mcu -arch: arm -toolchain: - - gnuarmemb - - xtools - - zephyr -sysbuild: true -ram: 256 -flash: 480 -supported: - - adc - - can - - counter - - gpio - - i2c - - pwm - - retained_mem - - spi - - watchdog - - usbd diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_iron_defconfig b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_iron_defconfig deleted file mode 100644 index bf3b6ac01e47..000000000000 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_iron_defconfig +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright (c) 2025 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -# Enable UART driver -CONFIG_SERIAL=y - -# Enable console -CONFIG_CONSOLE=y -CONFIG_UART_CONSOLE=y - -# Enable MPU -CONFIG_ARM_MPU=y - -# MPU-based null-pointer dereferencing detection cannot be applied -# as the (0x0 - 0x400) region is unmapped for this target. -CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y - -# Enable cache -CONFIG_CACHE_MANAGEMENT=y -CONFIG_EXTERNAL_CACHE=y - -# Enable GPIO -CONFIG_GPIO=y - -# UICR generation is not supported, and when reintroduced will not use nrf-regtool. -CONFIG_NRF_REGTOOL_GENERATE_UICR=n diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts index ebeb2aeeafff..2813d5b11741 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts @@ -24,6 +24,7 @@ zephyr,flash = &mram1x; zephyr,sram = &cpurad_ram0; zephyr,shell-uart = &uart135; + zephyr,uart-mcumgr = &uart135; zephyr,ieee802154 = &cpurad_ieee802154; zephyr,bt-hci-ipc = &ipc0; nordic,802154-spinel-ipc = &ipc0; @@ -62,8 +63,6 @@ &cpusec_cpurad_ipc { status = "okay"; mbox-names = "tx", "rx"; - tx-region = <&cpurad_cpusec_ipc_shm>; - rx-region = <&cpusec_cpurad_ipc_shm>; }; &cpusec_bellboard { @@ -90,8 +89,12 @@ ipc0: &cpuapp_cpurad_ipc { status = "okay"; }; -&cpurad_rx_partitions { - status = "okay"; +slot0_partition: &cpurad_slot0_partition { + label = "image-0"; +}; + +slot1_partition: &cpurad_slot1_partition { + label = "image-1"; }; &grtc { diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_iron.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_iron.dts deleted file mode 100644 index 16b599f554e4..000000000000 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_iron.dts +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include "nrf54h20dk_nrf54h20_cpurad.dts" -#include "nrf54h20dk_nrf54h20-ipc_conf_iron.dtsi" -#include "nrf54h20dk_nrf54h20-memory_map_iron.dtsi" - -/ { - chosen { - zephyr,code-partition = &cpurad_slot0_partition; - zephyr,uart-mcumgr = &uart135; - }; -}; - -&cpusec_cpurad_ipc { - mbox-names = "tx", "rx"; - status = "okay"; -}; - -slot0_partition: &cpurad_slot0_partition { - label = "image-0"; -}; - -slot1_partition: &cpurad_slot1_partition { - label = "image-1"; -}; diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_iron_0_9_0.yaml b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_iron_0_9_0.yaml deleted file mode 100644 index 034b9f7e27dd..000000000000 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_iron_0_9_0.yaml +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright (c) 2025 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -identifier: nrf54h20dk/nrf54h20/cpurad/iron -name: nRF54H20-DK-nRF54H20-Radio (IronSide SE compatible) (revision 0.9.0) -type: mcu -arch: arm -toolchain: - - gnuarmemb - - xtools - - zephyr -sysbuild: true -ram: 192 -flash: 336 -supported: - - counter - - gpio - - pwm - - retained_mem - - spi diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_iron_defconfig b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_iron_defconfig deleted file mode 100644 index 4d247d805269..000000000000 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_iron_defconfig +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright (c) 2025 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -# Enable UART driver -CONFIG_SERIAL=y - -# Enable console -CONFIG_CONSOLE=y -CONFIG_UART_CONSOLE=y - -CONFIG_USE_DT_CODE_PARTITION=y - -# Enable MPU -CONFIG_ARM_MPU=y - -# MPU-based null-pointer dereferencing detection cannot be applied -# as the (0x0 - 0x400) region is unmapped for this target. -CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y - -# Enable cache -CONFIG_CACHE_MANAGEMENT=y -CONFIG_EXTERNAL_CACHE=y - -# UICR generation is not supported, and when reintroduced will not use nrf-regtool. -CONFIG_NRF_REGTOOL_GENERATE_UICR=n diff --git a/dts/vendor/nordic/nrf54h20.dtsi b/dts/vendor/nordic/nrf54h20.dtsi index c72fedef84a6..b57c718a9e2b 100644 --- a/dts/vendor/nordic/nrf54h20.dtsi +++ b/dts/vendor/nordic/nrf54h20.dtsi @@ -152,10 +152,6 @@ reserved-memory { #address-cells = <1>; #size-cells = <1>; - - suit_storage_partition: memory@e1ed000 { - reg = <0xe1ed000 DT_SIZE_K(20)>; - }; }; clocks { diff --git a/samples/boards/nordic/nrf_ironside/update/README.rst b/samples/boards/nordic/nrf_ironside/update/README.rst index af72d23f3917..484d97d0adda 100644 --- a/samples/boards/nordic/nrf_ironside/update/README.rst +++ b/samples/boards/nordic/nrf_ironside/update/README.rst @@ -25,8 +25,8 @@ The update procedure works as follows: Once the operation has completed, you can read the boot report to verify that the update has taken place. -Building and running the application for nrf54h20dk/nrf54h20/cpuapp/iron -************************************************************************ +Building and running the application for nrf54h20dk/nrf54h20/cpuapp +******************************************************************* .. note:: You can use this application only when there is already a version of IronSide SE installed on the device. @@ -55,7 +55,7 @@ Building and running the application for nrf54h20dk/nrf54h20/cpuapp/iron .. zephyr-app-commands:: :zephyr-app: samples/boards/nordic/nrf_ironside/update - :board: nrf54h20dk/nrf54h20/cpuapp/iron + :board: nrf54h20dk/nrf54h20/cpuapp :goals: flash #. Trigger a reset: diff --git a/samples/boards/nordic/nrf_ironside/update/sample.yaml b/samples/boards/nordic/nrf_ironside/update/sample.yaml index cc127d9eb6dd..3a5d9477da2f 100644 --- a/samples/boards/nordic/nrf_ironside/update/sample.yaml +++ b/samples/boards/nordic/nrf_ironside/update/sample.yaml @@ -5,8 +5,8 @@ common: build_only: true tags: nrf_ironside integration_platforms: - - nrf54h20dk/nrf54h20/cpuapp/iron + - nrf54h20dk/nrf54h20/cpuapp tests: sample.boards.nordic.nrf_ironside.update: - platform_allow: nrf54h20dk/nrf54h20/cpuapp/iron + platform_allow: nrf54h20dk/nrf54h20/cpuapp diff --git a/samples/drivers/counter/alarm/boards/nrf54h20dk_nrf54h20_cpuapp_iron.overlay b/samples/drivers/counter/alarm/boards/nrf54h20dk_nrf54h20_cpuapp_iron.overlay deleted file mode 100644 index f65b4dd3b0ba..000000000000 --- a/samples/drivers/counter/alarm/boards/nrf54h20dk_nrf54h20_cpuapp_iron.overlay +++ /dev/null @@ -1,3 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - -#include "nrf54h20dk_nrf54h20_common.dtsi" diff --git a/samples/drivers/mbox/sample.yaml b/samples/drivers/mbox/sample.yaml index 8a25dc0b3bf7..c18533c2c180 100644 --- a/samples/drivers/mbox/sample.yaml +++ b/samples/drivers/mbox/sample.yaml @@ -65,6 +65,7 @@ tests: integration_platforms: - nrf54h20dk/nrf54h20/cpuapp extra_args: + - mbox_CONFIG_SOC_NRF54H20_CPURAD_ENABLE=y - SB_CONF_FILE=sysbuild/nrf54h20dk_nrf54h20_cpurad.conf sysbuild: true harness: console diff --git a/samples/drivers/watchdog/boards/nrf54h20dk_nrf54h20_cpuapp_iron.overlay b/samples/drivers/watchdog/boards/nrf54h20dk_nrf54h20_cpuapp_iron.overlay deleted file mode 100644 index 102abfc8ef27..000000000000 --- a/samples/drivers/watchdog/boards/nrf54h20dk_nrf54h20_cpuapp_iron.overlay +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright 2025 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -&wdt010 { - status = "okay"; -}; diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml b/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml index 8ede9b77d07b..fd6194cdc4f1 100644 --- a/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml +++ b/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml @@ -88,7 +88,7 @@ tests: - mimxrt685_evk/mimxrt685s/cm33 - rd_rw612_bga - nrf52840dk/nrf52840 - - nrf54h20dk/nrf54h20/cpuapp/iron + - nrf54h20dk/nrf54h20/cpuapp - pinnacle_100_dvk - mg100 integration_platforms: diff --git a/samples/sysbuild/hello_world/boards/nrf54h20dk_nrf54h20_cpuapp_iron.conf b/samples/sysbuild/hello_world/boards/nrf54h20dk_nrf54h20_cpuapp_iron.conf deleted file mode 100644 index ca2bc07e4f29..000000000000 --- a/samples/sysbuild/hello_world/boards/nrf54h20dk_nrf54h20_cpuapp_iron.conf +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -CONFIG_SOC_NRF54H20_CPURAD_ENABLE=y diff --git a/samples/sysbuild/hello_world/sample.yaml b/samples/sysbuild/hello_world/sample.yaml index c8ca9cbe4c0d..e638594c634e 100644 --- a/samples/sysbuild/hello_world/sample.yaml +++ b/samples/sysbuild/hello_world/sample.yaml @@ -25,13 +25,9 @@ tests: - nrf54h20dk/nrf54h20/cpuapp integration_platforms: - nrf54h20dk/nrf54h20/cpuapp - extra_args: SB_CONF_FILE=sysbuild/nrf54h20dk_nrf54h20_cpurad.conf - - sample.sysbuild.hello_world.nrf54h20dk_cpuapp_cpurad.iron: - platform_allow: - - nrf54h20dk/nrf54h20/cpuapp/iron - extra_args: SB_CONF_FILE=sysbuild/nrf54h20dk_nrf54h20_cpurad_iron.conf - + extra_args: + - SB_CONF_FILE=sysbuild/nrf54h20dk_nrf54h20_cpurad.conf + - hello_world_CONFIG_SOC_NRF54H20_CPURAD_ENABLE=y sample.sysbuild.hello_world.nrf54h20dk_cpuapp_cpuppr: platform_allow: - nrf54h20dk/nrf54h20/cpuapp diff --git a/samples/sysbuild/hello_world/sysbuild/nrf54h20dk_nrf54h20_cpurad_iron.conf b/samples/sysbuild/hello_world/sysbuild/nrf54h20dk_nrf54h20_cpurad_iron.conf deleted file mode 100644 index 8d4a230adbe1..000000000000 --- a/samples/sysbuild/hello_world/sysbuild/nrf54h20dk_nrf54h20_cpurad_iron.conf +++ /dev/null @@ -1 +0,0 @@ -SB_CONFIG_REMOTE_BOARD="nrf54h20dk/nrf54h20/cpurad/iron" diff --git a/scripts/west_commands/runners/nrf_common.py b/scripts/west_commands/runners/nrf_common.py index a6af477c61a9..e08186537720 100644 --- a/scripts/west_commands/runners/nrf_common.py +++ b/scripts/west_commands/runners/nrf_common.py @@ -379,7 +379,7 @@ def program_hex(self): ) if self.erase: - if self.build_conf.get('CONFIG_SOC_NRF54H20_IRON'): + if self.family == 'nrf54h': self.exec_op('erase', kind='all') else: self.exec_op('erase', core='Application', kind='all') @@ -464,8 +464,8 @@ def program_hex(self): self.logger.debug(f'Erase modes: chip:{erase_arg} ext_mem:' f'{ext_mem_erase_opt}') - # Temp hack while waiting for NRF54H20_IRON support for Network in nrfutil - if self.build_conf.get('CONFIG_SOC_NRF54H20_IRON') and core == "Network": + # Temp hack while waiting for nrfutil Network support for NRF54H20 with IronSide + if self.family == 'nrf54h' and core == 'Network': core = "Application" self.op_program(self.hex_, erase_arg, ext_mem_erase_opt, defer=True, core=core) diff --git a/soc/nordic/ironside/Kconfig b/soc/nordic/ironside/Kconfig index 8a91adf8ed0e..a9e68bba0b28 100644 --- a/soc/nordic/ironside/Kconfig +++ b/soc/nordic/ironside/Kconfig @@ -3,7 +3,7 @@ config NRF_IRONSIDE bool - depends on SOC_NRF54H20_IRON || SOC_NRF9280_IRON + depends on SOC_NRF54H20 || SOC_NRF9280_IRON help This is selected by drivers interacting with Nordic IronSide firmware. @@ -28,7 +28,7 @@ config NRF_IRONSIDE_CALL_INIT_PRIORITY endif # NRF_IRONSIDE_CALL menu "Nordic IronSide services" - depends on SOC_NRF54H20_IRON || SOC_NRF9280_IRON + depends on SOC_NRF54H20 || SOC_NRF9280_IRON config NRF_IRONSIDE_CPUCONF_SERVICE bool "IronSide CPUCONF service" diff --git a/soc/nordic/nrf54h/Kconfig b/soc/nordic/nrf54h/Kconfig index ed9fc86f2fc9..97423a04e9b7 100644 --- a/soc/nordic/nrf54h/Kconfig +++ b/soc/nordic/nrf54h/Kconfig @@ -10,6 +10,7 @@ config SOC_SERIES_NRF54HX select SOC_EARLY_INIT_HOOK if ARM select SOC_LATE_INIT_HOOK if SOC_NRF54H20_CPURAD_ENABLE select NRF_PLATFORM_HALTIUM + select EXPERIMENTAL if MCUBOOT config SOC_NRF54H20_CPUAPP_COMMON bool @@ -88,6 +89,3 @@ config SOC_NRF54H20_CPUFLPR rsource "bicr/Kconfig" rsource "gpd/Kconfig" - -config SOC_NRF54H20_IRON - select EXPERIMENTAL if MCUBOOT diff --git a/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuapp b/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuapp index 595cc2d38860..69bde826ba41 100644 --- a/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuapp +++ b/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuapp @@ -8,9 +8,6 @@ if SOC_NRF54H20_CPUAPP config NUM_IRQS default 471 -config NRF_REGTOOL_GENERATE_UICR - default y - config SHELL_BACKEND_SERIAL default n if NRF_ETR_SHELL diff --git a/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpurad b/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpurad index 1fffdeae6d2e..8f86835b92c5 100644 --- a/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpurad +++ b/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpurad @@ -8,9 +8,6 @@ if SOC_NRF54H20_CPURAD config NUM_IRQS default 471 -config NRF_REGTOOL_GENERATE_UICR - default y - config PM default y diff --git a/soc/nordic/nrf54h/Kconfig.soc b/soc/nordic/nrf54h/Kconfig.soc index 62d5293bfe32..459854e13b2d 100644 --- a/soc/nordic/nrf54h/Kconfig.soc +++ b/soc/nordic/nrf54h/Kconfig.soc @@ -33,10 +33,5 @@ config SOC_NRF54H20_CPUFLPR help nRF54H20 CPUFLPR -config SOC_NRF54H20_IRON - bool - help - Indicates that local domain firmware is compatible with Nordic IronSide SE. - config SOC default "nrf54h20" if SOC_NRF54H20 diff --git a/tests/boards/nrf/nrfs/prj.conf b/tests/boards/nrf/nrfs/prj.conf index c1a01949d601..ee3da6976c4e 100644 --- a/tests/boards/nrf/nrfs/prj.conf +++ b/tests/boards/nrf/nrfs/prj.conf @@ -19,3 +19,5 @@ CONFIG_LOG=y CONFIG_LOG_MODE_IMMEDIATE=n CONFIG_CONSOLE=y CONFIG_UART_CONSOLE=y + +CONFIG_SOC_NRF54H20_CPURAD_ENABLE=y diff --git a/tests/drivers/adc/adc_api/boards/nrf54h20dk_nrf54h20_cpuapp_iron.overlay b/tests/drivers/adc/adc_api/boards/nrf54h20dk_nrf54h20_cpuapp_iron.overlay deleted file mode 100644 index 0e01ff40bb9e..000000000000 --- a/tests/drivers/adc/adc_api/boards/nrf54h20dk_nrf54h20_cpuapp_iron.overlay +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor - * SPDX-License-Identifier: Apache-2.0 - */ - -#include "nrf54h20dk_nrf54h20_common.dtsi" diff --git a/tests/drivers/watchdog/wdt_basic_api/boards/nrf54h20dk_nrf54h20_cpuapp_iron.conf b/tests/drivers/watchdog/wdt_basic_api/boards/nrf54h20dk_nrf54h20_cpuapp_iron.conf deleted file mode 100644 index 45e31e2fae42..000000000000 --- a/tests/drivers/watchdog/wdt_basic_api/boards/nrf54h20dk_nrf54h20_cpuapp_iron.conf +++ /dev/null @@ -1,2 +0,0 @@ -# Disable dcache -CONFIG_DCACHE=n diff --git a/tests/drivers/watchdog/wdt_basic_api/boards/nrf54h20dk_nrf54h20_cpuapp_iron.overlay b/tests/drivers/watchdog/wdt_basic_api/boards/nrf54h20dk_nrf54h20_cpuapp_iron.overlay deleted file mode 100644 index 102abfc8ef27..000000000000 --- a/tests/drivers/watchdog/wdt_basic_api/boards/nrf54h20dk_nrf54h20_cpuapp_iron.overlay +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright 2025 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -&wdt010 { - status = "okay"; -}; diff --git a/tests/subsys/ipc/ipc_sessions/testcase.yaml b/tests/subsys/ipc/ipc_sessions/testcase.yaml index f76a61b8d68e..a4d34a394dd8 100644 --- a/tests/subsys/ipc/ipc_sessions/testcase.yaml +++ b/tests/subsys/ipc/ipc_sessions/testcase.yaml @@ -20,6 +20,7 @@ tests: - nrf54h20dk/nrf54h20/cpuapp extra_args: - CONFIG_IPC_TEST_SKIP_CORE_RESET=y + - CONFIG_SOC_NRF54H20_CPURAD_ENABLE=y sample.ipc.ipc_sessions.nrf54h20dk_cpuapp_cpuppr: platform_allow: - nrf54h20dk/nrf54h20/cpuapp From b1e4c7852981379374f30da895e3d72380706c48 Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Wed, 11 Jun 2025 11:07:04 +0200 Subject: [PATCH 0434/2141] [nrf fromtree] boards: nrf54h20dk: Limit app core FLASH_LOAD_SIZE CONFIG_USE_DT_CODE_PARTITION had to be disabled to add MCUboot support. As a result, CONFIG_FLASH_LOAD_SIZE was left at zero, which means that the linker would claim all available MRAM for the app core. For now, we can't allow that, because the default nRF54H20 DK memory map divides MRAM between multiple cores in order to support various samples. Signed-off-by: Grzegorz Swiderski (cherry picked from commit b7b8b27338471271862d090162ce4b0fdbe9e221) --- boards/nordic/nrf54h20dk/Kconfig.defconfig | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/boards/nordic/nrf54h20dk/Kconfig.defconfig b/boards/nordic/nrf54h20dk/Kconfig.defconfig index 1800fb1775fb..069ed7b6eba6 100644 --- a/boards/nordic/nrf54h20dk/Kconfig.defconfig +++ b/boards/nordic/nrf54h20dk/Kconfig.defconfig @@ -22,6 +22,13 @@ if !USE_DT_CODE_PARTITION config FLASH_LOAD_OFFSET default $(dt_nodelabel_reg_addr_hex,cpuapp_boot_partition) +# This is meant to span 'cpuapp_boot_partition' and 'cpuapp_slot0_partition' +# in the default memory map. +config FLASH_LOAD_SIZE + default $(add_hex, $(dt_nodelabel_reg_addr_hex,cpuapp_slot0_partition), \ + $(dt_nodelabel_reg_size_hex,cpuapp_slot0_partition), \ + -$(dt_nodelabel_reg_addr_hex,cpuapp_boot_partition)) + endif # !USE_DT_CODE_PARTITION endif # BOARD_NRF54H20DK_NRF54H20_CPUAPP From eda8866442f8461d437d881115863965d281e035 Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Wed, 11 Jun 2025 11:07:04 +0200 Subject: [PATCH 0435/2141] [nrf fromtree] modules: hal_nordic: Remove nrf-regtool support for nRF54H nrf-regtool will not be used as part of IronSide SE compatible builds. It will remain in use for the nRF92 series, until that too undergoes a switch from SDFW to IronSide SE. Signed-off-by: Grzegorz Swiderski (cherry picked from commit 835649acdc6a72ff802b3634d9a0debd99019a58) --- modules/hal_nordic/Kconfig.nrf_regtool | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/hal_nordic/Kconfig.nrf_regtool b/modules/hal_nordic/Kconfig.nrf_regtool index 396ec2050a05..12f7a53f471c 100644 --- a/modules/hal_nordic/Kconfig.nrf_regtool +++ b/modules/hal_nordic/Kconfig.nrf_regtool @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 menu "nrf-regtool options" - depends on SOC_SERIES_NRF54HX || SOC_SERIES_NRF92X + depends on SOC_SERIES_NRF92X config NRF_REGTOOL_GENERATE_UICR bool "Generate UICR" From 9f67617e6ecb8990d82b4836c68d70af6e729caa Mon Sep 17 00:00:00 2001 From: Jonathan Nilsen Date: Wed, 18 Jun 2025 11:46:57 +0200 Subject: [PATCH 0436/2141] [nrf fromtree] boards: nordic: update nrf54h20dk memory map MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update memory map to be compatible with latest IronSide. 180kB MRAM is reserved. Co-authored-by: Håkon Amundsen Signed-off-by: Håkon Amundsen Signed-off-by: Jonathan Nilsen (cherry picked from commit 7324eea7c9b5d09b8759c97cf90ced2c93c5b831) --- .../nrf54h20dk_nrf54h20-memory_map.dtsi | 22 +++++++++---------- .../nrf54h20dk_nrf54h20_cpuapp_0_9_0.yaml | 2 +- .../nrf54h20dk_nrf54h20_cpurad_0_9_0.yaml | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi index cd595d6cd5dd..7f568005a225 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi @@ -200,16 +200,16 @@ #address-cells = <1>; #size-cells = <1>; - cpuapp_boot_partition: partition@2c000 { - reg = <0x2c000 DT_SIZE_K(64)>; + cpuapp_boot_partition: partition@30000 { + reg = <0x30000 DT_SIZE_K(64)>; }; - cpuapp_slot0_partition: partition@3c000 { - reg = <0x3c000 DT_SIZE_K(336)>; + cpuapp_slot0_partition: partition@40000 { + reg = <0x40000 DT_SIZE_K(328)>; }; - cpurad_slot0_partition: partition@90000 { - reg = <0x90000 DT_SIZE_K(336)>; + cpurad_slot0_partition: partition@92000 { + reg = <0x92000 DT_SIZE_K(328)>; }; cpuppr_code_partition: partition@e4000 { @@ -221,15 +221,15 @@ }; cpuapp_slot1_partition: partition@100000 { - reg = <0x100000 DT_SIZE_K(336)>; + reg = <0x100000 DT_SIZE_K(328)>; }; - cpurad_slot1_partition: partition@154000 { - reg = <0x154000 DT_SIZE_K(336)>; + cpurad_slot1_partition: partition@152000 { + reg = <0x152000 DT_SIZE_K(328)>; }; - storage_partition: partition@1a8000 { - reg = <0x1a8000 DT_SIZE_K(40)>; + storage_partition: partition@1a4000 { + reg = <0x1a4000 DT_SIZE_K(40)>; }; }; }; diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_0_9_0.yaml b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_0_9_0.yaml index 1884ce0a4d0d..832689be8e1d 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_0_9_0.yaml +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_0_9_0.yaml @@ -10,7 +10,7 @@ toolchain: - zephyr sysbuild: true ram: 256 -flash: 296 +flash: 392 supported: - adc - can diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_0_9_0.yaml b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_0_9_0.yaml index de557fcc2cdb..8567494d1e3a 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_0_9_0.yaml +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_0_9_0.yaml @@ -10,7 +10,7 @@ toolchain: - zephyr sysbuild: true ram: 192 -flash: 256 +flash: 328 supported: - counter - gpio From 75718fa236c519a4ae9e28a06671182983d2adc2 Mon Sep 17 00:00:00 2001 From: Jonathan Nilsen Date: Fri, 20 Jun 2025 10:52:01 +0200 Subject: [PATCH 0437/2141] [nrf fromtree] boards: nordic: nrf54h20dk: refactor RAM memory map Refactor the default RAM memory map on nrf54h20dk: Removes use of "nordic,owned-memory" which is no longer needed on nrf54h20. Reserved memory nodes that were under "nordic,owned-memory" have been moved directly under reserved-memory. The memory shared between cpuapp-cpusec and cpurad-cpusec in RAM0x is no longer used with IronSide, since IPC buffers toward the secure domain are at new fixed locations. The cpuapp_data region has been expanded to fill the available space in RAM0x when removing these shared memory regions. Signed-off-by: Jonathan Nilsen (cherry picked from commit 38e60025b0c2ed137109ec5dd8ecae1d09435ac6) --- .../nrf54h20dk_nrf54h20-memory_map.dtsi | 135 +++++------------- .../nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 12 -- .../nrf54h20dk_nrf54h20_cpuapp_0_9_0.yaml | 2 +- .../nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts | 8 -- dts/vendor/nordic/nrf54h20.dtsi | 1 - .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 5 - .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 4 - .../soc/nrf54h20_cpuapp.overlay | 4 - .../nordic-ppr/soc/nrf54h20_cpuapp.overlay | 4 - .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 8 -- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 4 - 11 files changed, 34 insertions(+), 153 deletions(-) delete mode 100644 tests/arch/common/ramfunc/boards/nrf54h20dk_nrf54h20_cpuapp.overlay diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi index 7f568005a225..aa6ebc629cc2 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi @@ -7,62 +7,20 @@ / { reserved-memory { - cpuapp_ram0x_region: memory@2f010000 { - compatible = "nordic,owned-memory"; - reg = <0x2f010000 DT_SIZE_K(260)>; - status = "disabled"; - nordic,access = ; - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x2f010000 0x41000>; - - cpuapp_data: memory@1000 { - reg = <0x1000 DT_SIZE_K(256)>; - }; + cpuapp_data: memory@2f000000 { + reg = <0x2f000000 DT_SIZE_K(760)>; }; - cpurad_ram0x_region: memory@2f051000 { - compatible = "nordic,owned-memory"; - reg = <0x2f051000 DT_SIZE_K(4)>; - status = "disabled"; - nordic,access = ; - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x2f051000 0x1000>; - }; - - etr_buf_ram0x_region: memory@2f0be000 { - compatible = "nordic,owned-memory"; + etr_buffer: memory@2f0be000 { reg = <0x2f0be000 DT_SIZE_K(4)>; - status = "disabled"; - nordic,access = ; - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x2f0be000 0x1000>; - - /* TODO In future move this region to cpuapp_ram0x_region. */ - etr_buffer: memory@0 { - reg = <0x0 DT_SIZE_K(4)>; - }; }; - cpuapp_cpurad_ram0x_region: memory@2f0bf000 { - compatible = "nordic,owned-memory"; - reg = <0x2f0bf000 DT_SIZE_K(4)>; - status = "disabled"; - nordic,access = , - ; - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x2f0bf000 0x1000>; - - cpuapp_cpurad_ipc_shm: memory@0 { - reg = <0x0 DT_SIZE_K(2)>; - }; + cpuapp_cpurad_ipc_shm: memory@2f0bf000 { + reg = <0x2f0bf000 DT_SIZE_K(2)>; + }; - cpurad_cpuapp_ipc_shm: memory@800 { - reg = <0x800 DT_SIZE_K(2)>; - }; + cpurad_cpuapp_ipc_shm: memory@2f0bf800 { + reg = <0x2f0bf800 DT_SIZE_K(2)>; }; cpuapp_cpusys_ipc_shm: memory@2f88f600 { @@ -105,80 +63,53 @@ reg = <0x2f88fd00 0x200>; }; - /* - * NOTE: FLPR has a direct bridge with RAM21 that bypasses MPC. - * This means that when this region is marked as non-executable, - * only FLPR can execute code from it. - */ - ram21_region: memory@2f890000 { - compatible = "nordic,owned-memory"; - status = "disabled"; - reg = <0x2f890000 DT_SIZE_K(64)>; - nordic,access = ; - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x2f890000 0x10000>; - - cpuflpr_code_data: memory@0 { - reg = <0x0 DT_SIZE_K(46)>; - }; - - cpuapp_cpuflpr_ipc_shm: memory@b800 { - reg = <0xb800 DT_SIZE_K(1)>; - }; + cpuflpr_code_data: memory@2f890000 { + reg = <0x2f890000 DT_SIZE_K(46)>; + }; - cpuflpr_cpuapp_ipc_shm: memory@bc00 { - reg = <0xbc00 DT_SIZE_K(1)>; - }; + cpuapp_cpuflpr_ipc_shm: memory@2f89b800 { + reg = <0x2f89b800 DT_SIZE_K(1)>; + }; - dma_fast_region: memory@c000 { - compatible = "zephyr,memory-region"; - reg = <0xc000 DT_SIZE_K(16)>; - status = "disabled"; - #memory-region-cells = <0>; - zephyr,memory-region = "DMA_RAM21"; - zephyr,memory-attr = <( DT_MEM_DMA | DT_MEM_CACHEABLE )>; - }; + cpuflpr_cpuapp_ipc_shm: memory@2f89bc00 { + reg = <0x2f89bc00 DT_SIZE_K(1)>; }; - cpuppr_ram3x_region: memory@2fc00000 { - compatible = "nordic,owned-memory"; - reg = <0x2fc00000 DT_SIZE_K(64)>; + dma_fast_region: memory@2f89c000 { + compatible = "zephyr,memory-region"; + reg = <0x2f89c000 DT_SIZE_K(16)>; status = "disabled"; - nordic,access = ; - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x2fc00000 0x10000>; + #memory-region-cells = <0>; + zephyr,memory-region = "DMA_RAM21"; + zephyr,memory-attr = <( DT_MEM_DMA | DT_MEM_CACHEABLE )>; + }; - cpuppr_code_data: memory@0 { - reg = <0x0 DT_SIZE_K(62)>; - }; + cpuppr_code_data: memory@2fc00000 { + reg = <0x2fc00000 DT_SIZE_K(62)>; + }; - cpuapp_cpuppr_ipc_shm: memory@f800 { - reg = <0xf800 DT_SIZE_K(1)>; - }; + cpuapp_cpuppr_ipc_shm: memory@2fc0f800 { + reg = <0x2fc0f800 DT_SIZE_K(1)>; + }; - cpuppr_cpuapp_ipc_shm: memory@fc00 { - reg = <0xfc00 DT_SIZE_K(1)>; - }; + cpuppr_cpuapp_ipc_shm: memory@2fc0fc00 { + reg = <0x2fc0fc00 DT_SIZE_K(1)>; }; cpuapp_dma_region: memory@2fc12000 { - compatible = "nordic,owned-memory", "zephyr,memory-region"; + compatible = "zephyr,memory-region"; reg = <0x2fc12000 DT_SIZE_K(4)>; status = "disabled"; #memory-region-cells = <0>; - nordic,access = ; zephyr,memory-region = "DMA_RAM3x_APP"; zephyr,memory-attr = <( DT_MEM_DMA )>; }; cpurad_dma_region: memory@2fc13000 { - compatible = "nordic,owned-memory", "zephyr,memory-region"; + compatible = "zephyr,memory-region"; reg = <0x2fc13000 DT_SIZE_K(1)>; status = "disabled"; #memory-region-cells = <0>; - nordic,access = ; zephyr,memory-region = "DMA_RAM3x_RAD"; zephyr,memory-attr = <( DT_MEM_DMA )>; }; diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index 16c573d127e1..47255b0c9947 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -109,18 +109,6 @@ }; }; -&cpuapp_ram0x_region { - status = "okay"; -}; - -&etr_buf_ram0x_region { - status = "okay"; -}; - -&ram21_region { - status = "okay"; -}; - &cpuapp_bellboard { status = "okay"; interrupts = <96 NRF_DEFAULT_IRQ_PRIORITY>; diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_0_9_0.yaml b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_0_9_0.yaml index 832689be8e1d..4e82987d28e5 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_0_9_0.yaml +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_0_9_0.yaml @@ -9,7 +9,7 @@ toolchain: - gnuarmemb - zephyr sysbuild: true -ram: 256 +ram: 760 flash: 392 supported: - adc diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts index 2813d5b11741..5473d9a7405a 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts @@ -36,14 +36,6 @@ }; }; -&cpuapp_cpurad_ram0x_region { - status = "okay"; -}; - -&cpurad_ram0x_region { - status = "okay"; -}; - &cpurad_bellboard { status = "okay"; interrupts = <96 NRF_DEFAULT_IRQ_PRIORITY>; diff --git a/dts/vendor/nordic/nrf54h20.dtsi b/dts/vendor/nordic/nrf54h20.dtsi index b57c718a9e2b..241a8206f9af 100644 --- a/dts/vendor/nordic/nrf54h20.dtsi +++ b/dts/vendor/nordic/nrf54h20.dtsi @@ -14,7 +14,6 @@ #include #include #include -#include #include /delete-node/ &sw_pwm; diff --git a/samples/application_development/code_relocation_nocopy/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/samples/application_development/code_relocation_nocopy/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index ab53f12725d7..98d67e2ad082 100644 --- a/samples/application_development/code_relocation_nocopy/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/samples/application_development/code_relocation_nocopy/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -1,10 +1,5 @@ -&cpuapp_ram0x_region { - nordic,access = ; -}; - &xip_region { status = "okay"; - nordic,access = ; }; &mx25uw63 { diff --git a/samples/boards/nordic/coresight_stm/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/samples/boards/nordic/coresight_stm/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index bf5ba18d2044..970377c4d896 100644 --- a/samples/boards/nordic/coresight_stm/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/samples/boards/nordic/coresight_stm/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -7,10 +7,6 @@ status = "okay"; }; -&cpuppr_ram3x_region { - status = "okay"; -}; - &cpuflpr_vpr { status = "okay"; }; diff --git a/snippets/nordic-ppr-xip/soc/nrf54h20_cpuapp.overlay b/snippets/nordic-ppr-xip/soc/nrf54h20_cpuapp.overlay index 4d02921660b5..2d884a3455a2 100644 --- a/snippets/nordic-ppr-xip/soc/nrf54h20_cpuapp.overlay +++ b/snippets/nordic-ppr-xip/soc/nrf54h20_cpuapp.overlay @@ -3,10 +3,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -&cpuppr_ram3x_region { - status = "okay"; -}; - &cpuppr_vpr { execution-memory = <&cpuppr_code_partition>; /delete-property/ source-memory; diff --git a/snippets/nordic-ppr/soc/nrf54h20_cpuapp.overlay b/snippets/nordic-ppr/soc/nrf54h20_cpuapp.overlay index 75128f42a13f..ae635c9ca9b6 100644 --- a/snippets/nordic-ppr/soc/nrf54h20_cpuapp.overlay +++ b/snippets/nordic-ppr/soc/nrf54h20_cpuapp.overlay @@ -3,10 +3,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -&cpuppr_ram3x_region { - status = "okay"; -}; - &uart135 { status = "reserved"; }; diff --git a/tests/arch/common/ramfunc/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/arch/common/ramfunc/boards/nrf54h20dk_nrf54h20_cpuapp.overlay deleted file mode 100644 index ad84324a3e94..000000000000 --- a/tests/arch/common/ramfunc/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -&cpuapp_ram0x_region { - nordic,access = ; -}; diff --git a/tests/boards/nrf/coresight_stm/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/boards/nrf/coresight_stm/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index bf5ba18d2044..970377c4d896 100644 --- a/tests/boards/nrf/coresight_stm/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/tests/boards/nrf/coresight_stm/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -7,10 +7,6 @@ status = "okay"; }; -&cpuppr_ram3x_region { - status = "okay"; -}; - &cpuflpr_vpr { status = "okay"; }; From 3ad7a6d1a6bfb5b71213a96732ed58ed66086cf2 Mon Sep 17 00:00:00 2001 From: Jonathan Nilsen Date: Wed, 18 Jun 2025 11:55:27 +0200 Subject: [PATCH 0438/2141] [nrf fromtree] dts: nordic: update UICR definition on nrf54h20 With IronSide SE there is only one defined UICR which is at the location of the APPLICATION UICR. Update the devicetree definition accordingly, and use the "nordic,nrf-uicr" compatible on the node since the domain distinction added by the v2 compatible is no longer relevant. Signed-off-by: Jonathan Nilsen (cherry picked from commit b43ae17fdd460a5963b985fed1ff11ea83e82bb7) --- dts/vendor/nordic/nrf54h20.dtsi | 11 ++--------- soc/nordic/validate_base_addresses.c | 4 ++++ 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/dts/vendor/nordic/nrf54h20.dtsi b/dts/vendor/nordic/nrf54h20.dtsi index 241a8206f9af..05ae6df5d0f6 100644 --- a/dts/vendor/nordic/nrf54h20.dtsi +++ b/dts/vendor/nordic/nrf54h20.dtsi @@ -226,13 +226,12 @@ write-block-size = <16>; }; - cpuapp_uicr: uicr@fff8000 { - compatible = "nordic,nrf-uicr-v2"; + uicr: uicr@fff8000 { + compatible = "nordic,nrf-uicr"; reg = <0xfff8000 DT_SIZE_K(2)>; #address-cells = <1>; #size-cells = <1>; ranges = <0x0 0xfff8000 DT_SIZE_K(2)>; - domain = <2>; bicr: bicr@7b0 { compatible = "nordic,nrf-bicr"; @@ -240,12 +239,6 @@ }; }; - cpurad_uicr: uicr@fffa000 { - compatible = "nordic,nrf-uicr-v2"; - reg = <0xfffa000 DT_SIZE_K(2)>; - domain = <3>; - }; - ficr: ficr@fffe000 { compatible = "nordic,nrf-ficr"; reg = <0xfffe000 DT_SIZE_K(2)>; diff --git a/soc/nordic/validate_base_addresses.c b/soc/nordic/validate_base_addresses.c index 1c5c39f74ec1..f3c9c8bf2145 100644 --- a/soc/nordic/validate_base_addresses.c +++ b/soc/nordic/validate_base_addresses.c @@ -335,7 +335,11 @@ CHECK_DT_REG(uart134, NRF_UARTE134); CHECK_DT_REG(uart135, NRF_UARTE135); CHECK_DT_REG(uart136, NRF_UARTE136); CHECK_DT_REG(uart137, NRF_UARTE137); +#if !defined(CONFIG_SOC_SERIES_NRF54HX) CHECK_DT_REG(uicr, NRF_UICR); +#else +CHECK_DT_REG(uicr, NRF_APPLICATION_UICR); +#endif CHECK_DT_REG(cpuapp_uicr, NRF_APPLICATION_UICR); CHECK_DT_REG(bicr, NRF_APPLICATION_BICR); CHECK_DT_REG(cpurad_uicr, NRF_RADIOCORE_UICR); From ed57bd891abe731ba2cbafeb0f4e1329ed51572d Mon Sep 17 00:00:00 2001 From: Jonathan Nilsen Date: Wed, 18 Jun 2025 12:02:39 +0200 Subject: [PATCH 0439/2141] [nrf fromtree] soc: nordic: add IronSide SE compatible UICR support Add support for generating UICR and associated artifacts in a format compatible with IronSide SE, to be used for Nordic SoCs in the Haltium family. The main feature added with this is the ability to configure certain global domain peripherals that are managed by the secure domain through setting UICR.PERIPHCONF. This register points at a blob of (register address, register value) pairs which are loaded into the peripherals by IronSide SE ahead of the application boot. The added helper macros in uicr.h can be used to add register configurations to the PERIPHCONF. Entries added through these macros are then extracted by a script, post-processed and placed in a blob located at specific part of MRAM. A default PERIPHCONF configuration has been added for the nrf54h20 soc to support the standard BLE use case (matching the configuration in the soc devicetree). Signed-off-by: Jonathan Nilsen (cherry picked from commit 56b6e575212e5868f7b4cc90a152e4957ccea3af) --- .../nrf54h20dk_nrf54h20-memory_map.dtsi | 4 + soc/nordic/common/CMakeLists.txt | 4 + soc/nordic/common/Kconfig | 1 + soc/nordic/common/uicr/CMakeLists.txt | 36 ++ soc/nordic/common/uicr/Kconfig | 31 ++ soc/nordic/common/uicr/gen_uicr.py | 270 +++++++++++++++ soc/nordic/common/uicr/uicr.h | 308 ++++++++++++++++++ soc/nordic/common/uicr/uicr.ld | 11 + 8 files changed, 665 insertions(+) create mode 100644 soc/nordic/common/uicr/CMakeLists.txt create mode 100644 soc/nordic/common/uicr/Kconfig create mode 100644 soc/nordic/common/uicr/gen_uicr.py create mode 100644 soc/nordic/common/uicr/uicr.h create mode 100644 soc/nordic/common/uicr/uicr.ld diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi index aa6ebc629cc2..b6a53955c60e 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi @@ -162,5 +162,9 @@ storage_partition: partition@1a4000 { reg = <0x1a4000 DT_SIZE_K(40)>; }; + + periphconf_partition: partition@1ae000 { + reg = <0x1ae000 DT_SIZE_K(8)>; + }; }; }; diff --git a/soc/nordic/common/CMakeLists.txt b/soc/nordic/common/CMakeLists.txt index ac75d0838696..825be4842fb7 100644 --- a/soc/nordic/common/CMakeLists.txt +++ b/soc/nordic/common/CMakeLists.txt @@ -3,6 +3,10 @@ add_subdirectory_ifdef(CONFIG_RISCV_CORE_NORDIC_VPR vpr) +if(CONFIG_NRF_PERIPHCONF_SECTION OR CONFIG_NRF_HALTIUM_GENERATE_UICR) + add_subdirectory(uicr) +endif() + # Let SystemInit() be called in place of soc_reset_hook() by default. zephyr_linker_symbol(SYMBOL soc_reset_hook EXPR "@SystemInit@") diff --git a/soc/nordic/common/Kconfig b/soc/nordic/common/Kconfig index 059274fd299f..782d9452b677 100644 --- a/soc/nordic/common/Kconfig +++ b/soc/nordic/common/Kconfig @@ -49,3 +49,4 @@ source "subsys/logging/Kconfig.template.log_config" endif # MRAM_LATENCY rsource "vpr/Kconfig" +rsource "uicr/Kconfig" diff --git a/soc/nordic/common/uicr/CMakeLists.txt b/soc/nordic/common/uicr/CMakeLists.txt new file mode 100644 index 000000000000..0bde6b47f576 --- /dev/null +++ b/soc/nordic/common/uicr/CMakeLists.txt @@ -0,0 +1,36 @@ +# Copyright (c) 2025 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +if(CONFIG_NRF_PERIPHCONF_SECTION) + zephyr_linker_sources(SECTIONS uicr.ld) +endif() + +if(CONFIG_NRF_HALTIUM_GENERATE_UICR) + if(CONFIG_NRF_PERIPHCONF_SECTION) + set(in_periphconf_elf_arg + --in-periphconf-elf $ + ) + endif() + + if(CONFIG_NRF_HALTIUM_UICR_PERIPHCONF) + set(periphconf_hex_file ${PROJECT_BINARY_DIR}/periphconf.hex) + set(out_periphconf_hex_arg + --out-periphconf-hex ${periphconf_hex_file} + ) + list(APPEND optional_byproducts ${periphconf_hex_file}) + endif() + + set(uicr_hex_file ${PROJECT_BINARY_DIR}/uicr.hex) + set_property(GLOBAL APPEND PROPERTY extra_post_build_commands + COMMAND ${CMAKE_COMMAND} -E env PYTHONPATH=${ZEPHYR_BASE}/scripts/dts/python-devicetree/src + ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_LIST_DIR}/gen_uicr.py + --in-config ${DOTCONFIG} + --in-edt-pickle ${EDT_PICKLE} + ${in_periphconf_elf_arg} + ${out_periphconf_hex_arg} + --out-uicr-hex ${uicr_hex_file} + ) + set_property(GLOBAL APPEND PROPERTY extra_post_build_byproducts + ${uicr_hex_file} ${optional_byproducts} + ) +endif() diff --git a/soc/nordic/common/uicr/Kconfig b/soc/nordic/common/uicr/Kconfig new file mode 100644 index 000000000000..f132510a7a5d --- /dev/null +++ b/soc/nordic/common/uicr/Kconfig @@ -0,0 +1,31 @@ +# Copyright (c) 2025 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config NRF_HALTIUM_GENERATE_UICR + bool "Generate UICR file" + depends on SOC_NRF54H20_CPUAPP + default y + help + Generate UICR HEX file. + +if NRF_HALTIUM_GENERATE_UICR + +config NRF_HALTIUM_UICR_PERIPHCONF + bool "Initialize global domain peripherals" + default y + help + Generates a blob containing static global domain peripheral initialization + values extracted from the build artifacts, and configures UICR.PERIPHCONF + to point at the blob. The initialization values are then loaded ahead of + ahead of the application boot. + +endif + +config NRF_PERIPHCONF_SECTION + bool "Populate global peripheral initialization section" + default y if SOC_NRF54H20_CPUAPP + depends on LINKER_DEVNULL_SUPPORT + imply LINKER_DEVNULL_MEMORY + help + Include static global domain peripheral initialization values from the + build in a dedicated section in the devnull region. diff --git a/soc/nordic/common/uicr/gen_uicr.py b/soc/nordic/common/uicr/gen_uicr.py new file mode 100644 index 000000000000..50f96eab566f --- /dev/null +++ b/soc/nordic/common/uicr/gen_uicr.py @@ -0,0 +1,270 @@ +""" +Copyright (c) 2025 Nordic Semiconductor ASA +SPDX-License-Identifier: Apache-2.0 +""" + +from __future__ import annotations + +import argparse +import ctypes as c +import math +import pickle +import re +import sys +from collections import defaultdict +from itertools import groupby + +from elftools.elf.elffile import ELFFile +from intelhex import IntelHex + +# Name of the ELF section containing PERIPHCONF entries. +# Must match the name used in the linker script. +PERIPHCONF_SECTION = "uicr_periphconf_entry" + +# Expected nodelabel of the UICR devicetree node, used to extract its location from the devicetree. +UICR_NODELABEL = "uicr" +# Nodelabel of the PERIPHCONF devicetree node, used to extract its location from the devicetree. +PERIPHCONF_NODELABEL = "periphconf_partition" + +# Common values for representing enabled/disabled in the UICR format. +ENABLED_VALUE = 0xFFFF_FFFF +DISABLED_VALUE = 0xBD23_28A8 + + +class ScriptError(RuntimeError): ... + + +class PeriphconfEntry(c.LittleEndianStructure): + _pack_ = 1 + _fields_ = [ + ("regptr", c.c_uint32), + ("value", c.c_uint32), + ] + + +PERIPHCONF_ENTRY_SIZE = c.sizeof(PeriphconfEntry) + + +class Approtect(c.LittleEndianStructure): + _pack_ = 1 + _fields_ = [ + ("APPLICATION", c.c_uint32), + ("RADIOCORE", c.c_uint32), + ("RESERVED", c.c_uint32), + ("CORESIGHT", c.c_uint32), + ] + + +class Protectedmem(c.LittleEndianStructure): + _pack_ = 1 + _fields_ = [ + ("ENABLE", c.c_uint32), + ("SIZE4KB", c.c_uint32), + ] + + +class Recovery(c.LittleEndianStructure): + _pack_ = 1 + _fields_ = [ + ("ENABLE", c.c_uint32), + ("PROCESSOR", c.c_uint32), + ("INITSVTOR", c.c_uint32), + ("SIZE4KB", c.c_uint32), + ] + + +class Its(c.LittleEndianStructure): + _pack_ = 1 + _fields_ = [ + ("ENABLE", c.c_uint32), + ("ADDRESS", c.c_uint32), + ("APPLICATIONSIZE", c.c_uint32), + ("RADIOCORESIZE", c.c_uint32), + ] + + +class Periphconf(c.LittleEndianStructure): + _pack_ = 1 + _fields_ = [ + ("ENABLE", c.c_uint32), + ("ADDRESS", c.c_uint32), + ("MAXCOUNT", c.c_uint32), + ] + + +class Mpcconf(c.LittleEndianStructure): + _pack_ = 1 + _fields_ = [ + ("ENABLE", c.c_uint32), + ("ADDRESS", c.c_uint32), + ("MAXCOUNT", c.c_uint32), + ] + + +class Uicr(c.LittleEndianStructure): + _pack_ = 1 + _fields_ = [ + ("VERSION", c.c_uint32), + ("RESERVED", c.c_uint32), + ("LOCK", c.c_uint32), + ("RESERVED1", c.c_uint32), + ("APPROTECT", Approtect), + ("ERASEPROTECT", c.c_uint32), + ("PROTECTEDMEM", Protectedmem), + ("RECOVERY", Recovery), + ("ITS", Its), + ("RESERVED2", c.c_uint32 * 7), + ("PERIPHCONF", Periphconf), + ("MPCCONF", Mpcconf), + ] + + +def main() -> None: + parser = argparse.ArgumentParser( + allow_abbrev=False, + description=( + "Generate artifacts for the UICR and associated configuration blobs from application " + "build outputs. User Information Configuration Registers (UICR), in the context of " + "certain Nordic SoCs, are used to configure system resources, like memory and " + "peripherals, and to protect the device in various ways." + ), + ) + parser.add_argument( + "--in-config", + required=True, + type=argparse.FileType("r"), + help="Path to the .config file from the application build", + ) + parser.add_argument( + "--in-edt-pickle", + required=True, + type=argparse.FileType("rb"), + help="Path to the edt.pickle file from the application build", + ) + parser.add_argument( + "--in-periphconf-elf", + dest="in_periphconf_elfs", + default=[], + action="append", + type=argparse.FileType("rb"), + help=( + "Path to an ELF file to extract PERIPHCONF data from. Can be provided multiple times. " + "The PERIPHCONF data from each ELF file is combined in a single list which is sorted " + "by ascending address and cleared of duplicate entries." + ), + ) + parser.add_argument( + "--out-uicr-hex", + required=True, + type=argparse.FileType("w", encoding="utf-8"), + help="Path to write the generated UICR HEX file to", + ) + parser.add_argument( + "--out-periphconf-hex", + default=None, + type=argparse.FileType("w", encoding="utf-8"), + help="Path to write the generated PERIPHCONF HEX file to", + ) + args = parser.parse_args() + + try: + init_values = DISABLED_VALUE.to_bytes(4, "little") * (c.sizeof(Uicr) // 4) + uicr = Uicr.from_buffer_copy(init_values) + + kconfig_str = args.in_config.read() + kconfig = parse_kconfig(kconfig_str) + + edt = pickle.load(args.in_edt_pickle) + + try: + periphconf_partition = edt.label2node[PERIPHCONF_NODELABEL] + except LookupError as e: + raise ScriptError( + "Failed to find a PERIPHCONF partition in the devicetree. " + f"Expected a DT node with label '{PERIPHCONF_NODELABEL}'." + ) from e + + flash_base_address = periphconf_partition.flash_controller.regs[0].addr + periphconf_address = flash_base_address + periphconf_partition.regs[0].addr + periphconf_size = periphconf_partition.regs[0].size + + periphconf_combined = extract_and_combine_periphconfs(args.in_periphconf_elfs) + padding_len = periphconf_size - len(periphconf_combined) + periphconf_final = periphconf_combined + bytes([0xFF for _ in range(padding_len)]) + + if kconfig.get("CONFIG_NRF_HALTIUM_UICR_PERIPHCONF") == "y": + uicr.PERIPHCONF.ENABLE = ENABLED_VALUE + uicr.PERIPHCONF.ADDRESS = periphconf_address + uicr.PERIPHCONF.MAXCOUNT = math.floor(periphconf_size / 8) + + try: + uicr_node = edt.label2node[UICR_NODELABEL] + except LookupError as e: + raise ScriptError( + "Failed to find UICR node in the devicetree. " + f"Expected a DT node with label '{UICR_NODELABEL}'." + ) from e + + uicr_hex = IntelHex() + uicr_hex.frombytes(bytes(uicr), offset=uicr_node.regs[0].addr) + + uicr_hex.write_hex_file(args.out_uicr_hex) + + if args.out_periphconf_hex is not None: + periphconf_hex = IntelHex() + periphconf_hex.frombytes(periphconf_final, offset=periphconf_address) + periphconf_hex.write_hex_file(args.out_periphconf_hex) + + except ScriptError as e: + print(f"Error: {e!s}") + sys.exit(1) + + +def extract_and_combine_periphconfs(elf_files: list[argparse.FileType]) -> bytes: + combined_periphconf = [] + + for in_file in elf_files: + elf = ELFFile(in_file) + conf_section = elf.get_section_by_name(PERIPHCONF_SECTION) + if conf_section is None: + continue + + conf_section_data = conf_section.data() + num_entries = len(conf_section_data) // PERIPHCONF_ENTRY_SIZE + periphconf = (PeriphconfEntry * num_entries).from_buffer_copy(conf_section_data) + combined_periphconf.extend(periphconf) + + combined_periphconf.sort(key=lambda e: e.regptr) + deduplicated_periphconf = [] + + for regptr, regptr_entries in groupby(combined_periphconf, key=lambda e: e.regptr): + entries = list(regptr_entries) + if len(entries) > 1: + unique_values = {e.value for e in entries} + if len(unique_values) > 1: + raise ScriptError( + f"PERIPHCONF has conflicting values for register 0x{regptr:09_x}: " + + ", ".join([f"0x{val:09_x}" for val in unique_values]) + ) + deduplicated_periphconf.append(entries[0]) + + final_periphconf = (PeriphconfEntry * len(deduplicated_periphconf))() + for i, entry in enumerate(deduplicated_periphconf): + final_periphconf[i] = entry + + return bytes(final_periphconf) + + +def parse_kconfig(content: str) -> dict[str, str | None]: + result = defaultdict(None) + match_iter = re.finditer( + r"^(?P(SB_)?CONFIG_[^=\s]+)=(?P[^\s#])+$", content, re.MULTILINE + ) + for match in match_iter: + result[match["config"]] = match["value"] + + return result + + +if __name__ == "__main__": + main() diff --git a/soc/nordic/common/uicr/uicr.h b/soc/nordic/common/uicr/uicr.h new file mode 100644 index 000000000000..7ceb12429e22 --- /dev/null +++ b/soc/nordic/common/uicr/uicr.h @@ -0,0 +1,308 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef SOC_NORDIC_COMMON_UICR_UICR_H_ +#define SOC_NORDIC_COMMON_UICR_UICR_H_ + +#include +#include +#include +#include +#include + +/** Entry in the PERIPHCONF table. */ +struct uicr_periphconf_entry { + /** Register pointer. */ + uint32_t regptr; + /** Register value. */ + uint32_t value; +} __packed; + +/** @brief Add an entry to the PERIPHCONF table section. + * + * This should typically not be used directly. + * Prefer to use one of the higher level macros. + */ +#define UICR_PERIPHCONF_ADD(_regptr, _value) \ + static STRUCT_SECTION_ITERABLE(uicr_periphconf_entry, \ + _UICR_PERIPHCONF_ENTRY_NAME(__COUNTER__)) = { \ + .regptr = (_regptr), \ + .value = (_value), \ + } + +#define _UICR_PERIPHCONF_ENTRY_NAME(_id) __UICR_PERIPHCONF_ENTRY_NAME(_id) +#define __UICR_PERIPHCONF_ENTRY_NAME(_id) _uicr_periphconf_entry_##_id + +/** @brief Add a PERIPHCONF entry for a SPU PERIPH[n].PERM register value. + * + * @param _spu Global domain SPU instance address. + * @param _index Peripheral slave index on the bus (PERIPH[n] register index). + * @param _secattr If true, set SECATTR to secure, otherwise set it to non-secure. + * @param _dmasec If true, set DMASEC to secure, otherwise set it to non-secure. + * @param _ownerid OWNERID field value. + */ +#define UICR_SPU_PERIPH_PERM_SET(_spu, _index, _secattr, _dmasec, _ownerid) \ + UICR_PERIPHCONF_ADD((uint32_t)&((NRF_SPU_Type *)(_spu))->PERIPH[(_index)].PERM, \ + (uint32_t)((((_ownerid) << SPU_PERIPH_PERM_OWNERID_Pos) & \ + SPU_PERIPH_PERM_OWNERID_Msk) | \ + (((_secattr) ? SPU_PERIPH_PERM_SECATTR_Secure \ + : SPU_PERIPH_PERM_SECATTR_NonSecure) \ + << SPU_PERIPH_PERM_SECATTR_Pos) | \ + (((_dmasec) ? SPU_PERIPH_PERM_DMASEC_Secure \ + : SPU_PERIPH_PERM_DMASEC_NonSecure) \ + << SPU_PERIPH_PERM_DMASEC_Pos) | \ + (SPU_PERIPH_PERM_LOCK_Locked << SPU_PERIPH_PERM_LOCK_Pos))) + +/** @brief Add a PERIPHCONF entry for a SPU FEATURE.IPCT.CH[n] register value. + * + * @param _spu Global domain SPU instance address. + * @param _index Feature index. + * @param _secattr If true, set SECATTR to secure, otherwise set it to non-secure. + * @param _ownerid OWNERID field value. + */ +#define UICR_SPU_FEATURE_IPCT_CH_SET(_spu, _index, _secattr, _ownerid) \ + UICR_PERIPHCONF_ADD((uint32_t)&((NRF_SPU_Type *)(_spu))->FEATURE.IPCT.CH[_index], \ + _UICR_SPU_FEATURE_VAL(_secattr, _ownerid)) + +/** @brief Add a PERIPHCONF entry for a SPU FEATURE.IPCT.INTERRUPT[n] register value. + * + * @param _spu Global domain SPU instance address. + * @param _index Feature index. + * @param _secattr If true, set SECATTR to secure, otherwise set it to non-secure. + * @param _ownerid OWNERID field value. + */ +#define UICR_SPU_FEATURE_IPCT_INTERRUPT_SET(_spu, _index, _secattr, _ownerid) \ + UICR_PERIPHCONF_ADD((uint32_t)&((NRF_SPU_Type *)(_spu))->FEATURE.IPCT.INTERRUPT[_index], \ + _UICR_SPU_FEATURE_VAL(_secattr, _ownerid)) + +/** @brief Add a PERIPHCONF entry for a SPU FEATURE.DPPIC.CH[n] register value. + * + * @param _spu Global domain SPU instance address. + * @param _index Feature index. + * @param _secattr If true, set SECATTR to secure, otherwise set it to non-secure. + * @param _ownerid OWNERID field value. + */ +#define UICR_SPU_FEATURE_DPPIC_CH_SET(_spu, _index, _secattr, _ownerid) \ + UICR_PERIPHCONF_ADD((uint32_t)&((NRF_SPU_Type *)(_spu))->FEATURE.DPPIC.CH[_index], \ + _UICR_SPU_FEATURE_VAL(_secattr, _ownerid)) + +/** @brief Add a PERIPHCONF entry for a SPU FEATURE.DPPIC.CHG[n] register value. + * + * @param _spu Global domain SPU instance address. + * @param _index Register index. + * @param _secattr If true, set SECATTR to secure, otherwise set it to non-secure. + * @param _ownerid OWNERID field value. + */ +#define UICR_SPU_FEATURE_DPPIC_CHG_SET(_spu, _index, _secattr, _ownerid) \ + UICR_PERIPHCONF_ADD((uint32_t)&((NRF_SPU_Type *)(_spu))->FEATURE.DPPIC.CHG[_index], \ + _UICR_SPU_FEATURE_VAL(_secattr, _ownerid)) + +/** @brief Add a PERIPHCONF entry for a SPU FEATURE.GPIOTE[n].CH[m] register value. + * + * @param _spu Global domain SPU instance address. + * @param _index Feature index (GPIOTE[n] register index). + * @param _subindex Feature subindex (CH[m] register index). + * @param _secattr If true, set the SECATTR to secure, otherwise set it to non-secure. + * @param _ownerid OWNERID field value. + */ +#define UICR_SPU_FEATURE_GPIOTE_CH_SET(_spu, _index, _subindex, _secattr, _ownerid) \ + UICR_PERIPHCONF_ADD( \ + (uint32_t)&((NRF_SPU_Type *)(_spu))->FEATURE.GPIOTE[_index].CH[_subindex], \ + _UICR_SPU_FEATURE_VAL(_secattr, _ownerid)) + +/** @brief Add a PERIPHCONF entry for a SPU FEATURE.GPIOTE.INTERRUPT[n] register value. + * + * @param _spu Global domain SPU instance address. + * @param _index Feature index. + * @param _subindex Feature subindex. + * @param _secattr If true, set SECATTR to secure, otherwise set it to non-secure. + * @param _ownerid OWNERID field value. + */ +#define UICR_SPU_FEATURE_GPIOTE_INTERRUPT_SET(_spu, _index, _subindex, _secattr, _ownerid) \ + UICR_PERIPHCONF_ADD( \ + (uint32_t)&((NRF_SPU_Type *)(_spu))->FEATURE.GPIOTE[_index].INTERRUPT[_subindex], \ + _UICR_SPU_FEATURE_VAL(_secattr, _ownerid)) + +/** @brief Add a PERIPHCONF entry for a SPU FEATURE.GPIO[n].PIN[m] register value. + * + * @param _spu Global domain SPU instance address. + * @param _index Feature index. + * @param _subindex Feature subindex. + * @param _secattr If true, set SECATTR to secure, otherwise set it to non-secure. + * @param _ownerid OWNERID field value. + */ +#define UICR_SPU_FEATURE_GPIO_PIN_SET(_spu, _index, _subindex, _secattr, _ownerid) \ + UICR_PERIPHCONF_ADD( \ + (uint32_t)&((NRF_SPU_Type *)(_spu))->FEATURE.GPIO[_index].PIN[_subindex], \ + _UICR_SPU_FEATURE_VAL(_secattr, _ownerid)) + +/** @brief Add a PERIPHCONF entry for a SPU FEATURE.GRTC.CC[n] register value. + * + * @param _spu Global domain SPU instance address. + * @param _index Feature index. + * @param _secattr If true, set SECATTR to secure, otherwise set it to non-secure. + * @param _ownerid OWNERID field value. + */ +#define UICR_SPU_FEATURE_GRTC_CC_SET(_spu, _index, _secattr, _ownerid) \ + UICR_PERIPHCONF_ADD((uint32_t)&((NRF_SPU_Type *)(_spu))->FEATURE.GRTC.CC[_index], \ + _UICR_SPU_FEATURE_VAL(_secattr, _ownerid)) + +/* Common macro for encoding a SPU FEATURE.* register value. + * Note that the MDK SPU_FEATURE_IPCT_CH_ macros are used for all since all the FEATURE registers + * have the same layout with different naming. + */ +#define _UICR_SPU_FEATURE_VAL(_secattr, _ownerid) \ + (uint32_t)((((_ownerid) << SPU_FEATURE_IPCT_CH_OWNERID_Pos) & \ + SPU_FEATURE_IPCT_CH_OWNERID_Msk) | \ + (((_secattr) ? SPU_FEATURE_IPCT_CH_SECATTR_Secure \ + : SPU_FEATURE_IPCT_CH_SECATTR_NonSecure) \ + << SPU_FEATURE_IPCT_CH_SECATTR_Pos) | \ + (SPU_FEATURE_IPCT_CH_LOCK_Locked << SPU_FEATURE_IPCT_CH_LOCK_Pos)) + +/** @brief Add PERIPHCONF entries for configuring IPCMAP CHANNEL.SOURCE[n] and CHANNEL.SINK[n]. + * + * @param _index CHANNEL.SOURCE[n]/CHANNEL.SINK[n] register index. + * @param _source_domain DOMAIN field value in CHANNEL[n].SOURCE. + * @param _source_ch SOURCE field value in CHANNEL[n].SOURCE. + * @param _sink_domain DOMAIN field value in CHANNEL[n].SINK. + * @param _sink_ch SINK field value in CHANNEL[n].SINK. + */ +#define UICR_IPCMAP_CHANNEL_CFG(_index, _source_domain, _source_ch, _sink_domain, _sink_ch) \ + UICR_IPCMAP_CHANNEL_SOURCE_SET(_index, _source_domain, _source_ch, 1); \ + UICR_IPCMAP_CHANNEL_SINK_SET(_index, _sink_domain, _sink_ch) + +#define UICR_IPCMAP_CHANNEL_SOURCE_SET(_index, _domain, _ch, _enable) \ + UICR_PERIPHCONF_ADD((uint32_t)&NRF_IPCMAP->CHANNEL[(_index)].SOURCE, \ + (uint32_t)((((_domain) << IPCMAP_CHANNEL_SOURCE_DOMAIN_Pos) & \ + IPCMAP_CHANNEL_SOURCE_DOMAIN_Msk) | \ + (((_ch) << IPCMAP_CHANNEL_SOURCE_SOURCE_Pos) & \ + IPCMAP_CHANNEL_SOURCE_SOURCE_Msk) | \ + (((_enable) ? IPCMAP_CHANNEL_SOURCE_ENABLE_Enabled \ + : IPCMAP_CHANNEL_SOURCE_ENABLE_Disabled) \ + << IPCMAP_CHANNEL_SOURCE_ENABLE_Pos))) + +#define UICR_IPCMAP_CHANNEL_SINK_SET(_index, _domain, _ch) \ + UICR_PERIPHCONF_ADD((uint32_t)&NRF_IPCMAP->CHANNEL[(_index)].SINK, \ + (uint32_t)((((_domain) << IPCMAP_CHANNEL_SINK_DOMAIN_Pos) & \ + IPCMAP_CHANNEL_SINK_DOMAIN_Msk) | \ + (((_ch) << IPCMAP_CHANNEL_SINK_SINK_Pos) & \ + IPCMAP_CHANNEL_SINK_SINK_Msk))) + +/** @brief Add a PERIPHCONF entry for an IRQMAP IRQ[n].SINK register value. + * + * @param _irqnum IRQ number (IRQ[n] register index). + * @param _processor Processor to route the interrupt to (PROCESSORID field value). + */ +#define UICR_IRQMAP_IRQ_SINK_SET(_irqnum, _processor) \ + UICR_PERIPHCONF_ADD((uint32_t)&NRF_IRQMAP->IRQ[(_irqnum)].SINK, \ + (uint32_t)(((_processor) << IRQMAP_IRQ_SINK_PROCESSORID_Pos) & \ + IRQMAP_IRQ_SINK_PROCESSORID_Msk)) + +/** @brief Add a PERIPHCONF entry for configuring a GPIO PIN_CNF[n] CTRLSEL field value. + * + * @param _gpio GPIO instance address. + * @param _pin Pin number (PIN_CNF[n] register index). + * @param _ctrlsel CTRLSEL field value. + */ +#define UICR_GPIO_PIN_CNF_CTRLSEL_SET(_gpio, _pin, _ctrlsel) \ + UICR_PERIPHCONF_ADD( \ + (uint32_t)&((NRF_GPIO_Type *)(_gpio))->PIN_CNF[(_pin)], \ + ((GPIO_PIN_CNF_ResetValue) | \ + (uint32_t)(((_ctrlsel) << GPIO_PIN_CNF_CTRLSEL_Pos) & GPIO_PIN_CNF_CTRLSEL_Msk))) + +/** @brief Add a PERIPHCONF entry for a PPIB SUBSCRIBE_SEND[n] register. + * + * @param _ppib Global domain PPIB instance address. + * @param _ppib_ch PPIB channel number. + */ +#define UICR_PPIB_SUBSCRIBE_SEND_ENABLE(_ppib, _ppib_ch) \ + UICR_PERIPHCONF_ADD((uint32_t)&((NRF_PPIB_Type *)(_ppib))->SUBSCRIBE_SEND[(_ppib_ch)], \ + (uint32_t)PPIB_SUBSCRIBE_SEND_EN_Msk) + +/** @brief Add a PERIPHCONF entry for a PPIB PUBLISH_RECEIVE[n] register. + * + * @param _ppib Global domain PPIB instance address. + * @param _ppib_ch PPIB channel number. + */ +#define UICR_PPIB_PUBLISH_RECEIVE_ENABLE(_ppib, _ppib_ch) \ + UICR_PERIPHCONF_ADD((uint32_t)&((NRF_PPIB_Type *)(_ppib))->PUBLISH_RECEIVE[(_ppib_ch)], \ + (uint32_t)PPIB_PUBLISH_RECEIVE_EN_Msk) + +/* The definitions below are not currently available in the MDK but are needed for the macros + * above. When they are, this can be deleted. + */ +#ifndef IPCMAP_CHANNEL_SOURCE_SOURCE_Msk + +typedef struct { + __IOM uint32_t SOURCE; + __IOM uint32_t SINK; +} NRF_IPCMAP_CHANNEL_Type; + +#define IPCMAP_CHANNEL_SOURCE_SOURCE_Pos (0UL) +#define IPCMAP_CHANNEL_SOURCE_SOURCE_Msk (0xFUL << IPCMAP_CHANNEL_SOURCE_SOURCE_Pos) +#define IPCMAP_CHANNEL_SOURCE_DOMAIN_Pos (8UL) +#define IPCMAP_CHANNEL_SOURCE_DOMAIN_Msk (0xFUL << IPCMAP_CHANNEL_SOURCE_DOMAIN_Pos) +#define IPCMAP_CHANNEL_SOURCE_ENABLE_Pos (31UL) +#define IPCMAP_CHANNEL_SOURCE_ENABLE_Disabled (0x0UL) +#define IPCMAP_CHANNEL_SOURCE_ENABLE_Enabled (0x1UL) +#define IPCMAP_CHANNEL_SINK_SINK_Pos (0UL) +#define IPCMAP_CHANNEL_SINK_SINK_Msk (0xFUL << IPCMAP_CHANNEL_SINK_SINK_Pos) +#define IPCMAP_CHANNEL_SINK_DOMAIN_Pos (8UL) +#define IPCMAP_CHANNEL_SINK_DOMAIN_Msk (0xFUL << IPCMAP_CHANNEL_SINK_DOMAIN_Pos) + +typedef struct { + __IM uint32_t RESERVED[256]; + __IOM NRF_IPCMAP_CHANNEL_Type CHANNEL[16]; +} NRF_IPCMAP_Type; + +#endif /* IPCMAP_CHANNEL_SOURCE_SOURCE_Msk */ + +#ifndef NRF_IPCMAP +#define NRF_IPCMAP ((NRF_IPCMAP_Type *)0x5F923000UL) +#endif + +#ifndef IRQMAP_IRQ_SINK_PROCESSORID_Msk + +typedef struct { + __IOM uint32_t SINK; +} NRF_IRQMAP_IRQ_Type; + +#define IRQMAP_IRQ_SINK_PROCESSORID_Pos (8UL) +#define IRQMAP_IRQ_SINK_PROCESSORID_Msk (0xFUL << IRQMAP_IRQ_SINK_PROCESSORID_Pos) + +typedef struct { + __IM uint32_t RESERVED[256]; + __IOM NRF_IRQMAP_IRQ_Type IRQ[480]; +} NRF_IRQMAP_Type; + +#endif /* IRQMAP_IRQ_SINK_PROCESSORID_Msk */ + +#ifndef NRF_IRQMAP +#define NRF_IRQMAP ((NRF_IRQMAP_Type *)0x5F924000UL) +#endif /* NRF_IRQMAP */ + +#ifndef GPIO_PIN_CNF_CTRLSEL_Pos + +#define GPIO_PIN_CNF_CTRLSEL_Pos (28UL) +#define GPIO_PIN_CNF_CTRLSEL_Msk (0x7UL << GPIO_PIN_CNF_CTRLSEL_Pos) +#define GPIO_PIN_CNF_CTRLSEL_Min (0x0UL) +#define GPIO_PIN_CNF_CTRLSEL_Max (0x7UL) +#define GPIO_PIN_CNF_CTRLSEL_GPIO (0x0UL) +#define GPIO_PIN_CNF_CTRLSEL_VPR (0x1UL) +#define GPIO_PIN_CNF_CTRLSEL_GRC (0x1UL) +#define GPIO_PIN_CNF_CTRLSEL_SecureDomain (0x2UL) +#define GPIO_PIN_CNF_CTRLSEL_PWM (0x2UL) +#define GPIO_PIN_CNF_CTRLSEL_I3C (0x2UL) +#define GPIO_PIN_CNF_CTRLSEL_Serial (0x3UL) +#define GPIO_PIN_CNF_CTRLSEL_HSSPI (0x3UL) +#define GPIO_PIN_CNF_CTRLSEL_RadioCore (0x4UL) +#define GPIO_PIN_CNF_CTRLSEL_EXMIF (0x4UL) +#define GPIO_PIN_CNF_CTRLSEL_CELL (0x4UL) +#define GPIO_PIN_CNF_CTRLSEL_DTB (0x6UL) +#define GPIO_PIN_CNF_CTRLSEL_TND (0x7UL) + +#endif /* GPIO_PIN_CNF_CTRLSEL_Pos */ + +#endif /* SOC_NORDIC_COMMON_UICR_UICR_H_ */ diff --git a/soc/nordic/common/uicr/uicr.ld b/soc/nordic/common/uicr/uicr.ld new file mode 100644 index 000000000000..210495b1c66c --- /dev/null +++ b/soc/nordic/common/uicr/uicr.ld @@ -0,0 +1,11 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +SECTION_PROLOGUE(uicr_periphconf_entry,(COPY),SUBALIGN(Z_LINK_ITERABLE_SUBALIGN)) +{ + Z_LINK_ITERABLE(uicr_periphconf_entry); +} GROUP_ROM_LINK_IN(DEVNULL_REGION, DEVNULL_REGION) From 39b677e13129bf1e7d77af0819eb9292b642b27e Mon Sep 17 00:00:00 2001 From: Jonathan Nilsen Date: Wed, 4 Jun 2025 18:04:43 +0200 Subject: [PATCH 0440/2141] [nrf fromtree] west: runners: nrf: Program UICR/PERIPHCONF artifacts if present Program the new UICR and PERIPHCONF artifacts if they are generated. These are required for the application to operate properly if they are in use. Signed-off-by: Jonathan Nilsen (cherry picked from commit eb7239c6a88be5375a9b2068db1b8ebe484d99d6) --- scripts/west_commands/runners/nrf_common.py | 26 ++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/scripts/west_commands/runners/nrf_common.py b/scripts/west_commands/runners/nrf_common.py index e08186537720..ba1d0dfdc323 100644 --- a/scripts/west_commands/runners/nrf_common.py +++ b/scripts/west_commands/runners/nrf_common.py @@ -369,9 +369,9 @@ def program_hex(self): if self.family in ('nrf54h', 'nrf92'): erase_arg = 'ERASE_NONE' - generated_uicr = self.build_conf.getboolean('CONFIG_NRF_REGTOOL_GENERATE_UICR') + regtool_generated_uicr = self.build_conf.getboolean('CONFIG_NRF_REGTOOL_GENERATE_UICR') - if generated_uicr and not self.hex_get_uicrs().get(core): + if regtool_generated_uicr and not self.hex_get_uicrs().get(core): raise RuntimeError( f"Expected a UICR to be contained in: {self.hex_}\n" "Please ensure that the correct version of nrf-regtool is " @@ -434,7 +434,27 @@ def program_hex(self): core='Application', ) - if not self.erase and generated_uicr: + if self.build_conf.getboolean("CONFIG_NRF_HALTIUM_GENERATE_UICR"): + zephyr_build_dir = Path(self.cfg.build_dir) / 'zephyr' + + self.op_program( + str(zephyr_build_dir / 'uicr.hex'), + 'ERASE_NONE', + None, + defer=True, + core='Application', + ) + + if self.build_conf.getboolean("CONFIG_NRF_HALTIUM_UICR_PERIPHCONF"): + self.op_program( + str(zephyr_build_dir / 'periphconf.hex'), + 'ERASE_NONE', + None, + defer=True, + core='Application', + ) + + if not self.erase and regtool_generated_uicr: self.exec_op('erase', core=core, kind='uicr') else: if self.erase: From 1871cdbd417ea23ebe66ff2a7c1669c0c32337a9 Mon Sep 17 00:00:00 2001 From: Jonathan Nilsen Date: Wed, 18 Jun 2025 12:09:48 +0200 Subject: [PATCH 0441/2141] [nrf fromtree] west: runners: nrf: don't recover twice on nrf54h Update the recover mechanism for nrf54h to only call recover once. Using nrfutil device recover with both --core Network and --core Application is redundant with IronSide SE as both of these map to the same operation which does a full erase of the device MRAM. Additionally, recovering twice in a row specifically in a nrfutil batch file (which is used by this runner implementation) triggers some odd behavior with the current latest version of nrfutil device + IronSide SE, which can cause the device to enter a reset loop and appear unresponsive and preventing 'west flash --recover' from working properly. Signed-off-by: Jonathan Nilsen (cherry picked from commit 78a61579d8c1e65697054a2ef996b9fd55b14c61) --- scripts/west_commands/runners/nrf_common.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/west_commands/runners/nrf_common.py b/scripts/west_commands/runners/nrf_common.py index ba1d0dfdc323..a7401084ef31 100644 --- a/scripts/west_commands/runners/nrf_common.py +++ b/scripts/west_commands/runners/nrf_common.py @@ -320,8 +320,7 @@ def recover_target(self): # recover operation unlocks the core and then flashes a small image that # keeps the debug access port open, recovering the network core last # would result in that small image being deleted from the app core. - # In the case of the 54H, the order is indifferent. - if self.family in ('nrf53', 'nrf54h', 'nrf92'): + if self.family in ('nrf53', 'nrf92'): self.exec_op('recover', core='Network') self.exec_op('recover') From d8199513c3c9151c4fb067632c23e4450fb9e78f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20Amundsen?= Date: Mon, 23 Jun 2025 07:09:46 +0200 Subject: [PATCH 0442/2141] [nrf fromtree] soc: nrf54h: don't boot radio core if VTOR is not programmed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Booting the radio core when it is not programmed will typically cause a reset loop. This can happen when programming multiple images to a device, and the app core image is programmed before the radio core. With this change we avoid the reset loop in that case. Signed-off-by: Håkon Amundsen (cherry picked from commit 7697eff4fb9470ba1d06e07e00beb9375825f0c5) --- soc/nordic/nrf54h/Kconfig | 7 +++++++ soc/nordic/nrf54h/soc.c | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/soc/nordic/nrf54h/Kconfig b/soc/nordic/nrf54h/Kconfig index 97423a04e9b7..7889287b4a4b 100644 --- a/soc/nordic/nrf54h/Kconfig +++ b/soc/nordic/nrf54h/Kconfig @@ -78,6 +78,13 @@ config SOC_NRF54H20_CPURAD_ENABLE Radiocore, and also power will be requested to the Radiocore subsystem. The Radiocore will then start executing instructions. +config SOC_NRF54H20_CPURAD_ENABLE_CHECK_VTOR + bool "Check VTOR before booting Radio core" + default y + depends on SOC_NRF54H20_CPURAD_ENABLE + help + Verify that VTOR is not 0xFFFFFFFF before booting the Radiocore. + config SOC_NRF54H20_CPURAD select SOC_NRF54H20_CPURAD_COMMON diff --git a/soc/nordic/nrf54h/soc.c b/soc/nordic/nrf54h/soc.c index cdff23103555..797081298041 100644 --- a/soc/nordic/nrf54h/soc.c +++ b/soc/nordic/nrf54h/soc.c @@ -200,6 +200,13 @@ void soc_late_init_hook(void) CONFIG_ROM_START_OFFSET); #endif + if (IS_ENABLED(CONFIG_SOC_NRF54H20_CPURAD_ENABLE_CHECK_VTOR) && + sys_read32((mem_addr_t)radiocore_address) == 0xFFFFFFFFUL) { + LOG_ERR("Radiocore is not programmed, it will not be started"); + + return; + } + /* Don't wait as this is not yet supported. */ bool cpu_wait = false; From 8c49e07c567e284bbbed4aa675c5d0a74eadaaa0 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Fri, 4 Jul 2025 15:09:12 +0100 Subject: [PATCH 0443/2141] [nrf fromtree] soc: nordic: ironside: Fix bleeding config Fixes generating a library for devices that do not need it which gives a cmake warning Signed-off-by: Jamie McCrae (cherry picked from commit 85d4ebcf51fa69a67e93df73387816011a347bc5) --- soc/nordic/CMakeLists.txt | 2 +- soc/nordic/ironside/CMakeLists.txt | 3 --- soc/nordic/nrf54h/soc.c | 3 +++ 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/soc/nordic/CMakeLists.txt b/soc/nordic/CMakeLists.txt index cba58ae51875..0c9e9184d6dc 100644 --- a/soc/nordic/CMakeLists.txt +++ b/soc/nordic/CMakeLists.txt @@ -47,4 +47,4 @@ endif() add_subdirectory(${SOC_SERIES}) add_subdirectory(common) -add_subdirectory(ironside) +add_subdirectory_ifdef(CONFIG_NRF_IRONSIDE ironside) diff --git a/soc/nordic/ironside/CMakeLists.txt b/soc/nordic/ironside/CMakeLists.txt index a0a18fc94a8a..cf68e8a13529 100644 --- a/soc/nordic/ironside/CMakeLists.txt +++ b/soc/nordic/ironside/CMakeLists.txt @@ -2,11 +2,8 @@ # SPDX-License-Identifier: Apache-2.0 zephyr_include_directories(include) - zephyr_library() - zephyr_library_sources_ifdef(CONFIG_NRF_IRONSIDE_CALL call.c) - zephyr_library_sources_ifdef(CONFIG_NRF_IRONSIDE_BOOT_REPORT boot_report.c) zephyr_library_sources_ifdef(CONFIG_NRF_IRONSIDE_CPUCONF_SERVICE cpuconf.c) zephyr_library_sources_ifdef(CONFIG_NRF_IRONSIDE_UPDATE_SERVICE update.c) diff --git a/soc/nordic/nrf54h/soc.c b/soc/nordic/nrf54h/soc.c index 797081298041..5f52a091fa84 100644 --- a/soc/nordic/nrf54h/soc.c +++ b/soc/nordic/nrf54h/soc.c @@ -22,7 +22,10 @@ #include #include #include + +#if defined(CONFIG_SOC_NRF54H20_CPURAD_ENABLE) #include +#endif LOG_MODULE_REGISTER(soc, CONFIG_SOC_LOG_LEVEL); From bd9a022166c48254d021f64c5b61d7f47bbf6215 Mon Sep 17 00:00:00 2001 From: Karsten Koenig Date: Thu, 15 May 2025 12:29:32 +0200 Subject: [PATCH 0444/2141] [nrf fromlist] soc: nordic: ironside: Add TDD Upstream PR #: 92340 Added support for the IronSide TDD service which allows configuring and powering the trace and debug domain of the nrf54h20. Also provide option to start the trace and debug domain in the soc start sequence. Signed-off-by: Karsten Koenig (cherry picked from commit 8abc1ac5cbaf4c2b97333492954729ed905d32c3) --- soc/nordic/ironside/CMakeLists.txt | 1 + soc/nordic/ironside/Kconfig | 6 +++ .../ironside/include/nrf_ironside/tdd.h | 38 +++++++++++++++++++ soc/nordic/ironside/tdd.c | 28 ++++++++++++++ soc/nordic/nrf54h/Kconfig | 13 ++++++- soc/nordic/nrf54h/soc.c | 22 +++++++++-- 6 files changed, 103 insertions(+), 5 deletions(-) create mode 100644 soc/nordic/ironside/include/nrf_ironside/tdd.h create mode 100644 soc/nordic/ironside/tdd.c diff --git a/soc/nordic/ironside/CMakeLists.txt b/soc/nordic/ironside/CMakeLists.txt index cf68e8a13529..98e721541d7f 100644 --- a/soc/nordic/ironside/CMakeLists.txt +++ b/soc/nordic/ironside/CMakeLists.txt @@ -6,5 +6,6 @@ zephyr_library() zephyr_library_sources_ifdef(CONFIG_NRF_IRONSIDE_CALL call.c) zephyr_library_sources_ifdef(CONFIG_NRF_IRONSIDE_BOOT_REPORT boot_report.c) zephyr_library_sources_ifdef(CONFIG_NRF_IRONSIDE_CPUCONF_SERVICE cpuconf.c) +zephyr_library_sources_ifdef(CONFIG_NRF_IRONSIDE_TDD_SERVICE tdd.c) zephyr_library_sources_ifdef(CONFIG_NRF_IRONSIDE_UPDATE_SERVICE update.c) zephyr_library_sources_ifdef(CONFIG_NRF_IRONSIDE_DVFS_SERVICE dvfs.c) diff --git a/soc/nordic/ironside/Kconfig b/soc/nordic/ironside/Kconfig index a9e68bba0b28..2430090c943b 100644 --- a/soc/nordic/ironside/Kconfig +++ b/soc/nordic/ironside/Kconfig @@ -37,6 +37,12 @@ config NRF_IRONSIDE_CPUCONF_SERVICE help Service used to boot local domain cores. +config NRF_IRONSIDE_TDD_SERVICE + bool "IronSide TDD service" + select NRF_IRONSIDE_CALL + help + Service used to control the trace and debug domain. + config NRF_IRONSIDE_UPDATE_SERVICE bool "IronSide update service" select NRF_IRONSIDE_CALL diff --git a/soc/nordic/ironside/include/nrf_ironside/tdd.h b/soc/nordic/ironside/include/nrf_ironside/tdd.h new file mode 100644 index 000000000000..d065b1619a68 --- /dev/null +++ b/soc/nordic/ironside/include/nrf_ironside/tdd.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_SOC_NORDIC_IRONSIDE_INCLUDE_NRF_IRONSIDE_TDD_H_ +#define ZEPHYR_SOC_NORDIC_IRONSIDE_INCLUDE_NRF_IRONSIDE_TDD_H_ + +#include + +#include + +#define IRONSIDE_SE_TDD_SERVICE_ERROR_INVALID_CONFIG (1) + +#define IRONSIDE_SE_CALL_ID_TDD_V0 4 + +#define IRONSIDE_SE_TDD_SERVICE_REQ_CONFIG_IDX 0 +#define IRONSIDE_SE_TDD_SERVICE_RSP_RETCODE_IDX 0 + +enum ironside_se_tdd_config { + RESERVED0 = 0, /* Reserved */ + /** Turn off the TDD */ + IRONSIDE_SE_TDD_CONFIG_OFF = 1, + /** Turn on the TDD with default configuration */ + IRONSIDE_SE_TDD_CONFIG_ON_DEFAULT = 2, +}; + +/** + * @brief Control the Trace and Debug Domain (TDD). + * + * @param config The configuration to be applied. + * + * @retval 0 on success. + * @retval -IRONSIDE_SE_TDD_ERROR_EINVAL on invalid argument. + */ +int ironside_se_tdd_configure(const enum ironside_se_tdd_config config); + +#endif /* ZEPHYR_SOC_NORDIC_IRONSIDE_INCLUDE_NRF_IRONSIDE_TDD_H_ */ diff --git a/soc/nordic/ironside/tdd.c b/soc/nordic/ironside/tdd.c new file mode 100644 index 000000000000..eee5691cf362 --- /dev/null +++ b/soc/nordic/ironside/tdd.c @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include + +int ironside_se_tdd_configure(const enum ironside_se_tdd_config config) +{ + int err; + struct ironside_call_buf *const buf = ironside_call_alloc(); + + buf->id = IRONSIDE_SE_CALL_ID_TDD_V0; + buf->args[IRONSIDE_SE_TDD_SERVICE_REQ_CONFIG_IDX] = (uint32_t)config; + + ironside_call_dispatch(buf); + + if (buf->status == IRONSIDE_CALL_STATUS_RSP_SUCCESS) { + err = buf->args[IRONSIDE_SE_TDD_SERVICE_RSP_RETCODE_IDX]; + } else { + err = buf->status; + } + + ironside_call_release(buf); + + return err; +} diff --git a/soc/nordic/nrf54h/Kconfig b/soc/nordic/nrf54h/Kconfig index 7889287b4a4b..56b64f293baf 100644 --- a/soc/nordic/nrf54h/Kconfig +++ b/soc/nordic/nrf54h/Kconfig @@ -8,7 +8,6 @@ config SOC_SERIES_NRF54HX select HAS_NRFX select HAS_NORDIC_DRIVERS select SOC_EARLY_INIT_HOOK if ARM - select SOC_LATE_INIT_HOOK if SOC_NRF54H20_CPURAD_ENABLE select NRF_PLATFORM_HALTIUM select EXPERIMENTAL if MCUBOOT @@ -68,11 +67,23 @@ config SOC_NRF54H20_CPURAD_COMMON select HAS_PM select HAS_POWEROFF +config SOC_NRF54H20_TDD_ENABLE + bool "Power and configure the trace and debug domain (TDD)" + depends on SOC_NRF54H20_CPUAPP + select NRF_IRONSIDE_TDD_SERVICE + select SOC_LATE_INIT_HOOK + help + This will at application boot time request that the trace and + debug domain (TDD) is powered up and configured. + This allows configuring the coresight peripherals from + the application domain. + config SOC_NRF54H20_CPURAD_ENABLE bool "Boot the nRF54H20 Radio core" default y if NRF_802154_SER_HOST || BT_HCI_HOST depends on SOC_NRF54H20_CPUAPP select NRF_IRONSIDE_CPUCONF_SERVICE + select SOC_LATE_INIT_HOOK help This will at application boot time enable clock to the Radiocore, and also power will be requested to the Radiocore diff --git a/soc/nordic/nrf54h/soc.c b/soc/nordic/nrf54h/soc.c index 5f52a091fa84..d51ade98911a 100644 --- a/soc/nordic/nrf54h/soc.c +++ b/soc/nordic/nrf54h/soc.c @@ -26,6 +26,9 @@ #if defined(CONFIG_SOC_NRF54H20_CPURAD_ENABLE) #include #endif +#if defined(CONFIG_SOC_NRF54H20_TDD_ENABLE) +#include +#endif LOG_MODULE_REGISTER(soc, CONFIG_SOC_LOG_LEVEL); @@ -171,10 +174,19 @@ void soc_early_init_hook(void) } } -#if defined(CONFIG_SOC_NRF54H20_CPURAD_ENABLE) +#if defined(CONFIG_SOC_LATE_INIT_HOOK) + void soc_late_init_hook(void) { - int err; +#if defined(CONFIG_SOC_NRF54H20_TDD_ENABLE) + int err_tdd; + + err_tdd = ironside_se_tdd_configure(IRONSIDE_SE_TDD_CONFIG_ON_DEFAULT); + __ASSERT(err_tdd == 0, "err_tdd was %d", err_tdd); +#endif + +#if defined(CONFIG_SOC_NRF54H20_CPURAD_ENABLE) + int err_cpuconf; /* The msg will be used for communication prior to IPC * communication being set up. But at this moment no such @@ -213,8 +225,10 @@ void soc_late_init_hook(void) /* Don't wait as this is not yet supported. */ bool cpu_wait = false; - err = ironside_cpuconf(NRF_PROCESSOR_RADIOCORE, radiocore_address, cpu_wait, msg, msg_size); - __ASSERT(err == 0, "err was %d", err); + err_cpuconf = ironside_cpuconf(NRF_PROCESSOR_RADIOCORE, radiocore_address, cpu_wait, msg, + msg_size); + __ASSERT(err_cpuconf == 0, "err_cpuconf was %d", err_cpuconf); +#endif } #endif From bdd753cd1311d72ab043800c4913d417d3e71020 Mon Sep 17 00:00:00 2001 From: Karsten Koenig Date: Sat, 28 Jun 2025 12:35:19 +0200 Subject: [PATCH 0445/2141] [nrf fromlist] soc: nrf54h: Configure CTRLSEL and pin for TRACE Upstream PR #: 92340 Configure the CTRLSEL value and the clock pin so that the TRACE pins work when the TDD gets used. Signed-off-by: Karsten Koenig (cherry picked from commit dec9eb348bcf94d093930f73804cec58d99c8c7f) --- soc/nordic/nrf54h/soc.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/soc/nordic/nrf54h/soc.c b/soc/nordic/nrf54h/soc.c index d51ade98911a..a20815b2227e 100644 --- a/soc/nordic/nrf54h/soc.c +++ b/soc/nordic/nrf54h/soc.c @@ -22,6 +22,7 @@ #include #include #include +#include #if defined(CONFIG_SOC_NRF54H20_CPURAD_ENABLE) #include @@ -183,6 +184,13 @@ void soc_late_init_hook(void) err_tdd = ironside_se_tdd_configure(IRONSIDE_SE_TDD_CONFIG_ON_DEFAULT); __ASSERT(err_tdd == 0, "err_tdd was %d", err_tdd); + + UICR_GPIO_PIN_CNF_CTRLSEL_SET(NRF_P7, 3, GPIO_PIN_CNF_CTRLSEL_TND); + UICR_GPIO_PIN_CNF_CTRLSEL_SET(NRF_P7, 4, GPIO_PIN_CNF_CTRLSEL_TND); + UICR_GPIO_PIN_CNF_CTRLSEL_SET(NRF_P7, 5, GPIO_PIN_CNF_CTRLSEL_TND); + UICR_GPIO_PIN_CNF_CTRLSEL_SET(NRF_P7, 6, GPIO_PIN_CNF_CTRLSEL_TND); + UICR_GPIO_PIN_CNF_CTRLSEL_SET(NRF_P7, 7, GPIO_PIN_CNF_CTRLSEL_TND); + #endif #if defined(CONFIG_SOC_NRF54H20_CPURAD_ENABLE) From d45353ccd301fea2fb90e10102b05b4d44167fa6 Mon Sep 17 00:00:00 2001 From: Karsten Koenig Date: Mon, 30 Jun 2025 11:56:31 +0200 Subject: [PATCH 0446/2141] [nrf fromlist] boards: nordic: nrf54h20dk: Add ETM to JLinkScript Upstream PR #: 92340 Added support for ETM tracing via TPIU to the JLinkScript. Signed-off-by: Karsten Koenig (cherry picked from commit 722b043c49f6aad02f767d5df12b1a85d1de148e) --- .../support/nrf54h20_cpuapp.JLinkScript | 169 ++++++++++++++++++ 1 file changed, 169 insertions(+) diff --git a/boards/nordic/nrf54h20dk/support/nrf54h20_cpuapp.JLinkScript b/boards/nordic/nrf54h20dk/support/nrf54h20_cpuapp.JLinkScript index b1b968573991..9738ec77f437 100644 --- a/boards/nordic/nrf54h20dk/support/nrf54h20_cpuapp.JLinkScript +++ b/boards/nordic/nrf54h20dk/support/nrf54h20_cpuapp.JLinkScript @@ -1,6 +1,175 @@ __constant U32 _CPUCONF_ADDR = 0x52011000; __constant U32 _CPUCONF_CPUWAIT_OFFSET = 0x50C; +// ATBFUNNEL +__constant U32 _ATBFUNNEL211_ADDR = 0xBF04D000; +__constant U32 _ATBFUNNEL212_ADDR = 0xBF04E000; +__constant U32 _ATBFUNNEL_CTRLREG_OFFSET = 0x0; +__constant U32 _HOLDTIME_4 = 0x300; +__constant U32 _ENS0 = 0x1; +__constant U32 _ENS1 = 0x2; +__constant U32 _ENS2 = 0x4; + +// ATBREPLICATOR +__constant U32 _ATBREPLICATOR212_ADDR = 0xBF04A000; +__constant U32 _ATBREPLICATOR213_ADDR = 0xBF04B000; +__constant U32 _ATBREPLICATOR_IDFILTER0_OFFSET = 0x0; +__constant U32 _ATBREPLICATOR_IDFILTER1_OFFSET = 0x4; +__constant U32 _ID_NONE = 0xFFFFFFFF; +__constant U32 _ID1x = 0xFFFFFFFD; + +// TSGEN +__constant U32 _TSGEN_ADDR = 0xBF041000; +__constant U32 _TSGEN_CNTCR_OFFSET = 0x0; +__constant U32 _TSGEN_CNTFID0_OFFSET = 0x20; +// Clock rate = TDD Freq. / 8 +__constant U32 _TS_CLOCKRATE = 40000000; + +// CTI +__constant U32 _CTI210_ADDR = 0xBF046000; +__constant U32 _CTICONTROL_OFFSET = 0x0; +__constant U32 _CTIOUTEN_OFFSET = 0xA0; +__constant U32 _CTIGATE_OFFSET = 0x140; +__constant U32 _TPIU_FLUSH_TRIG = 0x2; + +// TPIU +__constant U32 _TPIU_ADDR = 0xBF043000; +__constant U32 _CURRENTPORTSIZE_OFFSET = 0x4; +__constant U32 _FFCR_OFFSET = 0x304; +__constant U32 _FSCR_OFFSET = 0x308; +__constant U32 _ENFCONT = 0x02; +__constant U32 _FONFLIN = 0x10; +__constant U32 _ENFTC = 0x1; +__constant U32 _TPIU_SYNC_FRAME_COUNT = 0x8; +__constant U32 _CURRENTPORTSIZE_4 = 0x8; + +// TDDCONF +__constant U32 _TDDCONF_ADDR = 0xBF001000; +__constant U32 _TRACEPORTSPEED_OFFSET = 0x408; +__constant U32 _SPEED80MHZ = 0x0; + +// CoreSight general +__constant U32 _CORESIGHT_CLAIMSET_OFFSET = 0xFA0; +__constant U32 _CORESIGHT_CLAIMCLR_OFFSET = 0xFA4; +__constant U32 _CORESIGHT_LAR_OFFSET = 0xFB0; +__constant U32 _CORESIGHT_UNLOCK_KEY = 0xC5ACCE55; + +// GPIO P7 +__constant U32 _P7_ADDR = 0x5F938E00; +__constant U32 _PIN_CNF3_OFFSET = 0x8C; +__constant U32 _PIN_CNF4_OFFSET = 0x90; +__constant U32 _PIN_CNF5_OFFSET = 0x94; +__constant U32 _PIN_CNF6_OFFSET = 0x98; +__constant U32 _PIN_CNF7_OFFSET = 0x9C; +__constant U32 _PIN_CNF_TPIU_CLOCK_VALUE = 0x80000503; +__constant U32 _PIN_CNF_TPIU_DATA_VALUE = 0x00000503; + +// Settings +__constant U32 _DEBUGGER_CLAIM_MASK = 0x2; + +// Used to check if we have already set up tracing +int _needCoresightSetup = 1; + +// Unlock a CoreSight peripheral +void _CSUnlock(U32 addr) +{ + JLINK_MEM_WriteU32(addr + _CORESIGHT_LAR_OFFSET, _CORESIGHT_UNLOCK_KEY); +} + +// Lock a CoreSight peripheral +void _CSLock(U32 addr) +{ + JLINK_MEM_WriteU32(addr + _CORESIGHT_LAR_OFFSET, 0); +} + +// Set claim bits in the CoreSight peripheral to indicate to the firmware that it +// has been configured by the host debugger +void _CSClaim(U32 addr) +{ + JLINK_MEM_WriteU32(addr + _CORESIGHT_CLAIMSET_OFFSET, _DEBUGGER_CLAIM_MASK); +} + +// Set up CoreSight and other necessary configuration so to enable ETM -> TPIU tracing. +int _SetupETMTPIUTrace(void) +{ + // Set up ATB funnels/replicators to route ApplicationDomain ETM to TPIU + _CSUnlock(_ATBFUNNEL212_ADDR); + JLINK_MEM_WriteU32(_ATBFUNNEL212_ADDR + _ATBFUNNEL_CTRLREG_OFFSET, _HOLDTIME_4 | _ENS0); + _CSClaim(_ATBFUNNEL212_ADDR); + _CSLock(_ATBFUNNEL212_ADDR); + + _CSUnlock(_ATBREPLICATOR212_ADDR); + JLINK_MEM_WriteU32(_ATBREPLICATOR212_ADDR + _ATBREPLICATOR_IDFILTER0_OFFSET, _ID_NONE); + JLINK_MEM_WriteU32(_ATBREPLICATOR212_ADDR + _ATBREPLICATOR_IDFILTER1_OFFSET, _ID1x); + _CSLock(_ATBREPLICATOR212_ADDR); + _CSClaim(_ATBREPLICATOR212_ADDR); + _CSLock(_ATBREPLICATOR212_ADDR); + + _CSUnlock(_ATBFUNNEL211_ADDR); + JLINK_MEM_WriteU32(_ATBFUNNEL211_ADDR + _ATBFUNNEL_CTRLREG_OFFSET, _HOLDTIME_4 | _ENS0); + _CSClaim(_ATBFUNNEL211_ADDR); + _CSLock(_ATBFUNNEL211_ADDR); + + _CSUnlock(_ATBREPLICATOR213_ADDR); + JLINK_MEM_WriteU32(_ATBREPLICATOR213_ADDR + _ATBREPLICATOR_IDFILTER0_OFFSET, _ID1x); + JLINK_MEM_WriteU32(_ATBREPLICATOR213_ADDR + _ATBREPLICATOR_IDFILTER1_OFFSET, _ID_NONE); + _CSClaim(_ATBREPLICATOR213_ADDR); + _CSLock(_ATBREPLICATOR213_ADDR); + + // Configure timestamp generator for the correct clock rate + JLINK_MEM_WriteU32(_TSGEN_ADDR + _TSGEN_CNTFID0_OFFSET, _TS_CLOCKRATE); + JLINK_MEM_WriteU32(_TSGEN_ADDR + _TSGEN_CNTCR_OFFSET, 1); + _CSClaim(_TSGEN_ADDR); + + // Configure CTI1 for TPIU formatter flushing + _CSUnlock(_CTI210_ADDR); + JLINK_MEM_WriteU32(_CTI210_ADDR + _CTIOUTEN_OFFSET, _TPIU_FLUSH_TRIG); + JLINK_MEM_WriteU32(_CTI210_ADDR + _CTIGATE_OFFSET, _TPIU_FLUSH_TRIG); + JLINK_MEM_WriteU32(_CTI210_ADDR + _CTICONTROL_OFFSET, 1); + _CSClaim(_CTI210_ADDR); + _CSLock(_CTI210_ADDR); + + // Configure TPIU for port size 4, continuous formatting + _CSUnlock(_TPIU_ADDR); + JLINK_MEM_WriteU32(_TPIU_ADDR + _CURRENTPORTSIZE_OFFSET, _CURRENTPORTSIZE_4); + JLINK_MEM_WriteU32(_TPIU_ADDR + _FFCR_OFFSET, _ENFCONT | _FONFLIN | _ENFTC); + JLINK_MEM_WriteU32(_TPIU_ADDR + _FSCR_OFFSET, _TPIU_SYNC_FRAME_COUNT); + _CSClaim(_TPIU_ADDR); + _CSLock(_TPIU_ADDR); + + // Configure the trace pins + JLINK_MEM_WriteU32(_P7_ADDR + _PIN_CNF3_OFFSET, _PIN_CNF_TPIU_CLOCK_VALUE); + JLINK_MEM_WriteU32(_P7_ADDR + _PIN_CNF4_OFFSET, _PIN_CNF_TPIU_DATA_VALUE); + JLINK_MEM_WriteU32(_P7_ADDR + _PIN_CNF5_OFFSET, _PIN_CNF_TPIU_DATA_VALUE); + JLINK_MEM_WriteU32(_P7_ADDR + _PIN_CNF6_OFFSET, _PIN_CNF_TPIU_DATA_VALUE); + JLINK_MEM_WriteU32(_P7_ADDR + _PIN_CNF7_OFFSET, _PIN_CNF_TPIU_DATA_VALUE); + + return 0; +} + +int ConfigTargetSettings(void) +{ + JLINK_ExecCommand("CORESIGHT_AddAP = Index=0 Type=AHB-AP"); + CORESIGHT_IndexAHBAPToUse = 0; + + // Adjust trace sample delay to compensate for timing when using 320MHz + JLINK_ExecCommand("TraceSampleAdjust TD = 1000"); + + return 0; +} + +int OnTraceStart(void) +{ + // Set up CoreSight if not already configured + if (_needCoresightSetup) { + _SetupETMTPIUTrace(); + _needCoresightSetup = 0; + } + + return 0; +} + + int SetupTarget(void) { JLINK_TARGET_Halt(); From e125145b9ea8e0945d52b170e3a34f7d87aae0bb Mon Sep 17 00:00:00 2001 From: Jonathan Nilsen Date: Mon, 28 Jul 2025 12:55:25 +0200 Subject: [PATCH 0447/2141] [nrf fromlist] soc: nordic: ironside: run clang-format on some files Upstream PR #: 93768 Format a few files with clang-format. Signed-off-by: Jonathan Nilsen (cherry picked from commit 2c2453cac1d41be138c047e94c510a4189c695af) --- soc/nordic/ironside/include/nrf_ironside/dvfs.h | 15 +++++++-------- soc/nordic/ironside/include/nrf_ironside/update.h | 2 +- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/soc/nordic/ironside/include/nrf_ironside/dvfs.h b/soc/nordic/ironside/include/nrf_ironside/dvfs.h index e2cb03c249e0..f48c8a6344a2 100644 --- a/soc/nordic/ironside/include/nrf_ironside/dvfs.h +++ b/soc/nordic/ironside/include/nrf_ironside/dvfs.h @@ -31,19 +31,19 @@ enum ironside_dvfs_oppoint { */ /** The requested DVFS oppoint is not allowed. */ -#define IRONSIDE_DVFS_ERROR_WRONG_OPPOINT (1) +#define IRONSIDE_DVFS_ERROR_WRONG_OPPOINT (1) /** Waiting for mutex lock timed out, or hardware is busy. */ -#define IRONSIDE_DVFS_ERROR_BUSY (2) +#define IRONSIDE_DVFS_ERROR_BUSY (2) /** There is configuration error in the DVFS service. */ -#define IRONSIDE_DVFS_ERROR_OPPOINT_DATA (3) +#define IRONSIDE_DVFS_ERROR_OPPOINT_DATA (3) /** The caller does not have permission to change the DVFS oppoint. */ -#define IRONSIDE_DVFS_ERROR_PERMISSION (4) +#define IRONSIDE_DVFS_ERROR_PERMISSION (4) /** The requested DVFS oppoint is already set, no change needed. */ #define IRONSIDE_DVFS_ERROR_NO_CHANGE_NEEDED (5) /** The operation timed out, possibly due to a hardware issue. */ -#define IRONSIDE_DVFS_ERROR_TIMEOUT (6) +#define IRONSIDE_DVFS_ERROR_TIMEOUT (6) /** The DVFS oppoint change operation is not allowed in the ISR context. */ -#define IRONSIDE_DVFS_ERROR_ISR_NOT_ALLOWED (7) +#define IRONSIDE_DVFS_ERROR_ISR_NOT_ALLOWED (7) /** * @} @@ -80,8 +80,7 @@ int ironside_dvfs_change_oppoint(enum ironside_dvfs_oppoint dvfs_oppoint); */ static inline bool ironside_dvfs_is_oppoint_valid(enum ironside_dvfs_oppoint dvfs_oppoint) { - if (dvfs_oppoint != IRONSIDE_DVFS_OPP_HIGH && - dvfs_oppoint != IRONSIDE_DVFS_OPP_MEDLOW && + if (dvfs_oppoint != IRONSIDE_DVFS_OPP_HIGH && dvfs_oppoint != IRONSIDE_DVFS_OPP_MEDLOW && dvfs_oppoint != IRONSIDE_DVFS_OPP_LOW) { return false; } diff --git a/soc/nordic/ironside/include/nrf_ironside/update.h b/soc/nordic/ironside/include/nrf_ironside/update.h index 8152a77f5f7c..c0f021a91ed5 100644 --- a/soc/nordic/ironside/include/nrf_ironside/update.h +++ b/soc/nordic/ironside/include/nrf_ironside/update.h @@ -40,7 +40,7 @@ /* Index of the update blob pointer within the service buffer. */ #define IRONSIDE_UPDATE_SERVICE_UPDATE_PTR_IDX (0) /* Index of the return code within the service buffer. */ -#define IRONSIDE_UPDATE_SERVICE_RETCODE_IDX (0) +#define IRONSIDE_UPDATE_SERVICE_RETCODE_IDX (0) /** * @brief IronSide update blob. From 7f2380fed7aafab23b4c64e20aa96dfeb77d77ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Fri, 25 Jul 2025 15:51:37 +0200 Subject: [PATCH 0448/2141] [nrf fromtree] drivers: flash_mspi_nor: Make transfer timeout configurable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Although the value currently hard-coded in the driver (10 ms) is quite high, it may turn out to be insufficient when there is a need to use some very low SCK frequency, like 250 kHz. Make the timeout value configurable per-instance, via devicetree. Signed-off-by: Andrzej Głąbek (cherry picked from commit 7efa5c87dde1bf82ab8cf6cff300025c04daee76) --- drivers/flash/flash_mspi_nor.c | 3 ++- drivers/flash/flash_mspi_nor.h | 1 + dts/bindings/mtd/jedec,mspi-nor.yaml | 8 ++++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/flash/flash_mspi_nor.c b/drivers/flash/flash_mspi_nor.c index b7ca6341d3ae..ae22202e075d 100644 --- a/drivers/flash/flash_mspi_nor.c +++ b/drivers/flash/flash_mspi_nor.c @@ -27,7 +27,7 @@ void flash_mspi_command_set(const struct device *dev, const struct flash_mspi_no dev_data->xfer.xfer_mode = MSPI_PIO; dev_data->xfer.packets = &dev_data->packet; dev_data->xfer.num_packet = 1; - dev_data->xfer.timeout = 10; + dev_data->xfer.timeout = dev_config->transfer_timeout; dev_data->xfer.cmd_length = cmd->cmd_length; dev_data->xfer.addr_length = cmd->addr_length; @@ -887,6 +887,7 @@ BUILD_ASSERT((FLASH_SIZE_INST(inst) % CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE) == / 1000, \ .reset_recovery_us = DT_INST_PROP_OR(inst, t_reset_recovery, 0) \ / 1000,)) \ + .transfer_timeout = DT_INST_PROP(inst, transfer_timeout), \ FLASH_PAGE_LAYOUT_DEFINE(inst) \ .jedec_id = DT_INST_PROP(inst, jedec_id), \ .jedec_cmds = FLASH_CMDS(inst), \ diff --git a/drivers/flash/flash_mspi_nor.h b/drivers/flash/flash_mspi_nor.h index 35a0bff4c215..ad957f24bc79 100644 --- a/drivers/flash/flash_mspi_nor.h +++ b/drivers/flash/flash_mspi_nor.h @@ -35,6 +35,7 @@ struct flash_mspi_nor_config { uint32_t reset_pulse_us; uint32_t reset_recovery_us; #endif + uint32_t transfer_timeout; #if defined(CONFIG_FLASH_PAGE_LAYOUT) struct flash_pages_layout layout; #endif diff --git a/dts/bindings/mtd/jedec,mspi-nor.yaml b/dts/bindings/mtd/jedec,mspi-nor.yaml index 5bad8f54b5dc..09660b841591 100644 --- a/dts/bindings/mtd/jedec,mspi-nor.yaml +++ b/dts/bindings/mtd/jedec,mspi-nor.yaml @@ -22,3 +22,11 @@ properties: type: int description: | Minimum time, in nanoseconds, the flash chip needs to recover after reset. + + transfer-timeout: + type: int + default: 10 + description: | + Maximum time, in milliseconds, allowed for a single transfer on the MSPI + bus in communication with the flash chip. The default value is the one + that was previously hard-coded in the flash_mspi_nor driver. From d01522d5e70f52bff1ce751a72d962c404640f02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Fri, 11 Jul 2025 14:30:40 +0200 Subject: [PATCH 0449/2141] [nrf fromlist] drivers: flash_mspi_nor: Get info from dts SFDP arrays MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Get parameters for used flash commands and requirements for enabling Quad and Octal modes from dts uint8-arrays containing data read from SFDP tables for particular flash chips. Upstream PR #: 93093 Signed-off-by: Andrzej Głąbek (cherry picked from commit 550961d8d32dd157335976de83e5b183bffcaa10) --- .../nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 7 + .../nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts | 7 + drivers/flash/flash_mspi_nor.c | 46 ++- drivers/flash/flash_mspi_nor.h | 47 ++- drivers/flash/flash_mspi_nor_sfdp.h | 331 ++++++++++++++++++ dts/bindings/mtd/jedec,jesd216.yaml | 12 + 6 files changed, 434 insertions(+), 16 deletions(-) create mode 100644 drivers/flash/flash_mspi_nor_sfdp.h diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index 47255b0c9947..e01295e9e300 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -279,6 +279,13 @@ slot3_partition: &cpurad_slot1_partition { 30 b0 30 b0 f4 bd d5 5c 00 00 00 ff 10 10 00 20 00 00 00 00 00 00 7c 23 48 00 00 00 00 00 88 88 ]; + sfdp-ff05 = [ + 00 ee c0 69 72 72 71 71 00 d8 f7 f6 00 0a 00 00 + 14 45 98 80 + ]; + sfdp-ff84 = [ + 43 06 0f 00 21 dc ff ff + ]; size = <67108864>; has-dpd; t-enter-dpd = <10000>; diff --git a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts index f4cce12f4b1a..4cc9c7ba1a34 100644 --- a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts +++ b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts @@ -260,6 +260,13 @@ ipc0: &cpuapp_cpurad_ipc { 30 b0 30 b0 f4 bd d5 5c 00 00 00 ff 10 10 00 20 00 00 00 00 00 00 7c 23 48 00 00 00 00 00 88 88 ]; + sfdp-ff05 = [ + 00 ee c0 69 72 72 71 71 00 d8 f7 f6 00 0a 00 00 + 14 45 98 80 + ]; + sfdp-ff84 = [ + 43 06 0f 00 21 dc ff ff + ]; size = <67108864>; has-dpd; t-enter-dpd = <10000>; diff --git a/drivers/flash/flash_mspi_nor.c b/drivers/flash/flash_mspi_nor.c index ae22202e075d..2403160e296a 100644 --- a/drivers/flash/flash_mspi_nor.c +++ b/drivers/flash/flash_mspi_nor.c @@ -12,6 +12,7 @@ #include #include "flash_mspi_nor.h" +#include "flash_mspi_nor_sfdp.h" #include "flash_mspi_nor_quirks.h" LOG_MODULE_REGISTER(flash_mspi_nor, CONFIG_FLASH_LOG_LEVEL); @@ -110,7 +111,9 @@ static inline uint32_t dev_flash_size(const struct device *dev) static inline uint16_t dev_page_size(const struct device *dev) { - return SPI_NOR_PAGE_SIZE; + const struct flash_mspi_nor_config *dev_config = dev->config; + + return dev_config->page_size; } static int api_read(const struct device *dev, off_t addr, void *dest, @@ -528,7 +531,7 @@ static int quad_enable_set(const struct device *dev, bool enable) return rc; } - if (dev_config->dw15_qer == JESD216_DW15_QER_VAL_S1B6) { + if (dev_data->switch_info.quad_enable_req == JESD216_DW15_QER_VAL_S1B6) { const struct flash_mspi_nor_cmd cmd_status = { .dir = MSPI_TX, .cmd = SPI_NOR_CMD_WRSR, @@ -564,10 +567,11 @@ static int quad_enable_set(const struct device *dev, bool enable) static int default_io_mode(const struct device *dev) { const struct flash_mspi_nor_config *dev_config = dev->config; + struct flash_mspi_nor_data *dev_data = dev->data; enum mspi_io_mode io_mode = dev_config->mspi_nor_cfg.io_mode; int rc = 0; - if (dev_config->dw15_qer != JESD216_DW15_QER_VAL_NONE) { + if (dev_data->switch_info.quad_enable_req != JESD216_DW15_QER_VAL_NONE) { /* For Quad 1-1-4 and 1-4-4, entering or leaving mode is defined * in JEDEC216 BFP DW15 QER */ @@ -651,7 +655,7 @@ static int flash_chip_init(const struct device *dev) /* Some chips reuse RESET pin for data in Quad modes: * force single line mode before resetting. */ - if (dev_config->dw15_qer != JESD216_DW15_QER_VAL_NONE && + if (dev_data->switch_info.quad_enable_req != JESD216_DW15_QER_VAL_NONE && (io_mode == MSPI_IO_MODE_SINGLE || io_mode == MSPI_IO_MODE_QUAD_1_1_4 || io_mode == MSPI_IO_MODE_QUAD_1_4_4)) { @@ -743,6 +747,11 @@ static int drv_init(const struct device *dev) return -ENODEV; } + memcpy(dev_data->erase_types, dev_config->default_erase_types, + sizeof(dev_data->erase_types)); + dev_data->cmd_info = dev_config->default_cmd_info; + dev_data->switch_info = dev_config->default_switch_info; + rc = pm_device_runtime_get(dev_config->bus); if (rc < 0) { LOG_ERR("pm_device_runtime_get() failed: %d", rc); @@ -793,7 +802,15 @@ static DEVICE_API(flash, drv_api) = { .dqs_enable = false, \ } -#define FLASH_SIZE_INST(inst) (DT_INST_PROP(inst, size) / 8) +#define FLASH_SIZE(inst) \ + (DT_INST_NODE_HAS_PROP(inst, size) \ + ? DT_INST_PROP(inst, size) / 8 \ + : BFP_FLASH_DENSITY(SFDP_DW(inst, sfdp_bfp, 2)) / 8) + +#define FLASH_PAGE_EXP(inst) SFDP_FIELD(inst, sfdp_bfp, 11, GENMASK(7, 4)) +#define FLASH_PAGE_SIZE(inst) \ + (FLASH_PAGE_EXP(inst) ? BIT(FLASH_PAGE_EXP(inst)) \ + : SPI_NOR_PAGE_SIZE) /* Define copies of mspi_io_mode enum values, so they can be used inside * the COND_CODE_1 macros. @@ -829,23 +846,17 @@ extern const struct flash_mspi_nor_cmds mspi_io_mode_not_supported; #define FLASH_QUIRKS(inst) FLASH_MSPI_QUIRKS_GET(DT_DRV_INST(inst)) -#define FLASH_DW15_QER_VAL(inst) _CONCAT(JESD216_DW15_QER_VAL_, \ - DT_INST_STRING_TOKEN(inst, quad_enable_requirements)) -#define FLASH_DW15_QER(inst) COND_CODE_1(DT_INST_NODE_HAS_PROP(inst, quad_enable_requirements), \ - (FLASH_DW15_QER_VAL(inst)), (JESD216_DW15_QER_VAL_NONE)) - - #if defined(CONFIG_FLASH_PAGE_LAYOUT) BUILD_ASSERT((CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE % 4096) == 0, "MSPI_NOR_FLASH_LAYOUT_PAGE_SIZE must be multiple of 4096"); #define FLASH_PAGE_LAYOUT_DEFINE(inst) \ .layout = { \ .pages_size = CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE, \ - .pages_count = FLASH_SIZE_INST(inst) \ + .pages_count = FLASH_SIZE(inst) \ / CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE, \ }, #define FLASH_PAGE_LAYOUT_CHECK(inst) \ -BUILD_ASSERT((FLASH_SIZE_INST(inst) % CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE) == 0, \ +BUILD_ASSERT((FLASH_SIZE(inst) % CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE) == 0, \ "MSPI_NOR_FLASH_LAYOUT_PAGE_SIZE incompatible with flash size, instance " #inst); #else #define FLASH_PAGE_LAYOUT_DEFINE(inst) @@ -867,11 +878,14 @@ BUILD_ASSERT((FLASH_SIZE_INST(inst) % CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE) == (DT_INST_ENUM_IDX(inst, mspi_io_mode) == \ MSPI_IO_MODE_OCTAL), \ "Only 1x, 1-4-4 and 8x I/O modes are supported for now"); \ + SFDP_BUILD_ASSERTS(inst); \ PM_DEVICE_DT_INST_DEFINE(inst, dev_pm_action_cb); \ + DEFAULT_ERASE_TYPES_DEFINE(inst); \ static struct flash_mspi_nor_data dev##inst##_data; \ static const struct flash_mspi_nor_config dev##inst##_config = { \ .bus = DEVICE_DT_GET(DT_INST_BUS(inst)), \ - .flash_size = FLASH_SIZE_INST(inst), \ + .flash_size = FLASH_SIZE(inst), \ + .page_size = FLASH_PAGE_SIZE(inst), \ .mspi_id = MSPI_DEVICE_ID_DT_INST(inst), \ .mspi_nor_cfg = MSPI_DEVICE_CONFIG_DT_INST(inst), \ .mspi_nor_init_cfg = FLASH_INITIAL_CONFIG(inst), \ @@ -892,7 +906,9 @@ BUILD_ASSERT((FLASH_SIZE_INST(inst) % CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE) == .jedec_id = DT_INST_PROP(inst, jedec_id), \ .jedec_cmds = FLASH_CMDS(inst), \ .quirks = FLASH_QUIRKS(inst), \ - .dw15_qer = FLASH_DW15_QER(inst), \ + .default_erase_types = DEFAULT_ERASE_TYPES(inst), \ + .default_cmd_info = DEFAULT_CMD_INFO(inst), \ + .default_switch_info = DEFAULT_SWITCH_INFO(inst), \ }; \ FLASH_PAGE_LAYOUT_CHECK(inst) \ DEVICE_DT_INST_DEFINE(inst, \ diff --git a/drivers/flash/flash_mspi_nor.h b/drivers/flash/flash_mspi_nor.h index ad957f24bc79..a68162f148a1 100644 --- a/drivers/flash/flash_mspi_nor.h +++ b/drivers/flash/flash_mspi_nor.h @@ -20,9 +20,49 @@ extern "C" { #define WITH_RESET_GPIO 1 #endif +#define CMD_EXTENSION_NONE 0 +#define CMD_EXTENSION_SAME 1 +#define CMD_EXTENSION_INVERSE 2 + +#define ENTER_4BYTE_ADDR_NONE 0 +#define ENTER_4BYTE_ADDR_B7 1 +#define ENTER_4BYTE_ADDR_06_B7 2 + +struct flash_mspi_nor_cmd_info { + uint8_t read_cmd; + uint8_t read_mode_clocks : 3; + uint8_t read_dummy_clocks : 5; + uint8_t pp_cmd; + bool uses_4byte_addr : 1; + /* BFP, 18th DWORD, bits 30-29 */ + uint8_t cmd_extension : 2; + /* xSPI Profile 1.0 (ID FF05), 1st DWORD: */ + /* - Read SFDP command address bytes: 4 (true) or 3 */ + bool sfdp_addr_4 : 1; + /* - Read SDFP command dummy cycles: 20 (true) or 8 */ + bool sfdp_dummy_20 : 1; + /* - Read Status Register command address bytes: 4 (true) or 0 */ + bool rdsr_addr_4 : 1; + /* - Read Status Register command dummy cycles: 0, 4, or 8 */ + uint8_t rdsr_dummy : 4; + /* - Read JEDEC ID command parameters; not sure where to get their + * values from, but since for many flash chips they are the same + * as for RDSR, those are taken as defaults, see DEFAULT_CMD_INFO() + */ + bool rdid_addr_4 : 1; + uint8_t rdid_dummy : 4; +}; + +struct flash_mspi_nor_switch_info { + uint8_t quad_enable_req : 3; + uint8_t octal_enable_req : 3; + uint8_t enter_4byte_addr : 2; +}; + struct flash_mspi_nor_config { const struct device *bus; uint32_t flash_size; + uint16_t page_size; struct mspi_dev_id mspi_id; struct mspi_dev_cfg mspi_nor_cfg; struct mspi_dev_cfg mspi_nor_init_cfg; @@ -42,7 +82,9 @@ struct flash_mspi_nor_config { uint8_t jedec_id[SPI_NOR_MAX_ID_LEN]; const struct flash_mspi_nor_cmds *jedec_cmds; struct flash_mspi_nor_quirks *quirks; - uint8_t dw15_qer; + const struct jesd216_erase_type *default_erase_types; + struct flash_mspi_nor_cmd_info default_cmd_info; + struct flash_mspi_nor_switch_info default_switch_info; }; struct flash_mspi_nor_data { @@ -50,6 +92,9 @@ struct flash_mspi_nor_data { struct mspi_xfer_packet packet; struct mspi_xfer xfer; struct mspi_dev_cfg *curr_cfg; + struct jesd216_erase_type erase_types[JESD216_NUM_ERASE_TYPES]; + struct flash_mspi_nor_cmd_info cmd_info; + struct flash_mspi_nor_switch_info switch_info; }; struct flash_mspi_nor_cmd { diff --git a/drivers/flash/flash_mspi_nor_sfdp.h b/drivers/flash/flash_mspi_nor_sfdp.h new file mode 100644 index 000000000000..71139623fff8 --- /dev/null +++ b/drivers/flash/flash_mspi_nor_sfdp.h @@ -0,0 +1,331 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#define BFP_DW16_4B_ADDR_ENTER_B7 BIT(0) +#define BFP_DW16_4B_ADDR_ENTER_06_B7 BIT(1) +#define BFP_DW16_4B_ADDR_PER_CMD BIT(5) +#define BFP_DW16_4B_ADDR_ALWAYS BIT(6) + +#define BFP_DW18_CMD_EXT_SAME 0 +#define BFP_DW18_CMD_EXT_INV 1 + +#define BFP_DW19_OER_VAL_NONE 0 +#define BFP_DW19_OER_VAL_S2B3 1 + +/* 32-bit words in SFDP arrays in devicetree are stored in little-endian byte + * order. See jedec,jesd216.yaml + */ +#define SFDP_DW_BYTE_0_IDX(dw_no) \ + UTIL_DEC(UTIL_DEC(UTIL_DEC(UTIL_DEC(UTIL_X2(UTIL_X2(dw_no)))))) +#define SFDP_DW_BYTE_1_IDX(dw_no) \ + UTIL_DEC(UTIL_DEC(UTIL_DEC(UTIL_X2(UTIL_X2(dw_no))))) +#define SFDP_DW_BYTE_2_IDX(dw_no) \ + UTIL_DEC(UTIL_DEC(UTIL_X2(UTIL_X2(dw_no)))) +#define SFDP_DW_BYTE_3_IDX(dw_no) \ + UTIL_DEC(UTIL_X2(UTIL_X2(dw_no))) +#define SFDP_DW_BYTE(inst, prop, dw_no, byte_idx) \ + DT_INST_PROP_BY_IDX(inst, prop, SFDP_DW_BYTE_##byte_idx##_IDX(dw_no)) +#define SFDP_DW_EXISTS(inst, prop, dw_no) \ + DT_INST_PROP_HAS_IDX(inst, prop, SFDP_DW_BYTE_3_IDX(dw_no)) + +#define SFDP_DW(inst, prop, dw_no) \ + COND_CODE_1(SFDP_DW_EXISTS(inst, prop, dw_no), \ + (((SFDP_DW_BYTE(inst, prop, dw_no, 3) << 24) | \ + (SFDP_DW_BYTE(inst, prop, dw_no, 2) << 16) | \ + (SFDP_DW_BYTE(inst, prop, dw_no, 1) << 8) | \ + (SFDP_DW_BYTE(inst, prop, dw_no, 0) << 0))), \ + (0)) + +#define SFDP_FIELD(inst, prop, dw_no, mask) \ + FIELD_GET(mask, SFDP_DW(inst, prop, dw_no)) + +#define BFP_FLASH_DENSITY(dw2) \ + ((dw2 & BIT(31)) \ + ? BIT(dw2 & BIT_MASK(31)) \ + : dw2) + +/* Quad Enable Requirement from 15th DWORD of BFP */ +#define BSP_DW15_QER(inst) \ + DT_INST_ENUM_IDX_OR(inst, quad_enable_requirements, \ + SFDP_FIELD(inst, sfdp_bfp, 15, GENMASK(22, 20))) + +/* Octal Enable Requirement from 19th DWORD of BFP */ +#define BSP_DW19_OER(inst) \ + SFDP_FIELD(inst, sfdp_bfp, 19, GENMASK(22, 20)) + +#define BFP_DW1_ADDRESS_BYTES(inst) \ + SFDP_FIELD(inst, sfdp_bfp, 1, GENMASK(18, 17)) + +#define BFP_DW18_CMD_EXT(inst) \ + SFDP_FIELD(inst, sfdp_bfp, 18, GENMASK(30, 29)) + +#define BFP_ENTER_4BYTE_ADDR_METHODS(inst) \ + SFDP_FIELD(inst, sfdp_bfp, 16, GENMASK(31, 24)) + +#define USES_8D_8D_8D(inst) \ + (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_OCTAL && \ + DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_DUAL) +#define USES_8S_8S_8S(inst) \ + (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_OCTAL && \ + DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_SINGLE) +#define USES_1S_8D_8D(inst) \ + (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_OCTAL_1_8_8 && \ + DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_DUAL) +#define USES_1S_8S_8S(inst) \ + (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_OCTAL_1_8_8 && \ + DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_SINGLE) +#define USES_1S_1S_8S(inst) \ + (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_OCTAL_1_1_8 && \ + DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_SINGLE) +#define USES_4S_4D_4D(inst) \ + (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_QUAD && \ + DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_DUAL) +#define USES_4S_4S_4S(inst) \ + (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_QUAD && \ + DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_SINGLE) +#define USES_1S_4D_4D(inst) \ + (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_QUAD_1_4_4 && \ + DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_DUAL) +#define USES_1S_4S_4S(inst) \ + (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_QUAD_1_4_4 && \ + DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_SINGLE) +#define USES_1S_1S_4S(inst) \ + (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_QUAD_1_1_4 && \ + DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_SINGLE) +#define USES_2S_2S_2S(inst) \ + (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_DUAL && \ + DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_SINGLE) +#define USES_1S_2D_2D(inst) \ + (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_DUAL_1_2_2 && \ + DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_DUAL) +#define USES_1S_2S_2S(inst) \ + (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_DUAL_1_2_2 && \ + DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_SINGLE) +#define USES_1S_1S_2S(inst) \ + (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_DUAL_1_1_2 && \ + DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_SINGLE) +#define USES_1S_1D_1D(inst) \ + (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_SINGLE && \ + DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_DUAL) +#define USES_1S_1S_1S(inst) \ + (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_SINGLE && \ + DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_SINGLE) + +#define USES_OCTAL_IO(inst) \ + (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_OCTAL) + +#define USES_4BYTE_ADDR(inst) \ + (USES_OCTAL_IO(inst) || \ + BFP_DW1_ADDRESS_BYTES(inst) == JESD216_SFDP_BFP_DW1_ADDRBYTES_VAL_4B) + +#define CMD_EXTENSION(inst) \ + (!USES_8D_8D_8D(inst) ? CMD_EXTENSION_NONE : \ + (BFP_DW18_CMD_EXT(inst) \ + == BFP_DW18_CMD_EXT_INV) ? CMD_EXTENSION_INVERSE \ + : CMD_EXTENSION_SAME) + + +#define FF84_DW1_BIT(inst, bit) (SFDP_DW(inst, sfdp_ff84, 1) & BIT(bit)) + +#define SFDP_CMD_PP(inst) \ + USES_1S_4S_4S(inst) ? SPI_NOR_CMD_PP_1_4_4 : \ + USES_1S_1S_4S(inst) ? SPI_NOR_CMD_PP_1_1_4 : \ + SPI_NOR_CMD_PP +#define SFDP_CMD_PP_4B(inst) \ + USES_1S_8S_8S(inst) && FF84_DW1_BIT(inst, 24) ? 0x8E : \ + USES_1S_1S_8S(inst) && FF84_DW1_BIT(inst, 23) ? 0x84 : \ + USES_1S_4S_4S(inst) && FF84_DW1_BIT(inst, 8) ? SPI_NOR_CMD_PP_1_4_4_4B : \ + USES_1S_1S_4S(inst) && FF84_DW1_BIT(inst, 7) ? SPI_NOR_CMD_PP_1_1_4_4B : \ + FF84_DW1_BIT(inst, 6) ? SPI_NOR_CMD_PP_4B \ + : 0 +#define SFDP_CMD_FAST_READ(inst) \ + USES_1S_8D_8D(inst) ? 0 : \ + USES_1S_8S_8S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 17, GENMASK(15, 8)) : \ + USES_1S_1S_8S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 17, GENMASK(31, 24)) : \ + USES_4S_4D_4D(inst) ? SFDP_FIELD(inst, sfdp_bfp, 23, GENMASK(31, 24)) : \ + USES_4S_4S_4S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 7, GENMASK(31, 24)) : \ + USES_1S_4D_4D(inst) ? SFDP_FIELD(inst, sfdp_bfp, 23, GENMASK(15, 8)) : \ + USES_1S_4S_4S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 3, GENMASK(15, 8)) : \ + USES_1S_1S_4S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 3, GENMASK(31, 24)) : \ + USES_2S_2S_2S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 6, GENMASK(31, 24)) : \ + USES_1S_2D_2D(inst) ? SFDP_FIELD(inst, sfdp_bfp, 22, GENMASK(31, 24)) : \ + USES_1S_2S_2S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 4, GENMASK(31, 24)) : \ + USES_1S_1S_2S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 4, GENMASK(15, 8)) : \ + USES_1S_1D_1D(inst) ? SFDP_FIELD(inst, sfdp_bfp, 22, GENMASK(15, 8)) : \ + SPI_NOR_CMD_READ_FAST +#define SFDP_CMD_FAST_READ_4B(inst) \ + USES_8D_8D_8D(inst) ? 0xEE : \ + USES_8S_8S_8S(inst) ? 0xEC : \ + USES_1S_8D_8D(inst) && FF84_DW1_BIT(inst, 22) ? 0xFD : \ + USES_1S_8S_8S(inst) && FF84_DW1_BIT(inst, 21) ? 0xCC : \ + USES_1S_1S_8S(inst) && FF84_DW1_BIT(inst, 20) ? 0x7C : \ + USES_4S_4D_4D(inst) ? 0 : \ + USES_4S_4S_4S(inst) ? 0 : \ + USES_1S_4D_4D(inst) && FF84_DW1_BIT(inst, 15) ? 0xEE : \ + USES_1S_4S_4S(inst) && FF84_DW1_BIT(inst, 5) ? 0xEC : \ + USES_1S_1S_4S(inst) && FF84_DW1_BIT(inst, 4) ? 0x6C : \ + USES_2S_2S_2S(inst) ? 0 : \ + USES_1S_2D_2D(inst) && FF84_DW1_BIT(inst, 14) ? 0xBE : \ + USES_1S_2S_2S(inst) && FF84_DW1_BIT(inst, 3) ? 0xBC : \ + USES_1S_1S_2S(inst) && FF84_DW1_BIT(inst, 2) ? 0x3C : \ + USES_1S_1D_1D(inst) && FF84_DW1_BIT(inst, 13) ? 0x0E : \ + FF84_DW1_BIT(inst, 1) ? SPI_NOR_CMD_READ_FAST_4B : \ + 0 + +#define DEFAULT_CMD_INFO(inst) { \ + .pp_cmd = USES_4BYTE_ADDR(inst) \ + ? SFDP_CMD_PP_4B(inst) \ + : SFDP_CMD_PP(inst), \ + .read_cmd = USES_4BYTE_ADDR(inst) \ + ? SFDP_CMD_FAST_READ_4B(inst) \ + : SFDP_CMD_FAST_READ(inst), \ + .read_mode_clocks = \ + USES_1S_8S_8S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 17, GENMASK(7, 5)) : \ + USES_1S_1S_8S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 17, GENMASK(23, 21)) : \ + USES_4S_4D_4D(inst) ? SFDP_FIELD(inst, sfdp_bfp, 23, GENMASK(23, 21)) : \ + USES_4S_4S_4S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 7, GENMASK(23, 21)) : \ + USES_1S_4D_4D(inst) ? SFDP_FIELD(inst, sfdp_bfp, 23, GENMASK(7, 5)) : \ + USES_1S_4S_4S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 3, GENMASK(7, 5)) : \ + USES_1S_1S_4S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 3, GENMASK(23, 21)) : \ + USES_2S_2S_2S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 6, GENMASK(23, 21)) : \ + USES_1S_2D_2D(inst) ? SFDP_FIELD(inst, sfdp_bfp, 22, GENMASK(23, 21)) : \ + USES_1S_2S_2S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 4, GENMASK(23, 21)) : \ + USES_1S_1S_2S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 4, GENMASK(7, 5)) : \ + USES_1S_1D_1D(inst) ? SFDP_FIELD(inst, sfdp_bfp, 22, GENMASK(7, 5)) : \ + USES_1S_1S_1S(inst) ? 0 : \ + 0, \ + .read_dummy_clocks = DT_INST_PROP_OR(inst, rx_dummy, \ + USES_8D_8D_8D(inst) ? 20 : \ + USES_8S_8S_8S(inst) ? 20 : \ + USES_1S_8S_8S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 17, GENMASK(4, 0)) : \ + USES_1S_1S_8S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 17, GENMASK(20, 16)) : \ + USES_4S_4D_4D(inst) ? SFDP_FIELD(inst, sfdp_bfp, 23, GENMASK(20, 16)) : \ + USES_4S_4S_4S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 7, GENMASK(20, 16)) : \ + USES_1S_4D_4D(inst) ? SFDP_FIELD(inst, sfdp_bfp, 23, GENMASK(4, 0)) : \ + USES_1S_4S_4S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 3, GENMASK(4, 0)) : \ + USES_1S_1S_4S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 3, GENMASK(20, 16)) : \ + USES_2S_2S_2S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 6, GENMASK(20, 16)) : \ + USES_1S_2D_2D(inst) ? SFDP_FIELD(inst, sfdp_bfp, 22, GENMASK(20, 16)) : \ + USES_1S_2S_2S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 4, GENMASK(20, 16)) : \ + USES_1S_1S_2S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 4, GENMASK(4, 0)) : \ + USES_1S_1D_1D(inst) ? SFDP_FIELD(inst, sfdp_bfp, 22, GENMASK(4, 0)) : \ + USES_1S_1S_1S(inst) ? 8 : \ + 0), \ + .uses_4byte_addr = USES_4BYTE_ADDR(inst), \ + .cmd_extension = CMD_EXTENSION(inst), \ + .sfdp_addr_4 = USES_OCTAL_IO(inst) \ + ? (SFDP_FIELD(inst, sfdp_ff05, 1, BIT(31)) == 0) \ + : false, \ + .sfdp_dummy_20 = USES_OCTAL_IO(inst) \ + ? (SFDP_FIELD(inst, sfdp_ff05, 1, BIT(30)) == 1) \ + : false, \ + .rdsr_addr_4 = USES_OCTAL_IO(inst) \ + ? (SFDP_FIELD(inst, sfdp_ff05, 1, BIT(29)) == 1) \ + : false, \ + .rdsr_dummy = USES_OCTAL_IO(inst) \ + ? (SFDP_FIELD(inst, sfdp_ff05, 1, BIT(28)) ? 8 : 4) \ + : 0, \ + .rdid_addr_4 = USES_OCTAL_IO(inst) \ + ? (SFDP_FIELD(inst, sfdp_ff05, 1, BIT(29)) == 1) \ + : false, \ + .rdid_dummy = USES_OCTAL_IO(inst) \ + ? (SFDP_FIELD(inst, sfdp_ff05, 1, BIT(28)) ? 8 : 4) \ + : 0, } + +/* Erase Types, 8th and 9th DWORD of BSP */ +#define BFP_DW8_CMD_ET_1(inst) SFDP_FIELD(inst, sfdp_bfp, 8, GENMASK(15, 8)) +#define BFP_DW8_EXP_ET_1(inst) SFDP_FIELD(inst, sfdp_bfp, 8, GENMASK(7, 0)) +#define BFP_DW8_CMD_ET_2(inst) SFDP_FIELD(inst, sfdp_bfp, 8, GENMASK(31, 24)) +#define BFP_DW8_EXP_ET_2(inst) SFDP_FIELD(inst, sfdp_bfp, 8, GENMASK(23, 16)) +#define BFP_DW9_CMD_ET_3(inst) SFDP_FIELD(inst, sfdp_bfp, 9, GENMASK(15, 8)) +#define BFP_DW9_EXP_ET_3(inst) SFDP_FIELD(inst, sfdp_bfp, 9, GENMASK(7, 0)) +#define BFP_DW9_CMD_ET_4(inst) SFDP_FIELD(inst, sfdp_bfp, 9, GENMASK(31, 24)) +#define BFP_DW9_EXP_ET_4(inst) SFDP_FIELD(inst, sfdp_bfp, 9, GENMASK(23, 16)) + +/* 4-byte Address instructions for Erase Types defined in 8th and 9th DWORD + * of BFP; 2nd DWORD of 4-byte Address Instruction Table (ID FF84) + */ +#define FF84_DW2_CMD_ET_1(inst) SFDP_FIELD(inst, sfdp_ff84, 2, GENMASK(7, 0)) +#define FF84_DW2_CMD_ET_2(inst) SFDP_FIELD(inst, sfdp_ff84, 2, GENMASK(15, 8)) +#define FF84_DW2_CMD_ET_3(inst) SFDP_FIELD(inst, sfdp_ff84, 2, GENMASK(23, 16)) +#define FF84_DW2_CMD_ET_4(inst) SFDP_FIELD(inst, sfdp_ff84, 2, GENMASK(31, 24)) +/* Support for Erase Types in 4-byte Address mode; table FF84, 1st DWORD */ +#define FF84_DW1_SUP_ET_1(inst) SFDP_FIELD(inst, sfdp_ff84, 1, BIT(9)) +#define FF84_DW1_SUP_ET_2(inst) SFDP_FIELD(inst, sfdp_ff84, 1, BIT(10)) +#define FF84_DW1_SUP_ET_3(inst) SFDP_FIELD(inst, sfdp_ff84, 1, BIT(11)) +#define FF84_DW1_SUP_ET_4(inst) SFDP_FIELD(inst, sfdp_ff84, 1, BIT(12)) + +#define DEFAULT_ERASE_TYPES_DEFINE(inst) \ + static const struct jesd216_erase_type \ + dev##inst##_erase_types[JESD216_NUM_ERASE_TYPES] = \ + COND_CODE_1(SFDP_DW_EXISTS(inst, sfdp_bfp, 8), \ + ({{ .cmd = BFP_DW8_CMD_ET_1(inst), \ + .exp = BFP_DW8_EXP_ET_1(inst), }, \ + { .cmd = BFP_DW8_CMD_ET_2(inst), \ + .exp = BFP_DW8_EXP_ET_2(inst), }, \ + { .cmd = BFP_DW9_CMD_ET_3(inst), \ + .exp = BFP_DW9_EXP_ET_3(inst), }, \ + { .cmd = BFP_DW9_CMD_ET_4(inst), \ + .exp = BFP_DW9_EXP_ET_4(inst), }}), \ + ({{ .cmd = SPI_NOR_CMD_SE, \ + .exp = 0x0C }})); \ + static const struct jesd216_erase_type \ + dev##inst##_erase_types_4b[JESD216_NUM_ERASE_TYPES] = \ + COND_CODE_1(UTIL_AND(SFDP_DW_EXISTS(inst, sfdp_ff84, 2), \ + SFDP_DW_EXISTS(inst, sfdp_bfp, 9)), \ + ({{ .cmd = FF84_DW2_CMD_ET_1(inst), \ + .exp = FF84_DW1_SUP_ET_1(inst) \ + ? BFP_DW8_EXP_ET_1(inst) \ + : 0, }, \ + { .cmd = FF84_DW2_CMD_ET_2(inst), \ + .exp = FF84_DW1_SUP_ET_2(inst) \ + ? BFP_DW8_EXP_ET_2(inst) \ + : 0, }, \ + { .cmd = FF84_DW2_CMD_ET_3(inst), \ + .exp = FF84_DW1_SUP_ET_3(inst) \ + ? BFP_DW9_EXP_ET_3(inst) \ + : 0, }, \ + { .cmd = FF84_DW2_CMD_ET_4(inst), \ + .exp = FF84_DW1_SUP_ET_4(inst) \ + ? BFP_DW9_EXP_ET_4(inst) \ + : 0, }}), \ + ({{ .cmd = SPI_NOR_CMD_SE_4B, \ + .exp = 0x0C }})) + +#define DEFAULT_ERASE_TYPES(inst) \ + USES_4BYTE_ADDR(inst) ? dev##inst##_erase_types_4b \ + : dev##inst##_erase_types + +#define ENTER_4BYTE_ADDR(inst) \ + (!USES_4BYTE_ADDR(inst) ? ENTER_4BYTE_ADDR_NONE : \ + (BFP_ENTER_4BYTE_ADDR_METHODS(inst) \ + & BFP_DW16_4B_ADDR_ENTER_B7) ? ENTER_4BYTE_ADDR_B7 : \ + (BFP_ENTER_4BYTE_ADDR_METHODS(inst) \ + & BFP_DW16_4B_ADDR_ENTER_06_B7) ? ENTER_4BYTE_ADDR_06_B7 : \ + ENTER_4BYTE_ADDR_NONE) + +#define DEFAULT_SWITCH_INFO(inst) { \ + .quad_enable_req = BSP_DW15_QER(inst), \ + .octal_enable_req = BSP_DW19_OER(inst), \ + .enter_4byte_addr = ENTER_4BYTE_ADDR(inst) } + +#define SFDP_BUILD_ASSERTS(inst) \ + BUILD_ASSERT(DT_INST_NODE_HAS_PROP(inst, sfdp_bfp), \ + "sfdp-bfp property needed in " \ + DT_NODE_FULL_NAME(DT_DRV_INST(inst))); \ + BUILD_ASSERT((DT_INST_ENUM_IDX(inst, mspi_io_mode) \ + != MSPI_IO_MODE_OCTAL) || \ + DT_INST_NODE_HAS_PROP(inst, sfdp_ff05), \ + "sfdp-ff05 property needed in " \ + DT_NODE_FULL_NAME(DT_DRV_INST(inst))); \ + BUILD_ASSERT(!USES_4BYTE_ADDR(inst) || \ + DT_INST_NODE_HAS_PROP(inst, sfdp_ff84), \ + "sfdp-ff84 property needed in " \ + DT_NODE_FULL_NAME(DT_DRV_INST(inst))); \ + BUILD_ASSERT(!USES_8D_8D_8D(inst) || \ + BFP_DW18_CMD_EXT(inst) <= BFP_DW18_CMD_EXT_INV, \ + "Unsupported Octal Command Extension mode in " \ + DT_NODE_FULL_NAME(DT_DRV_INST(inst))) diff --git a/dts/bindings/mtd/jedec,jesd216.yaml b/dts/bindings/mtd/jedec,jesd216.yaml index c55440456c2a..d5f75c74dd3d 100644 --- a/dts/bindings/mtd/jedec,jesd216.yaml +++ b/dts/bindings/mtd/jedec,jesd216.yaml @@ -35,6 +35,18 @@ properties: information in cases were runtime retrieval of SFDP data is not desired. + sfdp-ff05: + type: uint8-array + description: | + Contains the 32-bit words in little-endian byte order from the JESD216 + SFDP xSPI Profile 1.0 table. + + sfdp-ff84: + type: uint8-array + description: | + Contains the 32-bit words in little-endian byte order from the JESD216 + SFDP 4-byte Address Instruction Parameter table. + quad-enable-requirements: type: string enum: From bbf056735bf2a4612e06d7745a51629624e59079 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Fri, 11 Jul 2025 14:46:28 +0200 Subject: [PATCH 0450/2141] [nrf fromlist] drivers: flash_mspi_nor: Refactor handling of commands MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Use standard operation codes and parameters from SFDP for handling the used flash commands (allow to override some of them through dts with the `read-command`, `write-command`, and `rx-dummy` properties) - Use all available erase types as specified by SFDP - Allow using all IO modes - Add support for switching to 4-byte addressing mode - Use common functions for reading and writing of status registers and for enabling write operations - Switch IO mode (between the target one and Single IO) in a common function that performs transfers and do it only when required for a given command Upstream PR #: 93093 Signed-off-by: Andrzej Głąbek (cherry picked from commit 505db63d42ad89f1bb5c4b1caa07dbfd6d999be2) --- drivers/flash/flash_mspi_nor.c | 613 +++++++++++++++----------- drivers/flash/flash_mspi_nor.h | 200 +-------- drivers/flash/flash_mspi_nor_quirks.h | 77 ++-- drivers/flash/flash_mspi_nor_sfdp.h | 14 + dts/bindings/mtd/jedec,mspi-nor.yaml | 8 + 5 files changed, 428 insertions(+), 484 deletions(-) diff --git a/drivers/flash/flash_mspi_nor.c b/drivers/flash/flash_mspi_nor.c index 2403160e296a..cb74abccef70 100644 --- a/drivers/flash/flash_mspi_nor.c +++ b/drivers/flash/flash_mspi_nor.c @@ -13,14 +13,26 @@ #include "flash_mspi_nor.h" #include "flash_mspi_nor_sfdp.h" + +#define INVALID_DTS_RX_DUMMY 0xFF + +static void set_up_xfer(const struct device *dev, enum mspi_xfer_direction dir); +static int perform_xfer(const struct device *dev, + uint8_t cmd, bool in_target_io_mode); +static int cmd_rdsr(const struct device *dev, uint8_t op_code, uint8_t *sr); +static int wait_until_ready(const struct device *dev, k_timeout_t poll_period); +static int cmd_wren(const struct device *dev); +static int cmd_wrsr(const struct device *dev, uint8_t op_code, + uint8_t sr_cnt, uint8_t *sr); + #include "flash_mspi_nor_quirks.h" LOG_MODULE_REGISTER(flash_mspi_nor, CONFIG_FLASH_LOG_LEVEL); -void flash_mspi_command_set(const struct device *dev, const struct flash_mspi_nor_cmd *cmd) +static void set_up_xfer(const struct device *dev, enum mspi_xfer_direction dir) { - struct flash_mspi_nor_data *dev_data = dev->data; const struct flash_mspi_nor_config *dev_config = dev->config; + struct flash_mspi_nor_data *dev_data = dev->data; memset(&dev_data->xfer, 0, sizeof(dev_data->xfer)); memset(&dev_data->packet, 0, sizeof(dev_data->packet)); @@ -30,32 +42,94 @@ void flash_mspi_command_set(const struct device *dev, const struct flash_mspi_no dev_data->xfer.num_packet = 1; dev_data->xfer.timeout = dev_config->transfer_timeout; - dev_data->xfer.cmd_length = cmd->cmd_length; - dev_data->xfer.addr_length = cmd->addr_length; - dev_data->xfer.tx_dummy = (cmd->dir == MSPI_TX) ? - cmd->tx_dummy : dev_config->mspi_nor_cfg.tx_dummy; - dev_data->xfer.rx_dummy = (cmd->dir == MSPI_RX) ? - cmd->rx_dummy : dev_config->mspi_nor_cfg.rx_dummy; + dev_data->packet.dir = dir; +} + +static void set_up_xfer_with_addr(const struct device *dev, + enum mspi_xfer_direction dir, + uint32_t addr) +{ + struct flash_mspi_nor_data *dev_data = dev->data; - dev_data->packet.dir = cmd->dir; - dev_data->packet.cmd = cmd->cmd; + set_up_xfer(dev, dir); + dev_data->xfer.addr_length = dev_data->cmd_info.uses_4byte_addr + ? 4 : 3; + dev_data->packet.address = addr; } -static int dev_cfg_apply(const struct device *dev, const struct mspi_dev_cfg *cfg) +static int perform_xfer(const struct device *dev, + uint8_t cmd, bool data_transfer) { const struct flash_mspi_nor_config *dev_config = dev->config; struct flash_mspi_nor_data *dev_data = dev->data; + const struct mspi_dev_cfg *cfg = NULL; + int rc; - if (dev_data->curr_cfg == cfg) { - return 0; + if (dev_data->cmd_info.cmd_extension != CMD_EXTENSION_NONE && + dev_data->in_target_io_mode) { + uint8_t cmd_extension = cmd; + + if (dev_data->cmd_info.cmd_extension == CMD_EXTENSION_INVERSE) { + cmd_extension = ~cmd_extension; + } + + dev_data->xfer.cmd_length = 2; + dev_data->packet.cmd = ((uint16_t)cmd << 8) + | cmd_extension; + } else { + dev_data->xfer.cmd_length = 1; + dev_data->packet.cmd = cmd; + } + + if (dev_config->multi_io_cmd || + dev_config->mspi_nor_cfg.io_mode == MSPI_IO_MODE_SINGLE) { + /* If multiple IO lines are used in all the transfer phases + * or in none of them, there's no need to switch the IO mode. + */ + } else if (data_transfer) { + /* For data transfer commands (read and program), ensure that + * the target IO mode is active. + */ + if (!dev_data->in_target_io_mode) { + cfg = &dev_config->mspi_nor_cfg; + } + } else { + /* For all other commands, switch to Single IO mode if a given + * command needs the data or address phase and in the target IO + * mode multiple IO lines are used in these phases. + */ + if (dev_data->in_target_io_mode) { + if (dev_data->packet.num_bytes != 0 || + (dev_data->xfer.addr_length != 0 && + !dev_config->single_io_addr)) { + /* Only the IO mode is to be changed, so the + * initial configuration structure can be used + * for this operation. + */ + cfg = &dev_config->mspi_nor_init_cfg; + } + } + } + + if (cfg) { + rc = mspi_dev_config(dev_config->bus, &dev_config->mspi_id, + MSPI_DEVICE_CONFIG_IO_MODE, cfg); + if (rc < 0) { + LOG_ERR("%s: dev_config() failed: %d", __func__, rc); + return rc; + } + + dev_data->in_target_io_mode = data_transfer; } - int rc = mspi_dev_config(dev_config->bus, &dev_config->mspi_id, - MSPI_DEVICE_CONFIG_ALL, cfg); + rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, + &dev_data->xfer); if (rc < 0) { - LOG_ERR("Failed to set device config: %p error: %d", cfg, rc); + LOG_ERR("%s: transceive() failed: %d", __func__, rc); + return rc; } - return rc; + + return 0; } static int acquire(const struct device *dev) @@ -70,15 +144,26 @@ static int acquire(const struct device *dev) if (rc < 0) { LOG_ERR("pm_device_runtime_get() failed: %d", rc); } else { + enum mspi_dev_cfg_mask mask; + + if (dev_config->multiperipheral_bus) { + mask = MSPI_DEVICE_CONFIG_ALL; + } else { + mask = MSPI_DEVICE_CONFIG_NONE; + } + /* This acquires the MSPI controller and reconfigures it * if needed for the flash device. */ rc = mspi_dev_config(dev_config->bus, &dev_config->mspi_id, - dev_config->mspi_nor_cfg_mask, - &dev_config->mspi_nor_cfg); + mask, &dev_config->mspi_nor_cfg); if (rc < 0) { LOG_ERR("mspi_dev_config() failed: %d", rc); } else { + if (dev_config->multiperipheral_bus) { + dev_data->in_target_io_mode = true; + } + return 0; } @@ -116,134 +201,145 @@ static inline uint16_t dev_page_size(const struct device *dev) return dev_config->page_size; } -static int api_read(const struct device *dev, off_t addr, void *dest, - size_t size) +static inline +const struct jesd216_erase_type *dev_erase_types(const struct device *dev) { - const struct flash_mspi_nor_config *dev_config = dev->config; struct flash_mspi_nor_data *dev_data = dev->data; - const uint32_t flash_size = dev_flash_size(dev); - int rc; - if (size == 0) { - return 0; - } + return dev_data->erase_types; +} - if ((addr < 0) || ((addr + size) > flash_size)) { - return -EINVAL; - } +static int cmd_rdsr(const struct device *dev, uint8_t op_code, uint8_t *sr) +{ + struct flash_mspi_nor_data *dev_data = dev->data; + int rc; - rc = acquire(dev); + set_up_xfer(dev, MSPI_RX); + if (dev_data->in_target_io_mode) { + dev_data->xfer.rx_dummy = dev_data->cmd_info.rdsr_dummy; + dev_data->xfer.addr_length = dev_data->cmd_info.rdsr_addr_4 + ? 4 : 0; + } + dev_data->packet.num_bytes = sizeof(uint8_t); + dev_data->packet.data_buf = sr; + rc = perform_xfer(dev, op_code, false); if (rc < 0) { + LOG_ERR("%s 0x%02x failed: %d", __func__, op_code, rc); return rc; } - if (dev_config->jedec_cmds->read.force_single) { - rc = dev_cfg_apply(dev, &dev_config->mspi_nor_init_cfg); - } else { - rc = dev_cfg_apply(dev, &dev_config->mspi_nor_cfg); - } + return 0; +} - if (rc < 0) { - return rc; +static int wait_until_ready(const struct device *dev, k_timeout_t poll_period) +{ + int rc; + uint8_t status_reg; + + while (true) { + rc = cmd_rdsr(dev, SPI_NOR_CMD_RDSR, &status_reg); + if (rc < 0) { + LOG_ERR("%s - status xfer failed: %d", __func__, rc); + return rc; + } + + if (!(status_reg & SPI_NOR_WIP_BIT)) { + break; + } + + k_sleep(poll_period); } - /* TODO: get rid of all these hard-coded values for MX25Ux chips */ - flash_mspi_command_set(dev, &dev_config->jedec_cmds->read); - dev_data->packet.address = addr; - dev_data->packet.data_buf = dest; - dev_data->packet.num_bytes = size; - rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, - &dev_data->xfer); + return 0; +} - release(dev); +static int cmd_wren(const struct device *dev) +{ + int rc; + set_up_xfer(dev, MSPI_TX); + rc = perform_xfer(dev, SPI_NOR_CMD_WREN, false); if (rc < 0) { - LOG_ERR("Read xfer failed: %d", rc); + LOG_ERR("%s failed: %d", __func__, rc); return rc; } return 0; } -static int status_get(const struct device *dev, uint8_t *status) +static int cmd_wrsr(const struct device *dev, uint8_t op_code, + uint8_t sr_cnt, uint8_t *sr) { - const struct flash_mspi_nor_config *dev_config = dev->config; struct flash_mspi_nor_data *dev_data = dev->data; int rc; - /* Enter command mode */ - if (dev_config->jedec_cmds->status.force_single) { - rc = dev_cfg_apply(dev, &dev_config->mspi_nor_init_cfg); - } else { - rc = dev_cfg_apply(dev, &dev_config->mspi_nor_cfg); + rc = cmd_wren(dev); + if (rc < 0) { + return rc; } + set_up_xfer(dev, MSPI_TX); + dev_data->packet.num_bytes = sr_cnt; + dev_data->packet.data_buf = sr; + rc = perform_xfer(dev, op_code, false); if (rc < 0) { - LOG_ERR("Switching to dev_cfg failed: %d", rc); + LOG_ERR("%s 0x%02x failed: %d", __func__, op_code, rc); return rc; } - flash_mspi_command_set(dev, &dev_config->jedec_cmds->status); - dev_data->packet.data_buf = status; - dev_data->packet.num_bytes = sizeof(uint8_t); - - rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, &dev_data->xfer); - + rc = wait_until_ready(dev, K_USEC(1)); if (rc < 0) { - LOG_ERR("Status xfer failed: %d", rc); return rc; } - return rc; + return 0; } -static int wait_until_ready(const struct device *dev, k_timeout_t poll_period) +static int api_read(const struct device *dev, off_t addr, void *dest, + size_t size) { + const struct flash_mspi_nor_config *dev_config = dev->config; + struct flash_mspi_nor_data *dev_data = dev->data; + const uint32_t flash_size = dev_flash_size(dev); int rc; - uint8_t status_reg; - - while (true) { - rc = status_get(dev, &status_reg); - - if (rc < 0) { - LOG_ERR("Wait until ready - status xfer failed: %d", rc); - return rc; - } - if (!(status_reg & SPI_NOR_WIP_BIT)) { - break; - } - - k_sleep(poll_period); + if (size == 0) { + return 0; } - return 0; -} + if ((addr < 0) || ((addr + size) > flash_size)) { + return -EINVAL; + } -static int write_enable(const struct device *dev) -{ - const struct flash_mspi_nor_config *dev_config = dev->config; - struct flash_mspi_nor_data *dev_data = dev->data; - int rc; + rc = acquire(dev); + if (rc < 0) { + return rc; + } - if (dev_config->jedec_cmds->write_en.force_single) { - rc = dev_cfg_apply(dev, &dev_config->mspi_nor_init_cfg); + set_up_xfer_with_addr(dev, MSPI_RX, addr); + if (dev_config->dts_rx_dummy != INVALID_DTS_RX_DUMMY) { + dev_data->xfer.rx_dummy = dev_config->dts_rx_dummy; } else { - rc = dev_cfg_apply(dev, &dev_config->mspi_nor_cfg); + dev_data->xfer.rx_dummy = dev_data->cmd_info.read_mode_clocks + + dev_data->cmd_info.read_dummy_clocks; } + dev_data->packet.data_buf = dest; + dev_data->packet.num_bytes = size; + rc = perform_xfer(dev, dev_data->cmd_info.read_cmd, true); + + release(dev); if (rc < 0) { + LOG_ERR("Read xfer failed: %d", rc); return rc; } - flash_mspi_command_set(dev, &dev_config->jedec_cmds->write_en); - return mspi_transceive(dev_config->bus, &dev_config->mspi_id, &dev_data->xfer); + return 0; } static int api_write(const struct device *dev, off_t addr, const void *src, size_t size) { - const struct flash_mspi_nor_config *dev_config = dev->config; struct flash_mspi_nor_data *dev_data = dev->data; const uint32_t flash_size = dev_flash_size(dev); const uint16_t page_size = dev_page_size(dev); @@ -268,27 +364,14 @@ static int api_write(const struct device *dev, off_t addr, const void *src, uint16_t page_left = page_size - page_offset; uint16_t to_write = (uint16_t)MIN(size, page_left); - if (write_enable(dev) < 0) { - LOG_ERR("Write enable xfer failed: %d", rc); + if (cmd_wren(dev) < 0) { break; } - if (dev_config->jedec_cmds->page_program.force_single) { - rc = dev_cfg_apply(dev, &dev_config->mspi_nor_init_cfg); - } else { - rc = dev_cfg_apply(dev, &dev_config->mspi_nor_cfg); - } - - if (rc < 0) { - return rc; - } - - flash_mspi_command_set(dev, &dev_config->jedec_cmds->page_program); - dev_data->packet.address = addr; + set_up_xfer_with_addr(dev, MSPI_TX, addr); dev_data->packet.data_buf = (uint8_t *)src; dev_data->packet.num_bytes = to_write; - rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, - &dev_data->xfer); + rc = perform_xfer(dev, dev_data->cmd_info.pp_cmd, true); if (rc < 0) { LOG_ERR("Page program xfer failed: %d", rc); break; @@ -309,9 +392,28 @@ static int api_write(const struct device *dev, off_t addr, const void *src, return rc; } +static const struct jesd216_erase_type *find_best_erase_type( + const struct device *dev, off_t addr, size_t size) +{ + const struct jesd216_erase_type *erase_types = dev_erase_types(dev); + const struct jesd216_erase_type *best_et = NULL; + + for (int i = 0; i < JESD216_NUM_ERASE_TYPES; ++i) { + const struct jesd216_erase_type *et = &erase_types[i]; + + if ((et->exp != 0) + && SPI_NOR_IS_ALIGNED(addr, et->exp) + && (size >= BIT(et->exp)) + && ((best_et == NULL) || (et->exp > best_et->exp))) { + best_et = et; + } + } + + return best_et; +} + static int api_erase(const struct device *dev, off_t addr, size_t size) { - const struct flash_mspi_nor_config *dev_config = dev->config; struct flash_mspi_nor_data *dev_data = dev->data; const uint32_t flash_size = dev_flash_size(dev); int rc = 0; @@ -334,45 +436,33 @@ static int api_erase(const struct device *dev, off_t addr, size_t size) } while (size > 0) { - rc = write_enable(dev); - if (rc < 0) { - LOG_ERR("Write enable failed."); + if (cmd_wren(dev) < 0) { break; } if (size == flash_size) { /* Chip erase. */ - if (dev_config->jedec_cmds->chip_erase.force_single) { - rc = dev_cfg_apply(dev, &dev_config->mspi_nor_init_cfg); - } else { - rc = dev_cfg_apply(dev, &dev_config->mspi_nor_cfg); - } - - if (rc < 0) { - return rc; - } + set_up_xfer(dev, MSPI_TX); + rc = perform_xfer(dev, SPI_NOR_CMD_CE, false); - flash_mspi_command_set(dev, &dev_config->jedec_cmds->chip_erase); size -= flash_size; } else { - /* Sector erase. */ - if (dev_config->jedec_cmds->sector_erase.force_single) { - rc = dev_cfg_apply(dev, &dev_config->mspi_nor_init_cfg); - } else { - rc = dev_cfg_apply(dev, &dev_config->mspi_nor_cfg); - } + const struct jesd216_erase_type *best_et = + find_best_erase_type(dev, addr, size); - if (rc < 0) { - return rc; - } + if (best_et != NULL) { + set_up_xfer_with_addr(dev, MSPI_TX, addr); + rc = perform_xfer(dev, best_et->cmd, false); - flash_mspi_command_set(dev, &dev_config->jedec_cmds->sector_erase); - dev_data->packet.address = addr; - addr += SPI_NOR_SECTOR_SIZE; - size -= SPI_NOR_SECTOR_SIZE; + addr += BIT(best_et->exp); + size -= BIT(best_et->exp); + } else { + LOG_ERR("Can't erase %zu at 0x%lx", + size, (long)addr); + rc = -EINVAL; + break; + } } - rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, - &dev_data->xfer); if (rc < 0) { LOG_ERR("Erase command 0x%02x xfer failed: %d", dev_data->packet.cmd, rc); @@ -405,28 +495,20 @@ struct flash_parameters *api_get_parameters(const struct device *dev) static int read_jedec_id(const struct device *dev, uint8_t *id) { - const struct flash_mspi_nor_config *dev_config = dev->config; struct flash_mspi_nor_data *dev_data = dev->data; int rc; - if (dev_config->jedec_cmds->id.force_single) { - rc = dev_cfg_apply(dev, &dev_config->mspi_nor_init_cfg); - } else { - rc = dev_cfg_apply(dev, &dev_config->mspi_nor_cfg); + set_up_xfer(dev, MSPI_RX); + if (dev_data->in_target_io_mode) { + dev_data->xfer.rx_dummy = dev_data->cmd_info.rdid_dummy; + dev_data->xfer.addr_length = dev_data->cmd_info.rdid_addr_4 + ? 4 : 0; } - - if (rc < 0) { - return rc; - } - - flash_mspi_command_set(dev, &dev_config->jedec_cmds->id); dev_data->packet.data_buf = id; dev_data->packet.num_bytes = JESD216_READ_ID_LEN; - - rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, - &dev_data->xfer); + rc = perform_xfer(dev, SPI_NOR_CMD_RDID, false); if (rc < 0) { - LOG_ERR("Read JEDEC ID failed: %d\n", rc); + LOG_ERR("Read JEDEC ID failed: %d", rc); } return rc; @@ -448,7 +530,6 @@ static void api_page_layout(const struct device *dev, static int api_sfdp_read(const struct device *dev, off_t addr, void *dest, size_t size) { - const struct flash_mspi_nor_config *dev_config = dev->config; struct flash_mspi_nor_data *dev_data = dev->data; int rc; @@ -461,25 +542,22 @@ static int api_sfdp_read(const struct device *dev, off_t addr, void *dest, return rc; } - if (dev_config->jedec_cmds->sfdp.force_single) { - rc = dev_cfg_apply(dev, &dev_config->mspi_nor_init_cfg); + set_up_xfer(dev, MSPI_RX); + if (dev_data->in_target_io_mode) { + dev_data->xfer.rx_dummy = dev_data->cmd_info.sfdp_dummy_20 + ? 20 : 8; + dev_data->xfer.addr_length = dev_data->cmd_info.sfdp_addr_4 + ? 4 : 3; } else { - rc = dev_cfg_apply(dev, &dev_config->mspi_nor_cfg); + dev_data->xfer.rx_dummy = 8; + dev_data->xfer.addr_length = 3; } - - if (rc < 0) { - return rc; - } - - flash_mspi_command_set(dev, &dev_config->jedec_cmds->sfdp); dev_data->packet.address = addr; dev_data->packet.data_buf = dest; dev_data->packet.num_bytes = size; - rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, - &dev_data->xfer); + rc = perform_xfer(dev, JESD216_CMD_READ_SFDP, false); if (rc < 0) { - printk("Read SFDP xfer failed: %d\n", rc); - return rc; + LOG_ERR("Read SFDP xfer failed: %d", rc); } release(dev); @@ -519,31 +597,19 @@ static int dev_pm_action_cb(const struct device *dev, static int quad_enable_set(const struct device *dev, bool enable) { - const struct flash_mspi_nor_config *dev_config = dev->config; struct flash_mspi_nor_data *dev_data = dev->data; int rc; - flash_mspi_command_set(dev, &commands_single.write_en); - rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, - &dev_data->xfer); + rc = cmd_wren(dev); if (rc < 0) { LOG_ERR("Failed to set write enable: %d", rc); return rc; } if (dev_data->switch_info.quad_enable_req == JESD216_DW15_QER_VAL_S1B6) { - const struct flash_mspi_nor_cmd cmd_status = { - .dir = MSPI_TX, - .cmd = SPI_NOR_CMD_WRSR, - .cmd_length = 1, - }; uint8_t mode_payload = enable ? BIT(6) : 0; - flash_mspi_command_set(dev, &cmd_status); - dev_data->packet.data_buf = &mode_payload; - dev_data->packet.num_bytes = sizeof(mode_payload); - rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, &dev_data->xfer); - + rc = cmd_wrsr(dev, SPI_NOR_CMD_WRSR, 1, &mode_payload); if (rc < 0) { LOG_ERR("Failed to enable/disable quad mode: %d", rc); return rc; @@ -563,8 +629,29 @@ static int quad_enable_set(const struct device *dev, bool enable) return 0; } +static int enter_4byte_addressing_mode(const struct device *dev) +{ + struct flash_mspi_nor_data *dev_data = dev->data; + int rc; + + if (dev_data->switch_info.enter_4byte_addr == ENTER_4BYTE_ADDR_06_B7) { + rc = cmd_wren(dev); + if (rc < 0) { + return rc; + } + } -static int default_io_mode(const struct device *dev) + set_up_xfer(dev, MSPI_TX); + rc = perform_xfer(dev, 0xB7, false); + if (rc < 0) { + LOG_ERR("Command 0xB7 failed: %d", rc); + return rc; + } + + return 0; +} + +static int switch_to_target_io_mode(const struct device *dev) { const struct flash_mspi_nor_config *dev_config = dev->config; struct flash_mspi_nor_data *dev_data = dev->data; @@ -587,16 +674,25 @@ static int default_io_mode(const struct device *dev) } } - if ((dev_config->quirks != NULL) && (dev_config->quirks->post_switch_mode != NULL)) { - rc = dev_config->quirks->post_switch_mode(dev); + if (dev_data->switch_info.enter_4byte_addr != ENTER_4BYTE_ADDR_NONE) { + rc = enter_4byte_addressing_mode(dev); + if (rc < 0) { + LOG_ERR("Failed to enter 4-byte addressing mode: %d", rc); + return rc; + } } - if (rc < 0) { - LOG_ERR("Failed to change IO mode: %d\n", rc); - return rc; + if (dev_config->quirks != NULL && + dev_config->quirks->post_switch_mode != NULL) { + rc = dev_config->quirks->post_switch_mode(dev); + if (rc < 0) { + return rc; + } } - return dev_cfg_apply(dev, &dev_config->mspi_nor_cfg); + return mspi_dev_config(dev_config->bus, &dev_config->mspi_id, + MSPI_DEVICE_CONFIG_ALL, + &dev_config->mspi_nor_cfg); } #if defined(WITH_RESET_GPIO) @@ -646,12 +742,15 @@ static int flash_chip_init(const struct device *dev) uint8_t id[JESD216_READ_ID_LEN] = {0}; int rc; - rc = dev_cfg_apply(dev, &dev_config->mspi_nor_init_cfg); - + rc = mspi_dev_config(dev_config->bus, &dev_config->mspi_id, + MSPI_DEVICE_CONFIG_ALL, + &dev_config->mspi_nor_init_cfg); if (rc < 0) { return rc; } + dev_data->in_target_io_mode = false; + /* Some chips reuse RESET pin for data in Quad modes: * force single line mode before resetting. */ @@ -683,35 +782,25 @@ static int flash_chip_init(const struct device *dev) } #endif - flash_mspi_command_set(dev, &commands_single.id); - dev_data->packet.data_buf = id; - dev_data->packet.num_bytes = sizeof(id); + if (dev_config->quirks != NULL && + dev_config->quirks->pre_init != NULL) { + rc = dev_config->quirks->pre_init(dev); + } - rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, - &dev_data->xfer); + rc = switch_to_target_io_mode(dev); if (rc < 0) { - LOG_ERR("Failed to read JEDEC ID in initial line mode: %d", rc); + LOG_ERR("Failed to switch to target io mode: %d", rc); return rc; } - rc = default_io_mode(dev); + dev_data->in_target_io_mode = true; + rc = read_jedec_id(dev, id); if (rc < 0) { - LOG_ERR("Failed to switch to default io mode: %d", rc); + LOG_ERR("Failed to read JEDEC ID: %d", rc); return rc; } - /* Reading JEDEC ID for mode that forces single lane would be redundant, - * since it switches back to single lane mode. Use ID from previous read. - */ - if (!dev_config->jedec_cmds->id.force_single) { - rc = read_jedec_id(dev, id); - if (rc < 0) { - LOG_ERR("Failed to read JEDEC ID in final line mode: %d", rc); - return rc; - } - } - if (memcmp(id, dev_config->jedec_id, sizeof(id)) != 0) { LOG_ERR("JEDEC ID mismatch, read: %02x %02x %02x, " "expected: %02x %02x %02x", @@ -771,6 +860,51 @@ static int drv_init(const struct device *dev) return rc; } + /* Allow users to specify commands for Read and Page Program operations + * through dts and override what was taken from SFDP. Also the number + * of dummy cycles for the Read operation can be overridden this way + * (see api_read() and dts_rx_dummy). + */ + if (dev_config->dts_read_command != 0) { + dev_data->cmd_info.read_cmd = dev_config->dts_read_command; + } + if (dev_config->dts_write_command != 0) { + dev_data->cmd_info.pp_cmd = dev_config->dts_write_command; + } + + if (dev_data->cmd_info.read_cmd == 0) { + LOG_ERR("Read command not defined for %s, " + "use \"read-command\" property to specify it.", + dev->name); + return -EINVAL; + } + + if (dev_data->cmd_info.pp_cmd == 0) { + LOG_ERR("Page Program command not defined for %s, " + "use \"write-command\" property to specify it.", + dev->name); + return -EINVAL; + } + + LOG_DBG("%s - size: %u, page %u%s", + dev->name, dev_flash_size(dev), dev_page_size(dev), + dev_data->cmd_info.uses_4byte_addr ? ", 4-byte addressing" : ""); + LOG_DBG("- read command: 0x%02X with %u mode and %u dummy cycles", + dev_data->cmd_info.read_cmd, + dev_data->cmd_info.read_mode_clocks, + dev_data->cmd_info.read_dummy_clocks); + LOG_DBG("- page program command: 0x%02X", + dev_data->cmd_info.pp_cmd); + LOG_DBG("- erase types:"); + for (int i = 0; i < JESD216_NUM_ERASE_TYPES; ++i) { + const struct jesd216_erase_type *et = &dev_erase_types(dev)[i]; + + if (et->exp != 0) { + LOG_DBG(" - command: 0x%02X, size: %lu", + et->cmd, BIT(et->exp)); + } + } + k_sem_init(&dev_data->acquired, 1, K_SEM_MAX_LIMIT); return pm_device_driver_init(dev, dev_pm_action_cb); @@ -812,40 +946,19 @@ static DEVICE_API(flash, drv_api) = { (FLASH_PAGE_EXP(inst) ? BIT(FLASH_PAGE_EXP(inst)) \ : SPI_NOR_PAGE_SIZE) -/* Define copies of mspi_io_mode enum values, so they can be used inside - * the COND_CODE_1 macros. - */ -#define _MSPI_IO_MODE_SINGLE 0 -#define _MSPI_IO_MODE_QUAD_1_4_4 6 -#define _MSPI_IO_MODE_OCTAL 7 -BUILD_ASSERT(_MSPI_IO_MODE_SINGLE == MSPI_IO_MODE_SINGLE, - "Please align _MSPI_IO_MODE_SINGLE macro value"); -BUILD_ASSERT(_MSPI_IO_MODE_QUAD_1_4_4 == MSPI_IO_MODE_QUAD_1_4_4, - "Please align _MSPI_IO_MODE_QUAD_1_4_4 macro value"); -BUILD_ASSERT(_MSPI_IO_MODE_OCTAL == MSPI_IO_MODE_OCTAL, - "Please align _MSPI_IO_MODE_OCTAL macro value"); - -/* Define a non-existing extern symbol to get an understandable compile-time error - * if the IO mode is not supported by the driver. - */ -extern const struct flash_mspi_nor_cmds mspi_io_mode_not_supported; - -#define FLASH_CMDS(inst) COND_CODE_1( \ - IS_EQ(DT_INST_ENUM_IDX(inst, mspi_io_mode), _MSPI_IO_MODE_SINGLE), \ - (&commands_single), \ - (COND_CODE_1( \ - IS_EQ(DT_INST_ENUM_IDX(inst, mspi_io_mode), _MSPI_IO_MODE_QUAD_1_4_4), \ - (&commands_quad_1_4_4), \ - (COND_CODE_1( \ - IS_EQ(DT_INST_ENUM_IDX(inst, mspi_io_mode), _MSPI_IO_MODE_OCTAL), \ - (&commands_octal), \ - (&mspi_io_mode_not_supported) \ - )) \ - )) \ -) - #define FLASH_QUIRKS(inst) FLASH_MSPI_QUIRKS_GET(DT_DRV_INST(inst)) +#define IO_MODE_FLAGS(io_mode) \ + .multi_io_cmd = (io_mode == MSPI_IO_MODE_DUAL || \ + io_mode == MSPI_IO_MODE_QUAD || \ + io_mode == MSPI_IO_MODE_OCTAL || \ + io_mode == MSPI_IO_MODE_HEX || \ + io_mode == MSPI_IO_MODE_HEX_8_8_16 || \ + io_mode == MSPI_IO_MODE_HEX_8_16_16), \ + .single_io_addr = (io_mode == MSPI_IO_MODE_DUAL_1_1_2 || \ + io_mode == MSPI_IO_MODE_QUAD_1_1_4 || \ + io_mode == MSPI_IO_MODE_OCTAL_1_1_8) + #if defined(CONFIG_FLASH_PAGE_LAYOUT) BUILD_ASSERT((CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE % 4096) == 0, "MSPI_NOR_FLASH_LAYOUT_PAGE_SIZE must be multiple of 4096"); @@ -871,14 +984,10 @@ BUILD_ASSERT((FLASH_SIZE(inst) % CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE) == 0, \ #endif #define FLASH_MSPI_NOR_INST(inst) \ - BUILD_ASSERT((DT_INST_ENUM_IDX(inst, mspi_io_mode) == \ - MSPI_IO_MODE_SINGLE) || \ - (DT_INST_ENUM_IDX(inst, mspi_io_mode) == \ - MSPI_IO_MODE_QUAD_1_4_4) || \ - (DT_INST_ENUM_IDX(inst, mspi_io_mode) == \ - MSPI_IO_MODE_OCTAL), \ - "Only 1x, 1-4-4 and 8x I/O modes are supported for now"); \ SFDP_BUILD_ASSERTS(inst); \ + BUILD_ASSERT(DT_INST_PROP_OR(inst, rx_dummy, 0) != INVALID_DTS_RX_DUMMY,\ + "Invalid number of RX dummy clocks specified for " \ + DT_NODE_FULL_NAME(DT_DRV_INST(inst))); \ PM_DEVICE_DT_INST_DEFINE(inst, dev_pm_action_cb); \ DEFAULT_ERASE_TYPES_DEFINE(inst); \ static struct flash_mspi_nor_data dev##inst##_data; \ @@ -889,10 +998,6 @@ BUILD_ASSERT((FLASH_SIZE(inst) % CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE) == 0, \ .mspi_id = MSPI_DEVICE_ID_DT_INST(inst), \ .mspi_nor_cfg = MSPI_DEVICE_CONFIG_DT_INST(inst), \ .mspi_nor_init_cfg = FLASH_INITIAL_CONFIG(inst), \ - .mspi_nor_cfg_mask = DT_PROP(DT_INST_BUS(inst), \ - software_multiperipheral) \ - ? MSPI_DEVICE_CONFIG_ALL \ - : MSPI_DEVICE_CONFIG_NONE, \ IF_ENABLED(CONFIG_MSPI_XIP, \ (.xip_cfg = MSPI_XIP_CONFIG_DT_INST(inst),)) \ IF_ENABLED(WITH_RESET_GPIO, \ @@ -904,11 +1009,17 @@ BUILD_ASSERT((FLASH_SIZE(inst) % CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE) == 0, \ .transfer_timeout = DT_INST_PROP(inst, transfer_timeout), \ FLASH_PAGE_LAYOUT_DEFINE(inst) \ .jedec_id = DT_INST_PROP(inst, jedec_id), \ - .jedec_cmds = FLASH_CMDS(inst), \ .quirks = FLASH_QUIRKS(inst), \ .default_erase_types = DEFAULT_ERASE_TYPES(inst), \ .default_cmd_info = DEFAULT_CMD_INFO(inst), \ .default_switch_info = DEFAULT_SWITCH_INFO(inst), \ + .dts_read_command = DT_INST_PROP_OR(inst, read_command, 0), \ + .dts_write_command = DT_INST_PROP_OR(inst, write_command, 0), \ + .dts_rx_dummy = DT_INST_PROP_OR(inst, rx_dummy, \ + INVALID_DTS_RX_DUMMY), \ + .multiperipheral_bus = DT_PROP(DT_INST_BUS(inst), \ + software_multiperipheral), \ + IO_MODE_FLAGS(DT_INST_ENUM_IDX(inst, mspi_io_mode)), \ }; \ FLASH_PAGE_LAYOUT_CHECK(inst) \ DEVICE_DT_INST_DEFINE(inst, \ diff --git a/drivers/flash/flash_mspi_nor.h b/drivers/flash/flash_mspi_nor.h index a68162f148a1..f9da334b4d73 100644 --- a/drivers/flash/flash_mspi_nor.h +++ b/drivers/flash/flash_mspi_nor.h @@ -66,7 +66,6 @@ struct flash_mspi_nor_config { struct mspi_dev_id mspi_id; struct mspi_dev_cfg mspi_nor_cfg; struct mspi_dev_cfg mspi_nor_init_cfg; - enum mspi_dev_cfg_mask mspi_nor_cfg_mask; #if defined(CONFIG_MSPI_XIP) struct mspi_xip_cfg xip_cfg; #endif @@ -80,213 +79,28 @@ struct flash_mspi_nor_config { struct flash_pages_layout layout; #endif uint8_t jedec_id[SPI_NOR_MAX_ID_LEN]; - const struct flash_mspi_nor_cmds *jedec_cmds; struct flash_mspi_nor_quirks *quirks; const struct jesd216_erase_type *default_erase_types; struct flash_mspi_nor_cmd_info default_cmd_info; struct flash_mspi_nor_switch_info default_switch_info; + uint8_t dts_read_command; + uint8_t dts_rx_dummy; + uint8_t dts_write_command; + bool multiperipheral_bus : 1; + bool multi_io_cmd : 1; + bool single_io_addr : 1; }; struct flash_mspi_nor_data { struct k_sem acquired; struct mspi_xfer_packet packet; struct mspi_xfer xfer; - struct mspi_dev_cfg *curr_cfg; struct jesd216_erase_type erase_types[JESD216_NUM_ERASE_TYPES]; struct flash_mspi_nor_cmd_info cmd_info; struct flash_mspi_nor_switch_info switch_info; + bool in_target_io_mode; }; -struct flash_mspi_nor_cmd { - enum mspi_xfer_direction dir; - uint32_t cmd; - uint16_t tx_dummy; - uint16_t rx_dummy; - uint8_t cmd_length; - uint8_t addr_length; - bool force_single; -}; - -struct flash_mspi_nor_cmds { - struct flash_mspi_nor_cmd id; - struct flash_mspi_nor_cmd write_en; - struct flash_mspi_nor_cmd read; - struct flash_mspi_nor_cmd status; - struct flash_mspi_nor_cmd config; - struct flash_mspi_nor_cmd page_program; - struct flash_mspi_nor_cmd sector_erase; - struct flash_mspi_nor_cmd chip_erase; - struct flash_mspi_nor_cmd sfdp; -}; - -const struct flash_mspi_nor_cmds commands_single = { - .id = { - .dir = MSPI_RX, - .cmd = JESD216_CMD_READ_ID, - .cmd_length = 1, - }, - .write_en = { - .dir = MSPI_TX, - .cmd = SPI_NOR_CMD_WREN, - .cmd_length = 1, - }, - .read = { - .dir = MSPI_RX, - .cmd = SPI_NOR_CMD_READ_FAST, - .cmd_length = 1, - .addr_length = 3, - .rx_dummy = 8, - }, - .status = { - .dir = MSPI_RX, - .cmd = SPI_NOR_CMD_RDSR, - .cmd_length = 1, - }, - .config = { - .dir = MSPI_RX, - .cmd = SPI_NOR_CMD_RDCR, - .cmd_length = 1, - }, - .page_program = { - .dir = MSPI_TX, - .cmd = SPI_NOR_CMD_PP, - .cmd_length = 1, - .addr_length = 3, - }, - .sector_erase = { - .dir = MSPI_TX, - .cmd = SPI_NOR_CMD_SE, - .cmd_length = 1, - .addr_length = 3, - }, - .chip_erase = { - .dir = MSPI_TX, - .cmd = SPI_NOR_CMD_CE, - .cmd_length = 1, - }, - .sfdp = { - .dir = MSPI_RX, - .cmd = JESD216_CMD_READ_SFDP, - .cmd_length = 1, - .addr_length = 3, - .rx_dummy = 8, - }, -}; - -const struct flash_mspi_nor_cmds commands_quad_1_4_4 = { - .id = { - .dir = MSPI_RX, - .cmd = JESD216_CMD_READ_ID, - .cmd_length = 1, - .force_single = true, - }, - .write_en = { - .dir = MSPI_TX, - .cmd = SPI_NOR_CMD_WREN, - .cmd_length = 1, - }, - .read = { - .dir = MSPI_RX, - .cmd = SPI_NOR_CMD_4READ, - .cmd_length = 1, - .addr_length = 3, - .rx_dummy = 6, - }, - .status = { - .dir = MSPI_RX, - .cmd = SPI_NOR_CMD_RDSR, - .cmd_length = 1, - .force_single = true, - }, - .config = { - .dir = MSPI_RX, - .cmd = SPI_NOR_CMD_RDCR, - .cmd_length = 1, - .force_single = true, - }, - .page_program = { - .dir = MSPI_TX, - .cmd = SPI_NOR_CMD_PP_1_4_4, - .cmd_length = 1, - .addr_length = 3, - }, - .sector_erase = { - .dir = MSPI_TX, - .cmd = SPI_NOR_CMD_SE, - .cmd_length = 1, - .addr_length = 3, - .force_single = true, - }, - .chip_erase = { - .dir = MSPI_TX, - .cmd = SPI_NOR_CMD_CE, - .cmd_length = 1, - }, - .sfdp = { - .dir = MSPI_RX, - .cmd = JESD216_CMD_READ_SFDP, - .cmd_length = 1, - .addr_length = 3, - .rx_dummy = 8, - .force_single = true, - }, -}; - -const struct flash_mspi_nor_cmds commands_octal = { - .id = { - .dir = MSPI_RX, - .cmd = JESD216_OCMD_READ_ID, - .cmd_length = 2, - .addr_length = 4, - .rx_dummy = 4 - }, - .write_en = { - .dir = MSPI_TX, - .cmd = SPI_NOR_OCMD_WREN, - .cmd_length = 2, - }, - .read = { - .dir = MSPI_RX, - .cmd = SPI_NOR_OCMD_RD, - .cmd_length = 2, - .addr_length = 4, - .rx_dummy = 20, - }, - .status = { - .dir = MSPI_RX, - .cmd = SPI_NOR_OCMD_RDSR, - .cmd_length = 2, - .addr_length = 4, - .rx_dummy = 4, - }, - .page_program = { - .dir = MSPI_TX, - .cmd = SPI_NOR_OCMD_PAGE_PRG, - .cmd_length = 2, - .addr_length = 4, - }, - .sector_erase = { - .dir = MSPI_TX, - .cmd = SPI_NOR_OCMD_SE, - .cmd_length = 2, - .addr_length = 4, - }, - .chip_erase = { - .dir = MSPI_TX, - .cmd = SPI_NOR_OCMD_CE, - .cmd_length = 2, - }, - .sfdp = { - .dir = MSPI_RX, - .cmd = JESD216_OCMD_READ_SFDP, - .cmd_length = 2, - .addr_length = 4, - .rx_dummy = 20, - }, -}; - -void flash_mspi_command_set(const struct device *dev, const struct flash_mspi_nor_cmd *cmd); - #ifdef __cplusplus } #endif diff --git a/drivers/flash/flash_mspi_nor_quirks.h b/drivers/flash/flash_mspi_nor_quirks.h index eb40ad1938aa..2231d776fc04 100644 --- a/drivers/flash/flash_mspi_nor_quirks.h +++ b/drivers/flash/flash_mspi_nor_quirks.h @@ -9,6 +9,13 @@ /* Flash chip specific quirks */ struct flash_mspi_nor_quirks { + /* Called at the beginning of the flash chip initialization, + * right after reset if any is performed. Can be used to alter + * structures that define communication with the chip, like + * `cmd_info`, `switch_info`, and `erase_types`, which are set + * to default values at this point. + */ + int (*pre_init)(const struct device *dev); /* Called after switching to default IO mode. */ int (*post_switch_mode)(const struct device *dev); }; @@ -64,45 +71,29 @@ static inline int mxicy_mx25r_post_switch_mode(const struct device *dev) } /* Wait for previous write to finish */ - do { - flash_mspi_command_set(dev, &dev_config->jedec_cmds->status); - dev_data->packet.data_buf = &status; - dev_data->packet.num_bytes = sizeof(status); - rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, &dev_data->xfer); - if (rc < 0) { - return rc; - } - } while (status & SPI_NOR_WIP_BIT); + rc = wait_until_ready(dev, K_USEC(1)); + if (rc < 0) { + return rc; + } /* Write enable */ - flash_mspi_command_set(dev, &commands_single.write_en); - rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, - &dev_data->xfer); + rc = cmd_wren(dev); if (rc < 0) { return rc; } /* Write status and config registers */ - const struct flash_mspi_nor_cmd cmd_status = { - .dir = MSPI_TX, - .cmd = SPI_NOR_CMD_WRSR, - .cmd_length = 1, - }; - - flash_mspi_command_set(dev, &cmd_status); + set_up_xfer(dev, MSPI_TX); dev_data->packet.data_buf = mxicy_mx25r_hp_payload; dev_data->packet.num_bytes = sizeof(mxicy_mx25r_hp_payload); - rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, &dev_data->xfer); + rc = perform_xfer(dev, SPI_NOR_CMD_WRSR, false); if (rc < 0) { return rc; } /* Wait for write to end and verify status register */ do { - flash_mspi_command_set(dev, &dev_config->jedec_cmds->status); - dev_data->packet.data_buf = &status; - dev_data->packet.num_bytes = sizeof(status); - rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, &dev_data->xfer); + rc = cmd_rdsr(dev, SPI_NOR_CMD_RDSR, &status); if (rc < 0) { return rc; } @@ -113,10 +104,10 @@ static inline int mxicy_mx25r_post_switch_mode(const struct device *dev) } /* Verify configuration registers */ - flash_mspi_command_set(dev, &dev_config->jedec_cmds->config); - dev_data->packet.data_buf = config; + set_up_xfer(dev, MSPI_RX); dev_data->packet.num_bytes = sizeof(config); - rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, &dev_data->xfer); + dev_data->packet.data_buf = config; + rc = perform_xfer(dev, SPI_NOR_CMD_RDCR, false); if (rc < 0) { return rc; } @@ -154,29 +145,35 @@ static inline int mxicy_mx25u_post_switch_mode(const struct device *dev) } /* Write enable */ - flash_mspi_command_set(dev, &commands_single.write_en); - rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, - &dev_data->xfer); + rc = cmd_wren(dev); if (rc < 0) { return rc; } /* Write config register 2 */ - const struct flash_mspi_nor_cmd cmd_status = { - .dir = MSPI_TX, - .cmd = SPI_NOR_CMD_WR_CFGREG2, - .cmd_length = 1, - .addr_length = 4, - }; - - flash_mspi_command_set(dev, &cmd_status); + set_up_xfer(dev, MSPI_TX); + dev_data->xfer.addr_length = 4; + dev_data->packet.address = 0; dev_data->packet.data_buf = &mxicy_mx25u_oe_payload; dev_data->packet.num_bytes = sizeof(mxicy_mx25u_oe_payload); - rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, &dev_data->xfer); - return rc; + return perform_xfer(dev, SPI_NOR_CMD_WR_CFGREG2, false); +} + +static int mxicy_mx25u_pre_init(const struct device *dev) +{ + const struct flash_mspi_nor_config *dev_config = dev->config; + struct flash_mspi_nor_data *dev_data = dev->data; + + if (dev_config->mspi_nor_cfg.io_mode == MSPI_IO_MODE_OCTAL && + dev_config->mspi_nor_cfg.data_rate == MSPI_DATA_RATE_SINGLE) { + dev_data->cmd_info.cmd_extension = CMD_EXTENSION_INVERSE; + } + + return 0; } struct flash_mspi_nor_quirks flash_quirks_mxicy_mx25u = { + .pre_init = mxicy_mx25u_pre_init, .post_switch_mode = mxicy_mx25u_post_switch_mode, }; diff --git a/drivers/flash/flash_mspi_nor_sfdp.h b/drivers/flash/flash_mspi_nor_sfdp.h index 71139623fff8..1a15515c5651 100644 --- a/drivers/flash/flash_mspi_nor_sfdp.h +++ b/drivers/flash/flash_mspi_nor_sfdp.h @@ -119,6 +119,7 @@ #define USES_4BYTE_ADDR(inst) \ (USES_OCTAL_IO(inst) || \ + DT_INST_PROP(inst, use_4byte_addressing) || \ BFP_DW1_ADDRESS_BYTES(inst) == JESD216_SFDP_BFP_DW1_ADDRBYTES_VAL_4B) #define CMD_EXTENSION(inst) \ @@ -328,4 +329,17 @@ BUILD_ASSERT(!USES_8D_8D_8D(inst) || \ BFP_DW18_CMD_EXT(inst) <= BFP_DW18_CMD_EXT_INV, \ "Unsupported Octal Command Extension mode in " \ + DT_NODE_FULL_NAME(DT_DRV_INST(inst))); \ + BUILD_ASSERT(!DT_INST_PROP(inst, use_4byte_addressing) || \ + (BFP_DW1_ADDRESS_BYTES(inst) \ + != JESD216_SFDP_BFP_DW1_ADDRBYTES_VAL_3B), \ + "Cannot use 4-byte addressing for " \ + DT_NODE_FULL_NAME(DT_DRV_INST(inst))); \ + BUILD_ASSERT(!DT_INST_PROP(inst, use_4byte_addressing) || \ + (BFP_ENTER_4BYTE_ADDR_METHODS(inst) \ + & (BFP_DW16_4B_ADDR_ENTER_B7 | \ + BFP_DW16_4B_ADDR_ENTER_06_B7 | \ + BFP_DW16_4B_ADDR_PER_CMD | \ + BFP_DW16_4B_ADDR_ALWAYS)), \ + "No supported method of entering 4-byte addressing mode for " \ DT_NODE_FULL_NAME(DT_DRV_INST(inst))) diff --git a/dts/bindings/mtd/jedec,mspi-nor.yaml b/dts/bindings/mtd/jedec,mspi-nor.yaml index 09660b841591..e21057cc803a 100644 --- a/dts/bindings/mtd/jedec,mspi-nor.yaml +++ b/dts/bindings/mtd/jedec,mspi-nor.yaml @@ -30,3 +30,11 @@ properties: Maximum time, in milliseconds, allowed for a single transfer on the MSPI bus in communication with the flash chip. The default value is the one that was previously hard-coded in the flash_mspi_nor driver. + + use-4byte-addressing: + type: boolean + description: | + Indicates that 4-byte addressing is to be used in communication with + the flash chip. The driver will use dedicated instruction codes for + commands that require addresses (like Read, Page Program, or Erase) + and will switch the flash chip to 4-byte addressing mode if necessary. From a4d3616629ae26dabdb09edf75c4a6c596a6b6ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Fri, 11 Jul 2025 15:24:07 +0200 Subject: [PATCH 0451/2141] [nrf fromlist] drivers: flash_mspi_nor: Complete handling of QER, add handling of OER MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Complete implementation of quad_enable_set() by adding support for all possible Quad Enable Requirements (QER) as specified by the SFDP JEDEC standard (JESD216). Add also corresponding octal_enable_set() to handle Octal Enable Requirements. Also remove initial waiting from mxicy_mx25r_post_switch_mode() which became unneeded, as now such waiting is done in cmd_wrsr() which is called at the end of quad_enable_set(). Upstream PR #: 93093 Signed-off-by: Andrzej Głąbek (cherry picked from commit 5a16efa78c1749de902ae6d275728bd3447fd807) --- drivers/flash/flash_mspi_nor.c | 153 ++++++++++++++++++++++---- drivers/flash/flash_mspi_nor_quirks.h | 6 - 2 files changed, 134 insertions(+), 25 deletions(-) diff --git a/drivers/flash/flash_mspi_nor.c b/drivers/flash/flash_mspi_nor.c index cb74abccef70..8cc2c580ab0e 100644 --- a/drivers/flash/flash_mspi_nor.c +++ b/drivers/flash/flash_mspi_nor.c @@ -598,31 +598,138 @@ static int dev_pm_action_cb(const struct device *dev, static int quad_enable_set(const struct device *dev, bool enable) { struct flash_mspi_nor_data *dev_data = dev->data; + uint8_t op_code; + uint8_t qe_bit; + uint8_t status_reg; + uint8_t payload_len; + uint8_t payload[2]; int rc; - rc = cmd_wren(dev); + switch (dev_data->switch_info.quad_enable_req) { + case JESD216_DW15_QER_VAL_S1B6: + op_code = SPI_NOR_CMD_RDSR; + qe_bit = BIT(6); + break; + case JESD216_DW15_QER_VAL_S2B7: + /* Use special Read status register 2 instruction. */ + op_code = 0x3F; + qe_bit = BIT(7); + break; + case JESD216_DW15_QER_VAL_S2B1v1: + case JESD216_DW15_QER_VAL_S2B1v4: + case JESD216_DW15_QER_VAL_S2B1v5: + case JESD216_DW15_QER_VAL_S2B1v6: + op_code = SPI_NOR_CMD_RDSR2; + qe_bit = BIT(1); + break; + default: + LOG_ERR("Unknown Quad Enable Requirement: %u", + dev_data->switch_info.quad_enable_req); + return -ENOTSUP; + } + + rc = cmd_rdsr(dev, op_code, &status_reg); if (rc < 0) { - LOG_ERR("Failed to set write enable: %d", rc); return rc; } - if (dev_data->switch_info.quad_enable_req == JESD216_DW15_QER_VAL_S1B6) { - uint8_t mode_payload = enable ? BIT(6) : 0; + if (((status_reg & qe_bit) != 0) == enable) { + /* Nothing to do, the QE bit is already set properly. */ + return 0; + } + + status_reg ^= qe_bit; + + switch (dev_data->switch_info.quad_enable_req) { + default: + case JESD216_DW15_QER_VAL_S1B6: + payload_len = 1; + op_code = SPI_NOR_CMD_WRSR; + break; + case JESD216_DW15_QER_VAL_S2B7: + payload_len = 1; + /* Use special Write status register 2 instruction. */ + op_code = 0x3E; + break; + case JESD216_DW15_QER_VAL_S2B1v1: + case JESD216_DW15_QER_VAL_S2B1v4: + case JESD216_DW15_QER_VAL_S2B1v5: + payload_len = 2; + op_code = SPI_NOR_CMD_WRSR; + break; + case JESD216_DW15_QER_VAL_S2B1v6: + payload_len = 1; + op_code = SPI_NOR_CMD_WRSR2; + break; + } + + if (payload_len == 1) { + payload[0] = status_reg; + } else { + payload[1] = status_reg; - rc = cmd_wrsr(dev, SPI_NOR_CMD_WRSR, 1, &mode_payload); + /* When the Write Status command is to be sent with two data + * bytes (this is the case for S2B1v1, S2B1v4, and S2B1v5 QER + * values), the first status register needs to be read and + * sent as the first byte, so that its value is not modified. + */ + rc = cmd_rdsr(dev, SPI_NOR_CMD_RDSR, &payload[0]); if (rc < 0) { - LOG_ERR("Failed to enable/disable quad mode: %d", rc); return rc; } - } else { - /* TODO: handle all DW15 QER values */ + } + + rc = cmd_wrsr(dev, op_code, payload_len, payload); + if (rc < 0) { + return rc; + } + + return 0; +} + +static int octal_enable_set(const struct device *dev, bool enable) +{ + struct flash_mspi_nor_data *dev_data = dev->data; + uint8_t op_code; + uint8_t oe_bit; + uint8_t status_reg; + int rc; + + if (dev_data->switch_info.octal_enable_req != BFP_DW19_OER_VAL_S2B3) { + LOG_ERR("Unknown Octal Enable Requirement: %u", + dev_data->switch_info.octal_enable_req); return -ENOTSUP; } - rc = wait_until_ready(dev, K_USEC(1)); + oe_bit = BIT(3); + /* Use special Read status register 2 instruction 0x65 with one address + * byte 0x02 and one dummy byte. + */ + op_code = 0x65; + set_up_xfer(dev, MSPI_RX); + dev_data->xfer.rx_dummy = 8; + dev_data->xfer.addr_length = 1; + dev_data->packet.address = 0x02; + dev_data->packet.num_bytes = sizeof(uint8_t); + dev_data->packet.data_buf = &status_reg; + rc = perform_xfer(dev, op_code, false); + if (rc < 0) { + LOG_ERR("cmd_rdsr 0x%02x failed: %d", op_code, rc); + return rc; + } + + if (((status_reg & oe_bit) != 0) == enable) { + /* Nothing to do, the OE bit is already set properly. */ + return 0; + } + + status_reg ^= oe_bit; + + /* Use special Write status register 2 instruction to clear the bit. */ + op_code = (status_reg & oe_bit) ? SPI_NOR_CMD_WRSR2 : 0x3E; + rc = cmd_wrsr(dev, op_code, 1, &status_reg); if (rc < 0) { - LOG_ERR("Failed waiting until device ready after enabling quad: %d", rc); return rc; } @@ -659,18 +766,26 @@ static int switch_to_target_io_mode(const struct device *dev) int rc = 0; if (dev_data->switch_info.quad_enable_req != JESD216_DW15_QER_VAL_NONE) { - /* For Quad 1-1-4 and 1-4-4, entering or leaving mode is defined - * in JEDEC216 BFP DW15 QER - */ - if (io_mode == MSPI_IO_MODE_SINGLE) { - rc = quad_enable_set(dev, false); - } else if (io_mode == MSPI_IO_MODE_QUAD_1_1_4 || - io_mode == MSPI_IO_MODE_QUAD_1_4_4) { - rc = quad_enable_set(dev, true); - } + bool quad_needed = io_mode == MSPI_IO_MODE_QUAD_1_1_4 || + io_mode == MSPI_IO_MODE_QUAD_1_4_4 || + io_mode == MSPI_IO_MODE_QUAD; + rc = quad_enable_set(dev, quad_needed); if (rc < 0) { LOG_ERR("Failed to modify Quad Enable bit: %d", rc); + return rc; + } + } + + if (dev_data->switch_info.octal_enable_req != BFP_DW19_OER_VAL_NONE) { + bool octal_needed = io_mode == MSPI_IO_MODE_OCTAL_1_1_8 || + io_mode == MSPI_IO_MODE_OCTAL_1_8_8 || + io_mode == MSPI_IO_MODE_OCTAL; + + rc = octal_enable_set(dev, octal_needed); + if (rc < 0) { + LOG_ERR("Failed to modify Octal Enable bit: %d", rc); + return rc; } } diff --git a/drivers/flash/flash_mspi_nor_quirks.h b/drivers/flash/flash_mspi_nor_quirks.h index 2231d776fc04..7e2a75fa70ca 100644 --- a/drivers/flash/flash_mspi_nor_quirks.h +++ b/drivers/flash/flash_mspi_nor_quirks.h @@ -70,12 +70,6 @@ static inline int mxicy_mx25r_post_switch_mode(const struct device *dev) return 0; } - /* Wait for previous write to finish */ - rc = wait_until_ready(dev, K_USEC(1)); - if (rc < 0) { - return rc; - } - /* Write enable */ rc = cmd_wren(dev); if (rc < 0) { From 6d48f83dce85115bf933d6dd45e8c543f459a08c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Fri, 11 Jul 2025 16:54:05 +0200 Subject: [PATCH 0452/2141] [nrf fromlist] drivers: flash_mspi_nor: Add Soft Reset MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add implementation of the most common Soft Reset routine (sequence of reset enable instruction 0x66 and reset instruction 0x99). Upstream PR #: 93093 Signed-off-by: Andrzej Głąbek (cherry picked from commit 08c5be29ebf2e75f177c4df7e18c560e30986bad) --- drivers/flash/flash_mspi_nor.c | 87 +++++++++++++++++++++++++++- drivers/flash/flash_mspi_nor.h | 6 +- drivers/flash/flash_mspi_nor_sfdp.h | 7 +++ dts/bindings/mtd/jedec,mspi-nor.yaml | 6 ++ 4 files changed, 102 insertions(+), 4 deletions(-) diff --git a/drivers/flash/flash_mspi_nor.c b/drivers/flash/flash_mspi_nor.c index 8cc2c580ab0e..7663e1cc12a9 100644 --- a/drivers/flash/flash_mspi_nor.c +++ b/drivers/flash/flash_mspi_nor.c @@ -849,6 +849,77 @@ static int gpio_reset(const struct device *dev) } #endif +#if defined(WITH_SOFT_RESET) +static int soft_reset_66_99(const struct device *dev) +{ + int rc; + + set_up_xfer(dev, MSPI_TX); + rc = perform_xfer(dev, SPI_NOR_CMD_RESET_EN, false); + if (rc < 0) { + LOG_ERR("CMD_RESET_EN failed: %d", rc); + return rc; + } + + set_up_xfer(dev, MSPI_TX); + rc = perform_xfer(dev, SPI_NOR_CMD_RESET_MEM, false); + if (rc < 0) { + LOG_ERR("CMD_RESET_MEM failed: %d", rc); + return rc; + } + + return 0; +} + +static int soft_reset(const struct device *dev) +{ + const struct flash_mspi_nor_config *dev_config = dev->config; + struct flash_mspi_nor_data *dev_data = dev->data; + int rc; + + /* If the flash may expect commands sent in multi-line mode, + * send additionally the reset sequence this way. + */ + if (dev_config->multi_io_cmd) { + rc = mspi_dev_config(dev_config->bus, &dev_config->mspi_id, + MSPI_DEVICE_CONFIG_IO_MODE, + &dev_config->mspi_nor_cfg); + if (rc < 0) { + LOG_ERR("%s: dev_config() failed: %d", __func__, rc); + return rc; + } + + dev_data->in_target_io_mode = true; + + rc = soft_reset_66_99(dev); + if (rc < 0) { + return rc; + } + + rc = mspi_dev_config(dev_config->bus, &dev_config->mspi_id, + MSPI_DEVICE_CONFIG_IO_MODE, + &dev_config->mspi_nor_init_cfg); + if (rc < 0) { + LOG_ERR("%s: dev_config() failed: %d", __func__, rc); + return rc; + } + + dev_data->in_target_io_mode = false; + } + + rc = soft_reset_66_99(dev); + if (rc < 0) { + return rc; + } + + if (dev_config->reset_recovery_us != 0) { + k_busy_wait(dev_config->reset_recovery_us); + } + + return 0; +} +#endif /* WITH_SOFT_RESET */ + static int flash_chip_init(const struct device *dev) { const struct flash_mspi_nor_config *dev_config = dev->config; @@ -897,6 +968,15 @@ static int flash_chip_init(const struct device *dev) } #endif +#if defined(WITH_SOFT_RESET) + if (dev_config->initial_soft_reset) { + rc = soft_reset(dev); + if (rc < 0) { + return rc; + } + } +#endif + if (dev_config->quirks != NULL && dev_config->quirks->pre_init != NULL) { rc = dev_config->quirks->pre_init(dev); @@ -1117,10 +1197,10 @@ BUILD_ASSERT((FLASH_SIZE(inst) % CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE) == 0, \ (.xip_cfg = MSPI_XIP_CONFIG_DT_INST(inst),)) \ IF_ENABLED(WITH_RESET_GPIO, \ (.reset = GPIO_DT_SPEC_INST_GET_OR(inst, reset_gpios, {0}), \ - .reset_pulse_us = DT_INST_PROP_OR(inst, t_reset_pulse, 0) \ - / 1000, \ + .reset_pulse_us = DT_INST_PROP_OR(inst, t_reset_pulse, 0) \ + / 1000,)) \ .reset_recovery_us = DT_INST_PROP_OR(inst, t_reset_recovery, 0) \ - / 1000,)) \ + / 1000, \ .transfer_timeout = DT_INST_PROP(inst, transfer_timeout), \ FLASH_PAGE_LAYOUT_DEFINE(inst) \ .jedec_id = DT_INST_PROP(inst, jedec_id), \ @@ -1135,6 +1215,7 @@ BUILD_ASSERT((FLASH_SIZE(inst) % CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE) == 0, \ .multiperipheral_bus = DT_PROP(DT_INST_BUS(inst), \ software_multiperipheral), \ IO_MODE_FLAGS(DT_INST_ENUM_IDX(inst, mspi_io_mode)), \ + .initial_soft_reset = DT_INST_PROP(inst, initial_soft_reset), \ }; \ FLASH_PAGE_LAYOUT_CHECK(inst) \ DEVICE_DT_INST_DEFINE(inst, \ diff --git a/drivers/flash/flash_mspi_nor.h b/drivers/flash/flash_mspi_nor.h index f9da334b4d73..ac362f48c25c 100644 --- a/drivers/flash/flash_mspi_nor.h +++ b/drivers/flash/flash_mspi_nor.h @@ -19,6 +19,9 @@ extern "C" { #if DT_ANY_INST_HAS_PROP_STATUS_OKAY(reset_gpios) #define WITH_RESET_GPIO 1 #endif +#if DT_ANY_INST_HAS_BOOL_STATUS_OKAY(initial_soft_reset) +#define WITH_SOFT_RESET 1 +#endif #define CMD_EXTENSION_NONE 0 #define CMD_EXTENSION_SAME 1 @@ -72,8 +75,8 @@ struct flash_mspi_nor_config { #if defined(WITH_RESET_GPIO) struct gpio_dt_spec reset; uint32_t reset_pulse_us; - uint32_t reset_recovery_us; #endif + uint32_t reset_recovery_us; uint32_t transfer_timeout; #if defined(CONFIG_FLASH_PAGE_LAYOUT) struct flash_pages_layout layout; @@ -89,6 +92,7 @@ struct flash_mspi_nor_config { bool multiperipheral_bus : 1; bool multi_io_cmd : 1; bool single_io_addr : 1; + bool initial_soft_reset : 1; }; struct flash_mspi_nor_data { diff --git a/drivers/flash/flash_mspi_nor_sfdp.h b/drivers/flash/flash_mspi_nor_sfdp.h index 1a15515c5651..b2a8ba80bec1 100644 --- a/drivers/flash/flash_mspi_nor_sfdp.h +++ b/drivers/flash/flash_mspi_nor_sfdp.h @@ -4,6 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ +#define BFP_DW16_SOFT_RESET_66_99 BIT(4) + #define BFP_DW16_4B_ADDR_ENTER_B7 BIT(0) #define BFP_DW16_4B_ADDR_ENTER_06_B7 BIT(1) #define BFP_DW16_4B_ADDR_PER_CMD BIT(5) @@ -342,4 +344,9 @@ BFP_DW16_4B_ADDR_PER_CMD | \ BFP_DW16_4B_ADDR_ALWAYS)), \ "No supported method of entering 4-byte addressing mode for " \ + DT_NODE_FULL_NAME(DT_DRV_INST(inst))); \ + BUILD_ASSERT(!DT_INST_PROP(inst, initial_soft_reset) || \ + (SFDP_FIELD(inst, sfdp_bfp, 16, GENMASK(13, 8)) \ + & BFP_DW16_SOFT_RESET_66_99), \ + "Cannot use 66h/99h soft reset sequence for " \ DT_NODE_FULL_NAME(DT_DRV_INST(inst))) diff --git a/dts/bindings/mtd/jedec,mspi-nor.yaml b/dts/bindings/mtd/jedec,mspi-nor.yaml index e21057cc803a..5343fde5f7da 100644 --- a/dts/bindings/mtd/jedec,mspi-nor.yaml +++ b/dts/bindings/mtd/jedec,mspi-nor.yaml @@ -38,3 +38,9 @@ properties: the flash chip. The driver will use dedicated instruction codes for commands that require addresses (like Read, Page Program, or Erase) and will switch the flash chip to 4-byte addressing mode if necessary. + + initial-soft-reset: + type: boolean + description: | + When set, the flash driver performs software reset of the flash chip + at initialization. From 7cee84cdeabe56e316d5313fbf714acdeadbb603 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Mon, 14 Jul 2025 11:51:50 +0200 Subject: [PATCH 0453/2141] [nrf fromlist] drivers: flash_mspi_nor: Remove undesirable initial Quad disabling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Using a GPIO reset for a flash chip that has a dual function pin (RESET# or SIO3) and is to be used in Quad mode is rather a bad idea and so is clearing of the Quad Enable bit at every initialization of the flash driver, since this bit is usually non-volatile, so such operation means unnecessary wearing of the flash chip. Soft Reset should be use instead in such case. Upstream PR #: 93093 Signed-off-by: Andrzej Głąbek (cherry picked from commit 5c268bca7d080c0809beffc3212be8d7a2258c75) --- drivers/flash/flash_mspi_nor.c | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/drivers/flash/flash_mspi_nor.c b/drivers/flash/flash_mspi_nor.c index 7663e1cc12a9..4416ddc91a53 100644 --- a/drivers/flash/flash_mspi_nor.c +++ b/drivers/flash/flash_mspi_nor.c @@ -924,7 +924,6 @@ static int flash_chip_init(const struct device *dev) { const struct flash_mspi_nor_config *dev_config = dev->config; struct flash_mspi_nor_data *dev_data = dev->data; - enum mspi_io_mode io_mode = dev_config->mspi_nor_cfg.io_mode; uint8_t id[JESD216_READ_ID_LEN] = {0}; int rc; @@ -937,28 +936,6 @@ static int flash_chip_init(const struct device *dev) dev_data->in_target_io_mode = false; - /* Some chips reuse RESET pin for data in Quad modes: - * force single line mode before resetting. - */ - if (dev_data->switch_info.quad_enable_req != JESD216_DW15_QER_VAL_NONE && - (io_mode == MSPI_IO_MODE_SINGLE || - io_mode == MSPI_IO_MODE_QUAD_1_1_4 || - io_mode == MSPI_IO_MODE_QUAD_1_4_4)) { - rc = quad_enable_set(dev, false); - - if (rc < 0) { - LOG_ERR("Failed to switch to single line mode: %d", rc); - return rc; - } - - rc = wait_until_ready(dev, K_USEC(1)); - - if (rc < 0) { - LOG_ERR("Failed waiting for device after switch to single line: %d", rc); - return rc; - } - } - #if defined(WITH_RESET_GPIO) rc = gpio_reset(dev); From fce86d05bccdba2ac2e1b50808407e2d48c87bd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Fri, 25 Jul 2025 17:56:18 +0200 Subject: [PATCH 0454/2141] [nrf fromlist] drivers: flash_mspi_nor: Add support for "supply-gpios" property MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add support for supplying power to the flash chip by activation of a GPIO specified through the "supply-gpios" property. Implementation of gpio_reset() is also slightly modified so that it is consistent with soft_reset() and the new power_supply() and so that all these functions can use a common routine that performs a reset recovery delay. Upstream PR #: 93093 Signed-off-by: Andrzej Głąbek (cherry picked from commit 81ae9243acd0780462bcf9fd39f8560a6dc090db) --- drivers/flash/flash_mspi_nor.c | 97 +++++++++++++++++++--------- drivers/flash/flash_mspi_nor.h | 6 ++ dts/bindings/mtd/jedec,mspi-nor.yaml | 2 + 3 files changed, 73 insertions(+), 32 deletions(-) diff --git a/drivers/flash/flash_mspi_nor.c b/drivers/flash/flash_mspi_nor.c index 4416ddc91a53..bbda4c6361d6 100644 --- a/drivers/flash/flash_mspi_nor.c +++ b/drivers/flash/flash_mspi_nor.c @@ -810,39 +810,54 @@ static int switch_to_target_io_mode(const struct device *dev) &dev_config->mspi_nor_cfg); } +#if defined(WITH_SUPPLY_GPIO) +static int power_supply(const struct device *dev) +{ + const struct flash_mspi_nor_config *dev_config = dev->config; + int rc; + + if (!gpio_is_ready_dt(&dev_config->supply)) { + LOG_ERR("Device %s is not ready", + dev_config->supply.port->name); + return -ENODEV; + } + + rc = gpio_pin_configure_dt(&dev_config->supply, GPIO_OUTPUT_ACTIVE); + if (rc < 0) { + LOG_ERR("Failed to activate power supply GPIO: %d", rc); + return -EIO; + } + + return 0; +} +#endif + #if defined(WITH_RESET_GPIO) static int gpio_reset(const struct device *dev) { const struct flash_mspi_nor_config *dev_config = dev->config; int rc; - if (dev_config->reset.port) { - if (!gpio_is_ready_dt(&dev_config->reset)) { - LOG_ERR("Device %s is not ready", - dev_config->reset.port->name); - return -ENODEV; - } - - rc = gpio_pin_configure_dt(&dev_config->reset, - GPIO_OUTPUT_ACTIVE); - if (rc < 0) { - LOG_ERR("Failed to activate RESET: %d", rc); - return -EIO; - } + if (!gpio_is_ready_dt(&dev_config->reset)) { + LOG_ERR("Device %s is not ready", + dev_config->reset.port->name); + return -ENODEV; + } - if (dev_config->reset_pulse_us != 0) { - k_busy_wait(dev_config->reset_pulse_us); - } + rc = gpio_pin_configure_dt(&dev_config->reset, GPIO_OUTPUT_ACTIVE); + if (rc < 0) { + LOG_ERR("Failed to activate RESET: %d", rc); + return -EIO; + } - rc = gpio_pin_set_dt(&dev_config->reset, 0); - if (rc < 0) { - LOG_ERR("Failed to deactivate RESET: %d", rc); - return -EIO; - } + if (dev_config->reset_pulse_us != 0) { + k_busy_wait(dev_config->reset_pulse_us); + } - if (dev_config->reset_recovery_us != 0) { - k_busy_wait(dev_config->reset_recovery_us); - } + rc = gpio_pin_set_dt(&dev_config->reset, 0); + if (rc < 0) { + LOG_ERR("Failed to deactivate RESET: %d", rc); + return -EIO; } return 0; @@ -912,10 +927,6 @@ static int soft_reset(const struct device *dev) return rc; } - if (dev_config->reset_recovery_us != 0) { - k_busy_wait(dev_config->reset_recovery_us); - } - return 0; } #endif /* WITH_SOFT_RESET */ @@ -925,6 +936,7 @@ static int flash_chip_init(const struct device *dev) const struct flash_mspi_nor_config *dev_config = dev->config; struct flash_mspi_nor_data *dev_data = dev->data; uint8_t id[JESD216_READ_ID_LEN] = {0}; + bool flash_reset = false; int rc; rc = mspi_dev_config(dev_config->bus, &dev_config->mspi_id, @@ -936,12 +948,25 @@ static int flash_chip_init(const struct device *dev) dev_data->in_target_io_mode = false; +#if defined(WITH_SUPPLY_GPIO) + if (dev_config->supply.port) { + rc = power_supply(dev); + if (rc < 0) { + return rc; + } + + flash_reset = true; + } +#endif + #if defined(WITH_RESET_GPIO) - rc = gpio_reset(dev); + if (dev_config->reset.port) { + rc = gpio_reset(dev); + if (rc < 0) { + return rc; + } - if (rc < 0) { - LOG_ERR("Failed to reset with GPIO: %d", rc); - return rc; + flash_reset = true; } #endif @@ -951,9 +976,15 @@ static int flash_chip_init(const struct device *dev) if (rc < 0) { return rc; } + + flash_reset = true; } #endif + if (flash_reset && dev_config->reset_recovery_us != 0) { + k_busy_wait(dev_config->reset_recovery_us); + } + if (dev_config->quirks != NULL && dev_config->quirks->pre_init != NULL) { rc = dev_config->quirks->pre_init(dev); @@ -1172,6 +1203,8 @@ BUILD_ASSERT((FLASH_SIZE(inst) % CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE) == 0, \ .mspi_nor_init_cfg = FLASH_INITIAL_CONFIG(inst), \ IF_ENABLED(CONFIG_MSPI_XIP, \ (.xip_cfg = MSPI_XIP_CONFIG_DT_INST(inst),)) \ + IF_ENABLED(WITH_SUPPLY_GPIO, \ + (.supply = GPIO_DT_SPEC_INST_GET_OR(inst, supply_gpios, {0}),)) \ IF_ENABLED(WITH_RESET_GPIO, \ (.reset = GPIO_DT_SPEC_INST_GET_OR(inst, reset_gpios, {0}), \ .reset_pulse_us = DT_INST_PROP_OR(inst, t_reset_pulse, 0) \ diff --git a/drivers/flash/flash_mspi_nor.h b/drivers/flash/flash_mspi_nor.h index ac362f48c25c..950606fe3a8b 100644 --- a/drivers/flash/flash_mspi_nor.h +++ b/drivers/flash/flash_mspi_nor.h @@ -16,6 +16,9 @@ extern "C" { #include "jesd216.h" #include "spi_nor.h" +#if DT_ANY_INST_HAS_PROP_STATUS_OKAY(supply_gpios) +#define WITH_SUPPLY_GPIO 1 +#endif #if DT_ANY_INST_HAS_PROP_STATUS_OKAY(reset_gpios) #define WITH_RESET_GPIO 1 #endif @@ -72,6 +75,9 @@ struct flash_mspi_nor_config { #if defined(CONFIG_MSPI_XIP) struct mspi_xip_cfg xip_cfg; #endif +#if defined(WITH_SUPPLY_GPIO) + struct gpio_dt_spec supply; +#endif #if defined(WITH_RESET_GPIO) struct gpio_dt_spec reset; uint32_t reset_pulse_us; diff --git a/dts/bindings/mtd/jedec,mspi-nor.yaml b/dts/bindings/mtd/jedec,mspi-nor.yaml index 5343fde5f7da..06b72bf951c0 100644 --- a/dts/bindings/mtd/jedec,mspi-nor.yaml +++ b/dts/bindings/mtd/jedec,mspi-nor.yaml @@ -22,6 +22,8 @@ properties: type: int description: | Minimum time, in nanoseconds, the flash chip needs to recover after reset. + Such delay is performed when a GPIO or software reset is done, or after + power is supplied to the chip if the "supply-gpios" property is specified. transfer-timeout: type: int From c61e3f3ce2b475d212dfe16f88fa5f1eea11a460 Mon Sep 17 00:00:00 2001 From: Rubin Gerritsen Date: Mon, 16 Jun 2025 09:09:25 +0200 Subject: [PATCH 0455/2141] [nrf fromtree] Bluetooth: Decode Bluetooth 6.1 version number Bluetooth 6.1 has version number 0x0F and was released in May 2025. This commit ensures this version number is properly decoded. Going forward we may consider removing printing the version number as a string because the feature set is more important than the version number. Signed-off-by: Rubin Gerritsen (cherry picked from commit b63b993491633e699567ff0d71a3465ecfb9fa50) --- include/zephyr/bluetooth/hci_types.h | 1 + subsys/bluetooth/host/hci_core.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/include/zephyr/bluetooth/hci_types.h b/include/zephyr/bluetooth/hci_types.h index 2123556b4555..0b2c1b1a3976 100644 --- a/include/zephyr/bluetooth/hci_types.h +++ b/include/zephyr/bluetooth/hci_types.h @@ -858,6 +858,7 @@ struct bt_hci_rp_configure_data_path { #define BT_HCI_VERSION_5_3 12 #define BT_HCI_VERSION_5_4 13 #define BT_HCI_VERSION_6_0 14 +#define BT_HCI_VERSION_6_1 15 #define BT_HCI_OP_READ_LOCAL_VERSION_INFO BT_OP(BT_OGF_INFO, 0x0001) /* 0x1001 */ struct bt_hci_rp_read_local_version_info { diff --git a/subsys/bluetooth/host/hci_core.c b/subsys/bluetooth/host/hci_core.c index 3a866c6346d6..7263bc39ed4e 100644 --- a/subsys/bluetooth/host/hci_core.c +++ b/subsys/bluetooth/host/hci_core.c @@ -3843,7 +3843,7 @@ const char *bt_hci_get_ver_str(uint8_t core_version) { const char * const str[] = { "1.0b", "1.1", "1.2", "2.0", "2.1", "3.0", "4.0", "4.1", "4.2", - "5.0", "5.1", "5.2", "5.3", "5.4", "6.0" + "5.0", "5.1", "5.2", "5.3", "5.4", "6.0", "6.1" }; if (core_version < ARRAY_SIZE(str)) { From 1b785f57b67170f8c163fa617783a91013ce9b1f Mon Sep 17 00:00:00 2001 From: Triveni Danda Date: Tue, 29 Jul 2025 15:10:10 +0530 Subject: [PATCH 0456/2141] [nrf fromlist] soc: nordic: nrf54h: Add DT_NODE_EXISTS check Add `DT_NODE_EXISTS` check to ensure cpurad partition nodes exist before referencing their addresses. This prevents build errors when these partitions are not defined in the devicetree. Upstream PR #: 93815 Signed-off-by: Triveni Danda (cherry picked from commit 72ecd41ad7f33544dbe2e68437a3fe3f7cd8e5ad) --- soc/nordic/nrf54h/soc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soc/nordic/nrf54h/soc.c b/soc/nordic/nrf54h/soc.c index a20815b2227e..a3f67711e455 100644 --- a/soc/nordic/nrf54h/soc.c +++ b/soc/nordic/nrf54h/soc.c @@ -216,7 +216,7 @@ void soc_late_init_hook(void) DT_REG_ADDR(DT_NODELABEL(cpurad_slot0_partition)) + CONFIG_ROM_START_OFFSET); } -#else +#elif DT_NODE_EXISTS(DT_NODELABEL(cpurad_slot0_partition)) radiocore_address = (void *)(DT_REG_ADDR(DT_GPARENT(DT_NODELABEL(cpurad_slot0_partition))) + DT_REG_ADDR(DT_NODELABEL(cpurad_slot0_partition)) + From a1604e234eceb23779c387d5907294e4457b76e0 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Mon, 23 Jun 2025 10:01:56 +0100 Subject: [PATCH 0457/2141] [nrf fromtree] tests: fs: littlefs: Fix nRF54L15-based dtc overlay files Fixes these files to no longer delete non-secure partitions as they are not present, and updates the offset of the area to use Signed-off-by: Jamie McCrae (cherry picked from commit 3d11c84cfbcefef6ba0c341ad77d90a3e9daed18) --- .../fs/littlefs/boards/bl54l15_dvk_nrf54l15_cpuapp.overlay | 6 ++---- .../fs/littlefs/boards/bl54l15u_dvk_nrf54l15_cpuapp.overlay | 6 ++---- .../fs/littlefs/boards/nrf54l15dk_nrf54l15_cpuapp.overlay | 6 ++---- .../fs/littlefs/boards/ophelia4ev_nrf54l15_cpuapp.overlay | 6 ++---- 4 files changed, 8 insertions(+), 16 deletions(-) diff --git a/tests/subsys/fs/littlefs/boards/bl54l15_dvk_nrf54l15_cpuapp.overlay b/tests/subsys/fs/littlefs/boards/bl54l15_dvk_nrf54l15_cpuapp.overlay index 31e324265bc6..f0cf923b4e7e 100644 --- a/tests/subsys/fs/littlefs/boards/bl54l15_dvk_nrf54l15_cpuapp.overlay +++ b/tests/subsys/fs/littlefs/boards/bl54l15_dvk_nrf54l15_cpuapp.overlay @@ -5,9 +5,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -/delete-node/ &slot0_ns_partition; /delete-node/ &slot1_partition; -/delete-node/ &slot1_ns_partition; &cpuapp_rram { partitions { @@ -15,9 +13,9 @@ #address-cells = <1>; #size-cells = <1>; - small_partition: partition@67000 { + small_partition: partition@b6000 { label = "small"; - reg = <0x00067000 0x00010000>; + reg = <0x000b6000 0x00010000>; }; }; }; diff --git a/tests/subsys/fs/littlefs/boards/bl54l15u_dvk_nrf54l15_cpuapp.overlay b/tests/subsys/fs/littlefs/boards/bl54l15u_dvk_nrf54l15_cpuapp.overlay index 31e324265bc6..f0cf923b4e7e 100644 --- a/tests/subsys/fs/littlefs/boards/bl54l15u_dvk_nrf54l15_cpuapp.overlay +++ b/tests/subsys/fs/littlefs/boards/bl54l15u_dvk_nrf54l15_cpuapp.overlay @@ -5,9 +5,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -/delete-node/ &slot0_ns_partition; /delete-node/ &slot1_partition; -/delete-node/ &slot1_ns_partition; &cpuapp_rram { partitions { @@ -15,9 +13,9 @@ #address-cells = <1>; #size-cells = <1>; - small_partition: partition@67000 { + small_partition: partition@b6000 { label = "small"; - reg = <0x00067000 0x00010000>; + reg = <0x000b6000 0x00010000>; }; }; }; diff --git a/tests/subsys/fs/littlefs/boards/nrf54l15dk_nrf54l15_cpuapp.overlay b/tests/subsys/fs/littlefs/boards/nrf54l15dk_nrf54l15_cpuapp.overlay index 292e98c96a03..d7b166fa1e02 100644 --- a/tests/subsys/fs/littlefs/boards/nrf54l15dk_nrf54l15_cpuapp.overlay +++ b/tests/subsys/fs/littlefs/boards/nrf54l15dk_nrf54l15_cpuapp.overlay @@ -4,9 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -/delete-node/ &slot0_ns_partition; /delete-node/ &slot1_partition; -/delete-node/ &slot1_ns_partition; &cpuapp_rram { partitions { @@ -14,9 +12,9 @@ #address-cells = <1>; #size-cells = <1>; - small_partition: partition@67000 { + small_partition: partition@b6000 { label = "small"; - reg = <0x00067000 0x00010000>; + reg = <0x000b6000 0x00010000>; }; }; }; diff --git a/tests/subsys/fs/littlefs/boards/ophelia4ev_nrf54l15_cpuapp.overlay b/tests/subsys/fs/littlefs/boards/ophelia4ev_nrf54l15_cpuapp.overlay index 64bfe273c9d7..807d42c43da6 100644 --- a/tests/subsys/fs/littlefs/boards/ophelia4ev_nrf54l15_cpuapp.overlay +++ b/tests/subsys/fs/littlefs/boards/ophelia4ev_nrf54l15_cpuapp.overlay @@ -4,9 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -/delete-node/ &slot0_ns_partition; /delete-node/ &slot1_partition; -/delete-node/ &slot1_ns_partition; &cpuapp_rram { partitions { @@ -14,9 +12,9 @@ #address-cells = <1>; #size-cells = <1>; - small_partition: partition@67000 { + small_partition: partition@b6000 { label = "small"; - reg = <0x00067000 0x00010000>; + reg = <0x000b6000 0x00010000>; }; }; }; From b924e1adc5fa06b1e53e0f1088795a1a4529a271 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Wed, 30 Jul 2025 13:20:48 +0100 Subject: [PATCH 0458/2141] [nrf fromlist] mgmt: mcumgr: grp: img_mgmt: Show firmware loader slot info Allows returning image information for the firmware loader image slot, showing version of the application and flags Upstream PR #: 93875 Signed-off-by: Jamie McCrae (cherry picked from commit a1ba1018c3c8f262a570ae583c932d51cab0ca7f) --- .../mcumgr/grp/img_mgmt/src/img_mgmt_state.c | 50 ++++++++++++++++++- .../mcumgr/grp/img_mgmt/src/zephyr_img_mgmt.c | 2 +- 2 files changed, 49 insertions(+), 3 deletions(-) diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt_state.c b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt_state.c index 5333d651c9f9..384d06137393 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt_state.c +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt_state.c @@ -58,6 +58,11 @@ LOG_MODULE_DECLARE(mcumgr_img_grp, CONFIG_MCUMGR_GRP_IMG_LOG_LEVEL); #define DIRECT_XIP_BOOT_FOREVER 3 #endif +#if defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_FIRMWARE_UPDATER) && \ + CONFIG_MCUMGR_GRP_IMG_UPDATABLE_IMAGE_NUMBER > 1 +#warning "MCUmgr img mgmt only supports 1 image" +#endif + /** * Collects information about the specified image slot. */ @@ -196,7 +201,6 @@ int img_mgmt_get_next_boot_slot(int image, enum img_mgmt_next_boot_type *type) #else #if defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP_WITH_REVERT) - static int read_directxip_state(int slot) { struct boot_swap_state bss; @@ -229,6 +233,8 @@ static int read_directxip_state(int slot) } #endif /* defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP_WITH_REVERT) */ +#if defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP) || \ + defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP_WITH_REVERT) int img_mgmt_get_next_boot_slot(int image, enum img_mgmt_next_boot_type *type) { struct image_version aver; @@ -301,12 +307,14 @@ int img_mgmt_get_next_boot_slot(int image, enum img_mgmt_next_boot_type *type) return return_slot; } +#endif /* defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP) || \ + * defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP_WITH_REVERT) + */ #endif /* !defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP) && \ * !defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP_WITH_REVERT) && \ * !defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_FIRMWARE_UPDATER) */ - /** * Indicates whether any image slot is pending (i.e., whether a test swap will * happen on the next reboot. @@ -494,6 +502,7 @@ static bool img_mgmt_state_encode_slot(struct smp_streamer *ctxt, uint32_t slot, /** * Command handler: image state read */ +#if !defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_FIRMWARE_UPDATER) int img_mgmt_state_read(struct smp_streamer *ctxt) { @@ -551,6 +560,43 @@ img_mgmt_state_read(struct smp_streamer *ctxt) return ok ? MGMT_ERR_EOK : MGMT_ERR_EMSGSIZE; } +#else +int +img_mgmt_state_read(struct smp_streamer *ctxt) +{ + zcbor_state_t *zse = ctxt->writer->zs; + uint32_t i; + bool ok; + + ok = zcbor_tstr_put_lit(zse, "images") && + zcbor_list_start_encode(zse, 2); + + img_mgmt_take_lock(); + + for (i = 0; ok && i < CONFIG_MCUMGR_GRP_IMG_UPDATABLE_IMAGE_NUMBER; i++) { + /* _a is active slot, _o is opposite slot */ + int slot_a = img_mgmt_active_slot(i); + int slot_o = img_mgmt_get_opposite_slot(slot_a); + int flags_a = REPORT_SLOT_ACTIVE; + int flags_o = REPORT_SLOT_CONFIRMED; + + ok = img_mgmt_state_encode_slot(ctxt, slot_o, flags_o) && + img_mgmt_state_encode_slot(ctxt, slot_a, flags_a); + } + + /* Ending list encoding for two slots per image */ + ok = ok && zcbor_list_end_encode(zse, 2); + /* splitStatus is always 0 so in frugal list it is not present at all */ + if (!IS_ENABLED(CONFIG_MCUMGR_GRP_IMG_FRUGAL_LIST) && ok) { + ok = zcbor_tstr_put_lit(zse, "splitStatus") && + zcbor_int32_put(zse, 0); + } + + img_mgmt_release_lock(); + + return ok ? MGMT_ERR_EOK : MGMT_ERR_EMSGSIZE; +} +#endif /* !defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_FIRMWARE_UPDATER) */ static int img_mgmt_set_next_boot_slot_common(int slot, int active_slot, bool confirm) { diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/src/zephyr_img_mgmt.c b/subsys/mgmt/mcumgr/grp/img_mgmt/src/zephyr_img_mgmt.c index b43b250ad16e..d4972b573ccf 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/src/zephyr_img_mgmt.c +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/src/zephyr_img_mgmt.c @@ -140,11 +140,11 @@ img_mgmt_flash_area_id(int slot) fa_id = FIXED_PARTITION_ID(SLOT0_PARTITION); break; -#if !defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_FIRMWARE_UPDATER) case 1: fa_id = FIXED_PARTITION_ID(SLOT1_PARTITION); break; +#if !defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_FIRMWARE_UPDATER) #if FIXED_PARTITION_EXISTS(SLOT2_PARTITION) case 2: fa_id = FIXED_PARTITION_ID(SLOT2_PARTITION); From 8d67a0f289f02ed16ef4644fb6f7df4562ce8aa5 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Fri, 25 Jul 2025 19:42:08 +0530 Subject: [PATCH 0459/2141] [nrf fromtree] drivers: nrf_wifi: Fix the issue of delayed keepalive Supplicant sends keepalive on timer expiry but due to driver + nRF70 delays it is delayed to the AP, meanwhile some APs disconnect due to lack of keepalive. Set the processing delay to 700ms (based on tests) to fix. Signed-off-by: Chaitanya Tata (cherry picked from commit 7fe693029f43755e3eaf0d7545f31d71398691df) --- drivers/wifi/nrf_wifi/src/wpa_supp_if.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/wifi/nrf_wifi/src/wpa_supp_if.c b/drivers/wifi/nrf_wifi/src/wpa_supp_if.c index 1ef412df7f72..21f7600ca80a 100644 --- a/drivers/wifi/nrf_wifi/src/wpa_supp_if.c +++ b/drivers/wifi/nrf_wifi/src/wpa_supp_if.c @@ -1807,6 +1807,11 @@ int nrf_wifi_supp_get_capa(void *if_priv, struct wpa_driver_capa *capa) capa->extended_capa_mask = rpu_ctx_zep->extended_capa_mask; capa->extended_capa_len = rpu_ctx_zep->extended_capa_len; } + /* Based on testing, this works to fix the disconnection due to delayed + * keepalive to the AP + */ + capa->driver_tx_processing_delay_ms = 1000; + out: k_mutex_unlock(&vif_ctx_zep->vif_lock); return status; From 9d2a54e5529f39fb05228bbeaa6e937d30eddc3c Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Tue, 15 Jul 2025 13:34:44 +0530 Subject: [PATCH 0460/2141] [nrf fromtree] manifest: hostap: Pull support to dump keys Helps in debugging crypto issues. Signed-off-by: Chaitanya Tata (cherry picked from commit 7fbb0fda6cd6588a1da5a407518e8a3518053a83) --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 94e1638cb45f..c4c3f8ceda51 100644 --- a/west.yml +++ b/west.yml @@ -281,7 +281,7 @@ manifest: - hal - name: hostap path: modules/lib/hostap - revision: e942f86e865d5b24bbbe8b0c333f030cbbe62bfb + revision: 7fda615fcccd577af7339b4198400c39ac14f8f8 - name: liblc3 revision: 48bbd3eacd36e99a57317a0a4867002e0b09e183 path: modules/lib/liblc3 From 47f186c0e50d052ccafb9b9b70caba717b5280c2 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Fri, 25 Jul 2025 19:42:06 +0530 Subject: [PATCH 0461/2141] [nrf fromtree] manifest: hostap: Pull feature to add driver processing delay to capa Pull the feature to add driver processing delay to the driver capabilities. Useful to customize for sending keepalive. Signed-off-by: Chaitanya Tata (cherry picked from commit d51127ddc3ae777ba0316d277b0eab8d0be7ea7d) --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index c4c3f8ceda51..41fa45c86936 100644 --- a/west.yml +++ b/west.yml @@ -281,7 +281,7 @@ manifest: - hal - name: hostap path: modules/lib/hostap - revision: 7fda615fcccd577af7339b4198400c39ac14f8f8 + revision: c55683ce514953277be5566fceb38c4c2485f1e1 - name: liblc3 revision: 48bbd3eacd36e99a57317a0a4867002e0b09e183 path: modules/lib/liblc3 From d87f317227c9bbdc2c9712d195560841dd8740fd Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Thu, 31 Jul 2025 17:40:48 +0530 Subject: [PATCH 0462/2141] [nrf fromlist] net: l2: wifi: Fix the default keepalive value 30s is too aggressive for most APs, and hostapd also uses 5mins as the default value. Upstream PR #: 93920 Signed-off-by: Chaitanya Tata (cherry picked from commit 9a7025a16ba4c627cab994dc9f4c3fd38ae53319) --- subsys/net/l2/wifi/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/l2/wifi/Kconfig b/subsys/net/l2/wifi/Kconfig index 7728678cc979..49d061c7439c 100644 --- a/subsys/net/l2/wifi/Kconfig +++ b/subsys/net/l2/wifi/Kconfig @@ -158,7 +158,7 @@ endif # WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE config WIFI_MGMT_BSS_MAX_IDLE_TIME int "BSS max idle timeout in seconds" range 0 64000 - default 30 + default 300 help As per 802.11-2020: 11.21.13 BSS max idle period management If dot11WirelessManagementImplemented is true, dot11BSSMaxIdlePeriod is From 91510521ffd06a8fadad9c73db8cf13e555f3cff Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Thu, 31 Jul 2025 17:42:03 +0530 Subject: [PATCH 0463/2141] [nrf fromlist] drivers: nrf_wifi: Fix the interoperability issues With few APs we have seen unexplained disconnections and sending keepalive often solves the problem, so, to fix interoperability reduce the keepalive period to 30s. Upstream PR #: 93920 Signed-off-by: Chaitanya Tata (cherry picked from commit f5f766da850ecdbec38ff23c954cb5092427afb0) --- drivers/wifi/nrf_wifi/Kconfig.nrfwifi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/wifi/nrf_wifi/Kconfig.nrfwifi b/drivers/wifi/nrf_wifi/Kconfig.nrfwifi index af3e7827dcbf..4b3bb0d41ca2 100644 --- a/drivers/wifi/nrf_wifi/Kconfig.nrfwifi +++ b/drivers/wifi/nrf_wifi/Kconfig.nrfwifi @@ -840,7 +840,7 @@ if NRF_WIFI_FEAT_KEEPALIVE config NRF_WIFI_KEEPALIVE_PERIOD_S int "Keepalive period in seconds" range 30 3600 - default 60 + default 30 help Keepalive period in seconds to send keepalive packets to the AP. endif From 98158522b81f9b0f7926731714063c80dec0eaa5 Mon Sep 17 00:00:00 2001 From: Piotr Kosycarz Date: Fri, 1 Aug 2025 08:08:45 +0200 Subject: [PATCH 0464/2141] [nrf fromlist] samples: boards: nordic: spis_wakeup: fix boot for h20 Explicit start radio core. Upstream PR #: 93966 Signed-off-by: Piotr Kosycarz (cherry picked from commit 9425c47819d9bfe1bee49174949135beed7e5ab3) --- .../nordic/spis_wakeup/boards/nrf54h20dk_nrf54h20_cpuapp.conf | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 samples/boards/nordic/spis_wakeup/boards/nrf54h20dk_nrf54h20_cpuapp.conf diff --git a/samples/boards/nordic/spis_wakeup/boards/nrf54h20dk_nrf54h20_cpuapp.conf b/samples/boards/nordic/spis_wakeup/boards/nrf54h20dk_nrf54h20_cpuapp.conf new file mode 100644 index 000000000000..61643e48fbfd --- /dev/null +++ b/samples/boards/nordic/spis_wakeup/boards/nrf54h20dk_nrf54h20_cpuapp.conf @@ -0,0 +1,4 @@ +# Copyright (c) 2025 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_SOC_NRF54H20_CPURAD_ENABLE=y From 26572f95c09d9c063ad9dda85b6e6368f015ce94 Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Tue, 26 Jan 2021 15:43:08 +0100 Subject: [PATCH 0465/2141] [nrf noup] ci: set `ZEPHYR__KCONFIG` for NCS modules MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit sets `ZEPHYR__KCONFIG` variable for each Kconfig file discovered in `nrf/modules//Kconfig`. This is not meant as a permanent solution; we should do more careful consideration on the optimal approach forward that will allow compliance_check.py to be used downstream with custom module_ext_roots, and at the same time keep current flexibility for module glue code handling intact. Adds a static path for the NRF Kconfig variable in the check compliance script, this is a temporary workaround due to supporting an external root for NCS that should be reworked to use package helper in future Signed-off-by: Torsten Rasmussen Signed-off-by: Martí Bolívar Signed-off-by: Carles Cufi Signed-off-by: Jamie McCrae (cherry picked from commit ade9bb7cb0820e2e6dbbc6ebb74b2e0a8063a743) --- scripts/ci/check_compliance.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index cd97ea96717f..31bb02c22f88 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -458,6 +458,13 @@ def get_modules(self, modules_file, sysbuild_modules_file, settings_file): modules = [name for name in os.listdir(modules_dir) if modules_dir / name / 'Kconfig'] + nrf_modules_dir = ZEPHYR_BASE / Path('../nrf/modules') + nrf_modules = [] + if os.path.exists(nrf_modules_dir): + nrf_modules = [name for name in os.listdir(nrf_modules_dir) if + os.path.exists(os.path.join(nrf_modules_dir, name, + 'Kconfig'))] + with open(modules_file, 'r') as fp_module_file: content = fp_module_file.read() @@ -467,8 +474,31 @@ def get_modules(self, modules_file, sysbuild_modules_file, settings_file): re.sub('[^a-zA-Z0-9]', '_', module).upper(), modules_dir / module / 'Kconfig' )) + for module in nrf_modules: + fp_module_file.write("ZEPHYR_{}_KCONFIG = {}\n".format( + re.sub('[^a-zA-Z0-9]', '_', module).upper(), + nrf_modules_dir / module / 'Kconfig' + )) + fp_module_file.write("NCS_{}_KCONFIG = {}\n".format( + re.sub('[^a-zA-Z0-9]', '_', module).upper(), + modules_dir / module / 'Kconfig' + )) + # Add NRF as static entry as workaround for ext Kconfig root support + fp_module_file.write("ZEPHYR_NRF_KCONFIG = {}\n".format( + nrf_modules_dir / '..' / 'Kconfig.nrf' + )) fp_module_file.write(content) + with open(sysbuild_modules_file, 'r') as fp_sysbuild_module_file: + content = fp_sysbuild_module_file.read() + + with open(sysbuild_modules_file, 'w') as fp_sysbuild_module_file: + # Add NRF as static entry as workaround for ext Kconfig root support + fp_sysbuild_module_file.write("SYSBUILD_NRF_KCONFIG = {}\n".format( + nrf_modules_dir / '..' / 'sysbuild' / 'Kconfig.sysbuild' + )) + fp_sysbuild_module_file.write(content) + def get_kconfig_dts(self, kconfig_dts_file, settings_file): """ Generate the Kconfig.dts using dts/bindings as the source. From 88c7330e9305bcb19c46cb7f4d03db556753bab1 Mon Sep 17 00:00:00 2001 From: Piotr Golyzniak Date: Mon, 1 Aug 2022 13:06:01 +0200 Subject: [PATCH 0466/2141] [nrf noup] ci: scripts: add quarantine file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add scripts/quarantine.yaml file, which will be used in CI. Signed-off-by: Piotr Golyzniak Signed-off-by: Andrzej Głąbek Signed-off-by: Maciej Perkowski Signed-off-by: Robert Lubos (cherry picked from commit b4f0ded58f92d12045dfc90466fb512d6a1fc1f2) --- scripts/quarantine.yaml | 88 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 scripts/quarantine.yaml diff --git a/scripts/quarantine.yaml b/scripts/quarantine.yaml new file mode 100644 index 000000000000..20c4f9248ea9 --- /dev/null +++ b/scripts/quarantine.yaml @@ -0,0 +1,88 @@ +# The configurations resulting as a product of scenarios and platforms +# will be skipped if quarantine is used. More details here: +# https://docs.zephyrproject.org/latest/guides/test/twister.html#quarantine + +- scenarios: + - testing.ztest.busy_sim + - testing.ztest.busy_sim_nrf52840dk_pin + platforms: + - nrf52840dk_nrf52840 + +# Already reported, but will not be fixed (look at the discussion): +# https://github.com/zephyrproject-rtos/zephyr/issues/44947 +- scenarios: + - libraries.cmsis_dsp.matrix.unary_f64 + platforms: + - nrf5340dk_nrf5340_cpunet + - qemu_cortex_m3 + comment: "Flash overflows" + +# Already reported, but will not be fixed (look at the discussion): +# https://github.com/zephyrproject-rtos/zephyr/issues/44947 +- scenarios: + - libraries.cmsis_dsp.matrix.binary_f16 + - libraries.cmsis_dsp.matrix.binary_f16.fpu + platforms: + - nrf5340dk_nrf5340_cpuapp_ns + comment: "Flash overflows" + +# Already reported, but will not be fixed (look at the discussion): +# https://github.com/zephyrproject-rtos/zephyr/issues/44947 +- scenarios: + - libraries.cmsis_dsp.matrix.binary_q15 + - libraries.cmsis_dsp.matrix.binary_q15.fpu + - libraries.cmsis_dsp.matrix.unary_f32 + - libraries.cmsis_dsp.matrix.unary_f32.fpu + - libraries.cmsis_dsp.matrix.unary_f64 + - libraries.cmsis_dsp.matrix.unary_f64.fpu + platforms: + - nrf5340dk_nrf5340_cpuapp_ns + - nrf9160dk_nrf9160_ns + comment: "Flash overflows" + +# libsdl2-dev package should be added into docker image +- scenarios: + - sample.boards.nrf.nrf_led_matrix + - sample.display.lvgl.gui + platforms: + - native_posix + comment: "libsdl2-dev package not available" + +- scenarios: + - sample.net.sockets.echo_server.usbnet + - sample.net.sockets.echo_server.usbnet_composite + platforms: + - nrf5340dk_nrf5340_cpuapp_ns + comment: "Ram/flash overflows, also in the upstream" + +- scenarios: + - sample.net.zperf.netusb_ecm + - sample.net.zperf.netusb_eem + - sample.net.zperf.netusb_rndis + platforms: + - nrf52833dk_nrf52833 + - nrf5340dk_nrf5340_cpuapp_ns + comment: "Ram/flash overflows, also in the upstream" + +- scenarios: + - net.mqtt.tls + platforms: + - nrf5340dk_nrf5340_cpuapp_ns + - nrf9160dk_nrf9160_ns + comment: "Ram/flash overflows, also in the upstream" + +- scenarios: + - kernel.common.picolibc + - libraries.picolibc + - libraries.libc.picolibc.mem_alloc + - libraries.picolibc.sprintf_new + platforms: + - nrf52dk_nrf52832 + comment: "Ram overflows, also in the upstream" + +- scenarios: + - sample.psa_crypto + platforms: + - nrf5340dk_nrf5340_cpuapp_ns + - nrf9160dk_nrf9160_ns + comment: "Due to using sdk-zephyr manifest instead of nrf. Should be fixed after the change" From fc65d19b1f987439ab158c74e32f2085060baf09 Mon Sep 17 00:00:00 2001 From: Sebastian Wezel Date: Tue, 15 Mar 2022 13:12:25 +0100 Subject: [PATCH 0467/2141] [nrf noup] ci: add .github/test-spec.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This file is used for NCS-specific testing configuration based on modifications to files in this repository. Signed-off-by: Alperen Sener Signed-off-by: Elisabeth Solheim Klakken Signed-off-by: Mariusz Poslinski Signed-off-by: Markus Swarowsky Signed-off-by: Robert Lubos Signed-off-by: Sebastian Wezel Signed-off-by: Tomasz Tyzenhauz Signed-off-by: Fredrik Ås Signed-off-by: Michał Szablowski Signed-off-by: Tony Le Signed-off-by: Krishna T Signed-off-by: Dawid Przybylo Signed-off-by: Rubin Gerritsen Signed-off-by: Jørgen Kvalvaag Signed-off-by: Magne Værnes Signed-off-by: Lang Xie Signed-off-by: Alexander Svensen Signed-off-by: Jan Gałda Signed-off-by: Vladislav Litvinov Signed-off-by: Guojun Wang Signed-off-by: Piotr Kosycarz Signed-off-by: Thomas Stilwell Signed-off-by: Krzysztof Szromek Signed-off-by: Grzegorz Chwierut Signed-off-by: Eduardo Montoya Signed-off-by: Pavel Vasilyev (cherry picked from commit f6fc29e37e108782290d9536973d7c60cd74b6d2) --- .github/test-spec.yml | 392 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 392 insertions(+) create mode 100644 .github/test-spec.yml diff --git a/.github/test-spec.yml b/.github/test-spec.yml new file mode 100644 index 000000000000..6da6bdbaa87d --- /dev/null +++ b/.github/test-spec.yml @@ -0,0 +1,392 @@ +# This is the Jenkins ci variant of the .github/labler.yaml + +"CI-run-zephyr-twister": + - any: + - "!.github/**/*" + - "!doc/**/*" + - "!CODEOWNERS" + - "!LICENSE" + - "!**/*.rst" + - "!VERSION" + - "!submanifests/**/*" + - "!MAINTAINERS.yml" + - "!version.h.in" + - "!Jenkinsfile" + - "!**/*.md" + +"CI-iot-zephyr-lwm2m-test": + - "drivers/console/**/*" + - "drivers/flash/**/*" + - "subsys/dfu/boot/**/*" + - "subsys/net/ip/**/*" + - "subsys/net/lib/http/**/*" + - "subsys/net/lib/lwm2m//**/*" + - "subsys/net/**/*" + +"CI-iot-samples-test": + - "boards/nordic/nrf9160dk/**/*" + - "dts/arm/nordic/nrf9160*" + - "include/net/**/*" + - "subsys/net/lib/**/*" + +"CI-iot-libraries-test": + - "boards/nordic/nrf9160dk/**/*" + - "dts/arm/nordic/nrf9160*" + - "include/net/socket_ncs.h" + - "subsys/testsuite/ztest/**/*" + +"CI-lwm2m-test": null +# Not necessary to run tests on changes to this repo. + +"CI-boot-test": + - "subsys/mgmt/mcumgr/**/*" + - "subsys/dfu/**/*" + - "include/mgmt/mcumgr/**/*" + - "include/dfu/**/*" + - "samples/subsys/mgmt/mcumgr/smp_svr/**/*" + - "tests/boot/**/*" + - "tests/subsys/dfu/**/*" + - "tests/subsys/mgmt/mcumgr/**/*" + +"CI-tfm-test": + - "boards/nordic/nrf5340dk/**/*" + - "boards/nordic/nrf9160dk/**/*" + - "drivers/entropy/*" + - "dts/arm/nordic/nrf5340*" + - "dts/arm/nordic/nrf9160*" + - "modules/trusted-firmware-m/**/*" + - "samples/tfm_integration/**/*" + +"CI-ble-test": + - any: + - "drivers/bluetooth/**/*" + - any: + - "dts/arm/nordic/nrf5*" + - any: + - "subsys/bluetooth/**/*" + - "!subsys/bluetooth/mesh/**/*" + - "!subsys/bluetooth/audio/**/*" + - any: + - "include/zephyr/bluetooth/**/*" + - "!include/zephyr/bluetooth/mesh/**/*" + - "samples/bluetooth/hci_ipc/**/*" + +"CI-ble-samples-test": + - any: + - "drivers/bluetooth/**/*" + - any: + - "dts/arm/nordic/nrf5*" + - any: + - "subsys/bluetooth/**/*" + - "!subsys/bluetooth/mesh/**/*" + - "!subsys/bluetooth/audio/**/*" + - any: + - "include/zephyr/bluetooth/**/*" + - "!include/zephyr/bluetooth/mesh/**/*" + - "samples/bluetooth/**/*" + +"CI-mesh-test": + - "subsys/bluetooth/mesh/**/*" + - "include/zephyr/bluetooth/mesh/**/*" + - "samples/bluetooth/mesh/**/*" + - "samples/bluetooth/mesh_demo/**/*" + - "samples/bluetooth/mesh_provisioner/**/*" + - "tests/bluetooth/mesh/**/*" + - "tests/bluetooth/mesh_shell/**/*" + +"CI-thingy91-test": + - "boards/nordic/nrf9160dk/**/*" + - "arch/x86/core/**/*" + - "arch/x86/include/**/*" + - "drivers/console/**/*" + - "drivers/ethernet/**/*" + - "drivers/flash/**/*" + - "drivers/hwinfo/**/*" + - "drivers/interrupt_controller/**/*" + - "drivers/net/**/*" + - "drivers/serial/**/*" + - "drivers/timer/**/*" + - "include/**/*" + - "kernel/**/*" + - "lib/libc/common/source/stdlib/**/*" + - "lib/libc/newlib/**/*" + - "lib/libc/picolibc/**/*" + - "lib/os/**/*" + - "lib/posix/**/*" + - "misc/**/*" + - "modules/mbedtls/**/*" + - "soc/x86/ia32/**/*" + - "subsys/fs/fcb/**/*" + - "subsys/logging/**/*" + - "subsys/net/**/*" + - "subsys/random/**/*" + - "subsys/settings/include/**/*" + - "subsys/settings/src/**/*" + - "subsys/stats/**/*" + - "subsys/storage/flash_map/**/*" + - "subsys/storage/stream/**/*" + - "subsys/tracing/**/*" + +"CI-desktop-test": + - "drivers/bluetooth/*" + - "subsys/bluetooth/*" + - "include/zephyr/bluetooth/*" + +"CI-crypto-test": + - "boards/nordic/nrf52840dk/**/*" + - "boards/nordic/nrf5340dk/**/*" + - "boards/nordic/nrf9160dk/**/*" + - "drivers/entropy/*" + - "drivers/serial/**/*" + - "dts/arm/nordic/nrf52840*" + - "dts/arm/nordic/nrf5340*" + - "dts/arm/nordic/nrf9160*" + - "include/drivers/serial/**/*" + - "modules/mbedtls/**/*" + +"CI-fem-test": + - "boards/nordic/**/*" + - "drivers/bluetooth/hci/**/*" + - "drivers/entropy/**/*" + - "dts/bindings/**/*" + - "include/zephyr/net/**/*" + - "include/zephyr/arch/**/*" + - "lib/libc/**/*" + - "lib/open-amp/**/*" + - "modules/hal_nordic/**/*" + - "modules/mbedtls/**/*" + - "modules/openthread/**/*" + - "modules/trusted-firmware-m/**/*" + - "samples/net/sockets/echo_*/**/*" + - "share/**/*" + - "soc/nordic/**/*" + - "subsys/net/**/*" + - "subsys/settings/**/*" + - "subsys/bluetooth/shell/**/*" + - "subsys/ipc/**/*" + - "Kconfig" + - "CMakeLists.txt" + +"CI-rs-test": + - "boards/nordic/**/*" + - "drivers/bluetooth/hci/**/*" + - "drivers/entropy/**/*" + - "dts/bindings/**/*" + - "include/zephyr/net/**/*" + - "include/zephyr/arch/**/*" + - "lib/libc/**/*" + - "lib/open-amp/**/*" + - "modules/hal_nordic/**/*" + - "modules/mbedtls/**/*" + - "modules/openthread/**/*" + - "modules/trusted-firmware-m/**/*" + - "samples/net/sockets/echo_*/**/*" + - "share/**/*" + - "soc/nordic/**/*" + - "subsys/net/**/*" + - "subsys/settings/**/*" + - "subsys/bluetooth/shell/**/*" + - "subsys/ipc/**/*" + - "Kconfig" + - "CMakeLists.txt" + +"CI-thread-test": + - "include/zephyr/net/**/*" + - "modules/mbedtls/**/*" + - "modules/openthread/**/*" + - "samples/net/openthread/**/*" + - "soc/nordic/**/*" + - "subsys/net/**/*" + - "subsys/settings/**/*" + +"CI-nfc-test": + - "drivers/bluetooth/hci/**/*" + - "drivers/entropy/**/*" + - "drivers/flash/**/*" + - "drivers/mbox/**/*" + - "drivers/spi/**/*" + - "lib/crc/**/*" + - "modules/hal_nordic/**/*" + - "soc/nordic/**/*" + - "subsys/ipc/ipc_service/**/*" + - "subsys/fs/**/*" + - "subsys/mem_mgmt/**/*" + - "subsys/net/**/*" + - "subsys/random/**/*" + - "subsys/settings/**/*" + - "subsys/shell/**/*" + - "subsys/storage/**/*" + - any: + - "subsys/bluetooth/**/*" + - "!subsys/bluetooth/mesh/**/*" + +"CI-matter-test": + - "include/dfu/**/*" + - "include/mgmt/mcumgr/**/*" + - "soc/nordic/**/*" + - "subsys/dfu/**/*" + - "subsys/settings/**/*" + - "subsys/net/**/*" + - "subsys/mgmt/mcumgr/**/*" + - "drivers/net/**/*" + - "samples/bluetooth/hci_ipc/**/*" + - any: + - "subsys/bluetooth/**/*" + - "!subsys/bluetooth/mesh/**/*" + - "!subsys/bluetooth/audio/**/*" + +"CI-find-my-test": + - "boards/nordic/**/*" + - "drivers/bluetooth/**/*" + - "drivers/entropy/**/*" + - "drivers/flash/**/*" + - "drivers/usb/**/*" + - "drivers/regulator/**/*" + - "soc/nordic/**/*" + - "subsys/dfu/**/*" + - "subsys/fs/**/*" + - "subsys/ipc/**/*" + - "subsys/net/**/*" + - "subsys/random/**/*" + - "subsys/settings/**/*" + - "subsys/storage/**/*" + - "subsys/tracing/**/*" + - "subsys/usb/device/**/*" + - any: + - "subsys/bluetooth/**/*" + - "!subsys/bluetooth/mesh/**/*" + +"CI-rpc-test": + - "subsys/ipc/ipc_service/**/*" + - "subsys/random/**/*" + - "soc/nordic/nrf53/**/*" + +"CI-modemshell-test": + - "include/net/**/*" + - "include/posix/**/*" + - "include/shell/**/*" + - "drivers/net/**/*" + - "drivers/serial/**/*" + - "drivers/wifi/**/*" + - "subsys/shell/**/*" + - "subsys/net/**/*" + - "subsys/settings/**/*" + +"CI-positioning-test": + - "include/net/**/*" + - "include/posix/**/*" + - "drivers/net/**/*" + - "drivers/wifi/**/*" + - "subsys/net/**/*" + - "subsys/settings/**/*" + +"CI-cloud-test": + - "include/zephyr/dfu/**/*" + - "include/zephyr/net/**/*" + - "include/zephyr/posix/**/*" + - "include/zephyr/settings/**/*" + - "drivers/led/**/*" + - "drivers/net/**/*" + - "drivers/sensor/**/*" + - "drivers/serial/**/*" + - "drivers/wifi/**/*" + - "lib/posix/**/*" + - "soc/nordic/**/*" + - "subsys/dfu/**/*" + - "subsys/net/**/*" + - "subsys/settings/**/*" + +"CI-wifi": + - "subsys/net/l2/wifi/**/*" + - "subsys/net/l2/ethernet/**/*" + +"CI-audio-test": + - "boards/nordic/nrf5340_audio_dk/**/*" + - "drivers/flash/**/*" + - "drivers/spi/**/*" + - "drivers/gpio/**/*" + - "drivers/i2c/**/*" + - "drivers/watchdog/**/*" + - "include/dfu/**/*" + - "include/mgmt/mcumgr/**/*" + - "samples/bluetooth/hci_ipc/**/*" + - "soc/nordic/**/*" + - "subsys/bluetooth/audio/**/*" + - "subsys/bluetooth/host/**/*" + - "subsys/dfu/**/*" + - "subsys/fs/**/*" + - "subsys/mgmt/mcumgr/**/*" + - "subsys/sd/**/*" + - "subsys/storage/**/*" + - "subsys/task_wdt/**/*" + - "subsys/usb/**/*" + - "subsys/zbus/**/*" + +"CI-pmic-samples-test": + - "samples/shields/npm1300_ek/**/*" + - "boards/shields/npm1300_ek/**/*" + - "**/**npm1300**/**" + - "drivers/regulator/regulator_common.c" + - "drivers/regulator/regulator_shell.c" + - "drivers/gpio/gpio_shell.c" + - "drivers/sensor/sensor_shell.c" + +"CI-test-low-level": + - "arch/**/*" + - "boards/nordic/nrf54*/**/*" + - "drivers/**/*" + - "dts/**/*" + - "include/zephyr/**/*" + - "kernel/**/*" + - "modules/hal_nordic/**/*" + - "samples/basic/blinky_pwm/**/*" + - "samples/basic/fade_led/**/*" + - "samples/boards/nrf/**/*" + - "samples/boards/nordic/**/*" + - "samples/drivers/adc/**/*" + - "samples/drivers/jesd216/**/*" + - "samples/drivers/mbox/**/*" + - "samples/drivers/soc_flash_nrf/**/*" + - "samples/drivers/spi_flash/**/*" + - "samples/drivers/watchdog/**/*" + - "samples/hello_world/**/*" + - "samples/sensor/**/*" + - "samples/subsys/ipc/**/*" + - "samples/subsys/logging/**/*" + - "samples/subsys/settings/**/*" + - "samples/subsys/usb/cdc_acm/**/*" + - "samples/subsys/usb/mass/**/*" + - "samples/synchronization/**/*" + - "subsys/logging/**/*" + - "subsys/settings/**/*" + - "tests/arch/**/*" + - "tests/boards/nrf/**/*" + - "tests/boards/nordic/**/*" + - "tests/drivers/**/*" + - "tests/kernel/**/*" + +"CI-suit-dfu-test": + - "subsys/mgmt/mcumgr/**/*" + - "include/mgmt/mcumgr/**/*" + - "samples/subsys/mgmt/mcumgr/smp_svr/**/*" + - "subsys/bluetooth/**/*" + - "drivers/bluetooth/**/*" + - "drivers/flash/**/*" + - "drivers/spi/**/*" + - "drivers/mbox/**/*" + - "drivers/serial/**/*" + - "drivers/console/**/*" + - "drivers/gpio/**/*" + - "dts/common/nordic/*" + - "dts/arm/nordic/nrf54h*/**/*" + - "dts/riscv/nordic/nrf54h*/**/*" + - "boards/nordic/nrf54h*/**/*" + - "soc/nordic/nrf54h/**/*" + - "include/zephyr/**/*" + - "subsys/logging/**/*" + - "subsys/tracing/**/*" + - "scripts/west_commands/build.py" + - "scripts/west_commands/flash.py" + - "scripts/west_commands/runners/nrfutil.py" + - "scripts/west_commands/runners/core.py" + - "scripts/west_commands/runners/nrf_common.py" From e6f28400604c1307aa5768438749b9686e891947 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Thu, 1 Jun 2023 15:58:56 +0200 Subject: [PATCH 0468/2141] [nrf noup] tests: drivers: build_all: regulator: use old schema New Twister schema is not supported yet in sdk-zephyr, drop this patch once Twister is updated. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit b1e95ba9e07f42dd8ca7468b8d90a3c1902c26ff) --- tests/drivers/build_all/regulator/testcase.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/drivers/build_all/regulator/testcase.yaml b/tests/drivers/build_all/regulator/testcase.yaml index 30d494aca231..b662f0ac2050 100644 --- a/tests/drivers/build_all/regulator/testcase.yaml +++ b/tests/drivers/build_all/regulator/testcase.yaml @@ -3,9 +3,7 @@ tests: drivers.regulator.build: - tags: - - drivers - - regulator + tags: drivers regulator build_only: true platform_allow: - native_sim From 0250cd1c9fb33c0d9b5da883b24bdfdb7df522c2 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Mon, 19 Jun 2023 12:19:05 +0200 Subject: [PATCH 0469/2141] [nrf noup] Revert "twister: Use natural sort when generating hardware map" This reverts commit c37deeb0c4602dc3eeb700a7dc3ed317283fff17. This is only a temporary change, until we align our CI. To be removed once natsort is avaialble in the NCS CI. Signed-off-by: Robert Lubos (cherry picked from commit fdb19c59138bf98bb12e633ff1b07309f6db674a) --- scripts/pylib/twister/twisterlib/hardwaremap.py | 2 +- scripts/requirements-run-test.txt | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/pylib/twister/twisterlib/hardwaremap.py b/scripts/pylib/twister/twisterlib/hardwaremap.py index d3308b8cbe3f..5c0c5eb12385 100644 --- a/scripts/pylib/twister/twisterlib/hardwaremap.py +++ b/scripts/pylib/twister/twisterlib/hardwaremap.py @@ -386,7 +386,7 @@ def save(self, hwm_file): boot_ids = [] # use existing map - self.detected = natsorted(self.detected, key=lambda x: x.serial or '') + self.detected.sort(key=lambda x: x.serial or '') if os.path.exists(hwm_file): with open(hwm_file) as yaml_file: hwm = yaml.load(yaml_file, Loader=SafeLoader) diff --git a/scripts/requirements-run-test.txt b/scripts/requirements-run-test.txt index d3a4be916735..08ff89b0c545 100644 --- a/scripts/requirements-run-test.txt +++ b/scripts/requirements-run-test.txt @@ -7,7 +7,6 @@ pyocd>=0.35.0 # used by twister for board/hardware map tabulate -natsort # used by mcuboot cbor>=1.0.0 From 68cba0c8e64da160f49c2296ef956fe1512369d9 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Thu, 3 Mar 2022 15:28:16 +0100 Subject: [PATCH 0470/2141] [nrf noup] doc: remove Kconfig search Kconfig search is handled in a separate docset in NCS, so remove the page. This is a long-term noup patch. Signed-off-by: Gerard Marull-Paretas Signed-off-by: Krishna T (cherry picked from commit af089336598c9e0aca23ac22c7d66d140d905c7a) --- MAINTAINERS.yml | 1 - doc/build/kconfig/setting.rst | 6 ++---- doc/develop/application/index.rst | 5 ++--- doc/kconfig.rst | 8 -------- 4 files changed, 4 insertions(+), 16 deletions(-) delete mode 100644 doc/kconfig.rst diff --git a/MAINTAINERS.yml b/MAINTAINERS.yml index 3e7c3048b538..77296a734a6d 100644 --- a/MAINTAINERS.yml +++ b/MAINTAINERS.yml @@ -1041,7 +1041,6 @@ Documentation: - doc/images/Zephyr-Kite-in-tree.png - doc/index-tex.rst - doc/index.rst - - doc/kconfig.rst - doc/templates/sample.tmpl - doc/templates/board.tmpl - boards/index.rst diff --git a/doc/build/kconfig/setting.rst b/doc/build/kconfig/setting.rst index ad62d86eb3d4..6fe1feaed7d3 100644 --- a/doc/build/kconfig/setting.rst +++ b/doc/build/kconfig/setting.rst @@ -7,8 +7,7 @@ The :ref:`menuconfig and guiconfig interfaces ` can be used to test out configurations during application development. This page explains how to make settings permanent. -All Kconfig options can be searched in the :ref:`Kconfig search page -`. +All Kconfig options can be searched in the Kconfig search page. .. note:: @@ -115,8 +114,7 @@ Assignments in configuration files are only respected if the dependencies for the symbol are satisfied. A warning is printed otherwise. To figure out what the dependencies of a symbol are, use one of the :ref:`interactive configuration interfaces ` (you can jump directly to a symbol with -:kbd:`/`), or look up the symbol in the :ref:`Kconfig search page -`. +:kbd:`/`), or look up the symbol in the Kconfig search page. .. _initial-conf: diff --git a/doc/develop/application/index.rst b/doc/develop/application/index.rst index 7dc4539677ea..42d53040bd29 100644 --- a/doc/develop/application/index.rst +++ b/doc/develop/application/index.rst @@ -648,9 +648,8 @@ started. See :ref:`setting_configuration_values` for detailed documentation on setting Kconfig configuration values. The :ref:`initial-conf` section on the same page -explains how the initial configuration is derived. See :ref:`kconfig-search` -for a complete list of configuration options. -See :ref:`hardening` for security information related with Kconfig options. +explains how the initial configuration is derived. See :ref:`hardening` for +security information related with Kconfig options. The other pages in the :ref:`Kconfig section of the manual ` are also worth going through, especially if you planning to add new configuration diff --git a/doc/kconfig.rst b/doc/kconfig.rst deleted file mode 100644 index 1123de2adbd9..000000000000 --- a/doc/kconfig.rst +++ /dev/null @@ -1,8 +0,0 @@ -:orphan: - -.. _kconfig-search: - -Kconfig Search -============== - -.. kconfig:search:: From 5620a796e91d9e65c6a02d7585ca8909eb674c77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Audun=20Kvamtr=C3=B8?= Date: Thu, 13 Jan 2022 11:37:18 +0100 Subject: [PATCH 0471/2141] [nrf noup] modules: tf-m: use of PSA_HAS_XXXX_SUPPORT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -This allows configurations enabled by PSA_WANTS_ALG_XXXX to be used to control which TF-M module is enabled -If the TF-M image doesn't support e.g. the MAC APIs, then the MAC interface is not enabled Note: This functionality requires that nrf_security is enabled ref: NCSDK-11689 Make TF-M crypto module depend on PSA_WANT_GENERATE_RANDOM, same as all other crypto modules, which have PSA_HAS to group all PSA features that require the module. This makes TF-M by default exclude the RNG module when not needed. Signed-off-by: Frank Audun Kvamtrø Signed-off-by: Joakim Andersson (cherry picked from commit ff04215c23a8f32792e5b75fbc734fce9322dc14) --- modules/trusted-firmware-m/Kconfig.tfm.crypto_modules | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/modules/trusted-firmware-m/Kconfig.tfm.crypto_modules b/modules/trusted-firmware-m/Kconfig.tfm.crypto_modules index 1d70a2c44d29..02d3580c22f3 100644 --- a/modules/trusted-firmware-m/Kconfig.tfm.crypto_modules +++ b/modules/trusted-firmware-m/Kconfig.tfm.crypto_modules @@ -10,6 +10,7 @@ if TFM_PARTITION_CRYPTO config TFM_CRYPTO_RNG_MODULE_ENABLED bool "Random number generator crypto module" default y + depends on PSA_WANT_GENERATE_RANDOM && NRF_SECURITY help Enables the random number generator module within the crypto partition. Unset this option if 'psa_generate_random' is not used. @@ -17,6 +18,7 @@ config TFM_CRYPTO_RNG_MODULE_ENABLED config TFM_CRYPTO_KEY_MODULE_ENABLED bool "KEY crypto module" default y + depends on PSA_HAS_KEY_SUPPORT && NRF_SECURITY help Enables the KEY crypto module within the crypto partition. Unset this option if the functionality provided by 'crypto_key_management.c' @@ -25,6 +27,7 @@ config TFM_CRYPTO_KEY_MODULE_ENABLED config TFM_CRYPTO_AEAD_MODULE_ENABLED bool "AEAD crypto module" default y + depends on PSA_HAS_AEAD_SUPPORT && NRF_SECURITY help Enables the AEAD crypto module within the crypto partition. Unset this option if the functionality provided by 'crypto_aead.c' @@ -33,6 +36,7 @@ config TFM_CRYPTO_AEAD_MODULE_ENABLED config TFM_CRYPTO_MAC_MODULE_ENABLED bool "MAC crypto module" default y + depends on PSA_HAS_MAC_SUPPORT && NRF_SECURITY help Enables the MAC crypto module within the crypto partition. Unset this option if the functionality provided by 'crypto_mac.c' @@ -41,6 +45,7 @@ config TFM_CRYPTO_MAC_MODULE_ENABLED config TFM_CRYPTO_HASH_MODULE_ENABLED bool "HASH crypto module" default y + depends on PSA_HAS_HASH_SUPPORT && NRF_SECURITY help Enables the HASH crypto module within the crypto partition. Unset this option if the functionality provided by 'crypto_hash.c' @@ -49,6 +54,7 @@ config TFM_CRYPTO_HASH_MODULE_ENABLED config TFM_CRYPTO_CIPHER_MODULE_ENABLED bool "CIPHER crypto module" default y + depends on PSA_HAS_CIPHER_SUPPORT && NRF_SECURITY help Enables the CIPHER crypto module within the crypto partition. Unset this option if the functionality provided by 'crypto_cipher.c' @@ -57,6 +63,7 @@ config TFM_CRYPTO_CIPHER_MODULE_ENABLED config TFM_CRYPTO_ASYM_ENCRYPT_MODULE_ENABLED bool "ASYM ENCRYPT crypto module" default y + depends on PSA_HAS_ASYM_ENCRYPT_SUPPORT && NRF_SECURITY help Enables the ASYM ENCRYPT crypto module within the crypto partition. Unset this option if the encrypt functionality provided by 'crypto_asymmetric.c' @@ -65,6 +72,7 @@ config TFM_CRYPTO_ASYM_ENCRYPT_MODULE_ENABLED config TFM_CRYPTO_ASYM_SIGN_MODULE_ENABLED bool "ASYM SIGN crypto module" default y + depends on PSA_HAS_ASYM_SIGN_SUPPORT && NRF_SECURITY help Enables the ASYM SIGN crypto module within the crypto partition. Unset this option if the sign functionality provided by 'crypto_asymmetric.c' @@ -73,10 +81,12 @@ config TFM_CRYPTO_ASYM_SIGN_MODULE_ENABLED config TFM_CRYPTO_KEY_DERIVATION_MODULE_ENABLED bool "KEY DERIVATION crypto module" default y + depends on (PSA_HAS_KEY_DERIVATION || PSA_HAS_KEY_AGREEMENT) && NRF_SECURITY help Enables the KEY_DERIVATION crypto module within the crypto partition. Unset this option if the functionality provided by 'crypto_key_derivation.c' is not used. + Note that key agreement is under key derivation in the current implementation. endif # TFM_PARTITION_CRYPTO From 0556e7f7d3e2e046bb334ef2133c071179caf189 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B8e?= Date: Sat, 29 Jan 2022 13:03:08 +0100 Subject: [PATCH 0472/2141] [nrf noup] modules: mbedtls: Allow MBEDTLS_BUILTIN to be deselected MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Out-of-tree crypto subsystems need to deselect MBEDTLS_BUILTIN, but deselection is not supported. It is however supported to select a dependency in a ! expression. Signed-off-by: Sebastian Bøe (cherry picked from commit f778d9f9775be1653a3fd0e171c385effca06a69) --- modules/mbedtls/Kconfig | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/mbedtls/Kconfig b/modules/mbedtls/Kconfig index bf165473f17f..f7bc6a609f1f 100644 --- a/modules/mbedtls/Kconfig +++ b/modules/mbedtls/Kconfig @@ -29,6 +29,7 @@ choice MBEDTLS_IMPLEMENTATION config MBEDTLS_BUILTIN bool "Use Zephyr in-tree mbedTLS version" + depends on ! DISABLE_MBEDTLS_BUILTIN help Link with mbedTLS sources included with Zephyr distribution. Included mbedTLS version is well integrated with and supported @@ -42,6 +43,11 @@ config MBEDTLS_LIBRARY endchoice +# subsystems cannot deselect MBEDTLS_BUILTIN, but they can select +# DISABLE_MBEDTLS_BUILTIN. +config DISABLE_MBEDTLS_BUILTIN + bool + config CUSTOM_MBEDTLS_CFG_FILE bool "Custom mbed TLS configuration file" help From a3505ca86f9f4bb9a1d33116259bb2d7e08196db Mon Sep 17 00:00:00 2001 From: Georgios Vasilakis Date: Mon, 12 Feb 2024 14:30:23 +0100 Subject: [PATCH 0473/2141] [nrf noup] modules: mbedtls: Add include folders We moved the header files in sdk-mbedtls from the library folder to the include/library folder. This was done to avoid issues when building MbedTLS with the nrf_security module and the Oberon PSA core. The Oberon PSA core provides a subset of these header files and since they are included with quotes we cannot have them in the same directory. This change make the needed adaptions in CMake for the applications that don't use nrf_security. Signed-off-by: Georgios Vasilakis Signed-off-by: Markus Swarowsky (cherry picked from commit a73fcf0baef0d53520b39364cdaac8914b17b749) --- modules/mbedtls/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/mbedtls/CMakeLists.txt b/modules/mbedtls/CMakeLists.txt index 61c7400017da..8801e1ecdf17 100644 --- a/modules/mbedtls/CMakeLists.txt +++ b/modules/mbedtls/CMakeLists.txt @@ -40,6 +40,8 @@ zephyr_interface_library_named(mbedTLS) # Add regular includes target_include_directories(mbedTLS INTERFACE ${ZEPHYR_CURRENT_MODULE_DIR}/include + ${ZEPHYR_CURRENT_MODULE_DIR}/include/library + ${ZEPHYR_CURRENT_MODULE_DIR}/library configs include ) From a01de066f17e286537b4979a04ca69c286806bc9 Mon Sep 17 00:00:00 2001 From: Dominik Ermel Date: Thu, 13 Jul 2023 13:42:10 +0000 Subject: [PATCH 0474/2141] [nrf noup] drivers/flashdisk: Add support for Partition Manager The commits adds support for generating flash disks from Partition Manager defined partitions. Signed-off-by: Dominik Ermel (cherry picked from commit 1a14317cc84f0b67e1b482d5f300f44e72ed19ba) --- drivers/disk/flashdisk.c | 78 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/drivers/disk/flashdisk.c b/drivers/disk/flashdisk.c index 1ac3d15ba62f..4d8e3f1eee01 100644 --- a/drivers/disk/flashdisk.c +++ b/drivers/disk/flashdisk.c @@ -469,6 +469,8 @@ static const struct disk_operations flash_disk_ops = { .ioctl = disk_flash_access_ioctl, }; +#ifndef USE_PARTITION_MANAGER +/* The non-Partition manager, DTS based generators below */ #define DT_DRV_COMPAT zephyr_flash_disk #define PARTITION_PHANDLE(n) DT_PHANDLE_BY_IDX(DT_DRV_INST(n), partition, 0) @@ -510,6 +512,82 @@ DT_INST_FOREACH_STATUS_OKAY(VERIFY_CACHE_SIZE_IS_NOT_ZERO_IF_NOT_READ_ONLY) "Devicetree node " DT_NODE_PATH(DT_DRV_INST(n)) \ " has cache size which is not a multiple of its sector size"); DT_INST_FOREACH_STATUS_OKAY(VERIFY_CACHE_SIZE_IS_MULTIPLY_OF_SECTOR_SIZE) +#else /* ifndef USE_PARTITION_MANAGER */ +/* Partition Manager based generators below */ + +/* Gets the PM_..._EXTRA_PARAM_##param value */ +#define PM_FLASH_DISK_ENTRY_EXTRA_PARAM(name, param) PM_##name##_EXTRA_PARAM_disk_##param + +/* Gets the PM_..._NAME value which is originally cased, as in yaml, partition name */ +#define PM_FLASH_DISK_ENTRY_PARTITION_NAME(name) PM_##name##_NAME + +/* Generates flashdiskN_cache variable name, where N is partition ID */ +#define PM_FLASH_DISK_CACHE_VARIABLE(n) UTIL_CAT(flashdisk, UTIL_CAT(FIXED_PARTITION_ID(n), _cache)) + +/* Generate cache buffers */ +#define CACHE_SIZE(n) (COND_CODE_1(PM_FLASH_DISK_ENTRY_EXTRA_PARAM(n, read_only), (0), (1)) * \ + PM_FLASH_DISK_ENTRY_EXTRA_PARAM(n, cache_size)) +#define DEFINE_FLASHDISKS_CACHE(n) \ + static uint8_t __aligned(4) PM_FLASH_DISK_CACHE_VARIABLE(n)[CACHE_SIZE(n)]; + +PM_FOREACH_AFFILIATED_TO_disk(DEFINE_FLASHDISKS_CACHE) + +/* Generated single Flash Disk device data from Partition Manager partition. + * Partition is required to have type set to disk in partition definitions: + * type: disk + * and following extra params can be provided: + * extra_params: { + * name = "", + * cache_size = , + * sector_size = , + * read_only = + * } + * where: + * is mandatory device name that will be used by Disk Access and FAT FS to mount device; + * is cache r/w cache size, which is mandatory if read_only = 0 or not present, + * and should be multiple of ; + * is mandatory device sector size information, usually should be erase page size, + * for flash devices, for example 4096 bytes; + * read_only is optional, if not present then assumed false; can be 0(false) or 1(true). + */ +#define DEFINE_FLASHDISKS_DEVICE(n) \ +{ \ + .info = { \ + .ops = &flash_disk_ops, \ + .name = STRINGIFY(PM_FLASH_DISK_ENTRY_EXTRA_PARAM(n, name)), \ + }, \ + .area_id = FIXED_PARTITION_ID(n), \ + .offset = FIXED_PARTITION_OFFSET(n), \ + .cache = PM_FLASH_DISK_CACHE_VARIABLE(n), \ + .cache_size = sizeof(PM_FLASH_DISK_CACHE_VARIABLE(n)), \ + .size = FIXED_PARTITION_SIZE(n), \ + .sector_size = PM_FLASH_DISK_ENTRY_EXTRA_PARAM(n, sector_size), \ +}, + +/* The bellow used PM_FOREACH_TYPE_disk is generated by Partition Manager foreach + * loop macro. The lower case _disk is type name for which the macro has been generated; + * partition entry can have multiple types set and foreach macro will be generated + * for every type found across partition definitions. + */ +static struct flashdisk_data flash_disks[] = { + PM_FOREACH_AFFILIATED_TO_disk(DEFINE_FLASHDISKS_DEVICE) +}; + +#define VERIFY_CACHE_SIZE_IS_NOT_ZERO_IF_NOT_READ_ONLY(n) \ + COND_CODE_1(PM_FLASH_DISK_ENTRY_EXTRA_PARAM(n, read_only), \ + (/* cache-size is not used for read-only disks */), \ + (BUILD_ASSERT(PM_FLASH_DISK_ENTRY_EXTRA_PARAM(n, cache_size) != 0, \ + "Flash disk partition " STRINGIFY(PM_FLASH_DISK_ENTRY_PARTITION_NAME(n))\ + " must have non-zero cache-size");)) +PM_FOREACH_AFFILIATED_TO_disk(VERIFY_CACHE_SIZE_IS_NOT_ZERO_IF_NOT_READ_ONLY) + +#define VERIFY_CACHE_SIZE_IS_MULTIPLY_OF_SECTOR_SIZE(n) \ + BUILD_ASSERT(PM_FLASH_DISK_ENTRY_EXTRA_PARAM(n, cache_size) % \ + PM_FLASH_DISK_ENTRY_EXTRA_PARAM(n, sector_size) == 0, \ + "Devicetree node " STRINGIFY(PM_FLASH_DISK_ENTRY_PARTITION_NAME(n)) \ + " has cache size which is not a multiple of its sector size"); +PM_FOREACH_AFFILIATED_TO_disk(VERIFY_CACHE_SIZE_IS_MULTIPLY_OF_SECTOR_SIZE) +#endif /* USE_PARTITION_MANAGER */ static int disk_flash_init(void) { From 6b04ceee078c40901b3ddd15e821fde8333d5f5c Mon Sep 17 00:00:00 2001 From: Marek Pieta Date: Fri, 5 May 2023 11:12:26 +0200 Subject: [PATCH 0475/2141] [nrf noup] mcumgr: img_mgmt: Fix check for chosen code partition The "zephyr-code-partition" chosen DTS node cannot be used when build uses Partition Manager. In that case, mcumgr must rely on the definitions provided by the Partition Manager. Jira: NCSDK-21381 Signed-off-by: Marek Pieta Signed-off-by: Dominik Ermel (cherry picked from commit e1f0f172e3cc7c1a6efcad83a998a5dd24daa81e) --- subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c index 035a765798ee..d0303360f691 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c @@ -43,6 +43,23 @@ #if !defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_RAM_LOAD) +#if USE_PARTITION_MANAGER +#include + +#ifdef PM_MCUBOOT_SECONDARY_PAD_SIZE +BUILD_ASSERT(PM_MCUBOOT_PAD_SIZE == PM_MCUBOOT_SECONDARY_PAD_SIZE); +#endif + +#if CONFIG_BUILD_WITH_TFM + #define PM_ADDRESS_OFFSET (PM_MCUBOOT_PAD_SIZE + PM_TFM_SIZE) +#else + #define PM_ADDRESS_OFFSET (PM_MCUBOOT_PAD_SIZE) +#endif + +#define FIXED_PARTITION_IS_RUNNING_APP_PARTITION(label) \ + (FIXED_PARTITION_OFFSET(label) == (PM_ADDRESS - PM_ADDRESS_OFFSET)) + +#else /* ! USE_PARTITION_MANAGER */ #ifndef CONFIG_FLASH_LOAD_OFFSET #error MCUmgr requires application to be built with CONFIG_FLASH_LOAD_OFFSET set \ to be able to figure out application running slot. @@ -50,6 +67,7 @@ #define FIXED_PARTITION_IS_RUNNING_APP_PARTITION(label) \ (FIXED_PARTITION_OFFSET(label) == CONFIG_FLASH_LOAD_OFFSET) +#endif /* USE_PARTITION_MANAGER */ BUILD_ASSERT(sizeof(struct image_header) == IMAGE_HEADER_SIZE, "struct image_header not required size"); From c82b5f3d3859c3aa32c1157bd4225a2186a47856 Mon Sep 17 00:00:00 2001 From: Dominik Ermel Date: Thu, 23 Jun 2022 14:10:01 +0000 Subject: [PATCH 0476/2141] [nrf noup] mgmt/mcumgr: Bootutil hooks to handle image-1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The commit adds bootutil hook, for nrf5340, to allow it handling the non-accessible image-1/primary slot. Signed-off-by: Andrzej Głąbek Signed-off-by: Vinayak Kariappa Chettimada Signed-off-by: Johann Fischer Signed-off-by: Dominik Ermel Signed-off-by: Jamie McCrae (cherry picked from commit 410e44f59d3d2ec15608f0b40c7bf09a57082a62) --- subsys/mgmt/mcumgr/CMakeLists.txt | 8 +++++ subsys/mgmt/mcumgr/Kconfig | 1 + .../mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c | 35 +++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c diff --git a/subsys/mgmt/mcumgr/CMakeLists.txt b/subsys/mgmt/mcumgr/CMakeLists.txt index 39d4a4ca8ce0..ad088eca0677 100644 --- a/subsys/mgmt/mcumgr/CMakeLists.txt +++ b/subsys/mgmt/mcumgr/CMakeLists.txt @@ -16,3 +16,11 @@ add_subdirectory(transport) add_subdirectory_ifdef(CONFIG_SMP_CLIENT smp_client) zephyr_library_link_libraries(mgmt_mcumgr) + +if (CONFIG_BOOT_IMAGE_ACCESS_HOOKS) + zephyr_include_directories( + ${ZEPHYR_MCUBOOT_MODULE_DIR}/boot/bootutil/include + ${ZEPHYR_MCUBOOT_MODULE_DIR}/boot/zephyr/include + ) + zephyr_library_sources(bootutil_hooks/nrf53_hooks.c) +endif() diff --git a/subsys/mgmt/mcumgr/Kconfig b/subsys/mgmt/mcumgr/Kconfig index 49bd17f46691..1c6a3a2a5162 100644 --- a/subsys/mgmt/mcumgr/Kconfig +++ b/subsys/mgmt/mcumgr/Kconfig @@ -6,6 +6,7 @@ menuconfig MCUMGR bool "mcumgr Support" depends on NET_BUF depends on ZCBOR + imply BOOT_IMAGE_ACCESS_HOOKS if (SOC_NRF5340_CPUAPP_QKAA && MCUMGR_GRP_IMG) help This option enables the mcumgr management library. diff --git a/subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c b/subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c new file mode 100644 index 000000000000..f1ac8a168e65 --- /dev/null +++ b/subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2022 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include "bootutil/bootutil_public.h" + +#if CONFIG_MCUBOOT_NETWORK_CORE_IMAGE_NUMBER != -1 +/* Sysbuild */ +#define NET_CORE_IMAGE CONFIG_MCUBOOT_NETWORK_CORE_IMAGE_NUMBER +#else +/* Legacy child/parent */ +#define NET_CORE_IMAGE 1 +#endif + +int boot_read_swap_state_primary_slot_hook(int image_index, + struct boot_swap_state *state) +{ + if (image_index == NET_CORE_IMAGE) { + /* Pretend that primary slot of image 1 unpopulated */ + state->magic = BOOT_MAGIC_UNSET; + state->swap_type = BOOT_SWAP_TYPE_NONE; + state->image_num = image_index; + state->copy_done = BOOT_FLAG_UNSET; + state->image_ok = BOOT_FLAG_UNSET; + + /* Prevent bootutil from trying to obtain true info */ + return 0; + } + + return BOOT_HOOK_REGULAR; +} From 757558096a07cc71ee4afc0f6aebe766bbb61d01 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Mon, 16 Oct 2023 08:40:38 +0100 Subject: [PATCH 0477/2141] [nrf noup] samples: bluetooth: hci_pow_ctrl: Migrate child image config Migrates child image configuration for this sample over to sysbuild Signed-off-by: Jamie McCrae (cherry picked from commit 30e3e3201e4957c50d4e4b56bb485e0dfae78d28) --- samples/bluetooth/hci_pwr_ctrl/sysbuild/hci_rpmsg.conf | 1 + 1 file changed, 1 insertion(+) create mode 100644 samples/bluetooth/hci_pwr_ctrl/sysbuild/hci_rpmsg.conf diff --git a/samples/bluetooth/hci_pwr_ctrl/sysbuild/hci_rpmsg.conf b/samples/bluetooth/hci_pwr_ctrl/sysbuild/hci_rpmsg.conf new file mode 100644 index 000000000000..e6749ae63990 --- /dev/null +++ b/samples/bluetooth/hci_pwr_ctrl/sysbuild/hci_rpmsg.conf @@ -0,0 +1 @@ +CONFIG_BT_CTLR_TX_PWR_DYNAMIC_CONTROL=y From cda7620299116bde3df5639d50b9c1b9169ee1e3 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Mon, 16 Oct 2023 08:41:27 +0100 Subject: [PATCH 0478/2141] [nrf noup] samples: mgmt: mcumgr smp_svr: Migrate child image config Migrates child image configuration for this sample over to sysbuild Signed-off-by: Jamie McCrae (cherry picked from commit 97bbc7546ec53a8b9febb6631f75587550d9b020) --- .../subsys/mgmt/mcumgr/smp_svr/sysbuild/hci_rpmsg.conf | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 samples/subsys/mgmt/mcumgr/smp_svr/sysbuild/hci_rpmsg.conf diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/sysbuild/hci_rpmsg.conf b/samples/subsys/mgmt/mcumgr/smp_svr/sysbuild/hci_rpmsg.conf new file mode 100644 index 000000000000..98260877332f --- /dev/null +++ b/samples/subsys/mgmt/mcumgr/smp_svr/sysbuild/hci_rpmsg.conf @@ -0,0 +1,10 @@ +# +# Copyright (c) 2022 Nordic Semiconductor +# +# SPDX-License-Identifier: Apache-2.0 +# + +CONFIG_BT_MAX_CONN=2 +CONFIG_BT_BUF_ACL_RX_SIZE=502 +CONFIG_BT_BUF_ACL_TX_SIZE=502 +CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 From a6e6112a4c064a3d280153bc8644236153105c0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Thu, 1 Dec 2022 14:41:13 +0100 Subject: [PATCH 0479/2141] [nrf noup] samples&tests: Restore a few CONFIG_NEWLIB_LIBC_NANO=n MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a follow-up to commit 9dd570f8a2207a02c886480b0065cd5a0e3a2e94. Since in NCS, unlike in vanilla Zephyr, the nano variant of newlib is the default one, restore entries that disable the nano variant in one sample and one test that require the full newlib variant. This patch is supposed to be removed when picolibc becomes the default. Signed-off-by: Andrzej Głąbek Signed-off-by: Dominik Ermel (cherry picked from commit 41c5668ecb5038ab6f8a689f549615f232377086) --- tests/lib/newlib/heap_listener/prj.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/lib/newlib/heap_listener/prj.conf b/tests/lib/newlib/heap_listener/prj.conf index e5a5dc6df4c1..7282777ff1ca 100644 --- a/tests/lib/newlib/heap_listener/prj.conf +++ b/tests/lib/newlib/heap_listener/prj.conf @@ -1,3 +1,4 @@ CONFIG_ZTEST=y CONFIG_NEWLIB_LIBC=y +CONFIG_NEWLIB_LIBC_NANO=n CONFIG_NEWLIB_LIBC_HEAP_LISTENER=y From d1cb7a90e291f4b336ff4729bc5fa7923f228df5 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Fri, 15 Dec 2023 07:57:14 +0000 Subject: [PATCH 0480/2141] [nrf noup] samples/tests: Disable PM for some sysbuild builds Disables partition manager when building some samples and tests which use sysbuild to prevent build issues Signed-off-by: Jamie McCrae (cherry picked from commit a2bc55ae210e7c6cca4ad781e1999d7538bf48b4) --- samples/boards/nordic/nrf53_sync_rtc/sysbuild.conf | 1 + samples/drivers/mbox/sysbuild.conf | 1 + samples/subsys/ipc/ipc_service/icmsg/sysbuild.conf | 1 + samples/subsys/ipc/ipc_service/multi_endpoint/sysbuild.conf | 1 + samples/subsys/ipc/ipc_service/static_vrings/sysbuild.conf | 1 + samples/subsys/logging/multidomain/sysbuild.conf | 1 + tests/boot/mcuboot_recovery_retention/sysbuild.conf | 1 + tests/boot/test_mcuboot/sysbuild.conf | 1 + tests/drivers/flash/common/sysbuild.conf | 1 + tests/drivers/flash/negative_tests/sysbuild.conf | 1 + tests/subsys/fs/fcb/sysbuild.conf | 1 + tests/subsys/fs/littlefs/sysbuild.conf | 1 + 12 files changed, 12 insertions(+) create mode 100644 samples/boards/nordic/nrf53_sync_rtc/sysbuild.conf create mode 100644 samples/drivers/mbox/sysbuild.conf create mode 100644 samples/subsys/ipc/ipc_service/icmsg/sysbuild.conf create mode 100644 samples/subsys/ipc/ipc_service/multi_endpoint/sysbuild.conf create mode 100644 samples/subsys/ipc/ipc_service/static_vrings/sysbuild.conf create mode 100644 samples/subsys/logging/multidomain/sysbuild.conf create mode 100644 tests/drivers/flash/common/sysbuild.conf create mode 100644 tests/drivers/flash/negative_tests/sysbuild.conf create mode 100644 tests/subsys/fs/fcb/sysbuild.conf create mode 100644 tests/subsys/fs/littlefs/sysbuild.conf diff --git a/samples/boards/nordic/nrf53_sync_rtc/sysbuild.conf b/samples/boards/nordic/nrf53_sync_rtc/sysbuild.conf new file mode 100644 index 000000000000..6408669a8474 --- /dev/null +++ b/samples/boards/nordic/nrf53_sync_rtc/sysbuild.conf @@ -0,0 +1 @@ +SB_CONFIG_PARTITION_MANAGER=n diff --git a/samples/drivers/mbox/sysbuild.conf b/samples/drivers/mbox/sysbuild.conf new file mode 100644 index 000000000000..6408669a8474 --- /dev/null +++ b/samples/drivers/mbox/sysbuild.conf @@ -0,0 +1 @@ +SB_CONFIG_PARTITION_MANAGER=n diff --git a/samples/subsys/ipc/ipc_service/icmsg/sysbuild.conf b/samples/subsys/ipc/ipc_service/icmsg/sysbuild.conf new file mode 100644 index 000000000000..6408669a8474 --- /dev/null +++ b/samples/subsys/ipc/ipc_service/icmsg/sysbuild.conf @@ -0,0 +1 @@ +SB_CONFIG_PARTITION_MANAGER=n diff --git a/samples/subsys/ipc/ipc_service/multi_endpoint/sysbuild.conf b/samples/subsys/ipc/ipc_service/multi_endpoint/sysbuild.conf new file mode 100644 index 000000000000..6408669a8474 --- /dev/null +++ b/samples/subsys/ipc/ipc_service/multi_endpoint/sysbuild.conf @@ -0,0 +1 @@ +SB_CONFIG_PARTITION_MANAGER=n diff --git a/samples/subsys/ipc/ipc_service/static_vrings/sysbuild.conf b/samples/subsys/ipc/ipc_service/static_vrings/sysbuild.conf new file mode 100644 index 000000000000..6408669a8474 --- /dev/null +++ b/samples/subsys/ipc/ipc_service/static_vrings/sysbuild.conf @@ -0,0 +1 @@ +SB_CONFIG_PARTITION_MANAGER=n diff --git a/samples/subsys/logging/multidomain/sysbuild.conf b/samples/subsys/logging/multidomain/sysbuild.conf new file mode 100644 index 000000000000..6408669a8474 --- /dev/null +++ b/samples/subsys/logging/multidomain/sysbuild.conf @@ -0,0 +1 @@ +SB_CONFIG_PARTITION_MANAGER=n diff --git a/tests/boot/mcuboot_recovery_retention/sysbuild.conf b/tests/boot/mcuboot_recovery_retention/sysbuild.conf index 47f00ff3cff8..3b5b3c963800 100644 --- a/tests/boot/mcuboot_recovery_retention/sysbuild.conf +++ b/tests/boot/mcuboot_recovery_retention/sysbuild.conf @@ -1 +1,2 @@ SB_CONFIG_BOOTLOADER_MCUBOOT=y +SB_CONFIG_PARTITION_MANAGER=n diff --git a/tests/boot/test_mcuboot/sysbuild.conf b/tests/boot/test_mcuboot/sysbuild.conf index 47f00ff3cff8..3b5b3c963800 100644 --- a/tests/boot/test_mcuboot/sysbuild.conf +++ b/tests/boot/test_mcuboot/sysbuild.conf @@ -1 +1,2 @@ SB_CONFIG_BOOTLOADER_MCUBOOT=y +SB_CONFIG_PARTITION_MANAGER=n diff --git a/tests/drivers/flash/common/sysbuild.conf b/tests/drivers/flash/common/sysbuild.conf new file mode 100644 index 000000000000..6408669a8474 --- /dev/null +++ b/tests/drivers/flash/common/sysbuild.conf @@ -0,0 +1 @@ +SB_CONFIG_PARTITION_MANAGER=n diff --git a/tests/drivers/flash/negative_tests/sysbuild.conf b/tests/drivers/flash/negative_tests/sysbuild.conf new file mode 100644 index 000000000000..6408669a8474 --- /dev/null +++ b/tests/drivers/flash/negative_tests/sysbuild.conf @@ -0,0 +1 @@ +SB_CONFIG_PARTITION_MANAGER=n diff --git a/tests/subsys/fs/fcb/sysbuild.conf b/tests/subsys/fs/fcb/sysbuild.conf new file mode 100644 index 000000000000..6408669a8474 --- /dev/null +++ b/tests/subsys/fs/fcb/sysbuild.conf @@ -0,0 +1 @@ +SB_CONFIG_PARTITION_MANAGER=n diff --git a/tests/subsys/fs/littlefs/sysbuild.conf b/tests/subsys/fs/littlefs/sysbuild.conf new file mode 100644 index 000000000000..6408669a8474 --- /dev/null +++ b/tests/subsys/fs/littlefs/sysbuild.conf @@ -0,0 +1 @@ +SB_CONFIG_PARTITION_MANAGER=n From 821fa521c423a67c7ac013a36345241f7841e4a8 Mon Sep 17 00:00:00 2001 From: Markus Swarowsky Date: Thu, 29 Feb 2024 13:38:48 +0100 Subject: [PATCH 0481/2141] [nrf noup] modules: tfm: Add Kconfig for CRYPTO_PAKE_MODULE_ENABLED Add a Kconfig for th TFM_CRYPTO_PAKE_MODULE_ENABLED to support the PAKE APIs. noup as the PAKE support including the PAKE module doesn't exist yet in upstream TF-M as they depend on mbed TLS support for it Ref: NCSDK-22416 Signed-off-by: Markus Swarowsky (cherry picked from commit 8907bee085bef96a12d3510f06b373ce41154a81) --- modules/trusted-firmware-m/Kconfig.tfm.crypto_modules | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/modules/trusted-firmware-m/Kconfig.tfm.crypto_modules b/modules/trusted-firmware-m/Kconfig.tfm.crypto_modules index 02d3580c22f3..9604319ca012 100644 --- a/modules/trusted-firmware-m/Kconfig.tfm.crypto_modules +++ b/modules/trusted-firmware-m/Kconfig.tfm.crypto_modules @@ -88,6 +88,17 @@ config TFM_CRYPTO_KEY_DERIVATION_MODULE_ENABLED is not used. Note that key agreement is under key derivation in the current implementation. +config TFM_CRYPTO_PAKE_MODULE_ENABLED + bool "PAKE crypto module" + default y + depends on PSA_HAS_PAKE_SUPPORT + depends on NRF_SECURITY + depends on PSA_CRYPTO_DRIVER_OBERON || PSA_CRYPTO_DRIVER_CRACEN + help + Enables the PAKE crypto module within the crypto partition. + Unset this option if the functionality provided by 'crypto_pake.c' + is not used. + endif # TFM_PARTITION_CRYPTO endif # BUILD_WITH_TFM From 71c24b8a084e7ae6290b678ce2e4418d75720a39 Mon Sep 17 00:00:00 2001 From: Aleksandr Khromykh Date: Tue, 7 Feb 2023 12:39:12 +0100 Subject: [PATCH 0482/2141] [nrf noup] Bluetooth: Mesh: zero randomization for friend's adv Friend's replies on LPN's polls do not assume randomization in advertiser. Zero randomization will help to optimize time when LPN keeps receiving window open and save power. Signed-off-by: Aleksandr Khromykh Signed-off-by: Olivier Lesage (cherry picked from commit 896f7737e7c046dc6a8a1502c41179002db9462e) --- subsys/bluetooth/mesh/Kconfig | 2 +- subsys/bluetooth/mesh/adv_ext.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index e51ad2ccac0e..cd3d46190971 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -1705,7 +1705,7 @@ config BT_MESH_LPN_INIT_POLL_TIMEOUT config BT_MESH_LPN_SCAN_LATENCY int "Latency for enabling scanning" range 0 50 - default 15 + default 2 help Latency in milliseconds that it takes to enable scanning. This is in practice how much time in advance before the Receive Window diff --git a/subsys/bluetooth/mesh/adv_ext.c b/subsys/bluetooth/mesh/adv_ext.c index b056f74a5876..7caff2f91d2b 100644 --- a/subsys/bluetooth/mesh/adv_ext.c +++ b/subsys/bluetooth/mesh/adv_ext.c @@ -13,6 +13,9 @@ #include #include #include +#if defined(CONFIG_BT_LL_SOFTDEVICE) +#include +#endif #include "common/bt_str.h" @@ -149,6 +152,28 @@ static inline struct bt_mesh_ext_adv *gatt_adv_get(void) } } +static int set_adv_randomness(uint8_t handle, int rand_us) +{ +#if defined(CONFIG_BT_LL_SOFTDEVICE) + struct net_buf *buf; + sdc_hci_cmd_vs_set_adv_randomness_t *cmd_params; + + buf = bt_hci_cmd_alloc(K_FOREVER); + if (!buf) { + LOG_ERR("Could not allocate command buffer"); + return -ENOMEM; + } + + cmd_params = net_buf_add(buf, sizeof(*cmd_params)); + cmd_params->adv_handle = handle; + cmd_params->rand_us = rand_us; + + return bt_hci_cmd_send_sync(SDC_HCI_OPCODE_CMD_VS_SET_ADV_RANDOMNESS, buf, NULL); +#else + return 0; +#endif /* defined(CONFIG_BT_LL_SOFTDEVICE) */ +} + static int adv_start(struct bt_mesh_ext_adv *ext_adv, const struct bt_le_adv_param *param, struct bt_le_ext_adv_start_param *start, @@ -542,6 +567,13 @@ int bt_mesh_adv_enable(void) if (err) { return err; } + + if (IS_ENABLED(CONFIG_BT_LL_SOFTDEVICE) && adv->tag & BT_MESH_FRIEND_ADV) { + err = set_adv_randomness(adv->instance->handle, 0); + if (err) { + LOG_ERR("Failed to set zero randomness: %d", err); + } + } } return 0; From 43189afa7eec1ea93bd83e7c7fb2284779723402 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20Storr=C3=B8?= Date: Wed, 8 Mar 2023 12:17:09 +0100 Subject: [PATCH 0483/2141] [nrf noup] Bluetooth: Mesh: Fix adv randomness bug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes issue where randomness can be removed for advertising sets that have to handle other adv types than the BT_MESH_FRIEND_ADV tag type. Signed-off-by: Anders Storrø Signed-off-by: Aleksandr Khromykh Signed-off-by: Dominik Ermel (cherry picked from commit 5dd031d43e2d6f865f73aff53127b20759d345c7) --- subsys/bluetooth/mesh/adv_ext.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/subsys/bluetooth/mesh/adv_ext.c b/subsys/bluetooth/mesh/adv_ext.c index 7caff2f91d2b..0e6f6120f73f 100644 --- a/subsys/bluetooth/mesh/adv_ext.c +++ b/subsys/bluetooth/mesh/adv_ext.c @@ -568,8 +568,10 @@ int bt_mesh_adv_enable(void) return err; } - if (IS_ENABLED(CONFIG_BT_LL_SOFTDEVICE) && adv->tag & BT_MESH_FRIEND_ADV) { - err = set_adv_randomness(adv->instance->handle, 0); + if (IS_ENABLED(CONFIG_BT_LL_SOFTDEVICE) && + IS_ENABLED(CONFIG_BT_MESH_ADV_EXT_FRIEND_SEPARATE) && + advs[i].tags == BT_MESH_ADV_TAG_BIT_FRIEND) { + err = set_adv_randomness(advs[i].instance->handle, 0); if (err) { LOG_ERR("Failed to set zero randomness: %d", err); } From b24d5100b9a635d4bb2bc2e041b5fdbc0ad452a0 Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Thu, 28 Mar 2024 15:04:41 +0100 Subject: [PATCH 0484/2141] [nrf noup] dfu/boot/mcuboot: fix confirmation in case of USE_PARTITION_MANAGER Active partition ID need to be extracted basing on PARTITION_MANAGER products. ref.:NCSDK-26693 Signed-off-by: Andrzej Puzdrowski Signed-off-by: Jamie McCrae (cherry picked from commit a6e4092bd9d38f7416f4387c446ac77da3a8a9d8) --- subsys/dfu/boot/mcuboot.c | 44 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/subsys/dfu/boot/mcuboot.c b/subsys/dfu/boot/mcuboot.c index 5683d23a87ad..2984efe0906c 100644 --- a/subsys/dfu/boot/mcuboot.c +++ b/subsys/dfu/boot/mcuboot.c @@ -49,6 +49,48 @@ enum IMAGE_INDEXES { IMAGE_INDEX_2 }; +#if USE_PARTITION_MANAGER +#include + +#if CONFIG_MCUBOOT_APPLICATION_IMAGE_NUMBER != -1 +/* Sysbuild */ +#ifdef CONFIG_MCUBOOT +/* lib is part of MCUboot -> operate on the primary application slot */ +#define ACTIVE_SLOT_FLASH_AREA_ID PM_MCUBOOT_PRIMARY_ID +#else +/* TODO: Add firmware loader support */ +/* lib is part of the app -> operate on active slot */ +#if defined(CONFIG_NCS_IS_VARIANT_IMAGE) +#define ACTIVE_SLOT_FLASH_AREA_ID PM_MCUBOOT_SECONDARY_ID +#else +#define ACTIVE_SLOT_FLASH_AREA_ID PM_MCUBOOT_PRIMARY_ID +#endif +#endif /* CONFIG_MCUBOOT */ +#else +/* Legacy child/parent */ +#if CONFIG_BUILD_WITH_TFM + #define PM_ADDRESS_OFFSET (PM_MCUBOOT_PAD_SIZE + PM_TFM_SIZE) +#else + #define PM_ADDRESS_OFFSET (PM_MCUBOOT_PAD_SIZE) +#endif + +#ifdef CONFIG_MCUBOOT + /* lib is part of MCUboot -> operate on the primary application slot */ + #define ACTIVE_SLOT_FLASH_AREA_ID PM_MCUBOOT_PRIMARY_ID +#else + /* lib is part of the App -> operate on active slot */ +#if (PM_ADDRESS - PM_ADDRESS_OFFSET) == PM_MCUBOOT_PRIMARY_ADDRESS + #define ACTIVE_SLOT_FLASH_AREA_ID PM_MCUBOOT_PRIMARY_ID +#elif (PM_ADDRESS - PM_ADDRESS_OFFSET) == PM_MCUBOOT_SECONDARY_ADDRESS + #define ACTIVE_SLOT_FLASH_AREA_ID PM_MCUBOOT_SECONDARY_ID +#else + #error Missing partition definitions. +#endif +#endif /* CONFIG_MCUBOOT */ +#endif /* CONFIG_MCUBOOT_APPLICATION_IMAGE_NUMBER != -1 */ + +#else + #if defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_RAM_LOAD) /* For RAM LOAD mode, the active image must be fetched from the bootloader */ #define ACTIVE_SLOT_FLASH_AREA_ID boot_fetch_active_slot() @@ -58,6 +100,8 @@ enum IMAGE_INDEXES { #define ACTIVE_SLOT_FLASH_AREA_ID DT_FIXED_PARTITION_ID(DT_CHOSEN(zephyr_code_partition)) #endif +#endif /* USE_PARTITION_MANAGER */ + /* * Raw (on-flash) representation of the v1 image header. */ From c289b579cd65da72777519d2305d1c7cf46ad609 Mon Sep 17 00:00:00 2001 From: Sigurd Hellesvik Date: Tue, 26 Mar 2024 16:35:05 +0100 Subject: [PATCH 0485/2141] [nrf noup] modules: mbedtls: Use help for DISABLE_MBEDTLS_BUILTIN info Using a comment to explain Kconfig options make them invisible to Kconfig search. Use help instead. Signed-off-by: Sigurd Hellesvik (cherry picked from commit eac8bb33f83a061f2089255874a93fd82d1789d1) --- modules/mbedtls/Kconfig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/mbedtls/Kconfig b/modules/mbedtls/Kconfig index f7bc6a609f1f..aa8c479e89f7 100644 --- a/modules/mbedtls/Kconfig +++ b/modules/mbedtls/Kconfig @@ -43,10 +43,11 @@ config MBEDTLS_LIBRARY endchoice -# subsystems cannot deselect MBEDTLS_BUILTIN, but they can select -# DISABLE_MBEDTLS_BUILTIN. config DISABLE_MBEDTLS_BUILTIN bool + help + Subsystems cannot deselect MBEDTLS_BUILTIN, but they can select + DISABLE_MBEDTLS_BUILTIN. config CUSTOM_MBEDTLS_CFG_FILE bool "Custom mbed TLS configuration file" From 73df5dd6bcae4ee554efb1eb475a7f17d6f6b9d4 Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Wed, 10 Apr 2024 16:21:40 +0200 Subject: [PATCH 0486/2141] [nrf noup] sample/**/smp_svr: nrf54l15pdk external memory dts overlay Added overlay with m25r64 on-DK memory selecton. This aim to support testing DFU with secondary partition moved to the external flash. Signed-off-by: Andrzej Puzdrowski (cherry picked from commit e5a3c321771ecc8a901bcbff438737a06407357b) --- .../boards/nrf54l15pdk_nrf54l15_cpuapp_ext_flash.overlay | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 samples/subsys/mgmt/mcumgr/smp_svr/boards/nrf54l15pdk_nrf54l15_cpuapp_ext_flash.overlay diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/boards/nrf54l15pdk_nrf54l15_cpuapp_ext_flash.overlay b/samples/subsys/mgmt/mcumgr/smp_svr/boards/nrf54l15pdk_nrf54l15_cpuapp_ext_flash.overlay new file mode 100644 index 000000000000..410388bfa6d3 --- /dev/null +++ b/samples/subsys/mgmt/mcumgr/smp_svr/boards/nrf54l15pdk_nrf54l15_cpuapp_ext_flash.overlay @@ -0,0 +1,9 @@ +/ { + chosen { + nordic,pm-ext-flash = &mx25r64; + }; +}; + +&mx25r64 { + status = "okay"; +}; From 8cb54eb26cbce8c31af83154d863dd72bca036a4 Mon Sep 17 00:00:00 2001 From: Dominik Ermel Date: Wed, 27 Sep 2023 09:41:10 +0000 Subject: [PATCH 0487/2141] [nrf noup] test: schedule_api: Use Minimal C library There is no point to use PICOLIB here as it bloats the tests. Signed-off-by: Dominik Ermel (cherry picked from commit cbdf3c203fd490636e1e34ef134da580d5a42c9b) --- tests/kernel/pipe/deprecated/pipe_api/prj.conf | 1 + tests/kernel/sched/schedule_api/prj.conf | 1 + tests/kernel/sched/schedule_api/prj_multiq.conf | 1 + 3 files changed, 3 insertions(+) diff --git a/tests/kernel/pipe/deprecated/pipe_api/prj.conf b/tests/kernel/pipe/deprecated/pipe_api/prj.conf index 02d8fd3dd565..df3270adfdf8 100644 --- a/tests/kernel/pipe/deprecated/pipe_api/prj.conf +++ b/tests/kernel/pipe/deprecated/pipe_api/prj.conf @@ -6,3 +6,4 @@ CONFIG_MP_MAX_NUM_CPUS=1 CONFIG_ZTEST_FATAL_HOOK=y CONFIG_PIPES=y CONFIG_DEPRECATION_TEST=y +CONFIG_MINIMAL_LIBC=y diff --git a/tests/kernel/sched/schedule_api/prj.conf b/tests/kernel/sched/schedule_api/prj.conf index a5ceef694331..8b649a3b7fca 100644 --- a/tests/kernel/sched/schedule_api/prj.conf +++ b/tests/kernel/sched/schedule_api/prj.conf @@ -7,3 +7,4 @@ CONFIG_MAX_THREAD_BYTES=6 CONFIG_TEST_USERSPACE=y CONFIG_MP_MAX_NUM_CPUS=1 CONFIG_ZTEST_FATAL_HOOK=y +CONFIG_MINIMAL_LIBC=y diff --git a/tests/kernel/sched/schedule_api/prj_multiq.conf b/tests/kernel/sched/schedule_api/prj_multiq.conf index c8dd4bf786bc..84c9d80ac619 100644 --- a/tests/kernel/sched/schedule_api/prj_multiq.conf +++ b/tests/kernel/sched/schedule_api/prj_multiq.conf @@ -7,3 +7,4 @@ CONFIG_MP_MAX_NUM_CPUS=1 CONFIG_ZTEST_FATAL_HOOK=y CONFIG_NUM_COOP_PRIORITIES=30 CONFIG_NUM_PREEMPT_PRIORITIES=40 +CONFIG_MINIMAL_LIBC=y From e15a1164f1ce13a1b67291fdc880e31d8cf63abd Mon Sep 17 00:00:00 2001 From: Jan Tore Guggedal Date: Mon, 18 May 2020 20:50:13 +0200 Subject: [PATCH 0488/2141] [nrf noup] net: mqtt: Provide option to enable TLS session caching Provides an option to enable TLS session caching for an MQTT client's secure socket. Signed-off-by: Jan Tore Guggedal Signed-off-by: Robert Lubos Signed-off-by: Dominik Ermel Signed-off-by: Johann Fischer (cherry picked from commit 10800b0c1cc4d621e5cbc787ffebd891b81c2141) --- include/zephyr/net/mqtt.h | 3 +++ subsys/net/lib/mqtt/mqtt_transport_socket_tls.c | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/include/zephyr/net/mqtt.h b/include/zephyr/net/mqtt.h index b992714afd32..d63cc1316249 100644 --- a/include/zephyr/net/mqtt.h +++ b/include/zephyr/net/mqtt.h @@ -763,6 +763,9 @@ struct mqtt_sec_config { uint32_t alpn_protocol_name_count; #endif + /** Indicates the preference for enabling TLS session caching. */ + int session_cache; + /** Peer hostname for ceritificate verification. * May be NULL to skip hostname verification. */ diff --git a/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c b/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c index 2ff337eef343..68a101e6c846 100644 --- a/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c +++ b/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c @@ -109,6 +109,16 @@ int mqtt_client_tls_connect(struct mqtt_client *client) } } + if (tls_config->session_cache == TLS_SESSION_CACHE_ENABLED) { + ret = zsock_setsockopt(client->transport.tls.sock, SOL_TLS, + TLS_SESSION_CACHE, + &tls_config->session_cache, + sizeof(tls_config->session_cache)); + if (ret < 0) { + goto error; + } + } + if (tls_config->cert_nocopy != TLS_CERT_NOCOPY_NONE) { ret = zsock_setsockopt(client->transport.tls.sock, SOL_TLS, TLS_CERT_NOCOPY, &tls_config->cert_nocopy, From 3fbd1c5c3c5217423087ea1075acc4b5b79ac330 Mon Sep 17 00:00:00 2001 From: Mirko Covizzi Date: Thu, 10 Mar 2022 00:25:50 -0800 Subject: [PATCH 0489/2141] [nrf noup] net: mqtt: add native TLS support This commit adds an extra parameter in the configuration structure to configure native TLS support at runtime. Signed-off-by: Mirko Covizzi (cherry picked from commit 98c267767246171abb321cae20a5762716b3b77b) --- doc/connectivity/networking/api/mqtt.rst | 3 +++ include/zephyr/net/mqtt.h | 3 +++ subsys/net/lib/mqtt/mqtt_transport_socket_tls.c | 7 ++++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/doc/connectivity/networking/api/mqtt.rst b/doc/connectivity/networking/api/mqtt.rst index 9a167ffe665a..3d222d53816a 100644 --- a/doc/connectivity/networking/api/mqtt.rst +++ b/doc/connectivity/networking/api/mqtt.rst @@ -150,6 +150,7 @@ additional configuration information: tls_config->sec_tag_list = m_sec_tags; tls_config->sec_tag_count = ARRAY_SIZE(m_sec_tags); tls_config->hostname = MQTT_BROKER_HOSTNAME; + tls_config->set_native_tls = true; In this sample code, the ``m_sec_tags`` array holds a list of tags, referencing TLS credentials that the MQTT library should use for authentication. We do not specify @@ -162,6 +163,8 @@ Note, that TLS credentials referenced by the ``m_sec_tags`` array must be registered in the system first. For more information on how to do that, refer to :ref:`secure sockets documentation `. +Finally, ``set_native_tls`` can be optionally set to enable native TLS support instead of offloading TLS operations to the modem. + An example of how to use TLS with MQTT is also present in :zephyr:code-sample:`mqtt-publisher` sample application. diff --git a/include/zephyr/net/mqtt.h b/include/zephyr/net/mqtt.h index d63cc1316249..797f8f339d7f 100644 --- a/include/zephyr/net/mqtt.h +++ b/include/zephyr/net/mqtt.h @@ -773,6 +773,9 @@ struct mqtt_sec_config { /** Indicates the preference for copying certificates to the heap. */ int cert_nocopy; + + /** Set socket to native TLS */ + bool set_native_tls; }; /** @brief MQTT transport type. */ diff --git a/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c b/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c index 68a101e6c846..617dec4b4d26 100644 --- a/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c +++ b/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c @@ -22,10 +22,15 @@ int mqtt_client_tls_connect(struct mqtt_client *client) { const struct sockaddr *broker = client->broker; struct mqtt_sec_config *tls_config = &client->transport.tls.config; + int type = SOCK_STREAM; int ret; + if (tls_config->set_native_tls) { + type |= SOCK_NATIVE_TLS; + } + client->transport.tls.sock = zsock_socket(broker->sa_family, - SOCK_STREAM, IPPROTO_TLS_1_2); + type, IPPROTO_TLS_1_2); if (client->transport.tls.sock < 0) { return -errno; } From bc60d5ca3563061a00c35873e3e5c225e6de3750 Mon Sep 17 00:00:00 2001 From: Markus Swarowsky Date: Mon, 4 Dec 2023 15:27:08 +0100 Subject: [PATCH 0490/2141] [nrf noup] soc: arm: nRF53: Add SPU Flash/RAM alignment TF-M will uses SPU alignment during build time to make sure all partitions can be locked down with the SPU. So adding them for nRF53 Signed-off-by: Markus Swarowsky (cherry picked from commit fdd4008022c11eaca3efa7ed1f33658d56fa315f) --- soc/nordic/nrf53/Kconfig | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/soc/nordic/nrf53/Kconfig b/soc/nordic/nrf53/Kconfig index 8aade63f54a1..d90bf28846ae 100644 --- a/soc/nordic/nrf53/Kconfig +++ b/soc/nordic/nrf53/Kconfig @@ -167,12 +167,26 @@ config NRF_SPU_FLASH_REGION_SIZE help FLASH region size for the NRF_SPU peripheral +config NRF_SPU_FLASH_REGION_ALIGNMENT + hex + default 0x4000 + help + FLASH regions must be aligned to this value due to SPU HW + limitations. + config NRF_SPU_RAM_REGION_SIZE hex default 0x2000 help RAM region size for the NRF_SPU peripheral +config NRF_SPU_RAM_REGION_ALIGNMENT + hex + default 0x2000 + help + RAM regions must be aligned to this value due to SPU HW + limitations. + config SOC_NRF_GPIO_FORWARDER_FOR_NRF5340 bool "Forward GPIO pins to network core" depends on NRF_SOC_SECURE_SUPPORTED From a562d9663033995572b1e3269c687cbb343773e0 Mon Sep 17 00:00:00 2001 From: Markus Swarowsky Date: Mon, 4 Dec 2023 15:27:14 +0100 Subject: [PATCH 0491/2141] [nrf noup] soc: arm: nRF91: Add SPU Flash/RAM alignment TF-M will uses SPU alignment during build time to make sure all partitions can be locked down with the SPU. So adding them for nRF91 The nRF54L15 doesn't use the SPU for setting the security attributes for flash/RAM regions. In order to avoid having multiple Kconfigs with similar meaning renamed the alignment Kconfig option to something more generic in order to use the same symbol for all the TrustZone enabled devices. Ref: NCSDK-25023 Signed-off-by: Markus Swarowsky Signed-off-by: Georgios Vasilakis (cherry picked from commit 03fc9837eedbf4860e1871f9b4eb4c1df477eb3e) --- soc/nordic/nrf53/Kconfig | 22 ++++++++++++++-------- soc/nordic/nrf91/Kconfig | 20 ++++++++++++++++++++ 2 files changed, 34 insertions(+), 8 deletions(-) diff --git a/soc/nordic/nrf53/Kconfig b/soc/nordic/nrf53/Kconfig index d90bf28846ae..1a747bec9ea6 100644 --- a/soc/nordic/nrf53/Kconfig +++ b/soc/nordic/nrf53/Kconfig @@ -167,12 +167,15 @@ config NRF_SPU_FLASH_REGION_SIZE help FLASH region size for the NRF_SPU peripheral -config NRF_SPU_FLASH_REGION_ALIGNMENT +config NRF_TRUSTZONE_FLASH_REGION_SIZE hex - default 0x4000 + default NRF_SPU_FLASH_REGION_SIZE help - FLASH regions must be aligned to this value due to SPU HW - limitations. + Define the flash region size from a TrustZone perspective. + This is used when we set the security attributes(S/NSC/NS) of a region + in TrustZone enabled devices. + In practice this option defines the granularity of the security attributes, + i.e. the smallest region that can be set to secure or non-secure. config NRF_SPU_RAM_REGION_SIZE hex @@ -180,12 +183,15 @@ config NRF_SPU_RAM_REGION_SIZE help RAM region size for the NRF_SPU peripheral -config NRF_SPU_RAM_REGION_ALIGNMENT +config NRF_TRUSTZONE_RAM_REGION_SIZE hex - default 0x2000 + default NRF_SPU_RAM_REGION_SIZE help - RAM regions must be aligned to this value due to SPU HW - limitations. + Define the RAM region size from a TrustZone perspective. + This is used when we set the security attributes(S/NSC/NS) of a region + in TrustZone enabled devices. + In practice this option defines the granularity of the security attributes, + i.e. the smallest region that can be set to secure or non-secure. config SOC_NRF_GPIO_FORWARDER_FOR_NRF5340 bool "Forward GPIO pins to network core" diff --git a/soc/nordic/nrf91/Kconfig b/soc/nordic/nrf91/Kconfig index ed38eff73a2d..9f55cdd77ed9 100644 --- a/soc/nordic/nrf91/Kconfig +++ b/soc/nordic/nrf91/Kconfig @@ -24,6 +24,16 @@ config NRF_SPU_FLASH_REGION_SIZE help FLASH region size for the NRF_SPU peripheral +config NRF_TRUSTZONE_FLASH_REGION_SIZE + hex + default NRF_SPU_FLASH_REGION_SIZE + help + Define the flash region size from a TrustZone perspective. + This is used when we set the security attributes(S/NSC/NS) of a region + in TrustZone enabled devices. + In practice this option defines the granularity of the security attributes, + i.e. the smallest region that can be set to secure or non-secure. + config NRF_SPU_RAM_REGION_SIZE hex default 0x2000 @@ -34,4 +44,14 @@ config NRF_ENABLE_ICACHE bool "Instruction cache (I-Cache)" default y +config NRF_TRUSTZONE_RAM_REGION_SIZE + hex + default NRF_SPU_RAM_REGION_SIZE + help + Define the RAM region size from a TrustZone perspective. + This is used when we set the security attributes(S/NSC/NS) of a region + in TrustZone enabled devices. + In practice this option defines the granularity of the security attributes, + i.e. the smallest region that can be set to secure or non-secure. + endif # SOC_SERIES_NRF91X From afef9ef461a574f57a785bf220060468ad3ebbde Mon Sep 17 00:00:00 2001 From: Marek Pieta Date: Mon, 14 Nov 2022 11:22:06 +0100 Subject: [PATCH 0492/2141] [nrf noup] boards: thingy53_nrf5340: Add common partition map Change introduces common static Partition Manager configuration. The tfm_nonsecure partition must be SPU region aligned. Ref: NCSDK-18033 Ref: NCSDK-19515 Signed-off-by: Marek Pieta Signed-off-by: Markus Swarowsky (cherry picked from commit 466808152977ce0eb0fd0a7dca789c26df6fb12e) --- .../pm_static_thingy53_nrf5340_cpuapp.yml | 55 ++++++++++++++ .../pm_static_thingy53_nrf5340_cpuapp_ns.yml | 73 +++++++++++++++++++ 2 files changed, 128 insertions(+) create mode 100644 boards/nordic/thingy53/pm_static_thingy53_nrf5340_cpuapp.yml create mode 100644 boards/nordic/thingy53/pm_static_thingy53_nrf5340_cpuapp_ns.yml diff --git a/boards/nordic/thingy53/pm_static_thingy53_nrf5340_cpuapp.yml b/boards/nordic/thingy53/pm_static_thingy53_nrf5340_cpuapp.yml new file mode 100644 index 000000000000..7a48d51ec334 --- /dev/null +++ b/boards/nordic/thingy53/pm_static_thingy53_nrf5340_cpuapp.yml @@ -0,0 +1,55 @@ +app: + address: 0x10200 + region: flash_primary + size: 0xdfe00 +mcuboot: + address: 0x0 + region: flash_primary + size: 0x10000 +mcuboot_pad: + address: 0x10000 + region: flash_primary + size: 0x200 +mcuboot_primary: + address: 0x10000 + orig_span: &id001 + - mcuboot_pad + - app + region: flash_primary + size: 0xe0000 + span: *id001 +mcuboot_primary_app: + address: 0x10200 + orig_span: &id002 + - app + region: flash_primary + size: 0xdfe00 + span: *id002 +settings_storage: + address: 0xf0000 + region: flash_primary + size: 0x10000 +mcuboot_primary_1: + address: 0x0 + size: 0x40000 + device: flash_ctrl + region: ram_flash +mcuboot_secondary: + address: 0x00000 + size: 0xe0000 + device: MX25R64 + region: external_flash +mcuboot_secondary_1: + address: 0xe0000 + size: 0x40000 + device: MX25R64 + region: external_flash +external_flash: + address: 0x120000 + size: 0x6e0000 + device: MX25R64 + region: external_flash +pcd_sram: + address: 0x20000000 + size: 0x2000 + region: sram_primary diff --git a/boards/nordic/thingy53/pm_static_thingy53_nrf5340_cpuapp_ns.yml b/boards/nordic/thingy53/pm_static_thingy53_nrf5340_cpuapp_ns.yml new file mode 100644 index 000000000000..70ffe6d9c124 --- /dev/null +++ b/boards/nordic/thingy53/pm_static_thingy53_nrf5340_cpuapp_ns.yml @@ -0,0 +1,73 @@ +mcuboot: + address: 0x0 + region: flash_primary + size: 0x10000 +mcuboot_pad: + address: 0x10000 + region: flash_primary + size: 0x200 +tfm_secure: + address: 0x10000 + size: 0xc000 + span: [mcuboot_pad, tfm] +tfm_nonsecure: + address: 0x1c000 + size: 0xd4000 + span: [app] +tfm: + address: 0x10200 + region: flash_primary + size: 0xbe00 +app: + address: 0x1c000 + region: flash_primary + size: 0xd4000 +mcuboot_primary: + address: 0x10000 + orig_span: &id001 + - mcuboot_pad + - tfm + - app + region: flash_primary + size: 0xe0000 + span: *id001 +mcuboot_primary_app: + address: 0x10200 + orig_span: &id002 + - tfm + - app + region: flash_primary + size: 0xdfe00 + span: *id002 +nonsecure_storage: + address: 0xf0000 + size: 0x10000 + span: [settings_storage] +settings_storage: + address: 0xf0000 + region: flash_primary + size: 0x10000 +mcuboot_primary_1: + address: 0x0 + size: 0x40000 + device: flash_ctrl + region: ram_flash +mcuboot_secondary: + address: 0x00000 + size: 0xe0000 + device: MX25R64 + region: external_flash +mcuboot_secondary_1: + address: 0xe0000 + size: 0x40000 + device: MX25R64 + region: external_flash +external_flash: + address: 0x120000 + size: 0x6e0000 + device: MX25R64 + region: external_flash +pcd_sram: + address: 0x20000000 + size: 0x2000 + region: sram_primary From 6d1e3772d63562e2e30fa3176805538d2f0c4117 Mon Sep 17 00:00:00 2001 From: Mateusz Kapala Date: Thu, 2 Feb 2023 11:04:23 +0100 Subject: [PATCH 0493/2141] [nrf noup] boards: arm: thingy53: Disable USB CDC added by MCUBoot Enabling USB CDC by default in Thingy:53 board configuration caused that there were two instances of USB CDC in MCUBoot. Change disables one instance which was added automatically by NCS if MCUBoot bootloader was built as a child image. Jira: NCSDK-18596 Signed-off-by: Mateusz Kapala Signed-off-by: Johann Fischer (cherry picked from commit 5928c1a79fa621983ccc4f639426c7e9b4b0227b) --- boards/nordic/thingy53/Kconfig.defconfig | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/boards/nordic/thingy53/Kconfig.defconfig b/boards/nordic/thingy53/Kconfig.defconfig index c1139f0dca10..1aa0d7d082ec 100644 --- a/boards/nordic/thingy53/Kconfig.defconfig +++ b/boards/nordic/thingy53/Kconfig.defconfig @@ -84,6 +84,13 @@ endif # !TRUSTED_EXECUTION_SECURE source "boards/common/usb/Kconfig.cdc_acm_serial.defconfig" +# By default, a USB CDC ACM instance is already enabled in the board's DTS. +# It is not necessary for nRF Connect SDK to add another instance if MCUBoot +# bootloader is built as a child image. +config MCUBOOT_USB_SUPPORT + bool + default n + endif # BOARD_THINGY53_NRF5340_CPUAPP || BOARD_THINGY53_NRF5340_CPUAPP_NS if BOARD_THINGY53_NRF5340_CPUNET From ce70796db5dd9a8d99c55732c0292bbeffc38f77 Mon Sep 17 00:00:00 2001 From: Marek Pieta Date: Mon, 28 Nov 2022 15:31:33 +0100 Subject: [PATCH 0494/2141] [nrf noup] boards: thingy53_nrf5340: Enable MCUboot by default Change enables MCUboot bootloader by default to allow programming samples and applications without external programmer (using MCUboot serial recovery). Change also enables network core to prevent build failures when building MCUboot with nRF53 multi image DFU. Jira: NCSDK-18263 Signed-off-by: Marek Pieta Signed-off-by: Vinayak Kariappa Chettimada Signed-off-by: Johann Fischer Signed-off-by: Joakim Andersson (cherry picked from commit 39e767e9ed2333d8c9b1dfc483df7dc8aef58179) --- boards/nordic/thingy53/Kconfig.defconfig | 6 ++++++ boards/nordic/thingy53/thingy53_nrf5340_common.dtsi | 1 + 2 files changed, 7 insertions(+) diff --git a/boards/nordic/thingy53/Kconfig.defconfig b/boards/nordic/thingy53/Kconfig.defconfig index 1aa0d7d082ec..badcb5c20e5d 100644 --- a/boards/nordic/thingy53/Kconfig.defconfig +++ b/boards/nordic/thingy53/Kconfig.defconfig @@ -8,6 +8,12 @@ config HW_STACK_PROTECTION if BOARD_THINGY53_NRF5340_CPUAPP || BOARD_THINGY53_NRF5340_CPUAPP_NS +config BOOTLOADER_MCUBOOT + default y if !MCUBOOT + +config BOARD_ENABLE_CPUNET + default y if !MCUBOOT + # Code Partition: # # For the secure version of the board the firmware is linked at the beginning diff --git a/boards/nordic/thingy53/thingy53_nrf5340_common.dtsi b/boards/nordic/thingy53/thingy53_nrf5340_common.dtsi index 3f2f2d5f0606..900b9d06e658 100644 --- a/boards/nordic/thingy53/thingy53_nrf5340_common.dtsi +++ b/boards/nordic/thingy53/thingy53_nrf5340_common.dtsi @@ -13,6 +13,7 @@ zephyr,bt-hci = &bt_hci_ipc0; nordic,802154-spinel-ipc = &ipc0; zephyr,ieee802154 = &ieee802154; + nordic,pm-ext-flash = &mx25r64; }; buttons { From 640dbac87630e705ab5633e2de6003fc3bb70d57 Mon Sep 17 00:00:00 2001 From: Mateusz Michalek Date: Wed, 20 Mar 2024 12:10:13 +0100 Subject: [PATCH 0495/2141] [nrf noup] samples: smp_svr: configuration for nrf54l15 * Configuration allows DFU with serial transport using mcumgr and over BT using nRF Connect. * Added description of sample testcase for building smp_svr with support of secondary partition in on PDK spi_nor flash. * Added description of sample testcase for building smp_svr with support of secondary partition in on PDK spi_nor flash uisng DTS. Signed-off-by: Mateusz Michalek Signed-off-by: Andrzej Puzdrowski Signed-off-by: Dominik Ermel Signed-off-by: Jamie McCrae (cherry picked from commit 173521b2e5513b5516d17e7fe9305a6fcab9add9) --- ...f54l15dk_nrf54l15_cpuapp_ext_flash.overlay | 46 +++++++++++++++++++ ...54l15pdk_nrf54l15_cpuapp_ext_flash.overlay | 9 ---- .../subsys/mgmt/mcumgr/smp_svr/sample.yaml | 30 ++++++++++++ 3 files changed, 76 insertions(+), 9 deletions(-) create mode 100644 samples/subsys/mgmt/mcumgr/smp_svr/boards/nrf54l15dk_nrf54l15_cpuapp_ext_flash.overlay delete mode 100644 samples/subsys/mgmt/mcumgr/smp_svr/boards/nrf54l15pdk_nrf54l15_cpuapp_ext_flash.overlay diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/boards/nrf54l15dk_nrf54l15_cpuapp_ext_flash.overlay b/samples/subsys/mgmt/mcumgr/smp_svr/boards/nrf54l15dk_nrf54l15_cpuapp_ext_flash.overlay new file mode 100644 index 000000000000..c8040e40ffd7 --- /dev/null +++ b/samples/subsys/mgmt/mcumgr/smp_svr/boards/nrf54l15dk_nrf54l15_cpuapp_ext_flash.overlay @@ -0,0 +1,46 @@ +/ { + chosen { + nordic,pm-ext-flash = &mx25r64; + }; +}; + +/delete-node/ &boot_partition; +/delete-node/ &slot0_partition; +/delete-node/ &slot1_partition; +/delete-node/ &storage_partition; + +&cpuapp_rram { + reg = <0x0 DT_SIZE_K(1524)>; + + partitions { + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x000000000 0x00014000>; + }; + + slot0_partition: partition@14000 { + label = "image-0"; + reg = <0x000014000 0x0015A000>; + }; + + storage_partition: partition@16E000 { + label = "storage"; + reg = < 0x16E000 0x9000 >; + }; + }; +}; + +&mx25r64 { + status = "okay"; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + slot1_partition: partition@0 { + label = "image-1"; + reg = <0x000000000 0x0015A000>; + }; + }; +}; diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/boards/nrf54l15pdk_nrf54l15_cpuapp_ext_flash.overlay b/samples/subsys/mgmt/mcumgr/smp_svr/boards/nrf54l15pdk_nrf54l15_cpuapp_ext_flash.overlay deleted file mode 100644 index 410388bfa6d3..000000000000 --- a/samples/subsys/mgmt/mcumgr/smp_svr/boards/nrf54l15pdk_nrf54l15_cpuapp_ext_flash.overlay +++ /dev/null @@ -1,9 +0,0 @@ -/ { - chosen { - nordic,pm-ext-flash = &mx25r64; - }; -}; - -&mx25r64 { - status = "okay"; -}; diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml b/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml index fd6194cdc4f1..ab41f093dc3c 100644 --- a/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml +++ b/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml @@ -14,9 +14,12 @@ tests: - nrf52840dk/nrf52840 - pinnacle_100_dvk - mg100 + - nrf54l15dk/nrf54l15/cpuapp + - nrf54l15dk/nrf54l10/cpuapp integration_platforms: - nrf52dk/nrf52832 - nrf52840dk/nrf52840 + - nrf54l15dk/nrf54l15/cpuapp sample.mcumgr.smp_svr.bt_static_svc: harness: bluetooth tags: bluetooth @@ -170,6 +173,33 @@ tests: - mg100 integration_platforms: - nrf52840dk/nrf52840 + sample.mcumgr.smp_svr.bt.nrf54l15dk.ext_flash: + extra_args: + - OVERLAY_CONFIG="overlay-bt.conf" + - DTC_OVERLAY_FILE="boards/nrf54l15dk_nrf54l15_cpuapp_ext_flash.overlay" + - mcuboot_CONF_FILE="boards/nrf54l15dk_nrf54l15_cpuapp_ext_flash.conf" + - mcuboot_EXTRA_DTC_OVERLAY_FILE="boards/nrf54l15dk_nrf54l15_cpuapp_ext_flash.overlay" + - SB_CONFIG_PM_OVERRIDE_EXTERNAL_DRIVER_CHECK=y + - SB_CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y + platform_allow: + - nrf54l15dk/nrf54l15/cpuapp + - nrf54l15dk/nrf54l10/cpuapp + - nrf54l15dk/nrf54l05/cpuapp + integration_platforms: + - nrf54l15dk/nrf54l15/cpuapp + sample.mcumgr.smp_svr.bt.nrf54l15dk.ext_flash.pure_dts: + extra_args: + - OVERLAY_CONFIG="overlay-bt.conf" + - DTC_OVERLAY_FILE="boards/nrf54l15dk_nrf54l15_cpuapp_ext_flash.overlay" + - mcuboot_CONF_FILE="boards/nrf54l15dk_nrf54l15_cpuapp_ext_flash.conf" + - mcuboot_EXTRA_DTC_OVERLAY_FILE="boards/nrf54l15dk_nrf54l15_cpuapp_ext_flash.overlay" + - SB_CONFIG_PARTITION_MANAGER=n + platform_allow: + - nrf54l15dk/nrf54l15/cpuapp + - nrf54l15dk/nrf54l10/cpuapp + - nrf54l15dk/nrf54l05/cpuapp + integration_platforms: + - nrf54l15dk/nrf54l15/cpuapp sample.mcumgr.smp_svr.ram_load: extra_args: FILE_SUFFIX="ram_load" platform_allow: From 27f225d5ae6e3f73b609970b81881d504f1b956d Mon Sep 17 00:00:00 2001 From: Markus Swarowsky Date: Fri, 19 Apr 2024 12:58:47 +0200 Subject: [PATCH 0496/2141] [nrf noup] samples: psa_crypto: Remove support for Nordic boards We have our own psa crypto samples to show how to used PSA crypto with NCS. This sample still uses CONFIG_MBEDTLS_BUILTIN which is not supported anymore, therefore removing the support for it in NCS. Ref: NCSDK-17944 Signed-off-by: Markus Swarowsky (cherry picked from commit 399afcb770a4b8994f9fc9a5ce25104aa27e8d15) --- samples/tfm_integration/psa_crypto/sample.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/samples/tfm_integration/psa_crypto/sample.yaml b/samples/tfm_integration/psa_crypto/sample.yaml index ea9844730fc1..7d287985bf3c 100644 --- a/samples/tfm_integration/psa_crypto/sample.yaml +++ b/samples/tfm_integration/psa_crypto/sample.yaml @@ -16,8 +16,6 @@ tests: platform_allow: - mps2/an521/cpu0/ns - v2m_musca_s1/musca_s1/ns - - nrf5340dk/nrf5340/cpuapp/ns - - nrf9160dk/nrf9160/ns - stm32l562e_dk/stm32l562xx/ns - bl5340_dvk/nrf5340/cpuapp/ns - max32657evkit/max32657/ns From fa07e94d6a760f8a4e025b408f3ddd5db47acaf5 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Thu, 9 May 2024 09:34:06 +0100 Subject: [PATCH 0497/2141] [nrf noup] boards: nordic: thingy53: Add sysbuild Kconfig file Adds a sysbuild Kconfig file which enables external flash when partition manager is enabled Signed-off-by: Jamie McCrae (cherry picked from commit 41431fb6849faeb5c106c63cf8933dd4c96fc53f) --- boards/nordic/thingy53/Kconfig.sysbuild | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 boards/nordic/thingy53/Kconfig.sysbuild diff --git a/boards/nordic/thingy53/Kconfig.sysbuild b/boards/nordic/thingy53/Kconfig.sysbuild new file mode 100644 index 000000000000..2110f226e6b1 --- /dev/null +++ b/boards/nordic/thingy53/Kconfig.sysbuild @@ -0,0 +1,5 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY + default y if BOOTLOADER_MCUBOOT From 5bbb2c8dd32e564667eb7b6bc3bd27f9f58e1bfb Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Tue, 14 May 2024 12:22:51 +0100 Subject: [PATCH 0498/2141] [nrf noup] scripts: west: build: Use sysbuild by default if in NCS dir Uses sysbuild by default when building an application which resides in an allowed NCS-based directory when the sysbuild config key is not set. Do not use sysbuild if the mps2 board is being used to avoid problems with CI testing. Signed-off-by: Jamie McCrae (cherry picked from commit 5cfd8be12639557aa0e6c01f9c401823f74ac282) --- scripts/west_commands/build.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/west_commands/build.py b/scripts/west_commands/build.py index 90d1a037e4f7..1b7bf3b80a18 100644 --- a/scripts/west_commands/build.py +++ b/scripts/west_commands/build.py @@ -624,7 +624,12 @@ def _run_cmake(self, board, origin, cmake_opts): if user_args: cmake_opts.extend(shlex.split(user_args)) - config_sysbuild = config_getboolean('sysbuild', False) + config_sysbuild = config_getboolean('sysbuild', None) + + if config_sysbuild is None: + # If no option is set, then enable sysbuild globally + config_sysbuild = True + if self.args.sysbuild or (config_sysbuild and not self.args.no_sysbuild): cmake_opts.extend([f'-S{SYSBUILD_PROJ_DIR}', f'-DAPP_DIR:PATH={self.source_dir}']) From f730f82960010af1f6fd988d15842de0920dc9af Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Fri, 17 May 2024 10:15:33 +0100 Subject: [PATCH 0499/2141] [nrf noup] board: nordic: thingy53: Enable default images for sysbuild Enables MCUboot, empty network core and network core updates by default when building for the thingy53 Signed-off-by: Jamie McCrae (cherry picked from commit b7123304343bd3bdedb382353b2957fa9a66c9ed) --- boards/nordic/thingy53/Kconfig.sysbuild | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/boards/nordic/thingy53/Kconfig.sysbuild b/boards/nordic/thingy53/Kconfig.sysbuild index 2110f226e6b1..c03d191b3708 100644 --- a/boards/nordic/thingy53/Kconfig.sysbuild +++ b/boards/nordic/thingy53/Kconfig.sysbuild @@ -1,5 +1,22 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 +if BOARD_THINGY53_NRF5340_CPUAPP || BOARD_THINGY53_NRF5340_CPUAPP_NS + +choice BOOTLOADER + default BOOTLOADER_MCUBOOT +endchoice + +config SECURE_BOOT_NETCORE + default y + +config NETCORE_APP_UPDATE + default y if SECURE_BOOT_NETCORE + +config NRF_DEFAULT_EMPTY + default y if SECURE_BOOT_NETCORE + +endif # BOARD_THINGY53_NRF5340_CPUAPP || BOARD_THINGY53_NRF5340_CPUAPP_NS + config PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY default y if BOOTLOADER_MCUBOOT From d7a627775d65077527e6272d627e2b88bfecc9cd Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Mon, 1 Oct 2018 10:27:32 +0200 Subject: [PATCH 0500/2141] [nrf noup] include: net: add NCS extensions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add some socket options and address family extensions to Zephyr headers, which will be useful for nRF Connect SDK. Add secure socket options: * Add CID socket options to NCS specific options. * Add TLS/DTLS tls ciphersuite chosen socket option to NCS specific options. * Add TLS/DTLS connection save/load socket options to NCS specific options. * Add TLS/DTLS handshake status socket option to NCS specific options. * Add SO_KEEPOPEN socket option. * Add SO_RAI socket options. * Add SO_IPV6_DELAYED_ADDR_REFRESH socket option. The "author" of this commit is a contact person; various people with s-o-b lines following here have contributed to the maintenance of this patch. Signed-off-by: Andreas Moltumyr Signed-off-by: Andrzej Głąbek Signed-off-by: Christopher Métrailler Signed-off-by: Emanuele Di Santo Signed-off-by: Glenn Ruben Bakke Signed-off-by: Håkon Alseth Signed-off-by: Ioannis Glaropoulos Signed-off-by: Jan Tore Guggedal Signed-off-by: Joakim Andersson Signed-off-by: Martí Bolívar Signed-off-by: Mirko Covizzi Signed-off-by: Petri Honkala Signed-off-by: Robert Lubos Signed-off-by: Tommi Mammela Signed-off-by: Trond Einar Snekvik Signed-off-by: Torsten Rasmussen Signed-off-by: Eivind Jølsgard Signed-off-by: Dominik Ermel (cherry picked from commit b9a0c119d0874611b8cdc01c9e44f31be6e03c94) --- include/zephyr/net/socket.h | 1 + include/zephyr/net/socket_ncs.h | 170 ++++++++++++++++++++++++++++++++ 2 files changed, 171 insertions(+) create mode 100644 include/zephyr/net/socket_ncs.h diff --git a/include/zephyr/net/socket.h b/include/zephyr/net/socket.h index ae398bb61177..4a0823bc069f 100644 --- a/include/zephyr/net/socket.h +++ b/include/zephyr/net/socket.h @@ -35,6 +35,7 @@ #include #include #include +#include #include #ifdef __cplusplus diff --git a/include/zephyr/net/socket_ncs.h b/include/zephyr/net/socket_ncs.h new file mode 100644 index 000000000000..92a8447c47fb --- /dev/null +++ b/include/zephyr/net/socket_ncs.h @@ -0,0 +1,170 @@ +/* + * Copyright (c) 2021 Nordic Semiconductor + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_INCLUDE_NET_SOCKET_NCS_H_ +#define ZEPHYR_INCLUDE_NET_SOCKET_NCS_H_ + +/** + * @file + * @brief NCS specific additions to the BSD sockets API definitions + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* When CONFIG_NET_SOCKETS_OFFLOAD is enabled, offloaded sockets take precedence + * when creating a new socket. Combine this flag with a socket type when + * creating a socket, to enforce native socket creation (e. g. SOCK_STREAM | SOCK_NATIVE). + * If it's desired to create a native TLS socket, but still offload the + * underlying TCP/UDP socket, use e. g. SOCK_STREAM | SOCK_NATIVE_TLS. + */ +#define SOCK_NATIVE 0x80000000 +#define SOCK_NATIVE_TLS 0x40000000 + +/** Define a base for NCS specific socket options to prevent overlaps with Zephyr's socket options. + */ +#define NET_SOCKET_NCS_BASE 1000 + +/* NCS specific TLS level socket options */ + +/** Socket option to set DTLS handshake timeout, specifically for nRF sockets. + * The option accepts an integer, indicating the total handshake timeout, + * including retransmissions, in seconds. + * Accepted values for the option are: 1, 3, 7, 15, 31, 63, 123. + */ +#define TLS_DTLS_HANDSHAKE_TIMEO (NET_SOCKET_NCS_BASE + 18) + +/** Socket option to save DTLS connection, specifically for nRF sockets. + */ +#define TLS_DTLS_CONN_SAVE (NET_SOCKET_NCS_BASE + 19) + +/** Socket option to load DTLS connection, specifically for nRF sockets. + */ +#define TLS_DTLS_CONN_LOAD (NET_SOCKET_NCS_BASE + 20) + +/** Socket option to get result of latest TLS/DTLS completed handshakes end status, + * specifically for nRF sockets. + * The option accepts an integer, indicating the setting. + * Accepted vaules for the option are: 0 and 1. + */ +#define TLS_DTLS_HANDSHAKE_STATUS (NET_SOCKET_NCS_BASE + 21) + +/* Valid values for TLS_DTLS_HANDSHAKE_TIMEO option */ +#define TLS_DTLS_HANDSHAKE_TIMEO_NONE 0 /**< No timeout */ +#define TLS_DTLS_HANDSHAKE_TIMEO_1S 1 /**< 1 second */ +#define TLS_DTLS_HANDSHAKE_TIMEO_3S 3 /**< 1s + 2s */ +#define TLS_DTLS_HANDSHAKE_TIMEO_7S 7 /**< 1s + 2s + 4s */ +#define TLS_DTLS_HANDSHAKE_TIMEO_15S 15 /**< 1s + 2s + 4s + 8s */ +#define TLS_DTLS_HANDSHAKE_TIMEO_31S 31 /**< 1s + 2s + 4s + 8s + 16s */ +#define TLS_DTLS_HANDSHAKE_TIMEO_63S 63 /**< 1s + 2s + 4s + 8s + 16s + 32s */ +#define TLS_DTLS_HANDSHAKE_TIMEO_123S 123 /**< 1s + 2s + 4s + 8s + 16s + 32s + 60s */ + +/* Valid values for TLS_DTLS_HANDSHAKE_STATUS option */ +#define TLS_DTLS_HANDSHAKE_STATUS_FULL 0 +#define TLS_DTLS_HANDSHAKE_STATUS_CACHED 1 + +/* NCS specific socket options */ + +/** sockopt: enable sending data as part of exceptional events */ +#define SO_EXCEPTIONAL_DATA (NET_SOCKET_NCS_BASE + 33) +/** sockopt: Keep socket open when its PDN connection is lost + * or the device is put into flight mode. + */ +#define SO_KEEPOPEN (NET_SOCKET_NCS_BASE + 34) +/** sockopt: bind to PDN */ +#define SO_BINDTOPDN (NET_SOCKET_NCS_BASE + 40) + +/** sockopt: Release assistance indication (RAI). + * The option accepts an integer, indicating the type of RAI. + * Accepted values for the option are: @ref RAI_NO_DATA, @ref RAI_LAST, @ref RAI_ONE_RESP, + * @ref RAI_ONGOING, @ref RAI_WAIT_MORE. + */ +#define SO_RAI (NET_SOCKET_NCS_BASE + 61) + +/** Release assistance indication (RAI). + * Indicate that the application does not intend to send more data. + * This applies immediately and lets the modem exit connected mode more + * quickly. + * + * @note This requires the socket to be connected. + */ +#define RAI_NO_DATA 1 +/** Release assistance indication (RAI). + * Indicate that the application does not intend to send more data + * after the next call to send() or sendto(). + * This lets the modem exit connected mode more quickly after sending the data. + */ +#define RAI_LAST 2 +/** Release assistance indication (RAI). + * Indicate that the application is expecting to receive just one data packet + * after the next call to send() or sendto(). + * This lets the modem exit connected mode more quickly after having received the data. + */ +#define RAI_ONE_RESP 3 +/** Release assistance indication (RAI). + * Indicate that the socket is in active use by a client application. + * This lets the modem stay in connected mode longer. + */ +#define RAI_ONGOING 4 +/** Release assistance indication (RAI). + * Indicate that the socket is in active use by a server application. + * This lets the modem stay in connected mode longer. + */ +#define RAI_WAIT_MORE 5 + +/* NCS specific IPPROTO_ALL level socket options */ + +/** IPv4 and IPv6 protocol level (pseudo-val) for nRF sockets. */ +#define IPPROTO_ALL 512 +/** sockopt: disable all replies to unexpected traffics */ +#define SO_SILENCE_ALL (NET_SOCKET_NCS_BASE + 30) + +/* NCS specific IPPROTO_IP level socket options */ + +/** sockopt: enable IPv4 ICMP replies */ +#define SO_IP_ECHO_REPLY (NET_SOCKET_NCS_BASE + 31) + +/* NCS specific IPPROTO_IPV6 level socket options */ + +/** sockopt: enable IPv6 ICMP replies */ +#define SO_IPV6_ECHO_REPLY (NET_SOCKET_NCS_BASE + 32) + +/** sockopt: Delay IPv6 address refresh during power saving mode */ +#define SO_IPV6_DELAYED_ADDR_REFRESH (NET_SOCKET_NCS_BASE + 62) + +/* NCS specific TCP level socket options */ + +/** sockopt: Configurable TCP server session timeout in minutes. + * Range is 0 to 135. 0 is no timeout and 135 is 2 h 15 min. Default is 0 (no timeout). + */ +#define SO_TCP_SRV_SESSTIMEO (NET_SOCKET_NCS_BASE + 55) + +/* NCS specific gettaddrinfo() flags */ + +/** Assume `service` contains a Packet Data Network (PDN) ID. + * When specified together with the AI_NUMERICSERV flag, + * `service` shall be formatted as follows: "port:pdn_id" + * where "port" is the port number and "pdn_id" is the PDN ID. + * Example: "8080:1", port 8080 PDN ID 1. + * Example: "42:0", port 42 PDN ID 0. + */ +#define AI_PDNSERV 0x1000 + +/* NCS specific send() and sendto() flags */ + +/** Request a blocking send operation until the request is acknowledged. + * When used in send() or sendto(), the request will not return until the + * send operation is completed by lower layers, or until the timeout, given by the SO_SNDTIMEO + * socket option, is reached. Valid timeout values are 1 to 600 seconds. + */ +#define MSG_WAITACK 0x200 + +#ifdef __cplusplus +} +#endif + +#endif /* ZEPHYR_INCLUDE_NET_SOCKET_NCS_H_ */ From 5c2eecf1ef8bc3bc714dff8adf8f023bd921227a Mon Sep 17 00:00:00 2001 From: Sigvart Hovland Date: Fri, 3 May 2019 14:21:52 +0200 Subject: [PATCH 0501/2141] [nrf noup] tree-wide: support NCS Partition Manager (PM) definitions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Partition Manager (PM) is a component of the nRF Connect SDK (NCS) which uses yaml files to resolve flash partition placement with a holistic view of the entire device, including each firmware image present on the flash device, and various subsystems, such as settings and NFFS. When this NCS extension is used, various source files which would use partition information from devicetree in "vanilla" zephyr instead use defines generated by PM instead. This commit removes support for HEX_FILES_TO_MERGE, as it conflicts with PM. The settings subsystem pm.yml defines a partition 'settings_storage'. The nffs subsystem pm.yml defines 'nffs_storage'. Leverage label translation to avoid patching partition names. Refer to the NCS documentation page for this feature for more details. This is a long-running out of tree patch which has been worked on by several people. The following sign-offs are in alphabetical order by first name. Signed-off-by: Andrzej Głąbek Signed-off-by: Andrzej Puzdrowski Signed-off-by: Håkon Øye Amundsen Signed-off-by: Ioannis Glaropoulos Signed-off-by: Joakim Andersson Signed-off-by: Johann Fischer Signed-off-by: Martí Bolívar Signed-off-by: Ole Sæther Signed-off-by: Robert Lubos Signed-off-by: Sebastian Bøe Signed-off-by: Sigvart Hovland Signed-off-by: Thomas Stenersen Signed-off-by: Torsten Rasmussen Signed-off-by: Øyvind Rønningstad Signed-off-by: Trond Einar Snekvik Signed-off-by: Gerard Marull-Paretas Signed-off-by: Tomasz Moń Signed-off-by: Dominik Ermel Signed-off-by: Jamie McCrae (cherry picked from commit 7ad01c28efca10b3c900ed956d76bc357b9e381e) --- arch/arm/core/mpu/arm_mpu_regions.c | 13 +++++ cmake/linker/ld/target.cmake | 1 + cmake/linker/lld/target.cmake | 1 + cmake/modules/kernel.cmake | 4 ++ drivers/flash/soc_flash_nrf.c | 11 ++++ drivers/flash/soc_flash_nrf_rram.c | 11 ++++ .../arch/arm/cortex_m/scripts/linker.ld | 50 +++++++++++++++++++ include/zephyr/storage/flash_map.h | 6 +++ lib/heap/Kconfig | 2 +- lib/libc/common/source/stdlib/malloc.c | 18 ++++++- subsys/dfu/boot/mcuboot_shell.c | 40 +++++++++++++++ subsys/fs/littlefs_fs.c | 7 ++- subsys/ipc/rpmsg_service/rpmsg_backend.h | 27 ++++++++++ 13 files changed, 187 insertions(+), 4 deletions(-) diff --git a/arch/arm/core/mpu/arm_mpu_regions.c b/arch/arm/core/mpu/arm_mpu_regions.c index 0bf7a219c27d..383fd573513c 100644 --- a/arch/arm/core/mpu/arm_mpu_regions.c +++ b/arch/arm/core/mpu/arm_mpu_regions.c @@ -8,6 +8,9 @@ #include #include +#if USE_PARTITION_MANAGER +#include +#endif static const struct arm_mpu_region mpu_regions[] = { #ifdef CONFIG_XIP @@ -24,6 +27,14 @@ static const struct arm_mpu_region mpu_regions[] = { /* Region 1 */ MPU_REGION_ENTRY("SRAM_0", +#if USE_PARTITION_MANAGER + PM_SRAM_ADDRESS, +#if defined(CONFIG_ARMV8_M_BASELINE) || defined(CONFIG_ARMV8_M_MAINLINE) + REGION_RAM_ATTR(PM_SRAM_ADDRESS, PM_SRAM_SIZE)), +#else + REGION_RAM_ATTR(REGION_SRAM_SIZE)), +#endif +#else CONFIG_SRAM_BASE_ADDRESS, #if defined(CONFIG_ARMV8_M_BASELINE) || defined(CONFIG_ARMV8_M_MAINLINE) REGION_RAM_ATTR(CONFIG_SRAM_BASE_ADDRESS, \ @@ -31,6 +42,8 @@ static const struct arm_mpu_region mpu_regions[] = { #else REGION_RAM_ATTR(REGION_SRAM_SIZE)), #endif + +#endif /* USE_PARTITION_MANAGER */ }; const struct arm_mpu_config mpu_config = { diff --git a/cmake/linker/ld/target.cmake b/cmake/linker/ld/target.cmake index 733accda7820..cee3dd011bc5 100644 --- a/cmake/linker/ld/target.cmake +++ b/cmake/linker/ld/target.cmake @@ -80,6 +80,7 @@ macro(configure_linker_script linker_script_gen linker_pass_define) ${current_includes} ${soc_linker_script_includes} ${template_script_defines} + -DUSE_PARTITION_MANAGER=$ -E ${LINKER_SCRIPT} -P # Prevent generation of debug `#line' directives. -o ${linker_script_gen} diff --git a/cmake/linker/lld/target.cmake b/cmake/linker/lld/target.cmake index b6b96525e706..bdea4f1ec922 100644 --- a/cmake/linker/lld/target.cmake +++ b/cmake/linker/lld/target.cmake @@ -52,6 +52,7 @@ macro(configure_linker_script linker_script_gen linker_pass_define) -imacros ${AUTOCONF_H} ${current_includes} ${template_script_defines} + -DUSE_PARTITION_MANAGER=$ -E ${LINKER_SCRIPT} -P # Prevent generation of debug `#line' directives. -o ${linker_script_gen} diff --git a/cmake/modules/kernel.cmake b/cmake/modules/kernel.cmake index c6319611c8c3..5c8fa184b208 100644 --- a/cmake/modules/kernel.cmake +++ b/cmake/modules/kernel.cmake @@ -256,3 +256,7 @@ if("${CMAKE_EXTRA_GENERATOR}" STREQUAL "Eclipse CDT4") include(${ZEPHYR_BASE}/cmake/ide/eclipse_cdt4_generator_amendment.cmake) eclipse_cdt4_generator_amendment(1) endif() + +if(ZEPHYR_NRF_MODULE_DIR) + include(${ZEPHYR_NRF_MODULE_DIR}/cmake/partition_manager.cmake) +endif() diff --git a/drivers/flash/soc_flash_nrf.c b/drivers/flash/soc_flash_nrf.c index 9e1ba68319ff..574739082dc4 100644 --- a/drivers/flash/soc_flash_nrf.c +++ b/drivers/flash/soc_flash_nrf.c @@ -37,6 +37,11 @@ LOG_MODULE_REGISTER(flash_nrf); #define SOC_NV_FLASH_NODE DT_INST(0, soc_nv_flash) +#if CONFIG_TRUSTED_EXECUTION_NONSECURE && USE_PARTITION_MANAGER +#include +#include +#endif /* CONFIG_TRUSTED_EXECUTION_NONSECURE && USE_PARTITION_MANAGER */ + #ifndef CONFIG_SOC_FLASH_NRF_RADIO_SYNC_NONE #define FLASH_SLOT_WRITE 7500 #if defined(CONFIG_SOC_FLASH_NRF_PARTIAL_ERASE) @@ -166,6 +171,12 @@ static int flash_nrf_read(const struct device *dev, off_t addr, } #endif +#if CONFIG_TRUSTED_EXECUTION_NONSECURE && USE_PARTITION_MANAGER && PM_APP_ADDRESS + if (addr < PM_APP_ADDRESS) { + return soc_secure_mem_read(data, (void *)addr, len); + } +#endif + nrf_nvmc_buffer_read(data, (uint32_t)addr, len); return 0; diff --git a/drivers/flash/soc_flash_nrf_rram.c b/drivers/flash/soc_flash_nrf_rram.c index d26a15cf7236..d46e3524ea8d 100644 --- a/drivers/flash/soc_flash_nrf_rram.c +++ b/drivers/flash/soc_flash_nrf_rram.c @@ -54,6 +54,11 @@ LOG_MODULE_REGISTER(flash_nrf_rram, CONFIG_FLASH_LOG_LEVEL); #define WRITE_BLOCK_SIZE_FROM_DT DT_PROP(RRAM, write_block_size) #define ERASE_VALUE 0xFF +#if CONFIG_TRUSTED_EXECUTION_NONSECURE && USE_PARTITION_MANAGER +#include +#include +#endif /* CONFIG_TRUSTED_EXECUTION_NONSECURE && USE_PARTITION_MANAGER */ + #ifdef CONFIG_MULTITHREADING static struct k_sem sem_lock; #define SYNC_INIT() k_sem_init(&sem_lock, 1, 1) @@ -279,6 +284,12 @@ static int nrf_rram_read(const struct device *dev, off_t addr, void *data, size_ } addr += RRAM_START; +#if CONFIG_TRUSTED_EXECUTION_NONSECURE && USE_PARTITION_MANAGER && PM_APP_ADDRESS + if (addr < PM_APP_ADDRESS) { + return soc_secure_mem_read(data, (void *)addr, len); + } +#endif + memcpy(data, (void *)addr, len); return 0; diff --git a/include/zephyr/arch/arm/cortex_m/scripts/linker.ld b/include/zephyr/arch/arm/cortex_m/scripts/linker.ld index 278620dfaf02..ae4fbcaeddac 100644 --- a/include/zephyr/arch/arm/cortex_m/scripts/linker.ld +++ b/include/zephyr/arch/arm/cortex_m/scripts/linker.ld @@ -34,6 +34,39 @@ #define ROMSTART_REGION ROMABLE_REGION #endif +#if USE_PARTITION_MANAGER + +#include + +#if CONFIG_NCS_IS_VARIANT_IMAGE && defined(PM_S0_ID) +/* We are linking against S1, create symbol containing the flash ID of S0. + * This is used when writing code operating on the "other" slot. + */ +_image_1_primary_slot_id = PM_S0_ID; + +#else /* ! CONFIG_NCS_IS_VARIANT_IMAGE */ + +#ifdef PM_S1_ID +/* We are linking against S0, create symbol containing the flash ID of S1. + * This is used when writing code operating on the "other" slot. + */ +_image_1_primary_slot_id = PM_S1_ID; +#endif /* PM_S1_ID */ + +#endif /* CONFIG_NCS_IS_VARIANT_IMAGE */ + +#define ROM_ADDR PM_ADDRESS +#define ROM_SIZE PM_SIZE + +#if defined(CONFIG_PM_USE_CONFIG_SRAM_SIZE) +#define RAM_SIZE CONFIG_PM_SRAM_SIZE +#else +#define RAM_SIZE PM_SRAM_SIZE +#endif +#define RAM_ADDR PM_SRAM_ADDRESS + +#else /* ! USE_PARTITION_MANAGER */ + #if !defined(CONFIG_XIP) && (CONFIG_FLASH_SIZE == 0) #define ROM_ADDR RAM_ADDR #else @@ -55,6 +88,23 @@ #define RAM_SIZE (CONFIG_SRAM_SIZE * 1K) #define RAM_ADDR CONFIG_SRAM_BASE_ADDRESS +#endif /* USE_PARTITION_MANAGER */ + +#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_ccm), okay) +#define CCM_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_ccm)) +#define CCM_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_ccm)) +#endif + +#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_itcm), okay) +#define ITCM_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_itcm)) +#define ITCM_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_itcm)) +#endif + +#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_dtcm), okay) +#define DTCM_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_dtcm)) +#define DTCM_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_dtcm)) +#endif + #if defined(CONFIG_CUSTOM_SECTION_ALIGN) _region_min_align = CONFIG_CUSTOM_SECTION_MIN_ALIGN_SIZE; #else diff --git a/include/zephyr/storage/flash_map.h b/include/zephyr/storage/flash_map.h index d8ba414abd3d..f62f1c217185 100644 --- a/include/zephyr/storage/flash_map.h +++ b/include/zephyr/storage/flash_map.h @@ -348,6 +348,10 @@ const char *flash_area_label(const struct flash_area *fa); */ uint8_t flash_area_erased_val(const struct flash_area *fa); +#if USE_PARTITION_MANAGER +#include +#else + /** * Returns non-0 value if fixed-partition of given DTS node label exists. * @@ -469,6 +473,8 @@ DT_FOREACH_STATUS_OKAY(fixed_partitions, FOR_EACH_PARTITION_TABLE) #undef FOR_EACH_PARTITION_TABLE /** @endcond */ +#endif /* USE_PARTITION_MANAGER */ + #ifdef __cplusplus } #endif diff --git a/lib/heap/Kconfig b/lib/heap/Kconfig index 0d97da3e340b..9a39ab8ad73b 100644 --- a/lib/heap/Kconfig +++ b/lib/heap/Kconfig @@ -81,7 +81,7 @@ config HEAP_LISTENER choice prompt "Supported heap sizes" depends on !64BIT - default SYS_HEAP_SMALL_ONLY if (SRAM_SIZE <= 256) + default SYS_HEAP_SMALL_ONLY if (SRAM_SIZE <= 256) && !PARTITION_MANAGER_ENABLED default SYS_HEAP_AUTO help Heaps using reduced-size chunk headers can accommodate so called diff --git a/lib/libc/common/source/stdlib/malloc.c b/lib/libc/common/source/stdlib/malloc.c index 2b01e152f009..2821ae8173ac 100644 --- a/lib/libc/common/source/stdlib/malloc.c +++ b/lib/libc/common/source/stdlib/malloc.c @@ -25,6 +25,20 @@ #include LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); +#if USE_PARTITION_MANAGER + +#include + +#define RAM_SIZE PM_SRAM_SIZE +#define RAM_ADDR PM_SRAM_ADDRESS + +#else /* ! USE_PARTITION_MANAGER */ + +#define RAM_SIZE (KB((size_t) CONFIG_SRAM_SIZE)) +#define RAM_ADDR CONFIG_SRAM_BASE_ADDRESS + +#endif /* USE_PARTITION_MANAGER */ + #ifdef CONFIG_COMMON_LIBC_MALLOC #if (CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE != 0) @@ -106,8 +120,8 @@ static POOL_SECTION unsigned char __aligned(HEAP_ALIGN) malloc_arena[HEAP_SIZE]; extern char _heap_sentry[]; # define HEAP_SIZE ROUND_DOWN((POINTER_TO_UINT(_heap_sentry) - HEAP_BASE), HEAP_ALIGN) # else -# define HEAP_SIZE ROUND_DOWN((KB((size_t) CONFIG_SRAM_SIZE) - \ - ((size_t) HEAP_BASE - (size_t) CONFIG_SRAM_BASE_ADDRESS)), HEAP_ALIGN) +# define HEAP_SIZE ROUND_DOWN((RAM_SIZE - \ + ((size_t) HEAP_BASE - (size_t) RAM_ADDR)), HEAP_ALIGN) # endif /* else CONFIG_XTENSA */ # endif /* else CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE > 0 */ diff --git a/subsys/dfu/boot/mcuboot_shell.c b/subsys/dfu/boot/mcuboot_shell.c index be4e558713f1..e167bc1e39b8 100644 --- a/subsys/dfu/boot/mcuboot_shell.c +++ b/subsys/dfu/boot/mcuboot_shell.c @@ -20,6 +20,16 @@ #endif #endif +#if USE_PARTITION_MANAGER +#include + +#ifdef CONFIG_NCS_IS_VARIANT_IMAGE +#define ACTIVE_IMAGE_ID PM_MCUBOOT_SECONDARY_ID +#else +#define ACTIVE_IMAGE_ID PM_MCUBOOT_PRIMARY_ID +#endif +#endif + struct area_desc { const char *name; unsigned int id; @@ -93,6 +103,35 @@ static int cmd_mcuboot_erase(const struct shell *sh, size_t argc, id = strtoul(argv[1], NULL, 0); /* Check if this is the parent (MCUboot) or own slot and if so, deny the request */ +#if USE_PARTITION_MANAGER +#ifdef PM_MCUBOOT_ID + if (id == PM_MCUBOOT_ID || id == PM_MCUBOOT_PAD_ID) { + shell_error(sh, "Cannot erase boot partition"); + return -EACCES; + } +#endif + +#ifdef PM_APP_ID + if (id == PM_APP_ID) { + shell_error(sh, "Cannot erase this area"); + return -EACCES; + } +#endif + +#ifdef PM_MCUBOOT_PRIMARY_APP_ID + if (id == PM_MCUBOOT_PRIMARY_APP_ID) { + shell_error(sh, "Cannot erase this area"); + return -EACCES; + } +#endif + +#ifdef ACTIVE_IMAGE_ID + if (id == ACTIVE_IMAGE_ID) { + shell_error(sh, "Cannot erase active partitions"); + return -EACCES; + } +#endif +#else #if FIXED_PARTITION_EXISTS(boot_partition) if (id == FIXED_PARTITION_ID(boot_partition)) { shell_error(sh, "Cannot erase boot partition"); @@ -105,6 +144,7 @@ static int cmd_mcuboot_erase(const struct shell *sh, size_t argc, shell_error(sh, "Cannot erase active partitions"); return -EACCES; } +#endif #endif err = boot_erase_img_bank(id); diff --git a/subsys/fs/littlefs_fs.c b/subsys/fs/littlefs_fs.c index 7cf8aaa44c7b..5abbf95f949e 100644 --- a/subsys/fs/littlefs_fs.c +++ b/subsys/fs/littlefs_fs.c @@ -1103,7 +1103,12 @@ struct fs_mount_t FS_FSTAB_ENTRY(DT_DRV_INST(inst)) = { \ .type = FS_LITTLEFS, \ .mnt_point = DT_INST_PROP(inst, mount_point), \ .fs_data = &fs_data_##inst, \ - .storage_dev = (void *)DT_FIXED_PARTITION_ID(FS_PARTITION(inst)), \ + .storage_dev = (void *) \ + COND_CODE_1(USE_PARTITION_MANAGER, \ + (COND_CODE_1(FIXED_PARTITION_EXISTS(littlefs_storage), \ + (FIXED_PARTITION_ID(littlefs_storage)), \ + (FIXED_PARTITION_ID(storage)))), \ + (DT_FIXED_PARTITION_ID(FS_PARTITION(inst)))), \ .flags = FSTAB_ENTRY_DT_MOUNT_FLAGS(DT_DRV_INST(inst)), \ }; diff --git a/subsys/ipc/rpmsg_service/rpmsg_backend.h b/subsys/ipc/rpmsg_service/rpmsg_backend.h index a74e46b85207..9996e1d74d9b 100644 --- a/subsys/ipc/rpmsg_service/rpmsg_backend.h +++ b/subsys/ipc/rpmsg_service/rpmsg_backend.h @@ -13,8 +13,35 @@ extern "C" { #endif +#if CONFIG_PARTITION_MANAGER_ENABLED + +#include "pm_config.h" + +#if defined(PM_RPMSG_NRF53_SRAM_ADDRESS) || defined(PM__RPMSG_NRF53_SRAM_ADDRESS) + +#if defined(PM_RPMSG_NRF53_SRAM_ADDRESS) +#define VDEV_START_ADDR PM_RPMSG_NRF53_SRAM_ADDRESS +#define VDEV_SIZE PM_RPMSG_NRF53_SRAM_SIZE +#else +/* The current image is a child image in a different domain than the image + * which defined the required values. To reach the values of the parent domain + * we use the 'PM__' variant of the define. + */ +#define VDEV_START_ADDR PM__RPMSG_NRF53_SRAM_ADDRESS +#define VDEV_SIZE PM__RPMSG_NRF53_SRAM_SIZE +#endif /* defined(PM_RPMSG_NRF53_SRAM_ADDRESS) */ + +#else #define VDEV_START_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_ipc_shm)) #define VDEV_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_ipc_shm)) +#endif /* defined(PM_RPMSG_NRF53_SRAM_ADDRESS) || defined(PM__RPMSG_NRF53_SRAM_ADDRESS) */ + +#else + +#define VDEV_START_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_ipc_shm)) +#define VDEV_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_ipc_shm)) + +#endif /* CONFIG_PARTITION_MANAGER_ENABLED */ #define VDEV_STATUS_ADDR VDEV_START_ADDR #define VDEV_STATUS_SIZE 0x400 From 4b7a867eabe9e6e3724e8b3c210b9506c9c2cfef Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Fri, 17 May 2024 14:10:51 +0200 Subject: [PATCH 0502/2141] [nrf noup] kernel: Disable boot banner if NCS_BOOT_BANNER is enabled Zephyr's boot banner should not be used if NCS boot banner is enabled. Signed-off-by: Robert Lubos (cherry picked from commit 11254fb60239df70e1d1c21f6fc1203af484a50e) --- kernel/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/Kconfig b/kernel/Kconfig index 838d44afbf9e..c2976b9f281f 100644 --- a/kernel/Kconfig +++ b/kernel/Kconfig @@ -457,6 +457,7 @@ config SKIP_BSS_CLEAR config BOOT_BANNER bool "Boot banner" default y + depends on !NCS_BOOT_BANNER select PRINTK select EARLY_CONSOLE help From 10b13619fcdedaa5ae25f62eb7acd86f5f768635 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20Reierstad?= Date: Fri, 31 May 2024 08:21:51 +0200 Subject: [PATCH 0503/2141] =?UTF-8?q?[nrf=20noup]=C2=A0Bluetooth:=20Mesh:?= =?UTF-8?q?=20remove=20legacy=20adv=20support?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removes explicit support for the legacy advertiser due to incompatibility with SDC. The legacy advertiser can be used (experimentally) with the Zephyr Link Layer enabled, but is not recommended. Signed-off-by: Håvard Reierstad (cherry picked from commit 4680ad758392681b1668c3b29cd58548e51950af) --- subsys/bluetooth/mesh/Kconfig | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index cd3d46190971..bd0350307ba2 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -59,12 +59,16 @@ choice BT_MESH_ADV menuconfig BT_MESH_ADV_LEGACY bool "Legacy advertising" + depends on BT_LL_SW_SPLIT help Use legacy advertising commands for mesh sending. Legacy - advertising is significantly slower than the extended advertising, but - is supported by all controllers. + advertising is significantly slower than the extended advertising. - WARNING: The legacy advertiser can occasionally do more message + WARNING: This feature is not supported in NCS. The legacy advertiser will not work + with SDC, as attempting to start an advertisement during the scanner duty cycle + will result in an error. The Zephyr Link Layer can be used experimentally as an + alternative. + The legacy advertiser can occasionally do more message retransmissions than requested because of limitations of HCI interface API. From a06f9582999650d0f950952b4799510871e23948 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Wed, 5 Jun 2024 13:37:34 +0100 Subject: [PATCH 0504/2141] [nrf noup] board: nordic: thingy53: Default to update only MCUboot type Changes the default MCUboot mode to update only for the thingy53, to align with previous bootloader builds Changes the thingy53 default configuration for sysbuild to enable using all RAM in the MCUboot image Signed-off-by: Jamie McCrae (cherry picked from commit af016f5a1c4ea251ba5078c17a8920d6153de0db) --- boards/nordic/thingy53/Kconfig.sysbuild | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/boards/nordic/thingy53/Kconfig.sysbuild b/boards/nordic/thingy53/Kconfig.sysbuild index c03d191b3708..df489c1dd546 100644 --- a/boards/nordic/thingy53/Kconfig.sysbuild +++ b/boards/nordic/thingy53/Kconfig.sysbuild @@ -7,6 +7,10 @@ choice BOOTLOADER default BOOTLOADER_MCUBOOT endchoice +choice MCUBOOT_MODE + default MCUBOOT_MODE_OVERWRITE_ONLY +endchoice + config SECURE_BOOT_NETCORE default y @@ -16,6 +20,9 @@ config NETCORE_APP_UPDATE config NRF_DEFAULT_EMPTY default y if SECURE_BOOT_NETCORE +config MCUBOOT_USE_ALL_AVAILABLE_RAM + default y if BOARD_THINGY53_NRF5340_CPUAPP_NS && BOOTLOADER_MCUBOOT + endif # BOARD_THINGY53_NRF5340_CPUAPP || BOARD_THINGY53_NRF5340_CPUAPP_NS config PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY From 470fcc9ac884ec9698e1d838160c7c3aadf706e0 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 12 Jun 2024 16:15:29 +0200 Subject: [PATCH 0505/2141] [nrf noup] samples: sysbuild: hello_world: support PM on nRF53 PM support is still required for nRF53/nRF54l15 in the context of NCS. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 528a23314ac20942e26818093739ab1550e1e288) --- samples/sysbuild/hello_world/sysbuild.cmake | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/samples/sysbuild/hello_world/sysbuild.cmake b/samples/sysbuild/hello_world/sysbuild.cmake index c7c2615c665a..8f8fc49dbff3 100644 --- a/samples/sysbuild/hello_world/sysbuild.cmake +++ b/samples/sysbuild/hello_world/sysbuild.cmake @@ -11,5 +11,17 @@ ExternalZephyrProject_Add( BOARD ${SB_CONFIG_REMOTE_BOARD} ) +if(SB_CONFIG_SOC_SERIES_NRF53X) + set_property(GLOBAL APPEND PROPERTY PM_DOMAINS CPUNET) + set_property(GLOBAL APPEND PROPERTY PM_CPUNET_IMAGES remote) + set_property(GLOBAL PROPERTY DOMAIN_APP_CPUNET remote) + set(CPUNET_PM_DOMAIN_DYNAMIC_PARTITION remote CACHE INTERNAL "") +else(SB_CONFIG_SOC_SERIES_NRF54LX) + set_property(GLOBAL APPEND PROPERTY PM_DOMAINS CPUFLPR) + set_property(GLOBAL APPEND PROPERTY PM_CPUFLPR_IMAGES remote) + set_property(GLOBAL PROPERTY DOMAIN_APP_CPUFLPR remote) + set(CPUFLPR_PM_DOMAIN_DYNAMIC_PARTITION remote CACHE INTERNAL "") +endif() + add_dependencies(${DEFAULT_IMAGE} remote) sysbuild_add_dependencies(FLASH ${DEFAULT_IMAGE} remote) From 1deb982783fff1ca9368fbe649123fbdeedfd304 Mon Sep 17 00:00:00 2001 From: Damian Krolik Date: Mon, 25 Sep 2023 16:41:15 +0200 Subject: [PATCH 0506/2141] [nrf noup] settings: nvs: use dedicated lookup cache hash function Introduce NVS_LOOKUP_CACHE_FOR_SETTINGS Kconfig option that enables a dedicated hash function for the NVS lookup cache that takes advantage of the NVS ID allocation scheme used by the NVS settings backend. As such, this option should only be used if an application uses NVS via the settings layer. Signed-off-by: Damian Krolik (cherry picked from commit aaa00db626046e5118aac5a7556f27c038b9169d) --- subsys/fs/nvs/Kconfig | 9 +++++++++ subsys/fs/nvs/nvs.c | 46 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/subsys/fs/nvs/Kconfig b/subsys/fs/nvs/Kconfig index 48915c2f048e..21798932f521 100644 --- a/subsys/fs/nvs/Kconfig +++ b/subsys/fs/nvs/Kconfig @@ -29,6 +29,15 @@ config NVS_LOOKUP_CACHE_SIZE Number of entries in Non-volatile Storage lookup cache. It is recommended that it be a power of 2. +config NVS_LOOKUP_CACHE_FOR_SETTINGS + bool "Non-volatile Storage lookup cache optimized for settings" + depends on NVS_LOOKUP_CACHE + help + Use the lookup cache hash function that results in the least number of + collissions and, in turn, the best NVS performance provided that the NVS + is used as the settings backend only. This option should NOT be enabled + if the NVS is also written to directly, outside the settings layer. + config NVS_DATA_CRC bool "Non-volatile Storage CRC protection on the data" help diff --git a/subsys/fs/nvs/nvs.c b/subsys/fs/nvs/nvs.c index 2e553fdbf554..103b605d5fcc 100644 --- a/subsys/fs/nvs/nvs.c +++ b/subsys/fs/nvs/nvs.c @@ -13,6 +13,11 @@ #include #include "nvs_priv.h" +#ifdef CONFIG_NVS_LOOKUP_CACHE_FOR_SETTINGS +#include +#include +#endif + #include LOG_MODULE_REGISTER(fs_nvs, CONFIG_NVS_LOG_LEVEL); @@ -21,6 +26,45 @@ static int nvs_ate_valid(struct nvs_fs *fs, const struct nvs_ate *entry); #ifdef CONFIG_NVS_LOOKUP_CACHE +#ifdef CONFIG_NVS_LOOKUP_CACHE_FOR_SETTINGS + +static inline size_t nvs_lookup_cache_pos(uint16_t id) +{ + /* + * 1. The NVS settings backend uses up to (NVS_NAME_ID_OFFSET - 1) NVS IDs to + store keys and equal number of NVS IDs to store values. + * 2. For each key-value pair, the value is stored at NVS ID greater by exactly + * NVS_NAME_ID_OFFSET than NVS ID that holds the key. + * 3. The backend tries to minimize the range of NVS IDs used to store keys. + * That is, NVS IDs are allocated sequentially, and freed NVS IDs are reused + * before allocating new ones. + * + * Therefore, to assure the least number of collisions in the lookup cache, + * the least significant bit of the hash indicates whether the given NVS ID + * represents a key or a value, and remaining bits of the hash are set to + * the ordinal number of the key-value pair. Consequently, the hash function + * provides the following mapping: + * + * 1st settings key => hash 0 + * 1st settings value => hash 1 + * 2nd settings key => hash 2 + * 2nd settings value => hash 3 + * ... + */ + BUILD_ASSERT(IS_POWER_OF_TWO(NVS_NAMECNT_ID), "NVS_NAMECNT_ID is not power of 2"); + BUILD_ASSERT(IS_POWER_OF_TWO(NVS_NAME_ID_OFFSET), "NVS_NAME_ID_OFFSET is not power of 2"); + + uint16_t key_value_bit; + uint16_t key_value_ord; + + key_value_bit = (id >> LOG2(NVS_NAME_ID_OFFSET)) & 1; + key_value_ord = id & (NVS_NAME_ID_OFFSET - 1); + + return ((key_value_ord << 1) | key_value_bit) % CONFIG_NVS_LOOKUP_CACHE_SIZE; +} + +#else /* CONFIG_NVS_LOOKUP_CACHE_FOR_SETTINGS */ + static inline size_t nvs_lookup_cache_pos(uint16_t id) { uint16_t hash; @@ -36,6 +80,8 @@ static inline size_t nvs_lookup_cache_pos(uint16_t id) return hash % CONFIG_NVS_LOOKUP_CACHE_SIZE; } +#endif /* CONFIG_NVS_LOOKUP_CACHE_FOR_SETTINGS */ + static int nvs_lookup_cache_rebuild(struct nvs_fs *fs) { int rc; From 4a163d030c88bc9d9a8c3f2069d4140d1f990d1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B8e?= Date: Fri, 24 May 2024 15:32:07 +0200 Subject: [PATCH 0507/2141] [nrf noup] soc: nordic: nrf54l: Skip clock configuration from ns MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Do not permit configuring clocks from non-secure as NRF_OSCILLATORS is a not supported as a non-secure peripheral Signed-off-by: Sebastian Bøe (cherry picked from commit 0099c2c667c8a0d2fc36c7c2a0020f5401fb3b39) --- soc/nordic/nrf54l/Kconfig | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/soc/nordic/nrf54l/Kconfig b/soc/nordic/nrf54l/Kconfig index 2d968a57bbe5..bc88a62efb7e 100644 --- a/soc/nordic/nrf54l/Kconfig +++ b/soc/nordic/nrf54l/Kconfig @@ -62,10 +62,18 @@ config SOC_NRF54LM20A_ENGA_CPUFLPR if SOC_SERIES_NRF54LX config SOC_NRF54LX_SKIP_CLOCK_CONFIG - bool "Skip clock frequency configuration in system initialization" + bool + prompt "Skip clock frequency configuration in system initialization" if TRUSTED_EXECUTION_SECURE + default y if TRUSTED_EXECUTION_NONSECURE help - With this option, the CPU clock frequency is not set during system initialization. - The CPU runs with the default, hardware-selected frequency. + With this option, the CPU clock frequency is not set during this + Zephyr image's system initialization. The CPU runs with either + the HW reset values, or with the configuration set by an image + earlier in the boot chain. + + Note that for security reasons it is not supported to configure + the clock peripheral (NRF_OSCILLATORS) from the non-secure + domain. config SOC_NRF54LX_DISABLE_FICR_TRIMCNF bool "Disable trimming of the device" From 7cf6f4fa8083e27ae79ba2c3160a870a1054380e Mon Sep 17 00:00:00 2001 From: Rubin Gerritsen Date: Mon, 8 Jul 2024 10:08:10 +0200 Subject: [PATCH 0508/2141] [nrf noup] ci: Enable action-manifest-pr This action will automatically manage a PR to sdk-nrf once a PR to sdk-zephyr is created. This includes: - Creating an initial PR - Updating and (optionally) rebase it once the PR to sdk-nrf is merged. The action can be disabled by adding the string "manifest-pr-skip" to the title or body of the PR. This will simplify cherry-picking changes from upstream zephyr. Signed-off-by: Rubin Gerritsen (cherry picked from commit 40f8ba3c9cbf667a5410e2a353bc6719978b763f) --- .github/workflows/manifest-PR.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/workflows/manifest-PR.yml diff --git a/.github/workflows/manifest-PR.yml b/.github/workflows/manifest-PR.yml new file mode 100644 index 000000000000..a871aa381ded --- /dev/null +++ b/.github/workflows/manifest-PR.yml @@ -0,0 +1,17 @@ +name: handle manifest PR +on: + pull_request_target: + types: [opened, synchronize, closed] + branches: + - main + + +jobs: + call-manifest-pr-action: + runs-on: ubuntu-latest + steps: + - name: handle manifest PR + uses: nrfconnect/action-manifest-pr@main + with: + token: ${{ secrets.NCS_GITHUB_TOKEN }} + manifest-pr-title-details: ${{ github.event.pull_request.title }} From 73823d3b105fd8547e1363ec07d91d0da1665ba1 Mon Sep 17 00:00:00 2001 From: Mateusz Michalek Date: Mon, 17 Jun 2024 14:57:09 +0200 Subject: [PATCH 0509/2141] [nrf noup] drivers: flash: kconfig: nrf_rram region resolution adjusting region resolution to match erase-block-size Signed-off-by: Mateusz Michalek (cherry picked from commit 743b21ba3cc6bbedd603d4ca22d9b7b52ecc1dc9) --- drivers/flash/Kconfig.nrf_rram | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/flash/Kconfig.nrf_rram b/drivers/flash/Kconfig.nrf_rram index 3dea687a0f80..a59560e86a46 100644 --- a/drivers/flash/Kconfig.nrf_rram +++ b/drivers/flash/Kconfig.nrf_rram @@ -70,14 +70,14 @@ config SOC_FLASH_NRF_TIMEOUT_MULTIPLIER config NRF_RRAM_REGION_ADDRESS_RESOLUTION hex - default 0x400 + default 0x1000 help RRAMC's region protection address resolution. Applies to region with configurable start address. config NRF_RRAM_REGION_SIZE_UNIT hex - default 0x400 + default 0x1000 help Base unit for the size of RRAMC's region protection. From 6f17dc3e1d057a260efb291a63f4d2d94cb94d6d Mon Sep 17 00:00:00 2001 From: Rubin Gerritsen Date: Tue, 16 Jul 2024 14:43:30 +0200 Subject: [PATCH 0510/2141] [nrf noup] dts: Add Bluetooth Controller to nRF54H20 The nRF54H20 supports a Bluetooth controller. The HCI driver interface has changed upstream in https://github.com/zephyrproject-rtos/zephyr/pull/72323 so now we need to add it to device tree. Signed-off-by: Rubin Gerritsen (cherry picked from commit e9a13c3d91f2ce76abcdb72c62455578fbf2257a) --- dts/arm/nordic/nrf54h20_cpurad.dtsi | 8 ++++++++ dts/vendor/nordic/nrf54h20.dtsi | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/dts/arm/nordic/nrf54h20_cpurad.dtsi b/dts/arm/nordic/nrf54h20_cpurad.dtsi index 2d2fdee8d270..2cfda47afc55 100644 --- a/dts/arm/nordic/nrf54h20_cpurad.dtsi +++ b/dts/arm/nordic/nrf54h20_cpurad.dtsi @@ -23,6 +23,10 @@ wdt011: &cpurad_wdt011 {}; /delete-node/ &cpuflpr; / { + chosen { + zephyr,bt-hci = &bt_hci_controller; + }; + soc { compatible = "simple-bus"; interrupt-parent = <&cpurad_nvic>; @@ -99,3 +103,7 @@ wdt011: &cpurad_wdt011 {}; &dppic020 { status = "okay"; }; + +&bt_hci_controller { + status = "okay"; +}; diff --git a/dts/vendor/nordic/nrf54h20.dtsi b/dts/vendor/nordic/nrf54h20.dtsi index 05ae6df5d0f6..8dcd8700b274 100644 --- a/dts/vendor/nordic/nrf54h20.dtsi +++ b/dts/vendor/nordic/nrf54h20.dtsi @@ -449,6 +449,14 @@ compatible = "nordic,nrf-ieee802154"; status = "disabled"; }; + + /* Note: In the nRF Connect SDK the SoftDevice Controller + * is added and set as the default Bluetooth Controller. + */ + bt_hci_controller: bt_hci_controller { + compatible = "zephyr,bt-hci-ll-sw-split"; + status = "disabled"; + }; }; ccm030: ccm@3a000 { From 5b9ea8c24b78a4be7e83f5cdbe1fead42b659f44 Mon Sep 17 00:00:00 2001 From: Marek Pieta Date: Fri, 14 Jun 2024 09:13:48 +0200 Subject: [PATCH 0511/2141] [nrf noup] bluetooth: att: Allow ATT sent callback after data TX is done By default, the BLE stack calls sent callback for ATT data when the data is passed to BLE controller for transmission. Enabling this Kconfig option delays calling the sent callback until data transmission is finished by BLE controller (the callback is delayed until receiving the num complete packets event). Jira: NCSDK-27422 Signed-off-by: Marek Pieta (cherry picked from commit 5cb2c90acf6bb72aa7098e27d9dba7eff9b96513) --- subsys/bluetooth/host/Kconfig.gatt | 17 +++++++++++++++++ subsys/bluetooth/host/att.c | 17 ++++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/subsys/bluetooth/host/Kconfig.gatt b/subsys/bluetooth/host/Kconfig.gatt index a04241a3e94f..221bc413c4bc 100644 --- a/subsys/bluetooth/host/Kconfig.gatt +++ b/subsys/bluetooth/host/Kconfig.gatt @@ -38,6 +38,23 @@ config BT_ATT_RETRY_ON_SEC_ERR If an ATT request fails due to insufficient security, the host will try to elevate the security level and retry the ATT request. +config BT_ATT_SENT_CB_AFTER_TX + bool "Delay ATT sent callback until data transmission is done by controller [EXPERIMENTAL]" + select EXPERIMENTAL + help + By default, the BLE stack calls sent callback for ATT data when the + data is passed to BLE controller for transmission. Enabling this + Kconfig option delays calling the sent callback until data + transmission is finished by BLE controller (the callback is called + upon receiving the Number of Completed Packets HCI Event). + + The feature is not available in Zephyr RTOS (it's specific to NCS + Zephyr fork). It is a temporary solution allowing to control flow of + GATT notifications with HID reports for HID use-case. + + Enabling this option may require increasing CONFIG_BT_CONN_TX_MAX in + configuration, because ATT would use additional TX contexts. + config BT_EATT bool "Enhanced ATT Bearers support [EXPERIMENTAL]" depends on BT_L2CAP_ECRED diff --git a/subsys/bluetooth/host/att.c b/subsys/bluetooth/host/att.c index 98b310f4b4b0..7fac12a6fb97 100644 --- a/subsys/bluetooth/host/att.c +++ b/subsys/bluetooth/host/att.c @@ -328,6 +328,13 @@ static void att_disconnect(struct bt_att_chan *chan) } } +static void chan_sent_cb(struct bt_conn *conn, void *user_data, int err) +{ + struct net_buf *nb = user_data; + + net_buf_unref(nb); +} + /* In case of success the ownership of the buffer is transferred to the stack * which takes care of releasing it when it completes transmitting to the * controller. @@ -421,7 +428,15 @@ static int chan_send(struct bt_att_chan *chan, struct net_buf *buf) data->att_chan = chan; - err = bt_l2cap_send_pdu(&chan->chan, buf, NULL, NULL); + if (IS_ENABLED(CONFIG_BT_ATT_SENT_CB_AFTER_TX)) { + err = bt_l2cap_send_pdu(&chan->chan, buf, chan_sent_cb, net_buf_ref(buf)); + if (err) { + net_buf_unref(buf); + } + } else { + err = bt_l2cap_send_pdu(&chan->chan, buf, NULL, NULL); + } + if (err) { if (err == -ENOBUFS) { LOG_ERR("Ran out of TX buffers or contexts."); From 20671bcf45981a4491aea49326e530978e79d792 Mon Sep 17 00:00:00 2001 From: Sigurd Hellesvik Date: Fri, 23 Aug 2024 11:24:06 +0200 Subject: [PATCH 0512/2141] [nrf noup] board: nordic_ thingy53: Enable QSPI by default The Thingy:53 enabled MCUboot and external flash by default. Therefore, it should also enable drivers for its external flash by default. Signed-off-by: Sigurd Hellesvik (cherry picked from commit d8ae490697223e96752af1a69dd0ded46a16c257) --- boards/nordic/thingy53/Kconfig.defconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/boards/nordic/thingy53/Kconfig.defconfig b/boards/nordic/thingy53/Kconfig.defconfig index badcb5c20e5d..b7f33e89bf1b 100644 --- a/boards/nordic/thingy53/Kconfig.defconfig +++ b/boards/nordic/thingy53/Kconfig.defconfig @@ -97,6 +97,9 @@ config MCUBOOT_USB_SUPPORT bool default n +config NORDIC_QSPI_NOR + default y + endif # BOARD_THINGY53_NRF5340_CPUAPP || BOARD_THINGY53_NRF5340_CPUAPP_NS if BOARD_THINGY53_NRF5340_CPUNET From a5b67c16269292d3f1f921238591cb8cb848c004 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Mon, 9 Sep 2024 08:31:03 +0100 Subject: [PATCH 0513/2141] [nrf noup] mgmt: mcumgr: grp: img_mgmt: Add handling for QSPI XIP Adds handling code to allow selecting the correct image slot when using QSPI XIP in DirectXIP mode In case of Direct XIP and multiple images, the radio active slot changes accordingly (i.e. application slot 1 boots radio slot 1). Signed-off-by: Jamie McCrae Signed-off-by: Tomasz Chyrowicz (cherry picked from commit eff40058cccbaaf4fd447b10aedb21856e2aa19e) --- subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig | 8 ++++++++ subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig b/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig index 0915d70e8706..5f122fcf71fc 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig @@ -219,6 +219,14 @@ config MCUMGR_GRP_IMG_SLOT_INFO_HOOKS This will enable the slot info function hooks which can be used to add additional information to responses. +config MCUMGR_GRP_IMG_QSPI_XIP_SPLIT_IMAGE + bool "QSPI XIP Split image mode" + depends on MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP + help + This option should not be selected by users and should automatically be selected by + sysbuild if needed. This enables selecting the correct slot when running a QSPI XIP + split image application in DirectXIP mode. + module = MCUMGR_GRP_IMG module-str = mcumgr_grp_img source "subsys/logging/Kconfig.template.log_config" diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c index d0303360f691..b53f1b214658 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c @@ -235,6 +235,14 @@ int img_mgmt_active_slot(int image) /* Multi image does not support DirectXIP or RAM load currently */ #if CONFIG_MCUMGR_GRP_IMG_UPDATABLE_IMAGE_NUMBER > 1 slot = (image << 1); + +#if defined(CONFIG_MCUMGR_GRP_IMG_QSPI_XIP_SPLIT_IMAGE) || \ + defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP) || \ + defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP_WITH_REVERT) + if (FIXED_PARTITION_IS_RUNNING_APP_PARTITION(slot1_partition)) { + slot += 1; + } +#endif #elif defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_RAM_LOAD) /* RAM load requires querying bootloader */ int rc; From cea66ec75f604cbdc74f67165cb50ea478c716cd Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Mon, 16 Sep 2024 15:09:50 +0200 Subject: [PATCH 0514/2141] [nrf noup] boards/nordic/nrf54l15dk: Set ROM offset by PM While Partition Manager is enabled, it manages the offset by itself. Signed-off-by: Andrzej Puzdrowski (cherry picked from commit 8e130db2d12ee6d27e040667fc2cd12b695b3bcc) --- boards/nordic/nrf54l15dk/Kconfig.defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/boards/nordic/nrf54l15dk/Kconfig.defconfig b/boards/nordic/nrf54l15dk/Kconfig.defconfig index 0661366e911d..fb63aaecb441 100644 --- a/boards/nordic/nrf54l15dk/Kconfig.defconfig +++ b/boards/nordic/nrf54l15dk/Kconfig.defconfig @@ -8,6 +8,7 @@ if BOARD_NRF54L15DK_NRF54L05_CPUAPP || BOARD_NRF54L15DK_NRF54L10_CPUAPP || \ BOARD_NRF54L15DK_NRF54L15_CPUAPP config ROM_START_OFFSET + default 0 if PARTITION_MANAGER_ENABLED default 0x800 if BOOTLOADER_MCUBOOT endif # BOARD_NRF54L15DK_NRF54L05_CPUAPP || BOARD_NRF54L15DK_NRF54L10_CPUAPP || \ From 40b222de413d542f187f039da8eb1e9e3d9a359d Mon Sep 17 00:00:00 2001 From: Jakub Zymelka Date: Thu, 26 Sep 2024 12:40:33 +0200 Subject: [PATCH 0515/2141] [nrf noup] samples: basic: blinky: add eGPIO tests configuration Add overlay for nrf54l15dk to enable eGPIO tests. Signed-off-by: Jakub Zymelka Signed-off-by: Marcin Szymczyk (cherry picked from commit cdbdb2694501f0e2b20433787b4bfd3e461a4fc4) --- .../boards/nrf54l15dk_nrf54l15_cpuapp_hpf_gpio.overlay | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 samples/basic/blinky/boards/nrf54l15dk_nrf54l15_cpuapp_hpf_gpio.overlay diff --git a/samples/basic/blinky/boards/nrf54l15dk_nrf54l15_cpuapp_hpf_gpio.overlay b/samples/basic/blinky/boards/nrf54l15dk_nrf54l15_cpuapp_hpf_gpio.overlay new file mode 100644 index 000000000000..bd1ceb2f8945 --- /dev/null +++ b/samples/basic/blinky/boards/nrf54l15dk_nrf54l15_cpuapp_hpf_gpio.overlay @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +&led0 { + gpios = <&hpf_gpio 9 GPIO_ACTIVE_HIGH>; +}; From c62b6ebb411e687814e89652273b333a4b47bbae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Audun=20Kvamtr=C3=B8?= Date: Wed, 11 Sep 2024 10:17:28 +0200 Subject: [PATCH 0516/2141] [nrf noup] modules: mbedtls: Disable configurations in Kconfig.tls-generic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -This commit prevents legacy mbed TLS configurations from being in conflict with PSA Configurations while using nrf_security. -This [nrf noup] is reworked from an earlier cherry-pick of commit d8c96cfab37d3738dac933075780f6ca24593447, but has the following changes: - Endif's relevant that is using our pattern for masking configs duplicated or in conflict in nrf_security (by using if !(NRF_SECURITY || NORDIC_SECURITY_BACKEND)) is made clearer by adding a comment at their corresponding endif (# !(NRF_SECURITY || NORDIC_SECURITY_BACKEND)) - Changes to zephyr_init.c for entropy_dev checking for CONFIG_NRF_CC3XX_PLATFORM is removed as the symbol entropy_dev doesn't exist in this file anymore ref: NCSDK-13503 Signed-off-by: Frank Audun Kvamtrø (cherry picked from commit 9e06da7a9d5d0aee5440d14d8a585a9e01f349fd) --- modules/mbedtls/Kconfig.mbedtls | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/modules/mbedtls/Kconfig.mbedtls b/modules/mbedtls/Kconfig.mbedtls index e534ba0c10a8..b4c5f48a4287 100644 --- a/modules/mbedtls/Kconfig.mbedtls +++ b/modules/mbedtls/Kconfig.mbedtls @@ -7,6 +7,8 @@ menu "Mbed TLS configuration" depends on MBEDTLS_BUILTIN && MBEDTLS_CFG_FILE = "config-mbedtls.h" +if !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) + menu "TLS" config MBEDTLS_TLS_VERSION_1_2 @@ -40,6 +42,8 @@ endif # MBEDTLS_TLS_VERSION_1_2 || MBEDTLS_TLS_VERSION_1_3 endmenu # TLS +endif # !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) + menu "Ciphersuite configuration" comment "Supported key exchange modes" @@ -60,6 +64,8 @@ config MBEDTLS_GENPRIME_ENABLED endif # MBEDTLS_RSA_C +if !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) + config MBEDTLS_KEY_EXCHANGE_ALL_ENABLED bool "All available ciphersuite modes" select MBEDTLS_MD @@ -92,6 +98,8 @@ config MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED bool "RSA-PSK based ciphersuite modes" depends on MBEDTLS_PKCS1_V15 || MBEDTLS_PKCS1_V21 +endif # !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) + config MBEDTLS_PSK_MAX_LEN int "Max size of TLS pre-shared keys" default 32 @@ -99,6 +107,8 @@ config MBEDTLS_PSK_MAX_LEN Max size of TLS pre-shared keys, in bytes. It has no effect if no PSK key exchange is used. +if !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) + config MBEDTLS_KEY_EXCHANGE_RSA_ENABLED bool "RSA-only based ciphersuite modes" depends on MBEDTLS_MD @@ -236,8 +246,12 @@ config MBEDTLS_ECP_NIST_OPTIM endif +endif # !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) + comment "Supported ciphers and cipher modes" +if !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) + config MBEDTLS_CIPHER_ALL_ENABLED bool "All available ciphers and modes" select MBEDTLS_CIPHER_AES_ENABLED @@ -328,8 +342,12 @@ config MBEDTLS_CMAC bool "CMAC (Cipher-based Message Authentication Code) mode for block ciphers." depends on MBEDTLS_CIPHER_AES_ENABLED || MBEDTLS_CIPHER_DES_ENABLED +endif # !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) + comment "Supported hash algorithms" +if !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) + config MBEDTLS_HASH_ALL_ENABLED bool "All available MAC methods" select MBEDTLS_MD5 @@ -370,10 +388,14 @@ config MBEDTLS_SHA512 config MBEDTLS_POLY1305 bool "Poly1305 hash family" +endif # !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) + endmenu comment "Random number generators" +if !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) + config MBEDTLS_CTR_DRBG_ENABLED bool "CTR_DRBG AES-256-based random generator" depends on MBEDTLS_CIPHER_AES_ENABLED @@ -383,15 +405,21 @@ config MBEDTLS_HMAC_DRBG_ENABLED bool "HMAC_DRBG random generator" select MBEDTLS_MD +endif # !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) + comment "Other configurations" config MBEDTLS_CIPHER bool "generic cipher layer." default y if PSA_WANT_ALG_CMAC +if !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) + config MBEDTLS_MD bool "generic message digest layer." +endif # !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) + config MBEDTLS_ASN1_PARSE_C bool "Support for ASN1 parser functions" @@ -431,6 +459,8 @@ config MBEDTLS_HAVE_ASM of asymmetric cryptography, however this might have an impact on the code size. +if !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) + config MBEDTLS_ENTROPY_C bool "Mbed TLS entropy accumulator" depends on MBEDTLS_SHA256 || MBEDTLS_SHA384 || MBEDTLS_SHA512 @@ -439,6 +469,8 @@ config MBEDTLS_ENTROPY_C mostly used in conjunction with CTR_DRBG or HMAC_DRBG to create a deterministic random number generator. +endif # !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) + config MBEDTLS_ENTROPY_POLL_ZEPHYR bool "Provide entropy data to Mbed TLS through entropy driver or random generator" default y From 3c07722fbc78e7432f561696e82bf77982f4550a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Audun=20Kvamtr=C3=B8?= Date: Mon, 9 Sep 2024 14:55:05 +0200 Subject: [PATCH 0517/2141] [nrf noup] mbedtls: Enable PSA_WANT_GENERATE_RANDOM for PSA RNG MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -This is a [nrf noup] because PSA_WANT_GENERATE_RANDOM is a Nordic configuration that is not found upstream. This was previously in commit 5cfe5750b622efff77427425bf61854a95ade9fb but has been split out Signed-off-by: Frank Audun Kvamtrø (cherry picked from commit 2a84cc8ff478c316b8aad8f3ab0b943022e846f6) --- drivers/entropy/Kconfig.psa_crypto | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/entropy/Kconfig.psa_crypto b/drivers/entropy/Kconfig.psa_crypto index d06001225b05..18514a071d1c 100644 --- a/drivers/entropy/Kconfig.psa_crypto +++ b/drivers/entropy/Kconfig.psa_crypto @@ -7,6 +7,7 @@ config ENTROPY_PSA_CRYPTO_RNG bool "PSA Crypto Random source Entropy driver" depends on DT_HAS_ZEPHYR_PSA_CRYPTO_RNG_ENABLED select ENTROPY_HAS_DRIVER + select PSA_WANT_GENERATE_RANDOM default y help Enable the PSA Crypto source Entropy driver. From 32fa048131dc1eb8dd223c99c3e40649efb720bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Audun=20Kvamtr=C3=B8?= Date: Wed, 21 Aug 2024 12:35:25 +0200 Subject: [PATCH 0518/2141] [nrf noup] mbedtls: Remove unsupported algorithms in PSA crypto MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -This commit is a [nrf noup] because it removes configuration options for cryptographic algortihms available in Mbed TLS but which is not actively supported in nRF Connect SDK. The list of algorithms removed: - AES CFB - Cipher Feedback block cipher - AES OFB - Output Feedback block cipher - FFDH - RIPEMD160 - Aria - Camellia - DES The removal of these algorithms is based both on a wish to remove weaker cryptography and unsupported features in the products we have today. Signed-off-by: Frank Audun Kvamtrø (cherry picked from commit f0c625315be60b1cf2ef710623f3c1b21cea01c8) --- modules/mbedtls/Kconfig.psa.auto | 61 ------------------------------- modules/mbedtls/Kconfig.psa.logic | 7 ---- 2 files changed, 68 deletions(-) diff --git a/modules/mbedtls/Kconfig.psa.auto b/modules/mbedtls/Kconfig.psa.auto index 08b1bbc02410..56a81dd6efda 100644 --- a/modules/mbedtls/Kconfig.psa.auto +++ b/modules/mbedtls/Kconfig.psa.auto @@ -36,10 +36,6 @@ config PSA_WANT_ALG_CMAC bool "PSA_WANT_ALG_CMAC" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL -config PSA_WANT_ALG_CFB - bool "PSA_WANT_ALG_CFB" if !MBEDTLS_PROMPTLESS - default y if PSA_CRYPTO_ENABLE_ALL - config PSA_WANT_ALG_CHACHA20_POLY1305 bool "PSA_WANT_ALG_CHACHA20_POLY1305" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL @@ -60,10 +56,6 @@ config PSA_WANT_ALG_ECDH bool "PSA_WANT_ALG_ECDH" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL -config PSA_WANT_ALG_FFDH - bool "PSA_WANT_ALG_FFDH" if !MBEDTLS_PROMPTLESS - default y if PSA_CRYPTO_ENABLE_ALL - config PSA_WANT_ALG_ECDSA bool "PSA_WANT_ALG_ECDSA" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL @@ -96,9 +88,6 @@ config PSA_WANT_ALG_MD5 bool "PSA_WANT_ALG_MD5" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL -config PSA_WANT_ALG_OFB - bool "PSA_WANT_ALG_OFB" if !MBEDTLS_PROMPTLESS - default y if PSA_CRYPTO_ENABLE_ALL config PSA_WANT_ALG_PBKDF2_HMAC bool "PSA_WANT_ALG_PBKDF2_HMAC" if !MBEDTLS_PROMPTLESS @@ -108,9 +97,6 @@ config PSA_WANT_ALG_PBKDF2_AES_CMAC_PRF_128 bool "PSA_WANT_ALG_PBKDF2_AES_CMAC_PRF_128" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL -config PSA_WANT_ALG_RIPEMD160 - bool "PSA_WANT_ALG_RIPEMD160" if !MBEDTLS_PROMPTLESS - default y if PSA_CRYPTO_ENABLE_ALL config PSA_WANT_ALG_RSA_OAEP bool "PSA_WANT_ALG_RSA_OAEP" if !MBEDTLS_PROMPTLESS @@ -228,26 +214,6 @@ config PSA_WANT_ECC_SECP_R1_521 bool "PSA_WANT_ECC_SECP_R1_521" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL -config PSA_WANT_DH_RFC7919_2048 - bool "PSA_WANT_DH_RFC7919_2048" if !MBEDTLS_PROMPTLESS - default y if PSA_CRYPTO_ENABLE_ALL - -config PSA_WANT_DH_RFC7919_3072 - bool "PSA_WANT_DH_RFC7919_3072" if !MBEDTLS_PROMPTLESS - default y if PSA_CRYPTO_ENABLE_ALL - -config PSA_WANT_DH_RFC7919_4096 - bool "PSA_WANT_DH_RFC7919_4096" if !MBEDTLS_PROMPTLESS - default y if PSA_CRYPTO_ENABLE_ALL - -config PSA_WANT_DH_RFC7919_6144 - bool "PSA_WANT_DH_RFC7919_6144" if !MBEDTLS_PROMPTLESS - default y if PSA_CRYPTO_ENABLE_ALL - -config PSA_WANT_DH_RFC7919_8192 - bool "PSA_WANT_DH_RFC7919_8192" if !MBEDTLS_PROMPTLESS - default y if PSA_CRYPTO_ENABLE_ALL - config PSA_WANT_KEY_TYPE_DERIVE bool "PSA_WANT_KEY_TYPE_DERIVE" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL @@ -268,30 +234,15 @@ config PSA_WANT_KEY_TYPE_AES bool "PSA_WANT_KEY_TYPE_AES" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL -config PSA_WANT_KEY_TYPE_ARIA - bool "PSA_WANT_KEY_TYPE_ARIA" if !MBEDTLS_PROMPTLESS - default y if PSA_CRYPTO_ENABLE_ALL - -config PSA_WANT_KEY_TYPE_CAMELLIA - bool "PSA_WANT_KEY_TYPE_CAMELLIA" if !MBEDTLS_PROMPTLESS - default y if PSA_CRYPTO_ENABLE_ALL - config PSA_WANT_KEY_TYPE_CHACHA20 bool "PSA_WANT_KEY_TYPE_CHACHA20" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL -config PSA_WANT_KEY_TYPE_DES - bool "PSA_WANT_KEY_TYPE_DES" if !MBEDTLS_PROMPTLESS - default y if PSA_CRYPTO_ENABLE_ALL config PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY bool "PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL -config PSA_WANT_KEY_TYPE_DH_PUBLIC_KEY - bool "PSA_WANT_KEY_TYPE_DH_PUBLIC_KEY" if !MBEDTLS_PROMPTLESS - default y if PSA_CRYPTO_ENABLE_ALL - config PSA_WANT_KEY_TYPE_RAW_DATA bool "PSA_WANT_KEY_TYPE_RAW_DATA" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL @@ -328,16 +279,4 @@ config PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_GENERATE bool "PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_GENERATE" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL -config PSA_WANT_KEY_TYPE_DH_KEY_PAIR_IMPORT - bool "PSA_WANT_KEY_TYPE_DH_KEY_PAIR_IMPORT" if !MBEDTLS_PROMPTLESS - default y if PSA_CRYPTO_ENABLE_ALL - -config PSA_WANT_KEY_TYPE_DH_KEY_PAIR_EXPORT - bool "PSA_WANT_KEY_TYPE_DH_KEY_PAIR_EXPORT" if !MBEDTLS_PROMPTLESS - default y if PSA_CRYPTO_ENABLE_ALL - -config PSA_WANT_KEY_TYPE_DH_KEY_PAIR_GENERATE - bool "PSA_WANT_KEY_TYPE_DH_KEY_PAIR_GENERATE" if !MBEDTLS_PROMPTLESS - default y if PSA_CRYPTO_ENABLE_ALL - endif # PSA_CRYPTO_CLIENT diff --git a/modules/mbedtls/Kconfig.psa.logic b/modules/mbedtls/Kconfig.psa.logic index dcea9e354052..2de81163dc1f 100644 --- a/modules/mbedtls/Kconfig.psa.logic +++ b/modules/mbedtls/Kconfig.psa.logic @@ -18,10 +18,3 @@ config PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_BASIC depends on PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_IMPORT || \ PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_EXPORT || \ PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_GENERATE - -config PSA_WANT_KEY_TYPE_DH_KEY_PAIR_BASIC - bool - default y - depends on PSA_WANT_KEY_TYPE_DH_KEY_PAIR_IMPORT || \ - PSA_WANT_KEY_TYPE_DH_KEY_PAIR_EXPORT || \ - PSA_WANT_KEY_TYPE_DH_KEY_PAIR_GENERATE From 2abfddff4d8f12849a31dd0842e0a7a07825847e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Audun=20Kvamtr=C3=B8?= Date: Wed, 21 Aug 2024 12:49:58 +0200 Subject: [PATCH 0519/2141] [nrf noup] mbedtls: Add dependency logic for PSA crypto configurations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -This is a [nrf noup] as this the upstream version of PSA crypto configs is generated by tooling, and there is no mechanisms to qualify that dependent configurations are enabled (by depends or select). -This adds dependency-mapping between configurations in the Kconfigs added for PSA crypto in upstream. -Selecting CHACHA20 key type if PSA_WANT_ALG_STREAM_CIPHER is enabled Signed-off-by: Frank Audun Kvamtrø (cherry picked from commit abe10414258f8f0732d2b04bc62d2310418a1643) --- modules/mbedtls/Kconfig.psa.auto | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/modules/mbedtls/Kconfig.psa.auto b/modules/mbedtls/Kconfig.psa.auto index 56a81dd6efda..fa8cdbc7b536 100644 --- a/modules/mbedtls/Kconfig.psa.auto +++ b/modules/mbedtls/Kconfig.psa.auto @@ -71,6 +71,7 @@ config PSA_WANT_ALG_GCM config PSA_WANT_ALG_HKDF bool "PSA_WANT_ALG_HKDF" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL + depends on PSA_WANT_ALG_HMAC config PSA_WANT_ALG_HKDF_EXTRACT bool "PSA_WANT_ALG_HKDF_EXTRACT" if !MBEDTLS_PROMPTLESS @@ -92,11 +93,12 @@ config PSA_WANT_ALG_MD5 config PSA_WANT_ALG_PBKDF2_HMAC bool "PSA_WANT_ALG_PBKDF2_HMAC" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL + depends on PSA_WANT_ALG_HMAC config PSA_WANT_ALG_PBKDF2_AES_CMAC_PRF_128 bool "PSA_WANT_ALG_PBKDF2_AES_CMAC_PRF_128" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL - + depends on PSA_WANT_ALG_CMAC config PSA_WANT_ALG_RSA_OAEP bool "PSA_WANT_ALG_RSA_OAEP" if !MBEDTLS_PROMPTLESS @@ -153,18 +155,22 @@ config PSA_WANT_ALG_SHA3_512 config PSA_WANT_ALG_STREAM_CIPHER bool "PSA_WANT_ALG_STREAM_CIPHER" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL + select PSA_WANT_KEY_TYPE_CHACHA20 config PSA_WANT_ALG_TLS12_PRF bool "PSA_WANT_ALG_TLS12_PRF" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL + depends on PSA_WANT_ALG_HMAC config PSA_WANT_ALG_TLS12_PSK_TO_MS bool "PSA_WANT_ALG_TLS12_PSK_TO_MS" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL + depends on PSA_WANT_ALG_HMAC config PSA_WANT_ALG_TLS12_ECJPAKE_TO_PMS bool "PSA_WANT_ALG_TLS12_ECJPAKE_TO_PMS" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL + depends on PSA_WANT_ALG_SHA_256 config PSA_WANT_ECC_BRAINPOOL_P_R1_256 bool "PSA_WANT_ECC_BRAINPOOL_P_R1_256" if !MBEDTLS_PROMPTLESS @@ -237,7 +243,8 @@ config PSA_WANT_KEY_TYPE_AES config PSA_WANT_KEY_TYPE_CHACHA20 bool "PSA_WANT_KEY_TYPE_CHACHA20" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL - + depends on PSA_WANT_ALG_CHACHA20_POLY1305 || \ + PSA_WANT_ALG_STREAM_CIPHER config PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY bool "PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY" if !MBEDTLS_PROMPTLESS @@ -253,30 +260,37 @@ config PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY config PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT bool "PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT" if !MBEDTLS_PROMPTLESS + select PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY default y if PSA_CRYPTO_ENABLE_ALL config PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_EXPORT bool "PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_EXPORT" if !MBEDTLS_PROMPTLESS + select PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY default y if PSA_CRYPTO_ENABLE_ALL config PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_GENERATE bool "PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_GENERATE" if !MBEDTLS_PROMPTLESS + select PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY default y if PSA_CRYPTO_ENABLE_ALL config PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_DERIVE bool "PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_DERIVE" if !MBEDTLS_PROMPTLESS + select PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY default y if PSA_CRYPTO_ENABLE_ALL config PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_IMPORT bool "PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_IMPORT" if !MBEDTLS_PROMPTLESS + select PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY default y if PSA_CRYPTO_ENABLE_ALL config PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_EXPORT bool "PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_EXPORT" if !MBEDTLS_PROMPTLESS + select PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY default y if PSA_CRYPTO_ENABLE_ALL config PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_GENERATE bool "PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_GENERATE" if !MBEDTLS_PROMPTLESS + select PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY default y if PSA_CRYPTO_ENABLE_ALL endif # PSA_CRYPTO_CLIENT From 76dee8cd798e036c3d034df18006e06c1b9431f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Audun=20Kvamtr=C3=B8?= Date: Wed, 21 Aug 2024 12:53:27 +0200 Subject: [PATCH 0520/2141] [nrf noup] mbedtls: Adding helptext warnings for weak crypto MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -This commit is a [nrf noup] because PSA crypto configs in upstream Zephyr doesn't have help-text in their configurations and we don't want to duplicate configurations to control the value -This adds warning for SHA-1 and MD5 usage Signed-off-by: Frank Audun Kvamtrø (cherry picked from commit e4e16eb0a4e73f5177c290bdf99690cbb41ab2bc) --- modules/mbedtls/Kconfig.psa.auto | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/mbedtls/Kconfig.psa.auto b/modules/mbedtls/Kconfig.psa.auto index fa8cdbc7b536..834252432b52 100644 --- a/modules/mbedtls/Kconfig.psa.auto +++ b/modules/mbedtls/Kconfig.psa.auto @@ -88,7 +88,9 @@ config PSA_WANT_ALG_HMAC config PSA_WANT_ALG_MD5 bool "PSA_WANT_ALG_MD5" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL - + help + Warning: The MD5 hash is weak and deprecated and is only recommended + for use in legacy protocols. config PSA_WANT_ALG_PBKDF2_HMAC bool "PSA_WANT_ALG_PBKDF2_HMAC" if !MBEDTLS_PROMPTLESS @@ -119,6 +121,9 @@ config PSA_WANT_ALG_RSA_PSS config PSA_WANT_ALG_SHA_1 bool "PSA_WANT_ALG_SHA_1" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL + help + Warning: The SHA-1 hash is weak and deprecated and is only recommended + for use in legacy protocols. config PSA_WANT_ALG_SHA_224 bool "PSA_WANT_ALG_SHA_224" if !MBEDTLS_PROMPTLESS From 414a6c3008ad17b54a22682962c6eddfa47d6368 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Audun=20Kvamtr=C3=B8?= Date: Wed, 21 Aug 2024 12:56:48 +0200 Subject: [PATCH 0521/2141] [nrf noup] mbedtls: Adding missing configuration for RSA key type derive MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -This is a [nrf noup] because the upstream Zephyr is generated using a script and is not committed as-is as source-code. The relevant responsible person for this feature has received information about the missing configuration and this will be resolved upstream in Mbed TLS and will propagate down to zephyr. Once this has happened, this [nrf noup] can be dropped. -Add missing PSA_WANT_KEY_TYPE_RSA_KEY_DERIVE Signed-off-by: Frank Audun Kvamtrø (cherry picked from commit 6ce5d2f3419389151eff23b5ac1dc3f8636f65dc) --- modules/mbedtls/Kconfig.psa.auto | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/mbedtls/Kconfig.psa.auto b/modules/mbedtls/Kconfig.psa.auto index 834252432b52..b235c30380fb 100644 --- a/modules/mbedtls/Kconfig.psa.auto +++ b/modules/mbedtls/Kconfig.psa.auto @@ -298,4 +298,9 @@ config PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_GENERATE select PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY default y if PSA_CRYPTO_ENABLE_ALL +config PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_DERIVE + bool "PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_DERIVE" if !MBEDTLS_PROMPTLESS + select PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY + default y if PSA_CRYPTO_ENABLE_ALL + endif # PSA_CRYPTO_CLIENT From 34341c43b31bb2c60c84b98e4322b465edd0e433 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Audun=20Kvamtr=C3=B8?= Date: Thu, 5 Sep 2024 15:05:43 +0200 Subject: [PATCH 0522/2141] [nrf noup] mbedtls: Don't select PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_BASIC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_BASIC is internally resolved by Mbed TLS. It has been made promptless in a previous commit. Keeping this change separated since the Kconfig.psa is auto-generated and it would likely be a bit more complex to handle this in a single commit. Upstream maintainers have been notified about this mismatch in configurations. Signed-off-by: Frank Audun Kvamtrø (cherry picked from commit 1a18abd48bf7893e9980983c377e35f66658704a) --- modules/mbedtls/Kconfig.mbedtls | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/mbedtls/Kconfig.mbedtls b/modules/mbedtls/Kconfig.mbedtls index b4c5f48a4287..7b5122670e5e 100644 --- a/modules/mbedtls/Kconfig.mbedtls +++ b/modules/mbedtls/Kconfig.mbedtls @@ -117,6 +117,7 @@ config MBEDTLS_KEY_EXCHANGE_RSA_ENABLED select PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_IMPORT if PSA_CRYPTO_CLIENT select PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_EXPORT if PSA_CRYPTO_CLIENT select PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_GENERATE if PSA_CRYPTO_CLIENT + select PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_DERIVE if PSA_CRYPTO_CLIENT config MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED bool "DHE-RSA based ciphersuite modes" From 717e659b48410693135e5e630579ab4671633cb7 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Tue, 7 May 2024 08:27:09 +0100 Subject: [PATCH 0523/2141] [nrf noup] kernel: banner: Make function weak Makes the boot banner function weak, this resolves an issue when building with llext enabled which uses different build options than a normal zephyr build Signed-off-by: Jamie McCrae (cherry picked from commit 461df8cfcccfc0d882eeecb05ac097300e465c9a) --- kernel/banner.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/banner.c b/kernel/banner.c index 5cadda0a5e98..a16784cb975c 100644 --- a/kernel/banner.c +++ b/kernel/banner.c @@ -24,7 +24,7 @@ #endif /* BUILD_VERSION */ #endif /* !BANNER_VERSION */ -void boot_banner(void) +__weak void boot_banner(void) { #if defined(CONFIG_BOOT_DELAY) && (CONFIG_BOOT_DELAY > 0) #ifdef CONFIG_BOOT_BANNER From f52f65458f060758f18daf2b572383b6938eceae Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Fri, 20 Sep 2024 14:48:37 +0200 Subject: [PATCH 0524/2141] [nrf noup] lib: os: zvfs: Remove EXPERIMENTAL from ZVFS Although ZVFS is experimental, the warning is annoying the matter team. Therefore, remove the experimental selection. This may be reverted once upstream unselects experimental. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit 835d5454624b920df6451a699de67617d2491744) --- lib/os/zvfs/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/os/zvfs/Kconfig b/lib/os/zvfs/Kconfig index a9c9518a1d5d..495d5c849685 100644 --- a/lib/os/zvfs/Kconfig +++ b/lib/os/zvfs/Kconfig @@ -6,7 +6,6 @@ menuconfig ZVFS bool "Zephyr virtual filesystem (ZVFS) support [EXPERIMENTAL]" select FDTABLE - select EXPERIMENTAL help ZVFS is a central, Zephyr-native library that provides a common interoperable API for all types of file descriptors such as those from the non-virtual FS, sockets, eventfds, FILE *'s From ccf6152219b7547248f52b752f19f770ad444c66 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Mon, 7 Oct 2024 15:36:43 +0200 Subject: [PATCH 0525/2141] [nrf noup] samples: net: Enable Wi-Fi driver in sysbuild builds Make sure Wi-Fi driver is enabled in networking samples supporting Wi-Fi when sysbuild is used. For shields we cannot automate this, as sysbuild doesn't recognize shields, so, Wi-Fi has to be explicitly enabled, this is done for twister in Wi-Fi sample. Signed-off-by: Robert Lubos Signed-off-by: Chaitanya Tata (cherry picked from commit 48f4e3bb9d0b746d126733b40e152d92cdea7319) --- samples/net/dns_resolve/Kconfig.sysbuild | 13 +++++++++++++ samples/net/ipv4_autoconf/Kconfig.sysbuild | 13 +++++++++++++ samples/net/lwm2m_client/Kconfig.sysbuild | 13 +++++++++++++ samples/net/mdns_responder/Kconfig.sysbuild | 13 +++++++++++++ samples/net/mqtt_publisher/Kconfig.sysbuild | 13 +++++++++++++ samples/net/mqtt_sn_publisher/Kconfig.sysbuild | 13 +++++++++++++ samples/net/sockets/coap_server/Kconfig.sysbuild | 13 +++++++++++++ samples/net/sockets/echo_async/Kconfig.sysbuild | 13 +++++++++++++ samples/net/sockets/echo_client/Kconfig.sysbuild | 13 +++++++++++++ samples/net/sockets/echo_server/Kconfig.sysbuild | 13 +++++++++++++ samples/net/sockets/http_get/Kconfig.sysbuild | 13 +++++++++++++ samples/net/sockets/sntp_client/Kconfig.sysbuild | 13 +++++++++++++ samples/net/syslog_net/Kconfig.sysbuild | 13 +++++++++++++ samples/net/telnet/Kconfig.sysbuild | 13 +++++++++++++ samples/net/wifi/Kconfig.sysbuild | 13 +++++++++++++ samples/net/wifi/shell/sample.yaml | 2 ++ 16 files changed, 197 insertions(+) create mode 100644 samples/net/dns_resolve/Kconfig.sysbuild create mode 100644 samples/net/ipv4_autoconf/Kconfig.sysbuild create mode 100644 samples/net/lwm2m_client/Kconfig.sysbuild create mode 100644 samples/net/mdns_responder/Kconfig.sysbuild create mode 100644 samples/net/mqtt_publisher/Kconfig.sysbuild create mode 100644 samples/net/mqtt_sn_publisher/Kconfig.sysbuild create mode 100644 samples/net/sockets/coap_server/Kconfig.sysbuild create mode 100644 samples/net/sockets/echo_async/Kconfig.sysbuild create mode 100644 samples/net/sockets/echo_client/Kconfig.sysbuild create mode 100644 samples/net/sockets/echo_server/Kconfig.sysbuild create mode 100644 samples/net/sockets/http_get/Kconfig.sysbuild create mode 100644 samples/net/sockets/sntp_client/Kconfig.sysbuild create mode 100644 samples/net/syslog_net/Kconfig.sysbuild create mode 100644 samples/net/telnet/Kconfig.sysbuild create mode 100644 samples/net/wifi/Kconfig.sysbuild diff --git a/samples/net/dns_resolve/Kconfig.sysbuild b/samples/net/dns_resolve/Kconfig.sysbuild new file mode 100644 index 000000000000..158551060c56 --- /dev/null +++ b/samples/net/dns_resolve/Kconfig.sysbuild @@ -0,0 +1,13 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 +# + +config WIFI_NRF70 + default y if BOARD_NRF7002DK_NRF5340_CPUAPP || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS + +source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/samples/net/ipv4_autoconf/Kconfig.sysbuild b/samples/net/ipv4_autoconf/Kconfig.sysbuild new file mode 100644 index 000000000000..158551060c56 --- /dev/null +++ b/samples/net/ipv4_autoconf/Kconfig.sysbuild @@ -0,0 +1,13 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 +# + +config WIFI_NRF70 + default y if BOARD_NRF7002DK_NRF5340_CPUAPP || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS + +source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/samples/net/lwm2m_client/Kconfig.sysbuild b/samples/net/lwm2m_client/Kconfig.sysbuild new file mode 100644 index 000000000000..158551060c56 --- /dev/null +++ b/samples/net/lwm2m_client/Kconfig.sysbuild @@ -0,0 +1,13 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 +# + +config WIFI_NRF70 + default y if BOARD_NRF7002DK_NRF5340_CPUAPP || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS + +source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/samples/net/mdns_responder/Kconfig.sysbuild b/samples/net/mdns_responder/Kconfig.sysbuild new file mode 100644 index 000000000000..158551060c56 --- /dev/null +++ b/samples/net/mdns_responder/Kconfig.sysbuild @@ -0,0 +1,13 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 +# + +config WIFI_NRF70 + default y if BOARD_NRF7002DK_NRF5340_CPUAPP || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS + +source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/samples/net/mqtt_publisher/Kconfig.sysbuild b/samples/net/mqtt_publisher/Kconfig.sysbuild new file mode 100644 index 000000000000..158551060c56 --- /dev/null +++ b/samples/net/mqtt_publisher/Kconfig.sysbuild @@ -0,0 +1,13 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 +# + +config WIFI_NRF70 + default y if BOARD_NRF7002DK_NRF5340_CPUAPP || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS + +source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/samples/net/mqtt_sn_publisher/Kconfig.sysbuild b/samples/net/mqtt_sn_publisher/Kconfig.sysbuild new file mode 100644 index 000000000000..158551060c56 --- /dev/null +++ b/samples/net/mqtt_sn_publisher/Kconfig.sysbuild @@ -0,0 +1,13 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 +# + +config WIFI_NRF70 + default y if BOARD_NRF7002DK_NRF5340_CPUAPP || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS + +source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/samples/net/sockets/coap_server/Kconfig.sysbuild b/samples/net/sockets/coap_server/Kconfig.sysbuild new file mode 100644 index 000000000000..158551060c56 --- /dev/null +++ b/samples/net/sockets/coap_server/Kconfig.sysbuild @@ -0,0 +1,13 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 +# + +config WIFI_NRF70 + default y if BOARD_NRF7002DK_NRF5340_CPUAPP || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS + +source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/samples/net/sockets/echo_async/Kconfig.sysbuild b/samples/net/sockets/echo_async/Kconfig.sysbuild new file mode 100644 index 000000000000..158551060c56 --- /dev/null +++ b/samples/net/sockets/echo_async/Kconfig.sysbuild @@ -0,0 +1,13 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 +# + +config WIFI_NRF70 + default y if BOARD_NRF7002DK_NRF5340_CPUAPP || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS + +source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/samples/net/sockets/echo_client/Kconfig.sysbuild b/samples/net/sockets/echo_client/Kconfig.sysbuild new file mode 100644 index 000000000000..158551060c56 --- /dev/null +++ b/samples/net/sockets/echo_client/Kconfig.sysbuild @@ -0,0 +1,13 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 +# + +config WIFI_NRF70 + default y if BOARD_NRF7002DK_NRF5340_CPUAPP || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS + +source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/samples/net/sockets/echo_server/Kconfig.sysbuild b/samples/net/sockets/echo_server/Kconfig.sysbuild new file mode 100644 index 000000000000..158551060c56 --- /dev/null +++ b/samples/net/sockets/echo_server/Kconfig.sysbuild @@ -0,0 +1,13 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 +# + +config WIFI_NRF70 + default y if BOARD_NRF7002DK_NRF5340_CPUAPP || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS + +source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/samples/net/sockets/http_get/Kconfig.sysbuild b/samples/net/sockets/http_get/Kconfig.sysbuild new file mode 100644 index 000000000000..158551060c56 --- /dev/null +++ b/samples/net/sockets/http_get/Kconfig.sysbuild @@ -0,0 +1,13 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 +# + +config WIFI_NRF70 + default y if BOARD_NRF7002DK_NRF5340_CPUAPP || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS + +source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/samples/net/sockets/sntp_client/Kconfig.sysbuild b/samples/net/sockets/sntp_client/Kconfig.sysbuild new file mode 100644 index 000000000000..158551060c56 --- /dev/null +++ b/samples/net/sockets/sntp_client/Kconfig.sysbuild @@ -0,0 +1,13 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 +# + +config WIFI_NRF70 + default y if BOARD_NRF7002DK_NRF5340_CPUAPP || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS + +source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/samples/net/syslog_net/Kconfig.sysbuild b/samples/net/syslog_net/Kconfig.sysbuild new file mode 100644 index 000000000000..158551060c56 --- /dev/null +++ b/samples/net/syslog_net/Kconfig.sysbuild @@ -0,0 +1,13 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 +# + +config WIFI_NRF70 + default y if BOARD_NRF7002DK_NRF5340_CPUAPP || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS + +source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/samples/net/telnet/Kconfig.sysbuild b/samples/net/telnet/Kconfig.sysbuild new file mode 100644 index 000000000000..158551060c56 --- /dev/null +++ b/samples/net/telnet/Kconfig.sysbuild @@ -0,0 +1,13 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 +# + +config WIFI_NRF70 + default y if BOARD_NRF7002DK_NRF5340_CPUAPP || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS + +source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/samples/net/wifi/Kconfig.sysbuild b/samples/net/wifi/Kconfig.sysbuild new file mode 100644 index 000000000000..158551060c56 --- /dev/null +++ b/samples/net/wifi/Kconfig.sysbuild @@ -0,0 +1,13 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 +# + +config WIFI_NRF70 + default y if BOARD_NRF7002DK_NRF5340_CPUAPP || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS + +source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/samples/net/wifi/shell/sample.yaml b/samples/net/wifi/shell/sample.yaml index 5f72e0686116..8543e6bfb38b 100644 --- a/samples/net/wifi/shell/sample.yaml +++ b/samples/net/wifi/shell/sample.yaml @@ -58,6 +58,7 @@ tests: - nrf7002dk/nrf5340/cpuapp/nrf7001 sample.net.wifi.nrf7002ek: extra_args: + - SB_CONFIG_WIFI_NRF70=y - CONFIG_BUILD_ONLY_NO_BLOBS=y - SHIELD=nrf7002ek platform_allow: @@ -69,6 +70,7 @@ tests: sample.net.wifi.nrf7002eb: extra_args: - CONFIG_NRF70_UTIL=y + - SB_CONFIG_WIFI_NRF70=y - CONFIG_BUILD_ONLY_NO_BLOBS=y - SHIELD=nrf7002eb platform_allow: From d268008fb254d5fcb01e92931864fca8165a1246 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Audun=20Kvamtr=C3=B8?= Date: Wed, 25 Sep 2024 13:49:59 +0200 Subject: [PATCH 0526/2141] [nrf noup] mbedtls: Don't enable auto-generation of Mbed TLS files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - We don't use this mechanism in nRF Connect SDK Signed-off-by: Frank Audun Kvamtrø (cherry picked from commit 4bdc1088cba5435a3bbab1cae2eb68eafa4ba0a0) --- tests/crypto/mbedtls/CMakeLists.txt | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/tests/crypto/mbedtls/CMakeLists.txt b/tests/crypto/mbedtls/CMakeLists.txt index 7ebdc9d76a9a..47670bead010 100644 --- a/tests/crypto/mbedtls/CMakeLists.txt +++ b/tests/crypto/mbedtls/CMakeLists.txt @@ -6,15 +6,5 @@ project(mbedtls) set(output_file ${PROJECT_BINARY_DIR}/mbedtls-check.timestamp) -add_custom_command( - COMMENT "Check Mbed TLS auto-generated files" - COMMAND - ${PYTHON_EXECUTABLE} ${ZEPHYR_BASE}/modules/mbedtls/create_psa_files.py --check - OUTPUT - ${output_file} -) - -add_custom_target(check_mbedtls_auto_generated_files ALL DEPENDS ${output_file}) - FILE(GLOB app_sources src/*.c) target_sources(app PRIVATE ${app_sources}) From d9e0b36c715d2afa68d885ae3a0435efd4cac4a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Audun=20Kvamtr=C3=B8?= Date: Wed, 25 Sep 2024 14:05:41 +0200 Subject: [PATCH 0527/2141] [nrf noup] net: tests: Add legacy crypto API support for big_http_download MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -We handle legacy Crypto API support specially (favoring PSA crypto) the tests here require MD interface to build, which needs the config MBEDTLS_LEGACY_CRYPTO_C to be enable to get access to Signed-off-by: Frank Audun Kvamtrø (cherry picked from commit 3c4be0d757048f1aef7d55296a500f8730659206) --- samples/net/sockets/big_http_download/prj.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/samples/net/sockets/big_http_download/prj.conf b/samples/net/sockets/big_http_download/prj.conf index a406f314dfb2..8677e7113e4b 100644 --- a/samples/net/sockets/big_http_download/prj.conf +++ b/samples/net/sockets/big_http_download/prj.conf @@ -3,6 +3,7 @@ CONFIG_REQUIRES_FULL_LIBC=y CONFIG_MBEDTLS=y CONFIG_MBEDTLS_ENABLE_HEAP=y CONFIG_MBEDTLS_MD=y +CONFIG_MBEDTLS_LEGACY_CRYPTO_C=y CONFIG_MAIN_STACK_SIZE=2536 # Networking config From 462b528e3f91ce8139309d0d07c8bc64edc65042 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Audun=20Kvamtr=C3=B8?= Date: Wed, 25 Sep 2024 14:31:02 +0200 Subject: [PATCH 0528/2141] [nrf noup] net: tests: crypto: Adding legacy Crypto support ipv6 tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -This adds crypto support for ipv6 tests by enabling CONFIG_MBEDTLS_LEGACY_CRYPTO_C Signed-off-by: Frank Audun Kvamtrø (cherry picked from commit 2553081a39b48315d93c1df3b697f8b40d06ed7a) --- tests/net/ipv6/prj.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/net/ipv6/prj.conf b/tests/net/ipv6/prj.conf index 51cfa883727d..c8dda7728952 100644 --- a/tests/net/ipv6/prj.conf +++ b/tests/net/ipv6/prj.conf @@ -33,6 +33,7 @@ CONFIG_NET_IF_MAX_IPV6_COUNT=2 CONFIG_NET_IPV6_PE=y CONFIG_NET_IPV6_PE_FILTER_PREFIX_COUNT=2 CONFIG_NET_IPV6_PE_PREFER_PUBLIC_ADDRESSES=n +CONFIG_MBEDTLS_LEGACY_CRYPTO_C=y # Increase the stack a bit for mps2/an385 CONFIG_NET_RX_STACK_SIZE=1700 From 6f1c879193c47eac41cc525dc02320bce8664472 Mon Sep 17 00:00:00 2001 From: Dominik Ermel Date: Tue, 12 Nov 2024 11:13:38 +0000 Subject: [PATCH 0529/2141] [nrf noup] mcuboot: Add CONFIG_MCUBOOT_BOOTLOADER_USES_SHA512 The option notifies application that MCUboot has been configured to use SHA512 for image hashing. Signed-off-by: Dominik Ermel (cherry picked from commit 6b3791792fc6b221fd6f5bc634256d08e144a7c3) --- modules/Kconfig.mcuboot | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/Kconfig.mcuboot b/modules/Kconfig.mcuboot index c02ee43f5eb8..694f4069b90f 100644 --- a/modules/Kconfig.mcuboot +++ b/modules/Kconfig.mcuboot @@ -288,6 +288,11 @@ config MCUBOOT_BOOTLOADER_NO_DOWNGRADE MCUBOOT_DOWNGRADE_PREVENTION option enabled. endif +config MCUBOOT_BOOTLOADER_USES_SHA512 + bool "MCUboot uses SHA512 for image hash" + help + MCUboot has been compiled to verify images using SHA512. + config MCUBOOT_APPLICATION_FIRMWARE_UPDATER bool "Application is firmware updater image" depends on MCUBOOT_BOOTLOADER_MODE_FIRMWARE_UPDATER From a56cf020bdc67698c9846a79be612256d0cfc25a Mon Sep 17 00:00:00 2001 From: Dominik Ermel Date: Tue, 12 Nov 2024 12:50:38 +0000 Subject: [PATCH 0530/2141] [nrf noup] mgmt/mcumgr: Add support for SHA512 in images Adds support for images signed with SHA512. Signed-off-by: Dominik Ermel (cherry picked from commit b00a959e1f60d34e06ba4cdeb71867e334306808) --- .../include/mgmt/mcumgr/grp/img_mgmt/img_mgmt_priv.h | 8 ++++++++ subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c | 12 ++++++------ subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt_state.c | 8 ++++---- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/include/mgmt/mcumgr/grp/img_mgmt/img_mgmt_priv.h b/subsys/mgmt/mcumgr/grp/img_mgmt/include/mgmt/mcumgr/grp/img_mgmt/img_mgmt_priv.h index 133a1abf054f..d584467ee2bf 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/include/mgmt/mcumgr/grp/img_mgmt/img_mgmt_priv.h +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/include/mgmt/mcumgr/grp/img_mgmt/img_mgmt_priv.h @@ -18,6 +18,14 @@ extern "C" { #endif +#ifdef CONFIG_MCUBOOT_BOOTLOADER_USES_SHA512 +#define IMAGE_TLV_SHA IMAGE_TLV_SHA512 +#define IMAGE_SHA_LEN 64 +#else +#define IMAGE_TLV_SHA IMAGE_TLV_SHA256 +#define IMAGE_SHA_LEN 32 +#endif + /** * @brief Ensures the spare slot (slot 1) is fully erased. * diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c index b53f1b214658..05e3a9c64889 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c @@ -348,7 +348,7 @@ int img_mgmt_read_info(int image_slot, struct image_version *ver, uint8_t *hash, if (tlv.it_type == 0xff && tlv.it_len == 0xffff) { return IMG_MGMT_ERR_INVALID_TLV; } - if (tlv.it_type != IMAGE_TLV_SHA256 || tlv.it_len != IMAGE_HASH_LEN) { + if (tlv.it_type != IMAGE_TLV_SHA || tlv.it_len != IMAGE_SHA_LEN) { /* Non-hash TLV. Skip it. */ data_off += sizeof(tlv) + tlv.it_len; continue; @@ -362,10 +362,10 @@ int img_mgmt_read_info(int image_slot, struct image_version *ver, uint8_t *hash, data_off += sizeof(tlv); if (hash != NULL) { - if (data_off + IMAGE_HASH_LEN > data_end) { + if (data_off + IMAGE_SHA_LEN > data_end) { return IMG_MGMT_ERR_TLV_INVALID_SIZE; } - rc = img_mgmt_read(image_slot, data_off, hash, IMAGE_HASH_LEN); + rc = img_mgmt_read(image_slot, data_off, hash, IMAGE_SHA_LEN); if (rc != 0) { return rc; } @@ -408,13 +408,13 @@ int img_mgmt_find_by_hash(uint8_t *find, struct image_version *ver) { int i; - uint8_t hash[IMAGE_HASH_LEN]; + uint8_t hash[IMAGE_SHA_LEN]; for (i = 0; i < SLOTS_PER_IMAGE * CONFIG_MCUMGR_GRP_IMG_UPDATABLE_IMAGE_NUMBER; i++) { if (img_mgmt_read_info(i, ver, hash, NULL) != 0) { continue; } - if (!memcmp(hash, find, IMAGE_HASH_LEN)) { + if (!memcmp(hash, find, IMAGE_SHA_LEN)) { return i; } } @@ -724,7 +724,7 @@ img_mgmt_upload_good_rsp(struct smp_streamer *ctxt) static int img_mgmt_upload_log(bool is_first, bool is_last, int status) { - uint8_t hash[IMAGE_HASH_LEN]; + uint8_t hash[IMAGE_SHA_LEN]; const uint8_t *hashp; int rc; diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt_state.c b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt_state.c index 384d06137393..4ddd741851ef 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt_state.c +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt_state.c @@ -434,8 +434,8 @@ static bool img_mgmt_state_encode_slot(struct smp_streamer *ctxt, uint32_t slot, zcbor_state_t *zse = ctxt->writer->zs; uint32_t flags; char vers_str[IMG_MGMT_VER_MAX_STR_LEN]; - uint8_t hash[IMAGE_HASH_LEN]; /* SHA256 hash */ - struct zcbor_string zhash = { .value = hash, .len = IMAGE_HASH_LEN }; + uint8_t hash[IMAGE_SHA_LEN]; + struct zcbor_string zhash = { .value = hash, .len = IMAGE_SHA_LEN}; struct image_version ver; bool ok; int rc = img_mgmt_read_info(slot, &ver, hash, &flags); @@ -779,14 +779,14 @@ img_mgmt_state_write(struct smp_streamer *ctxt) IMG_MGMT_ERR_INVALID_HASH); goto end; } - } else if (zhash.len != IMAGE_HASH_LEN) { + } else if (zhash.len != IMAGE_SHA_LEN) { /* The img_mgmt_find_by_hash does exact length compare * so just fail here. */ ok = smp_add_cmd_err(zse, MGMT_GROUP_ID_IMAGE, IMG_MGMT_ERR_INVALID_HASH); goto end; } else { - uint8_t hash[IMAGE_HASH_LEN]; + uint8_t hash[IMAGE_SHA_LEN]; memcpy(hash, zhash.value, zhash.len); From 018554da0ddaeef65fb50fa915874e60cd571631 Mon Sep 17 00:00:00 2001 From: Dominik Ermel Date: Tue, 12 Nov 2024 12:52:03 +0000 Subject: [PATCH 0531/2141] [nrf noup] samples/smp_svr: Increase stack size required Increase stack size as support for SHA512 requires more data. Signed-off-by: Dominik Ermel (cherry picked from commit 0efc441e146dde1780f968a89df12f0b89cae230) --- samples/subsys/mgmt/mcumgr/smp_svr/prj.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/prj.conf b/samples/subsys/mgmt/mcumgr/smp_svr/prj.conf index 06a27644bacb..925ac0c93a27 100644 --- a/samples/subsys/mgmt/mcumgr/smp_svr/prj.conf +++ b/samples/subsys/mgmt/mcumgr/smp_svr/prj.conf @@ -8,7 +8,7 @@ CONFIG_FLASH_MAP=y # Some command handlers require a large stack. CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2304 -CONFIG_MAIN_STACK_SIZE=2048 +CONFIG_MAIN_STACK_SIZE=2176 # Ensure an MCUboot-compatible binary is generated. CONFIG_BOOTLOADER_MCUBOOT=y From 63f0faef7bd0ccffd1970b1677efa04b696b8d70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ayt=C3=BCrk=20D=C3=BCzen?= Date: Wed, 20 Nov 2024 13:06:23 +0100 Subject: [PATCH 0532/2141] [nrf noup] tests: bluetooth: tester: sysbuild configurable 53/54H MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add support for sysbuild 54h20 building added nrf54h20 cpurad configuration to hci_ipc sample. Signed-off-by: Aytürk Düzen Signed-off-by: Vinayak Kariappa Chettimada (cherry picked from commit 3f40e382562c3cceb74a24fcf34330dd853d2796) --- .../nrf54h20_cpurad-bt_ll_softdevice.conf | 33 +++++++++++++++++++ tests/bluetooth/tester/Kconfig.sysbuild | 1 + tests/bluetooth/tester/sysbuild.cmake | 16 +++++++-- 3 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 samples/bluetooth/hci_ipc/nrf54h20_cpurad-bt_ll_softdevice.conf diff --git a/samples/bluetooth/hci_ipc/nrf54h20_cpurad-bt_ll_softdevice.conf b/samples/bluetooth/hci_ipc/nrf54h20_cpurad-bt_ll_softdevice.conf new file mode 100644 index 000000000000..1f7748e5cd7d --- /dev/null +++ b/samples/bluetooth/hci_ipc/nrf54h20_cpurad-bt_ll_softdevice.conf @@ -0,0 +1,33 @@ +CONFIG_IPC_SERVICE=y +CONFIG_MBOX=y + +CONFIG_ISR_STACK_SIZE=1024 +CONFIG_IDLE_STACK_SIZE=256 +CONFIG_MAIN_STACK_SIZE=512 +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=512 +CONFIG_IPC_SERVICE_BACKEND_RPMSG_WQ_STACK_SIZE=512 +CONFIG_HEAP_MEM_POOL_SIZE=8192 + +CONFIG_BT=y +CONFIG_BT_HCI_RAW=y + +CONFIG_BT_BUF_EVT_RX_COUNT=16 +CONFIG_BT_BUF_EVT_RX_SIZE=255 +CONFIG_BT_BUF_ACL_RX_SIZE=255 +CONFIG_BT_BUF_ACL_TX_SIZE=251 +CONFIG_BT_BUF_CMD_TX_SIZE=255 + +# Host +CONFIG_BT_BROADCASTER=y +CONFIG_BT_PERIPHERAL=y +CONFIG_BT_OBSERVER=y +CONFIG_BT_CENTRAL=y +CONFIG_BT_EXT_ADV=y +CONFIG_BT_PER_ADV=y +CONFIG_BT_PER_ADV_SYNC=y + +# Controller +CONFIG_BT_LL_SW_SPLIT=n +CONFIG_BT_LL_SOFTDEVICE=y +CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 +CONFIG_BT_CTLR_SCAN_DATA_LEN_MAX=191 diff --git a/tests/bluetooth/tester/Kconfig.sysbuild b/tests/bluetooth/tester/Kconfig.sysbuild index 69e4d5a97fbe..e14a6e1aa8e0 100644 --- a/tests/bluetooth/tester/Kconfig.sysbuild +++ b/tests/bluetooth/tester/Kconfig.sysbuild @@ -5,6 +5,7 @@ source "share/sysbuild/Kconfig" config NET_CORE_BOARD string + default "nrf54h20dk/nrf54h20/cpurad" if "$(BOARD)" = "nrf54h20dk" default "nrf5340dk/nrf5340/cpunet" if "$(BOARD)" = "nrf5340dk" default "nrf5340_audio_dk/nrf5340/cpunet" if "$(BOARD)" = "nrf5340_audio_dk" default "nrf5340bsim/nrf5340/cpunet" if $(BOARD_TARGET_STRING) = "NRF5340BSIM_NRF5340_CPUAPP" diff --git a/tests/bluetooth/tester/sysbuild.cmake b/tests/bluetooth/tester/sysbuild.cmake index a9ddf1279471..bcd564733c53 100644 --- a/tests/bluetooth/tester/sysbuild.cmake +++ b/tests/bluetooth/tester/sysbuild.cmake @@ -2,8 +2,6 @@ # SPDX-License-Identifier: Apache-2.0 if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) - # For builds in the nrf5340, we build the netcore image with the controller - set(NET_APP hci_ipc) set(NET_APP_SRC_DIR ${ZEPHYR_BASE}/samples/bluetooth/${NET_APP}) @@ -13,6 +11,20 @@ if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) BOARD ${SB_CONFIG_NET_CORE_BOARD} ) + if(SB_CONFIG_SOC_NRF5340_CPUAPP) + set(${NET_APP}_SNIPPET + "bt-ll-sw-split" + CACHE INTERNAL "" + ) + endif() + + if(SB_CONFIG_SOC_NRF54H20_CPUAPP) + set(${NET_APP}_CONF_FILE + ${NET_APP_SRC_DIR}/nrf54h20_cpurad-bt_ll_softdevice.conf + CACHE INTERNAL "" + ) + endif() + set(${NET_APP}_EXTRA_CONF_FILE ${APP_DIR}/overlay-bt_ll_sw_split.conf CACHE INTERNAL "" From bc11d5db02692ffaa2a6e75ec939f2b9fa404d03 Mon Sep 17 00:00:00 2001 From: Ingar Kulbrandstad Date: Tue, 21 May 2024 13:59:58 +0200 Subject: [PATCH 0533/2141] [nrf noup] Bluetooth: Mesh: Disable processing of ext ADV packets Disable processing of extended ADV packets by mesh scanner. This is done to prevent loss of scan time due to reception of pointer packets while scanning for mesh packets. Signed-off-by: Ingar Kulbrandstad (cherry picked from commit 542b335d7a48b069971a1376bf8586b5b8a7a8c3) --- subsys/bluetooth/mesh/Kconfig | 11 +++++++++++ subsys/bluetooth/mesh/adv_ext.c | 12 ++++++++++++ 2 files changed, 23 insertions(+) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index bd0350307ba2..7e4adf4c78ab 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -214,6 +214,17 @@ config BT_MESH_ADV_EXT_FRIEND_SEPARATE messages as close to the start of the ReceiveWindow as possible, thus reducing the scanning time on the Low Power node. +config BT_MESH_ADV_EXT_ACCEPT_EXT_ADV_PACKETS + bool "Reject or accept extended advertising packets" + depends on BT_LL_SOFTDEVICE + help + Configure the scanner and initiator to either reject or accept extended + advertising packets by the SoftDevice Controller. This is set to false + by default, to prevent loss of scan time when receiving a pointer packet + while scanning for Bluetooth Mesh packets. Set to true if extended + advertising packets are to be received by the SoftDevice Controller for + purposes other than Bluetooth Mesh. + endif # BT_MESH_ADV_EXT endchoice diff --git a/subsys/bluetooth/mesh/adv_ext.c b/subsys/bluetooth/mesh/adv_ext.c index 0e6f6120f73f..c74f0a40d99a 100644 --- a/subsys/bluetooth/mesh/adv_ext.c +++ b/subsys/bluetooth/mesh/adv_ext.c @@ -519,6 +519,18 @@ void bt_mesh_adv_init(void) K_PRIO_COOP(MESH_WORKQ_PRIORITY), NULL); k_thread_name_set(&bt_mesh_workq.thread, "BT MESH WQ"); } + +#if defined(CONFIG_BT_LL_SOFTDEVICE) + const sdc_hci_cmd_vs_scan_accept_ext_adv_packets_set_t cmd_params = { + .accept_ext_adv_packets = IS_ENABLED(CONFIG_BT_MESH_ADV_EXT_ACCEPT_EXT_ADV_PACKETS), + }; + + int err = sdc_hci_cmd_vs_scan_accept_ext_adv_packets_set(&cmd_params); + + if (err) { + LOG_ERR("Failed to set accept_ext_adv_packets: %d", err); + } +#endif } static struct bt_mesh_ext_adv *adv_instance_find(struct bt_le_ext_adv *instance) From 53fae56efca3c201e8faa1433b7c3ee98b4e6dd6 Mon Sep 17 00:00:00 2001 From: Joakim Andersson Date: Mon, 16 Jan 2023 14:15:22 +0100 Subject: [PATCH 0534/2141] [nrf noup] dts: choose a crypto accelerator for entropy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a long-term noup patch because crypto driver support is NCS-only for both cryptocell and CRACEN. Set HAS_HW_NRF_CC3XX to be defined in NS build when cryptocell is accessed through the PSA API. We need to know which CC3XX features are available. Set PSA as the entropy source for 54L. PSA is the only NCS-supported interface to CRACEN. Signed-off-by: Georgios Vasilakis Signed-off-by: Joakim Andersson Signed-off-by: Dominik Ermel Signed-off-by: Sebastian Bøe Signed-off-by: Robert Lubos Signed-off-by: Rubin Gerritsen (cherry picked from commit d1f466242ecb1c8d5325b3b149cbb50499ef5bbc) --- dts/arm/nordic/nrf52840.dtsi | 4 ++-- dts/arm/nordic/nrf5340_cpuapp.dtsi | 4 ++-- dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi | 4 ++-- dts/arm/nordic/nrf91.dtsi | 3 ++- soc/nordic/common/Kconfig.peripherals | 6 ++++-- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/dts/arm/nordic/nrf52840.dtsi b/dts/arm/nordic/nrf52840.dtsi index dab5f7620585..bcbfd926c9bb 100644 --- a/dts/arm/nordic/nrf52840.dtsi +++ b/dts/arm/nordic/nrf52840.dtsi @@ -8,7 +8,7 @@ / { chosen { zephyr,bt-hci = &bt_hci_controller; - zephyr,entropy = &rng; + zephyr,entropy = &cryptocell; zephyr,flash-controller = &flash_controller; }; @@ -572,7 +572,7 @@ reg = <0x5002a000 0x1000>, <0x5002b000 0x1000>; reg-names = "wrapper", "core"; interrupts = <42 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; + status = "okay"; }; }; }; diff --git a/dts/arm/nordic/nrf5340_cpuapp.dtsi b/dts/arm/nordic/nrf5340_cpuapp.dtsi index 30aaf9c99479..d3df6da31997 100644 --- a/dts/arm/nordic/nrf5340_cpuapp.dtsi +++ b/dts/arm/nordic/nrf5340_cpuapp.dtsi @@ -34,7 +34,7 @@ }; chosen { - zephyr,entropy = &rng_hci; + zephyr,entropy = &cryptocell; zephyr,flash-controller = &flash_controller; }; @@ -104,7 +104,7 @@ reg = <0x50844000 0x1000>, <0x50845000 0x1000>; reg-names = "wrapper", "core"; interrupts = <68 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; + status = "okay"; }; }; diff --git a/dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi b/dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi index 3f1fe655b6e5..8b0339eda399 100644 --- a/dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi +++ b/dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi @@ -16,7 +16,7 @@ nvic: &cpuapp_nvic {}; / { chosen { zephyr,bt-hci = &bt_hci_controller; - zephyr,entropy = &rng; + zephyr,entropy = &psa_rng; }; soc { @@ -32,7 +32,7 @@ nvic: &cpuapp_nvic {}; psa_rng: psa-rng { compatible = "zephyr,psa-crypto-rng"; - status = "disabled"; + status = "okay"; }; }; diff --git a/dts/arm/nordic/nrf91.dtsi b/dts/arm/nordic/nrf91.dtsi index 1747dcea74a9..7b7d48916519 100644 --- a/dts/arm/nordic/nrf91.dtsi +++ b/dts/arm/nordic/nrf91.dtsi @@ -28,6 +28,7 @@ }; chosen { + zephyr,entropy = &cryptocell; zephyr,flash-controller = &flash_controller; }; @@ -51,7 +52,7 @@ reg = <0x50840000 0x1000>, <0x50841000 0x1000>; reg-names = "wrapper", "core"; interrupts = <64 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; + status = "okay"; }; ctrlap: ctrlap@50006000 { diff --git a/soc/nordic/common/Kconfig.peripherals b/soc/nordic/common/Kconfig.peripherals index 083fcc4e0891..90bd21f84663 100644 --- a/soc/nordic/common/Kconfig.peripherals +++ b/soc/nordic/common/Kconfig.peripherals @@ -13,10 +13,12 @@ config HAS_HW_NRF_BPROT def_bool $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF_BPROT)) config HAS_HW_NRF_CC310 - def_bool $(dt_compat_enabled,$(DT_COMPAT_ARM_CRYPTOCELL_310)) + def_bool $(dt_compat_enabled,$(DT_COMPAT_ARM_CRYPTOCELL_310)) || \ + ($(dt_nodelabel_enabled,psa_rng) && SOC_SERIES_NRF91X) config HAS_HW_NRF_CC312 - def_bool $(dt_compat_enabled,$(DT_COMPAT_ARM_CRYPTOCELL_312)) + def_bool $(dt_compat_enabled,$(DT_COMPAT_ARM_CRYPTOCELL_312)) || \ + ($(dt_nodelabel_enabled,psa_rng) && SOC_NRF5340_CPUAPP) config HAS_HW_NRF_CCM def_bool $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF_CCM)) From 6d216e1a427579ef6fba03c6cb0fa90d4d9e1504 Mon Sep 17 00:00:00 2001 From: Rubin Gerritsen Date: Thu, 5 Sep 2024 08:04:15 +0200 Subject: [PATCH 0535/2141] [nrf noup] dts: Select SoftDevice Controller DTS binding as default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The SoftDevice Controller is a different controller than the open source link layer with a different set of quirks. It should therefore have its own device tree binding. This commit converts the SoftDevice Controller driver to use this new DTS binding instead of reusing the existing one. This commit updates or adds additional overlays for existing samples, applications and tests that were using the open source link layer. Signed-off-by: Rubin Gerritsen Signed-off-by: Kristoffer Rist Skøien Signed-off-by: Rafał Kuźnia (cherry picked from commit 946fcec6c632424ca0a7e2ee7cc9a5df7eb1180e) --- .../nrf54l20pdk/nrf54l20_cpuapp_common.dtsi | 4 +- dts/arm/nordic/nrf52805.dtsi | 11 +- dts/arm/nordic/nrf52810.dtsi | 11 +- dts/arm/nordic/nrf52811.dtsi | 11 +- dts/arm/nordic/nrf52820.dtsi | 11 +- dts/arm/nordic/nrf52832.dtsi | 11 +- dts/arm/nordic/nrf52833.dtsi | 11 +- dts/arm/nordic/nrf52840.dtsi | 11 +- dts/arm/nordic/nrf5340_cpunet.dtsi | 11 +- dts/arm/nordic/nrf54h20_cpurad.dtsi | 4 +- dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi | 4 +- dts/vendor/nordic/nrf54h20.dtsi | 7 +- dts/vendor/nordic/nrf54l20.dtsi | 7 +- dts/vendor/nordic/nrf54l_05_10_15.dtsi | 8 +- .../bluetooth/bap_broadcast_sink/sample.yaml | 4 +- .../bap_broadcast_sink/sysbuild.cmake | 4 + .../bap_broadcast_source/sample.yaml | 4 +- .../bap_broadcast_source/sysbuild.cmake | 4 + .../bluetooth/bap_unicast_client/sample.yaml | 4 +- .../bap_unicast_client/sysbuild.cmake | 4 + .../bluetooth/bap_unicast_server/sample.yaml | 4 +- .../bap_unicast_server/sysbuild.cmake | 4 + samples/bluetooth/beacon/sample.yaml | 4 +- samples/bluetooth/cap_acceptor/sample.yaml | 4 +- samples/bluetooth/cap_acceptor/sysbuild.cmake | 4 + samples/bluetooth/cap_initiator/sample.yaml | 4 +- .../bluetooth/cap_initiator/sysbuild.cmake | 4 + .../direction_finding_central/sample.yaml | 15 ++- .../sample.yaml | 14 ++- .../sample.yaml | 14 ++- .../direction_finding_peripheral/sample.yaml | 15 ++- samples/bluetooth/hci_ipc/sample.yaml | 34 ++++-- samples/bluetooth/hci_uart/sample.yaml | 18 +++- samples/bluetooth/hci_vs_scan_req/sample.yaml | 2 + samples/bluetooth/iso_central/sample.yaml | 6 +- .../pbp_public_broadcast_sink/sample.yaml | 4 +- .../pbp_public_broadcast_sink/sysbuild.cmake | 4 + .../pbp_public_broadcast_source/sample.yaml | 4 +- .../sysbuild.cmake | 4 + .../bt-ll-sw-split/bt-ll-sw-split.overlay | 4 + .../controller/ll_sw/nordic/lll/lll.c | 2 +- .../controller/ctrl_api/testcase.yaml | 2 + .../controller/ctrl_chmu/testcase.yaml | 2 + .../controller/ctrl_cis_create/testcase.yaml | 2 + .../ctrl_cis_terminate/testcase.yaml | 2 + .../controller/ctrl_collision/testcase.yaml | 2 + .../controller/ctrl_conn_update/testcase.yaml | 11 +- .../controller/ctrl_cte_req/testcase.yaml | 2 + .../ctrl_data_length_update/testcase.yaml | 10 +- .../controller/ctrl_encrypt/testcase.yaml | 2 + .../ctrl_feature_exchange/testcase.yaml | 2 + .../controller/ctrl_hci/testcase.yaml | 2 + .../controller/ctrl_invalid/testcase.yaml | 2 + .../controller/ctrl_le_ping/testcase.yaml | 2 + .../ctrl_min_used_chans/testcase.yaml | 2 + .../controller/ctrl_phy_update/testcase.yaml | 6 +- .../controller/ctrl_sca_update/testcase.yaml | 2 + .../controller/ctrl_sw_privacy/testcase.yaml | 2 + .../controller/ctrl_terminate/testcase.yaml | 2 + .../ctrl_tx_buffer_alloc/testcase.yaml | 22 +++- .../controller/ctrl_tx_queue/testcase.yaml | 2 + .../controller/ctrl_unsupported/testcase.yaml | 6 +- .../controller/ctrl_user_ext/testcase.yaml | 2 + .../controller/ctrl_version/testcase.yaml | 2 + .../df/connection_cte_req/testcase.yaml | 2 + .../df/connection_cte_tx_params/testcase.yaml | 2 + .../connectionless_cte_chains/testcase.yaml | 2 + .../df/connectionless_cte_rx/testcase.yaml | 2 + .../df/connectionless_cte_tx/testcase.yaml | 2 + tests/bluetooth/init/testcase.yaml | 101 +++++++++++++----- 70 files changed, 389 insertions(+), 127 deletions(-) diff --git a/boards/nordic/nrf54l20pdk/nrf54l20_cpuapp_common.dtsi b/boards/nordic/nrf54l20pdk/nrf54l20_cpuapp_common.dtsi index 614ffbca4de3..f719b2d93920 100644 --- a/boards/nordic/nrf54l20pdk/nrf54l20_cpuapp_common.dtsi +++ b/boards/nordic/nrf54l20pdk/nrf54l20_cpuapp_common.dtsi @@ -18,7 +18,7 @@ zephyr,bt-c2h-uart = &uart20; zephyr,flash-controller = &rram_controller; zephyr,flash = &cpuapp_rram; - zephyr,bt-hci = &bt_hci_controller; + zephyr,bt-hci = &bt_hci_sdc; zephyr,ieee802154 = &ieee802154; }; }; @@ -122,7 +122,7 @@ status = "okay"; }; -&bt_hci_controller { +&bt_hci_sdc { status = "okay"; }; diff --git a/dts/arm/nordic/nrf52805.dtsi b/dts/arm/nordic/nrf52805.dtsi index 45a54f97b061..2134605c9f86 100644 --- a/dts/arm/nordic/nrf52805.dtsi +++ b/dts/arm/nordic/nrf52805.dtsi @@ -11,7 +11,7 @@ / { chosen { - zephyr,bt-hci = &bt_hci_controller; + zephyr,bt-hci = &bt_hci_sdc; zephyr,entropy = &rng; zephyr,flash-controller = &flash_controller; }; @@ -106,12 +106,13 @@ status = "okay"; ble-2mbps-supported; - /* Note: In the nRF Connect SDK the SoftDevice Controller - * is added and set as the default Bluetooth Controller. - */ + bt_hci_sdc: bt_hci_sdc { + compatible = "nordic,bt-hci-sdc"; + status = "okay"; + }; bt_hci_controller: bt_hci_controller { compatible = "zephyr,bt-hci-ll-sw-split"; - status = "okay"; + status = "disabled"; }; }; diff --git a/dts/arm/nordic/nrf52810.dtsi b/dts/arm/nordic/nrf52810.dtsi index 217758dd1614..6e09220e78bb 100644 --- a/dts/arm/nordic/nrf52810.dtsi +++ b/dts/arm/nordic/nrf52810.dtsi @@ -7,7 +7,7 @@ / { chosen { - zephyr,bt-hci = &bt_hci_controller; + zephyr,bt-hci = &bt_hci_sdc; zephyr,entropy = &rng; zephyr,flash-controller = &flash_controller; }; @@ -110,12 +110,13 @@ status = "okay"; ble-2mbps-supported; - /* Note: In the nRF Connect SDK the SoftDevice Controller - * is added and set as the default Bluetooth Controller. - */ + bt_hci_sdc: bt_hci_sdc { + compatible = "nordic,bt-hci-sdc"; + status = "okay"; + }; bt_hci_controller: bt_hci_controller { compatible = "zephyr,bt-hci-ll-sw-split"; - status = "okay"; + status = "disabled"; }; }; diff --git a/dts/arm/nordic/nrf52811.dtsi b/dts/arm/nordic/nrf52811.dtsi index 670f569c0ace..12d0a0ea4d6f 100644 --- a/dts/arm/nordic/nrf52811.dtsi +++ b/dts/arm/nordic/nrf52811.dtsi @@ -11,7 +11,7 @@ / { chosen { - zephyr,bt-hci = &bt_hci_controller; + zephyr,bt-hci = &bt_hci_sdc; zephyr,entropy = &rng; zephyr,flash-controller = &flash_controller; }; @@ -122,12 +122,13 @@ status = "disabled"; }; - /* Note: In the nRF Connect SDK the SoftDevice Controller - * is added and set as the default Bluetooth Controller. - */ + bt_hci_sdc: bt_hci_sdc { + compatible = "nordic,bt-hci-sdc"; + status = "okay"; + }; bt_hci_controller: bt_hci_controller { compatible = "zephyr,bt-hci-ll-sw-split"; - status = "okay"; + status = "disabled"; }; }; diff --git a/dts/arm/nordic/nrf52820.dtsi b/dts/arm/nordic/nrf52820.dtsi index 50c8d2ba07f0..d15fbb2ae4e3 100644 --- a/dts/arm/nordic/nrf52820.dtsi +++ b/dts/arm/nordic/nrf52820.dtsi @@ -11,7 +11,7 @@ / { chosen { - zephyr,bt-hci = &bt_hci_controller; + zephyr,bt-hci = &bt_hci_sdc; zephyr,entropy = &rng; zephyr,flash-controller = &flash_controller; }; @@ -124,12 +124,13 @@ status = "disabled"; }; - /* Note: In the nRF Connect SDK another Bluetooth controller - * is added and set as the default. - */ + bt_hci_sdc: bt_hci_sdc { + compatible = "nordic,bt-hci-sdc"; + status = "okay"; + }; bt_hci_controller: bt_hci_controller { compatible = "zephyr,bt-hci-ll-sw-split"; - status = "okay"; + status = "disabled"; }; }; diff --git a/dts/arm/nordic/nrf52832.dtsi b/dts/arm/nordic/nrf52832.dtsi index 7bd62c707545..eef2297c43b1 100644 --- a/dts/arm/nordic/nrf52832.dtsi +++ b/dts/arm/nordic/nrf52832.dtsi @@ -7,7 +7,7 @@ / { chosen { - zephyr,bt-hci = &bt_hci_controller; + zephyr,bt-hci = &bt_hci_sdc; zephyr,entropy = &rng; zephyr,flash-controller = &flash_controller; }; @@ -110,12 +110,13 @@ status = "okay"; ble-2mbps-supported; - /* Note: In the nRF Connect SDK the SoftDevice Controller - * is added and set as the default Bluetooth Controller. - */ + bt_hci_sdc: bt_hci_sdc { + compatible = "nordic,bt-hci-sdc"; + status = "okay"; + }; bt_hci_controller: bt_hci_controller { compatible = "zephyr,bt-hci-ll-sw-split"; - status = "okay"; + status = "disabled"; }; }; diff --git a/dts/arm/nordic/nrf52833.dtsi b/dts/arm/nordic/nrf52833.dtsi index 8202ddc45431..1b3620aa01cb 100644 --- a/dts/arm/nordic/nrf52833.dtsi +++ b/dts/arm/nordic/nrf52833.dtsi @@ -11,7 +11,7 @@ / { chosen { - zephyr,bt-hci = &bt_hci_controller; + zephyr,bt-hci = &bt_hci_sdc; zephyr,entropy = &rng; zephyr,flash-controller = &flash_controller; }; @@ -124,12 +124,13 @@ status = "disabled"; }; - /* Note: In the nRF Connect SDK the SoftDevice Controller - * is added and set as the default Bluetooth Controller. - */ + bt_hci_sdc: bt_hci_sdc { + compatible = "nordic,bt-hci-sdc"; + status = "okay"; + }; bt_hci_controller: bt_hci_controller { compatible = "zephyr,bt-hci-ll-sw-split"; - status = "okay"; + status = "disabled"; }; }; diff --git a/dts/arm/nordic/nrf52840.dtsi b/dts/arm/nordic/nrf52840.dtsi index bcbfd926c9bb..f19383ba7e75 100644 --- a/dts/arm/nordic/nrf52840.dtsi +++ b/dts/arm/nordic/nrf52840.dtsi @@ -7,7 +7,7 @@ / { chosen { - zephyr,bt-hci = &bt_hci_controller; + zephyr,bt-hci = &bt_hci_sdc; zephyr,entropy = &cryptocell; zephyr,flash-controller = &flash_controller; }; @@ -112,12 +112,13 @@ status = "disabled"; }; - /* Note: In the nRF Connect SDK the SoftDevice Controller - * is added and set as the default Bluetooth Controller. - */ + bt_hci_sdc: bt_hci_sdc { + compatible = "nordic,bt-hci-sdc"; + status = "okay"; + }; bt_hci_controller: bt_hci_controller { compatible = "zephyr,bt-hci-ll-sw-split"; - status = "okay"; + status = "disabled"; }; }; diff --git a/dts/arm/nordic/nrf5340_cpunet.dtsi b/dts/arm/nordic/nrf5340_cpunet.dtsi index 4f9164767f1a..be0fad16d66b 100644 --- a/dts/arm/nordic/nrf5340_cpunet.dtsi +++ b/dts/arm/nordic/nrf5340_cpunet.dtsi @@ -9,7 +9,7 @@ / { chosen { - zephyr,bt-hci = &bt_hci_controller; + zephyr,bt-hci = &bt_hci_sdc; zephyr,entropy = &rng; zephyr,flash-controller = &flash_controller; }; @@ -102,12 +102,13 @@ status = "disabled"; }; - /* Note: In the nRF Connect SDK the SoftDevice Controller - * is added and set as the default Bluetooth Controller. - */ + bt_hci_sdc: bt_hci_sdc { + compatible = "nordic,bt-hci-sdc"; + status = "okay"; + }; bt_hci_controller: bt_hci_controller { compatible = "zephyr,bt-hci-ll-sw-split"; - status = "okay"; + status = "disabled"; }; }; diff --git a/dts/arm/nordic/nrf54h20_cpurad.dtsi b/dts/arm/nordic/nrf54h20_cpurad.dtsi index 2cfda47afc55..e8ff2dac3a4a 100644 --- a/dts/arm/nordic/nrf54h20_cpurad.dtsi +++ b/dts/arm/nordic/nrf54h20_cpurad.dtsi @@ -24,7 +24,7 @@ wdt011: &cpurad_wdt011 {}; / { chosen { - zephyr,bt-hci = &bt_hci_controller; + zephyr,bt-hci = &bt_hci_sdc; }; soc { @@ -104,6 +104,6 @@ wdt011: &cpurad_wdt011 {}; status = "okay"; }; -&bt_hci_controller { +&bt_hci_sdc { status = "okay"; }; diff --git a/dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi b/dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi index 8b0339eda399..80875058f5fd 100644 --- a/dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi +++ b/dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi @@ -15,7 +15,7 @@ nvic: &cpuapp_nvic {}; / { chosen { - zephyr,bt-hci = &bt_hci_controller; + zephyr,bt-hci = &bt_hci_sdc; zephyr,entropy = &psa_rng; }; @@ -36,7 +36,7 @@ nvic: &cpuapp_nvic {}; }; }; -&bt_hci_controller { +&bt_hci_sdc { status = "okay"; }; diff --git a/dts/vendor/nordic/nrf54h20.dtsi b/dts/vendor/nordic/nrf54h20.dtsi index 8dcd8700b274..68884b8a5672 100644 --- a/dts/vendor/nordic/nrf54h20.dtsi +++ b/dts/vendor/nordic/nrf54h20.dtsi @@ -450,9 +450,10 @@ status = "disabled"; }; - /* Note: In the nRF Connect SDK the SoftDevice Controller - * is added and set as the default Bluetooth Controller. - */ + bt_hci_sdc: bt_hci_sdc { + compatible = "nordic,bt-hci-sdc"; + status = "disabled"; + }; bt_hci_controller: bt_hci_controller { compatible = "zephyr,bt-hci-ll-sw-split"; status = "disabled"; diff --git a/dts/vendor/nordic/nrf54l20.dtsi b/dts/vendor/nordic/nrf54l20.dtsi index de63a005c1de..bee70effa0e8 100644 --- a/dts/vendor/nordic/nrf54l20.dtsi +++ b/dts/vendor/nordic/nrf54l20.dtsi @@ -261,9 +261,10 @@ status = "disabled"; }; - /* Note: In the nRF Connect SDK the SoftDevice Controller - * is added and set as the default Bluetooth Controller. - */ + bt_hci_sdc: bt_hci_sdc { + compatible = "nordic,bt-hci-sdc"; + status = "disabled"; + }; bt_hci_controller: bt_hci_controller { compatible = "zephyr,bt-hci-ll-sw-split"; status = "disabled"; diff --git a/dts/vendor/nordic/nrf54l_05_10_15.dtsi b/dts/vendor/nordic/nrf54l_05_10_15.dtsi index aa259713d2fd..95c273750387 100644 --- a/dts/vendor/nordic/nrf54l_05_10_15.dtsi +++ b/dts/vendor/nordic/nrf54l_05_10_15.dtsi @@ -250,9 +250,11 @@ status = "disabled"; }; - /* Note: In the nRF Connect SDK the SoftDevice Controller - * is added and set as the default Bluetooth Controller. - */ + bt_hci_sdc: bt_hci_sdc { + compatible = "nordic,bt-hci-sdc"; + status = "disabled"; + }; + bt_hci_controller: bt_hci_controller { compatible = "zephyr,bt-hci-ll-sw-split"; status = "disabled"; diff --git a/samples/bluetooth/bap_broadcast_sink/sample.yaml b/samples/bluetooth/bap_broadcast_sink/sample.yaml index 5d06dee0bf89..148b8b641697 100644 --- a/samples/bluetooth/bap_broadcast_sink/sample.yaml +++ b/samples/bluetooth/bap_broadcast_sink/sample.yaml @@ -24,5 +24,7 @@ tests: - nrf52_bsim - nrf52833dk/nrf52833 - nrf52840dongle/nrf52840 - extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf + extra_args: + - EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf + - SNIPPET="bt-ll-sw-split" tags: bluetooth diff --git a/samples/bluetooth/bap_broadcast_sink/sysbuild.cmake b/samples/bluetooth/bap_broadcast_sink/sysbuild.cmake index 2523aac8ea76..d5d260789ff7 100644 --- a/samples/bluetooth/bap_broadcast_sink/sysbuild.cmake +++ b/samples/bluetooth/bap_broadcast_sink/sysbuild.cmake @@ -18,6 +18,10 @@ if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) CACHE INTERNAL "" ) + list(APPEND ${NET_APP}_SNIPPET ${SNIPPET}) + list(APPEND ${NET_APP}_SNIPPET bt-ll-sw-split) + set(${NET_APP}_SNIPPET ${${NET_APP}_SNIPPET} CACHE STRING "" FORCE) + native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) endif() diff --git a/samples/bluetooth/bap_broadcast_source/sample.yaml b/samples/bluetooth/bap_broadcast_source/sample.yaml index 5e5b01d942d0..5f745cd08950 100644 --- a/samples/bluetooth/bap_broadcast_source/sample.yaml +++ b/samples/bluetooth/bap_broadcast_source/sample.yaml @@ -36,5 +36,7 @@ tests: - nrf52_bsim - nrf52833dk/nrf52833 - nrf52840dongle/nrf52840 - extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf + extra_args: + - EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf + - SNIPPET="bt-ll-sw-split" tags: bluetooth diff --git a/samples/bluetooth/bap_broadcast_source/sysbuild.cmake b/samples/bluetooth/bap_broadcast_source/sysbuild.cmake index 2523aac8ea76..d5d260789ff7 100644 --- a/samples/bluetooth/bap_broadcast_source/sysbuild.cmake +++ b/samples/bluetooth/bap_broadcast_source/sysbuild.cmake @@ -18,6 +18,10 @@ if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) CACHE INTERNAL "" ) + list(APPEND ${NET_APP}_SNIPPET ${SNIPPET}) + list(APPEND ${NET_APP}_SNIPPET bt-ll-sw-split) + set(${NET_APP}_SNIPPET ${${NET_APP}_SNIPPET} CACHE STRING "" FORCE) + native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) endif() diff --git a/samples/bluetooth/bap_unicast_client/sample.yaml b/samples/bluetooth/bap_unicast_client/sample.yaml index 7283090b8781..44f32934ce99 100644 --- a/samples/bluetooth/bap_unicast_client/sample.yaml +++ b/samples/bluetooth/bap_unicast_client/sample.yaml @@ -22,5 +22,7 @@ tests: - nrf52840dk/nrf52840 integration_platforms: - nrf52dk/nrf52832 - extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf + extra_args: + - EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf + - SNIPPET="bt-ll-sw-split" tags: bluetooth diff --git a/samples/bluetooth/bap_unicast_client/sysbuild.cmake b/samples/bluetooth/bap_unicast_client/sysbuild.cmake index 2523aac8ea76..d5d260789ff7 100644 --- a/samples/bluetooth/bap_unicast_client/sysbuild.cmake +++ b/samples/bluetooth/bap_unicast_client/sysbuild.cmake @@ -18,6 +18,10 @@ if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) CACHE INTERNAL "" ) + list(APPEND ${NET_APP}_SNIPPET ${SNIPPET}) + list(APPEND ${NET_APP}_SNIPPET bt-ll-sw-split) + set(${NET_APP}_SNIPPET ${${NET_APP}_SNIPPET} CACHE STRING "" FORCE) + native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) endif() diff --git a/samples/bluetooth/bap_unicast_server/sample.yaml b/samples/bluetooth/bap_unicast_server/sample.yaml index 068f752b626b..266ced73f66d 100644 --- a/samples/bluetooth/bap_unicast_server/sample.yaml +++ b/samples/bluetooth/bap_unicast_server/sample.yaml @@ -22,5 +22,7 @@ tests: - nrf52840dk/nrf52840 integration_platforms: - nrf52dk/nrf52832 - extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf + extra_args: + - EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf + - SNIPPET="bt-ll-sw-split" tags: bluetooth diff --git a/samples/bluetooth/bap_unicast_server/sysbuild.cmake b/samples/bluetooth/bap_unicast_server/sysbuild.cmake index 2523aac8ea76..d5d260789ff7 100644 --- a/samples/bluetooth/bap_unicast_server/sysbuild.cmake +++ b/samples/bluetooth/bap_unicast_server/sysbuild.cmake @@ -18,6 +18,10 @@ if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) CACHE INTERNAL "" ) + list(APPEND ${NET_APP}_SNIPPET ${SNIPPET}) + list(APPEND ${NET_APP}_SNIPPET bt-ll-sw-split) + set(${NET_APP}_SNIPPET ${${NET_APP}_SNIPPET} CACHE STRING "" FORCE) + native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) endif() diff --git a/samples/bluetooth/beacon/sample.yaml b/samples/bluetooth/beacon/sample.yaml index f6f08790092f..819ac3d30024 100644 --- a/samples/bluetooth/beacon/sample.yaml +++ b/samples/bluetooth/beacon/sample.yaml @@ -18,7 +18,9 @@ tests: - nrf54l15dk/nrf54l15/cpuapp - ophelia4ev/nrf54l15/cpuapp sample.bluetooth.beacon-coex: - extra_args: CONF_FILE="prj-coex.conf" + extra_args: + - CONF_FILE="prj-coex.conf" + - SNIPPET="bt-ll-sw-split" harness: bluetooth platform_allow: - nrf52840dk/nrf52840 diff --git a/samples/bluetooth/cap_acceptor/sample.yaml b/samples/bluetooth/cap_acceptor/sample.yaml index 824e744eecaf..9061f44679fb 100644 --- a/samples/bluetooth/cap_acceptor/sample.yaml +++ b/samples/bluetooth/cap_acceptor/sample.yaml @@ -26,5 +26,7 @@ tests: - nrf52833dk/nrf52833 - nrf52840dk/nrf52840 - nrf52840dongle/nrf52840 - extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf + extra_args: + - EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf + - SNIPPET="bt-ll-sw-split" tags: bluetooth diff --git a/samples/bluetooth/cap_acceptor/sysbuild.cmake b/samples/bluetooth/cap_acceptor/sysbuild.cmake index 2523aac8ea76..d5d260789ff7 100644 --- a/samples/bluetooth/cap_acceptor/sysbuild.cmake +++ b/samples/bluetooth/cap_acceptor/sysbuild.cmake @@ -18,6 +18,10 @@ if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) CACHE INTERNAL "" ) + list(APPEND ${NET_APP}_SNIPPET ${SNIPPET}) + list(APPEND ${NET_APP}_SNIPPET bt-ll-sw-split) + set(${NET_APP}_SNIPPET ${${NET_APP}_SNIPPET} CACHE STRING "" FORCE) + native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) endif() diff --git a/samples/bluetooth/cap_initiator/sample.yaml b/samples/bluetooth/cap_initiator/sample.yaml index b4f593c99129..e3e557f48301 100644 --- a/samples/bluetooth/cap_initiator/sample.yaml +++ b/samples/bluetooth/cap_initiator/sample.yaml @@ -26,5 +26,7 @@ tests: - nrf52833dk/nrf52833 - nrf52840dk/nrf52840 - nrf52840dongle/nrf52840 - extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf + extra_args: + - EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf + - SNIPPET="bt-ll-sw-split" tags: bluetooth diff --git a/samples/bluetooth/cap_initiator/sysbuild.cmake b/samples/bluetooth/cap_initiator/sysbuild.cmake index 2523aac8ea76..d5d260789ff7 100644 --- a/samples/bluetooth/cap_initiator/sysbuild.cmake +++ b/samples/bluetooth/cap_initiator/sysbuild.cmake @@ -18,6 +18,10 @@ if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) CACHE INTERNAL "" ) + list(APPEND ${NET_APP}_SNIPPET ${SNIPPET}) + list(APPEND ${NET_APP}_SNIPPET bt-ll-sw-split) + set(${NET_APP}_SNIPPET ${${NET_APP}_SNIPPET} CACHE STRING "" FORCE) + native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) endif() diff --git a/samples/bluetooth/direction_finding_central/sample.yaml b/samples/bluetooth/direction_finding_central/sample.yaml index b7a118e6cdc8..ffdf634c6e3e 100644 --- a/samples/bluetooth/direction_finding_central/sample.yaml +++ b/samples/bluetooth/direction_finding_central/sample.yaml @@ -14,15 +14,24 @@ tests: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 - nrf5340dk/nrf5340/cpuapp - sample.bluetooth.direction_finding.central.aod: + sample.bluetooth.direction_finding.central.aod_with_controller: harness: bluetooth - extra_args: EXTRA_CONF_FILE="overlay-aod.conf" + extra_args: + - EXTRA_CONF_FILE="overlay-aod.conf" + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 - - nrf5340dk/nrf5340/cpuapp tags: bluetooth integration_platforms: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 + sample.bluetooth.direction_finding.central.aod_host_only: + harness: bluetooth + extra_args: + - OVERLAY_CONFIG="overlay-aod.conf" + platform_allow: + - nrf5340dk/nrf5340/cpuapp + tags: bluetooth + integration_platforms: - nrf5340dk/nrf5340/cpuapp diff --git a/samples/bluetooth/direction_finding_connectionless_rx/sample.yaml b/samples/bluetooth/direction_finding_connectionless_rx/sample.yaml index 8e6097de58ae..c500cc80dcec 100644 --- a/samples/bluetooth/direction_finding_connectionless_rx/sample.yaml +++ b/samples/bluetooth/direction_finding_connectionless_rx/sample.yaml @@ -12,14 +12,22 @@ tests: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 - nrf5340dk/nrf5340/cpuapp - sample.bluetooth.direction_finding_connectionless_rx.aod: + sample.bluetooth.direction_finding_connectionless_rx.aod_with_controller: harness: bluetooth - extra_args: EXTRA_CONF_FILE="overlay-aod.conf" + extra_args: + - EXTRA_CONF_FILE="overlay-aod.conf" + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 - - nrf5340dk/nrf5340/cpuapp integration_platforms: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 + sample.bluetooth.direction_finding_connectionless_rx.aod_host_only: + harness: bluetooth + extra_args: + - OVERLAY_CONFIG="overlay-aod.conf" + platform_allow: + - nrf5340dk/nrf5340/cpuapp + integration_platforms: - nrf5340dk/nrf5340/cpuapp diff --git a/samples/bluetooth/direction_finding_connectionless_tx/sample.yaml b/samples/bluetooth/direction_finding_connectionless_tx/sample.yaml index 78d21b2c95f5..2a4fa93d19d5 100644 --- a/samples/bluetooth/direction_finding_connectionless_tx/sample.yaml +++ b/samples/bluetooth/direction_finding_connectionless_tx/sample.yaml @@ -12,14 +12,22 @@ tests: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 - nrf5340dk/nrf5340/cpuapp - sample.bluetooth.direction_finding_connectionless.aoa: + sample.bluetooth.direction_finding_connectionless.aoa_with_controller: harness: bluetooth - extra_args: EXTRA_CONF_FILE="overlay-aoa.conf" + extra_args: + - EXTRA_CONF_FILE="overlay-aoa.conf" + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 - - nrf5340dk/nrf5340/cpuapp integration_platforms: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 + sample.bluetooth.direction_finding_connectionless.aoa_host_only: + harness: bluetooth + extra_args: + - OVERLAY_CONFIG="overlay-aoa.conf" + platform_allow: + - nrf5340dk/nrf5340/cpuapp + integration_platforms: - nrf5340dk/nrf5340/cpuapp diff --git a/samples/bluetooth/direction_finding_peripheral/sample.yaml b/samples/bluetooth/direction_finding_peripheral/sample.yaml index f300cb415cc5..01f612ad08a0 100644 --- a/samples/bluetooth/direction_finding_peripheral/sample.yaml +++ b/samples/bluetooth/direction_finding_peripheral/sample.yaml @@ -14,15 +14,24 @@ tests: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 - nrf5340dk/nrf5340/cpuapp - sample.bluetooth.direction_finding.peripheral.aod: + sample.bluetooth.direction_finding.peripheral.aod_with_controller: harness: bluetooth - extra_args: EXTRA_CONF_FILE="overlay-aoa.conf" + extra_args: + - EXTRA_CONF_FILE="overlay-aoa.conf" + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 - - nrf5340dk/nrf5340/cpuapp tags: bluetooth integration_platforms: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 + sample.bluetooth.direction_finding.peripheral.aod_host_only: + harness: bluetooth + extra_args: + - OVERLAY_CONFIG="overlay-aoa.conf" + platform_allow: + - nrf5340dk/nrf5340/cpuapp + tags: bluetooth + integration_platforms: - nrf5340dk/nrf5340/cpuapp diff --git a/samples/bluetooth/hci_ipc/sample.yaml b/samples/bluetooth/hci_ipc/sample.yaml index b758b2547688..3763478b6b33 100644 --- a/samples/bluetooth/hci_ipc/sample.yaml +++ b/samples/bluetooth/hci_ipc/sample.yaml @@ -15,7 +15,9 @@ tests: sample.bluetooth.hci_ipc.iso_broadcast.bt_ll_sw_split: harness: bluetooth tags: bluetooth - extra_args: CONF_FILE="nrf5340_cpunet_iso_broadcast-bt_ll_sw_split.conf" + extra_args: + - CONF_FILE="nrf5340_cpunet_iso_broadcast-bt_ll_sw_split.conf" + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf5340dk/nrf5340/cpunet - nrf5340_audio_dk/nrf5340/cpunet @@ -25,7 +27,9 @@ tests: sample.bluetooth.hci_ipc.iso_receive.bt_ll_sw_split: harness: bluetooth tags: bluetooth - extra_args: CONF_FILE="nrf5340_cpunet_iso_receive-bt_ll_sw_split.conf" + extra_args: + - CONF_FILE="nrf5340_cpunet_iso_receive-bt_ll_sw_split.conf" + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf5340dk/nrf5340/cpunet - nrf5340_audio_dk/nrf5340/cpunet @@ -35,7 +39,9 @@ tests: sample.bluetooth.hci_ipc.bis.bt_ll_sw_split: harness: bluetooth tags: bluetooth - extra_args: CONF_FILE="nrf5340_cpunet_bis-bt_ll_sw_split.conf" + extra_args: + - CONF_FILE="nrf5340_cpunet_bis-bt_ll_sw_split.conf" + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf5340dk/nrf5340/cpunet - nrf5340_audio_dk/nrf5340/cpunet @@ -45,7 +51,9 @@ tests: sample.bluetooth.hci_ipc.iso_central.bt_ll_sw_split: harness: bluetooth tags: bluetooth - extra_args: CONF_FILE="nrf5340_cpunet_iso_central-bt_ll_sw_split.conf" + extra_args: + - CONF_FILE="nrf5340_cpunet_iso_central-bt_ll_sw_split.conf" + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf5340dk/nrf5340/cpunet - nrf5340_audio_dk/nrf5340/cpunet @@ -55,7 +63,9 @@ tests: sample.bluetooth.hci_ipc.iso_peripheral.bt_ll_sw_split: harness: bluetooth tags: bluetooth - extra_args: CONF_FILE="nrf5340_cpunet_iso_peripheral-bt_ll_sw_split.conf" + extra_args: + - CONF_FILE="nrf5340_cpunet_iso_peripheral-bt_ll_sw_split.conf" + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf5340dk/nrf5340/cpunet - nrf5340_audio_dk/nrf5340/cpunet @@ -65,7 +75,9 @@ tests: sample.bluetooth.hci_ipc.cis.bt_ll_sw_split: harness: bluetooth tags: bluetooth - extra_args: CONF_FILE="nrf5340_cpunet_cis-bt_ll_sw_split.conf" + extra_args: + - CONF_FILE="nrf5340_cpunet_cis-bt_ll_sw_split.conf" + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf5340dk/nrf5340/cpunet - nrf5340_audio_dk/nrf5340/cpunet @@ -75,7 +87,9 @@ tests: sample.bluetooth.hci_ipc.iso.bt_ll_sw_split: harness: bluetooth tags: bluetooth - extra_args: CONF_FILE="nrf5340_cpunet_iso-bt_ll_sw_split.conf" + extra_args: + - CONF_FILE="nrf5340_cpunet_iso-bt_ll_sw_split.conf" + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf5340dk/nrf5340/cpunet - nrf5340_audio_dk/nrf5340/cpunet @@ -99,6 +113,7 @@ tests: extra_args: - CONF_FILE="nrf5340_cpunet_df-bt_ll_sw_split.conf" - DTC_OVERLAY_FILE="nrf5340_cpunet_df-bt_ll_sw_split.overlay" + - SNIPPET="bt-ll-sw-split" platform_allow: nrf5340dk/nrf5340/cpunet integration_platforms: - nrf5340dk/nrf5340/cpunet @@ -109,13 +124,16 @@ tests: - CONF_FILE="nrf5340_cpunet_df-bt_ll_sw_split.conf" - DTC_OVERLAY_FILE="nrf5340_cpunet_df-bt_ll_sw_split.overlay" - CONFIG_BT_CTLR_PHY_CODED=n + - SNIPPET="bt-ll-sw-split" platform_allow: nrf5340dk/nrf5340/cpunet integration_platforms: - nrf5340dk/nrf5340/cpunet sample.bluetooth.hci_ipc.mesh.bt_ll_sw_split: harness: bluetooth tags: bluetooth - extra_args: CONF_FILE="nrf5340_cpunet_bt_mesh-bt_ll_sw_split.conf" + extra_args: + - CONF_FILE="nrf5340_cpunet_bt_mesh-bt_ll_sw_split.conf" + - SNIPPET="bt-ll-sw-split" platform_allow: nrf5340dk/nrf5340/cpunet integration_platforms: - nrf5340dk/nrf5340/cpunet diff --git a/samples/bluetooth/hci_uart/sample.yaml b/samples/bluetooth/hci_uart/sample.yaml index b555a74ac5bc..97ad6c561b2e 100644 --- a/samples/bluetooth/hci_uart/sample.yaml +++ b/samples/bluetooth/hci_uart/sample.yaml @@ -20,7 +20,9 @@ tests: platform_allow: nrf52833dk/nrf52833 integration_platforms: - nrf52833dk/nrf52833 - extra_args: DTC_OVERLAY_FILE=./boards/nrf52833dk_nrf52833_df.overlay + extra_args: + - DTC_OVERLAY_FILE=./boards/nrf52833dk_nrf52833_df.overlay + - SNIPPET="bt-ll-sw-split" extra_configs: - CONFIG_BT_CTLR_DF=y tags: @@ -29,7 +31,9 @@ tests: sample.bluetooth.hci_uart.nrf5340_netcore.df: harness: bluetooth platform_allow: nrf5340dk/nrf5340/cpunet - extra_args: DTC_OVERLAY_FILE=./boards/nrf5340dk_nrf5340_cpunet_df.overlay + extra_args: + - DTC_OVERLAY_FILE=./boards/nrf5340dk_nrf5340_cpunet_df.overlay + - SNIPPET="bt-ll-sw-split" extra_configs: - CONFIG_BT_CTLR_DF=y tags: @@ -40,7 +44,9 @@ tests: platform_allow: nrf52833dk/nrf52833 integration_platforms: - nrf52833dk/nrf52833 - extra_args: DTC_OVERLAY_FILE=./boards/nrf52833dk_nrf52833_df.overlay + extra_args: + - DTC_OVERLAY_FILE=./boards/nrf52833dk_nrf52833_df.overlay + - SNIPPET="bt-ll-sw-split" extra_configs: - CONFIG_BT_CTLR_DF=y - CONFIG_BT_CTLR_DTM_HCI_DF_IQ_REPORT=y @@ -50,7 +56,9 @@ tests: sample.bluetooth.hci_uart.nrf5340_netcore.df.iq_report: harness: bluetooth platform_allow: nrf5340dk/nrf5340/cpunet - extra_args: DTC_OVERLAY_FILE=./boards/nrf5340dk_nrf5340_cpunet_df.overlay + extra_args: + - DTC_OVERLAY_FILE=./boards/nrf5340dk_nrf5340_cpunet_df.overlay + - SNIPPET="bt-ll-sw-split" extra_configs: - CONFIG_BT_CTLR_DF=y - CONFIG_BT_CTLR_DTM_HCI_DF_IQ_REPORT=y @@ -84,6 +92,7 @@ tests: extra_args: - EXTRA_CONF_FILE=overlay-all-bt_ll_sw_split.conf - DTC_OVERLAY_FILE=./boards/nrf52833dk_nrf52833_df.overlay + - SNIPPET="bt-ll-sw-split" tags: - uart - bluetooth @@ -95,6 +104,7 @@ tests: extra_args: - EXTRA_CONF_FILE=overlay-all-bt_ll_sw_split.conf - DTC_OVERLAY_FILE=./boards/nrf54l15dk_nrf54l15_cpuapp_df.overlay + - SNIPPET="bt-ll-sw-split" tags: - uart - bluetooth diff --git a/samples/bluetooth/hci_vs_scan_req/sample.yaml b/samples/bluetooth/hci_vs_scan_req/sample.yaml index 245a83aa0d96..49526522d16e 100644 --- a/samples/bluetooth/hci_vs_scan_req/sample.yaml +++ b/samples/bluetooth/hci_vs_scan_req/sample.yaml @@ -9,4 +9,6 @@ tests: - nrf52dk/nrf52832 extra_configs: - CONFIG_BT_LL_SW_SPLIT=y + extra_args: + - SNIPPET="bt-ll-sw-split" tags: bluetooth diff --git a/samples/bluetooth/iso_central/sample.yaml b/samples/bluetooth/iso_central/sample.yaml index 3a7dedd404ae..57254ee809ab 100644 --- a/samples/bluetooth/iso_central/sample.yaml +++ b/samples/bluetooth/iso_central/sample.yaml @@ -11,11 +11,11 @@ tests: sample.bluetooth.iso_central.bt_ll_sw_split: harness: bluetooth platform_allow: - - qemu_cortex_m3 - - qemu_x86 - nrf52_bsim - nrf52833dk/nrf52833 integration_platforms: - nrf52833dk/nrf52833 - extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf + extra_args: + - EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf + - SNIPPET="bt-ll-sw-split" tags: bluetooth diff --git a/samples/bluetooth/pbp_public_broadcast_sink/sample.yaml b/samples/bluetooth/pbp_public_broadcast_sink/sample.yaml index d7c816ee5b76..901d40b00d4f 100644 --- a/samples/bluetooth/pbp_public_broadcast_sink/sample.yaml +++ b/samples/bluetooth/pbp_public_broadcast_sink/sample.yaml @@ -23,5 +23,7 @@ tests: integration_platforms: - nrf52_bsim - nrf52833dk/nrf52833 - extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf + extra_args: + - EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf + - SNIPPET="bt-ll-sw-split" tags: bluetooth diff --git a/samples/bluetooth/pbp_public_broadcast_sink/sysbuild.cmake b/samples/bluetooth/pbp_public_broadcast_sink/sysbuild.cmake index 2523aac8ea76..d5d260789ff7 100644 --- a/samples/bluetooth/pbp_public_broadcast_sink/sysbuild.cmake +++ b/samples/bluetooth/pbp_public_broadcast_sink/sysbuild.cmake @@ -18,6 +18,10 @@ if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) CACHE INTERNAL "" ) + list(APPEND ${NET_APP}_SNIPPET ${SNIPPET}) + list(APPEND ${NET_APP}_SNIPPET bt-ll-sw-split) + set(${NET_APP}_SNIPPET ${${NET_APP}_SNIPPET} CACHE STRING "" FORCE) + native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) endif() diff --git a/samples/bluetooth/pbp_public_broadcast_source/sample.yaml b/samples/bluetooth/pbp_public_broadcast_source/sample.yaml index 80c907042119..1d2e31306e29 100644 --- a/samples/bluetooth/pbp_public_broadcast_source/sample.yaml +++ b/samples/bluetooth/pbp_public_broadcast_source/sample.yaml @@ -23,5 +23,7 @@ tests: integration_platforms: - nrf52_bsim - nrf52833dk/nrf52833 - extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf + extra_args: + - EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf + - SNIPPET="bt-ll-sw-split" tags: bluetooth diff --git a/samples/bluetooth/pbp_public_broadcast_source/sysbuild.cmake b/samples/bluetooth/pbp_public_broadcast_source/sysbuild.cmake index d3bf7be5b6c3..e0a7fd9d175d 100644 --- a/samples/bluetooth/pbp_public_broadcast_source/sysbuild.cmake +++ b/samples/bluetooth/pbp_public_broadcast_source/sysbuild.cmake @@ -18,6 +18,10 @@ if(NOT("${SB_CONFIG_NET_CORE_BOARD}" STREQUAL "")) CACHE INTERNAL "" ) + list(APPEND ${NET_APP}_SNIPPET ${SNIPPET}) + list(APPEND ${NET_APP}_SNIPPET bt-ll-sw-split) + set(${NET_APP}_SNIPPET ${${NET_APP}_SNIPPET} CACHE STRING "" FORCE) + native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) endif() diff --git a/snippets/bt-ll-sw-split/bt-ll-sw-split.overlay b/snippets/bt-ll-sw-split/bt-ll-sw-split.overlay index 04bf83ef44d4..a57a0e82ba6e 100644 --- a/snippets/bt-ll-sw-split/bt-ll-sw-split.overlay +++ b/snippets/bt-ll-sw-split/bt-ll-sw-split.overlay @@ -2,6 +2,10 @@ status = "okay"; }; +&bt_hci_sdc { + status = "disabled"; +}; + / { chosen { zephyr,bt-hci = &bt_hci_controller; diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c index d3e1f77b3553..f93ea59f38e3 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c @@ -62,7 +62,7 @@ static struct { /* FIXME: This could probably use a chosen entropy device instead on relying on * the nodelabel being the same as for the old nrf rng. */ -static const struct device *const dev_entropy = DEVICE_DT_GET(DT_NODELABEL(rng)); +static const struct device *const dev_entropy = DEVICE_DT_GET(DT_CHOSEN(zephyr_entropy)); #endif /* CONFIG_ENTROPY_HAS_DRIVER */ static int init_reset(void); diff --git a/tests/bluetooth/controller/ctrl_api/testcase.yaml b/tests/bluetooth/controller/ctrl_api/testcase.yaml index 19bf6c9ab490..21f178bf9b2b 100644 --- a/tests/bluetooth/controller/ctrl_api/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_api/testcase.yaml @@ -6,3 +6,5 @@ common: tests: bluetooth.controller.ctrl_api.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_chmu/testcase.yaml b/tests/bluetooth/controller/ctrl_chmu/testcase.yaml index f7e8068d60ec..9c3ee6264335 100644 --- a/tests/bluetooth/controller/ctrl_chmu/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_chmu/testcase.yaml @@ -6,3 +6,5 @@ common: tests: bluetooth.controller.ctrl_chmu.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_cis_create/testcase.yaml b/tests/bluetooth/controller/ctrl_cis_create/testcase.yaml index 99612a89bc31..2371d7063eb7 100644 --- a/tests/bluetooth/controller/ctrl_cis_create/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_cis_create/testcase.yaml @@ -6,3 +6,5 @@ common: tests: bluetooth.controller.ctrl_cis_create.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_cis_terminate/testcase.yaml b/tests/bluetooth/controller/ctrl_cis_terminate/testcase.yaml index 956172a89b20..a98229ba45f3 100644 --- a/tests/bluetooth/controller/ctrl_cis_terminate/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_cis_terminate/testcase.yaml @@ -6,3 +6,5 @@ common: tests: bluetooth.controller.ctrl_cis_terminate.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_collision/testcase.yaml b/tests/bluetooth/controller/ctrl_collision/testcase.yaml index 6086a9a4ebc8..daa8f3bc6c3d 100644 --- a/tests/bluetooth/controller/ctrl_collision/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_collision/testcase.yaml @@ -6,3 +6,5 @@ common: tests: bluetooth.controller.ctrl_collision.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_conn_update/testcase.yaml b/tests/bluetooth/controller/ctrl_conn_update/testcase.yaml index 5b0bda4b9088..fc4ecb0b647d 100644 --- a/tests/bluetooth/controller/ctrl_conn_update/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_conn_update/testcase.yaml @@ -7,11 +7,18 @@ common: tests: bluetooth.controller.ctrl_conn_update.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" bluetooth.controller.ctrl_conn_update.apm_test: type: unit - extra_args: CONF_FILE=prj_apm.conf + extra_args: + - CONF_FILE=prj_apm.conf + - SNIPPET="bt-ll-sw-split" + bluetooth.controller.ctrl_conn_update.no_param_req_test: type: unit - extra_args: CONF_FILE=prj_no_param_req.conf + extra_args: + - CONF_FILE=prj_no_param_req.conf + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_cte_req/testcase.yaml b/tests/bluetooth/controller/ctrl_cte_req/testcase.yaml index fd6ff51118d9..c6288aecc433 100644 --- a/tests/bluetooth/controller/ctrl_cte_req/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_cte_req/testcase.yaml @@ -6,3 +6,5 @@ common: tests: bluetooth.controller.ctrl_cte_req.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_data_length_update/testcase.yaml b/tests/bluetooth/controller/ctrl_data_length_update/testcase.yaml index 9778af435b4a..c7d1174e12bf 100644 --- a/tests/bluetooth/controller/ctrl_data_length_update/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_data_length_update/testcase.yaml @@ -6,11 +6,17 @@ common: tests: bluetooth.controller.ctrl_data_length_update.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" bluetooth.controller.ctrl_data_length_update.test_nocodedphy: type: unit - extra_args: CONF_FILE=prj_nocoded.conf + extra_args: + - CONF_FILE=prj_nocoded.conf + - SNIPPET="bt-ll-sw-split" bluetooth.controller.ctrl_data_length_update.test_nophy: type: unit - extra_args: CONF_FILE=prj_nophy.conf + extra_args: + - CONF_FILE=prj_nophy.conf + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_encrypt/testcase.yaml b/tests/bluetooth/controller/ctrl_encrypt/testcase.yaml index d5bb2cb8b110..86dd5bfe4d30 100644 --- a/tests/bluetooth/controller/ctrl_encrypt/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_encrypt/testcase.yaml @@ -6,3 +6,5 @@ common: tests: bluetooth.controller.ctrl_encrypt.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_feature_exchange/testcase.yaml b/tests/bluetooth/controller/ctrl_feature_exchange/testcase.yaml index 257542f36120..087e49575ff7 100644 --- a/tests/bluetooth/controller/ctrl_feature_exchange/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_feature_exchange/testcase.yaml @@ -6,3 +6,5 @@ common: tests: bluetooth.controller.ctrl_feature_exchange.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_hci/testcase.yaml b/tests/bluetooth/controller/ctrl_hci/testcase.yaml index c750ebc8dd8e..5e00c85f6f43 100644 --- a/tests/bluetooth/controller/ctrl_hci/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_hci/testcase.yaml @@ -6,3 +6,5 @@ common: tests: bluetooth.controller.ctrl_hci.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_invalid/testcase.yaml b/tests/bluetooth/controller/ctrl_invalid/testcase.yaml index 2d1741931e37..cee54e6b09ed 100644 --- a/tests/bluetooth/controller/ctrl_invalid/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_invalid/testcase.yaml @@ -6,3 +6,5 @@ common: tests: bluetooth.controller.ctrl_invalid.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_le_ping/testcase.yaml b/tests/bluetooth/controller/ctrl_le_ping/testcase.yaml index b6a77528f32d..54178905da17 100644 --- a/tests/bluetooth/controller/ctrl_le_ping/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_le_ping/testcase.yaml @@ -6,3 +6,5 @@ common: tests: bluetooth.controller.ctrl_le_ping.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_min_used_chans/testcase.yaml b/tests/bluetooth/controller/ctrl_min_used_chans/testcase.yaml index 0991b0cdd43c..a9445cbf8c4d 100644 --- a/tests/bluetooth/controller/ctrl_min_used_chans/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_min_used_chans/testcase.yaml @@ -6,3 +6,5 @@ common: tests: bluetooth.controller.ctrl_min_used_chans.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_phy_update/testcase.yaml b/tests/bluetooth/controller/ctrl_phy_update/testcase.yaml index 1d7da169f1d8..d5c49d587a8f 100644 --- a/tests/bluetooth/controller/ctrl_phy_update/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_phy_update/testcase.yaml @@ -6,6 +6,10 @@ common: tests: bluetooth.controller.ctrl_phy_update.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" bluetooth.controller.ctrl_phy_update.test_reduced_buf: type: unit - extra_args: CONF_FILE=prj_rx_cnt.conf + extra_args: + - CONF_FILE=prj_rx_cnt.conf + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_sca_update/testcase.yaml b/tests/bluetooth/controller/ctrl_sca_update/testcase.yaml index cbf63aa1b575..cbc3c3faf720 100644 --- a/tests/bluetooth/controller/ctrl_sca_update/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_sca_update/testcase.yaml @@ -6,3 +6,5 @@ common: tests: bluetooth.controller.ctrl_sca_update.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_sw_privacy/testcase.yaml b/tests/bluetooth/controller/ctrl_sw_privacy/testcase.yaml index 778606d69549..ac5dd6e957eb 100644 --- a/tests/bluetooth/controller/ctrl_sw_privacy/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_sw_privacy/testcase.yaml @@ -4,3 +4,5 @@ common: tests: bluetooth.ctrl_sw_privacy.test: platform_allow: nrf52_bsim + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_terminate/testcase.yaml b/tests/bluetooth/controller/ctrl_terminate/testcase.yaml index cbe639401ea3..6b1409e9653e 100644 --- a/tests/bluetooth/controller/ctrl_terminate/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_terminate/testcase.yaml @@ -6,3 +6,5 @@ common: tests: bluetooth.controller.ctrl_terminate.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_tx_buffer_alloc/testcase.yaml b/tests/bluetooth/controller/ctrl_tx_buffer_alloc/testcase.yaml index 614eb7fe94c0..363986bd3d35 100644 --- a/tests/bluetooth/controller/ctrl_tx_buffer_alloc/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_tx_buffer_alloc/testcase.yaml @@ -6,23 +6,35 @@ common: tests: bluetooth.controller.ctrl_tx_buffer_alloc.test_0_per_conn: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" bluetooth.controller.ctrl_tx_buffer_alloc.test_1_per_conn: type: unit - extra_args: CONF_FILE=prj_1.conf + extra_args: + - CONF_FILE=prj_1.conf + - SNIPPET="bt-ll-sw-split" bluetooth.controller.ctrl_tx_buffer_alloc.test_2_per_conn: type: unit - extra_args: CONF_FILE=prj_2.conf + extra_args: + - CONF_FILE=prj_2.conf + - SNIPPET="bt-ll-sw-split" bluetooth.controller.ctrl_tx_buffer_alloc.test_3_per_conn: type: unit - extra_args: CONF_FILE=prj_3.conf + extra_args: + - CONF_FILE=prj_3.conf + - SNIPPET="bt-ll-sw-split" bluetooth.controller.ctrl_tx_buffer_alloc.test_max_per_conn_alloc: type: unit - extra_args: CONF_FILE=prj_max.conf + extra_args: + - CONF_FILE=prj_max.conf + - SNIPPET="bt-ll-sw-split" bluetooth.controller.ctrl_tx_buffer_alloc.test_max_common_alloc: type: unit - extra_args: CONF_FILE=prj_max_common.conf + extra_args: + - CONF_FILE=prj_max_common.conf + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_tx_queue/testcase.yaml b/tests/bluetooth/controller/ctrl_tx_queue/testcase.yaml index 295ad891a630..282b620b317a 100644 --- a/tests/bluetooth/controller/ctrl_tx_queue/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_tx_queue/testcase.yaml @@ -5,3 +5,5 @@ common: tests: bluetooth.ctrl_tx_queue.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_unsupported/testcase.yaml b/tests/bluetooth/controller/ctrl_unsupported/testcase.yaml index 28aba1a752a8..48b18af93536 100644 --- a/tests/bluetooth/controller/ctrl_unsupported/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_unsupported/testcase.yaml @@ -6,7 +6,11 @@ common: tests: bluetooth.controller.ctrl_unsupported.default.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" bluetooth.controller.ctrl_unsupported.test: type: unit - extra_args: CONF_FILE=prj_unsupported.conf + extra_args: + - CONF_FILE=prj_unsupported.conf + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_user_ext/testcase.yaml b/tests/bluetooth/controller/ctrl_user_ext/testcase.yaml index af319a7a7191..be963df24a8a 100644 --- a/tests/bluetooth/controller/ctrl_user_ext/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_user_ext/testcase.yaml @@ -4,3 +4,5 @@ common: tests: bluetooth.ctrl_user_ext.test: platform_allow: nrf52_bsim + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_version/testcase.yaml b/tests/bluetooth/controller/ctrl_version/testcase.yaml index 6badcbc72547..5df86b9bca9f 100644 --- a/tests/bluetooth/controller/ctrl_version/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_version/testcase.yaml @@ -6,3 +6,5 @@ common: tests: bluetooth.controller.ctrl_version.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/df/connection_cte_req/testcase.yaml b/tests/bluetooth/df/connection_cte_req/testcase.yaml index 768aba4a51f5..fbfe4b0d9a1a 100644 --- a/tests/bluetooth/df/connection_cte_req/testcase.yaml +++ b/tests/bluetooth/df/connection_cte_req/testcase.yaml @@ -2,3 +2,5 @@ tests: bluetooth.df.conection_cte_req: platform_allow: nrf52_bsim tags: bluetooth + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/df/connection_cte_tx_params/testcase.yaml b/tests/bluetooth/df/connection_cte_tx_params/testcase.yaml index 38a23b0950e3..a9986c5b0e53 100644 --- a/tests/bluetooth/df/connection_cte_tx_params/testcase.yaml +++ b/tests/bluetooth/df/connection_cte_tx_params/testcase.yaml @@ -2,3 +2,5 @@ tests: bluetooth.df.conection_cte_tx_params: platform_allow: nrf52_bsim tags: bluetooth + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/df/connectionless_cte_chains/testcase.yaml b/tests/bluetooth/df/connectionless_cte_chains/testcase.yaml index 6aa5bb0f0c1c..844a7bbb524e 100644 --- a/tests/bluetooth/df/connectionless_cte_chains/testcase.yaml +++ b/tests/bluetooth/df/connectionless_cte_chains/testcase.yaml @@ -2,3 +2,5 @@ tests: bluetooth.df.connectionless_cte_chains: platform_allow: nrf52_bsim tags: bluetooth + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/df/connectionless_cte_rx/testcase.yaml b/tests/bluetooth/df/connectionless_cte_rx/testcase.yaml index f839b1910eb2..c8f08a908436 100644 --- a/tests/bluetooth/df/connectionless_cte_rx/testcase.yaml +++ b/tests/bluetooth/df/connectionless_cte_rx/testcase.yaml @@ -2,3 +2,5 @@ tests: bluetooth.df.connectionless_cte_rx: platform_allow: nrf52_bsim tags: bluetooth + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/df/connectionless_cte_tx/testcase.yaml b/tests/bluetooth/df/connectionless_cte_tx/testcase.yaml index 77d651d0cbc2..491cc0e7e599 100644 --- a/tests/bluetooth/df/connectionless_cte_tx/testcase.yaml +++ b/tests/bluetooth/df/connectionless_cte_tx/testcase.yaml @@ -2,3 +2,5 @@ tests: bluetooth.df.connectionless_cte_tx: platform_allow: nrf52_bsim tags: bluetooth + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/init/testcase.yaml b/tests/bluetooth/init/testcase.yaml index dd44257e0128..a5cc40cd39e7 100644 --- a/tests/bluetooth/init/testcase.yaml +++ b/tests/bluetooth/init/testcase.yaml @@ -74,7 +74,9 @@ tests: extra_args: CONF_FILE=prj_9.conf platform_allow: qemu_cortex_m3 bluetooth.init.test_ctlr: - extra_args: CONF_FILE=prj_ctlr.conf + extra_args: + - CONF_FILE=prj_ctlr.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -86,7 +88,9 @@ tests: - nrf51dk/nrf51822 - rv32m1_vega/openisa_rv32m1/ri5cy bluetooth.init.test_ctlr_4_0: - extra_args: CONF_FILE=prj_ctlr_4_0.conf + extra_args: + - CONF_FILE=prj_ctlr_4_0.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -95,7 +99,9 @@ tests: - nrf52dk/nrf52832 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_4_0_dbg: - extra_args: CONF_FILE=prj_ctlr_4_0_dbg.conf + extra_args: + - CONF_FILE=prj_ctlr_4_0_dbg.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -104,7 +110,9 @@ tests: - nrf52dk/nrf52832 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_tiny: - extra_args: CONF_FILE=prj_ctlr_tiny.conf + extra_args: + - CONF_FILE=prj_ctlr_tiny.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -116,6 +124,7 @@ tests: extra_args: - CONF_FILE=prj_ctlr_dbg.conf - DTC_OVERLAY_FILE=pa_lna.overlay + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -126,6 +135,7 @@ tests: extra_args: - CONF_FILE=prj_ctlr_5_x_dbg.conf - DTC_OVERLAY_FILE=pa_lna.overlay + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -137,6 +147,7 @@ tests: - CONF_FILE=prj_ctlr.conf - CONFIG_BT_CTLR_ADVANCED_FEATURES=y - CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER=y + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf5340dk/nrf5340/cpunet - nrf52840dk/nrf52840 @@ -146,13 +157,16 @@ tests: bluetooth.init.test_ctlr_ticker: extra_args: - CONF_FILE=prj_ctlr_ticker.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 integration_platforms: - nrf52dk/nrf52832 bluetooth.init.test_ctlr_broadcaster: - extra_args: CONF_FILE=prj_ctlr_broadcaster.conf + extra_args: + - CONF_FILE=prj_ctlr_broadcaster.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -161,7 +175,9 @@ tests: integration_platforms: - nrf52dk/nrf52832 bluetooth.init.test_ctlr_peripheral: - extra_args: CONF_FILE=prj_ctlr_peripheral.conf + extra_args: + - CONF_FILE=prj_ctlr_peripheral.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -170,7 +186,9 @@ tests: integration_platforms: - nrf52dk/nrf52832 bluetooth.init.test_ctlr_peripheral_priv: - extra_args: CONF_FILE=prj_ctlr_peripheral_priv.conf + extra_args: + - CONF_FILE=prj_ctlr_peripheral_priv.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -179,7 +197,9 @@ tests: integration_platforms: - nrf52840dk/nrf52840 bluetooth.init.test_ctlr_observer: - extra_args: CONF_FILE=prj_ctlr_observer.conf + extra_args: + - CONF_FILE=prj_ctlr_observer.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -188,7 +208,9 @@ tests: integration_platforms: - nrf52dk/nrf52832 bluetooth.init.test_ctlr_central: - extra_args: CONF_FILE=prj_ctlr_central.conf + extra_args: + - CONF_FILE=prj_ctlr_central.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -198,7 +220,9 @@ tests: - nrf52dk/nrf52832 - rv32m1_vega/openisa_rv32m1/ri5cy bluetooth.init.test_ctlr_central_priv: - extra_args: CONF_FILE=prj_ctlr_central_priv.conf + extra_args: + - CONF_FILE=prj_ctlr_central_priv.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -208,7 +232,9 @@ tests: - nrf52dk/nrf52832 - rv32m1_vega/openisa_rv32m1/ri5cy bluetooth.init.test_ctlr_broadcaster_ext: - extra_args: CONF_FILE=prj_ctlr_broadcaster_ext.conf + extra_args: + - CONF_FILE=prj_ctlr_broadcaster_ext.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -217,7 +243,9 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_peripheral_ext: - extra_args: CONF_FILE=prj_ctlr_peripheral_ext.conf + extra_args: + - CONF_FILE=prj_ctlr_peripheral_ext.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -226,7 +254,9 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_peripheral_ext_priv: - extra_args: CONF_FILE=prj_ctlr_peripheral_ext_priv.conf + extra_args: + - CONF_FILE=prj_ctlr_peripheral_ext_priv.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -235,7 +265,9 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_oberver_ext: - extra_args: CONF_FILE=prj_ctlr_observer_ext.conf + extra_args: + - CONF_FILE=prj_ctlr_observer_ext.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -244,7 +276,9 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_central_ext: - extra_args: CONF_FILE=prj_ctlr_central_ext.conf + extra_args: + - CONF_FILE=prj_ctlr_central_ext.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -253,7 +287,9 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_central_ext_priv: - extra_args: CONF_FILE=prj_ctlr_central_ext_priv.conf + extra_args: + - CONF_FILE=prj_ctlr_central_ext_priv.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -262,7 +298,9 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_per_adv: - extra_args: CONF_FILE=prj_ctlr_per_adv.conf + extra_args: + - CONF_FILE=prj_ctlr_per_adv.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -271,7 +309,9 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_per_adv_no_adi: - extra_args: CONF_FILE=prj_ctlr_per_adv_no_adi.conf + extra_args: + - CONF_FILE=prj_ctlr_per_adv_no_adi.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -280,7 +320,9 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_per_sync: - extra_args: CONF_FILE=prj_ctlr_per_sync.conf + extra_args: + - CONF_FILE=prj_ctlr_per_sync.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -289,7 +331,9 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_per_sync_no_adi: - extra_args: CONF_FILE=prj_ctlr_per_sync_no_adi.conf + extra_args: + - CONF_FILE=prj_ctlr_per_sync_no_adi.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -298,7 +342,9 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_per_sync_no_filter: - extra_args: CONF_FILE=prj_ctlr_per_sync_no_filter.conf + extra_args: + - CONF_FILE=prj_ctlr_per_sync_no_filter.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -307,7 +353,9 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_peripheral_iso: - extra_args: CONF_FILE=prj_ctlr_peripheral_iso.conf + extra_args: + - CONF_FILE=prj_ctlr_peripheral_iso.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -316,7 +364,9 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_central_iso: - extra_args: CONF_FILE=prj_ctlr_central_iso.conf + extra_args: + - CONF_FILE=prj_ctlr_central_iso.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -335,7 +385,9 @@ tests: - DTC_OVERLAY_FILE=h5.overlay platform_allow: qemu_cortex_m3 bluetooth.init.test_llcp: - extra_args: CONF_FILE=prj_llcp.conf + extra_args: + - CONF_FILE=prj_llcp.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -347,6 +399,7 @@ tests: extra_args: - CONF_FILE=prj_ctlr.conf - CONFIG_BT_RECV_WORKQ_BT=y + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 bluetooth.init.test_host_6_x: From e9da911d1d201b953c920a536f1c1c6b0cda5327 Mon Sep 17 00:00:00 2001 From: Georgios Vasilakis Date: Fri, 21 Jun 2024 13:25:22 +0200 Subject: [PATCH 0536/2141] [nrf noup] soc: nrf54l: Add custom section for KMU Add a custom section in the linker which should always be placed in the top of RAM. This will be used by the KMU to push keys into it. Since when you provision a key into the KMU you need to set specific a memory location for the PUSH operation we need to keep this memory location static across images/dfus. The linker script inclusion which places the KMU reserved buffer on the top of RAM doesn't work for non-XIP builds. The Zephyr linker script will firstly load the code for an non-XIP build in RAM and then include this KMU related linker script which results in an unpredictable placement of the KMU reserved area and a failed build. In order to support non-XIP builds the linker file is not included and the a DTS reserved-memory entry should be used. To limit the scope, the DTS reserved memory region is currently only supported for non-XIP builds. This is a noup since the KMU is not supported upstream. Ref: NCSDK-25121 Signed-off-by: Georgios Vasilakis (cherry picked from commit d1c0da1cd5ef77af0e88625d1cc3a45b4b18cfb5) --- soc/nordic/nrf54l/CMakeLists.txt | 9 +++++++++ soc/nordic/nrf54l/kmu_push_area_section.ld | 19 +++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 soc/nordic/nrf54l/kmu_push_area_section.ld diff --git a/soc/nordic/nrf54l/CMakeLists.txt b/soc/nordic/nrf54l/CMakeLists.txt index cebbda571b68..d986fe9c20d5 100644 --- a/soc/nordic/nrf54l/CMakeLists.txt +++ b/soc/nordic/nrf54l/CMakeLists.txt @@ -6,3 +6,12 @@ zephyr_library_sources( ../validate_rram_partitions.c ) zephyr_include_directories(.) + +# We need a buffer in memory in a static location which can be used by +# the KMU peripheral. The KMU has a static destination address, we chose +# this address to be 0x20000000, which is the first address in the SRAM. +if(NOT CONFIG_BUILD_WITH_TFM AND CONFIG_PSA_NEED_CRACEN_KMU_DRIVER AND CONFIG_XIP) +# Exclamation mark is printable character with the lowest number in ASCII table. +# We are sure that this file will be included first. +zephyr_linker_sources(RAM_SECTIONS SORT_KEY ! kmu_push_area_section.ld) +endif() diff --git a/soc/nordic/nrf54l/kmu_push_area_section.ld b/soc/nordic/nrf54l/kmu_push_area_section.ld new file mode 100644 index 000000000000..e8c8cd9f09ad --- /dev/null +++ b/soc/nordic/nrf54l/kmu_push_area_section.ld @@ -0,0 +1,19 @@ +# This section must be loaded first of all the +# custom sections because we want it to be placed +# at the top address of RAM. +SECTION_PROLOGUE(NRF_KMU_RESERVED_PUSH_SECTION,(NOLOAD) ,) +{ + __nrf_kmu_reserved_push_area = .; + *(.nrf_kmu_reserved_push_area) + __nrf_kmu_reserved_push_area_end = .; +} GROUP_NOLOAD_LINK_IN(RAMABLE_REGION, RAMABLE_REGION) + +# It doesn't seem to be possible to enforce placing a section +# at a specific address in memory using the Zephyr SECTION macros. +# So this assert is necessary to avoid accidentatly moving this +# section to a different address. +ASSERT(__nrf_kmu_reserved_push_area == RAM_ADDR, "Error: \ + The section NRF_KMU_RESERVED_PUSH_SECTION needs to be \ + placed on the top RAM address but it is not, please edit \ + your linker scripts to make sure that it is placed on \ + the to RAM address.") From 0d882bd5dfc71bf18fd548404dc30d6674308f09 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Thu, 12 Dec 2024 07:58:06 +0000 Subject: [PATCH 0537/2141] [nrf noup] samples/tests: Add TF-M sysbuild config files Fixes some issues with samples/tests by adding configuration files to satisfy TF-M requirements Signed-off-by: Jamie McCrae (cherry picked from commit d8c9f9eb6b9f9380dc75272caf2cd92c3aa1bfe6) --- samples/subsys/usb/dfu/sysbuild.conf | 1 + tests/drivers/flash/common/sysbuild.conf | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 samples/subsys/usb/dfu/sysbuild.conf delete mode 100644 tests/drivers/flash/common/sysbuild.conf diff --git a/samples/subsys/usb/dfu/sysbuild.conf b/samples/subsys/usb/dfu/sysbuild.conf new file mode 100644 index 000000000000..47f00ff3cff8 --- /dev/null +++ b/samples/subsys/usb/dfu/sysbuild.conf @@ -0,0 +1 @@ +SB_CONFIG_BOOTLOADER_MCUBOOT=y diff --git a/tests/drivers/flash/common/sysbuild.conf b/tests/drivers/flash/common/sysbuild.conf deleted file mode 100644 index 6408669a8474..000000000000 --- a/tests/drivers/flash/common/sysbuild.conf +++ /dev/null @@ -1 +0,0 @@ -SB_CONFIG_PARTITION_MANAGER=n From a83567fd12f3f2f0e5dc1a4c6ed6d667e7154bb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Wed, 8 Jan 2025 10:48:30 +0100 Subject: [PATCH 0538/2141] [nrf noup] Revert "mbedtls: auto-select MBEDTLS_CIPHER_AES_ENABLED when built-in in PSA" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit ac6d8342728c8a63f9fea965ce41610618aeed5a. Temporarily revert an upstream change that leads to a Kconfig dependency loop with MBEDTLS_CIPHER_AES_ENABLED. This is supposed to be replaced with a better fix later. Signed-off-by: Andrzej Głąbek (cherry picked from commit 00d0d89876b11bde42bae4c00412786424cfc1fe) --- modules/mbedtls/Kconfig.mbedtls | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/mbedtls/Kconfig.mbedtls b/modules/mbedtls/Kconfig.mbedtls index 7b5122670e5e..2d8f260b5d13 100644 --- a/modules/mbedtls/Kconfig.mbedtls +++ b/modules/mbedtls/Kconfig.mbedtls @@ -283,7 +283,6 @@ config MBEDTLS_SOME_CIPHER_ENABLED config MBEDTLS_CIPHER_AES_ENABLED bool "AES block cipher" - default y if PSA_WANT_KEY_TYPE_AES && MBEDTLS_PSA_CRYPTO_C if MBEDTLS_CIPHER_AES_ENABLED From 1449016262127173218fd276fab23c4b97800c7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Fri, 24 Jan 2025 17:57:54 +0100 Subject: [PATCH 0539/2141] [nrf noup] tests: arm_irq_vector_table: Disable starting of SSF client MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This test cannot be executed with the SDFW Service Framework client started, so disable its initialization. Signed-off-by: Andrzej Głąbek (cherry picked from commit dbd39369412159c1a9655f17f3d8636ec3722abe) --- .../arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpuapp.conf | 1 + .../arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpurad.conf | 1 + 2 files changed, 2 insertions(+) diff --git a/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpuapp.conf b/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpuapp.conf index 0bcc82e646b1..025c842f70bb 100644 --- a/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpuapp.conf +++ b/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpuapp.conf @@ -1 +1,2 @@ CONFIG_SOC_NRF54H20_GPD=n +CONFIG_SSF_CLIENT_SYS_INIT=n diff --git a/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpurad.conf b/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpurad.conf index 0bcc82e646b1..025c842f70bb 100644 --- a/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpurad.conf +++ b/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpurad.conf @@ -1 +1,2 @@ CONFIG_SOC_NRF54H20_GPD=n +CONFIG_SSF_CLIENT_SYS_INIT=n From 8797d168475faaa8c96cab970881b8ee35dfa2c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Grochala?= Date: Fri, 31 Jan 2025 16:09:26 +0000 Subject: [PATCH 0540/2141] [nrf noup] bluetooth: Temporary Kconfig fix for BT RPC configuration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The BT_DRIVERS symbol default value 'y' used to depend on !BT_CTLR but now it is always on when BT is set. For BT_RPC the BT_DRIVERS symbol must not be enabled on the client side as no driver is used. The temporary solution is to set BT_DRIVERS to 'y' by default only when BT_HCI stack selection is enabled. It will be 'n' when BT_RPC_STACK is enabled. The fix should be fine as NCS uses either HCI or RPC stack. Signed-off-by: Michał Grochala (cherry picked from commit 6bfcdca9b4d51f1f291fdb3ebef1bbe9d21f79e8) --- drivers/bluetooth/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/bluetooth/Kconfig b/drivers/bluetooth/Kconfig index a1680af6583d..e64a33f663ce 100644 --- a/drivers/bluetooth/Kconfig +++ b/drivers/bluetooth/Kconfig @@ -12,7 +12,7 @@ menuconfig BT_DRIVERS bool "Bluetooth drivers" default y - depends on BT + depends on BT && BT_HCI if BT_DRIVERS From ff0b9ad68007db349497f7a4cb33e3235e4473ea Mon Sep 17 00:00:00 2001 From: Tomi Fontanilles Date: Fri, 31 Jan 2025 14:47:05 +0200 Subject: [PATCH 0541/2141] [nrf noup] tests: secure_storage: fix test w/ ZMS backend on 54L15 noup because it's about partition manager. Fix the build of secure_storage.psa.its.secure_storage.store.zms on nrf54l15dk/nrf54l15/cpuapp by disabling partition manager, which is incompatible with the ZMS implementation of the ITS store module. Disabling it only for that test as it's not needed for the others and even makes the NS board targets fail if disabling PM. Signed-off-by: Tomi Fontanilles (cherry picked from commit 9bb16add93e0c3cd4d84259a94819f695db3a88e) --- tests/subsys/secure_storage/psa/its/testcase.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/subsys/secure_storage/psa/its/testcase.yaml b/tests/subsys/secure_storage/psa/its/testcase.yaml index 05f1c1b9a6ac..74bcec135863 100644 --- a/tests/subsys/secure_storage/psa/its/testcase.yaml +++ b/tests/subsys/secure_storage/psa/its/testcase.yaml @@ -28,6 +28,7 @@ tests: extra_args: - EXTRA_DTC_OVERLAY_FILE=zms.overlay - EXTRA_CONF_FILE=overlay-secure_storage.conf;overlay-store_zms.conf;overlay-transform_default.conf + - SB_CONFIG_PARTITION_MANAGER=n secure_storage.psa.its.secure_storage.store.settings: filter: CONFIG_SECURE_STORAGE_ITS_STORE_IMPLEMENTATION_SETTINGS From b3b520b40258b238a58133f568353a852ca8eb87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Audun=20Kvamtr=C3=B8?= Date: Tue, 4 Feb 2025 14:55:58 +0100 Subject: [PATCH 0542/2141] [nrf noup] ble: Adding missing AES config for BT_CRYPTO MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Adding imply MBEDTLS_CIPHER_AES_ENABLED if not TF-M build in BT_CRYPTO -Needed to set a specific symbol for MBEDTLS + MBEDTLS_BUILTIN to work on network core build. -This [nrf noup] can be removed once PSA crypto is fully supported in network core, or PSA crypto is not compiled in at all and is provided as a RPC-mechanism via the app-core Signed-off-by: Frank Audun Kvamtrø (cherry picked from commit b7555adb610d2d65a01e5da9f54ee2ddcd29a1fe) --- subsys/bluetooth/crypto/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/subsys/bluetooth/crypto/Kconfig b/subsys/bluetooth/crypto/Kconfig index 0856daf9d9a5..0f46a0f59a0f 100644 --- a/subsys/bluetooth/crypto/Kconfig +++ b/subsys/bluetooth/crypto/Kconfig @@ -8,6 +8,7 @@ config BT_CRYPTO select PSA_WANT_KEY_TYPE_AES select PSA_WANT_ALG_CMAC select PSA_WANT_ALG_ECB_NO_PADDING + imply MBEDTLS_CIPHER_AES_ENABLED if !BUILD_WITH_TFM imply MBEDTLS_AES_ROM_TABLES if MBEDTLS_PSA_CRYPTO_C help This option enables the Bluetooth Cryptographic Toolbox. From d2ca24360362b22d0bce60bf1227dfd148614268 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Wed, 13 Nov 2024 14:00:17 +0000 Subject: [PATCH 0543/2141] [nrf noup] samples: mgmt: mcumgr: smp_svr: Add nrf5340dk-optimised sample Adds a configuration to this sample that is optimised for testing/usage with the nRF5340 which enables the Bluetooth transport, enables most management groups, has a static partition manager file with secondary partitions on QSPI flash, configures MCUboot in overwrite only mode with network core update support Signed-off-by: Jamie McCrae (cherry picked from commit 0151175fa37dbf873b458127dda50c5a4dad4616) --- .../mcumgr/smp_svr/app_nrf5340_bt.overlay | 5 ++ .../mcumgr/smp_svr/pm_static_nrf5340_bt.yml | 55 ++++++++++++ .../mgmt/mcumgr/smp_svr/prj_nrf5340_bt.conf | 88 +++++++++++++++++++ .../subsys/mgmt/mcumgr/smp_svr/sample.yaml | 8 ++ .../subsys/mgmt/mcumgr/smp_svr/sysbuild.cmake | 16 ++++ .../smp_svr/sysbuild/mcuboot_nrf5340_bt.conf | 1 + .../mcumgr/smp_svr/sysbuild_nrf5340_bt.conf | 8 ++ 7 files changed, 181 insertions(+) create mode 100644 samples/subsys/mgmt/mcumgr/smp_svr/app_nrf5340_bt.overlay create mode 100644 samples/subsys/mgmt/mcumgr/smp_svr/pm_static_nrf5340_bt.yml create mode 100644 samples/subsys/mgmt/mcumgr/smp_svr/prj_nrf5340_bt.conf create mode 100644 samples/subsys/mgmt/mcumgr/smp_svr/sysbuild.cmake create mode 100644 samples/subsys/mgmt/mcumgr/smp_svr/sysbuild/mcuboot_nrf5340_bt.conf create mode 100644 samples/subsys/mgmt/mcumgr/smp_svr/sysbuild_nrf5340_bt.conf diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/app_nrf5340_bt.overlay b/samples/subsys/mgmt/mcumgr/smp_svr/app_nrf5340_bt.overlay new file mode 100644 index 000000000000..fcc2e240fd9e --- /dev/null +++ b/samples/subsys/mgmt/mcumgr/smp_svr/app_nrf5340_bt.overlay @@ -0,0 +1,5 @@ +/ { + chosen { + nordic,pm-ext-flash = &mx25r64; + }; +}; diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/pm_static_nrf5340_bt.yml b/samples/subsys/mgmt/mcumgr/smp_svr/pm_static_nrf5340_bt.yml new file mode 100644 index 000000000000..7a48d51ec334 --- /dev/null +++ b/samples/subsys/mgmt/mcumgr/smp_svr/pm_static_nrf5340_bt.yml @@ -0,0 +1,55 @@ +app: + address: 0x10200 + region: flash_primary + size: 0xdfe00 +mcuboot: + address: 0x0 + region: flash_primary + size: 0x10000 +mcuboot_pad: + address: 0x10000 + region: flash_primary + size: 0x200 +mcuboot_primary: + address: 0x10000 + orig_span: &id001 + - mcuboot_pad + - app + region: flash_primary + size: 0xe0000 + span: *id001 +mcuboot_primary_app: + address: 0x10200 + orig_span: &id002 + - app + region: flash_primary + size: 0xdfe00 + span: *id002 +settings_storage: + address: 0xf0000 + region: flash_primary + size: 0x10000 +mcuboot_primary_1: + address: 0x0 + size: 0x40000 + device: flash_ctrl + region: ram_flash +mcuboot_secondary: + address: 0x00000 + size: 0xe0000 + device: MX25R64 + region: external_flash +mcuboot_secondary_1: + address: 0xe0000 + size: 0x40000 + device: MX25R64 + region: external_flash +external_flash: + address: 0x120000 + size: 0x6e0000 + device: MX25R64 + region: external_flash +pcd_sram: + address: 0x20000000 + size: 0x2000 + region: sram_primary diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/prj_nrf5340_bt.conf b/samples/subsys/mgmt/mcumgr/smp_svr/prj_nrf5340_bt.conf new file mode 100644 index 000000000000..cb53d3e6beb6 --- /dev/null +++ b/samples/subsys/mgmt/mcumgr/smp_svr/prj_nrf5340_bt.conf @@ -0,0 +1,88 @@ +# Enable MCUmgr and dependencies. +CONFIG_NET_BUF=y +CONFIG_ZCBOR=y +CONFIG_CRC=y +CONFIG_MCUMGR=y +CONFIG_STREAM_FLASH=y +CONFIG_FLASH_MAP=y +CONFIG_BT=y +CONFIG_BT_PERIPHERAL=y + +# Some command handlers require a large stack. +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2304 +CONFIG_MAIN_STACK_SIZE=2176 + +# Ensure an MCUboot-compatible binary is generated. +CONFIG_BOOTLOADER_MCUBOOT=y + +# Enable flash operations. +CONFIG_FLASH=y + +# Required by the `taskstat` command. +CONFIG_THREAD_MONITOR=y + +# Support for taskstat command +CONFIG_MCUMGR_GRP_OS_TASKSTAT=y + +# Enable statistics and statistic names. +CONFIG_STATS=y +CONFIG_STATS_NAMES=y + +# Enable most core commands. +CONFIG_FLASH=y +CONFIG_IMG_MANAGER=y +CONFIG_MCUMGR_GRP_IMG=y +CONFIG_MCUMGR_GRP_OS=y +CONFIG_MCUMGR_GRP_STAT=y + +# Enable logging +CONFIG_LOG=y +CONFIG_MCUBOOT_UTIL_LOG_LEVEL_WRN=y + +# Disable debug logging +CONFIG_LOG_MAX_LEVEL=3 + +# Allow for large Bluetooth data packets. +CONFIG_BT_L2CAP_TX_MTU=498 +CONFIG_BT_BUF_ACL_RX_SIZE=502 +CONFIG_BT_BUF_ACL_TX_SIZE=502 +CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 + +# Enable the Bluetooth mcumgr transport (unauthenticated). +CONFIG_MCUMGR_TRANSPORT_BT=y +CONFIG_MCUMGR_TRANSPORT_BT_CONN_PARAM_CONTROL=y + +# Enable the Shell mcumgr transport. +CONFIG_BASE64=y +CONFIG_CRC=y +CONFIG_SHELL=y +CONFIG_SHELL_BACKEND_SERIAL=y +CONFIG_MCUMGR_TRANSPORT_SHELL=y + +# Enable the mcumgr Packet Reassembly feature over Bluetooth and its configuration dependencies. +# MCUmgr buffer size is optimized to fit one SMP packet divided into five Bluetooth Write Commands, +# transmitted with the maximum possible MTU value: 498 bytes. +CONFIG_MCUMGR_TRANSPORT_BT_REASSEMBLY=y +CONFIG_MCUMGR_TRANSPORT_NETBUF_SIZE=2475 +CONFIG_MCUMGR_GRP_OS_MCUMGR_PARAMS=y +CONFIG_MCUMGR_TRANSPORT_WORKQUEUE_STACK_SIZE=4608 + +# Enable the LittleFS file system. +CONFIG_FILE_SYSTEM=y +CONFIG_FILE_SYSTEM_LITTLEFS=y + +# Enable file system commands +CONFIG_MCUMGR_GRP_FS=y + +# Enable the storage erase command. +CONFIG_MCUMGR_GRP_ZBASIC=y +CONFIG_MCUMGR_GRP_ZBASIC_STORAGE_ERASE=y + +# Disable Bluetooth ping support +CONFIG_BT_CTLR_LE_PING=n + +# Disable shell commands that are not needed +CONFIG_CLOCK_CONTROL_NRF_SHELL=n +CONFIG_DEVICE_SHELL=n +CONFIG_DEVMEM_SHELL=n +CONFIG_FLASH_SHELL=n diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml b/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml index ab41f093dc3c..aef16825a75b 100644 --- a/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml +++ b/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml @@ -222,3 +222,11 @@ tests: - nrf52840dk/nrf52840 integration_platforms: - nrf52840dk/nrf52840 + sample.mcumgr.smp_svr.bt.nrf5340dk.ext_flash: + sysbuild: true + extra_args: + - FILE_SUFFIX=nrf5340_bt + platform_allow: + - nrf5340dk/nrf5340/cpuapp + integration_platforms: + - nrf5340dk/nrf5340/cpuapp diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/sysbuild.cmake b/samples/subsys/mgmt/mcumgr/smp_svr/sysbuild.cmake new file mode 100644 index 000000000000..f0a9f06df847 --- /dev/null +++ b/samples/subsys/mgmt/mcumgr/smp_svr/sysbuild.cmake @@ -0,0 +1,16 @@ +# +# Copyright (c) 2024 Nordic Semiconductor +# +# SPDX-License-Identifier: Apache-2.0 +# + +if(FILE_SUFFIX STREQUAL "nrf5340_bt") + if(SB_CONFIG_SOC_NRF5340_CPUAPP) + # nRF5340 with Bluetooth configuration, add partition manager configuration to MCUboot image + list(APPEND mcuboot_EXTRA_DTC_OVERLAY_FILE ${CMAKE_CURRENT_LIST_DIR}/app_nrf5340_bt.overlay) + list(REMOVE_DUPLICATES mcuboot_EXTRA_DTC_OVERLAY_FILE) + set(mcuboot_EXTRA_DTC_OVERLAY_FILE ${mcuboot_EXTRA_DTC_OVERLAY_FILE} CACHE INTERNAL "" FORCE) + else() + message(FATAL_ERROR "File suffix 'nrf5340_bt' can only be used on an nRF5340 CPUAPP board target") + endif() +endif() diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/sysbuild/mcuboot_nrf5340_bt.conf b/samples/subsys/mgmt/mcumgr/smp_svr/sysbuild/mcuboot_nrf5340_bt.conf new file mode 100644 index 000000000000..4ebbf98cf20e --- /dev/null +++ b/samples/subsys/mgmt/mcumgr/smp_svr/sysbuild/mcuboot_nrf5340_bt.conf @@ -0,0 +1 @@ +CONFIG_BOOT_MAX_IMG_SECTORS=240 diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/sysbuild_nrf5340_bt.conf b/samples/subsys/mgmt/mcumgr/smp_svr/sysbuild_nrf5340_bt.conf new file mode 100644 index 000000000000..16bcac179e83 --- /dev/null +++ b/samples/subsys/mgmt/mcumgr/smp_svr/sysbuild_nrf5340_bt.conf @@ -0,0 +1,8 @@ +# Enable MCUboot bootloader support +SB_CONFIG_BOOTLOADER_MCUBOOT=y +SB_CONFIG_MCUBOOT_MODE_OVERWRITE_ONLY=y +SB_CONFIG_NETCORE_HCI_IPC=y +SB_CONFIG_SECURE_BOOT_NETCORE=y +SB_CONFIG_NETCORE_APP_UPDATE=y +SB_CONFIG_MCUBOOT_NRF53_MULTI_IMAGE_UPDATE=y +SB_CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y From a0d10324b63734e313e07415908fcca08936e5fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Ku=C5=BAnia?= Date: Tue, 18 Feb 2025 12:17:47 +0100 Subject: [PATCH 0544/2141] [nrf noup] entropy: Add fake entropy nRF PRNG driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This adds temporary entropy driver simulation for nRF54l09 device since final entropy source is not available yet. TODO: Remove this commit when proper solution will be available. Signed-off-by: Rafał Kuźnia (cherry picked from commit 3d02dc6fb7c7a29dde82faf53d17dd1ec25e35de) --- dts/arm/nordic/nrf54l09_enga_cpuapp.dtsi | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dts/arm/nordic/nrf54l09_enga_cpuapp.dtsi b/dts/arm/nordic/nrf54l09_enga_cpuapp.dtsi index fc359cdb0ac9..1dfc5ce133c0 100644 --- a/dts/arm/nordic/nrf54l09_enga_cpuapp.dtsi +++ b/dts/arm/nordic/nrf54l09_enga_cpuapp.dtsi @@ -18,6 +18,7 @@ nvic: &cpuapp_nvic {}; / { chosen { zephyr,bt-hci = &bt_hci_controller; + zephyr,entropy = &prng; }; soc { @@ -30,6 +31,11 @@ nvic: &cpuapp_nvic {}; compatible = "zephyr,psa-crypto-rng"; status = "disabled"; }; + + prng: prng { + compatible = "nordic,entropy-prng"; + status = "okay"; + }; }; &bt_hci_controller { From e40f5313c37dc245a8812643924cdba02afe1252 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Ku=C5=BAnia?= Date: Wed, 19 Feb 2025 15:47:07 +0100 Subject: [PATCH 0545/2141] [nrf noup] dts: Select SoftDevice Controller on nRF54L09 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The SDC HCI controller is defined as a device tree node. A node representing the SDC controller is added and selected as the default over the open source link layer. This is consistent with other SoCs. Signed-off-by: Rafał Kuźnia (cherry picked from commit da86248f40248d863adfed61bb35019e61a5dadf) --- boards/nordic/nrf54l09pdk/nrf54l09_cpuapp_common.dtsi | 4 ++-- dts/arm/nordic/nrf54l09_enga_cpuapp.dtsi | 4 ++-- dts/vendor/nordic/nrf54l09.dtsi | 8 +++++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/boards/nordic/nrf54l09pdk/nrf54l09_cpuapp_common.dtsi b/boards/nordic/nrf54l09pdk/nrf54l09_cpuapp_common.dtsi index 7d0c880c2de3..e1347c35948c 100644 --- a/boards/nordic/nrf54l09pdk/nrf54l09_cpuapp_common.dtsi +++ b/boards/nordic/nrf54l09pdk/nrf54l09_cpuapp_common.dtsi @@ -18,7 +18,7 @@ zephyr,bt-c2h-uart = &uart20; zephyr,flash-controller = &rram_controller; zephyr,flash = &cpuapp_rram; - zephyr,bt-hci = &bt_hci_controller; + zephyr,bt-hci = &bt_hci_sdc; zephyr,ieee802154 = &ieee802154; }; }; @@ -119,7 +119,7 @@ status = "okay"; }; -&bt_hci_controller { +&bt_hci_sdc { status = "okay"; }; diff --git a/dts/arm/nordic/nrf54l09_enga_cpuapp.dtsi b/dts/arm/nordic/nrf54l09_enga_cpuapp.dtsi index 1dfc5ce133c0..6c7f34d3b21e 100644 --- a/dts/arm/nordic/nrf54l09_enga_cpuapp.dtsi +++ b/dts/arm/nordic/nrf54l09_enga_cpuapp.dtsi @@ -17,7 +17,7 @@ nvic: &cpuapp_nvic {}; / { chosen { - zephyr,bt-hci = &bt_hci_controller; + zephyr,bt-hci = &bt_hci_sdc; zephyr,entropy = &prng; }; @@ -38,7 +38,7 @@ nvic: &cpuapp_nvic {}; }; }; -&bt_hci_controller { +&bt_hci_sdc { status = "okay"; }; diff --git a/dts/vendor/nordic/nrf54l09.dtsi b/dts/vendor/nordic/nrf54l09.dtsi index 3dc17dabd9ba..90ecc49b877c 100644 --- a/dts/vendor/nordic/nrf54l09.dtsi +++ b/dts/vendor/nordic/nrf54l09.dtsi @@ -221,9 +221,11 @@ status = "disabled"; }; - /* Note: In the nRF Connect SDK the SoftDevice Controller - * is added and set as the default Bluetooth Controller. - */ + bt_hci_sdc: bt_hci_sdc { + compatible = "nordic,bt-hci-sdc"; + status = "disabled"; + }; + bt_hci_controller: bt_hci_controller { compatible = "zephyr,bt-hci-ll-sw-split"; status = "disabled"; From 609c11851694ecaee87cda239066273e2410b8e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Ku=C5=BAnia?= Date: Tue, 22 Oct 2024 08:55:47 +0200 Subject: [PATCH 0546/2141] [nrf noup] modules: hal_nordic: adjust nrfx reservations to NCS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added ncs-specific modules to nrfx_config_reserved_resources. The modules are: - mpsl - nrfe Signed-off-by: Rafał Kuźnia Signed-off-by: Nikodem Kastelik Co-authored-by: Krzysztof Chruściński Signed-off-by: Eivind Jølsgard Signed-off-by: Aleksandar Stanoev Signed-off-by: Piotr Pryga (cherry picked from commit afa7dc073e62650bb7c54a9a6cb019775af9f4ed) --- modules/hal_nordic/nrfx/Kconfig | 2 +- .../nrfx/nrfx_config_reserved_resources_ncs.h | 948 ++++++++++++++++++ 2 files changed, 949 insertions(+), 1 deletion(-) create mode 100644 modules/hal_nordic/nrfx/nrfx_config_reserved_resources_ncs.h diff --git a/modules/hal_nordic/nrfx/Kconfig b/modules/hal_nordic/nrfx/Kconfig index b7f459ea177b..5fe8f70377e2 100644 --- a/modules/hal_nordic/nrfx/Kconfig +++ b/modules/hal_nordic/nrfx/Kconfig @@ -1294,6 +1294,6 @@ endmenu config NRFX_RESERVED_RESOURCES_HEADER string - default "nrfx_reserved_resources.h" + default "nrfx_config_reserved_resources_ncs.h" endmenu # "nrfx drivers" diff --git a/modules/hal_nordic/nrfx/nrfx_config_reserved_resources_ncs.h b/modules/hal_nordic/nrfx/nrfx_config_reserved_resources_ncs.h new file mode 100644 index 000000000000..ec8a9acaf7b5 --- /dev/null +++ b/modules/hal_nordic/nrfx/nrfx_config_reserved_resources_ncs.h @@ -0,0 +1,948 @@ +/* + * Copyright (c) 2024, Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef NRFX_CONFIG_RESERVED_RESOURCES_H__ +#define NRFX_CONFIG_RESERVED_RESOURCES_H__ + +/** @brief Bitmask that defines GPIOTE130 channels reserved for use outside + * of the nrfx library. + */ +#define NRFX_GPIOTE130_CHANNELS_USED \ + (~NRFX_CONFIG_MASK_DT(DT_NODELABEL(gpiote130), owned_channels) | \ + NRFX_CONFIG_MASK_DT(DT_NODELABEL(gpiote130), child_owned_channels)) + +/** @brief Bitmask that defines GPIOTE131 channels reserved for use outside + * of the nrfx library. + */ +#define NRFX_GPIOTE131_CHANNELS_USED \ + (~NRFX_CONFIG_MASK_DT(DT_NODELABEL(gpiote131), owned_channels) | \ + NRFX_CONFIG_MASK_DT(DT_NODELABEL(gpiote131), child_owned_channels)) + +/** @brief Bitmask that defines EGU instances that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_EGUS_USED 0 + +/** @brief Bitmask that defines TIMER instances that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_TIMERS_USED 0 + +/* If the GRTC system timer driver is to be used, prepare definitions required + * by the nrfx_grtc driver (NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK and + * NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS) based on information from devicetree. + */ +#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_grtc) +#define NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK \ + (NRFX_CONFIG_MASK_DT(DT_INST(0, nordic_nrf_grtc), owned_channels) & \ + ~NRFX_CONFIG_MASK_DT(DT_INST(0, nordic_nrf_grtc), child_owned_channels)) +#define NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS \ + (DT_PROP_LEN_OR(DT_INST(0, nordic_nrf_grtc), owned_channels, 0) - \ + DT_PROP_LEN_OR(DT_INST(0, nordic_nrf_grtc), child_owned_channels, 0)) +#endif /* DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_grtc) */ + +/* + * The enabled Bluetooth controller subsystem is responsible for providing + * definitions of the BT_CTLR_USED_* symbols used below in a file named + * bt_ctlr_used_resources.h and for adding its location to global include + * paths so that the file can be included here for all Zephyr libraries that + * are to be built. + */ +#if defined(CONFIG_BT_LL_SW_SPLIT) +#include +#if defined(CONFIG_SOC_SERIES_NRF51X) || defined(CONFIG_SOC_COMPATIBLE_NRF52X) +#define NRFX_PPI_CHANNELS_USED_BY_BT_CTLR BT_CTLR_USED_PPI_CHANNELS +#define NRFX_PPI_GROUPS_USED_BY_BT_CTLR BT_CTLR_USED_PPI_GROUPS +#elif defined(CONFIG_SOC_COMPATIBLE_NRF53X) +#define NRFX_DPPI0_CHANNELS_USED_BY_BT_CTLR BT_CTLR_USED_PPI_CHANNELS +#define NRFX_DPPI0_GROUPS_USED_BY_BT_CTLR BT_CTLR_USED_PPI_GROUPS +#elif defined(CONFIG_SOC_COMPATIBLE_NRF54LX) +#define NRFX_DPPI10_CHANNELS_USED_BY_BT_CTLR BT_CTLR_USED_PPI_CHANNELS +#define NRFX_DPPI10_GROUPS_USED_BY_BT_CTLR BT_CTLR_USED_PPI_GROUPS +#endif +#endif /* defined(CONFIG_BT_LL_SW_SPLIT) */ + +#if defined(CONFIG_BT_LL_SOFTDEVICE) +/* Define auxiliary symbols needed for SDC device dispatch. */ +#if defined(CONFIG_SOC_COMPATIBLE_NRF52X) +#define NRF52_SERIES +#elif defined(CONFIG_SOC_COMPATIBLE_NRF53X) +#define NRF53_SERIES +#elif defined(CONFIG_SOC_COMPATIBLE_NRF54LX) +#define NRF54L_SERIES +#elif defined(CONFIG_SOC_SERIES_NRF71X) +#define NRF71_SERIES +#elif defined(CONFIG_SOC_SERIES_NRF54HX) +#define NRF54H_SERIES +#endif +#include +#if defined(CONFIG_SOC_COMPATIBLE_NRF52X) +#define NRFX_PPI_CHANNELS_USED_BY_BT_CTLR SDC_PPI_CHANNELS_USED_MASK +#elif defined(CONFIG_SOC_COMPATIBLE_NRF53X) +#define NRFX_DPPI0_CHANNELS_USED_BY_BT_CTLR SDC_DPPI_CHANNELS_USED_MASK +#elif defined(CONFIG_SOC_COMPATIBLE_NRF54LX) || defined(CONFIG_SOC_SERIES_NRF71X) +#define NRFX_DPPI10_CHANNELS_USED_BY_BT_CTLR SDC_DPPIC10_CHANNELS_USED_MASK +#define NRFX_DPPI00_CHANNELS_USED_BY_BT_CTLR SDC_DPPIC00_CHANNELS_USED_MASK +#define NRFX_PPIB_00_10_CHANNELS_USED_BY_BT_CTLR \ + (SDC_PPIB00_CHANNELS_USED_MASK | SDC_PPIB10_CHANNELS_USED_MASK) +#elif defined(CONFIG_SOC_SERIES_NRF54HX) +#define NRFX_DPPI020_CHANNELS_USED_BY_BT_CTLR SDC_DPPIC020_CHANNELS_USED_MASK +#define NRFX_DPPI030_CHANNELS_USED_BY_BT_CTLR SDC_DPPIC030_CHANNELS_USED_MASK +#define NRFX_PPIB_020_030_CHANNELS_USED_BY_BT_CTLR \ + (SDC_PPIB020_CHANNELS_USED_MASK | SDC_PPIB030_CHANNELS_USED_MASK) +#else +#error Unsupported chip family +#endif +#endif /* defined(CONFIG_BT_LL_SOFTDEVICE) */ + +#if defined(CONFIG_NRF_802154_RADIO_DRIVER) +#if defined(CONFIG_SOC_COMPATIBLE_NRF52X) +#include <../src/nrf_802154_peripherals_nrf52.h> +#define NRFX_PPI_CHANNELS_USED_BY_802154_DRV NRF_802154_PPI_CHANNELS_USED_MASK +#define NRFX_PPI_GROUPS_USED_BY_802154_DRV NRF_802154_PPI_GROUPS_USED_MASK +#elif defined(CONFIG_SOC_COMPATIBLE_NRF53X) +#include <../src/nrf_802154_peripherals_nrf53.h> +#define NRFX_DPPI0_CHANNELS_USED_BY_802154_DRV NRF_802154_DPPI_CHANNELS_USED_MASK +#define NRFX_DPPI0_GROUPS_USED_BY_802154_DRV NRF_802154_DPPI_GROUPS_USED_MASK +#elif defined(CONFIG_SOC_COMPATIBLE_NRF54LX) +#include <../src/nrf_802154_peripherals_nrf54l.h> +#define NRFX_DPPI10_CHANNELS_USED_BY_802154_DRV NRF_802154_DPPI_CHANNELS_USED_MASK +#define NRFX_DPPI10_GROUPS_USED_BY_802154_DRV NRF_802154_DPPI_GROUPS_USED_MASK +#elif defined(CONFIG_SOC_SERIES_NRF54HX) +#include <../src/nrf_802154_peripherals_nrf54h.h> +#define NRFX_DPPI020_CHANNELS_USED_BY_802154_DRV NRF_802154_DPPI_CHANNELS_USED_MASK +#define NRFX_DPPI020_GROUPS_USED_BY_802154_DRV NRF_802154_DPPI_GROUPS_USED_MASK +#else +#error Unsupported chip family +#endif +#endif /* CONFIG_NRF_802154_RADIO_DRIVER */ + +#if defined(CONFIG_MPSL) +#include +#if defined(CONFIG_SOC_COMPATIBLE_NRF52X) +#define NRFX_PPI_CHANNELS_USED_BY_MPSL MPSL_PPI_CHANNELS_USED_MASK +#elif defined(CONFIG_SOC_COMPATIBLE_NRF53X) +#define NRFX_DPPI0_CHANNELS_USED_BY_MPSL MPSL_DPPIC_CHANNELS_USED_MASK +#elif defined(CONFIG_SOC_COMPATIBLE_NRF54LX) || defined(CONFIG_SOC_SERIES_NRF71X) +#define NRFX_DPPI10_CHANNELS_USED_BY_MPSL MPSL_DPPIC10_CHANNELS_USED_MASK +#define NRFX_DPPI20_CHANNELS_USED_BY_MPSL MPSL_DPPIC20_CHANNELS_USED_MASK +#define NRFX_PPIB_11_21_CHANNELS_USED_BY_MPSL \ + (MPSL_PPIB11_CHANNELS_USED_MASK | MPSL_PPIB21_CHANNELS_USED_MASK) +#elif defined(CONFIG_SOC_SERIES_NRF54HX) +#define NRFX_DPPI020_CHANNELS_USED_BY_MPSL MPSL_DPPIC020_CHANNELS_USED_MASK +#else +#error Unsupported chip family +#endif +#endif + +#ifndef NRFX_DPPI0_CHANNELS_USED_BY_BT_CTLR +#define NRFX_DPPI0_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI0_GROUPS_USED_BY_BT_CTLR +#define NRFX_DPPI0_GROUPS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI0_CHANNELS_USED_BY_802154_DRV +#define NRFX_DPPI0_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI0_GROUPS_USED_BY_802154_DRV +#define NRFX_DPPI0_GROUPS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI0_CHANNELS_USED_BY_MPSL +#define NRFX_DPPI0_CHANNELS_USED_BY_MPSL 0 +#endif +#ifndef NRFX_DPPI0_GROUPS_USED_BY_MPSL +#define NRFX_DPPI0_GROUPS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_DPPI00_CHANNELS_USED_BY_BT_CTLR +#define NRFX_DPPI00_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI00_GROUPS_USED_BY_BT_CTLR +#define NRFX_DPPI00_GROUPS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI00_CHANNELS_USED_BY_802154_DRV +#define NRFX_DPPI00_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI00_GROUPS_USED_BY_802154_DRV +#define NRFX_DPPI00_GROUPS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI00_CHANNELS_USED_BY_MPSL +#define NRFX_DPPI00_CHANNELS_USED_BY_MPSL 0 +#endif +#ifndef NRFX_DPPI00_GROUPS_USED_BY_MPSL +#define NRFX_DPPI00_GROUPS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_DPPI10_CHANNELS_USED_BY_BT_CTLR +#define NRFX_DPPI10_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI10_GROUPS_USED_BY_BT_CTLR +#define NRFX_DPPI10_GROUPS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI10_CHANNELS_USED_BY_802154_DRV +#define NRFX_DPPI10_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI10_GROUPS_USED_BY_802154_DRV +#define NRFX_DPPI10_GROUPS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI10_CHANNELS_USED_BY_MPSL +#define NRFX_DPPI10_CHANNELS_USED_BY_MPSL 0 +#endif +#ifndef NRFX_DPPI10_GROUPS_USED_BY_MPSL +#define NRFX_DPPI10_GROUPS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_DPPI20_CHANNELS_USED_BY_BT_CTLR +#define NRFX_DPPI20_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI20_GROUPS_USED_BY_BT_CTLR +#define NRFX_DPPI20_GROUPS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI20_CHANNELS_USED_BY_802154_DRV +#define NRFX_DPPI20_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI20_GROUPS_USED_BY_802154_DRV +#define NRFX_DPPI20_GROUPS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI20_CHANNELS_USED_BY_MPSL +#define NRFX_DPPI20_CHANNELS_USED_BY_MPSL 0 +#endif +#ifndef NRFX_DPPI20_GROUPS_USED_BY_MPSL +#define NRFX_DPPI20_GROUPS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_DPPI30_CHANNELS_USED_BY_BT_CTLR +#define NRFX_DPPI30_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI30_GROUPS_USED_BY_BT_CTLR +#define NRFX_DPPI30_GROUPS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI30_CHANNELS_USED_BY_802154_DRV +#define NRFX_DPPI30_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI30_GROUPS_USED_BY_802154_DRV +#define NRFX_DPPI30_GROUPS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI30_CHANNELS_USED_BY_MPSL +#define NRFX_DPPI30_CHANNELS_USED_BY_MPSL 0 +#endif +#ifndef NRFX_DPPI30_GROUPS_USED_BY_MPSL +#define NRFX_DPPI30_GROUPS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_DPPI020_CHANNELS_USED_BY_BT_CTLR +#define NRFX_DPPI020_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI020_GROUPS_USED_BY_BT_CTLR +#define NRFX_DPPI020_GROUPS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI020_CHANNELS_USED_BY_802154_DRV +#define NRFX_DPPI020_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI020_GROUPS_USED_BY_802154_DRV +#define NRFX_DPPI020_GROUPS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI020_CHANNELS_USED_BY_MPSL +#define NRFX_DPPI020_CHANNELS_USED_BY_MPSL 0 +#endif +#ifndef NRFX_DPPI020_GROUPS_USED_BY_MPSL +#define NRFX_DPPI020_GROUPS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_DPPI030_CHANNELS_USED_BY_BT_CTLR +#define NRFX_DPPI030_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI030_GROUPS_USED_BY_BT_CTLR +#define NRFX_DPPI030_GROUPS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI030_CHANNELS_USED_BY_802154_DRV +#define NRFX_DPPI030_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI030_GROUPS_USED_BY_802154_DRV +#define NRFX_DPPI030_GROUPS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI030_CHANNELS_USED_BY_MPSL +#define NRFX_DPPI030_CHANNELS_USED_BY_MPSL 0 +#endif +#ifndef NRFX_DPPI030_GROUPS_USED_BY_MPSL +#define NRFX_DPPI030_GROUPS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_DPPI120_CHANNELS_USED_BY_BT_CTLR +#define NRFX_DPPI120_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI120_GROUPS_USED_BY_BT_CTLR +#define NRFX_DPPI120_GROUPS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI120_CHANNELS_USED_BY_802154_DRV +#define NRFX_DPPI120_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI120_GROUPS_USED_BY_802154_DRV +#define NRFX_DPPI120_GROUPS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI120_CHANNELS_USED_BY_MPSL +#define NRFX_DPPI120_CHANNELS_USED_BY_MPSL 0 +#endif +#ifndef NRFX_DPPI120_GROUPS_USED_BY_MPSL +#define NRFX_DPPI120_GROUPS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_DPPI130_CHANNELS_USED_BY_BT_CTLR +#define NRFX_DPPI130_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI130_GROUPS_USED_BY_BT_CTLR +#define NRFX_DPPI130_GROUPS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI130_CHANNELS_USED_BY_802154_DRV +#define NRFX_DPPI130_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI130_GROUPS_USED_BY_802154_DRV +#define NRFX_DPPI130_GROUPS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI130_CHANNELS_USED_BY_MPSL +#define NRFX_DPPI130_CHANNELS_USED_BY_MPSL 0 +#endif +#ifndef NRFX_DPPI130_GROUPS_USED_BY_MPSL +#define NRFX_DPPI130_GROUPS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_DPPI131_CHANNELS_USED_BY_BT_CTLR +#define NRFX_DPPI131_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI131_GROUPS_USED_BY_BT_CTLR +#define NRFX_DPPI131_GROUPS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI131_CHANNELS_USED_BY_802154_DRV +#define NRFX_DPPI131_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI131_GROUPS_USED_BY_802154_DRV +#define NRFX_DPPI131_GROUPS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI131_CHANNELS_USED_BY_MPSL +#define NRFX_DPPI131_CHANNELS_USED_BY_MPSL 0 +#endif +#ifndef NRFX_DPPI131_GROUPS_USED_BY_MPSL +#define NRFX_DPPI131_GROUPS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_DPPI132_CHANNELS_USED_BY_BT_CTLR +#define NRFX_DPPI132_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI132_GROUPS_USED_BY_BT_CTLR +#define NRFX_DPPI132_GROUPS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI132_CHANNELS_USED_BY_802154_DRV +#define NRFX_DPPI132_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI132_GROUPS_USED_BY_802154_DRV +#define NRFX_DPPI132_GROUPS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI132_CHANNELS_USED_BY_MPSL +#define NRFX_DPPI132_CHANNELS_USED_BY_MPSL 0 +#endif +#ifndef NRFX_DPPI132_GROUPS_USED_BY_MPSL +#define NRFX_DPPI132_GROUPS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_DPPI133_CHANNELS_USED_BY_BT_CTLR +#define NRFX_DPPI133_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI133_GROUPS_USED_BY_BT_CTLR +#define NRFX_DPPI133_GROUPS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI133_CHANNELS_USED_BY_802154_DRV +#define NRFX_DPPI133_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI133_GROUPS_USED_BY_802154_DRV +#define NRFX_DPPI133_GROUPS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI133_CHANNELS_USED_BY_MPSL +#define NRFX_DPPI133_CHANNELS_USED_BY_MPSL 0 +#endif +#ifndef NRFX_DPPI133_GROUPS_USED_BY_MPSL +#define NRFX_DPPI133_GROUPS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_DPPI134_CHANNELS_USED_BY_BT_CTLR +#define NRFX_DPPI134_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI134_GROUPS_USED_BY_BT_CTLR +#define NRFX_DPPI134_GROUPS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI134_CHANNELS_USED_BY_802154_DRV +#define NRFX_DPPI134_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI134_GROUPS_USED_BY_802154_DRV +#define NRFX_DPPI134_GROUPS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI134_CHANNELS_USED_BY_MPSL +#define NRFX_DPPI134_CHANNELS_USED_BY_MPSL 0 +#endif +#ifndef NRFX_DPPI134_GROUPS_USED_BY_MPSL +#define NRFX_DPPI134_GROUPS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_DPPI135_CHANNELS_USED_BY_BT_CTLR +#define NRFX_DPPI135_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI135_GROUPS_USED_BY_BT_CTLR +#define NRFX_DPPI135_GROUPS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI135_CHANNELS_USED_BY_802154_DRV +#define NRFX_DPPI135_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI135_GROUPS_USED_BY_802154_DRV +#define NRFX_DPPI135_GROUPS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI135_CHANNELS_USED_BY_MPSL +#define NRFX_DPPI135_CHANNELS_USED_BY_MPSL 0 +#endif +#ifndef NRFX_DPPI135_GROUPS_USED_BY_MPSL +#define NRFX_DPPI135_GROUPS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_DPPI136_CHANNELS_USED_BY_BT_CTLR +#define NRFX_DPPI136_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI136_GROUPS_USED_BY_BT_CTLR +#define NRFX_DPPI136_GROUPS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI136_CHANNELS_USED_BY_802154_DRV +#define NRFX_DPPI136_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI136_GROUPS_USED_BY_802154_DRV +#define NRFX_DPPI136_GROUPS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI136_CHANNELS_USED_BY_MPSL +#define NRFX_DPPI136_CHANNELS_USED_BY_MPSL 0 +#endif +#ifndef NRFX_DPPI136_GROUPS_USED_BY_MPSL +#define NRFX_DPPI136_GROUPS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_PPI_CHANNELS_USED_BY_BT_CTLR +#define NRFX_PPI_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_PPI_GROUPS_USED_BY_BT_CTLR +#define NRFX_PPI_GROUPS_USED_BY_BT_CTLR 0 +#endif + +#ifndef NRFX_PPI_CHANNELS_USED_BY_802154_DRV +#define NRFX_PPI_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_PPI_GROUPS_USED_BY_802154_DRV +#define NRFX_PPI_GROUPS_USED_BY_802154_DRV 0 +#endif + +#ifndef NRFX_PPI_CHANNELS_USED_BY_MPSL +#define NRFX_PPI_CHANNELS_USED_BY_MPSL 0 +#endif +#ifndef NRFX_PPI_GROUPS_USED_BY_MPSL +#define NRFX_PPI_GROUPS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_PPIB_00_10_CHANNELS_USED_BY_BT_CTLR +#define NRFX_PPIB_00_10_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_PPIB_00_10_CHANNELS_USED_BY_802154_DRV +#define NRFX_PPIB_00_10_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_PPIB_00_10_CHANNELS_USED_BY_MPSL +#define NRFX_PPIB_00_10_CHANNELS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_PPIB_01_20_CHANNELS_USED_BY_BT_CTLR +#define NRFX_PPIB_01_20_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_PPIB_01_20_CHANNELS_USED_BY_802154_DRV +#define NRFX_PPIB_01_20_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_PPIB_01_20_CHANNELS_USED_BY_MPSL +#define NRFX_PPIB_01_20_CHANNELS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_PPIB_11_21_CHANNELS_USED_BY_BT_CTLR +#define NRFX_PPIB_11_21_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_PPIB_11_21_CHANNELS_USED_BY_802154_DRV +#define NRFX_PPIB_11_21_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_PPIB_11_21_CHANNELS_USED_BY_MPSL +#define NRFX_PPIB_11_21_CHANNELS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_PPIB_22_30_CHANNELS_USED_BY_BT_CTLR +#define NRFX_PPIB_22_30_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_PPIB_22_30_CHANNELS_USED_BY_802154_DRV +#define NRFX_PPIB_22_30_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_PPIB_22_30_CHANNELS_USED_BY_MPSL +#define NRFX_PPIB_22_30_CHANNELS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_PPIB_02_03_CHANNELS_USED_BY_BT_CTLR +#define NRFX_PPIB_02_03_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_PPIB_02_03_CHANNELS_USED_BY_802154_DRV +#define NRFX_PPIB_02_03_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_PPIB_02_03_CHANNELS_USED_BY_MPSL +#define NRFX_PPIB_02_03_CHANNELS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_PPIB_04_12_CHANNELS_USED_BY_BT_CTLR +#define NRFX_PPIB_04_12_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_PPIB_04_12_CHANNELS_USED_BY_802154_DRV +#define NRFX_PPIB_04_12_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_PPIB_04_12_CHANNELS_USED_BY_MPSL +#define NRFX_PPIB_04_12_CHANNELS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_PPIB_020_030_CHANNELS_USED_BY_BT_CTLR +#define NRFX_PPIB_020_030_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_PPIB_020_030_CHANNELS_USED_BY_802154_DRV +#define NRFX_PPIB_020_030_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_PPIB_020_030_CHANNELS_USED_BY_MPSL +#define NRFX_PPIB_020_030_CHANNELS_USED_BY_MPSL 0 +#endif + +#if defined(NRF_802154_VERIFY_PERIPHS_ALLOC_AGAINST_MPSL) + +BUILD_ASSERT((NRFX_DPPI0_CHANNELS_USED_BY_802154_DRV & NRFX_DPPI0_CHANNELS_USED_BY_MPSL) == 0, + "PPI channels used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI0_GROUPS_USED_BY_802154_DRV & NRFX_DPPI0_GROUPS_USED_BY_MPSL) == 0, + "PPI groups used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI00_CHANNELS_USED_BY_802154_DRV & NRFX_DPPI00_CHANNELS_USED_BY_MPSL) == 0, + "PPI channels used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI00_GROUPS_USED_BY_802154_DRV & NRFX_DPPI00_GROUPS_USED_BY_MPSL) == 0, + "PPI groups used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI10_CHANNELS_USED_BY_802154_DRV & NRFX_DPPI10_CHANNELS_USED_BY_MPSL) == 0, + "PPI channels used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI10_GROUPS_USED_BY_802154_DRV & NRFX_DPPI10_GROUPS_USED_BY_MPSL) == 0, + "PPI groups used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI20_CHANNELS_USED_BY_802154_DRV & NRFX_DPPI20_CHANNELS_USED_BY_MPSL) == 0, + "PPI channels used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI20_GROUPS_USED_BY_802154_DRV & NRFX_DPPI20_GROUPS_USED_BY_MPSL) == 0, + "PPI groups used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI30_CHANNELS_USED_BY_802154_DRV & NRFX_DPPI30_CHANNELS_USED_BY_MPSL) == 0, + "PPI channels used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI30_GROUPS_USED_BY_802154_DRV & NRFX_DPPI30_GROUPS_USED_BY_MPSL) == 0, + "PPI groups used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI020_CHANNELS_USED_BY_802154_DRV & NRFX_DPPI020_CHANNELS_USED_BY_MPSL) == 0, + "PPI channels used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI020_GROUPS_USED_BY_802154_DRV & NRFX_DPPI020_GROUPS_USED_BY_MPSL) == 0, + "PPI groups used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI030_CHANNELS_USED_BY_802154_DRV & NRFX_DPPI030_CHANNELS_USED_BY_MPSL) == 0, + "PPI channels used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI030_GROUPS_USED_BY_802154_DRV & NRFX_DPPI030_GROUPS_USED_BY_MPSL) == 0, + "PPI groups used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI120_CHANNELS_USED_BY_802154_DRV & NRFX_DPPI120_CHANNELS_USED_BY_MPSL) == 0, + "PPI channels used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI120_GROUPS_USED_BY_802154_DRV & NRFX_DPPI120_GROUPS_USED_BY_MPSL) == 0, + "PPI groups used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI130_CHANNELS_USED_BY_802154_DRV & NRFX_DPPI130_CHANNELS_USED_BY_MPSL) == 0, + "PPI channels used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI130_GROUPS_USED_BY_802154_DRV & NRFX_DPPI130_GROUPS_USED_BY_MPSL) == 0, + "PPI groups used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI131_CHANNELS_USED_BY_802154_DRV & NRFX_DPPI131_CHANNELS_USED_BY_MPSL) == 0, + "PPI channels used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI131_GROUPS_USED_BY_802154_DRV & NRFX_DPPI131_GROUPS_USED_BY_MPSL) == 0, + "PPI groups used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI132_CHANNELS_USED_BY_802154_DRV & NRFX_DPPI132_CHANNELS_USED_BY_MPSL) == 0, + "PPI channels used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI132_GROUPS_USED_BY_802154_DRV & NRFX_DPPI132_GROUPS_USED_BY_MPSL) == 0, + "PPI groups used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI133_CHANNELS_USED_BY_802154_DRV & NRFX_DPPI133_CHANNELS_USED_BY_MPSL) == 0, + "PPI channels used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI133_GROUPS_USED_BY_802154_DRV & NRFX_DPPI133_GROUPS_USED_BY_MPSL) == 0, + "PPI groups used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI134_CHANNELS_USED_BY_802154_DRV & NRFX_DPPI134_CHANNELS_USED_BY_MPSL) == 0, + "PPI channels used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI134_GROUPS_USED_BY_802154_DRV & NRFX_DPPI134_GROUPS_USED_BY_MPSL) == 0, + "PPI groups used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI135_CHANNELS_USED_BY_802154_DRV & NRFX_DPPI135_CHANNELS_USED_BY_MPSL) == 0, + "PPI channels used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI135_GROUPS_USED_BY_802154_DRV & NRFX_DPPI135_GROUPS_USED_BY_MPSL) == 0, + "PPI groups used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI136_CHANNELS_USED_BY_802154_DRV & NRFX_DPPI136_CHANNELS_USED_BY_MPSL) == 0, + "PPI channels used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI136_GROUPS_USED_BY_802154_DRV & NRFX_DPPI136_GROUPS_USED_BY_MPSL) == 0, + "PPI groups used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_PPI_CHANNELS_USED_BY_802154_DRV & NRFX_PPI_CHANNELS_USED_BY_MPSL) == 0, + "PPI channels used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_PPI_GROUPS_USED_BY_802154_DRV & NRFX_PPI_GROUPS_USED_BY_MPSL) == 0, + "PPI groups used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_PPIB_00_10_CHANNELS_USED_BY_802154_DRV & + NRFX_PPIB_00_10_CHANNELS_USED_BY_MPSL) == 0, + "PPI channels used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_PPIB_01_20_CHANNELS_USED_BY_802154_DRV & + NRFX_PPIB_01_20_CHANNELS_USED_BY_MPSL) == 0, + "PPI channels used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_PPIB_11_21_CHANNELS_USED_BY_802154_DRV & + NRFX_PPIB_11_21_CHANNELS_USED_BY_MPSL) == 0, + "PPI channels used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_PPIB_22_30_CHANNELS_USED_BY_802154_DRV & + NRFX_PPIB_22_30_CHANNELS_USED_BY_MPSL) == 0, + "PPI channels used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_PPIB_02_03_CHANNELS_USED_BY_802154_DRV & + NRFX_PPIB_02_03_CHANNELS_USED_BY_MPSL) == 0, + "PPI channels used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_PPIB_04_12_CHANNELS_USED_BY_802154_DRV & + NRFX_PPIB_04_12_CHANNELS_USED_BY_MPSL) == 0, + "PPI channels used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_PPIB_020_030_CHANNELS_USED_BY_802154_DRV & + NRFX_PPIB_020_030_CHANNELS_USED_BY_MPSL) == 0, + "PPI channels used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +#endif /* NRF_802154_VERIFY_PERIPHS_ALLOC_AGAINST_MPSL */ + +/** @brief Bitmask that defines DPPI channels that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI0_CHANNELS_USED \ + (NRFX_DPPI0_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI0_CHANNELS_USED_BY_802154_DRV | \ + NRFX_DPPI0_CHANNELS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI groups that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI0_GROUPS_USED \ + (NRFX_DPPI0_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI0_GROUPS_USED_BY_802154_DRV | \ + NRFX_DPPI0_GROUPS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI channels that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI00_CHANNELS_USED \ + (NRFX_DPPI00_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI00_CHANNELS_USED_BY_802154_DRV | \ + NRFX_DPPI00_CHANNELS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI groups that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI00_GROUPS_USED \ + (NRFX_DPPI00_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI00_GROUPS_USED_BY_802154_DRV | \ + NRFX_DPPI00_GROUPS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI channels that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI10_CHANNELS_USED \ + (NRFX_DPPI10_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI10_CHANNELS_USED_BY_802154_DRV | \ + NRFX_DPPI10_CHANNELS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI groups that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI10_GROUPS_USED \ + (NRFX_DPPI10_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI10_GROUPS_USED_BY_802154_DRV | \ + NRFX_DPPI10_GROUPS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI channels that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI20_CHANNELS_USED \ + (NRFX_DPPI20_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI20_CHANNELS_USED_BY_802154_DRV | \ + NRFX_DPPI20_CHANNELS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI groups that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI20_GROUPS_USED \ + (NRFX_DPPI20_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI20_GROUPS_USED_BY_802154_DRV | \ + NRFX_DPPI20_GROUPS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI channels that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI30_CHANNELS_USED \ + (NRFX_DPPI30_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI30_CHANNELS_USED_BY_802154_DRV | \ + NRFX_DPPI30_CHANNELS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI groups that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI30_GROUPS_USED \ + (NRFX_DPPI30_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI30_GROUPS_USED_BY_802154_DRV | \ + NRFX_DPPI30_GROUPS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI channels that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI020_CHANNELS_USED \ + (NRFX_DPPI020_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI020_CHANNELS_USED_BY_802154_DRV | \ + NRFX_DPPI020_CHANNELS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI groups that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI020_GROUPS_USED \ + (NRFX_DPPI020_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI020_GROUPS_USED_BY_802154_DRV | \ + NRFX_DPPI020_GROUPS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI channels that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI030_CHANNELS_USED \ + (NRFX_DPPI030_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI030_CHANNELS_USED_BY_802154_DRV | \ + NRFX_DPPI030_CHANNELS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI groups that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI030_GROUPS_USED \ + (NRFX_DPPI030_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI030_GROUPS_USED_BY_802154_DRV | \ + NRFX_DPPI030_GROUPS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI channels that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI120_CHANNELS_USED \ + (NRFX_DPPI120_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI120_CHANNELS_USED_BY_802154_DRV | \ + NRFX_DPPI120_CHANNELS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI groups that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI120_GROUPS_USED \ + (NRFX_DPPI120_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI120_GROUPS_USED_BY_802154_DRV | \ + NRFX_DPPI120_GROUPS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI channels that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI130_CHANNELS_USED \ + (NRFX_DPPI130_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI130_CHANNELS_USED_BY_802154_DRV | \ + NRFX_DPPI130_CHANNELS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI groups that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI130_GROUPS_USED \ + (NRFX_DPPI130_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI130_GROUPS_USED_BY_802154_DRV | \ + NRFX_DPPI130_GROUPS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI channels that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI131_CHANNELS_USED \ + (NRFX_DPPI131_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI131_CHANNELS_USED_BY_802154_DRV | \ + NRFX_DPPI131_CHANNELS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI groups that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI131_GROUPS_USED \ + (NRFX_DPPI131_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI131_GROUPS_USED_BY_802154_DRV | \ + NRFX_DPPI131_GROUPS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI channels that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI132_CHANNELS_USED \ + (NRFX_DPPI132_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI132_CHANNELS_USED_BY_802154_DRV | \ + NRFX_DPPI132_CHANNELS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI groups that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI132_GROUPS_USED \ + (NRFX_DPPI132_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI132_GROUPS_USED_BY_802154_DRV | \ + NRFX_DPPI132_GROUPS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI channels that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI133_CHANNELS_USED \ + (NRFX_DPPI133_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI133_CHANNELS_USED_BY_802154_DRV | \ + NRFX_DPPI133_CHANNELS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI groups that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI133_GROUPS_USED \ + (NRFX_DPPI133_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI133_GROUPS_USED_BY_802154_DRV | \ + NRFX_DPPI133_GROUPS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI channels that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI134_CHANNELS_USED \ + (NRFX_DPPI134_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI134_CHANNELS_USED_BY_802154_DRV | \ + NRFX_DPPI134_CHANNELS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI groups that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI134_GROUPS_USED \ + (NRFX_DPPI134_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI134_GROUPS_USED_BY_802154_DRV | \ + NRFX_DPPI134_GROUPS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI channels that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI135_CHANNELS_USED \ + (NRFX_DPPI135_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI135_CHANNELS_USED_BY_802154_DRV | \ + NRFX_DPPI135_CHANNELS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI groups that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI135_GROUPS_USED \ + (NRFX_DPPI135_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI135_GROUPS_USED_BY_802154_DRV | \ + NRFX_DPPI135_GROUPS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI channels that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI136_CHANNELS_USED \ + (NRFX_DPPI136_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI136_CHANNELS_USED_BY_802154_DRV | \ + NRFX_DPPI136_CHANNELS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI groups that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI136_GROUPS_USED \ + (NRFX_DPPI136_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI136_GROUPS_USED_BY_802154_DRV | \ + NRFX_DPPI136_GROUPS_USED_BY_MPSL) + +/** @brief Bitmask that defines PPI channels that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_PPI_CHANNELS_USED \ + (NRFX_PPI_CHANNELS_USED_BY_BT_CTLR | NRFX_PPI_CHANNELS_USED_BY_802154_DRV | \ + NRFX_PPI_CHANNELS_USED_BY_MPSL | NRFX_PPI_CHANNELS_USED_BY_SD) + +#define NRFX_DPPI_CHANNELS_USED NRFX_DPPI0_CHANNELS_USED +#define NRFX_DPPI_GROUPS_USED NRFX_DPPI0_GROUPS_USED + +/** @brief Bitmask that defines PPI groups that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_PPI_GROUPS_USED \ + (NRFX_PPI_GROUPS_USED_BY_BT_CTLR | NRFX_PPI_GROUPS_USED_BY_802154_DRV | \ + NRFX_PPI_GROUPS_USED_BY_MPSL | NRFX_PPI_GROUPS_USED_BY_SD) + +#define NRFX_PPIB_INTERCONNECT_00_10_CHANNELS_USED \ + (NRFX_PPIB_00_10_CHANNELS_USED_BY_BT_CTLR | NRFX_PPIB_00_10_CHANNELS_USED_BY_802154_DRV | \ + NRFX_PPIB_00_10_CHANNELS_USED_BY_MPSL) + +#define NRFX_PPIB_INTERCONNECT_01_20_CHANNELS_USED \ + (NRFX_PPIB_01_20_CHANNELS_USED_BY_BT_CTLR | NRFX_PPIB_01_20_CHANNELS_USED_BY_802154_DRV | \ + NRFX_PPIB_01_20_CHANNELS_USED_BY_MPSL) + +#define NRFX_PPIB_INTERCONNECT_11_21_CHANNELS_USED \ + (NRFX_PPIB_11_21_CHANNELS_USED_BY_BT_CTLR | NRFX_PPIB_11_21_CHANNELS_USED_BY_802154_DRV | \ + NRFX_PPIB_11_21_CHANNELS_USED_BY_MPSL) + +#define NRFX_PPIB_INTERCONNECT_22_30_CHANNELS_USED \ + (NRFX_PPIB_22_30_CHANNELS_USED_BY_BT_CTLR | NRFX_PPIB_22_30_CHANNELS_USED_BY_802154_DRV | \ + NRFX_PPIB_22_30_CHANNELS_USED_BY_MPSL) + +#define NRFX_PPIB_INTERCONNECT_02_03_CHANNELS_USED \ + (NRFX_PPIB_02_03_CHANNELS_USED_BY_BT_CTLR | NRFX_PPIB_02_03_CHANNELS_USED_BY_802154_DRV | \ + NRFX_PPIB_02_03_CHANNELS_USED_BY_MPSL) + +#define NRFX_PPIB_INTERCONNECT_04_12_CHANNELS_USED \ + (NRFX_PPIB_04_12_CHANNELS_USED_BY_BT_CTLR | NRFX_PPIB_04_12_CHANNELS_USED_BY_802154_DRV | \ + NRFX_PPIB_04_12_CHANNELS_USED_BY_MPSL) + +#define NRFX_PPIB_INTERCONNECT_020_030_CHANNELS_USED \ + (NRFX_PPIB_020_030_CHANNELS_USED_BY_BT_CTLR | \ + NRFX_PPIB_020_030_CHANNELS_USED_BY_802154_DRV | NRFX_PPIB_020_030_CHANNELS_USED_BY_MPSL) + +#if defined(CONFIG_SOFTDEVICE) +#include +#define NRFX_PPI_CHANNELS_USED_BY_SD SD_PPI_CHANNELS_USED +#define NRFX_PPI_GROUPS_USED_BY_SD SD_PPI_GROUPS_USED +#else +#define NRFX_PPI_CHANNELS_USED_BY_SD 0 +#define NRFX_PPI_GROUPS_USED_BY_SD 0 +#endif + +#endif /* NRFX_CONFIG_RESERVED_RESOURCES_H__ */ From f331133c270974e2a33087c12dab21419fc0b0ba Mon Sep 17 00:00:00 2001 From: Aleksandr Khromykh Date: Tue, 25 Feb 2025 10:35:24 +0100 Subject: [PATCH 0547/2141] [nrf noup] samples: bluetooth: mesh: Disable secure storage for real targets. Mesh currently works with trusted storage on real targets. Until secure storage is supported by default disable it. Signed-off-by: Aleksandr Khromykh (cherry picked from commit 754db49d71faa8859b4bde046b394b4d9c71049f) --- samples/bluetooth/mesh/boards/qemu_x86.conf | 6 ++++++ samples/bluetooth/mesh/prj.conf | 2 +- samples/bluetooth/mesh_demo/boards/qemu_x86.conf | 6 ++++++ samples/bluetooth/mesh_demo/prj.conf | 2 +- samples/bluetooth/mesh_provisioner/boards/qemu_x86.conf | 6 ++++++ samples/bluetooth/mesh_provisioner/prj.conf | 2 +- samples/boards/nordic/mesh/onoff-app/prj.conf | 2 +- .../nordic/mesh/onoff_level_lighting_vnd_app/prj.conf | 2 +- tests/bluetooth/mesh_shell/boards/qemu_x86.conf | 6 ++++++ tests/bluetooth/mesh_shell/prj.conf | 2 +- 10 files changed, 30 insertions(+), 6 deletions(-) create mode 100644 samples/bluetooth/mesh/boards/qemu_x86.conf create mode 100644 samples/bluetooth/mesh_demo/boards/qemu_x86.conf create mode 100644 samples/bluetooth/mesh_provisioner/boards/qemu_x86.conf create mode 100644 tests/bluetooth/mesh_shell/boards/qemu_x86.conf diff --git a/samples/bluetooth/mesh/boards/qemu_x86.conf b/samples/bluetooth/mesh/boards/qemu_x86.conf new file mode 100644 index 000000000000..bfb57193b782 --- /dev/null +++ b/samples/bluetooth/mesh/boards/qemu_x86.conf @@ -0,0 +1,6 @@ +# nrf_security only supports Cortex-M via PSA crypto libraries. +# Enforcing usage of built-in Mbed TLS for native simulator. +CONFIG_NRF_SECURITY=n +CONFIG_MBEDTLS_ENABLE_HEAP=n +CONFIG_TRUSTED_STORAGE=n +CONFIG_SECURE_STORAGE=y diff --git a/samples/bluetooth/mesh/prj.conf b/samples/bluetooth/mesh/prj.conf index 14b19316a866..cd7d6532b614 100644 --- a/samples/bluetooth/mesh/prj.conf +++ b/samples/bluetooth/mesh/prj.conf @@ -5,7 +5,7 @@ CONFIG_FLASH=y CONFIG_FLASH_MAP=y CONFIG_NVS=y CONFIG_SETTINGS=y -CONFIG_SECURE_STORAGE=y +# CONFIG_SECURE_STORAGE=y CONFIG_HWINFO=y CONFIG_BT=y diff --git a/samples/bluetooth/mesh_demo/boards/qemu_x86.conf b/samples/bluetooth/mesh_demo/boards/qemu_x86.conf new file mode 100644 index 000000000000..bfb57193b782 --- /dev/null +++ b/samples/bluetooth/mesh_demo/boards/qemu_x86.conf @@ -0,0 +1,6 @@ +# nrf_security only supports Cortex-M via PSA crypto libraries. +# Enforcing usage of built-in Mbed TLS for native simulator. +CONFIG_NRF_SECURITY=n +CONFIG_MBEDTLS_ENABLE_HEAP=n +CONFIG_TRUSTED_STORAGE=n +CONFIG_SECURE_STORAGE=y diff --git a/samples/bluetooth/mesh_demo/prj.conf b/samples/bluetooth/mesh_demo/prj.conf index bcb738ae5bd1..b7016b02c65b 100644 --- a/samples/bluetooth/mesh_demo/prj.conf +++ b/samples/bluetooth/mesh_demo/prj.conf @@ -31,7 +31,7 @@ CONFIG_FLASH_MAP=y CONFIG_NVS=y CONFIG_SETTINGS=y CONFIG_BT_MESH_RPL_STORE_TIMEOUT=600 -CONFIG_SECURE_STORAGE=y +# CONFIG_SECURE_STORAGE=y # Limit the number of key slots in PSA Crypto core to reduce # RAM footprint diff --git a/samples/bluetooth/mesh_provisioner/boards/qemu_x86.conf b/samples/bluetooth/mesh_provisioner/boards/qemu_x86.conf new file mode 100644 index 000000000000..bfb57193b782 --- /dev/null +++ b/samples/bluetooth/mesh_provisioner/boards/qemu_x86.conf @@ -0,0 +1,6 @@ +# nrf_security only supports Cortex-M via PSA crypto libraries. +# Enforcing usage of built-in Mbed TLS for native simulator. +CONFIG_NRF_SECURITY=n +CONFIG_MBEDTLS_ENABLE_HEAP=n +CONFIG_TRUSTED_STORAGE=n +CONFIG_SECURE_STORAGE=y diff --git a/samples/bluetooth/mesh_provisioner/prj.conf b/samples/bluetooth/mesh_provisioner/prj.conf index 10949c5480db..241767805164 100644 --- a/samples/bluetooth/mesh_provisioner/prj.conf +++ b/samples/bluetooth/mesh_provisioner/prj.conf @@ -45,7 +45,7 @@ CONFIG_FLASH_MAP=y CONFIG_NVS=y CONFIG_SETTINGS=y CONFIG_BT_MESH_RPL_STORE_TIMEOUT=600 -CONFIG_SECURE_STORAGE=y +# CONFIG_SECURE_STORAGE=y #CONFIG_BT_MESH_LOG_LEVEL_DBG=y #CONFIG_BT_MESH_SETTINGS_LOG_LEVEL_DBG=y diff --git a/samples/boards/nordic/mesh/onoff-app/prj.conf b/samples/boards/nordic/mesh/onoff-app/prj.conf index 0e67042b2653..0783579e795e 100644 --- a/samples/boards/nordic/mesh/onoff-app/prj.conf +++ b/samples/boards/nordic/mesh/onoff-app/prj.conf @@ -9,7 +9,7 @@ CONFIG_FLASH=y CONFIG_FLASH_MAP=y CONFIG_NVS=y CONFIG_SETTINGS=y -CONFIG_SECURE_STORAGE=y +# CONFIG_SECURE_STORAGE=y CONFIG_BT_MESH_RPL_STORE_TIMEOUT=600 diff --git a/samples/boards/nordic/mesh/onoff_level_lighting_vnd_app/prj.conf b/samples/boards/nordic/mesh/onoff_level_lighting_vnd_app/prj.conf index 3bb984208c70..96b5466b4a16 100644 --- a/samples/boards/nordic/mesh/onoff_level_lighting_vnd_app/prj.conf +++ b/samples/boards/nordic/mesh/onoff_level_lighting_vnd_app/prj.conf @@ -7,7 +7,7 @@ CONFIG_FLASH=y CONFIG_FLASH_MAP=y CONFIG_NVS=y CONFIG_SETTINGS=y -CONFIG_SECURE_STORAGE=y +# CONFIG_SECURE_STORAGE=y CONFIG_BT_OBSERVER=y CONFIG_BT_BROADCASTER=y diff --git a/tests/bluetooth/mesh_shell/boards/qemu_x86.conf b/tests/bluetooth/mesh_shell/boards/qemu_x86.conf new file mode 100644 index 000000000000..bfb57193b782 --- /dev/null +++ b/tests/bluetooth/mesh_shell/boards/qemu_x86.conf @@ -0,0 +1,6 @@ +# nrf_security only supports Cortex-M via PSA crypto libraries. +# Enforcing usage of built-in Mbed TLS for native simulator. +CONFIG_NRF_SECURITY=n +CONFIG_MBEDTLS_ENABLE_HEAP=n +CONFIG_TRUSTED_STORAGE=n +CONFIG_SECURE_STORAGE=y diff --git a/tests/bluetooth/mesh_shell/prj.conf b/tests/bluetooth/mesh_shell/prj.conf index 2af600295680..aab2745d359f 100644 --- a/tests/bluetooth/mesh_shell/prj.conf +++ b/tests/bluetooth/mesh_shell/prj.conf @@ -14,7 +14,7 @@ CONFIG_FLASH=y CONFIG_FLASH_MAP=y CONFIG_NVS=y CONFIG_SETTINGS=y -CONFIG_SECURE_STORAGE=y +# CONFIG_SECURE_STORAGE=y CONFIG_BT=y CONFIG_BT_OBSERVER=y From 316cce07af745093d8056a50ff27c88e15f7d9b6 Mon Sep 17 00:00:00 2001 From: Gordon Klaus Date: Fri, 28 Feb 2025 12:27:22 +0100 Subject: [PATCH 0548/2141] [nrf noup] samples: bluetooth: hci_ipc: increase main stack size for Cracen driver on nRF54H20 A larger stack is needed to accomodate the Cracen driver. Signed-off-by: Gordon Klaus (cherry picked from commit 7396a70644fa2f9dc00520289f3688ab2131884e) --- .../bluetooth/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.conf | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 samples/bluetooth/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.conf diff --git a/samples/bluetooth/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.conf b/samples/bluetooth/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.conf new file mode 100644 index 000000000000..296e68366389 --- /dev/null +++ b/samples/bluetooth/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.conf @@ -0,0 +1,2 @@ +# Increase stack size for Cracen driver. +CONFIG_MAIN_STACK_SIZE=1024 From e2aa08c6d7cbba17349065d497885731a21715df Mon Sep 17 00:00:00 2001 From: Kamil Gawor Date: Tue, 9 Apr 2024 14:24:34 +0200 Subject: [PATCH 0549/2141] [nrf noup] entropy: Add fake entropy nRF PRNG driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This adds temporary entropy driver simulation for nRF54h20 device since final entropy source is not available yet. TODO: Remove this commit when proper solution will be available. Jira: NCSDK-25947 Signed-off-by: Kamil Gawor Signed-off-by: Robert Lubos Signed-off-by: Andreas Moltumyr Signed-off-by: Karol Lasończyk (cherry picked from commit 27b137c9ee18b4b2ced382e5af255769a096727e) --- .../nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 6 ++ .../nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts | 5 + .../nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts | 6 ++ .../nrf9280pdk/nrf9280pdk_nrf9280_cpurad.dts | 5 + drivers/entropy/CMakeLists.txt | 7 ++ drivers/entropy/Kconfig | 1 + drivers/entropy/Kconfig.nrf_prng | 19 ++++ drivers/entropy/fake_entropy_nrf_prng.c | 101 ++++++++++++++++++ dts/arm/nordic/nrf54l20_enga_cpuapp.dtsi | 9 ++ dts/bindings/rng/nordic,nrf-prng.yaml | 8 ++ 10 files changed, 167 insertions(+) create mode 100644 drivers/entropy/Kconfig.nrf_prng create mode 100644 drivers/entropy/fake_entropy_nrf_prng.c create mode 100644 dts/bindings/rng/nordic,nrf-prng.yaml diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index e01295e9e300..3846627ab1a5 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -27,6 +27,7 @@ zephyr,bt-hci = &bt_hci_ipc0; nordic,802154-spinel-ipc = &ipc0; zephyr,canbus = &can120; + zephyr,entropy = &prng; }; aliases { @@ -107,6 +108,11 @@ pwms = <&pwm130 0 PWM_MSEC(20) PWM_POLARITY_NORMAL>; }; }; + + prng: prng { + compatible = "nordic,entropy-prng"; + status = "okay"; + }; }; &cpuapp_bellboard { diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts index 5473d9a7405a..7e1a1c8e9e04 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts @@ -28,6 +28,11 @@ zephyr,ieee802154 = &cpurad_ieee802154; zephyr,bt-hci-ipc = &ipc0; nordic,802154-spinel-ipc = &ipc0; + zephyr,entropy = &prng; + }; + prng: prng { + compatible = "nordic,entropy-prng"; + status = "okay"; }; aliases { diff --git a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts index 4cc9c7ba1a34..d9ed27f49558 100644 --- a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts +++ b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts @@ -27,6 +27,7 @@ zephyr,ieee802154 = &cpuapp_ieee802154; zephyr,bt-hci = &bt_hci_ipc0; nordic,802154-spinel-ipc = &ipc0; + zephyr,entropy = &prng; }; aliases { @@ -108,6 +109,11 @@ pwms = <&pwm130 0 PWM_MSEC(20) PWM_POLARITY_NORMAL>; }; }; + + prng: prng { + compatible = "nordic,entropy-prng"; + status = "okay"; + }; }; &cpuapp_ram0x_region { diff --git a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpurad.dts b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpurad.dts index 5efa7dbd471c..d6c03bc4a514 100644 --- a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpurad.dts +++ b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpurad.dts @@ -28,6 +28,11 @@ zephyr,ieee802154 = &cpurad_ieee802154; zephyr,bt-hci-ipc = &ipc0; nordic,802154-spinel-ipc = &ipc0; + zephyr,entropy = &prng; + }; + prng: prng { + compatible = "nordic,entropy-prng"; + status = "okay"; }; aliases { diff --git a/drivers/entropy/CMakeLists.txt b/drivers/entropy/CMakeLists.txt index eaf858add89b..e038bbfe1b65 100644 --- a/drivers/entropy/CMakeLists.txt +++ b/drivers/entropy/CMakeLists.txt @@ -45,4 +45,11 @@ zephyr_library_sources_ifdef(CONFIG_ENTROPY_SY1XX_TRNG entropy_sy1xx_tr zephyr_library_sources_ifdef(CONFIG_ENTROPY_TELINK_B91_TRNG entropy_b91_trng.c) # zephyr-keep-sorted-stop +if (CONFIG_FAKE_ENTROPY_NRF_PRNG) + zephyr_library_sources(fake_entropy_nrf_prng.c) + + message(WARNING "\nA nRF PRNG is used, which does not produce real random bits." + "This is not secure and should therefore never be used in a product.") +endif() + zephyr_library_link_libraries_ifdef(CONFIG_BUILD_WITH_TFM tfm_api) diff --git a/drivers/entropy/Kconfig b/drivers/entropy/Kconfig index e0a2080b343b..c52ac96e6bfc 100644 --- a/drivers/entropy/Kconfig +++ b/drivers/entropy/Kconfig @@ -36,6 +36,7 @@ source "drivers/entropy/Kconfig.neorv32" source "drivers/entropy/Kconfig.npcx" source "drivers/entropy/Kconfig.nrf5" source "drivers/entropy/Kconfig.nrf_cracen" +source "drivers/entropy/Kconfig.nrf_prng" source "drivers/entropy/Kconfig.nxp" source "drivers/entropy/Kconfig.psa_crypto" source "drivers/entropy/Kconfig.renesas_ra" diff --git a/drivers/entropy/Kconfig.nrf_prng b/drivers/entropy/Kconfig.nrf_prng new file mode 100644 index 000000000000..e81db4de4b15 --- /dev/null +++ b/drivers/entropy/Kconfig.nrf_prng @@ -0,0 +1,19 @@ +# nRF fake entropy prng generator driver configuration + +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +if ENTROPY_GENERATOR + +config FAKE_ENTROPY_NRF_PRNG + bool "A fake nRF entropy driver" + default y + depends on DT_HAS_NORDIC_ENTROPY_PRNG_ENABLED + depends on (SOC_SERIES_NRF54HX || SOC_SERIES_NRF92X || SOC_SERIES_NRF54LX) + select ENTROPY_HAS_DRIVER + help + This is a super simple PRNG driver that can be used on nRF platforms that + do not have an entropy source. + This is NOT SAFE to use for cryptographic operations! + +endif diff --git a/drivers/entropy/fake_entropy_nrf_prng.c b/drivers/entropy/fake_entropy_nrf_prng.c new file mode 100644 index 000000000000..8624c8444057 --- /dev/null +++ b/drivers/entropy/fake_entropy_nrf_prng.c @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include +#include + +#define DT_DRV_COMPAT nordic_entropy_prng + +/* This file implements a pseudo-RNG + * https://vigna.di.unimi.it/xorshift/xoshiro128plus.c + */ + +static uint32_t s[4]; + +static inline uint32_t rotl(const uint32_t x, int k) +{ + return (x << k) | (x >> (32 - k)); +} + +static uint32_t rng_next(void) +{ + const uint32_t result = rotl(s[0] + s[3], 7) + s[0]; + + const uint32_t t = s[1] << 9; + + s[2] ^= s[0]; + s[3] ^= s[1]; + s[1] ^= s[2]; + s[0] ^= s[3]; + + s[2] ^= t; + + s[3] = rotl(s[3], 11); + + return result; +} + +static int entropy_prng_get_entropy(const struct device *dev, uint8_t *buffer, uint16_t length) +{ + ARG_UNUSED(dev); + + while (length) { + /* + * Note that only 1 thread (Zephyr thread or HW models), runs at + * a time, therefore there is no need to use random_r() + */ + uint32_t value = rng_next(); + + size_t to_copy = MIN(length, sizeof(long)); + + memcpy(buffer, &value, to_copy); + buffer += to_copy; + length -= to_copy; + } + + return 0; +} + +static int entropy_prng_get_entropy_isr(const struct device *dev, uint8_t *buf, uint16_t len, + uint32_t flags) +{ + ARG_UNUSED(flags); + + int err; + + /* + * entropy_prng_get_entropy() is also safe for ISRs + * and always produces data. + */ + err = entropy_prng_get_entropy(dev, buf, len); + if (err < 0) { + return err; + } else { + return len; + } +} + +static int entropy_prng_init(const struct device *dev) +{ + ARG_UNUSED(dev); + + /* Picked some arbitrary initial seed. */ + s[0] = 0xAF568BC0; + s[1] = 0xAC34307E; + s[2] = 0x9B7F6DD1; + s[3] = 0xD84319FC; + return 0; +} + +static const struct entropy_driver_api entropy_prng_api_funcs = { + .get_entropy = entropy_prng_get_entropy, .get_entropy_isr = entropy_prng_get_entropy_isr}; + +DEVICE_DT_INST_DEFINE(0, entropy_prng_init, NULL, NULL, NULL, PRE_KERNEL_1, + CONFIG_ENTROPY_INIT_PRIORITY, &entropy_prng_api_funcs); diff --git a/dts/arm/nordic/nrf54l20_enga_cpuapp.dtsi b/dts/arm/nordic/nrf54l20_enga_cpuapp.dtsi index 2df3fc596767..5c7e5db30014 100644 --- a/dts/arm/nordic/nrf54l20_enga_cpuapp.dtsi +++ b/dts/arm/nordic/nrf54l20_enga_cpuapp.dtsi @@ -16,6 +16,10 @@ nvic: &cpuapp_nvic {}; /delete-node/ &cpuflpr_clic; / { + chosen { + zephyr,entropy = &prng; + }; + soc { compatible = "simple-bus"; interrupt-parent = <&cpuapp_nvic>; @@ -26,6 +30,11 @@ nvic: &cpuapp_nvic {}; compatible = "zephyr,psa-crypto-rng"; status = "disabled"; }; + + prng: prng { + compatible = "nordic,entropy-prng"; + status = "okay"; + }; }; &cpuflpr_vpr { diff --git a/dts/bindings/rng/nordic,nrf-prng.yaml b/dts/bindings/rng/nordic,nrf-prng.yaml new file mode 100644 index 000000000000..8936393a0b65 --- /dev/null +++ b/dts/bindings/rng/nordic,nrf-prng.yaml @@ -0,0 +1,8 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + +description: This is a super simple PRNG + +compatible: "nordic,entropy-prng" + +include: base.yaml From e2ee4c0ffea72be2e9385b81594cbad94ac00ae9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Tue, 17 Dec 2024 21:45:47 +0100 Subject: [PATCH 0550/2141] [nrf noup] drivers: spi_dw: Bring back custom EXMIF peripheral handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit brings back modifications from these reverted commits: - f68b2edaa2233cde29d955bc3d3b3dd75ff50334 - e606246f0fc3e9299cb5bdd3c1e34a091e5d85a1 slightly adjusted so that the EXMIF peripheral is still by default handled by the mspi_dw driver, and in cases where this driver cannot be used because something still does not work correctly, one can switch to the old solution based on the tweaked spi_dw driver. Signed-off-by: Andrzej Głąbek (cherry picked from commit f5228b90b39edff5bfdc74c176b206f748e961b0) --- drivers/pinctrl/pinctrl_nrf.c | 3 +- drivers/spi/spi_dw.c | 32 +++++++++++++++++++++- dts/bindings/spi/nordic,nrf-exmif-spi.yaml | 8 ++++++ 3 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 dts/bindings/spi/nordic,nrf-exmif-spi.yaml diff --git a/drivers/pinctrl/pinctrl_nrf.c b/drivers/pinctrl/pinctrl_nrf.c index 07941fcb5ad5..65a073102607 100644 --- a/drivers/pinctrl/pinctrl_nrf.c +++ b/drivers/pinctrl/pinctrl_nrf.c @@ -428,7 +428,8 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, input = NRF_GPIO_PIN_INPUT_CONNECT; break; #endif /* DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_can) */ -#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_exmif) +#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_exmif) || \ + DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_exmif_spi) /* Pin routing is controlled by secure domain, via UICR */ case NRF_FUN_EXMIF_CK: case NRF_FUN_EXMIF_DQ0: diff --git a/drivers/spi/spi_dw.c b/drivers/spi/spi_dw.c index bd10447e4429..6941bfdaaa77 100644 --- a/drivers/spi/spi_dw.c +++ b/drivers/spi/spi_dw.c @@ -41,6 +41,14 @@ LOG_MODULE_REGISTER(spi_dw); #include #endif +#ifdef CONFIG_HAS_NRFX +#include +#endif + +#ifdef CONFIG_SOC_NRF54H20_GPD +#include +#endif + static inline bool spi_dw_is_slave(struct spi_dw_data *spi) { return (IS_ENABLED(CONFIG_SPI_SLAVE) && @@ -258,6 +266,7 @@ static int spi_dw_configure(const struct device *dev, /* Baud rate and Slave select, for master only */ write_baudr(dev, SPI_DW_CLK_DIVIDER(info->clock_frequency, config->frequency)); + write_ser(dev, BIT(config->slave)); } if (spi_dw_is_slave(spi)) { @@ -512,6 +521,10 @@ void spi_dw_isr(const struct device *dev) uint32_t int_status; int error; +#ifdef CONFIG_HAS_NRFX + NRF_EXMIF->EVENTS_CORE = 0; +#endif + int_status = read_isr(dev); LOG_DBG("SPI %p int_status 0x%x - (tx: %d, rx: %d)", dev, int_status, @@ -560,6 +573,18 @@ int spi_dw_init(const struct device *dev) DEVICE_MMIO_MAP(dev, K_MEM_CACHE_NONE); +#ifdef CONFIG_HAS_NRFX + NRF_EXMIF->INTENSET = BIT(0); + NRF_EXMIF->TASKS_START = 1; + +#ifdef CONFIG_SOC_NRF54H20_GPD + err = nrf_gpd_request(NRF_GPD_FAST_ACTIVE1); + if (err < 0) { + return err; + } +#endif +#endif + info->config_func(); /* Masking interrupt and making sure controller is disabled */ @@ -584,6 +609,11 @@ int spi_dw_init(const struct device *dev) return 0; } +#define REG_ADDR(inst) \ + COND_CODE_1(DT_NODE_HAS_COMPAT(DT_DRV_INST(inst), nordic_nrf_exmif_spi), \ + (Z_DEVICE_MMIO_NAMED_ROM_INITIALIZER(core, DT_DRV_INST(inst))), \ + (DEVICE_MMIO_ROM_INIT(DT_DRV_INST(inst)))) + #define SPI_CFG_IRQS_SINGLE_ERR_LINE(inst) \ IRQ_CONNECT(DT_INST_IRQ_BY_NAME(inst, rx_avail, irq), \ DT_INST_IRQ_BY_NAME(inst, rx_avail, priority), \ @@ -656,7 +686,7 @@ COND_CODE_1(IS_EQ(DT_NUM_IRQS(DT_DRV_INST(inst)), 1), \ SPI_CONTEXT_CS_GPIOS_INITIALIZE(DT_DRV_INST(inst), ctx) \ }; \ static const struct spi_dw_config spi_dw_config_##inst = { \ - DEVICE_MMIO_ROM_INIT(DT_DRV_INST(inst)), \ + REG_ADDR(inst), \ .clock_frequency = COND_CODE_1( \ DT_NODE_HAS_PROP(DT_INST_PHANDLE(inst, clocks), clock_frequency), \ (DT_INST_PROP_BY_PHANDLE(inst, clocks, clock_frequency)), \ diff --git a/dts/bindings/spi/nordic,nrf-exmif-spi.yaml b/dts/bindings/spi/nordic,nrf-exmif-spi.yaml new file mode 100644 index 000000000000..d988b4146878 --- /dev/null +++ b/dts/bindings/spi/nordic,nrf-exmif-spi.yaml @@ -0,0 +1,8 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: Nordic External Memory Interface (EXMIF) used in SPI mode only + +compatible: "nordic,nrf-exmif-spi" + +include: snps,designware-spi.yaml From 2e74ea72fa61061c4caf1beb6dda304473838774 Mon Sep 17 00:00:00 2001 From: Jakub Zymelka Date: Mon, 25 Nov 2024 14:14:40 +0100 Subject: [PATCH 0551/2141] [nrf noup] drivers: pinctrl: Add SDP MSPI pin configuration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Configure SDP MSPI pins to switch their control to VPR core Signed-off-by: Jakub Zymelka Signed-off-by: Andrzej Głąbek Signed-off-by: Magdalena Pastula (cherry picked from commit a9bcc44f74eed83f28506e8fcd44f0f70c65ea9c) --- drivers/pinctrl/pinctrl_nrf.c | 32 +++++++++++ .../zephyr/dt-bindings/pinctrl/nrf-pinctrl.h | 56 +++++++++++++++++++ 2 files changed, 88 insertions(+) diff --git a/drivers/pinctrl/pinctrl_nrf.c b/drivers/pinctrl/pinctrl_nrf.c index 65a073102607..34c0107b591b 100644 --- a/drivers/pinctrl/pinctrl_nrf.c +++ b/drivers/pinctrl/pinctrl_nrf.c @@ -112,6 +112,18 @@ static const nrf_gpio_pin_drive_t drive_modes[NRF_DRIVE_COUNT] = { #define NRF_PSEL_TDM(reg, line) ((NRF_TDM_Type *)reg)->PSEL.line #endif +#if DT_HAS_COMPAT_STATUS_OKAY(nordic_hpf_mspi_controller) || \ + defined(CONFIG_MSPI_HPF) || \ + DT_ANY_COMPAT_HAS_PROP_STATUS_OKAY(nordic_nrf_vpr_coprocessor, pinctrl_0) +#if defined(CONFIG_SOC_SERIES_NRF54LX) +#define NRF_PSEL_SDP_MSPI(psel) \ + nrf_gpio_pin_control_select(psel, NRF_GPIO_PIN_SEL_VPR); +#elif defined(CONFIG_SOC_SERIES_NRF54HX) +/* On nRF54H, pin routing is controlled by secure domain, via UICR. */ +#define NRF_PSEL_SDP_MSPI(psel) +#endif +#endif /* DT_HAS_COMPAT_STATUS_OKAY(nordic_hpf_mspi_controller) || ... */ + int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, uintptr_t reg) { @@ -465,6 +477,26 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, input = NRF_GPIO_PIN_INPUT_CONNECT; break; #endif /* defined(NRF_PSEL_TWIS) */ +#if defined(NRF_PSEL_SDP_MSPI) + case NRF_FUN_SDP_MSPI_CS0: + case NRF_FUN_SDP_MSPI_CS1: + case NRF_FUN_SDP_MSPI_CS2: + case NRF_FUN_SDP_MSPI_CS3: + case NRF_FUN_SDP_MSPI_CS4: + case NRF_FUN_SDP_MSPI_SCK: + case NRF_FUN_SDP_MSPI_DQ0: + case NRF_FUN_SDP_MSPI_DQ1: + case NRF_FUN_SDP_MSPI_DQ2: + case NRF_FUN_SDP_MSPI_DQ3: + case NRF_FUN_SDP_MSPI_DQ4: + case NRF_FUN_SDP_MSPI_DQ5: + case NRF_FUN_SDP_MSPI_DQ6: + case NRF_FUN_SDP_MSPI_DQ7: + NRF_PSEL_SDP_MSPI(psel); + dir = NRF_GPIO_PIN_DIR_OUTPUT; + input = NRF_GPIO_PIN_INPUT_CONNECT; + break; +#endif /* defined(NRF_PSEL_SDP_MSPI) */ default: return -ENOTSUP; } diff --git a/include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h b/include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h index 9de74061e8da..088cfce648bb 100644 --- a/include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h +++ b/include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h @@ -172,6 +172,62 @@ #define NRF_FUN_GRTC_CLKOUT_FAST 55U /** GRTC slow clock output */ #define NRF_FUN_GRTC_CLKOUT_32K 56U +/** SDP_MSPI clock pin */ +#define NRF_FUN_SDP_MSPI_SCK 57U +/** SDP_MSPI data pin 0 */ +#define NRF_FUN_SDP_MSPI_DQ0 58U +/** SDP_MSPI data pin 1 */ +#define NRF_FUN_SDP_MSPI_DQ1 59U +/** SDP_MSPI data pin 2 */ +#define NRF_FUN_SDP_MSPI_DQ2 60U +/** SDP_MSPI data pin 3 */ +#define NRF_FUN_SDP_MSPI_DQ3 61U +/** SDP_MSPI data pin 4 */ +#define NRF_FUN_SDP_MSPI_DQ4 62U +/** SDP_MSPI data pin 5 */ +#define NRF_FUN_SDP_MSPI_DQ5 63U +/** SDP_MSPI data pin 6 */ +#define NRF_FUN_SDP_MSPI_DQ6 64U +/** SDP_MSPI data pin 7 */ +#define NRF_FUN_SDP_MSPI_DQ7 65U +/** SDP_MSPI chip select 0 */ +#define NRF_FUN_SDP_MSPI_CS0 66U +/** SDP_MSPI chip select 1 */ +#define NRF_FUN_SDP_MSPI_CS1 67U +/** SDP_MSPI chip select 2 */ +#define NRF_FUN_SDP_MSPI_CS2 68U +/** SDP_MSPI chip select 3 */ +#define NRF_FUN_SDP_MSPI_CS3 69U +/** SDP_MSPI chip select 4 */ +#define NRF_FUN_SDP_MSPI_CS4 70U +/** High-Performance Framework MSPI clock pin */ +#define NRF_FUN_HPF_MSPI_SCK NRF_FUN_SDP_MSPI_SCK +/** High-Performance Framework MSPI data pin 0 */ +#define NRF_FUN_HPF_MSPI_DQ0 NRF_FUN_SDP_MSPI_DQ0 +/** High-Performance Framework MSPI data pin 1 */ +#define NRF_FUN_HPF_MSPI_DQ1 NRF_FUN_SDP_MSPI_DQ1 +/** High-Performance Framework MSPI data pin 2 */ +#define NRF_FUN_HPF_MSPI_DQ2 NRF_FUN_SDP_MSPI_DQ2 +/** High-Performance Framework MSPI data pin 3 */ +#define NRF_FUN_HPF_MSPI_DQ3 NRF_FUN_SDP_MSPI_DQ3 +/** High-Performance Framework MSPI data pin 4 */ +#define NRF_FUN_HPF_MSPI_DQ4 NRF_FUN_SDP_MSPI_DQ4 +/** High-Performance Framework MSPI data pin 5 */ +#define NRF_FUN_HPF_MSPI_DQ5 NRF_FUN_SDP_MSPI_DQ5 +/** High-Performance Framework MSPI data pin 6 */ +#define NRF_FUN_HPF_MSPI_DQ6 NRF_FUN_SDP_MSPI_DQ6 +/** High-Performance Framework MSPI data pin 7 */ +#define NRF_FUN_HPF_MSPI_DQ7 NRF_FUN_SDP_MSPI_DQ7 +/** High-Performance Framework MSPI chip select pin 0 */ +#define NRF_FUN_HPF_MSPI_CS0 NRF_FUN_SDP_MSPI_CS0 +/** High-Performance Framework MSPI chip select pin 1 */ +#define NRF_FUN_HPF_MSPI_CS1 NRF_FUN_SDP_MSPI_CS1 +/** High-Performance Framework MSPI chip select pin 2 */ +#define NRF_FUN_HPF_MSPI_CS2 NRF_FUN_SDP_MSPI_CS2 +/** High-Performance Framework MSPI chip select pin 3 */ +#define NRF_FUN_HPF_MSPI_CS3 NRF_FUN_SDP_MSPI_CS3 +/** High-Performance Framework MSPI chip select pin 4 */ +#define NRF_FUN_HPF_MSPI_CS4 NRF_FUN_SDP_MSPI_CS4 /** TDM SCK in master mode */ #define NRF_FUN_TDM_SCK_M 71U /** TDM SCK in slave mode */ From a29db90830b199845cccdcf81544fc0129a228f9 Mon Sep 17 00:00:00 2001 From: Joakim Andersson Date: Fri, 20 Nov 2020 14:44:03 +0100 Subject: [PATCH 0552/2141] [nrf noup] Bluetooth: update experimental for qualification MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update Kconfig options for qualification: - Remove experimental on qualified feature. - Add experimental on unqualified feature. - BT_L2CAP_ECRED is not marked as experimental upstream and we qualify it downstream. Signed-off-by: Joakim Andersson Signed-off-by: Trond Einar Snekvik Signed-off-by: Martí Bolívar Signed-off-by: Robert Lubos Signed-off-by: Dominik Ermel Signed-off-by: Ingar Kulbrandstad Signed-off-by: Torsten Rasmussen Signed-off-by: Herman Berget Signed-off-by: Tomasz Moń Signed-off-by: Théo Battrel (cherry picked from commit e5c30e3c66aa803071ac9a62badc14ac1919609e) --- subsys/bluetooth/controller/Kconfig | 4 +++- subsys/bluetooth/host/Kconfig.l2cap | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/subsys/bluetooth/controller/Kconfig b/subsys/bluetooth/controller/Kconfig index 2cc9600d27f0..60726163581c 100644 --- a/subsys/bluetooth/controller/Kconfig +++ b/subsys/bluetooth/controller/Kconfig @@ -143,10 +143,12 @@ config BT_CTLR the HAS_BT_CTLR option. config BT_LL_SW_SPLIT - bool "Software-based Bluetooth LE Link Layer" + bool "Software-based Bluetooth LE Link Layer [EXPERIMENTAL]" default y depends on DT_HAS_ZEPHYR_BT_HCI_LL_SW_SPLIT_ENABLED select HAS_BT_CTLR + select EXPERIMENTAL + select ENTROPY_GENERATOR help Use Zephyr software Bluetooth LE Link Layer ULL LLL split implementation. diff --git a/subsys/bluetooth/host/Kconfig.l2cap b/subsys/bluetooth/host/Kconfig.l2cap index 2841e7d8a129..34e862378c5e 100644 --- a/subsys/bluetooth/host/Kconfig.l2cap +++ b/subsys/bluetooth/host/Kconfig.l2cap @@ -52,7 +52,7 @@ config BT_L2CAP_DYNAMIC_CHANNEL allowing the creation of dynamic L2CAP Channels. config BT_L2CAP_ECRED - bool "L2CAP Enhanced Credit Based Flow Control support" + bool "L2CAP Enhanced Credit Based Flow Control support [EXPERIMENTAL]" depends on BT_L2CAP_DYNAMIC_CHANNEL help This option enables support for LE Connection oriented Channels with From 39b7cf4e0af13a0a08afd68b0b94976dc0ce8bac Mon Sep 17 00:00:00 2001 From: Georgios Vasilakis Date: Fri, 21 Mar 2025 14:43:43 +0100 Subject: [PATCH 0553/2141] [nrf noup] tests: crypto: Set size for PSA slot noup since this option does not exist upstream. The Oberon PSA core has an option to manually set the buffer size of the PSA key slots in bytes. This option here: MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE This option has a default value of 16 since it directly affects the memory usage. The crypto tests use a secp256r1 key and thus since the public key for this key is 65 bytes long we need to set the option in the sample. Signed-off-by: Georgios Vasilakis (cherry picked from commit 2da48612f1dda350112d716bfac4d962d7d3ebd9) --- tests/crypto/secp256r1/mbedtls.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/crypto/secp256r1/mbedtls.conf b/tests/crypto/secp256r1/mbedtls.conf index bbc2eb0e6563..c4ea620de55f 100644 --- a/tests/crypto/secp256r1/mbedtls.conf +++ b/tests/crypto/secp256r1/mbedtls.conf @@ -1,6 +1,7 @@ CONFIG_MBEDTLS=y CONFIG_MBEDTLS_PSA_CRYPTO_C=y CONFIG_MBEDTLS_PSA_P256M_DRIVER_ENABLED=y +CONFIG_MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE=65 CONFIG_MBEDTLS_PSA_STATIC_KEY_SLOTS=y CONFIG_MBEDTLS_PSA_KEY_SLOT_COUNT=2 From 730c36b0bbb62f31816baeb0f3efaa84dc522c90 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Tue, 8 Apr 2025 10:16:33 +0100 Subject: [PATCH 0554/2141] [nrf noup] mgmt: mcumgr: Fix nRF5340 network core hook Fixes an issue whereby just enabling hooks would enable the nrf5340 network core hook despite lacking other requirements Signed-off-by: Jamie McCrae (cherry picked from commit e4e13ce6339d5624a6497b4a320e695a6933967e) --- subsys/mgmt/mcumgr/CMakeLists.txt | 13 +++++++------ subsys/mgmt/mcumgr/Kconfig | 2 +- subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c | 15 +++------------ subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig | 8 ++++++++ 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/subsys/mgmt/mcumgr/CMakeLists.txt b/subsys/mgmt/mcumgr/CMakeLists.txt index ad088eca0677..3bb21e16f798 100644 --- a/subsys/mgmt/mcumgr/CMakeLists.txt +++ b/subsys/mgmt/mcumgr/CMakeLists.txt @@ -17,10 +17,11 @@ add_subdirectory_ifdef(CONFIG_SMP_CLIENT smp_client) zephyr_library_link_libraries(mgmt_mcumgr) -if (CONFIG_BOOT_IMAGE_ACCESS_HOOKS) - zephyr_include_directories( - ${ZEPHYR_MCUBOOT_MODULE_DIR}/boot/bootutil/include - ${ZEPHYR_MCUBOOT_MODULE_DIR}/boot/zephyr/include - ) - zephyr_library_sources(bootutil_hooks/nrf53_hooks.c) +if(CONFIG_MCUMGR_GRP_IMG_NRF5340_BOOTUTIL_HOOK) + zephyr_include_directories( + ${ZEPHYR_MCUBOOT_MODULE_DIR}/boot/bootutil/include + ${ZEPHYR_MCUBOOT_MODULE_DIR}/boot/zephyr/include + ) + + zephyr_library_sources(bootutil_hooks/nrf53_hooks.c) endif() diff --git a/subsys/mgmt/mcumgr/Kconfig b/subsys/mgmt/mcumgr/Kconfig index 1c6a3a2a5162..c45cb7f81d6b 100644 --- a/subsys/mgmt/mcumgr/Kconfig +++ b/subsys/mgmt/mcumgr/Kconfig @@ -6,7 +6,7 @@ menuconfig MCUMGR bool "mcumgr Support" depends on NET_BUF depends on ZCBOR - imply BOOT_IMAGE_ACCESS_HOOKS if (SOC_NRF5340_CPUAPP_QKAA && MCUMGR_GRP_IMG) + imply BOOT_IMAGE_ACCESS_HOOKS if SOC_NRF5340_CPUAPP && MCUMGR_GRP_IMG && MCUBOOT_NETWORK_CORE_IMAGE_NUMBER > -1 help This option enables the mcumgr management library. diff --git a/subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c b/subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c index f1ac8a168e65..b372ce4e4945 100644 --- a/subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c +++ b/subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c @@ -8,19 +8,10 @@ #include #include "bootutil/bootutil_public.h" -#if CONFIG_MCUBOOT_NETWORK_CORE_IMAGE_NUMBER != -1 -/* Sysbuild */ -#define NET_CORE_IMAGE CONFIG_MCUBOOT_NETWORK_CORE_IMAGE_NUMBER -#else -/* Legacy child/parent */ -#define NET_CORE_IMAGE 1 -#endif - -int boot_read_swap_state_primary_slot_hook(int image_index, - struct boot_swap_state *state) +int boot_read_swap_state_primary_slot_hook(int image_index, struct boot_swap_state *state) { - if (image_index == NET_CORE_IMAGE) { - /* Pretend that primary slot of image 1 unpopulated */ + if (image_index == CONFIG_MCUBOOT_NETWORK_CORE_IMAGE_NUMBER) { + /* Pretend that primary slot of the network core update image is unpopulated */ state->magic = BOOT_MAGIC_UNSET; state->swap_type = BOOT_SWAP_TYPE_NONE; state->image_num = image_index; diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig b/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig index 5f122fcf71fc..d95f9b5849a5 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig @@ -227,6 +227,14 @@ config MCUMGR_GRP_IMG_QSPI_XIP_SPLIT_IMAGE sysbuild if needed. This enables selecting the correct slot when running a QSPI XIP split image application in DirectXIP mode. +config MCUMGR_GRP_IMG_NRF5340_BOOTUTIL_HOOK + bool "nRF5340 network core bootutil hook" + depends on SOC_NRF5340_CPUAPP && BOOT_IMAGE_ACCESS_HOOKS && MCUBOOT_NETWORK_CORE_IMAGE_NUMBER > -1 + default y + help + This option will enable a bootutil hook that populates the network core update image + slot with dummy data to allow for uploading a firmware update to the network core. + module = MCUMGR_GRP_IMG module-str = mcumgr_grp_img source "subsys/logging/Kconfig.template.log_config" From 892f60bbd28790a22fbaa5631fd32aaa6a6f755f Mon Sep 17 00:00:00 2001 From: Gordon Klaus Date: Tue, 8 Apr 2025 17:56:00 +0200 Subject: [PATCH 0555/2141] [nrf noup] tests: bluetooth: tester: Enable PSA RNG on nRF54H20 The PSA is a cryptographically secure random number generator. It will be enabled by default, eventually, For now, enable it manually. Signed-off-by: Gordon Klaus (cherry picked from commit 55f401babbc483a933d460a6bf11a402552aa54e) --- .../boards/nrf54h20dk_nrf54h20_cpuapp.conf | 7 ++++ .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 14 +++++++ tests/bluetooth/tester/sysbuild.cmake | 7 ---- .../boards/nrf54h20dk_nrf54h20_cpurad.conf | 40 +++++++++++++++++++ .../boards/nrf54h20dk_nrf54h20_cpurad.overlay | 13 ++++++ .../tester/sysbuild/hci_ipc/prj.conf | 23 +++++++++++ 6 files changed, 97 insertions(+), 7 deletions(-) create mode 100644 tests/bluetooth/tester/sysbuild/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.conf create mode 100644 tests/bluetooth/tester/sysbuild/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.overlay create mode 100644 tests/bluetooth/tester/sysbuild/hci_ipc/prj.conf diff --git a/tests/bluetooth/tester/boards/nrf54h20dk_nrf54h20_cpuapp.conf b/tests/bluetooth/tester/boards/nrf54h20dk_nrf54h20_cpuapp.conf index 5bb1c4d82846..51b0ef5fa8d4 100644 --- a/tests/bluetooth/tester/boards/nrf54h20dk_nrf54h20_cpuapp.conf +++ b/tests/bluetooth/tester/boards/nrf54h20dk_nrf54h20_cpuapp.conf @@ -22,3 +22,10 @@ CONFIG_LOG_DEFAULT_LEVEL=3 CONFIG_BTTESTER_LOG_LEVEL_DBG=y CONFIG_UART_INTERRUPT_DRIVEN=y + +# Enable PSA RNG +CONFIG_PSA_CRYPTO_DRIVER_OBERON=n +CONFIG_PSA_SSF_CRYPTO_CLIENT=y +CONFIG_SSF_PSA_CRYPTO_SERVICE_ENABLED=y +CONFIG_MBEDTLS_PSA_CRYPTO_C=y +CONFIG_NRF_SECURITY=y diff --git a/tests/bluetooth/tester/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/bluetooth/tester/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index e6d4f675f57a..4f9de686b7e5 100644 --- a/tests/bluetooth/tester/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/tests/bluetooth/tester/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -12,3 +12,17 @@ status = "okay"; hw-flow-control; }; + +// Enable PSA RNG +/ { + chosen { + zephyr,entropy = &psa_rng; + }; + + psa_rng: psa-rng { + compatible = "zephyr,psa-crypto-rng"; + status = "okay"; + }; + + /delete-node/ prng; +}; diff --git a/tests/bluetooth/tester/sysbuild.cmake b/tests/bluetooth/tester/sysbuild.cmake index bcd564733c53..b640a7d04936 100644 --- a/tests/bluetooth/tester/sysbuild.cmake +++ b/tests/bluetooth/tester/sysbuild.cmake @@ -18,13 +18,6 @@ if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) ) endif() - if(SB_CONFIG_SOC_NRF54H20_CPUAPP) - set(${NET_APP}_CONF_FILE - ${NET_APP_SRC_DIR}/nrf54h20_cpurad-bt_ll_softdevice.conf - CACHE INTERNAL "" - ) - endif() - set(${NET_APP}_EXTRA_CONF_FILE ${APP_DIR}/overlay-bt_ll_sw_split.conf CACHE INTERNAL "" diff --git a/tests/bluetooth/tester/sysbuild/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.conf b/tests/bluetooth/tester/sysbuild/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.conf new file mode 100644 index 000000000000..b7d64a9e6a08 --- /dev/null +++ b/tests/bluetooth/tester/sysbuild/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.conf @@ -0,0 +1,40 @@ +CONFIG_IPC_SERVICE=y +CONFIG_MBOX=y + +CONFIG_ISR_STACK_SIZE=1024 +CONFIG_IDLE_STACK_SIZE=256 +CONFIG_MAIN_STACK_SIZE=1024 +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=512 +CONFIG_IPC_SERVICE_BACKEND_RPMSG_WQ_STACK_SIZE=512 +CONFIG_HEAP_MEM_POOL_SIZE=8192 + +CONFIG_BT=y +CONFIG_BT_HCI_RAW=y + +CONFIG_BT_BUF_EVT_RX_COUNT=16 +CONFIG_BT_BUF_EVT_RX_SIZE=255 +CONFIG_BT_BUF_ACL_RX_SIZE=255 +CONFIG_BT_BUF_ACL_TX_SIZE=251 +CONFIG_BT_BUF_CMD_TX_SIZE=255 + +# Host +CONFIG_BT_BROADCASTER=y +CONFIG_BT_PERIPHERAL=y +CONFIG_BT_OBSERVER=y +CONFIG_BT_CENTRAL=y +CONFIG_BT_EXT_ADV=y +CONFIG_BT_PER_ADV=y +CONFIG_BT_PER_ADV_SYNC=y + +# Controller +CONFIG_BT_LL_SW_SPLIT=n +CONFIG_BT_LL_SOFTDEVICE=y +CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 +CONFIG_BT_CTLR_SCAN_DATA_LEN_MAX=191 + +# Enable PSA RNG +CONFIG_PSA_CRYPTO_DRIVER_OBERON=n +CONFIG_PSA_SSF_CRYPTO_CLIENT=y +CONFIG_SSF_PSA_CRYPTO_SERVICE_ENABLED=y +CONFIG_MBEDTLS_PSA_CRYPTO_C=y +CONFIG_NRF_SECURITY=y diff --git a/tests/bluetooth/tester/sysbuild/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.overlay b/tests/bluetooth/tester/sysbuild/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.overlay new file mode 100644 index 000000000000..e34567fe834a --- /dev/null +++ b/tests/bluetooth/tester/sysbuild/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.overlay @@ -0,0 +1,13 @@ +// Enable PSA RNG +/ { + chosen { + zephyr,entropy = &psa_rng; + }; + + psa_rng: psa-rng { + compatible = "zephyr,psa-crypto-rng"; + status = "okay"; + }; + + /delete-node/ prng; +}; diff --git a/tests/bluetooth/tester/sysbuild/hci_ipc/prj.conf b/tests/bluetooth/tester/sysbuild/hci_ipc/prj.conf new file mode 100644 index 000000000000..08b1aed9e7f6 --- /dev/null +++ b/tests/bluetooth/tester/sysbuild/hci_ipc/prj.conf @@ -0,0 +1,23 @@ +CONFIG_IPC_SERVICE=y +CONFIG_MBOX=y + +CONFIG_HEAP_MEM_POOL_SIZE=4096 + +CONFIG_MAIN_STACK_SIZE=512 +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=512 + +CONFIG_BT=y +CONFIG_BT_HCI_RAW=y +CONFIG_BT_MAX_CONN=16 + + +# Workaround: Unable to allocate command buffer when using K_NO_WAIT since +# Host number of completed commands does not follow normal flow control. +CONFIG_BT_BUF_CMD_TX_COUNT=10 + +# Enable and adjust the below value as necessary +# CONFIG_BT_BUF_EVT_RX_COUNT=16 +# CONFIG_BT_BUF_EVT_RX_SIZE=255 +# CONFIG_BT_BUF_ACL_RX_SIZE=255 +# CONFIG_BT_BUF_ACL_TX_SIZE=251 +# CONFIG_BT_BUF_CMD_TX_SIZE=255 From ad003a38b2a4230828df44ea025f179a64256947 Mon Sep 17 00:00:00 2001 From: Carles Cufi Date: Fri, 30 Nov 2018 14:07:56 +0100 Subject: [PATCH 0556/2141] [nrf noup] ci: NCS-specific CI tweaks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Necessary changes for NCS CI. - Add a Jenkinsfile - Add a commit-tags workflow: This enables sauce tag checking in sdk-zephyr - compliance.yml: Disable check for merge commits, since we have upmerges downstream. Also, since in the code we refer to Kconfig symbols that are defined in the sdk-nrf repository, the Kconfig checks ((SysBuild)Kconfig, (SysBuild)KconfigBasic and (SysBuild)KconfigBasicNoModules) will not pass so exclude them. Also, disable any maintainers-related checks - scripts/gitlint: Extend the max commit line lengths for Gitlint to account for sauce tags - Adapt to the changes in: https://github.com/nrfconnect/action-commit-tags/pull/4 Signed-off-by: Carles Cufi Signed-off-by: Dominik Ermel Signed-off-by: Martí Bolívar Signed-off-by: Vinayak Kariappa Chettimada Signed-off-by: Krishna T Signed-off-by: Dominik Ermel (cherry picked from commit 9c80c875a24013dd2d9c03dd7442c2ba96d2bbf8) --- .github/workflows/commit-tags.yml | 28 ++++++++++++++++++++++++++ .github/workflows/compliance.yml | 13 +++++------- Jenkinsfile | 5 +++++ scripts/gitlint/zephyr_commit_rules.py | 4 ++-- 4 files changed, 40 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/commit-tags.yml create mode 100644 Jenkinsfile diff --git a/.github/workflows/commit-tags.yml b/.github/workflows/commit-tags.yml new file mode 100644 index 000000000000..828f02971678 --- /dev/null +++ b/.github/workflows/commit-tags.yml @@ -0,0 +1,28 @@ +name: Commit tags + +on: + pull_request: + types: [synchronize, opened, reopened, edited, labeled, unlabeled, + milestoned, demilestoned, assigned, unassigned, ready_for_review, + review_requested] + +jobs: + commit_tags: + runs-on: ubuntu-22.04 + name: Run commit tags checks on patch series (PR) + steps: + - name: Update PATH for west + run: | + echo "$HOME/.local/bin" >> $GITHUB_PATH + + - name: Checkout the code + uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.head.sha }} + fetch-depth: 0 + + - name: Run the commit tags + uses: nrfconnect/action-commit-tags@main + with: + target: . + upstream: zephyrproject-rtos/zephyr/main diff --git a/.github/workflows/compliance.yml b/.github/workflows/compliance.yml index 9d1621cc4d3a..22744e8a6ac1 100644 --- a/.github/workflows/compliance.yml +++ b/.github/workflows/compliance.yml @@ -34,8 +34,8 @@ jobs: git config --global user.name "Your Name" git remote -v # Ensure there's no merge commits in the PR - [[ "$(git rev-list --merges --count origin/${BASE_REF}..)" == "0" ]] || \ - (echo "::error ::Merge commits not allowed, rebase instead";false) + #[[ "$(git rev-list --merges --count origin/${BASE_REF}..)" == "0" ]] || \ + #(echo "::error ::Merge commits not allowed, rebase instead";false) rm -fr ".git/rebase-apply" rm -fr ".git/rebase-merge" git rebase origin/${BASE_REF} @@ -72,12 +72,9 @@ jobs: git log --pretty=oneline | head -n 10 # Increase rename limit to allow for large PRs git config diff.renameLimit 10000 - excludes="-e KconfigBasic -e SysbuildKconfigBasic -e ClangFormat" - # The signed-off-by check for dependabot should be skipped - if [ "${{ github.actor }}" == "dependabot[bot]" ]; then - excludes="$excludes -e Identity" - fi - ./scripts/ci/check_compliance.py --annotate $excludes -c origin/${BASE_REF}.. + ./scripts/ci/check_compliance.py --annotate -e KconfigBasic -e SysbuildKconfigBasic \ + -e Kconfig -e SysbuildKconfig -e KconfigBasicNoModules -e SysbuildKconfigBasicNoModules \ + -e ModulesMaintainers -c origin/${BASE_REF}.. - name: upload-results uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 000000000000..3b9cf0022399 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,5 @@ +@Library("CI_LIB") _ + +def pipeline = new ncs.sdk_zephyr.Main() + +pipeline.run(JOB_NAME) diff --git a/scripts/gitlint/zephyr_commit_rules.py b/scripts/gitlint/zephyr_commit_rules.py index a2c9cd3cb7fe..ef317e22684c 100644 --- a/scripts/gitlint/zephyr_commit_rules.py +++ b/scripts/gitlint/zephyr_commit_rules.py @@ -78,7 +78,7 @@ class TitleMaxLengthRevert(LineRule): name = "title-max-length-no-revert" id = "UC5" target = CommitMessageTitle - options_spec = [IntOption('line-length', 75, "Max line length")] + options_spec = [IntOption('line-length', 120, "Max line length")] violation_message = "Commit title exceeds max length ({0}>{1})" def validate(self, line, _commit): @@ -103,7 +103,7 @@ class MaxLineLengthExceptions(LineRule): name = "max-line-length-with-exceptions" id = "UC4" target = CommitMessageBody - options_spec = [IntOption('line-length', 75, "Max line length")] + options_spec = [IntOption('line-length', 120, "Max line length")] violation_message = "Commit message body line exceeds max length ({0}>{1})" def validate(self, line, _commit): From 77ba279d1f02d409714133c72ca70852193d5e3c Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Mon, 12 May 2025 08:47:55 +0100 Subject: [PATCH 0557/2141] [nrf noup] scripts: ci: check_compliance: Add NCS sysbuild Kconfigs Adds symbols used in NCS to the sysbuild Kconfig allow list Signed-off-by: Jamie McCrae (cherry picked from commit cdad205084d8ce92ced86d96e49e79943758e3d9) --- scripts/ci/check_compliance.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index 31bb02c22f88..3ee7b62c9b5a 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -1241,6 +1241,30 @@ class SysbuildKconfigCheck(KconfigCheck): "SUIT_MPI_GENERATE", # Used by nRF runners to program provisioning data "SUIT_MPI_RAD_AREA_PATH", # Used by nRF runners to program provisioning data # zephyr-keep-sorted-stop + + # NCS-specific allowlist + # zephyr-keep-sorted-start re(^\s+") + "APP_CPUNET_RUN", # Used by sample + "APP_DFU", # Used by sample + "BT_FAST_PAIR", # Legacy/removed, used in migration documentation + "COMP_DATA_LAYOUT_ARRAY", # Used by test + "COMP_DATA_LAYOUT_MULTIPLE", # Used by test + "COMP_DATA_LAYOUT_SINGLE", # Used by test + "DTM_NO_DFE", # Used by DTM application + "DTM_TRANSPORT_HCI", # Used by DTM application + "INCLUDE_REMOTE_IMAGE", # Used by machine learning application + "MCUBOOT_FPROTECT_ALLOW_COMBINED_REGIONS", # Used in migration documentation + "ML_APP_INCLUDE_REMOTE_IMAGE", # Used by machine learning application + "ML_APP_REMOTE_BOARD", # Used by machine learning application + "MY_APP_IMAGE_ABC", # Used in documentation + "REMOTE_GLOBAL_DOMAIN_CLOCK_FREQUENCY_SWITCHING", # Used in tests + "SOC_FLASH_NRF_RADIO_SYNC_RPC", # Used in documentation + "SUIT_ENVELOPE_", # Used by jinja + "SUIT_ENVELOPE_SEQUENCE_NUM", # Legacy/removed, used in migration documentation + "SUIT_MPI_", # Used by jinja + "SUIT_RECOVERY_APPLICATION_CUSTOM", # Used in documentation + "SUPPORT_NETCORE_PERIPHERAL_RADIO_TEST", # Used by wifi radio test sample + # zephyr-keep-sorted-stop } From 15cd2f6e5d5b9e6580365cae8d882e1e8845f188 Mon Sep 17 00:00:00 2001 From: Riadh Ghaddab Date: Tue, 3 Jun 2025 16:07:48 +0200 Subject: [PATCH 0558/2141] [nrf noup] zms: add lookup cache hash function for legacy ZMS ZMS legacy enabled by CONFIG_SETTINGS_ZMS_LEGACY uses a different lookup cache function that is optimized for Settings subsystem. Signed-off-by: Riadh Ghaddab (cherry picked from commit 491354b7e5fd6255de4b119e9256012aefaf19f6) --- subsys/fs/zms/zms.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/subsys/fs/zms/zms.c b/subsys/fs/zms/zms.c index 80b86a41cdcb..95c2ef82c3b4 100644 --- a/subsys/fs/zms/zms.c +++ b/subsys/fs/zms/zms.c @@ -13,8 +13,12 @@ #include #include "zms_priv.h" #ifdef CONFIG_ZMS_LOOKUP_CACHE_FOR_SETTINGS +#ifdef CONFIG_SETTINGS_ZMS_LEGACY +#include +#else #include #endif +#endif #include LOG_MODULE_REGISTER(fs_zms, CONFIG_ZMS_LOG_LEVEL); @@ -34,6 +38,39 @@ static inline size_t zms_lookup_cache_pos(uint32_t id) uint32_t hash = id; #ifdef CONFIG_ZMS_LOOKUP_CACHE_FOR_SETTINGS +#ifdef CONFIG_SETTINGS_ZMS_LEGACY + /* + * 1. The ZMS settings backend uses up to (ZMS_NAME_ID_OFFSET - 1) ZMS IDs to + store keys and equal number of ZMS IDs to store values. + * 2. For each key-value pair, the value is stored at ZMS ID greater by exactly + * ZMS_NAME_ID_OFFSET than ZMS ID that holds the key. + * 3. The backend tries to minimize the range of ZMS IDs used to store keys. + * That is, ZMS IDs are allocated sequentially, and freed ZMS IDs are reused + * before allocating new ones. + * + * Therefore, to assure the least number of collisions in the lookup cache, + * the least significant bit of the hash indicates whether the given ZMS ID + * represents a key or a value, and remaining bits of the hash are set to + * the ordinal number of the key-value pair. Consequently, the hash function + * provides the following mapping: + * + * 1st settings key => hash 0 + * 1st settings value => hash 1 + * 2nd settings key => hash 2 + * 2nd settings value => hash 3 + * ... + */ + BUILD_ASSERT(IS_POWER_OF_TWO(ZMS_NAMECNT_ID), "ZMS_NAMECNT_ID is not power of 2"); + BUILD_ASSERT(IS_POWER_OF_TWO(ZMS_NAME_ID_OFFSET), "ZMS_NAME_ID_OFFSET is not power of 2"); + + uint32_t key_value_bit; + uint32_t key_value_ord; + + key_value_bit = (id >> LOG2(ZMS_NAME_ID_OFFSET)) & 1; + key_value_ord = id & (ZMS_NAME_ID_OFFSET - 1); + + hash = ((key_value_ord << 1) | key_value_bit); +#else /* * 1. Settings subsystem is storing the name ID and the linked list node ID * with only one bit difference at BIT(0). @@ -58,6 +95,7 @@ static inline size_t zms_lookup_cache_pos(uint32_t id) key_value_ll = id & BIT(0); hash = (key_value_hash << 2) | (key_value_bit << 1) | key_value_ll; +#endif /* CONFIG_SETTINGS_ZMS_LEGACY */ #else /* 32-bit integer hash function found by https://github.com/skeeto/hash-prospector. */ hash ^= hash >> 16; From b68aa7bd7be4df7d7d6cb924c1f963cb590b9ce9 Mon Sep 17 00:00:00 2001 From: Robert Stypa Date: Wed, 18 Jun 2025 07:45:47 +0200 Subject: [PATCH 0559/2141] [nrf noup] ci: Update CI-boot-test patterns and remove SUIT labels Add boards/nordic/**/* to the CI-boot-test scope and remove SUIT labels. Signed-off-by: Robert Stypa (cherry picked from commit 6c7937356d0b37b752ac58079cbe473794ced5ee) --- .github/test-spec.yml | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/.github/test-spec.yml b/.github/test-spec.yml index 6da6bdbaa87d..5337249f7dab 100644 --- a/.github/test-spec.yml +++ b/.github/test-spec.yml @@ -39,6 +39,7 @@ # Not necessary to run tests on changes to this repo. "CI-boot-test": + - "boards/nordic/**/*" - "subsys/mgmt/mcumgr/**/*" - "subsys/dfu/**/*" - "include/mgmt/mcumgr/**/*" @@ -364,29 +365,3 @@ - "tests/boards/nordic/**/*" - "tests/drivers/**/*" - "tests/kernel/**/*" - -"CI-suit-dfu-test": - - "subsys/mgmt/mcumgr/**/*" - - "include/mgmt/mcumgr/**/*" - - "samples/subsys/mgmt/mcumgr/smp_svr/**/*" - - "subsys/bluetooth/**/*" - - "drivers/bluetooth/**/*" - - "drivers/flash/**/*" - - "drivers/spi/**/*" - - "drivers/mbox/**/*" - - "drivers/serial/**/*" - - "drivers/console/**/*" - - "drivers/gpio/**/*" - - "dts/common/nordic/*" - - "dts/arm/nordic/nrf54h*/**/*" - - "dts/riscv/nordic/nrf54h*/**/*" - - "boards/nordic/nrf54h*/**/*" - - "soc/nordic/nrf54h/**/*" - - "include/zephyr/**/*" - - "subsys/logging/**/*" - - "subsys/tracing/**/*" - - "scripts/west_commands/build.py" - - "scripts/west_commands/flash.py" - - "scripts/west_commands/runners/nrfutil.py" - - "scripts/west_commands/runners/core.py" - - "scripts/west_commands/runners/nrf_common.py" From 45023b2d4f10fbbcb6f0be9da7d666a1cc5dee46 Mon Sep 17 00:00:00 2001 From: Richa Pandey Date: Thu, 19 Jun 2025 11:07:37 +0200 Subject: [PATCH 0560/2141] [nrf noup] zephyr: doc: fix board page Fixed board page in zephyr. Signed-off-by: Richa Pandey (cherry picked from commit f1732a80ba0235182aad668e7023755cf6a4417b) --- boards/index.rst | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/boards/index.rst b/boards/index.rst index 3cc92770cfeb..2ffe426fc24b 100644 --- a/boards/index.rst +++ b/boards/index.rst @@ -12,33 +12,8 @@ template available under :zephyr_file:`doc/templates/board.tmpl`. Shields are hardware add-ons that can be stacked on top of a board to add extra functionality. Refer to the :ref:`shield_porting_guide` for more information on how to port a shield. -.. admonition:: Search Tips - :class: dropdown - - * Use the form below to filter the list of supported boards and shields. If a field is left - empty, it will not be used in the filtering process. - - * Filtering by name and vendor is available for both boards and shields. The rest of the fields - apply only to boards. - - * A board/shield must meet **all** criteria selected across different fields. For example, if you - select both a vendor and an architecture, only boards that match both will be displayed. Within - a single field, selecting multiple options (such as two architectures) will show boards - matching **either** option. - - * The list of supported hardware features for each board is automatically generated using - information from the Devicetree. It may not be reflecting the full list of supported features - since some of them may not be enabled by default. - - * Can't find your exact board? Don't worry! If a similar board with the same or a closely related - MCU exists, you can use it as a :ref:`starting point ` for adding - support for your own board. - .. toctree:: :maxdepth: 2 :glob: - :hidden: */index - -.. zephyr:board-catalog:: From 1890dbafd139c48deecd082099fb036fb4ca1649 Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Tue, 10 Jun 2025 23:20:32 +0200 Subject: [PATCH 0561/2141] [nrf noup] bluetooth: host: Add support for bonding with same peer This commit adds a new Kconfig option by enabling which Host will keep bonding with the same Central instead of rejecting pairing. Brief implementation details: This implementation adds a new flag to bt_keys struct: BT_KEYS_ID_CONFLICT. The flag is set, when: - bonding with the same peer and conflict identified - when loading conflicting keys from persistent storage. When bonding and conflict is identified, the new keys aren't added to the Resolving List immediately. Instead, the old keys stay in the Resolving List. When start advertising, Host finds conflicting keys that are already added to the Resolving List and substitues them. If, however, there is another advertiser already started for the added keys, the new request is reject and advertising start function returns -EPERM. This is supported by Peripheral role only for now. Signed-off-by: Pavel Vasilyev (cherry picked from commit 93b8dd96508ddc5b86ea2f34ea57501fce5311b2) --- include/zephyr/bluetooth/bluetooth.h | 10 ++ subsys/bluetooth/host/Kconfig | 18 +++ subsys/bluetooth/host/adv.c | 52 +++++++ subsys/bluetooth/host/adv.h | 1 + subsys/bluetooth/host/hci_core.h | 23 ++- subsys/bluetooth/host/id.c | 217 +++++++++++++++++++++++++-- subsys/bluetooth/host/id.h | 23 +++ subsys/bluetooth/host/keys.c | 79 +++++++++- subsys/bluetooth/host/keys.h | 6 + subsys/bluetooth/host/smp.c | 18 ++- tests/bluetooth/host/id/mocks/adv.c | 1 + tests/bluetooth/host/id/mocks/adv.h | 4 +- tests/bluetooth/host/id/mocks/keys.c | 1 + tests/bluetooth/host/id/mocks/keys.h | 4 +- 14 files changed, 427 insertions(+), 30 deletions(-) diff --git a/include/zephyr/bluetooth/bluetooth.h b/include/zephyr/bluetooth/bluetooth.h index c68327647599..7f287f1c3448 100644 --- a/include/zephyr/bluetooth/bluetooth.h +++ b/include/zephyr/bluetooth/bluetooth.h @@ -1489,6 +1489,10 @@ struct bt_le_per_adv_param { * This error code is only guaranteed when using Zephyr * controller, for other controllers code returned in * this case may be -EIO. + * @return -EPERM When @kconfig{CONFIG_BT_PRIVACY} and + * @kconfig{CONFIG_BT_ID_AUTO_SWAP_MATCHING_BONDS} are enabled and connectable + * advertising is requested, and the given local identity has a conflicting + * key with another local identity for which advertising is already started. */ int bt_le_adv_start(const struct bt_le_adv_param *param, const struct bt_data *ad, size_t ad_len, @@ -1616,6 +1620,12 @@ struct bt_le_ext_adv_start_param { * * @param adv Advertising set object. * @param param Advertise start parameters. + * + * @return Zero on success or (negative) error code otherwise. + * @return -EPERM When @kconfig{CONFIG_BT_PRIVACY} and + * @kconfig{CONFIG_BT_ID_AUTO_SWAP_MATCHING_BONDS} are enabled and connectable + * advertising is requested, and the given local identity has a conflicting + * key with another local identity for which advertising is already started. */ int bt_le_ext_adv_start(struct bt_le_ext_adv *adv, const struct bt_le_ext_adv_start_param *param); diff --git a/subsys/bluetooth/host/Kconfig b/subsys/bluetooth/host/Kconfig index 7611761bb453..3830745417ae 100644 --- a/subsys/bluetooth/host/Kconfig +++ b/subsys/bluetooth/host/Kconfig @@ -630,6 +630,24 @@ config BT_ID_UNPAIR_MATCHING_BONDS link-layer. The Host does not have control over this acknowledgment, and the order of distribution is fixed by the specification. +config BT_ID_AUTO_SWAP_MATCHING_BONDS + bool "Automatically swap conflicting entries in the Resolving List" + depends on !BT_ID_UNPAIR_MATCHING_BONDS + depends on BT_PRIVACY && BT_PERIPHERAL && !BT_CENTRAL + help + If this option is enabled, the Host will not add a new bond with + the same peer address (or IRK) to the Resolving List if there is + already a bond with the same peer address (or IRK) on another local + identity. + + In case of Peripheral, the Host will swap the existing entry in the + Resolving List with the new one, so that the new bond will be used for + address resolution for the new local identity if the device starts + advertising with the new local identity. + + Important: this option is supported exclusively in the Peripheral + role. Excluding the Central role. + config BT_ID_ALLOW_UNAUTH_OVERWRITE bool "Allow unauthenticated pairing with same peer with other local identity" depends on !BT_SMP_ALLOW_UNAUTH_OVERWRITE diff --git a/subsys/bluetooth/host/adv.c b/subsys/bluetooth/host/adv.c index 25a538614e3a..2d7d65aaaeb8 100644 --- a/subsys/bluetooth/host/adv.c +++ b/subsys/bluetooth/host/adv.c @@ -272,6 +272,25 @@ struct bt_le_ext_adv *bt_hci_adv_lookup_handle(uint8_t handle) #endif /* CONFIG_BT_BROADCASTER */ #endif /* defined(CONFIG_BT_EXT_ADV) */ +struct bt_le_ext_adv *bt_adv_lookup_by_id(uint8_t id) +{ +#if defined(CONFIG_BT_EXT_ADV) + for (size_t i = 0; i < ARRAY_SIZE(adv_pool); i++) { + if (atomic_test_bit(adv_pool[i].flags, BT_ADV_CREATED) && + adv_pool[i].id == id) { + return &adv_pool[i]; + } + } +#else + if (atomic_test_bit(bt_dev.adv.flags, BT_ADV_CREATED) && bt_dev.adv.id == id) { + return &bt_dev.adv; + } +#endif + + return NULL; +} + + void bt_le_ext_adv_foreach(void (*func)(struct bt_le_ext_adv *adv, void *data), void *data) { @@ -1021,6 +1040,14 @@ int bt_le_adv_start_legacy(struct bt_le_ext_adv *adv, adv->id = param->id; bt_dev.adv_conn_id = adv->id; + if (IS_ENABLED(CONFIG_BT_ID_AUTO_SWAP_MATCHING_BONDS)) { + err = bt_id_resolving_list_check_and_update(adv->id, param->peer); + if (err) { + LOG_ERR("Failed to check and update resolving list: %d", err); + return err; + } + } + err = bt_id_set_adv_own_addr(adv, param->options, dir_adv, &set_param.own_addr_type); if (err) { @@ -1336,6 +1363,15 @@ int bt_le_adv_start_ext(struct bt_le_ext_adv *adv, } adv->id = param->id; + + if (IS_ENABLED(CONFIG_BT_ID_AUTO_SWAP_MATCHING_BONDS)) { + err = bt_id_resolving_list_check_and_update(adv->id, param->peer); + if (err) { + LOG_ERR("Failed to check and update resolving list: %d", err); + return err; + } + } + err = le_ext_adv_param_set(adv, param, sd != NULL); if (err) { return err; @@ -1691,6 +1727,22 @@ int bt_le_ext_adv_start(struct bt_le_ext_adv *adv, return -EALREADY; } + if (IS_ENABLED(CONFIG_BT_ID_AUTO_SWAP_MATCHING_BONDS)) { + const bt_addr_le_t *peer; + + if (bt_addr_le_eq(&adv->target_addr, BT_ADDR_LE_ANY)) { + peer = NULL; + } else { + peer = &adv->target_addr; + } + + err = bt_id_resolving_list_check_and_update(adv->id, peer); + if (err) { + LOG_ERR("Failed to check and update resolving list: %d", err); + return err; + } + } + if (IS_ENABLED(CONFIG_BT_PERIPHERAL) && atomic_test_bit(adv->flags, BT_ADV_CONNECTABLE)) { err = le_adv_start_add_conn(adv, &conn); diff --git a/subsys/bluetooth/host/adv.h b/subsys/bluetooth/host/adv.h index 65ad51135ce0..1bd15854db28 100644 --- a/subsys/bluetooth/host/adv.h +++ b/subsys/bluetooth/host/adv.h @@ -25,3 +25,4 @@ int bt_le_adv_set_enable_ext(struct bt_le_ext_adv *adv, int bt_le_adv_set_enable_legacy(struct bt_le_ext_adv *adv, bool enable); int bt_le_lim_adv_cancel_timeout(struct bt_le_ext_adv *adv); void bt_adv_reset_adv_pool(void); +struct bt_le_ext_adv *bt_adv_lookup_by_id(uint8_t id); diff --git a/subsys/bluetooth/host/hci_core.h b/subsys/bluetooth/host/hci_core.h index b6ebdba31a7e..74c2711b3e4c 100644 --- a/subsys/bluetooth/host/hci_core.h +++ b/subsys/bluetooth/host/hci_core.h @@ -500,7 +500,28 @@ struct bt_keys; void bt_id_add(struct bt_keys *keys); void bt_id_del(struct bt_keys *keys); -struct bt_keys *bt_id_find_conflict(struct bt_keys *candidate); +/** @brief Find a conflict in the resolving list for a candidate IRK. + * + * @param candidate The candidate keys to check for conflicts. + * @param all If true, check all IRKs, otherwise check only added keys. + * + * @return The conflicting key if there is one, or NULL if no conflict was found. + */ +struct bt_keys *bt_id_find_conflict(struct bt_keys *candidate, bool all); + +/** * @brief Find multiple conflicts in the resolving list for a candidate IRK. + * + * This function iterates over all keys (added and not added to the Resolving List). If there are + * multiple conflicts, this function will return true. Otherwise, it will return false. + * + * If @c firt_conflict is not NULL, it will be set to the first found conflict. + * + * @param candidate The candidate key to check for conflicts. + * @param first_conflict Pointer to store the first found conflict, if any. Can be NULL. + * + * @return True if there are multiple conflicts, otherwise it returns false. + */ +bool bt_id_find_conflict_multiple(struct bt_keys *candidate, struct bt_keys **first_conflict); int bt_setup_random_id_addr(void); int bt_setup_public_id_addr(void); diff --git a/subsys/bluetooth/host/id.c b/subsys/bluetooth/host/id.c index e52294cf5386..436feb32c1be 100644 --- a/subsys/bluetooth/host/id.c +++ b/subsys/bluetooth/host/id.c @@ -942,9 +942,33 @@ void bt_id_pending_keys_update(void) } } +static bool keys_conflict_check(const struct bt_keys *candidate, const struct bt_keys *resident) +{ + bool addr_conflict; + bool irk_conflict; + + addr_conflict = bt_addr_le_eq(&candidate->addr, &resident->addr); + + /* All-zero IRK is "no IRK", and does not conflict with other Zero-IRKs. */ + irk_conflict = (!bt_irk_eq(&candidate->irk, &(struct bt_irk){}) && + bt_irk_eq(&candidate->irk, &resident->irk)); + + if (addr_conflict || irk_conflict) { + LOG_DBG("Resident : addr %s and IRK %s", bt_addr_le_str(&resident->addr), + bt_hex(resident->irk.val, sizeof(resident->irk.val))); + LOG_DBG("Candidate: addr %s and IRK %s", bt_addr_le_str(&candidate->addr), + bt_hex(candidate->irk.val, sizeof(candidate->irk.val))); + + return true; + } + + return false; +} + struct bt_id_conflict { struct bt_keys *candidate; struct bt_keys *found; + bool check_all_irk; }; /* The Controller Resolve List is constrained by 7.8.38 "LE Add Device To @@ -956,8 +980,6 @@ struct bt_id_conflict { void find_rl_conflict(struct bt_keys *resident, void *user_data) { struct bt_id_conflict *conflict = user_data; - bool addr_conflict; - bool irk_conflict; __ASSERT_NO_MSG(conflict != NULL); __ASSERT_NO_MSG(conflict->candidate != NULL); @@ -970,30 +992,26 @@ void find_rl_conflict(struct bt_keys *resident, void *user_data) } /* Test against committed bonds only. */ - if ((resident->state & BT_KEYS_ID_ADDED) == 0) { + if (!conflict->check_all_irk && (resident->state & BT_KEYS_ID_ADDED) == 0) { + /* If the resident bond is not committed, we cannot have a conflict. */ return; } - addr_conflict = bt_addr_le_eq(&conflict->candidate->addr, &resident->addr); - - /* All-zero IRK is "no IRK", and does not conflict with other Zero-IRKs. */ - irk_conflict = (!bt_irk_eq(&conflict->candidate->irk, &(struct bt_irk){}) && - bt_irk_eq(&conflict->candidate->irk, &resident->irk)); - - if (addr_conflict || irk_conflict) { - LOG_DBG("Resident : addr %s and IRK %s", bt_addr_le_str(&resident->addr), - bt_hex(resident->irk.val, sizeof(resident->irk.val))); - LOG_DBG("Candidate: addr %s and IRK %s", bt_addr_le_str(&conflict->candidate->addr), - bt_hex(conflict->candidate->irk.val, sizeof(conflict->candidate->irk.val))); + if (resident->id == conflict->candidate->id) { + /* If the IDs are the same, we cannot have a conflict. */ + return; + } + if (keys_conflict_check(conflict->candidate, resident)) { conflict->found = resident; } } -struct bt_keys *bt_id_find_conflict(struct bt_keys *candidate) +struct bt_keys *bt_id_find_conflict(struct bt_keys *candidate, bool check_all_irk) { struct bt_id_conflict conflict = { .candidate = candidate, + .check_all_irk = check_all_irk, }; bt_keys_foreach_type(BT_KEYS_IRK, find_rl_conflict, &conflict); @@ -1001,6 +1019,59 @@ struct bt_keys *bt_id_find_conflict(struct bt_keys *candidate) return conflict.found; } +struct bt_id_conflict_multiple { + struct bt_keys *candidate; + struct bt_keys *found; + bool found_multiple; +}; + +void find_rl_conflict_multiple(struct bt_keys *resident, void *user_data) +{ + struct bt_id_conflict_multiple *conflict = user_data; + + __ASSERT_NO_MSG(conflict != NULL); + __ASSERT_NO_MSG(conflict->candidate != NULL); + __ASSERT_NO_MSG(resident != NULL); + + if (conflict->found_multiple) { + /* If we already found enough conflicts, we can stop searching. */ + return; + } + + if (resident->id == conflict->candidate->id) { + /* If the IDs are the same, we cannot have a conflict. */ + return; + } + + if (keys_conflict_check(conflict->candidate, resident)) { + if (conflict->found) { + conflict->found_multiple = true; + + LOG_WRN("Found multiple conflicts for %s: addr %s and IRK %s", + bt_addr_le_str(&conflict->candidate->addr), + bt_addr_le_str(&resident->addr), + bt_hex(resident->irk.val, sizeof(resident->irk.val))); + } else { + conflict->found = resident; + } + } +} + +bool bt_id_find_conflict_multiple(struct bt_keys *candidate, struct bt_keys **first_conflict) +{ + struct bt_id_conflict_multiple conflict = { + .candidate = candidate, + }; + + bt_keys_foreach_type(BT_KEYS_IRK, find_rl_conflict_multiple, &conflict); + + if (first_conflict != NULL) { + *first_conflict = conflict.found; + } + + return conflict.found_multiple; +} + void bt_id_add(struct bt_keys *keys) { CHECKIF(keys == NULL) { @@ -1252,6 +1323,122 @@ void bt_id_del(struct bt_keys *keys) bt_le_ext_adv_foreach(adv_unpause_enabled, NULL); } } + +static int conflict_check_and_replace(uint8_t id, struct bt_keys *keys) +{ + /* For the given key check if it has conflicts with other keys in the Resolving List + * (such keys have BT_KEYS_ID_ADDED state and BT_KEYS_ID_CONFLICT flag set). If it does, we + * need to remove the conflicting key from the Resolving List and add the new key. + * + * If the key is not in the Resolving List, we can add the new key right away. + * + * If advertiser for the conflicting key is enabled, we cannot remove the key from the + * Resolving List, so we return an error. + */ + + struct bt_keys *conflict; + const struct bt_le_ext_adv *adv; + + if (!(keys->flags & BT_KEYS_ID_CONFLICT)) { + LOG_DBG("Key has no conflicts for id %u addr %s", id, bt_addr_le_str(&keys->addr)); + return 0; + } + + if (keys->state & BT_KEYS_ID_ADDED) { + LOG_DBG("Key is already added to resolving list for id %u addr %s", id, + bt_addr_le_str(&keys->addr)); + return 0; + } + + /* bt_id_find_conflict returns only keys added to the Resolving List (state is + * BT_KEYS_ID_ADDED). If the key has conflict, but no keys were added (for example, if the + * last added key was removed after bt_unpair()), then this function will return NULL. Then, + * we don't need to remove a conflicting key from the Resolving List. Otherwise, we need to + * remove the conflicting key from the Resolving List before adding the new key. + */ + conflict = bt_id_find_conflict(keys, false); + if (conflict != NULL) { + __ASSERT_NO_MSG((conflict->flags & BT_KEYS_ID_CONFLICT) != 0); + + LOG_DBG("Found conflicting key with id %u addr %s", conflict->id, + bt_addr_le_str(&conflict->addr)); + + adv = bt_adv_lookup_by_id(conflict->id); + if (adv && atomic_test_bit(adv->flags, BT_ADV_ENABLED)) { + LOG_WRN("Cannot remove the conflicting key from the Resolving List while" + " advertising"); + return -EPERM; + } + + /* Drop BT_KEYS_ID_PENDING_DEL flag if we were about to delete the keys since we + * delete it here. + */ + conflict->state &= ~BT_KEYS_ID_PENDING_DEL; + bt_id_del(conflict); + } + + bt_id_add(keys); + + return 0; +} + +struct bt_id_resolve { + uint8_t id; + int err; +}; + +static void check_and_add_keys_for_id(struct bt_keys *keys, void *data) +{ + struct bt_id_resolve *resolve = data; + + if (resolve->err) { + /* Skipping other keys because we got error. */ + return; + } + + if (resolve->id != keys->id) { + /* We are only interested in keys for the given id */ + return; + } + + resolve->err = conflict_check_and_replace(resolve->id, keys); +} + +int bt_id_resolving_list_check_and_update(uint8_t id, const bt_addr_le_t *peer) +{ + int err; + + if (peer == NULL) { + struct bt_id_resolve resolve = { + .id = id, + }; + + LOG_DBG("Updating resolving list for id %u without peer address", id); + + bt_keys_foreach_type(BT_KEYS_IRK, check_and_add_keys_for_id, &resolve); + err = resolve.err; + } else { + struct bt_keys *keys; + + LOG_DBG("Updating resolving list for id %u addr %s", id, bt_addr_le_str(peer)); + + keys = bt_keys_get_addr(id, peer); + if (!keys) { + LOG_DBG("No keys found for id %u addr %s", id, bt_addr_le_str(peer)); + return -ENOENT; + } + + err = conflict_check_and_replace(id, keys); + } + + if (err) { + LOG_ERR("Failed to update resolving list for id %u addr %s (err %d)", id, + peer ? bt_addr_le_str(peer) : "NULL", err); + return err; + } + + return err; +} #endif /* defined(CONFIG_BT_SMP) */ void bt_id_get(bt_addr_le_t *addrs, size_t *count) diff --git a/subsys/bluetooth/host/id.h b/subsys/bluetooth/host/id.h index 8824d3bb496b..cd66784a5037 100644 --- a/subsys/bluetooth/host/id.h +++ b/subsys/bluetooth/host/id.h @@ -60,3 +60,26 @@ void bt_id_pending_keys_update(void); void bt_id_pending_keys_update_set(struct bt_keys *keys, uint8_t flag); void bt_id_adv_limited_stopped(struct bt_le_ext_adv *adv); + +/** + * @brief Check and update the resolving list for a given identity. + * + * This function checks if the resolving list contains the keys for the given + * identity and peer address. If the keys are not present, it adds them to the + * resolving list. If the keys are present, it checks for conflicts with + * existing keys in the resolving list. If a conflict is found, it replaces + * the conflicting key with the new key. + * + * If the peer address is NULL, it updates the resolving list for all keys that belong to the given + * identity. + * + * If for any of the keys belonging to the given identity a conflict is found and the advertiser for + * that key is enabled, the function returns an error. + * + * @param id The identity ID to check and update. + * @param peer The peer address to check against the resolving list. + * + * @return 0 on success, or a negative error code on failure. + * @return -EPERM if a conflict is found and the advertiser for the conflicting key is enabled. + */ +int bt_id_resolving_list_check_and_update(uint8_t id, const bt_addr_le_t *peer); diff --git a/subsys/bluetooth/host/keys.c b/subsys/bluetooth/host/keys.c index 6341fc1e58e8..4ae1d5b7a96a 100644 --- a/subsys/bluetooth/host/keys.c +++ b/subsys/bluetooth/host/keys.c @@ -310,16 +310,57 @@ void bt_keys_add_type(struct bt_keys *keys, enum bt_keys_type type) keys->keys |= type; } +static void add_id_cb(struct k_work *work) +{ + bt_id_pending_keys_update(); +} + +static K_WORK_DEFINE(add_id_work, add_id_cb); + void bt_keys_clear(struct bt_keys *keys) { + struct bt_keys *conflict = NULL; + __ASSERT_NO_MSG(keys != NULL); LOG_DBG("%s (keys 0x%04x)", bt_addr_le_str(&keys->addr), keys->keys); + if (IS_ENABLED(CONFIG_BT_ID_AUTO_SWAP_MATCHING_BONDS) && + (keys->flags & BT_KEYS_ID_CONFLICT) != 0) { + /* We need to check how many conflicting keys left. If there is only one conflicting + * key left, we can remove the BT_KEYS_ID_CONFLICT flag from it so that Host don't + * need to check and update the Resolving List whenever this is needed. The key + * should be re-added to the Resolving List. + */ + bool found_multiple; + + found_multiple = bt_id_find_conflict_multiple(keys, &conflict); + if (conflict) { + if (found_multiple || (conflict->state & BT_KEYS_ID_ADDED) != 0) { + /* If we found multiple conflicting keys or the conflicting key + * is already added to the ID list, we don't need to clear the + * conflict flag for it and re-add it to the Resolving List. + */ + conflict = NULL; + } else { + /* Clear the conflict flag for the conflicting key */ + conflict->flags &= ~BT_KEYS_ID_CONFLICT; + } + } + } + if (keys->state & BT_KEYS_ID_ADDED) { bt_id_del(keys); } + if (conflict) { + /* Re-add the conflicting key to the Resolving List if it was the last conflicting + * key. + */ + bt_id_pending_keys_update_set(conflict, BT_KEYS_ID_PENDING_ADD); + k_work_submit(&add_id_work); + } + if (IS_ENABLED(CONFIG_BT_SETTINGS)) { /* Delete stored keys from flash */ bt_settings_delete_keys(keys->id, &keys->addr); @@ -347,6 +388,28 @@ int bt_keys_store(struct bt_keys *keys) return 0; } +static void check_and_set_id_conflict_flag(struct bt_keys *keys) +{ + struct bt_keys *conflict; + + if (!IS_ENABLED(CONFIG_BT_ID_AUTO_SWAP_MATCHING_BONDS)) { + /* If auto-swap is not enabled, we don't need to check for conflicts */ + return; + } + + /* Use bt_id_find_conflict() to check if there are any conflicting keys for the given keys. + * If there is at least one, set the BT_KEYS_ID_CONFLICT flag for both the keys and the + * conflicting key. + */ + conflict = bt_id_find_conflict(keys, true); + if (conflict != NULL) { + LOG_DBG("Found conflicting key %p.", conflict); + + keys->flags |= BT_KEYS_ID_CONFLICT; + conflict->flags |= BT_KEYS_ID_CONFLICT; + } +} + static int keys_set(const char *name, size_t len_rd, settings_read_cb read_cb, void *cb_arg) { @@ -427,6 +490,8 @@ static int keys_set(const char *name, size_t len_rd, settings_read_cb read_cb, memcpy(keys->storage_start, val, len); } + check_and_set_id_conflict_flag(keys); + LOG_DBG("Successfully restored keys for %s", bt_addr_le_str(&addr)); #if defined(CONFIG_BT_KEYS_OVERWRITE_OLDEST) if (aging_counter_val < keys->aging_counter) { @@ -436,17 +501,17 @@ static int keys_set(const char *name, size_t len_rd, settings_read_cb read_cb, return 0; } -static void add_id_cb(struct k_work *work) -{ - bt_id_pending_keys_update(); -} - -static K_WORK_DEFINE(add_id_work, add_id_cb); - static void id_add(struct bt_keys *keys, void *user_data) { __ASSERT_NO_MSG(keys != NULL); + if (keys->flags & BT_KEYS_ID_CONFLICT) { + /* If the keys have the conflict flag set, we don't want to add them to the ID list, + * as this will cause issues with resolving list. + */ + return; + } + bt_id_pending_keys_update_set(keys, BT_KEYS_ID_PENDING_ADD); k_work_submit(&add_id_work); } diff --git a/subsys/bluetooth/host/keys.h b/subsys/bluetooth/host/keys.h index b53635ce2c56..185fd610e779 100644 --- a/subsys/bluetooth/host/keys.h +++ b/subsys/bluetooth/host/keys.h @@ -45,6 +45,12 @@ enum { /* Bit 2 and 3 might accidentally exist in old stored keys */ BT_KEYS_SC = BIT(4), BT_KEYS_OOB = BIT(5), + /** Indicates that the keys are in conflict with existing keys. + * + * This is used to indicate that the keys being added conflict with + * existing keys from different identity. + */ + BT_KEYS_ID_CONFLICT = BIT(6), }; struct bt_ltk { diff --git a/subsys/bluetooth/host/smp.c b/subsys/bluetooth/host/smp.c index 3c4fc29fe243..916bb661bb98 100644 --- a/subsys/bluetooth/host/smp.c +++ b/subsys/bluetooth/host/smp.c @@ -909,7 +909,7 @@ static void smp_br_id_add_replace(struct bt_keys *keys) bt_id_del(keys); } - conflict = bt_id_find_conflict(keys); + conflict = bt_id_find_conflict(keys, false); if (conflict != NULL) { int err; @@ -919,7 +919,7 @@ static void smp_br_id_add_replace(struct bt_keys *keys) __ASSERT_NO_MSG(!err); } - __ASSERT_NO_MSG(!bt_id_find_conflict(keys)); + __ASSERT_NO_MSG(!bt_id_find_conflict(keys, false)); bt_id_add(keys); } @@ -4048,16 +4048,24 @@ static uint8_t smp_id_add_replace(struct bt_smp *smp, struct bt_keys *new_bond) */ __ASSERT_NO_MSG(!(smp->remote_dist & BT_SMP_DIST_ID_KEY)); - conflict = bt_id_find_conflict(new_bond); + conflict = bt_id_find_conflict(new_bond, IS_ENABLED(CONFIG_BT_ID_AUTO_SWAP_MATCHING_BONDS)); if (conflict) { LOG_DBG("New bond conflicts with a bond on id %d.", conflict->id); } - if (conflict && !IS_ENABLED(CONFIG_BT_ID_UNPAIR_MATCHING_BONDS)) { + if (conflict && !IS_ENABLED(CONFIG_BT_ID_AUTO_SWAP_MATCHING_BONDS) && + !IS_ENABLED(CONFIG_BT_ID_UNPAIR_MATCHING_BONDS)) { LOG_WRN("Refusing new pairing. The old bond must be unpaired first."); return BT_SMP_ERR_AUTH_REQUIREMENTS; } + if (conflict && IS_ENABLED(CONFIG_BT_ID_AUTO_SWAP_MATCHING_BONDS)) { + LOG_WRN("Conflict detected with %p. Don't add key to Resolve List.", conflict); + new_bond->flags |= BT_KEYS_ID_CONFLICT; + conflict->flags |= BT_KEYS_ID_CONFLICT; + return 0; + } + if (conflict && IS_ENABLED(CONFIG_BT_ID_UNPAIR_MATCHING_BONDS)) { bool trust_ok; int unpair_err; @@ -4074,7 +4082,7 @@ static uint8_t smp_id_add_replace(struct bt_smp *smp, struct bt_keys *new_bond) __ASSERT_NO_MSG(!unpair_err); } - __ASSERT_NO_MSG(!bt_id_find_conflict(new_bond)); + __ASSERT_NO_MSG(!bt_id_find_conflict(new_bond, false)); bt_id_add(new_bond); return 0; } diff --git a/tests/bluetooth/host/id/mocks/adv.c b/tests/bluetooth/host/id/mocks/adv.c index 2c2d4f3f3c7a..a22123dea3da 100644 --- a/tests/bluetooth/host/id/mocks/adv.c +++ b/tests/bluetooth/host/id/mocks/adv.c @@ -15,3 +15,4 @@ DEFINE_FAKE_VALUE_FUNC(int, bt_le_adv_set_enable_legacy, struct bt_le_ext_adv *, DEFINE_FAKE_VALUE_FUNC(int, bt_le_adv_set_enable_ext, struct bt_le_ext_adv *, bool, const struct bt_le_ext_adv_start_param *); DEFINE_FAKE_VOID_FUNC(bt_le_ext_adv_foreach, bt_le_ext_adv_foreach_cb, void *); +DEFINE_FAKE_VALUE_FUNC(struct bt_le_ext_adv *, bt_adv_lookup_by_id, uint8_t); diff --git a/tests/bluetooth/host/id/mocks/adv.h b/tests/bluetooth/host/id/mocks/adv.h index bfb744001596..1602ddf47185 100644 --- a/tests/bluetooth/host/id/mocks/adv.h +++ b/tests/bluetooth/host/id/mocks/adv.h @@ -18,7 +18,8 @@ typedef void (*bt_le_ext_adv_foreach_cb)(struct bt_le_ext_adv *adv, void *data); FAKE(bt_le_adv_lookup_legacy) \ FAKE(bt_le_ext_adv_get_index) \ FAKE(bt_le_adv_set_enable_ext) \ - FAKE(bt_le_ext_adv_foreach) + FAKE(bt_le_ext_adv_foreach) \ + FAKE(bt_adv_lookup_by_id) DECLARE_FAKE_VALUE_FUNC(int, bt_le_adv_set_enable, struct bt_le_ext_adv *, bool); DECLARE_FAKE_VALUE_FUNC(struct bt_le_ext_adv *, bt_le_adv_lookup_legacy); @@ -27,3 +28,4 @@ DECLARE_FAKE_VALUE_FUNC(int, bt_le_adv_set_enable_legacy, struct bt_le_ext_adv * DECLARE_FAKE_VALUE_FUNC(int, bt_le_adv_set_enable_ext, struct bt_le_ext_adv *, bool, const struct bt_le_ext_adv_start_param *); DECLARE_FAKE_VOID_FUNC(bt_le_ext_adv_foreach, bt_le_ext_adv_foreach_cb, void *); +DECLARE_FAKE_VALUE_FUNC(struct bt_le_ext_adv *, bt_adv_lookup_by_id, uint8_t); diff --git a/tests/bluetooth/host/id/mocks/keys.c b/tests/bluetooth/host/id/mocks/keys.c index f885ab875c0f..61f73569c469 100644 --- a/tests/bluetooth/host/id/mocks/keys.c +++ b/tests/bluetooth/host/id/mocks/keys.c @@ -10,3 +10,4 @@ DEFINE_FAKE_VALUE_FUNC(struct bt_keys *, bt_keys_find_irk, uint8_t, const bt_addr_le_t *); DEFINE_FAKE_VOID_FUNC(bt_keys_foreach_type, enum bt_keys_type, bt_keys_foreach_type_cb, void *); +DEFINE_FAKE_VALUE_FUNC(struct bt_keys *, bt_keys_get_addr, uint8_t, const bt_addr_le_t *); diff --git a/tests/bluetooth/host/id/mocks/keys.h b/tests/bluetooth/host/id/mocks/keys.h index b6901e315ab9..1912472b78de 100644 --- a/tests/bluetooth/host/id/mocks/keys.h +++ b/tests/bluetooth/host/id/mocks/keys.h @@ -15,7 +15,9 @@ typedef void (*bt_keys_foreach_type_cb)(struct bt_keys *keys, void *data); /* List of fakes used by this unit tester */ #define KEYS_FFF_FAKES_LIST(FAKE) \ FAKE(bt_keys_find_irk) \ - FAKE(bt_keys_foreach_type) + FAKE(bt_keys_foreach_type) \ + FAKE(bt_keys_get_addr) DECLARE_FAKE_VALUE_FUNC(struct bt_keys *, bt_keys_find_irk, uint8_t, const bt_addr_le_t *); DECLARE_FAKE_VOID_FUNC(bt_keys_foreach_type, enum bt_keys_type, bt_keys_foreach_type_cb, void *); +DECLARE_FAKE_VALUE_FUNC(struct bt_keys *, bt_keys_get_addr, uint8_t, const bt_addr_le_t *); From 91e50002e9f067dff6727639670c1719308e9a6a Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Thu, 12 Jun 2025 13:09:23 +0200 Subject: [PATCH 0562/2141] [nrf noup] boards: nrf54h20dk: Enable default images for sysbuild Enable the `empty_app_core` image when building for `cpurad`. Signed-off-by: Grzegorz Swiderski (cherry picked from commit 2ea472de16fa9ac3e75587f8aabaa4909d9619bc) --- boards/nordic/nrf54h20dk/Kconfig.sysbuild | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 boards/nordic/nrf54h20dk/Kconfig.sysbuild diff --git a/boards/nordic/nrf54h20dk/Kconfig.sysbuild b/boards/nordic/nrf54h20dk/Kconfig.sysbuild new file mode 100644 index 000000000000..29bd62b49927 --- /dev/null +++ b/boards/nordic/nrf54h20dk/Kconfig.sysbuild @@ -0,0 +1,9 @@ +# Copyright (c) 2025 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +if BOARD_NRF54H20DK_NRF54H20_CPURAD + +config NRF_DEFAULT_EMPTY + default y + +endif # BOARD_NRF54H20DK_NRF54H20_CPURAD From f8d62960ff1247572cc783278a6fd42900e8621a Mon Sep 17 00:00:00 2001 From: Aleksandar Stanoev Date: Thu, 3 Jul 2025 15:37:01 +0100 Subject: [PATCH 0563/2141] [nrf noup] boards: xiao_ble: Add static partition manager configuration The xiao_ble boards ship with a bootloader requiring an app offset of 0x27000. The upstream board defines this via DT partitions, which will not be used if partition manager is enabled. Add a static partition configuration to allow binaries built for this board to work out-of-the-box in NCS, and match the behavior with sysbuild disabled. Signed-off-by: Aleksandar Stanoev (cherry picked from commit 6c9cf79754dde49993f59a2aabe334b3cc152683) --- boards/seeed/xiao_ble/pm_static.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 boards/seeed/xiao_ble/pm_static.yml diff --git a/boards/seeed/xiao_ble/pm_static.yml b/boards/seeed/xiao_ble/pm_static.yml new file mode 100644 index 000000000000..02915293177c --- /dev/null +++ b/boards/seeed/xiao_ble/pm_static.yml @@ -0,0 +1,18 @@ +# Mirror of partitions defined in nrf52840_partition_uf2_sdv7.dtsi +# Default flash layout for nrf52840 using UF2 and SoftDevice s140 v7 + +softdevice_reserved: + address: 0x00 + size: 0x27000 + +app: + address: 0x27000 + size: 0xC5000 + +settings_storage: + address: 0xEC000 + size: 0x8000 + +uf2_partition: + address: 0xF4000 + size: 0xC000 From 3290b8b98587cafc91c483cdd217a40f9c51bad0 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Fri, 4 Jul 2025 14:38:28 +0200 Subject: [PATCH 0564/2141] [nrf noup] modem: backend: uart: SLM optimized modem UART backend This noup does the following: - Adds the modem_backend_uart_slm modem backend which is optimized for UART communication to SLM. The noup is intended to live until upstream zephyr has proper consistent RTS/CTS flow control support across multiple drivers, and DTR, RTS and CTS support has been added to the upstream modem UART backends, and lastly, SLM has been updated to use DTR, so everything is in sync. Ask Bjarki Arge Andreasen, Markus Lassila or Seppo Takalo when this noup is to be altered as part of an upmerge for example. Signed-off-by: Bjarki Arge Andreasen Signed-off-by: Markus Lassila (cherry picked from commit 964736df4b123d94117477fd05337f999b025026) --- include/zephyr/modem/backend/uart_slm.h | 61 +++ subsys/modem/backends/CMakeLists.txt | 1 + subsys/modem/backends/Kconfig | 23 + .../modem/backends/modem_backend_uart_slm.c | 514 ++++++++++++++++++ 4 files changed, 599 insertions(+) create mode 100644 include/zephyr/modem/backend/uart_slm.h create mode 100644 subsys/modem/backends/modem_backend_uart_slm.c diff --git a/include/zephyr/modem/backend/uart_slm.h b/include/zephyr/modem/backend/uart_slm.h new file mode 100644 index 000000000000..e522c6cf791e --- /dev/null +++ b/include/zephyr/modem/backend/uart_slm.h @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include + +#ifndef ZEPHYR_MODEM_BACKEND_UART_SLM_ +#define ZEPHYR_MODEM_BACKEND_UART_SLM_ + +#ifdef __cplusplus +extern "C" { +#endif + +struct slm_rx_queue_event { + uint8_t *buf; + size_t len; +}; + +struct modem_backend_uart_slm { + const struct device *uart; + struct modem_pipe pipe; + struct k_work_delayable receive_ready_work; + struct k_work transmit_idle_work; + +#ifdef CONFIG_MODEM_STATS + struct modem_stats_buffer receive_buf_stats; + struct modem_stats_buffer transmit_buf_stats; +#endif + struct ring_buf transmit_rb; + struct k_work rx_disabled_work; + atomic_t state; + + struct k_mem_slab rx_slab; + struct k_msgq rx_queue; + struct slm_rx_queue_event rx_event; + struct slm_rx_queue_event rx_queue_buf[CONFIG_MODEM_BACKEND_UART_SLM_BUFFER_COUNT]; + uint32_t rx_buf_size; + uint8_t rx_buf_count; +}; + +struct modem_backend_uart_slm_config { + const struct device *uart; + uint8_t *receive_buf; /* Address must be word-aligned. */ + uint32_t receive_buf_size; + uint8_t *transmit_buf; + uint32_t transmit_buf_size; +}; + +struct modem_pipe *modem_backend_uart_slm_init(struct modem_backend_uart_slm *backend, + const struct modem_backend_uart_slm_config *config); + +#ifdef __cplusplus +} +#endif + +#endif /* ZEPHYR_MODEM_BACKEND_UART_SLM_ */ diff --git a/subsys/modem/backends/CMakeLists.txt b/subsys/modem/backends/CMakeLists.txt index e2247a8a09dd..787697a84e18 100644 --- a/subsys/modem/backends/CMakeLists.txt +++ b/subsys/modem/backends/CMakeLists.txt @@ -10,3 +10,4 @@ if(CONFIG_MODEM_BACKEND_UART_ASYNC) zephyr_library_sources_ifdef(CONFIG_MODEM_BACKEND_UART_ASYNC_HWFC modem_backend_uart_async_hwfc.c) zephyr_library_sources_ifndef(CONFIG_MODEM_BACKEND_UART_ASYNC_HWFC modem_backend_uart_async.c) endif() +zephyr_library_sources_ifdef(CONFIG_MODEM_BACKEND_UART_SLM modem_backend_uart_slm.c) diff --git a/subsys/modem/backends/Kconfig b/subsys/modem/backends/Kconfig index 2ce81c6dce11..5f8d804ed35c 100644 --- a/subsys/modem/backends/Kconfig +++ b/subsys/modem/backends/Kconfig @@ -64,3 +64,26 @@ endif # MODEM_BACKEND_UART_ASYNC_HWFC endif # MODEM_BACKEND_UART_ASYNC endif # MODEM_BACKEND_UART + +config MODEM_BACKEND_UART_SLM + bool "SLM-optimized modem UART backend" + select MODEM_PIPE + select RING_BUFFER + depends on UART_ASYNC_API + +if MODEM_BACKEND_UART_SLM + +config MODEM_BACKEND_UART_SLM_BUFFER_COUNT + int "SLM modem UART backend buffer count" + range 2 4 + default 3 + +config MODEM_BACKEND_UART_SLM_TRANSMIT_TIMEOUT_MS + int "SLM modem UART transmit timeout in milliseconds" + default 1000 + +config MODEM_BACKEND_UART_SLM_RECEIVE_IDLE_TIMEOUT_MS + int "SLM modem UART receive idle timeout in milliseconds" + default 30 + +endif # MODEM_BACKEND_UART_SLM diff --git a/subsys/modem/backends/modem_backend_uart_slm.c b/subsys/modem/backends/modem_backend_uart_slm.c new file mode 100644 index 000000000000..f1aa1b0bb402 --- /dev/null +++ b/subsys/modem/backends/modem_backend_uart_slm.c @@ -0,0 +1,514 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +#include +LOG_MODULE_REGISTER(modem_backend_uart_slm, CONFIG_MODEM_MODULES_LOG_LEVEL); + +#include +#include +#include + +struct rx_buf_t { + atomic_t ref_counter; + uint8_t buf[]; +}; + +static inline struct rx_buf_t *block_start_get(struct modem_backend_uart_slm *backend, uint8_t *buf) +{ + size_t block_num; + + /* Find the correct block. */ + block_num = (((size_t)buf - sizeof(struct rx_buf_t) - (size_t)backend->rx_slab.buffer) / + backend->rx_buf_size); + + return (struct rx_buf_t *)&backend->rx_slab.buffer[block_num * backend->rx_buf_size]; +} + +static struct rx_buf_t *rx_buf_alloc(struct modem_backend_uart_slm *backend) +{ + struct rx_buf_t *buf; + + if (k_mem_slab_alloc(&backend->rx_slab, (void **)&buf, K_NO_WAIT)) { + return NULL; + } + atomic_set(&buf->ref_counter, 1); + + return buf; +} + +static void rx_buf_ref(struct modem_backend_uart_slm *backend, void *buf) +{ + atomic_inc(&(block_start_get(backend, buf)->ref_counter)); +} + +static void rx_buf_unref(struct modem_backend_uart_slm *backend, void *buf) +{ + struct rx_buf_t *uart_buf = block_start_get(backend, buf); + atomic_t ref_counter = atomic_dec(&uart_buf->ref_counter); + + if (ref_counter == 1) { + k_mem_slab_free(&backend->rx_slab, (void *)uart_buf); + } +} + +enum { + MODEM_BACKEND_UART_SLM_STATE_OPEN_BIT, + MODEM_BACKEND_UART_SLM_STATE_TRANSMIT_BIT, + MODEM_BACKEND_UART_SLM_STATE_RECOVERY_BIT, +}; + +static int modem_backend_uart_slm_rx_enable(struct modem_backend_uart_slm *backend) +{ + int ret; + struct rx_buf_t *buf = rx_buf_alloc(backend); + + if (!buf) { + return -ENOMEM; + } + + ret = uart_rx_enable(backend->uart, buf->buf, + backend->rx_buf_size - sizeof(struct rx_buf_t), + CONFIG_MODEM_BACKEND_UART_SLM_RECEIVE_IDLE_TIMEOUT_MS * 1000); + if (ret) { + rx_buf_unref(backend, buf->buf); + return ret; + } + + return 0; +} + +static void modem_backend_uart_slm_rx_recovery(struct modem_backend_uart_slm *backend) +{ + int err; + + if (!atomic_test_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_RECOVERY_BIT)) { + return; + } + + err = modem_backend_uart_slm_rx_enable(backend); + if (err) { + LOG_DBG("RX recovery failed: %d", err); + return; + } + + if (!atomic_test_and_clear_bit(&backend->state, + MODEM_BACKEND_UART_SLM_STATE_RECOVERY_BIT)) { + /* Closed during recovery. */ + uart_rx_disable(backend->uart); + } else { + LOG_DBG("RX recovery success"); + } +} + +static bool modem_backend_uart_slm_is_uart_stopped(const struct modem_backend_uart_slm *backend) +{ + if (!atomic_test_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_OPEN_BIT) && + !atomic_test_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_RECOVERY_BIT) && + !atomic_test_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_TRANSMIT_BIT)) { + return true; + } + + return false; +} + +static bool modem_backend_uart_slm_is_open(const struct modem_backend_uart_slm *backend) +{ + return atomic_test_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_OPEN_BIT); +} + +static void modem_backend_uart_slm_event_handler(const struct device *dev, struct uart_event *evt, + void *user_data) +{ + struct modem_backend_uart_slm *backend = (struct modem_backend_uart_slm *)user_data; + struct slm_rx_queue_event rx_event; + int err; + + switch (evt->type) { + case UART_TX_DONE: + ring_buf_get_finish(&backend->transmit_rb, evt->data.tx.len); + atomic_clear_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_TRANSMIT_BIT); + k_work_submit(&backend->transmit_idle_work); + break; + + case UART_TX_ABORTED: + ring_buf_get_finish(&backend->transmit_rb, evt->data.tx.len); + if (!modem_backend_uart_slm_is_open(backend)) { + /* When we are closing, send the remaining data after re-open. */ + atomic_clear_bit(&backend->state, + MODEM_BACKEND_UART_SLM_STATE_TRANSMIT_BIT); + break; + } + if (evt->data.tx.len != 0) { + /* If we were able to send some data, attempt to send the remaining + * data before releasing the transmit bit. + */ + uint8_t *buf; + size_t bytes_to_transmit = + ring_buf_get_claim(&backend->transmit_rb, &buf, + ring_buf_capacity_get(&backend->transmit_rb)); + + err = uart_tx(backend->uart, buf, bytes_to_transmit, + CONFIG_MODEM_BACKEND_UART_SLM_TRANSMIT_TIMEOUT_MS * 1000L); + if (err) { + LOG_ERR("Failed to %s %u bytes. (%d)", "start async transmit for", + bytes_to_transmit, err); + atomic_clear_bit(&backend->state, + MODEM_BACKEND_UART_SLM_STATE_TRANSMIT_BIT); + } + break; + } + + /* We were not able to send anything. Start dropping data. */ + LOG_ERR("Transmit aborted (%u bytes dropped)", + ring_buf_size_get(&backend->transmit_rb)); + atomic_clear_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_TRANSMIT_BIT); + k_work_submit(&backend->transmit_idle_work); + break; + + case UART_RX_BUF_REQUEST: + struct rx_buf_t *buf = rx_buf_alloc(backend); + + if (!buf) { + LOG_DBG("No receive buffer, disabling RX"); + break; + } + err = uart_rx_buf_rsp(backend->uart, buf->buf, + backend->rx_buf_size - sizeof(struct rx_buf_t)); + if (err) { + LOG_ERR("uart_rx_buf_rsp: %d", err); + rx_buf_unref(backend, buf->buf); + } + break; + + case UART_RX_BUF_RELEASED: + if (evt->data.rx_buf.buf) { + rx_buf_unref(backend, evt->data.rx_buf.buf); + } + break; + + case UART_RX_RDY: + if (evt->data.rx.buf) { + rx_buf_ref(backend, evt->data.rx.buf); + rx_event.buf = &evt->data.rx.buf[evt->data.rx.offset]; + rx_event.len = evt->data.rx.len; + err = k_msgq_put(&backend->rx_queue, &rx_event, K_NO_WAIT); + if (err) { + LOG_WRN("RX queue overflow: %d (dropped %u)", err, + evt->data.rx.len); + rx_buf_unref(backend, evt->data.rx.buf); + break; + } + k_work_schedule(&backend->receive_ready_work, K_NO_WAIT); + } + break; + + case UART_RX_DISABLED: + if (atomic_test_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_OPEN_BIT)) { + if (!atomic_test_and_set_bit(&backend->state, + MODEM_BACKEND_UART_SLM_STATE_RECOVERY_BIT)) { + k_work_schedule(&backend->receive_ready_work, K_NO_WAIT); + LOG_DBG("RX recovery started"); + } + } + break; + + case UART_RX_STOPPED: + LOG_WRN("Receive stopped for reasons: %u", (uint8_t)evt->data.rx_stop.reason); + break; + + default: + break; + } + + if (modem_backend_uart_slm_is_uart_stopped(backend)) { + k_work_submit(&backend->rx_disabled_work); + } +} + +static int modem_backend_uart_slm_open(void *data) +{ + struct modem_backend_uart_slm *backend = (struct modem_backend_uart_slm *)data; + struct rx_buf_t *rx_buf = rx_buf_alloc(backend); + int ret; + + if (!rx_buf) { + return -ENOMEM; + } + + atomic_clear(&backend->state); + atomic_set_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_TRANSMIT_BIT); + atomic_set_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_OPEN_BIT); + + if (!ring_buf_is_empty(&backend->transmit_rb)) { + /* Transmit was aborted due to modem_backend_uart_slm_close. + * Send the remaining data before allowing further transmits. + */ + uint8_t *tx_buf; + const uint32_t tx_buf_size = ring_buf_get_claim( + &backend->transmit_rb, &tx_buf, ring_buf_size_get(&backend->transmit_rb)); + + ret = uart_tx(backend->uart, tx_buf, tx_buf_size, + CONFIG_MODEM_BACKEND_UART_SLM_TRANSMIT_TIMEOUT_MS * 1000L); + if (ret) { + LOG_ERR("Failed to %s %u bytes. (%d)", "start async transmit for", + tx_buf_size, ret); + atomic_clear_bit(&backend->state, + MODEM_BACKEND_UART_SLM_STATE_TRANSMIT_BIT); + } + } else { + /* Previous transmit was not aborted. */ + atomic_clear_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_TRANSMIT_BIT); + } + + ret = uart_rx_enable(backend->uart, rx_buf->buf, + backend->rx_buf_size - sizeof(struct rx_buf_t), + CONFIG_MODEM_BACKEND_UART_SLM_RECEIVE_IDLE_TIMEOUT_MS * 1000L); + if (ret < 0) { + rx_buf_unref(backend, rx_buf->buf); + atomic_clear_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_OPEN_BIT); + return ret; + } + + modem_pipe_notify_opened(&backend->pipe); + return 0; +} + +#ifdef CONFIG_MODEM_STATS +static uint32_t get_transmit_buf_size(const struct modem_backend_uart_slm *backend) +{ + return ring_buf_capacity_get(&backend->transmit_rb); +} + +static uint32_t get_receive_buf_size(struct modem_backend_uart_slm *backend) +{ + return (backend->rx_buf_size - sizeof(struct rx_buf_t)) * backend->rx_buf_count; +} + +static void advertise_transmit_buf_stats(struct modem_backend_uart_slm *backend, uint32_t length) +{ + modem_stats_buffer_advertise_length(&backend->transmit_buf_stats, length); +} + +static void advertise_receive_buf_stats(struct modem_backend_uart_slm *backend, uint32_t reserved) +{ + modem_stats_buffer_advertise_length(&backend->receive_buf_stats, reserved); +} +#endif + +static int modem_backend_uart_slm_transmit(void *data, const uint8_t *buf, size_t size) +{ + struct modem_backend_uart_slm *backend = (struct modem_backend_uart_slm *)data; + bool transmitting; + uint32_t bytes_to_transmit; + int ret; + uint8_t *tx_buf; + + if (!modem_backend_uart_slm_is_open(backend)) { + return -EPERM; + } + + transmitting = + atomic_test_and_set_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_TRANSMIT_BIT); + if (transmitting) { + return 0; + } + + /* Copy buf to transmit ring buffer which is passed to UART. */ + ring_buf_reset(&backend->transmit_rb); + ring_buf_put(&backend->transmit_rb, buf, size); + bytes_to_transmit = ring_buf_get_claim(&backend->transmit_rb, &tx_buf, size); + + ret = uart_tx(backend->uart, tx_buf, bytes_to_transmit, + CONFIG_MODEM_BACKEND_UART_SLM_TRANSMIT_TIMEOUT_MS * 1000L); + +#ifdef CONFIG_MODEM_STATS + advertise_transmit_buf_stats(backend, bytes_to_transmit); +#endif + + if (ret != 0) { + LOG_ERR("Failed to %s %u bytes. (%d)", "start async transmit for", + bytes_to_transmit, ret); + atomic_clear_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_TRANSMIT_BIT); + + return ret; + } + + return (int)bytes_to_transmit; +} + +static int modem_backend_uart_slm_receive(void *data, uint8_t *buf, size_t size) +{ + struct modem_backend_uart_slm *backend = (struct modem_backend_uart_slm *)data; + size_t received = 0; + size_t copy_size = 0; + +#ifdef CONFIG_MODEM_STATS + struct slm_rx_queue_event rx_event; + size_t reserved = backend->rx_event.len; + + for (int i = 0; i < k_msgq_num_used_get(&backend->rx_queue); i++) { + if (k_msgq_peek_at(&backend->rx_queue, &rx_event, i)) { + break; + } + reserved += rx_event.len; + } + advertise_receive_buf_stats(backend, reserved); +#endif + while (size > received) { + /* Keeping track of the rx_event allows us to receive less than what the event + * indicates. + */ + if (backend->rx_event.len == 0) { + if (k_msgq_get(&backend->rx_queue, &backend->rx_event, K_NO_WAIT)) { + break; + } + } + copy_size = MIN(size - received, backend->rx_event.len); + memcpy(buf, backend->rx_event.buf, copy_size); + buf += copy_size; + received += copy_size; + backend->rx_event.buf += copy_size; + backend->rx_event.len -= copy_size; + + if (backend->rx_event.len == 0) { + rx_buf_unref(backend, backend->rx_event.buf); + } + } + + if (backend->rx_event.len != 0 || k_msgq_num_used_get(&backend->rx_queue) != 0) { + k_work_schedule(&backend->receive_ready_work, K_NO_WAIT); + } + + modem_backend_uart_slm_rx_recovery(backend); + + return (int)received; +} + +static int modem_backend_uart_slm_close(void *data) +{ + struct modem_backend_uart_slm *backend = (struct modem_backend_uart_slm *)data; + + atomic_clear_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_OPEN_BIT); + uart_tx_abort(backend->uart); + + if (!atomic_test_and_clear_bit(&backend->state, + MODEM_BACKEND_UART_SLM_STATE_RECOVERY_BIT)) { + /* Disable the RX, if recovery is not ongoing. */ + uart_rx_disable(backend->uart); + } + + return 0; +} + +static void modem_backend_uart_slm_receive_ready_handler(struct k_work *item) +{ + struct modem_backend_uart_slm *backend = + CONTAINER_OF(k_work_delayable_from_work(item), struct modem_backend_uart_slm, + receive_ready_work); + + modem_pipe_notify_receive_ready(&backend->pipe); +} + +static void modem_backend_uart_slm_transmit_idle_handler(struct k_work *item) +{ + struct modem_backend_uart_slm *backend = + CONTAINER_OF(item, struct modem_backend_uart_slm, transmit_idle_work); + + modem_pipe_notify_transmit_idle(&backend->pipe); +} + +static void modem_backend_uart_slm_notify_closed(struct k_work *item) +{ + + struct modem_backend_uart_slm *backend = + CONTAINER_OF(item, struct modem_backend_uart_slm, rx_disabled_work); + + modem_pipe_notify_closed(&backend->pipe); +} + +#ifdef CONFIG_MODEM_STATS +static void init_stats(struct modem_backend_uart_slm *backend) +{ + char name[CONFIG_MODEM_STATS_BUFFER_NAME_SIZE]; + uint32_t receive_buf_size; + uint32_t transmit_buf_size; + + receive_buf_size = get_receive_buf_size(backend); + transmit_buf_size = get_transmit_buf_size(backend); + + snprintk(name, sizeof(name), "%s_%s", backend->uart->name, "rx"); + modem_stats_buffer_init(&backend->receive_buf_stats, name, receive_buf_size); + snprintk(name, sizeof(name), "%s_%s", backend->uart->name, "tx"); + modem_stats_buffer_init(&backend->transmit_buf_stats, name, transmit_buf_size); +} +#endif + +static const struct modem_pipe_api modem_backend_uart_slm_api = { + .open = modem_backend_uart_slm_open, + .transmit = modem_backend_uart_slm_transmit, + .receive = modem_backend_uart_slm_receive, + .close = modem_backend_uart_slm_close, +}; + +struct modem_pipe *modem_backend_uart_slm_init(struct modem_backend_uart_slm *backend, + const struct modem_backend_uart_slm_config *config) +{ + int err; + + __ASSERT_NO_MSG(config->uart != NULL); + __ASSERT_NO_MSG(config->receive_buf != NULL); + __ASSERT_NO_MSG(config->receive_buf_size > 1); + __ASSERT_NO_MSG((config->receive_buf_size % 2) == 0); + __ASSERT_NO_MSG(config->transmit_buf != NULL); + __ASSERT_NO_MSG(config->transmit_buf_size > 0); + + memset(backend, 0x00, sizeof(*backend)); + backend->uart = config->uart; + k_work_init_delayable(&backend->receive_ready_work, + modem_backend_uart_slm_receive_ready_handler); + k_work_init(&backend->transmit_idle_work, modem_backend_uart_slm_transmit_idle_handler); + k_work_init(&backend->rx_disabled_work, modem_backend_uart_slm_notify_closed); + + err = uart_callback_set(backend->uart, modem_backend_uart_slm_event_handler, backend); + if (err) { + LOG_ERR("uart_callback_set failed. (%d)", err); + return NULL; + } + + int32_t buf_size = (int32_t)config->receive_buf_size; + + backend->rx_buf_count = CONFIG_MODEM_BACKEND_UART_SLM_BUFFER_COUNT; + + /* k_mem_slab_init requires a word-aligned buffer. */ + __ASSERT((uintptr_t)config->receive_buf % sizeof(void *) == 0, + "Receive buffer is not word-aligned"); + + /* Make sure all the buffers will be aligned. */ + buf_size -= (config->receive_buf_size % (sizeof(uint32_t) * backend->rx_buf_count)); + backend->rx_buf_size = buf_size / backend->rx_buf_count; + __ASSERT_NO_MSG(backend->rx_buf_size > sizeof(struct rx_buf_t)); + + /* Initialize the RX buffers and event queue. */ + err = k_mem_slab_init(&backend->rx_slab, config->receive_buf, backend->rx_buf_size, + backend->rx_buf_count); + if (err) { + LOG_ERR("k_mem_slab_init failed. (%d)", err); + return NULL; + } + k_msgq_init(&backend->rx_queue, (char *)backend->rx_queue_buf, + sizeof(struct slm_rx_queue_event), CONFIG_MODEM_BACKEND_UART_SLM_BUFFER_COUNT); + + ring_buf_init(&backend->transmit_rb, config->transmit_buf_size, config->transmit_buf); + + modem_pipe_init(&backend->pipe, backend, &modem_backend_uart_slm_api); + +#ifdef CONFIG_MODEM_STATS + init_stats(backend); +#endif + return &backend->pipe; +} From cd135b25e4e48e649c8fdfa97abee3989c5300f6 Mon Sep 17 00:00:00 2001 From: Mateusz Michalek Date: Mon, 14 Jul 2025 10:13:32 +0200 Subject: [PATCH 0565/2141] [nrf noup] boards: nordic: nrf54lm20 adjust ROM_START_OFFSET adds kconfig that was probably skipped during migration. Signed-off-by: Mateusz Michalek (cherry picked from commit 81a2b95a7e78217ec0ec0173a0dc9bcc4447ea5e) --- boards/nordic/nrf54lm20dk/Kconfig.defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/boards/nordic/nrf54lm20dk/Kconfig.defconfig b/boards/nordic/nrf54lm20dk/Kconfig.defconfig index 266f0f7c13d4..2efb752c97be 100644 --- a/boards/nordic/nrf54lm20dk/Kconfig.defconfig +++ b/boards/nordic/nrf54lm20dk/Kconfig.defconfig @@ -4,6 +4,7 @@ if BOARD_NRF54LM20DK_NRF54LM20A_CPUAPP config ROM_START_OFFSET + default 0 if PARTITION_MANAGER_ENABLED default 0x800 if BOOTLOADER_MCUBOOT endif # BOARD_NRF54LM20DK_NRF54LM20A_CPUAPP From 1b7ccc6e935529a3a464097925b31d69a3a9f9f2 Mon Sep 17 00:00:00 2001 From: Krzysztof Szromek Date: Fri, 18 Jul 2025 08:05:27 +0200 Subject: [PATCH 0566/2141] [nrf noup] ci: update test_spec label for E2E DFU tests Ref: NCSDK-34052 Signed-off-by: Krzysztof Szromek (cherry picked from commit ddfd826ddeab60f5bb78ed75976ecb7856987859) --- .github/test-spec.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/.github/test-spec.yml b/.github/test-spec.yml index 5337249f7dab..76def875e0be 100644 --- a/.github/test-spec.yml +++ b/.github/test-spec.yml @@ -49,6 +49,33 @@ - "tests/subsys/dfu/**/*" - "tests/subsys/mgmt/mcumgr/**/*" +"CI-dfu-test": + - "boards/nordic/**/*" + - "drivers/bluetooth/**/*" + - "drivers/console/**/*" + - "drivers/flash/**/*" + - "drivers/mbox/**/*" + - "drivers/serial/**/*" + - "drivers/spi/**/*" + - "dts/arm/nordic/nrf54h*" + - "dts/common/nordic/*" + - "dts/riscv/nordic/nrf54h*" + - "include/dfu/**/*" + - "include/mgmt/mcumgr/**/*" + - "include/zephyr/**/*" + - "samples/subsys/mgmt/mcumgr/smp_svr/**/*" + - "scripts/west_commands/build.py" + - "scripts/west_commands/flash.py" + - "scripts/west_commands/runners/core.py" + - "scripts/west_commands/runners/nrf_common.py" + - "scripts/west_commands/runners/nrfutil.py" + - "soc/nordic/nrf54h/**/*" + - "subsys/bluetooth/**/*" + - "subsys/dfu/**/*" + - "subsys/logging/**/*" + - "subsys/mgmt/mcumgr/**/*" + - "subsys/tracing/**/*" + "CI-tfm-test": - "boards/nordic/nrf5340dk/**/*" - "boards/nordic/nrf9160dk/**/*" From 90daf74e59ef2ef4d6d385d39632fa9cd736c80a Mon Sep 17 00:00:00 2001 From: Marek Pieta Date: Fri, 14 Jun 2024 12:08:55 +0200 Subject: [PATCH 0567/2141] [nrf noup] bluetooth: conn: Allow for an extra ref in bt_l2cap_send_pdu Allow for an additional buffer reference if callback is provided. This can be used to extend lifetime of the net buffer until the data transmission is confirmed by ACK of the remote. Signed-off-by: Marek Pieta (cherry picked from commit 14c7424d97a0c7d9144e70cb2ca128ea7e2be8fb) --- subsys/bluetooth/host/conn.c | 17 ++++++++++++----- subsys/bluetooth/host/l2cap.c | 8 ++++++-- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/subsys/bluetooth/host/conn.c b/subsys/bluetooth/host/conn.c index 9e9f18c040a0..489792d3098b 100644 --- a/subsys/bluetooth/host/conn.c +++ b/subsys/bluetooth/host/conn.c @@ -702,12 +702,19 @@ static int send_buf(struct bt_conn *conn, struct net_buf *buf, uint16_t frag_len = MIN(conn_mtu(conn), len); - /* Check that buf->ref is 1 or 2. It would be 1 if this - * was the only reference (e.g. buf was removed - * from the conn tx_queue). It would be 2 if the - * tx_data_pull kept it on the tx_queue for segmentation. + /* Check that buf->ref is 1 or 2. It would be 1 if this was + * the only reference (e.g. buf was removed from the conn + * tx_queue). It would be 2 if the tx_data_pull kept it on + * the tx_queue for segmentation. + * + * Allow for an additional buffer reference if callback is + * provided. This can be used to extend lifetime of the net + * buffer until the data transmission is confirmed by ACK of + * the remote. */ - __ASSERT_NO_MSG((buf->ref == 1) || (buf->ref == 2)); + if (buf->ref > 2 + (cb ? 1 : 0)) { + __ASSERT_NO_MSG(false); + } /* The reference is always transferred to the frag, so when * the frag is destroyed, the parent reference is decremented. diff --git a/subsys/bluetooth/host/l2cap.c b/subsys/bluetooth/host/l2cap.c index ac6fc60dbad6..9fa5638d9617 100644 --- a/subsys/bluetooth/host/l2cap.c +++ b/subsys/bluetooth/host/l2cap.c @@ -729,13 +729,17 @@ int bt_l2cap_send_pdu(struct bt_l2cap_le_chan *le_chan, struct net_buf *pdu, return -ENOTCONN; } - if (pdu->ref != 1) { + /* Allow for an additional buffer reference if callback is provided. This can be used to + * extend lifetime of the net buffer until the data transmission is confirmed by ACK of the + * remote. + */ + if (pdu->ref > 1 + (cb ? 1 : 0)) { /* The host may alter the buf contents when fragmenting. Higher * layers cannot expect the buf contents to stay intact. Extra * refs suggests a silent data corruption would occur if not for * this error. */ - LOG_ERR("Expecting 1 ref, got %d", pdu->ref); + LOG_ERR("Expecting up to %d refs, got %d", cb ? 2 : 1, pdu->ref); return -EINVAL; } From cc098c6faa2fbcac2be22af3586102d17e81e5ea Mon Sep 17 00:00:00 2001 From: Marek Pieta Date: Wed, 7 Aug 2024 10:29:21 +0200 Subject: [PATCH 0568/2141] [nrf noup] bluetooth: conn: Skip buffer ref count check in send_buf If ATT sent callback is delayed until data transmission is done by BLE controller, the transmitted buffer may have an additional reference. The reference is used to extend lifetime of the net buffer until the data transmission is confirmed by ACK of the remote. send_buf function can be called multiple times, if buffer has to be fragmented over HCI. In that case, the callback is provided as an argument only for the last transmitted fragment. The `buf->ref == 1` check is skipped because it's impossible to properly validate number of references for the sent fragments if buffers may have the additional reference. Jira: NCSDK-28624 Signed-off-by: Marek Pieta (cherry picked from commit 2c09574cf5ad0625b9132e94e265dcc37fa8289a) --- subsys/bluetooth/host/conn.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/subsys/bluetooth/host/conn.c b/subsys/bluetooth/host/conn.c index 489792d3098b..a74a04295278 100644 --- a/subsys/bluetooth/host/conn.c +++ b/subsys/bluetooth/host/conn.c @@ -702,19 +702,27 @@ static int send_buf(struct bt_conn *conn, struct net_buf *buf, uint16_t frag_len = MIN(conn_mtu(conn), len); - /* Check that buf->ref is 1 or 2. It would be 1 if this was - * the only reference (e.g. buf was removed from the conn - * tx_queue). It would be 2 if the tx_data_pull kept it on - * the tx_queue for segmentation. + /* If ATT sent callback is delayed until data transmission + * is done by BLE controller, the transmitted buffer may + * have an additional reference. The reference is used to + * extend lifetime of the net buffer until the data + * transmission is confirmed by ACK of the remote. * - * Allow for an additional buffer reference if callback is - * provided. This can be used to extend lifetime of the net - * buffer until the data transmission is confirmed by ACK of - * the remote. + * send_buf function can be called multiple times, if buffer + * has to be fragmented over HCI. In that case, the callback + * is provided as an argument only for the last transmitted + * fragment. The `buf->ref == 1` (or 2) check is skipped + * because it's impossible to properly validate number of + * references for the sent fragments if buffers may have the + * additional reference. + * + * Otherwise, check that buf->ref is 1 or 2. It would be 1 + * if this was the only reference (e.g. buf was removed from + * the conn tx_queue). It would be 2 if the tx_data_pull + * kept it on the tx_queue for segmentation. */ - if (buf->ref > 2 + (cb ? 1 : 0)) { - __ASSERT_NO_MSG(false); - } + __ASSERT_NO_MSG(IS_ENABLED(CONFIG_BT_ATT_SENT_CB_AFTER_TX) || (buf->ref == 1) || + (buf->ref == 2)); /* The reference is always transferred to the frag, so when * the frag is destroyed, the parent reference is decremented. From 1b4e2efade1fa707bf264d4da17fa6b78e9d67fa Mon Sep 17 00:00:00 2001 From: Juha Ylinen Date: Fri, 19 Jan 2024 15:26:33 +0200 Subject: [PATCH 0569/2141] [nrf noup] samples: lwm2m_client: Add support for nRF91x Add support for nRF91x by providing overlay configuration file. Signed-off-by: Juha Ylinen Signed-off-by: Robert Lubos (cherry picked from commit bf5684e2a9137f68f222673451d59e0db123091e) --- samples/net/lwm2m_client/overlay-nrf91x.conf | 53 ++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 samples/net/lwm2m_client/overlay-nrf91x.conf diff --git a/samples/net/lwm2m_client/overlay-nrf91x.conf b/samples/net/lwm2m_client/overlay-nrf91x.conf new file mode 100644 index 000000000000..7b902178e078 --- /dev/null +++ b/samples/net/lwm2m_client/overlay-nrf91x.conf @@ -0,0 +1,53 @@ +# Configuration file for nRF91x +# This file is merged with prj.conf in the application folder, and options +# set here will take precedence if they are present in both files. + +# General +CONFIG_MAIN_STACK_SIZE=4096 + +CONFIG_NET_SOCKETS=y +CONFIG_NET_NATIVE=y +CONFIG_NET_SOCKETS_OFFLOAD=y + +CONFIG_NET_CONFIG_MY_IPV6_ADDR="" +CONFIG_NET_CONFIG_PEER_IPV6_ADDR="" +CONFIG_NET_CONFIG_MY_IPV4_ADDR="" +CONFIG_NET_CONFIG_MY_IPV4_GW="" + +CONFIG_NET_CONFIG_NEED_IPV6=n +CONFIG_NET_CONFIG_NEED_IPV4=n +CONFIG_NET_CONFIG_AUTO_INIT=n + +# Modem related configurations +CONFIG_NRF_MODEM_LIB_NET_IF=y +CONFIG_NRF_MODEM_LIB_NET_IF_AUTO_DOWN=n +CONFIG_NRF_MODEM_LIB_NET_IF_AUTO_CONNECT=n +CONFIG_NRF_MODEM_LIB_NET_IF_AUTO_START=n +CONFIG_NRF_MODEM_LIB_ON_FAULT_APPLICATION_SPECIFIC=y + +CONFIG_LTE_LINK_CONTROL_LOG_LEVEL_DBG=n +CONFIG_NRF_MODEM_LIB_NET_IF_LOG_LEVEL_DBG=n + +# Disable Duplicate Address Detection (DAD) +# due to not being properly implemented for offloaded interfaces. +CONFIG_NET_IPV6_NBR_CACHE=n +CONFIG_NET_IPV6_MLD=n + +# Zephyr NET Connection Manager and Connectivity layer. +CONFIG_NET_CONNECTION_MANAGER=y +CONFIG_NET_CONNECTION_MANAGER_MONITOR_STACK_SIZE=1024 + +CONFIG_NET_SAMPLE_LWM2M_ID="nrf91x" +CONFIG_NET_SAMPLE_LWM2M_SERVER="coaps://leshan.eclipseprojects.io:5684" +CONFIG_LWM2M_DNS_SUPPORT=y + +## Enable DTLS support +CONFIG_LWM2M_DTLS_SUPPORT=y +CONFIG_LWM2M_TLS_SESSION_CACHING=y +CONFIG_LWM2M_DTLS_CID=y +CONFIG_TLS_CREDENTIALS=y + +## Crypto +CONFIG_OBERON_BACKEND=y +CONFIG_NORDIC_SECURITY_BACKEND=y +CONFIG_MBEDTLS_SHA256_C=y From e606b2aaf5ebd69b03c5fd92c99d9ef1d9c7e96a Mon Sep 17 00:00:00 2001 From: Jonathan Nilsen Date: Tue, 22 Apr 2025 14:34:11 +0200 Subject: [PATCH 0570/2141] [nrf noup] modules: hal_nordic: require nrf-regtool Same as commit 6ec9d10 but with the REQUIRED keyword on its own line to attempt to avoid a merge conflict when reverting/reapplying this patch. Signed-off-by: Jonathan Nilsen (cherry picked from commit 17a975f5511259bcb2a4ee2b1b4d309cf4a6a291) --- modules/hal_nordic/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/hal_nordic/CMakeLists.txt b/modules/hal_nordic/CMakeLists.txt index b6f352864123..e5b1ab60dfca 100644 --- a/modules/hal_nordic/CMakeLists.txt +++ b/modules/hal_nordic/CMakeLists.txt @@ -13,6 +13,7 @@ if(CONFIG_NRF_REGTOOL_GENERATE_UICR) endif() if(DEFINED nrf_regtool_components) find_package(nrf-regtool 9.2.0 + REQUIRED COMPONENTS ${nrf_regtool_components} PATHS ${CMAKE_CURRENT_LIST_DIR}/nrf-regtool NO_CMAKE_PATH From c1643faea535faad9caf5852960c2d9cb09db101 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Wed, 8 Jan 2025 11:15:56 +0100 Subject: [PATCH 0571/2141] [nrf noup] boards: nordic: nrf7002dk: Bring back NS variants MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Non-secure variants for nRF7002 DK were removed from upstream in commit 10d49736cffa14d3798e615e70d58b3be8ee2cfc. Revert these changes downstream, so that the NS variants are still available. Signed-off-by: Andrzej Głąbek Signed-off-by: Johann Fischer (cherry picked from commit 10cee0340c8f580c8edf4eef4a8aff78f3e2a96b) --- boards/nordic/nrf7002dk/CMakeLists.txt | 11 +++ boards/nordic/nrf7002dk/Kconfig | 4 +- boards/nordic/nrf7002dk/Kconfig.defconfig | 72 +++++++++++++++++++ boards/nordic/nrf7002dk/Kconfig.nrf7002dk | 4 +- boards/nordic/nrf7002dk/board.cmake | 18 ++++- boards/nordic/nrf7002dk/board.yml | 4 ++ .../nrf7002dk_nrf5340_cpuapp_nrf7001_ns.dts | 39 ++++++++++ .../nrf7002dk_nrf5340_cpuapp_nrf7001_ns.yaml | 19 +++++ ...7002dk_nrf5340_cpuapp_nrf7001_ns_defconfig | 24 +++++++ .../nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.dts | 40 +++++++++++ .../nrf7002dk_nrf5340_cpuapp_ns.yaml | 19 +++++ .../nrf7002dk_nrf5340_cpuapp_ns_defconfig | 23 ++++++ 12 files changed, 273 insertions(+), 4 deletions(-) create mode 100644 boards/nordic/nrf7002dk/CMakeLists.txt create mode 100644 boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns.dts create mode 100644 boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns.yaml create mode 100644 boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns_defconfig create mode 100644 boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.dts create mode 100644 boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.yaml create mode 100644 boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns_defconfig diff --git a/boards/nordic/nrf7002dk/CMakeLists.txt b/boards/nordic/nrf7002dk/CMakeLists.txt new file mode 100644 index 000000000000..db20255712bc --- /dev/null +++ b/boards/nordic/nrf7002dk/CMakeLists.txt @@ -0,0 +1,11 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +if((CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP OR + CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NS OR + CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 OR + CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS) AND + CONFIG_BOARD_ENABLE_CPUNET) + zephyr_library() + zephyr_library_sources(nrf5340_cpunet_reset.c) +endif() diff --git a/boards/nordic/nrf7002dk/Kconfig b/boards/nordic/nrf7002dk/Kconfig index fa6c8097ae32..d4b7030a65ab 100644 --- a/boards/nordic/nrf7002dk/Kconfig +++ b/boards/nordic/nrf7002dk/Kconfig @@ -10,7 +10,9 @@ config MBOX_NRFX_IPC default MBOX if BOARD_NRF7002DK_NRF5340_CPUAPP || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 + BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS config BT_HCI_IPC default y if BT diff --git a/boards/nordic/nrf7002dk/Kconfig.defconfig b/boards/nordic/nrf7002dk/Kconfig.defconfig index 48510d6e24f8..0d89a0089968 100644 --- a/boards/nordic/nrf7002dk/Kconfig.defconfig +++ b/boards/nordic/nrf7002dk/Kconfig.defconfig @@ -9,3 +9,75 @@ config HW_STACK_PROTECTION default ARCH_HAS_STACK_PROTECTION endif # BOARD_NRF7002DK + +if BOARD_NRF7002DK_NRF5340_CPUAPP || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS + +# By default, if we build for a Non-Secure version of the board, +# force building with TF-M as the Secure Execution Environment. +config BUILD_WITH_TFM + default y if BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS + +if BUILD_WITH_TFM + +# By default, if we build with TF-M, instruct build system to +# flash the combined TF-M (Secure) & Zephyr (Non Secure) image +config TFM_FLASH_MERGED_BINARY + bool + default y + +endif # BUILD_WITH_TFM + +# Code Partition: +# +# 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- +# secure image (TRUSTED_EXECUTION_SECURE=y), the secure FW image shall always +# be restricted to the size of its code partition. +# +# For the non-secure version of the board, the firmware +# must be linked into the code-partition (non-secure) defined in DT, regardless. +# Apply this configuration below by setting the Kconfig symbols used by +# the linker according to the information extracted from DT partitions. + +# SRAM Partition: +# +# If the secure firmware is to be combined with a non-secure image +# (TRUSTED_EXECUTION_SECURE=y), the secure FW image SRAM shall always +# be restricted to the secure image SRAM partition (sram-secure-partition). +# Otherwise (if TRUSTED_EXECUTION_SECURE is not set) the whole zephyr,sram +# may be used by the image. +# +# For the non-secure version of the board, the firmware image SRAM is +# always restricted to the allocated non-secure SRAM partition. +# +# Workaround for not being able to have commas in macro arguments +DT_CHOSEN_Z_CODE_PARTITION := zephyr,code-partition +DT_CHOSEN_Z_SRAM_PARTITION := zephyr,sram-secure-partition + +if (BOARD_NRF7002DK_NRF5340_CPUAPP || BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001) && \ + TRUSTED_EXECUTION_SECURE + +config FLASH_LOAD_SIZE + default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) + +config SRAM_SIZE + default $(dt_chosen_reg_size_int,$(DT_CHOSEN_Z_SRAM_PARTITION),0,K) + +endif + +if BOARD_NRF7002DK_NRF5340_CPUAPP_NS || BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS + +config FLASH_LOAD_OFFSET + default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) + +config FLASH_LOAD_SIZE + default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) + +endif + +endif diff --git a/boards/nordic/nrf7002dk/Kconfig.nrf7002dk b/boards/nordic/nrf7002dk/Kconfig.nrf7002dk index 61b9e818f367..91f52ee6f08c 100644 --- a/boards/nordic/nrf7002dk/Kconfig.nrf7002dk +++ b/boards/nordic/nrf7002dk/Kconfig.nrf7002dk @@ -4,4 +4,6 @@ config BOARD_NRF7002DK select SOC_NRF5340_CPUNET_QKAA if BOARD_NRF7002DK_NRF5340_CPUNET select SOC_NRF5340_CPUAPP_QKAA if BOARD_NRF7002DK_NRF5340_CPUAPP || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 + BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS diff --git a/boards/nordic/nrf7002dk/board.cmake b/boards/nordic/nrf7002dk/board.cmake index f85bbc86f485..11a27910eebc 100644 --- a/boards/nordic/nrf7002dk/board.cmake +++ b/boards/nordic/nrf7002dk/board.cmake @@ -1,10 +1,24 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -if(CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP OR CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001) +if(CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NS OR + CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS) + set(TFM_PUBLIC_KEY_FORMAT "full") +endif() + +if(CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP OR + CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NS OR + CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 OR + CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS) board_runner_args(nrfutil "--ext-mem-config-file=${BOARD_DIR}/support/nrf7002dk_spi_nrfutil_config.json") board_runner_args(jlink "--device=nrf5340_xxaa_app" "--speed=4000") -elseif(CONFIG_BOARD_NRF7002DK_NRF5340_CPUNET) +endif() + +if(CONFIG_TFM_FLASH_MERGED_BINARY) + set_property(TARGET runners_yaml_props_target PROPERTY hex_file "${CMAKE_BINARY_DIR}/zephyr/tfm_merged.hex") +endif() + +if(CONFIG_BOARD_NRF7002DK_NRF5340_CPUNET) board_runner_args(jlink "--device=nrf5340_xxaa_net" "--speed=4000") endif() diff --git a/boards/nordic/nrf7002dk/board.yml b/boards/nordic/nrf7002dk/board.yml index 4f41341e4423..39db5dcfa3a7 100644 --- a/boards/nordic/nrf7002dk/board.yml +++ b/boards/nordic/nrf7002dk/board.yml @@ -5,5 +5,9 @@ board: socs: - name: nrf5340 variants: + - name: ns + cpucluster: cpuapp - name: nrf7001 cpucluster: cpuapp + variants: + - name: ns diff --git a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns.dts b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns.dts new file mode 100644 index 000000000000..5ff28accf3fc --- /dev/null +++ b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns.dts @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; +#include +#include "nrf5340_cpuapp_common.dtsi" + +/ { + model = "Nordic NRF5340 DK NRF5340 Application"; + compatible = "nordic,nrf5340-dk-nrf5340-cpuapp"; + + chosen { + zephyr,sram = &sram0_ns; + zephyr,flash = &flash0; + zephyr,code-partition = &slot0_ns_partition; + zephyr,entropy = &psa_rng; + zephyr,wifi = &wlan0; + }; + + psa_rng: psa-rng { + compatible = "zephyr,psa-crypto-rng"; + status = "okay"; + }; +}; + +&qspi { + nrf70: nrf7001@1 { + compatible = "nordic,nrf7001-qspi"; + status = "okay"; + reg = <1>; + qspi-frequency = <24000000>; + qspi-quad-mode; + + #include "nrf70_common.dtsi" + }; +}; diff --git a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns.yaml b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns.yaml new file mode 100644 index 000000000000..165759691260 --- /dev/null +++ b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns.yaml @@ -0,0 +1,19 @@ +identifier: nrf7002dk/nrf5340/cpuapp/nrf7001/ns +name: NRF7002-DK-NRF7001-NRF5340-application-MCU-Non-Secure +type: mcu +arch: arm +toolchain: + - gnuarmemb + - xtools + - zephyr +ram: 192 +flash: 192 +supported: + - gpio + - i2c + - pwm + - watchdog + - usbd + - usb_device + - netif:openthread +vendor: nordic diff --git a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns_defconfig b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns_defconfig new file mode 100644 index 000000000000..2c435653140a --- /dev/null +++ b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns_defconfig @@ -0,0 +1,24 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +# Enable MPU +CONFIG_ARM_MPU=y + +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y + +# Enable TrustZone-M +CONFIG_ARM_TRUSTZONE_M=y + +# This Board implies building Non-Secure firmware +CONFIG_TRUSTED_EXECUTION_NONSECURE=y + +# enable GPIO +CONFIG_GPIO=y + +# Enable uart driver +CONFIG_SERIAL=y + +# enable console +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y diff --git a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.dts b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.dts new file mode 100644 index 000000000000..0deb8ccc1bf5 --- /dev/null +++ b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.dts @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; +#include +#include "nrf5340_cpuapp_common.dtsi" + +/ { + model = "Nordic NRF5340 DK NRF5340 Application"; + compatible = "nordic,nrf5340-dk-nrf5340-cpuapp"; + + chosen { + zephyr,sram = &sram0_ns_app; + zephyr,flash = &flash0; + zephyr,code-partition = &slot0_ns_partition; + zephyr,entropy = &psa_rng; + zephyr,wifi = &wlan0; + }; + + psa_rng: psa-rng { + compatible = "zephyr,psa-crypto-rng"; + status = "okay"; + }; +}; + +&qspi { + nrf70: nrf7002@1 { + compatible = "nordic,nrf7002-qspi"; + status = "okay"; + reg = <1>; + qspi-frequency = <24000000>; + qspi-quad-mode; + + #include "nrf70_common.dtsi" + #include "nrf70_common_5g.dtsi" + }; +}; diff --git a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.yaml b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.yaml new file mode 100644 index 000000000000..ea43785b4559 --- /dev/null +++ b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.yaml @@ -0,0 +1,19 @@ +identifier: nrf7002dk/nrf5340/cpuapp/ns +name: NRF7002-DK-NRF5340-application-MCU-Non-Secure +type: mcu +arch: arm +toolchain: + - gnuarmemb + - xtools + - zephyr +ram: 192 +flash: 192 +supported: + - gpio + - i2c + - pwm + - watchdog + - usbd + - usb_device + - netif:openthread +vendor: nordic diff --git a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns_defconfig b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns_defconfig new file mode 100644 index 000000000000..1886b926bfd5 --- /dev/null +++ b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns_defconfig @@ -0,0 +1,23 @@ +# SPDX-License-Identifier: Apache-2.0 + +# Enable MPU +CONFIG_ARM_MPU=y + +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y + +# Enable TrustZone-M +CONFIG_ARM_TRUSTZONE_M=y + +# This Board implies building Non-Secure firmware +CONFIG_TRUSTED_EXECUTION_NONSECURE=y + +# enable GPIO +CONFIG_GPIO=y + +# Enable uart driver +CONFIG_SERIAL=y + +# enable console +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y From 797a60e8542a450d615b7fd1007f3c407fae87b8 Mon Sep 17 00:00:00 2001 From: Maximilian Deubel Date: Wed, 15 Nov 2023 12:55:40 +0100 Subject: [PATCH 0572/2141] [nrf noup] boards: arm: nrf9131ek: enable tfm This patch backports the nrf9131ek to a time before tfm was refactored. To be reverted when TF-M is updated. Signed-off-by: Maximilian Deubel (cherry picked from commit ca2646b48492653fbfdf42d4c9bd5e5321bb05a1) --- boards/nordic/nrf9131ek/Kconfig.defconfig | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/boards/nordic/nrf9131ek/Kconfig.defconfig b/boards/nordic/nrf9131ek/Kconfig.defconfig index e1d8de241c0a..1a30d006b4c6 100644 --- a/boards/nordic/nrf9131ek/Kconfig.defconfig +++ b/boards/nordic/nrf9131ek/Kconfig.defconfig @@ -8,3 +8,22 @@ config HW_STACK_PROTECTION config BOARD_NRF9131EK select USE_DT_CODE_PARTITION if BOARD_NRF9131EK_NRF9131_NS + +if BOARD_NRF9131EK_NRF9131 || BOARD_NRF9131EK_NRF9131_NS + +# By default, if we build for a Non-Secure version of the board, +# enable building with TF-M as the Secure Execution Environment. +config BUILD_WITH_TFM + default y if BOARD_NRF9131EK_NRF9131_NS + +if BUILD_WITH_TFM + +# By default, if we build with TF-M, instruct build system to +# flash the combined TF-M (Secure) & Zephyr (Non Secure) image +config TFM_FLASH_MERGED_BINARY + bool + default y + +endif # BUILD_WITH_TFM + +endif # BOARD_NRF9131EK_NRF9131 || BOARD_NRF9131EK_NRF9131_NS From 1512388b59efaa75c4f87e7139b878d0a58d8101 Mon Sep 17 00:00:00 2001 From: Gordon Klaus Date: Mon, 4 Aug 2025 09:37:08 +0200 Subject: [PATCH 0573/2141] [nrf noup] samples: bluetooth: Add support for nRF54lm20a to hci_uart Add support for nRF54lm20a to the hci_uart sample. Signed-off-by: Gordon Klaus --- .../boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 12 ++++++++++++ samples/bluetooth/hci_uart/sample.yaml | 4 ++++ 2 files changed, 16 insertions(+) create mode 100644 samples/bluetooth/hci_uart/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay diff --git a/samples/bluetooth/hci_uart/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/samples/bluetooth/hci_uart/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay new file mode 100644 index 000000000000..0388a57baecf --- /dev/null +++ b/samples/bluetooth/hci_uart/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&uart20 { + compatible = "nordic,nrf-uarte"; + current-speed = <1000000>; + status = "okay"; + hw-flow-control; +}; diff --git a/samples/bluetooth/hci_uart/sample.yaml b/samples/bluetooth/hci_uart/sample.yaml index 97ad6c561b2e..4dc5c6e90368 100644 --- a/samples/bluetooth/hci_uart/sample.yaml +++ b/samples/bluetooth/hci_uart/sample.yaml @@ -8,10 +8,14 @@ tests: - nrf52dk/nrf52832 - nrf52840dk/nrf52840 - nrf21540dk/nrf52840 + - nrf54l15dk/nrf54l15/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp integration_platforms: - nrf52dk/nrf52832 - nrf52840dk/nrf52840 - nrf21540dk/nrf52840 + - nrf54l15dk/nrf54l15/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp tags: - uart - bluetooth From 8d7b9c9d00552a89eb04755435e24d555894d819 Mon Sep 17 00:00:00 2001 From: Gordon Klaus Date: Mon, 4 Aug 2025 09:38:37 +0200 Subject: [PATCH 0574/2141] [nrf fromlist] samples: bluetooth: Add support for nRF54lm20a to two samples Add support for nRF54lm20a to the beacon and peripheral_hr samples. Upstream PR #: 93917 Signed-off-by: Gordon Klaus --- samples/bluetooth/beacon/sample.yaml | 2 ++ samples/bluetooth/peripheral_hr/sample.yaml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/samples/bluetooth/beacon/sample.yaml b/samples/bluetooth/beacon/sample.yaml index 819ac3d30024..00215341924f 100644 --- a/samples/bluetooth/beacon/sample.yaml +++ b/samples/bluetooth/beacon/sample.yaml @@ -10,6 +10,7 @@ tests: - nrf52dk/nrf52832 - nrf54l15dk/nrf54l15/cpuapp - ophelia4ev/nrf54l15/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp tags: bluetooth integration_platforms: - qemu_cortex_m3 @@ -17,6 +18,7 @@ tests: - nrf52dk/nrf52832 - nrf54l15dk/nrf54l15/cpuapp - ophelia4ev/nrf54l15/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp sample.bluetooth.beacon-coex: extra_args: - CONF_FILE="prj-coex.conf" diff --git a/samples/bluetooth/peripheral_hr/sample.yaml b/samples/bluetooth/peripheral_hr/sample.yaml index 8b0722d169fd..22bc7667461e 100644 --- a/samples/bluetooth/peripheral_hr/sample.yaml +++ b/samples/bluetooth/peripheral_hr/sample.yaml @@ -15,6 +15,7 @@ tests: - nrf5340dk/nrf5340/cpuapp - nrf54l15dk/nrf54l15/cpuapp - ophelia4ev/nrf54l15/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp integration_platforms: - qemu_cortex_m3 - nrf52_bsim @@ -25,6 +26,7 @@ tests: - nrf5340dk/nrf5340/cpuapp - nrf54l15dk/nrf54l15/cpuapp - ophelia4ev/nrf54l15/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp tags: bluetooth sample.bluetooth.peripheral_hr.minimal: harness: bluetooth From 2e2beca20d6bd81740b32d2f2da8d741fec941dd Mon Sep 17 00:00:00 2001 From: Michal Kozikowski Date: Tue, 29 Jul 2025 12:44:13 +0200 Subject: [PATCH 0575/2141] Revert "[nrf noup] mcuboot: Add CONFIG_MCUBOOT_BOOTLOADER_USES_SHA512" This reverts commit 6b3791792fc6b221fd6f5bc634256d08e144a7c3. Changes were moved to upstream in PR #93813. Signed-off-by: Michal Kozikowski --- modules/Kconfig.mcuboot | 5 ----- 1 file changed, 5 deletions(-) diff --git a/modules/Kconfig.mcuboot b/modules/Kconfig.mcuboot index 694f4069b90f..c02ee43f5eb8 100644 --- a/modules/Kconfig.mcuboot +++ b/modules/Kconfig.mcuboot @@ -288,11 +288,6 @@ config MCUBOOT_BOOTLOADER_NO_DOWNGRADE MCUBOOT_DOWNGRADE_PREVENTION option enabled. endif -config MCUBOOT_BOOTLOADER_USES_SHA512 - bool "MCUboot uses SHA512 for image hash" - help - MCUboot has been compiled to verify images using SHA512. - config MCUBOOT_APPLICATION_FIRMWARE_UPDATER bool "Application is firmware updater image" depends on MCUBOOT_BOOTLOADER_MODE_FIRMWARE_UPDATER From c136755381da8ba816a7be35bc0ff8050fc559df Mon Sep 17 00:00:00 2001 From: Michal Kozikowski Date: Wed, 23 Jul 2025 09:53:11 +0200 Subject: [PATCH 0576/2141] [nrf fromtree] cmake: mcuboot: SHA512/pure image signing Update signing script to use proper arguments for imgtool when SHA512 or pure signature is needed. Signed-off-by: Michal Kozikowski (cherry picked from commit 6c72cd3e65e3d3a1c9b8026be5fd6207b06d8f81) --- cmake/mcuboot.cmake | 7 +++++++ modules/Kconfig.mcuboot | 12 ++++++++++++ 2 files changed, 19 insertions(+) diff --git a/cmake/mcuboot.cmake b/cmake/mcuboot.cmake index d2fcf68e8897..ac37b175a31b 100644 --- a/cmake/mcuboot.cmake +++ b/cmake/mcuboot.cmake @@ -152,6 +152,13 @@ function(zephyr_mcuboot_tasks) set(imgtool_args --align ${write_block_size} ${imgtool_args}) endif() + # Set proper hash calculation algorithm for signing + if(CONFIG_MCUBOOT_BOOTLOADER_SIGNATURE_TYPE_PURE) + set(imgtool_args --pure ${imgtool_args}) + elseif(CONFIG_MCUBOOT_BOOTLOADER_USES_SHA512) + set(imgtool_args --sha 512 ${imgtool_args}) + endif() + # Extensionless prefix of any output file. set(output ${ZEPHYR_BINARY_DIR}/${KERNEL_NAME}) diff --git a/modules/Kconfig.mcuboot b/modules/Kconfig.mcuboot index c02ee43f5eb8..a95dc34b72f7 100644 --- a/modules/Kconfig.mcuboot +++ b/modules/Kconfig.mcuboot @@ -288,6 +288,18 @@ config MCUBOOT_BOOTLOADER_NO_DOWNGRADE MCUBOOT_DOWNGRADE_PREVENTION option enabled. endif +config MCUBOOT_BOOTLOADER_USES_SHA512 + bool "MCUboot uses SHA512 for image hash" + help + MCUboot has been compiled to verify images using SHA512. + +config MCUBOOT_BOOTLOADER_SIGNATURE_TYPE_PURE + bool "Signature is verified over an image rather than sha of an image" + help + MCUboot has been compiled to verify images using pure signature + verification, i.e., the signature is verified over the image rather + than the SHA of the image. + config MCUBOOT_APPLICATION_FIRMWARE_UPDATER bool "Application is firmware updater image" depends on MCUBOOT_BOOTLOADER_MODE_FIRMWARE_UPDATER From c1ddd14ed35f577e22cdd0021781a70bda2a0926 Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Thu, 31 Jul 2025 14:26:40 +0200 Subject: [PATCH 0577/2141] [nrf noup] bluetooth: host: Allow auto swap feature without privacy Allow to use CONFIG_BT_ID_AUTO_SWAP_MATCHING_BONDS Kconfig option even if CONFIG_BT_PRIVACY is disabled. This is because CONFIG_BT_PRIVACY configures privacy of local device will still allows to resolve peer address. During pairing, peer device may send its Identity Address and IRK which then can be used for address resolution. This doesn't require CONFIG_BT_PRIVACY be enabled. nrf-squash! [nrf noup] bluetooth: host: Add support for bonding with same peer Signed-off-by: Pavel Vasilyev --- subsys/bluetooth/host/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/bluetooth/host/Kconfig b/subsys/bluetooth/host/Kconfig index 3830745417ae..da1928758fd9 100644 --- a/subsys/bluetooth/host/Kconfig +++ b/subsys/bluetooth/host/Kconfig @@ -633,7 +633,7 @@ config BT_ID_UNPAIR_MATCHING_BONDS config BT_ID_AUTO_SWAP_MATCHING_BONDS bool "Automatically swap conflicting entries in the Resolving List" depends on !BT_ID_UNPAIR_MATCHING_BONDS - depends on BT_PRIVACY && BT_PERIPHERAL && !BT_CENTRAL + depends on BT_SMP && BT_PERIPHERAL && !BT_CENTRAL help If this option is enabled, the Host will not add a new bond with the same peer address (or IRK) to the Resolving List if there is From 6fb16ab25d1adff73dbde6b89defcc6ce8a20734 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Tue, 29 Jul 2025 17:30:25 +0100 Subject: [PATCH 0578/2141] [nrf fromlist] doc: extensions: kconfig: Add support for sysbuild Adds support for outputting details on sysbuild Kconfigs for use with the documentation Kconfig lookup tool Upstream PR #: 93861 Signed-off-by: Jamie McCrae --- doc/_extensions/zephyr/kconfig/__init__.py | 276 +++++++++++---------- 1 file changed, 146 insertions(+), 130 deletions(-) diff --git a/doc/_extensions/zephyr/kconfig/__init__.py b/doc/_extensions/zephyr/kconfig/__init__.py index 6bf828a9088e..eb1903b18982 100644 --- a/doc/_extensions/zephyr/kconfig/__init__.py +++ b/doc/_extensions/zephyr/kconfig/__init__.py @@ -70,19 +70,24 @@ ZEPHYR_BASE = Path(__file__).parents[4] -def kconfig_load(app: Sphinx) -> tuple[kconfiglib.Kconfig, dict[str, str]]: +def kconfig_load(app: Sphinx) -> tuple[kconfiglib.Kconfig, kconfiglib.Kconfig, dict[str, str]]: """Load Kconfig""" with TemporaryDirectory() as td: modules = zephyr_module.parse_modules(ZEPHYR_BASE) # generate Kconfig.modules file kconfig = "" + sysbuild_kconfig = "" for module in modules: kconfig += zephyr_module.process_kconfig(module.project, module.meta) + sysbuild_kconfig += zephyr_module.process_sysbuildkconfig(module.project, module.meta) with open(Path(td) / "Kconfig.modules", "w") as f: f.write(kconfig) + with open(Path(td) / "Kconfig.sysbuild.modules", "w") as f: + f.write(sysbuild_kconfig) + # generate dummy Kconfig.dts file kconfig = "" @@ -145,6 +150,13 @@ def kconfig_load(app: Sphinx) -> tuple[kconfiglib.Kconfig, dict[str, str]]: os.environ["BOARD"] = "boards" os.environ["KCONFIG_BOARD_DIR"] = str(Path(td) / "boards") + # Sysbuild runs first + os.environ["CONFIG_"] = "SB_CONFIG_" + sysbuild_output = kconfiglib.Kconfig(ZEPHYR_BASE / "share" / "sysbuild" / "Kconfig") + + # Normal Kconfig runs second + os.environ["CONFIG_"] = "CONFIG_" + # insert external Kconfigs to the environment module_paths = dict() for module in modules: @@ -172,7 +184,7 @@ def kconfig_load(app: Sphinx) -> tuple[kconfiglib.Kconfig, dict[str, str]]: if kconfig.exists(): os.environ[f"ZEPHYR_{name_var}_KCONFIG"] = str(kconfig) - return kconfiglib.Kconfig(ZEPHYR_BASE / "Kconfig"), module_paths + return kconfiglib.Kconfig(ZEPHYR_BASE / "Kconfig"), sysbuild_output, module_paths class KconfigSearchNode(nodes.Element): @@ -332,13 +344,15 @@ def add_option(self, option): def sc_fmt(sc): + prefix = os.environ["CONFIG_"] + if isinstance(sc, kconfiglib.Symbol): if sc.nodes: - return f'CONFIG_{sc.name}' + return f'{prefix}{sc.name}' elif isinstance(sc, kconfiglib.Choice): if not sc.name: return "<choice>" - return f'<choice CONFIG_{sc.name}>' + return f'<choice {prefix}{sc.name}>' return kconfiglib.standard_sc_expr_str(sc) @@ -350,137 +364,139 @@ def kconfig_build_resources(app: Sphinx) -> None: return with progress_message("Building Kconfig database..."): - kconfig, module_paths = kconfig_load(app) + kconfig, sysbuild_kconfig, module_paths = kconfig_load(app) db = list() - for sc in sorted( - chain(kconfig.unique_defined_syms, kconfig.unique_choices), - key=lambda sc: sc.name if sc.name else "", - ): - # skip nameless symbols - if not sc.name: - continue - - # store alternative defaults (from defconfig files) - alt_defaults = list() - for node in sc.nodes: - if "defconfig" not in node.filename: + for kconfig_obj in [kconfig, sysbuild_kconfig]: + os.environ["CONFIG_"] = kconfig_obj.config_prefix + for sc in sorted( + chain(kconfig_obj.unique_defined_syms, kconfig_obj.unique_choices), + key=lambda sc: sc.name if sc.name else "", + ): + # skip nameless symbols + if not sc.name: continue - for value, cond in node.orig_defaults: - fmt = kconfiglib.expr_str(value, sc_fmt) - if cond is not sc.kconfig.y: - fmt += f" if {kconfiglib.expr_str(cond, sc_fmt)}" - alt_defaults.append([fmt, node.filename]) - - # build list of symbols that select/imply the current one - # note: all reverse dependencies are ORed together, and conditionals - # (e.g. select/imply A if B) turns into A && B. So we first split - # by OR to include all entries, and we split each one by AND to just - # take the first entry. - selected_by = list() - if isinstance(sc, kconfiglib.Symbol) and sc.rev_dep != sc.kconfig.n: - for select in kconfiglib.split_expr(sc.rev_dep, kconfiglib.OR): - sym = kconfiglib.split_expr(select, kconfiglib.AND)[0] - selected_by.append(f"CONFIG_{sym.name}") - - implied_by = list() - if isinstance(sc, kconfiglib.Symbol) and sc.weak_rev_dep != sc.kconfig.n: - for select in kconfiglib.split_expr(sc.weak_rev_dep, kconfiglib.OR): - sym = kconfiglib.split_expr(select, kconfiglib.AND)[0] - implied_by.append(f"CONFIG_{sym.name}") - - # only process nodes with prompt or help - nodes = [node for node in sc.nodes if node.prompt or node.help] - - inserted_paths = list() - for node in nodes: - # avoid duplicate symbols by forcing unique paths. this can - # happen due to dependencies on 0, a trick used by some modules - path = f"{node.filename}:{node.linenr}" - if path in inserted_paths: - continue - inserted_paths.append(path) - - dependencies = None - if node.dep is not sc.kconfig.y: - dependencies = kconfiglib.expr_str(node.dep, sc_fmt) - - defaults = list() - for value, cond in node.orig_defaults: - fmt = kconfiglib.expr_str(value, sc_fmt) - if cond is not sc.kconfig.y: - fmt += f" if {kconfiglib.expr_str(cond, sc_fmt)}" - defaults.append(fmt) - - selects = list() - for value, cond in node.orig_selects: - fmt = kconfiglib.expr_str(value, sc_fmt) - if cond is not sc.kconfig.y: - fmt += f" if {kconfiglib.expr_str(cond, sc_fmt)}" - selects.append(fmt) - - implies = list() - for value, cond in node.orig_implies: - fmt = kconfiglib.expr_str(value, sc_fmt) - if cond is not sc.kconfig.y: - fmt += f" if {kconfiglib.expr_str(cond, sc_fmt)}" - implies.append(fmt) - - ranges = list() - for min, max, cond in node.orig_ranges: - fmt = ( - f"[{kconfiglib.expr_str(min, sc_fmt)}, " - f"{kconfiglib.expr_str(max, sc_fmt)}]" + # store alternative defaults (from defconfig files) + alt_defaults = list() + for node in sc.nodes: + if "defconfig" not in str(node.filename): + continue + + for value, cond in node.orig_defaults: + fmt = kconfiglib.expr_str(value, sc_fmt) + if cond is not sc.kconfig.y: + fmt += f" if {kconfiglib.expr_str(cond, sc_fmt)}" + alt_defaults.append([fmt, node.filename]) + + # build list of symbols that select/imply the current one + # note: all reverse dependencies are ORed together, and conditionals + # (e.g. select/imply A if B) turns into A && B. So we first split + # by OR to include all entries, and we split each one by AND to just + # take the first entry. + selected_by = list() + if isinstance(sc, kconfiglib.Symbol) and sc.rev_dep != sc.kconfig.n: + for select in kconfiglib.split_expr(sc.rev_dep, kconfiglib.OR): + sym = kconfiglib.split_expr(select, kconfiglib.AND)[0] + selected_by.append(f"{kconfig_obj.config_prefix}{sym.name}") + + implied_by = list() + if isinstance(sc, kconfiglib.Symbol) and sc.weak_rev_dep != sc.kconfig.n: + for select in kconfiglib.split_expr(sc.weak_rev_dep, kconfiglib.OR): + sym = kconfiglib.split_expr(select, kconfiglib.AND)[0] + implied_by.append(f"{kconfig_obj.config_prefix}{sym.name}") + + # only process nodes with prompt or help + nodes = [node for node in sc.nodes if node.prompt or node.help] + + inserted_paths = list() + for node in nodes: + # avoid duplicate symbols by forcing unique paths. this can + # happen due to dependencies on 0, a trick used by some modules + path = f"{node.filename}:{node.linenr}" + if path in inserted_paths: + continue + inserted_paths.append(path) + + dependencies = None + if node.dep is not sc.kconfig.y: + dependencies = kconfiglib.expr_str(node.dep, sc_fmt) + + defaults = list() + for value, cond in node.orig_defaults: + fmt = kconfiglib.expr_str(value, sc_fmt) + if cond is not sc.kconfig.y: + fmt += f" if {kconfiglib.expr_str(cond, sc_fmt)}" + defaults.append(fmt) + + selects = list() + for value, cond in node.orig_selects: + fmt = kconfiglib.expr_str(value, sc_fmt) + if cond is not sc.kconfig.y: + fmt += f" if {kconfiglib.expr_str(cond, sc_fmt)}" + selects.append(fmt) + + implies = list() + for value, cond in node.orig_implies: + fmt = kconfiglib.expr_str(value, sc_fmt) + if cond is not sc.kconfig.y: + fmt += f" if {kconfiglib.expr_str(cond, sc_fmt)}" + implies.append(fmt) + + ranges = list() + for min, max, cond in node.orig_ranges: + fmt = ( + f"[{kconfiglib.expr_str(min, sc_fmt)}, " + f"{kconfiglib.expr_str(max, sc_fmt)}]" + ) + if cond is not sc.kconfig.y: + fmt += f" if {kconfiglib.expr_str(cond, sc_fmt)}" + ranges.append(fmt) + + choices = list() + if isinstance(sc, kconfiglib.Choice): + for sym in sc.syms: + choices.append(kconfiglib.expr_str(sym, sc_fmt)) + + menupath = "" + iternode = node + while iternode.parent is not iternode.kconfig.top_node: + iternode = iternode.parent + if iternode.prompt: + title = iternode.prompt[0] + else: + title = kconfiglib.standard_sc_expr_str(iternode.item) + menupath = f" > {title}" + menupath + + menupath = "(Top)" + menupath + + filename = str(node.filename) + for name, path in module_paths.items(): + path += "/" + if str(node.filename).startswith(path): + filename = str(node.filename).replace(path, f"/") + break + + db.append( + { + "name": f"{kconfig_obj.config_prefix}{sc.name}", + "prompt": node.prompt[0] if node.prompt else None, + "type": kconfiglib.TYPE_TO_STR[sc.type], + "help": node.help, + "dependencies": dependencies, + "defaults": defaults, + "alt_defaults": alt_defaults, + "selects": selects, + "selected_by": selected_by, + "implies": implies, + "implied_by": implied_by, + "ranges": ranges, + "choices": choices, + "filename": filename, + "linenr": node.linenr, + "menupath": menupath, + } ) - if cond is not sc.kconfig.y: - fmt += f" if {kconfiglib.expr_str(cond, sc_fmt)}" - ranges.append(fmt) - - choices = list() - if isinstance(sc, kconfiglib.Choice): - for sym in sc.syms: - choices.append(kconfiglib.expr_str(sym, sc_fmt)) - - menupath = "" - iternode = node - while iternode.parent is not iternode.kconfig.top_node: - iternode = iternode.parent - if iternode.prompt: - title = iternode.prompt[0] - else: - title = kconfiglib.standard_sc_expr_str(iternode.item) - menupath = f" > {title}" + menupath - - menupath = "(Top)" + menupath - - filename = node.filename - for name, path in module_paths.items(): - path += "/" - if node.filename.startswith(path): - filename = node.filename.replace(path, f"/") - break - - db.append( - { - "name": f"CONFIG_{sc.name}", - "prompt": node.prompt[0] if node.prompt else None, - "type": kconfiglib.TYPE_TO_STR[sc.type], - "help": node.help, - "dependencies": dependencies, - "defaults": defaults, - "alt_defaults": alt_defaults, - "selects": selects, - "selected_by": selected_by, - "implies": implies, - "implied_by": implied_by, - "ranges": ranges, - "choices": choices, - "filename": filename, - "linenr": node.linenr, - "menupath": menupath, - } - ) app.env.kconfig_db = db # type: ignore From c09cc2f94af10b1996f9e0c726d25f252c434af0 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Fri, 27 Jun 2025 13:09:08 +0200 Subject: [PATCH 0579/2141] [nrf fromtree] manifest: Update nRF hw models to latest Update the HW models module to: 6e5961223f81aa2707c555db138819a5c1b7942c Including the following: 6e59612 CLOCK (52,53): Fix test interface with multiple instances ecf2292 54 CRACEN: Improve model 1277b16 irq controller: Remove out of date comment Signed-off-by: Alberto Escolar Piedras (cherry picked from commit e1c37f6292b0efa651e2a59b19b43870b9cf9262) Signed-off-by: Rubin Gerritsen --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 41fa45c86936..6ec17c12dce4 100644 --- a/west.yml +++ b/west.yml @@ -325,7 +325,7 @@ manifest: groups: - tools - name: nrf_hw_models - revision: 968d55ff22579080466bf2f482596dd6e35361c6 + revision: 6e5961223f81aa2707c555db138819a5c1b7942c path: modules/bsim_hw_models/nrf_hw_models - name: nrf_wifi revision: 787eea1a3c8dd13c86214e204a919e6f9bcebf91 From 2c70598db1380173cedfaf193c93d9c540fdd72e Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Fri, 25 Jul 2025 10:12:12 +0200 Subject: [PATCH 0580/2141] [nrf fromtree] manifest: Update nRF hw models to latest Update the HW models module to: 8b6001d6bdd9e2c8bb858fdb26f696f6d5f73db5 Including the following: 8b6001d CLOCK (54): Fix XOTUNE subscription sideeffecting for nrf54L15 9af1ac8 nRF54LM20: Bugfix: Add missing UART configuration e6af4a7 RADIO: Fix register init for some devices (at least nRF54LM20) 2fe99ab CLOCK (54): Add XO24M/PLL24M/HFCLK24M ffd578a CLOCK (54): Fixes around XOTUNE Signed-off-by: Alberto Escolar Piedras (cherry picked from commit e7115d04ded2b17e91758cee73a4af807bf8ed44) Signed-off-by: Rubin Gerritsen --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 6ec17c12dce4..853d84113a68 100644 --- a/west.yml +++ b/west.yml @@ -325,7 +325,7 @@ manifest: groups: - tools - name: nrf_hw_models - revision: 6e5961223f81aa2707c555db138819a5c1b7942c + revision: 8b6001d6bdd9e2c8bb858fdb26f696f6d5f73db5 path: modules/bsim_hw_models/nrf_hw_models - name: nrf_wifi revision: 787eea1a3c8dd13c86214e204a919e6f9bcebf91 From 10fd4547f9aba742598e82a3975222fe7b07e267 Mon Sep 17 00:00:00 2001 From: Yuxuan Cai Date: Fri, 1 Aug 2025 10:11:17 +0200 Subject: [PATCH 0581/2141] [nrf fromlist] drivers: firmware: remove duplicate function definitions tisci_cmd_get_fwl_region is defined three times which is causing doc build errors Upstream PR #: 93968 Signed-off-by: Yuxuan Cai --- include/zephyr/drivers/firmware/tisci/tisci.h | 38 ------------------- 1 file changed, 38 deletions(-) diff --git a/include/zephyr/drivers/firmware/tisci/tisci.h b/include/zephyr/drivers/firmware/tisci/tisci.h index 8097d6d44059..38fc58b91214 100644 --- a/include/zephyr/drivers/firmware/tisci/tisci.h +++ b/include/zephyr/drivers/firmware/tisci/tisci.h @@ -891,44 +891,6 @@ int tisci_cmd_set_fwl_region(const struct device *dev, const struct tisci_msg_fw */ int tisci_cmd_get_fwl_region(const struct device *dev, struct tisci_msg_fwl_region *region); -/* INCLUDE_ZEPHYR_DRIVERS_TISCI_H_ */ - -/* Firewall Management Functions */ -/* ... previous firewall functions ... */ - -/** - * @brief Get firewall region configuration - * - * Retrieves the configuration of a firewall region including permissions, - * addresses, and control settings. - * - * @param dev Pointer to the TI SCI device - * @param region Pointer to store the firewall region configuration. - * The fwl_id, region, and n_permission_regs fields must be - * set before calling this function. - * - * @return 0 if successful, or an error code - */ -int tisci_cmd_get_fwl_region(const struct device *dev, struct tisci_msg_fwl_region *region); - -/* Firewall Management Functions */ -/* ... previous firewall functions ... */ - -/** - * @brief Get firewall region configuration - * - * Retrieves the configuration of a firewall region including permissions, - * addresses, and control settings. - * - * @param dev Pointer to the TI SCI device - * @param region Pointer to store the firewall region configuration. - * The fwl_id, region, and n_permission_regs fields must be - * set before calling this function. - * - * @return 0 if successful, or an error code - */ -int tisci_cmd_get_fwl_region(const struct device *dev, struct tisci_msg_fwl_region *region); - /* Firewall Management Functions */ /* ... previous firewall functions ... */ From d6ac46be53344353db054fd4a6068868d1b99457 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Stasiak?= Date: Wed, 30 Jul 2025 16:00:13 +0200 Subject: [PATCH 0582/2141] [nrf fromlist] drivers: hwinfo: nrf: extend supported reset reasons MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added missing supported reset reasons based on conditional guards. Upstream PR #: 93910 Signed-off-by: Michał Stasiak --- drivers/hwinfo/hwinfo_nrf.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/hwinfo/hwinfo_nrf.c b/drivers/hwinfo/hwinfo_nrf.c index f5a6ed38a20f..3d3314ddf581 100644 --- a/drivers/hwinfo/hwinfo_nrf.c +++ b/drivers/hwinfo/hwinfo_nrf.c @@ -207,6 +207,15 @@ int z_impl_hwinfo_get_supported_reset_cause(uint32_t *supported) | RESET_SOFTWARE | RESET_CPU_LOCKUP | RESET_LOW_POWER_WAKE +#if NRFX_RESET_REASON_HAS_VBUS + | RESET_POR +#endif +#if NRFX_RESET_REASON_HAS_GRTC + | RESET_CLOCK +#endif +#if defined(NRFX_RESET_REASON_TAMPC_MASK) || defined(NRFX_RESET_REASON_SECTAMPER_MASK) + | RESET_SECURITY +#endif | RESET_DEBUG); return 0; From 49957e518f5cd614529c2bc69e606e870629c1af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Stasiak?= Date: Thu, 31 Jul 2025 11:22:37 +0200 Subject: [PATCH 0583/2141] [nrf fromlist] samples: nordic: system_off: check for supported reset causes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Check whether used reset causes are supported by hwinfo driver. Upstream PR #: 93910 Signed-off-by: Michał Stasiak --- samples/boards/nordic/system_off/src/main.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/samples/boards/nordic/system_off/src/main.c b/samples/boards/nordic/system_off/src/main.c index d119eff87dac..b4c2eeb2b1bb 100644 --- a/samples/boards/nordic/system_off/src/main.c +++ b/samples/boards/nordic/system_off/src/main.c @@ -31,8 +31,17 @@ static const struct gpio_dt_spec sw0 = GPIO_DT_SPEC_GET(DT_ALIAS(sw0), gpios); static const struct device *comp_dev = DEVICE_DT_GET(DT_NODELABEL(comp)); #endif -void print_reset_cause(uint32_t reset_cause) +int print_reset_cause(uint32_t reset_cause) { + int32_t ret; + uint32_t supported; + + ret = hwinfo_get_supported_reset_cause((uint32_t *) &supported); + + if (ret || !(reset_cause & supported)) { + return -ENOTSUP; + } + if (reset_cause & RESET_DEBUG) { printf("Reset by debugger.\n"); } else if (reset_cause & RESET_CLOCK) { @@ -42,6 +51,8 @@ void print_reset_cause(uint32_t reset_cause) } else { printf("Other wake up cause 0x%08X.\n", reset_cause); } + + return 0; } int main(void) @@ -57,7 +68,12 @@ int main(void) printf("\n%s system off demo\n", CONFIG_BOARD); hwinfo_get_reset_cause(&reset_cause); - print_reset_cause(reset_cause); + rc = print_reset_cause(reset_cause); + + if (rc < 0) { + printf("Reset cause not supported.\n"); + return 0; + } if (IS_ENABLED(CONFIG_APP_USE_RETAINED_MEM)) { bool retained_ok = retained_validate(); From d45132712f2f0a846c04f0c171ec9fcbd43d8d1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karol=20Laso=C5=84czyk?= Date: Tue, 29 Jul 2025 09:13:19 +0200 Subject: [PATCH 0584/2141] [nrf fromtree] soc: nordic: Extend address validation to cover GPREGRET MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Extension of the validate_base_addresses.c file to cover GPREGRET in all Nordic SoCs. Signed-off-by: Karol Lasończyk (cherry picked from commit 8f2d3e7623d6abdaaccae8fe42a93230f53ae05f) --- soc/nordic/validate_base_addresses.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/soc/nordic/validate_base_addresses.c b/soc/nordic/validate_base_addresses.c index f3c9c8bf2145..7426364417fe 100644 --- a/soc/nordic/validate_base_addresses.c +++ b/soc/nordic/validate_base_addresses.c @@ -73,13 +73,19 @@ #define NRF_WDT0 NRF_WDT #endif +#if !defined(NRF_POWER_GPREGRET1) && defined(NRF_POWER) #if defined(CONFIG_SOC_SERIES_NRF51X) || defined(CONFIG_SOC_SERIES_NRF52X) -#if !defined(NRF_POWER_GPREGRET1) && defined(NRF_POWER_BASE) -#define NRF_POWER_GPREGRET1 (0x51c + NRF_POWER_BASE) +#define NRF_POWER_GPREGRET1 (&NRF_POWER->GPREGRET) +#else +#define NRF_POWER_GPREGRET1 (&NRF_POWER->GPREGRET[0]) +#endif #endif -#if !defined(NRF_POWER_GPREGRET2) && defined(NRF_POWER_BASE) -#define NRF_POWER_GPREGRET2 (0x520 + NRF_POWER_BASE) +#if !defined(NRF_POWER_GPREGRET2) && defined(NRF_POWER) +#if defined(CONFIG_SOC_SERIES_NRF51X) || defined(CONFIG_SOC_SERIES_NRF52X) +#define NRF_POWER_GPREGRET2 (&NRF_POWER->GPREGRET2) +#else +#define NRF_POWER_GPREGRET2 (&NRF_POWER->GPREGRET[1]) #endif #endif @@ -367,9 +373,5 @@ CHECK_DT_REG(cpurad_wdt010, NRF_RADIOCORE_WDT010); CHECK_DT_REG(cpurad_wdt011, NRF_RADIOCORE_WDT011); CHECK_DT_REG(wdt131, NRF_WDT131); CHECK_DT_REG(wdt132, NRF_WDT132); - -/* nRF51/nRF52-specific addresses */ -#if defined(CONFIG_SOC_SERIES_NRF51X) || defined(CONFIG_SOC_SERIES_NRF52X) CHECK_DT_REG(gpregret1, NRF_POWER_GPREGRET1); CHECK_DT_REG(gpregret2, NRF_POWER_GPREGRET2); -#endif From b57c64b8fcf5a7e5e3b7a501074d364d36471f18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karol=20Laso=C5=84czyk?= Date: Tue, 29 Jul 2025 09:12:23 +0200 Subject: [PATCH 0585/2141] [nrf fromtree] dts: nordic: Fix GPREGRET addresses for nRF54LM20A MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix for wrongly addressed GPREGRET space. Signed-off-by: Karol Lasończyk (cherry picked from commit d55ee09e1a1491172ffecb75ea4595a19e13c08b) --- dts/vendor/nordic/nrf54lm20a.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dts/vendor/nordic/nrf54lm20a.dtsi b/dts/vendor/nordic/nrf54lm20a.dtsi index d673ae94e509..d1e6d1b0d28a 100644 --- a/dts/vendor/nordic/nrf54lm20a.dtsi +++ b/dts/vendor/nordic/nrf54lm20a.dtsi @@ -800,19 +800,19 @@ #address-cells = <1>; #size-cells = <1>; - gpregret1: gpregret1@51c { + gpregret1: gpregret1@500 { #address-cells = <1>; #size-cells = <1>; compatible = "nordic,nrf-gpregret"; - reg = <0x51c 0x1>; + reg = <0x500 0x1>; status = "disabled"; }; - gpregret2: gpregret2@520 { + gpregret2: gpregret2@504 { #address-cells = <1>; #size-cells = <1>; compatible = "nordic,nrf-gpregret"; - reg = <0x520 0x1>; + reg = <0x504 0x1>; status = "disabled"; }; }; From 1ed3c0dd5c9ddbccd5a1c19a5720d27880c7dd69 Mon Sep 17 00:00:00 2001 From: Omkar Kulkarni Date: Fri, 18 Jul 2025 15:15:35 +0200 Subject: [PATCH 0586/2141] [nrf fromtree] Bluetooth: Mesh: Blob Server considers friendship Fix Max Chunk reporting during Block_Information_Get: If friendship is established, then max possible chunk size for transfer is reported according to friend's queue size. ChunkSize = (FndQ sz * Bytes per seg (12)) - Opcode(1) - Chunk_Num (2)- 8 byte MIC (max) = (FndQ sz * 12) - 11 This allows all segments of Chunk_Transfer messages to fit in a friend queue. If this is not done, friend queue keeps overflowing systematically causing unstable PULL_MODE transfers. Fix Chunk requests: Adapt number of requested chunks according to current friend queue size. If friend queue is too small, at least 1 chunk is requested. Signed-off-by: Omkar Kulkarni (cherry picked from commit 602fd0d8898031f689f5682cda4f2124c519ea03) --- subsys/bluetooth/mesh/blob_srv.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/subsys/bluetooth/mesh/blob_srv.c b/subsys/bluetooth/mesh/blob_srv.c index 2d4ec561f834..c022352b040c 100644 --- a/subsys/bluetooth/mesh/blob_srv.c +++ b/subsys/bluetooth/mesh/blob_srv.c @@ -151,8 +151,12 @@ static int pull_req_max(const struct bt_mesh_blob_srv *srv) BLOB_CHUNK_SDU_LEN(srv->state.xfer.chunk_size), BT_MESH_APP_SEG_SDU_MAX); - count = MIN(CONFIG_BT_MESH_BLOB_SRV_PULL_REQ_COUNT, - bt_mesh.lpn.queue_size / segments_per_chunk); + /* It is possible that the friend node cannot hold all segments per chunk. In this + * case, we should request at least 1 chunk. As requesting `0` would be invalid. + */ + count = MAX(1, MIN(CONFIG_BT_MESH_BLOB_SRV_PULL_REQ_COUNT, + bt_mesh.lpn.queue_size / segments_per_chunk)); + } #endif @@ -821,7 +825,27 @@ static int handle_info_get(const struct bt_mesh_model *mod, struct bt_mesh_msg_c net_buf_simple_add_u8(&rsp, BLOB_BLOCK_SIZE_LOG_MIN); net_buf_simple_add_u8(&rsp, BLOB_BLOCK_SIZE_LOG_MAX); net_buf_simple_add_le16(&rsp, CONFIG_BT_MESH_BLOB_CHUNK_COUNT_MAX); + +#if defined(CONFIG_BT_MESH_LOW_POWER) + /* If friendship is established, then chunk size is according to friend's queue size. + * Chunk size = (Queue size * Segment size) - (Opcode (1) - Chunk Number (2) + * - 8 byte MIC (max)) + */ + if (bt_mesh_lpn_established() && bt_mesh.lpn.queue_size > 0) { + uint16_t chunk_size = (bt_mesh.lpn.queue_size * 12) - 11; + + chunk_size = MIN(chunk_size, BLOB_RX_CHUNK_SIZE); + net_buf_simple_add_le16(&rsp, chunk_size); + if (bt_mesh.lpn.queue_size <= 2) { + LOG_WRN("FndQ too small %u", bt_mesh.lpn.queue_size); + } + } else { + net_buf_simple_add_le16(&rsp, BLOB_RX_CHUNK_SIZE); + } +#else net_buf_simple_add_le16(&rsp, BLOB_RX_CHUNK_SIZE); +#endif + net_buf_simple_add_le32(&rsp, CONFIG_BT_MESH_BLOB_SIZE_MAX); net_buf_simple_add_le16(&rsp, MTU_SIZE_MAX); net_buf_simple_add_u8(&rsp, BT_MESH_BLOB_XFER_MODE_ALL); From bb1a8e3fa07b0841fdacf487e1cebdf660915eef Mon Sep 17 00:00:00 2001 From: Bartosz Miller Date: Wed, 21 May 2025 11:41:09 +0200 Subject: [PATCH 0587/2141] [nrf fromtree] tests: boards: nrf: qdec: Add testing with multiple QDEC instances NRFX should support multiple QDEC devices operation. Signed-off-by: Bartosz Miller (cherry picked from commit 08cc78cc9f109855aac3526bf3b3915df5cf90a3) --- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 57 +++- .../boards/nrf54l15dk_nrf54l15_common.dtsi | 53 +++- tests/boards/nrf/qdec/src/main.c | 272 +++++++++++++----- 3 files changed, 300 insertions(+), 82 deletions(-) diff --git a/tests/boards/nrf/qdec/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/boards/nrf/qdec/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index 7e6da5a34582..78f3aa09ace4 100644 --- a/tests/boards/nrf/qdec/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/tests/boards/nrf/qdec/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -3,11 +3,21 @@ * SPDX-License-Identifier: Apache-2.0 */ +/* Required loopbacks + * P2.08 <-> P2.09 + * P2.10 <-> P2.11 + * P1.02 <-> P1.03 + * P7.01 <-> P1.05 + */ + / { aliases { qdec0 = &qdec130; + qdec1 = &qdec131; qenca = &phase_a; qencb = &phase_b; + qenca1 = &phase_a1; + qencb1 = &phase_b1; }; encoder-emulate { @@ -18,34 +28,73 @@ phase_b: phase_b { gpios = <&gpio2 11 GPIO_ACTIVE_HIGH>; }; + phase_a1: phase_a1 { + gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>; + }; + phase_b1: phase_b1 { + gpios = <&gpio7 1 GPIO_ACTIVE_HIGH>; + }; }; }; &pinctrl { - qdec_pinctrl: qdec_pinctrl { + qdec_130_pinctrl: qdec_130_pinctrl { group1 { psels = , ; }; }; - qdec_sleep_pinctrl: qdec_sleep_pinctrl { + qdec_130_sleep_pinctrl: qdec_130_sleep_pinctrl { group1 { psels = , ; low-power-enable; }; }; + + qdec_131_pinctrl: qdec_131_pinctrl { + group1 { + psels = , + ; + }; + }; + + qdec_131_sleep_pinctrl: qdec_131_sleep_pinctrl { + group1 { + psels = , + ; + low-power-enable; + }; + }; +}; + +&gpio1 { + status = "okay"; }; &gpio2 { status = "okay"; }; +&gpio7 { + status = "okay"; +}; + &qdec130 { status = "okay"; - pinctrl-0 = <&qdec_pinctrl>; - pinctrl-1 = <&qdec_sleep_pinctrl>; + pinctrl-0 = <&qdec_130_pinctrl>; + pinctrl-1 = <&qdec_130_sleep_pinctrl>; + pinctrl-names = "default", "sleep"; + steps = <127>; + led-pre = <500>; + zephyr,pm-device-runtime-auto; +}; + +&qdec131 { + status = "okay"; + pinctrl-0 = <&qdec_131_pinctrl>; + pinctrl-1 = <&qdec_131_sleep_pinctrl>; pinctrl-names = "default", "sleep"; steps = <127>; led-pre = <500>; diff --git a/tests/boards/nrf/qdec/boards/nrf54l15dk_nrf54l15_common.dtsi b/tests/boards/nrf/qdec/boards/nrf54l15dk_nrf54l15_common.dtsi index 3fa426569b8b..06a490d1da08 100644 --- a/tests/boards/nrf/qdec/boards/nrf54l15dk_nrf54l15_common.dtsi +++ b/tests/boards/nrf/qdec/boards/nrf54l15dk_nrf54l15_common.dtsi @@ -3,11 +3,21 @@ * SPDX-License-Identifier: Apache-2.0 */ +/* Required loopbacks + * P1.8 <-> P1.9 + * P1.10 >-> P1.11 + * P2.8 <-> P2.9 + * P2.10 <-> P1.14 + */ + / { aliases { qdec0 = &qdec20; + qdec1 = &qdec21; qenca = &phase_a; qencb = &phase_b; + qenca1 = &phase_a1; + qencb1 = &phase_b1; }; encoder-emulate { @@ -18,34 +28,69 @@ phase_b: phase_b { gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>; }; + phase_a1: phase_a1 { + gpios = <&gpio2 9 GPIO_ACTIVE_HIGH>; + }; + phase_b1: phase_b1 { + gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>; + }; }; }; &pinctrl { - qdec_pinctrl: qdec_pinctrl { + qdec_20_pinctrl: qdec_20_pinctrl { group1 { psels = , ; }; }; - qdec_sleep_pinctrl: qdec_sleep_pinctrl { + qdec_20_sleep_pinctrl: qdec_20_sleep_pinctrl { group1 { psels = , ; low-power-enable; }; }; + + qdec_21_pinctrl: qdec_21_pinctrl { + group1 { + psels = , + ; + }; + }; + + qdec_21_sleep_pinctrl: qdec_21_sleep_pinctrl { + group1 { + psels = , + ; + low-power-enable; + }; + }; }; &gpio1 { status = "okay"; }; +&gpio2 { + status = "okay"; +}; + &qdec20 { status = "okay"; - pinctrl-0 = <&qdec_pinctrl>; - pinctrl-1 = <&qdec_sleep_pinctrl>; + pinctrl-0 = <&qdec_20_pinctrl>; + pinctrl-1 = <&qdec_20_sleep_pinctrl>; + pinctrl-names = "default", "sleep"; + steps = <127>; + led-pre = <500>; + zephyr,pm-device-runtime-auto; +}; + +&qdec21 { + status = "okay"; + pinctrl-0 = <&qdec_21_pinctrl>; + pinctrl-1 = <&qdec_21_sleep_pinctrl>; pinctrl-names = "default", "sleep"; steps = <127>; led-pre = <500>; diff --git a/tests/boards/nrf/qdec/src/main.c b/tests/boards/nrf/qdec/src/main.c index d87feb22f42f..0df3ee2ab952 100644 --- a/tests/boards/nrf/qdec/src/main.c +++ b/tests/boards/nrf/qdec/src/main.c @@ -16,6 +16,15 @@ static const struct gpio_dt_spec phase_a = GPIO_DT_SPEC_GET(DT_ALIAS(qenca), gpi static const struct gpio_dt_spec phase_b = GPIO_DT_SPEC_GET(DT_ALIAS(qencb), gpios); static const struct device *const qdec_dev = DEVICE_DT_GET(DT_ALIAS(qdec0)); static const uint32_t qdec_config_step = DT_PROP(DT_ALIAS(qdec0), steps); + +#if DT_NODE_EXISTS(DT_ALIAS(qdec1)) +#define SECOND_QDEC_INSTANCE + +static const struct gpio_dt_spec phase_a1 = GPIO_DT_SPEC_GET(DT_ALIAS(qenca1), gpios); +static const struct gpio_dt_spec phase_b1 = GPIO_DT_SPEC_GET(DT_ALIAS(qencb1), gpios); +static const struct device *const qdec_1_dev = DEVICE_DT_GET(DT_ALIAS(qdec1)); +static const uint32_t qdec_1_config_step = DT_PROP(DT_ALIAS(qdec1), steps); +#endif static struct sensor_trigger qdec_trigger = {.type = SENSOR_TRIG_DATA_READY, .chan = SENSOR_CHAN_ROTATION}; static bool toggle_a = true; @@ -24,7 +33,6 @@ static void qdec_trigger_handler(const struct device *dev, const struct sensor_t { zassert_not_null(dev); zassert_not_null(trigger); - zassert_equal_ptr(dev, qdec_dev); /* trigger should be stored as a pointer in a driver * thus this address should match */ @@ -37,8 +45,14 @@ static void qenc_emulate_work_handler(struct k_work *work) { if (toggle_a) { gpio_pin_toggle_dt(&phase_a); +#if defined(SECOND_QDEC_INSTANCE) + gpio_pin_toggle_dt(&phase_a1); +#endif } else { gpio_pin_toggle_dt(&phase_b); +#if defined(SECOND_QDEC_INSTANCE) + gpio_pin_toggle_dt(&phase_b1); +#endif } toggle_a = !toggle_a; } @@ -75,6 +89,10 @@ static void qenc_emulate_start(k_timeout_t period, bool forward) { qenc_emulate_reset_pin(&phase_a); qenc_emulate_reset_pin(&phase_b); +#if defined(SECOND_QDEC_INSTANCE) + qenc_emulate_reset_pin(&phase_a1); + qenc_emulate_reset_pin(&phase_b1); +#endif toggle_a = !forward; @@ -87,15 +105,20 @@ static void qenc_emulate_stop(void) qenc_emulate_reset_pin(&phase_a); qenc_emulate_reset_pin(&phase_b); +#if defined(SECOND_QDEC_INSTANCE) + qenc_emulate_reset_pin(&phase_a1); + qenc_emulate_reset_pin(&phase_b1); +#endif } -static void qenc_emulate_verify_reading(int emulator_period_ms, int emulation_duration_ms, - bool forward, bool overflow_expected) +static void qenc_emulate_verify_reading(const struct device *const dev, int emulator_period_ms, + int emulation_duration_ms, bool forward, bool overflow_expected, + const uint32_t config_step) { int rc; struct sensor_value val = {0}; int32_t expected_steps = emulation_duration_ms / emulator_period_ms; - int32_t expected_reading = 360 * expected_steps / qdec_config_step; + int32_t expected_reading = 360 * expected_steps / config_step; int32_t delta = expected_reading / 5; if (!forward) { @@ -104,10 +127,10 @@ static void qenc_emulate_verify_reading(int emulator_period_ms, int emulation_du qenc_emulate_start(K_MSEC(emulator_period_ms), forward); - /* wait for some readings*/ + /* wait for some readings */ k_msleep(emulation_duration_ms); - rc = sensor_sample_fetch(qdec_dev); + rc = sensor_sample_fetch(dev); if (!overflow_expected) { zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); @@ -115,9 +138,11 @@ static void qenc_emulate_verify_reading(int emulator_period_ms, int emulation_du zassert_true(rc == -EOVERFLOW, "Failed to detect overflow"); } - rc = sensor_channel_get(qdec_dev, SENSOR_CHAN_ROTATION, &val); + rc = sensor_channel_get(dev, SENSOR_CHAN_ROTATION, &val); zassert_true(rc == 0, "Failed to get sample (%d)", rc); + TC_PRINT("Expected reading: %d, actual value: %d, delta: %d\n", + expected_reading, val.val1, delta); if (!overflow_expected) { zassert_within(val.val1, expected_reading, delta, "Expected reading: %d, but got: %d", expected_reading, val.val1); @@ -128,30 +153,26 @@ static void qenc_emulate_verify_reading(int emulator_period_ms, int emulation_du /* wait and get readings to clear state */ k_msleep(100); - rc = sensor_sample_fetch(qdec_dev); + rc = sensor_sample_fetch(dev); zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); - rc = sensor_channel_get(qdec_dev, SENSOR_CHAN_ROTATION, &val); + rc = sensor_channel_get(dev, SENSOR_CHAN_ROTATION, &val); zassert_true(rc == 0, "Failed to get sample (%d)", rc); } -/** - * @brief sensor_trigger_set test disable trigger - * - * Confirm trigger happens after set and stops after being disabled - * - */ -ZTEST(qdec_sensor, test_sensor_trigger_set_and_disable) +static void sensor_trigger_set_and_disable(const struct device *const dev) { int rc; if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_get(qdec_dev); + pm_device_runtime_get(dev); } + k_sem_give(&sem); + qdec_trigger.type = SENSOR_TRIG_DATA_READY; qdec_trigger.chan = SENSOR_CHAN_ALL; - rc = sensor_trigger_set(qdec_dev, &qdec_trigger, qdec_trigger_handler); + rc = sensor_trigger_set(dev, &qdec_trigger, qdec_trigger_handler); zassume_true(rc != -ENOSYS, "sensor_trigger_set not supported"); zassert_true(rc == 0, "sensor_trigger_set failed: %d", rc); @@ -168,7 +189,7 @@ ZTEST(qdec_sensor, test_sensor_trigger_set_and_disable) rc = k_sem_take(&sem, K_MSEC(200)); if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_put(qdec_dev); + pm_device_runtime_put(dev); } /* there should be no triggers now*/ @@ -176,11 +197,11 @@ ZTEST(qdec_sensor, test_sensor_trigger_set_and_disable) zassert_true(rc == -EAGAIN, "qdec handler should not be triggered (%d)", rc); if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_get(qdec_dev); + pm_device_runtime_get(dev); } /* register empty trigger - disable trigger */ - rc = sensor_trigger_set(qdec_dev, &qdec_trigger, NULL); + rc = sensor_trigger_set(dev, &qdec_trigger, NULL); zassert_true(rc == 0, "sensor_trigger_set failed: %d", rc); qenc_emulate_start(K_MSEC(10), true); @@ -190,28 +211,39 @@ ZTEST(qdec_sensor, test_sensor_trigger_set_and_disable) zassert_true(rc == -EAGAIN, "qdec handler should not be triggered (%d)", rc); if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_put(qdec_dev); + pm_device_runtime_put(dev); } } /** - * @brief sensor_trigger_set test + * @brief sensor_trigger_set test disable trigger * - * Confirm trigger happens after set + * Confirm trigger happens after set and stops after being disabled * */ -ZTEST(qdec_sensor, test_sensor_trigger_set) +ZTEST(qdec_sensor, test_sensor_trigger_set_and_disable) +{ + TC_PRINT("Testing QDEC-0, address: %p\n", qdec_dev); + sensor_trigger_set_and_disable(qdec_dev); +#if defined(SECOND_QDEC_INSTANCE) + TC_PRINT("Testing QDEC-1, address: %p\n", qdec_1_dev); + sensor_trigger_set_and_disable(qdec_1_dev); +#endif + +} + +static void sensor_trigger_set_test(const struct device *const dev) { int rc; struct sensor_value val = {0}; if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_get(qdec_dev); + pm_device_runtime_get(dev); } qdec_trigger.type = SENSOR_TRIG_DATA_READY; qdec_trigger.chan = SENSOR_CHAN_ROTATION; - rc = sensor_trigger_set(qdec_dev, &qdec_trigger, qdec_trigger_handler); + rc = sensor_trigger_set(dev, &qdec_trigger, qdec_trigger_handler); zassume_true(rc != -ENOSYS, "sensor_trigger_set not supported"); zassert_true(rc == 0, "sensor_trigger_set failed: %d", rc); @@ -222,54 +254,80 @@ ZTEST(qdec_sensor, test_sensor_trigger_set) rc = k_sem_take(&sem, K_MSEC(200)); zassert_true(rc == 0, "qdec handler should be triggered (%d)", rc); - rc = sensor_sample_fetch(qdec_dev); + rc = sensor_sample_fetch(dev); zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); - rc = sensor_channel_get(qdec_dev, SENSOR_CHAN_ROTATION, &val); + rc = sensor_channel_get(dev, SENSOR_CHAN_ROTATION, &val); zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); TC_PRINT("QDEC reading: %d\n", val.val1); zassert_true(val.val1 != 0, "No readings from QDEC"); if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_put(qdec_dev); + pm_device_runtime_put(dev); } } /** - * @brief sensor_trigger_set test negative + * @brief sensor_trigger_set test * - * Confirm setting trigger with invalid data does not work + * Confirm trigger happens after set * */ -ZTEST(qdec_sensor, test_sensor_trigger_set_negative) +ZTEST(qdec_sensor, test_sensor_trigger_set) +{ + TC_PRINT("Testing QDEC-0, address: %p\n", qdec_dev); + sensor_trigger_set_test(qdec_dev); +#if defined(SECOND_QDEC_INSTANCE) + TC_PRINT("Testing QDEC-1, address: %p\n", qdec_1_dev); + sensor_trigger_set_test(qdec_1_dev); +#endif +} + +static void sensor_trigger_set_negative(const struct device *const dev) { int rc; if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_get(qdec_dev); + pm_device_runtime_get(dev); } - rc = sensor_trigger_set(qdec_dev, &qdec_trigger, qdec_trigger_handler); + rc = sensor_trigger_set(dev, &qdec_trigger, qdec_trigger_handler); zassume_true(rc != -ENOSYS, "sensor_trigger_set not supported"); qdec_trigger.type = SENSOR_TRIG_MAX; qdec_trigger.chan = SENSOR_CHAN_ROTATION; - rc = sensor_trigger_set(qdec_dev, &qdec_trigger, qdec_trigger_handler); + rc = sensor_trigger_set(dev, &qdec_trigger, qdec_trigger_handler); zassume_true(rc < 0, "sensor_trigger_set should fail due to invalid trigger type"); qdec_trigger.type = SENSOR_TRIG_DATA_READY; qdec_trigger.chan = SENSOR_CHAN_MAX; - rc = sensor_trigger_set(qdec_dev, &qdec_trigger, qdec_trigger_handler); + rc = sensor_trigger_set(dev, &qdec_trigger, qdec_trigger_handler); zassume_true(rc < 0, "sensor_trigger_set should fail due to invalid channel"); if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_put(qdec_dev); + pm_device_runtime_put(dev); } } +/** + * @brief sensor_trigger_set test negative + * + * Confirm setting trigger with invalid data does not work + * + */ +ZTEST(qdec_sensor, test_sensor_trigger_set_negative) +{ + TC_PRINT("Testing QDEC-0, address: %p\n", qdec_dev); + sensor_trigger_set_negative(qdec_dev); +#if defined(SECOND_QDEC_INSTANCE) + TC_PRINT("Testing QDEC-1, address: %p\n", qdec_1_dev); + sensor_trigger_set_negative(qdec_1_dev); +#endif +} + /** * @brief QDEC readings tests * @@ -282,68 +340,90 @@ ZTEST(qdec_sensor, test_qdec_readings) pm_device_runtime_get(qdec_dev); } - qenc_emulate_verify_reading(10, 100, true, false); - qenc_emulate_verify_reading(2, 500, true, false); - qenc_emulate_verify_reading(10, 200, false, false); - qenc_emulate_verify_reading(1, 1000, false, true); - qenc_emulate_verify_reading(1, 1000, true, true); + TC_PRINT("Testing QDEC-0, address: %p\n", qdec_dev); + qenc_emulate_verify_reading(qdec_dev, 10, 100, true, false, qdec_config_step); + qenc_emulate_verify_reading(qdec_dev, 2, 500, true, false, qdec_config_step); + qenc_emulate_verify_reading(qdec_dev, 10, 200, false, false, qdec_config_step); + qenc_emulate_verify_reading(qdec_dev, 1, 1000, false, true, qdec_config_step); + qenc_emulate_verify_reading(qdec_dev, 1, 1000, true, true, qdec_config_step); if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { pm_device_runtime_put(qdec_dev); } + +#if defined(SECOND_QDEC_INSTANCE) + if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { + pm_device_runtime_get(qdec_1_dev); + } + + TC_PRINT("Testing QDEC-1, address: %p\n", qdec_1_dev); + qenc_emulate_verify_reading(qdec_1_dev, 10, 100, true, false, qdec_1_config_step); + qenc_emulate_verify_reading(qdec_1_dev, 2, 500, true, false, qdec_1_config_step); + qenc_emulate_verify_reading(qdec_1_dev, 10, 200, false, false, qdec_1_config_step); + qenc_emulate_verify_reading(qdec_1_dev, 1, 1000, false, true, qdec_1_config_step); + qenc_emulate_verify_reading(qdec_1_dev, 1, 1000, true, true, qdec_1_config_step); + + if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { + pm_device_runtime_put(qdec_1_dev); + } +#endif } -/** - * @brief sensor_channel_get test with no emulation - * - * Confirm getting empty reading from QDEC - * - */ -ZTEST(qdec_sensor, test_sensor_channel_get_empty) +static void sensor_channel_get_empty(const struct device *const dev) { int rc; struct sensor_value val = {0}; if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_get(qdec_dev); + pm_device_runtime_get(dev); } /* wait for potential new readings */ k_msleep(100); - rc = sensor_sample_fetch(qdec_dev); + rc = sensor_sample_fetch(dev); zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); /* get readings but ignore them, as they may include reading from time * when emulation was still working (i.e. during previous test) */ - rc = sensor_channel_get(qdec_dev, SENSOR_CHAN_ROTATION, &val); + rc = sensor_channel_get(dev, SENSOR_CHAN_ROTATION, &val); zassert_true(rc == 0, "Failed to get sample (%d)", rc); /* wait for potential new readings */ k_msleep(100); - rc = sensor_sample_fetch(qdec_dev); + rc = sensor_sample_fetch(dev); zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); /* emulation was not working, expect no readings */ - rc = sensor_channel_get(qdec_dev, SENSOR_CHAN_ROTATION, &val); + rc = sensor_channel_get(dev, SENSOR_CHAN_ROTATION, &val); zassert_true(rc == 0, "Failed to get sample (%d)", rc); zassert_true(val.val1 == 0, "Expected no readings but got: %d", val.val1); zassert_true(val.val2 == 0, "Expected no readings but got: %d", val.val2); if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_put(qdec_dev); + pm_device_runtime_put(dev); } } /** - * @brief sensor_channel_get test with emulation + * @brief sensor_channel_get test with no emulation * - * Confirm getting readings from QDEC + * Confirm getting empty reading from QDEC * */ -ZTEST(qdec_sensor, test_sensor_channel_get) +ZTEST(qdec_sensor, test_sensor_channel_get_empty) +{ + TC_PRINT("Testing QDEC-0, address: %p\n", qdec_dev); + sensor_channel_get_empty(qdec_dev); +#if defined(SECOND_QDEC_INSTANCE) + TC_PRINT("Testing QDEC-1, address: %p\n", qdec_1_dev); + sensor_channel_get_empty(qdec_1_dev); +#endif +} + +static void sensor_channel_get_test(const struct device *const dev) { int rc; struct sensor_value val_first = {0}; @@ -391,18 +471,28 @@ ZTEST(qdec_sensor, test_sensor_channel_get) } /** - * @brief sensor_channel_get test negative + * @brief sensor_channel_get test with emulation * - * Confirm getting readings from QDEC with invalid channel + * Confirm getting readings from QDEC * */ -ZTEST(qdec_sensor, test_sensor_channel_get_negative) +ZTEST(qdec_sensor, test_sensor_channel_get) +{ + TC_PRINT("Testing QDEC-0, address: %p\n", qdec_dev); + sensor_channel_get_test(qdec_dev); +#if defined(SECOND_QDEC_INSTANCE) + TC_PRINT("Testing QDEC-1, address: %p\n", qdec_1_dev); + sensor_channel_get_test(qdec_1_dev); +#endif +} + +static void sensor_channel_get_negative(const struct device *const dev) { int rc; struct sensor_value val = {0}; if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_get(qdec_dev); + pm_device_runtime_get(dev); } qenc_emulate_start(K_MSEC(10), true); @@ -410,47 +500,73 @@ ZTEST(qdec_sensor, test_sensor_channel_get_negative) /* wait for some readings*/ k_msleep(100); - rc = sensor_sample_fetch(qdec_dev); + rc = sensor_sample_fetch(dev); zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); - rc = sensor_channel_get(qdec_dev, SENSOR_CHAN_MAX, &val); + rc = sensor_channel_get(dev, SENSOR_CHAN_MAX, &val); zassert_true(rc < 0, "Should failed to get sample (%d)", rc); zassert_true(val.val1 == 0, "Some readings from QDEC: %d", val.val1); zassert_true(val.val2 == 0, "Some readings from QDEC: %d", val.val2); if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_put(qdec_dev); + pm_device_runtime_put(dev); } } /** - * @brief sensor_sample_fetch(_chan) test + * @brief sensor_channel_get test negative * - * Confirm fetching work with QDEC specific channel - rotation + * Confirm getting readings from QDEC with invalid channel * */ -ZTEST(qdec_sensor, test_sensor_sample_fetch) +ZTEST(qdec_sensor, test_sensor_channel_get_negative) +{ + TC_PRINT("Testing QDEC-0, address: %p\n", qdec_dev); + sensor_channel_get_negative(qdec_dev); +#if defined(SECOND_QDEC_INSTANCE) + TC_PRINT("Testing QDEC-1, address: %p\n", qdec_1_dev); + sensor_channel_get_negative(qdec_1_dev); +#endif +} + +static void sensor_sample_fetch_test(const struct device *const dev) { int rc; if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_get(qdec_dev); + pm_device_runtime_get(dev); } - rc = sensor_sample_fetch(qdec_dev); + rc = sensor_sample_fetch(dev); zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); - rc = sensor_sample_fetch_chan(qdec_dev, SENSOR_CHAN_ROTATION); + rc = sensor_sample_fetch_chan(dev, SENSOR_CHAN_ROTATION); zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); - rc = sensor_sample_fetch_chan(qdec_dev, SENSOR_CHAN_MAX); + rc = sensor_sample_fetch_chan(dev, SENSOR_CHAN_MAX); zassert_true(rc < 0, "Should fail to fetch sample from invalid channel (%d)", rc); if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_put(qdec_dev); + pm_device_runtime_put(dev); } } +/** + * @brief sensor_sample_fetch(_chan) test + * + * Confirm fetching work with QDEC specific channel - rotation + * + */ +ZTEST(qdec_sensor, test_sensor_sample_fetch) +{ + TC_PRINT("Testing QDEC-0, address: %p\n", qdec_dev); + sensor_sample_fetch_test(qdec_dev); +#if defined(SECOND_QDEC_INSTANCE) + TC_PRINT("Testing QDEC-1, address: %p\n", qdec_1_dev); + sensor_sample_fetch_test(qdec_1_dev); +#endif +} + static void *setup(void) { int rc; @@ -461,6 +577,14 @@ static void *setup(void) qenc_emulate_setup_pin(&phase_a); qenc_emulate_setup_pin(&phase_b); +#if defined(SECOND_QDEC_INSTANCE) + rc = device_is_ready(qdec_1_dev); + zassert_true(rc, "QDEC 1 device not ready: %d", rc); + + qenc_emulate_setup_pin(&phase_a1); + qenc_emulate_setup_pin(&phase_b1); +#endif + return NULL; } From 64d730258d9ebfdb61cd2098ebbf3e1c1bf7dd51 Mon Sep 17 00:00:00 2001 From: Bartosz Miller Date: Tue, 24 Jun 2025 10:55:20 +0200 Subject: [PATCH 0588/2141] [nrf fromtree] tests: boards: nrf: qdec: Disable testing of 2nd instance until fixed Disable testing second QDEC instance until the issue with multiple QDEC instances support is resolved Signed-off-by: Bartosz Miller (cherry picked from commit 39b24514940b2acd7bfd1b71a951f1b3d30727d6) --- tests/boards/nrf/qdec/src/main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/boards/nrf/qdec/src/main.c b/tests/boards/nrf/qdec/src/main.c index 0df3ee2ab952..7df97be2a432 100644 --- a/tests/boards/nrf/qdec/src/main.c +++ b/tests/boards/nrf/qdec/src/main.c @@ -17,7 +17,11 @@ static const struct gpio_dt_spec phase_b = GPIO_DT_SPEC_GET(DT_ALIAS(qencb), gpi static const struct device *const qdec_dev = DEVICE_DT_GET(DT_ALIAS(qdec0)); static const uint32_t qdec_config_step = DT_PROP(DT_ALIAS(qdec0), steps); -#if DT_NODE_EXISTS(DT_ALIAS(qdec1)) +/* Disable testing second QDEC instance + * until the issue with multiple + * QDEC instances support is resolved + */ +#if DT_NODE_EXISTS(DT_ALIAS(qdecX)) #define SECOND_QDEC_INSTANCE static const struct gpio_dt_spec phase_a1 = GPIO_DT_SPEC_GET(DT_ALIAS(qenca1), gpios); From e6948df926e1027caeb3914a2dc37430aca3d09c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Bainczyk?= Date: Thu, 31 Jul 2025 13:09:12 +0200 Subject: [PATCH 0589/2141] [nrf fromlist] tests: boards: nrf: qdec: Fix test for multiple instances MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fixed pin configuration for nRF54L15 (QDECs can use only port 1) - Changed the way the test handles testing multiple instances to make it possible to output quadrature signal to one QDEC instance at a time. Upstream PR #: 93927 Signed-off-by: Michał Bainczyk --- .../boards/bl54l15_dvk_nrf54l15_common.dtsi | 14 +- .../boards/bl54l15u_dvk_nrf54l15_common.dtsi | 14 +- .../qdec/boards/nrf52840dk_nrf52840.overlay | 7 + .../boards/nrf5340dk_nrf5340_cpuapp.overlay | 14 +- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 25 +- .../boards/nrf54l15dk_nrf54l15_common.dtsi | 45 +-- .../boards/nrf54lm20dk_nrf54lm20_common.dtsi | 14 +- .../qdec/dts/bindings/test-qdec-loopback.yaml | 20 ++ tests/boards/nrf/qdec/src/main.c | 313 ++++++++---------- 9 files changed, 237 insertions(+), 229 deletions(-) create mode 100644 tests/boards/nrf/qdec/dts/bindings/test-qdec-loopback.yaml diff --git a/tests/boards/nrf/qdec/boards/bl54l15_dvk_nrf54l15_common.dtsi b/tests/boards/nrf/qdec/boards/bl54l15_dvk_nrf54l15_common.dtsi index 4db67a49a5e0..19ca5e83647f 100644 --- a/tests/boards/nrf/qdec/boards/bl54l15_dvk_nrf54l15_common.dtsi +++ b/tests/boards/nrf/qdec/boards/bl54l15_dvk_nrf54l15_common.dtsi @@ -5,12 +5,6 @@ */ / { - aliases { - qdec0 = &qdec20; - qenca = &phase_a; - qencb = &phase_b; - }; - encoder-emulate { compatible = "gpio-leds"; @@ -22,6 +16,14 @@ gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>; }; }; + + qdec_loopbacks: loopbacks { + compatible = "test-qdec-loopbacks"; + loopback0 { + qdec = <&qdec20>; + qenc-emul-gpios = <&phase_a &phase_b>; + }; + }; }; &pinctrl { diff --git a/tests/boards/nrf/qdec/boards/bl54l15u_dvk_nrf54l15_common.dtsi b/tests/boards/nrf/qdec/boards/bl54l15u_dvk_nrf54l15_common.dtsi index 4db67a49a5e0..19ca5e83647f 100644 --- a/tests/boards/nrf/qdec/boards/bl54l15u_dvk_nrf54l15_common.dtsi +++ b/tests/boards/nrf/qdec/boards/bl54l15u_dvk_nrf54l15_common.dtsi @@ -5,12 +5,6 @@ */ / { - aliases { - qdec0 = &qdec20; - qenca = &phase_a; - qencb = &phase_b; - }; - encoder-emulate { compatible = "gpio-leds"; @@ -22,6 +16,14 @@ gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>; }; }; + + qdec_loopbacks: loopbacks { + compatible = "test-qdec-loopbacks"; + loopback0 { + qdec = <&qdec20>; + qenc-emul-gpios = <&phase_a &phase_b>; + }; + }; }; &pinctrl { diff --git a/tests/boards/nrf/qdec/boards/nrf52840dk_nrf52840.overlay b/tests/boards/nrf/qdec/boards/nrf52840dk_nrf52840.overlay index f227fb95c382..a495df07f7ca 100644 --- a/tests/boards/nrf/qdec/boards/nrf52840dk_nrf52840.overlay +++ b/tests/boards/nrf/qdec/boards/nrf52840dk_nrf52840.overlay @@ -22,6 +22,13 @@ }; }; + qdec_loopbacks: loopbacks { + compatible = "test-qdec-loopbacks"; + loopback0 { + qdec = <&qdec0>; + qenc-emul-gpios = <&phase_a &phase_b>; + }; + }; }; &pinctrl { diff --git a/tests/boards/nrf/qdec/boards/nrf5340dk_nrf5340_cpuapp.overlay b/tests/boards/nrf/qdec/boards/nrf5340dk_nrf5340_cpuapp.overlay index ed6a5587f5b3..d1f008c81936 100644 --- a/tests/boards/nrf/qdec/boards/nrf5340dk_nrf5340_cpuapp.overlay +++ b/tests/boards/nrf/qdec/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -4,12 +4,6 @@ */ / { - aliases { - qdec0 = &qdec1; - qenca = &phase_a; - qencb = &phase_b; - }; - encoder-emulate { compatible = "gpio-leds"; phase_a: phase_a { @@ -21,6 +15,14 @@ gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>; }; }; + + qdec_loopbacks: loopbacks { + compatible = "test-qdec-loopbacks"; + loopback0 { + qdec = <&qdec1>; + qenc-emul-gpios = <&phase_a &phase_b>; + }; + }; }; &pinctrl { diff --git a/tests/boards/nrf/qdec/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/boards/nrf/qdec/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index 78f3aa09ace4..7e43c70dac0f 100644 --- a/tests/boards/nrf/qdec/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/tests/boards/nrf/qdec/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -11,21 +11,12 @@ */ / { - aliases { - qdec0 = &qdec130; - qdec1 = &qdec131; - qenca = &phase_a; - qencb = &phase_b; - qenca1 = &phase_a1; - qencb1 = &phase_b1; - }; - encoder-emulate { compatible = "gpio-leds"; - phase_a: phase_a { + phase_a0: phase_a0 { gpios = <&gpio2 9 GPIO_ACTIVE_HIGH>; }; - phase_b: phase_b { + phase_b0: phase_b0 { gpios = <&gpio2 11 GPIO_ACTIVE_HIGH>; }; phase_a1: phase_a1 { @@ -35,6 +26,18 @@ gpios = <&gpio7 1 GPIO_ACTIVE_HIGH>; }; }; + + qdec_loopbacks: loopbacks { + compatible = "test-qdec-loopbacks"; + loopback0 { + qdec = <&qdec130>; + qenc-emul-gpios = <&phase_a0 &phase_b0>; + }; + loopback1 { + qdec = <&qdec131>; + qenc-emul-gpios = <&phase_a1 &phase_b1>; + }; + }; }; &pinctrl { diff --git a/tests/boards/nrf/qdec/boards/nrf54l15dk_nrf54l15_common.dtsi b/tests/boards/nrf/qdec/boards/nrf54l15dk_nrf54l15_common.dtsi index 06a490d1da08..f27294146527 100644 --- a/tests/boards/nrf/qdec/boards/nrf54l15dk_nrf54l15_common.dtsi +++ b/tests/boards/nrf/qdec/boards/nrf54l15dk_nrf54l15_common.dtsi @@ -4,35 +4,38 @@ */ /* Required loopbacks - * P1.8 <-> P1.9 - * P1.10 >-> P1.11 - * P2.8 <-> P2.9 - * P2.10 <-> P1.14 + * P1.8 <-> P1.9 + * P1.10 <-> P1.11 + * P1.12 <-> P1.13 + * P1.14 <-> P2.10 */ / { - aliases { - qdec0 = &qdec20; - qdec1 = &qdec21; - qenca = &phase_a; - qencb = &phase_b; - qenca1 = &phase_a1; - qencb1 = &phase_b1; - }; - encoder-emulate { compatible = "gpio-leds"; - phase_a: phase_a { + phase_a0: phase_a0 { gpios = <&gpio1 9 GPIO_ACTIVE_HIGH>; }; - phase_b: phase_b { + phase_b0: phase_b0 { gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>; }; phase_a1: phase_a1 { - gpios = <&gpio2 9 GPIO_ACTIVE_HIGH>; + gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>; }; phase_b1: phase_b1 { - gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>; + gpios = <&gpio2 10 GPIO_ACTIVE_HIGH>; + }; + }; + + qdec_loopbacks: loopbacks { + compatible = "test-qdec-loopbacks"; + loopback0 { + qdec = <&qdec20>; + qenc-emul-gpios = <&phase_a0 &phase_b0>; + }; + loopback1 { + qdec = <&qdec21>; + qenc-emul-gpios = <&phase_a1 &phase_b1>; }; }; }; @@ -55,15 +58,15 @@ qdec_21_pinctrl: qdec_21_pinctrl { group1 { - psels = , - ; + psels = , + ; }; }; qdec_21_sleep_pinctrl: qdec_21_sleep_pinctrl { group1 { - psels = , - ; + psels = , + ; low-power-enable; }; }; diff --git a/tests/boards/nrf/qdec/boards/nrf54lm20dk_nrf54lm20_common.dtsi b/tests/boards/nrf/qdec/boards/nrf54lm20dk_nrf54lm20_common.dtsi index 84e7b1dbc30f..6f8f3a184312 100644 --- a/tests/boards/nrf/qdec/boards/nrf54lm20dk_nrf54lm20_common.dtsi +++ b/tests/boards/nrf/qdec/boards/nrf54lm20dk_nrf54lm20_common.dtsi @@ -11,12 +11,6 @@ */ / { - aliases { - qdec0 = &qdec20; - qenca = &phase_a; - qencb = &phase_b; - }; - encoder-emulate { compatible = "gpio-leds"; phase_a: phase_a { @@ -26,6 +20,14 @@ gpios = <&gpio1 23 GPIO_ACTIVE_HIGH>; }; }; + + qdec_loopbacks: loopbacks { + compatible = "test-qdec-loopbacks"; + loopback0 { + qdec = <&qdec20>; + qenc-emul-gpios = <&phase_a &phase_b>; + }; + }; }; &pinctrl { diff --git a/tests/boards/nrf/qdec/dts/bindings/test-qdec-loopback.yaml b/tests/boards/nrf/qdec/dts/bindings/test-qdec-loopback.yaml new file mode 100644 index 000000000000..e03b2ff3bc32 --- /dev/null +++ b/tests/boards/nrf/qdec/dts/bindings/test-qdec-loopback.yaml @@ -0,0 +1,20 @@ +description: | + Binding describing loopbacks required to run tests/boards/nrf/qdec test in Zephyr. + +compatible: "test-qdec-loopbacks" + +child-binding: + description: | + Binding describing a single loopback pair consisting of a QDEC device and two "gpio-leds" pins + working as a quadrature encoder for the test. + properties: + qdec: + type: phandle + required: true + description: Node of the QDEC device used to capture quadrature signal in the loopback. + qenc-emul-gpios: + type: phandles + required: true + description: | + Children nodes of "gpio-leds" compatible used to generate quadrature signal. The first + phandles outputs phase A signal, the second one outputs phase B signal. diff --git a/tests/boards/nrf/qdec/src/main.c b/tests/boards/nrf/qdec/src/main.c index 7df97be2a432..9d138d325fb5 100644 --- a/tests/boards/nrf/qdec/src/main.c +++ b/tests/boards/nrf/qdec/src/main.c @@ -11,27 +11,40 @@ #include #include -static K_SEM_DEFINE(sem, 0, 1); -static const struct gpio_dt_spec phase_a = GPIO_DT_SPEC_GET(DT_ALIAS(qenca), gpios); -static const struct gpio_dt_spec phase_b = GPIO_DT_SPEC_GET(DT_ALIAS(qencb), gpios); -static const struct device *const qdec_dev = DEVICE_DT_GET(DT_ALIAS(qdec0)); -static const uint32_t qdec_config_step = DT_PROP(DT_ALIAS(qdec0), steps); - -/* Disable testing second QDEC instance - * until the issue with multiple - * QDEC instances support is resolved +/** + * Structure grouping gpio pins used for QENC emulation connected with a QDEC device + * with a loopback. */ -#if DT_NODE_EXISTS(DT_ALIAS(qdecX)) -#define SECOND_QDEC_INSTANCE - -static const struct gpio_dt_spec phase_a1 = GPIO_DT_SPEC_GET(DT_ALIAS(qenca1), gpios); -static const struct gpio_dt_spec phase_b1 = GPIO_DT_SPEC_GET(DT_ALIAS(qencb1), gpios); -static const struct device *const qdec_1_dev = DEVICE_DT_GET(DT_ALIAS(qdec1)); -static const uint32_t qdec_1_config_step = DT_PROP(DT_ALIAS(qdec1), steps); -#endif +struct qdec_qenc_loopback { + struct gpio_dt_spec qenc_phase_a; + struct gpio_dt_spec qenc_phase_b; + + const struct device *qdec; + uint32_t qdec_config_step; +}; + +static K_SEM_DEFINE(sem, 0, 1); + +#define GET_QDEC_QENC_LOOPBACK(x) \ + { \ + .qenc_phase_a = GPIO_DT_SPEC_GET(DT_PHANDLE_BY_IDX(x, qenc_emul_gpios, 0), gpios), \ + .qenc_phase_b = GPIO_DT_SPEC_GET(DT_PHANDLE_BY_IDX(x, qenc_emul_gpios, 1), gpios), \ + .qdec = DEVICE_DT_GET(DT_PHANDLE(x, qdec)), \ + .qdec_config_step = DT_PROP_BY_PHANDLE(x, qdec, steps) \ + } + + +struct qdec_qenc_loopback loopbacks[] = { + DT_FOREACH_CHILD_SEP(DT_NODELABEL(qdec_loopbacks), GET_QDEC_QENC_LOOPBACK, (,)) +}; + +#define TESTED_QDEC_COUNT ARRAY_SIZE(loopbacks) + static struct sensor_trigger qdec_trigger = {.type = SENSOR_TRIG_DATA_READY, .chan = SENSOR_CHAN_ROTATION}; + static bool toggle_a = true; +static struct qdec_qenc_loopback *loopback_currently_under_test; static void qdec_trigger_handler(const struct device *dev, const struct sensor_trigger *trigger) { @@ -48,15 +61,9 @@ static void qdec_trigger_handler(const struct device *dev, const struct sensor_t static void qenc_emulate_work_handler(struct k_work *work) { if (toggle_a) { - gpio_pin_toggle_dt(&phase_a); -#if defined(SECOND_QDEC_INSTANCE) - gpio_pin_toggle_dt(&phase_a1); -#endif + gpio_pin_toggle_dt(&loopback_currently_under_test->qenc_phase_a); } else { - gpio_pin_toggle_dt(&phase_b); -#if defined(SECOND_QDEC_INSTANCE) - gpio_pin_toggle_dt(&phase_b1); -#endif + gpio_pin_toggle_dt(&loopback_currently_under_test->qenc_phase_b); } toggle_a = !toggle_a; } @@ -89,52 +96,46 @@ static void qenc_emulate_setup_pin(const struct gpio_dt_spec *gpio_dt) zassert_true(rc == 0, "%s: pin configure failed: %d", gpio_dt->port->name, rc); } -static void qenc_emulate_start(k_timeout_t period, bool forward) +static void qenc_emulate_start(struct qdec_qenc_loopback *loopback, k_timeout_t period, + bool forward) { - qenc_emulate_reset_pin(&phase_a); - qenc_emulate_reset_pin(&phase_b); -#if defined(SECOND_QDEC_INSTANCE) - qenc_emulate_reset_pin(&phase_a1); - qenc_emulate_reset_pin(&phase_b1); -#endif + qenc_emulate_reset_pin(&loopback->qenc_phase_a); + qenc_emulate_reset_pin(&loopback->qenc_phase_b); toggle_a = !forward; - + loopback_currently_under_test = loopback; k_timer_start(&qenc_emulate_timer, period, period); } static void qenc_emulate_stop(void) { - k_timer_stop(&qenc_emulate_timer); - - qenc_emulate_reset_pin(&phase_a); - qenc_emulate_reset_pin(&phase_b); -#if defined(SECOND_QDEC_INSTANCE) - qenc_emulate_reset_pin(&phase_a1); - qenc_emulate_reset_pin(&phase_b1); -#endif + if (loopback_currently_under_test) { + k_timer_stop(&qenc_emulate_timer); + qenc_emulate_reset_pin(&loopback_currently_under_test->qenc_phase_a); + qenc_emulate_reset_pin(&loopback_currently_under_test->qenc_phase_b); + } } -static void qenc_emulate_verify_reading(const struct device *const dev, int emulator_period_ms, - int emulation_duration_ms, bool forward, bool overflow_expected, - const uint32_t config_step) +static void qenc_emulate_verify_reading(struct qdec_qenc_loopback *loopback, + int emulator_period_ms, int emulation_duration_ms, bool forward, + bool overflow_expected) { int rc; struct sensor_value val = {0}; int32_t expected_steps = emulation_duration_ms / emulator_period_ms; - int32_t expected_reading = 360 * expected_steps / config_step; - int32_t delta = expected_reading / 5; + int32_t expected_reading = 360 * expected_steps / loopback->qdec_config_step; + int32_t delta = expected_reading / 4; if (!forward) { expected_reading *= -1; } - qenc_emulate_start(K_MSEC(emulator_period_ms), forward); + qenc_emulate_start(loopback, K_MSEC(emulator_period_ms), forward); /* wait for some readings */ k_msleep(emulation_duration_ms); - rc = sensor_sample_fetch(dev); + rc = sensor_sample_fetch(loopback->qdec); if (!overflow_expected) { zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); @@ -142,7 +143,7 @@ static void qenc_emulate_verify_reading(const struct device *const dev, int emul zassert_true(rc == -EOVERFLOW, "Failed to detect overflow"); } - rc = sensor_channel_get(dev, SENSOR_CHAN_ROTATION, &val); + rc = sensor_channel_get(loopback->qdec, SENSOR_CHAN_ROTATION, &val); zassert_true(rc == 0, "Failed to get sample (%d)", rc); TC_PRINT("Expected reading: %d, actual value: %d, delta: %d\n", @@ -157,31 +158,31 @@ static void qenc_emulate_verify_reading(const struct device *const dev, int emul /* wait and get readings to clear state */ k_msleep(100); - rc = sensor_sample_fetch(dev); + rc = sensor_sample_fetch(loopback->qdec); zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); - rc = sensor_channel_get(dev, SENSOR_CHAN_ROTATION, &val); + rc = sensor_channel_get(loopback->qdec, SENSOR_CHAN_ROTATION, &val); zassert_true(rc == 0, "Failed to get sample (%d)", rc); } -static void sensor_trigger_set_and_disable(const struct device *const dev) +static void sensor_trigger_set_and_disable(struct qdec_qenc_loopback *loopback) { int rc; if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_get(dev); + pm_device_runtime_get(loopback->qdec); } k_sem_give(&sem); qdec_trigger.type = SENSOR_TRIG_DATA_READY; qdec_trigger.chan = SENSOR_CHAN_ALL; - rc = sensor_trigger_set(dev, &qdec_trigger, qdec_trigger_handler); + rc = sensor_trigger_set(loopback->qdec, &qdec_trigger, qdec_trigger_handler); zassume_true(rc != -ENOSYS, "sensor_trigger_set not supported"); zassert_true(rc == 0, "sensor_trigger_set failed: %d", rc); - qenc_emulate_start(K_MSEC(10), true); + qenc_emulate_start(loopback, K_MSEC(10), true); /* emulation working, handler should be called */ rc = k_sem_take(&sem, K_MSEC(200)); @@ -193,7 +194,7 @@ static void sensor_trigger_set_and_disable(const struct device *const dev) rc = k_sem_take(&sem, K_MSEC(200)); if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_put(dev); + pm_device_runtime_put(loopback->qdec); } /* there should be no triggers now*/ @@ -201,21 +202,21 @@ static void sensor_trigger_set_and_disable(const struct device *const dev) zassert_true(rc == -EAGAIN, "qdec handler should not be triggered (%d)", rc); if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_get(dev); + pm_device_runtime_get(loopback->qdec); } /* register empty trigger - disable trigger */ - rc = sensor_trigger_set(dev, &qdec_trigger, NULL); + rc = sensor_trigger_set(loopback->qdec, &qdec_trigger, NULL); zassert_true(rc == 0, "sensor_trigger_set failed: %d", rc); - qenc_emulate_start(K_MSEC(10), true); + qenc_emulate_start(loopback, K_MSEC(10), true); /* emulation working, but handler not set, thus should not be called */ rc = k_sem_take(&sem, K_MSEC(200)); zassert_true(rc == -EAGAIN, "qdec handler should not be triggered (%d)", rc); if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_put(dev); + pm_device_runtime_put(loopback->qdec); } } @@ -227,49 +228,50 @@ static void sensor_trigger_set_and_disable(const struct device *const dev) */ ZTEST(qdec_sensor, test_sensor_trigger_set_and_disable) { - TC_PRINT("Testing QDEC-0, address: %p\n", qdec_dev); - sensor_trigger_set_and_disable(qdec_dev); -#if defined(SECOND_QDEC_INSTANCE) - TC_PRINT("Testing QDEC-1, address: %p\n", qdec_1_dev); - sensor_trigger_set_and_disable(qdec_1_dev); -#endif - + for (size_t i = 0; i < TESTED_QDEC_COUNT; i++) { + TC_PRINT("Testing QDEC index %d, address: %p\n", i, loopbacks[i].qdec); + sensor_trigger_set_and_disable(&loopbacks[i]); + } } -static void sensor_trigger_set_test(const struct device *const dev) +static void sensor_trigger_set_test(struct qdec_qenc_loopback *loopback) { int rc; struct sensor_value val = {0}; if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_get(dev); + pm_device_runtime_get(loopback->qdec); } qdec_trigger.type = SENSOR_TRIG_DATA_READY; qdec_trigger.chan = SENSOR_CHAN_ROTATION; - rc = sensor_trigger_set(dev, &qdec_trigger, qdec_trigger_handler); + rc = sensor_trigger_set(loopback->qdec, &qdec_trigger, qdec_trigger_handler); zassume_true(rc != -ENOSYS, "sensor_trigger_set not supported"); zassert_true(rc == 0, "sensor_trigger_set failed: %d", rc); - qenc_emulate_start(K_MSEC(10), true); + qenc_emulate_start(loopback, K_MSEC(10), true); /* emulation working now */ rc = k_sem_take(&sem, K_MSEC(200)); zassert_true(rc == 0, "qdec handler should be triggered (%d)", rc); - rc = sensor_sample_fetch(dev); + rc = sensor_sample_fetch(loopback->qdec); zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); - rc = sensor_channel_get(dev, SENSOR_CHAN_ROTATION, &val); + rc = sensor_channel_get(loopback->qdec, SENSOR_CHAN_ROTATION, &val); zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); TC_PRINT("QDEC reading: %d\n", val.val1); zassert_true(val.val1 != 0, "No readings from QDEC"); if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_put(dev); + pm_device_runtime_put(loopback->qdec); } + + qenc_emulate_stop(); + /* emulation not working, but there may be old trigger which needs to be cleaned up */ + rc = k_sem_take(&sem, K_MSEC(200)); } /** @@ -280,39 +282,37 @@ static void sensor_trigger_set_test(const struct device *const dev) */ ZTEST(qdec_sensor, test_sensor_trigger_set) { - TC_PRINT("Testing QDEC-0, address: %p\n", qdec_dev); - sensor_trigger_set_test(qdec_dev); -#if defined(SECOND_QDEC_INSTANCE) - TC_PRINT("Testing QDEC-1, address: %p\n", qdec_1_dev); - sensor_trigger_set_test(qdec_1_dev); -#endif + for (size_t i = 0; i < TESTED_QDEC_COUNT; i++) { + TC_PRINT("Testing QDEC index %d, address: %p\n", i, loopbacks[i].qdec); + sensor_trigger_set_test(&loopbacks[i]); + } } -static void sensor_trigger_set_negative(const struct device *const dev) +static void sensor_trigger_set_negative(struct qdec_qenc_loopback *loopback) { int rc; if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_get(dev); + pm_device_runtime_get(loopback->qdec); } - rc = sensor_trigger_set(dev, &qdec_trigger, qdec_trigger_handler); + rc = sensor_trigger_set(loopback->qdec, &qdec_trigger, qdec_trigger_handler); zassume_true(rc != -ENOSYS, "sensor_trigger_set not supported"); qdec_trigger.type = SENSOR_TRIG_MAX; qdec_trigger.chan = SENSOR_CHAN_ROTATION; - rc = sensor_trigger_set(dev, &qdec_trigger, qdec_trigger_handler); + rc = sensor_trigger_set(loopback->qdec, &qdec_trigger, qdec_trigger_handler); zassume_true(rc < 0, "sensor_trigger_set should fail due to invalid trigger type"); qdec_trigger.type = SENSOR_TRIG_DATA_READY; qdec_trigger.chan = SENSOR_CHAN_MAX; - rc = sensor_trigger_set(dev, &qdec_trigger, qdec_trigger_handler); + rc = sensor_trigger_set(loopback->qdec, &qdec_trigger, qdec_trigger_handler); zassume_true(rc < 0, "sensor_trigger_set should fail due to invalid channel"); if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_put(dev); + pm_device_runtime_put(loopback->qdec); } } @@ -324,12 +324,10 @@ static void sensor_trigger_set_negative(const struct device *const dev) */ ZTEST(qdec_sensor, test_sensor_trigger_set_negative) { - TC_PRINT("Testing QDEC-0, address: %p\n", qdec_dev); - sensor_trigger_set_negative(qdec_dev); -#if defined(SECOND_QDEC_INSTANCE) - TC_PRINT("Testing QDEC-1, address: %p\n", qdec_1_dev); - sensor_trigger_set_negative(qdec_1_dev); -#endif + for (size_t i = 0; i < TESTED_QDEC_COUNT; i++) { + TC_PRINT("Testing QDEC index %d, address: %p\n", i, loopbacks[i].qdec); + sensor_trigger_set_negative(&loopbacks[i]); + } } /** @@ -340,37 +338,22 @@ ZTEST(qdec_sensor, test_sensor_trigger_set_negative) */ ZTEST(qdec_sensor, test_qdec_readings) { - if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_get(qdec_dev); + for (size_t i = 0; i < TESTED_QDEC_COUNT; i++) { + if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { + pm_device_runtime_get(loopbacks[i].qdec); + } + + TC_PRINT("Testing QDEC index %d, address: %p\n", i, loopbacks[i].qdec); + qenc_emulate_verify_reading(&loopbacks[i], 10, 100, true, false); + qenc_emulate_verify_reading(&loopbacks[i], 2, 500, true, false); + qenc_emulate_verify_reading(&loopbacks[i], 10, 200, false, false); + qenc_emulate_verify_reading(&loopbacks[i], 1, 1000, false, true); + qenc_emulate_verify_reading(&loopbacks[i], 1, 1000, true, true); + + if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { + pm_device_runtime_put(loopbacks[i].qdec); + } } - - TC_PRINT("Testing QDEC-0, address: %p\n", qdec_dev); - qenc_emulate_verify_reading(qdec_dev, 10, 100, true, false, qdec_config_step); - qenc_emulate_verify_reading(qdec_dev, 2, 500, true, false, qdec_config_step); - qenc_emulate_verify_reading(qdec_dev, 10, 200, false, false, qdec_config_step); - qenc_emulate_verify_reading(qdec_dev, 1, 1000, false, true, qdec_config_step); - qenc_emulate_verify_reading(qdec_dev, 1, 1000, true, true, qdec_config_step); - - if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_put(qdec_dev); - } - -#if defined(SECOND_QDEC_INSTANCE) - if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_get(qdec_1_dev); - } - - TC_PRINT("Testing QDEC-1, address: %p\n", qdec_1_dev); - qenc_emulate_verify_reading(qdec_1_dev, 10, 100, true, false, qdec_1_config_step); - qenc_emulate_verify_reading(qdec_1_dev, 2, 500, true, false, qdec_1_config_step); - qenc_emulate_verify_reading(qdec_1_dev, 10, 200, false, false, qdec_1_config_step); - qenc_emulate_verify_reading(qdec_1_dev, 1, 1000, false, true, qdec_1_config_step); - qenc_emulate_verify_reading(qdec_1_dev, 1, 1000, true, true, qdec_1_config_step); - - if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_put(qdec_1_dev); - } -#endif } static void sensor_channel_get_empty(const struct device *const dev) @@ -419,40 +402,38 @@ static void sensor_channel_get_empty(const struct device *const dev) */ ZTEST(qdec_sensor, test_sensor_channel_get_empty) { - TC_PRINT("Testing QDEC-0, address: %p\n", qdec_dev); - sensor_channel_get_empty(qdec_dev); -#if defined(SECOND_QDEC_INSTANCE) - TC_PRINT("Testing QDEC-1, address: %p\n", qdec_1_dev); - sensor_channel_get_empty(qdec_1_dev); -#endif + for (size_t i = 0; i < TESTED_QDEC_COUNT; i++) { + TC_PRINT("Testing QDEC index %d, address: %p\n", i, loopbacks[i].qdec); + sensor_channel_get_empty(loopbacks[i].qdec); + } } -static void sensor_channel_get_test(const struct device *const dev) +static void sensor_channel_get_test(struct qdec_qenc_loopback *loopback) { int rc; struct sensor_value val_first = {0}; struct sensor_value val_second = {0}; if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_get(qdec_dev); + pm_device_runtime_get(loopback->qdec); } - qenc_emulate_start(K_MSEC(10), true); + qenc_emulate_start(loopback, K_MSEC(10), true); /* wait for some readings*/ k_msleep(100); - rc = sensor_sample_fetch(qdec_dev); + rc = sensor_sample_fetch(loopback->qdec); zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); - rc = sensor_channel_get(qdec_dev, SENSOR_CHAN_ROTATION, &val_first); + rc = sensor_channel_get(loopback->qdec, SENSOR_CHAN_ROTATION, &val_first); zassert_true(rc == 0, "Failed to get sample (%d)", rc); zassert_true(val_first.val1 != 0, "No readings from QDEC"); /* wait for more readings*/ k_msleep(200); - rc = sensor_channel_get(qdec_dev, SENSOR_CHAN_ROTATION, &val_second); + rc = sensor_channel_get(loopback->qdec, SENSOR_CHAN_ROTATION, &val_second); zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); zassert_true(val_second.val1 != 0, "No readings from QDEC"); @@ -470,7 +451,7 @@ static void sensor_channel_get_test(const struct device *const dev) val_second.val2); if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_put(qdec_dev); + pm_device_runtime_put(loopback->qdec); } } @@ -482,38 +463,36 @@ static void sensor_channel_get_test(const struct device *const dev) */ ZTEST(qdec_sensor, test_sensor_channel_get) { - TC_PRINT("Testing QDEC-0, address: %p\n", qdec_dev); - sensor_channel_get_test(qdec_dev); -#if defined(SECOND_QDEC_INSTANCE) - TC_PRINT("Testing QDEC-1, address: %p\n", qdec_1_dev); - sensor_channel_get_test(qdec_1_dev); -#endif + for (size_t i = 0; i < TESTED_QDEC_COUNT; i++) { + TC_PRINT("Testing QDEC index %d, address: %p\n", i, loopbacks[i].qdec); + sensor_channel_get_test(&loopbacks[i]); + } } -static void sensor_channel_get_negative(const struct device *const dev) +static void sensor_channel_get_negative(struct qdec_qenc_loopback *loopback) { int rc; struct sensor_value val = {0}; if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_get(dev); + pm_device_runtime_get(loopback->qdec); } - qenc_emulate_start(K_MSEC(10), true); + qenc_emulate_start(loopback, K_MSEC(10), true); /* wait for some readings*/ k_msleep(100); - rc = sensor_sample_fetch(dev); + rc = sensor_sample_fetch(loopback->qdec); zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); - rc = sensor_channel_get(dev, SENSOR_CHAN_MAX, &val); + rc = sensor_channel_get(loopback->qdec, SENSOR_CHAN_MAX, &val); zassert_true(rc < 0, "Should failed to get sample (%d)", rc); zassert_true(val.val1 == 0, "Some readings from QDEC: %d", val.val1); zassert_true(val.val2 == 0, "Some readings from QDEC: %d", val.val2); if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_put(dev); + pm_device_runtime_put(loopback->qdec); } } @@ -525,12 +504,10 @@ static void sensor_channel_get_negative(const struct device *const dev) */ ZTEST(qdec_sensor, test_sensor_channel_get_negative) { - TC_PRINT("Testing QDEC-0, address: %p\n", qdec_dev); - sensor_channel_get_negative(qdec_dev); -#if defined(SECOND_QDEC_INSTANCE) - TC_PRINT("Testing QDEC-1, address: %p\n", qdec_1_dev); - sensor_channel_get_negative(qdec_1_dev); -#endif + for (size_t i = 0; i < TESTED_QDEC_COUNT; i++) { + TC_PRINT("Testing QDEC index %d, address: %p\n", i, loopbacks[i].qdec); + sensor_channel_get_negative(&loopbacks[i]); + } } static void sensor_sample_fetch_test(const struct device *const dev) @@ -563,32 +540,22 @@ static void sensor_sample_fetch_test(const struct device *const dev) */ ZTEST(qdec_sensor, test_sensor_sample_fetch) { - TC_PRINT("Testing QDEC-0, address: %p\n", qdec_dev); - sensor_sample_fetch_test(qdec_dev); -#if defined(SECOND_QDEC_INSTANCE) - TC_PRINT("Testing QDEC-1, address: %p\n", qdec_1_dev); - sensor_sample_fetch_test(qdec_1_dev); -#endif + for (size_t i = 0; i < TESTED_QDEC_COUNT; i++) { + TC_PRINT("Testing QDEC index %d, address: %p\n", i, loopbacks[i].qdec); + sensor_sample_fetch_test(loopbacks[i].qdec); + } } static void *setup(void) { - int rc; - - rc = device_is_ready(qdec_dev); - zassert_true(rc, "QDEC device not ready: %d", rc); + for (size_t i = 0; i < TESTED_QDEC_COUNT; i++) { + int rc = device_is_ready(loopbacks[i].qdec); - qenc_emulate_setup_pin(&phase_a); - qenc_emulate_setup_pin(&phase_b); - -#if defined(SECOND_QDEC_INSTANCE) - rc = device_is_ready(qdec_1_dev); - zassert_true(rc, "QDEC 1 device not ready: %d", rc); - - qenc_emulate_setup_pin(&phase_a1); - qenc_emulate_setup_pin(&phase_b1); -#endif + zassert_true(rc, "QDEC index %d not ready: %d", i, rc); + qenc_emulate_setup_pin(&loopbacks[i].qenc_phase_a); + qenc_emulate_setup_pin(&loopbacks[i].qenc_phase_b); + } return NULL; } From 8876f35b0208e315d554ca1fec6f66643340fd0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stine=20=C3=85kredalen?= Date: Mon, 4 Aug 2025 01:26:12 +0200 Subject: [PATCH 0590/2141] [nrf noup] samples: bluetooth: mesh: update stack sizes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Increased stack sizes for mesh provisoner sample. Values are based of thread analysis, plus added margin. Signed-off-by: Stine Åkredalen --- samples/bluetooth/mesh_provisioner/prj.conf | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/samples/bluetooth/mesh_provisioner/prj.conf b/samples/bluetooth/mesh_provisioner/prj.conf index 241767805164..0e5f6490edee 100644 --- a/samples/bluetooth/mesh_provisioner/prj.conf +++ b/samples/bluetooth/mesh_provisioner/prj.conf @@ -1,6 +1,10 @@ #CONFIG_INIT_STACKS=y -CONFIG_MAIN_STACK_SIZE=2048 -CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048 +# Stack sizes from thread analysis + 50% margin, rounded to nearest 100 +CONFIG_MAIN_STACK_SIZE=4400 +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4800 +CONFIG_BT_MESH_SETTINGS_WORKQ_STACK_SIZE=1700 +CONFIG_BT_MESH_ADV_STACK_SIZE=4000 +CONFIG_BT_RX_STACK_SIZE=3300 # The Bluetooth API should not be used from a preemptive thread: CONFIG_MAIN_THREAD_PRIORITY=-2 From f10e671ae2b0ecfadb48592d51fae88800ce836b Mon Sep 17 00:00:00 2001 From: Carles Cufi Date: Tue, 17 Jun 2025 14:17:39 +0200 Subject: [PATCH 0591/2141] [nrf fromtree] soc: nordic: 54h20: bicr: Fix order of enum The order of the enumNames array needs to match the actual enum values array below it. Signed-off-by: Carles Cufi (cherry picked from commit d215f5efec6832ec52947e7384284414cdf0db14) --- soc/nordic/nrf54h/bicr/bicr-schema.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/soc/nordic/nrf54h/bicr/bicr-schema.json b/soc/nordic/nrf54h/bicr/bicr-schema.json index b43b7236a6b7..70e133f6ae01 100644 --- a/soc/nordic/nrf54h/bicr/bicr-schema.json +++ b/soc/nordic/nrf54h/bicr/bicr-schema.json @@ -11,8 +11,8 @@ "title": "Power supply scheme", "enumNames": [ "Unconfigured (system will not boot)", - "VDDH supplied with 2.1-5.5 V and VDD regulated by the chip (inductor present)", - "Both VDD and VDDH supplied with 1.8 V (inductor present)" + "Both VDD and VDDH supplied with 1.8 V (inductor present)", + "VDDH supplied with 2.1-5.5 V and VDD regulated by the chip (inductor present)" ], "enum": [ "UNCONFIGURED", From 64848a42d2b6c12fc6f3ed89fad4272195ceadd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20Amundsen?= Date: Thu, 26 Jun 2025 09:06:45 +0200 Subject: [PATCH 0592/2141] [nrf fromtree] soc: nordic: 54h20: fix typo ETX -> EXT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix typo in BICR schema Signed-off-by: Håkon Amundsen (cherry picked from commit e96a63ad82c6c7c20dbe7554777226a7ea4fca48) --- soc/nordic/nrf54h/bicr/bicr-schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soc/nordic/nrf54h/bicr/bicr-schema.json b/soc/nordic/nrf54h/bicr/bicr-schema.json index 70e133f6ae01..a43107a12b6d 100644 --- a/soc/nordic/nrf54h/bicr/bicr-schema.json +++ b/soc/nordic/nrf54h/bicr/bicr-schema.json @@ -193,7 +193,7 @@ ], "enum": [ "CRYSTAL", - "ETX_SINE", + "EXT_SINE", "EXT_SQUARE" ], "default": "CRYSTAL" From 05746fdc63754ddf8eee3ce25485760dbcb86df4 Mon Sep 17 00:00:00 2001 From: Jakub Zymelka Date: Tue, 5 Aug 2025 09:13:03 +0200 Subject: [PATCH 0593/2141] [nrf fromlist] drivers: adc: nrfx_saadc: Add support for DMM Add support for DMM which manages cache and dedicated memory spaces. Upstream PR #: 90751 Signed-off-by: Jakub Zymelka --- drivers/adc/adc_nrfx_saadc.c | 72 +++++++++++++++++------------------- 1 file changed, 34 insertions(+), 38 deletions(-) diff --git a/drivers/adc/adc_nrfx_saadc.c b/drivers/adc/adc_nrfx_saadc.c index 2ba7b6efd008..7d442b482e65 100644 --- a/drivers/adc/adc_nrfx_saadc.c +++ b/drivers/adc/adc_nrfx_saadc.c @@ -13,6 +13,7 @@ #include #include #include +#include LOG_MODULE_REGISTER(adc_nrfx_saadc, CONFIG_ADC_LOG_LEVEL); @@ -97,34 +98,19 @@ BUILD_ASSERT((NRF_SAADC_AIN0 == NRF_SAADC_INPUT_AIN0) && "Definitions from nrf-adc.h do not match those from nrf_saadc.h"); #endif -#if defined(CONFIG_NRF_PLATFORM_HALTIUM) -#include -/* Haltium devices always use bounce buffers in RAM */ -static uint16_t adc_samples_buffer[SAADC_CH_NUM] DMM_MEMORY_SECTION(DT_NODELABEL(adc)); - -#define ADC_BUFFER_IN_RAM - -#endif /* defined(CONFIG_NRF_PLATFORM_HALTIUM) */ - struct driver_data { struct adc_context ctx; uint8_t single_ended_channels; - nrf_saadc_value_t *buffer; /* Pointer to the buffer with converted samples. */ uint8_t active_channel_cnt; - -#if defined(ADC_BUFFER_IN_RAM) - void *samples_buffer; + void *mem_reg; void *user_buffer; -#endif }; static struct driver_data m_data = { ADC_CONTEXT_INIT_TIMER(m_data, ctx), ADC_CONTEXT_INIT_LOCK(m_data, ctx), ADC_CONTEXT_INIT_SYNC(m_data, ctx), -#if defined(ADC_BUFFER_IN_RAM) - .samples_buffer = adc_samples_buffer, -#endif + .mem_reg = DMM_DEV_TO_REG(DT_NODELABEL(adc)), }; /* Forward declaration */ @@ -392,22 +378,29 @@ static void adc_context_start_sampling(struct adc_context *ctx) if (ret != NRFX_SUCCESS) { LOG_ERR("Cannot start sampling: 0x%08x", ret); - adc_context_complete(&m_data.ctx, -EIO); + adc_context_complete(ctx, -EIO); } } } static void adc_context_update_buffer_pointer(struct adc_context *ctx, bool repeat) { + void *samples_buffer; + if (!repeat) { -#if defined(ADC_BUFFER_IN_RAM) m_data.user_buffer = (uint16_t *)m_data.user_buffer + m_data.active_channel_cnt; -#else - nrf_saadc_value_t *buffer = (uint16_t *)m_data.buffer + m_data.active_channel_cnt; + } - nrfx_saadc_buffer_set(buffer, m_data.active_channel_cnt); -#endif + int error = dmm_buffer_in_prepare( + m_data.mem_reg, m_data.user_buffer, + NRFX_SAADC_SAMPLES_TO_BYTES(m_data.active_channel_cnt), + &samples_buffer); + if (error != 0) { + LOG_ERR("DMM buffer allocation failed err=%d", error); + adc_context_complete(ctx, -EIO); } + + nrfx_saadc_buffer_set(samples_buffer, m_data.active_channel_cnt); } static int get_resolution(const struct adc_sequence *sequence, nrf_saadc_resolution_t *resolution) @@ -502,12 +495,12 @@ static bool has_single_ended(const struct adc_sequence *sequence) return sequence->channels & m_data.single_ended_channels; } -static void correct_single_ended(const struct adc_sequence *sequence) +static void correct_single_ended(const struct adc_sequence *sequence, nrf_saadc_value_t *buffer) { uint16_t channel_bit = BIT(0); uint8_t selected_channels = sequence->channels; uint8_t single_ended_channels = m_data.single_ended_channels; - int16_t *sample = (int16_t *)m_data.buffer; + int16_t *sample = (int16_t *)buffer; while (channel_bit <= single_ended_channels) { if (channel_bit & selected_channels) { @@ -532,6 +525,7 @@ static int start_read(const struct device *dev, nrf_saadc_oversample_t oversampling; uint8_t active_channel_cnt = 0U; uint8_t channel_id = 0U; + void *samples_buffer; /* Signal an error if channel selection is invalid (no channels or * a non-existing one is selected). @@ -582,16 +576,21 @@ static int start_read(const struct device *dev, } m_data.active_channel_cnt = active_channel_cnt; -#if defined(ADC_BUFFER_IN_RAM) m_data.user_buffer = sequence->buffer; - nrfx_saadc_buffer_set(m_data.samples_buffer, active_channel_cnt); -#else + error = dmm_buffer_in_prepare(m_data.mem_reg, + m_data.user_buffer, + NRFX_SAADC_SAMPLES_TO_BYTES(active_channel_cnt), + &samples_buffer); + if (error != 0) { + LOG_ERR("DMM buffer allocation failed err=%d", error); + return error; + } + /* Buffer is filled in chunks, each chunk composed of number of samples equal to number * of active channels. Buffer pointer is advanced and reloaded after each chunk. */ - nrfx_saadc_buffer_set(sequence->buffer, active_channel_cnt); -#endif + nrfx_saadc_buffer_set(samples_buffer, active_channel_cnt); adc_context_start_read(&m_data.ctx, sequence); @@ -632,17 +631,14 @@ static void event_handler(const nrfx_saadc_evt_t *event) nrfx_err_t err; if (event->type == NRFX_SAADC_EVT_DONE) { - m_data.buffer = event->data.done.p_buffer; + dmm_buffer_in_release( + m_data.mem_reg, m_data.user_buffer, + NRFX_SAADC_SAMPLES_TO_BYTES(m_data.active_channel_cnt), + event->data.done.p_buffer); if (has_single_ended(&m_data.ctx.sequence)) { - correct_single_ended(&m_data.ctx.sequence); + correct_single_ended(&m_data.ctx.sequence, m_data.user_buffer); } - -#if defined(ADC_BUFFER_IN_RAM) - memcpy(m_data.user_buffer, m_data.samples_buffer, - NRFX_SAADC_SAMPLES_TO_BYTES(m_data.active_channel_cnt)); -#endif - adc_context_on_sampling_done(&m_data.ctx, DEVICE_DT_INST_GET(0)); } else if (event->type == NRFX_SAADC_EVT_CALIBRATEDONE) { err = nrfx_saadc_mode_trigger(); From 77289621634d9247a5b831dcd1c307889ba58104 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Mon, 4 Aug 2025 14:56:28 +0200 Subject: [PATCH 0594/2141] Revert "[nrf fromlist] drivers: timer: nrf_grtc_timer: Optimize to reduce register access" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 8cba1f6198f880ce025d6f69625e42cdfdb0d4d0. Signed-off-by: Krzysztof Chruściński --- drivers/timer/nrf_grtc_timer.c | 94 +++++++++++----------------------- 1 file changed, 31 insertions(+), 63 deletions(-) diff --git a/drivers/timer/nrf_grtc_timer.c b/drivers/timer/nrf_grtc_timer.c index 43f6e8e97caa..2809d8b3d608 100644 --- a/drivers/timer/nrf_grtc_timer.c +++ b/drivers/timer/nrf_grtc_timer.c @@ -49,16 +49,12 @@ #define COUNTER_SPAN (GRTC_SYSCOUNTERL_VALUE_Msk | ((uint64_t)GRTC_SYSCOUNTERH_VALUE_Msk << 32)) #define MAX_ABS_TICKS (COUNTER_SPAN / CYC_PER_TICK) -/* To allow use of CCADD we need to limit max cycles to 31 bits. */ -#define MAX_REL_CYCLES BIT_MASK(31) -#define MAX_REL_TICKS (MAX_REL_CYCLES / CYC_PER_TICK) +#define MAX_TICKS \ + (((COUNTER_SPAN / CYC_PER_TICK) > INT_MAX) ? INT_MAX : (COUNTER_SPAN / CYC_PER_TICK)) -#define LFCLK_FREQUENCY_HZ DT_PROP(LFCLK_NODE, clock_frequency) +#define MAX_CYCLES (MAX_TICKS * CYC_PER_TICK) -/* Threshold used to determine if there is a risk of unexpected GRTC COMPARE event coming - * from previous CC value. - */ -#define LATENCY_THR_TICKS 200 +#define LFCLK_FREQUENCY_HZ DT_PROP(LFCLK_NODE, clock_frequency) #if defined(CONFIG_TEST) const int32_t z_sys_timer_irq_for_test = DT_IRQN(GRTC_NODE); @@ -66,10 +62,8 @@ const int32_t z_sys_timer_irq_for_test = DT_IRQN(GRTC_NODE); static void sys_clock_timeout_handler(int32_t id, uint64_t cc_val, void *p_context); +static struct k_spinlock lock; static uint64_t last_count; /* Time (SYSCOUNTER value) @last sys_clock_announce() */ -static uint32_t last_elapsed; -static uint64_t cc_value; /* Value that is expected to be in CC register. */ -static uint64_t expired_cc; /* Value that is expected to be in CC register. */ static atomic_t int_mask; static uint8_t ext_channels_allocated; static uint64_t grtc_start_value; @@ -152,13 +146,17 @@ static void compare_int_unlock(int32_t chan, bool key) static void sys_clock_timeout_handler(int32_t id, uint64_t cc_val, void *p_context) { ARG_UNUSED(id); - ARG_UNUSED(cc_val); ARG_UNUSED(p_context); - uint32_t dticks; + uint64_t dticks; + uint64_t now = counter(); + + if (unlikely(now < cc_val)) { + return; + } dticks = counter_sub(cc_val, last_count) / CYC_PER_TICK; - last_count += (dticks * CYC_PER_TICK); - expired_cc = cc_val; + + last_count += dticks * CYC_PER_TICK; if (!IS_ENABLED(CONFIG_TICKLESS_KERNEL)) { /* protection is not needed because we are in the GRTC interrupt @@ -167,7 +165,6 @@ static void sys_clock_timeout_handler(int32_t id, uint64_t cc_val, void *p_conte system_timeout_set_abs(last_count + CYC_PER_TICK); } - last_elapsed = 0; sys_clock_announce((int32_t)dticks); } @@ -371,7 +368,6 @@ uint64_t z_nrf_grtc_timer_startup_value_get(void) int z_nrf_grtc_wakeup_prepare(uint64_t wake_time_us) { nrfx_err_t err_code; - static struct k_spinlock lock; static uint8_t systemoff_channel; uint64_t now = counter(); nrfx_grtc_sleep_config_t sleep_cfg; @@ -434,12 +430,20 @@ int z_nrf_grtc_wakeup_prepare(uint64_t wake_time_us) uint32_t sys_clock_cycle_get_32(void) { - return nrf_grtc_sys_counter_low_get(NRF_GRTC); + k_spinlock_key_t key = k_spin_lock(&lock); + uint32_t ret = (uint32_t)counter(); + + k_spin_unlock(&lock, key); + return ret; } uint64_t sys_clock_cycle_get_64(void) { - return counter(); + k_spinlock_key_t key = k_spin_lock(&lock); + uint64_t ret = counter(); + + k_spin_unlock(&lock, key); + return ret; } uint32_t sys_clock_elapsed(void) @@ -448,9 +452,7 @@ uint32_t sys_clock_elapsed(void) return 0; } - last_elapsed = (uint32_t)counter_sub(counter(), last_count); - - return last_elapsed / CYC_PER_TICK; + return (uint32_t)(counter_sub(counter(), last_count) / CYC_PER_TICK); } static int sys_clock_driver_init(void) @@ -491,10 +493,6 @@ static int sys_clock_driver_init(void) last_count = (counter() / CYC_PER_TICK) * CYC_PER_TICK; grtc_start_value = last_count; - expired_cc = UINT64_MAX; - nrfx_grtc_channel_callback_set(system_clock_channel_data.channel, - sys_clock_timeout_handler, NULL); - int_mask = NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK; if (!IS_ENABLED(CONFIG_TICKLESS_KERNEL)) { system_timeout_set_relative(CYC_PER_TICK); @@ -553,48 +551,18 @@ void sys_clock_set_timeout(int32_t ticks, bool idle) return; } - uint32_t ch = system_clock_channel_data.channel; - - if ((cc_value == expired_cc) && (ticks < MAX_REL_TICKS)) { - uint32_t cyc = ticks * CYC_PER_TICK; - - if (cyc == 0) { - /* GRTC will expire anyway since HW ensures that past value triggers an - * event but we need to ensure to always progress the cc_value as this - * if condition expects that cc_value will change after each call to - * set_timeout function. - */ - cyc = 1; - } + ticks = (ticks == K_TICKS_FOREVER) ? MAX_TICKS : MIN(MAX_TICKS, MAX(ticks, 0)); - /* If it's the first timeout setting after previous expiration and timeout - * is short so fast method can be used which utilizes relative CC configuration. - */ - cc_value += cyc; - nrfx_grtc_syscounter_cc_rel_set(ch, cyc, NRFX_GRTC_CC_RELATIVE_COMPARE); - return; - } + uint64_t delta_time = ticks * CYC_PER_TICK; - uint64_t cyc = (uint64_t)ticks * CYC_PER_TICK; - bool safe_setting = false; - int64_t prev_cc_val = cc_value; + uint64_t target_time = counter() + delta_time; - cc_value = last_count + last_elapsed + cyc; - - /* In case of timeout abort it may happen that CC is being set to a value - * that later than previous CC. If previous CC value is not far in the - * future, there is a risk that COMPARE event will be triggered for that - * previous CC value. If there is such risk safe procedure must be applied - * which is more time consuming but ensures that there will be no spurious - * event. + /* Rounded down target_time to the tick boundary + * (but not less than one tick after the last) */ - if (prev_cc_val < cc_value) { - int64_t now = last_count + last_elapsed; - - safe_setting = (prev_cc_val - now) < LATENCY_THR_TICKS; - } + target_time = MAX((target_time - last_count)/CYC_PER_TICK, 1)*CYC_PER_TICK + last_count; - nrfx_grtc_syscounter_cc_abs_set(ch, cc_value, safe_setting); + system_timeout_set_abs(target_time); } #if defined(CONFIG_NRF_GRTC_TIMER_APP_DEFINED_INIT) From 3d9083487d0e8797f9c55d785b3589b14e1122ee Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Tue, 5 Aug 2025 09:54:06 +0200 Subject: [PATCH 0595/2141] Revert "[nrf fromlist] net: l2: wifi: Fix the default keepalive value" This reverts commit d87f317227c9bbdc2c9712d195560841dd8740fd. Signed-off-by: Robert Lubos --- subsys/net/l2/wifi/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/l2/wifi/Kconfig b/subsys/net/l2/wifi/Kconfig index 49d061c7439c..7728678cc979 100644 --- a/subsys/net/l2/wifi/Kconfig +++ b/subsys/net/l2/wifi/Kconfig @@ -158,7 +158,7 @@ endif # WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE config WIFI_MGMT_BSS_MAX_IDLE_TIME int "BSS max idle timeout in seconds" range 0 64000 - default 300 + default 30 help As per 802.11-2020: 11.21.13 BSS max idle period management If dot11WirelessManagementImplemented is true, dot11BSSMaxIdlePeriod is From c162fe25fefddc2f6c39c8ba0ca9dbd35d2119c5 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Tue, 5 Aug 2025 09:54:14 +0200 Subject: [PATCH 0596/2141] Revert "[nrf noup] net: l2: wifi: Configure BSS max idle period" This reverts commit 691b66e66d350d3e64e35f0fec1d490152cd2f53. Signed-off-by: Robert Lubos --- drivers/wifi/nrf_wifi/inc/fmac_main.h | 1 - drivers/wifi/nrf_wifi/inc/wifi_mgmt.h | 3 -- drivers/wifi/nrf_wifi/src/fmac_main.c | 4 -- drivers/wifi/nrf_wifi/src/wifi_mgmt.c | 53 ------------------------- drivers/wifi/nrf_wifi/src/wpa_supp_if.c | 6 +-- include/zephyr/net/wifi_mgmt.h | 16 -------- modules/hostap/src/supp_api.c | 13 ------ modules/hostap/src/supp_api.h | 8 ---- modules/hostap/src/supp_main.c | 1 - subsys/net/l2/wifi/Kconfig | 16 -------- subsys/net/l2/wifi/wifi_mgmt.c | 25 ------------ subsys/net/l2/wifi/wifi_shell.c | 32 --------------- 12 files changed, 2 insertions(+), 176 deletions(-) diff --git a/drivers/wifi/nrf_wifi/inc/fmac_main.h b/drivers/wifi/nrf_wifi/inc/fmac_main.h index 7a863d8b614a..c193515ae2dd 100644 --- a/drivers/wifi/nrf_wifi/inc/fmac_main.h +++ b/drivers/wifi/nrf_wifi/inc/fmac_main.h @@ -91,7 +91,6 @@ struct nrf_wifi_vif_ctx_zep { struct k_work_delayable nrf_wifi_rpu_recovery_bringup_work; #endif /* CONFIG_NRF_WIFI_RPU_RECOVERY */ int rts_threshold_value; - unsigned short bss_max_idle_period; }; struct nrf_wifi_vif_ctx_map { diff --git a/drivers/wifi/nrf_wifi/inc/wifi_mgmt.h b/drivers/wifi/nrf_wifi/inc/wifi_mgmt.h index 9b84427cdca4..a4ae20302100 100644 --- a/drivers/wifi/nrf_wifi/inc/wifi_mgmt.h +++ b/drivers/wifi/nrf_wifi/inc/wifi_mgmt.h @@ -77,7 +77,4 @@ int nrf_wifi_set_rts_threshold(const struct device *dev, int nrf_wifi_get_rts_threshold(const struct device *dev, unsigned int *rts_threshold); - -int nrf_wifi_set_bss_max_idle_period(const struct device *dev, - unsigned short bss_max_idle_period); #endif /* __ZEPHYR_WIFI_MGMT_H__ */ diff --git a/drivers/wifi/nrf_wifi/src/fmac_main.c b/drivers/wifi/nrf_wifi/src/fmac_main.c index f2d9aa55af9f..379c3242b182 100644 --- a/drivers/wifi/nrf_wifi/src/fmac_main.c +++ b/drivers/wifi/nrf_wifi/src/fmac_main.c @@ -858,9 +858,6 @@ static int nrf_wifi_drv_main_zep(const struct device *dev) #endif /* CONFIG_NRF70_RADIO_TEST */ k_mutex_init(&rpu_drv_priv_zep.rpu_ctx_zep.rpu_lock); -#ifndef CONFIG_NRF70_RADIO_TEST - vif_ctx_zep->bss_max_idle_period = USHRT_MAX; -#endif /* !CONFIG_NRF70_RADIO_TEST */ return 0; #ifdef CONFIG_NRF70_RADIO_TEST fmac_deinit: @@ -888,7 +885,6 @@ static const struct wifi_mgmt_ops nrf_wifi_mgmt_ops = { .get_power_save_config = nrf_wifi_get_power_save_config, .set_rts_threshold = nrf_wifi_set_rts_threshold, .get_rts_threshold = nrf_wifi_get_rts_threshold, - .set_bss_max_idle_period = nrf_wifi_set_bss_max_idle_period, #endif #ifdef CONFIG_NRF70_SYSTEM_WITH_RAW_MODES .mode = nrf_wifi_mode, diff --git a/drivers/wifi/nrf_wifi/src/wifi_mgmt.c b/drivers/wifi/nrf_wifi/src/wifi_mgmt.c index e9755e80013e..a323faf21dd6 100644 --- a/drivers/wifi/nrf_wifi/src/wifi_mgmt.c +++ b/drivers/wifi/nrf_wifi/src/wifi_mgmt.c @@ -1077,56 +1077,3 @@ int nrf_wifi_get_rts_threshold(const struct device *dev, return ret; } - -int nrf_wifi_set_bss_max_idle_period(const struct device *dev, - unsigned short bss_max_idle_period) -{ - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - int ret = -1; - - if (!dev) { - LOG_ERR("%s: dev is NULL", __func__); - return ret; - } - - vif_ctx_zep = dev->data; - - if (!vif_ctx_zep) { - LOG_ERR("%s: vif_ctx_zep is NULL", __func__); - return ret; - } - - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - - if (!rpu_ctx_zep) { - LOG_ERR("%s: rpu_ctx_zep is NULL", __func__); - return ret; - } - - - if (!rpu_ctx_zep->rpu_ctx) { - LOG_ERR("%s: RPU context not initialized", __func__); - return ret; - } - - if (((int)bss_max_idle_period < 0) || - (bss_max_idle_period > 64000)) { - /* 0 or value less than 64000 is passed to f/w. - * All other values considered as invalid. - */ - LOG_ERR("%s: Invalid max_idle_period value : %d", - __func__, (int)bss_max_idle_period); - return ret; - } - - k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); - - vif_ctx_zep->bss_max_idle_period = bss_max_idle_period; - - ret = 0; - - k_mutex_unlock(&vif_ctx_zep->vif_lock); - - return ret; -} diff --git a/drivers/wifi/nrf_wifi/src/wpa_supp_if.c b/drivers/wifi/nrf_wifi/src/wpa_supp_if.c index 21f7600ca80a..34af00e6d388 100644 --- a/drivers/wifi/nrf_wifi/src/wpa_supp_if.c +++ b/drivers/wifi/nrf_wifi/src/wpa_supp_if.c @@ -931,10 +931,8 @@ int nrf_wifi_wpa_supp_associate(void *if_priv, struct wpa_driver_associate_param assoc_info.use_mfp = NRF_WIFI_MFP_REQUIRED; } - if (vif_ctx_zep->bss_max_idle_period == USHRT_MAX) { - assoc_info.bss_max_idle_time = CONFIG_WIFI_MGMT_BSS_MAX_IDLE_TIME; - } else { - assoc_info.bss_max_idle_time = vif_ctx_zep->bss_max_idle_period; + if (params->bss_max_idle_period) { + assoc_info.bss_max_idle_time = params->bss_max_idle_period; } assoc_info.conn_type = NRF_WIFI_CONN_TYPE_OPEN; diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index 00c83a986ea1..5477b6a3c0e9 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -133,8 +133,6 @@ enum net_request_wifi_cmd { NET_REQUEST_WIFI_CMD_CANDIDATE_SCAN, /** AP WPS config */ NET_REQUEST_WIFI_CMD_AP_WPS_CONFIG, - /** Configure BSS maximum idle period */ - NET_REQUEST_WIFI_CMD_BSS_MAX_IDLE_PERIOD, /** @cond INTERNAL_HIDDEN */ NET_REQUEST_WIFI_CMD_MAX /** @endcond */ @@ -319,11 +317,6 @@ NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_START_ROAMING); NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_NEIGHBOR_REP_COMPLETE); -#define NET_REQUEST_WIFI_BSS_MAX_IDLE_PERIOD \ - (NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_BSS_MAX_IDLE_PERIOD) - -NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_BSS_MAX_IDLE_PERIOD); - /** @brief Wi-Fi management events */ enum net_event_wifi_cmd { /** Scan results available */ @@ -1566,15 +1559,6 @@ struct wifi_mgmt_ops { * @return 0 if ok, < 0 if error */ int (*start_11r_roaming)(const struct device *dev); - /** Set BSS max idle period - * - * @param dev Pointer to the device structure for the driver instance. - * @param BSS max idle period value - * - * @return 0 if ok, < 0 if error - */ - int (*set_bss_max_idle_period)(const struct device *dev, - unsigned short bss_max_idle_period); }; /** Wi-Fi management offload API */ diff --git a/modules/hostap/src/supp_api.c b/modules/hostap/src/supp_api.c index 3679808b3d4b..cde1ef95f478 100644 --- a/modules/hostap/src/supp_api.c +++ b/modules/hostap/src/supp_api.c @@ -1811,19 +1811,6 @@ int supplicant_legacy_roam(const struct device *dev) return ret; } -int supplicant_set_bss_max_idle_period(const struct device *dev, - unsigned short bss_max_idle_period) -{ - const struct wifi_mgmt_ops *const wifi_mgmt_api = get_wifi_mgmt_api(dev); - - if (!wifi_mgmt_api || !wifi_mgmt_api->set_bss_max_idle_period) { - wpa_printf(MSG_ERROR, "set_bss_max_idle_period is not supported"); - return -ENOTSUP; - } - - return wifi_mgmt_api->set_bss_max_idle_period(dev, bss_max_idle_period); -} - #ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_WNM int supplicant_btm_query(const struct device *dev, uint8_t reason) { diff --git a/modules/hostap/src/supp_api.h b/modules/hostap/src/supp_api.h index 9d2b90b50fe0..ddd3c3d66988 100644 --- a/modules/hostap/src/supp_api.h +++ b/modules/hostap/src/supp_api.h @@ -305,14 +305,6 @@ int supplicant_get_wifi_conn_params(const struct device *dev, */ int supplicant_wps_config(const struct device *dev, struct wifi_wps_config_params *params); -/** @ Set Wi-Fi max idle period - * - * @param dev Wi-Fi interface handle to use - * @param bss_max_idle_period Maximum idle period to set - * @return 0 for OK; -1 for ERROR - */ -int supplicant_set_bss_max_idle_period(const struct device *dev, - unsigned short bss_max_idle_period); #ifdef CONFIG_AP int set_ap_bandwidth(const struct device *dev, enum wifi_frequency_bandwidths bandwidth); diff --git a/modules/hostap/src/supp_main.c b/modules/hostap/src/supp_main.c index 849ba834ec18..c2a4866b9218 100644 --- a/modules/hostap/src/supp_main.c +++ b/modules/hostap/src/supp_main.c @@ -83,7 +83,6 @@ static const struct wifi_mgmt_ops mgmt_ops = { #endif .get_conn_params = supplicant_get_wifi_conn_params, .wps_config = supplicant_wps_config, - .set_bss_max_idle_period = supplicant_set_bss_max_idle_period, #ifdef CONFIG_AP .ap_enable = supplicant_ap_enable, .ap_disable = supplicant_ap_disable, diff --git a/subsys/net/l2/wifi/Kconfig b/subsys/net/l2/wifi/Kconfig index 7728678cc979..4b1d309066c3 100644 --- a/subsys/net/l2/wifi/Kconfig +++ b/subsys/net/l2/wifi/Kconfig @@ -154,19 +154,3 @@ config HEAP_MEM_POOL_ADD_SIZE_WIFI_CERT endif # WIFI_SHELL_RUNTIME_CERTIFICATES endif # WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE - -config WIFI_MGMT_BSS_MAX_IDLE_TIME - int "BSS max idle timeout in seconds" - range 0 64000 - default 30 - help - As per 802.11-2020: 11.21.13 BSS max idle period management - If dot11WirelessManagementImplemented is true, dot11BSSMaxIdlePeriod is - nonzero and dot11BSSMaxIdlePeriodIndicationByNonAPSTA is true, then a - non-S1G non-AP STA shall include a BSS Max Idle Period element - in the (Re)Association Request frame. If the BSS Max Idle Period - element is present in the (Re)Association Request frame received - by a non-S1G AP that has dot11BSSMaxIdlePeriodIndicationByNonAPSTA - equal to true, then the non-S1G AP may choose the non-AP STA’s - preferred maximum idle period. The non-S1G AP indicates its chosen - value to the non-S1G STA in the (Re)Association Response frame. diff --git a/subsys/net/l2/wifi/wifi_mgmt.c b/subsys/net/l2/wifi/wifi_mgmt.c index 67f1f68e5a5a..dc52c42a5c2f 100644 --- a/subsys/net/l2/wifi/wifi_mgmt.c +++ b/subsys/net/l2/wifi/wifi_mgmt.c @@ -1403,31 +1403,6 @@ static int wifi_set_enterprise_creds(uint32_t mgmt_request, struct net_if *iface NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_ENTERPRISE_CREDS, wifi_set_enterprise_creds); #endif -static int wifi_set_bss_max_idle_period(uint32_t mgmt_request, struct net_if *iface, - void *data, size_t len) -{ - const struct device *dev = net_if_get_device(iface); - const struct wifi_mgmt_ops *const wifi_mgmt_api = get_wifi_api(iface); - unsigned short *bss_max_idle_period = data; - - if (wifi_mgmt_api == NULL || wifi_mgmt_api->set_bss_max_idle_period == NULL) { - return -ENOTSUP; - } - - if (!net_if_is_admin_up(iface)) { - return -ENETDOWN; - } - - if (!data || len != sizeof(*bss_max_idle_period)) { - return -EINVAL; - } - - return wifi_mgmt_api->set_bss_max_idle_period(dev, *bss_max_idle_period); -} - -NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_BSS_MAX_IDLE_PERIOD, - wifi_set_bss_max_idle_period); - #ifdef CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS void wifi_mgmt_raise_raw_scan_result_event(struct net_if *iface, struct wifi_raw_scan_result *raw_scan_result) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 6ef17817aa45..07514b53a336 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -3455,32 +3455,6 @@ static int cmd_wifi_pmksa_flush(const struct shell *sh, size_t argc, char *argv[ return 0; } - -static int cmd_wifi_set_bss_max_idle_period(const struct shell *sh, size_t argc, char *argv[]) -{ - struct net_if *iface = get_iface(IFACE_TYPE_STA, argc, argv); - unsigned short bss_max_idle_period = 0; - int idx = 1; - unsigned long val = 0; - - if (!parse_number(sh, &val, argv[idx++], "bss_max_idle_period", 0, USHRT_MAX)) { - return -EINVAL; - } - - bss_max_idle_period = (unsigned short)val; - - if (net_mgmt(NET_REQUEST_WIFI_BSS_MAX_IDLE_PERIOD, iface, - &bss_max_idle_period, sizeof(bss_max_idle_period))) { - shell_fprintf(sh, SHELL_WARNING, - "Setting BSS maximum idle period failed.\n"); - return -ENOEXEC; - } - - shell_fprintf(sh, SHELL_NORMAL, "BSS max idle period: %hu\n", bss_max_idle_period); - - return 0; -} - SHELL_STATIC_SUBCMD_SET_CREATE( wifi_cmd_ap, SHELL_CMD_ARG(disable, NULL, "Disable Access Point mode.\n" @@ -3956,12 +3930,6 @@ SHELL_SUBCMD_ADD((wifi), ps_exit_strategy, NULL, cmd_wifi_ps_exit_strategy, 2, 2); -SHELL_SUBCMD_ADD((wifi), bss_max_idle_period, NULL, - ".\n" - "[-i, --iface=] : Interface index.\n", - cmd_wifi_set_bss_max_idle_period, - 2, 2); - SHELL_CMD_REGISTER(wifi, &wifi_commands, "Wi-Fi commands", NULL); static int wifi_shell_init(void) From 8b3dda735e1b57360d80423698f4897c7a790c8b Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Thu, 24 Apr 2025 19:30:07 +0300 Subject: [PATCH 0597/2141] [nrf fromtree] net: mgmt: Convert the mgmt API to use 64-bit masks Instead of using 32 bit enum values for event numbers, convert the code to use 64 bit long bit fields. This means that the user API is changed to use 64 bit event values instead of 32 bit event values. Signed-off-by: Jukka Rissanen (cherry picked from commit 5a9a39caf3bf5195a38194bb844a428eaa7f2bb8) Signed-off-by: Robert Lubos --- .../networking/api/coap_server.rst | 2 +- doc/connectivity/networking/api/net_mgmt.rst | 6 +- drivers/modem/modem_cellular.c | 2 +- drivers/wifi/esp32/src/esp_wifi_drv.c | 2 +- include/zephyr/net/coap_mgmt.h | 20 +- include/zephyr/net/conn_mgr_connectivity.h | 14 +- include/zephyr/net/ethernet_mgmt.h | 20 +- include/zephyr/net/ieee802154_mgmt.h | 11 +- include/zephyr/net/net_event.h | 245 ++++++++++++------ include/zephyr/net/net_mgmt.h | 85 +++--- include/zephyr/net/ppp.h | 20 +- include/zephyr/net/socket_net_mgmt.h | 2 +- include/zephyr/net/wifi_mgmt.h | 63 +++-- modules/hostap/src/supp_events.h | 27 +- modules/hostap/src/supp_main.c | 4 +- samples/boards/nxp/s32/netc/src/main.c | 2 +- samples/net/capture/src/main.c | 4 +- samples/net/cloud/mqtt_azure/src/main.c | 2 +- samples/net/cloud/tagoio_http_post/src/wifi.c | 2 +- samples/net/common/net_sample_common.c | 2 +- samples/net/dhcpv4_client/src/main.c | 2 +- samples/net/dns_resolve/src/main.c | 2 +- samples/net/dsa/src/main.c | 2 +- samples/net/ipv4_autoconf/src/main.c | 2 +- samples/net/lwm2m_client/src/lwm2m-client.c | 4 +- samples/net/mqtt_sn_publisher/src/main.c | 2 +- .../secure_mqtt_sensor_actuator/src/main.c | 2 +- samples/net/sockets/coap_download/src/main.c | 2 +- samples/net/sockets/coap_server/src/events.c | 2 +- .../sockets/dumb_http_server_mt/src/main.c | 2 +- .../net/sockets/echo_client/src/echo-client.c | 4 +- .../net/sockets/echo_server/src/echo-server.c | 2 +- samples/net/sockets/packet/src/packet.c | 2 +- samples/net/sockets/txtime/src/main.c | 2 +- samples/net/wifi/apsta_mode/src/main.c | 2 +- samples/subsys/mgmt/updatehub/src/main.c | 2 +- subsys/logging/backends/log_backend_net.c | 2 +- subsys/mgmt/mcumgr/transport/src/smp_udp.c | 2 +- subsys/net/conn_mgr/conn_mgr_connectivity.c | 4 +- subsys/net/conn_mgr/events_handler.c | 16 +- subsys/net/ip/ipv4_autoconf.c | 2 +- subsys/net/ip/ipv6_pe.c | 2 +- subsys/net/ip/net_mgmt.c | 36 +-- subsys/net/ip/net_stats.c | 2 +- subsys/net/ip/pmtu.c | 1 - subsys/net/l2/ethernet/arp.c | 4 +- subsys/net/l2/ethernet/ethernet_mgmt.c | 4 +- subsys/net/l2/ethernet/ethernet_stats.c | 2 +- subsys/net/l2/ethernet/lldp/lldp.c | 4 +- subsys/net/l2/ieee802154/ieee802154_mgmt.c | 18 +- subsys/net/l2/ieee802154/ieee802154_shell.c | 4 +- subsys/net/l2/openthread/openthread.c | 2 +- subsys/net/l2/ppp/ppp_l2.c | 2 +- subsys/net/l2/virtual/virtual_mgmt.c | 4 +- subsys/net/l2/wifi/wifi_mgmt.c | 66 ++--- subsys/net/l2/wifi/wifi_shell.c | 4 +- subsys/net/lib/coap/coap.c | 2 +- subsys/net/lib/coap/coap_server.c | 2 +- subsys/net/lib/config/init.c | 26 +- subsys/net/lib/config/init_clock_sntp.c | 2 +- subsys/net/lib/dhcpv4/dhcpv4.c | 4 +- subsys/net/lib/dhcpv6/dhcpv6.c | 2 +- subsys/net/lib/dns/llmnr_responder.c | 2 +- subsys/net/lib/dns/mdns_responder.c | 8 +- subsys/net/lib/ptp/port.c | 2 +- subsys/net/lib/shell/events.c | 6 +- subsys/net/lib/sockets/sockets_net_mgmt.c | 4 +- subsys/shell/backends/shell_mqtt.c | 2 +- tests/boards/espressif/ethernet/src/main.c | 2 +- tests/boards/espressif/wifi/src/main.c | 2 +- tests/net/conn_mgr_conn/src/main.c | 2 +- tests/net/conn_mgr_monitor/src/main.c | 18 +- tests/net/conn_mgr_nsos/src/main.c | 2 +- tests/net/dhcpv4/client/prj.conf | 3 + tests/net/dhcpv4/client/src/main.c | 4 +- tests/net/dhcpv6/src/main.c | 2 +- tests/net/hostname/src/main.c | 2 +- .../ieee802154/l2/src/ieee802154_shell_test.c | 2 +- tests/net/igmp/src/main.c | 6 +- tests/net/lib/dns_addremove/src/main.c | 2 +- tests/net/mgmt/src/mgmt.c | 43 +-- tests/net/mld/src/main.c | 6 +- tests/net/pmtu/src/main.c | 6 +- 83 files changed, 546 insertions(+), 370 deletions(-) diff --git a/doc/connectivity/networking/api/coap_server.rst b/doc/connectivity/networking/api/coap_server.rst index a2d0d1b77c1f..91ae5ecde47f 100644 --- a/doc/connectivity/networking/api/coap_server.rst +++ b/doc/connectivity/networking/api/coap_server.rst @@ -243,7 +243,7 @@ following example simply prints when an event occurs. #define COAP_EVENTS_SET (NET_EVENT_COAP_OBSERVER_ADDED | NET_EVENT_COAP_OBSERVER_REMOVED | \ NET_EVENT_COAP_SERVICE_STARTED | NET_EVENT_COAP_SERVICE_STOPPED) - void coap_event_handler(uint32_t mgmt_event, struct net_if *iface, + void coap_event_handler(uint64_t mgmt_event, struct net_if *iface, void *info, size_t info_length, void *user_data) { switch (mgmt_event) { diff --git a/doc/connectivity/networking/api/net_mgmt.rst b/doc/connectivity/networking/api/net_mgmt.rst index 2973ee82b041..7c47a63eee2a 100644 --- a/doc/connectivity/networking/api/net_mgmt.rst +++ b/doc/connectivity/networking/api/net_mgmt.rst @@ -97,7 +97,7 @@ An example follows. struct net_mgmt_event_callback ipv4_callback; void callback_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, + uint64_t mgmt_event, struct net_if *iface) { if (mgmt_event == NET_EVENT_IF_xxx) { @@ -139,7 +139,7 @@ Or similarly using :c:macro:`NET_MGMT_REGISTER_EVENT_HANDLER`. #define EVENT_IFACE_SET (NET_EVENT_IF_xxx | NET_EVENT_IF_yyy) #define EVENT_IPV4_SET (NET_EVENT_IPV4_xxx | NET_EVENT_IPV4_yyy) - static void event_handler(uint32_t mgmt_event, struct net_if *iface, + static void event_handler(uint64_t mgmt_event, struct net_if *iface, void *info, size_t info_length, void *user_data) { @@ -183,7 +183,7 @@ You define your handler modeled with this signature: .. code-block:: c - static int your_handler(uint32_t mgmt_event, struct net_if *iface, + static int your_handler(uint64_t mgmt_event, struct net_if *iface, void *data, size_t len); and then register it with an associated mgmt_request code: diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index 1c00525b7d86..8eb87fd36082 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -1774,7 +1774,7 @@ static int modem_cellular_pm_action(const struct device *dev, enum pm_device_act } #endif /* CONFIG_PM_DEVICE */ -static void net_mgmt_event_handler(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, +static void net_mgmt_event_handler(struct net_mgmt_event_callback *cb, uint64_t mgmt_event, struct net_if *iface) { struct modem_cellular_data *data = diff --git a/drivers/wifi/esp32/src/esp_wifi_drv.c b/drivers/wifi/esp32/src/esp_wifi_drv.c index 305994d6a328..72c4c5127173 100644 --- a/drivers/wifi/esp32/src/esp_wifi_drv.c +++ b/drivers/wifi/esp32/src/esp_wifi_drv.c @@ -77,7 +77,7 @@ struct esp32_wifi_runtime { static struct net_mgmt_event_callback esp32_dhcp_cb; -static void wifi_event_handler(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, +static void wifi_event_handler(struct net_mgmt_event_callback *cb, uint64_t mgmt_event, struct net_if *iface) { switch (mgmt_event) { diff --git a/include/zephyr/net/coap_mgmt.h b/include/zephyr/net/coap_mgmt.h index 961ca18d1ab1..0cc25a9cb18d 100644 --- a/include/zephyr/net/coap_mgmt.h +++ b/include/zephyr/net/coap_mgmt.h @@ -40,13 +40,25 @@ struct coap_service; struct coap_resource; struct coap_observer; +enum { + NET_EVENT_COAP_CMD_SERVICE_STARTED_VAL, + NET_EVENT_COAP_CMD_SERVICE_STOPPED_VAL, + NET_EVENT_COAP_CMD_OBSERVER_ADDED_VAL, + NET_EVENT_COAP_CMD_OBSERVER_REMOVED_VAL, + + NET_EVENT_COAP_CMD_MAX +}; + +BUILD_ASSERT(NET_EVENT_COAP_CMD_MAX <= NET_MGMT_MAX_COMMANDS, + "Number of events in net_event_coap_cmd exceeds the limit"); + enum net_event_coap_cmd { /* Service events */ - NET_EVENT_COAP_CMD_SERVICE_STARTED = 1, - NET_EVENT_COAP_CMD_SERVICE_STOPPED, + NET_MGMT_CMD(NET_EVENT_COAP_CMD_SERVICE_STARTED), + NET_MGMT_CMD(NET_EVENT_COAP_CMD_SERVICE_STOPPED), /* Observer events */ - NET_EVENT_COAP_CMD_OBSERVER_ADDED, - NET_EVENT_COAP_CMD_OBSERVER_REMOVED, + NET_MGMT_CMD(NET_EVENT_COAP_CMD_OBSERVER_ADDED), + NET_MGMT_CMD(NET_EVENT_COAP_CMD_OBSERVER_REMOVED), }; /** @endcond */ diff --git a/include/zephyr/net/conn_mgr_connectivity.h b/include/zephyr/net/conn_mgr_connectivity.h index d1b0ea8106a5..cb0f63fcfac0 100644 --- a/include/zephyr/net/conn_mgr_connectivity.h +++ b/include/zephyr/net/conn_mgr_connectivity.h @@ -41,9 +41,19 @@ extern "C" { NET_MGMT_EVENT_BIT) #define NET_MGMT_CONN_IF_EVENT (NET_MGMT_IFACE_BIT | NET_MGMT_CONN_BASE) +enum { + NET_EVENT_CONN_CMD_IF_TIMEOUT_VAL, + NET_EVENT_CONN_CMD_IF_FATAL_ERROR_VAL, + + NET_EVENT_CONN_CMD_MAX +}; + +BUILD_ASSERT(NET_EVENT_CONN_CMD_MAX <= NET_MGMT_MAX_COMMANDS, + "Number of events in net_event_conn_cmd exceeds the limit"); + enum net_event_conn_cmd { - NET_EVENT_CONN_CMD_IF_TIMEOUT = 1, - NET_EVENT_CONN_CMD_IF_FATAL_ERROR, + NET_MGMT_CMD(NET_EVENT_CONN_CMD_IF_TIMEOUT), + NET_MGMT_CMD(NET_EVENT_CONN_CMD_IF_FATAL_ERROR), }; /** @endcond */ diff --git a/include/zephyr/net/ethernet_mgmt.h b/include/zephyr/net/ethernet_mgmt.h index 750e899da20b..79306e9195aa 100644 --- a/include/zephyr/net/ethernet_mgmt.h +++ b/include/zephyr/net/ethernet_mgmt.h @@ -188,11 +188,23 @@ struct ethernet_req_params { }; }; +enum { + NET_EVENT_ETHERNET_CMD_CARRIER_ON_VAL, + NET_EVENT_ETHERNET_CMD_CARRIER_OFF_VAL, + NET_EVENT_ETHERNET_CMD_VLAN_TAG_ENABLED_VAL, + NET_EVENT_ETHERNET_CMD_VLAN_TAG_DISABLED_VAL, + + NET_EVENT_ETHERNET_CMD_MAX +}; + +BUILD_ASSERT(NET_EVENT_ETHERNET_CMD_MAX <= NET_MGMT_MAX_COMMANDS, + "Number of events in net_event_ethernet_cmd exceeds the limit"); + enum net_event_ethernet_cmd { - NET_EVENT_ETHERNET_CMD_CARRIER_ON = 1, - NET_EVENT_ETHERNET_CMD_CARRIER_OFF, - NET_EVENT_ETHERNET_CMD_VLAN_TAG_ENABLED, - NET_EVENT_ETHERNET_CMD_VLAN_TAG_DISABLED, + NET_MGMT_CMD(NET_EVENT_ETHERNET_CMD_CARRIER_ON), + NET_MGMT_CMD(NET_EVENT_ETHERNET_CMD_CARRIER_OFF), + NET_MGMT_CMD(NET_EVENT_ETHERNET_CMD_VLAN_TAG_ENABLED), + NET_MGMT_CMD(NET_EVENT_ETHERNET_CMD_VLAN_TAG_DISABLED), }; #define NET_EVENT_ETHERNET_CARRIER_ON \ diff --git a/include/zephyr/net/ieee802154_mgmt.h b/include/zephyr/net/ieee802154_mgmt.h index bf20b49b7208..970f8a89a9c6 100644 --- a/include/zephyr/net/ieee802154_mgmt.h +++ b/include/zephyr/net/ieee802154_mgmt.h @@ -255,8 +255,17 @@ NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_IEEE802154_GET_SECURITY_SETTINGS); * @cond INTERNAL_HIDDEN */ +enum { + NET_EVENT_IEEE802154_CMD_SCAN_RESULT_VAL, + + NET_EVENT_IEEE802154_CMD_MAX +}; + +BUILD_ASSERT(NET_EVENT_IEEE802154_CMD_MAX <= NET_MGMT_MAX_COMMANDS, + "Number of events in net_event_ieee802154_cmd exceeds the limit"); + enum net_event_ieee802154_cmd { - NET_EVENT_IEEE802154_CMD_SCAN_RESULT = 1, + NET_MGMT_CMD(NET_EVENT_IEEE802154_CMD_SCAN_RESULT), }; /** diff --git a/include/zephyr/net/net_event.h b/include/zephyr/net/net_event.h index 0b8c995cd3e9..3a948ca5ef96 100644 --- a/include/zephyr/net/net_event.h +++ b/include/zephyr/net/net_event.h @@ -34,11 +34,23 @@ extern "C" { NET_MGMT_LAYER(NET_IF_LAYER) | \ NET_MGMT_LAYER_CODE(NET_IF_CORE_CODE)) +enum { + NET_EVENT_IF_CMD_DOWN_VAL, + NET_EVENT_IF_CMD_UP_VAL, + NET_EVENT_IF_CMD_ADMIN_DOWN_VAL, + NET_EVENT_IF_CMD_ADMIN_UP_VAL, + + NET_EVENT_IF_CMD_MAX +}; + +BUILD_ASSERT(NET_EVENT_IF_CMD_MAX <= NET_MGMT_MAX_COMMANDS, + "Number of events in net_event_if_cmd exceeds the limit"); + enum net_event_if_cmd { - NET_EVENT_IF_CMD_DOWN = 1, - NET_EVENT_IF_CMD_UP, - NET_EVENT_IF_CMD_ADMIN_DOWN, - NET_EVENT_IF_CMD_ADMIN_UP, + NET_MGMT_CMD(NET_EVENT_IF_CMD_DOWN), + NET_MGMT_CMD(NET_EVENT_IF_CMD_UP), + NET_MGMT_CMD(NET_EVENT_IF_CMD_ADMIN_DOWN), + NET_MGMT_CMD(NET_EVENT_IF_CMD_ADMIN_UP), }; /* IPv6 Events */ @@ -49,32 +61,65 @@ enum net_event_if_cmd { NET_MGMT_LAYER(NET_IPV6_LAYER) | \ NET_MGMT_LAYER_CODE(NET_IPV6_CORE_CODE)) +enum { + NET_EVENT_IPV6_CMD_ADDR_ADD_VAL, + NET_EVENT_IPV6_CMD_ADDR_DEL_VAL, + NET_EVENT_IPV6_CMD_MADDR_ADD_VAL, + NET_EVENT_IPV6_CMD_MADDR_DEL_VAL, + NET_EVENT_IPV6_CMD_PREFIX_ADD_VAL, + NET_EVENT_IPV6_CMD_PREFIX_DEL_VAL, + NET_EVENT_IPV6_CMD_MCAST_JOIN_VAL, + NET_EVENT_IPV6_CMD_MCAST_LEAVE_VAL, + NET_EVENT_IPV6_CMD_ROUTER_ADD_VAL, + NET_EVENT_IPV6_CMD_ROUTER_DEL_VAL, + NET_EVENT_IPV6_CMD_ROUTE_ADD_VAL, + NET_EVENT_IPV6_CMD_ROUTE_DEL_VAL, + NET_EVENT_IPV6_CMD_DAD_SUCCEED_VAL, + NET_EVENT_IPV6_CMD_DAD_FAILED_VAL, + NET_EVENT_IPV6_CMD_NBR_ADD_VAL, + NET_EVENT_IPV6_CMD_NBR_DEL_VAL, + NET_EVENT_IPV6_CMD_DHCP_START_VAL, + NET_EVENT_IPV6_CMD_DHCP_BOUND_VAL, + NET_EVENT_IPV6_CMD_DHCP_STOP_VAL, + NET_EVENT_IPV6_CMD_ADDR_DEPRECATED_VAL, + NET_EVENT_IPV6_CMD_PE_ENABLED_VAL, + NET_EVENT_IPV6_CMD_PE_DISABLED_VAL, + NET_EVENT_IPV6_CMD_PE_FILTER_ADD_VAL, + NET_EVENT_IPV6_CMD_PE_FILTER_DEL_VAL, + NET_EVENT_IPV6_CMD_PMTU_CHANGED_VAL, + + NET_EVENT_IPV6_CMD_MAX +}; + +BUILD_ASSERT(NET_EVENT_IPV6_CMD_MAX <= NET_MGMT_MAX_COMMANDS, + "Number of events in net_event_ipv6_cmd exceeds the limit"); + enum net_event_ipv6_cmd { - NET_EVENT_IPV6_CMD_ADDR_ADD = 1, - NET_EVENT_IPV6_CMD_ADDR_DEL, - NET_EVENT_IPV6_CMD_MADDR_ADD, - NET_EVENT_IPV6_CMD_MADDR_DEL, - NET_EVENT_IPV6_CMD_PREFIX_ADD, - NET_EVENT_IPV6_CMD_PREFIX_DEL, - NET_EVENT_IPV6_CMD_MCAST_JOIN, - NET_EVENT_IPV6_CMD_MCAST_LEAVE, - NET_EVENT_IPV6_CMD_ROUTER_ADD, - NET_EVENT_IPV6_CMD_ROUTER_DEL, - NET_EVENT_IPV6_CMD_ROUTE_ADD, - NET_EVENT_IPV6_CMD_ROUTE_DEL, - NET_EVENT_IPV6_CMD_DAD_SUCCEED, - NET_EVENT_IPV6_CMD_DAD_FAILED, - NET_EVENT_IPV6_CMD_NBR_ADD, - NET_EVENT_IPV6_CMD_NBR_DEL, - NET_EVENT_IPV6_CMD_DHCP_START, - NET_EVENT_IPV6_CMD_DHCP_BOUND, - NET_EVENT_IPV6_CMD_DHCP_STOP, - NET_EVENT_IPV6_CMD_ADDR_DEPRECATED, - NET_EVENT_IPV6_CMD_PE_ENABLED, - NET_EVENT_IPV6_CMD_PE_DISABLED, - NET_EVENT_IPV6_CMD_PE_FILTER_ADD, - NET_EVENT_IPV6_CMD_PE_FILTER_DEL, - NET_EVENT_IPV6_CMD_PMTU_CHANGED, + NET_MGMT_CMD(NET_EVENT_IPV6_CMD_ADDR_ADD), + NET_MGMT_CMD(NET_EVENT_IPV6_CMD_ADDR_DEL), + NET_MGMT_CMD(NET_EVENT_IPV6_CMD_MADDR_ADD), + NET_MGMT_CMD(NET_EVENT_IPV6_CMD_MADDR_DEL), + NET_MGMT_CMD(NET_EVENT_IPV6_CMD_PREFIX_ADD), + NET_MGMT_CMD(NET_EVENT_IPV6_CMD_PREFIX_DEL), + NET_MGMT_CMD(NET_EVENT_IPV6_CMD_MCAST_JOIN), + NET_MGMT_CMD(NET_EVENT_IPV6_CMD_MCAST_LEAVE), + NET_MGMT_CMD(NET_EVENT_IPV6_CMD_ROUTER_ADD), + NET_MGMT_CMD(NET_EVENT_IPV6_CMD_ROUTER_DEL), + NET_MGMT_CMD(NET_EVENT_IPV6_CMD_ROUTE_ADD), + NET_MGMT_CMD(NET_EVENT_IPV6_CMD_ROUTE_DEL), + NET_MGMT_CMD(NET_EVENT_IPV6_CMD_DAD_SUCCEED), + NET_MGMT_CMD(NET_EVENT_IPV6_CMD_DAD_FAILED), + NET_MGMT_CMD(NET_EVENT_IPV6_CMD_NBR_ADD), + NET_MGMT_CMD(NET_EVENT_IPV6_CMD_NBR_DEL), + NET_MGMT_CMD(NET_EVENT_IPV6_CMD_DHCP_START), + NET_MGMT_CMD(NET_EVENT_IPV6_CMD_DHCP_BOUND), + NET_MGMT_CMD(NET_EVENT_IPV6_CMD_DHCP_STOP), + NET_MGMT_CMD(NET_EVENT_IPV6_CMD_ADDR_DEPRECATED), + NET_MGMT_CMD(NET_EVENT_IPV6_CMD_PE_ENABLED), + NET_MGMT_CMD(NET_EVENT_IPV6_CMD_PE_DISABLED), + NET_MGMT_CMD(NET_EVENT_IPV6_CMD_PE_FILTER_ADD), + NET_MGMT_CMD(NET_EVENT_IPV6_CMD_PE_FILTER_DEL), + NET_MGMT_CMD(NET_EVENT_IPV6_CMD_PMTU_CHANGED), }; /* IPv4 Events*/ @@ -85,22 +130,45 @@ enum net_event_ipv6_cmd { NET_MGMT_LAYER(NET_IPV4_LAYER) | \ NET_MGMT_LAYER_CODE(NET_IPV4_CORE_CODE)) +enum { + NET_EVENT_IPV4_CMD_ADDR_ADD_VAL, + NET_EVENT_IPV4_CMD_ADDR_DEL_VAL, + NET_EVENT_IPV4_CMD_MADDR_ADD_VAL, + NET_EVENT_IPV4_CMD_MADDR_DEL_VAL, + NET_EVENT_IPV4_CMD_ROUTER_ADD_VAL, + NET_EVENT_IPV4_CMD_ROUTER_DEL_VAL, + NET_EVENT_IPV4_CMD_DHCP_START_VAL, + NET_EVENT_IPV4_CMD_DHCP_BOUND_VAL, + NET_EVENT_IPV4_CMD_DHCP_STOP_VAL, + NET_EVENT_IPV4_CMD_MCAST_JOIN_VAL, + NET_EVENT_IPV4_CMD_MCAST_LEAVE_VAL, + NET_EVENT_IPV4_CMD_ACD_SUCCEED_VAL, + NET_EVENT_IPV4_CMD_ACD_FAILED_VAL, + NET_EVENT_IPV4_CMD_ACD_CONFLICT_VAL, + NET_EVENT_IPV4_CMD_PMTU_CHANGED_VAL, + + NET_EVENT_IPV4_CMD_MAX +}; + +BUILD_ASSERT(NET_EVENT_IPV4_CMD_MAX <= NET_MGMT_MAX_COMMANDS, + "Number of events in net_event_ipv4_cmd exceeds the limit"); + enum net_event_ipv4_cmd { - NET_EVENT_IPV4_CMD_ADDR_ADD = 1, - NET_EVENT_IPV4_CMD_ADDR_DEL, - NET_EVENT_IPV4_CMD_MADDR_ADD, - NET_EVENT_IPV4_CMD_MADDR_DEL, - NET_EVENT_IPV4_CMD_ROUTER_ADD, - NET_EVENT_IPV4_CMD_ROUTER_DEL, - NET_EVENT_IPV4_CMD_DHCP_START, - NET_EVENT_IPV4_CMD_DHCP_BOUND, - NET_EVENT_IPV4_CMD_DHCP_STOP, - NET_EVENT_IPV4_CMD_MCAST_JOIN, - NET_EVENT_IPV4_CMD_MCAST_LEAVE, - NET_EVENT_IPV4_CMD_ACD_SUCCEED, - NET_EVENT_IPV4_CMD_ACD_FAILED, - NET_EVENT_IPV4_CMD_ACD_CONFLICT, - NET_EVENT_IPV4_CMD_PMTU_CHANGED, + NET_MGMT_CMD(NET_EVENT_IPV4_CMD_ADDR_ADD), + NET_MGMT_CMD(NET_EVENT_IPV4_CMD_ADDR_DEL), + NET_MGMT_CMD(NET_EVENT_IPV4_CMD_MADDR_ADD), + NET_MGMT_CMD(NET_EVENT_IPV4_CMD_MADDR_DEL), + NET_MGMT_CMD(NET_EVENT_IPV4_CMD_ROUTER_ADD), + NET_MGMT_CMD(NET_EVENT_IPV4_CMD_ROUTER_DEL), + NET_MGMT_CMD(NET_EVENT_IPV4_CMD_DHCP_START), + NET_MGMT_CMD(NET_EVENT_IPV4_CMD_DHCP_BOUND), + NET_MGMT_CMD(NET_EVENT_IPV4_CMD_DHCP_STOP), + NET_MGMT_CMD(NET_EVENT_IPV4_CMD_MCAST_JOIN), + NET_MGMT_CMD(NET_EVENT_IPV4_CMD_MCAST_LEAVE), + NET_MGMT_CMD(NET_EVENT_IPV4_CMD_ACD_SUCCEED), + NET_MGMT_CMD(NET_EVENT_IPV4_CMD_ACD_FAILED), + NET_MGMT_CMD(NET_EVENT_IPV4_CMD_ACD_CONFLICT), + NET_MGMT_CMD(NET_EVENT_IPV4_CMD_PMTU_CHANGED), }; /* L4 network events */ @@ -111,22 +179,45 @@ enum net_event_ipv4_cmd { NET_MGMT_LAYER(NET_L4_LAYER) | \ NET_MGMT_LAYER_CODE(NET_L4_CORE_CODE)) +enum { + NET_EVENT_L4_CMD_CONNECTED_VAL, + NET_EVENT_L4_CMD_DISCONNECTED_VAL, + NET_EVENT_L4_CMD_IPV4_CONNECTED_VAL, + NET_EVENT_L4_CMD_IPV4_DISCONNECTED_VAL, + NET_EVENT_L4_CMD_IPV6_CONNECTED_VAL, + NET_EVENT_L4_CMD_IPV6_DISCONNECTED_VAL, + NET_EVENT_L4_CMD_DNS_SERVER_ADD_VAL, + NET_EVENT_L4_CMD_DNS_SERVER_DEL_VAL, + NET_EVENT_L4_CMD_HOSTNAME_CHANGED_VAL, + NET_EVENT_L4_CMD_CAPTURE_STARTED_VAL, + NET_EVENT_L4_CMD_CAPTURE_STOPPED_VAL, + NET_EVENT_L4_CMD_VPN_CONNECTED_VAL, + NET_EVENT_L4_CMD_VPN_DISCONNECTED_VAL, + NET_EVENT_L4_CMD_VPN_PEER_ADD_VAL, + NET_EVENT_L4_CMD_VPN_PEER_DEL_VAL, + + NET_EVENT_L4_CMD_MAX +}; + +BUILD_ASSERT(NET_EVENT_L4_CMD_MAX <= NET_MGMT_MAX_COMMANDS, + "Number of events in net_event_l4_cmd exceeds the limit"); + enum net_event_l4_cmd { - NET_EVENT_L4_CMD_CONNECTED = 1, - NET_EVENT_L4_CMD_DISCONNECTED, - NET_EVENT_L4_CMD_IPV4_CONNECTED, - NET_EVENT_L4_CMD_IPV4_DISCONNECTED, - NET_EVENT_L4_CMD_IPV6_CONNECTED, - NET_EVENT_L4_CMD_IPV6_DISCONNECTED, - NET_EVENT_L4_CMD_DNS_SERVER_ADD, - NET_EVENT_L4_CMD_DNS_SERVER_DEL, - NET_EVENT_L4_CMD_HOSTNAME_CHANGED, - NET_EVENT_L4_CMD_CAPTURE_STARTED, - NET_EVENT_L4_CMD_CAPTURE_STOPPED, - NET_EVENT_L4_CMD_VPN_CONNECTED, - NET_EVENT_L4_CMD_VPN_DISCONNECTED, - NET_EVENT_L4_CMD_VPN_PEER_ADD, - NET_EVENT_L4_CMD_VPN_PEER_DEL, + NET_MGMT_CMD(NET_EVENT_L4_CMD_CONNECTED), + NET_MGMT_CMD(NET_EVENT_L4_CMD_DISCONNECTED), + NET_MGMT_CMD(NET_EVENT_L4_CMD_IPV4_CONNECTED), + NET_MGMT_CMD(NET_EVENT_L4_CMD_IPV4_DISCONNECTED), + NET_MGMT_CMD(NET_EVENT_L4_CMD_IPV6_CONNECTED), + NET_MGMT_CMD(NET_EVENT_L4_CMD_IPV6_DISCONNECTED), + NET_MGMT_CMD(NET_EVENT_L4_CMD_DNS_SERVER_ADD), + NET_MGMT_CMD(NET_EVENT_L4_CMD_DNS_SERVER_DEL), + NET_MGMT_CMD(NET_EVENT_L4_CMD_HOSTNAME_CHANGED), + NET_MGMT_CMD(NET_EVENT_L4_CMD_CAPTURE_STARTED), + NET_MGMT_CMD(NET_EVENT_L4_CMD_CAPTURE_STOPPED), + NET_MGMT_CMD(NET_EVENT_L4_CMD_VPN_CONNECTED), + NET_MGMT_CMD(NET_EVENT_L4_CMD_VPN_DISCONNECTED), + NET_MGMT_CMD(NET_EVENT_L4_CMD_VPN_PEER_ADD), + NET_MGMT_CMD(NET_EVENT_L4_CMD_VPN_PEER_DEL), }; /** @endcond */ @@ -153,11 +244,11 @@ enum net_event_l4_cmd { /** Event emitted when an IPv6 address is removed from the system. */ #define NET_EVENT_IPV6_ADDR_DEL \ - (NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_ADDR_DEL) + (NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_ADDR_DEL) /** Event emitted when an IPv6 multicast address is added to the system. */ #define NET_EVENT_IPV6_MADDR_ADD \ - (NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_MADDR_ADD) + (NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_MADDR_ADD) /** Event emitted when an IPv6 multicast address is removed from the system. */ #define NET_EVENT_IPV6_MADDR_DEL \ @@ -165,19 +256,19 @@ enum net_event_l4_cmd { /** Event emitted when an IPv6 prefix is added to the system. */ #define NET_EVENT_IPV6_PREFIX_ADD \ - (NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_PREFIX_ADD) + (NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_PREFIX_ADD) /** Event emitted when an IPv6 prefix is removed from the system. */ #define NET_EVENT_IPV6_PREFIX_DEL \ - (NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_PREFIX_DEL) + (NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_PREFIX_DEL) /** Event emitted when an IPv6 multicast group is joined. */ #define NET_EVENT_IPV6_MCAST_JOIN \ - (NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_MCAST_JOIN) + (NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_MCAST_JOIN) /** Event emitted when an IPv6 multicast group is left. */ #define NET_EVENT_IPV6_MCAST_LEAVE \ - (NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_MCAST_LEAVE) + (NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_MCAST_LEAVE) /** Event emitted when an IPv6 router is added to the system. */ #define NET_EVENT_IPV6_ROUTER_ADD \ @@ -213,15 +304,15 @@ enum net_event_l4_cmd { /** Event emitted when an IPv6 DHCP client starts. */ #define NET_EVENT_IPV6_DHCP_START \ - (NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_DHCP_START) + (NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_DHCP_START) /** Event emitted when an IPv6 DHCP client address is bound. */ #define NET_EVENT_IPV6_DHCP_BOUND \ - (NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_DHCP_BOUND) + (NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_DHCP_BOUND) /** Event emitted when an IPv6 DHCP client is stopped. */ #define NET_EVENT_IPV6_DHCP_STOP \ - (NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_DHCP_STOP) + (NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_DHCP_STOP) /** IPv6 address is deprecated. */ #define NET_EVENT_IPV6_ADDR_DEPRECATED \ @@ -253,11 +344,11 @@ enum net_event_l4_cmd { /** Event emitted when an IPv4 address is removed from the system. */ #define NET_EVENT_IPV4_ADDR_DEL \ - (NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_ADDR_DEL) + (NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_ADDR_DEL) /** Event emitted when an IPv4 multicast address is added to the system. */ #define NET_EVENT_IPV4_MADDR_ADD \ - (NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_MADDR_ADD) + (NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_MADDR_ADD) /** Event emitted when an IPv4 multicast address is removed from the system. */ #define NET_EVENT_IPV4_MADDR_DEL \ @@ -265,31 +356,31 @@ enum net_event_l4_cmd { /** Event emitted when an IPv4 router is added to the system. */ #define NET_EVENT_IPV4_ROUTER_ADD \ - (NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_ROUTER_ADD) + (NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_ROUTER_ADD) /** Event emitted when an IPv4 router is removed from the system. */ #define NET_EVENT_IPV4_ROUTER_DEL \ - (NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_ROUTER_DEL) + (NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_ROUTER_DEL) /** Event emitted when an IPv4 DHCP client is started. */ #define NET_EVENT_IPV4_DHCP_START \ - (NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_DHCP_START) + (NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_DHCP_START) /** Event emitted when an IPv4 DHCP client address is bound. */ #define NET_EVENT_IPV4_DHCP_BOUND \ - (NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_DHCP_BOUND) + (NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_DHCP_BOUND) /** Event emitted when an IPv4 DHCP client is stopped. */ #define NET_EVENT_IPV4_DHCP_STOP \ - (NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_DHCP_STOP) + (NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_DHCP_STOP) /** Event emitted when an IPv4 multicast group is joined. */ #define NET_EVENT_IPV4_MCAST_JOIN \ - (NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_MCAST_JOIN) + (NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_MCAST_JOIN) /** Event emitted when an IPv4 multicast group is left. */ #define NET_EVENT_IPV4_MCAST_LEAVE \ - (NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_MCAST_LEAVE) + (NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_MCAST_LEAVE) /** Event emitted when an IPv4 address conflict detection succeeds. */ #define NET_EVENT_IPV4_ACD_SUCCEED \ diff --git a/include/zephyr/net/net_mgmt.h b/include/zephyr/net/net_mgmt.h index 04e95cbb5ec1..9c559b7fd8b9 100644 --- a/include/zephyr/net/net_mgmt.h +++ b/include/zephyr/net/net_mgmt.h @@ -14,7 +14,6 @@ #include #include -#include #include #ifdef __cplusplus @@ -36,38 +35,30 @@ struct net_if; /** * @brief NET MGMT event mask basics, normalizing parts of bit fields */ -#define NET_MGMT_EVENT_MASK 0x80000000 -#define NET_MGMT_ON_IFACE_MASK 0x40000000 -#define NET_MGMT_LAYER_MASK 0x30000000 -#define NET_MGMT_SYNC_EVENT_MASK 0x08000000 -#define NET_MGMT_LAYER_CODE_MASK 0x07FF0000 -#define NET_MGMT_COMMAND_MASK 0x0000FFFF - -#define NET_MGMT_EVENT_BIT BIT(31) -#define NET_MGMT_IFACE_BIT BIT(30) -#define NET_MGMT_SYNC_EVENT_BIT BIT(27) - -#define NET_MGMT_LAYER(_layer) (_layer << 28) -#define NET_MGMT_LAYER_CODE(_code) (_code << 16) - -#define NET_MGMT_EVENT(mgmt_request) \ - (mgmt_request & NET_MGMT_EVENT_MASK) +#define NET_MGMT_EVENT_MASK GENMASK64(63, 63) /* 0x8000000000000000 */ +#define NET_MGMT_ON_IFACE_MASK GENMASK64(62, 62) /* 0x4000000000000000 */ +#define NET_MGMT_LAYER_MASK GENMASK64(61, 60) /* 0x3000000000000000 */ +#define NET_MGMT_SYNC_EVENT_MASK GENMASK64(59, 59) /* 0x0800000000000000 */ +#define NET_MGMT_LAYER_CODE_MASK GENMASK64(58, 52) /* 0x07F0000000000000 */ +#define NET_MGMT_COMMAND_MASK GENMASK64(51, 0) /* 0x000FFFFFFFFFFFFF */ -#define NET_MGMT_ON_IFACE(mgmt_request) \ - (mgmt_request & NET_MGMT_ON_IFACE_MASK) +#define NET_MGMT_MAX_COMMANDS 52 /* TODO: figure out the value from mask */ -#define NET_MGMT_EVENT_SYNCHRONOUS(mgmt_request) \ - (mgmt_request & NET_MGMT_SYNC_EVENT_MASK) +#define NET_MGMT_EVENT_BIT BIT64(63) +#define NET_MGMT_IFACE_BIT BIT64(62) +#define NET_MGMT_SYNC_EVENT_BIT BIT64(59) -#define NET_MGMT_GET_LAYER(mgmt_request) \ - ((mgmt_request & NET_MGMT_LAYER_MASK) >> 28) +#define NET_MGMT_LAYER(_layer) FIELD_PREP(NET_MGMT_LAYER_MASK, (_layer)) +#define NET_MGMT_LAYER_CODE(_code) FIELD_PREP(NET_MGMT_LAYER_CODE_MASK, (_code)) -#define NET_MGMT_GET_LAYER_CODE(mgmt_request) \ - ((mgmt_request & NET_MGMT_LAYER_CODE_MASK) >> 16) - -#define NET_MGMT_GET_COMMAND(mgmt_request) \ - (mgmt_request & NET_MGMT_COMMAND_MASK) +#define NET_MGMT_EVENT(mgmt_request) FIELD_GET(NET_MGMT_EVENT_MASK, mgmt_request) +#define NET_MGMT_ON_IFACE(mgmt_request) FIELD_GET(NET_MGMT_ON_IFACE_MASK, mgmt_request) +#define NET_MGMT_EVENT_SYNCHRONOUS(mgmt_request) FIELD_GET(NET_MGMT_SYNC_EVENT_MASK, mgmt_request) +#define NET_MGMT_GET_LAYER(mgmt_request) FIELD_GET(NET_MGMT_LAYER_MASK, mgmt_request) +#define NET_MGMT_GET_LAYER_CODE(mgmt_request) FIELD_GET(NET_MGMT_LAYER_CODE_MASK, mgmt_request) +#define NET_MGMT_GET_COMMAND(mgmt_request) FIELD_GET(NET_MGMT_COMMAND_MASK, mgmt_request) +#define NET_MGMT_CMD(cmd) cmd = BIT64(cmd ##_VAL) /* Useful generic definitions */ #define NET_MGMT_LAYER_L2 1 @@ -102,6 +93,8 @@ enum net_mgmt_layer_code { NET_MGMT_LAYER_CODE_RESERVED = 0x7F /**< Reserved layer code for future use */ }; +#include + /** * @typedef net_mgmt_request_handler_t * @brief Signature which all Net MGMT request handler need to follow @@ -113,7 +106,7 @@ enum net_mgmt_layer_code { * NULL otherwise. * @param len Length in byte of the memory pointed by data. */ -typedef int (*net_mgmt_request_handler_t)(uint32_t mgmt_request, +typedef int (*net_mgmt_request_handler_t)(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len); @@ -134,7 +127,7 @@ typedef int (*net_mgmt_request_handler_t)(uint32_t mgmt_request, * @param _mgmt_request Management event identifier */ #define NET_MGMT_DEFINE_REQUEST_HANDLER(_mgmt_request) \ - extern int net_mgmt_##_mgmt_request(uint32_t mgmt_request, \ + extern int net_mgmt_##_mgmt_request(uint64_t mgmt_request, \ struct net_if *iface, \ void *data, size_t len) @@ -158,7 +151,7 @@ struct net_mgmt_event_callback; * if it's an event on an iface. NULL otherwise. */ typedef void (*net_mgmt_event_handler_t)(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, + uint64_t mgmt_event, struct net_if *iface); /** @@ -202,11 +195,11 @@ struct net_mgmt_event_callback { * receive events from multiple layers, one must have multiple * listeners registered, one for each layer being listened. */ - uint32_t event_mask; + uint64_t event_mask; /** Internal place holder when a synchronous event wait is * successfully unlocked on a event. */ - uint32_t raised_event; + uint64_t raised_event; }; }; @@ -221,7 +214,7 @@ struct net_mgmt_event_callback { * @param info_length Length in bytes of the memory pointed by @p info. * @param user_data Data provided by the user to the handler. */ -typedef void (*net_mgmt_event_static_handler_t)(uint32_t mgmt_event, +typedef void (*net_mgmt_event_static_handler_t)(uint64_t mgmt_event, struct net_if *iface, void *info, size_t info_length, void *user_data); @@ -230,7 +223,7 @@ typedef void (*net_mgmt_event_static_handler_t)(uint32_t mgmt_event, /* Structure for event handler registered at compile time */ struct net_mgmt_event_static_handler { - uint32_t event_mask; + uint64_t event_mask; net_mgmt_event_static_handler_t handler; void *user_data; }; @@ -267,7 +260,7 @@ struct net_mgmt_event_static_handler { static inline void net_mgmt_init_event_callback(struct net_mgmt_event_callback *cb, net_mgmt_event_handler_t handler, - uint32_t mgmt_event_mask) + uint64_t mgmt_event_mask) { __ASSERT(cb, "Callback pointer should not be NULL"); __ASSERT(handler, "Handler pointer should not be NULL"); @@ -313,7 +306,7 @@ void net_mgmt_del_event_callback(struct net_mgmt_event_callback *cb); * is not defined. */ #if defined(CONFIG_NET_MGMT_EVENT) -void net_mgmt_event_notify_with_info(uint32_t mgmt_event, struct net_if *iface, +void net_mgmt_event_notify_with_info(uint64_t mgmt_event, struct net_if *iface, const void *info, size_t length); #else #define net_mgmt_event_notify_with_info(...) @@ -326,7 +319,7 @@ void net_mgmt_event_notify_with_info(uint32_t mgmt_event, struct net_if *iface, * based on an iface. NULL otherwise. */ #if defined(CONFIG_NET_MGMT_EVENT) -static inline void net_mgmt_event_notify(uint32_t mgmt_event, +static inline void net_mgmt_event_notify(uint64_t mgmt_event, struct net_if *iface) { net_mgmt_event_notify_with_info(mgmt_event, iface, NULL, 0); @@ -356,15 +349,15 @@ static inline void net_mgmt_event_notify(uint32_t mgmt_event, * actual event. */ #ifdef CONFIG_NET_MGMT_EVENT -int net_mgmt_event_wait(uint32_t mgmt_event_mask, - uint32_t *raised_event, +int net_mgmt_event_wait(uint64_t mgmt_event_mask, + uint64_t *raised_event, struct net_if **iface, const void **info, size_t *info_length, k_timeout_t timeout); #else -static inline int net_mgmt_event_wait(uint32_t mgmt_event_mask, - uint32_t *raised_event, +static inline int net_mgmt_event_wait(uint64_t mgmt_event_mask, + uint64_t *raised_event, struct net_if **iface, const void **info, size_t *info_length, @@ -401,15 +394,15 @@ static inline int net_mgmt_event_wait(uint32_t mgmt_event_mask, */ #ifdef CONFIG_NET_MGMT_EVENT int net_mgmt_event_wait_on_iface(struct net_if *iface, - uint32_t mgmt_event_mask, - uint32_t *raised_event, + uint64_t mgmt_event_mask, + uint64_t *raised_event, const void **info, size_t *info_length, k_timeout_t timeout); #else static inline int net_mgmt_event_wait_on_iface(struct net_if *iface, - uint32_t mgmt_event_mask, - uint32_t *raised_event, + uint64_t mgmt_event_mask, + uint64_t *raised_event, const void **info, size_t *info_length, k_timeout_t timeout) diff --git a/include/zephyr/net/ppp.h b/include/zephyr/net/ppp.h index 7028e4f2d0f6..82e026483806 100644 --- a/include/zephyr/net/ppp.h +++ b/include/zephyr/net/ppp.h @@ -574,11 +574,23 @@ void net_ppp_init(struct net_if *iface); NET_MGMT_LAYER_CODE(NET_PPP_CODE)) #define NET_PPP_EVENT (NET_PPP_BASE | NET_MGMT_EVENT_BIT) +enum { + NET_EVENT_PPP_CMD_CARRIER_ON_VAL, + NET_EVENT_PPP_CMD_CARRIER_OFF_VAL, + NET_EVENT_PPP_CMD_PHASE_RUNNING_VAL, + NET_EVENT_PPP_CMD_PHASE_DEAD_VAL, + + NET_EVENT_PPP_CMD_MAX +}; + +BUILD_ASSERT(NET_EVENT_PPP_CMD_MAX <= NET_MGMT_MAX_COMMANDS, + "Number of events in net_event_ppp_cmd exceeds the limit"); + enum net_event_ppp_cmd { - NET_EVENT_PPP_CMD_CARRIER_ON = 1, - NET_EVENT_PPP_CMD_CARRIER_OFF, - NET_EVENT_PPP_CMD_PHASE_RUNNING, - NET_EVENT_PPP_CMD_PHASE_DEAD, + NET_MGMT_CMD(NET_EVENT_PPP_CMD_CARRIER_ON), + NET_MGMT_CMD(NET_EVENT_PPP_CMD_CARRIER_OFF), + NET_MGMT_CMD(NET_EVENT_PPP_CMD_PHASE_RUNNING), + NET_MGMT_CMD(NET_EVENT_PPP_CMD_PHASE_DEAD), }; struct net_if; diff --git a/include/zephyr/net/socket_net_mgmt.h b/include/zephyr/net/socket_net_mgmt.h index 8f3c5829ad3f..337648d5d188 100644 --- a/include/zephyr/net/socket_net_mgmt.h +++ b/include/zephyr/net/socket_net_mgmt.h @@ -73,7 +73,7 @@ struct sockaddr_nm { uintptr_t nm_pid; /** net_mgmt mask */ - uint32_t nm_mask; + uint64_t nm_mask; }; diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index 5477b6a3c0e9..2c895afb36d0 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -317,44 +317,73 @@ NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_START_ROAMING); NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_NEIGHBOR_REP_COMPLETE); +/** @cond INTERNAL_HIDDEN */ + +enum { + NET_EVENT_WIFI_CMD_SCAN_RESULT_VAL, + NET_EVENT_WIFI_CMD_SCAN_DONE_VAL, + NET_EVENT_WIFI_CMD_CONNECT_RESULT_VAL, + NET_EVENT_WIFI_CMD_DISCONNECT_RESULT_VAL, + NET_EVENT_WIFI_CMD_IFACE_STATUS_VAL, + NET_EVENT_WIFI_CMD_TWT_VAL, + NET_EVENT_WIFI_CMD_TWT_SLEEP_STATE_VAL, + NET_EVENT_WIFI_CMD_RAW_SCAN_RESULT_VAL, + NET_EVENT_WIFI_CMD_DISCONNECT_COMPLETE_VAL, + NET_EVENT_WIFI_CMD_SIGNAL_CHANGE_VAL, + NET_EVENT_WIFI_CMD_NEIGHBOR_REP_RECEIVED_VAL, + NET_EVENT_WIFI_CMD_NEIGHBOR_REP_COMPLETE_VAL, + NET_EVENT_WIFI_CMD_AP_ENABLE_RESULT_VAL, + NET_EVENT_WIFI_CMD_AP_DISABLE_RESULT_VAL, + NET_EVENT_WIFI_CMD_AP_STA_CONNECTED_VAL, + NET_EVENT_WIFI_CMD_AP_STA_DISCONNECTED_VAL, + NET_EVENT_WIFI_CMD_SUPPLICANT_VAL, + + NET_EVENT_WIFI_CMD_MAX, +}; + +BUILD_ASSERT(NET_EVENT_WIFI_CMD_MAX <= NET_MGMT_MAX_COMMANDS, + "Number of events in net_event_wifi_cmd exceeds the limit"); + +/** @endcond */ + /** @brief Wi-Fi management events */ enum net_event_wifi_cmd { /** Scan results available */ - NET_EVENT_WIFI_CMD_SCAN_RESULT = 1, + NET_MGMT_CMD(NET_EVENT_WIFI_CMD_SCAN_RESULT), /** Scan done */ - NET_EVENT_WIFI_CMD_SCAN_DONE, + NET_MGMT_CMD(NET_EVENT_WIFI_CMD_SCAN_DONE), /** Connect result */ - NET_EVENT_WIFI_CMD_CONNECT_RESULT, + NET_MGMT_CMD(NET_EVENT_WIFI_CMD_CONNECT_RESULT), /** Disconnect result */ - NET_EVENT_WIFI_CMD_DISCONNECT_RESULT, + NET_MGMT_CMD(NET_EVENT_WIFI_CMD_DISCONNECT_RESULT), /** Interface status */ - NET_EVENT_WIFI_CMD_IFACE_STATUS, + NET_MGMT_CMD(NET_EVENT_WIFI_CMD_IFACE_STATUS), /** TWT events */ - NET_EVENT_WIFI_CMD_TWT, + NET_MGMT_CMD(NET_EVENT_WIFI_CMD_TWT), /** TWT sleep status: awake or sleeping, can be used by application * to determine if it can send data or not. */ - NET_EVENT_WIFI_CMD_TWT_SLEEP_STATE, + NET_MGMT_CMD(NET_EVENT_WIFI_CMD_TWT_SLEEP_STATE), /** Raw scan results available */ - NET_EVENT_WIFI_CMD_RAW_SCAN_RESULT, + NET_MGMT_CMD(NET_EVENT_WIFI_CMD_RAW_SCAN_RESULT), /** Disconnect complete */ - NET_EVENT_WIFI_CMD_DISCONNECT_COMPLETE, + NET_MGMT_CMD(NET_EVENT_WIFI_CMD_DISCONNECT_COMPLETE), /** Signal change event */ - NET_EVENT_WIFI_CMD_SIGNAL_CHANGE, + NET_MGMT_CMD(NET_EVENT_WIFI_CMD_SIGNAL_CHANGE), /** Neighbor Report */ - NET_EVENT_WIFI_CMD_NEIGHBOR_REP_RECEIVED, + NET_MGMT_CMD(NET_EVENT_WIFI_CMD_NEIGHBOR_REP_RECEIVED), /** Neighbor Report complete */ - NET_EVENT_WIFI_CMD_NEIGHBOR_REP_COMPLETE, + NET_MGMT_CMD(NET_EVENT_WIFI_CMD_NEIGHBOR_REP_COMPLETE), /** AP mode enable result */ - NET_EVENT_WIFI_CMD_AP_ENABLE_RESULT, + NET_MGMT_CMD(NET_EVENT_WIFI_CMD_AP_ENABLE_RESULT), /** AP mode disable result */ - NET_EVENT_WIFI_CMD_AP_DISABLE_RESULT, + NET_MGMT_CMD(NET_EVENT_WIFI_CMD_AP_DISABLE_RESULT), /** STA connected to AP */ - NET_EVENT_WIFI_CMD_AP_STA_CONNECTED, + NET_MGMT_CMD(NET_EVENT_WIFI_CMD_AP_STA_CONNECTED), /** STA disconnected from AP */ - NET_EVENT_WIFI_CMD_AP_STA_DISCONNECTED, + NET_MGMT_CMD(NET_EVENT_WIFI_CMD_AP_STA_DISCONNECTED), /** Supplicant specific event */ - NET_EVENT_WIFI_CMD_SUPPLICANT, + NET_MGMT_CMD(NET_EVENT_WIFI_CMD_SUPPLICANT), }; /** Event emitted for Wi-Fi scan result */ diff --git a/modules/hostap/src/supp_events.h b/modules/hostap/src/supp_events.h index 09c30e7a37f5..1c74af528492 100644 --- a/modules/hostap/src/supp_events.h +++ b/modules/hostap/src/supp_events.h @@ -17,14 +17,27 @@ NET_MGMT_IFACE_BIT) #define NET_MGMT_SUPPLICANT_EVENT (NET_MGMT_EVENT_BIT | NET_MGMT_SUPPLICANT_BASE) +enum { + NET_EVENT_SUPPLICANT_CMD_READY_VAL, + NET_EVENT_SUPPLICANT_CMD_NOT_READY_VAL, + NET_EVENT_SUPPLICANT_CMD_IFACE_ADDED_VAL, + NET_EVENT_SUPPLICANT_CMD_IFACE_REMOVING_VAL, + NET_EVENT_SUPPLICANT_CMD_IFACE_REMOVED_VAL, + NET_EVENT_SUPPLICANT_CMD_INT_EVENT_VAL, + + NET_EVENT_SUPPLICANT_CMD_MAX +}; + +BUILD_ASSERT(NET_EVENT_SUPPLICANT_CMD_MAX <= NET_MGMT_MAX_COMMANDS, + "Number of events in net_event_supplicant_cmd exceeds the limit"); + enum net_event_supplicant_cmd { - NET_EVENT_SUPPLICANT_CMD_READY = 1, - NET_EVENT_SUPPLICANT_CMD_NOT_READY, - NET_EVENT_SUPPLICANT_CMD_IFACE_ADDED, - NET_EVENT_SUPPLICANT_CMD_IFACE_REMOVING, - NET_EVENT_SUPPLICANT_CMD_IFACE_REMOVED, - NET_EVENT_SUPPLICANT_CMD_INT_EVENT, - NET_EVENT_WIFI_CMD_MAX + NET_MGMT_CMD(NET_EVENT_SUPPLICANT_CMD_READY), + NET_MGMT_CMD(NET_EVENT_SUPPLICANT_CMD_NOT_READY), + NET_MGMT_CMD(NET_EVENT_SUPPLICANT_CMD_IFACE_ADDED), + NET_MGMT_CMD(NET_EVENT_SUPPLICANT_CMD_IFACE_REMOVING), + NET_MGMT_CMD(NET_EVENT_SUPPLICANT_CMD_IFACE_REMOVED), + NET_MGMT_CMD(NET_EVENT_SUPPLICANT_CMD_INT_EVENT), }; #define NET_EVENT_SUPPLICANT_READY \ diff --git a/modules/hostap/src/supp_main.c b/modules/hostap/src/supp_main.c index c2a4866b9218..4549ab3160d2 100644 --- a/modules/hostap/src/supp_main.c +++ b/modules/hostap/src/supp_main.c @@ -484,14 +484,14 @@ static void submit_iface_work(struct supplicant_context *ctx, } #ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_INF_MON static void interface_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { if ((mgmt_event & INTERFACE_EVENT_MASK) != mgmt_event) { return; } if (!is_wanted_interface(iface)) { - LOG_DBG("Ignoring event (0x%02x) from interface %d (%p)", + LOG_DBG("Ignoring event (0x%" PRIx64 ") from interface %d (%p)", mgmt_event, net_if_get_by_iface(iface), iface); return; } diff --git a/samples/boards/nxp/s32/netc/src/main.c b/samples/boards/nxp/s32/netc/src/main.c index 8399a7dd9b5d..09e6cea98836 100644 --- a/samples/boards/nxp/s32/netc/src/main.c +++ b/samples/boards/nxp/s32/netc/src/main.c @@ -69,7 +69,7 @@ static int setup_iface(struct net_if *iface, const char *ipv6_addr, } static void iface_up_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { if (mgmt_event == NET_EVENT_IF_UP) { k_sem_give(&iface_up); diff --git a/samples/net/capture/src/main.c b/samples/net/capture/src/main.c index 3feafc4eb254..1b68ee30afa8 100644 --- a/samples/net/capture/src/main.c +++ b/samples/net/capture/src/main.c @@ -285,7 +285,7 @@ static int init_app(void) #define EVENT_MASK (NET_EVENT_CAPTURE_STARTED | NET_EVENT_CAPTURE_STOPPED) static void event_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { ARG_UNUSED(iface); ARG_UNUSED(cb); @@ -307,7 +307,7 @@ int main(void) { static struct net_mgmt_event_callback mgmt_cb; struct net_if *iface; - uint32_t event; + uint64_t event; int ret; LOG_INF("Starting network capture sample"); diff --git a/samples/net/cloud/mqtt_azure/src/main.c b/samples/net/cloud/mqtt_azure/src/main.c index 841c1fb7ebe0..538461af2d1c 100644 --- a/samples/net/cloud/mqtt_azure/src/main.c +++ b/samples/net/cloud/mqtt_azure/src/main.c @@ -487,7 +487,7 @@ static void abort_mqtt_connection(void) } static void l4_event_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { if ((mgmt_event & L4_EVENT_MASK) != mgmt_event) { return; diff --git a/samples/net/cloud/tagoio_http_post/src/wifi.c b/samples/net/cloud/tagoio_http_post/src/wifi.c index f9eb52b7a594..a0cd121d62b3 100644 --- a/samples/net/cloud/tagoio_http_post/src/wifi.c +++ b/samples/net/cloud/tagoio_http_post/src/wifi.c @@ -26,7 +26,7 @@ static void handle_wifi_connect_result(struct net_mgmt_event_callback *cb) } static void wifi_mgmt_event_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { switch (mgmt_event) { case NET_EVENT_WIFI_CONNECT_RESULT: diff --git a/samples/net/common/net_sample_common.c b/samples/net/common/net_sample_common.c index e1b91c911222..0b570a64feb1 100644 --- a/samples/net/common/net_sample_common.c +++ b/samples/net/common/net_sample_common.c @@ -20,7 +20,7 @@ LOG_MODULE_REGISTER(net_samples_common, LOG_LEVEL_DBG); static struct net_mgmt_event_callback l4_cb; static K_SEM_DEFINE(network_connected, 0, 1); -static void l4_event_handler(struct net_mgmt_event_callback *cb, uint32_t event, +static void l4_event_handler(struct net_mgmt_event_callback *cb, uint64_t event, struct net_if *iface) { switch (event) { diff --git a/samples/net/dhcpv4_client/src/main.c b/samples/net/dhcpv4_client/src/main.c index 00d48949d739..72f7a17f273c 100644 --- a/samples/net/dhcpv4_client/src/main.c +++ b/samples/net/dhcpv4_client/src/main.c @@ -38,7 +38,7 @@ static void start_dhcpv4_client(struct net_if *iface, void *user_data) } static void handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, + uint64_t mgmt_event, struct net_if *iface) { int i = 0; diff --git a/samples/net/dns_resolve/src/main.c b/samples/net/dns_resolve/src/main.c index 23e5645d0b45..5302f5698742 100644 --- a/samples/net/dns_resolve/src/main.c +++ b/samples/net/dns_resolve/src/main.c @@ -198,7 +198,7 @@ static void print_dhcpv4_addr(struct net_if *iface, struct net_if_addr *if_addr, } static void ipv4_addr_add_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, + uint64_t mgmt_event, struct net_if *iface) { diff --git a/samples/net/dsa/src/main.c b/samples/net/dsa/src/main.c index 16d41af59993..a84b2cef7a9d 100644 --- a/samples/net/dsa/src/main.c +++ b/samples/net/dsa/src/main.c @@ -54,7 +54,7 @@ static void dsa_iface_find_cb(struct net_if *iface, void *user_data) static struct net_mgmt_event_callback mgmt_cb; static void event_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { ARG_UNUSED(iface); ARG_UNUSED(cb); diff --git a/samples/net/ipv4_autoconf/src/main.c b/samples/net/ipv4_autoconf/src/main.c index c4e93105cf73..9dd9fa53bb71 100644 --- a/samples/net/ipv4_autoconf/src/main.c +++ b/samples/net/ipv4_autoconf/src/main.c @@ -25,7 +25,7 @@ LOG_MODULE_REGISTER(net_ipv4_autoconf_sample, LOG_LEVEL_DBG); static struct net_mgmt_event_callback mgmt_cb; static void handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, + uint64_t mgmt_event, struct net_if *iface) { int i = 0; diff --git a/samples/net/lwm2m_client/src/lwm2m-client.c b/samples/net/lwm2m_client/src/lwm2m-client.c index 9127769ff6b8..7c15f84502c7 100644 --- a/samples/net/lwm2m_client/src/lwm2m-client.c +++ b/samples/net/lwm2m_client/src/lwm2m-client.c @@ -334,7 +334,7 @@ static void on_net_event_l4_connected(void) } static void l4_event_handler(struct net_mgmt_event_callback *cb, - uint32_t event, + uint64_t event, struct net_if *iface) { switch (event) { @@ -356,7 +356,7 @@ static void l4_event_handler(struct net_mgmt_event_callback *cb, } static void connectivity_event_handler(struct net_mgmt_event_callback *cb, - uint32_t event, + uint64_t event, struct net_if *iface) { if (event == NET_EVENT_CONN_IF_FATAL_ERROR) { diff --git a/samples/net/mqtt_sn_publisher/src/main.c b/samples/net/mqtt_sn_publisher/src/main.c index 65436daea4d5..fddeb4c976fe 100644 --- a/samples/net/mqtt_sn_publisher/src/main.c +++ b/samples/net/mqtt_sn_publisher/src/main.c @@ -30,7 +30,7 @@ K_SEM_DEFINE(run_app, 0, 1); #define EVENT_MASK (NET_EVENT_L4_CONNECTED | NET_EVENT_L4_DISCONNECTED) -static void net_event_handler(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, +static void net_event_handler(struct net_mgmt_event_callback *cb, uint64_t mgmt_event, struct net_if *iface) { if ((mgmt_event & EVENT_MASK) != mgmt_event) { diff --git a/samples/net/secure_mqtt_sensor_actuator/src/main.c b/samples/net/secure_mqtt_sensor_actuator/src/main.c index 64993139e900..9b6872a69cfc 100644 --- a/samples/net/secure_mqtt_sensor_actuator/src/main.c +++ b/samples/net/secure_mqtt_sensor_actuator/src/main.c @@ -30,7 +30,7 @@ static struct net_mgmt_event_callback net_l4_mgmt_cb; K_SEM_DEFINE(net_conn_sem, 0, 1); static void net_l4_evt_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { switch (mgmt_event) { case NET_EVENT_L4_CONNECTED: diff --git a/samples/net/sockets/coap_download/src/main.c b/samples/net/sockets/coap_download/src/main.c index bb15551cfba4..2e1ee6c59d33 100644 --- a/samples/net/sockets/coap_download/src/main.c +++ b/samples/net/sockets/coap_download/src/main.c @@ -21,7 +21,7 @@ static int64_t start_time; /* This struct contains (potentially large) TX and RX buffers, so allocate statically */ static struct coap_client client = {0}; -static void net_event_handler(uint32_t mgmt_event, struct net_if *iface, void *info, +static void net_event_handler(uint64_t mgmt_event, struct net_if *iface, void *info, size_t info_length, void *user_data) { if (NET_EVENT_L4_CONNECTED == mgmt_event) { diff --git a/samples/net/sockets/coap_server/src/events.c b/samples/net/sockets/coap_server/src/events.c index 3f843fba0171..8c621214a7d5 100644 --- a/samples/net/sockets/coap_server/src/events.c +++ b/samples/net/sockets/coap_server/src/events.c @@ -13,7 +13,7 @@ LOG_MODULE_DECLARE(net_coap_service_sample); #define COAP_EVENTS_SET (NET_EVENT_COAP_OBSERVER_ADDED | NET_EVENT_COAP_OBSERVER_REMOVED | \ NET_EVENT_COAP_SERVICE_STARTED | NET_EVENT_COAP_SERVICE_STOPPED) -void coap_event_handler(uint32_t mgmt_event, struct net_if *iface, +void coap_event_handler(uint64_t mgmt_event, struct net_if *iface, void *info, size_t info_length, void *user_data) { ARG_UNUSED(iface); diff --git a/samples/net/sockets/dumb_http_server_mt/src/main.c b/samples/net/sockets/dumb_http_server_mt/src/main.c index ed19fa968332..4c8a10219239 100644 --- a/samples/net/sockets/dumb_http_server_mt/src/main.c +++ b/samples/net/sockets/dumb_http_server_mt/src/main.c @@ -98,7 +98,7 @@ K_THREAD_DEFINE(tcp6_thread_id, STACK_SIZE, NET_EVENT_L4_DISCONNECTED) static void event_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { if ((mgmt_event & EVENT_MASK) != mgmt_event) { return; diff --git a/samples/net/sockets/echo_client/src/echo-client.c b/samples/net/sockets/echo_client/src/echo-client.c index 3ca9ddc8aa03..9c451b9c3ccf 100644 --- a/samples/net/sockets/echo_client/src/echo-client.c +++ b/samples/net/sockets/echo_client/src/echo-client.c @@ -229,7 +229,7 @@ static int check_our_ipv6_sockets(int sock, } static void ipv6_event_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { static char addr_str[INET6_ADDRSTRLEN]; @@ -297,7 +297,7 @@ static void ipv6_event_handler(struct net_mgmt_event_callback *cb, } static void event_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { if ((mgmt_event & EVENT_MASK) != mgmt_event) { return; diff --git a/samples/net/sockets/echo_server/src/echo-server.c b/samples/net/sockets/echo_server/src/echo-server.c index fd6bd4f6acf0..c4dc98b40044 100644 --- a/samples/net/sockets/echo_server/src/echo-server.c +++ b/samples/net/sockets/echo_server/src/echo-server.c @@ -82,7 +82,7 @@ static void stop_udp_and_tcp(void) } static void event_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { ARG_UNUSED(iface); ARG_UNUSED(cb); diff --git a/samples/net/sockets/packet/src/packet.c b/samples/net/sockets/packet/src/packet.c index 3b3af25c7ab8..e4354254b3e8 100644 --- a/samples/net/sockets/packet/src/packet.c +++ b/samples/net/sockets/packet/src/packet.c @@ -229,7 +229,7 @@ static void send_packet(void) } static void iface_up_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { if (mgmt_event == NET_EVENT_IF_UP) { k_sem_give(&iface_up); diff --git a/samples/net/sockets/txtime/src/main.c b/samples/net/sockets/txtime/src/main.c index d4bc85a3f2a5..870e10f8ff7c 100644 --- a/samples/net/sockets/txtime/src/main.c +++ b/samples/net/sockets/txtime/src/main.c @@ -71,7 +71,7 @@ static void quit(void) } static void event_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { static bool dhcpv4_done; diff --git a/samples/net/wifi/apsta_mode/src/main.c b/samples/net/wifi/apsta_mode/src/main.c index eb90b1c21046..aa0d0cb28cbb 100644 --- a/samples/net/wifi/apsta_mode/src/main.c +++ b/samples/net/wifi/apsta_mode/src/main.c @@ -36,7 +36,7 @@ static struct wifi_connect_req_params sta_config; static struct net_mgmt_event_callback cb; -static void wifi_event_handler(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, +static void wifi_event_handler(struct net_mgmt_event_callback *cb, uint64_t mgmt_event, struct net_if *iface) { switch (mgmt_event) { diff --git a/samples/subsys/mgmt/updatehub/src/main.c b/samples/subsys/mgmt/updatehub/src/main.c index 73d64a1a6947..9f9af6ae0037 100644 --- a/samples/subsys/mgmt/updatehub/src/main.c +++ b/samples/subsys/mgmt/updatehub/src/main.c @@ -63,7 +63,7 @@ void start_updatehub(void) } static void event_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { if ((mgmt_event & EVENT_MASK) != mgmt_event) { return; diff --git a/subsys/logging/backends/log_backend_net.c b/subsys/logging/backends/log_backend_net.c index 11f0612724f2..b0e3ca5c4258 100644 --- a/subsys/logging/backends/log_backend_net.c +++ b/subsys/logging/backends/log_backend_net.c @@ -367,7 +367,7 @@ const struct log_backend *log_backend_net_get(void) } #if defined(CONFIG_LOG_BACKEND_NET_USE_CONNECTION_MANAGER) -static void l4_event_handler(uint32_t mgmt_event, struct net_if *iface, void *info, +static void l4_event_handler(uint64_t mgmt_event, struct net_if *iface, void *info, size_t info_length, void *user_data) { ARG_UNUSED(iface); diff --git a/subsys/mgmt/mcumgr/transport/src/smp_udp.c b/subsys/mgmt/mcumgr/transport/src/smp_udp.c index 8067b36d6e63..e3da22e67312 100644 --- a/subsys/mgmt/mcumgr/transport/src/smp_udp.c +++ b/subsys/mgmt/mcumgr/transport/src/smp_udp.c @@ -280,7 +280,7 @@ static void smp_udp_open_iface(struct net_if *iface, void *user_data) } } -static void smp_udp_net_event_handler(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, +static void smp_udp_net_event_handler(struct net_mgmt_event_callback *cb, uint64_t mgmt_event, struct net_if *iface) { ARG_UNUSED(cb); diff --git a/subsys/net/conn_mgr/conn_mgr_connectivity.c b/subsys/net/conn_mgr/conn_mgr_connectivity.c index 5bf8e3f58be8..905b5b07d1c5 100644 --- a/subsys/net/conn_mgr/conn_mgr_connectivity.c +++ b/subsys/net/conn_mgr/conn_mgr_connectivity.c @@ -315,7 +315,7 @@ static void conn_mgr_conn_handle_iface_down(struct net_if *iface) } static struct net_mgmt_event_callback conn_mgr_conn_iface_cb; -static void conn_mgr_conn_iface_handler(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, +static void conn_mgr_conn_iface_handler(struct net_mgmt_event_callback *cb, uint64_t mgmt_event, struct net_if *iface) { if ((mgmt_event & CONN_MGR_CONN_IFACE_EVENTS_MASK) != mgmt_event) { @@ -333,7 +333,7 @@ static void conn_mgr_conn_iface_handler(struct net_mgmt_event_callback *cb, uint } static struct net_mgmt_event_callback conn_mgr_conn_self_cb; -static void conn_mgr_conn_self_handler(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, +static void conn_mgr_conn_self_handler(struct net_mgmt_event_callback *cb, uint64_t mgmt_event, struct net_if *iface) { if ((mgmt_event & CONN_MGR_CONN_SELF_EVENTS_MASK) != mgmt_event) { diff --git a/subsys/net/conn_mgr/events_handler.c b/subsys/net/conn_mgr/events_handler.c index 8f15a8b6c622..2a0c6fefc28e 100644 --- a/subsys/net/conn_mgr/events_handler.c +++ b/subsys/net/conn_mgr/events_handler.c @@ -19,12 +19,12 @@ static struct net_mgmt_event_callback ipv6_events_cb; static struct net_mgmt_event_callback ipv4_events_cb; static void conn_mgr_iface_events_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, + uint64_t mgmt_event, struct net_if *iface) { int idx; - NET_DBG("%s event 0x%x received on iface %d (%p)", "Iface", mgmt_event, + NET_DBG("%s event 0x%" PRIx64 " received on iface %d (%p)", "Iface", mgmt_event, net_if_get_by_iface(iface), iface); if ((mgmt_event & CONN_MGR_IFACE_EVENTS_MASK) != mgmt_event) { @@ -55,12 +55,12 @@ static void conn_mgr_iface_events_handler(struct net_mgmt_event_callback *cb, #if defined(CONFIG_NET_IPV6) static void conn_mgr_ipv6_events_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, + uint64_t mgmt_event, struct net_if *iface) { int idx; - NET_DBG("%s event 0x%x received on iface %d (%p)", "IPv6", mgmt_event, + NET_DBG("%s event 0x%" PRIx64 " received on iface %d (%p)", "IPv6", mgmt_event, net_if_get_by_iface(iface), iface); if ((mgmt_event & CONN_MGR_IPV6_EVENTS_MASK) != mgmt_event) { @@ -101,7 +101,7 @@ static void conn_mgr_ipv6_events_handler(struct net_mgmt_event_callback *cb, #else static inline void conn_mgr_ipv6_events_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, + uint64_t mgmt_event, struct net_if *iface) { ARG_UNUSED(cb); @@ -112,12 +112,12 @@ void conn_mgr_ipv6_events_handler(struct net_mgmt_event_callback *cb, #if defined(CONFIG_NET_IPV4) static void conn_mgr_ipv4_events_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, + uint64_t mgmt_event, struct net_if *iface) { int idx; - NET_DBG("%s event 0x%x received on iface %d (%p)", "IPv4", mgmt_event, + NET_DBG("%s event 0x%" PRIx64 " received on iface %d (%p)", "IPv4", mgmt_event, net_if_get_by_iface(iface), iface); if ((mgmt_event & CONN_MGR_IPV4_EVENTS_MASK) != mgmt_event) { @@ -159,7 +159,7 @@ static void conn_mgr_ipv4_events_handler(struct net_mgmt_event_callback *cb, #else static inline void conn_mgr_ipv4_events_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, + uint64_t mgmt_event, struct net_if *iface) { ARG_UNUSED(cb); diff --git a/subsys/net/ip/ipv4_autoconf.c b/subsys/net/ip/ipv4_autoconf.c index f08608f3b7e2..ad399622a994 100644 --- a/subsys/net/ip/ipv4_autoconf.c +++ b/subsys/net/ip/ipv4_autoconf.c @@ -55,7 +55,7 @@ static inline void ipv4_autoconf_addr_set(struct net_if_ipv4_autoconf *ipv4auto) } static void acd_event_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { struct net_if_config *cfg; struct in_addr *addr; diff --git a/subsys/net/ip/ipv6_pe.c b/subsys/net/ip/ipv6_pe.c index 4379dc47e7e5..bb03683db39f 100644 --- a/subsys/net/ip/ipv6_pe.c +++ b/subsys/net/ip/ipv6_pe.c @@ -501,7 +501,7 @@ static void ipv6_pe_recheck_filters(bool is_denylist) #if CONFIG_NET_IPV6_PE_FILTER_PREFIX_COUNT > 0 static void send_filter_event(struct in6_addr *addr, bool is_denylist, - int event_type) + uint64_t event_type) { if (IS_ENABLED(CONFIG_NET_MGMT_EVENT_INFO)) { struct net_event_ipv6_pe_filter info; diff --git a/subsys/net/ip/net_mgmt.c b/subsys/net/ip/net_mgmt.c index 4fbc1a1b5997..d48a54e56110 100644 --- a/subsys/net/ip/net_mgmt.c +++ b/subsys/net/ip/net_mgmt.c @@ -27,7 +27,7 @@ struct mgmt_event_entry { #endif /* CONFIG_NET_MGMT_EVENT_QUEUE */ size_t info_length; #endif /* CONFIG_NET_MGMT_EVENT_INFO */ - uint32_t event; + uint64_t event; struct net_if *iface; }; @@ -47,7 +47,7 @@ K_KERNEL_STACK_DEFINE(mgmt_stack, CONFIG_NET_MGMT_EVENT_STACK_SIZE); static struct k_work_q mgmt_work_q_obj; #endif -static uint32_t global_event_mask; +static uint64_t global_event_mask; static sys_slist_t event_callbacks = SYS_SLIST_STATIC_INIT(&event_callbacks); /* Forward declaration for the actual caller */ @@ -67,7 +67,7 @@ static struct k_work_q *mgmt_work_q = COND_CODE_1(CONFIG_NET_MGMT_EVENT_SYSTEM_W static void mgmt_event_work_handler(struct k_work *work); static K_WORK_DEFINE(mgmt_work, mgmt_event_work_handler); -static inline void mgmt_push_event(uint32_t mgmt_event, struct net_if *iface, +static inline void mgmt_push_event(uint64_t mgmt_event, struct net_if *iface, const void *info, size_t length) { #ifndef CONFIG_NET_MGMT_EVENT_INFO @@ -85,7 +85,7 @@ static inline void mgmt_push_event(uint32_t mgmt_event, struct net_if *iface, memcpy(new_event.info, info, length); new_event.info_length = length; } else { - NET_ERR("Event %u info length %zu > max size %zu", + NET_ERR("Event 0x%" PRIx64 " info length %zu > max size %zu", mgmt_event, length, NET_EVENT_INFO_MAX_SIZE); (void)k_mutex_unlock(&net_mgmt_event_lock); @@ -99,7 +99,7 @@ static inline void mgmt_push_event(uint32_t mgmt_event, struct net_if *iface, if (k_msgq_put(&event_msgq, &new_event, K_MSEC(CONFIG_NET_MGMT_EVENT_QUEUE_TIMEOUT)) != 0) { - NET_WARN("Failure to push event (%u), " + NET_WARN("Failure to push event (0x%" PRIx64 "), " "try increasing the 'CONFIG_NET_MGMT_EVENT_QUEUE_SIZE' " "or 'CONFIG_NET_MGMT_EVENT_QUEUE_TIMEOUT' options.", mgmt_event); @@ -128,7 +128,7 @@ static void mgmt_event_work_handler(struct k_work *work) #else -static inline void mgmt_push_event(uint32_t event, struct net_if *iface, +static inline void mgmt_push_event(uint64_t event, struct net_if *iface, const void *info, size_t length) { #ifndef CONFIG_NET_MGMT_EVENT_INFO @@ -149,7 +149,7 @@ static inline void mgmt_push_event(uint32_t event, struct net_if *iface, #endif /* CONFIG_NET_MGMT_EVENT_QUEUE */ -static inline void mgmt_add_event_mask(uint32_t event_mask) +static inline void mgmt_add_event_mask(uint64_t event_mask) { global_event_mask |= event_mask; } @@ -169,7 +169,7 @@ static inline void mgmt_rebuild_global_event_mask(void) } } -static inline bool mgmt_is_event_handled(uint32_t mgmt_event) +static inline bool mgmt_is_event_handled(uint64_t mgmt_event) { return (((NET_MGMT_GET_LAYER(mgmt_event) & NET_MGMT_GET_LAYER(global_event_mask)) == @@ -188,7 +188,7 @@ static inline void mgmt_run_slist_callbacks(const struct mgmt_event_entry * cons struct net_mgmt_event_callback *cb, *tmp; /* Readable layer code is starting from 1, thus the increment */ - NET_DBG("Event layer %u code %u cmd %u", + NET_DBG("Event layer 0x%" PRIx64 " code 0x%" PRIx64 " cmd 0x%" PRIx64, NET_MGMT_GET_LAYER(mgmt_event->event) + 1, NET_MGMT_GET_LAYER_CODE(mgmt_event->event), NET_MGMT_GET_COMMAND(mgmt_event->event)); @@ -283,8 +283,8 @@ static void mgmt_run_callbacks(const struct mgmt_event_entry * const mgmt_event) } static int mgmt_event_wait_call(struct net_if *iface, - uint32_t mgmt_event_mask, - uint32_t *raised_event, + uint64_t mgmt_event_mask, + uint64_t *raised_event, struct net_if **event_iface, const void **info, size_t *info_length, @@ -303,7 +303,7 @@ static int mgmt_event_wait_call(struct net_if *iface, sync_data.iface = iface; } - NET_DBG("Synchronous event 0x%08x wait %p", sync.event_mask, &sync); + NET_DBG("Synchronous event 0x%" PRIx64 " wait %p", sync.event_mask, &sync); net_mgmt_add_event_callback(&sync); @@ -367,12 +367,12 @@ void net_mgmt_del_event_callback(struct net_mgmt_event_callback *cb) (void)k_mutex_unlock(&net_mgmt_callback_lock); } -void net_mgmt_event_notify_with_info(uint32_t mgmt_event, struct net_if *iface, +void net_mgmt_event_notify_with_info(uint64_t mgmt_event, struct net_if *iface, const void *info, size_t length) { if (mgmt_is_event_handled(mgmt_event)) { /* Readable layer code is starting from 1, thus the increment */ - NET_DBG("Notifying Event layer %u code %u type %u", + NET_DBG("Notifying Event layer 0x%" PRIx64 " code 0x%" PRIx64 " type 0x%" PRIx64, NET_MGMT_GET_LAYER(mgmt_event) + 1, NET_MGMT_GET_LAYER_CODE(mgmt_event), NET_MGMT_GET_COMMAND(mgmt_event)); @@ -381,8 +381,8 @@ void net_mgmt_event_notify_with_info(uint32_t mgmt_event, struct net_if *iface, } } -int net_mgmt_event_wait(uint32_t mgmt_event_mask, - uint32_t *raised_event, +int net_mgmt_event_wait(uint64_t mgmt_event_mask, + uint64_t *raised_event, struct net_if **iface, const void **info, size_t *info_length, @@ -394,8 +394,8 @@ int net_mgmt_event_wait(uint32_t mgmt_event_mask, } int net_mgmt_event_wait_on_iface(struct net_if *iface, - uint32_t mgmt_event_mask, - uint32_t *raised_event, + uint64_t mgmt_event_mask, + uint64_t *raised_event, const void **info, size_t *info_length, k_timeout_t timeout) diff --git a/subsys/net/ip/net_stats.c b/subsys/net/ip/net_stats.c index 5da625faeb6d..9e7d0bb6fc7b 100644 --- a/subsys/net/ip/net_stats.c +++ b/subsys/net/ip/net_stats.c @@ -252,7 +252,7 @@ void net_print_statistics(void) #if defined(CONFIG_NET_STATISTICS_USER_API) -static int net_stats_get(uint32_t mgmt_request, struct net_if *iface, +static int net_stats_get(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { size_t len_chk = 0; diff --git a/subsys/net/ip/pmtu.c b/subsys/net/ip/pmtu.c index be2c3355a6b4..cdd09ed0ca83 100644 --- a/subsys/net/ip/pmtu.c +++ b/subsys/net/ip/pmtu.c @@ -12,7 +12,6 @@ LOG_MODULE_REGISTER(net_pmtu, CONFIG_NET_PMTU_LOG_LEVEL); #include -#include #include #include #include "pmtu.h" diff --git a/subsys/net/l2/ethernet/arp.c b/subsys/net/l2/ethernet/arp.c index af816185fe1b..d49ab054eaa9 100644 --- a/subsys/net/l2/ethernet/arp.c +++ b/subsys/net/l2/ethernet/arp.c @@ -569,7 +569,7 @@ static void notify_all_ipv4_addr(struct net_if *iface) } static void iface_event_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { ARG_UNUSED(cb); @@ -586,7 +586,7 @@ static void iface_event_handler(struct net_mgmt_event_callback *cb, } static void ipv4_event_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { struct in_addr *ipaddr; diff --git a/subsys/net/l2/ethernet/ethernet_mgmt.c b/subsys/net/l2/ethernet/ethernet_mgmt.c index 3f1b6735318a..15efbc4f37c3 100644 --- a/subsys/net/l2/ethernet/ethernet_mgmt.c +++ b/subsys/net/l2/ethernet/ethernet_mgmt.c @@ -25,7 +25,7 @@ static inline bool is_hw_caps_supported(const struct device *dev, return ((api->get_capabilities(dev) & caps) != 0); } -static int ethernet_set_config(uint32_t mgmt_request, +static int ethernet_set_config(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { @@ -255,7 +255,7 @@ NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_ETHERNET_SET_TXINJECTION_MODE, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_ETHERNET_SET_MAC_FILTER, ethernet_set_config); -static int ethernet_get_config(uint32_t mgmt_request, +static int ethernet_get_config(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { diff --git a/subsys/net/l2/ethernet/ethernet_stats.c b/subsys/net/l2/ethernet/ethernet_stats.c index ccbbd53e2f2d..57d354623f66 100644 --- a/subsys/net/l2/ethernet/ethernet_stats.c +++ b/subsys/net/l2/ethernet/ethernet_stats.c @@ -17,7 +17,7 @@ LOG_MODULE_REGISTER(net_ethernet_stats, CONFIG_NET_L2_ETHERNET_LOG_LEVEL); #if defined(CONFIG_NET_STATISTICS_USER_API) -static int eth_stats_get(uint32_t mgmt_request, struct net_if *iface, +static int eth_stats_get(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { size_t len_chk = 0; diff --git a/subsys/net/l2/ethernet/lldp/lldp.c b/subsys/net/l2/ethernet/lldp/lldp.c index 2895691d6f0a..230e69eb6b81 100644 --- a/subsys/net/l2/ethernet/lldp/lldp.c +++ b/subsys/net/l2/ethernet/lldp/lldp.c @@ -234,7 +234,7 @@ static int lldp_check_iface(struct net_if *iface) return 0; } -static int lldp_start(struct net_if *iface, uint32_t mgmt_event) +static int lldp_start(struct net_if *iface, uint64_t mgmt_event) { struct ethernet_context *ctx; int ret, slot; @@ -328,7 +328,7 @@ int net_lldp_register_callback(struct net_if *iface, net_lldp_recv_cb_t recv_cb) } static void iface_event_handler(struct net_mgmt_event_callback *evt_cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { lldp_start(iface, mgmt_event); } diff --git a/subsys/net/l2/ieee802154/ieee802154_mgmt.c b/subsys/net/l2/ieee802154/ieee802154_mgmt.c index 993bcc12ae91..3c654c375b67 100644 --- a/subsys/net/l2/ieee802154/ieee802154_mgmt.c +++ b/subsys/net/l2/ieee802154/ieee802154_mgmt.c @@ -74,7 +74,7 @@ enum net_verdict ieee802154_handle_beacon(struct net_if *iface, return NET_CONTINUE; } -static int ieee802154_cancel_scan(uint32_t mgmt_request, struct net_if *iface, +static int ieee802154_cancel_scan(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { struct ieee802154_context *ctx = net_if_l2_data(iface); @@ -94,7 +94,7 @@ static int ieee802154_cancel_scan(uint32_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_IEEE802154_CANCEL_SCAN, ieee802154_cancel_scan); -static int ieee802154_scan(uint32_t mgmt_request, struct net_if *iface, +static int ieee802154_scan(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct ieee802154_phy_supported_channels *supported_channels; @@ -437,7 +437,7 @@ enum net_verdict ieee802154_handle_mac_command(struct net_if *iface, return NET_DROP; } -static int ieee802154_associate(uint32_t mgmt_request, struct net_if *iface, +static int ieee802154_associate(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { struct ieee802154_context *ctx = net_if_l2_data(iface); @@ -631,7 +631,7 @@ static int ieee802154_associate(uint32_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_IEEE802154_ASSOCIATE, ieee802154_associate); -static int ieee802154_disassociate(uint32_t mgmt_request, struct net_if *iface, +static int ieee802154_disassociate(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { struct ieee802154_context *ctx = net_if_l2_data(iface); @@ -706,7 +706,7 @@ static int ieee802154_disassociate(uint32_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_IEEE802154_DISASSOCIATE, ieee802154_disassociate); -static int ieee802154_set_ack(uint32_t mgmt_request, struct net_if *iface, +static int ieee802154_set_ack(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { struct ieee802154_context *ctx = net_if_l2_data(iface); @@ -733,7 +733,7 @@ NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_IEEE802154_SET_ACK, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_IEEE802154_UNSET_ACK, ieee802154_set_ack); -static int ieee802154_set_parameters(uint32_t mgmt_request, +static int ieee802154_set_parameters(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { @@ -851,7 +851,7 @@ NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_IEEE802154_SET_SHORT_ADDR, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_IEEE802154_SET_TX_POWER, ieee802154_set_parameters); -static int ieee802154_get_parameters(uint32_t mgmt_request, +static int ieee802154_get_parameters(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { @@ -914,7 +914,7 @@ NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_IEEE802154_GET_TX_POWER, #ifdef CONFIG_NET_L2_IEEE802154_SECURITY -static int ieee802154_set_security_settings(uint32_t mgmt_request, +static int ieee802154_set_security_settings(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { @@ -953,7 +953,7 @@ static int ieee802154_set_security_settings(uint32_t mgmt_request, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_IEEE802154_SET_SECURITY_SETTINGS, ieee802154_set_security_settings); -static int ieee802154_get_security_settings(uint32_t mgmt_request, +static int ieee802154_get_security_settings(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { diff --git a/subsys/net/l2/ieee802154/ieee802154_shell.c b/subsys/net/l2/ieee802154/ieee802154_shell.c index 8a4e6ab0b6c3..777e7c6e46f3 100644 --- a/subsys/net/l2/ieee802154/ieee802154_shell.c +++ b/subsys/net/l2/ieee802154/ieee802154_shell.c @@ -209,7 +209,7 @@ static inline char *print_coordinator_address(char *buf, int buf_len) } static void scan_result_cb(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { char buf[64]; @@ -224,7 +224,7 @@ static int cmd_ieee802154_scan(const struct shell *sh, size_t argc, char *argv[]) { struct net_if *iface = net_if_get_ieee802154(); - uint32_t scan_type; + uint64_t scan_type; int ret = 0; if (argc < 3) { diff --git a/subsys/net/l2/openthread/openthread.c b/subsys/net/l2/openthread/openthread.c index 6ddeadf8dfcf..4ed6a34162f8 100644 --- a/subsys/net/l2/openthread/openthread.c +++ b/subsys/net/l2/openthread/openthread.c @@ -34,7 +34,7 @@ static struct openthread_state_changed_callback ot_l2_state_changed_cb; #ifdef CONFIG_NET_MGMT_EVENT static struct net_mgmt_event_callback ip6_addr_cb; -static void ipv6_addr_event_handler(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, +static void ipv6_addr_event_handler(struct net_mgmt_event_callback *cb, uint64_t mgmt_event, struct net_if *iface) { if (net_if_l2(iface) != &NET_L2_GET_NAME(OPENTHREAD)) { diff --git a/subsys/net/l2/ppp/ppp_l2.c b/subsys/net/l2/ppp/ppp_l2.c index 5521d76470e3..ae573a6e7cee 100644 --- a/subsys/net/l2/ppp/ppp_l2.c +++ b/subsys/net/l2/ppp/ppp_l2.c @@ -474,7 +474,7 @@ static void tx_handler(void *p1, void *p2, void *p3) } } -static void net_ppp_mgmt_evt_handler(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, +static void net_ppp_mgmt_evt_handler(struct net_mgmt_event_callback *cb, uint64_t mgmt_event, struct net_if *iface) { struct ppp_context *ctx; diff --git a/subsys/net/l2/virtual/virtual_mgmt.c b/subsys/net/l2/virtual/virtual_mgmt.c index 1210fc59083e..c6187e0dd9f5 100644 --- a/subsys/net/l2/virtual/virtual_mgmt.c +++ b/subsys/net/l2/virtual/virtual_mgmt.c @@ -13,7 +13,7 @@ LOG_MODULE_REGISTER(net_virtual_mgmt, CONFIG_NET_L2_VIRTUAL_LOG_LEVEL); #include #include -static int virtual_interface_set_config(uint32_t mgmt_request, +static int virtual_interface_set_config(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { @@ -89,7 +89,7 @@ NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_VIRTUAL_INTERFACE_SET_LINK_TYPE, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_VIRTUAL_INTERFACE_SET_PRIVATE_KEY, virtual_interface_set_config); -static int virtual_interface_get_config(uint32_t mgmt_request, +static int virtual_interface_get_config(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { diff --git a/subsys/net/l2/wifi/wifi_mgmt.c b/subsys/net/l2/wifi/wifi_mgmt.c index dc52c42a5c2f..0183faab1d50 100644 --- a/subsys/net/l2/wifi/wifi_mgmt.c +++ b/subsys/net/l2/wifi/wifi_mgmt.c @@ -371,7 +371,7 @@ static const struct wifi_mgmt_ops *const get_wifi_api(struct net_if *iface) return off_api ? off_api->wifi_mgmt_api : NULL; } -static int wifi_connect(uint32_t mgmt_request, struct net_if *iface, +static int wifi_connect(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { struct wifi_connect_req_params *params = @@ -475,7 +475,7 @@ static void scan_result_cb(struct net_if *iface, int status, #endif /* CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS_ONLY */ } -static int wifi_scan(uint32_t mgmt_request, struct net_if *iface, +static int wifi_scan(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -504,7 +504,7 @@ static int wifi_scan(uint32_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_SCAN, wifi_scan); -static int wifi_disconnect(uint32_t mgmt_request, struct net_if *iface, +static int wifi_disconnect(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -546,7 +546,7 @@ void wifi_mgmt_raise_disconnect_result_event(struct net_if *iface, int status) } #ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_ROAMING -static int wifi_start_roaming(uint32_t mgmt_request, struct net_if *iface, +static int wifi_start_roaming(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -589,7 +589,7 @@ static int wifi_start_roaming(uint32_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_START_ROAMING, wifi_start_roaming); -static int wifi_neighbor_rep_complete(uint32_t mgmt_request, struct net_if *iface, +static int wifi_neighbor_rep_complete(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -684,7 +684,7 @@ void wifi_mgmt_raise_neighbor_rep_recv_event(struct net_if *iface, char *inbuf, } #endif -static int wifi_ap_enable(uint32_t mgmt_request, struct net_if *iface, +static int wifi_ap_enable(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { struct wifi_connect_req_params *params = @@ -705,7 +705,7 @@ static int wifi_ap_enable(uint32_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_AP_ENABLE, wifi_ap_enable); -static int wifi_ap_disable(uint32_t mgmt_request, struct net_if *iface, +static int wifi_ap_disable(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -724,7 +724,7 @@ static int wifi_ap_disable(uint32_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_AP_DISABLE, wifi_ap_disable); -static int wifi_ap_sta_disconnect(uint32_t mgmt_request, struct net_if *iface, +static int wifi_ap_sta_disconnect(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -752,7 +752,7 @@ static int wifi_ap_sta_disconnect(uint32_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_AP_STA_DISCONNECT, wifi_ap_sta_disconnect); -static int wifi_ap_config_params(uint32_t mgmt_request, struct net_if *iface, +static int wifi_ap_config_params(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -790,7 +790,7 @@ static int wifi_ap_config_params(uint32_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_AP_CONFIG_PARAM, wifi_ap_config_params); -static int wifi_ap_set_rts_threshold(uint32_t mgmt_request, struct net_if *iface, +static int wifi_ap_set_rts_threshold(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -814,7 +814,7 @@ static int wifi_ap_set_rts_threshold(uint32_t mgmt_request, struct net_if *iface NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_AP_RTS_THRESHOLD, wifi_ap_set_rts_threshold); -static int wifi_iface_status(uint32_t mgmt_request, struct net_if *iface, +static int wifi_iface_status(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -842,7 +842,7 @@ void wifi_mgmt_raise_iface_status_event(struct net_if *iface, } #ifdef CONFIG_NET_STATISTICS_WIFI -static int wifi_iface_stats(uint32_t mgmt_request, struct net_if *iface, +static int wifi_iface_stats(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -861,7 +861,7 @@ static int wifi_iface_stats(uint32_t mgmt_request, struct net_if *iface, } NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_STATS_GET_WIFI, wifi_iface_stats); -static int wifi_iface_stats_reset(uint32_t mgmt_request, struct net_if *iface, +static int wifi_iface_stats_reset(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -876,7 +876,7 @@ static int wifi_iface_stats_reset(uint32_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_STATS_RESET_WIFI, wifi_iface_stats_reset); #endif /* CONFIG_NET_STATISTICS_WIFI */ -static int wifi_11k_cfg(uint32_t mgmt_request, struct net_if *iface, +static int wifi_11k_cfg(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -902,7 +902,7 @@ static int wifi_11k_cfg(uint32_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_11K_CONFIG, wifi_11k_cfg); -static int wifi_11k_neighbor_request(uint32_t mgmt_request, struct net_if *iface, +static int wifi_11k_neighbor_request(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -923,7 +923,7 @@ static int wifi_11k_neighbor_request(uint32_t mgmt_request, struct net_if *iface NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_11K_NEIGHBOR_REQUEST, wifi_11k_neighbor_request); -static int wifi_set_power_save(uint32_t mgmt_request, struct net_if *iface, +static int wifi_set_power_save(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -977,7 +977,7 @@ static int wifi_set_power_save(uint32_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_PS, wifi_set_power_save); -static int wifi_get_power_save_config(uint32_t mgmt_request, struct net_if *iface, +static int wifi_get_power_save_config(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -1001,7 +1001,7 @@ static int wifi_get_power_save_config(uint32_t mgmt_request, struct net_if *ifac NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_PS_CONFIG, wifi_get_power_save_config); -static int wifi_set_twt(uint32_t mgmt_request, struct net_if *iface, +static int wifi_set_twt(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -1068,7 +1068,7 @@ static int wifi_set_twt(uint32_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_TWT, wifi_set_twt); -static int wifi_set_btwt(uint32_t mgmt_request, struct net_if *iface, +static int wifi_set_btwt(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -1108,7 +1108,7 @@ void wifi_mgmt_raise_twt_event(struct net_if *iface, struct wifi_twt_params *twt sizeof(struct wifi_twt_params)); } -static int wifi_reg_domain(uint32_t mgmt_request, struct net_if *iface, +static int wifi_reg_domain(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -1140,7 +1140,7 @@ void wifi_mgmt_raise_twt_sleep_state(struct net_if *iface, sizeof(twt_sleep_state)); } -static int wifi_mode(uint32_t mgmt_request, struct net_if *iface, +static int wifi_mode(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -1164,7 +1164,7 @@ static int wifi_mode(uint32_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_MODE, wifi_mode); -static int wifi_packet_filter(uint32_t mgmt_request, struct net_if *iface, +static int wifi_packet_filter(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -1188,7 +1188,7 @@ static int wifi_packet_filter(uint32_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_PACKET_FILTER, wifi_packet_filter); -static int wifi_channel(uint32_t mgmt_request, struct net_if *iface, +static int wifi_channel(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -1212,7 +1212,7 @@ static int wifi_channel(uint32_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_CHANNEL, wifi_channel); -static int wifi_get_version(uint32_t mgmt_request, struct net_if *iface, +static int wifi_get_version(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -1228,7 +1228,7 @@ static int wifi_get_version(uint32_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_VERSION, wifi_get_version); -static int wifi_btm_query(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) +static int wifi_btm_query(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); const struct wifi_mgmt_ops *const wifi_mgmt_api = get_wifi_api(iface); @@ -1252,7 +1252,7 @@ static int wifi_btm_query(uint32_t mgmt_request, struct net_if *iface, void *dat NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_BTM_QUERY, wifi_btm_query); -static int wifi_get_connection_params(uint32_t mgmt_request, struct net_if *iface, +static int wifi_get_connection_params(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -1272,7 +1272,7 @@ static int wifi_get_connection_params(uint32_t mgmt_request, struct net_if *ifac NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_CONN_PARAMS, wifi_get_connection_params); -static int wifi_wps_config(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) +static int wifi_wps_config(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); const struct wifi_mgmt_ops *const wifi_mgmt_api = get_wifi_api(iface); @@ -1291,7 +1291,7 @@ static int wifi_wps_config(uint32_t mgmt_request, struct net_if *iface, void *da NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_WPS_CONFIG, wifi_wps_config); -static int wifi_set_rts_threshold(uint32_t mgmt_request, struct net_if *iface, +static int wifi_set_rts_threshold(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -1316,7 +1316,7 @@ static int wifi_set_rts_threshold(uint32_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_RTS_THRESHOLD, wifi_set_rts_threshold); #ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_DPP -static int wifi_dpp(uint32_t mgmt_request, struct net_if *iface, +static int wifi_dpp(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -1338,7 +1338,7 @@ NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_DPP, wifi_dpp); #endif /* CONFIG_WIFI_NM_WPA_SUPPLICANT_DPP */ -static int wifi_pmksa_flush(uint32_t mgmt_request, struct net_if *iface, +static int wifi_pmksa_flush(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -1357,7 +1357,7 @@ static int wifi_pmksa_flush(uint32_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_PMKSA_FLUSH, wifi_pmksa_flush); -static int wifi_get_rts_threshold(uint32_t mgmt_request, struct net_if *iface, +static int wifi_get_rts_threshold(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -1382,7 +1382,7 @@ static int wifi_get_rts_threshold(uint32_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_RTS_THRESHOLD_CONFIG, wifi_get_rts_threshold); #ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE -static int wifi_set_enterprise_creds(uint32_t mgmt_request, struct net_if *iface, +static int wifi_set_enterprise_creds(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -1721,7 +1721,7 @@ static int add_static_network_config(struct net_if *iface) #endif /* defined(CONFIG_WIFI_CREDENTIALS_STATIC) */ } -static int connect_stored_command(uint32_t mgmt_request, struct net_if *iface, void *data, +static int connect_stored_command(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { int ret = 0; diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 07514b53a336..8a5468ba81b1 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -518,7 +518,7 @@ static void handle_wifi_neighbor_rep_complete(struct net_mgmt_event_callback *cb #endif static void wifi_mgmt_event_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { switch (mgmt_event) { case NET_EVENT_WIFI_CONNECT_RESULT: @@ -556,7 +556,7 @@ static void wifi_mgmt_event_handler(struct net_mgmt_event_callback *cb, } static void wifi_mgmt_scan_event_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { switch (mgmt_event) { case NET_EVENT_WIFI_SCAN_RESULT: diff --git a/subsys/net/lib/coap/coap.c b/subsys/net/lib/coap/coap.c index b1d00a46f1dd..4ba5f4d309ef 100644 --- a/subsys/net/lib/coap/coap.c +++ b/subsys/net/lib/coap/coap.c @@ -1956,7 +1956,7 @@ void coap_observer_init(struct coap_observer *observer, static inline void coap_observer_raise_event(struct coap_resource *resource, struct coap_observer *observer, - uint32_t mgmt_event) + uint64_t mgmt_event) { #ifdef CONFIG_NET_MGMT_EVENT_INFO const struct net_event_coap_observer net_event = { diff --git a/subsys/net/lib/coap/coap_server.c b/subsys/net/lib/coap/coap_server.c index 6ab85ede3f1a..27e4267167ff 100644 --- a/subsys/net/lib/coap/coap_server.c +++ b/subsys/net/lib/coap/coap_server.c @@ -385,7 +385,7 @@ static inline bool coap_service_in_section(const struct coap_service *service) STRUCT_SECTION_END(coap_service) > service; } -static inline void coap_service_raise_event(const struct coap_service *service, uint32_t mgmt_event) +static inline void coap_service_raise_event(const struct coap_service *service, uint64_t mgmt_event) { #if defined(CONFIG_NET_MGMT_EVENT_INFO) const struct net_event_coap_service net_event = { diff --git a/subsys/net/lib/config/init.c b/subsys/net/lib/config/init.c index 56b6bc03b6cf..22500fd8f844 100644 --- a/subsys/net/lib/config/init.c +++ b/subsys/net/lib/config/init.c @@ -102,7 +102,7 @@ static void print_dhcpv4_info(struct net_if *iface) static struct net_mgmt_event_callback mgmt4_cb; static void ipv4_addr_add_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, + uint64_t mgmt_event, struct net_if *iface) { if (mgmt_event == NET_EVENT_IPV4_ADDR_ADD) { @@ -244,7 +244,7 @@ static struct net_mgmt_event_callback mgmt6_cb; static struct in6_addr laddr; static void ipv6_event_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { struct net_if_ipv6 *ipv6 = iface->config.ip.ipv6; int i; @@ -310,7 +310,7 @@ static void ipv6_event_handler(struct net_mgmt_event_callback *cb, static void setup_ipv6(struct net_if *iface, uint32_t flags) { struct net_if_addr *ifaddr; - uint32_t mask = NET_EVENT_IPV6_DAD_SUCCEED; + uint64_t mask = NET_EVENT_IPV6_DAD_SUCCEED; if (sizeof(CONFIG_NET_CONFIG_MY_IPV6_ADDR) == 1) { /* Empty address, skip setting ANY address in this case */ @@ -330,20 +330,10 @@ static void setup_ipv6(struct net_if *iface, uint32_t flags) net_mgmt_init_event_callback(&mgmt6_cb, ipv6_event_handler, mask); net_mgmt_add_event_callback(&mgmt6_cb); - /* - * check for CMD_ADDR_ADD bit here, NET_EVENT_IPV6_ADDR_ADD is - * a combination of _NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_ADDR_ADD - * so it will always return != NET_EVENT_IPV6_CMD_ADDR_ADD if any other - * event is set (for instance NET_EVENT_IPV6_ROUTER_ADD) - */ - if ((mask & NET_EVENT_IPV6_CMD_ADDR_ADD) == - NET_EVENT_IPV6_CMD_ADDR_ADD) { - ifaddr = net_if_ipv6_addr_add(iface, &laddr, - NET_ADDR_MANUAL, 0); - if (!ifaddr) { - NET_ERR("Cannot add %s to interface", - CONFIG_NET_CONFIG_MY_IPV6_ADDR); - } + ifaddr = net_if_ipv6_addr_add(iface, &laddr, NET_ADDR_MANUAL, 0); + if (!ifaddr) { + NET_ERR("Cannot add %s to interface", + CONFIG_NET_CONFIG_MY_IPV6_ADDR); } exit: @@ -363,7 +353,7 @@ static void setup_ipv6(struct net_if *iface, uint32_t flags) #if defined(CONFIG_NET_NATIVE) static void iface_up_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { if (mgmt_event == NET_EVENT_IF_UP) { NET_INFO("Interface %d (%p) coming up", diff --git a/subsys/net/lib/config/init_clock_sntp.c b/subsys/net/lib/config/init_clock_sntp.c index dd63564f9c02..0e2b9aa13626 100644 --- a/subsys/net/lib/config/init_clock_sntp.c +++ b/subsys/net/lib/config/init_clock_sntp.c @@ -89,7 +89,7 @@ static void sntp_resync_handler(struct k_work *work) #endif /* CONFIG_NET_CONFIG_SNTP_INIT_RESYNC */ #ifdef CONFIG_NET_CONFIG_SNTP_INIT_USE_CONNECTION_MANAGER -static void l4_event_handler(uint32_t mgmt_event, struct net_if *iface, void *info, +static void l4_event_handler(uint64_t mgmt_event, struct net_if *iface, void *info, size_t info_length, void *user_data) { ARG_UNUSED(iface); diff --git a/subsys/net/lib/dhcpv4/dhcpv4.c b/subsys/net/lib/dhcpv4/dhcpv4.c index 2096bf330d9e..f9a20bb7dfed 100644 --- a/subsys/net/lib/dhcpv4/dhcpv4.c +++ b/subsys/net/lib/dhcpv4/dhcpv4.c @@ -1637,7 +1637,7 @@ static enum net_verdict net_dhcpv4_input(struct net_conn *conn, } static void dhcpv4_iface_event_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { sys_snode_t *node = NULL; @@ -1699,7 +1699,7 @@ static void dhcpv4_iface_event_handler(struct net_mgmt_event_callback *cb, #if defined(CONFIG_NET_IPV4_ACD) static void dhcpv4_acd_event_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { sys_snode_t *node = NULL; struct in_addr *addr; diff --git a/subsys/net/lib/dhcpv6/dhcpv6.c b/subsys/net/lib/dhcpv6/dhcpv6.c index c1282c2a6f12..88770bac66d9 100644 --- a/subsys/net/lib/dhcpv6/dhcpv6.c +++ b/subsys/net/lib/dhcpv6/dhcpv6.c @@ -2200,7 +2200,7 @@ static void dhcpv6_timeout(struct k_work *work) } static void dhcpv6_iface_event_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { sys_snode_t *node = NULL; diff --git a/subsys/net/lib/dns/llmnr_responder.c b/subsys/net/lib/dns/llmnr_responder.c index bf330e243745..f0f1f57ff289 100644 --- a/subsys/net/lib/dns/llmnr_responder.c +++ b/subsys/net/lib/dns/llmnr_responder.c @@ -117,7 +117,7 @@ static void create_ipv4_dst_addr(struct sockaddr_in *src_addr, #endif static void llmnr_iface_event_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { if (mgmt_event == NET_EVENT_IF_UP) { #if defined(CONFIG_NET_IPV4) diff --git a/subsys/net/lib/dns/mdns_responder.c b/subsys/net/lib/dns/mdns_responder.c index 29f1c657ae1e..8642364bc2b7 100644 --- a/subsys/net/lib/dns/mdns_responder.c +++ b/subsys/net/lib/dns/mdns_responder.c @@ -157,7 +157,7 @@ static void mark_needs_announce(struct net_if *iface, bool needs_announce) #endif /* CONFIG_MDNS_RESPONDER_PROBE */ static void mdns_iface_event_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { if (mgmt_event == NET_EVENT_IF_UP) { @@ -958,7 +958,7 @@ static void probing(struct k_work *work) } static void mdns_addr_event_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { uint32_t probe_delay = sys_rand32_get() % 250; bool probe_started = false; @@ -1110,7 +1110,7 @@ static void mdns_addr_event_handler(struct net_mgmt_event_callback *cb, } static void mdns_conn_event_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { if (mgmt_event == NET_EVENT_L4_DISCONNECTED) { /* Clear the failed probes counter so that we can start @@ -1823,7 +1823,7 @@ static void do_init_listener(struct k_work *work) static int mdns_responder_init(void) { - uint32_t flags = NET_EVENT_IF_UP; + uint64_t flags = NET_EVENT_IF_UP; external_records = NULL; external_records_count = 0; diff --git a/subsys/net/lib/ptp/port.c b/subsys/net/lib/ptp/port.c index 24abec002c8d..d3f803cb3915 100644 --- a/subsys/net/lib/ptp/port.c +++ b/subsys/net/lib/ptp/port.c @@ -964,7 +964,7 @@ int port_state_update(struct ptp_port *port, enum ptp_port_event event, bool tt_ } static void port_link_monitor(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, + uint64_t mgmt_event, struct net_if *iface) { ARG_UNUSED(cb); diff --git a/subsys/net/lib/shell/events.c b/subsys/net/lib/shell/events.c index 6b27dc2e4b0b..51afbc85fc9f 100644 --- a/subsys/net/lib/shell/events.c +++ b/subsys/net/lib/shell/events.c @@ -44,7 +44,7 @@ static const char unknown_event_str[] = ""; struct event_msg { struct net_if *iface; size_t len; - uint32_t event; + uint64_t event; uint8_t data[MAX_EVENT_INFO_SIZE]; }; @@ -52,7 +52,7 @@ K_MSGQ_DEFINE(event_mon_msgq, sizeof(struct event_msg), CONFIG_NET_MGMT_EVENT_QUEUE_SIZE, sizeof(intptr_t)); static void event_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { struct event_msg msg; int ret; @@ -563,7 +563,7 @@ static void event_mon_handler(const struct shell *sh, void *p2, void *p3) } if (desc == unknown_event_str) { - PR_INFO("EVENT: %s [%d] %s%s%s%s%s (0x%08x)\n", layer_str, + PR_INFO("EVENT: %s [%d] %s%s%s%s%s (0x%" PRIx64 ")\n", layer_str, net_if_get_by_iface(msg.iface), desc, desc2 ? " " : "", desc2 ? desc2 : "", info ? " " : "", info ? info : "", msg.event); diff --git a/subsys/net/lib/sockets/sockets_net_mgmt.c b/subsys/net/lib/sockets/sockets_net_mgmt.c index 909893e0444c..0b45416c1f2d 100644 --- a/subsys/net/lib/sockets/sockets_net_mgmt.c +++ b/subsys/net/lib/sockets/sockets_net_mgmt.c @@ -31,7 +31,7 @@ __net_socket struct net_mgmt_socket { uintptr_t pid; /* net_mgmt mask */ - uint32_t mask; + uint64_t mask; /* Message allocation timeout */ k_timeout_t alloc_timeout; @@ -145,7 +145,7 @@ static ssize_t znet_mgmt_recvfrom(struct net_mgmt_socket *mgmt, void *buf, { struct sockaddr_nm *nm_addr = (struct sockaddr_nm *)src_addr; k_timeout_t timeout = mgmt->wait_timeout; - uint32_t raised_event = 0; + uint64_t raised_event = 0; uint8_t *copy_to = buf; struct net_mgmt_msghdr hdr; struct net_if *iface; diff --git a/subsys/shell/backends/shell_mqtt.c b/subsys/shell/backends/shell_mqtt.c index 28bd39f4b0de..d77cbac67423 100644 --- a/subsys/shell/backends/shell_mqtt.c +++ b/subsys/shell/backends/shell_mqtt.c @@ -508,7 +508,7 @@ static void net_disconnect_handler(struct k_work *work) } /* Network connection event handler */ -static void network_evt_handler(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, +static void network_evt_handler(struct net_mgmt_event_callback *cb, uint64_t mgmt_event, struct net_if *iface) { struct shell_mqtt *sh = sh_mqtt; diff --git a/tests/boards/espressif/ethernet/src/main.c b/tests/boards/espressif/ethernet/src/main.c index b64bc946366a..e9c397d795fd 100644 --- a/tests/boards/espressif/ethernet/src/main.c +++ b/tests/boards/espressif/ethernet/src/main.c @@ -30,7 +30,7 @@ static uint8_t ntp_server[4]; static struct net_mgmt_event_callback mgmt_cb; static struct net_dhcpv4_option_callback dhcp_cb; -static void ipv4_event(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, +static void ipv4_event(struct net_mgmt_event_callback *cb, uint64_t mgmt_event, struct net_if *iface) { if ((mgmt_event != NET_EVENT_IPV4_ADDR_ADD) || diff --git a/tests/boards/espressif/wifi/src/main.c b/tests/boards/espressif/wifi/src/main.c index bbccdb9b2a95..931927ef25da 100644 --- a/tests/boards/espressif/wifi/src/main.c +++ b/tests/boards/espressif/wifi/src/main.c @@ -93,7 +93,7 @@ static void wifi_disconnect_result(struct net_mgmt_event_callback *cb) } } -static void wifi_mgmt_event_handler(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, +static void wifi_mgmt_event_handler(struct net_mgmt_event_callback *cb, uint64_t mgmt_event, struct net_if *iface) { switch (mgmt_event) { diff --git a/tests/net/conn_mgr_conn/src/main.c b/tests/net/conn_mgr_conn/src/main.c index b66e246b12de..940d142b8dbd 100644 --- a/tests/net/conn_mgr_conn/src/main.c +++ b/tests/net/conn_mgr_conn/src/main.c @@ -95,7 +95,7 @@ static struct event_stats { struct net_mgmt_event_callback conn_mgr_conn_callback; static void conn_mgr_conn_handler(struct net_mgmt_event_callback *cb, - uint32_t event, struct net_if *iface) + uint64_t event, struct net_if *iface) { k_mutex_lock(&event_mutex, K_FOREVER); diff --git a/tests/net/conn_mgr_monitor/src/main.c b/tests/net/conn_mgr_monitor/src/main.c index cd8242c10d15..e1e1cd67081b 100644 --- a/tests/net/conn_mgr_monitor/src/main.c +++ b/tests/net/conn_mgr_monitor/src/main.c @@ -38,12 +38,12 @@ #define DAD_WAIT_TIME EVENT_WAIT_TIME #endif -#define TEST_EXPECT_L4_CONNECTED BIT(NET_EVENT_L4_CMD_CONNECTED) -#define TEST_EXPECT_L4_DISCONNECTED BIT(NET_EVENT_L4_CMD_DISCONNECTED) -#define TEST_EXPECT_L4_IPV6_CONNECTED BIT(NET_EVENT_L4_CMD_IPV6_CONNECTED) -#define TEST_EXPECT_L4_IPV6_DISCONNECTED BIT(NET_EVENT_L4_CMD_IPV6_DISCONNECTED) -#define TEST_EXPECT_L4_IPV4_CONNECTED BIT(NET_EVENT_L4_CMD_IPV4_CONNECTED) -#define TEST_EXPECT_L4_IPV4_DISCONNECTED BIT(NET_EVENT_L4_CMD_IPV4_DISCONNECTED) +#define TEST_EXPECT_L4_CONNECTED NET_EVENT_L4_CMD_CONNECTED +#define TEST_EXPECT_L4_DISCONNECTED NET_EVENT_L4_CMD_DISCONNECTED +#define TEST_EXPECT_L4_IPV6_CONNECTED NET_EVENT_L4_CMD_IPV6_CONNECTED +#define TEST_EXPECT_L4_IPV6_DISCONNECTED NET_EVENT_L4_CMD_IPV6_DISCONNECTED +#define TEST_EXPECT_L4_IPV4_CONNECTED NET_EVENT_L4_CMD_IPV4_CONNECTED +#define TEST_EXPECT_L4_IPV4_DISCONNECTED NET_EVENT_L4_CMD_IPV4_DISCONNECTED #define TEST_EXPECT_CLEAR(event) (global_stats.expected_events &= ~event) @@ -162,7 +162,7 @@ static struct test_stats get_reset_stats(void) /* Callback hooks */ struct net_mgmt_event_callback l4_callback; -void l4_handler(struct net_mgmt_event_callback *cb, uint32_t event, struct net_if *iface) +void l4_handler(struct net_mgmt_event_callback *cb, uint64_t event, struct net_if *iface) { if (event == NET_EVENT_L4_CONNECTED) { k_mutex_lock(&stats_mutex, K_FOREVER); @@ -187,7 +187,7 @@ void l4_handler(struct net_mgmt_event_callback *cb, uint32_t event, struct net_i struct net_mgmt_event_callback conn_callback; -void conn_handler(struct net_mgmt_event_callback *cb, uint32_t event, struct net_if *iface) +void conn_handler(struct net_mgmt_event_callback *cb, uint64_t event, struct net_if *iface) { if (event == NET_EVENT_L4_IPV6_CONNECTED) { k_mutex_lock(&stats_mutex, K_FOREVER); @@ -224,7 +224,7 @@ void conn_handler(struct net_mgmt_event_callback *cb, uint32_t event, struct net } } -static void wait_for_events(uint32_t event_mask, k_timeout_t timeout) +static void wait_for_events(uint64_t event_mask, k_timeout_t timeout) { k_mutex_lock(&stats_mutex, K_FOREVER); k_sem_reset(&event_sem); diff --git a/tests/net/conn_mgr_nsos/src/main.c b/tests/net/conn_mgr_nsos/src/main.c index 41c4273f262f..d4e014accff8 100644 --- a/tests/net/conn_mgr_nsos/src/main.c +++ b/tests/net/conn_mgr_nsos/src/main.c @@ -15,7 +15,7 @@ K_SEM_DEFINE(l4_connected, 0, 1); K_SEM_DEFINE(l4_disconnected, 0, 1); -static void l4_event_handler(struct net_mgmt_event_callback *cb, uint32_t event, +static void l4_event_handler(struct net_mgmt_event_callback *cb, uint64_t event, struct net_if *iface) { switch (event) { diff --git a/tests/net/dhcpv4/client/prj.conf b/tests/net/dhcpv4/client/prj.conf index 5b126f90a14c..5ac775854822 100644 --- a/tests/net/dhcpv4/client/prj.conf +++ b/tests/net/dhcpv4/client/prj.conf @@ -20,6 +20,7 @@ CONFIG_NET_MGMT_EVENT=y CONFIG_NET_MGMT_EVENT_INFO=y CONFIG_DNS_RESOLVER=y +CONFIG_DNS_RESOLVER_MAX_SERVERS=3 # Turn off UDP checksum checking as the test fails otherwise. CONFIG_NET_UDP_CHECKSUM=n @@ -31,3 +32,5 @@ CONFIG_NET_DHCPV4_INITIAL_DELAY_MAX=2 CONFIG_NET_DHCPV4_LOG_LEVEL_DBG=y CONFIG_LOG_BUFFER_SIZE=8192 + +CONFIG_ZVFS_POLL_MAX=5 diff --git a/tests/net/dhcpv4/client/src/main.c b/tests/net/dhcpv4/client/src/main.c index 654a98d2cbee..7c87ab4d4786 100644 --- a/tests/net/dhcpv4/client/src/main.c +++ b/tests/net/dhcpv4/client/src/main.c @@ -493,7 +493,7 @@ static struct net_dhcpv4_option_callback opt_vs_invalid_cb; static int event_count; static void receiver_cb(struct net_mgmt_event_callback *cb, - uint32_t nm_event, struct net_if *iface) + uint64_t nm_event, struct net_if *iface) { if (nm_event != NET_EVENT_IPV4_ADDR_ADD && nm_event != NET_EVENT_DNS_SERVER_ADD && @@ -694,7 +694,7 @@ ZTEST(dhcpv4_tests, test_dhcp) #elif defined(CONFIG_NET_DHCPV4_OPTION_CALLBACKS) while (event_count < 10) { #elif defined(CONFIG_NET_DHCPV4_OPTION_PRINT_IGNORED) - while (event_count < 2) { + while (event_count < 1) { #else while (event_count < 5) { #endif diff --git a/tests/net/dhcpv6/src/main.c b/tests/net/dhcpv6/src/main.c index c5046a2746a2..b1375383c678 100644 --- a/tests/net/dhcpv6/src/main.c +++ b/tests/net/dhcpv6/src/main.c @@ -178,7 +178,7 @@ static struct net_pkt *test_dhcpv6_create_message( return NULL; } -static void evt_handler(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, +static void evt_handler(struct net_mgmt_event_callback *cb, uint64_t mgmt_event, struct net_if *iface) { ARG_UNUSED(cb); diff --git a/tests/net/hostname/src/main.c b/tests/net/hostname/src/main.c index bfc2fd926f8e..b5c0664d2ef7 100644 --- a/tests/net/hostname/src/main.c +++ b/tests/net/hostname/src/main.c @@ -101,7 +101,7 @@ static void net_iface_init(struct net_if *iface) #ifdef CONFIG_NET_MGMT_EVENT static void hostname_changed(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { if (mgmt_event == NET_EVENT_HOSTNAME_CHANGED) { #ifdef CONFIG_NET_MGMT_EVENT_INFO diff --git a/tests/net/ieee802154/l2/src/ieee802154_shell_test.c b/tests/net/ieee802154/l2/src/ieee802154_shell_test.c index 0281b699edbe..5964025e0231 100644 --- a/tests/net/ieee802154/l2/src/ieee802154_shell_test.c +++ b/tests/net/ieee802154/l2/src/ieee802154_shell_test.c @@ -50,7 +50,7 @@ static bool expected_association_permitted_bit; #define EXPECTED_PAYLOAD_DATA EXPECTED_ENDDEVICE_EXT_ADDR_LE #define EXPECTED_PAYLOAD_LEN 8 -static void scan_result_cb(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, +static void scan_result_cb(struct net_mgmt_event_callback *cb, uint64_t mgmt_event, struct net_if *iface) { struct ieee802154_context *ctx = net_if_l2_data(iface); diff --git a/tests/net/igmp/src/main.c b/tests/net/igmp/src/main.c index 7878c5953eb4..e2f201dd4eee 100644 --- a/tests/net/igmp/src/main.c +++ b/tests/net/igmp/src/main.c @@ -227,7 +227,7 @@ NET_DEVICE_INIT(net_test_igmp, "net_test_igmp", 127); static void group_joined(struct net_mgmt_event_callback *cb, - uint32_t nm_event, struct net_if *iface) + uint64_t nm_event, struct net_if *iface) { if (nm_event != NET_EVENT_IPV4_MCAST_JOIN) { /* Spurious callback. */ @@ -240,7 +240,7 @@ static void group_joined(struct net_mgmt_event_callback *cb, } static void group_left(struct net_mgmt_event_callback *cb, - uint32_t nm_event, struct net_if *iface) + uint64_t nm_event, struct net_if *iface) { if (nm_event != NET_EVENT_IPV4_MCAST_LEAVE) { /* Spurious callback. */ @@ -253,7 +253,7 @@ static void group_left(struct net_mgmt_event_callback *cb, } static struct mgmt_events { - uint32_t event; + uint64_t event; net_mgmt_event_handler_t handler; struct net_mgmt_event_callback cb; } mgmt_events[] = { diff --git a/tests/net/lib/dns_addremove/src/main.c b/tests/net/lib/dns_addremove/src/main.c index 1b6f55efd730..f8f9fdc1c806 100644 --- a/tests/net/lib/dns_addremove/src/main.c +++ b/tests/net/lib/dns_addremove/src/main.c @@ -139,7 +139,7 @@ NET_DEVICE_INIT_INSTANCE(net_iface1_test, 127); static void dns_evt_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { if (mgmt_event == NET_EVENT_DNS_SERVER_ADD) { k_sem_give(&dns_added); diff --git a/tests/net/mgmt/src/mgmt.c b/tests/net/mgmt/src/mgmt.c index 004b60adb971..288dcc353b21 100644 --- a/tests/net/mgmt/src/mgmt.c +++ b/tests/net/mgmt/src/mgmt.c @@ -28,7 +28,7 @@ LOG_MODULE_REGISTER(net_test, CONFIG_NET_MGMT_EVENT_LOG_LEVEL); MAX(sizeof(TEST_INFO_STRING), sizeof(struct in6_addr)) /* Notifier infra */ -static uint32_t event2throw; +static uint64_t event2throw; static uint32_t throw_times; static uint32_t throw_sleep; static bool with_info; @@ -38,7 +38,7 @@ static struct k_thread thrower_thread_data; static struct k_sem thrower_lock; /* Receiver infra */ -static uint32_t rx_event; +static uint64_t rx_event; static uint32_t rx_calls; static size_t info_length_in_test; static struct net_mgmt_event_callback rx_cb; @@ -49,7 +49,7 @@ static struct in6_addr addr6 = { { { 0xfe, 0x80, 0, 0, 0, 0, 0, 0, static char info_data[TEST_MGMT_EVENT_INFO_SIZE]; -static int test_mgmt_request(uint32_t mgmt_request, +static int test_mgmt_request(uint64_t mgmt_request, struct net_if *iface, void *data, uint32_t len) { uint32_t *test_data = data; @@ -67,14 +67,14 @@ static int test_mgmt_request(uint32_t mgmt_request, NET_MGMT_REGISTER_REQUEST_HANDLER(TEST_MGMT_REQUEST, test_mgmt_request); -static void test_mgmt_event_handler(uint32_t mgmt_event, struct net_if *iface, void *info, +static void test_mgmt_event_handler(uint64_t mgmt_event, struct net_if *iface, void *info, size_t info_length, void *user_data) { if (!with_static) { return; } - TC_PRINT("\t\tReceived static event 0x%08X\n", mgmt_event); + TC_PRINT("\t\tReceived static event 0x%" PRIx64 "\n", mgmt_event); ARG_UNUSED(user_data); @@ -144,7 +144,7 @@ static void thrower_thread(void *p1, void *p2, void *p3) while (1) { k_sem_take(&thrower_lock, K_FOREVER); - TC_PRINT("\tThrowing event 0x%08X %u times\n", + TC_PRINT("\tThrowing event 0x%" PRIx64 " %u times\n", event2throw, throw_times); for (; throw_times; throw_times--) { @@ -168,9 +168,9 @@ static void thrower_thread(void *p1, void *p2, void *p3) } static void receiver_cb(struct net_mgmt_event_callback *cb, - uint32_t nm_event, struct net_if *iface) + uint64_t nm_event, struct net_if *iface) { - TC_PRINT("\t\tReceived event 0x%08X\n", nm_event); + TC_PRINT("\t\tReceived event 0x%" PRIx64 "\n", nm_event); if (with_info && cb->info) { if (cb->info_length != info_length_in_test) { @@ -208,14 +208,15 @@ static int sending_event(uint32_t times, bool receiver, bool info) k_msleep(THREAD_SLEEP); if (receiver) { - TC_PRINT("\tReceived 0x%08X %u times\n", + TC_PRINT("\tReceived 0x%" PRIx64 " %u times\n", rx_event, rx_calls); zassert_equal(rx_event, event2throw, "rx_event check failed"); zassert_equal(rx_calls, times, "rx_calls check failed"); net_mgmt_del_event_callback(&rx_cb); - rx_event = rx_calls = 0U; + rx_event = 0ULL; + rx_calls = 0U; } return TC_PASS; @@ -233,7 +234,7 @@ static int test_sending_event_info(uint32_t times, bool receiver) static int test_synchronous_event_listener(uint32_t times, bool on_iface) { - uint32_t event_mask; + uint64_t event_mask; int ret; TC_PRINT("- Synchronous event listener %s\n", @@ -283,13 +284,14 @@ static int test_static_event_listener(uint32_t times, bool info) /* Let the network stack to proceed */ k_msleep(THREAD_SLEEP); - TC_PRINT("\tReceived 0x%08X %u times\n", + TC_PRINT("\tReceived 0x%" PRIx64 " %u times\n", rx_event, rx_calls); zassert_equal(rx_event, event2throw, "rx_event check failed"); zassert_equal(rx_calls, times, "rx_calls check failed"); - rx_event = rx_calls = 0U; + rx_event = 0ULL; + rx_calls = 0U; with_static = false; return TC_PASS; @@ -297,12 +299,12 @@ static int test_static_event_listener(uint32_t times, bool info) static void initialize_event_tests(void) { - event2throw = 0U; + event2throw = 0ULL; throw_times = 0U; throw_sleep = 0; with_info = false; - rx_event = 0U; + rx_event = 0ULL; rx_calls = 0U; k_sem_init(&thrower_lock, 0, UINT_MAX); @@ -318,9 +320,9 @@ static void initialize_event_tests(void) NULL, NULL, NULL, K_PRIO_COOP(7), 0, K_NO_WAIT); } -static int test_core_event(uint32_t event, bool (*func)(void)) +static int test_core_event(uint64_t event, bool (*func)(void)) { - TC_PRINT("- Triggering core event: 0x%08X\n", event); + TC_PRINT("- Triggering core event: 0x%" PRIx64 "\n", event); info_length_in_test = sizeof(struct in6_addr); memcpy(info_data, &addr6, sizeof(addr6)); @@ -336,10 +338,11 @@ static int test_core_event(uint32_t event, bool (*func)(void)) zassert_true(rx_calls > 0 && rx_calls != -1, "rx_calls empty"); zassert_equal(rx_event, event, "rx_event check failed, " - "0x%08x vs 0x%08x", rx_event, event); + "0x%" PRIx64 " vs 0x%" PRIx64, rx_event, event); net_mgmt_del_event_callback(&rx_cb); - rx_event = rx_calls = 0U; + rx_event = 0ULL; + rx_calls = 0U; return TC_PASS; } @@ -426,7 +429,7 @@ ZTEST(mgmt_fn_test_suite, test_mgmt) static K_SEM_DEFINE(wait_for_event_processing, 0, 1); static void net_mgmt_event_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { static int cb_call_count; diff --git a/tests/net/mld/src/main.c b/tests/net/mld/src/main.c index 1c95fe5409dc..0036b5853af3 100644 --- a/tests/net/mld/src/main.c +++ b/tests/net/mld/src/main.c @@ -238,7 +238,7 @@ static void test_iface_carrier_off_on(void) } static void group_joined(struct net_mgmt_event_callback *cb, - uint32_t nm_event, struct net_if *iface) + uint64_t nm_event, struct net_if *iface) { if (nm_event != NET_EVENT_IPV6_MCAST_JOIN) { /* Spurious callback. */ @@ -254,7 +254,7 @@ static void group_joined(struct net_mgmt_event_callback *cb, } static void group_left(struct net_mgmt_event_callback *cb, - uint32_t nm_event, struct net_if *iface) + uint64_t nm_event, struct net_if *iface) { if (nm_event != NET_EVENT_IPV6_MCAST_LEAVE) { /* Spurious callback. */ @@ -270,7 +270,7 @@ static void group_left(struct net_mgmt_event_callback *cb, } static struct mgmt_events { - uint32_t event; + uint64_t event; net_mgmt_event_handler_t handler; struct net_mgmt_event_callback cb; } mgmt_events[] = { diff --git a/tests/net/pmtu/src/main.c b/tests/net/pmtu/src/main.c index 54d225a259e2..d744a4415f43 100644 --- a/tests/net/pmtu/src/main.c +++ b/tests/net/pmtu/src/main.c @@ -103,7 +103,7 @@ static K_SEM_DEFINE(wait_pmtu_changed, 0, UINT_MAX); static bool is_pmtu_changed; static void ipv6_pmtu_changed(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, + uint64_t mgmt_event, struct net_if *iface) { ARG_UNUSED(cb); @@ -123,7 +123,7 @@ static void ipv6_pmtu_changed(struct net_mgmt_event_callback *cb, } static void ipv4_pmtu_changed(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, + uint64_t mgmt_event, struct net_if *iface) { ARG_UNUSED(cb); @@ -143,7 +143,7 @@ static void ipv4_pmtu_changed(struct net_mgmt_event_callback *cb, } static struct mgmt_events { - uint32_t event; + uint64_t event; net_mgmt_event_handler_t handler; struct net_mgmt_event_callback cb; } mgmt_events[] = { From 664e66c32f9ff1dc86a0fed3fea82b55cce36bfa Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Wed, 4 Jun 2025 16:35:31 +0300 Subject: [PATCH 0598/2141] [nrf fromtree] net: socket: mgmt: Create proper socket options for net_mgmt sockets We cannot use the network management event number directly as a socket option value because the management value is uint64_t and that cannot be mapped directly to 32 bit integer. So have an intermediate socket option that is mapped to actual network management request number in getsockopt() and setsockopt(). Signed-off-by: Jukka Rissanen (cherry picked from commit 2ed2232f17f732bcf8b21db70e6dfb4e49782be1) Signed-off-by: Robert Lubos --- include/zephyr/net/socket_net_mgmt.h | 13 +++++++++++++ subsys/net/lib/sockets/sockets_net_mgmt.c | 4 ++-- tests/net/socket/net_mgmt/src/main.c | 21 +++++++++++++++++---- 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/include/zephyr/net/socket_net_mgmt.h b/include/zephyr/net/socket_net_mgmt.h index 337648d5d188..595a92bbad93 100644 --- a/include/zephyr/net/socket_net_mgmt.h +++ b/include/zephyr/net/socket_net_mgmt.h @@ -42,6 +42,19 @@ extern "C" { /** @endcond */ +/** + * @name Socket options for NET_MGMT sockets + * @{ + */ + +/** Set Ethernet Qav parameters */ +#define SO_NET_MGMT_ETHERNET_SET_QAV_PARAM 1 + +/** Get Ethernet Qav parameters */ +#define SO_NET_MGMT_ETHERNET_GET_QAV_PARAM 2 + +/** @} */ /* for @name */ + /** * struct sockaddr_nm - The sockaddr structure for NET_MGMT sockets * diff --git a/subsys/net/lib/sockets/sockets_net_mgmt.c b/subsys/net/lib/sockets/sockets_net_mgmt.c index 0b45416c1f2d..dcb4194ec85d 100644 --- a/subsys/net/lib/sockets/sockets_net_mgmt.c +++ b/subsys/net/lib/sockets/sockets_net_mgmt.c @@ -237,7 +237,7 @@ static int znet_mgmt_getsockopt(struct net_mgmt_socket *mgmt, int level, } if (IS_ENABLED(CONFIG_NET_L2_ETHERNET_MGMT)) { - if (optname == NET_REQUEST_ETHERNET_GET_QAV_PARAM) { + if (optname == SO_NET_MGMT_ETHERNET_GET_QAV_PARAM) { int ret; ret = net_mgmt(NET_REQUEST_ETHERNET_GET_QAV_PARAM, @@ -274,7 +274,7 @@ static int znet_mgmt_setsockopt(struct net_mgmt_socket *mgmt, int level, } if (IS_ENABLED(CONFIG_NET_L2_ETHERNET_MGMT)) { - if (optname == NET_REQUEST_ETHERNET_SET_QAV_PARAM) { + if (optname == SO_NET_MGMT_ETHERNET_SET_QAV_PARAM) { int ret; ret = net_mgmt(NET_REQUEST_ETHERNET_SET_QAV_PARAM, diff --git a/tests/net/socket/net_mgmt/src/main.c b/tests/net/socket/net_mgmt/src/main.c index a5d6ead46793..89901beda7b2 100644 --- a/tests/net/socket/net_mgmt/src/main.c +++ b/tests/net/socket/net_mgmt/src/main.c @@ -20,6 +20,19 @@ LOG_MODULE_REGISTER(net_test, CONFIG_NET_SOCKETS_LOG_LEVEL); #define STACK_SIZE 1024 #define THREAD_PRIORITY K_PRIO_COOP(8) +/* Use a base value for socket options that are not implemented. + * This is used to check if the socket option is implemented or not. + */ +#define NOT_IMPLEMENTED_SOCKET_OPTION_BASE (INT32_MAX - 1000) + +#if !defined(SO_NET_MGMT_ETHERNET_GET_PRIORITY_QUEUES_NUM) +#define SO_NET_MGMT_ETHERNET_GET_PRIORITY_QUEUES_NUM (NOT_IMPLEMENTED_SOCKET_OPTION_BASE + 1) +#endif /* !defined(SO_NET_MGMT_ETHERNET_GET_PRIORITY_QUEUES_NUM) */ + +#if !defined(SO_NET_MGMT_ETHERNET_SET_MAC_ADDRESS) +#define SO_NET_MGMT_ETHERNET_SET_MAC_ADDRESS (NOT_IMPLEMENTED_SOCKET_OPTION_BASE + 2) +#endif /* !defined(SO_NET_MGMT_ETHERNET_SET_MAC_ADDRESS) */ + static struct net_if *default_iface; static ZTEST_BMEM int fd; @@ -502,7 +515,7 @@ static void test_ethernet_set_qav(void) params.qav_param.enabled = true; ret = zsock_setsockopt(fd, SOL_NET_MGMT_RAW, - NET_REQUEST_ETHERNET_SET_QAV_PARAM, + SO_NET_MGMT_ETHERNET_SET_QAV_PARAM, ¶ms, sizeof(params)); zassert_equal(ret, 0, "Cannot set Qav parameters"); } @@ -529,7 +542,7 @@ static void test_ethernet_get_qav(void) params.qav_param.type = ETHERNET_QAV_PARAM_TYPE_STATUS; ret = zsock_getsockopt(fd, SOL_NET_MGMT_RAW, - NET_REQUEST_ETHERNET_GET_QAV_PARAM, + SO_NET_MGMT_ETHERNET_GET_QAV_PARAM, ¶ms, &optlen); zassert_equal(ret, 0, "Cannot get Qav parameters (%d)", ret); zassert_equal(optlen, sizeof(params), "Invalid optlen (%d)", optlen); @@ -556,7 +569,7 @@ static void test_ethernet_get_unknown_option(void) memset(¶ms, 0, sizeof(params)); ret = zsock_getsockopt(fd, SOL_NET_MGMT_RAW, - NET_REQUEST_ETHERNET_GET_PRIORITY_QUEUES_NUM, + SO_NET_MGMT_ETHERNET_GET_PRIORITY_QUEUES_NUM, ¶ms, &optlen); zassert_equal(ret, -1, "Could get prio queue parameters (%d)", errno); zassert_equal(errno, EINVAL, "prio queue get parameters"); @@ -581,7 +594,7 @@ static void test_ethernet_set_unknown_option(void) memset(¶ms, 0, sizeof(params)); ret = zsock_setsockopt(fd, SOL_NET_MGMT_RAW, - NET_REQUEST_ETHERNET_SET_MAC_ADDRESS, + SO_NET_MGMT_ETHERNET_SET_MAC_ADDRESS, ¶ms, optlen); zassert_equal(ret, -1, "Could set promisc_mode parameters (%d)", errno); zassert_equal(errno, EINVAL, "promisc_mode set parameters"); From 2b89705e9b89a5779bcdccfe853d2c0d08074a16 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Fri, 30 May 2025 15:23:23 +0300 Subject: [PATCH 0599/2141] [nrf fromtree] doc: migration: 4.2: Add information about net_mgmt API changes Add information how the net_mgmt request handler is changed. The event number type is changed from uint32_t to uint64_t to allow the event command to be a bit mask instead of enum value. Signed-off-by: Jukka Rissanen (cherry picked from commit 6b0597f631338b2193a57c91a1093b0aeb8dd1d2) Signed-off-by: Robert Lubos --- doc/releases/migration-guide-4.2.rst | 15 +++++++++++++++ doc/releases/release-notes-4.2.rst | 7 +++++++ 2 files changed, 22 insertions(+) diff --git a/doc/releases/migration-guide-4.2.rst b/doc/releases/migration-guide-4.2.rst index 08a2a3d0e33d..9b31f4a16348 100644 --- a/doc/releases/migration-guide-4.2.rst +++ b/doc/releases/migration-guide-4.2.rst @@ -509,6 +509,21 @@ Networking need to update their response callback implementations. To retain current behavior, simply return 0 from the callback. +* The API signature of ``net_mgmt`` event handler :c:type:`net_mgmt_event_handler_t` and + request handler :c:type:`net_mgmt_request_handler_t` has changed. The management event + type is changed from ``uint32_t`` to ``uint64_t``. The change allows event number values + to be bit masks instead of enum values. The layer code still stays as a enum value. + The :c:macro:`NET_MGMT_LAYER_CODE` and :c:macro:`NET_MGMT_GET_COMMAND` can be used to get + the layer code and management event command from the actual event value in the request or + event handlers if needed. + +* The socket options for ``net_mgmt`` type sockets cannot directly be network management + event types as those are now ``uint64_t`` and the socket option expects a normal 32 bit + integer value. Because of this, a new ``SO_NET_MGMT_ETHERNET_SET_QAV_PARAM`` + and ``SO_NET_MGMT_ETHERNET_GET_QAV_PARAM`` socket options are created that will replace + the previously used ``NET_REQUEST_ETHERNET_GET_QAV_PARAM`` and + ``NET_REQUEST_ETHERNET_GET_QAV_PARAM`` options. + OpenThread ========== diff --git a/doc/releases/release-notes-4.2.rst b/doc/releases/release-notes-4.2.rst index 00c655568802..80e0f5868def 100644 --- a/doc/releases/release-notes-4.2.rst +++ b/doc/releases/release-notes-4.2.rst @@ -111,6 +111,13 @@ Deprecated APIs and options was deprecated since Zephyr 4.0, and users were advised to migrate to alternative crypto backends. +Stable API changes in this release +================================== + +* The API signature of ``net_mgmt`` event handler :c:type:`net_mgmt_event_handler_t` + and request handler :c:type:`net_mgmt_request_handler_t` has changed. The event value + type is changed from ``uint32_t`` to ``uint64_t``. + New APIs and options ==================== From f5093d3789c7b9fd38ab1c17d62a74854c5d70c6 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 9 Jun 2025 17:28:47 +0300 Subject: [PATCH 0600/2141] [nrf fromtree] net: mgmt: Increment API major version number As per API overview documentation, a braking API change must increment major version number. https://docs.zephyrproject.org/latest/develop/api/overview.html#api-overview Signed-off-by: Jukka Rissanen (cherry picked from commit b1a8655bf0d8fb64ce1034e7b7efd2e983360874) Signed-off-by: Robert Lubos --- include/zephyr/net/net_mgmt.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/zephyr/net/net_mgmt.h b/include/zephyr/net/net_mgmt.h index 9c559b7fd8b9..1c5f0aebeaa9 100644 --- a/include/zephyr/net/net_mgmt.h +++ b/include/zephyr/net/net_mgmt.h @@ -24,7 +24,7 @@ extern "C" { * @brief Network Management * @defgroup net_mgmt Network Management * @since 1.7 - * @version 1.0.0 + * @version 2.0.0 * @ingroup networking * @{ */ From 22479b9c1f1d4915b4adc2bec36021f2e86f7c9b Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 26 Jun 2025 15:01:20 +0200 Subject: [PATCH 0601/2141] [nrf fromtree] net: ppp: stats: Fix net_mgmt request handler format This has been missed in net_mgmt rework in commit 5a9a39caf3bf5195a38194bb844a428eaa7f2bb8. Signed-off-by: Robert Lubos (cherry picked from commit 3e704256e308fed36dfea82b1e897439eecc49fe) --- subsys/net/l2/ppp/ppp_stats.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/l2/ppp/ppp_stats.c b/subsys/net/l2/ppp/ppp_stats.c index 9dafef154b30..ee831b3953da 100644 --- a/subsys/net/l2/ppp/ppp_stats.c +++ b/subsys/net/l2/ppp/ppp_stats.c @@ -17,7 +17,7 @@ LOG_MODULE_REGISTER(net_ppp_stats, CONFIG_NET_L2_PPP_LOG_LEVEL); #if defined(CONFIG_NET_STATISTICS_USER_API) -static int ppp_stats_get(uint32_t mgmt_request, struct net_if *iface, +static int ppp_stats_get(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { size_t len_chk = 0; From 2cf4a21ae0008f40c499943e9ba7ec794ab0385b Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 26 Jun 2025 14:17:43 +0200 Subject: [PATCH 0602/2141] [nrf fromtree] net: events: Add missing net_mgmt.h include net_event.h header makes use of macros defined in net_mgmt.h, therefore it should include that header. Signed-off-by: Robert Lubos (cherry picked from commit ae7d7a800e281b42068a56cda3a7c5be56639600) --- include/zephyr/net/net_event.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/zephyr/net/net_event.h b/include/zephyr/net/net_event.h index 3a948ca5ef96..556a78ae99e9 100644 --- a/include/zephyr/net/net_event.h +++ b/include/zephyr/net/net_event.h @@ -13,6 +13,7 @@ #define ZEPHYR_INCLUDE_NET_NET_EVENT_H_ #include +#include #include #ifdef __cplusplus From 9c45c9847cf12b71026a1241dfc06bf52da3f1a9 Mon Sep 17 00:00:00 2001 From: Ajay Parida Date: Mon, 3 Jun 2024 17:31:59 +0530 Subject: [PATCH 0603/2141] [nrf fromtree] net: l2: wifi: Configure BSS max idle period Support to configure BSS max idle period at runtime. Signed-off-by: Ajay Parida (cherry picked from commit c70b3504bb9aa421baa150ec9248808f82b04219) Signed-off-by: Robert Lubos --- drivers/wifi/nrf_wifi/inc/fmac_main.h | 1 + drivers/wifi/nrf_wifi/inc/wifi_mgmt.h | 3 ++ drivers/wifi/nrf_wifi/src/fmac_main.c | 4 ++ drivers/wifi/nrf_wifi/src/wifi_mgmt.c | 53 +++++++++++++++++++++++++ drivers/wifi/nrf_wifi/src/wpa_supp_if.c | 6 ++- include/zephyr/net/wifi_mgmt.h | 16 ++++++++ modules/hostap/src/supp_api.c | 13 ++++++ modules/hostap/src/supp_api.h | 8 ++++ modules/hostap/src/supp_main.c | 1 + subsys/net/l2/wifi/Kconfig | 16 ++++++++ subsys/net/l2/wifi/wifi_mgmt.c | 25 ++++++++++++ subsys/net/l2/wifi/wifi_shell.c | 32 +++++++++++++++ 12 files changed, 176 insertions(+), 2 deletions(-) diff --git a/drivers/wifi/nrf_wifi/inc/fmac_main.h b/drivers/wifi/nrf_wifi/inc/fmac_main.h index c193515ae2dd..7a863d8b614a 100644 --- a/drivers/wifi/nrf_wifi/inc/fmac_main.h +++ b/drivers/wifi/nrf_wifi/inc/fmac_main.h @@ -91,6 +91,7 @@ struct nrf_wifi_vif_ctx_zep { struct k_work_delayable nrf_wifi_rpu_recovery_bringup_work; #endif /* CONFIG_NRF_WIFI_RPU_RECOVERY */ int rts_threshold_value; + unsigned short bss_max_idle_period; }; struct nrf_wifi_vif_ctx_map { diff --git a/drivers/wifi/nrf_wifi/inc/wifi_mgmt.h b/drivers/wifi/nrf_wifi/inc/wifi_mgmt.h index a4ae20302100..9b84427cdca4 100644 --- a/drivers/wifi/nrf_wifi/inc/wifi_mgmt.h +++ b/drivers/wifi/nrf_wifi/inc/wifi_mgmt.h @@ -77,4 +77,7 @@ int nrf_wifi_set_rts_threshold(const struct device *dev, int nrf_wifi_get_rts_threshold(const struct device *dev, unsigned int *rts_threshold); + +int nrf_wifi_set_bss_max_idle_period(const struct device *dev, + unsigned short bss_max_idle_period); #endif /* __ZEPHYR_WIFI_MGMT_H__ */ diff --git a/drivers/wifi/nrf_wifi/src/fmac_main.c b/drivers/wifi/nrf_wifi/src/fmac_main.c index 379c3242b182..f2d9aa55af9f 100644 --- a/drivers/wifi/nrf_wifi/src/fmac_main.c +++ b/drivers/wifi/nrf_wifi/src/fmac_main.c @@ -858,6 +858,9 @@ static int nrf_wifi_drv_main_zep(const struct device *dev) #endif /* CONFIG_NRF70_RADIO_TEST */ k_mutex_init(&rpu_drv_priv_zep.rpu_ctx_zep.rpu_lock); +#ifndef CONFIG_NRF70_RADIO_TEST + vif_ctx_zep->bss_max_idle_period = USHRT_MAX; +#endif /* !CONFIG_NRF70_RADIO_TEST */ return 0; #ifdef CONFIG_NRF70_RADIO_TEST fmac_deinit: @@ -885,6 +888,7 @@ static const struct wifi_mgmt_ops nrf_wifi_mgmt_ops = { .get_power_save_config = nrf_wifi_get_power_save_config, .set_rts_threshold = nrf_wifi_set_rts_threshold, .get_rts_threshold = nrf_wifi_get_rts_threshold, + .set_bss_max_idle_period = nrf_wifi_set_bss_max_idle_period, #endif #ifdef CONFIG_NRF70_SYSTEM_WITH_RAW_MODES .mode = nrf_wifi_mode, diff --git a/drivers/wifi/nrf_wifi/src/wifi_mgmt.c b/drivers/wifi/nrf_wifi/src/wifi_mgmt.c index a323faf21dd6..e9755e80013e 100644 --- a/drivers/wifi/nrf_wifi/src/wifi_mgmt.c +++ b/drivers/wifi/nrf_wifi/src/wifi_mgmt.c @@ -1077,3 +1077,56 @@ int nrf_wifi_get_rts_threshold(const struct device *dev, return ret; } + +int nrf_wifi_set_bss_max_idle_period(const struct device *dev, + unsigned short bss_max_idle_period) +{ + struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; + struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; + int ret = -1; + + if (!dev) { + LOG_ERR("%s: dev is NULL", __func__); + return ret; + } + + vif_ctx_zep = dev->data; + + if (!vif_ctx_zep) { + LOG_ERR("%s: vif_ctx_zep is NULL", __func__); + return ret; + } + + rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; + + if (!rpu_ctx_zep) { + LOG_ERR("%s: rpu_ctx_zep is NULL", __func__); + return ret; + } + + + if (!rpu_ctx_zep->rpu_ctx) { + LOG_ERR("%s: RPU context not initialized", __func__); + return ret; + } + + if (((int)bss_max_idle_period < 0) || + (bss_max_idle_period > 64000)) { + /* 0 or value less than 64000 is passed to f/w. + * All other values considered as invalid. + */ + LOG_ERR("%s: Invalid max_idle_period value : %d", + __func__, (int)bss_max_idle_period); + return ret; + } + + k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); + + vif_ctx_zep->bss_max_idle_period = bss_max_idle_period; + + ret = 0; + + k_mutex_unlock(&vif_ctx_zep->vif_lock); + + return ret; +} diff --git a/drivers/wifi/nrf_wifi/src/wpa_supp_if.c b/drivers/wifi/nrf_wifi/src/wpa_supp_if.c index 34af00e6d388..21f7600ca80a 100644 --- a/drivers/wifi/nrf_wifi/src/wpa_supp_if.c +++ b/drivers/wifi/nrf_wifi/src/wpa_supp_if.c @@ -931,8 +931,10 @@ int nrf_wifi_wpa_supp_associate(void *if_priv, struct wpa_driver_associate_param assoc_info.use_mfp = NRF_WIFI_MFP_REQUIRED; } - if (params->bss_max_idle_period) { - assoc_info.bss_max_idle_time = params->bss_max_idle_period; + if (vif_ctx_zep->bss_max_idle_period == USHRT_MAX) { + assoc_info.bss_max_idle_time = CONFIG_WIFI_MGMT_BSS_MAX_IDLE_TIME; + } else { + assoc_info.bss_max_idle_time = vif_ctx_zep->bss_max_idle_period; } assoc_info.conn_type = NRF_WIFI_CONN_TYPE_OPEN; diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index 2c895afb36d0..4232a88d9556 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -133,6 +133,8 @@ enum net_request_wifi_cmd { NET_REQUEST_WIFI_CMD_CANDIDATE_SCAN, /** AP WPS config */ NET_REQUEST_WIFI_CMD_AP_WPS_CONFIG, + /** Configure BSS maximum idle period */ + NET_REQUEST_WIFI_CMD_BSS_MAX_IDLE_PERIOD, /** @cond INTERNAL_HIDDEN */ NET_REQUEST_WIFI_CMD_MAX /** @endcond */ @@ -317,6 +319,11 @@ NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_START_ROAMING); NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_NEIGHBOR_REP_COMPLETE); +#define NET_REQUEST_WIFI_BSS_MAX_IDLE_PERIOD \ + (NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_BSS_MAX_IDLE_PERIOD) + +NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_BSS_MAX_IDLE_PERIOD); + /** @cond INTERNAL_HIDDEN */ enum { @@ -1588,6 +1595,15 @@ struct wifi_mgmt_ops { * @return 0 if ok, < 0 if error */ int (*start_11r_roaming)(const struct device *dev); + /** Set BSS max idle period + * + * @param dev Pointer to the device structure for the driver instance. + * @param BSS max idle period value + * + * @return 0 if ok, < 0 if error + */ + int (*set_bss_max_idle_period)(const struct device *dev, + unsigned short bss_max_idle_period); }; /** Wi-Fi management offload API */ diff --git a/modules/hostap/src/supp_api.c b/modules/hostap/src/supp_api.c index cde1ef95f478..3679808b3d4b 100644 --- a/modules/hostap/src/supp_api.c +++ b/modules/hostap/src/supp_api.c @@ -1811,6 +1811,19 @@ int supplicant_legacy_roam(const struct device *dev) return ret; } +int supplicant_set_bss_max_idle_period(const struct device *dev, + unsigned short bss_max_idle_period) +{ + const struct wifi_mgmt_ops *const wifi_mgmt_api = get_wifi_mgmt_api(dev); + + if (!wifi_mgmt_api || !wifi_mgmt_api->set_bss_max_idle_period) { + wpa_printf(MSG_ERROR, "set_bss_max_idle_period is not supported"); + return -ENOTSUP; + } + + return wifi_mgmt_api->set_bss_max_idle_period(dev, bss_max_idle_period); +} + #ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_WNM int supplicant_btm_query(const struct device *dev, uint8_t reason) { diff --git a/modules/hostap/src/supp_api.h b/modules/hostap/src/supp_api.h index ddd3c3d66988..9d2b90b50fe0 100644 --- a/modules/hostap/src/supp_api.h +++ b/modules/hostap/src/supp_api.h @@ -305,6 +305,14 @@ int supplicant_get_wifi_conn_params(const struct device *dev, */ int supplicant_wps_config(const struct device *dev, struct wifi_wps_config_params *params); +/** @ Set Wi-Fi max idle period + * + * @param dev Wi-Fi interface handle to use + * @param bss_max_idle_period Maximum idle period to set + * @return 0 for OK; -1 for ERROR + */ +int supplicant_set_bss_max_idle_period(const struct device *dev, + unsigned short bss_max_idle_period); #ifdef CONFIG_AP int set_ap_bandwidth(const struct device *dev, enum wifi_frequency_bandwidths bandwidth); diff --git a/modules/hostap/src/supp_main.c b/modules/hostap/src/supp_main.c index 4549ab3160d2..9336cb2bf747 100644 --- a/modules/hostap/src/supp_main.c +++ b/modules/hostap/src/supp_main.c @@ -83,6 +83,7 @@ static const struct wifi_mgmt_ops mgmt_ops = { #endif .get_conn_params = supplicant_get_wifi_conn_params, .wps_config = supplicant_wps_config, + .set_bss_max_idle_period = supplicant_set_bss_max_idle_period, #ifdef CONFIG_AP .ap_enable = supplicant_ap_enable, .ap_disable = supplicant_ap_disable, diff --git a/subsys/net/l2/wifi/Kconfig b/subsys/net/l2/wifi/Kconfig index 4b1d309066c3..7728678cc979 100644 --- a/subsys/net/l2/wifi/Kconfig +++ b/subsys/net/l2/wifi/Kconfig @@ -154,3 +154,19 @@ config HEAP_MEM_POOL_ADD_SIZE_WIFI_CERT endif # WIFI_SHELL_RUNTIME_CERTIFICATES endif # WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE + +config WIFI_MGMT_BSS_MAX_IDLE_TIME + int "BSS max idle timeout in seconds" + range 0 64000 + default 30 + help + As per 802.11-2020: 11.21.13 BSS max idle period management + If dot11WirelessManagementImplemented is true, dot11BSSMaxIdlePeriod is + nonzero and dot11BSSMaxIdlePeriodIndicationByNonAPSTA is true, then a + non-S1G non-AP STA shall include a BSS Max Idle Period element + in the (Re)Association Request frame. If the BSS Max Idle Period + element is present in the (Re)Association Request frame received + by a non-S1G AP that has dot11BSSMaxIdlePeriodIndicationByNonAPSTA + equal to true, then the non-S1G AP may choose the non-AP STA’s + preferred maximum idle period. The non-S1G AP indicates its chosen + value to the non-S1G STA in the (Re)Association Response frame. diff --git a/subsys/net/l2/wifi/wifi_mgmt.c b/subsys/net/l2/wifi/wifi_mgmt.c index 0183faab1d50..f16f2581374f 100644 --- a/subsys/net/l2/wifi/wifi_mgmt.c +++ b/subsys/net/l2/wifi/wifi_mgmt.c @@ -1403,6 +1403,31 @@ static int wifi_set_enterprise_creds(uint64_t mgmt_request, struct net_if *iface NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_ENTERPRISE_CREDS, wifi_set_enterprise_creds); #endif +static int wifi_set_bss_max_idle_period(uint64_t mgmt_request, struct net_if *iface, + void *data, size_t len) +{ + const struct device *dev = net_if_get_device(iface); + const struct wifi_mgmt_ops *const wifi_mgmt_api = get_wifi_api(iface); + unsigned short *bss_max_idle_period = data; + + if (wifi_mgmt_api == NULL || wifi_mgmt_api->set_bss_max_idle_period == NULL) { + return -ENOTSUP; + } + + if (!net_if_is_admin_up(iface)) { + return -ENETDOWN; + } + + if (!data || len != sizeof(*bss_max_idle_period)) { + return -EINVAL; + } + + return wifi_mgmt_api->set_bss_max_idle_period(dev, *bss_max_idle_period); +} + +NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_BSS_MAX_IDLE_PERIOD, + wifi_set_bss_max_idle_period); + #ifdef CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS void wifi_mgmt_raise_raw_scan_result_event(struct net_if *iface, struct wifi_raw_scan_result *raw_scan_result) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 8a5468ba81b1..b23d407da641 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -3455,6 +3455,32 @@ static int cmd_wifi_pmksa_flush(const struct shell *sh, size_t argc, char *argv[ return 0; } + +static int cmd_wifi_set_bss_max_idle_period(const struct shell *sh, size_t argc, char *argv[]) +{ + struct net_if *iface = get_iface(IFACE_TYPE_STA, argc, argv); + unsigned short bss_max_idle_period = 0; + int idx = 1; + unsigned long val = 0; + + if (!parse_number(sh, &val, argv[idx++], "bss_max_idle_period", 0, USHRT_MAX)) { + return -EINVAL; + } + + bss_max_idle_period = (unsigned short)val; + + if (net_mgmt(NET_REQUEST_WIFI_BSS_MAX_IDLE_PERIOD, iface, + &bss_max_idle_period, sizeof(bss_max_idle_period))) { + shell_fprintf(sh, SHELL_WARNING, + "Setting BSS maximum idle period failed.\n"); + return -ENOEXEC; + } + + shell_fprintf(sh, SHELL_NORMAL, "BSS max idle period: %hu\n", bss_max_idle_period); + + return 0; +} + SHELL_STATIC_SUBCMD_SET_CREATE( wifi_cmd_ap, SHELL_CMD_ARG(disable, NULL, "Disable Access Point mode.\n" @@ -3930,6 +3956,12 @@ SHELL_SUBCMD_ADD((wifi), ps_exit_strategy, NULL, cmd_wifi_ps_exit_strategy, 2, 2); +SHELL_SUBCMD_ADD((wifi), bss_max_idle_period, NULL, + ".\n" + "[-i, --iface=] : Interface index.\n", + cmd_wifi_set_bss_max_idle_period, + 2, 2); + SHELL_CMD_REGISTER(wifi, &wifi_commands, "Wi-Fi commands", NULL); static int wifi_shell_init(void) From 8277731e86e2d7bab82d1ac72c8419c583a7bf3b Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Thu, 31 Jul 2025 17:40:48 +0530 Subject: [PATCH 0604/2141] [nrf fromtree] net: l2: wifi: Fix the default keepalive value 30s is too aggressive for most APs, and hostapd also uses 5mins as the default value. Signed-off-by: Chaitanya Tata (cherry picked from commit 59ff12656ff93fd2568bc3013073edbe1eb65e98) Signed-off-by: Robert Lubos --- subsys/net/l2/wifi/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/l2/wifi/Kconfig b/subsys/net/l2/wifi/Kconfig index 7728678cc979..49d061c7439c 100644 --- a/subsys/net/l2/wifi/Kconfig +++ b/subsys/net/l2/wifi/Kconfig @@ -158,7 +158,7 @@ endif # WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE config WIFI_MGMT_BSS_MAX_IDLE_TIME int "BSS max idle timeout in seconds" range 0 64000 - default 30 + default 300 help As per 802.11-2020: 11.21.13 BSS max idle period management If dot11WirelessManagementImplemented is true, dot11BSSMaxIdlePeriod is From 39a962774d40381bdd99f94f7efa14c102035434 Mon Sep 17 00:00:00 2001 From: Kapil Bhatt Date: Tue, 5 Aug 2025 06:19:02 +0000 Subject: [PATCH 0605/2141] [nrf fromlist] drivers: nrf_wifi: Add check for minimum RX buffer size Add check for the RX data buffer size. It should be atleast 400 bytes, anthing less than that scan fails. Upstream PR #: 94106 Signed-off-by: Kapil Bhatt --- drivers/wifi/nrf_wifi/src/fmac_main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/wifi/nrf_wifi/src/fmac_main.c b/drivers/wifi/nrf_wifi/src/fmac_main.c index f2d9aa55af9f..125ffd7a9a10 100644 --- a/drivers/wifi/nrf_wifi/src/fmac_main.c +++ b/drivers/wifi/nrf_wifi/src/fmac_main.c @@ -79,6 +79,8 @@ BUILD_ASSERT(CONFIG_NRF70_TX_MAX_DATA_SIZE % 4 == 0, "TX buffer size must be a multiple of 4"); BUILD_ASSERT(CONFIG_NRF70_RX_MAX_DATA_SIZE % 4 == 0, "RX buffer size must be a multiple of 4"); +BUILD_ASSERT(CONFIG_NRF70_RX_MAX_DATA_SIZE >= 400, + "RX buffer size must be at least 400 bytes"); static const unsigned char aggregation = 1; static const unsigned char max_num_tx_agg_sessions = 4; From 2c900ff71beb178c58b4d0f295e003bfbce94da8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20Reierstad?= Date: Thu, 5 Jun 2025 15:48:25 +0200 Subject: [PATCH 0606/2141] [nrf fromtree] Bluetooth: Host: Update LE legacy pairing check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updates the LE legacy pairing procedure as a result of errata ES-24491. New part: If the initiating device receives an LP_CONFIRM_R value that is equal to the LP_CONFIRM_I value, the pairing process shall be aborted and fail with "Confirm Value Failed" as reason. Signed-off-by: Håvard Reierstad (cherry picked from commit 2a8118c9454542119e9d06c49093e77da609a3ab) Signed-off-by: Håvard Reierstad --- subsys/bluetooth/host/smp.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/subsys/bluetooth/host/smp.c b/subsys/bluetooth/host/smp.c index 916bb661bb98..805b18f33c48 100644 --- a/subsys/bluetooth/host/smp.c +++ b/subsys/bluetooth/host/smp.c @@ -2555,22 +2555,35 @@ static uint8_t legacy_pairing_req(struct bt_smp *smp) static uint8_t legacy_pairing_random(struct bt_smp *smp) { struct bt_conn *conn = smp->chan.chan.conn; - uint8_t tmp[16]; + uint8_t tmp[16], cfm_i[16]; int err; LOG_DBG(""); - /* calculate confirmation */ + /* calculate LP_CONFIRM_R */ err = smp_c1(smp->tk, smp->rrnd, smp->preq, smp->prsp, &conn->le.init_addr, &conn->le.resp_addr, tmp); if (err) { return BT_SMP_ERR_UNSPECIFIED; } + /* calculate LP_CONFIRM_I */ + err = smp_c1(smp->tk, smp->prnd, smp->preq, smp->prsp, + &conn->le.init_addr, &conn->le.resp_addr, cfm_i); + if (err) { + return BT_SMP_ERR_UNSPECIFIED; + } + LOG_DBG("pcnf %s", bt_hex(smp->pcnf, 16)); - LOG_DBG("cfm %s", bt_hex(tmp, 16)); + LOG_DBG("cfm (remote) %s", bt_hex(tmp, 16)); + LOG_DBG("cfm (local) %s", bt_hex(cfm_i, 16)); - if (memcmp(smp->pcnf, tmp, sizeof(smp->pcnf))) { + /* Core Specification, Vol 3, Part H, section 2.3.5.5 (Errata ES-24491): If the computed + * LP_CONFIRM_R value is not equal to the received LP_CONFIRM_R value, or the received + * LP_CONFIRM_R value is equal to the LP_CONFIRM_I value, fail pairing. + */ + if (memcmp(smp->pcnf, tmp, sizeof(smp->pcnf)) || + !memcmp(smp->pcnf, cfm_i, sizeof(smp->pcnf))) { return BT_SMP_ERR_CONFIRM_FAILED; } From 8720fcc41232657f771b09ec1627b1bbc279d471 Mon Sep 17 00:00:00 2001 From: Szymon Janc Date: Wed, 11 Jun 2025 16:59:55 +0200 Subject: [PATCH 0607/2141] [nrf fromtree] Bluetooth: Host: Fix SMP Pairing failed code on invalid Public Key MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Core Specification 6.1 clarified exptected erro code in case peer sending invalid Public Key. In case pairing is aborted during or immediately after Public Key Exchange phase has completed (which is the case here) expected reason code is set to "DHKey Check Failed". This was affecting SM/CEN/KDU/BI-04-C and SM/PER/KDU/BI-04-C qualification test cases. Signed-off-by: Szymon Janc (cherry picked from commit 9b27a472f42e92fc290915e7529e1e9e91631a7b) Signed-off-by: Håvard Reierstad --- subsys/bluetooth/host/smp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/bluetooth/host/smp.c b/subsys/bluetooth/host/smp.c index 805b18f33c48..ff920fb0f3a3 100644 --- a/subsys/bluetooth/host/smp.c +++ b/subsys/bluetooth/host/smp.c @@ -4499,7 +4499,7 @@ static uint8_t smp_public_key(struct bt_smp *smp, struct net_buf *buf) } } else if (!bt_pub_key_is_valid(smp->pkey)) { LOG_WRN("Received invalid public key"); - return BT_SMP_ERR_INVALID_PARAMS; + return BT_SMP_ERR_DHKEY_CHECK_FAILED; } if (IS_ENABLED(CONFIG_BT_CENTRAL) && From 57d8acee344a9fcc77116a02cee99624a548bf9a Mon Sep 17 00:00:00 2001 From: Nirav Agrawal Date: Fri, 13 Jun 2025 10:44:29 +0530 Subject: [PATCH 0608/2141] [nrf fromtree] bluetooth: host: gatt: fix null-ptr access if no include-svc userdata MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Issue: There is a bus-fault while accessing empty userdata structure pointer if application does not include any include service userdata instance (which consist of UUID list of included service) but service array has defined dummy entry for it assumed to be overridden by app during initial flow. - For example, the issue has happened in case of tmap-central sample without "CONFIG_BT_OTS" support. there are some MCS attributes dependent on OTS service because of that "BT_GATT_INCLUDE_SERVICE(NULL)" entry is added as part of service definition. The given entry does not have userdata handler defined and is expecting to be overriden by the app if it will be included. During "bt_mcs_init()" call, "mcs.attrs[i].user_data" is not populated with any attr-instance pointer. This makes CPU to access null-address during reading local-database include-service attribute which was not provided by the app but the include-service entry was added to the db. - Fix: Adding condition to check if user-data has null address, and returning back to avoid any hard-faults. Signed-off-by: Nirav Agrawal (cherry picked from commit 5a8189bf2afec221b925065854a714b1088ccddc) Signed-off-by: Håvard Reierstad --- include/zephyr/bluetooth/gatt.h | 1 + subsys/bluetooth/host/gatt.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/include/zephyr/bluetooth/gatt.h b/include/zephyr/bluetooth/gatt.h index 3597c7c5fdb1..2c7d36a67588 100644 --- a/include/zephyr/bluetooth/gatt.h +++ b/include/zephyr/bluetooth/gatt.h @@ -918,6 +918,7 @@ ssize_t bt_gatt_attr_read_service(struct bt_conn *conn, * Read include service attribute value from local database storing the result * into buffer after encoding it. * @note Only use this with attributes which user_data is a ``bt_gatt_include``. + * The function returns EINVAL if @p attr or @p attr->user_data is NULL. * * @param conn Connection object. * @param attr Attribute to read. diff --git a/subsys/bluetooth/host/gatt.c b/subsys/bluetooth/host/gatt.c index 3092801554a1..be642fec9fe7 100644 --- a/subsys/bluetooth/host/gatt.c +++ b/subsys/bluetooth/host/gatt.c @@ -1917,6 +1917,10 @@ ssize_t bt_gatt_attr_read_included(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, uint16_t len, uint16_t offset) { + if ((attr == NULL) || (attr->user_data == NULL)) { + return -EINVAL; + } + struct bt_gatt_attr *incl = attr->user_data; uint16_t handle = bt_gatt_attr_get_handle(incl); struct bt_uuid *uuid = incl->user_data; From 01ec0ff5bd167631bc8078b88ac1767f9ac6d866 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20Reierstad?= Date: Tue, 15 Jul 2025 07:43:33 +0200 Subject: [PATCH 0609/2141] [nrf fromtree] Bluetooth: Host: l2cap: Fix MPS/MTU confusion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The implementation used BT_L2CAP_ECRED_MIN_MTU to check the lower limits of both MTU and MPS, instead of BT_L2CAP_ECRED_MIN_MPS for MPS. While these are the same here, confusion may arise. This commit fixes the confusion. Signed-off-by: Håvard Reierstad (cherry picked from commit d989188f29e6d19c9b7ec0458becc868632d939b) Signed-off-by: Håvard Reierstad --- subsys/bluetooth/host/l2cap.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/subsys/bluetooth/host/l2cap.c b/subsys/bluetooth/host/l2cap.c index 9fa5638d9617..ac3bd8eeb2b1 100644 --- a/subsys/bluetooth/host/l2cap.c +++ b/subsys/bluetooth/host/l2cap.c @@ -46,6 +46,7 @@ LOG_MODULE_REGISTER(bt_l2cap, CONFIG_BT_L2CAP_LOG_LEVEL); #define CHAN_RX(_w) CONTAINER_OF(_w, struct bt_l2cap_le_chan, rx_work) #define L2CAP_LE_MIN_MTU 23 +#define L2CAP_LE_MIN_MPS 23 #define L2CAP_LE_MAX_CREDITS (BT_BUF_ACL_RX_COUNT - 1) @@ -1478,7 +1479,7 @@ static void le_conn_req(struct bt_l2cap *l2cap, uint8_t ident, LOG_DBG("psm 0x%02x scid 0x%04x mtu %u mps %u credits %u", psm, scid, mtu, mps, credits); - if (mtu < L2CAP_LE_MIN_MTU || mps < L2CAP_LE_MIN_MTU) { + if (mtu < L2CAP_LE_MIN_MTU || mps < L2CAP_LE_MIN_MPS) { LOG_ERR("Invalid LE-Conn Req params: mtu %u mps %u", mtu, mps); return; } @@ -1577,7 +1578,7 @@ static void le_ecred_conn_req(struct bt_l2cap *l2cap, uint8_t ident, LOG_DBG("psm 0x%02x mtu %u mps %u credits %u", psm, mtu, mps, credits); - if (mtu < BT_L2CAP_ECRED_MIN_MTU || mps < BT_L2CAP_ECRED_MIN_MTU) { + if (mtu < BT_L2CAP_ECRED_MIN_MTU || mps < BT_L2CAP_ECRED_MIN_MPS) { LOG_ERR("Invalid ecred conn req params. mtu %u mps %u", mtu, mps); result = BT_L2CAP_LE_ERR_INVALID_PARAMS; goto response; @@ -1685,7 +1686,7 @@ static void le_ecred_reconf_req(struct bt_l2cap *l2cap, uint8_t ident, mtu = sys_le16_to_cpu(req->mtu); mps = sys_le16_to_cpu(req->mps); - if (mps < BT_L2CAP_ECRED_MIN_MTU) { + if (mps < BT_L2CAP_ECRED_MIN_MPS) { result = BT_L2CAP_RECONF_OTHER_UNACCEPT; goto response; } From b07b1bba4aec25dc602f00301a2a8ed72bc4b0de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20Reierstad?= Date: Tue, 22 Jul 2025 13:25:11 +0200 Subject: [PATCH 0610/2141] [nrf fromtree] Bluetooth: Host: Add l2cap credit param checks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds a missing requirement from Core Spec V6.0 Vol 3.A chapters 10.1 and 10.2 to ignore L2CAP_FLOW_CONTROL_CREDIT_IND packets with the credit value set to 0. Matches existing credit-related functions by checking that the CID is in the dynamic range (you can't add credits to fixed channels). Signed-off-by: Håvard Reierstad (cherry picked from commit 2b42a1d81d981d55e0a5c6e3cd96caee13b195ea) Signed-off-by: Håvard Reierstad --- subsys/bluetooth/host/l2cap.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/subsys/bluetooth/host/l2cap.c b/subsys/bluetooth/host/l2cap.c index ac3bd8eeb2b1..9ecdc72c0aa7 100644 --- a/subsys/bluetooth/host/l2cap.c +++ b/subsys/bluetooth/host/l2cap.c @@ -2158,6 +2158,17 @@ static void le_credits(struct bt_l2cap *l2cap, uint8_t ident, cid = sys_le16_to_cpu(ev->cid); credits = sys_le16_to_cpu(ev->credits); + if (!L2CAP_LE_CID_IS_DYN(cid)) { + LOG_WRN("Can't add credits to non-dynamic channel %p (cid 0x%04x)", &l2cap->chan, + cid); + return; + } + + if (credits == 0U) { + LOG_WRN("Ignoring zero credit packet"); + return; + } + LOG_DBG("cid 0x%04x credits %u", cid, credits); chan = bt_l2cap_le_lookup_tx_cid(conn, cid); From 4c976e3ff28fceec1203f5a86cd5399675795f0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20Reierstad?= Date: Wed, 16 Jul 2025 08:55:06 +0200 Subject: [PATCH 0611/2141] [nrf fromtree] Bluetooth: Host: Add conn rsp param check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Check whether the connection response parameters both with and without ECRED are within the valid ranges from the Bluetooth Core Specification (part 3.A.4 v6.0). Changes validation checks in requests to match the same pattern. Signed-off-by: Håvard Reierstad (cherry picked from commit 7debc8a8f53d4832dfc9cd4dd9debff3d8648079) Signed-off-by: Håvard Reierstad --- include/zephyr/bluetooth/l2cap.h | 14 +++++++ subsys/bluetooth/host/l2cap.c | 52 +++++++++++++++++++++----- subsys/bluetooth/host/l2cap_internal.h | 3 ++ 3 files changed, 60 insertions(+), 9 deletions(-) diff --git a/include/zephyr/bluetooth/l2cap.h b/include/zephyr/bluetooth/l2cap.h index f8781d791f01..380b52ad508d 100644 --- a/include/zephyr/bluetooth/l2cap.h +++ b/include/zephyr/bluetooth/l2cap.h @@ -111,6 +111,20 @@ extern "C" { */ #define BT_L2CAP_ECRED_MIN_MPS 64 +/** @brief L2CAP maximum MTU + * + * The maximum MTU for an L2CAP Based Connection. This is the same with or without ECRED. This + * requirement is taken from text in Core 3.A.4.22 and 3.A.4.26 v6.0. + */ +#define BT_L2CAP_MAX_MTU UINT16_MAX + +/** @brief L2CAP maximum MPS + * + * The maximum MPS for an L2CAP Based Connection. This is the same with or without ECRED. This + * requirement is taken from text in Core 3.A.4.22 and 3.A.4.26 v6.0. + */ +#define BT_L2CAP_MAX_MPS 65533 + /** @brief The maximum number of channels in ECRED L2CAP signaling PDUs * * Currently, this is the maximum number of channels referred to in the diff --git a/subsys/bluetooth/host/l2cap.c b/subsys/bluetooth/host/l2cap.c index 9ecdc72c0aa7..caf5424717bc 100644 --- a/subsys/bluetooth/host/l2cap.c +++ b/subsys/bluetooth/host/l2cap.c @@ -1479,11 +1479,6 @@ static void le_conn_req(struct bt_l2cap *l2cap, uint8_t ident, LOG_DBG("psm 0x%02x scid 0x%04x mtu %u mps %u credits %u", psm, scid, mtu, mps, credits); - if (mtu < L2CAP_LE_MIN_MTU || mps < L2CAP_LE_MIN_MPS) { - LOG_ERR("Invalid LE-Conn Req params: mtu %u mps %u", mtu, mps); - return; - } - buf = l2cap_create_le_sig_pdu(BT_L2CAP_LE_CONN_RSP, ident, sizeof(*rsp)); if (!buf) { @@ -1493,6 +1488,16 @@ static void le_conn_req(struct bt_l2cap *l2cap, uint8_t ident, rsp = net_buf_add(buf, sizeof(*rsp)); (void)memset(rsp, 0, sizeof(*rsp)); + /* Validate parameters. Requirements are from Core Spec v6.0, Vol 3.A.4.22. Valid credit + * range is from 0 to UINT16_MAX, thus no credit validation is needed. + */ + if (!IN_RANGE(mtu, L2CAP_LE_MIN_MTU, BT_L2CAP_MAX_MTU) || + !IN_RANGE(mps, L2CAP_LE_MIN_MPS, BT_L2CAP_MAX_MPS)) { + LOG_ERR("Invalid le conn req params: mtu %u mps %u", mtu, mps); + result = BT_L2CAP_LE_ERR_UNACCEPT_PARAMS; + goto rsp; + } + /* Check if there is a server registered */ server = bt_l2cap_server_lookup_psm(psm); if (!server) { @@ -1578,8 +1583,12 @@ static void le_ecred_conn_req(struct bt_l2cap *l2cap, uint8_t ident, LOG_DBG("psm 0x%02x mtu %u mps %u credits %u", psm, mtu, mps, credits); - if (mtu < BT_L2CAP_ECRED_MIN_MTU || mps < BT_L2CAP_ECRED_MIN_MPS) { - LOG_ERR("Invalid ecred conn req params. mtu %u mps %u", mtu, mps); + /* Validate parameters. Requirements are from Core Spec v6.0, Vol 3.A.4.25. */ + if (!IN_RANGE(mtu, BT_L2CAP_ECRED_MIN_MTU, BT_L2CAP_MAX_MTU) || + !IN_RANGE(mps, BT_L2CAP_ECRED_MIN_MPS, BT_L2CAP_MAX_MPS) || + !IN_RANGE(credits, BT_L2CAP_ECRED_CREDITS_MIN, BT_L2CAP_ECRED_CREDITS_MAX)) { + LOG_ERR("Invalid le ecred conn req params: mtu %u mps %u credits %u", mtu, mps, + credits); result = BT_L2CAP_LE_ERR_INVALID_PARAMS; goto response; } @@ -1982,13 +1991,24 @@ static void le_ecred_conn_rsp(struct bt_l2cap *l2cap, uint8_t ident, LOG_DBG("dcid 0x%04x", dcid); - /* If a Destination CID is 0x0000, the channel was not + /* Validate parameters before assignment. Requirements are from Core Spec + * v6.0, Vol 3.A.4.26. If a Destination CID is 0x0000, the channel was not * established. */ - if (!dcid) { + if (dcid == 0U) { bt_l2cap_chan_remove(conn, &chan->chan); bt_l2cap_chan_del(&chan->chan); continue; + } else if (!L2CAP_LE_CID_IS_DYN(dcid) || + !IN_RANGE(mtu, BT_L2CAP_ECRED_MIN_MTU, BT_L2CAP_MAX_MTU) || + !IN_RANGE(mps, BT_L2CAP_ECRED_MIN_MPS, BT_L2CAP_MAX_MPS) || + !IN_RANGE(credits, BT_L2CAP_ECRED_CREDITS_MIN, + BT_L2CAP_ECRED_CREDITS_MAX)) { + LOG_WRN("Invalid ecred conn rsp params: dcid 0x%04x mtu %u mps %u " + "credits %u. Disconnecting.", + dcid, mtu, mps, credits); + bt_conn_disconnect(conn, BT_HCI_ERR_UNACCEPT_CONN_PARAM); + return; } c = bt_l2cap_le_lookup_tx_cid(conn, dcid); @@ -2086,6 +2106,20 @@ static void le_conn_rsp(struct bt_l2cap *l2cap, uint8_t ident, switch (result) { case BT_L2CAP_LE_SUCCESS: + /* Validate parameters on successful connection. Requirements are from Core Spec + * v6.0, Vol 3.A.4.23. Valid credit range is from 0 to UINT16_MAX, thus no credit + * validation is needed. + */ + if ((!L2CAP_LE_CID_IS_DYN(dcid) || + !IN_RANGE(mtu, L2CAP_LE_MIN_MTU, BT_L2CAP_MAX_MTU) || + !IN_RANGE(mps, L2CAP_LE_MIN_MPS, BT_L2CAP_MAX_MPS))) { + LOG_WRN("Invalid conn rsp params: dcid 0x%04x mtu %u mps %u. " + "Disconnecting.", + dcid, mtu, mps); + bt_conn_disconnect(conn, BT_HCI_ERR_UNACCEPT_CONN_PARAM); + return; + } + chan->tx.cid = dcid; chan->tx.mtu = mtu; chan->tx.mps = mps; diff --git a/subsys/bluetooth/host/l2cap_internal.h b/subsys/bluetooth/host/l2cap_internal.h index 07bd428334ae..61fa7416dd5d 100644 --- a/subsys/bluetooth/host/l2cap_internal.h +++ b/subsys/bluetooth/host/l2cap_internal.h @@ -125,6 +125,9 @@ struct bt_l2cap_le_credits { uint16_t credits; } __packed; +#define BT_L2CAP_ECRED_CREDITS_MIN 1 +#define BT_L2CAP_ECRED_CREDITS_MAX UINT16_MAX + #define BT_L2CAP_ECRED_CONN_REQ 0x17 struct bt_l2cap_ecred_conn_req { uint16_t psm; From 7de47337d2a38ff9e5221986072ce1e8c9f6aaaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20Reierstad?= Date: Tue, 22 Jul 2025 09:56:14 +0200 Subject: [PATCH 0612/2141] [nrf fromtree] Bluetooth: Host: Use MTU min for l2cap test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The many_conn l2cap test used a MTU lower than the minimum permitted value. This commit bumps it to the minimum (23). Signed-off-by: Håvard Reierstad (cherry picked from commit b799d1897b9695d4bea7d985509a6621ab9dcd85) Signed-off-by: Håvard Reierstad --- tests/bsim/bluetooth/host/l2cap/many_conns/src/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/bsim/bluetooth/host/l2cap/many_conns/src/main.c b/tests/bsim/bluetooth/host/l2cap/many_conns/src/main.c index ff9f3030d1eb..a4f45bc1890c 100644 --- a/tests/bsim/bluetooth/host/l2cap/many_conns/src/main.c +++ b/tests/bsim/bluetooth/host/l2cap/many_conns/src/main.c @@ -29,7 +29,7 @@ DEFINE_FLAG_STATIC(flag_l2cap_connected); #define NUM_PERIPHERALS CONFIG_BT_MAX_CONN #define L2CAP_CHANS NUM_PERIPHERALS #define SDU_NUM 1 -#define SDU_LEN 10 +#define SDU_LEN 23 /* Only one SDU per link will be transmitted */ NET_BUF_POOL_DEFINE(sdu_tx_pool, From 7d913ca2a706b2f2a49e8c9e8c80178cf2ef0539 Mon Sep 17 00:00:00 2001 From: Jonathan Nilsen Date: Mon, 4 Aug 2025 12:08:04 +0200 Subject: [PATCH 0613/2141] [nrf fromlist] soc: nordic: uicr: Populate UICR.VERSION field in gen_uicr.py Upstream PR #: 94064 Set the VERSION field to 2.0 in gen_uicr.py to indicate the version of the format the script produces blobs for. This is required for forwards compatibility with newer versions of IronSide SE. Signed-off-by: Jonathan Nilsen --- soc/nordic/common/uicr/gen_uicr.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/soc/nordic/common/uicr/gen_uicr.py b/soc/nordic/common/uicr/gen_uicr.py index 50f96eab566f..5888786e928f 100644 --- a/soc/nordic/common/uicr/gen_uicr.py +++ b/soc/nordic/common/uicr/gen_uicr.py @@ -17,6 +17,10 @@ from elftools.elf.elffile import ELFFile from intelhex import IntelHex +# The UICR format version produced by this script +UICR_FORMAT_VERSION_MAJOR = 2 +UICR_FORMAT_VERSION_MINOR = 0 + # Name of the ELF section containing PERIPHCONF entries. # Must match the name used in the linker script. PERIPHCONF_SECTION = "uicr_periphconf_entry" @@ -45,6 +49,14 @@ class PeriphconfEntry(c.LittleEndianStructure): PERIPHCONF_ENTRY_SIZE = c.sizeof(PeriphconfEntry) +class Version(c.LittleEndianStructure): + _pack_ = 1 + _fields_ = [ + ("MINOR", c.c_uint16), + ("MAJOR", c.c_uint16), + ] + + class Approtect(c.LittleEndianStructure): _pack_ = 1 _fields_ = [ @@ -104,7 +116,7 @@ class Mpcconf(c.LittleEndianStructure): class Uicr(c.LittleEndianStructure): _pack_ = 1 _fields_ = [ - ("VERSION", c.c_uint32), + ("VERSION", Version), ("RESERVED", c.c_uint32), ("LOCK", c.c_uint32), ("RESERVED1", c.c_uint32), @@ -171,6 +183,9 @@ def main() -> None: init_values = DISABLED_VALUE.to_bytes(4, "little") * (c.sizeof(Uicr) // 4) uicr = Uicr.from_buffer_copy(init_values) + uicr.VERSION.MAJOR = UICR_FORMAT_VERSION_MAJOR + uicr.VERSION.MINOR = UICR_FORMAT_VERSION_MINOR + kconfig_str = args.in_config.read() kconfig = parse_kconfig(kconfig_str) From a0459930f3cd7393326f35475a93aad9121d074d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Stasiak?= Date: Mon, 23 Jun 2025 12:53:29 +0200 Subject: [PATCH 0614/2141] [nrf fromlist] drivers: timer: nrf_rtc_timer: Allow use of custom bit width MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Allowed use of counter bit width lower than hardware 24. In that case, PPI connection is established to trigger clear task once maximum value is reached. Upstream PR #: 92025 Signed-off-by: Michał Stasiak --- drivers/timer/Kconfig.nrf_rtc | 7 ++ drivers/timer/nrf_rtc_timer.c | 77 ++++++++++++++++++-- include/zephyr/drivers/timer/nrf_rtc_timer.h | 2 +- tests/drivers/timer/nrf_rtc_timer/src/main.c | 11 ++- 4 files changed, 88 insertions(+), 9 deletions(-) diff --git a/drivers/timer/Kconfig.nrf_rtc b/drivers/timer/Kconfig.nrf_rtc index 729dc8d362a7..82228d453caf 100644 --- a/drivers/timer/Kconfig.nrf_rtc +++ b/drivers/timer/Kconfig.nrf_rtc @@ -9,6 +9,7 @@ config NRF_RTC_TIMER depends on SOC_COMPATIBLE_NRF select TICKLESS_CAPABLE select SYSTEM_TIMER_HAS_DISABLE_SUPPORT + select NRFX_PPI if SOC_NRF52832 depends on !$(dt_nodelabel_enabled,rtc1) help This module implements a kernel device driver for the nRF Real Time @@ -42,4 +43,10 @@ config NRF_RTC_TIMER_TRIGGER_OVERFLOW When enabled, a function can be used to trigger RTC overflow and effectively shift time into the future. +config NRF_RTC_COUNTER_BIT_WIDTH + int + default 15 if SOC_NRF52832 + default 24 + range 15 24 + endif # NRF_RTC_TIMER diff --git a/drivers/timer/nrf_rtc_timer.c b/drivers/timer/nrf_rtc_timer.c index 0fdf951f925b..a70cc19b7e9b 100644 --- a/drivers/timer/nrf_rtc_timer.c +++ b/drivers/timer/nrf_rtc_timer.c @@ -17,23 +17,34 @@ #include #include +#define RTC_BIT_WIDTH 24 + +#if (CONFIG_NRF_RTC_COUNTER_BIT_WIDTH < RTC_BIT_WIDTH) +#define CUSTOM_COUNTER_BIT_WIDTH 1 +#define WRAP_CH 1 +#include "nrfx_ppi.h" +#else +#define CUSTOM_COUNTER_BIT_WIDTH 0 +#endif + #define RTC_PRETICK (IS_ENABLED(CONFIG_SOC_NRF53_RTC_PRETICK) && \ IS_ENABLED(CONFIG_SOC_NRF5340_CPUNET)) #define EXT_CHAN_COUNT CONFIG_NRF_RTC_TIMER_USER_CHAN_COUNT -#define CHAN_COUNT (EXT_CHAN_COUNT + 1) +#define CHAN_COUNT (EXT_CHAN_COUNT + 1 + CUSTOM_COUNTER_BIT_WIDTH) #define RTC NRF_RTC1 #define RTC_IRQn NRFX_IRQ_NUMBER_GET(RTC) #define RTC_LABEL rtc1 #define CHAN_COUNT_MAX (RTC1_CC_NUM - (RTC_PRETICK ? 1 : 0)) +#define SYS_CLOCK_CH 0 BUILD_ASSERT(CHAN_COUNT <= CHAN_COUNT_MAX, "Not enough compare channels"); /* Ensure that counter driver for RTC1 is not enabled. */ BUILD_ASSERT(DT_NODE_HAS_STATUS(DT_NODELABEL(RTC_LABEL), disabled), "Counter for RTC1 must be disabled"); -#define COUNTER_BIT_WIDTH 24U +#define COUNTER_BIT_WIDTH CONFIG_NRF_RTC_COUNTER_BIT_WIDTH #define COUNTER_SPAN BIT(COUNTER_BIT_WIDTH) #define COUNTER_MAX (COUNTER_SPAN - 1U) #define COUNTER_HALF_SPAN (COUNTER_SPAN / 2U) @@ -139,7 +150,7 @@ uint32_t z_nrf_rtc_timer_capture_task_address_get(int32_t chan) { #if defined(RTC_TASKS_CAPTURE_TASKS_CAPTURE_Msk) __ASSERT_NO_MSG(chan >= 0 && chan < CHAN_COUNT); - if (chan == 0) { + if (chan == SYS_CLOCK_CH) { return 0; } @@ -264,6 +275,15 @@ static int set_alarm(int32_t chan, uint32_t req_cc, bool exact) */ enum { MIN_CYCLES_FROM_NOW = 3 }; uint32_t cc_val = req_cc; + +#if CUSTOM_COUNTER_BIT_WIDTH + /* If a CC value is 0 when a CLEAR task is set, this will not + * trigger a COMAPRE event. Need to use 1 instead. + */ + if (cc_val % COUNTER_MAX == 0) { + cc_val = 1; + } +#endif uint32_t cc_inc = MIN_CYCLES_FROM_NOW; /* Disable event routing for the channel to avoid getting a COMPARE @@ -427,6 +447,17 @@ uint64_t z_nrf_rtc_timer_read(void) uint32_t cntr = counter(); +#if CUSTOM_COUNTER_BIT_WIDTH + /* If counter is equal to it maximum value while val is greater + * than anchor, then we can assume that overflow has been recorded + * in the overflow_cnt, but clear task has not been triggered yet. + * Treat counter as if it has been cleared. + */ + if ((cntr == COUNTER_MAX) && (val > anchor)) { + cntr = 0; + } +#endif + val += cntr; if (cntr < OVERFLOW_RISK_RANGE_END) { @@ -565,8 +596,13 @@ void rtc_nrf_isr(const void *arg) rtc_pretick_rtc1_isr_hook(); } +#if CUSTOM_COUNTER_BIT_WIDTH + if (nrfy_rtc_int_enable_check(RTC, NRF_RTC_INT_COMPARE1_MASK) && + nrfy_rtc_events_process(RTC, NRF_RTC_INT_COMPARE1_MASK)) { +#else if (nrfy_rtc_int_enable_check(RTC, NRF_RTC_INT_OVERFLOW_MASK) && nrfy_rtc_events_process(RTC, NRF_RTC_INT_OVERFLOW_MASK)) { +#endif overflow_cnt++; } @@ -625,7 +661,7 @@ int z_nrf_rtc_timer_trigger_overflow(void) uint64_t now = z_nrf_rtc_timer_read(); if (err == 0) { - sys_clock_timeout_handler(0, now, NULL); + sys_clock_timeout_handler(SYS_CLOCK_CH, now, NULL); } bail: full_int_unlock(mcu_critical_state); @@ -682,7 +718,7 @@ void sys_clock_set_timeout(int32_t ticks, bool idle) uint64_t target_time = cyc + last_count; - compare_set(0, target_time, sys_clock_timeout_handler, NULL, false); + compare_set(SYS_CLOCK_CH, target_time, sys_clock_timeout_handler, NULL, false); } uint32_t sys_clock_elapsed(void) @@ -702,7 +738,9 @@ uint32_t sys_clock_cycle_get_32(void) static void int_event_disable_rtc(void) { uint32_t mask = NRF_RTC_INT_TICK_MASK | +#if !CUSTOM_COUNTER_BIT_WIDTH NRF_RTC_INT_OVERFLOW_MASK | +#endif NRF_RTC_INT_COMPARE0_MASK | NRF_RTC_INT_COMPARE1_MASK | NRF_RTC_INT_COMPARE2_MASK | @@ -734,7 +772,9 @@ static int sys_clock_driver_init(void) nrfy_rtc_int_enable(RTC, NRF_RTC_CHANNEL_INT_MASK(chan)); } +#if !CUSTOM_COUNTER_BIT_WIDTH nrfy_rtc_int_enable(RTC, NRF_RTC_INT_OVERFLOW_MASK); +#endif NVIC_ClearPendingIRQ(RTC_IRQn); @@ -747,13 +787,13 @@ static int sys_clock_driver_init(void) int_mask = BIT_MASK(CHAN_COUNT); if (CONFIG_NRF_RTC_TIMER_USER_CHAN_COUNT) { - alloc_mask = BIT_MASK(EXT_CHAN_COUNT) << 1; + alloc_mask = BIT_MASK(CHAN_COUNT) & ~BIT(SYS_CLOCK_CH); } uint32_t initial_timeout = IS_ENABLED(CONFIG_TICKLESS_KERNEL) ? MAX_CYCLES : CYC_PER_TICK; - compare_set(0, initial_timeout, sys_clock_timeout_handler, NULL, false); + compare_set(SYS_CLOCK_CH, initial_timeout, sys_clock_timeout_handler, NULL, false); #if defined(CONFIG_CLOCK_CONTROL_NRF) static const enum nrf_lfclk_start_mode mode = @@ -766,6 +806,29 @@ static int sys_clock_driver_init(void) z_nrf_clock_control_lf_on(mode); #endif +#if CUSTOM_COUNTER_BIT_WIDTH + /* WRAP_CH reserved for wrapping. */ + alloc_mask &= ~BIT(WRAP_CH); + + nrf_rtc_event_t evt = NRF_RTC_CHANNEL_EVENT_ADDR(WRAP_CH); + nrfx_err_t result; + nrf_ppi_channel_t ch; + + nrfy_rtc_event_enable(RTC, NRF_RTC_CHANNEL_INT_MASK(WRAP_CH)); + nrfy_rtc_cc_set(RTC, WRAP_CH, COUNTER_MAX); + uint32_t evt_addr; + uint32_t task_addr; + + evt_addr = nrfy_rtc_event_address_get(RTC, evt); + task_addr = nrfy_rtc_task_address_get(RTC, NRF_RTC_TASK_CLEAR); + + result = nrfx_ppi_channel_alloc(&ch); + if (result != NRFX_SUCCESS) { + return -ENODEV; + } + (void)nrfx_ppi_channel_assign(ch, evt_addr, task_addr); + (void)nrfx_ppi_channel_enable(ch); +#endif return 0; } diff --git a/include/zephyr/drivers/timer/nrf_rtc_timer.h b/include/zephyr/drivers/timer/nrf_rtc_timer.h index 57340098c23b..de1ad940cf54 100644 --- a/include/zephyr/drivers/timer/nrf_rtc_timer.h +++ b/include/zephyr/drivers/timer/nrf_rtc_timer.h @@ -15,7 +15,7 @@ extern "C" { /** @brief Maximum allowed time span that is considered to be in the future. */ -#define NRF_RTC_TIMER_MAX_SCHEDULE_SPAN BIT(23) +#define NRF_RTC_TIMER_MAX_SCHEDULE_SPAN BIT(CONFIG_NRF_RTC_COUNTER_BIT_WIDTH - 1) /** @brief RTC timer compare event handler. * diff --git a/tests/drivers/timer/nrf_rtc_timer/src/main.c b/tests/drivers/timer/nrf_rtc_timer/src/main.c index ebdb1c18a3f6..00393c8587d4 100644 --- a/tests/drivers/timer/nrf_rtc_timer/src/main.c +++ b/tests/drivers/timer/nrf_rtc_timer/src/main.c @@ -321,7 +321,11 @@ ZTEST(nrf_rtc_timer, test_resetting_cc) struct test_data test_data = { .target_time = now + 5, .window = 0, - .delay = 0, + /* For lower bit width, target_time may be equal to maximum counter value. + * In such case, due to PPI connection clearing the timer, counter value + * read in the handler may be slightly off the set counter value. + */ + .delay = (CONFIG_NRF_RTC_COUNTER_BIT_WIDTH < 24) ? 2 : 0, .err = -EINVAL }; @@ -361,6 +365,11 @@ static void overflow_sched_handler(int32_t id, uint64_t expire_time, */ ZTEST(nrf_rtc_timer, test_overflow) { + /* For bit width lower than default 24, overflow injection is not possible. */ + if (CONFIG_NRF_RTC_COUNTER_BIT_WIDTH < 24) { + ztest_test_skip(); + } + PRINT("RTC ticks before overflow injection: %u\r\n", (uint32_t)z_nrf_rtc_timer_read()); From dcf7fbdde4ca060152ca71b820b9be3a02707ce2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Stasiak?= Date: Wed, 16 Jul 2025 14:16:24 +0200 Subject: [PATCH 0615/2141] [nrf fromlist] tests: drivers: counter_nrf_rtc: test fixed top on nRF52832 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added overlay for the board. Upstream PR #: 92025 Signed-off-by: Michał Stasiak --- .../fixed_top/boards/nrf52dk_nrf52832.overlay | 8 ++++++++ .../counter/counter_nrf_rtc/fixed_top/testcase.yaml | 1 + 2 files changed, 9 insertions(+) create mode 100644 tests/drivers/counter/counter_nrf_rtc/fixed_top/boards/nrf52dk_nrf52832.overlay diff --git a/tests/drivers/counter/counter_nrf_rtc/fixed_top/boards/nrf52dk_nrf52832.overlay b/tests/drivers/counter/counter_nrf_rtc/fixed_top/boards/nrf52dk_nrf52832.overlay new file mode 100644 index 000000000000..ebfed9cf9032 --- /dev/null +++ b/tests/drivers/counter/counter_nrf_rtc/fixed_top/boards/nrf52dk_nrf52832.overlay @@ -0,0 +1,8 @@ +&rtc0 { + status = "okay"; + fixed-top; +}; +&rtc2 { + status = "okay"; + fixed-top; +}; diff --git a/tests/drivers/counter/counter_nrf_rtc/fixed_top/testcase.yaml b/tests/drivers/counter/counter_nrf_rtc/fixed_top/testcase.yaml index 38dda6dc88ce..763c6896d079 100644 --- a/tests/drivers/counter/counter_nrf_rtc/fixed_top/testcase.yaml +++ b/tests/drivers/counter/counter_nrf_rtc/fixed_top/testcase.yaml @@ -5,6 +5,7 @@ tests: - counter depends_on: counter platform_allow: + - nrf52dk/nrf52832 - nrf52840dk/nrf52840 - nrf52_bsim - nrf54h20dk/nrf54h20/cpuapp From f1b32dd21614cb36651a29e6b37c795581839489 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Stasiak?= Date: Wed, 6 Aug 2025 10:37:50 +0200 Subject: [PATCH 0616/2141] [nrf fromlist] drivers: spi: nrfx: release constlat mode on suspend MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Release instead of requesting constant latency mode on SPI suspend. Upstream PR #: 94153 Signed-off-by: Michał Stasiak --- drivers/spi/spi_nrfx_spim.c | 2 +- drivers/spi/spi_nrfx_spis.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi_nrfx_spim.c b/drivers/spi/spi_nrfx_spim.c index c8a0566b68a6..ef832713936c 100644 --- a/drivers/spi/spi_nrfx_spim.c +++ b/drivers/spi/spi_nrfx_spim.c @@ -806,7 +806,7 @@ static void spim_suspend(const struct device *dev) #if SPIM_CROSS_DOMAIN_PINS_HANDLE int err; - err = nrf_sys_event_request_global_constlat(); + err = nrf_sys_event_release_global_constlat(); (void)err; __ASSERT_NO_MSG(err >= 0); #else diff --git a/drivers/spi/spi_nrfx_spis.c b/drivers/spi/spi_nrfx_spis.c index c6e551eafc32..71256b84fc33 100644 --- a/drivers/spi/spi_nrfx_spis.c +++ b/drivers/spi/spi_nrfx_spis.c @@ -451,7 +451,7 @@ static void spi_nrfx_suspend(const struct device *dev) #if SPIS_CROSS_DOMAIN_PINS_HANDLE int err; - err = nrf_sys_event_request_global_constlat(); + err = nrf_sys_event_release_global_constlat(); (void)err; __ASSERT_NO_MSG(err >= 0); #else From f39f7647e2526ffc081096e8b764693d620a93c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Duda?= Date: Mon, 4 Aug 2025 10:21:37 +0200 Subject: [PATCH 0617/2141] [nrf fromlist] openthread: Use OPENTHREAD instead of L2_OPENTHREAD in dependencies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update Kconfig dependencies in mbedTLS and logging backend to use OPENTHREAD instead of NET_L2_OPENTHREAD. Upstream PR #: 94054 Signed-off-by: Łukasz Duda --- modules/mbedtls/Kconfig.mbedtls | 2 +- subsys/logging/backends/Kconfig.spinel | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/mbedtls/Kconfig.mbedtls b/modules/mbedtls/Kconfig.mbedtls index 2d8f260b5d13..87ab5ed44e4d 100644 --- a/modules/mbedtls/Kconfig.mbedtls +++ b/modules/mbedtls/Kconfig.mbedtls @@ -485,7 +485,7 @@ config MBEDTLS_ENTROPY_POLL_ZEPHYR config MBEDTLS_OPENTHREAD_OPTIMIZATIONS_ENABLED bool "MbedTLS optimizations for OpenThread" - depends on NET_L2_OPENTHREAD + depends on OPENTHREAD default y if !NET_SOCKETS_SOCKOPT_TLS help Enable some OpenThread specific mbedTLS optimizations that allows to diff --git a/subsys/logging/backends/Kconfig.spinel b/subsys/logging/backends/Kconfig.spinel index d2d29370aa35..94ed1f040a94 100644 --- a/subsys/logging/backends/Kconfig.spinel +++ b/subsys/logging/backends/Kconfig.spinel @@ -4,7 +4,7 @@ config LOG_BACKEND_SPINEL bool "OpenThread dedicated Spinel protocol backend" depends on !LOG_BACKEND_UART - depends on NET_L2_OPENTHREAD + depends on OPENTHREAD help When enabled, backend will use OpenThread dedicated SPINEL protocol for logging. This protocol is byte oriented and wraps given messages into serial frames. From 63febf7715f82807e3b70eb33b3365a7372412a8 Mon Sep 17 00:00:00 2001 From: Adam Kondraciuk Date: Wed, 6 Aug 2025 17:57:20 +0200 Subject: [PATCH 0618/2141] [nrf fromlist] boards: nordic: nrf54h20dk: Disable EXMIF and GPIO6 by default External flash memory is typically not used, so it should be disabled by default. The GPIO6 port used by this device should also be disabled. Upstream PR #: 94180 Signed-off-by: Adam Kondraciuk --- .../nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 4 ++-- .../jesd216/boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 10 ++++++++++ .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 10 ++++++++++ .../common/boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 10 ++++++++++ 4 files changed, 32 insertions(+), 2 deletions(-) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index 3846627ab1a5..994d16242f41 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -264,14 +264,14 @@ slot3_partition: &cpurad_slot1_partition { }; &gpio6 { - status = "okay"; + status = "disabled"; }; &exmif { pinctrl-0 = <&exmif_default>; pinctrl-1 = <&exmif_sleep>; pinctrl-names = "default", "sleep"; - status = "okay"; + status = "disabled"; mx25uw63: mx25uw6345g@0 { compatible = "mxicy,mx25u", "jedec,mspi-nor"; diff --git a/samples/drivers/jesd216/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/samples/drivers/jesd216/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index b8f138ad2b2e..22c24c32f6d8 100644 --- a/samples/drivers/jesd216/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/samples/drivers/jesd216/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -4,6 +4,16 @@ * SPDX-License-Identifier: Apache-2.0 */ +&gpio6 { + status = "okay"; + zephyr,pm-device-runtime-auto; +}; + +&exmif { + status = "okay"; + zephyr,pm-device-runtime-auto; +}; + &mx25uw63 { status = "okay"; }; diff --git a/samples/drivers/spi_flash/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/samples/drivers/spi_flash/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index b8f138ad2b2e..22c24c32f6d8 100644 --- a/samples/drivers/spi_flash/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/samples/drivers/spi_flash/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -4,6 +4,16 @@ * SPDX-License-Identifier: Apache-2.0 */ +&gpio6 { + status = "okay"; + zephyr,pm-device-runtime-auto; +}; + +&exmif { + status = "okay"; + zephyr,pm-device-runtime-auto; +}; + &mx25uw63 { status = "okay"; }; diff --git a/tests/drivers/flash/common/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/flash/common/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index b8f138ad2b2e..22c24c32f6d8 100644 --- a/tests/drivers/flash/common/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/tests/drivers/flash/common/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -4,6 +4,16 @@ * SPDX-License-Identifier: Apache-2.0 */ +&gpio6 { + status = "okay"; + zephyr,pm-device-runtime-auto; +}; + +&exmif { + status = "okay"; + zephyr,pm-device-runtime-auto; +}; + &mx25uw63 { status = "okay"; }; From d1bf6d42716c9e662dd55393c842e83eb5d41f9f Mon Sep 17 00:00:00 2001 From: Travis Lam Date: Wed, 23 Jul 2025 15:39:20 +0200 Subject: [PATCH 0619/2141] [nrf fromtree] drivers: flash: nordic: fix nrf-mramc indentation Fix soc_mramc_nrf_mram space indentation Signed-off-by: Travis Lam (cherry picked from commit 64131856199342d0cb6507e5c57355c82f24dd69) --- drivers/flash/soc_flash_nrf_mramc.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/flash/soc_flash_nrf_mramc.c b/drivers/flash/soc_flash_nrf_mramc.c index c08f8f32851c..716e7c0f2504 100644 --- a/drivers/flash/soc_flash_nrf_mramc.c +++ b/drivers/flash/soc_flash_nrf_mramc.c @@ -4,14 +4,14 @@ * SPDX-License-Identifier: Apache-2.0 */ - #include - - #include - #include - #include - #if defined(CONFIG_SOC_FLASH_NRF_MRAMC_FLUSH_CACHE) - #include - #endif +#include + +#include +#include +#include +#if defined(CONFIG_SOC_FLASH_NRF_MRAMC_FLUSH_CACHE) +#include +#endif LOG_MODULE_REGISTER(flash_nrf_mramc, CONFIG_FLASH_LOG_LEVEL); From 142b7e6a6ba865e99abca1f326a302df7e5647c1 Mon Sep 17 00:00:00 2001 From: Travis Lam Date: Tue, 29 Jul 2025 13:47:21 +0200 Subject: [PATCH 0620/2141] [nrf fromtree] drivers: flash: nordic: nrf_mramc update Remove cache invalidation after flash write, cpu should automatically invalidate cache but for HW erase invalidation needed due to erase from different bus. Signed-off-by: Travis Lam (cherry picked from commit 5274d6601922d25f6efa67031b1d691678140f6e) --- drivers/flash/soc_flash_nrf_mramc.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/drivers/flash/soc_flash_nrf_mramc.c b/drivers/flash/soc_flash_nrf_mramc.c index 716e7c0f2504..7e3a88af2b23 100644 --- a/drivers/flash/soc_flash_nrf_mramc.c +++ b/drivers/flash/soc_flash_nrf_mramc.c @@ -10,7 +10,7 @@ #include #include #if defined(CONFIG_SOC_FLASH_NRF_MRAMC_FLUSH_CACHE) -#include +#include #endif LOG_MODULE_REGISTER(flash_nrf_mramc, CONFIG_FLASH_LOG_LEVEL); @@ -112,13 +112,7 @@ static int nrf_mramc_write(const struct device *dev, off_t offset, * and not number of bytes */ nrfx_mramc_words_write(addr, data, len / WRITE_BLOCK_SIZE); -#if defined(CONFIG_SOC_FLASH_NRF_MRAMC_FLUSH_CACHE) - if (nrf_cache_enable_check(NRF_ICACHE)) { - while (nrf_cache_busy_check(NRF_ICACHE)) { - } - nrf_cache_invalidate(NRF_ICACHE); - } -#endif + return 0; } @@ -144,11 +138,7 @@ static int nrf_mramc_erase(const struct device *dev, off_t offset, size_t size) */ nrfx_mramc_area_erase(addr, size / WRITE_BLOCK_SIZE); #if defined(CONFIG_SOC_FLASH_NRF_MRAMC_FLUSH_CACHE) - if (nrf_cache_enable_check(NRF_ICACHE)) { - while (nrf_cache_busy_check(NRF_ICACHE)) { - } - nrf_cache_invalidate(NRF_ICACHE); - } + sys_cache_instr_invd_all(); #endif return 0; } From 149b89ae09b5658fdd4ede74ee5275e8a7ac3cd9 Mon Sep 17 00:00:00 2001 From: Pisit Sawangvonganan Date: Sat, 28 Jun 2025 02:52:54 +0700 Subject: [PATCH 0621/2141] [nrf fromtree] kconfig: fix typo in (soc, subsys) Utilize a code spell-checking tool to scan for and correct spelling errors in `Kconfig` files within the `soc` and `subsys` directory. Additionally, incorporates a fix recommended by the reviewer. Signed-off-by: Pisit Sawangvonganan (cherry picked from commit 0ec49fa570a76060c5b99187eba8c1682ed133f2) Signed-off-by: Sean Madigan --- soc/atmel/sam0/common/Kconfig.samd2x | 2 +- soc/espressif/esp32s3/Kconfig | 3 ++- soc/intel/intel_adsp/Kconfig | 4 ++-- soc/intel/intel_adsp/Kconfig.defconfig | 2 +- soc/nxp/imxrt/imxrt118x/Kconfig | 4 ++-- soc/nxp/rw/Kconfig | 2 +- soc/renesas/rx/Kconfig | 2 +- soc/silabs/Kconfig | 2 +- soc/st/stm32/Kconfig | 2 +- soc/st/stm32/Kconfig.defconfig | 2 +- subsys/bluetooth/controller/Kconfig | 2 +- subsys/canbus/isotp/Kconfig | 2 +- subsys/debug/coredump/Kconfig | 2 +- subsys/ipc/ipc_service/backends/Kconfig | 10 +++++----- subsys/logging/Kconfig.processing | 2 +- subsys/mgmt/ec_host_cmd/Kconfig.logging | 2 +- subsys/mgmt/mcumgr/smp/Kconfig | 4 ++-- 17 files changed, 25 insertions(+), 24 deletions(-) diff --git a/soc/atmel/sam0/common/Kconfig.samd2x b/soc/atmel/sam0/common/Kconfig.samd2x index 11f76f608a14..c9de00e3249b 100644 --- a/soc/atmel/sam0/common/Kconfig.samd2x +++ b/soc/atmel/sam0/common/Kconfig.samd2x @@ -8,7 +8,7 @@ config SOC_ATMEL_SAMD_NVM_WAIT_STATES default 1 help Wait states to set for NVM. Consult the datasheet as these are highly - dependent on the device operationg conditions. + dependent on the device operating conditions. config SOC_ATMEL_SAMD_OSC32K bool "Internal 32.768 kHz RC oscillator" diff --git a/soc/espressif/esp32s3/Kconfig b/soc/espressif/esp32s3/Kconfig index 99ebadeb4405..5fa2d4607e8b 100644 --- a/soc/espressif/esp32s3/Kconfig +++ b/soc/espressif/esp32s3/Kconfig @@ -152,7 +152,8 @@ config MAC_BB_PD help If enabled, the MAC and baseband of Wi-Fi and Bluetooth will be powered down when PHY is disabled. Enabling this setting reduces power consumption - by a small amount but increases RAM use by approximat + by a small amount but increases RAM use by approximately 4KB (Wi-Fi only), + 2KB (Bluetooth only) or 5.3KB (Wi-Fi + Bluetooth). endmenu # Cache config diff --git a/soc/intel/intel_adsp/Kconfig b/soc/intel/intel_adsp/Kconfig index 096c4336876e..2d87adb03066 100644 --- a/soc/intel/intel_adsp/Kconfig +++ b/soc/intel/intel_adsp/Kconfig @@ -141,8 +141,8 @@ config XTENSA_WAITI_BUG config ADSP_IDLE_CLOCK_GATING bool "DSP clock gating in Idle" help - When true, FW will run with enabled clock gating. This options change - HW configuration of a DSP. Evry time core goes to the WAITI state + When true, FW will run with enabled clock gating. This option changes + HW configuration of a DSP. Every time core goes to the WAITI state (wait for interrupt) during idle, the clock can be gated (however, this does not mean that this will happen). diff --git a/soc/intel/intel_adsp/Kconfig.defconfig b/soc/intel/intel_adsp/Kconfig.defconfig index 5a2ff345e259..1d8312e7fb6c 100644 --- a/soc/intel/intel_adsp/Kconfig.defconfig +++ b/soc/intel/intel_adsp/Kconfig.defconfig @@ -18,7 +18,7 @@ config XTENSA_RPO_CACHE def_bool y # console can't handle the amount of data coming from many tests, so introduce -# a delay beween testcases. +# a delay between testcases. if ZTEST config ZTEST_TEST_DELAY_MS default 100 diff --git a/soc/nxp/imxrt/imxrt118x/Kconfig b/soc/nxp/imxrt/imxrt118x/Kconfig index d62af3d1b518..1ec08a043113 100644 --- a/soc/nxp/imxrt/imxrt118x/Kconfig +++ b/soc/nxp/imxrt/imxrt118x/Kconfig @@ -40,11 +40,11 @@ config IMAGE_CONTAINER_OFFSET default 0x1000 help Image container is a boot image format that is used by ROM. Container - format consists container header, image arrary entry, signature block + format consists of container header, image array entry, signature block and user program images and data. The boot ROM expects container data to be saved in external memory. -# Note- This config present the offest between container header and user +# Note- This config presents the offset between container header and user # image. If ROM_START_OFFSET changed, you also need to change CONTAINER_USER_IMAGE_OFFSET # value. CONTAINER_USER_IMAGE_OFFSET = ROM_START_OFFSET - IMAGE_CONTAINER_OFFSET. config CONTAINER_USER_IMAGE_OFFSET diff --git a/soc/nxp/rw/Kconfig b/soc/nxp/rw/Kconfig index a32483ad0c12..63a2e28b7320 100644 --- a/soc/nxp/rw/Kconfig +++ b/soc/nxp/rw/Kconfig @@ -39,7 +39,7 @@ config FLASH_CONFIG_OFFSET default 0x400 help The flash config offset provides the boot ROM with the on-board - flash type and parameters. The boot ROM requires a fixed flash conifg + flash type and parameters. The boot ROM requires a fixed flash config offset for FlexSPI device. config IMAGE_VECTOR_TABLE_OFFSET diff --git a/soc/renesas/rx/Kconfig b/soc/renesas/rx/Kconfig index f0670b850e3a..2f5253bf5412 100644 --- a/soc/renesas/rx/Kconfig +++ b/soc/renesas/rx/Kconfig @@ -10,7 +10,7 @@ config RENESAS_NONE_USED_PORT_INIT bool "Initialize unused ports" default y help - Initialize the unsed pins of RX MCU followed by in the "Handling of + Initialize the unused pins of RX MCU followed by in the "Handling of Unused Pins" section of PORT chapter of RX MCU of User's manual. Note: please MUST set "BSP_PACKAGE_PINS" definition to your device of pin type in r_bsp_config.h. diff --git a/soc/silabs/Kconfig b/soc/silabs/Kconfig index dcf8de541c63..1fb5535ac671 100644 --- a/soc/silabs/Kconfig +++ b/soc/silabs/Kconfig @@ -9,7 +9,7 @@ if SOC_FAMILY_SILABS_S0 || SOC_FAMILY_SILABS_S1 || SOC_FAMILY_SILABS_S2 config SOC_GECKO_SDID int help - Gecko SDK sometime refere to the chipset using the internal ID. This + Sometimes, Gecko SDK refers to the chipset using the internal ID. This entry reflects this ID. config SOC_GECKO_BURTC diff --git a/soc/st/stm32/Kconfig b/soc/st/stm32/Kconfig index 59a245fb17a9..a14d9ea81824 100644 --- a/soc/st/stm32/Kconfig +++ b/soc/st/stm32/Kconfig @@ -36,7 +36,7 @@ config STM32_ENABLE_DEBUG_SLEEP_STOP Some STM32 parts disable the DBGMCU in sleep/stop modes because of power consumption. As a side-effects this prevents debuggers from attaching w/o resetting the target. This - effectivly destroys the use-case of `west attach`. Also + effectively destroys the use-case of `west attach`. Also SEGGER RTT and similar technologies need this. config SWJ_ANALOG_PRIORITY diff --git a/soc/st/stm32/Kconfig.defconfig b/soc/st/stm32/Kconfig.defconfig index 18f343b9324c..26055f9eb606 100644 --- a/soc/st/stm32/Kconfig.defconfig +++ b/soc/st/stm32/Kconfig.defconfig @@ -3,7 +3,7 @@ # Copyright (c) 2017, I-SENSE group of ICCS # SPDX-License-Identifier: Apache-2.0 -# Default configurations appplied tp the whole STM32 family +# Default configurations applied to the whole STM32 family if SOC_FAMILY_STM32 diff --git a/subsys/bluetooth/controller/Kconfig b/subsys/bluetooth/controller/Kconfig index 60726163581c..16a40b7f4375 100644 --- a/subsys/bluetooth/controller/Kconfig +++ b/subsys/bluetooth/controller/Kconfig @@ -128,7 +128,7 @@ config BT_CTLR_SUBRATING_SUPPORT config BT_CTLR_CHANNEL_SOUNDING_SUPPORT bool -# Virtual option that all local LL implemenations should select +# Virtual option that all local LL implementations should select config HAS_BT_CTLR bool diff --git a/subsys/canbus/isotp/Kconfig b/subsys/canbus/isotp/Kconfig index 281692cf95ed..c643f22ca187 100644 --- a/subsys/canbus/isotp/Kconfig +++ b/subsys/canbus/isotp/Kconfig @@ -87,7 +87,7 @@ config ISOTP_RX_SF_FF_BUF_COUNT default 4 help This buffer is used for first and single frames. It is extra because the - buffer has to be ready for the first reception in isr context and therefor + buffer has to be ready for the first reception in isr context and therefore is allocated when binding. Each buffer will occupy CAN_MAX_DLEN - 1 byte + header (sizeof(struct net_buf)) amount of data. diff --git a/subsys/debug/coredump/Kconfig b/subsys/debug/coredump/Kconfig index 1e763e522e19..c4e93605988d 100644 --- a/subsys/debug/coredump/Kconfig +++ b/subsys/debug/coredump/Kconfig @@ -45,7 +45,7 @@ config DEBUG_COREDUMP_BACKEND_INTEL_ADSP_MEM_WINDOW help Core dump is done via memory window slot[1]. It is Intel ADSP memory region shared with xtensa DSP. - Window 2 slot [1] is reserved for debuging information. + Window 2 slot [1] is reserved for debugging information. config DEBUG_COREDUMP_BACKEND_OTHER bool "Backend subsystem for coredump defined out of tree" diff --git a/subsys/ipc/ipc_service/backends/Kconfig b/subsys/ipc/ipc_service/backends/Kconfig index 8230465e246a..bb8b444898f9 100644 --- a/subsys/ipc/ipc_service/backends/Kconfig +++ b/subsys/ipc/ipc_service/backends/Kconfig @@ -23,7 +23,7 @@ config IPC_SERVICE_BACKEND_ICMSG depends on DT_HAS_ZEPHYR_IPC_ICMSG_ENABLED select IPC_SERVICE_ICMSG help - Chosing this backend results in single endpoint implementation based + Choosing this backend results in single endpoint implementation based on circular packet buffer. config IPC_SERVICE_BACKEND_ICMSG_ME_INITIATOR @@ -33,8 +33,8 @@ config IPC_SERVICE_BACKEND_ICMSG_ME_INITIATOR depends on DT_HAS_ZEPHYR_IPC_ICMSG_ME_INITIATOR_ENABLED select IPC_SERVICE_ICMSG_ME help - Chosing this backend results in multi endpoint implementation based - on circular packet buffer. This enables enpoint discovery initiator + Choosing this backend results in multi endpoint implementation based + on circular packet buffer. This enables endpoint discovery initiator role. config IPC_SERVICE_BACKEND_ICMSG_ME_FOLLOWER @@ -44,8 +44,8 @@ config IPC_SERVICE_BACKEND_ICMSG_ME_FOLLOWER depends on DT_HAS_ZEPHYR_IPC_ICMSG_ME_FOLLOWER_ENABLED select IPC_SERVICE_ICMSG_ME help - Chosing this backend results in multi endpoint implementation based - on circular packet buffer. This enables enpoint discovery follower + Choosing this backend results in multi endpoint implementation based + on circular packet buffer. This enables endpoint discovery follower role. rsource "Kconfig.icmsg_me" diff --git a/subsys/logging/Kconfig.processing b/subsys/logging/Kconfig.processing index f354e8b5df61..c13c8a76a913 100644 --- a/subsys/logging/Kconfig.processing +++ b/subsys/logging/Kconfig.processing @@ -114,7 +114,7 @@ config LOG_PROCESS_THREAD_PRIORITY depends on LOG_PROCESS_THREAD_CUSTOM_PRIORITY help The priority of the log processing thread. - When not set the prority is set to K_LOWEST_APPLICATION_THREAD_PRIO. + When not set the priority is set to K_LOWEST_APPLICATION_THREAD_PRIO. endif # LOG_PROCESS_THREAD diff --git a/subsys/mgmt/ec_host_cmd/Kconfig.logging b/subsys/mgmt/ec_host_cmd/Kconfig.logging index 96de59e39cd0..ca2253099294 100644 --- a/subsys/mgmt/ec_host_cmd/Kconfig.logging +++ b/subsys/mgmt/ec_host_cmd/Kconfig.logging @@ -8,7 +8,7 @@ config EC_HOST_CMD_LOG_DBG_BUFFERS depends on EC_HC_LOG_LEVEL_DBG help Every command is logged with the debug logging level. Use this config - to decide, if full reqest and response buffers are logged alongside + to decide if full request and response buffers are logged alongside other command parameters. config EC_HOST_CMD_LOG_SUPPRESSED_NUMBER diff --git a/subsys/mgmt/mcumgr/smp/Kconfig b/subsys/mgmt/mcumgr/smp/Kconfig index b460067dd844..aab861fa9cf9 100644 --- a/subsys/mgmt/mcumgr/smp/Kconfig +++ b/subsys/mgmt/mcumgr/smp/Kconfig @@ -31,7 +31,7 @@ config MCUMGR_SMP_CBOR_MIN_DECODING_LEVELS help Minimal decoding levels, map/list encapsulation, required to be supported by zcbor decoding of SMP responses - is auto genereated from MCUMGR_SMP_CBOR_MIN_DECODING_LEVEL_? options. + is auto generated from MCUMGR_SMP_CBOR_MIN_DECODING_LEVEL_? options. A group or command that adds additional maps/lists above the base map, which is already taken into account, should select one of the MCUMGR_SMP_CBOR_MIN_DECODING_LEVEL_?. @@ -87,7 +87,7 @@ config MCUMGR_SMP_CBOR_MIN_ENCODING_LEVELS help Minimal encoding levels, map/list encapsulation, required to be supported by zcbor encoding of SMP responses - is auto genereated from MCUMGR_SMP_CBOR_MIN_ENCODING_LEVEL_? options. + is auto generated from MCUMGR_SMP_CBOR_MIN_ENCODING_LEVEL_? options. A group or command that adds additional maps/lists above the base map, which is already taken into account, should select one of the MCUMGR_SMP_CBOR_MIN_ENCODING_LEVEL_?. From 5684f5eeed7d513efcc806aaa69bb8f274776515 Mon Sep 17 00:00:00 2001 From: Sean Madigan Date: Wed, 9 Jul 2025 12:32:54 +0100 Subject: [PATCH 0622/2141] [nrf fromtree] bluetooth: host: hci_core: allow both orders of version and feature events Previously, the version complete event had to come after the remote feature complete event for the notify_remote_info function to be called. This becomes less practical when adding the read all remote features complete event, as this can take some time. Meaning the order of events is not predictable. Signed-off-by: Sean Madigan (cherry picked from commit cddea431eb9264c64760028ed132fb99de56922c) Signed-off-by: Sean Madigan --- subsys/bluetooth/host/hci_core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/subsys/bluetooth/host/hci_core.c b/subsys/bluetooth/host/hci_core.c index 7263bc39ed4e..9de787388b17 100644 --- a/subsys/bluetooth/host/hci_core.c +++ b/subsys/bluetooth/host/hci_core.c @@ -1792,7 +1792,8 @@ static void le_remote_feat_complete(struct net_buf *buf) atomic_set_bit(conn->flags, BT_CONN_LE_FEATURES_EXCHANGED); if (IS_ENABLED(CONFIG_BT_REMOTE_INFO) && - !IS_ENABLED(CONFIG_BT_REMOTE_VERSION)) { + (!IS_ENABLED(CONFIG_BT_REMOTE_VERSION) || + atomic_test_bit(conn->flags, BT_CONN_AUTO_VERSION_INFO))) { notify_remote_info(conn); } @@ -2372,7 +2373,8 @@ static void bt_hci_evt_read_remote_version_complete(struct net_buf *buf) atomic_set_bit(conn->flags, BT_CONN_AUTO_VERSION_INFO); - if (IS_ENABLED(CONFIG_BT_REMOTE_INFO)) { + if (IS_ENABLED(CONFIG_BT_REMOTE_INFO) && + atomic_test_bit(conn->flags, BT_CONN_LE_FEATURES_EXCHANGED)) { /* Remote features is already present */ notify_remote_info(conn); } From 579aa3120082320a027414816202b9e4f88edc41 Mon Sep 17 00:00:00 2001 From: Sean Madigan Date: Tue, 8 Jul 2025 17:11:51 +0100 Subject: [PATCH 0623/2141] [nrf fromtree] bluetooth: host: Add support for extended feature set feature This commit adds support for the extended feature set feature. This includes: - hci boilerplate - kconfigs, including one for a max local feature page - reading remote features is done by a command and callback - this is not linked into the auto feature request on connection as this procedure can take quite a few connection events, and we do not want to delay the user - added the commands to the bt shell Signed-off-by: Sean Madigan (cherry picked from commit 3adae8bd9ae71822fe6442a60306103763eabf02) Signed-off-by: Sean Madigan --- include/zephyr/bluetooth/bluetooth.h | 12 +++- include/zephyr/bluetooth/conn.h | 58 ++++++++++++++++++ include/zephyr/bluetooth/hci_types.h | 36 ++++++++++- subsys/bluetooth/Kconfig | 15 +++++ subsys/bluetooth/common/Kconfig | 2 +- subsys/bluetooth/controller/Kconfig | 11 ++++ subsys/bluetooth/host/conn.c | 47 +++++++++++++++ subsys/bluetooth/host/conn_internal.h | 3 + subsys/bluetooth/host/hci_core.c | 86 +++++++++++++++++++++++++-- subsys/bluetooth/host/shell/bt.c | 66 ++++++++++++++++++++ tests/bluetooth/shell/testcase.yaml | 6 ++ 11 files changed, 331 insertions(+), 11 deletions(-) diff --git a/include/zephyr/bluetooth/bluetooth.h b/include/zephyr/bluetooth/bluetooth.h index 7f287f1c3448..a061b0564bfb 100644 --- a/include/zephyr/bluetooth/bluetooth.h +++ b/include/zephyr/bluetooth/bluetooth.h @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -71,11 +72,16 @@ extern "C" { #define BT_ID_DEFAULT 0 /** - * @brief Number of octets for local supported + * @brief Number of octets for local supported features * - * The value of 8 correspond to page 0 in the LE Controller supported features + * The value of 8 correspond to page 0 in the LE Controller supported features. + * 24 bytes are required for all subsequent supported feature pages. */ -#define BT_LE_LOCAL_SUPPORTED_FEATURES_SIZE 8 +#define BT_LE_LOCAL_SUPPORTED_FEATURES_SIZE \ + (BT_HCI_LE_BYTES_PAGE_0_FEATURE_PAGE + \ + COND_CODE_1(CONFIG_BT_LE_MAX_LOCAL_SUPPORTED_FEATURE_PAGE, \ + CONFIG_BT_LE_MAX_LOCAL_SUPPORTED_FEATURE_PAGE * BT_HCI_LE_BYTES_PER_FEATURE_PAGE, \ + (0U))) /** Opaque type representing an advertiser. */ struct bt_le_ext_adv; diff --git a/include/zephyr/bluetooth/conn.h b/include/zephyr/bluetooth/conn.h index 8bc060bb05b5..bf8a31603b85 100644 --- a/include/zephyr/bluetooth/conn.h +++ b/include/zephyr/bluetooth/conn.h @@ -252,6 +252,27 @@ struct bt_conn_le_subrate_changed { uint16_t supervision_timeout; }; +/** Read all remote features complete callback params */ +struct bt_conn_le_read_all_remote_feat_complete { + /** @brief HCI Status from LE Read All Remote Features Complete event. + * + * The remaining parameters will be unchanged if status is not @ref BT_HCI_ERR_SUCCESS. + */ + uint8_t status; + /** Number of pages supported by remote device. */ + uint8_t max_remote_page; + /** Number of pages fetched from remote device. */ + uint8_t max_valid_page; + /** @brief Pointer to array of size 248, with feature bits of remote supported features. + * + * Page 0 being 8 bytes, with the following 10 pages of 24 bytes. + * Refer to BT_LE_FEAT_BIT_* for values. + * Refer to the BT_FEAT_LE_* macros for value comparison. + * See Bluetooth Core Specification, Vol 6, Part B, Section 4.6. + */ + const uint8_t *features; +}; + /** Connection Type */ enum __packed bt_conn_type { /** LE Connection Type */ @@ -1186,6 +1207,24 @@ int bt_conn_le_subrate_set_defaults(const struct bt_conn_le_subrate_param *param int bt_conn_le_subrate_request(struct bt_conn *conn, const struct bt_conn_le_subrate_param *params); +/** @brief Read remote feature pages. + * + * Request remote feature pages, from 0 up to pages_requested or the number + * of pages supported by the peer. There is a maximum of 10 pages. + * This function will trigger the read_all_remote_feat_complete callback + * when the procedure is completed. + * + * @kconfig_dep{CONFIG_BT_LE_EXTENDED_FEAT_SET} + * + * @param conn @ref BT_CONN_TYPE_LE connection object. + * @param pages_requested Number of feature pages to be requested from peer. + * There is a maximum of 10 pages. + * + * @return Zero on success or (negative) error code on failure. + * @return -EINVAL @p conn is not a valid @ref BT_CONN_TYPE_LE connection. + */ +int bt_conn_le_read_all_remote_features(struct bt_conn *conn, uint8_t pages_requested); + /** @brief Update the connection parameters. * * If the local device is in the peripheral role then updating the connection @@ -1877,6 +1916,25 @@ struct bt_conn_cb { const struct bt_conn_le_subrate_changed *params); #endif /* CONFIG_BT_SUBRATING */ +#if defined(CONFIG_BT_LE_EXTENDED_FEAT_SET) + /** @brief Read all remote features complete event. + * + * This callback notifies the application that a 'read all remote + * features' procedure of the connection is completed. The other params + * will not be populated if status is not @ref BT_HCI_ERR_SUCCESS. + * + * This callback can be triggered by calling @ref + * bt_conn_le_read_all_remote_features or by the procedure running + * autonomously in the controller. + * + * @param conn Connection object. + * @param params Remote features. + */ + void (*read_all_remote_feat_complete)( + struct bt_conn *conn, + const struct bt_conn_le_read_all_remote_feat_complete *params); +#endif /* CONFIG_BT_LE_EXTENDED_FEAT_SET */ + #if defined(CONFIG_BT_CHANNEL_SOUNDING) /** @brief LE CS Read Remote Supported Capabilities Complete event. * diff --git a/include/zephyr/bluetooth/hci_types.h b/include/zephyr/bluetooth/hci_types.h index 0b2c1b1a3976..a20852712394 100644 --- a/include/zephyr/bluetooth/hci_types.h +++ b/include/zephyr/bluetooth/hci_types.h @@ -207,7 +207,7 @@ struct bt_hci_cmd_hdr { #define BT_LE_FEAT_BIT_CHANNEL_SOUNDING 46 #define BT_LE_FEAT_BIT_CHANNEL_SOUNDING_HOST 47 #define BT_LE_FEAT_BIT_CHANNEL_SOUNDING_TONE_QUAL_IND 48 -#define BT_LE_FEAT_BIT_LL_EXTENDED_FEAT_SET 63 +#define BT_LE_FEAT_BIT_EXTENDED_FEAT_SET 63 #define BT_LE_FEAT_TEST(feat, n) (feat[(n) >> 3] & \ BIT((n) & 7)) @@ -284,6 +284,8 @@ struct bt_hci_cmd_hdr { BT_LE_FEAT_BIT_CHANNEL_SOUNDING) #define BT_FEAT_LE_CHANNEL_SOUNDING_HOST(feat) BT_LE_FEAT_TEST(feat, \ BT_LE_FEAT_BIT_CHANNEL_SOUNDING_HOST) +#define BT_FEAT_LE_EXTENDED_FEAT_SET(feat) BT_LE_FEAT_TEST(feat, \ + BT_LE_FEAT_BIT_EXTENDED_FEAT_SET) #define BT_FEAT_LE_CIS(feat) (BT_FEAT_LE_CIS_CENTRAL(feat) | \ BT_FEAT_LE_CIS_PERIPHERAL(feat)) @@ -2438,6 +2440,22 @@ struct bt_hci_cp_le_tx_test_v4 { uint8_t ant_ids[0]; } __packed; +#define BT_HCI_OP_LE_READ_ALL_LOCAL_SUPPORTED_FEATURES BT_OP(BT_OGF_LE, 0x0087) /* 0x2087 */ +struct bt_hci_rp_le_read_all_local_supported_features { + uint8_t status; + uint8_t max_page; + uint8_t features[248]; +} __packed; + +#define BT_READ_ALL_LOCAL_FEATURES_SUPPORTED(supported_commands) \ + BT_CMD_TEST(supported_commands, 47, 2) + +#define BT_HCI_OP_LE_READ_ALL_REMOTE_FEATURES BT_OP(BT_OGF_LE, 0x0088) /* 0x2088 */ +struct bt_hci_cp_le_read_all_remote_features { + uint16_t handle; + uint8_t pages_requested; +} __packed; + #define BT_HCI_TX_TEST_POWER_MIN -0x7F #define BT_HCI_TX_TEST_POWER_MAX 0x14 @@ -3552,6 +3570,20 @@ struct bt_hci_evt_le_cis_established_v2 { uint8_t framing; } __packed; +#define BT_HCI_EVT_LE_READ_ALL_REMOTE_FEAT_COMPLETE 0x2b + +#define BT_HCI_LE_FEATURE_PAGE_MAX 10 +#define BT_HCI_LE_BYTES_PER_FEATURE_PAGE 24 +#define BT_HCI_LE_BYTES_PAGE_0_FEATURE_PAGE 8 + +struct bt_hci_evt_le_read_all_remote_feat_complete { + uint8_t status; + uint16_t handle; + uint8_t max_remote_page; + uint8_t max_valid_page; + uint8_t features[248]; +} __packed; + #define BT_HCI_LE_CS_INITIATOR_ROLE_MASK BIT(0) #define BT_HCI_LE_CS_REFLECTOR_ROLE_MASK BIT(1) @@ -4024,6 +4056,8 @@ struct bt_hci_evt_le_cs_procedure_enable_complete { #define BT_EVT_MASK_LE_ENH_CONN_COMPLETE_V2 BT_EVT_BIT(40) #define BT_EVT_MASK_LE_CIS_ESTABLISHED_V2 BT_EVT_BIT(41) +#define BT_EVT_MASK_LE_READ_ALL_REMOTE_FEAT_COMPLETE BT_EVT_BIT(42) + #define BT_EVT_MASK_LE_CS_READ_REMOTE_SUPPORTED_CAPABILITIES_COMPLETE BT_EVT_BIT(43) #define BT_EVT_MASK_LE_CS_READ_REMOTE_FAE_TABLE_COMPLETE BT_EVT_BIT(44) #define BT_EVT_MASK_LE_CS_SECURITY_ENABLE_COMPLETE BT_EVT_BIT(45) diff --git a/subsys/bluetooth/Kconfig b/subsys/bluetooth/Kconfig index 68d08819e1c3..c98c7a5ff538 100644 --- a/subsys/bluetooth/Kconfig +++ b/subsys/bluetooth/Kconfig @@ -115,6 +115,21 @@ config BT_CONN_TX help Hidden configuration that is true if ACL or broadcast ISO is enabled +config BT_LE_MAX_LOCAL_SUPPORTED_FEATURE_PAGE + int "Maximum supported feature page" + default 0 + range 0 10 + depends on BT_LE_EXTENDED_FEAT_SET + help + Maximum supported feature page that can be stored locally and fetched + from the remote connection with the LL Extended Feature Set feature. + +config BT_LE_EXTENDED_FEAT_SET + bool "LL Extended Feature Set" + depends on !HAS_BT_CTLR || BT_CTLR_EXTENDED_FEAT_SET_SUPPORT + help + Enable support for the LL Extended Feature Set feature. + if BT_CONN config BT_HCI_ACL_FLOW_CONTROL bool "Controller to Host ACL flow control support" diff --git a/subsys/bluetooth/common/Kconfig b/subsys/bluetooth/common/Kconfig index 2b7b698d8f8e..60328a1dd35a 100644 --- a/subsys/bluetooth/common/Kconfig +++ b/subsys/bluetooth/common/Kconfig @@ -119,7 +119,7 @@ config BT_BUF_ACL_RX_COUNT config BT_BUF_EVT_RX_SIZE int "Maximum supported HCI Event buffer length" - default $(UINT8_MAX) if (BT_EXT_ADV && BT_OBSERVER) || BT_PER_ADV_SYNC || BT_DF_CONNECTION_CTE_RX || BT_CLASSIC || BT_CHANNEL_SOUNDING + default $(UINT8_MAX) if (BT_EXT_ADV && BT_OBSERVER) || BT_PER_ADV_SYNC || BT_DF_CONNECTION_CTE_RX || BT_CLASSIC || BT_CHANNEL_SOUNDING || BT_LE_EXTENDED_FEAT_SET # LE Read Supported Commands command complete event. default 68 range 68 $(UINT8_MAX) diff --git a/subsys/bluetooth/controller/Kconfig b/subsys/bluetooth/controller/Kconfig index 16a40b7f4375..c7e7030ba287 100644 --- a/subsys/bluetooth/controller/Kconfig +++ b/subsys/bluetooth/controller/Kconfig @@ -128,6 +128,9 @@ config BT_CTLR_SUBRATING_SUPPORT config BT_CTLR_CHANNEL_SOUNDING_SUPPORT bool +config BT_CTLR_EXTENDED_FEAT_SET_SUPPORT + bool + # Virtual option that all local LL implementations should select config HAS_BT_CTLR bool @@ -1176,6 +1179,14 @@ config BT_CTLR_CHANNEL_SOUNDING Enable support for Bluetooth 6.0 Channel Sounding in the Controller. +config BT_CTLR_EXTENDED_FEAT_SET + bool "LL Extended Feature Set support" + depends on BT_CTLR_EXTENDED_FEAT_SET_SUPPORT + default y if BT_LE_EXTENDED_FEAT_SET + help + Enable support for Bluetooth 6.0 LL Extended Feature Set + in the Controller. + rsource "Kconfig.df" rsource "Kconfig.ll_sw_split" rsource "Kconfig.dtm" diff --git a/subsys/bluetooth/host/conn.c b/subsys/bluetooth/host/conn.c index a74a04295278..b8f63abf801e 100644 --- a/subsys/bluetooth/host/conn.c +++ b/subsys/bluetooth/host/conn.c @@ -3304,6 +3304,53 @@ int bt_conn_le_subrate_request(struct bt_conn *conn, } #endif /* CONFIG_BT_SUBRATING */ +#if defined(CONFIG_BT_LE_EXTENDED_FEAT_SET) +void notify_read_all_remote_feat_complete(struct bt_conn *conn, + struct bt_conn_le_read_all_remote_feat_complete *params) +{ + struct bt_conn_cb *callback; + + SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { + if (callback->read_all_remote_feat_complete != NULL) { + callback->read_all_remote_feat_complete(conn, params); + } + } + + STRUCT_SECTION_FOREACH(bt_conn_cb, cb) + { + if (cb->read_all_remote_feat_complete != NULL) { + cb->read_all_remote_feat_complete(conn, params); + } + } +} + +int bt_conn_le_read_all_remote_features(struct bt_conn *conn, uint8_t pages_requested) +{ + struct bt_hci_cp_le_read_all_remote_features *cp; + struct net_buf *buf; + + if (!bt_conn_is_type(conn, BT_CONN_TYPE_LE)) { + LOG_DBG("Invalid connection type: %u for %p", conn->type, conn); + return -EINVAL; + } + + if (pages_requested > BT_HCI_LE_FEATURE_PAGE_MAX) { + return -EINVAL; + } + + buf = bt_hci_cmd_alloc(K_FOREVER); + if (buf == NULL) { + return -ENOBUFS; + } + + cp = net_buf_add(buf, sizeof(*cp)); + cp->handle = sys_cpu_to_le16(conn->handle); + cp->pages_requested = pages_requested; + + return bt_hci_cmd_send_sync(BT_HCI_OP_LE_READ_ALL_REMOTE_FEATURES, buf, NULL); +} +#endif /* CONFIG_BT_LE_EXTENDED_FEAT_SET */ + #if defined(CONFIG_BT_CHANNEL_SOUNDING) void notify_remote_cs_capabilities(struct bt_conn *conn, uint8_t status, struct bt_conn_le_cs_capabilities *params) diff --git a/subsys/bluetooth/host/conn_internal.h b/subsys/bluetooth/host/conn_internal.h index 909c0ebd22ef..7d3cc1303942 100644 --- a/subsys/bluetooth/host/conn_internal.h +++ b/subsys/bluetooth/host/conn_internal.h @@ -512,6 +512,9 @@ void notify_path_loss_threshold_report(struct bt_conn *conn, void notify_subrate_change(struct bt_conn *conn, struct bt_conn_le_subrate_changed params); +void notify_read_all_remote_feat_complete(struct bt_conn *conn, + struct bt_conn_le_read_all_remote_feat_complete *params); + void notify_remote_cs_capabilities(struct bt_conn *conn, uint8_t status, struct bt_conn_le_cs_capabilities *params); diff --git a/subsys/bluetooth/host/hci_core.c b/subsys/bluetooth/host/hci_core.c index 9de787388b17..1fe19b5373b7 100644 --- a/subsys/bluetooth/host/hci_core.c +++ b/subsys/bluetooth/host/hci_core.c @@ -1800,6 +1800,37 @@ static void le_remote_feat_complete(struct net_buf *buf) bt_conn_unref(conn); } +#if defined(CONFIG_BT_LE_EXTENDED_FEAT_SET) +static void le_read_all_remote_feat_complete(struct net_buf *buf) +{ + struct bt_hci_evt_le_read_all_remote_feat_complete *evt = (void *)buf->data; + struct bt_conn *conn; + struct bt_conn_le_read_all_remote_feat_complete params; + uint16_t handle = sys_le16_to_cpu(evt->handle); + + LOG_DBG("Read all remote feature complete: 0x%02x %s handle %u", evt->status, + bt_hci_err_to_str(evt->status), handle); + + conn = bt_conn_lookup_handle(handle, BT_CONN_TYPE_LE); + if (conn == NULL) { + LOG_ERR("Unknown conn handle 0x%04X", handle); + return; + } + + params.status = evt->status; + + if (params.status == BT_HCI_ERR_SUCCESS) { + params.max_remote_page = evt->max_remote_page; + params.max_valid_page = evt->max_valid_page; + params.features = evt->features; + } + + notify_read_all_remote_feat_complete(conn, ¶ms); + + bt_conn_unref(conn); +} +#endif /* CONFIG_BT_LE_EXTENDED_FEAT_SET */ + #if defined(CONFIG_BT_DATA_LEN_UPDATE) static void le_data_len_change(struct net_buf *buf) { @@ -2922,6 +2953,11 @@ static const struct event_handler meta_events[] = { EVENT_HANDLER(BT_HCI_EVT_LE_ENH_CONN_COMPLETE_V2, le_enh_conn_complete_v2, sizeof(struct bt_hci_evt_le_enh_conn_complete_v2)), #endif /* CONFIG_BT_PER_ADV_RSP || CONFIG_BT_PER_ADV_SYNC_RSP */ +#if defined(CONFIG_BT_LE_EXTENDED_FEAT_SET) + EVENT_HANDLER(BT_HCI_EVT_LE_READ_ALL_REMOTE_FEAT_COMPLETE, + le_read_all_remote_feat_complete, + sizeof(struct bt_hci_evt_le_read_all_remote_feat_complete)), +#endif /* CONFIG_BT_LE_EXTENDED_FEAT_SET */ #endif /* CONFIG_BT_CONN */ #if defined(CONFIG_BT_CHANNEL_SOUNDING) EVENT_HANDLER(BT_HCI_EVT_LE_CS_READ_REMOTE_SUPPORTED_CAPABILITIES_COMPLETE, @@ -3158,9 +3194,47 @@ static void read_le_features_complete(struct net_buf *buf) LOG_DBG("status 0x%02x %s", rp->status, bt_hci_err_to_str(rp->status)); + memcpy(bt_dev.le.features, rp->features, sizeof(rp->features)); +} + +static void read_le_all_supported_features_complete(struct net_buf *buf) +{ + struct bt_hci_rp_le_read_all_local_supported_features *rp = (void *)buf->data; + + LOG_DBG("status 0x%02x %s", rp->status, bt_hci_err_to_str(rp->status)); + memcpy(bt_dev.le.features, rp->features, sizeof(bt_dev.le.features)); } +static int read_le_local_supported_features(void) +{ + struct net_buf *rsp; + int err; + + /* Read Low Energy Supported Features */ + if (IS_ENABLED(CONFIG_BT_LE_EXTENDED_FEAT_SET) && + BT_READ_ALL_LOCAL_FEATURES_SUPPORTED(bt_dev.supported_commands)) { + err = bt_hci_cmd_send_sync(BT_HCI_OP_LE_READ_ALL_LOCAL_SUPPORTED_FEATURES, NULL, + &rsp); + if (err != 0) { + return err; + } + + read_le_all_supported_features_complete(rsp); + } else { + err = bt_hci_cmd_send_sync(BT_HCI_OP_LE_READ_LOCAL_FEATURES, NULL, + &rsp); + if (err != 0) { + return err; + } + + read_le_features_complete(rsp); + } + + net_buf_unref(rsp); + return 0; +} + #if defined(CONFIG_BT_CONN) #if !defined(CONFIG_BT_CLASSIC) static void read_buffer_size_complete(struct net_buf *buf) @@ -3445,6 +3519,11 @@ static int le_set_event_mask(void) BT_FEAT_LE_CONN_SUBRATING(bt_dev.le.features)) { mask |= BT_EVT_MASK_LE_SUBRATE_CHANGE; } + + if (IS_ENABLED(CONFIG_BT_LE_EXTENDED_FEAT_SET) && + BT_FEAT_LE_EXTENDED_FEAT_SET(bt_dev.le.features)) { + mask |= BT_EVT_MASK_LE_READ_ALL_REMOTE_FEAT_COMPLETE; + } } if (IS_ENABLED(CONFIG_BT_SMP) && @@ -3583,16 +3662,11 @@ static int le_init(void) return -ENODEV; } - /* Read Low Energy Supported Features */ - err = bt_hci_cmd_send_sync(BT_HCI_OP_LE_READ_LOCAL_FEATURES, NULL, - &rsp); + err = read_le_local_supported_features(); if (err) { return err; } - read_le_features_complete(rsp); - net_buf_unref(rsp); - if (IS_ENABLED(CONFIG_BT_ISO) && BT_FEAT_LE_ISO(bt_dev.le.features)) { err = le_init_iso(); diff --git a/subsys/bluetooth/host/shell/bt.c b/subsys/bluetooth/host/shell/bt.c index 1550644018ef..cc30ad7fbb19 100644 --- a/subsys/bluetooth/host/shell/bt.c +++ b/subsys/bluetooth/host/shell/bt.c @@ -1008,6 +1008,37 @@ void subrate_changed(struct bt_conn *conn, } #endif +#if defined(CONFIG_BT_LE_EXTENDED_FEAT_SET) +void read_all_remote_feat_complete(struct bt_conn *conn, + const struct bt_conn_le_read_all_remote_feat_complete *params) +{ + if (params->status == BT_HCI_ERR_SUCCESS) { + uint8_t number_of_bytes = BT_HCI_LE_BYTES_PAGE_0_FEATURE_PAGE; + + if (params->max_valid_page > 0) { + number_of_bytes += + (params->max_valid_page * BT_HCI_LE_BYTES_PER_FEATURE_PAGE); + } + + bt_shell_fprintf_print( + "Read all remote features complete, Max Remote Page %d, LE Features: 0x", + params->max_remote_page); + + for (int i = number_of_bytes - 1; i >= 0; i--) { + uint8_t features = params->features[i]; + char features_str[(2 * sizeof(uint8_t)) + 1]; + + bin2hex(&features, sizeof(features), features_str, sizeof(features_str)); + bt_shell_fprintf_print("%s", features_str); + } + bt_shell_fprintf_print("\n"); + } else { + bt_shell_print("Read all remote features failed (HCI status 0x%02x)", + params->status); + } +} +#endif + #if defined(CONFIG_BT_CHANNEL_SOUNDING) void print_remote_cs_capabilities(struct bt_conn *conn, uint8_t status, @@ -1187,6 +1218,9 @@ static struct bt_conn_cb conn_callbacks = { #if defined(CONFIG_BT_SUBRATING) .subrate_changed = subrate_changed, #endif +#if defined(CONFIG_BT_LE_EXTENDED_FEAT_SET) + .read_all_remote_feat_complete = read_all_remote_feat_complete, +#endif #if defined(CONFIG_BT_CHANNEL_SOUNDING) .le_cs_read_remote_capabilities_complete = print_remote_cs_capabilities, .le_cs_read_remote_fae_table_complete = print_remote_cs_fae_table, @@ -3280,6 +3314,34 @@ static int cmd_subrate_request(const struct shell *sh, size_t argc, char *argv[] } #endif +#if defined(CONFIG_BT_LE_EXTENDED_FEAT_SET) +static int cmd_read_all_remote_features(const struct shell *sh, size_t argc, char *argv[]) +{ + int err = 0; + + if (default_conn == NULL) { + shell_error(sh, "Conn handle error, at least one connection is required."); + return -ENOEXEC; + } + + uint8_t pages_requested = shell_strtoul(argv[1], 10, &err); + + if (err != 0) { + shell_help(sh); + shell_error(sh, "Could not parse input for pages_requested"); + return SHELL_CMD_HELP_PRINTED; + } + + err = bt_conn_le_read_all_remote_features(default_conn, pages_requested); + if (err != 0) { + shell_error(sh, "bt_conn_le_read_all_remote_features returned error %d", err); + return -ENOEXEC; + } + + return 0; +} +#endif + #if defined(CONFIG_BT_CONN) #if defined(CONFIG_BT_CENTRAL) static int bt_do_connect_le(int *ercd, size_t argc, char *argv[]) @@ -5031,6 +5093,10 @@ SHELL_STATIC_SUBCMD_SET_CREATE(bt_cmds, " ", cmd_subrate_request, 6, 0), #endif +#if defined(CONFIG_BT_LE_EXTENDED_FEAT_SET) + SHELL_CMD_ARG(read-all-remote-features, NULL, "", + cmd_read_all_remote_features, 2, 0), +#endif #if defined(CONFIG_BT_BROADCASTER) SHELL_CMD_ARG(advertise, NULL, " [mode: discov, non_discov] " diff --git a/tests/bluetooth/shell/testcase.yaml b/tests/bluetooth/shell/testcase.yaml index 812aee24eeb3..673f13e481ca 100644 --- a/tests/bluetooth/shell/testcase.yaml +++ b/tests/bluetooth/shell/testcase.yaml @@ -34,6 +34,12 @@ tests: - CONFIG_BT_SUBRATING=y - CONFIG_BT_LL_SW_SPLIT=n build_only: true + bluetooth.shell.extended_feature_set: + extra_configs: + - CONFIG_BT_LE_MAX_LOCAL_SUPPORTED_FEATURE_PAGE=10 + - CONFIG_BT_LE_EXTENDED_FEAT_SET=y + - CONFIG_BT_LL_SW_SPLIT=n + build_only: true bluetooth.shell.channel_sounding: extra_configs: - CONFIG_BT_CHANNEL_SOUNDING=y From 534fd57c6f0ef128eb638366e9bc5d88c5c1e618 Mon Sep 17 00:00:00 2001 From: Aleksandr Khromykh Date: Thu, 26 Jun 2025 09:18:49 +0200 Subject: [PATCH 0624/2141] [nrf fromtree] bluetooth: mesh: remove unused functionality Commit removes unused host hci custom functionality that was moved to mesh by misinterpretation of it. Signed-off-by: Aleksandr Khromykh (cherry picked from commit b6a0f4e07266c06303b4057eae04421455ed0c9c) Signed-off-by: Sean Madigan --- subsys/bluetooth/host/shell/bt.c | 4 -- subsys/bluetooth/mesh/shell/CMakeLists.txt | 2 - subsys/bluetooth/mesh/shell/hci.c | 76 ---------------------- subsys/bluetooth/mesh/shell/hci.h | 7 -- 4 files changed, 89 deletions(-) delete mode 100644 subsys/bluetooth/mesh/shell/hci.c delete mode 100644 subsys/bluetooth/mesh/shell/hci.h diff --git a/subsys/bluetooth/host/shell/bt.c b/subsys/bluetooth/host/shell/bt.c index cc30ad7fbb19..05d841e37449 100644 --- a/subsys/bluetooth/host/shell/bt.c +++ b/subsys/bluetooth/host/shell/bt.c @@ -53,7 +53,6 @@ #include "controller/ll_sw/shell/ll.h" #endif /* CONFIG_BT_LL_SW_SPLIT */ #include "host/shell/bt.h" -#include "mesh/shell/hci.h" static bool no_settings_load; @@ -5242,9 +5241,6 @@ SHELL_STATIC_SUBCMD_SET_CREATE(bt_cmds, #endif #endif /* CONFIG_BT_SMP || CONFIG_BT_CLASSIC) */ #endif /* CONFIG_BT_CONN */ -#if defined(CONFIG_BT_HCI_MESH_EXT) - SHELL_CMD(mesh_adv, NULL, HELP_ONOFF, cmd_mesh_adv), -#endif /* CONFIG_BT_HCI_MESH_EXT */ #if defined(CONFIG_BT_LL_SW_SPLIT) SHELL_CMD(ll-addr, NULL, "", cmd_ll_addr_read), diff --git a/subsys/bluetooth/mesh/shell/CMakeLists.txt b/subsys/bluetooth/mesh/shell/CMakeLists.txt index 0a8e948fc436..e90e55428469 100644 --- a/subsys/bluetooth/mesh/shell/CMakeLists.txt +++ b/subsys/bluetooth/mesh/shell/CMakeLists.txt @@ -36,5 +36,3 @@ zephyr_library_sources_ifdef(CONFIG_BT_MESH_OD_PRIV_PROXY_CLI od_priv_proxy.c) zephyr_library_sources_ifdef(CONFIG_BT_MESH_SOL_PDU_RPL_CLI sol_pdu_rpl.c) zephyr_library_sources_ifdef(CONFIG_BT_MESH_SHELL_BRG_CFG_CLI brg_cfg.c) - -zephyr_library_sources_ifdef(CONFIG_BT_HCI_MESH_EXT hci.c) diff --git a/subsys/bluetooth/mesh/shell/hci.c b/subsys/bluetooth/mesh/shell/hci.c deleted file mode 100644 index 191a47c24115..000000000000 --- a/subsys/bluetooth/mesh/shell/hci.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2017-2018 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "../host/hci_core.h" - -#if defined(CONFIG_BT_HCI_MESH_EXT) -int cmd_mesh_adv(const struct shell *sh, size_t argc, char *argv[]) -{ - struct net_buf *buf; - int err; - - if (argc < 2) { - return -EINVAL; - } - - if (!strcmp(argv[1], "on")) { - struct bt_hci_cp_mesh_advertise *cp; - - buf = bt_hci_cmd_alloc(K_FOREVER); - if (!buf) { - return -ENOBUFS; - } - - net_buf_add_u8(buf, BT_HCI_OC_MESH_ADVERTISE); - - /* TODO: fetch and fill cmdline params */ - cp = net_buf_add(buf, sizeof(*cp)); - cp->adv_slot = 0U; - cp->own_addr_type = 0x01; - memset(&cp->random_addr, 0, sizeof(bt_addr_t)); - cp->ch_map = 0x07; - cp->tx_power = 0; - cp->min_tx_delay = 0U; - cp->max_tx_delay = 0x32; - cp->retx_count = 0x07; - cp->retx_interval = 0x00; - cp->scan_delay = 0x0a; - cp->scan_duration = sys_cpu_to_le16(0x0064); - cp->scan_filter = 0x00; - cp->data_len = 0U; - memset(cp->data, 0, sizeof(cp->data)); - } else if (!strcmp(argv[1], "off")) { - struct bt_hci_cp_mesh_advertise_cancel *cp; - - buf = bt_hci_cmd_alloc(K_FOREVER); - if (!buf) { - return -ENOBUFS; - } - - net_buf_add_u8(buf, BT_HCI_OC_MESH_ADVERTISE_CANCEL); - - cp = net_buf_add(buf, sizeof(*cp)); - cp->adv_slot = 0U; - } else { - return -EINVAL; - } - - err = bt_hci_cmd_send_sync(BT_HCI_OP_VS_MESH, buf, NULL); - - return err; -} -#endif /* CONFIG_BT_HCI_MESH_EXT */ diff --git a/subsys/bluetooth/mesh/shell/hci.h b/subsys/bluetooth/mesh/shell/hci.h deleted file mode 100644 index 81dcb0d892e7..000000000000 --- a/subsys/bluetooth/mesh/shell/hci.h +++ /dev/null @@ -1,7 +0,0 @@ -/* - * Copyright (c) 2017 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -int cmd_mesh_adv(const struct shell *sh, size_t argc, char *argv[]); From 009cc9b41f3790e4ae6d4bac05e6ccad95c19184 Mon Sep 17 00:00:00 2001 From: Mark Wang Date: Mon, 19 May 2025 10:25:52 +0800 Subject: [PATCH 0625/2141] [nrf fromtree] bluetooth: classic: add role changed callback add `role_changed` to `struct bt_conn_cb` to notify the HCI_Role_Change event to application. Signed-off-by: Mark Wang (cherry picked from commit 31fba83fb3665e747ad5b7f47c5cc8a9b686aa2d) Signed-off-by: Sean Madigan --- include/zephyr/bluetooth/conn.h | 11 +++++++++++ subsys/bluetooth/host/classic/br.c | 16 ++++++++-------- subsys/bluetooth/host/conn.c | 19 +++++++++++++++++++ subsys/bluetooth/host/conn_internal.h | 2 ++ 4 files changed, 40 insertions(+), 8 deletions(-) diff --git a/include/zephyr/bluetooth/conn.h b/include/zephyr/bluetooth/conn.h index bf8a31603b85..e74aeaa0fb5e 100644 --- a/include/zephyr/bluetooth/conn.h +++ b/include/zephyr/bluetooth/conn.h @@ -2033,6 +2033,17 @@ struct bt_conn_cb { #endif +#if defined(CONFIG_BT_CLASSIC) + /** @brief The role of the connection has changed. + * + * This callback notifies the application that the role switch procedure has completed. + * + * @param conn Connection object. + * @param status HCI status of role change event. + */ + void (*role_changed)(struct bt_conn *conn, uint8_t status); +#endif + /** @internal Internally used field for list handling */ sys_snode_t _node; }; diff --git a/subsys/bluetooth/host/classic/br.c b/subsys/bluetooth/host/classic/br.c index 994fcfbd22c7..f7cc28fb45f7 100644 --- a/subsys/bluetooth/host/classic/br.c +++ b/subsys/bluetooth/host/classic/br.c @@ -681,22 +681,22 @@ void bt_hci_role_change(struct net_buf *buf) LOG_DBG("status 0x%02x role %u addr %s", evt->status, evt->role, bt_addr_str(&evt->bdaddr)); - if (evt->status) { - return; - } - conn = bt_conn_lookup_addr_br(&evt->bdaddr); if (!conn) { LOG_ERR("Can't find conn for %s", bt_addr_str(&evt->bdaddr)); return; } - if (evt->role) { - conn->role = BT_CONN_ROLE_PERIPHERAL; - } else { - conn->role = BT_CONN_ROLE_CENTRAL; + if (evt->status == 0) { + if (evt->role == BT_HCI_ROLE_PERIPHERAL) { + conn->role = BT_CONN_ROLE_PERIPHERAL; + } else { + conn->role = BT_CONN_ROLE_CENTRAL; + } } + bt_conn_role_changed(conn, evt->status); + bt_conn_unref(conn); } diff --git a/subsys/bluetooth/host/conn.c b/subsys/bluetooth/host/conn.c index b8f63abf801e..abcc3d861ff9 100644 --- a/subsys/bluetooth/host/conn.c +++ b/subsys/bluetooth/host/conn.c @@ -1826,6 +1826,25 @@ void bt_conn_connected(struct bt_conn *conn) notify_connected(conn); } +#if defined(CONFIG_BT_CLASSIC) +void bt_conn_role_changed(struct bt_conn *conn, uint8_t status) +{ + struct bt_conn_cb *callback; + + SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { + if (callback->role_changed) { + callback->role_changed(conn, status); + } + } + + STRUCT_SECTION_FOREACH(bt_conn_cb, cb) { + if (cb->role_changed) { + cb->role_changed(conn, status); + } + } +} +#endif + static int conn_disconnect(struct bt_conn *conn, uint8_t reason) { int err; diff --git a/subsys/bluetooth/host/conn_internal.h b/subsys/bluetooth/host/conn_internal.h index 7d3cc1303942..495de9114462 100644 --- a/subsys/bluetooth/host/conn_internal.h +++ b/subsys/bluetooth/host/conn_internal.h @@ -490,6 +490,8 @@ void bt_conn_set_state(struct bt_conn *conn, bt_conn_state_t state); void bt_conn_connected(struct bt_conn *conn); +void bt_conn_role_changed(struct bt_conn *conn, uint8_t status); + int bt_conn_le_conn_update(struct bt_conn *conn, const struct bt_le_conn_param *param); From 0c9f335f663bab986df74ec88351c675e74d7aed Mon Sep 17 00:00:00 2001 From: Mark Wang Date: Mon, 16 Jun 2025 09:16:04 +0800 Subject: [PATCH 0626/2141] [nrf fromtree] bluetooth: classic: add role switch API add bt_conn_br_switch_role and bt_conn_br_set_role_switchable to control the role switch, add DEFAULT_ROLE_SWITCHABLE Kconfig to control the default role switch state. Signed-off-by: Mark Wang (cherry picked from commit e71b5122f79e44237379839cb0050e20d6ea1169) Signed-off-by: Sean Madigan --- include/zephyr/bluetooth/conn.h | 23 +++++ include/zephyr/bluetooth/hci_types.h | 38 ++++++++ subsys/bluetooth/host/classic/Kconfig | 6 ++ subsys/bluetooth/host/classic/br.c | 35 +++++++ subsys/bluetooth/host/classic/conn_br.c | 101 ++++++++++++++++++++ subsys/bluetooth/host/classic/shell/bredr.c | 77 +++++++++++++++ subsys/bluetooth/host/classic/shell/bredr.h | 20 ++++ subsys/bluetooth/host/shell/bt.c | 6 ++ 8 files changed, 306 insertions(+) create mode 100644 subsys/bluetooth/host/classic/shell/bredr.h diff --git a/include/zephyr/bluetooth/conn.h b/include/zephyr/bluetooth/conn.h index e74aeaa0fb5e..2da6b2c91d63 100644 --- a/include/zephyr/bluetooth/conn.h +++ b/include/zephyr/bluetooth/conn.h @@ -2746,6 +2746,29 @@ struct bt_conn *bt_conn_lookup_addr_br(const bt_addr_t *peer); */ const bt_addr_t *bt_conn_get_dst_br(const struct bt_conn *conn); +/** @brief Change the role of the conn. + * + * @param conn Connection object. + * @param role The role that want to switch as, the value is @ref BT_HCI_ROLE_CENTRAL and + * @ref BT_HCI_ROLE_PERIPHERAL from hci_types.h. + * + * @return Zero on success or (negative) error code on failure. + * @return -ENOBUFS HCI command buffer is not available. + * @return -EINVAL @p conn is not a valid @ref BT_CONN_TYPE_BR connection + */ +int bt_conn_br_switch_role(const struct bt_conn *conn, uint8_t role); + +/** @brief Enable/disable role switch of the connection by setting the connection's link policy. + * + * @param conn Connection object. + * @param enable Value enable/disable role switch of controller. + * + * @return Zero on success or (negative) error code on failure. + * @return -ENOBUFS HCI command buffer is not available. + * @return -EINVAL @p conn is not a valid @ref BT_CONN_TYPE_BR connection. + */ +int bt_conn_br_set_role_switch_enable(const struct bt_conn *conn, bool enable); + #ifdef __cplusplus } #endif diff --git a/include/zephyr/bluetooth/hci_types.h b/include/zephyr/bluetooth/hci_types.h index a20852712394..877617362c66 100644 --- a/include/zephyr/bluetooth/hci_types.h +++ b/include/zephyr/bluetooth/hci_types.h @@ -365,6 +365,7 @@ struct bt_hci_cmd_hdr { /* OpCode Group Fields */ #define BT_OGF_LINK_CTRL 0x01 +#define BT_OGF_LINK_POLICY 0x02 #define BT_OGF_BASEBAND 0x03 #define BT_OGF_INFO 0x04 #define BT_OGF_STATUS 0x05 @@ -560,6 +561,43 @@ struct bt_hci_cp_io_capability_neg_reply { uint8_t reason; } __packed; +#define BT_HCI_OP_SWITCH_ROLE BT_OP(BT_OGF_LINK_POLICY, 0x000b) +struct bt_hci_cp_switch_role { + bt_addr_t bdaddr; + uint8_t role; +} __packed; + +#define BT_HCI_LINK_POLICY_SETTINGS_ENABLE_ROLE_SWITCH BIT(0) +#define BT_HCI_LINK_POLICY_SETTINGS_ENABLE_HOLD_MODE BIT(1) +#define BT_HCI_LINK_POLICY_SETTINGS_ENABLE_SNIFF_SWITCH BIT(2) + +#define BT_HCI_OP_READ_LINK_POLICY_SETTINGS BT_OP(BT_OGF_LINK_POLICY, 0x000c) +struct bt_hci_cp_read_link_policy_settings { + uint16_t handle; +} __packed; +struct bt_hci_rp_read_link_policy_settings { + uint8_t status; + uint16_t handle; + uint16_t link_policy_settings; +} __packed; + +#define BT_HCI_OP_WRITE_LINK_POLICY_SETTINGS BT_OP(BT_OGF_LINK_POLICY, 0x000d) +struct bt_hci_cp_write_link_policy_settings { + uint16_t handle; + uint16_t link_policy_settings; +} __packed; + +#define BT_HCI_OP_READ_DEFAULT_LINK_POLICY_SETTINGS BT_OP(BT_OGF_LINK_POLICY, 0x000e) +struct bt_hci_rp_read_default_link_policy_settings { + uint8_t status; + uint16_t default_link_policy_settings; +} __packed; + +#define BT_HCI_OP_WRITE_DEFAULT_LINK_POLICY_SETTINGS BT_OP(BT_OGF_LINK_POLICY, 0x000f) +struct bt_hci_cp_write_default_link_policy_settings { + uint16_t default_link_policy_settings; +} __packed; + #define BT_HCI_OP_SET_EVENT_MASK BT_OP(BT_OGF_BASEBAND, 0x0001) /* 0x0c01 */ struct bt_hci_cp_set_event_mask { uint8_t events[8]; diff --git a/subsys/bluetooth/host/classic/Kconfig b/subsys/bluetooth/host/classic/Kconfig index 5d95a6375f56..beacfc316288 100644 --- a/subsys/bluetooth/host/classic/Kconfig +++ b/subsys/bluetooth/host/classic/Kconfig @@ -508,6 +508,12 @@ config BT_COD consult the following link: https://www.bluetooth.com/specifications/assigned-numbers +config BT_DEFAULT_ROLE_SWITCH_ENABLE + bool "Default Bluetooth Role Switch Enable/Disable State" + help + This option sets the controller's default link policy to + enable/disable the role switch. + endif # BT_CLASSIC endmenu diff --git a/subsys/bluetooth/host/classic/br.c b/subsys/bluetooth/host/classic/br.c index f7cc28fb45f7..f9265dc948ba 100644 --- a/subsys/bluetooth/host/classic/br.c +++ b/subsys/bluetooth/host/classic/br.c @@ -800,7 +800,10 @@ int bt_br_init(void) struct bt_hci_cp_write_ssp_mode *ssp_cp; struct bt_hci_cp_write_inquiry_mode *inq_cp; struct bt_hci_write_local_name *name_cp; + struct bt_hci_rp_read_default_link_policy_settings *rp; + struct net_buf *rsp; int err; + uint16_t default_link_policy_settings; /* Read extended local features */ if (BT_FEAT_EXT_FEATURES(bt_dev.features)) { @@ -906,6 +909,38 @@ int bt_br_init(void) } } + err = bt_hci_cmd_send_sync(BT_HCI_OP_READ_DEFAULT_LINK_POLICY_SETTINGS, NULL, &rsp); + if (err) { + return err; + } + + rp = (void *)rsp->data; + default_link_policy_settings = rp->default_link_policy_settings; + + bool should_enable = IS_ENABLED(CONFIG_BT_DEFAULT_ROLE_SWITCH_ENABLE); + bool is_enabled = (default_link_policy_settings & + BT_HCI_LINK_POLICY_SETTINGS_ENABLE_ROLE_SWITCH); + + /* Enable/Disable the default role switch */ + if (should_enable != is_enabled) { + struct bt_hci_cp_write_default_link_policy_settings *policy_cp; + + default_link_policy_settings ^= BT_HCI_LINK_POLICY_SETTINGS_ENABLE_ROLE_SWITCH; + + buf = bt_hci_cmd_alloc(K_FOREVER); + if (!buf) { + return -ENOBUFS; + } + + policy_cp = net_buf_add(buf, sizeof(*policy_cp)); + policy_cp->default_link_policy_settings = default_link_policy_settings; + + err = bt_hci_cmd_send_sync(BT_HCI_OP_WRITE_DEFAULT_LINK_POLICY_SETTINGS, buf, NULL); + if (err) { + return err; + } + } + return 0; } diff --git a/subsys/bluetooth/host/classic/conn_br.c b/subsys/bluetooth/host/classic/conn_br.c index 582d560c4df3..29cb2e2dfd48 100644 --- a/subsys/bluetooth/host/classic/conn_br.c +++ b/subsys/bluetooth/host/classic/conn_br.c @@ -170,3 +170,104 @@ void bt_br_acl_recv(struct bt_conn *conn, struct net_buf *buf, bool complete) net_buf_unref(buf); } + +int bt_conn_br_switch_role(const struct bt_conn *conn, uint8_t role) +{ + struct net_buf *buf; + struct bt_hci_cp_switch_role *cp; + + CHECKIF(conn == NULL) { + LOG_DBG("conn is NULL"); + return -EINVAL; + } + + if (!bt_conn_is_type(conn, BT_CONN_TYPE_BR)) { + LOG_DBG("Invalid connection type: %u for %p", conn->type, conn); + return -EINVAL; + } + + buf = bt_hci_cmd_alloc(K_FOREVER); + if (!buf) { + return -ENOBUFS; + } + + cp = net_buf_add(buf, sizeof(*cp)); + bt_addr_copy(&cp->bdaddr, &conn->br.dst); + cp->role = role; + + return bt_hci_cmd_send_sync(BT_HCI_OP_SWITCH_ROLE, buf, NULL); +} + +static int bt_conn_br_read_link_policy_settings(const struct bt_conn *conn, + uint16_t *link_policy_settings) +{ + int err; + struct net_buf *buf; + struct bt_hci_cp_read_link_policy_settings *cp; + struct bt_hci_rp_read_link_policy_settings *rp; + struct net_buf *rsp; + + buf = bt_hci_cmd_alloc(K_FOREVER); + if (!buf) { + return -ENOBUFS; + } + + cp = net_buf_add(buf, sizeof(*cp)); + cp->handle = sys_cpu_to_le16(conn->handle); + + err = bt_hci_cmd_send_sync(BT_HCI_OP_READ_LINK_POLICY_SETTINGS, buf, &rsp); + if (!err) { + rp = (void *)rsp->data; + *link_policy_settings = rp->link_policy_settings; + } + + return err; +} + +static int bt_conn_br_write_link_policy_settings(const struct bt_conn *conn, + uint16_t link_policy_settings) +{ + struct net_buf *buf; + struct bt_hci_cp_write_link_policy_settings *cp; + + buf = bt_hci_cmd_alloc(K_FOREVER); + if (!buf) { + return -ENOBUFS; + } + + cp = net_buf_add(buf, sizeof(*cp)); + cp->handle = sys_cpu_to_le16(conn->handle); + cp->link_policy_settings = link_policy_settings; + + return bt_hci_cmd_send_sync(BT_HCI_OP_WRITE_LINK_POLICY_SETTINGS, buf, NULL); +} + +int bt_conn_br_set_role_switch_enable(const struct bt_conn *conn, bool enable) +{ + int err; + uint16_t link_policy_settings; + bool is_enabled; + + CHECKIF(conn == NULL) { + LOG_DBG("conn is NULL"); + return -EINVAL; + } + + if (!bt_conn_is_type(conn, BT_CONN_TYPE_BR)) { + LOG_DBG("Invalid connection type: %u for %p", conn->type, conn); + return -EINVAL; + } + + err = bt_conn_br_read_link_policy_settings(conn, &link_policy_settings); + if (err) { + return err; + } + + is_enabled = (link_policy_settings & BT_HCI_LINK_POLICY_SETTINGS_ENABLE_ROLE_SWITCH); + if (enable == is_enabled) { + return 0; + } + + link_policy_settings ^= BT_HCI_LINK_POLICY_SETTINGS_ENABLE_ROLE_SWITCH; + return bt_conn_br_write_link_policy_settings(conn, link_policy_settings); +} diff --git a/subsys/bluetooth/host/classic/shell/bredr.c b/subsys/bluetooth/host/classic/shell/bredr.c index 8770d3acbd2e..d5c1d09a082d 100644 --- a/subsys/bluetooth/host/classic/shell/bredr.c +++ b/subsys/bluetooth/host/classic/shell/bredr.c @@ -1207,6 +1207,80 @@ static int cmd_info(const struct shell *sh, size_t argc, char *argv[]) return err; } +void role_changed(struct bt_conn *conn, uint8_t status) +{ + struct bt_conn_info info; + int err; + + bt_shell_print("Role changed (HCI status 0x%02x)", status); + + err = bt_conn_get_info(conn, &info); + if (err) { + bt_shell_print("Failed to get info"); + return; + } + + bt_shell_print("Current role is: %s", get_conn_role_str(info.role)); +} + +static int cmd_switch_role(const struct shell *sh, size_t argc, char *argv[]) +{ + int err; + const char *action; + uint8_t role; + + if (!default_conn) { + shell_print(sh, "Not connected"); + return -ENOEXEC; + } + + action = argv[1]; + + if (!strcmp(action, "central")) { + role = BT_HCI_ROLE_CENTRAL; + } else if (!strcmp(action, "peripheral")) { + role = BT_HCI_ROLE_PERIPHERAL; + } else { + shell_help(sh); + return SHELL_CMD_HELP_PRINTED; + } + + err = bt_conn_br_switch_role(default_conn, role); + + if (err) { + shell_error(sh, "fail to change role (err %d)", err); + } + + return 0; +} + +static int cmd_set_role_switchable(const struct shell *sh, size_t argc, char *argv[]) +{ + int err = 0; + bool enable; + + if (!default_conn) { + shell_print(sh, "Not connected"); + return -ENOEXEC; + } + + enable = shell_strtobool(argv[1], 10, &err); + if (err) { + shell_help(sh); + return SHELL_CMD_HELP_PRINTED; + } + + err = bt_conn_br_set_role_switch_enable(default_conn, enable); + + if (err) { + shell_error(sh, "fail to set role switchable (err %d)", err); + } else { + shell_print(sh, "success"); + } + + return 0; +} + static int cmd_default_handler(const struct shell *sh, size_t argc, char **argv) { if (argc == 1) { @@ -1270,6 +1344,9 @@ SHELL_STATIC_SUBCMD_SET_CREATE(br_cmds, SHELL_CMD_ARG(oob, NULL, NULL, cmd_oob, 1, 0), SHELL_CMD_ARG(pscan, NULL, "", cmd_connectable, 2, 0), SHELL_CMD_ARG(sdp-find, NULL, "", cmd_sdp_find_record, 2, 0), + SHELL_CMD_ARG(switch-role, NULL, "", cmd_switch_role, 2, 0), + SHELL_CMD_ARG(set-role-switchable, NULL, "", + cmd_set_role_switchable, 2, 0), SHELL_SUBCMD_SET_END ); diff --git a/subsys/bluetooth/host/classic/shell/bredr.h b/subsys/bluetooth/host/classic/shell/bredr.h new file mode 100644 index 000000000000..1cc3396c63f1 --- /dev/null +++ b/subsys/bluetooth/host/classic/shell/bredr.h @@ -0,0 +1,20 @@ +/** @file + * @brief Bluetooth shell functions + * + * This is not to be included by the application. + */ + +/* + * Copyright 2025 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef __BREDR_H +#define __BREDR_H +#include +#include + +void role_changed(struct bt_conn *conn, uint8_t status); + +#endif /* __BREDR_H */ diff --git a/subsys/bluetooth/host/shell/bt.c b/subsys/bluetooth/host/shell/bt.c index 05d841e37449..611ce0afcec4 100644 --- a/subsys/bluetooth/host/shell/bt.c +++ b/subsys/bluetooth/host/shell/bt.c @@ -53,6 +53,9 @@ #include "controller/ll_sw/shell/ll.h" #endif /* CONFIG_BT_LL_SW_SPLIT */ #include "host/shell/bt.h" +#if defined(CONFIG_BT_CLASSIC) +#include "host/classic/shell/bredr.h" +#endif static bool no_settings_load; @@ -1226,6 +1229,9 @@ static struct bt_conn_cb conn_callbacks = { .le_cs_config_complete = le_cs_config_created, .le_cs_config_removed = le_cs_config_removed, #endif +#if defined(CONFIG_BT_CLASSIC) + .role_changed = role_changed, +#endif }; #endif /* CONFIG_BT_CONN */ From 307315be45f6ccea17485944fb15c5319ba26445 Mon Sep 17 00:00:00 2001 From: Yago Fontoura do Rosario Date: Mon, 28 Jul 2025 15:19:45 +0200 Subject: [PATCH 0627/2141] [nrf fromtree] Bluetooth: Audio: Conn callbacks registration with BT_CONN_CB_DEFINE This commit registers the connection callbacks using BT_CONN_CB_DEFINE, which ensures they are set up at link time rather than runtime. Signed-off-by: Yago Fontoura do Rosario (cherry picked from commit b1eaf02ec186993ea09c98e36f13ec09e131e58f) Signed-off-by: Sean Madigan --- subsys/bluetooth/audio/bap_unicast_client.c | 8 +------- subsys/bluetooth/audio/csip_set_member.c | 3 +-- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/subsys/bluetooth/audio/bap_unicast_client.c b/subsys/bluetooth/audio/bap_unicast_client.c index 1f081ee805b1..3db8e8a7b9c0 100644 --- a/subsys/bluetooth/audio/bap_unicast_client.c +++ b/subsys/bluetooth/audio/bap_unicast_client.c @@ -4456,14 +4456,13 @@ static void unicast_client_disconnected(struct bt_conn *conn, uint8_t reason) unicast_client_ep_reset(conn, reason); } -static struct bt_conn_cb conn_cbs = { +BT_CONN_CB_DEFINE(conn_cbs) = { .disconnected = unicast_client_disconnected, }; int bt_bap_unicast_client_discover(struct bt_conn *conn, enum bt_audio_dir dir) { struct unicast_client *client; - static bool conn_cb_registered; uint8_t role; int err; @@ -4496,11 +4495,6 @@ int bt_bap_unicast_client_discover(struct bt_conn *conn, enum bt_audio_dir dir) client->disc_params.start_handle = BT_ATT_FIRST_ATTRIBUTE_HANDLE; client->disc_params.end_handle = BT_ATT_LAST_ATTRIBUTE_HANDLE; - if (!conn_cb_registered) { - bt_conn_cb_register(&conn_cbs); - conn_cb_registered = true; - } - err = bt_gatt_discover(conn, &client->disc_params); if (err != 0) { atomic_clear_bit(client->flags, UNICAST_CLIENT_FLAG_BUSY); diff --git a/subsys/bluetooth/audio/csip_set_member.c b/subsys/bluetooth/audio/csip_set_member.c index d41230a16683..c38929846b4a 100644 --- a/subsys/bluetooth/audio/csip_set_member.c +++ b/subsys/bluetooth/audio/csip_set_member.c @@ -647,7 +647,7 @@ static void csip_bond_deleted(uint8_t id, const bt_addr_le_t *peer) } } -static struct bt_conn_cb conn_callbacks = { +BT_CONN_CB_DEFINE(conn_callbacks) = { .disconnected = csip_disconnected, .security_changed = csip_security_changed, }; @@ -926,7 +926,6 @@ int bt_csip_set_member_register(const struct bt_csip_set_member_register_param * for (size_t i = 0U; i < ARRAY_SIZE(svc_insts); i++) { k_mutex_init(&svc_insts[i].mutex); } - bt_conn_cb_register(&conn_callbacks); bt_conn_auth_info_cb_register(&auth_callbacks); first_register = true; } From 46f3f280968375c9e7340b4b28b80a10d98f1f3b Mon Sep 17 00:00:00 2001 From: Yago Fontoura do Rosario Date: Mon, 28 Jul 2025 15:20:39 +0200 Subject: [PATCH 0628/2141] [nrf fromtree] Bluetooth: Host: Conn callbacks registration with BT_CONN_CB_DEFINE This commit registers the connection callbacks using BT_CONN_CB_DEFINE, which ensures they are set up at link time rather than runtime. Signed-off-by: Yago Fontoura do Rosario (cherry picked from commit e0d22a308e74036e6b5811095f51df3e3d35eda1) Signed-off-by: Sean Madigan --- subsys/bluetooth/host/gatt.c | 22 +++++++++++----------- subsys/bluetooth/host/shell/bt.c | 6 +----- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/subsys/bluetooth/host/gatt.c b/subsys/bluetooth/host/gatt.c index be642fec9fe7..12ec91c78e44 100644 --- a/subsys/bluetooth/host/gatt.c +++ b/subsys/bluetooth/host/gatt.c @@ -1511,6 +1511,17 @@ static void gatt_store_ccc_cf(uint8_t id, const bt_addr_le_t *peer_addr) } } +#if defined(CONFIG_BT_SETTINGS) && defined(CONFIG_BT_SMP) +BT_CONN_CB_DEFINE(gatt_conn_cb) = { + /* Also update the address of CCC or CF writes that happened before the + * identity resolution. Note that to increase security in the future, we + * might want to explicitly not do this and treat a bonded device as a + * brand-new peer. + */ + .identity_resolved = bt_gatt_identity_resolved, +}; +#endif /* CONFIG_BT_SETTINGS && CONFIG_BT_SMP */ + static void bt_gatt_service_init(void) { if (atomic_test_and_set_bit(gatt_flags, GATT_SERVICE_INITIALIZED)) { @@ -1567,17 +1578,6 @@ void bt_gatt_init(void) * and CF storage on pairing complete. */ bt_conn_auth_info_cb_register(&gatt_conn_auth_info_cb); - - static struct bt_conn_cb gatt_conn_cb = { - .identity_resolved = bt_gatt_identity_resolved, - }; - - /* Also update the address of CCC or CF writes that happened before the - * identity resolution. Note that to increase security in the future, we - * might want to explicitly not do this and treat a bonded device as a - * brand-new peer. - */ - bt_conn_cb_register(&gatt_conn_cb); #endif /* CONFIG_BT_SETTINGS && CONFIG_BT_SMP */ } diff --git a/subsys/bluetooth/host/shell/bt.c b/subsys/bluetooth/host/shell/bt.c index 611ce0afcec4..0946939f22cf 100644 --- a/subsys/bluetooth/host/shell/bt.c +++ b/subsys/bluetooth/host/shell/bt.c @@ -1191,7 +1191,7 @@ static void le_cs_config_removed(struct bt_conn *conn, uint8_t config_id) } #endif -static struct bt_conn_cb conn_callbacks = { +BT_CONN_CB_DEFINE(conn_callbacks) = { .connected = connected, .disconnected = disconnected, .le_param_req = le_param_req, @@ -1374,10 +1374,6 @@ static void bt_ready(int err) #if defined(CONFIG_BT_CONN) default_conn = NULL; - - /* Unregister to avoid register repeatedly */ - bt_conn_cb_unregister(&conn_callbacks); - bt_conn_cb_register(&conn_callbacks); #endif /* CONFIG_BT_CONN */ #if defined(CONFIG_BT_PER_ADV_SYNC) From 208b1b9dca7bb336cf5a20496477ac5cf3dd6e9f Mon Sep 17 00:00:00 2001 From: Yago Fontoura do Rosario Date: Mon, 28 Jul 2025 15:35:57 +0200 Subject: [PATCH 0629/2141] [nrf fromtree] Bluetooth: Add configuration to control the dynamic connection callbacks This commit allows to the user to control the use or not of dynamic connection callbacks. The stack is not using the dynamic connection callbacks so they are only needed if the applications want to use it. Setting it to true for backwards compatibility. With dynamic connection callbacks FLASH: 176600 B 512 KB 33.68% RAM: 27428 B 64 KB 41.85% IDT_LIST: 0 GB 32 KB 0.00% Without dynamic connection callbacks FLASH: 176376 B 512 KB 33.64% RAM: 27428 B 64 KB 41.85% IDT_LIST: 0 GB 32 KB 0.00% Signed-off-by: Yago Fontoura do Rosario (cherry picked from commit ca06a1d80da97c897c2ee7e786181ab9b7d6e830) Signed-off-by: Sean Madigan --- .../central_hr/overlay-static_callbacks.conf | 2 + samples/bluetooth/central_hr/prj_minimal.conf | 1 + .../overlay-static_callbacks.conf | 2 + .../bluetooth/peripheral_hr/prj_minimal.conf | 1 + subsys/bluetooth/Kconfig | 10 + subsys/bluetooth/host/conn.c | 258 +++++++++++------- tests/bluetooth/gatt/testcase.yaml | 14 + tests/bluetooth/shell/testcase.yaml | 6 + ...ntral_hr_peripheral_hr_static_callbacks.sh | 24 ++ tests/bsim/bluetooth/samples/compile.sh | 9 + 10 files changed, 223 insertions(+), 104 deletions(-) create mode 100644 samples/bluetooth/central_hr/overlay-static_callbacks.conf create mode 100644 samples/bluetooth/peripheral_hr/overlay-static_callbacks.conf create mode 100755 tests/bsim/bluetooth/samples/central_hr_peripheral_hr/tests_scripts/central_hr_peripheral_hr_static_callbacks.sh diff --git a/samples/bluetooth/central_hr/overlay-static_callbacks.conf b/samples/bluetooth/central_hr/overlay-static_callbacks.conf new file mode 100644 index 000000000000..528958ad3a92 --- /dev/null +++ b/samples/bluetooth/central_hr/overlay-static_callbacks.conf @@ -0,0 +1,2 @@ +# Disable connection dynamic callbacks +CONFIG_BT_CONN_DYNAMIC_CALLBACKS=n diff --git a/samples/bluetooth/central_hr/prj_minimal.conf b/samples/bluetooth/central_hr/prj_minimal.conf index 3ea96d693c71..983b5a934d71 100644 --- a/samples/bluetooth/central_hr/prj_minimal.conf +++ b/samples/bluetooth/central_hr/prj_minimal.conf @@ -87,6 +87,7 @@ CONFIG_BT_GATT_SERVICE_CHANGED=n CONFIG_BT_GAP_PERIPHERAL_PREF_PARAMS=n CONFIG_BT_SETTINGS_CCC_LAZY_LOADING=y CONFIG_BT_HCI_VS=n +CONFIG_BT_CONN_DYNAMIC_CALLBACKS=n # Disable Bluetooth controller features not needed CONFIG_BT_CTLR_PRIVACY=n diff --git a/samples/bluetooth/peripheral_hr/overlay-static_callbacks.conf b/samples/bluetooth/peripheral_hr/overlay-static_callbacks.conf new file mode 100644 index 000000000000..528958ad3a92 --- /dev/null +++ b/samples/bluetooth/peripheral_hr/overlay-static_callbacks.conf @@ -0,0 +1,2 @@ +# Disable connection dynamic callbacks +CONFIG_BT_CONN_DYNAMIC_CALLBACKS=n diff --git a/samples/bluetooth/peripheral_hr/prj_minimal.conf b/samples/bluetooth/peripheral_hr/prj_minimal.conf index 8f9c2b85cb14..76cac20ec5ef 100644 --- a/samples/bluetooth/peripheral_hr/prj_minimal.conf +++ b/samples/bluetooth/peripheral_hr/prj_minimal.conf @@ -93,6 +93,7 @@ CONFIG_BT_GATT_SERVICE_CHANGED=n CONFIG_BT_GAP_PERIPHERAL_PREF_PARAMS=n CONFIG_BT_SETTINGS_CCC_LAZY_LOADING=y CONFIG_BT_HCI_VS=n +CONFIG_BT_CONN_DYNAMIC_CALLBACKS=n # Disable Bluetooth controller features not needed CONFIG_BT_CTLR_PRIVACY=n diff --git a/subsys/bluetooth/Kconfig b/subsys/bluetooth/Kconfig index c98c7a5ff538..26efaf7832d7 100644 --- a/subsys/bluetooth/Kconfig +++ b/subsys/bluetooth/Kconfig @@ -131,6 +131,16 @@ config BT_LE_EXTENDED_FEAT_SET Enable support for the LL Extended Feature Set feature. if BT_CONN +config BT_CONN_DYNAMIC_CALLBACKS + bool "Dynamic connection callbacks" + default y + help + Enable support for dynamic connection callbacks. This links in + bt_conn_cb_register(). Disabling this config is safe. It will make + uses of this and associated APIs fail to link. Note: Static registration + through BT_CONN_CB_DEFINE() is always available and does not depend on + this config. + config BT_HCI_ACL_FLOW_CONTROL bool "Controller to Host ACL flow control support" # Enable if building a Host-only build diff --git a/subsys/bluetooth/host/conn.c b/subsys/bluetooth/host/conn.c index abcc3d861ff9..3a2adf814b9f 100644 --- a/subsys/bluetooth/host/conn.c +++ b/subsys/bluetooth/host/conn.c @@ -1650,11 +1650,13 @@ static void tx_complete_work(struct k_work *work) static void notify_recycled_conn_slot(void) { #if defined(CONFIG_BT_CONN) - struct bt_conn_cb *callback; + if (IS_ENABLED(CONFIG_BT_CONN_DYNAMIC_CALLBACKS)) { + struct bt_conn_cb *callback; - SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { - if (callback->recycled) { - callback->recycled(); + SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { + if (callback->recycled) { + callback->recycled(); + } } } @@ -1829,11 +1831,13 @@ void bt_conn_connected(struct bt_conn *conn) #if defined(CONFIG_BT_CLASSIC) void bt_conn_role_changed(struct bt_conn *conn, uint8_t status) { - struct bt_conn_cb *callback; + if (IS_ENABLED(CONFIG_BT_CONN_DYNAMIC_CALLBACKS)) { + struct bt_conn_cb *callback; - SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { - if (callback->role_changed) { - callback->role_changed(conn, status); + SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { + if (callback->role_changed) { + callback->role_changed(conn, status); + } } } @@ -1908,12 +1912,14 @@ int bt_conn_disconnect(struct bt_conn *conn, uint8_t reason) static void notify_connected(struct bt_conn *conn) { - struct bt_conn_cb *callback; + if (IS_ENABLED(CONFIG_BT_CONN_DYNAMIC_CALLBACKS)) { + struct bt_conn_cb *callback; - SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { + SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { - if (callback->connected) { - callback->connected(conn, conn->err); + if (callback->connected) { + callback->connected(conn, conn->err); + } } } @@ -1926,11 +1932,13 @@ static void notify_connected(struct bt_conn *conn) static void notify_disconnected(struct bt_conn *conn) { - struct bt_conn_cb *callback; + if (IS_ENABLED(CONFIG_BT_CONN_DYNAMIC_CALLBACKS)) { + struct bt_conn_cb *callback; - SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { - if (callback->disconnected) { - callback->disconnected(conn, conn->err); + SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { + if (callback->disconnected) { + callback->disconnected(conn, conn->err); + } } } @@ -1953,11 +1961,13 @@ void notify_remote_info(struct bt_conn *conn) return; } - struct bt_conn_cb *callback; + if (IS_ENABLED(CONFIG_BT_CONN_DYNAMIC_CALLBACKS)) { + struct bt_conn_cb *callback; - SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { - if (callback->remote_info_available) { - callback->remote_info_available(conn, &remote_info); + SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { + if (callback->remote_info_available) { + callback->remote_info_available(conn, &remote_info); + } } } @@ -1982,13 +1992,14 @@ void notify_le_param_updated(struct bt_conn *conn) atomic_clear_bit(conn->flags, BT_CONN_PERIPHERAL_PARAM_SET); } - struct bt_conn_cb *callback; + if (IS_ENABLED(CONFIG_BT_CONN_DYNAMIC_CALLBACKS)) { + struct bt_conn_cb *callback; - SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { - if (callback->le_param_updated) { - callback->le_param_updated(conn, conn->le.interval, - conn->le.latency, - conn->le.timeout); + SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { + if (callback->le_param_updated) { + callback->le_param_updated(conn, conn->le.interval, + conn->le.latency, conn->le.timeout); + } } } @@ -2004,11 +2015,13 @@ void notify_le_param_updated(struct bt_conn *conn) #if defined(CONFIG_BT_USER_DATA_LEN_UPDATE) void notify_le_data_len_updated(struct bt_conn *conn) { - struct bt_conn_cb *callback; + if (IS_ENABLED(CONFIG_BT_CONN_DYNAMIC_CALLBACKS)) { + struct bt_conn_cb *callback; - SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { - if (callback->le_data_len_updated) { - callback->le_data_len_updated(conn, &conn->le.data_len); + SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { + if (callback->le_data_len_updated) { + callback->le_data_len_updated(conn, &conn->le.data_len); + } } } @@ -2023,11 +2036,13 @@ void notify_le_data_len_updated(struct bt_conn *conn) #if defined(CONFIG_BT_USER_PHY_UPDATE) void notify_le_phy_updated(struct bt_conn *conn) { - struct bt_conn_cb *callback; + if (IS_ENABLED(CONFIG_BT_CONN_DYNAMIC_CALLBACKS)) { + struct bt_conn_cb *callback; - SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { - if (callback->le_phy_updated) { - callback->le_phy_updated(conn, &conn->le.phy); + SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { + if (callback->le_phy_updated) { + callback->le_phy_updated(conn, &conn->le.phy); + } } } @@ -2045,22 +2060,24 @@ bool le_param_req(struct bt_conn *conn, struct bt_le_conn_param *param) return false; } - struct bt_conn_cb *callback; + if (IS_ENABLED(CONFIG_BT_CONN_DYNAMIC_CALLBACKS)) { + struct bt_conn_cb *callback; - SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { - if (!callback->le_param_req) { - continue; - } + SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { + if (!callback->le_param_req) { + continue; + } - if (!callback->le_param_req(conn, param)) { - return false; - } + if (!callback->le_param_req(conn, param)) { + return false; + } - /* The callback may modify the parameters so we need to - * double-check that it returned valid parameters. - */ - if (!bt_le_conn_params_valid(param)) { - return false; + /* The callback may modify the parameters so we need to + * double-check that it returned valid parameters. + */ + if (!bt_le_conn_params_valid(param)) { + return false; + } } } @@ -2447,12 +2464,13 @@ void bt_conn_identity_resolved(struct bt_conn *conn) rpa = &conn->le.init_addr; } + if (IS_ENABLED(CONFIG_BT_CONN_DYNAMIC_CALLBACKS)) { + struct bt_conn_cb *callback; - struct bt_conn_cb *callback; - - SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { - if (callback->identity_resolved) { - callback->identity_resolved(conn, rpa, &conn->le.dst); + SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { + if (callback->identity_resolved) { + callback->identity_resolved(conn, rpa, &conn->le.dst); + } } } @@ -2566,11 +2584,13 @@ void bt_conn_security_changed(struct bt_conn *conn, uint8_t hci_err, bt_iso_security_changed(conn, hci_err); } - struct bt_conn_cb *callback; + if (IS_ENABLED(CONFIG_BT_CONN_DYNAMIC_CALLBACKS)) { + struct bt_conn_cb *callback; - SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { - if (callback->security_changed) { - callback->security_changed(conn, conn->sec_level, err); + SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { + if (callback->security_changed) { + callback->security_changed(conn, conn->sec_level, err); + } } } @@ -2668,6 +2688,8 @@ bt_security_t bt_conn_get_security(const struct bt_conn *conn) } #endif /* CONFIG_BT_SMP */ +#if defined(CONFIG_BT_CONN_DYNAMIC_CALLBACKS) + int bt_conn_cb_register(struct bt_conn_cb *cb) { if (sys_slist_find(&conn_cbs, &cb->_node, NULL)) { @@ -2692,6 +2714,8 @@ int bt_conn_cb_unregister(struct bt_conn_cb *cb) return 0; } +#endif /* CONFIG_BT_CONN_DYNAMIC_CALLBACKS */ + bool bt_conn_exists_le(uint8_t id, const bt_addr_le_t *peer) { struct bt_conn *conn = bt_conn_lookup_addr_le(id, peer); @@ -3003,11 +3027,13 @@ static int bt_conn_get_tx_power_level(struct bt_conn *conn, uint8_t type, void notify_tx_power_report(struct bt_conn *conn, struct bt_conn_le_tx_power_report report) { - struct bt_conn_cb *callback; + if (IS_ENABLED(CONFIG_BT_CONN_DYNAMIC_CALLBACKS)) { + struct bt_conn_cb *callback; - SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { - if (callback->tx_power_report) { - callback->tx_power_report(conn, &report); + SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { + if (callback->tx_power_report) { + callback->tx_power_report(conn, &report); + } } } @@ -3148,11 +3174,13 @@ int bt_conn_le_get_tx_power_level(struct bt_conn *conn, void notify_path_loss_threshold_report(struct bt_conn *conn, struct bt_conn_le_path_loss_threshold_report report) { - struct bt_conn_cb *callback; + if (IS_ENABLED(CONFIG_BT_CONN_DYNAMIC_CALLBACKS)) { + struct bt_conn_cb *callback; - SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { - if (callback->path_loss_threshold_report) { - callback->path_loss_threshold_report(conn, &report); + SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { + if (callback->path_loss_threshold_report) { + callback->path_loss_threshold_report(conn, &report); + } } } @@ -3219,11 +3247,13 @@ int bt_conn_le_set_path_loss_mon_enable(struct bt_conn *conn, bool reporting_ena void notify_subrate_change(struct bt_conn *conn, const struct bt_conn_le_subrate_changed params) { - struct bt_conn_cb *callback; + if (IS_ENABLED(CONFIG_BT_CONN_DYNAMIC_CALLBACKS)) { + struct bt_conn_cb *callback; - SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { - if (callback->subrate_changed) { - callback->subrate_changed(conn, ¶ms); + SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { + if (callback->subrate_changed) { + callback->subrate_changed(conn, ¶ms); + } } } @@ -3374,11 +3404,14 @@ int bt_conn_le_read_all_remote_features(struct bt_conn *conn, uint8_t pages_requ void notify_remote_cs_capabilities(struct bt_conn *conn, uint8_t status, struct bt_conn_le_cs_capabilities *params) { - struct bt_conn_cb *callback; + if (IS_ENABLED(CONFIG_BT_CONN_DYNAMIC_CALLBACKS)) { + struct bt_conn_cb *callback; - SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { - if (callback->le_cs_read_remote_capabilities_complete) { - callback->le_cs_read_remote_capabilities_complete(conn, status, params); + SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { + if (callback->le_cs_read_remote_capabilities_complete) { + callback->le_cs_read_remote_capabilities_complete(conn, status, + params); + } } } @@ -3392,11 +3425,14 @@ void notify_remote_cs_capabilities(struct bt_conn *conn, uint8_t status, void notify_remote_cs_fae_table(struct bt_conn *conn, uint8_t status, struct bt_conn_le_cs_fae_table *params) { - struct bt_conn_cb *callback; + if (IS_ENABLED(CONFIG_BT_CONN_DYNAMIC_CALLBACKS)) { + struct bt_conn_cb *callback; - SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { - if (callback->le_cs_read_remote_fae_table_complete) { - callback->le_cs_read_remote_fae_table_complete(conn, status, params); + SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { + if (callback->le_cs_read_remote_fae_table_complete) { + callback->le_cs_read_remote_fae_table_complete(conn, status, + params); + } } } @@ -3410,11 +3446,13 @@ void notify_remote_cs_fae_table(struct bt_conn *conn, uint8_t status, void notify_cs_config_created(struct bt_conn *conn, uint8_t status, struct bt_conn_le_cs_config *params) { - struct bt_conn_cb *callback; + if (IS_ENABLED(CONFIG_BT_CONN_DYNAMIC_CALLBACKS)) { + struct bt_conn_cb *callback; - SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { - if (callback->le_cs_config_complete) { - callback->le_cs_config_complete(conn, status, params); + SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { + if (callback->le_cs_config_complete) { + callback->le_cs_config_complete(conn, status, params); + } } } @@ -3427,11 +3465,13 @@ void notify_cs_config_created(struct bt_conn *conn, uint8_t status, void notify_cs_config_removed(struct bt_conn *conn, uint8_t config_id) { - struct bt_conn_cb *callback; + if (IS_ENABLED(CONFIG_BT_CONN_DYNAMIC_CALLBACKS)) { + struct bt_conn_cb *callback; - SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { - if (callback->le_cs_config_removed) { - callback->le_cs_config_removed(conn, config_id); + SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { + if (callback->le_cs_config_removed) { + callback->le_cs_config_removed(conn, config_id); + } } } @@ -3444,11 +3484,13 @@ void notify_cs_config_removed(struct bt_conn *conn, uint8_t config_id) void notify_cs_security_enable_available(struct bt_conn *conn, uint8_t status) { - struct bt_conn_cb *callback; + if (IS_ENABLED(CONFIG_BT_CONN_DYNAMIC_CALLBACKS)) { + struct bt_conn_cb *callback; - SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { - if (callback->le_cs_security_enable_complete) { - callback->le_cs_security_enable_complete(conn, status); + SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { + if (callback->le_cs_security_enable_complete) { + callback->le_cs_security_enable_complete(conn, status); + } } } @@ -3462,11 +3504,13 @@ void notify_cs_security_enable_available(struct bt_conn *conn, uint8_t status) void notify_cs_procedure_enable_available(struct bt_conn *conn, uint8_t status, struct bt_conn_le_cs_procedure_enable_complete *params) { - struct bt_conn_cb *callback; + if (IS_ENABLED(CONFIG_BT_CONN_DYNAMIC_CALLBACKS)) { + struct bt_conn_cb *callback; - SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { - if (callback->le_cs_procedure_enable_complete) { - callback->le_cs_procedure_enable_complete(conn, status, params); + SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { + if (callback->le_cs_procedure_enable_complete) { + callback->le_cs_procedure_enable_complete(conn, status, params); + } } } @@ -3479,11 +3523,13 @@ void notify_cs_procedure_enable_available(struct bt_conn *conn, uint8_t status, void notify_cs_subevent_result(struct bt_conn *conn, struct bt_conn_le_cs_subevent_result *result) { - struct bt_conn_cb *callback; + if (IS_ENABLED(CONFIG_BT_CONN_DYNAMIC_CALLBACKS)) { + struct bt_conn_cb *callback; - SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { - if (callback->le_cs_subevent_data_available) { - callback->le_cs_subevent_data_available(conn, result); + SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { + if (callback->le_cs_subevent_data_available) { + callback->le_cs_subevent_data_available(conn, result); + } } } @@ -4265,11 +4311,13 @@ void bt_hci_le_df_connection_iq_report_common(uint8_t event, struct net_buf *buf return; } - struct bt_conn_cb *callback; + if (IS_ENABLED(CONFIG_BT_CONN_DYNAMIC_CALLBACKS)) { + struct bt_conn_cb *callback; - SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { - if (callback->cte_report_cb) { - callback->cte_report_cb(conn, &iq_report); + SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { + if (callback->cte_report_cb) { + callback->cte_report_cb(conn, &iq_report); + } } } @@ -4309,11 +4357,13 @@ void bt_hci_le_df_cte_req_failed(struct net_buf *buf) return; } - struct bt_conn_cb *callback; + if (IS_ENABLED(CONFIG_BT_CONN_DYNAMIC_CALLBACKS)) { + struct bt_conn_cb *callback; - SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { - if (callback->cte_report_cb) { - callback->cte_report_cb(conn, &iq_report); + SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { + if (callback->cte_report_cb) { + callback->cte_report_cb(conn, &iq_report); + } } } diff --git a/tests/bluetooth/gatt/testcase.yaml b/tests/bluetooth/gatt/testcase.yaml index 37e14f0b9686..ff18a0c663fd 100644 --- a/tests/bluetooth/gatt/testcase.yaml +++ b/tests/bluetooth/gatt/testcase.yaml @@ -28,3 +28,17 @@ tests: tags: - bluetooth - gatt + bluetooth.gatt.no_bt_conn_dynamic_callbacks: + extra_args: + - EXTRA_DTC_OVERLAY_FILE="test.overlay" + - CONFIG_BT_CONN_DYNAMIC_CALLBACKS=n + platform_allow: + - native_sim + - native_sim/native/64 + - qemu_x86 + - qemu_cortex_m3 + integration_platforms: + - native_sim + tags: + - bluetooth + - gatt diff --git a/tests/bluetooth/shell/testcase.yaml b/tests/bluetooth/shell/testcase.yaml index 673f13e481ca..0517acd65ad4 100644 --- a/tests/bluetooth/shell/testcase.yaml +++ b/tests/bluetooth/shell/testcase.yaml @@ -92,6 +92,12 @@ tests: extra_args: CONF_FILE="audio.conf" build_only: true tags: bluetooth + bluetooth.shell.audio.no_bt_conn_dynamic_callbacks: + extra_args: + - CONF_FILE="audio.conf" + - CONFIG_BT_CONN_DYNAMIC_CALLBACKS=n + build_only: true + tags: bluetooth bluetooth.shell.audio.no_testing: extra_args: CONF_FILE="audio.conf" build_only: true diff --git a/tests/bsim/bluetooth/samples/central_hr_peripheral_hr/tests_scripts/central_hr_peripheral_hr_static_callbacks.sh b/tests/bsim/bluetooth/samples/central_hr_peripheral_hr/tests_scripts/central_hr_peripheral_hr_static_callbacks.sh new file mode 100755 index 000000000000..f6567efdc2a8 --- /dev/null +++ b/tests/bsim/bluetooth/samples/central_hr_peripheral_hr/tests_scripts/central_hr_peripheral_hr_static_callbacks.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +# Copyright 2025 Demant A/S +# SPDX-License-Identifier: Apache-2.0 + +source ${ZEPHYR_BASE}/tests/bsim/sh_common.source + +simulation_id="central_hr_peripheral_hr_static_callbacks_test" +test_long_name="$(guess_test_long_name)" +verbosity_level=2 +EXECUTE_TIMEOUT=60 + +cd ${BSIM_OUT_PATH}/bin + +Execute ./bs_${BOARD_TS}_samples_bluetooth_peripheral_hr_prj_conf_overlay-static_callbacks_conf \ + -v=${verbosity_level} -s=${simulation_id} -d=0 + +Execute ./bs_${BOARD_TS}_${test_long_name}_prj_conf_overlay-static_callbacks_conf \ + -v=${verbosity_level} -s=${simulation_id} -d=1 \ + -testid=central_hr_peripheral_hr + +Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s=${simulation_id} \ + -D=2 -sim_length=12e6 $@ + +wait_for_background_jobs #Wait for all programs in background and return != 0 if any fails diff --git a/tests/bsim/bluetooth/samples/compile.sh b/tests/bsim/bluetooth/samples/compile.sh index f189445c36b0..33a9827a3001 100755 --- a/tests/bsim/bluetooth/samples/compile.sh +++ b/tests/bsim/bluetooth/samples/compile.sh @@ -37,6 +37,15 @@ app=tests/bsim/bluetooth/samples/central_hr_peripheral_hr \ extra_conf_file=${ZEPHYR_BASE}/samples/bluetooth/central_hr/prj.conf \ conf_overlay=${ZEPHYR_BASE}/samples/bluetooth/central_hr/overlay-phy_coded.conf \ compile +app=samples/bluetooth/peripheral_hr \ + sysbuild=1 \ + conf_overlay=overlay-static_callbacks.conf \ + compile +app=tests/bsim/bluetooth/samples/central_hr_peripheral_hr \ + sysbuild=1 \ + extra_conf_file=${ZEPHYR_BASE}/samples/bluetooth/central_hr/prj.conf \ + conf_overlay=${ZEPHYR_BASE}/samples/bluetooth/central_hr/overlay-static_callbacks.conf \ + compile if [ ${BOARD} == "nrf52_bsim/native" ]; then app=tests/bsim/bluetooth/samples/battery_service \ conf_file=prj.conf \ From 6c44930b7af9522a832e46b20d23012df1a8dab2 Mon Sep 17 00:00:00 2001 From: Sean Madigan Date: Wed, 6 Aug 2025 08:46:38 +0100 Subject: [PATCH 0630/2141] [nrf fromtree] bluetooth: host: Fix BT_LE_LOCAL_SUPPORTED_FEATURES_SIZE define Fix BT_LE_LOCAL_SUPPORTED_FEATURES_SIZE define, as this was not working correctly without brackets around CONFIG_BT_LE_MAX_LOCAL_SUPPORTED_FEATURE_PAGE. Also fix CONFIG_BT_LE_MAX_LOCAL_SUPPORTED_FEATURE_PAGE help, as this was talking about remote featues, where this only applies for local features. Also update for new CONFIG_BT_CONN_DYNAMIC_CALLBACKS kconfig Signed-off-by: Sean Madigan (cherry picked from commit 9bbc906b30d84ec1290690f1871753bb141f7373) Signed-off-by: Sean Madigan --- include/zephyr/bluetooth/bluetooth.h | 9 +++++---- subsys/bluetooth/Kconfig | 3 +-- subsys/bluetooth/host/conn.c | 10 ++++++---- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/include/zephyr/bluetooth/bluetooth.h b/include/zephyr/bluetooth/bluetooth.h index a061b0564bfb..750155d211e4 100644 --- a/include/zephyr/bluetooth/bluetooth.h +++ b/include/zephyr/bluetooth/bluetooth.h @@ -77,10 +77,11 @@ extern "C" { * The value of 8 correspond to page 0 in the LE Controller supported features. * 24 bytes are required for all subsequent supported feature pages. */ -#define BT_LE_LOCAL_SUPPORTED_FEATURES_SIZE \ - (BT_HCI_LE_BYTES_PAGE_0_FEATURE_PAGE + \ - COND_CODE_1(CONFIG_BT_LE_MAX_LOCAL_SUPPORTED_FEATURE_PAGE, \ - CONFIG_BT_LE_MAX_LOCAL_SUPPORTED_FEATURE_PAGE * BT_HCI_LE_BYTES_PER_FEATURE_PAGE, \ +#define BT_LE_LOCAL_SUPPORTED_FEATURES_SIZE \ + (BT_HCI_LE_BYTES_PAGE_0_FEATURE_PAGE + \ + COND_CODE_1(CONFIG_BT_LE_MAX_LOCAL_SUPPORTED_FEATURE_PAGE, \ + (CONFIG_BT_LE_MAX_LOCAL_SUPPORTED_FEATURE_PAGE \ + * BT_HCI_LE_BYTES_PER_FEATURE_PAGE), \ (0U))) /** Opaque type representing an advertiser. */ diff --git a/subsys/bluetooth/Kconfig b/subsys/bluetooth/Kconfig index 26efaf7832d7..3c297f370b0c 100644 --- a/subsys/bluetooth/Kconfig +++ b/subsys/bluetooth/Kconfig @@ -121,8 +121,7 @@ config BT_LE_MAX_LOCAL_SUPPORTED_FEATURE_PAGE range 0 10 depends on BT_LE_EXTENDED_FEAT_SET help - Maximum supported feature page that can be stored locally and fetched - from the remote connection with the LL Extended Feature Set feature. + Maximum feature page that can be stored for local supported features. config BT_LE_EXTENDED_FEAT_SET bool "LL Extended Feature Set" diff --git a/subsys/bluetooth/host/conn.c b/subsys/bluetooth/host/conn.c index 3a2adf814b9f..f930d85b3347 100644 --- a/subsys/bluetooth/host/conn.c +++ b/subsys/bluetooth/host/conn.c @@ -3357,11 +3357,13 @@ int bt_conn_le_subrate_request(struct bt_conn *conn, void notify_read_all_remote_feat_complete(struct bt_conn *conn, struct bt_conn_le_read_all_remote_feat_complete *params) { - struct bt_conn_cb *callback; + if (IS_ENABLED(CONFIG_BT_CONN_DYNAMIC_CALLBACKS)) { + struct bt_conn_cb *callback; - SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { - if (callback->read_all_remote_feat_complete != NULL) { - callback->read_all_remote_feat_complete(conn, params); + SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { + if (callback->read_all_remote_feat_complete != NULL) { + callback->read_all_remote_feat_complete(conn, params); + } } } From 8df4dd094d35868f76e51c002a3cd76312a6f38a Mon Sep 17 00:00:00 2001 From: Sean Madigan Date: Mon, 4 Aug 2025 12:20:35 +0100 Subject: [PATCH 0631/2141] [nrf fromtree] bluetooth: host: add frame space update support This commit adds support for the frame space update feature to the bluetooth host. This is mainly just a wrapper around the frame space update HCI command and event. Signed-off-by: Sean Madigan (cherry picked from commit 1b7b6af785652aa40875688dde6bcdf70778b869) Signed-off-by: Sean Madigan --- include/zephyr/bluetooth/conn.h | 117 ++++++++++++++++++++++++++ include/zephyr/bluetooth/hci_types.h | 39 +++++++++ subsys/bluetooth/Kconfig | 18 +++- subsys/bluetooth/controller/Kconfig | 11 +++ subsys/bluetooth/host/conn.c | 72 ++++++++++++++++ subsys/bluetooth/host/conn_internal.h | 3 + subsys/bluetooth/host/hci_core.c | 37 ++++++++ subsys/bluetooth/host/shell/bt.c | 90 ++++++++++++++++++++ tests/bluetooth/shell/testcase.yaml | 6 ++ 9 files changed, 391 insertions(+), 2 deletions(-) diff --git a/include/zephyr/bluetooth/conn.h b/include/zephyr/bluetooth/conn.h index 2da6b2c91d63..c6d8ce2015f8 100644 --- a/include/zephyr/bluetooth/conn.h +++ b/include/zephyr/bluetooth/conn.h @@ -273,6 +273,86 @@ struct bt_conn_le_read_all_remote_feat_complete { const uint8_t *features; }; +#define BT_CONN_LE_FRAME_SPACE_TYPES_MASK_ACL_IFS \ + (BT_HCI_LE_FRAME_SPACE_UPDATE_SPACING_TYPE_IFS_ACL_CP_MASK | \ + BT_HCI_LE_FRAME_SPACE_UPDATE_SPACING_TYPE_IFS_ACL_PC_MASK) + +#define BT_CONN_LE_FRAME_SPACE_TYPES_MASK_ACL \ + (BT_HCI_LE_FRAME_SPACE_UPDATE_SPACING_TYPE_IFS_ACL_CP_MASK | \ + BT_HCI_LE_FRAME_SPACE_UPDATE_SPACING_TYPE_IFS_ACL_PC_MASK | \ + BT_HCI_LE_FRAME_SPACE_UPDATE_SPACING_TYPE_MCES_MASK) + +#define BT_CONN_LE_FRAME_SPACE_TYPES_MASK_CIS \ + (BT_HCI_LE_FRAME_SPACE_UPDATE_SPACING_TYPE_IFS_CIS_MASK | \ + BT_HCI_LE_FRAME_SPACE_UPDATE_SPACING_TYPE_MSS_CIS_MASK) + +/** Maximum frame space in microseconds. + * As defined in Bluetooth Core Specification, Vol 4, Part E, Section 7.8.151. + */ +#define BT_CONN_LE_FRAME_SPACE_MAX (10000U) + +/** Frame space update initiator. */ +enum bt_conn_le_frame_space_update_initiator { + /** Initiated by local host */ + BT_CONN_LE_FRAME_SPACE_UPDATE_INITIATOR_LOCAL_HOST = + BT_HCI_LE_FRAME_SPACE_UPDATE_INITIATOR_LOCAL_HOST, + /** Initiated by local controller */ + BT_CONN_LE_FRAME_SPACE_UPDATE_INITIATOR_LOCAL_CONTROLLER = + BT_HCI_LE_FRAME_SPACE_UPDATE_INITIATOR_LOCAL_CONTROLLER, + /** Initiated by peer */ + BT_CONN_LE_FRAME_SPACE_UPDATE_INITIATOR_PEER = + BT_HCI_LE_FRAME_SPACE_UPDATE_INITIATOR_PEER +}; + +/** Frame space update params */ +struct bt_conn_le_frame_space_update_param { + /** Phy mask of the PHYs to be updated. + * Refer to BT_HCI_LE_FRAME_SPACE_UPDATE_PHY_* for values. + */ + uint8_t phys; + /** Spacing types mask of the spacing types to be updated. + * Refer to BT_HCI_LE_FRAME_SPACE_UPDATE_SPACING_TYPE_* and + * BT_CONN_LE_FRAME_SPACE_TYPES_MASK_* for values. + */ + uint16_t spacing_types; + /** Minimum frame space in microseconds. + * Bluetooth Core Specification, Vol 4, Part E, Section 7.8.151 + * allows for a range of frame space from 0 to 10000 microseconds. + * The actual supported frame space values will be dependent on + * the controller's capabilities. + */ + uint16_t frame_space_min; + /** Maximum frame space in microseconds. + * Bluetooth Core Specification, Vol 4, Part E, Section 7.8.151 + * allows for a range of frame space from 0 to 10000 microseconds. + * The actual supported frame space values will be dependent on + * the controller's capabilities. + */ + uint16_t frame_space_max; +}; + +/** Frame space updated callback params */ +struct bt_conn_le_frame_space_updated { + /** HCI Status from LE Frame Space Update Complete event. + * The remaining parameters will be invalid if status is not + * @ref BT_HCI_ERR_SUCCESS. + */ + uint8_t status; + /** Initiator of the frame space update. */ + enum bt_conn_le_frame_space_update_initiator initiator; + /** Updated frame space in microseconds. */ + uint16_t frame_space; + /** Phy mask of the PHYs updated. + * Refer to BT_HCI_LE_FRAME_SPACE_UPDATE_PHY_* for values. + */ + uint8_t phys; + /** Spacing types mask of the spacing types updated. + * Refer to BT_HCI_LE_FRAME_SPACE_UPDATE_SPACING_TYPE_* and + * BT_CONN_LE_FRAME_SPACE_TYPES_MASK_* for values. + */ + uint16_t spacing_types; +}; + /** Connection Type */ enum __packed bt_conn_type { /** LE Connection Type */ @@ -1225,6 +1305,23 @@ int bt_conn_le_subrate_request(struct bt_conn *conn, */ int bt_conn_le_read_all_remote_features(struct bt_conn *conn, uint8_t pages_requested); +/** @brief Update frame space. + * + * Request a change to the frame space parameters of a connection. + * This function will trigger the frame_space_updated callback when the + * procedure is completed. + * + * @kconfig_dep{CONFIG_BT_FRAME_SPACE_UPDATE}. + * + * @param conn @ref BT_CONN_TYPE_LE connection object. + * @param params Frame Space Update parameters. + * + * @return Zero on success or (negative) error code on failure. + * @return -EINVAL @p conn is not a valid @ref BT_CONN_TYPE_LE connection. + */ +int bt_conn_le_frame_space_update(struct bt_conn *conn, + const struct bt_conn_le_frame_space_update_param *params); + /** @brief Update the connection parameters. * * If the local device is in the peripheral role then updating the connection @@ -1935,6 +2032,26 @@ struct bt_conn_cb { const struct bt_conn_le_read_all_remote_feat_complete *params); #endif /* CONFIG_BT_LE_EXTENDED_FEAT_SET */ +#if defined(CONFIG_BT_FRAME_SPACE_UPDATE) + /** @brief Frame Space Update Complete event. + * + * This callback notifies the application that the frame space of + * the connection may have changed. + * The frame space update parameters will be invalid + * if status is not @ref BT_HCI_ERR_SUCCESS. + * + * This callback can be triggered by calling @ref + * bt_conn_le_frame_space_update, by the procedure running + * autonomously in the controller or by the peer. + * + * @param conn Connection object. + * @param params New frame space update parameters. + */ + void (*frame_space_updated)( + struct bt_conn *conn, + const struct bt_conn_le_frame_space_updated *params); +#endif /* CONFIG_BT_FRAME_SPACE_UPDATE */ + #if defined(CONFIG_BT_CHANNEL_SOUNDING) /** @brief LE CS Read Remote Supported Capabilities Complete event. * diff --git a/include/zephyr/bluetooth/hci_types.h b/include/zephyr/bluetooth/hci_types.h index 877617362c66..cc4cdad93646 100644 --- a/include/zephyr/bluetooth/hci_types.h +++ b/include/zephyr/bluetooth/hci_types.h @@ -208,6 +208,7 @@ struct bt_hci_cmd_hdr { #define BT_LE_FEAT_BIT_CHANNEL_SOUNDING_HOST 47 #define BT_LE_FEAT_BIT_CHANNEL_SOUNDING_TONE_QUAL_IND 48 #define BT_LE_FEAT_BIT_EXTENDED_FEAT_SET 63 +#define BT_LE_FEAT_BIT_FRAME_SPACE_UPDATE 65 #define BT_LE_FEAT_TEST(feat, n) (feat[(n) >> 3] & \ BIT((n) & 7)) @@ -286,6 +287,8 @@ struct bt_hci_cmd_hdr { BT_LE_FEAT_BIT_CHANNEL_SOUNDING_HOST) #define BT_FEAT_LE_EXTENDED_FEAT_SET(feat) BT_LE_FEAT_TEST(feat, \ BT_LE_FEAT_BIT_EXTENDED_FEAT_SET) +#define BT_FEAT_LE_FRAME_SPACE_UPDATE_SET(feat) BT_LE_FEAT_TEST(feat, \ + BT_LE_FEAT_BIT_FRAME_SPACE_UPDATE) #define BT_FEAT_LE_CIS(feat) (BT_FEAT_LE_CIS_CENTRAL(feat) | \ BT_FEAT_LE_CIS_PERIPHERAL(feat)) @@ -2815,6 +2818,30 @@ struct bt_hci_cp_le_cs_remove_config { #define BT_HCI_OP_LE_CS_TEST_END BT_OP(BT_OGF_LE, 0x0096) /* 0x2096 */ +#define BT_HCI_LE_FRAME_SPACE_UPDATE_PHY_1M_MASK BIT(0) +#define BT_HCI_LE_FRAME_SPACE_UPDATE_PHY_2M_MASK BIT(1) +#define BT_HCI_LE_FRAME_SPACE_UPDATE_PHY_CODED_MASK BIT(2) + +#define BT_HCI_LE_FRAME_SPACE_UPDATE_SPACING_TYPE_IFS_ACL_CP_MASK BIT(0) +#define BT_HCI_LE_FRAME_SPACE_UPDATE_SPACING_TYPE_IFS_ACL_PC_MASK BIT(1) +#define BT_HCI_LE_FRAME_SPACE_UPDATE_SPACING_TYPE_MCES_MASK BIT(2) +#define BT_HCI_LE_FRAME_SPACE_UPDATE_SPACING_TYPE_IFS_CIS_MASK BIT(3) +#define BT_HCI_LE_FRAME_SPACE_UPDATE_SPACING_TYPE_MSS_CIS_MASK BIT(4) + +#define BT_HCI_LE_FRAME_SPACE_UPDATE_INITIATOR_LOCAL_HOST (0) +#define BT_HCI_LE_FRAME_SPACE_UPDATE_INITIATOR_LOCAL_CONTROLLER (1) +#define BT_HCI_LE_FRAME_SPACE_UPDATE_INITIATOR_PEER (2) + +struct bt_hci_cp_le_frame_space_update { + uint16_t handle; + uint16_t frame_space_min; + uint16_t frame_space_max; + uint8_t phys; + uint16_t spacing_types; +} __packed; + +#define BT_HCI_OP_LE_FRAME_SPACE_UPDATE BT_OP(BT_OGF_LE, 0x009D) /* 0x209D */ + /* Event definitions */ #define BT_HCI_EVT_UNKNOWN 0x00 @@ -4004,6 +4031,16 @@ struct bt_hci_evt_le_cs_procedure_enable_complete { uint16_t max_procedure_len; } __packed; +#define BT_HCI_EVT_LE_FRAME_SPACE_UPDATE_COMPLETE 0x35 +struct bt_hci_evt_le_frame_space_update_complete { + uint8_t status; + uint16_t handle; + uint8_t initiator; + uint16_t frame_space; + uint8_t phys; + uint16_t spacing_types; +} __packed; + /* Event mask bits */ #define BT_EVT_BIT(n) (1ULL << (n)) @@ -4105,6 +4142,8 @@ struct bt_hci_evt_le_cs_procedure_enable_complete { #define BT_EVT_MASK_LE_CS_SUBEVENT_RESULT_CONTINUE BT_EVT_BIT(49) #define BT_EVT_MASK_LE_CS_TEST_END_COMPLETE BT_EVT_BIT(50) +#define BT_EVT_MASK_LE_FRAME_SPACE_UPDATE_COMPLETE BT_EVT_BIT(52) + /** HCI Error Codes, BT Core Spec v5.4 [Vol 1, Part F]. */ #define BT_HCI_ERR_SUCCESS 0x00 #define BT_HCI_ERR_UNKNOWN_CMD 0x01 diff --git a/subsys/bluetooth/Kconfig b/subsys/bluetooth/Kconfig index 3c297f370b0c..7e8fa5dca6ec 100644 --- a/subsys/bluetooth/Kconfig +++ b/subsys/bluetooth/Kconfig @@ -115,10 +115,18 @@ config BT_CONN_TX help Hidden configuration that is true if ACL or broadcast ISO is enabled +config BT_LE_LOCAL_MINIMUM_REQUIRED_FEATURE_PAGE + int + default 1 if BT_FRAME_SPACE_UPDATE + default 0 + depends on BT_LE_EXTENDED_FEAT_SET + help + Minimum required feature page that must be supported. + config BT_LE_MAX_LOCAL_SUPPORTED_FEATURE_PAGE int "Maximum supported feature page" - default 0 - range 0 10 + default BT_LE_LOCAL_MINIMUM_REQUIRED_FEATURE_PAGE + range BT_LE_LOCAL_MINIMUM_REQUIRED_FEATURE_PAGE 10 depends on BT_LE_EXTENDED_FEAT_SET help Maximum feature page that can be stored for local supported features. @@ -212,6 +220,12 @@ config BT_SUBRATING Enable support for LE Connection Subrating feature that is defined in the Bluetooth Core specification, Version 5.4 | Vol 6, Part B, Section 4.6.35. +config BT_FRAME_SPACE_UPDATE + bool "Frame Space Update" + depends on (!HAS_BT_CTLR || BT_CTLR_FRAME_SPACE_UPDATE_SUPPORT) && BT_CONN && BT_LE_EXTENDED_FEAT_SET + help + Enable support for Bluetooth 6.0 Frame Space Update feature. + config BT_CHANNEL_SOUNDING bool "Channel Sounding [EXPERIMENTAL]" select EXPERIMENTAL diff --git a/subsys/bluetooth/controller/Kconfig b/subsys/bluetooth/controller/Kconfig index c7e7030ba287..3b2c5beae802 100644 --- a/subsys/bluetooth/controller/Kconfig +++ b/subsys/bluetooth/controller/Kconfig @@ -125,6 +125,9 @@ config BT_CTLR_LE_PATH_LOSS_MONITORING_SUPPORT config BT_CTLR_SUBRATING_SUPPORT bool +config BT_CTLR_FRAME_SPACE_UPDATE_SUPPORT + bool + config BT_CTLR_CHANNEL_SOUNDING_SUPPORT bool @@ -1170,6 +1173,14 @@ config BT_CTLR_SUBRATING Enable support for Bluetooth v5.3 LE Connection Subrating in the Controller. +config BT_CTLR_FRAME_SPACE_UPDATE + bool "Frame Space Update" + depends on BT_CTLR_FRAME_SPACE_UPDATE_SUPPORT + default y if BT_FRAME_SPACE_UPDATE + help + Enable support for Bluetooth 6.0 Frame Space Update + in the Controller. + config BT_CTLR_CHANNEL_SOUNDING bool "Channel Sounding support" depends on BT_CTLR_CHANNEL_SOUNDING_SUPPORT diff --git a/subsys/bluetooth/host/conn.c b/subsys/bluetooth/host/conn.c index f930d85b3347..10c112507277 100644 --- a/subsys/bluetooth/host/conn.c +++ b/subsys/bluetooth/host/conn.c @@ -3402,6 +3402,78 @@ int bt_conn_le_read_all_remote_features(struct bt_conn *conn, uint8_t pages_requ } #endif /* CONFIG_BT_LE_EXTENDED_FEAT_SET */ +#if defined(CONFIG_BT_FRAME_SPACE_UPDATE) +void notify_frame_space_update_complete(struct bt_conn *conn, + struct bt_conn_le_frame_space_updated *params) +{ + if (IS_ENABLED(CONFIG_BT_CONN_DYNAMIC_CALLBACKS)) { + struct bt_conn_cb *callback; + + SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { + if (callback->frame_space_updated != NULL) { + callback->frame_space_updated(conn, params); + } + } + } + + STRUCT_SECTION_FOREACH(bt_conn_cb, cb) + { + if (cb->frame_space_updated != NULL) { + cb->frame_space_updated(conn, params); + } + } +} + +static bool frame_space_update_param_valid(const struct bt_conn_le_frame_space_update_param *param) +{ + if (param->frame_space_min > BT_CONN_LE_FRAME_SPACE_MAX || + param->frame_space_max > BT_CONN_LE_FRAME_SPACE_MAX || + param->frame_space_min > param->frame_space_max) { + return false; + } + + if (param->spacing_types == 0) { + return false; + } + + if (param->phys == 0) { + return false; + } + + return true; +} + +int bt_conn_le_frame_space_update(struct bt_conn *conn, + const struct bt_conn_le_frame_space_update_param *param) +{ + struct bt_hci_cp_le_frame_space_update *cp; + struct net_buf *buf; + + if (!bt_conn_is_type(conn, BT_CONN_TYPE_LE)) { + LOG_DBG("Invalid connection type: %u for %p", conn->type, conn); + return -EINVAL; + } + + if (!frame_space_update_param_valid(param)) { + return -EINVAL; + } + + buf = bt_hci_cmd_alloc(K_FOREVER); + if (buf == NULL) { + return -ENOBUFS; + } + + cp = net_buf_add(buf, sizeof(*cp)); + cp->handle = sys_cpu_to_le16(conn->handle); + cp->frame_space_min = sys_cpu_to_le16(param->frame_space_min); + cp->frame_space_max = sys_cpu_to_le16(param->frame_space_max); + cp->spacing_types = sys_cpu_to_le16(param->spacing_types); + cp->phys = param->phys; + + return bt_hci_cmd_send_sync(BT_HCI_OP_LE_FRAME_SPACE_UPDATE, buf, NULL); +} +#endif /* CONFIG_BT_FRAME_SPACE_UPDATE */ + #if defined(CONFIG_BT_CHANNEL_SOUNDING) void notify_remote_cs_capabilities(struct bt_conn *conn, uint8_t status, struct bt_conn_le_cs_capabilities *params) diff --git a/subsys/bluetooth/host/conn_internal.h b/subsys/bluetooth/host/conn_internal.h index 495de9114462..a31ca85c315b 100644 --- a/subsys/bluetooth/host/conn_internal.h +++ b/subsys/bluetooth/host/conn_internal.h @@ -517,6 +517,9 @@ void notify_subrate_change(struct bt_conn *conn, void notify_read_all_remote_feat_complete(struct bt_conn *conn, struct bt_conn_le_read_all_remote_feat_complete *params); +void notify_frame_space_update_complete(struct bt_conn *conn, + struct bt_conn_le_frame_space_updated *params); + void notify_remote_cs_capabilities(struct bt_conn *conn, uint8_t status, struct bt_conn_le_cs_capabilities *params); diff --git a/subsys/bluetooth/host/hci_core.c b/subsys/bluetooth/host/hci_core.c index 1fe19b5373b7..1f649689c7af 100644 --- a/subsys/bluetooth/host/hci_core.c +++ b/subsys/bluetooth/host/hci_core.c @@ -1831,6 +1831,33 @@ static void le_read_all_remote_feat_complete(struct net_buf *buf) } #endif /* CONFIG_BT_LE_EXTENDED_FEAT_SET */ +#if defined(CONFIG_BT_FRAME_SPACE_UPDATE) +static void le_frame_space_update_complete(struct net_buf *buf) +{ + struct bt_hci_evt_le_frame_space_update_complete *evt = (void *)buf->data; + struct bt_conn *conn; + struct bt_conn_le_frame_space_updated params; + uint16_t handle = sys_le16_to_cpu(evt->handle); + + conn = bt_conn_lookup_handle(handle, BT_CONN_TYPE_LE); + if (conn == NULL) { + LOG_ERR("Unknown conn handle 0x%04X", handle); + return; + } + + params.status = evt->status; + + if (params.status == BT_HCI_ERR_SUCCESS) { + params.phys = evt->phys; + params.spacing_types = evt->spacing_types; + params.frame_space = evt->frame_space; + params.initiator = evt->initiator; + } + + notify_frame_space_update_complete(conn, ¶ms); +} +#endif /* CONFIG_BT_FRAME_SPACE_UPDATE */ + #if defined(CONFIG_BT_DATA_LEN_UPDATE) static void le_data_len_change(struct net_buf *buf) { @@ -2958,6 +2985,11 @@ static const struct event_handler meta_events[] = { le_read_all_remote_feat_complete, sizeof(struct bt_hci_evt_le_read_all_remote_feat_complete)), #endif /* CONFIG_BT_LE_EXTENDED_FEAT_SET */ +#if defined(CONFIG_BT_FRAME_SPACE_UPDATE) + EVENT_HANDLER(BT_HCI_EVT_LE_FRAME_SPACE_UPDATE_COMPLETE, + le_frame_space_update_complete, + sizeof(struct bt_hci_evt_le_frame_space_update_complete)), +#endif /* CONFIG_BT_FRAME_SPACE_UPDATE */ #endif /* CONFIG_BT_CONN */ #if defined(CONFIG_BT_CHANNEL_SOUNDING) EVENT_HANDLER(BT_HCI_EVT_LE_CS_READ_REMOTE_SUPPORTED_CAPABILITIES_COMPLETE, @@ -3524,6 +3556,11 @@ static int le_set_event_mask(void) BT_FEAT_LE_EXTENDED_FEAT_SET(bt_dev.le.features)) { mask |= BT_EVT_MASK_LE_READ_ALL_REMOTE_FEAT_COMPLETE; } + + if (IS_ENABLED(CONFIG_BT_FRAME_SPACE_UPDATE) && + BT_FEAT_LE_FRAME_SPACE_UPDATE_SET(bt_dev.le.features)) { + mask |= BT_EVT_MASK_LE_FRAME_SPACE_UPDATE_COMPLETE; + } } if (IS_ENABLED(CONFIG_BT_SMP) && diff --git a/subsys/bluetooth/host/shell/bt.c b/subsys/bluetooth/host/shell/bt.c index 0946939f22cf..d9f7467104a9 100644 --- a/subsys/bluetooth/host/shell/bt.c +++ b/subsys/bluetooth/host/shell/bt.c @@ -1041,6 +1041,38 @@ void read_all_remote_feat_complete(struct bt_conn *conn, } #endif +#if defined(CONFIG_BT_FRAME_SPACE_UPDATE) +static const char *frame_space_initiator_to_str( + enum bt_conn_le_frame_space_update_initiator initiator) +{ + switch (initiator) { + case BT_CONN_LE_FRAME_SPACE_UPDATE_INITIATOR_LOCAL_HOST: + return "Local Host"; + case BT_CONN_LE_FRAME_SPACE_UPDATE_INITIATOR_LOCAL_CONTROLLER: + return "Local Controller"; + case BT_CONN_LE_FRAME_SPACE_UPDATE_INITIATOR_PEER: + return "Peer"; + default: + return "Unknown"; + } +} + +void frame_space_updated(struct bt_conn *conn, + const struct bt_conn_le_frame_space_updated *params) +{ + if (params->status != BT_HCI_ERR_SUCCESS) { + bt_shell_print("Frame space update failed (HCI status 0x%02x)", + params->status); + return; + } + + bt_shell_print( + "Frame space updated: frame space %d us, PHYs 0x%04x, spacing types 0x%04x, initiator %s", + params->frame_space, params->phys, params->spacing_types, + frame_space_initiator_to_str(params->initiator)); +} +#endif + #if defined(CONFIG_BT_CHANNEL_SOUNDING) void print_remote_cs_capabilities(struct bt_conn *conn, uint8_t status, @@ -1223,6 +1255,9 @@ BT_CONN_CB_DEFINE(conn_callbacks) = { #if defined(CONFIG_BT_LE_EXTENDED_FEAT_SET) .read_all_remote_feat_complete = read_all_remote_feat_complete, #endif +#if defined(CONFIG_BT_FRAME_SPACE_UPDATE) + .frame_space_updated = frame_space_updated, +#endif #if defined(CONFIG_BT_CHANNEL_SOUNDING) .le_cs_read_remote_capabilities_complete = print_remote_cs_capabilities, .le_cs_read_remote_fae_table_complete = print_remote_cs_fae_table, @@ -3343,6 +3378,55 @@ static int cmd_read_all_remote_features(const struct shell *sh, size_t argc, cha } #endif +#if defined(CONFIG_BT_FRAME_SPACE_UPDATE) +static int cmd_frame_space_update(const struct shell *sh, size_t argc, char *argv[]) +{ + int err = 0; + struct bt_conn_le_frame_space_update_param params; + + if (default_conn == NULL) { + shell_error(sh, "Conn handle error, at least one connection is required."); + return -ENOEXEC; + } + + params.frame_space_min = shell_strtoul(argv[1], 10, &err); + if (err) { + shell_help(sh); + shell_error(sh, "Could not parse frame_space_min input"); + return SHELL_CMD_HELP_PRINTED; + } + + params.frame_space_max = shell_strtoul(argv[2], 10, &err); + if (err) { + shell_help(sh); + shell_error(sh, "Could not parse frame_space_max input"); + return SHELL_CMD_HELP_PRINTED; + } + + params.phys = shell_strtoul(argv[3], 16, &err); + if (err) { + shell_help(sh); + shell_error(sh, "Could not parse phys input"); + return SHELL_CMD_HELP_PRINTED; + } + + params.spacing_types = shell_strtoul(argv[4], 16, &err); + if (err) { + shell_help(sh); + shell_error(sh, "Could not parse spacing_types input"); + return SHELL_CMD_HELP_PRINTED; + } + + err = bt_conn_le_frame_space_update(default_conn, ¶ms); + if (err != 0) { + shell_error(sh, "bt_conn_le_frame_space_update returned error %d", err); + return -ENOEXEC; + } + + return 0; +} +#endif + #if defined(CONFIG_BT_CONN) #if defined(CONFIG_BT_CENTRAL) static int bt_do_connect_le(int *ercd, size_t argc, char *argv[]) @@ -5098,6 +5182,12 @@ SHELL_STATIC_SUBCMD_SET_CREATE(bt_cmds, SHELL_CMD_ARG(read-all-remote-features, NULL, "", cmd_read_all_remote_features, 2, 0), #endif +#if defined(CONFIG_BT_FRAME_SPACE_UPDATE) + SHELL_CMD_ARG(frame-space-update, NULL, + "[frame_space_min ] [frame_space_max ] [phys ] " + "[spacing_types ]", + cmd_frame_space_update, 5, 0), +#endif #if defined(CONFIG_BT_BROADCASTER) SHELL_CMD_ARG(advertise, NULL, " [mode: discov, non_discov] " diff --git a/tests/bluetooth/shell/testcase.yaml b/tests/bluetooth/shell/testcase.yaml index 0517acd65ad4..45812ca51323 100644 --- a/tests/bluetooth/shell/testcase.yaml +++ b/tests/bluetooth/shell/testcase.yaml @@ -40,6 +40,12 @@ tests: - CONFIG_BT_LE_EXTENDED_FEAT_SET=y - CONFIG_BT_LL_SW_SPLIT=n build_only: true + bluetooth.shell.frame_space_update: + extra_configs: + - CONFIG_BT_FRAME_SPACE_UPDATE=y + - CONFIG_BT_LE_EXTENDED_FEAT_SET=y + - CONFIG_BT_LL_SW_SPLIT=n + build_only: true bluetooth.shell.channel_sounding: extra_configs: - CONFIG_BT_CHANNEL_SOUNDING=y From 7f148155976055f98e2549d6904d724a2fbb213c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20Reierstad?= Date: Thu, 7 Aug 2025 14:26:23 +0200 Subject: [PATCH 0632/2141] [nrf fromlist] Bluetooth: Host: Add req/rsp l2cap validation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit L2CAP channels will now, along with the ident, store the opcode of the pending request. This commit expands the ident lookup function to also compare received response types to this opcode, and will ignore unsolicited responses. Setting of idents for channels are moved after verification of buffer allocation for the request to be sent. A TODO is added for improving this functionality at a later time. Upstream PR #: 94080 Signed-off-by: Håvard Reierstad --- include/zephyr/bluetooth/l2cap.h | 2 + subsys/bluetooth/host/l2cap.c | 70 +++++++++++++++++++++++--------- 2 files changed, 53 insertions(+), 19 deletions(-) diff --git a/include/zephyr/bluetooth/l2cap.h b/include/zephyr/bluetooth/l2cap.h index 380b52ad508d..ee5203281d90 100644 --- a/include/zephyr/bluetooth/l2cap.h +++ b/include/zephyr/bluetooth/l2cap.h @@ -264,6 +264,8 @@ struct bt_l2cap_le_chan { uint16_t psm; /** Helps match request context during CoC */ uint8_t ident; + /** Opcode of the pending request. Used to match responses with requests. */ + uint8_t pending_req; bt_security_t required_sec_level; /* Response Timeout eXpired (RTX) timer */ diff --git a/subsys/bluetooth/host/l2cap.c b/subsys/bluetooth/host/l2cap.c index caf5424717bc..466dd1e27c51 100644 --- a/subsys/bluetooth/host/l2cap.c +++ b/subsys/bluetooth/host/l2cap.c @@ -80,8 +80,11 @@ NET_BUF_POOL_FIXED_DEFINE(disc_pool, 1, sizeof(struct bt_l2cap_disconn_req)), CONFIG_BT_CONN_TX_USER_DATA_SIZE, NULL); -#define l2cap_lookup_ident(conn, ident) __l2cap_lookup_ident(conn, ident, false) -#define l2cap_remove_ident(conn, ident) __l2cap_lookup_ident(conn, ident, true) +#define ANY_OPCODE 0x100 +#define l2cap_lookup_ident(conn, ident, req_opcode) \ + __l2cap_lookup_ident(conn, ident, req_opcode, false) +#define l2cap_remove_ident(conn, ident, req_opcode) \ + __l2cap_lookup_ident(conn, ident, req_opcode, true) static sys_slist_t servers = SYS_SLIST_STATIC_INIT(&servers); #endif /* CONFIG_BT_L2CAP_DYNAMIC_CHANNEL */ @@ -139,13 +142,15 @@ static struct bt_l2cap_le_chan *l2cap_chan_alloc_cid(struct bt_conn *conn, } static struct bt_l2cap_le_chan * -__l2cap_lookup_ident(struct bt_conn *conn, uint16_t ident, bool remove) +__l2cap_lookup_ident(struct bt_conn *conn, uint16_t ident, uint16_t req_opcode, bool remove) { struct bt_l2cap_chan *chan; sys_snode_t *prev = NULL; SYS_SLIST_FOR_EACH_CONTAINER(&conn->channels, chan, node) { - if (BT_L2CAP_LE_CHAN(chan)->ident == ident) { + if ((BT_L2CAP_LE_CHAN(chan)->ident == ident) && + ((BT_L2CAP_LE_CHAN(chan)->pending_req == req_opcode) || + (req_opcode == ANY_OPCODE))) { if (remove) { sys_slist_remove(&conn->channels, prev, &chan->node); @@ -303,7 +308,7 @@ static void l2cap_rtx_timeout(struct k_work *work) bt_l2cap_chan_del(&chan->chan); /* Remove other channels if pending on the same ident */ - while ((chan = l2cap_remove_ident(conn, chan->ident))) { + while ((chan = l2cap_remove_ident(conn, chan->ident, chan->pending_req))) { bt_l2cap_chan_del(&chan->chan); } } @@ -523,15 +528,23 @@ static int l2cap_le_conn_req(struct bt_l2cap_le_chan *ch) { struct net_buf *buf; struct bt_l2cap_le_conn_req *req; + uint8_t ident; - ch->ident = get_ident(); + ident = get_ident(); - buf = l2cap_create_le_sig_pdu(BT_L2CAP_LE_CONN_REQ, - ch->ident, sizeof(*req)); + buf = l2cap_create_le_sig_pdu(BT_L2CAP_LE_CONN_REQ, ident, sizeof(*req)); if (!buf) { return -ENOMEM; } + /* TODO Ident handling/setting should ideally be done in l2cap_chan_send_req after the + * request is successfully sent on the channel but will require special considerations for + * functions such as l2cap_ecred_conn_req and bt_l2cap_ecred_chan_reconfigure where the + * ident is set for multiple channels, but the request is only sent on one. + */ + ch->ident = ident; + ch->pending_req = BT_L2CAP_LE_CONN_REQ; + req = net_buf_add(buf, sizeof(*req)); req->psm = sys_cpu_to_le16(ch->psm); req->scid = sys_cpu_to_le16(ch->rx.cid); @@ -590,6 +603,7 @@ static int l2cap_ecred_conn_req(struct bt_l2cap_chan **chan, int channels) "The MTU shall be the same for channels in the same request."); ch->ident = ident; + ch->pending_req = BT_L2CAP_ECRED_CONN_REQ; net_buf_add_le16(buf, ch->rx.cid); } @@ -1785,7 +1799,7 @@ static void le_ecred_reconf_rsp(struct bt_l2cap *l2cap, uint8_t ident, rsp = net_buf_pull_mem(buf, sizeof(*rsp)); result = sys_le16_to_cpu(rsp->result); - while ((ch = l2cap_lookup_ident(conn, ident))) { + while ((ch = l2cap_lookup_ident(conn, ident, BT_L2CAP_ECRED_RECONF_REQ))) { /* Stop timer started on REQ send. The timer is only set on one * of the channels, but we don't want to make assumptions on * which one it is. @@ -1798,6 +1812,7 @@ static void le_ecred_reconf_rsp(struct bt_l2cap *l2cap, uint8_t ident, ch->pending_rx_mtu = 0; ch->ident = 0U; + ch->pending_req = 0U; if (ch->chan.ops->reconfigured) { ch->chan.ops->reconfigured(&ch->chan); @@ -1943,7 +1958,7 @@ static void le_ecred_conn_rsp(struct bt_l2cap *l2cap, uint8_t ident, LOG_DBG("mtu 0x%04x mps 0x%04x credits 0x%04x result %u", mtu, mps, credits, result); - chan = l2cap_lookup_ident(conn, ident); + chan = l2cap_lookup_ident(conn, ident, BT_L2CAP_ECRED_CONN_REQ); if (chan) { psm = chan->psm; } else { @@ -1953,7 +1968,7 @@ static void le_ecred_conn_rsp(struct bt_l2cap *l2cap, uint8_t ident, switch (result) { case BT_L2CAP_LE_ERR_AUTHENTICATION: case BT_L2CAP_LE_ERR_ENCRYPTION: - while ((chan = l2cap_lookup_ident(conn, ident))) { + while ((chan = l2cap_lookup_ident(conn, ident, BT_L2CAP_ECRED_CONN_REQ))) { /* Cancel RTX work */ k_work_cancel_delayable(&chan->rtx_work); @@ -1973,7 +1988,7 @@ static void le_ecred_conn_rsp(struct bt_l2cap *l2cap, uint8_t ident, case BT_L2CAP_LE_ERR_SCID_IN_USE: /* Some connections refused – not enough resources available */ case BT_L2CAP_LE_ERR_NO_RESOURCES: - while ((chan = l2cap_lookup_ident(conn, ident))) { + while ((chan = l2cap_lookup_ident(conn, ident, BT_L2CAP_ECRED_CONN_REQ))) { struct bt_l2cap_chan *c; /* Cancel RTX work */ @@ -2029,6 +2044,7 @@ static void le_ecred_conn_rsp(struct bt_l2cap *l2cap, uint8_t ident, chan->tx.cid = dcid; chan->ident = 0U; + chan->pending_req = 0U; chan->tx.mtu = mtu; chan->tx.mps = mps; @@ -2049,7 +2065,7 @@ static void le_ecred_conn_rsp(struct bt_l2cap *l2cap, uint8_t ident, break; case BT_L2CAP_LE_ERR_PSM_NOT_SUPP: default: - while ((chan = l2cap_remove_ident(conn, ident))) { + while ((chan = l2cap_remove_ident(conn, ident, BT_L2CAP_ECRED_CONN_REQ))) { bt_l2cap_chan_del(&chan->chan); } break; @@ -2088,9 +2104,9 @@ static void le_conn_rsp(struct bt_l2cap *l2cap, uint8_t ident, if (result == BT_L2CAP_LE_SUCCESS || result == BT_L2CAP_LE_ERR_AUTHENTICATION || result == BT_L2CAP_LE_ERR_ENCRYPTION) { - chan = l2cap_lookup_ident(conn, ident); + chan = l2cap_lookup_ident(conn, ident, BT_L2CAP_LE_CONN_REQ); } else { - chan = l2cap_remove_ident(conn, ident); + chan = l2cap_remove_ident(conn, ident, BT_L2CAP_LE_CONN_REQ); } if (!chan) { @@ -2103,6 +2119,7 @@ static void le_conn_rsp(struct bt_l2cap *l2cap, uint8_t ident, /* Reset ident since it got a response */ chan->ident = 0U; + chan->pending_req = 0U; switch (result) { case BT_L2CAP_LE_SUCCESS: @@ -2162,7 +2179,17 @@ static void le_disconn_rsp(struct bt_l2cap *l2cap, uint8_t ident, return; } + chan = l2cap_lookup_ident(conn, ident, BT_L2CAP_DISCONN_REQ); + if (!chan) { + LOG_ERR("Cannot find channel for ident %u", ident); + return; + } + scid = sys_le16_to_cpu(rsp->scid); + if (scid != chan->rx.cid) { + LOG_ERR("Invalid scid 0x%04x", scid); + return; + } LOG_DBG("dcid 0x%04x scid 0x%04x", sys_le16_to_cpu(rsp->dcid), scid); @@ -2230,7 +2257,7 @@ static void reject_cmd(struct bt_l2cap *l2cap, uint8_t ident, struct bt_conn *conn = l2cap->chan.chan.conn; struct bt_l2cap_le_chan *chan; - while ((chan = l2cap_remove_ident(conn, ident))) { + while ((chan = l2cap_remove_ident(conn, ident, ANY_OPCODE))) { bt_l2cap_chan_del(&chan->chan); } } @@ -3097,6 +3124,7 @@ int bt_l2cap_ecred_chan_reconfigure(struct bt_l2cap_chan **chans, uint16_t mtu) ch = BT_L2CAP_LE_CHAN(chans[j]); ch->ident = ident; + ch->pending_req = BT_L2CAP_ECRED_RECONF_REQ; ch->pending_rx_mtu = mtu; net_buf_add_le16(buf, ch->rx.cid); @@ -3184,6 +3212,7 @@ int bt_l2cap_ecred_chan_reconfigure_explicit(struct bt_l2cap_chan **chans, size_ ch = BT_L2CAP_LE_CHAN(chans[i]); ch->ident = ident; + ch->pending_req = BT_L2CAP_ECRED_RECONF_REQ; ch->pending_rx_mtu = mtu; net_buf_add_le16(buf, ch->rx.cid); @@ -3236,6 +3265,7 @@ int bt_l2cap_chan_disconnect(struct bt_l2cap_chan *chan) struct net_buf *buf; struct bt_l2cap_disconn_req *req; struct bt_l2cap_le_chan *le_chan; + uint8_t ident; if (!conn) { return -ENOTCONN; @@ -3250,14 +3280,16 @@ int bt_l2cap_chan_disconnect(struct bt_l2cap_chan *chan) LOG_DBG("chan %p scid 0x%04x dcid 0x%04x", chan, le_chan->rx.cid, le_chan->tx.cid); - le_chan->ident = get_ident(); + ident = get_ident(); - buf = l2cap_create_le_sig_pdu(BT_L2CAP_DISCONN_REQ, - le_chan->ident, sizeof(*req)); + buf = l2cap_create_le_sig_pdu(BT_L2CAP_DISCONN_REQ, ident, sizeof(*req)); if (!buf) { return -ENOMEM; } + le_chan->ident = ident; + le_chan->pending_req = BT_L2CAP_DISCONN_REQ; + req = net_buf_add(buf, sizeof(*req)); req->dcid = sys_cpu_to_le16(le_chan->tx.cid); req->scid = sys_cpu_to_le16(le_chan->rx.cid); From e78ab1d9e5814a0043b5fbfa8359fd021ec1f8fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Tue, 5 Aug 2025 09:56:30 +0200 Subject: [PATCH 0633/2141] [nrf fromlist] soc: nordic: Use default SYS_CLOCK_TICKS_PER_SEC for PPR core MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PPR was using 1 kHz system clock frequency instead of default 31250 Hz used on other cores with GRTC. Low frequency impacts system clock accuracy. There is no reason to use different frequency for PPR. Upstream PR #: 94112 Signed-off-by: Krzysztof Chruściński --- soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuppr | 2 -- soc/nordic/nrf92/Kconfig.defconfig.nrf9280_cpuppr | 3 --- 2 files changed, 5 deletions(-) diff --git a/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuppr b/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuppr index bf7c12a3a694..e7f9a57a44cd 100644 --- a/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuppr +++ b/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuppr @@ -6,8 +6,6 @@ if SOC_NRF54H20_CPUPPR config NUM_IRQS default 496 -config SYS_CLOCK_TICKS_PER_SEC - default 1000 # # As PPR has limited memory most of tests does not fit with asserts enabled. config ASSERT diff --git a/soc/nordic/nrf92/Kconfig.defconfig.nrf9280_cpuppr b/soc/nordic/nrf92/Kconfig.defconfig.nrf9280_cpuppr index 8e52b3611aa2..1280c0e63c0f 100644 --- a/soc/nordic/nrf92/Kconfig.defconfig.nrf9280_cpuppr +++ b/soc/nordic/nrf92/Kconfig.defconfig.nrf9280_cpuppr @@ -6,9 +6,6 @@ if SOC_NRF9280_CPUPPR config NUM_IRQS default 496 -config SYS_CLOCK_TICKS_PER_SEC - default 1000 - config RV_BOOT_HART default 13 if SOC_NRF9230_ENGB From 77547f89162265a6a4a285175b8e60b1dac7ae04 Mon Sep 17 00:00:00 2001 From: Jakub Zymelka Date: Tue, 5 Aug 2025 13:55:10 +0200 Subject: [PATCH 0634/2141] [nrf fromlist] drivers: adc: nrfx_saadc: Add support for SAADC internal sampling timer The SAMPLERATE register can be used as a local timer instead of triggering individual SAMPLE tasks. When SAMPLERATE.MODE is set to Timers, it is sufficient to trigger SAMPLE task only once in order to start the SAADC and triggering the STOP task will stop sampling. The SAMPLERATE.CC field controls the sample rate. The SAMPLERATE timer should not be combined with SCAN mode and only one channel should be enabled when using the internal timer. Upstream PR #: 91368 Signed-off-by: Jakub Zymelka --- drivers/adc/adc_nrfx_saadc.c | 176 ++++++++++++++++++++++++++++------- 1 file changed, 144 insertions(+), 32 deletions(-) diff --git a/drivers/adc/adc_nrfx_saadc.c b/drivers/adc/adc_nrfx_saadc.c index 7d442b482e65..94af0cddac3f 100644 --- a/drivers/adc/adc_nrfx_saadc.c +++ b/drivers/adc/adc_nrfx_saadc.c @@ -4,7 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -#define ADC_CONTEXT_USES_KERNEL_TIMER #include "adc_context.h" #include #include @@ -104,15 +103,20 @@ struct driver_data { uint8_t active_channel_cnt; void *mem_reg; void *user_buffer; + struct k_timer timer; + bool internal_timer_enabled; }; static struct driver_data m_data = { - ADC_CONTEXT_INIT_TIMER(m_data, ctx), ADC_CONTEXT_INIT_LOCK(m_data, ctx), ADC_CONTEXT_INIT_SYNC(m_data, ctx), .mem_reg = DMM_DEV_TO_REG(DT_NODELABEL(adc)), + .internal_timer_enabled = false, }; +/* Maximum value of the internal timer interval in microseconds. */ +#define ADC_INTERNAL_TIMER_INTERVAL_MAX_US 128U + /* Forward declaration */ static void event_handler(const nrfx_saadc_evt_t *event); @@ -385,22 +389,57 @@ static void adc_context_start_sampling(struct adc_context *ctx) static void adc_context_update_buffer_pointer(struct adc_context *ctx, bool repeat) { - void *samples_buffer; + if (!m_data.internal_timer_enabled) { + void *samples_buffer; + + if (!repeat) { + m_data.user_buffer = + (uint16_t *)m_data.user_buffer + m_data.active_channel_cnt; + } + + int error = dmm_buffer_in_prepare( + m_data.mem_reg, m_data.user_buffer, + NRFX_SAADC_SAMPLES_TO_BYTES(m_data.active_channel_cnt), &samples_buffer); + if (error != 0) { + LOG_ERR("DMM buffer allocation failed err=%d", error); + adc_context_complete(ctx, -EIO); + } - if (!repeat) { - m_data.user_buffer = (uint16_t *)m_data.user_buffer + m_data.active_channel_cnt; + nrfx_err_t nrfx_err = + nrfx_saadc_buffer_set(samples_buffer, m_data.active_channel_cnt); + if (nrfx_err != NRFX_SUCCESS) { + LOG_ERR("Failed to set buffer: %08x", nrfx_err); + adc_context_complete(ctx, -EIO); + } } +} - int error = dmm_buffer_in_prepare( - m_data.mem_reg, m_data.user_buffer, - NRFX_SAADC_SAMPLES_TO_BYTES(m_data.active_channel_cnt), - &samples_buffer); - if (error != 0) { - LOG_ERR("DMM buffer allocation failed err=%d", error); - adc_context_complete(ctx, -EIO); +static inline void adc_context_enable_timer(struct adc_context *ctx) +{ + if (!m_data.internal_timer_enabled) { + k_timer_start(&m_data.timer, K_NO_WAIT, K_USEC(ctx->options.interval_us)); + } else { + nrfx_err_t ret = nrfx_saadc_mode_trigger(); + + if (ret != NRFX_SUCCESS) { + LOG_ERR("Cannot start sampling: %d", ret); + adc_context_complete(&m_data.ctx, -EIO); + } } +} + +static inline void adc_context_disable_timer(struct adc_context *ctx) +{ + if (!m_data.internal_timer_enabled) { + k_timer_stop(&m_data.timer); + } +} + +static void adc_context_on_timer_expired(struct k_timer *timer_id) +{ + ARG_UNUSED(timer_id); - nrfx_saadc_buffer_set(samples_buffer, m_data.active_channel_cnt); + adc_context_request_next_sampling(&m_data.ctx); } static int get_resolution(const struct adc_sequence *sequence, nrf_saadc_resolution_t *resolution) @@ -490,31 +529,68 @@ static int check_buffer_size(const struct adc_sequence *sequence, uint8_t active return 0; } +static inline void single_ended_channel_cut_negative_sample(uint16_t channel_bit, + uint8_t single_ended_channels, + int16_t **sample) +{ + if ((channel_bit & single_ended_channels) && (*sample < 0)) { + **sample = 0; + } + + (*sample)++; +} + static bool has_single_ended(const struct adc_sequence *sequence) { return sequence->channels & m_data.single_ended_channels; } -static void correct_single_ended(const struct adc_sequence *sequence, nrf_saadc_value_t *buffer) +static void correct_single_ended(const struct adc_sequence *sequence, nrf_saadc_value_t *buffer, + uint16_t buffer_size) { - uint16_t channel_bit = BIT(0); uint8_t selected_channels = sequence->channels; uint8_t single_ended_channels = m_data.single_ended_channels; int16_t *sample = (int16_t *)buffer; - while (channel_bit <= single_ended_channels) { - if (channel_bit & selected_channels) { - if ((channel_bit & single_ended_channels) && (*sample < 0)) { - *sample = 0; + for (uint16_t channel_bit = BIT(0); channel_bit <= single_ended_channels; + channel_bit <<= 1) { + if (!(channel_bit & selected_channels)) { + continue; + } + + if (m_data.internal_timer_enabled) { + if (!(channel_bit & single_ended_channels)) { + continue; } - sample++; + for (int i = 0; i < buffer_size; i++) { + if (sample[i] < 0) { + sample[i] = 0; + } + } + } else { + single_ended_channel_cut_negative_sample(channel_bit, single_ended_channels, + &sample); } - - channel_bit <<= 1; } } +/* The internal timer runs at 16 MHz, so to convert the interval in microseconds + * to the internal timer CC value, we can use the formula: + * interval_cc = interval_us * 16 MHz + * where 16 MHz is the frequency of the internal timer. + * + * The maximum value for interval_cc is 2047, which corresponds to + * approximately 7816 Hz ~ 128us. + * The minimum value for interval_cc is depends on the SoC. + */ +static inline uint16_t interval_to_cc(uint16_t interval_us) +{ + NRFX_ASSERT((interval_us <= ADC_INTERNAL_TIMER_INTERVAL_MAX_US) && (interval_us > 0)); + + return (interval_us * 16) - 1; +} + static int start_read(const struct device *dev, const struct adc_sequence *sequence) { @@ -562,10 +638,28 @@ static int start_read(const struct device *dev, return error; } - nrfx_err = nrfx_saadc_simple_mode_set(selected_channels, - resolution, - oversampling, - event_handler); + if ((active_channel_cnt == 1) && (sequence->options != NULL) && + (sequence->options->interval_us <= ADC_INTERNAL_TIMER_INTERVAL_MAX_US) && + (sequence->options->interval_us > 0)) { + + nrfx_saadc_adv_config_t adv_config = { + .oversampling = oversampling, + .burst = NRF_SAADC_BURST_DISABLED, + .internal_timer_cc = interval_to_cc(sequence->options->interval_us), + .start_on_end = true, + }; + + m_data.internal_timer_enabled = true; + + nrfx_err = nrfx_saadc_advanced_mode_set(selected_channels, resolution, &adv_config, + event_handler); + } else { + m_data.internal_timer_enabled = false; + + nrfx_err = nrfx_saadc_simple_mode_set(selected_channels, resolution, oversampling, + event_handler); + } + if (nrfx_err != NRFX_SUCCESS) { return -EINVAL; } @@ -578,9 +672,11 @@ static int start_read(const struct device *dev, m_data.active_channel_cnt = active_channel_cnt; m_data.user_buffer = sequence->buffer; - error = dmm_buffer_in_prepare(m_data.mem_reg, - m_data.user_buffer, - NRFX_SAADC_SAMPLES_TO_BYTES(active_channel_cnt), + error = dmm_buffer_in_prepare(m_data.mem_reg, m_data.user_buffer, + (m_data.internal_timer_enabled + ? (NRFX_SAADC_SAMPLES_TO_BYTES(active_channel_cnt) * + (1 + sequence->options->extra_samplings)) + : NRFX_SAADC_SAMPLES_TO_BYTES(active_channel_cnt)), &samples_buffer); if (error != 0) { LOG_ERR("DMM buffer allocation failed err=%d", error); @@ -590,7 +686,15 @@ static int start_read(const struct device *dev, /* Buffer is filled in chunks, each chunk composed of number of samples equal to number * of active channels. Buffer pointer is advanced and reloaded after each chunk. */ - nrfx_saadc_buffer_set(samples_buffer, active_channel_cnt); + nrfx_err = nrfx_saadc_buffer_set( + samples_buffer, + (m_data.internal_timer_enabled + ? (active_channel_cnt * (1 + sequence->options->extra_samplings)) + : active_channel_cnt)); + if (nrfx_err != NRFX_SUCCESS) { + LOG_ERR("Failed to set buffer: %08x", nrfx_err); + return -EINVAL; + } adc_context_start_read(&m_data.ctx, sequence); @@ -633,11 +737,15 @@ static void event_handler(const nrfx_saadc_evt_t *event) if (event->type == NRFX_SAADC_EVT_DONE) { dmm_buffer_in_release( m_data.mem_reg, m_data.user_buffer, - NRFX_SAADC_SAMPLES_TO_BYTES(m_data.active_channel_cnt), + (m_data.internal_timer_enabled + ? (NRFX_SAADC_SAMPLES_TO_BYTES(m_data.active_channel_cnt) * + (1 + m_data.ctx.sequence.options->extra_samplings)) + : NRFX_SAADC_SAMPLES_TO_BYTES(m_data.active_channel_cnt)), event->data.done.p_buffer); if (has_single_ended(&m_data.ctx.sequence)) { - correct_single_ended(&m_data.ctx.sequence, m_data.user_buffer); + correct_single_ended(&m_data.ctx.sequence, m_data.user_buffer, + event->data.done.size); } adc_context_on_sampling_done(&m_data.ctx, DEVICE_DT_INST_GET(0)); } else if (event->type == NRFX_SAADC_EVT_CALIBRATEDONE) { @@ -646,6 +754,8 @@ static void event_handler(const nrfx_saadc_evt_t *event) LOG_ERR("Cannot start sampling: 0x%08x", err); adc_context_complete(&m_data.ctx, -EIO); } + } else if (event->type == NRFX_SAADC_EVT_FINISHED) { + adc_context_complete(&m_data.ctx, 0); } } @@ -653,6 +763,8 @@ static int init_saadc(const struct device *dev) { nrfx_err_t err; + k_timer_init(&m_data.timer, adc_context_on_timer_expired, NULL); + /* The priority value passed here is ignored (see nrfx_glue.h). */ err = nrfx_saadc_init(0); if (err != NRFX_SUCCESS) { From 84ab620777ceec9b286f3fe6640ed0869c682c0b Mon Sep 17 00:00:00 2001 From: Jakub Zymelka Date: Tue, 5 Aug 2025 14:00:57 +0200 Subject: [PATCH 0635/2141] [nrf fromlist] drivers: adc: nrfx: enable negative values for single-ended ADC readings The ADC driver API already supports ADC readings which can return signed values, these are differential readings. In Nordic's datasheet, we have a mode called "single ended", but its just a name. "Single ended" is a differential reading, with the negative channel tied to GND. This is not compatible with zephyrs definition of a single ended reading. To support Nordic's "single ended" mode, the user must configure a differential reading, with the negative input tied to ground, which the saadc driver can then use to configure the reading as Nordic SAADC "single ended", and return negative values as expected. Upstream PR #: 94069 Signed-off-by: Jakub Zymelka --- drivers/adc/adc_nrfx_saadc.c | 20 ++++++++++++------ include/zephyr/dt-bindings/adc/nrf-saadc.h | 24 ++++++++++++++++++++++ 2 files changed, 38 insertions(+), 6 deletions(-) diff --git a/drivers/adc/adc_nrfx_saadc.c b/drivers/adc/adc_nrfx_saadc.c index 94af0cddac3f..9b0f59084b62 100644 --- a/drivers/adc/adc_nrfx_saadc.c +++ b/drivers/adc/adc_nrfx_saadc.c @@ -191,7 +191,6 @@ static int input_assign(nrf_saadc_input_t *pin_p, if (channel_cfg->differential) { if (channel_cfg->input_negative > ARRAY_SIZE(saadc_psels) || - channel_cfg->input_negative < NRF_SAADC_AIN0 || (IS_ENABLED(CONFIG_NRF_PLATFORM_HALTIUM) && (channel_cfg->input_positive > NRF_SAADC_AIN7) != (channel_cfg->input_negative > NRF_SAADC_AIN7))) { @@ -199,14 +198,17 @@ static int input_assign(nrf_saadc_input_t *pin_p, channel_cfg->input_negative); return -EINVAL; } - *pin_n = saadc_psels[channel_cfg->input_negative]; + *pin_n = channel_cfg->input_negative == NRF_SAADC_GND ? + NRF_SAADC_INPUT_DISABLED : + saadc_psels[channel_cfg->input_negative]; } else { *pin_n = NRF_SAADC_INPUT_DISABLED; } #else *pin_p = channel_cfg->input_positive; - *pin_n = channel_cfg->differential ? channel_cfg->input_negative - : NRF_SAADC_INPUT_DISABLED; + *pin_n = (channel_cfg->differential && (channel_cfg->input_negative != NRF_SAADC_GND)) + ? channel_cfg->input_negative + : NRF_SAADC_INPUT_DISABLED; #endif LOG_DBG("ADC positive input: %d", *pin_p); LOG_DBG("ADC negative input: %d", *pin_n); @@ -356,8 +358,14 @@ static int adc_nrfx_channel_setup(const struct device *dev, * after ADC sequence ends. */ if (channel_cfg->differential) { - ch_cfg->mode = NRF_SAADC_MODE_DIFFERENTIAL; - m_data.single_ended_channels &= ~BIT(channel_cfg->channel_id); + if (channel_cfg->input_negative == NRF_SAADC_GND) { + ch_cfg->mode = NRF_SAADC_MODE_SINGLE_ENDED; + /* Do not mark as single-ended to not correct negative values. */ + m_data.single_ended_channels &= ~BIT(channel_cfg->channel_id); + } else { + ch_cfg->mode = NRF_SAADC_MODE_DIFFERENTIAL; + m_data.single_ended_channels &= ~BIT(channel_cfg->channel_id); + } } else { ch_cfg->mode = NRF_SAADC_MODE_SINGLE_ENDED; m_data.single_ended_channels |= BIT(channel_cfg->channel_id); diff --git a/include/zephyr/dt-bindings/adc/nrf-saadc.h b/include/zephyr/dt-bindings/adc/nrf-saadc.h index 4a3deb95cff9..e5a86150cd43 100644 --- a/include/zephyr/dt-bindings/adc/nrf-saadc.h +++ b/include/zephyr/dt-bindings/adc/nrf-saadc.h @@ -7,6 +7,30 @@ #ifndef ZEPHYR_INCLUDE_DT_BINDINGS_ADC_NRF_SAADC_H_ #define ZEPHYR_INCLUDE_DT_BINDINGS_ADC_NRF_SAADC_H_ +/** + * @brief Short ADC negative input to ground + * + * @details The nRF SAADC hardware only supports differential readings. + * The nRF SAADC SE (single ended) mode is differential with the negative + * input shorted to GND (ground). To use the nRF SAADC SE mode, set the + * negative input to NRF_SAADC_GND: + * + * @code{.dts} + * zephyr,input-positive = ; + * zephyr,input-negative = ; + * @endcode + * + * The nRF SAADC driver also supports using the nRF SAADC SE mode in + * emulated "single-ended" mode, as defined by zephyr. In this mode, + * negative readings will be clamped to 0 by software to emulate the + * behavior of an ADC in "single-ended" mode, as defined by zephyr. To + * do this, only define the positive input: + * + * @code{.dts} + * zephyr,input-positive = ; + * @endcode + */ +#define NRF_SAADC_GND 0 #define NRF_SAADC_AIN0 1 #define NRF_SAADC_AIN1 2 #define NRF_SAADC_AIN2 3 From eb125ac902754194d2cfcc8a603f29262c18ceb9 Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Fri, 25 Jul 2025 15:22:36 +0200 Subject: [PATCH 0636/2141] [nrf fromtree] arch/arm/core/cortex_m: optional memory section for _cp_context More complex suspend and resume scheme might require exactly defined location of this variable due to platform peculiar SW and HW requirement. DTS zephyr,memory-region node with nodelabel `pm_s2ram` shall be used to automatic definition of linker section for such objective. Signed-off-by: Andrzej Puzdrowski (cherry picked from commit 20695ed09121eab21adeffe03dc9fb0b97657808) --- arch/arm/core/cortex_m/pm_s2ram.c | 14 +++++++++++++- subsys/pm/Kconfig | 3 +++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/arch/arm/core/cortex_m/pm_s2ram.c b/arch/arm/core/cortex_m/pm_s2ram.c index 2657d48dc32a..81a4ae20a4f6 100644 --- a/arch/arm/core/cortex_m/pm_s2ram.c +++ b/arch/arm/core/cortex_m/pm_s2ram.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2022, Carlo Caione + * Copyright (c) 2025 Nordic Semiconductor ASA * * SPDX-License-Identifier: Apache-2.0 */ @@ -14,7 +15,18 @@ /** * CPU context for S2RAM */ -__noinit _cpu_context_t _cpu_context; + +#if DT_NODE_EXISTS(DT_NODELABEL(pm_s2ram)) &&\ + DT_NODE_HAS_COMPAT(DT_NODELABEL(pm_s2ram), zephyr_memory_region) + +/* Linker section name is given by `zephyr,memory-region` property of + * `zephyr,memory-region` compatible DT node with nodelabel `pm_s2ram`. + */ +__attribute__((section(DT_PROP(DT_NODELABEL(pm_s2ram), zephyr_memory_region)))) +#else +__noinit +#endif +_cpu_context_t _cpu_context; #ifndef CONFIG_PM_S2RAM_CUSTOM_MARKING /** diff --git a/subsys/pm/Kconfig b/subsys/pm/Kconfig index c2bca1c5f04c..7cc347369b98 100644 --- a/subsys/pm/Kconfig +++ b/subsys/pm/Kconfig @@ -38,6 +38,9 @@ config PM_S2RAM depends on ARCH_HAS_SUSPEND_TO_RAM help This option enables suspend-to-RAM (S2RAM). + When enabled on Cortex-M, and a 'zephyr,memory-region' compatible node with nodelabel + 'pm_s2ram' is defined in DT, _cpu_context symbol (located in arch/arm/core/cortex_m/pm_s2ram.c) + is placed in linker section given by 'zephyr,memory-region' property of aforementioned node. config PM_S2RAM_CUSTOM_MARKING bool "Use custom marking functions" From 820b875fa19140ac5cb1f7f917edaba9890dc159 Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Fri, 25 Jul 2025 15:25:41 +0200 Subject: [PATCH 0637/2141] [nrf fromtree] boards/nordic/nrf54h20dk: added prototype s2ram_context section Added DTS node which describes section for PM S2RAM context location Signed-off-by: Andrzej Puzdrowski (cherry picked from commit aa90ede92ae5e3cfd65848421a8d7087d4b97e11) --- .../nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index 994d16242f41..e086601abae9 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -340,3 +340,20 @@ zephyr_udc0: &usbhs { memory-regions = <&cpuapp_dma_region>; status = "okay"; }; + +/* Trim this RAM block for making room on all run-time common S2RAM cpu context. */ +&cpuapp_ram0 { + reg = <0x22000000 (DT_SIZE_K(32)-32)>; + ranges = <0x0 0x22000000 (0x8000-0x20)>; +}; + +/ { + soc { + /* run-time common S2RAM cpu context RAM */ + pm_s2ram: cpuapp_s2ram@22007fe0 { + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0x22007fe0 32>; + zephyr,memory-region = "pm_s2ram_context"; + }; + }; +}; From ec8bfd85d4ec9a7e883345312633c8dfae54e9d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20St=C4=99pnicki?= Date: Wed, 6 Aug 2025 09:22:26 +0200 Subject: [PATCH 0638/2141] [nrf noup] soc: nordic: ironside: fix typo in Kconfig MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This typo was fixed in upstream but not ported to NCS This creates conflicts when cherry picking. Signed-off-by: Łukasz Stępnicki --- soc/nordic/ironside/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soc/nordic/ironside/Kconfig b/soc/nordic/ironside/Kconfig index 2430090c943b..6eeacf067718 100644 --- a/soc/nordic/ironside/Kconfig +++ b/soc/nordic/ironside/Kconfig @@ -69,7 +69,7 @@ config NRF_IRONSIDE_DVFS_OPPOINT_CHANGE_MUTEX_TIMEOUT_MS int "IRONSside DVFS change oppoint mutex timeout" default 100 help - Maximum tiemout when waiting for DVFS oppoint change mutex lock. + Maximum timeout when waiting for DVFS oppoint change mutex lock. endif # NRF_IRONSIDE_DVFS_SERVICE From c867cec99e85127132360620f53c4c5f45a3f56d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20St=C4=99pnicki?= Date: Wed, 23 Jul 2025 15:52:10 +0200 Subject: [PATCH 0639/2141] [nrf fromlist] soc: nordic: ironside: dvfs: check abb analog status more than once MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added ABB analog status lock read retries if needed. After cpu idle ABB macro may need some time to initialize and report status locked. Attempts cound can be configured using Kconfig option. Upstream PR #: 93595 Signed-off-by: Łukasz Stępnicki --- soc/nordic/ironside/Kconfig | 9 +++++---- soc/nordic/ironside/dvfs.c | 10 ++++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/soc/nordic/ironside/Kconfig b/soc/nordic/ironside/Kconfig index 6eeacf067718..3136e3bd5f47 100644 --- a/soc/nordic/ironside/Kconfig +++ b/soc/nordic/ironside/Kconfig @@ -65,11 +65,12 @@ config NRF_IRONSIDE_DVFS_SERVICE if NRF_IRONSIDE_DVFS_SERVICE -config NRF_IRONSIDE_DVFS_OPPOINT_CHANGE_MUTEX_TIMEOUT_MS - int "IRONSside DVFS change oppoint mutex timeout" - default 100 +config NRF_IRONSIDE_ABB_STATUSANA_CHECK_MAX_ATTEMPTS + int "IRONSside DVFS ABB analog status check maximum attempts" + range 0 255 + default 50 help - Maximum timeout when waiting for DVFS oppoint change mutex lock. + Maximum attempts with 10us intervals before busy status will be reported. endif # NRF_IRONSIDE_DVFS_SERVICE diff --git a/soc/nordic/ironside/dvfs.c b/soc/nordic/ironside/dvfs.c index 7793ff015b1e..6c7a86cd0ad4 100644 --- a/soc/nordic/ironside/dvfs.c +++ b/soc/nordic/ironside/dvfs.c @@ -18,6 +18,9 @@ static enum ironside_dvfs_oppoint current_dvfs_oppoint = IRONSIDE_DVFS_OPP_HIGH; #error "Unsupported SoC series for IronSide DVFS" #endif +#define ABB_STATUSANA_CHECK_MAX_ATTEMPTS (CONFIG_NRF_IRONSIDE_ABB_STATUSANA_CHECK_MAX_ATTEMPTS) +#define ABB_STATUSANA_CHECK_INTERVAL_US (10U) + struct dvfs_hsfll_data_t { uint32_t new_f_mult; uint32_t new_f_trim_entry; @@ -129,6 +132,13 @@ static inline bool ironside_dvfs_is_abb_locked(NRF_ABB_Type *abb) /* Temporary workaround until STATUSANA register is visible. */ volatile const uint32_t *statusana = (uint32_t *)abb + ABB_STATUSANA_REG_OFFSET; + uint8_t status_read_attempts = ABB_STATUSANA_CHECK_MAX_ATTEMPTS; + + while ((*statusana & ABB_STATUSANA_LOCKED_L_Msk) == 0 && status_read_attempts > 0) { + k_busy_wait(ABB_STATUSANA_CHECK_INTERVAL_US); + status_read_attempts--; + } + return ((*statusana & ABB_STATUSANA_LOCKED_L_Msk) != 0); } From 568a8ad16dc5c9f738f574d47b6a352a87541cf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Ku=C5=BAnia?= Date: Thu, 31 Jul 2025 13:33:43 +0200 Subject: [PATCH 0640/2141] [nrf fromlist] modules: hal_nordic: nrf_802154: de-escalate to non-ZLI isr MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both the nrf_802154_clock_hfclk_start() and nrf_802154_clock_hfclk_stop() can potentially be called form ZLI and non-ZLI contexts and consecutive calls are not guaranteed to be alternating. Added an implementation that uses the EGU to de-escalate to a non-ZLI context from which it is safe to use the Zephyr API that enables/disables the HFXO. Upstream PR #: 94208 Signed-off-by: Rafał Kuźnia --- .../platform/nrf_802154_clock_zephyr.c | 156 ++++++++++++++---- west.yml | 2 +- 2 files changed, 129 insertions(+), 29 deletions(-) diff --git a/modules/hal_nordic/nrf_802154/sl_opensource/platform/nrf_802154_clock_zephyr.c b/modules/hal_nordic/nrf_802154/sl_opensource/platform/nrf_802154_clock_zephyr.c index 1dcf724b0e52..ee3a589bd234 100644 --- a/modules/hal_nordic/nrf_802154/sl_opensource/platform/nrf_802154_clock_zephyr.c +++ b/modules/hal_nordic/nrf_802154/sl_opensource/platform/nrf_802154_clock_zephyr.c @@ -13,8 +13,35 @@ #include #include #include +#include + +/** + * The implementation uses EGU to de-escalate execution context from ZLI to a regular interrupt + * to ensure that Zephyr APIs can be used safely. + * + * Both the nrf_802154_clock_hfclk_start() and nrf_802154_clock_hfclk_stop() can potentially be + * called from ZLI and non-ZLI contexts and consecutive calls are not guaranteed to be alternating. + * + * For example, it is possible that _stop() may be called multiple times in succession and the + * same thing applies to _start(). What is known however is that the last call always takes + * the precedence. + */ + +#define SWI_INT NRFX_CONCAT_2(NRF_EGU_INT_TRIGGERED, NRF_802154_SL_EGU_CLOCK_CHANNEL_NO) +#define SWI_TASK NRFX_CONCAT_2(NRF_EGU_TASK_TRIGGER, NRF_802154_SL_EGU_CLOCK_CHANNEL_NO) +#define SWI_EVENT NRFX_CONCAT_2(NRF_EGU_EVENT_TRIGGERED, NRF_802154_SL_EGU_CLOCK_CHANNEL_NO) + +#define CLOCK_NONE 0u +#define CLOCK_REQUEST 1u +#define CLOCK_RELEASE 2u static bool hfclk_is_running; +static bool enabled; +static atomic_t request = CLOCK_NONE; + +/* Forward declarations. */ +static void hfclk_start(void); +static void hfclk_stop(void); void nrf_802154_clock_init(void) { @@ -23,11 +50,13 @@ void nrf_802154_clock_init(void) nrf_802154_clock_hfclk_latency_set(clock_latency_us); #endif + + nrf_egu_int_enable(NRF_802154_EGU_INSTANCE, SWI_INT); } void nrf_802154_clock_deinit(void) { - /* Intentionally empty. */ + nrf_egu_int_disable(NRF_802154_EGU_INSTANCE, SWI_INT); } bool nrf_802154_clock_hfclk_is_running(void) @@ -47,8 +76,44 @@ static void hfclk_on_callback(struct onoff_manager *mgr, nrf_802154_clock_hfclk_ready(); } -#if defined(CONFIG_CLOCK_CONTROL_NRF) +void nrf_802154_sl_clock_swi_irq_handler(void) +{ + if (nrf_egu_event_check(NRF_802154_EGU_INSTANCE, SWI_EVENT)) { + nrf_egu_event_clear(NRF_802154_EGU_INSTANCE, SWI_EVENT); + + atomic_val_t previous = atomic_set(&request, CLOCK_NONE); + + __ASSERT_NO_MSG(previous == CLOCK_REQUEST || previous == CLOCK_RELEASE); + + switch (previous) { + case CLOCK_REQUEST: + hfclk_start(); + break; + + case CLOCK_RELEASE: + hfclk_stop(); + break; + + default: + break; + } + } +} + void nrf_802154_clock_hfclk_start(void) +{ + atomic_set(&request, CLOCK_REQUEST); + nrf_egu_task_trigger(NRF_802154_EGU_INSTANCE, SWI_TASK); +} + +void nrf_802154_clock_hfclk_stop(void) +{ + atomic_set(&request, CLOCK_RELEASE); + nrf_egu_task_trigger(NRF_802154_EGU_INSTANCE, SWI_TASK); +} + +#if defined(CONFIG_CLOCK_CONTROL_NRF) +static void hfclk_start(void) { struct onoff_manager *mgr = z_nrf_clock_control_get_onoff(CLOCK_CONTROL_NRF_SUBSYS_HF); @@ -57,56 +122,91 @@ void nrf_802154_clock_hfclk_start(void) sys_notify_init_callback(&hfclk_cli.notify, hfclk_on_callback); - /* - * todo: replace constlat request with PM policy API when - * controlling the event latency becomes possible. - */ - if (IS_ENABLED(CONFIG_NRF_802154_CONSTLAT_CONTROL)) { - nrf_sys_event_request_global_constlat(); + if (!enabled) { + unsigned int key = irq_lock(); + + /* + * todo: replace constlat request with PM policy API when + * controlling the event latency becomes possible. + */ + if (IS_ENABLED(CONFIG_NRF_802154_CONSTLAT_CONTROL)) { + nrf_sys_event_request_global_constlat(); + } + + int ret = onoff_request(mgr, &hfclk_cli); + + __ASSERT_NO_MSG(ret >= 0); + (void)ret; + + irq_unlock(key); } - int ret = onoff_request(mgr, &hfclk_cli); - __ASSERT_NO_MSG(ret >= 0); - (void)ret; + enabled = true; } -void nrf_802154_clock_hfclk_stop(void) +static void hfclk_stop(void) { struct onoff_manager *mgr = z_nrf_clock_control_get_onoff(CLOCK_CONTROL_NRF_SUBSYS_HF); __ASSERT_NO_MSG(mgr != NULL); - int ret = onoff_cancel_or_release(mgr, &hfclk_cli); - __ASSERT_NO_MSG(ret >= 0); - (void)ret; + if (enabled) { + unsigned int key = irq_lock(); + + int ret = onoff_cancel_or_release(mgr, &hfclk_cli); + + __ASSERT_NO_MSG(ret >= 0); + (void)ret; + + if (IS_ENABLED(CONFIG_NRF_802154_CONSTLAT_CONTROL)) { + nrf_sys_event_release_global_constlat(); + } + + hfclk_is_running = false; - if (IS_ENABLED(CONFIG_NRF_802154_CONSTLAT_CONTROL)) { - nrf_sys_event_release_global_constlat(); + irq_unlock(key); } - hfclk_is_running = false; + enabled = false; } #elif DT_NODE_HAS_STATUS(DT_NODELABEL(hfxo), okay) && \ DT_NODE_HAS_COMPAT(DT_NODELABEL(hfxo), nordic_nrf54h_hfxo) -void nrf_802154_clock_hfclk_start(void) +static void hfclk_start(void) { - sys_notify_init_callback(&hfclk_cli.notify, hfclk_on_callback); - int ret = nrf_clock_control_request(DEVICE_DT_GET(DT_NODELABEL(hfxo)), NULL, &hfclk_cli); + if (!enabled) { + unsigned int key = irq_lock(); + + sys_notify_init_callback(&hfclk_cli.notify, hfclk_on_callback); + int ret = nrf_clock_control_request(DEVICE_DT_GET(DT_NODELABEL(hfxo)), + NULL, &hfclk_cli); + + __ASSERT_NO_MSG(ret >= 0); + (void)ret; + + irq_unlock(key); + } - __ASSERT_NO_MSG(ret >= 0); - (void)ret; + enabled = true; } -void nrf_802154_clock_hfclk_stop(void) +static void hfclk_stop(void) { - int ret = nrf_clock_control_cancel_or_release(DEVICE_DT_GET(DT_NODELABEL(hfxo)), - NULL, &hfclk_cli); + if (enabled) { + unsigned int key = irq_lock(); + + int ret = nrf_clock_control_cancel_or_release(DEVICE_DT_GET(DT_NODELABEL(hfxo)), + NULL, &hfclk_cli); + + __ASSERT_NO_MSG(ret >= 0); + (void)ret; + + irq_unlock(key); + } - __ASSERT_NO_MSG(ret >= 0); - (void)ret; + enabled = false; } #endif diff --git a/west.yml b/west.yml index 853d84113a68..cce707f4bedd 100644 --- a/west.yml +++ b/west.yml @@ -200,7 +200,7 @@ manifest: groups: - hal - name: hal_nordic - revision: 2f5d4e5868ab573eac932fa4bc142565073c3c04 + revision: 9e1bc32436a71adf1aa55937046d659a2db9e74f path: modules/hal/nordic groups: - hal From c784ed16c10cbe33a4cde3488098cf347ef5cf04 Mon Sep 17 00:00:00 2001 From: Tomi Fontanilles Date: Tue, 5 Aug 2025 15:49:47 +0300 Subject: [PATCH 0641/2141] [nrf fromlist] secure_storage: make UIDs 32-bit Make the storage UID type 32-bit long. This makes it more convenient to use those UIDs as storage entry IDs when storing the entries to NVM. The previous 64+ bits UIDs made it incovenient to use them as such. As Zephyr defines UID ranges to be used (see e.g. `zephyr/psa/key_ids.h`), this guarantees that all the UIDs will fit within the 30 bits reserved for them. The secure storage ITS implementation API is changed to take `psa_storage_uid_t` separately so the implementation can check that no forbidden bits are set before they are packed into `secure_storage_its_uid_t`. This change breaks backward compatibility because `secure_storage_its_uid_t`, which is used both as part of the additional data for authentication and for generating encryption keys, changes size from 12 to 4 bytes. For users wanting to preserve backward compatibility (for example when upgrading an existing installation to a newer Zephyr release) or that for some reason want to use a 64-bit `psa_storage_uid_t`, the Kconfig option CONFIG_SECURE_STORAGE_64_BIT_UID is added. When enabled, it makes the implementation behave the same as previously and compatibility with existing entries is preserved. This was tested manually. Fixes zephyrproject-rtos/zephyr#86177. Signed-off-by: Tomi Fontanilles Upstream PR #: 94171 --- subsys/secure_storage/Kconfig | 11 +++ subsys/secure_storage/Kconfig.its_store | 7 +- .../internal/zephyr/secure_storage/its.h | 17 ++-- .../zephyr/secure_storage/its/common.h | 23 ++++- .../include/psa/internal_trusted_storage.h | 10 +- .../include/psa/protected_storage.h | 12 +-- .../include/psa/storage_common.h | 4 + .../secure_storage/src/its/implementation.c | 94 ++++++++++++++----- subsys/secure_storage/src/its/store/zms.c | 30 ++---- 9 files changed, 139 insertions(+), 69 deletions(-) diff --git a/subsys/secure_storage/Kconfig b/subsys/secure_storage/Kconfig index 3fe8eb0f76a7..b0ac8c08a14c 100644 --- a/subsys/secure_storage/Kconfig +++ b/subsys/secure_storage/Kconfig @@ -25,6 +25,17 @@ module = SECURE_STORAGE module-str = secure_storage source "subsys/logging/Kconfig.template.log_config" +config SECURE_STORAGE_64_BIT_UID + bool "Make psa_storage_uid_t 64-bit" + help + Zephyr, by default, uses a 30-bit psa_storage_uid_t, which allows using only 32 bits to + identify entries. + UID ranges are defined for the different users of the API which guarantees that all the + UIDs fit within 30 bits. See for example the zephyr/psa/key_ids.h header file. + Enable this for backward compatibility if you are updating an existing installation with + stored entries that was using Zephyr prior to 4.3 or if for some reason you need the full + 64-bit UID range. + choice SECURE_STORAGE_ITS_IMPLEMENTATION prompt "Internal Trusted Storage (ITS) API implementation" diff --git a/subsys/secure_storage/Kconfig.its_store b/subsys/secure_storage/Kconfig.its_store index ccd15b968a7c..c924def563fa 100644 --- a/subsys/secure_storage/Kconfig.its_store +++ b/subsys/secure_storage/Kconfig.its_store @@ -17,7 +17,7 @@ config SECURE_STORAGE_ITS_STORE_IMPLEMENTATION_ZMS depends on ZMS help This implementation of the ITS store module makes direct use of ZMS for storage. - It needs a `secure_storage_its_partition` devicetree chosen property that points + It needs a secure_storage_its_partition devicetree chosen property that points to a fixed storage partition that will be dedicated to the ITS. It has lower overhead compared to the settings-based implementation, both in terms of runtime execution and storage space, and also ROM footprint if the settings subsystem is disabled. @@ -78,7 +78,8 @@ config SECURE_STORAGE_ITS_STORE_SETTINGS_PREFIX config SECURE_STORAGE_ITS_STORE_SETTINGS_NAME_MAX_LEN int "Maximum setting name length" range 2 64 - default 22 if !SECURE_STORAGE_ITS_STORE_SETTINGS_NAME_CUSTOM - default 0 + default 0 if SECURE_STORAGE_ITS_STORE_SETTINGS_NAME_CUSTOM + default 22 if SECURE_STORAGE_64_BIT_UID + default 14 endif # SECURE_STORAGE_ITS_STORE_IMPLEMENTATION_SETTINGS diff --git a/subsys/secure_storage/include/internal/zephyr/secure_storage/its.h b/subsys/secure_storage/include/internal/zephyr/secure_storage/its.h index 009bb5e061af..c19dd7be7b63 100644 --- a/subsys/secure_storage/include/internal/zephyr/secure_storage/its.h +++ b/subsys/secure_storage/include/internal/zephyr/secure_storage/its.h @@ -14,18 +14,21 @@ #include "its/common.h" /** @brief See `psa_its_set()`, to which this function is analogous. */ -psa_status_t secure_storage_its_set(secure_storage_its_uid_t uid, size_t data_length, - const void *p_data, psa_storage_create_flags_t create_flags); +psa_status_t secure_storage_its_set(secure_storage_its_caller_id_t caller_id, psa_storage_uid_t uid, + size_t data_length, const void *p_data, + psa_storage_create_flags_t create_flags); /** @brief See `psa_its_get()`, to which this function is analogous. */ -psa_status_t secure_storage_its_get(secure_storage_its_uid_t uid, size_t data_offset, - size_t data_size, void *p_data, size_t *p_data_length); +psa_status_t secure_storage_its_get(secure_storage_its_caller_id_t caller_id, psa_storage_uid_t uid, + size_t data_offset, size_t data_size, + void *p_data, size_t *p_data_length); /** @brief See `psa_its_get_info()`, to which this function is analogous. */ -psa_status_t secure_storage_its_get_info(secure_storage_its_uid_t uid, - struct psa_storage_info_t *p_info); +psa_status_t secure_storage_its_get_info(secure_storage_its_caller_id_t caller_id, + psa_storage_uid_t uid, struct psa_storage_info_t *p_info); /** @brief See `psa_its_remove()`, to which this function is analogous. */ -psa_status_t secure_storage_its_remove(secure_storage_its_uid_t uid); +psa_status_t secure_storage_its_remove(secure_storage_its_caller_id_t caller_id, + psa_storage_uid_t uid); #endif diff --git a/subsys/secure_storage/include/internal/zephyr/secure_storage/its/common.h b/subsys/secure_storage/include/internal/zephyr/secure_storage/its/common.h index cd953086950a..f0576cba185f 100644 --- a/subsys/secure_storage/include/internal/zephyr/secure_storage/its/common.h +++ b/subsys/secure_storage/include/internal/zephyr/secure_storage/its/common.h @@ -12,8 +12,7 @@ #include /** @brief The ID of the caller from which the ITS API call originates. - * This is used to prevent ID collisions between different callers that are not aware - * of each other and so might use the same numerical IDs, e.g. PSA Crypto and PSA ITS. + * This is used to namespace the different callers and possibly treat them differently. */ typedef enum { SECURE_STORAGE_ITS_CALLER_PSA_ITS, @@ -22,12 +21,32 @@ typedef enum { SECURE_STORAGE_ITS_CALLER_COUNT } secure_storage_its_caller_id_t; +#ifdef CONFIG_SECURE_STORAGE_64_BIT_UID + /** The UID (caller + entry IDs) of an ITS entry. */ typedef struct { psa_storage_uid_t uid; secure_storage_its_caller_id_t caller_id; } __packed secure_storage_its_uid_t; +#else + +#define SECURE_STORAGE_ITS_UID_BIT_SIZE 30 +#define SECURE_STORAGE_ITS_CALLER_ID_BIT_SIZE 2 + +/** @brief The UID (caller + entry IDs) of an ITS entry. + * This is a packed, 32-bit version of `psa_storage_uid_t` which allows storing + * smaller IDs compared to the 64-bit ones that PSA Secure Storage specifies. + * Zephyr defines ranges of IDs to be used by different users of the API (subsystems, application) + * which guarantees 1. no collisions and 2. that the IDs used fit within `uid`. + */ +typedef struct { + psa_storage_uid_t uid : SECURE_STORAGE_ITS_UID_BIT_SIZE; + secure_storage_its_caller_id_t caller_id : SECURE_STORAGE_ITS_CALLER_ID_BIT_SIZE; +} secure_storage_its_uid_t; + +#endif /* CONFIG_SECURE_STORAGE_64_BIT_UID */ + #ifdef CONFIG_SECURE_STORAGE_ITS_TRANSFORM_MODULE /** The maximum size, in bytes, of an entry's data after it has been transformed for storage. */ diff --git a/subsys/secure_storage/include/psa/internal_trusted_storage.h b/subsys/secure_storage/include/psa/internal_trusted_storage.h index a8c3b77c601a..06a09e34988b 100644 --- a/subsys/secure_storage/include/psa/internal_trusted_storage.h +++ b/subsys/secure_storage/include/psa/internal_trusted_storage.h @@ -16,7 +16,6 @@ #else #define ITS_CALLER_ID SECURE_STORAGE_ITS_CALLER_PSA_ITS #endif -#define ITS_UID (secure_storage_its_uid_t){.uid = uid, .caller_id = ITS_CALLER_ID} /** @endcond */ #include @@ -50,7 +49,7 @@ static ALWAYS_INLINE psa_status_t psa_its_set(psa_storage_uid_t uid, size_t data_length, const void *p_data, psa_storage_create_flags_t create_flags) { - return secure_storage_its_set(ITS_UID, data_length, p_data, create_flags); + return secure_storage_its_set(ITS_CALLER_ID, uid, data_length, p_data, create_flags); } /** @@ -76,7 +75,8 @@ static ALWAYS_INLINE psa_status_t psa_its_get(psa_storage_uid_t uid, size_t data_offset, size_t data_size, void *p_data, size_t *p_data_length) { - return secure_storage_its_get(ITS_UID, data_offset, data_size, p_data, p_data_length); + return secure_storage_its_get(ITS_CALLER_ID, uid, data_offset, + data_size, p_data, p_data_length); } /** @@ -96,7 +96,7 @@ static ALWAYS_INLINE /** @endcond */ psa_status_t psa_its_get_info(psa_storage_uid_t uid, struct psa_storage_info_t *p_info) { - return secure_storage_its_get_info(ITS_UID, p_info); + return secure_storage_its_get_info(ITS_CALLER_ID, uid, p_info); } /** @@ -117,7 +117,7 @@ static ALWAYS_INLINE /** @endcond */ psa_status_t psa_its_remove(psa_storage_uid_t uid) { - return secure_storage_its_remove(ITS_UID); + return secure_storage_its_remove(ITS_CALLER_ID, uid); } #undef ITS_UID diff --git a/subsys/secure_storage/include/psa/protected_storage.h b/subsys/secure_storage/include/psa/protected_storage.h index 7c20d3097a2a..40d731b04254 100644 --- a/subsys/secure_storage/include/psa/protected_storage.h +++ b/subsys/secure_storage/include/psa/protected_storage.h @@ -12,8 +12,7 @@ /** @cond INTERNAL_HIDDEN */ #ifdef CONFIG_SECURE_STORAGE_PS_IMPLEMENTATION_ITS #include "../internal/zephyr/secure_storage/its.h" -#define ITS_UID (secure_storage_its_uid_t){.uid = uid, \ - .caller_id = SECURE_STORAGE_ITS_CALLER_PSA_PS} +#define ITS_CALLER_ID SECURE_STORAGE_ITS_CALLER_PSA_PS #else #include "../internal/zephyr/secure_storage/ps.h" #endif @@ -50,7 +49,7 @@ psa_status_t psa_ps_set(psa_storage_uid_t uid, size_t data_length, const void *p_data, psa_storage_create_flags_t create_flags) { #ifdef CONFIG_SECURE_STORAGE_PS_IMPLEMENTATION_ITS - return secure_storage_its_set(ITS_UID, data_length, p_data, create_flags); + return secure_storage_its_set(ITS_CALLER_ID, uid, data_length, p_data, create_flags); #else return secure_storage_ps_set(uid, data_length, p_data, create_flags); #endif @@ -83,7 +82,8 @@ psa_status_t psa_ps_get(psa_storage_uid_t uid, size_t data_offset, size_t data_size, void *p_data, size_t *p_data_length) { #ifdef CONFIG_SECURE_STORAGE_PS_IMPLEMENTATION_ITS - return secure_storage_its_get(ITS_UID, data_offset, data_size, p_data, p_data_length); + return secure_storage_its_get(ITS_CALLER_ID, uid, data_offset, + data_size, p_data, p_data_length); #else return secure_storage_ps_get(uid, data_offset, data_size, p_data, p_data_length); #endif @@ -110,7 +110,7 @@ static ALWAYS_INLINE psa_status_t psa_ps_get_info(psa_storage_uid_t uid, struct psa_storage_info_t *p_info) { #ifdef CONFIG_SECURE_STORAGE_PS_IMPLEMENTATION_ITS - return secure_storage_its_get_info(ITS_UID, p_info); + return secure_storage_its_get_info(ITS_CALLER_ID, uid, p_info); #else return secure_storage_ps_get_info(uid, p_info); #endif @@ -138,7 +138,7 @@ static ALWAYS_INLINE psa_status_t psa_ps_remove(psa_storage_uid_t uid) { #ifdef CONFIG_SECURE_STORAGE_PS_IMPLEMENTATION_ITS - return secure_storage_its_remove(ITS_UID); + return secure_storage_its_remove(ITS_CALLER_ID, uid); #else return secure_storage_ps_remove(uid); #endif diff --git a/subsys/secure_storage/include/psa/storage_common.h b/subsys/secure_storage/include/psa/storage_common.h index d5bed2a692e7..2bd0f7cce732 100644 --- a/subsys/secure_storage/include/psa/storage_common.h +++ b/subsys/secure_storage/include/psa/storage_common.h @@ -20,7 +20,11 @@ #include /** UID type for identifying entries. */ +#ifdef CONFIG_SECURE_STORAGE_64_BIT_UID typedef uint64_t psa_storage_uid_t; +#else +typedef uint32_t psa_storage_uid_t; +#endif /** Flags used when creating an entry. */ typedef uint32_t psa_storage_create_flags_t; diff --git a/subsys/secure_storage/src/its/implementation.c b/subsys/secure_storage/src/its/implementation.c index 2ad937d45d27..b39fbf90b002 100644 --- a/subsys/secure_storage/src/its/implementation.c +++ b/subsys/secure_storage/src/its/implementation.c @@ -11,6 +11,33 @@ LOG_MODULE_DECLARE(secure_storage, CONFIG_SECURE_STORAGE_LOG_LEVEL); +#ifndef CONFIG_SECURE_STORAGE_64_BIT_UID +BUILD_ASSERT(sizeof(secure_storage_its_uid_t) == 4); /* ITS UIDs are 32-bit */ +BUILD_ASSERT(1 << SECURE_STORAGE_ITS_CALLER_ID_BIT_SIZE >= SECURE_STORAGE_ITS_CALLER_COUNT); +BUILD_ASSERT(SECURE_STORAGE_ITS_CALLER_ID_BIT_SIZE + SECURE_STORAGE_ITS_UID_BIT_SIZE == 32); +#endif + +static psa_status_t make_its_uid(secure_storage_its_caller_id_t caller_id, psa_storage_uid_t uid, + secure_storage_its_uid_t *its_uid) +{ + if (uid == 0) { + return PSA_ERROR_INVALID_ARGUMENT; + } + +#ifndef CONFIG_SECURE_STORAGE_64_BIT_UID + /* Check that the UID is not bigger than the maximum defined size. */ + if (uid & GENMASK64(63, SECURE_STORAGE_ITS_UID_BIT_SIZE)) { + LOG_DBG("UID %u/0x%llx cannot be used as it has bits set past " + "the first " STRINGIFY(SECURE_STORAGE_ITS_UID_BIT_SIZE) " ones.", + caller_id, (unsigned long long)uid); + return PSA_ERROR_INVALID_ARGUMENT; + } +#endif /* !CONFIG_SECURE_STORAGE_64_BIT_UID */ + + *its_uid = (secure_storage_its_uid_t){.caller_id = caller_id, .uid = uid}; + return PSA_SUCCESS; +} + static void log_failed_operation(const char *operation, const char *preposition, psa_status_t ret) { LOG_ERR("Failed to %s data %s storage. (%d)", operation, preposition, ret); @@ -117,12 +144,17 @@ static psa_status_t store_entry(secure_storage_its_uid_t uid, size_t data_length return ret; } -psa_status_t secure_storage_its_set(secure_storage_its_uid_t uid, size_t data_length, - const void *p_data, psa_storage_create_flags_t create_flags) +psa_status_t secure_storage_its_set(secure_storage_its_caller_id_t caller_id, psa_storage_uid_t uid, + size_t data_length, const void *p_data, + psa_storage_create_flags_t create_flags) { psa_status_t ret; + secure_storage_its_uid_t its_uid; - if (uid.uid == 0 || (p_data == NULL && data_length != 0)) { + if (make_its_uid(caller_id, uid, &its_uid) != PSA_SUCCESS) { + return PSA_ERROR_INVALID_ARGUMENT; + } + if (p_data == NULL && data_length != 0) { return PSA_ERROR_INVALID_ARGUMENT; } if (create_flags & ~SECURE_STORAGE_ALL_CREATE_FLAGS) { @@ -134,43 +166,49 @@ psa_status_t secure_storage_its_set(secure_storage_its_uid_t uid, size_t data_le return PSA_ERROR_INSUFFICIENT_STORAGE; } - if (keep_stored_entry(uid, data_length, p_data, create_flags, &ret)) { + if (keep_stored_entry(its_uid, data_length, p_data, create_flags, &ret)) { return ret; } - ret = store_entry(uid, data_length, p_data, create_flags); + ret = store_entry(its_uid, data_length, p_data, create_flags); return ret; } - -psa_status_t secure_storage_its_get(secure_storage_its_uid_t uid, size_t data_offset, - size_t data_size, void *p_data, size_t *p_data_length) +psa_status_t secure_storage_its_get(secure_storage_its_caller_id_t caller_id, psa_storage_uid_t uid, + size_t data_offset, size_t data_size, + void *p_data, size_t *p_data_length) { - if (uid.uid == 0 || (p_data == NULL && data_size != 0) || p_data_length == NULL) { + psa_status_t ret; + secure_storage_its_uid_t its_uid; + uint8_t stored_data[SECURE_STORAGE_ITS_TRANSFORM_MAX_STORED_DATA_SIZE]; + size_t stored_data_len; + psa_storage_create_flags_t create_flags; + + if (make_its_uid(caller_id, uid, &its_uid) != PSA_SUCCESS) { + return PSA_ERROR_INVALID_ARGUMENT; + } + if ((p_data == NULL && data_size != 0) || p_data_length == NULL) { return PSA_ERROR_INVALID_ARGUMENT; } if (data_size == 0) { *p_data_length = 0; return PSA_SUCCESS; } - psa_status_t ret; - uint8_t stored_data[SECURE_STORAGE_ITS_TRANSFORM_MAX_STORED_DATA_SIZE]; - size_t stored_data_len; - psa_storage_create_flags_t create_flags; - ret = get_stored_data(uid, stored_data, &stored_data_len); + + ret = get_stored_data(its_uid, stored_data, &stored_data_len); if (ret != PSA_SUCCESS) { return ret; } if (data_offset == 0 && data_size >= SECURE_STORAGE_ITS_TRANSFORM_DATA_SIZE(stored_data_len)) { /* All the data fits directly in the provided buffer. */ - return transform_stored_data(uid, stored_data_len, stored_data, data_size, p_data, - p_data_length, &create_flags); + return transform_stored_data(its_uid, stored_data_len, stored_data, data_size, + p_data, p_data_length, &create_flags); } uint8_t data[CONFIG_SECURE_STORAGE_ITS_MAX_DATA_SIZE]; size_t data_len; - ret = transform_stored_data(uid, stored_data_len, stored_data, sizeof(data), data, + ret = transform_stored_data(its_uid, stored_data_len, stored_data, sizeof(data), data, &data_len, &create_flags); if (ret == PSA_SUCCESS) { if (data_offset > data_len) { @@ -184,41 +222,47 @@ psa_status_t secure_storage_its_get(secure_storage_its_uid_t uid, size_t data_of return ret; } -psa_status_t secure_storage_its_get_info(secure_storage_its_uid_t uid, - struct psa_storage_info_t *p_info) +psa_status_t secure_storage_its_get_info(secure_storage_its_caller_id_t caller_id, + psa_storage_uid_t uid, struct psa_storage_info_t *p_info) { psa_status_t ret; + secure_storage_its_uid_t its_uid; uint8_t data[CONFIG_SECURE_STORAGE_ITS_MAX_DATA_SIZE]; - if (uid.uid == 0 || p_info == NULL) { + if (make_its_uid(caller_id, uid, &its_uid) != PSA_SUCCESS) { + return PSA_ERROR_INVALID_ARGUMENT; + } + if (p_info == NULL) { return PSA_ERROR_INVALID_ARGUMENT; } - ret = get_entry(uid, sizeof(data), data, &p_info->size, &p_info->flags); + ret = get_entry(its_uid, sizeof(data), data, &p_info->size, &p_info->flags); if (ret == PSA_SUCCESS) { p_info->capacity = p_info->size; } return ret; } -psa_status_t secure_storage_its_remove(secure_storage_its_uid_t uid) +psa_status_t secure_storage_its_remove(secure_storage_its_caller_id_t caller_id, + psa_storage_uid_t uid) { psa_status_t ret; + secure_storage_its_uid_t its_uid; psa_storage_create_flags_t create_flags; uint8_t data[CONFIG_SECURE_STORAGE_ITS_MAX_DATA_SIZE]; size_t data_len; - if (uid.uid == 0) { + if (make_its_uid(caller_id, uid, &its_uid) != PSA_SUCCESS) { return PSA_ERROR_INVALID_ARGUMENT; } - ret = get_entry(uid, sizeof(data), data, &data_len, &create_flags); + ret = get_entry(its_uid, sizeof(data), data, &data_len, &create_flags); if (ret == PSA_SUCCESS && (create_flags & PSA_STORAGE_FLAG_WRITE_ONCE)) { return PSA_ERROR_NOT_PERMITTED; } /* Allow overwriting corrupted entries as well to not be stuck with them forever. */ if (ret == PSA_SUCCESS || ret == PSA_ERROR_STORAGE_FAILURE) { - ret = secure_storage_its_store_remove(uid); + ret = secure_storage_its_store_remove(its_uid); if (ret != PSA_SUCCESS) { log_failed_operation("remove", "from", ret); return PSA_ERROR_STORAGE_FAILURE; diff --git a/subsys/secure_storage/src/its/store/zms.c b/subsys/secure_storage/src/its/store/zms.c index ede296952ab5..3a3bdd64c762 100644 --- a/subsys/secure_storage/src/its/store/zms.c +++ b/subsys/secure_storage/src/its/store/zms.c @@ -33,26 +33,26 @@ static int init_zms(void) } SYS_INIT(init_zms, APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY); +#ifdef CONFIG_SECURE_STORAGE_64_BIT_UID + /* Bit position of the ITS caller ID in the ZMS entry ID. */ #define ITS_CALLER_ID_POS 30 /* Make sure that every ITS caller ID fits in ZMS entry IDs at the defined position. */ BUILD_ASSERT(1 << (32 - ITS_CALLER_ID_POS) >= SECURE_STORAGE_ITS_CALLER_COUNT); -static bool has_forbidden_bits_set(secure_storage_its_uid_t uid) +static uint32_t zms_id_from(secure_storage_its_uid_t uid) { - if (uid.uid & GENMASK64(63, ITS_CALLER_ID_POS)) { - LOG_DBG("UID %u/0x%llx cannot be used as it has bits set past " - "the first " STRINGIFY(ITS_CALLER_ID_POS) " ones.", - uid.caller_id, (unsigned long long)uid.uid); - return true; - } - return false; + __ASSERT_NO_MSG(!(uid.uid & GENMASK64(63, ITS_CALLER_ID_POS))); + return (uint32_t)uid.uid | (uid.caller_id << ITS_CALLER_ID_POS); } +#else static uint32_t zms_id_from(secure_storage_its_uid_t uid) { - return (uint32_t)uid.uid | (uid.caller_id << ITS_CALLER_ID_POS); + BUILD_ASSERT(sizeof(uid) == sizeof(uint32_t)); + return *(uint32_t *)&uid; } +#endif /* CONFIG_SECURE_STORAGE_64_BIT_UID */ psa_status_t secure_storage_its_store_set(secure_storage_its_uid_t uid, size_t data_length, const void *data) @@ -61,10 +61,6 @@ psa_status_t secure_storage_its_store_set(secure_storage_its_uid_t uid, ssize_t zms_ret; const uint32_t zms_id = zms_id_from(uid); - if (has_forbidden_bits_set(uid)) { - return PSA_ERROR_INVALID_ARGUMENT; - } - zms_ret = zms_write(&s_zms, zms_id, data, data_length); if (zms_ret == data_length) { psa_ret = PSA_SUCCESS; @@ -85,10 +81,6 @@ psa_status_t secure_storage_its_store_get(secure_storage_its_uid_t uid, size_t d ssize_t zms_ret; const uint32_t zms_id = zms_id_from(uid); - if (has_forbidden_bits_set(uid)) { - return PSA_ERROR_INVALID_ARGUMENT; - } - zms_ret = zms_read(&s_zms, zms_id, data, data_size); if (zms_ret > 0) { *data_length = zms_ret; @@ -108,10 +100,6 @@ psa_status_t secure_storage_its_store_remove(secure_storage_its_uid_t uid) int ret; const uint32_t zms_id = zms_id_from(uid); - if (has_forbidden_bits_set(uid)) { - return PSA_ERROR_INVALID_ARGUMENT; - } - ret = zms_delete(&s_zms, zms_id); LOG_DBG("%s 0x%x. (%d)", ret ? "Failed to delete" : "Deleted", zms_id, ret); From 2ce069884367ce0ea8a687ef0966dfaf8088a600 Mon Sep 17 00:00:00 2001 From: Tomi Fontanilles Date: Tue, 5 Aug 2025 15:58:21 +0300 Subject: [PATCH 0642/2141] [nrf fromlist] secure_storage: its: use %l printf length modifier Cast the UIDs to unsigned long when they are 32 bits. This allows to use a single %l length modifier instead of the double one for long long. Certain printf implementations only support the former and not the latter length modifier, so this has the advantage to work with them now that the UIDs are 32-bit by default. Signed-off-by: Tomi Fontanilles Upstream PR #: 94171 --- subsys/secure_storage/src/its/implementation.c | 11 +++++++++-- subsys/secure_storage/src/its/store/settings.c | 6 ++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/subsys/secure_storage/src/its/implementation.c b/subsys/secure_storage/src/its/implementation.c index b39fbf90b002..a2b7f97c3723 100644 --- a/subsys/secure_storage/src/its/implementation.c +++ b/subsys/secure_storage/src/its/implementation.c @@ -115,8 +115,15 @@ static bool keep_stored_entry(secure_storage_its_uid_t uid, size_t data_length, if (existing_data_len == data_length && existing_create_flags == create_flags && !memcmp(existing_data, p_data, data_length)) { - LOG_DBG("Not writing entry %u/%llu to storage because its stored data" - " (of length %zu) is identical.", uid.caller_id, uid.uid, data_length); +#ifdef CONFIG_SECURE_STORAGE_64_BIT_UID + LOG_DBG("Not writing entry %u/%#llx to storage because its stored data" + " (of length %zu) is identical.", uid.caller_id, + (unsigned long long)uid.uid, data_length); +#else + LOG_DBG("Not writing entry %u/%#lx to storage because its stored data" + " (of length %zu) is identical.", uid.caller_id, + (unsigned long)uid.uid, data_length); +#endif *ret = PSA_SUCCESS; return true; } diff --git a/subsys/secure_storage/src/its/store/settings.c b/subsys/secure_storage/src/its/store/settings.c index 962fa516770a..37973ffb0244 100644 --- a/subsys/secure_storage/src/its/store/settings.c +++ b/subsys/secure_storage/src/its/store/settings.c @@ -38,9 +38,15 @@ void secure_storage_its_store_settings_get_name( { int ret; +#ifdef CONFIG_SECURE_STORAGE_64_BIT_UID ret = snprintf(name, SECURE_STORAGE_ITS_STORE_SETTINGS_NAME_BUF_SIZE, CONFIG_SECURE_STORAGE_ITS_STORE_SETTINGS_PREFIX "%x/%llx", uid.caller_id, (unsigned long long)uid.uid); +#else + ret = snprintf(name, SECURE_STORAGE_ITS_STORE_SETTINGS_NAME_BUF_SIZE, + CONFIG_SECURE_STORAGE_ITS_STORE_SETTINGS_PREFIX "%x/%lx", + uid.caller_id, (unsigned long)uid.uid); +#endif __ASSERT_NO_MSG(ret > 0 && ret < SECURE_STORAGE_ITS_STORE_SETTINGS_NAME_BUF_SIZE); } From ad278796a43c4ccded4f18bc1ef984624c3b2f27 Mon Sep 17 00:00:00 2001 From: Tomi Fontanilles Date: Thu, 7 Aug 2025 13:38:20 +0300 Subject: [PATCH 0643/2141] Revert "[nrf noup] tests: secure_storage: fix test w/ ZMS backend on 54L15" This reverts commit ff0b9ad68007db349497f7a4cb33e3235e4473ea. Signed-off-by: Tomi Fontanilles --- tests/subsys/secure_storage/psa/its/testcase.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/subsys/secure_storage/psa/its/testcase.yaml b/tests/subsys/secure_storage/psa/its/testcase.yaml index 74bcec135863..05f1c1b9a6ac 100644 --- a/tests/subsys/secure_storage/psa/its/testcase.yaml +++ b/tests/subsys/secure_storage/psa/its/testcase.yaml @@ -28,7 +28,6 @@ tests: extra_args: - EXTRA_DTC_OVERLAY_FILE=zms.overlay - EXTRA_CONF_FILE=overlay-secure_storage.conf;overlay-store_zms.conf;overlay-transform_default.conf - - SB_CONFIG_PARTITION_MANAGER=n secure_storage.psa.its.secure_storage.store.settings: filter: CONFIG_SECURE_STORAGE_ITS_STORE_IMPLEMENTATION_SETTINGS From 5f0e7cdd3bd0d4096ac6f5368f03ab89f5ed5445 Mon Sep 17 00:00:00 2001 From: Tomi Fontanilles Date: Tue, 5 Aug 2025 16:18:39 +0300 Subject: [PATCH 0644/2141] [nrf fromlist] tests: secure_storage: psa: its: add test scenarios for 64-bit UIDs Add test scenarios for the newly-added CONFIG_SECURE_STORAGE_64_BIT_UID enabled with both the ZMS and Settings backends. They don't test backward compatibility but it makes sure that secure storage compiles and works fine with this configuration. Signed-off-by: Tomi Fontanilles Upstream PR #: 94171 --- .../secure_storage/psa/its/testcase.yaml | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/tests/subsys/secure_storage/psa/its/testcase.yaml b/tests/subsys/secure_storage/psa/its/testcase.yaml index 05f1c1b9a6ac..e0cf75c58955 100644 --- a/tests/subsys/secure_storage/psa/its/testcase.yaml +++ b/tests/subsys/secure_storage/psa/its/testcase.yaml @@ -10,10 +10,9 @@ common: - psa.secure_storage tests: secure_storage.psa.its.secure_storage.store.zms: - filter: CONFIG_SECURE_STORAGE_ITS_STORE_IMPLEMENTATION_ZMS # DT-based filtering is not possible for this test scenario. # Platforms with a storage_partition must be manually added here. - platform_allow: + platform_allow: &zms_platform_allow - native_sim - mps2/an385 - qemu_x86/atom @@ -25,14 +24,29 @@ tests: - nrf9160dk/nrf9160 - nrf9161dk/nrf9161 - ophelia4ev/nrf54l15/cpuapp - extra_args: + extra_args: &zms_extra_args - EXTRA_DTC_OVERLAY_FILE=zms.overlay - - EXTRA_CONF_FILE=overlay-secure_storage.conf;overlay-store_zms.conf;overlay-transform_default.conf + - EXTRA_CONF_FILE=\ + overlay-secure_storage.conf;overlay-store_zms.conf;overlay-transform_default.conf + + secure_storage.psa.its.secure_storage.store.zms.64-bit_uids: + platform_allow: *zms_platform_allow + extra_args: *zms_extra_args + extra_configs: + - CONFIG_SECURE_STORAGE_64_BIT_UID=y secure_storage.psa.its.secure_storage.store.settings: - filter: CONFIG_SECURE_STORAGE_ITS_STORE_IMPLEMENTATION_SETTINGS - extra_args: "EXTRA_CONF_FILE=\ - overlay-secure_storage.conf;overlay-transform_default.conf;overlay-store_settings.conf" + filter: &settings_filter + CONFIG_SECURE_STORAGE_ITS_STORE_IMPLEMENTATION_SETTINGS + extra_args: &settings_extra_args + "EXTRA_CONF_FILE=\ + overlay-secure_storage.conf;overlay-transform_default.conf;overlay-store_settings.conf" + + secure_storage.psa.its.secure_storage.store.settings.64-bit_uids: + filter: *settings_filter + extra_args: *settings_extra_args + extra_configs: + - CONFIG_SECURE_STORAGE_64_BIT_UID=y secure_storage.psa.its.secure_storage.custom.transform: filter: CONFIG_SECURE_STORAGE and not CONFIG_SECURE_STORAGE_ITS_STORE_IMPLEMENTATION_NONE From eb02a0210ff85ff00c9bacdf14c692f97d2e4d35 Mon Sep 17 00:00:00 2001 From: Tomi Fontanilles Date: Fri, 31 Jan 2025 14:47:05 +0200 Subject: [PATCH 0645/2141] [nrf noup] tests: secure_storage: fix test w/ ZMS backend on 54L15 noup because it's about partition manager. Fix the build of secure_storage.psa.its.secure_storage.store.zms on nrf54l15dk/nrf54l15/cpuapp by disabling partition manager, which is incompatible with the ZMS implementation of the ITS store module. Disabling it only for that test as it's not needed for the others and even makes the NS board targets fail if disabling PM. Signed-off-by: Tomi Fontanilles --- tests/subsys/secure_storage/psa/its/testcase.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/subsys/secure_storage/psa/its/testcase.yaml b/tests/subsys/secure_storage/psa/its/testcase.yaml index e0cf75c58955..a871c015117a 100644 --- a/tests/subsys/secure_storage/psa/its/testcase.yaml +++ b/tests/subsys/secure_storage/psa/its/testcase.yaml @@ -28,6 +28,7 @@ tests: - EXTRA_DTC_OVERLAY_FILE=zms.overlay - EXTRA_CONF_FILE=\ overlay-secure_storage.conf;overlay-store_zms.conf;overlay-transform_default.conf + - SB_CONFIG_PARTITION_MANAGER=n secure_storage.psa.its.secure_storage.store.zms.64-bit_uids: platform_allow: *zms_platform_allow From 2f40e49a5a6fdeeb23af70d80f00aabf15fca3a3 Mon Sep 17 00:00:00 2001 From: Tomi Fontanilles Date: Tue, 5 Aug 2025 16:22:46 +0300 Subject: [PATCH 0646/2141] [nrf fromlist] tests: secure_storage: psa: its: fix ZMS test 77f19eb1b5ce10d8ec2e906b736d3789f15565c6 made ZMS depend on FLASH_MAP. Enable that Kconfig option in the ZMS Kconfig overlay file. Signed-off-by: Tomi Fontanilles Upstream PR #: 94171 --- tests/subsys/secure_storage/psa/its/overlay-store_zms.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/subsys/secure_storage/psa/its/overlay-store_zms.conf b/tests/subsys/secure_storage/psa/its/overlay-store_zms.conf index 7efe611bc0a4..6c36dd402972 100644 --- a/tests/subsys/secure_storage/psa/its/overlay-store_zms.conf +++ b/tests/subsys/secure_storage/psa/its/overlay-store_zms.conf @@ -1,3 +1,4 @@ CONFIG_SECURE_STORAGE_ITS_STORE_IMPLEMENTATION_ZMS=y CONFIG_ZMS=y CONFIG_FLASH=y +CONFIG_FLASH_MAP=y From f9e3cfe8473ea45b23eebe781f0a6515139e7762 Mon Sep 17 00:00:00 2001 From: Tomi Fontanilles Date: Wed, 6 Aug 2025 15:00:10 +0300 Subject: [PATCH 0647/2141] [nrf fromlist] tests: secure_storage: remove an integration platform nrf54l15dk/nrf54l15/cpuapp already covers the non-emulated case as part of the integration_platforms. Having ophelia4ev/nrf54l15/cpuapp does not bring any additional value and increases CI load, so remove it. Signed-off-by: Tomi Fontanilles Upstream PR #: 94171 --- tests/subsys/secure_storage/psa/crypto/testcase.yaml | 1 - tests/subsys/secure_storage/psa/its/testcase.yaml | 1 - 2 files changed, 2 deletions(-) diff --git a/tests/subsys/secure_storage/psa/crypto/testcase.yaml b/tests/subsys/secure_storage/psa/crypto/testcase.yaml index 8755a5a19352..1482d23cb6c7 100644 --- a/tests/subsys/secure_storage/psa/crypto/testcase.yaml +++ b/tests/subsys/secure_storage/psa/crypto/testcase.yaml @@ -8,7 +8,6 @@ tests: integration_platforms: - native_sim - nrf54l15dk/nrf54l15/cpuapp - - ophelia4ev/nrf54l15/cpuapp secure_storage.psa.crypto.tfm: filter: CONFIG_BUILD_WITH_TFM extra_args: EXTRA_CONF_FILE=overlay-tfm.conf diff --git a/tests/subsys/secure_storage/psa/its/testcase.yaml b/tests/subsys/secure_storage/psa/its/testcase.yaml index a871c015117a..0125b9d1e210 100644 --- a/tests/subsys/secure_storage/psa/its/testcase.yaml +++ b/tests/subsys/secure_storage/psa/its/testcase.yaml @@ -2,7 +2,6 @@ common: integration_platforms: - native_sim - nrf54l15dk/nrf54l15/cpuapp - - ophelia4ev/nrf54l15/cpuapp platform_exclude: - qemu_cortex_m0 # settings subsystem initialization fails timeout: 600 From 5161a6a58af31aba9075eec78a7eb0134b6e5092 Mon Sep 17 00:00:00 2001 From: Tomi Fontanilles Date: Wed, 6 Aug 2025 14:54:18 +0300 Subject: [PATCH 0648/2141] [nrf fromlist] samples: psa: specify integration_platforms Explicitly specify native_sim as integration platform for better PR CI coverage. Signed-off-by: Tomi Fontanilles Upstream PR #: 94171 --- samples/psa/its/sample.yaml | 2 ++ samples/psa/persistent_key/sample.yaml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/samples/psa/its/sample.yaml b/samples/psa/its/sample.yaml index 8d67cddd1573..d3e7b7e10c9b 100644 --- a/samples/psa/its/sample.yaml +++ b/samples/psa/its/sample.yaml @@ -2,6 +2,8 @@ sample: name: PSA ITS API sample description: Demonstration of PSA Internal Trusted Storage (ITS) API usage. common: + integration_platforms: + - native_sim tags: - psa.secure_storage timeout: 10 diff --git a/samples/psa/persistent_key/sample.yaml b/samples/psa/persistent_key/sample.yaml index 490f2ea8f156..7c5b9d803004 100644 --- a/samples/psa/persistent_key/sample.yaml +++ b/samples/psa/persistent_key/sample.yaml @@ -2,6 +2,8 @@ sample: name: PSA Crypto persistent key sample description: Demonstration of persistent key usage in the PSA Crypto API. common: + integration_platforms: + - native_sim tags: - psa.secure_storage timeout: 10 From fdb9ab5d52bacff73a0bc00f47cddfb61d282edd Mon Sep 17 00:00:00 2001 From: Tomi Fontanilles Date: Tue, 5 Aug 2025 16:01:44 +0300 Subject: [PATCH 0649/2141] [nrf fromlist] secure_storage: use %# flag character for hex printing Instead of literally having 0x in the format string, use the %# flag character so the printf implementation adds the 0x for us. Signed-off-by: Tomi Fontanilles Upstream PR #: 94171 --- subsys/secure_storage/src/its/implementation.c | 2 +- subsys/secure_storage/src/its/store/zms.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/subsys/secure_storage/src/its/implementation.c b/subsys/secure_storage/src/its/implementation.c index a2b7f97c3723..6f33195a0628 100644 --- a/subsys/secure_storage/src/its/implementation.c +++ b/subsys/secure_storage/src/its/implementation.c @@ -27,7 +27,7 @@ static psa_status_t make_its_uid(secure_storage_its_caller_id_t caller_id, psa_s #ifndef CONFIG_SECURE_STORAGE_64_BIT_UID /* Check that the UID is not bigger than the maximum defined size. */ if (uid & GENMASK64(63, SECURE_STORAGE_ITS_UID_BIT_SIZE)) { - LOG_DBG("UID %u/0x%llx cannot be used as it has bits set past " + LOG_DBG("UID %u/%#llx cannot be used as it has bits set past " "the first " STRINGIFY(SECURE_STORAGE_ITS_UID_BIT_SIZE) " ones.", caller_id, (unsigned long long)uid); return PSA_ERROR_INVALID_ARGUMENT; diff --git a/subsys/secure_storage/src/its/store/zms.c b/subsys/secure_storage/src/its/store/zms.c index 3a3bdd64c762..4778e0365e91 100644 --- a/subsys/secure_storage/src/its/store/zms.c +++ b/subsys/secure_storage/src/its/store/zms.c @@ -69,7 +69,7 @@ psa_status_t secure_storage_its_store_set(secure_storage_its_uid_t uid, } else { psa_ret = PSA_ERROR_STORAGE_FAILURE; } - LOG_DBG("%s 0x%x with %zu bytes. (%zd)", (psa_ret == PSA_SUCCESS) ? + LOG_DBG("%s %#x with %zu bytes. (%zd)", (psa_ret == PSA_SUCCESS) ? "Wrote" : "Failed to write", zms_id, data_length, zms_ret); return psa_ret; } @@ -90,7 +90,7 @@ psa_status_t secure_storage_its_store_get(secure_storage_its_uid_t uid, size_t d } else { psa_ret = PSA_ERROR_STORAGE_FAILURE; } - LOG_DBG("%s 0x%x for up to %zu bytes. (%zd)", (psa_ret != PSA_ERROR_STORAGE_FAILURE) ? + LOG_DBG("%s %#x for up to %zu bytes. (%zd)", (psa_ret != PSA_ERROR_STORAGE_FAILURE) ? "Read" : "Failed to read", zms_id, data_size, zms_ret); return psa_ret; } @@ -101,7 +101,7 @@ psa_status_t secure_storage_its_store_remove(secure_storage_its_uid_t uid) const uint32_t zms_id = zms_id_from(uid); ret = zms_delete(&s_zms, zms_id); - LOG_DBG("%s 0x%x. (%d)", ret ? "Failed to delete" : "Deleted", zms_id, ret); + LOG_DBG("%s %#x. (%d)", ret ? "Failed to delete" : "Deleted", zms_id, ret); return ret ? PSA_ERROR_STORAGE_FAILURE : PSA_SUCCESS; } From 804a1d59154a63351e29d6cf294e3b462220d5cd Mon Sep 17 00:00:00 2001 From: Tomi Fontanilles Date: Wed, 6 Aug 2025 15:59:28 +0300 Subject: [PATCH 0650/2141] [nrf fromlist] doc: secure_storage: document the 30-bit UID Add a bullet point for this new, relatively important deviation from the official specification. Also, advertise the Zephyr-specific zephyr/psa/* header files as they are related and probably need more attention from end users. Signed-off-by: Tomi Fontanilles Upstream PR #: 94171 --- doc/services/storage/secure_storage/index.rst | 11 ++++++++++- .../internal/zephyr/secure_storage/its/common.h | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/doc/services/storage/secure_storage/index.rst b/doc/services/storage/secure_storage/index.rst index 57f7dc03b27e..1829b435ea96 100644 --- a/doc/services/storage/secure_storage/index.rst +++ b/doc/services/storage/secure_storage/index.rst @@ -43,9 +43,18 @@ The secure storage subsystem's implementation of the PSA Secure Storage API: Instead, the PS API directly calls into the Internal Trusted Storage (ITS) API (unless a `custom implementation <#whole-api>`_ of the PS API is provided). -Below are some ways the implementation deviates from the specification +Below are some ways the implementation purposefully deviates from the specification and an explanation why. This is not an exhaustive list. +* The UID type is only 30 bits by default. (Against `2.5 UIDs `_.) + + | This is an optimization done to make it more convenient to directly use the UIDs as + storage entry IDs (e.g., with :ref:`ZMS ` when + :kconfig:option:`CONFIG_SECURE_STORAGE_ITS_STORE_IMPLEMENTATION_ZMS` is enabled). + | Zephyr defines numerical ranges to be used by different users of the API which guarantees that + there are no collisions and that they all fit within 30 bits. + See the header files in :zephyr_file:`include/zephyr/psa` for more information. + * The data stored in the ITS is by default encrypted and authenticated (Against ``1.`` in `3.2. Internal Trusted Storage requirements `_.) diff --git a/subsys/secure_storage/include/internal/zephyr/secure_storage/its/common.h b/subsys/secure_storage/include/internal/zephyr/secure_storage/its/common.h index f0576cba185f..6ffc1bc78f57 100644 --- a/subsys/secure_storage/include/internal/zephyr/secure_storage/its/common.h +++ b/subsys/secure_storage/include/internal/zephyr/secure_storage/its/common.h @@ -39,6 +39,7 @@ typedef struct { * smaller IDs compared to the 64-bit ones that PSA Secure Storage specifies. * Zephyr defines ranges of IDs to be used by different users of the API (subsystems, application) * which guarantees 1. no collisions and 2. that the IDs used fit within `uid`. + * @see @ref zephyr/psa/key_ids.h and the other header files under `zephyr/psa`. */ typedef struct { psa_storage_uid_t uid : SECURE_STORAGE_ITS_UID_BIT_SIZE; From 319b359ae7669cd64ba3adec65034a4a4e4a5535 Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Mon, 11 Aug 2025 14:19:17 +0200 Subject: [PATCH 0651/2141] [nrf noup] tests: bluetooth: bt_crypto: Use TFM_PROFILE_TYPE_NOT_SET The default TFM profile type Minimal in NCS doesn't have all algorithms needed by this test. Signed-off-by: Pavel Vasilyev --- .../bluetooth/bt_crypto/boards/nrf5340dk_nrf5340_cpuapp_ns.conf | 1 + 1 file changed, 1 insertion(+) create mode 100644 tests/bluetooth/bt_crypto/boards/nrf5340dk_nrf5340_cpuapp_ns.conf diff --git a/tests/bluetooth/bt_crypto/boards/nrf5340dk_nrf5340_cpuapp_ns.conf b/tests/bluetooth/bt_crypto/boards/nrf5340dk_nrf5340_cpuapp_ns.conf new file mode 100644 index 000000000000..516f4d9eb784 --- /dev/null +++ b/tests/bluetooth/bt_crypto/boards/nrf5340dk_nrf5340_cpuapp_ns.conf @@ -0,0 +1 @@ +CONFIG_TFM_PROFILE_TYPE_NOT_SET=y From e54b99492bc3df78612eabb5743509de8338a9a3 Mon Sep 17 00:00:00 2001 From: Jakub Zymelka Date: Tue, 12 Aug 2025 09:49:41 +0200 Subject: [PATCH 0652/2141] [nrf fromlist] drivers: adc: nrfx: fix for negative samples in single-mode We need to check value of the sample not the pointer. Upstream PR #: 91368 Signed-off-by: Jakub Zymelka --- drivers/adc/adc_nrfx_saadc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/adc/adc_nrfx_saadc.c b/drivers/adc/adc_nrfx_saadc.c index 9b0f59084b62..d62101910d7f 100644 --- a/drivers/adc/adc_nrfx_saadc.c +++ b/drivers/adc/adc_nrfx_saadc.c @@ -541,7 +541,7 @@ static inline void single_ended_channel_cut_negative_sample(uint16_t channel_bit uint8_t single_ended_channels, int16_t **sample) { - if ((channel_bit & single_ended_channels) && (*sample < 0)) { + if ((channel_bit & single_ended_channels) && (**sample < 0)) { **sample = 0; } From 2158e6b9d71fe7582c0b3bd6fd8827352b26fc19 Mon Sep 17 00:00:00 2001 From: Jakub Zymelka Date: Tue, 12 Aug 2025 10:52:52 +0200 Subject: [PATCH 0653/2141] [nrf fromlist] drivers: adc: nrfx: Temporary fix for SAADC power consumption This is temporary fix for SAADC power consumption. Need to be removed after hal_nrfx version upgrade. Upstream PR #: 94383 Signed-off-by: Jakub Zymelka --- drivers/adc/adc_nrfx_saadc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/adc/adc_nrfx_saadc.c b/drivers/adc/adc_nrfx_saadc.c index d62101910d7f..499d7c4b1108 100644 --- a/drivers/adc/adc_nrfx_saadc.c +++ b/drivers/adc/adc_nrfx_saadc.c @@ -755,6 +755,7 @@ static void event_handler(const nrfx_saadc_evt_t *event) correct_single_ended(&m_data.ctx.sequence, m_data.user_buffer, event->data.done.size); } + nrfy_saadc_disable(NRF_SAADC); adc_context_on_sampling_done(&m_data.ctx, DEVICE_DT_INST_GET(0)); } else if (event->type == NRFX_SAADC_EVT_CALIBRATEDONE) { err = nrfx_saadc_mode_trigger(); From 139789b0b648c24b1a2dcbd5047725e213cf4f37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Fri, 8 Aug 2025 08:21:53 +0200 Subject: [PATCH 0654/2141] [nrf fromlist] drivers: timer: nrf_rtc: Fix custom wrapping MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use channel 0 for RTC wrapping. Skip that channel when processing channels. Fix algorithm that prevents setting CC=0 when custom wrapping is used. Upstream PR #: 94259 Signed-off-by: Krzysztof Chruściński --- drivers/timer/nrf_rtc_timer.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/timer/nrf_rtc_timer.c b/drivers/timer/nrf_rtc_timer.c index a70cc19b7e9b..d689365665ed 100644 --- a/drivers/timer/nrf_rtc_timer.c +++ b/drivers/timer/nrf_rtc_timer.c @@ -21,10 +21,12 @@ #if (CONFIG_NRF_RTC_COUNTER_BIT_WIDTH < RTC_BIT_WIDTH) #define CUSTOM_COUNTER_BIT_WIDTH 1 -#define WRAP_CH 1 +#define WRAP_CH 0 +#define SYS_CLOCK_CH 1 #include "nrfx_ppi.h" #else #define CUSTOM_COUNTER_BIT_WIDTH 0 +#define SYS_CLOCK_CH 0 #endif #define RTC_PRETICK (IS_ENABLED(CONFIG_SOC_NRF53_RTC_PRETICK) && \ @@ -37,7 +39,6 @@ #define RTC_IRQn NRFX_IRQ_NUMBER_GET(RTC) #define RTC_LABEL rtc1 #define CHAN_COUNT_MAX (RTC1_CC_NUM - (RTC_PRETICK ? 1 : 0)) -#define SYS_CLOCK_CH 0 BUILD_ASSERT(CHAN_COUNT <= CHAN_COUNT_MAX, "Not enough compare channels"); /* Ensure that counter driver for RTC1 is not enabled. */ @@ -275,15 +276,6 @@ static int set_alarm(int32_t chan, uint32_t req_cc, bool exact) */ enum { MIN_CYCLES_FROM_NOW = 3 }; uint32_t cc_val = req_cc; - -#if CUSTOM_COUNTER_BIT_WIDTH - /* If a CC value is 0 when a CLEAR task is set, this will not - * trigger a COMAPRE event. Need to use 1 instead. - */ - if (cc_val % COUNTER_MAX == 0) { - cc_val = 1; - } -#endif uint32_t cc_inc = MIN_CYCLES_FROM_NOW; /* Disable event routing for the channel to avoid getting a COMPARE @@ -299,6 +291,14 @@ static int set_alarm(int32_t chan, uint32_t req_cc, bool exact) for (;;) { uint32_t now; +#if CUSTOM_COUNTER_BIT_WIDTH + /* If a CC value is 0 when a CLEAR task is set, this will not + * trigger a COMAPRE event. Need to use 1 instead. + */ + if ((cc_val & COUNTER_MAX) == 0) { + cc_val = 1; + } +#endif set_comparator(chan, cc_val); /* Enable event routing after the required CC value was set. * Even though the above operation may get repeated (see below), @@ -597,8 +597,8 @@ void rtc_nrf_isr(const void *arg) } #if CUSTOM_COUNTER_BIT_WIDTH - if (nrfy_rtc_int_enable_check(RTC, NRF_RTC_INT_COMPARE1_MASK) && - nrfy_rtc_events_process(RTC, NRF_RTC_INT_COMPARE1_MASK)) { + if (nrfy_rtc_int_enable_check(RTC, NRF_RTC_CHANNEL_INT_MASK(WRAP_CH)) && + nrfy_rtc_events_process(RTC, NRF_RTC_CHANNEL_INT_MASK(WRAP_CH))) { #else if (nrfy_rtc_int_enable_check(RTC, NRF_RTC_INT_OVERFLOW_MASK) && nrfy_rtc_events_process(RTC, NRF_RTC_INT_OVERFLOW_MASK)) { @@ -606,7 +606,7 @@ void rtc_nrf_isr(const void *arg) overflow_cnt++; } - for (int32_t chan = 0; chan < CHAN_COUNT; chan++) { + for (int32_t chan = SYS_CLOCK_CH; chan < CHAN_COUNT; chan++) { process_channel(chan); } } From 82973b4f6d2a80e46775d336d20d3d57f09da409 Mon Sep 17 00:00:00 2001 From: Maximilian Deubel Date: Fri, 1 Aug 2025 13:22:13 +0200 Subject: [PATCH 0655/2141] [nrf fromtree] net: lib: tls_credentials: add invalid sec tag value Add a definition for an invalid secure tag value to be used as a placeholder. Negative values are reserved for internal use, but some of them should be considered valid. To be able to check against a value, we need to define an invalid one. (cherry picked from commit 59a8eebd18eabdd793ad675b3b0befebbf00dddc) Signed-off-by: Maximilian Deubel --- include/zephyr/net/tls_credentials.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/zephyr/net/tls_credentials.h b/include/zephyr/net/tls_credentials.h index 1002eee7e64b..d4bce6cd6fe5 100644 --- a/include/zephyr/net/tls_credentials.h +++ b/include/zephyr/net/tls_credentials.h @@ -77,6 +77,8 @@ enum tls_credential_type { */ typedef int sec_tag_t; +#define SEC_TAG_TLS_INVALID (-1) /**< Invalid secure tag value. */ + /** * @brief Add a TLS credential. * From 809e846366f267496984d3a14fb40a347dc360a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20St=C4=99pnicki?= Date: Fri, 27 Jun 2025 14:21:38 +0200 Subject: [PATCH 0656/2141] [nrf fromtree] tests: kernel: interrupt: generic ISR offset definition for nrf54h20 VPRs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit All VPRs in nrf54h20 can have same ISR offset configuration. (cherry picked from commit d7fd99ecc631c12b19ddc24ab23b524fd5af7372) Signed-off-by: Łukasz Stępnicki --- tests/kernel/interrupt/src/nested_irq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/kernel/interrupt/src/nested_irq.c b/tests/kernel/interrupt/src/nested_irq.c index 6bfc81b8965c..99ebe7a35e97 100644 --- a/tests/kernel/interrupt/src/nested_irq.c +++ b/tests/kernel/interrupt/src/nested_irq.c @@ -63,7 +63,7 @@ #define IRQ0_PRIO 1 #define IRQ1_PRIO 2 -#elif defined(CONFIG_SOC_NRF54H20_CPUPPR) +#elif defined(CONFIG_SOC_SERIES_NRF54HX) && defined(CONFIG_RISCV_CORE_NORDIC_VPR) #define IRQ0_LINE 14 #define IRQ1_LINE 15 From 04dbe2e567ecae84c575a335a22a8aa8895bfbf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20St=C4=99pnicki?= Date: Thu, 7 Aug 2025 15:25:33 +0200 Subject: [PATCH 0657/2141] [nrf fromlist] tests: kernel: interrupt: generic ISR offset definition for nrf54h20 VPRs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit All VPRs in nrf54h20 can have same ISR offset configuration. Upstream PR #: 94224 Signed-off-by: Łukasz Stępnicki --- tests/kernel/gen_isr_table/src/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/kernel/gen_isr_table/src/main.c b/tests/kernel/gen_isr_table/src/main.c index d3e3291573a7..fdea6d3bd985 100644 --- a/tests/kernel/gen_isr_table/src/main.c +++ b/tests/kernel/gen_isr_table/src/main.c @@ -26,7 +26,7 @@ extern uintptr_t _irq_vector_table[]; #define ISR3_OFFSET 17 #define ISR5_OFFSET 18 #define TRIG_CHECK_SIZE 19 -#elif defined(CONFIG_SOC_NRF54H20_CPUPPR) || defined(CONFIG_SOC_NRF54H20_CPUFLPR) +#elif defined(CONFIG_SOC_SERIES_NRF54HX) && defined(CONFIG_RISCV_CORE_NORDIC_VPR) #define ISR1_OFFSET 14 #define ISR3_OFFSET 15 #define ISR5_OFFSET 16 From 28dd6d642251104d3f1cf5b27d7641b36d070757 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Thu, 31 Jul 2025 10:58:32 +0200 Subject: [PATCH 0658/2141] [nrf fromtree] manifest: Update nRF hw models to latest Update the HW models module to: 40403f5f2805cca210d2a47c8717d89c4e816cda Including the following: 40403f5 TIMER: Bugfix: Be sure to not use more than BITMODE bits e1a976c RTC: Bugfix: Be sure to not use more than 24bits of CC like the HW bfb5309 doc: Add nRF54LM20 to table of supported HW Signed-off-by: Alberto Escolar Piedras (cherry picked from commit b0e6471cee39f64e87558f11f4fde9e01bb31a8e) --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index cce707f4bedd..9036b6d589f6 100644 --- a/west.yml +++ b/west.yml @@ -325,7 +325,7 @@ manifest: groups: - tools - name: nrf_hw_models - revision: 8b6001d6bdd9e2c8bb858fdb26f696f6d5f73db5 + revision: 40403f5f2805cca210d2a47c8717d89c4e816cda path: modules/bsim_hw_models/nrf_hw_models - name: nrf_wifi revision: 787eea1a3c8dd13c86214e204a919e6f9bcebf91 From d24c26f9852942beb447cd6a352aa95873fb6b7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Bainczyk?= Date: Wed, 13 Aug 2025 10:33:25 +0200 Subject: [PATCH 0659/2141] [nrf fromlist] tests: boards: nrf: qdec: Fix test for nRF54L15 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added additional cleanups between tests, which fixed the issue of a failing testcase on nRF54L15. Upstream PR #: 93927 Signed-off-by: Michał Bainczyk --- tests/boards/nrf/qdec/src/main.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/boards/nrf/qdec/src/main.c b/tests/boards/nrf/qdec/src/main.c index 9d138d325fb5..6bc867f8aa9c 100644 --- a/tests/boards/nrf/qdec/src/main.c +++ b/tests/boards/nrf/qdec/src/main.c @@ -60,6 +60,11 @@ static void qdec_trigger_handler(const struct device *dev, const struct sensor_t static void qenc_emulate_work_handler(struct k_work *work) { + /* Check if emulation has been stopped after submitting this work item. */ + if (loopback_currently_under_test == NULL) { + return; + } + if (toggle_a) { gpio_pin_toggle_dt(&loopback_currently_under_test->qenc_phase_a); } else { @@ -113,6 +118,8 @@ static void qenc_emulate_stop(void) k_timer_stop(&qenc_emulate_timer); qenc_emulate_reset_pin(&loopback_currently_under_test->qenc_phase_a); qenc_emulate_reset_pin(&loopback_currently_under_test->qenc_phase_b); + + loopback_currently_under_test = NULL; } } @@ -218,6 +225,9 @@ static void sensor_trigger_set_and_disable(struct qdec_qenc_loopback *loopback) if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { pm_device_runtime_put(loopback->qdec); } + + qenc_emulate_stop(); + k_sem_reset(&sem); } /** @@ -270,8 +280,7 @@ static void sensor_trigger_set_test(struct qdec_qenc_loopback *loopback) } qenc_emulate_stop(); - /* emulation not working, but there may be old trigger which needs to be cleaned up */ - rc = k_sem_take(&sem, K_MSEC(200)); + k_sem_reset(&sem); } /** @@ -571,6 +580,7 @@ static void after(void *fixture) ARG_UNUSED(fixture); qenc_emulate_stop(); + k_sem_reset(&sem); } ZTEST_SUITE(qdec_sensor, NULL, setup, before, after, NULL); From 06b71687856dd61331c3eaaef08191938e2e9738 Mon Sep 17 00:00:00 2001 From: Bartosz Miller Date: Mon, 11 Aug 2025 10:31:36 +0200 Subject: [PATCH 0660/2141] [nrf fromtree] samples: subsys: ipc: Run multi-endpoint IPC sample on nrf54h20 Extend IPC multi-endpont sample for 54h20 Signed-off-by: Bartosz Miller (cherry picked from commit 86fb21502c86b0ca4f1151ef3594a7bf6a7bf46c) --- .../ipc_service/multi_endpoint/CMakeLists.txt | 8 +-- .../multi_endpoint/Kconfig.sysbuild | 5 +- .../boards/nrf54h20dk_nrf54h20_cpuapp.conf | 1 + .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 50 +++++++++++++++++++ .../boards/nrf54h20dk_nrf54h20_cpurad.overlay | 50 +++++++++++++++++++ .../ipc_service/multi_endpoint/sample.yaml | 2 + .../ipc/ipc_service/multi_endpoint/src/main.c | 1 + 7 files changed, 109 insertions(+), 8 deletions(-) create mode 100644 samples/subsys/ipc/ipc_service/multi_endpoint/boards/nrf54h20dk_nrf54h20_cpuapp.conf create mode 100644 samples/subsys/ipc/ipc_service/multi_endpoint/boards/nrf54h20dk_nrf54h20_cpuapp.overlay create mode 100644 samples/subsys/ipc/ipc_service/multi_endpoint/remote/boards/nrf54h20dk_nrf54h20_cpurad.overlay diff --git a/samples/subsys/ipc/ipc_service/multi_endpoint/CMakeLists.txt b/samples/subsys/ipc/ipc_service/multi_endpoint/CMakeLists.txt index fca156d9fe2d..d8c7b1367e8e 100644 --- a/samples/subsys/ipc/ipc_service/multi_endpoint/CMakeLists.txt +++ b/samples/subsys/ipc/ipc_service/multi_endpoint/CMakeLists.txt @@ -8,11 +8,7 @@ cmake_minimum_required(VERSION 3.20.0) find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -if(NOT CONFIG_BOARD_NRF5340DK_NRF5340_CPUAPP AND - NOT CONFIG_BOARD_NRF5340BSIM_NRF5340_CPUAPP ) - message(FATAL_ERROR "${BOARD} is not supported for this sample") -endif() - project(ipc_service) -target_sources(app PRIVATE src/main.c) +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/subsys/ipc/ipc_service/multi_endpoint/Kconfig.sysbuild b/samples/subsys/ipc/ipc_service/multi_endpoint/Kconfig.sysbuild index 5e4c6d497cfb..abaec58fdf45 100644 --- a/samples/subsys/ipc/ipc_service/multi_endpoint/Kconfig.sysbuild +++ b/samples/subsys/ipc/ipc_service/multi_endpoint/Kconfig.sysbuild @@ -6,5 +6,6 @@ source "share/sysbuild/Kconfig" config NET_CORE_BOARD string - default "nrf5340dk/nrf5340/cpunet" if $(BOARD) = "nrf5340dk" - default "nrf5340bsim/nrf5340/cpunet" if $(BOARD) = "nrf5340bsim" + default "$(BOARD)/nrf5340/cpunet" if $(BOARD) = "nrf5340dk" + default "$(BOARD)/nrf5340/cpunet" if $(BOARD) = "nrf5340bsim" + default "$(BOARD)/nrf54h20/cpurad" if $(BOARD) = "nrf54h20dk" diff --git a/samples/subsys/ipc/ipc_service/multi_endpoint/boards/nrf54h20dk_nrf54h20_cpuapp.conf b/samples/subsys/ipc/ipc_service/multi_endpoint/boards/nrf54h20dk_nrf54h20_cpuapp.conf new file mode 100644 index 000000000000..a6fa5758d9ae --- /dev/null +++ b/samples/subsys/ipc/ipc_service/multi_endpoint/boards/nrf54h20dk_nrf54h20_cpuapp.conf @@ -0,0 +1 @@ +CONFIG_SOC_NRF54H20_CPURAD_ENABLE=y diff --git a/samples/subsys/ipc/ipc_service/multi_endpoint/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/samples/subsys/ipc/ipc_service/multi_endpoint/boards/nrf54h20dk_nrf54h20_cpuapp.overlay new file mode 100644 index 000000000000..1698d7a800d4 --- /dev/null +++ b/samples/subsys/ipc/ipc_service/multi_endpoint/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -0,0 +1,50 @@ +/ { + reserved-memory { + /delete-node/ memory@2f0bf000; + /delete-node/ memory@2f0bf800; + + cpuapp_cpurad_ipc_shm_a: memory@2f0bf000 { + reg = <0x2f0bf000 DT_SIZE_K(1)>; + }; + + cpurad_cpuapp_ipc_shm_a: memory@2f0bf400 { + reg = <0x2f0bf400 DT_SIZE_K(1)>; + }; + + cpuapp_cpurad_ipc_shm_b: memory@2f0bf800 { + reg = <0x2f0bf800 DT_SIZE_K(1)>; + }; + + cpurad_cpuapp_ipc_shm_b: memory@2f0bfC00 { + reg = <0x2f0bfC00 DT_SIZE_K(1)>; + }; + }; + + ipc { + cpuapp_cpurad_ipc_b: ipc-2-3-b { + compatible = "zephyr,ipc-icbmsg"; + dcache-alignment = <32>; + status = "okay"; + mboxes = <&cpuapp_bellboard 20>, + <&cpurad_bellboard 14>; + }; + }; +}; + +&cpuapp_bellboard { + nordic,interrupt-mapping = <0x146041 0x0>; +}; + +&ipc0 { + tx-region = <&cpuapp_cpurad_ipc_shm_a>; + rx-region = <&cpurad_cpuapp_ipc_shm_a>; +}; + +ipc1: &cpuapp_cpurad_ipc_b { + status = "okay"; + mbox-names = "rx", "tx"; + tx-region = <&cpuapp_cpurad_ipc_shm_b>; + rx-region = <&cpurad_cpuapp_ipc_shm_b>; + tx-blocks = <32>; + rx-blocks = <32>; +}; diff --git a/samples/subsys/ipc/ipc_service/multi_endpoint/remote/boards/nrf54h20dk_nrf54h20_cpurad.overlay b/samples/subsys/ipc/ipc_service/multi_endpoint/remote/boards/nrf54h20dk_nrf54h20_cpurad.overlay new file mode 100644 index 000000000000..26ef0518b8b5 --- /dev/null +++ b/samples/subsys/ipc/ipc_service/multi_endpoint/remote/boards/nrf54h20dk_nrf54h20_cpurad.overlay @@ -0,0 +1,50 @@ +/ { + reserved-memory { + /delete-node/ memory@2f0bf000; + /delete-node/ memory@2f0bf800; + + cpuapp_cpurad_ipc_shm_a: memory@2f0bf000 { + reg = <0x2f0bf000 DT_SIZE_K(1)>; + }; + + cpurad_cpuapp_ipc_shm_a: memory@2f0bf400 { + reg = <0x2f0bf400 DT_SIZE_K(1)>; + }; + + cpuapp_cpurad_ipc_shm_b: memory@2f0bf800 { + reg = <0x2f0bf800 DT_SIZE_K(1)>; + }; + + cpurad_cpuapp_ipc_shm_b: memory@2f0bfC00 { + reg = <0x2f0bfC00 DT_SIZE_K(1)>; + }; + }; + + ipc { + cpuapp_cpurad_ipc_b: ipc-2-3-b { + compatible = "zephyr,ipc-icbmsg"; + dcache-alignment = <32>; + status = "okay"; + mboxes = <&cpuapp_bellboard 20>, + <&cpurad_bellboard 14>; + }; + }; +}; + +&cpurad_bellboard { + nordic,interrupt-mapping = <0x5041 0>; +}; + +&ipc0 { + tx-region = <&cpurad_cpuapp_ipc_shm_a>; + rx-region = <&cpuapp_cpurad_ipc_shm_a>; +}; + +ipc1: &cpuapp_cpurad_ipc_b { + status = "okay"; + mbox-names = "tx", "rx"; + tx-region = <&cpurad_cpuapp_ipc_shm_b>; + rx-region = <&cpuapp_cpurad_ipc_shm_b>; + tx-blocks = <32>; + rx-blocks = <32>; +}; diff --git a/samples/subsys/ipc/ipc_service/multi_endpoint/sample.yaml b/samples/subsys/ipc/ipc_service/multi_endpoint/sample.yaml index 4505f76ac519..1e08253ca2ba 100644 --- a/samples/subsys/ipc/ipc_service/multi_endpoint/sample.yaml +++ b/samples/subsys/ipc/ipc_service/multi_endpoint/sample.yaml @@ -17,9 +17,11 @@ tests: platform_allow: - nrf5340dk/nrf5340/cpuapp - nrf5340bsim/nrf5340/cpuapp + - nrf54h20dk/nrf54h20/cpuapp integration_platforms: - nrf5340dk/nrf5340/cpuapp - nrf5340bsim/nrf5340/cpuapp + - nrf54h20dk/nrf54h20/cpuapp tags: ipc sysbuild: true sample.ipc.multi_endpoint.icbmsg: diff --git a/samples/subsys/ipc/ipc_service/multi_endpoint/src/main.c b/samples/subsys/ipc/ipc_service/multi_endpoint/src/main.c index 4ad5659df382..d7d74daaf107 100644 --- a/samples/subsys/ipc/ipc_service/multi_endpoint/src/main.c +++ b/samples/subsys/ipc/ipc_service/multi_endpoint/src/main.c @@ -228,6 +228,7 @@ static void ipc1_entry(void *dummy0, void *dummy1, void *dummy2) return; } + printf("Waiting for bind\n"); k_sem_take(&ipc1_bound_sem, K_FOREVER); /* From fa08cc6afe0e53ef1d6db5cc8d7e46f9a99365a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Stasiak?= Date: Mon, 11 Aug 2025 11:05:24 +0200 Subject: [PATCH 0661/2141] [nrf fromtree] modules: hal_nordic: remove deprecated error code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit NRFX_ERROR_ALREADY_INITIALIZED has beed deprecated and repleaced by NRFX_ERROR_ALREADY. Signed-off-by: Michał Stasiak (cherry picked from commit 4abc1dd67cea2573bf29c2fda5fabbe8e884eede) --- drivers/usb/device/usb_dc_nrfx.c | 2 +- modules/hal_nordic/nrfx/nrfx_glue.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/device/usb_dc_nrfx.c b/drivers/usb/device/usb_dc_nrfx.c index d7e56167120b..c8bbfd40ada8 100644 --- a/drivers/usb/device/usb_dc_nrfx.c +++ b/drivers/usb/device/usb_dc_nrfx.c @@ -1914,7 +1914,7 @@ static int usb_init(void) return -EIO; } - /* Ignore the return value, as NRFX_ERROR_ALREADY_INITIALIZED is not + /* Ignore the return value, as NRFX_ERROR_ALREADY is not * a problem here. */ (void)nrfx_power_init(&power_config); diff --git a/modules/hal_nordic/nrfx/nrfx_glue.c b/modules/hal_nordic/nrfx/nrfx_glue.c index 54696efd122e..4e7fc94e11de 100644 --- a/modules/hal_nordic/nrfx/nrfx_glue.c +++ b/modules/hal_nordic/nrfx/nrfx_glue.c @@ -38,7 +38,7 @@ char const *nrfx_error_string_get(nrfx_err_t code) NRFX_ERROR_STRING_CASE(NRFX_ERROR_NULL); NRFX_ERROR_STRING_CASE(NRFX_ERROR_INVALID_ADDR); NRFX_ERROR_STRING_CASE(NRFX_ERROR_BUSY); - NRFX_ERROR_STRING_CASE(NRFX_ERROR_ALREADY_INITIALIZED); + NRFX_ERROR_STRING_CASE(NRFX_ERROR_ALREADY); NRFX_ERROR_STRING_CASE(NRFX_ERROR_DRV_TWI_ERR_OVERRUN); NRFX_ERROR_STRING_CASE(NRFX_ERROR_DRV_TWI_ERR_ANACK); NRFX_ERROR_STRING_CASE(NRFX_ERROR_DRV_TWI_ERR_DNACK); From 8f6f73e398f415c08bfa9ae7e3b02e03eb66c46e Mon Sep 17 00:00:00 2001 From: Jakub Zymelka Date: Thu, 17 Apr 2025 13:21:49 +0200 Subject: [PATCH 0662/2141] [nrf fromtree] soc: nordic: common: poweroff: Set VPR to remain in its reset state CM33 must write MEMCONF.POWER[VPR].RET = 0 before entering System OFF. This bit drives the vprSavedCtx input to VPR. Forcing it low will disable the Hibernate wake feature in VPR, so that VPR will remain in its reset state when waking from OFF. (cherry picked from commit f87f2dc9b29e6908ea0f2cf3095a2484328ef6ab) Signed-off-by: Jakub Zymelka --- soc/nordic/common/poweroff.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/soc/nordic/common/poweroff.c b/soc/nordic/common/poweroff.c index 857b2f38078a..ebce3aae77cd 100644 --- a/soc/nordic/common/poweroff.c +++ b/soc/nordic/common/poweroff.c @@ -16,12 +16,18 @@ #endif #if defined(CONFIG_SOC_SERIES_NRF54LX) #include +#include #endif #if defined(CONFIG_HAS_NORDIC_RAM_CTRL) #include #endif +#if defined(CONFIG_SOC_SERIES_NRF54LX) +#define VPR_POWER_IDX 1 +#define VPR_RET_BIT MEMCONF_POWER_RET_MEM0_Pos +#endif + void z_sys_poweroff(void) { #if defined(CONFIG_HAS_NORDIC_RAM_CTRL) @@ -59,6 +65,9 @@ void z_sys_poweroff(void) #endif #if defined(CONFIG_SOC_SERIES_NRF54LX) + /* Set VPR to remain in its reset state when waking from OFF */ + nrf_memconf_ramblock_ret_enable_set(NRF_MEMCONF, VPR_POWER_IDX, VPR_RET_BIT, false); + nrfx_reset_reason_clear(UINT32_MAX); #endif #if defined(CONFIG_SOC_SERIES_NRF51X) || defined(CONFIG_SOC_SERIES_NRF52X) From 70e7ab3812919e7d9562ff4ee243be806d1982f3 Mon Sep 17 00:00:00 2001 From: James Roy Date: Thu, 12 Jun 2025 20:31:47 +0800 Subject: [PATCH 0663/2141] [nrf fromtree] scripts: ci: Add CI bindings style checker MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implement a check in the CI pipeline to enforce that property names in device tree bindings do not contain underscores. Signed-off-by: James Roy Signed-off-by: Martí Bolívar (cherry picked from commit 4240853a06b83a0d5d49a5e80697f4a6485a3a76) --- scripts/bindings_properties_allowlist.yaml | 11 ++ scripts/ci/check_compliance.py | 117 +++++++++++++++------ 2 files changed, 98 insertions(+), 30 deletions(-) create mode 100644 scripts/bindings_properties_allowlist.yaml diff --git a/scripts/bindings_properties_allowlist.yaml b/scripts/bindings_properties_allowlist.yaml new file mode 100644 index 000000000000..100d4d380fbf --- /dev/null +++ b/scripts/bindings_properties_allowlist.yaml @@ -0,0 +1,11 @@ +# This file is a YAML allowlist of property names that are allowed to +# bypass the underscore check in bindings. These properties are exempt +# from the rule that requires using '-' instead of '_'. +# +# The file content can be as shown below: +# - propname1 +# - propname2 +# - ... + +- mmc-hs200-1_8v +- mmc-hs400-1_8v diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index 3ee7b62c9b5a..7ad88630e170 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -21,6 +21,7 @@ import shutil import textwrap import unidiff +import yaml from yamllint import config, linter @@ -35,6 +36,30 @@ import list_boards import list_hardware +sys.path.insert(0, str(Path(__file__).resolve().parents[2] + / "scripts" / "dts" / "python-devicetree" / "src")) +from devicetree import edtlib + + +# Let the user run this script as ./scripts/ci/check_compliance.py without +# making them set ZEPHYR_BASE. +ZEPHYR_BASE = os.environ.get('ZEPHYR_BASE') +if ZEPHYR_BASE: + ZEPHYR_BASE = Path(ZEPHYR_BASE) +else: + ZEPHYR_BASE = Path(__file__).resolve().parents[2] + # Propagate this decision to child processes. + os.environ['ZEPHYR_BASE'] = str(ZEPHYR_BASE) + +# Initialize the property names allowlist +BINDINGS_PROPERTIES_AL = None +with open(Path(__file__).parents[1] / 'bindings_properties_allowlist.yaml') as f: + allowlist = yaml.safe_load(f.read()) + if allowlist is not None: + BINDINGS_PROPERTIES_AL = set(allowlist) + else: + BINDINGS_PROPERTIES_AL = set() + logger = None def git(*args, cwd=None, ignore_non_zero=False): @@ -380,32 +405,75 @@ class DevicetreeBindingsCheck(ComplianceTest): doc = "See https://docs.zephyrproject.org/latest/build/dts/bindings.html for more details." def run(self, full=True): - dts_bindings = self.parse_dt_bindings() - - for dts_binding in dts_bindings: - self.required_false_check(dts_binding) + bindings_diff, bindings = self.get_yaml_bindings() - def parse_dt_bindings(self): + # If no bindings are changed, skip this check. + try: + subprocess.check_call(['git', 'diff', '--quiet', COMMIT_RANGE] + + bindings_diff) + nodiff = True + except subprocess.CalledProcessError: + nodiff = False + if nodiff: + self.skip('no changes to bindings were made') + + for binding in bindings: + self.check(binding, self.check_yaml_property_name) + self.check(binding, self.required_false_check) + + @staticmethod + def check(binding, callback): + while binding is not None: + callback(binding) + binding = binding.child_binding + + def get_yaml_bindings(self): """ - Returns a list of dts/bindings/**/*.yaml files + Returns a list of 'dts/bindings/**/*.yaml' """ + from glob import glob + BINDINGS_PATH = 'dts/bindings/' + bindings_diff_dir, bindings = set(), [] - dt_bindings = [] - for file_name in get_files(filter="d"): - if 'dts/bindings/' in file_name and file_name.endswith('.yaml'): - dt_bindings.append(file_name) + for file_name in get_files(filter='d'): + if BINDINGS_PATH in file_name: + p = file_name.partition(BINDINGS_PATH) + bindings_diff_dir.add(os.path.join(p[0], p[1])) - return dt_bindings + for path in bindings_diff_dir: + yamls = glob(f'{os.fspath(path)}/**/*.yaml', recursive=True) + bindings.extend(yamls) - def required_false_check(self, dts_binding): - with open(dts_binding) as file: - for line_number, line in enumerate(file, 1): - if 'required: false' in line: - self.fmtd_failure( - 'warning', 'Devicetree Bindings', dts_binding, - line_number, col=None, - desc="'required: false' is redundant, please remove") + bindings = edtlib.bindings_from_paths(bindings, ignore_errors=True) + return list(bindings_diff_dir), bindings + def check_yaml_property_name(self, binding): + """ + Checks if the property names in the binding file contain underscores. + """ + for prop_name in binding.prop2specs: + if '_' in prop_name and prop_name not in BINDINGS_PROPERTIES_AL: + better_prop = prop_name.replace('_', '-') + print(f"Required: In '{binding.path}', " + f"the property '{prop_name}' " + f"should be renamed to '{better_prop}'.") + self.failure( + f"{binding.path}: property '{prop_name}' contains underscores.\n" + f"\tUse '{better_prop}' instead unless this property name is from Linux.\n" + "Or another authoritative upstream source of bindings for " + f"compatible '{binding.compatible}'.\n" + "\tHint: update 'bindings_properties_allowlist.yaml' if you need to " + "override this check for this property." + ) + + def required_false_check(self, binding): + raw_props = binding.raw.get('properties', {}) + for prop_name, raw_prop in raw_props.items(): + if raw_prop.get('required') is False: + self.failure( + f'{binding.path}: property "{prop_name}": ' + "'required: false' is redundant, please remove" + ) class KconfigCheck(ComplianceTest): """ @@ -1984,17 +2052,6 @@ def _main(args): # The "real" main(), which is wrapped to catch exceptions and report them # to GitHub. Returns the number of test failures. - global ZEPHYR_BASE - ZEPHYR_BASE = os.environ.get('ZEPHYR_BASE') - if not ZEPHYR_BASE: - # Let the user run this script as ./scripts/ci/check_compliance.py without - # making them set ZEPHYR_BASE. - ZEPHYR_BASE = str(Path(__file__).resolve().parents[2]) - - # Propagate this decision to child processes. - os.environ['ZEPHYR_BASE'] = ZEPHYR_BASE - ZEPHYR_BASE = Path(ZEPHYR_BASE) - # The absolute path of the top-level git directory. Initialize it here so # that issues running Git can be reported to GitHub. global GIT_TOP From 2f556e6769ccef2e66d1607ca0cf6e6dab63aa15 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Tue, 4 Mar 2025 09:11:24 +0000 Subject: [PATCH 0664/2141] [nrf fromtree] scripts: ci: check_compliance: Add support for modules for Kconfig Adds support for checking modules for disallow Kconfig's in boards and SoCs, which have been defined in a Zephyr module file Signed-off-by: Jamie McCrae (cherry picked from commit 6d73a9c45aee4a1040bf4f94d41a27463ceca027) --- scripts/ci/check_compliance.py | 59 +++++++++++++++++++++++++++++++--- 1 file changed, 54 insertions(+), 5 deletions(-) diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index 7ad88630e170..5a441c873f0c 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -10,7 +10,7 @@ import json import logging import os -from pathlib import Path +from pathlib import Path, PurePath import platform import re import subprocess @@ -31,6 +31,11 @@ from west.manifest import Manifest from west.manifest import ManifestProject +try: + from yaml import CSafeLoader as SafeLoader +except ImportError: + from yaml import SafeLoader + sys.path.insert(0, str(Path(__file__).resolve().parents[1])) from get_maintainer import Maintainers, MaintainersError import list_boards @@ -781,6 +786,23 @@ def get_logging_syms(self, kconf): return set(kconf_syms) + def module_disallowed_check(self, module_path, type, folder, meta, regex): + # Returns a list with lines from git grep which includes Kconfigs from defconfig files + entry = type + '_root' + git_folder = ":" + folder + + if entry in meta['build']['settings']: + tmp_path = module_path.joinpath(meta['build']['settings'][entry]) + + if Path(tmp_path.joinpath(folder)).is_dir(): + tmp_output = git("grep", "--line-number", "-I", "--null", + "--perl-regexp", regex, "--", git_folder, + cwd=tmp_path, ignore_non_zero=True) + + if len(tmp_output) > 0: + return tmp_output.splitlines() + return [] + def check_disallowed_defconfigs(self, kconf): """ Checks that there are no disallowed Kconfigs used in board/SoC defconfig files @@ -823,14 +845,41 @@ def check_disallowed_defconfigs(self, kconf): grep_stdout_boards = git("grep", "--line-number", "-I", "--null", "--perl-regexp", regex_boards, "--", ":boards", - cwd=ZEPHYR_BASE) + cwd=ZEPHYR_BASE).splitlines() grep_stdout_socs = git("grep", "--line-number", "-I", "--null", "--perl-regexp", regex_socs, "--", ":soc", - cwd=ZEPHYR_BASE) + cwd=ZEPHYR_BASE).splitlines() + + manifest = Manifest.from_file() + for project in manifest.get_projects([]): + if not manifest.is_active(project): + continue + + if not project.is_cloned(): + continue + + module_path = PurePath(project.abspath) + module_yml = module_path.joinpath('zephyr/module.yml') + + if not Path(module_yml).is_file(): + module_yml = module_path.joinpath('zephyr/module.yaml') + + if Path(module_yml).is_file(): + with Path(module_yml).open('r', encoding='utf-8') as f: + meta = yaml.load(f.read(), Loader=SafeLoader) + + if 'build' in meta and 'settings' in meta['build']: + grep_stdout_boards.extend(self.module_disallowed_check(module_path, + 'board', + 'boards', meta, + regex_boards)) + grep_stdout_socs.extend(self.module_disallowed_check(module_path, 'soc', + 'soc', meta, + regex_socs)) # Board processing # splitlines() supports various line terminators - for grep_line in grep_stdout_boards.splitlines(): + for grep_line in grep_stdout_boards: path, lineno, line = grep_line.split("\0") # Extract symbol references (might be more than one) within the line @@ -847,7 +896,7 @@ def check_disallowed_defconfigs(self, kconf): # SoCs processing # splitlines() supports various line terminators - for grep_line in grep_stdout_socs.splitlines(): + for grep_line in grep_stdout_socs: path, lineno, line = grep_line.split("\0") # Extract symbol references (might be more than one) within the line From 2d0838c2fc9c8994e19a32a6bf50fd9dbbda30e8 Mon Sep 17 00:00:00 2001 From: Declan Snyder Date: Fri, 27 Jun 2025 13:04:13 -0500 Subject: [PATCH 0665/2141] [nrf fromtree] scripts: check_compliance: Fix resource leak The git diff subprocess was leaking, ie., it was still running with it's file streams open, and python was printing warnings about this. Fix by calling communicate() on the object which will do the cleanup. Signed-off-by: Declan Snyder (cherry picked from commit 3b5bfd9f4ad3e140af3b0e30f250807b8a886573) --- scripts/ci/check_compliance.py | 50 +++++++++++++++++----------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index 5a441c873f0c..332f6cf08c3c 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -291,37 +291,37 @@ def run(self): cmd = [checkpatch] cmd.extend(['--mailback', '--no-tree', '-']) - diff = subprocess.Popen(('git', 'diff', '--no-ext-diff', COMMIT_RANGE), + with subprocess.Popen(('git', 'diff', '--no-ext-diff', COMMIT_RANGE), stdout=subprocess.PIPE, - cwd=GIT_TOP) - try: - subprocess.run(cmd, - check=True, - stdin=diff.stdout, - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, - shell=False, cwd=GIT_TOP) + cwd=GIT_TOP) as diff: + try: + subprocess.run(cmd, + check=True, + stdin=diff.stdout, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + shell=False, cwd=GIT_TOP) - except subprocess.CalledProcessError as ex: - output = ex.output.decode("utf-8") - regex = r'^\s*\S+:(\d+):\s*(ERROR|WARNING):(.+?):(.+)(?:\n|\r\n?)+' \ - r'^\s*#(\d+):\s*FILE:\s*(.+):(\d+):' + except subprocess.CalledProcessError as ex: + output = ex.output.decode("utf-8") + regex = r'^\s*\S+:(\d+):\s*(ERROR|WARNING):(.+?):(.+)(?:\n|\r\n?)+' \ + r'^\s*#(\d+):\s*FILE:\s*(.+):(\d+):' - matches = re.findall(regex, output, re.MULTILINE) + matches = re.findall(regex, output, re.MULTILINE) - # add a guard here for excessive number of errors, do not try and - # process each one of them and instead push this as one failure. - if len(matches) > 500: - self.failure(output) - return + # add a guard here for excessive number of errors, do not try and + # process each one of them and instead push this as one failure. + if len(matches) > 500: + self.failure(output) + return - for m in matches: - self.fmtd_failure(m[1].lower(), m[2], m[5], m[6], col=None, - desc=m[3]) + for m in matches: + self.fmtd_failure(m[1].lower(), m[2], m[5], m[6], col=None, + desc=m[3]) - # If the regex has not matched add the whole output as a failure - if len(matches) == 0: - self.failure(output) + # If the regex has not matched add the whole output as a failure + if len(matches) == 0: + self.failure(output) class BoardYmlCheck(ComplianceTest): From a922397417e49858aa7a6fd98d8ef79f6dee3666 Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Tue, 12 Aug 2025 12:45:02 +0200 Subject: [PATCH 0666/2141] [nrf fromlist] scripts: parse module.yml for dts bindings Change BoardYml compliance check from using get_module_setting_root() to load and parse module.yml directly. get_module_setting_root cannot be used directly with module.yml. Instead adjust the code so that the module.yml file is loaded locally and the dts_root setting is extracted from the dictionary. Upstream PR #: 94397 Signed-off-by: Torsten Rasmussen --- scripts/ci/check_compliance.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index 332f6cf08c3c..5958fa52a7d5 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -345,15 +345,24 @@ def check_board_file(self, file, vendor_prefixes): def run(self): path = resolve_path_hint(self.path_hint) + module_ymls = [path / "zephyr" / "module.yml", path / "zephyr" / "module.yaml"] vendor_prefixes = {"others"} # add vendor prefixes from the main zephyr repo vendor_prefixes |= get_vendor_prefixes(ZEPHYR_BASE / "dts" / "bindings" / "vendor-prefixes.txt", self.error) - # add vendor prefixes from the current repo - dts_roots = get_module_setting_root('dts', path / "zephyr" / "module.yml") - for dts_root in dts_roots: - vendor_prefix_file = dts_root / "dts" / "bindings" / "vendor-prefixes.txt" + dts_root = None + for module_yml in module_ymls: + if module_yml.is_file(): + with module_yml.open('r', encoding='utf-8') as f: + meta = yaml.load(f.read(), Loader=SafeLoader) + section = meta.get('build', dict()) + build_settings = section.get('settings', None) + if build_settings: + dts_root = build_settings.get('dts_root', None) + + if dts_root: + vendor_prefix_file = Path(dts_root) / "dts" / "bindings" / "vendor-prefixes.txt" if vendor_prefix_file.exists(): vendor_prefixes |= get_vendor_prefixes(vendor_prefix_file, self.error) From 793e93e14667c87968d75c1666a9a99b44a054c9 Mon Sep 17 00:00:00 2001 From: Georgios Vasilakis Date: Fri, 8 Aug 2025 12:26:35 +0200 Subject: [PATCH 0667/2141] [nrf noup] soc: nrf54l: Change logic for KMU reserved area nrf-squash! [nrf noup] soc: nrf54l: Add custom section for KMU Change how the KMU reserved area is included in the linker file. Now there is a separate Kconfig which shows it the there is a dts entry for the KMU reserved area. Signed-off-by: Georgios Vasilakis --- soc/nordic/nrf54l/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/soc/nordic/nrf54l/CMakeLists.txt b/soc/nordic/nrf54l/CMakeLists.txt index d986fe9c20d5..d84330bffa6a 100644 --- a/soc/nordic/nrf54l/CMakeLists.txt +++ b/soc/nordic/nrf54l/CMakeLists.txt @@ -7,10 +7,12 @@ zephyr_library_sources( ) zephyr_include_directories(.) +dt_nodelabel(kmu_push_area_node NODELABEL nrf_kmu_reserved_push_area) + # We need a buffer in memory in a static location which can be used by # the KMU peripheral. The KMU has a static destination address, we chose # this address to be 0x20000000, which is the first address in the SRAM. -if(NOT CONFIG_BUILD_WITH_TFM AND CONFIG_PSA_NEED_CRACEN_KMU_DRIVER AND CONFIG_XIP) +if(NOT CONFIG_BUILD_WITH_TFM AND CONFIG_PSA_NEED_CRACEN_KMU_DRIVER AND NOT kmu_push_area_node) # Exclamation mark is printable character with the lowest number in ASCII table. # We are sure that this file will be included first. zephyr_linker_sources(RAM_SECTIONS SORT_KEY ! kmu_push_area_section.ld) From e7e4f8bc6d9ca3d51de2a60a25fd3cce8698b767 Mon Sep 17 00:00:00 2001 From: Bas van Loon Date: Thu, 31 Jul 2025 14:36:07 +0200 Subject: [PATCH 0668/2141] [nrf fromtree] net: openthread: Add option to set RCP restoration count. This patch allows to set the RCP restoration count when necessary. Signed-off-by: Bas van Loon (cherry picked from commit 27a32b3b2ee9f0e45ff9d4e30f87545fe52a7937) --- modules/openthread/CMakeLists.txt | 5 +++++ modules/openthread/Kconfig.thread | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/modules/openthread/CMakeLists.txt b/modules/openthread/CMakeLists.txt index 02af3687cf58..e6d4af115601 100644 --- a/modules/openthread/CMakeLists.txt +++ b/modules/openthread/CMakeLists.txt @@ -11,6 +11,10 @@ macro(kconfig_to_ot_option kconfig_option ot_config description) endif() endmacro() +macro(kconfig_to_ot_option_value kconfig_option ot_config description) + set(${ot_config} ${${kconfig_option}} CACHE STRING "${description}" FORCE) +endmacro() + # OpenThread options set(OT_BUILD_EXECUTABLES OFF CACHE BOOL "Disable OpenThread samples") set(OT_BUILTIN_MBEDTLS_MANAGEMENT OFF CACHE BOOL "Use Zephyr's mbedTLS heap") @@ -130,6 +134,7 @@ kconfig_to_ot_option(CONFIG_OPENTHREAD_UPTIME OT_UPTIME "Enable support for trac kconfig_to_ot_option(CONFIG_OPENTHREAD_VERHOEFF_CHECKSUM OT_VERHOEFF_CHECKSUM "Verhoeff checksum") kconfig_to_ot_option(CONFIG_OPENTHREAD_WAKEUP_COORDINATOR OT_WAKEUP_COORDINATOR "Enable Wake-up Coordinator role") kconfig_to_ot_option(CONFIG_OPENTHREAD_WAKEUP_END_DEVICE OT_WAKEUP_END_DEVICE "Enable Wake-up End Device role") +kconfig_to_ot_option_value(CONFIG_OPENTHREAD_RCP_RESTORATION_MAX_COUNT OT_RCP_RESTORATION_MAX_COUNT "Set the maximum number of RCP restoration attempts") if(CONFIG_OPENTHREAD_COPROCESSOR_VENDOR_HOOK_SOURCE) set(OT_NCP_VENDOR_HOOK_SOURCE ${CONFIG_OPENTHREAD_COPROCESSOR_VENDOR_HOOK_SOURCE} CACHE STRING "NCP vendor hook source file name" FORCE) diff --git a/modules/openthread/Kconfig.thread b/modules/openthread/Kconfig.thread index 2bababd4fee5..01737ef7567b 100644 --- a/modules/openthread/Kconfig.thread +++ b/modules/openthread/Kconfig.thread @@ -250,3 +250,9 @@ config OPENTHREAD_MLE_CHILD_TIMEOUT default 240 help The value of MLE child timeout in seconds. + +config OPENTHREAD_RCP_RESTORATION_MAX_COUNT + int "Openthread RCP restoration maximum count" + default 2 + help + The maximum number of attempts to restore the RCP connection. From 53824876e35648dc8c2d6fb99e3756e7cd4d779f Mon Sep 17 00:00:00 2001 From: Damian Krolik Date: Thu, 14 Aug 2025 13:49:36 +0200 Subject: [PATCH 0669/2141] [nrf fromlist] modules: openthread: configure router selection jitter Add CONFIG_OPENTHREAD_ROUTER_SELECTION_JITTER_OVERRIDE Kconfig option that enables setting the router selection jitter to CONFIG_OPENTHREAD_ROUTER_SELECTION_JITTER at startup. Upstream PR #: 94507 Signed-off-by: Damian Krolik --- modules/openthread/Kconfig.thread | 9 +++++++++ modules/openthread/openthread.c | 11 +++++++++++ 2 files changed, 20 insertions(+) diff --git a/modules/openthread/Kconfig.thread b/modules/openthread/Kconfig.thread index 01737ef7567b..0633d8bc62d3 100644 --- a/modules/openthread/Kconfig.thread +++ b/modules/openthread/Kconfig.thread @@ -256,3 +256,12 @@ config OPENTHREAD_RCP_RESTORATION_MAX_COUNT default 2 help The maximum number of attempts to restore the RCP connection. + +config OPENTHREAD_ROUTER_SELECTION_JITTER_OVERRIDE + bool "Override default router selection jitter" + depends on OPENTHREAD_FTD + +config OPENTHREAD_ROUTER_SELECTION_JITTER + int "OpenThread router selection jitter in seconds" + depends on OPENTHREAD_ROUTER_SELECTION_JITTER_OVERRIDE + default 120 diff --git a/modules/openthread/openthread.c b/modules/openthread/openthread.c index 5bd7f27e8c89..e4124cda7f9b 100644 --- a/modules/openthread/openthread.c +++ b/modules/openthread/openthread.c @@ -33,6 +33,7 @@ LOG_MODULE_REGISTER(net_openthread_platform, CONFIG_OPENTHREAD_PLATFORM_LOG_LEVE #include #include #include +#include #include #include #include @@ -98,6 +99,12 @@ LOG_MODULE_REGISTER(net_openthread_platform, CONFIG_OPENTHREAD_PLATFORM_LOG_LEVE #define OT_POLL_PERIOD 0 #endif +#if defined(CONFIG_OPENTHREAD_ROUTER_SELECTION_JITTER) +#define OT_ROUTER_SELECTION_JITTER CONFIG_OPENTHREAD_ROUTER_SELECTION_JITTER +#else +#define OT_ROUTER_SELECTION_JITTER 0 +#endif + #define ZEPHYR_PACKAGE_NAME "Zephyr" #define PACKAGE_VERSION KERNEL_VERSION_STRING @@ -340,6 +347,10 @@ int openthread_init(void) } } + if (IS_ENABLED(CONFIG_OPENTHREAD_ROUTER_SELECTION_JITTER_OVERRIDE)) { + otThreadSetRouterSelectionJitter(openthread_instance, OT_ROUTER_SELECTION_JITTER); + } + openthread_mutex_unlock(); /* Start work queue for the OpenThread module */ From 2cc69ef97a5ce7871628b29a2eaf2a7b4a628388 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Ku=C5=BAnia?= Date: Mon, 18 Aug 2025 10:29:34 +0200 Subject: [PATCH 0670/2141] Revert "[nrf fromlist] modules: hal_nordic: nrf_802154: de-escalate to non-ZLI isr" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 568a8ad16dc5c9f738f574d47b6a352a87541cf4. Signed-off-by: Rafał Kuźnia --- .../platform/nrf_802154_clock_zephyr.c | 156 ++++-------------- west.yml | 2 +- 2 files changed, 29 insertions(+), 129 deletions(-) diff --git a/modules/hal_nordic/nrf_802154/sl_opensource/platform/nrf_802154_clock_zephyr.c b/modules/hal_nordic/nrf_802154/sl_opensource/platform/nrf_802154_clock_zephyr.c index ee3a589bd234..1dcf724b0e52 100644 --- a/modules/hal_nordic/nrf_802154/sl_opensource/platform/nrf_802154_clock_zephyr.c +++ b/modules/hal_nordic/nrf_802154/sl_opensource/platform/nrf_802154_clock_zephyr.c @@ -13,35 +13,8 @@ #include #include #include -#include - -/** - * The implementation uses EGU to de-escalate execution context from ZLI to a regular interrupt - * to ensure that Zephyr APIs can be used safely. - * - * Both the nrf_802154_clock_hfclk_start() and nrf_802154_clock_hfclk_stop() can potentially be - * called from ZLI and non-ZLI contexts and consecutive calls are not guaranteed to be alternating. - * - * For example, it is possible that _stop() may be called multiple times in succession and the - * same thing applies to _start(). What is known however is that the last call always takes - * the precedence. - */ - -#define SWI_INT NRFX_CONCAT_2(NRF_EGU_INT_TRIGGERED, NRF_802154_SL_EGU_CLOCK_CHANNEL_NO) -#define SWI_TASK NRFX_CONCAT_2(NRF_EGU_TASK_TRIGGER, NRF_802154_SL_EGU_CLOCK_CHANNEL_NO) -#define SWI_EVENT NRFX_CONCAT_2(NRF_EGU_EVENT_TRIGGERED, NRF_802154_SL_EGU_CLOCK_CHANNEL_NO) - -#define CLOCK_NONE 0u -#define CLOCK_REQUEST 1u -#define CLOCK_RELEASE 2u static bool hfclk_is_running; -static bool enabled; -static atomic_t request = CLOCK_NONE; - -/* Forward declarations. */ -static void hfclk_start(void); -static void hfclk_stop(void); void nrf_802154_clock_init(void) { @@ -50,13 +23,11 @@ void nrf_802154_clock_init(void) nrf_802154_clock_hfclk_latency_set(clock_latency_us); #endif - - nrf_egu_int_enable(NRF_802154_EGU_INSTANCE, SWI_INT); } void nrf_802154_clock_deinit(void) { - nrf_egu_int_disable(NRF_802154_EGU_INSTANCE, SWI_INT); + /* Intentionally empty. */ } bool nrf_802154_clock_hfclk_is_running(void) @@ -76,44 +47,8 @@ static void hfclk_on_callback(struct onoff_manager *mgr, nrf_802154_clock_hfclk_ready(); } -void nrf_802154_sl_clock_swi_irq_handler(void) -{ - if (nrf_egu_event_check(NRF_802154_EGU_INSTANCE, SWI_EVENT)) { - nrf_egu_event_clear(NRF_802154_EGU_INSTANCE, SWI_EVENT); - - atomic_val_t previous = atomic_set(&request, CLOCK_NONE); - - __ASSERT_NO_MSG(previous == CLOCK_REQUEST || previous == CLOCK_RELEASE); - - switch (previous) { - case CLOCK_REQUEST: - hfclk_start(); - break; - - case CLOCK_RELEASE: - hfclk_stop(); - break; - - default: - break; - } - } -} - -void nrf_802154_clock_hfclk_start(void) -{ - atomic_set(&request, CLOCK_REQUEST); - nrf_egu_task_trigger(NRF_802154_EGU_INSTANCE, SWI_TASK); -} - -void nrf_802154_clock_hfclk_stop(void) -{ - atomic_set(&request, CLOCK_RELEASE); - nrf_egu_task_trigger(NRF_802154_EGU_INSTANCE, SWI_TASK); -} - #if defined(CONFIG_CLOCK_CONTROL_NRF) -static void hfclk_start(void) +void nrf_802154_clock_hfclk_start(void) { struct onoff_manager *mgr = z_nrf_clock_control_get_onoff(CLOCK_CONTROL_NRF_SUBSYS_HF); @@ -122,91 +57,56 @@ static void hfclk_start(void) sys_notify_init_callback(&hfclk_cli.notify, hfclk_on_callback); - if (!enabled) { - unsigned int key = irq_lock(); - - /* - * todo: replace constlat request with PM policy API when - * controlling the event latency becomes possible. - */ - if (IS_ENABLED(CONFIG_NRF_802154_CONSTLAT_CONTROL)) { - nrf_sys_event_request_global_constlat(); - } - - int ret = onoff_request(mgr, &hfclk_cli); - - __ASSERT_NO_MSG(ret >= 0); - (void)ret; - - irq_unlock(key); + /* + * todo: replace constlat request with PM policy API when + * controlling the event latency becomes possible. + */ + if (IS_ENABLED(CONFIG_NRF_802154_CONSTLAT_CONTROL)) { + nrf_sys_event_request_global_constlat(); } - enabled = true; + int ret = onoff_request(mgr, &hfclk_cli); + __ASSERT_NO_MSG(ret >= 0); + (void)ret; } -static void hfclk_stop(void) +void nrf_802154_clock_hfclk_stop(void) { struct onoff_manager *mgr = z_nrf_clock_control_get_onoff(CLOCK_CONTROL_NRF_SUBSYS_HF); __ASSERT_NO_MSG(mgr != NULL); - if (enabled) { - unsigned int key = irq_lock(); - - int ret = onoff_cancel_or_release(mgr, &hfclk_cli); - - __ASSERT_NO_MSG(ret >= 0); - (void)ret; - - if (IS_ENABLED(CONFIG_NRF_802154_CONSTLAT_CONTROL)) { - nrf_sys_event_release_global_constlat(); - } - - hfclk_is_running = false; + int ret = onoff_cancel_or_release(mgr, &hfclk_cli); + __ASSERT_NO_MSG(ret >= 0); + (void)ret; - irq_unlock(key); + if (IS_ENABLED(CONFIG_NRF_802154_CONSTLAT_CONTROL)) { + nrf_sys_event_release_global_constlat(); } - enabled = false; + hfclk_is_running = false; } #elif DT_NODE_HAS_STATUS(DT_NODELABEL(hfxo), okay) && \ DT_NODE_HAS_COMPAT(DT_NODELABEL(hfxo), nordic_nrf54h_hfxo) -static void hfclk_start(void) +void nrf_802154_clock_hfclk_start(void) { - if (!enabled) { - unsigned int key = irq_lock(); - - sys_notify_init_callback(&hfclk_cli.notify, hfclk_on_callback); - int ret = nrf_clock_control_request(DEVICE_DT_GET(DT_NODELABEL(hfxo)), - NULL, &hfclk_cli); - - __ASSERT_NO_MSG(ret >= 0); - (void)ret; - - irq_unlock(key); - } + sys_notify_init_callback(&hfclk_cli.notify, hfclk_on_callback); + int ret = nrf_clock_control_request(DEVICE_DT_GET(DT_NODELABEL(hfxo)), NULL, &hfclk_cli); - enabled = true; + __ASSERT_NO_MSG(ret >= 0); + (void)ret; } -static void hfclk_stop(void) +void nrf_802154_clock_hfclk_stop(void) { - if (enabled) { - unsigned int key = irq_lock(); - - int ret = nrf_clock_control_cancel_or_release(DEVICE_DT_GET(DT_NODELABEL(hfxo)), - NULL, &hfclk_cli); - - __ASSERT_NO_MSG(ret >= 0); - (void)ret; - - irq_unlock(key); - } + int ret = nrf_clock_control_cancel_or_release(DEVICE_DT_GET(DT_NODELABEL(hfxo)), + NULL, &hfclk_cli); - enabled = false; + __ASSERT_NO_MSG(ret >= 0); + (void)ret; } #endif diff --git a/west.yml b/west.yml index 9036b6d589f6..b5ace932db27 100644 --- a/west.yml +++ b/west.yml @@ -200,7 +200,7 @@ manifest: groups: - hal - name: hal_nordic - revision: 9e1bc32436a71adf1aa55937046d659a2db9e74f + revision: 2f5d4e5868ab573eac932fa4bc142565073c3c04 path: modules/hal/nordic groups: - hal From f5564e36c6030a0e4c134642a44bd5b1ba69e599 Mon Sep 17 00:00:00 2001 From: Artur Hadasz Date: Mon, 28 Jul 2025 11:55:53 +0200 Subject: [PATCH 0671/2141] [nrf fromtree] bootloader: mcuboot: Changes needed to support AES256 This commit adds changes which are necessary to support the AES256 encryption algorithm in mcuboot. Signed-off-by: Artur Hadasz (cherry picked from commit 9a1fe301993471ac8aa13d75fa675ed4683f1bd0) --- cmake/mcuboot.cmake | 7 +++++++ modules/Kconfig.mcuboot | 16 ++++++++++++++++ .../BOOTLOADER_image_default.cmake | 9 +++++++++ .../MAIN_image_default.cmake | 8 ++++++++ share/sysbuild/images/bootloader/CMakeLists.txt | 4 ---- share/sysbuild/images/bootloader/Kconfig | 16 ++++++++++++++++ 6 files changed, 56 insertions(+), 4 deletions(-) diff --git a/cmake/mcuboot.cmake b/cmake/mcuboot.cmake index ac37b175a31b..964d694983b3 100644 --- a/cmake/mcuboot.cmake +++ b/cmake/mcuboot.cmake @@ -159,6 +159,13 @@ function(zephyr_mcuboot_tasks) set(imgtool_args --sha 512 ${imgtool_args}) endif() + if(NOT "${keyfile_enc}" STREQUAL "") + if(CONFIG_MCUBOOT_ENCRYPTION_ALG_AES_256) + # Note: this overrides the default behavior of using AES-128 + set(imgtool_args ${imgtool_args} --encrypt-keylen 256) + endif() + endif() + # Extensionless prefix of any output file. set(output ${ZEPHYR_BINARY_DIR}/${KERNEL_NAME}) diff --git a/modules/Kconfig.mcuboot b/modules/Kconfig.mcuboot index a95dc34b72f7..d6b4465de2d4 100644 --- a/modules/Kconfig.mcuboot +++ b/modules/Kconfig.mcuboot @@ -89,6 +89,22 @@ config MCUBOOT_ENCRYPTION_KEY_FILE If left empty, you must encrypt the Zephyr binaries manually. +if MCUBOOT_ENCRYPTION_KEY_FILE != "" + +choice MCUBOOT_ENCRYPTION_ALG + prompt "Algorithm used for image encryption" + default MCUBOOT_ENCRYPTION_ALG_AES_128 + +config MCUBOOT_ENCRYPTION_ALG_AES_128 + bool "Use AES-128 for image encryption" + +config MCUBOOT_ENCRYPTION_ALG_AES_256 + bool "Use AES-256 for image encryption" + +endchoice # MCUBOOT_ENCRYPTION_ALG + +endif # MCUBOOT_ENCRYPTION_KEY_FILE != "" + config MCUBOOT_IMGTOOL_SIGN_VERSION string "Version to pass to imgtool when signing" default "$(APP_VERSION_TWEAK_STRING)" if "$(VERSION_MAJOR)" != "" diff --git a/share/sysbuild/image_configurations/BOOTLOADER_image_default.cmake b/share/sysbuild/image_configurations/BOOTLOADER_image_default.cmake index 9125de71fac6..1267fc1e1ef6 100644 --- a/share/sysbuild/image_configurations/BOOTLOADER_image_default.cmake +++ b/share/sysbuild/image_configurations/BOOTLOADER_image_default.cmake @@ -78,3 +78,12 @@ foreach(loopkeytype ${keytypes}) set_config_bool(${ZCMAKE_APPLICATION} ${loopkeytype} n) endif() endforeach() + +if(SB_CONFIG_BOOT_ENCRYPTION) + set_config_string(${ZCMAKE_APPLICATION} CONFIG_BOOT_ENCRYPTION_KEY_FILE "${SB_CONFIG_BOOT_ENCRYPTION_KEY_FILE}") + if(SB_CONFIG_BOOT_ENCRYPTION_ALG_AES_128) + set_config_bool(${ZCMAKE_APPLICATION} CONFIG_BOOT_ENCRYPT_ALG_AES_128 y) + elseif(SB_CONFIG_BOOT_ENCRYPTION_ALG_AES_256) + set_config_bool(${ZCMAKE_APPLICATION} CONFIG_BOOT_ENCRYPT_ALG_AES_256 y) + endif() +endif() diff --git a/share/sysbuild/image_configurations/MAIN_image_default.cmake b/share/sysbuild/image_configurations/MAIN_image_default.cmake index a6c29c8d7569..96cb18355428 100644 --- a/share/sysbuild/image_configurations/MAIN_image_default.cmake +++ b/share/sysbuild/image_configurations/MAIN_image_default.cmake @@ -51,4 +51,12 @@ if(SB_CONFIG_BOOTLOADER_MCUBOOT) set_config_bool(${ZCMAKE_APPLICATION} CONFIG_RETENTION_BOOT_MODE y) endif() endif() + + if(SB_CONFIG_BOOT_ENCRYPTION) + if(SB_CONFIG_BOOT_ENCRYPTION_ALG_AES_128) + set_config_bool(${ZCMAKE_APPLICATION} CONFIG_MCUBOOT_ENCRYPTION_ALG_AES_128 y) + elseif(SB_CONFIG_BOOT_ENCRYPTION_ALG_AES_256) + set_config_bool(${ZCMAKE_APPLICATION} CONFIG_MCUBOOT_ENCRYPTION_ALG_AES_256 y) + endif() + endif() endif() diff --git a/share/sysbuild/images/bootloader/CMakeLists.txt b/share/sysbuild/images/bootloader/CMakeLists.txt index c82f0808c66e..501a1f366f2a 100644 --- a/share/sysbuild/images/bootloader/CMakeLists.txt +++ b/share/sysbuild/images/bootloader/CMakeLists.txt @@ -15,8 +15,4 @@ if(SB_CONFIG_BOOTLOADER_MCUBOOT) sysbuild_add_dependencies(FLASH ${DEFAULT_IMAGE} ${image}) set_config_string(${image} CONFIG_BOOT_SIGNATURE_KEY_FILE "${SB_CONFIG_BOOT_SIGNATURE_KEY_FILE}") - set_config_bool(${image} CONFIG_BOOT_ENCRYPT_IMAGE "${SB_CONFIG_BOOT_ENCRYPTION}") - if(SB_CONFIG_BOOT_ENCRYPTION) - set_config_string(${image} CONFIG_BOOT_ENCRYPTION_KEY_FILE "${SB_CONFIG_BOOT_ENCRYPTION_KEY_FILE}") - endif() endif() diff --git a/share/sysbuild/images/bootloader/Kconfig b/share/sysbuild/images/bootloader/Kconfig index 7a416f2fe239..fa4eff374d6f 100644 --- a/share/sysbuild/images/bootloader/Kconfig +++ b/share/sysbuild/images/bootloader/Kconfig @@ -204,4 +204,20 @@ config BOOT_ENCRYPTION_KEY_FILE help Absolute path to encryption key file to use with MCUBoot. +if BOOT_ENCRYPTION + +choice BOOT_ENCRYPTION_ALG + prompt "Algorithm used for image encryption" + default BOOT_ENCRYPTION_ALG_AES_128 + +config BOOT_ENCRYPTION_ALG_AES_128 + bool "Use AES-128 for image encryption" + +config BOOT_ENCRYPTION_ALG_AES_256 + bool "Use AES-256 for image encryption" + +endchoice # BOOT_ENCRYPTION_ALG + +endif # BOOT_ENCRYPTION + endif From 51f0b2c5c449b08826faef7cea0df23e9856ceed Mon Sep 17 00:00:00 2001 From: Artur Hadasz Date: Wed, 13 Aug 2025 15:46:19 +0200 Subject: [PATCH 0672/2141] [nrf fromtree] bootloader: mcuboot: Fix encryption not being selected in bootloader In some cases this resulted in the device not booting. Signed-off-by: Artur Hadasz (cherry picked from commit b43ce97c6b237a94bae19fdf6635e54e3981101c) --- .../sysbuild/image_configurations/BOOTLOADER_image_default.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/share/sysbuild/image_configurations/BOOTLOADER_image_default.cmake b/share/sysbuild/image_configurations/BOOTLOADER_image_default.cmake index 1267fc1e1ef6..1c09b452ee40 100644 --- a/share/sysbuild/image_configurations/BOOTLOADER_image_default.cmake +++ b/share/sysbuild/image_configurations/BOOTLOADER_image_default.cmake @@ -80,6 +80,7 @@ foreach(loopkeytype ${keytypes}) endforeach() if(SB_CONFIG_BOOT_ENCRYPTION) + set_config_bool(${image} CONFIG_BOOT_ENCRYPT_IMAGE y) set_config_string(${ZCMAKE_APPLICATION} CONFIG_BOOT_ENCRYPTION_KEY_FILE "${SB_CONFIG_BOOT_ENCRYPTION_KEY_FILE}") if(SB_CONFIG_BOOT_ENCRYPTION_ALG_AES_128) set_config_bool(${ZCMAKE_APPLICATION} CONFIG_BOOT_ENCRYPT_ALG_AES_128 y) From f637c2ca51eee3c26bcc6a53619f4dd1c64d3b4f Mon Sep 17 00:00:00 2001 From: Kapil Bhatt Date: Mon, 11 Aug 2025 11:13:30 +0000 Subject: [PATCH 0673/2141] [nrf fromlist] net: zperf: Improve UDP multicast upload MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit UDP multicast uploads did not produce zperf-compatible server stats, so the client waited for and tried to decode a non-existent reply, causing “Unexpected response flags” and misleading “LAST PACKET NOT RECEIVED!!!” output. This change treats multicast as client-only: after sending the negative-id FIN it does not wait for or decode server stats, Instead transmits the FIN a few times to help receivers detect test end. The shell prints a clear “Statistics (client only)” summary for multicast and suppresses the error when client stats are valid. Unicast behavior is unchanged. Upstream PR #: 94344 Signed-off-by: Kapil Bhatt --- include/zephyr/net/zperf.h | 1 + subsys/net/lib/zperf/zperf_shell.c | 75 ++++++++++++++--------- subsys/net/lib/zperf/zperf_udp_uploader.c | 16 ++++- 3 files changed, 59 insertions(+), 33 deletions(-) diff --git a/include/zephyr/net/zperf.h b/include/zephyr/net/zperf.h index e26a6076f7a6..3b4e9bbb684e 100644 --- a/include/zephyr/net/zperf.h +++ b/include/zephyr/net/zperf.h @@ -90,6 +90,7 @@ struct zperf_results { uint64_t client_time_in_us; /**< Client connection time in microseconds */ uint32_t packet_size; /**< Packet size */ uint32_t nb_packets_errors; /**< Number of packet errors */ + bool is_multicast; /**< True if this session used IP multicast */ }; /** diff --git a/subsys/net/lib/zperf/zperf_shell.c b/subsys/net/lib/zperf/zperf_shell.c index dca889b49a9f..5ebaada1b509 100644 --- a/subsys/net/lib/zperf/zperf_shell.c +++ b/subsys/net/lib/zperf/zperf_shell.c @@ -516,41 +516,56 @@ static void shell_udp_upload_print_stats(const struct shell *sh, client_rate_in_kbps = 0U; } - if (!rate_in_kbps) { + /* Print warning if no server stats in unicast case; for multicast, + * server stats are not expected. + */ + if (!rate_in_kbps && !results->is_multicast) { shell_fprintf(sh, SHELL_ERROR, "LAST PACKET NOT RECEIVED!!!\n"); } - shell_fprintf(sh, SHELL_NORMAL, - "Statistics:\t\tserver\t(client)\n"); - shell_fprintf(sh, SHELL_NORMAL, "Duration:\t\t"); - print_number_64(sh, results->time_in_us, TIME_US, - TIME_US_UNIT); - shell_fprintf(sh, SHELL_NORMAL, "\t("); - print_number_64(sh, results->client_time_in_us, TIME_US, - TIME_US_UNIT); - shell_fprintf(sh, SHELL_NORMAL, ")\n"); - - shell_fprintf(sh, SHELL_NORMAL, "Num packets:\t\t%u\t(%u)\n", - results->nb_packets_rcvd, - results->nb_packets_sent); - - shell_fprintf(sh, SHELL_NORMAL, - "Num packets out order:\t%u\n", - results->nb_packets_outorder); - shell_fprintf(sh, SHELL_NORMAL, "Num packets lost:\t%u\n", - results->nb_packets_lost); - - shell_fprintf(sh, SHELL_NORMAL, "Jitter:\t\t\t"); - print_number(sh, results->jitter_in_us, TIME_US, - TIME_US_UNIT); - shell_fprintf(sh, SHELL_NORMAL, "\n"); + if (results->is_multicast) { + shell_fprintf(sh, SHELL_NORMAL, "Statistics (client only)\n"); + shell_fprintf(sh, SHELL_NORMAL, "Duration:\t\t"); + print_number_64(sh, results->client_time_in_us, TIME_US, TIME_US_UNIT); + shell_fprintf(sh, SHELL_NORMAL, "\n"); + shell_fprintf(sh, SHELL_NORMAL, "Num packets:\t\t%u\n", + results->nb_packets_sent); + shell_fprintf(sh, SHELL_NORMAL, "Rate:\t\t\t"); + print_number(sh, client_rate_in_kbps, KBPS, KBPS_UNIT); + shell_fprintf(sh, SHELL_NORMAL, "\n"); + } else { + shell_fprintf(sh, SHELL_NORMAL, + "Statistics:\t\tserver\t(client)\n"); + shell_fprintf(sh, SHELL_NORMAL, "Duration:\t\t"); + print_number_64(sh, results->time_in_us, TIME_US, + TIME_US_UNIT); + shell_fprintf(sh, SHELL_NORMAL, "\t("); + print_number_64(sh, results->client_time_in_us, TIME_US, + TIME_US_UNIT); + shell_fprintf(sh, SHELL_NORMAL, ")\n"); + + shell_fprintf(sh, SHELL_NORMAL, "Num packets:\t\t%u\t(%u)\n", + results->nb_packets_rcvd, + results->nb_packets_sent); - shell_fprintf(sh, SHELL_NORMAL, "Rate:\t\t\t"); - print_number(sh, rate_in_kbps, KBPS, KBPS_UNIT); - shell_fprintf(sh, SHELL_NORMAL, "\t("); - print_number(sh, client_rate_in_kbps, KBPS, KBPS_UNIT); - shell_fprintf(sh, SHELL_NORMAL, ")\n"); + shell_fprintf(sh, SHELL_NORMAL, + "Num packets out order:\t%u\n", + results->nb_packets_outorder); + shell_fprintf(sh, SHELL_NORMAL, "Num packets lost:\t%u\n", + results->nb_packets_lost); + + shell_fprintf(sh, SHELL_NORMAL, "Jitter:\t\t\t"); + print_number(sh, results->jitter_in_us, TIME_US, + TIME_US_UNIT); + shell_fprintf(sh, SHELL_NORMAL, "\n"); + + shell_fprintf(sh, SHELL_NORMAL, "Rate:\t\t\t"); + print_number(sh, rate_in_kbps, KBPS, KBPS_UNIT); + shell_fprintf(sh, SHELL_NORMAL, "\t("); + print_number(sh, client_rate_in_kbps, KBPS, KBPS_UNIT); + shell_fprintf(sh, SHELL_NORMAL, ")\n"); + } #ifdef CONFIG_ZPERF_SESSION_PER_THREAD if (is_async) { diff --git a/subsys/net/lib/zperf/zperf_udp_uploader.c b/subsys/net/lib/zperf/zperf_udp_uploader.c index 344ea39560b6..f4944d5777fb 100644 --- a/subsys/net/lib/zperf/zperf_udp_uploader.c +++ b/subsys/net/lib/zperf/zperf_udp_uploader.c @@ -105,10 +105,14 @@ static inline int zperf_upload_fin(int sock, continue; } - /* Multicast only send the negative sequence number packet - * and doesn't wait for a server ack + /* For multicast, do not wait for a server ack. Keep resending FIN + * for the configured number of attempts by forcing another loop + * iteration. */ - if (!is_mcast_pkt) { + if (is_mcast_pkt) { + ret = 0; + continue; + } else { /* Receive statistics */ ret = zsock_setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, &rcvtimeo, sizeof(rcvtimeo)); @@ -126,6 +130,11 @@ static inline int zperf_upload_fin(int sock, } } + /* In multicast, we never expect a stats reply. Stop here. */ + if (is_mcast_pkt) { + return 0; + } + /* Decode statistics */ if (ret > 0) { zperf_upload_decode_stat(stats, ret, results); @@ -299,6 +308,7 @@ static int udp_upload(int sock, int port, results->client_time_in_us = k_ticks_to_us_ceil64(end_time - start_time); results->packet_size = packet_size; + results->is_multicast = is_mcast_pkt; return 0; } From 1fe49abe2fccbdacdfbc9b2876d6ca0245963085 Mon Sep 17 00:00:00 2001 From: Hake Huang Date: Wed, 2 Jul 2025 19:58:36 +0800 Subject: [PATCH 0674/2141] [nrf fromtree] tests: vector_table_relocation: fix a mis-use of SRAM_SIZE SRAM_SIZE is given in kilobytes fixes: #92533 Signed-off-by: Hake Huang (cherry picked from commit fe811defb28a0468dae763c0d2f9b5e42de7766b) --- .../application_development/vector_table_relocation/src/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/application_development/vector_table_relocation/src/main.c b/tests/application_development/vector_table_relocation/src/main.c index d102f713df53..d5fa7c8ed473 100644 --- a/tests/application_development/vector_table_relocation/src/main.c +++ b/tests/application_development/vector_table_relocation/src/main.c @@ -55,7 +55,7 @@ ZTEST(vector_table_relocation, test_vector_table_in_ram) printf("VTOR address: 0x%x\n", vtor_address); zassert_true(vtor_address >= CONFIG_SRAM_BASE_ADDRESS && - vtor_address <= CONFIG_SRAM_BASE_ADDRESS + CONFIG_SRAM_SIZE, + vtor_address <= CONFIG_SRAM_BASE_ADDRESS + CONFIG_SRAM_SIZE * 1024U, "Vector table is not in RAM! Address: 0x%x", vtor_address); } From 6997770e93b3fc57c5325b430fb806f13d345f40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dag=20Erik=20Gj=C3=B8rvad?= Date: Mon, 18 Aug 2025 14:25:53 +0200 Subject: [PATCH 0675/2141] [nrf noup] tests: crypto: Add ENTROPY_GENERATOR in overlays MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add ENTROPY_GENERATOR=y in overlays for l series devices. This fixes an error where a trng source is not included in ncs. Signed-off-by: Dag Erik Gjørvad --- .../mbedtls_psa/boards/nrf54l05dk_nrf54l05_cpuapp.conf | 6 ++++++ .../mbedtls_psa/boards/nrf54l15dk_nrf54l10_cpuapp.conf | 6 ++++++ .../mbedtls_psa/boards/nrf54l15dk_nrf54l15_cpuapp.conf | 6 ++++++ .../mbedtls_psa/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf | 6 ++++++ .../mbedtls_psa/boards/nrf54lv10dk_nrf54lv10a_cpuapp.conf | 6 ++++++ 5 files changed, 30 insertions(+) create mode 100644 tests/crypto/mbedtls_psa/boards/nrf54l05dk_nrf54l05_cpuapp.conf create mode 100644 tests/crypto/mbedtls_psa/boards/nrf54l15dk_nrf54l10_cpuapp.conf create mode 100644 tests/crypto/mbedtls_psa/boards/nrf54l15dk_nrf54l15_cpuapp.conf create mode 100644 tests/crypto/mbedtls_psa/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf create mode 100644 tests/crypto/mbedtls_psa/boards/nrf54lv10dk_nrf54lv10a_cpuapp.conf diff --git a/tests/crypto/mbedtls_psa/boards/nrf54l05dk_nrf54l05_cpuapp.conf b/tests/crypto/mbedtls_psa/boards/nrf54l05dk_nrf54l05_cpuapp.conf new file mode 100644 index 000000000000..70c601183ddf --- /dev/null +++ b/tests/crypto/mbedtls_psa/boards/nrf54l05dk_nrf54l05_cpuapp.conf @@ -0,0 +1,6 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# +CONFIG_ENTROPY_GENERATOR=y diff --git a/tests/crypto/mbedtls_psa/boards/nrf54l15dk_nrf54l10_cpuapp.conf b/tests/crypto/mbedtls_psa/boards/nrf54l15dk_nrf54l10_cpuapp.conf new file mode 100644 index 000000000000..70c601183ddf --- /dev/null +++ b/tests/crypto/mbedtls_psa/boards/nrf54l15dk_nrf54l10_cpuapp.conf @@ -0,0 +1,6 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# +CONFIG_ENTROPY_GENERATOR=y diff --git a/tests/crypto/mbedtls_psa/boards/nrf54l15dk_nrf54l15_cpuapp.conf b/tests/crypto/mbedtls_psa/boards/nrf54l15dk_nrf54l15_cpuapp.conf new file mode 100644 index 000000000000..70c601183ddf --- /dev/null +++ b/tests/crypto/mbedtls_psa/boards/nrf54l15dk_nrf54l15_cpuapp.conf @@ -0,0 +1,6 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# +CONFIG_ENTROPY_GENERATOR=y diff --git a/tests/crypto/mbedtls_psa/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf b/tests/crypto/mbedtls_psa/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf new file mode 100644 index 000000000000..70c601183ddf --- /dev/null +++ b/tests/crypto/mbedtls_psa/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf @@ -0,0 +1,6 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# +CONFIG_ENTROPY_GENERATOR=y diff --git a/tests/crypto/mbedtls_psa/boards/nrf54lv10dk_nrf54lv10a_cpuapp.conf b/tests/crypto/mbedtls_psa/boards/nrf54lv10dk_nrf54lv10a_cpuapp.conf new file mode 100644 index 000000000000..70c601183ddf --- /dev/null +++ b/tests/crypto/mbedtls_psa/boards/nrf54lv10dk_nrf54lv10a_cpuapp.conf @@ -0,0 +1,6 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# +CONFIG_ENTROPY_GENERATOR=y From 6872776607a93ee279176a32a73f4e362ba066d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20St=C4=99pnicki?= Date: Thu, 3 Jul 2025 12:28:09 +0200 Subject: [PATCH 0676/2141] [nrf fromlist] boards: nordic: nrf54h20dk: ipc to cpusys with unbound MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Unbound feature in IPC with cpusys will be enabled by default. This is needed to enable IPC link renewal. If unbound is not needed then it can be disabled in overlay, sysctrl will detect if it is present. Upstream PR #: 94646 Signed-off-by: Łukasz Stępnicki --- boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf.dtsi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf.dtsi b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf.dtsi index f31d909b6f94..f7e7d63d548d 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf.dtsi +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf.dtsi @@ -32,6 +32,7 @@ cpuapp_cpusys_ipc: ipc-2-12 { compatible = "zephyr,ipc-icmsg"; + unbound = "enable"; status = "disabled"; dcache-alignment = <32>; mboxes = <&cpuapp_bellboard 6>, @@ -56,6 +57,7 @@ cpurad_cpusys_ipc: ipc-3-12 { compatible = "zephyr,ipc-icmsg"; + unbound = "enable"; status = "disabled"; dcache-alignment = <32>; mboxes = <&cpurad_bellboard 6>, From c3081e4e090db74ed71b06d118ebba1320202d1f Mon Sep 17 00:00:00 2001 From: Jakub Zymelka Date: Tue, 19 Aug 2025 14:57:36 +0200 Subject: [PATCH 0677/2141] Revert "[nrf fromlist] drivers: adc: nrfx: fix for negative samples in single-mode" This reverts commit e54b99492bc3df78612eabb5743509de8338a9a3. Signed-off-by: Jakub Zymelka --- drivers/adc/adc_nrfx_saadc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/adc/adc_nrfx_saadc.c b/drivers/adc/adc_nrfx_saadc.c index 499d7c4b1108..efc6883e7b48 100644 --- a/drivers/adc/adc_nrfx_saadc.c +++ b/drivers/adc/adc_nrfx_saadc.c @@ -541,7 +541,7 @@ static inline void single_ended_channel_cut_negative_sample(uint16_t channel_bit uint8_t single_ended_channels, int16_t **sample) { - if ((channel_bit & single_ended_channels) && (**sample < 0)) { + if ((channel_bit & single_ended_channels) && (*sample < 0)) { **sample = 0; } From ecebf206d90791a47dc582cb7e4e78390720c201 Mon Sep 17 00:00:00 2001 From: Jakub Zymelka Date: Tue, 19 Aug 2025 14:58:34 +0200 Subject: [PATCH 0678/2141] Revert "[nrf fromlist] drivers: adc: nrfx: enable negative values for single-ended ADC readings" This reverts commit 84ab620777ceec9b286f3fe6640ed0869c682c0b. Signed-off-by: Jakub Zymelka --- drivers/adc/adc_nrfx_saadc.c | 20 ++++++------------ include/zephyr/dt-bindings/adc/nrf-saadc.h | 24 ---------------------- 2 files changed, 6 insertions(+), 38 deletions(-) diff --git a/drivers/adc/adc_nrfx_saadc.c b/drivers/adc/adc_nrfx_saadc.c index efc6883e7b48..42da1cf4232b 100644 --- a/drivers/adc/adc_nrfx_saadc.c +++ b/drivers/adc/adc_nrfx_saadc.c @@ -191,6 +191,7 @@ static int input_assign(nrf_saadc_input_t *pin_p, if (channel_cfg->differential) { if (channel_cfg->input_negative > ARRAY_SIZE(saadc_psels) || + channel_cfg->input_negative < NRF_SAADC_AIN0 || (IS_ENABLED(CONFIG_NRF_PLATFORM_HALTIUM) && (channel_cfg->input_positive > NRF_SAADC_AIN7) != (channel_cfg->input_negative > NRF_SAADC_AIN7))) { @@ -198,17 +199,14 @@ static int input_assign(nrf_saadc_input_t *pin_p, channel_cfg->input_negative); return -EINVAL; } - *pin_n = channel_cfg->input_negative == NRF_SAADC_GND ? - NRF_SAADC_INPUT_DISABLED : - saadc_psels[channel_cfg->input_negative]; + *pin_n = saadc_psels[channel_cfg->input_negative]; } else { *pin_n = NRF_SAADC_INPUT_DISABLED; } #else *pin_p = channel_cfg->input_positive; - *pin_n = (channel_cfg->differential && (channel_cfg->input_negative != NRF_SAADC_GND)) - ? channel_cfg->input_negative - : NRF_SAADC_INPUT_DISABLED; + *pin_n = channel_cfg->differential ? channel_cfg->input_negative + : NRF_SAADC_INPUT_DISABLED; #endif LOG_DBG("ADC positive input: %d", *pin_p); LOG_DBG("ADC negative input: %d", *pin_n); @@ -358,14 +356,8 @@ static int adc_nrfx_channel_setup(const struct device *dev, * after ADC sequence ends. */ if (channel_cfg->differential) { - if (channel_cfg->input_negative == NRF_SAADC_GND) { - ch_cfg->mode = NRF_SAADC_MODE_SINGLE_ENDED; - /* Do not mark as single-ended to not correct negative values. */ - m_data.single_ended_channels &= ~BIT(channel_cfg->channel_id); - } else { - ch_cfg->mode = NRF_SAADC_MODE_DIFFERENTIAL; - m_data.single_ended_channels &= ~BIT(channel_cfg->channel_id); - } + ch_cfg->mode = NRF_SAADC_MODE_DIFFERENTIAL; + m_data.single_ended_channels &= ~BIT(channel_cfg->channel_id); } else { ch_cfg->mode = NRF_SAADC_MODE_SINGLE_ENDED; m_data.single_ended_channels |= BIT(channel_cfg->channel_id); diff --git a/include/zephyr/dt-bindings/adc/nrf-saadc.h b/include/zephyr/dt-bindings/adc/nrf-saadc.h index e5a86150cd43..4a3deb95cff9 100644 --- a/include/zephyr/dt-bindings/adc/nrf-saadc.h +++ b/include/zephyr/dt-bindings/adc/nrf-saadc.h @@ -7,30 +7,6 @@ #ifndef ZEPHYR_INCLUDE_DT_BINDINGS_ADC_NRF_SAADC_H_ #define ZEPHYR_INCLUDE_DT_BINDINGS_ADC_NRF_SAADC_H_ -/** - * @brief Short ADC negative input to ground - * - * @details The nRF SAADC hardware only supports differential readings. - * The nRF SAADC SE (single ended) mode is differential with the negative - * input shorted to GND (ground). To use the nRF SAADC SE mode, set the - * negative input to NRF_SAADC_GND: - * - * @code{.dts} - * zephyr,input-positive = ; - * zephyr,input-negative = ; - * @endcode - * - * The nRF SAADC driver also supports using the nRF SAADC SE mode in - * emulated "single-ended" mode, as defined by zephyr. In this mode, - * negative readings will be clamped to 0 by software to emulate the - * behavior of an ADC in "single-ended" mode, as defined by zephyr. To - * do this, only define the positive input: - * - * @code{.dts} - * zephyr,input-positive = ; - * @endcode - */ -#define NRF_SAADC_GND 0 #define NRF_SAADC_AIN0 1 #define NRF_SAADC_AIN1 2 #define NRF_SAADC_AIN2 3 From ffadf146fd7d2325673f391a58eb1ae1995e8f4c Mon Sep 17 00:00:00 2001 From: Jakub Zymelka Date: Tue, 19 Aug 2025 14:58:48 +0200 Subject: [PATCH 0679/2141] Revert "[nrf fromlist] drivers: adc: nrfx_saadc: Add support for SAADC internal sampling timer" This reverts commit 77547f89162265a6a4a285175b8e60b1dac7ae04. Signed-off-by: Jakub Zymelka --- drivers/adc/adc_nrfx_saadc.c | 176 +++++++---------------------------- 1 file changed, 32 insertions(+), 144 deletions(-) diff --git a/drivers/adc/adc_nrfx_saadc.c b/drivers/adc/adc_nrfx_saadc.c index 42da1cf4232b..100c3fa66efa 100644 --- a/drivers/adc/adc_nrfx_saadc.c +++ b/drivers/adc/adc_nrfx_saadc.c @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +#define ADC_CONTEXT_USES_KERNEL_TIMER #include "adc_context.h" #include #include @@ -103,20 +104,15 @@ struct driver_data { uint8_t active_channel_cnt; void *mem_reg; void *user_buffer; - struct k_timer timer; - bool internal_timer_enabled; }; static struct driver_data m_data = { + ADC_CONTEXT_INIT_TIMER(m_data, ctx), ADC_CONTEXT_INIT_LOCK(m_data, ctx), ADC_CONTEXT_INIT_SYNC(m_data, ctx), .mem_reg = DMM_DEV_TO_REG(DT_NODELABEL(adc)), - .internal_timer_enabled = false, }; -/* Maximum value of the internal timer interval in microseconds. */ -#define ADC_INTERNAL_TIMER_INTERVAL_MAX_US 128U - /* Forward declaration */ static void event_handler(const nrfx_saadc_evt_t *event); @@ -389,57 +385,22 @@ static void adc_context_start_sampling(struct adc_context *ctx) static void adc_context_update_buffer_pointer(struct adc_context *ctx, bool repeat) { - if (!m_data.internal_timer_enabled) { - void *samples_buffer; - - if (!repeat) { - m_data.user_buffer = - (uint16_t *)m_data.user_buffer + m_data.active_channel_cnt; - } - - int error = dmm_buffer_in_prepare( - m_data.mem_reg, m_data.user_buffer, - NRFX_SAADC_SAMPLES_TO_BYTES(m_data.active_channel_cnt), &samples_buffer); - if (error != 0) { - LOG_ERR("DMM buffer allocation failed err=%d", error); - adc_context_complete(ctx, -EIO); - } - - nrfx_err_t nrfx_err = - nrfx_saadc_buffer_set(samples_buffer, m_data.active_channel_cnt); - if (nrfx_err != NRFX_SUCCESS) { - LOG_ERR("Failed to set buffer: %08x", nrfx_err); - adc_context_complete(ctx, -EIO); - } - } -} - -static inline void adc_context_enable_timer(struct adc_context *ctx) -{ - if (!m_data.internal_timer_enabled) { - k_timer_start(&m_data.timer, K_NO_WAIT, K_USEC(ctx->options.interval_us)); - } else { - nrfx_err_t ret = nrfx_saadc_mode_trigger(); + void *samples_buffer; - if (ret != NRFX_SUCCESS) { - LOG_ERR("Cannot start sampling: %d", ret); - adc_context_complete(&m_data.ctx, -EIO); - } + if (!repeat) { + m_data.user_buffer = (uint16_t *)m_data.user_buffer + m_data.active_channel_cnt; } -} -static inline void adc_context_disable_timer(struct adc_context *ctx) -{ - if (!m_data.internal_timer_enabled) { - k_timer_stop(&m_data.timer); + int error = dmm_buffer_in_prepare( + m_data.mem_reg, m_data.user_buffer, + NRFX_SAADC_SAMPLES_TO_BYTES(m_data.active_channel_cnt), + &samples_buffer); + if (error != 0) { + LOG_ERR("DMM buffer allocation failed err=%d", error); + adc_context_complete(ctx, -EIO); } -} - -static void adc_context_on_timer_expired(struct k_timer *timer_id) -{ - ARG_UNUSED(timer_id); - adc_context_request_next_sampling(&m_data.ctx); + nrfx_saadc_buffer_set(samples_buffer, m_data.active_channel_cnt); } static int get_resolution(const struct adc_sequence *sequence, nrf_saadc_resolution_t *resolution) @@ -529,66 +490,29 @@ static int check_buffer_size(const struct adc_sequence *sequence, uint8_t active return 0; } -static inline void single_ended_channel_cut_negative_sample(uint16_t channel_bit, - uint8_t single_ended_channels, - int16_t **sample) -{ - if ((channel_bit & single_ended_channels) && (*sample < 0)) { - **sample = 0; - } - - (*sample)++; -} - static bool has_single_ended(const struct adc_sequence *sequence) { return sequence->channels & m_data.single_ended_channels; } -static void correct_single_ended(const struct adc_sequence *sequence, nrf_saadc_value_t *buffer, - uint16_t buffer_size) +static void correct_single_ended(const struct adc_sequence *sequence, nrf_saadc_value_t *buffer) { + uint16_t channel_bit = BIT(0); uint8_t selected_channels = sequence->channels; uint8_t single_ended_channels = m_data.single_ended_channels; int16_t *sample = (int16_t *)buffer; - for (uint16_t channel_bit = BIT(0); channel_bit <= single_ended_channels; - channel_bit <<= 1) { - if (!(channel_bit & selected_channels)) { - continue; - } - - if (m_data.internal_timer_enabled) { - if (!(channel_bit & single_ended_channels)) { - continue; + while (channel_bit <= single_ended_channels) { + if (channel_bit & selected_channels) { + if ((channel_bit & single_ended_channels) && (*sample < 0)) { + *sample = 0; } - for (int i = 0; i < buffer_size; i++) { - if (sample[i] < 0) { - sample[i] = 0; - } - } - } else { - single_ended_channel_cut_negative_sample(channel_bit, single_ended_channels, - &sample); + sample++; } - } -} - -/* The internal timer runs at 16 MHz, so to convert the interval in microseconds - * to the internal timer CC value, we can use the formula: - * interval_cc = interval_us * 16 MHz - * where 16 MHz is the frequency of the internal timer. - * - * The maximum value for interval_cc is 2047, which corresponds to - * approximately 7816 Hz ~ 128us. - * The minimum value for interval_cc is depends on the SoC. - */ -static inline uint16_t interval_to_cc(uint16_t interval_us) -{ - NRFX_ASSERT((interval_us <= ADC_INTERNAL_TIMER_INTERVAL_MAX_US) && (interval_us > 0)); - return (interval_us * 16) - 1; + channel_bit <<= 1; + } } static int start_read(const struct device *dev, @@ -638,28 +562,10 @@ static int start_read(const struct device *dev, return error; } - if ((active_channel_cnt == 1) && (sequence->options != NULL) && - (sequence->options->interval_us <= ADC_INTERNAL_TIMER_INTERVAL_MAX_US) && - (sequence->options->interval_us > 0)) { - - nrfx_saadc_adv_config_t adv_config = { - .oversampling = oversampling, - .burst = NRF_SAADC_BURST_DISABLED, - .internal_timer_cc = interval_to_cc(sequence->options->interval_us), - .start_on_end = true, - }; - - m_data.internal_timer_enabled = true; - - nrfx_err = nrfx_saadc_advanced_mode_set(selected_channels, resolution, &adv_config, - event_handler); - } else { - m_data.internal_timer_enabled = false; - - nrfx_err = nrfx_saadc_simple_mode_set(selected_channels, resolution, oversampling, - event_handler); - } - + nrfx_err = nrfx_saadc_simple_mode_set(selected_channels, + resolution, + oversampling, + event_handler); if (nrfx_err != NRFX_SUCCESS) { return -EINVAL; } @@ -672,11 +578,9 @@ static int start_read(const struct device *dev, m_data.active_channel_cnt = active_channel_cnt; m_data.user_buffer = sequence->buffer; - error = dmm_buffer_in_prepare(m_data.mem_reg, m_data.user_buffer, - (m_data.internal_timer_enabled - ? (NRFX_SAADC_SAMPLES_TO_BYTES(active_channel_cnt) * - (1 + sequence->options->extra_samplings)) - : NRFX_SAADC_SAMPLES_TO_BYTES(active_channel_cnt)), + error = dmm_buffer_in_prepare(m_data.mem_reg, + m_data.user_buffer, + NRFX_SAADC_SAMPLES_TO_BYTES(active_channel_cnt), &samples_buffer); if (error != 0) { LOG_ERR("DMM buffer allocation failed err=%d", error); @@ -686,15 +590,7 @@ static int start_read(const struct device *dev, /* Buffer is filled in chunks, each chunk composed of number of samples equal to number * of active channels. Buffer pointer is advanced and reloaded after each chunk. */ - nrfx_err = nrfx_saadc_buffer_set( - samples_buffer, - (m_data.internal_timer_enabled - ? (active_channel_cnt * (1 + sequence->options->extra_samplings)) - : active_channel_cnt)); - if (nrfx_err != NRFX_SUCCESS) { - LOG_ERR("Failed to set buffer: %08x", nrfx_err); - return -EINVAL; - } + nrfx_saadc_buffer_set(samples_buffer, active_channel_cnt); adc_context_start_read(&m_data.ctx, sequence); @@ -737,15 +633,11 @@ static void event_handler(const nrfx_saadc_evt_t *event) if (event->type == NRFX_SAADC_EVT_DONE) { dmm_buffer_in_release( m_data.mem_reg, m_data.user_buffer, - (m_data.internal_timer_enabled - ? (NRFX_SAADC_SAMPLES_TO_BYTES(m_data.active_channel_cnt) * - (1 + m_data.ctx.sequence.options->extra_samplings)) - : NRFX_SAADC_SAMPLES_TO_BYTES(m_data.active_channel_cnt)), + NRFX_SAADC_SAMPLES_TO_BYTES(m_data.active_channel_cnt), event->data.done.p_buffer); if (has_single_ended(&m_data.ctx.sequence)) { - correct_single_ended(&m_data.ctx.sequence, m_data.user_buffer, - event->data.done.size); + correct_single_ended(&m_data.ctx.sequence, m_data.user_buffer); } nrfy_saadc_disable(NRF_SAADC); adc_context_on_sampling_done(&m_data.ctx, DEVICE_DT_INST_GET(0)); @@ -755,8 +647,6 @@ static void event_handler(const nrfx_saadc_evt_t *event) LOG_ERR("Cannot start sampling: 0x%08x", err); adc_context_complete(&m_data.ctx, -EIO); } - } else if (event->type == NRFX_SAADC_EVT_FINISHED) { - adc_context_complete(&m_data.ctx, 0); } } @@ -764,8 +654,6 @@ static int init_saadc(const struct device *dev) { nrfx_err_t err; - k_timer_init(&m_data.timer, adc_context_on_timer_expired, NULL); - /* The priority value passed here is ignored (see nrfx_glue.h). */ err = nrfx_saadc_init(0); if (err != NRFX_SUCCESS) { From 605e7799371de1ff935617a1e95fa2f38c208c2c Mon Sep 17 00:00:00 2001 From: Jakub Zymelka Date: Thu, 14 Aug 2025 13:41:20 +0200 Subject: [PATCH 0680/2141] [nrf fromtree] drivers: adc: nrfx_saadc: Add support for SAADC internal sampling timer The SAMPLERATE register can be used as a local timer instead of triggering individual SAMPLE tasks. When SAMPLERATE.MODE is set to Timers, it is sufficient to trigger SAMPLE task only once in order to start the SAADC and triggering the STOP task will stop sampling. The SAMPLERATE.CC field controls the sample rate. The SAMPLERATE timer should not be combined with SCAN mode and only one channel should be enabled when using the internal timer. (cherry picked from commit 376b34ca6366dff1a3f9c524164f6d44d5f69b8f) Signed-off-by: Jakub Zymelka --- drivers/adc/adc_nrfx_saadc.c | 169 +++++++++++++++++++++++++++-------- 1 file changed, 134 insertions(+), 35 deletions(-) diff --git a/drivers/adc/adc_nrfx_saadc.c b/drivers/adc/adc_nrfx_saadc.c index 100c3fa66efa..8c21a34f1108 100644 --- a/drivers/adc/adc_nrfx_saadc.c +++ b/drivers/adc/adc_nrfx_saadc.c @@ -4,7 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -#define ADC_CONTEXT_USES_KERNEL_TIMER #include "adc_context.h" #include #include @@ -104,15 +103,20 @@ struct driver_data { uint8_t active_channel_cnt; void *mem_reg; void *user_buffer; + struct k_timer timer; + bool internal_timer_enabled; }; static struct driver_data m_data = { - ADC_CONTEXT_INIT_TIMER(m_data, ctx), ADC_CONTEXT_INIT_LOCK(m_data, ctx), ADC_CONTEXT_INIT_SYNC(m_data, ctx), .mem_reg = DMM_DEV_TO_REG(DT_NODELABEL(adc)), + .internal_timer_enabled = false, }; +/* Maximum value of the internal timer interval in microseconds. */ +#define ADC_INTERNAL_TIMER_INTERVAL_MAX_US 128U + /* Forward declaration */ static void event_handler(const nrfx_saadc_evt_t *event); @@ -362,7 +366,7 @@ static int adc_nrfx_channel_setup(const struct device *dev, nrfx_err_t ret = nrfx_saadc_channel_config(&cfg); if (ret != NRFX_SUCCESS) { - LOG_ERR("Cannot configure channel %d: %d", channel_cfg->channel_id, ret); + LOG_ERR("Cannot configure channel %d: 0x%08x", channel_cfg->channel_id, ret); return -EINVAL; } @@ -385,22 +389,58 @@ static void adc_context_start_sampling(struct adc_context *ctx) static void adc_context_update_buffer_pointer(struct adc_context *ctx, bool repeat) { - void *samples_buffer; + if (!m_data.internal_timer_enabled) { + void *samples_buffer; + + if (!repeat) { + m_data.user_buffer = + (uint16_t *)m_data.user_buffer + m_data.active_channel_cnt; + } + + int error = dmm_buffer_in_prepare( + m_data.mem_reg, m_data.user_buffer, + NRFX_SAADC_SAMPLES_TO_BYTES(m_data.active_channel_cnt), &samples_buffer); + if (error != 0) { + LOG_ERR("DMM buffer allocation failed err=%d", error); + adc_context_complete(ctx, -EIO); + return; + } - if (!repeat) { - m_data.user_buffer = (uint16_t *)m_data.user_buffer + m_data.active_channel_cnt; + nrfx_err_t nrfx_err = + nrfx_saadc_buffer_set(samples_buffer, m_data.active_channel_cnt); + if (nrfx_err != NRFX_SUCCESS) { + LOG_ERR("Failed to set buffer: 0x%08x", nrfx_err); + adc_context_complete(ctx, -EIO); + } } +} - int error = dmm_buffer_in_prepare( - m_data.mem_reg, m_data.user_buffer, - NRFX_SAADC_SAMPLES_TO_BYTES(m_data.active_channel_cnt), - &samples_buffer); - if (error != 0) { - LOG_ERR("DMM buffer allocation failed err=%d", error); - adc_context_complete(ctx, -EIO); +static inline void adc_context_enable_timer(struct adc_context *ctx) +{ + if (!m_data.internal_timer_enabled) { + k_timer_start(&m_data.timer, K_NO_WAIT, K_USEC(ctx->options.interval_us)); + } else { + nrfx_err_t ret = nrfx_saadc_mode_trigger(); + + if (ret != NRFX_SUCCESS) { + LOG_ERR("Cannot start sampling: 0x%08x", ret); + adc_context_complete(&m_data.ctx, -EIO); + } } +} + +static inline void adc_context_disable_timer(struct adc_context *ctx) +{ + if (!m_data.internal_timer_enabled) { + k_timer_stop(&m_data.timer); + } +} - nrfx_saadc_buffer_set(samples_buffer, m_data.active_channel_cnt); +static void external_timer_expired_handler(struct k_timer *timer_id) +{ + ARG_UNUSED(timer_id); + + adc_context_request_next_sampling(&m_data.ctx); } static int get_resolution(const struct adc_sequence *sequence, nrf_saadc_resolution_t *resolution) @@ -495,26 +535,48 @@ static bool has_single_ended(const struct adc_sequence *sequence) return sequence->channels & m_data.single_ended_channels; } -static void correct_single_ended(const struct adc_sequence *sequence, nrf_saadc_value_t *buffer) +static void correct_single_ended(const struct adc_sequence *sequence, nrf_saadc_value_t *buffer, + uint16_t num_samples) { - uint16_t channel_bit = BIT(0); - uint8_t selected_channels = sequence->channels; - uint8_t single_ended_channels = m_data.single_ended_channels; int16_t *sample = (int16_t *)buffer; - while (channel_bit <= single_ended_channels) { - if (channel_bit & selected_channels) { - if ((channel_bit & single_ended_channels) && (*sample < 0)) { - *sample = 0; + if (m_data.internal_timer_enabled) { + for (int i = 0; i < num_samples; i++) { + if (sample[i] < 0) { + sample[i] = 0; } + } + } else { + uint8_t selected_channels = sequence->channels; + uint8_t single_ended_channels = m_data.single_ended_channels; + for (uint16_t channel_bit = BIT(0); channel_bit <= single_ended_channels; + channel_bit <<= 1) { + if ((channel_bit & selected_channels & single_ended_channels) && + (*sample < 0)) { + *sample = 0; + } sample++; } - - channel_bit <<= 1; } } +/* The internal timer runs at 16 MHz, so to convert the interval in microseconds + * to the internal timer CC value, we can use the formula: + * interval_cc = interval_us * 16 MHz + * where 16 MHz is the frequency of the internal timer. + * + * The maximum value for interval_cc is 2047, which corresponds to + * approximately 7816 Hz ~ 128us. + * The minimum value for interval_cc is depends on the SoC. + */ +static inline uint16_t interval_to_cc(uint16_t interval_us) +{ + NRFX_ASSERT((interval_us <= ADC_INTERNAL_TIMER_INTERVAL_MAX_US) && (interval_us > 0)); + + return (interval_us * 16) - 1; +} + static int start_read(const struct device *dev, const struct adc_sequence *sequence) { @@ -562,10 +624,29 @@ static int start_read(const struct device *dev, return error; } - nrfx_err = nrfx_saadc_simple_mode_set(selected_channels, - resolution, - oversampling, - event_handler); + if ((active_channel_cnt == 1) && (sequence->options != NULL) && + (sequence->options->callback == NULL) && + (sequence->options->interval_us <= ADC_INTERNAL_TIMER_INTERVAL_MAX_US) && + (sequence->options->interval_us > 0)) { + + nrfx_saadc_adv_config_t adv_config = { + .oversampling = oversampling, + .burst = NRF_SAADC_BURST_DISABLED, + .internal_timer_cc = interval_to_cc(sequence->options->interval_us), + .start_on_end = true, + }; + + m_data.internal_timer_enabled = true; + + nrfx_err = nrfx_saadc_advanced_mode_set(selected_channels, resolution, &adv_config, + event_handler); + } else { + m_data.internal_timer_enabled = false; + + nrfx_err = nrfx_saadc_simple_mode_set(selected_channels, resolution, oversampling, + event_handler); + } + if (nrfx_err != NRFX_SUCCESS) { return -EINVAL; } @@ -578,10 +659,12 @@ static int start_read(const struct device *dev, m_data.active_channel_cnt = active_channel_cnt; m_data.user_buffer = sequence->buffer; - error = dmm_buffer_in_prepare(m_data.mem_reg, - m_data.user_buffer, - NRFX_SAADC_SAMPLES_TO_BYTES(active_channel_cnt), - &samples_buffer); + error = dmm_buffer_in_prepare( + m_data.mem_reg, m_data.user_buffer, + (m_data.internal_timer_enabled + ? NRFX_SAADC_SAMPLES_TO_BYTES(1 + sequence->options->extra_samplings) + : NRFX_SAADC_SAMPLES_TO_BYTES(active_channel_cnt)), + &samples_buffer); if (error != 0) { LOG_ERR("DMM buffer allocation failed err=%d", error); return error; @@ -590,7 +673,15 @@ static int start_read(const struct device *dev, /* Buffer is filled in chunks, each chunk composed of number of samples equal to number * of active channels. Buffer pointer is advanced and reloaded after each chunk. */ - nrfx_saadc_buffer_set(samples_buffer, active_channel_cnt); + nrfx_err = nrfx_saadc_buffer_set( + samples_buffer, + (m_data.internal_timer_enabled + ? (1 + sequence->options->extra_samplings) + : active_channel_cnt)); + if (nrfx_err != NRFX_SUCCESS) { + LOG_ERR("Failed to set buffer: 0x%08x", nrfx_err); + return -EINVAL; + } adc_context_start_read(&m_data.ctx, sequence); @@ -633,11 +724,15 @@ static void event_handler(const nrfx_saadc_evt_t *event) if (event->type == NRFX_SAADC_EVT_DONE) { dmm_buffer_in_release( m_data.mem_reg, m_data.user_buffer, - NRFX_SAADC_SAMPLES_TO_BYTES(m_data.active_channel_cnt), + (m_data.internal_timer_enabled + ? NRFX_SAADC_SAMPLES_TO_BYTES( + 1 + m_data.ctx.sequence.options->extra_samplings) + : NRFX_SAADC_SAMPLES_TO_BYTES(m_data.active_channel_cnt)), event->data.done.p_buffer); if (has_single_ended(&m_data.ctx.sequence)) { - correct_single_ended(&m_data.ctx.sequence, m_data.user_buffer); + correct_single_ended(&m_data.ctx.sequence, m_data.user_buffer, + event->data.done.size); } nrfy_saadc_disable(NRF_SAADC); adc_context_on_sampling_done(&m_data.ctx, DEVICE_DT_INST_GET(0)); @@ -647,6 +742,8 @@ static void event_handler(const nrfx_saadc_evt_t *event) LOG_ERR("Cannot start sampling: 0x%08x", err); adc_context_complete(&m_data.ctx, -EIO); } + } else if (event->type == NRFX_SAADC_EVT_FINISHED) { + adc_context_complete(&m_data.ctx, 0); } } @@ -654,6 +751,8 @@ static int init_saadc(const struct device *dev) { nrfx_err_t err; + k_timer_init(&m_data.timer, external_timer_expired_handler, NULL); + /* The priority value passed here is ignored (see nrfx_glue.h). */ err = nrfx_saadc_init(0); if (err != NRFX_SUCCESS) { From 77197cecc0575a068c1bd79fcf0aee4eed5ff543 Mon Sep 17 00:00:00 2001 From: Jakub Zymelka Date: Tue, 19 Aug 2025 11:02:32 +0200 Subject: [PATCH 0681/2141] [nrf fromtree] drivers: adc: nrfx: enable negative values for single-ended ADC readings The ADC driver API already supports ADC readings which can return signed values, these are differential readings. In Nordic's datasheet, we have a mode called "single ended", but its just a name. "Single ended" is a differential reading, with the negative channel tied to GND. This is not compatible with zephyrs definition of a single ended reading. To support Nordic's "single ended" mode, the user must configure a differential reading, with the negative input tied to ground, which the saadc driver can then use to configure the reading as Nordic SAADC "single ended", and return negative values as expected. (cherry picked from commit 138f97770499d5e48ba8a10f8367c5850b04cdfc) Signed-off-by: Jakub Zymelka --- drivers/adc/adc_nrfx_saadc.c | 46 ++++++++++++++++------ include/zephyr/dt-bindings/adc/nrf-saadc.h | 24 +++++++++++ 2 files changed, 57 insertions(+), 13 deletions(-) diff --git a/drivers/adc/adc_nrfx_saadc.c b/drivers/adc/adc_nrfx_saadc.c index 8c21a34f1108..50aef053fd94 100644 --- a/drivers/adc/adc_nrfx_saadc.c +++ b/drivers/adc/adc_nrfx_saadc.c @@ -100,6 +100,7 @@ BUILD_ASSERT((NRF_SAADC_AIN0 == NRF_SAADC_INPUT_AIN0) && struct driver_data { struct adc_context ctx; uint8_t single_ended_channels; + uint8_t divide_single_ended_value; uint8_t active_channel_cnt; void *mem_reg; void *user_buffer; @@ -191,7 +192,6 @@ static int input_assign(nrf_saadc_input_t *pin_p, if (channel_cfg->differential) { if (channel_cfg->input_negative > ARRAY_SIZE(saadc_psels) || - channel_cfg->input_negative < NRF_SAADC_AIN0 || (IS_ENABLED(CONFIG_NRF_PLATFORM_HALTIUM) && (channel_cfg->input_positive > NRF_SAADC_AIN7) != (channel_cfg->input_negative > NRF_SAADC_AIN7))) { @@ -199,14 +199,17 @@ static int input_assign(nrf_saadc_input_t *pin_p, channel_cfg->input_negative); return -EINVAL; } - *pin_n = saadc_psels[channel_cfg->input_negative]; + *pin_n = channel_cfg->input_negative == NRF_SAADC_GND ? + NRF_SAADC_INPUT_DISABLED : + saadc_psels[channel_cfg->input_negative]; } else { *pin_n = NRF_SAADC_INPUT_DISABLED; } #else *pin_p = channel_cfg->input_positive; - *pin_n = channel_cfg->differential ? channel_cfg->input_negative - : NRF_SAADC_INPUT_DISABLED; + *pin_n = (channel_cfg->differential && (channel_cfg->input_negative != NRF_SAADC_GND)) + ? channel_cfg->input_negative + : NRF_SAADC_INPUT_DISABLED; #endif LOG_DBG("ADC positive input: %d", *pin_p); LOG_DBG("ADC negative input: %d", *pin_n); @@ -356,11 +359,18 @@ static int adc_nrfx_channel_setup(const struct device *dev, * after ADC sequence ends. */ if (channel_cfg->differential) { - ch_cfg->mode = NRF_SAADC_MODE_DIFFERENTIAL; - m_data.single_ended_channels &= ~BIT(channel_cfg->channel_id); + if (channel_cfg->input_negative == NRF_SAADC_GND) { + ch_cfg->mode = NRF_SAADC_MODE_SINGLE_ENDED; + m_data.single_ended_channels |= BIT(channel_cfg->channel_id); + m_data.divide_single_ended_value |= BIT(channel_cfg->channel_id); + } else { + ch_cfg->mode = NRF_SAADC_MODE_DIFFERENTIAL; + m_data.single_ended_channels &= ~BIT(channel_cfg->channel_id); + } } else { ch_cfg->mode = NRF_SAADC_MODE_SINGLE_ENDED; m_data.single_ended_channels |= BIT(channel_cfg->channel_id); + m_data.divide_single_ended_value &= ~BIT(channel_cfg->channel_id); } nrfx_err_t ret = nrfx_saadc_channel_config(&cfg); @@ -539,22 +549,32 @@ static void correct_single_ended(const struct adc_sequence *sequence, nrf_saadc_ uint16_t num_samples) { int16_t *sample = (int16_t *)buffer; + uint8_t selected_channels = sequence->channels; + uint8_t divide_single_ended_value = m_data.divide_single_ended_value; if (m_data.internal_timer_enabled) { - for (int i = 0; i < num_samples; i++) { - if (sample[i] < 0) { - sample[i] = 0; + if (selected_channels & divide_single_ended_value) { + for (int i = 0; i < num_samples; i++) { + sample[i] /= 2; + } + } else { + for (int i = 0; i < num_samples; i++) { + if (sample[i] < 0) { + sample[i] = 0; + } } } } else { - uint8_t selected_channels = sequence->channels; uint8_t single_ended_channels = m_data.single_ended_channels; for (uint16_t channel_bit = BIT(0); channel_bit <= single_ended_channels; channel_bit <<= 1) { - if ((channel_bit & selected_channels & single_ended_channels) && - (*sample < 0)) { - *sample = 0; + if (channel_bit & selected_channels & single_ended_channels) { + if (channel_bit & divide_single_ended_value) { + *sample /= 2; + } else if (*sample < 0) { + *sample = 0; + } } sample++; } diff --git a/include/zephyr/dt-bindings/adc/nrf-saadc.h b/include/zephyr/dt-bindings/adc/nrf-saadc.h index 4a3deb95cff9..e5a86150cd43 100644 --- a/include/zephyr/dt-bindings/adc/nrf-saadc.h +++ b/include/zephyr/dt-bindings/adc/nrf-saadc.h @@ -7,6 +7,30 @@ #ifndef ZEPHYR_INCLUDE_DT_BINDINGS_ADC_NRF_SAADC_H_ #define ZEPHYR_INCLUDE_DT_BINDINGS_ADC_NRF_SAADC_H_ +/** + * @brief Short ADC negative input to ground + * + * @details The nRF SAADC hardware only supports differential readings. + * The nRF SAADC SE (single ended) mode is differential with the negative + * input shorted to GND (ground). To use the nRF SAADC SE mode, set the + * negative input to NRF_SAADC_GND: + * + * @code{.dts} + * zephyr,input-positive = ; + * zephyr,input-negative = ; + * @endcode + * + * The nRF SAADC driver also supports using the nRF SAADC SE mode in + * emulated "single-ended" mode, as defined by zephyr. In this mode, + * negative readings will be clamped to 0 by software to emulate the + * behavior of an ADC in "single-ended" mode, as defined by zephyr. To + * do this, only define the positive input: + * + * @code{.dts} + * zephyr,input-positive = ; + * @endcode + */ +#define NRF_SAADC_GND 0 #define NRF_SAADC_AIN0 1 #define NRF_SAADC_AIN1 2 #define NRF_SAADC_AIN2 3 From 778ca5fed933dba356bc3c8003915749775ac031 Mon Sep 17 00:00:00 2001 From: Jakub Zymelka Date: Wed, 20 Aug 2025 10:06:08 +0200 Subject: [PATCH 0682/2141] [nrf fromlist] drivers: adc: nrfx_saadc: Fix for negative samples correction Increment pointer only when channel was selected. Upstream PR #: 94705 Signed-off-by: Jakub Zymelka --- drivers/adc/adc_nrfx_saadc.c | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/drivers/adc/adc_nrfx_saadc.c b/drivers/adc/adc_nrfx_saadc.c index 50aef053fd94..614973261746 100644 --- a/drivers/adc/adc_nrfx_saadc.c +++ b/drivers/adc/adc_nrfx_saadc.c @@ -550,10 +550,11 @@ static void correct_single_ended(const struct adc_sequence *sequence, nrf_saadc_ { int16_t *sample = (int16_t *)buffer; uint8_t selected_channels = sequence->channels; - uint8_t divide_single_ended_value = m_data.divide_single_ended_value; + uint8_t divide_mask = m_data.divide_single_ended_value; + uint8_t single_ended_mask = m_data.single_ended_channels; if (m_data.internal_timer_enabled) { - if (selected_channels & divide_single_ended_value) { + if (selected_channels & divide_mask) { for (int i = 0; i < num_samples; i++) { sample[i] /= 2; } @@ -564,20 +565,22 @@ static void correct_single_ended(const struct adc_sequence *sequence, nrf_saadc_ } } } - } else { - uint8_t single_ended_channels = m_data.single_ended_channels; - - for (uint16_t channel_bit = BIT(0); channel_bit <= single_ended_channels; - channel_bit <<= 1) { - if (channel_bit & selected_channels & single_ended_channels) { - if (channel_bit & divide_single_ended_value) { - *sample /= 2; - } else if (*sample < 0) { - *sample = 0; - } + return; + } + + for (uint16_t channel_bit = BIT(0); channel_bit <= single_ended_mask; channel_bit <<= 1) { + if (!(channel_bit & selected_channels)) { + continue; + } + + if (channel_bit & single_ended_mask) { + if (channel_bit & divide_mask) { + *sample /= 2; + } else if (*sample < 0) { + *sample = 0; } - sample++; } + sample++; } } From 4e4710276bf23706c908a04940dc2b4110225353 Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Thu, 21 Aug 2025 09:56:04 +0200 Subject: [PATCH 0683/2141] Revert "[nrf noup] zms: add lookup cache hash function for legacy ZMS" This reverts commit 15cd2f6e5d5b9e6580365cae8d882e1e8845f188. To be re-applied after cherry-picks. Signed-off-by: Grzegorz Swiderski --- subsys/fs/zms/zms.c | 38 -------------------------------------- 1 file changed, 38 deletions(-) diff --git a/subsys/fs/zms/zms.c b/subsys/fs/zms/zms.c index 95c2ef82c3b4..80b86a41cdcb 100644 --- a/subsys/fs/zms/zms.c +++ b/subsys/fs/zms/zms.c @@ -13,12 +13,8 @@ #include #include "zms_priv.h" #ifdef CONFIG_ZMS_LOOKUP_CACHE_FOR_SETTINGS -#ifdef CONFIG_SETTINGS_ZMS_LEGACY -#include -#else #include #endif -#endif #include LOG_MODULE_REGISTER(fs_zms, CONFIG_ZMS_LOG_LEVEL); @@ -38,39 +34,6 @@ static inline size_t zms_lookup_cache_pos(uint32_t id) uint32_t hash = id; #ifdef CONFIG_ZMS_LOOKUP_CACHE_FOR_SETTINGS -#ifdef CONFIG_SETTINGS_ZMS_LEGACY - /* - * 1. The ZMS settings backend uses up to (ZMS_NAME_ID_OFFSET - 1) ZMS IDs to - store keys and equal number of ZMS IDs to store values. - * 2. For each key-value pair, the value is stored at ZMS ID greater by exactly - * ZMS_NAME_ID_OFFSET than ZMS ID that holds the key. - * 3. The backend tries to minimize the range of ZMS IDs used to store keys. - * That is, ZMS IDs are allocated sequentially, and freed ZMS IDs are reused - * before allocating new ones. - * - * Therefore, to assure the least number of collisions in the lookup cache, - * the least significant bit of the hash indicates whether the given ZMS ID - * represents a key or a value, and remaining bits of the hash are set to - * the ordinal number of the key-value pair. Consequently, the hash function - * provides the following mapping: - * - * 1st settings key => hash 0 - * 1st settings value => hash 1 - * 2nd settings key => hash 2 - * 2nd settings value => hash 3 - * ... - */ - BUILD_ASSERT(IS_POWER_OF_TWO(ZMS_NAMECNT_ID), "ZMS_NAMECNT_ID is not power of 2"); - BUILD_ASSERT(IS_POWER_OF_TWO(ZMS_NAME_ID_OFFSET), "ZMS_NAME_ID_OFFSET is not power of 2"); - - uint32_t key_value_bit; - uint32_t key_value_ord; - - key_value_bit = (id >> LOG2(ZMS_NAME_ID_OFFSET)) & 1; - key_value_ord = id & (ZMS_NAME_ID_OFFSET - 1); - - hash = ((key_value_ord << 1) | key_value_bit); -#else /* * 1. Settings subsystem is storing the name ID and the linked list node ID * with only one bit difference at BIT(0). @@ -95,7 +58,6 @@ static inline size_t zms_lookup_cache_pos(uint32_t id) key_value_ll = id & BIT(0); hash = (key_value_hash << 2) | (key_value_bit << 1) | key_value_ll; -#endif /* CONFIG_SETTINGS_ZMS_LEGACY */ #else /* 32-bit integer hash function found by https://github.com/skeeto/hash-prospector. */ hash ^= hash >> 16; From 73fe1eee7fd419790c21444135638ac0c6b58181 Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Mon, 11 Aug 2025 12:08:09 +0200 Subject: [PATCH 0684/2141] [nrf fromlist] zms: Initial support for 64 bit IDs Upstream PR #: 94330 Allow the ZMS API to optionally accept 64 bit IDs. A typedef `zms_id_t` is added, so that the maximum ID width can be controlled using Kconfig. The current ATE structure is already large enough that it is possible to reserve 64 bits for IDs without increasing its total size (128 bits). This makes the feature a natural, low footprint alternative to Settings, for cases where the supported key namespace must be larger than 32 bit but not arbitrarily large. The ATE format does have to be altered to accommodate larger IDs, but the default "32 bit" format is left as is. Now, the `struct zms_ate` describes one of two supported formats, selected based on an `#ifdef`. In the future, it may be possible to support multiple ATE formats at runtime, in which case the structure can be turned into a union. In the new, "64 bit" ATEs, the `offset` and `metadata` fields are moved into a union, because they are found to be mutually exclusive. With the old format, the same fields are in different locations, but one of them always gets filled with a dummy value, depending on the given ATE type. To cover both cases, use a `memset` which the compiler can optimize away when appropriate. The only limitation is that the new ATE format has no room for data CRC, but an alternative integrity check can be implemented by the caller. Signed-off-by: Grzegorz Swiderski (cherry picked from commit 11e2cd69f89595f6eaafc74a75a78121532b8885) --- include/zephyr/fs/zms.h | 21 ++++++++++---- subsys/fs/zms/Kconfig | 10 +++++++ subsys/fs/zms/zms.c | 62 +++++++++++++++++++++++++--------------- subsys/fs/zms/zms_priv.h | 32 +++++++++++++++++++-- 4 files changed, 94 insertions(+), 31 deletions(-) diff --git a/include/zephyr/fs/zms.h b/include/zephyr/fs/zms.h index 8b776b426f9c..436f448f6b48 100644 --- a/include/zephyr/fs/zms.h +++ b/include/zephyr/fs/zms.h @@ -77,6 +77,17 @@ struct zms_fs { * @{ */ +/** + * @brief ID type used in the ZMS API. + * + * @note The width of this type depends on @kconfig{CONFIG_ZMS_ID_64BIT}. + */ +#if CONFIG_ZMS_ID_64BIT +typedef uint64_t zms_id_t; +#else +typedef uint32_t zms_id_t; +#endif + /** * @brief Mount a ZMS file system onto the device specified in `fs`. * @@ -127,7 +138,7 @@ int zms_clear(struct zms_fs *fs); * @retval -EINVAL if `len` is invalid. * @retval -ENOSPC if no space is left on the device. */ -ssize_t zms_write(struct zms_fs *fs, uint32_t id, const void *data, size_t len); +ssize_t zms_write(struct zms_fs *fs, zms_id_t id, const void *data, size_t len); /** * @brief Delete an entry from the file system @@ -140,7 +151,7 @@ ssize_t zms_write(struct zms_fs *fs, uint32_t id, const void *data, size_t len); * @retval -ENXIO if there is a device error. * @retval -EIO if there is a memory read/write error. */ -int zms_delete(struct zms_fs *fs, uint32_t id); +int zms_delete(struct zms_fs *fs, zms_id_t id); /** * @brief Read an entry from the file system. @@ -158,7 +169,7 @@ int zms_delete(struct zms_fs *fs, uint32_t id); * @retval -EIO if there is a memory read/write error. * @retval -ENOENT if there is no entry with the given `id`. */ -ssize_t zms_read(struct zms_fs *fs, uint32_t id, void *data, size_t len); +ssize_t zms_read(struct zms_fs *fs, zms_id_t id, void *data, size_t len); /** * @brief Read a history entry from the file system. @@ -178,7 +189,7 @@ ssize_t zms_read(struct zms_fs *fs, uint32_t id, void *data, size_t len); * @retval -EIO if there is a memory read/write error. * @retval -ENOENT if there is no entry with the given `id` and history counter. */ -ssize_t zms_read_hist(struct zms_fs *fs, uint32_t id, void *data, size_t len, uint32_t cnt); +ssize_t zms_read_hist(struct zms_fs *fs, zms_id_t id, void *data, size_t len, uint32_t cnt); /** * @brief Gets the length of the data that is stored in an entry with a given `id` @@ -193,7 +204,7 @@ ssize_t zms_read_hist(struct zms_fs *fs, uint32_t id, void *data, size_t len, ui * @retval -EIO if there is a memory read/write error. * @retval -ENOENT if there is no entry with the given id and history counter. */ -ssize_t zms_get_data_length(struct zms_fs *fs, uint32_t id); +ssize_t zms_get_data_length(struct zms_fs *fs, zms_id_t id); /** * @brief Calculate the available free space in the file system. diff --git a/subsys/fs/zms/Kconfig b/subsys/fs/zms/Kconfig index f371d75647f1..ad424608e0ef 100644 --- a/subsys/fs/zms/Kconfig +++ b/subsys/fs/zms/Kconfig @@ -15,6 +15,15 @@ config ZMS if ZMS +config ZMS_ID_64BIT + bool "64 bit ZMS IDs" + help + When this option is true, the `zms_id_t` values passed to ZMS APIs will be 64 bit, + as opposed to the default 32 bit. + This option will also change the format of allocation table entries (ATEs) in memory + to accommodate larger IDs. Currently, this will make ZMS unable to mount an existing + file system if it has been initialized with a different ATE format. + config ZMS_LOOKUP_CACHE bool "ZMS lookup cache" help @@ -33,6 +42,7 @@ config ZMS_LOOKUP_CACHE_SIZE config ZMS_DATA_CRC bool "ZMS data CRC" + depends on !ZMS_ID_64BIT config ZMS_CUSTOMIZE_BLOCK_SIZE bool "Customize the size of the buffer used internally for reads and writes" diff --git a/subsys/fs/zms/zms.c b/subsys/fs/zms/zms.c index 80b86a41cdcb..250c9c47dadb 100644 --- a/subsys/fs/zms/zms.c +++ b/subsys/fs/zms/zms.c @@ -29,10 +29,8 @@ static int zms_ate_valid_different_sector(struct zms_fs *fs, const struct zms_at #ifdef CONFIG_ZMS_LOOKUP_CACHE -static inline size_t zms_lookup_cache_pos(uint32_t id) +static inline size_t zms_lookup_cache_pos(zms_id_t id) { - uint32_t hash = id; - #ifdef CONFIG_ZMS_LOOKUP_CACHE_FOR_SETTINGS /* * 1. Settings subsystem is storing the name ID and the linked list node ID @@ -52,14 +50,26 @@ static inline size_t zms_lookup_cache_pos(uint32_t id) uint32_t key_value_bit; uint32_t key_value_hash; uint32_t key_value_ll; + uint32_t hash; key_value_bit = (id >> LOG2(ZMS_DATA_ID_OFFSET)) & 1; key_value_hash = (id & ZMS_HASH_MASK) >> (CONFIG_SETTINGS_ZMS_MAX_COLLISIONS_BITS + 1); key_value_ll = id & BIT(0); hash = (key_value_hash << 2) | (key_value_bit << 1) | key_value_ll; +#elif defined(CONFIG_ZMS_ID_64BIT) + /* 64-bit integer hash function found by https://github.com/skeeto/hash-prospector. */ + uint64_t hash = id; + + hash ^= hash >> 32; + hash *= 0x42ab4abe4c475039ULL; + hash ^= hash >> 31; + hash *= 0xfa90c4424c537791ULL; + hash ^= hash >> 32; #else /* 32-bit integer hash function found by https://github.com/skeeto/hash-prospector. */ + uint32_t hash = id; + hash ^= hash >> 16; hash *= 0x7feb352dU; hash ^= hash >> 15; @@ -239,7 +249,7 @@ static int zms_flash_ate_wrt(struct zms_fs *fs, const struct zms_ate *entry) goto end; } #ifdef CONFIG_ZMS_LOOKUP_CACHE - /* 0xFFFFFFFF is a special-purpose identifier. Exclude it from the cache */ + /* ZMS_HEAD_ID is a special-purpose identifier. Exclude it from the cache */ if (entry->id != ZMS_HEAD_ID) { fs->lookup_cache[zms_lookup_cache_pos(entry->id)] = fs->ate_wra; } @@ -487,7 +497,7 @@ static bool zms_close_ate_valid(struct zms_fs *fs, const struct zms_ate *entry) /* zms_empty_ate_valid validates an sector empty ate. * A valid sector empty ate should be: * - a valid ate - * - with len = 0xffff and id = 0xffffffff + * - with len = 0xffff and id = ZMS_HEAD_ID * return true if valid, false otherwise */ static bool zms_empty_ate_valid(struct zms_fs *fs, const struct zms_ate *entry) @@ -500,7 +510,7 @@ static bool zms_empty_ate_valid(struct zms_fs *fs, const struct zms_ate *entry) * Valid gc_done_ate: * - valid ate * - len = 0 - * - id = 0xffffffff + * - id = ZMS_HEAD_ID * return true if valid, false otherwise */ static bool zms_gc_done_ate_valid(struct zms_fs *fs, const struct zms_ate *entry) @@ -536,7 +546,7 @@ static int zms_validate_closed_sector(struct zms_fs *fs, uint64_t addr, struct z } /* store an entry in flash */ -static int zms_flash_write_entry(struct zms_fs *fs, uint32_t id, const void *data, size_t len) +static int zms_flash_write_entry(struct zms_fs *fs, zms_id_t id, const void *data, size_t len) { int rc; struct zms_ate entry; @@ -549,13 +559,13 @@ static int zms_flash_write_entry(struct zms_fs *fs, uint32_t id, const void *dat entry.cycle_cnt = fs->sector_cycle; if (len > ZMS_DATA_IN_ATE_SIZE) { - /* only compute CRC if len is greater than 8 bytes */ - if (IS_ENABLED(CONFIG_ZMS_DATA_CRC)) { - entry.data_crc = crc32_ieee(data, len); - } +#ifdef CONFIG_ZMS_DATA_CRC + /* only compute CRC if data is to be stored outside of entry */ + entry.data_crc = crc32_ieee(data, len); +#endif entry.offset = (uint32_t)SECTOR_OFFSET(fs->data_wra); } else if ((len > 0) && (len <= ZMS_DATA_IN_ATE_SIZE)) { - /* Copy data into entry for small data ( < 8B) */ + /* Copy data into entry if data is sufficiently small */ memcpy(&entry.data, data, len); } @@ -688,10 +698,12 @@ static int zms_sector_close(struct zms_fs *fs) struct zms_ate close_ate; struct zms_ate garbage_ate; + /* Initialize all members to 0xff */ + memset(&close_ate, 0xff, sizeof(struct zms_ate)); + close_ate.id = ZMS_HEAD_ID; close_ate.len = 0U; close_ate.offset = (uint32_t)SECTOR_OFFSET(fs->ate_wra + fs->ate_size); - close_ate.metadata = 0xffffffff; close_ate.cycle_cnt = fs->sector_cycle; /* When we close the sector, we must write all non used ATE with @@ -740,11 +752,13 @@ static int zms_add_gc_done_ate(struct zms_fs *fs) { struct zms_ate gc_done_ate; + /* Initialize all members to 0xff */ + memset(&gc_done_ate, 0xff, sizeof(struct zms_ate)); + LOG_DBG("Adding gc done ate at %llx", fs->ate_wra); gc_done_ate.id = ZMS_HEAD_ID; gc_done_ate.len = 0U; gc_done_ate.offset = (uint32_t)SECTOR_OFFSET(fs->data_wra); - gc_done_ate.metadata = 0xffffffff; gc_done_ate.cycle_cnt = fs->sector_cycle; zms_ate_crc8_update(&gc_done_ate); @@ -793,12 +807,14 @@ static int zms_add_empty_ate(struct zms_fs *fs, uint64_t addr) int rc = 0; uint64_t previous_ate_wra; + /* Initialize all members to 0 */ + memset(&empty_ate, 0, sizeof(struct zms_ate)); + addr &= ADDR_SECT_MASK; LOG_DBG("Adding empty ate at %llx", (uint64_t)(addr + fs->sector_size - fs->ate_size)); empty_ate.id = ZMS_HEAD_ID; empty_ate.len = 0xffff; - empty_ate.offset = 0U; empty_ate.metadata = FIELD_PREP(ZMS_MAGIC_NUMBER_MASK, ZMS_MAGIC_NUMBER) | ZMS_DEFAULT_VERSION; @@ -893,7 +909,7 @@ static int zms_get_sector_header(struct zms_fs *fs, uint64_t addr, struct zms_at * @retval 1 valid ATE with same ID found * @retval < 0 An error happened */ -static int zms_find_ate_with_id(struct zms_fs *fs, uint32_t id, uint64_t start_addr, +static int zms_find_ate_with_id(struct zms_fs *fs, zms_id_t id, uint64_t start_addr, uint64_t end_addr, struct zms_ate *ate, uint64_t *ate_addr) { int rc; @@ -1044,10 +1060,10 @@ static int zms_gc(struct zms_fs *fs) */ if (wlk_prev_addr == gc_prev_addr) { /* copy needed */ - LOG_DBG("Moving %d, len %d", gc_ate.id, gc_ate.len); + LOG_DBG("Moving %lld, len %d", (long long)gc_ate.id, gc_ate.len); if (gc_ate.len > ZMS_DATA_IN_ATE_SIZE) { - /* Copy Data only when len > 8 + /* Only copy Data with large enough len * Otherwise, Data is already inside ATE */ data_addr = (gc_prev_addr & ADDR_SECT_MASK); @@ -1458,7 +1474,7 @@ int zms_mount(struct zms_fs *fs) return 0; } -ssize_t zms_write(struct zms_fs *fs, uint32_t id, const void *data, size_t len) +ssize_t zms_write(struct zms_fs *fs, zms_id_t id, const void *data, size_t len) { int rc; size_t data_size; @@ -1598,12 +1614,12 @@ ssize_t zms_write(struct zms_fs *fs, uint32_t id, const void *data, size_t len) return rc; } -int zms_delete(struct zms_fs *fs, uint32_t id) +int zms_delete(struct zms_fs *fs, zms_id_t id) { return zms_write(fs, id, NULL, 0); } -ssize_t zms_read_hist(struct zms_fs *fs, uint32_t id, void *data, size_t len, uint32_t cnt) +ssize_t zms_read_hist(struct zms_fs *fs, zms_id_t id, void *data, size_t len, uint32_t cnt) { int rc; int prev_found = 0; @@ -1700,7 +1716,7 @@ ssize_t zms_read_hist(struct zms_fs *fs, uint32_t id, void *data, size_t len, ui return rc; } -ssize_t zms_read(struct zms_fs *fs, uint32_t id, void *data, size_t len) +ssize_t zms_read(struct zms_fs *fs, zms_id_t id, void *data, size_t len) { int rc; @@ -1713,7 +1729,7 @@ ssize_t zms_read(struct zms_fs *fs, uint32_t id, void *data, size_t len) return MIN(rc, len); } -ssize_t zms_get_data_length(struct zms_fs *fs, uint32_t id) +ssize_t zms_get_data_length(struct zms_fs *fs, zms_id_t id) { int rc; diff --git a/subsys/fs/zms/zms_priv.h b/subsys/fs/zms/zms_priv.h index 84f77296f4f3..97e202c2d530 100644 --- a/subsys/fs/zms/zms_priv.h +++ b/subsys/fs/zms/zms_priv.h @@ -28,22 +28,21 @@ #endif #define ZMS_LOOKUP_CACHE_NO_ADDR GENMASK64(63, 0) -#define ZMS_HEAD_ID GENMASK(31, 0) #define ZMS_VERSION_MASK GENMASK(7, 0) #define ZMS_GET_VERSION(x) FIELD_GET(ZMS_VERSION_MASK, x) #define ZMS_DEFAULT_VERSION 1 -#define ZMS_MAGIC_NUMBER 0x42 /* murmur3a hash of "ZMS" (MSB) */ #define ZMS_MAGIC_NUMBER_MASK GENMASK(15, 8) #define ZMS_GET_MAGIC_NUMBER(x) FIELD_GET(ZMS_MAGIC_NUMBER_MASK, x) #define ZMS_MIN_ATE_NUM 5 #define ZMS_INVALID_SECTOR_NUM -1 -#define ZMS_DATA_IN_ATE_SIZE 8 /** * @ingroup zms_data_structures * ZMS Allocation Table Entry (ATE) structure + * + * @note This structure depends on @kconfig{CONFIG_ZMS_ID_64BIT}. */ struct zms_ate { /** crc8 check of the entry */ @@ -52,6 +51,8 @@ struct zms_ate { uint8_t cycle_cnt; /** data len within sector */ uint16_t len; + +#if !defined(CONFIG_ZMS_ID_64BIT) /** data id */ uint32_t id; union { @@ -75,6 +76,31 @@ struct zms_ate { }; }; }; +#else + /** data id */ + uint64_t id; + union { + /** data field used to store small sized data */ + uint8_t data[4]; + /** data offset within sector */ + uint32_t offset; + /** Used to store metadata information such as storage version. */ + uint32_t metadata; + }; +#endif /* CONFIG_ZMS_ID_64BIT */ + } __packed; +#define ZMS_DATA_IN_ATE_SIZE SIZEOF_FIELD(struct zms_ate, data) + +#if !defined(CONFIG_ZMS_ID_64BIT) +#define ZMS_HEAD_ID GENMASK(31, 0) +#define ZMS_MAGIC_NUMBER 0x42 /* murmur3a hash of "ZMS" (MSB) */ + +#else +#define ZMS_HEAD_ID GENMASK64(63, 0) +#define ZMS_MAGIC_NUMBER 0xb8 /* murmur3a hash of "ZMS64" (MSB) */ + +#endif /* CONFIG_ZMS_ID_64BIT */ + #endif /* __ZMS_PRIV_H_ */ From 664645d0256abc6f5ab40a7b617775ce83d7ccb4 Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Mon, 11 Aug 2025 12:08:09 +0200 Subject: [PATCH 0685/2141] [nrf fromlist] tests: zms: Minor improvements Upstream PR #: 94330 * Explicitly skip tests that depend on CONFIG_ZMS_LOOKUP_CACHE. * In `testcase.yaml`, use `extra_configs` instead of `extra_args` for setting Kconfigs. Signed-off-by: Grzegorz Swiderski (cherry picked from commit bde68d15bb6e017f75dcec2b99d9cac642361661) --- tests/subsys/fs/zms/src/main.c | 9 ++++++++- tests/subsys/fs/zms/testcase.yaml | 9 +++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/tests/subsys/fs/zms/src/main.c b/tests/subsys/fs/zms/src/main.c index 14d6291970ca..f307fe1b3a73 100644 --- a/tests/subsys/fs/zms/src/main.c +++ b/tests/subsys/fs/zms/src/main.c @@ -752,6 +752,8 @@ ZTEST_F(zms, test_zms_cache_init) num = num_matching_cache_entries(ate_addr, false, &fixture->fs); zassert_equal(num, 1, "invalid cache entry after restart"); +#else + ztest_test_skip(); #endif } @@ -780,6 +782,8 @@ ZTEST_F(zms, test_zms_cache_collission) zassert_equal(err, sizeof(data), "zms_read call failure: %d", err); zassert_equal(data, id, "incorrect data read"); } +#else + ztest_test_skip(); #endif } @@ -829,6 +833,8 @@ ZTEST_F(zms, test_zms_cache_gc) num = num_matching_cache_entries(2ULL << ADDR_SECT_SHIFT, true, &fixture->fs); zassert_equal(num, 2, "invalid cache content after gc"); +#else + ztest_test_skip(); #endif } @@ -886,6 +892,7 @@ ZTEST_F(zms, test_zms_cache_hash_quality) TC_PRINT("Cache occupancy: %u\n", (unsigned int)num); zassert_between_inclusive(num, MIN_CACHE_OCCUPANCY, CONFIG_ZMS_LOOKUP_CACHE_SIZE, "too low cache occupancy - poor hash quality"); - +#else + ztest_test_skip(); #endif } diff --git a/tests/subsys/fs/zms/testcase.yaml b/tests/subsys/fs/zms/testcase.yaml index bdee4529f2af..4949e1be0c6b 100644 --- a/tests/subsys/fs/zms/testcase.yaml +++ b/tests/subsys/fs/zms/testcase.yaml @@ -8,20 +8,21 @@ tests: extra_args: DTC_OVERLAY_FILE=boards/qemu_x86_ev_0x00.overlay platform_allow: qemu_x86 filesystem.zms.sim.no_erase: - extra_args: CONFIG_FLASH_SIMULATOR_EXPLICIT_ERASE=n + extra_configs: + - CONFIG_FLASH_SIMULATOR_EXPLICIT_ERASE=n platform_allow: qemu_x86 filesystem.zms.sim.corrupt_close: - extra_args: + extra_configs: - CONFIG_FLASH_SIMULATOR_EXPLICIT_ERASE=y - CONFIG_FLASH_SIMULATOR_DOUBLE_WRITES=y platform_allow: qemu_x86 filesystem.zms.cache: - extra_args: + extra_configs: - CONFIG_ZMS_LOOKUP_CACHE=y - CONFIG_ZMS_LOOKUP_CACHE_SIZE=64 platform_allow: native_sim filesystem.zms.data_crc: - extra_args: + extra_configs: - CONFIG_ZMS_DATA_CRC=y platform_allow: - native_sim From fb385d5cbbdb87a651797edb40f9cc420ee64b04 Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Mon, 11 Aug 2025 12:08:09 +0200 Subject: [PATCH 0686/2141] [nrf fromlist] tests: zms: Add test coverage for ZMS_ID_64BIT Upstream PR #: 94330 * Update the "corrupt ATE" tests to work with the new ATE format. * Add a basic test to verify support to 64 bit ZMS IDs. * Add a `testcase.yaml` entry to cover the above points and also run lookup cache tests to evaluate the 64 bit hash function. Signed-off-by: Grzegorz Swiderski (cherry picked from commit 6313c77daec51a20f7d4e0f4ad213f4bac54010d) --- tests/subsys/fs/zms/src/main.c | 55 +++++++++++++++++++++++++++---- tests/subsys/fs/zms/testcase.yaml | 7 ++++ 2 files changed, 56 insertions(+), 6 deletions(-) diff --git a/tests/subsys/fs/zms/src/main.c b/tests/subsys/fs/zms/src/main.c index f307fe1b3a73..8dc8cadba34c 100644 --- a/tests/subsys/fs/zms/src/main.c +++ b/tests/subsys/fs/zms/src/main.c @@ -578,17 +578,18 @@ ZTEST_F(zms, test_zms_gc_corrupt_close_ate) int err; Z_TEST_SKIP_IFNDEF(CONFIG_FLASH_SIMULATOR_DOUBLE_WRITES); - close_ate.id = 0xffffffff; + memset(&close_ate, 0xff, sizeof(struct zms_ate)); + close_ate.id = ZMS_HEAD_ID; close_ate.offset = fixture->fs.sector_size - sizeof(struct zms_ate) * 5; close_ate.len = 0; - close_ate.metadata = 0xffffffff; close_ate.cycle_cnt = 1; close_ate.crc8 = 0xff; /* Incorrect crc8 */ - empty_ate.id = 0xffffffff; - empty_ate.offset = 0; + memset(&empty_ate, 0, sizeof(struct zms_ate)); + empty_ate.id = ZMS_HEAD_ID; empty_ate.len = 0xffff; - empty_ate.metadata = 0x4201; + empty_ate.metadata = + FIELD_PREP(ZMS_MAGIC_NUMBER_MASK, ZMS_MAGIC_NUMBER) | ZMS_DEFAULT_VERSION; empty_ate.cycle_cnt = 1; empty_ate.crc8 = crc8_ccitt(0xff, (uint8_t *)&empty_ate + SIZEOF_FIELD(struct zms_ate, crc8), @@ -649,7 +650,7 @@ ZTEST_F(zms, test_zms_gc_corrupt_ate) struct zms_ate close_ate; int err; - close_ate.id = 0xffffffff; + close_ate.id = ZMS_HEAD_ID; close_ate.offset = fixture->fs.sector_size / 2; close_ate.len = 0; close_ate.crc8 = @@ -896,3 +897,45 @@ ZTEST_F(zms, test_zms_cache_hash_quality) ztest_test_skip(); #endif } + +/* + * Test 64 bit ZMS ID support. + */ +ZTEST_F(zms, test_zms_id_64bit) +{ + int err; + ssize_t len; + uint64_t data; + uint64_t filling_id = 0xdeadbeefULL; + + Z_TEST_SKIP_IFNDEF(CONFIG_ZMS_ID_64BIT); + + err = zms_mount(&fixture->fs); + zassert_true(err == 0, "zms_mount call failure: %d", err); + + /* Fill the first sector with writes of different IDs */ + + while (fixture->fs.data_wra + sizeof(data) + sizeof(struct zms_ate) <= + fixture->fs.ate_wra) { + data = filling_id; + len = zms_write(&fixture->fs, (zms_id_t)filling_id, &data, sizeof(data)); + zassert_true(len == sizeof(data), "zms_write failed: %d", len); + + /* Choose the next ID so that its lower 32 bits stay invariant. + * The purpose is to test that ZMS doesn't mistakenly cast the + * 64 bit ID to a 32 bit one somewhere. + */ + filling_id += BIT64(32); + } + + /* Read back the written entries and check that they're all unique */ + + for (uint64_t id = 0xdeadbeefULL; id < filling_id; id += BIT64(32)) { + len = zms_read_hist(&fixture->fs, (zms_id_t)id, &data, sizeof(data), 0); + zassert_true(len == sizeof(data), "zms_read_hist unexpected failure: %d", len); + zassert_equal(data, id, "read unexpected data: %llx instead of %llx", data, id); + + len = zms_read_hist(&fixture->fs, (zms_id_t)id, &data, sizeof(data), 1); + zassert_true(len == -ENOENT, "zms_read_hist unexpected failure: %d", len); + } +} diff --git a/tests/subsys/fs/zms/testcase.yaml b/tests/subsys/fs/zms/testcase.yaml index 4949e1be0c6b..18886b0e23dc 100644 --- a/tests/subsys/fs/zms/testcase.yaml +++ b/tests/subsys/fs/zms/testcase.yaml @@ -27,3 +27,10 @@ tests: platform_allow: - native_sim - qemu_x86 + filesystem.zms.id_64bit: + extra_configs: + - CONFIG_ZMS_ID_64BIT=y + - CONFIG_ZMS_LOOKUP_CACHE=y + - CONFIG_ZMS_LOOKUP_CACHE_SIZE=64 + - CONFIG_FLASH_SIMULATOR_DOUBLE_WRITES=y + platform_allow: qemu_x86 From 8ccb9862ea82f28f5b92c33ea5d382b2da9ce203 Mon Sep 17 00:00:00 2001 From: Riadh Ghaddab Date: Tue, 3 Jun 2025 16:07:48 +0200 Subject: [PATCH 0687/2141] [nrf noup] zms: add lookup cache hash function for legacy ZMS ZMS legacy enabled by CONFIG_SETTINGS_ZMS_LEGACY uses a different lookup cache function that is optimized for Settings subsystem. Signed-off-by: Riadh Ghaddab (cherry picked from commit 491354b7e5fd6255de4b119e9256012aefaf19f6) (cherry picked from commit 15cd2f6e5d5b9e6580365cae8d882e1e8845f188) --- subsys/fs/zms/zms.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/subsys/fs/zms/zms.c b/subsys/fs/zms/zms.c index 250c9c47dadb..86a4d469f908 100644 --- a/subsys/fs/zms/zms.c +++ b/subsys/fs/zms/zms.c @@ -13,8 +13,12 @@ #include #include "zms_priv.h" #ifdef CONFIG_ZMS_LOOKUP_CACHE_FOR_SETTINGS +#ifdef CONFIG_SETTINGS_ZMS_LEGACY +#include +#else #include #endif +#endif #include LOG_MODULE_REGISTER(fs_zms, CONFIG_ZMS_LOG_LEVEL); @@ -32,6 +36,39 @@ static int zms_ate_valid_different_sector(struct zms_fs *fs, const struct zms_at static inline size_t zms_lookup_cache_pos(zms_id_t id) { #ifdef CONFIG_ZMS_LOOKUP_CACHE_FOR_SETTINGS +#ifdef CONFIG_SETTINGS_ZMS_LEGACY + /* + * 1. The ZMS settings backend uses up to (ZMS_NAME_ID_OFFSET - 1) ZMS IDs to + store keys and equal number of ZMS IDs to store values. + * 2. For each key-value pair, the value is stored at ZMS ID greater by exactly + * ZMS_NAME_ID_OFFSET than ZMS ID that holds the key. + * 3. The backend tries to minimize the range of ZMS IDs used to store keys. + * That is, ZMS IDs are allocated sequentially, and freed ZMS IDs are reused + * before allocating new ones. + * + * Therefore, to assure the least number of collisions in the lookup cache, + * the least significant bit of the hash indicates whether the given ZMS ID + * represents a key or a value, and remaining bits of the hash are set to + * the ordinal number of the key-value pair. Consequently, the hash function + * provides the following mapping: + * + * 1st settings key => hash 0 + * 1st settings value => hash 1 + * 2nd settings key => hash 2 + * 2nd settings value => hash 3 + * ... + */ + BUILD_ASSERT(IS_POWER_OF_TWO(ZMS_NAMECNT_ID), "ZMS_NAMECNT_ID is not power of 2"); + BUILD_ASSERT(IS_POWER_OF_TWO(ZMS_NAME_ID_OFFSET), "ZMS_NAME_ID_OFFSET is not power of 2"); + + uint32_t key_value_bit; + uint32_t key_value_ord; + + key_value_bit = (id >> LOG2(ZMS_NAME_ID_OFFSET)) & 1; + key_value_ord = id & (ZMS_NAME_ID_OFFSET - 1); + + hash = ((key_value_ord << 1) | key_value_bit); +#else /* * 1. Settings subsystem is storing the name ID and the linked list node ID * with only one bit difference at BIT(0). @@ -57,6 +94,7 @@ static inline size_t zms_lookup_cache_pos(zms_id_t id) key_value_ll = id & BIT(0); hash = (key_value_hash << 2) | (key_value_bit << 1) | key_value_ll; +#endif /* CONFIG_SETTINGS_ZMS_LEGACY */ #elif defined(CONFIG_ZMS_ID_64BIT) /* 64-bit integer hash function found by https://github.com/skeeto/hash-prospector. */ uint64_t hash = id; From 58e6d5e8c487ce076048e0b54ed6776411b3999e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Thu, 21 Aug 2025 08:32:08 +0200 Subject: [PATCH 0688/2141] [nrf fromtree] boards: nordic: nrf54lm20dk: Extend ext memory node with reset GPIO MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Extend external memory node with 'reset-gpios' property. Signed-off-by: Sebastian Głąb (cherry picked from commit 4330c06a20a15a4ae76e8c2b36e75a4465226f2a) --- boards/nordic/nrf54lm20dk/nrf54lm20a_cpuapp_common.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/boards/nordic/nrf54lm20dk/nrf54lm20a_cpuapp_common.dtsi b/boards/nordic/nrf54lm20dk/nrf54lm20a_cpuapp_common.dtsi index 3591a8009486..1d916f8189e4 100644 --- a/boards/nordic/nrf54lm20dk/nrf54lm20a_cpuapp_common.dtsi +++ b/boards/nordic/nrf54lm20dk/nrf54lm20a_cpuapp_common.dtsi @@ -166,5 +166,6 @@ zephyr_udc0: &usbhs { has-dpd; t-enter-dpd = <10000>; t-exit-dpd = <35000>; + reset-gpios = <&gpio2 0 GPIO_ACTIVE_LOW>; }; }; From 4e2451d0397c2b95f5d393f72afd4bd6b58ee81e Mon Sep 17 00:00:00 2001 From: Robert Robinson Date: Mon, 28 Jul 2025 09:09:18 +0100 Subject: [PATCH 0689/2141] [nrf fromtree] scripts: twister: handlers: Append dev-id for runner nrfutil_next appends the --dev-id argument when using nrfutil_next runner. Signed-off-by: Robert Robinson (cherry picked from commit 8e69b522057ee0766d6b2aafe1140cc972dc6ca9) --- .../src/twister_harness/device/hardware_adapter.py | 2 +- scripts/pylib/twister/twisterlib/handlers.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/pylib/pytest-twister-harness/src/twister_harness/device/hardware_adapter.py b/scripts/pylib/pytest-twister-harness/src/twister_harness/device/hardware_adapter.py index 79a3a9356448..37751f69d86d 100644 --- a/scripts/pylib/pytest-twister-harness/src/twister_harness/device/hardware_adapter.py +++ b/scripts/pylib/pytest-twister-harness/src/twister_harness/device/hardware_adapter.py @@ -76,7 +76,7 @@ def _prepare_runner_args(self) -> tuple[list[str], list[str]]: elif runner == "esp32": extra_args.append("--esp-device") extra_args.append(board_id) - elif runner in ('nrfjprog', 'nrfutil'): + elif runner in ('nrfjprog', 'nrfutil', 'nrfutil_next'): extra_args.append('--dev-id') extra_args.append(board_id) elif runner == 'openocd' and self.device_config.product in ['STM32 STLink', 'STLINK-V3']: diff --git a/scripts/pylib/twister/twisterlib/handlers.py b/scripts/pylib/twister/twisterlib/handlers.py index dc1ff2589356..30c40e01c8e9 100755 --- a/scripts/pylib/twister/twisterlib/handlers.py +++ b/scripts/pylib/twister/twisterlib/handlers.py @@ -566,7 +566,7 @@ def _create_command(self, runner, hardware): board_id = hardware.probe_id or hardware.id product = hardware.product if board_id is not None: - if runner in ("pyocd", "nrfjprog", "nrfutil"): + if runner in ("pyocd", "nrfjprog", "nrfutil", "nrfutil_next"): command_extra_args.append("--dev-id") command_extra_args.append(board_id) elif runner == "esp32": From f940b644def12ee10ae0285ea067236e7c375750 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Fri, 22 Aug 2025 09:33:28 +0200 Subject: [PATCH 0690/2141] [nrf fromlist] boards: nordic: nrf54l15dk: Extend ext memory node with reset GPIO MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Extend external memory node with 'reset-gpios' property. When this property is defined, driver will reset the memory at startup. Upstream PR #: 94843 Signed-off-by: Sebastian Głąb --- boards/nordic/nrf54l15dk/nrf54l_05_10_15_cpuapp_common.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/boards/nordic/nrf54l15dk/nrf54l_05_10_15_cpuapp_common.dtsi b/boards/nordic/nrf54l15dk/nrf54l_05_10_15_cpuapp_common.dtsi index 46f9d797b61a..f3c1d924d27c 100644 --- a/boards/nordic/nrf54l15dk/nrf54l_05_10_15_cpuapp_common.dtsi +++ b/boards/nordic/nrf54l15dk/nrf54l_05_10_15_cpuapp_common.dtsi @@ -134,6 +134,7 @@ has-dpd; t-enter-dpd = <10000>; t-exit-dpd = <35000>; + reset-gpios = <&gpio2 0 GPIO_ACTIVE_LOW>; }; }; From 6b0cb071611744ed47c8ddd810443e23f954483b Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Tue, 19 Aug 2025 15:00:02 +0200 Subject: [PATCH 0691/2141] [nrf fromtree] bluetooth: host: gatt: destroy key after hash calc completes To generate the GATT Database Hash characteristic, the function `db_hash_setup` is called. It allocates an entry for the AES key that will be used in the CMAC calculation. Next, `db_hash_update` is called to feed all GATT database entries into the hash. Finally, `db_hash_finish` produces the resulting hash. However, the AES key entry allocated in `db_hash_setup` was not being destroyed after the hash generation completed. This caused a memory leak, eventually leading to the error `PSA_ERROR_INSUFFICIENT_MEMORY` (`-134`). This commit fixes the issue by destroying the allocated AES key after the GATT Database Hash calculation is complete, by calling `psa_destroy_key` in `db_hash_finish`. Signed-off-by: Pavel Vasilyev (cherry picked from commit bcdd74d815c4e1c8a3b40d05f071d552790e435f) --- subsys/bluetooth/host/gatt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/subsys/bluetooth/host/gatt.c b/subsys/bluetooth/host/gatt.c index 12ec91c78e44..a99a497749f7 100644 --- a/subsys/bluetooth/host/gatt.c +++ b/subsys/bluetooth/host/gatt.c @@ -755,6 +755,8 @@ static int db_hash_finish(struct gen_hash_state *state) size_t mac_length; psa_status_t ret = psa_mac_sign_finish(&(state->operation), db_hash.hash, 16, &mac_length); + psa_destroy_key(state->key); + if (ret != PSA_SUCCESS) { LOG_ERR("CMAC finish failed %d", ret); return -EIO; From 28bdaa3f38fbd01abb4d894fd1f2272306694a7a Mon Sep 17 00:00:00 2001 From: Rafal Dyla Date: Wed, 4 Jun 2025 08:52:20 +0200 Subject: [PATCH 0692/2141] [nrf fromtree] modules: hal_nordic: nrfs: Disabling subscription - Code optimization for platforms which don't use subscription feature in the temperature service. - Test adaptation to code changes Signed-off-by: Rafal Dyla (cherry picked from commit 8876a3bbd26f5e06250540cbcea810f95aa8fe77) --- drivers/sensor/nordic/temp/Kconfig | 4 ++-- modules/hal_nordic/nrfs/Kconfig | 8 ++++++++ modules/hal_nordic/nrfs/nrfs_config.h | 4 ++++ soc/nordic/nrf92/Kconfig | 2 ++ .../temp_sensor/boards/nrf54h20dk_nrf54h20_cpuapp.conf | 1 - west.yml | 2 +- 6 files changed, 17 insertions(+), 4 deletions(-) diff --git a/drivers/sensor/nordic/temp/Kconfig b/drivers/sensor/nordic/temp/Kconfig index e32fb1b8fdd6..6641fcf5cb29 100644 --- a/drivers/sensor/nordic/temp/Kconfig +++ b/drivers/sensor/nordic/temp/Kconfig @@ -28,11 +28,11 @@ config TEMP_NRFS Enable driver for nRF temperature sensor accessed through the nRF Services (nrfs) layer. -if TEMP_NRFS +if TEMP_NRFS && NRFS_TEMP_SERVICE_SUBSCRIPTION_ENABLED module = TEMP_NRFS thread_priority = 10 thread_stack_size = 1024 source "drivers/sensor/Kconfig.trigger_template" -endif # TEMP_NRFS +endif diff --git a/modules/hal_nordic/nrfs/Kconfig b/modules/hal_nordic/nrfs/Kconfig index f5d4e92f94de..166520d9d017 100644 --- a/modules/hal_nordic/nrfs/Kconfig +++ b/modules/hal_nordic/nrfs/Kconfig @@ -46,6 +46,9 @@ config NRFS_HAS_TEMP_SERVICE config NRFS_HAS_VBUS_DETECTOR_SERVICE bool +config NRFS_TEMP_SERVICE_HAS_SUBSCRIPTION_SERVICE + bool + config NRFS bool "nRF Services Support" select NRFS_LOCAL_DOMAIN if SOC_NRF54H20_CPUAPP || \ @@ -93,6 +96,11 @@ config NRFS_TEMP_SERVICE_ENABLED depends on NRFS_HAS_TEMP_SERVICE default y +config NRFS_TEMP_SERVICE_SUBSCRIPTION_ENABLED + bool "Subscription feature for the temperature service" + depends on NRFS_TEMP_SERVICE_HAS_SUBSCRIPTION_SERVICE + default y + config NRFS_VBUS_DETECTOR_SERVICE_ENABLED bool "VBUS detector for the USB peripheral" depends on NRFS_HAS_VBUS_DETECTOR_SERVICE diff --git a/modules/hal_nordic/nrfs/nrfs_config.h b/modules/hal_nordic/nrfs/nrfs_config.h index 9d1a9b7b6b35..3ef87a8af393 100644 --- a/modules/hal_nordic/nrfs/nrfs_config.h +++ b/modules/hal_nordic/nrfs/nrfs_config.h @@ -12,6 +12,10 @@ #define NRFS_TEMP_SERVICE_ENABLED #endif +#ifdef CONFIG_NRFS_TEMP_SERVICE_SUBSCRIPTION_ENABLED +#define NRFS_TEMP_SERVICE_SUBSCRIPTION_ENABLED +#endif + #ifdef CONFIG_NRFS_MRAM_SERVICE_ENABLED #define NRFS_MRAM_SERVICE_ENABLED #endif diff --git a/soc/nordic/nrf92/Kconfig b/soc/nordic/nrf92/Kconfig index a7769c00b6f2..eea33654f57d 100644 --- a/soc/nordic/nrf92/Kconfig +++ b/soc/nordic/nrf92/Kconfig @@ -28,6 +28,7 @@ config SOC_NRF9230_ENGB_CPUAPP select NRFS_HAS_PMIC_SERVICE select NRFS_HAS_TEMP_SERVICE select NRFS_HAS_VBUS_DETECTOR_SERVICE + select NRFS_TEMP_SERVICE_HAS_SUBSCRIPTION_SERVICE config SOC_NRF9230_ENGB_CPURAD select ARM @@ -46,6 +47,7 @@ config SOC_NRF9230_ENGB_CPURAD select NRFS_HAS_MRAM_SERVICE select NRFS_HAS_PMIC_SERVICE select NRFS_HAS_TEMP_SERVICE + select NRFS_TEMP_SERVICE_HAS_SUBSCRIPTION_SERVICE config SOC_NRF9230_ENGB_CPUPPR select RISCV_CORE_NORDIC_VPR diff --git a/tests/drivers/sensor/temp_sensor/boards/nrf54h20dk_nrf54h20_cpuapp.conf b/tests/drivers/sensor/temp_sensor/boards/nrf54h20dk_nrf54h20_cpuapp.conf index 371797173d97..219e5ebb46ed 100644 --- a/tests/drivers/sensor/temp_sensor/boards/nrf54h20dk_nrf54h20_cpuapp.conf +++ b/tests/drivers/sensor/temp_sensor/boards/nrf54h20dk_nrf54h20_cpuapp.conf @@ -1,2 +1 @@ CONFIG_NRFS=y -CONFIG_TEMP_NRFS_TRIGGER_OWN_THREAD=y diff --git a/west.yml b/west.yml index b5ace932db27..4d20267c8b48 100644 --- a/west.yml +++ b/west.yml @@ -200,7 +200,7 @@ manifest: groups: - hal - name: hal_nordic - revision: 2f5d4e5868ab573eac932fa4bc142565073c3c04 + revision: a6579483deb33112cc763d05a4a3f8085883c1ac path: modules/hal/nordic groups: - hal From e88ccb07817f82a9e7958b741773f885f44d0628 Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Mon, 25 Aug 2025 07:40:39 +0200 Subject: [PATCH 0693/2141] Revert "[nrf noup] zms: add lookup cache hash function for legacy ZMS" This reverts commit 8ccb9862ea82f28f5b92c33ea5d382b2da9ce203. To be re-applied after cherry-picks with a fix for a recent mistake. Signed-off-by: Grzegorz Swiderski --- subsys/fs/zms/zms.c | 38 -------------------------------------- 1 file changed, 38 deletions(-) diff --git a/subsys/fs/zms/zms.c b/subsys/fs/zms/zms.c index 86a4d469f908..250c9c47dadb 100644 --- a/subsys/fs/zms/zms.c +++ b/subsys/fs/zms/zms.c @@ -13,12 +13,8 @@ #include #include "zms_priv.h" #ifdef CONFIG_ZMS_LOOKUP_CACHE_FOR_SETTINGS -#ifdef CONFIG_SETTINGS_ZMS_LEGACY -#include -#else #include #endif -#endif #include LOG_MODULE_REGISTER(fs_zms, CONFIG_ZMS_LOG_LEVEL); @@ -36,39 +32,6 @@ static int zms_ate_valid_different_sector(struct zms_fs *fs, const struct zms_at static inline size_t zms_lookup_cache_pos(zms_id_t id) { #ifdef CONFIG_ZMS_LOOKUP_CACHE_FOR_SETTINGS -#ifdef CONFIG_SETTINGS_ZMS_LEGACY - /* - * 1. The ZMS settings backend uses up to (ZMS_NAME_ID_OFFSET - 1) ZMS IDs to - store keys and equal number of ZMS IDs to store values. - * 2. For each key-value pair, the value is stored at ZMS ID greater by exactly - * ZMS_NAME_ID_OFFSET than ZMS ID that holds the key. - * 3. The backend tries to minimize the range of ZMS IDs used to store keys. - * That is, ZMS IDs are allocated sequentially, and freed ZMS IDs are reused - * before allocating new ones. - * - * Therefore, to assure the least number of collisions in the lookup cache, - * the least significant bit of the hash indicates whether the given ZMS ID - * represents a key or a value, and remaining bits of the hash are set to - * the ordinal number of the key-value pair. Consequently, the hash function - * provides the following mapping: - * - * 1st settings key => hash 0 - * 1st settings value => hash 1 - * 2nd settings key => hash 2 - * 2nd settings value => hash 3 - * ... - */ - BUILD_ASSERT(IS_POWER_OF_TWO(ZMS_NAMECNT_ID), "ZMS_NAMECNT_ID is not power of 2"); - BUILD_ASSERT(IS_POWER_OF_TWO(ZMS_NAME_ID_OFFSET), "ZMS_NAME_ID_OFFSET is not power of 2"); - - uint32_t key_value_bit; - uint32_t key_value_ord; - - key_value_bit = (id >> LOG2(ZMS_NAME_ID_OFFSET)) & 1; - key_value_ord = id & (ZMS_NAME_ID_OFFSET - 1); - - hash = ((key_value_ord << 1) | key_value_bit); -#else /* * 1. Settings subsystem is storing the name ID and the linked list node ID * with only one bit difference at BIT(0). @@ -94,7 +57,6 @@ static inline size_t zms_lookup_cache_pos(zms_id_t id) key_value_ll = id & BIT(0); hash = (key_value_hash << 2) | (key_value_bit << 1) | key_value_ll; -#endif /* CONFIG_SETTINGS_ZMS_LEGACY */ #elif defined(CONFIG_ZMS_ID_64BIT) /* 64-bit integer hash function found by https://github.com/skeeto/hash-prospector. */ uint64_t hash = id; From 1d4a2e800a6d46e6bb219f61258d817f43737f44 Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Mon, 25 Aug 2025 07:40:40 +0200 Subject: [PATCH 0694/2141] Revert "[nrf fromlist] tests: zms: Add test coverage for ZMS_ID_64BIT" This reverts commit fb385d5cbbdb87a651797edb40f9cc420ee64b04. Signed-off-by: Grzegorz Swiderski --- tests/subsys/fs/zms/src/main.c | 55 ++++--------------------------- tests/subsys/fs/zms/testcase.yaml | 7 ---- 2 files changed, 6 insertions(+), 56 deletions(-) diff --git a/tests/subsys/fs/zms/src/main.c b/tests/subsys/fs/zms/src/main.c index 8dc8cadba34c..f307fe1b3a73 100644 --- a/tests/subsys/fs/zms/src/main.c +++ b/tests/subsys/fs/zms/src/main.c @@ -578,18 +578,17 @@ ZTEST_F(zms, test_zms_gc_corrupt_close_ate) int err; Z_TEST_SKIP_IFNDEF(CONFIG_FLASH_SIMULATOR_DOUBLE_WRITES); - memset(&close_ate, 0xff, sizeof(struct zms_ate)); - close_ate.id = ZMS_HEAD_ID; + close_ate.id = 0xffffffff; close_ate.offset = fixture->fs.sector_size - sizeof(struct zms_ate) * 5; close_ate.len = 0; + close_ate.metadata = 0xffffffff; close_ate.cycle_cnt = 1; close_ate.crc8 = 0xff; /* Incorrect crc8 */ - memset(&empty_ate, 0, sizeof(struct zms_ate)); - empty_ate.id = ZMS_HEAD_ID; + empty_ate.id = 0xffffffff; + empty_ate.offset = 0; empty_ate.len = 0xffff; - empty_ate.metadata = - FIELD_PREP(ZMS_MAGIC_NUMBER_MASK, ZMS_MAGIC_NUMBER) | ZMS_DEFAULT_VERSION; + empty_ate.metadata = 0x4201; empty_ate.cycle_cnt = 1; empty_ate.crc8 = crc8_ccitt(0xff, (uint8_t *)&empty_ate + SIZEOF_FIELD(struct zms_ate, crc8), @@ -650,7 +649,7 @@ ZTEST_F(zms, test_zms_gc_corrupt_ate) struct zms_ate close_ate; int err; - close_ate.id = ZMS_HEAD_ID; + close_ate.id = 0xffffffff; close_ate.offset = fixture->fs.sector_size / 2; close_ate.len = 0; close_ate.crc8 = @@ -897,45 +896,3 @@ ZTEST_F(zms, test_zms_cache_hash_quality) ztest_test_skip(); #endif } - -/* - * Test 64 bit ZMS ID support. - */ -ZTEST_F(zms, test_zms_id_64bit) -{ - int err; - ssize_t len; - uint64_t data; - uint64_t filling_id = 0xdeadbeefULL; - - Z_TEST_SKIP_IFNDEF(CONFIG_ZMS_ID_64BIT); - - err = zms_mount(&fixture->fs); - zassert_true(err == 0, "zms_mount call failure: %d", err); - - /* Fill the first sector with writes of different IDs */ - - while (fixture->fs.data_wra + sizeof(data) + sizeof(struct zms_ate) <= - fixture->fs.ate_wra) { - data = filling_id; - len = zms_write(&fixture->fs, (zms_id_t)filling_id, &data, sizeof(data)); - zassert_true(len == sizeof(data), "zms_write failed: %d", len); - - /* Choose the next ID so that its lower 32 bits stay invariant. - * The purpose is to test that ZMS doesn't mistakenly cast the - * 64 bit ID to a 32 bit one somewhere. - */ - filling_id += BIT64(32); - } - - /* Read back the written entries and check that they're all unique */ - - for (uint64_t id = 0xdeadbeefULL; id < filling_id; id += BIT64(32)) { - len = zms_read_hist(&fixture->fs, (zms_id_t)id, &data, sizeof(data), 0); - zassert_true(len == sizeof(data), "zms_read_hist unexpected failure: %d", len); - zassert_equal(data, id, "read unexpected data: %llx instead of %llx", data, id); - - len = zms_read_hist(&fixture->fs, (zms_id_t)id, &data, sizeof(data), 1); - zassert_true(len == -ENOENT, "zms_read_hist unexpected failure: %d", len); - } -} diff --git a/tests/subsys/fs/zms/testcase.yaml b/tests/subsys/fs/zms/testcase.yaml index 18886b0e23dc..4949e1be0c6b 100644 --- a/tests/subsys/fs/zms/testcase.yaml +++ b/tests/subsys/fs/zms/testcase.yaml @@ -27,10 +27,3 @@ tests: platform_allow: - native_sim - qemu_x86 - filesystem.zms.id_64bit: - extra_configs: - - CONFIG_ZMS_ID_64BIT=y - - CONFIG_ZMS_LOOKUP_CACHE=y - - CONFIG_ZMS_LOOKUP_CACHE_SIZE=64 - - CONFIG_FLASH_SIMULATOR_DOUBLE_WRITES=y - platform_allow: qemu_x86 From 5d39c92cb610e70b1528aac6c65e8daa58123f6d Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Mon, 25 Aug 2025 07:40:40 +0200 Subject: [PATCH 0695/2141] Revert "[nrf fromlist] zms: Initial support for 64 bit IDs" This reverts commit 73fe1eee7fd419790c21444135638ac0c6b58181. Signed-off-by: Grzegorz Swiderski --- include/zephyr/fs/zms.h | 21 ++++---------- subsys/fs/zms/Kconfig | 10 ------- subsys/fs/zms/zms.c | 62 +++++++++++++++------------------------- subsys/fs/zms/zms_priv.h | 32 ++------------------- 4 files changed, 31 insertions(+), 94 deletions(-) diff --git a/include/zephyr/fs/zms.h b/include/zephyr/fs/zms.h index 436f448f6b48..8b776b426f9c 100644 --- a/include/zephyr/fs/zms.h +++ b/include/zephyr/fs/zms.h @@ -77,17 +77,6 @@ struct zms_fs { * @{ */ -/** - * @brief ID type used in the ZMS API. - * - * @note The width of this type depends on @kconfig{CONFIG_ZMS_ID_64BIT}. - */ -#if CONFIG_ZMS_ID_64BIT -typedef uint64_t zms_id_t; -#else -typedef uint32_t zms_id_t; -#endif - /** * @brief Mount a ZMS file system onto the device specified in `fs`. * @@ -138,7 +127,7 @@ int zms_clear(struct zms_fs *fs); * @retval -EINVAL if `len` is invalid. * @retval -ENOSPC if no space is left on the device. */ -ssize_t zms_write(struct zms_fs *fs, zms_id_t id, const void *data, size_t len); +ssize_t zms_write(struct zms_fs *fs, uint32_t id, const void *data, size_t len); /** * @brief Delete an entry from the file system @@ -151,7 +140,7 @@ ssize_t zms_write(struct zms_fs *fs, zms_id_t id, const void *data, size_t len); * @retval -ENXIO if there is a device error. * @retval -EIO if there is a memory read/write error. */ -int zms_delete(struct zms_fs *fs, zms_id_t id); +int zms_delete(struct zms_fs *fs, uint32_t id); /** * @brief Read an entry from the file system. @@ -169,7 +158,7 @@ int zms_delete(struct zms_fs *fs, zms_id_t id); * @retval -EIO if there is a memory read/write error. * @retval -ENOENT if there is no entry with the given `id`. */ -ssize_t zms_read(struct zms_fs *fs, zms_id_t id, void *data, size_t len); +ssize_t zms_read(struct zms_fs *fs, uint32_t id, void *data, size_t len); /** * @brief Read a history entry from the file system. @@ -189,7 +178,7 @@ ssize_t zms_read(struct zms_fs *fs, zms_id_t id, void *data, size_t len); * @retval -EIO if there is a memory read/write error. * @retval -ENOENT if there is no entry with the given `id` and history counter. */ -ssize_t zms_read_hist(struct zms_fs *fs, zms_id_t id, void *data, size_t len, uint32_t cnt); +ssize_t zms_read_hist(struct zms_fs *fs, uint32_t id, void *data, size_t len, uint32_t cnt); /** * @brief Gets the length of the data that is stored in an entry with a given `id` @@ -204,7 +193,7 @@ ssize_t zms_read_hist(struct zms_fs *fs, zms_id_t id, void *data, size_t len, ui * @retval -EIO if there is a memory read/write error. * @retval -ENOENT if there is no entry with the given id and history counter. */ -ssize_t zms_get_data_length(struct zms_fs *fs, zms_id_t id); +ssize_t zms_get_data_length(struct zms_fs *fs, uint32_t id); /** * @brief Calculate the available free space in the file system. diff --git a/subsys/fs/zms/Kconfig b/subsys/fs/zms/Kconfig index ad424608e0ef..f371d75647f1 100644 --- a/subsys/fs/zms/Kconfig +++ b/subsys/fs/zms/Kconfig @@ -15,15 +15,6 @@ config ZMS if ZMS -config ZMS_ID_64BIT - bool "64 bit ZMS IDs" - help - When this option is true, the `zms_id_t` values passed to ZMS APIs will be 64 bit, - as opposed to the default 32 bit. - This option will also change the format of allocation table entries (ATEs) in memory - to accommodate larger IDs. Currently, this will make ZMS unable to mount an existing - file system if it has been initialized with a different ATE format. - config ZMS_LOOKUP_CACHE bool "ZMS lookup cache" help @@ -42,7 +33,6 @@ config ZMS_LOOKUP_CACHE_SIZE config ZMS_DATA_CRC bool "ZMS data CRC" - depends on !ZMS_ID_64BIT config ZMS_CUSTOMIZE_BLOCK_SIZE bool "Customize the size of the buffer used internally for reads and writes" diff --git a/subsys/fs/zms/zms.c b/subsys/fs/zms/zms.c index 250c9c47dadb..80b86a41cdcb 100644 --- a/subsys/fs/zms/zms.c +++ b/subsys/fs/zms/zms.c @@ -29,8 +29,10 @@ static int zms_ate_valid_different_sector(struct zms_fs *fs, const struct zms_at #ifdef CONFIG_ZMS_LOOKUP_CACHE -static inline size_t zms_lookup_cache_pos(zms_id_t id) +static inline size_t zms_lookup_cache_pos(uint32_t id) { + uint32_t hash = id; + #ifdef CONFIG_ZMS_LOOKUP_CACHE_FOR_SETTINGS /* * 1. Settings subsystem is storing the name ID and the linked list node ID @@ -50,26 +52,14 @@ static inline size_t zms_lookup_cache_pos(zms_id_t id) uint32_t key_value_bit; uint32_t key_value_hash; uint32_t key_value_ll; - uint32_t hash; key_value_bit = (id >> LOG2(ZMS_DATA_ID_OFFSET)) & 1; key_value_hash = (id & ZMS_HASH_MASK) >> (CONFIG_SETTINGS_ZMS_MAX_COLLISIONS_BITS + 1); key_value_ll = id & BIT(0); hash = (key_value_hash << 2) | (key_value_bit << 1) | key_value_ll; -#elif defined(CONFIG_ZMS_ID_64BIT) - /* 64-bit integer hash function found by https://github.com/skeeto/hash-prospector. */ - uint64_t hash = id; - - hash ^= hash >> 32; - hash *= 0x42ab4abe4c475039ULL; - hash ^= hash >> 31; - hash *= 0xfa90c4424c537791ULL; - hash ^= hash >> 32; #else /* 32-bit integer hash function found by https://github.com/skeeto/hash-prospector. */ - uint32_t hash = id; - hash ^= hash >> 16; hash *= 0x7feb352dU; hash ^= hash >> 15; @@ -249,7 +239,7 @@ static int zms_flash_ate_wrt(struct zms_fs *fs, const struct zms_ate *entry) goto end; } #ifdef CONFIG_ZMS_LOOKUP_CACHE - /* ZMS_HEAD_ID is a special-purpose identifier. Exclude it from the cache */ + /* 0xFFFFFFFF is a special-purpose identifier. Exclude it from the cache */ if (entry->id != ZMS_HEAD_ID) { fs->lookup_cache[zms_lookup_cache_pos(entry->id)] = fs->ate_wra; } @@ -497,7 +487,7 @@ static bool zms_close_ate_valid(struct zms_fs *fs, const struct zms_ate *entry) /* zms_empty_ate_valid validates an sector empty ate. * A valid sector empty ate should be: * - a valid ate - * - with len = 0xffff and id = ZMS_HEAD_ID + * - with len = 0xffff and id = 0xffffffff * return true if valid, false otherwise */ static bool zms_empty_ate_valid(struct zms_fs *fs, const struct zms_ate *entry) @@ -510,7 +500,7 @@ static bool zms_empty_ate_valid(struct zms_fs *fs, const struct zms_ate *entry) * Valid gc_done_ate: * - valid ate * - len = 0 - * - id = ZMS_HEAD_ID + * - id = 0xffffffff * return true if valid, false otherwise */ static bool zms_gc_done_ate_valid(struct zms_fs *fs, const struct zms_ate *entry) @@ -546,7 +536,7 @@ static int zms_validate_closed_sector(struct zms_fs *fs, uint64_t addr, struct z } /* store an entry in flash */ -static int zms_flash_write_entry(struct zms_fs *fs, zms_id_t id, const void *data, size_t len) +static int zms_flash_write_entry(struct zms_fs *fs, uint32_t id, const void *data, size_t len) { int rc; struct zms_ate entry; @@ -559,13 +549,13 @@ static int zms_flash_write_entry(struct zms_fs *fs, zms_id_t id, const void *dat entry.cycle_cnt = fs->sector_cycle; if (len > ZMS_DATA_IN_ATE_SIZE) { -#ifdef CONFIG_ZMS_DATA_CRC - /* only compute CRC if data is to be stored outside of entry */ - entry.data_crc = crc32_ieee(data, len); -#endif + /* only compute CRC if len is greater than 8 bytes */ + if (IS_ENABLED(CONFIG_ZMS_DATA_CRC)) { + entry.data_crc = crc32_ieee(data, len); + } entry.offset = (uint32_t)SECTOR_OFFSET(fs->data_wra); } else if ((len > 0) && (len <= ZMS_DATA_IN_ATE_SIZE)) { - /* Copy data into entry if data is sufficiently small */ + /* Copy data into entry for small data ( < 8B) */ memcpy(&entry.data, data, len); } @@ -698,12 +688,10 @@ static int zms_sector_close(struct zms_fs *fs) struct zms_ate close_ate; struct zms_ate garbage_ate; - /* Initialize all members to 0xff */ - memset(&close_ate, 0xff, sizeof(struct zms_ate)); - close_ate.id = ZMS_HEAD_ID; close_ate.len = 0U; close_ate.offset = (uint32_t)SECTOR_OFFSET(fs->ate_wra + fs->ate_size); + close_ate.metadata = 0xffffffff; close_ate.cycle_cnt = fs->sector_cycle; /* When we close the sector, we must write all non used ATE with @@ -752,13 +740,11 @@ static int zms_add_gc_done_ate(struct zms_fs *fs) { struct zms_ate gc_done_ate; - /* Initialize all members to 0xff */ - memset(&gc_done_ate, 0xff, sizeof(struct zms_ate)); - LOG_DBG("Adding gc done ate at %llx", fs->ate_wra); gc_done_ate.id = ZMS_HEAD_ID; gc_done_ate.len = 0U; gc_done_ate.offset = (uint32_t)SECTOR_OFFSET(fs->data_wra); + gc_done_ate.metadata = 0xffffffff; gc_done_ate.cycle_cnt = fs->sector_cycle; zms_ate_crc8_update(&gc_done_ate); @@ -807,14 +793,12 @@ static int zms_add_empty_ate(struct zms_fs *fs, uint64_t addr) int rc = 0; uint64_t previous_ate_wra; - /* Initialize all members to 0 */ - memset(&empty_ate, 0, sizeof(struct zms_ate)); - addr &= ADDR_SECT_MASK; LOG_DBG("Adding empty ate at %llx", (uint64_t)(addr + fs->sector_size - fs->ate_size)); empty_ate.id = ZMS_HEAD_ID; empty_ate.len = 0xffff; + empty_ate.offset = 0U; empty_ate.metadata = FIELD_PREP(ZMS_MAGIC_NUMBER_MASK, ZMS_MAGIC_NUMBER) | ZMS_DEFAULT_VERSION; @@ -909,7 +893,7 @@ static int zms_get_sector_header(struct zms_fs *fs, uint64_t addr, struct zms_at * @retval 1 valid ATE with same ID found * @retval < 0 An error happened */ -static int zms_find_ate_with_id(struct zms_fs *fs, zms_id_t id, uint64_t start_addr, +static int zms_find_ate_with_id(struct zms_fs *fs, uint32_t id, uint64_t start_addr, uint64_t end_addr, struct zms_ate *ate, uint64_t *ate_addr) { int rc; @@ -1060,10 +1044,10 @@ static int zms_gc(struct zms_fs *fs) */ if (wlk_prev_addr == gc_prev_addr) { /* copy needed */ - LOG_DBG("Moving %lld, len %d", (long long)gc_ate.id, gc_ate.len); + LOG_DBG("Moving %d, len %d", gc_ate.id, gc_ate.len); if (gc_ate.len > ZMS_DATA_IN_ATE_SIZE) { - /* Only copy Data with large enough len + /* Copy Data only when len > 8 * Otherwise, Data is already inside ATE */ data_addr = (gc_prev_addr & ADDR_SECT_MASK); @@ -1474,7 +1458,7 @@ int zms_mount(struct zms_fs *fs) return 0; } -ssize_t zms_write(struct zms_fs *fs, zms_id_t id, const void *data, size_t len) +ssize_t zms_write(struct zms_fs *fs, uint32_t id, const void *data, size_t len) { int rc; size_t data_size; @@ -1614,12 +1598,12 @@ ssize_t zms_write(struct zms_fs *fs, zms_id_t id, const void *data, size_t len) return rc; } -int zms_delete(struct zms_fs *fs, zms_id_t id) +int zms_delete(struct zms_fs *fs, uint32_t id) { return zms_write(fs, id, NULL, 0); } -ssize_t zms_read_hist(struct zms_fs *fs, zms_id_t id, void *data, size_t len, uint32_t cnt) +ssize_t zms_read_hist(struct zms_fs *fs, uint32_t id, void *data, size_t len, uint32_t cnt) { int rc; int prev_found = 0; @@ -1716,7 +1700,7 @@ ssize_t zms_read_hist(struct zms_fs *fs, zms_id_t id, void *data, size_t len, ui return rc; } -ssize_t zms_read(struct zms_fs *fs, zms_id_t id, void *data, size_t len) +ssize_t zms_read(struct zms_fs *fs, uint32_t id, void *data, size_t len) { int rc; @@ -1729,7 +1713,7 @@ ssize_t zms_read(struct zms_fs *fs, zms_id_t id, void *data, size_t len) return MIN(rc, len); } -ssize_t zms_get_data_length(struct zms_fs *fs, zms_id_t id) +ssize_t zms_get_data_length(struct zms_fs *fs, uint32_t id) { int rc; diff --git a/subsys/fs/zms/zms_priv.h b/subsys/fs/zms/zms_priv.h index 97e202c2d530..84f77296f4f3 100644 --- a/subsys/fs/zms/zms_priv.h +++ b/subsys/fs/zms/zms_priv.h @@ -28,21 +28,22 @@ #endif #define ZMS_LOOKUP_CACHE_NO_ADDR GENMASK64(63, 0) +#define ZMS_HEAD_ID GENMASK(31, 0) #define ZMS_VERSION_MASK GENMASK(7, 0) #define ZMS_GET_VERSION(x) FIELD_GET(ZMS_VERSION_MASK, x) #define ZMS_DEFAULT_VERSION 1 +#define ZMS_MAGIC_NUMBER 0x42 /* murmur3a hash of "ZMS" (MSB) */ #define ZMS_MAGIC_NUMBER_MASK GENMASK(15, 8) #define ZMS_GET_MAGIC_NUMBER(x) FIELD_GET(ZMS_MAGIC_NUMBER_MASK, x) #define ZMS_MIN_ATE_NUM 5 #define ZMS_INVALID_SECTOR_NUM -1 +#define ZMS_DATA_IN_ATE_SIZE 8 /** * @ingroup zms_data_structures * ZMS Allocation Table Entry (ATE) structure - * - * @note This structure depends on @kconfig{CONFIG_ZMS_ID_64BIT}. */ struct zms_ate { /** crc8 check of the entry */ @@ -51,8 +52,6 @@ struct zms_ate { uint8_t cycle_cnt; /** data len within sector */ uint16_t len; - -#if !defined(CONFIG_ZMS_ID_64BIT) /** data id */ uint32_t id; union { @@ -76,31 +75,6 @@ struct zms_ate { }; }; }; -#else - /** data id */ - uint64_t id; - union { - /** data field used to store small sized data */ - uint8_t data[4]; - /** data offset within sector */ - uint32_t offset; - /** Used to store metadata information such as storage version. */ - uint32_t metadata; - }; -#endif /* CONFIG_ZMS_ID_64BIT */ - } __packed; -#define ZMS_DATA_IN_ATE_SIZE SIZEOF_FIELD(struct zms_ate, data) - -#if !defined(CONFIG_ZMS_ID_64BIT) -#define ZMS_HEAD_ID GENMASK(31, 0) -#define ZMS_MAGIC_NUMBER 0x42 /* murmur3a hash of "ZMS" (MSB) */ - -#else -#define ZMS_HEAD_ID GENMASK64(63, 0) -#define ZMS_MAGIC_NUMBER 0xb8 /* murmur3a hash of "ZMS64" (MSB) */ - -#endif /* CONFIG_ZMS_ID_64BIT */ - #endif /* __ZMS_PRIV_H_ */ From 019a9ebb2b08eacf2876dd2a10e9b0c6db97f7a1 Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Mon, 11 Aug 2025 12:08:09 +0200 Subject: [PATCH 0696/2141] [nrf fromlist] zms: Initial support for 64 bit IDs Upstream PR #: 94330 Allow the ZMS API to optionally accept 64 bit IDs. A typedef `zms_id_t` is added, so that the maximum ID width can be controlled using Kconfig. The current ATE structure is already large enough that it is possible to reserve 64 bits for IDs without increasing its total size (128 bits). This makes the feature a natural, low footprint alternative to Settings, for cases where the supported key namespace must be larger than 32 bit but not arbitrarily large. The ATE format does have to be altered to accommodate larger IDs, but the default "32 bit" format is left as is. Now, the `struct zms_ate` describes one of two supported formats, selected by an `#if` condition. In the future, it may be possible to support multiple ATE formats at runtime, in which case the structure can be turned into a union. In the new, "64 bit" ATEs, the `offset` and `metadata` fields are moved into a union, because they are found to be mutually exclusive. With the old format, the same fields are in different locations, but one of them always gets filled with a dummy value, depending on the given ATE type. To cover both cases, a `memset` is used, which should be optimized away by the compiler when appropriate. The only limitation is that the new ATE format has no room for data CRC, but an alternative integrity check can be implemented by the caller. Signed-off-by: Grzegorz Swiderski (cherry picked from commit ec7a4ad199b0a87e5d604cbea20c8e2f4f741303) --- include/zephyr/fs/zms.h | 21 ++++++-- subsys/fs/zms/Kconfig | 11 ++++ subsys/fs/zms/zms.c | 108 +++++++++++++++++++++++++++------------ subsys/fs/zms/zms_priv.h | 35 ++++++++++++- 4 files changed, 135 insertions(+), 40 deletions(-) diff --git a/include/zephyr/fs/zms.h b/include/zephyr/fs/zms.h index 8b776b426f9c..436f448f6b48 100644 --- a/include/zephyr/fs/zms.h +++ b/include/zephyr/fs/zms.h @@ -77,6 +77,17 @@ struct zms_fs { * @{ */ +/** + * @brief ID type used in the ZMS API. + * + * @note The width of this type depends on @kconfig{CONFIG_ZMS_ID_64BIT}. + */ +#if CONFIG_ZMS_ID_64BIT +typedef uint64_t zms_id_t; +#else +typedef uint32_t zms_id_t; +#endif + /** * @brief Mount a ZMS file system onto the device specified in `fs`. * @@ -127,7 +138,7 @@ int zms_clear(struct zms_fs *fs); * @retval -EINVAL if `len` is invalid. * @retval -ENOSPC if no space is left on the device. */ -ssize_t zms_write(struct zms_fs *fs, uint32_t id, const void *data, size_t len); +ssize_t zms_write(struct zms_fs *fs, zms_id_t id, const void *data, size_t len); /** * @brief Delete an entry from the file system @@ -140,7 +151,7 @@ ssize_t zms_write(struct zms_fs *fs, uint32_t id, const void *data, size_t len); * @retval -ENXIO if there is a device error. * @retval -EIO if there is a memory read/write error. */ -int zms_delete(struct zms_fs *fs, uint32_t id); +int zms_delete(struct zms_fs *fs, zms_id_t id); /** * @brief Read an entry from the file system. @@ -158,7 +169,7 @@ int zms_delete(struct zms_fs *fs, uint32_t id); * @retval -EIO if there is a memory read/write error. * @retval -ENOENT if there is no entry with the given `id`. */ -ssize_t zms_read(struct zms_fs *fs, uint32_t id, void *data, size_t len); +ssize_t zms_read(struct zms_fs *fs, zms_id_t id, void *data, size_t len); /** * @brief Read a history entry from the file system. @@ -178,7 +189,7 @@ ssize_t zms_read(struct zms_fs *fs, uint32_t id, void *data, size_t len); * @retval -EIO if there is a memory read/write error. * @retval -ENOENT if there is no entry with the given `id` and history counter. */ -ssize_t zms_read_hist(struct zms_fs *fs, uint32_t id, void *data, size_t len, uint32_t cnt); +ssize_t zms_read_hist(struct zms_fs *fs, zms_id_t id, void *data, size_t len, uint32_t cnt); /** * @brief Gets the length of the data that is stored in an entry with a given `id` @@ -193,7 +204,7 @@ ssize_t zms_read_hist(struct zms_fs *fs, uint32_t id, void *data, size_t len, ui * @retval -EIO if there is a memory read/write error. * @retval -ENOENT if there is no entry with the given id and history counter. */ -ssize_t zms_get_data_length(struct zms_fs *fs, uint32_t id); +ssize_t zms_get_data_length(struct zms_fs *fs, zms_id_t id); /** * @brief Calculate the available free space in the file system. diff --git a/subsys/fs/zms/Kconfig b/subsys/fs/zms/Kconfig index f371d75647f1..3beb3b0dc34d 100644 --- a/subsys/fs/zms/Kconfig +++ b/subsys/fs/zms/Kconfig @@ -15,6 +15,15 @@ config ZMS if ZMS +config ZMS_ID_64BIT + bool "64 bit ZMS IDs" + help + When this option is true, the `zms_id_t` values passed to ZMS APIs will be 64 bit, + as opposed to the default 32 bit. + This option will also change the format of allocation table entries (ATEs) in memory + to accommodate larger IDs. Currently, this will make ZMS unable to mount an existing + file system if it has been initialized with a different ATE format. + config ZMS_LOOKUP_CACHE bool "ZMS lookup cache" help @@ -33,6 +42,7 @@ config ZMS_LOOKUP_CACHE_SIZE config ZMS_DATA_CRC bool "ZMS data CRC" + depends on !ZMS_ID_64BIT config ZMS_CUSTOMIZE_BLOCK_SIZE bool "Customize the size of the buffer used internally for reads and writes" @@ -53,6 +63,7 @@ config ZMS_CUSTOM_BLOCK_SIZE config ZMS_LOOKUP_CACHE_FOR_SETTINGS bool "ZMS Storage lookup cache optimized for settings" depends on ZMS_LOOKUP_CACHE && SETTINGS_ZMS + depends on !ZMS_ID_64BIT help Enable usage of lookup cache based on hashes to get, the best ZMS performance, provided that the ZMS is used only for the purpose of providing the settings diff --git a/subsys/fs/zms/zms.c b/subsys/fs/zms/zms.c index 80b86a41cdcb..bc0d4286739c 100644 --- a/subsys/fs/zms/zms.c +++ b/subsys/fs/zms/zms.c @@ -29,10 +29,8 @@ static int zms_ate_valid_different_sector(struct zms_fs *fs, const struct zms_at #ifdef CONFIG_ZMS_LOOKUP_CACHE -static inline size_t zms_lookup_cache_pos(uint32_t id) +static inline size_t zms_lookup_cache_pos(zms_id_t id) { - uint32_t hash = id; - #ifdef CONFIG_ZMS_LOOKUP_CACHE_FOR_SETTINGS /* * 1. Settings subsystem is storing the name ID and the linked list node ID @@ -52,14 +50,27 @@ static inline size_t zms_lookup_cache_pos(uint32_t id) uint32_t key_value_bit; uint32_t key_value_hash; uint32_t key_value_ll; + uint32_t hash; key_value_bit = (id >> LOG2(ZMS_DATA_ID_OFFSET)) & 1; key_value_hash = (id & ZMS_HASH_MASK) >> (CONFIG_SETTINGS_ZMS_MAX_COLLISIONS_BITS + 1); key_value_ll = id & BIT(0); hash = (key_value_hash << 2) | (key_value_bit << 1) | key_value_ll; + +#elif defined(CONFIG_ZMS_ID_64BIT) + /* 64-bit integer hash function found by https://github.com/skeeto/hash-prospector. */ + uint64_t hash = id; + + hash ^= hash >> 32; + hash *= 0x42ab4abe4c475039ULL; + hash ^= hash >> 31; + hash *= 0xfa90c4424c537791ULL; + hash ^= hash >> 32; #else /* 32-bit integer hash function found by https://github.com/skeeto/hash-prospector. */ + uint32_t hash = id; + hash ^= hash >> 16; hash *= 0x7feb352dU; hash ^= hash >> 15; @@ -239,7 +250,7 @@ static int zms_flash_ate_wrt(struct zms_fs *fs, const struct zms_ate *entry) goto end; } #ifdef CONFIG_ZMS_LOOKUP_CACHE - /* 0xFFFFFFFF is a special-purpose identifier. Exclude it from the cache */ + /* ZMS_HEAD_ID is a special-purpose identifier. Exclude it from the cache */ if (entry->id != ZMS_HEAD_ID) { fs->lookup_cache[zms_lookup_cache_pos(entry->id)] = fs->ate_wra; } @@ -487,7 +498,7 @@ static bool zms_close_ate_valid(struct zms_fs *fs, const struct zms_ate *entry) /* zms_empty_ate_valid validates an sector empty ate. * A valid sector empty ate should be: * - a valid ate - * - with len = 0xffff and id = 0xffffffff + * - with len = 0xffff and id = ZMS_HEAD_ID * return true if valid, false otherwise */ static bool zms_empty_ate_valid(struct zms_fs *fs, const struct zms_ate *entry) @@ -500,7 +511,7 @@ static bool zms_empty_ate_valid(struct zms_fs *fs, const struct zms_ate *entry) * Valid gc_done_ate: * - valid ate * - len = 0 - * - id = 0xffffffff + * - id = ZMS_HEAD_ID * return true if valid, false otherwise */ static bool zms_gc_done_ate_valid(struct zms_fs *fs, const struct zms_ate *entry) @@ -509,6 +520,18 @@ static bool zms_gc_done_ate_valid(struct zms_fs *fs, const struct zms_ate *entry (entry->id == ZMS_HEAD_ID)); } +/* zms_sector_closed checks whether the current sector is closed, which would imply + * that the empty ATE and close ATE are both valid and have matching cycle counters + * + * return true if closed, false otherwise + */ +static bool zms_sector_closed(struct zms_fs *fs, struct zms_ate *empty_ate, + struct zms_ate *close_ate) +{ + return (zms_empty_ate_valid(fs, empty_ate) && zms_close_ate_valid(fs, close_ate) && + (empty_ate->cycle_cnt == close_ate->cycle_cnt)); +} + /* Read empty and close ATE of the sector where belongs address "addr" and * validates that the sector is closed. * retval: 0 if sector is not close @@ -526,8 +549,7 @@ static int zms_validate_closed_sector(struct zms_fs *fs, uint64_t addr, struct z return rc; } - if (zms_empty_ate_valid(fs, empty_ate) && zms_close_ate_valid(fs, close_ate) && - (empty_ate->cycle_cnt == close_ate->cycle_cnt)) { + if (zms_sector_closed(fs, empty_ate, close_ate)) { /* Closed sector validated */ return 1; } @@ -536,7 +558,7 @@ static int zms_validate_closed_sector(struct zms_fs *fs, uint64_t addr, struct z } /* store an entry in flash */ -static int zms_flash_write_entry(struct zms_fs *fs, uint32_t id, const void *data, size_t len) +static int zms_flash_write_entry(struct zms_fs *fs, zms_id_t id, const void *data, size_t len) { int rc; struct zms_ate entry; @@ -549,13 +571,13 @@ static int zms_flash_write_entry(struct zms_fs *fs, uint32_t id, const void *dat entry.cycle_cnt = fs->sector_cycle; if (len > ZMS_DATA_IN_ATE_SIZE) { - /* only compute CRC if len is greater than 8 bytes */ - if (IS_ENABLED(CONFIG_ZMS_DATA_CRC)) { - entry.data_crc = crc32_ieee(data, len); - } +#ifdef CONFIG_ZMS_DATA_CRC + /* only compute CRC if data is to be stored outside of entry */ + entry.data_crc = crc32_ieee(data, len); +#endif entry.offset = (uint32_t)SECTOR_OFFSET(fs->data_wra); } else if ((len > 0) && (len <= ZMS_DATA_IN_ATE_SIZE)) { - /* Copy data into entry for small data ( < 8B) */ + /* Copy data into entry for small data (at most ZMS_DATA_IN_ATE_SIZE bytes) */ memcpy(&entry.data, data, len); } @@ -688,10 +710,12 @@ static int zms_sector_close(struct zms_fs *fs) struct zms_ate close_ate; struct zms_ate garbage_ate; + /* Initialize all members to 0xff */ + memset(&close_ate, 0xff, sizeof(struct zms_ate)); + close_ate.id = ZMS_HEAD_ID; close_ate.len = 0U; close_ate.offset = (uint32_t)SECTOR_OFFSET(fs->ate_wra + fs->ate_size); - close_ate.metadata = 0xffffffff; close_ate.cycle_cnt = fs->sector_cycle; /* When we close the sector, we must write all non used ATE with @@ -740,11 +764,13 @@ static int zms_add_gc_done_ate(struct zms_fs *fs) { struct zms_ate gc_done_ate; + /* Initialize all members to 0xff */ + memset(&gc_done_ate, 0xff, sizeof(struct zms_ate)); + LOG_DBG("Adding gc done ate at %llx", fs->ate_wra); gc_done_ate.id = ZMS_HEAD_ID; gc_done_ate.len = 0U; gc_done_ate.offset = (uint32_t)SECTOR_OFFSET(fs->data_wra); - gc_done_ate.metadata = 0xffffffff; gc_done_ate.cycle_cnt = fs->sector_cycle; zms_ate_crc8_update(&gc_done_ate); @@ -793,14 +819,17 @@ static int zms_add_empty_ate(struct zms_fs *fs, uint64_t addr) int rc = 0; uint64_t previous_ate_wra; + /* Initialize all members to 0 */ + memset(&empty_ate, 0, sizeof(struct zms_ate)); + addr &= ADDR_SECT_MASK; LOG_DBG("Adding empty ate at %llx", (uint64_t)(addr + fs->sector_size - fs->ate_size)); empty_ate.id = ZMS_HEAD_ID; empty_ate.len = 0xffff; - empty_ate.offset = 0U; - empty_ate.metadata = - FIELD_PREP(ZMS_MAGIC_NUMBER_MASK, ZMS_MAGIC_NUMBER) | ZMS_DEFAULT_VERSION; + empty_ate.metadata = FIELD_PREP(ZMS_VERSION_MASK, ZMS_DEFAULT_VERSION) | + FIELD_PREP(ZMS_MAGIC_NUMBER_MASK, ZMS_MAGIC_NUMBER) | + FIELD_PREP(ZMS_ATE_FORMAT_MASK, ZMS_DEFAULT_ATE_FORMAT); rc = zms_get_sector_cycle(fs, addr, &cycle_cnt); if (rc == -ENOENT) { @@ -893,7 +922,7 @@ static int zms_get_sector_header(struct zms_fs *fs, uint64_t addr, struct zms_at * @retval 1 valid ATE with same ID found * @retval < 0 An error happened */ -static int zms_find_ate_with_id(struct zms_fs *fs, uint32_t id, uint64_t start_addr, +static int zms_find_ate_with_id(struct zms_fs *fs, zms_id_t id, uint64_t start_addr, uint64_t end_addr, struct zms_ate *ate, uint64_t *ate_addr) { int rc; @@ -1044,10 +1073,10 @@ static int zms_gc(struct zms_fs *fs) */ if (wlk_prev_addr == gc_prev_addr) { /* copy needed */ - LOG_DBG("Moving %d, len %d", gc_ate.id, gc_ate.len); + LOG_DBG("Moving %lld, len %d", (long long)gc_ate.id, gc_ate.len); if (gc_ate.len > ZMS_DATA_IN_ATE_SIZE) { - /* Copy Data only when len > 8 + /* Copy Data only when len > ZMS_DATA_IN_ATE_SIZE * Otherwise, Data is already inside ATE */ data_addr = (gc_prev_addr & ADDR_SECT_MASK); @@ -1151,16 +1180,28 @@ static int zms_init(struct zms_fs *fs) for (i = 0; i < fs->sector_count; i++) { addr = zms_close_ate_addr(fs, ((uint64_t)i << ADDR_SECT_SHIFT)); - /* verify if the sector is closed */ - sec_closed = zms_validate_closed_sector(fs, addr, &empty_ate, &close_ate); - if (sec_closed < 0) { - rc = sec_closed; + /* read the header ATEs */ + rc = zms_get_sector_header(fs, addr, &empty_ate, &close_ate); + if (rc) { goto end; } /* update cycle count */ fs->sector_cycle = empty_ate.cycle_cnt; - if (sec_closed == 1) { + /* Check the ATE format indicator so that we know how to validate ATEs. + * The metadata field has the same offset and size in all ATE formats + * (the same is guaranteed for crc8 and cycle_cnt). + * Currently, ZMS can only recognize one of its supported ATE formats + * (the one chosen at build time), so their indicators are defined for + * the possibility of a future extension. + * If this indicator is unknown, then consider the header ATEs invalid, + * because we might not be dealing with ZMS contents at all. + */ + if (ZMS_GET_ATE_FORMAT(empty_ate.metadata) != ZMS_DEFAULT_ATE_FORMAT) { + continue; + } + + if (zms_sector_closed(fs, &empty_ate, &close_ate)) { /* closed sector */ closed_sectors++; /* Let's verify that this is a ZMS storage system */ @@ -1218,7 +1259,8 @@ static int zms_init(struct zms_fs *fs) goto end; } - if (zms_empty_ate_valid(fs, &empty_ate)) { + if ((ZMS_GET_ATE_FORMAT(empty_ate.metadata) == ZMS_DEFAULT_ATE_FORMAT) && + zms_empty_ate_valid(fs, &empty_ate)) { /* Empty ATE is valid, let's verify that this is a ZMS storage system */ if (ZMS_GET_MAGIC_NUMBER(empty_ate.metadata) == ZMS_MAGIC_NUMBER) { zms_magic_exist = true; @@ -1458,7 +1500,7 @@ int zms_mount(struct zms_fs *fs) return 0; } -ssize_t zms_write(struct zms_fs *fs, uint32_t id, const void *data, size_t len) +ssize_t zms_write(struct zms_fs *fs, zms_id_t id, const void *data, size_t len) { int rc; size_t data_size; @@ -1598,12 +1640,12 @@ ssize_t zms_write(struct zms_fs *fs, uint32_t id, const void *data, size_t len) return rc; } -int zms_delete(struct zms_fs *fs, uint32_t id) +int zms_delete(struct zms_fs *fs, zms_id_t id) { return zms_write(fs, id, NULL, 0); } -ssize_t zms_read_hist(struct zms_fs *fs, uint32_t id, void *data, size_t len, uint32_t cnt) +ssize_t zms_read_hist(struct zms_fs *fs, zms_id_t id, void *data, size_t len, uint32_t cnt) { int rc; int prev_found = 0; @@ -1700,7 +1742,7 @@ ssize_t zms_read_hist(struct zms_fs *fs, uint32_t id, void *data, size_t len, ui return rc; } -ssize_t zms_read(struct zms_fs *fs, uint32_t id, void *data, size_t len) +ssize_t zms_read(struct zms_fs *fs, zms_id_t id, void *data, size_t len) { int rc; @@ -1713,7 +1755,7 @@ ssize_t zms_read(struct zms_fs *fs, uint32_t id, void *data, size_t len) return MIN(rc, len); } -ssize_t zms_get_data_length(struct zms_fs *fs, uint32_t id) +ssize_t zms_get_data_length(struct zms_fs *fs, zms_id_t id) { int rc; diff --git a/subsys/fs/zms/zms_priv.h b/subsys/fs/zms/zms_priv.h index 84f77296f4f3..44cfb2f3d280 100644 --- a/subsys/fs/zms/zms_priv.h +++ b/subsys/fs/zms/zms_priv.h @@ -28,7 +28,6 @@ #endif #define ZMS_LOOKUP_CACHE_NO_ADDR GENMASK64(63, 0) -#define ZMS_HEAD_ID GENMASK(31, 0) #define ZMS_VERSION_MASK GENMASK(7, 0) #define ZMS_GET_VERSION(x) FIELD_GET(ZMS_VERSION_MASK, x) @@ -36,14 +35,28 @@ #define ZMS_MAGIC_NUMBER 0x42 /* murmur3a hash of "ZMS" (MSB) */ #define ZMS_MAGIC_NUMBER_MASK GENMASK(15, 8) #define ZMS_GET_MAGIC_NUMBER(x) FIELD_GET(ZMS_MAGIC_NUMBER_MASK, x) +#define ZMS_ATE_FORMAT_MASK GENMASK(19, 16) +#define ZMS_GET_ATE_FORMAT(x) FIELD_GET(ZMS_ATE_FORMAT_MASK, x) #define ZMS_MIN_ATE_NUM 5 #define ZMS_INVALID_SECTOR_NUM -1 -#define ZMS_DATA_IN_ATE_SIZE 8 + +#define ZMS_ATE_FORMAT_ID_32BIT 0 +#define ZMS_ATE_FORMAT_ID_64BIT 1 + +#if !defined(CONFIG_ZMS_ID_64BIT) +#define ZMS_DEFAULT_ATE_FORMAT ZMS_ATE_FORMAT_ID_32BIT +#define ZMS_HEAD_ID GENMASK(31, 0) +#else +#define ZMS_DEFAULT_ATE_FORMAT ZMS_ATE_FORMAT_ID_64BIT +#define ZMS_HEAD_ID GENMASK64(63, 0) +#endif /* CONFIG_ZMS_ID_64BIT */ /** * @ingroup zms_data_structures * ZMS Allocation Table Entry (ATE) structure + * + * @note This structure depends on @kconfig{CONFIG_ZMS_ID_64BIT}. */ struct zms_ate { /** crc8 check of the entry */ @@ -52,6 +65,8 @@ struct zms_ate { uint8_t cycle_cnt; /** data len within sector */ uint16_t len; + +#if ZMS_DEFAULT_ATE_FORMAT == ZMS_ATE_FORMAT_ID_32BIT /** data id */ uint32_t id; union { @@ -75,6 +90,22 @@ struct zms_ate { }; }; }; + +#elif ZMS_DEFAULT_ATE_FORMAT == ZMS_ATE_FORMAT_ID_64BIT + /** data id */ + uint64_t id; + union { + /** data field used to store small sized data */ + uint8_t data[4]; + /** data offset within sector */ + uint32_t offset; + /** Used to store metadata information such as storage version. */ + uint32_t metadata; + }; +#endif /* ZMS_DEFAULT_ATE_FORMAT */ + } __packed; +#define ZMS_DATA_IN_ATE_SIZE SIZEOF_FIELD(struct zms_ate, data) + #endif /* __ZMS_PRIV_H_ */ From 9311d969c2e501e2f01249d92304193acc20cedb Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Mon, 11 Aug 2025 12:08:09 +0200 Subject: [PATCH 0697/2141] [nrf fromlist] tests: zms: Add test coverage for ZMS_ID_64BIT Upstream PR #: 94330 * Update the "corrupt ATE" tests to work with the new ATE format. * Add a basic test to verify support to 64 bit ZMS IDs. * Add a `testcase.yaml` entry to cover the above points and also run lookup cache tests to evaluate the 64 bit hash function. Signed-off-by: Grzegorz Swiderski (cherry picked from commit d9e38a9c4521e9b4423526e2c8e91b64f15928c7) --- tests/subsys/fs/zms/src/main.c | 56 +++++++++++++++++++++++++++---- tests/subsys/fs/zms/testcase.yaml | 6 ++++ 2 files changed, 56 insertions(+), 6 deletions(-) diff --git a/tests/subsys/fs/zms/src/main.c b/tests/subsys/fs/zms/src/main.c index f307fe1b3a73..bcdb739161dc 100644 --- a/tests/subsys/fs/zms/src/main.c +++ b/tests/subsys/fs/zms/src/main.c @@ -578,17 +578,19 @@ ZTEST_F(zms, test_zms_gc_corrupt_close_ate) int err; Z_TEST_SKIP_IFNDEF(CONFIG_FLASH_SIMULATOR_DOUBLE_WRITES); - close_ate.id = 0xffffffff; + memset(&close_ate, 0xff, sizeof(struct zms_ate)); + close_ate.id = ZMS_HEAD_ID; close_ate.offset = fixture->fs.sector_size - sizeof(struct zms_ate) * 5; close_ate.len = 0; - close_ate.metadata = 0xffffffff; close_ate.cycle_cnt = 1; close_ate.crc8 = 0xff; /* Incorrect crc8 */ - empty_ate.id = 0xffffffff; - empty_ate.offset = 0; + memset(&empty_ate, 0, sizeof(struct zms_ate)); + empty_ate.id = ZMS_HEAD_ID; empty_ate.len = 0xffff; - empty_ate.metadata = 0x4201; + empty_ate.metadata = FIELD_PREP(ZMS_VERSION_MASK, ZMS_DEFAULT_VERSION) | + FIELD_PREP(ZMS_MAGIC_NUMBER_MASK, ZMS_MAGIC_NUMBER) | + FIELD_PREP(ZMS_ATE_FORMAT_MASK, ZMS_DEFAULT_ATE_FORMAT); empty_ate.cycle_cnt = 1; empty_ate.crc8 = crc8_ccitt(0xff, (uint8_t *)&empty_ate + SIZEOF_FIELD(struct zms_ate, crc8), @@ -649,7 +651,7 @@ ZTEST_F(zms, test_zms_gc_corrupt_ate) struct zms_ate close_ate; int err; - close_ate.id = 0xffffffff; + close_ate.id = ZMS_HEAD_ID; close_ate.offset = fixture->fs.sector_size / 2; close_ate.len = 0; close_ate.crc8 = @@ -896,3 +898,45 @@ ZTEST_F(zms, test_zms_cache_hash_quality) ztest_test_skip(); #endif } + +/* + * Test 64 bit ZMS ID support. + */ +ZTEST_F(zms, test_zms_id_64bit) +{ + int err; + ssize_t len; + uint64_t data; + uint64_t filling_id = 0xdeadbeefULL; + + Z_TEST_SKIP_IFNDEF(CONFIG_ZMS_ID_64BIT); + + err = zms_mount(&fixture->fs); + zassert_true(err == 0, "zms_mount call failure: %d", err); + + /* Fill the first sector with writes of different IDs */ + + while (fixture->fs.data_wra + sizeof(data) + sizeof(struct zms_ate) <= + fixture->fs.ate_wra) { + data = filling_id; + len = zms_write(&fixture->fs, (zms_id_t)filling_id, &data, sizeof(data)); + zassert_true(len == sizeof(data), "zms_write failed: %d", len); + + /* Choose the next ID so that its lower 32 bits stay invariant. + * The purpose is to test that ZMS doesn't mistakenly cast the + * 64 bit ID to a 32 bit one somewhere. + */ + filling_id += BIT64(32); + } + + /* Read back the written entries and check that they're all unique */ + + for (uint64_t id = 0xdeadbeefULL; id < filling_id; id += BIT64(32)) { + len = zms_read_hist(&fixture->fs, (zms_id_t)id, &data, sizeof(data), 0); + zassert_true(len == sizeof(data), "zms_read_hist unexpected failure: %d", len); + zassert_equal(data, id, "read unexpected data: %llx instead of %llx", data, id); + + len = zms_read_hist(&fixture->fs, (zms_id_t)id, &data, sizeof(data), 1); + zassert_true(len == -ENOENT, "zms_read_hist unexpected failure: %d", len); + } +} diff --git a/tests/subsys/fs/zms/testcase.yaml b/tests/subsys/fs/zms/testcase.yaml index 4949e1be0c6b..14cb7e9c36a2 100644 --- a/tests/subsys/fs/zms/testcase.yaml +++ b/tests/subsys/fs/zms/testcase.yaml @@ -27,3 +27,9 @@ tests: platform_allow: - native_sim - qemu_x86 + filesystem.zms.id_64bit: + extra_configs: + - CONFIG_ZMS_ID_64BIT=y + - CONFIG_ZMS_LOOKUP_CACHE=y + - CONFIG_ZMS_LOOKUP_CACHE_SIZE=64 + platform_allow: qemu_x86 From 476ad665287a8b92e90ba1ec9a1ebd3241018b7a Mon Sep 17 00:00:00 2001 From: Riadh Ghaddab Date: Tue, 3 Jun 2025 16:07:48 +0200 Subject: [PATCH 0698/2141] [nrf noup] zms: add lookup cache hash function for legacy ZMS ZMS legacy enabled by CONFIG_SETTINGS_ZMS_LEGACY uses a different lookup cache function that is optimized for Settings subsystem. Signed-off-by: Riadh Ghaddab (cherry picked from commit 491354b7e5fd6255de4b119e9256012aefaf19f6) (cherry picked from commit 15cd2f6e5d5b9e6580365cae8d882e1e8845f188) (cherry picked from commit 8ccb9862ea82f28f5b92c33ea5d382b2da9ce203) --- subsys/fs/zms/zms.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/subsys/fs/zms/zms.c b/subsys/fs/zms/zms.c index bc0d4286739c..6d3a2b30a3aa 100644 --- a/subsys/fs/zms/zms.c +++ b/subsys/fs/zms/zms.c @@ -13,8 +13,12 @@ #include #include "zms_priv.h" #ifdef CONFIG_ZMS_LOOKUP_CACHE_FOR_SETTINGS +#ifdef CONFIG_SETTINGS_ZMS_LEGACY +#include +#else #include #endif +#endif #include LOG_MODULE_REGISTER(fs_zms, CONFIG_ZMS_LOG_LEVEL); @@ -32,6 +36,40 @@ static int zms_ate_valid_different_sector(struct zms_fs *fs, const struct zms_at static inline size_t zms_lookup_cache_pos(zms_id_t id) { #ifdef CONFIG_ZMS_LOOKUP_CACHE_FOR_SETTINGS +#ifdef CONFIG_SETTINGS_ZMS_LEGACY + /* + * 1. The ZMS settings backend uses up to (ZMS_NAME_ID_OFFSET - 1) ZMS IDs to + store keys and equal number of ZMS IDs to store values. + * 2. For each key-value pair, the value is stored at ZMS ID greater by exactly + * ZMS_NAME_ID_OFFSET than ZMS ID that holds the key. + * 3. The backend tries to minimize the range of ZMS IDs used to store keys. + * That is, ZMS IDs are allocated sequentially, and freed ZMS IDs are reused + * before allocating new ones. + * + * Therefore, to assure the least number of collisions in the lookup cache, + * the least significant bit of the hash indicates whether the given ZMS ID + * represents a key or a value, and remaining bits of the hash are set to + * the ordinal number of the key-value pair. Consequently, the hash function + * provides the following mapping: + * + * 1st settings key => hash 0 + * 1st settings value => hash 1 + * 2nd settings key => hash 2 + * 2nd settings value => hash 3 + * ... + */ + BUILD_ASSERT(IS_POWER_OF_TWO(ZMS_NAMECNT_ID), "ZMS_NAMECNT_ID is not power of 2"); + BUILD_ASSERT(IS_POWER_OF_TWO(ZMS_NAME_ID_OFFSET), "ZMS_NAME_ID_OFFSET is not power of 2"); + + uint32_t key_value_bit; + uint32_t key_value_ord; + uint32_t hash; + + key_value_bit = (id >> LOG2(ZMS_NAME_ID_OFFSET)) & 1; + key_value_ord = id & (ZMS_NAME_ID_OFFSET - 1); + + hash = ((key_value_ord << 1) | key_value_bit); +#else /* * 1. Settings subsystem is storing the name ID and the linked list node ID * with only one bit difference at BIT(0). @@ -57,6 +95,7 @@ static inline size_t zms_lookup_cache_pos(zms_id_t id) key_value_ll = id & BIT(0); hash = (key_value_hash << 2) | (key_value_bit << 1) | key_value_ll; +#endif /* CONFIG_SETTINGS_ZMS_LEGACY */ #elif defined(CONFIG_ZMS_ID_64BIT) /* 64-bit integer hash function found by https://github.com/skeeto/hash-prospector. */ From 20d3002d636dc6cef77d1059dadc1510f99f640e Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Tue, 3 Jun 2025 15:32:41 +0200 Subject: [PATCH 0699/2141] [nrf fromtree] modules: openthread: platform: logging: Take kconfig into account Currently all calls to otPlatLog with debug log level are printed. Cleanup logging.c Signed-off-by: Pieter De Gendt (cherry picked from commit 9983ff708ecd2a3152109bc5c2ae00e6a2ef752b) --- modules/openthread/platform/logging.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/modules/openthread/platform/logging.c b/modules/openthread/platform/logging.c index 110bd2ecf544..2445c9c53ed2 100644 --- a/modules/openthread/platform/logging.c +++ b/modules/openthread/platform/logging.c @@ -5,16 +5,10 @@ */ #include +#include #include -#include #include -#include "openthread-core-zephyr-config.h" - -#define LOG_MODULE_NAME net_openthread -#define LOG_LEVEL LOG_LEVEL_DBG -#include -LOG_MODULE_REGISTER(LOG_MODULE_NAME); #include "platform-zephyr.h" @@ -49,7 +43,7 @@ void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat int level = log_translate(aLogLevel); va_list param_list; - if (level < 0) { + if (level < 0 || level > CONFIG_OPENTHREAD_PLATFORM_LOG_LEVEL) { return; } From 5ca258a1523d6f9a9211c51770fa7e7be2fa27ad Mon Sep 17 00:00:00 2001 From: Piotr Kosycarz Date: Mon, 25 Aug 2025 08:35:55 +0200 Subject: [PATCH 0700/2141] [nrf fromlist] tests: drivers: spi: spi_loopback: skip timing test when COVERAGE Skip checking timing expectation when COVERAGE is used. Coverage mode affect timing - making code slower, as additional operations are needed to gather coverage stats. Upstream PR #: 94927 Signed-off-by: Piotr Kosycarz --- tests/drivers/spi/spi_loopback/src/spi.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/drivers/spi/spi_loopback/src/spi.c b/tests/drivers/spi/spi_loopback/src/spi.c index bb8b9d283b28..ad45fd67991b 100644 --- a/tests/drivers/spi/spi_loopback/src/spi.c +++ b/tests/drivers/spi/spi_loopback/src/spi.c @@ -291,6 +291,9 @@ ZTEST(spi_loopback, test_spi_complete_multiple) /* same as the test_spi_complete_multiple test, but seeing if there is any unreasonable latency */ ZTEST(spi_loopback, test_spi_complete_multiple_timed) { + /* Do not check timing when coverage is enabled */ + Z_TEST_SKIP_IFDEF(CONFIG_COVERAGE); + struct spi_dt_spec *spec = loopback_specs[spec_idx]; const struct spi_buf_set tx = spi_loopback_setup_xfer(tx_bufs_pool, 2, buffer_tx, BUF_SIZE, From 273273fe9cc22beb95197bc40c4290fa4ca79927 Mon Sep 17 00:00:00 2001 From: Johann Fischer Date: Tue, 5 Nov 2024 11:20:11 +0100 Subject: [PATCH 0701/2141] [nrf fromtree] samples: usb: move the legacy code out of the CDC ACM sample Move the legacy code of the CDC ACM sample to a separate sample in the legacy directory. Signed-off-by: Johann Fischer (cherry picked from commit a7b0f71925e8b86fd817ac65789db42e57cb5f8b) --- samples/subsys/usb/cdc_acm/README.rst | 6 +- samples/subsys/usb/cdc_acm/prj.conf | 19 ++- samples/subsys/usb/cdc_acm/sample.yaml | 18 -- samples/subsys/usb/cdc_acm/src/main.c | 40 +---- samples/subsys/usb/cdc_acm/usbd_next_prj.conf | 14 -- .../subsys/usb/legacy/cdc_acm/CMakeLists.txt | 9 + samples/subsys/usb/legacy/cdc_acm/README.rst | 102 ++++++++++++ samples/subsys/usb/legacy/cdc_acm/app.overlay | 11 ++ samples/subsys/usb/legacy/cdc_acm/prj.conf | 11 ++ samples/subsys/usb/legacy/cdc_acm/sample.yaml | 7 + samples/subsys/usb/legacy/cdc_acm/src/main.c | 154 ++++++++++++++++++ 11 files changed, 310 insertions(+), 81 deletions(-) delete mode 100644 samples/subsys/usb/cdc_acm/usbd_next_prj.conf create mode 100644 samples/subsys/usb/legacy/cdc_acm/CMakeLists.txt create mode 100644 samples/subsys/usb/legacy/cdc_acm/README.rst create mode 100644 samples/subsys/usb/legacy/cdc_acm/app.overlay create mode 100644 samples/subsys/usb/legacy/cdc_acm/prj.conf create mode 100644 samples/subsys/usb/legacy/cdc_acm/sample.yaml create mode 100644 samples/subsys/usb/legacy/cdc_acm/src/main.c diff --git a/samples/subsys/usb/cdc_acm/README.rst b/samples/subsys/usb/cdc_acm/README.rst index 21ce853ae081..db95373b2530 100644 --- a/samples/subsys/usb/cdc_acm/README.rst +++ b/samples/subsys/usb/cdc_acm/README.rst @@ -1,8 +1,8 @@ .. zephyr:code-sample:: usb-cdc-acm - :name: USB CDC-ACM - :relevant-api: usbd_api _usb_device_core_api uart_interface + :name: USB CDC ACM UART sample + :relevant-api: usbd_api uart_interface - Use USB CDC-ACM driver to implement a serial port echo. + Use USB CDC ACM UART driver to implement a serial port echo. Overview ******** diff --git a/samples/subsys/usb/cdc_acm/prj.conf b/samples/subsys/usb/cdc_acm/prj.conf index 55e4fe9217fb..e0012027ec6a 100644 --- a/samples/subsys/usb/cdc_acm/prj.conf +++ b/samples/subsys/usb/cdc_acm/prj.conf @@ -1,11 +1,14 @@ +CONFIG_USB_DEVICE_STACK_NEXT=y + CONFIG_STDOUT_CONSOLE=y -CONFIG_USB_DEVICE_STACK=y -CONFIG_USB_DEVICE_PRODUCT="Zephyr CDC ACM sample" -CONFIG_USB_DEVICE_PID=0x0001 -CONFIG_LOG=y -CONFIG_USB_DRIVER_LOG_LEVEL_ERR=y -CONFIG_USB_DEVICE_LOG_LEVEL_ERR=y CONFIG_SERIAL=y -CONFIG_UART_INTERRUPT_DRIVEN=y CONFIG_UART_LINE_CTRL=y -CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=n +CONFIG_USBD_CDC_ACM_CLASS=y + +CONFIG_LOG=y +CONFIG_USBD_LOG_LEVEL_ERR=y +CONFIG_UDC_DRIVER_LOG_LEVEL_ERR=y +CONFIG_USBD_CDC_ACM_LOG_LEVEL_ERR=y + +CONFIG_SAMPLE_USBD_PID=0x0001 +CONFIG_SAMPLE_USBD_PRODUCT="USBD CDC ACM sample" diff --git a/samples/subsys/usb/cdc_acm/sample.yaml b/samples/subsys/usb/cdc_acm/sample.yaml index 875bfb335b5c..b9256e74eee5 100644 --- a/samples/subsys/usb/cdc_acm/sample.yaml +++ b/samples/subsys/usb/cdc_acm/sample.yaml @@ -1,19 +1,9 @@ sample: name: CDC ACM USB tests: - sample.usb.cdc-acm: - depends_on: usb_device - tags: usb - arch_exclude: posix - harness: console - harness_config: - type: one_line - regex: - - "Wait for DTR" sample.usb_device_next.cdc-acm: depends_on: usbd tags: usb - extra_args: CONF_FILE="usbd_next_prj.conf" integration_platforms: - nrf52840dk/nrf52840 - nrf54h20dk/nrf54h20/cpuapp @@ -34,7 +24,6 @@ tests: depends_on: usbd tags: usb extra_args: - - CONF_FILE="usbd_next_prj.conf" - DCONFIG_USBD_CDC_ACM_WORKQUEUE=y integration_platforms: - frdm_k64f @@ -43,10 +32,3 @@ tests: type: one_line regex: - "Wait for DTR" - sample.usb.cdc-acm.buildonly: - depends_on: usb_device - tags: usb - arch_allow: posix - build_only: true - integration_platforms: - - native_sim diff --git a/samples/subsys/usb/cdc_acm/src/main.c b/samples/subsys/usb/cdc_acm/src/main.c index ab1cbdc6a4c0..c80d253966b7 100644 --- a/samples/subsys/usb/cdc_acm/src/main.c +++ b/samples/subsys/usb/cdc_acm/src/main.c @@ -4,14 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * @file - * @brief Sample echo app for CDC ACM class - * - * Sample app for USB CDC ACM class driver. The received data is echoed back - * to the serial port. - */ - #include #include @@ -21,7 +13,6 @@ #include #include -#include #include #include LOG_MODULE_REGISTER(cdc_acm_echo, LOG_LEVEL_INF); @@ -48,7 +39,6 @@ static inline void print_baudrate(const struct device *dev) } } -#if defined(CONFIG_USB_DEVICE_STACK_NEXT) static struct usbd_context *sample_usbd; K_SEM_DEFINE(dtr_sem, 0, 1); @@ -106,7 +96,6 @@ static int enable_usb_device_next(void) return 0; } -#endif /* defined(CONFIG_USB_DEVICE_STACK_NEXT) */ static void interrupt_handler(const struct device *dev, void *user_data) { @@ -178,37 +167,16 @@ int main(void) return 0; } -#if defined(CONFIG_USB_DEVICE_STACK_NEXT) - ret = enable_usb_device_next(); -#else - ret = usb_enable(NULL); -#endif - + ret = enable_usb_device_next(); if (ret != 0) { - LOG_ERR("Failed to enable USB"); + LOG_ERR("Failed to enable USB device support"); return 0; } ring_buf_init(&ringbuf, sizeof(ring_buffer), ring_buffer); LOG_INF("Wait for DTR"); - -#if defined(CONFIG_USB_DEVICE_STACK_NEXT) k_sem_take(&dtr_sem, K_FOREVER); -#else - while (true) { - uint32_t dtr = 0U; - - uart_line_ctrl_get(uart_dev, UART_LINE_CTRL_DTR, &dtr); - if (dtr) { - break; - } else { - /* Give CPU resources to low priority threads. */ - k_sleep(K_MSEC(100)); - } - } -#endif - LOG_INF("DTR set"); /* They are optional, we use them to test the interrupt endpoint */ @@ -225,11 +193,7 @@ int main(void) /* Wait 100ms for the host to do all settings */ k_msleep(100); -#ifndef CONFIG_USB_DEVICE_STACK_NEXT - print_baudrate(uart_dev); -#endif uart_irq_callback_set(uart_dev, interrupt_handler); - /* Enable rx interrupts */ uart_irq_rx_enable(uart_dev); diff --git a/samples/subsys/usb/cdc_acm/usbd_next_prj.conf b/samples/subsys/usb/cdc_acm/usbd_next_prj.conf deleted file mode 100644 index f08928438b77..000000000000 --- a/samples/subsys/usb/cdc_acm/usbd_next_prj.conf +++ /dev/null @@ -1,14 +0,0 @@ -CONFIG_USB_DEVICE_STACK_NEXT=y - -CONFIG_STDOUT_CONSOLE=y -CONFIG_SERIAL=y -CONFIG_UART_LINE_CTRL=y -CONFIG_USBD_CDC_ACM_CLASS=y - -CONFIG_LOG=y -CONFIG_USBD_LOG_LEVEL_WRN=y -CONFIG_UDC_DRIVER_LOG_LEVEL_WRN=y -CONFIG_USBD_CDC_ACM_LOG_LEVEL_ERR=y - -CONFIG_SAMPLE_USBD_PID=0x0001 -CONFIG_SAMPLE_USBD_PRODUCT="USBD CDC ACM sample" diff --git a/samples/subsys/usb/legacy/cdc_acm/CMakeLists.txt b/samples/subsys/usb/legacy/cdc_acm/CMakeLists.txt new file mode 100644 index 000000000000..c97b49907663 --- /dev/null +++ b/samples/subsys/usb/legacy/cdc_acm/CMakeLists.txt @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(cdc_acm) + +include(${ZEPHYR_BASE}/samples/subsys/usb/common/common.cmake) +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/subsys/usb/legacy/cdc_acm/README.rst b/samples/subsys/usb/legacy/cdc_acm/README.rst new file mode 100644 index 000000000000..1e7a4d153006 --- /dev/null +++ b/samples/subsys/usb/legacy/cdc_acm/README.rst @@ -0,0 +1,102 @@ +.. zephyr:code-sample:: legacy-usb-cdc-acm + :name: Legacy USB CDC ACM UART sample + :relevant-api: _usb_device_core_api uart_interface + + Use USB CDC ACM UART driver to implement a serial port echo. + +Overview +******** + +This sample app demonstrates use of a USB Communication Device Class (CDC) +Abstract Control Model (ACM) driver provided by the Zephyr project. +Received data from the serial port is echoed back to the same port +provided by this driver. + +.. note:: + This samples demonstrate deprecated :ref:`usb_device_stack`. + +This sample can be found under :zephyr_file:`samples/subsys/usb/legacy/cdc_acm` in the +Zephyr project tree. + +Requirements +************ + +This project requires an USB device driver, which is available for multiple +boards supported in Zephyr. + +Building and Running +******************** + +Reel Board +=========== + +To see the console output of the app, open a serial port emulator and +attach it to the USB to TTL Serial cable. Build and flash the project: + +.. zephyr-app-commands:: + :zephyr-app: samples/subsys/usb/legacy/cdc_acm + :board: reel_board + :goals: flash + :compact: + +Running +======= + +Plug the board into a host device, for example, a PC running Linux. +The board will be detected as shown by the Linux dmesg command: + +.. code-block:: console + + usb 9-1: new full-speed USB device number 112 using uhci_hcd + usb 9-1: New USB device found, idVendor=8086, idProduct=f8a1 + usb 9-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 + usb 9-1: Product: CDC-ACM + usb 9-1: Manufacturer: Intel + usb 9-1: SerialNumber: 00.01 + cdc_acm 9-1:1.0: ttyACM1: USB ACM device + +The app prints on serial output (UART1), used for the console: + +.. code-block:: console + + Wait for DTR + +Open a serial port emulator, for example minicom +and attach it to detected CDC ACM device: + +.. code-block:: console + + minicom --device /dev/ttyACM1 + +The app should respond on serial output with: + +.. code-block:: console + + DTR set, start test + Baudrate detected: 115200 + +And on ttyACM device, provided by zephyr USB device stack: + +.. code-block:: console + + Send characters to the UART device + Characters read: + +The characters entered in serial port emulator will be echoed back. + +Troubleshooting +=============== + +If the ModemManager runs on your operating system, it will try +to access the CDC ACM device and maybe you can see several characters +including "AT" on the terminal attached to the CDC ACM device. +You can add or extend the udev rule for your board to inform +ModemManager to skip the CDC ACM device. +For this example, it would look like this: + +.. code-block:: none + + ATTRS{idVendor}=="8086" ATTRS{idProduct}=="f8a1", ENV{ID_MM_DEVICE_IGNORE}="1" + +You can use +``/lib/udev/rules.d/77-mm-usb-device-blacklist.rules`` as reference. diff --git a/samples/subsys/usb/legacy/cdc_acm/app.overlay b/samples/subsys/usb/legacy/cdc_acm/app.overlay new file mode 100644 index 000000000000..c50d0fd9d69e --- /dev/null +++ b/samples/subsys/usb/legacy/cdc_acm/app.overlay @@ -0,0 +1,11 @@ +/* + * Copyright (c) 2021 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&zephyr_udc0 { + cdc_acm_uart0 { + compatible = "zephyr,cdc-acm-uart"; + }; +}; diff --git a/samples/subsys/usb/legacy/cdc_acm/prj.conf b/samples/subsys/usb/legacy/cdc_acm/prj.conf new file mode 100644 index 000000000000..55e4fe9217fb --- /dev/null +++ b/samples/subsys/usb/legacy/cdc_acm/prj.conf @@ -0,0 +1,11 @@ +CONFIG_STDOUT_CONSOLE=y +CONFIG_USB_DEVICE_STACK=y +CONFIG_USB_DEVICE_PRODUCT="Zephyr CDC ACM sample" +CONFIG_USB_DEVICE_PID=0x0001 +CONFIG_LOG=y +CONFIG_USB_DRIVER_LOG_LEVEL_ERR=y +CONFIG_USB_DEVICE_LOG_LEVEL_ERR=y +CONFIG_SERIAL=y +CONFIG_UART_INTERRUPT_DRIVEN=y +CONFIG_UART_LINE_CTRL=y +CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=n diff --git a/samples/subsys/usb/legacy/cdc_acm/sample.yaml b/samples/subsys/usb/legacy/cdc_acm/sample.yaml new file mode 100644 index 000000000000..b61deab71ff2 --- /dev/null +++ b/samples/subsys/usb/legacy/cdc_acm/sample.yaml @@ -0,0 +1,7 @@ +sample: + name: CDC ACM USB +tests: + sample.usb.legacy.cdc-acm: + depends_on: usb_device + tags: usb + build_only: true diff --git a/samples/subsys/usb/legacy/cdc_acm/src/main.c b/samples/subsys/usb/legacy/cdc_acm/src/main.c new file mode 100644 index 000000000000..d06161f0f5ca --- /dev/null +++ b/samples/subsys/usb/legacy/cdc_acm/src/main.c @@ -0,0 +1,154 @@ +/* + * Copyright (c) 2019 Intel Corporation + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include +#include + +#include +#include +LOG_MODULE_REGISTER(cdc_acm_echo, LOG_LEVEL_INF); + +const struct device *const uart_dev = DEVICE_DT_GET_ONE(zephyr_cdc_acm_uart); + +#define RING_BUF_SIZE 1024 +uint8_t ring_buffer[RING_BUF_SIZE]; + +struct ring_buf ringbuf; + +static bool rx_throttled; + +static inline void print_baudrate(const struct device *dev) +{ + uint32_t baudrate; + int ret; + + ret = uart_line_ctrl_get(dev, UART_LINE_CTRL_BAUD_RATE, &baudrate); + if (ret) { + LOG_WRN("Failed to get baudrate, ret code %d", ret); + } else { + LOG_INF("Baudrate %u", baudrate); + } +} + +static void interrupt_handler(const struct device *dev, void *user_data) +{ + ARG_UNUSED(user_data); + + while (uart_irq_update(dev) && uart_irq_is_pending(dev)) { + if (!rx_throttled && uart_irq_rx_ready(dev)) { + int recv_len, rb_len; + uint8_t buffer[64]; + size_t len = MIN(ring_buf_space_get(&ringbuf), + sizeof(buffer)); + + if (len == 0) { + /* Throttle because ring buffer is full */ + uart_irq_rx_disable(dev); + rx_throttled = true; + continue; + } + + recv_len = uart_fifo_read(dev, buffer, len); + if (recv_len < 0) { + LOG_ERR("Failed to read UART FIFO"); + recv_len = 0; + }; + + rb_len = ring_buf_put(&ringbuf, buffer, recv_len); + if (rb_len < recv_len) { + LOG_ERR("Drop %u bytes", recv_len - rb_len); + } + + LOG_DBG("tty fifo -> ringbuf %d bytes", rb_len); + if (rb_len) { + uart_irq_tx_enable(dev); + } + } + + if (uart_irq_tx_ready(dev)) { + uint8_t buffer[64]; + int rb_len, send_len; + + rb_len = ring_buf_get(&ringbuf, buffer, sizeof(buffer)); + if (!rb_len) { + LOG_DBG("Ring buffer empty, disable TX IRQ"); + uart_irq_tx_disable(dev); + continue; + } + + if (rx_throttled) { + uart_irq_rx_enable(dev); + rx_throttled = false; + } + + send_len = uart_fifo_fill(dev, buffer, rb_len); + if (send_len < rb_len) { + LOG_ERR("Drop %d bytes", rb_len - send_len); + } + + LOG_DBG("ringbuf -> tty fifo %d bytes", send_len); + } + } +} + +int main(void) +{ + int ret; + + if (!device_is_ready(uart_dev)) { + LOG_ERR("CDC ACM device not ready"); + return 0; + } + + ret = usb_enable(NULL); + if (ret != 0) { + LOG_ERR("Failed to enable USB"); + return 0; + } + + ring_buf_init(&ringbuf, sizeof(ring_buffer), ring_buffer); + + LOG_INF("Wait for DTR"); + + while (true) { + uint32_t dtr = 0U; + + uart_line_ctrl_get(uart_dev, UART_LINE_CTRL_DTR, &dtr); + if (dtr) { + break; + } + + k_sleep(K_MSEC(100)); + } + + LOG_INF("DTR set"); + + /* They are optional, we use them to test the interrupt endpoint */ + ret = uart_line_ctrl_set(uart_dev, UART_LINE_CTRL_DCD, 1); + if (ret) { + LOG_WRN("Failed to set DCD, ret code %d", ret); + } + + ret = uart_line_ctrl_set(uart_dev, UART_LINE_CTRL_DSR, 1); + if (ret) { + LOG_WRN("Failed to set DSR, ret code %d", ret); + } + + /* Wait 100ms for the host to do all settings */ + k_msleep(100); + + print_baudrate(uart_dev); + + uart_irq_callback_set(uart_dev, interrupt_handler); + /* Enable rx interrupts */ + uart_irq_rx_enable(uart_dev); + + return 0; +} From 82e0bf157cf68480d2b1f402e709063ed588dd52 Mon Sep 17 00:00:00 2001 From: Johann Fischer Date: Tue, 5 Nov 2024 13:11:47 +0100 Subject: [PATCH 0702/2141] [nrf fromtree] samples: usb: move the legacy code out of the HID mouse sample Move the legacy code from the HID mouse sample to a separate sample in the legacy directory. Signed-off-by: Johann Fischer (cherry picked from commit 1e50aaa6e0570700badb65f2c42125d85af17084) --- samples/subsys/usb/hid-mouse/README.rst | 2 +- .../{usbd_next.overlay => app.overlay} | 0 samples/subsys/usb/hid-mouse/prj.conf | 14 +- samples/subsys/usb/hid-mouse/sample.yaml | 9 - samples/subsys/usb/hid-mouse/src/main.c | 120 ++++++------- .../subsys/usb/hid-mouse/usbd_next_prj.conf | 11 -- .../usb/legacy/hid-mouse/CMakeLists.txt | 9 + .../subsys/usb/legacy/hid-mouse/README.rst | 114 +++++++++++++ samples/subsys/usb/legacy/hid-mouse/prj.conf | 13 ++ .../subsys/usb/legacy/hid-mouse/sample.yaml | 15 ++ .../subsys/usb/legacy/hid-mouse/src/main.c | 158 ++++++++++++++++++ 11 files changed, 364 insertions(+), 101 deletions(-) rename samples/subsys/usb/hid-mouse/{usbd_next.overlay => app.overlay} (100%) delete mode 100644 samples/subsys/usb/hid-mouse/usbd_next_prj.conf create mode 100644 samples/subsys/usb/legacy/hid-mouse/CMakeLists.txt create mode 100644 samples/subsys/usb/legacy/hid-mouse/README.rst create mode 100644 samples/subsys/usb/legacy/hid-mouse/prj.conf create mode 100644 samples/subsys/usb/legacy/hid-mouse/sample.yaml create mode 100644 samples/subsys/usb/legacy/hid-mouse/src/main.c diff --git a/samples/subsys/usb/hid-mouse/README.rst b/samples/subsys/usb/hid-mouse/README.rst index e2f099f98f44..0c1d908f05b8 100644 --- a/samples/subsys/usb/hid-mouse/README.rst +++ b/samples/subsys/usb/hid-mouse/README.rst @@ -1,6 +1,6 @@ .. zephyr:code-sample:: usb-hid-mouse :name: USB HID mouse - :relevant-api: _usb_device_core_api usb_hid_device_api input_interface + :relevant-api: usbd_api usbd_hid_device input_interface Implement a basic HID mouse device. diff --git a/samples/subsys/usb/hid-mouse/usbd_next.overlay b/samples/subsys/usb/hid-mouse/app.overlay similarity index 100% rename from samples/subsys/usb/hid-mouse/usbd_next.overlay rename to samples/subsys/usb/hid-mouse/app.overlay diff --git a/samples/subsys/usb/hid-mouse/prj.conf b/samples/subsys/usb/hid-mouse/prj.conf index b797a7382e81..9c8894b2126c 100644 --- a/samples/subsys/usb/hid-mouse/prj.conf +++ b/samples/subsys/usb/hid-mouse/prj.conf @@ -1,13 +1,11 @@ -CONFIG_USB_DEVICE_STACK=y -CONFIG_USB_DEVICE_HID=y -CONFIG_USB_DEVICE_PRODUCT="Zephyr HID mouse sample" -CONFIG_USB_DEVICE_PID=0x0007 -CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=n +CONFIG_USB_DEVICE_STACK_NEXT=y +CONFIG_USBD_HID_SUPPORT=y CONFIG_LOG=y -CONFIG_USB_DRIVER_LOG_LEVEL_ERR=y -CONFIG_USB_DEVICE_LOG_LEVEL_ERR=y +CONFIG_USBD_LOG_LEVEL_WRN=y +CONFIG_USBD_HID_LOG_LEVEL_WRN=y +CONFIG_UDC_DRIVER_LOG_LEVEL_WRN=y +CONFIG_SAMPLE_USBD_PID=0x0007 CONFIG_GPIO=y CONFIG_INPUT=y -CONFIG_INPUT_MODE_SYNCHRONOUS=y diff --git a/samples/subsys/usb/hid-mouse/sample.yaml b/samples/subsys/usb/hid-mouse/sample.yaml index 132c71c928b6..0a9e1af37f0f 100644 --- a/samples/subsys/usb/hid-mouse/sample.yaml +++ b/samples/subsys/usb/hid-mouse/sample.yaml @@ -6,12 +6,6 @@ common: depends_on: - gpio tests: - sample.usb.hid-mouse: - depends_on: - - usb_device - platform_exclude: - - frdm_mcxn947/mcxn947/cpu0 - tags: usb sample.usb_device_next.hid-mouse: depends_on: - usbd @@ -23,7 +17,4 @@ tests: - nucleo_f413zh - mimxrt1060_evk/mimxrt1062/qspi - max32690evkit/max32690/m4 - extra_args: - - CONF_FILE="usbd_next_prj.conf" - - EXTRA_DTC_OVERLAY_FILE="usbd_next.overlay" tags: usb diff --git a/samples/subsys/usb/hid-mouse/src/main.c b/samples/subsys/usb/hid-mouse/src/main.c index 4e579832cf9d..967591b2a711 100644 --- a/samples/subsys/usb/hid-mouse/src/main.c +++ b/samples/subsys/usb/hid-mouse/src/main.c @@ -15,16 +15,14 @@ #include #include -#include #include -#include +#include #include LOG_MODULE_REGISTER(main, LOG_LEVEL_INF); static const struct gpio_dt_spec led0 = GPIO_DT_SPEC_GET(DT_ALIAS(led0), gpios); static const uint8_t hid_report_desc[] = HID_MOUSE_REPORT_DESC(2); -static enum usb_dc_status_code usb_status; #define MOUSE_BTN_LEFT 0 #define MOUSE_BTN_RIGHT 1 @@ -38,22 +36,7 @@ enum mouse_report_idx { }; K_MSGQ_DEFINE(mouse_msgq, MOUSE_REPORT_COUNT, 2, 1); -static K_SEM_DEFINE(ep_write_sem, 0, 1); - -static inline void status_cb(enum usb_dc_status_code status, const uint8_t *param) -{ - usb_status = status; -} - -static ALWAYS_INLINE void rwup_if_suspended(void) -{ - if (IS_ENABLED(CONFIG_USB_DEVICE_REMOTE_WAKEUP)) { - if (usb_status == USB_DC_SUSPEND) { - usb_wakeup_request(); - return; - } - } -} +static bool mouse_ready; static void input_cb(struct input_event *evt, void *user_data) { @@ -63,11 +46,9 @@ static void input_cb(struct input_event *evt, void *user_data) switch (evt->code) { case INPUT_KEY_0: - rwup_if_suspended(); WRITE_BIT(tmp[MOUSE_BTN_REPORT_IDX], MOUSE_BTN_LEFT, evt->value); break; case INPUT_KEY_1: - rwup_if_suspended(); WRITE_BIT(tmp[MOUSE_BTN_REPORT_IDX], MOUSE_BTN_RIGHT, evt->value); break; case INPUT_KEY_2: @@ -99,42 +80,30 @@ static void input_cb(struct input_event *evt, void *user_data) INPUT_CALLBACK_DEFINE(NULL, input_cb, NULL); -#if defined(CONFIG_USB_DEVICE_STACK_NEXT) -static int enable_usb_device_next(void) +static void mouse_iface_ready(const struct device *dev, const bool ready) { - struct usbd_context *sample_usbd; - int err; - - sample_usbd = sample_usbd_init_device(NULL); - if (sample_usbd == NULL) { - LOG_ERR("Failed to initialize USB device"); - return -ENODEV; - } - - err = usbd_enable(sample_usbd); - if (err) { - LOG_ERR("Failed to enable device support"); - return err; - } - - LOG_DBG("USB device support enabled"); - - return 0; + LOG_INF("HID device %s interface is %s", + dev->name, ready ? "ready" : "not ready"); + mouse_ready = ready; } -#endif /* defined(CONFIG_USB_DEVICE_STACK_NEXT) */ -static void int_in_ready_cb(const struct device *dev) +static int mouse_get_report(const struct device *dev, + const uint8_t type, const uint8_t id, const uint16_t len, + uint8_t *const buf) { - ARG_UNUSED(dev); - k_sem_give(&ep_write_sem); + LOG_WRN("Get Report not implemented, Type %u ID %u", type, id); + + return 0; } -static const struct hid_ops ops = { - .int_in_ready = int_in_ready_cb, +struct hid_device_ops mouse_ops = { + .iface_ready = mouse_iface_ready, + .get_report = mouse_get_report, }; int main(void) { + struct usbd_context *sample_usbd; const struct device *hid_dev; int ret; @@ -143,51 +112,58 @@ int main(void) return 0; } -#if defined(CONFIG_USB_DEVICE_STACK_NEXT) - hid_dev = DEVICE_DT_GET_ONE(zephyr_hid_device); -#else - hid_dev = device_get_binding("HID_0"); -#endif - if (hid_dev == NULL) { - LOG_ERR("Cannot get USB HID Device"); - return 0; - } - ret = gpio_pin_configure_dt(&led0, GPIO_OUTPUT); - if (ret < 0) { + if (ret != 0) { LOG_ERR("Failed to configure the LED pin, error: %d", ret); return 0; } - usb_hid_register_device(hid_dev, - hid_report_desc, sizeof(hid_report_desc), - &ops); + hid_dev = DEVICE_DT_GET_ONE(zephyr_hid_device); + if (!device_is_ready(hid_dev)) { + LOG_ERR("HID Device is not ready"); + return -EIO; + } - usb_hid_init(hid_dev); + ret = hid_device_register(hid_dev, + hid_report_desc, sizeof(hid_report_desc), + &mouse_ops); + if (ret != 0) { + LOG_ERR("Failed to register HID Device, %d", ret); + return ret; + } -#if defined(CONFIG_USB_DEVICE_STACK_NEXT) - ret = enable_usb_device_next(); -#else - ret = usb_enable(status_cb); -#endif + sample_usbd = sample_usbd_init_device(NULL); + if (sample_usbd == NULL) { + LOG_ERR("Failed to initialize USB device"); + return -ENODEV; + } + + ret = usbd_enable(sample_usbd); if (ret != 0) { - LOG_ERR("Failed to enable USB"); - return 0; + LOG_ERR("Failed to enable device support"); + return ret; } + LOG_DBG("USB device support enabled"); + while (true) { UDC_STATIC_BUF_DEFINE(report, MOUSE_REPORT_COUNT); k_msgq_get(&mouse_msgq, &report, K_FOREVER); - ret = hid_int_ep_write(hid_dev, report, MOUSE_REPORT_COUNT, NULL); + if (!mouse_ready) { + LOG_INF("USB HID device is not ready"); + continue; + } + + ret = hid_device_submit_report(hid_dev, MOUSE_REPORT_COUNT, report); if (ret) { - LOG_ERR("HID write error, %d", ret); + LOG_ERR("HID submit report error, %d", ret); } else { - k_sem_take(&ep_write_sem, K_FOREVER); /* Toggle LED on sent report */ (void)gpio_pin_toggle(led0.port, led0.pin); } } + return 0; } diff --git a/samples/subsys/usb/hid-mouse/usbd_next_prj.conf b/samples/subsys/usb/hid-mouse/usbd_next_prj.conf deleted file mode 100644 index 9c8894b2126c..000000000000 --- a/samples/subsys/usb/hid-mouse/usbd_next_prj.conf +++ /dev/null @@ -1,11 +0,0 @@ -CONFIG_USB_DEVICE_STACK_NEXT=y -CONFIG_USBD_HID_SUPPORT=y - -CONFIG_LOG=y -CONFIG_USBD_LOG_LEVEL_WRN=y -CONFIG_USBD_HID_LOG_LEVEL_WRN=y -CONFIG_UDC_DRIVER_LOG_LEVEL_WRN=y -CONFIG_SAMPLE_USBD_PID=0x0007 - -CONFIG_GPIO=y -CONFIG_INPUT=y diff --git a/samples/subsys/usb/legacy/hid-mouse/CMakeLists.txt b/samples/subsys/usb/legacy/hid-mouse/CMakeLists.txt new file mode 100644 index 000000000000..d2217c00a472 --- /dev/null +++ b/samples/subsys/usb/legacy/hid-mouse/CMakeLists.txt @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(hid-mouse) + +include(${ZEPHYR_BASE}/samples/subsys/usb/common/common.cmake) +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/subsys/usb/legacy/hid-mouse/README.rst b/samples/subsys/usb/legacy/hid-mouse/README.rst new file mode 100644 index 000000000000..aa82e23804a1 --- /dev/null +++ b/samples/subsys/usb/legacy/hid-mouse/README.rst @@ -0,0 +1,114 @@ +.. zephyr:code-sample:: legacy-usb-hid-mouse + :name: Legacy USB HID mouse + :relevant-api: _usb_device_core_api usb_hid_device_api input_interface + + Implement a basic HID mouse device. + +Overview +******** + +This sample app demonstrates use of a USB Human Interface Device (HID) driver +by the Zephyr project. This very simple driver enumerates a board with a button +into a mouse that has a left mouse button and optionally (depending on +the number of buttons on the board) a right mouse button, X-axis movement, +and Y-axis movement. +If the USB peripheral driver supports remote wakeup feature, wakeup request +will be performed on every button click if the bus is in suspended state. +This sample can be found under :zephyr_file:`samples/subsys/usb/legacy/hid-mouse` in the +Zephyr project tree. + +.. note:: + This samples demonstrate deprecated :ref:`usb_device_stack`. + +Requirements +************ + +This project requires an USB device driver and uses the :ref:`input` API. +There must be a :dtcompatible:`gpio-keys` group of buttons or keys defined at +the board level that can generate input events, otherwise the example will build +but not work as expected. + +The key mapping in the sample is as follows: + +- ``INPUT_KEY_0``: left button +- ``INPUT_KEY_1``: right button +- ``INPUT_KEY_2``: move the mouse along the x-axis +- ``INPUT_KEY_3``: move the mouse along the y-axis + +An LED must also be configured via the ``led0`` devicetree alias. You may also +see this error if you try to build this sample for an unsupported board: + +.. code-block:: none + + Unsupported board: led0 devicetree alias is not defined + +Building and Running +******************** + +This sample can be built for multiple boards, in this example we will build it +for the nucleo_f070rb board: + +.. zephyr-app-commands:: + :zephyr-app: samples/subsys/usb/legacy/hid-mouse + :board: nucleo_f070rb + :goals: build + :compact: + +After you have built and flashed the sample app image to your board, plug the +board into a host device, for example, a PC running Linux. +The board will be detected as shown by the Linux dmesg command: + +.. code-block:: console + + dmesg | tail -10 + usb 2-2: new full-speed USB device number 2 using at91_ohci + usb 2-2: New USB device found, idVendor=2fe3, idProduct=0007, bcdDevice= 2.03 + usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3 + usb 2-2: Product: Zephyr HID mouse sample + usb 2-2: Manufacturer: ZEPHYR + usb 2-2: SerialNumber: 86FE679A598AC47A + input: ZEPHYR Zephyr HID mouse sample as /devices/soc0/ahb/600000.ohci/usb2/2-2/2-2:1.0/0003:2FE3:0100.0001/input/input0 + hid-generic 0003:2FE3:0100.0001: input: USB HID v1.10 Mouse [ZEPHYR Zephyr HID mouse sample] on usb-at91-2/input0 + +You can also monitor mouse events by using the standard Linux ``evtest`` command +(see the `Ubuntu evtest man page`_ for more information about this tool): + +.. _Ubuntu evtest man page: + http://manpages.ubuntu.com/manpages/trusty/man1/evtest.1.html + +.. code-block:: console + + sudo evtest /dev/input/event0 + Input driver version is 1.0.1 + Input device ID: bus 0x3 vendor 0x2fe3 product 0x7 version 0x110 + Input device name: "ZEPHYR Zephyr HID mouse sample" + Supported events: + Event type 0 (EV_SYN) + Event type 1 (EV_KEY) + Event code 272 (BTN_LEFT) + Event code 273 (BTN_RIGHT) + Event code 274 (BTN_MIDDLE) + Event type 2 (EV_REL) + Event code 0 (REL_X) + Event code 1 (REL_Y) + Event code 8 (REL_WHEEL) + Event type 4 (EV_MSC) + Event code 4 (MSC_SCAN) + Properties: + Testing ... (interrupt to exit) + +When you press the button on your board, it will act as if the left +mouse button was pressed, and this information will be displayed +by ``evtest``: + +.. code-block:: console + + Event: time 1167609663.618515, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90001 + Event: time 1167609663.618515, type 1 (EV_KEY), code 272 (BTN_LEFT), value 1 + Event: time 1167609663.618515, -------------- SYN_REPORT ------------ + Event: time 1167609663.730510, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90001 + Event: time 1167609663.730510, type 1 (EV_KEY), code 272 (BTN_LEFT), value 0 + Event: time 1167609663.730510, -------------- SYN_REPORT ------------ + +If your board has more than one button, they will act as right mouse button, +X-axis movement, and Y-axis movement. diff --git a/samples/subsys/usb/legacy/hid-mouse/prj.conf b/samples/subsys/usb/legacy/hid-mouse/prj.conf new file mode 100644 index 000000000000..b797a7382e81 --- /dev/null +++ b/samples/subsys/usb/legacy/hid-mouse/prj.conf @@ -0,0 +1,13 @@ +CONFIG_USB_DEVICE_STACK=y +CONFIG_USB_DEVICE_HID=y +CONFIG_USB_DEVICE_PRODUCT="Zephyr HID mouse sample" +CONFIG_USB_DEVICE_PID=0x0007 +CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=n + +CONFIG_LOG=y +CONFIG_USB_DRIVER_LOG_LEVEL_ERR=y +CONFIG_USB_DEVICE_LOG_LEVEL_ERR=y + +CONFIG_GPIO=y +CONFIG_INPUT=y +CONFIG_INPUT_MODE_SYNCHRONOUS=y diff --git a/samples/subsys/usb/legacy/hid-mouse/sample.yaml b/samples/subsys/usb/legacy/hid-mouse/sample.yaml new file mode 100644 index 000000000000..4dc2da907988 --- /dev/null +++ b/samples/subsys/usb/legacy/hid-mouse/sample.yaml @@ -0,0 +1,15 @@ +sample: + name: USB HID mouse sample +common: + harness: button + filter: dt_alias_exists("sw0") and dt_alias_exists("led0") + depends_on: + - gpio +tests: + sample.usb.legacy.hid-mouse: + depends_on: + - usb_device + build_only: true + platform_exclude: + - frdm_mcxn947/mcxn947/cpu0 + tags: usb diff --git a/samples/subsys/usb/legacy/hid-mouse/src/main.c b/samples/subsys/usb/legacy/hid-mouse/src/main.c new file mode 100644 index 000000000000..e668ce64758a --- /dev/null +++ b/samples/subsys/usb/legacy/hid-mouse/src/main.c @@ -0,0 +1,158 @@ +/* + * Copyright (c) 2018 qianfan Zhao + * Copyright (c) 2018, 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include +LOG_MODULE_REGISTER(main, LOG_LEVEL_INF); + +static const struct gpio_dt_spec led0 = GPIO_DT_SPEC_GET(DT_ALIAS(led0), gpios); +static const uint8_t hid_report_desc[] = HID_MOUSE_REPORT_DESC(2); +static enum usb_dc_status_code usb_status; + +#define MOUSE_BTN_LEFT 0 +#define MOUSE_BTN_RIGHT 1 + +enum mouse_report_idx { + MOUSE_BTN_REPORT_IDX = 0, + MOUSE_X_REPORT_IDX = 1, + MOUSE_Y_REPORT_IDX = 2, + MOUSE_WHEEL_REPORT_IDX = 3, + MOUSE_REPORT_COUNT = 4, +}; + +K_MSGQ_DEFINE(mouse_msgq, MOUSE_REPORT_COUNT, 2, 1); +static K_SEM_DEFINE(ep_write_sem, 0, 1); + +static inline void status_cb(enum usb_dc_status_code status, const uint8_t *param) +{ + usb_status = status; +} + +static ALWAYS_INLINE void rwup_if_suspended(void) +{ + if (IS_ENABLED(CONFIG_USB_DEVICE_REMOTE_WAKEUP)) { + if (usb_status == USB_DC_SUSPEND) { + usb_wakeup_request(); + return; + } + } +} + +static void input_cb(struct input_event *evt, void *user_data) +{ + static uint8_t tmp[MOUSE_REPORT_COUNT]; + + ARG_UNUSED(user_data); + + switch (evt->code) { + case INPUT_KEY_0: + rwup_if_suspended(); + WRITE_BIT(tmp[MOUSE_BTN_REPORT_IDX], MOUSE_BTN_LEFT, evt->value); + break; + case INPUT_KEY_1: + rwup_if_suspended(); + WRITE_BIT(tmp[MOUSE_BTN_REPORT_IDX], MOUSE_BTN_RIGHT, evt->value); + break; + case INPUT_KEY_2: + if (evt->value) { + tmp[MOUSE_X_REPORT_IDX] += 10U; + } + + break; + case INPUT_KEY_3: + if (evt->value) { + tmp[MOUSE_Y_REPORT_IDX] += 10U; + } + + break; + default: + LOG_INF("Unrecognized input code %u value %d", + evt->code, evt->value); + return; + } + + if (k_msgq_put(&mouse_msgq, tmp, K_NO_WAIT) != 0) { + LOG_ERR("Failed to put new input event"); + } + + tmp[MOUSE_X_REPORT_IDX] = 0U; + tmp[MOUSE_Y_REPORT_IDX] = 0U; + +} + +INPUT_CALLBACK_DEFINE(NULL, input_cb, NULL); + +static void int_in_ready_cb(const struct device *dev) +{ + ARG_UNUSED(dev); + k_sem_give(&ep_write_sem); +} + +static const struct hid_ops ops = { + .int_in_ready = int_in_ready_cb, +}; + +int main(void) +{ + const struct device *hid_dev; + int ret; + + if (!gpio_is_ready_dt(&led0)) { + LOG_ERR("LED device %s is not ready", led0.port->name); + return 0; + } + + hid_dev = device_get_binding("HID_0"); + if (hid_dev == NULL) { + LOG_ERR("Cannot get USB HID Device"); + return 0; + } + + ret = gpio_pin_configure_dt(&led0, GPIO_OUTPUT); + if (ret < 0) { + LOG_ERR("Failed to configure the LED pin, error: %d", ret); + return 0; + } + + usb_hid_register_device(hid_dev, + hid_report_desc, sizeof(hid_report_desc), + &ops); + + usb_hid_init(hid_dev); + + ret = usb_enable(status_cb); + if (ret != 0) { + LOG_ERR("Failed to enable USB"); + return 0; + } + + while (true) { + uint8_t __aligned(sizeof(void *)) report[MOUSE_REPORT_COUNT]; + + k_msgq_get(&mouse_msgq, &report, K_FOREVER); + + ret = hid_int_ep_write(hid_dev, report, MOUSE_REPORT_COUNT, NULL); + if (ret) { + LOG_ERR("HID write error, %d", ret); + } else { + k_sem_take(&ep_write_sem, K_FOREVER); + /* Toggle LED on sent report */ + (void)gpio_pin_toggle(led0.port, led0.pin); + } + } + return 0; +} From 758c8491095e71ff20ffe5c3b3b5dc6bc5a48410 Mon Sep 17 00:00:00 2001 From: John Lin Date: Mon, 9 Jun 2025 11:29:05 -0700 Subject: [PATCH 0703/2141] [nrf fromtree] samples: subsys: usb: mass: Include rpi_pico.overlay Include rpi_pico.overlay from the rpi_pico_rp2040_w.overlay in order to have `pico/rp2040/w` board to work out of the box. Signed-off-by: John Lin (cherry picked from commit 0fe7cbd0dbaf95221b27dad420a7dfff11dccef0) --- samples/subsys/usb/mass/boards/rpi_pico_rp2040_w.overlay | 1 + 1 file changed, 1 insertion(+) create mode 100644 samples/subsys/usb/mass/boards/rpi_pico_rp2040_w.overlay diff --git a/samples/subsys/usb/mass/boards/rpi_pico_rp2040_w.overlay b/samples/subsys/usb/mass/boards/rpi_pico_rp2040_w.overlay new file mode 100644 index 000000000000..759ce77a4f83 --- /dev/null +++ b/samples/subsys/usb/mass/boards/rpi_pico_rp2040_w.overlay @@ -0,0 +1 @@ +#include "rpi_pico.overlay" From 928f44c8941d281cb934f7db038e6592cca73411 Mon Sep 17 00:00:00 2001 From: Johann Fischer Date: Tue, 5 Nov 2024 15:12:58 +0100 Subject: [PATCH 0704/2141] [nrf fromtree] samples: usb: move the legacy code out of the USB MSC sample Move the legacy code from the USB MSC sample to a separate sample in the legacy directory. Make legacy sample very simple and drop all filesystem dependencies. Signed-off-by: Johann Fischer (cherry picked from commit 375e8e6ccb287707586ebb1fc58ab1c90c11b369) --- samples/subsys/usb/legacy/mass/CMakeLists.txt | 9 ++ samples/subsys/usb/legacy/mass/README.rst | 32 +++++ samples/subsys/usb/legacy/mass/app.overlay | 14 +++ samples/subsys/usb/legacy/mass/prj.conf | 14 +++ samples/subsys/usb/legacy/mass/sample.yaml | 10 ++ samples/subsys/usb/legacy/mass/src/main.c | 27 +++++ samples/subsys/usb/mass/README.rst | 2 +- samples/subsys/usb/mass/prj.conf | 21 ++-- samples/subsys/usb/mass/sample.yaml | 112 ++++-------------- samples/subsys/usb/mass/src/main.c | 46 +++---- samples/subsys/usb/mass/usbd_next_prj.conf | 15 --- 11 files changed, 153 insertions(+), 149 deletions(-) create mode 100644 samples/subsys/usb/legacy/mass/CMakeLists.txt create mode 100644 samples/subsys/usb/legacy/mass/README.rst create mode 100644 samples/subsys/usb/legacy/mass/app.overlay create mode 100644 samples/subsys/usb/legacy/mass/prj.conf create mode 100644 samples/subsys/usb/legacy/mass/sample.yaml create mode 100644 samples/subsys/usb/legacy/mass/src/main.c delete mode 100644 samples/subsys/usb/mass/usbd_next_prj.conf diff --git a/samples/subsys/usb/legacy/mass/CMakeLists.txt b/samples/subsys/usb/legacy/mass/CMakeLists.txt new file mode 100644 index 000000000000..f80c6eb9afa6 --- /dev/null +++ b/samples/subsys/usb/legacy/mass/CMakeLists.txt @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(mass) + +include(${ZEPHYR_BASE}/samples/subsys/usb/common/common.cmake) +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/subsys/usb/legacy/mass/README.rst b/samples/subsys/usb/legacy/mass/README.rst new file mode 100644 index 000000000000..8e3ae5319df6 --- /dev/null +++ b/samples/subsys/usb/legacy/mass/README.rst @@ -0,0 +1,32 @@ +.. zephyr:code-sample:: legacy-usb-mass + :name: Legacy USB Mass Storage + :relevant-api: _usb_device_core_api + + Expose board's RAM as a USB disk using USB Mass Storage driver. + +Overview +******** + +This sample app demonstrates use of a USB Mass Storage driver by the Zephyr +project. This very simple driver enumerates a board with RAM disk into an USB +disk. This sample can be found under +:zephyr_file:`samples/subsys/usb/legacy/mass` in the Zephyr project tree. + +.. note:: + This samples demonstrate deprecated :ref:`usb_device_stack`. + +Requirements +************ + +This project requires a USB device driver, and either 96KiB of RAM or a FLASH device. + +Building and Running +******************** + +The configurations selects RAM-based disk without any file system. + +.. zephyr-app-commands:: + :zephyr-app: samples/subsys/usb/legacy/mass + :board: reel_board + :goals: build + :compact: diff --git a/samples/subsys/usb/legacy/mass/app.overlay b/samples/subsys/usb/legacy/mass/app.overlay new file mode 100644 index 000000000000..ff09a0f8ca73 --- /dev/null +++ b/samples/subsys/usb/legacy/mass/app.overlay @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + ramdisk0 { + compatible = "zephyr,ram-disk"; + disk-name = "RAM"; + sector-size = <512>; + sector-count = <192>; + }; +}; diff --git a/samples/subsys/usb/legacy/mass/prj.conf b/samples/subsys/usb/legacy/mass/prj.conf new file mode 100644 index 000000000000..0954afcd0eec --- /dev/null +++ b/samples/subsys/usb/legacy/mass/prj.conf @@ -0,0 +1,14 @@ +CONFIG_STDOUT_CONSOLE=y + +#USB related configs +CONFIG_USB_DEVICE_STACK=y +CONFIG_USB_DEVICE_PRODUCT="Zephyr MSC sample" +CONFIG_USB_DEVICE_PID=0x0008 +CONFIG_LOG=y +CONFIG_USB_DRIVER_LOG_LEVEL_ERR=y +CONFIG_USB_MASS_STORAGE=y +CONFIG_USB_DEVICE_LOG_LEVEL_ERR=y +CONFIG_USB_MASS_STORAGE_LOG_LEVEL_ERR=y +CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=n + +CONFIG_MAIN_STACK_SIZE=1536 diff --git a/samples/subsys/usb/legacy/mass/sample.yaml b/samples/subsys/usb/legacy/mass/sample.yaml new file mode 100644 index 000000000000..f4d1bb2f96d9 --- /dev/null +++ b/samples/subsys/usb/legacy/mass/sample.yaml @@ -0,0 +1,10 @@ +sample: + name: Mass Storage +tests: + sample.usb.legacy.mass_ram_none: + min_ram: 128 + depends_on: usb_device + build_only: true + arch_exclude: posix + tags: + - usb diff --git a/samples/subsys/usb/legacy/mass/src/main.c b/samples/subsys/usb/legacy/mass/src/main.c new file mode 100644 index 000000000000..52dfa00294ef --- /dev/null +++ b/samples/subsys/usb/legacy/mass/src/main.c @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2016 Intel Corporation. + * Copyright (c) 2019-2020 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include + +#include +LOG_MODULE_REGISTER(main, LOG_LEVEL_INF); + +int main(void) +{ + int ret; + + ret = usb_enable(NULL); + if (ret != 0) { + LOG_ERR("Failed to enable USB"); + return 0; + } + + LOG_INF("The device is put in USB mass storage mode"); + + return 0; +} diff --git a/samples/subsys/usb/mass/README.rst b/samples/subsys/usb/mass/README.rst index b68f57497b20..910c34e7c1ec 100644 --- a/samples/subsys/usb/mass/README.rst +++ b/samples/subsys/usb/mass/README.rst @@ -1,6 +1,6 @@ .. zephyr:code-sample:: usb-mass :name: USB Mass Storage - :relevant-api: usbd_api usbd_msc_device _usb_device_core_api file_system_api + :relevant-api: usbd_api usbd_msc_device file_system_api Expose board's RAM or FLASH as a USB disk using USB Mass Storage driver. diff --git a/samples/subsys/usb/mass/prj.conf b/samples/subsys/usb/mass/prj.conf index 0954afcd0eec..dd9d784070de 100644 --- a/samples/subsys/usb/mass/prj.conf +++ b/samples/subsys/usb/mass/prj.conf @@ -1,14 +1,15 @@ +CONFIG_USB_DEVICE_STACK_NEXT=y + CONFIG_STDOUT_CONSOLE=y +CONFIG_SERIAL=y +CONFIG_UART_LINE_CTRL=y +CONFIG_USBD_MSC_CLASS=y +CONFIG_USBD_MSC_LUNS_PER_INSTANCE=3 -#USB related configs -CONFIG_USB_DEVICE_STACK=y -CONFIG_USB_DEVICE_PRODUCT="Zephyr MSC sample" -CONFIG_USB_DEVICE_PID=0x0008 CONFIG_LOG=y -CONFIG_USB_DRIVER_LOG_LEVEL_ERR=y -CONFIG_USB_MASS_STORAGE=y -CONFIG_USB_DEVICE_LOG_LEVEL_ERR=y -CONFIG_USB_MASS_STORAGE_LOG_LEVEL_ERR=y -CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=n +CONFIG_USBD_LOG_LEVEL_WRN=y +CONFIG_UDC_DRIVER_LOG_LEVEL_WRN=y -CONFIG_MAIN_STACK_SIZE=1536 +CONFIG_SAMPLE_USBD_PID=0x0008 +CONFIG_SAMPLE_USBD_PRODUCT="USBD MSC sample" +CONFIG_MAIN_STACK_SIZE=2048 diff --git a/samples/subsys/usb/mass/sample.yaml b/samples/subsys/usb/mass/sample.yaml index 4dbf2126798b..9f3a169be609 100644 --- a/samples/subsys/usb/mass/sample.yaml +++ b/samples/subsys/usb/mass/sample.yaml @@ -1,25 +1,7 @@ sample: name: Mass Storage tests: - sample.usb.mass_ram_none: - min_ram: 128 - depends_on: usb_device - arch_exclude: posix - extra_args: - - EXTRA_DTC_OVERLAY_FILE="ramdisk.overlay" - extra_configs: - - CONFIG_LOG_DEFAULT_LEVEL=3 - tags: - - msd - - usb - harness: console - harness_config: - type: multi_line - ordered: true - regex: - - "No file system selected" - - "The device is put in USB mass storage mode." - sample.usb_device_next.mass_ram_none: + sample.usbd.mass_ram_none: min_ram: 128 depends_on: usbd integration_platforms: @@ -32,12 +14,8 @@ tests: - mimxrt1060_evk/mimxrt1062/qspi - max32690evkit/max32690/m4 extra_args: - - CONF_FILE="usbd_next_prj.conf" - EXTRA_DTC_OVERLAY_FILE="ramdisk.overlay" - extra_configs: - - CONFIG_LOG_DEFAULT_LEVEL=3 tags: - - msd - usb harness: console harness_config: @@ -45,43 +23,23 @@ tests: ordered: true regex: - "No file system selected" - - "The device is put in USB mass storage mode." - sample.usb.mass_ram_fat: + - "The device is put in USB mass storage mode" + sample.usbd.mass_ram_fat: min_ram: 128 - depends_on: usb_device - arch_exclude: posix + depends_on: usbd + integration_platforms: + - nrf52840dk/nrf52840 + - nrf54h20dk/nrf54h20/cpuapp + - frdm_k64f + - stm32f723e_disco + - nucleo_f413zh + - mimxrt685_evk/mimxrt685s/cm33 + - mimxrt1060_evk/mimxrt1062/qspi extra_args: - EXTRA_DTC_OVERLAY_FILE="ramdisk.overlay" extra_configs: - - CONFIG_LOG_DEFAULT_LEVEL=3 - CONFIG_APP_MSC_STORAGE_RAM=y tags: - - msd - - usb - harness: console - harness_config: - type: multi_line - ordered: true - regex: - - "End of files" - - "The device is put in USB mass storage mode." - sample.usb.mass_flash_fatfs: - min_ram: 32 - modules: - - fatfs - depends_on: usb_device - filter: dt_compat_enabled("nordic,qspi-nor") - platform_allow: - - nrf52840dk/nrf52840 - - nrf5340dk/nrf5340/cpuapp - - adafruit_feather_nrf52840/nrf52840/sense - integration_platforms: - - nrf52840dk/nrf52840 - extra_configs: - - CONFIG_LOG_DEFAULT_LEVEL=3 - - CONFIG_APP_MSC_STORAGE_FLASH_FATFS=y - tags: - - msd - usb harness: console harness_config: @@ -89,8 +47,8 @@ tests: ordered: true regex: - "End of files" - - "The device is put in USB mass storage mode." - sample.usb_device_next.mass_flash_fatfs: + - "The device is put in USB mass storage mode" + sample.usbd.mass_flash_fatfs: min_ram: 32 modules: - fatfs @@ -102,43 +60,18 @@ tests: - adafruit_feather_nrf52840/nrf52840/sense integration_platforms: - nrf52840dk/nrf52840 - extra_args: CONF_FILE="usbd_next_prj.conf" extra_configs: - - CONFIG_LOG_DEFAULT_LEVEL=3 - CONFIG_APP_MSC_STORAGE_FLASH_FATFS=y tags: - - msd - - usb - harness: console - harness_config: - type: multi_line - ordered: true - regex: - - "End of files" - - "The device is put in USB mass storage mode." - sample.usb.mass_sdhc_fatfs: - min_ram: 32 - filter: dt_compat_enabled("zephyr,sdmmc-disk") - modules: - - fatfs - depends_on: - - usb_device - - sdhc - extra_configs: - - CONFIG_LOG_DEFAULT_LEVEL=3 - - CONFIG_APP_MSC_STORAGE_SDCARD=y - tags: - - msd - usb harness: console harness_config: - fixture: fixture_sdcard type: multi_line ordered: true regex: - "End of files" - - "The device is put in USB mass storage mode." - sample.usb_device_next.mass_sdhc_fatfs: + - "The device is put in USB mass storage mode" + sample.usbd.mass_sdhc_fatfs: min_ram: 32 filter: dt_compat_enabled("zephyr,sdmmc-disk") modules: @@ -147,11 +80,8 @@ tests: - usbd - sdhc extra_configs: - - CONFIG_LOG_DEFAULT_LEVEL=3 - CONFIG_APP_MSC_STORAGE_SDCARD=y - extra_args: CONF_FILE="usbd_next_prj.conf" tags: - - msd - usb harness: console harness_config: @@ -160,12 +90,12 @@ tests: ordered: true regex: - "End of files" - - "The device is put in USB mass storage mode." - sample.usb.mass_flash_littlefs: + - "The device is put in USB mass storage mode" + sample.usbd.mass_flash_littlefs: modules: - littlefs min_ram: 32 - depends_on: usb_device + depends_on: usbd filter: dt_compat_enabled("nordic,qspi-nor") platform_allow: - nrf52840dk/nrf52840 @@ -174,10 +104,8 @@ tests: integration_platforms: - nrf52840dk/nrf52840 extra_configs: - - CONFIG_LOG_DEFAULT_LEVEL=3 - CONFIG_APP_MSC_STORAGE_FLASH_LITTLEFS=y tags: - - msd - usb harness: console harness_config: @@ -185,4 +113,4 @@ tests: ordered: true regex: - "End of files" - - "The device is put in USB mass storage mode." + - "The device is put in USB mass storage mode" diff --git a/samples/subsys/usb/mass/src/main.c b/samples/subsys/usb/mass/src/main.c index df90560d8353..59a770a51545 100644 --- a/samples/subsys/usb/mass/src/main.c +++ b/samples/subsys/usb/mass/src/main.c @@ -9,13 +9,12 @@ #include #include -#include #include #include #include #include -LOG_MODULE_REGISTER(main); +LOG_MODULE_REGISTER(main, LOG_LEVEL_INF); #if CONFIG_DISK_DRIVER_FLASH #include @@ -41,7 +40,6 @@ FS_LITTLEFS_DECLARE_DEFAULT_CONFIG(storage); static struct fs_mount_t fs_mnt; -#if defined(CONFIG_USB_DEVICE_STACK_NEXT) static struct usbd_context *sample_usbd; #if CONFIG_DISK_DRIVER_RAM @@ -56,28 +54,6 @@ USBD_DEFINE_MSC_LUN(nand, "NAND", "Zephyr", "FlashDisk", "0.00"); USBD_DEFINE_MSC_LUN(sd, "SD", "Zephyr", "SD", "0.00"); #endif -static int enable_usb_device_next(void) -{ - int err; - - sample_usbd = sample_usbd_init_device(NULL); - if (sample_usbd == NULL) { - LOG_ERR("Failed to initialize USB device"); - return -ENODEV; - } - - err = usbd_enable(sample_usbd); - if (err) { - LOG_ERR("Failed to enable device support"); - return err; - } - - LOG_DBG("USB device support enabled"); - - return 0; -} -#endif /* defined(CONFIG_USB_DEVICE_STACK_NEXT) */ - static int setup_flash(struct fs_mount_t *mnt) { int rc = 0; @@ -215,16 +191,24 @@ int main(void) setup_disk(); -#if defined(CONFIG_USB_DEVICE_STACK_NEXT) - ret = enable_usb_device_next(); -#else - ret = usb_enable(NULL); -#endif + sample_usbd = sample_usbd_init_device(NULL); + if (sample_usbd == NULL) { + LOG_ERR("Failed to initialize USB device"); + return -ENODEV; + } + + ret = usbd_enable(sample_usbd); + if (ret) { + LOG_ERR("Failed to enable device support"); + return ret; + } + if (ret != 0) { LOG_ERR("Failed to enable USB"); return 0; } - LOG_INF("The device is put in USB mass storage mode.\n"); + LOG_INF("The device is put in USB mass storage mode"); + return 0; } diff --git a/samples/subsys/usb/mass/usbd_next_prj.conf b/samples/subsys/usb/mass/usbd_next_prj.conf deleted file mode 100644 index dd9d784070de..000000000000 --- a/samples/subsys/usb/mass/usbd_next_prj.conf +++ /dev/null @@ -1,15 +0,0 @@ -CONFIG_USB_DEVICE_STACK_NEXT=y - -CONFIG_STDOUT_CONSOLE=y -CONFIG_SERIAL=y -CONFIG_UART_LINE_CTRL=y -CONFIG_USBD_MSC_CLASS=y -CONFIG_USBD_MSC_LUNS_PER_INSTANCE=3 - -CONFIG_LOG=y -CONFIG_USBD_LOG_LEVEL_WRN=y -CONFIG_UDC_DRIVER_LOG_LEVEL_WRN=y - -CONFIG_SAMPLE_USBD_PID=0x0008 -CONFIG_SAMPLE_USBD_PRODUCT="USBD MSC sample" -CONFIG_MAIN_STACK_SIZE=2048 From 8cd3b935a445e21c0eafa76f438472460aaf706f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Tue, 26 Aug 2025 15:02:07 +0200 Subject: [PATCH 0705/2141] [nrf fromtree] boards: nordic: nrf54lm20dk: Add usbd to supported features MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add 'usbd' to the list of features supported by nrf54lm20dk. Signed-off-by: Sebastian Głąb (cherry picked from commit b50b5b4f4ea1495b7eb8a56559349a1439659082) --- boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp.yaml b/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp.yaml index 765845fa27f0..e5a2b89087de 100644 --- a/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp.yaml +++ b/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp.yaml @@ -20,4 +20,5 @@ supported: - i2s - pwm - spi + - usbd - watchdog From c1bf4336ce6d3a1bf6007c06c9ed8142183e16d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Mon, 7 Jul 2025 10:32:26 +0200 Subject: [PATCH 0706/2141] [nrf fromtree] samples: subsys: usb: hid-keyboard: Confirm operation with console MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use console logs to determine if sample operates correctly. Signed-off-by: Sebastian Głąb (cherry picked from commit e0fcfa1be9e0806635826af4ca79da416cb474a1) --- samples/subsys/usb/hid-keyboard/sample.yaml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/samples/subsys/usb/hid-keyboard/sample.yaml b/samples/subsys/usb/hid-keyboard/sample.yaml index 6161ff90c2cf..f53ae514f97c 100644 --- a/samples/subsys/usb/hid-keyboard/sample.yaml +++ b/samples/subsys/usb/hid-keyboard/sample.yaml @@ -1,11 +1,17 @@ sample: name: USB HID keyboard sample common: - harness: button filter: dt_alias_exists("sw0") and dt_alias_exists("led0") depends_on: - usbd - gpio + tags: usb + timeout: 15 + harness: console + harness_config: + type: one_line + regex: + - "HID keyboard sample is initialized" integration_platforms: - nrf52840dk/nrf52840 - nrf54h20dk/nrf54h20/cpuapp @@ -17,17 +23,13 @@ common: - samd21_xpro - same54_xpro tests: - sample.usbd.hid-keyboard: - tags: usb + sample.usbd.hid-keyboard: {} sample.usbd.hid-keyboard.out-report: - tags: usb extra_args: - EXTRA_DTC_OVERLAY_FILE="out_report.overlay" sample.usbd.hid-keyboard.large-report: - tags: usb extra_args: - EXTRA_DTC_OVERLAY_FILE="large_in_report.overlay" sample.usbd.hid-keyboard.large-out-report: - tags: usb extra_args: - EXTRA_DTC_OVERLAY_FILE="large_out_report.overlay" From 78df52b6c28124714620ed8904a302232f20be7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fin=20Maa=C3=9F?= Date: Wed, 18 Jun 2025 11:13:17 +0200 Subject: [PATCH 0707/2141] [nrf fromtree] dts: treewide: fix missing use of underscores MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit in #83352 a few bindings were not migrated, fix that, as it will lead to ci fails. Signed-off-by: Fin Maaß (cherry picked from commit 4a468e93cd6f5310996fcb1956ea889bf0f78470) --- boards/nxp/lpcxpresso55s28/lpcxpresso55s28.dts | 2 +- boards/nxp/lpcxpresso55s69/lpcxpresso55s69_lpc55s69_cpu0.dts | 2 +- boards/nxp/mimxrt1050_evk/mimxrt1050_evk.dtsi | 4 ++-- boards/nxp/mimxrt1060_evk/mimxrt1060_evk.dtsi | 4 ++-- dts/arm/silabs/siwg917.dtsi | 2 +- dts/bindings/display/solomon,ssd1309fb-spi.yaml | 2 +- dts/bindings/led/ti,lp50xx.yaml | 2 +- dts/bindings/pwm/silabs,siwx91x-pwm.yaml | 4 ++-- dts/bindings/usb/nxp,uhc-ehci.yaml | 2 +- dts/bindings/usb/nxp,uhc-ip3516hs.yaml | 2 +- dts/bindings/watchdog/nxp,ewm.yaml | 4 ++-- tests/drivers/pwm/pwm_api/boards/siwx917_rb4338a.overlay | 2 +- 12 files changed, 16 insertions(+), 16 deletions(-) diff --git a/boards/nxp/lpcxpresso55s28/lpcxpresso55s28.dts b/boards/nxp/lpcxpresso55s28/lpcxpresso55s28.dts index d9d46ed50ed1..7b6fa3e1fc3a 100644 --- a/boards/nxp/lpcxpresso55s28/lpcxpresso55s28.dts +++ b/boards/nxp/lpcxpresso55s28/lpcxpresso55s28.dts @@ -138,7 +138,7 @@ zephyr_uhc1: &usbhhs { pinctrl-0 = <&pinmux_usbhhs>; pinctrl-names = "default"; status = "okay"; - phy_handle = <&usbphy1>; + phy-handle = <&usbphy1>; }; &usbphy1 { diff --git a/boards/nxp/lpcxpresso55s69/lpcxpresso55s69_lpc55s69_cpu0.dts b/boards/nxp/lpcxpresso55s69/lpcxpresso55s69_lpc55s69_cpu0.dts index 44caca0d3270..5049eec3f5f5 100644 --- a/boards/nxp/lpcxpresso55s69/lpcxpresso55s69_lpc55s69_cpu0.dts +++ b/boards/nxp/lpcxpresso55s69/lpcxpresso55s69_lpc55s69_cpu0.dts @@ -165,7 +165,7 @@ zephyr_uhc1: &usbhhs { pinctrl-0 = <&pinmux_usbhhs>; pinctrl-names = "default"; status = "okay"; - phy_handle = <&usbphy1>; + phy-handle = <&usbphy1>; }; &usbphy1 { diff --git a/boards/nxp/mimxrt1050_evk/mimxrt1050_evk.dtsi b/boards/nxp/mimxrt1050_evk/mimxrt1050_evk.dtsi index 0886b2ac912b..15731d8bdcd5 100644 --- a/boards/nxp/mimxrt1050_evk/mimxrt1050_evk.dtsi +++ b/boards/nxp/mimxrt1050_evk/mimxrt1050_evk.dtsi @@ -213,12 +213,12 @@ zephyr_udc0: &usb1 { zephyr_uhc0: &usbh1 { status = "okay"; - phy_handle = <&usbphy1>; + phy-handle = <&usbphy1>; }; zephyr_uhc1: &usbh2 { status = "okay"; - phy_handle = <&usbphy2>; + phy-handle = <&usbphy2>; }; &usbphy1 { diff --git a/boards/nxp/mimxrt1060_evk/mimxrt1060_evk.dtsi b/boards/nxp/mimxrt1060_evk/mimxrt1060_evk.dtsi index 4143a7b6430f..c81d10ea18ad 100644 --- a/boards/nxp/mimxrt1060_evk/mimxrt1060_evk.dtsi +++ b/boards/nxp/mimxrt1060_evk/mimxrt1060_evk.dtsi @@ -190,12 +190,12 @@ zephyr_udc0: &usb1 { zephyr_uhc0: &usbh1 { status = "okay"; - phy_handle = <&usbphy1>; + phy-handle = <&usbphy1>; }; zephyr_uhc1: &usbh2 { status = "okay"; - phy_handle = <&usbphy2>; + phy-handle = <&usbphy2>; }; &usbphy1 { diff --git a/dts/arm/silabs/siwg917.dtsi b/dts/arm/silabs/siwg917.dtsi index b1404f475b2d..c1b9c2ad995f 100644 --- a/dts/arm/silabs/siwg917.dtsi +++ b/dts/arm/silabs/siwg917.dtsi @@ -307,7 +307,7 @@ interrupt-names = "pwm"; clocks = <&clock0 SIWX91X_CLK_PWM>; #pwm-cells = <2>; - silabs,ch_prescaler = <64 64 64 64>; + silabs,ch-prescaler = <64 64 64 64>; status = "disabled"; }; diff --git a/dts/bindings/display/solomon,ssd1309fb-spi.yaml b/dts/bindings/display/solomon,ssd1309fb-spi.yaml index 4a24a35d7cdc..5d58bc732fd2 100644 --- a/dts/bindings/display/solomon,ssd1309fb-spi.yaml +++ b/dts/bindings/display/solomon,ssd1309fb-spi.yaml @@ -8,7 +8,7 @@ compatible: "solomon,ssd1309fb" include: ["solomon,ssd1306fb-common.yaml", "spi-device.yaml"] properties: - data_cmd-gpios: + data-cmd-gpios: type: phandle-array required: true description: D/C# pin. diff --git a/dts/bindings/led/ti,lp50xx.yaml b/dts/bindings/led/ti,lp50xx.yaml index 91511dbd3039..1906d8f34170 100644 --- a/dts/bindings/led/ti,lp50xx.yaml +++ b/dts/bindings/led/ti,lp50xx.yaml @@ -12,7 +12,7 @@ properties: type: boolean description: | If enabled the maximum current output is set to 35 mA (25.5 mA else). - log_scale_en: + log-scale-en: type: boolean description: | If enabled a logarithmic dimming scale curve is used for LED brightness diff --git a/dts/bindings/pwm/silabs,siwx91x-pwm.yaml b/dts/bindings/pwm/silabs,siwx91x-pwm.yaml index b8a01f2027b8..daec68e9ed72 100644 --- a/dts/bindings/pwm/silabs,siwx91x-pwm.yaml +++ b/dts/bindings/pwm/silabs,siwx91x-pwm.yaml @@ -12,7 +12,7 @@ properties: "#pwm-cells": const: 2 - silabs,ch_prescaler: + silabs,ch-prescaler: type: array required: true description: | @@ -26,7 +26,7 @@ properties: - 32 - 64 - silabs,pwm_polarity: + silabs,pwm-polarity: type: int required: true description: | diff --git a/dts/bindings/usb/nxp,uhc-ehci.yaml b/dts/bindings/usb/nxp,uhc-ehci.yaml index 5f8657fe7227..919625da151c 100644 --- a/dts/bindings/usb/nxp,uhc-ehci.yaml +++ b/dts/bindings/usb/nxp,uhc-ehci.yaml @@ -8,5 +8,5 @@ compatible: "nxp,uhc-ehci" include: [usb-controller.yaml] properties: - phy_handle: + phy-handle: type: phandle diff --git a/dts/bindings/usb/nxp,uhc-ip3516hs.yaml b/dts/bindings/usb/nxp,uhc-ip3516hs.yaml index d09b5b9f056d..d9ebcae8abfc 100644 --- a/dts/bindings/usb/nxp,uhc-ip3516hs.yaml +++ b/dts/bindings/usb/nxp,uhc-ip3516hs.yaml @@ -8,5 +8,5 @@ compatible: "nxp,uhc-ip3516hs" include: [usb-controller.yaml, pinctrl-device.yaml] properties: - phy_handle: + phy-handle: type: phandle diff --git a/dts/bindings/watchdog/nxp,ewm.yaml b/dts/bindings/watchdog/nxp,ewm.yaml index 5bd1e6a36ebf..69ffdf86abcc 100644 --- a/dts/bindings/watchdog/nxp,ewm.yaml +++ b/dts/bindings/watchdog/nxp,ewm.yaml @@ -19,13 +19,13 @@ properties: description: Watchdog clock divider required: true - input_trigger_en: + input-trigger-en: type: boolean description: | When enabled the ewm_in signal can be used to assert the ewm. - input_trigger_active_high: + input-trigger-active-high: type: boolean description: | When enabled the ewm_in signal is active high. diff --git a/tests/drivers/pwm/pwm_api/boards/siwx917_rb4338a.overlay b/tests/drivers/pwm/pwm_api/boards/siwx917_rb4338a.overlay index 91125d52963f..02f1c9da28de 100644 --- a/tests/drivers/pwm/pwm_api/boards/siwx917_rb4338a.overlay +++ b/tests/drivers/pwm/pwm_api/boards/siwx917_rb4338a.overlay @@ -26,6 +26,6 @@ pwm_channel1: pwm_channel1 { pwms = <&pwm 0 1000000>; }; - silabs,pwm_polarity = ; + silabs,pwm-polarity = ; status = "okay"; }; From f4f709d6ba80666656e87fb2428d23bac9cc3698 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20St=C4=99pnicki?= Date: Thu, 26 Jun 2025 12:43:55 +0200 Subject: [PATCH 0708/2141] [nrf fromtree] drivers: clock control: ironside dvfs hsfll MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Extended clock control driver to support new DVFS service from IronSide secure domain. Added new compatible nrf-iron-hsfll-local which can be used to enable new DVFS service support in local domain. Signed-off-by: Łukasz Stępnicki (cherry picked from commit a5c0ba853b3a7aa6fc3d1140c96f62a03016c314) --- drivers/clock_control/CMakeLists.txt | 1 + drivers/clock_control/Kconfig.nrf | 20 ++ .../clock_control_nrf_iron_hsfll_local.c | 244 ++++++++++++++++++ .../clock/nordic,nrf-iron-hsfll-local.yaml | 59 +++++ dts/vendor/nordic/nrf54h20.dtsi | 2 +- .../nrf_clock_control/src/main.c | 3 +- 6 files changed, 327 insertions(+), 2 deletions(-) create mode 100644 drivers/clock_control/clock_control_nrf_iron_hsfll_local.c create mode 100644 dts/bindings/clock/nordic,nrf-iron-hsfll-local.yaml diff --git a/drivers/clock_control/CMakeLists.txt b/drivers/clock_control/CMakeLists.txt index 0bf5e0075ebf..59e7e3e30260 100644 --- a/drivers/clock_control/CMakeLists.txt +++ b/drivers/clock_control/CMakeLists.txt @@ -53,6 +53,7 @@ zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF2_COMMON clock_cont zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF_FLL16M clock_control_nrf_fll16m.c) zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF54H_HFXO clock_control_nrf54h_hfxo.c) zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF_HSFLL_LOCAL clock_control_nrf_hsfll_local.c) +zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF_IRON_HSFLL_LOCAL clock_control_nrf_iron_hsfll_local.c) zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF_LFCLK clock_control_nrf_lfclk.c) zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF_AUXPLL clock_control_nrf_auxpll.c) zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_BOUFFALOLAB_BL60X clock_control_bl60x.c) diff --git a/drivers/clock_control/Kconfig.nrf b/drivers/clock_control/Kconfig.nrf index a7c1be10a126..53f03cf6bcdc 100644 --- a/drivers/clock_control/Kconfig.nrf +++ b/drivers/clock_control/Kconfig.nrf @@ -282,6 +282,26 @@ config CLOCK_CONTROL_NRF_HSFLL_LOCAL_NRFS_DVFS_TIMEOUT_MS endif # CLOCK_CONTROL_NRF_HSFLL_LOCAL +config CLOCK_CONTROL_NRF_IRON_HSFLL_LOCAL + bool "NRF IronSide HSFLL LOCAL driver support" + depends on DT_HAS_NORDIC_NRF_IRON_HSFLL_LOCAL_ENABLED + select NRF_IRONSIDE_DVFS_SERVICE + select CLOCK_CONTROL_NRF2_COMMON + default y + +if CLOCK_CONTROL_NRF_IRON_HSFLL_LOCAL + +config CLOCK_CONTROL_NRF_IRON_HSFLL_LOCAL_REQ_LOW_FREQ + bool "Local domain scale down after init" + help + Request the lowest operating point after DVFS initialization. + +config CLOCK_CONTROL_NRF_IRON_HSFLL_LOCAL_DVFS_TIMEOUT_MS + int "Timeout waiting for dvfs request to complete" + default 2000 + +endif # CLOCK_CONTROL_NRF_IRON_HSFLL_LOCAL + config CLOCK_CONTROL_NRF_LFCLK bool "NRF LFCLK driver support" depends on DT_HAS_NORDIC_NRF_LFCLK_ENABLED diff --git a/drivers/clock_control/clock_control_nrf_iron_hsfll_local.c b/drivers/clock_control/clock_control_nrf_iron_hsfll_local.c new file mode 100644 index 000000000000..ba4e2a3f6bed --- /dev/null +++ b/drivers/clock_control/clock_control_nrf_iron_hsfll_local.c @@ -0,0 +1,244 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +#define DT_DRV_COMPAT nordic_nrf_iron_hsfll_local + +#include "clock_control_nrf2_common.h" +#include +#include + +#include +LOG_MODULE_DECLARE(clock_control_nrf2, CONFIG_CLOCK_CONTROL_LOG_LEVEL); + +BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) == 1, "multiple instances not supported"); + +#ifdef CONFIG_NRF_IRONSIDE_DVFS_SERVICE +#include + +#define HSFLL_FREQ_LOW MHZ(64) +#define HSFLL_FREQ_MEDLOW MHZ(128) +#define HSFLL_FREQ_HIGH MHZ(320) + +#define IRONSIDE_DVFS_TIMEOUT K_MSEC(CONFIG_CLOCK_CONTROL_NRF_IRON_HSFLL_LOCAL_DVFS_TIMEOUT_MS) + +/* Clock options sorted from lowest to highest frequency */ +static const struct clock_options { + uint32_t frequency; + enum ironside_dvfs_oppoint setting; +} clock_options[] = { + { + .frequency = HSFLL_FREQ_LOW, + .setting = IRONSIDE_DVFS_OPP_LOW, + }, + { + .frequency = HSFLL_FREQ_MEDLOW, + .setting = IRONSIDE_DVFS_OPP_MEDLOW, + }, + { + .frequency = HSFLL_FREQ_HIGH, + .setting = IRONSIDE_DVFS_OPP_HIGH, + }, +}; + +struct hsfll_dev_data { + STRUCT_CLOCK_CONFIG(hsfll, ARRAY_SIZE(clock_options)) clk_cfg; + struct k_timer timer; +}; + +static void hsfll_update_timeout_handler(struct k_timer *timer) +{ + struct hsfll_dev_data *dev_data = CONTAINER_OF(timer, struct hsfll_dev_data, timer); + + clock_config_update_end(&dev_data->clk_cfg, -ETIMEDOUT); +} + +static void hsfll_work_handler(struct k_work *work) +{ + struct hsfll_dev_data *dev_data = CONTAINER_OF(work, struct hsfll_dev_data, clk_cfg.work); + enum ironside_dvfs_oppoint required_setting; + uint8_t to_activate_idx; + int rc; + + to_activate_idx = clock_config_update_begin(work); + required_setting = clock_options[to_activate_idx].setting; + + k_timer_start(&dev_data->timer, IRONSIDE_DVFS_TIMEOUT, K_NO_WAIT); + + /* Request the DVFS service to change the OPP point. */ + rc = ironside_dvfs_change_oppoint(required_setting); + k_timer_stop(&dev_data->timer); + clock_config_update_end(&dev_data->clk_cfg, rc); +} + +static int hsfll_resolve_spec_to_idx(const struct nrf_clock_spec *req_spec) +{ + uint32_t req_frequency; + + if (req_spec->accuracy || req_spec->precision) { + LOG_ERR("invalid specification of accuracy or precision"); + return -EINVAL; + } + + req_frequency = req_spec->frequency == NRF_CLOCK_CONTROL_FREQUENCY_MAX + ? HSFLL_FREQ_HIGH + : req_spec->frequency; + + for (int i = 0; i < ARRAY_SIZE(clock_options); ++i) { + if (req_frequency > clock_options[i].frequency) { + continue; + } + + return i; + } + + LOG_ERR("invalid frequency"); + return -EINVAL; +} + +static void hsfll_get_spec_by_idx(uint8_t idx, struct nrf_clock_spec *spec) +{ + spec->frequency = clock_options[idx].frequency; + spec->accuracy = 0; + spec->precision = 0; +} + +static struct onoff_manager *hsfll_get_mgr_by_idx(const struct device *dev, uint8_t idx) +{ + struct hsfll_dev_data *dev_data = dev->data; + + return &dev_data->clk_cfg.onoff[idx].mgr; +} + +static struct onoff_manager *hsfll_find_mgr_by_spec(const struct device *dev, + const struct nrf_clock_spec *spec) +{ + int idx; + + if (!spec) { + return hsfll_get_mgr_by_idx(dev, 0); + } + + idx = hsfll_resolve_spec_to_idx(spec); + return idx < 0 ? NULL : hsfll_get_mgr_by_idx(dev, idx); +} +#endif /* CONFIG_NRF_IRONSIDE_DVFS_SERVICE */ + +static int api_request_hsfll(const struct device *dev, const struct nrf_clock_spec *spec, + struct onoff_client *cli) +{ +#ifdef CONFIG_NRF_IRONSIDE_DVFS_SERVICE + struct onoff_manager *mgr = hsfll_find_mgr_by_spec(dev, spec); + + if (mgr) { + return clock_config_request(mgr, cli); + } + + return -EINVAL; +#else + return -ENOTSUP; +#endif +} + +static int api_release_hsfll(const struct device *dev, const struct nrf_clock_spec *spec) +{ +#ifdef CONFIG_NRF_IRONSIDE_DVFS_SERVICE + struct onoff_manager *mgr = hsfll_find_mgr_by_spec(dev, spec); + + if (mgr) { + return onoff_release(mgr); + } + + return -EINVAL; +#else + return -ENOTSUP; +#endif +} + +static int api_cancel_or_release_hsfll(const struct device *dev, const struct nrf_clock_spec *spec, + struct onoff_client *cli) +{ +#ifdef CONFIG_NRF_IRONSIDE_DVFS_SERVICE + struct onoff_manager *mgr = hsfll_find_mgr_by_spec(dev, spec); + + if (mgr) { + return onoff_cancel_or_release(mgr, cli); + } + + return -EINVAL; +#else + return -ENOTSUP; +#endif +} + +static int api_resolve_hsfll(const struct device *dev, const struct nrf_clock_spec *req_spec, + struct nrf_clock_spec *res_spec) +{ +#ifdef CONFIG_NRF_IRONSIDE_DVFS_SERVICE + int idx; + + idx = hsfll_resolve_spec_to_idx(req_spec); + if (idx < 0) { + return -EINVAL; + } + + hsfll_get_spec_by_idx(idx, res_spec); + return 0; +#else + return -ENOTSUP; +#endif +} + +static int hsfll_init(const struct device *dev) +{ +#ifdef CONFIG_NRF_IRONSIDE_DVFS_SERVICE + struct hsfll_dev_data *dev_data = dev->data; + int rc; + + rc = clock_config_init(&dev_data->clk_cfg, ARRAY_SIZE(dev_data->clk_cfg.onoff), + hsfll_work_handler); + if (rc < 0) { + return rc; + } + + k_timer_init(&dev_data->timer, hsfll_update_timeout_handler, NULL); + +#endif + + return 0; +} + +static DEVICE_API(nrf_clock_control, hsfll_drv_api) = { + .std_api = { + .on = api_nosys_on_off, + .off = api_nosys_on_off, + }, + .request = api_request_hsfll, + .release = api_release_hsfll, + .cancel_or_release = api_cancel_or_release_hsfll, + .resolve = api_resolve_hsfll, +}; + +#ifdef CONFIG_NRF_IRONSIDE_DVFS_SERVICE +static struct hsfll_dev_data hsfll_data; +#endif + +#ifdef CONFIG_CLOCK_CONTROL_NRF_IRON_HSFLL_LOCAL_REQ_LOW_FREQ +static int dvfs_low_init(void) +{ + static const k_timeout_t timeout = IRONSIDE_DVFS_TIMEOUT; + static const struct device *hsfll_dev = DEVICE_DT_GET(DT_CLOCKS_CTLR(DT_NODELABEL(cpu))); + static const struct nrf_clock_spec clk_spec = {.frequency = HSFLL_FREQ_LOW}; + + return nrf_clock_control_request_sync(hsfll_dev, &clk_spec, timeout); +} + +SYS_INIT(dvfs_low_init, APPLICATION, 0); +#endif + +DEVICE_DT_INST_DEFINE(0, hsfll_init, NULL, + COND_CODE_1(CONFIG_NRF_IRONSIDE_DVFS_SERVICE, + (&hsfll_data), + (NULL)), NULL, PRE_KERNEL_1, + CONFIG_CLOCK_CONTROL_INIT_PRIORITY, &hsfll_drv_api); diff --git a/dts/bindings/clock/nordic,nrf-iron-hsfll-local.yaml b/dts/bindings/clock/nordic,nrf-iron-hsfll-local.yaml new file mode 100644 index 000000000000..65769fb107f7 --- /dev/null +++ b/dts/bindings/clock/nordic,nrf-iron-hsfll-local.yaml @@ -0,0 +1,59 @@ +# Copyright (c) 2025 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: | + Nordic nRF local HSFLL with IronSide DVFS support + + The local HSFLL mixed-mode IP generates several clock frequencies in the range + from 64 MHz to 400 MHz (in steps of 16 MHz). + + Usage example: + + hsfll: clock@deadbeef { + compatible = "nordic,nrf-hsfll-local"; + reg = <0xdeadbeef 0x1000>; + clocks = <&fll16m>; + clock-frequency = ; + nordic,ficrs = <&ficr NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_VSUP>, + <&ficr NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_COARSE_0>, + <&ficr NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_FINE_0>; + nordic,ficr-names = "vsup", "coarse", "fine"; + }; + + Required FICR entries are for VSUP, COARSE and FINE trim values. + +compatible: "nordic,nrf-iron-hsfll-local" + +include: [base.yaml, fixed-clock.yaml, nordic-nrf-ficr-client.yaml] + +properties: + reg: + required: true + + clocks: + required: true + + clock-frequency: + enum: + - 64000000 + - 80000000 + - 96000000 + - 112000000 + - 128000000 + - 144000000 + - 160000000 + - 176000000 + - 192000000 + - 208000000 + - 224000000 + - 240000000 + - 256000000 + - 272000000 + - 288000000 + - 304000000 + - 320000000 + - 336000000 + - 352000000 + - 368000000 + - 384000000 + - 400000000 diff --git a/dts/vendor/nordic/nrf54h20.dtsi b/dts/vendor/nordic/nrf54h20.dtsi index 68884b8a5672..d06cbde97e02 100644 --- a/dts/vendor/nordic/nrf54h20.dtsi +++ b/dts/vendor/nordic/nrf54h20.dtsi @@ -268,7 +268,7 @@ ranges = <0x0 0x52000000 0x1000000>; cpuapp_hsfll: clock@d000 { - compatible = "nordic,nrf-hsfll-local"; + compatible = "nordic,nrf-iron-hsfll-local"; #clock-cells = <0>; reg = <0xd000 0x1000>; clocks = <&fll16m>; diff --git a/tests/drivers/clock_control/nrf_clock_control/src/main.c b/tests/drivers/clock_control/nrf_clock_control/src/main.c index 395e6a0fc000..83fdc98ca193 100644 --- a/tests/drivers/clock_control/nrf_clock_control/src/main.c +++ b/tests/drivers/clock_control/nrf_clock_control/src/main.c @@ -17,7 +17,8 @@ struct test_clk_context { size_t clk_specs_size; }; -#if defined(CONFIG_CLOCK_CONTROL_NRF_HSFLL_LOCAL) +#if defined(CONFIG_CLOCK_CONTROL_NRF_HSFLL_LOCAL) || \ + defined(CONFIG_CLOCK_CONTROL_NRF_IRON_HSFLL_LOCAL) const struct nrf_clock_spec test_clk_specs_hsfll[] = { { .frequency = MHZ(128), From 59e68646df7213ce3e782f781fdb872cfdc42f7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20St=C4=99pnicki?= Date: Fri, 22 Aug 2025 14:53:48 +0200 Subject: [PATCH 0709/2141] [nrf fromlist] soc: nordic: nrf54h: turn off NRFS DVFS service MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit DVFS is supported with IronSide call. NRFS DVFS will be not enabled by default. Upstream PR #: 94865 Signed-off-by: Łukasz Stępnicki --- soc/nordic/nrf54h/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/soc/nordic/nrf54h/Kconfig b/soc/nordic/nrf54h/Kconfig index 56b64f293baf..e227a2999101 100644 --- a/soc/nordic/nrf54h/Kconfig +++ b/soc/nordic/nrf54h/Kconfig @@ -28,7 +28,6 @@ config SOC_NRF54H20_CPUAPP_COMMON select HAS_SEGGER_RTT if ZEPHYR_SEGGER_MODULE select NRFS_HAS_AUDIOPLL_SERVICE select NRFS_HAS_CLOCK_SERVICE - select NRFS_HAS_DVFS_SERVICE select NRFS_HAS_GDFS_SERVICE select NRFS_HAS_GDPWR_SERVICE select NRFS_HAS_MRAM_SERVICE From 20d89eb11a79ec9ca6ee80372af2a725028765ac Mon Sep 17 00:00:00 2001 From: Jonathan Nilsen Date: Thu, 28 Aug 2025 08:26:23 +0200 Subject: [PATCH 0710/2141] [nrf noup] soc: nrf54h: work around missing power domain handling This patch should be dropped as part of the next upmerge. The upcoming release of IronSide SE no longer disables RETAIN in all GPIO instances on boot, so the application must be able to handle the hardware default state of RETAIN being enabled. The GPIO retention is properly handled by changes that are currently only upstream and will be pulled in by the next upmerge. This patch exists a workaround to be able to integrate IronSide SE before the proper solution is pulled in. Signed-off-by: Jonathan Nilsen --- soc/nordic/nrf54h/Kconfig | 5 +++++ soc/nordic/nrf54h/soc.c | 12 ++++++++++++ 2 files changed, 17 insertions(+) diff --git a/soc/nordic/nrf54h/Kconfig b/soc/nordic/nrf54h/Kconfig index e227a2999101..b117ee45ad89 100644 --- a/soc/nordic/nrf54h/Kconfig +++ b/soc/nordic/nrf54h/Kconfig @@ -95,6 +95,11 @@ config SOC_NRF54H20_CPURAD_ENABLE_CHECK_VTOR help Verify that VTOR is not 0xFFFFFFFF before booting the Radiocore. +config SOC_NRF54H20_DISABLE_ALL_GPIO_RETENTION_WORKAROUND + bool "Disable all GPIO pin retention on boot" + default y + depends on SOC_NRF54H20_CPUAPP || SOC_NRF54H20_CPURAD + config SOC_NRF54H20_CPURAD select SOC_NRF54H20_CPURAD_COMMON diff --git a/soc/nordic/nrf54h/soc.c b/soc/nordic/nrf54h/soc.c index a3f67711e455..7c3bc65768f1 100644 --- a/soc/nordic/nrf54h/soc.c +++ b/soc/nordic/nrf54h/soc.c @@ -14,6 +14,7 @@ #include #endif +#include #include #include #include @@ -173,6 +174,17 @@ void soc_early_init_hook(void) DT_PROP_OR(DT_NODELABEL(nfct), nfct_pins_as_gpios, 0)) { nrf_nfct_pad_config_enable_set(NRF_NFCT, false); } + + /* This is a workaround for not yet having upstream patches for properly handling + * pin retention. It should be removed as part of the next upmerge. + */ + if (IS_ENABLED(CONFIG_SOC_NRF54H20_DISABLE_ALL_GPIO_RETENTION_WORKAROUND)) { + NRF_GPIO_Type *gpio_regs[GPIO_COUNT] = GPIO_REG_LIST; + + for (int i = 0; i < NRFX_ARRAY_SIZE(gpio_regs); i++) { + nrf_gpio_port_retain_set(gpio_regs[i], 0); + } + } } #if defined(CONFIG_SOC_LATE_INIT_HOOK) From dc15a79bfeb842bfb503fd63017e8cb371050ddf Mon Sep 17 00:00:00 2001 From: Georgios Vasilakis Date: Tue, 19 Aug 2025 14:56:41 +0200 Subject: [PATCH 0711/2141] Revert "[nrf noup] tests: bluetooth: bt_crypto: Use TFM_PROFILE_TYPE_NOT_SET" This reverts commit 319b359ae7669cd64ba3adec65034a4a4e4a5535. This is not needed anymore since this configuration is enabled in sdk-nrf when BT_CRYPTO is enabled. Signed-off-by: Georgios Vasilakis --- .../bluetooth/bt_crypto/boards/nrf5340dk_nrf5340_cpuapp_ns.conf | 1 - 1 file changed, 1 deletion(-) delete mode 100644 tests/bluetooth/bt_crypto/boards/nrf5340dk_nrf5340_cpuapp_ns.conf diff --git a/tests/bluetooth/bt_crypto/boards/nrf5340dk_nrf5340_cpuapp_ns.conf b/tests/bluetooth/bt_crypto/boards/nrf5340dk_nrf5340_cpuapp_ns.conf deleted file mode 100644 index 516f4d9eb784..000000000000 --- a/tests/bluetooth/bt_crypto/boards/nrf5340dk_nrf5340_cpuapp_ns.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_TFM_PROFILE_TYPE_NOT_SET=y From 103b06acfc2bf2d3c1f6414e5c3448e74d477ae6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Stasiak?= Date: Fri, 29 Aug 2025 15:15:34 +0200 Subject: [PATCH 0712/2141] [nrf fromlist] tests: drivers: timer: nrf_grtc_timer: wait for coverage dump MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If test is to be run in coverage mode, wait for output to dump at the end of a failing testcase. Upstream PR #: 95162 Signed-off-by: Michał Stasiak --- tests/drivers/timer/nrf_grtc_timer/src/main.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/drivers/timer/nrf_grtc_timer/src/main.c b/tests/drivers/timer/nrf_grtc_timer/src/main.c index 9de554256b41..7e2b440a9aa1 100644 --- a/tests/drivers/timer/nrf_grtc_timer/src/main.c +++ b/tests/drivers/timer/nrf_grtc_timer/src/main.c @@ -393,6 +393,13 @@ static void grtc_stress_test(bool busy_sim_en) if (counter_dev) { counter_stop(counter_dev); } + +#ifdef CONFIG_COVERAGE + /* Wait a few seconds before exit, giving the test the + * opportunity to dump some output before coverage data gets emitted + */ + k_sleep(K_MSEC(5000)); +#endif } ZTEST(nrf_grtc_timer, test_stress) From 93c862443b731d8668d31e476c0552db5bf3095b Mon Sep 17 00:00:00 2001 From: Kapil Bhatt Date: Fri, 22 Aug 2025 06:36:18 +0000 Subject: [PATCH 0713/2141] [nrf fromtree] manifest: Update nrf_wifi revision to fix raw tx Fix TX buffer issue for raw tx. Signed-off-by: Kapil Bhatt (cherry picked from commit 028eec235ee485dc087d50a006b7e4251be3a1e3) --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 4d20267c8b48..b8e6b93699ed 100644 --- a/west.yml +++ b/west.yml @@ -328,7 +328,7 @@ manifest: revision: 40403f5f2805cca210d2a47c8717d89c4e816cda path: modules/bsim_hw_models/nrf_hw_models - name: nrf_wifi - revision: 787eea1a3c8dd13c86214e204a919e6f9bcebf91 + revision: 5fffeab6496932abb10f9dae53ed3686967aa050 path: modules/lib/nrf_wifi - name: open-amp revision: f7f4d083c7909a39d86e217376c69b416ec4faf3 From d4d69a4a781859dd8691633988b6b8816b653dc9 Mon Sep 17 00:00:00 2001 From: Ajay Parida Date: Wed, 20 Aug 2025 13:00:23 +0530 Subject: [PATCH 0714/2141] [nrf fromtree] driver: nrf_wifi: TWT setup duration Build time configuration option to set TWT setup duration. If AP does not respond to TWT setup request for this period, STA will timeout and report setup failure. Signed-off-by: Ajay Parida (cherry picked from commit 092347cdb1ede22061d6affe09ebdf91e8f37626) --- drivers/wifi/nrf_wifi/Kconfig.nrfwifi | 10 ++++++++++ drivers/wifi/nrf_wifi/src/wifi_mgmt.c | 1 + 2 files changed, 11 insertions(+) diff --git a/drivers/wifi/nrf_wifi/Kconfig.nrfwifi b/drivers/wifi/nrf_wifi/Kconfig.nrfwifi index 4b3bb0d41ca2..9b37c302872b 100644 --- a/drivers/wifi/nrf_wifi/Kconfig.nrfwifi +++ b/drivers/wifi/nrf_wifi/Kconfig.nrfwifi @@ -934,4 +934,14 @@ config NRF_WIFI_DYNAMIC_ED help This option enables support for proprietary algorithm to enhance performance in high-traffic channels. + +config NRF_WIFI_TWT_SETUP_TIMEOUT_MS + int "TWT setup timeout (ms)" + range 100 10000 + default 250 + help + Timeout duration (in milliseconds) for the TWT setup procedure. + The STA will transmit a TWT setup request every 100 milliseconds, + continuing until this timeout value is reached. If no response is + received before the timeout expires, the TWT setup is considered failed. endif # WIFI_NRF70 diff --git a/drivers/wifi/nrf_wifi/src/wifi_mgmt.c b/drivers/wifi/nrf_wifi/src/wifi_mgmt.c index e9755e80013e..e48ae31734a7 100644 --- a/drivers/wifi/nrf_wifi/src/wifi_mgmt.c +++ b/drivers/wifi/nrf_wifi/src/wifi_mgmt.c @@ -564,6 +564,7 @@ int nrf_wifi_set_twt(const struct device *dev, twt_info.dialog_token = twt_params->dialog_token; twt_info.twt_wake_ahead_duration = twt_params->setup.twt_wake_ahead_duration; + twt_info.twt_req_timeout = CONFIG_NRF_WIFI_TWT_SETUP_TIMEOUT_MS; status = nrf_wifi_sys_fmac_twt_setup(rpu_ctx_zep->rpu_ctx, vif_ctx_zep->vif_idx, From 1d73d0e3cb5ff37fd53c103bb49c1e9b92be75c5 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Tue, 2 Sep 2025 10:48:14 +0100 Subject: [PATCH 0715/2141] [nrf noup] doc: extensions: kconfig: Add SoC sysbuild Kconfigs Allows listing sysbuild Kconfigs for SoCs Signed-off-by: Jamie McCrae --- doc/_extensions/zephyr/kconfig/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/_extensions/zephyr/kconfig/__init__.py b/doc/_extensions/zephyr/kconfig/__init__.py index eb1903b18982..dfb7a567da83 100644 --- a/doc/_extensions/zephyr/kconfig/__init__.py +++ b/doc/_extensions/zephyr/kconfig/__init__.py @@ -106,6 +106,9 @@ def kconfig_load(app: Sphinx) -> tuple[kconfiglib.Kconfig, kconfiglib.Kconfig, d for folder in soc_folders: f.write('source "' + (Path(folder) / 'Kconfig.soc').as_posix() + '"\n') + if "nordic" in folder: + f.write('osource "' + (Path(folder) / 'Kconfig.sysbuild').as_posix() + '"\n') + with open(Path(td) / "soc" / "Kconfig", "w") as f: for folder in soc_folders: f.write('osource "' + (Path(folder) / 'Kconfig').as_posix() + '"\n') From a9c15a8b8d74a49a0864cb95f6a1bb41f5141599 Mon Sep 17 00:00:00 2001 From: Nikodem Kastelik Date: Wed, 13 Aug 2025 16:07:54 +0200 Subject: [PATCH 0716/2141] [nrf fromtree] soc: nordic: nrf54l: make SWO available Existing nRF54L Series SoCs support SWO. Signed-off-by: Nikodem Kastelik (cherry picked from commit 6171bdaa6eed75137fcc4ae672791c2217738f17) --- soc/nordic/nrf54l/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/soc/nordic/nrf54l/Kconfig b/soc/nordic/nrf54l/Kconfig index bc88a62efb7e..da1781414782 100644 --- a/soc/nordic/nrf54l/Kconfig +++ b/soc/nordic/nrf54l/Kconfig @@ -22,6 +22,7 @@ config SOC_NRF54L_CPUAPP_COMMON select HAS_HW_NRF_RADIO_IEEE802154 select HAS_POWEROFF select HAS_NORDIC_RAM_CTRL + select HAS_SWO config SOC_NRF54L05_CPUAPP select SOC_NRF54L_CPUAPP_COMMON From 64061358cc5d25b97af613202397dec7256f3271 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Stasiak?= Date: Fri, 5 Sep 2025 08:15:26 +0200 Subject: [PATCH 0717/2141] [nrf fromlist] tests: drivers: clock_control_api: fix Kconfig logic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Kconfig was using symbol with redundant CONFIG prefix. Upstream PR #: 95496 Signed-off-by: Michał Stasiak --- tests/drivers/clock_control/clock_control_api/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/drivers/clock_control/clock_control_api/Kconfig b/tests/drivers/clock_control/clock_control_api/Kconfig index dc1e976d824c..9315f3e337bc 100644 --- a/tests/drivers/clock_control/clock_control_api/Kconfig +++ b/tests/drivers/clock_control/clock_control_api/Kconfig @@ -3,7 +3,7 @@ config TEST_NRF_HF_STARTUP_TIME_US int "Delay required for HF clock startup." - default 3000 if CONFIG_SOC_SERIES_NRF91X + default 3000 if SOC_SERIES_NRF91X default 500 depends on SOC_FAMILY_NORDIC_NRF help From 94a6f0d75715310e3c3c808118335ba8e00818af Mon Sep 17 00:00:00 2001 From: Tomasz Chyrowicz Date: Tue, 29 Jul 2025 11:22:40 +0200 Subject: [PATCH 0718/2141] [nrf fromtree] modules: Add VID and CID Kconfigs Add a possibility to specify VID and CID for each MCUboot image and pass it to the imgtool. Signed-off-by: Tomasz Chyrowicz (cherry picked from commit 7c1a74f8677e4bb4893ae4b61e2aa098fbec4d8d) --- cmake/mcuboot.cmake | 8 ++++++++ modules/Kconfig.mcuboot | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/cmake/mcuboot.cmake b/cmake/mcuboot.cmake index 964d694983b3..6562193725d6 100644 --- a/cmake/mcuboot.cmake +++ b/cmake/mcuboot.cmake @@ -124,6 +124,14 @@ function(zephyr_mcuboot_tasks) set(imgtool_args --key "${keyfile}" ${imgtool_args}) endif() + if(CONFIG_MCUBOOT_IMGTOOL_UUID_VID) + set(imgtool_args ${imgtool_args} --vid "${CONFIG_MCUBOOT_IMGTOOL_UUID_VID_NAME}") + endif() + + if(CONFIG_MCUBOOT_IMGTOOL_UUID_CID) + set(imgtool_args ${imgtool_args} --cid "${CONFIG_MCUBOOT_IMGTOOL_UUID_CID_NAME}") + endif() + if(CONFIG_MCUBOOT_IMGTOOL_OVERWRITE_ONLY) # Use overwrite-only instead of swap upgrades. set(imgtool_args --overwrite-only --align 1 ${imgtool_args}) diff --git a/modules/Kconfig.mcuboot b/modules/Kconfig.mcuboot index d6b4465de2d4..b4d7f5173357 100644 --- a/modules/Kconfig.mcuboot +++ b/modules/Kconfig.mcuboot @@ -120,6 +120,40 @@ config MCUBOOT_IMGTOOL_OVERWRITE_ONLY If enabled, --overwrite-only option passed to imgtool to avoid adding the swap status area size when calculating overflow. +config MCUBOOT_IMGTOOL_UUID_VID + bool "Append vendor unique identifier TLV" + help + If enabled, --vid option passed to imgtool with the value set by + the MCUBOOT_IMGTOOL_UUID_VID_NAME option. + +config MCUBOOT_IMGTOOL_UUID_VID_NAME + string "Vendor UUID" + depends on MCUBOOT_IMGTOOL_UUID_VID + help + The vendor unique identifier. + The following formats are supported: + - Domain name (i.e. amce.corp) + - Raw UUID (i.e. 12345678-1234-5678-1234-567812345678) + - Raw HEX UUID (i.e. 12345678123456781234567812345678) + +config MCUBOOT_IMGTOOL_UUID_CID + bool "Append image class unique identifier TLV" + help + If enabled, --cid option passed to imgtool with the value set by + the MCUBOOT_IMGTOOL_UUID_CID_NAME option. + +config MCUBOOT_IMGTOOL_UUID_CID_NAME + string "Image class UUID" + depends on MCUBOOT_IMGTOOL_UUID_CID + help + The image class unique identifier. + The following formats are supported: + - Image class name (i.e. nRF5340_door_lock_btperipheral). + This format requires MCUBOOT_IMGTOOL_UUID_VID_NAME to be defined + as the VID UUID is used as the namespace for image class UUID. + - Raw UUID (i.e. 12345678-1234-5678-1234-567812345678) + - Raw HEX UUID (i.e. 12345678123456781234567812345678) + config MCUBOOT_EXTRA_IMGTOOL_ARGS string "Extra arguments to pass to imgtool when signing" default "" From 7b7000067d43780fd2217d3ee536d7fe0740fcec Mon Sep 17 00:00:00 2001 From: Adam Kondraciuk Date: Thu, 28 Aug 2025 17:10:52 +0200 Subject: [PATCH 0719/2141] [nrf fromtree] drivers: i2s: nrf_tdm: Allow using 8 channels TDM should have clock divider bypass enabled when calculated clock divider exceeds maximum allowed value which is `CKDIV2`. Signed-off-by: Adam Kondraciuk (cherry picked from commit 14b78981f739345e2a6687257797c977be2fb490) --- drivers/i2s/i2s_nrf_tdm.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/i2s/i2s_nrf_tdm.c b/drivers/i2s/i2s_nrf_tdm.c index c65edb2717bc..45e5b3d18049 100644 --- a/drivers/i2s/i2s_nrf_tdm.c +++ b/drivers/i2s/i2s_nrf_tdm.c @@ -30,6 +30,10 @@ LOG_MODULE_REGISTER(tdm_nrf, CONFIG_I2S_LOG_LEVEL); */ #define NRFX_TDM_STATUS_TRANSFER_STOPPED BIT(1) +/* Maximum clock divider value. Corresponds to CKDIV2. */ +#define NRFX_TDM_MAX_SCK_DIV_VALUE TDM_CONFIG_SCK_DIV_SCKDIV_Max +#define NRFX_TDM_MAX_MCK_DIV_VALUE TDM_CONFIG_MCK_DIV_DIV_Max + #define NRFX_TDM_NUM_OF_CHANNELS (TDM_CONFIG_CHANNEL_NUM_NUM_Max + 1) #define NRFX_TDM_TX_CHANNELS_MASK \ @@ -814,11 +818,11 @@ static int trigger_start(const struct device *dev) nrf_tdm_sck_configure(drv_cfg->p_reg, drv_cfg->sck_src == ACLK ? NRF_TDM_SRC_ACLK : NRF_TDM_SRC_PCLK32M, - false); + nrfx_cfg->sck_setup > NRFX_TDM_MAX_SCK_DIV_VALUE); nrf_tdm_mck_configure(drv_cfg->p_reg, drv_cfg->mck_src == ACLK ? NRF_TDM_SRC_ACLK : NRF_TDM_SRC_PCLK32M, - false); + nrfx_cfg->mck_setup > NRFX_TDM_MAX_MCK_DIV_VALUE); /* If it is required to use certain HF clock, request it to be running * first. If not, start the transfer directly. */ From 6e68865b19e49b0bc62215b4b1c7f5401422cccd Mon Sep 17 00:00:00 2001 From: Kapil Bhatt Date: Thu, 4 Sep 2025 07:17:55 +0000 Subject: [PATCH 0720/2141] [nrf fromtree] drivers: nrf_wifi: Disable VHT capabilities for softAP mode Disable VHT (Wi-Fi 5) capabilities when building with softAP support to ensure consistent Wi-Fi 4 only behavior across all channels and frequency bands. Signed-off-by: Kapil Bhatt (cherry picked from commit e7d5d7e8044bebea574e4d237ee499c99806400c) --- drivers/wifi/nrf_wifi/src/wpa_supp_if.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/wifi/nrf_wifi/src/wpa_supp_if.c b/drivers/wifi/nrf_wifi/src/wpa_supp_if.c index 21f7600ca80a..faaddd770c37 100644 --- a/drivers/wifi/nrf_wifi/src/wpa_supp_if.c +++ b/drivers/wifi/nrf_wifi/src/wpa_supp_if.c @@ -1578,6 +1578,7 @@ enum nrf_wifi_status nrf_wifi_parse_sband( band->ht_cap.wpa_supp_ampdu_factor = event->ht_cap.nrf_wifi_ampdu_factor; band->ht_cap.wpa_supp_ampdu_density = event->ht_cap.nrf_wifi_ampdu_density; +#ifndef CONFIG_WIFI_NM_WPA_SUPPLICANT_AP band->vht_cap.wpa_supp_vht_supported = event->vht_cap.nrf_wifi_vht_supported; band->vht_cap.wpa_supp_cap = event->vht_cap.nrf_wifi_cap; @@ -1585,6 +1586,7 @@ enum nrf_wifi_status nrf_wifi_parse_sband( band->vht_cap.vht_mcs.rx_highest = event->vht_cap.vht_mcs.rx_highest; band->vht_cap.vht_mcs.tx_mcs_map = event->vht_cap.vht_mcs.tx_mcs_map; band->vht_cap.vht_mcs.tx_highest = event->vht_cap.vht_mcs.tx_highest; +#endif /* !CONFIG_WIFI_NM_WPA_SUPPLICANT_AP */ band->band = event->band; From 3b39377992b19c8eddf0b4322e15a69d2f25c16e Mon Sep 17 00:00:00 2001 From: Flavio Ceolin Date: Mon, 16 Jun 2025 12:10:32 -0700 Subject: [PATCH 0721/2141] [nrf fromtree] tfm-tests: Bump tests to tfm-2.2.0 Update tests to use tfm-2.2.0. Signed-off-by: Flavio Ceolin (cherry picked from commit 1ff7d1c6388a6390f0288628f951cefa6e5d9ff1) --- submanifests/optional.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submanifests/optional.yaml b/submanifests/optional.yaml index af2d68d0ef5f..567f38b7a0e2 100644 --- a/submanifests/optional.yaml +++ b/submanifests/optional.yaml @@ -41,7 +41,7 @@ manifest: groups: - optional - name: tf-m-tests - revision: c712761dd5391bf3f38033643d28a736cae89a19 + revision: a286347e6a5dd37a9a5e960450ffc0260d63fb27 path: modules/tee/tf-m/tf-m-tests remote: upstream groups: From e3c8913c84e967527b184e0de20c6ee05c9b350d Mon Sep 17 00:00:00 2001 From: Flavio Ceolin Date: Mon, 16 Jun 2025 22:02:59 -0700 Subject: [PATCH 0722/2141] [nrf fromtree] samples: tfm_psa_test: Set TFM_PROFILE TEST_PSA_API requires TFM_PROFILE to be set to "profile_large". Signed-off-by: Flavio Ceolin (cherry picked from commit 8caef68264f22efe95dafc1b74f190b4d37f1c28) --- samples/tfm_integration/tfm_psa_test/prj.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/tfm_integration/tfm_psa_test/prj.conf b/samples/tfm_integration/tfm_psa_test/prj.conf index bab1254229da..ba515d542c8c 100644 --- a/samples/tfm_integration/tfm_psa_test/prj.conf +++ b/samples/tfm_integration/tfm_psa_test/prj.conf @@ -5,7 +5,7 @@ # CONFIG_BUILD_WITH_TFM=y -CONFIG_TFM_PROFILE_TYPE_NOT_SET=y +CONFIG_TFM_PROFILE_TYPE_LARGE=y CONFIG_TFM_USE_NS_APP=y CONFIG_QEMU_ICOUNT_SHIFT=1 From 82dae59317f083e90a3323a09ea567e0bd1be37f Mon Sep 17 00:00:00 2001 From: Georgios Vasilakis Date: Mon, 7 Jul 2025 14:24:25 +0200 Subject: [PATCH 0723/2141] [nrf fromtree] samples: tfm: tfm_psa_test: Add temporary isolation workaround Add a workaround which sets the isolation level to 2 in CMake. The TF-M tests require the large TF-M profile because it supports the full list of crypto algorithms needed, not because of the solation level. For the TF-M tests the isolation level is irrelevant so we set it to 2 here so that we don't exclude the platforms which don't support the isolation level 3. I communicated with a TF-M maintainer and he informed me that this workaround will be included in the TF-M 2.2 release branch later so this is a short lived workaround that can be reverted when the relevant commit from the TF-M branch is cherry-picked. Signed-off-by: Georgios Vasilakis (cherry picked from commit 0081207078a908324e427b98868464123b0b0f82) --- samples/tfm_integration/tfm_psa_test/CMakeLists.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/samples/tfm_integration/tfm_psa_test/CMakeLists.txt b/samples/tfm_integration/tfm_psa_test/CMakeLists.txt index 03f55dccad13..8b05afab3aa6 100644 --- a/samples/tfm_integration/tfm_psa_test/CMakeLists.txt +++ b/samples/tfm_integration/tfm_psa_test/CMakeLists.txt @@ -63,6 +63,17 @@ set_property(TARGET zephyr_property_target -DTEST_PSA_API=${TEST_PSA_API} ) +# Workaround: The TF-M tests require the large TF-M profile because it supports +# the full list of crypto algorithms needed, not because of the isolation level. +# For the TF-M tests the isolation level is irrelevant so we set it to 2 here so +# that we don't exclude the platforms which don't support the isolation level 3. +# This is a short lived workaround because the TF-M cmake logic will do this workaround +# automatically in the future. +set_property(TARGET zephyr_property_target + APPEND PROPERTY TFM_CMAKE_OPTIONS + -DTFM_ISOLATION_LEVEL=2 +) + include(ExternalProject) ExternalProject_Add(tfm_psa_arch_test_app From 5b5eafa8b75d9e881431e5d37436eccd79fd47eb Mon Sep 17 00:00:00 2001 From: Flavio Ceolin Date: Thu, 5 Jun 2025 18:09:49 -0700 Subject: [PATCH 0724/2141] [nrf fromtree] tf-m: build: Treat warnings as errors Starting in TF-M 2.2.0 there is a build option to treat warnings as errors. Lets use it. Signed-off-by: Flavio Ceolin (cherry picked from commit ca7d99a24986c99c26c9e0d7e1ddf568eec81b76) --- modules/trusted-firmware-m/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/trusted-firmware-m/CMakeLists.txt b/modules/trusted-firmware-m/CMakeLists.txt index c76812198a32..5e066130b262 100644 --- a/modules/trusted-firmware-m/CMakeLists.txt +++ b/modules/trusted-firmware-m/CMakeLists.txt @@ -26,6 +26,11 @@ if (CONFIG_BUILD_WITH_TFM) endif() endif() + # Treat any warning as error + if (CONFIG_COMPILER_WARNINGS_AS_ERRORS) + list(APPEND TFM_CMAKE_ARGS -DCONFIG_TFM_WARNINGS_ARE_ERRORS:BOOL=ON) + endif() + if (CONFIG_TFM_SFN) list(APPEND TFM_CMAKE_ARGS -DCONFIG_TFM_SPM_BACKEND="SFN") else() # CONFIG_TFM_IPC From d9746f46a002b97126e4ff963d0df8dd9cea19c4 Mon Sep 17 00:00:00 2001 From: Michele Sardo Date: Mon, 14 Jul 2025 22:50:28 +0200 Subject: [PATCH 0725/2141] [nrf fromtree] arch: arm: cortex_m: Modifed FPU save and restore helpers z_arm_save_fp_context and z_arm_restore_fp_context save and restore fpu context regardless of the CONFIG_FPU_SHARING setting. This modification is required to support suspend to ram use cases where save and restore of FPU state is needed to ensure proper bahaviour after wakeup. Signed-off-by: Michele Sardo (cherry picked from commit 5981dc8ee16e808f0fc61814c6288f170fa56f6b) --- arch/arm/core/cortex_m/fpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/core/cortex_m/fpu.c b/arch/arm/core/cortex_m/fpu.c index b937d725c283..0b8499afd6ed 100644 --- a/arch/arm/core/cortex_m/fpu.c +++ b/arch/arm/core/cortex_m/fpu.c @@ -16,7 +16,7 @@ void z_arm_save_fp_context(struct fpu_ctx_full *buffer) { -#if defined(CONFIG_FPU_SHARING) +#if defined(CONFIG_FPU) __ASSERT_NO_MSG(buffer != NULL); uint32_t CONTROL = __get_CONTROL(); @@ -44,7 +44,7 @@ void z_arm_save_fp_context(struct fpu_ctx_full *buffer) void z_arm_restore_fp_context(const struct fpu_ctx_full *buffer) { -#if defined(CONFIG_FPU_SHARING) +#if defined(CONFIG_FPU) if (buffer->ctx_saved) { /* Set FPCA first so it is set even if an interrupt happens * during restoration. From 143520e2b5171f3ec84c6cdf6223adc72b36fcba Mon Sep 17 00:00:00 2001 From: Michele Sardo Date: Mon, 14 Jul 2025 22:54:56 +0200 Subject: [PATCH 0726/2141] [nrf fromtree] modules: trusted-firmware-m: Update in interface implementation Following changes to arch/arm/core/cortex_m/fpu.c, the dependency on CONFIG_FPU_SHARING is moved into this file. Signed-off-by: Michele Sardo (cherry picked from commit 7bc1756396724d15a4121514a4b976283d72db1d) --- modules/trusted-firmware-m/interface/interface.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/trusted-firmware-m/interface/interface.c b/modules/trusted-firmware-m/interface/interface.c index abff7efdc72f..027985b9e9b9 100644 --- a/modules/trusted-firmware-m/interface/interface.c +++ b/modules/trusted-firmware-m/interface/interface.c @@ -53,13 +53,17 @@ int32_t tfm_ns_interface_dispatch(veneer_fn fn, #endif } +#if defined(CONFIG_FPU_SHARING) struct fpu_ctx_full context_buffer; z_arm_save_fp_context(&context_buffer); +#endif result = fn(arg0, arg1, arg2, arg3); +#if defined(CONFIG_FPU_SHARING) z_arm_restore_fp_context(&context_buffer); +#endif if (!isr_mode) { #if !defined(CONFIG_ARM_NONSECURE_PREEMPTIBLE_SECURE_CALLS) From b48a1f26ef887cee5f3c20ee04c1b1db7f43f226 Mon Sep 17 00:00:00 2001 From: Tomi Fontanilles Date: Thu, 28 Aug 2025 15:12:39 +0300 Subject: [PATCH 0727/2141] [nrf fromlist] manifest: tf-m-tests: bring in fix for TF-M 2.2.0 Fixup to the TF-M 2.2.0 update. Signed-off-by: Tomi Fontanilles Upstream PR #: 94729 Signed-off-by: Tomi Fontanilles --- submanifests/optional.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submanifests/optional.yaml b/submanifests/optional.yaml index 567f38b7a0e2..8e8d7904ac59 100644 --- a/submanifests/optional.yaml +++ b/submanifests/optional.yaml @@ -41,7 +41,7 @@ manifest: groups: - optional - name: tf-m-tests - revision: a286347e6a5dd37a9a5e960450ffc0260d63fb27 + revision: a90702bcb8fadb6f70daf0ffbb13888dfe63fc99 path: modules/tee/tf-m/tf-m-tests remote: upstream groups: From 70886df2617f6620f9c38159ee36d702b78f8f1a Mon Sep 17 00:00:00 2001 From: Nikodem Kastelik Date: Fri, 22 Aug 2025 14:05:57 +0200 Subject: [PATCH 0728/2141] [nrf fromtree] manifest: update hal_nordic revision to integrate nrfx 3.14.0 New nrfx release contains MDK 8.72.2 and various fixes for nRF devices. Signed-off-by: Nikodem Kastelik (cherry picked from commit c1d28a4ea70df8dae41fc9160b27c34174ab9f1f) --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index b8e6b93699ed..17e5d7cf22d1 100644 --- a/west.yml +++ b/west.yml @@ -200,7 +200,7 @@ manifest: groups: - hal - name: hal_nordic - revision: a6579483deb33112cc763d05a4a3f8085883c1ac + revision: 54f33f10a0b826174fb145f155afa61ce5a44b93 path: modules/hal/nordic groups: - hal From e53ffc9c2a33e81597f021a5e8459dbb6cabcf72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Stasiak?= Date: Wed, 30 Jul 2025 08:10:15 +0200 Subject: [PATCH 0729/2141] [nrf fromtree] soc: nordic: nrf54l: remove redundant inclusion of GLITCHDET MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GLITCHDET is not used in this file and causes issues for devices without GLITCHDET. Signed-off-by: Michał Stasiak (cherry picked from commit a9eadb411d29edbf05fe53c15072a6d0296136e6) --- soc/nordic/nrf54l/soc.c | 1 - 1 file changed, 1 deletion(-) diff --git a/soc/nordic/nrf54l/soc.c b/soc/nordic/nrf54l/soc.c index 85043985e51f..76225d70ab74 100644 --- a/soc/nordic/nrf54l/soc.c +++ b/soc/nordic/nrf54l/soc.c @@ -29,7 +29,6 @@ LOG_MODULE_REGISTER(soc, CONFIG_SOC_LOG_LEVEL); !defined(__ZEPHYR__) #include -#include #include #include #include From 886cc3ddf15affe198ee2e0908f09068a9eaf42e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Stasiak?= Date: Wed, 13 Aug 2025 12:05:48 +0200 Subject: [PATCH 0730/2141] [nrf fromtree] drivers: adc: adc_nrfx_saadc: add nRF54LS05B analog pins MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added array of analong pins for nRF54LS05B. Signed-off-by: Michał Stasiak (cherry picked from commit 2939ccdf42b9f1467b6c4dbf6149f1ff04795f58) --- drivers/adc/adc_nrfx_saadc.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/adc/adc_nrfx_saadc.c b/drivers/adc/adc_nrfx_saadc.c index 614973261746..06035e2c3c5d 100644 --- a/drivers/adc/adc_nrfx_saadc.c +++ b/drivers/adc/adc_nrfx_saadc.c @@ -76,6 +76,13 @@ static const uint32_t saadc_psels[NRF_SAADC_AIN7 + 1] = { [NRF_SAADC_AIN6] = NRF_PIN_PORT_TO_PIN_NUMBER(11U, 1), [NRF_SAADC_AIN7] = NRF_PIN_PORT_TO_PIN_NUMBER(12U, 1), }; +#elif defined(NRF54LS05B_ENGA_XXAA) +static const uint32_t saadc_psels[NRF_SAADC_AIN3 + 1] = { + [NRF_SAADC_AIN0] = NRF_PIN_PORT_TO_PIN_NUMBER(4U, 1), + [NRF_SAADC_AIN1] = NRF_PIN_PORT_TO_PIN_NUMBER(5U, 1), + [NRF_SAADC_AIN2] = NRF_PIN_PORT_TO_PIN_NUMBER(6U, 1), + [NRF_SAADC_AIN3] = NRF_PIN_PORT_TO_PIN_NUMBER(7U, 1), +}; #endif #else From 620baa90b08d140b0852eab72affcb8197e70b19 Mon Sep 17 00:00:00 2001 From: Carles Cufi Date: Wed, 3 Sep 2025 13:41:42 +0200 Subject: [PATCH 0731/2141] [nrf fromtree] flash: spi_nor: Fix VLA error when building with clang The following error is issued by clang when building with SPI_NOR_SFDP_RUNTIME enabled: error: fields must have a constant size: 'variable length array in structure' extension will never be supported 1379 | uint32_t dw[MIN(php->len_dw, 20)]; Instead, hardcode the array length to 20 32-bit words (it's instantiated in the stack anyway). Signed-off-by: Carles Cufi (cherry picked from commit 267469b503dbcdc28959b374322a4adb4e6b436c) --- drivers/flash/spi_nor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/flash/spi_nor.c b/drivers/flash/spi_nor.c index 383a6065394b..b235c166f374 100644 --- a/drivers/flash/spi_nor.c +++ b/drivers/flash/spi_nor.c @@ -1376,7 +1376,7 @@ static int spi_nor_process_sfdp(const struct device *dev) if (id == JESD216_SFDP_PARAM_ID_BFP) { union { - uint32_t dw[MIN(php->len_dw, 20)]; + uint32_t dw[20]; struct jesd216_bfp bfp; } u_param; const struct jesd216_bfp *bfp = &u_param.bfp; From 0f36da36cf5b1bd30a2d426daa3141132352a319 Mon Sep 17 00:00:00 2001 From: Carles Cufi Date: Mon, 8 Sep 2025 14:08:35 +0200 Subject: [PATCH 0732/2141] [nrf fromtree] Revert "boards: nordic: nRF54L15DK: set HFXO clock latency to 854" This reverts commit d0a076984b1082d51db41e2d1d61d7b48c1d3019. The reason for reverting this is that the only safe startup time for 54L series is the one defined in the SoC .dtsi files (1650us), and other startup times are not reliable even when tested on a particular board. Signed-off-by: Carles Cufi (cherry picked from commit 9e52df023482739045cd2c927be24d567a368b77) --- boards/nordic/nrf54l15dk/nrf54l15dk_common.dtsi | 4 ---- 1 file changed, 4 deletions(-) diff --git a/boards/nordic/nrf54l15dk/nrf54l15dk_common.dtsi b/boards/nordic/nrf54l15dk/nrf54l15dk_common.dtsi index 6740544b524a..c030c2c55189 100644 --- a/boards/nordic/nrf54l15dk/nrf54l15dk_common.dtsi +++ b/boards/nordic/nrf54l15dk/nrf54l15dk_common.dtsi @@ -108,9 +108,5 @@ pinctrl-names = "default", "sleep"; }; -&hfxo { - startup-time-us = <854>; -}; - /* Get a node label for wi-fi spi to use in shield files */ wifi_spi: &spi22 {}; From 08ea5d1e78b749c8c31017b9ae0fe6b02fe590cd Mon Sep 17 00:00:00 2001 From: Tomasz Chyrowicz Date: Wed, 3 Sep 2025 12:30:52 +0200 Subject: [PATCH 0733/2141] [nrf fromtree] samples: Enable Direct XIP through sysbuild Enable Direct XIP with revert MCUboot mode through sysbuild configuration. Signed-off-by: Tomasz Chyrowicz (cherry picked from commit 7a54526de04decd49961de3586dfbc6914a71a33) --- samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml b/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml index aef16825a75b..c0dac45de949 100644 --- a/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml +++ b/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml @@ -100,9 +100,9 @@ tests: # transport. Transport does not affect flags so it does not really matter which is selected, # flags should affect any transport the same way. sample.mcumgr.smp_svr.mcuboot_flags.direct_xip_withrevert: - extra_args: EXTRA_CONF_FILE="overlay-serial.conf" - extra_configs: - - CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP_WITH_REVERT=y + extra_args: + - EXTRA_CONF_FILE="overlay-serial.conf" + - SB_CONFIG_MCUBOOT_MODE_DIRECT_XIP_WITH_REVERT=y platform_allow: - nrf52840dk/nrf52840 - pinnacle_100_dvk From bfbe1e06ca94859b94a2148db7a583f62dc0ac99 Mon Sep 17 00:00:00 2001 From: Bernt Johan Damslora Date: Mon, 25 Aug 2025 15:46:50 +0200 Subject: [PATCH 0734/2141] [nrf fromtree] boards: nrf9280pdk: disable IEEE 802.15.4 support nRF92 series is not supported in the IEEE 802.15.4 stack yet, so remove it from the board for now. Signed-off-by: Bernt Johan Damslora (cherry picked from commit cb1b569fc38476984adbf50364f28f7bb60817b5) --- boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts index d9ed27f49558..8920d7966bbf 100644 --- a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts +++ b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts @@ -24,7 +24,6 @@ zephyr,flash = &mram1x; zephyr,sram = &cpuapp_data; zephyr,shell-uart = &uart136; - zephyr,ieee802154 = &cpuapp_ieee802154; zephyr,bt-hci = &bt_hci_ipc0; nordic,802154-spinel-ipc = &ipc0; zephyr,entropy = &prng; @@ -291,10 +290,6 @@ ipc0: &cpuapp_cpurad_ipc { }; }; -&cpuapp_ieee802154 { - status = "okay"; -}; - zephyr_udc0: &usbhs { status = "okay"; }; From b2b59e08ca03fe41222a3c3a6cad6fe11529b9c2 Mon Sep 17 00:00:00 2001 From: Bernt Johan Damslora Date: Wed, 20 Aug 2025 17:21:05 +0200 Subject: [PATCH 0735/2141] [nrf fromtree] boards: nrf9280pdk: Add revision 0.2.0 Add revision support and overlays for rev. 0.2.0. Signed-off-by: Bernt Johan Damslora (cherry picked from commit 46e9b4a6af9a82b6d69d6db1346c675bfddc629b) --- boards/nordic/nrf9280pdk/board.yml | 7 +++ .../nrf9280pdk_nrf9280-pinctrl_0_2_0.dtsi | 53 +++++++++++++++++++ .../nrf9280pdk_nrf9280_cpuapp_0_2_0.overlay | 52 ++++++++++++++++++ .../nrf9280pdk_nrf9280_cpuppr_0_2_0.overlay | 7 +++ .../nrf9280pdk_nrf9280_cpurad_0_2_0.overlay | 7 +++ 5 files changed, 126 insertions(+) create mode 100644 boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280-pinctrl_0_2_0.dtsi create mode 100644 boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp_0_2_0.overlay create mode 100644 boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuppr_0_2_0.overlay create mode 100644 boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpurad_0_2_0.overlay diff --git a/boards/nordic/nrf9280pdk/board.yml b/boards/nordic/nrf9280pdk/board.yml index 2cce133d95c3..274b9a84a7b7 100644 --- a/boards/nordic/nrf9280pdk/board.yml +++ b/boards/nordic/nrf9280pdk/board.yml @@ -9,3 +9,10 @@ board: cpucluster: cpuppr - name: iron cpucluster: cpuapp + revision: + format: major.minor.patch + default: 0.2.0 + exact: false + revisions: + - name: 0.1.0 + - name: 0.2.0 diff --git a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280-pinctrl_0_2_0.dtsi b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280-pinctrl_0_2_0.dtsi new file mode 100644 index 000000000000..41ca41e073e4 --- /dev/null +++ b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280-pinctrl_0_2_0.dtsi @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + /omit-if-no-ref/ uart135_default: uart135_default { + group1 { + psels = , + ; + }; + + group3 { + bias-pull-up; + psels = , + ; + }; + }; + + /omit-if-no-ref/ uart135_sleep: uart135_sleep { + group1 { + low-power-enable; + psels = , + , + , + ; + }; + }; + + /omit-if-no-ref/ uart136_default: uart136_default { + group1 { + psels = , + ; + }; + + group3 { + bias-pull-up; + psels = , + ; + }; + }; + + /omit-if-no-ref/ uart136_sleep: uart136_sleep { + group1 { + low-power-enable; + psels = , + , + , + ; + }; + }; +}; diff --git a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp_0_2_0.overlay b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp_0_2_0.overlay new file mode 100644 index 000000000000..4fa3f667eadd --- /dev/null +++ b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp_0_2_0.overlay @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "nrf9280pdk_nrf9280-pinctrl_0_2_0.dtsi" + +/ { + aliases { + pwm-led0 = &pwm_led2; /* Alias for compatibility with samples that use pwm-led0 */ + }; + + leds { + compatible = "gpio-leds"; + + led0: led_0 { + gpios = <&gpio9 0 GPIO_ACTIVE_HIGH>; + label = "Green LED 0"; + }; + + led1: led_1 { + gpios = <&gpio9 1 GPIO_ACTIVE_HIGH>; + label = "Green LED 1"; + }; + + led2: led_2 { + gpios = <&gpio9 2 GPIO_ACTIVE_HIGH>; + label = "Green LED 2"; + }; + + led3: led_3 { + gpios = <&gpio9 3 GPIO_ACTIVE_HIGH>; + label = "Green LED 3"; + }; + }; + + pwmleds { + compatible = "pwm-leds"; + + /delete-node/ pwm_led_0; + + /* + * There is no valid hardware configuration to pass PWM signal on pins 0 and 1. + * First valid config is P9.2. This corresponds to LED 2. + * Signal on PWM130's channel 0 can be passed directly on GPIO Port 9 pin 2. + */ + pwm_led2: pwm_led_2 { + pwms = <&pwm130 0 PWM_MSEC(20) PWM_POLARITY_NORMAL>; + }; + }; +}; diff --git a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuppr_0_2_0.overlay b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuppr_0_2_0.overlay new file mode 100644 index 000000000000..f2d986e6cb06 --- /dev/null +++ b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuppr_0_2_0.overlay @@ -0,0 +1,7 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "nrf9280pdk_nrf9280-pinctrl_0_2_0.dtsi" diff --git a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpurad_0_2_0.overlay b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpurad_0_2_0.overlay new file mode 100644 index 000000000000..f2d986e6cb06 --- /dev/null +++ b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpurad_0_2_0.overlay @@ -0,0 +1,7 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "nrf9280pdk_nrf9280-pinctrl_0_2_0.dtsi" From 6cf3d6e11d5273e75bf69aaa9dccf61160834300 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Tue, 2 Sep 2025 13:20:29 +0100 Subject: [PATCH 0736/2141] Revert "[nrf noup] mgmt/mcumgr: Add support for SHA512 in images" This reverts commit a56cf020bdc67698c9846a79be612256d0cfc25a. Signed-off-by: Jamie McCrae --- .../include/mgmt/mcumgr/grp/img_mgmt/img_mgmt_priv.h | 8 -------- subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c | 12 ++++++------ subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt_state.c | 8 ++++---- 3 files changed, 10 insertions(+), 18 deletions(-) diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/include/mgmt/mcumgr/grp/img_mgmt/img_mgmt_priv.h b/subsys/mgmt/mcumgr/grp/img_mgmt/include/mgmt/mcumgr/grp/img_mgmt/img_mgmt_priv.h index d584467ee2bf..133a1abf054f 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/include/mgmt/mcumgr/grp/img_mgmt/img_mgmt_priv.h +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/include/mgmt/mcumgr/grp/img_mgmt/img_mgmt_priv.h @@ -18,14 +18,6 @@ extern "C" { #endif -#ifdef CONFIG_MCUBOOT_BOOTLOADER_USES_SHA512 -#define IMAGE_TLV_SHA IMAGE_TLV_SHA512 -#define IMAGE_SHA_LEN 64 -#else -#define IMAGE_TLV_SHA IMAGE_TLV_SHA256 -#define IMAGE_SHA_LEN 32 -#endif - /** * @brief Ensures the spare slot (slot 1) is fully erased. * diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c index 05e3a9c64889..b53f1b214658 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c @@ -348,7 +348,7 @@ int img_mgmt_read_info(int image_slot, struct image_version *ver, uint8_t *hash, if (tlv.it_type == 0xff && tlv.it_len == 0xffff) { return IMG_MGMT_ERR_INVALID_TLV; } - if (tlv.it_type != IMAGE_TLV_SHA || tlv.it_len != IMAGE_SHA_LEN) { + if (tlv.it_type != IMAGE_TLV_SHA256 || tlv.it_len != IMAGE_HASH_LEN) { /* Non-hash TLV. Skip it. */ data_off += sizeof(tlv) + tlv.it_len; continue; @@ -362,10 +362,10 @@ int img_mgmt_read_info(int image_slot, struct image_version *ver, uint8_t *hash, data_off += sizeof(tlv); if (hash != NULL) { - if (data_off + IMAGE_SHA_LEN > data_end) { + if (data_off + IMAGE_HASH_LEN > data_end) { return IMG_MGMT_ERR_TLV_INVALID_SIZE; } - rc = img_mgmt_read(image_slot, data_off, hash, IMAGE_SHA_LEN); + rc = img_mgmt_read(image_slot, data_off, hash, IMAGE_HASH_LEN); if (rc != 0) { return rc; } @@ -408,13 +408,13 @@ int img_mgmt_find_by_hash(uint8_t *find, struct image_version *ver) { int i; - uint8_t hash[IMAGE_SHA_LEN]; + uint8_t hash[IMAGE_HASH_LEN]; for (i = 0; i < SLOTS_PER_IMAGE * CONFIG_MCUMGR_GRP_IMG_UPDATABLE_IMAGE_NUMBER; i++) { if (img_mgmt_read_info(i, ver, hash, NULL) != 0) { continue; } - if (!memcmp(hash, find, IMAGE_SHA_LEN)) { + if (!memcmp(hash, find, IMAGE_HASH_LEN)) { return i; } } @@ -724,7 +724,7 @@ img_mgmt_upload_good_rsp(struct smp_streamer *ctxt) static int img_mgmt_upload_log(bool is_first, bool is_last, int status) { - uint8_t hash[IMAGE_SHA_LEN]; + uint8_t hash[IMAGE_HASH_LEN]; const uint8_t *hashp; int rc; diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt_state.c b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt_state.c index 4ddd741851ef..384d06137393 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt_state.c +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt_state.c @@ -434,8 +434,8 @@ static bool img_mgmt_state_encode_slot(struct smp_streamer *ctxt, uint32_t slot, zcbor_state_t *zse = ctxt->writer->zs; uint32_t flags; char vers_str[IMG_MGMT_VER_MAX_STR_LEN]; - uint8_t hash[IMAGE_SHA_LEN]; - struct zcbor_string zhash = { .value = hash, .len = IMAGE_SHA_LEN}; + uint8_t hash[IMAGE_HASH_LEN]; /* SHA256 hash */ + struct zcbor_string zhash = { .value = hash, .len = IMAGE_HASH_LEN }; struct image_version ver; bool ok; int rc = img_mgmt_read_info(slot, &ver, hash, &flags); @@ -779,14 +779,14 @@ img_mgmt_state_write(struct smp_streamer *ctxt) IMG_MGMT_ERR_INVALID_HASH); goto end; } - } else if (zhash.len != IMAGE_SHA_LEN) { + } else if (zhash.len != IMAGE_HASH_LEN) { /* The img_mgmt_find_by_hash does exact length compare * so just fail here. */ ok = smp_add_cmd_err(zse, MGMT_GROUP_ID_IMAGE, IMG_MGMT_ERR_INVALID_HASH); goto end; } else { - uint8_t hash[IMAGE_SHA_LEN]; + uint8_t hash[IMAGE_HASH_LEN]; memcpy(hash, zhash.value, zhash.len); From 1aa4426f1d2ed96807bb2f5e0b329664846ee3c3 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Tue, 2 Sep 2025 13:25:38 +0100 Subject: [PATCH 0737/2141] Revert "[nrf noup] samples/smp_svr: Increase stack size required" This reverts commit 018554da0ddaeef65fb50fa915874e60cd571631. Signed-off-by: Jamie McCrae --- samples/subsys/mgmt/mcumgr/smp_svr/prj.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/prj.conf b/samples/subsys/mgmt/mcumgr/smp_svr/prj.conf index 925ac0c93a27..06a27644bacb 100644 --- a/samples/subsys/mgmt/mcumgr/smp_svr/prj.conf +++ b/samples/subsys/mgmt/mcumgr/smp_svr/prj.conf @@ -8,7 +8,7 @@ CONFIG_FLASH_MAP=y # Some command handlers require a large stack. CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2304 -CONFIG_MAIN_STACK_SIZE=2176 +CONFIG_MAIN_STACK_SIZE=2048 # Ensure an MCUboot-compatible binary is generated. CONFIG_BOOTLOADER_MCUBOOT=y From 1bf6d60ee693a62e93c8c619cd7292996ae2e9f7 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Tue, 2 Sep 2025 13:14:21 +0100 Subject: [PATCH 0738/2141] [nrf fromlist] mgmt: mcumgr: grp: img_mgmt: Add support for SHA512 in images Adds support for images signed with SHA512. Upstream PR #: 95332 Signed-off-by: Dominik Ermel Signed-off-by: Jamie McCrae --- .../include/mgmt/mcumgr/grp/img_mgmt/img_mgmt_priv.h | 8 ++++++++ subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c | 12 ++++++------ subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt_state.c | 11 +++++++---- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/include/mgmt/mcumgr/grp/img_mgmt/img_mgmt_priv.h b/subsys/mgmt/mcumgr/grp/img_mgmt/include/mgmt/mcumgr/grp/img_mgmt/img_mgmt_priv.h index 133a1abf054f..d584467ee2bf 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/include/mgmt/mcumgr/grp/img_mgmt/img_mgmt_priv.h +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/include/mgmt/mcumgr/grp/img_mgmt/img_mgmt_priv.h @@ -18,6 +18,14 @@ extern "C" { #endif +#ifdef CONFIG_MCUBOOT_BOOTLOADER_USES_SHA512 +#define IMAGE_TLV_SHA IMAGE_TLV_SHA512 +#define IMAGE_SHA_LEN 64 +#else +#define IMAGE_TLV_SHA IMAGE_TLV_SHA256 +#define IMAGE_SHA_LEN 32 +#endif + /** * @brief Ensures the spare slot (slot 1) is fully erased. * diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c index b53f1b214658..05e3a9c64889 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c @@ -348,7 +348,7 @@ int img_mgmt_read_info(int image_slot, struct image_version *ver, uint8_t *hash, if (tlv.it_type == 0xff && tlv.it_len == 0xffff) { return IMG_MGMT_ERR_INVALID_TLV; } - if (tlv.it_type != IMAGE_TLV_SHA256 || tlv.it_len != IMAGE_HASH_LEN) { + if (tlv.it_type != IMAGE_TLV_SHA || tlv.it_len != IMAGE_SHA_LEN) { /* Non-hash TLV. Skip it. */ data_off += sizeof(tlv) + tlv.it_len; continue; @@ -362,10 +362,10 @@ int img_mgmt_read_info(int image_slot, struct image_version *ver, uint8_t *hash, data_off += sizeof(tlv); if (hash != NULL) { - if (data_off + IMAGE_HASH_LEN > data_end) { + if (data_off + IMAGE_SHA_LEN > data_end) { return IMG_MGMT_ERR_TLV_INVALID_SIZE; } - rc = img_mgmt_read(image_slot, data_off, hash, IMAGE_HASH_LEN); + rc = img_mgmt_read(image_slot, data_off, hash, IMAGE_SHA_LEN); if (rc != 0) { return rc; } @@ -408,13 +408,13 @@ int img_mgmt_find_by_hash(uint8_t *find, struct image_version *ver) { int i; - uint8_t hash[IMAGE_HASH_LEN]; + uint8_t hash[IMAGE_SHA_LEN]; for (i = 0; i < SLOTS_PER_IMAGE * CONFIG_MCUMGR_GRP_IMG_UPDATABLE_IMAGE_NUMBER; i++) { if (img_mgmt_read_info(i, ver, hash, NULL) != 0) { continue; } - if (!memcmp(hash, find, IMAGE_HASH_LEN)) { + if (!memcmp(hash, find, IMAGE_SHA_LEN)) { return i; } } @@ -724,7 +724,7 @@ img_mgmt_upload_good_rsp(struct smp_streamer *ctxt) static int img_mgmt_upload_log(bool is_first, bool is_last, int status) { - uint8_t hash[IMAGE_HASH_LEN]; + uint8_t hash[IMAGE_SHA_LEN]; const uint8_t *hashp; int rc; diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt_state.c b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt_state.c index 384d06137393..984ed7fea27c 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt_state.c +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt_state.c @@ -434,8 +434,11 @@ static bool img_mgmt_state_encode_slot(struct smp_streamer *ctxt, uint32_t slot, zcbor_state_t *zse = ctxt->writer->zs; uint32_t flags; char vers_str[IMG_MGMT_VER_MAX_STR_LEN]; - uint8_t hash[IMAGE_HASH_LEN]; /* SHA256 hash */ - struct zcbor_string zhash = { .value = hash, .len = IMAGE_HASH_LEN }; + uint8_t hash[IMAGE_SHA_LEN]; + struct zcbor_string zhash = { + .value = hash, + .len = IMAGE_SHA_LEN, + }; struct image_version ver; bool ok; int rc = img_mgmt_read_info(slot, &ver, hash, &flags); @@ -779,14 +782,14 @@ img_mgmt_state_write(struct smp_streamer *ctxt) IMG_MGMT_ERR_INVALID_HASH); goto end; } - } else if (zhash.len != IMAGE_HASH_LEN) { + } else if (zhash.len != IMAGE_SHA_LEN) { /* The img_mgmt_find_by_hash does exact length compare * so just fail here. */ ok = smp_add_cmd_err(zse, MGMT_GROUP_ID_IMAGE, IMG_MGMT_ERR_INVALID_HASH); goto end; } else { - uint8_t hash[IMAGE_HASH_LEN]; + uint8_t hash[IMAGE_SHA_LEN]; memcpy(hash, zhash.value, zhash.len); From 3143c022b78224f0edc1a7b3175caf92b8d01cca Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Tue, 2 Sep 2025 13:24:25 +0100 Subject: [PATCH 0739/2141] [nrf fromlist] samples/smp_svr: Increase stack size required Increase stack size as support for SHA512 requires more data. Upstream PR #: 95332 Signed-off-by: Dominik Ermel Signed-off-by: Jamie McCrae --- samples/subsys/mgmt/mcumgr/smp_svr/prj.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/prj.conf b/samples/subsys/mgmt/mcumgr/smp_svr/prj.conf index 06a27644bacb..925ac0c93a27 100644 --- a/samples/subsys/mgmt/mcumgr/smp_svr/prj.conf +++ b/samples/subsys/mgmt/mcumgr/smp_svr/prj.conf @@ -8,7 +8,7 @@ CONFIG_FLASH_MAP=y # Some command handlers require a large stack. CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2304 -CONFIG_MAIN_STACK_SIZE=2048 +CONFIG_MAIN_STACK_SIZE=2176 # Ensure an MCUboot-compatible binary is generated. CONFIG_BOOTLOADER_MCUBOOT=y From dd89948f6ecd89359bd9049ba0c0be730f68640a Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Tue, 2 Sep 2025 13:28:45 +0100 Subject: [PATCH 0740/2141] Revert "[nrf noup] samples: smp_svr: configuration for nrf54l15" This reverts commit 640dbac87630e705ab5633e2de6003fc3bb70d57. Signed-off-by: Jamie McCrae --- ...f54l15dk_nrf54l15_cpuapp_ext_flash.overlay | 46 ------------------- ...54l15pdk_nrf54l15_cpuapp_ext_flash.overlay | 9 ++++ .../subsys/mgmt/mcumgr/smp_svr/sample.yaml | 30 ------------ 3 files changed, 9 insertions(+), 76 deletions(-) delete mode 100644 samples/subsys/mgmt/mcumgr/smp_svr/boards/nrf54l15dk_nrf54l15_cpuapp_ext_flash.overlay create mode 100644 samples/subsys/mgmt/mcumgr/smp_svr/boards/nrf54l15pdk_nrf54l15_cpuapp_ext_flash.overlay diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/boards/nrf54l15dk_nrf54l15_cpuapp_ext_flash.overlay b/samples/subsys/mgmt/mcumgr/smp_svr/boards/nrf54l15dk_nrf54l15_cpuapp_ext_flash.overlay deleted file mode 100644 index c8040e40ffd7..000000000000 --- a/samples/subsys/mgmt/mcumgr/smp_svr/boards/nrf54l15dk_nrf54l15_cpuapp_ext_flash.overlay +++ /dev/null @@ -1,46 +0,0 @@ -/ { - chosen { - nordic,pm-ext-flash = &mx25r64; - }; -}; - -/delete-node/ &boot_partition; -/delete-node/ &slot0_partition; -/delete-node/ &slot1_partition; -/delete-node/ &storage_partition; - -&cpuapp_rram { - reg = <0x0 DT_SIZE_K(1524)>; - - partitions { - boot_partition: partition@0 { - label = "mcuboot"; - reg = <0x000000000 0x00014000>; - }; - - slot0_partition: partition@14000 { - label = "image-0"; - reg = <0x000014000 0x0015A000>; - }; - - storage_partition: partition@16E000 { - label = "storage"; - reg = < 0x16E000 0x9000 >; - }; - }; -}; - -&mx25r64 { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - slot1_partition: partition@0 { - label = "image-1"; - reg = <0x000000000 0x0015A000>; - }; - }; -}; diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/boards/nrf54l15pdk_nrf54l15_cpuapp_ext_flash.overlay b/samples/subsys/mgmt/mcumgr/smp_svr/boards/nrf54l15pdk_nrf54l15_cpuapp_ext_flash.overlay new file mode 100644 index 000000000000..410388bfa6d3 --- /dev/null +++ b/samples/subsys/mgmt/mcumgr/smp_svr/boards/nrf54l15pdk_nrf54l15_cpuapp_ext_flash.overlay @@ -0,0 +1,9 @@ +/ { + chosen { + nordic,pm-ext-flash = &mx25r64; + }; +}; + +&mx25r64 { + status = "okay"; +}; diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml b/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml index c0dac45de949..34c4f6028527 100644 --- a/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml +++ b/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml @@ -14,12 +14,9 @@ tests: - nrf52840dk/nrf52840 - pinnacle_100_dvk - mg100 - - nrf54l15dk/nrf54l15/cpuapp - - nrf54l15dk/nrf54l10/cpuapp integration_platforms: - nrf52dk/nrf52832 - nrf52840dk/nrf52840 - - nrf54l15dk/nrf54l15/cpuapp sample.mcumgr.smp_svr.bt_static_svc: harness: bluetooth tags: bluetooth @@ -173,33 +170,6 @@ tests: - mg100 integration_platforms: - nrf52840dk/nrf52840 - sample.mcumgr.smp_svr.bt.nrf54l15dk.ext_flash: - extra_args: - - OVERLAY_CONFIG="overlay-bt.conf" - - DTC_OVERLAY_FILE="boards/nrf54l15dk_nrf54l15_cpuapp_ext_flash.overlay" - - mcuboot_CONF_FILE="boards/nrf54l15dk_nrf54l15_cpuapp_ext_flash.conf" - - mcuboot_EXTRA_DTC_OVERLAY_FILE="boards/nrf54l15dk_nrf54l15_cpuapp_ext_flash.overlay" - - SB_CONFIG_PM_OVERRIDE_EXTERNAL_DRIVER_CHECK=y - - SB_CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y - platform_allow: - - nrf54l15dk/nrf54l15/cpuapp - - nrf54l15dk/nrf54l10/cpuapp - - nrf54l15dk/nrf54l05/cpuapp - integration_platforms: - - nrf54l15dk/nrf54l15/cpuapp - sample.mcumgr.smp_svr.bt.nrf54l15dk.ext_flash.pure_dts: - extra_args: - - OVERLAY_CONFIG="overlay-bt.conf" - - DTC_OVERLAY_FILE="boards/nrf54l15dk_nrf54l15_cpuapp_ext_flash.overlay" - - mcuboot_CONF_FILE="boards/nrf54l15dk_nrf54l15_cpuapp_ext_flash.conf" - - mcuboot_EXTRA_DTC_OVERLAY_FILE="boards/nrf54l15dk_nrf54l15_cpuapp_ext_flash.overlay" - - SB_CONFIG_PARTITION_MANAGER=n - platform_allow: - - nrf54l15dk/nrf54l15/cpuapp - - nrf54l15dk/nrf54l10/cpuapp - - nrf54l15dk/nrf54l05/cpuapp - integration_platforms: - - nrf54l15dk/nrf54l15/cpuapp sample.mcumgr.smp_svr.ram_load: extra_args: FILE_SUFFIX="ram_load" platform_allow: From f7a34c9e0e6ed690c4a5e2ea687194bfb499d5be Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Tue, 2 Sep 2025 13:28:53 +0100 Subject: [PATCH 0741/2141] Revert "[nrf noup] sample/**/smp_svr: nrf54l15pdk external memory dts overlay" This reverts commit 73df5dd6bcae4ee554efb1eb475a7f17d6f6b9d4. Signed-off-by: Jamie McCrae --- .../boards/nrf54l15pdk_nrf54l15_cpuapp_ext_flash.overlay | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 samples/subsys/mgmt/mcumgr/smp_svr/boards/nrf54l15pdk_nrf54l15_cpuapp_ext_flash.overlay diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/boards/nrf54l15pdk_nrf54l15_cpuapp_ext_flash.overlay b/samples/subsys/mgmt/mcumgr/smp_svr/boards/nrf54l15pdk_nrf54l15_cpuapp_ext_flash.overlay deleted file mode 100644 index 410388bfa6d3..000000000000 --- a/samples/subsys/mgmt/mcumgr/smp_svr/boards/nrf54l15pdk_nrf54l15_cpuapp_ext_flash.overlay +++ /dev/null @@ -1,9 +0,0 @@ -/ { - chosen { - nordic,pm-ext-flash = &mx25r64; - }; -}; - -&mx25r64 { - status = "okay"; -}; From cf180fe3d39cdedcc05ce6fe8e9ada09f325c730 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Tue, 2 Sep 2025 13:29:30 +0100 Subject: [PATCH 0742/2141] Revert "[nrf noup] samples: mgmt: mcumgr: smp_svr: Add nrf5340dk-optimised sample" This reverts commit d2ca24360362b22d0bce60bf1227dfd148614268. Signed-off-by: Jamie McCrae --- .../mcumgr/smp_svr/app_nrf5340_bt.overlay | 5 -- .../mcumgr/smp_svr/pm_static_nrf5340_bt.yml | 55 ------------ .../mgmt/mcumgr/smp_svr/prj_nrf5340_bt.conf | 88 ------------------- .../subsys/mgmt/mcumgr/smp_svr/sample.yaml | 8 -- .../subsys/mgmt/mcumgr/smp_svr/sysbuild.cmake | 16 ---- .../smp_svr/sysbuild/mcuboot_nrf5340_bt.conf | 1 - .../mcumgr/smp_svr/sysbuild_nrf5340_bt.conf | 8 -- 7 files changed, 181 deletions(-) delete mode 100644 samples/subsys/mgmt/mcumgr/smp_svr/app_nrf5340_bt.overlay delete mode 100644 samples/subsys/mgmt/mcumgr/smp_svr/pm_static_nrf5340_bt.yml delete mode 100644 samples/subsys/mgmt/mcumgr/smp_svr/prj_nrf5340_bt.conf delete mode 100644 samples/subsys/mgmt/mcumgr/smp_svr/sysbuild.cmake delete mode 100644 samples/subsys/mgmt/mcumgr/smp_svr/sysbuild/mcuboot_nrf5340_bt.conf delete mode 100644 samples/subsys/mgmt/mcumgr/smp_svr/sysbuild_nrf5340_bt.conf diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/app_nrf5340_bt.overlay b/samples/subsys/mgmt/mcumgr/smp_svr/app_nrf5340_bt.overlay deleted file mode 100644 index fcc2e240fd9e..000000000000 --- a/samples/subsys/mgmt/mcumgr/smp_svr/app_nrf5340_bt.overlay +++ /dev/null @@ -1,5 +0,0 @@ -/ { - chosen { - nordic,pm-ext-flash = &mx25r64; - }; -}; diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/pm_static_nrf5340_bt.yml b/samples/subsys/mgmt/mcumgr/smp_svr/pm_static_nrf5340_bt.yml deleted file mode 100644 index 7a48d51ec334..000000000000 --- a/samples/subsys/mgmt/mcumgr/smp_svr/pm_static_nrf5340_bt.yml +++ /dev/null @@ -1,55 +0,0 @@ -app: - address: 0x10200 - region: flash_primary - size: 0xdfe00 -mcuboot: - address: 0x0 - region: flash_primary - size: 0x10000 -mcuboot_pad: - address: 0x10000 - region: flash_primary - size: 0x200 -mcuboot_primary: - address: 0x10000 - orig_span: &id001 - - mcuboot_pad - - app - region: flash_primary - size: 0xe0000 - span: *id001 -mcuboot_primary_app: - address: 0x10200 - orig_span: &id002 - - app - region: flash_primary - size: 0xdfe00 - span: *id002 -settings_storage: - address: 0xf0000 - region: flash_primary - size: 0x10000 -mcuboot_primary_1: - address: 0x0 - size: 0x40000 - device: flash_ctrl - region: ram_flash -mcuboot_secondary: - address: 0x00000 - size: 0xe0000 - device: MX25R64 - region: external_flash -mcuboot_secondary_1: - address: 0xe0000 - size: 0x40000 - device: MX25R64 - region: external_flash -external_flash: - address: 0x120000 - size: 0x6e0000 - device: MX25R64 - region: external_flash -pcd_sram: - address: 0x20000000 - size: 0x2000 - region: sram_primary diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/prj_nrf5340_bt.conf b/samples/subsys/mgmt/mcumgr/smp_svr/prj_nrf5340_bt.conf deleted file mode 100644 index cb53d3e6beb6..000000000000 --- a/samples/subsys/mgmt/mcumgr/smp_svr/prj_nrf5340_bt.conf +++ /dev/null @@ -1,88 +0,0 @@ -# Enable MCUmgr and dependencies. -CONFIG_NET_BUF=y -CONFIG_ZCBOR=y -CONFIG_CRC=y -CONFIG_MCUMGR=y -CONFIG_STREAM_FLASH=y -CONFIG_FLASH_MAP=y -CONFIG_BT=y -CONFIG_BT_PERIPHERAL=y - -# Some command handlers require a large stack. -CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2304 -CONFIG_MAIN_STACK_SIZE=2176 - -# Ensure an MCUboot-compatible binary is generated. -CONFIG_BOOTLOADER_MCUBOOT=y - -# Enable flash operations. -CONFIG_FLASH=y - -# Required by the `taskstat` command. -CONFIG_THREAD_MONITOR=y - -# Support for taskstat command -CONFIG_MCUMGR_GRP_OS_TASKSTAT=y - -# Enable statistics and statistic names. -CONFIG_STATS=y -CONFIG_STATS_NAMES=y - -# Enable most core commands. -CONFIG_FLASH=y -CONFIG_IMG_MANAGER=y -CONFIG_MCUMGR_GRP_IMG=y -CONFIG_MCUMGR_GRP_OS=y -CONFIG_MCUMGR_GRP_STAT=y - -# Enable logging -CONFIG_LOG=y -CONFIG_MCUBOOT_UTIL_LOG_LEVEL_WRN=y - -# Disable debug logging -CONFIG_LOG_MAX_LEVEL=3 - -# Allow for large Bluetooth data packets. -CONFIG_BT_L2CAP_TX_MTU=498 -CONFIG_BT_BUF_ACL_RX_SIZE=502 -CONFIG_BT_BUF_ACL_TX_SIZE=502 -CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 - -# Enable the Bluetooth mcumgr transport (unauthenticated). -CONFIG_MCUMGR_TRANSPORT_BT=y -CONFIG_MCUMGR_TRANSPORT_BT_CONN_PARAM_CONTROL=y - -# Enable the Shell mcumgr transport. -CONFIG_BASE64=y -CONFIG_CRC=y -CONFIG_SHELL=y -CONFIG_SHELL_BACKEND_SERIAL=y -CONFIG_MCUMGR_TRANSPORT_SHELL=y - -# Enable the mcumgr Packet Reassembly feature over Bluetooth and its configuration dependencies. -# MCUmgr buffer size is optimized to fit one SMP packet divided into five Bluetooth Write Commands, -# transmitted with the maximum possible MTU value: 498 bytes. -CONFIG_MCUMGR_TRANSPORT_BT_REASSEMBLY=y -CONFIG_MCUMGR_TRANSPORT_NETBUF_SIZE=2475 -CONFIG_MCUMGR_GRP_OS_MCUMGR_PARAMS=y -CONFIG_MCUMGR_TRANSPORT_WORKQUEUE_STACK_SIZE=4608 - -# Enable the LittleFS file system. -CONFIG_FILE_SYSTEM=y -CONFIG_FILE_SYSTEM_LITTLEFS=y - -# Enable file system commands -CONFIG_MCUMGR_GRP_FS=y - -# Enable the storage erase command. -CONFIG_MCUMGR_GRP_ZBASIC=y -CONFIG_MCUMGR_GRP_ZBASIC_STORAGE_ERASE=y - -# Disable Bluetooth ping support -CONFIG_BT_CTLR_LE_PING=n - -# Disable shell commands that are not needed -CONFIG_CLOCK_CONTROL_NRF_SHELL=n -CONFIG_DEVICE_SHELL=n -CONFIG_DEVMEM_SHELL=n -CONFIG_FLASH_SHELL=n diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml b/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml index 34c4f6028527..4596e468207b 100644 --- a/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml +++ b/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml @@ -192,11 +192,3 @@ tests: - nrf52840dk/nrf52840 integration_platforms: - nrf52840dk/nrf52840 - sample.mcumgr.smp_svr.bt.nrf5340dk.ext_flash: - sysbuild: true - extra_args: - - FILE_SUFFIX=nrf5340_bt - platform_allow: - - nrf5340dk/nrf5340/cpuapp - integration_platforms: - - nrf5340dk/nrf5340/cpuapp diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/sysbuild.cmake b/samples/subsys/mgmt/mcumgr/smp_svr/sysbuild.cmake deleted file mode 100644 index f0a9f06df847..000000000000 --- a/samples/subsys/mgmt/mcumgr/smp_svr/sysbuild.cmake +++ /dev/null @@ -1,16 +0,0 @@ -# -# Copyright (c) 2024 Nordic Semiconductor -# -# SPDX-License-Identifier: Apache-2.0 -# - -if(FILE_SUFFIX STREQUAL "nrf5340_bt") - if(SB_CONFIG_SOC_NRF5340_CPUAPP) - # nRF5340 with Bluetooth configuration, add partition manager configuration to MCUboot image - list(APPEND mcuboot_EXTRA_DTC_OVERLAY_FILE ${CMAKE_CURRENT_LIST_DIR}/app_nrf5340_bt.overlay) - list(REMOVE_DUPLICATES mcuboot_EXTRA_DTC_OVERLAY_FILE) - set(mcuboot_EXTRA_DTC_OVERLAY_FILE ${mcuboot_EXTRA_DTC_OVERLAY_FILE} CACHE INTERNAL "" FORCE) - else() - message(FATAL_ERROR "File suffix 'nrf5340_bt' can only be used on an nRF5340 CPUAPP board target") - endif() -endif() diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/sysbuild/mcuboot_nrf5340_bt.conf b/samples/subsys/mgmt/mcumgr/smp_svr/sysbuild/mcuboot_nrf5340_bt.conf deleted file mode 100644 index 4ebbf98cf20e..000000000000 --- a/samples/subsys/mgmt/mcumgr/smp_svr/sysbuild/mcuboot_nrf5340_bt.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_BOOT_MAX_IMG_SECTORS=240 diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/sysbuild_nrf5340_bt.conf b/samples/subsys/mgmt/mcumgr/smp_svr/sysbuild_nrf5340_bt.conf deleted file mode 100644 index 16bcac179e83..000000000000 --- a/samples/subsys/mgmt/mcumgr/smp_svr/sysbuild_nrf5340_bt.conf +++ /dev/null @@ -1,8 +0,0 @@ -# Enable MCUboot bootloader support -SB_CONFIG_BOOTLOADER_MCUBOOT=y -SB_CONFIG_MCUBOOT_MODE_OVERWRITE_ONLY=y -SB_CONFIG_NETCORE_HCI_IPC=y -SB_CONFIG_SECURE_BOOT_NETCORE=y -SB_CONFIG_NETCORE_APP_UPDATE=y -SB_CONFIG_MCUBOOT_NRF53_MULTI_IMAGE_UPDATE=y -SB_CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y From f1b68e8ddc1c02c29af0513aab38f1a2ecea0454 Mon Sep 17 00:00:00 2001 From: Syver Haraldsen Date: Mon, 1 Sep 2025 09:00:17 +0200 Subject: [PATCH 0743/2141] [nrf fromtree] storage/stream_flash: Add API to query buffered data size add a wrapper function to read the number of bytes currently buffered and pending for the next flash write operation. Signed-off-by: Syver Haraldsen (cherry picked from commit 6331225c94316b88b1dc70cc4d1c13be79a34e5a) --- include/zephyr/storage/stream_flash.h | 9 +++++++++ subsys/storage/stream/stream_flash.c | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/include/zephyr/storage/stream_flash.h b/include/zephyr/storage/stream_flash.h index 5a1e096e6d10..6be67896013a 100644 --- a/include/zephyr/storage/stream_flash.h +++ b/include/zephyr/storage/stream_flash.h @@ -106,6 +106,15 @@ int stream_flash_init(struct stream_flash_ctx *ctx, const struct device *fdev, */ size_t stream_flash_bytes_written(const struct stream_flash_ctx *ctx); +/** + * @brief Read number of bytes buffered for the next flash write. + * + * @param ctx context + * + * @return Number of payload bytes buffered for the next flash write. + */ +size_t stream_flash_bytes_buffered(const struct stream_flash_ctx *ctx); + /** * @brief Process input buffers to be written to flash device in single blocks. * Will store remainder between calls. diff --git a/subsys/storage/stream/stream_flash.c b/subsys/storage/stream/stream_flash.c index 8155ef3dfe35..c611dde9dc41 100644 --- a/subsys/storage/stream/stream_flash.c +++ b/subsys/storage/stream/stream_flash.c @@ -307,6 +307,11 @@ size_t stream_flash_bytes_written(const struct stream_flash_ctx *ctx) return ctx->bytes_written; } +size_t stream_flash_bytes_buffered(const struct stream_flash_ctx *ctx) +{ + return ctx->buf_bytes; +} + #ifdef CONFIG_STREAM_FLASH_INSPECT struct _inspect_flash { size_t buf_len; From 3722a2f2a16b998bdab8a230dc943e9e6c8367c4 Mon Sep 17 00:00:00 2001 From: Syver Haraldsen Date: Mon, 1 Sep 2025 09:02:37 +0200 Subject: [PATCH 0744/2141] [nrf fromtree] storage/stream_flash: Add test for buffered data size API Add a test for the new API to query the buffered data size in the stream_flash subsystem. Signed-off-by: Syver Haraldsen (cherry picked from commit bd9dc902e180c967dfb914a3de3ae6628b76ef43) --- .../storage/stream/stream_flash/src/main.c | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/tests/subsys/storage/stream/stream_flash/src/main.c b/tests/subsys/storage/stream/stream_flash/src/main.c index b691a7e07926..944892e256f3 100644 --- a/tests/subsys/storage/stream/stream_flash/src/main.c +++ b/tests/subsys/storage/stream/stream_flash/src/main.c @@ -276,6 +276,42 @@ ZTEST(lib_stream_flash, test_stream_flash_bytes_written) VERIFY_WRITTEN(BUF_LEN, BUF_LEN); } +ZTEST(lib_stream_flash, test_stream_flash_bytes_buffered) +{ + int rc; + size_t buffered; + + init_target(); + + /* Initially no bytes should be buffered */ + buffered = stream_flash_bytes_buffered(&ctx); + zassert_equal(buffered, 0, "expected no buffered bytes"); + + /* Write partial buffer */ + rc = stream_flash_buffered_write(&ctx, write_buf, BUF_LEN - 128, false); + zassert_equal(rc, 0, "expected success"); + + /* Verify buffered bytes */ + buffered = stream_flash_bytes_buffered(&ctx); + zassert_equal(buffered, BUF_LEN - 128, "expected buffered bytes"); + + /* Write remaining buffer */ + rc = stream_flash_buffered_write(&ctx, write_buf, 128, false); + zassert_equal(rc, 0, "expected success"); + + /* After auto-flush, no bytes should be buffered */ + buffered = stream_flash_bytes_buffered(&ctx); + zassert_equal(buffered, 0, "expected no buffered bytes"); + + /* Write more than buffer size to trigger auto-flush */ + rc = stream_flash_buffered_write(&ctx, write_buf, BUF_LEN + 128, false); + zassert_equal(rc, 0, "expected success"); + + /* Verify buffered bytes */ + buffered = stream_flash_bytes_buffered(&ctx); + zassert_equal(buffered, 128, "expected remaining buffered bytes after auto-flush"); +} + ZTEST(lib_stream_flash, test_stream_flash_buf_size_greater_than_page_size) { int rc; From 72e0c1852b32b48b3c3ebc0183bf960e3f1c1cc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Mon, 1 Sep 2025 08:51:28 +0200 Subject: [PATCH 0745/2141] [nrf fromtree] tests: drivers: i2s: Add test for 8ch, 32bit, 48k TDM MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add test case where TDM is tested with 8 channels, 32 bit word size and 48k sample rate. Add Kconfig that enables test skip if the driver supports 8 channels but fails in this configuration. Signed-off-by: Sebastian Głąb (cherry picked from commit ce68b5a700c77c2e37d619b1bf08826e20b1e78f) --- tests/drivers/i2s/i2s_additional/Kconfig | 8 ++++ .../nrf54h20dk_nrf54h20_cpuapp_aclk.overlay | 16 +++++++ tests/drivers/i2s/i2s_additional/src/main.c | 43 +++++++++++++++++-- .../drivers/i2s/i2s_additional/testcase.yaml | 11 +++++ 4 files changed, 75 insertions(+), 3 deletions(-) create mode 100644 tests/drivers/i2s/i2s_additional/boards/nrf54h20dk_nrf54h20_cpuapp_aclk.overlay diff --git a/tests/drivers/i2s/i2s_additional/Kconfig b/tests/drivers/i2s/i2s_additional/Kconfig index 3c80dba48532..ee903546708b 100644 --- a/tests/drivers/i2s/i2s_additional/Kconfig +++ b/tests/drivers/i2s/i2s_additional/Kconfig @@ -75,6 +75,14 @@ config I2S_TEST_EIGHT_CHANNELS_UNSUPPORTED When set to 'y', test will check that i2s_configure() returns -EINVAL. When set to 'n', test will do the transmission. +config I2S_TEST_EIGHT_CHANNELS_32B_48K_UNSUPPORTED + bool "Skip test with 8 channels, 32 bit word size and 48k sample rate" + depends on !I2S_TEST_EIGHT_CHANNELS_UNSUPPORTED + help + Skip test that is challenging due to high data throughput. + When set to 'y', test will be skipped. + When set to 'n', test will do the transmission. + config I2S_TEST_DATA_FORMAT_I2S_UNSUPPORTED bool "I2S_FMT_DATA_FORMAT_I2S is not supported by the driver" help diff --git a/tests/drivers/i2s/i2s_additional/boards/nrf54h20dk_nrf54h20_cpuapp_aclk.overlay b/tests/drivers/i2s/i2s_additional/boards/nrf54h20dk_nrf54h20_cpuapp_aclk.overlay new file mode 100644 index 000000000000..ad9e06d0793e --- /dev/null +++ b/tests/drivers/i2s/i2s_additional/boards/nrf54h20dk_nrf54h20_cpuapp_aclk.overlay @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&audiopll { + status = "okay"; + frequency = ; +}; + +&tdm130 { + mck-frequency = <12288000>; + mck-clock-source = "ACLK"; + sck-clock-source = "ACLK"; +}; diff --git a/tests/drivers/i2s/i2s_additional/src/main.c b/tests/drivers/i2s/i2s_additional/src/main.c index e8852850cee5..0dcfc052bdf3 100644 --- a/tests/drivers/i2s/i2s_additional/src/main.c +++ b/tests/drivers/i2s/i2s_additional/src/main.c @@ -19,7 +19,7 @@ LOG_MODULE_REGISTER(i2s_add, LOG_LEVEL_INF); #define NUMBER_OF_CHANNELS 2 #define FRAME_CLK_FREQ 44100 -#define NUM_BLOCKS 20 +#define NUM_BLOCKS 4 #define TIMEOUT 1000 #define SAMPLES_COUNT 64 @@ -519,9 +519,9 @@ ZTEST(i2s_additional, test_02b_four_channels) #endif /* CONFIG_I2S_TEST_FOUR_CHANNELS_UNSUPPORTED */ } -/** @brief Test I2S transfer with eight channels. +/** @brief Test I2S transfer with eight channels, 16 bit and 44.1 kHz. */ -ZTEST(i2s_additional, test_02c_eight_channels) +ZTEST(i2s_additional, test_02c_eight_channels_default) { struct i2s_config i2s_cfg = default_i2s_cfg; @@ -549,6 +549,43 @@ ZTEST(i2s_additional, test_02c_eight_channels) #endif /* CONFIG_I2S_TEST_EIGHT_CHANNELS_UNSUPPORTED */ } +/** @brief Test I2S transfer with eight channels, 32 bit and 48 kHz. + */ +ZTEST(i2s_additional, test_02d_eight_channels_high_throughput) +{ + struct i2s_config i2s_cfg = default_i2s_cfg; + + i2s_cfg.channels = 8; + i2s_cfg.word_size = 32; + i2s_cfg.frame_clk_freq = 48000; + +#if defined(CONFIG_I2S_TEST_EIGHT_CHANNELS_UNSUPPORTED) + int ret; + + ret = i2s_configure(dev_i2s, I2S_DIR_TX, &i2s_cfg); + zassert_equal(ret, -EINVAL, "Unexpected result %d", ret); +#else /* CONFIG_I2S_TEST_EIGHT_CHANNELS_UNSUPPORTED */ + +#if defined(CONFIG_I2S_TEST_EIGHT_CHANNELS_32B_48K_UNSUPPORTED) + /* Skip this test if driver supports 8ch but fails in this configuration. */ + ztest_test_skip(); +#endif + + /* Select format that supports eight channels. */ +#if !defined(CONFIG_I2S_TEST_DATA_FORMAT_PCM_LONG_UNSUPPORTED) + i2s_cfg.format = I2S_FMT_DATA_FORMAT_PCM_LONG; + TC_PRINT("Selected format is I2S_FMT_DATA_FORMAT_PCM_LONG\n"); +#elif !defined(CONFIG_I2S_TEST_DATA_FORMAT_PCM_SHORT_UNSUPPORTED) + i2s_cfg.format = I2S_FMT_DATA_FORMAT_PCM_SHORT; + TC_PRINT("Selected format is I2S_FMT_DATA_FORMAT_PCM_SHORT\n"); +#else +#error "Don't know what format supports eight channels." +#endif + + i2s_dir_both_transfer_long(&i2s_cfg); +#endif /* CONFIG_I2S_TEST_EIGHT_CHANNELS_UNSUPPORTED */ +} + /** @brief Test I2S transfer with format I2S_FMT_DATA_FORMAT_I2S */ ZTEST(i2s_additional, test_03a_format_i2s) diff --git a/tests/drivers/i2s/i2s_additional/testcase.yaml b/tests/drivers/i2s/i2s_additional/testcase.yaml index 9dcb82d61f3f..77a18c3ab9d3 100644 --- a/tests/drivers/i2s/i2s_additional/testcase.yaml +++ b/tests/drivers/i2s/i2s_additional/testcase.yaml @@ -26,6 +26,17 @@ tests: drivers.i2s.additional.gpio_loopback.54h: harness_config: fixture: i2s_loopback + extra_configs: + - CONFIG_I2S_TEST_EIGHT_CHANNELS_32B_48K_UNSUPPORTED=y + platform_allow: + - nrf54h20dk/nrf54h20/cpuapp + integration_platforms: + - nrf54h20dk/nrf54h20/cpuapp + + drivers.i2s.additional.gpio_loopback.54h.aclk: + harness_config: + fixture: i2s_loopback + extra_args: EXTRA_DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_aclk.overlay" platform_allow: - nrf54h20dk/nrf54h20/cpuapp integration_platforms: From ac96822f2db8f5a1b4045a2f64fec445892f44c7 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Tue, 22 Apr 2025 10:23:46 -0500 Subject: [PATCH 0746/2141] [nrf fromtree] drivers: mspi: supply empty vendor specific macros for generic case Supply empty vendor specific macros for cases where vendor specific functions are not needed by driver. Signed-off-by: Daniel DeGrasse (cherry picked from commit 98c0cc4e677853e1cd22eb28cd74495fe1550f60) --- drivers/mspi/mspi_dw_vendor_specific.h | 38 ++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/drivers/mspi/mspi_dw_vendor_specific.h b/drivers/mspi/mspi_dw_vendor_specific.h index e34d8a5db60b..d32a53ac2939 100644 --- a/drivers/mspi/mspi_dw_vendor_specific.h +++ b/drivers/mspi/mspi_dw_vendor_specific.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2024 Nordic Semiconductor ASA + * Copyright (c) 2025 Tenstorrent AI ULC * * SPDX-License-Identifier: Apache-2.0 */ @@ -96,4 +97,41 @@ static inline int vendor_specific_xip_disable(const struct device *dev, } #endif /* defined(CONFIG_MSPI_XIP) */ +#else +static inline void vendor_specific_init(const struct device *dev) +{ + ARG_UNUSED(dev); +} +static inline void vendor_specific_suspend(const struct device *dev) +{ + ARG_UNUSED(dev); +} +static inline void vendor_specific_resume(const struct device *dev) +{ + ARG_UNUSED(dev); +} +static inline void vendor_specific_irq_clear(const struct device *dev) +{ + ARG_UNUSED(dev); +} +static inline int vendor_specific_xip_enable(const struct device *dev, + const struct mspi_dev_id *dev_id, + const struct mspi_xip_cfg *cfg) +{ + ARG_UNUSED(dev); + ARG_UNUSED(dev_id); + ARG_UNUSED(cfg); + + return 0; +} +static inline int vendor_specific_xip_disable(const struct device *dev, + const struct mspi_dev_id *dev_id, + const struct mspi_xip_cfg *cfg) +{ + ARG_UNUSED(dev); + ARG_UNUSED(dev_id); + ARG_UNUSED(cfg); + + return 0; +} #endif /* DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_exmif) */ From ee801a9aad329624cd700363a3db9f6f3dedb3e8 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Tue, 22 Apr 2025 10:25:07 -0500 Subject: [PATCH 0747/2141] [nrf fromtree] drivers: mspi: mspi_dw: make pinctrl include conditional The remainder of this driver functions when pin control is disabled, so make the include conditional as well to fully support this case. Signed-off-by: Daniel DeGrasse (cherry picked from commit cb31e67c491ca6241880108d10c692ddfd0d648b) --- drivers/mspi/mspi_dw.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/mspi/mspi_dw.c b/drivers/mspi/mspi_dw.c index e57511b409aa..53937f0690c1 100644 --- a/drivers/mspi/mspi_dw.c +++ b/drivers/mspi/mspi_dw.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2024 Nordic Semiconductor ASA + * Copyright (c) 2025 Tenstorrent AI ULC * * SPDX-License-Identifier: Apache-2.0 */ @@ -8,7 +9,9 @@ #include #include +#if defined(CONFIG_PINCTRL) #include +#endif #include #include #include From 9f644bb7e7ab1b4e0d061330027e128d497a0b9a Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Tue, 22 Apr 2025 10:30:19 -0500 Subject: [PATCH 0748/2141] [nrf fromtree] drivers: mspi: mspi_dw: properly support multi-level interrupts Multilevel interrupts require that the irq number be read with DT_IRQN, so update the driver to use this macro. Signed-off-by: Daniel DeGrasse (cherry picked from commit 5dbaa862825469372bb9fea1794b2e846dcc5861) --- drivers/mspi/mspi_dw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mspi/mspi_dw.c b/drivers/mspi/mspi_dw.c index 53937f0690c1..f6c8c95eb6de 100644 --- a/drivers/mspi/mspi_dw.c +++ b/drivers/mspi/mspi_dw.c @@ -1408,10 +1408,10 @@ static DEVICE_API(mspi, drv_api) = { }; #define MSPI_DW_INST_IRQ(idx, inst) \ - IRQ_CONNECT(DT_INST_IRQ_BY_IDX(inst, idx, irq), \ + IRQ_CONNECT(DT_INST_IRQN_BY_IDX(inst, idx), \ DT_INST_IRQ_BY_IDX(inst, idx, priority), \ mspi_dw_isr, DEVICE_DT_INST_GET(inst), 0); \ - irq_enable(DT_INST_IRQ_BY_IDX(inst, idx, irq)) + irq_enable(DT_INST_IRQN_BY_IDX(inst, idx)) #define MSPI_DW_MMIO_ROM_INIT(node_id) \ COND_CODE_1(DT_REG_HAS_NAME(node_id, core), \ From 17142bc74b809afdb01c0b74da72474c1573337f Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Tue, 22 Apr 2025 10:29:15 -0500 Subject: [PATCH 0749/2141] [nrf fromtree] drivers: mspi: mspi_dw: support newer IP revisions Bitmask offsets for the MSPI_DW peripheral are incorrect for the 4.03a databook for the DW APB SSI. Add a "v2" compatible to handle these changed offsets. The compatible does not define new binding properties, just modifies the register offsets. Additionally, handle writing the DFS32 mask for v2 of this compatible, as newer IP supports a dataframe size up to 32 bits. Signed-off-by: Daniel DeGrasse (cherry picked from commit 59d8fbc0a9554311e9296a3d6773e510fb35a154) --- drivers/mspi/mspi_dw.c | 9 +++++++-- drivers/mspi/mspi_dw.h | 22 ++++++++++++++++------ 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/drivers/mspi/mspi_dw.c b/drivers/mspi/mspi_dw.c index f6c8c95eb6de..d2c4376302ff 100644 --- a/drivers/mspi/mspi_dw.c +++ b/drivers/mspi/mspi_dw.c @@ -820,8 +820,9 @@ static int start_next_packet(const struct device *dev, k_timeout_t timeout) dev_data->dummy_bytes = 0; dev_data->bytes_to_discard = 0; - dev_data->ctrlr0 &= ~CTRLR0_TMOD_MASK - & ~CTRLR0_DFS_MASK; + dev_data->ctrlr0 &= ~(CTRLR0_TMOD_MASK) + & ~(CTRLR0_DFS_MASK) + & ~(CTRLR0_DFS32_MASK); dev_data->spi_ctrlr0 &= ~SPI_CTRLR0_WAIT_CYCLES_MASK; @@ -830,16 +831,20 @@ static int start_next_packet(const struct device *dev, k_timeout_t timeout) dev_data->xfer.addr_length != 0)) { dev_data->bytes_per_frame_exp = 0; dev_data->ctrlr0 |= FIELD_PREP(CTRLR0_DFS_MASK, 7); + dev_data->ctrlr0 |= FIELD_PREP(CTRLR0_DFS32_MASK, 7); } else { if ((packet->num_bytes % 4) == 0) { dev_data->bytes_per_frame_exp = 2; dev_data->ctrlr0 |= FIELD_PREP(CTRLR0_DFS_MASK, 31); + dev_data->ctrlr0 |= FIELD_PREP(CTRLR0_DFS32_MASK, 31); } else if ((packet->num_bytes % 2) == 0) { dev_data->bytes_per_frame_exp = 1; dev_data->ctrlr0 |= FIELD_PREP(CTRLR0_DFS_MASK, 15); + dev_data->ctrlr0 |= FIELD_PREP(CTRLR0_DFS32_MASK, 15); } else { dev_data->bytes_per_frame_exp = 0; dev_data->ctrlr0 |= FIELD_PREP(CTRLR0_DFS_MASK, 7); + dev_data->ctrlr0 |= FIELD_PREP(CTRLR0_DFS32_MASK, 7); } } diff --git a/drivers/mspi/mspi_dw.h b/drivers/mspi/mspi_dw.h index c35778cb1c59..28e4bed016e7 100644 --- a/drivers/mspi/mspi_dw.h +++ b/drivers/mspi/mspi_dw.h @@ -1,32 +1,42 @@ /* * Copyright (c) 2024 Nordic Semiconductor ASA + * Copyright (c) 2025 Tenstorrent AI ULC * * SPDX-License-Identifier: Apache-2.0 */ +#if DT_HAS_COMPAT_STATUS_OKAY(snps_designware_ssi_v2) +/* + * Later versions of the SSI have different register offsets. Define a macro + * to use these. + */ +#define SSI_VERSION_2 1 +#endif + /* * This header is part of mspi_dw.c extracted only for clarity. * It is not supposed to be included by any file other than mspi_dw.c. */ /* CTRLR0 - Control Register 0 */ -#define CTRLR0_SPI_FRF_MASK GENMASK(23, 22) +#define CTRLR0_SPI_FRF_MASK COND_CODE_1(SSI_VERSION_2, GENMASK(22, 21), GENMASK(23, 22)) #define CTRLR0_SPI_FRF_STANDARD 0UL #define CTRLR0_SPI_FRF_DUAL 1UL #define CTRLR0_SPI_FRF_QUAD 2UL #define CTRLR0_SPI_FRF_OCTAL 3UL -#define CTRLR0_TMOD_MASK GENMASK(11, 10) +#define CTRLR0_TMOD_MASK COND_CODE_1(SSI_VERSION_2, GENMASK(9, 8), GENMASK(11, 10)) #define CTRLR0_TMOD_TX_RX 0UL #define CTRLR0_TMOD_TX 1UL #define CTRLR0_TMOD_RX 2UL #define CTRLR0_TMOD_EEPROM 3UL -#define CTRLR0_SCPOL_BIT BIT(9) -#define CTRLR0_SCPH_BIT BIT(8) -#define CTRLR0_FRF_MASK GENMASK(7, 6) +#define CTRLR0_SCPOL_BIT COND_CODE_1(SSI_VERSION_2, BIT(7), BIT(9)) +#define CTRLR0_SCPH_BIT COND_CODE_1(SSI_VERSION_2, BIT(6), BIT(8)) +#define CTRLR0_FRF_MASK COND_CODE_1(SSI_VERSION_2, GENMASK(5, 4), GENMASK(7, 6)) #define CTRLR0_FRF_SPI 0UL #define CTRLR0_FRF_SSP 1UL #define CTRLR0_FRF_MICROWIRE 2UL -#define CTRLR0_DFS_MASK GENMASK(4, 0) +#define CTRLR0_DFS_MASK COND_CODE_1(SSI_VERSION_2, GENMASK(3, 0), GENMASK(4, 0)) +#define CTRLR0_DFS32_MASK COND_CODE_1(SSI_VERSION_2, GENMASK(20, 16), (0)) /* CTRLR1- Control Register 1 */ #define CTRLR1_NDF_MASK GENMASK(15, 0) From e8027d3ae2bd52634012905066a5bb4bfa6e2fe2 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Tue, 22 Apr 2025 10:33:32 -0500 Subject: [PATCH 0750/2141] [nrf fromtree] drivers: mspi: mspi_dw: add API to configure RX_DLY timing The SSI DW peripheral supports an RX_SAMPLE_DLY register in some instances- this register controls the number of clock cycles from the default sample time before the RX input is actually sampled. This can be used to improve reliability when operating the SSI at a higher clock speed. Add an implementation of the mspi_timing_cfg api, and header to define the identifier so that users can configure this parameter Signed-off-by: Daniel DeGrasse (cherry picked from commit 9c829a1bbeb043aebe11c0682994d81dc48e7b44) --- drivers/mspi/mspi_dw.c | 19 ++++++++++++++++++ include/zephyr/drivers/mspi/mspi_dw.h | 29 +++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 include/zephyr/drivers/mspi/mspi_dw.h diff --git a/drivers/mspi/mspi_dw.c b/drivers/mspi/mspi_dw.c index d2c4376302ff..262f4c6b2a2e 100644 --- a/drivers/mspi/mspi_dw.c +++ b/drivers/mspi/mspi_dw.c @@ -17,6 +17,7 @@ #include #include #include +#include #include "mspi_dw.h" @@ -48,6 +49,7 @@ struct mspi_dw_data { uint32_t ctrlr0; uint32_t spi_ctrlr0; uint32_t baudr; + uint32_t rx_sample_dly; #if defined(CONFIG_MSPI_XIP) uint32_t xip_freq; @@ -113,6 +115,7 @@ DEFINE_MM_REG_WR(imr, 0x2c) DEFINE_MM_REG_RD(isr, 0x30) DEFINE_MM_REG_RD(risr, 0x34) DEFINE_MM_REG_RD_WR(dr, 0x60) +DEFINE_MM_REG_WR(rx_sample_dly, 0xf0) DEFINE_MM_REG_WR(spi_ctrlr0, 0xf4) #if defined(CONFIG_MSPI_XIP) @@ -936,6 +939,7 @@ static int start_next_packet(const struct device *dev, k_timeout_t timeout) : 0); write_spi_ctrlr0(dev, dev_data->spi_ctrlr0); write_baudr(dev, dev_data->baudr); + write_rx_sample_dly(dev, dev_data->rx_sample_dly); write_ser(dev, BIT(dev_data->dev_id->dev_idx)); if (xip_enabled) { @@ -1262,6 +1266,20 @@ static int _api_xip_config(const struct device *dev, return 0; } +static int api_timing_config(const struct device *dev, + const struct mspi_dev_id *dev_id, + const uint32_t param_mask, void *cfg) +{ + struct mspi_dw_data *dev_data = dev->data; + struct mspi_dw_timing_cfg *config = cfg; + + if (param_mask & MSPI_DW_RX_TIMING_CFG) { + dev_data->rx_sample_dly = config->rx_sample_dly; + return 0; + } + return -ENOTSUP; +} + static int api_xip_config(const struct device *dev, const struct mspi_dev_id *dev_id, const struct mspi_xip_cfg *cfg) @@ -1407,6 +1425,7 @@ static DEVICE_API(mspi, drv_api) = { .dev_config = api_dev_config, .get_channel_status = api_get_channel_status, .transceive = api_transceive, + .timing_config = api_timing_config, #if defined(CONFIG_MSPI_XIP) .xip_config = api_xip_config, #endif diff --git a/include/zephyr/drivers/mspi/mspi_dw.h b/include/zephyr/drivers/mspi/mspi_dw.h new file mode 100644 index 000000000000..b51c9b9cdf05 --- /dev/null +++ b/include/zephyr/drivers/mspi/mspi_dw.h @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Tenstorrent AI ULC + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_INCLUDE_DRIVERS_MSPI_DW_H_ +#define ZEPHYR_INCLUDE_DRIVERS_MSPI_DW_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Designware MSPI configuration structure- this should be passed to the + * MSPI driver when calling mspi_timing_config + */ +struct mspi_dw_timing_cfg { + uint32_t rx_sample_dly; /* RX sample delay, written to RX_SAMPLE_DLY register */ +}; + +/* Configure RX_SAMPLE_DLY register for MSPI DW SSI */ +#define MSPI_DW_RX_TIMING_CFG BIT(0) + +#ifdef __cplusplus +} +#endif + +#endif /* ZEPHYR_INCLUDE_DRIVERS_MSPI_DW_H_ */ From c9a1136d6d54d5e13f988be6347e3e8864672e77 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Wed, 2 Jul 2025 15:43:38 -0400 Subject: [PATCH 0751/2141] [nrf fromtree] drivers: mspi: mspi_dw: improve reliability of CS signal The designware controller has an *interesting* implementation of the CS signal- CS will be de-asserted whenever the TX FIFO is empty, so slower cores may see CS de-assert prematurely if they cannot keep pace with their SPI peripheral. To help reduce odds of de-assertion, implement the following changes: - don't write SER bit until directly before we enable interrupts, so that transfers don't start early - prefix the TX FIFO before writing SER, so the FIFO can drain a bit before have to service an interrupt Signed-off-by: Daniel DeGrasse (cherry picked from commit e425b3dd1c85889bec6157dab88960773788660f) --- drivers/mspi/mspi_dw.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/mspi/mspi_dw.c b/drivers/mspi/mspi_dw.c index 262f4c6b2a2e..bc2419e7f846 100644 --- a/drivers/mspi/mspi_dw.c +++ b/drivers/mspi/mspi_dw.c @@ -940,7 +940,6 @@ static int start_next_packet(const struct device *dev, k_timeout_t timeout) write_spi_ctrlr0(dev, dev_data->spi_ctrlr0); write_baudr(dev, dev_data->baudr); write_rx_sample_dly(dev, dev_data->rx_sample_dly); - write_ser(dev, BIT(dev_data->dev_id->dev_idx)); if (xip_enabled) { write_ssienr(dev, SSIENR_SSIC_EN_BIT); @@ -1027,8 +1026,17 @@ static int start_next_packet(const struct device *dev, k_timeout_t timeout) } } + /* Prefill TX FIFO with any data we can */ + if (dev_data->dummy_bytes && tx_dummy_bytes(dev)) { + imr = IMR_RXFIM_BIT; + } else if (packet->dir == MSPI_TX && packet->num_bytes) { + tx_data(dev, packet); + } + /* Enable interrupts now and wait until the packet is done. */ write_imr(dev, imr); + /* Write SER to start transfer */ + write_ser(dev, BIT(dev_data->dev_id->dev_idx)); rc = k_sem_take(&dev_data->finished, timeout); if (read_risr(dev) & RISR_RXOIR_BIT) { @@ -1058,6 +1066,8 @@ static int start_next_packet(const struct device *dev, k_timeout_t timeout) } else { write_ssienr(dev, 0); } + /* Clear SER */ + write_ser(dev, 0); if (dev_data->dev_id->ce.port) { int rc2; From 9d9d507a7cd58fa12dfbc6fbde7f0f030ada6c07 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Wed, 2 Jul 2025 15:47:13 -0400 Subject: [PATCH 0752/2141] [nrf fromtree] drivers: mspi: mspi_dw: support DDR mode Support DDR mode within the mspi_dw driver Signed-off-by: Daniel DeGrasse (cherry picked from commit fc64fec8fe2f2833a371ba383eb26b8ea010e6fe) --- drivers/mspi/mspi_dw.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/drivers/mspi/mspi_dw.c b/drivers/mspi/mspi_dw.c index bc2419e7f846..992c5dd10133 100644 --- a/drivers/mspi/mspi_dw.c +++ b/drivers/mspi/mspi_dw.c @@ -117,6 +117,7 @@ DEFINE_MM_REG_RD(risr, 0x34) DEFINE_MM_REG_RD_WR(dr, 0x60) DEFINE_MM_REG_WR(rx_sample_dly, 0xf0) DEFINE_MM_REG_WR(spi_ctrlr0, 0xf4) +DEFINE_MM_REG_WR(txd_drive_edge, 0xf8) #if defined(CONFIG_MSPI_XIP) DEFINE_MM_REG_WR(xip_incr_inst, 0x100) @@ -691,8 +692,21 @@ static int _api_dev_config(const struct device *dev, if (param_mask & MSPI_DEVICE_CONFIG_DATA_RATE) { /* TODO: add support for DDR */ - if (cfg->data_rate != MSPI_DATA_RATE_SINGLE) { - LOG_ERR("Only single data rate is supported."); + dev_data->spi_ctrlr0 &= ~(SPI_CTRLR0_SPI_DDR_EN_BIT | + SPI_CTRLR0_INST_DDR_EN_BIT); + switch (cfg->data_rate) { + case MSPI_DATA_RATE_SINGLE: + break; + case MSPI_DATA_RATE_DUAL: + dev_data->spi_ctrlr0 |= SPI_CTRLR0_INST_DDR_EN_BIT; + /* Also need to set DDR_EN bit */ + __fallthrough; + case MSPI_DATA_RATE_S_D_D: + dev_data->spi_ctrlr0 |= SPI_CTRLR0_SPI_DDR_EN_BIT; + break; + default: + LOG_ERR("Data rate %d not supported", + cfg->data_rate); return -ENOTSUP; } } @@ -940,6 +954,12 @@ static int start_next_packet(const struct device *dev, k_timeout_t timeout) write_spi_ctrlr0(dev, dev_data->spi_ctrlr0); write_baudr(dev, dev_data->baudr); write_rx_sample_dly(dev, dev_data->rx_sample_dly); + if (dev_data->spi_ctrlr0 & (SPI_CTRLR0_SPI_DDR_EN_BIT | + SPI_CTRLR0_INST_DDR_EN_BIT)) { + write_txd_drive_edge(dev, dev_data->baudr / 4); + } else { + write_txd_drive_edge(dev, 0); + } if (xip_enabled) { write_ssienr(dev, SSIENR_SSIC_EN_BIT); From c1dd79cdff9e19442c89ab717859b170ccf9db1d Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Wed, 2 Jul 2025 15:48:52 -0400 Subject: [PATCH 0753/2141] [nrf fromtree] drivers: mspi: mspi_dw: make sure controller is disabled at entry Some systems (IE cores with bootloaders) may not disable the DW SPI peripheral at boot time. Make sure the peripheral is disabled before we try to configure it. Signed-off-by: Daniel DeGrasse (cherry picked from commit a294653848a5478ca679c9414b76705305a385dd) --- drivers/mspi/mspi_dw.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/mspi/mspi_dw.c b/drivers/mspi/mspi_dw.c index 992c5dd10133..5370da453b0a 100644 --- a/drivers/mspi/mspi_dw.c +++ b/drivers/mspi/mspi_dw.c @@ -1437,6 +1437,9 @@ static int dev_init(const struct device *dev) } } + /* Make sure controller is disabled. */ + write_ssienr(dev, 0); + #if defined(CONFIG_PINCTRL) if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { rc = pinctrl_apply_state(dev_config->pcfg, PINCTRL_STATE_SLEEP); From a6480d2bce7a558a54915ac9091f69e636cbcce5 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Mon, 4 Aug 2025 10:49:03 -0500 Subject: [PATCH 0754/2141] [nrf fromtree] drivers: mspi: mspi_dw: support configuration of TXD_DRIVE_EDGE setting TXD_DRIVE_EDGE setting will typically be set to BAUDR/4 for DDR mode, but this may not cover all cases. Add a configurable multiplier and divisor to apply to the BAUDR value so the value's relation to BAUDR can be customized. Signed-off-by: Daniel DeGrasse (cherry picked from commit 6e3a8da8dc14f0cec1fd8cbd94603f5ea44b6aef) --- drivers/mspi/Kconfig.dw | 21 +++++++++++++++++++++ drivers/mspi/mspi_dw.c | 5 ++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/drivers/mspi/Kconfig.dw b/drivers/mspi/Kconfig.dw index 1ab82da0e854..d429cff044c0 100644 --- a/drivers/mspi/Kconfig.dw +++ b/drivers/mspi/Kconfig.dw @@ -1,4 +1,5 @@ # Copyright (c) 2024 Nordic Semiconductor ASA +# Copyright (c) 2025 Tenstorrent AI ULC # SPDX-License-Identifier: Apache-2.0 config MSPI_DW @@ -7,3 +8,23 @@ config MSPI_DW depends on DT_HAS_SNPS_DESIGNWARE_SSI_ENABLED select PINCTRL if $(dt_compat_any_has_prop,$(DT_COMPAT_SNPS_DESIGNWARE_SSI),pinctrl-0) imply MSPI_XIP + +if MSPI_DW + +config MSPI_DW_TXD_DIV + int "Designware SSI TX Drive edge divisor" + default 4 + help + Division factor to apply to calculated BAUDR value when writing it + to the TXD_DRIVE_EDGE register in DDR mode. Note that the maximum + value of this register is (BAUDR / 2) - 1. + +config MSPI_DW_TXD_MUL + int "Designware SSI TX Drive edge multiplier" + default 1 + help + Multiplication factor to apply to calculated BAUDR value when writing + it to the TXD_DRIVE_EDGE register in DDR mode. Note that the maximum + value of this register is (BAUDR / 2) - 1. + +endif # MSPI_DW diff --git a/drivers/mspi/mspi_dw.c b/drivers/mspi/mspi_dw.c index 5370da453b0a..0c6d8d151661 100644 --- a/drivers/mspi/mspi_dw.c +++ b/drivers/mspi/mspi_dw.c @@ -956,7 +956,10 @@ static int start_next_packet(const struct device *dev, k_timeout_t timeout) write_rx_sample_dly(dev, dev_data->rx_sample_dly); if (dev_data->spi_ctrlr0 & (SPI_CTRLR0_SPI_DDR_EN_BIT | SPI_CTRLR0_INST_DDR_EN_BIT)) { - write_txd_drive_edge(dev, dev_data->baudr / 4); + int txd = (CONFIG_MSPI_DW_TXD_MUL * dev_data->baudr) / + CONFIG_MSPI_DW_TXD_DIV; + + write_txd_drive_edge(dev, txd); } else { write_txd_drive_edge(dev, 0); } From c89e1b0541b2e68a181f63736b42e76ff45fd925 Mon Sep 17 00:00:00 2001 From: Utsav Munendra Date: Wed, 20 Aug 2025 11:55:35 -0700 Subject: [PATCH 0755/2141] [nrf fromtree] drivers: mspi: mspi_dw: Fix compilation with CONFIG_MSPI_XIP disabled Move `api_timing_config()` impl outside of the block gated behind CONFIG_MSPI_XIP. Signed-off-by: Utsav Munendra (cherry picked from commit 030b9f35975c8ec06f822d1e2783897de63fba5e) --- drivers/mspi/Kconfig.dw | 1 + drivers/mspi/mspi_dw.c | 32 ++++++++++++++++++-------------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/drivers/mspi/Kconfig.dw b/drivers/mspi/Kconfig.dw index d429cff044c0..06d2e09c8af1 100644 --- a/drivers/mspi/Kconfig.dw +++ b/drivers/mspi/Kconfig.dw @@ -8,6 +8,7 @@ config MSPI_DW depends on DT_HAS_SNPS_DESIGNWARE_SSI_ENABLED select PINCTRL if $(dt_compat_any_has_prop,$(DT_COMPAT_SNPS_DESIGNWARE_SSI),pinctrl-0) imply MSPI_XIP + imply MSPI_TIMING if MSPI_DW diff --git a/drivers/mspi/mspi_dw.c b/drivers/mspi/mspi_dw.c index 0c6d8d151661..f4e775ead437 100644 --- a/drivers/mspi/mspi_dw.c +++ b/drivers/mspi/mspi_dw.c @@ -1193,6 +1193,22 @@ static int api_transceive(const struct device *dev, return rc; } +#if defined(CONFIG_MSPI_TIMING) +static int api_timing_config(const struct device *dev, + const struct mspi_dev_id *dev_id, + const uint32_t param_mask, void *cfg) +{ + struct mspi_dw_data *dev_data = dev->data; + struct mspi_dw_timing_cfg *config = cfg; + + if (param_mask & MSPI_DW_RX_TIMING_CFG) { + dev_data->rx_sample_dly = config->rx_sample_dly; + return 0; + } + return -ENOTSUP; +} +#endif /* defined(CONFIG_MSPI_TIMING) */ + #if defined(CONFIG_MSPI_XIP) static int _api_xip_config(const struct device *dev, const struct mspi_dev_id *dev_id, @@ -1299,20 +1315,6 @@ static int _api_xip_config(const struct device *dev, return 0; } -static int api_timing_config(const struct device *dev, - const struct mspi_dev_id *dev_id, - const uint32_t param_mask, void *cfg) -{ - struct mspi_dw_data *dev_data = dev->data; - struct mspi_dw_timing_cfg *config = cfg; - - if (param_mask & MSPI_DW_RX_TIMING_CFG) { - dev_data->rx_sample_dly = config->rx_sample_dly; - return 0; - } - return -ENOTSUP; -} - static int api_xip_config(const struct device *dev, const struct mspi_dev_id *dev_id, const struct mspi_xip_cfg *cfg) @@ -1461,7 +1463,9 @@ static DEVICE_API(mspi, drv_api) = { .dev_config = api_dev_config, .get_channel_status = api_get_channel_status, .transceive = api_transceive, +#if defined(CONFIG_MSPI_TIMING) .timing_config = api_timing_config, +#endif #if defined(CONFIG_MSPI_XIP) .xip_config = api_xip_config, #endif From a2c68d47df855f27f48e7b594f3f5e2d7d532aaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Wed, 20 Aug 2025 12:37:49 +0200 Subject: [PATCH 0756/2141] [nrf fromtree] drivers: mspi_dw: Add support for DQS line MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add possibility of using data strobe signal (DQS) called RXDS in the SSI documentation. This signal may be necessary to make use of DDR modes. Remove also a TODO comment that should have been removed when support for DDR was added in fc64fec8fe2f2833a371ba383eb26b8ea010e6fe. Signed-off-by: Andrzej Głąbek (cherry picked from commit 0e1dfd940330a336c6358155589070e42a3455ad) --- drivers/mspi/mspi_dw.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/mspi/mspi_dw.c b/drivers/mspi/mspi_dw.c index f4e775ead437..66f257839aa4 100644 --- a/drivers/mspi/mspi_dw.c +++ b/drivers/mspi/mspi_dw.c @@ -691,7 +691,6 @@ static int _api_dev_config(const struct device *dev, } if (param_mask & MSPI_DEVICE_CONFIG_DATA_RATE) { - /* TODO: add support for DDR */ dev_data->spi_ctrlr0 &= ~(SPI_CTRLR0_SPI_DDR_EN_BIT | SPI_CTRLR0_INST_DDR_EN_BIT); switch (cfg->data_rate) { @@ -712,10 +711,10 @@ static int _api_dev_config(const struct device *dev, } if (param_mask & MSPI_DEVICE_CONFIG_DQS) { - /* TODO: add support for DQS */ + dev_data->spi_ctrlr0 &= ~SPI_CTRLR0_SPI_RXDS_EN_BIT; + if (cfg->dqs_enable) { - LOG_ERR("DQS line is not supported."); - return -ENOTSUP; + dev_data->spi_ctrlr0 |= SPI_CTRLR0_SPI_RXDS_EN_BIT; } } From 352ef48d7075d2e23cadd1ac92e85376420adaea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Wed, 10 Sep 2025 13:37:23 +0200 Subject: [PATCH 0757/2141] Revert "[nrf fromlist] drivers: flash_mspi_nor: Add support for "supply-gpios" property" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit fce86d05bccdba2ac2e1b50808407e2d48c87bd7. Signed-off-by: Andrzej Głąbek --- drivers/flash/flash_mspi_nor.c | 97 +++++++++------------------- drivers/flash/flash_mspi_nor.h | 6 -- dts/bindings/mtd/jedec,mspi-nor.yaml | 2 - 3 files changed, 32 insertions(+), 73 deletions(-) diff --git a/drivers/flash/flash_mspi_nor.c b/drivers/flash/flash_mspi_nor.c index bbda4c6361d6..4416ddc91a53 100644 --- a/drivers/flash/flash_mspi_nor.c +++ b/drivers/flash/flash_mspi_nor.c @@ -810,54 +810,39 @@ static int switch_to_target_io_mode(const struct device *dev) &dev_config->mspi_nor_cfg); } -#if defined(WITH_SUPPLY_GPIO) -static int power_supply(const struct device *dev) -{ - const struct flash_mspi_nor_config *dev_config = dev->config; - int rc; - - if (!gpio_is_ready_dt(&dev_config->supply)) { - LOG_ERR("Device %s is not ready", - dev_config->supply.port->name); - return -ENODEV; - } - - rc = gpio_pin_configure_dt(&dev_config->supply, GPIO_OUTPUT_ACTIVE); - if (rc < 0) { - LOG_ERR("Failed to activate power supply GPIO: %d", rc); - return -EIO; - } - - return 0; -} -#endif - #if defined(WITH_RESET_GPIO) static int gpio_reset(const struct device *dev) { const struct flash_mspi_nor_config *dev_config = dev->config; int rc; - if (!gpio_is_ready_dt(&dev_config->reset)) { - LOG_ERR("Device %s is not ready", - dev_config->reset.port->name); - return -ENODEV; - } + if (dev_config->reset.port) { + if (!gpio_is_ready_dt(&dev_config->reset)) { + LOG_ERR("Device %s is not ready", + dev_config->reset.port->name); + return -ENODEV; + } - rc = gpio_pin_configure_dt(&dev_config->reset, GPIO_OUTPUT_ACTIVE); - if (rc < 0) { - LOG_ERR("Failed to activate RESET: %d", rc); - return -EIO; - } + rc = gpio_pin_configure_dt(&dev_config->reset, + GPIO_OUTPUT_ACTIVE); + if (rc < 0) { + LOG_ERR("Failed to activate RESET: %d", rc); + return -EIO; + } - if (dev_config->reset_pulse_us != 0) { - k_busy_wait(dev_config->reset_pulse_us); - } + if (dev_config->reset_pulse_us != 0) { + k_busy_wait(dev_config->reset_pulse_us); + } - rc = gpio_pin_set_dt(&dev_config->reset, 0); - if (rc < 0) { - LOG_ERR("Failed to deactivate RESET: %d", rc); - return -EIO; + rc = gpio_pin_set_dt(&dev_config->reset, 0); + if (rc < 0) { + LOG_ERR("Failed to deactivate RESET: %d", rc); + return -EIO; + } + + if (dev_config->reset_recovery_us != 0) { + k_busy_wait(dev_config->reset_recovery_us); + } } return 0; @@ -927,6 +912,10 @@ static int soft_reset(const struct device *dev) return rc; } + if (dev_config->reset_recovery_us != 0) { + k_busy_wait(dev_config->reset_recovery_us); + } + return 0; } #endif /* WITH_SOFT_RESET */ @@ -936,7 +925,6 @@ static int flash_chip_init(const struct device *dev) const struct flash_mspi_nor_config *dev_config = dev->config; struct flash_mspi_nor_data *dev_data = dev->data; uint8_t id[JESD216_READ_ID_LEN] = {0}; - bool flash_reset = false; int rc; rc = mspi_dev_config(dev_config->bus, &dev_config->mspi_id, @@ -948,25 +936,12 @@ static int flash_chip_init(const struct device *dev) dev_data->in_target_io_mode = false; -#if defined(WITH_SUPPLY_GPIO) - if (dev_config->supply.port) { - rc = power_supply(dev); - if (rc < 0) { - return rc; - } - - flash_reset = true; - } -#endif - #if defined(WITH_RESET_GPIO) - if (dev_config->reset.port) { - rc = gpio_reset(dev); - if (rc < 0) { - return rc; - } + rc = gpio_reset(dev); - flash_reset = true; + if (rc < 0) { + LOG_ERR("Failed to reset with GPIO: %d", rc); + return rc; } #endif @@ -976,15 +951,9 @@ static int flash_chip_init(const struct device *dev) if (rc < 0) { return rc; } - - flash_reset = true; } #endif - if (flash_reset && dev_config->reset_recovery_us != 0) { - k_busy_wait(dev_config->reset_recovery_us); - } - if (dev_config->quirks != NULL && dev_config->quirks->pre_init != NULL) { rc = dev_config->quirks->pre_init(dev); @@ -1203,8 +1172,6 @@ BUILD_ASSERT((FLASH_SIZE(inst) % CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE) == 0, \ .mspi_nor_init_cfg = FLASH_INITIAL_CONFIG(inst), \ IF_ENABLED(CONFIG_MSPI_XIP, \ (.xip_cfg = MSPI_XIP_CONFIG_DT_INST(inst),)) \ - IF_ENABLED(WITH_SUPPLY_GPIO, \ - (.supply = GPIO_DT_SPEC_INST_GET_OR(inst, supply_gpios, {0}),)) \ IF_ENABLED(WITH_RESET_GPIO, \ (.reset = GPIO_DT_SPEC_INST_GET_OR(inst, reset_gpios, {0}), \ .reset_pulse_us = DT_INST_PROP_OR(inst, t_reset_pulse, 0) \ diff --git a/drivers/flash/flash_mspi_nor.h b/drivers/flash/flash_mspi_nor.h index 950606fe3a8b..ac362f48c25c 100644 --- a/drivers/flash/flash_mspi_nor.h +++ b/drivers/flash/flash_mspi_nor.h @@ -16,9 +16,6 @@ extern "C" { #include "jesd216.h" #include "spi_nor.h" -#if DT_ANY_INST_HAS_PROP_STATUS_OKAY(supply_gpios) -#define WITH_SUPPLY_GPIO 1 -#endif #if DT_ANY_INST_HAS_PROP_STATUS_OKAY(reset_gpios) #define WITH_RESET_GPIO 1 #endif @@ -75,9 +72,6 @@ struct flash_mspi_nor_config { #if defined(CONFIG_MSPI_XIP) struct mspi_xip_cfg xip_cfg; #endif -#if defined(WITH_SUPPLY_GPIO) - struct gpio_dt_spec supply; -#endif #if defined(WITH_RESET_GPIO) struct gpio_dt_spec reset; uint32_t reset_pulse_us; diff --git a/dts/bindings/mtd/jedec,mspi-nor.yaml b/dts/bindings/mtd/jedec,mspi-nor.yaml index 06b72bf951c0..5343fde5f7da 100644 --- a/dts/bindings/mtd/jedec,mspi-nor.yaml +++ b/dts/bindings/mtd/jedec,mspi-nor.yaml @@ -22,8 +22,6 @@ properties: type: int description: | Minimum time, in nanoseconds, the flash chip needs to recover after reset. - Such delay is performed when a GPIO or software reset is done, or after - power is supplied to the chip if the "supply-gpios" property is specified. transfer-timeout: type: int From 73f05d80f91d71dfd57100ac726a8e6706560137 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Wed, 10 Sep 2025 13:37:28 +0200 Subject: [PATCH 0758/2141] Revert "[nrf fromlist] drivers: flash_mspi_nor: Remove undesirable initial Quad disabling" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 7cee84cdeabe56e316d5313fbf714acdeadbb603. Signed-off-by: Andrzej Głąbek --- drivers/flash/flash_mspi_nor.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/flash/flash_mspi_nor.c b/drivers/flash/flash_mspi_nor.c index 4416ddc91a53..7663e1cc12a9 100644 --- a/drivers/flash/flash_mspi_nor.c +++ b/drivers/flash/flash_mspi_nor.c @@ -924,6 +924,7 @@ static int flash_chip_init(const struct device *dev) { const struct flash_mspi_nor_config *dev_config = dev->config; struct flash_mspi_nor_data *dev_data = dev->data; + enum mspi_io_mode io_mode = dev_config->mspi_nor_cfg.io_mode; uint8_t id[JESD216_READ_ID_LEN] = {0}; int rc; @@ -936,6 +937,28 @@ static int flash_chip_init(const struct device *dev) dev_data->in_target_io_mode = false; + /* Some chips reuse RESET pin for data in Quad modes: + * force single line mode before resetting. + */ + if (dev_data->switch_info.quad_enable_req != JESD216_DW15_QER_VAL_NONE && + (io_mode == MSPI_IO_MODE_SINGLE || + io_mode == MSPI_IO_MODE_QUAD_1_1_4 || + io_mode == MSPI_IO_MODE_QUAD_1_4_4)) { + rc = quad_enable_set(dev, false); + + if (rc < 0) { + LOG_ERR("Failed to switch to single line mode: %d", rc); + return rc; + } + + rc = wait_until_ready(dev, K_USEC(1)); + + if (rc < 0) { + LOG_ERR("Failed waiting for device after switch to single line: %d", rc); + return rc; + } + } + #if defined(WITH_RESET_GPIO) rc = gpio_reset(dev); From 3fcd0ca39d1b5d89e9a1d0a95435c5cce263c71a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Wed, 10 Sep 2025 13:37:30 +0200 Subject: [PATCH 0759/2141] Revert "[nrf fromlist] drivers: flash_mspi_nor: Add Soft Reset" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 6d48f83dce85115bf933d6dd45e8c543f459a08c. Signed-off-by: Andrzej Głąbek --- drivers/flash/flash_mspi_nor.c | 87 +--------------------------- drivers/flash/flash_mspi_nor.h | 6 +- drivers/flash/flash_mspi_nor_sfdp.h | 7 --- dts/bindings/mtd/jedec,mspi-nor.yaml | 6 -- 4 files changed, 4 insertions(+), 102 deletions(-) diff --git a/drivers/flash/flash_mspi_nor.c b/drivers/flash/flash_mspi_nor.c index 7663e1cc12a9..8cc2c580ab0e 100644 --- a/drivers/flash/flash_mspi_nor.c +++ b/drivers/flash/flash_mspi_nor.c @@ -849,77 +849,6 @@ static int gpio_reset(const struct device *dev) } #endif -#if defined(WITH_SOFT_RESET) -static int soft_reset_66_99(const struct device *dev) -{ - int rc; - - set_up_xfer(dev, MSPI_TX); - rc = perform_xfer(dev, SPI_NOR_CMD_RESET_EN, false); - if (rc < 0) { - LOG_ERR("CMD_RESET_EN failed: %d", rc); - return rc; - } - - set_up_xfer(dev, MSPI_TX); - rc = perform_xfer(dev, SPI_NOR_CMD_RESET_MEM, false); - if (rc < 0) { - LOG_ERR("CMD_RESET_MEM failed: %d", rc); - return rc; - } - - return 0; -} - -static int soft_reset(const struct device *dev) -{ - const struct flash_mspi_nor_config *dev_config = dev->config; - struct flash_mspi_nor_data *dev_data = dev->data; - int rc; - - /* If the flash may expect commands sent in multi-line mode, - * send additionally the reset sequence this way. - */ - if (dev_config->multi_io_cmd) { - rc = mspi_dev_config(dev_config->bus, &dev_config->mspi_id, - MSPI_DEVICE_CONFIG_IO_MODE, - &dev_config->mspi_nor_cfg); - if (rc < 0) { - LOG_ERR("%s: dev_config() failed: %d", __func__, rc); - return rc; - } - - dev_data->in_target_io_mode = true; - - rc = soft_reset_66_99(dev); - if (rc < 0) { - return rc; - } - - rc = mspi_dev_config(dev_config->bus, &dev_config->mspi_id, - MSPI_DEVICE_CONFIG_IO_MODE, - &dev_config->mspi_nor_init_cfg); - if (rc < 0) { - LOG_ERR("%s: dev_config() failed: %d", __func__, rc); - return rc; - } - - dev_data->in_target_io_mode = false; - } - - rc = soft_reset_66_99(dev); - if (rc < 0) { - return rc; - } - - if (dev_config->reset_recovery_us != 0) { - k_busy_wait(dev_config->reset_recovery_us); - } - - return 0; -} -#endif /* WITH_SOFT_RESET */ - static int flash_chip_init(const struct device *dev) { const struct flash_mspi_nor_config *dev_config = dev->config; @@ -968,15 +897,6 @@ static int flash_chip_init(const struct device *dev) } #endif -#if defined(WITH_SOFT_RESET) - if (dev_config->initial_soft_reset) { - rc = soft_reset(dev); - if (rc < 0) { - return rc; - } - } -#endif - if (dev_config->quirks != NULL && dev_config->quirks->pre_init != NULL) { rc = dev_config->quirks->pre_init(dev); @@ -1197,10 +1117,10 @@ BUILD_ASSERT((FLASH_SIZE(inst) % CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE) == 0, \ (.xip_cfg = MSPI_XIP_CONFIG_DT_INST(inst),)) \ IF_ENABLED(WITH_RESET_GPIO, \ (.reset = GPIO_DT_SPEC_INST_GET_OR(inst, reset_gpios, {0}), \ - .reset_pulse_us = DT_INST_PROP_OR(inst, t_reset_pulse, 0) \ - / 1000,)) \ + .reset_pulse_us = DT_INST_PROP_OR(inst, t_reset_pulse, 0) \ + / 1000, \ .reset_recovery_us = DT_INST_PROP_OR(inst, t_reset_recovery, 0) \ - / 1000, \ + / 1000,)) \ .transfer_timeout = DT_INST_PROP(inst, transfer_timeout), \ FLASH_PAGE_LAYOUT_DEFINE(inst) \ .jedec_id = DT_INST_PROP(inst, jedec_id), \ @@ -1215,7 +1135,6 @@ BUILD_ASSERT((FLASH_SIZE(inst) % CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE) == 0, \ .multiperipheral_bus = DT_PROP(DT_INST_BUS(inst), \ software_multiperipheral), \ IO_MODE_FLAGS(DT_INST_ENUM_IDX(inst, mspi_io_mode)), \ - .initial_soft_reset = DT_INST_PROP(inst, initial_soft_reset), \ }; \ FLASH_PAGE_LAYOUT_CHECK(inst) \ DEVICE_DT_INST_DEFINE(inst, \ diff --git a/drivers/flash/flash_mspi_nor.h b/drivers/flash/flash_mspi_nor.h index ac362f48c25c..f9da334b4d73 100644 --- a/drivers/flash/flash_mspi_nor.h +++ b/drivers/flash/flash_mspi_nor.h @@ -19,9 +19,6 @@ extern "C" { #if DT_ANY_INST_HAS_PROP_STATUS_OKAY(reset_gpios) #define WITH_RESET_GPIO 1 #endif -#if DT_ANY_INST_HAS_BOOL_STATUS_OKAY(initial_soft_reset) -#define WITH_SOFT_RESET 1 -#endif #define CMD_EXTENSION_NONE 0 #define CMD_EXTENSION_SAME 1 @@ -75,8 +72,8 @@ struct flash_mspi_nor_config { #if defined(WITH_RESET_GPIO) struct gpio_dt_spec reset; uint32_t reset_pulse_us; -#endif uint32_t reset_recovery_us; +#endif uint32_t transfer_timeout; #if defined(CONFIG_FLASH_PAGE_LAYOUT) struct flash_pages_layout layout; @@ -92,7 +89,6 @@ struct flash_mspi_nor_config { bool multiperipheral_bus : 1; bool multi_io_cmd : 1; bool single_io_addr : 1; - bool initial_soft_reset : 1; }; struct flash_mspi_nor_data { diff --git a/drivers/flash/flash_mspi_nor_sfdp.h b/drivers/flash/flash_mspi_nor_sfdp.h index b2a8ba80bec1..1a15515c5651 100644 --- a/drivers/flash/flash_mspi_nor_sfdp.h +++ b/drivers/flash/flash_mspi_nor_sfdp.h @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -#define BFP_DW16_SOFT_RESET_66_99 BIT(4) - #define BFP_DW16_4B_ADDR_ENTER_B7 BIT(0) #define BFP_DW16_4B_ADDR_ENTER_06_B7 BIT(1) #define BFP_DW16_4B_ADDR_PER_CMD BIT(5) @@ -344,9 +342,4 @@ BFP_DW16_4B_ADDR_PER_CMD | \ BFP_DW16_4B_ADDR_ALWAYS)), \ "No supported method of entering 4-byte addressing mode for " \ - DT_NODE_FULL_NAME(DT_DRV_INST(inst))); \ - BUILD_ASSERT(!DT_INST_PROP(inst, initial_soft_reset) || \ - (SFDP_FIELD(inst, sfdp_bfp, 16, GENMASK(13, 8)) \ - & BFP_DW16_SOFT_RESET_66_99), \ - "Cannot use 66h/99h soft reset sequence for " \ DT_NODE_FULL_NAME(DT_DRV_INST(inst))) diff --git a/dts/bindings/mtd/jedec,mspi-nor.yaml b/dts/bindings/mtd/jedec,mspi-nor.yaml index 5343fde5f7da..e21057cc803a 100644 --- a/dts/bindings/mtd/jedec,mspi-nor.yaml +++ b/dts/bindings/mtd/jedec,mspi-nor.yaml @@ -38,9 +38,3 @@ properties: the flash chip. The driver will use dedicated instruction codes for commands that require addresses (like Read, Page Program, or Erase) and will switch the flash chip to 4-byte addressing mode if necessary. - - initial-soft-reset: - type: boolean - description: | - When set, the flash driver performs software reset of the flash chip - at initialization. From 1bd60f9073fe13ea98b9413617f98ef178d14ee1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Wed, 10 Sep 2025 13:37:31 +0200 Subject: [PATCH 0760/2141] Revert "[nrf fromlist] drivers: flash_mspi_nor: Complete handling of QER, add handling of OER" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit a4d3616629ae26dabdb09edf75c4a6c596a6b6ae. Signed-off-by: Andrzej Głąbek --- drivers/flash/flash_mspi_nor.c | 153 ++++---------------------- drivers/flash/flash_mspi_nor_quirks.h | 6 + 2 files changed, 25 insertions(+), 134 deletions(-) diff --git a/drivers/flash/flash_mspi_nor.c b/drivers/flash/flash_mspi_nor.c index 8cc2c580ab0e..cb74abccef70 100644 --- a/drivers/flash/flash_mspi_nor.c +++ b/drivers/flash/flash_mspi_nor.c @@ -598,138 +598,31 @@ static int dev_pm_action_cb(const struct device *dev, static int quad_enable_set(const struct device *dev, bool enable) { struct flash_mspi_nor_data *dev_data = dev->data; - uint8_t op_code; - uint8_t qe_bit; - uint8_t status_reg; - uint8_t payload_len; - uint8_t payload[2]; int rc; - switch (dev_data->switch_info.quad_enable_req) { - case JESD216_DW15_QER_VAL_S1B6: - op_code = SPI_NOR_CMD_RDSR; - qe_bit = BIT(6); - break; - case JESD216_DW15_QER_VAL_S2B7: - /* Use special Read status register 2 instruction. */ - op_code = 0x3F; - qe_bit = BIT(7); - break; - case JESD216_DW15_QER_VAL_S2B1v1: - case JESD216_DW15_QER_VAL_S2B1v4: - case JESD216_DW15_QER_VAL_S2B1v5: - case JESD216_DW15_QER_VAL_S2B1v6: - op_code = SPI_NOR_CMD_RDSR2; - qe_bit = BIT(1); - break; - default: - LOG_ERR("Unknown Quad Enable Requirement: %u", - dev_data->switch_info.quad_enable_req); - return -ENOTSUP; - } - - rc = cmd_rdsr(dev, op_code, &status_reg); + rc = cmd_wren(dev); if (rc < 0) { + LOG_ERR("Failed to set write enable: %d", rc); return rc; } - if (((status_reg & qe_bit) != 0) == enable) { - /* Nothing to do, the QE bit is already set properly. */ - return 0; - } - - status_reg ^= qe_bit; - - switch (dev_data->switch_info.quad_enable_req) { - default: - case JESD216_DW15_QER_VAL_S1B6: - payload_len = 1; - op_code = SPI_NOR_CMD_WRSR; - break; - case JESD216_DW15_QER_VAL_S2B7: - payload_len = 1; - /* Use special Write status register 2 instruction. */ - op_code = 0x3E; - break; - case JESD216_DW15_QER_VAL_S2B1v1: - case JESD216_DW15_QER_VAL_S2B1v4: - case JESD216_DW15_QER_VAL_S2B1v5: - payload_len = 2; - op_code = SPI_NOR_CMD_WRSR; - break; - case JESD216_DW15_QER_VAL_S2B1v6: - payload_len = 1; - op_code = SPI_NOR_CMD_WRSR2; - break; - } - - if (payload_len == 1) { - payload[0] = status_reg; - } else { - payload[1] = status_reg; + if (dev_data->switch_info.quad_enable_req == JESD216_DW15_QER_VAL_S1B6) { + uint8_t mode_payload = enable ? BIT(6) : 0; - /* When the Write Status command is to be sent with two data - * bytes (this is the case for S2B1v1, S2B1v4, and S2B1v5 QER - * values), the first status register needs to be read and - * sent as the first byte, so that its value is not modified. - */ - rc = cmd_rdsr(dev, SPI_NOR_CMD_RDSR, &payload[0]); + rc = cmd_wrsr(dev, SPI_NOR_CMD_WRSR, 1, &mode_payload); if (rc < 0) { + LOG_ERR("Failed to enable/disable quad mode: %d", rc); return rc; } - } - - rc = cmd_wrsr(dev, op_code, payload_len, payload); - if (rc < 0) { - return rc; - } - - return 0; -} - -static int octal_enable_set(const struct device *dev, bool enable) -{ - struct flash_mspi_nor_data *dev_data = dev->data; - uint8_t op_code; - uint8_t oe_bit; - uint8_t status_reg; - int rc; - - if (dev_data->switch_info.octal_enable_req != BFP_DW19_OER_VAL_S2B3) { - LOG_ERR("Unknown Octal Enable Requirement: %u", - dev_data->switch_info.octal_enable_req); + } else { + /* TODO: handle all DW15 QER values */ return -ENOTSUP; } - oe_bit = BIT(3); - - /* Use special Read status register 2 instruction 0x65 with one address - * byte 0x02 and one dummy byte. - */ - op_code = 0x65; - set_up_xfer(dev, MSPI_RX); - dev_data->xfer.rx_dummy = 8; - dev_data->xfer.addr_length = 1; - dev_data->packet.address = 0x02; - dev_data->packet.num_bytes = sizeof(uint8_t); - dev_data->packet.data_buf = &status_reg; - rc = perform_xfer(dev, op_code, false); - if (rc < 0) { - LOG_ERR("cmd_rdsr 0x%02x failed: %d", op_code, rc); - return rc; - } - - if (((status_reg & oe_bit) != 0) == enable) { - /* Nothing to do, the OE bit is already set properly. */ - return 0; - } - - status_reg ^= oe_bit; + rc = wait_until_ready(dev, K_USEC(1)); - /* Use special Write status register 2 instruction to clear the bit. */ - op_code = (status_reg & oe_bit) ? SPI_NOR_CMD_WRSR2 : 0x3E; - rc = cmd_wrsr(dev, op_code, 1, &status_reg); if (rc < 0) { + LOG_ERR("Failed waiting until device ready after enabling quad: %d", rc); return rc; } @@ -766,26 +659,18 @@ static int switch_to_target_io_mode(const struct device *dev) int rc = 0; if (dev_data->switch_info.quad_enable_req != JESD216_DW15_QER_VAL_NONE) { - bool quad_needed = io_mode == MSPI_IO_MODE_QUAD_1_1_4 || - io_mode == MSPI_IO_MODE_QUAD_1_4_4 || - io_mode == MSPI_IO_MODE_QUAD; - - rc = quad_enable_set(dev, quad_needed); - if (rc < 0) { - LOG_ERR("Failed to modify Quad Enable bit: %d", rc); - return rc; + /* For Quad 1-1-4 and 1-4-4, entering or leaving mode is defined + * in JEDEC216 BFP DW15 QER + */ + if (io_mode == MSPI_IO_MODE_SINGLE) { + rc = quad_enable_set(dev, false); + } else if (io_mode == MSPI_IO_MODE_QUAD_1_1_4 || + io_mode == MSPI_IO_MODE_QUAD_1_4_4) { + rc = quad_enable_set(dev, true); } - } - if (dev_data->switch_info.octal_enable_req != BFP_DW19_OER_VAL_NONE) { - bool octal_needed = io_mode == MSPI_IO_MODE_OCTAL_1_1_8 || - io_mode == MSPI_IO_MODE_OCTAL_1_8_8 || - io_mode == MSPI_IO_MODE_OCTAL; - - rc = octal_enable_set(dev, octal_needed); if (rc < 0) { - LOG_ERR("Failed to modify Octal Enable bit: %d", rc); - return rc; + LOG_ERR("Failed to modify Quad Enable bit: %d", rc); } } diff --git a/drivers/flash/flash_mspi_nor_quirks.h b/drivers/flash/flash_mspi_nor_quirks.h index 7e2a75fa70ca..2231d776fc04 100644 --- a/drivers/flash/flash_mspi_nor_quirks.h +++ b/drivers/flash/flash_mspi_nor_quirks.h @@ -70,6 +70,12 @@ static inline int mxicy_mx25r_post_switch_mode(const struct device *dev) return 0; } + /* Wait for previous write to finish */ + rc = wait_until_ready(dev, K_USEC(1)); + if (rc < 0) { + return rc; + } + /* Write enable */ rc = cmd_wren(dev); if (rc < 0) { From f2b51a6512526ee46237526055a3c78947967356 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Wed, 10 Sep 2025 13:37:33 +0200 Subject: [PATCH 0761/2141] Revert "[nrf fromlist] drivers: flash_mspi_nor: Refactor handling of commands" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit bbf056735bf2a4612e06d7745a51629624e59079. Signed-off-by: Andrzej Głąbek --- drivers/flash/flash_mspi_nor.c | 613 +++++++++++--------------- drivers/flash/flash_mspi_nor.h | 200 ++++++++- drivers/flash/flash_mspi_nor_quirks.h | 77 ++-- drivers/flash/flash_mspi_nor_sfdp.h | 14 - dts/bindings/mtd/jedec,mspi-nor.yaml | 8 - 5 files changed, 484 insertions(+), 428 deletions(-) diff --git a/drivers/flash/flash_mspi_nor.c b/drivers/flash/flash_mspi_nor.c index cb74abccef70..2403160e296a 100644 --- a/drivers/flash/flash_mspi_nor.c +++ b/drivers/flash/flash_mspi_nor.c @@ -13,26 +13,14 @@ #include "flash_mspi_nor.h" #include "flash_mspi_nor_sfdp.h" - -#define INVALID_DTS_RX_DUMMY 0xFF - -static void set_up_xfer(const struct device *dev, enum mspi_xfer_direction dir); -static int perform_xfer(const struct device *dev, - uint8_t cmd, bool in_target_io_mode); -static int cmd_rdsr(const struct device *dev, uint8_t op_code, uint8_t *sr); -static int wait_until_ready(const struct device *dev, k_timeout_t poll_period); -static int cmd_wren(const struct device *dev); -static int cmd_wrsr(const struct device *dev, uint8_t op_code, - uint8_t sr_cnt, uint8_t *sr); - #include "flash_mspi_nor_quirks.h" LOG_MODULE_REGISTER(flash_mspi_nor, CONFIG_FLASH_LOG_LEVEL); -static void set_up_xfer(const struct device *dev, enum mspi_xfer_direction dir) +void flash_mspi_command_set(const struct device *dev, const struct flash_mspi_nor_cmd *cmd) { - const struct flash_mspi_nor_config *dev_config = dev->config; struct flash_mspi_nor_data *dev_data = dev->data; + const struct flash_mspi_nor_config *dev_config = dev->config; memset(&dev_data->xfer, 0, sizeof(dev_data->xfer)); memset(&dev_data->packet, 0, sizeof(dev_data->packet)); @@ -42,94 +30,32 @@ static void set_up_xfer(const struct device *dev, enum mspi_xfer_direction dir) dev_data->xfer.num_packet = 1; dev_data->xfer.timeout = dev_config->transfer_timeout; - dev_data->packet.dir = dir; -} - -static void set_up_xfer_with_addr(const struct device *dev, - enum mspi_xfer_direction dir, - uint32_t addr) -{ - struct flash_mspi_nor_data *dev_data = dev->data; + dev_data->xfer.cmd_length = cmd->cmd_length; + dev_data->xfer.addr_length = cmd->addr_length; + dev_data->xfer.tx_dummy = (cmd->dir == MSPI_TX) ? + cmd->tx_dummy : dev_config->mspi_nor_cfg.tx_dummy; + dev_data->xfer.rx_dummy = (cmd->dir == MSPI_RX) ? + cmd->rx_dummy : dev_config->mspi_nor_cfg.rx_dummy; - set_up_xfer(dev, dir); - dev_data->xfer.addr_length = dev_data->cmd_info.uses_4byte_addr - ? 4 : 3; - dev_data->packet.address = addr; + dev_data->packet.dir = cmd->dir; + dev_data->packet.cmd = cmd->cmd; } -static int perform_xfer(const struct device *dev, - uint8_t cmd, bool data_transfer) +static int dev_cfg_apply(const struct device *dev, const struct mspi_dev_cfg *cfg) { const struct flash_mspi_nor_config *dev_config = dev->config; struct flash_mspi_nor_data *dev_data = dev->data; - const struct mspi_dev_cfg *cfg = NULL; - int rc; - - if (dev_data->cmd_info.cmd_extension != CMD_EXTENSION_NONE && - dev_data->in_target_io_mode) { - uint8_t cmd_extension = cmd; - - if (dev_data->cmd_info.cmd_extension == CMD_EXTENSION_INVERSE) { - cmd_extension = ~cmd_extension; - } - - dev_data->xfer.cmd_length = 2; - dev_data->packet.cmd = ((uint16_t)cmd << 8) - | cmd_extension; - } else { - dev_data->xfer.cmd_length = 1; - dev_data->packet.cmd = cmd; - } - if (dev_config->multi_io_cmd || - dev_config->mspi_nor_cfg.io_mode == MSPI_IO_MODE_SINGLE) { - /* If multiple IO lines are used in all the transfer phases - * or in none of them, there's no need to switch the IO mode. - */ - } else if (data_transfer) { - /* For data transfer commands (read and program), ensure that - * the target IO mode is active. - */ - if (!dev_data->in_target_io_mode) { - cfg = &dev_config->mspi_nor_cfg; - } - } else { - /* For all other commands, switch to Single IO mode if a given - * command needs the data or address phase and in the target IO - * mode multiple IO lines are used in these phases. - */ - if (dev_data->in_target_io_mode) { - if (dev_data->packet.num_bytes != 0 || - (dev_data->xfer.addr_length != 0 && - !dev_config->single_io_addr)) { - /* Only the IO mode is to be changed, so the - * initial configuration structure can be used - * for this operation. - */ - cfg = &dev_config->mspi_nor_init_cfg; - } - } - } - - if (cfg) { - rc = mspi_dev_config(dev_config->bus, &dev_config->mspi_id, - MSPI_DEVICE_CONFIG_IO_MODE, cfg); - if (rc < 0) { - LOG_ERR("%s: dev_config() failed: %d", __func__, rc); - return rc; - } - - dev_data->in_target_io_mode = data_transfer; + if (dev_data->curr_cfg == cfg) { + return 0; } - rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, - &dev_data->xfer); + int rc = mspi_dev_config(dev_config->bus, &dev_config->mspi_id, + MSPI_DEVICE_CONFIG_ALL, cfg); if (rc < 0) { - LOG_ERR("%s: transceive() failed: %d", __func__, rc); - return rc; + LOG_ERR("Failed to set device config: %p error: %d", cfg, rc); } - - return 0; + return rc; } static int acquire(const struct device *dev) @@ -144,26 +70,15 @@ static int acquire(const struct device *dev) if (rc < 0) { LOG_ERR("pm_device_runtime_get() failed: %d", rc); } else { - enum mspi_dev_cfg_mask mask; - - if (dev_config->multiperipheral_bus) { - mask = MSPI_DEVICE_CONFIG_ALL; - } else { - mask = MSPI_DEVICE_CONFIG_NONE; - } - /* This acquires the MSPI controller and reconfigures it * if needed for the flash device. */ rc = mspi_dev_config(dev_config->bus, &dev_config->mspi_id, - mask, &dev_config->mspi_nor_cfg); + dev_config->mspi_nor_cfg_mask, + &dev_config->mspi_nor_cfg); if (rc < 0) { LOG_ERR("mspi_dev_config() failed: %d", rc); } else { - if (dev_config->multiperipheral_bus) { - dev_data->in_target_io_mode = true; - } - return 0; } @@ -201,145 +116,134 @@ static inline uint16_t dev_page_size(const struct device *dev) return dev_config->page_size; } -static inline -const struct jesd216_erase_type *dev_erase_types(const struct device *dev) -{ - struct flash_mspi_nor_data *dev_data = dev->data; - - return dev_data->erase_types; -} - -static int cmd_rdsr(const struct device *dev, uint8_t op_code, uint8_t *sr) +static int api_read(const struct device *dev, off_t addr, void *dest, + size_t size) { + const struct flash_mspi_nor_config *dev_config = dev->config; struct flash_mspi_nor_data *dev_data = dev->data; + const uint32_t flash_size = dev_flash_size(dev); int rc; - set_up_xfer(dev, MSPI_RX); - if (dev_data->in_target_io_mode) { - dev_data->xfer.rx_dummy = dev_data->cmd_info.rdsr_dummy; - dev_data->xfer.addr_length = dev_data->cmd_info.rdsr_addr_4 - ? 4 : 0; + if (size == 0) { + return 0; } - dev_data->packet.num_bytes = sizeof(uint8_t); - dev_data->packet.data_buf = sr; - rc = perform_xfer(dev, op_code, false); + + if ((addr < 0) || ((addr + size) > flash_size)) { + return -EINVAL; + } + + rc = acquire(dev); if (rc < 0) { - LOG_ERR("%s 0x%02x failed: %d", __func__, op_code, rc); return rc; } - return 0; -} - -static int wait_until_ready(const struct device *dev, k_timeout_t poll_period) -{ - int rc; - uint8_t status_reg; - - while (true) { - rc = cmd_rdsr(dev, SPI_NOR_CMD_RDSR, &status_reg); - if (rc < 0) { - LOG_ERR("%s - status xfer failed: %d", __func__, rc); - return rc; - } - - if (!(status_reg & SPI_NOR_WIP_BIT)) { - break; - } + if (dev_config->jedec_cmds->read.force_single) { + rc = dev_cfg_apply(dev, &dev_config->mspi_nor_init_cfg); + } else { + rc = dev_cfg_apply(dev, &dev_config->mspi_nor_cfg); + } - k_sleep(poll_period); + if (rc < 0) { + return rc; } - return 0; -} + /* TODO: get rid of all these hard-coded values for MX25Ux chips */ + flash_mspi_command_set(dev, &dev_config->jedec_cmds->read); + dev_data->packet.address = addr; + dev_data->packet.data_buf = dest; + dev_data->packet.num_bytes = size; + rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, + &dev_data->xfer); -static int cmd_wren(const struct device *dev) -{ - int rc; + release(dev); - set_up_xfer(dev, MSPI_TX); - rc = perform_xfer(dev, SPI_NOR_CMD_WREN, false); if (rc < 0) { - LOG_ERR("%s failed: %d", __func__, rc); + LOG_ERR("Read xfer failed: %d", rc); return rc; } return 0; } -static int cmd_wrsr(const struct device *dev, uint8_t op_code, - uint8_t sr_cnt, uint8_t *sr) +static int status_get(const struct device *dev, uint8_t *status) { + const struct flash_mspi_nor_config *dev_config = dev->config; struct flash_mspi_nor_data *dev_data = dev->data; int rc; - rc = cmd_wren(dev); - if (rc < 0) { - return rc; + /* Enter command mode */ + if (dev_config->jedec_cmds->status.force_single) { + rc = dev_cfg_apply(dev, &dev_config->mspi_nor_init_cfg); + } else { + rc = dev_cfg_apply(dev, &dev_config->mspi_nor_cfg); } - set_up_xfer(dev, MSPI_TX); - dev_data->packet.num_bytes = sr_cnt; - dev_data->packet.data_buf = sr; - rc = perform_xfer(dev, op_code, false); if (rc < 0) { - LOG_ERR("%s 0x%02x failed: %d", __func__, op_code, rc); + LOG_ERR("Switching to dev_cfg failed: %d", rc); return rc; } - rc = wait_until_ready(dev, K_USEC(1)); + flash_mspi_command_set(dev, &dev_config->jedec_cmds->status); + dev_data->packet.data_buf = status; + dev_data->packet.num_bytes = sizeof(uint8_t); + + rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, &dev_data->xfer); + if (rc < 0) { + LOG_ERR("Status xfer failed: %d", rc); return rc; } - return 0; + return rc; } -static int api_read(const struct device *dev, off_t addr, void *dest, - size_t size) +static int wait_until_ready(const struct device *dev, k_timeout_t poll_period) { - const struct flash_mspi_nor_config *dev_config = dev->config; - struct flash_mspi_nor_data *dev_data = dev->data; - const uint32_t flash_size = dev_flash_size(dev); int rc; + uint8_t status_reg; - if (size == 0) { - return 0; - } + while (true) { + rc = status_get(dev, &status_reg); - if ((addr < 0) || ((addr + size) > flash_size)) { - return -EINVAL; - } + if (rc < 0) { + LOG_ERR("Wait until ready - status xfer failed: %d", rc); + return rc; + } - rc = acquire(dev); - if (rc < 0) { - return rc; + if (!(status_reg & SPI_NOR_WIP_BIT)) { + break; + } + + k_sleep(poll_period); } - set_up_xfer_with_addr(dev, MSPI_RX, addr); - if (dev_config->dts_rx_dummy != INVALID_DTS_RX_DUMMY) { - dev_data->xfer.rx_dummy = dev_config->dts_rx_dummy; + return 0; +} + +static int write_enable(const struct device *dev) +{ + const struct flash_mspi_nor_config *dev_config = dev->config; + struct flash_mspi_nor_data *dev_data = dev->data; + int rc; + + if (dev_config->jedec_cmds->write_en.force_single) { + rc = dev_cfg_apply(dev, &dev_config->mspi_nor_init_cfg); } else { - dev_data->xfer.rx_dummy = dev_data->cmd_info.read_mode_clocks - + dev_data->cmd_info.read_dummy_clocks; + rc = dev_cfg_apply(dev, &dev_config->mspi_nor_cfg); } - dev_data->packet.data_buf = dest; - dev_data->packet.num_bytes = size; - rc = perform_xfer(dev, dev_data->cmd_info.read_cmd, true); - - release(dev); if (rc < 0) { - LOG_ERR("Read xfer failed: %d", rc); return rc; } - return 0; + flash_mspi_command_set(dev, &dev_config->jedec_cmds->write_en); + return mspi_transceive(dev_config->bus, &dev_config->mspi_id, &dev_data->xfer); } static int api_write(const struct device *dev, off_t addr, const void *src, size_t size) { + const struct flash_mspi_nor_config *dev_config = dev->config; struct flash_mspi_nor_data *dev_data = dev->data; const uint32_t flash_size = dev_flash_size(dev); const uint16_t page_size = dev_page_size(dev); @@ -364,14 +268,27 @@ static int api_write(const struct device *dev, off_t addr, const void *src, uint16_t page_left = page_size - page_offset; uint16_t to_write = (uint16_t)MIN(size, page_left); - if (cmd_wren(dev) < 0) { + if (write_enable(dev) < 0) { + LOG_ERR("Write enable xfer failed: %d", rc); break; } - set_up_xfer_with_addr(dev, MSPI_TX, addr); + if (dev_config->jedec_cmds->page_program.force_single) { + rc = dev_cfg_apply(dev, &dev_config->mspi_nor_init_cfg); + } else { + rc = dev_cfg_apply(dev, &dev_config->mspi_nor_cfg); + } + + if (rc < 0) { + return rc; + } + + flash_mspi_command_set(dev, &dev_config->jedec_cmds->page_program); + dev_data->packet.address = addr; dev_data->packet.data_buf = (uint8_t *)src; dev_data->packet.num_bytes = to_write; - rc = perform_xfer(dev, dev_data->cmd_info.pp_cmd, true); + rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, + &dev_data->xfer); if (rc < 0) { LOG_ERR("Page program xfer failed: %d", rc); break; @@ -392,28 +309,9 @@ static int api_write(const struct device *dev, off_t addr, const void *src, return rc; } -static const struct jesd216_erase_type *find_best_erase_type( - const struct device *dev, off_t addr, size_t size) -{ - const struct jesd216_erase_type *erase_types = dev_erase_types(dev); - const struct jesd216_erase_type *best_et = NULL; - - for (int i = 0; i < JESD216_NUM_ERASE_TYPES; ++i) { - const struct jesd216_erase_type *et = &erase_types[i]; - - if ((et->exp != 0) - && SPI_NOR_IS_ALIGNED(addr, et->exp) - && (size >= BIT(et->exp)) - && ((best_et == NULL) || (et->exp > best_et->exp))) { - best_et = et; - } - } - - return best_et; -} - static int api_erase(const struct device *dev, off_t addr, size_t size) { + const struct flash_mspi_nor_config *dev_config = dev->config; struct flash_mspi_nor_data *dev_data = dev->data; const uint32_t flash_size = dev_flash_size(dev); int rc = 0; @@ -436,33 +334,45 @@ static int api_erase(const struct device *dev, off_t addr, size_t size) } while (size > 0) { - if (cmd_wren(dev) < 0) { + rc = write_enable(dev); + if (rc < 0) { + LOG_ERR("Write enable failed."); break; } if (size == flash_size) { /* Chip erase. */ - set_up_xfer(dev, MSPI_TX); - rc = perform_xfer(dev, SPI_NOR_CMD_CE, false); + if (dev_config->jedec_cmds->chip_erase.force_single) { + rc = dev_cfg_apply(dev, &dev_config->mspi_nor_init_cfg); + } else { + rc = dev_cfg_apply(dev, &dev_config->mspi_nor_cfg); + } + + if (rc < 0) { + return rc; + } + flash_mspi_command_set(dev, &dev_config->jedec_cmds->chip_erase); size -= flash_size; } else { - const struct jesd216_erase_type *best_et = - find_best_erase_type(dev, addr, size); - - if (best_et != NULL) { - set_up_xfer_with_addr(dev, MSPI_TX, addr); - rc = perform_xfer(dev, best_et->cmd, false); - - addr += BIT(best_et->exp); - size -= BIT(best_et->exp); + /* Sector erase. */ + if (dev_config->jedec_cmds->sector_erase.force_single) { + rc = dev_cfg_apply(dev, &dev_config->mspi_nor_init_cfg); } else { - LOG_ERR("Can't erase %zu at 0x%lx", - size, (long)addr); - rc = -EINVAL; - break; + rc = dev_cfg_apply(dev, &dev_config->mspi_nor_cfg); + } + + if (rc < 0) { + return rc; } + + flash_mspi_command_set(dev, &dev_config->jedec_cmds->sector_erase); + dev_data->packet.address = addr; + addr += SPI_NOR_SECTOR_SIZE; + size -= SPI_NOR_SECTOR_SIZE; } + rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, + &dev_data->xfer); if (rc < 0) { LOG_ERR("Erase command 0x%02x xfer failed: %d", dev_data->packet.cmd, rc); @@ -495,20 +405,28 @@ struct flash_parameters *api_get_parameters(const struct device *dev) static int read_jedec_id(const struct device *dev, uint8_t *id) { + const struct flash_mspi_nor_config *dev_config = dev->config; struct flash_mspi_nor_data *dev_data = dev->data; int rc; - set_up_xfer(dev, MSPI_RX); - if (dev_data->in_target_io_mode) { - dev_data->xfer.rx_dummy = dev_data->cmd_info.rdid_dummy; - dev_data->xfer.addr_length = dev_data->cmd_info.rdid_addr_4 - ? 4 : 0; + if (dev_config->jedec_cmds->id.force_single) { + rc = dev_cfg_apply(dev, &dev_config->mspi_nor_init_cfg); + } else { + rc = dev_cfg_apply(dev, &dev_config->mspi_nor_cfg); } + + if (rc < 0) { + return rc; + } + + flash_mspi_command_set(dev, &dev_config->jedec_cmds->id); dev_data->packet.data_buf = id; dev_data->packet.num_bytes = JESD216_READ_ID_LEN; - rc = perform_xfer(dev, SPI_NOR_CMD_RDID, false); + + rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, + &dev_data->xfer); if (rc < 0) { - LOG_ERR("Read JEDEC ID failed: %d", rc); + LOG_ERR("Read JEDEC ID failed: %d\n", rc); } return rc; @@ -530,6 +448,7 @@ static void api_page_layout(const struct device *dev, static int api_sfdp_read(const struct device *dev, off_t addr, void *dest, size_t size) { + const struct flash_mspi_nor_config *dev_config = dev->config; struct flash_mspi_nor_data *dev_data = dev->data; int rc; @@ -542,22 +461,25 @@ static int api_sfdp_read(const struct device *dev, off_t addr, void *dest, return rc; } - set_up_xfer(dev, MSPI_RX); - if (dev_data->in_target_io_mode) { - dev_data->xfer.rx_dummy = dev_data->cmd_info.sfdp_dummy_20 - ? 20 : 8; - dev_data->xfer.addr_length = dev_data->cmd_info.sfdp_addr_4 - ? 4 : 3; + if (dev_config->jedec_cmds->sfdp.force_single) { + rc = dev_cfg_apply(dev, &dev_config->mspi_nor_init_cfg); } else { - dev_data->xfer.rx_dummy = 8; - dev_data->xfer.addr_length = 3; + rc = dev_cfg_apply(dev, &dev_config->mspi_nor_cfg); } + + if (rc < 0) { + return rc; + } + + flash_mspi_command_set(dev, &dev_config->jedec_cmds->sfdp); dev_data->packet.address = addr; dev_data->packet.data_buf = dest; dev_data->packet.num_bytes = size; - rc = perform_xfer(dev, JESD216_CMD_READ_SFDP, false); + rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, + &dev_data->xfer); if (rc < 0) { - LOG_ERR("Read SFDP xfer failed: %d", rc); + printk("Read SFDP xfer failed: %d\n", rc); + return rc; } release(dev); @@ -597,19 +519,31 @@ static int dev_pm_action_cb(const struct device *dev, static int quad_enable_set(const struct device *dev, bool enable) { + const struct flash_mspi_nor_config *dev_config = dev->config; struct flash_mspi_nor_data *dev_data = dev->data; int rc; - rc = cmd_wren(dev); + flash_mspi_command_set(dev, &commands_single.write_en); + rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, + &dev_data->xfer); if (rc < 0) { LOG_ERR("Failed to set write enable: %d", rc); return rc; } if (dev_data->switch_info.quad_enable_req == JESD216_DW15_QER_VAL_S1B6) { + const struct flash_mspi_nor_cmd cmd_status = { + .dir = MSPI_TX, + .cmd = SPI_NOR_CMD_WRSR, + .cmd_length = 1, + }; uint8_t mode_payload = enable ? BIT(6) : 0; - rc = cmd_wrsr(dev, SPI_NOR_CMD_WRSR, 1, &mode_payload); + flash_mspi_command_set(dev, &cmd_status); + dev_data->packet.data_buf = &mode_payload; + dev_data->packet.num_bytes = sizeof(mode_payload); + rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, &dev_data->xfer); + if (rc < 0) { LOG_ERR("Failed to enable/disable quad mode: %d", rc); return rc; @@ -629,29 +563,8 @@ static int quad_enable_set(const struct device *dev, bool enable) return 0; } -static int enter_4byte_addressing_mode(const struct device *dev) -{ - struct flash_mspi_nor_data *dev_data = dev->data; - int rc; - - if (dev_data->switch_info.enter_4byte_addr == ENTER_4BYTE_ADDR_06_B7) { - rc = cmd_wren(dev); - if (rc < 0) { - return rc; - } - } - set_up_xfer(dev, MSPI_TX); - rc = perform_xfer(dev, 0xB7, false); - if (rc < 0) { - LOG_ERR("Command 0xB7 failed: %d", rc); - return rc; - } - - return 0; -} - -static int switch_to_target_io_mode(const struct device *dev) +static int default_io_mode(const struct device *dev) { const struct flash_mspi_nor_config *dev_config = dev->config; struct flash_mspi_nor_data *dev_data = dev->data; @@ -674,25 +587,16 @@ static int switch_to_target_io_mode(const struct device *dev) } } - if (dev_data->switch_info.enter_4byte_addr != ENTER_4BYTE_ADDR_NONE) { - rc = enter_4byte_addressing_mode(dev); - if (rc < 0) { - LOG_ERR("Failed to enter 4-byte addressing mode: %d", rc); - return rc; - } + if ((dev_config->quirks != NULL) && (dev_config->quirks->post_switch_mode != NULL)) { + rc = dev_config->quirks->post_switch_mode(dev); } - if (dev_config->quirks != NULL && - dev_config->quirks->post_switch_mode != NULL) { - rc = dev_config->quirks->post_switch_mode(dev); - if (rc < 0) { - return rc; - } + if (rc < 0) { + LOG_ERR("Failed to change IO mode: %d\n", rc); + return rc; } - return mspi_dev_config(dev_config->bus, &dev_config->mspi_id, - MSPI_DEVICE_CONFIG_ALL, - &dev_config->mspi_nor_cfg); + return dev_cfg_apply(dev, &dev_config->mspi_nor_cfg); } #if defined(WITH_RESET_GPIO) @@ -742,15 +646,12 @@ static int flash_chip_init(const struct device *dev) uint8_t id[JESD216_READ_ID_LEN] = {0}; int rc; - rc = mspi_dev_config(dev_config->bus, &dev_config->mspi_id, - MSPI_DEVICE_CONFIG_ALL, - &dev_config->mspi_nor_init_cfg); + rc = dev_cfg_apply(dev, &dev_config->mspi_nor_init_cfg); + if (rc < 0) { return rc; } - dev_data->in_target_io_mode = false; - /* Some chips reuse RESET pin for data in Quad modes: * force single line mode before resetting. */ @@ -782,25 +683,35 @@ static int flash_chip_init(const struct device *dev) } #endif - if (dev_config->quirks != NULL && - dev_config->quirks->pre_init != NULL) { - rc = dev_config->quirks->pre_init(dev); - } + flash_mspi_command_set(dev, &commands_single.id); + dev_data->packet.data_buf = id; + dev_data->packet.num_bytes = sizeof(id); - rc = switch_to_target_io_mode(dev); + rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, + &dev_data->xfer); if (rc < 0) { - LOG_ERR("Failed to switch to target io mode: %d", rc); + LOG_ERR("Failed to read JEDEC ID in initial line mode: %d", rc); return rc; } - dev_data->in_target_io_mode = true; + rc = default_io_mode(dev); - rc = read_jedec_id(dev, id); if (rc < 0) { - LOG_ERR("Failed to read JEDEC ID: %d", rc); + LOG_ERR("Failed to switch to default io mode: %d", rc); return rc; } + /* Reading JEDEC ID for mode that forces single lane would be redundant, + * since it switches back to single lane mode. Use ID from previous read. + */ + if (!dev_config->jedec_cmds->id.force_single) { + rc = read_jedec_id(dev, id); + if (rc < 0) { + LOG_ERR("Failed to read JEDEC ID in final line mode: %d", rc); + return rc; + } + } + if (memcmp(id, dev_config->jedec_id, sizeof(id)) != 0) { LOG_ERR("JEDEC ID mismatch, read: %02x %02x %02x, " "expected: %02x %02x %02x", @@ -860,51 +771,6 @@ static int drv_init(const struct device *dev) return rc; } - /* Allow users to specify commands for Read and Page Program operations - * through dts and override what was taken from SFDP. Also the number - * of dummy cycles for the Read operation can be overridden this way - * (see api_read() and dts_rx_dummy). - */ - if (dev_config->dts_read_command != 0) { - dev_data->cmd_info.read_cmd = dev_config->dts_read_command; - } - if (dev_config->dts_write_command != 0) { - dev_data->cmd_info.pp_cmd = dev_config->dts_write_command; - } - - if (dev_data->cmd_info.read_cmd == 0) { - LOG_ERR("Read command not defined for %s, " - "use \"read-command\" property to specify it.", - dev->name); - return -EINVAL; - } - - if (dev_data->cmd_info.pp_cmd == 0) { - LOG_ERR("Page Program command not defined for %s, " - "use \"write-command\" property to specify it.", - dev->name); - return -EINVAL; - } - - LOG_DBG("%s - size: %u, page %u%s", - dev->name, dev_flash_size(dev), dev_page_size(dev), - dev_data->cmd_info.uses_4byte_addr ? ", 4-byte addressing" : ""); - LOG_DBG("- read command: 0x%02X with %u mode and %u dummy cycles", - dev_data->cmd_info.read_cmd, - dev_data->cmd_info.read_mode_clocks, - dev_data->cmd_info.read_dummy_clocks); - LOG_DBG("- page program command: 0x%02X", - dev_data->cmd_info.pp_cmd); - LOG_DBG("- erase types:"); - for (int i = 0; i < JESD216_NUM_ERASE_TYPES; ++i) { - const struct jesd216_erase_type *et = &dev_erase_types(dev)[i]; - - if (et->exp != 0) { - LOG_DBG(" - command: 0x%02X, size: %lu", - et->cmd, BIT(et->exp)); - } - } - k_sem_init(&dev_data->acquired, 1, K_SEM_MAX_LIMIT); return pm_device_driver_init(dev, dev_pm_action_cb); @@ -946,18 +812,39 @@ static DEVICE_API(flash, drv_api) = { (FLASH_PAGE_EXP(inst) ? BIT(FLASH_PAGE_EXP(inst)) \ : SPI_NOR_PAGE_SIZE) -#define FLASH_QUIRKS(inst) FLASH_MSPI_QUIRKS_GET(DT_DRV_INST(inst)) +/* Define copies of mspi_io_mode enum values, so they can be used inside + * the COND_CODE_1 macros. + */ +#define _MSPI_IO_MODE_SINGLE 0 +#define _MSPI_IO_MODE_QUAD_1_4_4 6 +#define _MSPI_IO_MODE_OCTAL 7 +BUILD_ASSERT(_MSPI_IO_MODE_SINGLE == MSPI_IO_MODE_SINGLE, + "Please align _MSPI_IO_MODE_SINGLE macro value"); +BUILD_ASSERT(_MSPI_IO_MODE_QUAD_1_4_4 == MSPI_IO_MODE_QUAD_1_4_4, + "Please align _MSPI_IO_MODE_QUAD_1_4_4 macro value"); +BUILD_ASSERT(_MSPI_IO_MODE_OCTAL == MSPI_IO_MODE_OCTAL, + "Please align _MSPI_IO_MODE_OCTAL macro value"); + +/* Define a non-existing extern symbol to get an understandable compile-time error + * if the IO mode is not supported by the driver. + */ +extern const struct flash_mspi_nor_cmds mspi_io_mode_not_supported; + +#define FLASH_CMDS(inst) COND_CODE_1( \ + IS_EQ(DT_INST_ENUM_IDX(inst, mspi_io_mode), _MSPI_IO_MODE_SINGLE), \ + (&commands_single), \ + (COND_CODE_1( \ + IS_EQ(DT_INST_ENUM_IDX(inst, mspi_io_mode), _MSPI_IO_MODE_QUAD_1_4_4), \ + (&commands_quad_1_4_4), \ + (COND_CODE_1( \ + IS_EQ(DT_INST_ENUM_IDX(inst, mspi_io_mode), _MSPI_IO_MODE_OCTAL), \ + (&commands_octal), \ + (&mspi_io_mode_not_supported) \ + )) \ + )) \ +) -#define IO_MODE_FLAGS(io_mode) \ - .multi_io_cmd = (io_mode == MSPI_IO_MODE_DUAL || \ - io_mode == MSPI_IO_MODE_QUAD || \ - io_mode == MSPI_IO_MODE_OCTAL || \ - io_mode == MSPI_IO_MODE_HEX || \ - io_mode == MSPI_IO_MODE_HEX_8_8_16 || \ - io_mode == MSPI_IO_MODE_HEX_8_16_16), \ - .single_io_addr = (io_mode == MSPI_IO_MODE_DUAL_1_1_2 || \ - io_mode == MSPI_IO_MODE_QUAD_1_1_4 || \ - io_mode == MSPI_IO_MODE_OCTAL_1_1_8) +#define FLASH_QUIRKS(inst) FLASH_MSPI_QUIRKS_GET(DT_DRV_INST(inst)) #if defined(CONFIG_FLASH_PAGE_LAYOUT) BUILD_ASSERT((CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE % 4096) == 0, @@ -984,10 +871,14 @@ BUILD_ASSERT((FLASH_SIZE(inst) % CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE) == 0, \ #endif #define FLASH_MSPI_NOR_INST(inst) \ + BUILD_ASSERT((DT_INST_ENUM_IDX(inst, mspi_io_mode) == \ + MSPI_IO_MODE_SINGLE) || \ + (DT_INST_ENUM_IDX(inst, mspi_io_mode) == \ + MSPI_IO_MODE_QUAD_1_4_4) || \ + (DT_INST_ENUM_IDX(inst, mspi_io_mode) == \ + MSPI_IO_MODE_OCTAL), \ + "Only 1x, 1-4-4 and 8x I/O modes are supported for now"); \ SFDP_BUILD_ASSERTS(inst); \ - BUILD_ASSERT(DT_INST_PROP_OR(inst, rx_dummy, 0) != INVALID_DTS_RX_DUMMY,\ - "Invalid number of RX dummy clocks specified for " \ - DT_NODE_FULL_NAME(DT_DRV_INST(inst))); \ PM_DEVICE_DT_INST_DEFINE(inst, dev_pm_action_cb); \ DEFAULT_ERASE_TYPES_DEFINE(inst); \ static struct flash_mspi_nor_data dev##inst##_data; \ @@ -998,6 +889,10 @@ BUILD_ASSERT((FLASH_SIZE(inst) % CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE) == 0, \ .mspi_id = MSPI_DEVICE_ID_DT_INST(inst), \ .mspi_nor_cfg = MSPI_DEVICE_CONFIG_DT_INST(inst), \ .mspi_nor_init_cfg = FLASH_INITIAL_CONFIG(inst), \ + .mspi_nor_cfg_mask = DT_PROP(DT_INST_BUS(inst), \ + software_multiperipheral) \ + ? MSPI_DEVICE_CONFIG_ALL \ + : MSPI_DEVICE_CONFIG_NONE, \ IF_ENABLED(CONFIG_MSPI_XIP, \ (.xip_cfg = MSPI_XIP_CONFIG_DT_INST(inst),)) \ IF_ENABLED(WITH_RESET_GPIO, \ @@ -1009,17 +904,11 @@ BUILD_ASSERT((FLASH_SIZE(inst) % CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE) == 0, \ .transfer_timeout = DT_INST_PROP(inst, transfer_timeout), \ FLASH_PAGE_LAYOUT_DEFINE(inst) \ .jedec_id = DT_INST_PROP(inst, jedec_id), \ + .jedec_cmds = FLASH_CMDS(inst), \ .quirks = FLASH_QUIRKS(inst), \ .default_erase_types = DEFAULT_ERASE_TYPES(inst), \ .default_cmd_info = DEFAULT_CMD_INFO(inst), \ .default_switch_info = DEFAULT_SWITCH_INFO(inst), \ - .dts_read_command = DT_INST_PROP_OR(inst, read_command, 0), \ - .dts_write_command = DT_INST_PROP_OR(inst, write_command, 0), \ - .dts_rx_dummy = DT_INST_PROP_OR(inst, rx_dummy, \ - INVALID_DTS_RX_DUMMY), \ - .multiperipheral_bus = DT_PROP(DT_INST_BUS(inst), \ - software_multiperipheral), \ - IO_MODE_FLAGS(DT_INST_ENUM_IDX(inst, mspi_io_mode)), \ }; \ FLASH_PAGE_LAYOUT_CHECK(inst) \ DEVICE_DT_INST_DEFINE(inst, \ diff --git a/drivers/flash/flash_mspi_nor.h b/drivers/flash/flash_mspi_nor.h index f9da334b4d73..a68162f148a1 100644 --- a/drivers/flash/flash_mspi_nor.h +++ b/drivers/flash/flash_mspi_nor.h @@ -66,6 +66,7 @@ struct flash_mspi_nor_config { struct mspi_dev_id mspi_id; struct mspi_dev_cfg mspi_nor_cfg; struct mspi_dev_cfg mspi_nor_init_cfg; + enum mspi_dev_cfg_mask mspi_nor_cfg_mask; #if defined(CONFIG_MSPI_XIP) struct mspi_xip_cfg xip_cfg; #endif @@ -79,28 +80,213 @@ struct flash_mspi_nor_config { struct flash_pages_layout layout; #endif uint8_t jedec_id[SPI_NOR_MAX_ID_LEN]; + const struct flash_mspi_nor_cmds *jedec_cmds; struct flash_mspi_nor_quirks *quirks; const struct jesd216_erase_type *default_erase_types; struct flash_mspi_nor_cmd_info default_cmd_info; struct flash_mspi_nor_switch_info default_switch_info; - uint8_t dts_read_command; - uint8_t dts_rx_dummy; - uint8_t dts_write_command; - bool multiperipheral_bus : 1; - bool multi_io_cmd : 1; - bool single_io_addr : 1; }; struct flash_mspi_nor_data { struct k_sem acquired; struct mspi_xfer_packet packet; struct mspi_xfer xfer; + struct mspi_dev_cfg *curr_cfg; struct jesd216_erase_type erase_types[JESD216_NUM_ERASE_TYPES]; struct flash_mspi_nor_cmd_info cmd_info; struct flash_mspi_nor_switch_info switch_info; - bool in_target_io_mode; }; +struct flash_mspi_nor_cmd { + enum mspi_xfer_direction dir; + uint32_t cmd; + uint16_t tx_dummy; + uint16_t rx_dummy; + uint8_t cmd_length; + uint8_t addr_length; + bool force_single; +}; + +struct flash_mspi_nor_cmds { + struct flash_mspi_nor_cmd id; + struct flash_mspi_nor_cmd write_en; + struct flash_mspi_nor_cmd read; + struct flash_mspi_nor_cmd status; + struct flash_mspi_nor_cmd config; + struct flash_mspi_nor_cmd page_program; + struct flash_mspi_nor_cmd sector_erase; + struct flash_mspi_nor_cmd chip_erase; + struct flash_mspi_nor_cmd sfdp; +}; + +const struct flash_mspi_nor_cmds commands_single = { + .id = { + .dir = MSPI_RX, + .cmd = JESD216_CMD_READ_ID, + .cmd_length = 1, + }, + .write_en = { + .dir = MSPI_TX, + .cmd = SPI_NOR_CMD_WREN, + .cmd_length = 1, + }, + .read = { + .dir = MSPI_RX, + .cmd = SPI_NOR_CMD_READ_FAST, + .cmd_length = 1, + .addr_length = 3, + .rx_dummy = 8, + }, + .status = { + .dir = MSPI_RX, + .cmd = SPI_NOR_CMD_RDSR, + .cmd_length = 1, + }, + .config = { + .dir = MSPI_RX, + .cmd = SPI_NOR_CMD_RDCR, + .cmd_length = 1, + }, + .page_program = { + .dir = MSPI_TX, + .cmd = SPI_NOR_CMD_PP, + .cmd_length = 1, + .addr_length = 3, + }, + .sector_erase = { + .dir = MSPI_TX, + .cmd = SPI_NOR_CMD_SE, + .cmd_length = 1, + .addr_length = 3, + }, + .chip_erase = { + .dir = MSPI_TX, + .cmd = SPI_NOR_CMD_CE, + .cmd_length = 1, + }, + .sfdp = { + .dir = MSPI_RX, + .cmd = JESD216_CMD_READ_SFDP, + .cmd_length = 1, + .addr_length = 3, + .rx_dummy = 8, + }, +}; + +const struct flash_mspi_nor_cmds commands_quad_1_4_4 = { + .id = { + .dir = MSPI_RX, + .cmd = JESD216_CMD_READ_ID, + .cmd_length = 1, + .force_single = true, + }, + .write_en = { + .dir = MSPI_TX, + .cmd = SPI_NOR_CMD_WREN, + .cmd_length = 1, + }, + .read = { + .dir = MSPI_RX, + .cmd = SPI_NOR_CMD_4READ, + .cmd_length = 1, + .addr_length = 3, + .rx_dummy = 6, + }, + .status = { + .dir = MSPI_RX, + .cmd = SPI_NOR_CMD_RDSR, + .cmd_length = 1, + .force_single = true, + }, + .config = { + .dir = MSPI_RX, + .cmd = SPI_NOR_CMD_RDCR, + .cmd_length = 1, + .force_single = true, + }, + .page_program = { + .dir = MSPI_TX, + .cmd = SPI_NOR_CMD_PP_1_4_4, + .cmd_length = 1, + .addr_length = 3, + }, + .sector_erase = { + .dir = MSPI_TX, + .cmd = SPI_NOR_CMD_SE, + .cmd_length = 1, + .addr_length = 3, + .force_single = true, + }, + .chip_erase = { + .dir = MSPI_TX, + .cmd = SPI_NOR_CMD_CE, + .cmd_length = 1, + }, + .sfdp = { + .dir = MSPI_RX, + .cmd = JESD216_CMD_READ_SFDP, + .cmd_length = 1, + .addr_length = 3, + .rx_dummy = 8, + .force_single = true, + }, +}; + +const struct flash_mspi_nor_cmds commands_octal = { + .id = { + .dir = MSPI_RX, + .cmd = JESD216_OCMD_READ_ID, + .cmd_length = 2, + .addr_length = 4, + .rx_dummy = 4 + }, + .write_en = { + .dir = MSPI_TX, + .cmd = SPI_NOR_OCMD_WREN, + .cmd_length = 2, + }, + .read = { + .dir = MSPI_RX, + .cmd = SPI_NOR_OCMD_RD, + .cmd_length = 2, + .addr_length = 4, + .rx_dummy = 20, + }, + .status = { + .dir = MSPI_RX, + .cmd = SPI_NOR_OCMD_RDSR, + .cmd_length = 2, + .addr_length = 4, + .rx_dummy = 4, + }, + .page_program = { + .dir = MSPI_TX, + .cmd = SPI_NOR_OCMD_PAGE_PRG, + .cmd_length = 2, + .addr_length = 4, + }, + .sector_erase = { + .dir = MSPI_TX, + .cmd = SPI_NOR_OCMD_SE, + .cmd_length = 2, + .addr_length = 4, + }, + .chip_erase = { + .dir = MSPI_TX, + .cmd = SPI_NOR_OCMD_CE, + .cmd_length = 2, + }, + .sfdp = { + .dir = MSPI_RX, + .cmd = JESD216_OCMD_READ_SFDP, + .cmd_length = 2, + .addr_length = 4, + .rx_dummy = 20, + }, +}; + +void flash_mspi_command_set(const struct device *dev, const struct flash_mspi_nor_cmd *cmd); + #ifdef __cplusplus } #endif diff --git a/drivers/flash/flash_mspi_nor_quirks.h b/drivers/flash/flash_mspi_nor_quirks.h index 2231d776fc04..eb40ad1938aa 100644 --- a/drivers/flash/flash_mspi_nor_quirks.h +++ b/drivers/flash/flash_mspi_nor_quirks.h @@ -9,13 +9,6 @@ /* Flash chip specific quirks */ struct flash_mspi_nor_quirks { - /* Called at the beginning of the flash chip initialization, - * right after reset if any is performed. Can be used to alter - * structures that define communication with the chip, like - * `cmd_info`, `switch_info`, and `erase_types`, which are set - * to default values at this point. - */ - int (*pre_init)(const struct device *dev); /* Called after switching to default IO mode. */ int (*post_switch_mode)(const struct device *dev); }; @@ -71,29 +64,45 @@ static inline int mxicy_mx25r_post_switch_mode(const struct device *dev) } /* Wait for previous write to finish */ - rc = wait_until_ready(dev, K_USEC(1)); - if (rc < 0) { - return rc; - } + do { + flash_mspi_command_set(dev, &dev_config->jedec_cmds->status); + dev_data->packet.data_buf = &status; + dev_data->packet.num_bytes = sizeof(status); + rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, &dev_data->xfer); + if (rc < 0) { + return rc; + } + } while (status & SPI_NOR_WIP_BIT); /* Write enable */ - rc = cmd_wren(dev); + flash_mspi_command_set(dev, &commands_single.write_en); + rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, + &dev_data->xfer); if (rc < 0) { return rc; } /* Write status and config registers */ - set_up_xfer(dev, MSPI_TX); + const struct flash_mspi_nor_cmd cmd_status = { + .dir = MSPI_TX, + .cmd = SPI_NOR_CMD_WRSR, + .cmd_length = 1, + }; + + flash_mspi_command_set(dev, &cmd_status); dev_data->packet.data_buf = mxicy_mx25r_hp_payload; dev_data->packet.num_bytes = sizeof(mxicy_mx25r_hp_payload); - rc = perform_xfer(dev, SPI_NOR_CMD_WRSR, false); + rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, &dev_data->xfer); if (rc < 0) { return rc; } /* Wait for write to end and verify status register */ do { - rc = cmd_rdsr(dev, SPI_NOR_CMD_RDSR, &status); + flash_mspi_command_set(dev, &dev_config->jedec_cmds->status); + dev_data->packet.data_buf = &status; + dev_data->packet.num_bytes = sizeof(status); + rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, &dev_data->xfer); if (rc < 0) { return rc; } @@ -104,10 +113,10 @@ static inline int mxicy_mx25r_post_switch_mode(const struct device *dev) } /* Verify configuration registers */ - set_up_xfer(dev, MSPI_RX); - dev_data->packet.num_bytes = sizeof(config); + flash_mspi_command_set(dev, &dev_config->jedec_cmds->config); dev_data->packet.data_buf = config; - rc = perform_xfer(dev, SPI_NOR_CMD_RDCR, false); + dev_data->packet.num_bytes = sizeof(config); + rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, &dev_data->xfer); if (rc < 0) { return rc; } @@ -145,35 +154,29 @@ static inline int mxicy_mx25u_post_switch_mode(const struct device *dev) } /* Write enable */ - rc = cmd_wren(dev); + flash_mspi_command_set(dev, &commands_single.write_en); + rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, + &dev_data->xfer); if (rc < 0) { return rc; } /* Write config register 2 */ - set_up_xfer(dev, MSPI_TX); - dev_data->xfer.addr_length = 4; - dev_data->packet.address = 0; + const struct flash_mspi_nor_cmd cmd_status = { + .dir = MSPI_TX, + .cmd = SPI_NOR_CMD_WR_CFGREG2, + .cmd_length = 1, + .addr_length = 4, + }; + + flash_mspi_command_set(dev, &cmd_status); dev_data->packet.data_buf = &mxicy_mx25u_oe_payload; dev_data->packet.num_bytes = sizeof(mxicy_mx25u_oe_payload); - return perform_xfer(dev, SPI_NOR_CMD_WR_CFGREG2, false); -} - -static int mxicy_mx25u_pre_init(const struct device *dev) -{ - const struct flash_mspi_nor_config *dev_config = dev->config; - struct flash_mspi_nor_data *dev_data = dev->data; - - if (dev_config->mspi_nor_cfg.io_mode == MSPI_IO_MODE_OCTAL && - dev_config->mspi_nor_cfg.data_rate == MSPI_DATA_RATE_SINGLE) { - dev_data->cmd_info.cmd_extension = CMD_EXTENSION_INVERSE; - } - - return 0; + rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, &dev_data->xfer); + return rc; } struct flash_mspi_nor_quirks flash_quirks_mxicy_mx25u = { - .pre_init = mxicy_mx25u_pre_init, .post_switch_mode = mxicy_mx25u_post_switch_mode, }; diff --git a/drivers/flash/flash_mspi_nor_sfdp.h b/drivers/flash/flash_mspi_nor_sfdp.h index 1a15515c5651..71139623fff8 100644 --- a/drivers/flash/flash_mspi_nor_sfdp.h +++ b/drivers/flash/flash_mspi_nor_sfdp.h @@ -119,7 +119,6 @@ #define USES_4BYTE_ADDR(inst) \ (USES_OCTAL_IO(inst) || \ - DT_INST_PROP(inst, use_4byte_addressing) || \ BFP_DW1_ADDRESS_BYTES(inst) == JESD216_SFDP_BFP_DW1_ADDRBYTES_VAL_4B) #define CMD_EXTENSION(inst) \ @@ -329,17 +328,4 @@ BUILD_ASSERT(!USES_8D_8D_8D(inst) || \ BFP_DW18_CMD_EXT(inst) <= BFP_DW18_CMD_EXT_INV, \ "Unsupported Octal Command Extension mode in " \ - DT_NODE_FULL_NAME(DT_DRV_INST(inst))); \ - BUILD_ASSERT(!DT_INST_PROP(inst, use_4byte_addressing) || \ - (BFP_DW1_ADDRESS_BYTES(inst) \ - != JESD216_SFDP_BFP_DW1_ADDRBYTES_VAL_3B), \ - "Cannot use 4-byte addressing for " \ - DT_NODE_FULL_NAME(DT_DRV_INST(inst))); \ - BUILD_ASSERT(!DT_INST_PROP(inst, use_4byte_addressing) || \ - (BFP_ENTER_4BYTE_ADDR_METHODS(inst) \ - & (BFP_DW16_4B_ADDR_ENTER_B7 | \ - BFP_DW16_4B_ADDR_ENTER_06_B7 | \ - BFP_DW16_4B_ADDR_PER_CMD | \ - BFP_DW16_4B_ADDR_ALWAYS)), \ - "No supported method of entering 4-byte addressing mode for " \ DT_NODE_FULL_NAME(DT_DRV_INST(inst))) diff --git a/dts/bindings/mtd/jedec,mspi-nor.yaml b/dts/bindings/mtd/jedec,mspi-nor.yaml index e21057cc803a..09660b841591 100644 --- a/dts/bindings/mtd/jedec,mspi-nor.yaml +++ b/dts/bindings/mtd/jedec,mspi-nor.yaml @@ -30,11 +30,3 @@ properties: Maximum time, in milliseconds, allowed for a single transfer on the MSPI bus in communication with the flash chip. The default value is the one that was previously hard-coded in the flash_mspi_nor driver. - - use-4byte-addressing: - type: boolean - description: | - Indicates that 4-byte addressing is to be used in communication with - the flash chip. The driver will use dedicated instruction codes for - commands that require addresses (like Read, Page Program, or Erase) - and will switch the flash chip to 4-byte addressing mode if necessary. From c86fc5ba400589f90c0294abeb578bc296651293 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Wed, 10 Sep 2025 13:37:35 +0200 Subject: [PATCH 0762/2141] Revert "[nrf fromlist] drivers: flash_mspi_nor: Get info from dts SFDP arrays" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit d01522d5e70f52bff1ce751a72d962c404640f02. Signed-off-by: Andrzej Głąbek --- .../nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 7 - .../nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts | 7 - drivers/flash/flash_mspi_nor.c | 46 +-- drivers/flash/flash_mspi_nor.h | 47 +-- drivers/flash/flash_mspi_nor_sfdp.h | 331 ------------------ dts/bindings/mtd/jedec,jesd216.yaml | 12 - 6 files changed, 16 insertions(+), 434 deletions(-) delete mode 100644 drivers/flash/flash_mspi_nor_sfdp.h diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index e086601abae9..2c86129c0f38 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -285,13 +285,6 @@ slot3_partition: &cpurad_slot1_partition { 30 b0 30 b0 f4 bd d5 5c 00 00 00 ff 10 10 00 20 00 00 00 00 00 00 7c 23 48 00 00 00 00 00 88 88 ]; - sfdp-ff05 = [ - 00 ee c0 69 72 72 71 71 00 d8 f7 f6 00 0a 00 00 - 14 45 98 80 - ]; - sfdp-ff84 = [ - 43 06 0f 00 21 dc ff ff - ]; size = <67108864>; has-dpd; t-enter-dpd = <10000>; diff --git a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts index 8920d7966bbf..1c8622c07803 100644 --- a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts +++ b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts @@ -265,13 +265,6 @@ ipc0: &cpuapp_cpurad_ipc { 30 b0 30 b0 f4 bd d5 5c 00 00 00 ff 10 10 00 20 00 00 00 00 00 00 7c 23 48 00 00 00 00 00 88 88 ]; - sfdp-ff05 = [ - 00 ee c0 69 72 72 71 71 00 d8 f7 f6 00 0a 00 00 - 14 45 98 80 - ]; - sfdp-ff84 = [ - 43 06 0f 00 21 dc ff ff - ]; size = <67108864>; has-dpd; t-enter-dpd = <10000>; diff --git a/drivers/flash/flash_mspi_nor.c b/drivers/flash/flash_mspi_nor.c index 2403160e296a..ae22202e075d 100644 --- a/drivers/flash/flash_mspi_nor.c +++ b/drivers/flash/flash_mspi_nor.c @@ -12,7 +12,6 @@ #include #include "flash_mspi_nor.h" -#include "flash_mspi_nor_sfdp.h" #include "flash_mspi_nor_quirks.h" LOG_MODULE_REGISTER(flash_mspi_nor, CONFIG_FLASH_LOG_LEVEL); @@ -111,9 +110,7 @@ static inline uint32_t dev_flash_size(const struct device *dev) static inline uint16_t dev_page_size(const struct device *dev) { - const struct flash_mspi_nor_config *dev_config = dev->config; - - return dev_config->page_size; + return SPI_NOR_PAGE_SIZE; } static int api_read(const struct device *dev, off_t addr, void *dest, @@ -531,7 +528,7 @@ static int quad_enable_set(const struct device *dev, bool enable) return rc; } - if (dev_data->switch_info.quad_enable_req == JESD216_DW15_QER_VAL_S1B6) { + if (dev_config->dw15_qer == JESD216_DW15_QER_VAL_S1B6) { const struct flash_mspi_nor_cmd cmd_status = { .dir = MSPI_TX, .cmd = SPI_NOR_CMD_WRSR, @@ -567,11 +564,10 @@ static int quad_enable_set(const struct device *dev, bool enable) static int default_io_mode(const struct device *dev) { const struct flash_mspi_nor_config *dev_config = dev->config; - struct flash_mspi_nor_data *dev_data = dev->data; enum mspi_io_mode io_mode = dev_config->mspi_nor_cfg.io_mode; int rc = 0; - if (dev_data->switch_info.quad_enable_req != JESD216_DW15_QER_VAL_NONE) { + if (dev_config->dw15_qer != JESD216_DW15_QER_VAL_NONE) { /* For Quad 1-1-4 and 1-4-4, entering or leaving mode is defined * in JEDEC216 BFP DW15 QER */ @@ -655,7 +651,7 @@ static int flash_chip_init(const struct device *dev) /* Some chips reuse RESET pin for data in Quad modes: * force single line mode before resetting. */ - if (dev_data->switch_info.quad_enable_req != JESD216_DW15_QER_VAL_NONE && + if (dev_config->dw15_qer != JESD216_DW15_QER_VAL_NONE && (io_mode == MSPI_IO_MODE_SINGLE || io_mode == MSPI_IO_MODE_QUAD_1_1_4 || io_mode == MSPI_IO_MODE_QUAD_1_4_4)) { @@ -747,11 +743,6 @@ static int drv_init(const struct device *dev) return -ENODEV; } - memcpy(dev_data->erase_types, dev_config->default_erase_types, - sizeof(dev_data->erase_types)); - dev_data->cmd_info = dev_config->default_cmd_info; - dev_data->switch_info = dev_config->default_switch_info; - rc = pm_device_runtime_get(dev_config->bus); if (rc < 0) { LOG_ERR("pm_device_runtime_get() failed: %d", rc); @@ -802,15 +793,7 @@ static DEVICE_API(flash, drv_api) = { .dqs_enable = false, \ } -#define FLASH_SIZE(inst) \ - (DT_INST_NODE_HAS_PROP(inst, size) \ - ? DT_INST_PROP(inst, size) / 8 \ - : BFP_FLASH_DENSITY(SFDP_DW(inst, sfdp_bfp, 2)) / 8) - -#define FLASH_PAGE_EXP(inst) SFDP_FIELD(inst, sfdp_bfp, 11, GENMASK(7, 4)) -#define FLASH_PAGE_SIZE(inst) \ - (FLASH_PAGE_EXP(inst) ? BIT(FLASH_PAGE_EXP(inst)) \ - : SPI_NOR_PAGE_SIZE) +#define FLASH_SIZE_INST(inst) (DT_INST_PROP(inst, size) / 8) /* Define copies of mspi_io_mode enum values, so they can be used inside * the COND_CODE_1 macros. @@ -846,17 +829,23 @@ extern const struct flash_mspi_nor_cmds mspi_io_mode_not_supported; #define FLASH_QUIRKS(inst) FLASH_MSPI_QUIRKS_GET(DT_DRV_INST(inst)) +#define FLASH_DW15_QER_VAL(inst) _CONCAT(JESD216_DW15_QER_VAL_, \ + DT_INST_STRING_TOKEN(inst, quad_enable_requirements)) +#define FLASH_DW15_QER(inst) COND_CODE_1(DT_INST_NODE_HAS_PROP(inst, quad_enable_requirements), \ + (FLASH_DW15_QER_VAL(inst)), (JESD216_DW15_QER_VAL_NONE)) + + #if defined(CONFIG_FLASH_PAGE_LAYOUT) BUILD_ASSERT((CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE % 4096) == 0, "MSPI_NOR_FLASH_LAYOUT_PAGE_SIZE must be multiple of 4096"); #define FLASH_PAGE_LAYOUT_DEFINE(inst) \ .layout = { \ .pages_size = CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE, \ - .pages_count = FLASH_SIZE(inst) \ + .pages_count = FLASH_SIZE_INST(inst) \ / CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE, \ }, #define FLASH_PAGE_LAYOUT_CHECK(inst) \ -BUILD_ASSERT((FLASH_SIZE(inst) % CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE) == 0, \ +BUILD_ASSERT((FLASH_SIZE_INST(inst) % CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE) == 0, \ "MSPI_NOR_FLASH_LAYOUT_PAGE_SIZE incompatible with flash size, instance " #inst); #else #define FLASH_PAGE_LAYOUT_DEFINE(inst) @@ -878,14 +867,11 @@ BUILD_ASSERT((FLASH_SIZE(inst) % CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE) == 0, \ (DT_INST_ENUM_IDX(inst, mspi_io_mode) == \ MSPI_IO_MODE_OCTAL), \ "Only 1x, 1-4-4 and 8x I/O modes are supported for now"); \ - SFDP_BUILD_ASSERTS(inst); \ PM_DEVICE_DT_INST_DEFINE(inst, dev_pm_action_cb); \ - DEFAULT_ERASE_TYPES_DEFINE(inst); \ static struct flash_mspi_nor_data dev##inst##_data; \ static const struct flash_mspi_nor_config dev##inst##_config = { \ .bus = DEVICE_DT_GET(DT_INST_BUS(inst)), \ - .flash_size = FLASH_SIZE(inst), \ - .page_size = FLASH_PAGE_SIZE(inst), \ + .flash_size = FLASH_SIZE_INST(inst), \ .mspi_id = MSPI_DEVICE_ID_DT_INST(inst), \ .mspi_nor_cfg = MSPI_DEVICE_CONFIG_DT_INST(inst), \ .mspi_nor_init_cfg = FLASH_INITIAL_CONFIG(inst), \ @@ -906,9 +892,7 @@ BUILD_ASSERT((FLASH_SIZE(inst) % CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE) == 0, \ .jedec_id = DT_INST_PROP(inst, jedec_id), \ .jedec_cmds = FLASH_CMDS(inst), \ .quirks = FLASH_QUIRKS(inst), \ - .default_erase_types = DEFAULT_ERASE_TYPES(inst), \ - .default_cmd_info = DEFAULT_CMD_INFO(inst), \ - .default_switch_info = DEFAULT_SWITCH_INFO(inst), \ + .dw15_qer = FLASH_DW15_QER(inst), \ }; \ FLASH_PAGE_LAYOUT_CHECK(inst) \ DEVICE_DT_INST_DEFINE(inst, \ diff --git a/drivers/flash/flash_mspi_nor.h b/drivers/flash/flash_mspi_nor.h index a68162f148a1..ad957f24bc79 100644 --- a/drivers/flash/flash_mspi_nor.h +++ b/drivers/flash/flash_mspi_nor.h @@ -20,49 +20,9 @@ extern "C" { #define WITH_RESET_GPIO 1 #endif -#define CMD_EXTENSION_NONE 0 -#define CMD_EXTENSION_SAME 1 -#define CMD_EXTENSION_INVERSE 2 - -#define ENTER_4BYTE_ADDR_NONE 0 -#define ENTER_4BYTE_ADDR_B7 1 -#define ENTER_4BYTE_ADDR_06_B7 2 - -struct flash_mspi_nor_cmd_info { - uint8_t read_cmd; - uint8_t read_mode_clocks : 3; - uint8_t read_dummy_clocks : 5; - uint8_t pp_cmd; - bool uses_4byte_addr : 1; - /* BFP, 18th DWORD, bits 30-29 */ - uint8_t cmd_extension : 2; - /* xSPI Profile 1.0 (ID FF05), 1st DWORD: */ - /* - Read SFDP command address bytes: 4 (true) or 3 */ - bool sfdp_addr_4 : 1; - /* - Read SDFP command dummy cycles: 20 (true) or 8 */ - bool sfdp_dummy_20 : 1; - /* - Read Status Register command address bytes: 4 (true) or 0 */ - bool rdsr_addr_4 : 1; - /* - Read Status Register command dummy cycles: 0, 4, or 8 */ - uint8_t rdsr_dummy : 4; - /* - Read JEDEC ID command parameters; not sure where to get their - * values from, but since for many flash chips they are the same - * as for RDSR, those are taken as defaults, see DEFAULT_CMD_INFO() - */ - bool rdid_addr_4 : 1; - uint8_t rdid_dummy : 4; -}; - -struct flash_mspi_nor_switch_info { - uint8_t quad_enable_req : 3; - uint8_t octal_enable_req : 3; - uint8_t enter_4byte_addr : 2; -}; - struct flash_mspi_nor_config { const struct device *bus; uint32_t flash_size; - uint16_t page_size; struct mspi_dev_id mspi_id; struct mspi_dev_cfg mspi_nor_cfg; struct mspi_dev_cfg mspi_nor_init_cfg; @@ -82,9 +42,7 @@ struct flash_mspi_nor_config { uint8_t jedec_id[SPI_NOR_MAX_ID_LEN]; const struct flash_mspi_nor_cmds *jedec_cmds; struct flash_mspi_nor_quirks *quirks; - const struct jesd216_erase_type *default_erase_types; - struct flash_mspi_nor_cmd_info default_cmd_info; - struct flash_mspi_nor_switch_info default_switch_info; + uint8_t dw15_qer; }; struct flash_mspi_nor_data { @@ -92,9 +50,6 @@ struct flash_mspi_nor_data { struct mspi_xfer_packet packet; struct mspi_xfer xfer; struct mspi_dev_cfg *curr_cfg; - struct jesd216_erase_type erase_types[JESD216_NUM_ERASE_TYPES]; - struct flash_mspi_nor_cmd_info cmd_info; - struct flash_mspi_nor_switch_info switch_info; }; struct flash_mspi_nor_cmd { diff --git a/drivers/flash/flash_mspi_nor_sfdp.h b/drivers/flash/flash_mspi_nor_sfdp.h deleted file mode 100644 index 71139623fff8..000000000000 --- a/drivers/flash/flash_mspi_nor_sfdp.h +++ /dev/null @@ -1,331 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#define BFP_DW16_4B_ADDR_ENTER_B7 BIT(0) -#define BFP_DW16_4B_ADDR_ENTER_06_B7 BIT(1) -#define BFP_DW16_4B_ADDR_PER_CMD BIT(5) -#define BFP_DW16_4B_ADDR_ALWAYS BIT(6) - -#define BFP_DW18_CMD_EXT_SAME 0 -#define BFP_DW18_CMD_EXT_INV 1 - -#define BFP_DW19_OER_VAL_NONE 0 -#define BFP_DW19_OER_VAL_S2B3 1 - -/* 32-bit words in SFDP arrays in devicetree are stored in little-endian byte - * order. See jedec,jesd216.yaml - */ -#define SFDP_DW_BYTE_0_IDX(dw_no) \ - UTIL_DEC(UTIL_DEC(UTIL_DEC(UTIL_DEC(UTIL_X2(UTIL_X2(dw_no)))))) -#define SFDP_DW_BYTE_1_IDX(dw_no) \ - UTIL_DEC(UTIL_DEC(UTIL_DEC(UTIL_X2(UTIL_X2(dw_no))))) -#define SFDP_DW_BYTE_2_IDX(dw_no) \ - UTIL_DEC(UTIL_DEC(UTIL_X2(UTIL_X2(dw_no)))) -#define SFDP_DW_BYTE_3_IDX(dw_no) \ - UTIL_DEC(UTIL_X2(UTIL_X2(dw_no))) -#define SFDP_DW_BYTE(inst, prop, dw_no, byte_idx) \ - DT_INST_PROP_BY_IDX(inst, prop, SFDP_DW_BYTE_##byte_idx##_IDX(dw_no)) -#define SFDP_DW_EXISTS(inst, prop, dw_no) \ - DT_INST_PROP_HAS_IDX(inst, prop, SFDP_DW_BYTE_3_IDX(dw_no)) - -#define SFDP_DW(inst, prop, dw_no) \ - COND_CODE_1(SFDP_DW_EXISTS(inst, prop, dw_no), \ - (((SFDP_DW_BYTE(inst, prop, dw_no, 3) << 24) | \ - (SFDP_DW_BYTE(inst, prop, dw_no, 2) << 16) | \ - (SFDP_DW_BYTE(inst, prop, dw_no, 1) << 8) | \ - (SFDP_DW_BYTE(inst, prop, dw_no, 0) << 0))), \ - (0)) - -#define SFDP_FIELD(inst, prop, dw_no, mask) \ - FIELD_GET(mask, SFDP_DW(inst, prop, dw_no)) - -#define BFP_FLASH_DENSITY(dw2) \ - ((dw2 & BIT(31)) \ - ? BIT(dw2 & BIT_MASK(31)) \ - : dw2) - -/* Quad Enable Requirement from 15th DWORD of BFP */ -#define BSP_DW15_QER(inst) \ - DT_INST_ENUM_IDX_OR(inst, quad_enable_requirements, \ - SFDP_FIELD(inst, sfdp_bfp, 15, GENMASK(22, 20))) - -/* Octal Enable Requirement from 19th DWORD of BFP */ -#define BSP_DW19_OER(inst) \ - SFDP_FIELD(inst, sfdp_bfp, 19, GENMASK(22, 20)) - -#define BFP_DW1_ADDRESS_BYTES(inst) \ - SFDP_FIELD(inst, sfdp_bfp, 1, GENMASK(18, 17)) - -#define BFP_DW18_CMD_EXT(inst) \ - SFDP_FIELD(inst, sfdp_bfp, 18, GENMASK(30, 29)) - -#define BFP_ENTER_4BYTE_ADDR_METHODS(inst) \ - SFDP_FIELD(inst, sfdp_bfp, 16, GENMASK(31, 24)) - -#define USES_8D_8D_8D(inst) \ - (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_OCTAL && \ - DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_DUAL) -#define USES_8S_8S_8S(inst) \ - (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_OCTAL && \ - DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_SINGLE) -#define USES_1S_8D_8D(inst) \ - (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_OCTAL_1_8_8 && \ - DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_DUAL) -#define USES_1S_8S_8S(inst) \ - (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_OCTAL_1_8_8 && \ - DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_SINGLE) -#define USES_1S_1S_8S(inst) \ - (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_OCTAL_1_1_8 && \ - DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_SINGLE) -#define USES_4S_4D_4D(inst) \ - (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_QUAD && \ - DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_DUAL) -#define USES_4S_4S_4S(inst) \ - (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_QUAD && \ - DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_SINGLE) -#define USES_1S_4D_4D(inst) \ - (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_QUAD_1_4_4 && \ - DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_DUAL) -#define USES_1S_4S_4S(inst) \ - (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_QUAD_1_4_4 && \ - DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_SINGLE) -#define USES_1S_1S_4S(inst) \ - (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_QUAD_1_1_4 && \ - DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_SINGLE) -#define USES_2S_2S_2S(inst) \ - (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_DUAL && \ - DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_SINGLE) -#define USES_1S_2D_2D(inst) \ - (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_DUAL_1_2_2 && \ - DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_DUAL) -#define USES_1S_2S_2S(inst) \ - (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_DUAL_1_2_2 && \ - DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_SINGLE) -#define USES_1S_1S_2S(inst) \ - (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_DUAL_1_1_2 && \ - DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_SINGLE) -#define USES_1S_1D_1D(inst) \ - (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_SINGLE && \ - DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_DUAL) -#define USES_1S_1S_1S(inst) \ - (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_SINGLE && \ - DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_SINGLE) - -#define USES_OCTAL_IO(inst) \ - (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_OCTAL) - -#define USES_4BYTE_ADDR(inst) \ - (USES_OCTAL_IO(inst) || \ - BFP_DW1_ADDRESS_BYTES(inst) == JESD216_SFDP_BFP_DW1_ADDRBYTES_VAL_4B) - -#define CMD_EXTENSION(inst) \ - (!USES_8D_8D_8D(inst) ? CMD_EXTENSION_NONE : \ - (BFP_DW18_CMD_EXT(inst) \ - == BFP_DW18_CMD_EXT_INV) ? CMD_EXTENSION_INVERSE \ - : CMD_EXTENSION_SAME) - - -#define FF84_DW1_BIT(inst, bit) (SFDP_DW(inst, sfdp_ff84, 1) & BIT(bit)) - -#define SFDP_CMD_PP(inst) \ - USES_1S_4S_4S(inst) ? SPI_NOR_CMD_PP_1_4_4 : \ - USES_1S_1S_4S(inst) ? SPI_NOR_CMD_PP_1_1_4 : \ - SPI_NOR_CMD_PP -#define SFDP_CMD_PP_4B(inst) \ - USES_1S_8S_8S(inst) && FF84_DW1_BIT(inst, 24) ? 0x8E : \ - USES_1S_1S_8S(inst) && FF84_DW1_BIT(inst, 23) ? 0x84 : \ - USES_1S_4S_4S(inst) && FF84_DW1_BIT(inst, 8) ? SPI_NOR_CMD_PP_1_4_4_4B : \ - USES_1S_1S_4S(inst) && FF84_DW1_BIT(inst, 7) ? SPI_NOR_CMD_PP_1_1_4_4B : \ - FF84_DW1_BIT(inst, 6) ? SPI_NOR_CMD_PP_4B \ - : 0 -#define SFDP_CMD_FAST_READ(inst) \ - USES_1S_8D_8D(inst) ? 0 : \ - USES_1S_8S_8S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 17, GENMASK(15, 8)) : \ - USES_1S_1S_8S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 17, GENMASK(31, 24)) : \ - USES_4S_4D_4D(inst) ? SFDP_FIELD(inst, sfdp_bfp, 23, GENMASK(31, 24)) : \ - USES_4S_4S_4S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 7, GENMASK(31, 24)) : \ - USES_1S_4D_4D(inst) ? SFDP_FIELD(inst, sfdp_bfp, 23, GENMASK(15, 8)) : \ - USES_1S_4S_4S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 3, GENMASK(15, 8)) : \ - USES_1S_1S_4S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 3, GENMASK(31, 24)) : \ - USES_2S_2S_2S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 6, GENMASK(31, 24)) : \ - USES_1S_2D_2D(inst) ? SFDP_FIELD(inst, sfdp_bfp, 22, GENMASK(31, 24)) : \ - USES_1S_2S_2S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 4, GENMASK(31, 24)) : \ - USES_1S_1S_2S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 4, GENMASK(15, 8)) : \ - USES_1S_1D_1D(inst) ? SFDP_FIELD(inst, sfdp_bfp, 22, GENMASK(15, 8)) : \ - SPI_NOR_CMD_READ_FAST -#define SFDP_CMD_FAST_READ_4B(inst) \ - USES_8D_8D_8D(inst) ? 0xEE : \ - USES_8S_8S_8S(inst) ? 0xEC : \ - USES_1S_8D_8D(inst) && FF84_DW1_BIT(inst, 22) ? 0xFD : \ - USES_1S_8S_8S(inst) && FF84_DW1_BIT(inst, 21) ? 0xCC : \ - USES_1S_1S_8S(inst) && FF84_DW1_BIT(inst, 20) ? 0x7C : \ - USES_4S_4D_4D(inst) ? 0 : \ - USES_4S_4S_4S(inst) ? 0 : \ - USES_1S_4D_4D(inst) && FF84_DW1_BIT(inst, 15) ? 0xEE : \ - USES_1S_4S_4S(inst) && FF84_DW1_BIT(inst, 5) ? 0xEC : \ - USES_1S_1S_4S(inst) && FF84_DW1_BIT(inst, 4) ? 0x6C : \ - USES_2S_2S_2S(inst) ? 0 : \ - USES_1S_2D_2D(inst) && FF84_DW1_BIT(inst, 14) ? 0xBE : \ - USES_1S_2S_2S(inst) && FF84_DW1_BIT(inst, 3) ? 0xBC : \ - USES_1S_1S_2S(inst) && FF84_DW1_BIT(inst, 2) ? 0x3C : \ - USES_1S_1D_1D(inst) && FF84_DW1_BIT(inst, 13) ? 0x0E : \ - FF84_DW1_BIT(inst, 1) ? SPI_NOR_CMD_READ_FAST_4B : \ - 0 - -#define DEFAULT_CMD_INFO(inst) { \ - .pp_cmd = USES_4BYTE_ADDR(inst) \ - ? SFDP_CMD_PP_4B(inst) \ - : SFDP_CMD_PP(inst), \ - .read_cmd = USES_4BYTE_ADDR(inst) \ - ? SFDP_CMD_FAST_READ_4B(inst) \ - : SFDP_CMD_FAST_READ(inst), \ - .read_mode_clocks = \ - USES_1S_8S_8S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 17, GENMASK(7, 5)) : \ - USES_1S_1S_8S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 17, GENMASK(23, 21)) : \ - USES_4S_4D_4D(inst) ? SFDP_FIELD(inst, sfdp_bfp, 23, GENMASK(23, 21)) : \ - USES_4S_4S_4S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 7, GENMASK(23, 21)) : \ - USES_1S_4D_4D(inst) ? SFDP_FIELD(inst, sfdp_bfp, 23, GENMASK(7, 5)) : \ - USES_1S_4S_4S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 3, GENMASK(7, 5)) : \ - USES_1S_1S_4S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 3, GENMASK(23, 21)) : \ - USES_2S_2S_2S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 6, GENMASK(23, 21)) : \ - USES_1S_2D_2D(inst) ? SFDP_FIELD(inst, sfdp_bfp, 22, GENMASK(23, 21)) : \ - USES_1S_2S_2S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 4, GENMASK(23, 21)) : \ - USES_1S_1S_2S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 4, GENMASK(7, 5)) : \ - USES_1S_1D_1D(inst) ? SFDP_FIELD(inst, sfdp_bfp, 22, GENMASK(7, 5)) : \ - USES_1S_1S_1S(inst) ? 0 : \ - 0, \ - .read_dummy_clocks = DT_INST_PROP_OR(inst, rx_dummy, \ - USES_8D_8D_8D(inst) ? 20 : \ - USES_8S_8S_8S(inst) ? 20 : \ - USES_1S_8S_8S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 17, GENMASK(4, 0)) : \ - USES_1S_1S_8S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 17, GENMASK(20, 16)) : \ - USES_4S_4D_4D(inst) ? SFDP_FIELD(inst, sfdp_bfp, 23, GENMASK(20, 16)) : \ - USES_4S_4S_4S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 7, GENMASK(20, 16)) : \ - USES_1S_4D_4D(inst) ? SFDP_FIELD(inst, sfdp_bfp, 23, GENMASK(4, 0)) : \ - USES_1S_4S_4S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 3, GENMASK(4, 0)) : \ - USES_1S_1S_4S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 3, GENMASK(20, 16)) : \ - USES_2S_2S_2S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 6, GENMASK(20, 16)) : \ - USES_1S_2D_2D(inst) ? SFDP_FIELD(inst, sfdp_bfp, 22, GENMASK(20, 16)) : \ - USES_1S_2S_2S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 4, GENMASK(20, 16)) : \ - USES_1S_1S_2S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 4, GENMASK(4, 0)) : \ - USES_1S_1D_1D(inst) ? SFDP_FIELD(inst, sfdp_bfp, 22, GENMASK(4, 0)) : \ - USES_1S_1S_1S(inst) ? 8 : \ - 0), \ - .uses_4byte_addr = USES_4BYTE_ADDR(inst), \ - .cmd_extension = CMD_EXTENSION(inst), \ - .sfdp_addr_4 = USES_OCTAL_IO(inst) \ - ? (SFDP_FIELD(inst, sfdp_ff05, 1, BIT(31)) == 0) \ - : false, \ - .sfdp_dummy_20 = USES_OCTAL_IO(inst) \ - ? (SFDP_FIELD(inst, sfdp_ff05, 1, BIT(30)) == 1) \ - : false, \ - .rdsr_addr_4 = USES_OCTAL_IO(inst) \ - ? (SFDP_FIELD(inst, sfdp_ff05, 1, BIT(29)) == 1) \ - : false, \ - .rdsr_dummy = USES_OCTAL_IO(inst) \ - ? (SFDP_FIELD(inst, sfdp_ff05, 1, BIT(28)) ? 8 : 4) \ - : 0, \ - .rdid_addr_4 = USES_OCTAL_IO(inst) \ - ? (SFDP_FIELD(inst, sfdp_ff05, 1, BIT(29)) == 1) \ - : false, \ - .rdid_dummy = USES_OCTAL_IO(inst) \ - ? (SFDP_FIELD(inst, sfdp_ff05, 1, BIT(28)) ? 8 : 4) \ - : 0, } - -/* Erase Types, 8th and 9th DWORD of BSP */ -#define BFP_DW8_CMD_ET_1(inst) SFDP_FIELD(inst, sfdp_bfp, 8, GENMASK(15, 8)) -#define BFP_DW8_EXP_ET_1(inst) SFDP_FIELD(inst, sfdp_bfp, 8, GENMASK(7, 0)) -#define BFP_DW8_CMD_ET_2(inst) SFDP_FIELD(inst, sfdp_bfp, 8, GENMASK(31, 24)) -#define BFP_DW8_EXP_ET_2(inst) SFDP_FIELD(inst, sfdp_bfp, 8, GENMASK(23, 16)) -#define BFP_DW9_CMD_ET_3(inst) SFDP_FIELD(inst, sfdp_bfp, 9, GENMASK(15, 8)) -#define BFP_DW9_EXP_ET_3(inst) SFDP_FIELD(inst, sfdp_bfp, 9, GENMASK(7, 0)) -#define BFP_DW9_CMD_ET_4(inst) SFDP_FIELD(inst, sfdp_bfp, 9, GENMASK(31, 24)) -#define BFP_DW9_EXP_ET_4(inst) SFDP_FIELD(inst, sfdp_bfp, 9, GENMASK(23, 16)) - -/* 4-byte Address instructions for Erase Types defined in 8th and 9th DWORD - * of BFP; 2nd DWORD of 4-byte Address Instruction Table (ID FF84) - */ -#define FF84_DW2_CMD_ET_1(inst) SFDP_FIELD(inst, sfdp_ff84, 2, GENMASK(7, 0)) -#define FF84_DW2_CMD_ET_2(inst) SFDP_FIELD(inst, sfdp_ff84, 2, GENMASK(15, 8)) -#define FF84_DW2_CMD_ET_3(inst) SFDP_FIELD(inst, sfdp_ff84, 2, GENMASK(23, 16)) -#define FF84_DW2_CMD_ET_4(inst) SFDP_FIELD(inst, sfdp_ff84, 2, GENMASK(31, 24)) -/* Support for Erase Types in 4-byte Address mode; table FF84, 1st DWORD */ -#define FF84_DW1_SUP_ET_1(inst) SFDP_FIELD(inst, sfdp_ff84, 1, BIT(9)) -#define FF84_DW1_SUP_ET_2(inst) SFDP_FIELD(inst, sfdp_ff84, 1, BIT(10)) -#define FF84_DW1_SUP_ET_3(inst) SFDP_FIELD(inst, sfdp_ff84, 1, BIT(11)) -#define FF84_DW1_SUP_ET_4(inst) SFDP_FIELD(inst, sfdp_ff84, 1, BIT(12)) - -#define DEFAULT_ERASE_TYPES_DEFINE(inst) \ - static const struct jesd216_erase_type \ - dev##inst##_erase_types[JESD216_NUM_ERASE_TYPES] = \ - COND_CODE_1(SFDP_DW_EXISTS(inst, sfdp_bfp, 8), \ - ({{ .cmd = BFP_DW8_CMD_ET_1(inst), \ - .exp = BFP_DW8_EXP_ET_1(inst), }, \ - { .cmd = BFP_DW8_CMD_ET_2(inst), \ - .exp = BFP_DW8_EXP_ET_2(inst), }, \ - { .cmd = BFP_DW9_CMD_ET_3(inst), \ - .exp = BFP_DW9_EXP_ET_3(inst), }, \ - { .cmd = BFP_DW9_CMD_ET_4(inst), \ - .exp = BFP_DW9_EXP_ET_4(inst), }}), \ - ({{ .cmd = SPI_NOR_CMD_SE, \ - .exp = 0x0C }})); \ - static const struct jesd216_erase_type \ - dev##inst##_erase_types_4b[JESD216_NUM_ERASE_TYPES] = \ - COND_CODE_1(UTIL_AND(SFDP_DW_EXISTS(inst, sfdp_ff84, 2), \ - SFDP_DW_EXISTS(inst, sfdp_bfp, 9)), \ - ({{ .cmd = FF84_DW2_CMD_ET_1(inst), \ - .exp = FF84_DW1_SUP_ET_1(inst) \ - ? BFP_DW8_EXP_ET_1(inst) \ - : 0, }, \ - { .cmd = FF84_DW2_CMD_ET_2(inst), \ - .exp = FF84_DW1_SUP_ET_2(inst) \ - ? BFP_DW8_EXP_ET_2(inst) \ - : 0, }, \ - { .cmd = FF84_DW2_CMD_ET_3(inst), \ - .exp = FF84_DW1_SUP_ET_3(inst) \ - ? BFP_DW9_EXP_ET_3(inst) \ - : 0, }, \ - { .cmd = FF84_DW2_CMD_ET_4(inst), \ - .exp = FF84_DW1_SUP_ET_4(inst) \ - ? BFP_DW9_EXP_ET_4(inst) \ - : 0, }}), \ - ({{ .cmd = SPI_NOR_CMD_SE_4B, \ - .exp = 0x0C }})) - -#define DEFAULT_ERASE_TYPES(inst) \ - USES_4BYTE_ADDR(inst) ? dev##inst##_erase_types_4b \ - : dev##inst##_erase_types - -#define ENTER_4BYTE_ADDR(inst) \ - (!USES_4BYTE_ADDR(inst) ? ENTER_4BYTE_ADDR_NONE : \ - (BFP_ENTER_4BYTE_ADDR_METHODS(inst) \ - & BFP_DW16_4B_ADDR_ENTER_B7) ? ENTER_4BYTE_ADDR_B7 : \ - (BFP_ENTER_4BYTE_ADDR_METHODS(inst) \ - & BFP_DW16_4B_ADDR_ENTER_06_B7) ? ENTER_4BYTE_ADDR_06_B7 : \ - ENTER_4BYTE_ADDR_NONE) - -#define DEFAULT_SWITCH_INFO(inst) { \ - .quad_enable_req = BSP_DW15_QER(inst), \ - .octal_enable_req = BSP_DW19_OER(inst), \ - .enter_4byte_addr = ENTER_4BYTE_ADDR(inst) } - -#define SFDP_BUILD_ASSERTS(inst) \ - BUILD_ASSERT(DT_INST_NODE_HAS_PROP(inst, sfdp_bfp), \ - "sfdp-bfp property needed in " \ - DT_NODE_FULL_NAME(DT_DRV_INST(inst))); \ - BUILD_ASSERT((DT_INST_ENUM_IDX(inst, mspi_io_mode) \ - != MSPI_IO_MODE_OCTAL) || \ - DT_INST_NODE_HAS_PROP(inst, sfdp_ff05), \ - "sfdp-ff05 property needed in " \ - DT_NODE_FULL_NAME(DT_DRV_INST(inst))); \ - BUILD_ASSERT(!USES_4BYTE_ADDR(inst) || \ - DT_INST_NODE_HAS_PROP(inst, sfdp_ff84), \ - "sfdp-ff84 property needed in " \ - DT_NODE_FULL_NAME(DT_DRV_INST(inst))); \ - BUILD_ASSERT(!USES_8D_8D_8D(inst) || \ - BFP_DW18_CMD_EXT(inst) <= BFP_DW18_CMD_EXT_INV, \ - "Unsupported Octal Command Extension mode in " \ - DT_NODE_FULL_NAME(DT_DRV_INST(inst))) diff --git a/dts/bindings/mtd/jedec,jesd216.yaml b/dts/bindings/mtd/jedec,jesd216.yaml index d5f75c74dd3d..c55440456c2a 100644 --- a/dts/bindings/mtd/jedec,jesd216.yaml +++ b/dts/bindings/mtd/jedec,jesd216.yaml @@ -35,18 +35,6 @@ properties: information in cases were runtime retrieval of SFDP data is not desired. - sfdp-ff05: - type: uint8-array - description: | - Contains the 32-bit words in little-endian byte order from the JESD216 - SFDP xSPI Profile 1.0 table. - - sfdp-ff84: - type: uint8-array - description: | - Contains the 32-bit words in little-endian byte order from the JESD216 - SFDP 4-byte Address Instruction Parameter table. - quad-enable-requirements: type: string enum: From 086847880b782e4efcecf3e8256aca207b396cb9 Mon Sep 17 00:00:00 2001 From: Utsav Munendra Date: Wed, 3 Sep 2025 19:33:07 -0700 Subject: [PATCH 0763/2141] [nrf fromtree] drivers: flash_mspi: Implement flash API get_size Implement the Zephyr Flash Driver API for completeness. Signed-off-by: Utsav Munendra (cherry picked from commit 19988acd90e09eecbed029df39d3cac02daa38b4) --- drivers/flash/flash_mspi_nor.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/flash/flash_mspi_nor.c b/drivers/flash/flash_mspi_nor.c index ae22202e075d..5546ef904c03 100644 --- a/drivers/flash/flash_mspi_nor.c +++ b/drivers/flash/flash_mspi_nor.c @@ -387,6 +387,12 @@ static int api_erase(const struct device *dev, off_t addr, size_t size) return rc; } +static int api_get_size(const struct device *dev, uint64_t *size) +{ + *size = dev_flash_size(dev); + return 0; +} + static const struct flash_parameters *api_get_parameters(const struct device *dev) { @@ -771,6 +777,7 @@ static DEVICE_API(flash, drv_api) = { .read = api_read, .write = api_write, .erase = api_erase, + .get_size = api_get_size, .get_parameters = api_get_parameters, #if defined(CONFIG_FLASH_PAGE_LAYOUT) .page_layout = api_page_layout, From 6c308a75b2b934f22ac07f8474e84a2894e2ced6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Fri, 11 Jul 2025 14:30:40 +0200 Subject: [PATCH 0764/2141] [nrf fromtree] drivers: flash_mspi_nor: Get info from dts SFDP arrays MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Get parameters for used flash commands and requirements for enabling Quad and Octal modes from dts uint8-arrays containing data read from SFDP tables for particular flash chips. Also introduce `pre_init` quirk that allows alteration of the above parameters or complementation of them in a specific way for particular flash chip families. Signed-off-by: Andrzej Głąbek (cherry picked from commit 29bc5bf12cff6495df108ee31c40d652981ee439) --- .../nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 7 + .../nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts | 7 + drivers/flash/Kconfig.mspi | 18 + drivers/flash/flash_mspi_nor.c | 46 +- drivers/flash/flash_mspi_nor.h | 50 ++- drivers/flash/flash_mspi_nor_quirks.h | 56 +++ drivers/flash/flash_mspi_nor_sfdp.h | 399 ++++++++++++++++++ dts/bindings/mtd/jedec,jesd216.yaml | 12 + 8 files changed, 577 insertions(+), 18 deletions(-) create mode 100644 drivers/flash/flash_mspi_nor_sfdp.h diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index 2c86129c0f38..e086601abae9 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -285,6 +285,13 @@ slot3_partition: &cpurad_slot1_partition { 30 b0 30 b0 f4 bd d5 5c 00 00 00 ff 10 10 00 20 00 00 00 00 00 00 7c 23 48 00 00 00 00 00 88 88 ]; + sfdp-ff05 = [ + 00 ee c0 69 72 72 71 71 00 d8 f7 f6 00 0a 00 00 + 14 45 98 80 + ]; + sfdp-ff84 = [ + 43 06 0f 00 21 dc ff ff + ]; size = <67108864>; has-dpd; t-enter-dpd = <10000>; diff --git a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts index 1c8622c07803..8920d7966bbf 100644 --- a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts +++ b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts @@ -265,6 +265,13 @@ ipc0: &cpuapp_cpurad_ipc { 30 b0 30 b0 f4 bd d5 5c 00 00 00 ff 10 10 00 20 00 00 00 00 00 00 7c 23 48 00 00 00 00 00 88 88 ]; + sfdp-ff05 = [ + 00 ee c0 69 72 72 71 71 00 d8 f7 f6 00 0a 00 00 + 14 45 98 80 + ]; + sfdp-ff84 = [ + 43 06 0f 00 21 dc ff ff + ]; size = <67108864>; has-dpd; t-enter-dpd = <10000>; diff --git a/drivers/flash/Kconfig.mspi b/drivers/flash/Kconfig.mspi index d0f244957d21..cab2f3a2bcde 100644 --- a/drivers/flash/Kconfig.mspi +++ b/drivers/flash/Kconfig.mspi @@ -39,6 +39,24 @@ menuconfig FLASH_MSPI_NOR if FLASH_MSPI_NOR +config FLASH_MSPI_NOR_USE_SFDP + bool "Use Serial Flash Discoverable Parameters (SFDP)" + default $(dt_compat_any_has_prop,$(DT_COMPAT_JEDEC_MSPI_NOR),sfdp-bfp) + help + Use information from SFDP for setting up flash command transfers + and for configuring the flash chip. + + Currently, only build time processing of SFDP structures is supported, + based on dts arrays provided as flash node properties like `sfdp-bfp`, + `sfdp-ff05`, and `sfdp-ff84`. Depending on the IO mode used, some or + all of these properties are required for building the flash driver. + Data for these properties can be obtained with the `drivers/jesd216` + sample. If a given SFDP table is not available in a flash chip, + the related property can be defined as an empty array - this will + prevent a related build assertion from failing and default values + will be assigned to parameters that would otherwise be read from + that SFDP table. + config FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE int "Page size to use for FLASH_LAYOUT feature" depends on FLASH_PAGE_LAYOUT diff --git a/drivers/flash/flash_mspi_nor.c b/drivers/flash/flash_mspi_nor.c index 5546ef904c03..125aedfa250f 100644 --- a/drivers/flash/flash_mspi_nor.c +++ b/drivers/flash/flash_mspi_nor.c @@ -12,10 +12,12 @@ #include #include "flash_mspi_nor.h" -#include "flash_mspi_nor_quirks.h" +#include "flash_mspi_nor_sfdp.h" LOG_MODULE_REGISTER(flash_mspi_nor, CONFIG_FLASH_LOG_LEVEL); +#include "flash_mspi_nor_quirks.h" + void flash_mspi_command_set(const struct device *dev, const struct flash_mspi_nor_cmd *cmd) { struct flash_mspi_nor_data *dev_data = dev->data; @@ -110,7 +112,9 @@ static inline uint32_t dev_flash_size(const struct device *dev) static inline uint16_t dev_page_size(const struct device *dev) { - return SPI_NOR_PAGE_SIZE; + const struct flash_mspi_nor_config *dev_config = dev->config; + + return dev_config->page_size; } static int api_read(const struct device *dev, off_t addr, void *dest, @@ -534,7 +538,7 @@ static int quad_enable_set(const struct device *dev, bool enable) return rc; } - if (dev_config->dw15_qer == JESD216_DW15_QER_VAL_S1B6) { + if (dev_data->switch_info.quad_enable_req == JESD216_DW15_QER_VAL_S1B6) { const struct flash_mspi_nor_cmd cmd_status = { .dir = MSPI_TX, .cmd = SPI_NOR_CMD_WRSR, @@ -570,10 +574,11 @@ static int quad_enable_set(const struct device *dev, bool enable) static int default_io_mode(const struct device *dev) { const struct flash_mspi_nor_config *dev_config = dev->config; + struct flash_mspi_nor_data *dev_data = dev->data; enum mspi_io_mode io_mode = dev_config->mspi_nor_cfg.io_mode; int rc = 0; - if (dev_config->dw15_qer != JESD216_DW15_QER_VAL_NONE) { + if (dev_data->switch_info.quad_enable_req != JESD216_DW15_QER_VAL_NONE) { /* For Quad 1-1-4 and 1-4-4, entering or leaving mode is defined * in JEDEC216 BFP DW15 QER */ @@ -657,7 +662,7 @@ static int flash_chip_init(const struct device *dev) /* Some chips reuse RESET pin for data in Quad modes: * force single line mode before resetting. */ - if (dev_config->dw15_qer != JESD216_DW15_QER_VAL_NONE && + if (dev_data->switch_info.quad_enable_req != JESD216_DW15_QER_VAL_NONE && (io_mode == MSPI_IO_MODE_SINGLE || io_mode == MSPI_IO_MODE_QUAD_1_1_4 || io_mode == MSPI_IO_MODE_QUAD_1_4_4)) { @@ -685,6 +690,11 @@ static int flash_chip_init(const struct device *dev) } #endif + if (dev_config->quirks != NULL && + dev_config->quirks->pre_init != NULL) { + rc = dev_config->quirks->pre_init(dev); + } + flash_mspi_command_set(dev, &commands_single.id); dev_data->packet.data_buf = id; dev_data->packet.num_bytes = sizeof(id); @@ -749,6 +759,11 @@ static int drv_init(const struct device *dev) return -ENODEV; } + memcpy(dev_data->erase_types, dev_config->default_erase_types, + sizeof(dev_data->erase_types)); + dev_data->cmd_info = dev_config->default_cmd_info; + dev_data->switch_info = dev_config->default_switch_info; + rc = pm_device_runtime_get(dev_config->bus); if (rc < 0) { LOG_ERR("pm_device_runtime_get() failed: %d", rc); @@ -800,8 +815,6 @@ static DEVICE_API(flash, drv_api) = { .dqs_enable = false, \ } -#define FLASH_SIZE_INST(inst) (DT_INST_PROP(inst, size) / 8) - /* Define copies of mspi_io_mode enum values, so they can be used inside * the COND_CODE_1 macros. */ @@ -836,23 +849,17 @@ extern const struct flash_mspi_nor_cmds mspi_io_mode_not_supported; #define FLASH_QUIRKS(inst) FLASH_MSPI_QUIRKS_GET(DT_DRV_INST(inst)) -#define FLASH_DW15_QER_VAL(inst) _CONCAT(JESD216_DW15_QER_VAL_, \ - DT_INST_STRING_TOKEN(inst, quad_enable_requirements)) -#define FLASH_DW15_QER(inst) COND_CODE_1(DT_INST_NODE_HAS_PROP(inst, quad_enable_requirements), \ - (FLASH_DW15_QER_VAL(inst)), (JESD216_DW15_QER_VAL_NONE)) - - #if defined(CONFIG_FLASH_PAGE_LAYOUT) BUILD_ASSERT((CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE % 4096) == 0, "MSPI_NOR_FLASH_LAYOUT_PAGE_SIZE must be multiple of 4096"); #define FLASH_PAGE_LAYOUT_DEFINE(inst) \ .layout = { \ .pages_size = CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE, \ - .pages_count = FLASH_SIZE_INST(inst) \ + .pages_count = FLASH_SIZE(inst) \ / CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE, \ }, #define FLASH_PAGE_LAYOUT_CHECK(inst) \ -BUILD_ASSERT((FLASH_SIZE_INST(inst) % CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE) == 0, \ +BUILD_ASSERT((FLASH_SIZE(inst) % CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE) == 0, \ "MSPI_NOR_FLASH_LAYOUT_PAGE_SIZE incompatible with flash size, instance " #inst); #else #define FLASH_PAGE_LAYOUT_DEFINE(inst) @@ -874,11 +881,14 @@ BUILD_ASSERT((FLASH_SIZE_INST(inst) % CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE) == (DT_INST_ENUM_IDX(inst, mspi_io_mode) == \ MSPI_IO_MODE_OCTAL), \ "Only 1x, 1-4-4 and 8x I/O modes are supported for now"); \ + SFDP_BUILD_ASSERTS(inst); \ PM_DEVICE_DT_INST_DEFINE(inst, dev_pm_action_cb); \ + DEFAULT_ERASE_TYPES_DEFINE(inst); \ static struct flash_mspi_nor_data dev##inst##_data; \ static const struct flash_mspi_nor_config dev##inst##_config = { \ .bus = DEVICE_DT_GET(DT_INST_BUS(inst)), \ - .flash_size = FLASH_SIZE_INST(inst), \ + .flash_size = FLASH_SIZE(inst), \ + .page_size = FLASH_PAGE_SIZE(inst), \ .mspi_id = MSPI_DEVICE_ID_DT_INST(inst), \ .mspi_nor_cfg = MSPI_DEVICE_CONFIG_DT_INST(inst), \ .mspi_nor_init_cfg = FLASH_INITIAL_CONFIG(inst), \ @@ -899,7 +909,9 @@ BUILD_ASSERT((FLASH_SIZE_INST(inst) % CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE) == .jedec_id = DT_INST_PROP(inst, jedec_id), \ .jedec_cmds = FLASH_CMDS(inst), \ .quirks = FLASH_QUIRKS(inst), \ - .dw15_qer = FLASH_DW15_QER(inst), \ + .default_erase_types = DEFAULT_ERASE_TYPES(inst), \ + .default_cmd_info = DEFAULT_CMD_INFO(inst), \ + .default_switch_info = DEFAULT_SWITCH_INFO(inst), \ }; \ FLASH_PAGE_LAYOUT_CHECK(inst) \ DEVICE_DT_INST_DEFINE(inst, \ diff --git a/drivers/flash/flash_mspi_nor.h b/drivers/flash/flash_mspi_nor.h index ad957f24bc79..9c96c334fbe0 100644 --- a/drivers/flash/flash_mspi_nor.h +++ b/drivers/flash/flash_mspi_nor.h @@ -20,9 +20,52 @@ extern "C" { #define WITH_RESET_GPIO 1 #endif +#define CMD_EXTENSION_NONE 0 +#define CMD_EXTENSION_SAME 1 +#define CMD_EXTENSION_INVERSE 2 + +#define OCTAL_ENABLE_REQ_NONE 0 +#define OCTAL_ENABLE_REQ_S2B3 1 + +#define ENTER_4BYTE_ADDR_NONE 0 +#define ENTER_4BYTE_ADDR_B7 1 +#define ENTER_4BYTE_ADDR_06_B7 2 + +struct flash_mspi_nor_cmd_info { + uint8_t read_cmd; + uint8_t read_mode_bit_cycles : 3; + uint8_t read_dummy_cycles : 5; + uint8_t pp_cmd; + bool uses_4byte_addr : 1; + /* BFP, 18th DWORD, bits 30-29 */ + uint8_t cmd_extension : 2; + /* xSPI Profile 1.0 (ID FF05), 1st DWORD: */ + /* - Read SFDP command address bytes: 4 (true) or 3 */ + bool sfdp_addr_4 : 1; + /* - Read SDFP command dummy cycles: 20 (true) or 8 */ + bool sfdp_dummy_20 : 1; + /* - Read Status Register command address bytes: 4 (true) or 0 */ + bool rdsr_addr_4 : 1; + /* - Read Status Register command dummy cycles: 0, 4, or 8 */ + uint8_t rdsr_dummy : 4; + /* - Read JEDEC ID command parameters; not sure where to get their + * values from, but since for many flash chips they are the same + * as for RDSR, those are taken as defaults, see DEFAULT_CMD_INFO() + */ + bool rdid_addr_4 : 1; + uint8_t rdid_dummy : 4; +}; + +struct flash_mspi_nor_switch_info { + uint8_t quad_enable_req : 3; + uint8_t octal_enable_req : 3; + uint8_t enter_4byte_addr : 2; +}; + struct flash_mspi_nor_config { const struct device *bus; uint32_t flash_size; + uint16_t page_size; struct mspi_dev_id mspi_id; struct mspi_dev_cfg mspi_nor_cfg; struct mspi_dev_cfg mspi_nor_init_cfg; @@ -42,7 +85,9 @@ struct flash_mspi_nor_config { uint8_t jedec_id[SPI_NOR_MAX_ID_LEN]; const struct flash_mspi_nor_cmds *jedec_cmds; struct flash_mspi_nor_quirks *quirks; - uint8_t dw15_qer; + const struct jesd216_erase_type *default_erase_types; + struct flash_mspi_nor_cmd_info default_cmd_info; + struct flash_mspi_nor_switch_info default_switch_info; }; struct flash_mspi_nor_data { @@ -50,6 +95,9 @@ struct flash_mspi_nor_data { struct mspi_xfer_packet packet; struct mspi_xfer xfer; struct mspi_dev_cfg *curr_cfg; + struct jesd216_erase_type erase_types[JESD216_NUM_ERASE_TYPES]; + struct flash_mspi_nor_cmd_info cmd_info; + struct flash_mspi_nor_switch_info switch_info; }; struct flash_mspi_nor_cmd { diff --git a/drivers/flash/flash_mspi_nor_quirks.h b/drivers/flash/flash_mspi_nor_quirks.h index eb40ad1938aa..f8a0a147e6b1 100644 --- a/drivers/flash/flash_mspi_nor_quirks.h +++ b/drivers/flash/flash_mspi_nor_quirks.h @@ -9,6 +9,13 @@ /* Flash chip specific quirks */ struct flash_mspi_nor_quirks { + /* Called at the beginning of the flash chip initialization, + * right after reset if any is performed. Can be used to alter + * structures that define communication with the chip, like + * `cmd_info`, `switch_info`, and `erase_types`, which are set + * to default values at this point. + */ + int (*pre_init)(const struct device *dev); /* Called after switching to default IO mode. */ int (*post_switch_mode)(const struct device *dev); }; @@ -176,7 +183,56 @@ static inline int mxicy_mx25u_post_switch_mode(const struct device *dev) return rc; } +static int mxicy_mx25u_pre_init(const struct device *dev) +{ + const struct flash_mspi_nor_config *dev_config = dev->config; + struct flash_mspi_nor_data *dev_data = dev->data; + static const uint8_t dummy_cycles[8] = { + 20, 18, 16, 14, 12, 10, 8, 6 + }; + uint8_t cfg_reg; + int rc; + + if (dev_config->mspi_nor_cfg.io_mode != MSPI_IO_MODE_OCTAL) { + return 0; + } + + if (dev_config->mspi_nor_cfg.data_rate == MSPI_DATA_RATE_SINGLE) { + dev_data->cmd_info.cmd_extension = CMD_EXTENSION_INVERSE; + } + + /* + * TODO - replace this with a generic routine that uses information + * from SFDP header FF87 (Status, Control and Configuration + * Register Map) + */ + + /* Read configured number of dummy cycles for memory reading commands. */ + const struct flash_mspi_nor_cmd cmd_rd_cr2 = { + .dir = MSPI_RX, + .cmd = SPI_NOR_CMD_RD_CFGREG2, + .cmd_length = 1, + .addr_length = 4, + }; + + flash_mspi_command_set(dev, &cmd_rd_cr2); + dev_data->packet.address = 0x300; + dev_data->packet.data_buf = &cfg_reg; + dev_data->packet.num_bytes = sizeof(cfg_reg); + rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, &dev_data->xfer); + if (rc < 0) { + LOG_ERR("Failed to read Dummy Cycle from CFGREG2"); + return rc; + } + + dev_data->cmd_info.read_mode_bit_cycles = 0; + dev_data->cmd_info.read_dummy_cycles = dummy_cycles[cfg_reg & 0x7]; + + return 0; +} + struct flash_mspi_nor_quirks flash_quirks_mxicy_mx25u = { + .pre_init = mxicy_mx25u_pre_init, .post_switch_mode = mxicy_mx25u_post_switch_mode, }; diff --git a/drivers/flash/flash_mspi_nor_sfdp.h b/drivers/flash/flash_mspi_nor_sfdp.h new file mode 100644 index 000000000000..5fa07a51782c --- /dev/null +++ b/drivers/flash/flash_mspi_nor_sfdp.h @@ -0,0 +1,399 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifdef CONFIG_FLASH_MSPI_NOR_USE_SFDP + +#define BFP_DW16_4B_ADDR_ENTER_B7 BIT(0) +#define BFP_DW16_4B_ADDR_ENTER_06_B7 BIT(1) +#define BFP_DW16_4B_ADDR_PER_CMD BIT(5) +#define BFP_DW16_4B_ADDR_ALWAYS BIT(6) + +#define BFP_DW18_CMD_EXT_SAME 0 +#define BFP_DW18_CMD_EXT_INV 1 + +/* 32-bit words in SFDP arrays in devicetree are stored in little-endian byte + * order. See jedec,jesd216.yaml + */ +#define SFDP_DW_BYTE_0_IDX(dw_no) \ + UTIL_DEC(UTIL_DEC(UTIL_DEC(UTIL_DEC(UTIL_X2(UTIL_X2(dw_no)))))) +#define SFDP_DW_BYTE_1_IDX(dw_no) \ + UTIL_DEC(UTIL_DEC(UTIL_DEC(UTIL_X2(UTIL_X2(dw_no))))) +#define SFDP_DW_BYTE_2_IDX(dw_no) \ + UTIL_DEC(UTIL_DEC(UTIL_X2(UTIL_X2(dw_no)))) +#define SFDP_DW_BYTE_3_IDX(dw_no) \ + UTIL_DEC(UTIL_X2(UTIL_X2(dw_no))) +#define SFDP_DW_BYTE(inst, prop, dw_no, byte_idx) \ + DT_INST_PROP_BY_IDX(inst, prop, SFDP_DW_BYTE_##byte_idx##_IDX(dw_no)) +#define SFDP_DW_EXISTS(inst, prop, dw_no) \ + DT_INST_PROP_HAS_IDX(inst, prop, SFDP_DW_BYTE_3_IDX(dw_no)) + +#define SFDP_DW(inst, prop, dw_no) \ + COND_CODE_1(SFDP_DW_EXISTS(inst, prop, dw_no), \ + (((SFDP_DW_BYTE(inst, prop, dw_no, 3) << 24) | \ + (SFDP_DW_BYTE(inst, prop, dw_no, 2) << 16) | \ + (SFDP_DW_BYTE(inst, prop, dw_no, 1) << 8) | \ + (SFDP_DW_BYTE(inst, prop, dw_no, 0) << 0))), \ + (0)) + +#define SFDP_FIELD(inst, prop, dw_no, mask) \ + FIELD_GET(mask, SFDP_DW(inst, prop, dw_no)) + +#define USES_8D_8D_8D(inst) \ + (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_OCTAL && \ + DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_DUAL) +#define USES_8S_8S_8S(inst) \ + (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_OCTAL && \ + DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_SINGLE) +#define USES_1S_8D_8D(inst) \ + (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_OCTAL_1_8_8 && \ + DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_DUAL) +#define USES_1S_8S_8S(inst) \ + (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_OCTAL_1_8_8 && \ + DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_SINGLE) +#define USES_1S_1S_8S(inst) \ + (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_OCTAL_1_1_8 && \ + DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_SINGLE) +#define USES_4S_4D_4D(inst) \ + (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_QUAD && \ + DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_DUAL) +#define USES_4S_4S_4S(inst) \ + (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_QUAD && \ + DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_SINGLE) +#define USES_1S_4D_4D(inst) \ + (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_QUAD_1_4_4 && \ + DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_DUAL) +#define USES_1S_4S_4S(inst) \ + (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_QUAD_1_4_4 && \ + DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_SINGLE) +#define USES_1S_1S_4S(inst) \ + (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_QUAD_1_1_4 && \ + DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_SINGLE) +#define USES_2S_2S_2S(inst) \ + (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_DUAL && \ + DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_SINGLE) +#define USES_1S_2D_2D(inst) \ + (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_DUAL_1_2_2 && \ + DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_DUAL) +#define USES_1S_2S_2S(inst) \ + (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_DUAL_1_2_2 && \ + DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_SINGLE) +#define USES_1S_1S_2S(inst) \ + (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_DUAL_1_1_2 && \ + DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_SINGLE) +#define USES_1S_1D_1D(inst) \ + (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_SINGLE && \ + DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_DUAL) +#define USES_1S_1S_1S(inst) \ + (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_SINGLE && \ + DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_SINGLE) + +#define USES_OCTAL_IO(inst) \ + (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_OCTAL) + +#define BFP_DW1_ADDRESS_BYTES(inst) \ + SFDP_FIELD(inst, sfdp_bfp, 1, GENMASK(18, 17)) + +#define USES_4BYTE_ADDR(inst) \ + (USES_OCTAL_IO(inst) || \ + BFP_DW1_ADDRESS_BYTES(inst) == JESD216_SFDP_BFP_DW1_ADDRBYTES_VAL_4B) + +#define BFP_ENTER_4BYTE_ADDR_METHODS(inst) \ + SFDP_FIELD(inst, sfdp_bfp, 16, GENMASK(31, 24)) + +#define HAS_4BYTE_ADDR_CMDS(inst) \ + (BFP_ENTER_4BYTE_ADDR_METHODS(inst) & BFP_DW16_4B_ADDR_PER_CMD) + +#define BFP_DW18_CMD_EXT(inst) \ + SFDP_FIELD(inst, sfdp_bfp, 18, GENMASK(30, 29)) + +#define CMD_EXTENSION(inst) \ + (!USES_8D_8D_8D(inst) ? CMD_EXTENSION_NONE : \ + (BFP_DW18_CMD_EXT(inst) \ + == BFP_DW18_CMD_EXT_INV) ? CMD_EXTENSION_INVERSE \ + : CMD_EXTENSION_SAME) + +/* 1st DWORD of 4-byte Address Instruction Table (ID FF84) indicates commands + * that are supported by the chip. + */ +#define FF84_DW1_BIT(inst, bit) (SFDP_DW(inst, sfdp_ff84, 1) & BIT(bit)) + +#define SFDP_CMD_PP(inst) \ + USES_1S_4S_4S(inst) ? SPI_NOR_CMD_PP_1_4_4 : \ + USES_1S_1S_4S(inst) ? SPI_NOR_CMD_PP_1_1_4 : \ + SPI_NOR_CMD_PP +#define SFDP_CMD_PP_4B(inst) \ + USES_1S_8S_8S(inst) && FF84_DW1_BIT(inst, 24) ? 0x8E : \ + USES_1S_1S_8S(inst) && FF84_DW1_BIT(inst, 23) ? 0x84 : \ + USES_1S_4S_4S(inst) && FF84_DW1_BIT(inst, 8) ? SPI_NOR_CMD_PP_1_4_4_4B : \ + USES_1S_1S_4S(inst) && FF84_DW1_BIT(inst, 7) ? SPI_NOR_CMD_PP_1_1_4_4B : \ + FF84_DW1_BIT(inst, 6) ? SPI_NOR_CMD_PP_4B \ + : 0 +#define SFDP_CMD_FAST_READ(inst) \ + USES_1S_8D_8D(inst) ? 0 : \ + USES_1S_8S_8S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 17, GENMASK(15, 8)) : \ + USES_1S_1S_8S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 17, GENMASK(31, 24)) : \ + USES_4S_4D_4D(inst) ? SFDP_FIELD(inst, sfdp_bfp, 23, GENMASK(31, 24)) : \ + USES_4S_4S_4S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 7, GENMASK(31, 24)) : \ + USES_1S_4D_4D(inst) ? SFDP_FIELD(inst, sfdp_bfp, 23, GENMASK(15, 8)) : \ + USES_1S_4S_4S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 3, GENMASK(15, 8)) : \ + USES_1S_1S_4S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 3, GENMASK(31, 24)) : \ + USES_2S_2S_2S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 6, GENMASK(31, 24)) : \ + USES_1S_2D_2D(inst) ? SFDP_FIELD(inst, sfdp_bfp, 22, GENMASK(31, 24)) : \ + USES_1S_2S_2S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 4, GENMASK(31, 24)) : \ + USES_1S_1S_2S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 4, GENMASK(15, 8)) : \ + USES_1S_1D_1D(inst) ? SFDP_FIELD(inst, sfdp_bfp, 22, GENMASK(15, 8)) : \ + SPI_NOR_CMD_READ_FAST +#define SFDP_CMD_FAST_READ_4B(inst) \ + USES_8D_8D_8D(inst) ? 0xEE : \ + USES_8S_8S_8S(inst) ? 0xEC : \ + USES_1S_8D_8D(inst) && FF84_DW1_BIT(inst, 22) ? 0xFD : \ + USES_1S_8S_8S(inst) && FF84_DW1_BIT(inst, 21) ? 0xCC : \ + USES_1S_1S_8S(inst) && FF84_DW1_BIT(inst, 20) ? 0x7C : \ + USES_4S_4D_4D(inst) ? 0 : \ + USES_4S_4S_4S(inst) ? 0 : \ + USES_1S_4D_4D(inst) && FF84_DW1_BIT(inst, 15) ? 0xEE : \ + USES_1S_4S_4S(inst) && FF84_DW1_BIT(inst, 5) ? 0xEC : \ + USES_1S_1S_4S(inst) && FF84_DW1_BIT(inst, 4) ? 0x6C : \ + USES_2S_2S_2S(inst) ? 0 : \ + USES_1S_2D_2D(inst) && FF84_DW1_BIT(inst, 14) ? 0xBE : \ + USES_1S_2S_2S(inst) && FF84_DW1_BIT(inst, 3) ? 0xBC : \ + USES_1S_1S_2S(inst) && FF84_DW1_BIT(inst, 2) ? 0x3C : \ + USES_1S_1D_1D(inst) && FF84_DW1_BIT(inst, 13) ? 0x0E : \ + FF84_DW1_BIT(inst, 1) ? SPI_NOR_CMD_READ_FAST_4B : \ + 0 + +#define DEFAULT_CMD_INFO(inst) { \ + .pp_cmd = USES_4BYTE_ADDR(inst) && HAS_4BYTE_ADDR_CMDS(inst) \ + ? SFDP_CMD_PP_4B(inst) \ + : SFDP_CMD_PP(inst), \ + .read_cmd = USES_4BYTE_ADDR(inst) && HAS_4BYTE_ADDR_CMDS(inst) \ + ? SFDP_CMD_FAST_READ_4B(inst) \ + : SFDP_CMD_FAST_READ(inst), \ + .read_mode_bit_cycles = \ + USES_1S_8S_8S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 17, GENMASK(7, 5)) : \ + USES_1S_1S_8S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 17, GENMASK(23, 21)) : \ + USES_4S_4D_4D(inst) ? SFDP_FIELD(inst, sfdp_bfp, 23, GENMASK(23, 21)) : \ + USES_4S_4S_4S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 7, GENMASK(23, 21)) : \ + USES_1S_4D_4D(inst) ? SFDP_FIELD(inst, sfdp_bfp, 23, GENMASK(7, 5)) : \ + USES_1S_4S_4S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 3, GENMASK(7, 5)) : \ + USES_1S_1S_4S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 3, GENMASK(23, 21)) : \ + USES_2S_2S_2S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 6, GENMASK(23, 21)) : \ + USES_1S_2D_2D(inst) ? SFDP_FIELD(inst, sfdp_bfp, 22, GENMASK(23, 21)) : \ + USES_1S_2S_2S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 4, GENMASK(23, 21)) : \ + USES_1S_1S_2S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 4, GENMASK(7, 5)) : \ + USES_1S_1D_1D(inst) ? SFDP_FIELD(inst, sfdp_bfp, 22, GENMASK(7, 5)) : \ + USES_1S_1S_1S(inst) ? 0 : \ + 0, \ + .read_dummy_cycles = DT_INST_PROP_OR(inst, rx_dummy, \ + USES_8D_8D_8D(inst) ? SFDP_FIELD(inst, sfdp_ff05, 6, GENMASK(4, 0)) : \ + USES_8S_8S_8S(inst) ? SFDP_FIELD(inst, sfdp_ff05, 6, GENMASK(9, 5)) : \ + USES_1S_8S_8S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 17, GENMASK(4, 0)) : \ + USES_1S_1S_8S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 17, GENMASK(20, 16)) : \ + USES_4S_4D_4D(inst) ? SFDP_FIELD(inst, sfdp_bfp, 23, GENMASK(20, 16)) : \ + USES_4S_4S_4S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 7, GENMASK(20, 16)) : \ + USES_1S_4D_4D(inst) ? SFDP_FIELD(inst, sfdp_bfp, 23, GENMASK(4, 0)) : \ + USES_1S_4S_4S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 3, GENMASK(4, 0)) : \ + USES_1S_1S_4S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 3, GENMASK(20, 16)) : \ + USES_2S_2S_2S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 6, GENMASK(20, 16)) : \ + USES_1S_2D_2D(inst) ? SFDP_FIELD(inst, sfdp_bfp, 22, GENMASK(20, 16)) : \ + USES_1S_2S_2S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 4, GENMASK(20, 16)) : \ + USES_1S_1S_2S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 4, GENMASK(4, 0)) : \ + USES_1S_1D_1D(inst) ? SFDP_FIELD(inst, sfdp_bfp, 22, GENMASK(4, 0)) : \ + USES_1S_1S_1S(inst) ? 8 : \ + 0), \ + .uses_4byte_addr = USES_4BYTE_ADDR(inst), \ + .cmd_extension = CMD_EXTENSION(inst), \ + .sfdp_addr_4 = USES_OCTAL_IO(inst) \ + ? (SFDP_FIELD(inst, sfdp_ff05, 1, BIT(31)) == 0) \ + : false, \ + .sfdp_dummy_20 = USES_OCTAL_IO(inst) \ + ? (SFDP_FIELD(inst, sfdp_ff05, 1, BIT(30)) == 1) \ + : false, \ + .rdsr_addr_4 = USES_OCTAL_IO(inst) \ + ? (SFDP_FIELD(inst, sfdp_ff05, 1, BIT(29)) == 1) \ + : false, \ + .rdsr_dummy = USES_OCTAL_IO(inst) \ + ? (SFDP_FIELD(inst, sfdp_ff05, 1, BIT(28)) ? 8 : 4) \ + : 0, \ + .rdid_addr_4 = USES_OCTAL_IO(inst) \ + ? (SFDP_FIELD(inst, sfdp_ff05, 1, BIT(29)) == 1) \ + : false, \ + .rdid_dummy = USES_OCTAL_IO(inst) \ + ? (SFDP_FIELD(inst, sfdp_ff05, 1, BIT(28)) ? 8 : 4) \ + : 0, } + +/* Erase Types, 8th and 9th DWORD of BSP */ +#define BFP_DW8_CMD_ET_1(inst) SFDP_FIELD(inst, sfdp_bfp, 8, GENMASK(15, 8)) +#define BFP_DW8_EXP_ET_1(inst) SFDP_FIELD(inst, sfdp_bfp, 8, GENMASK(7, 0)) +#define BFP_DW8_CMD_ET_2(inst) SFDP_FIELD(inst, sfdp_bfp, 8, GENMASK(31, 24)) +#define BFP_DW8_EXP_ET_2(inst) SFDP_FIELD(inst, sfdp_bfp, 8, GENMASK(23, 16)) +#define BFP_DW9_CMD_ET_3(inst) SFDP_FIELD(inst, sfdp_bfp, 9, GENMASK(15, 8)) +#define BFP_DW9_EXP_ET_3(inst) SFDP_FIELD(inst, sfdp_bfp, 9, GENMASK(7, 0)) +#define BFP_DW9_CMD_ET_4(inst) SFDP_FIELD(inst, sfdp_bfp, 9, GENMASK(31, 24)) +#define BFP_DW9_EXP_ET_4(inst) SFDP_FIELD(inst, sfdp_bfp, 9, GENMASK(23, 16)) + +/* 4-byte Address instructions for Erase Types defined in 8th and 9th DWORD + * of BFP; 2nd DWORD of 4-byte Address Instruction Table (ID FF84) + */ +#define FF84_DW2_CMD_ET_1(inst) SFDP_FIELD(inst, sfdp_ff84, 2, GENMASK(7, 0)) +#define FF84_DW2_CMD_ET_2(inst) SFDP_FIELD(inst, sfdp_ff84, 2, GENMASK(15, 8)) +#define FF84_DW2_CMD_ET_3(inst) SFDP_FIELD(inst, sfdp_ff84, 2, GENMASK(23, 16)) +#define FF84_DW2_CMD_ET_4(inst) SFDP_FIELD(inst, sfdp_ff84, 2, GENMASK(31, 24)) +/* Support for Erase Types in 4-byte Address mode; table FF84, 1st DWORD */ +#define FF84_DW1_SUP_ET_1(inst) SFDP_FIELD(inst, sfdp_ff84, 1, BIT(9)) +#define FF84_DW1_SUP_ET_2(inst) SFDP_FIELD(inst, sfdp_ff84, 1, BIT(10)) +#define FF84_DW1_SUP_ET_3(inst) SFDP_FIELD(inst, sfdp_ff84, 1, BIT(11)) +#define FF84_DW1_SUP_ET_4(inst) SFDP_FIELD(inst, sfdp_ff84, 1, BIT(12)) + +#define DEFAULT_ERASE_TYPES_DEFINE(inst) \ + static const struct jesd216_erase_type \ + dev##inst##_erase_types[JESD216_NUM_ERASE_TYPES] = \ + COND_CODE_1(SFDP_DW_EXISTS(inst, sfdp_bfp, 8), \ + ({{ .cmd = BFP_DW8_CMD_ET_1(inst), \ + .exp = BFP_DW8_EXP_ET_1(inst), }, \ + { .cmd = BFP_DW8_CMD_ET_2(inst), \ + .exp = BFP_DW8_EXP_ET_2(inst), }, \ + { .cmd = BFP_DW9_CMD_ET_3(inst), \ + .exp = BFP_DW9_EXP_ET_3(inst), }, \ + { .cmd = BFP_DW9_CMD_ET_4(inst), \ + .exp = BFP_DW9_EXP_ET_4(inst), }}), \ + ({{ .cmd = SPI_NOR_CMD_SE, \ + .exp = 0x0C }})); \ + static const struct jesd216_erase_type \ + dev##inst##_erase_types_4b[JESD216_NUM_ERASE_TYPES] = \ + COND_CODE_1(UTIL_AND(SFDP_DW_EXISTS(inst, sfdp_ff84, 2), \ + SFDP_DW_EXISTS(inst, sfdp_bfp, 9)), \ + ({{ .cmd = FF84_DW2_CMD_ET_1(inst), \ + .exp = FF84_DW1_SUP_ET_1(inst) \ + ? BFP_DW8_EXP_ET_1(inst) \ + : 0, }, \ + { .cmd = FF84_DW2_CMD_ET_2(inst), \ + .exp = FF84_DW1_SUP_ET_2(inst) \ + ? BFP_DW8_EXP_ET_2(inst) \ + : 0, }, \ + { .cmd = FF84_DW2_CMD_ET_3(inst), \ + .exp = FF84_DW1_SUP_ET_3(inst) \ + ? BFP_DW9_EXP_ET_3(inst) \ + : 0, }, \ + { .cmd = FF84_DW2_CMD_ET_4(inst), \ + .exp = FF84_DW1_SUP_ET_4(inst) \ + ? BFP_DW9_EXP_ET_4(inst) \ + : 0, }}), \ + ({{ .cmd = SPI_NOR_CMD_SE_4B, \ + .exp = 0x0C }})) + +#define DEFAULT_ERASE_TYPES(inst) \ + USES_4BYTE_ADDR(inst) && HAS_4BYTE_ADDR_CMDS(inst) \ + ? dev##inst##_erase_types_4b \ + : dev##inst##_erase_types + +#define BFP_DW15_QER(inst) \ + SFDP_FIELD(inst, sfdp_bfp, 15, GENMASK(22, 20)) + +#define BFP_DW19_OER(inst) \ + SFDP_FIELD(inst, sfdp_bfp, 19, GENMASK(22, 20)) + +#define ENTER_4BYTE_ADDR(inst) \ + (!USES_4BYTE_ADDR(inst) ? ENTER_4BYTE_ADDR_NONE : \ + (BFP_ENTER_4BYTE_ADDR_METHODS(inst) \ + & (BFP_DW16_4B_ADDR_PER_CMD | \ + BFP_DW16_4B_ADDR_ALWAYS)) ? ENTER_4BYTE_ADDR_NONE : \ + (BFP_ENTER_4BYTE_ADDR_METHODS(inst) \ + & BFP_DW16_4B_ADDR_ENTER_B7) ? ENTER_4BYTE_ADDR_B7 : \ + (BFP_ENTER_4BYTE_ADDR_METHODS(inst) \ + & BFP_DW16_4B_ADDR_ENTER_06_B7) ? ENTER_4BYTE_ADDR_06_B7 : \ + ENTER_4BYTE_ADDR_NONE) + +#define DEFAULT_SWITCH_INFO(inst) { \ + .quad_enable_req = BFP_DW15_QER(inst), \ + .octal_enable_req = BFP_DW19_OER(inst), \ + .enter_4byte_addr = ENTER_4BYTE_ADDR(inst) } + +#define BFP_FLASH_SIZE(dw2) \ + ((dw2 & BIT(31)) \ + ? BIT(MIN(31, (dw2 & BIT_MASK(31)) - 3)) \ + : dw2 / 8) + +#define FLASH_SIZE(inst) \ + (DT_INST_NODE_HAS_PROP(inst, size) \ + ? DT_INST_PROP(inst, size) / 8 \ + : BFP_FLASH_SIZE(SFDP_DW(inst, sfdp_bfp, 2))) + +#define BFP_FLASH_PAGE_EXP(inst) SFDP_FIELD(inst, sfdp_bfp, 11, GENMASK(7, 4)) + +#define FLASH_PAGE_SIZE(inst) \ + (BFP_FLASH_PAGE_EXP(inst) \ + ? BIT(BFP_FLASH_PAGE_EXP(inst)) \ + : SPI_NOR_PAGE_SIZE) + +#define SFDP_BUILD_ASSERTS(inst) \ + BUILD_ASSERT(DT_INST_NODE_HAS_PROP(inst, sfdp_bfp), \ + "sfdp-bfp property needed in " \ + DT_NODE_FULL_NAME(DT_DRV_INST(inst))); \ + BUILD_ASSERT((DT_INST_ENUM_IDX(inst, mspi_io_mode) \ + != MSPI_IO_MODE_OCTAL) || \ + DT_INST_NODE_HAS_PROP(inst, sfdp_ff05), \ + "sfdp-ff05 property needed in " \ + DT_NODE_FULL_NAME(DT_DRV_INST(inst))); \ + BUILD_ASSERT(!USES_4BYTE_ADDR(inst) || \ + DT_INST_NODE_HAS_PROP(inst, sfdp_ff84), \ + "sfdp-ff84 property needed in " \ + DT_NODE_FULL_NAME(DT_DRV_INST(inst))); \ + BUILD_ASSERT(!USES_8D_8D_8D(inst) || \ + BFP_DW18_CMD_EXT(inst) <= BFP_DW18_CMD_EXT_INV, \ + "Unsupported Octal Command Extension mode in " \ + DT_NODE_FULL_NAME(DT_DRV_INST(inst))) + +#else + +#define USES_4BYTE_ADDR(inst) \ + (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_OCTAL) + +#define DEFAULT_CMD_INFO(inst) { \ + .pp_cmd = USES_4BYTE_ADDR(inst) \ + ? SPI_NOR_CMD_PP_4B \ + : SPI_NOR_CMD_PP, \ + .read_cmd = USES_4BYTE_ADDR(inst) \ + ? SPI_NOR_CMD_READ_FAST_4B \ + : SPI_NOR_CMD_READ_FAST, \ + .read_mode_bit_cycles = 0, \ + .read_dummy_cycles = 8, \ + .uses_4byte_addr = USES_4BYTE_ADDR(inst), \ + .cmd_extension = CMD_EXTENSION_NONE, \ + .sfdp_addr_4 = false, \ + .sfdp_dummy_20 = false, \ + .rdsr_addr_4 = false, \ + .rdsr_dummy = 0, \ + .rdid_addr_4 = false, \ + .rdid_dummy = 0, } + +#define DEFAULT_ERASE_TYPES_DEFINE(inst) \ + static const struct jesd216_erase_type \ + dev##inst##_erase_types[JESD216_NUM_ERASE_TYPES] = \ + {{ .cmd = SPI_NOR_CMD_SE, \ + .exp = 0x0C }}; \ + static const struct jesd216_erase_type \ + dev##inst##_erase_types_4b[JESD216_NUM_ERASE_TYPES] = \ + {{ .cmd = SPI_NOR_CMD_SE_4B, \ + .exp = 0x0C }} + +#define DEFAULT_ERASE_TYPES(inst) \ + USES_4BYTE_ADDR(inst) ? dev##inst##_erase_types_4b \ + : dev##inst##_erase_types + +#define DEFAULT_SWITCH_INFO(inst) { \ + .quad_enable_req = DT_INST_ENUM_IDX_OR(inst, quad_enable_requirements, \ + JESD216_DW15_QER_VAL_NONE), \ + .octal_enable_req = OCTAL_ENABLE_REQ_NONE, \ + .enter_4byte_addr = ENTER_4BYTE_ADDR_NONE } + +#define FLASH_SIZE(inst) (DT_INST_PROP(inst, size) / 8) + +#define FLASH_PAGE_SIZE(inst) SPI_NOR_PAGE_SIZE + +#define SFDP_BUILD_ASSERTS(inst) + +#endif /* CONFIG_FLASH_MSPI_NOR_USE_SFDP */ diff --git a/dts/bindings/mtd/jedec,jesd216.yaml b/dts/bindings/mtd/jedec,jesd216.yaml index c55440456c2a..d5f75c74dd3d 100644 --- a/dts/bindings/mtd/jedec,jesd216.yaml +++ b/dts/bindings/mtd/jedec,jesd216.yaml @@ -35,6 +35,18 @@ properties: information in cases were runtime retrieval of SFDP data is not desired. + sfdp-ff05: + type: uint8-array + description: | + Contains the 32-bit words in little-endian byte order from the JESD216 + SFDP xSPI Profile 1.0 table. + + sfdp-ff84: + type: uint8-array + description: | + Contains the 32-bit words in little-endian byte order from the JESD216 + SFDP 4-byte Address Instruction Parameter table. + quad-enable-requirements: type: string enum: From 034396afc6d0dc498bd5e8f075f84ae258e58651 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Fri, 11 Jul 2025 14:46:28 +0200 Subject: [PATCH 0765/2141] [nrf fromtree] drivers: flash_mspi_nor: Refactor handling of commands MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Use standard operation codes and parameters from SFDP for handling the used flash commands (allow to override some of them through dts with the `read-command`, `write-command`, and `rx-dummy` properties) - Use all available erase types as specified by SFDP - Allow using all IO modes - Add support for switching to 4-byte addressing mode - Use common functions for reading and writing of status registers and for enabling write operations - Switch IO mode (between the target one and Single IO) in a common function that performs transfers and do it only when required for a given command - Make checking of JEDEC ID at initialization optional Signed-off-by: Andrzej Głąbek (cherry picked from commit cafa288197e5e65d01e38386690b673a39a87205) --- drivers/flash/flash_mspi_nor.c | 771 ++++++++++++++++---------- drivers/flash/flash_mspi_nor.h | 199 +------ drivers/flash/flash_mspi_nor_quirks.h | 68 +-- drivers/flash/flash_mspi_nor_sfdp.h | 17 +- dts/bindings/mtd/jedec,mspi-nor.yaml | 24 +- 5 files changed, 551 insertions(+), 528 deletions(-) diff --git a/drivers/flash/flash_mspi_nor.c b/drivers/flash/flash_mspi_nor.c index 125aedfa250f..abf9bb85fc8c 100644 --- a/drivers/flash/flash_mspi_nor.c +++ b/drivers/flash/flash_mspi_nor.c @@ -16,12 +16,30 @@ LOG_MODULE_REGISTER(flash_mspi_nor, CONFIG_FLASH_LOG_LEVEL); +#define XIP_DEV_CFG_MASK (MSPI_DEVICE_CONFIG_CMD_LEN || \ + MSPI_DEVICE_CONFIG_ADDR_LEN || \ + MSPI_DEVICE_CONFIG_READ_CMD || \ + MSPI_DEVICE_CONFIG_WRITE_CMD || \ + MSPI_DEVICE_CONFIG_RX_DUMMY || \ + MSPI_DEVICE_CONFIG_TX_DUMMY) + +#define NON_XIP_DEV_CFG_MASK (MSPI_DEVICE_CONFIG_ALL & ~XIP_DEV_CFG_MASK) + +static void set_up_xfer(const struct device *dev, enum mspi_xfer_direction dir); +static int perform_xfer(const struct device *dev, + uint8_t cmd, bool mem_access); +static int cmd_rdsr(const struct device *dev, uint8_t op_code, uint8_t *sr); +static int wait_until_ready(const struct device *dev, k_timeout_t poll_period); +static int cmd_wren(const struct device *dev); +static int cmd_wrsr(const struct device *dev, uint8_t op_code, + uint8_t sr_cnt, uint8_t *sr); + #include "flash_mspi_nor_quirks.h" -void flash_mspi_command_set(const struct device *dev, const struct flash_mspi_nor_cmd *cmd) +static void set_up_xfer(const struct device *dev, enum mspi_xfer_direction dir) { - struct flash_mspi_nor_data *dev_data = dev->data; const struct flash_mspi_nor_config *dev_config = dev->config; + struct flash_mspi_nor_data *dev_data = dev->data; memset(&dev_data->xfer, 0, sizeof(dev_data->xfer)); memset(&dev_data->packet, 0, sizeof(dev_data->packet)); @@ -31,32 +49,186 @@ void flash_mspi_command_set(const struct device *dev, const struct flash_mspi_no dev_data->xfer.num_packet = 1; dev_data->xfer.timeout = dev_config->transfer_timeout; - dev_data->xfer.cmd_length = cmd->cmd_length; - dev_data->xfer.addr_length = cmd->addr_length; - dev_data->xfer.tx_dummy = (cmd->dir == MSPI_TX) ? - cmd->tx_dummy : dev_config->mspi_nor_cfg.tx_dummy; - dev_data->xfer.rx_dummy = (cmd->dir == MSPI_RX) ? - cmd->rx_dummy : dev_config->mspi_nor_cfg.rx_dummy; + dev_data->packet.dir = dir; +} + +static void set_up_xfer_with_addr(const struct device *dev, + enum mspi_xfer_direction dir, + uint32_t addr) +{ + struct flash_mspi_nor_data *dev_data = dev->data; + + set_up_xfer(dev, dir); + dev_data->xfer.addr_length = dev_data->cmd_info.uses_4byte_addr + ? 4 : 3; + dev_data->packet.address = addr; +} + +static uint16_t get_extended_command(const struct device *dev, + uint8_t cmd) +{ + struct flash_mspi_nor_data *dev_data = dev->data; + uint8_t cmd_extension = cmd; + + if (dev_data->cmd_info.cmd_extension == CMD_EXTENSION_INVERSE) { + cmd_extension = ~cmd_extension; + } - dev_data->packet.dir = cmd->dir; - dev_data->packet.cmd = cmd->cmd; + return ((uint16_t)cmd << 8) | cmd_extension; } -static int dev_cfg_apply(const struct device *dev, const struct mspi_dev_cfg *cfg) +static int perform_xfer(const struct device *dev, + uint8_t cmd, bool mem_access) { const struct flash_mspi_nor_config *dev_config = dev->config; struct flash_mspi_nor_data *dev_data = dev->data; + const struct mspi_dev_cfg *cfg = NULL; + int rc; - if (dev_data->curr_cfg == cfg) { - return 0; + if (dev_data->cmd_info.cmd_extension != CMD_EXTENSION_NONE && + dev_data->in_target_io_mode) { + dev_data->xfer.cmd_length = 2; + dev_data->packet.cmd = get_extended_command(dev, cmd); + } else { + dev_data->xfer.cmd_length = 1; + dev_data->packet.cmd = cmd; } - int rc = mspi_dev_config(dev_config->bus, &dev_config->mspi_id, - MSPI_DEVICE_CONFIG_ALL, cfg); + if (dev_config->multi_io_cmd || + dev_config->mspi_nor_cfg.io_mode == MSPI_IO_MODE_SINGLE) { + /* If multiple IO lines are used in all the transfer phases + * or in none of them, there's no need to switch the IO mode. + */ + } else if (mem_access) { + /* For commands accessing the flash memory (read and program), + * ensure that the target IO mode is active. + */ + if (!dev_data->in_target_io_mode) { + cfg = &dev_config->mspi_nor_cfg; + } + } else { + /* For all other commands, switch to Single IO mode if a given + * command needs the data or address phase and in the target IO + * mode multiple IO lines are used in these phases. + */ + if (dev_data->in_target_io_mode) { + if (dev_data->packet.num_bytes != 0 || + (dev_data->xfer.addr_length != 0 && + !dev_config->single_io_addr)) { + /* Only the IO mode is to be changed, so the + * initial configuration structure can be used + * for this operation. + */ + cfg = &dev_config->mspi_nor_init_cfg; + } + } + } + + if (cfg) { + rc = mspi_dev_config(dev_config->bus, &dev_config->mspi_id, + MSPI_DEVICE_CONFIG_IO_MODE, cfg); + if (rc < 0) { + LOG_ERR("%s: dev_config() failed: %d", __func__, rc); + return rc; + } + + dev_data->in_target_io_mode = mem_access; + } + + rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, + &dev_data->xfer); if (rc < 0) { - LOG_ERR("Failed to set device config: %p error: %d", cfg, rc); + LOG_ERR("%s: transceive() failed: %d", __func__, rc); + return rc; } - return rc; + + return 0; +} + +static int cmd_rdsr(const struct device *dev, uint8_t op_code, uint8_t *sr) +{ + struct flash_mspi_nor_data *dev_data = dev->data; + int rc; + + set_up_xfer(dev, MSPI_RX); + if (dev_data->in_target_io_mode) { + dev_data->xfer.rx_dummy = dev_data->cmd_info.rdsr_dummy; + dev_data->xfer.addr_length = dev_data->cmd_info.rdsr_addr_4 + ? 4 : 0; + } + dev_data->packet.num_bytes = sizeof(uint8_t); + dev_data->packet.data_buf = sr; + rc = perform_xfer(dev, op_code, false); + if (rc < 0) { + LOG_ERR("%s 0x%02x failed: %d", __func__, op_code, rc); + return rc; + } + + return 0; +} + +static int wait_until_ready(const struct device *dev, k_timeout_t poll_period) +{ + int rc; + uint8_t status_reg; + + while (true) { + rc = cmd_rdsr(dev, SPI_NOR_CMD_RDSR, &status_reg); + if (rc < 0) { + LOG_ERR("%s - status xfer failed: %d", __func__, rc); + return rc; + } + + if (!(status_reg & SPI_NOR_WIP_BIT)) { + break; + } + + k_sleep(poll_period); + } + + return 0; +} + +static int cmd_wren(const struct device *dev) +{ + int rc; + + set_up_xfer(dev, MSPI_TX); + rc = perform_xfer(dev, SPI_NOR_CMD_WREN, false); + if (rc < 0) { + LOG_ERR("%s failed: %d", __func__, rc); + return rc; + } + + return 0; +} + +static int cmd_wrsr(const struct device *dev, uint8_t op_code, + uint8_t sr_cnt, uint8_t *sr) +{ + struct flash_mspi_nor_data *dev_data = dev->data; + int rc; + + rc = cmd_wren(dev); + if (rc < 0) { + return rc; + } + + set_up_xfer(dev, MSPI_TX); + dev_data->packet.num_bytes = sr_cnt; + dev_data->packet.data_buf = sr; + rc = perform_xfer(dev, op_code, false); + if (rc < 0) { + LOG_ERR("%s 0x%02x failed: %d", __func__, op_code, rc); + return rc; + } + + rc = wait_until_ready(dev, K_USEC(1)); + if (rc < 0) { + return rc; + } + + return 0; } static int acquire(const struct device *dev) @@ -71,15 +243,26 @@ static int acquire(const struct device *dev) if (rc < 0) { LOG_ERR("pm_device_runtime_get() failed: %d", rc); } else { + enum mspi_dev_cfg_mask mask; + + if (dev_config->multiperipheral_bus) { + mask = NON_XIP_DEV_CFG_MASK; + } else { + mask = MSPI_DEVICE_CONFIG_NONE; + } + /* This acquires the MSPI controller and reconfigures it * if needed for the flash device. */ rc = mspi_dev_config(dev_config->bus, &dev_config->mspi_id, - dev_config->mspi_nor_cfg_mask, - &dev_config->mspi_nor_cfg); + mask, &dev_config->mspi_nor_cfg); if (rc < 0) { LOG_ERR("mspi_dev_config() failed: %d", rc); } else { + if (dev_config->multiperipheral_bus) { + dev_data->in_target_io_mode = true; + } + return 0; } @@ -117,10 +300,34 @@ static inline uint16_t dev_page_size(const struct device *dev) return dev_config->page_size; } +static inline +const struct jesd216_erase_type *dev_erase_types(const struct device *dev) +{ + struct flash_mspi_nor_data *dev_data = dev->data; + + return dev_data->erase_types; +} + +static uint8_t get_rx_dummy(const struct device *dev) +{ + const struct flash_mspi_nor_config *dev_config = dev->config; + struct flash_mspi_nor_data *dev_data = dev->data; + + /* If the number of RX dummy cycles is specified in dts, use that value. */ + if (dev_config->rx_dummy_specified) { + return dev_config->mspi_nor_cfg.rx_dummy; + } + + /* Since it's not yet possible to specify mode bits with MSPI API, + * treat mode bit cycles as just dummy. + */ + return dev_data->cmd_info.read_mode_bit_cycles + + dev_data->cmd_info.read_dummy_cycles; +} + static int api_read(const struct device *dev, off_t addr, void *dest, size_t size) { - const struct flash_mspi_nor_config *dev_config = dev->config; struct flash_mspi_nor_data *dev_data = dev->data; const uint32_t flash_size = dev_flash_size(dev); int rc; @@ -138,23 +345,11 @@ static int api_read(const struct device *dev, off_t addr, void *dest, return rc; } - if (dev_config->jedec_cmds->read.force_single) { - rc = dev_cfg_apply(dev, &dev_config->mspi_nor_init_cfg); - } else { - rc = dev_cfg_apply(dev, &dev_config->mspi_nor_cfg); - } - - if (rc < 0) { - return rc; - } - - /* TODO: get rid of all these hard-coded values for MX25Ux chips */ - flash_mspi_command_set(dev, &dev_config->jedec_cmds->read); - dev_data->packet.address = addr; + set_up_xfer_with_addr(dev, MSPI_RX, addr); + dev_data->xfer.rx_dummy = get_rx_dummy(dev); dev_data->packet.data_buf = dest; dev_data->packet.num_bytes = size; - rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, - &dev_data->xfer); + rc = perform_xfer(dev, dev_data->cmd_info.read_cmd, true); release(dev); @@ -166,85 +361,9 @@ static int api_read(const struct device *dev, off_t addr, void *dest, return 0; } -static int status_get(const struct device *dev, uint8_t *status) -{ - const struct flash_mspi_nor_config *dev_config = dev->config; - struct flash_mspi_nor_data *dev_data = dev->data; - int rc; - - /* Enter command mode */ - if (dev_config->jedec_cmds->status.force_single) { - rc = dev_cfg_apply(dev, &dev_config->mspi_nor_init_cfg); - } else { - rc = dev_cfg_apply(dev, &dev_config->mspi_nor_cfg); - } - - if (rc < 0) { - LOG_ERR("Switching to dev_cfg failed: %d", rc); - return rc; - } - - flash_mspi_command_set(dev, &dev_config->jedec_cmds->status); - dev_data->packet.data_buf = status; - dev_data->packet.num_bytes = sizeof(uint8_t); - - rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, &dev_data->xfer); - - if (rc < 0) { - LOG_ERR("Status xfer failed: %d", rc); - return rc; - } - - return rc; -} - -static int wait_until_ready(const struct device *dev, k_timeout_t poll_period) -{ - int rc; - uint8_t status_reg; - - while (true) { - rc = status_get(dev, &status_reg); - - if (rc < 0) { - LOG_ERR("Wait until ready - status xfer failed: %d", rc); - return rc; - } - - if (!(status_reg & SPI_NOR_WIP_BIT)) { - break; - } - - k_sleep(poll_period); - } - - return 0; -} - -static int write_enable(const struct device *dev) -{ - const struct flash_mspi_nor_config *dev_config = dev->config; - struct flash_mspi_nor_data *dev_data = dev->data; - int rc; - - if (dev_config->jedec_cmds->write_en.force_single) { - rc = dev_cfg_apply(dev, &dev_config->mspi_nor_init_cfg); - } else { - rc = dev_cfg_apply(dev, &dev_config->mspi_nor_cfg); - } - - if (rc < 0) { - return rc; - } - - flash_mspi_command_set(dev, &dev_config->jedec_cmds->write_en); - return mspi_transceive(dev_config->bus, &dev_config->mspi_id, &dev_data->xfer); -} - static int api_write(const struct device *dev, off_t addr, const void *src, size_t size) { - const struct flash_mspi_nor_config *dev_config = dev->config; struct flash_mspi_nor_data *dev_data = dev->data; const uint32_t flash_size = dev_flash_size(dev); const uint16_t page_size = dev_page_size(dev); @@ -269,27 +388,14 @@ static int api_write(const struct device *dev, off_t addr, const void *src, uint16_t page_left = page_size - page_offset; uint16_t to_write = (uint16_t)MIN(size, page_left); - if (write_enable(dev) < 0) { - LOG_ERR("Write enable xfer failed: %d", rc); + if (cmd_wren(dev) < 0) { break; } - if (dev_config->jedec_cmds->page_program.force_single) { - rc = dev_cfg_apply(dev, &dev_config->mspi_nor_init_cfg); - } else { - rc = dev_cfg_apply(dev, &dev_config->mspi_nor_cfg); - } - - if (rc < 0) { - return rc; - } - - flash_mspi_command_set(dev, &dev_config->jedec_cmds->page_program); - dev_data->packet.address = addr; + set_up_xfer_with_addr(dev, MSPI_TX, addr); dev_data->packet.data_buf = (uint8_t *)src; dev_data->packet.num_bytes = to_write; - rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, - &dev_data->xfer); + rc = perform_xfer(dev, dev_data->cmd_info.pp_cmd, true); if (rc < 0) { LOG_ERR("Page program xfer failed: %d", rc); break; @@ -310,9 +416,28 @@ static int api_write(const struct device *dev, off_t addr, const void *src, return rc; } +static const struct jesd216_erase_type *find_best_erase_type( + const struct device *dev, off_t addr, size_t size) +{ + const struct jesd216_erase_type *erase_types = dev_erase_types(dev); + const struct jesd216_erase_type *best_et = NULL; + + for (int i = 0; i < JESD216_NUM_ERASE_TYPES; ++i) { + const struct jesd216_erase_type *et = &erase_types[i]; + + if ((et->exp != 0) + && SPI_NOR_IS_ALIGNED(addr, et->exp) + && (size >= BIT(et->exp)) + && ((best_et == NULL) || (et->exp > best_et->exp))) { + best_et = et; + } + } + + return best_et; +} + static int api_erase(const struct device *dev, off_t addr, size_t size) { - const struct flash_mspi_nor_config *dev_config = dev->config; struct flash_mspi_nor_data *dev_data = dev->data; const uint32_t flash_size = dev_flash_size(dev); int rc = 0; @@ -335,45 +460,33 @@ static int api_erase(const struct device *dev, off_t addr, size_t size) } while (size > 0) { - rc = write_enable(dev); - if (rc < 0) { - LOG_ERR("Write enable failed."); + if (cmd_wren(dev) < 0) { break; } if (size == flash_size) { /* Chip erase. */ - if (dev_config->jedec_cmds->chip_erase.force_single) { - rc = dev_cfg_apply(dev, &dev_config->mspi_nor_init_cfg); - } else { - rc = dev_cfg_apply(dev, &dev_config->mspi_nor_cfg); - } - - if (rc < 0) { - return rc; - } + set_up_xfer(dev, MSPI_TX); + rc = perform_xfer(dev, SPI_NOR_CMD_CE, false); - flash_mspi_command_set(dev, &dev_config->jedec_cmds->chip_erase); size -= flash_size; } else { - /* Sector erase. */ - if (dev_config->jedec_cmds->sector_erase.force_single) { - rc = dev_cfg_apply(dev, &dev_config->mspi_nor_init_cfg); - } else { - rc = dev_cfg_apply(dev, &dev_config->mspi_nor_cfg); - } + const struct jesd216_erase_type *best_et = + find_best_erase_type(dev, addr, size); - if (rc < 0) { - return rc; - } + if (best_et != NULL) { + set_up_xfer_with_addr(dev, MSPI_TX, addr); + rc = perform_xfer(dev, best_et->cmd, false); - flash_mspi_command_set(dev, &dev_config->jedec_cmds->sector_erase); - dev_data->packet.address = addr; - addr += SPI_NOR_SECTOR_SIZE; - size -= SPI_NOR_SECTOR_SIZE; + addr += BIT(best_et->exp); + size -= BIT(best_et->exp); + } else { + LOG_ERR("Can't erase %zu at 0x%lx", + size, (long)addr); + rc = -EINVAL; + break; + } } - rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, - &dev_data->xfer); if (rc < 0) { LOG_ERR("Erase command 0x%02x xfer failed: %d", dev_data->packet.cmd, rc); @@ -410,30 +523,49 @@ struct flash_parameters *api_get_parameters(const struct device *dev) return ¶meters; } -static int read_jedec_id(const struct device *dev, uint8_t *id) +static int sfdp_read(const struct device *dev, off_t addr, void *dest, + size_t size) { - const struct flash_mspi_nor_config *dev_config = dev->config; struct flash_mspi_nor_data *dev_data = dev->data; int rc; - if (dev_config->jedec_cmds->id.force_single) { - rc = dev_cfg_apply(dev, &dev_config->mspi_nor_init_cfg); + set_up_xfer(dev, MSPI_RX); + if (dev_data->in_target_io_mode) { + dev_data->xfer.rx_dummy = dev_data->cmd_info.sfdp_dummy_20 + ? 20 : 8; + dev_data->xfer.addr_length = dev_data->cmd_info.sfdp_addr_4 + ? 4 : 3; } else { - rc = dev_cfg_apply(dev, &dev_config->mspi_nor_cfg); + dev_data->xfer.rx_dummy = 8; + dev_data->xfer.addr_length = 3; } - + dev_data->packet.address = addr; + dev_data->packet.data_buf = dest; + dev_data->packet.num_bytes = size; + rc = perform_xfer(dev, JESD216_CMD_READ_SFDP, false); if (rc < 0) { - return rc; + LOG_ERR("Read SFDP xfer failed: %d", rc); } - flash_mspi_command_set(dev, &dev_config->jedec_cmds->id); + return rc; +} + +static int read_jedec_id(const struct device *dev, uint8_t *id) +{ + struct flash_mspi_nor_data *dev_data = dev->data; + int rc; + + set_up_xfer(dev, MSPI_RX); + if (dev_data->in_target_io_mode) { + dev_data->xfer.rx_dummy = dev_data->cmd_info.rdid_dummy; + dev_data->xfer.addr_length = dev_data->cmd_info.rdid_addr_4 + ? 4 : 0; + } dev_data->packet.data_buf = id; dev_data->packet.num_bytes = JESD216_READ_ID_LEN; - - rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, - &dev_data->xfer); + rc = perform_xfer(dev, SPI_NOR_CMD_RDID, false); if (rc < 0) { - LOG_ERR("Read JEDEC ID failed: %d\n", rc); + LOG_ERR("Read JEDEC ID failed: %d", rc); } return rc; @@ -455,8 +587,6 @@ static void api_page_layout(const struct device *dev, static int api_sfdp_read(const struct device *dev, off_t addr, void *dest, size_t size) { - const struct flash_mspi_nor_config *dev_config = dev->config; - struct flash_mspi_nor_data *dev_data = dev->data; int rc; if (size == 0) { @@ -468,26 +598,7 @@ static int api_sfdp_read(const struct device *dev, off_t addr, void *dest, return rc; } - if (dev_config->jedec_cmds->sfdp.force_single) { - rc = dev_cfg_apply(dev, &dev_config->mspi_nor_init_cfg); - } else { - rc = dev_cfg_apply(dev, &dev_config->mspi_nor_cfg); - } - - if (rc < 0) { - return rc; - } - - flash_mspi_command_set(dev, &dev_config->jedec_cmds->sfdp); - dev_data->packet.address = addr; - dev_data->packet.data_buf = dest; - dev_data->packet.num_bytes = size; - rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, - &dev_data->xfer); - if (rc < 0) { - printk("Read SFDP xfer failed: %d\n", rc); - return rc; - } + rc = sfdp_read(dev, addr, dest, size); release(dev); @@ -526,31 +637,19 @@ static int dev_pm_action_cb(const struct device *dev, static int quad_enable_set(const struct device *dev, bool enable) { - const struct flash_mspi_nor_config *dev_config = dev->config; struct flash_mspi_nor_data *dev_data = dev->data; int rc; - flash_mspi_command_set(dev, &commands_single.write_en); - rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, - &dev_data->xfer); + rc = cmd_wren(dev); if (rc < 0) { LOG_ERR("Failed to set write enable: %d", rc); return rc; } if (dev_data->switch_info.quad_enable_req == JESD216_DW15_QER_VAL_S1B6) { - const struct flash_mspi_nor_cmd cmd_status = { - .dir = MSPI_TX, - .cmd = SPI_NOR_CMD_WRSR, - .cmd_length = 1, - }; uint8_t mode_payload = enable ? BIT(6) : 0; - flash_mspi_command_set(dev, &cmd_status); - dev_data->packet.data_buf = &mode_payload; - dev_data->packet.num_bytes = sizeof(mode_payload); - rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, &dev_data->xfer); - + rc = cmd_wrsr(dev, SPI_NOR_CMD_WRSR, 1, &mode_payload); if (rc < 0) { LOG_ERR("Failed to enable/disable quad mode: %d", rc); return rc; @@ -570,8 +669,29 @@ static int quad_enable_set(const struct device *dev, bool enable) return 0; } +static int enter_4byte_addressing_mode(const struct device *dev) +{ + struct flash_mspi_nor_data *dev_data = dev->data; + int rc; + + if (dev_data->switch_info.enter_4byte_addr == ENTER_4BYTE_ADDR_06_B7) { + rc = cmd_wren(dev); + if (rc < 0) { + return rc; + } + } + + set_up_xfer(dev, MSPI_TX); + rc = perform_xfer(dev, 0xB7, false); + if (rc < 0) { + LOG_ERR("Command 0xB7 failed: %d", rc); + return rc; + } -static int default_io_mode(const struct device *dev) + return 0; +} + +static int switch_to_target_io_mode(const struct device *dev) { const struct flash_mspi_nor_config *dev_config = dev->config; struct flash_mspi_nor_data *dev_data = dev->data; @@ -594,16 +714,25 @@ static int default_io_mode(const struct device *dev) } } - if ((dev_config->quirks != NULL) && (dev_config->quirks->post_switch_mode != NULL)) { - rc = dev_config->quirks->post_switch_mode(dev); + if (dev_data->switch_info.enter_4byte_addr != ENTER_4BYTE_ADDR_NONE) { + rc = enter_4byte_addressing_mode(dev); + if (rc < 0) { + LOG_ERR("Failed to enter 4-byte addressing mode: %d", rc); + return rc; + } } - if (rc < 0) { - LOG_ERR("Failed to change IO mode: %d\n", rc); - return rc; + if (dev_config->quirks != NULL && + dev_config->quirks->post_switch_mode != NULL) { + rc = dev_config->quirks->post_switch_mode(dev); + if (rc < 0) { + return rc; + } } - return dev_cfg_apply(dev, &dev_config->mspi_nor_cfg); + return mspi_dev_config(dev_config->bus, &dev_config->mspi_id, + NON_XIP_DEV_CFG_MASK, + &dev_config->mspi_nor_cfg); } #if defined(WITH_RESET_GPIO) @@ -651,14 +780,20 @@ static int flash_chip_init(const struct device *dev) struct flash_mspi_nor_data *dev_data = dev->data; enum mspi_io_mode io_mode = dev_config->mspi_nor_cfg.io_mode; uint8_t id[JESD216_READ_ID_LEN] = {0}; + uint16_t dts_cmd = 0; + uint32_t sfdp_signature; int rc; - rc = dev_cfg_apply(dev, &dev_config->mspi_nor_init_cfg); - + rc = mspi_dev_config(dev_config->bus, &dev_config->mspi_id, + MSPI_DEVICE_CONFIG_ALL, + &dev_config->mspi_nor_init_cfg); if (rc < 0) { + LOG_ERR("%s: dev_config() failed: %d", __func__, rc); return rc; } + dev_data->in_target_io_mode = false; + /* Some chips reuse RESET pin for data in Quad modes: * force single line mode before resetting. */ @@ -695,51 +830,114 @@ static int flash_chip_init(const struct device *dev) rc = dev_config->quirks->pre_init(dev); } - flash_mspi_command_set(dev, &commands_single.id); - dev_data->packet.data_buf = id; - dev_data->packet.num_bytes = sizeof(id); - - rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, - &dev_data->xfer); - if (rc < 0) { - LOG_ERR("Failed to read JEDEC ID in initial line mode: %d", rc); - return rc; + /* Allow users to specify commands for Read and Page Program operations + * through dts to override what was taken from SFDP and perhaps altered + * in the pre_init quirk. Also the number of dummy cycles for the Read + * operation can be overridden this way, see get_rx_dummy(). + */ + if (dev_config->mspi_nor_cfg.read_cmd != 0) { + dts_cmd = (uint16_t)dev_config->mspi_nor_cfg.read_cmd; + if (dev_config->mspi_nor_cfg.cmd_length > 1) { + dev_data->cmd_info.read_cmd = (uint8_t)(dts_cmd >> 8); + } else { + dev_data->cmd_info.read_cmd = (uint8_t)dts_cmd; + } + } + if (dev_config->mspi_nor_cfg.write_cmd != 0) { + dts_cmd = (uint16_t)dev_config->mspi_nor_cfg.write_cmd; + if (dev_config->mspi_nor_cfg.cmd_length > 1) { + dev_data->cmd_info.pp_cmd = (uint8_t)(dts_cmd >> 8); + } else { + dev_data->cmd_info.pp_cmd = (uint8_t)dts_cmd; + } + } + if (dts_cmd != 0) { + if (dev_config->mspi_nor_cfg.cmd_length <= 1) { + dev_data->cmd_info.cmd_extension = CMD_EXTENSION_NONE; + } else if ((dts_cmd & 0xFF) == ((dts_cmd >> 8) & 0xFF)) { + dev_data->cmd_info.cmd_extension = CMD_EXTENSION_SAME; + } else { + dev_data->cmd_info.cmd_extension = CMD_EXTENSION_INVERSE; + } } - rc = default_io_mode(dev); + if (dev_config->jedec_id_specified) { + rc = read_jedec_id(dev, id); + if (rc < 0) { + LOG_ERR("Failed to read JEDEC ID: %d", rc); + return rc; + } + + if (memcmp(id, dev_config->jedec_id, sizeof(id)) != 0) { + LOG_ERR("JEDEC ID mismatch, read: %02x %02x %02x, " + "expected: %02x %02x %02x", + id[0], id[1], id[2], + dev_config->jedec_id[0], + dev_config->jedec_id[1], + dev_config->jedec_id[2]); + return -ENODEV; + } + } + rc = switch_to_target_io_mode(dev); if (rc < 0) { - LOG_ERR("Failed to switch to default io mode: %d", rc); + LOG_ERR("Failed to switch to target io mode: %d", rc); return rc; } - /* Reading JEDEC ID for mode that forces single lane would be redundant, - * since it switches back to single lane mode. Use ID from previous read. - */ - if (!dev_config->jedec_cmds->id.force_single) { - rc = read_jedec_id(dev, id); + dev_data->in_target_io_mode = true; + + if (IS_ENABLED(CONFIG_FLASH_MSPI_NOR_USE_SFDP)) { + /* Read the SFDP signature to test if communication with + * the flash chip can be successfully performed after switching + * to target IO mode. + */ + rc = sfdp_read(dev, 0, &sfdp_signature, sizeof(sfdp_signature)); if (rc < 0) { - LOG_ERR("Failed to read JEDEC ID in final line mode: %d", rc); + LOG_ERR("Failed to read SFDP signature: %d", rc); return rc; } - } - if (memcmp(id, dev_config->jedec_id, sizeof(id)) != 0) { - LOG_ERR("JEDEC ID mismatch, read: %02x %02x %02x, " - "expected: %02x %02x %02x", - id[0], id[1], id[2], - dev_config->jedec_id[0], - dev_config->jedec_id[1], - dev_config->jedec_id[2]); - return -ENODEV; + if (sfdp_signature != JESD216_SFDP_MAGIC) { + LOG_ERR("SFDP signature mismatch: %08x, expected: %08x", + sfdp_signature, JESD216_SFDP_MAGIC); + return -ENODEV; + } } #if defined(CONFIG_MSPI_XIP) /* Enable XIP access for this chip if specified so in DT. */ if (dev_config->xip_cfg.enable) { + struct mspi_dev_cfg mspi_cfg = { + .addr_length = dev_data->cmd_info.uses_4byte_addr + ? 4 : 3, + .rx_dummy = get_rx_dummy(dev), + }; + + if (dev_data->cmd_info.cmd_extension != CMD_EXTENSION_NONE) { + mspi_cfg.cmd_length = 2; + mspi_cfg.read_cmd = get_extended_command(dev, + dev_data->cmd_info.read_cmd); + mspi_cfg.write_cmd = get_extended_command(dev, + dev_data->cmd_info.pp_cmd); + } else { + mspi_cfg.cmd_length = 1; + mspi_cfg.read_cmd = dev_data->cmd_info.read_cmd; + mspi_cfg.write_cmd = dev_data->cmd_info.pp_cmd; + } + + rc = mspi_dev_config(dev_config->bus, &dev_config->mspi_id, + XIP_DEV_CFG_MASK, &mspi_cfg); + if (rc < 0) { + LOG_ERR("Failed to configure controller for XIP: %d", + rc); + return rc; + } + rc = mspi_xip_config(dev_config->bus, &dev_config->mspi_id, &dev_config->xip_cfg); if (rc < 0) { + LOG_ERR("Failed to enable XIP: %d", rc); return rc; } } @@ -783,6 +981,39 @@ static int drv_init(const struct device *dev) return rc; } + if (dev_data->cmd_info.read_cmd == 0) { + LOG_ERR("Read command not defined for %s, " + "use \"read-command\" property to specify it.", + dev->name); + return -EINVAL; + } + + if (dev_data->cmd_info.pp_cmd == 0) { + LOG_ERR("Page Program command not defined for %s, " + "use \"write-command\" property to specify it.", + dev->name); + return -EINVAL; + } + + LOG_DBG("%s - size: %u, page %u%s", + dev->name, dev_flash_size(dev), dev_page_size(dev), + dev_data->cmd_info.uses_4byte_addr ? ", 4-byte addressing" : ""); + LOG_DBG("- read command: 0x%02X with %u mode bit and %u dummy cycles", + dev_data->cmd_info.read_cmd, + dev_data->cmd_info.read_mode_bit_cycles, + dev_data->cmd_info.read_dummy_cycles); + LOG_DBG("- page program command: 0x%02X", + dev_data->cmd_info.pp_cmd); + LOG_DBG("- erase types:"); + for (int i = 0; i < JESD216_NUM_ERASE_TYPES; ++i) { + const struct jesd216_erase_type *et = &dev_erase_types(dev)[i]; + + if (et->exp != 0) { + LOG_DBG(" - command: 0x%02X, size: %lu", + et->cmd, BIT(et->exp)); + } + } + k_sem_init(&dev_data->acquired, 1, K_SEM_MAX_LIMIT); return pm_device_driver_init(dev, dev_pm_action_cb); @@ -815,40 +1046,19 @@ static DEVICE_API(flash, drv_api) = { .dqs_enable = false, \ } -/* Define copies of mspi_io_mode enum values, so they can be used inside - * the COND_CODE_1 macros. - */ -#define _MSPI_IO_MODE_SINGLE 0 -#define _MSPI_IO_MODE_QUAD_1_4_4 6 -#define _MSPI_IO_MODE_OCTAL 7 -BUILD_ASSERT(_MSPI_IO_MODE_SINGLE == MSPI_IO_MODE_SINGLE, - "Please align _MSPI_IO_MODE_SINGLE macro value"); -BUILD_ASSERT(_MSPI_IO_MODE_QUAD_1_4_4 == MSPI_IO_MODE_QUAD_1_4_4, - "Please align _MSPI_IO_MODE_QUAD_1_4_4 macro value"); -BUILD_ASSERT(_MSPI_IO_MODE_OCTAL == MSPI_IO_MODE_OCTAL, - "Please align _MSPI_IO_MODE_OCTAL macro value"); - -/* Define a non-existing extern symbol to get an understandable compile-time error - * if the IO mode is not supported by the driver. - */ -extern const struct flash_mspi_nor_cmds mspi_io_mode_not_supported; - -#define FLASH_CMDS(inst) COND_CODE_1( \ - IS_EQ(DT_INST_ENUM_IDX(inst, mspi_io_mode), _MSPI_IO_MODE_SINGLE), \ - (&commands_single), \ - (COND_CODE_1( \ - IS_EQ(DT_INST_ENUM_IDX(inst, mspi_io_mode), _MSPI_IO_MODE_QUAD_1_4_4), \ - (&commands_quad_1_4_4), \ - (COND_CODE_1( \ - IS_EQ(DT_INST_ENUM_IDX(inst, mspi_io_mode), _MSPI_IO_MODE_OCTAL), \ - (&commands_octal), \ - (&mspi_io_mode_not_supported) \ - )) \ - )) \ -) - #define FLASH_QUIRKS(inst) FLASH_MSPI_QUIRKS_GET(DT_DRV_INST(inst)) +#define IO_MODE_FLAGS(io_mode) \ + .multi_io_cmd = (io_mode == MSPI_IO_MODE_DUAL || \ + io_mode == MSPI_IO_MODE_QUAD || \ + io_mode == MSPI_IO_MODE_OCTAL || \ + io_mode == MSPI_IO_MODE_HEX || \ + io_mode == MSPI_IO_MODE_HEX_8_8_16 || \ + io_mode == MSPI_IO_MODE_HEX_8_16_16), \ + .single_io_addr = (io_mode == MSPI_IO_MODE_DUAL_1_1_2 || \ + io_mode == MSPI_IO_MODE_QUAD_1_1_4 || \ + io_mode == MSPI_IO_MODE_OCTAL_1_1_8) + #if defined(CONFIG_FLASH_PAGE_LAYOUT) BUILD_ASSERT((CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE % 4096) == 0, "MSPI_NOR_FLASH_LAYOUT_PAGE_SIZE must be multiple of 4096"); @@ -874,13 +1084,6 @@ BUILD_ASSERT((FLASH_SIZE(inst) % CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE) == 0, \ #endif #define FLASH_MSPI_NOR_INST(inst) \ - BUILD_ASSERT((DT_INST_ENUM_IDX(inst, mspi_io_mode) == \ - MSPI_IO_MODE_SINGLE) || \ - (DT_INST_ENUM_IDX(inst, mspi_io_mode) == \ - MSPI_IO_MODE_QUAD_1_4_4) || \ - (DT_INST_ENUM_IDX(inst, mspi_io_mode) == \ - MSPI_IO_MODE_OCTAL), \ - "Only 1x, 1-4-4 and 8x I/O modes are supported for now"); \ SFDP_BUILD_ASSERTS(inst); \ PM_DEVICE_DT_INST_DEFINE(inst, dev_pm_action_cb); \ DEFAULT_ERASE_TYPES_DEFINE(inst); \ @@ -892,10 +1095,6 @@ BUILD_ASSERT((FLASH_SIZE(inst) % CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE) == 0, \ .mspi_id = MSPI_DEVICE_ID_DT_INST(inst), \ .mspi_nor_cfg = MSPI_DEVICE_CONFIG_DT_INST(inst), \ .mspi_nor_init_cfg = FLASH_INITIAL_CONFIG(inst), \ - .mspi_nor_cfg_mask = DT_PROP(DT_INST_BUS(inst), \ - software_multiperipheral) \ - ? MSPI_DEVICE_CONFIG_ALL \ - : MSPI_DEVICE_CONFIG_NONE, \ IF_ENABLED(CONFIG_MSPI_XIP, \ (.xip_cfg = MSPI_XIP_CONFIG_DT_INST(inst),)) \ IF_ENABLED(WITH_RESET_GPIO, \ @@ -906,12 +1105,16 @@ BUILD_ASSERT((FLASH_SIZE(inst) % CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE) == 0, \ / 1000,)) \ .transfer_timeout = DT_INST_PROP(inst, transfer_timeout), \ FLASH_PAGE_LAYOUT_DEFINE(inst) \ - .jedec_id = DT_INST_PROP(inst, jedec_id), \ - .jedec_cmds = FLASH_CMDS(inst), \ + .jedec_id = DT_INST_PROP_OR(inst, jedec_id, {0}), \ .quirks = FLASH_QUIRKS(inst), \ .default_erase_types = DEFAULT_ERASE_TYPES(inst), \ .default_cmd_info = DEFAULT_CMD_INFO(inst), \ .default_switch_info = DEFAULT_SWITCH_INFO(inst), \ + .jedec_id_specified = DT_INST_NODE_HAS_PROP(inst, jedec_id), \ + .rx_dummy_specified = DT_INST_NODE_HAS_PROP(inst, rx_dummy), \ + .multiperipheral_bus = DT_PROP(DT_INST_BUS(inst), \ + software_multiperipheral), \ + IO_MODE_FLAGS(DT_INST_ENUM_IDX(inst, mspi_io_mode)), \ }; \ FLASH_PAGE_LAYOUT_CHECK(inst) \ DEVICE_DT_INST_DEFINE(inst, \ diff --git a/drivers/flash/flash_mspi_nor.h b/drivers/flash/flash_mspi_nor.h index 9c96c334fbe0..13b12d58221b 100644 --- a/drivers/flash/flash_mspi_nor.h +++ b/drivers/flash/flash_mspi_nor.h @@ -69,7 +69,6 @@ struct flash_mspi_nor_config { struct mspi_dev_id mspi_id; struct mspi_dev_cfg mspi_nor_cfg; struct mspi_dev_cfg mspi_nor_init_cfg; - enum mspi_dev_cfg_mask mspi_nor_cfg_mask; #if defined(CONFIG_MSPI_XIP) struct mspi_xip_cfg xip_cfg; #endif @@ -83,213 +82,27 @@ struct flash_mspi_nor_config { struct flash_pages_layout layout; #endif uint8_t jedec_id[SPI_NOR_MAX_ID_LEN]; - const struct flash_mspi_nor_cmds *jedec_cmds; struct flash_mspi_nor_quirks *quirks; const struct jesd216_erase_type *default_erase_types; struct flash_mspi_nor_cmd_info default_cmd_info; struct flash_mspi_nor_switch_info default_switch_info; + bool jedec_id_specified : 1; + bool rx_dummy_specified : 1; + bool multiperipheral_bus : 1; + bool multi_io_cmd : 1; + bool single_io_addr : 1; }; struct flash_mspi_nor_data { struct k_sem acquired; struct mspi_xfer_packet packet; struct mspi_xfer xfer; - struct mspi_dev_cfg *curr_cfg; struct jesd216_erase_type erase_types[JESD216_NUM_ERASE_TYPES]; struct flash_mspi_nor_cmd_info cmd_info; struct flash_mspi_nor_switch_info switch_info; + bool in_target_io_mode; }; -struct flash_mspi_nor_cmd { - enum mspi_xfer_direction dir; - uint32_t cmd; - uint16_t tx_dummy; - uint16_t rx_dummy; - uint8_t cmd_length; - uint8_t addr_length; - bool force_single; -}; - -struct flash_mspi_nor_cmds { - struct flash_mspi_nor_cmd id; - struct flash_mspi_nor_cmd write_en; - struct flash_mspi_nor_cmd read; - struct flash_mspi_nor_cmd status; - struct flash_mspi_nor_cmd config; - struct flash_mspi_nor_cmd page_program; - struct flash_mspi_nor_cmd sector_erase; - struct flash_mspi_nor_cmd chip_erase; - struct flash_mspi_nor_cmd sfdp; -}; - -const struct flash_mspi_nor_cmds commands_single = { - .id = { - .dir = MSPI_RX, - .cmd = JESD216_CMD_READ_ID, - .cmd_length = 1, - }, - .write_en = { - .dir = MSPI_TX, - .cmd = SPI_NOR_CMD_WREN, - .cmd_length = 1, - }, - .read = { - .dir = MSPI_RX, - .cmd = SPI_NOR_CMD_READ_FAST, - .cmd_length = 1, - .addr_length = 3, - .rx_dummy = 8, - }, - .status = { - .dir = MSPI_RX, - .cmd = SPI_NOR_CMD_RDSR, - .cmd_length = 1, - }, - .config = { - .dir = MSPI_RX, - .cmd = SPI_NOR_CMD_RDCR, - .cmd_length = 1, - }, - .page_program = { - .dir = MSPI_TX, - .cmd = SPI_NOR_CMD_PP, - .cmd_length = 1, - .addr_length = 3, - }, - .sector_erase = { - .dir = MSPI_TX, - .cmd = SPI_NOR_CMD_SE, - .cmd_length = 1, - .addr_length = 3, - }, - .chip_erase = { - .dir = MSPI_TX, - .cmd = SPI_NOR_CMD_CE, - .cmd_length = 1, - }, - .sfdp = { - .dir = MSPI_RX, - .cmd = JESD216_CMD_READ_SFDP, - .cmd_length = 1, - .addr_length = 3, - .rx_dummy = 8, - }, -}; - -const struct flash_mspi_nor_cmds commands_quad_1_4_4 = { - .id = { - .dir = MSPI_RX, - .cmd = JESD216_CMD_READ_ID, - .cmd_length = 1, - .force_single = true, - }, - .write_en = { - .dir = MSPI_TX, - .cmd = SPI_NOR_CMD_WREN, - .cmd_length = 1, - }, - .read = { - .dir = MSPI_RX, - .cmd = SPI_NOR_CMD_4READ, - .cmd_length = 1, - .addr_length = 3, - .rx_dummy = 6, - }, - .status = { - .dir = MSPI_RX, - .cmd = SPI_NOR_CMD_RDSR, - .cmd_length = 1, - .force_single = true, - }, - .config = { - .dir = MSPI_RX, - .cmd = SPI_NOR_CMD_RDCR, - .cmd_length = 1, - .force_single = true, - }, - .page_program = { - .dir = MSPI_TX, - .cmd = SPI_NOR_CMD_PP_1_4_4, - .cmd_length = 1, - .addr_length = 3, - }, - .sector_erase = { - .dir = MSPI_TX, - .cmd = SPI_NOR_CMD_SE, - .cmd_length = 1, - .addr_length = 3, - .force_single = true, - }, - .chip_erase = { - .dir = MSPI_TX, - .cmd = SPI_NOR_CMD_CE, - .cmd_length = 1, - }, - .sfdp = { - .dir = MSPI_RX, - .cmd = JESD216_CMD_READ_SFDP, - .cmd_length = 1, - .addr_length = 3, - .rx_dummy = 8, - .force_single = true, - }, -}; - -const struct flash_mspi_nor_cmds commands_octal = { - .id = { - .dir = MSPI_RX, - .cmd = JESD216_OCMD_READ_ID, - .cmd_length = 2, - .addr_length = 4, - .rx_dummy = 4 - }, - .write_en = { - .dir = MSPI_TX, - .cmd = SPI_NOR_OCMD_WREN, - .cmd_length = 2, - }, - .read = { - .dir = MSPI_RX, - .cmd = SPI_NOR_OCMD_RD, - .cmd_length = 2, - .addr_length = 4, - .rx_dummy = 20, - }, - .status = { - .dir = MSPI_RX, - .cmd = SPI_NOR_OCMD_RDSR, - .cmd_length = 2, - .addr_length = 4, - .rx_dummy = 4, - }, - .page_program = { - .dir = MSPI_TX, - .cmd = SPI_NOR_OCMD_PAGE_PRG, - .cmd_length = 2, - .addr_length = 4, - }, - .sector_erase = { - .dir = MSPI_TX, - .cmd = SPI_NOR_OCMD_SE, - .cmd_length = 2, - .addr_length = 4, - }, - .chip_erase = { - .dir = MSPI_TX, - .cmd = SPI_NOR_OCMD_CE, - .cmd_length = 2, - }, - .sfdp = { - .dir = MSPI_RX, - .cmd = JESD216_OCMD_READ_SFDP, - .cmd_length = 2, - .addr_length = 4, - .rx_dummy = 20, - }, -}; - -void flash_mspi_command_set(const struct device *dev, const struct flash_mspi_nor_cmd *cmd); - #ifdef __cplusplus } #endif diff --git a/drivers/flash/flash_mspi_nor_quirks.h b/drivers/flash/flash_mspi_nor_quirks.h index f8a0a147e6b1..391a075131d3 100644 --- a/drivers/flash/flash_mspi_nor_quirks.h +++ b/drivers/flash/flash_mspi_nor_quirks.h @@ -71,45 +71,29 @@ static inline int mxicy_mx25r_post_switch_mode(const struct device *dev) } /* Wait for previous write to finish */ - do { - flash_mspi_command_set(dev, &dev_config->jedec_cmds->status); - dev_data->packet.data_buf = &status; - dev_data->packet.num_bytes = sizeof(status); - rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, &dev_data->xfer); - if (rc < 0) { - return rc; - } - } while (status & SPI_NOR_WIP_BIT); + rc = wait_until_ready(dev, K_USEC(1)); + if (rc < 0) { + return rc; + } /* Write enable */ - flash_mspi_command_set(dev, &commands_single.write_en); - rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, - &dev_data->xfer); + rc = cmd_wren(dev); if (rc < 0) { return rc; } /* Write status and config registers */ - const struct flash_mspi_nor_cmd cmd_status = { - .dir = MSPI_TX, - .cmd = SPI_NOR_CMD_WRSR, - .cmd_length = 1, - }; - - flash_mspi_command_set(dev, &cmd_status); + set_up_xfer(dev, MSPI_TX); dev_data->packet.data_buf = mxicy_mx25r_hp_payload; dev_data->packet.num_bytes = sizeof(mxicy_mx25r_hp_payload); - rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, &dev_data->xfer); + rc = perform_xfer(dev, SPI_NOR_CMD_WRSR, false); if (rc < 0) { return rc; } /* Wait for write to end and verify status register */ do { - flash_mspi_command_set(dev, &dev_config->jedec_cmds->status); - dev_data->packet.data_buf = &status; - dev_data->packet.num_bytes = sizeof(status); - rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, &dev_data->xfer); + rc = cmd_rdsr(dev, SPI_NOR_CMD_RDSR, &status); if (rc < 0) { return rc; } @@ -120,10 +104,10 @@ static inline int mxicy_mx25r_post_switch_mode(const struct device *dev) } /* Verify configuration registers */ - flash_mspi_command_set(dev, &dev_config->jedec_cmds->config); - dev_data->packet.data_buf = config; + set_up_xfer(dev, MSPI_RX); dev_data->packet.num_bytes = sizeof(config); - rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, &dev_data->xfer); + dev_data->packet.data_buf = config; + rc = perform_xfer(dev, SPI_NOR_CMD_RDCR, false); if (rc < 0) { return rc; } @@ -161,26 +145,18 @@ static inline int mxicy_mx25u_post_switch_mode(const struct device *dev) } /* Write enable */ - flash_mspi_command_set(dev, &commands_single.write_en); - rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, - &dev_data->xfer); + rc = cmd_wren(dev); if (rc < 0) { return rc; } /* Write config register 2 */ - const struct flash_mspi_nor_cmd cmd_status = { - .dir = MSPI_TX, - .cmd = SPI_NOR_CMD_WR_CFGREG2, - .cmd_length = 1, - .addr_length = 4, - }; - - flash_mspi_command_set(dev, &cmd_status); + set_up_xfer(dev, MSPI_TX); + dev_data->xfer.addr_length = 4; + dev_data->packet.address = 0; dev_data->packet.data_buf = &mxicy_mx25u_oe_payload; dev_data->packet.num_bytes = sizeof(mxicy_mx25u_oe_payload); - rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, &dev_data->xfer); - return rc; + return perform_xfer(dev, SPI_NOR_CMD_WR_CFGREG2, false); } static int mxicy_mx25u_pre_init(const struct device *dev) @@ -208,18 +184,12 @@ static int mxicy_mx25u_pre_init(const struct device *dev) */ /* Read configured number of dummy cycles for memory reading commands. */ - const struct flash_mspi_nor_cmd cmd_rd_cr2 = { - .dir = MSPI_RX, - .cmd = SPI_NOR_CMD_RD_CFGREG2, - .cmd_length = 1, - .addr_length = 4, - }; - - flash_mspi_command_set(dev, &cmd_rd_cr2); + set_up_xfer(dev, MSPI_RX); + dev_data->xfer.addr_length = 4; dev_data->packet.address = 0x300; dev_data->packet.data_buf = &cfg_reg; dev_data->packet.num_bytes = sizeof(cfg_reg); - rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, &dev_data->xfer); + rc = perform_xfer(dev, SPI_NOR_CMD_RD_CFGREG2, false); if (rc < 0) { LOG_ERR("Failed to read Dummy Cycle from CFGREG2"); return rc; diff --git a/drivers/flash/flash_mspi_nor_sfdp.h b/drivers/flash/flash_mspi_nor_sfdp.h index 5fa07a51782c..e8291a7af2ab 100644 --- a/drivers/flash/flash_mspi_nor_sfdp.h +++ b/drivers/flash/flash_mspi_nor_sfdp.h @@ -98,6 +98,7 @@ #define USES_4BYTE_ADDR(inst) \ (USES_OCTAL_IO(inst) || \ + DT_INST_PROP(inst, use_4byte_addressing) || \ BFP_DW1_ADDRESS_BYTES(inst) == JESD216_SFDP_BFP_DW1_ADDRBYTES_VAL_4B) #define BFP_ENTER_4BYTE_ADDR_METHODS(inst) \ @@ -345,12 +346,26 @@ BUILD_ASSERT(!USES_8D_8D_8D(inst) || \ BFP_DW18_CMD_EXT(inst) <= BFP_DW18_CMD_EXT_INV, \ "Unsupported Octal Command Extension mode in " \ + DT_NODE_FULL_NAME(DT_DRV_INST(inst))); \ + BUILD_ASSERT(!DT_INST_PROP(inst, use_4byte_addressing) || \ + (BFP_DW1_ADDRESS_BYTES(inst) \ + != JESD216_SFDP_BFP_DW1_ADDRBYTES_VAL_3B), \ + "Cannot use 4-byte addressing for " \ + DT_NODE_FULL_NAME(DT_DRV_INST(inst))); \ + BUILD_ASSERT(!DT_INST_PROP(inst, use_4byte_addressing) || \ + (BFP_ENTER_4BYTE_ADDR_METHODS(inst) \ + & (BFP_DW16_4B_ADDR_ENTER_B7 | \ + BFP_DW16_4B_ADDR_ENTER_06_B7 | \ + BFP_DW16_4B_ADDR_PER_CMD | \ + BFP_DW16_4B_ADDR_ALWAYS)), \ + "No supported method of entering 4-byte addressing mode for " \ DT_NODE_FULL_NAME(DT_DRV_INST(inst))) #else #define USES_4BYTE_ADDR(inst) \ - (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_OCTAL) + (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_OCTAL || \ + DT_INST_PROP(inst, use_4byte_addressing)) #define DEFAULT_CMD_INFO(inst) { \ .pp_cmd = USES_4BYTE_ADDR(inst) \ diff --git a/dts/bindings/mtd/jedec,mspi-nor.yaml b/dts/bindings/mtd/jedec,mspi-nor.yaml index 09660b841591..40bfe3539430 100644 --- a/dts/bindings/mtd/jedec,mspi-nor.yaml +++ b/dts/bindings/mtd/jedec,mspi-nor.yaml @@ -5,7 +5,20 @@ description: Generic NOR flash on MSPI bus compatible: "jedec,mspi-nor" -include: [mspi-device.yaml, "jedec,spi-nor-common.yaml"] +include: + - name: mspi-device.yaml + - name: jedec,spi-nor-common.yaml + property-allowlist: + - jedec-id + - size + - sfdp-bfp + - sfdp-ff05 + - sfdp-ff84 + - quad-enable-requirements + - has-dpd + - dpd-wakeup-sequence + - t-enter-dpd + - t-exit-dpd properties: reset-gpios: @@ -30,3 +43,12 @@ properties: Maximum time, in milliseconds, allowed for a single transfer on the MSPI bus in communication with the flash chip. The default value is the one that was previously hard-coded in the flash_mspi_nor driver. + + use-4byte-addressing: + type: boolean + description: | + Indicates that 4-byte addressing is to be used in communication with + the flash chip. The driver will use dedicated 4-byte address instruction + codes for commands that require addresses (like Read, Page Program, + or Erase) if those are supported by the flash chip, or if necessary, + it will switch the chip to 4-byte addressing mode. From 79bc3aa74768e2d203f73cd9ce9efbdca4b36186 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Fri, 11 Jul 2025 15:24:07 +0200 Subject: [PATCH 0766/2141] [nrf fromtree] drivers: flash_mspi_nor: Complete handling of QER, add handling of OER MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Complete implementation of quad_enable_set() by adding support for all possible Quad Enable Requirements (QER) as specified by the SFDP JEDEC standard (JESD216). Add also corresponding octal_enable_set() to handle Octal Enable Requirements. Also remove initial waiting from mxicy_mx25r_post_switch_mode() which became unneeded, as now such waiting is done in cmd_wrsr() which is called at the end of quad_enable_set(). Signed-off-by: Andrzej Głąbek (cherry picked from commit 2fcb2158ae68f190382bcd6a8a59afdfa763ac92) --- drivers/flash/flash_mspi_nor.c | 151 ++++++++++++++++++++++---- drivers/flash/flash_mspi_nor_quirks.h | 6 - 2 files changed, 132 insertions(+), 25 deletions(-) diff --git a/drivers/flash/flash_mspi_nor.c b/drivers/flash/flash_mspi_nor.c index abf9bb85fc8c..b4b5589a14f4 100644 --- a/drivers/flash/flash_mspi_nor.c +++ b/drivers/flash/flash_mspi_nor.c @@ -638,31 +638,138 @@ static int dev_pm_action_cb(const struct device *dev, static int quad_enable_set(const struct device *dev, bool enable) { struct flash_mspi_nor_data *dev_data = dev->data; + uint8_t op_code; + uint8_t qe_bit; + uint8_t status_reg; + uint8_t payload_len; + uint8_t payload[2]; int rc; - rc = cmd_wren(dev); + switch (dev_data->switch_info.quad_enable_req) { + case JESD216_DW15_QER_VAL_S1B6: + op_code = SPI_NOR_CMD_RDSR; + qe_bit = BIT(6); + break; + case JESD216_DW15_QER_VAL_S2B7: + /* Use special Read status register 2 instruction. */ + op_code = 0x3F; + qe_bit = BIT(7); + break; + case JESD216_DW15_QER_VAL_S2B1v1: + case JESD216_DW15_QER_VAL_S2B1v4: + case JESD216_DW15_QER_VAL_S2B1v5: + case JESD216_DW15_QER_VAL_S2B1v6: + op_code = SPI_NOR_CMD_RDSR2; + qe_bit = BIT(1); + break; + default: + LOG_ERR("Unknown Quad Enable Requirement: %u", + dev_data->switch_info.quad_enable_req); + return -ENOTSUP; + } + + rc = cmd_rdsr(dev, op_code, &status_reg); if (rc < 0) { - LOG_ERR("Failed to set write enable: %d", rc); return rc; } - if (dev_data->switch_info.quad_enable_req == JESD216_DW15_QER_VAL_S1B6) { - uint8_t mode_payload = enable ? BIT(6) : 0; + if (((status_reg & qe_bit) != 0) == enable) { + /* Nothing to do, the QE bit is already set properly. */ + return 0; + } + + status_reg ^= qe_bit; + + switch (dev_data->switch_info.quad_enable_req) { + default: + case JESD216_DW15_QER_VAL_S1B6: + payload_len = 1; + op_code = SPI_NOR_CMD_WRSR; + break; + case JESD216_DW15_QER_VAL_S2B7: + payload_len = 1; + /* Use special Write status register 2 instruction. */ + op_code = 0x3E; + break; + case JESD216_DW15_QER_VAL_S2B1v1: + case JESD216_DW15_QER_VAL_S2B1v4: + case JESD216_DW15_QER_VAL_S2B1v5: + payload_len = 2; + op_code = SPI_NOR_CMD_WRSR; + break; + case JESD216_DW15_QER_VAL_S2B1v6: + payload_len = 1; + op_code = SPI_NOR_CMD_WRSR2; + break; + } + + if (payload_len == 1) { + payload[0] = status_reg; + } else { + payload[1] = status_reg; - rc = cmd_wrsr(dev, SPI_NOR_CMD_WRSR, 1, &mode_payload); + /* When the Write Status command is to be sent with two data + * bytes (this is the case for S2B1v1, S2B1v4, and S2B1v5 QER + * values), the first status register needs to be read and + * sent as the first byte, so that its value is not modified. + */ + rc = cmd_rdsr(dev, SPI_NOR_CMD_RDSR, &payload[0]); if (rc < 0) { - LOG_ERR("Failed to enable/disable quad mode: %d", rc); return rc; } - } else { - /* TODO: handle all DW15 QER values */ + } + + rc = cmd_wrsr(dev, op_code, payload_len, payload); + if (rc < 0) { + return rc; + } + + return 0; +} + +static int octal_enable_set(const struct device *dev, bool enable) +{ + struct flash_mspi_nor_data *dev_data = dev->data; + uint8_t op_code; + uint8_t oe_bit; + uint8_t status_reg; + int rc; + + if (dev_data->switch_info.octal_enable_req != OCTAL_ENABLE_REQ_S2B3) { + LOG_ERR("Unknown Octal Enable Requirement: %u", + dev_data->switch_info.octal_enable_req); return -ENOTSUP; } - rc = wait_until_ready(dev, K_USEC(1)); + oe_bit = BIT(3); + /* Use special Read status register 2 instruction 0x65 with one address + * byte 0x02 and one dummy byte. + */ + op_code = 0x65; + set_up_xfer(dev, MSPI_RX); + dev_data->xfer.rx_dummy = 8; + dev_data->xfer.addr_length = 1; + dev_data->packet.address = 0x02; + dev_data->packet.num_bytes = sizeof(uint8_t); + dev_data->packet.data_buf = &status_reg; + rc = perform_xfer(dev, op_code, false); + if (rc < 0) { + LOG_ERR("cmd_rdsr 0x%02x failed: %d", op_code, rc); + return rc; + } + + if (((status_reg & oe_bit) != 0) == enable) { + /* Nothing to do, the OE bit is already set properly. */ + return 0; + } + + status_reg ^= oe_bit; + + /* Use special Write status register 2 instruction to clear the bit. */ + op_code = (status_reg & oe_bit) ? SPI_NOR_CMD_WRSR2 : 0x3E; + rc = cmd_wrsr(dev, op_code, 1, &status_reg); if (rc < 0) { - LOG_ERR("Failed waiting until device ready after enabling quad: %d", rc); return rc; } @@ -699,18 +806,24 @@ static int switch_to_target_io_mode(const struct device *dev) int rc = 0; if (dev_data->switch_info.quad_enable_req != JESD216_DW15_QER_VAL_NONE) { - /* For Quad 1-1-4 and 1-4-4, entering or leaving mode is defined - * in JEDEC216 BFP DW15 QER - */ - if (io_mode == MSPI_IO_MODE_SINGLE) { - rc = quad_enable_set(dev, false); - } else if (io_mode == MSPI_IO_MODE_QUAD_1_1_4 || - io_mode == MSPI_IO_MODE_QUAD_1_4_4) { - rc = quad_enable_set(dev, true); - } + bool quad_needed = io_mode == MSPI_IO_MODE_QUAD_1_1_4 || + io_mode == MSPI_IO_MODE_QUAD_1_4_4; + rc = quad_enable_set(dev, quad_needed); if (rc < 0) { LOG_ERR("Failed to modify Quad Enable bit: %d", rc); + return rc; + } + } + + if (dev_data->switch_info.octal_enable_req != OCTAL_ENABLE_REQ_NONE) { + bool octal_needed = io_mode == MSPI_IO_MODE_OCTAL_1_1_8 || + io_mode == MSPI_IO_MODE_OCTAL_1_8_8; + + rc = octal_enable_set(dev, octal_needed); + if (rc < 0) { + LOG_ERR("Failed to modify Octal Enable bit: %d", rc); + return rc; } } diff --git a/drivers/flash/flash_mspi_nor_quirks.h b/drivers/flash/flash_mspi_nor_quirks.h index 391a075131d3..e6989496b325 100644 --- a/drivers/flash/flash_mspi_nor_quirks.h +++ b/drivers/flash/flash_mspi_nor_quirks.h @@ -70,12 +70,6 @@ static inline int mxicy_mx25r_post_switch_mode(const struct device *dev) return 0; } - /* Wait for previous write to finish */ - rc = wait_until_ready(dev, K_USEC(1)); - if (rc < 0) { - return rc; - } - /* Write enable */ rc = cmd_wren(dev); if (rc < 0) { From bdd7c438aeaf83e8416d4108c533581ebcd5a8a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Fri, 11 Jul 2025 16:54:05 +0200 Subject: [PATCH 0767/2141] [nrf fromtree] drivers: flash_mspi_nor: Add Soft Reset MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add implementation of the most common Soft Reset routine (sequence of reset enable instruction 0x66 and reset instruction 0x99). Signed-off-by: Andrzej Głąbek (cherry picked from commit ff13d4062f48888eb591fa799804660a06ab91ec) --- drivers/flash/flash_mspi_nor.c | 87 +++++++++++++++++++++++++++- drivers/flash/flash_mspi_nor.h | 6 +- drivers/flash/flash_mspi_nor_sfdp.h | 7 +++ dts/bindings/mtd/jedec,mspi-nor.yaml | 6 ++ 4 files changed, 102 insertions(+), 4 deletions(-) diff --git a/drivers/flash/flash_mspi_nor.c b/drivers/flash/flash_mspi_nor.c index b4b5589a14f4..8dbc2db08cc2 100644 --- a/drivers/flash/flash_mspi_nor.c +++ b/drivers/flash/flash_mspi_nor.c @@ -887,6 +887,77 @@ static int gpio_reset(const struct device *dev) } #endif +#if defined(WITH_SOFT_RESET) +static int soft_reset_66_99(const struct device *dev) +{ + int rc; + + set_up_xfer(dev, MSPI_TX); + rc = perform_xfer(dev, SPI_NOR_CMD_RESET_EN, false); + if (rc < 0) { + LOG_ERR("CMD_RESET_EN failed: %d", rc); + return rc; + } + + set_up_xfer(dev, MSPI_TX); + rc = perform_xfer(dev, SPI_NOR_CMD_RESET_MEM, false); + if (rc < 0) { + LOG_ERR("CMD_RESET_MEM failed: %d", rc); + return rc; + } + + return 0; +} + +static int soft_reset(const struct device *dev) +{ + const struct flash_mspi_nor_config *dev_config = dev->config; + struct flash_mspi_nor_data *dev_data = dev->data; + int rc; + + /* If the flash may expect commands sent in multi-line mode, + * send additionally the reset sequence this way. + */ + if (dev_config->multi_io_cmd) { + rc = mspi_dev_config(dev_config->bus, &dev_config->mspi_id, + MSPI_DEVICE_CONFIG_IO_MODE, + &dev_config->mspi_nor_cfg); + if (rc < 0) { + LOG_ERR("%s: dev_config() failed: %d", __func__, rc); + return rc; + } + + dev_data->in_target_io_mode = true; + + rc = soft_reset_66_99(dev); + if (rc < 0) { + return rc; + } + + rc = mspi_dev_config(dev_config->bus, &dev_config->mspi_id, + MSPI_DEVICE_CONFIG_IO_MODE, + &dev_config->mspi_nor_init_cfg); + if (rc < 0) { + LOG_ERR("%s: dev_config() failed: %d", __func__, rc); + return rc; + } + + dev_data->in_target_io_mode = false; + } + + rc = soft_reset_66_99(dev); + if (rc < 0) { + return rc; + } + + if (dev_config->reset_recovery_us != 0) { + k_busy_wait(dev_config->reset_recovery_us); + } + + return 0; +} +#endif /* WITH_SOFT_RESET */ + static int flash_chip_init(const struct device *dev) { const struct flash_mspi_nor_config *dev_config = dev->config; @@ -938,6 +1009,15 @@ static int flash_chip_init(const struct device *dev) } #endif +#if defined(WITH_SOFT_RESET) + if (dev_config->initial_soft_reset) { + rc = soft_reset(dev); + if (rc < 0) { + return rc; + } + } +#endif + if (dev_config->quirks != NULL && dev_config->quirks->pre_init != NULL) { rc = dev_config->quirks->pre_init(dev); @@ -1212,10 +1292,10 @@ BUILD_ASSERT((FLASH_SIZE(inst) % CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE) == 0, \ (.xip_cfg = MSPI_XIP_CONFIG_DT_INST(inst),)) \ IF_ENABLED(WITH_RESET_GPIO, \ (.reset = GPIO_DT_SPEC_INST_GET_OR(inst, reset_gpios, {0}), \ - .reset_pulse_us = DT_INST_PROP_OR(inst, t_reset_pulse, 0) \ - / 1000, \ + .reset_pulse_us = DT_INST_PROP_OR(inst, t_reset_pulse, 0) \ + / 1000,)) \ .reset_recovery_us = DT_INST_PROP_OR(inst, t_reset_recovery, 0) \ - / 1000,)) \ + / 1000, \ .transfer_timeout = DT_INST_PROP(inst, transfer_timeout), \ FLASH_PAGE_LAYOUT_DEFINE(inst) \ .jedec_id = DT_INST_PROP_OR(inst, jedec_id, {0}), \ @@ -1228,6 +1308,7 @@ BUILD_ASSERT((FLASH_SIZE(inst) % CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE) == 0, \ .multiperipheral_bus = DT_PROP(DT_INST_BUS(inst), \ software_multiperipheral), \ IO_MODE_FLAGS(DT_INST_ENUM_IDX(inst, mspi_io_mode)), \ + .initial_soft_reset = DT_INST_PROP(inst, initial_soft_reset), \ }; \ FLASH_PAGE_LAYOUT_CHECK(inst) \ DEVICE_DT_INST_DEFINE(inst, \ diff --git a/drivers/flash/flash_mspi_nor.h b/drivers/flash/flash_mspi_nor.h index 13b12d58221b..a32186439825 100644 --- a/drivers/flash/flash_mspi_nor.h +++ b/drivers/flash/flash_mspi_nor.h @@ -19,6 +19,9 @@ extern "C" { #if DT_ANY_INST_HAS_PROP_STATUS_OKAY(reset_gpios) #define WITH_RESET_GPIO 1 #endif +#if DT_ANY_INST_HAS_BOOL_STATUS_OKAY(initial_soft_reset) +#define WITH_SOFT_RESET 1 +#endif #define CMD_EXTENSION_NONE 0 #define CMD_EXTENSION_SAME 1 @@ -75,8 +78,8 @@ struct flash_mspi_nor_config { #if defined(WITH_RESET_GPIO) struct gpio_dt_spec reset; uint32_t reset_pulse_us; - uint32_t reset_recovery_us; #endif + uint32_t reset_recovery_us; uint32_t transfer_timeout; #if defined(CONFIG_FLASH_PAGE_LAYOUT) struct flash_pages_layout layout; @@ -91,6 +94,7 @@ struct flash_mspi_nor_config { bool multiperipheral_bus : 1; bool multi_io_cmd : 1; bool single_io_addr : 1; + bool initial_soft_reset : 1; }; struct flash_mspi_nor_data { diff --git a/drivers/flash/flash_mspi_nor_sfdp.h b/drivers/flash/flash_mspi_nor_sfdp.h index e8291a7af2ab..8dbecff01e80 100644 --- a/drivers/flash/flash_mspi_nor_sfdp.h +++ b/drivers/flash/flash_mspi_nor_sfdp.h @@ -6,6 +6,8 @@ #ifdef CONFIG_FLASH_MSPI_NOR_USE_SFDP +#define BFP_DW16_SOFT_RESET_66_99 BIT(4) + #define BFP_DW16_4B_ADDR_ENTER_B7 BIT(0) #define BFP_DW16_4B_ADDR_ENTER_06_B7 BIT(1) #define BFP_DW16_4B_ADDR_PER_CMD BIT(5) @@ -359,6 +361,11 @@ BFP_DW16_4B_ADDR_PER_CMD | \ BFP_DW16_4B_ADDR_ALWAYS)), \ "No supported method of entering 4-byte addressing mode for " \ + DT_NODE_FULL_NAME(DT_DRV_INST(inst))); \ + BUILD_ASSERT(!DT_INST_PROP(inst, initial_soft_reset) || \ + (SFDP_FIELD(inst, sfdp_bfp, 16, GENMASK(13, 8)) \ + & BFP_DW16_SOFT_RESET_66_99), \ + "Cannot use 66h/99h soft reset sequence for " \ DT_NODE_FULL_NAME(DT_DRV_INST(inst))) #else diff --git a/dts/bindings/mtd/jedec,mspi-nor.yaml b/dts/bindings/mtd/jedec,mspi-nor.yaml index 40bfe3539430..01eba90ecb2c 100644 --- a/dts/bindings/mtd/jedec,mspi-nor.yaml +++ b/dts/bindings/mtd/jedec,mspi-nor.yaml @@ -52,3 +52,9 @@ properties: codes for commands that require addresses (like Read, Page Program, or Erase) if those are supported by the flash chip, or if necessary, it will switch the chip to 4-byte addressing mode. + + initial-soft-reset: + type: boolean + description: | + When set, the flash driver performs software reset of the flash chip + at initialization. From 8b1bd678d432d313f4beccc9e969367119fd7ac4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Mon, 14 Jul 2025 11:51:50 +0200 Subject: [PATCH 0768/2141] [nrf fromtree] drivers: flash_mspi_nor: Remove undesirable initial Quad disabling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Using a GPIO reset for a flash chip that has a dual function pin (RESET# or SIO3) and is to be used in Quad mode is rather a bad idea and so is clearing of the Quad Enable bit at every initialization of the flash driver, since this bit is usually non-volatile, so such operation means unnecessary wearing of the flash chip. Soft Reset should be use instead in such case. Signed-off-by: Andrzej Głąbek (cherry picked from commit c2b537fb6c36d7c93593f0586156500a0d5a6796) --- drivers/flash/flash_mspi_nor.c | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/drivers/flash/flash_mspi_nor.c b/drivers/flash/flash_mspi_nor.c index 8dbc2db08cc2..cf283b9302af 100644 --- a/drivers/flash/flash_mspi_nor.c +++ b/drivers/flash/flash_mspi_nor.c @@ -962,7 +962,6 @@ static int flash_chip_init(const struct device *dev) { const struct flash_mspi_nor_config *dev_config = dev->config; struct flash_mspi_nor_data *dev_data = dev->data; - enum mspi_io_mode io_mode = dev_config->mspi_nor_cfg.io_mode; uint8_t id[JESD216_READ_ID_LEN] = {0}; uint16_t dts_cmd = 0; uint32_t sfdp_signature; @@ -978,28 +977,6 @@ static int flash_chip_init(const struct device *dev) dev_data->in_target_io_mode = false; - /* Some chips reuse RESET pin for data in Quad modes: - * force single line mode before resetting. - */ - if (dev_data->switch_info.quad_enable_req != JESD216_DW15_QER_VAL_NONE && - (io_mode == MSPI_IO_MODE_SINGLE || - io_mode == MSPI_IO_MODE_QUAD_1_1_4 || - io_mode == MSPI_IO_MODE_QUAD_1_4_4)) { - rc = quad_enable_set(dev, false); - - if (rc < 0) { - LOG_ERR("Failed to switch to single line mode: %d", rc); - return rc; - } - - rc = wait_until_ready(dev, K_USEC(1)); - - if (rc < 0) { - LOG_ERR("Failed waiting for device after switch to single line: %d", rc); - return rc; - } - } - #if defined(WITH_RESET_GPIO) rc = gpio_reset(dev); From 0d565bb9fc3d0e46b080624c04709d25e9457638 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Fri, 25 Jul 2025 17:56:18 +0200 Subject: [PATCH 0769/2141] [nrf fromtree] drivers: flash_mspi_nor: Add support for "supply-gpios" property MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add support for supplying power to the flash chip by activation of a GPIO specified through the "supply-gpios" property. Implementation of gpio_reset() is also slightly modified so that it is consistent with soft_reset() and the new power_supply() and so that all these functions can use a common routine that performs a reset recovery delay. Signed-off-by: Andrzej Głąbek (cherry picked from commit 835d77389cae80308f1aa2b9bcba4670b10af7f6) --- drivers/flash/Kconfig.mspi | 3 +- drivers/flash/flash_mspi_nor.c | 97 +++++++++++++++++++--------- drivers/flash/flash_mspi_nor.h | 6 ++ dts/bindings/mtd/jedec,mspi-nor.yaml | 2 + 4 files changed, 75 insertions(+), 33 deletions(-) diff --git a/drivers/flash/Kconfig.mspi b/drivers/flash/Kconfig.mspi index cab2f3a2bcde..5740f3618d76 100644 --- a/drivers/flash/Kconfig.mspi +++ b/drivers/flash/Kconfig.mspi @@ -35,7 +35,8 @@ menuconfig FLASH_MSPI_NOR select FLASH_MSPI select FLASH_HAS_EXPLICIT_ERASE select FLASH_JESD216 - select GPIO if $(dt_compat_any_has_prop,$(DT_COMPAT_JEDEC_MSPI_NOR),reset-gpios) + select GPIO if $(dt_compat_any_has_prop,$(DT_COMPAT_JEDEC_MSPI_NOR),reset-gpios) \ + || $(dt_compat_any_has_prop,$(DT_COMPAT_JEDEC_MSPI_NOR),supply-gpios) if FLASH_MSPI_NOR diff --git a/drivers/flash/flash_mspi_nor.c b/drivers/flash/flash_mspi_nor.c index cf283b9302af..f08f8b68a1d0 100644 --- a/drivers/flash/flash_mspi_nor.c +++ b/drivers/flash/flash_mspi_nor.c @@ -848,39 +848,54 @@ static int switch_to_target_io_mode(const struct device *dev) &dev_config->mspi_nor_cfg); } +#if defined(WITH_SUPPLY_GPIO) +static int power_supply(const struct device *dev) +{ + const struct flash_mspi_nor_config *dev_config = dev->config; + int rc; + + if (!gpio_is_ready_dt(&dev_config->supply)) { + LOG_ERR("Device %s is not ready", + dev_config->supply.port->name); + return -ENODEV; + } + + rc = gpio_pin_configure_dt(&dev_config->supply, GPIO_OUTPUT_ACTIVE); + if (rc < 0) { + LOG_ERR("Failed to activate power supply GPIO: %d", rc); + return -EIO; + } + + return 0; +} +#endif + #if defined(WITH_RESET_GPIO) static int gpio_reset(const struct device *dev) { const struct flash_mspi_nor_config *dev_config = dev->config; int rc; - if (dev_config->reset.port) { - if (!gpio_is_ready_dt(&dev_config->reset)) { - LOG_ERR("Device %s is not ready", - dev_config->reset.port->name); - return -ENODEV; - } - - rc = gpio_pin_configure_dt(&dev_config->reset, - GPIO_OUTPUT_ACTIVE); - if (rc < 0) { - LOG_ERR("Failed to activate RESET: %d", rc); - return -EIO; - } + if (!gpio_is_ready_dt(&dev_config->reset)) { + LOG_ERR("Device %s is not ready", + dev_config->reset.port->name); + return -ENODEV; + } - if (dev_config->reset_pulse_us != 0) { - k_busy_wait(dev_config->reset_pulse_us); - } + rc = gpio_pin_configure_dt(&dev_config->reset, GPIO_OUTPUT_ACTIVE); + if (rc < 0) { + LOG_ERR("Failed to activate RESET: %d", rc); + return -EIO; + } - rc = gpio_pin_set_dt(&dev_config->reset, 0); - if (rc < 0) { - LOG_ERR("Failed to deactivate RESET: %d", rc); - return -EIO; - } + if (dev_config->reset_pulse_us != 0) { + k_busy_wait(dev_config->reset_pulse_us); + } - if (dev_config->reset_recovery_us != 0) { - k_busy_wait(dev_config->reset_recovery_us); - } + rc = gpio_pin_set_dt(&dev_config->reset, 0); + if (rc < 0) { + LOG_ERR("Failed to deactivate RESET: %d", rc); + return -EIO; } return 0; @@ -950,10 +965,6 @@ static int soft_reset(const struct device *dev) return rc; } - if (dev_config->reset_recovery_us != 0) { - k_busy_wait(dev_config->reset_recovery_us); - } - return 0; } #endif /* WITH_SOFT_RESET */ @@ -965,6 +976,7 @@ static int flash_chip_init(const struct device *dev) uint8_t id[JESD216_READ_ID_LEN] = {0}; uint16_t dts_cmd = 0; uint32_t sfdp_signature; + bool flash_reset = false; int rc; rc = mspi_dev_config(dev_config->bus, &dev_config->mspi_id, @@ -977,12 +989,25 @@ static int flash_chip_init(const struct device *dev) dev_data->in_target_io_mode = false; +#if defined(WITH_SUPPLY_GPIO) + if (dev_config->supply.port) { + rc = power_supply(dev); + if (rc < 0) { + return rc; + } + + flash_reset = true; + } +#endif + #if defined(WITH_RESET_GPIO) - rc = gpio_reset(dev); + if (dev_config->reset.port) { + rc = gpio_reset(dev); + if (rc < 0) { + return rc; + } - if (rc < 0) { - LOG_ERR("Failed to reset with GPIO: %d", rc); - return rc; + flash_reset = true; } #endif @@ -992,9 +1017,15 @@ static int flash_chip_init(const struct device *dev) if (rc < 0) { return rc; } + + flash_reset = true; } #endif + if (flash_reset && dev_config->reset_recovery_us != 0) { + k_busy_wait(dev_config->reset_recovery_us); + } + if (dev_config->quirks != NULL && dev_config->quirks->pre_init != NULL) { rc = dev_config->quirks->pre_init(dev); @@ -1267,6 +1298,8 @@ BUILD_ASSERT((FLASH_SIZE(inst) % CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE) == 0, \ .mspi_nor_init_cfg = FLASH_INITIAL_CONFIG(inst), \ IF_ENABLED(CONFIG_MSPI_XIP, \ (.xip_cfg = MSPI_XIP_CONFIG_DT_INST(inst),)) \ + IF_ENABLED(WITH_SUPPLY_GPIO, \ + (.supply = GPIO_DT_SPEC_INST_GET_OR(inst, supply_gpios, {0}),)) \ IF_ENABLED(WITH_RESET_GPIO, \ (.reset = GPIO_DT_SPEC_INST_GET_OR(inst, reset_gpios, {0}), \ .reset_pulse_us = DT_INST_PROP_OR(inst, t_reset_pulse, 0) \ diff --git a/drivers/flash/flash_mspi_nor.h b/drivers/flash/flash_mspi_nor.h index a32186439825..480bccce4729 100644 --- a/drivers/flash/flash_mspi_nor.h +++ b/drivers/flash/flash_mspi_nor.h @@ -16,6 +16,9 @@ extern "C" { #include "jesd216.h" #include "spi_nor.h" +#if DT_ANY_INST_HAS_PROP_STATUS_OKAY(supply_gpios) +#define WITH_SUPPLY_GPIO 1 +#endif #if DT_ANY_INST_HAS_PROP_STATUS_OKAY(reset_gpios) #define WITH_RESET_GPIO 1 #endif @@ -75,6 +78,9 @@ struct flash_mspi_nor_config { #if defined(CONFIG_MSPI_XIP) struct mspi_xip_cfg xip_cfg; #endif +#if defined(WITH_SUPPLY_GPIO) + struct gpio_dt_spec supply; +#endif #if defined(WITH_RESET_GPIO) struct gpio_dt_spec reset; uint32_t reset_pulse_us; diff --git a/dts/bindings/mtd/jedec,mspi-nor.yaml b/dts/bindings/mtd/jedec,mspi-nor.yaml index 01eba90ecb2c..348e11cd9833 100644 --- a/dts/bindings/mtd/jedec,mspi-nor.yaml +++ b/dts/bindings/mtd/jedec,mspi-nor.yaml @@ -35,6 +35,8 @@ properties: type: int description: | Minimum time, in nanoseconds, the flash chip needs to recover after reset. + Such delay is performed when a GPIO or software reset is done, or after + power is supplied to the chip if the "supply-gpios" property is specified. transfer-timeout: type: int From 8a2d4d752ce6cb8e801197aa0dca0184a2ce28cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Fri, 22 Aug 2025 17:20:52 +0200 Subject: [PATCH 0770/2141] [nrf fromtree] drivers: flash_mspi_nor: Add support for DDR in mx25u family MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When Octal IO mode is to be used with DDR in mx25u family chips, bit 1 instead of 0 must be set in the Configuration Register 2 at address 0. Signed-off-by: Andrzej Głąbek (cherry picked from commit 77f00f06bb11a4d7643b6e631d35a41220b579d8) --- drivers/flash/flash_mspi_nor_quirks.h | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/drivers/flash/flash_mspi_nor_quirks.h b/drivers/flash/flash_mspi_nor_quirks.h index e6989496b325..d58fbea4ff9b 100644 --- a/drivers/flash/flash_mspi_nor_quirks.h +++ b/drivers/flash/flash_mspi_nor_quirks.h @@ -123,21 +123,30 @@ struct flash_mspi_nor_quirks flash_quirks_mxicy_mx25r = { #if DT_HAS_COMPAT_STATUS_OKAY(mxicy_mx25u) -#define MXICY_MX25R_OE_MASK BIT(0) - -static uint8_t mxicy_mx25u_oe_payload = MXICY_MX25R_OE_MASK; - static inline int mxicy_mx25u_post_switch_mode(const struct device *dev) { const struct flash_mspi_nor_config *dev_config = dev->config; struct flash_mspi_nor_data *dev_data = dev->data; enum mspi_io_mode io_mode = dev_config->mspi_nor_cfg.io_mode; + uint8_t opi_enable; int rc; if (io_mode != MSPI_IO_MODE_OCTAL) { return 0; } + /* + * TODO - replace this with a generic routine that uses information + * from SFDP header FF87 (Status, Control and Configuration + * Register Map) + */ + + if (dev_config->mspi_nor_cfg.data_rate == MSPI_DATA_RATE_DUAL) { + opi_enable = BIT(1); + } else { + opi_enable = BIT(0); + } + /* Write enable */ rc = cmd_wren(dev); if (rc < 0) { @@ -148,8 +157,8 @@ static inline int mxicy_mx25u_post_switch_mode(const struct device *dev) set_up_xfer(dev, MSPI_TX); dev_data->xfer.addr_length = 4; dev_data->packet.address = 0; - dev_data->packet.data_buf = &mxicy_mx25u_oe_payload; - dev_data->packet.num_bytes = sizeof(mxicy_mx25u_oe_payload); + dev_data->packet.data_buf = &opi_enable; + dev_data->packet.num_bytes = sizeof(opi_enable); return perform_xfer(dev, SPI_NOR_CMD_WR_CFGREG2, false); } From b21162108c368ed4c50eb7373223e3e7f0a093c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Tue, 9 Sep 2025 09:12:36 +0200 Subject: [PATCH 0771/2141] [nrf fromtree] samples: code_relocation_nocopy: Update configuration for nRF54H20 DK MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It is no longer needed to specify the read command parameters in dts, as the flash driver is capable of obtaining those from SFDP structures, so the redundant properties are removed. After commit 612fd940fa307ea8a83b97571505d6201ab28d85 got merged, both the EXMIF and flash nodes in dts are not enabled by default so this needs to be done in the overlay. Although nrfutil is still not capable of programming the external flash on nRF54H20 DK, thus `west flash` will not work in this case, `nrf54h20dk/nrf54h20/cpuapp` is added as an allowed platform so that the sample is at least built in CI for it. Signed-off-by: Andrzej Głąbek (cherry picked from commit 10740d63a54d81fa35a65d90b0e773521174ea69) --- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 13 +++++++++---- .../code_relocation_nocopy/sample.yaml | 1 + 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/samples/application_development/code_relocation_nocopy/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/samples/application_development/code_relocation_nocopy/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index 98d67e2ad082..789c47d3a473 100644 --- a/samples/application_development/code_relocation_nocopy/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/samples/application_development/code_relocation_nocopy/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -2,11 +2,16 @@ status = "okay"; }; +&gpio6 { + status = "okay"; +}; + +&exmif { + status = "okay"; +}; + &mx25uw63 { - read-command = <0xEC13>; - command-length = "INSTR_2_BYTE"; - address-length = "ADDR_4_BYTE"; - rx-dummy = <20>; + status = "okay"; xip-config = <1 0 0x20000000 0>; }; diff --git a/samples/application_development/code_relocation_nocopy/sample.yaml b/samples/application_development/code_relocation_nocopy/sample.yaml index 37e009bc9871..62929419c534 100644 --- a/samples/application_development/code_relocation_nocopy/sample.yaml +++ b/samples/application_development/code_relocation_nocopy/sample.yaml @@ -6,6 +6,7 @@ tests: platform_allow: - qemu_cortex_m3 - nrf5340dk/nrf5340/cpuapp + - nrf54h20dk/nrf54h20/cpuapp - stm32f769i_disco - stm32h7b3i_dk - stm32h573i_dk From 9f038bf1860117b8e039a2347a1abaebb38807c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Wed, 10 Sep 2025 16:00:54 +0200 Subject: [PATCH 0772/2141] [nrf fromtree] drivers: flash_mspi_nor: Fix XIP_DEV_CFG_MASK definition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a follow-up to commit cafa288197e5e65d01e38386690b673a39a87205. Bit masks should use the bitwise OR operator, not the logical one... Signed-off-by: Andrzej Głąbek (cherry picked from commit 9223235a492580b162e753437cb8a9b138e34f60) --- drivers/flash/flash_mspi_nor.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/flash/flash_mspi_nor.c b/drivers/flash/flash_mspi_nor.c index f08f8b68a1d0..a634b3d9118b 100644 --- a/drivers/flash/flash_mspi_nor.c +++ b/drivers/flash/flash_mspi_nor.c @@ -16,11 +16,11 @@ LOG_MODULE_REGISTER(flash_mspi_nor, CONFIG_FLASH_LOG_LEVEL); -#define XIP_DEV_CFG_MASK (MSPI_DEVICE_CONFIG_CMD_LEN || \ - MSPI_DEVICE_CONFIG_ADDR_LEN || \ - MSPI_DEVICE_CONFIG_READ_CMD || \ - MSPI_DEVICE_CONFIG_WRITE_CMD || \ - MSPI_DEVICE_CONFIG_RX_DUMMY || \ +#define XIP_DEV_CFG_MASK (MSPI_DEVICE_CONFIG_CMD_LEN | \ + MSPI_DEVICE_CONFIG_ADDR_LEN | \ + MSPI_DEVICE_CONFIG_READ_CMD | \ + MSPI_DEVICE_CONFIG_WRITE_CMD | \ + MSPI_DEVICE_CONFIG_RX_DUMMY | \ MSPI_DEVICE_CONFIG_TX_DUMMY) #define NON_XIP_DEV_CFG_MASK (MSPI_DEVICE_CONFIG_ALL & ~XIP_DEV_CFG_MASK) From ccc8d2b94034e89c93f3c14d9acfacfeb5829e85 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Tue, 12 Aug 2025 10:47:24 +0100 Subject: [PATCH 0773/2141] [nrf fromtree] scripts: zephyr_module: Add variable with module path Adds a variable that has the path of the module directory, this is supplied as an argument when running cmake normally but is not supplied when running the check compliance script, this addition allows checks to be ran that use such syntax in Kconfig files. This is then removed from cmake as the python file handles it instead Signed-off-by: Jamie McCrae (cherry picked from commit ea9815ff34af16bc2e52f1a4356ca67dabe1f4b7) --- cmake/modules/kconfig.cmake | 8 +------- scripts/zephyr_module.py | 24 ++++++++++++++---------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/cmake/modules/kconfig.cmake b/cmake/modules/kconfig.cmake index def17f16ae63..ac5f1b83e4c3 100644 --- a/cmake/modules/kconfig.cmake +++ b/cmake/modules/kconfig.cmake @@ -99,15 +99,9 @@ zephyr_file(CONF_FILES ${BOARD_EXTENSION_DIRS} KCONF board_extension_conf_files # separated list instead. string(REPLACE ";" "?" DTS_ROOT_BINDINGS "${DTS_ROOT_BINDINGS}") -# Export each `ZEPHYR__MODULE_DIR` to Kconfig. -# This allows Kconfig files to refer relative from a modules root as: -# source "$(ZEPHYR_FOO_MODULE_DIR)/Kconfig" +# Export each `ZEPHYR__KCONFIG` to Kconfig. foreach(module_name ${ZEPHYR_MODULE_NAMES}) zephyr_string(SANITIZE TOUPPER MODULE_NAME_UPPER ${module_name}) - list(APPEND - ZEPHYR_KCONFIG_MODULES_DIR - "ZEPHYR_${MODULE_NAME_UPPER}_MODULE_DIR=${ZEPHYR_${MODULE_NAME_UPPER}_MODULE_DIR}" - ) if(ZEPHYR_${MODULE_NAME_UPPER}_KCONFIG) list(APPEND diff --git a/scripts/zephyr_module.py b/scripts/zephyr_module.py index 8aabe6767845..aeda845639e0 100755 --- a/scripts/zephyr_module.py +++ b/scripts/zephyr_module.py @@ -393,8 +393,11 @@ def process_kconfig(module, meta): module_path = PurePath(module) module_yml = module_path.joinpath('zephyr/module.yml') kconfig_extern = section.get('kconfig-ext', False) + name_sanitized = meta['name-sanitized'] + snippet = f'ZEPHYR_{name_sanitized.upper()}_MODULE_DIR := {module_path.as_posix()}\n' + if kconfig_extern: - return kconfig_snippet(meta, module_path, blobs=blobs, taint_blobs=taint_blobs) + return snippet + kconfig_snippet(meta, module_path, blobs=blobs, taint_blobs=taint_blobs) kconfig_setting = section.get('kconfig', None) if not validate_setting(kconfig_setting, module): @@ -404,12 +407,10 @@ def process_kconfig(module, meta): kconfig_file = os.path.join(module, kconfig_setting or 'zephyr/Kconfig') if os.path.isfile(kconfig_file): - return kconfig_snippet(meta, module_path, Path(kconfig_file), - blobs=blobs, taint_blobs=taint_blobs) + return snippet + kconfig_snippet(meta, module_path, Path(kconfig_file), + blobs=blobs, taint_blobs=taint_blobs) else: - name_sanitized = meta['name-sanitized'] - snippet = kconfig_module_opts(name_sanitized, blobs, taint_blobs) - return '\n'.join(snippet) + '\n' + return snippet + '\n'.join(kconfig_module_opts(name_sanitized, blobs, taint_blobs)) + '\n' def process_sysbuildkconfig(module, meta): @@ -417,8 +418,11 @@ def process_sysbuildkconfig(module, meta): module_path = PurePath(module) module_yml = module_path.joinpath('zephyr/module.yml') kconfig_extern = section.get('sysbuild-kconfig-ext', False) + name_sanitized = meta['name-sanitized'] + snippet = f'ZEPHYR_{name_sanitized.upper()}_MODULE_DIR := {module_path.as_posix()}\n' + if kconfig_extern: - return kconfig_snippet(meta, module_path, sysbuild=True) + return snippet + kconfig_snippet(meta, module_path, sysbuild=True) kconfig_setting = section.get('sysbuild-kconfig', None) if not validate_setting(kconfig_setting, module): @@ -429,10 +433,10 @@ def process_sysbuildkconfig(module, meta): if kconfig_setting is not None: kconfig_file = os.path.join(module, kconfig_setting) if os.path.isfile(kconfig_file): - return kconfig_snippet(meta, module_path, Path(kconfig_file)) + return snippet + kconfig_snippet(meta, module_path, Path(kconfig_file)) - name_sanitized = meta['name-sanitized'] - return (f'config ZEPHYR_{name_sanitized.upper()}_MODULE\n' + return snippet + \ + (f'config ZEPHYR_{name_sanitized.upper()}_MODULE\n' f' bool\n' f' default y\n') From e3f5d4388cbe0cfb72220414db48ac7cac472456 Mon Sep 17 00:00:00 2001 From: Sudan Landge Date: Tue, 27 May 2025 11:32:41 +0100 Subject: [PATCH 0774/2141] [nrf fromtree] boards: arm: add support for MPS4 Corstone-320 Add initial support for the MPS4 Corstone-320 platform, including board and SoC definitions. This platform features a Cortex-M85 CPU with an Ethos-U85 NPU and runs in simulation using the FVP_Corstone_SSE-320 Fixed Virtual Platform. Signed-off-by: Sudan Landge (cherry picked from commit d1e830fe0d657ade703462e4a9f07333a074ecb7) --- boards/arm/mps4/Kconfig.defconfig | 23 ++ boards/arm/mps4/Kconfig.mps4 | 6 + boards/arm/mps4/board.cmake | 45 ++++ boards/arm/mps4/board.yml | 10 + boards/arm/mps4/mps4_common.dtsi | 119 ++++++++++ .../arm/mps4/mps4_common_soc_peripheral.dtsi | 209 ++++++++++++++++++ boards/arm/mps4/mps4_corstone320_fvp.dts | 97 ++++++++ boards/arm/mps4/mps4_corstone320_fvp.yaml | 25 +++ .../arm/mps4/mps4_corstone320_fvp_defconfig | 19 ++ boards/arm/mps4/mps4_corstone320_fvp_ns.dts | 102 +++++++++ boards/arm/mps4/mps4_corstone320_fvp_ns.yaml | 15 ++ .../mps4/mps4_corstone320_fvp_ns_defconfig | 19 ++ soc/arm/mps4/CMakeLists.txt | 6 + soc/arm/mps4/Kconfig | 21 ++ soc/arm/mps4/Kconfig.defconfig | 11 + .../mps4/Kconfig.defconfig.mps4_corstone320 | 9 + soc/arm/mps4/Kconfig.soc | 18 ++ soc/arm/mps4/soc.h | 12 + soc/arm/soc.yml | 3 + 19 files changed, 769 insertions(+) create mode 100644 boards/arm/mps4/Kconfig.defconfig create mode 100644 boards/arm/mps4/Kconfig.mps4 create mode 100644 boards/arm/mps4/board.cmake create mode 100644 boards/arm/mps4/board.yml create mode 100644 boards/arm/mps4/mps4_common.dtsi create mode 100644 boards/arm/mps4/mps4_common_soc_peripheral.dtsi create mode 100644 boards/arm/mps4/mps4_corstone320_fvp.dts create mode 100644 boards/arm/mps4/mps4_corstone320_fvp.yaml create mode 100644 boards/arm/mps4/mps4_corstone320_fvp_defconfig create mode 100644 boards/arm/mps4/mps4_corstone320_fvp_ns.dts create mode 100644 boards/arm/mps4/mps4_corstone320_fvp_ns.yaml create mode 100644 boards/arm/mps4/mps4_corstone320_fvp_ns_defconfig create mode 100644 soc/arm/mps4/CMakeLists.txt create mode 100644 soc/arm/mps4/Kconfig create mode 100644 soc/arm/mps4/Kconfig.defconfig create mode 100644 soc/arm/mps4/Kconfig.defconfig.mps4_corstone320 create mode 100644 soc/arm/mps4/Kconfig.soc create mode 100644 soc/arm/mps4/soc.h diff --git a/boards/arm/mps4/Kconfig.defconfig b/boards/arm/mps4/Kconfig.defconfig new file mode 100644 index 000000000000..b4e987753860 --- /dev/null +++ b/boards/arm/mps4/Kconfig.defconfig @@ -0,0 +1,23 @@ +# Copyright 2025 Arm Limited and/or its affiliates +# SPDX-License-Identifier: Apache-2.0 + +if BOARD_MPS4_CORSTONE320_FVP + +if SERIAL + +config UART_INTERRUPT_DRIVEN + default y + +endif # SERIAL + +if ROMSTART_RELOCATION_ROM && BOARD_MPS4_CORSTONE320_FVP + +config ROMSTART_REGION_ADDRESS + default $(dt_nodelabel_reg_addr_hex,itcm) + +config ROMSTART_REGION_SIZE + default $(dt_nodelabel_reg_size_hex,itcm,0,k) + +endif + +endif diff --git a/boards/arm/mps4/Kconfig.mps4 b/boards/arm/mps4/Kconfig.mps4 new file mode 100644 index 000000000000..ffb494cf3377 --- /dev/null +++ b/boards/arm/mps4/Kconfig.mps4 @@ -0,0 +1,6 @@ +# Copyright 2025 Arm Limited and/or its affiliates +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_MPS4 + select SOC_SERIES_MPS4 + select SOC_MPS4_CORSTONE320 if BOARD_MPS4_CORSTONE320_FVP || BOARD_MPS4_CORSTONE320_FVP_NS diff --git a/boards/arm/mps4/board.cmake b/boards/arm/mps4/board.cmake new file mode 100644 index 000000000000..6497c65c4260 --- /dev/null +++ b/boards/arm/mps4/board.cmake @@ -0,0 +1,45 @@ +# Copyright 2025 Arm Limited and/or its affiliates +# SPDX-License-Identifier: Apache-2.0 + +# +# Default emulation: +# FVP is used by default for corstone320/fvp. +# + + +if(CONFIG_BOARD_MPS4_CORSTONE320_FVP OR CONFIG_BOARD_MPS4_CORSTONE320_FVP_NS) + set(SUPPORTED_EMU_PLATFORMS armfvp) + set(ARMFVP_BIN_NAME FVP_Corstone_SSE-320) + if(CONFIG_BOARD_MPS4_CORSTONE320_FVP) + set(ARMFVP_FLAGS + # default is '0x11000000' but should match cpu.INITSVTOR which is 0. + -C mps4_board.subsystem.iotss3_systemcontrol.INITSVTOR_RST=0 + # default is 0x8, this change is needed since we split flash into itcm + # and sram and it reduces the number of available mpu regions causing a + # few MPU tests to fail. + -C mps4_board.subsystem.cpu0.MPU_S=16 + ) + endif() +endif() + +if(CONFIG_BUILD_WITH_TFM) + set(ARMFVP_FLAGS ${ARMFVP_FLAGS} -a ${APPLICATION_BINARY_DIR}/zephyr/tfm_merged.hex) +endif() + +# FVP Parameters +# -C indicate a config option in the form of: +# instance.parameter=value +# Run the FVP with --list-params to list all options +set(ARMFVP_FLAGS ${ARMFVP_FLAGS} + -C mps4_board.uart0.out_file=- + -C mps4_board.uart0.unbuffered_output=1 + -C mps4_board.uart1.out_file=- + -C mps4_board.uart1.unbuffered_output=1 + -C mps4_board.uart2.out_file=- + -C mps4_board.uart2.unbuffered_output=1 + -C mps4_board.visualisation.disable-visualisation=1 + -C mps4_board.telnetterminal0.start_telnet=0 + -C mps4_board.telnetterminal1.start_telnet=0 + -C mps4_board.telnetterminal2.start_telnet=0 + -C vis_hdlcd.disable_visualisation=1 + ) diff --git a/boards/arm/mps4/board.yml b/boards/arm/mps4/board.yml new file mode 100644 index 000000000000..8c2b411846fb --- /dev/null +++ b/boards/arm/mps4/board.yml @@ -0,0 +1,10 @@ +board: + name: mps4 + full_name: MPS4 + vendor: arm + socs: + - name: 'corstone320' + variants: + - name: 'fvp' + variants: + - name: 'ns' diff --git a/boards/arm/mps4/mps4_common.dtsi b/boards/arm/mps4/mps4_common.dtsi new file mode 100644 index 000000000000..c2958fc5c075 --- /dev/null +++ b/boards/arm/mps4/mps4_common.dtsi @@ -0,0 +1,119 @@ +/* + * Copyright 2025 Arm Limited and/or its affiliates + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* /dts-v1/; */ + +#include +#include +#include +#include +#include + +/ { + aliases { + led0 = &led_0; + led1 = &led_1; + sw0 = &user_button_0; + sw1 = &user_button_1; + }; + + leds { + compatible = "gpio-leds"; + + led_0: led_0 { + gpios = <&gpio_led0 0>; + label = "USERLED0"; + }; + + led_1: led_1 { + gpios = <&gpio_led0 1>; + label = "USERLED1"; + }; + + led_2: led_2 { + gpios = <&gpio_led0 2>; + label = "USERLED2"; + }; + + led_3: led_3 { + gpios = <&gpio_led0 3>; + label = "USERLED3"; + }; + + led_4: led_4 { + gpios = <&gpio_led0 4>; + label = "USERLED4"; + }; + + led_5: led_5 { + gpios = <&gpio_led0 5>; + label = "USERLED5"; + }; + + led_6: led_6 { + gpios = <&gpio_led0 6>; + label = "USERLED6"; + }; + + led_7: led_7 { + gpios = <&gpio_led0 7>; + label = "USERLED7"; + }; + + led_8: led_8 { + gpios = <&gpio_led0 8>; + label = "PB1LED"; + }; + + led_9: led_9 { + gpios = <&gpio_led0 9>; + label = "PB2LED"; + }; + }; + + gpio_keys { + compatible = "gpio-keys"; + + user_button_0: button_0 { + label = "USERPB0"; + gpios = <&gpio_button 0>; + zephyr,code = ; + }; + + user_button_1: button_1 { + label = "USERPB1"; + gpios = <&gpio_button 1>; + zephyr,code = ; + }; + }; + + null_ptr_detect: null_ptr_detect@0 { + compatible = "zephyr,memory-region"; + /* 0 - CONFIG_CORTEX_M_NULL_POINTER_EXCEPTION_PAGE_SIZE> */ + reg = <0x0 0x400>; + zephyr,memory-region = "NULL_PTR_DETECT"; + zephyr,memory-attr = <( DT_MEM_ARM(ATTR_MPU_FLASH) )>; + }; + + /* DDR4 - 2G, alternates non-secure/secure every 256M */ + ddr4: memory@60000000 { + device_type = "memory"; + compatible = "zephyr,memory-region"; + reg = <0x60000000 DT_SIZE_M(256) + 0x70000000 DT_SIZE_M(256) + 0x80000000 DT_SIZE_M(256) + 0x90000000 DT_SIZE_M(256) + 0xa0000000 DT_SIZE_M(256) + 0xb0000000 DT_SIZE_M(256) + 0xc0000000 DT_SIZE_M(256) + 0xd0000000 DT_SIZE_M(256)>; + zephyr,memory-region = "DDR4"; + }; +}; + +&nvic { + arm,num-irq-priority-bits = <3>; +}; diff --git a/boards/arm/mps4/mps4_common_soc_peripheral.dtsi b/boards/arm/mps4/mps4_common_soc_peripheral.dtsi new file mode 100644 index 000000000000..d94339e4c05c --- /dev/null +++ b/boards/arm/mps4/mps4_common_soc_peripheral.dtsi @@ -0,0 +1,209 @@ +/* + * Copyright 2025 Arm Limited and/or its affiliates + * + * SPDX-License-Identifier: Apache-2.0 + */ + +sysclk: system-clock { + compatible = "fixed-clock"; + clock-frequency = <25000000>; + #clock-cells = <0>; +}; + +gpio0: gpio@100000 { + compatible = "arm,cmsdk-gpio"; + reg = <0x100000 0x1000>; + interrupts = <69 3>; + gpio-controller; + #gpio-cells = <2>; +}; + +gpio1: gpio@101000 { + compatible = "arm,cmsdk-gpio"; + reg = <0x101000 0x1000>; + interrupts = <70 3>; + gpio-controller; + #gpio-cells = <2>; +}; + +gpio2: gpio@102000 { + compatible = "arm,cmsdk-gpio"; + reg = <0x102000 0x1000>; + interrupts = <71 3>; + gpio-controller; + #gpio-cells = <2>; +}; + +gpio3: gpio@103000 { + compatible = "arm,cmsdk-gpio"; + reg = <0x103000 0x1000>; + interrupts = <72 3>; + gpio-controller; + #gpio-cells = <2>; +}; + +eth0: eth@400000 { + /* Linux has "smsc,lan9115" */ + compatible = "smsc,lan9220"; + /* Actual reg range is ~0x200 */ + reg = <0x400000 0x100000>; + interrupts = <49 3>; +}; + +i2c_touch: i2c@8100000 { + compatible = "arm,versatile-i2c"; + clock-frequency = ; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x8100000 0x1000>; +}; + +i2c_audio_conf: i2c@8101000 { + compatible = "arm,versatile-i2c"; + clock-frequency = ; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x8101000 0x1000>; +}; + +spi_adc: spi@8102000 { + compatible = "arm,pl022"; + reg = <0x8102000 DT_SIZE_K(4)>; + interrupts = <53 3>; + interrupt-names = "shield_adc"; + clocks = <&sysclk>; + #address-cells = <1>; + #size-cells = <0>; +}; + +spi_shield0: spi@8103000 { + compatible = "arm,pl022"; + reg = <0x8103000 DT_SIZE_K(4)>; + interrupts = <54 3>; + interrupt-names = "shield0_spi"; + clocks = <&sysclk>; + #address-cells = <1>; + #size-cells = <0>; + pinctrl-0 = <&spi3_default>; + pinctrl-names = "default"; +}; + +spi_shield1: spi@8104000 { + compatible = "arm,pl022"; + reg = <0x8104000 DT_SIZE_K(4)>; + interrupts = <55 3>; + interrupt-names = "shield1_spi"; + clocks = <&sysclk>; + #address-cells = <1>; + #size-cells = <0>; + pinctrl-0 = <&spi4_default>; + pinctrl-names = "default"; +}; + +i2c_shield0: i2c@8105000 { + compatible = "arm,versatile-i2c"; + clock-frequency = ; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x8105000 0x1000>; + pinctrl-0 = <&sbcon2_default>; + pinctrl-names = "default"; +}; + +i2c_shield1: i2c@8106000 { + compatible = "arm,versatile-i2c"; + clock-frequency = ; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x8106000 0x1000>; + pinctrl-0 = <&sbcon3_default>; + pinctrl-names = "default"; +}; + +i2c_ddr4_eeprom: i2c@8108000 { + compatible = "arm,versatile-i2c"; + clock-frequency = ; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x8108000 0x1000>; +}; + +gpio_led0: mps4_fpgaio@8202000 { + compatible = "arm,mmio32-gpio"; + reg = <0x8202000 0x4>; + gpio-controller; + #gpio-cells = <1>; + ngpios = <8>; +}; + +gpio_button: mps4_fpgaio@8202008 { + compatible = "arm,mmio32-gpio"; + reg = <0x8202008 0x4>; + gpio-controller; + #gpio-cells = <1>; + ngpios = <2>; + direction-input; +}; + +gpio_misc: mps4_fpgaio@820204c { + compatible = "arm,mmio32-gpio"; + reg = <0x820204c 0x4>; + gpio-controller; + #gpio-cells = <1>; + ngpios = <3>; +}; + +uart0: uart@8203000 { + compatible = "arm,cmsdk-uart"; + reg = <0x8203000 0x1000>; + interrupts = <34 3 33 3>; + interrupt-names = "tx", "rx"; + clocks = <&sysclk>; + current-speed = <115200>; +}; + +uart1: uart@8204000 { + compatible = "arm,cmsdk-uart"; + reg = <0x8204000 0x1000>; + interrupts = <36 3 35 3>; + interrupt-names = "tx", "rx"; + clocks = <&sysclk>; + current-speed = <115200>; +}; + +uart2: uart@8205000 { + compatible = "arm,cmsdk-uart"; + reg = <0x8205000 0x1000>; + interrupts = <38 3 37 3>; + interrupt-names = "tx", "rx"; + clocks = <&sysclk>; + current-speed = <115200>; +}; + +uart3: uart@8206000 { + compatible = "arm,cmsdk-uart"; + reg = <0x8206000 0x1000>; + interrupts = <40 3 39 3>; + interrupt-names = "tx", "rx"; + clocks = <&sysclk>; + current-speed = <115200>; +}; + +uart4: uart@8207000 { + compatible = "arm,cmsdk-uart"; + reg = <0x8207000 0x1000>; + interrupts = <42 3 41 3>; + interrupt-names = "tx", "rx"; + clocks = <&sysclk>; + current-speed = <115200>; +}; + +uart5: uart@8208000 { + compatible = "arm,cmsdk-uart"; + status = "disabled"; + reg = <0x8208000 0x1000>; + interrupt-names = "tx", "rx"; + interrupts = <126 3 125 3>; + clocks = <&sysclk>; + current-speed = <115200>; +}; diff --git a/boards/arm/mps4/mps4_corstone320_fvp.dts b/boards/arm/mps4/mps4_corstone320_fvp.dts new file mode 100644 index 000000000000..98c87ce7ed7a --- /dev/null +++ b/boards/arm/mps4/mps4_corstone320_fvp.dts @@ -0,0 +1,97 @@ +/* + * Copyright 2025 Arm Limited and/or its affiliates + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include +#include +#include +#include + +/ { + compatible = "arm,mps4-fvp"; + #address-cells = <1>; + #size-cells = <1>; + + chosen { + zephyr,console = &uart0; + zephyr,shell-uart = &uart0; + zephyr,sram = &sram; + zephyr,flash = &isram; + }; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu@0 { + device_type = "cpu"; + compatible = "arm,cortex-m85"; + reg = <0>; + #address-cells = <1>; + #size-cells = <1>; + + mpu: mpu@e000ed90 { + compatible = "arm,armv8.1m-mpu"; + reg = <0xe000ed90 0x40>; + }; + }; + }; + + ethosu { + #address-cells = <1>; + #size-cells = <0>; + interrupt-parent = <&nvic>; + + ethosu0: ethosu@50004000 { + compatible = "arm,ethos-u"; + reg = <0x50004000>; + interrupts = <16 3>; + secure-enable; + privilege-enable; + status = "okay"; + }; + }; + + /* We utilize the secure addresses, if you subtract 0x10000000 + * you'll get the non-secure alias + */ + itcm: itcm@10000000 { /* alias @ 0x0 */ + compatible = "zephyr,memory-region"; + reg = <0x10000000 DT_SIZE_K(32)>; + zephyr,memory-region = "ITCM"; + }; + + sram: sram@12000000 { /* alias @ 0x01000000 */ + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0x12000000 DT_SIZE_M(2)>; + zephyr,memory-region = "SRAM"; + }; + + dtcm: dtcm@30000000 { /* alias @ 0x20000000 */ + compatible = "zephyr,memory-region"; + reg = <0x30000000 DT_SIZE_K(32)>; + zephyr,memory-region = "DTCM"; + }; + + isram: sram@31000000 { /* alias @ 0x21000000 */ + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0x31000000 DT_SIZE_M(4)>; + zephyr,memory-region = "ISRAM"; + }; + + soc { + peripheral@50000000 { + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x50000000 0x10000000>; + + #include "mps4_common_soc_peripheral.dtsi" + }; + }; +}; + +#include "mps4_common.dtsi" diff --git a/boards/arm/mps4/mps4_corstone320_fvp.yaml b/boards/arm/mps4/mps4_corstone320_fvp.yaml new file mode 100644 index 000000000000..624c85808128 --- /dev/null +++ b/boards/arm/mps4/mps4_corstone320_fvp.yaml @@ -0,0 +1,25 @@ +# Copyright 2025 Arm Limited and/or its affiliates +# SPDX-License-Identifier: Apache-2.0 + +identifier: mps4/corstone320/fvp +name: Arm MPS4-Corstone320-FVP +type: mcu +arch: arm +ram: 2048 +flash: 4096 +simulation: + - name: armfvp + exec: FVP_Corstone_SSE-320 +toolchain: + - gnuarmemb + - zephyr +supported: + - gpio +testing: + default: true + ignore_tags: + - drivers + - bluetooth + - net + - timer +vendor: arm diff --git a/boards/arm/mps4/mps4_corstone320_fvp_defconfig b/boards/arm/mps4/mps4_corstone320_fvp_defconfig new file mode 100644 index 000000000000..26d5a732e493 --- /dev/null +++ b/boards/arm/mps4/mps4_corstone320_fvp_defconfig @@ -0,0 +1,19 @@ +# Copyright 2025 Arm Limited and/or its affiliates +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_RUNTIME_NMI=y +CONFIG_ARM_TRUSTZONE_M=y +CONFIG_ARM_MPU=y + +# GPIOs +CONFIG_GPIO=y + +# Serial +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y +CONFIG_SERIAL=y + +# Build a Secure firmware image +CONFIG_TRUSTED_EXECUTION_SECURE=y +# ROMSTART_REGION address and size are defined in Kconfig.defconfig +CONFIG_ROMSTART_RELOCATION_ROM=y diff --git a/boards/arm/mps4/mps4_corstone320_fvp_ns.dts b/boards/arm/mps4/mps4_corstone320_fvp_ns.dts new file mode 100644 index 000000000000..c511a7cc700b --- /dev/null +++ b/boards/arm/mps4/mps4_corstone320_fvp_ns.dts @@ -0,0 +1,102 @@ +/* + * Copyright 2025 Arm Limited and/or its affiliates + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include +#include +#include +#include + +/ { + compatible = "arm,mps4-fvp"; + #address-cells = <1>; + #size-cells = <1>; + + chosen { + zephyr,console = &uart0; + zephyr,shell-uart = &uart0; + zephyr,sram = &ram; + zephyr,flash = &code; + }; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu@0 { + device_type = "cpu"; + compatible = "arm,cortex-m85"; + reg = <0>; + #address-cells = <1>; + #size-cells = <1>; + + mpu: mpu@e000ed90 { + compatible = "arm,armv8.1m-mpu"; + reg = <0xe000ed90 0x40>; + }; + }; + }; + + /* We utilize the secure addresses, if you subtract 0x10000000 + * you'll get the non-secure alias + */ + itcm: itcm@0 { + compatible = "zephyr,memory-region"; + reg = <0x0 DT_SIZE_K(32)>; + zephyr,memory-region = "ITCM"; + }; + + sram: sram@1000000 { + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0x1000000 DT_SIZE_M(2)>; + zephyr,memory-region = "SRAM"; + }; + + dtcm: dtcm@20000000 { + compatible = "zephyr,memory-region"; + reg = <0x20000000 DT_SIZE_K(512)>; + zephyr,memory-region = "DTCM"; + }; + + isram: sram@21000000 { + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0x21000000 DT_SIZE_M(4)>; + zephyr,memory-region = "ISRAM"; + }; + + reserved-memory { + #address-cells = <1>; + #size-cells = <1>; + ranges; + + /* The memory regions defined below must match what the TF-M + * project has defined for that board - a single image boot is + * assumed. Please see the memory layout in: + * https://git.trustedfirmware.org/TF-M/trusted-firmware-m.git/tree/platform/ext/target/mps4/corstone320/common/partition/flash_layout.h + */ + + code: memory@28080000 { + reg = <0x28080000 DT_SIZE_K(512)>; + }; + + ram: memory@21020000 { + reg = <0x21020000 DT_SIZE_M(1)>; + }; + }; + + soc { + peripheral@40000000 { + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x40000000 0x10000000>; + + #include "mps4_common_soc_peripheral.dtsi" + }; + }; +}; + +#include "mps4_common.dtsi" diff --git a/boards/arm/mps4/mps4_corstone320_fvp_ns.yaml b/boards/arm/mps4/mps4_corstone320_fvp_ns.yaml new file mode 100644 index 000000000000..45ee954a3370 --- /dev/null +++ b/boards/arm/mps4/mps4_corstone320_fvp_ns.yaml @@ -0,0 +1,15 @@ +# Copyright 2025 Arm Limited and/or its affiliates +# SPDX-License-Identifier: Apache-2.0 + +identifier: mps4/corstone320/fvp/ns +name: Arm MPS4-Corstone320-FVP_ns +type: mcu +arch: arm +ram: 1024 +flash: 512 +toolchain: + - gnuarmemb + - zephyr +testing: + only_tags: + - trusted-firmware-m diff --git a/boards/arm/mps4/mps4_corstone320_fvp_ns_defconfig b/boards/arm/mps4/mps4_corstone320_fvp_ns_defconfig new file mode 100644 index 000000000000..d59d419011b0 --- /dev/null +++ b/boards/arm/mps4/mps4_corstone320_fvp_ns_defconfig @@ -0,0 +1,19 @@ +# Copyright 2025 Arm Limited and/or its affiliates +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_ARM_TRUSTZONE_M=y +CONFIG_RUNTIME_NMI=y +CONFIG_ARM_MPU=y + +# GPIOs +CONFIG_GPIO=y + +# Serial +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y +CONFIG_SERIAL=y + +# Build a Non-secure firmware image +CONFIG_TRUSTED_EXECUTION_SECURE=n +CONFIG_TRUSTED_EXECUTION_NONSECURE=y +CONFIG_BUILD_WITH_TFM=y diff --git a/soc/arm/mps4/CMakeLists.txt b/soc/arm/mps4/CMakeLists.txt new file mode 100644 index 000000000000..1cc200dafbb0 --- /dev/null +++ b/soc/arm/mps4/CMakeLists.txt @@ -0,0 +1,6 @@ +# Copyright 2025 Arm Limited and/or its affiliates +# SPDX-License-Identifier: Apache-2.0 + +zephyr_include_directories(.) + +set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/arm/cortex_m/scripts/linker.ld CACHE INTERNAL "") diff --git a/soc/arm/mps4/Kconfig b/soc/arm/mps4/Kconfig new file mode 100644 index 000000000000..0054f715208f --- /dev/null +++ b/soc/arm/mps4/Kconfig @@ -0,0 +1,21 @@ +# Copyright 2025 Arm Limited and/or its affiliates +# SPDX-License-Identifier: Apache-2.0 + +config SOC_SERIES_MPS4 + select ARM + select GPIO_MMIO32 if GPIO + +config SOC_MPS4_CORSTONE320 + select CPU_CORTEX_M85 + select CPU_HAS_ARM_SAU + select CPU_HAS_ARM_MPU + select CPU_HAS_FPU + select ARMV8_M_DSP + select ARMV8_1_M_MVEI + select ARMV8_1_M_MVEF + select ARMV8_1_M_PMU + select ARM_MPU_PXN if ARM_MPU + +config ARMV8_1_M_PMU_EVENTCNT + int + default 8 if SOC_MPS4_CORSTONE320 diff --git a/soc/arm/mps4/Kconfig.defconfig b/soc/arm/mps4/Kconfig.defconfig new file mode 100644 index 000000000000..667eaadb35cf --- /dev/null +++ b/soc/arm/mps4/Kconfig.defconfig @@ -0,0 +1,11 @@ +# Copyright 2025 Arm Limited and/or its affiliates +# SPDX-License-Identifier: Apache-2.0 + +if SOC_SERIES_MPS4 + +config SYS_CLOCK_HW_CYCLES_PER_SEC + default $(dt_node_int_prop_int,$(dt_nodelabel_path,sysclk),clock-frequency) + +rsource "Kconfig.defconfig.mps4*" + +endif # SOC_SERIES_MPS4 diff --git a/soc/arm/mps4/Kconfig.defconfig.mps4_corstone320 b/soc/arm/mps4/Kconfig.defconfig.mps4_corstone320 new file mode 100644 index 000000000000..f7348d7fcadf --- /dev/null +++ b/soc/arm/mps4/Kconfig.defconfig.mps4_corstone320 @@ -0,0 +1,9 @@ +# Copyright 2025 Arm Limited and/or its affiliates +# SPDX-License-Identifier: Apache-2.0 + +if SOC_MPS4_CORSTONE320 + +config NUM_IRQS + default 232 + +endif diff --git a/soc/arm/mps4/Kconfig.soc b/soc/arm/mps4/Kconfig.soc new file mode 100644 index 000000000000..a557d287f0e8 --- /dev/null +++ b/soc/arm/mps4/Kconfig.soc @@ -0,0 +1,18 @@ +# Copyright 2025 Arm Limited and/or its affiliates +# SPDX-License-Identifier: Apache-2.0 + +config SOC_SERIES_MPS4 + bool + select SOC_FAMILY_ARM + help + Enable support for ARM MPS4 MCU Series + +config SOC_SERIES + default "mps4" if SOC_SERIES_MPS4 + +config SOC_MPS4_CORSTONE320 + bool + select SOC_SERIES_MPS4 + +config SOC + default "corstone320" if SOC_MPS4_CORSTONE320 diff --git a/soc/arm/mps4/soc.h b/soc/arm/mps4/soc.h new file mode 100644 index 000000000000..14ceadbd20a9 --- /dev/null +++ b/soc/arm/mps4/soc.h @@ -0,0 +1,12 @@ +/* + * Copyright 2025 Arm Limited and/or its affiliates + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef _SOC_H_ +#define _SOC_H_ + +#include + +#endif /* _SOC_H_ */ diff --git a/soc/arm/soc.yml b/soc/arm/soc.yml index 866f34dafd45..2caf077656a9 100644 --- a/soc/arm/soc.yml +++ b/soc/arm/soc.yml @@ -15,6 +15,9 @@ family: socs: - name: corstone300 - name: corstone310 + - name: mps4 + socs: + - name: corstone320 - name: musca socs: - name: musca_b1 From a11bf865174f193c117476c330f60e6a4a6ffc59 Mon Sep 17 00:00:00 2001 From: Sudan Landge Date: Tue, 27 May 2025 11:33:54 +0100 Subject: [PATCH 0775/2141] [nrf fromtree] pinctrl: add support for mps4 Add MPS4 pinctrl support by referring to `mps4/common/partition/platform_base_address.h` from TF-M's main branch. Signed-off-by: Sudan Landge (cherry picked from commit 5a3c4941a2a199c3762a98c1d955cba56905b1e9) --- boards/arm/mps4/mps4-pinctrl.dtsi | 68 +++++++++++++++ boards/arm/mps4/mps4_common.dtsi | 2 + .../arm/mps4/mps4_common_soc_peripheral.dtsi | 9 ++ drivers/pinctrl/CMakeLists.txt | 1 + drivers/pinctrl/Kconfig | 1 + drivers/pinctrl/Kconfig.arm_mps4 | 9 ++ drivers/pinctrl/pinctrl_arm_mps4.c | 36 ++++++++ dts/bindings/pinctrl/arm,mps4-pinctrl.yaml | 82 +++++++++++++++++++ .../dt-bindings/pinctrl/arm-mps4-pinctrl.h | 40 +++++++++ soc/arm/mps4/pinctrl_soc.h | 51 ++++++++++++ 10 files changed, 299 insertions(+) create mode 100644 boards/arm/mps4/mps4-pinctrl.dtsi create mode 100644 drivers/pinctrl/Kconfig.arm_mps4 create mode 100644 drivers/pinctrl/pinctrl_arm_mps4.c create mode 100644 dts/bindings/pinctrl/arm,mps4-pinctrl.yaml create mode 100644 include/zephyr/dt-bindings/pinctrl/arm-mps4-pinctrl.h create mode 100644 soc/arm/mps4/pinctrl_soc.h diff --git a/boards/arm/mps4/mps4-pinctrl.dtsi b/boards/arm/mps4/mps4-pinctrl.dtsi new file mode 100644 index 000000000000..e8b7e7207037 --- /dev/null +++ b/boards/arm/mps4/mps4-pinctrl.dtsi @@ -0,0 +1,68 @@ +/* + * Copyright 2025 Arm Limited and/or its affiliates + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +&pinctrl { + /omit-if-no-ref/ uart3_default: uart3_default { + group1 { + pinmux = ; + }; + + group2 { + pinmux = ; + input-enable; + }; + }; + + /omit-if-no-ref/ uart4_default: uart4_default { + group1 { + pinmux = ; + }; + + group2 { + pinmux = ; + input-enable; + }; + }; + + /omit-if-no-ref/ spi3_default: spi3_default { + group1 { + pinmux = , , + ; + }; + + group2 { + pinmux = ; + input-enable; + }; + }; + + /omit-if-no-ref/ spi4_default: spi4_default { + group1 { + pinmux = , , ; + }; + + group2 { + pinmux = ; + input-enable; + }; + }; + + /omit-if-no-ref/ sbcon2_default: sbcon2_default { + group1 { + pinmux = , ; + input-enable; + }; + }; + + /omit-if-no-ref/ sbcon3_default: sbcon3_default { + group1 { + pinmux = , ; + input-enable; + }; + }; +}; diff --git a/boards/arm/mps4/mps4_common.dtsi b/boards/arm/mps4/mps4_common.dtsi index c2958fc5c075..ad97dae06af5 100644 --- a/boards/arm/mps4/mps4_common.dtsi +++ b/boards/arm/mps4/mps4_common.dtsi @@ -117,3 +117,5 @@ &nvic { arm,num-irq-priority-bits = <3>; }; + +#include "mps4-pinctrl.dtsi" diff --git a/boards/arm/mps4/mps4_common_soc_peripheral.dtsi b/boards/arm/mps4/mps4_common_soc_peripheral.dtsi index d94339e4c05c..6cc3f405ea76 100644 --- a/boards/arm/mps4/mps4_common_soc_peripheral.dtsi +++ b/boards/arm/mps4/mps4_common_soc_peripheral.dtsi @@ -187,6 +187,8 @@ uart3: uart@8206000 { interrupt-names = "tx", "rx"; clocks = <&sysclk>; current-speed = <115200>; + pinctrl-0 = <&uart3_default>; + pinctrl-names = "default"; }; uart4: uart@8207000 { @@ -196,6 +198,8 @@ uart4: uart@8207000 { interrupt-names = "tx", "rx"; clocks = <&sysclk>; current-speed = <115200>; + pinctrl-0 = <&uart4_default>; + pinctrl-names = "default"; }; uart5: uart@8208000 { @@ -207,3 +211,8 @@ uart5: uart@8208000 { clocks = <&sysclk>; current-speed = <115200>; }; + +pinctrl: pinctrl { + compatible = "arm,mps4-pinctrl"; + status = "okay"; +}; diff --git a/drivers/pinctrl/CMakeLists.txt b/drivers/pinctrl/CMakeLists.txt index b325217c6a92..839c288c394e 100644 --- a/drivers/pinctrl/CMakeLists.txt +++ b/drivers/pinctrl/CMakeLists.txt @@ -8,6 +8,7 @@ zephyr_library_sources_ifdef(CONFIG_PINCTRL_TELINK_B91 pinctrl_b91.c) zephyr_library_sources_ifdef(CONFIG_PINCTRL_AMBIQ pinctrl_ambiq.c) zephyr_library_sources_ifdef(CONFIG_PINCTRL_ARM_MPS2 pinctrl_arm_mps2.c) zephyr_library_sources_ifdef(CONFIG_PINCTRL_ARM_MPS3 pinctrl_arm_mps3.c) +zephyr_library_sources_ifdef(CONFIG_PINCTRL_ARM_MPS4 pinctrl_arm_mps4.c) zephyr_library_sources_ifdef(CONFIG_PINCTRL_ARM_V2M_BEETLE pinctrl_arm_v2m_beetle.c) zephyr_library_sources_ifdef(CONFIG_PINCTRL_BFLB pinctrl_bflb.c) zephyr_library_sources_ifdef(CONFIG_PINCTRL_GD32_AF pinctrl_gd32_af.c) diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig index a47c4392a78a..e13c4e427ff7 100644 --- a/drivers/pinctrl/Kconfig +++ b/drivers/pinctrl/Kconfig @@ -39,6 +39,7 @@ source "drivers/pinctrl/Kconfig.bflb" source "drivers/pinctrl/Kconfig.ambiq" source "drivers/pinctrl/Kconfig.arm_mps2" source "drivers/pinctrl/Kconfig.arm_mps3" +source "drivers/pinctrl/Kconfig.arm_mps4" source "drivers/pinctrl/Kconfig.arm_v2m_beetle" source "drivers/pinctrl/Kconfig.gd32" source "drivers/pinctrl/Kconfig.it8xxx2" diff --git a/drivers/pinctrl/Kconfig.arm_mps4 b/drivers/pinctrl/Kconfig.arm_mps4 new file mode 100644 index 000000000000..ab610a411bae --- /dev/null +++ b/drivers/pinctrl/Kconfig.arm_mps4 @@ -0,0 +1,9 @@ +# Copyright 2025 Arm Limited and/or its affiliates +# SPDX-License-Identifier: Apache-2.0 + +config PINCTRL_ARM_MPS4 + bool "Arm MPS4 pin controller driver" + default y + depends on DT_HAS_ARM_MPS4_PINCTRL_ENABLED + help + Arm MPS4 pinctrl driver diff --git a/drivers/pinctrl/pinctrl_arm_mps4.c b/drivers/pinctrl/pinctrl_arm_mps4.c new file mode 100644 index 000000000000..3a0215b53e60 --- /dev/null +++ b/drivers/pinctrl/pinctrl_arm_mps4.c @@ -0,0 +1,36 @@ +/* + * Copyright 2025 Arm Limited and/or its affiliates + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "zephyr/device.h" +#include "zephyr/drivers/gpio.h" +#include +#include +#include + +static const struct device *const gpio_ports[] = {DEVICE_DT_GET_OR_NULL(DT_NODELABEL(gpio0)), + DEVICE_DT_GET_OR_NULL(DT_NODELABEL(gpio1))}; + +static int pinctrl_configure_pin(const pinctrl_soc_pin_t *pin) +{ + uint32_t flags = pin->input_enable ? GPIO_INPUT : GPIO_OUTPUT; + + /* Each gpio has 16 pins, so divide by 16 to get specific gpio*/ + const struct device *gpio_dev = gpio_ports[pin->pin_num >> 4]; + + return cmsdk_ahb_gpio_config(gpio_dev, pin->pin_num % 16, flags); +} + +int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, uintptr_t reg) +{ + ARG_UNUSED(reg); + for (uint8_t i = 0U; i < pin_cnt; i++) { + if (pinctrl_configure_pin(&pins[i]) == -ENOTSUP) { + return -ENOTSUP; + } + } + + return 0; +} diff --git a/dts/bindings/pinctrl/arm,mps4-pinctrl.yaml b/dts/bindings/pinctrl/arm,mps4-pinctrl.yaml new file mode 100644 index 000000000000..d08e37cdab2b --- /dev/null +++ b/dts/bindings/pinctrl/arm,mps4-pinctrl.yaml @@ -0,0 +1,82 @@ +# Copyright 2025 Arm Limited and/or its affiliates +# SPDX-License-Identifier: Apache-2.0 + +description: | + The Arm Mps4 pin controller is a node responsible for controlling + pin function selection and pin properties, such as routing a UART3 TX + to pin 1. + + The node has the 'pinctrl' node label set in your SoC's devicetree, + so you can modify it like this: + + &pinctrl { + /* your modifications go here */ + }; + + All device pin configurations should be placed in child nodes of the + 'pinctrl' node, as shown in this example: + + &pinctrl { + /* configuration for the usart0 "default" state */ + uart3_default: uart3_default { + /* group 1 */ + group1 { + /* configure P1 as UART3 TX */ + pinmux = ; + }; + /* group 2 */ + group2 { + /* configure P0 as UART3 RX */ + pinmux = ; + /* enable input on pin 1 */ + input-enable; + }; + }; + }; + + The 'uart3_default' child node encodes the pin configurations for a + particular state of a device; in this case, the default (that is, active) + state. + + As shown, pin configurations are organized in groups within each child node. + Each group can specify a list of pin function selections in the 'pinmux' + property. Here is a list of supported standard pin properties: + - input-enable + + A group can also specify shared pin properties common to all the specified + pins, such as the 'input-enable' property in group 2. + + To link pin configurations with a device, use a pinctrl-N property for some + number N, like this example you could place in your board's DTS file: + + #include "board-pinctrl.dtsi" + + &uart3 { + pinctrl-0 = <&uart3_default>; + pinctrl-1 = <&uart3_sleep>; + pinctrl-names = "default", "sleep"; + }; + + +compatible: "arm,mps4-pinctrl" + +include: base.yaml + +child-binding: + description: | + Definitions for a pinctrl state. + child-binding: + + include: + - name: pincfg-node.yaml + property-allowlist: + - input-enable + + properties: + pinmux: + required: true + type: array + description: | + An array of pins sharing the same group properties. Each + element of the array is an integer constructed from the + pin number and the alternative function of the pin. diff --git a/include/zephyr/dt-bindings/pinctrl/arm-mps4-pinctrl.h b/include/zephyr/dt-bindings/pinctrl/arm-mps4-pinctrl.h new file mode 100644 index 000000000000..a2d211499a76 --- /dev/null +++ b/include/zephyr/dt-bindings/pinctrl/arm-mps4-pinctrl.h @@ -0,0 +1,40 @@ +/* + * Copyright 2025 Arm Limited and/or its affiliates + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#define MPS4_ALT_FUNC_POS 0 +#define MPS4_ALT_FUNC_MASK 0x7 + +#define MPS4_EXP_NUM_POS 3 +#define MPS4_EXP_NUM_MASK 0x1F8 + +#define MPS4_PINCTRL_FUNC_UART 0 +#define MPS4_PINCTRL_FUNC_GPIO 1 +#define MPS4_PINCTRL_FUNC_I2C 2 +#define MPS4_PINCTRL_FUNC_SPI 3 + +#define MPS4_PINMUX(alt_func, exp_num) (exp_num << MPS4_EXP_NUM_POS | \ + alt_func << MPS4_ALT_FUNC_POS) + +/* GPIO 0 */ +#define UART3_RXD_EXP MPS4_PINMUX(MPS4_PINCTRL_FUNC_UART, 0) +#define UART3_TXD_EXP MPS4_PINMUX(MPS4_PINCTRL_FUNC_UART, 1) +#define SPI3_SS_EXP MPS4_PINMUX(MPS4_PINCTRL_FUNC_SPI, 10) +#define SPI3_MOSI_EXP MPS4_PINMUX(MPS4_PINCTRL_FUNC_SPI, 11) +#define SPI3_MISO_EXP MPS4_PINMUX(MPS4_PINCTRL_FUNC_SPI, 12) +#define SPI3_SCK_EXP MPS4_PINMUX(MPS4_PINCTRL_FUNC_SPI, 13) +#define SBCON2_SDA_EXP MPS4_PINMUX(MPS4_PINCTRL_FUNC_I2C, 14) +#define SBCON2_SCL_EXP MPS4_PINMUX(MPS4_PINCTRL_FUNC_I2C, 15) + + +/* GPIO 1 */ +#define UART4_RXD_EXP MPS4_PINMUX(MPS4_PINCTRL_FUNC_UART, 16) +#define UART4_TXD_EXP MPS4_PINMUX(MPS4_PINCTRL_FUNC_UART, 17) +#define SPI4_SS_EXP MPS4_PINMUX(MPS4_PINCTRL_FUNC_SPI, 26) +#define SPI4_MOSI_EXP MPS4_PINMUX(MPS4_PINCTRL_FUNC_SPI, 27) +#define SPI4_MISO_EXP MPS4_PINMUX(MPS4_PINCTRL_FUNC_SPI, 28) +#define SPI4_SCK_EXP MPS4_PINMUX(MPS4_PINCTRL_FUNC_SPI, 29) +#define SBCON3_SDA_EXP MPS4_PINMUX(MPS4_PINCTRL_FUNC_I2C, 30) +#define SBCON3_SCL_EXP MPS4_PINMUX(MPS4_PINCTRL_FUNC_I2C, 31) diff --git a/soc/arm/mps4/pinctrl_soc.h b/soc/arm/mps4/pinctrl_soc.h new file mode 100644 index 000000000000..a88e0cee7df6 --- /dev/null +++ b/soc/arm/mps4/pinctrl_soc.h @@ -0,0 +1,51 @@ +/* + * Copyright 2025 Arm Limited and/or its affiliates + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +/** + * @brief Type to hold a pin's pinctrl configuration. + */ +struct mps4_pinctrl_soc_pin { + /** Pin number 0..52 */ + uint32_t pin_num : 6; + /** Alternative function (UART, SPI, etc.) */ + uint32_t alt_func : 3; + /** Enable the pin as an input */ + uint32_t input_enable : 1; +}; + +typedef struct mps4_pinctrl_soc_pin pinctrl_soc_pin_t; + +/** + * @brief Utility macro to initialize each pin. + * + * @param node_id Node identifier. + * @param prop Property name. + * @param idx Property entry index. + */ +#define Z_PINCTRL_STATE_PIN_INIT(node_id, prop, idx) \ + { \ + MPS4_GET_PIN_NUM(DT_PROP_BY_IDX(node_id, prop, idx)), \ + MPS4_GET_PIN_ALT_FUNC(DT_PROP_BY_IDX(node_id, prop, idx)), \ + DT_PROP(node_id, input_enable), \ + }, + +/** + * @brief Utility macro to initialize state pins contained in a given property. + * + * @param node_id Node identifier. + * @param prop Property name describing state pins. + */ +#define Z_PINCTRL_STATE_PINS_INIT(node_id, prop) \ + {DT_FOREACH_CHILD_VARGS(DT_PHANDLE(node_id, prop), \ + DT_FOREACH_PROP_ELEM, pinmux, \ + Z_PINCTRL_STATE_PIN_INIT)} + +#define MPS4_GET_PIN_NUM(pinctrl) \ + (((pinctrl) >> MPS4_EXP_NUM_POS) & MPS4_EXP_NUM_MASK) +#define MPS4_GET_PIN_ALT_FUNC(pinctrl) \ + (((pinctrl) >> MPS4_ALT_FUNC_POS) & MPS4_ALT_FUNC_MASK) From c7861ae07c2282aed1d25532b179bbf83a3102d4 Mon Sep 17 00:00:00 2001 From: Shaunak saha Date: Mon, 16 Jun 2025 11:36:53 -0700 Subject: [PATCH 0776/2141] [nrf fromtree] boards: mps4: Add initial support for corstone315 What is changed? - Add initial support for the MPS4 Corstone-315 FVP platform, including board and SoC definitions.The qualifier to build/run application with board mps4/corstone315 is `mps4/corstone315/fvp` for secure and `mps3/corstone315/fvp/ns` for non-secure. - FVP testing with corstone315 uses the ARM FVP `FVP_Corstone_SSE-315`. Why do we need this change? - This enables FVP support for corstone315. - A separate FVP variant was added for corstone315 as the TFM board used for non-secure variant differs for FPGA and FVP. TFM board `arm/mps4/corstone315` support is present but no FVP support yet. We can test this by building TF-M with -DTFM_PLATFORM=arm/mps4/corstone315 and then lauching FVP: FVP_Corstone_SSE-315 --data "bl1_1.bin"@0x11000000 --data "cm_provisioning_bundle.bin"@0x12024000 --data "dm_provisioning_bundle.bin"@0x1202aa00 --data "bl2_signed.bin"@0x12031400 --data "tfm_s_ns_signed.bin"@0x38000000 Signed-off-by: Shaunak saha (cherry picked from commit 05d1c3a7f061352b807bf180ca925c7cc035d4f6) --- boards/arm/mps4/Kconfig.defconfig | 4 +- boards/arm/mps4/Kconfig.mps4 | 1 + boards/arm/mps4/board.cmake | 10 +- boards/arm/mps4/board.yml | 5 + boards/arm/mps4/mps4_corstone315_fvp.dts | 97 +++++++++++++++++ boards/arm/mps4/mps4_corstone315_fvp.yaml | 26 +++++ .../arm/mps4/mps4_corstone315_fvp_defconfig | 19 ++++ boards/arm/mps4/mps4_corstone315_fvp_ns.dts | 102 ++++++++++++++++++ boards/arm/mps4/mps4_corstone315_fvp_ns.yaml | 15 +++ .../mps4/mps4_corstone315_fvp_ns_defconfig | 19 ++++ soc/arm/mps4/Kconfig | 12 +++ .../mps4/Kconfig.defconfig.mps4_corstone315 | 9 ++ soc/arm/mps4/Kconfig.soc | 5 + soc/arm/soc.yml | 1 + 14 files changed, 320 insertions(+), 5 deletions(-) create mode 100644 boards/arm/mps4/mps4_corstone315_fvp.dts create mode 100644 boards/arm/mps4/mps4_corstone315_fvp.yaml create mode 100644 boards/arm/mps4/mps4_corstone315_fvp_defconfig create mode 100644 boards/arm/mps4/mps4_corstone315_fvp_ns.dts create mode 100644 boards/arm/mps4/mps4_corstone315_fvp_ns.yaml create mode 100644 boards/arm/mps4/mps4_corstone315_fvp_ns_defconfig create mode 100644 soc/arm/mps4/Kconfig.defconfig.mps4_corstone315 diff --git a/boards/arm/mps4/Kconfig.defconfig b/boards/arm/mps4/Kconfig.defconfig index b4e987753860..96cbd9472eae 100644 --- a/boards/arm/mps4/Kconfig.defconfig +++ b/boards/arm/mps4/Kconfig.defconfig @@ -1,7 +1,7 @@ # Copyright 2025 Arm Limited and/or its affiliates # SPDX-License-Identifier: Apache-2.0 -if BOARD_MPS4_CORSTONE320_FVP +if BOARD_MPS4_CORSTONE315_FVP || BOARD_MPS4_CORSTONE320_FVP if SERIAL @@ -10,7 +10,7 @@ config UART_INTERRUPT_DRIVEN endif # SERIAL -if ROMSTART_RELOCATION_ROM && BOARD_MPS4_CORSTONE320_FVP +if ROMSTART_RELOCATION_ROM && (BOARD_MPS4_CORSTONE315_FVP || BOARD_MPS4_CORSTONE320_FVP) config ROMSTART_REGION_ADDRESS default $(dt_nodelabel_reg_addr_hex,itcm) diff --git a/boards/arm/mps4/Kconfig.mps4 b/boards/arm/mps4/Kconfig.mps4 index ffb494cf3377..46ce14cc0620 100644 --- a/boards/arm/mps4/Kconfig.mps4 +++ b/boards/arm/mps4/Kconfig.mps4 @@ -3,4 +3,5 @@ config BOARD_MPS4 select SOC_SERIES_MPS4 + select SOC_MPS4_CORSTONE315 if BOARD_MPS4_CORSTONE315_FVP || BOARD_MPS4_CORSTONE315_FVP_NS select SOC_MPS4_CORSTONE320 if BOARD_MPS4_CORSTONE320_FVP || BOARD_MPS4_CORSTONE320_FVP_NS diff --git a/boards/arm/mps4/board.cmake b/boards/arm/mps4/board.cmake index 6497c65c4260..4e5044ab1b7c 100644 --- a/boards/arm/mps4/board.cmake +++ b/boards/arm/mps4/board.cmake @@ -7,10 +7,15 @@ # -if(CONFIG_BOARD_MPS4_CORSTONE320_FVP OR CONFIG_BOARD_MPS4_CORSTONE320_FVP_NS) +if(CONFIG_BOARD_MPS4_CORSTONE315_FVP OR CONFIG_BOARD_MPS4_CORSTONE315_FVP_NS) + set(SUPPORTED_EMU_PLATFORMS armfvp) + set(ARMFVP_BIN_NAME FVP_Corstone_SSE-315) +elseif(CONFIG_BOARD_MPS4_CORSTONE320_FVP OR CONFIG_BOARD_MPS4_CORSTONE320_FVP_NS) set(SUPPORTED_EMU_PLATFORMS armfvp) set(ARMFVP_BIN_NAME FVP_Corstone_SSE-320) - if(CONFIG_BOARD_MPS4_CORSTONE320_FVP) +endif() + +if(CONFIG_BOARD_MPS4_CORSTONE315_FVP OR CONFIG_BOARD_MPS4_CORSTONE320_FVP) set(ARMFVP_FLAGS # default is '0x11000000' but should match cpu.INITSVTOR which is 0. -C mps4_board.subsystem.iotss3_systemcontrol.INITSVTOR_RST=0 @@ -19,7 +24,6 @@ if(CONFIG_BOARD_MPS4_CORSTONE320_FVP OR CONFIG_BOARD_MPS4_CORSTONE320_FVP_NS) # few MPU tests to fail. -C mps4_board.subsystem.cpu0.MPU_S=16 ) - endif() endif() if(CONFIG_BUILD_WITH_TFM) diff --git a/boards/arm/mps4/board.yml b/boards/arm/mps4/board.yml index 8c2b411846fb..760321039f6d 100644 --- a/boards/arm/mps4/board.yml +++ b/boards/arm/mps4/board.yml @@ -3,6 +3,11 @@ board: full_name: MPS4 vendor: arm socs: + - name: 'corstone315' + variants: + - name: 'fvp' + variants: + - name: 'ns' - name: 'corstone320' variants: - name: 'fvp' diff --git a/boards/arm/mps4/mps4_corstone315_fvp.dts b/boards/arm/mps4/mps4_corstone315_fvp.dts new file mode 100644 index 000000000000..98c87ce7ed7a --- /dev/null +++ b/boards/arm/mps4/mps4_corstone315_fvp.dts @@ -0,0 +1,97 @@ +/* + * Copyright 2025 Arm Limited and/or its affiliates + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include +#include +#include +#include + +/ { + compatible = "arm,mps4-fvp"; + #address-cells = <1>; + #size-cells = <1>; + + chosen { + zephyr,console = &uart0; + zephyr,shell-uart = &uart0; + zephyr,sram = &sram; + zephyr,flash = &isram; + }; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu@0 { + device_type = "cpu"; + compatible = "arm,cortex-m85"; + reg = <0>; + #address-cells = <1>; + #size-cells = <1>; + + mpu: mpu@e000ed90 { + compatible = "arm,armv8.1m-mpu"; + reg = <0xe000ed90 0x40>; + }; + }; + }; + + ethosu { + #address-cells = <1>; + #size-cells = <0>; + interrupt-parent = <&nvic>; + + ethosu0: ethosu@50004000 { + compatible = "arm,ethos-u"; + reg = <0x50004000>; + interrupts = <16 3>; + secure-enable; + privilege-enable; + status = "okay"; + }; + }; + + /* We utilize the secure addresses, if you subtract 0x10000000 + * you'll get the non-secure alias + */ + itcm: itcm@10000000 { /* alias @ 0x0 */ + compatible = "zephyr,memory-region"; + reg = <0x10000000 DT_SIZE_K(32)>; + zephyr,memory-region = "ITCM"; + }; + + sram: sram@12000000 { /* alias @ 0x01000000 */ + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0x12000000 DT_SIZE_M(2)>; + zephyr,memory-region = "SRAM"; + }; + + dtcm: dtcm@30000000 { /* alias @ 0x20000000 */ + compatible = "zephyr,memory-region"; + reg = <0x30000000 DT_SIZE_K(32)>; + zephyr,memory-region = "DTCM"; + }; + + isram: sram@31000000 { /* alias @ 0x21000000 */ + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0x31000000 DT_SIZE_M(4)>; + zephyr,memory-region = "ISRAM"; + }; + + soc { + peripheral@50000000 { + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x50000000 0x10000000>; + + #include "mps4_common_soc_peripheral.dtsi" + }; + }; +}; + +#include "mps4_common.dtsi" diff --git a/boards/arm/mps4/mps4_corstone315_fvp.yaml b/boards/arm/mps4/mps4_corstone315_fvp.yaml new file mode 100644 index 000000000000..4af1421bcbc6 --- /dev/null +++ b/boards/arm/mps4/mps4_corstone315_fvp.yaml @@ -0,0 +1,26 @@ +# Copyright 2025 Arm Limited and/or its affiliates +# SPDX-License-Identifier: Apache-2.0 + +identifier: mps4/corstone315/fvp +name: Arm MPS4-Corstone315-FVP +type: mcu +arch: arm +ram: 2048 +flash: 4096 +simulation: + - name: armfvp + exec: FVP_Corstone_SSE-315 +toolchain: + - gnuarmemb + - zephyr +supported: + - gpio +testing: + default: true + timeout_multiplier: 4 + ignore_tags: + - drivers + - bluetooth + - net + - timer +vendor: arm diff --git a/boards/arm/mps4/mps4_corstone315_fvp_defconfig b/boards/arm/mps4/mps4_corstone315_fvp_defconfig new file mode 100644 index 000000000000..26d5a732e493 --- /dev/null +++ b/boards/arm/mps4/mps4_corstone315_fvp_defconfig @@ -0,0 +1,19 @@ +# Copyright 2025 Arm Limited and/or its affiliates +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_RUNTIME_NMI=y +CONFIG_ARM_TRUSTZONE_M=y +CONFIG_ARM_MPU=y + +# GPIOs +CONFIG_GPIO=y + +# Serial +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y +CONFIG_SERIAL=y + +# Build a Secure firmware image +CONFIG_TRUSTED_EXECUTION_SECURE=y +# ROMSTART_REGION address and size are defined in Kconfig.defconfig +CONFIG_ROMSTART_RELOCATION_ROM=y diff --git a/boards/arm/mps4/mps4_corstone315_fvp_ns.dts b/boards/arm/mps4/mps4_corstone315_fvp_ns.dts new file mode 100644 index 000000000000..cb5a38baf47d --- /dev/null +++ b/boards/arm/mps4/mps4_corstone315_fvp_ns.dts @@ -0,0 +1,102 @@ +/* + * Copyright 2025 Arm Limited and/or its affiliates + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include +#include +#include +#include + +/ { + compatible = "arm,mps4-fvp"; + #address-cells = <1>; + #size-cells = <1>; + + chosen { + zephyr,console = &uart0; + zephyr,shell-uart = &uart0; + zephyr,sram = &ram; + zephyr,flash = &code; + }; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu@0 { + device_type = "cpu"; + compatible = "arm,cortex-m85"; + reg = <0>; + #address-cells = <1>; + #size-cells = <1>; + + mpu: mpu@e000ed90 { + compatible = "arm,armv8.1m-mpu"; + reg = <0xe000ed90 0x40>; + }; + }; + }; + + /* We utilize the non-secure addresses, if you add 0x10000000 + * you'll get the secure alias + */ + itcm: itcm@0 { + compatible = "zephyr,memory-region"; + reg = <0x0 DT_SIZE_K(32)>; + zephyr,memory-region = "ITCM"; + }; + + sram: sram@1000000 { + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0x1000000 DT_SIZE_M(2)>; + zephyr,memory-region = "SRAM"; + }; + + dtcm: dtcm@20000000 { + compatible = "zephyr,memory-region"; + reg = <0x20000000 DT_SIZE_K(512)>; + zephyr,memory-region = "DTCM"; + }; + + isram: sram@21000000 { + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0x21000000 DT_SIZE_M(4)>; + zephyr,memory-region = "ISRAM"; + }; + + reserved-memory { + #address-cells = <1>; + #size-cells = <1>; + ranges; + + /* The memory regions defined below must match what the TF-M + * project has defined for that board - a single image boot is + * assumed. Please see the memory layout in: + * https://git.trustedfirmware.org/plugins/gitiles/TF-M/trusted-firmware-m.git/+/HEAD/platform/ext/target/arm/mps4/common/partition/flash_layout.h + */ + + code: memory@28080000 { + reg = <0x28080000 DT_SIZE_K(512)>; + }; + + ram: memory@21020000 { + reg = <0x21020000 DT_SIZE_M(1)>; + }; + }; + + soc { + peripheral@40000000 { + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x40000000 0x10000000>; + + #include "mps4_common_soc_peripheral.dtsi" + }; + }; +}; + +#include "mps4_common.dtsi" diff --git a/boards/arm/mps4/mps4_corstone315_fvp_ns.yaml b/boards/arm/mps4/mps4_corstone315_fvp_ns.yaml new file mode 100644 index 000000000000..01bee24100a2 --- /dev/null +++ b/boards/arm/mps4/mps4_corstone315_fvp_ns.yaml @@ -0,0 +1,15 @@ +# Copyright 2025 Arm Limited and/or its affiliates +# SPDX-License-Identifier: Apache-2.0 + +identifier: mps4/corstone315/fvp/ns +name: Arm MPS4-Corstone315-FVP_ns +type: mcu +arch: arm +ram: 1024 +flash: 512 +toolchain: + - gnuarmemb + - zephyr +testing: + only_tags: + - trusted-firmware-m diff --git a/boards/arm/mps4/mps4_corstone315_fvp_ns_defconfig b/boards/arm/mps4/mps4_corstone315_fvp_ns_defconfig new file mode 100644 index 000000000000..d59d419011b0 --- /dev/null +++ b/boards/arm/mps4/mps4_corstone315_fvp_ns_defconfig @@ -0,0 +1,19 @@ +# Copyright 2025 Arm Limited and/or its affiliates +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_ARM_TRUSTZONE_M=y +CONFIG_RUNTIME_NMI=y +CONFIG_ARM_MPU=y + +# GPIOs +CONFIG_GPIO=y + +# Serial +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y +CONFIG_SERIAL=y + +# Build a Non-secure firmware image +CONFIG_TRUSTED_EXECUTION_SECURE=n +CONFIG_TRUSTED_EXECUTION_NONSECURE=y +CONFIG_BUILD_WITH_TFM=y diff --git a/soc/arm/mps4/Kconfig b/soc/arm/mps4/Kconfig index 0054f715208f..ea733d1566dc 100644 --- a/soc/arm/mps4/Kconfig +++ b/soc/arm/mps4/Kconfig @@ -5,6 +5,17 @@ config SOC_SERIES_MPS4 select ARM select GPIO_MMIO32 if GPIO +config SOC_MPS4_CORSTONE315 + select CPU_CORTEX_M85 + select CPU_HAS_ARM_SAU + select CPU_HAS_ARM_MPU + select CPU_HAS_FPU + select ARMV8_M_DSP + select ARMV8_1_M_MVEI + select ARMV8_1_M_MVEF + select ARMV8_1_M_PMU + select ARM_MPU_PXN if ARM_MPU + config SOC_MPS4_CORSTONE320 select CPU_CORTEX_M85 select CPU_HAS_ARM_SAU @@ -18,4 +29,5 @@ config SOC_MPS4_CORSTONE320 config ARMV8_1_M_PMU_EVENTCNT int + default 8 if SOC_MPS4_CORSTONE315 default 8 if SOC_MPS4_CORSTONE320 diff --git a/soc/arm/mps4/Kconfig.defconfig.mps4_corstone315 b/soc/arm/mps4/Kconfig.defconfig.mps4_corstone315 new file mode 100644 index 000000000000..191b5d45df44 --- /dev/null +++ b/soc/arm/mps4/Kconfig.defconfig.mps4_corstone315 @@ -0,0 +1,9 @@ +# Copyright 2025 Arm Limited and/or its affiliates +# SPDX-License-Identifier: Apache-2.0 + +if SOC_MPS4_CORSTONE315 + +config NUM_IRQS + default 232 + +endif diff --git a/soc/arm/mps4/Kconfig.soc b/soc/arm/mps4/Kconfig.soc index a557d287f0e8..98087bb36763 100644 --- a/soc/arm/mps4/Kconfig.soc +++ b/soc/arm/mps4/Kconfig.soc @@ -10,9 +10,14 @@ config SOC_SERIES_MPS4 config SOC_SERIES default "mps4" if SOC_SERIES_MPS4 +config SOC_MPS4_CORSTONE315 + bool + select SOC_SERIES_MPS4 + config SOC_MPS4_CORSTONE320 bool select SOC_SERIES_MPS4 config SOC + default "corstone315" if SOC_MPS4_CORSTONE315 default "corstone320" if SOC_MPS4_CORSTONE320 diff --git a/soc/arm/soc.yml b/soc/arm/soc.yml index 2caf077656a9..821da33e9cf9 100644 --- a/soc/arm/soc.yml +++ b/soc/arm/soc.yml @@ -17,6 +17,7 @@ family: - name: corstone310 - name: mps4 socs: + - name: corstone315 - name: corstone320 - name: musca socs: From 370ff7bb18ab2d78790006b8e3fee8586d57adf8 Mon Sep 17 00:00:00 2001 From: Sudan Landge Date: Tue, 27 May 2025 11:36:06 +0100 Subject: [PATCH 0777/2141] [nrf fromtree] modules: ethos_u: arm: update for MPS4 Update support for MPS4 which has default 256 MACs as per FVP. Signed-off-by: Sudan Landge (cherry picked from commit 97c501f0f33463471740befb52f2cdc2192613f4) --- modules/hal_ethos_u/Kconfig | 5 +++-- modules/trusted-firmware-m/Kconfig.tfm | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/hal_ethos_u/Kconfig b/modules/hal_ethos_u/Kconfig index 4ca5136cf023..e7b045c23526 100644 --- a/modules/hal_ethos_u/Kconfig +++ b/modules/hal_ethos_u/Kconfig @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Copyright 2021-2022, 2024 Arm Limited and/or its +# SPDX-FileCopyrightText: Copyright 2021-2022, 2024-2025 Arm Limited and/or its # affiliates # SPDX-License-Identifier: Apache-2.0 @@ -13,7 +13,8 @@ if ARM_ETHOS_U menu "Arm Ethos-U NPU configuration" choice ARM_ETHOS_U_NPU_CONFIG prompt "Arm Ethos-U NPU configuration" - default ARM_ETHOS_U55_128 + default ARM_ETHOS_U55_128 if SOC_SERIES_MPS3 + default ARM_ETHOS_U85_256 if SOC_SERIES_MPS4 config ARM_ETHOS_U55_64 bool "using Ethos-U55 with 64 macs" config ARM_ETHOS_U55_128 diff --git a/modules/trusted-firmware-m/Kconfig.tfm b/modules/trusted-firmware-m/Kconfig.tfm index d1cf81f8f0ac..97591ac8a830 100644 --- a/modules/trusted-firmware-m/Kconfig.tfm +++ b/modules/trusted-firmware-m/Kconfig.tfm @@ -2,7 +2,7 @@ # Copyright (c) 2019, 2020 Linaro Limited # Copyright (c) 2020, 2021 Nordic Semiconductor ASA -# Copyright 2024 Arm Limited and/or its affiliates +# Copyright 2024-2025 Arm Limited and/or its affiliates # SPDX-License-Identifier: Apache-2.0 config ZEPHYR_TRUSTED_FIRMWARE_M_MODULE @@ -333,7 +333,7 @@ endchoice config TFM_ETHOS_DRIVER_PATH_LOCAL string "Path to a locally available Ethos-U driver or an empty string" - depends on SOC_SERIES_MPS3 + depends on SOC_SERIES_MPS3 || SOC_SERIES_MPS4 default "${ZEPHYR_HAL_ETHOS_U_MODULE_DIR}" help Path to a locally available Ethos-U driver to be used for TF-M builds or From d550fd27201c099371377c1dbfae9ee03b22171b Mon Sep 17 00:00:00 2001 From: Lucas Tamborrino Date: Tue, 8 Jul 2025 15:01:42 -0300 Subject: [PATCH 0778/2141] [nrf fromtree] samples: mbox: Add support for ESP32C6 Add mbox sample support for ESP32C6 HP and LP Core Signed-off-by: Lucas Tamborrino (cherry picked from commit 6379ef4a2cd72ed2aecd2386b1f7d14f0aa5b126) --- samples/drivers/mbox/CMakeLists.txt | 1 + samples/drivers/mbox/Kconfig.sysbuild | 1 + .../mbox/boards/esp32c6_devkitc_hpcore.conf | 1 + .../boards/esp32c6_devkitc_hpcore.overlay | 26 +++++++++++++++++++ samples/drivers/mbox/remote/CMakeLists.txt | 1 + .../boards/esp32c6_devkitc_lpcore.overlay | 26 +++++++++++++++++++ 6 files changed, 56 insertions(+) create mode 100644 samples/drivers/mbox/boards/esp32c6_devkitc_hpcore.conf create mode 100644 samples/drivers/mbox/boards/esp32c6_devkitc_hpcore.overlay create mode 100644 samples/drivers/mbox/remote/boards/esp32c6_devkitc_lpcore.overlay diff --git a/samples/drivers/mbox/CMakeLists.txt b/samples/drivers/mbox/CMakeLists.txt index e5d5e612c79d..dc03717d2ce5 100644 --- a/samples/drivers/mbox/CMakeLists.txt +++ b/samples/drivers/mbox/CMakeLists.txt @@ -23,6 +23,7 @@ if(CONFIG_BOARD_NRF5340DK_NRF5340_CPUAPP OR CONFIG_BOARD_MCX_N9XX_EVK_MCXN947_CPU0 OR CONFIG_BOARD_ESP32_DEVKITC_ESP32_PROCPU OR CONFIG_BOARD_ESP32S3_DEVKITM_ESP32S3_PROCPU OR + CONFIG_BOARD_ESP32C6_DEVKITC_ESP32C6_HPCORE OR CONFIG_BOARD_NRF54H20DK_NRF54H20_CPUAPP OR CONFIG_BOARD_NRF54L09PDK_NRF54L09_CPUAPP OR CONFIG_BOARD_NRF54L15DK_NRF54L15_CPUAPP OR diff --git a/samples/drivers/mbox/Kconfig.sysbuild b/samples/drivers/mbox/Kconfig.sysbuild index 2a79840f389b..e5408e9bd4de 100644 --- a/samples/drivers/mbox/Kconfig.sysbuild +++ b/samples/drivers/mbox/Kconfig.sysbuild @@ -25,5 +25,6 @@ config REMOTE_BOARD default "stm32h747i_disco/stm32h747xx/m4" if $(BOARD) = "stm32h747i_disco" default "esp32_devkitc/esp32/appcpu" if "$(BOARD)${BOARD_QUALIFIERS}" = "esp32_devkitc/esp32/procpu" default "esp32s3_devkitm/esp32s3/appcpu" if "$(BOARD)${BOARD_QUALIFIERS}" = "esp32s3_devkitm/esp32s3/procpu" + default "esp32c6_devkitc/esp32c6/lpcore" if "$(BOARD)${BOARD_QUALIFIERS}" = "esp32c6_devkitc/esp32c6/hpcore" default "bl54l15_dvk/nrf54l15/cpuflpr" if "$(BOARD)${BOARD_QUALIFIERS}" = "bl54l15_dvk/nrf54l15/cpuapp" default "bl54l15u_dvk/nrf54l15/cpuflpr" if $(BOARD) = "bl54l15u_dvk" diff --git a/samples/drivers/mbox/boards/esp32c6_devkitc_hpcore.conf b/samples/drivers/mbox/boards/esp32c6_devkitc_hpcore.conf new file mode 100644 index 000000000000..7d425a10aa2c --- /dev/null +++ b/samples/drivers/mbox/boards/esp32c6_devkitc_hpcore.conf @@ -0,0 +1 @@ +CONFIG_ULP_COPROC_ENABLED=y diff --git a/samples/drivers/mbox/boards/esp32c6_devkitc_hpcore.overlay b/samples/drivers/mbox/boards/esp32c6_devkitc_hpcore.overlay new file mode 100644 index 000000000000..a597cd0f12a7 --- /dev/null +++ b/samples/drivers/mbox/boards/esp32c6_devkitc_hpcore.overlay @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2025 Espressif Systems (Shanghai) Co., Ltd. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + chosen { + zephyr,ipc_shm = &shmlp; + zephyr,ipc = &mbox0; + }; + + mbox-consumer { + compatible = "vnd,mbox-consumer"; + mboxes = <&mbox0 0>, <&mbox0 1>; + mbox-names = "tx", "rx"; + }; +}; + +&mbox0 { + status = "okay"; +}; + +&lp_uart { + status = "okay"; +}; diff --git a/samples/drivers/mbox/remote/CMakeLists.txt b/samples/drivers/mbox/remote/CMakeLists.txt index bd4c9e2e20e5..a2c07a2dd2a8 100644 --- a/samples/drivers/mbox/remote/CMakeLists.txt +++ b/samples/drivers/mbox/remote/CMakeLists.txt @@ -21,6 +21,7 @@ if(CONFIG_BOARD_NRF5340DK_NRF5340_CPUNET OR CONFIG_BOARD_MCX_N9XX_EVK_MCXN947_CPU1 OR CONFIG_BOARD_ESP32_DEVKITC_ESP32_APPCPU OR CONFIG_BOARD_ESP32S3_DEVKITM_ESP32S3_APPCPU OR + CONFIG_BOARD_ESP32C6_DEVKITC_ESP32C6_LPCORE OR CONFIG_BOARD_NRF54H20DK_NRF54H20_CPUPPR OR CONFIG_BOARD_NRF54H20DK_NRF54H20_CPUFLPR OR CONFIG_BOARD_NRF54H20DK_NRF54H20_CPURAD OR diff --git a/samples/drivers/mbox/remote/boards/esp32c6_devkitc_lpcore.overlay b/samples/drivers/mbox/remote/boards/esp32c6_devkitc_lpcore.overlay new file mode 100644 index 000000000000..4717edbd985c --- /dev/null +++ b/samples/drivers/mbox/remote/boards/esp32c6_devkitc_lpcore.overlay @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2024 Felipe Neves. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + chosen { + zephyr,ipc_shm = &shmlp; + zephyr,ipc = &mbox0; + }; + + mbox-consumer { + compatible = "vnd,mbox-consumer"; + mboxes = <&mbox0 1>, <&mbox0 0>; + mbox-names = "tx", "rx"; + }; +}; + +&mbox0 { + status = "okay"; +}; + +&lp_uart { + status = "okay"; +}; From 32dce2ffd63fd3436794ef27b2fed2c5d1c1d9e5 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Tue, 12 Aug 2025 11:09:05 +0100 Subject: [PATCH 0779/2141] [nrf fromtree] kconfig: Use $(...) instead of ${...} for getting variables Updates this to comply with the Zephyr Kconfig recommendations Signed-off-by: Jamie McCrae (cherry picked from commit db8f991c773f7bfdc36df8864c7bb47f4a62eb45) --- Kconfig.zephyr | 4 ++-- boards/qemu/x86/Kconfig.defconfig | 2 +- doc/build/sysbuild/images.rst | 6 +++--- drivers/usb/uvb/Kconfig | 2 +- kernel/Kconfig | 2 +- lib/runtime/Kconfig | 2 +- modules/nrf_wifi/bus/Kconfig | 2 +- modules/trusted-firmware-m/Kconfig.tfm | 18 +++++++++--------- samples/drivers/mbox/Kconfig.sysbuild | 8 ++++---- samples/sysbuild/hello_world/Kconfig.sysbuild | 2 +- share/sysbuild/images/firmware_loader/Kconfig | 2 +- subsys/bluetooth/Kconfig.logging | 6 +++--- subsys/testsuite/Kconfig | 2 +- tests/boards/nrf/nrfs/Kconfig.sysbuild | 2 +- .../audio_samples/bap_broadcast_sink/Kconfig | 2 +- .../bap_broadcast_sink/Kconfig.sysbuild | 2 +- .../bap_unicast_client/Kconfig.sysbuild | 2 +- .../audio_samples/cap/acceptor/Kconfig | 2 +- .../cap/acceptor/Kconfig.sysbuild | 2 +- .../audio_samples/cap/initiator/Kconfig | 2 +- .../cap/initiator/Kconfig.sysbuild | 2 +- .../ccp/call_control_client/Kconfig.sysbuild | 2 +- .../ccp/call_control_server/Kconfig.sysbuild | 2 +- .../samples/central_hr_peripheral_hr/Kconfig | 2 +- .../central_hr_peripheral_hr/Kconfig.sysbuild | 2 +- tests/bsim/net/sockets/echo_test/Kconfig | 2 +- tests/cmake/sysbuild_snippets/Kconfig.sysbuild | 2 +- tests/subsys/ipc/ipc_sessions/Kconfig.sysbuild | 2 +- 28 files changed, 44 insertions(+), 44 deletions(-) diff --git a/Kconfig.zephyr b/Kconfig.zephyr index 4993e56c8b24..994730d19332 100644 --- a/Kconfig.zephyr +++ b/Kconfig.zephyr @@ -7,7 +7,7 @@ source "Kconfig.constants" -osource "${APPLICATION_SOURCE_DIR}/VERSION" +osource "$(APPLICATION_SOURCE_DIR)/VERSION" # Include Kconfig.defconfig files first so that they can override defaults and # other symbol/choice properties by adding extra symbol/choice definitions. @@ -967,7 +967,7 @@ config BUILD_OUTPUT_STRIP_PATHS bool "Strip absolute paths from binaries" default y help - If the compiler supports it, strip the ${ZEPHYR_BASE} prefix from the + If the compiler supports it, strip the $(ZEPHYR_BASE) prefix from the __FILE__ macro used in __ASSERT*, in the .noinit."/home/joe/zephyr/fu/bar.c" section names and in any application code. diff --git a/boards/qemu/x86/Kconfig.defconfig b/boards/qemu/x86/Kconfig.defconfig index 5afe94d68e5d..5a039094f833 100644 --- a/boards/qemu/x86/Kconfig.defconfig +++ b/boards/qemu/x86/Kconfig.defconfig @@ -100,7 +100,7 @@ config HAVE_CUSTOM_LINKER_SCRIPT default y config CUSTOM_LINKER_SCRIPT - default "${ZEPHYR_BASE}/boards/qemu/x86/qemu_x86_tiny.ld" + default "$(ZEPHYR_BASE)/boards/qemu/x86/qemu_x86_tiny.ld" config X86_EXTRA_PAGE_TABLE_PAGES # This is needed for gen_mmu.py to map the flash into memory diff --git a/doc/build/sysbuild/images.rst b/doc/build/sysbuild/images.rst index 3ccfd873e16b..00075894cefc 100644 --- a/doc/build/sysbuild/images.rst +++ b/doc/build/sysbuild/images.rst @@ -151,13 +151,13 @@ more complex to create but is the preferred method for adding images to upstream config OTHER_APP_IMAGE_PATH string - default "${ZEPHYR_MY_IMAGE_MODULE_DIR}/path/to/my_image" if OTHER_APP_IMAGE_MY_IMAGE + default "$(ZEPHYR_MY_IMAGE_MODULE_DIR)/path/to/my_image" if OTHER_APP_IMAGE_MY_IMAGE help Source directory of other app image. .. note:: - Remember to have ``source "${ZEPHYR_BASE}/share/sysbuild/Kconfig"`` in the file if this + Remember to have ``source "$(ZEPHYR_BASE)/share/sysbuild/Kconfig"`` in the file if this is being applied in an application ``Kconfig.sysbuild`` file. .. group-tab:: ``sysbuild.cmake`` @@ -212,7 +212,7 @@ This can then be extended by :ref:`modules` like so: default "my_second_image" if OTHER_APP_IMAGE_MY_SECOND_IMAGE config OTHER_APP_IMAGE_PATH - default "${ZEPHYR_MY_SECOND_IMAGE_MODULE_DIR}/path/to/my_second_image" if OTHER_APP_IMAGE_MY_SECOND_IMAGE + default "$(ZEPHYR_MY_SECOND_IMAGE_MODULE_DIR)/path/to/my_second_image" if OTHER_APP_IMAGE_MY_SECOND_IMAGE As can be seen, no additional CMake changes are needed to add an alternative image as the base CMake code will add the replacement image instead of the original image, if selected. diff --git a/drivers/usb/uvb/Kconfig b/drivers/usb/uvb/Kconfig index 77e893cff505..039296dd3ba7 100644 --- a/drivers/usb/uvb/Kconfig +++ b/drivers/usb/uvb/Kconfig @@ -22,6 +22,6 @@ config UVB_MAX_MESSAGES module = UVB module-str = USB virtual bus service -source "${ZEPHYR_BASE}/subsys/logging/Kconfig.template.log_config" +source "$(ZEPHYR_BASE)/subsys/logging/Kconfig.template.log_config" endif # UVB diff --git a/kernel/Kconfig b/kernel/Kconfig index c2976b9f281f..9afeeaa5e67c 100644 --- a/kernel/Kconfig +++ b/kernel/Kconfig @@ -942,7 +942,7 @@ config STACK_CANARIES_ALL config STACK_CANARIES_EXPLICIT bool "Explicit protection" depends on ENTROPY_GENERATOR || TEST_RANDOM_GENERATOR - depends on "${ZEPHYR_TOOLCHAIN_VARIANT}" = "zephyr" + depends on "$(ZEPHYR_TOOLCHAIN_VARIANT)" = "zephyr" select NEED_LIBC_MEM_PARTITION if !STACK_CANARIES_TLS select REQUIRES_STACK_CANARIES help diff --git a/lib/runtime/Kconfig b/lib/runtime/Kconfig index afb78f5b82b8..9be8ac5b7aea 100644 --- a/lib/runtime/Kconfig +++ b/lib/runtime/Kconfig @@ -4,7 +4,7 @@ config COMPILER_RT_SUPPORTED bool default y - depends on "${ZEPHYR_TOOLCHAIN_VARIANT}" = "llvm" + depends on "$(ZEPHYR_TOOLCHAIN_VARIANT)" = "llvm" help Selected when the compiler supports compiler-rt runtime library. diff --git a/modules/nrf_wifi/bus/Kconfig b/modules/nrf_wifi/bus/Kconfig index 3fed449bb809..430cf3ba9ffd 100644 --- a/modules/nrf_wifi/bus/Kconfig +++ b/modules/nrf_wifi/bus/Kconfig @@ -43,7 +43,7 @@ config NRF71_ON_IPC module = WIFI_NRF70_BUSLIB module-dep = LOG module-str = Log level for Wi-Fi nRF70 bus library -source "${ZEPHYR_BASE}/subsys/logging/Kconfig.template.log_config" +source "$(ZEPHYR_BASE)/subsys/logging/Kconfig.template.log_config" config WIFI_NRF70_BUSLIB_LOG_LEVEL # Enable error by default diff --git a/modules/trusted-firmware-m/Kconfig.tfm b/modules/trusted-firmware-m/Kconfig.tfm index 97591ac8a830..55e08ee45e4a 100644 --- a/modules/trusted-firmware-m/Kconfig.tfm +++ b/modules/trusted-firmware-m/Kconfig.tfm @@ -23,11 +23,11 @@ config TFM_BOARD default "arm/musca_b1" if BOARD_V2M_MUSCA_B1 default "arm/musca_s1" if BOARD_V2M_MUSCA_S1 default "adi/max32657" if BOARD_MAX32657EVKIT_MAX32657_NS - default "${ZEPHYR_BASE}/modules/trusted-firmware-m/nordic/nrf9160" if SOC_NRF9160 - default "${ZEPHYR_BASE}/modules/trusted-firmware-m/nordic/nrf9120" if SOC_NRF9120 - default "${ZEPHYR_BASE}/modules/trusted-firmware-m/nordic/nrf5340_cpuapp" if SOC_NRF5340_CPUAPP - default "${ZEPHYR_BASE}/modules/trusted-firmware-m/nordic/nrf54l15_cpuapp" if SOC_NRF54L15_CPUAPP - default "${ZEPHYR_BASE}/modules/trusted-firmware-m/nordic/nrf54l10_cpuapp" if SOC_NRF54L10_CPUAPP + default "$(ZEPHYR_BASE)/modules/trusted-firmware-m/nordic/nrf9160" if SOC_NRF9160 + default "$(ZEPHYR_BASE)/modules/trusted-firmware-m/nordic/nrf9120" if SOC_NRF9120 + default "$(ZEPHYR_BASE)/modules/trusted-firmware-m/nordic/nrf5340_cpuapp" if SOC_NRF5340_CPUAPP + default "$(ZEPHYR_BASE)/modules/trusted-firmware-m/nordic/nrf54l15_cpuapp" if SOC_NRF54L15_CPUAPP + default "$(ZEPHYR_BASE)/modules/trusted-firmware-m/nordic/nrf54l10_cpuapp" if SOC_NRF54L10_CPUAPP help The board name used for building TFM. Building with TFM requires that TFM has been ported to the given board/SoC. @@ -256,7 +256,7 @@ config TFM_BL2_SIGNING_KEY_PATH string "Path to private key used to sign BL2 firmware images." help Path to binary BL2 signing private key - Default is ${ZEPHYR_TRUSTED_FIRMWARE_M_MODULE_DIR}/bl1/bl1_2/bl1_dummy_rotpk + Default is $(ZEPHYR_TRUSTED_FIRMWARE_M_MODULE_DIR)/bl1/bl1_2/bl1_dummy_rotpk if it has not been changed on TF-M side for your board endif # TFM_BL1 @@ -281,7 +281,7 @@ config TFM_MCUBOOT_SIGNATURE_TYPE config TFM_KEY_FILE_S string "Path to private key used to sign secure firmware images." - default "${ZEPHYR_TRUSTED_FIRMWARE_M_MODULE_DIR}/bl2/ext/mcuboot/root-${CONFIG_TFM_MCUBOOT_SIGNATURE_TYPE}.pem" + default "$(ZEPHYR_TRUSTED_FIRMWARE_M_MODULE_DIR)/bl2/ext/mcuboot/root-${CONFIG_TFM_MCUBOOT_SIGNATURE_TYPE}.pem" help The path and filename for the .pem file containing the private key that should be used by the BL2 bootloader when signing secure @@ -290,7 +290,7 @@ config TFM_KEY_FILE_S config TFM_KEY_FILE_NS string "Path to private key used to sign non-secure firmware images." - default "${ZEPHYR_TRUSTED_FIRMWARE_M_MODULE_DIR}/bl2/ext/mcuboot/root-${CONFIG_TFM_MCUBOOT_SIGNATURE_TYPE}_1.pem" + default "$(ZEPHYR_TRUSTED_FIRMWARE_M_MODULE_DIR)/bl2/ext/mcuboot/root-${CONFIG_TFM_MCUBOOT_SIGNATURE_TYPE}_1.pem" help The path and filename for the .pem file containing the private key that should be used by the BL2 bootloader when signing non-secure @@ -334,7 +334,7 @@ endchoice config TFM_ETHOS_DRIVER_PATH_LOCAL string "Path to a locally available Ethos-U driver or an empty string" depends on SOC_SERIES_MPS3 || SOC_SERIES_MPS4 - default "${ZEPHYR_HAL_ETHOS_U_MODULE_DIR}" + default "$(ZEPHYR_HAL_ETHOS_U_MODULE_DIR)" help Path to a locally available Ethos-U driver to be used for TF-M builds or an empty string to allow TF-M to automatically fetch the Ethos-U diff --git a/samples/drivers/mbox/Kconfig.sysbuild b/samples/drivers/mbox/Kconfig.sysbuild index e5408e9bd4de..5cffe27038fb 100644 --- a/samples/drivers/mbox/Kconfig.sysbuild +++ b/samples/drivers/mbox/Kconfig.sysbuild @@ -23,8 +23,8 @@ config REMOTE_BOARD default "nrf54lm20dk/nrf54lm20a/cpuflpr" if $(BOARD) = "nrf54lm20dk" default "ophelia4ev/cpuflpr" if $(BOARD) = "ophelia4ev" default "stm32h747i_disco/stm32h747xx/m4" if $(BOARD) = "stm32h747i_disco" - default "esp32_devkitc/esp32/appcpu" if "$(BOARD)${BOARD_QUALIFIERS}" = "esp32_devkitc/esp32/procpu" - default "esp32s3_devkitm/esp32s3/appcpu" if "$(BOARD)${BOARD_QUALIFIERS}" = "esp32s3_devkitm/esp32s3/procpu" - default "esp32c6_devkitc/esp32c6/lpcore" if "$(BOARD)${BOARD_QUALIFIERS}" = "esp32c6_devkitc/esp32c6/hpcore" - default "bl54l15_dvk/nrf54l15/cpuflpr" if "$(BOARD)${BOARD_QUALIFIERS}" = "bl54l15_dvk/nrf54l15/cpuapp" + default "esp32_devkitc/esp32/appcpu" if "$(BOARD)$(BOARD_QUALIFIERS)" = "esp32_devkitc/esp32/procpu" + default "esp32s3_devkitm/esp32s3/appcpu" if "$(BOARD)$(BOARD_QUALIFIERS)" = "esp32s3_devkitm/esp32s3/procpu" + default "esp32c6_devkitc/esp32c6/lpcore" if "$(BOARD)$(BOARD_QUALIFIERS)" = "esp32c6_devkitc/esp32c6/hpcore" + default "bl54l15_dvk/nrf54l15/cpuflpr" if "$(BOARD)$(BOARD_QUALIFIERS)" = "bl54l15_dvk/nrf54l15/cpuapp" default "bl54l15u_dvk/nrf54l15/cpuflpr" if $(BOARD) = "bl54l15u_dvk" diff --git a/samples/sysbuild/hello_world/Kconfig.sysbuild b/samples/sysbuild/hello_world/Kconfig.sysbuild index edec01b94c98..53ed4507b760 100644 --- a/samples/sysbuild/hello_world/Kconfig.sysbuild +++ b/samples/sysbuild/hello_world/Kconfig.sysbuild @@ -1,7 +1,7 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" +source "$(ZEPHYR_BASE)/share/sysbuild/Kconfig" config REMOTE_BOARD string "The board used for remote target" diff --git a/share/sysbuild/images/firmware_loader/Kconfig b/share/sysbuild/images/firmware_loader/Kconfig index a5c4283ad5c6..2ff27251b929 100644 --- a/share/sysbuild/images/firmware_loader/Kconfig +++ b/share/sysbuild/images/firmware_loader/Kconfig @@ -32,6 +32,6 @@ config FIRMWARE_LOADER_IMAGE_NAME config FIRMWARE_LOADER_IMAGE_PATH string - default "${ZEPHYR_BASE}/samples/subsys/mgmt/mcumgr/smp_svr" if FIRMWARE_LOADER_IMAGE_SMP_SVR + default "$(ZEPHYR_BASE)/samples/subsys/mgmt/mcumgr/smp_svr" if FIRMWARE_LOADER_IMAGE_SMP_SVR help Source directory of firmware loader image. diff --git a/subsys/bluetooth/Kconfig.logging b/subsys/bluetooth/Kconfig.logging index 7ccaf55c2d6b..850fb9872302 100644 --- a/subsys/bluetooth/Kconfig.logging +++ b/subsys/bluetooth/Kconfig.logging @@ -358,7 +358,7 @@ endif # BT_VOCS_CLIENT if BT_PBP module = BT_PBP module-str = "Public Broadcast Profile" -source "${ZEPHYR_BASE}/subsys/logging/Kconfig.template.log_config" +source "$(ZEPHYR_BASE)/subsys/logging/Kconfig.template.log_config" endif # BT_PBP endmenu # Audio @@ -539,7 +539,7 @@ endif # BT_IAS_CLIENT if BT_IAS module = BT_IAS module-str = IAS -source "${ZEPHYR_BASE}/subsys/logging/Kconfig.template.log_config" +source "$(ZEPHYR_BASE)/subsys/logging/Kconfig.template.log_config" endif # BT_IAS # OTS (subsys/bluetooth/services/ots/Kconfig) @@ -553,7 +553,7 @@ endif # BT_OTS_CLIENT if BT_OTS module = BT_OTS module-str = BT_OTS -source "${ZEPHYR_BASE}/subsys/logging/Kconfig.template.log_config" +source "$(ZEPHYR_BASE)/subsys/logging/Kconfig.template.log_config" endif # BT_OTS endmenu # Services diff --git a/subsys/testsuite/Kconfig b/subsys/testsuite/Kconfig index dd1aff5b6251..9e72a5696fdb 100644 --- a/subsys/testsuite/Kconfig +++ b/subsys/testsuite/Kconfig @@ -56,7 +56,7 @@ config COVERAGE_NATIVE_GCOV config COVERAGE_NATIVE_SOURCE bool "Host compiler source based code coverage" depends on NATIVE_BUILD - depends on "${ZEPHYR_TOOLCHAIN_VARIANT}" = "llvm" + depends on "$(ZEPHYR_TOOLCHAIN_VARIANT)" = "llvm" help Build natively with the compiler source based coverage options. Today this is only supported with LLVM diff --git a/tests/boards/nrf/nrfs/Kconfig.sysbuild b/tests/boards/nrf/nrfs/Kconfig.sysbuild index 6cc7dc9575af..6c4c8618f3ed 100644 --- a/tests/boards/nrf/nrfs/Kconfig.sysbuild +++ b/tests/boards/nrf/nrfs/Kconfig.sysbuild @@ -1,7 +1,7 @@ # Copyright (c) 2025 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" +source "$(ZEPHYR_BASE)/share/sysbuild/Kconfig" config REMOTE_BOARD string diff --git a/tests/bsim/bluetooth/audio_samples/bap_broadcast_sink/Kconfig b/tests/bsim/bluetooth/audio_samples/bap_broadcast_sink/Kconfig index 040286af18c7..2b474ba2a4ca 100644 --- a/tests/bsim/bluetooth/audio_samples/bap_broadcast_sink/Kconfig +++ b/tests/bsim/bluetooth/audio_samples/bap_broadcast_sink/Kconfig @@ -1,4 +1,4 @@ # Copyright (c) 2023 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -source "${ZEPHYR_BASE}/samples/bluetooth/bap_broadcast_sink/Kconfig" +source "$(ZEPHYR_BASE)/samples/bluetooth/bap_broadcast_sink/Kconfig" diff --git a/tests/bsim/bluetooth/audio_samples/bap_broadcast_sink/Kconfig.sysbuild b/tests/bsim/bluetooth/audio_samples/bap_broadcast_sink/Kconfig.sysbuild index b6f4d0678e8b..5f0b50c75635 100644 --- a/tests/bsim/bluetooth/audio_samples/bap_broadcast_sink/Kconfig.sysbuild +++ b/tests/bsim/bluetooth/audio_samples/bap_broadcast_sink/Kconfig.sysbuild @@ -1,7 +1,7 @@ # Copyright (c) 2023 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -source "${ZEPHYR_BASE}/samples/bluetooth/bap_broadcast_sink/Kconfig.sysbuild" +source "$(ZEPHYR_BASE)/samples/bluetooth/bap_broadcast_sink/Kconfig.sysbuild" config NATIVE_SIMULATOR_PRIMARY_MCU_INDEX int diff --git a/tests/bsim/bluetooth/audio_samples/bap_unicast_client/Kconfig.sysbuild b/tests/bsim/bluetooth/audio_samples/bap_unicast_client/Kconfig.sysbuild index 6db98670507d..54467d2a2d2e 100644 --- a/tests/bsim/bluetooth/audio_samples/bap_unicast_client/Kconfig.sysbuild +++ b/tests/bsim/bluetooth/audio_samples/bap_unicast_client/Kconfig.sysbuild @@ -1,7 +1,7 @@ # Copyright (c) 2023 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -source "${ZEPHYR_BASE}/samples/bluetooth/bap_unicast_client/Kconfig.sysbuild" +source "$(ZEPHYR_BASE)/samples/bluetooth/bap_unicast_client/Kconfig.sysbuild" config NATIVE_SIMULATOR_PRIMARY_MCU_INDEX int diff --git a/tests/bsim/bluetooth/audio_samples/cap/acceptor/Kconfig b/tests/bsim/bluetooth/audio_samples/cap/acceptor/Kconfig index 8a2dcf8e5ae0..7c94a0933055 100644 --- a/tests/bsim/bluetooth/audio_samples/cap/acceptor/Kconfig +++ b/tests/bsim/bluetooth/audio_samples/cap/acceptor/Kconfig @@ -1,4 +1,4 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -source "${ZEPHYR_BASE}/samples/bluetooth/cap_acceptor/Kconfig" +source "$(ZEPHYR_BASE)/samples/bluetooth/cap_acceptor/Kconfig" diff --git a/tests/bsim/bluetooth/audio_samples/cap/acceptor/Kconfig.sysbuild b/tests/bsim/bluetooth/audio_samples/cap/acceptor/Kconfig.sysbuild index 3b2c35e65c55..a73e90e42883 100644 --- a/tests/bsim/bluetooth/audio_samples/cap/acceptor/Kconfig.sysbuild +++ b/tests/bsim/bluetooth/audio_samples/cap/acceptor/Kconfig.sysbuild @@ -1,7 +1,7 @@ # Copyright (c) 2023-2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -source "${ZEPHYR_BASE}/samples/bluetooth/cap_acceptor/Kconfig.sysbuild" +source "$(ZEPHYR_BASE)/samples/bluetooth/cap_acceptor/Kconfig.sysbuild" config NATIVE_SIMULATOR_PRIMARY_MCU_INDEX int diff --git a/tests/bsim/bluetooth/audio_samples/cap/initiator/Kconfig b/tests/bsim/bluetooth/audio_samples/cap/initiator/Kconfig index 7027c92b5900..b21d8aad4906 100644 --- a/tests/bsim/bluetooth/audio_samples/cap/initiator/Kconfig +++ b/tests/bsim/bluetooth/audio_samples/cap/initiator/Kconfig @@ -1,4 +1,4 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -source "${ZEPHYR_BASE}/samples/bluetooth/cap_initiator/Kconfig" +source "$(ZEPHYR_BASE)/samples/bluetooth/cap_initiator/Kconfig" diff --git a/tests/bsim/bluetooth/audio_samples/cap/initiator/Kconfig.sysbuild b/tests/bsim/bluetooth/audio_samples/cap/initiator/Kconfig.sysbuild index c9f3abf294f8..fb7ee3a61da4 100644 --- a/tests/bsim/bluetooth/audio_samples/cap/initiator/Kconfig.sysbuild +++ b/tests/bsim/bluetooth/audio_samples/cap/initiator/Kconfig.sysbuild @@ -1,7 +1,7 @@ # Copyright (c) 2023-2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -source "${ZEPHYR_BASE}/samples/bluetooth/cap_initiator/Kconfig.sysbuild" +source "$(ZEPHYR_BASE)/samples/bluetooth/cap_initiator/Kconfig.sysbuild" config NATIVE_SIMULATOR_PRIMARY_MCU_INDEX int diff --git a/tests/bsim/bluetooth/audio_samples/ccp/call_control_client/Kconfig.sysbuild b/tests/bsim/bluetooth/audio_samples/ccp/call_control_client/Kconfig.sysbuild index 2fdcdcf687c6..fa711c8f6d32 100644 --- a/tests/bsim/bluetooth/audio_samples/ccp/call_control_client/Kconfig.sysbuild +++ b/tests/bsim/bluetooth/audio_samples/ccp/call_control_client/Kconfig.sysbuild @@ -1,7 +1,7 @@ # Copyright (c) 2023-2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -source "${ZEPHYR_BASE}/samples/bluetooth/ccp_call_control_client/Kconfig.sysbuild" +source "$(ZEPHYR_BASE)/samples/bluetooth/ccp_call_control_client/Kconfig.sysbuild" config NATIVE_SIMULATOR_PRIMARY_MCU_INDEX int diff --git a/tests/bsim/bluetooth/audio_samples/ccp/call_control_server/Kconfig.sysbuild b/tests/bsim/bluetooth/audio_samples/ccp/call_control_server/Kconfig.sysbuild index f2b0bb8c607e..8fe269f15e14 100644 --- a/tests/bsim/bluetooth/audio_samples/ccp/call_control_server/Kconfig.sysbuild +++ b/tests/bsim/bluetooth/audio_samples/ccp/call_control_server/Kconfig.sysbuild @@ -1,7 +1,7 @@ # Copyright (c) 2023-2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -source "${ZEPHYR_BASE}/samples/bluetooth/ccp_call_control_server/Kconfig.sysbuild" +source "$(ZEPHYR_BASE)/samples/bluetooth/ccp_call_control_server/Kconfig.sysbuild" config NATIVE_SIMULATOR_PRIMARY_MCU_INDEX int diff --git a/tests/bsim/bluetooth/samples/central_hr_peripheral_hr/Kconfig b/tests/bsim/bluetooth/samples/central_hr_peripheral_hr/Kconfig index e2cbc2de9177..196e362034e0 100644 --- a/tests/bsim/bluetooth/samples/central_hr_peripheral_hr/Kconfig +++ b/tests/bsim/bluetooth/samples/central_hr_peripheral_hr/Kconfig @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 # source sample's Kconfig, if any -# source "${ZEPHYR_BASE}/samples/bluetooth/central_hr/Kconfig" +# source "$(ZEPHYR_BASE)/samples/bluetooth/central_hr/Kconfig" # OR # source Zephyr Kernel's Kconfig, as below (not both) menu "Zephyr Kernel" diff --git a/tests/bsim/bluetooth/samples/central_hr_peripheral_hr/Kconfig.sysbuild b/tests/bsim/bluetooth/samples/central_hr_peripheral_hr/Kconfig.sysbuild index 8a4e25038c49..c0dcdf6e24e0 100644 --- a/tests/bsim/bluetooth/samples/central_hr_peripheral_hr/Kconfig.sysbuild +++ b/tests/bsim/bluetooth/samples/central_hr_peripheral_hr/Kconfig.sysbuild @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 # source the samples' Kconfig.sysbuild, if any -source "${ZEPHYR_BASE}/samples/bluetooth/central_hr/Kconfig.sysbuild" +source "$(ZEPHYR_BASE)/samples/bluetooth/central_hr/Kconfig.sysbuild" config NATIVE_SIMULATOR_PRIMARY_MCU_INDEX int diff --git a/tests/bsim/net/sockets/echo_test/Kconfig b/tests/bsim/net/sockets/echo_test/Kconfig index 7c48b4fca91d..2a5bde5e9d0c 100644 --- a/tests/bsim/net/sockets/echo_test/Kconfig +++ b/tests/bsim/net/sockets/echo_test/Kconfig @@ -1,4 +1,4 @@ # Copyright (c) 2023 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -source "${ZEPHYR_BASE}/samples/net/sockets/echo_client/Kconfig" +source "$(ZEPHYR_BASE)/samples/net/sockets/echo_client/Kconfig" diff --git a/tests/cmake/sysbuild_snippets/Kconfig.sysbuild b/tests/cmake/sysbuild_snippets/Kconfig.sysbuild index e36914325117..bf3fb5fc4b35 100644 --- a/tests/cmake/sysbuild_snippets/Kconfig.sysbuild +++ b/tests/cmake/sysbuild_snippets/Kconfig.sysbuild @@ -19,4 +19,4 @@ config EXPECTED_APP_TEST_FOO_VAL help Expected application value for the test. -source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" +source "$(ZEPHYR_BASE)/share/sysbuild/Kconfig" diff --git a/tests/subsys/ipc/ipc_sessions/Kconfig.sysbuild b/tests/subsys/ipc/ipc_sessions/Kconfig.sysbuild index 3c064f59d525..ad83e2107b6c 100644 --- a/tests/subsys/ipc/ipc_sessions/Kconfig.sysbuild +++ b/tests/subsys/ipc/ipc_sessions/Kconfig.sysbuild @@ -4,7 +4,7 @@ # SPDX-License-Identifier: Apache-2.0 # -source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" +source "$(ZEPHYR_BASE)/share/sysbuild/Kconfig" config REMOTE_BOARD string "The board used for remote target" From 0e3da0add10c30ded8d05a9084d0721ccffe53dc Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Wed, 27 Aug 2025 09:01:03 +0100 Subject: [PATCH 0780/2141] [nrf fromtree] scripts/kconfig/cmake: Generate/use env file for zephyr module paths Adds a output env file that lists the paths of zephyr modules which can be used in Kconfig files and uses this in Kconfig. Also updates Kconfig doc output to generate and use this Signed-off-by: Jamie McCrae (cherry picked from commit 4977c5cef959edf0c6481184e6356b4e38ff80c2) --- Kconfig.zephyr | 1 + cmake/modules/kconfig.cmake | 1 + doc/_extensions/zephyr/kconfig/__init__.py | 7 ++++ scripts/ci/check_compliance.py | 16 +++++++--- scripts/zephyr_module.py | 37 +++++++++++++++------- share/sysbuild/Kconfig | 2 ++ 6 files changed, 48 insertions(+), 16 deletions(-) diff --git a/Kconfig.zephyr b/Kconfig.zephyr index 994730d19332..ace2652550d3 100644 --- a/Kconfig.zephyr +++ b/Kconfig.zephyr @@ -6,6 +6,7 @@ # SPDX-License-Identifier: Apache-2.0 source "Kconfig.constants" +source "$(KCONFIG_ENV_FILE)" osource "$(APPLICATION_SOURCE_DIR)/VERSION" diff --git a/cmake/modules/kconfig.cmake b/cmake/modules/kconfig.cmake index ac5f1b83e4c3..1e2cf75f54b2 100644 --- a/cmake/modules/kconfig.cmake +++ b/cmake/modules/kconfig.cmake @@ -134,6 +134,7 @@ zephyr_get(APP_DIR VAR APP_DIR APPLICATION_SOURCE_DIR) set(COMMON_KCONFIG_ENV_SETTINGS PYTHON_EXECUTABLE=${PYTHON_EXECUTABLE} + KCONFIG_ENV_FILE=${KCONFIG_BINARY_DIR}/kconfig_module_dirs.env srctree=${ZEPHYR_BASE} KERNELVERSION=${KERNELVERSION} APPVERSION=${APP_VERSION_STRING} diff --git a/doc/_extensions/zephyr/kconfig/__init__.py b/doc/_extensions/zephyr/kconfig/__init__.py index dfb7a567da83..a76ac87f887b 100644 --- a/doc/_extensions/zephyr/kconfig/__init__.py +++ b/doc/_extensions/zephyr/kconfig/__init__.py @@ -76,12 +76,18 @@ def kconfig_load(app: Sphinx) -> tuple[kconfiglib.Kconfig, kconfiglib.Kconfig, d modules = zephyr_module.parse_modules(ZEPHYR_BASE) # generate Kconfig.modules file + kconfig_module_dirs = "" kconfig = "" sysbuild_kconfig = "" for module in modules: + kconfig_module_dirs += zephyr_module.process_kconfig_module_dir(module.project, + module.meta) kconfig += zephyr_module.process_kconfig(module.project, module.meta) sysbuild_kconfig += zephyr_module.process_sysbuildkconfig(module.project, module.meta) + with open(Path(td) / "kconfig_module_dirs.env", "w") as f: + f.write(kconfig_module_dirs) + with open(Path(td) / "Kconfig.modules", "w") as f: f.write(kconfig) @@ -152,6 +158,7 @@ def kconfig_load(app: Sphinx) -> tuple[kconfiglib.Kconfig, kconfiglib.Kconfig, d os.environ["BOARD"] = "boards" os.environ["KCONFIG_BOARD_DIR"] = str(Path(td) / "boards") + os.environ["KCONFIG_ENV_FILE"] = str(Path(td) / "kconfig_module_dirs.env") # Sysbuild runs first os.environ["CONFIG_"] = "SB_CONFIG_" diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index 5958fa52a7d5..d5f13ee84fce 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -515,7 +515,7 @@ def run(self): self.check_no_undef_outside_kconfig(kconf) self.check_disallowed_defconfigs(kconf) - def get_modules(self, modules_file, sysbuild_modules_file, settings_file): + def get_modules(self, _module_dirs_file, modules_file, sysbuild_modules_file, settings_file): """ Get a list of modules and put them in a file that is parsed by Kconfig @@ -730,13 +730,15 @@ def parse_kconfig(self): os.environ["KCONFIG_BINARY_DIR"] = kconfiglib_dir os.environ['DEVICETREE_CONF'] = "dummy" os.environ['TOOLCHAIN_HAS_NEWLIB'] = "y" + os.environ['KCONFIG_ENV_FILE'] = os.path.join(kconfiglib_dir, "kconfig_module_dirs.env") # Older name for DEVICETREE_CONF, for compatibility with older Zephyr # versions that don't have the renaming os.environ["GENERATED_DTS_BOARD_CONF"] = "dummy" # For multi repo support - self.get_modules(os.path.join(kconfiglib_dir, "Kconfig.modules"), + self.get_modules(os.environ['KCONFIG_ENV_FILE'], + os.path.join(kconfiglib_dir, "Kconfig.modules"), os.path.join(kconfiglib_dir, "Kconfig.sysbuild.modules"), os.path.join(kconfiglib_dir, "settings_file.txt")) # For Kconfig.dts support @@ -1321,13 +1323,17 @@ class KconfigBasicNoModulesCheck(KconfigBasicCheck): """ name = "KconfigBasicNoModules" path_hint = "" + EMPTY_FILE_CONTENTS = "# Empty\n" + + def get_modules(self, module_dirs_file, modules_file, sysbuild_modules_file, settings_file): + with open(module_dirs_file, 'w') as fp_module_file: + fp_module_file.write(self.EMPTY_FILE_CONTENTS) - def get_modules(self, modules_file, sysbuild_modules_file, settings_file): with open(modules_file, 'w') as fp_module_file: - fp_module_file.write("# Empty\n") + fp_module_file.write(self.EMPTY_FILE_CONTENTS) with open(sysbuild_modules_file, 'w') as fp_module_file: - fp_module_file.write("# Empty\n") + fp_module_file.write(self.EMPTY_FILE_CONTENTS) class KconfigHWMv2Check(KconfigBasicCheck): diff --git a/scripts/zephyr_module.py b/scripts/zephyr_module.py index aeda845639e0..8bf2d00793d7 100755 --- a/scripts/zephyr_module.py +++ b/scripts/zephyr_module.py @@ -386,6 +386,12 @@ def kconfig_snippet(meta, path, kconfig_file=None, blobs=False, taint_blobs=Fals return '\n'.join(snippet) +def process_kconfig_module_dir(module, meta): + module_path = PurePath(module) + name_sanitized = meta['name-sanitized'] + return f'ZEPHYR_{name_sanitized.upper()}_MODULE_DIR={module_path.as_posix()}\n' + + def process_kconfig(module, meta): blobs = process_blobs(module, meta) taint_blobs = any(b['status'] != BLOB_NOT_PRESENT for b in blobs) @@ -393,11 +399,9 @@ def process_kconfig(module, meta): module_path = PurePath(module) module_yml = module_path.joinpath('zephyr/module.yml') kconfig_extern = section.get('kconfig-ext', False) - name_sanitized = meta['name-sanitized'] - snippet = f'ZEPHYR_{name_sanitized.upper()}_MODULE_DIR := {module_path.as_posix()}\n' if kconfig_extern: - return snippet + kconfig_snippet(meta, module_path, blobs=blobs, taint_blobs=taint_blobs) + return kconfig_snippet(meta, module_path, blobs=blobs, taint_blobs=taint_blobs) kconfig_setting = section.get('kconfig', None) if not validate_setting(kconfig_setting, module): @@ -407,10 +411,11 @@ def process_kconfig(module, meta): kconfig_file = os.path.join(module, kconfig_setting or 'zephyr/Kconfig') if os.path.isfile(kconfig_file): - return snippet + kconfig_snippet(meta, module_path, Path(kconfig_file), - blobs=blobs, taint_blobs=taint_blobs) + return kconfig_snippet(meta, module_path, Path(kconfig_file), + blobs=blobs, taint_blobs=taint_blobs) else: - return snippet + '\n'.join(kconfig_module_opts(name_sanitized, blobs, taint_blobs)) + '\n' + name_sanitized = meta['name-sanitized'] + return '\n'.join(kconfig_module_opts(name_sanitized, blobs, taint_blobs)) + '\n' def process_sysbuildkconfig(module, meta): @@ -419,10 +424,9 @@ def process_sysbuildkconfig(module, meta): module_yml = module_path.joinpath('zephyr/module.yml') kconfig_extern = section.get('sysbuild-kconfig-ext', False) name_sanitized = meta['name-sanitized'] - snippet = f'ZEPHYR_{name_sanitized.upper()}_MODULE_DIR := {module_path.as_posix()}\n' if kconfig_extern: - return snippet + kconfig_snippet(meta, module_path, sysbuild=True) + return kconfig_snippet(meta, module_path, sysbuild=True) kconfig_setting = section.get('sysbuild-kconfig', None) if not validate_setting(kconfig_setting, module): @@ -433,10 +437,9 @@ def process_sysbuildkconfig(module, meta): if kconfig_setting is not None: kconfig_file = os.path.join(module, kconfig_setting) if os.path.isfile(kconfig_file): - return snippet + kconfig_snippet(meta, module_path, Path(kconfig_file)) + return kconfig_snippet(meta, module_path, Path(kconfig_file)) - return snippet + \ - (f'config ZEPHYR_{name_sanitized.upper()}_MODULE\n' + return (f'config ZEPHYR_{name_sanitized.upper()}_MODULE\n' f' bool\n' f' default y\n') @@ -861,6 +864,7 @@ def main(): help='Path to zephyr repository') args = parser.parse_args() + kconfig_module_dirs = "" kconfig = "" cmake = "" sysbuild_kconfig = "" @@ -873,6 +877,7 @@ def main(): args.modules, args.extra_modules) for module in modules: + kconfig_module_dirs += process_kconfig_module_dir(module.project, module.meta) kconfig += process_kconfig(module.project, module.meta) cmake += process_cmake(module.project, module.meta) sysbuild_kconfig += process_sysbuildkconfig( @@ -881,6 +886,16 @@ def main(): settings += process_settings(module.project, module.meta) twister += process_twister(module.project, module.meta) + if args.kconfig_out or args.sysbuild_kconfig_out: + if args.kconfig_out: + kconfig_module_dirs_out = PurePath(args.kconfig_out).parent / 'kconfig_module_dirs.env' + elif args.sysbuild_kconfig_out: + kconfig_module_dirs_out = PurePath(args.sysbuild_kconfig_out).parent / \ + 'kconfig_module_dirs.env' + + with open(kconfig_module_dirs_out, 'w', encoding="utf-8") as fp: + fp.write(kconfig_module_dirs) + if args.kconfig_out: with open(args.kconfig_out, 'w', encoding="utf-8") as fp: fp.write(kconfig) diff --git a/share/sysbuild/Kconfig b/share/sysbuild/Kconfig index 5f689e07399a..6bf51245771f 100644 --- a/share/sysbuild/Kconfig +++ b/share/sysbuild/Kconfig @@ -2,6 +2,8 @@ # # SPDX-License-Identifier: Apache-2.0 +source "$(KCONFIG_ENV_FILE)" + config BOARD string default "$(BOARD)" From cff056bd234fb91722e269d97254efcf846364e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Tue, 3 Jun 2025 12:05:08 +0200 Subject: [PATCH 0781/2141] [nrf fromtree] scripts: requirements: update pinned dependencies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Run uv-compile to update to latest minor versions of dependencies. Signed-off-by: Benjamin Cabé (cherry picked from commit 710a7272baa733ff0849030a2697521db9138898) --- scripts/requirements-actions.txt | 34 +++++++++++++++++--------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/scripts/requirements-actions.txt b/scripts/requirements-actions.txt index 61b88c954041..b1997b684398 100644 --- a/scripts/requirements-actions.txt +++ b/scripts/requirements-actions.txt @@ -12,13 +12,13 @@ astroid==3.3.10 \ --hash=sha256:104fb9cb9b27ea95e847a94c003be03a9e039334a8ebca5ee27dafaf5c5711eb \ --hash=sha256:c332157953060c6deb9caa57303ae0d20b0fbdb2e59b4a4f2a6ba49d0a7961ce # via pylint -awscli==1.40.24 \ - --hash=sha256:6dbd7baebd5e01cd983dc8a816dfaa09155ce1825099ee09fd2044ea60024a3e \ - --hash=sha256:a5d8dffa523f332839ec95501364df45d763c3000f9a61247324e6cfa46a3bf2 +awscli==1.40.27 \ + --hash=sha256:92c84a3e9cbe3a7566bc738ad21201d9dad32dd7ab6a7a4906f7e1b29b9385ca \ + --hash=sha256:d1e1047cccd675b48ab215b4012c91673de73ba498f503fd6eda3de1a24995d7 # via -r requirements-actions.in -botocore==1.38.25 \ - --hash=sha256:5a960bd990a11cdb78865e908a58ed712d87d9b419f55ad21c99d7d21f0d6726 \ - --hash=sha256:8c73e97d9662a6c92be33dab66cd1e2b59797154c7ec379ce3bb5d6779d9d78c +botocore==1.38.28 \ + --hash=sha256:515e1a535a27f17e1381aec1fb48eaa2c2308258c4db0bfd09e4f1cd1f239c44 \ + --hash=sha256:63d5977a10a375c3fc11c8e15e1ae5a4daaf450af135d55c170cc537648edf25 # via # awscli # s3transfer @@ -840,7 +840,9 @@ pygithub==2.6.1 \ pygments==2.19.1 \ --hash=sha256:61c16d2a8576dc0649d9f39e089b5f02bcd27fba10d8fb4dcc28173f7a45151f \ --hash=sha256:9ea1544ad55cecf4b8242fab6dd35a93bbce657034b0611ee383099054ab6d8c - # via gcovr + # via + # gcovr + # pytest pyjwt==2.10.1 \ --hash=sha256:3cc5772eb20009233caf06e9d8a0577824723b44e6648ee0a2aedb6cf9381953 \ --hash=sha256:dcdd193e30abefd5debf142f9adfcdd2b58004e644f25406ffaebd50bd98dacb @@ -875,9 +877,9 @@ pyserial==3.5 \ --hash=sha256:3c77e014170dfffbd816e6ffc205e9842efb10be9f58ec16d3e8675b4925cddb \ --hash=sha256:c4451db6ba391ca6ca299fb3ec7bae67a5c55dde170964c7a14ceefec02f2cf0 # via -r requirements-actions.in -pytest==8.3.5 \ - --hash=sha256:c69214aa47deac29fad6c2a4f590b9c4a9fdb16a403176fe154b79c0b4d4d820 \ - --hash=sha256:f4efe70cc14e511565ac476b57c279e12a855b11f48f212af1080ef2263d3845 +pytest==8.4.0 \ + --hash=sha256:14d920b48472ea0dbf68e45b96cd1ffda4705f33307dcc86c676c1b5104838a6 \ + --hash=sha256:f40f825768ad76c0977cbacdf1fd37c6f7a468e460ea6a0636078f8972d4517e # via -r requirements-actions.in python-can==4.5.0 \ --hash=sha256:1eec66833c1ac76a7e3d636ee0f8b4ba2752e892bab1c56ce74308b2216b5445 \ @@ -1063,9 +1065,9 @@ rsa==4.7.2 \ --hash=sha256:78f9a9bf4e7be0c5ded4583326e7461e3a3c5aae24073648b4bdfa797d78c9d2 \ --hash=sha256:9d689e6ca1b3038bc82bf8d23e944b6b6037bc02301a574935b2dd946e0353b9 # via awscli -ruamel-yaml==0.18.11 \ - --hash=sha256:b586a3416676566ed45bf679a0909719f7ea7b58c03a9b6e03f905a1e2cd5076 \ - --hash=sha256:eca06c9fce6ee3220845c4c54e58376586e041a6127e4d1958e12a3142084897 +ruamel-yaml==0.18.12 \ + --hash=sha256:5a38fd5ce39d223bebb9e3a6779e86b9427a03fb0bf9f270060f8b149cffe5e2 \ + --hash=sha256:790ba4c48b6a6e6b12b532a7308779eb12d2aaab3a80fdb8389216f28ea2b287 # via pykwalify ruamel-yaml-clib==0.2.12 ; python_full_version < '3.14' and platform_python_implementation == 'CPython' \ --hash=sha256:040ae85536960525ea62868b642bdb0c2cc6021c9f9d507810c0c604e66f5a7b \ @@ -1210,9 +1212,9 @@ tox==4.26.0 \ --hash=sha256:75f17aaf09face9b97bd41645028d9f722301e912be8b4c65a3f938024560224 \ --hash=sha256:a83b3b67b0159fa58e44e646505079e35a43317a62d2ae94725e0586266faeca # via -r requirements-actions.in -typing-extensions==4.13.2 \ - --hash=sha256:a439e7c04b49fec3e5d3e2beaa21755cadbbdc391694e28ccdd36ca4a1408f8c \ - --hash=sha256:e6c81219bd689f51865d9e372991c540bda33a0379d5573cddb9a3a23f7caaef +typing-extensions==4.14.0 \ + --hash=sha256:8676b788e32f02ab42d9e7c61324048ae4c6d844a399eebace3d4979d75ceef4 \ + --hash=sha256:a1514509136dd0b477638fc68d6a91497af5076466ad0fa6c338e44e359944af # via # astroid # elasticsearch From 3bd95f869510e3b0be9bdd03c8ec9e66455c22c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Tue, 3 Jun 2025 11:00:16 +0200 Subject: [PATCH 0782/2141] [nrf fromtree] scripts: ci: add vermin (min python version check) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a compliance check that allows to flag when a given file requires a Python version higher than 3.10 (minimum supported version in Zephyr at the time of writing) since not all Python scripts are tested against 3.10 in CI and we want to avoid introducing changes that could break users. Signed-off-by: Benjamin Cabé (cherry picked from commit 17ab862169b34e29d8ad606b9cd874fbf9bf9aa7) --- .gitignore | 1 + scripts/ci/check_compliance.py | 60 +++++++++++++++++++++++++++++ scripts/requirements-actions.in | 1 + scripts/requirements-actions.txt | 4 ++ scripts/requirements-compliance.txt | 1 + 5 files changed, 67 insertions(+) diff --git a/.gitignore b/.gitignore index aab3981f52fc..c24356df575a 100644 --- a/.gitignore +++ b/.gitignore @@ -102,6 +102,7 @@ MaintainersFormat.txt ModulesMaintainers.txt Nits.txt Pylint.txt +PythonCompat.txt Ruff.txt SphinxLint.txt SysbuildKconfig.txt diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index d5f13ee84fce..f1da73f3ec0d 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -2001,6 +2001,66 @@ def run(self): desc = f"Run 'ruff format {file}'" self.fmtd_failure("error", "Python format error", file, desc=desc) +class PythonCompatCheck(ComplianceTest): + """ + Python Compatibility Check + """ + name = "PythonCompat" + doc = "Check that Python files are compatible with Zephyr minimum supported Python version." + + MAX_VERSION = (3, 10) + MAX_VERSION_STR = f"{MAX_VERSION[0]}.{MAX_VERSION[1]}" + + def run(self): + py_files = [f for f in get_files(filter="d") if f.endswith(".py")] + if not py_files: + return + cmd = ["vermin", "-f", "parsable", "--violations", + f"-t={self.MAX_VERSION_STR}", "--no-make-paths-absolute"] + py_files + try: + result = subprocess.run(cmd, + check=False, + capture_output=True, + cwd=GIT_TOP) + except Exception as ex: + self.error(f"Failed to run vermin: {ex}") + output = result.stdout.decode("utf-8") + failed = False + for line in output.splitlines(): + parts = line.split(":") + if len(parts) < 6: + continue + filename, line_number, column, _, py3ver, feature = parts[:6] + if not line_number: + # Ignore all file-level messages + continue + + desc = None + if py3ver.startswith('!'): + desc = f"{feature} is known to be incompatible with Python 3." + elif py3ver.startswith('~'): + # "no known reason it won't work", just skip + continue + else: + major, minor = map(int, py3ver.split(".")[:2]) + if (major, minor) > self.MAX_VERSION: + desc = f"{feature} requires Python {major}.{minor}, which is higher than " \ + f"Zephyr's minimum supported Python version ({self.MAX_VERSION_STR})." + + if desc is not None: + self.fmtd_failure( + "error", + "PythonCompat", + filename, + line=int(line_number), + col=int(column) if column else None, + desc=desc, + ) + failed = True + if failed: + self.failure("Some Python files use features that are not compatible with Python " \ + f"{self.MAX_VERSION_STR}.") + class TextEncoding(ComplianceTest): """ diff --git a/scripts/requirements-actions.in b/scripts/requirements-actions.in index bf4a50e2aa27..2094546f423a 100644 --- a/scripts/requirements-actions.in +++ b/scripts/requirements-actions.in @@ -35,6 +35,7 @@ tabulate tomli>=1.1.0 tox unidiff +vermin west>=0.14.0 xlsxwriter yamllint diff --git a/scripts/requirements-actions.txt b/scripts/requirements-actions.txt index b1997b684398..065d59923991 100644 --- a/scripts/requirements-actions.txt +++ b/scripts/requirements-actions.txt @@ -1235,6 +1235,10 @@ urllib3==2.4.0 \ # elastic-transport # pygithub # requests +vermin==1.6.0 \ + --hash=sha256:6266ca02f55d1c2aa189a610017c132eb2d1934f09e72a955b1eb3820ee6d4ef \ + --hash=sha256:f1fa9ee40f59983dc40e0477eb2b1fa8061a3df4c3b2bcf349add462a5610efb + # via -r requirements-actions.in virtualenv==20.31.2 \ --hash=sha256:36efd0d9650ee985f0cad72065001e66d49a6f24eb44d98980f630686243cf11 \ --hash=sha256:e10c0a9d02835e592521be48b332b6caee6887f332c111aa79a09b9e79efc2af diff --git a/scripts/requirements-compliance.txt b/scripts/requirements-compliance.txt index a7134e7ff002..19bdcb3071f3 100644 --- a/scripts/requirements-compliance.txt +++ b/scripts/requirements-compliance.txt @@ -13,5 +13,6 @@ python-magic; sys_platform != "win32" ruff==0.11.11 sphinx-lint unidiff +vermin yamllint # zephyr-keep-sorted-stop From dea8f87f84b3e1704bcb06c8abd114bde965093a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Mon, 16 Jun 2025 22:29:22 +0200 Subject: [PATCH 0783/2141] [nrf fromtree] tests: cmake: actually test SBOM files generation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The current test was just a basic sanity check. This adds actual validation of the SPDX files being generated as being spec-compliant. Signed-off-by: Benjamin Cabé (cherry picked from commit 14ea8b087bdf961197c650b151e99aaa2622916f) --- scripts/requirements-actions.in | 1 + scripts/requirements-actions.txt | 392 ++++++++++-------- scripts/requirements-run-test.txt | 3 + .../software_bill_of_materials/CMakeLists.txt | 33 +- .../software_bill_of_materials/testcase.yaml | 4 +- 5 files changed, 255 insertions(+), 178 deletions(-) diff --git a/scripts/requirements-actions.in b/scripts/requirements-actions.in index 2094546f423a..0fb1eca5ad81 100644 --- a/scripts/requirements-actions.in +++ b/scripts/requirements-actions.in @@ -30,6 +30,7 @@ python-magic; sys_platform != "win32" pyyaml ruff==0.11.11 setuptools>=70.2.0 +spdx-tools sphinx-lint tabulate tomli>=1.1.0 diff --git a/scripts/requirements-actions.txt b/scripts/requirements-actions.txt index 065d59923991..621d8dbc4aec 100644 --- a/scripts/requirements-actions.txt +++ b/scripts/requirements-actions.txt @@ -12,27 +12,35 @@ astroid==3.3.10 \ --hash=sha256:104fb9cb9b27ea95e847a94c003be03a9e039334a8ebca5ee27dafaf5c5711eb \ --hash=sha256:c332157953060c6deb9caa57303ae0d20b0fbdb2e59b4a4f2a6ba49d0a7961ce # via pylint -awscli==1.40.27 \ - --hash=sha256:92c84a3e9cbe3a7566bc738ad21201d9dad32dd7ab6a7a4906f7e1b29b9385ca \ - --hash=sha256:d1e1047cccd675b48ab215b4012c91673de73ba498f503fd6eda3de1a24995d7 +awscli==1.40.36 \ + --hash=sha256:4a548d855cafad153e661defab601363ba8a5644873bf9f8dec31d5c0ebbb351 \ + --hash=sha256:960d92bf8b2f7efd142112f277eed7cc82d8af85fceefe4d321a620352b75ebd # via -r requirements-actions.in -botocore==1.38.28 \ - --hash=sha256:515e1a535a27f17e1381aec1fb48eaa2c2308258c4db0bfd09e4f1cd1f239c44 \ - --hash=sha256:63d5977a10a375c3fc11c8e15e1ae5a4daaf450af135d55c170cc537648edf25 +beartype==0.21.0 \ + --hash=sha256:b6a1bd56c72f31b0a496a36cc55df6e2f475db166ad07fa4acc7e74f4c7f34c0 \ + --hash=sha256:f9a5078f5ce87261c2d22851d19b050b64f6a805439e8793aecf01ce660d3244 + # via spdx-tools +boolean-py==5.0 \ + --hash=sha256:60cbc4bad079753721d32649545505362c754e121570ada4658b852a3a318d95 \ + --hash=sha256:ef28a70bd43115208441b53a045d1549e2f0ec6e3d08a9d142cbc41c1938e8d9 + # via license-expression +botocore==1.38.37 \ + --hash=sha256:06ce46da5420ea7cf542ece4ff1ec9045922fef977adf4bbec618c96c7a478bf \ + --hash=sha256:f8ad063b7dcdbf12f2c1b5a4405f390ce52beff3b2861af2e5169816ee0146f2 # via # awscli # s3transfer -cachetools==6.0.0 \ - --hash=sha256:82e73ba88f7b30228b5507dce1a1f878498fc669d972aef2dde4f3a3c24f103e \ - --hash=sha256:f225782b84438f828328fc2ad74346522f27e5b1440f4e9fd18b20ebfd1aa2cf +cachetools==6.1.0 \ + --hash=sha256:1c7bb3cf9193deaf3508b7c5f2a79986c13ea38965c5adcff1f84519cf39163e \ + --hash=sha256:b4c4f404392848db3ce7aac34950d17be4d864da4b8b66911008e430bc544587 # via tox canopen==2.3.0 \ --hash=sha256:792084a93c138d5b2a406ddd2d4eb5ce208f03bd8fda60f81ad2bb8d56c6b827 \ --hash=sha256:7a62274af6ded7ee85ee96f4ada3afa38bc8607a91f306dcc202c3c8cf2850d7 # via -r requirements-actions.in -certifi==2025.4.26 \ - --hash=sha256:0a816057ea3cdefcef70270d2c515e4506bbc954f417fa5ade2021213bb8f0c6 \ - --hash=sha256:30350364dfe371162649852c63336a15c70c6510c2ad5015b21c2345311805f3 +certifi==2025.6.15 \ + --hash=sha256:2e0c7ce7cb5d8f8634ca55d2ba7e6ec2689a2fd6537d8dec1296a477a4910057 \ + --hash=sha256:d747aa5a8b9bbbb1bb8c22bb13e22bd1f18e9796defa16bab421f7f7a317323b # via # elastic-transport # requests @@ -205,28 +213,30 @@ charset-normalizer==3.4.2 \ --hash=sha256:fcbe676a55d7445b22c10967bceaaf0ee69407fbe0ece4d032b6eb8d4565982a \ --hash=sha256:fdb20a30fe1175ecabed17cbf7812f7b804b8a315a25f24678bcdf120a90077f # via requests -clang-format==20.1.5 \ - --hash=sha256:16c99e744009822d8574b163d679d3a13c81d26beb8512e55a74651b8972f64d \ - --hash=sha256:269d0a12cf6177f2bb806f73130189efac311bd2d24bd5ab8e12f9486b31f591 \ - --hash=sha256:4412731a18ed0749b8357c41bbe277baed514b117345f1f8e3dbc61bf7b6d78e \ - --hash=sha256:45e23bceb0ec646acd14a6274ea92ddc6d959bed4a8c1c338346e4da403b1c96 \ - --hash=sha256:5af73b84c98461bdab8f0b6c1bc49a7935a3362c3183315421607805a0b3e03b \ - --hash=sha256:626e29e1014e044166d856ef439955622e5e6ba50662fe4b4142f41ecebafefe \ - --hash=sha256:6f0d7e54f25374c7849ec639f2e666b35c18bfe76cdacb7e3fdfc92647c99387 \ - --hash=sha256:7abe250990f6eaf89a201cf89f296c18bdb2c135dd44b949a6007ffd31c4522c \ - --hash=sha256:8e0b8e8bdf513f8ac27b82ec940440d836177836d5bc30d1002632e7f4308aab \ - --hash=sha256:9d2b233edaa1323ea9e736f598ba6a845ecb5fa3d21fe88dbb5be12974b8cc78 \ - --hash=sha256:9f82d954ed96cb01a5b6fdcbd87339837b2a310ce65dcd89c88821b6207b6e00 \ - --hash=sha256:c9dbc67e23bafa578367b815425573697a7e3d342e5aed17ae02cb0108007e74 \ - --hash=sha256:cffbcc410ef535a60ab918699ac38d22fa231059cba2bc6c1226a5de69af2c38 \ - --hash=sha256:dba394d7fb285d1adb48a9a46f7241afd2bd8569d63efc76ffe3c381f72c3c7e \ - --hash=sha256:e389a7aa1e99988764060e8fd06b71517dd5d86e3d5285cb9f8eefb1823b4233 \ - --hash=sha256:ee886b41fd7a671a38d207af05006a187b7fc0f5e2463d66fce8c8b4f4cd30c7 +clang-format==20.1.6 \ + --hash=sha256:0ea008a20951527d35a1e2b8febdca3c47c6f8e9a1bd174601c891e20053ef2e \ + --hash=sha256:11530ff352c64176ba4297ad398452d9fcd442b4a8bb2a804cc7915bc94b96e1 \ + --hash=sha256:12626f058755198b92b26076312cc1052f8dd7868bd6cf61b65d2911154ef6df \ + --hash=sha256:15dbc113b4d2f1eb545adb9b815b96c2d64aff947de9453802e47ef1c5267996 \ + --hash=sha256:2ea00197fe650f29b77dd870cd87891e15d9d2dac75c4e9072f4eee99a928dcb \ + --hash=sha256:5351f353062bb0df9c31b4e84c8a9d6b472f9f0727ebd5ab1f96fd3e792756fa \ + --hash=sha256:58b3ef54bc32304990f1890cc982607f69359e46b0e98350718125bea24566de \ + --hash=sha256:779153a039c8552438dd9a3925f5dad20d8b5a812329703f98cd5da7bb91556c \ + --hash=sha256:8ce12618431d8955026c30a2d19a3ae9ddc6d918ad24a4e00a10f8f130454469 \ + --hash=sha256:8ce920b103447d21ff44d41a7ad412794bde1b737426a126c8ab141f00bbfba8 \ + --hash=sha256:bfc4a9922ee1f7c0ec5a8250cb72e755a1ddc73e5d50866efe00561be6fc69eb \ + --hash=sha256:c93c8b7feed66521349918f741b40ef6eaf85dfa1b5eb1303a49ed4608fd882a \ + --hash=sha256:ce8f5bbacba3f05adc2cd64a1780e36c81b54a2caa0b4c618c611b2b45124930 \ + --hash=sha256:d1d64ccfb14dcd93cd98321191e9fbaef049774d050f0c084b7aede41e79fee2 \ + --hash=sha256:d84fffa03432c400bb560f3c8181c2dfa6be05b9b866f7d0180dfb41e0f91907 \ + --hash=sha256:e1e59c3a23d033df261ce8048c96f0493285cff1b65d3f519b77a47854653d27 # via -r requirements-actions.in click==8.1.3 \ --hash=sha256:7682dc8afb30297001674575ea00d1814d808d6a36af415a82bd481d37ba7b8e \ --hash=sha256:bb4d8133cb15a609f44e8213d9b391b0809795062913b383c62be0ee95b1db48 - # via gitlint-core + # via + # gitlint-core + # spdx-tools colorama==0.4.6 \ --hash=sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44 \ --hash=sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6 @@ -237,44 +247,44 @@ colorama==0.4.6 \ # pytest # tox # west -cryptography==45.0.3 \ - --hash=sha256:00094838ecc7c6594171e8c8a9166124c1197b074cfca23645cee573910d76bc \ - --hash=sha256:050ce5209d5072472971e6efbfc8ec5a8f9a841de5a4db0ebd9c2e392cb81972 \ - --hash=sha256:232954730c362638544758a8160c4ee1b832dc011d2c41a306ad8f7cccc5bb0b \ - --hash=sha256:25286aacb947286620a31f78f2ed1a32cded7be5d8b729ba3fb2c988457639e4 \ - --hash=sha256:2f8f8f0b73b885ddd7f3d8c2b2234a7d3ba49002b0223f58cfde1bedd9563c56 \ - --hash=sha256:38deed72285c7ed699864f964a3f4cf11ab3fb38e8d39cfcd96710cd2b5bb716 \ - --hash=sha256:3ad69eeb92a9de9421e1f6685e85a10fbcfb75c833b42cc9bc2ba9fb00da4710 \ - --hash=sha256:5555365a50efe1f486eed6ac7062c33b97ccef409f5970a0b6f205a7cfab59c8 \ - --hash=sha256:555e5e2d3a53b4fabeca32835878b2818b3f23966a4efb0d566689777c5a12c8 \ - --hash=sha256:57a6500d459e8035e813bd8b51b671977fb149a8c95ed814989da682314d0782 \ - --hash=sha256:5833bb4355cb377ebd880457663a972cd044e7f49585aee39245c0d592904578 \ - --hash=sha256:71320fbefd05454ef2d457c481ba9a5b0e540f3753354fff6f780927c25d19b0 \ - --hash=sha256:7573d9eebaeceeb55285205dbbb8753ac1e962af3d9640791d12b36864065e71 \ - --hash=sha256:92d5f428c1a0439b2040435a1d6bc1b26ebf0af88b093c3628913dd464d13fa1 \ - --hash=sha256:97787952246a77d77934d41b62fb1b6f3581d83f71b44796a4158d93b8f5c490 \ - --hash=sha256:9bb5bf55dcb69f7067d80354d0a348368da907345a2c448b0babc4215ccd3497 \ - --hash=sha256:9cc80ce69032ffa528b5e16d217fa4d8d4bb7d6ba8659c1b4d74a1b0f4235fca \ - --hash=sha256:9e4253ed8f5948a3589b3caee7ad9a5bf218ffd16869c516535325fece163dcc \ - --hash=sha256:9eda14f049d7f09c2e8fb411dda17dd6b16a3c76a1de5e249188a32aeb92de19 \ - --hash=sha256:a2b56de3417fd5f48773ad8e91abaa700b678dc7fe1e0c757e1ae340779acf7b \ - --hash=sha256:af3f92b1dc25621f5fad065288a44ac790c5798e986a34d393ab27d2b27fcff9 \ - --hash=sha256:c5edcb90da1843df85292ef3a313513766a78fbbb83f584a5a58fb001a5a9d57 \ - --hash=sha256:c824c9281cb628015bfc3c59335163d4ca0540d49de4582d6c2637312907e4b1 \ - --hash=sha256:c92519d242703b675ccefd0f0562eb45e74d438e001f8ab52d628e885751fb06 \ - --hash=sha256:ca932e11218bcc9ef812aa497cdf669484870ecbcf2d99b765d6c27a86000942 \ - --hash=sha256:cb6ab89421bc90e0422aca911c69044c2912fc3debb19bb3c1bfe28ee3dff6ab \ - --hash=sha256:cfd84777b4b6684955ce86156cfb5e08d75e80dc2585e10d69e47f014f0a5342 \ - --hash=sha256:d377dde61c5d67eb4311eace661c3efda46c62113ff56bf05e2d679e02aebb5b \ - --hash=sha256:d54ae41e6bd70ea23707843021c778f151ca258081586f0cfa31d936ae43d1b2 \ - --hash=sha256:dc10ec1e9f21f33420cc05214989544727e776286c1c16697178978327b95c9c \ - --hash=sha256:ec21313dd335c51d7877baf2972569f40a4291b76a0ce51391523ae358d05899 \ - --hash=sha256:ec64ee375b5aaa354b2b273c921144a660a511f9df8785e6d1c942967106438e \ - --hash=sha256:ed43d396f42028c1f47b5fec012e9e12631266e3825e95c00e3cf94d472dac49 \ - --hash=sha256:edd6d51869beb7f0d472e902ef231a9b7689508e83880ea16ca3311a00bf5ce7 \ - --hash=sha256:f22af3c78abfbc7cbcdf2c55d23c3e022e1a462ee2481011d518c7fb9c9f3d65 \ - --hash=sha256:fae1e637f527750811588e4582988932c222f8251f7b7ea93739acb624e1487f \ - --hash=sha256:fed5aaca1750e46db870874c9c273cd5182a9e9deb16f06f7bdffdb5c2bde4b9 +cryptography==45.0.4 \ + --hash=sha256:0339a692de47084969500ee455e42c58e449461e0ec845a34a6a9b9bf7df7fb8 \ + --hash=sha256:03dbff8411206713185b8cebe31bc5c0eb544799a50c09035733716b386e61a4 \ + --hash=sha256:06509dc70dd71fa56eaa138336244e2fbaf2ac164fc9b5e66828fccfd2b680d6 \ + --hash=sha256:0cf13c77d710131d33e63626bd55ae7c0efb701ebdc2b3a7952b9b23a0412862 \ + --hash=sha256:23b9c3ea30c3ed4db59e7b9619272e94891f8a3a5591d0b656a7582631ccf750 \ + --hash=sha256:25eb4d4d3e54595dc8adebc6bbd5623588991d86591a78c2548ffb64797341e2 \ + --hash=sha256:2882338b2a6e0bd337052e8b9007ced85c637da19ef9ecaf437744495c8c2999 \ + --hash=sha256:3530382a43a0e524bc931f187fc69ef4c42828cf7d7f592f7f249f602b5a4ab0 \ + --hash=sha256:425a9a6ac2823ee6e46a76a21a4e8342d8fa5c01e08b823c1f19a8b74f096069 \ + --hash=sha256:46cf7088bf91bdc9b26f9c55636492c1cce3e7aaf8041bbf0243f5e5325cfb2d \ + --hash=sha256:4828190fb6c4bcb6ebc6331f01fe66ae838bb3bd58e753b59d4b22eb444b996c \ + --hash=sha256:49fe9155ab32721b9122975e168a6760d8ce4cffe423bcd7ca269ba41b5dfac1 \ + --hash=sha256:4ca0f52170e821bc8da6fc0cc565b7bb8ff8d90d36b5e9fdd68e8a86bdf72036 \ + --hash=sha256:51dfbd4d26172d31150d84c19bbe06c68ea4b7f11bbc7b3a5e146b367c311349 \ + --hash=sha256:5f31e6b0a5a253f6aa49be67279be4a7e5a4ef259a9f33c69f7d1b1191939872 \ + --hash=sha256:627ba1bc94f6adf0b0a2e35d87020285ead22d9f648c7e75bb64f367375f3b22 \ + --hash=sha256:680806cf63baa0039b920f4976f5f31b10e772de42f16310a6839d9f21a26b0d \ + --hash=sha256:6a3511ae33f09094185d111160fd192c67aa0a2a8d19b54d36e4c78f651dc5ad \ + --hash=sha256:6a5bf57554e80f75a7db3d4b1dacaa2764611ae166ab42ea9a72bcdb5d577637 \ + --hash=sha256:6b613164cb8425e2f8db5849ffb84892e523bf6d26deb8f9bb76ae86181fa12b \ + --hash=sha256:7405ade85c83c37682c8fe65554759800a4a8c54b2d96e0f8ad114d31b808d57 \ + --hash=sha256:7aad98a25ed8ac917fdd8a9c1e706e5a0956e06c498be1f713b61734333a4507 \ + --hash=sha256:7bedbe4cc930fa4b100fc845ea1ea5788fcd7ae9562e669989c11618ae8d76ee \ + --hash=sha256:7ef2dde4fa9408475038fc9aadfc1fb2676b174e68356359632e980c661ec8f6 \ + --hash=sha256:817ee05c6c9f7a69a16200f0c90ab26d23a87701e2a284bd15156783e46dbcc8 \ + --hash=sha256:944e9ccf67a9594137f942d5b52c8d238b1b4e46c7a0c2891b7ae6e01e7c80a4 \ + --hash=sha256:964bcc28d867e0f5491a564b7debb3ffdd8717928d315d12e0d7defa9e43b723 \ + --hash=sha256:96d4819e25bf3b685199b304a0029ce4a3caf98947ce8a066c9137cc78ad2c58 \ + --hash=sha256:a77c6fb8d76e9c9f99f2f3437c1a4ac287b34eaf40997cfab1e9bd2be175ac39 \ + --hash=sha256:b0a97c927497e3bc36b33987abb99bf17a9a175a19af38a892dc4bbb844d7ee2 \ + --hash=sha256:b97737a3ffbea79eebb062eb0d67d72307195035332501722a9ca86bab9e3ab2 \ + --hash=sha256:bbc505d1dc469ac12a0a064214879eac6294038d6b24ae9f71faae1448a9608d \ + --hash=sha256:c22fe01e53dc65edd1945a2e6f0015e887f84ced233acecb64b4daadb32f5c97 \ + --hash=sha256:ce1678a2ccbe696cf3af15a75bb72ee008d7ff183c9228592ede9db467e64f1b \ + --hash=sha256:e00a6c10a5c53979d6242f123c0a97cff9f3abed7f064fc412c36dc521b5f257 \ + --hash=sha256:eaa3e28ea2235b33220b949c5a0d6cf79baa80eab2eb5607ca8ab7525331b9ff \ + --hash=sha256:f3fe7a5ae34d5a414957cc7f457e2b92076e72938423ac64d215722f6cf49a9e # via pyjwt deprecated==1.2.18 \ --hash=sha256:422b6f6d859da6f2ef57857761bfb392480502a64c3028ca9bbe86085d72115d \ @@ -434,6 +444,10 @@ intelhex==2.3.0 \ --hash=sha256:87cc5225657524ec6361354be928adfd56bcf2a3dcc646c40f8f094c39c07db4 \ --hash=sha256:892b7361a719f4945237da8ccf754e9513db32f5628852785aea108dcd250093 # via -r requirements-actions.in +isodate==0.7.2 ; python_full_version < '3.11' \ + --hash=sha256:28009937d8031054830160fce6d409ed342816b543597cece116d966c6d99e15 \ + --hash=sha256:4cd1aa0f43ca76f4a6c6c0292a85f40b35ec2e43e315b59f06e6d32171a953e6 + # via rdflib isort==6.0.1 \ --hash=sha256:1cb5df28dfbc742e490c5e41bad6da41b805b0a8be7bc93cd0fb2a8a890ac450 \ --hash=sha256:2dc5d7f65c9678d94c88dfc29161a320eec67328bc97aad576874cb4be1e9615 @@ -455,6 +469,10 @@ junitparser==3.2.0 \ --hash=sha256:b05e89c27e7b74b3c563a078d6e055d95cf397444f8f689b0ca616ebda0b3c65 \ --hash=sha256:e14fdc0a999edfc15889b637390e8ef6ca09a49532416d3bd562857d42d4b96d # via -r requirements-actions.in +license-expression==30.4.1 \ + --hash=sha256:679646bc3261a17690494a3e1cada446e5ee342dbd87dcfa4a0c24cc5dce13ee \ + --hash=sha256:9f02105f9e0fcecba6a85dfbbed7d94ea1c3a70cf23ddbfb5adf3438a6f6fce0 + # via spdx-tools lxml==5.4.0 \ --hash=sha256:00b8686694423ddae324cf614e1b9659c2edb754de617703c3d29ff568448df5 \ --hash=sha256:073eb6dcdf1f587d9b88c8c93528b57eccda40209cf9be549d469b942b41d70b \ @@ -662,105 +680,100 @@ mock==5.2.0 \ --hash=sha256:4e460e818629b4b173f32d08bf30d3af8123afbb8e04bb5707a1fd4799e503f0 \ --hash=sha256:7ba87f72ca0e915175596069dbbcc7c75af7b5e9b9bc107ad6349ede0819982f # via -r requirements-actions.in -msgpack==1.1.0 ; sys_platform != 'win32' \ - --hash=sha256:06f5fd2f6bb2a7914922d935d3b8bb4a7fff3a9a91cfce6d06c13bc42bec975b \ - --hash=sha256:071603e2f0771c45ad9bc65719291c568d4edf120b44eb36324dcb02a13bfddf \ - --hash=sha256:0907e1a7119b337971a689153665764adc34e89175f9a34793307d9def08e6ca \ - --hash=sha256:0f92a83b84e7c0749e3f12821949d79485971f087604178026085f60ce109330 \ - --hash=sha256:115a7af8ee9e8cddc10f87636767857e7e3717b7a2e97379dc2054712693e90f \ - --hash=sha256:13599f8829cfbe0158f6456374e9eea9f44eee08076291771d8ae93eda56607f \ - --hash=sha256:17fb65dd0bec285907f68b15734a993ad3fc94332b5bb21b0435846228de1f39 \ - --hash=sha256:2137773500afa5494a61b1208619e3871f75f27b03bcfca7b3a7023284140247 \ - --hash=sha256:3180065ec2abbe13a4ad37688b61b99d7f9e012a535b930e0e683ad6bc30155b \ - --hash=sha256:398b713459fea610861c8a7b62a6fec1882759f308ae0795b5413ff6a160cf3c \ - --hash=sha256:3d364a55082fb2a7416f6c63ae383fbd903adb5a6cf78c5b96cc6316dc1cedc7 \ - --hash=sha256:3df7e6b05571b3814361e8464f9304c42d2196808e0119f55d0d3e62cd5ea044 \ - --hash=sha256:41c991beebf175faf352fb940bf2af9ad1fb77fd25f38d9142053914947cdbf6 \ - --hash=sha256:42f754515e0f683f9c79210a5d1cad631ec3d06cea5172214d2176a42e67e19b \ - --hash=sha256:452aff037287acb1d70a804ffd022b21fa2bb7c46bee884dbc864cc9024128a0 \ - --hash=sha256:4676e5be1b472909b2ee6356ff425ebedf5142427842aa06b4dfd5117d1ca8a2 \ - --hash=sha256:46c34e99110762a76e3911fc923222472c9d681f1094096ac4102c18319e6468 \ - --hash=sha256:471e27a5787a2e3f974ba023f9e265a8c7cfd373632247deb225617e3100a3c7 \ - --hash=sha256:4a1964df7b81285d00a84da4e70cb1383f2e665e0f1f2a7027e683956d04b734 \ - --hash=sha256:4b51405e36e075193bc051315dbf29168d6141ae2500ba8cd80a522964e31434 \ - --hash=sha256:4d1b7ff2d6146e16e8bd665ac726a89c74163ef8cd39fa8c1087d4e52d3a2325 \ - --hash=sha256:53258eeb7a80fc46f62fd59c876957a2d0e15e6449a9e71842b6d24419d88ca1 \ - --hash=sha256:534480ee5690ab3cbed89d4c8971a5c631b69a8c0883ecfea96c19118510c846 \ - --hash=sha256:58638690ebd0a06427c5fe1a227bb6b8b9fdc2bd07701bec13c2335c82131a88 \ - --hash=sha256:58dfc47f8b102da61e8949708b3eafc3504509a5728f8b4ddef84bd9e16ad420 \ - --hash=sha256:59caf6a4ed0d164055ccff8fe31eddc0ebc07cf7326a2aaa0dbf7a4001cd823e \ - --hash=sha256:5dbad74103df937e1325cc4bfeaf57713be0b4f15e1c2da43ccdd836393e2ea2 \ - --hash=sha256:5e1da8f11a3dd397f0a32c76165cf0c4eb95b31013a94f6ecc0b280c05c91b59 \ - --hash=sha256:646afc8102935a388ffc3914b336d22d1c2d6209c773f3eb5dd4d6d3b6f8c1cb \ - --hash=sha256:64fc9068d701233effd61b19efb1485587560b66fe57b3e50d29c5d78e7fef68 \ - --hash=sha256:65553c9b6da8166e819a6aa90ad15288599b340f91d18f60b2061f402b9a4915 \ - --hash=sha256:685ec345eefc757a7c8af44a3032734a739f8c45d1b0ac45efc5d8977aa4720f \ - --hash=sha256:6ad622bf7756d5a497d5b6836e7fc3752e2dd6f4c648e24b1803f6048596f701 \ - --hash=sha256:73322a6cc57fcee3c0c57c4463d828e9428275fb85a27aa2aa1a92fdc42afd7b \ - --hash=sha256:74bed8f63f8f14d75eec75cf3d04ad581da6b914001b474a5d3cd3372c8cc27d \ - --hash=sha256:79ec007767b9b56860e0372085f8504db5d06bd6a327a335449508bbee9648fa \ - --hash=sha256:7a946a8992941fea80ed4beae6bff74ffd7ee129a90b4dd5cf9c476a30e9708d \ - --hash=sha256:7ad442d527a7e358a469faf43fda45aaf4ac3249c8310a82f0ccff9164e5dccd \ - --hash=sha256:7c9a35ce2c2573bada929e0b7b3576de647b0defbd25f5139dcdaba0ae35a4cc \ - --hash=sha256:7e7b853bbc44fb03fbdba34feb4bd414322180135e2cb5164f20ce1c9795ee48 \ - --hash=sha256:879a7b7b0ad82481c52d3c7eb99bf6f0645dbdec5134a4bddbd16f3506947feb \ - --hash=sha256:8a706d1e74dd3dea05cb54580d9bd8b2880e9264856ce5068027eed09680aa74 \ - --hash=sha256:8a84efb768fb968381e525eeeb3d92857e4985aacc39f3c47ffd00eb4509315b \ - --hash=sha256:8cf9e8c3a2153934a23ac160cc4cba0ec035f6867c8013cc6077a79823370346 \ - --hash=sha256:8da4bf6d54ceed70e8861f833f83ce0814a2b72102e890cbdfe4b34764cdd66e \ - --hash=sha256:8e59bca908d9ca0de3dc8684f21ebf9a690fe47b6be93236eb40b99af28b6ea6 \ - --hash=sha256:914571a2a5b4e7606997e169f64ce53a8b1e06f2cf2c3a7273aa106236d43dd5 \ - --hash=sha256:a51abd48c6d8ac89e0cfd4fe177c61481aca2d5e7ba42044fd218cfd8ea9899f \ - --hash=sha256:a52a1f3a5af7ba1c9ace055b659189f6c669cf3657095b50f9602af3a3ba0fe5 \ - --hash=sha256:ad33e8400e4ec17ba782f7b9cf868977d867ed784a1f5f2ab46e7ba53b6e1e1b \ - --hash=sha256:b4c01941fd2ff87c2a934ee6055bda4ed353a7846b8d4f341c428109e9fcde8c \ - --hash=sha256:bce7d9e614a04d0883af0b3d4d501171fbfca038f12c77fa838d9f198147a23f \ - --hash=sha256:c40ffa9a15d74e05ba1fe2681ea33b9caffd886675412612d93ab17b58ea2fec \ - --hash=sha256:c5a91481a3cc573ac8c0d9aace09345d989dc4a0202b7fcb312c88c26d4e71a8 \ - --hash=sha256:c921af52214dcbb75e6bdf6a661b23c3e6417f00c603dd2070bccb5c3ef499f5 \ - --hash=sha256:d46cf9e3705ea9485687aa4001a76e44748b609d260af21c4ceea7f2212a501d \ - --hash=sha256:d8ce0b22b890be5d252de90d0e0d119f363012027cf256185fc3d474c44b1b9e \ - --hash=sha256:dd432ccc2c72b914e4cb77afce64aab761c1137cc698be3984eee260bcb2896e \ - --hash=sha256:e0856a2b7e8dcb874be44fea031d22e5b3a19121be92a1e098f46068a11b0870 \ - --hash=sha256:e1f3c3d21f7cf67bcf2da8e494d30a75e4cf60041d98b3f79875afb5b96f3a3f \ - --hash=sha256:f1ba6136e650898082d9d5a5217d5906d1e138024f836ff48691784bbe1adf96 \ - --hash=sha256:f3e9b4936df53b970513eac1758f3882c88658a220b58dcc1e39606dccaaf01c \ - --hash=sha256:f80bc7d47f76089633763f952e67f8214cb7b3ee6bfa489b3cb6a84cfac114cd \ - --hash=sha256:fd2906780f25c8ed5d7b323379f6138524ba793428db5d0e9d226d3fa6aa1788 +msgpack==1.1.1 ; sys_platform != 'win32' \ + --hash=sha256:196a736f0526a03653d829d7d4c5500a97eea3648aebfd4b6743875f28aa2af8 \ + --hash=sha256:1abfc6e949b352dadf4bce0eb78023212ec5ac42f6abfd469ce91d783c149c2a \ + --hash=sha256:1b13fe0fb4aac1aa5320cd693b297fe6fdef0e7bea5518cbc2dd5299f873ae90 \ + --hash=sha256:1d75f3807a9900a7d575d8d6674a3a47e9f227e8716256f35bc6f03fc597ffbf \ + --hash=sha256:2fbbc0b906a24038c9958a1ba7ae0918ad35b06cb449d398b76a7d08470b0ed9 \ + --hash=sha256:33be9ab121df9b6b461ff91baac6f2731f83d9b27ed948c5b9d1978ae28bf157 \ + --hash=sha256:353b6fc0c36fde68b661a12949d7d49f8f51ff5fa019c1e47c87c4ff34b080ed \ + --hash=sha256:36043272c6aede309d29d56851f8841ba907a1a3d04435e43e8a19928e243c1d \ + --hash=sha256:3765afa6bd4832fc11c3749be4ba4b69a0e8d7b728f78e68120a157a4c5d41f0 \ + --hash=sha256:3a89cd8c087ea67e64844287ea52888239cbd2940884eafd2dcd25754fb72232 \ + --hash=sha256:40eae974c873b2992fd36424a5d9407f93e97656d999f43fca9d29f820899084 \ + --hash=sha256:4147151acabb9caed4e474c3344181e91ff7a388b888f1e19ea04f7e73dc7ad5 \ + --hash=sha256:435807eeb1bc791ceb3247d13c79868deb22184e1fc4224808750f0d7d1affc1 \ + --hash=sha256:4835d17af722609a45e16037bb1d4d78b7bdf19d6c0128116d178956618c4e88 \ + --hash=sha256:4a28e8072ae9779f20427af07f53bbb8b4aa81151054e882aee333b158da8752 \ + --hash=sha256:4d3237b224b930d58e9d83c81c0dba7aacc20fcc2f89c1e5423aa0529a4cd142 \ + --hash=sha256:4df2311b0ce24f06ba253fda361f938dfecd7b961576f9be3f3fbd60e87130ac \ + --hash=sha256:4fd6b577e4541676e0cc9ddc1709d25014d3ad9a66caa19962c4f5de30fc09ef \ + --hash=sha256:500e85823a27d6d9bba1d057c871b4210c1dd6fb01fbb764e37e4e8847376323 \ + --hash=sha256:5692095123007180dca3e788bb4c399cc26626da51629a31d40207cb262e67f4 \ + --hash=sha256:5fd1b58e1431008a57247d6e7cc4faa41c3607e8e7d4aaf81f7c29ea013cb458 \ + --hash=sha256:61abccf9de335d9efd149e2fff97ed5974f2481b3353772e8e2dd3402ba2bd57 \ + --hash=sha256:61e35a55a546a1690d9d09effaa436c25ae6130573b6ee9829c37ef0f18d5e78 \ + --hash=sha256:6640fd979ca9a212e4bcdf6eb74051ade2c690b862b679bfcb60ae46e6dc4bfd \ + --hash=sha256:6d489fba546295983abd142812bda76b57e33d0b9f5d5b71c09a583285506f69 \ + --hash=sha256:6f64ae8fe7ffba251fecb8408540c34ee9df1c26674c50c4544d72dbf792e5ce \ + --hash=sha256:71ef05c1726884e44f8b1d1773604ab5d4d17729d8491403a705e649116c9558 \ + --hash=sha256:77b79ce34a2bdab2594f490c8e80dd62a02d650b91a75159a63ec413b8d104cd \ + --hash=sha256:78426096939c2c7482bf31ef15ca219a9e24460289c00dd0b94411040bb73ad2 \ + --hash=sha256:79c408fcf76a958491b4e3b103d1c417044544b68e96d06432a189b43d1215c8 \ + --hash=sha256:7a17ac1ea6ec3c7687d70201cfda3b1e8061466f28f686c24f627cae4ea8efd0 \ + --hash=sha256:7da8831f9a0fdb526621ba09a281fadc58ea12701bc709e7b8cbc362feabc295 \ + --hash=sha256:870b9a626280c86cff9c576ec0d9cbcc54a1e5ebda9cd26dab12baf41fee218c \ + --hash=sha256:88d1e966c9235c1d4e2afac21ca83933ba59537e2e2727a999bf3f515ca2af26 \ + --hash=sha256:88daaf7d146e48ec71212ce21109b66e06a98e5e44dca47d853cbfe171d6c8d2 \ + --hash=sha256:8a8b10fdb84a43e50d38057b06901ec9da52baac6983d3f709d8507f3889d43f \ + --hash=sha256:8b17ba27727a36cb73aabacaa44b13090feb88a01d012c0f4be70c00f75048b4 \ + --hash=sha256:8b65b53204fe1bd037c40c4148d00ef918eb2108d24c9aaa20bc31f9810ce0a8 \ + --hash=sha256:8ddb2bcfd1a8b9e431c8d6f4f7db0773084e107730ecf3472f1dfe9ad583f3d9 \ + --hash=sha256:96decdfc4adcbc087f5ea7ebdcfd3dee9a13358cae6e81d54be962efc38f6338 \ + --hash=sha256:996f2609ddf0142daba4cefd767d6db26958aac8439ee41db9cc0db9f4c4c3a6 \ + --hash=sha256:9d592d06e3cc2f537ceeeb23d38799c6ad83255289bb84c2e5792e5a8dea268a \ + --hash=sha256:a32747b1b39c3ac27d0670122b57e6e57f28eefb725e0b625618d1b59bf9d1e0 \ + --hash=sha256:a494554874691720ba5891c9b0b39474ba43ffb1aaf32a5dac874effb1619e1a \ + --hash=sha256:a8ef6e342c137888ebbfb233e02b8fbd689bb5b5fcc59b34711ac47ebd504478 \ + --hash=sha256:ae497b11f4c21558d95de9f64fff7053544f4d1a17731c866143ed6bb4591238 \ + --hash=sha256:b1ce7f41670c5a69e1389420436f41385b1aa2504c3b0c30620764b15dded2e7 \ + --hash=sha256:b8f93dcddb243159c9e4109c9750ba5b335ab8d48d9522c5308cd05d7e3ce600 \ + --hash=sha256:ba0c325c3f485dc54ec298d8b024e134acf07c10d494ffa24373bea729acf704 \ + --hash=sha256:bb29aaa613c0a1c40d1af111abf025f1732cab333f96f285d6a93b934738a68a \ + --hash=sha256:bba1be28247e68994355e028dcd668316db30c1f758d3241a7b903ac78dcd285 \ + --hash=sha256:cb643284ab0ed26f6957d969fe0dd8bb17beb567beb8998140b5e38a90974f6c \ + --hash=sha256:d182dac0221eb8faef2e6f44701812b467c02674a322c739355c39e94730cdbf \ + --hash=sha256:d275a9e3c81b1093c060c3837e580c37f47c51eca031f7b5fb76f7b8470f5f9b \ + --hash=sha256:d8b55ea20dc59b181d3f47103f113e6f28a5e1c89fd5b67b9140edb442ab67f2 \ + --hash=sha256:da8f41e602574ece93dbbda1fab24650d6bf2a24089f9e9dbb4f5730ec1e58ad \ + --hash=sha256:e4141c5a32b5e37905b5940aacbc59739f036930367d7acce7a64e4dec1f5e0b \ + --hash=sha256:f5be6b6bc52fad84d010cb45433720327ce886009d862f46b26d4d154001994b \ + --hash=sha256:f6d58656842e1b2ddbe07f43f56b10a60f2ba5826164910968f5933e5178af75 # via python-can -mypy==1.16.0 \ - --hash=sha256:021a68568082c5b36e977d54e8f1de978baf401a33884ffcea09bd8e88a98f4c \ - --hash=sha256:089bedc02307c2548eb51f426e085546db1fa7dd87fbb7c9fa561575cf6eb1ff \ - --hash=sha256:09a8da6a0ee9a9770b8ff61b39c0bb07971cda90e7297f4213741b48a0cc8d93 \ - --hash=sha256:0b07e107affb9ee6ce1f342c07f51552d126c32cd62955f59a7db94a51ad12c0 \ - --hash=sha256:15486beea80be24ff067d7d0ede673b001d0d684d0095803b3e6e17a886a2a92 \ - --hash=sha256:29e1499864a3888bca5c1542f2d7232c6e586295183320caa95758fc84034031 \ - --hash=sha256:2e7e0ad35275e02797323a5aa1be0b14a4d03ffdb2e5f2b0489fa07b89c67b21 \ - --hash=sha256:4086883a73166631307fdd330c4a9080ce24913d4f4c5ec596c601b3a4bdd777 \ - --hash=sha256:54066fed302d83bf5128632d05b4ec68412e1f03ef2c300434057d66866cea4b \ - --hash=sha256:55f9076c6ce55dd3f8cd0c6fff26a008ca8e5131b89d5ba6d86bd3f47e736eeb \ - --hash=sha256:6a2322896003ba66bbd1318c10d3afdfe24e78ef12ea10e2acd985e9d684a666 \ - --hash=sha256:7909541fef256527e5ee9c0a7e2aeed78b6cda72ba44298d1334fe7881b05c5c \ - --hash=sha256:82d056e6faa508501af333a6af192c700b33e15865bda49611e3d7d8358ebea2 \ - --hash=sha256:84b94283f817e2aa6350a14b4a8fb2a35a53c286f97c9d30f53b63620e7af8ab \ - --hash=sha256:936ccfdd749af4766be824268bfe22d1db9eb2f34a3ea1d00ffbe5b5265f5491 \ - --hash=sha256:9f826aaa7ff8443bac6a494cf743f591488ea940dd360e7dd330e30dd772a5ab \ - --hash=sha256:a5fcfdb7318c6a8dd127b14b1052743b83e97a970f0edb6c913211507a255e20 \ - --hash=sha256:a7e32297a437cc915599e0578fa6bc68ae6a8dc059c9e009c628e1c47f91495d \ - --hash=sha256:a9e056237c89f1587a3be1a3a70a06a698d25e2479b9a2f57325ddaaffc3567b \ - --hash=sha256:afe420c9380ccec31e744e8baff0d406c846683681025db3531b32db56962d52 \ - --hash=sha256:b4968f14f44c62e2ec4a038c8797a87315be8df7740dc3ee8d3bfe1c6bf5dba8 \ - --hash=sha256:bd4e1ebe126152a7bbaa4daedd781c90c8f9643c79b9748caa270ad542f12bec \ - --hash=sha256:c5436d11e89a3ad16ce8afe752f0f373ae9620841c50883dc96f8b8805620b13 \ - --hash=sha256:c6fb60cbd85dc65d4d63d37cb5c86f4e3a301ec605f606ae3a9173e5cf34997b \ - --hash=sha256:d045d33c284e10a038f5e29faca055b90eee87da3fc63b8889085744ebabb5a1 \ - --hash=sha256:e71d6f0090c2256c713ed3d52711d01859c82608b5d68d4fa01a3fe30df95571 \ - --hash=sha256:eb14a4a871bb8efb1e4a50360d4e3c8d6c601e7a31028a2c79f9bb659b63d730 \ - --hash=sha256:eb5fbc8063cb4fde7787e4c0406aa63094a34a2daf4673f359a1fb64050e9cb2 \ - --hash=sha256:f2622af30bf01d8fc36466231bdd203d120d7a599a6d88fb22bdcb9dbff84090 \ - --hash=sha256:f2ed0e0847a80655afa2c121835b848ed101cc7b8d8d6ecc5205aedc732b1436 \ - --hash=sha256:f56236114c425620875c7cf71700e3d60004858da856c6fc78998ffe767b73d3 \ - --hash=sha256:feec38097f71797da0231997e0de3a58108c51845399669ebc532c815f93866b +mypy==1.16.1 \ + --hash=sha256:051e1677689c9d9578b9c7f4d206d763f9bbd95723cd1416fad50db49d52f359 \ + --hash=sha256:08e850ea22adc4d8a4014651575567b0318ede51e8e9fe7a68f25391af699507 \ + --hash=sha256:09aa4f91ada245f0a45dbc47e548fd94e0dd5a8433e0114917dc3b526912a30c \ + --hash=sha256:0a7cfb0fe29fe5a9841b7c8ee6dffb52382c45acdf68f032145b75620acfbd6f \ + --hash=sha256:0ab5eca37b50188163fa7c1b73c685ac66c4e9bdee4a85c9adac0e91d8895e15 \ + --hash=sha256:1256688e284632382f8f3b9e2123df7d279f603c561f099758e66dd6ed4e8bd6 \ + --hash=sha256:13c7cd5b1cb2909aa318a90fd1b7e31f17c50b242953e7dd58345b2a814f6383 \ + --hash=sha256:1f0435cf920e287ff68af3d10a118a73f212deb2ce087619eb4e648116d1fe9b \ + --hash=sha256:211287e98e05352a2e1d4e8759c5490925a7c784ddc84207f4714822f8cf99b6 \ + --hash=sha256:22d76a63a42619bfb90122889b903519149879ddbf2ba4251834727944c8baca \ + --hash=sha256:2c7ce0662b6b9dc8f4ed86eb7a5d505ee3298c04b40ec13b30e572c0e5ae17c4 \ + --hash=sha256:352025753ef6a83cb9e7f2427319bb7875d1fdda8439d1e23de12ab164179574 \ + --hash=sha256:44e7acddb3c48bd2713994d098729494117803616e116032af192871aed80b79 \ + --hash=sha256:472e4e4c100062488ec643f6162dd0d5208e33e2f34544e1fc931372e806c0cc \ + --hash=sha256:4f58ac32771341e38a853c5d0ec0dfe27e18e27da9cdb8bbc882d2249c71a3ee \ + --hash=sha256:58e07fb958bc5d752a280da0e890c538f1515b79a65757bbdc54252ba82e0b40 \ + --hash=sha256:5e198ab3f55924c03ead626ff424cad1732d0d391478dfbf7bb97b34602395da \ + --hash=sha256:5fc2ac4027d0ef28d6ba69a0343737a23c4d1b83672bf38d1fe237bdc0643b37 \ + --hash=sha256:66df38405fd8466ce3517eda1f6640611a0b8e70895e2a9462d1d4323c5eb4b9 \ + --hash=sha256:6bd00a0a2094841c5e47e7374bb42b83d64c527a502e3334e1173a0c24437bab \ + --hash=sha256:7fc688329af6a287567f45cc1cefb9db662defeb14625213a5b7da6e692e2069 \ + --hash=sha256:86042bbf9f5a05ea000d3203cf87aa9d0ccf9a01f73f71c58979eb9249f46d72 \ + --hash=sha256:87ff2c13d58bdc4bbe7dc0dedfe622c0f04e2cb2a492269f3b418df2de05c536 \ + --hash=sha256:af4792433f09575d9eeca5c63d7d90ca4aeceda9d8355e136f80f8967639183d \ + --hash=sha256:b4f0fed1022a63c6fec38f28b7fc77fca47fd490445c69d0a66266c59dd0b88a \ + --hash=sha256:d5d2309511cc56c021b4b4e462907c2b12f669b2dbeb68300110ec27723971be \ + --hash=sha256:ddc91eb318c8751c69ddb200a5937f1232ee8efb4e64e9f4bc475a33719de438 \ + --hash=sha256:dedb6229b2c9086247e21a83c309754b9058b438704ad2f6807f0d8227f6ebdd \ + --hash=sha256:ea16e2a7d2714277e349e24d19a782a663a34ed60864006e8585db08f8ad1782 \ + --hash=sha256:ea7469ee5902c95542bea7ee545f7006508c65c8c54b06dc2c92676ce526f3ea \ + --hash=sha256:f895078594d918f93337a505f8add9bd654d1a24962b4c6ed9390e12531eb31b \ + --hash=sha256:ff9fa5b16e4c1364eb89a4d16bcda9987f05d39604e1e6c35378a2987c1aac2d # via -r requirements-actions.in mypy-extensions==1.1.0 \ --hash=sha256:1be4cccdb0f2482337c4743e60421de3a356cd97508abadd57d47403e94f5505 \ @@ -801,7 +814,9 @@ pluggy==1.6.0 \ ply==3.11 \ --hash=sha256:00c7c1aaa88358b9c765b6d3000c6eec0ba42abca5351b095321aef446081da3 \ --hash=sha256:096f9b8350b65ebd2fd1346b12452efe5b9607f7482813ffca50c22722a807ce - # via -r requirements-actions.in + # via + # -r requirements-actions.in + # spdx-tools polib==1.2.0 \ --hash=sha256:1c77ee1b81feb31df9bca258cbc58db1bbb32d10214b173882452c73af06d62d \ --hash=sha256:f3ef94aefed6e183e342a8a269ae1fc4742ba193186ad76f175938621dbfc26b @@ -869,6 +884,10 @@ pynacl==1.5.0 \ --hash=sha256:a422368fc821589c228f4c49438a368831cb5bbc0eab5ebe1d7fac9dded6567b \ --hash=sha256:e46dae94e34b085175f8abb3b0aaa7da40767865ac82c928eeb9e57e1ea8a543 # via pygithub +pyparsing==3.2.3 \ + --hash=sha256:a749938e02d6fd0b59b356ca504a24982314bb090c383e3cf201c95ef7e2bfcf \ + --hash=sha256:b9c13f1ab8b3b542f72e28f634bad4de758ab3ce4546e4301970ad6fa77c38be + # via rdflib pyproject-api==1.9.1 \ --hash=sha256:43c9918f49daab37e302038fc1aed54a8c7a91a9fa935d00b9a485f37e0f5335 \ --hash=sha256:7d6238d92f8962773dd75b5f0c4a6a27cce092a14b623b811dba656f3b628948 @@ -959,8 +978,13 @@ pyyaml==6.0.2 \ # via # -r requirements-actions.in # awscli + # spdx-tools # west # yamllint +rdflib==7.1.4 \ + --hash=sha256:72f4adb1990fa5241abd22ddaf36d7cafa5d91d9ff2ba13f3086d339b213d997 \ + --hash=sha256:fed46e24f26a788e2ab8e445f7077f00edcf95abb73bcef4b86cefa8b62dd174 + # via spdx-tools regex==2024.11.6 \ --hash=sha256:02a02d2bb04fec86ad61f3ea7f49c015a0681bf76abb9857f945d26159d2968c \ --hash=sha256:02e28184be537f0e75c1f9b2f8847dc51e08e6e171c6bde130b2687e0c33cf60 \ @@ -1057,17 +1081,17 @@ regex==2024.11.6 \ --hash=sha256:fdd6028445d2460f33136c55eeb1f601ab06d74cb3347132e1c24250187500d9 \ --hash=sha256:ff590880083d60acc0433f9c3f713c51f7ac6ebb9adf889c79a261ecf541aa91 # via sphinx-lint -requests==2.32.3 \ - --hash=sha256:55365417734eb18255590a9ff9eb97e9e1da868d4ccd6402399eaf68af20a760 \ - --hash=sha256:70761cfe03c773ceb22aa2f671b4757976145175cdfca038c02654d061d6dcc6 +requests==2.32.4 \ + --hash=sha256:27babd3cda2a6d50b30443204ee89830707d396671944c998b5975b031ac2b2c \ + --hash=sha256:27d0316682c8a29834d3264820024b62a36942083d52caf2f14c0591336d3422 # via pygithub rsa==4.7.2 \ --hash=sha256:78f9a9bf4e7be0c5ded4583326e7461e3a3c5aae24073648b4bdfa797d78c9d2 \ --hash=sha256:9d689e6ca1b3038bc82bf8d23e944b6b6037bc02301a574935b2dd946e0353b9 # via awscli -ruamel-yaml==0.18.12 \ - --hash=sha256:5a38fd5ce39d223bebb9e3a6779e86b9427a03fb0bf9f270060f8b149cffe5e2 \ - --hash=sha256:790ba4c48b6a6e6b12b532a7308779eb12d2aaab3a80fdb8389216f28ea2b287 +ruamel-yaml==0.18.14 \ + --hash=sha256:710ff198bb53da66718c7db27eec4fbcc9aa6ca7204e4c1df2f282b6fe5eb6b2 \ + --hash=sha256:7227b76aaec364df15936730efbf7d72b30c0b79b1d578bbb8e3dcb2d81f52b7 # via pykwalify ruamel-yaml-clib==0.2.12 ; python_full_version < '3.14' and platform_python_implementation == 'CPython' \ --hash=sha256:040ae85536960525ea62868b642bdb0c2cc6021c9f9d507810c0c604e66f5a7b \ @@ -1141,6 +1165,10 @@ s3transfer==0.13.0 \ --hash=sha256:0148ef34d6dd964d0d8cf4311b2b21c474693e57c2e069ec708ce043d2b527be \ --hash=sha256:f5e6db74eb7776a37208001113ea7aa97695368242b364d73e91c981ac522177 # via awscli +semantic-version==2.10.0 \ + --hash=sha256:bdabb6d336998cbb378d4b9db3a4b56a1e3235701dc05ea2690d9a997ed5041c \ + --hash=sha256:de78a3b8e0feda74cabc54aab2da702113e33ac9d9eb9d2389bcf1f58b7d9177 + # via spdx-tools setuptools==80.9.0 \ --hash=sha256:062d34222ad13e0cc312a4c02d73f059e86a4acbfbdea8f8f76b28c99f306922 \ --hash=sha256:f36b47402ecde768dbfafc46e8e4207b4360c654f1f3bb84475f0a28628fb19c @@ -1156,6 +1184,10 @@ smmap==5.0.2 \ --hash=sha256:26ea65a03958fa0c8a1c7e8c7a58fdc77221b8910f6be2131affade476898ad5 \ --hash=sha256:b30115f0def7d7531d22a0fb6502488d879e75b260a9db4d0819cfb25403af5e # via gitdb +spdx-tools==0.8.3 \ + --hash=sha256:638fd9bd8be61901316eb6d063574e16d5403a1870073ec4d9241426a997501a \ + --hash=sha256:68b8f9ce2893b5216bd90b2e63f1c821c2884e4ebc4fd295ebbf1fa8b8a94b93 + # via -r requirements-actions.in sphinx-lint==1.0.0 \ --hash=sha256:6117a0f340b2dc73eadfc57db7531d4477e0929f92a0c1a2f61e6edbc272f0bc \ --hash=sha256:6eafdb44172ce526f405bf36c713eb246f1340ec2d667e7298e2487ed76decd2 @@ -1204,9 +1236,9 @@ tomli==2.2.1 \ # pyproject-api # pytest # tox -tomlkit==0.13.2 \ - --hash=sha256:7a974427f6e119197f670fbbbeae7bef749a6c14e793db934baefc1b5f03efde \ - --hash=sha256:fff5fe59a87295b278abd31bec92c15d9bc4a06885ab12bcea52c71119392e79 +tomlkit==0.13.3 \ + --hash=sha256:430cf247ee57df2b94ee3fbe588e71d362a941ebb545dec29b53961d61add2a1 \ + --hash=sha256:c89c649d79ee40629a9fda55f8ace8c6a1b42deb912b2a8fd8d942ddadb606b0 # via pylint tox==4.26.0 \ --hash=sha256:75f17aaf09face9b97bd41645028d9f722301e912be8b4c65a3f938024560224 \ @@ -1227,6 +1259,10 @@ unidiff==0.7.5 \ --hash=sha256:2e5f0162052248946b9f0970a40e9e124236bf86c82b70821143a6fc1dea2574 \ --hash=sha256:c93bf2265cc1ba2a520e415ab05da587370bc2a3ae9e0414329f54f0c2fc09e8 # via -r requirements-actions.in +uritools==5.0.0 \ + --hash=sha256:68180cad154062bd5b5d9ffcdd464f8de6934414b25462ae807b00b8df9345de \ + --hash=sha256:cead3a49ba8fbca3f91857343849d506d8639718f4a2e51b62e87393b493bd6f + # via spdx-tools urllib3==2.4.0 \ --hash=sha256:414bc6535b787febd7567804cc015fee39daab8ad86268f1310a9250697de466 \ --hash=sha256:4e16665048960a0900c702d4a66415956a584919c03361cac9f1df5c5dd7e813 @@ -1334,6 +1370,10 @@ xlsxwriter==3.2.3 \ --hash=sha256:593f8296e8a91790c6d0378ab08b064f34a642b3feb787cf6738236bd0a4860d \ --hash=sha256:ad6fd41bdcf1b885876b1f6b7087560aecc9ae5a9cc2ba97dcac7ab2e210d3d5 # via -r requirements-actions.in +xmltodict==0.14.2 \ + --hash=sha256:201e7c28bb210e374999d1dde6382923ab0ed1a8a5faeece48ab525b7810a553 \ + --hash=sha256:20cc7d723ed729276e808f26fb6b3599f786cbc37e06c65e192ba77c40f20aac + # via spdx-tools yamllint==1.37.1 \ --hash=sha256:364f0d79e81409f591e323725e6a9f4504c8699ddf2d7263d8d2b539cd66a583 \ --hash=sha256:81f7c0c5559becc8049470d86046b36e96113637bcbe4753ecef06977c00245d diff --git a/scripts/requirements-run-test.txt b/scripts/requirements-run-test.txt index 08ff89b0c545..4b09fd1aa3a9 100644 --- a/scripts/requirements-run-test.txt +++ b/scripts/requirements-run-test.txt @@ -16,3 +16,6 @@ psutil>=5.6.6 # used for CAN <=> host testing python-can>=4.3.0 + +# used for SPDX files validation +spdx-tools diff --git a/tests/application_development/software_bill_of_materials/CMakeLists.txt b/tests/application_development/software_bill_of_materials/CMakeLists.txt index 90fa8976b917..4c07f6bb2383 100644 --- a/tests/application_development/software_bill_of_materials/CMakeLists.txt +++ b/tests/application_development/software_bill_of_materials/CMakeLists.txt @@ -10,4 +10,35 @@ target_sources(app PRIVATE ${ZEPHYR_BASE}/misc/empty_file.c) enable_testing() include(CTest) -add_test(NAME spdx_gen COMMAND west spdx -d ${CMAKE_BINARY_DIR}) +set( + SPDX_FILES + app.spdx + zephyr.spdx + build.spdx + modules-deps.spdx +) + +set(SPDX_VERSIONS_TO_TEST "2.2" "2.3") + +foreach(spdx_version ${SPDX_VERSIONS_TO_TEST}) + string(REPLACE "." "_" version_suffix ${spdx_version}) + + add_test( + NAME spdx_gen_${version_suffix} + COMMAND west spdx -d ${CMAKE_BINARY_DIR} --spdx-version ${spdx_version} + ) + + foreach(spdx_file ${SPDX_FILES}) + get_filename_component(basename ${spdx_file} NAME_WE) + + add_test( + NAME spdx_validate_${basename}_${version_suffix} + COMMAND pyspdxtools -i ${CMAKE_BINARY_DIR}/spdx/${spdx_file} + ) + + set_tests_properties( + spdx_validate_${basename}_${version_suffix} + PROPERTIES DEPENDS spdx_gen_${version_suffix} + ) + endforeach() +endforeach() diff --git a/tests/application_development/software_bill_of_materials/testcase.yaml b/tests/application_development/software_bill_of_materials/testcase.yaml index 8436b69fdbe9..3fd2eab28e29 100644 --- a/tests/application_development/software_bill_of_materials/testcase.yaml +++ b/tests/application_development/software_bill_of_materials/testcase.yaml @@ -2,7 +2,9 @@ common: tags: - spdx integration_platforms: - - native_sim + - qemu_cortex_m3 + platform_allow: + - qemu_cortex_m3 harness: ctest tests: buildsystem.sbom.spdx: {} From 3d07feb9692c2bb5bba03347e40f1151e000e8e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Thu, 12 Jun 2025 16:19:40 +0200 Subject: [PATCH 0784/2141] [nrf fromtree] doc: ci: Zephyr now requires Python 3.12 or higher MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update getting started guide, release notes, CI actions and Python version compliance check to use Python 3.12 as minimum supported version. Signed-off-by: Benjamin Cabé (cherry picked from commit 043bb5848871aad90ded036efd2b31060afbb8df) --- cmake/modules/python.cmake | 2 +- doc/develop/getting_started/index.rst | 2 +- doc/releases/migration-guide-4.2.rst | 5 + doc/requirements.txt | 801 +++++++++++++------------- scripts/ci/check_compliance.py | 2 +- scripts/requirements-actions.txt | 56 +- 6 files changed, 415 insertions(+), 453 deletions(-) diff --git a/cmake/modules/python.cmake b/cmake/modules/python.cmake index e01d31921202..1438c3fcdaa6 100644 --- a/cmake/modules/python.cmake +++ b/cmake/modules/python.cmake @@ -11,7 +11,7 @@ if (WIN32) set(ENV{PYTHONIOENCODING} "utf-8") endif() -set(PYTHON_MINIMUM_REQUIRED 3.10) +set(PYTHON_MINIMUM_REQUIRED 3.12) if(NOT DEFINED Python3_EXECUTABLE AND DEFINED WEST_PYTHON) set(Python3_EXECUTABLE "${WEST_PYTHON}") diff --git a/doc/develop/getting_started/index.rst b/doc/develop/getting_started/index.rst index 78f43e70b5fd..5ba0d070fcaf 100644 --- a/doc/develop/getting_started/index.rst +++ b/doc/develop/getting_started/index.rst @@ -62,7 +62,7 @@ The current minimum required version for the main dependencies are: - 3.20.5 * - `Python `_ - - 3.10 + - 3.12 * - `Devicetree compiler `_ - 1.4.6 diff --git a/doc/releases/migration-guide-4.2.rst b/doc/releases/migration-guide-4.2.rst index 9b31f4a16348..26e4bd655e7d 100644 --- a/doc/releases/migration-guide-4.2.rst +++ b/doc/releases/migration-guide-4.2.rst @@ -20,6 +20,11 @@ the :ref:`release notes`. :local: :depth: 2 +Common +****** + +* The minimum required Python version is now 3.12 (from 3.10). + Build System ************ diff --git a/doc/requirements.txt b/doc/requirements.txt index c10b390651a9..3d424a5627ee 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -1,5 +1,5 @@ # This file was autogenerated by uv via the following command: -# uv pip compile --universal --python-version 3.10 --generate-hashes requirements.in --output-file requirements.txt +# uv pip compile --universal --python-version 3.12 --generate-hashes requirements.in --output-file requirements.txt alabaster==1.0.0 \ --hash=sha256:c00dca57bca26fa62a6d7d0a9fcce65f3e026e9bfe33e9c538fd3fbb2144fd9e \ --hash=sha256:fc6786402dc3fcb2de3cabd5fe455a2db534b371124f1f21de8731783dec828b @@ -10,115 +10,115 @@ anyio==4.9.0 \ # via # starlette # watchfiles -anytree==2.12.1 \ - --hash=sha256:244def434ccf31b668ed282954e5d315b4e066c4940b94aff4a7962d85947830 \ - --hash=sha256:5ea9e61caf96db1e5b3d0a914378d2cd83c269dfce1fb8242ce96589fa3382f0 +anytree==2.13.0 \ + --hash=sha256:4cbcf10df36b1f1cba131b7e487ff3edafc9d6e932a3c70071b5b768bab901ff \ + --hash=sha256:c9d3aa6825fdd06af7ebb05b4ef291d2db63e62bb1f9b7d9b71354be9d362714 # via -r requirements.in babel==2.17.0 \ --hash=sha256:0c54cffb19f690cdcc52a3b50bcbf71e07a808d1c80d549f2459b9d2cf0afb9d \ --hash=sha256:4d0b53093fdfb4b21c92b5213dba5a1b23885afa8383709427046b21c366e5f2 # via sphinx -certifi==2025.1.31 \ - --hash=sha256:3d5da6925056f6f18f119200434a4780a94263f10d1c21d032a6f6b2baa20651 \ - --hash=sha256:ca78db4565a652026a4db2bcdf68f2fb589ea80d0be70e03929ed730746b84fe +certifi==2025.6.15 \ + --hash=sha256:2e0c7ce7cb5d8f8634ca55d2ba7e6ec2689a2fd6537d8dec1296a477a4910057 \ + --hash=sha256:d747aa5a8b9bbbb1bb8c22bb13e22bd1f18e9796defa16bab421f7f7a317323b # via requests -charset-normalizer==3.4.1 \ - --hash=sha256:0167ddc8ab6508fe81860a57dd472b2ef4060e8d378f0cc555707126830f2537 \ - --hash=sha256:01732659ba9b5b873fc117534143e4feefecf3b2078b0a6a2e925271bb6f4cfa \ - --hash=sha256:01ad647cdd609225c5350561d084b42ddf732f4eeefe6e678765636791e78b9a \ - --hash=sha256:04432ad9479fa40ec0f387795ddad4437a2b50417c69fa275e212933519ff294 \ - --hash=sha256:0907f11d019260cdc3f94fbdb23ff9125f6b5d1039b76003b5b0ac9d6a6c9d5b \ - --hash=sha256:0924e81d3d5e70f8126529951dac65c1010cdf117bb75eb02dd12339b57749dd \ - --hash=sha256:09b26ae6b1abf0d27570633b2b078a2a20419c99d66fb2823173d73f188ce601 \ - --hash=sha256:09b5e6733cbd160dcc09589227187e242a30a49ca5cefa5a7edd3f9d19ed53fd \ - --hash=sha256:0af291f4fe114be0280cdd29d533696a77b5b49cfde5467176ecab32353395c4 \ - --hash=sha256:0f55e69f030f7163dffe9fd0752b32f070566451afe180f99dbeeb81f511ad8d \ - --hash=sha256:1a2bc9f351a75ef49d664206d51f8e5ede9da246602dc2d2726837620ea034b2 \ - --hash=sha256:22e14b5d70560b8dd51ec22863f370d1e595ac3d024cb8ad7d308b4cd95f8313 \ - --hash=sha256:234ac59ea147c59ee4da87a0c0f098e9c8d169f4dc2a159ef720f1a61bbe27cd \ - --hash=sha256:2369eea1ee4a7610a860d88f268eb39b95cb588acd7235e02fd5a5601773d4fa \ - --hash=sha256:237bdbe6159cff53b4f24f397d43c6336c6b0b42affbe857970cefbb620911c8 \ - --hash=sha256:28bf57629c75e810b6ae989f03c0828d64d6b26a5e205535585f96093e405ed1 \ - --hash=sha256:2967f74ad52c3b98de4c3b32e1a44e32975e008a9cd2a8cc8966d6a5218c5cb2 \ - --hash=sha256:2a75d49014d118e4198bcee5ee0a6f25856b29b12dbf7cd012791f8a6cc5c496 \ - --hash=sha256:2bdfe3ac2e1bbe5b59a1a63721eb3b95fc9b6817ae4a46debbb4e11f6232428d \ - --hash=sha256:2d074908e1aecee37a7635990b2c6d504cd4766c7bc9fc86d63f9c09af3fa11b \ - --hash=sha256:2fb9bd477fdea8684f78791a6de97a953c51831ee2981f8e4f583ff3b9d9687e \ - --hash=sha256:311f30128d7d333eebd7896965bfcfbd0065f1716ec92bd5638d7748eb6f936a \ - --hash=sha256:329ce159e82018d646c7ac45b01a430369d526569ec08516081727a20e9e4af4 \ - --hash=sha256:345b0426edd4e18138d6528aed636de7a9ed169b4aaf9d61a8c19e39d26838ca \ - --hash=sha256:363e2f92b0f0174b2f8238240a1a30142e3db7b957a5dd5689b0e75fb717cc78 \ - --hash=sha256:3a3bd0dcd373514dcec91c411ddb9632c0d7d92aed7093b8c3bbb6d69ca74408 \ - --hash=sha256:3bed14e9c89dcb10e8f3a29f9ccac4955aebe93c71ae803af79265c9ca5644c5 \ - --hash=sha256:44251f18cd68a75b56585dd00dae26183e102cd5e0f9f1466e6df5da2ed64ea3 \ - --hash=sha256:44ecbf16649486d4aebafeaa7ec4c9fed8b88101f4dd612dcaf65d5e815f837f \ - --hash=sha256:4532bff1b8421fd0a320463030c7520f56a79c9024a4e88f01c537316019005a \ - --hash=sha256:49402233c892a461407c512a19435d1ce275543138294f7ef013f0b63d5d3765 \ - --hash=sha256:4c0907b1928a36d5a998d72d64d8eaa7244989f7aaaf947500d3a800c83a3fd6 \ - --hash=sha256:4d86f7aff21ee58f26dcf5ae81a9addbd914115cdebcbb2217e4f0ed8982e146 \ - --hash=sha256:5777ee0881f9499ed0f71cc82cf873d9a0ca8af166dfa0af8ec4e675b7df48e6 \ - --hash=sha256:5df196eb874dae23dcfb968c83d4f8fdccb333330fe1fc278ac5ceeb101003a9 \ - --hash=sha256:619a609aa74ae43d90ed2e89bdd784765de0a25ca761b93e196d938b8fd1dbbd \ - --hash=sha256:6e27f48bcd0957c6d4cb9d6fa6b61d192d0b13d5ef563e5f2ae35feafc0d179c \ - --hash=sha256:6ff8a4a60c227ad87030d76e99cd1698345d4491638dfa6673027c48b3cd395f \ - --hash=sha256:73d94b58ec7fecbc7366247d3b0b10a21681004153238750bb67bd9012414545 \ - --hash=sha256:7461baadb4dc00fd9e0acbe254e3d7d2112e7f92ced2adc96e54ef6501c5f176 \ - --hash=sha256:75832c08354f595c760a804588b9357d34ec00ba1c940c15e31e96d902093770 \ - --hash=sha256:7709f51f5f7c853f0fb938bcd3bc59cdfdc5203635ffd18bf354f6967ea0f824 \ - --hash=sha256:78baa6d91634dfb69ec52a463534bc0df05dbd546209b79a3880a34487f4b84f \ - --hash=sha256:7974a0b5ecd505609e3b19742b60cee7aa2aa2fb3151bc917e6e2646d7667dcf \ - --hash=sha256:7a4f97a081603d2050bfaffdefa5b02a9ec823f8348a572e39032caa8404a487 \ - --hash=sha256:7b1bef6280950ee6c177b326508f86cad7ad4dff12454483b51d8b7d673a2c5d \ - --hash=sha256:7d053096f67cd1241601111b698f5cad775f97ab25d81567d3f59219b5f1adbd \ - --hash=sha256:804a4d582ba6e5b747c625bf1255e6b1507465494a40a2130978bda7b932c90b \ - --hash=sha256:807f52c1f798eef6cf26beb819eeb8819b1622ddfeef9d0977a8502d4db6d534 \ - --hash=sha256:80ed5e856eb7f30115aaf94e4a08114ccc8813e6ed1b5efa74f9f82e8509858f \ - --hash=sha256:8417cb1f36cc0bc7eaba8ccb0e04d55f0ee52df06df3ad55259b9a323555fc8b \ - --hash=sha256:8436c508b408b82d87dc5f62496973a1805cd46727c34440b0d29d8a2f50a6c9 \ - --hash=sha256:89149166622f4db9b4b6a449256291dc87a99ee53151c74cbd82a53c8c2f6ccd \ - --hash=sha256:8bfa33f4f2672964266e940dd22a195989ba31669bd84629f05fab3ef4e2d125 \ - --hash=sha256:8c60ca7339acd497a55b0ea5d506b2a2612afb2826560416f6894e8b5770d4a9 \ - --hash=sha256:91b36a978b5ae0ee86c394f5a54d6ef44db1de0815eb43de826d41d21e4af3de \ - --hash=sha256:955f8851919303c92343d2f66165294848d57e9bba6cf6e3625485a70a038d11 \ - --hash=sha256:97f68b8d6831127e4787ad15e6757232e14e12060bec17091b85eb1486b91d8d \ - --hash=sha256:9b23ca7ef998bc739bf6ffc077c2116917eabcc901f88da1b9856b210ef63f35 \ - --hash=sha256:9f0b8b1c6d84c8034a44893aba5e767bf9c7a211e313a9605d9c617d7083829f \ - --hash=sha256:aabfa34badd18f1da5ec1bc2715cadc8dca465868a4e73a0173466b688f29dda \ - --hash=sha256:ab36c8eb7e454e34e60eb55ca5d241a5d18b2c6244f6827a30e451c42410b5f7 \ - --hash=sha256:b010a7a4fd316c3c484d482922d13044979e78d1861f0e0650423144c616a46a \ - --hash=sha256:b1ac5992a838106edb89654e0aebfc24f5848ae2547d22c2c3f66454daa11971 \ - --hash=sha256:b7b2d86dd06bfc2ade3312a83a5c364c7ec2e3498f8734282c6c3d4b07b346b8 \ - --hash=sha256:b97e690a2118911e39b4042088092771b4ae3fc3aa86518f84b8cf6888dbdb41 \ - --hash=sha256:bc2722592d8998c870fa4e290c2eec2c1569b87fe58618e67d38b4665dfa680d \ - --hash=sha256:c0429126cf75e16c4f0ad00ee0eae4242dc652290f940152ca8c75c3a4b6ee8f \ - --hash=sha256:c30197aa96e8eed02200a83fba2657b4c3acd0f0aa4bdc9f6c1af8e8962e0757 \ - --hash=sha256:c4c3e6da02df6fa1410a7680bd3f63d4f710232d3139089536310d027950696a \ - --hash=sha256:c75cb2a3e389853835e84a2d8fb2b81a10645b503eca9bcb98df6b5a43eb8886 \ - --hash=sha256:c96836c97b1238e9c9e3fe90844c947d5afbf4f4c92762679acfe19927d81d77 \ - --hash=sha256:d7f50a1f8c450f3925cb367d011448c39239bb3eb4117c36a6d354794de4ce76 \ - --hash=sha256:d973f03c0cb71c5ed99037b870f2be986c3c05e63622c017ea9816881d2dd247 \ - --hash=sha256:d98b1668f06378c6dbefec3b92299716b931cd4e6061f3c875a71ced1780ab85 \ - --hash=sha256:d9c3cdf5390dcd29aa8056d13e8e99526cda0305acc038b96b30352aff5ff2bb \ - --hash=sha256:dad3e487649f498dd991eeb901125411559b22e8d7ab25d3aeb1af367df5efd7 \ - --hash=sha256:dccbe65bd2f7f7ec22c4ff99ed56faa1e9f785482b9bbd7c717e26fd723a1d1e \ - --hash=sha256:dd78cfcda14a1ef52584dbb008f7ac81c1328c0f58184bf9a84c49c605002da6 \ - --hash=sha256:e218488cd232553829be0664c2292d3af2eeeb94b32bea483cf79ac6a694e037 \ - --hash=sha256:e358e64305fe12299a08e08978f51fc21fac060dcfcddd95453eabe5b93ed0e1 \ - --hash=sha256:ea0d8d539afa5eb2728aa1932a988a9a7af94f18582ffae4bc10b3fbdad0626e \ - --hash=sha256:eab677309cdb30d047996b36d34caeda1dc91149e4fdca0b1a039b3f79d9a807 \ - --hash=sha256:eb8178fe3dba6450a3e024e95ac49ed3400e506fd4e9e5c32d30adda88cbd407 \ - --hash=sha256:ecddf25bee22fe4fe3737a399d0d177d72bc22be6913acfab364b40bce1ba83c \ - --hash=sha256:eea6ee1db730b3483adf394ea72f808b6e18cf3cb6454b4d86e04fa8c4327a12 \ - --hash=sha256:f08ff5e948271dc7e18a35641d2f11a4cd8dfd5634f55228b691e62b37125eb3 \ - --hash=sha256:f30bf9fd9be89ecb2360c7d94a711f00c09b976258846efe40db3d05828e8089 \ - --hash=sha256:fa88b843d6e211393a37219e6a1c1df99d35e8fd90446f1118f4216e307e48cd \ - --hash=sha256:fc54db6c8593ef7d4b2a331b58653356cf04f67c960f584edb7c3d8c97e8f39e \ - --hash=sha256:fd4ec41f914fa74ad1b8304bbc634b3de73d2a0889bd32076342a573e0779e00 \ - --hash=sha256:ffc9202a29ab3920fa812879e95a9e78b2465fd10be7fcbd042899695d75e616 +charset-normalizer==3.4.2 \ + --hash=sha256:005fa3432484527f9732ebd315da8da8001593e2cf46a3d817669f062c3d9ed4 \ + --hash=sha256:046595208aae0120559a67693ecc65dd75d46f7bf687f159127046628178dc45 \ + --hash=sha256:0c29de6a1a95f24b9a1aa7aefd27d2487263f00dfd55a77719b530788f75cff7 \ + --hash=sha256:0c8c57f84ccfc871a48a47321cfa49ae1df56cd1d965a09abe84066f6853b9c0 \ + --hash=sha256:0f5d9ed7f254402c9e7d35d2f5972c9bbea9040e99cd2861bd77dc68263277c7 \ + --hash=sha256:18dd2e350387c87dabe711b86f83c9c78af772c748904d372ade190b5c7c9d4d \ + --hash=sha256:1b1bde144d98e446b056ef98e59c256e9294f6b74d7af6846bf5ffdafd687a7d \ + --hash=sha256:1c95a1e2902a8b722868587c0e1184ad5c55631de5afc0eb96bc4b0d738092c0 \ + --hash=sha256:1cad5f45b3146325bb38d6855642f6fd609c3f7cad4dbaf75549bf3b904d3184 \ + --hash=sha256:21b2899062867b0e1fde9b724f8aecb1af14f2778d69aacd1a5a1853a597a5db \ + --hash=sha256:24498ba8ed6c2e0b56d4acbf83f2d989720a93b41d712ebd4f4979660db4417b \ + --hash=sha256:25a23ea5c7edc53e0f29bae2c44fcb5a1aa10591aae107f2a2b2583a9c5cbc64 \ + --hash=sha256:289200a18fa698949d2b39c671c2cc7a24d44096784e76614899a7ccf2574b7b \ + --hash=sha256:28a1005facc94196e1fb3e82a3d442a9d9110b8434fc1ded7a24a2983c9888d8 \ + --hash=sha256:32fc0341d72e0f73f80acb0a2c94216bd704f4f0bce10aedea38f30502b271ff \ + --hash=sha256:36b31da18b8890a76ec181c3cf44326bf2c48e36d393ca1b72b3f484113ea344 \ + --hash=sha256:3c21d4fca343c805a52c0c78edc01e3477f6dd1ad7c47653241cf2a206d4fc58 \ + --hash=sha256:3fddb7e2c84ac87ac3a947cb4e66d143ca5863ef48e4a5ecb83bd48619e4634e \ + --hash=sha256:43e0933a0eff183ee85833f341ec567c0980dae57c464d8a508e1b2ceb336471 \ + --hash=sha256:4a476b06fbcf359ad25d34a057b7219281286ae2477cc5ff5e3f70a246971148 \ + --hash=sha256:4e594135de17ab3866138f496755f302b72157d115086d100c3f19370839dd3a \ + --hash=sha256:50bf98d5e563b83cc29471fa114366e6806bc06bc7a25fd59641e41445327836 \ + --hash=sha256:5a9979887252a82fefd3d3ed2a8e3b937a7a809f65dcb1e068b090e165bbe99e \ + --hash=sha256:5baececa9ecba31eff645232d59845c07aa030f0c81ee70184a90d35099a0e63 \ + --hash=sha256:5bf4545e3b962767e5c06fe1738f951f77d27967cb2caa64c28be7c4563e162c \ + --hash=sha256:6333b3aa5a12c26b2a4d4e7335a28f1475e0e5e17d69d55141ee3cab736f66d1 \ + --hash=sha256:65c981bdbd3f57670af8b59777cbfae75364b483fa8a9f420f08094531d54a01 \ + --hash=sha256:68a328e5f55ec37c57f19ebb1fdc56a248db2e3e9ad769919a58672958e8f366 \ + --hash=sha256:6a0289e4589e8bdfef02a80478f1dfcb14f0ab696b5a00e1f4b8a14a307a3c58 \ + --hash=sha256:6b66f92b17849b85cad91259efc341dce9c1af48e2173bf38a85c6329f1033e5 \ + --hash=sha256:6c9379d65defcab82d07b2a9dfbfc2e95bc8fe0ebb1b176a3190230a3ef0e07c \ + --hash=sha256:6fc1f5b51fa4cecaa18f2bd7a003f3dd039dd615cd69a2afd6d3b19aed6775f2 \ + --hash=sha256:70f7172939fdf8790425ba31915bfbe8335030f05b9913d7ae00a87d4395620a \ + --hash=sha256:721c76e84fe669be19c5791da68232ca2e05ba5185575086e384352e2c309597 \ + --hash=sha256:7222ffd5e4de8e57e03ce2cef95a4c43c98fcb72ad86909abdfc2c17d227fc1b \ + --hash=sha256:75d10d37a47afee94919c4fab4c22b9bc2a8bf7d4f46f87363bcf0573f3ff4f5 \ + --hash=sha256:76af085e67e56c8816c3ccf256ebd136def2ed9654525348cfa744b6802b69eb \ + --hash=sha256:770cab594ecf99ae64c236bc9ee3439c3f46be49796e265ce0cc8bc17b10294f \ + --hash=sha256:7a6ab32f7210554a96cd9e33abe3ddd86732beeafc7a28e9955cdf22ffadbab0 \ + --hash=sha256:7c48ed483eb946e6c04ccbe02c6b4d1d48e51944b6db70f697e089c193404941 \ + --hash=sha256:7f56930ab0abd1c45cd15be65cc741c28b1c9a34876ce8c17a2fa107810c0af0 \ + --hash=sha256:8075c35cd58273fee266c58c0c9b670947c19df5fb98e7b66710e04ad4e9ff86 \ + --hash=sha256:8272b73e1c5603666618805fe821edba66892e2870058c94c53147602eab29c7 \ + --hash=sha256:82d8fd25b7f4675d0c47cf95b594d4e7b158aca33b76aa63d07186e13c0e0ab7 \ + --hash=sha256:844da2b5728b5ce0e32d863af26f32b5ce61bc4273a9c720a9f3aa9df73b1455 \ + --hash=sha256:8755483f3c00d6c9a77f490c17e6ab0c8729e39e6390328e42521ef175380ae6 \ + --hash=sha256:915f3849a011c1f593ab99092f3cecfcb4d65d8feb4a64cf1bf2d22074dc0ec4 \ + --hash=sha256:926ca93accd5d36ccdabd803392ddc3e03e6d4cd1cf17deff3b989ab8e9dbcf0 \ + --hash=sha256:982bb1e8b4ffda883b3d0a521e23abcd6fd17418f6d2c4118d257a10199c0ce3 \ + --hash=sha256:98f862da73774290f251b9df8d11161b6cf25b599a66baf087c1ffe340e9bfd1 \ + --hash=sha256:9cbfacf36cb0ec2897ce0ebc5d08ca44213af24265bd56eca54bee7923c48fd6 \ + --hash=sha256:a370b3e078e418187da8c3674eddb9d983ec09445c99a3a263c2011993522981 \ + --hash=sha256:a955b438e62efdf7e0b7b52a64dc5c3396e2634baa62471768a64bc2adb73d5c \ + --hash=sha256:aa6af9e7d59f9c12b33ae4e9450619cf2488e2bbe9b44030905877f0b2324980 \ + --hash=sha256:aa88ca0b1932e93f2d961bf3addbb2db902198dca337d88c89e1559e066e7645 \ + --hash=sha256:aaeeb6a479c7667fbe1099af9617c83aaca22182d6cf8c53966491a0f1b7ffb7 \ + --hash=sha256:aaf27faa992bfee0264dc1f03f4c75e9fcdda66a519db6b957a3f826e285cf12 \ + --hash=sha256:b2680962a4848b3c4f155dc2ee64505a9c57186d0d56b43123b17ca3de18f0fa \ + --hash=sha256:b2d318c11350e10662026ad0eb71bb51c7812fc8590825304ae0bdd4ac283acd \ + --hash=sha256:b33de11b92e9f75a2b545d6e9b6f37e398d86c3e9e9653c4864eb7e89c5773ef \ + --hash=sha256:b3daeac64d5b371dea99714f08ffc2c208522ec6b06fbc7866a450dd446f5c0f \ + --hash=sha256:be1e352acbe3c78727a16a455126d9ff83ea2dfdcbc83148d2982305a04714c2 \ + --hash=sha256:bee093bf902e1d8fc0ac143c88902c3dfc8941f7ea1d6a8dd2bcb786d33db03d \ + --hash=sha256:c72fbbe68c6f32f251bdc08b8611c7b3060612236e960ef848e0a517ddbe76c5 \ + --hash=sha256:c9e36a97bee9b86ef9a1cf7bb96747eb7a15c2f22bdb5b516434b00f2a599f02 \ + --hash=sha256:cddf7bd982eaa998934a91f69d182aec997c6c468898efe6679af88283b498d3 \ + --hash=sha256:cf713fe9a71ef6fd5adf7a79670135081cd4431c2943864757f0fa3a65b1fafd \ + --hash=sha256:d11b54acf878eef558599658b0ffca78138c8c3655cf4f3a4a673c437e67732e \ + --hash=sha256:d41c4d287cfc69060fa91cae9683eacffad989f1a10811995fa309df656ec214 \ + --hash=sha256:d524ba3f1581b35c03cb42beebab4a13e6cdad7b36246bd22541fa585a56cccd \ + --hash=sha256:daac4765328a919a805fa5e2720f3e94767abd632ae410a9062dff5412bae65a \ + --hash=sha256:db4c7bf0e07fc3b7d89ac2a5880a6a8062056801b83ff56d8464b70f65482b6c \ + --hash=sha256:dc7039885fa1baf9be153a0626e337aa7ec8bf96b0128605fb0d77788ddc1681 \ + --hash=sha256:dccab8d5fa1ef9bfba0590ecf4d46df048d18ffe3eec01eeb73a42e0d9e7a8ba \ + --hash=sha256:dedb8adb91d11846ee08bec4c8236c8549ac721c245678282dcb06b221aab59f \ + --hash=sha256:e45ba65510e2647721e35323d6ef54c7974959f6081b58d4ef5d87c60c84919a \ + --hash=sha256:e53efc7c7cee4c1e70661e2e112ca46a575f90ed9ae3fef200f2a25e954f4b28 \ + --hash=sha256:e635b87f01ebc977342e2697d05b56632f5f879a4f15955dfe8cef2448b51691 \ + --hash=sha256:e70e990b2137b29dc5564715de1e12701815dacc1d056308e2b17e9095372a82 \ + --hash=sha256:e8082b26888e2f8b36a042a58307d5b917ef2b1cacab921ad3323ef91901c71a \ + --hash=sha256:e8323a9b031aa0393768b87f04b4164a40037fb2a3c11ac06a03ffecd3618027 \ + --hash=sha256:e92fca20c46e9f5e1bb485887d074918b13543b1c2a1185e69bb8d17ab6236a7 \ + --hash=sha256:eb30abc20df9ab0814b5a2524f23d75dcf83cde762c161917a2b4b7b55b1e518 \ + --hash=sha256:eba9904b0f38a143592d9fc0e19e2df0fa2e41c3c3745554761c5f6447eedabf \ + --hash=sha256:ef8de666d6179b009dce7bcb2ad4c4a779f113f12caf8dc77f0162c29d20490b \ + --hash=sha256:efd387a49825780ff861998cd959767800d54f8308936b21025326de4b5a42b9 \ + --hash=sha256:f0aa37f3c979cf2546b73e8222bbfa3dc07a641585340179d768068e3455e544 \ + --hash=sha256:f4074c5a429281bf056ddd4c5d3b740ebca4d43ffffe2ef4bf4d2d05114299da \ + --hash=sha256:f69a27e45c43520f5487f27627059b64aaf160415589230992cec34c5e18a509 \ + --hash=sha256:fb707f3e15060adf5b7ada797624a6c6e0138e2a26baa089df64c68ee98e040f \ + --hash=sha256:fcbe676a55d7445b22c10967bceaaf0ee69407fbe0ece4d032b6eb8d4565982a \ + --hash=sha256:fdb20a30fe1175ecabed17cbf7812f7b804b8a315a25f24678bcdf120a90077f # via requests -click==8.1.8 \ - --hash=sha256:63c132bbbed01578a06712a2d1f497bb62d9c1c0d329b7903a866228027263b2 \ - --hash=sha256:ed53c9d8990d83c2a27deae68e4ee337473f6330c040a31d4225c9574d16096a +click==8.2.1 \ + --hash=sha256:27c491cc05d968d271d5a1db13e3b5a184636d9d930f148c50b038f0d0646202 \ + --hash=sha256:61a3265b914e850b85317d0b3109c7f8cd35a670f963866005d6ef1d5175a12b # via uvicorn colorama==0.4.6 \ --hash=sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44 \ @@ -142,18 +142,12 @@ docutils==0.21.2 \ # sphinx-rtd-theme # sphinx-tabs # sphinx-togglebutton -doxmlparser==1.13.2 \ - --hash=sha256:65ab126e7d3f77b1bb15fa6886663614f68d0473b48831e1fb822f533243eb68 +doxmlparser==1.14.0 \ + --hash=sha256:1037dcc4aadf908feb2d908685159972bb2975322fbe2b120f5cac5a938f0b14 # via -r requirements.in -exceptiongroup==1.2.2 ; python_full_version < '3.11' \ - --hash=sha256:3111b9d131c238bec2f8f516e123e14ba243563fb135d3fe885990585aa7795b \ - --hash=sha256:47c2edf7c6738fafb49fd34290706d1a1a2f4d1c6df275526b62cbb4aa5393cc - # via - # anyio - # pytest -h11==0.14.0 \ - --hash=sha256:8f19fbbe99e72420ff35c00b27a34cb9937e902a8b810e2c88300c6f0a3b699d \ - --hash=sha256:e3fe4ac4b851c468cc8363d500db52c2ead036020723024a109d37346efaa761 +h11==0.16.0 \ + --hash=sha256:4e35b956cf45792e4caa5885e69fba00bdbc6ffafbfa020300e549b208ee5ff1 \ + --hash=sha256:63cf8bbe7522de3bf65932fda1d9c2772064ffb3dae62d55932da54b31cb6c86 # via uvicorn idna==3.10 \ --hash=sha256:12f65c9b470abda6dc35cf8e63cc574b1c52b11df2c86030af0ac09b01b13ea9 \ @@ -173,145 +167,139 @@ jinja2==3.1.6 \ --hash=sha256:0137fb05990d35f1275a587e9aee6d56da821fc83491a0fb838183be43f66d6d \ --hash=sha256:85ece4451f492d0c13c5dd7c13a64681a86afae63a5f347908daf103ce6d2f67 # via sphinx -lxml==5.3.1 \ - --hash=sha256:016b96c58e9a4528219bb563acf1aaaa8bc5452e7651004894a973f03b84ba81 \ - --hash=sha256:05123fad495a429f123307ac6d8fd6f977b71e9a0b6d9aeeb8f80c017cb17131 \ - --hash=sha256:057e30d0012439bc54ca427a83d458752ccda725c1c161cc283db07bcad43cf9 \ - --hash=sha256:06a20d607a86fccab2fc15a77aa445f2bdef7b49ec0520a842c5c5afd8381576 \ - --hash=sha256:094b28ed8a8a072b9e9e2113a81fda668d2053f2ca9f2d202c2c8c7c2d6516b1 \ - --hash=sha256:0bcfadea3cdc68e678d2b20cb16a16716887dd00a881e16f7d806c2138b8ff0c \ - --hash=sha256:0d6b2fa86becfa81f0a0271ccb9eb127ad45fb597733a77b92e8a35e53414914 \ - --hash=sha256:0f2cfae0688fd01f7056a17367e3b84f37c545fb447d7282cf2c242b16262607 \ - --hash=sha256:106b7b5d2977b339f1e97efe2778e2ab20e99994cbb0ec5e55771ed0795920c8 \ - --hash=sha256:133f3493253a00db2c870d3740bc458ebb7d937bd0a6a4f9328373e0db305709 \ - --hash=sha256:136bf638d92848a939fd8f0e06fcf92d9f2e4b57969d94faae27c55f3d85c05b \ - --hash=sha256:155e1a5693cf4b55af652f5c0f78ef36596c7f680ff3ec6eb4d7d85367259b2c \ - --hash=sha256:1637fa31ec682cd5760092adfabe86d9b718a75d43e65e211d5931809bc111e7 \ - --hash=sha256:172d65f7c72a35a6879217bcdb4bb11bc88d55fb4879e7569f55616062d387c2 \ - --hash=sha256:17b5d7f8acf809465086d498d62a981fa6a56d2718135bb0e4aa48c502055f5c \ - --hash=sha256:198bb4b4dd888e8390afa4f170d4fa28467a7eaf857f1952589f16cfbb67af27 \ - --hash=sha256:1b6f92e35e2658a5ed51c6634ceb5ddae32053182851d8cad2a5bc102a359b33 \ - --hash=sha256:1b92fe86e04f680b848fff594a908edfa72b31bfc3499ef7433790c11d4c8cd8 \ - --hash=sha256:1bcc211542f7af6f2dfb705f5f8b74e865592778e6cafdfd19c792c244ccce19 \ - --hash=sha256:1c93ed3c998ea8472be98fb55aed65b5198740bfceaec07b2eba551e55b7b9ae \ - --hash=sha256:203b1d3eaebd34277be06a3eb880050f18a4e4d60861efba4fb946e31071a295 \ - --hash=sha256:22ec2b3c191f43ed21f9545e9df94c37c6b49a5af0a874008ddc9132d49a2d9c \ - --hash=sha256:231cf4d140b22a923b1d0a0a4e0b4f972e5893efcdec188934cc65888fd0227b \ - --hash=sha256:236610b77589faf462337b3305a1be91756c8abc5a45ff7ca8f245a71c5dab70 \ - --hash=sha256:29bfc8d3d88e56ea0a27e7c4897b642706840247f59f4377d81be8f32aa0cfbf \ - --hash=sha256:2b8969dbc8d09d9cd2ae06362c3bad27d03f433252601ef658a49bd9f2b22d79 \ - --hash=sha256:2dd0b80ac2d8f13ffc906123a6f20b459cb50a99222d0da492360512f3e50f84 \ - --hash=sha256:2df7ed5edeb6bd5590914cd61df76eb6cce9d590ed04ec7c183cf5509f73530d \ - --hash=sha256:2e4a570f6a99e96c457f7bec5ad459c9c420ee80b99eb04cbfcfe3fc18ec6423 \ - --hash=sha256:2f1be45d4c15f237209bbf123a0e05b5d630c8717c42f59f31ea9eae2ad89394 \ - --hash=sha256:2f23cf50eccb3255b6e913188291af0150d89dab44137a69e14e4dcb7be981f1 \ - --hash=sha256:3031e4c16b59424e8d78522c69b062d301d951dc55ad8685736c3335a97fc270 \ - --hash=sha256:33e06717c00c788ab4e79bc4726ecc50c54b9bfb55355eae21473c145d83c2d2 \ - --hash=sha256:364de8f57d6eda0c16dcfb999af902da31396949efa0e583e12675d09709881b \ - --hash=sha256:3715cdf0dd31b836433af9ee9197af10e3df41d273c19bb249230043667a5dfd \ - --hash=sha256:3bb8149840daf2c3f97cebf00e4ed4a65a0baff888bf2605a8d0135ff5cf764e \ - --hash=sha256:3c3c8b55c7fc7b7e8877b9366568cc73d68b82da7fe33d8b98527b73857a225f \ - --hash=sha256:3d68eeef7b4d08a25e51897dac29bcb62aba830e9ac6c4e3297ee7c6a0cf6439 \ - --hash=sha256:3dddf0fb832486cc1ea71d189cb92eb887826e8deebe128884e15020bb6e3f61 \ - --hash=sha256:3edbb9c9130bac05d8c3fe150c51c337a471cc7fdb6d2a0a7d3a88e88a829314 \ - --hash=sha256:3effe081b3135237da6e4c4530ff2a868d3f80be0bda027e118a5971285d42d0 \ - --hash=sha256:422c179022ecdedbe58b0e242607198580804253da220e9454ffe848daa1cfd2 \ - --hash=sha256:42978a68d3825eaac55399eb37a4d52012a205c0c6262199b8b44fcc6fd686e8 \ - --hash=sha256:4399b4226c4785575fb20998dc571bc48125dc92c367ce2602d0d70e0c455eb0 \ - --hash=sha256:45fbb70ccbc8683f2fb58bea89498a7274af1d9ec7995e9f4af5604e028233fc \ - --hash=sha256:4867361c049761a56bd21de507cab2c2a608c55102311d142ade7dab67b34f32 \ - --hash=sha256:48fd46bf7155def2e15287c6f2b133a2f78e2d22cdf55647269977b873c65499 \ - --hash=sha256:4b0d5cdba1b655d5b18042ac9c9ff50bda33568eb80feaaca4fc237b9c4fbfde \ - --hash=sha256:4df0ec814b50275ad6a99bc82a38b59f90e10e47714ac9871e1b223895825468 \ - --hash=sha256:4e52e1b148867b01c05e21837586ee307a01e793b94072d7c7b91d2c2da02ffe \ - --hash=sha256:514fe78fc4b87e7a7601c92492210b20a1b0c6ab20e71e81307d9c2e377c64de \ - --hash=sha256:524ccfded8989a6595dbdda80d779fb977dbc9a7bc458864fc9a0c2fc15dc877 \ - --hash=sha256:528f3a0498a8edc69af0559bdcf8a9f5a8bf7c00051a6ef3141fdcf27017bbf5 \ - --hash=sha256:52d82b0d436edd6a1d22d94a344b9a58abd6c68c357ed44f22d4ba8179b37629 \ - --hash=sha256:5412500e0dc5481b1ee9cf6b38bb3b473f6e411eb62b83dc9b62699c3b7b79f7 \ - --hash=sha256:585c4dc429deebc4307187d2b71ebe914843185ae16a4d582ee030e6cfbb4d8a \ - --hash=sha256:5865b270b420eda7b68928d70bb517ccbe045e53b1a428129bb44372bf3d7dd5 \ - --hash=sha256:5881aaa4bf3a2d086c5f20371d3a5856199a0d8ac72dd8d0dbd7a2ecfc26ab73 \ - --hash=sha256:5885bc586f1edb48e5d68e7a4b4757b5feb2a496b64f462b4d65950f5af3364f \ - --hash=sha256:5a11b16a33656ffc43c92a5343a28dc71eefe460bcc2a4923a96f292692709f6 \ - --hash=sha256:5a997b784a639e05b9d4053ef3b20c7e447ea80814a762f25b8ed5a89d261eac \ - --hash=sha256:5be8f5e4044146a69c96077c7e08f0709c13a314aa5315981185c1f00235fe65 \ - --hash=sha256:63d57fc94eb0bbb4735e45517afc21ef262991d8758a8f2f05dd6e4174944519 \ - --hash=sha256:673b9d8e780f455091200bba8534d5f4f465944cbdd61f31dc832d70e29064a5 \ - --hash=sha256:67d2f8ad9dcc3a9e826bdc7802ed541a44e124c29b7d95a679eeb58c1c14ade8 \ - --hash=sha256:67f5e80adf0aafc7b5454f2c1cb0cde920c9b1f2cbd0485f07cc1d0497c35c5d \ - --hash=sha256:68018c4c67d7e89951a91fbd371e2e34cd8cfc71f0bb43b5332db38497025d51 \ - --hash=sha256:6c4dd3bfd0c82400060896717dd261137398edb7e524527438c54a8c34f736bf \ - --hash=sha256:71f31eda4e370f46af42fc9f264fafa1b09f46ba07bdbee98f25689a04b81c20 \ - --hash=sha256:7512b4d0fc5339d5abbb14d1843f70499cab90d0b864f790e73f780f041615d7 \ - --hash=sha256:75fa3d6946d317ffc7016a6fcc44f42db6d514b7fdb8b4b28cbe058303cb6e53 \ - --hash=sha256:779e851fd0e19795ccc8a9bb4d705d6baa0ef475329fe44a13cf1e962f18ff1e \ - --hash=sha256:796520afa499732191e39fc95b56a3b07f95256f2d22b1c26e217fb69a9db5b5 \ - --hash=sha256:7aae7a3d63b935babfdc6864b31196afd5145878ddd22f5200729006366bc4d5 \ - --hash=sha256:7b82e67c5feb682dbb559c3e6b78355f234943053af61606af126df2183b9ef9 \ - --hash=sha256:7c0536bd9178f754b277a3e53f90f9c9454a3bd108b1531ffff720e082d824f2 \ - --hash=sha256:7eda194dd46e40ec745bf76795a7cccb02a6a41f445ad49d3cf66518b0bd9cff \ - --hash=sha256:82a4bb10b0beef1434fb23a09f001ab5ca87895596b4581fd53f1e5145a8934a \ - --hash=sha256:85c4f11be9cf08917ac2a5a8b6e1ef63b2f8e3799cec194417e76826e5f1de9c \ - --hash=sha256:88b72eb7222d918c967202024812c2bfb4048deeb69ca328363fb8e15254c549 \ - --hash=sha256:89934f9f791566e54c1d92cdc8f8fd0009447a5ecdb1ec6b810d5f8c4955f6be \ - --hash=sha256:8b1942b3e4ed9ed551ed3083a2e6e0772de1e5e3aca872d955e2e86385fb7ff9 \ - --hash=sha256:8ffb141361108e864ab5f1813f66e4e1164181227f9b1f105b042729b6c15125 \ - --hash=sha256:8fffc08de02071c37865a155e5ea5fce0282e1546fd5bde7f6149fcaa32558ac \ - --hash=sha256:91fb6a43d72b4f8863d21f347a9163eecbf36e76e2f51068d59cd004c506f332 \ - --hash=sha256:928e75a7200a4c09e6efc7482a1337919cc61fe1ba289f297827a5b76d8969c2 \ - --hash=sha256:96eef5b9f336f623ffc555ab47a775495e7e8846dde88de5f941e2906453a1ce \ - --hash=sha256:a0611da6b07dd3720f492db1b463a4d1175b096b49438761cc9f35f0d9eaaef5 \ - --hash=sha256:a091026c3bf7519ab1e64655a3f52a59ad4a4e019a6f830c24d6430695b1cf6a \ - --hash=sha256:a22f66270bd6d0804b02cd49dae2b33d4341015545d17f8426f2c4e22f557a23 \ - --hash=sha256:a243132767150a44e6a93cd1dde41010036e1cbc63cc3e9fe1712b277d926ce3 \ - --hash=sha256:a31fa7536ec1fb7155a0cd3a4e3d956c835ad0a43e3610ca32384d01f079ea1c \ - --hash=sha256:a364e8e944d92dcbf33b6b494d4e0fb3499dcc3bd9485beb701aa4b4201fa414 \ - --hash=sha256:a4058f16cee694577f7e4dd410263cd0ef75644b43802a689c2b3c2a7e69453b \ - --hash=sha256:a4b382e0e636ed54cd278791d93fe2c4f370772743f02bcbe431a160089025c9 \ - --hash=sha256:a83d3adea1e0ee36dac34627f78ddd7f093bb9cfc0a8e97f1572a949b695cb98 \ - --hash=sha256:a8ade0363f776f87f982572c2860cc43c65ace208db49c76df0a21dde4ddd16e \ - --hash=sha256:aa59974880ab5ad8ef3afaa26f9bda148c5f39e06b11a8ada4660ecc9fb2feb3 \ - --hash=sha256:aa826340a609d0c954ba52fd831f0fba2a4165659ab0ee1a15e4aac21f302406 \ - --hash=sha256:aaca5a812f050ab55426c32177091130b1e49329b3f002a32934cd0245571307 \ - --hash=sha256:ae82fce1d964f065c32c9517309f0c7be588772352d2f40b1574a214bd6e6098 \ - --hash=sha256:aed57b541b589fa05ac248f4cb1c46cbb432ab82cbd467d1c4f6a2bdc18aecf9 \ - --hash=sha256:afa578b6524ff85fb365f454cf61683771d0170470c48ad9d170c48075f86725 \ - --hash=sha256:b0884e3f22d87c30694e625b1e62e6f30d39782c806287450d9dc2fdf07692fd \ - --hash=sha256:b2aca14c235c7a08558fe0a4786a1a05873a01e86b474dfa8f6df49101853a4e \ - --hash=sha256:b450d7cabcd49aa7ab46a3c6aa3ac7e1593600a1a0605ba536ec0f1b99a04322 \ - --hash=sha256:b725e70d15906d24615201e650d5b0388b08a5187a55f119f25874d0103f90dd \ - --hash=sha256:bfbbab9316330cf81656fed435311386610f78b6c93cc5db4bebbce8dd146675 \ - --hash=sha256:c093c7088b40d8266f57ed71d93112bd64c6724d31f0794c1e52cc4857c28e0e \ - --hash=sha256:c2e49dc23a10a1296b04ca9db200c44d3eb32c8d8ec532e8c1fd24792276522a \ - --hash=sha256:c4393600915c308e546dc7003d74371744234e8444a28622d76fe19b98fa59d1 \ - --hash=sha256:c5ae125276f254b01daa73e2c103363d3e99e3e10505686ac7d9d2442dd4627a \ - --hash=sha256:c6aacf00d05b38a5069826e50ae72751cb5bc27bdc4d5746203988e429b385bb \ - --hash=sha256:c76722b5ed4a31ba103e0dc77ab869222ec36efe1a614e42e9bcea88a36186fe \ - --hash=sha256:c809eef167bf4a57af4b03007004896f5c60bd38dc3852fcd97a26eae3d4c9e6 \ - --hash=sha256:c92ea6d9dd84a750b2bae72ff5e8cf5fdd13e58dda79c33e057862c29a8d5b50 \ - --hash=sha256:cb659702a45136c743bc130760c6f137870d4df3a9e14386478b8a0511abcfca \ - --hash=sha256:ce0930a963ff593e8bb6fda49a503911accc67dee7e5445eec972668e672a0f0 \ - --hash=sha256:d0751528b97d2b19a388b302be2a0ee05817097bab46ff0ed76feeec24951f78 \ - --hash=sha256:d184f85ad2bb1f261eac55cddfcf62a70dee89982c978e92b9a74a1bfef2e367 \ - --hash=sha256:d2a3e412ce1849be34b45922bfef03df32d1410a06d1cdeb793a343c2f1fd666 \ - --hash=sha256:d61ec60945d694df806a9aec88e8f29a27293c6e424f8ff91c80416e3c617645 \ - --hash=sha256:db0c742aad702fd5d0c6611a73f9602f20aec2007c102630c06d7633d9c8f09a \ - --hash=sha256:db4743e30d6f5f92b6d2b7c86b3ad250e0bad8dee4b7ad8a0c44bfb276af89a3 \ - --hash=sha256:dbf7bebc2275016cddf3c997bf8a0f7044160714c64a9b83975670a04e6d2252 \ - --hash=sha256:de1fc314c3ad6bc2f6bd5b5a5b9357b8c6896333d27fdbb7049aea8bd5af2d79 \ - --hash=sha256:df7e5edac4778127f2bf452e0721a58a1cfa4d1d9eac63bdd650535eb8543615 \ - --hash=sha256:e220f7b3e8656ab063d2eb0cd536fafef396829cafe04cb314e734f87649058f \ - --hash=sha256:e3c623923967f3e5961d272718655946e5322b8d058e094764180cdee7bab1af \ - --hash=sha256:e69add9b6b7b08c60d7ff0152c7c9a6c45b4a71a919be5abde6f98f1ea16421c \ - --hash=sha256:e8e0d177b1fe251c3b1b914ab64135475c5273c8cfd2857964b2e3bb0fe196a7 \ - --hash=sha256:ef45f31aec9be01379fc6c10f1d9c677f032f2bac9383c827d44f620e8a88407 \ - --hash=sha256:f1208c1c67ec9e151d78aa3435aa9b08a488b53d9cfac9b699f15255a3461ef2 \ - --hash=sha256:f12582b8d3b4c6be1d298c49cb7ae64a3a73efaf4c2ab4e37db182e3545815ac \ - --hash=sha256:f1de541a9893cf8a1b1db9bf0bf670a2decab42e3e82233d36a74eda7822b4c9 \ - --hash=sha256:f4eac0584cdc3285ef2e74eee1513a6001681fd9753b259e8159421ed28a72e5 \ - --hash=sha256:f7b64fcd670bca8800bc10ced36620c6bbb321e7bc1214b9c0c0df269c1dddc2 \ - --hash=sha256:fb7c61d4be18e930f75948705e9718618862e6fc2ed0d7159b2262be73f167a2 +lxml==5.4.0 \ + --hash=sha256:00b8686694423ddae324cf614e1b9659c2edb754de617703c3d29ff568448df5 \ + --hash=sha256:073eb6dcdf1f587d9b88c8c93528b57eccda40209cf9be549d469b942b41d70b \ + --hash=sha256:09846782b1ef650b321484ad429217f5154da4d6e786636c38e434fa32e94e49 \ + --hash=sha256:0a01ce7d8479dce84fc03324e3b0c9c90b1ece9a9bb6a1b6c9025e7e4520e78c \ + --hash=sha256:0be91891bdb06ebe65122aa6bf3fc94489960cf7e03033c6f83a90863b23c58b \ + --hash=sha256:0cef4feae82709eed352cd7e97ae062ef6ae9c7b5dbe3663f104cd2c0e8d94ba \ + --hash=sha256:0e108352e203c7afd0eb91d782582f00a0b16a948d204d4dec8565024fafeea5 \ + --hash=sha256:0ea0252b51d296a75f6118ed0d8696888e7403408ad42345d7dfd0d1e93309a7 \ + --hash=sha256:0fce1294a0497edb034cb416ad3e77ecc89b313cff7adbee5334e4dc0d11f422 \ + --hash=sha256:1320091caa89805df7dcb9e908add28166113dcd062590668514dbd510798c88 \ + --hash=sha256:142accb3e4d1edae4b392bd165a9abdee8a3c432a2cca193df995bc3886249c8 \ + --hash=sha256:14479c2ad1cb08b62bb941ba8e0e05938524ee3c3114644df905d2331c76cd57 \ + --hash=sha256:151d6c40bc9db11e960619d2bf2ec5829f0aaffb10b41dcf6ad2ce0f3c0b2325 \ + --hash=sha256:15a665ad90054a3d4f397bc40f73948d48e36e4c09f9bcffc7d90c87410e478a \ + --hash=sha256:1a42b3a19346e5601d1b8296ff6ef3d76038058f311902edd574461e9c036982 \ + --hash=sha256:1af80c6316ae68aded77e91cd9d80648f7dd40406cef73df841aa3c36f6907c8 \ + --hash=sha256:1b717b00a71b901b4667226bba282dd462c42ccf618ade12f9ba3674e1fabc55 \ + --hash=sha256:1dc4ca99e89c335a7ed47d38964abcb36c5910790f9bd106f2a8fa2ee0b909d2 \ + --hash=sha256:20e16c08254b9b6466526bc1828d9370ee6c0d60a4b64836bc3ac2917d1e16df \ + --hash=sha256:226046e386556a45ebc787871d6d2467b32c37ce76c2680f5c608e25823ffc84 \ + --hash=sha256:24974f774f3a78ac12b95e3a20ef0931795ff04dbb16db81a90c37f589819551 \ + --hash=sha256:24f6df5f24fc3385f622c0c9d63fe34604893bc1a5bdbb2dbf5870f85f9a404a \ + --hash=sha256:27a9ded0f0b52098ff89dd4c418325b987feed2ea5cc86e8860b0f844285d740 \ + --hash=sha256:29f451a4b614a7b5b6c2e043d7b64a15bd8304d7e767055e8ab68387a8cacf4e \ + --hash=sha256:2b31a3a77501d86d8ade128abb01082724c0dfd9524f542f2f07d693c9f1175f \ + --hash=sha256:2c62891b1ea3094bb12097822b3d44b93fc6c325f2043c4d2736a8ff09e65f60 \ + --hash=sha256:2dc191e60425ad70e75a68c9fd90ab284df64d9cd410ba8d2b641c0c45bc006e \ + --hash=sha256:31e63621e073e04697c1b2d23fcb89991790eef370ec37ce4d5d469f40924ed6 \ + --hash=sha256:32697d2ea994e0db19c1df9e40275ffe84973e4232b5c274f47e7c1ec9763cdd \ + --hash=sha256:3a3178b4873df8ef9457a4875703488eb1622632a9cee6d76464b60e90adbfcd \ + --hash=sha256:3b9c2754cef6963f3408ab381ea55f47dabc6f78f4b8ebb0f0b25cf1ac1f7609 \ + --hash=sha256:3d3c30ba1c9b48c68489dc1829a6eede9873f52edca1dda900066542528d6b20 \ + --hash=sha256:3e6d5557989cdc3ebb5302bbdc42b439733a841891762ded9514e74f60319ad6 \ + --hash=sha256:4025bf2884ac4370a3243c5aa8d66d3cb9e15d3ddd0af2d796eccc5f0244390e \ + --hash=sha256:4291d3c409a17febf817259cb37bc62cb7eb398bcc95c1356947e2871911ae61 \ + --hash=sha256:4329422de653cdb2b72afa39b0aa04252fca9071550044904b2e7036d9d97fe4 \ + --hash=sha256:43d549b876ce64aa18b2328faff70f5877f8c6dede415f80a2f799d31644d776 \ + --hash=sha256:460508a4b07364d6abf53acaa0a90b6d370fafde5693ef37602566613a9b0779 \ + --hash=sha256:47fb24cc0f052f0576ea382872b3fc7e1f7e3028e53299ea751839418ade92a6 \ + --hash=sha256:48b4afaf38bf79109bb060d9016fad014a9a48fb244e11b94f74ae366a64d252 \ + --hash=sha256:497cab4d8254c2a90bf988f162ace2ddbfdd806fce3bda3f581b9d24c852e03c \ + --hash=sha256:4aa412a82e460571fad592d0f93ce9935a20090029ba08eca05c614f99b0cc92 \ + --hash=sha256:4b7ce10634113651d6f383aa712a194179dcd496bd8c41e191cec2099fa09de5 \ + --hash=sha256:4cd915c0fb1bed47b5e6d6edd424ac25856252f09120e3e8ba5154b6b921860e \ + --hash=sha256:4d885698f5019abe0de3d352caf9466d5de2baded00a06ef3f1216c1a58ae78f \ + --hash=sha256:4f5322cf38fe0e21c2d73901abf68e6329dc02a4994e483adbcf92b568a09a54 \ + --hash=sha256:50441c9de951a153c698b9b99992e806b71c1f36d14b154592580ff4a9d0d877 \ + --hash=sha256:529024ab3a505fed78fe3cc5ddc079464e709f6c892733e3f5842007cec8ac6e \ + --hash=sha256:53370c26500d22b45182f98847243efb518d268374a9570409d2e2276232fd37 \ + --hash=sha256:53d9469ab5460402c19553b56c3648746774ecd0681b1b27ea74d5d8a3ef5590 \ + --hash=sha256:56dbdbab0551532bb26c19c914848d7251d73edb507c3079d6805fa8bba5b706 \ + --hash=sha256:5a99d86351f9c15e4a901fc56404b485b1462039db59288b203f8c629260a142 \ + --hash=sha256:5cca36a194a4eb4e2ed6be36923d3cffd03dcdf477515dea687185506583d4c9 \ + --hash=sha256:5f11a1526ebd0dee85e7b1e39e39a0cc0d9d03fb527f56d8457f6df48a10dc0c \ + --hash=sha256:61c7bbf432f09ee44b1ccaa24896d21075e533cd01477966a5ff5a71d88b2f56 \ + --hash=sha256:639978bccb04c42677db43c79bdaa23785dc7f9b83bfd87570da8207872f1ce5 \ + --hash=sha256:63e7968ff83da2eb6fdda967483a7a023aa497d85ad8f05c3ad9b1f2e8c84987 \ + --hash=sha256:664cdc733bc87449fe781dbb1f309090966c11cc0c0cd7b84af956a02a8a4729 \ + --hash=sha256:67ed8a40665b84d161bae3181aa2763beea3747f748bca5874b4af4d75998f87 \ + --hash=sha256:67f779374c6b9753ae0a0195a892a1c234ce8416e4448fe1e9f34746482070a7 \ + --hash=sha256:6854f8bd8a1536f8a1d9a3655e6354faa6406621cf857dc27b681b69860645c7 \ + --hash=sha256:696ea9e87442467819ac22394ca36cb3d01848dad1be6fac3fb612d3bd5a12cf \ + --hash=sha256:6ef80aeac414f33c24b3815ecd560cee272786c3adfa5f31316d8b349bfade28 \ + --hash=sha256:72ac9762a9f8ce74c9eed4a4e74306f2f18613a6b71fa065495a67ac227b3056 \ + --hash=sha256:75133890e40d229d6c5837b0312abbe5bac1c342452cf0e12523477cd3aa21e7 \ + --hash=sha256:7605c1c32c3d6e8c990dd28a0970a3cbbf1429d5b92279e37fda05fb0c92190e \ + --hash=sha256:773e27b62920199c6197130632c18fb7ead3257fce1ffb7d286912e56ddb79e0 \ + --hash=sha256:795f61bcaf8770e1b37eec24edf9771b307df3af74d1d6f27d812e15a9ff3872 \ + --hash=sha256:79d5bfa9c1b455336f52343130b2067164040604e41f6dc4d8313867ed540079 \ + --hash=sha256:7a62cc23d754bb449d63ff35334acc9f5c02e6dae830d78dab4dd12b78a524f4 \ + --hash=sha256:7be701c24e7f843e6788353c055d806e8bd8466b52907bafe5d13ec6a6dbaecd \ + --hash=sha256:7ca56ebc2c474e8f3d5761debfd9283b8b18c76c4fc0967b74aeafba1f5647f9 \ + --hash=sha256:7ce1a171ec325192c6a636b64c94418e71a1964f56d002cc28122fceff0b6121 \ + --hash=sha256:891f7f991a68d20c75cb13c5c9142b2a3f9eb161f1f12a9489c82172d1f133c0 \ + --hash=sha256:8f82125bc7203c5ae8633a7d5d20bcfdff0ba33e436e4ab0abc026a53a8960b7 \ + --hash=sha256:91505d3ddebf268bb1588eb0f63821f738d20e1e7f05d3c647a5ca900288760b \ + --hash=sha256:942a5d73f739ad7c452bf739a62a0f83e2578afd6b8e5406308731f4ce78b16d \ + --hash=sha256:9454b8d8200ec99a224df8854786262b1bd6461f4280064c807303c642c05e76 \ + --hash=sha256:9459e6892f59ecea2e2584ee1058f5d8f629446eab52ba2305ae13a32a059530 \ + --hash=sha256:9776af1aad5a4b4a1317242ee2bea51da54b2a7b7b48674be736d463c999f37d \ + --hash=sha256:97dac543661e84a284502e0cf8a67b5c711b0ad5fb661d1bd505c02f8cf716d7 \ + --hash=sha256:98a3912194c079ef37e716ed228ae0dcb960992100461b704aea4e93af6b0bb9 \ + --hash=sha256:9b4a3bd174cc9cdaa1afbc4620c049038b441d6ba07629d89a83b408e54c35cd \ + --hash=sha256:9c886b481aefdf818ad44846145f6eaf373a20d200b5ce1a5c8e1bc2d8745410 \ + --hash=sha256:9ceaf423b50ecfc23ca00b7f50b64baba85fb3fb91c53e2c9d00bc86150c7e40 \ + --hash=sha256:a11a96c3b3f7551c8a8109aa65e8594e551d5a84c76bf950da33d0fb6dfafab7 \ + --hash=sha256:a3bcdde35d82ff385f4ede021df801b5c4a5bcdfb61ea87caabcebfc4945dc1b \ + --hash=sha256:a7fb111eef4d05909b82152721a59c1b14d0f365e2be4c742a473c5d7372f4f5 \ + --hash=sha256:a81e1196f0a5b4167a8dafe3a66aa67c4addac1b22dc47947abd5d5c7a3f24b5 \ + --hash=sha256:a8c9b7f16b63e65bbba889acb436a1034a82d34fa09752d754f88d708eca80e1 \ + --hash=sha256:a8ef956fce64c8551221f395ba21d0724fed6b9b6242ca4f2f7beb4ce2f41997 \ + --hash=sha256:ab339536aa798b1e17750733663d272038bf28069761d5be57cb4a9b0137b4f8 \ + --hash=sha256:ac7ba71f9561cd7d7b55e1ea5511543c0282e2b6450f122672a2694621d63b7e \ + --hash=sha256:aea53d51859b6c64e7c51d522c03cc2c48b9b5d6172126854cc7f01aa11f52bc \ + --hash=sha256:aea7c06667b987787c7d1f5e1dfcd70419b711cdb47d6b4bb4ad4b76777a0563 \ + --hash=sha256:aefe1a7cb852fa61150fcb21a8c8fcea7b58c4cb11fbe59c97a0a4b31cae3c8c \ + --hash=sha256:b0989737a3ba6cf2a16efb857fb0dfa20bc5c542737fddb6d893fde48be45433 \ + --hash=sha256:b108134b9667bcd71236c5a02aad5ddd073e372fb5d48ea74853e009fe38acb6 \ + --hash=sha256:b12cb6527599808ada9eb2cd6e0e7d3d8f13fe7bbb01c6311255a15ded4c7ab4 \ + --hash=sha256:b5aff6f3e818e6bdbbb38e5967520f174b18f539c2b9de867b1e7fde6f8d95a4 \ + --hash=sha256:b67319b4aef1a6c56576ff544b67a2a6fbd7eaee485b241cabf53115e8908b8f \ + --hash=sha256:b7c86884ad23d61b025989d99bfdd92a7351de956e01c61307cb87035960bcb1 \ + --hash=sha256:b92b69441d1bd39f4940f9eadfa417a25862242ca2c396b406f9272ef09cdcaa \ + --hash=sha256:bcb7a1096b4b6b24ce1ac24d4942ad98f983cd3810f9711bcd0293f43a9d8b9f \ + --hash=sha256:bda3ea44c39eb74e2488297bb39d47186ed01342f0022c8ff407c250ac3f498e \ + --hash=sha256:be2ba4c3c5b7900246a8f866580700ef0d538f2ca32535e991027bdaba944063 \ + --hash=sha256:c5681160758d3f6ac5b4fea370495c48aac0989d6a0f01bb9a72ad8ef5ab75c4 \ + --hash=sha256:c5d32f5284012deaccd37da1e2cd42f081feaa76981f0eaa474351b68df813c5 \ + --hash=sha256:c6364038c519dffdbe07e3cf42e6a7f8b90c275d4d1617a69bb59734c1a2d571 \ + --hash=sha256:c70e93fba207106cb16bf852e421c37bbded92acd5964390aad07cb50d60f5cf \ + --hash=sha256:ca755eebf0d9e62d6cb013f1261e510317a41bf4650f22963474a663fdfe02aa \ + --hash=sha256:cccd007d5c95279e529c146d095f1d39ac05139de26c098166c4beb9374b0f4d \ + --hash=sha256:ce31158630a6ac85bddd6b830cffd46085ff90498b397bd0a259f59d27a12188 \ + --hash=sha256:ce9c671845de9699904b1e9df95acfe8dfc183f2310f163cdaa91a3535af95de \ + --hash=sha256:d12832e1dbea4be280b22fd0ea7c9b87f0d8fc51ba06e92dc62d52f804f78ebd \ + --hash=sha256:d2ed1b3cb9ff1c10e6e8b00941bb2e5bb568b307bfc6b17dffbbe8be5eecba86 \ + --hash=sha256:d5663bc1b471c79f5c833cffbc9b87d7bf13f87e055a5c86c363ccd2348d7e82 \ + --hash=sha256:d90b729fd2732df28130c064aac9bb8aff14ba20baa4aee7bd0795ff1187545f \ + --hash=sha256:dc0af80267edc68adf85f2a5d9be1cdf062f973db6790c1d065e45025fa26140 \ + --hash=sha256:de5b4e1088523e2b6f730d0509a9a813355b7f5659d70eb4f319c76beea2e250 \ + --hash=sha256:de6f6bb8a7840c7bf216fb83eec4e2f79f7325eca8858167b68708b929ab2172 \ + --hash=sha256:df53330a3bff250f10472ce96a9af28628ff1f4efc51ccba351a8820bca2a8ba \ + --hash=sha256:e094ec83694b59d263802ed03a8384594fcce477ce484b0cbcd0008a211ca751 \ + --hash=sha256:e794f698ae4c5084414efea0f5cc9f4ac562ec02d66e1484ff822ef97c2cadff \ + --hash=sha256:e7bc6df34d42322c5289e37e9971d6ed114e3776b45fa879f734bded9d1fea9c \ + --hash=sha256:eaf24066ad0b30917186420d51e2e3edf4b0e2ea68d8cd885b14dc8afdcf6556 \ + --hash=sha256:ecf4c4b83f1ab3d5a7ace10bafcb6f11df6156857a3c418244cef41ca9fa3e44 \ + --hash=sha256:ef5a7178fcc73b7d8c07229e89f8eb45b2908a9238eb90dcfc46571ccf0383b8 \ + --hash=sha256:f5cb182f6396706dc6cc1896dd02b1c889d644c081b0cdec38747573db88a7d7 \ + --hash=sha256:fa0e294046de09acd6146be0ed6727d1f42ded4ce3ea1e9a19c11b6774eea27c \ + --hash=sha256:fb54f7c6bafaa808f27166569b1511fc42701a7713858dddc08afdde9746849e \ + --hash=sha256:fd3be6481ef54b8cfd0e1e953323b7aa9d9789b94842d0e5b142ef4bb7999539 # via doxmlparser markupsafe==3.0.2 \ --hash=sha256:0bff5e0ae4ef2e1ae4fdf2dfd5b76c75e5c2fa4132d05fc1b0dabcd20c7e28c4 \ @@ -376,21 +364,22 @@ markupsafe==3.0.2 \ --hash=sha256:f8b3d067f2e40fe93e1ccdd6b2e1d16c43140e76f02fb1319a05cf2b79d99430 \ --hash=sha256:fcabf5ff6eea076f859677f5f0b6b5c1a51e70a376b0579e0eadef8db48c6b50 # via jinja2 -packaging==24.2 \ - --hash=sha256:09abb1bccd265c01f4a3aa3f7a7db064b36514d2cba19a2f694fe6150451a759 \ - --hash=sha256:c228a6dc5e932d346bc5739379109d49e8853dd8223571c7c5b55260edc0b97f +packaging==25.0 \ + --hash=sha256:29572ef2b1f17581046b3a2227d5c611fb25ec70ca1ba8554b24b0e69331a484 \ + --hash=sha256:d443872c98d677bf60f6a1f2f8c1cb748e8fe762d2bf9d3148b5599295b0fc4f # via # pytest # sphinx -pluggy==1.5.0 \ - --hash=sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1 \ - --hash=sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669 +pluggy==1.6.0 \ + --hash=sha256:7dcc130b76258d33b90f61b658791dede3486c3e6bfb003ee5c9bfb396dd22f3 \ + --hash=sha256:e920276dd6813095e9377c0bc5566d94c932c33b27a3e3945d8389c374dd4746 # via pytest pygments==2.19.1 \ --hash=sha256:61c16d2a8576dc0649d9f39e089b5f02bcd27fba10d8fb4dcc28173f7a45151f \ --hash=sha256:9ea1544ad55cecf4b8242fab6dd35a93bbce657034b0611ee383099054ab6d8c # via # -r requirements.in + # pytest # sphinx # sphinx-tabs pykwalify==1.8.0 \ @@ -401,9 +390,9 @@ pyserial==3.5 \ --hash=sha256:3c77e014170dfffbd816e6ffc205e9842efb10be9f58ec16d3e8675b4925cddb \ --hash=sha256:c4451db6ba391ca6ca299fb3ec7bae67a5c55dde170964c7a14ceefec02f2cf0 # via -r requirements.in -pytest==8.3.5 \ - --hash=sha256:c69214aa47deac29fad6c2a4f590b9c4a9fdb16a403176fe154b79c0b4d4d820 \ - --hash=sha256:f4efe70cc14e511565ac476b57c279e12a855b11f48f212af1080ef2263d3845 +pytest==8.4.1 \ + --hash=sha256:539c70ba6fcead8e78eebbf1115e8b589e7565830d7d006a8723f19ac8a0afb7 \ + --hash=sha256:7c67fd69174877359ed9371ec3af8a3d2b04741818c51e5e99cc1742251fa93c # via -r requirements.in python-dateutil==2.9.0.post0 \ --hash=sha256:37dd54208da7e1cd875388217d5e00ebd4179249f90fb72437e91a35459a0ad3 \ @@ -464,19 +453,19 @@ pyyaml==6.0.2 \ --hash=sha256:f753120cb8181e736c57ef7636e83f31b9c0d1722c516f7e86cf15b7aa57ff12 \ --hash=sha256:ff3824dc5261f50c9b0dfb3be22b4567a6f938ccce4587b38952d85fd9e9afe4 # via -r requirements.in -requests==2.32.3 \ - --hash=sha256:55365417734eb18255590a9ff9eb97e9e1da868d4ccd6402399eaf68af20a760 \ - --hash=sha256:70761cfe03c773ceb22aa2f671b4757976145175cdfca038c02654d061d6dcc6 +requests==2.32.4 \ + --hash=sha256:27babd3cda2a6d50b30443204ee89830707d396671944c998b5975b031ac2b2c \ + --hash=sha256:27d0316682c8a29834d3264820024b62a36942083d52caf2f14c0591336d3422 # via sphinx -roman-numerals-py==3.1.0 ; python_full_version >= '3.11' \ +roman-numerals-py==3.1.0 \ --hash=sha256:9da2ad2fb670bcf24e81070ceb3be72f6c11c440d73bd579fbeca1e9f330954c \ --hash=sha256:be4bf804f083a4ce001b5eb7e3c0862479d10f94c936f6c4e5f250aa5ff5bd2d # via sphinx -ruamel-yaml==0.18.10 \ - --hash=sha256:20c86ab29ac2153f80a428e1254a8adf686d3383df04490514ca3b79a362db58 \ - --hash=sha256:30f22513ab2301b3d2b577adc121c6471f28734d3d9728581245f1e76468b4f1 +ruamel-yaml==0.18.14 \ + --hash=sha256:710ff198bb53da66718c7db27eec4fbcc9aa6ca7204e4c1df2f282b6fe5eb6b2 \ + --hash=sha256:7227b76aaec364df15936730efbf7d72b30c0b79b1d578bbb8e3dcb2d81f52b7 # via pykwalify -ruamel-yaml-clib==0.2.12 ; python_full_version < '3.13' and platform_python_implementation == 'CPython' \ +ruamel-yaml-clib==0.2.12 ; python_full_version < '3.14' and platform_python_implementation == 'CPython' \ --hash=sha256:040ae85536960525ea62868b642bdb0c2cc6021c9f9d507810c0c604e66f5a7b \ --hash=sha256:0467c5965282c62203273b838ae77c0d29d7638c8a4e3a1c8bdd3602c10904e4 \ --hash=sha256:0b7e75b4965e1d4690e93021adfcecccbca7d61c7bddd8e22406ef2ff20d74ef \ @@ -524,40 +513,25 @@ ruamel-yaml-clib==0.2.12 ; python_full_version < '3.13' and platform_python_impl --hash=sha256:fc4b630cd3fa2cf7fce38afa91d7cfe844a9f75d7f0f36393fa98815e911d987 \ --hash=sha256:fd5415dded15c3822597455bc02bcd66e81ef8b7a48cb71a33628fc9fdde39df # via ruamel-yaml -setuptools==78.1.0 \ - --hash=sha256:18fd474d4a82a5f83dac888df697af65afa82dec7323d09c3e37d1f14288da54 \ - --hash=sha256:3e386e96793c8702ae83d17b853fb93d3e09ef82ec62722e61da5cd22376dcd8 +setuptools==80.9.0 \ + --hash=sha256:062d34222ad13e0cc312a4c02d73f059e86a4acbfbdea8f8f76b28c99f306922 \ + --hash=sha256:f36b47402ecde768dbfafc46e8e4207b4360c654f1f3bb84475f0a28628fb19c # via sphinx-togglebutton six==1.17.0 \ --hash=sha256:4721f391ed90541fddacab5acf947aa0d3dc7d27b2e1e8eda2be8970586c3274 \ --hash=sha256:ff70335d468e7eb6ec65b95b99d3a2836546063f63acc5171de367e834932a81 # via - # anytree # doxmlparser # python-dateutil sniffio==1.3.1 \ --hash=sha256:2f6da418d1f1e0fddd844478f41680e794e6051915791a034ff65e5f100525a2 \ --hash=sha256:f4324edc670a0f49750a81b895f35c3adb843cca46f0530f79fc1babb23789dc # via anyio -snowballstemmer==2.2.0 \ - --hash=sha256:09b16deb8547d3412ad7b590689584cd0fe25ec8db3be37788be3810cbf19cb1 \ - --hash=sha256:c8e1716e83cc398ae16824e5572ae04e0d9fc2c6b985fb0f900f5f0c96ecba1a +snowballstemmer==3.0.1 \ + --hash=sha256:6cd7b3897da8d6c9ffb968a6781fa6532dce9c3618a4b127d920dab764a19064 \ + --hash=sha256:6d5eeeec8e9f84d4d56b847692bacf79bc2c8e90c7f80ca4444ff8b6f2e52895 # via sphinx -sphinx==8.1.3 ; python_full_version < '3.11' \ - --hash=sha256:09719015511837b76bf6e03e42eb7595ac8c2e41eeb9c29c5b755c6b677992a2 \ - --hash=sha256:43c1911eecb0d3e161ad78611bc905d1ad0e523e4ddc202a58a821773dc4c927 - # via - # -r requirements.in - # sphinx-autobuild - # sphinx-copybutton - # sphinx-notfound-page - # sphinx-rtd-theme - # sphinx-sitemap - # sphinx-tabs - # sphinx-togglebutton - # sphinxcontrib-jquery - # sphinxcontrib-svg2pdfconverter -sphinx==8.2.3 ; python_full_version >= '3.11' \ +sphinx==8.2.3 \ --hash=sha256:398ad29dee7f63a75888314e9424d40f52ce5a6a87ae88e7071e80af296ec348 \ --hash=sha256:4405915165f13521d875a8c29c8970800a0141c14cc5416a38feca4ea5d9b9c3 # via @@ -631,132 +605,129 @@ sphinxcontrib-svg2pdfconverter==1.3.0 \ --hash=sha256:5df6b0895e2e2101d720bfd08841bb56d74c57b1f86229a7c18b771dfdf4ffbb \ --hash=sha256:6411a4cc2f57eed96a0d7bbfa139f68cbe7983018881e1e6d7c46053cd69911f # via -r requirements.in -starlette==0.46.1 \ - --hash=sha256:3c88d58ee4bd1bb807c0d1acb381838afc7752f9ddaec81bbe4383611d833230 \ - --hash=sha256:77c74ed9d2720138b25875133f3a2dae6d854af2ec37dceb56aef370c1d8a227 +starlette==0.47.0 \ + --hash=sha256:1f64887e94a447fed5f23309fb6890ef23349b7e478faa7b24a851cd4eb844af \ + --hash=sha256:9d052d4933683af40ffd47c7465433570b4949dc937e20ad1d73b34e72f10c37 # via sphinx-autobuild -tomli==2.2.1 ; python_full_version < '3.11' \ - --hash=sha256:023aa114dd824ade0100497eb2318602af309e5a55595f76b626d6d9f3b7b0a6 \ - --hash=sha256:02abe224de6ae62c19f090f68da4e27b10af2b93213d36cf44e6e1c5abd19fdd \ - --hash=sha256:286f0ca2ffeeb5b9bd4fcc8d6c330534323ec51b2f52da063b11c502da16f30c \ - --hash=sha256:2d0f2fdd22b02c6d81637a3c95f8cd77f995846af7414c5c4b8d0545afa1bc4b \ - --hash=sha256:33580bccab0338d00994d7f16f4c4ec25b776af3ffaac1ed74e0b3fc95e885a8 \ - --hash=sha256:400e720fe168c0f8521520190686ef8ef033fb19fc493da09779e592861b78c6 \ - --hash=sha256:40741994320b232529c802f8bc86da4e1aa9f413db394617b9a256ae0f9a7f77 \ - --hash=sha256:465af0e0875402f1d226519c9904f37254b3045fc5084697cefb9bdde1ff99ff \ - --hash=sha256:4a8f6e44de52d5e6c657c9fe83b562f5f4256d8ebbfe4ff922c495620a7f6cea \ - --hash=sha256:4e340144ad7ae1533cb897d406382b4b6fede8890a03738ff1683af800d54192 \ - --hash=sha256:678e4fa69e4575eb77d103de3df8a895e1591b48e740211bd1067378c69e8249 \ - --hash=sha256:6972ca9c9cc9f0acaa56a8ca1ff51e7af152a9f87fb64623e31d5c83700080ee \ - --hash=sha256:7fc04e92e1d624a4a63c76474610238576942d6b8950a2d7f908a340494e67e4 \ - --hash=sha256:889f80ef92701b9dbb224e49ec87c645ce5df3fa2cc548664eb8a25e03127a98 \ - --hash=sha256:8d57ca8095a641b8237d5b079147646153d22552f1c637fd3ba7f4b0b29167a8 \ - --hash=sha256:8dd28b3e155b80f4d54beb40a441d366adcfe740969820caf156c019fb5c7ec4 \ - --hash=sha256:9316dc65bed1684c9a98ee68759ceaed29d229e985297003e494aa825ebb0281 \ - --hash=sha256:a198f10c4d1b1375d7687bc25294306e551bf1abfa4eace6650070a5c1ae2744 \ - --hash=sha256:a38aa0308e754b0e3c67e344754dff64999ff9b513e691d0e786265c93583c69 \ - --hash=sha256:a92ef1a44547e894e2a17d24e7557a5e85a9e1d0048b0b5e7541f76c5032cb13 \ - --hash=sha256:ac065718db92ca818f8d6141b5f66369833d4a80a9d74435a268c52bdfa73140 \ - --hash=sha256:b82ebccc8c8a36f2094e969560a1b836758481f3dc360ce9a3277c65f374285e \ - --hash=sha256:c954d2250168d28797dd4e3ac5cf812a406cd5a92674ee4c8f123c889786aa8e \ - --hash=sha256:cb55c73c5f4408779d0cf3eef9f762b9c9f147a77de7b258bef0a5628adc85cc \ - --hash=sha256:cd45e1dc79c835ce60f7404ec8119f2eb06d38b1deba146f07ced3bbc44505ff \ - --hash=sha256:d3f5614314d758649ab2ab3a62d4f2004c825922f9e370b29416484086b264ec \ - --hash=sha256:d920f33822747519673ee656a4b6ac33e382eca9d331c87770faa3eef562aeb2 \ - --hash=sha256:db2b95f9de79181805df90bedc5a5ab4c165e6ec3fe99f970d0e302f384ad222 \ - --hash=sha256:e59e304978767a54663af13c07b3d1af22ddee3bb2fb0618ca1593e4f593a106 \ - --hash=sha256:e85e99945e688e32d5a35c1ff38ed0b3f41f43fad8df0bdf79f72b2ba7bc5272 \ - --hash=sha256:ece47d672db52ac607a3d9599a9d48dcb2f2f735c6c2d1f34130085bb12b112a \ - --hash=sha256:f4039b9cbc3048b2416cc57ab3bda989a6fcf9b36cf8937f01a6e731b64f80d7 - # via - # pytest - # sphinx -typing-extensions==4.13.0 ; python_full_version < '3.13' \ - --hash=sha256:0a4ac55a5820789d87e297727d229866c9650f6521b64206413c4fbada24d95b \ - --hash=sha256:c8dd92cc0d6425a97c18fbb9d1954e5ff92c1ca881a309c45f06ebc0b79058e5 - # via - # anyio - # uvicorn -urllib3==2.3.0 \ - --hash=sha256:1cee9ad369867bfdbbb48b7dd50374c0967a0bb7710050facf0dd6911440e3df \ - --hash=sha256:f8c5449b3cf0861679ce7e0503c7b44b5ec981bec0d1d3795a07f1ba96f0204d +typing-extensions==4.14.0 ; python_full_version < '3.13' \ + --hash=sha256:8676b788e32f02ab42d9e7c61324048ae4c6d844a399eebace3d4979d75ceef4 \ + --hash=sha256:a1514509136dd0b477638fc68d6a91497af5076466ad0fa6c338e44e359944af + # via anyio +urllib3==2.5.0 \ + --hash=sha256:3fc47733c7e419d4bc3f6b3dc2b4f890bb743906a30d56ba4a5bfa4bbff92760 \ + --hash=sha256:e6b01673c0fa6a13e374b50871808eb3bf7046c4b125b216f6bf1cc604cff0dc # via requests -uvicorn==0.34.0 \ - --hash=sha256:023dc038422502fa28a09c7a30bf2b6991512da7dcdb8fd35fe57cfc154126f4 \ - --hash=sha256:404051050cd7e905de2c9a7e61790943440b3416f49cb409f965d9dcd0fa73e9 +uvicorn==0.34.3 \ + --hash=sha256:16246631db62bdfbf069b0645177d6e8a77ba950cfedbfd093acef9444e4d885 \ + --hash=sha256:35919a9a979d7a59334b6b10e05d77c1d0d574c50e0fc98b8b1a0f165708b55a # via sphinx-autobuild -watchfiles==1.0.4 \ - --hash=sha256:02a526ee5b5a09e8168314c905fc545c9bc46509896ed282aeb5a8ba9bd6ca27 \ - --hash=sha256:05d341c71f3d7098920f8551d4df47f7b57ac5b8dad56558064c3431bdfc0b74 \ - --hash=sha256:076f293100db3b0b634514aa0d294b941daa85fc777f9c698adb1009e5aca0b1 \ - --hash=sha256:0799ae68dfa95136dde7c472525700bd48777875a4abb2ee454e3ab18e9fc712 \ - --hash=sha256:0986902677a1a5e6212d0c49b319aad9cc48da4bd967f86a11bde96ad9676ca1 \ - --hash=sha256:0bc80d91ddaf95f70258cf78c471246846c1986bcc5fd33ccc4a1a67fcb40f9a \ - --hash=sha256:13c2ce7b72026cfbca120d652f02c7750f33b4c9395d79c9790b27f014c8a5a2 \ - --hash=sha256:1941b4e39de9b38b868a69b911df5e89dc43767feeda667b40ae032522b9b5f1 \ - --hash=sha256:1eacd91daeb5158c598fe22d7ce66d60878b6294a86477a4715154990394c9b3 \ - --hash=sha256:229e6ec880eca20e0ba2f7e2249c85bae1999d330161f45c78d160832e026ee2 \ - --hash=sha256:22bb55a7c9e564e763ea06c7acea24fc5d2ee5dfc5dafc5cfbedfe58505e9f90 \ - --hash=sha256:278aaa395f405972e9f523bd786ed59dfb61e4b827856be46a42130605fd0899 \ - --hash=sha256:2a9f93f8439639dc244c4d2902abe35b0279102bca7bbcf119af964f51d53c19 \ - --hash=sha256:308ac265c56f936636e3b0e3f59e059a40003c655228c131e1ad439957592303 \ - --hash=sha256:31f1a379c9dcbb3f09cf6be1b7e83b67c0e9faabed0471556d9438a4a4e14202 \ - --hash=sha256:32b026a6ab64245b584acf4931fe21842374da82372d5c039cba6bf99ef722f3 \ - --hash=sha256:342622287b5604ddf0ed2d085f3a589099c9ae8b7331df3ae9845571586c4f3d \ - --hash=sha256:39f4914548b818540ef21fd22447a63e7be6e24b43a70f7642d21f1e73371590 \ - --hash=sha256:3f68d8e9d5a321163ddacebe97091000955a1b74cd43724e346056030b0bacee \ - --hash=sha256:43b168bba889886b62edb0397cab5b6490ffb656ee2fcb22dec8bfeb371a9e12 \ - --hash=sha256:47eb32ef8c729dbc4f4273baece89398a4d4b5d21a1493efea77a17059f4df8a \ - --hash=sha256:4810ea2ae622add560f4aa50c92fef975e475f7ac4900ce5ff5547b2434642d8 \ - --hash=sha256:4e997802d78cdb02623b5941830ab06f8860038faf344f0d288d325cc9c5d2ff \ - --hash=sha256:4ebbeca9360c830766b9f0df3640b791be569d988f4be6c06d6fae41f187f105 \ - --hash=sha256:4f8c4998506241dedf59613082d1c18b836e26ef2a4caecad0ec41e2a15e4226 \ - --hash=sha256:55ccfd27c497b228581e2838d4386301227fc0cb47f5a12923ec2fe4f97b95af \ - --hash=sha256:5717021b199e8353782dce03bd8a8f64438832b84e2885c4a645f9723bf656d9 \ - --hash=sha256:5c11ea22304d17d4385067588123658e9f23159225a27b983f343fcffc3e796a \ - --hash=sha256:5e0227b8ed9074c6172cf55d85b5670199c99ab11fd27d2c473aa30aec67ee42 \ - --hash=sha256:62c9953cf85529c05b24705639ffa390f78c26449e15ec34d5339e8108c7c407 \ - --hash=sha256:6ba473efd11062d73e4f00c2b730255f9c1bdd73cd5f9fe5b5da8dbd4a717205 \ - --hash=sha256:740d103cd01458f22462dedeb5a3382b7f2c57d07ff033fbc9465919e5e1d0f3 \ - --hash=sha256:74cb3ca19a740be4caa18f238298b9d472c850f7b2ed89f396c00a4c97e2d9ff \ - --hash=sha256:7b75fee5a16826cf5c46fe1c63116e4a156924d668c38b013e6276f2582230f0 \ - --hash=sha256:7cf684aa9bba4cd95ecb62c822a56de54e3ae0598c1a7f2065d51e24637a3c5d \ - --hash=sha256:8012bd820c380c3d3db8435e8cf7592260257b378b649154a7948a663b5f84e9 \ - --hash=sha256:857f5fc3aa027ff5e57047da93f96e908a35fe602d24f5e5d8ce64bf1f2fc733 \ - --hash=sha256:8b1f135238e75d075359cf506b27bf3f4ca12029c47d3e769d8593a2024ce161 \ - --hash=sha256:8d0d0630930f5cd5af929040e0778cf676a46775753e442a3f60511f2409f48f \ - --hash=sha256:90192cdc15ab7254caa7765a98132a5a41471cf739513cc9bcf7d2ffcc0ec7b2 \ - --hash=sha256:95b42cac65beae3a362629950c444077d1b44f1790ea2772beaea95451c086bb \ - --hash=sha256:9745a4210b59e218ce64c91deb599ae8775c8a9da4e95fb2ee6fe745fc87d01a \ - --hash=sha256:9d1ef56b56ed7e8f312c934436dea93bfa3e7368adfcf3df4c0da6d4de959a1e \ - --hash=sha256:9eea33ad8c418847dd296e61eb683cae1c63329b6d854aefcd412e12d94ee235 \ - --hash=sha256:9f25d0ba0fe2b6d2c921cf587b2bf4c451860086534f40c384329fb96e2044d1 \ - --hash=sha256:9fe37a2de80aa785d340f2980276b17ef697ab8db6019b07ee4fd28a8359d2f3 \ - --hash=sha256:a38320582736922be8c865d46520c043bff350956dfc9fbaee3b2df4e1740a4b \ - --hash=sha256:a462490e75e466edbb9fc4cd679b62187153b3ba804868452ef0577ec958f5ff \ - --hash=sha256:a5ae5706058b27c74bac987d615105da17724172d5aaacc6c362a40599b6de43 \ - --hash=sha256:aa216f87594f951c17511efe5912808dfcc4befa464ab17c98d387830ce07b60 \ - --hash=sha256:ab0311bb2ffcd9f74b6c9de2dda1612c13c84b996d032cd74799adb656af4e8b \ - --hash=sha256:ab594e75644421ae0a2484554832ca5895f8cab5ab62de30a1a57db460ce06c6 \ - --hash=sha256:aee397456a29b492c20fda2d8961e1ffb266223625346ace14e4b6d861ba9c80 \ - --hash=sha256:b045c800d55bc7e2cadd47f45a97c7b29f70f08a7c2fa13241905010a5493f94 \ - --hash=sha256:b77d5622ac5cc91d21ae9c2b284b5d5c51085a0bdb7b518dba263d0af006132c \ - --hash=sha256:ba5bb3073d9db37c64520681dd2650f8bd40902d991e7b4cfaeece3e32561d08 \ - --hash=sha256:bdef5a1be32d0b07dcea3318a0be95d42c98ece24177820226b56276e06b63b0 \ - --hash=sha256:c2acfa49dd0ad0bf2a9c0bb9a985af02e89345a7189be1efc6baa085e0f72d7c \ - --hash=sha256:c7cce76c138a91e720d1df54014a047e680b652336e1b73b8e3ff3158e05061e \ - --hash=sha256:cc27a65069bcabac4552f34fd2dce923ce3fcde0721a16e4fb1b466d63ec831f \ - --hash=sha256:cdbd912a61543a36aef85e34f212e5d2486e7c53ebfdb70d1e0b060cc50dd0bf \ - --hash=sha256:cdcc92daeae268de1acf5b7befcd6cfffd9a047098199056c72e4623f531de18 \ - --hash=sha256:d3452c1ec703aa1c61e15dfe9d482543e4145e7c45a6b8566978fbb044265a21 \ - --hash=sha256:d6097538b0ae5c1b88c3b55afa245a66793a8fec7ada6755322e465fb1a0e8cc \ - --hash=sha256:d8d3d9203705b5797f0af7e7e5baa17c8588030aaadb7f6a86107b7247303817 \ - --hash=sha256:e0611d244ce94d83f5b9aff441ad196c6e21b55f77f3c47608dcf651efe54c4a \ - --hash=sha256:f12969a3765909cf5dc1e50b2436eb2c0e676a3c75773ab8cc3aa6175c16e902 \ - --hash=sha256:f44a39aee3cbb9b825285ff979ab887a25c5d336e5ec3574f1506a4671556a8d \ - --hash=sha256:f9ce064e81fe79faa925ff03b9f4c1a98b0bbb4a1b8c1b015afa93030cb21a49 \ - --hash=sha256:fb2c46e275fbb9f0c92e7654b231543c7bbfa1df07cdc4b99fa73bedfde5c844 \ - --hash=sha256:fc2eb5d14a8e0d5df7b36288979176fbb39672d45184fc4b1c004d7c3ce29317 +watchfiles==1.1.0 \ + --hash=sha256:00645eb79a3faa70d9cb15c8d4187bb72970b2470e938670240c7998dad9f13a \ + --hash=sha256:04e4ed5d1cd3eae68c89bcc1a485a109f39f2fd8de05f705e98af6b5f1861f1f \ + --hash=sha256:0a7d40b77f07be87c6faa93d0951a0fcd8cbca1ddff60a1b65d741bac6f3a9f6 \ + --hash=sha256:0ece16b563b17ab26eaa2d52230c9a7ae46cf01759621f4fbbca280e438267b3 \ + --hash=sha256:11ee4444250fcbeb47459a877e5e80ed994ce8e8d20283857fc128be1715dac7 \ + --hash=sha256:12b0a02a91762c08f7264e2e79542f76870c3040bbc847fb67410ab81474932a \ + --hash=sha256:12fe8eaffaf0faa7906895b4f8bb88264035b3f0243275e0bf24af0436b27259 \ + --hash=sha256:130fc497b8ee68dce163e4254d9b0356411d1490e868bd8790028bc46c5cc297 \ + --hash=sha256:17ab167cca6339c2b830b744eaf10803d2a5b6683be4d79d8475d88b4a8a4be1 \ + --hash=sha256:199207b2d3eeaeb80ef4411875a6243d9ad8bc35b07fc42daa6b801cc39cc41c \ + --hash=sha256:20ecc8abbd957046f1fe9562757903f5eaf57c3bce70929fda6c7711bb58074a \ + --hash=sha256:239736577e848678e13b201bba14e89718f5c2133dfd6b1f7846fa1b58a8532b \ + --hash=sha256:249590eb75ccc117f488e2fabd1bfa33c580e24b96f00658ad88e38844a040bb \ + --hash=sha256:27f30e14aa1c1e91cb653f03a63445739919aef84c8d2517997a83155e7a2fcc \ + --hash=sha256:29e7bc2eee15cbb339c68445959108803dc14ee0c7b4eea556400131a8de462b \ + --hash=sha256:328dbc9bff7205c215a7807da7c18dce37da7da718e798356212d22696404339 \ + --hash=sha256:32d6d4e583593cb8576e129879ea0991660b935177c0f93c6681359b3654bfa9 \ + --hash=sha256:3366f56c272232860ab45c77c3ca7b74ee819c8e1f6f35a7125556b198bbc6df \ + --hash=sha256:3434e401f3ce0ed6b42569128b3d1e3af773d7ec18751b918b89cd49c14eaafb \ + --hash=sha256:37d3d3f7defb13f62ece99e9be912afe9dd8a0077b7c45ee5a57c74811d581a4 \ + --hash=sha256:3a6fd40bbb50d24976eb275ccb55cd1951dfb63dbc27cae3066a6ca5f4beabd5 \ + --hash=sha256:3aba215958d88182e8d2acba0fdaf687745180974946609119953c0e112397dc \ + --hash=sha256:406520216186b99374cdb58bc48e34bb74535adec160c8459894884c983a149c \ + --hash=sha256:4281cd9fce9fc0a9dbf0fc1217f39bf9cf2b4d315d9626ef1d4e87b84699e7e8 \ + --hash=sha256:42f92befc848bb7a19658f21f3e7bae80d7d005d13891c62c2cd4d4d0abb3433 \ + --hash=sha256:48aa25e5992b61debc908a61ab4d3f216b64f44fdaa71eb082d8b2de846b7d12 \ + --hash=sha256:5007f860c7f1f8df471e4e04aaa8c43673429047d63205d1630880f7637bca30 \ + --hash=sha256:50a51a90610d0845a5931a780d8e51d7bd7f309ebc25132ba975aca016b576a0 \ + --hash=sha256:51556d5004887045dba3acdd1fdf61dddea2be0a7e18048b5e853dcd37149b86 \ + --hash=sha256:51b81e55d40c4b4aa8658427a3ee7ea847c591ae9e8b81ef94a90b668999353c \ + --hash=sha256:5366164391873ed76bfdf618818c82084c9db7fac82b64a20c44d335eec9ced5 \ + --hash=sha256:54062ef956807ba806559b3c3d52105ae1827a0d4ab47b621b31132b6b7e2866 \ + --hash=sha256:60022527e71d1d1fda67a33150ee42869042bce3d0fcc9cc49be009a9cded3fb \ + --hash=sha256:622d6b2c06be19f6e89b1d951485a232e3b59618def88dbeda575ed8f0d8dbf2 \ + --hash=sha256:62cc7a30eeb0e20ecc5f4bd113cd69dcdb745a07c68c0370cea919f373f65d9e \ + --hash=sha256:693ed7ec72cbfcee399e92c895362b6e66d63dac6b91e2c11ae03d10d503e575 \ + --hash=sha256:6d2404af8db1329f9a3c9b79ff63e0ae7131986446901582067d9304ae8aaf7f \ + --hash=sha256:7049e52167fc75fc3cc418fc13d39a8e520cbb60ca08b47f6cedb85e181d2f2a \ + --hash=sha256:7080c4bb3efd70a07b1cc2df99a7aa51d98685be56be6038c3169199d0a1c69f \ + --hash=sha256:7738027989881e70e3723c75921f1efa45225084228788fc59ea8c6d732eb30d \ + --hash=sha256:7a7bd57a1bb02f9d5c398c0c1675384e7ab1dd39da0ca50b7f09af45fa435277 \ + --hash=sha256:7b3443f4ec3ba5aa00b0e9fa90cf31d98321cbff8b925a7c7b84161619870bc9 \ + --hash=sha256:7c55b0f9f68590115c25272b06e63f0824f03d4fc7d6deed43d8ad5660cabdbf \ + --hash=sha256:7fd1b3879a578a8ec2076c7961076df540b9af317123f84569f5a9ddee64ce92 \ + --hash=sha256:8076a5769d6bdf5f673a19d51da05fc79e2bbf25e9fe755c47595785c06a8c72 \ + --hash=sha256:80f811146831c8c86ab17b640801c25dc0a88c630e855e2bef3568f30434d52b \ + --hash=sha256:8412eacef34cae2836d891836a7fff7b754d6bcac61f6c12ba5ca9bc7e427b68 \ + --hash=sha256:865c8e95713744cf5ae261f3067861e9da5f1370ba91fc536431e29b418676fa \ + --hash=sha256:86b1e28d4c37e89220e924305cd9f82866bb0ace666943a6e4196c5df4d58dcc \ + --hash=sha256:891c69e027748b4a73847335d208e374ce54ca3c335907d381fde4e41661b13b \ + --hash=sha256:8ac164e20d17cc285f2b94dc31c384bc3aa3dd5e7490473b3db043dd70fbccfd \ + --hash=sha256:8c5701dc474b041e2934a26d31d39f90fac8a3dee2322b39f7729867f932b1d4 \ + --hash=sha256:90ebb429e933645f3da534c89b29b665e285048973b4d2b6946526888c3eb2c7 \ + --hash=sha256:923fec6e5461c42bd7e3fd5ec37492c6f3468be0499bc0707b4bbbc16ac21792 \ + --hash=sha256:935f9edd022ec13e447e5723a7d14456c8af254544cefbc533f6dd276c9aa0d9 \ + --hash=sha256:95ab1594377effac17110e1352989bdd7bdfca9ff0e5eeccd8c69c5389b826d0 \ + --hash=sha256:9974d2f7dc561cce3bb88dfa8eb309dab64c729de85fba32e98d75cf24b66297 \ + --hash=sha256:9c733cda03b6d636b4219625a4acb5c6ffb10803338e437fb614fef9516825ef \ + --hash=sha256:9dc001c3e10de4725c749d4c2f2bdc6ae24de5a88a339c4bce32300a31ede179 \ + --hash=sha256:9f811079d2f9795b5d48b55a37aa7773680a5659afe34b54cc1d86590a51507d \ + --hash=sha256:a2726d7bfd9f76158c84c10a409b77a320426540df8c35be172444394b17f7ea \ + --hash=sha256:a479466da6db5c1e8754caee6c262cd373e6e6c363172d74394f4bff3d84d7b5 \ + --hash=sha256:a543492513a93b001975ae283a51f4b67973662a375a403ae82f420d2c7205ee \ + --hash=sha256:a89c75a5b9bc329131115a409d0acc16e8da8dfd5867ba59f1dd66ae7ea8fa82 \ + --hash=sha256:a8f6f72974a19efead54195bc9bed4d850fc047bb7aa971268fd9a8387c89011 \ + --hash=sha256:a9ccbf1f129480ed3044f540c0fdbc4ee556f7175e5ab40fe077ff6baf286d4e \ + --hash=sha256:aa0cc8365ab29487eb4f9979fd41b22549853389e22d5de3f134a6796e1b05a4 \ + --hash=sha256:adb4167043d3a78280d5d05ce0ba22055c266cf8655ce942f2fb881262ff3cdf \ + --hash=sha256:af06c863f152005c7592df1d6a7009c836a247c9d8adb78fef8575a5a98699db \ + --hash=sha256:b067915e3c3936966a8607f6fe5487df0c9c4afb85226613b520890049deea20 \ + --hash=sha256:b7c5f6fe273291f4d414d55b2c80d33c457b8a42677ad14b4b47ff025d0893e4 \ + --hash=sha256:b915daeb2d8c1f5cee4b970f2e2c988ce6514aace3c9296e58dd64dc9aa5d575 \ + --hash=sha256:ba0e3255b0396cac3cc7bbace76404dd72b5438bf0d8e7cefa2f79a7f3649caa \ + --hash=sha256:bda8136e6a80bdea23e5e74e09df0362744d24ffb8cd59c4a95a6ce3d142f79c \ + --hash=sha256:bfe3c517c283e484843cb2e357dd57ba009cff351edf45fb455b5fbd1f45b15f \ + --hash=sha256:c588c45da9b08ab3da81d08d7987dae6d2a3badd63acdb3e206a42dbfa7cb76f \ + --hash=sha256:c600e85f2ffd9f1035222b1a312aff85fd11ea39baff1d705b9b047aad2ce267 \ + --hash=sha256:c68e9f1fcb4d43798ad8814c4c1b61547b014b667216cb754e606bfade587018 \ + --hash=sha256:c9649dfc57cc1f9835551deb17689e8d44666315f2e82d337b9f07bd76ae3aa2 \ + --hash=sha256:cb45350fd1dc75cd68d3d72c47f5b513cb0578da716df5fba02fff31c69d5f2d \ + --hash=sha256:cbcf8630ef4afb05dc30107bfa17f16c0896bb30ee48fc24bf64c1f970f3b1fd \ + --hash=sha256:cbd949bdd87567b0ad183d7676feb98136cde5bb9025403794a4c0db28ed3a47 \ + --hash=sha256:cc08ef8b90d78bfac66f0def80240b0197008e4852c9f285907377b2947ffdcb \ + --hash=sha256:cd17a1e489f02ce9117b0de3c0b1fab1c3e2eedc82311b299ee6b6faf6c23a29 \ + --hash=sha256:d05686b5487cfa2e2c28ff1aa370ea3e6c5accfe6435944ddea1e10d93872147 \ + --hash=sha256:d0e10e6f8f6dc5762adee7dece33b722282e1f59aa6a55da5d493a97282fedd8 \ + --hash=sha256:d181ef50923c29cf0450c3cd47e2f0557b62218c50b2ab8ce2ecaa02bd97e670 \ + --hash=sha256:d1caf40c1c657b27858f9774d5c0e232089bca9cb8ee17ce7478c6e9264d2587 \ + --hash=sha256:d7642b9bc4827b5518ebdb3b82698ada8c14c7661ddec5fe719f3e56ccd13c97 \ + --hash=sha256:d9481174d3ed982e269c090f780122fb59cee6c3796f74efe74e70f7780ed94c \ + --hash=sha256:d9ba68ec283153dead62cbe81872d28e053745f12335d037de9cbd14bd1877f5 \ + --hash=sha256:da71945c9ace018d8634822f16cbc2a78323ef6c876b1d34bbf5d5222fd6a72e \ + --hash=sha256:dc44678a72ac0910bac46fa6a0de6af9ba1355669b3dfaf1ce5f05ca7a74364e \ + --hash=sha256:df32d59cb9780f66d165a9a7a26f19df2c7d24e3bd58713108b41d0ff4f929c6 \ + --hash=sha256:df670918eb7dd719642e05979fc84704af913d563fd17ed636f7c4783003fdcc \ + --hash=sha256:e78b6ed8165996013165eeabd875c5dfc19d41b54f94b40e9fff0eb3193e5e8e \ + --hash=sha256:ed8fc66786de8d0376f9f913c09e963c66e90ced9aa11997f93bdb30f7c872a8 \ + --hash=sha256:eff4b8d89f444f7e49136dc695599a591ff769300734446c0a86cba2eb2f9895 \ + --hash=sha256:f21af781a4a6fbad54f03c598ab620e3a77032c5878f3d780448421a6e1818c7 \ + --hash=sha256:f2bcdc54ea267fe72bfc7d83c041e4eb58d7d8dc6f578dfddb52f037ce62f432 \ + --hash=sha256:f2f0498b7d2a3c072766dba3274fe22a183dbea1f99d188f1c6c72209a1063dc \ + --hash=sha256:f7208ab6e009c627b7557ce55c465c98967e8caa8b11833531fdf95799372633 \ + --hash=sha256:f7590d5a455321e53857892ab8879dce62d1f4b04748769f5adf2e707afb9d4f \ + --hash=sha256:fa257a4d0d21fcbca5b5fcba9dca5a78011cb93c0323fb8855c6d2dfbc76eb77 \ + --hash=sha256:fba9b62da882c1be1280a7584ec4515d0a6006a94d6e5819730ec2eab60ffe12 \ + --hash=sha256:fe4371595edf78c41ef8ac8df20df3943e13defd0efcb732b2e393b5a8a7a71f # via sphinx-autobuild websockets==15.0.1 \ --hash=sha256:0701bc3cfcb9164d04a14b149fd74be7347a530ad3bbf15ab2c678a2cd3dd9a2 \ diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index f1da73f3ec0d..c32a40fd35c8 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -2008,7 +2008,7 @@ class PythonCompatCheck(ComplianceTest): name = "PythonCompat" doc = "Check that Python files are compatible with Zephyr minimum supported Python version." - MAX_VERSION = (3, 10) + MAX_VERSION = (3, 12) MAX_VERSION_STR = f"{MAX_VERSION[0]}.{MAX_VERSION[1]}" def run(self): diff --git a/scripts/requirements-actions.txt b/scripts/requirements-actions.txt index 621d8dbc4aec..5dc028452880 100644 --- a/scripts/requirements-actions.txt +++ b/scripts/requirements-actions.txt @@ -1,5 +1,5 @@ # This file was autogenerated by uv via the following command: -# uv pip compile --universal --python-version 3.10 --generate-hashes requirements-actions.in +# uv pip compile --universal --python-version 3.12 --generate-hashes requirements-actions.in --output-file requirements-actions.txt anytree==2.13.0 \ --hash=sha256:4cbcf10df36b1f1cba131b7e487ff3edafc9d6e932a3c70071b5b768bab901ff \ --hash=sha256:c9d3aa6825fdd06af7ebb05b4ef291d2db63e62bb1f9b7d9b71354be9d362714 @@ -12,9 +12,9 @@ astroid==3.3.10 \ --hash=sha256:104fb9cb9b27ea95e847a94c003be03a9e039334a8ebca5ee27dafaf5c5711eb \ --hash=sha256:c332157953060c6deb9caa57303ae0d20b0fbdb2e59b4a4f2a6ba49d0a7961ce # via pylint -awscli==1.40.36 \ - --hash=sha256:4a548d855cafad153e661defab601363ba8a5644873bf9f8dec31d5c0ebbb351 \ - --hash=sha256:960d92bf8b2f7efd142112f277eed7cc82d8af85fceefe4d321a620352b75ebd +awscli==1.40.38 \ + --hash=sha256:3f90f2815e3b72691785d2bbd4f2c3dcbde311c55e1f5633a37cc3e514ba6fdb \ + --hash=sha256:ec9b69ff4600ef151df3336f0e7af4cf30280d27f9d8e67e09c4b386ceb1f154 # via -r requirements-actions.in beartype==0.21.0 \ --hash=sha256:b6a1bd56c72f31b0a496a36cc55df6e2f475db166ad07fa4acc7e74f4c7f34c0 \ @@ -24,9 +24,9 @@ boolean-py==5.0 \ --hash=sha256:60cbc4bad079753721d32649545505362c754e121570ada4658b852a3a318d95 \ --hash=sha256:ef28a70bd43115208441b53a045d1549e2f0ec6e3d08a9d142cbc41c1938e8d9 # via license-expression -botocore==1.38.37 \ - --hash=sha256:06ce46da5420ea7cf542ece4ff1ec9045922fef977adf4bbec618c96c7a478bf \ - --hash=sha256:f8ad063b7dcdbf12f2c1b5a4405f390ce52beff3b2861af2e5169816ee0146f2 +botocore==1.38.39 \ + --hash=sha256:2305f688e9328af473a504197584112f228513e06412038d83205ce8d1456f40 \ + --hash=sha256:ee3aa03af1dabed4f3710cd64f6d9d488281eee720710bf1cf9f2b2fd30025ae # via # awscli # s3transfer @@ -316,9 +316,7 @@ elasticsearch==8.18.1 \ exceptiongroup==1.3.0 \ --hash=sha256:4d111e6e0c13d0644cad6ddaa7ed0261a0b36971f6d23e7ec9b4b9097da78a10 \ --hash=sha256:b241f5885f560bc56a59ee63ca4c6a8bfa46ae4ad651af316d4e81817bb9fd88 - # via - # -r requirements-actions.in - # pytest + # via -r requirements-actions.in filelock==3.18.0 \ --hash=sha256:adbc88eabb99d2fec8c9c1b229b171f18afa655400173ddc653d5d01501fb9f2 \ --hash=sha256:c401f4f8377c4464e6db25fff06205fd89bdd83b65eb0488ed1b160f780e21de @@ -444,10 +442,6 @@ intelhex==2.3.0 \ --hash=sha256:87cc5225657524ec6361354be928adfd56bcf2a3dcc646c40f8f094c39c07db4 \ --hash=sha256:892b7361a719f4945237da8ccf754e9513db32f5628852785aea108dcd250093 # via -r requirements-actions.in -isodate==0.7.2 ; python_full_version < '3.11' \ - --hash=sha256:28009937d8031054830160fce6d409ed342816b543597cece116d966c6d99e15 \ - --hash=sha256:4cd1aa0f43ca76f4a6c6c0292a85f40b35ec2e43e315b59f06e6d32171a953e6 - # via rdflib isort==6.0.1 \ --hash=sha256:1cb5df28dfbc742e490c5e41bad6da41b805b0a8be7bc93cd0fb2a8a890ac450 \ --hash=sha256:2dc5d7f65c9678d94c88dfc29161a320eec67328bc97aad576874cb4be1e9615 @@ -896,9 +890,9 @@ pyserial==3.5 \ --hash=sha256:3c77e014170dfffbd816e6ffc205e9842efb10be9f58ec16d3e8675b4925cddb \ --hash=sha256:c4451db6ba391ca6ca299fb3ec7bae67a5c55dde170964c7a14ceefec02f2cf0 # via -r requirements-actions.in -pytest==8.4.0 \ - --hash=sha256:14d920b48472ea0dbf68e45b96cd1ffda4705f33307dcc86c676c1b5104838a6 \ - --hash=sha256:f40f825768ad76c0977cbacdf1fd37c6f7a468e460ea6a0636078f8972d4517e +pytest==8.4.1 \ + --hash=sha256:539c70ba6fcead8e78eebbf1115e8b589e7565830d7d006a8723f19ac8a0afb7 \ + --hash=sha256:7c67fd69174877359ed9371ec3af8a3d2b04741818c51e5e99cc1742251fa93c # via -r requirements-actions.in python-can==4.5.0 \ --hash=sha256:1eec66833c1ac76a7e3d636ee0f8b4ba2752e892bab1c56ce74308b2216b5445 \ @@ -1229,32 +1223,24 @@ tomli==2.2.1 \ --hash=sha256:e85e99945e688e32d5a35c1ff38ed0b3f41f43fad8df0bdf79f72b2ba7bc5272 \ --hash=sha256:ece47d672db52ac607a3d9599a9d48dcb2f2f735c6c2d1f34130085bb12b112a \ --hash=sha256:f4039b9cbc3048b2416cc57ab3bda989a6fcf9b36cf8937f01a6e731b64f80d7 - # via - # -r requirements-actions.in - # mypy - # pylint - # pyproject-api - # pytest - # tox + # via -r requirements-actions.in tomlkit==0.13.3 \ --hash=sha256:430cf247ee57df2b94ee3fbe588e71d362a941ebb545dec29b53961d61add2a1 \ --hash=sha256:c89c649d79ee40629a9fda55f8ace8c6a1b42deb912b2a8fd8d942ddadb606b0 # via pylint -tox==4.26.0 \ - --hash=sha256:75f17aaf09face9b97bd41645028d9f722301e912be8b4c65a3f938024560224 \ - --hash=sha256:a83b3b67b0159fa58e44e646505079e35a43317a62d2ae94725e0586266faeca +tox==4.27.0 \ + --hash=sha256:2b8a7fb986b82aa2c830c0615082a490d134e0626dbc9189986da46a313c4f20 \ + --hash=sha256:b97d5ecc0c0d5755bcc5348387fef793e1bfa68eb33746412f4c60881d7f5f57 # via -r requirements-actions.in typing-extensions==4.14.0 \ --hash=sha256:8676b788e32f02ab42d9e7c61324048ae4c6d844a399eebace3d4979d75ceef4 \ --hash=sha256:a1514509136dd0b477638fc68d6a91497af5076466ad0fa6c338e44e359944af # via - # astroid # elasticsearch # exceptiongroup # mypy # pygithub # python-can - # tox unidiff==0.7.5 \ --hash=sha256:2e5f0162052248946b9f0970a40e9e124236bf86c82b70821143a6fc1dea2574 \ --hash=sha256:c93bf2265cc1ba2a520e415ab05da587370bc2a3ae9e0414329f54f0c2fc09e8 @@ -1263,9 +1249,9 @@ uritools==5.0.0 \ --hash=sha256:68180cad154062bd5b5d9ffcdd464f8de6934414b25462ae807b00b8df9345de \ --hash=sha256:cead3a49ba8fbca3f91857343849d506d8639718f4a2e51b62e87393b493bd6f # via spdx-tools -urllib3==2.4.0 \ - --hash=sha256:414bc6535b787febd7567804cc015fee39daab8ad86268f1310a9250697de466 \ - --hash=sha256:4e16665048960a0900c702d4a66415956a584919c03361cac9f1df5c5dd7e813 +urllib3==2.5.0 \ + --hash=sha256:3fc47733c7e419d4bc3f6b3dc2b4f890bb743906a30d56ba4a5bfa4bbff92760 \ + --hash=sha256:e6b01673c0fa6a13e374b50871808eb3bf7046c4b125b216f6bf1cc604cff0dc # via # botocore # elastic-transport @@ -1366,9 +1352,9 @@ wrapt==1.17.2 \ # via # deprecated # python-can -xlsxwriter==3.2.3 \ - --hash=sha256:593f8296e8a91790c6d0378ab08b064f34a642b3feb787cf6738236bd0a4860d \ - --hash=sha256:ad6fd41bdcf1b885876b1f6b7087560aecc9ae5a9cc2ba97dcac7ab2e210d3d5 +xlsxwriter==3.2.5 \ + --hash=sha256:4f4824234e1eaf9d95df9a8fe974585ff91d0f5e3d3f12ace5b71e443c1c6abd \ + --hash=sha256:7e88469d607cdc920151c0ab3ce9cf1a83992d4b7bc730c5ffdd1a12115a7dbe # via -r requirements-actions.in xmltodict==0.14.2 \ --hash=sha256:201e7c28bb210e374999d1dde6382923ab0ed1a8a5faeece48ab525b7810a553 \ From 990fa0d507abc0fc4764f463d27619c049c3b208 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Wed, 11 Jun 2025 14:29:57 +0200 Subject: [PATCH 0785/2141] [nrf fromtree] scripts: west: spdx: extract copyright info MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit use REUSE to extract copyright text from source files and include in SBOM documents Signed-off-by: Benjamin Cabé (cherry picked from commit 8031f338dd44c3038f59b0e6cb01db8645fc0e1a) --- doc/develop/west/zephyr-cmds.rst | 7 +++++ scripts/requirements-actions.in | 1 + scripts/requirements-actions.txt | 38 ++++++++++++++++++++++---- scripts/requirements-base.txt | 1 + scripts/west_commands/zspdx/scanner.py | 30 ++++++++++++++++++++ 5 files changed, 72 insertions(+), 5 deletions(-) diff --git a/doc/develop/west/zephyr-cmds.rst b/doc/develop/west/zephyr-cmds.rst index e40093c3dd16..8049d5c4309e 100644 --- a/doc/develop/west/zephyr-cmds.rst +++ b/doc/develop/west/zephyr-cmds.rst @@ -130,6 +130,13 @@ Each file in the bill-of-materials is scanned, so that its hashes (SHA256 and SHA1) can be recorded, along with any detected licenses if an ``SPDX-License-Identifier`` comment appears in the file. +Copyright notices are extracted using the third-party :command:`reuse` tool from the REUSE group. +When found, these notices are added to SPDX documents as ``FileCopyrightText`` fields. + +.. note:: + Copyright extraction uses heuristics that may not capture complete notice text, so + ``FileCopyrightText`` content is best-effort. This aligns with SPDX specification recommendations. + SPDX Relationships are created to indicate dependencies between CMake build targets, build targets that are linked together, and source files that are compiled to generate the built library files. diff --git a/scripts/requirements-actions.in b/scripts/requirements-actions.in index 0fb1eca5ad81..0fbced12c514 100644 --- a/scripts/requirements-actions.in +++ b/scripts/requirements-actions.in @@ -28,6 +28,7 @@ pytest python-magic-bin; sys_platform == "win32" python-magic; sys_platform != "win32" pyyaml +reuse ruff==0.11.11 setuptools>=70.2.0 spdx-tools diff --git a/scripts/requirements-actions.txt b/scripts/requirements-actions.txt index 5dc028452880..e9faf32c7f91 100644 --- a/scripts/requirements-actions.txt +++ b/scripts/requirements-actions.txt @@ -12,6 +12,10 @@ astroid==3.3.10 \ --hash=sha256:104fb9cb9b27ea95e847a94c003be03a9e039334a8ebca5ee27dafaf5c5711eb \ --hash=sha256:c332157953060c6deb9caa57303ae0d20b0fbdb2e59b4a4f2a6ba49d0a7961ce # via pylint +attrs==25.3.0 \ + --hash=sha256:427318ce031701fea540783410126f03899a97ffc6f61596ad581ac2e40e3bc3 \ + --hash=sha256:75d7cefc7fb576747b2c81b4442d4d4a1ce0900973527c011d1030fd3bf4af1b + # via reuse awscli==1.40.38 \ --hash=sha256:3f90f2815e3b72691785d2bbd4f2c3dcbde311c55e1f5633a37cc3e514ba6fdb \ --hash=sha256:ec9b69ff4600ef151df3336f0e7af4cf30280d27f9d8e67e09c4b386ceb1f154 @@ -20,10 +24,16 @@ beartype==0.21.0 \ --hash=sha256:b6a1bd56c72f31b0a496a36cc55df6e2f475db166ad07fa4acc7e74f4c7f34c0 \ --hash=sha256:f9a5078f5ce87261c2d22851d19b050b64f6a805439e8793aecf01ce660d3244 # via spdx-tools +binaryornot==0.4.4 \ + --hash=sha256:359501dfc9d40632edc9fac890e19542db1a287bbcfa58175b66658392018061 \ + --hash=sha256:b8b71173c917bddcd2c16070412e369c3ed7f0528926f70cac18a6c97fd563e4 + # via reuse boolean-py==5.0 \ --hash=sha256:60cbc4bad079753721d32649545505362c754e121570ada4658b852a3a318d95 \ --hash=sha256:ef28a70bd43115208441b53a045d1549e2f0ec6e3d08a9d142cbc41c1938e8d9 - # via license-expression + # via + # license-expression + # reuse botocore==1.38.39 \ --hash=sha256:2305f688e9328af473a504197584112f228513e06412038d83205ce8d1456f40 \ --hash=sha256:ee3aa03af1dabed4f3710cd64f6d9d488281eee720710bf1cf9f2b2fd30025ae @@ -118,7 +128,9 @@ cffi==1.17.1 \ chardet==5.2.0 \ --hash=sha256:1b3b6ff479a8c414bc3fa2c0852995695c4a026dcd6d0633b2dd092ca39c1cf7 \ --hash=sha256:e1cf59446890a00105fe7b7912492ea04b6e6f06d4b742b2c788469e34c82970 - # via tox + # via + # binaryornot + # tox charset-normalizer==3.4.2 \ --hash=sha256:005fa3432484527f9732ebd315da8da8001593e2cf46a3d817669f062c3d9ed4 \ --hash=sha256:046595208aae0120559a67693ecc65dd75d46f7bf687f159127046628178dc45 \ @@ -212,7 +224,9 @@ charset-normalizer==3.4.2 \ --hash=sha256:fb707f3e15060adf5b7ada797624a6c6e0138e2a26baa089df64c68ee98e040f \ --hash=sha256:fcbe676a55d7445b22c10967bceaaf0ee69407fbe0ece4d032b6eb8d4565982a \ --hash=sha256:fdb20a30fe1175ecabed17cbf7812f7b804b8a315a25f24678bcdf120a90077f - # via requests + # via + # python-debian + # requests clang-format==20.1.6 \ --hash=sha256:0ea008a20951527d35a1e2b8febdca3c47c6f8e9a1bd174601c891e20053ef2e \ --hash=sha256:11530ff352c64176ba4297ad398452d9fcd442b4a8bb2a804cc7915bc94b96e1 \ @@ -236,6 +250,7 @@ click==8.1.3 \ --hash=sha256:bb4d8133cb15a609f44e8213d9b391b0809795062913b383c62be0ee95b1db48 # via # gitlint-core + # reuse # spdx-tools colorama==0.4.6 \ --hash=sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44 \ @@ -452,6 +467,7 @@ jinja2==3.1.6 \ # via # gcovr # junit2html + # reuse jmespath==1.0.1 \ --hash=sha256:02e2e4cc71b5bcab88332eebf907519190dd9e6e82107fa7f83b1003a6252980 \ --hash=sha256:90261b206d6defd58fdd5e85f478bf633a2901798906be2ad389150c5c60edbe @@ -466,7 +482,9 @@ junitparser==3.2.0 \ license-expression==30.4.1 \ --hash=sha256:679646bc3261a17690494a3e1cada446e5ee342dbd87dcfa4a0c24cc5dce13ee \ --hash=sha256:9f02105f9e0fcecba6a85dfbbed7d94ea1c3a70cf23ddbfb5adf3438a6f6fce0 - # via spdx-tools + # via + # reuse + # spdx-tools lxml==5.4.0 \ --hash=sha256:00b8686694423ddae324cf614e1b9659c2edb754de617703c3d29ff568448df5 \ --hash=sha256:073eb6dcdf1f587d9b88c8c93528b57eccda40209cf9be549d469b942b41d70b \ @@ -906,6 +924,10 @@ python-dateutil==2.9.0.post0 \ # botocore # elasticsearch # pykwalify +python-debian==1.0.1 \ + --hash=sha256:3ada9b83a3d671b58081782c0969cffa0102f6ce433fbbc7cf21275b8b5cc771 \ + --hash=sha256:8f137c230c1d9279c2ac892b35915068b2aca090c9fd3da5671ff87af32af12c + # via reuse python-magic==0.4.27 ; sys_platform != 'win32' \ --hash=sha256:c1ba14b08e4a5f5c31a302b7721239695b2f0f058d125bd5ce1ee36b9d9d3c3b \ --hash=sha256:c212960ad306f700aa0d01e5d7a325d20548ff97eb9920dcd29513174f0294d3 @@ -1079,6 +1101,10 @@ requests==2.32.4 \ --hash=sha256:27babd3cda2a6d50b30443204ee89830707d396671944c998b5975b031ac2b2c \ --hash=sha256:27d0316682c8a29834d3264820024b62a36942083d52caf2f14c0591336d3422 # via pygithub +reuse==5.0.2 \ + --hash=sha256:7a680f00324e87a72061677a892d8cbabfddf7adcf7a5376aeeed2d78995bbbb \ + --hash=sha256:878016ae5dd29c10bad4606d6676c12a268c12aa9fcfea66403598e16eed085c + # via -r requirements-actions.in rsa==4.7.2 \ --hash=sha256:78f9a9bf4e7be0c5ded4583326e7461e3a3c5aae24073648b4bdfa797d78c9d2 \ --hash=sha256:9d689e6ca1b3038bc82bf8d23e944b6b6037bc02301a574935b2dd946e0353b9 @@ -1227,7 +1253,9 @@ tomli==2.2.1 \ tomlkit==0.13.3 \ --hash=sha256:430cf247ee57df2b94ee3fbe588e71d362a941ebb545dec29b53961d61add2a1 \ --hash=sha256:c89c649d79ee40629a9fda55f8ace8c6a1b42deb912b2a8fd8d942ddadb606b0 - # via pylint + # via + # pylint + # reuse tox==4.27.0 \ --hash=sha256:2b8a7fb986b82aa2c830c0615082a490d134e0626dbc9189986da46a313c4f20 \ --hash=sha256:b97d5ecc0c0d5755bcc5348387fef793e1bfa68eb33746412f4c60881d7f5f57 diff --git a/scripts/requirements-base.txt b/scripts/requirements-base.txt index 6e3cc0616cf4..2b35d3df097c 100644 --- a/scripts/requirements-base.txt +++ b/scripts/requirements-base.txt @@ -24,6 +24,7 @@ pyserial requests>=2.32.0 semver tqdm>=4.67.1 +reuse # for ram/rom reports anytree diff --git a/scripts/west_commands/zspdx/scanner.py b/scripts/west_commands/zspdx/scanner.py index 2a4ac792b9cd..93c43095598e 100644 --- a/scripts/west_commands/zspdx/scanner.py +++ b/scripts/west_commands/zspdx/scanner.py @@ -6,6 +6,7 @@ import os import re +from reuse.project import Project from west import log from zspdx.licenses import LICENSES @@ -177,6 +178,32 @@ def normalizeExpression(licsConcluded): return " AND ".join(revised) +def getCopyrightInfo(filePath): + """ + Scans the specified file for copyright information using REUSE tools. + + Arguments: + - filePath: path to file to scan + + Returns: list of copyright statements if found; empty list if not found + """ + log.dbg(f" - getting copyright info for {filePath}") + + try: + project = Project(os.path.dirname(filePath)) + infos = project.reuse_info_of(filePath) + copyrights = [] + + for info in infos: + if info.copyright_lines: + copyrights.extend(info.copyright_lines) + + return copyrights + except Exception as e: + log.wrn(f"Error getting copyright info for {filePath}: {e}") + return [] + + def scanDocument(cfg, doc): """ Scan for licenses and calculate hashes for all Files and Packages @@ -213,6 +240,9 @@ def scanDocument(cfg, doc): f.concludedLicense = expression f.licenseInfoInFile = splitExpression(expression) + if copyrights := getCopyrightInfo(f.abspath): + f.copyrightText = f"\n{'\n'.join(copyrights)}\n" + # check if any custom license IDs should be flagged for document for lic in f.licenseInfoInFile: checkLicenseValid(lic, doc) From 4ae5a61a99616ca8161296cb98e84c424130c1d7 Mon Sep 17 00:00:00 2001 From: Declan Snyder Date: Fri, 27 Jun 2025 13:11:36 -0500 Subject: [PATCH 0786/2141] [nrf fromtree] scripts: check_compliance: Fix traceback in junitparser junitparser had a bug causing a traceback when running the checkpatch check compliance module, fix is in 4.0.1 of junitparser from this PR: https://github.com/weiwei/junitparser/pull/168 Update requirements to make sure we get this version. Signed-off-by: Declan Snyder (cherry picked from commit 1f1a2e25b205adc90650235fa51e003ab954cbcf) --- scripts/requirements-actions.in | 2 +- scripts/requirements-compliance.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/requirements-actions.in b/scripts/requirements-actions.in index 0fbced12c514..4bdb9b0fbdad 100644 --- a/scripts/requirements-actions.in +++ b/scripts/requirements-actions.in @@ -11,7 +11,7 @@ gitpython>=3.1.41 ijson intelhex junit2html -junitparser>=2 +junitparser>=4.0.1 lxml>=5.3.0 mock mypy diff --git a/scripts/requirements-compliance.txt b/scripts/requirements-compliance.txt index 19bdcb3071f3..3c3841cf33ed 100644 --- a/scripts/requirements-compliance.txt +++ b/scripts/requirements-compliance.txt @@ -4,7 +4,7 @@ # zephyr-keep-sorted-start clang-format>=15.0.0 gitlint -junitparser>=2 +junitparser>=4.0.1 lxml>=5.3.0 pykwalify pylint>=3 From 654c27e193d4815a4d984375ddc418f19c582fc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Thu, 3 Jul 2025 10:21:23 +0200 Subject: [PATCH 0787/2141] [nrf fromtree] Revert "doc: ci: Zephyr now requires Python 3.12 or higher" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 043bb5848871aad90ded036efd2b31060afbb8df. Note that scripts/requirements-actions.txt might not be 100% the same as what was pinned prior to the revert due to it being difficult to restore previous versions while also accounting for the new dependencies that were added in the meantime. Signed-off-by: Benjamin Cabé (cherry picked from commit f672cb72d495b95acce00b45ba4e71b96f081e1a) --- cmake/modules/python.cmake | 2 +- doc/develop/getting_started/index.rst | 2 +- doc/releases/migration-guide-4.2.rst | 5 - doc/requirements.txt | 322 +++++++++++---------- scripts/ci/check_compliance.py | 2 +- scripts/requirements-actions.txt | 389 ++++++++++++-------------- 6 files changed, 356 insertions(+), 366 deletions(-) diff --git a/cmake/modules/python.cmake b/cmake/modules/python.cmake index 1438c3fcdaa6..e01d31921202 100644 --- a/cmake/modules/python.cmake +++ b/cmake/modules/python.cmake @@ -11,7 +11,7 @@ if (WIN32) set(ENV{PYTHONIOENCODING} "utf-8") endif() -set(PYTHON_MINIMUM_REQUIRED 3.12) +set(PYTHON_MINIMUM_REQUIRED 3.10) if(NOT DEFINED Python3_EXECUTABLE AND DEFINED WEST_PYTHON) set(Python3_EXECUTABLE "${WEST_PYTHON}") diff --git a/doc/develop/getting_started/index.rst b/doc/develop/getting_started/index.rst index 5ba0d070fcaf..78f43e70b5fd 100644 --- a/doc/develop/getting_started/index.rst +++ b/doc/develop/getting_started/index.rst @@ -62,7 +62,7 @@ The current minimum required version for the main dependencies are: - 3.20.5 * - `Python `_ - - 3.12 + - 3.10 * - `Devicetree compiler `_ - 1.4.6 diff --git a/doc/releases/migration-guide-4.2.rst b/doc/releases/migration-guide-4.2.rst index 26e4bd655e7d..9b31f4a16348 100644 --- a/doc/releases/migration-guide-4.2.rst +++ b/doc/releases/migration-guide-4.2.rst @@ -20,11 +20,6 @@ the :ref:`release notes`. :local: :depth: 2 -Common -****** - -* The minimum required Python version is now 3.12 (from 3.10). - Build System ************ diff --git a/doc/requirements.txt b/doc/requirements.txt index 3d424a5627ee..255ff1321a59 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -1,5 +1,5 @@ # This file was autogenerated by uv via the following command: -# uv pip compile --universal --python-version 3.12 --generate-hashes requirements.in --output-file requirements.txt +# uv pip compile --universal --python-version 3.10 --generate-hashes requirements.in --output-file requirements.txt alabaster==1.0.0 \ --hash=sha256:c00dca57bca26fa62a6d7d0a9fcce65f3e026e9bfe33e9c538fd3fbb2144fd9e \ --hash=sha256:fc6786402dc3fcb2de3cabd5fe455a2db534b371124f1f21de8731783dec828b @@ -145,6 +145,12 @@ docutils==0.21.2 \ doxmlparser==1.14.0 \ --hash=sha256:1037dcc4aadf908feb2d908685159972bb2975322fbe2b120f5cac5a938f0b14 # via -r requirements.in +exceptiongroup==1.3.0 ; python_full_version < '3.11' \ + --hash=sha256:4d111e6e0c13d0644cad6ddaa7ed0261a0b36971f6d23e7ec9b4b9097da78a10 \ + --hash=sha256:b241f5885f560bc56a59ee63ca4c6a8bfa46ae4ad651af316d4e81817bb9fd88 + # via + # anyio + # pytest h11==0.16.0 \ --hash=sha256:4e35b956cf45792e4caa5885e69fba00bdbc6ffafbfa020300e549b208ee5ff1 \ --hash=sha256:63cf8bbe7522de3bf65932fda1d9c2772064ffb3dae62d55932da54b31cb6c86 @@ -167,139 +173,97 @@ jinja2==3.1.6 \ --hash=sha256:0137fb05990d35f1275a587e9aee6d56da821fc83491a0fb838183be43f66d6d \ --hash=sha256:85ece4451f492d0c13c5dd7c13a64681a86afae63a5f347908daf103ce6d2f67 # via sphinx -lxml==5.4.0 \ - --hash=sha256:00b8686694423ddae324cf614e1b9659c2edb754de617703c3d29ff568448df5 \ - --hash=sha256:073eb6dcdf1f587d9b88c8c93528b57eccda40209cf9be549d469b942b41d70b \ - --hash=sha256:09846782b1ef650b321484ad429217f5154da4d6e786636c38e434fa32e94e49 \ - --hash=sha256:0a01ce7d8479dce84fc03324e3b0c9c90b1ece9a9bb6a1b6c9025e7e4520e78c \ - --hash=sha256:0be91891bdb06ebe65122aa6bf3fc94489960cf7e03033c6f83a90863b23c58b \ - --hash=sha256:0cef4feae82709eed352cd7e97ae062ef6ae9c7b5dbe3663f104cd2c0e8d94ba \ - --hash=sha256:0e108352e203c7afd0eb91d782582f00a0b16a948d204d4dec8565024fafeea5 \ - --hash=sha256:0ea0252b51d296a75f6118ed0d8696888e7403408ad42345d7dfd0d1e93309a7 \ - --hash=sha256:0fce1294a0497edb034cb416ad3e77ecc89b313cff7adbee5334e4dc0d11f422 \ - --hash=sha256:1320091caa89805df7dcb9e908add28166113dcd062590668514dbd510798c88 \ - --hash=sha256:142accb3e4d1edae4b392bd165a9abdee8a3c432a2cca193df995bc3886249c8 \ - --hash=sha256:14479c2ad1cb08b62bb941ba8e0e05938524ee3c3114644df905d2331c76cd57 \ - --hash=sha256:151d6c40bc9db11e960619d2bf2ec5829f0aaffb10b41dcf6ad2ce0f3c0b2325 \ - --hash=sha256:15a665ad90054a3d4f397bc40f73948d48e36e4c09f9bcffc7d90c87410e478a \ - --hash=sha256:1a42b3a19346e5601d1b8296ff6ef3d76038058f311902edd574461e9c036982 \ - --hash=sha256:1af80c6316ae68aded77e91cd9d80648f7dd40406cef73df841aa3c36f6907c8 \ - --hash=sha256:1b717b00a71b901b4667226bba282dd462c42ccf618ade12f9ba3674e1fabc55 \ - --hash=sha256:1dc4ca99e89c335a7ed47d38964abcb36c5910790f9bd106f2a8fa2ee0b909d2 \ - --hash=sha256:20e16c08254b9b6466526bc1828d9370ee6c0d60a4b64836bc3ac2917d1e16df \ - --hash=sha256:226046e386556a45ebc787871d6d2467b32c37ce76c2680f5c608e25823ffc84 \ - --hash=sha256:24974f774f3a78ac12b95e3a20ef0931795ff04dbb16db81a90c37f589819551 \ - --hash=sha256:24f6df5f24fc3385f622c0c9d63fe34604893bc1a5bdbb2dbf5870f85f9a404a \ - --hash=sha256:27a9ded0f0b52098ff89dd4c418325b987feed2ea5cc86e8860b0f844285d740 \ - --hash=sha256:29f451a4b614a7b5b6c2e043d7b64a15bd8304d7e767055e8ab68387a8cacf4e \ - --hash=sha256:2b31a3a77501d86d8ade128abb01082724c0dfd9524f542f2f07d693c9f1175f \ - --hash=sha256:2c62891b1ea3094bb12097822b3d44b93fc6c325f2043c4d2736a8ff09e65f60 \ - --hash=sha256:2dc191e60425ad70e75a68c9fd90ab284df64d9cd410ba8d2b641c0c45bc006e \ - --hash=sha256:31e63621e073e04697c1b2d23fcb89991790eef370ec37ce4d5d469f40924ed6 \ - --hash=sha256:32697d2ea994e0db19c1df9e40275ffe84973e4232b5c274f47e7c1ec9763cdd \ - --hash=sha256:3a3178b4873df8ef9457a4875703488eb1622632a9cee6d76464b60e90adbfcd \ - --hash=sha256:3b9c2754cef6963f3408ab381ea55f47dabc6f78f4b8ebb0f0b25cf1ac1f7609 \ - --hash=sha256:3d3c30ba1c9b48c68489dc1829a6eede9873f52edca1dda900066542528d6b20 \ - --hash=sha256:3e6d5557989cdc3ebb5302bbdc42b439733a841891762ded9514e74f60319ad6 \ - --hash=sha256:4025bf2884ac4370a3243c5aa8d66d3cb9e15d3ddd0af2d796eccc5f0244390e \ - --hash=sha256:4291d3c409a17febf817259cb37bc62cb7eb398bcc95c1356947e2871911ae61 \ - --hash=sha256:4329422de653cdb2b72afa39b0aa04252fca9071550044904b2e7036d9d97fe4 \ - --hash=sha256:43d549b876ce64aa18b2328faff70f5877f8c6dede415f80a2f799d31644d776 \ - --hash=sha256:460508a4b07364d6abf53acaa0a90b6d370fafde5693ef37602566613a9b0779 \ - --hash=sha256:47fb24cc0f052f0576ea382872b3fc7e1f7e3028e53299ea751839418ade92a6 \ - --hash=sha256:48b4afaf38bf79109bb060d9016fad014a9a48fb244e11b94f74ae366a64d252 \ - --hash=sha256:497cab4d8254c2a90bf988f162ace2ddbfdd806fce3bda3f581b9d24c852e03c \ - --hash=sha256:4aa412a82e460571fad592d0f93ce9935a20090029ba08eca05c614f99b0cc92 \ - --hash=sha256:4b7ce10634113651d6f383aa712a194179dcd496bd8c41e191cec2099fa09de5 \ - --hash=sha256:4cd915c0fb1bed47b5e6d6edd424ac25856252f09120e3e8ba5154b6b921860e \ - --hash=sha256:4d885698f5019abe0de3d352caf9466d5de2baded00a06ef3f1216c1a58ae78f \ - --hash=sha256:4f5322cf38fe0e21c2d73901abf68e6329dc02a4994e483adbcf92b568a09a54 \ - --hash=sha256:50441c9de951a153c698b9b99992e806b71c1f36d14b154592580ff4a9d0d877 \ - --hash=sha256:529024ab3a505fed78fe3cc5ddc079464e709f6c892733e3f5842007cec8ac6e \ - --hash=sha256:53370c26500d22b45182f98847243efb518d268374a9570409d2e2276232fd37 \ - --hash=sha256:53d9469ab5460402c19553b56c3648746774ecd0681b1b27ea74d5d8a3ef5590 \ - --hash=sha256:56dbdbab0551532bb26c19c914848d7251d73edb507c3079d6805fa8bba5b706 \ - --hash=sha256:5a99d86351f9c15e4a901fc56404b485b1462039db59288b203f8c629260a142 \ - --hash=sha256:5cca36a194a4eb4e2ed6be36923d3cffd03dcdf477515dea687185506583d4c9 \ - --hash=sha256:5f11a1526ebd0dee85e7b1e39e39a0cc0d9d03fb527f56d8457f6df48a10dc0c \ - --hash=sha256:61c7bbf432f09ee44b1ccaa24896d21075e533cd01477966a5ff5a71d88b2f56 \ - --hash=sha256:639978bccb04c42677db43c79bdaa23785dc7f9b83bfd87570da8207872f1ce5 \ - --hash=sha256:63e7968ff83da2eb6fdda967483a7a023aa497d85ad8f05c3ad9b1f2e8c84987 \ - --hash=sha256:664cdc733bc87449fe781dbb1f309090966c11cc0c0cd7b84af956a02a8a4729 \ - --hash=sha256:67ed8a40665b84d161bae3181aa2763beea3747f748bca5874b4af4d75998f87 \ - --hash=sha256:67f779374c6b9753ae0a0195a892a1c234ce8416e4448fe1e9f34746482070a7 \ - --hash=sha256:6854f8bd8a1536f8a1d9a3655e6354faa6406621cf857dc27b681b69860645c7 \ - --hash=sha256:696ea9e87442467819ac22394ca36cb3d01848dad1be6fac3fb612d3bd5a12cf \ - --hash=sha256:6ef80aeac414f33c24b3815ecd560cee272786c3adfa5f31316d8b349bfade28 \ - --hash=sha256:72ac9762a9f8ce74c9eed4a4e74306f2f18613a6b71fa065495a67ac227b3056 \ - --hash=sha256:75133890e40d229d6c5837b0312abbe5bac1c342452cf0e12523477cd3aa21e7 \ - --hash=sha256:7605c1c32c3d6e8c990dd28a0970a3cbbf1429d5b92279e37fda05fb0c92190e \ - --hash=sha256:773e27b62920199c6197130632c18fb7ead3257fce1ffb7d286912e56ddb79e0 \ - --hash=sha256:795f61bcaf8770e1b37eec24edf9771b307df3af74d1d6f27d812e15a9ff3872 \ - --hash=sha256:79d5bfa9c1b455336f52343130b2067164040604e41f6dc4d8313867ed540079 \ - --hash=sha256:7a62cc23d754bb449d63ff35334acc9f5c02e6dae830d78dab4dd12b78a524f4 \ - --hash=sha256:7be701c24e7f843e6788353c055d806e8bd8466b52907bafe5d13ec6a6dbaecd \ - --hash=sha256:7ca56ebc2c474e8f3d5761debfd9283b8b18c76c4fc0967b74aeafba1f5647f9 \ - --hash=sha256:7ce1a171ec325192c6a636b64c94418e71a1964f56d002cc28122fceff0b6121 \ - --hash=sha256:891f7f991a68d20c75cb13c5c9142b2a3f9eb161f1f12a9489c82172d1f133c0 \ - --hash=sha256:8f82125bc7203c5ae8633a7d5d20bcfdff0ba33e436e4ab0abc026a53a8960b7 \ - --hash=sha256:91505d3ddebf268bb1588eb0f63821f738d20e1e7f05d3c647a5ca900288760b \ - --hash=sha256:942a5d73f739ad7c452bf739a62a0f83e2578afd6b8e5406308731f4ce78b16d \ - --hash=sha256:9454b8d8200ec99a224df8854786262b1bd6461f4280064c807303c642c05e76 \ - --hash=sha256:9459e6892f59ecea2e2584ee1058f5d8f629446eab52ba2305ae13a32a059530 \ - --hash=sha256:9776af1aad5a4b4a1317242ee2bea51da54b2a7b7b48674be736d463c999f37d \ - --hash=sha256:97dac543661e84a284502e0cf8a67b5c711b0ad5fb661d1bd505c02f8cf716d7 \ - --hash=sha256:98a3912194c079ef37e716ed228ae0dcb960992100461b704aea4e93af6b0bb9 \ - --hash=sha256:9b4a3bd174cc9cdaa1afbc4620c049038b441d6ba07629d89a83b408e54c35cd \ - --hash=sha256:9c886b481aefdf818ad44846145f6eaf373a20d200b5ce1a5c8e1bc2d8745410 \ - --hash=sha256:9ceaf423b50ecfc23ca00b7f50b64baba85fb3fb91c53e2c9d00bc86150c7e40 \ - --hash=sha256:a11a96c3b3f7551c8a8109aa65e8594e551d5a84c76bf950da33d0fb6dfafab7 \ - --hash=sha256:a3bcdde35d82ff385f4ede021df801b5c4a5bcdfb61ea87caabcebfc4945dc1b \ - --hash=sha256:a7fb111eef4d05909b82152721a59c1b14d0f365e2be4c742a473c5d7372f4f5 \ - --hash=sha256:a81e1196f0a5b4167a8dafe3a66aa67c4addac1b22dc47947abd5d5c7a3f24b5 \ - --hash=sha256:a8c9b7f16b63e65bbba889acb436a1034a82d34fa09752d754f88d708eca80e1 \ - --hash=sha256:a8ef956fce64c8551221f395ba21d0724fed6b9b6242ca4f2f7beb4ce2f41997 \ - --hash=sha256:ab339536aa798b1e17750733663d272038bf28069761d5be57cb4a9b0137b4f8 \ - --hash=sha256:ac7ba71f9561cd7d7b55e1ea5511543c0282e2b6450f122672a2694621d63b7e \ - --hash=sha256:aea53d51859b6c64e7c51d522c03cc2c48b9b5d6172126854cc7f01aa11f52bc \ - --hash=sha256:aea7c06667b987787c7d1f5e1dfcd70419b711cdb47d6b4bb4ad4b76777a0563 \ - --hash=sha256:aefe1a7cb852fa61150fcb21a8c8fcea7b58c4cb11fbe59c97a0a4b31cae3c8c \ - --hash=sha256:b0989737a3ba6cf2a16efb857fb0dfa20bc5c542737fddb6d893fde48be45433 \ - --hash=sha256:b108134b9667bcd71236c5a02aad5ddd073e372fb5d48ea74853e009fe38acb6 \ - --hash=sha256:b12cb6527599808ada9eb2cd6e0e7d3d8f13fe7bbb01c6311255a15ded4c7ab4 \ - --hash=sha256:b5aff6f3e818e6bdbbb38e5967520f174b18f539c2b9de867b1e7fde6f8d95a4 \ - --hash=sha256:b67319b4aef1a6c56576ff544b67a2a6fbd7eaee485b241cabf53115e8908b8f \ - --hash=sha256:b7c86884ad23d61b025989d99bfdd92a7351de956e01c61307cb87035960bcb1 \ - --hash=sha256:b92b69441d1bd39f4940f9eadfa417a25862242ca2c396b406f9272ef09cdcaa \ - --hash=sha256:bcb7a1096b4b6b24ce1ac24d4942ad98f983cd3810f9711bcd0293f43a9d8b9f \ - --hash=sha256:bda3ea44c39eb74e2488297bb39d47186ed01342f0022c8ff407c250ac3f498e \ - --hash=sha256:be2ba4c3c5b7900246a8f866580700ef0d538f2ca32535e991027bdaba944063 \ - --hash=sha256:c5681160758d3f6ac5b4fea370495c48aac0989d6a0f01bb9a72ad8ef5ab75c4 \ - --hash=sha256:c5d32f5284012deaccd37da1e2cd42f081feaa76981f0eaa474351b68df813c5 \ - --hash=sha256:c6364038c519dffdbe07e3cf42e6a7f8b90c275d4d1617a69bb59734c1a2d571 \ - --hash=sha256:c70e93fba207106cb16bf852e421c37bbded92acd5964390aad07cb50d60f5cf \ - --hash=sha256:ca755eebf0d9e62d6cb013f1261e510317a41bf4650f22963474a663fdfe02aa \ - --hash=sha256:cccd007d5c95279e529c146d095f1d39ac05139de26c098166c4beb9374b0f4d \ - --hash=sha256:ce31158630a6ac85bddd6b830cffd46085ff90498b397bd0a259f59d27a12188 \ - --hash=sha256:ce9c671845de9699904b1e9df95acfe8dfc183f2310f163cdaa91a3535af95de \ - --hash=sha256:d12832e1dbea4be280b22fd0ea7c9b87f0d8fc51ba06e92dc62d52f804f78ebd \ - --hash=sha256:d2ed1b3cb9ff1c10e6e8b00941bb2e5bb568b307bfc6b17dffbbe8be5eecba86 \ - --hash=sha256:d5663bc1b471c79f5c833cffbc9b87d7bf13f87e055a5c86c363ccd2348d7e82 \ - --hash=sha256:d90b729fd2732df28130c064aac9bb8aff14ba20baa4aee7bd0795ff1187545f \ - --hash=sha256:dc0af80267edc68adf85f2a5d9be1cdf062f973db6790c1d065e45025fa26140 \ - --hash=sha256:de5b4e1088523e2b6f730d0509a9a813355b7f5659d70eb4f319c76beea2e250 \ - --hash=sha256:de6f6bb8a7840c7bf216fb83eec4e2f79f7325eca8858167b68708b929ab2172 \ - --hash=sha256:df53330a3bff250f10472ce96a9af28628ff1f4efc51ccba351a8820bca2a8ba \ - --hash=sha256:e094ec83694b59d263802ed03a8384594fcce477ce484b0cbcd0008a211ca751 \ - --hash=sha256:e794f698ae4c5084414efea0f5cc9f4ac562ec02d66e1484ff822ef97c2cadff \ - --hash=sha256:e7bc6df34d42322c5289e37e9971d6ed114e3776b45fa879f734bded9d1fea9c \ - --hash=sha256:eaf24066ad0b30917186420d51e2e3edf4b0e2ea68d8cd885b14dc8afdcf6556 \ - --hash=sha256:ecf4c4b83f1ab3d5a7ace10bafcb6f11df6156857a3c418244cef41ca9fa3e44 \ - --hash=sha256:ef5a7178fcc73b7d8c07229e89f8eb45b2908a9238eb90dcfc46571ccf0383b8 \ - --hash=sha256:f5cb182f6396706dc6cc1896dd02b1c889d644c081b0cdec38747573db88a7d7 \ - --hash=sha256:fa0e294046de09acd6146be0ed6727d1f42ded4ce3ea1e9a19c11b6774eea27c \ - --hash=sha256:fb54f7c6bafaa808f27166569b1511fc42701a7713858dddc08afdde9746849e \ - --hash=sha256:fd3be6481ef54b8cfd0e1e953323b7aa9d9789b94842d0e5b142ef4bb7999539 +lxml==6.0.0 \ + --hash=sha256:013090383863b72c62a702d07678b658fa2567aa58d373d963cca245b017e065 \ + --hash=sha256:032e65120339d44cdc3efc326c9f660f5f7205f3a535c1fdbf898b29ea01fb72 \ + --hash=sha256:048a930eb4572829604982e39a0c7289ab5dc8abc7fc9f5aabd6fbc08c154e93 \ + --hash=sha256:04d67ceee6db4bcb92987ccb16e53bef6b42ced872509f333c04fb58a3315256 \ + --hash=sha256:059c4cbf3973a621b62ea3132934ae737da2c132a788e6cfb9b08d63a0ef73f9 \ + --hash=sha256:0e32698462aacc5c1cf6bdfebc9c781821b7e74c79f13e5ffc8bfe27c42b1abf \ + --hash=sha256:1676b56d48048a62ef77a250428d1f31f610763636e0784ba67a9740823988ca \ + --hash=sha256:17f090a9bc0ce8da51a5632092f98a7e7f84bca26f33d161a98b57f7fb0004ca \ + --hash=sha256:185efc2fed89cdd97552585c624d3c908f0464090f4b91f7d92f8ed2f3b18f54 \ + --hash=sha256:1fa377b827ca2023244a06554c6e7dc6828a10aaf74ca41965c5d8a4925aebb4 \ + --hash=sha256:2181e4b1d07dde53986023482673c0f1fba5178ef800f9ab95ad791e8bdded6a \ + --hash=sha256:219e0431ea8006e15005767f0351e3f7f9143e793e58519dc97fe9e07fae5563 \ + --hash=sha256:21db1ec5525780fd07251636eb5f7acb84003e9382c72c18c542a87c416ade03 \ + --hash=sha256:246b40f8a4aec341cbbf52617cad8ab7c888d944bfe12a6abd2b1f6cfb6f6082 \ + --hash=sha256:2793a627e95d119e9f1e19720730472f5543a6d84c50ea33313ce328d870f2dd \ + --hash=sha256:2930aa001a3776c3e2601cb8e0a15d21b8270528d89cc308be4843ade546b9ab \ + --hash=sha256:2ae06fbab4f1bb7db4f7c8ca9897dc8db4447d1a2b9bee78474ad403437bcc29 \ + --hash=sha256:2b4790b558bee331a933e08883c423f65bbcd07e278f91b2272489e31ab1e2b4 \ + --hash=sha256:2cfcf84f1defed7e5798ef4f88aa25fcc52d279be731ce904789aa7ccfb7e8d2 \ + --hash=sha256:2dd1cc3ea7e60bfb31ff32cafe07e24839df573a5e7c2d33304082a5019bcd58 \ + --hash=sha256:2f34687222b78fff795feeb799a7d44eca2477c3d9d3a46ce17d51a4f383e32e \ + --hash=sha256:310b719b695b3dd442cdfbbe64936b2f2e231bb91d998e99e6f0daf991a3eba3 \ + --hash=sha256:34190a1ec4f1e84af256495436b2d196529c3f2094f0af80202947567fdbf2e7 \ + --hash=sha256:35bc626eec405f745199200ccb5c6b36f202675d204aa29bb52e27ba2b71dea8 \ + --hash=sha256:36531f81c8214e293097cd2b7873f178997dae33d3667caaae8bdfb9666b76c0 \ + --hash=sha256:390240baeb9f415a82eefc2e13285016f9c8b5ad71ec80574ae8fa9605093cd7 \ + --hash=sha256:40442e2a4456e9910875ac12951476d36c0870dcb38a68719f8c4686609897c4 \ + --hash=sha256:4337e4aec93b7c011f7ee2e357b0d30562edd1955620fdd4aeab6aacd90d43c5 \ + --hash=sha256:43cfbb7db02b30ad3926e8fceaef260ba2fb7df787e38fa2df890c1ca7966c3b \ + --hash=sha256:43fe5af2d590bf4691531b1d9a2495d7aab2090547eaacd224a3afec95706d76 \ + --hash=sha256:46b9ed911f36bfeb6338e0b482e7fe7c27d362c52fde29f221fddbc9ee2227e7 \ + --hash=sha256:4d23854ecf381ab1facc8f353dcd9adeddef3652268ee75297c1164c987c11dc \ + --hash=sha256:4eb114a0754fd00075c12648d991ec7a4357f9cb873042cc9a77bf3a7e30c9db \ + --hash=sha256:4ee56288d0df919e4aac43b539dd0e34bb55d6a12a6562038e8d6f3ed07f9e36 \ + --hash=sha256:51a5e4c61a4541bd1cd3ba74766d0c9b6c12d6a1a4964ef60026832aac8e79b3 \ + --hash=sha256:522fe7abb41309e9543b0d9b8b434f2b630c5fdaf6482bee642b34c8c70079c8 \ + --hash=sha256:54c4855eabd9fc29707d30141be99e5cd1102e7d2258d2892314cf4c110726c3 \ + --hash=sha256:5592401cdf3dc682194727c1ddaa8aa0f3ddc57ca64fd03226a430b955eab6f6 \ + --hash=sha256:58ffd35bd5425c3c3b9692d078bf7ab851441434531a7e517c4984d5634cd65b \ + --hash=sha256:5967fe415b1920a3877a4195e9a2b779249630ee49ece22021c690320ff07452 \ + --hash=sha256:5fcd7d3b1d8ecb91445bd71b9c88bdbeae528fefee4f379895becfc72298d181 \ + --hash=sha256:63b634facdfbad421d4b61c90735688465d4ab3a8853ac22c76ccac2baf98d97 \ + --hash=sha256:690b20e3388a7ec98e899fd54c924e50ba6693874aa65ef9cb53de7f7de9d64a \ + --hash=sha256:6da7cd4f405fd7db56e51e96bff0865b9853ae70df0e6720624049da76bde2da \ + --hash=sha256:7488a43033c958637b1a08cddc9188eb06d3ad36582cebc7d4815980b47e27ef \ + --hash=sha256:74e748012f8c19b47f7d6321ac929a9a94ee92ef12bc4298c47e8b7219b26541 \ + --hash=sha256:78718d8454a6e928470d511bf8ac93f469283a45c354995f7d19e77292f26108 \ + --hash=sha256:7bf61bc4345c1895221357af8f3e89f8c103d93156ef326532d35c707e2fb19d \ + --hash=sha256:7da298e1659e45d151b4028ad5c7974917e108afb48731f4ed785d02b6818994 \ + --hash=sha256:84ef591495ffd3f9dcabffd6391db7bb70d7230b5c35ef5148354a134f56f2be \ + --hash=sha256:85b14a4689d5cff426c12eefe750738648706ea2753b20c2f973b2a000d3d261 \ + --hash=sha256:8a2e76efbf8772add72d002d67a4c3d0958638696f541734304c7f28217a9cab \ + --hash=sha256:8cb26f51c82d77483cdcd2b4a53cda55bbee29b3c2f3ddeb47182a2a9064e4eb \ + --hash=sha256:8db5dc617cb937ae17ff3403c3a70a7de9df4852a046f93e71edaec678f721d0 \ + --hash=sha256:9ab542c91f5a47aaa58abdd8ea84b498e8e49fe4b883d67800017757a3eb78e8 \ + --hash=sha256:9da022c14baeec36edfcc8daf0e281e2f55b950249a455776f0d1adeeada4734 \ + --hash=sha256:9f4b481b6cc3a897adb4279216695150bbe7a44c03daba3c894f49d2037e0a24 \ + --hash=sha256:a52a4704811e2623b0324a18d41ad4b9fabf43ce5ff99b14e40a520e2190c851 \ + --hash=sha256:a55da151d0b0c6ab176b4e761670ac0e2667817a1e0dadd04a01d0561a219349 \ + --hash=sha256:a674c0948789e9136d69065cc28009c1b1874c6ea340253db58be7622ce6398f \ + --hash=sha256:ae74f7c762270196d2dda56f8dd7309411f08a4084ff2dfcc0b095a218df2e06 \ + --hash=sha256:afd27d8629ae94c5d863e32ab0e1d5590371d296b87dae0a751fb22bf3685741 \ + --hash=sha256:b2d71cdefda9424adff9a3607ba5bbfc60ee972d73c21c7e3c19e71037574816 \ + --hash=sha256:b34339898bb556a2351a1830f88f751679f343eabf9cf05841c95b165152c9e7 \ + --hash=sha256:b372d10d17a701b0945f67be58fae4664fd056b85e0ff0fbc1e6c951cdbc0512 \ + --hash=sha256:b3c98d5b24c6095e89e03d65d5c574705be3d49c0d8ca10c17a8a4b5201b72f5 \ + --hash=sha256:b8dd6dd0e9c1992613ccda2bcb74fc9d49159dbe0f0ca4753f37527749885c25 \ + --hash=sha256:bd5913b4972681ffc9718bc2d4c53cde39ef81415e1671ff93e9aa30b46595e7 \ + --hash=sha256:c0b5fa5eda84057a4f1bbb4bb77a8c28ff20ae7ce211588d698ae453e13c6281 \ + --hash=sha256:c16304bba98f48a28ae10e32a8e75c349dd742c45156f297e16eeb1ba9287a1f \ + --hash=sha256:c24b8efd9c0f62bad0439283c2c795ef916c5a6b75f03c17799775c7ae3c0c9e \ + --hash=sha256:c2a5e8d207311a0170aca0eb6b160af91adc29ec121832e4ac151a57743a1e1e \ + --hash=sha256:c352fc8f36f7e9727db17adbf93f82499457b3d7e5511368569b4c5bd155a922 \ + --hash=sha256:c86df1c9af35d903d2b52d22ea3e66db8058d21dc0f59842ca5deb0595921141 \ + --hash=sha256:ca50bd612438258a91b5b3788c6621c1f05c8c478e7951899f492be42defc0da \ + --hash=sha256:d18a25b19ca7307045581b18b3ec9ead2b1db5ccd8719c291f0cd0a5cec6cb81 \ + --hash=sha256:d4f0c66df4386b75d2ab1e20a489f30dc7fd9a06a896d64980541506086be1f1 \ + --hash=sha256:d7ae472f74afcc47320238b5dbfd363aba111a525943c8a34a1b657c6be934c3 \ + --hash=sha256:db0efd6bae1c4730b9c863fc4f5f3c0fa3e8f05cae2c44ae141cb9dfc7d091dc \ + --hash=sha256:dbdd7679a6f4f08152818043dbb39491d1af3332128b3752c3ec5cebc0011a72 \ + --hash=sha256:e0b1520ef900e9ef62e392dd3d7ae4f5fa224d1dd62897a792cf353eb20b6cae \ + --hash=sha256:e2030956cf4886b10be9a0285c6802e078ec2391e1dd7ff3eb509c2c95a69b76 \ + --hash=sha256:e35e8aaaf3981489f42884b59726693de32dabfc438ac10ef4eb3409961fd402 \ + --hash=sha256:e380e85b93f148ad28ac15f8117e2fd8e5437aa7732d65e260134f83ce67911b \ + --hash=sha256:edf6e4c8fe14dfe316939711e3ece3f9a20760aabf686051b537a7562f4da91a \ + --hash=sha256:f3389924581d9a770c6caa4df4e74b606180869043b9073e2cec324bad6e306e \ + --hash=sha256:f64ccf593916e93b8d36ed55401bb7fe9c7d5de3180ce2e10b08f82a8f397316 \ + --hash=sha256:f720a14aa102a38907c6d5030e3d66b3b680c3e6f6bc95473931ea3c00c59967 \ + --hash=sha256:f8d19565ae3eb956d84da3ef367aa7def14a2735d05bd275cd54c0301f0d0d6c \ + --hash=sha256:f97487996a39cb18278ca33f7be98198f278d0bc3c5d0fd4d7b3d63646ca3c8a # via doxmlparser markupsafe==3.0.2 \ --hash=sha256:0bff5e0ae4ef2e1ae4fdf2dfd5b76c75e5c2fa4132d05fc1b0dabcd20c7e28c4 \ @@ -374,9 +338,9 @@ pluggy==1.6.0 \ --hash=sha256:7dcc130b76258d33b90f61b658791dede3486c3e6bfb003ee5c9bfb396dd22f3 \ --hash=sha256:e920276dd6813095e9377c0bc5566d94c932c33b27a3e3945d8389c374dd4746 # via pytest -pygments==2.19.1 \ - --hash=sha256:61c16d2a8576dc0649d9f39e089b5f02bcd27fba10d8fb4dcc28173f7a45151f \ - --hash=sha256:9ea1544ad55cecf4b8242fab6dd35a93bbce657034b0611ee383099054ab6d8c +pygments==2.19.2 \ + --hash=sha256:636cb2477cec7f8952536970bc533bc43743542f70392ae026374600add5b887 \ + --hash=sha256:86540386c03d588bb81d44bc3928634ff26449851e99741617ecb9037ee5ec0b # via # -r requirements.in # pytest @@ -457,7 +421,7 @@ requests==2.32.4 \ --hash=sha256:27babd3cda2a6d50b30443204ee89830707d396671944c998b5975b031ac2b2c \ --hash=sha256:27d0316682c8a29834d3264820024b62a36942083d52caf2f14c0591336d3422 # via sphinx -roman-numerals-py==3.1.0 \ +roman-numerals-py==3.1.0 ; python_full_version >= '3.11' \ --hash=sha256:9da2ad2fb670bcf24e81070ceb3be72f6c11c440d73bd579fbeca1e9f330954c \ --hash=sha256:be4bf804f083a4ce001b5eb7e3c0862479d10f94c936f6c4e5f250aa5ff5bd2d # via sphinx @@ -531,16 +495,30 @@ snowballstemmer==3.0.1 \ --hash=sha256:6cd7b3897da8d6c9ffb968a6781fa6532dce9c3618a4b127d920dab764a19064 \ --hash=sha256:6d5eeeec8e9f84d4d56b847692bacf79bc2c8e90c7f80ca4444ff8b6f2e52895 # via sphinx -sphinx==8.2.3 \ +sphinx==8.1.3 ; python_full_version < '3.11' \ + --hash=sha256:09719015511837b76bf6e03e42eb7595ac8c2e41eeb9c29c5b755c6b677992a2 \ + --hash=sha256:43c1911eecb0d3e161ad78611bc905d1ad0e523e4ddc202a58a821773dc4c927 + # via + # -r requirements.in + # sphinx-autobuild + # sphinx-copybutton + # sphinx-last-updated-by-git + # sphinx-notfound-page + # sphinx-rtd-theme + # sphinx-tabs + # sphinx-togglebutton + # sphinxcontrib-jquery + # sphinxcontrib-svg2pdfconverter +sphinx==8.2.3 ; python_full_version >= '3.11' \ --hash=sha256:398ad29dee7f63a75888314e9424d40f52ce5a6a87ae88e7071e80af296ec348 \ --hash=sha256:4405915165f13521d875a8c29c8970800a0141c14cc5416a38feca4ea5d9b9c3 # via # -r requirements.in # sphinx-autobuild # sphinx-copybutton + # sphinx-last-updated-by-git # sphinx-notfound-page # sphinx-rtd-theme - # sphinx-sitemap # sphinx-tabs # sphinx-togglebutton # sphinxcontrib-jquery @@ -553,6 +531,10 @@ sphinx-copybutton==0.5.2 \ --hash=sha256:4cf17c82fb9646d1bc9ca92ac280813a3b605d8c421225fd9913154103ee1fbd \ --hash=sha256:fb543fd386d917746c9a2c50360c7905b605726b9355cd26e9974857afeae06e # via -r requirements.in +sphinx-last-updated-by-git==0.3.8 \ + --hash=sha256:6382c8285ac1f222483a58569b78c0371af5e55f7fbf9c01e5e8a72d6fdfa499 \ + --hash=sha256:c145011f4609d841805b69a9300099fc02fed8f5bb9e5bcef77d97aea97b7761 + # via sphinx-sitemap sphinx-notfound-page==1.1.0 \ --hash=sha256:835dc76ff7914577a1f58d80a2c8418fb6138c0932c8da8adce4d9096fbcd389 \ --hash=sha256:913e1754370bb3db201d9300d458a8b8b5fb22e9246a816643a819a9ea2b8067 @@ -561,9 +543,9 @@ sphinx-rtd-theme==3.0.2 \ --hash=sha256:422ccc750c3a3a311de4ae327e82affdaf59eb695ba4936538552f3b00f4ee13 \ --hash=sha256:b7457bc25dda723b20b086a670b9953c859eab60a2a03ee8eb2bb23e176e5f85 # via -r requirements.in -sphinx-sitemap==2.6.0 \ - --hash=sha256:5e0c66b9f2e371ede80c659866a9eaad337d46ab02802f9c7e5f7bc5893c28d2 \ - --hash=sha256:7478e417d141f99c9af27ccd635f44c03a471a08b20e778a0f9daef7ace1d30b +sphinx-sitemap==2.7.2 \ + --hash=sha256:1a6a8dcecb0ffb85fd37678f785cfcc40adfe3eebafb05e678971e5260b117e4 \ + --hash=sha256:819e028e27579b47efa0e2f863b87136b711c45f13e84730610e80316f6883da # via -r requirements.in sphinx-tabs==3.4.7 \ --hash=sha256:991ad4a424ff54119799ba1491701aa8130dd43509474aef45a81c42d889784d \ @@ -605,21 +587,61 @@ sphinxcontrib-svg2pdfconverter==1.3.0 \ --hash=sha256:5df6b0895e2e2101d720bfd08841bb56d74c57b1f86229a7c18b771dfdf4ffbb \ --hash=sha256:6411a4cc2f57eed96a0d7bbfa139f68cbe7983018881e1e6d7c46053cd69911f # via -r requirements.in -starlette==0.47.0 \ - --hash=sha256:1f64887e94a447fed5f23309fb6890ef23349b7e478faa7b24a851cd4eb844af \ - --hash=sha256:9d052d4933683af40ffd47c7465433570b4949dc937e20ad1d73b34e72f10c37 +starlette==0.47.1 \ + --hash=sha256:5e11c9f5c7c3f24959edbf2dffdc01bba860228acf657129467d8a7468591527 \ + --hash=sha256:aef012dd2b6be325ffa16698f9dc533614fb1cebd593a906b90dc1025529a79b # via sphinx-autobuild +tomli==2.2.1 ; python_full_version < '3.11' \ + --hash=sha256:023aa114dd824ade0100497eb2318602af309e5a55595f76b626d6d9f3b7b0a6 \ + --hash=sha256:02abe224de6ae62c19f090f68da4e27b10af2b93213d36cf44e6e1c5abd19fdd \ + --hash=sha256:286f0ca2ffeeb5b9bd4fcc8d6c330534323ec51b2f52da063b11c502da16f30c \ + --hash=sha256:2d0f2fdd22b02c6d81637a3c95f8cd77f995846af7414c5c4b8d0545afa1bc4b \ + --hash=sha256:33580bccab0338d00994d7f16f4c4ec25b776af3ffaac1ed74e0b3fc95e885a8 \ + --hash=sha256:400e720fe168c0f8521520190686ef8ef033fb19fc493da09779e592861b78c6 \ + --hash=sha256:40741994320b232529c802f8bc86da4e1aa9f413db394617b9a256ae0f9a7f77 \ + --hash=sha256:465af0e0875402f1d226519c9904f37254b3045fc5084697cefb9bdde1ff99ff \ + --hash=sha256:4a8f6e44de52d5e6c657c9fe83b562f5f4256d8ebbfe4ff922c495620a7f6cea \ + --hash=sha256:4e340144ad7ae1533cb897d406382b4b6fede8890a03738ff1683af800d54192 \ + --hash=sha256:678e4fa69e4575eb77d103de3df8a895e1591b48e740211bd1067378c69e8249 \ + --hash=sha256:6972ca9c9cc9f0acaa56a8ca1ff51e7af152a9f87fb64623e31d5c83700080ee \ + --hash=sha256:7fc04e92e1d624a4a63c76474610238576942d6b8950a2d7f908a340494e67e4 \ + --hash=sha256:889f80ef92701b9dbb224e49ec87c645ce5df3fa2cc548664eb8a25e03127a98 \ + --hash=sha256:8d57ca8095a641b8237d5b079147646153d22552f1c637fd3ba7f4b0b29167a8 \ + --hash=sha256:8dd28b3e155b80f4d54beb40a441d366adcfe740969820caf156c019fb5c7ec4 \ + --hash=sha256:9316dc65bed1684c9a98ee68759ceaed29d229e985297003e494aa825ebb0281 \ + --hash=sha256:a198f10c4d1b1375d7687bc25294306e551bf1abfa4eace6650070a5c1ae2744 \ + --hash=sha256:a38aa0308e754b0e3c67e344754dff64999ff9b513e691d0e786265c93583c69 \ + --hash=sha256:a92ef1a44547e894e2a17d24e7557a5e85a9e1d0048b0b5e7541f76c5032cb13 \ + --hash=sha256:ac065718db92ca818f8d6141b5f66369833d4a80a9d74435a268c52bdfa73140 \ + --hash=sha256:b82ebccc8c8a36f2094e969560a1b836758481f3dc360ce9a3277c65f374285e \ + --hash=sha256:c954d2250168d28797dd4e3ac5cf812a406cd5a92674ee4c8f123c889786aa8e \ + --hash=sha256:cb55c73c5f4408779d0cf3eef9f762b9c9f147a77de7b258bef0a5628adc85cc \ + --hash=sha256:cd45e1dc79c835ce60f7404ec8119f2eb06d38b1deba146f07ced3bbc44505ff \ + --hash=sha256:d3f5614314d758649ab2ab3a62d4f2004c825922f9e370b29416484086b264ec \ + --hash=sha256:d920f33822747519673ee656a4b6ac33e382eca9d331c87770faa3eef562aeb2 \ + --hash=sha256:db2b95f9de79181805df90bedc5a5ab4c165e6ec3fe99f970d0e302f384ad222 \ + --hash=sha256:e59e304978767a54663af13c07b3d1af22ddee3bb2fb0618ca1593e4f593a106 \ + --hash=sha256:e85e99945e688e32d5a35c1ff38ed0b3f41f43fad8df0bdf79f72b2ba7bc5272 \ + --hash=sha256:ece47d672db52ac607a3d9599a9d48dcb2f2f735c6c2d1f34130085bb12b112a \ + --hash=sha256:f4039b9cbc3048b2416cc57ab3bda989a6fcf9b36cf8937f01a6e731b64f80d7 + # via + # pytest + # sphinx typing-extensions==4.14.0 ; python_full_version < '3.13' \ --hash=sha256:8676b788e32f02ab42d9e7c61324048ae4c6d844a399eebace3d4979d75ceef4 \ --hash=sha256:a1514509136dd0b477638fc68d6a91497af5076466ad0fa6c338e44e359944af - # via anyio + # via + # anyio + # exceptiongroup + # starlette + # uvicorn urllib3==2.5.0 \ --hash=sha256:3fc47733c7e419d4bc3f6b3dc2b4f890bb743906a30d56ba4a5bfa4bbff92760 \ --hash=sha256:e6b01673c0fa6a13e374b50871808eb3bf7046c4b125b216f6bf1cc604cff0dc # via requests -uvicorn==0.34.3 \ - --hash=sha256:16246631db62bdfbf069b0645177d6e8a77ba950cfedbfd093acef9444e4d885 \ - --hash=sha256:35919a9a979d7a59334b6b10e05d77c1d0d574c50e0fc98b8b1a0f165708b55a +uvicorn==0.35.0 \ + --hash=sha256:197535216b25ff9b785e29a0b79199f55222193d47f820816e7da751e9bc8d4a \ + --hash=sha256:bc662f087f7cf2ce11a1d7fd70b90c9f98ef2e2831556dd078d131b96cc94a01 # via sphinx-autobuild watchfiles==1.1.0 \ --hash=sha256:00645eb79a3faa70d9cb15c8d4187bb72970b2470e938670240c7998dad9f13a \ diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index c32a40fd35c8..f1da73f3ec0d 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -2008,7 +2008,7 @@ class PythonCompatCheck(ComplianceTest): name = "PythonCompat" doc = "Check that Python files are compatible with Zephyr minimum supported Python version." - MAX_VERSION = (3, 12) + MAX_VERSION = (3, 10) MAX_VERSION_STR = f"{MAX_VERSION[0]}.{MAX_VERSION[1]}" def run(self): diff --git a/scripts/requirements-actions.txt b/scripts/requirements-actions.txt index e9faf32c7f91..7588db2575f9 100644 --- a/scripts/requirements-actions.txt +++ b/scripts/requirements-actions.txt @@ -1,5 +1,5 @@ # This file was autogenerated by uv via the following command: -# uv pip compile --universal --python-version 3.12 --generate-hashes requirements-actions.in --output-file requirements-actions.txt +# uv pip compile --universal --python-version 3.10 --generate-hashes requirements-actions.in --output-file requirements-actions.txt anytree==2.13.0 \ --hash=sha256:4cbcf10df36b1f1cba131b7e487ff3edafc9d6e932a3c70071b5b768bab901ff \ --hash=sha256:c9d3aa6825fdd06af7ebb05b4ef291d2db63e62bb1f9b7d9b71354be9d362714 @@ -16,9 +16,9 @@ attrs==25.3.0 \ --hash=sha256:427318ce031701fea540783410126f03899a97ffc6f61596ad581ac2e40e3bc3 \ --hash=sha256:75d7cefc7fb576747b2c81b4442d4d4a1ce0900973527c011d1030fd3bf4af1b # via reuse -awscli==1.40.38 \ - --hash=sha256:3f90f2815e3b72691785d2bbd4f2c3dcbde311c55e1f5633a37cc3e514ba6fdb \ - --hash=sha256:ec9b69ff4600ef151df3336f0e7af4cf30280d27f9d8e67e09c4b386ceb1f154 +awscli==1.41.2 \ + --hash=sha256:2c219f88a810c2908954ac50b52f3791c875a3c3a439d16e5a8eac31190c95b7 \ + --hash=sha256:428c5ff8a9c970405848ca49d7f4727e7afcfef5a93abd9227af730f77d24e03 # via -r requirements-actions.in beartype==0.21.0 \ --hash=sha256:b6a1bd56c72f31b0a496a36cc55df6e2f475db166ad07fa4acc7e74f4c7f34c0 \ @@ -34,9 +34,9 @@ boolean-py==5.0 \ # via # license-expression # reuse -botocore==1.38.39 \ - --hash=sha256:2305f688e9328af473a504197584112f228513e06412038d83205ce8d1456f40 \ - --hash=sha256:ee3aa03af1dabed4f3710cd64f6d9d488281eee720710bf1cf9f2b2fd30025ae +botocore==1.39.2 \ + --hash=sha256:474445fa8b281dd5db8fc62184f0f6e494d4f1efb96fe10312490583e67a9dd0 \ + --hash=sha256:921cab9aa6e1e4ceddcece5b55b57daae7722168e74409f1aafcc2c5589df676 # via # awscli # s3transfer @@ -227,23 +227,23 @@ charset-normalizer==3.4.2 \ # via # python-debian # requests -clang-format==20.1.6 \ - --hash=sha256:0ea008a20951527d35a1e2b8febdca3c47c6f8e9a1bd174601c891e20053ef2e \ - --hash=sha256:11530ff352c64176ba4297ad398452d9fcd442b4a8bb2a804cc7915bc94b96e1 \ - --hash=sha256:12626f058755198b92b26076312cc1052f8dd7868bd6cf61b65d2911154ef6df \ - --hash=sha256:15dbc113b4d2f1eb545adb9b815b96c2d64aff947de9453802e47ef1c5267996 \ - --hash=sha256:2ea00197fe650f29b77dd870cd87891e15d9d2dac75c4e9072f4eee99a928dcb \ - --hash=sha256:5351f353062bb0df9c31b4e84c8a9d6b472f9f0727ebd5ab1f96fd3e792756fa \ - --hash=sha256:58b3ef54bc32304990f1890cc982607f69359e46b0e98350718125bea24566de \ - --hash=sha256:779153a039c8552438dd9a3925f5dad20d8b5a812329703f98cd5da7bb91556c \ - --hash=sha256:8ce12618431d8955026c30a2d19a3ae9ddc6d918ad24a4e00a10f8f130454469 \ - --hash=sha256:8ce920b103447d21ff44d41a7ad412794bde1b737426a126c8ab141f00bbfba8 \ - --hash=sha256:bfc4a9922ee1f7c0ec5a8250cb72e755a1ddc73e5d50866efe00561be6fc69eb \ - --hash=sha256:c93c8b7feed66521349918f741b40ef6eaf85dfa1b5eb1303a49ed4608fd882a \ - --hash=sha256:ce8f5bbacba3f05adc2cd64a1780e36c81b54a2caa0b4c618c611b2b45124930 \ - --hash=sha256:d1d64ccfb14dcd93cd98321191e9fbaef049774d050f0c084b7aede41e79fee2 \ - --hash=sha256:d84fffa03432c400bb560f3c8181c2dfa6be05b9b866f7d0180dfb41e0f91907 \ - --hash=sha256:e1e59c3a23d033df261ce8048c96f0493285cff1b65d3f519b77a47854653d27 +clang-format==20.1.7 \ + --hash=sha256:11431cb437ed22be85744ea47b3a6801bc61de7ac4b775bf1cb89ee190c992d4 \ + --hash=sha256:1dad1e6f9eb732b76046bf5810c6ee78b9e6cd6b3616cb75d9bde06ecd3222e6 \ + --hash=sha256:29f5fe39e60579ca253d31c1122ce06a80716400ec7e5dc38833da80f88dbbd5 \ + --hash=sha256:2b0d76b9bf1f993bad33d2216b5fce4c407bc748fa31659ab7f51ca60df113c9 \ + --hash=sha256:4a9b909b1a9eb0b91aae51fdeeeb013ce20f9079d2e0fa8b8381e97c268dc889 \ + --hash=sha256:4c05114a10efe85c11fde518fe0fadc2977ce4a997a26ceaac88521daee83bbd \ + --hash=sha256:6db0b7271af8cbc2656b3b6b31e4276d5c6b8ceafb1981760f4738cfbe0a9e43 \ + --hash=sha256:70a904719a1bd6653d77ddc6d7b40418845912a1a2a419b9116b819a6b619f8c \ + --hash=sha256:7bd56bd0f519959488977dcddddba4e4fd07cba6225ed09ad658caa1f7286d1f \ + --hash=sha256:99cbfb99dab836027498190f55e543bed51bae33ae6dc256861e7aa91368de98 \ + --hash=sha256:9cd4d64dc0e34b23badad0ce3a235fb5c8ac63651d9f91d1c806356212cbca6c \ + --hash=sha256:b27ed7fe674e8a77461c8d5b117ed96021aa18233917b3fe54b95391e0b22d04 \ + --hash=sha256:bd144f093b4a3ac8a0f0d0ebb9b013974884d9da0627b9905949c6f3213aa850 \ + --hash=sha256:d11c62d38b9144d30021b884b0f95e7270a6bcbf4f22bdd7dae94a531d82fbba \ + --hash=sha256:d79484ce2c8f621242046c4bb0aefd49445ec5c7bc3c404af97490289791b777 \ + --hash=sha256:e5257e8188569e4e47fceb3ba3317b0b44dc5ab5046c8cc2d58c626430c747a6 # via -r requirements-actions.in click==8.1.3 \ --hash=sha256:7682dc8afb30297001674575ea00d1814d808d6a36af415a82bd481d37ba7b8e \ @@ -262,44 +262,44 @@ colorama==0.4.6 \ # pytest # tox # west -cryptography==45.0.4 \ - --hash=sha256:0339a692de47084969500ee455e42c58e449461e0ec845a34a6a9b9bf7df7fb8 \ - --hash=sha256:03dbff8411206713185b8cebe31bc5c0eb544799a50c09035733716b386e61a4 \ - --hash=sha256:06509dc70dd71fa56eaa138336244e2fbaf2ac164fc9b5e66828fccfd2b680d6 \ - --hash=sha256:0cf13c77d710131d33e63626bd55ae7c0efb701ebdc2b3a7952b9b23a0412862 \ - --hash=sha256:23b9c3ea30c3ed4db59e7b9619272e94891f8a3a5591d0b656a7582631ccf750 \ - --hash=sha256:25eb4d4d3e54595dc8adebc6bbd5623588991d86591a78c2548ffb64797341e2 \ - --hash=sha256:2882338b2a6e0bd337052e8b9007ced85c637da19ef9ecaf437744495c8c2999 \ - --hash=sha256:3530382a43a0e524bc931f187fc69ef4c42828cf7d7f592f7f249f602b5a4ab0 \ - --hash=sha256:425a9a6ac2823ee6e46a76a21a4e8342d8fa5c01e08b823c1f19a8b74f096069 \ - --hash=sha256:46cf7088bf91bdc9b26f9c55636492c1cce3e7aaf8041bbf0243f5e5325cfb2d \ - --hash=sha256:4828190fb6c4bcb6ebc6331f01fe66ae838bb3bd58e753b59d4b22eb444b996c \ - --hash=sha256:49fe9155ab32721b9122975e168a6760d8ce4cffe423bcd7ca269ba41b5dfac1 \ - --hash=sha256:4ca0f52170e821bc8da6fc0cc565b7bb8ff8d90d36b5e9fdd68e8a86bdf72036 \ - --hash=sha256:51dfbd4d26172d31150d84c19bbe06c68ea4b7f11bbc7b3a5e146b367c311349 \ - --hash=sha256:5f31e6b0a5a253f6aa49be67279be4a7e5a4ef259a9f33c69f7d1b1191939872 \ - --hash=sha256:627ba1bc94f6adf0b0a2e35d87020285ead22d9f648c7e75bb64f367375f3b22 \ - --hash=sha256:680806cf63baa0039b920f4976f5f31b10e772de42f16310a6839d9f21a26b0d \ - --hash=sha256:6a3511ae33f09094185d111160fd192c67aa0a2a8d19b54d36e4c78f651dc5ad \ - --hash=sha256:6a5bf57554e80f75a7db3d4b1dacaa2764611ae166ab42ea9a72bcdb5d577637 \ - --hash=sha256:6b613164cb8425e2f8db5849ffb84892e523bf6d26deb8f9bb76ae86181fa12b \ - --hash=sha256:7405ade85c83c37682c8fe65554759800a4a8c54b2d96e0f8ad114d31b808d57 \ - --hash=sha256:7aad98a25ed8ac917fdd8a9c1e706e5a0956e06c498be1f713b61734333a4507 \ - --hash=sha256:7bedbe4cc930fa4b100fc845ea1ea5788fcd7ae9562e669989c11618ae8d76ee \ - --hash=sha256:7ef2dde4fa9408475038fc9aadfc1fb2676b174e68356359632e980c661ec8f6 \ - --hash=sha256:817ee05c6c9f7a69a16200f0c90ab26d23a87701e2a284bd15156783e46dbcc8 \ - --hash=sha256:944e9ccf67a9594137f942d5b52c8d238b1b4e46c7a0c2891b7ae6e01e7c80a4 \ - --hash=sha256:964bcc28d867e0f5491a564b7debb3ffdd8717928d315d12e0d7defa9e43b723 \ - --hash=sha256:96d4819e25bf3b685199b304a0029ce4a3caf98947ce8a066c9137cc78ad2c58 \ - --hash=sha256:a77c6fb8d76e9c9f99f2f3437c1a4ac287b34eaf40997cfab1e9bd2be175ac39 \ - --hash=sha256:b0a97c927497e3bc36b33987abb99bf17a9a175a19af38a892dc4bbb844d7ee2 \ - --hash=sha256:b97737a3ffbea79eebb062eb0d67d72307195035332501722a9ca86bab9e3ab2 \ - --hash=sha256:bbc505d1dc469ac12a0a064214879eac6294038d6b24ae9f71faae1448a9608d \ - --hash=sha256:c22fe01e53dc65edd1945a2e6f0015e887f84ced233acecb64b4daadb32f5c97 \ - --hash=sha256:ce1678a2ccbe696cf3af15a75bb72ee008d7ff183c9228592ede9db467e64f1b \ - --hash=sha256:e00a6c10a5c53979d6242f123c0a97cff9f3abed7f064fc412c36dc521b5f257 \ - --hash=sha256:eaa3e28ea2235b33220b949c5a0d6cf79baa80eab2eb5607ca8ab7525331b9ff \ - --hash=sha256:f3fe7a5ae34d5a414957cc7f457e2b92076e72938423ac64d215722f6cf49a9e +cryptography==45.0.5 \ + --hash=sha256:0027d566d65a38497bc37e0dd7c2f8ceda73597d2ac9ba93810204f56f52ebc7 \ + --hash=sha256:101ee65078f6dd3e5a028d4f19c07ffa4dd22cce6a20eaa160f8b5219911e7d8 \ + --hash=sha256:12e55281d993a793b0e883066f590c1ae1e802e3acb67f8b442e721e475e6463 \ + --hash=sha256:14d96584701a887763384f3c47f0ca7c1cce322aa1c31172680eb596b890ec30 \ + --hash=sha256:1e1da5accc0c750056c556a93c3e9cb828970206c68867712ca5805e46dc806f \ + --hash=sha256:206210d03c1193f4e1ff681d22885181d47efa1ab3018766a7b32a7b3d6e6afd \ + --hash=sha256:2089cc8f70a6e454601525e5bf2779e665d7865af002a5dec8d14e561002e135 \ + --hash=sha256:3a264aae5f7fbb089dbc01e0242d3b67dffe3e6292e1f5182122bdf58e65215d \ + --hash=sha256:3af26738f2db354aafe492fb3869e955b12b2ef2e16908c8b9cb928128d42c57 \ + --hash=sha256:3fcfbefc4a7f332dece7272a88e410f611e79458fab97b5efe14e54fe476f4fd \ + --hash=sha256:460f8c39ba66af7db0545a8c6f2eabcbc5a5528fc1cf6c3fa9a1e44cec33385e \ + --hash=sha256:57c816dfbd1659a367831baca4b775b2a5b43c003daf52e9d57e1d30bc2e1b0e \ + --hash=sha256:5aa1e32983d4443e310f726ee4b071ab7569f58eedfdd65e9675484a4eb67bd1 \ + --hash=sha256:6ff8728d8d890b3dda5765276d1bc6fb099252915a2cd3aff960c4c195745dd0 \ + --hash=sha256:7259038202a47fdecee7e62e0fd0b0738b6daa335354396c6ddebdbe1206af2a \ + --hash=sha256:72e76caa004ab63accdf26023fccd1d087f6d90ec6048ff33ad0445abf7f605a \ + --hash=sha256:7760c1c2e1a7084153a0f68fab76e754083b126a47d0117c9ed15e69e2103492 \ + --hash=sha256:8c4a6ff8a30e9e3d38ac0539e9a9e02540ab3f827a3394f8852432f6b0ea152e \ + --hash=sha256:9024beb59aca9d31d36fcdc1604dd9bbeed0a55bface9f1908df19178e2f116e \ + --hash=sha256:90cb0a7bb35959f37e23303b7eed0a32280510030daba3f7fdfbb65defde6a97 \ + --hash=sha256:91098f02ca81579c85f66df8a588c78f331ca19089763d733e34ad359f474174 \ + --hash=sha256:926c3ea71a6043921050eaa639137e13dbe7b4ab25800932a8498364fc1abec9 \ + --hash=sha256:982518cd64c54fcada9d7e5cf28eabd3ee76bd03ab18e08a48cad7e8b6f31b18 \ + --hash=sha256:9b4cf6318915dccfe218e69bbec417fdd7c7185aa7aab139a2c0beb7468c89f0 \ + --hash=sha256:ad0caded895a00261a5b4aa9af828baede54638754b51955a0ac75576b831b27 \ + --hash=sha256:b85980d1e345fe769cfc57c57db2b59cff5464ee0c045d52c0df087e926fbe63 \ + --hash=sha256:b8fa8b0a35a9982a3c60ec79905ba5bb090fc0b9addcfd3dc2dd04267e45f25e \ + --hash=sha256:b9e38e0a83cd51e07f5a48ff9691cae95a79bea28fe4ded168a8e5c6c77e819d \ + --hash=sha256:bd4c45986472694e5121084c6ebbd112aa919a25e783b87eb95953c9573906d6 \ + --hash=sha256:be97d3a19c16a9be00edf79dca949c8fa7eff621763666a145f9f9535a5d7f42 \ + --hash=sha256:c648025b6840fe62e57107e0a25f604db740e728bd67da4f6f060f03017d5097 \ + --hash=sha256:d05a38884db2ba215218745f0781775806bde4f32e07b135348355fe8e4991d9 \ + --hash=sha256:dd420e577921c8c2d31289536c386aaa30140b473835e97f83bc71ea9d2baf2d \ + --hash=sha256:e357286c1b76403dd384d938f93c46b2b058ed4dfcdce64a770f0537ed3feb6f \ + --hash=sha256:e6c00130ed423201c5bc5544c23359141660b07999ad82e34e7bb8f882bb78e0 \ + --hash=sha256:e74d30ec9c7cb2f404af331d5b4099a9b322a8a6b25c4632755c8757345baac5 \ + --hash=sha256:f3562c2f23c612f2e4a6964a61d942f891d29ee320edb62ff48ffb99f3de9ae8 # via pyjwt deprecated==1.2.18 \ --hash=sha256:422b6f6d859da6f2ef57857761bfb392480502a64c3028ca9bbe86085d72115d \ @@ -331,7 +331,9 @@ elasticsearch==8.18.1 \ exceptiongroup==1.3.0 \ --hash=sha256:4d111e6e0c13d0644cad6ddaa7ed0261a0b36971f6d23e7ec9b4b9097da78a10 \ --hash=sha256:b241f5885f560bc56a59ee63ca4c6a8bfa46ae4ad651af316d4e81817bb9fd88 - # via -r requirements-actions.in + # via + # -r requirements-actions.in + # pytest filelock==3.18.0 \ --hash=sha256:adbc88eabb99d2fec8c9c1b229b171f18afa655400173ddc653d5d01501fb9f2 \ --hash=sha256:c401f4f8377c4464e6db25fff06205fd89bdd83b65eb0488ed1b160f780e21de @@ -457,6 +459,10 @@ intelhex==2.3.0 \ --hash=sha256:87cc5225657524ec6361354be928adfd56bcf2a3dcc646c40f8f094c39c07db4 \ --hash=sha256:892b7361a719f4945237da8ccf754e9513db32f5628852785aea108dcd250093 # via -r requirements-actions.in +isodate==0.7.2 ; python_full_version < '3.11' \ + --hash=sha256:28009937d8031054830160fce6d409ed342816b543597cece116d966c6d99e15 \ + --hash=sha256:4cd1aa0f43ca76f4a6c6c0292a85f40b35ec2e43e315b59f06e6d32171a953e6 + # via rdflib isort==6.0.1 \ --hash=sha256:1cb5df28dfbc742e490c5e41bad6da41b805b0a8be7bc93cd0fb2a8a890ac450 \ --hash=sha256:2dc5d7f65c9678d94c88dfc29161a320eec67328bc97aad576874cb4be1e9615 @@ -475,149 +481,107 @@ jmespath==1.0.1 \ junit2html==31.0.2 \ --hash=sha256:c7fd1f253d423f0df031d0cee8ef7d4d98d9f8bf6383a2d40dca639686814866 # via -r requirements-actions.in -junitparser==3.2.0 \ - --hash=sha256:b05e89c27e7b74b3c563a078d6e055d95cf397444f8f689b0ca616ebda0b3c65 \ - --hash=sha256:e14fdc0a999edfc15889b637390e8ef6ca09a49532416d3bd562857d42d4b96d +junitparser==4.0.2 \ + --hash=sha256:94c3570e41fcaedc64cc3c634ca99457fe41a84dd1aa8ff74e9e12e66223a155 \ + --hash=sha256:d5d07cece6d4a600ff3b7b96c8db5ffa45a91eed695cb86c45c3db113c1ca0f8 # via -r requirements-actions.in -license-expression==30.4.1 \ - --hash=sha256:679646bc3261a17690494a3e1cada446e5ee342dbd87dcfa4a0c24cc5dce13ee \ - --hash=sha256:9f02105f9e0fcecba6a85dfbbed7d94ea1c3a70cf23ddbfb5adf3438a6f6fce0 +license-expression==30.4.3 \ + --hash=sha256:49f439fea91c4d1a642f9f2902b58db1d42396c5e331045f41ce50df9b40b1f2 \ + --hash=sha256:fd3db53418133e0eef917606623bc125fbad3d1225ba8d23950999ee87c99280 # via # reuse # spdx-tools -lxml==5.4.0 \ - --hash=sha256:00b8686694423ddae324cf614e1b9659c2edb754de617703c3d29ff568448df5 \ - --hash=sha256:073eb6dcdf1f587d9b88c8c93528b57eccda40209cf9be549d469b942b41d70b \ - --hash=sha256:09846782b1ef650b321484ad429217f5154da4d6e786636c38e434fa32e94e49 \ - --hash=sha256:0a01ce7d8479dce84fc03324e3b0c9c90b1ece9a9bb6a1b6c9025e7e4520e78c \ - --hash=sha256:0be91891bdb06ebe65122aa6bf3fc94489960cf7e03033c6f83a90863b23c58b \ - --hash=sha256:0cef4feae82709eed352cd7e97ae062ef6ae9c7b5dbe3663f104cd2c0e8d94ba \ - --hash=sha256:0e108352e203c7afd0eb91d782582f00a0b16a948d204d4dec8565024fafeea5 \ - --hash=sha256:0ea0252b51d296a75f6118ed0d8696888e7403408ad42345d7dfd0d1e93309a7 \ - --hash=sha256:0fce1294a0497edb034cb416ad3e77ecc89b313cff7adbee5334e4dc0d11f422 \ - --hash=sha256:1320091caa89805df7dcb9e908add28166113dcd062590668514dbd510798c88 \ - --hash=sha256:142accb3e4d1edae4b392bd165a9abdee8a3c432a2cca193df995bc3886249c8 \ - --hash=sha256:14479c2ad1cb08b62bb941ba8e0e05938524ee3c3114644df905d2331c76cd57 \ - --hash=sha256:151d6c40bc9db11e960619d2bf2ec5829f0aaffb10b41dcf6ad2ce0f3c0b2325 \ - --hash=sha256:15a665ad90054a3d4f397bc40f73948d48e36e4c09f9bcffc7d90c87410e478a \ - --hash=sha256:1a42b3a19346e5601d1b8296ff6ef3d76038058f311902edd574461e9c036982 \ - --hash=sha256:1af80c6316ae68aded77e91cd9d80648f7dd40406cef73df841aa3c36f6907c8 \ - --hash=sha256:1b717b00a71b901b4667226bba282dd462c42ccf618ade12f9ba3674e1fabc55 \ - --hash=sha256:1dc4ca99e89c335a7ed47d38964abcb36c5910790f9bd106f2a8fa2ee0b909d2 \ - --hash=sha256:20e16c08254b9b6466526bc1828d9370ee6c0d60a4b64836bc3ac2917d1e16df \ - --hash=sha256:226046e386556a45ebc787871d6d2467b32c37ce76c2680f5c608e25823ffc84 \ - --hash=sha256:24974f774f3a78ac12b95e3a20ef0931795ff04dbb16db81a90c37f589819551 \ - --hash=sha256:24f6df5f24fc3385f622c0c9d63fe34604893bc1a5bdbb2dbf5870f85f9a404a \ - --hash=sha256:27a9ded0f0b52098ff89dd4c418325b987feed2ea5cc86e8860b0f844285d740 \ - --hash=sha256:29f451a4b614a7b5b6c2e043d7b64a15bd8304d7e767055e8ab68387a8cacf4e \ - --hash=sha256:2b31a3a77501d86d8ade128abb01082724c0dfd9524f542f2f07d693c9f1175f \ - --hash=sha256:2c62891b1ea3094bb12097822b3d44b93fc6c325f2043c4d2736a8ff09e65f60 \ - --hash=sha256:2dc191e60425ad70e75a68c9fd90ab284df64d9cd410ba8d2b641c0c45bc006e \ - --hash=sha256:31e63621e073e04697c1b2d23fcb89991790eef370ec37ce4d5d469f40924ed6 \ - --hash=sha256:32697d2ea994e0db19c1df9e40275ffe84973e4232b5c274f47e7c1ec9763cdd \ - --hash=sha256:3a3178b4873df8ef9457a4875703488eb1622632a9cee6d76464b60e90adbfcd \ - --hash=sha256:3b9c2754cef6963f3408ab381ea55f47dabc6f78f4b8ebb0f0b25cf1ac1f7609 \ - --hash=sha256:3d3c30ba1c9b48c68489dc1829a6eede9873f52edca1dda900066542528d6b20 \ - --hash=sha256:3e6d5557989cdc3ebb5302bbdc42b439733a841891762ded9514e74f60319ad6 \ - --hash=sha256:4025bf2884ac4370a3243c5aa8d66d3cb9e15d3ddd0af2d796eccc5f0244390e \ - --hash=sha256:4291d3c409a17febf817259cb37bc62cb7eb398bcc95c1356947e2871911ae61 \ - --hash=sha256:4329422de653cdb2b72afa39b0aa04252fca9071550044904b2e7036d9d97fe4 \ - --hash=sha256:43d549b876ce64aa18b2328faff70f5877f8c6dede415f80a2f799d31644d776 \ - --hash=sha256:460508a4b07364d6abf53acaa0a90b6d370fafde5693ef37602566613a9b0779 \ - --hash=sha256:47fb24cc0f052f0576ea382872b3fc7e1f7e3028e53299ea751839418ade92a6 \ - --hash=sha256:48b4afaf38bf79109bb060d9016fad014a9a48fb244e11b94f74ae366a64d252 \ - --hash=sha256:497cab4d8254c2a90bf988f162ace2ddbfdd806fce3bda3f581b9d24c852e03c \ - --hash=sha256:4aa412a82e460571fad592d0f93ce9935a20090029ba08eca05c614f99b0cc92 \ - --hash=sha256:4b7ce10634113651d6f383aa712a194179dcd496bd8c41e191cec2099fa09de5 \ - --hash=sha256:4cd915c0fb1bed47b5e6d6edd424ac25856252f09120e3e8ba5154b6b921860e \ - --hash=sha256:4d885698f5019abe0de3d352caf9466d5de2baded00a06ef3f1216c1a58ae78f \ - --hash=sha256:4f5322cf38fe0e21c2d73901abf68e6329dc02a4994e483adbcf92b568a09a54 \ - --hash=sha256:50441c9de951a153c698b9b99992e806b71c1f36d14b154592580ff4a9d0d877 \ - --hash=sha256:529024ab3a505fed78fe3cc5ddc079464e709f6c892733e3f5842007cec8ac6e \ - --hash=sha256:53370c26500d22b45182f98847243efb518d268374a9570409d2e2276232fd37 \ - --hash=sha256:53d9469ab5460402c19553b56c3648746774ecd0681b1b27ea74d5d8a3ef5590 \ - --hash=sha256:56dbdbab0551532bb26c19c914848d7251d73edb507c3079d6805fa8bba5b706 \ - --hash=sha256:5a99d86351f9c15e4a901fc56404b485b1462039db59288b203f8c629260a142 \ - --hash=sha256:5cca36a194a4eb4e2ed6be36923d3cffd03dcdf477515dea687185506583d4c9 \ - --hash=sha256:5f11a1526ebd0dee85e7b1e39e39a0cc0d9d03fb527f56d8457f6df48a10dc0c \ - --hash=sha256:61c7bbf432f09ee44b1ccaa24896d21075e533cd01477966a5ff5a71d88b2f56 \ - --hash=sha256:639978bccb04c42677db43c79bdaa23785dc7f9b83bfd87570da8207872f1ce5 \ - --hash=sha256:63e7968ff83da2eb6fdda967483a7a023aa497d85ad8f05c3ad9b1f2e8c84987 \ - --hash=sha256:664cdc733bc87449fe781dbb1f309090966c11cc0c0cd7b84af956a02a8a4729 \ - --hash=sha256:67ed8a40665b84d161bae3181aa2763beea3747f748bca5874b4af4d75998f87 \ - --hash=sha256:67f779374c6b9753ae0a0195a892a1c234ce8416e4448fe1e9f34746482070a7 \ - --hash=sha256:6854f8bd8a1536f8a1d9a3655e6354faa6406621cf857dc27b681b69860645c7 \ - --hash=sha256:696ea9e87442467819ac22394ca36cb3d01848dad1be6fac3fb612d3bd5a12cf \ - --hash=sha256:6ef80aeac414f33c24b3815ecd560cee272786c3adfa5f31316d8b349bfade28 \ - --hash=sha256:72ac9762a9f8ce74c9eed4a4e74306f2f18613a6b71fa065495a67ac227b3056 \ - --hash=sha256:75133890e40d229d6c5837b0312abbe5bac1c342452cf0e12523477cd3aa21e7 \ - --hash=sha256:7605c1c32c3d6e8c990dd28a0970a3cbbf1429d5b92279e37fda05fb0c92190e \ - --hash=sha256:773e27b62920199c6197130632c18fb7ead3257fce1ffb7d286912e56ddb79e0 \ - --hash=sha256:795f61bcaf8770e1b37eec24edf9771b307df3af74d1d6f27d812e15a9ff3872 \ - --hash=sha256:79d5bfa9c1b455336f52343130b2067164040604e41f6dc4d8313867ed540079 \ - --hash=sha256:7a62cc23d754bb449d63ff35334acc9f5c02e6dae830d78dab4dd12b78a524f4 \ - --hash=sha256:7be701c24e7f843e6788353c055d806e8bd8466b52907bafe5d13ec6a6dbaecd \ - --hash=sha256:7ca56ebc2c474e8f3d5761debfd9283b8b18c76c4fc0967b74aeafba1f5647f9 \ - --hash=sha256:7ce1a171ec325192c6a636b64c94418e71a1964f56d002cc28122fceff0b6121 \ - --hash=sha256:891f7f991a68d20c75cb13c5c9142b2a3f9eb161f1f12a9489c82172d1f133c0 \ - --hash=sha256:8f82125bc7203c5ae8633a7d5d20bcfdff0ba33e436e4ab0abc026a53a8960b7 \ - --hash=sha256:91505d3ddebf268bb1588eb0f63821f738d20e1e7f05d3c647a5ca900288760b \ - --hash=sha256:942a5d73f739ad7c452bf739a62a0f83e2578afd6b8e5406308731f4ce78b16d \ - --hash=sha256:9454b8d8200ec99a224df8854786262b1bd6461f4280064c807303c642c05e76 \ - --hash=sha256:9459e6892f59ecea2e2584ee1058f5d8f629446eab52ba2305ae13a32a059530 \ - --hash=sha256:9776af1aad5a4b4a1317242ee2bea51da54b2a7b7b48674be736d463c999f37d \ - --hash=sha256:97dac543661e84a284502e0cf8a67b5c711b0ad5fb661d1bd505c02f8cf716d7 \ - --hash=sha256:98a3912194c079ef37e716ed228ae0dcb960992100461b704aea4e93af6b0bb9 \ - --hash=sha256:9b4a3bd174cc9cdaa1afbc4620c049038b441d6ba07629d89a83b408e54c35cd \ - --hash=sha256:9c886b481aefdf818ad44846145f6eaf373a20d200b5ce1a5c8e1bc2d8745410 \ - --hash=sha256:9ceaf423b50ecfc23ca00b7f50b64baba85fb3fb91c53e2c9d00bc86150c7e40 \ - --hash=sha256:a11a96c3b3f7551c8a8109aa65e8594e551d5a84c76bf950da33d0fb6dfafab7 \ - --hash=sha256:a3bcdde35d82ff385f4ede021df801b5c4a5bcdfb61ea87caabcebfc4945dc1b \ - --hash=sha256:a7fb111eef4d05909b82152721a59c1b14d0f365e2be4c742a473c5d7372f4f5 \ - --hash=sha256:a81e1196f0a5b4167a8dafe3a66aa67c4addac1b22dc47947abd5d5c7a3f24b5 \ - --hash=sha256:a8c9b7f16b63e65bbba889acb436a1034a82d34fa09752d754f88d708eca80e1 \ - --hash=sha256:a8ef956fce64c8551221f395ba21d0724fed6b9b6242ca4f2f7beb4ce2f41997 \ - --hash=sha256:ab339536aa798b1e17750733663d272038bf28069761d5be57cb4a9b0137b4f8 \ - --hash=sha256:ac7ba71f9561cd7d7b55e1ea5511543c0282e2b6450f122672a2694621d63b7e \ - --hash=sha256:aea53d51859b6c64e7c51d522c03cc2c48b9b5d6172126854cc7f01aa11f52bc \ - --hash=sha256:aea7c06667b987787c7d1f5e1dfcd70419b711cdb47d6b4bb4ad4b76777a0563 \ - --hash=sha256:aefe1a7cb852fa61150fcb21a8c8fcea7b58c4cb11fbe59c97a0a4b31cae3c8c \ - --hash=sha256:b0989737a3ba6cf2a16efb857fb0dfa20bc5c542737fddb6d893fde48be45433 \ - --hash=sha256:b108134b9667bcd71236c5a02aad5ddd073e372fb5d48ea74853e009fe38acb6 \ - --hash=sha256:b12cb6527599808ada9eb2cd6e0e7d3d8f13fe7bbb01c6311255a15ded4c7ab4 \ - --hash=sha256:b5aff6f3e818e6bdbbb38e5967520f174b18f539c2b9de867b1e7fde6f8d95a4 \ - --hash=sha256:b67319b4aef1a6c56576ff544b67a2a6fbd7eaee485b241cabf53115e8908b8f \ - --hash=sha256:b7c86884ad23d61b025989d99bfdd92a7351de956e01c61307cb87035960bcb1 \ - --hash=sha256:b92b69441d1bd39f4940f9eadfa417a25862242ca2c396b406f9272ef09cdcaa \ - --hash=sha256:bcb7a1096b4b6b24ce1ac24d4942ad98f983cd3810f9711bcd0293f43a9d8b9f \ - --hash=sha256:bda3ea44c39eb74e2488297bb39d47186ed01342f0022c8ff407c250ac3f498e \ - --hash=sha256:be2ba4c3c5b7900246a8f866580700ef0d538f2ca32535e991027bdaba944063 \ - --hash=sha256:c5681160758d3f6ac5b4fea370495c48aac0989d6a0f01bb9a72ad8ef5ab75c4 \ - --hash=sha256:c5d32f5284012deaccd37da1e2cd42f081feaa76981f0eaa474351b68df813c5 \ - --hash=sha256:c6364038c519dffdbe07e3cf42e6a7f8b90c275d4d1617a69bb59734c1a2d571 \ - --hash=sha256:c70e93fba207106cb16bf852e421c37bbded92acd5964390aad07cb50d60f5cf \ - --hash=sha256:ca755eebf0d9e62d6cb013f1261e510317a41bf4650f22963474a663fdfe02aa \ - --hash=sha256:cccd007d5c95279e529c146d095f1d39ac05139de26c098166c4beb9374b0f4d \ - --hash=sha256:ce31158630a6ac85bddd6b830cffd46085ff90498b397bd0a259f59d27a12188 \ - --hash=sha256:ce9c671845de9699904b1e9df95acfe8dfc183f2310f163cdaa91a3535af95de \ - --hash=sha256:d12832e1dbea4be280b22fd0ea7c9b87f0d8fc51ba06e92dc62d52f804f78ebd \ - --hash=sha256:d2ed1b3cb9ff1c10e6e8b00941bb2e5bb568b307bfc6b17dffbbe8be5eecba86 \ - --hash=sha256:d5663bc1b471c79f5c833cffbc9b87d7bf13f87e055a5c86c363ccd2348d7e82 \ - --hash=sha256:d90b729fd2732df28130c064aac9bb8aff14ba20baa4aee7bd0795ff1187545f \ - --hash=sha256:dc0af80267edc68adf85f2a5d9be1cdf062f973db6790c1d065e45025fa26140 \ - --hash=sha256:de5b4e1088523e2b6f730d0509a9a813355b7f5659d70eb4f319c76beea2e250 \ - --hash=sha256:de6f6bb8a7840c7bf216fb83eec4e2f79f7325eca8858167b68708b929ab2172 \ - --hash=sha256:df53330a3bff250f10472ce96a9af28628ff1f4efc51ccba351a8820bca2a8ba \ - --hash=sha256:e094ec83694b59d263802ed03a8384594fcce477ce484b0cbcd0008a211ca751 \ - --hash=sha256:e794f698ae4c5084414efea0f5cc9f4ac562ec02d66e1484ff822ef97c2cadff \ - --hash=sha256:e7bc6df34d42322c5289e37e9971d6ed114e3776b45fa879f734bded9d1fea9c \ - --hash=sha256:eaf24066ad0b30917186420d51e2e3edf4b0e2ea68d8cd885b14dc8afdcf6556 \ - --hash=sha256:ecf4c4b83f1ab3d5a7ace10bafcb6f11df6156857a3c418244cef41ca9fa3e44 \ - --hash=sha256:ef5a7178fcc73b7d8c07229e89f8eb45b2908a9238eb90dcfc46571ccf0383b8 \ - --hash=sha256:f5cb182f6396706dc6cc1896dd02b1c889d644c081b0cdec38747573db88a7d7 \ - --hash=sha256:fa0e294046de09acd6146be0ed6727d1f42ded4ce3ea1e9a19c11b6774eea27c \ - --hash=sha256:fb54f7c6bafaa808f27166569b1511fc42701a7713858dddc08afdde9746849e \ - --hash=sha256:fd3be6481ef54b8cfd0e1e953323b7aa9d9789b94842d0e5b142ef4bb7999539 +lxml==6.0.0 \ + --hash=sha256:013090383863b72c62a702d07678b658fa2567aa58d373d963cca245b017e065 \ + --hash=sha256:032e65120339d44cdc3efc326c9f660f5f7205f3a535c1fdbf898b29ea01fb72 \ + --hash=sha256:048a930eb4572829604982e39a0c7289ab5dc8abc7fc9f5aabd6fbc08c154e93 \ + --hash=sha256:04d67ceee6db4bcb92987ccb16e53bef6b42ced872509f333c04fb58a3315256 \ + --hash=sha256:059c4cbf3973a621b62ea3132934ae737da2c132a788e6cfb9b08d63a0ef73f9 \ + --hash=sha256:0e32698462aacc5c1cf6bdfebc9c781821b7e74c79f13e5ffc8bfe27c42b1abf \ + --hash=sha256:1676b56d48048a62ef77a250428d1f31f610763636e0784ba67a9740823988ca \ + --hash=sha256:17f090a9bc0ce8da51a5632092f98a7e7f84bca26f33d161a98b57f7fb0004ca \ + --hash=sha256:185efc2fed89cdd97552585c624d3c908f0464090f4b91f7d92f8ed2f3b18f54 \ + --hash=sha256:1fa377b827ca2023244a06554c6e7dc6828a10aaf74ca41965c5d8a4925aebb4 \ + --hash=sha256:2181e4b1d07dde53986023482673c0f1fba5178ef800f9ab95ad791e8bdded6a \ + --hash=sha256:219e0431ea8006e15005767f0351e3f7f9143e793e58519dc97fe9e07fae5563 \ + --hash=sha256:21db1ec5525780fd07251636eb5f7acb84003e9382c72c18c542a87c416ade03 \ + --hash=sha256:246b40f8a4aec341cbbf52617cad8ab7c888d944bfe12a6abd2b1f6cfb6f6082 \ + --hash=sha256:2793a627e95d119e9f1e19720730472f5543a6d84c50ea33313ce328d870f2dd \ + --hash=sha256:2930aa001a3776c3e2601cb8e0a15d21b8270528d89cc308be4843ade546b9ab \ + --hash=sha256:2ae06fbab4f1bb7db4f7c8ca9897dc8db4447d1a2b9bee78474ad403437bcc29 \ + --hash=sha256:2b4790b558bee331a933e08883c423f65bbcd07e278f91b2272489e31ab1e2b4 \ + --hash=sha256:2cfcf84f1defed7e5798ef4f88aa25fcc52d279be731ce904789aa7ccfb7e8d2 \ + --hash=sha256:2dd1cc3ea7e60bfb31ff32cafe07e24839df573a5e7c2d33304082a5019bcd58 \ + --hash=sha256:2f34687222b78fff795feeb799a7d44eca2477c3d9d3a46ce17d51a4f383e32e \ + --hash=sha256:310b719b695b3dd442cdfbbe64936b2f2e231bb91d998e99e6f0daf991a3eba3 \ + --hash=sha256:34190a1ec4f1e84af256495436b2d196529c3f2094f0af80202947567fdbf2e7 \ + --hash=sha256:35bc626eec405f745199200ccb5c6b36f202675d204aa29bb52e27ba2b71dea8 \ + --hash=sha256:36531f81c8214e293097cd2b7873f178997dae33d3667caaae8bdfb9666b76c0 \ + --hash=sha256:390240baeb9f415a82eefc2e13285016f9c8b5ad71ec80574ae8fa9605093cd7 \ + --hash=sha256:40442e2a4456e9910875ac12951476d36c0870dcb38a68719f8c4686609897c4 \ + --hash=sha256:4337e4aec93b7c011f7ee2e357b0d30562edd1955620fdd4aeab6aacd90d43c5 \ + --hash=sha256:43cfbb7db02b30ad3926e8fceaef260ba2fb7df787e38fa2df890c1ca7966c3b \ + --hash=sha256:43fe5af2d590bf4691531b1d9a2495d7aab2090547eaacd224a3afec95706d76 \ + --hash=sha256:46b9ed911f36bfeb6338e0b482e7fe7c27d362c52fde29f221fddbc9ee2227e7 \ + --hash=sha256:4d23854ecf381ab1facc8f353dcd9adeddef3652268ee75297c1164c987c11dc \ + --hash=sha256:4eb114a0754fd00075c12648d991ec7a4357f9cb873042cc9a77bf3a7e30c9db \ + --hash=sha256:4ee56288d0df919e4aac43b539dd0e34bb55d6a12a6562038e8d6f3ed07f9e36 \ + --hash=sha256:51a5e4c61a4541bd1cd3ba74766d0c9b6c12d6a1a4964ef60026832aac8e79b3 \ + --hash=sha256:522fe7abb41309e9543b0d9b8b434f2b630c5fdaf6482bee642b34c8c70079c8 \ + --hash=sha256:54c4855eabd9fc29707d30141be99e5cd1102e7d2258d2892314cf4c110726c3 \ + --hash=sha256:5592401cdf3dc682194727c1ddaa8aa0f3ddc57ca64fd03226a430b955eab6f6 \ + --hash=sha256:58ffd35bd5425c3c3b9692d078bf7ab851441434531a7e517c4984d5634cd65b \ + --hash=sha256:5967fe415b1920a3877a4195e9a2b779249630ee49ece22021c690320ff07452 \ + --hash=sha256:5fcd7d3b1d8ecb91445bd71b9c88bdbeae528fefee4f379895becfc72298d181 \ + --hash=sha256:63b634facdfbad421d4b61c90735688465d4ab3a8853ac22c76ccac2baf98d97 \ + --hash=sha256:690b20e3388a7ec98e899fd54c924e50ba6693874aa65ef9cb53de7f7de9d64a \ + --hash=sha256:6da7cd4f405fd7db56e51e96bff0865b9853ae70df0e6720624049da76bde2da \ + --hash=sha256:7488a43033c958637b1a08cddc9188eb06d3ad36582cebc7d4815980b47e27ef \ + --hash=sha256:74e748012f8c19b47f7d6321ac929a9a94ee92ef12bc4298c47e8b7219b26541 \ + --hash=sha256:78718d8454a6e928470d511bf8ac93f469283a45c354995f7d19e77292f26108 \ + --hash=sha256:7bf61bc4345c1895221357af8f3e89f8c103d93156ef326532d35c707e2fb19d \ + --hash=sha256:7da298e1659e45d151b4028ad5c7974917e108afb48731f4ed785d02b6818994 \ + --hash=sha256:84ef591495ffd3f9dcabffd6391db7bb70d7230b5c35ef5148354a134f56f2be \ + --hash=sha256:85b14a4689d5cff426c12eefe750738648706ea2753b20c2f973b2a000d3d261 \ + --hash=sha256:8a2e76efbf8772add72d002d67a4c3d0958638696f541734304c7f28217a9cab \ + --hash=sha256:8cb26f51c82d77483cdcd2b4a53cda55bbee29b3c2f3ddeb47182a2a9064e4eb \ + --hash=sha256:8db5dc617cb937ae17ff3403c3a70a7de9df4852a046f93e71edaec678f721d0 \ + --hash=sha256:9ab542c91f5a47aaa58abdd8ea84b498e8e49fe4b883d67800017757a3eb78e8 \ + --hash=sha256:9da022c14baeec36edfcc8daf0e281e2f55b950249a455776f0d1adeeada4734 \ + --hash=sha256:9f4b481b6cc3a897adb4279216695150bbe7a44c03daba3c894f49d2037e0a24 \ + --hash=sha256:a52a4704811e2623b0324a18d41ad4b9fabf43ce5ff99b14e40a520e2190c851 \ + --hash=sha256:a55da151d0b0c6ab176b4e761670ac0e2667817a1e0dadd04a01d0561a219349 \ + --hash=sha256:a674c0948789e9136d69065cc28009c1b1874c6ea340253db58be7622ce6398f \ + --hash=sha256:ae74f7c762270196d2dda56f8dd7309411f08a4084ff2dfcc0b095a218df2e06 \ + --hash=sha256:afd27d8629ae94c5d863e32ab0e1d5590371d296b87dae0a751fb22bf3685741 \ + --hash=sha256:b2d71cdefda9424adff9a3607ba5bbfc60ee972d73c21c7e3c19e71037574816 \ + --hash=sha256:b34339898bb556a2351a1830f88f751679f343eabf9cf05841c95b165152c9e7 \ + --hash=sha256:b372d10d17a701b0945f67be58fae4664fd056b85e0ff0fbc1e6c951cdbc0512 \ + --hash=sha256:b3c98d5b24c6095e89e03d65d5c574705be3d49c0d8ca10c17a8a4b5201b72f5 \ + --hash=sha256:b8dd6dd0e9c1992613ccda2bcb74fc9d49159dbe0f0ca4753f37527749885c25 \ + --hash=sha256:bd5913b4972681ffc9718bc2d4c53cde39ef81415e1671ff93e9aa30b46595e7 \ + --hash=sha256:c0b5fa5eda84057a4f1bbb4bb77a8c28ff20ae7ce211588d698ae453e13c6281 \ + --hash=sha256:c16304bba98f48a28ae10e32a8e75c349dd742c45156f297e16eeb1ba9287a1f \ + --hash=sha256:c24b8efd9c0f62bad0439283c2c795ef916c5a6b75f03c17799775c7ae3c0c9e \ + --hash=sha256:c2a5e8d207311a0170aca0eb6b160af91adc29ec121832e4ac151a57743a1e1e \ + --hash=sha256:c352fc8f36f7e9727db17adbf93f82499457b3d7e5511368569b4c5bd155a922 \ + --hash=sha256:c86df1c9af35d903d2b52d22ea3e66db8058d21dc0f59842ca5deb0595921141 \ + --hash=sha256:ca50bd612438258a91b5b3788c6621c1f05c8c478e7951899f492be42defc0da \ + --hash=sha256:d18a25b19ca7307045581b18b3ec9ead2b1db5ccd8719c291f0cd0a5cec6cb81 \ + --hash=sha256:d4f0c66df4386b75d2ab1e20a489f30dc7fd9a06a896d64980541506086be1f1 \ + --hash=sha256:d7ae472f74afcc47320238b5dbfd363aba111a525943c8a34a1b657c6be934c3 \ + --hash=sha256:db0efd6bae1c4730b9c863fc4f5f3c0fa3e8f05cae2c44ae141cb9dfc7d091dc \ + --hash=sha256:dbdd7679a6f4f08152818043dbb39491d1af3332128b3752c3ec5cebc0011a72 \ + --hash=sha256:e0b1520ef900e9ef62e392dd3d7ae4f5fa224d1dd62897a792cf353eb20b6cae \ + --hash=sha256:e2030956cf4886b10be9a0285c6802e078ec2391e1dd7ff3eb509c2c95a69b76 \ + --hash=sha256:e35e8aaaf3981489f42884b59726693de32dabfc438ac10ef4eb3409961fd402 \ + --hash=sha256:e380e85b93f148ad28ac15f8117e2fd8e5437aa7732d65e260134f83ce67911b \ + --hash=sha256:edf6e4c8fe14dfe316939711e3ece3f9a20760aabf686051b537a7562f4da91a \ + --hash=sha256:f3389924581d9a770c6caa4df4e74b606180869043b9073e2cec324bad6e306e \ + --hash=sha256:f64ccf593916e93b8d36ed55401bb7fe9c7d5de3180ce2e10b08f82a8f397316 \ + --hash=sha256:f720a14aa102a38907c6d5030e3d66b3b680c3e6f6bc95473931ea3c00c59967 \ + --hash=sha256:f8d19565ae3eb956d84da3ef367aa7def14a2735d05bd275cd54c0301f0d0d6c \ + --hash=sha256:f97487996a39cb18278ca33f7be98198f278d0bc3c5d0fd4d7b3d63646ca3c8a # via # -r requirements-actions.in # gcovr @@ -833,8 +797,9 @@ polib==1.2.0 \ --hash=sha256:1c77ee1b81feb31df9bca258cbc58db1bbb32d10214b173882452c73af06d62d \ --hash=sha256:f3ef94aefed6e183e342a8a269ae1fc4742ba193186ad76f175938621dbfc26b # via sphinx-lint -progress==1.6 \ - --hash=sha256:c9c86e98b5c03fa1fe11e3b67c1feda4788b8d0fe7336c2ff7d5644ccfba34cd +progress==1.6.1 \ + --hash=sha256:5239f22f305c12fdc8ce6e0e47f70f21622a935e16eafc4535617112e7c7ea0b \ + --hash=sha256:c1ba719f862ce885232a759eab47971fe74dfc7bb76ab8a51ef5940bad35086c # via -r requirements-actions.in psutil==7.0.0 \ --hash=sha256:101d71dc322e3cffd7cea0650b09b3d08b8e7c4109dd6809fe452dfd00e58b25 \ @@ -864,9 +829,9 @@ pygithub==2.6.1 \ --hash=sha256:6f2fa6d076ccae475f9fc392cc6cdbd54db985d4f69b8833a28397de75ed6ca3 \ --hash=sha256:b5c035392991cca63959e9453286b41b54d83bf2de2daa7d7ff7e4312cebf3bf # via -r requirements-actions.in -pygments==2.19.1 \ - --hash=sha256:61c16d2a8576dc0649d9f39e089b5f02bcd27fba10d8fb4dcc28173f7a45151f \ - --hash=sha256:9ea1544ad55cecf4b8242fab6dd35a93bbce657034b0611ee383099054ab6d8c +pygments==2.19.2 \ + --hash=sha256:636cb2477cec7f8952536970bc533bc43743542f70392ae026374600add5b887 \ + --hash=sha256:86540386c03d588bb81d44bc3928634ff26449851e99741617ecb9037ee5ec0b # via # gcovr # pytest @@ -1249,7 +1214,13 @@ tomli==2.2.1 \ --hash=sha256:e85e99945e688e32d5a35c1ff38ed0b3f41f43fad8df0bdf79f72b2ba7bc5272 \ --hash=sha256:ece47d672db52ac607a3d9599a9d48dcb2f2f735c6c2d1f34130085bb12b112a \ --hash=sha256:f4039b9cbc3048b2416cc57ab3bda989a6fcf9b36cf8937f01a6e731b64f80d7 - # via -r requirements-actions.in + # via + # -r requirements-actions.in + # mypy + # pylint + # pyproject-api + # pytest + # tox tomlkit==0.13.3 \ --hash=sha256:430cf247ee57df2b94ee3fbe588e71d362a941ebb545dec29b53961d61add2a1 \ --hash=sha256:c89c649d79ee40629a9fda55f8ace8c6a1b42deb912b2a8fd8d942ddadb606b0 @@ -1264,11 +1235,13 @@ typing-extensions==4.14.0 \ --hash=sha256:8676b788e32f02ab42d9e7c61324048ae4c6d844a399eebace3d4979d75ceef4 \ --hash=sha256:a1514509136dd0b477638fc68d6a91497af5076466ad0fa6c338e44e359944af # via + # astroid # elasticsearch # exceptiongroup # mypy # pygithub # python-can + # tox unidiff==0.7.5 \ --hash=sha256:2e5f0162052248946b9f0970a40e9e124236bf86c82b70821143a6fc1dea2574 \ --hash=sha256:c93bf2265cc1ba2a520e415ab05da587370bc2a3ae9e0414329f54f0c2fc09e8 From 68ea99f2febae85ad8639d023d9d223c7d317a04 Mon Sep 17 00:00:00 2001 From: Mirko Covizzi Date: Tue, 1 Jul 2025 16:44:18 +0200 Subject: [PATCH 0788/2141] [nrf fromtree] scripts: requirements-base: pin patool to >=2.0.0 This resolves an issue on MacOS where `west sdk install` would fail when extracting a `.tar.xz` package due to the command line options selected by patool. Signed-off-by: Mirko Covizzi (cherry picked from commit 5b3a48c06327cfce0fd3bc69fbcf00963479cb6b) --- scripts/requirements-base.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/requirements-base.txt b/scripts/requirements-base.txt index 2b35d3df097c..efa58d8c19d7 100644 --- a/scripts/requirements-base.txt +++ b/scripts/requirements-base.txt @@ -17,7 +17,7 @@ pykwalify canopen packaging progress -patool +patool>=2.0.0 psutil>=5.6.6 pylink-square pyserial From 3c345c44e824012c8b9a524b5c214987a674ba0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Wed, 2 Jul 2025 12:47:52 +0200 Subject: [PATCH 0789/2141] [nrf fromtree] scripts: west_commands: canopen: replace progress by tqdm MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit progress has been unmaintained for years and tqdm is a more modern and faster alternative, which is already used by other commands. Replace progress by tqdm in the canopen_program.py script. Signed-off-by: Benjamin Cabé (cherry picked from commit 0ed775bfc94ddfa8db496f3f2e4e92312b42941c) --- scripts/requirements-actions.in | 2 +- scripts/requirements-actions.txt | 9 +++++---- scripts/requirements-base.txt | 1 - scripts/west_commands/runners/canopen_program.py | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/scripts/requirements-actions.in b/scripts/requirements-actions.in index 4bdb9b0fbdad..9d56d56f2a3a 100644 --- a/scripts/requirements-actions.in +++ b/scripts/requirements-actions.in @@ -17,7 +17,6 @@ mock mypy natsort ply>=3.10 -progress psutil>=5.6.6 pyelftools>=0.29 pygithub @@ -36,6 +35,7 @@ sphinx-lint tabulate tomli>=1.1.0 tox +tqdm>=4.67.1 unidiff vermin west>=0.14.0 diff --git a/scripts/requirements-actions.txt b/scripts/requirements-actions.txt index 7588db2575f9..7e9250109180 100644 --- a/scripts/requirements-actions.txt +++ b/scripts/requirements-actions.txt @@ -261,6 +261,7 @@ colorama==0.4.6 \ # pylint # pytest # tox + # tqdm # west cryptography==45.0.5 \ --hash=sha256:0027d566d65a38497bc37e0dd7c2f8ceda73597d2ac9ba93810204f56f52ebc7 \ @@ -797,10 +798,6 @@ polib==1.2.0 \ --hash=sha256:1c77ee1b81feb31df9bca258cbc58db1bbb32d10214b173882452c73af06d62d \ --hash=sha256:f3ef94aefed6e183e342a8a269ae1fc4742ba193186ad76f175938621dbfc26b # via sphinx-lint -progress==1.6.1 \ - --hash=sha256:5239f22f305c12fdc8ce6e0e47f70f21622a935e16eafc4535617112e7c7ea0b \ - --hash=sha256:c1ba719f862ce885232a759eab47971fe74dfc7bb76ab8a51ef5940bad35086c - # via -r requirements-actions.in psutil==7.0.0 \ --hash=sha256:101d71dc322e3cffd7cea0650b09b3d08b8e7c4109dd6809fe452dfd00e58b25 \ --hash=sha256:1e744154a6580bc968a0195fd25e80432d3afec619daf145b9e5ba16cc1d688e \ @@ -1231,6 +1228,10 @@ tox==4.27.0 \ --hash=sha256:2b8a7fb986b82aa2c830c0615082a490d134e0626dbc9189986da46a313c4f20 \ --hash=sha256:b97d5ecc0c0d5755bcc5348387fef793e1bfa68eb33746412f4c60881d7f5f57 # via -r requirements-actions.in +tqdm==4.67.1 \ + --hash=sha256:26445eca388f82e72884e0d580d5464cd801a3ea01e63e5601bdff9ba6a48de2 \ + --hash=sha256:f8aef9c52c08c13a65f30ea34f4e5aac3fd1a34959879d7e59e63027286627f2 + # via -r requirements-actions.in typing-extensions==4.14.0 \ --hash=sha256:8676b788e32f02ab42d9e7c61324048ae4c6d844a399eebace3d4979d75ceef4 \ --hash=sha256:a1514509136dd0b477638fc68d6a91497af5076466ad0fa6c338e44e359944af diff --git a/scripts/requirements-base.txt b/scripts/requirements-base.txt index efa58d8c19d7..52732068f399 100644 --- a/scripts/requirements-base.txt +++ b/scripts/requirements-base.txt @@ -16,7 +16,6 @@ pykwalify # used by west_commands canopen packaging -progress patool>=2.0.0 psutil>=5.6.6 pylink-square diff --git a/scripts/west_commands/runners/canopen_program.py b/scripts/west_commands/runners/canopen_program.py index 081a2652bfc5..e72b1dbbd665 100644 --- a/scripts/west_commands/runners/canopen_program.py +++ b/scripts/west_commands/runners/canopen_program.py @@ -12,7 +12,7 @@ try: import canopen - from progress.bar import Bar + from tqdm import tqdm MISSING_REQUIREMENTS = False except ImportError: MISSING_REQUIREMENTS = True @@ -284,17 +284,17 @@ def download(self, bin_file): outfile = self.data_sdo.open('wb', buffering=self.download_buffer_size, size=size, block_transfer=self.block_transfer) - progress = Bar('%(percent)d%%', max=size, suffix='%(index)d/%(max)dB') + progress = tqdm(total=size, unit='B', unit_scale=True) while True: chunk = infile.read(self.download_buffer_size // 2) if not chunk: break outfile.write(chunk) - progress.next(n=len(chunk)) + progress.update(len(chunk)) except Exception as err: raise ValueError('Failed to download program') from err finally: - progress.finish() + progress.close() infile.close() outfile.close() From e683d5798f4796909e8f573cabffae5a69cd16b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Wed, 2 Jul 2025 14:00:33 +0200 Subject: [PATCH 0790/2141] [nrf fromtree] scripts: tests: apply ruff linting to test_domains.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Somehow this file had no exclude rules in .ruff-excludes.toml. Make it compliant going forward. Signed-off-by: Benjamin Cabé (cherry picked from commit f39ec7980603ab8c335b555167cff80dc9019f74) --- scripts/tests/build_helpers/test_domains.py | 96 ++++++++++++--------- 1 file changed, 55 insertions(+), 41 deletions(-) diff --git a/scripts/tests/build_helpers/test_domains.py b/scripts/tests/build_helpers/test_domains.py index 0ebdeaf6cb2d..b22fff449166 100644 --- a/scripts/tests/build_helpers/test_domains.py +++ b/scripts/tests/build_helpers/test_domains.py @@ -8,45 +8,49 @@ import mock import os -import pytest import sys +from contextlib import nullcontext + +import pytest ZEPHYR_BASE = os.getenv("ZEPHYR_BASE") sys.path.insert(0, os.path.join(ZEPHYR_BASE, "scripts/pylib/build_helpers")) -import domains - -from contextlib import nullcontext - +import domains # noqa: E402 TESTDATA_1 = [ ('', False, 1, ['domains.yaml file not found: domains.yaml']), ( -""" + """ default: None build_dir: some/dir domains: [] """, - True, None, [] + True, + None, + [], ), ] + @pytest.mark.parametrize( 'f_contents, f_exists, exit_code, expected_logs', TESTDATA_1, - ids=['no file', 'valid'] + ids=['no file', 'valid'], ) def test_from_file(caplog, f_contents, f_exists, exit_code, expected_logs): def mock_open(*args, **kwargs): if f_exists: return mock.mock_open(read_data=f_contents)(args, kwargs) - raise FileNotFoundError(f'domains.yaml not found.') + raise FileNotFoundError('domains.yaml not found.') init_mock = mock.Mock(return_value=None) - with mock.patch('domains.Domains.__init__', init_mock), \ - mock.patch('builtins.open', mock_open), \ - pytest.raises(SystemExit) if exit_code else nullcontext() as s_exit: + with ( + mock.patch('domains.Domains.__init__', init_mock), + mock.patch('builtins.open', mock_open), + pytest.raises(SystemExit) if exit_code else nullcontext() as s_exit, + ): result = domains.Domains.from_file('domains.yaml') if exit_code: @@ -60,7 +64,7 @@ def mock_open(*args, **kwargs): TESTDATA_2 = [ ( -""" + """ default: some default build_dir: my/dir domains: @@ -70,10 +74,14 @@ def mock_open(*args, **kwargs): build_dir: dir/3 flash_order: I don\'t think this is correct """, - 1, None, None, None, None + 1, + None, + None, + None, + None, ), ( -""" + """ build_dir: build/dir domains: - name: a domain @@ -89,16 +97,15 @@ def mock_open(*args, **kwargs): 'build/dir', [('default_domain', 'dir/2'), ('a domain', 'dir/1')], ('default_domain', 'dir/2'), - {'a domain': ('a domain', 'dir/1'), - 'default_domain': ('default_domain', 'dir/2')} + {'a domain': ('a domain', 'dir/1'), 'default_domain': ('default_domain', 'dir/2')}, ), ] + @pytest.mark.parametrize( - 'data, exit_code, expected_build_dir, expected_flash_order,' \ - ' expected_default, expected_domains', + 'data, exit_code, expected_build_dir, expected_flash_order, expected_default, expected_domains', TESTDATA_2, - ids=['invalid', 'valid'] + ids=['invalid', 'valid'], ) def test_from_yaml( caplog, @@ -107,13 +114,15 @@ def test_from_yaml( expected_build_dir, expected_flash_order, expected_default, - expected_domains + expected_domains, ): def mock_domain(name, build_dir, *args, **kwargs): return name, build_dir - with mock.patch('domains.Domain', side_effect=mock_domain), \ - pytest.raises(SystemExit) if exit_code else nullcontext() as exit_st: + with ( + mock.patch('domains.Domain', side_effect=mock_domain), + pytest.raises(SystemExit) if exit_code else nullcontext() as exit_st, + ): doms = domains.Domains.from_yaml(data) if exit_code: @@ -133,35 +142,40 @@ def mock_domain(name, build_dir, *args, **kwargs): ( None, True, - [('some', os.path.join('dir', '2')), - ('order', os.path.join('dir', '1'))] + [ + ('some', os.path.join('dir', '2')), + ('order', os.path.join('dir', '1')), + ], ), ( None, False, - [('order', os.path.join('dir', '1')), - ('some', os.path.join('dir', '2'))] + [ + ('order', os.path.join('dir', '1')), + ('some', os.path.join('dir', '2')), + ], ), ( ['some'], False, - [('some', os.path.join('dir', '2'))] + [('some', os.path.join('dir', '2'))], ), ] + @pytest.mark.parametrize( 'names, default_flash_order, expected_result', TESTDATA_3, - ids=['order only', 'no parameters', 'valid'] + ids=['order only', 'no parameters', 'valid'], ) def test_get_domains( caplog, names, default_flash_order, - expected_result + expected_result, ): doms = domains.Domains( -""" + """ domains: - name: dummy build_dir: dummy @@ -171,11 +185,11 @@ def test_get_domains( ) doms._flash_order = [ ('some', os.path.join('dir', '2')), - ('order', os.path.join('dir', '1')) + ('order', os.path.join('dir', '1')), ] doms._domains = { 'order': ('order', os.path.join('dir', '1')), - 'some': ('some', os.path.join('dir', '2')) + 'some': ('some', os.path.join('dir', '2')), } result = doms.get_domains(names, default_flash_order) @@ -183,36 +197,36 @@ def test_get_domains( assert result == expected_result - TESTDATA_3 = [ ( 'other', 1, ['domain "other" not found, valid domains are: order, some'], - None + None, ), ( 'some', None, [], - ('some', os.path.join('dir', '2')) + ('some', os.path.join('dir', '2')), ), ] + @pytest.mark.parametrize( 'name, exit_code, expected_logs, expected_result', TESTDATA_3, - ids=['domain not found', 'valid'] + ids=['domain not found', 'valid'], ) def test_get_domain( caplog, name, exit_code, expected_logs, - expected_result + expected_result, ): doms = domains.Domains( -""" + """ domains: - name: dummy build_dir: dummy @@ -222,11 +236,11 @@ def test_get_domain( ) doms._flash_order = [ ('some', os.path.join('dir', '2')), - ('order', os.path.join('dir', '1')) + ('order', os.path.join('dir', '1')), ] doms._domains = { 'order': ('order', os.path.join('dir', '1')), - 'some': ('some', os.path.join('dir', '2')) + 'some': ('some', os.path.join('dir', '2')), } with pytest.raises(SystemExit) if exit_code else nullcontext() as s_exit: From 9648cfc0fa26d064bb650573c9ea752b077cb5b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Wed, 2 Jul 2025 13:54:36 +0200 Subject: [PATCH 0791/2141] [nrf fromtree] scripts: requirements: remove dependency to mock package MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit mock has been available in Python standard lib since Python 3.3, remove the unnecessary dependency to `mock` pip package. Signed-off-by: Benjamin Cabé (cherry picked from commit edead766dc4d267fd5756dfdf40e6fff2d302bbd) --- scripts/build/check_init_priorities_test.py | 2 +- scripts/requirements-actions.txt | 4 ---- scripts/requirements-build-test.txt | 3 --- scripts/tests/build_helpers/test_domains.py | 2 +- scripts/tests/twister/test_cmakecache.py | 2 +- scripts/tests/twister/test_config_parser.py | 2 +- scripts/tests/twister/test_environment.py | 2 +- scripts/tests/twister/test_handlers.py | 2 +- scripts/tests/twister/test_hardwaremap.py | 2 +- scripts/tests/twister/test_harness.py | 2 +- scripts/tests/twister/test_jobserver.py | 2 +- scripts/tests/twister/test_log_helper.py | 2 +- scripts/tests/twister/test_platform.py | 2 +- scripts/tests/twister/test_quarantine.py | 2 +- scripts/tests/twister/test_runner.py | 2 +- scripts/tests/twister/test_scl.py | 2 +- scripts/tests/twister/test_testinstance.py | 2 +- scripts/tests/twister/test_testplan.py | 2 +- scripts/tests/twister/test_testsuite.py | 2 +- scripts/tests/twister/test_twister.py | 2 +- scripts/tests/twister_blackbox/conftest.py | 2 +- scripts/tests/twister_blackbox/test_addon.py | 3 ++- scripts/tests/twister_blackbox/test_config.py | 2 +- scripts/tests/twister_blackbox/test_coverage.py | 2 +- scripts/tests/twister_blackbox/test_device.py | 2 +- scripts/tests/twister_blackbox/test_disable.py | 3 ++- scripts/tests/twister_blackbox/test_error.py | 2 +- scripts/tests/twister_blackbox/test_filter.py | 2 +- scripts/tests/twister_blackbox/test_footprint.py | 2 +- scripts/tests/twister_blackbox/test_hardwaremap.py | 3 ++- scripts/tests/twister_blackbox/test_outfile.py | 2 +- scripts/tests/twister_blackbox/test_output.py | 2 +- scripts/tests/twister_blackbox/test_platform.py | 2 +- scripts/tests/twister_blackbox/test_printouts.py | 2 +- scripts/tests/twister_blackbox/test_quarantine.py | 2 +- scripts/tests/twister_blackbox/test_report.py | 2 +- scripts/tests/twister_blackbox/test_runner.py | 2 +- scripts/tests/twister_blackbox/test_shuffle.py | 2 +- scripts/tests/twister_blackbox/test_testlist.py | 2 +- scripts/tests/twister_blackbox/test_testplan.py | 2 +- scripts/tests/twister_blackbox/test_tooling.py | 3 ++- 41 files changed, 43 insertions(+), 46 deletions(-) diff --git a/scripts/build/check_init_priorities_test.py b/scripts/build/check_init_priorities_test.py index 16cf9af74065..7ada23498396 100755 --- a/scripts/build/check_init_priorities_test.py +++ b/scripts/build/check_init_priorities_test.py @@ -6,7 +6,7 @@ Tests for check_init_priorities """ -import mock +from unittest import mock import pathlib import unittest diff --git a/scripts/requirements-actions.txt b/scripts/requirements-actions.txt index 7e9250109180..1af5b8267d5c 100644 --- a/scripts/requirements-actions.txt +++ b/scripts/requirements-actions.txt @@ -653,10 +653,6 @@ mccabe==0.7.0 \ --hash=sha256:348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325 \ --hash=sha256:6c2d30ab6be0e4a46919781807b4f0d834ebdd6c6e3dca0bda5a15f863427b6e # via pylint -mock==5.2.0 \ - --hash=sha256:4e460e818629b4b173f32d08bf30d3af8123afbb8e04bb5707a1fd4799e503f0 \ - --hash=sha256:7ba87f72ca0e915175596069dbbcc7c75af7b5e9b9bc107ad6349ede0819982f - # via -r requirements-actions.in msgpack==1.1.1 ; sys_platform != 'win32' \ --hash=sha256:196a736f0526a03653d829d7d4c5500a97eea3648aebfd4b6743875f28aa2af8 \ --hash=sha256:1abfc6e949b352dadf4bce0eb78023212ec5ac42f6abfd469ce91d783c149c2a \ diff --git a/scripts/requirements-build-test.txt b/scripts/requirements-build-test.txt index 0d540dd05c3e..76cee431f887 100644 --- a/scripts/requirements-build-test.txt +++ b/scripts/requirements-build-test.txt @@ -17,8 +17,5 @@ coverage pytest mypy -# used for mocking functions in pytest -mock>=4.0.1 - # used for JUnit XML parsing in CTest harness junitparser diff --git a/scripts/tests/build_helpers/test_domains.py b/scripts/tests/build_helpers/test_domains.py index b22fff449166..de784734bacf 100644 --- a/scripts/tests/build_helpers/test_domains.py +++ b/scripts/tests/build_helpers/test_domains.py @@ -6,10 +6,10 @@ Tests for domains.py classes """ -import mock import os import sys from contextlib import nullcontext +from unittest import mock import pytest diff --git a/scripts/tests/twister/test_cmakecache.py b/scripts/tests/twister/test_cmakecache.py index ebfb440423b2..51a09a581021 100644 --- a/scripts/tests/twister/test_cmakecache.py +++ b/scripts/tests/twister/test_cmakecache.py @@ -6,7 +6,7 @@ Tests for cmakecache.py classes' methods """ -import mock +from unittest import mock import pytest from contextlib import nullcontext diff --git a/scripts/tests/twister/test_config_parser.py b/scripts/tests/twister/test_config_parser.py index 48a2d5a7db52..dcc1495ab7cd 100644 --- a/scripts/tests/twister/test_config_parser.py +++ b/scripts/tests/twister/test_config_parser.py @@ -9,7 +9,7 @@ import os import pytest -import mock +from unittest import mock import scl from twisterlib.config_parser import TwisterConfigParser, extract_fields_from_arg_list, ConfigurationError diff --git a/scripts/tests/twister/test_environment.py b/scripts/tests/twister/test_environment.py index 3a4e090598b0..95b799bc8b7c 100644 --- a/scripts/tests/twister/test_environment.py +++ b/scripts/tests/twister/test_environment.py @@ -7,7 +7,7 @@ Tests for environment.py classes' methods """ -import mock +from unittest import mock import os import pytest import shutil diff --git a/scripts/tests/twister/test_handlers.py b/scripts/tests/twister/test_handlers.py index e4710060a35e..fbe22bb906f9 100644 --- a/scripts/tests/twister/test_handlers.py +++ b/scripts/tests/twister/test_handlers.py @@ -8,7 +8,7 @@ """ import itertools -import mock +from unittest import mock import os import pytest import signal diff --git a/scripts/tests/twister/test_hardwaremap.py b/scripts/tests/twister/test_hardwaremap.py index 5dc61dc1d9ec..c8f826792115 100644 --- a/scripts/tests/twister/test_hardwaremap.py +++ b/scripts/tests/twister/test_hardwaremap.py @@ -6,7 +6,7 @@ Tests for hardwaremap.py classes' methods """ -import mock +from unittest import mock import pytest import sys diff --git a/scripts/tests/twister/test_harness.py b/scripts/tests/twister/test_harness.py index 3283ff2085ab..edc2a96c8a13 100644 --- a/scripts/tests/twister/test_harness.py +++ b/scripts/tests/twister/test_harness.py @@ -6,7 +6,7 @@ """ This test file contains testsuites for the Harness classes of twister """ -import mock +from unittest import mock import sys import os import pytest diff --git a/scripts/tests/twister/test_jobserver.py b/scripts/tests/twister/test_jobserver.py index 554df8545fb2..d365313199d1 100644 --- a/scripts/tests/twister/test_jobserver.py +++ b/scripts/tests/twister/test_jobserver.py @@ -7,7 +7,7 @@ """ import functools -import mock +from unittest import mock import os import pytest import sys diff --git a/scripts/tests/twister/test_log_helper.py b/scripts/tests/twister/test_log_helper.py index 9373be5da2f8..31d7c6148da7 100644 --- a/scripts/tests/twister/test_log_helper.py +++ b/scripts/tests/twister/test_log_helper.py @@ -7,7 +7,7 @@ """ import logging -import mock +from unittest import mock import pytest from importlib import reload diff --git a/scripts/tests/twister/test_platform.py b/scripts/tests/twister/test_platform.py index cdbfd15d20c5..1ff7f0bb8fd1 100644 --- a/scripts/tests/twister/test_platform.py +++ b/scripts/tests/twister/test_platform.py @@ -8,7 +8,7 @@ ''' import sys import os -import mock +from unittest import mock import pytest from contextlib import nullcontext diff --git a/scripts/tests/twister/test_quarantine.py b/scripts/tests/twister/test_quarantine.py index ea6b3cf677eb..6165a755544a 100644 --- a/scripts/tests/twister/test_quarantine.py +++ b/scripts/tests/twister/test_quarantine.py @@ -6,7 +6,7 @@ Tests for quarantine.py classes' methods """ -import mock +from unittest import mock import os import pytest import textwrap diff --git a/scripts/tests/twister/test_runner.py b/scripts/tests/twister/test_runner.py index e689095fc7c1..3d2149664cfd 100644 --- a/scripts/tests/twister/test_runner.py +++ b/scripts/tests/twister/test_runner.py @@ -7,7 +7,7 @@ """ import errno -import mock +from unittest import mock import os import pathlib import pytest diff --git a/scripts/tests/twister/test_scl.py b/scripts/tests/twister/test_scl.py index 14a0c447192d..4a376257b1d8 100644 --- a/scripts/tests/twister/test_scl.py +++ b/scripts/tests/twister/test_scl.py @@ -7,7 +7,7 @@ """ import logging -import mock +from unittest import mock import os import pytest import sys diff --git a/scripts/tests/twister/test_testinstance.py b/scripts/tests/twister/test_testinstance.py index 271d55e76a01..df8286fe092b 100644 --- a/scripts/tests/twister/test_testinstance.py +++ b/scripts/tests/twister/test_testinstance.py @@ -11,7 +11,7 @@ import os import sys import pytest -import mock +from unittest import mock ZEPHYR_BASE = os.getenv("ZEPHYR_BASE") sys.path.insert(0, os.path.join(ZEPHYR_BASE, "scripts/pylib/twister")) diff --git a/scripts/tests/twister/test_testplan.py b/scripts/tests/twister/test_testplan.py index 73b2673b08ef..62733ed00dd5 100644 --- a/scripts/tests/twister/test_testplan.py +++ b/scripts/tests/twister/test_testplan.py @@ -8,7 +8,7 @@ ''' import sys import os -import mock +from unittest import mock import pytest from contextlib import nullcontext diff --git a/scripts/tests/twister/test_testsuite.py b/scripts/tests/twister/test_testsuite.py index 83231c0f48ad..635b2aaa99fa 100644 --- a/scripts/tests/twister/test_testsuite.py +++ b/scripts/tests/twister/test_testsuite.py @@ -7,7 +7,7 @@ """ import mmap -import mock +from unittest import mock import os import pytest import sys diff --git a/scripts/tests/twister/test_twister.py b/scripts/tests/twister/test_twister.py index 23a3e6d17db2..0e5118751dd2 100644 --- a/scripts/tests/twister/test_twister.py +++ b/scripts/tests/twister/test_twister.py @@ -9,7 +9,7 @@ import os import sys -import mock +from unittest import mock import pytest from pathlib import Path diff --git a/scripts/tests/twister_blackbox/conftest.py b/scripts/tests/twister_blackbox/conftest.py index 0fd73927c6fc..615e2f986b77 100644 --- a/scripts/tests/twister_blackbox/conftest.py +++ b/scripts/tests/twister_blackbox/conftest.py @@ -7,7 +7,7 @@ import logging import shutil -import mock +from unittest import mock import os import pytest import sys diff --git a/scripts/tests/twister_blackbox/test_addon.py b/scripts/tests/twister_blackbox/test_addon.py index ecd34501b73c..bb7fe84b6b88 100644 --- a/scripts/tests/twister_blackbox/test_addon.py +++ b/scripts/tests/twister_blackbox/test_addon.py @@ -7,7 +7,7 @@ """ import importlib -import mock +from unittest import mock import os import pkg_resources import pytest @@ -16,6 +16,7 @@ import subprocess import sys +# pylint: disable=no-name-in-module from conftest import ZEPHYR_BASE, TEST_DATA, sample_filename_mock, testsuite_filename_mock from twisterlib.testplan import TestPlan diff --git a/scripts/tests/twister_blackbox/test_config.py b/scripts/tests/twister_blackbox/test_config.py index 2cad497055f5..1b34e637ff47 100644 --- a/scripts/tests/twister_blackbox/test_config.py +++ b/scripts/tests/twister_blackbox/test_config.py @@ -7,7 +7,7 @@ """ import importlib -import mock +from unittest import mock import os import pytest import sys diff --git a/scripts/tests/twister_blackbox/test_coverage.py b/scripts/tests/twister_blackbox/test_coverage.py index aeb41e63daf3..c1f85c05057b 100644 --- a/scripts/tests/twister_blackbox/test_coverage.py +++ b/scripts/tests/twister_blackbox/test_coverage.py @@ -7,7 +7,7 @@ """ import importlib import re -import mock +from unittest import mock import os import pytest import sys diff --git a/scripts/tests/twister_blackbox/test_device.py b/scripts/tests/twister_blackbox/test_device.py index 790e0774e300..c35daa337e49 100644 --- a/scripts/tests/twister_blackbox/test_device.py +++ b/scripts/tests/twister_blackbox/test_device.py @@ -7,7 +7,7 @@ """ import importlib -import mock +from unittest import mock import os import pytest import sys diff --git a/scripts/tests/twister_blackbox/test_disable.py b/scripts/tests/twister_blackbox/test_disable.py index 26e804af9d43..3cbc7d314289 100644 --- a/scripts/tests/twister_blackbox/test_disable.py +++ b/scripts/tests/twister_blackbox/test_disable.py @@ -8,11 +8,12 @@ import importlib import pytest -import mock +from unittest import mock import os import sys import re +# pylint: disable=no-name-in-module from conftest import ZEPHYR_BASE, TEST_DATA, testsuite_filename_mock from twisterlib.testplan import TestPlan diff --git a/scripts/tests/twister_blackbox/test_error.py b/scripts/tests/twister_blackbox/test_error.py index 4a28f7fb178c..93d589fefdfc 100644 --- a/scripts/tests/twister_blackbox/test_error.py +++ b/scripts/tests/twister_blackbox/test_error.py @@ -7,7 +7,7 @@ """ import importlib -import mock +from unittest import mock import os import pytest import sys diff --git a/scripts/tests/twister_blackbox/test_filter.py b/scripts/tests/twister_blackbox/test_filter.py index f7e3ff8f21f5..c65dda1604c3 100644 --- a/scripts/tests/twister_blackbox/test_filter.py +++ b/scripts/tests/twister_blackbox/test_filter.py @@ -7,7 +7,7 @@ """ import importlib -import mock +from unittest import mock import os import pytest import sys diff --git a/scripts/tests/twister_blackbox/test_footprint.py b/scripts/tests/twister_blackbox/test_footprint.py index 35824d792b18..b9e072a26661 100644 --- a/scripts/tests/twister_blackbox/test_footprint.py +++ b/scripts/tests/twister_blackbox/test_footprint.py @@ -8,7 +8,7 @@ import importlib import json -import mock +from unittest import mock import os import pytest import sys diff --git a/scripts/tests/twister_blackbox/test_hardwaremap.py b/scripts/tests/twister_blackbox/test_hardwaremap.py index c1f6ff1eaf81..ce3493415a9d 100644 --- a/scripts/tests/twister_blackbox/test_hardwaremap.py +++ b/scripts/tests/twister_blackbox/test_hardwaremap.py @@ -6,11 +6,12 @@ Blackbox tests for twister's command line functions """ import importlib -import mock +from unittest import mock import os import pytest import sys +# pylint: disable=no-name-in-module from conftest import ZEPHYR_BASE, testsuite_filename_mock, clear_log_in_test from twisterlib.testplan import TestPlan diff --git a/scripts/tests/twister_blackbox/test_outfile.py b/scripts/tests/twister_blackbox/test_outfile.py index 590e0c8f58a7..bdaa5d3291d8 100644 --- a/scripts/tests/twister_blackbox/test_outfile.py +++ b/scripts/tests/twister_blackbox/test_outfile.py @@ -8,7 +8,7 @@ import importlib import re -import mock +from unittest import mock import os import shutil import pytest diff --git a/scripts/tests/twister_blackbox/test_output.py b/scripts/tests/twister_blackbox/test_output.py index 5babfa966208..c6a77020638b 100644 --- a/scripts/tests/twister_blackbox/test_output.py +++ b/scripts/tests/twister_blackbox/test_output.py @@ -8,7 +8,7 @@ import importlib import re -import mock +from unittest import mock import os import pytest import sys diff --git a/scripts/tests/twister_blackbox/test_platform.py b/scripts/tests/twister_blackbox/test_platform.py index 0c644dcff5ae..33239d5fcc02 100644 --- a/scripts/tests/twister_blackbox/test_platform.py +++ b/scripts/tests/twister_blackbox/test_platform.py @@ -8,7 +8,7 @@ import importlib import re -import mock +from unittest import mock import os import pytest import sys diff --git a/scripts/tests/twister_blackbox/test_printouts.py b/scripts/tests/twister_blackbox/test_printouts.py index 8f07a0fd3aa8..f383fe09744c 100644 --- a/scripts/tests/twister_blackbox/test_printouts.py +++ b/scripts/tests/twister_blackbox/test_printouts.py @@ -7,7 +7,7 @@ """ import importlib -import mock +from unittest import mock import os import pytest import sys diff --git a/scripts/tests/twister_blackbox/test_quarantine.py b/scripts/tests/twister_blackbox/test_quarantine.py index 61cfa9634e3e..63e6de53cc5a 100644 --- a/scripts/tests/twister_blackbox/test_quarantine.py +++ b/scripts/tests/twister_blackbox/test_quarantine.py @@ -7,7 +7,7 @@ """ import importlib -import mock +from unittest import mock import os import pytest import re diff --git a/scripts/tests/twister_blackbox/test_report.py b/scripts/tests/twister_blackbox/test_report.py index 83d5942c8554..ab2aec447ec1 100644 --- a/scripts/tests/twister_blackbox/test_report.py +++ b/scripts/tests/twister_blackbox/test_report.py @@ -8,7 +8,7 @@ import importlib import json -import mock +from unittest import mock import os import pytest import shutil diff --git a/scripts/tests/twister_blackbox/test_runner.py b/scripts/tests/twister_blackbox/test_runner.py index 57ecef3fbfed..09286663475b 100644 --- a/scripts/tests/twister_blackbox/test_runner.py +++ b/scripts/tests/twister_blackbox/test_runner.py @@ -8,7 +8,7 @@ # pylint: disable=duplicate-code import importlib -import mock +from unittest import mock import os import pytest import re diff --git a/scripts/tests/twister_blackbox/test_shuffle.py b/scripts/tests/twister_blackbox/test_shuffle.py index f45724b7b55e..ba19faf64b6e 100644 --- a/scripts/tests/twister_blackbox/test_shuffle.py +++ b/scripts/tests/twister_blackbox/test_shuffle.py @@ -7,7 +7,7 @@ """ import importlib -import mock +from unittest import mock import os import pytest import sys diff --git a/scripts/tests/twister_blackbox/test_testlist.py b/scripts/tests/twister_blackbox/test_testlist.py index ad8eaeddfaf5..410c417e14cd 100644 --- a/scripts/tests/twister_blackbox/test_testlist.py +++ b/scripts/tests/twister_blackbox/test_testlist.py @@ -7,7 +7,7 @@ """ import importlib -import mock +from unittest import mock import os import pytest import sys diff --git a/scripts/tests/twister_blackbox/test_testplan.py b/scripts/tests/twister_blackbox/test_testplan.py index 8834e03ead03..701acf94ddf2 100644 --- a/scripts/tests/twister_blackbox/test_testplan.py +++ b/scripts/tests/twister_blackbox/test_testplan.py @@ -7,7 +7,7 @@ """ import importlib -import mock +from unittest import mock import os import pytest import sys diff --git a/scripts/tests/twister_blackbox/test_tooling.py b/scripts/tests/twister_blackbox/test_tooling.py index 3979517e2da5..d844ec824de0 100644 --- a/scripts/tests/twister_blackbox/test_tooling.py +++ b/scripts/tests/twister_blackbox/test_tooling.py @@ -8,12 +8,13 @@ # pylint: disable=duplicate-code import importlib -import mock +from unittest import mock import os import pytest import sys import json +# pylint: disable=no-name-in-module from conftest import ZEPHYR_BASE, TEST_DATA, sample_filename_mock, testsuite_filename_mock from twisterlib.statuses import TwisterStatus from twisterlib.testplan import TestPlan From e06d9e82cd78b692bbbd99b2997f4e2e4d87444e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Wed, 2 Jul 2025 21:41:01 +0200 Subject: [PATCH 0792/2141] [nrf fromtree] scripts: requirements: drop tomli dependency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This dependency is not used anywhere so drop it. Signed-off-by: Benjamin Cabé (cherry picked from commit 53ea49539a2cf34944ddeac1f13b4dccdcbc469f) --- scripts/requirements-actions.in | 1 - scripts/requirements-actions.txt | 40 -------------------------------- 2 files changed, 41 deletions(-) diff --git a/scripts/requirements-actions.in b/scripts/requirements-actions.in index 9d56d56f2a3a..bb499b644a05 100644 --- a/scripts/requirements-actions.in +++ b/scripts/requirements-actions.in @@ -33,7 +33,6 @@ setuptools>=70.2.0 spdx-tools sphinx-lint tabulate -tomli>=1.1.0 tox tqdm>=4.67.1 unidiff diff --git a/scripts/requirements-actions.txt b/scripts/requirements-actions.txt index 1af5b8267d5c..cc6873a7061b 100644 --- a/scripts/requirements-actions.txt +++ b/scripts/requirements-actions.txt @@ -1174,46 +1174,6 @@ tabulate==0.9.0 \ --hash=sha256:0095b12bf5966de529c0feb1fa08671671b3368eec77d7ef7ab114be2c068b3c \ --hash=sha256:024ca478df22e9340661486f85298cff5f6dcdba14f3813e8830015b9ed1948f # via -r requirements-actions.in -tomli==2.2.1 \ - --hash=sha256:023aa114dd824ade0100497eb2318602af309e5a55595f76b626d6d9f3b7b0a6 \ - --hash=sha256:02abe224de6ae62c19f090f68da4e27b10af2b93213d36cf44e6e1c5abd19fdd \ - --hash=sha256:286f0ca2ffeeb5b9bd4fcc8d6c330534323ec51b2f52da063b11c502da16f30c \ - --hash=sha256:2d0f2fdd22b02c6d81637a3c95f8cd77f995846af7414c5c4b8d0545afa1bc4b \ - --hash=sha256:33580bccab0338d00994d7f16f4c4ec25b776af3ffaac1ed74e0b3fc95e885a8 \ - --hash=sha256:400e720fe168c0f8521520190686ef8ef033fb19fc493da09779e592861b78c6 \ - --hash=sha256:40741994320b232529c802f8bc86da4e1aa9f413db394617b9a256ae0f9a7f77 \ - --hash=sha256:465af0e0875402f1d226519c9904f37254b3045fc5084697cefb9bdde1ff99ff \ - --hash=sha256:4a8f6e44de52d5e6c657c9fe83b562f5f4256d8ebbfe4ff922c495620a7f6cea \ - --hash=sha256:4e340144ad7ae1533cb897d406382b4b6fede8890a03738ff1683af800d54192 \ - --hash=sha256:678e4fa69e4575eb77d103de3df8a895e1591b48e740211bd1067378c69e8249 \ - --hash=sha256:6972ca9c9cc9f0acaa56a8ca1ff51e7af152a9f87fb64623e31d5c83700080ee \ - --hash=sha256:7fc04e92e1d624a4a63c76474610238576942d6b8950a2d7f908a340494e67e4 \ - --hash=sha256:889f80ef92701b9dbb224e49ec87c645ce5df3fa2cc548664eb8a25e03127a98 \ - --hash=sha256:8d57ca8095a641b8237d5b079147646153d22552f1c637fd3ba7f4b0b29167a8 \ - --hash=sha256:8dd28b3e155b80f4d54beb40a441d366adcfe740969820caf156c019fb5c7ec4 \ - --hash=sha256:9316dc65bed1684c9a98ee68759ceaed29d229e985297003e494aa825ebb0281 \ - --hash=sha256:a198f10c4d1b1375d7687bc25294306e551bf1abfa4eace6650070a5c1ae2744 \ - --hash=sha256:a38aa0308e754b0e3c67e344754dff64999ff9b513e691d0e786265c93583c69 \ - --hash=sha256:a92ef1a44547e894e2a17d24e7557a5e85a9e1d0048b0b5e7541f76c5032cb13 \ - --hash=sha256:ac065718db92ca818f8d6141b5f66369833d4a80a9d74435a268c52bdfa73140 \ - --hash=sha256:b82ebccc8c8a36f2094e969560a1b836758481f3dc360ce9a3277c65f374285e \ - --hash=sha256:c954d2250168d28797dd4e3ac5cf812a406cd5a92674ee4c8f123c889786aa8e \ - --hash=sha256:cb55c73c5f4408779d0cf3eef9f762b9c9f147a77de7b258bef0a5628adc85cc \ - --hash=sha256:cd45e1dc79c835ce60f7404ec8119f2eb06d38b1deba146f07ced3bbc44505ff \ - --hash=sha256:d3f5614314d758649ab2ab3a62d4f2004c825922f9e370b29416484086b264ec \ - --hash=sha256:d920f33822747519673ee656a4b6ac33e382eca9d331c87770faa3eef562aeb2 \ - --hash=sha256:db2b95f9de79181805df90bedc5a5ab4c165e6ec3fe99f970d0e302f384ad222 \ - --hash=sha256:e59e304978767a54663af13c07b3d1af22ddee3bb2fb0618ca1593e4f593a106 \ - --hash=sha256:e85e99945e688e32d5a35c1ff38ed0b3f41f43fad8df0bdf79f72b2ba7bc5272 \ - --hash=sha256:ece47d672db52ac607a3d9599a9d48dcb2f2f735c6c2d1f34130085bb12b112a \ - --hash=sha256:f4039b9cbc3048b2416cc57ab3bda989a6fcf9b36cf8937f01a6e731b64f80d7 - # via - # -r requirements-actions.in - # mypy - # pylint - # pyproject-api - # pytest - # tox tomlkit==0.13.3 \ --hash=sha256:430cf247ee57df2b94ee3fbe588e71d362a941ebb545dec29b53961d61add2a1 \ --hash=sha256:c89c649d79ee40629a9fda55f8ace8c6a1b42deb912b2a8fd8d942ddadb606b0 From 70777ba23a9e67553dff61435150da7fe4b4a9d6 Mon Sep 17 00:00:00 2001 From: Tim Pambor Date: Sun, 20 Jul 2025 11:52:30 +0200 Subject: [PATCH 0793/2141] [nrf fromtree] scripts: requirements: Add back tomli Add back tomli to the requirements-actions.txt as it is still used by some dependencies. Signed-off-by: Tim Pambor (cherry picked from commit 12ba98b2ddb8e1c07de24c3dc0c48c135c3f7478) --- scripts/requirements-actions.txt | 39 ++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/scripts/requirements-actions.txt b/scripts/requirements-actions.txt index cc6873a7061b..a635c73b768e 100644 --- a/scripts/requirements-actions.txt +++ b/scripts/requirements-actions.txt @@ -1174,6 +1174,45 @@ tabulate==0.9.0 \ --hash=sha256:0095b12bf5966de529c0feb1fa08671671b3368eec77d7ef7ab114be2c068b3c \ --hash=sha256:024ca478df22e9340661486f85298cff5f6dcdba14f3813e8830015b9ed1948f # via -r requirements-actions.in +tomli==2.2.1 ; python_full_version < '3.11' \ + --hash=sha256:023aa114dd824ade0100497eb2318602af309e5a55595f76b626d6d9f3b7b0a6 \ + --hash=sha256:02abe224de6ae62c19f090f68da4e27b10af2b93213d36cf44e6e1c5abd19fdd \ + --hash=sha256:286f0ca2ffeeb5b9bd4fcc8d6c330534323ec51b2f52da063b11c502da16f30c \ + --hash=sha256:2d0f2fdd22b02c6d81637a3c95f8cd77f995846af7414c5c4b8d0545afa1bc4b \ + --hash=sha256:33580bccab0338d00994d7f16f4c4ec25b776af3ffaac1ed74e0b3fc95e885a8 \ + --hash=sha256:400e720fe168c0f8521520190686ef8ef033fb19fc493da09779e592861b78c6 \ + --hash=sha256:40741994320b232529c802f8bc86da4e1aa9f413db394617b9a256ae0f9a7f77 \ + --hash=sha256:465af0e0875402f1d226519c9904f37254b3045fc5084697cefb9bdde1ff99ff \ + --hash=sha256:4a8f6e44de52d5e6c657c9fe83b562f5f4256d8ebbfe4ff922c495620a7f6cea \ + --hash=sha256:4e340144ad7ae1533cb897d406382b4b6fede8890a03738ff1683af800d54192 \ + --hash=sha256:678e4fa69e4575eb77d103de3df8a895e1591b48e740211bd1067378c69e8249 \ + --hash=sha256:6972ca9c9cc9f0acaa56a8ca1ff51e7af152a9f87fb64623e31d5c83700080ee \ + --hash=sha256:7fc04e92e1d624a4a63c76474610238576942d6b8950a2d7f908a340494e67e4 \ + --hash=sha256:889f80ef92701b9dbb224e49ec87c645ce5df3fa2cc548664eb8a25e03127a98 \ + --hash=sha256:8d57ca8095a641b8237d5b079147646153d22552f1c637fd3ba7f4b0b29167a8 \ + --hash=sha256:8dd28b3e155b80f4d54beb40a441d366adcfe740969820caf156c019fb5c7ec4 \ + --hash=sha256:9316dc65bed1684c9a98ee68759ceaed29d229e985297003e494aa825ebb0281 \ + --hash=sha256:a198f10c4d1b1375d7687bc25294306e551bf1abfa4eace6650070a5c1ae2744 \ + --hash=sha256:a38aa0308e754b0e3c67e344754dff64999ff9b513e691d0e786265c93583c69 \ + --hash=sha256:a92ef1a44547e894e2a17d24e7557a5e85a9e1d0048b0b5e7541f76c5032cb13 \ + --hash=sha256:ac065718db92ca818f8d6141b5f66369833d4a80a9d74435a268c52bdfa73140 \ + --hash=sha256:b82ebccc8c8a36f2094e969560a1b836758481f3dc360ce9a3277c65f374285e \ + --hash=sha256:c954d2250168d28797dd4e3ac5cf812a406cd5a92674ee4c8f123c889786aa8e \ + --hash=sha256:cb55c73c5f4408779d0cf3eef9f762b9c9f147a77de7b258bef0a5628adc85cc \ + --hash=sha256:cd45e1dc79c835ce60f7404ec8119f2eb06d38b1deba146f07ced3bbc44505ff \ + --hash=sha256:d3f5614314d758649ab2ab3a62d4f2004c825922f9e370b29416484086b264ec \ + --hash=sha256:d920f33822747519673ee656a4b6ac33e382eca9d331c87770faa3eef562aeb2 \ + --hash=sha256:db2b95f9de79181805df90bedc5a5ab4c165e6ec3fe99f970d0e302f384ad222 \ + --hash=sha256:e59e304978767a54663af13c07b3d1af22ddee3bb2fb0618ca1593e4f593a106 \ + --hash=sha256:e85e99945e688e32d5a35c1ff38ed0b3f41f43fad8df0bdf79f72b2ba7bc5272 \ + --hash=sha256:ece47d672db52ac607a3d9599a9d48dcb2f2f735c6c2d1f34130085bb12b112a \ + --hash=sha256:f4039b9cbc3048b2416cc57ab3bda989a6fcf9b36cf8937f01a6e731b64f80d7 + # via + # mypy + # pylint + # pyproject-api + # pytest + # tox tomlkit==0.13.3 \ --hash=sha256:430cf247ee57df2b94ee3fbe588e71d362a941ebb545dec29b53961d61add2a1 \ --hash=sha256:c89c649d79ee40629a9fda55f8ace8c6a1b42deb912b2a8fd8d942ddadb606b0 From 6b25d16bb67034e389f4142f4f9325bc3b867ed6 Mon Sep 17 00:00:00 2001 From: Tim Pambor Date: Sun, 20 Jul 2025 17:35:51 +0200 Subject: [PATCH 0794/2141] [nrf fromtree] scripts: requirements: Remove mock Remove mock from requirements-actions.in as it is not needed anymore. Signed-off-by: Tim Pambor (cherry picked from commit 3d077c68ca4b106c0e16d7a65002323fa25c31a7) --- scripts/requirements-actions.in | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/requirements-actions.in b/scripts/requirements-actions.in index bb499b644a05..4488b9565d90 100644 --- a/scripts/requirements-actions.in +++ b/scripts/requirements-actions.in @@ -13,7 +13,6 @@ intelhex junit2html junitparser>=4.0.1 lxml>=5.3.0 -mock mypy natsort ply>=3.10 From 37ca03ef3c9b618f44fb2f38acebdb377b3cda55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Wed, 2 Jul 2025 21:30:42 +0200 Subject: [PATCH 0795/2141] [nrf fromtree] scripts: requirements: remove lxml dependency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit No more users of lxml in the tree so drop the 3rd party dependency (it might still be pulled in by other projects, ex. gcovr). Signed-off-by: Benjamin Cabé (cherry picked from commit 99138170b30c89614ea9b329f11cef1e33648874) --- scripts/requirements-actions.in | 1 - scripts/requirements-actions.txt | 4 +--- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/scripts/requirements-actions.in b/scripts/requirements-actions.in index 4488b9565d90..492a1a4fa84f 100644 --- a/scripts/requirements-actions.in +++ b/scripts/requirements-actions.in @@ -12,7 +12,6 @@ ijson intelhex junit2html junitparser>=4.0.1 -lxml>=5.3.0 mypy natsort ply>=3.10 diff --git a/scripts/requirements-actions.txt b/scripts/requirements-actions.txt index a635c73b768e..4a987e9f0ded 100644 --- a/scripts/requirements-actions.txt +++ b/scripts/requirements-actions.txt @@ -583,9 +583,7 @@ lxml==6.0.0 \ --hash=sha256:f720a14aa102a38907c6d5030e3d66b3b680c3e6f6bc95473931ea3c00c59967 \ --hash=sha256:f8d19565ae3eb956d84da3ef367aa7def14a2735d05bd275cd54c0301f0d0d6c \ --hash=sha256:f97487996a39cb18278ca33f7be98198f278d0bc3c5d0fd4d7b3d63646ca3c8a - # via - # -r requirements-actions.in - # gcovr + # via gcovr markupsafe==3.0.2 \ --hash=sha256:0bff5e0ae4ef2e1ae4fdf2dfd5b76c75e5c2fa4132d05fc1b0dabcd20c7e28c4 \ --hash=sha256:0f4ca02bea9a23221c0182836703cbf8930c5e9454bacce27e767509fa286a30 \ From e6b70b6612cbb5f5147248223b02c4789b7b98b8 Mon Sep 17 00:00:00 2001 From: Stephanos Ioannidis Date: Tue, 9 Sep 2025 13:43:39 +0900 Subject: [PATCH 0796/2141] [nrf fromtree] scripts: requirements-action: Require PyGithub >= 2.7.0 PyGithub >= 2.7.0 is required for the `Repository.get_collaborator_role_name` function used by the maintainer check script. Signed-off-by: Stephanos Ioannidis (cherry picked from commit 3c1f7f1c71bbba2927807e51f09efe957c07e514) --- scripts/requirements-actions.in | 2 +- scripts/requirements-actions.txt | 14 ++++---------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/scripts/requirements-actions.in b/scripts/requirements-actions.in index 492a1a4fa84f..997afed38712 100644 --- a/scripts/requirements-actions.in +++ b/scripts/requirements-actions.in @@ -17,7 +17,7 @@ natsort ply>=3.10 psutil>=5.6.6 pyelftools>=0.29 -pygithub +pygithub>=2.7.0 pykwalify pylint>=3 pyserial diff --git a/scripts/requirements-actions.txt b/scripts/requirements-actions.txt index 4a987e9f0ded..8c28b2d22f77 100644 --- a/scripts/requirements-actions.txt +++ b/scripts/requirements-actions.txt @@ -302,10 +302,6 @@ cryptography==45.0.5 \ --hash=sha256:e74d30ec9c7cb2f404af331d5b4099a9b322a8a6b25c4632755c8757345baac5 \ --hash=sha256:f3562c2f23c612f2e4a6964a61d942f891d29ee320edb62ff48ffb99f3de9ae8 # via pyjwt -deprecated==1.2.18 \ - --hash=sha256:422b6f6d859da6f2ef57857761bfb392480502a64c3028ca9bbe86085d72115d \ - --hash=sha256:bd5011788200372a32418f888e326a09ff80d0214bd961147cfed01b5c018eec - # via pygithub dill==0.4.0 \ --hash=sha256:0633f1d2df477324f53a895b02c901fb961bdbf65a17122586ea7019292cbcf0 \ --hash=sha256:44f54bf6412c2c8464c14e8243eb163690a9800dbe2c367330883b19c7561049 @@ -816,9 +812,9 @@ pyelftools==0.32 \ --hash=sha256:013df952a006db5e138b1edf6d8a68ecc50630adbd0d83a2d41e7f846163d738 \ --hash=sha256:6de90ee7b8263e740c8715a925382d4099b354f29ac48ea40d840cf7aa14ace5 # via -r requirements-actions.in -pygithub==2.6.1 \ - --hash=sha256:6f2fa6d076ccae475f9fc392cc6cdbd54db985d4f69b8833a28397de75ed6ca3 \ - --hash=sha256:b5c035392991cca63959e9453286b41b54d83bf2de2daa7d7ff7e4312cebf3bf +pygithub==2.8.1 \ + --hash=sha256:23a0a5bca93baef082e03411bf0ce27204c32be8bfa7abc92fe4a3e132936df0 \ + --hash=sha256:341b7c78521cb07324ff670afd1baa2bf5c286f8d9fd302c1798ba594a5400c9 # via -r requirements-actions.in pygments==2.19.2 \ --hash=sha256:636cb2477cec7f8952536970bc533bc43743542f70392ae026374600add5b887 \ @@ -1344,9 +1340,7 @@ wrapt==1.17.2 \ --hash=sha256:f917c1180fdb8623c2b75a99192f4025e412597c50b2ac870f156de8fb101119 \ --hash=sha256:fc78a84e2dfbc27afe4b2bd7c80c8db9bca75cc5b85df52bfe634596a1da846b \ --hash=sha256:ff04ef6eec3eee8a5efef2401495967a916feaa353643defcc03fc74fe213b58 - # via - # deprecated - # python-can + # via python-can xlsxwriter==3.2.5 \ --hash=sha256:4f4824234e1eaf9d95df9a8fe974585ff91d0f5e3d3f12ace5b71e443c1c6abd \ --hash=sha256:7e88469d607cdc920151c0ab3ce9cf1a83992d4b7bc730c5ffdd1a12115a7dbe From 9a9fe4d379938c28208e0556dc5897dba8de5570 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Wed, 2 Jul 2025 21:23:41 +0200 Subject: [PATCH 0797/2141] [nrf fromtree] scripts: ci: check_compliance: no need for lxml anymore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove an old workaround requiring lxml to be present as junitparser was not working with xml.etree.ElementTree until version 3.0.0. Signed-off-by: Benjamin Cabé (cherry picked from commit db47c899e3f5b59e9d7c6268e2dec49d0cfb28e0) --- scripts/ci/check_compliance.py | 8 -------- scripts/requirements-build-test.txt | 2 +- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index f1da73f3ec0d..a557c78af1e7 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -2288,14 +2288,6 @@ def _main(args): def main(argv=None): args = parse_args(argv) - try: - # pylint: disable=unused-import - from lxml import etree - except ImportError: - print("\nERROR: Python module lxml not installed, unable to proceed") - print("See https://github.com/weiwei/junitparser/issues/99") - return 1 - try: n_fails = _main(args) except BaseException: diff --git a/scripts/requirements-build-test.txt b/scripts/requirements-build-test.txt index 76cee431f887..2ce1227e3e70 100644 --- a/scripts/requirements-build-test.txt +++ b/scripts/requirements-build-test.txt @@ -18,4 +18,4 @@ pytest mypy # used for JUnit XML parsing in CTest harness -junitparser +junitparser>=3.0.0 From 2fc387e0dd4d8292bdf4f0683a7044639a810f65 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Wed, 10 Sep 2025 09:14:29 +0100 Subject: [PATCH 0798/2141] [nrf fromlist] scripts: requirements: Add python-dotenv This is needed for any Kconfig processing Upstream PR #: 95771 Signed-off-by: Jamie McCrae --- scripts/requirements-actions.in | 1 + scripts/requirements-actions.txt | 4 ++++ scripts/requirements-build-test.txt | 2 ++ scripts/requirements-compliance.txt | 1 + 4 files changed, 8 insertions(+) diff --git a/scripts/requirements-actions.in b/scripts/requirements-actions.in index 997afed38712..6baf9dc9e3f4 100644 --- a/scripts/requirements-actions.in +++ b/scripts/requirements-actions.in @@ -22,6 +22,7 @@ pykwalify pylint>=3 pyserial pytest +python-dotenv python-magic-bin; sys_platform == "win32" python-magic; sys_platform != "win32" pyyaml diff --git a/scripts/requirements-actions.txt b/scripts/requirements-actions.txt index 8c28b2d22f77..21505203bfa6 100644 --- a/scripts/requirements-actions.txt +++ b/scripts/requirements-actions.txt @@ -880,6 +880,10 @@ python-debian==1.0.1 \ --hash=sha256:3ada9b83a3d671b58081782c0969cffa0102f6ce433fbbc7cf21275b8b5cc771 \ --hash=sha256:8f137c230c1d9279c2ac892b35915068b2aca090c9fd3da5671ff87af32af12c # via reuse +python-dotenv==1.1.1 \ + --hash=sha256:31f23644fe2602f88ff55e1f5c79ba497e01224ee7737937930c448e4d0e24dc \ + --hash=sha256:a8a6399716257f45be6a007360200409fce5cda2661e3dec71d23dc15f6189ab + # via -r requirements-actions.in python-magic==0.4.27 ; sys_platform != 'win32' \ --hash=sha256:c1ba14b08e4a5f5c31a302b7721239695b2f0f058d125bd5ce1ee36b9d9d3c3b \ --hash=sha256:c212960ad306f700aa0d01e5d7a325d20548ff97eb9920dcd29513174f0294d3 diff --git a/scripts/requirements-build-test.txt b/scripts/requirements-build-test.txt index 2ce1227e3e70..e6264b11ea5e 100644 --- a/scripts/requirements-build-test.txt +++ b/scripts/requirements-build-test.txt @@ -19,3 +19,5 @@ mypy # used for JUnit XML parsing in CTest harness junitparser>=3.0.0 + +python-dotenv diff --git a/scripts/requirements-compliance.txt b/scripts/requirements-compliance.txt index 3c3841cf33ed..6d90ac4b2587 100644 --- a/scripts/requirements-compliance.txt +++ b/scripts/requirements-compliance.txt @@ -8,6 +8,7 @@ junitparser>=4.0.1 lxml>=5.3.0 pykwalify pylint>=3 +python-dotenv python-magic-bin; sys_platform == "win32" python-magic; sys_platform != "win32" ruff==0.11.11 From 25ced410af6caf6fea810b49ef4cf9b3bcb40b2b Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Wed, 10 Sep 2025 09:08:10 +0100 Subject: [PATCH 0799/2141] [nrf fromlist] kconfig: Load Kconfig env file better Loads this file in a better way that means samples and modules should not have to source the file before referencing Kconfig module path variables Upstream PR #: 95771 Signed-off-by: Jamie McCrae --- Kconfig.zephyr | 1 - cmake/modules/kconfig.cmake | 5 ++++- doc/_extensions/zephyr/kconfig/__init__.py | 6 ++++-- scripts/ci/check_compliance.py | 8 ++++++-- scripts/zephyr_module.py | 18 +++++++++++++++--- share/sysbuild/Kconfig | 2 -- 6 files changed, 29 insertions(+), 11 deletions(-) diff --git a/Kconfig.zephyr b/Kconfig.zephyr index ace2652550d3..994730d19332 100644 --- a/Kconfig.zephyr +++ b/Kconfig.zephyr @@ -6,7 +6,6 @@ # SPDX-License-Identifier: Apache-2.0 source "Kconfig.constants" -source "$(KCONFIG_ENV_FILE)" osource "$(APPLICATION_SOURCE_DIR)/VERSION" diff --git a/cmake/modules/kconfig.cmake b/cmake/modules/kconfig.cmake index 1e2cf75f54b2..c65f407502a5 100644 --- a/cmake/modules/kconfig.cmake +++ b/cmake/modules/kconfig.cmake @@ -132,10 +132,13 @@ endif() # APP_DIR: Path to the main image (sysbuild) or synonym for APPLICATION_SOURCE_DIR (non-sysbuild) zephyr_get(APP_DIR VAR APP_DIR APPLICATION_SOURCE_DIR) +# Load the module Kconfig file into CMake +include("${KCONFIG_BINARY_DIR}/kconfig_module_dirs.cmake") + set(COMMON_KCONFIG_ENV_SETTINGS PYTHON_EXECUTABLE=${PYTHON_EXECUTABLE} - KCONFIG_ENV_FILE=${KCONFIG_BINARY_DIR}/kconfig_module_dirs.env srctree=${ZEPHYR_BASE} + ${kconfig_env_dirs} KERNELVERSION=${KERNELVERSION} APPVERSION=${APP_VERSION_STRING} APP_VERSION_EXTENDED_STRING=${APP_VERSION_EXTENDED_STRING} diff --git a/doc/_extensions/zephyr/kconfig/__init__.py b/doc/_extensions/zephyr/kconfig/__init__.py index a76ac87f887b..63459a61ade6 100644 --- a/doc/_extensions/zephyr/kconfig/__init__.py +++ b/doc/_extensions/zephyr/kconfig/__init__.py @@ -44,6 +44,7 @@ from typing import Any from docutils import nodes +from dotenv import load_dotenv from sphinx.addnodes import pending_xref from sphinx.application import Sphinx from sphinx.builders import Builder @@ -81,7 +82,8 @@ def kconfig_load(app: Sphinx) -> tuple[kconfiglib.Kconfig, kconfiglib.Kconfig, d sysbuild_kconfig = "" for module in modules: kconfig_module_dirs += zephyr_module.process_kconfig_module_dir(module.project, - module.meta) + module.meta, + False) kconfig += zephyr_module.process_kconfig(module.project, module.meta) sysbuild_kconfig += zephyr_module.process_sysbuildkconfig(module.project, module.meta) @@ -158,7 +160,7 @@ def kconfig_load(app: Sphinx) -> tuple[kconfiglib.Kconfig, kconfiglib.Kconfig, d os.environ["BOARD"] = "boards" os.environ["KCONFIG_BOARD_DIR"] = str(Path(td) / "boards") - os.environ["KCONFIG_ENV_FILE"] = str(Path(td) / "kconfig_module_dirs.env") + load_dotenv(str(Path(td) / "kconfig_module_dirs.env")) # Sysbuild runs first os.environ["CONFIG_"] = "SB_CONFIG_" diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index a557c78af1e7..b0f4ccebb1e2 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -23,6 +23,8 @@ import unidiff import yaml +from dotenv import load_dotenv + from yamllint import config, linter from junitparser import TestCase, TestSuite, JUnitXml, Skipped, Error, Failure @@ -730,14 +732,14 @@ def parse_kconfig(self): os.environ["KCONFIG_BINARY_DIR"] = kconfiglib_dir os.environ['DEVICETREE_CONF'] = "dummy" os.environ['TOOLCHAIN_HAS_NEWLIB'] = "y" - os.environ['KCONFIG_ENV_FILE'] = os.path.join(kconfiglib_dir, "kconfig_module_dirs.env") + kconfig_env_file = os.path.join(kconfiglib_dir, "kconfig_module_dirs.env") # Older name for DEVICETREE_CONF, for compatibility with older Zephyr # versions that don't have the renaming os.environ["GENERATED_DTS_BOARD_CONF"] = "dummy" # For multi repo support - self.get_modules(os.environ['KCONFIG_ENV_FILE'], + self.get_modules(kconfig_env_file, os.path.join(kconfiglib_dir, "Kconfig.modules"), os.path.join(kconfiglib_dir, "Kconfig.sysbuild.modules"), os.path.join(kconfiglib_dir, "settings_file.txt")) @@ -751,6 +753,8 @@ def parse_kconfig(self): # symbols within Kconfig files os.environ["KCONFIG_WARN_UNDEF"] = "y" + load_dotenv(kconfig_env_file) + try: # Note this will both print warnings to stderr _and_ return # them: so some warnings might get printed diff --git a/scripts/zephyr_module.py b/scripts/zephyr_module.py index 8bf2d00793d7..8a451db63fa2 100755 --- a/scripts/zephyr_module.py +++ b/scripts/zephyr_module.py @@ -386,10 +386,13 @@ def kconfig_snippet(meta, path, kconfig_file=None, blobs=False, taint_blobs=Fals return '\n'.join(snippet) -def process_kconfig_module_dir(module, meta): +def process_kconfig_module_dir(module, meta, cmake_output): module_path = PurePath(module) name_sanitized = meta['name-sanitized'] - return f'ZEPHYR_{name_sanitized.upper()}_MODULE_DIR={module_path.as_posix()}\n' + + if cmake_output is False: + return f'ZEPHYR_{name_sanitized.upper()}_MODULE_DIR={module_path.as_posix()}\n' + return f'list(APPEND kconfig_env_dirs ZEPHYR_{name_sanitized.upper()}_MODULE_DIR={module_path.as_posix()})\n' def process_kconfig(module, meta): @@ -865,6 +868,7 @@ def main(): args = parser.parse_args() kconfig_module_dirs = "" + kconfig_module_dirs_cmake = "set(kconfig_env_dirs)\n" kconfig = "" cmake = "" sysbuild_kconfig = "" @@ -877,7 +881,8 @@ def main(): args.modules, args.extra_modules) for module in modules: - kconfig_module_dirs += process_kconfig_module_dir(module.project, module.meta) + kconfig_module_dirs += process_kconfig_module_dir(module.project, module.meta, False) + kconfig_module_dirs_cmake += process_kconfig_module_dir(module.project, module.meta, True) kconfig += process_kconfig(module.project, module.meta) cmake += process_cmake(module.project, module.meta) sysbuild_kconfig += process_sysbuildkconfig( @@ -889,13 +894,20 @@ def main(): if args.kconfig_out or args.sysbuild_kconfig_out: if args.kconfig_out: kconfig_module_dirs_out = PurePath(args.kconfig_out).parent / 'kconfig_module_dirs.env' + kconfig_module_dirs_cmake_out = PurePath(args.kconfig_out).parent / \ + 'kconfig_module_dirs.cmake' elif args.sysbuild_kconfig_out: kconfig_module_dirs_out = PurePath(args.sysbuild_kconfig_out).parent / \ 'kconfig_module_dirs.env' + kconfig_module_dirs_cmake_out = PurePath(args.sysbuild_kconfig_out).parent / \ + 'kconfig_module_dirs.cmake' with open(kconfig_module_dirs_out, 'w', encoding="utf-8") as fp: fp.write(kconfig_module_dirs) + with open(kconfig_module_dirs_cmake_out, 'w', encoding="utf-8") as fp: + fp.write(kconfig_module_dirs_cmake) + if args.kconfig_out: with open(args.kconfig_out, 'w', encoding="utf-8") as fp: fp.write(kconfig) diff --git a/share/sysbuild/Kconfig b/share/sysbuild/Kconfig index 6bf51245771f..5f689e07399a 100644 --- a/share/sysbuild/Kconfig +++ b/share/sysbuild/Kconfig @@ -2,8 +2,6 @@ # # SPDX-License-Identifier: Apache-2.0 -source "$(KCONFIG_ENV_FILE)" - config BOARD string default "$(BOARD)" From 96ef102fadde5fc5fb96e0019903c1f085780640 Mon Sep 17 00:00:00 2001 From: Kari Hamalainen Date: Fri, 12 Sep 2025 10:46:10 +0300 Subject: [PATCH 0800/2141] [nrf noup] ci: add reopen for manifest-pr action Previously reopening of PR did not reopen manifest PR. This commit will enable reopening of manifest PR in such case. Signed-off-by: Kari Hamalainen --- .github/workflows/manifest-PR.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/manifest-PR.yml b/.github/workflows/manifest-PR.yml index a871aa381ded..473301146527 100644 --- a/.github/workflows/manifest-PR.yml +++ b/.github/workflows/manifest-PR.yml @@ -1,7 +1,7 @@ name: handle manifest PR on: pull_request_target: - types: [opened, synchronize, closed] + types: [opened, synchronize, closed, reopened] branches: - main From 6d1a118f5e68da9f3378a772313dee1329041c78 Mon Sep 17 00:00:00 2001 From: Georgios Vasilakis Date: Tue, 5 Aug 2025 09:33:38 +0200 Subject: [PATCH 0801/2141] [nrf fromtree] Revert "boards: nordic: nrf54l10_cpuapp_ns: Add workaround for partitions" This reverts commit 002838ab9ef526c882225504bda0ef86ff577455. Signed-off-by: Georgios Vasilakis (cherry picked from commit dd95a7d83debfa08c4517aa04f3fdc8a519c7e2b) --- boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp_ns.dts | 3 --- boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns.dts | 3 --- 2 files changed, 6 deletions(-) diff --git a/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp_ns.dts b/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp_ns.dts index 39a986ae2b67..02d900390cca 100644 --- a/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp_ns.dts +++ b/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp_ns.dts @@ -59,9 +59,6 @@ }; &cpuapp_rram { - /* TODO: revert this hack when TF-M update is available that fixes partition sizes */ - reg = <0x0 DT_SIZE_K(1022)>; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns.dts b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns.dts index cd644d845d5e..f1aa851ed2d9 100644 --- a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns.dts +++ b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns.dts @@ -58,9 +58,6 @@ }; &cpuapp_rram { - /* TODO: revert this hack when TF-M update is available that fixes partition sizes */ - reg = <0x0 DT_SIZE_K(1022)>; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; From 481840a0e563d7b16268b992a72c9da663d34219 Mon Sep 17 00:00:00 2001 From: Georgios Vasilakis Date: Tue, 5 Aug 2025 09:43:53 +0200 Subject: [PATCH 0802/2141] [nrf fromtree] boards: nordic: Fix RRAM size for nRF54l10 NS The nRF54L1 has 1012 KB RRAM and not 1022 KB as it was set before. This adjusts the NS target with the correct size. Signed-off-by: Georgios Vasilakis (cherry picked from commit 9f0d2770f1ce544a0287d90731d0babed67f0972) --- .../nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns.dts | 12 ++++++------ .../nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns.yaml | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns.dts b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns.dts index f1aa851ed2d9..cfb02b6817a5 100644 --- a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns.dts +++ b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns.dts @@ -31,8 +31,8 @@ / { /* * Default SRAM planning when building for nRF54L10 with ARM TrustZone-M support. - * - Lowest 96 kB SRAM allocated to Secure image (sram0_s). - * - Upper 96 kB SRAM allocated to Non-Secure image (sram0_ns). + * - Lowest 72 kB SRAM allocated to Secure image (sram0_s). + * - Upper 72 kB SRAM allocated to Non-Secure image (sram0_ns). * * nRF54L10 has 192 kB of volatile memory (SRAM) but the last 42kB are reserved for * the FLPR MCU. @@ -62,7 +62,7 @@ compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; - /* nRF54L10 has 1022 kB of non volatile memory (RRAM) but the + /* nRF54L10 has 1012 kB of non volatile memory (RRAM) but the * last 62kB are reserved for the FLPR MCU. * * This static layout needs to be the same with the upstream TF-M layout in the @@ -91,12 +91,12 @@ slot0_ns_partition: partition@6A000 { label = "image-0-nonsecure"; - reg = <0x0006A000 DT_SIZE_K(504)>; + reg = <0x0006A000 DT_SIZE_K(494)>; }; - storage_partition: partition@E8000 { + storage_partition: partition@E5800 { label = "storage"; - reg = <0x000E8000 DT_SIZE_K(32)>; + reg = <0x000E5800 DT_SIZE_K(32)>; }; }; }; diff --git a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns.yaml b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns.yaml index 9f42daedf4e3..22fbcbc32c3c 100644 --- a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns.yaml +++ b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns.yaml @@ -9,7 +9,7 @@ toolchain: - gnuarmemb - zephyr ram: 192 -flash: 1022 +flash: 1012 supported: - adc - gpio From 51e6f94f5b7ff8d9364dff74d09cd37dfe69439d Mon Sep 17 00:00:00 2001 From: Georgios Vasilakis Date: Tue, 5 Aug 2025 10:47:53 +0200 Subject: [PATCH 0803/2141] [nrf fromtree] boards: ezurio: Fix RRAM size for nRF54l10 NS The nRF54L1 has 1012 KB RRAM and not 1022 KB as it was set before. This adjusts the NS target RRAM size for the relevant Ezurio boards which use the nRF54L10. Signed-off-by: Georgios Vasilakis (cherry picked from commit 7f9459571ad66f921ba48d56dcaddae1d603a233) --- .../bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp_ns.dts | 12 ++++++------ .../bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp_ns.yaml | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp_ns.dts b/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp_ns.dts index 02d900390cca..e7883bcbfaba 100644 --- a/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp_ns.dts +++ b/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp_ns.dts @@ -32,8 +32,8 @@ / { /* * Default SRAM planning when building for nRF54L10 with ARM TrustZone-M support. - * - Lowest 96 kB SRAM allocated to Secure image (sram0_s). - * - Upper 96 kB SRAM allocated to Non-Secure image (sram0_ns). + * - Lowest 72 kB SRAM allocated to Secure image (sram0_s). + * - Upper 72 kB SRAM allocated to Non-Secure image (sram0_ns). * * nRF54L10 has 192 kB of volatile memory (SRAM) but the last 42kB are reserved for * the FLPR MCU. @@ -63,7 +63,7 @@ compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; - /* nRF54L10 has 1022 kB of non volatile memory (RRAM) but the + /* nRF54L10 has 1012 kB of non volatile memory (RRAM) but the * last 62kB are reserved for the FLPR MCU. * * This static layout needs to be the same with the upstream TF-M layout in the @@ -92,12 +92,12 @@ slot0_ns_partition: partition@6A000 { label = "image-0-nonsecure"; - reg = <0x0006A000 DT_SIZE_K(504)>; + reg = <0x0006A000 DT_SIZE_K(494)>; }; - storage_partition: partition@E8000 { + storage_partition: partition@E5800 { label = "storage"; - reg = <0x000E8000 DT_SIZE_K(32)>; + reg = <0x000E5800 DT_SIZE_K(32)>; }; }; }; diff --git a/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp_ns.yaml b/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp_ns.yaml index d2ad19f03c4a..19bb368fc613 100644 --- a/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp_ns.yaml +++ b/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp_ns.yaml @@ -11,7 +11,7 @@ toolchain: - zephyr sysbuild: true ram: 192 -flash: 1022 +flash: 1012 supported: - adc - gpio From 4ff94f5ac0f195e2e359f61827890b7feec37244 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Mon, 15 Sep 2025 14:33:56 +0200 Subject: [PATCH 0804/2141] Revert "[nrf fromlist] tests: drivers: timer: nrf_grtc_timer: wait for coverage dump" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 103b06acfc2bf2d3c1f6414e5c3448e74d477ae6. Signed-off-by: Krzysztof Chruściński --- tests/drivers/timer/nrf_grtc_timer/src/main.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/tests/drivers/timer/nrf_grtc_timer/src/main.c b/tests/drivers/timer/nrf_grtc_timer/src/main.c index 7e2b440a9aa1..9de554256b41 100644 --- a/tests/drivers/timer/nrf_grtc_timer/src/main.c +++ b/tests/drivers/timer/nrf_grtc_timer/src/main.c @@ -393,13 +393,6 @@ static void grtc_stress_test(bool busy_sim_en) if (counter_dev) { counter_stop(counter_dev); } - -#ifdef CONFIG_COVERAGE - /* Wait a few seconds before exit, giving the test the - * opportunity to dump some output before coverage data gets emitted - */ - k_sleep(K_MSEC(5000)); -#endif } ZTEST(nrf_grtc_timer, test_stress) From 512a4880dc01043469ec27941dc3e95e48f0614a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Mon, 15 Sep 2025 14:34:06 +0200 Subject: [PATCH 0805/2141] Revert "[nrf fromlist] tests: drivers: timer: nrf_grtc_timer: Add stress test" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 6bbe5d64f72b0843ed16f9ef01704759e4e76cff. Signed-off-by: Krzysztof Chruściński --- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 17 -- .../boards/nrf54l15dk_nrf54l15_cpuapp.overlay | 32 --- .../nrf54l15dk_nrf54l15_cpuflpr.overlay | 32 --- tests/drivers/timer/nrf_grtc_timer/prj.conf | 6 - tests/drivers/timer/nrf_grtc_timer/src/main.c | 247 ------------------ .../timer/nrf_grtc_timer/testcase.yaml | 43 ++- 6 files changed, 20 insertions(+), 357 deletions(-) delete mode 100644 tests/drivers/timer/nrf_grtc_timer/boards/nrf54l15dk_nrf54l15_cpuapp.overlay delete mode 100644 tests/drivers/timer/nrf_grtc_timer/boards/nrf54l15dk_nrf54l15_cpuflpr.overlay diff --git a/tests/drivers/timer/nrf_grtc_timer/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/timer/nrf_grtc_timer/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index 7ae959267039..04580b71480b 100644 --- a/tests/drivers/timer/nrf_grtc_timer/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/tests/drivers/timer/nrf_grtc_timer/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -2,21 +2,4 @@ &grtc { /delete-property/ child-owned-channels; - interrupts = <109 2>; -}; - -test_timer: &timer131 { - status = "okay"; - interrupts = <419 1>; -}; - -&timer130 { - status = "okay"; - prescaler = <0>; -}; - -/ { - chosen { - zephyr,cpu-load-counter = &timer130; - }; }; diff --git a/tests/drivers/timer/nrf_grtc_timer/boards/nrf54l15dk_nrf54l15_cpuapp.overlay b/tests/drivers/timer/nrf_grtc_timer/boards/nrf54l15dk_nrf54l15_cpuapp.overlay deleted file mode 100644 index 7bcede529b0e..000000000000 --- a/tests/drivers/timer/nrf_grtc_timer/boards/nrf54l15dk_nrf54l15_cpuapp.overlay +++ /dev/null @@ -1,32 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - -&grtc { - interrupts = <228 2>; -}; - -test_timer: &timer21 { - status = "okay"; - interrupts = <203 1>; -}; - -&timer20 { - status = "okay"; - interrupts = <202 0>; -}; - -&timer00 { - status = "okay"; - prescaler = <0>; -}; - -/ { - chosen { - zephyr,cpu-load-counter = &timer00; - }; - - busy-sim { - compatible = "vnd,busy-sim"; - status = "okay"; - counter = <&timer20>; - }; -}; diff --git a/tests/drivers/timer/nrf_grtc_timer/boards/nrf54l15dk_nrf54l15_cpuflpr.overlay b/tests/drivers/timer/nrf_grtc_timer/boards/nrf54l15dk_nrf54l15_cpuflpr.overlay deleted file mode 100644 index cfa72ed02736..000000000000 --- a/tests/drivers/timer/nrf_grtc_timer/boards/nrf54l15dk_nrf54l15_cpuflpr.overlay +++ /dev/null @@ -1,32 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - -&grtc { - /*interrupts = <226 2>;*/ -}; - -test_timer: &timer21 { - status = "okay"; - /*interrupts = <203 2>;*/ -}; - -&timer20 { - status = "okay"; - interrupts = <202 0>; -}; - -&timer00 { - status = "okay"; - prescaler = <0>; -}; - -/ { - chosen { - zephyr,cpu-load-counter = &timer00; - }; - - busy-sim { - compatible = "vnd,busy-sim"; - status = "okay"; - counter = <&timer20>; - }; -}; diff --git a/tests/drivers/timer/nrf_grtc_timer/prj.conf b/tests/drivers/timer/nrf_grtc_timer/prj.conf index 93926f090b7e..dea03477519d 100644 --- a/tests/drivers/timer/nrf_grtc_timer/prj.conf +++ b/tests/drivers/timer/nrf_grtc_timer/prj.conf @@ -1,8 +1,2 @@ CONFIG_ZTEST=y CONFIG_NRF_GRTC_TIMER=y -CONFIG_COUNTER=y -CONFIG_TEST_RANDOM_GENERATOR=y -CONFIG_XOSHIRO_RANDOM_GENERATOR=y -CONFIG_LOG_PRINTK=y -CONFIG_CPU_LOAD=y -CONFIG_CPU_LOAD_USE_COUNTER=y diff --git a/tests/drivers/timer/nrf_grtc_timer/src/main.c b/tests/drivers/timer/nrf_grtc_timer/src/main.c index 9de554256b41..cede54f026f1 100644 --- a/tests/drivers/timer/nrf_grtc_timer/src/main.c +++ b/tests/drivers/timer/nrf_grtc_timer/src/main.c @@ -5,15 +5,7 @@ */ #include #include -#include -#include -#include -#include -#include -#include -#include #include -LOG_MODULE_REGISTER(test, 1); #define GRTC_SLEW_TICKS 10 #define NUMBER_OF_TRIES 2000 @@ -161,243 +153,4 @@ ZTEST(nrf_grtc_timer, test_timer_abort_in_compare_mode) z_nrf_grtc_timer_chan_free(channel); } -enum test_timer_state { - TIMER_IDLE, - TIMER_PREPARE, - TIMER_ACTIVE -}; - -enum test_ctx { - TEST_HIGH_PRI, - TEST_TIMER_CB, - TEST_THREAD -}; - -struct test_grtc_timer { - struct k_timer timer; - uint32_t ticks; - uint32_t expire; - uint32_t start_cnt; - uint32_t expire_cnt; - uint32_t abort_cnt; - uint32_t exp_expire; - int max_late; - int min_late; - int avg_late; - uint32_t early_cnt; - enum test_timer_state state; -}; - -static atomic_t test_active_cnt; -static struct test_grtc_timer timers[8]; -static uint32_t test_end; -static k_tid_t test_tid; -static volatile bool test_run; -static uint32_t ctx_cnt[3]; -static const char *const ctx_name[] = { "HIGH PRIO ISR", "TIMER CALLBACK", "THREAD" }; - -static bool stress_test_action(int ctx, int id) -{ - struct test_grtc_timer *timer = &timers[id]; - - ctx_cnt[ctx]++; - if (timer->state == TIMER_ACTIVE) { - /* Aborting soon to expire timers from higher interrupt priority may lead - * to test failures. - */ - if (ctx == 0 && (k_timer_remaining_get(&timer->timer) < 5)) { - return true; - } - - if (timer->abort_cnt < timer->expire_cnt / 2) { - bool any_active; - - timer->state = TIMER_PREPARE; - k_timer_stop(&timer->timer); - timer->abort_cnt++; - any_active = atomic_dec(&test_active_cnt) > 1; - timer->state = TIMER_IDLE; - - return any_active; - } - } else if (timer->state == TIMER_IDLE) { - int ticks = 10 + (sys_rand32_get() & 0x3F); - k_timeout_t t = K_TICKS(ticks); - - timer->exp_expire = k_ticks_to_cyc_floor32(sys_clock_tick_get_32() + ticks); - timer->state = TIMER_PREPARE; - timer->ticks = ticks; - k_timer_start(&timer->timer, t, K_NO_WAIT); - atomic_inc(&test_active_cnt); - timer->start_cnt++; - timer->state = TIMER_ACTIVE; - } - - return true; -} - -static void stress_test_actions(int ctx) -{ - uint32_t r = sys_rand32_get(); - int action_cnt = Z_MAX(r & 0x3, 1); - int tmr_id = (r >> 8) % ARRAY_SIZE(timers); - - /* Occasionally wake thread context from which timer actions are also executed. */ - if ((((r >> 2) & 0x3) == 0) || test_active_cnt < 2) { - LOG_DBG("ctx:%d thread wakeup", ctx); - k_wakeup(test_tid); - } - - for (int i = 0; i < action_cnt; i++) { - if (stress_test_action(ctx, tmr_id) == false) { - stress_test_action(ctx, tmr_id); - } - } -} - -static void timer_cb(struct k_timer *timer) -{ - struct test_grtc_timer *test_timer = CONTAINER_OF(timer, struct test_grtc_timer, timer); - uint32_t now = k_cycle_get_32(); - int diff = now - test_timer->exp_expire; - - atomic_dec(&test_active_cnt); - zassert_true(diff >= 0); - test_timer->max_late = MAX(diff, test_timer->max_late); - test_timer->min_late = MIN(diff, test_timer->min_late); - - if (test_timer->expire_cnt == 0) { - test_timer->avg_late = diff; - } else { - test_timer->avg_late = (test_timer->avg_late * test_timer->expire_cnt + diff) / - (test_timer->expire_cnt + 1); - } - - test_timer->expire_cnt++; - test_timer->state = TIMER_IDLE; - - if (test_run) { - stress_test_actions(TEST_TIMER_CB); - } -} - -static void counter_set(const struct device *dev, struct counter_alarm_cfg *cfg) -{ - int err; - uint32_t us = 150 + (sys_rand32_get() & 0x3F); - - cfg->ticks = counter_us_to_ticks(dev, us); - err = counter_set_channel_alarm(dev, 0, cfg); - zassert_equal(err, 0); -} - -static void counter_cb(const struct device *dev, uint8_t chan_id, uint32_t ticks, void *user_data) -{ - struct counter_alarm_cfg *config = user_data; - - if (test_run) { - stress_test_actions(TEST_HIGH_PRI); - counter_set(dev, config); - } -} - -static void report_progress(uint32_t start, uint32_t end) -{ - static uint32_t next_report; - static uint32_t step; - static uint32_t progress; - - if (next_report == 0) { - step = (end - start) / 10; - next_report = start + step; - } - - if (k_uptime_get_32() > next_report) { - next_report += step; - progress += 10; - printk("%d%%\r", progress); - } -} - -static void grtc_stress_test(bool busy_sim_en) -{ - static struct counter_alarm_cfg alarm_cfg; -#if DT_NODE_EXISTS(DT_NODELABEL(test_timer)) && DT_NODE_HAS_STATUS(DT_NODELABEL(test_timer), okay) - const struct device *const counter_dev = DEVICE_DT_GET(DT_NODELABEL(test_timer)); -#else - const struct device *const counter_dev = NULL; -#endif - uint32_t test_ms = 5000; - uint32_t test_start = k_uptime_get_32(); - uint32_t load; - - test_end = k_cycle_get_32() + k_ms_to_cyc_floor32(test_ms); - test_tid = k_current_get(); - - for (size_t i = 0; i < ARRAY_SIZE(timers); i++) { - k_timer_init(&timers[i].timer, timer_cb, NULL); - } - - if (IS_ENABLED(CONFIG_CPU_LOAD)) { - (void)cpu_load_get(true); - } - - if (counter_dev) { - counter_start(counter_dev); - } - - alarm_cfg.callback = counter_cb; - alarm_cfg.user_data = &alarm_cfg; - test_run = true; - - if (counter_dev) { - counter_set(counter_dev, &alarm_cfg); - } - - if (busy_sim_en) { - busy_sim_start(500, 200, 1000, 400, NULL); - } - - LOG_DBG("Starting test, will end at %d", test_end); - while (k_cycle_get_32() < test_end) { - report_progress(test_start, test_start + test_ms); - stress_test_actions(TEST_THREAD); - k_sleep(K_MSEC(test_ms)); - } - - load = IS_ENABLED(CONFIG_CPU_LOAD) ? cpu_load_get(true) : 0; - - test_run = false; - k_msleep(50); - - for (size_t i = 0; i < ARRAY_SIZE(timers); i++) { - zassert_equal(timers[i].state, TIMER_IDLE, "Unexpected timer %d state:%d", - i, timers[i].state); - TC_PRINT("Timer%d (%p)\r\n\tstart_cnt:%d abort_cnt:%d expire_cnt:%d\n", - i, &timers[i], timers[i].start_cnt, timers[i].abort_cnt, - timers[i].expire_cnt); - TC_PRINT("\tavarage late:%d ticks, max late:%d, min late:%d early:%d\n", - timers[i].avg_late, timers[i].max_late, timers[i].min_late, - timers[i].early_cnt); - } - - for (size_t i = 0; i < ARRAY_SIZE(ctx_cnt); i++) { - TC_PRINT("Context: %s executed %d times\n", ctx_name[i], ctx_cnt[i]); - } - TC_PRINT("CPU load during test:%d.%d\n", load / 10, load % 10); - - if (busy_sim_en) { - busy_sim_stop(); - } - - if (counter_dev) { - counter_stop(counter_dev); - } -} - -ZTEST(nrf_grtc_timer, test_stress) -{ - grtc_stress_test(false); -} - ZTEST_SUITE(nrf_grtc_timer, NULL, NULL, NULL, NULL, NULL); diff --git a/tests/drivers/timer/nrf_grtc_timer/testcase.yaml b/tests/drivers/timer/nrf_grtc_timer/testcase.yaml index 57835bc386a5..cd4f99daede0 100644 --- a/tests/drivers/timer/nrf_grtc_timer/testcase.yaml +++ b/tests/drivers/timer/nrf_grtc_timer/testcase.yaml @@ -1,24 +1,21 @@ -common: - tags: - - drivers - platform_allow: - - nrf54l15dk/nrf54l15/cpuapp - - nrf54l15dk/nrf54l15/cpuflpr - - nrf54l15bsim/nrf54l15/cpuapp - - nrf54h20dk/nrf54h20/cpuapp - - nrf54h20dk/nrf54h20/cpurad - - nrf54h20dk/nrf54h20/cpuppr - - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - - nrf54l20pdk/nrf54l20/cpuflpr - - nrf54lm20dk/nrf54lm20a/cpuflpr - - ophelia4ev/nrf54l15/cpuapp - - ophelia4ev/nrf54l15/cpuflpr - integration_platforms: - - nrf54l15dk/nrf54l15/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp tests: - drivers.timer.nrf_grtc_timer: {} - drivers.timer.nrf_grtc_timer.no_assert: - extra_configs: - - CONFIG_ASSERT=n + drivers.timer.nrf_grtc_timer: + tags: drivers + platform_allow: + - nrf54l09pdk/nrf54l09/cpuapp + - nrf54l09pdk/nrf54l09/cpuflpr + - nrf54l15dk/nrf54l15/cpuapp + - nrf54l15dk/nrf54l15/cpuflpr + - nrf54l15bsim/nrf54l15/cpuapp + - nrf54h20dk/nrf54h20/cpuapp + - nrf54h20dk/nrf54h20/cpurad + - nrf54h20dk/nrf54h20/cpuppr + - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp + - nrf54l20pdk/nrf54l20/cpuflpr + - nrf54lm20dk/nrf54lm20a/cpuflpr + - ophelia4ev/nrf54l15/cpuapp + - ophelia4ev/nrf54l15/cpuflpr + integration_platforms: + - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp From 7d4dfc50f2e3be363f8bf2d171d8bfb60e211706 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Wed, 9 Jul 2025 13:04:55 +0200 Subject: [PATCH 0806/2141] [nrf fromtree] tests: drivers: timer: nrf_grtc_timer: Cleanup after nRF54LM20 rename MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove duplicated test configuration after nrf54l20pdk/nrf54l20/cpuxxx was renamed to nrf54lm20dk/nrf54lm20a/cpuxxx. Signed-off-by: Sebastian Głąb (cherry picked from commit afd90f42a2f6af48ab324a40fcd59d74385243bf) --- tests/drivers/timer/nrf_grtc_timer/testcase.yaml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tests/drivers/timer/nrf_grtc_timer/testcase.yaml b/tests/drivers/timer/nrf_grtc_timer/testcase.yaml index cd4f99daede0..8d01344c49cb 100644 --- a/tests/drivers/timer/nrf_grtc_timer/testcase.yaml +++ b/tests/drivers/timer/nrf_grtc_timer/testcase.yaml @@ -2,20 +2,18 @@ tests: drivers.timer.nrf_grtc_timer: tags: drivers platform_allow: + - nrf54h20dk/nrf54h20/cpuapp + - nrf54h20dk/nrf54h20/cpurad + - nrf54h20dk/nrf54h20/cpuppr - nrf54l09pdk/nrf54l09/cpuapp - nrf54l09pdk/nrf54l09/cpuflpr - nrf54l15dk/nrf54l15/cpuapp - nrf54l15dk/nrf54l15/cpuflpr - nrf54l15bsim/nrf54l15/cpuapp - - nrf54h20dk/nrf54h20/cpuapp - - nrf54h20dk/nrf54h20/cpurad - - nrf54h20dk/nrf54h20/cpuppr - - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - - nrf54l20pdk/nrf54l20/cpuflpr - nrf54lm20dk/nrf54lm20a/cpuflpr - ophelia4ev/nrf54l15/cpuapp - ophelia4ev/nrf54l15/cpuflpr integration_platforms: - - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp + timeout: 30 From 1a0a42e035ad8e04b0e49aca92f0a3c19e9e2f60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Wed, 23 Jul 2025 09:17:29 +0200 Subject: [PATCH 0807/2141] [nrf fromtree] tests: Remove nrf54l09pdk from supported boards MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove possibility to run tests on nrf54l09pdk as this is an obsolete board that is going to be removed. Signed-off-by: Sebastian Głąb (cherry picked from commit d673851ec82b012a5795d6a16b718dc1b22c8281) --- .../boards/nrf54l09pdk_nrf54l09_cpuapp.conf | 1 - .../clock_control_api/testcase.yaml | 2 - .../nrf_clock_calibration/testcase.yaml | 1 - .../nrf_lf_clock_start/testcase.yaml | 8 -- .../drivers/clock_control/onoff/testcase.yaml | 1 - .../nrf54l09pdk_nrf54l09_cpuapp.overlay | 34 -------- .../boards/nrf54l09pdk_nrf54l09_cpuapp.conf | 4 - tests/drivers/flash/common/testcase.yaml | 1 - .../flash/negative_tests/testcase.yaml | 1 - .../nrf54l09pdk_nrf54l09_common.overlay | 21 ----- .../nrf54l09pdk_nrf54l09_cpuapp.overlay | 7 -- .../nrf54l09pdk_nrf54l09_cpuflpr.overlay | 7 -- .../boards/nrf54l09pdk_nrf54l09_cpuapp.conf | 1 - .../nrf54l09pdk_nrf54l09_cpuapp.overlay | 22 ----- tests/drivers/retained_mem/api/testcase.yaml | 1 - .../nrf54l09pdk_nrf54l09_cpuapp.overlay | 9 -- .../nrf54l09pdk_nrf54l09_cpuapp.overlay | 47 ---------- .../timer/nrf_grtc_timer/testcase.yaml | 2 - .../nrf54l09pdk_nrf54l09_cpuapp.overlay | 26 ------ .../nrf54l09pdk_nrf54l09_cpuapp.overlay | 31 ------- .../nrf54l09pdk_nrf54l09_cpuflpr.overlay | 31 ------- .../nrf54l09pdk_nrf54l09_dual_uart.overlay | 85 ------------------- .../uart/uart_elementary/testcase.yaml | 10 --- .../nrf54l09pdk_nrf54l09_cpuapp.overlay | 43 ---------- .../uart/uart_mix_fifo_poll/testcase.yaml | 1 - .../nrf54l09pdk_nrf54l09_cpuapp.overlay | 36 -------- tests/drivers/uart/uart_pm/testcase.yaml | 5 -- .../nrf54l09pdk_nrf54l09_cpuapp.overlay | 9 -- .../nrf54l09pdk_nrf54l09_cpuflpr.overlay | 9 -- .../nrf54l09pdk_nrf54l09_cpuapp.overlay | 9 -- .../watchdog/wdt_error_cases/testcase.yaml | 1 - .../nrf54l09pdk_nrf54l09_cpuapp.overlay | 9 -- .../watchdog/wdt_variables/testcase.yaml | 1 - .../boards/nrf54l09pdk_nrf54l09_cpuapp.conf | 1 - tests/subsys/fs/fcb/testcase.yaml | 3 +- .../storage/stream/stream_flash/testcase.yaml | 1 - 36 files changed, 1 insertion(+), 480 deletions(-) delete mode 100644 tests/drivers/clock_control/clock_control_api/boards/nrf54l09pdk_nrf54l09_cpuapp.conf delete mode 100644 tests/drivers/counter/counter_basic_api/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay delete mode 100644 tests/drivers/flash/common/boards/nrf54l09pdk_nrf54l09_cpuapp.conf delete mode 100644 tests/drivers/gpio/gpio_basic_api/boards/nrf54l09pdk_nrf54l09_common.overlay delete mode 100644 tests/drivers/gpio/gpio_basic_api/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay delete mode 100644 tests/drivers/gpio/gpio_basic_api/boards/nrf54l09pdk_nrf54l09_cpuflpr.overlay delete mode 100644 tests/drivers/retained_mem/api/boards/nrf54l09pdk_nrf54l09_cpuapp.conf delete mode 100644 tests/drivers/retained_mem/api/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay delete mode 100644 tests/drivers/sensor/temp_sensor/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay delete mode 100644 tests/drivers/spi/spi_loopback/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay delete mode 100644 tests/drivers/uart/uart_async_api/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay delete mode 100644 tests/drivers/uart/uart_elementary/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay delete mode 100644 tests/drivers/uart/uart_elementary/boards/nrf54l09pdk_nrf54l09_cpuflpr.overlay delete mode 100644 tests/drivers/uart/uart_elementary/boards/nrf54l09pdk_nrf54l09_dual_uart.overlay delete mode 100644 tests/drivers/uart/uart_mix_fifo_poll/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay delete mode 100644 tests/drivers/uart/uart_pm/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay delete mode 100644 tests/drivers/watchdog/wdt_basic_api/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay delete mode 100644 tests/drivers/watchdog/wdt_basic_api/boards/nrf54l09pdk_nrf54l09_cpuflpr.overlay delete mode 100644 tests/drivers/watchdog/wdt_error_cases/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay delete mode 100644 tests/drivers/watchdog/wdt_variables/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay delete mode 100644 tests/kernel/timer/timer_behavior/boards/nrf54l09pdk_nrf54l09_cpuapp.conf diff --git a/tests/drivers/clock_control/clock_control_api/boards/nrf54l09pdk_nrf54l09_cpuapp.conf b/tests/drivers/clock_control/clock_control_api/boards/nrf54l09pdk_nrf54l09_cpuapp.conf deleted file mode 100644 index 11d42321cbc3..000000000000 --- a/tests/drivers/clock_control/clock_control_api/boards/nrf54l09pdk_nrf54l09_cpuapp.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_TEST_NRF_HF_STARTUP_TIME_US=1000 diff --git a/tests/drivers/clock_control/clock_control_api/testcase.yaml b/tests/drivers/clock_control/clock_control_api/testcase.yaml index 4a192e5e3a72..4578b4282827 100644 --- a/tests/drivers/clock_control/clock_control_api/testcase.yaml +++ b/tests/drivers/clock_control/clock_control_api/testcase.yaml @@ -21,7 +21,6 @@ tests: - nrf52dk/nrf52832 - nrf52840dk/nrf52840 - nrf9160dk/nrf9160 - - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp @@ -32,7 +31,6 @@ tests: - nrf51dk/nrf51822 - nrf52dk/nrf52832 - nrf52840dk/nrf52840 - - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp diff --git a/tests/drivers/clock_control/nrf_clock_calibration/testcase.yaml b/tests/drivers/clock_control/nrf_clock_calibration/testcase.yaml index 4600202f0f1b..708e563900c2 100644 --- a/tests/drivers/clock_control/nrf_clock_calibration/testcase.yaml +++ b/tests/drivers/clock_control/nrf_clock_calibration/testcase.yaml @@ -8,7 +8,6 @@ tests: - nrf51dk/nrf51822 - nrf52dk/nrf52832 - nrf52840dk/nrf52840 - - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp diff --git a/tests/drivers/clock_control/nrf_lf_clock_start/testcase.yaml b/tests/drivers/clock_control/nrf_lf_clock_start/testcase.yaml index 0b1f9ae3c931..17a783a48084 100644 --- a/tests/drivers/clock_control/nrf_lf_clock_start/testcase.yaml +++ b/tests/drivers/clock_control/nrf_lf_clock_start/testcase.yaml @@ -14,7 +14,6 @@ tests: - nrf9160dk/nrf9160 - nrf5340dk/nrf5340/cpuapp - nrf5340dk/nrf5340/cpunet - - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp @@ -32,7 +31,6 @@ tests: - nrf9160dk/nrf9160 - nrf5340dk/nrf5340/cpuapp - nrf5340dk/nrf5340/cpunet - - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp @@ -66,7 +64,6 @@ tests: - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp - nrf5340dk/nrf5340/cpunet - - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp @@ -83,7 +80,6 @@ tests: - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp - nrf5340dk/nrf5340/cpunet - - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp @@ -100,7 +96,6 @@ tests: - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp - nrf5340dk/nrf5340/cpunet - - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp @@ -117,7 +112,6 @@ tests: - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp - nrf5340dk/nrf5340/cpunet - - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp @@ -134,7 +128,6 @@ tests: - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp - nrf5340dk/nrf5340/cpunet - - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp @@ -151,7 +144,6 @@ tests: - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp - nrf5340dk/nrf5340/cpunet - - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp diff --git a/tests/drivers/clock_control/onoff/testcase.yaml b/tests/drivers/clock_control/onoff/testcase.yaml index c26eeca5e3d1..1f557c918ab8 100644 --- a/tests/drivers/clock_control/onoff/testcase.yaml +++ b/tests/drivers/clock_control/onoff/testcase.yaml @@ -7,7 +7,6 @@ tests: - nrf51dk/nrf51822 - nrf52dk/nrf52832 - nrf52840dk/nrf52840 - - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - nrf9160dk/nrf9160 diff --git a/tests/drivers/counter/counter_basic_api/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay b/tests/drivers/counter/counter_basic_api/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay deleted file mode 100644 index 54b47926164d..000000000000 --- a/tests/drivers/counter/counter_basic_api/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay +++ /dev/null @@ -1,34 +0,0 @@ -&timer00 { - prescaler = <6>; - status = "okay"; -}; - -&timer10 { - prescaler = <4>; - status = "okay"; -}; - -&timer20 { - prescaler = <4>; - status = "okay"; -}; - -&timer21 { - prescaler = <4>; - status = "okay"; -}; - -&timer22 { - prescaler = <4>; - status = "okay"; -}; - -&timer23 { - prescaler = <4>; - status = "okay"; -}; - -&timer24 { - prescaler = <4>; - status = "okay"; -}; diff --git a/tests/drivers/flash/common/boards/nrf54l09pdk_nrf54l09_cpuapp.conf b/tests/drivers/flash/common/boards/nrf54l09pdk_nrf54l09_cpuapp.conf deleted file mode 100644 index 821a5e77e5b5..000000000000 --- a/tests/drivers/flash/common/boards/nrf54l09pdk_nrf54l09_cpuapp.conf +++ /dev/null @@ -1,4 +0,0 @@ -CONFIG_FCB=y -CONFIG_FLASH_MAP=y -CONFIG_SETTINGS=y -CONFIG_SETTINGS_FCB=y diff --git a/tests/drivers/flash/common/testcase.yaml b/tests/drivers/flash/common/testcase.yaml index 0a35ec04cd95..a4e2ac0632ed 100644 --- a/tests/drivers/flash/common/testcase.yaml +++ b/tests/drivers/flash/common/testcase.yaml @@ -45,7 +45,6 @@ tests: drivers.flash.common.no_explicit_erase: platform_allow: - nrf54l15dk/nrf54l05/cpuapp - - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l10/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54h20dk/nrf54h20/cpuapp diff --git a/tests/drivers/flash/negative_tests/testcase.yaml b/tests/drivers/flash/negative_tests/testcase.yaml index 7a55212aa3f5..7a96f4e65e54 100644 --- a/tests/drivers/flash/negative_tests/testcase.yaml +++ b/tests/drivers/flash/negative_tests/testcase.yaml @@ -6,7 +6,6 @@ tests: drivers.flash.negative_tests: platform_allow: - nrf54h20dk/nrf54h20/cpuapp - - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp diff --git a/tests/drivers/gpio/gpio_basic_api/boards/nrf54l09pdk_nrf54l09_common.overlay b/tests/drivers/gpio/gpio_basic_api/boards/nrf54l09pdk_nrf54l09_common.overlay deleted file mode 100644 index 8eb1b3c9f9ff..000000000000 --- a/tests/drivers/gpio/gpio_basic_api/boards/nrf54l09pdk_nrf54l09_common.overlay +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - resources { - compatible = "test-gpio-basic-api"; - out-gpios = <&gpio1 10 0>; - in-gpios = <&gpio1 11 0>; - }; -}; - -&gpiote20 { - status = "okay"; -}; - -&gpio1 { - status = "okay"; -}; diff --git a/tests/drivers/gpio/gpio_basic_api/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay b/tests/drivers/gpio/gpio_basic_api/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay deleted file mode 100644 index 7eee797278b6..000000000000 --- a/tests/drivers/gpio/gpio_basic_api/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay +++ /dev/null @@ -1,7 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include "nrf54l09pdk_nrf54l09_common.overlay" diff --git a/tests/drivers/gpio/gpio_basic_api/boards/nrf54l09pdk_nrf54l09_cpuflpr.overlay b/tests/drivers/gpio/gpio_basic_api/boards/nrf54l09pdk_nrf54l09_cpuflpr.overlay deleted file mode 100644 index b0c42fd3d2ac..000000000000 --- a/tests/drivers/gpio/gpio_basic_api/boards/nrf54l09pdk_nrf54l09_cpuflpr.overlay +++ /dev/null @@ -1,7 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include "nrf54l09pdk_nrf54l09_common.overlay" diff --git a/tests/drivers/retained_mem/api/boards/nrf54l09pdk_nrf54l09_cpuapp.conf b/tests/drivers/retained_mem/api/boards/nrf54l09pdk_nrf54l09_cpuapp.conf deleted file mode 100644 index c15ba3ed96da..000000000000 --- a/tests/drivers/retained_mem/api/boards/nrf54l09pdk_nrf54l09_cpuapp.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_POWEROFF=y diff --git a/tests/drivers/retained_mem/api/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay b/tests/drivers/retained_mem/api/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay deleted file mode 100644 index e304ecbbfb13..000000000000 --- a/tests/drivers/retained_mem/api/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay +++ /dev/null @@ -1,22 +0,0 @@ -/ { - cpuapp_sram@2002e000 { - compatible = "zephyr,memory-region", "mmio-sram"; - reg = <0x2002e000 DT_SIZE_K(4)>; - zephyr,memory-region = "RetainedMem"; - status = "okay"; - - retainedmem0: retainedmem { - compatible = "zephyr,retained-ram"; - status = "okay"; - }; - }; - - aliases { - retainedmemtestdevice = &retainedmem0; - }; -}; - -&cpuapp_sram { - reg = <0x20000000 DT_SIZE_K(184)>; - ranges = <0x0 0x20000000 0x2e000>; -}; diff --git a/tests/drivers/retained_mem/api/testcase.yaml b/tests/drivers/retained_mem/api/testcase.yaml index 88bd6ae16ff4..e89ef3953710 100644 --- a/tests/drivers/retained_mem/api/testcase.yaml +++ b/tests/drivers/retained_mem/api/testcase.yaml @@ -10,7 +10,6 @@ tests: - nrf5340dk/nrf5340/cpuapp - nrf54h20dk/nrf54h20/cpuapp - nrf54h20dk/nrf54h20/cpurad - - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l05/cpuapp - nrf54l15dk/nrf54l10/cpuapp - nrf54l15dk/nrf54l15/cpuapp diff --git a/tests/drivers/sensor/temp_sensor/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay b/tests/drivers/sensor/temp_sensor/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay deleted file mode 100644 index b1f2a2b9ec59..000000000000 --- a/tests/drivers/sensor/temp_sensor/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -temp_sensor: &temp { - status = "okay"; -}; diff --git a/tests/drivers/spi/spi_loopback/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay b/tests/drivers/spi/spi_loopback/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay deleted file mode 100644 index cdb0d0dbcecb..000000000000 --- a/tests/drivers/spi/spi_loopback/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&pinctrl { - spi21_default: spi21_default { - group1 { - psels = , - , - ; - }; - }; - - spi21_sleep: spi21_sleep { - group1 { - psels = , - , - ; - low-power-enable; - }; - }; -}; - -&spi21 { - status = "okay"; - pinctrl-0 = <&spi21_default>; - pinctrl-1 = <&spi21_sleep>; - pinctrl-names = "default", "sleep"; - overrun-character = <0x00>; - zephyr,pm-device-runtime-auto; - slow@0 { - compatible = "test-spi-loopback-slow"; - reg = <0>; - spi-max-frequency = ; - }; - fast@0 { - compatible = "test-spi-loopback-fast"; - reg = <0>; - spi-max-frequency = ; - }; -}; - -&gpio1 { - status = "okay"; -}; diff --git a/tests/drivers/timer/nrf_grtc_timer/testcase.yaml b/tests/drivers/timer/nrf_grtc_timer/testcase.yaml index 8d01344c49cb..6f4486de913c 100644 --- a/tests/drivers/timer/nrf_grtc_timer/testcase.yaml +++ b/tests/drivers/timer/nrf_grtc_timer/testcase.yaml @@ -5,8 +5,6 @@ tests: - nrf54h20dk/nrf54h20/cpuapp - nrf54h20dk/nrf54h20/cpurad - nrf54h20dk/nrf54h20/cpuppr - - nrf54l09pdk/nrf54l09/cpuapp - - nrf54l09pdk/nrf54l09/cpuflpr - nrf54l15dk/nrf54l15/cpuapp - nrf54l15dk/nrf54l15/cpuflpr - nrf54l15bsim/nrf54l15/cpuapp diff --git a/tests/drivers/uart/uart_async_api/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay b/tests/drivers/uart/uart_async_api/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay deleted file mode 100644 index ed4a2de1891c..000000000000 --- a/tests/drivers/uart/uart_async_api/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay +++ /dev/null @@ -1,26 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - -&pinctrl { - uart21_default_alt: uart21_default_alt { - group1 { - psels = , - ; - }; - }; - - uart21_sleep_alt: uart21_sleep_alt { - group1 { - psels = , - ; - low-power-enable; - }; - }; -}; - -dut: &uart21 { - status = "okay"; - pinctrl-0 = <&uart21_default_alt>; - pinctrl-1 = <&uart21_sleep_alt>; - pinctrl-names = "default", "sleep"; - current-speed = <115200>; -}; diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay b/tests/drivers/uart/uart_elementary/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay deleted file mode 100644 index cf481b7a1614..000000000000 --- a/tests/drivers/uart/uart_elementary/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay +++ /dev/null @@ -1,31 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - -&pinctrl { - uart21_default: uart21_default { - group1 { - psels = , - , - , - ; - }; - }; - - uart21_sleep: uart21_sleep { - group1 { - psels = , - , - , - ; - low-power-enable; - }; - }; -}; - -dut: &uart21 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart21_default>; - pinctrl-1 = <&uart21_sleep>; - pinctrl-names = "default", "sleep"; - hw-flow-control; -}; diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54l09pdk_nrf54l09_cpuflpr.overlay b/tests/drivers/uart/uart_elementary/boards/nrf54l09pdk_nrf54l09_cpuflpr.overlay deleted file mode 100644 index cf481b7a1614..000000000000 --- a/tests/drivers/uart/uart_elementary/boards/nrf54l09pdk_nrf54l09_cpuflpr.overlay +++ /dev/null @@ -1,31 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - -&pinctrl { - uart21_default: uart21_default { - group1 { - psels = , - , - , - ; - }; - }; - - uart21_sleep: uart21_sleep { - group1 { - psels = , - , - , - ; - low-power-enable; - }; - }; -}; - -dut: &uart21 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart21_default>; - pinctrl-1 = <&uart21_sleep>; - pinctrl-names = "default", "sleep"; - hw-flow-control; -}; diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54l09pdk_nrf54l09_dual_uart.overlay b/tests/drivers/uart/uart_elementary/boards/nrf54l09pdk_nrf54l09_dual_uart.overlay deleted file mode 100644 index 505993a73087..000000000000 --- a/tests/drivers/uart/uart_elementary/boards/nrf54l09pdk_nrf54l09_dual_uart.overlay +++ /dev/null @@ -1,85 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - -/ { - chosen { - zephyr,console = &uart30; - zephyr,shell-uart = &uart30; - }; -}; - -&pinctrl { - uart20_default: uart20_default { - group1 { - psels = , - ; - bias-pull-up; - }; - }; - - uart20_sleep: uart20_sleep { - group1 { - psels = , - ; - low-power-enable; - }; - }; - - uart21_default: uart21_default { - group1 { - psels = , - ; - bias-pull-up; - }; - }; - - uart21_sleep: uart21_sleep { - group1 { - psels = , - ; - low-power-enable; - }; - }; - - uart30_default: uart30_default { - group1 { - psels = ; - }; - group2 { - psels = ; - bias-pull-up; - }; - }; - - uart30_sleep: uart30_sleep { - group1 { - psels = , - ; - low-power-enable; - }; - }; -}; - - -&uart30 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart30_default>; - pinctrl-1 = <&uart30_sleep>; - pinctrl-names = "default", "sleep"; -}; - -dut: &uart20 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart20_default>; - pinctrl-1 = <&uart20_sleep>; - pinctrl-names = "default", "sleep"; -}; - -dut_aux: &uart21 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart21_default>; - pinctrl-1 = <&uart21_sleep>; - pinctrl-names = "default", "sleep"; -}; diff --git a/tests/drivers/uart/uart_elementary/testcase.yaml b/tests/drivers/uart/uart_elementary/testcase.yaml index 7afdc874269d..cbf222fa72cf 100644 --- a/tests/drivers/uart/uart_elementary/testcase.yaml +++ b/tests/drivers/uart/uart_elementary/testcase.yaml @@ -11,8 +11,6 @@ tests: filter: CONFIG_SERIAL_SUPPORT_INTERRUPT platform_allow: - nrf54h20dk/nrf54h20/cpuapp - - nrf54l09pdk/nrf54l09/cpuapp - - nrf54l09pdk/nrf54l09/cpuflpr - nrf54l15dk/nrf54l15/cpuapp - nrf54l15dk/nrf54l15/cpuflpr - nrf54lm20dk/nrf54lm20a/cpuapp @@ -55,8 +53,6 @@ tests: drivers.uart.uart_elementary_dual_nrf54l: filter: CONFIG_SERIAL_SUPPORT_INTERRUPT platform_allow: - - nrf54l09pdk/nrf54l09/cpuapp - - nrf54l09pdk/nrf54l09/cpuflpr - nrf54l15dk/nrf54l15/cpuapp - nrf54l15dk/nrf54l15/cpuflpr - nrf54lm20dk/nrf54lm20a/cpuapp @@ -64,8 +60,6 @@ tests: - ophelia4ev/nrf54l15/cpuapp - ophelia4ev/nrf54l15/cpuflpr extra_args: - - platform:nrf54l09pdk/nrf54l09/cpuapp:"DTC_OVERLAY_FILE=boards/nrf54l09pdk_nrf54l09_dual_uart.overlay" - - platform:nrf54l09pdk/nrf54l09/cpuflpr:"DTC_OVERLAY_FILE=boards/nrf54l09pdk_nrf54l09_dual_uart.overlay" - platform:nrf54l15dk/nrf54l15/cpuapp:"DTC_OVERLAY_FILE=boards/nrf54l15dk_nrf54l15_dual_uart.overlay" - platform:nrf54l15dk/nrf54l15/cpuflpr:"DTC_OVERLAY_FILE=boards/nrf54l15dk_nrf54l15_dual_uart.overlay" - platform:nrf54lm20dk/nrf54lm20a/cpuapp:"DTC_OVERLAY_FILE=boards/nrf54lm20dk_nrf54lm20a_dual_uart.overlay" @@ -77,8 +71,6 @@ tests: drivers.uart.uart_elementary_dual_setup_mismatch_nrf54l: filter: CONFIG_SERIAL_SUPPORT_INTERRUPT platform_allow: - - nrf54l09pdk/nrf54l09/cpuapp - - nrf54l09pdk/nrf54l09/cpuflpr - nrf54l15dk/nrf54l15/cpuapp - nrf54l15dk/nrf54l15/cpuflpr - nrf54lm20dk/nrf54lm20a/cpuapp @@ -86,8 +78,6 @@ tests: - ophelia4ev/nrf54l15/cpuapp - ophelia4ev/nrf54l15/cpuflpr extra_args: - - platform:nrf54l09pdk/nrf54l09/cpuapp:"DTC_OVERLAY_FILE=boards/nrf54l09pdk_nrf54l09_dual_uart.overlay" - - platform:nrf54l09pdk/nrf54l09/cpuflpr:"DTC_OVERLAY_FILE=boards/nrf54l09pdk_nrf54l09_dual_uart.overlay" - platform:nrf54l15dk/nrf54l15/cpuapp:"DTC_OVERLAY_FILE=boards/nrf54l15dk_nrf54l15_dual_uart.overlay" - platform:nrf54l15dk/nrf54l15/cpuflpr:"DTC_OVERLAY_FILE=boards/nrf54l15dk_nrf54l15_dual_uart.overlay" - platform:nrf54lm20dk/nrf54lm20a/cpuapp:"DTC_OVERLAY_FILE=boards/nrf54lm20dk_nrf54lm20a_dual_uart.overlay" diff --git a/tests/drivers/uart/uart_mix_fifo_poll/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay b/tests/drivers/uart/uart_mix_fifo_poll/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay deleted file mode 100644 index 945b8628e7a6..000000000000 --- a/tests/drivers/uart/uart_mix_fifo_poll/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&pinctrl { - uart21_default: uart21_default { - group1 { - psels = , - , - , - ; - }; - }; - - uart21_sleep: uart21_sleep { - group1 { - psels = , - , - , - ; - low-power-enable; - }; - }; -}; - -dut: &uart21 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart21_default>; - pinctrl-1 = <&uart21_sleep>; - pinctrl-names = "default", "sleep"; - hw-flow-control; -}; - -counter_dev: &timer00 { - status = "okay"; -}; - -&grtc { - interrupts = <228 2>; -}; diff --git a/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml b/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml index fee2d1f46463..0ba5944cca66 100644 --- a/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml +++ b/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml @@ -12,7 +12,6 @@ common: - nrf5340bsim/nrf5340/cpuapp - nrf54h20dk/nrf54h20/cpuapp - nrf54h20dk/nrf54h20/cpurad - - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l15bsim/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp diff --git a/tests/drivers/uart/uart_pm/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay b/tests/drivers/uart/uart_pm/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay deleted file mode 100644 index 033aab401ac0..000000000000 --- a/tests/drivers/uart/uart_pm/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&pinctrl { - uart21_default: uart21_default { - group1 { - psels = , - ; - }; - }; - - uart21_sleep: uart21_sleep { - group1 { - psels = , - ; - low-power-enable; - }; - }; -}; - -/ { - chosen { - zephyr,console = &uart20; - }; -}; - -dut: &uart21 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart21_default>; - pinctrl-1 = <&uart21_sleep>; - pinctrl-names = "default", "sleep"; -}; diff --git a/tests/drivers/uart/uart_pm/testcase.yaml b/tests/drivers/uart/uart_pm/testcase.yaml index d775e30ae71d..008eae9d3d7f 100644 --- a/tests/drivers/uart/uart_pm/testcase.yaml +++ b/tests/drivers/uart/uart_pm/testcase.yaml @@ -8,7 +8,6 @@ common: - nrf52840dk/nrf52840 - nrf5340bsim/nrf5340/cpuapp - nrf54h20dk/nrf54h20/cpuapp - - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l15bsim/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp @@ -36,7 +35,6 @@ tests: - nrf52_bsim - nrf5340bsim/nrf5340/cpuapp - nrf54h20dk/nrf54h20/cpuapp - - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l15bsim/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp @@ -50,7 +48,6 @@ tests: - CONFIG_UART_0_ENHANCED_POLL_OUT=y platform_exclude: - nrf54h20dk/nrf54h20/cpuapp - - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp @@ -70,7 +67,6 @@ tests: - CONFIG_UART_0_ENHANCED_POLL_OUT=y platform_exclude: - nrf54h20dk/nrf54h20/cpuapp - - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp @@ -96,7 +92,6 @@ tests: - CONFIG_UART_0_ENHANCED_POLL_OUT=y platform_exclude: - nrf54h20dk/nrf54h20/cpuapp - - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp diff --git a/tests/drivers/watchdog/wdt_basic_api/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay b/tests/drivers/watchdog/wdt_basic_api/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay deleted file mode 100644 index dc1ea1a9ddc9..000000000000 --- a/tests/drivers/watchdog/wdt_basic_api/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&wdt31 { - status = "okay"; -}; diff --git a/tests/drivers/watchdog/wdt_basic_api/boards/nrf54l09pdk_nrf54l09_cpuflpr.overlay b/tests/drivers/watchdog/wdt_basic_api/boards/nrf54l09pdk_nrf54l09_cpuflpr.overlay deleted file mode 100644 index dc1ea1a9ddc9..000000000000 --- a/tests/drivers/watchdog/wdt_basic_api/boards/nrf54l09pdk_nrf54l09_cpuflpr.overlay +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&wdt31 { - status = "okay"; -}; diff --git a/tests/drivers/watchdog/wdt_error_cases/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay b/tests/drivers/watchdog/wdt_error_cases/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay deleted file mode 100644 index 8d3dce3b3800..000000000000 --- a/tests/drivers/watchdog/wdt_error_cases/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&wdt31 { - status = "okay"; -}; diff --git a/tests/drivers/watchdog/wdt_error_cases/testcase.yaml b/tests/drivers/watchdog/wdt_error_cases/testcase.yaml index f8da32ca72de..438b59e92717 100644 --- a/tests/drivers/watchdog/wdt_error_cases/testcase.yaml +++ b/tests/drivers/watchdog/wdt_error_cases/testcase.yaml @@ -9,7 +9,6 @@ tests: drivers.watchdog.wdt_error_cases: platform_allow: - nrf5340dk/nrf5340/cpuapp - - nrf54l09pdk/nrf54l09/cpuapp - nrf54h20dk/nrf54h20/cpuapp - nrf54h20dk/nrf54h20/cpurad - nrf54l15dk/nrf54l15/cpuapp diff --git a/tests/drivers/watchdog/wdt_variables/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay b/tests/drivers/watchdog/wdt_variables/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay deleted file mode 100644 index dc1ea1a9ddc9..000000000000 --- a/tests/drivers/watchdog/wdt_variables/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&wdt31 { - status = "okay"; -}; diff --git a/tests/drivers/watchdog/wdt_variables/testcase.yaml b/tests/drivers/watchdog/wdt_variables/testcase.yaml index b504cb5b6b8d..434081c499fa 100644 --- a/tests/drivers/watchdog/wdt_variables/testcase.yaml +++ b/tests/drivers/watchdog/wdt_variables/testcase.yaml @@ -14,7 +14,6 @@ tests: platform_allow: - nrf54h20dk/nrf54h20/cpuapp - nrf54h20dk/nrf54h20/cpuppr - - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - nrf54lm20dk/nrf54lm20a/cpuflpr diff --git a/tests/kernel/timer/timer_behavior/boards/nrf54l09pdk_nrf54l09_cpuapp.conf b/tests/kernel/timer/timer_behavior/boards/nrf54l09pdk_nrf54l09_cpuapp.conf deleted file mode 100644 index 4b13bc80c7f3..000000000000 --- a/tests/kernel/timer/timer_behavior/boards/nrf54l09pdk_nrf54l09_cpuapp.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_SYS_CLOCK_TICKS_PER_SEC=10000 diff --git a/tests/subsys/fs/fcb/testcase.yaml b/tests/subsys/fs/fcb/testcase.yaml index c915dd56840b..572a8fe49a75 100644 --- a/tests/subsys/fs/fcb/testcase.yaml +++ b/tests/subsys/fs/fcb/testcase.yaml @@ -12,13 +12,12 @@ tests: - native_sim filesystem.fcb.no_erase: platform_allow: - - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp - native_sim integration_platforms: - - nrf54l09pdk/nrf54l09/cpuapp + - nrf54l15dk/nrf54l15/cpuapp - native_sim filesystem.fcb.native_sim.no_erase: extra_args: CONFIG_FLASH_SIMULATOR_EXPLICIT_ERASE=n diff --git a/tests/subsys/storage/stream/stream_flash/testcase.yaml b/tests/subsys/storage/stream/stream_flash/testcase.yaml index 3dc0a660f2f9..bd53b4438a9e 100644 --- a/tests/subsys/storage/stream/stream_flash/testcase.yaml +++ b/tests/subsys/storage/stream/stream_flash/testcase.yaml @@ -22,7 +22,6 @@ tests: # common platforms could bring them here too so filter these out. filter: not dt_compat_enabled("zephyr,sim-flash") platform_allow: - - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - ophelia4ev/nrf54l15/cpuapp extra_configs: From 0af05cc663896310c0c891322debf4c5519ef17d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Mon, 19 May 2025 15:42:20 +0200 Subject: [PATCH 0808/2141] [nrf fromlist] tests: drivers: timer: nrf_grtc_timer: Add stress test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add stress test that randomly starts and aborts multiple timers from various contexts. Test checks if timers do not expire prematurely. Upstream PR #: 87944 Signed-off-by: Krzysztof Chruściński --- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 17 ++ .../boards/nrf54l15dk_nrf54l15_cpuapp.overlay | 32 +++ .../nrf54l15dk_nrf54l15_cpuflpr.overlay | 32 +++ tests/drivers/timer/nrf_grtc_timer/prj.conf | 6 + tests/drivers/timer/nrf_grtc_timer/src/main.c | 247 ++++++++++++++++++ .../timer/nrf_grtc_timer/testcase.yaml | 37 +-- 6 files changed, 355 insertions(+), 16 deletions(-) create mode 100644 tests/drivers/timer/nrf_grtc_timer/boards/nrf54l15dk_nrf54l15_cpuapp.overlay create mode 100644 tests/drivers/timer/nrf_grtc_timer/boards/nrf54l15dk_nrf54l15_cpuflpr.overlay diff --git a/tests/drivers/timer/nrf_grtc_timer/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/timer/nrf_grtc_timer/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index 04580b71480b..7ae959267039 100644 --- a/tests/drivers/timer/nrf_grtc_timer/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/tests/drivers/timer/nrf_grtc_timer/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -2,4 +2,21 @@ &grtc { /delete-property/ child-owned-channels; + interrupts = <109 2>; +}; + +test_timer: &timer131 { + status = "okay"; + interrupts = <419 1>; +}; + +&timer130 { + status = "okay"; + prescaler = <0>; +}; + +/ { + chosen { + zephyr,cpu-load-counter = &timer130; + }; }; diff --git a/tests/drivers/timer/nrf_grtc_timer/boards/nrf54l15dk_nrf54l15_cpuapp.overlay b/tests/drivers/timer/nrf_grtc_timer/boards/nrf54l15dk_nrf54l15_cpuapp.overlay new file mode 100644 index 000000000000..7bcede529b0e --- /dev/null +++ b/tests/drivers/timer/nrf_grtc_timer/boards/nrf54l15dk_nrf54l15_cpuapp.overlay @@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +&grtc { + interrupts = <228 2>; +}; + +test_timer: &timer21 { + status = "okay"; + interrupts = <203 1>; +}; + +&timer20 { + status = "okay"; + interrupts = <202 0>; +}; + +&timer00 { + status = "okay"; + prescaler = <0>; +}; + +/ { + chosen { + zephyr,cpu-load-counter = &timer00; + }; + + busy-sim { + compatible = "vnd,busy-sim"; + status = "okay"; + counter = <&timer20>; + }; +}; diff --git a/tests/drivers/timer/nrf_grtc_timer/boards/nrf54l15dk_nrf54l15_cpuflpr.overlay b/tests/drivers/timer/nrf_grtc_timer/boards/nrf54l15dk_nrf54l15_cpuflpr.overlay new file mode 100644 index 000000000000..cfa72ed02736 --- /dev/null +++ b/tests/drivers/timer/nrf_grtc_timer/boards/nrf54l15dk_nrf54l15_cpuflpr.overlay @@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +&grtc { + /*interrupts = <226 2>;*/ +}; + +test_timer: &timer21 { + status = "okay"; + /*interrupts = <203 2>;*/ +}; + +&timer20 { + status = "okay"; + interrupts = <202 0>; +}; + +&timer00 { + status = "okay"; + prescaler = <0>; +}; + +/ { + chosen { + zephyr,cpu-load-counter = &timer00; + }; + + busy-sim { + compatible = "vnd,busy-sim"; + status = "okay"; + counter = <&timer20>; + }; +}; diff --git a/tests/drivers/timer/nrf_grtc_timer/prj.conf b/tests/drivers/timer/nrf_grtc_timer/prj.conf index dea03477519d..93926f090b7e 100644 --- a/tests/drivers/timer/nrf_grtc_timer/prj.conf +++ b/tests/drivers/timer/nrf_grtc_timer/prj.conf @@ -1,2 +1,8 @@ CONFIG_ZTEST=y CONFIG_NRF_GRTC_TIMER=y +CONFIG_COUNTER=y +CONFIG_TEST_RANDOM_GENERATOR=y +CONFIG_XOSHIRO_RANDOM_GENERATOR=y +CONFIG_LOG_PRINTK=y +CONFIG_CPU_LOAD=y +CONFIG_CPU_LOAD_USE_COUNTER=y diff --git a/tests/drivers/timer/nrf_grtc_timer/src/main.c b/tests/drivers/timer/nrf_grtc_timer/src/main.c index cede54f026f1..e411eba83a0b 100644 --- a/tests/drivers/timer/nrf_grtc_timer/src/main.c +++ b/tests/drivers/timer/nrf_grtc_timer/src/main.c @@ -5,7 +5,15 @@ */ #include #include +#include +#include +#include +#include +#include +#include +#include #include +LOG_MODULE_REGISTER(test, 1); #define GRTC_SLEW_TICKS 10 #define NUMBER_OF_TRIES 2000 @@ -153,4 +161,243 @@ ZTEST(nrf_grtc_timer, test_timer_abort_in_compare_mode) z_nrf_grtc_timer_chan_free(channel); } +enum test_timer_state { + TIMER_IDLE, + TIMER_PREPARE, + TIMER_ACTIVE +}; + +enum test_ctx { + TEST_HIGH_PRI, + TEST_TIMER_CB, + TEST_THREAD +}; + +struct test_grtc_timer { + struct k_timer timer; + uint32_t ticks; + uint32_t expire; + uint32_t start_cnt; + uint32_t expire_cnt; + uint32_t abort_cnt; + uint32_t exp_expire; + int max_late; + int min_late; + int avg_late; + uint32_t early_cnt; + enum test_timer_state state; +}; + +static atomic_t test_active_cnt; +static struct test_grtc_timer timers[8]; +static uint32_t test_end; +static k_tid_t test_tid; +static volatile bool test_run; +static uint32_t ctx_cnt[3]; +static const char *const ctx_name[] = { "HIGH PRIO ISR", "TIMER CALLBACK", "THREAD" }; + +static bool stress_test_action(int ctx, int id) +{ + struct test_grtc_timer *timer = &timers[id]; + + ctx_cnt[ctx]++; + if (timer->state == TIMER_ACTIVE) { + /* Aborting soon to expire timers from higher interrupt priority may lead + * to test failures. + */ + if (ctx == 0 && (k_timer_remaining_get(&timer->timer) < 5)) { + return true; + } + + if (timer->abort_cnt < timer->expire_cnt / 2) { + bool any_active; + + timer->state = TIMER_PREPARE; + k_timer_stop(&timer->timer); + timer->abort_cnt++; + any_active = atomic_dec(&test_active_cnt) > 1; + timer->state = TIMER_IDLE; + + return any_active; + } + } else if (timer->state == TIMER_IDLE) { + int ticks = 10 + (sys_rand32_get() & 0x3F); + k_timeout_t t = K_TICKS(ticks); + + timer->state = TIMER_PREPARE; + timer->exp_expire = k_ticks_to_cyc_floor32(sys_clock_tick_get_32() + ticks); + timer->ticks = ticks; + k_timer_start(&timer->timer, t, K_NO_WAIT); + atomic_inc(&test_active_cnt); + timer->start_cnt++; + timer->state = TIMER_ACTIVE; + } + + return true; +} + +static void stress_test_actions(int ctx) +{ + uint32_t r = sys_rand32_get(); + int action_cnt = Z_MAX(r & 0x3, 1); + int tmr_id = (r >> 8) % ARRAY_SIZE(timers); + + /* Occasionally wake thread context from which timer actions are also executed. */ + if ((((r >> 2) & 0x3) == 0) || test_active_cnt < 2) { + LOG_DBG("ctx:%d thread wakeup", ctx); + k_wakeup(test_tid); + } + + for (int i = 0; i < action_cnt; i++) { + if (stress_test_action(ctx, tmr_id) == false) { + stress_test_action(ctx, tmr_id); + } + } +} + +static void timer_cb(struct k_timer *timer) +{ + struct test_grtc_timer *test_timer = CONTAINER_OF(timer, struct test_grtc_timer, timer); + uint32_t now = k_cycle_get_32(); + int diff = now - test_timer->exp_expire; + + atomic_dec(&test_active_cnt); + zassert_true(diff >= 0); + test_timer->max_late = MAX(diff, test_timer->max_late); + test_timer->min_late = MIN(diff, test_timer->min_late); + + if (test_timer->expire_cnt == 0) { + test_timer->avg_late = diff; + } else { + test_timer->avg_late = (test_timer->avg_late * test_timer->expire_cnt + diff) / + (test_timer->expire_cnt + 1); + } + + test_timer->expire_cnt++; + test_timer->state = TIMER_IDLE; + + if (test_run) { + stress_test_actions(TEST_TIMER_CB); + } +} + +static void counter_set(const struct device *dev, struct counter_alarm_cfg *cfg) +{ + int err; + uint32_t us = 150 + (sys_rand32_get() & 0x3F); + + cfg->ticks = counter_us_to_ticks(dev, us); + err = counter_set_channel_alarm(dev, 0, cfg); + zassert_equal(err, 0); +} + +static void counter_cb(const struct device *dev, uint8_t chan_id, uint32_t ticks, void *user_data) +{ + struct counter_alarm_cfg *config = user_data; + + if (test_run) { + stress_test_actions(TEST_HIGH_PRI); + counter_set(dev, config); + } +} + +static void report_progress(uint32_t start, uint32_t end) +{ + static uint32_t next_report; + static uint32_t step; + static uint32_t progress; + + if (next_report == 0) { + step = (end - start) / 10; + next_report = start + step; + } + + if (k_uptime_get_32() > next_report) { + next_report += step; + progress += 10; + printk("%d%%\r", progress); + } +} + +static void grtc_stress_test(bool busy_sim_en) +{ + static struct counter_alarm_cfg alarm_cfg; +#if DT_NODE_EXISTS(DT_NODELABEL(test_timer)) && DT_NODE_HAS_STATUS(DT_NODELABEL(test_timer), okay) + const struct device *const counter_dev = DEVICE_DT_GET(DT_NODELABEL(test_timer)); +#else + const struct device *const counter_dev = NULL; +#endif + uint32_t test_ms = 5000; + uint32_t test_start = k_uptime_get_32(); + uint32_t load; + + test_end = k_cycle_get_32() + k_ms_to_cyc_floor32(test_ms); + test_tid = k_current_get(); + + for (size_t i = 0; i < ARRAY_SIZE(timers); i++) { + k_timer_init(&timers[i].timer, timer_cb, NULL); + } + + if (IS_ENABLED(CONFIG_CPU_LOAD)) { + (void)cpu_load_get(true); + } + + if (counter_dev) { + counter_start(counter_dev); + } + + alarm_cfg.callback = counter_cb; + alarm_cfg.user_data = &alarm_cfg; + test_run = true; + + if (counter_dev) { + counter_set(counter_dev, &alarm_cfg); + } + + if (busy_sim_en) { + busy_sim_start(500, 200, 1000, 400, NULL); + } + + LOG_DBG("Starting test, will end at %d", test_end); + while (k_cycle_get_32() < test_end) { + report_progress(test_start, test_start + test_ms); + stress_test_actions(TEST_THREAD); + k_sleep(K_MSEC(test_ms)); + } + + load = IS_ENABLED(CONFIG_CPU_LOAD) ? cpu_load_get(true) : 0; + + test_run = false; + k_msleep(50); + + for (size_t i = 0; i < ARRAY_SIZE(timers); i++) { + zassert_equal(timers[i].state, TIMER_IDLE, "Unexpected timer %d state:%d", + i, timers[i].state); + TC_PRINT("Timer%d (%p)\r\n\tstart_cnt:%d abort_cnt:%d expire_cnt:%d\n", + i, &timers[i], timers[i].start_cnt, timers[i].abort_cnt, + timers[i].expire_cnt); + TC_PRINT("\tavarage late:%d ticks, max late:%d, min late:%d early:%d\n", + timers[i].avg_late, timers[i].max_late, timers[i].min_late, + timers[i].early_cnt); + } + + for (size_t i = 0; i < ARRAY_SIZE(ctx_cnt); i++) { + TC_PRINT("Context: %s executed %d times\n", ctx_name[i], ctx_cnt[i]); + } + TC_PRINT("CPU load during test:%d.%d\n", load / 10, load % 10); + + if (busy_sim_en) { + busy_sim_stop(); + } + + if (counter_dev) { + counter_stop(counter_dev); + } +} + +ZTEST(nrf_grtc_timer, test_stress) +{ + grtc_stress_test(false); +} + ZTEST_SUITE(nrf_grtc_timer, NULL, NULL, NULL, NULL, NULL); diff --git a/tests/drivers/timer/nrf_grtc_timer/testcase.yaml b/tests/drivers/timer/nrf_grtc_timer/testcase.yaml index 6f4486de913c..140d9b222599 100644 --- a/tests/drivers/timer/nrf_grtc_timer/testcase.yaml +++ b/tests/drivers/timer/nrf_grtc_timer/testcase.yaml @@ -1,17 +1,22 @@ +common: + tags: + - drivers + platform_allow: + - nrf54h20dk/nrf54h20/cpuapp + - nrf54h20dk/nrf54h20/cpurad + - nrf54h20dk/nrf54h20/cpuppr + - nrf54l15dk/nrf54l15/cpuapp + - nrf54l15dk/nrf54l15/cpuflpr + - nrf54l15bsim/nrf54l15/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuflpr + - ophelia4ev/nrf54l15/cpuapp + - ophelia4ev/nrf54l15/cpuflpr + integration_platforms: + - nrf54lm20dk/nrf54lm20a/cpuapp + timeout: 30 tests: - drivers.timer.nrf_grtc_timer: - tags: drivers - platform_allow: - - nrf54h20dk/nrf54h20/cpuapp - - nrf54h20dk/nrf54h20/cpurad - - nrf54h20dk/nrf54h20/cpuppr - - nrf54l15dk/nrf54l15/cpuapp - - nrf54l15dk/nrf54l15/cpuflpr - - nrf54l15bsim/nrf54l15/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuflpr - - ophelia4ev/nrf54l15/cpuapp - - ophelia4ev/nrf54l15/cpuflpr - integration_platforms: - - nrf54lm20dk/nrf54lm20a/cpuapp - timeout: 30 + drivers.timer.nrf_grtc_timer: {} + drivers.timer.nrf_grtc_timer.no_assert: + extra_configs: + - CONFIG_ASSERT=n From 5408ed3f43481b3e6c031a16c7ea128e8fb1c0ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Stasiak?= Date: Fri, 29 Aug 2025 15:15:34 +0200 Subject: [PATCH 0809/2141] [nrf fromlist] tests: drivers: timer: nrf_grtc_timer: wait for coverage dump MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If test is to be run in coverage mode, wait for output to dump at the end of a failing testcase. Upstream PR #: 95162 Signed-off-by: Michał Stasiak --- tests/drivers/timer/nrf_grtc_timer/src/main.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/drivers/timer/nrf_grtc_timer/src/main.c b/tests/drivers/timer/nrf_grtc_timer/src/main.c index e411eba83a0b..bcb57519f3b4 100644 --- a/tests/drivers/timer/nrf_grtc_timer/src/main.c +++ b/tests/drivers/timer/nrf_grtc_timer/src/main.c @@ -393,6 +393,13 @@ static void grtc_stress_test(bool busy_sim_en) if (counter_dev) { counter_stop(counter_dev); } + +#ifdef CONFIG_COVERAGE + /* Wait a few seconds before exit, giving the test the + * opportunity to dump some output before coverage data gets emitted + */ + k_sleep(K_MSEC(5000)); +#endif } ZTEST(nrf_grtc_timer, test_stress) From e6e402fe59adfee2c4fe988a93f971caae689ee8 Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Fri, 5 Sep 2025 18:09:52 +0200 Subject: [PATCH 0810/2141] [nrf noup] soc/nordic/nrf54h: Add extension to define custom s2ram implementation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add Kconfig entries to allow compile own s2ram implementation. Signed-off-by: Karol Lasończyk Signed-off-by: Andrzej Puzdrowski --- soc/nordic/nrf54h/CMakeLists.txt | 4 +++- soc/nordic/nrf54h/Kconfig | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/soc/nordic/nrf54h/CMakeLists.txt b/soc/nordic/nrf54h/CMakeLists.txt index 23c1cab1e77a..18d91b508650 100644 --- a/soc/nordic/nrf54h/CMakeLists.txt +++ b/soc/nordic/nrf54h/CMakeLists.txt @@ -8,7 +8,9 @@ if(CONFIG_ARM) endif() endif() -zephyr_library_sources_ifdef(CONFIG_PM_S2RAM pm_s2ram.c) +if(NOT CONFIG_SOC_NRF54H20_PM_S2RAM_OVERRIDE) + zephyr_library_sources_ifdef(CONFIG_PM_S2RAM pm_s2ram.c) +endif() zephyr_include_directories(.) diff --git a/soc/nordic/nrf54h/Kconfig b/soc/nordic/nrf54h/Kconfig index b117ee45ad89..0148e6e2687d 100644 --- a/soc/nordic/nrf54h/Kconfig +++ b/soc/nordic/nrf54h/Kconfig @@ -100,6 +100,11 @@ config SOC_NRF54H20_DISABLE_ALL_GPIO_RETENTION_WORKAROUND default y depends on SOC_NRF54H20_CPUAPP || SOC_NRF54H20_CPURAD +config SOC_NRF54H20_PM_S2RAM_OVERRIDE + bool "Override `pm_s2ram` implementation" + help + Override Nordic s2ram implementation. + config SOC_NRF54H20_CPURAD select SOC_NRF54H20_CPURAD_COMMON From 08e0cf415c2c6a0db81c72a6c11f97a9f284d7ee Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Fri, 5 Sep 2025 18:11:52 +0200 Subject: [PATCH 0811/2141] [nrf noup] soc/nordic/nrf54h/pm_s2ram: S2RAM resume hardening Added support for hardening decision on resume from S2RAM by MCUboot bootloader. Application sets additional variable to MCUBOOT_S2RAM_RESUME_MAGIC which allows the bootloader to doublecheck. Signed-off-by: Andrzej Puzdrowski --- .../nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 11 +++++++++-- soc/nordic/nrf54h/pm_s2ram.c | 14 ++++++++++++++ soc/nordic/nrf54h/pm_s2ram.h | 6 ++++++ 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index e086601abae9..3350727c945a 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -343,12 +343,19 @@ zephyr_udc0: &usbhs { /* Trim this RAM block for making room on all run-time common S2RAM cpu context. */ &cpuapp_ram0 { - reg = <0x22000000 (DT_SIZE_K(32)-32)>; - ranges = <0x0 0x22000000 (0x8000-0x20)>; + reg = <0x22000000 (DT_SIZE_K(32) - 36)>; + ranges = <0x0 0x22000000 (0x8000 - 0x24)>; }; / { soc { + /* run-time common mcuboot S2RAM support section */ + mcuboot_s2ram: cpuapp_s2ram@22007fdc { + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0x22007fdc 4>; + zephyr,memory-region = "mcuboot_s2ram_context"; + }; + /* run-time common S2RAM cpu context RAM */ pm_s2ram: cpuapp_s2ram@22007fe0 { compatible = "zephyr,memory-region", "mmio-sram"; diff --git a/soc/nordic/nrf54h/pm_s2ram.c b/soc/nordic/nrf54h/pm_s2ram.c index c9be93ff5c9c..a0fb70fe3194 100644 --- a/soc/nordic/nrf54h/pm_s2ram.c +++ b/soc/nordic/nrf54h/pm_s2ram.c @@ -219,10 +219,24 @@ static void fpu_restore(_fpu_context_t *backup) #endif /* !defined(CONFIG_FPU_SHARING) */ #endif /* defined(CONFIG_FPU) */ +#if DT_NODE_EXISTS(DT_NODELABEL(mcuboot_s2ram)) &&\ + DT_NODE_HAS_COMPAT(DT_NODELABEL(mcuboot_s2ram), zephyr_memory_region) +/* Linker section name is given by `zephyr,memory-region` property of + * `zephyr,memory-region` compatible DT node with nodelabel `mcuboot_s2ram`. + */ +__attribute__((section(DT_PROP(DT_NODELABEL(mcuboot_s2ram), zephyr_memory_region)))) +volatile struct mcuboot_resume_s _mcuboot_resume; + +#define SET_MCUBOOT_RESUME_MAGIC() _mcuboot_resume.magic = MCUBOOT_S2RAM_RESUME_MAGIC +#else +#define SET_MCUBOOT_RESUME_MAGIC() +#endif + int soc_s2ram_suspend(pm_s2ram_system_off_fn_t system_off) { int ret; + SET_MCUBOOT_RESUME_MAGIC(); scb_save(&backup_data.scb_context); #if defined(CONFIG_FPU) #if !defined(CONFIG_FPU_SHARING) diff --git a/soc/nordic/nrf54h/pm_s2ram.h b/soc/nordic/nrf54h/pm_s2ram.h index 565afad6ca10..0906010cbe08 100644 --- a/soc/nordic/nrf54h/pm_s2ram.h +++ b/soc/nordic/nrf54h/pm_s2ram.h @@ -10,6 +10,12 @@ #ifndef _ZEPHYR_SOC_ARM_NORDIC_NRF_PM_S2RAM_H_ #define _ZEPHYR_SOC_ARM_NORDIC_NRF_PM_S2RAM_H_ +#define MCUBOOT_S2RAM_RESUME_MAGIC 0x75832419 + +struct mcuboot_resume_s { + uint32_t magic; /* magic value to identify valid structure */ +}; + /** * @brief Save CPU state on suspend * From 2ace1aa601b68597faa4ede720529a22acd4d0ee Mon Sep 17 00:00:00 2001 From: Piotr Pryga Date: Thu, 11 Sep 2025 09:16:02 +0200 Subject: [PATCH 0812/2141] [nrf fromtree] dts: nrf54h20: Add zephyr,pm-device-runtime-auto; to uart instances The uart driver for nRF54h20 doesn't call pm_device_runtime_enable(). During an uart driver init `pm_device_driver_init()` return early, because the `pm_device_is_powered()` returns `false`. Power domains, where uarts are instantiated, are disabled: `pm->domain->pm_base->state` is not equal to `PM_DEVICE_STATE_ACTIVE`. At the end of the day, an uart instance is left disabled. This is a workaround to make the uart usable when CONFIG_PM, CONFIG_PM_DEVICE and CONFIG_PM_DEVICE_RUNTIME are enabled. Signed-off-by: Piotr Pryga (cherry picked from commit eaede77351a75cca14acafc470eae6beb03d5852) --- dts/vendor/nordic/nrf54h20.dtsi | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dts/vendor/nordic/nrf54h20.dtsi b/dts/vendor/nordic/nrf54h20.dtsi index d06cbde97e02..0f311cf016d0 100644 --- a/dts/vendor/nordic/nrf54h20.dtsi +++ b/dts/vendor/nordic/nrf54h20.dtsi @@ -708,6 +708,7 @@ power-domains = <&gpd NRF_GPD_FAST_ACTIVE1>; endtx-stoptx-supported; frame-timeout-supported; + zephyr,pm-device-runtime-auto; }; spi121: spi@8e7000 { @@ -1066,6 +1067,7 @@ nordic,clockpin-enable = ; endtx-stoptx-supported; frame-timeout-supported; + zephyr,pm-device-runtime-auto; }; i2c131: i2c@9a6000 { @@ -1200,6 +1202,7 @@ nordic,clockpin-enable = ; endtx-stoptx-supported; frame-timeout-supported; + zephyr,pm-device-runtime-auto; }; i2c133: i2c@9b6000 { @@ -1246,6 +1249,7 @@ nordic,clockpin-enable = ; endtx-stoptx-supported; frame-timeout-supported; + zephyr,pm-device-runtime-auto; }; dppic135: dppic@9c1000 { @@ -1334,6 +1338,7 @@ nordic,clockpin-enable = ; endtx-stoptx-supported; frame-timeout-supported; + zephyr,pm-device-runtime-auto; }; i2c135: i2c@9c6000 { @@ -1380,6 +1385,7 @@ nordic,clockpin-enable = ; endtx-stoptx-supported; frame-timeout-supported; + zephyr,pm-device-runtime-auto; }; dppic136: dppic@9d1000 { @@ -1514,6 +1520,7 @@ nordic,clockpin-enable = ; endtx-stoptx-supported; frame-timeout-supported; + zephyr,pm-device-runtime-auto; }; tdm130: tdm@992000 { From ffdab1b6b90658e0a9fc9a3ae64e45e37c3e9386 Mon Sep 17 00:00:00 2001 From: Piotr Pryga Date: Fri, 12 Sep 2025 12:17:00 +0200 Subject: [PATCH 0813/2141] [nrf noup] dts: choose a psa-rng for entropy for 54lm20a Set PSA as the entropy source for nRF54lm20a target. PSA is the only NCS-supported interface to CRACEN. There is no other entropy source in 54lm20a than CRACEN. The commit also disables `rng` compatible with `nrf-cracen-ctrdrbg`, the nrfx based interface to CRACEN that is used in upstream Zephyr. Only one CRACEN interface may be enabled. Signed-off-by: Piotr Pryga --- dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi | 2 +- dts/arm/nordic/nrf54lm20a_enga_cpuapp.dtsi | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi b/dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi index 80875058f5fd..88c1f43a9b8b 100644 --- a/dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi +++ b/dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi @@ -26,7 +26,7 @@ nvic: &cpuapp_nvic {}; }; rng: rng { - status = "okay"; + status = "disabled"; compatible = "nordic,nrf-cracen-ctrdrbg"; }; diff --git a/dts/arm/nordic/nrf54lm20a_enga_cpuapp.dtsi b/dts/arm/nordic/nrf54lm20a_enga_cpuapp.dtsi index dc13fb40d6aa..c92c27f5ceb4 100644 --- a/dts/arm/nordic/nrf54lm20a_enga_cpuapp.dtsi +++ b/dts/arm/nordic/nrf54lm20a_enga_cpuapp.dtsi @@ -17,7 +17,7 @@ nvic: &cpuapp_nvic {}; / { chosen { - zephyr,entropy = &rng; + zephyr,entropy = &psa_rng; }; soc { @@ -28,11 +28,11 @@ nvic: &cpuapp_nvic {}; psa_rng: psa-rng { compatible = "zephyr,psa-crypto-rng"; - status = "disabled"; + status = "okay"; }; rng: rng { - status = "okay"; + status = "disabled"; compatible = "nordic,nrf-cracen-ctrdrbg"; }; }; From 7d3bd3993600d433ab0653391aee2fa2b4ce3fda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Stasiak?= Date: Fri, 12 Sep 2025 14:31:11 +0200 Subject: [PATCH 0814/2141] [nrf fromlist] manifest: update hal_nordic revision to integrate MDK 8.72.3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit New hal_nordic revision contains MDK 8.72.3 with changes for nRF54LV10A EngA SoC. Upstream PR #: 95907 Signed-off-by: Michał Stasiak --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 17e5d7cf22d1..b9f4cec94571 100644 --- a/west.yml +++ b/west.yml @@ -200,7 +200,7 @@ manifest: groups: - hal - name: hal_nordic - revision: 54f33f10a0b826174fb145f155afa61ce5a44b93 + revision: d0cef2363e572679deba0e796ef6c77f1188bb04 path: modules/hal/nordic groups: - hal From e353987da6569122328136309327a15fb7b27f20 Mon Sep 17 00:00:00 2001 From: Tomasz Chyrowicz Date: Tue, 16 Sep 2025 14:42:14 +0200 Subject: [PATCH 0815/2141] Revert "[nrf noup] soc/nordic/nrf54h/pm_s2ram: S2RAM resume hardening" This reverts commit 08e0cf415c2c6a0db81c72a6c11f97a9f284d7ee. Signed-off-by: Tomasz Chyrowicz --- .../nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 11 ++--------- soc/nordic/nrf54h/pm_s2ram.c | 14 -------------- soc/nordic/nrf54h/pm_s2ram.h | 6 ------ 3 files changed, 2 insertions(+), 29 deletions(-) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index 3350727c945a..e086601abae9 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -343,19 +343,12 @@ zephyr_udc0: &usbhs { /* Trim this RAM block for making room on all run-time common S2RAM cpu context. */ &cpuapp_ram0 { - reg = <0x22000000 (DT_SIZE_K(32) - 36)>; - ranges = <0x0 0x22000000 (0x8000 - 0x24)>; + reg = <0x22000000 (DT_SIZE_K(32)-32)>; + ranges = <0x0 0x22000000 (0x8000-0x20)>; }; / { soc { - /* run-time common mcuboot S2RAM support section */ - mcuboot_s2ram: cpuapp_s2ram@22007fdc { - compatible = "zephyr,memory-region", "mmio-sram"; - reg = <0x22007fdc 4>; - zephyr,memory-region = "mcuboot_s2ram_context"; - }; - /* run-time common S2RAM cpu context RAM */ pm_s2ram: cpuapp_s2ram@22007fe0 { compatible = "zephyr,memory-region", "mmio-sram"; diff --git a/soc/nordic/nrf54h/pm_s2ram.c b/soc/nordic/nrf54h/pm_s2ram.c index a0fb70fe3194..c9be93ff5c9c 100644 --- a/soc/nordic/nrf54h/pm_s2ram.c +++ b/soc/nordic/nrf54h/pm_s2ram.c @@ -219,24 +219,10 @@ static void fpu_restore(_fpu_context_t *backup) #endif /* !defined(CONFIG_FPU_SHARING) */ #endif /* defined(CONFIG_FPU) */ -#if DT_NODE_EXISTS(DT_NODELABEL(mcuboot_s2ram)) &&\ - DT_NODE_HAS_COMPAT(DT_NODELABEL(mcuboot_s2ram), zephyr_memory_region) -/* Linker section name is given by `zephyr,memory-region` property of - * `zephyr,memory-region` compatible DT node with nodelabel `mcuboot_s2ram`. - */ -__attribute__((section(DT_PROP(DT_NODELABEL(mcuboot_s2ram), zephyr_memory_region)))) -volatile struct mcuboot_resume_s _mcuboot_resume; - -#define SET_MCUBOOT_RESUME_MAGIC() _mcuboot_resume.magic = MCUBOOT_S2RAM_RESUME_MAGIC -#else -#define SET_MCUBOOT_RESUME_MAGIC() -#endif - int soc_s2ram_suspend(pm_s2ram_system_off_fn_t system_off) { int ret; - SET_MCUBOOT_RESUME_MAGIC(); scb_save(&backup_data.scb_context); #if defined(CONFIG_FPU) #if !defined(CONFIG_FPU_SHARING) diff --git a/soc/nordic/nrf54h/pm_s2ram.h b/soc/nordic/nrf54h/pm_s2ram.h index 0906010cbe08..565afad6ca10 100644 --- a/soc/nordic/nrf54h/pm_s2ram.h +++ b/soc/nordic/nrf54h/pm_s2ram.h @@ -10,12 +10,6 @@ #ifndef _ZEPHYR_SOC_ARM_NORDIC_NRF_PM_S2RAM_H_ #define _ZEPHYR_SOC_ARM_NORDIC_NRF_PM_S2RAM_H_ -#define MCUBOOT_S2RAM_RESUME_MAGIC 0x75832419 - -struct mcuboot_resume_s { - uint32_t magic; /* magic value to identify valid structure */ -}; - /** * @brief Save CPU state on suspend * From 998ed1b8b1b07bf801be74bbe9e69403a29fdab5 Mon Sep 17 00:00:00 2001 From: Tomasz Chyrowicz Date: Mon, 15 Sep 2025 11:22:28 +0200 Subject: [PATCH 0816/2141] [nrf noup] boards: Align board DTS with upstream. This alignment cannot be done through nrf fromlist commit, since it was introduced in the tree-wide commit: 2d22884f52a01236d404fb2e6910d3683f680af6 Once tried to pull all changes to merge it cleanly, the chain ended up in the doc/releases/migration-guide-4.3.rst file, which would bring nearly all of the changes from the Zephyr 4.3 release, making a small PR with just 4 white characters a Zephyr upmerge PR. Feel free to drop this commit during the next Zephyr upmerge. Signed-off-by: Tomasz Chyrowicz --- boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index e086601abae9..07c6b4155ca3 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -343,8 +343,8 @@ zephyr_udc0: &usbhs { /* Trim this RAM block for making room on all run-time common S2RAM cpu context. */ &cpuapp_ram0 { - reg = <0x22000000 (DT_SIZE_K(32)-32)>; - ranges = <0x0 0x22000000 (0x8000-0x20)>; + reg = <0x22000000 (DT_SIZE_K(32) - 32)>; + ranges = <0x0 0x22000000 (0x8000 - 0x20)>; }; / { From c9cfa6253d49d569d7129ef4a48daebef94127b2 Mon Sep 17 00:00:00 2001 From: Tomasz Chyrowicz Date: Tue, 16 Sep 2025 11:31:12 +0200 Subject: [PATCH 0817/2141] [nrf fromlist] arch: Allow to specify memory for S2RAM resume If the area, dedicated for the interrupt stack is not available, allow to specify a memory region that will be used as the stack for the S2RAM resume logic. Upstream PR #: 95914 Signed-off-by: Tomasz Chyrowicz --- arch/arm/core/cortex_m/reset.S | 12 ++++++++++++ subsys/pm/Kconfig | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/arch/arm/core/cortex_m/reset.S b/arch/arm/core/cortex_m/reset.S index c3f9362eca85..17b7a1d830f6 100644 --- a/arch/arm/core/cortex_m/reset.S +++ b/arch/arm/core/cortex_m/reset.S @@ -83,6 +83,17 @@ SECTION_SUBSEC_FUNC(TEXT,_reset_section,__start) #endif /* CONFIG_INIT_ARCH_HW_AT_BOOT */ #if defined(CONFIG_PM_S2RAM) +#if DT_NODE_EXISTS(DT_NODELABEL(pm_s2ram_stack)) &&\ + DT_NODE_HAS_COMPAT(DT_NODELABEL(pm_s2ram_stack), zephyr_memory_region) + /* In certain scenarios, the interrupt stack is actually not safe to overwrite. + * For example, when MCUboot is used, the bootloader's "z_interrupt_stack" and the + * loaded image's "z_interrupt_stacks" are NOT at the same address, and writing to + * the former would corrupt unrelated data from the loaded image. To support such + * scenarios, if the Device Tree provides a specially named "zephyr,memory-region", + * use it as the stack to run arch_pm_s2ram_resume instead of the interrupt stack. + */ + ldr r0, =DT_REG_ADDR(DT_NODELABEL(pm_s2ram_stack)) + DT_REG_SIZE(DT_NODELABEL(pm_s2ram_stack)) +#else /* * Temporarily set MSP to interrupt stack so that arch_pm_s2ram_resume can * use stack for calling pm_s2ram_mark_check_and_clear. @@ -95,6 +106,7 @@ SECTION_SUBSEC_FUNC(TEXT,_reset_section,__start) * a short while, there is no change in behavior in either of the paths. */ ldr r0, =z_interrupt_stacks + CONFIG_ISR_STACK_SIZE + MPU_GUARD_ALIGN_AND_SIZE +#endif msr msp, r0 bl arch_pm_s2ram_resume diff --git a/subsys/pm/Kconfig b/subsys/pm/Kconfig index 7cc347369b98..6276f5ab3833 100644 --- a/subsys/pm/Kconfig +++ b/subsys/pm/Kconfig @@ -41,6 +41,11 @@ config PM_S2RAM When enabled on Cortex-M, and a 'zephyr,memory-region' compatible node with nodelabel 'pm_s2ram' is defined in DT, _cpu_context symbol (located in arch/arm/core/cortex_m/pm_s2ram.c) is placed in linker section given by 'zephyr,memory-region' property of aforementioned node. + Additionally on Cortex-M, if a 'zephyr,memory-region' compatible node with nodelabel + 'pm_s2ram_stack' is defined in DT, this region will be used as a temporary program stack + for the S2RAM resume logic. The assembly reset handling code itself makes a single push of + the return address, but the SoC-specific function (pm_s2ram_mark_check_and_clear) must be + analyzed to determine the required stack size. config PM_S2RAM_CUSTOM_MARKING bool "Use custom marking functions" From c2748343ba324b7b5b1acd5598494eb8ee5b4e9a Mon Sep 17 00:00:00 2001 From: Tomasz Chyrowicz Date: Tue, 16 Sep 2025 11:31:37 +0200 Subject: [PATCH 0818/2141] [nrf fromlist] boards: Define pm_s2ram_stack for nRF54H20 Add the definition of pm_s2ram_stack memory region for nRF54H20. Upstream PR #: 95914 Signed-off-by: Tomasz Chyrowicz --- .../nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index 07c6b4155ca3..34e914721958 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -343,12 +343,19 @@ zephyr_udc0: &usbhs { /* Trim this RAM block for making room on all run-time common S2RAM cpu context. */ &cpuapp_ram0 { - reg = <0x22000000 (DT_SIZE_K(32) - 32)>; - ranges = <0x0 0x22000000 (0x8000 - 0x20)>; + reg = <0x22000000 (DT_SIZE_K(32) - 48)>; + ranges = <0x0 0x22000000 (0x8000 - 0x30)>; }; / { soc { + /* temporary stack for S2RAM resume logic */ + pm_s2ram_stack: cpuapp_s2ram_stack@22007fd0 { + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0x22007fd0 16>; + zephyr,memory-region = "pm_s2ram_stack"; + }; + /* run-time common S2RAM cpu context RAM */ pm_s2ram: cpuapp_s2ram@22007fe0 { compatible = "zephyr,memory-region", "mmio-sram"; From d4bb1c6b9f1c941480a457b18ae36c9bdf49faa7 Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Fri, 5 Sep 2025 18:11:52 +0200 Subject: [PATCH 0819/2141] [nrf noup] soc/nordic/nrf54h/pm_s2ram: S2RAM resume hardening Added support for hardening decision on resume from S2RAM by MCUboot bootloader. Application sets additional variable to MCUBOOT_S2RAM_RESUME_MAGIC which allows the bootloader to doublecheck. Signed-off-by: Andrzej Puzdrowski (cherry picked from commit 08e0cf415c2c6a0db81c72a6c11f97a9f284d7ee) --- .../nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 15 +++++++++++---- soc/nordic/nrf54h/pm_s2ram.c | 14 ++++++++++++++ soc/nordic/nrf54h/pm_s2ram.h | 6 ++++++ 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index 34e914721958..ae330e209aad 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -343,19 +343,26 @@ zephyr_udc0: &usbhs { /* Trim this RAM block for making room on all run-time common S2RAM cpu context. */ &cpuapp_ram0 { - reg = <0x22000000 (DT_SIZE_K(32) - 48)>; - ranges = <0x0 0x22000000 (0x8000 - 0x30)>; + reg = <0x22000000 (DT_SIZE_K(32) - 52)>; + ranges = <0x0 0x22000000 (0x8000 - 0x34)>; }; / { soc { /* temporary stack for S2RAM resume logic */ - pm_s2ram_stack: cpuapp_s2ram_stack@22007fd0 { + pm_s2ram_stack: cpuapp_s2ram_stack@22007fcc { compatible = "zephyr,memory-region", "mmio-sram"; - reg = <0x22007fd0 16>; + reg = <0x22007fcc 16>; zephyr,memory-region = "pm_s2ram_stack"; }; + /* run-time common mcuboot S2RAM support section */ + mcuboot_s2ram: cpuapp_s2ram@22007fdc { + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0x22007fdc 4>; + zephyr,memory-region = "mcuboot_s2ram_context"; + }; + /* run-time common S2RAM cpu context RAM */ pm_s2ram: cpuapp_s2ram@22007fe0 { compatible = "zephyr,memory-region", "mmio-sram"; diff --git a/soc/nordic/nrf54h/pm_s2ram.c b/soc/nordic/nrf54h/pm_s2ram.c index c9be93ff5c9c..a0fb70fe3194 100644 --- a/soc/nordic/nrf54h/pm_s2ram.c +++ b/soc/nordic/nrf54h/pm_s2ram.c @@ -219,10 +219,24 @@ static void fpu_restore(_fpu_context_t *backup) #endif /* !defined(CONFIG_FPU_SHARING) */ #endif /* defined(CONFIG_FPU) */ +#if DT_NODE_EXISTS(DT_NODELABEL(mcuboot_s2ram)) &&\ + DT_NODE_HAS_COMPAT(DT_NODELABEL(mcuboot_s2ram), zephyr_memory_region) +/* Linker section name is given by `zephyr,memory-region` property of + * `zephyr,memory-region` compatible DT node with nodelabel `mcuboot_s2ram`. + */ +__attribute__((section(DT_PROP(DT_NODELABEL(mcuboot_s2ram), zephyr_memory_region)))) +volatile struct mcuboot_resume_s _mcuboot_resume; + +#define SET_MCUBOOT_RESUME_MAGIC() _mcuboot_resume.magic = MCUBOOT_S2RAM_RESUME_MAGIC +#else +#define SET_MCUBOOT_RESUME_MAGIC() +#endif + int soc_s2ram_suspend(pm_s2ram_system_off_fn_t system_off) { int ret; + SET_MCUBOOT_RESUME_MAGIC(); scb_save(&backup_data.scb_context); #if defined(CONFIG_FPU) #if !defined(CONFIG_FPU_SHARING) diff --git a/soc/nordic/nrf54h/pm_s2ram.h b/soc/nordic/nrf54h/pm_s2ram.h index 565afad6ca10..0906010cbe08 100644 --- a/soc/nordic/nrf54h/pm_s2ram.h +++ b/soc/nordic/nrf54h/pm_s2ram.h @@ -10,6 +10,12 @@ #ifndef _ZEPHYR_SOC_ARM_NORDIC_NRF_PM_S2RAM_H_ #define _ZEPHYR_SOC_ARM_NORDIC_NRF_PM_S2RAM_H_ +#define MCUBOOT_S2RAM_RESUME_MAGIC 0x75832419 + +struct mcuboot_resume_s { + uint32_t magic; /* magic value to identify valid structure */ +}; + /** * @brief Save CPU state on suspend * From d32b79417c5a4c70f16cbbb579d3610daab5f88f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Pelikan?= Date: Mon, 8 Sep 2025 12:45:10 +0200 Subject: [PATCH 0820/2141] [nrf fromtree] tests: kernel: sleep: Adjustments for NRF54H20 PPR MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adjusting the max shortest ticks value for slow PPR core. Signed-off-by: Paweł Pelikan (cherry picked from commit 1192dbf24ad410e39652698e32f86d94c369d8de) --- tests/kernel/sleep/src/usleep.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/kernel/sleep/src/usleep.c b/tests/kernel/sleep/src/usleep.c index 8a234a27a199..a7c212e59b96 100644 --- a/tests/kernel/sleep/src/usleep.c +++ b/tests/kernel/sleep/src/usleep.c @@ -42,6 +42,11 @@ * loaded to its comparator. */ #define MAXIMUM_SHORTEST_TICKS 2 +#elif defined(CONFIG_SOC_NRF54H20_CPUPPR) && (CONFIG_SYS_CLOCK_TICKS_PER_SEC > 16384) +/* Similar for nRF54H20 cpuppr (RISC-V core), it has a slow CPU clock + * compared to other cores, causing the increased overhead. + */ +#define MAXIMUM_SHORTEST_TICKS 4 #else #define MAXIMUM_SHORTEST_TICKS 1 #endif From 4250b58524a4eddd2d0a29d8a4cc851e8fa8ff44 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:24 +0300 Subject: [PATCH 0821/2141] Revert "[nrf fromtree] tests: kernel: sleep: Adjustments for NRF54H20 PPR" This reverts commit d32b79417c5a4c70f16cbbb579d3610daab5f88f. Signed-off-by: Jukka Rissanen --- tests/kernel/sleep/src/usleep.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tests/kernel/sleep/src/usleep.c b/tests/kernel/sleep/src/usleep.c index a7c212e59b96..8a234a27a199 100644 --- a/tests/kernel/sleep/src/usleep.c +++ b/tests/kernel/sleep/src/usleep.c @@ -42,11 +42,6 @@ * loaded to its comparator. */ #define MAXIMUM_SHORTEST_TICKS 2 -#elif defined(CONFIG_SOC_NRF54H20_CPUPPR) && (CONFIG_SYS_CLOCK_TICKS_PER_SEC > 16384) -/* Similar for nRF54H20 cpuppr (RISC-V core), it has a slow CPU clock - * compared to other cores, causing the increased overhead. - */ -#define MAXIMUM_SHORTEST_TICKS 4 #else #define MAXIMUM_SHORTEST_TICKS 1 #endif From 9a9585e120fce6744b42e3646fdc6e4613d7f7e6 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:25 +0300 Subject: [PATCH 0822/2141] Revert "[nrf noup] soc/nordic/nrf54h/pm_s2ram: S2RAM resume hardening" This reverts commit d4bb1c6b9f1c941480a457b18ae36c9bdf49faa7. Signed-off-by: Jukka Rissanen --- .../nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 15 ++++----------- soc/nordic/nrf54h/pm_s2ram.c | 14 -------------- soc/nordic/nrf54h/pm_s2ram.h | 6 ------ 3 files changed, 4 insertions(+), 31 deletions(-) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index ae330e209aad..34e914721958 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -343,26 +343,19 @@ zephyr_udc0: &usbhs { /* Trim this RAM block for making room on all run-time common S2RAM cpu context. */ &cpuapp_ram0 { - reg = <0x22000000 (DT_SIZE_K(32) - 52)>; - ranges = <0x0 0x22000000 (0x8000 - 0x34)>; + reg = <0x22000000 (DT_SIZE_K(32) - 48)>; + ranges = <0x0 0x22000000 (0x8000 - 0x30)>; }; / { soc { /* temporary stack for S2RAM resume logic */ - pm_s2ram_stack: cpuapp_s2ram_stack@22007fcc { + pm_s2ram_stack: cpuapp_s2ram_stack@22007fd0 { compatible = "zephyr,memory-region", "mmio-sram"; - reg = <0x22007fcc 16>; + reg = <0x22007fd0 16>; zephyr,memory-region = "pm_s2ram_stack"; }; - /* run-time common mcuboot S2RAM support section */ - mcuboot_s2ram: cpuapp_s2ram@22007fdc { - compatible = "zephyr,memory-region", "mmio-sram"; - reg = <0x22007fdc 4>; - zephyr,memory-region = "mcuboot_s2ram_context"; - }; - /* run-time common S2RAM cpu context RAM */ pm_s2ram: cpuapp_s2ram@22007fe0 { compatible = "zephyr,memory-region", "mmio-sram"; diff --git a/soc/nordic/nrf54h/pm_s2ram.c b/soc/nordic/nrf54h/pm_s2ram.c index a0fb70fe3194..c9be93ff5c9c 100644 --- a/soc/nordic/nrf54h/pm_s2ram.c +++ b/soc/nordic/nrf54h/pm_s2ram.c @@ -219,24 +219,10 @@ static void fpu_restore(_fpu_context_t *backup) #endif /* !defined(CONFIG_FPU_SHARING) */ #endif /* defined(CONFIG_FPU) */ -#if DT_NODE_EXISTS(DT_NODELABEL(mcuboot_s2ram)) &&\ - DT_NODE_HAS_COMPAT(DT_NODELABEL(mcuboot_s2ram), zephyr_memory_region) -/* Linker section name is given by `zephyr,memory-region` property of - * `zephyr,memory-region` compatible DT node with nodelabel `mcuboot_s2ram`. - */ -__attribute__((section(DT_PROP(DT_NODELABEL(mcuboot_s2ram), zephyr_memory_region)))) -volatile struct mcuboot_resume_s _mcuboot_resume; - -#define SET_MCUBOOT_RESUME_MAGIC() _mcuboot_resume.magic = MCUBOOT_S2RAM_RESUME_MAGIC -#else -#define SET_MCUBOOT_RESUME_MAGIC() -#endif - int soc_s2ram_suspend(pm_s2ram_system_off_fn_t system_off) { int ret; - SET_MCUBOOT_RESUME_MAGIC(); scb_save(&backup_data.scb_context); #if defined(CONFIG_FPU) #if !defined(CONFIG_FPU_SHARING) diff --git a/soc/nordic/nrf54h/pm_s2ram.h b/soc/nordic/nrf54h/pm_s2ram.h index 0906010cbe08..565afad6ca10 100644 --- a/soc/nordic/nrf54h/pm_s2ram.h +++ b/soc/nordic/nrf54h/pm_s2ram.h @@ -10,12 +10,6 @@ #ifndef _ZEPHYR_SOC_ARM_NORDIC_NRF_PM_S2RAM_H_ #define _ZEPHYR_SOC_ARM_NORDIC_NRF_PM_S2RAM_H_ -#define MCUBOOT_S2RAM_RESUME_MAGIC 0x75832419 - -struct mcuboot_resume_s { - uint32_t magic; /* magic value to identify valid structure */ -}; - /** * @brief Save CPU state on suspend * From ebc9333604047c8e066186d251e8b1c36a54cf62 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:25 +0300 Subject: [PATCH 0823/2141] Revert "[nrf fromlist] boards: Define pm_s2ram_stack for nRF54H20" This reverts commit c2748343ba324b7b5b1acd5598494eb8ee5b4e9a. Signed-off-by: Jukka Rissanen --- .../nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index 34e914721958..07c6b4155ca3 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -343,19 +343,12 @@ zephyr_udc0: &usbhs { /* Trim this RAM block for making room on all run-time common S2RAM cpu context. */ &cpuapp_ram0 { - reg = <0x22000000 (DT_SIZE_K(32) - 48)>; - ranges = <0x0 0x22000000 (0x8000 - 0x30)>; + reg = <0x22000000 (DT_SIZE_K(32) - 32)>; + ranges = <0x0 0x22000000 (0x8000 - 0x20)>; }; / { soc { - /* temporary stack for S2RAM resume logic */ - pm_s2ram_stack: cpuapp_s2ram_stack@22007fd0 { - compatible = "zephyr,memory-region", "mmio-sram"; - reg = <0x22007fd0 16>; - zephyr,memory-region = "pm_s2ram_stack"; - }; - /* run-time common S2RAM cpu context RAM */ pm_s2ram: cpuapp_s2ram@22007fe0 { compatible = "zephyr,memory-region", "mmio-sram"; From 93f34b439c42ddb89a93b3dd6d546458c7d2407c Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:25 +0300 Subject: [PATCH 0824/2141] Revert "[nrf fromlist] arch: Allow to specify memory for S2RAM resume" This reverts commit c9cfa6253d49d569d7129ef4a48daebef94127b2. Signed-off-by: Jukka Rissanen --- arch/arm/core/cortex_m/reset.S | 12 ------------ subsys/pm/Kconfig | 5 ----- 2 files changed, 17 deletions(-) diff --git a/arch/arm/core/cortex_m/reset.S b/arch/arm/core/cortex_m/reset.S index 17b7a1d830f6..c3f9362eca85 100644 --- a/arch/arm/core/cortex_m/reset.S +++ b/arch/arm/core/cortex_m/reset.S @@ -83,17 +83,6 @@ SECTION_SUBSEC_FUNC(TEXT,_reset_section,__start) #endif /* CONFIG_INIT_ARCH_HW_AT_BOOT */ #if defined(CONFIG_PM_S2RAM) -#if DT_NODE_EXISTS(DT_NODELABEL(pm_s2ram_stack)) &&\ - DT_NODE_HAS_COMPAT(DT_NODELABEL(pm_s2ram_stack), zephyr_memory_region) - /* In certain scenarios, the interrupt stack is actually not safe to overwrite. - * For example, when MCUboot is used, the bootloader's "z_interrupt_stack" and the - * loaded image's "z_interrupt_stacks" are NOT at the same address, and writing to - * the former would corrupt unrelated data from the loaded image. To support such - * scenarios, if the Device Tree provides a specially named "zephyr,memory-region", - * use it as the stack to run arch_pm_s2ram_resume instead of the interrupt stack. - */ - ldr r0, =DT_REG_ADDR(DT_NODELABEL(pm_s2ram_stack)) + DT_REG_SIZE(DT_NODELABEL(pm_s2ram_stack)) -#else /* * Temporarily set MSP to interrupt stack so that arch_pm_s2ram_resume can * use stack for calling pm_s2ram_mark_check_and_clear. @@ -106,7 +95,6 @@ SECTION_SUBSEC_FUNC(TEXT,_reset_section,__start) * a short while, there is no change in behavior in either of the paths. */ ldr r0, =z_interrupt_stacks + CONFIG_ISR_STACK_SIZE + MPU_GUARD_ALIGN_AND_SIZE -#endif msr msp, r0 bl arch_pm_s2ram_resume diff --git a/subsys/pm/Kconfig b/subsys/pm/Kconfig index 6276f5ab3833..7cc347369b98 100644 --- a/subsys/pm/Kconfig +++ b/subsys/pm/Kconfig @@ -41,11 +41,6 @@ config PM_S2RAM When enabled on Cortex-M, and a 'zephyr,memory-region' compatible node with nodelabel 'pm_s2ram' is defined in DT, _cpu_context symbol (located in arch/arm/core/cortex_m/pm_s2ram.c) is placed in linker section given by 'zephyr,memory-region' property of aforementioned node. - Additionally on Cortex-M, if a 'zephyr,memory-region' compatible node with nodelabel - 'pm_s2ram_stack' is defined in DT, this region will be used as a temporary program stack - for the S2RAM resume logic. The assembly reset handling code itself makes a single push of - the return address, but the SoC-specific function (pm_s2ram_mark_check_and_clear) must be - analyzed to determine the required stack size. config PM_S2RAM_CUSTOM_MARKING bool "Use custom marking functions" From 7eda8061d64f013b47c0762adf532b5412c1e6fc Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:25 +0300 Subject: [PATCH 0825/2141] Revert "[nrf noup] boards: Align board DTS with upstream." This reverts commit 998ed1b8b1b07bf801be74bbe9e69403a29fdab5. Signed-off-by: Jukka Rissanen --- boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index 07c6b4155ca3..e086601abae9 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -343,8 +343,8 @@ zephyr_udc0: &usbhs { /* Trim this RAM block for making room on all run-time common S2RAM cpu context. */ &cpuapp_ram0 { - reg = <0x22000000 (DT_SIZE_K(32) - 32)>; - ranges = <0x0 0x22000000 (0x8000 - 0x20)>; + reg = <0x22000000 (DT_SIZE_K(32)-32)>; + ranges = <0x0 0x22000000 (0x8000-0x20)>; }; / { From e4ea8cb308ec5371bd51fe2357f2bd36f1616cf1 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:25 +0300 Subject: [PATCH 0826/2141] Revert "[nrf fromlist] manifest: update hal_nordic revision to integrate MDK 8.72.3" This reverts commit 7d3bd3993600d433ab0653391aee2fa2b4ce3fda. Signed-off-by: Jukka Rissanen --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index b9f4cec94571..17e5d7cf22d1 100644 --- a/west.yml +++ b/west.yml @@ -200,7 +200,7 @@ manifest: groups: - hal - name: hal_nordic - revision: d0cef2363e572679deba0e796ef6c77f1188bb04 + revision: 54f33f10a0b826174fb145f155afa61ce5a44b93 path: modules/hal/nordic groups: - hal From 6e3c7d6afceb6f00f53b1e9c07806ab8b17a5f12 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:25 +0300 Subject: [PATCH 0827/2141] Revert "[nrf noup] dts: choose a psa-rng for entropy for 54lm20a" This reverts commit ffdab1b6b90658e0a9fc9a3ae64e45e37c3e9386. Signed-off-by: Jukka Rissanen --- dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi | 2 +- dts/arm/nordic/nrf54lm20a_enga_cpuapp.dtsi | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi b/dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi index 88c1f43a9b8b..80875058f5fd 100644 --- a/dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi +++ b/dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi @@ -26,7 +26,7 @@ nvic: &cpuapp_nvic {}; }; rng: rng { - status = "disabled"; + status = "okay"; compatible = "nordic,nrf-cracen-ctrdrbg"; }; diff --git a/dts/arm/nordic/nrf54lm20a_enga_cpuapp.dtsi b/dts/arm/nordic/nrf54lm20a_enga_cpuapp.dtsi index c92c27f5ceb4..dc13fb40d6aa 100644 --- a/dts/arm/nordic/nrf54lm20a_enga_cpuapp.dtsi +++ b/dts/arm/nordic/nrf54lm20a_enga_cpuapp.dtsi @@ -17,7 +17,7 @@ nvic: &cpuapp_nvic {}; / { chosen { - zephyr,entropy = &psa_rng; + zephyr,entropy = &rng; }; soc { @@ -28,11 +28,11 @@ nvic: &cpuapp_nvic {}; psa_rng: psa-rng { compatible = "zephyr,psa-crypto-rng"; - status = "okay"; + status = "disabled"; }; rng: rng { - status = "disabled"; + status = "okay"; compatible = "nordic,nrf-cracen-ctrdrbg"; }; }; From 2982591b3f450c2197a6b3d6c6e226757fd7d140 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:25 +0300 Subject: [PATCH 0828/2141] Revert "[nrf fromtree] dts: nrf54h20: Add zephyr,pm-device-runtime-auto; to uart instances" This reverts commit 2ace1aa601b68597faa4ede720529a22acd4d0ee. Signed-off-by: Jukka Rissanen --- dts/vendor/nordic/nrf54h20.dtsi | 7 ------- 1 file changed, 7 deletions(-) diff --git a/dts/vendor/nordic/nrf54h20.dtsi b/dts/vendor/nordic/nrf54h20.dtsi index 0f311cf016d0..d06cbde97e02 100644 --- a/dts/vendor/nordic/nrf54h20.dtsi +++ b/dts/vendor/nordic/nrf54h20.dtsi @@ -708,7 +708,6 @@ power-domains = <&gpd NRF_GPD_FAST_ACTIVE1>; endtx-stoptx-supported; frame-timeout-supported; - zephyr,pm-device-runtime-auto; }; spi121: spi@8e7000 { @@ -1067,7 +1066,6 @@ nordic,clockpin-enable = ; endtx-stoptx-supported; frame-timeout-supported; - zephyr,pm-device-runtime-auto; }; i2c131: i2c@9a6000 { @@ -1202,7 +1200,6 @@ nordic,clockpin-enable = ; endtx-stoptx-supported; frame-timeout-supported; - zephyr,pm-device-runtime-auto; }; i2c133: i2c@9b6000 { @@ -1249,7 +1246,6 @@ nordic,clockpin-enable = ; endtx-stoptx-supported; frame-timeout-supported; - zephyr,pm-device-runtime-auto; }; dppic135: dppic@9c1000 { @@ -1338,7 +1334,6 @@ nordic,clockpin-enable = ; endtx-stoptx-supported; frame-timeout-supported; - zephyr,pm-device-runtime-auto; }; i2c135: i2c@9c6000 { @@ -1385,7 +1380,6 @@ nordic,clockpin-enable = ; endtx-stoptx-supported; frame-timeout-supported; - zephyr,pm-device-runtime-auto; }; dppic136: dppic@9d1000 { @@ -1520,7 +1514,6 @@ nordic,clockpin-enable = ; endtx-stoptx-supported; frame-timeout-supported; - zephyr,pm-device-runtime-auto; }; tdm130: tdm@992000 { From 57268290ad40fb6b6c0a419b2937e01f7579920e Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:25 +0300 Subject: [PATCH 0829/2141] Revert "[nrf noup] soc/nordic/nrf54h: Add extension to define custom s2ram implementation" This reverts commit e6e402fe59adfee2c4fe988a93f971caae689ee8. Signed-off-by: Jukka Rissanen --- soc/nordic/nrf54h/CMakeLists.txt | 4 +--- soc/nordic/nrf54h/Kconfig | 5 ----- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/soc/nordic/nrf54h/CMakeLists.txt b/soc/nordic/nrf54h/CMakeLists.txt index 18d91b508650..23c1cab1e77a 100644 --- a/soc/nordic/nrf54h/CMakeLists.txt +++ b/soc/nordic/nrf54h/CMakeLists.txt @@ -8,9 +8,7 @@ if(CONFIG_ARM) endif() endif() -if(NOT CONFIG_SOC_NRF54H20_PM_S2RAM_OVERRIDE) - zephyr_library_sources_ifdef(CONFIG_PM_S2RAM pm_s2ram.c) -endif() +zephyr_library_sources_ifdef(CONFIG_PM_S2RAM pm_s2ram.c) zephyr_include_directories(.) diff --git a/soc/nordic/nrf54h/Kconfig b/soc/nordic/nrf54h/Kconfig index 0148e6e2687d..b117ee45ad89 100644 --- a/soc/nordic/nrf54h/Kconfig +++ b/soc/nordic/nrf54h/Kconfig @@ -100,11 +100,6 @@ config SOC_NRF54H20_DISABLE_ALL_GPIO_RETENTION_WORKAROUND default y depends on SOC_NRF54H20_CPUAPP || SOC_NRF54H20_CPURAD -config SOC_NRF54H20_PM_S2RAM_OVERRIDE - bool "Override `pm_s2ram` implementation" - help - Override Nordic s2ram implementation. - config SOC_NRF54H20_CPURAD select SOC_NRF54H20_CPURAD_COMMON From 02643966741775f935f1b6f595b001bc3e5a5fd0 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:25 +0300 Subject: [PATCH 0830/2141] Revert "[nrf fromlist] tests: drivers: timer: nrf_grtc_timer: wait for coverage dump" This reverts commit 5408ed3f43481b3e6c031a16c7ea128e8fb1c0ae. Signed-off-by: Jukka Rissanen --- tests/drivers/timer/nrf_grtc_timer/src/main.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/tests/drivers/timer/nrf_grtc_timer/src/main.c b/tests/drivers/timer/nrf_grtc_timer/src/main.c index bcb57519f3b4..e411eba83a0b 100644 --- a/tests/drivers/timer/nrf_grtc_timer/src/main.c +++ b/tests/drivers/timer/nrf_grtc_timer/src/main.c @@ -393,13 +393,6 @@ static void grtc_stress_test(bool busy_sim_en) if (counter_dev) { counter_stop(counter_dev); } - -#ifdef CONFIG_COVERAGE - /* Wait a few seconds before exit, giving the test the - * opportunity to dump some output before coverage data gets emitted - */ - k_sleep(K_MSEC(5000)); -#endif } ZTEST(nrf_grtc_timer, test_stress) From 4ad8ccb77ff79640ae232025ecca1cfdef87c7af Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:25 +0300 Subject: [PATCH 0831/2141] Revert "[nrf fromlist] tests: drivers: timer: nrf_grtc_timer: Add stress test" This reverts commit 0af05cc663896310c0c891322debf4c5519ef17d. Signed-off-by: Jukka Rissanen --- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 17 -- .../boards/nrf54l15dk_nrf54l15_cpuapp.overlay | 32 --- .../nrf54l15dk_nrf54l15_cpuflpr.overlay | 32 --- tests/drivers/timer/nrf_grtc_timer/prj.conf | 6 - tests/drivers/timer/nrf_grtc_timer/src/main.c | 247 ------------------ .../timer/nrf_grtc_timer/testcase.yaml | 37 ++- 6 files changed, 16 insertions(+), 355 deletions(-) delete mode 100644 tests/drivers/timer/nrf_grtc_timer/boards/nrf54l15dk_nrf54l15_cpuapp.overlay delete mode 100644 tests/drivers/timer/nrf_grtc_timer/boards/nrf54l15dk_nrf54l15_cpuflpr.overlay diff --git a/tests/drivers/timer/nrf_grtc_timer/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/timer/nrf_grtc_timer/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index 7ae959267039..04580b71480b 100644 --- a/tests/drivers/timer/nrf_grtc_timer/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/tests/drivers/timer/nrf_grtc_timer/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -2,21 +2,4 @@ &grtc { /delete-property/ child-owned-channels; - interrupts = <109 2>; -}; - -test_timer: &timer131 { - status = "okay"; - interrupts = <419 1>; -}; - -&timer130 { - status = "okay"; - prescaler = <0>; -}; - -/ { - chosen { - zephyr,cpu-load-counter = &timer130; - }; }; diff --git a/tests/drivers/timer/nrf_grtc_timer/boards/nrf54l15dk_nrf54l15_cpuapp.overlay b/tests/drivers/timer/nrf_grtc_timer/boards/nrf54l15dk_nrf54l15_cpuapp.overlay deleted file mode 100644 index 7bcede529b0e..000000000000 --- a/tests/drivers/timer/nrf_grtc_timer/boards/nrf54l15dk_nrf54l15_cpuapp.overlay +++ /dev/null @@ -1,32 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - -&grtc { - interrupts = <228 2>; -}; - -test_timer: &timer21 { - status = "okay"; - interrupts = <203 1>; -}; - -&timer20 { - status = "okay"; - interrupts = <202 0>; -}; - -&timer00 { - status = "okay"; - prescaler = <0>; -}; - -/ { - chosen { - zephyr,cpu-load-counter = &timer00; - }; - - busy-sim { - compatible = "vnd,busy-sim"; - status = "okay"; - counter = <&timer20>; - }; -}; diff --git a/tests/drivers/timer/nrf_grtc_timer/boards/nrf54l15dk_nrf54l15_cpuflpr.overlay b/tests/drivers/timer/nrf_grtc_timer/boards/nrf54l15dk_nrf54l15_cpuflpr.overlay deleted file mode 100644 index cfa72ed02736..000000000000 --- a/tests/drivers/timer/nrf_grtc_timer/boards/nrf54l15dk_nrf54l15_cpuflpr.overlay +++ /dev/null @@ -1,32 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - -&grtc { - /*interrupts = <226 2>;*/ -}; - -test_timer: &timer21 { - status = "okay"; - /*interrupts = <203 2>;*/ -}; - -&timer20 { - status = "okay"; - interrupts = <202 0>; -}; - -&timer00 { - status = "okay"; - prescaler = <0>; -}; - -/ { - chosen { - zephyr,cpu-load-counter = &timer00; - }; - - busy-sim { - compatible = "vnd,busy-sim"; - status = "okay"; - counter = <&timer20>; - }; -}; diff --git a/tests/drivers/timer/nrf_grtc_timer/prj.conf b/tests/drivers/timer/nrf_grtc_timer/prj.conf index 93926f090b7e..dea03477519d 100644 --- a/tests/drivers/timer/nrf_grtc_timer/prj.conf +++ b/tests/drivers/timer/nrf_grtc_timer/prj.conf @@ -1,8 +1,2 @@ CONFIG_ZTEST=y CONFIG_NRF_GRTC_TIMER=y -CONFIG_COUNTER=y -CONFIG_TEST_RANDOM_GENERATOR=y -CONFIG_XOSHIRO_RANDOM_GENERATOR=y -CONFIG_LOG_PRINTK=y -CONFIG_CPU_LOAD=y -CONFIG_CPU_LOAD_USE_COUNTER=y diff --git a/tests/drivers/timer/nrf_grtc_timer/src/main.c b/tests/drivers/timer/nrf_grtc_timer/src/main.c index e411eba83a0b..cede54f026f1 100644 --- a/tests/drivers/timer/nrf_grtc_timer/src/main.c +++ b/tests/drivers/timer/nrf_grtc_timer/src/main.c @@ -5,15 +5,7 @@ */ #include #include -#include -#include -#include -#include -#include -#include -#include #include -LOG_MODULE_REGISTER(test, 1); #define GRTC_SLEW_TICKS 10 #define NUMBER_OF_TRIES 2000 @@ -161,243 +153,4 @@ ZTEST(nrf_grtc_timer, test_timer_abort_in_compare_mode) z_nrf_grtc_timer_chan_free(channel); } -enum test_timer_state { - TIMER_IDLE, - TIMER_PREPARE, - TIMER_ACTIVE -}; - -enum test_ctx { - TEST_HIGH_PRI, - TEST_TIMER_CB, - TEST_THREAD -}; - -struct test_grtc_timer { - struct k_timer timer; - uint32_t ticks; - uint32_t expire; - uint32_t start_cnt; - uint32_t expire_cnt; - uint32_t abort_cnt; - uint32_t exp_expire; - int max_late; - int min_late; - int avg_late; - uint32_t early_cnt; - enum test_timer_state state; -}; - -static atomic_t test_active_cnt; -static struct test_grtc_timer timers[8]; -static uint32_t test_end; -static k_tid_t test_tid; -static volatile bool test_run; -static uint32_t ctx_cnt[3]; -static const char *const ctx_name[] = { "HIGH PRIO ISR", "TIMER CALLBACK", "THREAD" }; - -static bool stress_test_action(int ctx, int id) -{ - struct test_grtc_timer *timer = &timers[id]; - - ctx_cnt[ctx]++; - if (timer->state == TIMER_ACTIVE) { - /* Aborting soon to expire timers from higher interrupt priority may lead - * to test failures. - */ - if (ctx == 0 && (k_timer_remaining_get(&timer->timer) < 5)) { - return true; - } - - if (timer->abort_cnt < timer->expire_cnt / 2) { - bool any_active; - - timer->state = TIMER_PREPARE; - k_timer_stop(&timer->timer); - timer->abort_cnt++; - any_active = atomic_dec(&test_active_cnt) > 1; - timer->state = TIMER_IDLE; - - return any_active; - } - } else if (timer->state == TIMER_IDLE) { - int ticks = 10 + (sys_rand32_get() & 0x3F); - k_timeout_t t = K_TICKS(ticks); - - timer->state = TIMER_PREPARE; - timer->exp_expire = k_ticks_to_cyc_floor32(sys_clock_tick_get_32() + ticks); - timer->ticks = ticks; - k_timer_start(&timer->timer, t, K_NO_WAIT); - atomic_inc(&test_active_cnt); - timer->start_cnt++; - timer->state = TIMER_ACTIVE; - } - - return true; -} - -static void stress_test_actions(int ctx) -{ - uint32_t r = sys_rand32_get(); - int action_cnt = Z_MAX(r & 0x3, 1); - int tmr_id = (r >> 8) % ARRAY_SIZE(timers); - - /* Occasionally wake thread context from which timer actions are also executed. */ - if ((((r >> 2) & 0x3) == 0) || test_active_cnt < 2) { - LOG_DBG("ctx:%d thread wakeup", ctx); - k_wakeup(test_tid); - } - - for (int i = 0; i < action_cnt; i++) { - if (stress_test_action(ctx, tmr_id) == false) { - stress_test_action(ctx, tmr_id); - } - } -} - -static void timer_cb(struct k_timer *timer) -{ - struct test_grtc_timer *test_timer = CONTAINER_OF(timer, struct test_grtc_timer, timer); - uint32_t now = k_cycle_get_32(); - int diff = now - test_timer->exp_expire; - - atomic_dec(&test_active_cnt); - zassert_true(diff >= 0); - test_timer->max_late = MAX(diff, test_timer->max_late); - test_timer->min_late = MIN(diff, test_timer->min_late); - - if (test_timer->expire_cnt == 0) { - test_timer->avg_late = diff; - } else { - test_timer->avg_late = (test_timer->avg_late * test_timer->expire_cnt + diff) / - (test_timer->expire_cnt + 1); - } - - test_timer->expire_cnt++; - test_timer->state = TIMER_IDLE; - - if (test_run) { - stress_test_actions(TEST_TIMER_CB); - } -} - -static void counter_set(const struct device *dev, struct counter_alarm_cfg *cfg) -{ - int err; - uint32_t us = 150 + (sys_rand32_get() & 0x3F); - - cfg->ticks = counter_us_to_ticks(dev, us); - err = counter_set_channel_alarm(dev, 0, cfg); - zassert_equal(err, 0); -} - -static void counter_cb(const struct device *dev, uint8_t chan_id, uint32_t ticks, void *user_data) -{ - struct counter_alarm_cfg *config = user_data; - - if (test_run) { - stress_test_actions(TEST_HIGH_PRI); - counter_set(dev, config); - } -} - -static void report_progress(uint32_t start, uint32_t end) -{ - static uint32_t next_report; - static uint32_t step; - static uint32_t progress; - - if (next_report == 0) { - step = (end - start) / 10; - next_report = start + step; - } - - if (k_uptime_get_32() > next_report) { - next_report += step; - progress += 10; - printk("%d%%\r", progress); - } -} - -static void grtc_stress_test(bool busy_sim_en) -{ - static struct counter_alarm_cfg alarm_cfg; -#if DT_NODE_EXISTS(DT_NODELABEL(test_timer)) && DT_NODE_HAS_STATUS(DT_NODELABEL(test_timer), okay) - const struct device *const counter_dev = DEVICE_DT_GET(DT_NODELABEL(test_timer)); -#else - const struct device *const counter_dev = NULL; -#endif - uint32_t test_ms = 5000; - uint32_t test_start = k_uptime_get_32(); - uint32_t load; - - test_end = k_cycle_get_32() + k_ms_to_cyc_floor32(test_ms); - test_tid = k_current_get(); - - for (size_t i = 0; i < ARRAY_SIZE(timers); i++) { - k_timer_init(&timers[i].timer, timer_cb, NULL); - } - - if (IS_ENABLED(CONFIG_CPU_LOAD)) { - (void)cpu_load_get(true); - } - - if (counter_dev) { - counter_start(counter_dev); - } - - alarm_cfg.callback = counter_cb; - alarm_cfg.user_data = &alarm_cfg; - test_run = true; - - if (counter_dev) { - counter_set(counter_dev, &alarm_cfg); - } - - if (busy_sim_en) { - busy_sim_start(500, 200, 1000, 400, NULL); - } - - LOG_DBG("Starting test, will end at %d", test_end); - while (k_cycle_get_32() < test_end) { - report_progress(test_start, test_start + test_ms); - stress_test_actions(TEST_THREAD); - k_sleep(K_MSEC(test_ms)); - } - - load = IS_ENABLED(CONFIG_CPU_LOAD) ? cpu_load_get(true) : 0; - - test_run = false; - k_msleep(50); - - for (size_t i = 0; i < ARRAY_SIZE(timers); i++) { - zassert_equal(timers[i].state, TIMER_IDLE, "Unexpected timer %d state:%d", - i, timers[i].state); - TC_PRINT("Timer%d (%p)\r\n\tstart_cnt:%d abort_cnt:%d expire_cnt:%d\n", - i, &timers[i], timers[i].start_cnt, timers[i].abort_cnt, - timers[i].expire_cnt); - TC_PRINT("\tavarage late:%d ticks, max late:%d, min late:%d early:%d\n", - timers[i].avg_late, timers[i].max_late, timers[i].min_late, - timers[i].early_cnt); - } - - for (size_t i = 0; i < ARRAY_SIZE(ctx_cnt); i++) { - TC_PRINT("Context: %s executed %d times\n", ctx_name[i], ctx_cnt[i]); - } - TC_PRINT("CPU load during test:%d.%d\n", load / 10, load % 10); - - if (busy_sim_en) { - busy_sim_stop(); - } - - if (counter_dev) { - counter_stop(counter_dev); - } -} - -ZTEST(nrf_grtc_timer, test_stress) -{ - grtc_stress_test(false); -} - ZTEST_SUITE(nrf_grtc_timer, NULL, NULL, NULL, NULL, NULL); diff --git a/tests/drivers/timer/nrf_grtc_timer/testcase.yaml b/tests/drivers/timer/nrf_grtc_timer/testcase.yaml index 140d9b222599..6f4486de913c 100644 --- a/tests/drivers/timer/nrf_grtc_timer/testcase.yaml +++ b/tests/drivers/timer/nrf_grtc_timer/testcase.yaml @@ -1,22 +1,17 @@ -common: - tags: - - drivers - platform_allow: - - nrf54h20dk/nrf54h20/cpuapp - - nrf54h20dk/nrf54h20/cpurad - - nrf54h20dk/nrf54h20/cpuppr - - nrf54l15dk/nrf54l15/cpuapp - - nrf54l15dk/nrf54l15/cpuflpr - - nrf54l15bsim/nrf54l15/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuflpr - - ophelia4ev/nrf54l15/cpuapp - - ophelia4ev/nrf54l15/cpuflpr - integration_platforms: - - nrf54lm20dk/nrf54lm20a/cpuapp - timeout: 30 tests: - drivers.timer.nrf_grtc_timer: {} - drivers.timer.nrf_grtc_timer.no_assert: - extra_configs: - - CONFIG_ASSERT=n + drivers.timer.nrf_grtc_timer: + tags: drivers + platform_allow: + - nrf54h20dk/nrf54h20/cpuapp + - nrf54h20dk/nrf54h20/cpurad + - nrf54h20dk/nrf54h20/cpuppr + - nrf54l15dk/nrf54l15/cpuapp + - nrf54l15dk/nrf54l15/cpuflpr + - nrf54l15bsim/nrf54l15/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuflpr + - ophelia4ev/nrf54l15/cpuapp + - ophelia4ev/nrf54l15/cpuflpr + integration_platforms: + - nrf54lm20dk/nrf54lm20a/cpuapp + timeout: 30 From 01383a07637fdbad184a712cc058958d59642628 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:25 +0300 Subject: [PATCH 0832/2141] Revert "[nrf fromtree] tests: Remove nrf54l09pdk from supported boards" This reverts commit 1a0a42e035ad8e04b0e49aca92f0a3c19e9e2f60. Signed-off-by: Jukka Rissanen --- .../boards/nrf54l09pdk_nrf54l09_cpuapp.conf | 1 + .../clock_control_api/testcase.yaml | 2 + .../nrf_clock_calibration/testcase.yaml | 1 + .../nrf_lf_clock_start/testcase.yaml | 8 ++ .../drivers/clock_control/onoff/testcase.yaml | 1 + .../nrf54l09pdk_nrf54l09_cpuapp.overlay | 34 ++++++++ .../boards/nrf54l09pdk_nrf54l09_cpuapp.conf | 4 + tests/drivers/flash/common/testcase.yaml | 1 + .../flash/negative_tests/testcase.yaml | 1 + .../nrf54l09pdk_nrf54l09_common.overlay | 21 +++++ .../nrf54l09pdk_nrf54l09_cpuapp.overlay | 7 ++ .../nrf54l09pdk_nrf54l09_cpuflpr.overlay | 7 ++ .../boards/nrf54l09pdk_nrf54l09_cpuapp.conf | 1 + .../nrf54l09pdk_nrf54l09_cpuapp.overlay | 22 +++++ tests/drivers/retained_mem/api/testcase.yaml | 1 + .../nrf54l09pdk_nrf54l09_cpuapp.overlay | 9 ++ .../nrf54l09pdk_nrf54l09_cpuapp.overlay | 47 ++++++++++ .../timer/nrf_grtc_timer/testcase.yaml | 2 + .../nrf54l09pdk_nrf54l09_cpuapp.overlay | 26 ++++++ .../nrf54l09pdk_nrf54l09_cpuapp.overlay | 31 +++++++ .../nrf54l09pdk_nrf54l09_cpuflpr.overlay | 31 +++++++ .../nrf54l09pdk_nrf54l09_dual_uart.overlay | 85 +++++++++++++++++++ .../uart/uart_elementary/testcase.yaml | 10 +++ .../nrf54l09pdk_nrf54l09_cpuapp.overlay | 43 ++++++++++ .../uart/uart_mix_fifo_poll/testcase.yaml | 1 + .../nrf54l09pdk_nrf54l09_cpuapp.overlay | 36 ++++++++ tests/drivers/uart/uart_pm/testcase.yaml | 5 ++ .../nrf54l09pdk_nrf54l09_cpuapp.overlay | 9 ++ .../nrf54l09pdk_nrf54l09_cpuflpr.overlay | 9 ++ .../nrf54l09pdk_nrf54l09_cpuapp.overlay | 9 ++ .../watchdog/wdt_error_cases/testcase.yaml | 1 + .../nrf54l09pdk_nrf54l09_cpuapp.overlay | 9 ++ .../watchdog/wdt_variables/testcase.yaml | 1 + .../boards/nrf54l09pdk_nrf54l09_cpuapp.conf | 1 + tests/subsys/fs/fcb/testcase.yaml | 3 +- .../storage/stream/stream_flash/testcase.yaml | 1 + 36 files changed, 480 insertions(+), 1 deletion(-) create mode 100644 tests/drivers/clock_control/clock_control_api/boards/nrf54l09pdk_nrf54l09_cpuapp.conf create mode 100644 tests/drivers/counter/counter_basic_api/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay create mode 100644 tests/drivers/flash/common/boards/nrf54l09pdk_nrf54l09_cpuapp.conf create mode 100644 tests/drivers/gpio/gpio_basic_api/boards/nrf54l09pdk_nrf54l09_common.overlay create mode 100644 tests/drivers/gpio/gpio_basic_api/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay create mode 100644 tests/drivers/gpio/gpio_basic_api/boards/nrf54l09pdk_nrf54l09_cpuflpr.overlay create mode 100644 tests/drivers/retained_mem/api/boards/nrf54l09pdk_nrf54l09_cpuapp.conf create mode 100644 tests/drivers/retained_mem/api/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay create mode 100644 tests/drivers/sensor/temp_sensor/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay create mode 100644 tests/drivers/spi/spi_loopback/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay create mode 100644 tests/drivers/uart/uart_async_api/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay create mode 100644 tests/drivers/uart/uart_elementary/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay create mode 100644 tests/drivers/uart/uart_elementary/boards/nrf54l09pdk_nrf54l09_cpuflpr.overlay create mode 100644 tests/drivers/uart/uart_elementary/boards/nrf54l09pdk_nrf54l09_dual_uart.overlay create mode 100644 tests/drivers/uart/uart_mix_fifo_poll/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay create mode 100644 tests/drivers/uart/uart_pm/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay create mode 100644 tests/drivers/watchdog/wdt_basic_api/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay create mode 100644 tests/drivers/watchdog/wdt_basic_api/boards/nrf54l09pdk_nrf54l09_cpuflpr.overlay create mode 100644 tests/drivers/watchdog/wdt_error_cases/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay create mode 100644 tests/drivers/watchdog/wdt_variables/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay create mode 100644 tests/kernel/timer/timer_behavior/boards/nrf54l09pdk_nrf54l09_cpuapp.conf diff --git a/tests/drivers/clock_control/clock_control_api/boards/nrf54l09pdk_nrf54l09_cpuapp.conf b/tests/drivers/clock_control/clock_control_api/boards/nrf54l09pdk_nrf54l09_cpuapp.conf new file mode 100644 index 000000000000..11d42321cbc3 --- /dev/null +++ b/tests/drivers/clock_control/clock_control_api/boards/nrf54l09pdk_nrf54l09_cpuapp.conf @@ -0,0 +1 @@ +CONFIG_TEST_NRF_HF_STARTUP_TIME_US=1000 diff --git a/tests/drivers/clock_control/clock_control_api/testcase.yaml b/tests/drivers/clock_control/clock_control_api/testcase.yaml index 4578b4282827..4a192e5e3a72 100644 --- a/tests/drivers/clock_control/clock_control_api/testcase.yaml +++ b/tests/drivers/clock_control/clock_control_api/testcase.yaml @@ -21,6 +21,7 @@ tests: - nrf52dk/nrf52832 - nrf52840dk/nrf52840 - nrf9160dk/nrf9160 + - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp @@ -31,6 +32,7 @@ tests: - nrf51dk/nrf51822 - nrf52dk/nrf52832 - nrf52840dk/nrf52840 + - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp diff --git a/tests/drivers/clock_control/nrf_clock_calibration/testcase.yaml b/tests/drivers/clock_control/nrf_clock_calibration/testcase.yaml index 708e563900c2..4600202f0f1b 100644 --- a/tests/drivers/clock_control/nrf_clock_calibration/testcase.yaml +++ b/tests/drivers/clock_control/nrf_clock_calibration/testcase.yaml @@ -8,6 +8,7 @@ tests: - nrf51dk/nrf51822 - nrf52dk/nrf52832 - nrf52840dk/nrf52840 + - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp diff --git a/tests/drivers/clock_control/nrf_lf_clock_start/testcase.yaml b/tests/drivers/clock_control/nrf_lf_clock_start/testcase.yaml index 17a783a48084..0b1f9ae3c931 100644 --- a/tests/drivers/clock_control/nrf_lf_clock_start/testcase.yaml +++ b/tests/drivers/clock_control/nrf_lf_clock_start/testcase.yaml @@ -14,6 +14,7 @@ tests: - nrf9160dk/nrf9160 - nrf5340dk/nrf5340/cpuapp - nrf5340dk/nrf5340/cpunet + - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp @@ -31,6 +32,7 @@ tests: - nrf9160dk/nrf9160 - nrf5340dk/nrf5340/cpuapp - nrf5340dk/nrf5340/cpunet + - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp @@ -64,6 +66,7 @@ tests: - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp - nrf5340dk/nrf5340/cpunet + - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp @@ -80,6 +83,7 @@ tests: - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp - nrf5340dk/nrf5340/cpunet + - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp @@ -96,6 +100,7 @@ tests: - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp - nrf5340dk/nrf5340/cpunet + - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp @@ -112,6 +117,7 @@ tests: - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp - nrf5340dk/nrf5340/cpunet + - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp @@ -128,6 +134,7 @@ tests: - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp - nrf5340dk/nrf5340/cpunet + - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp @@ -144,6 +151,7 @@ tests: - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp - nrf5340dk/nrf5340/cpunet + - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp diff --git a/tests/drivers/clock_control/onoff/testcase.yaml b/tests/drivers/clock_control/onoff/testcase.yaml index 1f557c918ab8..c26eeca5e3d1 100644 --- a/tests/drivers/clock_control/onoff/testcase.yaml +++ b/tests/drivers/clock_control/onoff/testcase.yaml @@ -7,6 +7,7 @@ tests: - nrf51dk/nrf51822 - nrf52dk/nrf52832 - nrf52840dk/nrf52840 + - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - nrf9160dk/nrf9160 diff --git a/tests/drivers/counter/counter_basic_api/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay b/tests/drivers/counter/counter_basic_api/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay new file mode 100644 index 000000000000..54b47926164d --- /dev/null +++ b/tests/drivers/counter/counter_basic_api/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay @@ -0,0 +1,34 @@ +&timer00 { + prescaler = <6>; + status = "okay"; +}; + +&timer10 { + prescaler = <4>; + status = "okay"; +}; + +&timer20 { + prescaler = <4>; + status = "okay"; +}; + +&timer21 { + prescaler = <4>; + status = "okay"; +}; + +&timer22 { + prescaler = <4>; + status = "okay"; +}; + +&timer23 { + prescaler = <4>; + status = "okay"; +}; + +&timer24 { + prescaler = <4>; + status = "okay"; +}; diff --git a/tests/drivers/flash/common/boards/nrf54l09pdk_nrf54l09_cpuapp.conf b/tests/drivers/flash/common/boards/nrf54l09pdk_nrf54l09_cpuapp.conf new file mode 100644 index 000000000000..821a5e77e5b5 --- /dev/null +++ b/tests/drivers/flash/common/boards/nrf54l09pdk_nrf54l09_cpuapp.conf @@ -0,0 +1,4 @@ +CONFIG_FCB=y +CONFIG_FLASH_MAP=y +CONFIG_SETTINGS=y +CONFIG_SETTINGS_FCB=y diff --git a/tests/drivers/flash/common/testcase.yaml b/tests/drivers/flash/common/testcase.yaml index a4e2ac0632ed..0a35ec04cd95 100644 --- a/tests/drivers/flash/common/testcase.yaml +++ b/tests/drivers/flash/common/testcase.yaml @@ -45,6 +45,7 @@ tests: drivers.flash.common.no_explicit_erase: platform_allow: - nrf54l15dk/nrf54l05/cpuapp + - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l10/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54h20dk/nrf54h20/cpuapp diff --git a/tests/drivers/flash/negative_tests/testcase.yaml b/tests/drivers/flash/negative_tests/testcase.yaml index 7a96f4e65e54..7a55212aa3f5 100644 --- a/tests/drivers/flash/negative_tests/testcase.yaml +++ b/tests/drivers/flash/negative_tests/testcase.yaml @@ -6,6 +6,7 @@ tests: drivers.flash.negative_tests: platform_allow: - nrf54h20dk/nrf54h20/cpuapp + - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp diff --git a/tests/drivers/gpio/gpio_basic_api/boards/nrf54l09pdk_nrf54l09_common.overlay b/tests/drivers/gpio/gpio_basic_api/boards/nrf54l09pdk_nrf54l09_common.overlay new file mode 100644 index 000000000000..8eb1b3c9f9ff --- /dev/null +++ b/tests/drivers/gpio/gpio_basic_api/boards/nrf54l09pdk_nrf54l09_common.overlay @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + resources { + compatible = "test-gpio-basic-api"; + out-gpios = <&gpio1 10 0>; + in-gpios = <&gpio1 11 0>; + }; +}; + +&gpiote20 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; diff --git a/tests/drivers/gpio/gpio_basic_api/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay b/tests/drivers/gpio/gpio_basic_api/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay new file mode 100644 index 000000000000..7eee797278b6 --- /dev/null +++ b/tests/drivers/gpio/gpio_basic_api/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay @@ -0,0 +1,7 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "nrf54l09pdk_nrf54l09_common.overlay" diff --git a/tests/drivers/gpio/gpio_basic_api/boards/nrf54l09pdk_nrf54l09_cpuflpr.overlay b/tests/drivers/gpio/gpio_basic_api/boards/nrf54l09pdk_nrf54l09_cpuflpr.overlay new file mode 100644 index 000000000000..b0c42fd3d2ac --- /dev/null +++ b/tests/drivers/gpio/gpio_basic_api/boards/nrf54l09pdk_nrf54l09_cpuflpr.overlay @@ -0,0 +1,7 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "nrf54l09pdk_nrf54l09_common.overlay" diff --git a/tests/drivers/retained_mem/api/boards/nrf54l09pdk_nrf54l09_cpuapp.conf b/tests/drivers/retained_mem/api/boards/nrf54l09pdk_nrf54l09_cpuapp.conf new file mode 100644 index 000000000000..c15ba3ed96da --- /dev/null +++ b/tests/drivers/retained_mem/api/boards/nrf54l09pdk_nrf54l09_cpuapp.conf @@ -0,0 +1 @@ +CONFIG_POWEROFF=y diff --git a/tests/drivers/retained_mem/api/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay b/tests/drivers/retained_mem/api/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay new file mode 100644 index 000000000000..e304ecbbfb13 --- /dev/null +++ b/tests/drivers/retained_mem/api/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay @@ -0,0 +1,22 @@ +/ { + cpuapp_sram@2002e000 { + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0x2002e000 DT_SIZE_K(4)>; + zephyr,memory-region = "RetainedMem"; + status = "okay"; + + retainedmem0: retainedmem { + compatible = "zephyr,retained-ram"; + status = "okay"; + }; + }; + + aliases { + retainedmemtestdevice = &retainedmem0; + }; +}; + +&cpuapp_sram { + reg = <0x20000000 DT_SIZE_K(184)>; + ranges = <0x0 0x20000000 0x2e000>; +}; diff --git a/tests/drivers/retained_mem/api/testcase.yaml b/tests/drivers/retained_mem/api/testcase.yaml index e89ef3953710..88bd6ae16ff4 100644 --- a/tests/drivers/retained_mem/api/testcase.yaml +++ b/tests/drivers/retained_mem/api/testcase.yaml @@ -10,6 +10,7 @@ tests: - nrf5340dk/nrf5340/cpuapp - nrf54h20dk/nrf54h20/cpuapp - nrf54h20dk/nrf54h20/cpurad + - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l05/cpuapp - nrf54l15dk/nrf54l10/cpuapp - nrf54l15dk/nrf54l15/cpuapp diff --git a/tests/drivers/sensor/temp_sensor/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay b/tests/drivers/sensor/temp_sensor/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay new file mode 100644 index 000000000000..b1f2a2b9ec59 --- /dev/null +++ b/tests/drivers/sensor/temp_sensor/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +temp_sensor: &temp { + status = "okay"; +}; diff --git a/tests/drivers/spi/spi_loopback/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay b/tests/drivers/spi/spi_loopback/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay new file mode 100644 index 000000000000..cdb0d0dbcecb --- /dev/null +++ b/tests/drivers/spi/spi_loopback/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + spi21_default: spi21_default { + group1 { + psels = , + , + ; + }; + }; + + spi21_sleep: spi21_sleep { + group1 { + psels = , + , + ; + low-power-enable; + }; + }; +}; + +&spi21 { + status = "okay"; + pinctrl-0 = <&spi21_default>; + pinctrl-1 = <&spi21_sleep>; + pinctrl-names = "default", "sleep"; + overrun-character = <0x00>; + zephyr,pm-device-runtime-auto; + slow@0 { + compatible = "test-spi-loopback-slow"; + reg = <0>; + spi-max-frequency = ; + }; + fast@0 { + compatible = "test-spi-loopback-fast"; + reg = <0>; + spi-max-frequency = ; + }; +}; + +&gpio1 { + status = "okay"; +}; diff --git a/tests/drivers/timer/nrf_grtc_timer/testcase.yaml b/tests/drivers/timer/nrf_grtc_timer/testcase.yaml index 6f4486de913c..8d01344c49cb 100644 --- a/tests/drivers/timer/nrf_grtc_timer/testcase.yaml +++ b/tests/drivers/timer/nrf_grtc_timer/testcase.yaml @@ -5,6 +5,8 @@ tests: - nrf54h20dk/nrf54h20/cpuapp - nrf54h20dk/nrf54h20/cpurad - nrf54h20dk/nrf54h20/cpuppr + - nrf54l09pdk/nrf54l09/cpuapp + - nrf54l09pdk/nrf54l09/cpuflpr - nrf54l15dk/nrf54l15/cpuapp - nrf54l15dk/nrf54l15/cpuflpr - nrf54l15bsim/nrf54l15/cpuapp diff --git a/tests/drivers/uart/uart_async_api/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay b/tests/drivers/uart/uart_async_api/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay new file mode 100644 index 000000000000..ed4a2de1891c --- /dev/null +++ b/tests/drivers/uart/uart_async_api/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay @@ -0,0 +1,26 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +&pinctrl { + uart21_default_alt: uart21_default_alt { + group1 { + psels = , + ; + }; + }; + + uart21_sleep_alt: uart21_sleep_alt { + group1 { + psels = , + ; + low-power-enable; + }; + }; +}; + +dut: &uart21 { + status = "okay"; + pinctrl-0 = <&uart21_default_alt>; + pinctrl-1 = <&uart21_sleep_alt>; + pinctrl-names = "default", "sleep"; + current-speed = <115200>; +}; diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay b/tests/drivers/uart/uart_elementary/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay new file mode 100644 index 000000000000..cf481b7a1614 --- /dev/null +++ b/tests/drivers/uart/uart_elementary/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay @@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +&pinctrl { + uart21_default: uart21_default { + group1 { + psels = , + , + , + ; + }; + }; + + uart21_sleep: uart21_sleep { + group1 { + psels = , + , + , + ; + low-power-enable; + }; + }; +}; + +dut: &uart21 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart21_default>; + pinctrl-1 = <&uart21_sleep>; + pinctrl-names = "default", "sleep"; + hw-flow-control; +}; diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54l09pdk_nrf54l09_cpuflpr.overlay b/tests/drivers/uart/uart_elementary/boards/nrf54l09pdk_nrf54l09_cpuflpr.overlay new file mode 100644 index 000000000000..cf481b7a1614 --- /dev/null +++ b/tests/drivers/uart/uart_elementary/boards/nrf54l09pdk_nrf54l09_cpuflpr.overlay @@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +&pinctrl { + uart21_default: uart21_default { + group1 { + psels = , + , + , + ; + }; + }; + + uart21_sleep: uart21_sleep { + group1 { + psels = , + , + , + ; + low-power-enable; + }; + }; +}; + +dut: &uart21 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart21_default>; + pinctrl-1 = <&uart21_sleep>; + pinctrl-names = "default", "sleep"; + hw-flow-control; +}; diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54l09pdk_nrf54l09_dual_uart.overlay b/tests/drivers/uart/uart_elementary/boards/nrf54l09pdk_nrf54l09_dual_uart.overlay new file mode 100644 index 000000000000..505993a73087 --- /dev/null +++ b/tests/drivers/uart/uart_elementary/boards/nrf54l09pdk_nrf54l09_dual_uart.overlay @@ -0,0 +1,85 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +/ { + chosen { + zephyr,console = &uart30; + zephyr,shell-uart = &uart30; + }; +}; + +&pinctrl { + uart20_default: uart20_default { + group1 { + psels = , + ; + bias-pull-up; + }; + }; + + uart20_sleep: uart20_sleep { + group1 { + psels = , + ; + low-power-enable; + }; + }; + + uart21_default: uart21_default { + group1 { + psels = , + ; + bias-pull-up; + }; + }; + + uart21_sleep: uart21_sleep { + group1 { + psels = , + ; + low-power-enable; + }; + }; + + uart30_default: uart30_default { + group1 { + psels = ; + }; + group2 { + psels = ; + bias-pull-up; + }; + }; + + uart30_sleep: uart30_sleep { + group1 { + psels = , + ; + low-power-enable; + }; + }; +}; + + +&uart30 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart30_default>; + pinctrl-1 = <&uart30_sleep>; + pinctrl-names = "default", "sleep"; +}; + +dut: &uart20 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart20_default>; + pinctrl-1 = <&uart20_sleep>; + pinctrl-names = "default", "sleep"; +}; + +dut_aux: &uart21 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart21_default>; + pinctrl-1 = <&uart21_sleep>; + pinctrl-names = "default", "sleep"; +}; diff --git a/tests/drivers/uart/uart_elementary/testcase.yaml b/tests/drivers/uart/uart_elementary/testcase.yaml index cbf222fa72cf..7afdc874269d 100644 --- a/tests/drivers/uart/uart_elementary/testcase.yaml +++ b/tests/drivers/uart/uart_elementary/testcase.yaml @@ -11,6 +11,8 @@ tests: filter: CONFIG_SERIAL_SUPPORT_INTERRUPT platform_allow: - nrf54h20dk/nrf54h20/cpuapp + - nrf54l09pdk/nrf54l09/cpuapp + - nrf54l09pdk/nrf54l09/cpuflpr - nrf54l15dk/nrf54l15/cpuapp - nrf54l15dk/nrf54l15/cpuflpr - nrf54lm20dk/nrf54lm20a/cpuapp @@ -53,6 +55,8 @@ tests: drivers.uart.uart_elementary_dual_nrf54l: filter: CONFIG_SERIAL_SUPPORT_INTERRUPT platform_allow: + - nrf54l09pdk/nrf54l09/cpuapp + - nrf54l09pdk/nrf54l09/cpuflpr - nrf54l15dk/nrf54l15/cpuapp - nrf54l15dk/nrf54l15/cpuflpr - nrf54lm20dk/nrf54lm20a/cpuapp @@ -60,6 +64,8 @@ tests: - ophelia4ev/nrf54l15/cpuapp - ophelia4ev/nrf54l15/cpuflpr extra_args: + - platform:nrf54l09pdk/nrf54l09/cpuapp:"DTC_OVERLAY_FILE=boards/nrf54l09pdk_nrf54l09_dual_uart.overlay" + - platform:nrf54l09pdk/nrf54l09/cpuflpr:"DTC_OVERLAY_FILE=boards/nrf54l09pdk_nrf54l09_dual_uart.overlay" - platform:nrf54l15dk/nrf54l15/cpuapp:"DTC_OVERLAY_FILE=boards/nrf54l15dk_nrf54l15_dual_uart.overlay" - platform:nrf54l15dk/nrf54l15/cpuflpr:"DTC_OVERLAY_FILE=boards/nrf54l15dk_nrf54l15_dual_uart.overlay" - platform:nrf54lm20dk/nrf54lm20a/cpuapp:"DTC_OVERLAY_FILE=boards/nrf54lm20dk_nrf54lm20a_dual_uart.overlay" @@ -71,6 +77,8 @@ tests: drivers.uart.uart_elementary_dual_setup_mismatch_nrf54l: filter: CONFIG_SERIAL_SUPPORT_INTERRUPT platform_allow: + - nrf54l09pdk/nrf54l09/cpuapp + - nrf54l09pdk/nrf54l09/cpuflpr - nrf54l15dk/nrf54l15/cpuapp - nrf54l15dk/nrf54l15/cpuflpr - nrf54lm20dk/nrf54lm20a/cpuapp @@ -78,6 +86,8 @@ tests: - ophelia4ev/nrf54l15/cpuapp - ophelia4ev/nrf54l15/cpuflpr extra_args: + - platform:nrf54l09pdk/nrf54l09/cpuapp:"DTC_OVERLAY_FILE=boards/nrf54l09pdk_nrf54l09_dual_uart.overlay" + - platform:nrf54l09pdk/nrf54l09/cpuflpr:"DTC_OVERLAY_FILE=boards/nrf54l09pdk_nrf54l09_dual_uart.overlay" - platform:nrf54l15dk/nrf54l15/cpuapp:"DTC_OVERLAY_FILE=boards/nrf54l15dk_nrf54l15_dual_uart.overlay" - platform:nrf54l15dk/nrf54l15/cpuflpr:"DTC_OVERLAY_FILE=boards/nrf54l15dk_nrf54l15_dual_uart.overlay" - platform:nrf54lm20dk/nrf54lm20a/cpuapp:"DTC_OVERLAY_FILE=boards/nrf54lm20dk_nrf54lm20a_dual_uart.overlay" diff --git a/tests/drivers/uart/uart_mix_fifo_poll/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay b/tests/drivers/uart/uart_mix_fifo_poll/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay new file mode 100644 index 000000000000..945b8628e7a6 --- /dev/null +++ b/tests/drivers/uart/uart_mix_fifo_poll/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + uart21_default: uart21_default { + group1 { + psels = , + , + , + ; + }; + }; + + uart21_sleep: uart21_sleep { + group1 { + psels = , + , + , + ; + low-power-enable; + }; + }; +}; + +dut: &uart21 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart21_default>; + pinctrl-1 = <&uart21_sleep>; + pinctrl-names = "default", "sleep"; + hw-flow-control; +}; + +counter_dev: &timer00 { + status = "okay"; +}; + +&grtc { + interrupts = <228 2>; +}; diff --git a/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml b/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml index 0ba5944cca66..fee2d1f46463 100644 --- a/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml +++ b/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml @@ -12,6 +12,7 @@ common: - nrf5340bsim/nrf5340/cpuapp - nrf54h20dk/nrf54h20/cpuapp - nrf54h20dk/nrf54h20/cpurad + - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l15bsim/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp diff --git a/tests/drivers/uart/uart_pm/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay b/tests/drivers/uart/uart_pm/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay new file mode 100644 index 000000000000..033aab401ac0 --- /dev/null +++ b/tests/drivers/uart/uart_pm/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + uart21_default: uart21_default { + group1 { + psels = , + ; + }; + }; + + uart21_sleep: uart21_sleep { + group1 { + psels = , + ; + low-power-enable; + }; + }; +}; + +/ { + chosen { + zephyr,console = &uart20; + }; +}; + +dut: &uart21 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart21_default>; + pinctrl-1 = <&uart21_sleep>; + pinctrl-names = "default", "sleep"; +}; diff --git a/tests/drivers/uart/uart_pm/testcase.yaml b/tests/drivers/uart/uart_pm/testcase.yaml index 008eae9d3d7f..d775e30ae71d 100644 --- a/tests/drivers/uart/uart_pm/testcase.yaml +++ b/tests/drivers/uart/uart_pm/testcase.yaml @@ -8,6 +8,7 @@ common: - nrf52840dk/nrf52840 - nrf5340bsim/nrf5340/cpuapp - nrf54h20dk/nrf54h20/cpuapp + - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l15bsim/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp @@ -35,6 +36,7 @@ tests: - nrf52_bsim - nrf5340bsim/nrf5340/cpuapp - nrf54h20dk/nrf54h20/cpuapp + - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l15bsim/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp @@ -48,6 +50,7 @@ tests: - CONFIG_UART_0_ENHANCED_POLL_OUT=y platform_exclude: - nrf54h20dk/nrf54h20/cpuapp + - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp @@ -67,6 +70,7 @@ tests: - CONFIG_UART_0_ENHANCED_POLL_OUT=y platform_exclude: - nrf54h20dk/nrf54h20/cpuapp + - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp @@ -92,6 +96,7 @@ tests: - CONFIG_UART_0_ENHANCED_POLL_OUT=y platform_exclude: - nrf54h20dk/nrf54h20/cpuapp + - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp diff --git a/tests/drivers/watchdog/wdt_basic_api/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay b/tests/drivers/watchdog/wdt_basic_api/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay new file mode 100644 index 000000000000..dc1ea1a9ddc9 --- /dev/null +++ b/tests/drivers/watchdog/wdt_basic_api/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&wdt31 { + status = "okay"; +}; diff --git a/tests/drivers/watchdog/wdt_basic_api/boards/nrf54l09pdk_nrf54l09_cpuflpr.overlay b/tests/drivers/watchdog/wdt_basic_api/boards/nrf54l09pdk_nrf54l09_cpuflpr.overlay new file mode 100644 index 000000000000..dc1ea1a9ddc9 --- /dev/null +++ b/tests/drivers/watchdog/wdt_basic_api/boards/nrf54l09pdk_nrf54l09_cpuflpr.overlay @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&wdt31 { + status = "okay"; +}; diff --git a/tests/drivers/watchdog/wdt_error_cases/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay b/tests/drivers/watchdog/wdt_error_cases/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay new file mode 100644 index 000000000000..8d3dce3b3800 --- /dev/null +++ b/tests/drivers/watchdog/wdt_error_cases/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&wdt31 { + status = "okay"; +}; diff --git a/tests/drivers/watchdog/wdt_error_cases/testcase.yaml b/tests/drivers/watchdog/wdt_error_cases/testcase.yaml index 438b59e92717..f8da32ca72de 100644 --- a/tests/drivers/watchdog/wdt_error_cases/testcase.yaml +++ b/tests/drivers/watchdog/wdt_error_cases/testcase.yaml @@ -9,6 +9,7 @@ tests: drivers.watchdog.wdt_error_cases: platform_allow: - nrf5340dk/nrf5340/cpuapp + - nrf54l09pdk/nrf54l09/cpuapp - nrf54h20dk/nrf54h20/cpuapp - nrf54h20dk/nrf54h20/cpurad - nrf54l15dk/nrf54l15/cpuapp diff --git a/tests/drivers/watchdog/wdt_variables/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay b/tests/drivers/watchdog/wdt_variables/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay new file mode 100644 index 000000000000..dc1ea1a9ddc9 --- /dev/null +++ b/tests/drivers/watchdog/wdt_variables/boards/nrf54l09pdk_nrf54l09_cpuapp.overlay @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&wdt31 { + status = "okay"; +}; diff --git a/tests/drivers/watchdog/wdt_variables/testcase.yaml b/tests/drivers/watchdog/wdt_variables/testcase.yaml index 434081c499fa..b504cb5b6b8d 100644 --- a/tests/drivers/watchdog/wdt_variables/testcase.yaml +++ b/tests/drivers/watchdog/wdt_variables/testcase.yaml @@ -14,6 +14,7 @@ tests: platform_allow: - nrf54h20dk/nrf54h20/cpuapp - nrf54h20dk/nrf54h20/cpuppr + - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - nrf54lm20dk/nrf54lm20a/cpuflpr diff --git a/tests/kernel/timer/timer_behavior/boards/nrf54l09pdk_nrf54l09_cpuapp.conf b/tests/kernel/timer/timer_behavior/boards/nrf54l09pdk_nrf54l09_cpuapp.conf new file mode 100644 index 000000000000..4b13bc80c7f3 --- /dev/null +++ b/tests/kernel/timer/timer_behavior/boards/nrf54l09pdk_nrf54l09_cpuapp.conf @@ -0,0 +1 @@ +CONFIG_SYS_CLOCK_TICKS_PER_SEC=10000 diff --git a/tests/subsys/fs/fcb/testcase.yaml b/tests/subsys/fs/fcb/testcase.yaml index 572a8fe49a75..c915dd56840b 100644 --- a/tests/subsys/fs/fcb/testcase.yaml +++ b/tests/subsys/fs/fcb/testcase.yaml @@ -12,12 +12,13 @@ tests: - native_sim filesystem.fcb.no_erase: platform_allow: + - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp - native_sim integration_platforms: - - nrf54l15dk/nrf54l15/cpuapp + - nrf54l09pdk/nrf54l09/cpuapp - native_sim filesystem.fcb.native_sim.no_erase: extra_args: CONFIG_FLASH_SIMULATOR_EXPLICIT_ERASE=n diff --git a/tests/subsys/storage/stream/stream_flash/testcase.yaml b/tests/subsys/storage/stream/stream_flash/testcase.yaml index bd53b4438a9e..3dc0a660f2f9 100644 --- a/tests/subsys/storage/stream/stream_flash/testcase.yaml +++ b/tests/subsys/storage/stream/stream_flash/testcase.yaml @@ -22,6 +22,7 @@ tests: # common platforms could bring them here too so filter these out. filter: not dt_compat_enabled("zephyr,sim-flash") platform_allow: + - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - ophelia4ev/nrf54l15/cpuapp extra_configs: From 33bddccc996e2fad16180609970fa6f87b0e2969 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:25 +0300 Subject: [PATCH 0833/2141] Revert "[nrf fromtree] tests: drivers: timer: nrf_grtc_timer: Cleanup after nRF54LM20 rename" This reverts commit 7d4dfc50f2e3be363f8bf2d171d8bfb60e211706. Signed-off-by: Jukka Rissanen --- tests/drivers/timer/nrf_grtc_timer/testcase.yaml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/drivers/timer/nrf_grtc_timer/testcase.yaml b/tests/drivers/timer/nrf_grtc_timer/testcase.yaml index 8d01344c49cb..cd4f99daede0 100644 --- a/tests/drivers/timer/nrf_grtc_timer/testcase.yaml +++ b/tests/drivers/timer/nrf_grtc_timer/testcase.yaml @@ -2,18 +2,20 @@ tests: drivers.timer.nrf_grtc_timer: tags: drivers platform_allow: - - nrf54h20dk/nrf54h20/cpuapp - - nrf54h20dk/nrf54h20/cpurad - - nrf54h20dk/nrf54h20/cpuppr - nrf54l09pdk/nrf54l09/cpuapp - nrf54l09pdk/nrf54l09/cpuflpr - nrf54l15dk/nrf54l15/cpuapp - nrf54l15dk/nrf54l15/cpuflpr - nrf54l15bsim/nrf54l15/cpuapp + - nrf54h20dk/nrf54h20/cpuapp + - nrf54h20dk/nrf54h20/cpurad + - nrf54h20dk/nrf54h20/cpuppr + - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp + - nrf54l20pdk/nrf54l20/cpuflpr - nrf54lm20dk/nrf54lm20a/cpuflpr - ophelia4ev/nrf54l15/cpuapp - ophelia4ev/nrf54l15/cpuflpr integration_platforms: + - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - timeout: 30 From 7fcbf30c09a201c23a2f685a978f130ca30f58dc Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:25 +0300 Subject: [PATCH 0834/2141] Revert "[nrf fromtree] boards: ezurio: Fix RRAM size for nRF54l10 NS" This reverts commit 51e6f94f5b7ff8d9364dff74d09cd37dfe69439d. Signed-off-by: Jukka Rissanen --- .../bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp_ns.dts | 12 ++++++------ .../bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp_ns.yaml | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp_ns.dts b/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp_ns.dts index e7883bcbfaba..02d900390cca 100644 --- a/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp_ns.dts +++ b/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp_ns.dts @@ -32,8 +32,8 @@ / { /* * Default SRAM planning when building for nRF54L10 with ARM TrustZone-M support. - * - Lowest 72 kB SRAM allocated to Secure image (sram0_s). - * - Upper 72 kB SRAM allocated to Non-Secure image (sram0_ns). + * - Lowest 96 kB SRAM allocated to Secure image (sram0_s). + * - Upper 96 kB SRAM allocated to Non-Secure image (sram0_ns). * * nRF54L10 has 192 kB of volatile memory (SRAM) but the last 42kB are reserved for * the FLPR MCU. @@ -63,7 +63,7 @@ compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; - /* nRF54L10 has 1012 kB of non volatile memory (RRAM) but the + /* nRF54L10 has 1022 kB of non volatile memory (RRAM) but the * last 62kB are reserved for the FLPR MCU. * * This static layout needs to be the same with the upstream TF-M layout in the @@ -92,12 +92,12 @@ slot0_ns_partition: partition@6A000 { label = "image-0-nonsecure"; - reg = <0x0006A000 DT_SIZE_K(494)>; + reg = <0x0006A000 DT_SIZE_K(504)>; }; - storage_partition: partition@E5800 { + storage_partition: partition@E8000 { label = "storage"; - reg = <0x000E5800 DT_SIZE_K(32)>; + reg = <0x000E8000 DT_SIZE_K(32)>; }; }; }; diff --git a/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp_ns.yaml b/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp_ns.yaml index 19bb368fc613..d2ad19f03c4a 100644 --- a/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp_ns.yaml +++ b/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp_ns.yaml @@ -11,7 +11,7 @@ toolchain: - zephyr sysbuild: true ram: 192 -flash: 1012 +flash: 1022 supported: - adc - gpio From e8a3554c094cccf870667dbef76284fef98f986a Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:25 +0300 Subject: [PATCH 0835/2141] Revert "[nrf fromtree] boards: nordic: Fix RRAM size for nRF54l10 NS" This reverts commit 481840a0e563d7b16268b992a72c9da663d34219. Signed-off-by: Jukka Rissanen --- .../nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns.dts | 12 ++++++------ .../nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns.yaml | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns.dts b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns.dts index cfb02b6817a5..f1aa851ed2d9 100644 --- a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns.dts +++ b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns.dts @@ -31,8 +31,8 @@ / { /* * Default SRAM planning when building for nRF54L10 with ARM TrustZone-M support. - * - Lowest 72 kB SRAM allocated to Secure image (sram0_s). - * - Upper 72 kB SRAM allocated to Non-Secure image (sram0_ns). + * - Lowest 96 kB SRAM allocated to Secure image (sram0_s). + * - Upper 96 kB SRAM allocated to Non-Secure image (sram0_ns). * * nRF54L10 has 192 kB of volatile memory (SRAM) but the last 42kB are reserved for * the FLPR MCU. @@ -62,7 +62,7 @@ compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; - /* nRF54L10 has 1012 kB of non volatile memory (RRAM) but the + /* nRF54L10 has 1022 kB of non volatile memory (RRAM) but the * last 62kB are reserved for the FLPR MCU. * * This static layout needs to be the same with the upstream TF-M layout in the @@ -91,12 +91,12 @@ slot0_ns_partition: partition@6A000 { label = "image-0-nonsecure"; - reg = <0x0006A000 DT_SIZE_K(494)>; + reg = <0x0006A000 DT_SIZE_K(504)>; }; - storage_partition: partition@E5800 { + storage_partition: partition@E8000 { label = "storage"; - reg = <0x000E5800 DT_SIZE_K(32)>; + reg = <0x000E8000 DT_SIZE_K(32)>; }; }; }; diff --git a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns.yaml b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns.yaml index 22fbcbc32c3c..9f42daedf4e3 100644 --- a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns.yaml +++ b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns.yaml @@ -9,7 +9,7 @@ toolchain: - gnuarmemb - zephyr ram: 192 -flash: 1012 +flash: 1022 supported: - adc - gpio From 8fd129382c9b0b4e9447ad75db1a4a8a73dba4d1 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:25 +0300 Subject: [PATCH 0836/2141] Revert "[nrf fromtree] Revert "boards: nordic: nrf54l10_cpuapp_ns: Add workaround for partitions"" This reverts commit 6d1a118f5e68da9f3378a772313dee1329041c78. Signed-off-by: Jukka Rissanen --- boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp_ns.dts | 3 +++ boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns.dts | 3 +++ 2 files changed, 6 insertions(+) diff --git a/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp_ns.dts b/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp_ns.dts index 02d900390cca..39a986ae2b67 100644 --- a/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp_ns.dts +++ b/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp_ns.dts @@ -59,6 +59,9 @@ }; &cpuapp_rram { + /* TODO: revert this hack when TF-M update is available that fixes partition sizes */ + reg = <0x0 DT_SIZE_K(1022)>; + partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns.dts b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns.dts index f1aa851ed2d9..cd644d845d5e 100644 --- a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns.dts +++ b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns.dts @@ -58,6 +58,9 @@ }; &cpuapp_rram { + /* TODO: revert this hack when TF-M update is available that fixes partition sizes */ + reg = <0x0 DT_SIZE_K(1022)>; + partitions { compatible = "fixed-partitions"; #address-cells = <1>; From 05122c94c841dfeb7472033a1ccece8fa79fa5e9 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:25 +0300 Subject: [PATCH 0837/2141] Revert "[nrf noup] ci: add reopen for manifest-pr action" This reverts commit 96ef102fadde5fc5fb96e0019903c1f085780640. Signed-off-by: Jukka Rissanen --- .github/workflows/manifest-PR.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/manifest-PR.yml b/.github/workflows/manifest-PR.yml index 473301146527..a871aa381ded 100644 --- a/.github/workflows/manifest-PR.yml +++ b/.github/workflows/manifest-PR.yml @@ -1,7 +1,7 @@ name: handle manifest PR on: pull_request_target: - types: [opened, synchronize, closed, reopened] + types: [opened, synchronize, closed] branches: - main From b046c018bcd9a3dc04dc0bd5027ba3bd4ed8c184 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:25 +0300 Subject: [PATCH 0838/2141] Revert "[nrf fromlist] kconfig: Load Kconfig env file better" This reverts commit 25ced410af6caf6fea810b49ef4cf9b3bcb40b2b. Signed-off-by: Jukka Rissanen --- Kconfig.zephyr | 1 + cmake/modules/kconfig.cmake | 5 +---- doc/_extensions/zephyr/kconfig/__init__.py | 6 ++---- scripts/ci/check_compliance.py | 8 ++------ scripts/zephyr_module.py | 18 +++--------------- share/sysbuild/Kconfig | 2 ++ 6 files changed, 11 insertions(+), 29 deletions(-) diff --git a/Kconfig.zephyr b/Kconfig.zephyr index 994730d19332..ace2652550d3 100644 --- a/Kconfig.zephyr +++ b/Kconfig.zephyr @@ -6,6 +6,7 @@ # SPDX-License-Identifier: Apache-2.0 source "Kconfig.constants" +source "$(KCONFIG_ENV_FILE)" osource "$(APPLICATION_SOURCE_DIR)/VERSION" diff --git a/cmake/modules/kconfig.cmake b/cmake/modules/kconfig.cmake index c65f407502a5..1e2cf75f54b2 100644 --- a/cmake/modules/kconfig.cmake +++ b/cmake/modules/kconfig.cmake @@ -132,13 +132,10 @@ endif() # APP_DIR: Path to the main image (sysbuild) or synonym for APPLICATION_SOURCE_DIR (non-sysbuild) zephyr_get(APP_DIR VAR APP_DIR APPLICATION_SOURCE_DIR) -# Load the module Kconfig file into CMake -include("${KCONFIG_BINARY_DIR}/kconfig_module_dirs.cmake") - set(COMMON_KCONFIG_ENV_SETTINGS PYTHON_EXECUTABLE=${PYTHON_EXECUTABLE} + KCONFIG_ENV_FILE=${KCONFIG_BINARY_DIR}/kconfig_module_dirs.env srctree=${ZEPHYR_BASE} - ${kconfig_env_dirs} KERNELVERSION=${KERNELVERSION} APPVERSION=${APP_VERSION_STRING} APP_VERSION_EXTENDED_STRING=${APP_VERSION_EXTENDED_STRING} diff --git a/doc/_extensions/zephyr/kconfig/__init__.py b/doc/_extensions/zephyr/kconfig/__init__.py index 63459a61ade6..a76ac87f887b 100644 --- a/doc/_extensions/zephyr/kconfig/__init__.py +++ b/doc/_extensions/zephyr/kconfig/__init__.py @@ -44,7 +44,6 @@ from typing import Any from docutils import nodes -from dotenv import load_dotenv from sphinx.addnodes import pending_xref from sphinx.application import Sphinx from sphinx.builders import Builder @@ -82,8 +81,7 @@ def kconfig_load(app: Sphinx) -> tuple[kconfiglib.Kconfig, kconfiglib.Kconfig, d sysbuild_kconfig = "" for module in modules: kconfig_module_dirs += zephyr_module.process_kconfig_module_dir(module.project, - module.meta, - False) + module.meta) kconfig += zephyr_module.process_kconfig(module.project, module.meta) sysbuild_kconfig += zephyr_module.process_sysbuildkconfig(module.project, module.meta) @@ -160,7 +158,7 @@ def kconfig_load(app: Sphinx) -> tuple[kconfiglib.Kconfig, kconfiglib.Kconfig, d os.environ["BOARD"] = "boards" os.environ["KCONFIG_BOARD_DIR"] = str(Path(td) / "boards") - load_dotenv(str(Path(td) / "kconfig_module_dirs.env")) + os.environ["KCONFIG_ENV_FILE"] = str(Path(td) / "kconfig_module_dirs.env") # Sysbuild runs first os.environ["CONFIG_"] = "SB_CONFIG_" diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index b0f4ccebb1e2..a557c78af1e7 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -23,8 +23,6 @@ import unidiff import yaml -from dotenv import load_dotenv - from yamllint import config, linter from junitparser import TestCase, TestSuite, JUnitXml, Skipped, Error, Failure @@ -732,14 +730,14 @@ def parse_kconfig(self): os.environ["KCONFIG_BINARY_DIR"] = kconfiglib_dir os.environ['DEVICETREE_CONF'] = "dummy" os.environ['TOOLCHAIN_HAS_NEWLIB'] = "y" - kconfig_env_file = os.path.join(kconfiglib_dir, "kconfig_module_dirs.env") + os.environ['KCONFIG_ENV_FILE'] = os.path.join(kconfiglib_dir, "kconfig_module_dirs.env") # Older name for DEVICETREE_CONF, for compatibility with older Zephyr # versions that don't have the renaming os.environ["GENERATED_DTS_BOARD_CONF"] = "dummy" # For multi repo support - self.get_modules(kconfig_env_file, + self.get_modules(os.environ['KCONFIG_ENV_FILE'], os.path.join(kconfiglib_dir, "Kconfig.modules"), os.path.join(kconfiglib_dir, "Kconfig.sysbuild.modules"), os.path.join(kconfiglib_dir, "settings_file.txt")) @@ -753,8 +751,6 @@ def parse_kconfig(self): # symbols within Kconfig files os.environ["KCONFIG_WARN_UNDEF"] = "y" - load_dotenv(kconfig_env_file) - try: # Note this will both print warnings to stderr _and_ return # them: so some warnings might get printed diff --git a/scripts/zephyr_module.py b/scripts/zephyr_module.py index 8a451db63fa2..8bf2d00793d7 100755 --- a/scripts/zephyr_module.py +++ b/scripts/zephyr_module.py @@ -386,13 +386,10 @@ def kconfig_snippet(meta, path, kconfig_file=None, blobs=False, taint_blobs=Fals return '\n'.join(snippet) -def process_kconfig_module_dir(module, meta, cmake_output): +def process_kconfig_module_dir(module, meta): module_path = PurePath(module) name_sanitized = meta['name-sanitized'] - - if cmake_output is False: - return f'ZEPHYR_{name_sanitized.upper()}_MODULE_DIR={module_path.as_posix()}\n' - return f'list(APPEND kconfig_env_dirs ZEPHYR_{name_sanitized.upper()}_MODULE_DIR={module_path.as_posix()})\n' + return f'ZEPHYR_{name_sanitized.upper()}_MODULE_DIR={module_path.as_posix()}\n' def process_kconfig(module, meta): @@ -868,7 +865,6 @@ def main(): args = parser.parse_args() kconfig_module_dirs = "" - kconfig_module_dirs_cmake = "set(kconfig_env_dirs)\n" kconfig = "" cmake = "" sysbuild_kconfig = "" @@ -881,8 +877,7 @@ def main(): args.modules, args.extra_modules) for module in modules: - kconfig_module_dirs += process_kconfig_module_dir(module.project, module.meta, False) - kconfig_module_dirs_cmake += process_kconfig_module_dir(module.project, module.meta, True) + kconfig_module_dirs += process_kconfig_module_dir(module.project, module.meta) kconfig += process_kconfig(module.project, module.meta) cmake += process_cmake(module.project, module.meta) sysbuild_kconfig += process_sysbuildkconfig( @@ -894,20 +889,13 @@ def main(): if args.kconfig_out or args.sysbuild_kconfig_out: if args.kconfig_out: kconfig_module_dirs_out = PurePath(args.kconfig_out).parent / 'kconfig_module_dirs.env' - kconfig_module_dirs_cmake_out = PurePath(args.kconfig_out).parent / \ - 'kconfig_module_dirs.cmake' elif args.sysbuild_kconfig_out: kconfig_module_dirs_out = PurePath(args.sysbuild_kconfig_out).parent / \ 'kconfig_module_dirs.env' - kconfig_module_dirs_cmake_out = PurePath(args.sysbuild_kconfig_out).parent / \ - 'kconfig_module_dirs.cmake' with open(kconfig_module_dirs_out, 'w', encoding="utf-8") as fp: fp.write(kconfig_module_dirs) - with open(kconfig_module_dirs_cmake_out, 'w', encoding="utf-8") as fp: - fp.write(kconfig_module_dirs_cmake) - if args.kconfig_out: with open(args.kconfig_out, 'w', encoding="utf-8") as fp: fp.write(kconfig) diff --git a/share/sysbuild/Kconfig b/share/sysbuild/Kconfig index 5f689e07399a..6bf51245771f 100644 --- a/share/sysbuild/Kconfig +++ b/share/sysbuild/Kconfig @@ -2,6 +2,8 @@ # # SPDX-License-Identifier: Apache-2.0 +source "$(KCONFIG_ENV_FILE)" + config BOARD string default "$(BOARD)" From 7544f13639a15932e4b5468d02496a968ed725aa Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:26 +0300 Subject: [PATCH 0839/2141] Revert "[nrf fromlist] scripts: requirements: Add python-dotenv" This reverts commit 2fc387e0dd4d8292bdf4f0683a7044639a810f65. Signed-off-by: Jukka Rissanen --- scripts/requirements-actions.in | 1 - scripts/requirements-actions.txt | 4 ---- scripts/requirements-build-test.txt | 2 -- scripts/requirements-compliance.txt | 1 - 4 files changed, 8 deletions(-) diff --git a/scripts/requirements-actions.in b/scripts/requirements-actions.in index 6baf9dc9e3f4..997afed38712 100644 --- a/scripts/requirements-actions.in +++ b/scripts/requirements-actions.in @@ -22,7 +22,6 @@ pykwalify pylint>=3 pyserial pytest -python-dotenv python-magic-bin; sys_platform == "win32" python-magic; sys_platform != "win32" pyyaml diff --git a/scripts/requirements-actions.txt b/scripts/requirements-actions.txt index 21505203bfa6..8c28b2d22f77 100644 --- a/scripts/requirements-actions.txt +++ b/scripts/requirements-actions.txt @@ -880,10 +880,6 @@ python-debian==1.0.1 \ --hash=sha256:3ada9b83a3d671b58081782c0969cffa0102f6ce433fbbc7cf21275b8b5cc771 \ --hash=sha256:8f137c230c1d9279c2ac892b35915068b2aca090c9fd3da5671ff87af32af12c # via reuse -python-dotenv==1.1.1 \ - --hash=sha256:31f23644fe2602f88ff55e1f5c79ba497e01224ee7737937930c448e4d0e24dc \ - --hash=sha256:a8a6399716257f45be6a007360200409fce5cda2661e3dec71d23dc15f6189ab - # via -r requirements-actions.in python-magic==0.4.27 ; sys_platform != 'win32' \ --hash=sha256:c1ba14b08e4a5f5c31a302b7721239695b2f0f058d125bd5ce1ee36b9d9d3c3b \ --hash=sha256:c212960ad306f700aa0d01e5d7a325d20548ff97eb9920dcd29513174f0294d3 diff --git a/scripts/requirements-build-test.txt b/scripts/requirements-build-test.txt index e6264b11ea5e..2ce1227e3e70 100644 --- a/scripts/requirements-build-test.txt +++ b/scripts/requirements-build-test.txt @@ -19,5 +19,3 @@ mypy # used for JUnit XML parsing in CTest harness junitparser>=3.0.0 - -python-dotenv diff --git a/scripts/requirements-compliance.txt b/scripts/requirements-compliance.txt index 6d90ac4b2587..3c3841cf33ed 100644 --- a/scripts/requirements-compliance.txt +++ b/scripts/requirements-compliance.txt @@ -8,7 +8,6 @@ junitparser>=4.0.1 lxml>=5.3.0 pykwalify pylint>=3 -python-dotenv python-magic-bin; sys_platform == "win32" python-magic; sys_platform != "win32" ruff==0.11.11 From bda0c9e1154a492cd635608747291013e0c7af6f Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:26 +0300 Subject: [PATCH 0840/2141] Revert "[nrf fromtree] scripts: ci: check_compliance: no need for lxml anymore" This reverts commit 9a9fe4d379938c28208e0556dc5897dba8de5570. Signed-off-by: Jukka Rissanen --- scripts/ci/check_compliance.py | 8 ++++++++ scripts/requirements-build-test.txt | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index a557c78af1e7..f1da73f3ec0d 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -2288,6 +2288,14 @@ def _main(args): def main(argv=None): args = parse_args(argv) + try: + # pylint: disable=unused-import + from lxml import etree + except ImportError: + print("\nERROR: Python module lxml not installed, unable to proceed") + print("See https://github.com/weiwei/junitparser/issues/99") + return 1 + try: n_fails = _main(args) except BaseException: diff --git a/scripts/requirements-build-test.txt b/scripts/requirements-build-test.txt index 2ce1227e3e70..76cee431f887 100644 --- a/scripts/requirements-build-test.txt +++ b/scripts/requirements-build-test.txt @@ -18,4 +18,4 @@ pytest mypy # used for JUnit XML parsing in CTest harness -junitparser>=3.0.0 +junitparser From 2802e70ad3e6171d11717f3c43413001b4a4d604 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:26 +0300 Subject: [PATCH 0841/2141] Revert "[nrf fromtree] scripts: requirements-action: Require PyGithub >= 2.7.0" This reverts commit e6b70b6612cbb5f5147248223b02c4789b7b98b8. Signed-off-by: Jukka Rissanen --- scripts/requirements-actions.in | 2 +- scripts/requirements-actions.txt | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/scripts/requirements-actions.in b/scripts/requirements-actions.in index 997afed38712..492a1a4fa84f 100644 --- a/scripts/requirements-actions.in +++ b/scripts/requirements-actions.in @@ -17,7 +17,7 @@ natsort ply>=3.10 psutil>=5.6.6 pyelftools>=0.29 -pygithub>=2.7.0 +pygithub pykwalify pylint>=3 pyserial diff --git a/scripts/requirements-actions.txt b/scripts/requirements-actions.txt index 8c28b2d22f77..4a987e9f0ded 100644 --- a/scripts/requirements-actions.txt +++ b/scripts/requirements-actions.txt @@ -302,6 +302,10 @@ cryptography==45.0.5 \ --hash=sha256:e74d30ec9c7cb2f404af331d5b4099a9b322a8a6b25c4632755c8757345baac5 \ --hash=sha256:f3562c2f23c612f2e4a6964a61d942f891d29ee320edb62ff48ffb99f3de9ae8 # via pyjwt +deprecated==1.2.18 \ + --hash=sha256:422b6f6d859da6f2ef57857761bfb392480502a64c3028ca9bbe86085d72115d \ + --hash=sha256:bd5011788200372a32418f888e326a09ff80d0214bd961147cfed01b5c018eec + # via pygithub dill==0.4.0 \ --hash=sha256:0633f1d2df477324f53a895b02c901fb961bdbf65a17122586ea7019292cbcf0 \ --hash=sha256:44f54bf6412c2c8464c14e8243eb163690a9800dbe2c367330883b19c7561049 @@ -812,9 +816,9 @@ pyelftools==0.32 \ --hash=sha256:013df952a006db5e138b1edf6d8a68ecc50630adbd0d83a2d41e7f846163d738 \ --hash=sha256:6de90ee7b8263e740c8715a925382d4099b354f29ac48ea40d840cf7aa14ace5 # via -r requirements-actions.in -pygithub==2.8.1 \ - --hash=sha256:23a0a5bca93baef082e03411bf0ce27204c32be8bfa7abc92fe4a3e132936df0 \ - --hash=sha256:341b7c78521cb07324ff670afd1baa2bf5c286f8d9fd302c1798ba594a5400c9 +pygithub==2.6.1 \ + --hash=sha256:6f2fa6d076ccae475f9fc392cc6cdbd54db985d4f69b8833a28397de75ed6ca3 \ + --hash=sha256:b5c035392991cca63959e9453286b41b54d83bf2de2daa7d7ff7e4312cebf3bf # via -r requirements-actions.in pygments==2.19.2 \ --hash=sha256:636cb2477cec7f8952536970bc533bc43743542f70392ae026374600add5b887 \ @@ -1340,7 +1344,9 @@ wrapt==1.17.2 \ --hash=sha256:f917c1180fdb8623c2b75a99192f4025e412597c50b2ac870f156de8fb101119 \ --hash=sha256:fc78a84e2dfbc27afe4b2bd7c80c8db9bca75cc5b85df52bfe634596a1da846b \ --hash=sha256:ff04ef6eec3eee8a5efef2401495967a916feaa353643defcc03fc74fe213b58 - # via python-can + # via + # deprecated + # python-can xlsxwriter==3.2.5 \ --hash=sha256:4f4824234e1eaf9d95df9a8fe974585ff91d0f5e3d3f12ace5b71e443c1c6abd \ --hash=sha256:7e88469d607cdc920151c0ab3ce9cf1a83992d4b7bc730c5ffdd1a12115a7dbe From 5ecd728d880657e1787bcafd0e0ff741b88f8e27 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:26 +0300 Subject: [PATCH 0842/2141] Revert "[nrf fromtree] scripts: requirements: remove lxml dependency" This reverts commit 37ca03ef3c9b618f44fb2f38acebdb377b3cda55. Signed-off-by: Jukka Rissanen --- scripts/requirements-actions.in | 1 + scripts/requirements-actions.txt | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/requirements-actions.in b/scripts/requirements-actions.in index 492a1a4fa84f..4488b9565d90 100644 --- a/scripts/requirements-actions.in +++ b/scripts/requirements-actions.in @@ -12,6 +12,7 @@ ijson intelhex junit2html junitparser>=4.0.1 +lxml>=5.3.0 mypy natsort ply>=3.10 diff --git a/scripts/requirements-actions.txt b/scripts/requirements-actions.txt index 4a987e9f0ded..a635c73b768e 100644 --- a/scripts/requirements-actions.txt +++ b/scripts/requirements-actions.txt @@ -583,7 +583,9 @@ lxml==6.0.0 \ --hash=sha256:f720a14aa102a38907c6d5030e3d66b3b680c3e6f6bc95473931ea3c00c59967 \ --hash=sha256:f8d19565ae3eb956d84da3ef367aa7def14a2735d05bd275cd54c0301f0d0d6c \ --hash=sha256:f97487996a39cb18278ca33f7be98198f278d0bc3c5d0fd4d7b3d63646ca3c8a - # via gcovr + # via + # -r requirements-actions.in + # gcovr markupsafe==3.0.2 \ --hash=sha256:0bff5e0ae4ef2e1ae4fdf2dfd5b76c75e5c2fa4132d05fc1b0dabcd20c7e28c4 \ --hash=sha256:0f4ca02bea9a23221c0182836703cbf8930c5e9454bacce27e767509fa286a30 \ From 5a08da659515f3af7f40c48d8992730f3abedd02 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:26 +0300 Subject: [PATCH 0843/2141] Revert "[nrf fromtree] scripts: requirements: Remove mock" This reverts commit 6b25d16bb67034e389f4142f4f9325bc3b867ed6. Signed-off-by: Jukka Rissanen --- scripts/requirements-actions.in | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/requirements-actions.in b/scripts/requirements-actions.in index 4488b9565d90..bb499b644a05 100644 --- a/scripts/requirements-actions.in +++ b/scripts/requirements-actions.in @@ -13,6 +13,7 @@ intelhex junit2html junitparser>=4.0.1 lxml>=5.3.0 +mock mypy natsort ply>=3.10 From 4ce20ce17052b85fa55158aaa21a0125deda4d5d Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:26 +0300 Subject: [PATCH 0844/2141] Revert "[nrf fromtree] scripts: requirements: Add back tomli" This reverts commit 70777ba23a9e67553dff61435150da7fe4b4a9d6. Signed-off-by: Jukka Rissanen --- scripts/requirements-actions.txt | 39 -------------------------------- 1 file changed, 39 deletions(-) diff --git a/scripts/requirements-actions.txt b/scripts/requirements-actions.txt index a635c73b768e..cc6873a7061b 100644 --- a/scripts/requirements-actions.txt +++ b/scripts/requirements-actions.txt @@ -1174,45 +1174,6 @@ tabulate==0.9.0 \ --hash=sha256:0095b12bf5966de529c0feb1fa08671671b3368eec77d7ef7ab114be2c068b3c \ --hash=sha256:024ca478df22e9340661486f85298cff5f6dcdba14f3813e8830015b9ed1948f # via -r requirements-actions.in -tomli==2.2.1 ; python_full_version < '3.11' \ - --hash=sha256:023aa114dd824ade0100497eb2318602af309e5a55595f76b626d6d9f3b7b0a6 \ - --hash=sha256:02abe224de6ae62c19f090f68da4e27b10af2b93213d36cf44e6e1c5abd19fdd \ - --hash=sha256:286f0ca2ffeeb5b9bd4fcc8d6c330534323ec51b2f52da063b11c502da16f30c \ - --hash=sha256:2d0f2fdd22b02c6d81637a3c95f8cd77f995846af7414c5c4b8d0545afa1bc4b \ - --hash=sha256:33580bccab0338d00994d7f16f4c4ec25b776af3ffaac1ed74e0b3fc95e885a8 \ - --hash=sha256:400e720fe168c0f8521520190686ef8ef033fb19fc493da09779e592861b78c6 \ - --hash=sha256:40741994320b232529c802f8bc86da4e1aa9f413db394617b9a256ae0f9a7f77 \ - --hash=sha256:465af0e0875402f1d226519c9904f37254b3045fc5084697cefb9bdde1ff99ff \ - --hash=sha256:4a8f6e44de52d5e6c657c9fe83b562f5f4256d8ebbfe4ff922c495620a7f6cea \ - --hash=sha256:4e340144ad7ae1533cb897d406382b4b6fede8890a03738ff1683af800d54192 \ - --hash=sha256:678e4fa69e4575eb77d103de3df8a895e1591b48e740211bd1067378c69e8249 \ - --hash=sha256:6972ca9c9cc9f0acaa56a8ca1ff51e7af152a9f87fb64623e31d5c83700080ee \ - --hash=sha256:7fc04e92e1d624a4a63c76474610238576942d6b8950a2d7f908a340494e67e4 \ - --hash=sha256:889f80ef92701b9dbb224e49ec87c645ce5df3fa2cc548664eb8a25e03127a98 \ - --hash=sha256:8d57ca8095a641b8237d5b079147646153d22552f1c637fd3ba7f4b0b29167a8 \ - --hash=sha256:8dd28b3e155b80f4d54beb40a441d366adcfe740969820caf156c019fb5c7ec4 \ - --hash=sha256:9316dc65bed1684c9a98ee68759ceaed29d229e985297003e494aa825ebb0281 \ - --hash=sha256:a198f10c4d1b1375d7687bc25294306e551bf1abfa4eace6650070a5c1ae2744 \ - --hash=sha256:a38aa0308e754b0e3c67e344754dff64999ff9b513e691d0e786265c93583c69 \ - --hash=sha256:a92ef1a44547e894e2a17d24e7557a5e85a9e1d0048b0b5e7541f76c5032cb13 \ - --hash=sha256:ac065718db92ca818f8d6141b5f66369833d4a80a9d74435a268c52bdfa73140 \ - --hash=sha256:b82ebccc8c8a36f2094e969560a1b836758481f3dc360ce9a3277c65f374285e \ - --hash=sha256:c954d2250168d28797dd4e3ac5cf812a406cd5a92674ee4c8f123c889786aa8e \ - --hash=sha256:cb55c73c5f4408779d0cf3eef9f762b9c9f147a77de7b258bef0a5628adc85cc \ - --hash=sha256:cd45e1dc79c835ce60f7404ec8119f2eb06d38b1deba146f07ced3bbc44505ff \ - --hash=sha256:d3f5614314d758649ab2ab3a62d4f2004c825922f9e370b29416484086b264ec \ - --hash=sha256:d920f33822747519673ee656a4b6ac33e382eca9d331c87770faa3eef562aeb2 \ - --hash=sha256:db2b95f9de79181805df90bedc5a5ab4c165e6ec3fe99f970d0e302f384ad222 \ - --hash=sha256:e59e304978767a54663af13c07b3d1af22ddee3bb2fb0618ca1593e4f593a106 \ - --hash=sha256:e85e99945e688e32d5a35c1ff38ed0b3f41f43fad8df0bdf79f72b2ba7bc5272 \ - --hash=sha256:ece47d672db52ac607a3d9599a9d48dcb2f2f735c6c2d1f34130085bb12b112a \ - --hash=sha256:f4039b9cbc3048b2416cc57ab3bda989a6fcf9b36cf8937f01a6e731b64f80d7 - # via - # mypy - # pylint - # pyproject-api - # pytest - # tox tomlkit==0.13.3 \ --hash=sha256:430cf247ee57df2b94ee3fbe588e71d362a941ebb545dec29b53961d61add2a1 \ --hash=sha256:c89c649d79ee40629a9fda55f8ace8c6a1b42deb912b2a8fd8d942ddadb606b0 From 074cd4430fe17ae723769949c14d90650b867204 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:26 +0300 Subject: [PATCH 0845/2141] Revert "[nrf fromtree] scripts: requirements: drop tomli dependency" This reverts commit e06d9e82cd78b692bbbd99b2997f4e2e4d87444e. Signed-off-by: Jukka Rissanen --- scripts/requirements-actions.in | 1 + scripts/requirements-actions.txt | 40 ++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/scripts/requirements-actions.in b/scripts/requirements-actions.in index bb499b644a05..9d56d56f2a3a 100644 --- a/scripts/requirements-actions.in +++ b/scripts/requirements-actions.in @@ -33,6 +33,7 @@ setuptools>=70.2.0 spdx-tools sphinx-lint tabulate +tomli>=1.1.0 tox tqdm>=4.67.1 unidiff diff --git a/scripts/requirements-actions.txt b/scripts/requirements-actions.txt index cc6873a7061b..1af5b8267d5c 100644 --- a/scripts/requirements-actions.txt +++ b/scripts/requirements-actions.txt @@ -1174,6 +1174,46 @@ tabulate==0.9.0 \ --hash=sha256:0095b12bf5966de529c0feb1fa08671671b3368eec77d7ef7ab114be2c068b3c \ --hash=sha256:024ca478df22e9340661486f85298cff5f6dcdba14f3813e8830015b9ed1948f # via -r requirements-actions.in +tomli==2.2.1 \ + --hash=sha256:023aa114dd824ade0100497eb2318602af309e5a55595f76b626d6d9f3b7b0a6 \ + --hash=sha256:02abe224de6ae62c19f090f68da4e27b10af2b93213d36cf44e6e1c5abd19fdd \ + --hash=sha256:286f0ca2ffeeb5b9bd4fcc8d6c330534323ec51b2f52da063b11c502da16f30c \ + --hash=sha256:2d0f2fdd22b02c6d81637a3c95f8cd77f995846af7414c5c4b8d0545afa1bc4b \ + --hash=sha256:33580bccab0338d00994d7f16f4c4ec25b776af3ffaac1ed74e0b3fc95e885a8 \ + --hash=sha256:400e720fe168c0f8521520190686ef8ef033fb19fc493da09779e592861b78c6 \ + --hash=sha256:40741994320b232529c802f8bc86da4e1aa9f413db394617b9a256ae0f9a7f77 \ + --hash=sha256:465af0e0875402f1d226519c9904f37254b3045fc5084697cefb9bdde1ff99ff \ + --hash=sha256:4a8f6e44de52d5e6c657c9fe83b562f5f4256d8ebbfe4ff922c495620a7f6cea \ + --hash=sha256:4e340144ad7ae1533cb897d406382b4b6fede8890a03738ff1683af800d54192 \ + --hash=sha256:678e4fa69e4575eb77d103de3df8a895e1591b48e740211bd1067378c69e8249 \ + --hash=sha256:6972ca9c9cc9f0acaa56a8ca1ff51e7af152a9f87fb64623e31d5c83700080ee \ + --hash=sha256:7fc04e92e1d624a4a63c76474610238576942d6b8950a2d7f908a340494e67e4 \ + --hash=sha256:889f80ef92701b9dbb224e49ec87c645ce5df3fa2cc548664eb8a25e03127a98 \ + --hash=sha256:8d57ca8095a641b8237d5b079147646153d22552f1c637fd3ba7f4b0b29167a8 \ + --hash=sha256:8dd28b3e155b80f4d54beb40a441d366adcfe740969820caf156c019fb5c7ec4 \ + --hash=sha256:9316dc65bed1684c9a98ee68759ceaed29d229e985297003e494aa825ebb0281 \ + --hash=sha256:a198f10c4d1b1375d7687bc25294306e551bf1abfa4eace6650070a5c1ae2744 \ + --hash=sha256:a38aa0308e754b0e3c67e344754dff64999ff9b513e691d0e786265c93583c69 \ + --hash=sha256:a92ef1a44547e894e2a17d24e7557a5e85a9e1d0048b0b5e7541f76c5032cb13 \ + --hash=sha256:ac065718db92ca818f8d6141b5f66369833d4a80a9d74435a268c52bdfa73140 \ + --hash=sha256:b82ebccc8c8a36f2094e969560a1b836758481f3dc360ce9a3277c65f374285e \ + --hash=sha256:c954d2250168d28797dd4e3ac5cf812a406cd5a92674ee4c8f123c889786aa8e \ + --hash=sha256:cb55c73c5f4408779d0cf3eef9f762b9c9f147a77de7b258bef0a5628adc85cc \ + --hash=sha256:cd45e1dc79c835ce60f7404ec8119f2eb06d38b1deba146f07ced3bbc44505ff \ + --hash=sha256:d3f5614314d758649ab2ab3a62d4f2004c825922f9e370b29416484086b264ec \ + --hash=sha256:d920f33822747519673ee656a4b6ac33e382eca9d331c87770faa3eef562aeb2 \ + --hash=sha256:db2b95f9de79181805df90bedc5a5ab4c165e6ec3fe99f970d0e302f384ad222 \ + --hash=sha256:e59e304978767a54663af13c07b3d1af22ddee3bb2fb0618ca1593e4f593a106 \ + --hash=sha256:e85e99945e688e32d5a35c1ff38ed0b3f41f43fad8df0bdf79f72b2ba7bc5272 \ + --hash=sha256:ece47d672db52ac607a3d9599a9d48dcb2f2f735c6c2d1f34130085bb12b112a \ + --hash=sha256:f4039b9cbc3048b2416cc57ab3bda989a6fcf9b36cf8937f01a6e731b64f80d7 + # via + # -r requirements-actions.in + # mypy + # pylint + # pyproject-api + # pytest + # tox tomlkit==0.13.3 \ --hash=sha256:430cf247ee57df2b94ee3fbe588e71d362a941ebb545dec29b53961d61add2a1 \ --hash=sha256:c89c649d79ee40629a9fda55f8ace8c6a1b42deb912b2a8fd8d942ddadb606b0 From 8214a3b82fc56277ec6cb88f1761b8c4014b2d9d Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:26 +0300 Subject: [PATCH 0846/2141] Revert "[nrf fromtree] scripts: requirements: remove dependency to mock package" This reverts commit 9648cfc0fa26d064bb650573c9ea752b077cb5b8. Signed-off-by: Jukka Rissanen --- scripts/build/check_init_priorities_test.py | 2 +- scripts/requirements-actions.txt | 4 ++++ scripts/requirements-build-test.txt | 3 +++ scripts/tests/build_helpers/test_domains.py | 2 +- scripts/tests/twister/test_cmakecache.py | 2 +- scripts/tests/twister/test_config_parser.py | 2 +- scripts/tests/twister/test_environment.py | 2 +- scripts/tests/twister/test_handlers.py | 2 +- scripts/tests/twister/test_hardwaremap.py | 2 +- scripts/tests/twister/test_harness.py | 2 +- scripts/tests/twister/test_jobserver.py | 2 +- scripts/tests/twister/test_log_helper.py | 2 +- scripts/tests/twister/test_platform.py | 2 +- scripts/tests/twister/test_quarantine.py | 2 +- scripts/tests/twister/test_runner.py | 2 +- scripts/tests/twister/test_scl.py | 2 +- scripts/tests/twister/test_testinstance.py | 2 +- scripts/tests/twister/test_testplan.py | 2 +- scripts/tests/twister/test_testsuite.py | 2 +- scripts/tests/twister/test_twister.py | 2 +- scripts/tests/twister_blackbox/conftest.py | 2 +- scripts/tests/twister_blackbox/test_addon.py | 3 +-- scripts/tests/twister_blackbox/test_config.py | 2 +- scripts/tests/twister_blackbox/test_coverage.py | 2 +- scripts/tests/twister_blackbox/test_device.py | 2 +- scripts/tests/twister_blackbox/test_disable.py | 3 +-- scripts/tests/twister_blackbox/test_error.py | 2 +- scripts/tests/twister_blackbox/test_filter.py | 2 +- scripts/tests/twister_blackbox/test_footprint.py | 2 +- scripts/tests/twister_blackbox/test_hardwaremap.py | 3 +-- scripts/tests/twister_blackbox/test_outfile.py | 2 +- scripts/tests/twister_blackbox/test_output.py | 2 +- scripts/tests/twister_blackbox/test_platform.py | 2 +- scripts/tests/twister_blackbox/test_printouts.py | 2 +- scripts/tests/twister_blackbox/test_quarantine.py | 2 +- scripts/tests/twister_blackbox/test_report.py | 2 +- scripts/tests/twister_blackbox/test_runner.py | 2 +- scripts/tests/twister_blackbox/test_shuffle.py | 2 +- scripts/tests/twister_blackbox/test_testlist.py | 2 +- scripts/tests/twister_blackbox/test_testplan.py | 2 +- scripts/tests/twister_blackbox/test_tooling.py | 3 +-- 41 files changed, 46 insertions(+), 43 deletions(-) diff --git a/scripts/build/check_init_priorities_test.py b/scripts/build/check_init_priorities_test.py index 7ada23498396..16cf9af74065 100755 --- a/scripts/build/check_init_priorities_test.py +++ b/scripts/build/check_init_priorities_test.py @@ -6,7 +6,7 @@ Tests for check_init_priorities """ -from unittest import mock +import mock import pathlib import unittest diff --git a/scripts/requirements-actions.txt b/scripts/requirements-actions.txt index 1af5b8267d5c..7e9250109180 100644 --- a/scripts/requirements-actions.txt +++ b/scripts/requirements-actions.txt @@ -653,6 +653,10 @@ mccabe==0.7.0 \ --hash=sha256:348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325 \ --hash=sha256:6c2d30ab6be0e4a46919781807b4f0d834ebdd6c6e3dca0bda5a15f863427b6e # via pylint +mock==5.2.0 \ + --hash=sha256:4e460e818629b4b173f32d08bf30d3af8123afbb8e04bb5707a1fd4799e503f0 \ + --hash=sha256:7ba87f72ca0e915175596069dbbcc7c75af7b5e9b9bc107ad6349ede0819982f + # via -r requirements-actions.in msgpack==1.1.1 ; sys_platform != 'win32' \ --hash=sha256:196a736f0526a03653d829d7d4c5500a97eea3648aebfd4b6743875f28aa2af8 \ --hash=sha256:1abfc6e949b352dadf4bce0eb78023212ec5ac42f6abfd469ce91d783c149c2a \ diff --git a/scripts/requirements-build-test.txt b/scripts/requirements-build-test.txt index 76cee431f887..0d540dd05c3e 100644 --- a/scripts/requirements-build-test.txt +++ b/scripts/requirements-build-test.txt @@ -17,5 +17,8 @@ coverage pytest mypy +# used for mocking functions in pytest +mock>=4.0.1 + # used for JUnit XML parsing in CTest harness junitparser diff --git a/scripts/tests/build_helpers/test_domains.py b/scripts/tests/build_helpers/test_domains.py index de784734bacf..b22fff449166 100644 --- a/scripts/tests/build_helpers/test_domains.py +++ b/scripts/tests/build_helpers/test_domains.py @@ -6,10 +6,10 @@ Tests for domains.py classes """ +import mock import os import sys from contextlib import nullcontext -from unittest import mock import pytest diff --git a/scripts/tests/twister/test_cmakecache.py b/scripts/tests/twister/test_cmakecache.py index 51a09a581021..ebfb440423b2 100644 --- a/scripts/tests/twister/test_cmakecache.py +++ b/scripts/tests/twister/test_cmakecache.py @@ -6,7 +6,7 @@ Tests for cmakecache.py classes' methods """ -from unittest import mock +import mock import pytest from contextlib import nullcontext diff --git a/scripts/tests/twister/test_config_parser.py b/scripts/tests/twister/test_config_parser.py index dcc1495ab7cd..48a2d5a7db52 100644 --- a/scripts/tests/twister/test_config_parser.py +++ b/scripts/tests/twister/test_config_parser.py @@ -9,7 +9,7 @@ import os import pytest -from unittest import mock +import mock import scl from twisterlib.config_parser import TwisterConfigParser, extract_fields_from_arg_list, ConfigurationError diff --git a/scripts/tests/twister/test_environment.py b/scripts/tests/twister/test_environment.py index 95b799bc8b7c..3a4e090598b0 100644 --- a/scripts/tests/twister/test_environment.py +++ b/scripts/tests/twister/test_environment.py @@ -7,7 +7,7 @@ Tests for environment.py classes' methods """ -from unittest import mock +import mock import os import pytest import shutil diff --git a/scripts/tests/twister/test_handlers.py b/scripts/tests/twister/test_handlers.py index fbe22bb906f9..e4710060a35e 100644 --- a/scripts/tests/twister/test_handlers.py +++ b/scripts/tests/twister/test_handlers.py @@ -8,7 +8,7 @@ """ import itertools -from unittest import mock +import mock import os import pytest import signal diff --git a/scripts/tests/twister/test_hardwaremap.py b/scripts/tests/twister/test_hardwaremap.py index c8f826792115..5dc61dc1d9ec 100644 --- a/scripts/tests/twister/test_hardwaremap.py +++ b/scripts/tests/twister/test_hardwaremap.py @@ -6,7 +6,7 @@ Tests for hardwaremap.py classes' methods """ -from unittest import mock +import mock import pytest import sys diff --git a/scripts/tests/twister/test_harness.py b/scripts/tests/twister/test_harness.py index edc2a96c8a13..3283ff2085ab 100644 --- a/scripts/tests/twister/test_harness.py +++ b/scripts/tests/twister/test_harness.py @@ -6,7 +6,7 @@ """ This test file contains testsuites for the Harness classes of twister """ -from unittest import mock +import mock import sys import os import pytest diff --git a/scripts/tests/twister/test_jobserver.py b/scripts/tests/twister/test_jobserver.py index d365313199d1..554df8545fb2 100644 --- a/scripts/tests/twister/test_jobserver.py +++ b/scripts/tests/twister/test_jobserver.py @@ -7,7 +7,7 @@ """ import functools -from unittest import mock +import mock import os import pytest import sys diff --git a/scripts/tests/twister/test_log_helper.py b/scripts/tests/twister/test_log_helper.py index 31d7c6148da7..9373be5da2f8 100644 --- a/scripts/tests/twister/test_log_helper.py +++ b/scripts/tests/twister/test_log_helper.py @@ -7,7 +7,7 @@ """ import logging -from unittest import mock +import mock import pytest from importlib import reload diff --git a/scripts/tests/twister/test_platform.py b/scripts/tests/twister/test_platform.py index 1ff7f0bb8fd1..cdbfd15d20c5 100644 --- a/scripts/tests/twister/test_platform.py +++ b/scripts/tests/twister/test_platform.py @@ -8,7 +8,7 @@ ''' import sys import os -from unittest import mock +import mock import pytest from contextlib import nullcontext diff --git a/scripts/tests/twister/test_quarantine.py b/scripts/tests/twister/test_quarantine.py index 6165a755544a..ea6b3cf677eb 100644 --- a/scripts/tests/twister/test_quarantine.py +++ b/scripts/tests/twister/test_quarantine.py @@ -6,7 +6,7 @@ Tests for quarantine.py classes' methods """ -from unittest import mock +import mock import os import pytest import textwrap diff --git a/scripts/tests/twister/test_runner.py b/scripts/tests/twister/test_runner.py index 3d2149664cfd..e689095fc7c1 100644 --- a/scripts/tests/twister/test_runner.py +++ b/scripts/tests/twister/test_runner.py @@ -7,7 +7,7 @@ """ import errno -from unittest import mock +import mock import os import pathlib import pytest diff --git a/scripts/tests/twister/test_scl.py b/scripts/tests/twister/test_scl.py index 4a376257b1d8..14a0c447192d 100644 --- a/scripts/tests/twister/test_scl.py +++ b/scripts/tests/twister/test_scl.py @@ -7,7 +7,7 @@ """ import logging -from unittest import mock +import mock import os import pytest import sys diff --git a/scripts/tests/twister/test_testinstance.py b/scripts/tests/twister/test_testinstance.py index df8286fe092b..271d55e76a01 100644 --- a/scripts/tests/twister/test_testinstance.py +++ b/scripts/tests/twister/test_testinstance.py @@ -11,7 +11,7 @@ import os import sys import pytest -from unittest import mock +import mock ZEPHYR_BASE = os.getenv("ZEPHYR_BASE") sys.path.insert(0, os.path.join(ZEPHYR_BASE, "scripts/pylib/twister")) diff --git a/scripts/tests/twister/test_testplan.py b/scripts/tests/twister/test_testplan.py index 62733ed00dd5..73b2673b08ef 100644 --- a/scripts/tests/twister/test_testplan.py +++ b/scripts/tests/twister/test_testplan.py @@ -8,7 +8,7 @@ ''' import sys import os -from unittest import mock +import mock import pytest from contextlib import nullcontext diff --git a/scripts/tests/twister/test_testsuite.py b/scripts/tests/twister/test_testsuite.py index 635b2aaa99fa..83231c0f48ad 100644 --- a/scripts/tests/twister/test_testsuite.py +++ b/scripts/tests/twister/test_testsuite.py @@ -7,7 +7,7 @@ """ import mmap -from unittest import mock +import mock import os import pytest import sys diff --git a/scripts/tests/twister/test_twister.py b/scripts/tests/twister/test_twister.py index 0e5118751dd2..23a3e6d17db2 100644 --- a/scripts/tests/twister/test_twister.py +++ b/scripts/tests/twister/test_twister.py @@ -9,7 +9,7 @@ import os import sys -from unittest import mock +import mock import pytest from pathlib import Path diff --git a/scripts/tests/twister_blackbox/conftest.py b/scripts/tests/twister_blackbox/conftest.py index 615e2f986b77..0fd73927c6fc 100644 --- a/scripts/tests/twister_blackbox/conftest.py +++ b/scripts/tests/twister_blackbox/conftest.py @@ -7,7 +7,7 @@ import logging import shutil -from unittest import mock +import mock import os import pytest import sys diff --git a/scripts/tests/twister_blackbox/test_addon.py b/scripts/tests/twister_blackbox/test_addon.py index bb7fe84b6b88..ecd34501b73c 100644 --- a/scripts/tests/twister_blackbox/test_addon.py +++ b/scripts/tests/twister_blackbox/test_addon.py @@ -7,7 +7,7 @@ """ import importlib -from unittest import mock +import mock import os import pkg_resources import pytest @@ -16,7 +16,6 @@ import subprocess import sys -# pylint: disable=no-name-in-module from conftest import ZEPHYR_BASE, TEST_DATA, sample_filename_mock, testsuite_filename_mock from twisterlib.testplan import TestPlan diff --git a/scripts/tests/twister_blackbox/test_config.py b/scripts/tests/twister_blackbox/test_config.py index 1b34e637ff47..2cad497055f5 100644 --- a/scripts/tests/twister_blackbox/test_config.py +++ b/scripts/tests/twister_blackbox/test_config.py @@ -7,7 +7,7 @@ """ import importlib -from unittest import mock +import mock import os import pytest import sys diff --git a/scripts/tests/twister_blackbox/test_coverage.py b/scripts/tests/twister_blackbox/test_coverage.py index c1f85c05057b..aeb41e63daf3 100644 --- a/scripts/tests/twister_blackbox/test_coverage.py +++ b/scripts/tests/twister_blackbox/test_coverage.py @@ -7,7 +7,7 @@ """ import importlib import re -from unittest import mock +import mock import os import pytest import sys diff --git a/scripts/tests/twister_blackbox/test_device.py b/scripts/tests/twister_blackbox/test_device.py index c35daa337e49..790e0774e300 100644 --- a/scripts/tests/twister_blackbox/test_device.py +++ b/scripts/tests/twister_blackbox/test_device.py @@ -7,7 +7,7 @@ """ import importlib -from unittest import mock +import mock import os import pytest import sys diff --git a/scripts/tests/twister_blackbox/test_disable.py b/scripts/tests/twister_blackbox/test_disable.py index 3cbc7d314289..26e804af9d43 100644 --- a/scripts/tests/twister_blackbox/test_disable.py +++ b/scripts/tests/twister_blackbox/test_disable.py @@ -8,12 +8,11 @@ import importlib import pytest -from unittest import mock +import mock import os import sys import re -# pylint: disable=no-name-in-module from conftest import ZEPHYR_BASE, TEST_DATA, testsuite_filename_mock from twisterlib.testplan import TestPlan diff --git a/scripts/tests/twister_blackbox/test_error.py b/scripts/tests/twister_blackbox/test_error.py index 93d589fefdfc..4a28f7fb178c 100644 --- a/scripts/tests/twister_blackbox/test_error.py +++ b/scripts/tests/twister_blackbox/test_error.py @@ -7,7 +7,7 @@ """ import importlib -from unittest import mock +import mock import os import pytest import sys diff --git a/scripts/tests/twister_blackbox/test_filter.py b/scripts/tests/twister_blackbox/test_filter.py index c65dda1604c3..f7e3ff8f21f5 100644 --- a/scripts/tests/twister_blackbox/test_filter.py +++ b/scripts/tests/twister_blackbox/test_filter.py @@ -7,7 +7,7 @@ """ import importlib -from unittest import mock +import mock import os import pytest import sys diff --git a/scripts/tests/twister_blackbox/test_footprint.py b/scripts/tests/twister_blackbox/test_footprint.py index b9e072a26661..35824d792b18 100644 --- a/scripts/tests/twister_blackbox/test_footprint.py +++ b/scripts/tests/twister_blackbox/test_footprint.py @@ -8,7 +8,7 @@ import importlib import json -from unittest import mock +import mock import os import pytest import sys diff --git a/scripts/tests/twister_blackbox/test_hardwaremap.py b/scripts/tests/twister_blackbox/test_hardwaremap.py index ce3493415a9d..c1f6ff1eaf81 100644 --- a/scripts/tests/twister_blackbox/test_hardwaremap.py +++ b/scripts/tests/twister_blackbox/test_hardwaremap.py @@ -6,12 +6,11 @@ Blackbox tests for twister's command line functions """ import importlib -from unittest import mock +import mock import os import pytest import sys -# pylint: disable=no-name-in-module from conftest import ZEPHYR_BASE, testsuite_filename_mock, clear_log_in_test from twisterlib.testplan import TestPlan diff --git a/scripts/tests/twister_blackbox/test_outfile.py b/scripts/tests/twister_blackbox/test_outfile.py index bdaa5d3291d8..590e0c8f58a7 100644 --- a/scripts/tests/twister_blackbox/test_outfile.py +++ b/scripts/tests/twister_blackbox/test_outfile.py @@ -8,7 +8,7 @@ import importlib import re -from unittest import mock +import mock import os import shutil import pytest diff --git a/scripts/tests/twister_blackbox/test_output.py b/scripts/tests/twister_blackbox/test_output.py index c6a77020638b..5babfa966208 100644 --- a/scripts/tests/twister_blackbox/test_output.py +++ b/scripts/tests/twister_blackbox/test_output.py @@ -8,7 +8,7 @@ import importlib import re -from unittest import mock +import mock import os import pytest import sys diff --git a/scripts/tests/twister_blackbox/test_platform.py b/scripts/tests/twister_blackbox/test_platform.py index 33239d5fcc02..0c644dcff5ae 100644 --- a/scripts/tests/twister_blackbox/test_platform.py +++ b/scripts/tests/twister_blackbox/test_platform.py @@ -8,7 +8,7 @@ import importlib import re -from unittest import mock +import mock import os import pytest import sys diff --git a/scripts/tests/twister_blackbox/test_printouts.py b/scripts/tests/twister_blackbox/test_printouts.py index f383fe09744c..8f07a0fd3aa8 100644 --- a/scripts/tests/twister_blackbox/test_printouts.py +++ b/scripts/tests/twister_blackbox/test_printouts.py @@ -7,7 +7,7 @@ """ import importlib -from unittest import mock +import mock import os import pytest import sys diff --git a/scripts/tests/twister_blackbox/test_quarantine.py b/scripts/tests/twister_blackbox/test_quarantine.py index 63e6de53cc5a..61cfa9634e3e 100644 --- a/scripts/tests/twister_blackbox/test_quarantine.py +++ b/scripts/tests/twister_blackbox/test_quarantine.py @@ -7,7 +7,7 @@ """ import importlib -from unittest import mock +import mock import os import pytest import re diff --git a/scripts/tests/twister_blackbox/test_report.py b/scripts/tests/twister_blackbox/test_report.py index ab2aec447ec1..83d5942c8554 100644 --- a/scripts/tests/twister_blackbox/test_report.py +++ b/scripts/tests/twister_blackbox/test_report.py @@ -8,7 +8,7 @@ import importlib import json -from unittest import mock +import mock import os import pytest import shutil diff --git a/scripts/tests/twister_blackbox/test_runner.py b/scripts/tests/twister_blackbox/test_runner.py index 09286663475b..57ecef3fbfed 100644 --- a/scripts/tests/twister_blackbox/test_runner.py +++ b/scripts/tests/twister_blackbox/test_runner.py @@ -8,7 +8,7 @@ # pylint: disable=duplicate-code import importlib -from unittest import mock +import mock import os import pytest import re diff --git a/scripts/tests/twister_blackbox/test_shuffle.py b/scripts/tests/twister_blackbox/test_shuffle.py index ba19faf64b6e..f45724b7b55e 100644 --- a/scripts/tests/twister_blackbox/test_shuffle.py +++ b/scripts/tests/twister_blackbox/test_shuffle.py @@ -7,7 +7,7 @@ """ import importlib -from unittest import mock +import mock import os import pytest import sys diff --git a/scripts/tests/twister_blackbox/test_testlist.py b/scripts/tests/twister_blackbox/test_testlist.py index 410c417e14cd..ad8eaeddfaf5 100644 --- a/scripts/tests/twister_blackbox/test_testlist.py +++ b/scripts/tests/twister_blackbox/test_testlist.py @@ -7,7 +7,7 @@ """ import importlib -from unittest import mock +import mock import os import pytest import sys diff --git a/scripts/tests/twister_blackbox/test_testplan.py b/scripts/tests/twister_blackbox/test_testplan.py index 701acf94ddf2..8834e03ead03 100644 --- a/scripts/tests/twister_blackbox/test_testplan.py +++ b/scripts/tests/twister_blackbox/test_testplan.py @@ -7,7 +7,7 @@ """ import importlib -from unittest import mock +import mock import os import pytest import sys diff --git a/scripts/tests/twister_blackbox/test_tooling.py b/scripts/tests/twister_blackbox/test_tooling.py index d844ec824de0..3979517e2da5 100644 --- a/scripts/tests/twister_blackbox/test_tooling.py +++ b/scripts/tests/twister_blackbox/test_tooling.py @@ -8,13 +8,12 @@ # pylint: disable=duplicate-code import importlib -from unittest import mock +import mock import os import pytest import sys import json -# pylint: disable=no-name-in-module from conftest import ZEPHYR_BASE, TEST_DATA, sample_filename_mock, testsuite_filename_mock from twisterlib.statuses import TwisterStatus from twisterlib.testplan import TestPlan From 2979fbee87684fbdd8024c346a4961fa2d785c3a Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:26 +0300 Subject: [PATCH 0847/2141] Revert "[nrf fromtree] scripts: tests: apply ruff linting to test_domains.py" This reverts commit e683d5798f4796909e8f573cabffae5a69cd16b0. Signed-off-by: Jukka Rissanen --- scripts/tests/build_helpers/test_domains.py | 96 +++++++++------------ 1 file changed, 41 insertions(+), 55 deletions(-) diff --git a/scripts/tests/build_helpers/test_domains.py b/scripts/tests/build_helpers/test_domains.py index b22fff449166..0ebdeaf6cb2d 100644 --- a/scripts/tests/build_helpers/test_domains.py +++ b/scripts/tests/build_helpers/test_domains.py @@ -8,49 +8,45 @@ import mock import os -import sys -from contextlib import nullcontext - import pytest +import sys ZEPHYR_BASE = os.getenv("ZEPHYR_BASE") sys.path.insert(0, os.path.join(ZEPHYR_BASE, "scripts/pylib/build_helpers")) -import domains # noqa: E402 +import domains + +from contextlib import nullcontext + TESTDATA_1 = [ ('', False, 1, ['domains.yaml file not found: domains.yaml']), ( - """ +""" default: None build_dir: some/dir domains: [] """, - True, - None, - [], + True, None, [] ), ] - @pytest.mark.parametrize( 'f_contents, f_exists, exit_code, expected_logs', TESTDATA_1, - ids=['no file', 'valid'], + ids=['no file', 'valid'] ) def test_from_file(caplog, f_contents, f_exists, exit_code, expected_logs): def mock_open(*args, **kwargs): if f_exists: return mock.mock_open(read_data=f_contents)(args, kwargs) - raise FileNotFoundError('domains.yaml not found.') + raise FileNotFoundError(f'domains.yaml not found.') init_mock = mock.Mock(return_value=None) - with ( - mock.patch('domains.Domains.__init__', init_mock), - mock.patch('builtins.open', mock_open), - pytest.raises(SystemExit) if exit_code else nullcontext() as s_exit, - ): + with mock.patch('domains.Domains.__init__', init_mock), \ + mock.patch('builtins.open', mock_open), \ + pytest.raises(SystemExit) if exit_code else nullcontext() as s_exit: result = domains.Domains.from_file('domains.yaml') if exit_code: @@ -64,7 +60,7 @@ def mock_open(*args, **kwargs): TESTDATA_2 = [ ( - """ +""" default: some default build_dir: my/dir domains: @@ -74,14 +70,10 @@ def mock_open(*args, **kwargs): build_dir: dir/3 flash_order: I don\'t think this is correct """, - 1, - None, - None, - None, - None, + 1, None, None, None, None ), ( - """ +""" build_dir: build/dir domains: - name: a domain @@ -97,15 +89,16 @@ def mock_open(*args, **kwargs): 'build/dir', [('default_domain', 'dir/2'), ('a domain', 'dir/1')], ('default_domain', 'dir/2'), - {'a domain': ('a domain', 'dir/1'), 'default_domain': ('default_domain', 'dir/2')}, + {'a domain': ('a domain', 'dir/1'), + 'default_domain': ('default_domain', 'dir/2')} ), ] - @pytest.mark.parametrize( - 'data, exit_code, expected_build_dir, expected_flash_order, expected_default, expected_domains', + 'data, exit_code, expected_build_dir, expected_flash_order,' \ + ' expected_default, expected_domains', TESTDATA_2, - ids=['invalid', 'valid'], + ids=['invalid', 'valid'] ) def test_from_yaml( caplog, @@ -114,15 +107,13 @@ def test_from_yaml( expected_build_dir, expected_flash_order, expected_default, - expected_domains, + expected_domains ): def mock_domain(name, build_dir, *args, **kwargs): return name, build_dir - with ( - mock.patch('domains.Domain', side_effect=mock_domain), - pytest.raises(SystemExit) if exit_code else nullcontext() as exit_st, - ): + with mock.patch('domains.Domain', side_effect=mock_domain), \ + pytest.raises(SystemExit) if exit_code else nullcontext() as exit_st: doms = domains.Domains.from_yaml(data) if exit_code: @@ -142,40 +133,35 @@ def mock_domain(name, build_dir, *args, **kwargs): ( None, True, - [ - ('some', os.path.join('dir', '2')), - ('order', os.path.join('dir', '1')), - ], + [('some', os.path.join('dir', '2')), + ('order', os.path.join('dir', '1'))] ), ( None, False, - [ - ('order', os.path.join('dir', '1')), - ('some', os.path.join('dir', '2')), - ], + [('order', os.path.join('dir', '1')), + ('some', os.path.join('dir', '2'))] ), ( ['some'], False, - [('some', os.path.join('dir', '2'))], + [('some', os.path.join('dir', '2'))] ), ] - @pytest.mark.parametrize( 'names, default_flash_order, expected_result', TESTDATA_3, - ids=['order only', 'no parameters', 'valid'], + ids=['order only', 'no parameters', 'valid'] ) def test_get_domains( caplog, names, default_flash_order, - expected_result, + expected_result ): doms = domains.Domains( - """ +""" domains: - name: dummy build_dir: dummy @@ -185,11 +171,11 @@ def test_get_domains( ) doms._flash_order = [ ('some', os.path.join('dir', '2')), - ('order', os.path.join('dir', '1')), + ('order', os.path.join('dir', '1')) ] doms._domains = { 'order': ('order', os.path.join('dir', '1')), - 'some': ('some', os.path.join('dir', '2')), + 'some': ('some', os.path.join('dir', '2')) } result = doms.get_domains(names, default_flash_order) @@ -197,36 +183,36 @@ def test_get_domains( assert result == expected_result + TESTDATA_3 = [ ( 'other', 1, ['domain "other" not found, valid domains are: order, some'], - None, + None ), ( 'some', None, [], - ('some', os.path.join('dir', '2')), + ('some', os.path.join('dir', '2')) ), ] - @pytest.mark.parametrize( 'name, exit_code, expected_logs, expected_result', TESTDATA_3, - ids=['domain not found', 'valid'], + ids=['domain not found', 'valid'] ) def test_get_domain( caplog, name, exit_code, expected_logs, - expected_result, + expected_result ): doms = domains.Domains( - """ +""" domains: - name: dummy build_dir: dummy @@ -236,11 +222,11 @@ def test_get_domain( ) doms._flash_order = [ ('some', os.path.join('dir', '2')), - ('order', os.path.join('dir', '1')), + ('order', os.path.join('dir', '1')) ] doms._domains = { 'order': ('order', os.path.join('dir', '1')), - 'some': ('some', os.path.join('dir', '2')), + 'some': ('some', os.path.join('dir', '2')) } with pytest.raises(SystemExit) if exit_code else nullcontext() as s_exit: From cc33f0268681259fd286b0dad291a4c7e72e06b8 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:26 +0300 Subject: [PATCH 0848/2141] Revert "[nrf fromtree] scripts: west_commands: canopen: replace progress by tqdm" This reverts commit 3c345c44e824012c8b9a524b5c214987a674ba0f. Signed-off-by: Jukka Rissanen --- scripts/requirements-actions.in | 2 +- scripts/requirements-actions.txt | 9 ++++----- scripts/requirements-base.txt | 1 + scripts/west_commands/runners/canopen_program.py | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/scripts/requirements-actions.in b/scripts/requirements-actions.in index 9d56d56f2a3a..4bdb9b0fbdad 100644 --- a/scripts/requirements-actions.in +++ b/scripts/requirements-actions.in @@ -17,6 +17,7 @@ mock mypy natsort ply>=3.10 +progress psutil>=5.6.6 pyelftools>=0.29 pygithub @@ -35,7 +36,6 @@ sphinx-lint tabulate tomli>=1.1.0 tox -tqdm>=4.67.1 unidiff vermin west>=0.14.0 diff --git a/scripts/requirements-actions.txt b/scripts/requirements-actions.txt index 7e9250109180..7588db2575f9 100644 --- a/scripts/requirements-actions.txt +++ b/scripts/requirements-actions.txt @@ -261,7 +261,6 @@ colorama==0.4.6 \ # pylint # pytest # tox - # tqdm # west cryptography==45.0.5 \ --hash=sha256:0027d566d65a38497bc37e0dd7c2f8ceda73597d2ac9ba93810204f56f52ebc7 \ @@ -798,6 +797,10 @@ polib==1.2.0 \ --hash=sha256:1c77ee1b81feb31df9bca258cbc58db1bbb32d10214b173882452c73af06d62d \ --hash=sha256:f3ef94aefed6e183e342a8a269ae1fc4742ba193186ad76f175938621dbfc26b # via sphinx-lint +progress==1.6.1 \ + --hash=sha256:5239f22f305c12fdc8ce6e0e47f70f21622a935e16eafc4535617112e7c7ea0b \ + --hash=sha256:c1ba719f862ce885232a759eab47971fe74dfc7bb76ab8a51ef5940bad35086c + # via -r requirements-actions.in psutil==7.0.0 \ --hash=sha256:101d71dc322e3cffd7cea0650b09b3d08b8e7c4109dd6809fe452dfd00e58b25 \ --hash=sha256:1e744154a6580bc968a0195fd25e80432d3afec619daf145b9e5ba16cc1d688e \ @@ -1228,10 +1231,6 @@ tox==4.27.0 \ --hash=sha256:2b8a7fb986b82aa2c830c0615082a490d134e0626dbc9189986da46a313c4f20 \ --hash=sha256:b97d5ecc0c0d5755bcc5348387fef793e1bfa68eb33746412f4c60881d7f5f57 # via -r requirements-actions.in -tqdm==4.67.1 \ - --hash=sha256:26445eca388f82e72884e0d580d5464cd801a3ea01e63e5601bdff9ba6a48de2 \ - --hash=sha256:f8aef9c52c08c13a65f30ea34f4e5aac3fd1a34959879d7e59e63027286627f2 - # via -r requirements-actions.in typing-extensions==4.14.0 \ --hash=sha256:8676b788e32f02ab42d9e7c61324048ae4c6d844a399eebace3d4979d75ceef4 \ --hash=sha256:a1514509136dd0b477638fc68d6a91497af5076466ad0fa6c338e44e359944af diff --git a/scripts/requirements-base.txt b/scripts/requirements-base.txt index 52732068f399..efa58d8c19d7 100644 --- a/scripts/requirements-base.txt +++ b/scripts/requirements-base.txt @@ -16,6 +16,7 @@ pykwalify # used by west_commands canopen packaging +progress patool>=2.0.0 psutil>=5.6.6 pylink-square diff --git a/scripts/west_commands/runners/canopen_program.py b/scripts/west_commands/runners/canopen_program.py index e72b1dbbd665..081a2652bfc5 100644 --- a/scripts/west_commands/runners/canopen_program.py +++ b/scripts/west_commands/runners/canopen_program.py @@ -12,7 +12,7 @@ try: import canopen - from tqdm import tqdm + from progress.bar import Bar MISSING_REQUIREMENTS = False except ImportError: MISSING_REQUIREMENTS = True @@ -284,17 +284,17 @@ def download(self, bin_file): outfile = self.data_sdo.open('wb', buffering=self.download_buffer_size, size=size, block_transfer=self.block_transfer) - progress = tqdm(total=size, unit='B', unit_scale=True) + progress = Bar('%(percent)d%%', max=size, suffix='%(index)d/%(max)dB') while True: chunk = infile.read(self.download_buffer_size // 2) if not chunk: break outfile.write(chunk) - progress.update(len(chunk)) + progress.next(n=len(chunk)) except Exception as err: raise ValueError('Failed to download program') from err finally: - progress.close() + progress.finish() infile.close() outfile.close() From ae9646d61f85bd1871e68e2f9e034dbc86fe4ce8 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:26 +0300 Subject: [PATCH 0849/2141] Revert "[nrf fromtree] scripts: requirements-base: pin patool to >=2.0.0" This reverts commit 68ea99f2febae85ad8639d023d9d223c7d317a04. Signed-off-by: Jukka Rissanen --- scripts/requirements-base.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/requirements-base.txt b/scripts/requirements-base.txt index efa58d8c19d7..2b35d3df097c 100644 --- a/scripts/requirements-base.txt +++ b/scripts/requirements-base.txt @@ -17,7 +17,7 @@ pykwalify canopen packaging progress -patool>=2.0.0 +patool psutil>=5.6.6 pylink-square pyserial From 730575fe5a43368a32fce9a751fd8fd61283b5ec Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:26 +0300 Subject: [PATCH 0850/2141] Revert "[nrf fromtree] Revert "doc: ci: Zephyr now requires Python 3.12 or higher"" This reverts commit 654c27e193d4815a4d984375ddc418f19c582fc4. Signed-off-by: Jukka Rissanen --- cmake/modules/python.cmake | 2 +- doc/develop/getting_started/index.rst | 2 +- doc/releases/migration-guide-4.2.rst | 5 + doc/requirements.txt | 322 ++++++++++----------- scripts/ci/check_compliance.py | 2 +- scripts/requirements-actions.txt | 389 ++++++++++++++------------ 6 files changed, 366 insertions(+), 356 deletions(-) diff --git a/cmake/modules/python.cmake b/cmake/modules/python.cmake index e01d31921202..1438c3fcdaa6 100644 --- a/cmake/modules/python.cmake +++ b/cmake/modules/python.cmake @@ -11,7 +11,7 @@ if (WIN32) set(ENV{PYTHONIOENCODING} "utf-8") endif() -set(PYTHON_MINIMUM_REQUIRED 3.10) +set(PYTHON_MINIMUM_REQUIRED 3.12) if(NOT DEFINED Python3_EXECUTABLE AND DEFINED WEST_PYTHON) set(Python3_EXECUTABLE "${WEST_PYTHON}") diff --git a/doc/develop/getting_started/index.rst b/doc/develop/getting_started/index.rst index 78f43e70b5fd..5ba0d070fcaf 100644 --- a/doc/develop/getting_started/index.rst +++ b/doc/develop/getting_started/index.rst @@ -62,7 +62,7 @@ The current minimum required version for the main dependencies are: - 3.20.5 * - `Python `_ - - 3.10 + - 3.12 * - `Devicetree compiler `_ - 1.4.6 diff --git a/doc/releases/migration-guide-4.2.rst b/doc/releases/migration-guide-4.2.rst index 9b31f4a16348..26e4bd655e7d 100644 --- a/doc/releases/migration-guide-4.2.rst +++ b/doc/releases/migration-guide-4.2.rst @@ -20,6 +20,11 @@ the :ref:`release notes`. :local: :depth: 2 +Common +****** + +* The minimum required Python version is now 3.12 (from 3.10). + Build System ************ diff --git a/doc/requirements.txt b/doc/requirements.txt index 255ff1321a59..3d424a5627ee 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -1,5 +1,5 @@ # This file was autogenerated by uv via the following command: -# uv pip compile --universal --python-version 3.10 --generate-hashes requirements.in --output-file requirements.txt +# uv pip compile --universal --python-version 3.12 --generate-hashes requirements.in --output-file requirements.txt alabaster==1.0.0 \ --hash=sha256:c00dca57bca26fa62a6d7d0a9fcce65f3e026e9bfe33e9c538fd3fbb2144fd9e \ --hash=sha256:fc6786402dc3fcb2de3cabd5fe455a2db534b371124f1f21de8731783dec828b @@ -145,12 +145,6 @@ docutils==0.21.2 \ doxmlparser==1.14.0 \ --hash=sha256:1037dcc4aadf908feb2d908685159972bb2975322fbe2b120f5cac5a938f0b14 # via -r requirements.in -exceptiongroup==1.3.0 ; python_full_version < '3.11' \ - --hash=sha256:4d111e6e0c13d0644cad6ddaa7ed0261a0b36971f6d23e7ec9b4b9097da78a10 \ - --hash=sha256:b241f5885f560bc56a59ee63ca4c6a8bfa46ae4ad651af316d4e81817bb9fd88 - # via - # anyio - # pytest h11==0.16.0 \ --hash=sha256:4e35b956cf45792e4caa5885e69fba00bdbc6ffafbfa020300e549b208ee5ff1 \ --hash=sha256:63cf8bbe7522de3bf65932fda1d9c2772064ffb3dae62d55932da54b31cb6c86 @@ -173,97 +167,139 @@ jinja2==3.1.6 \ --hash=sha256:0137fb05990d35f1275a587e9aee6d56da821fc83491a0fb838183be43f66d6d \ --hash=sha256:85ece4451f492d0c13c5dd7c13a64681a86afae63a5f347908daf103ce6d2f67 # via sphinx -lxml==6.0.0 \ - --hash=sha256:013090383863b72c62a702d07678b658fa2567aa58d373d963cca245b017e065 \ - --hash=sha256:032e65120339d44cdc3efc326c9f660f5f7205f3a535c1fdbf898b29ea01fb72 \ - --hash=sha256:048a930eb4572829604982e39a0c7289ab5dc8abc7fc9f5aabd6fbc08c154e93 \ - --hash=sha256:04d67ceee6db4bcb92987ccb16e53bef6b42ced872509f333c04fb58a3315256 \ - --hash=sha256:059c4cbf3973a621b62ea3132934ae737da2c132a788e6cfb9b08d63a0ef73f9 \ - --hash=sha256:0e32698462aacc5c1cf6bdfebc9c781821b7e74c79f13e5ffc8bfe27c42b1abf \ - --hash=sha256:1676b56d48048a62ef77a250428d1f31f610763636e0784ba67a9740823988ca \ - --hash=sha256:17f090a9bc0ce8da51a5632092f98a7e7f84bca26f33d161a98b57f7fb0004ca \ - --hash=sha256:185efc2fed89cdd97552585c624d3c908f0464090f4b91f7d92f8ed2f3b18f54 \ - --hash=sha256:1fa377b827ca2023244a06554c6e7dc6828a10aaf74ca41965c5d8a4925aebb4 \ - --hash=sha256:2181e4b1d07dde53986023482673c0f1fba5178ef800f9ab95ad791e8bdded6a \ - --hash=sha256:219e0431ea8006e15005767f0351e3f7f9143e793e58519dc97fe9e07fae5563 \ - --hash=sha256:21db1ec5525780fd07251636eb5f7acb84003e9382c72c18c542a87c416ade03 \ - --hash=sha256:246b40f8a4aec341cbbf52617cad8ab7c888d944bfe12a6abd2b1f6cfb6f6082 \ - --hash=sha256:2793a627e95d119e9f1e19720730472f5543a6d84c50ea33313ce328d870f2dd \ - --hash=sha256:2930aa001a3776c3e2601cb8e0a15d21b8270528d89cc308be4843ade546b9ab \ - --hash=sha256:2ae06fbab4f1bb7db4f7c8ca9897dc8db4447d1a2b9bee78474ad403437bcc29 \ - --hash=sha256:2b4790b558bee331a933e08883c423f65bbcd07e278f91b2272489e31ab1e2b4 \ - --hash=sha256:2cfcf84f1defed7e5798ef4f88aa25fcc52d279be731ce904789aa7ccfb7e8d2 \ - --hash=sha256:2dd1cc3ea7e60bfb31ff32cafe07e24839df573a5e7c2d33304082a5019bcd58 \ - --hash=sha256:2f34687222b78fff795feeb799a7d44eca2477c3d9d3a46ce17d51a4f383e32e \ - --hash=sha256:310b719b695b3dd442cdfbbe64936b2f2e231bb91d998e99e6f0daf991a3eba3 \ - --hash=sha256:34190a1ec4f1e84af256495436b2d196529c3f2094f0af80202947567fdbf2e7 \ - --hash=sha256:35bc626eec405f745199200ccb5c6b36f202675d204aa29bb52e27ba2b71dea8 \ - --hash=sha256:36531f81c8214e293097cd2b7873f178997dae33d3667caaae8bdfb9666b76c0 \ - --hash=sha256:390240baeb9f415a82eefc2e13285016f9c8b5ad71ec80574ae8fa9605093cd7 \ - --hash=sha256:40442e2a4456e9910875ac12951476d36c0870dcb38a68719f8c4686609897c4 \ - --hash=sha256:4337e4aec93b7c011f7ee2e357b0d30562edd1955620fdd4aeab6aacd90d43c5 \ - --hash=sha256:43cfbb7db02b30ad3926e8fceaef260ba2fb7df787e38fa2df890c1ca7966c3b \ - --hash=sha256:43fe5af2d590bf4691531b1d9a2495d7aab2090547eaacd224a3afec95706d76 \ - --hash=sha256:46b9ed911f36bfeb6338e0b482e7fe7c27d362c52fde29f221fddbc9ee2227e7 \ - --hash=sha256:4d23854ecf381ab1facc8f353dcd9adeddef3652268ee75297c1164c987c11dc \ - --hash=sha256:4eb114a0754fd00075c12648d991ec7a4357f9cb873042cc9a77bf3a7e30c9db \ - --hash=sha256:4ee56288d0df919e4aac43b539dd0e34bb55d6a12a6562038e8d6f3ed07f9e36 \ - --hash=sha256:51a5e4c61a4541bd1cd3ba74766d0c9b6c12d6a1a4964ef60026832aac8e79b3 \ - --hash=sha256:522fe7abb41309e9543b0d9b8b434f2b630c5fdaf6482bee642b34c8c70079c8 \ - --hash=sha256:54c4855eabd9fc29707d30141be99e5cd1102e7d2258d2892314cf4c110726c3 \ - --hash=sha256:5592401cdf3dc682194727c1ddaa8aa0f3ddc57ca64fd03226a430b955eab6f6 \ - --hash=sha256:58ffd35bd5425c3c3b9692d078bf7ab851441434531a7e517c4984d5634cd65b \ - --hash=sha256:5967fe415b1920a3877a4195e9a2b779249630ee49ece22021c690320ff07452 \ - --hash=sha256:5fcd7d3b1d8ecb91445bd71b9c88bdbeae528fefee4f379895becfc72298d181 \ - --hash=sha256:63b634facdfbad421d4b61c90735688465d4ab3a8853ac22c76ccac2baf98d97 \ - --hash=sha256:690b20e3388a7ec98e899fd54c924e50ba6693874aa65ef9cb53de7f7de9d64a \ - --hash=sha256:6da7cd4f405fd7db56e51e96bff0865b9853ae70df0e6720624049da76bde2da \ - --hash=sha256:7488a43033c958637b1a08cddc9188eb06d3ad36582cebc7d4815980b47e27ef \ - --hash=sha256:74e748012f8c19b47f7d6321ac929a9a94ee92ef12bc4298c47e8b7219b26541 \ - --hash=sha256:78718d8454a6e928470d511bf8ac93f469283a45c354995f7d19e77292f26108 \ - --hash=sha256:7bf61bc4345c1895221357af8f3e89f8c103d93156ef326532d35c707e2fb19d \ - --hash=sha256:7da298e1659e45d151b4028ad5c7974917e108afb48731f4ed785d02b6818994 \ - --hash=sha256:84ef591495ffd3f9dcabffd6391db7bb70d7230b5c35ef5148354a134f56f2be \ - --hash=sha256:85b14a4689d5cff426c12eefe750738648706ea2753b20c2f973b2a000d3d261 \ - --hash=sha256:8a2e76efbf8772add72d002d67a4c3d0958638696f541734304c7f28217a9cab \ - --hash=sha256:8cb26f51c82d77483cdcd2b4a53cda55bbee29b3c2f3ddeb47182a2a9064e4eb \ - --hash=sha256:8db5dc617cb937ae17ff3403c3a70a7de9df4852a046f93e71edaec678f721d0 \ - --hash=sha256:9ab542c91f5a47aaa58abdd8ea84b498e8e49fe4b883d67800017757a3eb78e8 \ - --hash=sha256:9da022c14baeec36edfcc8daf0e281e2f55b950249a455776f0d1adeeada4734 \ - --hash=sha256:9f4b481b6cc3a897adb4279216695150bbe7a44c03daba3c894f49d2037e0a24 \ - --hash=sha256:a52a4704811e2623b0324a18d41ad4b9fabf43ce5ff99b14e40a520e2190c851 \ - --hash=sha256:a55da151d0b0c6ab176b4e761670ac0e2667817a1e0dadd04a01d0561a219349 \ - --hash=sha256:a674c0948789e9136d69065cc28009c1b1874c6ea340253db58be7622ce6398f \ - --hash=sha256:ae74f7c762270196d2dda56f8dd7309411f08a4084ff2dfcc0b095a218df2e06 \ - --hash=sha256:afd27d8629ae94c5d863e32ab0e1d5590371d296b87dae0a751fb22bf3685741 \ - --hash=sha256:b2d71cdefda9424adff9a3607ba5bbfc60ee972d73c21c7e3c19e71037574816 \ - --hash=sha256:b34339898bb556a2351a1830f88f751679f343eabf9cf05841c95b165152c9e7 \ - --hash=sha256:b372d10d17a701b0945f67be58fae4664fd056b85e0ff0fbc1e6c951cdbc0512 \ - --hash=sha256:b3c98d5b24c6095e89e03d65d5c574705be3d49c0d8ca10c17a8a4b5201b72f5 \ - --hash=sha256:b8dd6dd0e9c1992613ccda2bcb74fc9d49159dbe0f0ca4753f37527749885c25 \ - --hash=sha256:bd5913b4972681ffc9718bc2d4c53cde39ef81415e1671ff93e9aa30b46595e7 \ - --hash=sha256:c0b5fa5eda84057a4f1bbb4bb77a8c28ff20ae7ce211588d698ae453e13c6281 \ - --hash=sha256:c16304bba98f48a28ae10e32a8e75c349dd742c45156f297e16eeb1ba9287a1f \ - --hash=sha256:c24b8efd9c0f62bad0439283c2c795ef916c5a6b75f03c17799775c7ae3c0c9e \ - --hash=sha256:c2a5e8d207311a0170aca0eb6b160af91adc29ec121832e4ac151a57743a1e1e \ - --hash=sha256:c352fc8f36f7e9727db17adbf93f82499457b3d7e5511368569b4c5bd155a922 \ - --hash=sha256:c86df1c9af35d903d2b52d22ea3e66db8058d21dc0f59842ca5deb0595921141 \ - --hash=sha256:ca50bd612438258a91b5b3788c6621c1f05c8c478e7951899f492be42defc0da \ - --hash=sha256:d18a25b19ca7307045581b18b3ec9ead2b1db5ccd8719c291f0cd0a5cec6cb81 \ - --hash=sha256:d4f0c66df4386b75d2ab1e20a489f30dc7fd9a06a896d64980541506086be1f1 \ - --hash=sha256:d7ae472f74afcc47320238b5dbfd363aba111a525943c8a34a1b657c6be934c3 \ - --hash=sha256:db0efd6bae1c4730b9c863fc4f5f3c0fa3e8f05cae2c44ae141cb9dfc7d091dc \ - --hash=sha256:dbdd7679a6f4f08152818043dbb39491d1af3332128b3752c3ec5cebc0011a72 \ - --hash=sha256:e0b1520ef900e9ef62e392dd3d7ae4f5fa224d1dd62897a792cf353eb20b6cae \ - --hash=sha256:e2030956cf4886b10be9a0285c6802e078ec2391e1dd7ff3eb509c2c95a69b76 \ - --hash=sha256:e35e8aaaf3981489f42884b59726693de32dabfc438ac10ef4eb3409961fd402 \ - --hash=sha256:e380e85b93f148ad28ac15f8117e2fd8e5437aa7732d65e260134f83ce67911b \ - --hash=sha256:edf6e4c8fe14dfe316939711e3ece3f9a20760aabf686051b537a7562f4da91a \ - --hash=sha256:f3389924581d9a770c6caa4df4e74b606180869043b9073e2cec324bad6e306e \ - --hash=sha256:f64ccf593916e93b8d36ed55401bb7fe9c7d5de3180ce2e10b08f82a8f397316 \ - --hash=sha256:f720a14aa102a38907c6d5030e3d66b3b680c3e6f6bc95473931ea3c00c59967 \ - --hash=sha256:f8d19565ae3eb956d84da3ef367aa7def14a2735d05bd275cd54c0301f0d0d6c \ - --hash=sha256:f97487996a39cb18278ca33f7be98198f278d0bc3c5d0fd4d7b3d63646ca3c8a +lxml==5.4.0 \ + --hash=sha256:00b8686694423ddae324cf614e1b9659c2edb754de617703c3d29ff568448df5 \ + --hash=sha256:073eb6dcdf1f587d9b88c8c93528b57eccda40209cf9be549d469b942b41d70b \ + --hash=sha256:09846782b1ef650b321484ad429217f5154da4d6e786636c38e434fa32e94e49 \ + --hash=sha256:0a01ce7d8479dce84fc03324e3b0c9c90b1ece9a9bb6a1b6c9025e7e4520e78c \ + --hash=sha256:0be91891bdb06ebe65122aa6bf3fc94489960cf7e03033c6f83a90863b23c58b \ + --hash=sha256:0cef4feae82709eed352cd7e97ae062ef6ae9c7b5dbe3663f104cd2c0e8d94ba \ + --hash=sha256:0e108352e203c7afd0eb91d782582f00a0b16a948d204d4dec8565024fafeea5 \ + --hash=sha256:0ea0252b51d296a75f6118ed0d8696888e7403408ad42345d7dfd0d1e93309a7 \ + --hash=sha256:0fce1294a0497edb034cb416ad3e77ecc89b313cff7adbee5334e4dc0d11f422 \ + --hash=sha256:1320091caa89805df7dcb9e908add28166113dcd062590668514dbd510798c88 \ + --hash=sha256:142accb3e4d1edae4b392bd165a9abdee8a3c432a2cca193df995bc3886249c8 \ + --hash=sha256:14479c2ad1cb08b62bb941ba8e0e05938524ee3c3114644df905d2331c76cd57 \ + --hash=sha256:151d6c40bc9db11e960619d2bf2ec5829f0aaffb10b41dcf6ad2ce0f3c0b2325 \ + --hash=sha256:15a665ad90054a3d4f397bc40f73948d48e36e4c09f9bcffc7d90c87410e478a \ + --hash=sha256:1a42b3a19346e5601d1b8296ff6ef3d76038058f311902edd574461e9c036982 \ + --hash=sha256:1af80c6316ae68aded77e91cd9d80648f7dd40406cef73df841aa3c36f6907c8 \ + --hash=sha256:1b717b00a71b901b4667226bba282dd462c42ccf618ade12f9ba3674e1fabc55 \ + --hash=sha256:1dc4ca99e89c335a7ed47d38964abcb36c5910790f9bd106f2a8fa2ee0b909d2 \ + --hash=sha256:20e16c08254b9b6466526bc1828d9370ee6c0d60a4b64836bc3ac2917d1e16df \ + --hash=sha256:226046e386556a45ebc787871d6d2467b32c37ce76c2680f5c608e25823ffc84 \ + --hash=sha256:24974f774f3a78ac12b95e3a20ef0931795ff04dbb16db81a90c37f589819551 \ + --hash=sha256:24f6df5f24fc3385f622c0c9d63fe34604893bc1a5bdbb2dbf5870f85f9a404a \ + --hash=sha256:27a9ded0f0b52098ff89dd4c418325b987feed2ea5cc86e8860b0f844285d740 \ + --hash=sha256:29f451a4b614a7b5b6c2e043d7b64a15bd8304d7e767055e8ab68387a8cacf4e \ + --hash=sha256:2b31a3a77501d86d8ade128abb01082724c0dfd9524f542f2f07d693c9f1175f \ + --hash=sha256:2c62891b1ea3094bb12097822b3d44b93fc6c325f2043c4d2736a8ff09e65f60 \ + --hash=sha256:2dc191e60425ad70e75a68c9fd90ab284df64d9cd410ba8d2b641c0c45bc006e \ + --hash=sha256:31e63621e073e04697c1b2d23fcb89991790eef370ec37ce4d5d469f40924ed6 \ + --hash=sha256:32697d2ea994e0db19c1df9e40275ffe84973e4232b5c274f47e7c1ec9763cdd \ + --hash=sha256:3a3178b4873df8ef9457a4875703488eb1622632a9cee6d76464b60e90adbfcd \ + --hash=sha256:3b9c2754cef6963f3408ab381ea55f47dabc6f78f4b8ebb0f0b25cf1ac1f7609 \ + --hash=sha256:3d3c30ba1c9b48c68489dc1829a6eede9873f52edca1dda900066542528d6b20 \ + --hash=sha256:3e6d5557989cdc3ebb5302bbdc42b439733a841891762ded9514e74f60319ad6 \ + --hash=sha256:4025bf2884ac4370a3243c5aa8d66d3cb9e15d3ddd0af2d796eccc5f0244390e \ + --hash=sha256:4291d3c409a17febf817259cb37bc62cb7eb398bcc95c1356947e2871911ae61 \ + --hash=sha256:4329422de653cdb2b72afa39b0aa04252fca9071550044904b2e7036d9d97fe4 \ + --hash=sha256:43d549b876ce64aa18b2328faff70f5877f8c6dede415f80a2f799d31644d776 \ + --hash=sha256:460508a4b07364d6abf53acaa0a90b6d370fafde5693ef37602566613a9b0779 \ + --hash=sha256:47fb24cc0f052f0576ea382872b3fc7e1f7e3028e53299ea751839418ade92a6 \ + --hash=sha256:48b4afaf38bf79109bb060d9016fad014a9a48fb244e11b94f74ae366a64d252 \ + --hash=sha256:497cab4d8254c2a90bf988f162ace2ddbfdd806fce3bda3f581b9d24c852e03c \ + --hash=sha256:4aa412a82e460571fad592d0f93ce9935a20090029ba08eca05c614f99b0cc92 \ + --hash=sha256:4b7ce10634113651d6f383aa712a194179dcd496bd8c41e191cec2099fa09de5 \ + --hash=sha256:4cd915c0fb1bed47b5e6d6edd424ac25856252f09120e3e8ba5154b6b921860e \ + --hash=sha256:4d885698f5019abe0de3d352caf9466d5de2baded00a06ef3f1216c1a58ae78f \ + --hash=sha256:4f5322cf38fe0e21c2d73901abf68e6329dc02a4994e483adbcf92b568a09a54 \ + --hash=sha256:50441c9de951a153c698b9b99992e806b71c1f36d14b154592580ff4a9d0d877 \ + --hash=sha256:529024ab3a505fed78fe3cc5ddc079464e709f6c892733e3f5842007cec8ac6e \ + --hash=sha256:53370c26500d22b45182f98847243efb518d268374a9570409d2e2276232fd37 \ + --hash=sha256:53d9469ab5460402c19553b56c3648746774ecd0681b1b27ea74d5d8a3ef5590 \ + --hash=sha256:56dbdbab0551532bb26c19c914848d7251d73edb507c3079d6805fa8bba5b706 \ + --hash=sha256:5a99d86351f9c15e4a901fc56404b485b1462039db59288b203f8c629260a142 \ + --hash=sha256:5cca36a194a4eb4e2ed6be36923d3cffd03dcdf477515dea687185506583d4c9 \ + --hash=sha256:5f11a1526ebd0dee85e7b1e39e39a0cc0d9d03fb527f56d8457f6df48a10dc0c \ + --hash=sha256:61c7bbf432f09ee44b1ccaa24896d21075e533cd01477966a5ff5a71d88b2f56 \ + --hash=sha256:639978bccb04c42677db43c79bdaa23785dc7f9b83bfd87570da8207872f1ce5 \ + --hash=sha256:63e7968ff83da2eb6fdda967483a7a023aa497d85ad8f05c3ad9b1f2e8c84987 \ + --hash=sha256:664cdc733bc87449fe781dbb1f309090966c11cc0c0cd7b84af956a02a8a4729 \ + --hash=sha256:67ed8a40665b84d161bae3181aa2763beea3747f748bca5874b4af4d75998f87 \ + --hash=sha256:67f779374c6b9753ae0a0195a892a1c234ce8416e4448fe1e9f34746482070a7 \ + --hash=sha256:6854f8bd8a1536f8a1d9a3655e6354faa6406621cf857dc27b681b69860645c7 \ + --hash=sha256:696ea9e87442467819ac22394ca36cb3d01848dad1be6fac3fb612d3bd5a12cf \ + --hash=sha256:6ef80aeac414f33c24b3815ecd560cee272786c3adfa5f31316d8b349bfade28 \ + --hash=sha256:72ac9762a9f8ce74c9eed4a4e74306f2f18613a6b71fa065495a67ac227b3056 \ + --hash=sha256:75133890e40d229d6c5837b0312abbe5bac1c342452cf0e12523477cd3aa21e7 \ + --hash=sha256:7605c1c32c3d6e8c990dd28a0970a3cbbf1429d5b92279e37fda05fb0c92190e \ + --hash=sha256:773e27b62920199c6197130632c18fb7ead3257fce1ffb7d286912e56ddb79e0 \ + --hash=sha256:795f61bcaf8770e1b37eec24edf9771b307df3af74d1d6f27d812e15a9ff3872 \ + --hash=sha256:79d5bfa9c1b455336f52343130b2067164040604e41f6dc4d8313867ed540079 \ + --hash=sha256:7a62cc23d754bb449d63ff35334acc9f5c02e6dae830d78dab4dd12b78a524f4 \ + --hash=sha256:7be701c24e7f843e6788353c055d806e8bd8466b52907bafe5d13ec6a6dbaecd \ + --hash=sha256:7ca56ebc2c474e8f3d5761debfd9283b8b18c76c4fc0967b74aeafba1f5647f9 \ + --hash=sha256:7ce1a171ec325192c6a636b64c94418e71a1964f56d002cc28122fceff0b6121 \ + --hash=sha256:891f7f991a68d20c75cb13c5c9142b2a3f9eb161f1f12a9489c82172d1f133c0 \ + --hash=sha256:8f82125bc7203c5ae8633a7d5d20bcfdff0ba33e436e4ab0abc026a53a8960b7 \ + --hash=sha256:91505d3ddebf268bb1588eb0f63821f738d20e1e7f05d3c647a5ca900288760b \ + --hash=sha256:942a5d73f739ad7c452bf739a62a0f83e2578afd6b8e5406308731f4ce78b16d \ + --hash=sha256:9454b8d8200ec99a224df8854786262b1bd6461f4280064c807303c642c05e76 \ + --hash=sha256:9459e6892f59ecea2e2584ee1058f5d8f629446eab52ba2305ae13a32a059530 \ + --hash=sha256:9776af1aad5a4b4a1317242ee2bea51da54b2a7b7b48674be736d463c999f37d \ + --hash=sha256:97dac543661e84a284502e0cf8a67b5c711b0ad5fb661d1bd505c02f8cf716d7 \ + --hash=sha256:98a3912194c079ef37e716ed228ae0dcb960992100461b704aea4e93af6b0bb9 \ + --hash=sha256:9b4a3bd174cc9cdaa1afbc4620c049038b441d6ba07629d89a83b408e54c35cd \ + --hash=sha256:9c886b481aefdf818ad44846145f6eaf373a20d200b5ce1a5c8e1bc2d8745410 \ + --hash=sha256:9ceaf423b50ecfc23ca00b7f50b64baba85fb3fb91c53e2c9d00bc86150c7e40 \ + --hash=sha256:a11a96c3b3f7551c8a8109aa65e8594e551d5a84c76bf950da33d0fb6dfafab7 \ + --hash=sha256:a3bcdde35d82ff385f4ede021df801b5c4a5bcdfb61ea87caabcebfc4945dc1b \ + --hash=sha256:a7fb111eef4d05909b82152721a59c1b14d0f365e2be4c742a473c5d7372f4f5 \ + --hash=sha256:a81e1196f0a5b4167a8dafe3a66aa67c4addac1b22dc47947abd5d5c7a3f24b5 \ + --hash=sha256:a8c9b7f16b63e65bbba889acb436a1034a82d34fa09752d754f88d708eca80e1 \ + --hash=sha256:a8ef956fce64c8551221f395ba21d0724fed6b9b6242ca4f2f7beb4ce2f41997 \ + --hash=sha256:ab339536aa798b1e17750733663d272038bf28069761d5be57cb4a9b0137b4f8 \ + --hash=sha256:ac7ba71f9561cd7d7b55e1ea5511543c0282e2b6450f122672a2694621d63b7e \ + --hash=sha256:aea53d51859b6c64e7c51d522c03cc2c48b9b5d6172126854cc7f01aa11f52bc \ + --hash=sha256:aea7c06667b987787c7d1f5e1dfcd70419b711cdb47d6b4bb4ad4b76777a0563 \ + --hash=sha256:aefe1a7cb852fa61150fcb21a8c8fcea7b58c4cb11fbe59c97a0a4b31cae3c8c \ + --hash=sha256:b0989737a3ba6cf2a16efb857fb0dfa20bc5c542737fddb6d893fde48be45433 \ + --hash=sha256:b108134b9667bcd71236c5a02aad5ddd073e372fb5d48ea74853e009fe38acb6 \ + --hash=sha256:b12cb6527599808ada9eb2cd6e0e7d3d8f13fe7bbb01c6311255a15ded4c7ab4 \ + --hash=sha256:b5aff6f3e818e6bdbbb38e5967520f174b18f539c2b9de867b1e7fde6f8d95a4 \ + --hash=sha256:b67319b4aef1a6c56576ff544b67a2a6fbd7eaee485b241cabf53115e8908b8f \ + --hash=sha256:b7c86884ad23d61b025989d99bfdd92a7351de956e01c61307cb87035960bcb1 \ + --hash=sha256:b92b69441d1bd39f4940f9eadfa417a25862242ca2c396b406f9272ef09cdcaa \ + --hash=sha256:bcb7a1096b4b6b24ce1ac24d4942ad98f983cd3810f9711bcd0293f43a9d8b9f \ + --hash=sha256:bda3ea44c39eb74e2488297bb39d47186ed01342f0022c8ff407c250ac3f498e \ + --hash=sha256:be2ba4c3c5b7900246a8f866580700ef0d538f2ca32535e991027bdaba944063 \ + --hash=sha256:c5681160758d3f6ac5b4fea370495c48aac0989d6a0f01bb9a72ad8ef5ab75c4 \ + --hash=sha256:c5d32f5284012deaccd37da1e2cd42f081feaa76981f0eaa474351b68df813c5 \ + --hash=sha256:c6364038c519dffdbe07e3cf42e6a7f8b90c275d4d1617a69bb59734c1a2d571 \ + --hash=sha256:c70e93fba207106cb16bf852e421c37bbded92acd5964390aad07cb50d60f5cf \ + --hash=sha256:ca755eebf0d9e62d6cb013f1261e510317a41bf4650f22963474a663fdfe02aa \ + --hash=sha256:cccd007d5c95279e529c146d095f1d39ac05139de26c098166c4beb9374b0f4d \ + --hash=sha256:ce31158630a6ac85bddd6b830cffd46085ff90498b397bd0a259f59d27a12188 \ + --hash=sha256:ce9c671845de9699904b1e9df95acfe8dfc183f2310f163cdaa91a3535af95de \ + --hash=sha256:d12832e1dbea4be280b22fd0ea7c9b87f0d8fc51ba06e92dc62d52f804f78ebd \ + --hash=sha256:d2ed1b3cb9ff1c10e6e8b00941bb2e5bb568b307bfc6b17dffbbe8be5eecba86 \ + --hash=sha256:d5663bc1b471c79f5c833cffbc9b87d7bf13f87e055a5c86c363ccd2348d7e82 \ + --hash=sha256:d90b729fd2732df28130c064aac9bb8aff14ba20baa4aee7bd0795ff1187545f \ + --hash=sha256:dc0af80267edc68adf85f2a5d9be1cdf062f973db6790c1d065e45025fa26140 \ + --hash=sha256:de5b4e1088523e2b6f730d0509a9a813355b7f5659d70eb4f319c76beea2e250 \ + --hash=sha256:de6f6bb8a7840c7bf216fb83eec4e2f79f7325eca8858167b68708b929ab2172 \ + --hash=sha256:df53330a3bff250f10472ce96a9af28628ff1f4efc51ccba351a8820bca2a8ba \ + --hash=sha256:e094ec83694b59d263802ed03a8384594fcce477ce484b0cbcd0008a211ca751 \ + --hash=sha256:e794f698ae4c5084414efea0f5cc9f4ac562ec02d66e1484ff822ef97c2cadff \ + --hash=sha256:e7bc6df34d42322c5289e37e9971d6ed114e3776b45fa879f734bded9d1fea9c \ + --hash=sha256:eaf24066ad0b30917186420d51e2e3edf4b0e2ea68d8cd885b14dc8afdcf6556 \ + --hash=sha256:ecf4c4b83f1ab3d5a7ace10bafcb6f11df6156857a3c418244cef41ca9fa3e44 \ + --hash=sha256:ef5a7178fcc73b7d8c07229e89f8eb45b2908a9238eb90dcfc46571ccf0383b8 \ + --hash=sha256:f5cb182f6396706dc6cc1896dd02b1c889d644c081b0cdec38747573db88a7d7 \ + --hash=sha256:fa0e294046de09acd6146be0ed6727d1f42ded4ce3ea1e9a19c11b6774eea27c \ + --hash=sha256:fb54f7c6bafaa808f27166569b1511fc42701a7713858dddc08afdde9746849e \ + --hash=sha256:fd3be6481ef54b8cfd0e1e953323b7aa9d9789b94842d0e5b142ef4bb7999539 # via doxmlparser markupsafe==3.0.2 \ --hash=sha256:0bff5e0ae4ef2e1ae4fdf2dfd5b76c75e5c2fa4132d05fc1b0dabcd20c7e28c4 \ @@ -338,9 +374,9 @@ pluggy==1.6.0 \ --hash=sha256:7dcc130b76258d33b90f61b658791dede3486c3e6bfb003ee5c9bfb396dd22f3 \ --hash=sha256:e920276dd6813095e9377c0bc5566d94c932c33b27a3e3945d8389c374dd4746 # via pytest -pygments==2.19.2 \ - --hash=sha256:636cb2477cec7f8952536970bc533bc43743542f70392ae026374600add5b887 \ - --hash=sha256:86540386c03d588bb81d44bc3928634ff26449851e99741617ecb9037ee5ec0b +pygments==2.19.1 \ + --hash=sha256:61c16d2a8576dc0649d9f39e089b5f02bcd27fba10d8fb4dcc28173f7a45151f \ + --hash=sha256:9ea1544ad55cecf4b8242fab6dd35a93bbce657034b0611ee383099054ab6d8c # via # -r requirements.in # pytest @@ -421,7 +457,7 @@ requests==2.32.4 \ --hash=sha256:27babd3cda2a6d50b30443204ee89830707d396671944c998b5975b031ac2b2c \ --hash=sha256:27d0316682c8a29834d3264820024b62a36942083d52caf2f14c0591336d3422 # via sphinx -roman-numerals-py==3.1.0 ; python_full_version >= '3.11' \ +roman-numerals-py==3.1.0 \ --hash=sha256:9da2ad2fb670bcf24e81070ceb3be72f6c11c440d73bd579fbeca1e9f330954c \ --hash=sha256:be4bf804f083a4ce001b5eb7e3c0862479d10f94c936f6c4e5f250aa5ff5bd2d # via sphinx @@ -495,30 +531,16 @@ snowballstemmer==3.0.1 \ --hash=sha256:6cd7b3897da8d6c9ffb968a6781fa6532dce9c3618a4b127d920dab764a19064 \ --hash=sha256:6d5eeeec8e9f84d4d56b847692bacf79bc2c8e90c7f80ca4444ff8b6f2e52895 # via sphinx -sphinx==8.1.3 ; python_full_version < '3.11' \ - --hash=sha256:09719015511837b76bf6e03e42eb7595ac8c2e41eeb9c29c5b755c6b677992a2 \ - --hash=sha256:43c1911eecb0d3e161ad78611bc905d1ad0e523e4ddc202a58a821773dc4c927 - # via - # -r requirements.in - # sphinx-autobuild - # sphinx-copybutton - # sphinx-last-updated-by-git - # sphinx-notfound-page - # sphinx-rtd-theme - # sphinx-tabs - # sphinx-togglebutton - # sphinxcontrib-jquery - # sphinxcontrib-svg2pdfconverter -sphinx==8.2.3 ; python_full_version >= '3.11' \ +sphinx==8.2.3 \ --hash=sha256:398ad29dee7f63a75888314e9424d40f52ce5a6a87ae88e7071e80af296ec348 \ --hash=sha256:4405915165f13521d875a8c29c8970800a0141c14cc5416a38feca4ea5d9b9c3 # via # -r requirements.in # sphinx-autobuild # sphinx-copybutton - # sphinx-last-updated-by-git # sphinx-notfound-page # sphinx-rtd-theme + # sphinx-sitemap # sphinx-tabs # sphinx-togglebutton # sphinxcontrib-jquery @@ -531,10 +553,6 @@ sphinx-copybutton==0.5.2 \ --hash=sha256:4cf17c82fb9646d1bc9ca92ac280813a3b605d8c421225fd9913154103ee1fbd \ --hash=sha256:fb543fd386d917746c9a2c50360c7905b605726b9355cd26e9974857afeae06e # via -r requirements.in -sphinx-last-updated-by-git==0.3.8 \ - --hash=sha256:6382c8285ac1f222483a58569b78c0371af5e55f7fbf9c01e5e8a72d6fdfa499 \ - --hash=sha256:c145011f4609d841805b69a9300099fc02fed8f5bb9e5bcef77d97aea97b7761 - # via sphinx-sitemap sphinx-notfound-page==1.1.0 \ --hash=sha256:835dc76ff7914577a1f58d80a2c8418fb6138c0932c8da8adce4d9096fbcd389 \ --hash=sha256:913e1754370bb3db201d9300d458a8b8b5fb22e9246a816643a819a9ea2b8067 @@ -543,9 +561,9 @@ sphinx-rtd-theme==3.0.2 \ --hash=sha256:422ccc750c3a3a311de4ae327e82affdaf59eb695ba4936538552f3b00f4ee13 \ --hash=sha256:b7457bc25dda723b20b086a670b9953c859eab60a2a03ee8eb2bb23e176e5f85 # via -r requirements.in -sphinx-sitemap==2.7.2 \ - --hash=sha256:1a6a8dcecb0ffb85fd37678f785cfcc40adfe3eebafb05e678971e5260b117e4 \ - --hash=sha256:819e028e27579b47efa0e2f863b87136b711c45f13e84730610e80316f6883da +sphinx-sitemap==2.6.0 \ + --hash=sha256:5e0c66b9f2e371ede80c659866a9eaad337d46ab02802f9c7e5f7bc5893c28d2 \ + --hash=sha256:7478e417d141f99c9af27ccd635f44c03a471a08b20e778a0f9daef7ace1d30b # via -r requirements.in sphinx-tabs==3.4.7 \ --hash=sha256:991ad4a424ff54119799ba1491701aa8130dd43509474aef45a81c42d889784d \ @@ -587,61 +605,21 @@ sphinxcontrib-svg2pdfconverter==1.3.0 \ --hash=sha256:5df6b0895e2e2101d720bfd08841bb56d74c57b1f86229a7c18b771dfdf4ffbb \ --hash=sha256:6411a4cc2f57eed96a0d7bbfa139f68cbe7983018881e1e6d7c46053cd69911f # via -r requirements.in -starlette==0.47.1 \ - --hash=sha256:5e11c9f5c7c3f24959edbf2dffdc01bba860228acf657129467d8a7468591527 \ - --hash=sha256:aef012dd2b6be325ffa16698f9dc533614fb1cebd593a906b90dc1025529a79b +starlette==0.47.0 \ + --hash=sha256:1f64887e94a447fed5f23309fb6890ef23349b7e478faa7b24a851cd4eb844af \ + --hash=sha256:9d052d4933683af40ffd47c7465433570b4949dc937e20ad1d73b34e72f10c37 # via sphinx-autobuild -tomli==2.2.1 ; python_full_version < '3.11' \ - --hash=sha256:023aa114dd824ade0100497eb2318602af309e5a55595f76b626d6d9f3b7b0a6 \ - --hash=sha256:02abe224de6ae62c19f090f68da4e27b10af2b93213d36cf44e6e1c5abd19fdd \ - --hash=sha256:286f0ca2ffeeb5b9bd4fcc8d6c330534323ec51b2f52da063b11c502da16f30c \ - --hash=sha256:2d0f2fdd22b02c6d81637a3c95f8cd77f995846af7414c5c4b8d0545afa1bc4b \ - --hash=sha256:33580bccab0338d00994d7f16f4c4ec25b776af3ffaac1ed74e0b3fc95e885a8 \ - --hash=sha256:400e720fe168c0f8521520190686ef8ef033fb19fc493da09779e592861b78c6 \ - --hash=sha256:40741994320b232529c802f8bc86da4e1aa9f413db394617b9a256ae0f9a7f77 \ - --hash=sha256:465af0e0875402f1d226519c9904f37254b3045fc5084697cefb9bdde1ff99ff \ - --hash=sha256:4a8f6e44de52d5e6c657c9fe83b562f5f4256d8ebbfe4ff922c495620a7f6cea \ - --hash=sha256:4e340144ad7ae1533cb897d406382b4b6fede8890a03738ff1683af800d54192 \ - --hash=sha256:678e4fa69e4575eb77d103de3df8a895e1591b48e740211bd1067378c69e8249 \ - --hash=sha256:6972ca9c9cc9f0acaa56a8ca1ff51e7af152a9f87fb64623e31d5c83700080ee \ - --hash=sha256:7fc04e92e1d624a4a63c76474610238576942d6b8950a2d7f908a340494e67e4 \ - --hash=sha256:889f80ef92701b9dbb224e49ec87c645ce5df3fa2cc548664eb8a25e03127a98 \ - --hash=sha256:8d57ca8095a641b8237d5b079147646153d22552f1c637fd3ba7f4b0b29167a8 \ - --hash=sha256:8dd28b3e155b80f4d54beb40a441d366adcfe740969820caf156c019fb5c7ec4 \ - --hash=sha256:9316dc65bed1684c9a98ee68759ceaed29d229e985297003e494aa825ebb0281 \ - --hash=sha256:a198f10c4d1b1375d7687bc25294306e551bf1abfa4eace6650070a5c1ae2744 \ - --hash=sha256:a38aa0308e754b0e3c67e344754dff64999ff9b513e691d0e786265c93583c69 \ - --hash=sha256:a92ef1a44547e894e2a17d24e7557a5e85a9e1d0048b0b5e7541f76c5032cb13 \ - --hash=sha256:ac065718db92ca818f8d6141b5f66369833d4a80a9d74435a268c52bdfa73140 \ - --hash=sha256:b82ebccc8c8a36f2094e969560a1b836758481f3dc360ce9a3277c65f374285e \ - --hash=sha256:c954d2250168d28797dd4e3ac5cf812a406cd5a92674ee4c8f123c889786aa8e \ - --hash=sha256:cb55c73c5f4408779d0cf3eef9f762b9c9f147a77de7b258bef0a5628adc85cc \ - --hash=sha256:cd45e1dc79c835ce60f7404ec8119f2eb06d38b1deba146f07ced3bbc44505ff \ - --hash=sha256:d3f5614314d758649ab2ab3a62d4f2004c825922f9e370b29416484086b264ec \ - --hash=sha256:d920f33822747519673ee656a4b6ac33e382eca9d331c87770faa3eef562aeb2 \ - --hash=sha256:db2b95f9de79181805df90bedc5a5ab4c165e6ec3fe99f970d0e302f384ad222 \ - --hash=sha256:e59e304978767a54663af13c07b3d1af22ddee3bb2fb0618ca1593e4f593a106 \ - --hash=sha256:e85e99945e688e32d5a35c1ff38ed0b3f41f43fad8df0bdf79f72b2ba7bc5272 \ - --hash=sha256:ece47d672db52ac607a3d9599a9d48dcb2f2f735c6c2d1f34130085bb12b112a \ - --hash=sha256:f4039b9cbc3048b2416cc57ab3bda989a6fcf9b36cf8937f01a6e731b64f80d7 - # via - # pytest - # sphinx typing-extensions==4.14.0 ; python_full_version < '3.13' \ --hash=sha256:8676b788e32f02ab42d9e7c61324048ae4c6d844a399eebace3d4979d75ceef4 \ --hash=sha256:a1514509136dd0b477638fc68d6a91497af5076466ad0fa6c338e44e359944af - # via - # anyio - # exceptiongroup - # starlette - # uvicorn + # via anyio urllib3==2.5.0 \ --hash=sha256:3fc47733c7e419d4bc3f6b3dc2b4f890bb743906a30d56ba4a5bfa4bbff92760 \ --hash=sha256:e6b01673c0fa6a13e374b50871808eb3bf7046c4b125b216f6bf1cc604cff0dc # via requests -uvicorn==0.35.0 \ - --hash=sha256:197535216b25ff9b785e29a0b79199f55222193d47f820816e7da751e9bc8d4a \ - --hash=sha256:bc662f087f7cf2ce11a1d7fd70b90c9f98ef2e2831556dd078d131b96cc94a01 +uvicorn==0.34.3 \ + --hash=sha256:16246631db62bdfbf069b0645177d6e8a77ba950cfedbfd093acef9444e4d885 \ + --hash=sha256:35919a9a979d7a59334b6b10e05d77c1d0d574c50e0fc98b8b1a0f165708b55a # via sphinx-autobuild watchfiles==1.1.0 \ --hash=sha256:00645eb79a3faa70d9cb15c8d4187bb72970b2470e938670240c7998dad9f13a \ diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index f1da73f3ec0d..c32a40fd35c8 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -2008,7 +2008,7 @@ class PythonCompatCheck(ComplianceTest): name = "PythonCompat" doc = "Check that Python files are compatible with Zephyr minimum supported Python version." - MAX_VERSION = (3, 10) + MAX_VERSION = (3, 12) MAX_VERSION_STR = f"{MAX_VERSION[0]}.{MAX_VERSION[1]}" def run(self): diff --git a/scripts/requirements-actions.txt b/scripts/requirements-actions.txt index 7588db2575f9..e9faf32c7f91 100644 --- a/scripts/requirements-actions.txt +++ b/scripts/requirements-actions.txt @@ -1,5 +1,5 @@ # This file was autogenerated by uv via the following command: -# uv pip compile --universal --python-version 3.10 --generate-hashes requirements-actions.in --output-file requirements-actions.txt +# uv pip compile --universal --python-version 3.12 --generate-hashes requirements-actions.in --output-file requirements-actions.txt anytree==2.13.0 \ --hash=sha256:4cbcf10df36b1f1cba131b7e487ff3edafc9d6e932a3c70071b5b768bab901ff \ --hash=sha256:c9d3aa6825fdd06af7ebb05b4ef291d2db63e62bb1f9b7d9b71354be9d362714 @@ -16,9 +16,9 @@ attrs==25.3.0 \ --hash=sha256:427318ce031701fea540783410126f03899a97ffc6f61596ad581ac2e40e3bc3 \ --hash=sha256:75d7cefc7fb576747b2c81b4442d4d4a1ce0900973527c011d1030fd3bf4af1b # via reuse -awscli==1.41.2 \ - --hash=sha256:2c219f88a810c2908954ac50b52f3791c875a3c3a439d16e5a8eac31190c95b7 \ - --hash=sha256:428c5ff8a9c970405848ca49d7f4727e7afcfef5a93abd9227af730f77d24e03 +awscli==1.40.38 \ + --hash=sha256:3f90f2815e3b72691785d2bbd4f2c3dcbde311c55e1f5633a37cc3e514ba6fdb \ + --hash=sha256:ec9b69ff4600ef151df3336f0e7af4cf30280d27f9d8e67e09c4b386ceb1f154 # via -r requirements-actions.in beartype==0.21.0 \ --hash=sha256:b6a1bd56c72f31b0a496a36cc55df6e2f475db166ad07fa4acc7e74f4c7f34c0 \ @@ -34,9 +34,9 @@ boolean-py==5.0 \ # via # license-expression # reuse -botocore==1.39.2 \ - --hash=sha256:474445fa8b281dd5db8fc62184f0f6e494d4f1efb96fe10312490583e67a9dd0 \ - --hash=sha256:921cab9aa6e1e4ceddcece5b55b57daae7722168e74409f1aafcc2c5589df676 +botocore==1.38.39 \ + --hash=sha256:2305f688e9328af473a504197584112f228513e06412038d83205ce8d1456f40 \ + --hash=sha256:ee3aa03af1dabed4f3710cd64f6d9d488281eee720710bf1cf9f2b2fd30025ae # via # awscli # s3transfer @@ -227,23 +227,23 @@ charset-normalizer==3.4.2 \ # via # python-debian # requests -clang-format==20.1.7 \ - --hash=sha256:11431cb437ed22be85744ea47b3a6801bc61de7ac4b775bf1cb89ee190c992d4 \ - --hash=sha256:1dad1e6f9eb732b76046bf5810c6ee78b9e6cd6b3616cb75d9bde06ecd3222e6 \ - --hash=sha256:29f5fe39e60579ca253d31c1122ce06a80716400ec7e5dc38833da80f88dbbd5 \ - --hash=sha256:2b0d76b9bf1f993bad33d2216b5fce4c407bc748fa31659ab7f51ca60df113c9 \ - --hash=sha256:4a9b909b1a9eb0b91aae51fdeeeb013ce20f9079d2e0fa8b8381e97c268dc889 \ - --hash=sha256:4c05114a10efe85c11fde518fe0fadc2977ce4a997a26ceaac88521daee83bbd \ - --hash=sha256:6db0b7271af8cbc2656b3b6b31e4276d5c6b8ceafb1981760f4738cfbe0a9e43 \ - --hash=sha256:70a904719a1bd6653d77ddc6d7b40418845912a1a2a419b9116b819a6b619f8c \ - --hash=sha256:7bd56bd0f519959488977dcddddba4e4fd07cba6225ed09ad658caa1f7286d1f \ - --hash=sha256:99cbfb99dab836027498190f55e543bed51bae33ae6dc256861e7aa91368de98 \ - --hash=sha256:9cd4d64dc0e34b23badad0ce3a235fb5c8ac63651d9f91d1c806356212cbca6c \ - --hash=sha256:b27ed7fe674e8a77461c8d5b117ed96021aa18233917b3fe54b95391e0b22d04 \ - --hash=sha256:bd144f093b4a3ac8a0f0d0ebb9b013974884d9da0627b9905949c6f3213aa850 \ - --hash=sha256:d11c62d38b9144d30021b884b0f95e7270a6bcbf4f22bdd7dae94a531d82fbba \ - --hash=sha256:d79484ce2c8f621242046c4bb0aefd49445ec5c7bc3c404af97490289791b777 \ - --hash=sha256:e5257e8188569e4e47fceb3ba3317b0b44dc5ab5046c8cc2d58c626430c747a6 +clang-format==20.1.6 \ + --hash=sha256:0ea008a20951527d35a1e2b8febdca3c47c6f8e9a1bd174601c891e20053ef2e \ + --hash=sha256:11530ff352c64176ba4297ad398452d9fcd442b4a8bb2a804cc7915bc94b96e1 \ + --hash=sha256:12626f058755198b92b26076312cc1052f8dd7868bd6cf61b65d2911154ef6df \ + --hash=sha256:15dbc113b4d2f1eb545adb9b815b96c2d64aff947de9453802e47ef1c5267996 \ + --hash=sha256:2ea00197fe650f29b77dd870cd87891e15d9d2dac75c4e9072f4eee99a928dcb \ + --hash=sha256:5351f353062bb0df9c31b4e84c8a9d6b472f9f0727ebd5ab1f96fd3e792756fa \ + --hash=sha256:58b3ef54bc32304990f1890cc982607f69359e46b0e98350718125bea24566de \ + --hash=sha256:779153a039c8552438dd9a3925f5dad20d8b5a812329703f98cd5da7bb91556c \ + --hash=sha256:8ce12618431d8955026c30a2d19a3ae9ddc6d918ad24a4e00a10f8f130454469 \ + --hash=sha256:8ce920b103447d21ff44d41a7ad412794bde1b737426a126c8ab141f00bbfba8 \ + --hash=sha256:bfc4a9922ee1f7c0ec5a8250cb72e755a1ddc73e5d50866efe00561be6fc69eb \ + --hash=sha256:c93c8b7feed66521349918f741b40ef6eaf85dfa1b5eb1303a49ed4608fd882a \ + --hash=sha256:ce8f5bbacba3f05adc2cd64a1780e36c81b54a2caa0b4c618c611b2b45124930 \ + --hash=sha256:d1d64ccfb14dcd93cd98321191e9fbaef049774d050f0c084b7aede41e79fee2 \ + --hash=sha256:d84fffa03432c400bb560f3c8181c2dfa6be05b9b866f7d0180dfb41e0f91907 \ + --hash=sha256:e1e59c3a23d033df261ce8048c96f0493285cff1b65d3f519b77a47854653d27 # via -r requirements-actions.in click==8.1.3 \ --hash=sha256:7682dc8afb30297001674575ea00d1814d808d6a36af415a82bd481d37ba7b8e \ @@ -262,44 +262,44 @@ colorama==0.4.6 \ # pytest # tox # west -cryptography==45.0.5 \ - --hash=sha256:0027d566d65a38497bc37e0dd7c2f8ceda73597d2ac9ba93810204f56f52ebc7 \ - --hash=sha256:101ee65078f6dd3e5a028d4f19c07ffa4dd22cce6a20eaa160f8b5219911e7d8 \ - --hash=sha256:12e55281d993a793b0e883066f590c1ae1e802e3acb67f8b442e721e475e6463 \ - --hash=sha256:14d96584701a887763384f3c47f0ca7c1cce322aa1c31172680eb596b890ec30 \ - --hash=sha256:1e1da5accc0c750056c556a93c3e9cb828970206c68867712ca5805e46dc806f \ - --hash=sha256:206210d03c1193f4e1ff681d22885181d47efa1ab3018766a7b32a7b3d6e6afd \ - --hash=sha256:2089cc8f70a6e454601525e5bf2779e665d7865af002a5dec8d14e561002e135 \ - --hash=sha256:3a264aae5f7fbb089dbc01e0242d3b67dffe3e6292e1f5182122bdf58e65215d \ - --hash=sha256:3af26738f2db354aafe492fb3869e955b12b2ef2e16908c8b9cb928128d42c57 \ - --hash=sha256:3fcfbefc4a7f332dece7272a88e410f611e79458fab97b5efe14e54fe476f4fd \ - --hash=sha256:460f8c39ba66af7db0545a8c6f2eabcbc5a5528fc1cf6c3fa9a1e44cec33385e \ - --hash=sha256:57c816dfbd1659a367831baca4b775b2a5b43c003daf52e9d57e1d30bc2e1b0e \ - --hash=sha256:5aa1e32983d4443e310f726ee4b071ab7569f58eedfdd65e9675484a4eb67bd1 \ - --hash=sha256:6ff8728d8d890b3dda5765276d1bc6fb099252915a2cd3aff960c4c195745dd0 \ - --hash=sha256:7259038202a47fdecee7e62e0fd0b0738b6daa335354396c6ddebdbe1206af2a \ - --hash=sha256:72e76caa004ab63accdf26023fccd1d087f6d90ec6048ff33ad0445abf7f605a \ - --hash=sha256:7760c1c2e1a7084153a0f68fab76e754083b126a47d0117c9ed15e69e2103492 \ - --hash=sha256:8c4a6ff8a30e9e3d38ac0539e9a9e02540ab3f827a3394f8852432f6b0ea152e \ - --hash=sha256:9024beb59aca9d31d36fcdc1604dd9bbeed0a55bface9f1908df19178e2f116e \ - --hash=sha256:90cb0a7bb35959f37e23303b7eed0a32280510030daba3f7fdfbb65defde6a97 \ - --hash=sha256:91098f02ca81579c85f66df8a588c78f331ca19089763d733e34ad359f474174 \ - --hash=sha256:926c3ea71a6043921050eaa639137e13dbe7b4ab25800932a8498364fc1abec9 \ - --hash=sha256:982518cd64c54fcada9d7e5cf28eabd3ee76bd03ab18e08a48cad7e8b6f31b18 \ - --hash=sha256:9b4cf6318915dccfe218e69bbec417fdd7c7185aa7aab139a2c0beb7468c89f0 \ - --hash=sha256:ad0caded895a00261a5b4aa9af828baede54638754b51955a0ac75576b831b27 \ - --hash=sha256:b85980d1e345fe769cfc57c57db2b59cff5464ee0c045d52c0df087e926fbe63 \ - --hash=sha256:b8fa8b0a35a9982a3c60ec79905ba5bb090fc0b9addcfd3dc2dd04267e45f25e \ - --hash=sha256:b9e38e0a83cd51e07f5a48ff9691cae95a79bea28fe4ded168a8e5c6c77e819d \ - --hash=sha256:bd4c45986472694e5121084c6ebbd112aa919a25e783b87eb95953c9573906d6 \ - --hash=sha256:be97d3a19c16a9be00edf79dca949c8fa7eff621763666a145f9f9535a5d7f42 \ - --hash=sha256:c648025b6840fe62e57107e0a25f604db740e728bd67da4f6f060f03017d5097 \ - --hash=sha256:d05a38884db2ba215218745f0781775806bde4f32e07b135348355fe8e4991d9 \ - --hash=sha256:dd420e577921c8c2d31289536c386aaa30140b473835e97f83bc71ea9d2baf2d \ - --hash=sha256:e357286c1b76403dd384d938f93c46b2b058ed4dfcdce64a770f0537ed3feb6f \ - --hash=sha256:e6c00130ed423201c5bc5544c23359141660b07999ad82e34e7bb8f882bb78e0 \ - --hash=sha256:e74d30ec9c7cb2f404af331d5b4099a9b322a8a6b25c4632755c8757345baac5 \ - --hash=sha256:f3562c2f23c612f2e4a6964a61d942f891d29ee320edb62ff48ffb99f3de9ae8 +cryptography==45.0.4 \ + --hash=sha256:0339a692de47084969500ee455e42c58e449461e0ec845a34a6a9b9bf7df7fb8 \ + --hash=sha256:03dbff8411206713185b8cebe31bc5c0eb544799a50c09035733716b386e61a4 \ + --hash=sha256:06509dc70dd71fa56eaa138336244e2fbaf2ac164fc9b5e66828fccfd2b680d6 \ + --hash=sha256:0cf13c77d710131d33e63626bd55ae7c0efb701ebdc2b3a7952b9b23a0412862 \ + --hash=sha256:23b9c3ea30c3ed4db59e7b9619272e94891f8a3a5591d0b656a7582631ccf750 \ + --hash=sha256:25eb4d4d3e54595dc8adebc6bbd5623588991d86591a78c2548ffb64797341e2 \ + --hash=sha256:2882338b2a6e0bd337052e8b9007ced85c637da19ef9ecaf437744495c8c2999 \ + --hash=sha256:3530382a43a0e524bc931f187fc69ef4c42828cf7d7f592f7f249f602b5a4ab0 \ + --hash=sha256:425a9a6ac2823ee6e46a76a21a4e8342d8fa5c01e08b823c1f19a8b74f096069 \ + --hash=sha256:46cf7088bf91bdc9b26f9c55636492c1cce3e7aaf8041bbf0243f5e5325cfb2d \ + --hash=sha256:4828190fb6c4bcb6ebc6331f01fe66ae838bb3bd58e753b59d4b22eb444b996c \ + --hash=sha256:49fe9155ab32721b9122975e168a6760d8ce4cffe423bcd7ca269ba41b5dfac1 \ + --hash=sha256:4ca0f52170e821bc8da6fc0cc565b7bb8ff8d90d36b5e9fdd68e8a86bdf72036 \ + --hash=sha256:51dfbd4d26172d31150d84c19bbe06c68ea4b7f11bbc7b3a5e146b367c311349 \ + --hash=sha256:5f31e6b0a5a253f6aa49be67279be4a7e5a4ef259a9f33c69f7d1b1191939872 \ + --hash=sha256:627ba1bc94f6adf0b0a2e35d87020285ead22d9f648c7e75bb64f367375f3b22 \ + --hash=sha256:680806cf63baa0039b920f4976f5f31b10e772de42f16310a6839d9f21a26b0d \ + --hash=sha256:6a3511ae33f09094185d111160fd192c67aa0a2a8d19b54d36e4c78f651dc5ad \ + --hash=sha256:6a5bf57554e80f75a7db3d4b1dacaa2764611ae166ab42ea9a72bcdb5d577637 \ + --hash=sha256:6b613164cb8425e2f8db5849ffb84892e523bf6d26deb8f9bb76ae86181fa12b \ + --hash=sha256:7405ade85c83c37682c8fe65554759800a4a8c54b2d96e0f8ad114d31b808d57 \ + --hash=sha256:7aad98a25ed8ac917fdd8a9c1e706e5a0956e06c498be1f713b61734333a4507 \ + --hash=sha256:7bedbe4cc930fa4b100fc845ea1ea5788fcd7ae9562e669989c11618ae8d76ee \ + --hash=sha256:7ef2dde4fa9408475038fc9aadfc1fb2676b174e68356359632e980c661ec8f6 \ + --hash=sha256:817ee05c6c9f7a69a16200f0c90ab26d23a87701e2a284bd15156783e46dbcc8 \ + --hash=sha256:944e9ccf67a9594137f942d5b52c8d238b1b4e46c7a0c2891b7ae6e01e7c80a4 \ + --hash=sha256:964bcc28d867e0f5491a564b7debb3ffdd8717928d315d12e0d7defa9e43b723 \ + --hash=sha256:96d4819e25bf3b685199b304a0029ce4a3caf98947ce8a066c9137cc78ad2c58 \ + --hash=sha256:a77c6fb8d76e9c9f99f2f3437c1a4ac287b34eaf40997cfab1e9bd2be175ac39 \ + --hash=sha256:b0a97c927497e3bc36b33987abb99bf17a9a175a19af38a892dc4bbb844d7ee2 \ + --hash=sha256:b97737a3ffbea79eebb062eb0d67d72307195035332501722a9ca86bab9e3ab2 \ + --hash=sha256:bbc505d1dc469ac12a0a064214879eac6294038d6b24ae9f71faae1448a9608d \ + --hash=sha256:c22fe01e53dc65edd1945a2e6f0015e887f84ced233acecb64b4daadb32f5c97 \ + --hash=sha256:ce1678a2ccbe696cf3af15a75bb72ee008d7ff183c9228592ede9db467e64f1b \ + --hash=sha256:e00a6c10a5c53979d6242f123c0a97cff9f3abed7f064fc412c36dc521b5f257 \ + --hash=sha256:eaa3e28ea2235b33220b949c5a0d6cf79baa80eab2eb5607ca8ab7525331b9ff \ + --hash=sha256:f3fe7a5ae34d5a414957cc7f457e2b92076e72938423ac64d215722f6cf49a9e # via pyjwt deprecated==1.2.18 \ --hash=sha256:422b6f6d859da6f2ef57857761bfb392480502a64c3028ca9bbe86085d72115d \ @@ -331,9 +331,7 @@ elasticsearch==8.18.1 \ exceptiongroup==1.3.0 \ --hash=sha256:4d111e6e0c13d0644cad6ddaa7ed0261a0b36971f6d23e7ec9b4b9097da78a10 \ --hash=sha256:b241f5885f560bc56a59ee63ca4c6a8bfa46ae4ad651af316d4e81817bb9fd88 - # via - # -r requirements-actions.in - # pytest + # via -r requirements-actions.in filelock==3.18.0 \ --hash=sha256:adbc88eabb99d2fec8c9c1b229b171f18afa655400173ddc653d5d01501fb9f2 \ --hash=sha256:c401f4f8377c4464e6db25fff06205fd89bdd83b65eb0488ed1b160f780e21de @@ -459,10 +457,6 @@ intelhex==2.3.0 \ --hash=sha256:87cc5225657524ec6361354be928adfd56bcf2a3dcc646c40f8f094c39c07db4 \ --hash=sha256:892b7361a719f4945237da8ccf754e9513db32f5628852785aea108dcd250093 # via -r requirements-actions.in -isodate==0.7.2 ; python_full_version < '3.11' \ - --hash=sha256:28009937d8031054830160fce6d409ed342816b543597cece116d966c6d99e15 \ - --hash=sha256:4cd1aa0f43ca76f4a6c6c0292a85f40b35ec2e43e315b59f06e6d32171a953e6 - # via rdflib isort==6.0.1 \ --hash=sha256:1cb5df28dfbc742e490c5e41bad6da41b805b0a8be7bc93cd0fb2a8a890ac450 \ --hash=sha256:2dc5d7f65c9678d94c88dfc29161a320eec67328bc97aad576874cb4be1e9615 @@ -481,107 +475,149 @@ jmespath==1.0.1 \ junit2html==31.0.2 \ --hash=sha256:c7fd1f253d423f0df031d0cee8ef7d4d98d9f8bf6383a2d40dca639686814866 # via -r requirements-actions.in -junitparser==4.0.2 \ - --hash=sha256:94c3570e41fcaedc64cc3c634ca99457fe41a84dd1aa8ff74e9e12e66223a155 \ - --hash=sha256:d5d07cece6d4a600ff3b7b96c8db5ffa45a91eed695cb86c45c3db113c1ca0f8 +junitparser==3.2.0 \ + --hash=sha256:b05e89c27e7b74b3c563a078d6e055d95cf397444f8f689b0ca616ebda0b3c65 \ + --hash=sha256:e14fdc0a999edfc15889b637390e8ef6ca09a49532416d3bd562857d42d4b96d # via -r requirements-actions.in -license-expression==30.4.3 \ - --hash=sha256:49f439fea91c4d1a642f9f2902b58db1d42396c5e331045f41ce50df9b40b1f2 \ - --hash=sha256:fd3db53418133e0eef917606623bc125fbad3d1225ba8d23950999ee87c99280 +license-expression==30.4.1 \ + --hash=sha256:679646bc3261a17690494a3e1cada446e5ee342dbd87dcfa4a0c24cc5dce13ee \ + --hash=sha256:9f02105f9e0fcecba6a85dfbbed7d94ea1c3a70cf23ddbfb5adf3438a6f6fce0 # via # reuse # spdx-tools -lxml==6.0.0 \ - --hash=sha256:013090383863b72c62a702d07678b658fa2567aa58d373d963cca245b017e065 \ - --hash=sha256:032e65120339d44cdc3efc326c9f660f5f7205f3a535c1fdbf898b29ea01fb72 \ - --hash=sha256:048a930eb4572829604982e39a0c7289ab5dc8abc7fc9f5aabd6fbc08c154e93 \ - --hash=sha256:04d67ceee6db4bcb92987ccb16e53bef6b42ced872509f333c04fb58a3315256 \ - --hash=sha256:059c4cbf3973a621b62ea3132934ae737da2c132a788e6cfb9b08d63a0ef73f9 \ - --hash=sha256:0e32698462aacc5c1cf6bdfebc9c781821b7e74c79f13e5ffc8bfe27c42b1abf \ - --hash=sha256:1676b56d48048a62ef77a250428d1f31f610763636e0784ba67a9740823988ca \ - --hash=sha256:17f090a9bc0ce8da51a5632092f98a7e7f84bca26f33d161a98b57f7fb0004ca \ - --hash=sha256:185efc2fed89cdd97552585c624d3c908f0464090f4b91f7d92f8ed2f3b18f54 \ - --hash=sha256:1fa377b827ca2023244a06554c6e7dc6828a10aaf74ca41965c5d8a4925aebb4 \ - --hash=sha256:2181e4b1d07dde53986023482673c0f1fba5178ef800f9ab95ad791e8bdded6a \ - --hash=sha256:219e0431ea8006e15005767f0351e3f7f9143e793e58519dc97fe9e07fae5563 \ - --hash=sha256:21db1ec5525780fd07251636eb5f7acb84003e9382c72c18c542a87c416ade03 \ - --hash=sha256:246b40f8a4aec341cbbf52617cad8ab7c888d944bfe12a6abd2b1f6cfb6f6082 \ - --hash=sha256:2793a627e95d119e9f1e19720730472f5543a6d84c50ea33313ce328d870f2dd \ - --hash=sha256:2930aa001a3776c3e2601cb8e0a15d21b8270528d89cc308be4843ade546b9ab \ - --hash=sha256:2ae06fbab4f1bb7db4f7c8ca9897dc8db4447d1a2b9bee78474ad403437bcc29 \ - --hash=sha256:2b4790b558bee331a933e08883c423f65bbcd07e278f91b2272489e31ab1e2b4 \ - --hash=sha256:2cfcf84f1defed7e5798ef4f88aa25fcc52d279be731ce904789aa7ccfb7e8d2 \ - --hash=sha256:2dd1cc3ea7e60bfb31ff32cafe07e24839df573a5e7c2d33304082a5019bcd58 \ - --hash=sha256:2f34687222b78fff795feeb799a7d44eca2477c3d9d3a46ce17d51a4f383e32e \ - --hash=sha256:310b719b695b3dd442cdfbbe64936b2f2e231bb91d998e99e6f0daf991a3eba3 \ - --hash=sha256:34190a1ec4f1e84af256495436b2d196529c3f2094f0af80202947567fdbf2e7 \ - --hash=sha256:35bc626eec405f745199200ccb5c6b36f202675d204aa29bb52e27ba2b71dea8 \ - --hash=sha256:36531f81c8214e293097cd2b7873f178997dae33d3667caaae8bdfb9666b76c0 \ - --hash=sha256:390240baeb9f415a82eefc2e13285016f9c8b5ad71ec80574ae8fa9605093cd7 \ - --hash=sha256:40442e2a4456e9910875ac12951476d36c0870dcb38a68719f8c4686609897c4 \ - --hash=sha256:4337e4aec93b7c011f7ee2e357b0d30562edd1955620fdd4aeab6aacd90d43c5 \ - --hash=sha256:43cfbb7db02b30ad3926e8fceaef260ba2fb7df787e38fa2df890c1ca7966c3b \ - --hash=sha256:43fe5af2d590bf4691531b1d9a2495d7aab2090547eaacd224a3afec95706d76 \ - --hash=sha256:46b9ed911f36bfeb6338e0b482e7fe7c27d362c52fde29f221fddbc9ee2227e7 \ - --hash=sha256:4d23854ecf381ab1facc8f353dcd9adeddef3652268ee75297c1164c987c11dc \ - --hash=sha256:4eb114a0754fd00075c12648d991ec7a4357f9cb873042cc9a77bf3a7e30c9db \ - --hash=sha256:4ee56288d0df919e4aac43b539dd0e34bb55d6a12a6562038e8d6f3ed07f9e36 \ - --hash=sha256:51a5e4c61a4541bd1cd3ba74766d0c9b6c12d6a1a4964ef60026832aac8e79b3 \ - --hash=sha256:522fe7abb41309e9543b0d9b8b434f2b630c5fdaf6482bee642b34c8c70079c8 \ - --hash=sha256:54c4855eabd9fc29707d30141be99e5cd1102e7d2258d2892314cf4c110726c3 \ - --hash=sha256:5592401cdf3dc682194727c1ddaa8aa0f3ddc57ca64fd03226a430b955eab6f6 \ - --hash=sha256:58ffd35bd5425c3c3b9692d078bf7ab851441434531a7e517c4984d5634cd65b \ - --hash=sha256:5967fe415b1920a3877a4195e9a2b779249630ee49ece22021c690320ff07452 \ - --hash=sha256:5fcd7d3b1d8ecb91445bd71b9c88bdbeae528fefee4f379895becfc72298d181 \ - --hash=sha256:63b634facdfbad421d4b61c90735688465d4ab3a8853ac22c76ccac2baf98d97 \ - --hash=sha256:690b20e3388a7ec98e899fd54c924e50ba6693874aa65ef9cb53de7f7de9d64a \ - --hash=sha256:6da7cd4f405fd7db56e51e96bff0865b9853ae70df0e6720624049da76bde2da \ - --hash=sha256:7488a43033c958637b1a08cddc9188eb06d3ad36582cebc7d4815980b47e27ef \ - --hash=sha256:74e748012f8c19b47f7d6321ac929a9a94ee92ef12bc4298c47e8b7219b26541 \ - --hash=sha256:78718d8454a6e928470d511bf8ac93f469283a45c354995f7d19e77292f26108 \ - --hash=sha256:7bf61bc4345c1895221357af8f3e89f8c103d93156ef326532d35c707e2fb19d \ - --hash=sha256:7da298e1659e45d151b4028ad5c7974917e108afb48731f4ed785d02b6818994 \ - --hash=sha256:84ef591495ffd3f9dcabffd6391db7bb70d7230b5c35ef5148354a134f56f2be \ - --hash=sha256:85b14a4689d5cff426c12eefe750738648706ea2753b20c2f973b2a000d3d261 \ - --hash=sha256:8a2e76efbf8772add72d002d67a4c3d0958638696f541734304c7f28217a9cab \ - --hash=sha256:8cb26f51c82d77483cdcd2b4a53cda55bbee29b3c2f3ddeb47182a2a9064e4eb \ - --hash=sha256:8db5dc617cb937ae17ff3403c3a70a7de9df4852a046f93e71edaec678f721d0 \ - --hash=sha256:9ab542c91f5a47aaa58abdd8ea84b498e8e49fe4b883d67800017757a3eb78e8 \ - --hash=sha256:9da022c14baeec36edfcc8daf0e281e2f55b950249a455776f0d1adeeada4734 \ - --hash=sha256:9f4b481b6cc3a897adb4279216695150bbe7a44c03daba3c894f49d2037e0a24 \ - --hash=sha256:a52a4704811e2623b0324a18d41ad4b9fabf43ce5ff99b14e40a520e2190c851 \ - --hash=sha256:a55da151d0b0c6ab176b4e761670ac0e2667817a1e0dadd04a01d0561a219349 \ - --hash=sha256:a674c0948789e9136d69065cc28009c1b1874c6ea340253db58be7622ce6398f \ - --hash=sha256:ae74f7c762270196d2dda56f8dd7309411f08a4084ff2dfcc0b095a218df2e06 \ - --hash=sha256:afd27d8629ae94c5d863e32ab0e1d5590371d296b87dae0a751fb22bf3685741 \ - --hash=sha256:b2d71cdefda9424adff9a3607ba5bbfc60ee972d73c21c7e3c19e71037574816 \ - --hash=sha256:b34339898bb556a2351a1830f88f751679f343eabf9cf05841c95b165152c9e7 \ - --hash=sha256:b372d10d17a701b0945f67be58fae4664fd056b85e0ff0fbc1e6c951cdbc0512 \ - --hash=sha256:b3c98d5b24c6095e89e03d65d5c574705be3d49c0d8ca10c17a8a4b5201b72f5 \ - --hash=sha256:b8dd6dd0e9c1992613ccda2bcb74fc9d49159dbe0f0ca4753f37527749885c25 \ - --hash=sha256:bd5913b4972681ffc9718bc2d4c53cde39ef81415e1671ff93e9aa30b46595e7 \ - --hash=sha256:c0b5fa5eda84057a4f1bbb4bb77a8c28ff20ae7ce211588d698ae453e13c6281 \ - --hash=sha256:c16304bba98f48a28ae10e32a8e75c349dd742c45156f297e16eeb1ba9287a1f \ - --hash=sha256:c24b8efd9c0f62bad0439283c2c795ef916c5a6b75f03c17799775c7ae3c0c9e \ - --hash=sha256:c2a5e8d207311a0170aca0eb6b160af91adc29ec121832e4ac151a57743a1e1e \ - --hash=sha256:c352fc8f36f7e9727db17adbf93f82499457b3d7e5511368569b4c5bd155a922 \ - --hash=sha256:c86df1c9af35d903d2b52d22ea3e66db8058d21dc0f59842ca5deb0595921141 \ - --hash=sha256:ca50bd612438258a91b5b3788c6621c1f05c8c478e7951899f492be42defc0da \ - --hash=sha256:d18a25b19ca7307045581b18b3ec9ead2b1db5ccd8719c291f0cd0a5cec6cb81 \ - --hash=sha256:d4f0c66df4386b75d2ab1e20a489f30dc7fd9a06a896d64980541506086be1f1 \ - --hash=sha256:d7ae472f74afcc47320238b5dbfd363aba111a525943c8a34a1b657c6be934c3 \ - --hash=sha256:db0efd6bae1c4730b9c863fc4f5f3c0fa3e8f05cae2c44ae141cb9dfc7d091dc \ - --hash=sha256:dbdd7679a6f4f08152818043dbb39491d1af3332128b3752c3ec5cebc0011a72 \ - --hash=sha256:e0b1520ef900e9ef62e392dd3d7ae4f5fa224d1dd62897a792cf353eb20b6cae \ - --hash=sha256:e2030956cf4886b10be9a0285c6802e078ec2391e1dd7ff3eb509c2c95a69b76 \ - --hash=sha256:e35e8aaaf3981489f42884b59726693de32dabfc438ac10ef4eb3409961fd402 \ - --hash=sha256:e380e85b93f148ad28ac15f8117e2fd8e5437aa7732d65e260134f83ce67911b \ - --hash=sha256:edf6e4c8fe14dfe316939711e3ece3f9a20760aabf686051b537a7562f4da91a \ - --hash=sha256:f3389924581d9a770c6caa4df4e74b606180869043b9073e2cec324bad6e306e \ - --hash=sha256:f64ccf593916e93b8d36ed55401bb7fe9c7d5de3180ce2e10b08f82a8f397316 \ - --hash=sha256:f720a14aa102a38907c6d5030e3d66b3b680c3e6f6bc95473931ea3c00c59967 \ - --hash=sha256:f8d19565ae3eb956d84da3ef367aa7def14a2735d05bd275cd54c0301f0d0d6c \ - --hash=sha256:f97487996a39cb18278ca33f7be98198f278d0bc3c5d0fd4d7b3d63646ca3c8a +lxml==5.4.0 \ + --hash=sha256:00b8686694423ddae324cf614e1b9659c2edb754de617703c3d29ff568448df5 \ + --hash=sha256:073eb6dcdf1f587d9b88c8c93528b57eccda40209cf9be549d469b942b41d70b \ + --hash=sha256:09846782b1ef650b321484ad429217f5154da4d6e786636c38e434fa32e94e49 \ + --hash=sha256:0a01ce7d8479dce84fc03324e3b0c9c90b1ece9a9bb6a1b6c9025e7e4520e78c \ + --hash=sha256:0be91891bdb06ebe65122aa6bf3fc94489960cf7e03033c6f83a90863b23c58b \ + --hash=sha256:0cef4feae82709eed352cd7e97ae062ef6ae9c7b5dbe3663f104cd2c0e8d94ba \ + --hash=sha256:0e108352e203c7afd0eb91d782582f00a0b16a948d204d4dec8565024fafeea5 \ + --hash=sha256:0ea0252b51d296a75f6118ed0d8696888e7403408ad42345d7dfd0d1e93309a7 \ + --hash=sha256:0fce1294a0497edb034cb416ad3e77ecc89b313cff7adbee5334e4dc0d11f422 \ + --hash=sha256:1320091caa89805df7dcb9e908add28166113dcd062590668514dbd510798c88 \ + --hash=sha256:142accb3e4d1edae4b392bd165a9abdee8a3c432a2cca193df995bc3886249c8 \ + --hash=sha256:14479c2ad1cb08b62bb941ba8e0e05938524ee3c3114644df905d2331c76cd57 \ + --hash=sha256:151d6c40bc9db11e960619d2bf2ec5829f0aaffb10b41dcf6ad2ce0f3c0b2325 \ + --hash=sha256:15a665ad90054a3d4f397bc40f73948d48e36e4c09f9bcffc7d90c87410e478a \ + --hash=sha256:1a42b3a19346e5601d1b8296ff6ef3d76038058f311902edd574461e9c036982 \ + --hash=sha256:1af80c6316ae68aded77e91cd9d80648f7dd40406cef73df841aa3c36f6907c8 \ + --hash=sha256:1b717b00a71b901b4667226bba282dd462c42ccf618ade12f9ba3674e1fabc55 \ + --hash=sha256:1dc4ca99e89c335a7ed47d38964abcb36c5910790f9bd106f2a8fa2ee0b909d2 \ + --hash=sha256:20e16c08254b9b6466526bc1828d9370ee6c0d60a4b64836bc3ac2917d1e16df \ + --hash=sha256:226046e386556a45ebc787871d6d2467b32c37ce76c2680f5c608e25823ffc84 \ + --hash=sha256:24974f774f3a78ac12b95e3a20ef0931795ff04dbb16db81a90c37f589819551 \ + --hash=sha256:24f6df5f24fc3385f622c0c9d63fe34604893bc1a5bdbb2dbf5870f85f9a404a \ + --hash=sha256:27a9ded0f0b52098ff89dd4c418325b987feed2ea5cc86e8860b0f844285d740 \ + --hash=sha256:29f451a4b614a7b5b6c2e043d7b64a15bd8304d7e767055e8ab68387a8cacf4e \ + --hash=sha256:2b31a3a77501d86d8ade128abb01082724c0dfd9524f542f2f07d693c9f1175f \ + --hash=sha256:2c62891b1ea3094bb12097822b3d44b93fc6c325f2043c4d2736a8ff09e65f60 \ + --hash=sha256:2dc191e60425ad70e75a68c9fd90ab284df64d9cd410ba8d2b641c0c45bc006e \ + --hash=sha256:31e63621e073e04697c1b2d23fcb89991790eef370ec37ce4d5d469f40924ed6 \ + --hash=sha256:32697d2ea994e0db19c1df9e40275ffe84973e4232b5c274f47e7c1ec9763cdd \ + --hash=sha256:3a3178b4873df8ef9457a4875703488eb1622632a9cee6d76464b60e90adbfcd \ + --hash=sha256:3b9c2754cef6963f3408ab381ea55f47dabc6f78f4b8ebb0f0b25cf1ac1f7609 \ + --hash=sha256:3d3c30ba1c9b48c68489dc1829a6eede9873f52edca1dda900066542528d6b20 \ + --hash=sha256:3e6d5557989cdc3ebb5302bbdc42b439733a841891762ded9514e74f60319ad6 \ + --hash=sha256:4025bf2884ac4370a3243c5aa8d66d3cb9e15d3ddd0af2d796eccc5f0244390e \ + --hash=sha256:4291d3c409a17febf817259cb37bc62cb7eb398bcc95c1356947e2871911ae61 \ + --hash=sha256:4329422de653cdb2b72afa39b0aa04252fca9071550044904b2e7036d9d97fe4 \ + --hash=sha256:43d549b876ce64aa18b2328faff70f5877f8c6dede415f80a2f799d31644d776 \ + --hash=sha256:460508a4b07364d6abf53acaa0a90b6d370fafde5693ef37602566613a9b0779 \ + --hash=sha256:47fb24cc0f052f0576ea382872b3fc7e1f7e3028e53299ea751839418ade92a6 \ + --hash=sha256:48b4afaf38bf79109bb060d9016fad014a9a48fb244e11b94f74ae366a64d252 \ + --hash=sha256:497cab4d8254c2a90bf988f162ace2ddbfdd806fce3bda3f581b9d24c852e03c \ + --hash=sha256:4aa412a82e460571fad592d0f93ce9935a20090029ba08eca05c614f99b0cc92 \ + --hash=sha256:4b7ce10634113651d6f383aa712a194179dcd496bd8c41e191cec2099fa09de5 \ + --hash=sha256:4cd915c0fb1bed47b5e6d6edd424ac25856252f09120e3e8ba5154b6b921860e \ + --hash=sha256:4d885698f5019abe0de3d352caf9466d5de2baded00a06ef3f1216c1a58ae78f \ + --hash=sha256:4f5322cf38fe0e21c2d73901abf68e6329dc02a4994e483adbcf92b568a09a54 \ + --hash=sha256:50441c9de951a153c698b9b99992e806b71c1f36d14b154592580ff4a9d0d877 \ + --hash=sha256:529024ab3a505fed78fe3cc5ddc079464e709f6c892733e3f5842007cec8ac6e \ + --hash=sha256:53370c26500d22b45182f98847243efb518d268374a9570409d2e2276232fd37 \ + --hash=sha256:53d9469ab5460402c19553b56c3648746774ecd0681b1b27ea74d5d8a3ef5590 \ + --hash=sha256:56dbdbab0551532bb26c19c914848d7251d73edb507c3079d6805fa8bba5b706 \ + --hash=sha256:5a99d86351f9c15e4a901fc56404b485b1462039db59288b203f8c629260a142 \ + --hash=sha256:5cca36a194a4eb4e2ed6be36923d3cffd03dcdf477515dea687185506583d4c9 \ + --hash=sha256:5f11a1526ebd0dee85e7b1e39e39a0cc0d9d03fb527f56d8457f6df48a10dc0c \ + --hash=sha256:61c7bbf432f09ee44b1ccaa24896d21075e533cd01477966a5ff5a71d88b2f56 \ + --hash=sha256:639978bccb04c42677db43c79bdaa23785dc7f9b83bfd87570da8207872f1ce5 \ + --hash=sha256:63e7968ff83da2eb6fdda967483a7a023aa497d85ad8f05c3ad9b1f2e8c84987 \ + --hash=sha256:664cdc733bc87449fe781dbb1f309090966c11cc0c0cd7b84af956a02a8a4729 \ + --hash=sha256:67ed8a40665b84d161bae3181aa2763beea3747f748bca5874b4af4d75998f87 \ + --hash=sha256:67f779374c6b9753ae0a0195a892a1c234ce8416e4448fe1e9f34746482070a7 \ + --hash=sha256:6854f8bd8a1536f8a1d9a3655e6354faa6406621cf857dc27b681b69860645c7 \ + --hash=sha256:696ea9e87442467819ac22394ca36cb3d01848dad1be6fac3fb612d3bd5a12cf \ + --hash=sha256:6ef80aeac414f33c24b3815ecd560cee272786c3adfa5f31316d8b349bfade28 \ + --hash=sha256:72ac9762a9f8ce74c9eed4a4e74306f2f18613a6b71fa065495a67ac227b3056 \ + --hash=sha256:75133890e40d229d6c5837b0312abbe5bac1c342452cf0e12523477cd3aa21e7 \ + --hash=sha256:7605c1c32c3d6e8c990dd28a0970a3cbbf1429d5b92279e37fda05fb0c92190e \ + --hash=sha256:773e27b62920199c6197130632c18fb7ead3257fce1ffb7d286912e56ddb79e0 \ + --hash=sha256:795f61bcaf8770e1b37eec24edf9771b307df3af74d1d6f27d812e15a9ff3872 \ + --hash=sha256:79d5bfa9c1b455336f52343130b2067164040604e41f6dc4d8313867ed540079 \ + --hash=sha256:7a62cc23d754bb449d63ff35334acc9f5c02e6dae830d78dab4dd12b78a524f4 \ + --hash=sha256:7be701c24e7f843e6788353c055d806e8bd8466b52907bafe5d13ec6a6dbaecd \ + --hash=sha256:7ca56ebc2c474e8f3d5761debfd9283b8b18c76c4fc0967b74aeafba1f5647f9 \ + --hash=sha256:7ce1a171ec325192c6a636b64c94418e71a1964f56d002cc28122fceff0b6121 \ + --hash=sha256:891f7f991a68d20c75cb13c5c9142b2a3f9eb161f1f12a9489c82172d1f133c0 \ + --hash=sha256:8f82125bc7203c5ae8633a7d5d20bcfdff0ba33e436e4ab0abc026a53a8960b7 \ + --hash=sha256:91505d3ddebf268bb1588eb0f63821f738d20e1e7f05d3c647a5ca900288760b \ + --hash=sha256:942a5d73f739ad7c452bf739a62a0f83e2578afd6b8e5406308731f4ce78b16d \ + --hash=sha256:9454b8d8200ec99a224df8854786262b1bd6461f4280064c807303c642c05e76 \ + --hash=sha256:9459e6892f59ecea2e2584ee1058f5d8f629446eab52ba2305ae13a32a059530 \ + --hash=sha256:9776af1aad5a4b4a1317242ee2bea51da54b2a7b7b48674be736d463c999f37d \ + --hash=sha256:97dac543661e84a284502e0cf8a67b5c711b0ad5fb661d1bd505c02f8cf716d7 \ + --hash=sha256:98a3912194c079ef37e716ed228ae0dcb960992100461b704aea4e93af6b0bb9 \ + --hash=sha256:9b4a3bd174cc9cdaa1afbc4620c049038b441d6ba07629d89a83b408e54c35cd \ + --hash=sha256:9c886b481aefdf818ad44846145f6eaf373a20d200b5ce1a5c8e1bc2d8745410 \ + --hash=sha256:9ceaf423b50ecfc23ca00b7f50b64baba85fb3fb91c53e2c9d00bc86150c7e40 \ + --hash=sha256:a11a96c3b3f7551c8a8109aa65e8594e551d5a84c76bf950da33d0fb6dfafab7 \ + --hash=sha256:a3bcdde35d82ff385f4ede021df801b5c4a5bcdfb61ea87caabcebfc4945dc1b \ + --hash=sha256:a7fb111eef4d05909b82152721a59c1b14d0f365e2be4c742a473c5d7372f4f5 \ + --hash=sha256:a81e1196f0a5b4167a8dafe3a66aa67c4addac1b22dc47947abd5d5c7a3f24b5 \ + --hash=sha256:a8c9b7f16b63e65bbba889acb436a1034a82d34fa09752d754f88d708eca80e1 \ + --hash=sha256:a8ef956fce64c8551221f395ba21d0724fed6b9b6242ca4f2f7beb4ce2f41997 \ + --hash=sha256:ab339536aa798b1e17750733663d272038bf28069761d5be57cb4a9b0137b4f8 \ + --hash=sha256:ac7ba71f9561cd7d7b55e1ea5511543c0282e2b6450f122672a2694621d63b7e \ + --hash=sha256:aea53d51859b6c64e7c51d522c03cc2c48b9b5d6172126854cc7f01aa11f52bc \ + --hash=sha256:aea7c06667b987787c7d1f5e1dfcd70419b711cdb47d6b4bb4ad4b76777a0563 \ + --hash=sha256:aefe1a7cb852fa61150fcb21a8c8fcea7b58c4cb11fbe59c97a0a4b31cae3c8c \ + --hash=sha256:b0989737a3ba6cf2a16efb857fb0dfa20bc5c542737fddb6d893fde48be45433 \ + --hash=sha256:b108134b9667bcd71236c5a02aad5ddd073e372fb5d48ea74853e009fe38acb6 \ + --hash=sha256:b12cb6527599808ada9eb2cd6e0e7d3d8f13fe7bbb01c6311255a15ded4c7ab4 \ + --hash=sha256:b5aff6f3e818e6bdbbb38e5967520f174b18f539c2b9de867b1e7fde6f8d95a4 \ + --hash=sha256:b67319b4aef1a6c56576ff544b67a2a6fbd7eaee485b241cabf53115e8908b8f \ + --hash=sha256:b7c86884ad23d61b025989d99bfdd92a7351de956e01c61307cb87035960bcb1 \ + --hash=sha256:b92b69441d1bd39f4940f9eadfa417a25862242ca2c396b406f9272ef09cdcaa \ + --hash=sha256:bcb7a1096b4b6b24ce1ac24d4942ad98f983cd3810f9711bcd0293f43a9d8b9f \ + --hash=sha256:bda3ea44c39eb74e2488297bb39d47186ed01342f0022c8ff407c250ac3f498e \ + --hash=sha256:be2ba4c3c5b7900246a8f866580700ef0d538f2ca32535e991027bdaba944063 \ + --hash=sha256:c5681160758d3f6ac5b4fea370495c48aac0989d6a0f01bb9a72ad8ef5ab75c4 \ + --hash=sha256:c5d32f5284012deaccd37da1e2cd42f081feaa76981f0eaa474351b68df813c5 \ + --hash=sha256:c6364038c519dffdbe07e3cf42e6a7f8b90c275d4d1617a69bb59734c1a2d571 \ + --hash=sha256:c70e93fba207106cb16bf852e421c37bbded92acd5964390aad07cb50d60f5cf \ + --hash=sha256:ca755eebf0d9e62d6cb013f1261e510317a41bf4650f22963474a663fdfe02aa \ + --hash=sha256:cccd007d5c95279e529c146d095f1d39ac05139de26c098166c4beb9374b0f4d \ + --hash=sha256:ce31158630a6ac85bddd6b830cffd46085ff90498b397bd0a259f59d27a12188 \ + --hash=sha256:ce9c671845de9699904b1e9df95acfe8dfc183f2310f163cdaa91a3535af95de \ + --hash=sha256:d12832e1dbea4be280b22fd0ea7c9b87f0d8fc51ba06e92dc62d52f804f78ebd \ + --hash=sha256:d2ed1b3cb9ff1c10e6e8b00941bb2e5bb568b307bfc6b17dffbbe8be5eecba86 \ + --hash=sha256:d5663bc1b471c79f5c833cffbc9b87d7bf13f87e055a5c86c363ccd2348d7e82 \ + --hash=sha256:d90b729fd2732df28130c064aac9bb8aff14ba20baa4aee7bd0795ff1187545f \ + --hash=sha256:dc0af80267edc68adf85f2a5d9be1cdf062f973db6790c1d065e45025fa26140 \ + --hash=sha256:de5b4e1088523e2b6f730d0509a9a813355b7f5659d70eb4f319c76beea2e250 \ + --hash=sha256:de6f6bb8a7840c7bf216fb83eec4e2f79f7325eca8858167b68708b929ab2172 \ + --hash=sha256:df53330a3bff250f10472ce96a9af28628ff1f4efc51ccba351a8820bca2a8ba \ + --hash=sha256:e094ec83694b59d263802ed03a8384594fcce477ce484b0cbcd0008a211ca751 \ + --hash=sha256:e794f698ae4c5084414efea0f5cc9f4ac562ec02d66e1484ff822ef97c2cadff \ + --hash=sha256:e7bc6df34d42322c5289e37e9971d6ed114e3776b45fa879f734bded9d1fea9c \ + --hash=sha256:eaf24066ad0b30917186420d51e2e3edf4b0e2ea68d8cd885b14dc8afdcf6556 \ + --hash=sha256:ecf4c4b83f1ab3d5a7ace10bafcb6f11df6156857a3c418244cef41ca9fa3e44 \ + --hash=sha256:ef5a7178fcc73b7d8c07229e89f8eb45b2908a9238eb90dcfc46571ccf0383b8 \ + --hash=sha256:f5cb182f6396706dc6cc1896dd02b1c889d644c081b0cdec38747573db88a7d7 \ + --hash=sha256:fa0e294046de09acd6146be0ed6727d1f42ded4ce3ea1e9a19c11b6774eea27c \ + --hash=sha256:fb54f7c6bafaa808f27166569b1511fc42701a7713858dddc08afdde9746849e \ + --hash=sha256:fd3be6481ef54b8cfd0e1e953323b7aa9d9789b94842d0e5b142ef4bb7999539 # via # -r requirements-actions.in # gcovr @@ -797,9 +833,8 @@ polib==1.2.0 \ --hash=sha256:1c77ee1b81feb31df9bca258cbc58db1bbb32d10214b173882452c73af06d62d \ --hash=sha256:f3ef94aefed6e183e342a8a269ae1fc4742ba193186ad76f175938621dbfc26b # via sphinx-lint -progress==1.6.1 \ - --hash=sha256:5239f22f305c12fdc8ce6e0e47f70f21622a935e16eafc4535617112e7c7ea0b \ - --hash=sha256:c1ba719f862ce885232a759eab47971fe74dfc7bb76ab8a51ef5940bad35086c +progress==1.6 \ + --hash=sha256:c9c86e98b5c03fa1fe11e3b67c1feda4788b8d0fe7336c2ff7d5644ccfba34cd # via -r requirements-actions.in psutil==7.0.0 \ --hash=sha256:101d71dc322e3cffd7cea0650b09b3d08b8e7c4109dd6809fe452dfd00e58b25 \ @@ -829,9 +864,9 @@ pygithub==2.6.1 \ --hash=sha256:6f2fa6d076ccae475f9fc392cc6cdbd54db985d4f69b8833a28397de75ed6ca3 \ --hash=sha256:b5c035392991cca63959e9453286b41b54d83bf2de2daa7d7ff7e4312cebf3bf # via -r requirements-actions.in -pygments==2.19.2 \ - --hash=sha256:636cb2477cec7f8952536970bc533bc43743542f70392ae026374600add5b887 \ - --hash=sha256:86540386c03d588bb81d44bc3928634ff26449851e99741617ecb9037ee5ec0b +pygments==2.19.1 \ + --hash=sha256:61c16d2a8576dc0649d9f39e089b5f02bcd27fba10d8fb4dcc28173f7a45151f \ + --hash=sha256:9ea1544ad55cecf4b8242fab6dd35a93bbce657034b0611ee383099054ab6d8c # via # gcovr # pytest @@ -1214,13 +1249,7 @@ tomli==2.2.1 \ --hash=sha256:e85e99945e688e32d5a35c1ff38ed0b3f41f43fad8df0bdf79f72b2ba7bc5272 \ --hash=sha256:ece47d672db52ac607a3d9599a9d48dcb2f2f735c6c2d1f34130085bb12b112a \ --hash=sha256:f4039b9cbc3048b2416cc57ab3bda989a6fcf9b36cf8937f01a6e731b64f80d7 - # via - # -r requirements-actions.in - # mypy - # pylint - # pyproject-api - # pytest - # tox + # via -r requirements-actions.in tomlkit==0.13.3 \ --hash=sha256:430cf247ee57df2b94ee3fbe588e71d362a941ebb545dec29b53961d61add2a1 \ --hash=sha256:c89c649d79ee40629a9fda55f8ace8c6a1b42deb912b2a8fd8d942ddadb606b0 @@ -1235,13 +1264,11 @@ typing-extensions==4.14.0 \ --hash=sha256:8676b788e32f02ab42d9e7c61324048ae4c6d844a399eebace3d4979d75ceef4 \ --hash=sha256:a1514509136dd0b477638fc68d6a91497af5076466ad0fa6c338e44e359944af # via - # astroid # elasticsearch # exceptiongroup # mypy # pygithub # python-can - # tox unidiff==0.7.5 \ --hash=sha256:2e5f0162052248946b9f0970a40e9e124236bf86c82b70821143a6fc1dea2574 \ --hash=sha256:c93bf2265cc1ba2a520e415ab05da587370bc2a3ae9e0414329f54f0c2fc09e8 From a7ea0a3d6f479c2ceb1f9880ba7490bf85de9d22 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:26 +0300 Subject: [PATCH 0851/2141] Revert "[nrf fromtree] scripts: check_compliance: Fix traceback in junitparser" This reverts commit 4ae5a61a99616ca8161296cb98e84c424130c1d7. Signed-off-by: Jukka Rissanen --- scripts/requirements-actions.in | 2 +- scripts/requirements-compliance.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/requirements-actions.in b/scripts/requirements-actions.in index 4bdb9b0fbdad..0fbced12c514 100644 --- a/scripts/requirements-actions.in +++ b/scripts/requirements-actions.in @@ -11,7 +11,7 @@ gitpython>=3.1.41 ijson intelhex junit2html -junitparser>=4.0.1 +junitparser>=2 lxml>=5.3.0 mock mypy diff --git a/scripts/requirements-compliance.txt b/scripts/requirements-compliance.txt index 3c3841cf33ed..19bdcb3071f3 100644 --- a/scripts/requirements-compliance.txt +++ b/scripts/requirements-compliance.txt @@ -4,7 +4,7 @@ # zephyr-keep-sorted-start clang-format>=15.0.0 gitlint -junitparser>=4.0.1 +junitparser>=2 lxml>=5.3.0 pykwalify pylint>=3 From 8f5918d0fc42a1c0ee152a20646e551c12d75cee Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:26 +0300 Subject: [PATCH 0852/2141] Revert "[nrf fromtree] scripts: west: spdx: extract copyright info" This reverts commit 990fa0d507abc0fc4764f463d27619c049c3b208. Signed-off-by: Jukka Rissanen --- doc/develop/west/zephyr-cmds.rst | 7 ----- scripts/requirements-actions.in | 1 - scripts/requirements-actions.txt | 38 ++++---------------------- scripts/requirements-base.txt | 1 - scripts/west_commands/zspdx/scanner.py | 30 -------------------- 5 files changed, 5 insertions(+), 72 deletions(-) diff --git a/doc/develop/west/zephyr-cmds.rst b/doc/develop/west/zephyr-cmds.rst index 8049d5c4309e..e40093c3dd16 100644 --- a/doc/develop/west/zephyr-cmds.rst +++ b/doc/develop/west/zephyr-cmds.rst @@ -130,13 +130,6 @@ Each file in the bill-of-materials is scanned, so that its hashes (SHA256 and SHA1) can be recorded, along with any detected licenses if an ``SPDX-License-Identifier`` comment appears in the file. -Copyright notices are extracted using the third-party :command:`reuse` tool from the REUSE group. -When found, these notices are added to SPDX documents as ``FileCopyrightText`` fields. - -.. note:: - Copyright extraction uses heuristics that may not capture complete notice text, so - ``FileCopyrightText`` content is best-effort. This aligns with SPDX specification recommendations. - SPDX Relationships are created to indicate dependencies between CMake build targets, build targets that are linked together, and source files that are compiled to generate the built library files. diff --git a/scripts/requirements-actions.in b/scripts/requirements-actions.in index 0fbced12c514..0fb1eca5ad81 100644 --- a/scripts/requirements-actions.in +++ b/scripts/requirements-actions.in @@ -28,7 +28,6 @@ pytest python-magic-bin; sys_platform == "win32" python-magic; sys_platform != "win32" pyyaml -reuse ruff==0.11.11 setuptools>=70.2.0 spdx-tools diff --git a/scripts/requirements-actions.txt b/scripts/requirements-actions.txt index e9faf32c7f91..5dc028452880 100644 --- a/scripts/requirements-actions.txt +++ b/scripts/requirements-actions.txt @@ -12,10 +12,6 @@ astroid==3.3.10 \ --hash=sha256:104fb9cb9b27ea95e847a94c003be03a9e039334a8ebca5ee27dafaf5c5711eb \ --hash=sha256:c332157953060c6deb9caa57303ae0d20b0fbdb2e59b4a4f2a6ba49d0a7961ce # via pylint -attrs==25.3.0 \ - --hash=sha256:427318ce031701fea540783410126f03899a97ffc6f61596ad581ac2e40e3bc3 \ - --hash=sha256:75d7cefc7fb576747b2c81b4442d4d4a1ce0900973527c011d1030fd3bf4af1b - # via reuse awscli==1.40.38 \ --hash=sha256:3f90f2815e3b72691785d2bbd4f2c3dcbde311c55e1f5633a37cc3e514ba6fdb \ --hash=sha256:ec9b69ff4600ef151df3336f0e7af4cf30280d27f9d8e67e09c4b386ceb1f154 @@ -24,16 +20,10 @@ beartype==0.21.0 \ --hash=sha256:b6a1bd56c72f31b0a496a36cc55df6e2f475db166ad07fa4acc7e74f4c7f34c0 \ --hash=sha256:f9a5078f5ce87261c2d22851d19b050b64f6a805439e8793aecf01ce660d3244 # via spdx-tools -binaryornot==0.4.4 \ - --hash=sha256:359501dfc9d40632edc9fac890e19542db1a287bbcfa58175b66658392018061 \ - --hash=sha256:b8b71173c917bddcd2c16070412e369c3ed7f0528926f70cac18a6c97fd563e4 - # via reuse boolean-py==5.0 \ --hash=sha256:60cbc4bad079753721d32649545505362c754e121570ada4658b852a3a318d95 \ --hash=sha256:ef28a70bd43115208441b53a045d1549e2f0ec6e3d08a9d142cbc41c1938e8d9 - # via - # license-expression - # reuse + # via license-expression botocore==1.38.39 \ --hash=sha256:2305f688e9328af473a504197584112f228513e06412038d83205ce8d1456f40 \ --hash=sha256:ee3aa03af1dabed4f3710cd64f6d9d488281eee720710bf1cf9f2b2fd30025ae @@ -128,9 +118,7 @@ cffi==1.17.1 \ chardet==5.2.0 \ --hash=sha256:1b3b6ff479a8c414bc3fa2c0852995695c4a026dcd6d0633b2dd092ca39c1cf7 \ --hash=sha256:e1cf59446890a00105fe7b7912492ea04b6e6f06d4b742b2c788469e34c82970 - # via - # binaryornot - # tox + # via tox charset-normalizer==3.4.2 \ --hash=sha256:005fa3432484527f9732ebd315da8da8001593e2cf46a3d817669f062c3d9ed4 \ --hash=sha256:046595208aae0120559a67693ecc65dd75d46f7bf687f159127046628178dc45 \ @@ -224,9 +212,7 @@ charset-normalizer==3.4.2 \ --hash=sha256:fb707f3e15060adf5b7ada797624a6c6e0138e2a26baa089df64c68ee98e040f \ --hash=sha256:fcbe676a55d7445b22c10967bceaaf0ee69407fbe0ece4d032b6eb8d4565982a \ --hash=sha256:fdb20a30fe1175ecabed17cbf7812f7b804b8a315a25f24678bcdf120a90077f - # via - # python-debian - # requests + # via requests clang-format==20.1.6 \ --hash=sha256:0ea008a20951527d35a1e2b8febdca3c47c6f8e9a1bd174601c891e20053ef2e \ --hash=sha256:11530ff352c64176ba4297ad398452d9fcd442b4a8bb2a804cc7915bc94b96e1 \ @@ -250,7 +236,6 @@ click==8.1.3 \ --hash=sha256:bb4d8133cb15a609f44e8213d9b391b0809795062913b383c62be0ee95b1db48 # via # gitlint-core - # reuse # spdx-tools colorama==0.4.6 \ --hash=sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44 \ @@ -467,7 +452,6 @@ jinja2==3.1.6 \ # via # gcovr # junit2html - # reuse jmespath==1.0.1 \ --hash=sha256:02e2e4cc71b5bcab88332eebf907519190dd9e6e82107fa7f83b1003a6252980 \ --hash=sha256:90261b206d6defd58fdd5e85f478bf633a2901798906be2ad389150c5c60edbe @@ -482,9 +466,7 @@ junitparser==3.2.0 \ license-expression==30.4.1 \ --hash=sha256:679646bc3261a17690494a3e1cada446e5ee342dbd87dcfa4a0c24cc5dce13ee \ --hash=sha256:9f02105f9e0fcecba6a85dfbbed7d94ea1c3a70cf23ddbfb5adf3438a6f6fce0 - # via - # reuse - # spdx-tools + # via spdx-tools lxml==5.4.0 \ --hash=sha256:00b8686694423ddae324cf614e1b9659c2edb754de617703c3d29ff568448df5 \ --hash=sha256:073eb6dcdf1f587d9b88c8c93528b57eccda40209cf9be549d469b942b41d70b \ @@ -924,10 +906,6 @@ python-dateutil==2.9.0.post0 \ # botocore # elasticsearch # pykwalify -python-debian==1.0.1 \ - --hash=sha256:3ada9b83a3d671b58081782c0969cffa0102f6ce433fbbc7cf21275b8b5cc771 \ - --hash=sha256:8f137c230c1d9279c2ac892b35915068b2aca090c9fd3da5671ff87af32af12c - # via reuse python-magic==0.4.27 ; sys_platform != 'win32' \ --hash=sha256:c1ba14b08e4a5f5c31a302b7721239695b2f0f058d125bd5ce1ee36b9d9d3c3b \ --hash=sha256:c212960ad306f700aa0d01e5d7a325d20548ff97eb9920dcd29513174f0294d3 @@ -1101,10 +1079,6 @@ requests==2.32.4 \ --hash=sha256:27babd3cda2a6d50b30443204ee89830707d396671944c998b5975b031ac2b2c \ --hash=sha256:27d0316682c8a29834d3264820024b62a36942083d52caf2f14c0591336d3422 # via pygithub -reuse==5.0.2 \ - --hash=sha256:7a680f00324e87a72061677a892d8cbabfddf7adcf7a5376aeeed2d78995bbbb \ - --hash=sha256:878016ae5dd29c10bad4606d6676c12a268c12aa9fcfea66403598e16eed085c - # via -r requirements-actions.in rsa==4.7.2 \ --hash=sha256:78f9a9bf4e7be0c5ded4583326e7461e3a3c5aae24073648b4bdfa797d78c9d2 \ --hash=sha256:9d689e6ca1b3038bc82bf8d23e944b6b6037bc02301a574935b2dd946e0353b9 @@ -1253,9 +1227,7 @@ tomli==2.2.1 \ tomlkit==0.13.3 \ --hash=sha256:430cf247ee57df2b94ee3fbe588e71d362a941ebb545dec29b53961d61add2a1 \ --hash=sha256:c89c649d79ee40629a9fda55f8ace8c6a1b42deb912b2a8fd8d942ddadb606b0 - # via - # pylint - # reuse + # via pylint tox==4.27.0 \ --hash=sha256:2b8a7fb986b82aa2c830c0615082a490d134e0626dbc9189986da46a313c4f20 \ --hash=sha256:b97d5ecc0c0d5755bcc5348387fef793e1bfa68eb33746412f4c60881d7f5f57 diff --git a/scripts/requirements-base.txt b/scripts/requirements-base.txt index 2b35d3df097c..6e3cc0616cf4 100644 --- a/scripts/requirements-base.txt +++ b/scripts/requirements-base.txt @@ -24,7 +24,6 @@ pyserial requests>=2.32.0 semver tqdm>=4.67.1 -reuse # for ram/rom reports anytree diff --git a/scripts/west_commands/zspdx/scanner.py b/scripts/west_commands/zspdx/scanner.py index 93c43095598e..2a4ac792b9cd 100644 --- a/scripts/west_commands/zspdx/scanner.py +++ b/scripts/west_commands/zspdx/scanner.py @@ -6,7 +6,6 @@ import os import re -from reuse.project import Project from west import log from zspdx.licenses import LICENSES @@ -178,32 +177,6 @@ def normalizeExpression(licsConcluded): return " AND ".join(revised) -def getCopyrightInfo(filePath): - """ - Scans the specified file for copyright information using REUSE tools. - - Arguments: - - filePath: path to file to scan - - Returns: list of copyright statements if found; empty list if not found - """ - log.dbg(f" - getting copyright info for {filePath}") - - try: - project = Project(os.path.dirname(filePath)) - infos = project.reuse_info_of(filePath) - copyrights = [] - - for info in infos: - if info.copyright_lines: - copyrights.extend(info.copyright_lines) - - return copyrights - except Exception as e: - log.wrn(f"Error getting copyright info for {filePath}: {e}") - return [] - - def scanDocument(cfg, doc): """ Scan for licenses and calculate hashes for all Files and Packages @@ -240,9 +213,6 @@ def scanDocument(cfg, doc): f.concludedLicense = expression f.licenseInfoInFile = splitExpression(expression) - if copyrights := getCopyrightInfo(f.abspath): - f.copyrightText = f"\n{'\n'.join(copyrights)}\n" - # check if any custom license IDs should be flagged for document for lic in f.licenseInfoInFile: checkLicenseValid(lic, doc) From 2f35003d3eb0d5c525c095715cba76bae89597e8 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:26 +0300 Subject: [PATCH 0853/2141] Revert "[nrf fromtree] doc: ci: Zephyr now requires Python 3.12 or higher" This reverts commit 3d07feb9692c2bb5bba03347e40f1151e000e8e2. Signed-off-by: Jukka Rissanen --- cmake/modules/python.cmake | 2 +- doc/develop/getting_started/index.rst | 2 +- doc/releases/migration-guide-4.2.rst | 5 - doc/requirements.txt | 801 +++++++++++++------------- scripts/ci/check_compliance.py | 2 +- scripts/requirements-actions.txt | 56 +- 6 files changed, 453 insertions(+), 415 deletions(-) diff --git a/cmake/modules/python.cmake b/cmake/modules/python.cmake index 1438c3fcdaa6..e01d31921202 100644 --- a/cmake/modules/python.cmake +++ b/cmake/modules/python.cmake @@ -11,7 +11,7 @@ if (WIN32) set(ENV{PYTHONIOENCODING} "utf-8") endif() -set(PYTHON_MINIMUM_REQUIRED 3.12) +set(PYTHON_MINIMUM_REQUIRED 3.10) if(NOT DEFINED Python3_EXECUTABLE AND DEFINED WEST_PYTHON) set(Python3_EXECUTABLE "${WEST_PYTHON}") diff --git a/doc/develop/getting_started/index.rst b/doc/develop/getting_started/index.rst index 5ba0d070fcaf..78f43e70b5fd 100644 --- a/doc/develop/getting_started/index.rst +++ b/doc/develop/getting_started/index.rst @@ -62,7 +62,7 @@ The current minimum required version for the main dependencies are: - 3.20.5 * - `Python `_ - - 3.12 + - 3.10 * - `Devicetree compiler `_ - 1.4.6 diff --git a/doc/releases/migration-guide-4.2.rst b/doc/releases/migration-guide-4.2.rst index 26e4bd655e7d..9b31f4a16348 100644 --- a/doc/releases/migration-guide-4.2.rst +++ b/doc/releases/migration-guide-4.2.rst @@ -20,11 +20,6 @@ the :ref:`release notes`. :local: :depth: 2 -Common -****** - -* The minimum required Python version is now 3.12 (from 3.10). - Build System ************ diff --git a/doc/requirements.txt b/doc/requirements.txt index 3d424a5627ee..c10b390651a9 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -1,5 +1,5 @@ # This file was autogenerated by uv via the following command: -# uv pip compile --universal --python-version 3.12 --generate-hashes requirements.in --output-file requirements.txt +# uv pip compile --universal --python-version 3.10 --generate-hashes requirements.in --output-file requirements.txt alabaster==1.0.0 \ --hash=sha256:c00dca57bca26fa62a6d7d0a9fcce65f3e026e9bfe33e9c538fd3fbb2144fd9e \ --hash=sha256:fc6786402dc3fcb2de3cabd5fe455a2db534b371124f1f21de8731783dec828b @@ -10,115 +10,115 @@ anyio==4.9.0 \ # via # starlette # watchfiles -anytree==2.13.0 \ - --hash=sha256:4cbcf10df36b1f1cba131b7e487ff3edafc9d6e932a3c70071b5b768bab901ff \ - --hash=sha256:c9d3aa6825fdd06af7ebb05b4ef291d2db63e62bb1f9b7d9b71354be9d362714 +anytree==2.12.1 \ + --hash=sha256:244def434ccf31b668ed282954e5d315b4e066c4940b94aff4a7962d85947830 \ + --hash=sha256:5ea9e61caf96db1e5b3d0a914378d2cd83c269dfce1fb8242ce96589fa3382f0 # via -r requirements.in babel==2.17.0 \ --hash=sha256:0c54cffb19f690cdcc52a3b50bcbf71e07a808d1c80d549f2459b9d2cf0afb9d \ --hash=sha256:4d0b53093fdfb4b21c92b5213dba5a1b23885afa8383709427046b21c366e5f2 # via sphinx -certifi==2025.6.15 \ - --hash=sha256:2e0c7ce7cb5d8f8634ca55d2ba7e6ec2689a2fd6537d8dec1296a477a4910057 \ - --hash=sha256:d747aa5a8b9bbbb1bb8c22bb13e22bd1f18e9796defa16bab421f7f7a317323b +certifi==2025.1.31 \ + --hash=sha256:3d5da6925056f6f18f119200434a4780a94263f10d1c21d032a6f6b2baa20651 \ + --hash=sha256:ca78db4565a652026a4db2bcdf68f2fb589ea80d0be70e03929ed730746b84fe # via requests -charset-normalizer==3.4.2 \ - --hash=sha256:005fa3432484527f9732ebd315da8da8001593e2cf46a3d817669f062c3d9ed4 \ - --hash=sha256:046595208aae0120559a67693ecc65dd75d46f7bf687f159127046628178dc45 \ - --hash=sha256:0c29de6a1a95f24b9a1aa7aefd27d2487263f00dfd55a77719b530788f75cff7 \ - --hash=sha256:0c8c57f84ccfc871a48a47321cfa49ae1df56cd1d965a09abe84066f6853b9c0 \ - --hash=sha256:0f5d9ed7f254402c9e7d35d2f5972c9bbea9040e99cd2861bd77dc68263277c7 \ - --hash=sha256:18dd2e350387c87dabe711b86f83c9c78af772c748904d372ade190b5c7c9d4d \ - --hash=sha256:1b1bde144d98e446b056ef98e59c256e9294f6b74d7af6846bf5ffdafd687a7d \ - --hash=sha256:1c95a1e2902a8b722868587c0e1184ad5c55631de5afc0eb96bc4b0d738092c0 \ - --hash=sha256:1cad5f45b3146325bb38d6855642f6fd609c3f7cad4dbaf75549bf3b904d3184 \ - --hash=sha256:21b2899062867b0e1fde9b724f8aecb1af14f2778d69aacd1a5a1853a597a5db \ - --hash=sha256:24498ba8ed6c2e0b56d4acbf83f2d989720a93b41d712ebd4f4979660db4417b \ - --hash=sha256:25a23ea5c7edc53e0f29bae2c44fcb5a1aa10591aae107f2a2b2583a9c5cbc64 \ - --hash=sha256:289200a18fa698949d2b39c671c2cc7a24d44096784e76614899a7ccf2574b7b \ - --hash=sha256:28a1005facc94196e1fb3e82a3d442a9d9110b8434fc1ded7a24a2983c9888d8 \ - --hash=sha256:32fc0341d72e0f73f80acb0a2c94216bd704f4f0bce10aedea38f30502b271ff \ - --hash=sha256:36b31da18b8890a76ec181c3cf44326bf2c48e36d393ca1b72b3f484113ea344 \ - --hash=sha256:3c21d4fca343c805a52c0c78edc01e3477f6dd1ad7c47653241cf2a206d4fc58 \ - --hash=sha256:3fddb7e2c84ac87ac3a947cb4e66d143ca5863ef48e4a5ecb83bd48619e4634e \ - --hash=sha256:43e0933a0eff183ee85833f341ec567c0980dae57c464d8a508e1b2ceb336471 \ - --hash=sha256:4a476b06fbcf359ad25d34a057b7219281286ae2477cc5ff5e3f70a246971148 \ - --hash=sha256:4e594135de17ab3866138f496755f302b72157d115086d100c3f19370839dd3a \ - --hash=sha256:50bf98d5e563b83cc29471fa114366e6806bc06bc7a25fd59641e41445327836 \ - --hash=sha256:5a9979887252a82fefd3d3ed2a8e3b937a7a809f65dcb1e068b090e165bbe99e \ - --hash=sha256:5baececa9ecba31eff645232d59845c07aa030f0c81ee70184a90d35099a0e63 \ - --hash=sha256:5bf4545e3b962767e5c06fe1738f951f77d27967cb2caa64c28be7c4563e162c \ - --hash=sha256:6333b3aa5a12c26b2a4d4e7335a28f1475e0e5e17d69d55141ee3cab736f66d1 \ - --hash=sha256:65c981bdbd3f57670af8b59777cbfae75364b483fa8a9f420f08094531d54a01 \ - --hash=sha256:68a328e5f55ec37c57f19ebb1fdc56a248db2e3e9ad769919a58672958e8f366 \ - --hash=sha256:6a0289e4589e8bdfef02a80478f1dfcb14f0ab696b5a00e1f4b8a14a307a3c58 \ - --hash=sha256:6b66f92b17849b85cad91259efc341dce9c1af48e2173bf38a85c6329f1033e5 \ - --hash=sha256:6c9379d65defcab82d07b2a9dfbfc2e95bc8fe0ebb1b176a3190230a3ef0e07c \ - --hash=sha256:6fc1f5b51fa4cecaa18f2bd7a003f3dd039dd615cd69a2afd6d3b19aed6775f2 \ - --hash=sha256:70f7172939fdf8790425ba31915bfbe8335030f05b9913d7ae00a87d4395620a \ - --hash=sha256:721c76e84fe669be19c5791da68232ca2e05ba5185575086e384352e2c309597 \ - --hash=sha256:7222ffd5e4de8e57e03ce2cef95a4c43c98fcb72ad86909abdfc2c17d227fc1b \ - --hash=sha256:75d10d37a47afee94919c4fab4c22b9bc2a8bf7d4f46f87363bcf0573f3ff4f5 \ - --hash=sha256:76af085e67e56c8816c3ccf256ebd136def2ed9654525348cfa744b6802b69eb \ - --hash=sha256:770cab594ecf99ae64c236bc9ee3439c3f46be49796e265ce0cc8bc17b10294f \ - --hash=sha256:7a6ab32f7210554a96cd9e33abe3ddd86732beeafc7a28e9955cdf22ffadbab0 \ - --hash=sha256:7c48ed483eb946e6c04ccbe02c6b4d1d48e51944b6db70f697e089c193404941 \ - --hash=sha256:7f56930ab0abd1c45cd15be65cc741c28b1c9a34876ce8c17a2fa107810c0af0 \ - --hash=sha256:8075c35cd58273fee266c58c0c9b670947c19df5fb98e7b66710e04ad4e9ff86 \ - --hash=sha256:8272b73e1c5603666618805fe821edba66892e2870058c94c53147602eab29c7 \ - --hash=sha256:82d8fd25b7f4675d0c47cf95b594d4e7b158aca33b76aa63d07186e13c0e0ab7 \ - --hash=sha256:844da2b5728b5ce0e32d863af26f32b5ce61bc4273a9c720a9f3aa9df73b1455 \ - --hash=sha256:8755483f3c00d6c9a77f490c17e6ab0c8729e39e6390328e42521ef175380ae6 \ - --hash=sha256:915f3849a011c1f593ab99092f3cecfcb4d65d8feb4a64cf1bf2d22074dc0ec4 \ - --hash=sha256:926ca93accd5d36ccdabd803392ddc3e03e6d4cd1cf17deff3b989ab8e9dbcf0 \ - --hash=sha256:982bb1e8b4ffda883b3d0a521e23abcd6fd17418f6d2c4118d257a10199c0ce3 \ - --hash=sha256:98f862da73774290f251b9df8d11161b6cf25b599a66baf087c1ffe340e9bfd1 \ - --hash=sha256:9cbfacf36cb0ec2897ce0ebc5d08ca44213af24265bd56eca54bee7923c48fd6 \ - --hash=sha256:a370b3e078e418187da8c3674eddb9d983ec09445c99a3a263c2011993522981 \ - --hash=sha256:a955b438e62efdf7e0b7b52a64dc5c3396e2634baa62471768a64bc2adb73d5c \ - --hash=sha256:aa6af9e7d59f9c12b33ae4e9450619cf2488e2bbe9b44030905877f0b2324980 \ - --hash=sha256:aa88ca0b1932e93f2d961bf3addbb2db902198dca337d88c89e1559e066e7645 \ - --hash=sha256:aaeeb6a479c7667fbe1099af9617c83aaca22182d6cf8c53966491a0f1b7ffb7 \ - --hash=sha256:aaf27faa992bfee0264dc1f03f4c75e9fcdda66a519db6b957a3f826e285cf12 \ - --hash=sha256:b2680962a4848b3c4f155dc2ee64505a9c57186d0d56b43123b17ca3de18f0fa \ - --hash=sha256:b2d318c11350e10662026ad0eb71bb51c7812fc8590825304ae0bdd4ac283acd \ - --hash=sha256:b33de11b92e9f75a2b545d6e9b6f37e398d86c3e9e9653c4864eb7e89c5773ef \ - --hash=sha256:b3daeac64d5b371dea99714f08ffc2c208522ec6b06fbc7866a450dd446f5c0f \ - --hash=sha256:be1e352acbe3c78727a16a455126d9ff83ea2dfdcbc83148d2982305a04714c2 \ - --hash=sha256:bee093bf902e1d8fc0ac143c88902c3dfc8941f7ea1d6a8dd2bcb786d33db03d \ - --hash=sha256:c72fbbe68c6f32f251bdc08b8611c7b3060612236e960ef848e0a517ddbe76c5 \ - --hash=sha256:c9e36a97bee9b86ef9a1cf7bb96747eb7a15c2f22bdb5b516434b00f2a599f02 \ - --hash=sha256:cddf7bd982eaa998934a91f69d182aec997c6c468898efe6679af88283b498d3 \ - --hash=sha256:cf713fe9a71ef6fd5adf7a79670135081cd4431c2943864757f0fa3a65b1fafd \ - --hash=sha256:d11b54acf878eef558599658b0ffca78138c8c3655cf4f3a4a673c437e67732e \ - --hash=sha256:d41c4d287cfc69060fa91cae9683eacffad989f1a10811995fa309df656ec214 \ - --hash=sha256:d524ba3f1581b35c03cb42beebab4a13e6cdad7b36246bd22541fa585a56cccd \ - --hash=sha256:daac4765328a919a805fa5e2720f3e94767abd632ae410a9062dff5412bae65a \ - --hash=sha256:db4c7bf0e07fc3b7d89ac2a5880a6a8062056801b83ff56d8464b70f65482b6c \ - --hash=sha256:dc7039885fa1baf9be153a0626e337aa7ec8bf96b0128605fb0d77788ddc1681 \ - --hash=sha256:dccab8d5fa1ef9bfba0590ecf4d46df048d18ffe3eec01eeb73a42e0d9e7a8ba \ - --hash=sha256:dedb8adb91d11846ee08bec4c8236c8549ac721c245678282dcb06b221aab59f \ - --hash=sha256:e45ba65510e2647721e35323d6ef54c7974959f6081b58d4ef5d87c60c84919a \ - --hash=sha256:e53efc7c7cee4c1e70661e2e112ca46a575f90ed9ae3fef200f2a25e954f4b28 \ - --hash=sha256:e635b87f01ebc977342e2697d05b56632f5f879a4f15955dfe8cef2448b51691 \ - --hash=sha256:e70e990b2137b29dc5564715de1e12701815dacc1d056308e2b17e9095372a82 \ - --hash=sha256:e8082b26888e2f8b36a042a58307d5b917ef2b1cacab921ad3323ef91901c71a \ - --hash=sha256:e8323a9b031aa0393768b87f04b4164a40037fb2a3c11ac06a03ffecd3618027 \ - --hash=sha256:e92fca20c46e9f5e1bb485887d074918b13543b1c2a1185e69bb8d17ab6236a7 \ - --hash=sha256:eb30abc20df9ab0814b5a2524f23d75dcf83cde762c161917a2b4b7b55b1e518 \ - --hash=sha256:eba9904b0f38a143592d9fc0e19e2df0fa2e41c3c3745554761c5f6447eedabf \ - --hash=sha256:ef8de666d6179b009dce7bcb2ad4c4a779f113f12caf8dc77f0162c29d20490b \ - --hash=sha256:efd387a49825780ff861998cd959767800d54f8308936b21025326de4b5a42b9 \ - --hash=sha256:f0aa37f3c979cf2546b73e8222bbfa3dc07a641585340179d768068e3455e544 \ - --hash=sha256:f4074c5a429281bf056ddd4c5d3b740ebca4d43ffffe2ef4bf4d2d05114299da \ - --hash=sha256:f69a27e45c43520f5487f27627059b64aaf160415589230992cec34c5e18a509 \ - --hash=sha256:fb707f3e15060adf5b7ada797624a6c6e0138e2a26baa089df64c68ee98e040f \ - --hash=sha256:fcbe676a55d7445b22c10967bceaaf0ee69407fbe0ece4d032b6eb8d4565982a \ - --hash=sha256:fdb20a30fe1175ecabed17cbf7812f7b804b8a315a25f24678bcdf120a90077f +charset-normalizer==3.4.1 \ + --hash=sha256:0167ddc8ab6508fe81860a57dd472b2ef4060e8d378f0cc555707126830f2537 \ + --hash=sha256:01732659ba9b5b873fc117534143e4feefecf3b2078b0a6a2e925271bb6f4cfa \ + --hash=sha256:01ad647cdd609225c5350561d084b42ddf732f4eeefe6e678765636791e78b9a \ + --hash=sha256:04432ad9479fa40ec0f387795ddad4437a2b50417c69fa275e212933519ff294 \ + --hash=sha256:0907f11d019260cdc3f94fbdb23ff9125f6b5d1039b76003b5b0ac9d6a6c9d5b \ + --hash=sha256:0924e81d3d5e70f8126529951dac65c1010cdf117bb75eb02dd12339b57749dd \ + --hash=sha256:09b26ae6b1abf0d27570633b2b078a2a20419c99d66fb2823173d73f188ce601 \ + --hash=sha256:09b5e6733cbd160dcc09589227187e242a30a49ca5cefa5a7edd3f9d19ed53fd \ + --hash=sha256:0af291f4fe114be0280cdd29d533696a77b5b49cfde5467176ecab32353395c4 \ + --hash=sha256:0f55e69f030f7163dffe9fd0752b32f070566451afe180f99dbeeb81f511ad8d \ + --hash=sha256:1a2bc9f351a75ef49d664206d51f8e5ede9da246602dc2d2726837620ea034b2 \ + --hash=sha256:22e14b5d70560b8dd51ec22863f370d1e595ac3d024cb8ad7d308b4cd95f8313 \ + --hash=sha256:234ac59ea147c59ee4da87a0c0f098e9c8d169f4dc2a159ef720f1a61bbe27cd \ + --hash=sha256:2369eea1ee4a7610a860d88f268eb39b95cb588acd7235e02fd5a5601773d4fa \ + --hash=sha256:237bdbe6159cff53b4f24f397d43c6336c6b0b42affbe857970cefbb620911c8 \ + --hash=sha256:28bf57629c75e810b6ae989f03c0828d64d6b26a5e205535585f96093e405ed1 \ + --hash=sha256:2967f74ad52c3b98de4c3b32e1a44e32975e008a9cd2a8cc8966d6a5218c5cb2 \ + --hash=sha256:2a75d49014d118e4198bcee5ee0a6f25856b29b12dbf7cd012791f8a6cc5c496 \ + --hash=sha256:2bdfe3ac2e1bbe5b59a1a63721eb3b95fc9b6817ae4a46debbb4e11f6232428d \ + --hash=sha256:2d074908e1aecee37a7635990b2c6d504cd4766c7bc9fc86d63f9c09af3fa11b \ + --hash=sha256:2fb9bd477fdea8684f78791a6de97a953c51831ee2981f8e4f583ff3b9d9687e \ + --hash=sha256:311f30128d7d333eebd7896965bfcfbd0065f1716ec92bd5638d7748eb6f936a \ + --hash=sha256:329ce159e82018d646c7ac45b01a430369d526569ec08516081727a20e9e4af4 \ + --hash=sha256:345b0426edd4e18138d6528aed636de7a9ed169b4aaf9d61a8c19e39d26838ca \ + --hash=sha256:363e2f92b0f0174b2f8238240a1a30142e3db7b957a5dd5689b0e75fb717cc78 \ + --hash=sha256:3a3bd0dcd373514dcec91c411ddb9632c0d7d92aed7093b8c3bbb6d69ca74408 \ + --hash=sha256:3bed14e9c89dcb10e8f3a29f9ccac4955aebe93c71ae803af79265c9ca5644c5 \ + --hash=sha256:44251f18cd68a75b56585dd00dae26183e102cd5e0f9f1466e6df5da2ed64ea3 \ + --hash=sha256:44ecbf16649486d4aebafeaa7ec4c9fed8b88101f4dd612dcaf65d5e815f837f \ + --hash=sha256:4532bff1b8421fd0a320463030c7520f56a79c9024a4e88f01c537316019005a \ + --hash=sha256:49402233c892a461407c512a19435d1ce275543138294f7ef013f0b63d5d3765 \ + --hash=sha256:4c0907b1928a36d5a998d72d64d8eaa7244989f7aaaf947500d3a800c83a3fd6 \ + --hash=sha256:4d86f7aff21ee58f26dcf5ae81a9addbd914115cdebcbb2217e4f0ed8982e146 \ + --hash=sha256:5777ee0881f9499ed0f71cc82cf873d9a0ca8af166dfa0af8ec4e675b7df48e6 \ + --hash=sha256:5df196eb874dae23dcfb968c83d4f8fdccb333330fe1fc278ac5ceeb101003a9 \ + --hash=sha256:619a609aa74ae43d90ed2e89bdd784765de0a25ca761b93e196d938b8fd1dbbd \ + --hash=sha256:6e27f48bcd0957c6d4cb9d6fa6b61d192d0b13d5ef563e5f2ae35feafc0d179c \ + --hash=sha256:6ff8a4a60c227ad87030d76e99cd1698345d4491638dfa6673027c48b3cd395f \ + --hash=sha256:73d94b58ec7fecbc7366247d3b0b10a21681004153238750bb67bd9012414545 \ + --hash=sha256:7461baadb4dc00fd9e0acbe254e3d7d2112e7f92ced2adc96e54ef6501c5f176 \ + --hash=sha256:75832c08354f595c760a804588b9357d34ec00ba1c940c15e31e96d902093770 \ + --hash=sha256:7709f51f5f7c853f0fb938bcd3bc59cdfdc5203635ffd18bf354f6967ea0f824 \ + --hash=sha256:78baa6d91634dfb69ec52a463534bc0df05dbd546209b79a3880a34487f4b84f \ + --hash=sha256:7974a0b5ecd505609e3b19742b60cee7aa2aa2fb3151bc917e6e2646d7667dcf \ + --hash=sha256:7a4f97a081603d2050bfaffdefa5b02a9ec823f8348a572e39032caa8404a487 \ + --hash=sha256:7b1bef6280950ee6c177b326508f86cad7ad4dff12454483b51d8b7d673a2c5d \ + --hash=sha256:7d053096f67cd1241601111b698f5cad775f97ab25d81567d3f59219b5f1adbd \ + --hash=sha256:804a4d582ba6e5b747c625bf1255e6b1507465494a40a2130978bda7b932c90b \ + --hash=sha256:807f52c1f798eef6cf26beb819eeb8819b1622ddfeef9d0977a8502d4db6d534 \ + --hash=sha256:80ed5e856eb7f30115aaf94e4a08114ccc8813e6ed1b5efa74f9f82e8509858f \ + --hash=sha256:8417cb1f36cc0bc7eaba8ccb0e04d55f0ee52df06df3ad55259b9a323555fc8b \ + --hash=sha256:8436c508b408b82d87dc5f62496973a1805cd46727c34440b0d29d8a2f50a6c9 \ + --hash=sha256:89149166622f4db9b4b6a449256291dc87a99ee53151c74cbd82a53c8c2f6ccd \ + --hash=sha256:8bfa33f4f2672964266e940dd22a195989ba31669bd84629f05fab3ef4e2d125 \ + --hash=sha256:8c60ca7339acd497a55b0ea5d506b2a2612afb2826560416f6894e8b5770d4a9 \ + --hash=sha256:91b36a978b5ae0ee86c394f5a54d6ef44db1de0815eb43de826d41d21e4af3de \ + --hash=sha256:955f8851919303c92343d2f66165294848d57e9bba6cf6e3625485a70a038d11 \ + --hash=sha256:97f68b8d6831127e4787ad15e6757232e14e12060bec17091b85eb1486b91d8d \ + --hash=sha256:9b23ca7ef998bc739bf6ffc077c2116917eabcc901f88da1b9856b210ef63f35 \ + --hash=sha256:9f0b8b1c6d84c8034a44893aba5e767bf9c7a211e313a9605d9c617d7083829f \ + --hash=sha256:aabfa34badd18f1da5ec1bc2715cadc8dca465868a4e73a0173466b688f29dda \ + --hash=sha256:ab36c8eb7e454e34e60eb55ca5d241a5d18b2c6244f6827a30e451c42410b5f7 \ + --hash=sha256:b010a7a4fd316c3c484d482922d13044979e78d1861f0e0650423144c616a46a \ + --hash=sha256:b1ac5992a838106edb89654e0aebfc24f5848ae2547d22c2c3f66454daa11971 \ + --hash=sha256:b7b2d86dd06bfc2ade3312a83a5c364c7ec2e3498f8734282c6c3d4b07b346b8 \ + --hash=sha256:b97e690a2118911e39b4042088092771b4ae3fc3aa86518f84b8cf6888dbdb41 \ + --hash=sha256:bc2722592d8998c870fa4e290c2eec2c1569b87fe58618e67d38b4665dfa680d \ + --hash=sha256:c0429126cf75e16c4f0ad00ee0eae4242dc652290f940152ca8c75c3a4b6ee8f \ + --hash=sha256:c30197aa96e8eed02200a83fba2657b4c3acd0f0aa4bdc9f6c1af8e8962e0757 \ + --hash=sha256:c4c3e6da02df6fa1410a7680bd3f63d4f710232d3139089536310d027950696a \ + --hash=sha256:c75cb2a3e389853835e84a2d8fb2b81a10645b503eca9bcb98df6b5a43eb8886 \ + --hash=sha256:c96836c97b1238e9c9e3fe90844c947d5afbf4f4c92762679acfe19927d81d77 \ + --hash=sha256:d7f50a1f8c450f3925cb367d011448c39239bb3eb4117c36a6d354794de4ce76 \ + --hash=sha256:d973f03c0cb71c5ed99037b870f2be986c3c05e63622c017ea9816881d2dd247 \ + --hash=sha256:d98b1668f06378c6dbefec3b92299716b931cd4e6061f3c875a71ced1780ab85 \ + --hash=sha256:d9c3cdf5390dcd29aa8056d13e8e99526cda0305acc038b96b30352aff5ff2bb \ + --hash=sha256:dad3e487649f498dd991eeb901125411559b22e8d7ab25d3aeb1af367df5efd7 \ + --hash=sha256:dccbe65bd2f7f7ec22c4ff99ed56faa1e9f785482b9bbd7c717e26fd723a1d1e \ + --hash=sha256:dd78cfcda14a1ef52584dbb008f7ac81c1328c0f58184bf9a84c49c605002da6 \ + --hash=sha256:e218488cd232553829be0664c2292d3af2eeeb94b32bea483cf79ac6a694e037 \ + --hash=sha256:e358e64305fe12299a08e08978f51fc21fac060dcfcddd95453eabe5b93ed0e1 \ + --hash=sha256:ea0d8d539afa5eb2728aa1932a988a9a7af94f18582ffae4bc10b3fbdad0626e \ + --hash=sha256:eab677309cdb30d047996b36d34caeda1dc91149e4fdca0b1a039b3f79d9a807 \ + --hash=sha256:eb8178fe3dba6450a3e024e95ac49ed3400e506fd4e9e5c32d30adda88cbd407 \ + --hash=sha256:ecddf25bee22fe4fe3737a399d0d177d72bc22be6913acfab364b40bce1ba83c \ + --hash=sha256:eea6ee1db730b3483adf394ea72f808b6e18cf3cb6454b4d86e04fa8c4327a12 \ + --hash=sha256:f08ff5e948271dc7e18a35641d2f11a4cd8dfd5634f55228b691e62b37125eb3 \ + --hash=sha256:f30bf9fd9be89ecb2360c7d94a711f00c09b976258846efe40db3d05828e8089 \ + --hash=sha256:fa88b843d6e211393a37219e6a1c1df99d35e8fd90446f1118f4216e307e48cd \ + --hash=sha256:fc54db6c8593ef7d4b2a331b58653356cf04f67c960f584edb7c3d8c97e8f39e \ + --hash=sha256:fd4ec41f914fa74ad1b8304bbc634b3de73d2a0889bd32076342a573e0779e00 \ + --hash=sha256:ffc9202a29ab3920fa812879e95a9e78b2465fd10be7fcbd042899695d75e616 # via requests -click==8.2.1 \ - --hash=sha256:27c491cc05d968d271d5a1db13e3b5a184636d9d930f148c50b038f0d0646202 \ - --hash=sha256:61a3265b914e850b85317d0b3109c7f8cd35a670f963866005d6ef1d5175a12b +click==8.1.8 \ + --hash=sha256:63c132bbbed01578a06712a2d1f497bb62d9c1c0d329b7903a866228027263b2 \ + --hash=sha256:ed53c9d8990d83c2a27deae68e4ee337473f6330c040a31d4225c9574d16096a # via uvicorn colorama==0.4.6 \ --hash=sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44 \ @@ -142,12 +142,18 @@ docutils==0.21.2 \ # sphinx-rtd-theme # sphinx-tabs # sphinx-togglebutton -doxmlparser==1.14.0 \ - --hash=sha256:1037dcc4aadf908feb2d908685159972bb2975322fbe2b120f5cac5a938f0b14 +doxmlparser==1.13.2 \ + --hash=sha256:65ab126e7d3f77b1bb15fa6886663614f68d0473b48831e1fb822f533243eb68 # via -r requirements.in -h11==0.16.0 \ - --hash=sha256:4e35b956cf45792e4caa5885e69fba00bdbc6ffafbfa020300e549b208ee5ff1 \ - --hash=sha256:63cf8bbe7522de3bf65932fda1d9c2772064ffb3dae62d55932da54b31cb6c86 +exceptiongroup==1.2.2 ; python_full_version < '3.11' \ + --hash=sha256:3111b9d131c238bec2f8f516e123e14ba243563fb135d3fe885990585aa7795b \ + --hash=sha256:47c2edf7c6738fafb49fd34290706d1a1a2f4d1c6df275526b62cbb4aa5393cc + # via + # anyio + # pytest +h11==0.14.0 \ + --hash=sha256:8f19fbbe99e72420ff35c00b27a34cb9937e902a8b810e2c88300c6f0a3b699d \ + --hash=sha256:e3fe4ac4b851c468cc8363d500db52c2ead036020723024a109d37346efaa761 # via uvicorn idna==3.10 \ --hash=sha256:12f65c9b470abda6dc35cf8e63cc574b1c52b11df2c86030af0ac09b01b13ea9 \ @@ -167,139 +173,145 @@ jinja2==3.1.6 \ --hash=sha256:0137fb05990d35f1275a587e9aee6d56da821fc83491a0fb838183be43f66d6d \ --hash=sha256:85ece4451f492d0c13c5dd7c13a64681a86afae63a5f347908daf103ce6d2f67 # via sphinx -lxml==5.4.0 \ - --hash=sha256:00b8686694423ddae324cf614e1b9659c2edb754de617703c3d29ff568448df5 \ - --hash=sha256:073eb6dcdf1f587d9b88c8c93528b57eccda40209cf9be549d469b942b41d70b \ - --hash=sha256:09846782b1ef650b321484ad429217f5154da4d6e786636c38e434fa32e94e49 \ - --hash=sha256:0a01ce7d8479dce84fc03324e3b0c9c90b1ece9a9bb6a1b6c9025e7e4520e78c \ - --hash=sha256:0be91891bdb06ebe65122aa6bf3fc94489960cf7e03033c6f83a90863b23c58b \ - --hash=sha256:0cef4feae82709eed352cd7e97ae062ef6ae9c7b5dbe3663f104cd2c0e8d94ba \ - --hash=sha256:0e108352e203c7afd0eb91d782582f00a0b16a948d204d4dec8565024fafeea5 \ - --hash=sha256:0ea0252b51d296a75f6118ed0d8696888e7403408ad42345d7dfd0d1e93309a7 \ - --hash=sha256:0fce1294a0497edb034cb416ad3e77ecc89b313cff7adbee5334e4dc0d11f422 \ - --hash=sha256:1320091caa89805df7dcb9e908add28166113dcd062590668514dbd510798c88 \ - --hash=sha256:142accb3e4d1edae4b392bd165a9abdee8a3c432a2cca193df995bc3886249c8 \ - --hash=sha256:14479c2ad1cb08b62bb941ba8e0e05938524ee3c3114644df905d2331c76cd57 \ - --hash=sha256:151d6c40bc9db11e960619d2bf2ec5829f0aaffb10b41dcf6ad2ce0f3c0b2325 \ - --hash=sha256:15a665ad90054a3d4f397bc40f73948d48e36e4c09f9bcffc7d90c87410e478a \ - --hash=sha256:1a42b3a19346e5601d1b8296ff6ef3d76038058f311902edd574461e9c036982 \ - --hash=sha256:1af80c6316ae68aded77e91cd9d80648f7dd40406cef73df841aa3c36f6907c8 \ - --hash=sha256:1b717b00a71b901b4667226bba282dd462c42ccf618ade12f9ba3674e1fabc55 \ - --hash=sha256:1dc4ca99e89c335a7ed47d38964abcb36c5910790f9bd106f2a8fa2ee0b909d2 \ - --hash=sha256:20e16c08254b9b6466526bc1828d9370ee6c0d60a4b64836bc3ac2917d1e16df \ - --hash=sha256:226046e386556a45ebc787871d6d2467b32c37ce76c2680f5c608e25823ffc84 \ - --hash=sha256:24974f774f3a78ac12b95e3a20ef0931795ff04dbb16db81a90c37f589819551 \ - --hash=sha256:24f6df5f24fc3385f622c0c9d63fe34604893bc1a5bdbb2dbf5870f85f9a404a \ - --hash=sha256:27a9ded0f0b52098ff89dd4c418325b987feed2ea5cc86e8860b0f844285d740 \ - --hash=sha256:29f451a4b614a7b5b6c2e043d7b64a15bd8304d7e767055e8ab68387a8cacf4e \ - --hash=sha256:2b31a3a77501d86d8ade128abb01082724c0dfd9524f542f2f07d693c9f1175f \ - --hash=sha256:2c62891b1ea3094bb12097822b3d44b93fc6c325f2043c4d2736a8ff09e65f60 \ - --hash=sha256:2dc191e60425ad70e75a68c9fd90ab284df64d9cd410ba8d2b641c0c45bc006e \ - --hash=sha256:31e63621e073e04697c1b2d23fcb89991790eef370ec37ce4d5d469f40924ed6 \ - --hash=sha256:32697d2ea994e0db19c1df9e40275ffe84973e4232b5c274f47e7c1ec9763cdd \ - --hash=sha256:3a3178b4873df8ef9457a4875703488eb1622632a9cee6d76464b60e90adbfcd \ - --hash=sha256:3b9c2754cef6963f3408ab381ea55f47dabc6f78f4b8ebb0f0b25cf1ac1f7609 \ - --hash=sha256:3d3c30ba1c9b48c68489dc1829a6eede9873f52edca1dda900066542528d6b20 \ - --hash=sha256:3e6d5557989cdc3ebb5302bbdc42b439733a841891762ded9514e74f60319ad6 \ - --hash=sha256:4025bf2884ac4370a3243c5aa8d66d3cb9e15d3ddd0af2d796eccc5f0244390e \ - --hash=sha256:4291d3c409a17febf817259cb37bc62cb7eb398bcc95c1356947e2871911ae61 \ - --hash=sha256:4329422de653cdb2b72afa39b0aa04252fca9071550044904b2e7036d9d97fe4 \ - --hash=sha256:43d549b876ce64aa18b2328faff70f5877f8c6dede415f80a2f799d31644d776 \ - --hash=sha256:460508a4b07364d6abf53acaa0a90b6d370fafde5693ef37602566613a9b0779 \ - --hash=sha256:47fb24cc0f052f0576ea382872b3fc7e1f7e3028e53299ea751839418ade92a6 \ - --hash=sha256:48b4afaf38bf79109bb060d9016fad014a9a48fb244e11b94f74ae366a64d252 \ - --hash=sha256:497cab4d8254c2a90bf988f162ace2ddbfdd806fce3bda3f581b9d24c852e03c \ - --hash=sha256:4aa412a82e460571fad592d0f93ce9935a20090029ba08eca05c614f99b0cc92 \ - --hash=sha256:4b7ce10634113651d6f383aa712a194179dcd496bd8c41e191cec2099fa09de5 \ - --hash=sha256:4cd915c0fb1bed47b5e6d6edd424ac25856252f09120e3e8ba5154b6b921860e \ - --hash=sha256:4d885698f5019abe0de3d352caf9466d5de2baded00a06ef3f1216c1a58ae78f \ - --hash=sha256:4f5322cf38fe0e21c2d73901abf68e6329dc02a4994e483adbcf92b568a09a54 \ - --hash=sha256:50441c9de951a153c698b9b99992e806b71c1f36d14b154592580ff4a9d0d877 \ - --hash=sha256:529024ab3a505fed78fe3cc5ddc079464e709f6c892733e3f5842007cec8ac6e \ - --hash=sha256:53370c26500d22b45182f98847243efb518d268374a9570409d2e2276232fd37 \ - --hash=sha256:53d9469ab5460402c19553b56c3648746774ecd0681b1b27ea74d5d8a3ef5590 \ - --hash=sha256:56dbdbab0551532bb26c19c914848d7251d73edb507c3079d6805fa8bba5b706 \ - --hash=sha256:5a99d86351f9c15e4a901fc56404b485b1462039db59288b203f8c629260a142 \ - --hash=sha256:5cca36a194a4eb4e2ed6be36923d3cffd03dcdf477515dea687185506583d4c9 \ - --hash=sha256:5f11a1526ebd0dee85e7b1e39e39a0cc0d9d03fb527f56d8457f6df48a10dc0c \ - --hash=sha256:61c7bbf432f09ee44b1ccaa24896d21075e533cd01477966a5ff5a71d88b2f56 \ - --hash=sha256:639978bccb04c42677db43c79bdaa23785dc7f9b83bfd87570da8207872f1ce5 \ - --hash=sha256:63e7968ff83da2eb6fdda967483a7a023aa497d85ad8f05c3ad9b1f2e8c84987 \ - --hash=sha256:664cdc733bc87449fe781dbb1f309090966c11cc0c0cd7b84af956a02a8a4729 \ - --hash=sha256:67ed8a40665b84d161bae3181aa2763beea3747f748bca5874b4af4d75998f87 \ - --hash=sha256:67f779374c6b9753ae0a0195a892a1c234ce8416e4448fe1e9f34746482070a7 \ - --hash=sha256:6854f8bd8a1536f8a1d9a3655e6354faa6406621cf857dc27b681b69860645c7 \ - --hash=sha256:696ea9e87442467819ac22394ca36cb3d01848dad1be6fac3fb612d3bd5a12cf \ - --hash=sha256:6ef80aeac414f33c24b3815ecd560cee272786c3adfa5f31316d8b349bfade28 \ - --hash=sha256:72ac9762a9f8ce74c9eed4a4e74306f2f18613a6b71fa065495a67ac227b3056 \ - --hash=sha256:75133890e40d229d6c5837b0312abbe5bac1c342452cf0e12523477cd3aa21e7 \ - --hash=sha256:7605c1c32c3d6e8c990dd28a0970a3cbbf1429d5b92279e37fda05fb0c92190e \ - --hash=sha256:773e27b62920199c6197130632c18fb7ead3257fce1ffb7d286912e56ddb79e0 \ - --hash=sha256:795f61bcaf8770e1b37eec24edf9771b307df3af74d1d6f27d812e15a9ff3872 \ - --hash=sha256:79d5bfa9c1b455336f52343130b2067164040604e41f6dc4d8313867ed540079 \ - --hash=sha256:7a62cc23d754bb449d63ff35334acc9f5c02e6dae830d78dab4dd12b78a524f4 \ - --hash=sha256:7be701c24e7f843e6788353c055d806e8bd8466b52907bafe5d13ec6a6dbaecd \ - --hash=sha256:7ca56ebc2c474e8f3d5761debfd9283b8b18c76c4fc0967b74aeafba1f5647f9 \ - --hash=sha256:7ce1a171ec325192c6a636b64c94418e71a1964f56d002cc28122fceff0b6121 \ - --hash=sha256:891f7f991a68d20c75cb13c5c9142b2a3f9eb161f1f12a9489c82172d1f133c0 \ - --hash=sha256:8f82125bc7203c5ae8633a7d5d20bcfdff0ba33e436e4ab0abc026a53a8960b7 \ - --hash=sha256:91505d3ddebf268bb1588eb0f63821f738d20e1e7f05d3c647a5ca900288760b \ - --hash=sha256:942a5d73f739ad7c452bf739a62a0f83e2578afd6b8e5406308731f4ce78b16d \ - --hash=sha256:9454b8d8200ec99a224df8854786262b1bd6461f4280064c807303c642c05e76 \ - --hash=sha256:9459e6892f59ecea2e2584ee1058f5d8f629446eab52ba2305ae13a32a059530 \ - --hash=sha256:9776af1aad5a4b4a1317242ee2bea51da54b2a7b7b48674be736d463c999f37d \ - --hash=sha256:97dac543661e84a284502e0cf8a67b5c711b0ad5fb661d1bd505c02f8cf716d7 \ - --hash=sha256:98a3912194c079ef37e716ed228ae0dcb960992100461b704aea4e93af6b0bb9 \ - --hash=sha256:9b4a3bd174cc9cdaa1afbc4620c049038b441d6ba07629d89a83b408e54c35cd \ - --hash=sha256:9c886b481aefdf818ad44846145f6eaf373a20d200b5ce1a5c8e1bc2d8745410 \ - --hash=sha256:9ceaf423b50ecfc23ca00b7f50b64baba85fb3fb91c53e2c9d00bc86150c7e40 \ - --hash=sha256:a11a96c3b3f7551c8a8109aa65e8594e551d5a84c76bf950da33d0fb6dfafab7 \ - --hash=sha256:a3bcdde35d82ff385f4ede021df801b5c4a5bcdfb61ea87caabcebfc4945dc1b \ - --hash=sha256:a7fb111eef4d05909b82152721a59c1b14d0f365e2be4c742a473c5d7372f4f5 \ - --hash=sha256:a81e1196f0a5b4167a8dafe3a66aa67c4addac1b22dc47947abd5d5c7a3f24b5 \ - --hash=sha256:a8c9b7f16b63e65bbba889acb436a1034a82d34fa09752d754f88d708eca80e1 \ - --hash=sha256:a8ef956fce64c8551221f395ba21d0724fed6b9b6242ca4f2f7beb4ce2f41997 \ - --hash=sha256:ab339536aa798b1e17750733663d272038bf28069761d5be57cb4a9b0137b4f8 \ - --hash=sha256:ac7ba71f9561cd7d7b55e1ea5511543c0282e2b6450f122672a2694621d63b7e \ - --hash=sha256:aea53d51859b6c64e7c51d522c03cc2c48b9b5d6172126854cc7f01aa11f52bc \ - --hash=sha256:aea7c06667b987787c7d1f5e1dfcd70419b711cdb47d6b4bb4ad4b76777a0563 \ - --hash=sha256:aefe1a7cb852fa61150fcb21a8c8fcea7b58c4cb11fbe59c97a0a4b31cae3c8c \ - --hash=sha256:b0989737a3ba6cf2a16efb857fb0dfa20bc5c542737fddb6d893fde48be45433 \ - --hash=sha256:b108134b9667bcd71236c5a02aad5ddd073e372fb5d48ea74853e009fe38acb6 \ - --hash=sha256:b12cb6527599808ada9eb2cd6e0e7d3d8f13fe7bbb01c6311255a15ded4c7ab4 \ - --hash=sha256:b5aff6f3e818e6bdbbb38e5967520f174b18f539c2b9de867b1e7fde6f8d95a4 \ - --hash=sha256:b67319b4aef1a6c56576ff544b67a2a6fbd7eaee485b241cabf53115e8908b8f \ - --hash=sha256:b7c86884ad23d61b025989d99bfdd92a7351de956e01c61307cb87035960bcb1 \ - --hash=sha256:b92b69441d1bd39f4940f9eadfa417a25862242ca2c396b406f9272ef09cdcaa \ - --hash=sha256:bcb7a1096b4b6b24ce1ac24d4942ad98f983cd3810f9711bcd0293f43a9d8b9f \ - --hash=sha256:bda3ea44c39eb74e2488297bb39d47186ed01342f0022c8ff407c250ac3f498e \ - --hash=sha256:be2ba4c3c5b7900246a8f866580700ef0d538f2ca32535e991027bdaba944063 \ - --hash=sha256:c5681160758d3f6ac5b4fea370495c48aac0989d6a0f01bb9a72ad8ef5ab75c4 \ - --hash=sha256:c5d32f5284012deaccd37da1e2cd42f081feaa76981f0eaa474351b68df813c5 \ - --hash=sha256:c6364038c519dffdbe07e3cf42e6a7f8b90c275d4d1617a69bb59734c1a2d571 \ - --hash=sha256:c70e93fba207106cb16bf852e421c37bbded92acd5964390aad07cb50d60f5cf \ - --hash=sha256:ca755eebf0d9e62d6cb013f1261e510317a41bf4650f22963474a663fdfe02aa \ - --hash=sha256:cccd007d5c95279e529c146d095f1d39ac05139de26c098166c4beb9374b0f4d \ - --hash=sha256:ce31158630a6ac85bddd6b830cffd46085ff90498b397bd0a259f59d27a12188 \ - --hash=sha256:ce9c671845de9699904b1e9df95acfe8dfc183f2310f163cdaa91a3535af95de \ - --hash=sha256:d12832e1dbea4be280b22fd0ea7c9b87f0d8fc51ba06e92dc62d52f804f78ebd \ - --hash=sha256:d2ed1b3cb9ff1c10e6e8b00941bb2e5bb568b307bfc6b17dffbbe8be5eecba86 \ - --hash=sha256:d5663bc1b471c79f5c833cffbc9b87d7bf13f87e055a5c86c363ccd2348d7e82 \ - --hash=sha256:d90b729fd2732df28130c064aac9bb8aff14ba20baa4aee7bd0795ff1187545f \ - --hash=sha256:dc0af80267edc68adf85f2a5d9be1cdf062f973db6790c1d065e45025fa26140 \ - --hash=sha256:de5b4e1088523e2b6f730d0509a9a813355b7f5659d70eb4f319c76beea2e250 \ - --hash=sha256:de6f6bb8a7840c7bf216fb83eec4e2f79f7325eca8858167b68708b929ab2172 \ - --hash=sha256:df53330a3bff250f10472ce96a9af28628ff1f4efc51ccba351a8820bca2a8ba \ - --hash=sha256:e094ec83694b59d263802ed03a8384594fcce477ce484b0cbcd0008a211ca751 \ - --hash=sha256:e794f698ae4c5084414efea0f5cc9f4ac562ec02d66e1484ff822ef97c2cadff \ - --hash=sha256:e7bc6df34d42322c5289e37e9971d6ed114e3776b45fa879f734bded9d1fea9c \ - --hash=sha256:eaf24066ad0b30917186420d51e2e3edf4b0e2ea68d8cd885b14dc8afdcf6556 \ - --hash=sha256:ecf4c4b83f1ab3d5a7ace10bafcb6f11df6156857a3c418244cef41ca9fa3e44 \ - --hash=sha256:ef5a7178fcc73b7d8c07229e89f8eb45b2908a9238eb90dcfc46571ccf0383b8 \ - --hash=sha256:f5cb182f6396706dc6cc1896dd02b1c889d644c081b0cdec38747573db88a7d7 \ - --hash=sha256:fa0e294046de09acd6146be0ed6727d1f42ded4ce3ea1e9a19c11b6774eea27c \ - --hash=sha256:fb54f7c6bafaa808f27166569b1511fc42701a7713858dddc08afdde9746849e \ - --hash=sha256:fd3be6481ef54b8cfd0e1e953323b7aa9d9789b94842d0e5b142ef4bb7999539 +lxml==5.3.1 \ + --hash=sha256:016b96c58e9a4528219bb563acf1aaaa8bc5452e7651004894a973f03b84ba81 \ + --hash=sha256:05123fad495a429f123307ac6d8fd6f977b71e9a0b6d9aeeb8f80c017cb17131 \ + --hash=sha256:057e30d0012439bc54ca427a83d458752ccda725c1c161cc283db07bcad43cf9 \ + --hash=sha256:06a20d607a86fccab2fc15a77aa445f2bdef7b49ec0520a842c5c5afd8381576 \ + --hash=sha256:094b28ed8a8a072b9e9e2113a81fda668d2053f2ca9f2d202c2c8c7c2d6516b1 \ + --hash=sha256:0bcfadea3cdc68e678d2b20cb16a16716887dd00a881e16f7d806c2138b8ff0c \ + --hash=sha256:0d6b2fa86becfa81f0a0271ccb9eb127ad45fb597733a77b92e8a35e53414914 \ + --hash=sha256:0f2cfae0688fd01f7056a17367e3b84f37c545fb447d7282cf2c242b16262607 \ + --hash=sha256:106b7b5d2977b339f1e97efe2778e2ab20e99994cbb0ec5e55771ed0795920c8 \ + --hash=sha256:133f3493253a00db2c870d3740bc458ebb7d937bd0a6a4f9328373e0db305709 \ + --hash=sha256:136bf638d92848a939fd8f0e06fcf92d9f2e4b57969d94faae27c55f3d85c05b \ + --hash=sha256:155e1a5693cf4b55af652f5c0f78ef36596c7f680ff3ec6eb4d7d85367259b2c \ + --hash=sha256:1637fa31ec682cd5760092adfabe86d9b718a75d43e65e211d5931809bc111e7 \ + --hash=sha256:172d65f7c72a35a6879217bcdb4bb11bc88d55fb4879e7569f55616062d387c2 \ + --hash=sha256:17b5d7f8acf809465086d498d62a981fa6a56d2718135bb0e4aa48c502055f5c \ + --hash=sha256:198bb4b4dd888e8390afa4f170d4fa28467a7eaf857f1952589f16cfbb67af27 \ + --hash=sha256:1b6f92e35e2658a5ed51c6634ceb5ddae32053182851d8cad2a5bc102a359b33 \ + --hash=sha256:1b92fe86e04f680b848fff594a908edfa72b31bfc3499ef7433790c11d4c8cd8 \ + --hash=sha256:1bcc211542f7af6f2dfb705f5f8b74e865592778e6cafdfd19c792c244ccce19 \ + --hash=sha256:1c93ed3c998ea8472be98fb55aed65b5198740bfceaec07b2eba551e55b7b9ae \ + --hash=sha256:203b1d3eaebd34277be06a3eb880050f18a4e4d60861efba4fb946e31071a295 \ + --hash=sha256:22ec2b3c191f43ed21f9545e9df94c37c6b49a5af0a874008ddc9132d49a2d9c \ + --hash=sha256:231cf4d140b22a923b1d0a0a4e0b4f972e5893efcdec188934cc65888fd0227b \ + --hash=sha256:236610b77589faf462337b3305a1be91756c8abc5a45ff7ca8f245a71c5dab70 \ + --hash=sha256:29bfc8d3d88e56ea0a27e7c4897b642706840247f59f4377d81be8f32aa0cfbf \ + --hash=sha256:2b8969dbc8d09d9cd2ae06362c3bad27d03f433252601ef658a49bd9f2b22d79 \ + --hash=sha256:2dd0b80ac2d8f13ffc906123a6f20b459cb50a99222d0da492360512f3e50f84 \ + --hash=sha256:2df7ed5edeb6bd5590914cd61df76eb6cce9d590ed04ec7c183cf5509f73530d \ + --hash=sha256:2e4a570f6a99e96c457f7bec5ad459c9c420ee80b99eb04cbfcfe3fc18ec6423 \ + --hash=sha256:2f1be45d4c15f237209bbf123a0e05b5d630c8717c42f59f31ea9eae2ad89394 \ + --hash=sha256:2f23cf50eccb3255b6e913188291af0150d89dab44137a69e14e4dcb7be981f1 \ + --hash=sha256:3031e4c16b59424e8d78522c69b062d301d951dc55ad8685736c3335a97fc270 \ + --hash=sha256:33e06717c00c788ab4e79bc4726ecc50c54b9bfb55355eae21473c145d83c2d2 \ + --hash=sha256:364de8f57d6eda0c16dcfb999af902da31396949efa0e583e12675d09709881b \ + --hash=sha256:3715cdf0dd31b836433af9ee9197af10e3df41d273c19bb249230043667a5dfd \ + --hash=sha256:3bb8149840daf2c3f97cebf00e4ed4a65a0baff888bf2605a8d0135ff5cf764e \ + --hash=sha256:3c3c8b55c7fc7b7e8877b9366568cc73d68b82da7fe33d8b98527b73857a225f \ + --hash=sha256:3d68eeef7b4d08a25e51897dac29bcb62aba830e9ac6c4e3297ee7c6a0cf6439 \ + --hash=sha256:3dddf0fb832486cc1ea71d189cb92eb887826e8deebe128884e15020bb6e3f61 \ + --hash=sha256:3edbb9c9130bac05d8c3fe150c51c337a471cc7fdb6d2a0a7d3a88e88a829314 \ + --hash=sha256:3effe081b3135237da6e4c4530ff2a868d3f80be0bda027e118a5971285d42d0 \ + --hash=sha256:422c179022ecdedbe58b0e242607198580804253da220e9454ffe848daa1cfd2 \ + --hash=sha256:42978a68d3825eaac55399eb37a4d52012a205c0c6262199b8b44fcc6fd686e8 \ + --hash=sha256:4399b4226c4785575fb20998dc571bc48125dc92c367ce2602d0d70e0c455eb0 \ + --hash=sha256:45fbb70ccbc8683f2fb58bea89498a7274af1d9ec7995e9f4af5604e028233fc \ + --hash=sha256:4867361c049761a56bd21de507cab2c2a608c55102311d142ade7dab67b34f32 \ + --hash=sha256:48fd46bf7155def2e15287c6f2b133a2f78e2d22cdf55647269977b873c65499 \ + --hash=sha256:4b0d5cdba1b655d5b18042ac9c9ff50bda33568eb80feaaca4fc237b9c4fbfde \ + --hash=sha256:4df0ec814b50275ad6a99bc82a38b59f90e10e47714ac9871e1b223895825468 \ + --hash=sha256:4e52e1b148867b01c05e21837586ee307a01e793b94072d7c7b91d2c2da02ffe \ + --hash=sha256:514fe78fc4b87e7a7601c92492210b20a1b0c6ab20e71e81307d9c2e377c64de \ + --hash=sha256:524ccfded8989a6595dbdda80d779fb977dbc9a7bc458864fc9a0c2fc15dc877 \ + --hash=sha256:528f3a0498a8edc69af0559bdcf8a9f5a8bf7c00051a6ef3141fdcf27017bbf5 \ + --hash=sha256:52d82b0d436edd6a1d22d94a344b9a58abd6c68c357ed44f22d4ba8179b37629 \ + --hash=sha256:5412500e0dc5481b1ee9cf6b38bb3b473f6e411eb62b83dc9b62699c3b7b79f7 \ + --hash=sha256:585c4dc429deebc4307187d2b71ebe914843185ae16a4d582ee030e6cfbb4d8a \ + --hash=sha256:5865b270b420eda7b68928d70bb517ccbe045e53b1a428129bb44372bf3d7dd5 \ + --hash=sha256:5881aaa4bf3a2d086c5f20371d3a5856199a0d8ac72dd8d0dbd7a2ecfc26ab73 \ + --hash=sha256:5885bc586f1edb48e5d68e7a4b4757b5feb2a496b64f462b4d65950f5af3364f \ + --hash=sha256:5a11b16a33656ffc43c92a5343a28dc71eefe460bcc2a4923a96f292692709f6 \ + --hash=sha256:5a997b784a639e05b9d4053ef3b20c7e447ea80814a762f25b8ed5a89d261eac \ + --hash=sha256:5be8f5e4044146a69c96077c7e08f0709c13a314aa5315981185c1f00235fe65 \ + --hash=sha256:63d57fc94eb0bbb4735e45517afc21ef262991d8758a8f2f05dd6e4174944519 \ + --hash=sha256:673b9d8e780f455091200bba8534d5f4f465944cbdd61f31dc832d70e29064a5 \ + --hash=sha256:67d2f8ad9dcc3a9e826bdc7802ed541a44e124c29b7d95a679eeb58c1c14ade8 \ + --hash=sha256:67f5e80adf0aafc7b5454f2c1cb0cde920c9b1f2cbd0485f07cc1d0497c35c5d \ + --hash=sha256:68018c4c67d7e89951a91fbd371e2e34cd8cfc71f0bb43b5332db38497025d51 \ + --hash=sha256:6c4dd3bfd0c82400060896717dd261137398edb7e524527438c54a8c34f736bf \ + --hash=sha256:71f31eda4e370f46af42fc9f264fafa1b09f46ba07bdbee98f25689a04b81c20 \ + --hash=sha256:7512b4d0fc5339d5abbb14d1843f70499cab90d0b864f790e73f780f041615d7 \ + --hash=sha256:75fa3d6946d317ffc7016a6fcc44f42db6d514b7fdb8b4b28cbe058303cb6e53 \ + --hash=sha256:779e851fd0e19795ccc8a9bb4d705d6baa0ef475329fe44a13cf1e962f18ff1e \ + --hash=sha256:796520afa499732191e39fc95b56a3b07f95256f2d22b1c26e217fb69a9db5b5 \ + --hash=sha256:7aae7a3d63b935babfdc6864b31196afd5145878ddd22f5200729006366bc4d5 \ + --hash=sha256:7b82e67c5feb682dbb559c3e6b78355f234943053af61606af126df2183b9ef9 \ + --hash=sha256:7c0536bd9178f754b277a3e53f90f9c9454a3bd108b1531ffff720e082d824f2 \ + --hash=sha256:7eda194dd46e40ec745bf76795a7cccb02a6a41f445ad49d3cf66518b0bd9cff \ + --hash=sha256:82a4bb10b0beef1434fb23a09f001ab5ca87895596b4581fd53f1e5145a8934a \ + --hash=sha256:85c4f11be9cf08917ac2a5a8b6e1ef63b2f8e3799cec194417e76826e5f1de9c \ + --hash=sha256:88b72eb7222d918c967202024812c2bfb4048deeb69ca328363fb8e15254c549 \ + --hash=sha256:89934f9f791566e54c1d92cdc8f8fd0009447a5ecdb1ec6b810d5f8c4955f6be \ + --hash=sha256:8b1942b3e4ed9ed551ed3083a2e6e0772de1e5e3aca872d955e2e86385fb7ff9 \ + --hash=sha256:8ffb141361108e864ab5f1813f66e4e1164181227f9b1f105b042729b6c15125 \ + --hash=sha256:8fffc08de02071c37865a155e5ea5fce0282e1546fd5bde7f6149fcaa32558ac \ + --hash=sha256:91fb6a43d72b4f8863d21f347a9163eecbf36e76e2f51068d59cd004c506f332 \ + --hash=sha256:928e75a7200a4c09e6efc7482a1337919cc61fe1ba289f297827a5b76d8969c2 \ + --hash=sha256:96eef5b9f336f623ffc555ab47a775495e7e8846dde88de5f941e2906453a1ce \ + --hash=sha256:a0611da6b07dd3720f492db1b463a4d1175b096b49438761cc9f35f0d9eaaef5 \ + --hash=sha256:a091026c3bf7519ab1e64655a3f52a59ad4a4e019a6f830c24d6430695b1cf6a \ + --hash=sha256:a22f66270bd6d0804b02cd49dae2b33d4341015545d17f8426f2c4e22f557a23 \ + --hash=sha256:a243132767150a44e6a93cd1dde41010036e1cbc63cc3e9fe1712b277d926ce3 \ + --hash=sha256:a31fa7536ec1fb7155a0cd3a4e3d956c835ad0a43e3610ca32384d01f079ea1c \ + --hash=sha256:a364e8e944d92dcbf33b6b494d4e0fb3499dcc3bd9485beb701aa4b4201fa414 \ + --hash=sha256:a4058f16cee694577f7e4dd410263cd0ef75644b43802a689c2b3c2a7e69453b \ + --hash=sha256:a4b382e0e636ed54cd278791d93fe2c4f370772743f02bcbe431a160089025c9 \ + --hash=sha256:a83d3adea1e0ee36dac34627f78ddd7f093bb9cfc0a8e97f1572a949b695cb98 \ + --hash=sha256:a8ade0363f776f87f982572c2860cc43c65ace208db49c76df0a21dde4ddd16e \ + --hash=sha256:aa59974880ab5ad8ef3afaa26f9bda148c5f39e06b11a8ada4660ecc9fb2feb3 \ + --hash=sha256:aa826340a609d0c954ba52fd831f0fba2a4165659ab0ee1a15e4aac21f302406 \ + --hash=sha256:aaca5a812f050ab55426c32177091130b1e49329b3f002a32934cd0245571307 \ + --hash=sha256:ae82fce1d964f065c32c9517309f0c7be588772352d2f40b1574a214bd6e6098 \ + --hash=sha256:aed57b541b589fa05ac248f4cb1c46cbb432ab82cbd467d1c4f6a2bdc18aecf9 \ + --hash=sha256:afa578b6524ff85fb365f454cf61683771d0170470c48ad9d170c48075f86725 \ + --hash=sha256:b0884e3f22d87c30694e625b1e62e6f30d39782c806287450d9dc2fdf07692fd \ + --hash=sha256:b2aca14c235c7a08558fe0a4786a1a05873a01e86b474dfa8f6df49101853a4e \ + --hash=sha256:b450d7cabcd49aa7ab46a3c6aa3ac7e1593600a1a0605ba536ec0f1b99a04322 \ + --hash=sha256:b725e70d15906d24615201e650d5b0388b08a5187a55f119f25874d0103f90dd \ + --hash=sha256:bfbbab9316330cf81656fed435311386610f78b6c93cc5db4bebbce8dd146675 \ + --hash=sha256:c093c7088b40d8266f57ed71d93112bd64c6724d31f0794c1e52cc4857c28e0e \ + --hash=sha256:c2e49dc23a10a1296b04ca9db200c44d3eb32c8d8ec532e8c1fd24792276522a \ + --hash=sha256:c4393600915c308e546dc7003d74371744234e8444a28622d76fe19b98fa59d1 \ + --hash=sha256:c5ae125276f254b01daa73e2c103363d3e99e3e10505686ac7d9d2442dd4627a \ + --hash=sha256:c6aacf00d05b38a5069826e50ae72751cb5bc27bdc4d5746203988e429b385bb \ + --hash=sha256:c76722b5ed4a31ba103e0dc77ab869222ec36efe1a614e42e9bcea88a36186fe \ + --hash=sha256:c809eef167bf4a57af4b03007004896f5c60bd38dc3852fcd97a26eae3d4c9e6 \ + --hash=sha256:c92ea6d9dd84a750b2bae72ff5e8cf5fdd13e58dda79c33e057862c29a8d5b50 \ + --hash=sha256:cb659702a45136c743bc130760c6f137870d4df3a9e14386478b8a0511abcfca \ + --hash=sha256:ce0930a963ff593e8bb6fda49a503911accc67dee7e5445eec972668e672a0f0 \ + --hash=sha256:d0751528b97d2b19a388b302be2a0ee05817097bab46ff0ed76feeec24951f78 \ + --hash=sha256:d184f85ad2bb1f261eac55cddfcf62a70dee89982c978e92b9a74a1bfef2e367 \ + --hash=sha256:d2a3e412ce1849be34b45922bfef03df32d1410a06d1cdeb793a343c2f1fd666 \ + --hash=sha256:d61ec60945d694df806a9aec88e8f29a27293c6e424f8ff91c80416e3c617645 \ + --hash=sha256:db0c742aad702fd5d0c6611a73f9602f20aec2007c102630c06d7633d9c8f09a \ + --hash=sha256:db4743e30d6f5f92b6d2b7c86b3ad250e0bad8dee4b7ad8a0c44bfb276af89a3 \ + --hash=sha256:dbf7bebc2275016cddf3c997bf8a0f7044160714c64a9b83975670a04e6d2252 \ + --hash=sha256:de1fc314c3ad6bc2f6bd5b5a5b9357b8c6896333d27fdbb7049aea8bd5af2d79 \ + --hash=sha256:df7e5edac4778127f2bf452e0721a58a1cfa4d1d9eac63bdd650535eb8543615 \ + --hash=sha256:e220f7b3e8656ab063d2eb0cd536fafef396829cafe04cb314e734f87649058f \ + --hash=sha256:e3c623923967f3e5961d272718655946e5322b8d058e094764180cdee7bab1af \ + --hash=sha256:e69add9b6b7b08c60d7ff0152c7c9a6c45b4a71a919be5abde6f98f1ea16421c \ + --hash=sha256:e8e0d177b1fe251c3b1b914ab64135475c5273c8cfd2857964b2e3bb0fe196a7 \ + --hash=sha256:ef45f31aec9be01379fc6c10f1d9c677f032f2bac9383c827d44f620e8a88407 \ + --hash=sha256:f1208c1c67ec9e151d78aa3435aa9b08a488b53d9cfac9b699f15255a3461ef2 \ + --hash=sha256:f12582b8d3b4c6be1d298c49cb7ae64a3a73efaf4c2ab4e37db182e3545815ac \ + --hash=sha256:f1de541a9893cf8a1b1db9bf0bf670a2decab42e3e82233d36a74eda7822b4c9 \ + --hash=sha256:f4eac0584cdc3285ef2e74eee1513a6001681fd9753b259e8159421ed28a72e5 \ + --hash=sha256:f7b64fcd670bca8800bc10ced36620c6bbb321e7bc1214b9c0c0df269c1dddc2 \ + --hash=sha256:fb7c61d4be18e930f75948705e9718618862e6fc2ed0d7159b2262be73f167a2 # via doxmlparser markupsafe==3.0.2 \ --hash=sha256:0bff5e0ae4ef2e1ae4fdf2dfd5b76c75e5c2fa4132d05fc1b0dabcd20c7e28c4 \ @@ -364,22 +376,21 @@ markupsafe==3.0.2 \ --hash=sha256:f8b3d067f2e40fe93e1ccdd6b2e1d16c43140e76f02fb1319a05cf2b79d99430 \ --hash=sha256:fcabf5ff6eea076f859677f5f0b6b5c1a51e70a376b0579e0eadef8db48c6b50 # via jinja2 -packaging==25.0 \ - --hash=sha256:29572ef2b1f17581046b3a2227d5c611fb25ec70ca1ba8554b24b0e69331a484 \ - --hash=sha256:d443872c98d677bf60f6a1f2f8c1cb748e8fe762d2bf9d3148b5599295b0fc4f +packaging==24.2 \ + --hash=sha256:09abb1bccd265c01f4a3aa3f7a7db064b36514d2cba19a2f694fe6150451a759 \ + --hash=sha256:c228a6dc5e932d346bc5739379109d49e8853dd8223571c7c5b55260edc0b97f # via # pytest # sphinx -pluggy==1.6.0 \ - --hash=sha256:7dcc130b76258d33b90f61b658791dede3486c3e6bfb003ee5c9bfb396dd22f3 \ - --hash=sha256:e920276dd6813095e9377c0bc5566d94c932c33b27a3e3945d8389c374dd4746 +pluggy==1.5.0 \ + --hash=sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1 \ + --hash=sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669 # via pytest pygments==2.19.1 \ --hash=sha256:61c16d2a8576dc0649d9f39e089b5f02bcd27fba10d8fb4dcc28173f7a45151f \ --hash=sha256:9ea1544ad55cecf4b8242fab6dd35a93bbce657034b0611ee383099054ab6d8c # via # -r requirements.in - # pytest # sphinx # sphinx-tabs pykwalify==1.8.0 \ @@ -390,9 +401,9 @@ pyserial==3.5 \ --hash=sha256:3c77e014170dfffbd816e6ffc205e9842efb10be9f58ec16d3e8675b4925cddb \ --hash=sha256:c4451db6ba391ca6ca299fb3ec7bae67a5c55dde170964c7a14ceefec02f2cf0 # via -r requirements.in -pytest==8.4.1 \ - --hash=sha256:539c70ba6fcead8e78eebbf1115e8b589e7565830d7d006a8723f19ac8a0afb7 \ - --hash=sha256:7c67fd69174877359ed9371ec3af8a3d2b04741818c51e5e99cc1742251fa93c +pytest==8.3.5 \ + --hash=sha256:c69214aa47deac29fad6c2a4f590b9c4a9fdb16a403176fe154b79c0b4d4d820 \ + --hash=sha256:f4efe70cc14e511565ac476b57c279e12a855b11f48f212af1080ef2263d3845 # via -r requirements.in python-dateutil==2.9.0.post0 \ --hash=sha256:37dd54208da7e1cd875388217d5e00ebd4179249f90fb72437e91a35459a0ad3 \ @@ -453,19 +464,19 @@ pyyaml==6.0.2 \ --hash=sha256:f753120cb8181e736c57ef7636e83f31b9c0d1722c516f7e86cf15b7aa57ff12 \ --hash=sha256:ff3824dc5261f50c9b0dfb3be22b4567a6f938ccce4587b38952d85fd9e9afe4 # via -r requirements.in -requests==2.32.4 \ - --hash=sha256:27babd3cda2a6d50b30443204ee89830707d396671944c998b5975b031ac2b2c \ - --hash=sha256:27d0316682c8a29834d3264820024b62a36942083d52caf2f14c0591336d3422 +requests==2.32.3 \ + --hash=sha256:55365417734eb18255590a9ff9eb97e9e1da868d4ccd6402399eaf68af20a760 \ + --hash=sha256:70761cfe03c773ceb22aa2f671b4757976145175cdfca038c02654d061d6dcc6 # via sphinx -roman-numerals-py==3.1.0 \ +roman-numerals-py==3.1.0 ; python_full_version >= '3.11' \ --hash=sha256:9da2ad2fb670bcf24e81070ceb3be72f6c11c440d73bd579fbeca1e9f330954c \ --hash=sha256:be4bf804f083a4ce001b5eb7e3c0862479d10f94c936f6c4e5f250aa5ff5bd2d # via sphinx -ruamel-yaml==0.18.14 \ - --hash=sha256:710ff198bb53da66718c7db27eec4fbcc9aa6ca7204e4c1df2f282b6fe5eb6b2 \ - --hash=sha256:7227b76aaec364df15936730efbf7d72b30c0b79b1d578bbb8e3dcb2d81f52b7 +ruamel-yaml==0.18.10 \ + --hash=sha256:20c86ab29ac2153f80a428e1254a8adf686d3383df04490514ca3b79a362db58 \ + --hash=sha256:30f22513ab2301b3d2b577adc121c6471f28734d3d9728581245f1e76468b4f1 # via pykwalify -ruamel-yaml-clib==0.2.12 ; python_full_version < '3.14' and platform_python_implementation == 'CPython' \ +ruamel-yaml-clib==0.2.12 ; python_full_version < '3.13' and platform_python_implementation == 'CPython' \ --hash=sha256:040ae85536960525ea62868b642bdb0c2cc6021c9f9d507810c0c604e66f5a7b \ --hash=sha256:0467c5965282c62203273b838ae77c0d29d7638c8a4e3a1c8bdd3602c10904e4 \ --hash=sha256:0b7e75b4965e1d4690e93021adfcecccbca7d61c7bddd8e22406ef2ff20d74ef \ @@ -513,25 +524,40 @@ ruamel-yaml-clib==0.2.12 ; python_full_version < '3.14' and platform_python_impl --hash=sha256:fc4b630cd3fa2cf7fce38afa91d7cfe844a9f75d7f0f36393fa98815e911d987 \ --hash=sha256:fd5415dded15c3822597455bc02bcd66e81ef8b7a48cb71a33628fc9fdde39df # via ruamel-yaml -setuptools==80.9.0 \ - --hash=sha256:062d34222ad13e0cc312a4c02d73f059e86a4acbfbdea8f8f76b28c99f306922 \ - --hash=sha256:f36b47402ecde768dbfafc46e8e4207b4360c654f1f3bb84475f0a28628fb19c +setuptools==78.1.0 \ + --hash=sha256:18fd474d4a82a5f83dac888df697af65afa82dec7323d09c3e37d1f14288da54 \ + --hash=sha256:3e386e96793c8702ae83d17b853fb93d3e09ef82ec62722e61da5cd22376dcd8 # via sphinx-togglebutton six==1.17.0 \ --hash=sha256:4721f391ed90541fddacab5acf947aa0d3dc7d27b2e1e8eda2be8970586c3274 \ --hash=sha256:ff70335d468e7eb6ec65b95b99d3a2836546063f63acc5171de367e834932a81 # via + # anytree # doxmlparser # python-dateutil sniffio==1.3.1 \ --hash=sha256:2f6da418d1f1e0fddd844478f41680e794e6051915791a034ff65e5f100525a2 \ --hash=sha256:f4324edc670a0f49750a81b895f35c3adb843cca46f0530f79fc1babb23789dc # via anyio -snowballstemmer==3.0.1 \ - --hash=sha256:6cd7b3897da8d6c9ffb968a6781fa6532dce9c3618a4b127d920dab764a19064 \ - --hash=sha256:6d5eeeec8e9f84d4d56b847692bacf79bc2c8e90c7f80ca4444ff8b6f2e52895 +snowballstemmer==2.2.0 \ + --hash=sha256:09b16deb8547d3412ad7b590689584cd0fe25ec8db3be37788be3810cbf19cb1 \ + --hash=sha256:c8e1716e83cc398ae16824e5572ae04e0d9fc2c6b985fb0f900f5f0c96ecba1a # via sphinx -sphinx==8.2.3 \ +sphinx==8.1.3 ; python_full_version < '3.11' \ + --hash=sha256:09719015511837b76bf6e03e42eb7595ac8c2e41eeb9c29c5b755c6b677992a2 \ + --hash=sha256:43c1911eecb0d3e161ad78611bc905d1ad0e523e4ddc202a58a821773dc4c927 + # via + # -r requirements.in + # sphinx-autobuild + # sphinx-copybutton + # sphinx-notfound-page + # sphinx-rtd-theme + # sphinx-sitemap + # sphinx-tabs + # sphinx-togglebutton + # sphinxcontrib-jquery + # sphinxcontrib-svg2pdfconverter +sphinx==8.2.3 ; python_full_version >= '3.11' \ --hash=sha256:398ad29dee7f63a75888314e9424d40f52ce5a6a87ae88e7071e80af296ec348 \ --hash=sha256:4405915165f13521d875a8c29c8970800a0141c14cc5416a38feca4ea5d9b9c3 # via @@ -605,129 +631,132 @@ sphinxcontrib-svg2pdfconverter==1.3.0 \ --hash=sha256:5df6b0895e2e2101d720bfd08841bb56d74c57b1f86229a7c18b771dfdf4ffbb \ --hash=sha256:6411a4cc2f57eed96a0d7bbfa139f68cbe7983018881e1e6d7c46053cd69911f # via -r requirements.in -starlette==0.47.0 \ - --hash=sha256:1f64887e94a447fed5f23309fb6890ef23349b7e478faa7b24a851cd4eb844af \ - --hash=sha256:9d052d4933683af40ffd47c7465433570b4949dc937e20ad1d73b34e72f10c37 +starlette==0.46.1 \ + --hash=sha256:3c88d58ee4bd1bb807c0d1acb381838afc7752f9ddaec81bbe4383611d833230 \ + --hash=sha256:77c74ed9d2720138b25875133f3a2dae6d854af2ec37dceb56aef370c1d8a227 # via sphinx-autobuild -typing-extensions==4.14.0 ; python_full_version < '3.13' \ - --hash=sha256:8676b788e32f02ab42d9e7c61324048ae4c6d844a399eebace3d4979d75ceef4 \ - --hash=sha256:a1514509136dd0b477638fc68d6a91497af5076466ad0fa6c338e44e359944af - # via anyio -urllib3==2.5.0 \ - --hash=sha256:3fc47733c7e419d4bc3f6b3dc2b4f890bb743906a30d56ba4a5bfa4bbff92760 \ - --hash=sha256:e6b01673c0fa6a13e374b50871808eb3bf7046c4b125b216f6bf1cc604cff0dc +tomli==2.2.1 ; python_full_version < '3.11' \ + --hash=sha256:023aa114dd824ade0100497eb2318602af309e5a55595f76b626d6d9f3b7b0a6 \ + --hash=sha256:02abe224de6ae62c19f090f68da4e27b10af2b93213d36cf44e6e1c5abd19fdd \ + --hash=sha256:286f0ca2ffeeb5b9bd4fcc8d6c330534323ec51b2f52da063b11c502da16f30c \ + --hash=sha256:2d0f2fdd22b02c6d81637a3c95f8cd77f995846af7414c5c4b8d0545afa1bc4b \ + --hash=sha256:33580bccab0338d00994d7f16f4c4ec25b776af3ffaac1ed74e0b3fc95e885a8 \ + --hash=sha256:400e720fe168c0f8521520190686ef8ef033fb19fc493da09779e592861b78c6 \ + --hash=sha256:40741994320b232529c802f8bc86da4e1aa9f413db394617b9a256ae0f9a7f77 \ + --hash=sha256:465af0e0875402f1d226519c9904f37254b3045fc5084697cefb9bdde1ff99ff \ + --hash=sha256:4a8f6e44de52d5e6c657c9fe83b562f5f4256d8ebbfe4ff922c495620a7f6cea \ + --hash=sha256:4e340144ad7ae1533cb897d406382b4b6fede8890a03738ff1683af800d54192 \ + --hash=sha256:678e4fa69e4575eb77d103de3df8a895e1591b48e740211bd1067378c69e8249 \ + --hash=sha256:6972ca9c9cc9f0acaa56a8ca1ff51e7af152a9f87fb64623e31d5c83700080ee \ + --hash=sha256:7fc04e92e1d624a4a63c76474610238576942d6b8950a2d7f908a340494e67e4 \ + --hash=sha256:889f80ef92701b9dbb224e49ec87c645ce5df3fa2cc548664eb8a25e03127a98 \ + --hash=sha256:8d57ca8095a641b8237d5b079147646153d22552f1c637fd3ba7f4b0b29167a8 \ + --hash=sha256:8dd28b3e155b80f4d54beb40a441d366adcfe740969820caf156c019fb5c7ec4 \ + --hash=sha256:9316dc65bed1684c9a98ee68759ceaed29d229e985297003e494aa825ebb0281 \ + --hash=sha256:a198f10c4d1b1375d7687bc25294306e551bf1abfa4eace6650070a5c1ae2744 \ + --hash=sha256:a38aa0308e754b0e3c67e344754dff64999ff9b513e691d0e786265c93583c69 \ + --hash=sha256:a92ef1a44547e894e2a17d24e7557a5e85a9e1d0048b0b5e7541f76c5032cb13 \ + --hash=sha256:ac065718db92ca818f8d6141b5f66369833d4a80a9d74435a268c52bdfa73140 \ + --hash=sha256:b82ebccc8c8a36f2094e969560a1b836758481f3dc360ce9a3277c65f374285e \ + --hash=sha256:c954d2250168d28797dd4e3ac5cf812a406cd5a92674ee4c8f123c889786aa8e \ + --hash=sha256:cb55c73c5f4408779d0cf3eef9f762b9c9f147a77de7b258bef0a5628adc85cc \ + --hash=sha256:cd45e1dc79c835ce60f7404ec8119f2eb06d38b1deba146f07ced3bbc44505ff \ + --hash=sha256:d3f5614314d758649ab2ab3a62d4f2004c825922f9e370b29416484086b264ec \ + --hash=sha256:d920f33822747519673ee656a4b6ac33e382eca9d331c87770faa3eef562aeb2 \ + --hash=sha256:db2b95f9de79181805df90bedc5a5ab4c165e6ec3fe99f970d0e302f384ad222 \ + --hash=sha256:e59e304978767a54663af13c07b3d1af22ddee3bb2fb0618ca1593e4f593a106 \ + --hash=sha256:e85e99945e688e32d5a35c1ff38ed0b3f41f43fad8df0bdf79f72b2ba7bc5272 \ + --hash=sha256:ece47d672db52ac607a3d9599a9d48dcb2f2f735c6c2d1f34130085bb12b112a \ + --hash=sha256:f4039b9cbc3048b2416cc57ab3bda989a6fcf9b36cf8937f01a6e731b64f80d7 + # via + # pytest + # sphinx +typing-extensions==4.13.0 ; python_full_version < '3.13' \ + --hash=sha256:0a4ac55a5820789d87e297727d229866c9650f6521b64206413c4fbada24d95b \ + --hash=sha256:c8dd92cc0d6425a97c18fbb9d1954e5ff92c1ca881a309c45f06ebc0b79058e5 + # via + # anyio + # uvicorn +urllib3==2.3.0 \ + --hash=sha256:1cee9ad369867bfdbbb48b7dd50374c0967a0bb7710050facf0dd6911440e3df \ + --hash=sha256:f8c5449b3cf0861679ce7e0503c7b44b5ec981bec0d1d3795a07f1ba96f0204d # via requests -uvicorn==0.34.3 \ - --hash=sha256:16246631db62bdfbf069b0645177d6e8a77ba950cfedbfd093acef9444e4d885 \ - --hash=sha256:35919a9a979d7a59334b6b10e05d77c1d0d574c50e0fc98b8b1a0f165708b55a +uvicorn==0.34.0 \ + --hash=sha256:023dc038422502fa28a09c7a30bf2b6991512da7dcdb8fd35fe57cfc154126f4 \ + --hash=sha256:404051050cd7e905de2c9a7e61790943440b3416f49cb409f965d9dcd0fa73e9 # via sphinx-autobuild -watchfiles==1.1.0 \ - --hash=sha256:00645eb79a3faa70d9cb15c8d4187bb72970b2470e938670240c7998dad9f13a \ - --hash=sha256:04e4ed5d1cd3eae68c89bcc1a485a109f39f2fd8de05f705e98af6b5f1861f1f \ - --hash=sha256:0a7d40b77f07be87c6faa93d0951a0fcd8cbca1ddff60a1b65d741bac6f3a9f6 \ - --hash=sha256:0ece16b563b17ab26eaa2d52230c9a7ae46cf01759621f4fbbca280e438267b3 \ - --hash=sha256:11ee4444250fcbeb47459a877e5e80ed994ce8e8d20283857fc128be1715dac7 \ - --hash=sha256:12b0a02a91762c08f7264e2e79542f76870c3040bbc847fb67410ab81474932a \ - --hash=sha256:12fe8eaffaf0faa7906895b4f8bb88264035b3f0243275e0bf24af0436b27259 \ - --hash=sha256:130fc497b8ee68dce163e4254d9b0356411d1490e868bd8790028bc46c5cc297 \ - --hash=sha256:17ab167cca6339c2b830b744eaf10803d2a5b6683be4d79d8475d88b4a8a4be1 \ - --hash=sha256:199207b2d3eeaeb80ef4411875a6243d9ad8bc35b07fc42daa6b801cc39cc41c \ - --hash=sha256:20ecc8abbd957046f1fe9562757903f5eaf57c3bce70929fda6c7711bb58074a \ - --hash=sha256:239736577e848678e13b201bba14e89718f5c2133dfd6b1f7846fa1b58a8532b \ - --hash=sha256:249590eb75ccc117f488e2fabd1bfa33c580e24b96f00658ad88e38844a040bb \ - --hash=sha256:27f30e14aa1c1e91cb653f03a63445739919aef84c8d2517997a83155e7a2fcc \ - --hash=sha256:29e7bc2eee15cbb339c68445959108803dc14ee0c7b4eea556400131a8de462b \ - --hash=sha256:328dbc9bff7205c215a7807da7c18dce37da7da718e798356212d22696404339 \ - --hash=sha256:32d6d4e583593cb8576e129879ea0991660b935177c0f93c6681359b3654bfa9 \ - --hash=sha256:3366f56c272232860ab45c77c3ca7b74ee819c8e1f6f35a7125556b198bbc6df \ - --hash=sha256:3434e401f3ce0ed6b42569128b3d1e3af773d7ec18751b918b89cd49c14eaafb \ - --hash=sha256:37d3d3f7defb13f62ece99e9be912afe9dd8a0077b7c45ee5a57c74811d581a4 \ - --hash=sha256:3a6fd40bbb50d24976eb275ccb55cd1951dfb63dbc27cae3066a6ca5f4beabd5 \ - --hash=sha256:3aba215958d88182e8d2acba0fdaf687745180974946609119953c0e112397dc \ - --hash=sha256:406520216186b99374cdb58bc48e34bb74535adec160c8459894884c983a149c \ - --hash=sha256:4281cd9fce9fc0a9dbf0fc1217f39bf9cf2b4d315d9626ef1d4e87b84699e7e8 \ - --hash=sha256:42f92befc848bb7a19658f21f3e7bae80d7d005d13891c62c2cd4d4d0abb3433 \ - --hash=sha256:48aa25e5992b61debc908a61ab4d3f216b64f44fdaa71eb082d8b2de846b7d12 \ - --hash=sha256:5007f860c7f1f8df471e4e04aaa8c43673429047d63205d1630880f7637bca30 \ - --hash=sha256:50a51a90610d0845a5931a780d8e51d7bd7f309ebc25132ba975aca016b576a0 \ - --hash=sha256:51556d5004887045dba3acdd1fdf61dddea2be0a7e18048b5e853dcd37149b86 \ - --hash=sha256:51b81e55d40c4b4aa8658427a3ee7ea847c591ae9e8b81ef94a90b668999353c \ - --hash=sha256:5366164391873ed76bfdf618818c82084c9db7fac82b64a20c44d335eec9ced5 \ - --hash=sha256:54062ef956807ba806559b3c3d52105ae1827a0d4ab47b621b31132b6b7e2866 \ - --hash=sha256:60022527e71d1d1fda67a33150ee42869042bce3d0fcc9cc49be009a9cded3fb \ - --hash=sha256:622d6b2c06be19f6e89b1d951485a232e3b59618def88dbeda575ed8f0d8dbf2 \ - --hash=sha256:62cc7a30eeb0e20ecc5f4bd113cd69dcdb745a07c68c0370cea919f373f65d9e \ - --hash=sha256:693ed7ec72cbfcee399e92c895362b6e66d63dac6b91e2c11ae03d10d503e575 \ - --hash=sha256:6d2404af8db1329f9a3c9b79ff63e0ae7131986446901582067d9304ae8aaf7f \ - --hash=sha256:7049e52167fc75fc3cc418fc13d39a8e520cbb60ca08b47f6cedb85e181d2f2a \ - --hash=sha256:7080c4bb3efd70a07b1cc2df99a7aa51d98685be56be6038c3169199d0a1c69f \ - --hash=sha256:7738027989881e70e3723c75921f1efa45225084228788fc59ea8c6d732eb30d \ - --hash=sha256:7a7bd57a1bb02f9d5c398c0c1675384e7ab1dd39da0ca50b7f09af45fa435277 \ - --hash=sha256:7b3443f4ec3ba5aa00b0e9fa90cf31d98321cbff8b925a7c7b84161619870bc9 \ - --hash=sha256:7c55b0f9f68590115c25272b06e63f0824f03d4fc7d6deed43d8ad5660cabdbf \ - --hash=sha256:7fd1b3879a578a8ec2076c7961076df540b9af317123f84569f5a9ddee64ce92 \ - --hash=sha256:8076a5769d6bdf5f673a19d51da05fc79e2bbf25e9fe755c47595785c06a8c72 \ - --hash=sha256:80f811146831c8c86ab17b640801c25dc0a88c630e855e2bef3568f30434d52b \ - --hash=sha256:8412eacef34cae2836d891836a7fff7b754d6bcac61f6c12ba5ca9bc7e427b68 \ - --hash=sha256:865c8e95713744cf5ae261f3067861e9da5f1370ba91fc536431e29b418676fa \ - --hash=sha256:86b1e28d4c37e89220e924305cd9f82866bb0ace666943a6e4196c5df4d58dcc \ - --hash=sha256:891c69e027748b4a73847335d208e374ce54ca3c335907d381fde4e41661b13b \ - --hash=sha256:8ac164e20d17cc285f2b94dc31c384bc3aa3dd5e7490473b3db043dd70fbccfd \ - --hash=sha256:8c5701dc474b041e2934a26d31d39f90fac8a3dee2322b39f7729867f932b1d4 \ - --hash=sha256:90ebb429e933645f3da534c89b29b665e285048973b4d2b6946526888c3eb2c7 \ - --hash=sha256:923fec6e5461c42bd7e3fd5ec37492c6f3468be0499bc0707b4bbbc16ac21792 \ - --hash=sha256:935f9edd022ec13e447e5723a7d14456c8af254544cefbc533f6dd276c9aa0d9 \ - --hash=sha256:95ab1594377effac17110e1352989bdd7bdfca9ff0e5eeccd8c69c5389b826d0 \ - --hash=sha256:9974d2f7dc561cce3bb88dfa8eb309dab64c729de85fba32e98d75cf24b66297 \ - --hash=sha256:9c733cda03b6d636b4219625a4acb5c6ffb10803338e437fb614fef9516825ef \ - --hash=sha256:9dc001c3e10de4725c749d4c2f2bdc6ae24de5a88a339c4bce32300a31ede179 \ - --hash=sha256:9f811079d2f9795b5d48b55a37aa7773680a5659afe34b54cc1d86590a51507d \ - --hash=sha256:a2726d7bfd9f76158c84c10a409b77a320426540df8c35be172444394b17f7ea \ - --hash=sha256:a479466da6db5c1e8754caee6c262cd373e6e6c363172d74394f4bff3d84d7b5 \ - --hash=sha256:a543492513a93b001975ae283a51f4b67973662a375a403ae82f420d2c7205ee \ - --hash=sha256:a89c75a5b9bc329131115a409d0acc16e8da8dfd5867ba59f1dd66ae7ea8fa82 \ - --hash=sha256:a8f6f72974a19efead54195bc9bed4d850fc047bb7aa971268fd9a8387c89011 \ - --hash=sha256:a9ccbf1f129480ed3044f540c0fdbc4ee556f7175e5ab40fe077ff6baf286d4e \ - --hash=sha256:aa0cc8365ab29487eb4f9979fd41b22549853389e22d5de3f134a6796e1b05a4 \ - --hash=sha256:adb4167043d3a78280d5d05ce0ba22055c266cf8655ce942f2fb881262ff3cdf \ - --hash=sha256:af06c863f152005c7592df1d6a7009c836a247c9d8adb78fef8575a5a98699db \ - --hash=sha256:b067915e3c3936966a8607f6fe5487df0c9c4afb85226613b520890049deea20 \ - --hash=sha256:b7c5f6fe273291f4d414d55b2c80d33c457b8a42677ad14b4b47ff025d0893e4 \ - --hash=sha256:b915daeb2d8c1f5cee4b970f2e2c988ce6514aace3c9296e58dd64dc9aa5d575 \ - --hash=sha256:ba0e3255b0396cac3cc7bbace76404dd72b5438bf0d8e7cefa2f79a7f3649caa \ - --hash=sha256:bda8136e6a80bdea23e5e74e09df0362744d24ffb8cd59c4a95a6ce3d142f79c \ - --hash=sha256:bfe3c517c283e484843cb2e357dd57ba009cff351edf45fb455b5fbd1f45b15f \ - --hash=sha256:c588c45da9b08ab3da81d08d7987dae6d2a3badd63acdb3e206a42dbfa7cb76f \ - --hash=sha256:c600e85f2ffd9f1035222b1a312aff85fd11ea39baff1d705b9b047aad2ce267 \ - --hash=sha256:c68e9f1fcb4d43798ad8814c4c1b61547b014b667216cb754e606bfade587018 \ - --hash=sha256:c9649dfc57cc1f9835551deb17689e8d44666315f2e82d337b9f07bd76ae3aa2 \ - --hash=sha256:cb45350fd1dc75cd68d3d72c47f5b513cb0578da716df5fba02fff31c69d5f2d \ - --hash=sha256:cbcf8630ef4afb05dc30107bfa17f16c0896bb30ee48fc24bf64c1f970f3b1fd \ - --hash=sha256:cbd949bdd87567b0ad183d7676feb98136cde5bb9025403794a4c0db28ed3a47 \ - --hash=sha256:cc08ef8b90d78bfac66f0def80240b0197008e4852c9f285907377b2947ffdcb \ - --hash=sha256:cd17a1e489f02ce9117b0de3c0b1fab1c3e2eedc82311b299ee6b6faf6c23a29 \ - --hash=sha256:d05686b5487cfa2e2c28ff1aa370ea3e6c5accfe6435944ddea1e10d93872147 \ - --hash=sha256:d0e10e6f8f6dc5762adee7dece33b722282e1f59aa6a55da5d493a97282fedd8 \ - --hash=sha256:d181ef50923c29cf0450c3cd47e2f0557b62218c50b2ab8ce2ecaa02bd97e670 \ - --hash=sha256:d1caf40c1c657b27858f9774d5c0e232089bca9cb8ee17ce7478c6e9264d2587 \ - --hash=sha256:d7642b9bc4827b5518ebdb3b82698ada8c14c7661ddec5fe719f3e56ccd13c97 \ - --hash=sha256:d9481174d3ed982e269c090f780122fb59cee6c3796f74efe74e70f7780ed94c \ - --hash=sha256:d9ba68ec283153dead62cbe81872d28e053745f12335d037de9cbd14bd1877f5 \ - --hash=sha256:da71945c9ace018d8634822f16cbc2a78323ef6c876b1d34bbf5d5222fd6a72e \ - --hash=sha256:dc44678a72ac0910bac46fa6a0de6af9ba1355669b3dfaf1ce5f05ca7a74364e \ - --hash=sha256:df32d59cb9780f66d165a9a7a26f19df2c7d24e3bd58713108b41d0ff4f929c6 \ - --hash=sha256:df670918eb7dd719642e05979fc84704af913d563fd17ed636f7c4783003fdcc \ - --hash=sha256:e78b6ed8165996013165eeabd875c5dfc19d41b54f94b40e9fff0eb3193e5e8e \ - --hash=sha256:ed8fc66786de8d0376f9f913c09e963c66e90ced9aa11997f93bdb30f7c872a8 \ - --hash=sha256:eff4b8d89f444f7e49136dc695599a591ff769300734446c0a86cba2eb2f9895 \ - --hash=sha256:f21af781a4a6fbad54f03c598ab620e3a77032c5878f3d780448421a6e1818c7 \ - --hash=sha256:f2bcdc54ea267fe72bfc7d83c041e4eb58d7d8dc6f578dfddb52f037ce62f432 \ - --hash=sha256:f2f0498b7d2a3c072766dba3274fe22a183dbea1f99d188f1c6c72209a1063dc \ - --hash=sha256:f7208ab6e009c627b7557ce55c465c98967e8caa8b11833531fdf95799372633 \ - --hash=sha256:f7590d5a455321e53857892ab8879dce62d1f4b04748769f5adf2e707afb9d4f \ - --hash=sha256:fa257a4d0d21fcbca5b5fcba9dca5a78011cb93c0323fb8855c6d2dfbc76eb77 \ - --hash=sha256:fba9b62da882c1be1280a7584ec4515d0a6006a94d6e5819730ec2eab60ffe12 \ - --hash=sha256:fe4371595edf78c41ef8ac8df20df3943e13defd0efcb732b2e393b5a8a7a71f +watchfiles==1.0.4 \ + --hash=sha256:02a526ee5b5a09e8168314c905fc545c9bc46509896ed282aeb5a8ba9bd6ca27 \ + --hash=sha256:05d341c71f3d7098920f8551d4df47f7b57ac5b8dad56558064c3431bdfc0b74 \ + --hash=sha256:076f293100db3b0b634514aa0d294b941daa85fc777f9c698adb1009e5aca0b1 \ + --hash=sha256:0799ae68dfa95136dde7c472525700bd48777875a4abb2ee454e3ab18e9fc712 \ + --hash=sha256:0986902677a1a5e6212d0c49b319aad9cc48da4bd967f86a11bde96ad9676ca1 \ + --hash=sha256:0bc80d91ddaf95f70258cf78c471246846c1986bcc5fd33ccc4a1a67fcb40f9a \ + --hash=sha256:13c2ce7b72026cfbca120d652f02c7750f33b4c9395d79c9790b27f014c8a5a2 \ + --hash=sha256:1941b4e39de9b38b868a69b911df5e89dc43767feeda667b40ae032522b9b5f1 \ + --hash=sha256:1eacd91daeb5158c598fe22d7ce66d60878b6294a86477a4715154990394c9b3 \ + --hash=sha256:229e6ec880eca20e0ba2f7e2249c85bae1999d330161f45c78d160832e026ee2 \ + --hash=sha256:22bb55a7c9e564e763ea06c7acea24fc5d2ee5dfc5dafc5cfbedfe58505e9f90 \ + --hash=sha256:278aaa395f405972e9f523bd786ed59dfb61e4b827856be46a42130605fd0899 \ + --hash=sha256:2a9f93f8439639dc244c4d2902abe35b0279102bca7bbcf119af964f51d53c19 \ + --hash=sha256:308ac265c56f936636e3b0e3f59e059a40003c655228c131e1ad439957592303 \ + --hash=sha256:31f1a379c9dcbb3f09cf6be1b7e83b67c0e9faabed0471556d9438a4a4e14202 \ + --hash=sha256:32b026a6ab64245b584acf4931fe21842374da82372d5c039cba6bf99ef722f3 \ + --hash=sha256:342622287b5604ddf0ed2d085f3a589099c9ae8b7331df3ae9845571586c4f3d \ + --hash=sha256:39f4914548b818540ef21fd22447a63e7be6e24b43a70f7642d21f1e73371590 \ + --hash=sha256:3f68d8e9d5a321163ddacebe97091000955a1b74cd43724e346056030b0bacee \ + --hash=sha256:43b168bba889886b62edb0397cab5b6490ffb656ee2fcb22dec8bfeb371a9e12 \ + --hash=sha256:47eb32ef8c729dbc4f4273baece89398a4d4b5d21a1493efea77a17059f4df8a \ + --hash=sha256:4810ea2ae622add560f4aa50c92fef975e475f7ac4900ce5ff5547b2434642d8 \ + --hash=sha256:4e997802d78cdb02623b5941830ab06f8860038faf344f0d288d325cc9c5d2ff \ + --hash=sha256:4ebbeca9360c830766b9f0df3640b791be569d988f4be6c06d6fae41f187f105 \ + --hash=sha256:4f8c4998506241dedf59613082d1c18b836e26ef2a4caecad0ec41e2a15e4226 \ + --hash=sha256:55ccfd27c497b228581e2838d4386301227fc0cb47f5a12923ec2fe4f97b95af \ + --hash=sha256:5717021b199e8353782dce03bd8a8f64438832b84e2885c4a645f9723bf656d9 \ + --hash=sha256:5c11ea22304d17d4385067588123658e9f23159225a27b983f343fcffc3e796a \ + --hash=sha256:5e0227b8ed9074c6172cf55d85b5670199c99ab11fd27d2c473aa30aec67ee42 \ + --hash=sha256:62c9953cf85529c05b24705639ffa390f78c26449e15ec34d5339e8108c7c407 \ + --hash=sha256:6ba473efd11062d73e4f00c2b730255f9c1bdd73cd5f9fe5b5da8dbd4a717205 \ + --hash=sha256:740d103cd01458f22462dedeb5a3382b7f2c57d07ff033fbc9465919e5e1d0f3 \ + --hash=sha256:74cb3ca19a740be4caa18f238298b9d472c850f7b2ed89f396c00a4c97e2d9ff \ + --hash=sha256:7b75fee5a16826cf5c46fe1c63116e4a156924d668c38b013e6276f2582230f0 \ + --hash=sha256:7cf684aa9bba4cd95ecb62c822a56de54e3ae0598c1a7f2065d51e24637a3c5d \ + --hash=sha256:8012bd820c380c3d3db8435e8cf7592260257b378b649154a7948a663b5f84e9 \ + --hash=sha256:857f5fc3aa027ff5e57047da93f96e908a35fe602d24f5e5d8ce64bf1f2fc733 \ + --hash=sha256:8b1f135238e75d075359cf506b27bf3f4ca12029c47d3e769d8593a2024ce161 \ + --hash=sha256:8d0d0630930f5cd5af929040e0778cf676a46775753e442a3f60511f2409f48f \ + --hash=sha256:90192cdc15ab7254caa7765a98132a5a41471cf739513cc9bcf7d2ffcc0ec7b2 \ + --hash=sha256:95b42cac65beae3a362629950c444077d1b44f1790ea2772beaea95451c086bb \ + --hash=sha256:9745a4210b59e218ce64c91deb599ae8775c8a9da4e95fb2ee6fe745fc87d01a \ + --hash=sha256:9d1ef56b56ed7e8f312c934436dea93bfa3e7368adfcf3df4c0da6d4de959a1e \ + --hash=sha256:9eea33ad8c418847dd296e61eb683cae1c63329b6d854aefcd412e12d94ee235 \ + --hash=sha256:9f25d0ba0fe2b6d2c921cf587b2bf4c451860086534f40c384329fb96e2044d1 \ + --hash=sha256:9fe37a2de80aa785d340f2980276b17ef697ab8db6019b07ee4fd28a8359d2f3 \ + --hash=sha256:a38320582736922be8c865d46520c043bff350956dfc9fbaee3b2df4e1740a4b \ + --hash=sha256:a462490e75e466edbb9fc4cd679b62187153b3ba804868452ef0577ec958f5ff \ + --hash=sha256:a5ae5706058b27c74bac987d615105da17724172d5aaacc6c362a40599b6de43 \ + --hash=sha256:aa216f87594f951c17511efe5912808dfcc4befa464ab17c98d387830ce07b60 \ + --hash=sha256:ab0311bb2ffcd9f74b6c9de2dda1612c13c84b996d032cd74799adb656af4e8b \ + --hash=sha256:ab594e75644421ae0a2484554832ca5895f8cab5ab62de30a1a57db460ce06c6 \ + --hash=sha256:aee397456a29b492c20fda2d8961e1ffb266223625346ace14e4b6d861ba9c80 \ + --hash=sha256:b045c800d55bc7e2cadd47f45a97c7b29f70f08a7c2fa13241905010a5493f94 \ + --hash=sha256:b77d5622ac5cc91d21ae9c2b284b5d5c51085a0bdb7b518dba263d0af006132c \ + --hash=sha256:ba5bb3073d9db37c64520681dd2650f8bd40902d991e7b4cfaeece3e32561d08 \ + --hash=sha256:bdef5a1be32d0b07dcea3318a0be95d42c98ece24177820226b56276e06b63b0 \ + --hash=sha256:c2acfa49dd0ad0bf2a9c0bb9a985af02e89345a7189be1efc6baa085e0f72d7c \ + --hash=sha256:c7cce76c138a91e720d1df54014a047e680b652336e1b73b8e3ff3158e05061e \ + --hash=sha256:cc27a65069bcabac4552f34fd2dce923ce3fcde0721a16e4fb1b466d63ec831f \ + --hash=sha256:cdbd912a61543a36aef85e34f212e5d2486e7c53ebfdb70d1e0b060cc50dd0bf \ + --hash=sha256:cdcc92daeae268de1acf5b7befcd6cfffd9a047098199056c72e4623f531de18 \ + --hash=sha256:d3452c1ec703aa1c61e15dfe9d482543e4145e7c45a6b8566978fbb044265a21 \ + --hash=sha256:d6097538b0ae5c1b88c3b55afa245a66793a8fec7ada6755322e465fb1a0e8cc \ + --hash=sha256:d8d3d9203705b5797f0af7e7e5baa17c8588030aaadb7f6a86107b7247303817 \ + --hash=sha256:e0611d244ce94d83f5b9aff441ad196c6e21b55f77f3c47608dcf651efe54c4a \ + --hash=sha256:f12969a3765909cf5dc1e50b2436eb2c0e676a3c75773ab8cc3aa6175c16e902 \ + --hash=sha256:f44a39aee3cbb9b825285ff979ab887a25c5d336e5ec3574f1506a4671556a8d \ + --hash=sha256:f9ce064e81fe79faa925ff03b9f4c1a98b0bbb4a1b8c1b015afa93030cb21a49 \ + --hash=sha256:fb2c46e275fbb9f0c92e7654b231543c7bbfa1df07cdc4b99fa73bedfde5c844 \ + --hash=sha256:fc2eb5d14a8e0d5df7b36288979176fbb39672d45184fc4b1c004d7c3ce29317 # via sphinx-autobuild websockets==15.0.1 \ --hash=sha256:0701bc3cfcb9164d04a14b149fd74be7347a530ad3bbf15ab2c678a2cd3dd9a2 \ diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index c32a40fd35c8..f1da73f3ec0d 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -2008,7 +2008,7 @@ class PythonCompatCheck(ComplianceTest): name = "PythonCompat" doc = "Check that Python files are compatible with Zephyr minimum supported Python version." - MAX_VERSION = (3, 12) + MAX_VERSION = (3, 10) MAX_VERSION_STR = f"{MAX_VERSION[0]}.{MAX_VERSION[1]}" def run(self): diff --git a/scripts/requirements-actions.txt b/scripts/requirements-actions.txt index 5dc028452880..621d8dbc4aec 100644 --- a/scripts/requirements-actions.txt +++ b/scripts/requirements-actions.txt @@ -1,5 +1,5 @@ # This file was autogenerated by uv via the following command: -# uv pip compile --universal --python-version 3.12 --generate-hashes requirements-actions.in --output-file requirements-actions.txt +# uv pip compile --universal --python-version 3.10 --generate-hashes requirements-actions.in anytree==2.13.0 \ --hash=sha256:4cbcf10df36b1f1cba131b7e487ff3edafc9d6e932a3c70071b5b768bab901ff \ --hash=sha256:c9d3aa6825fdd06af7ebb05b4ef291d2db63e62bb1f9b7d9b71354be9d362714 @@ -12,9 +12,9 @@ astroid==3.3.10 \ --hash=sha256:104fb9cb9b27ea95e847a94c003be03a9e039334a8ebca5ee27dafaf5c5711eb \ --hash=sha256:c332157953060c6deb9caa57303ae0d20b0fbdb2e59b4a4f2a6ba49d0a7961ce # via pylint -awscli==1.40.38 \ - --hash=sha256:3f90f2815e3b72691785d2bbd4f2c3dcbde311c55e1f5633a37cc3e514ba6fdb \ - --hash=sha256:ec9b69ff4600ef151df3336f0e7af4cf30280d27f9d8e67e09c4b386ceb1f154 +awscli==1.40.36 \ + --hash=sha256:4a548d855cafad153e661defab601363ba8a5644873bf9f8dec31d5c0ebbb351 \ + --hash=sha256:960d92bf8b2f7efd142112f277eed7cc82d8af85fceefe4d321a620352b75ebd # via -r requirements-actions.in beartype==0.21.0 \ --hash=sha256:b6a1bd56c72f31b0a496a36cc55df6e2f475db166ad07fa4acc7e74f4c7f34c0 \ @@ -24,9 +24,9 @@ boolean-py==5.0 \ --hash=sha256:60cbc4bad079753721d32649545505362c754e121570ada4658b852a3a318d95 \ --hash=sha256:ef28a70bd43115208441b53a045d1549e2f0ec6e3d08a9d142cbc41c1938e8d9 # via license-expression -botocore==1.38.39 \ - --hash=sha256:2305f688e9328af473a504197584112f228513e06412038d83205ce8d1456f40 \ - --hash=sha256:ee3aa03af1dabed4f3710cd64f6d9d488281eee720710bf1cf9f2b2fd30025ae +botocore==1.38.37 \ + --hash=sha256:06ce46da5420ea7cf542ece4ff1ec9045922fef977adf4bbec618c96c7a478bf \ + --hash=sha256:f8ad063b7dcdbf12f2c1b5a4405f390ce52beff3b2861af2e5169816ee0146f2 # via # awscli # s3transfer @@ -316,7 +316,9 @@ elasticsearch==8.18.1 \ exceptiongroup==1.3.0 \ --hash=sha256:4d111e6e0c13d0644cad6ddaa7ed0261a0b36971f6d23e7ec9b4b9097da78a10 \ --hash=sha256:b241f5885f560bc56a59ee63ca4c6a8bfa46ae4ad651af316d4e81817bb9fd88 - # via -r requirements-actions.in + # via + # -r requirements-actions.in + # pytest filelock==3.18.0 \ --hash=sha256:adbc88eabb99d2fec8c9c1b229b171f18afa655400173ddc653d5d01501fb9f2 \ --hash=sha256:c401f4f8377c4464e6db25fff06205fd89bdd83b65eb0488ed1b160f780e21de @@ -442,6 +444,10 @@ intelhex==2.3.0 \ --hash=sha256:87cc5225657524ec6361354be928adfd56bcf2a3dcc646c40f8f094c39c07db4 \ --hash=sha256:892b7361a719f4945237da8ccf754e9513db32f5628852785aea108dcd250093 # via -r requirements-actions.in +isodate==0.7.2 ; python_full_version < '3.11' \ + --hash=sha256:28009937d8031054830160fce6d409ed342816b543597cece116d966c6d99e15 \ + --hash=sha256:4cd1aa0f43ca76f4a6c6c0292a85f40b35ec2e43e315b59f06e6d32171a953e6 + # via rdflib isort==6.0.1 \ --hash=sha256:1cb5df28dfbc742e490c5e41bad6da41b805b0a8be7bc93cd0fb2a8a890ac450 \ --hash=sha256:2dc5d7f65c9678d94c88dfc29161a320eec67328bc97aad576874cb4be1e9615 @@ -890,9 +896,9 @@ pyserial==3.5 \ --hash=sha256:3c77e014170dfffbd816e6ffc205e9842efb10be9f58ec16d3e8675b4925cddb \ --hash=sha256:c4451db6ba391ca6ca299fb3ec7bae67a5c55dde170964c7a14ceefec02f2cf0 # via -r requirements-actions.in -pytest==8.4.1 \ - --hash=sha256:539c70ba6fcead8e78eebbf1115e8b589e7565830d7d006a8723f19ac8a0afb7 \ - --hash=sha256:7c67fd69174877359ed9371ec3af8a3d2b04741818c51e5e99cc1742251fa93c +pytest==8.4.0 \ + --hash=sha256:14d920b48472ea0dbf68e45b96cd1ffda4705f33307dcc86c676c1b5104838a6 \ + --hash=sha256:f40f825768ad76c0977cbacdf1fd37c6f7a468e460ea6a0636078f8972d4517e # via -r requirements-actions.in python-can==4.5.0 \ --hash=sha256:1eec66833c1ac76a7e3d636ee0f8b4ba2752e892bab1c56ce74308b2216b5445 \ @@ -1223,24 +1229,32 @@ tomli==2.2.1 \ --hash=sha256:e85e99945e688e32d5a35c1ff38ed0b3f41f43fad8df0bdf79f72b2ba7bc5272 \ --hash=sha256:ece47d672db52ac607a3d9599a9d48dcb2f2f735c6c2d1f34130085bb12b112a \ --hash=sha256:f4039b9cbc3048b2416cc57ab3bda989a6fcf9b36cf8937f01a6e731b64f80d7 - # via -r requirements-actions.in + # via + # -r requirements-actions.in + # mypy + # pylint + # pyproject-api + # pytest + # tox tomlkit==0.13.3 \ --hash=sha256:430cf247ee57df2b94ee3fbe588e71d362a941ebb545dec29b53961d61add2a1 \ --hash=sha256:c89c649d79ee40629a9fda55f8ace8c6a1b42deb912b2a8fd8d942ddadb606b0 # via pylint -tox==4.27.0 \ - --hash=sha256:2b8a7fb986b82aa2c830c0615082a490d134e0626dbc9189986da46a313c4f20 \ - --hash=sha256:b97d5ecc0c0d5755bcc5348387fef793e1bfa68eb33746412f4c60881d7f5f57 +tox==4.26.0 \ + --hash=sha256:75f17aaf09face9b97bd41645028d9f722301e912be8b4c65a3f938024560224 \ + --hash=sha256:a83b3b67b0159fa58e44e646505079e35a43317a62d2ae94725e0586266faeca # via -r requirements-actions.in typing-extensions==4.14.0 \ --hash=sha256:8676b788e32f02ab42d9e7c61324048ae4c6d844a399eebace3d4979d75ceef4 \ --hash=sha256:a1514509136dd0b477638fc68d6a91497af5076466ad0fa6c338e44e359944af # via + # astroid # elasticsearch # exceptiongroup # mypy # pygithub # python-can + # tox unidiff==0.7.5 \ --hash=sha256:2e5f0162052248946b9f0970a40e9e124236bf86c82b70821143a6fc1dea2574 \ --hash=sha256:c93bf2265cc1ba2a520e415ab05da587370bc2a3ae9e0414329f54f0c2fc09e8 @@ -1249,9 +1263,9 @@ uritools==5.0.0 \ --hash=sha256:68180cad154062bd5b5d9ffcdd464f8de6934414b25462ae807b00b8df9345de \ --hash=sha256:cead3a49ba8fbca3f91857343849d506d8639718f4a2e51b62e87393b493bd6f # via spdx-tools -urllib3==2.5.0 \ - --hash=sha256:3fc47733c7e419d4bc3f6b3dc2b4f890bb743906a30d56ba4a5bfa4bbff92760 \ - --hash=sha256:e6b01673c0fa6a13e374b50871808eb3bf7046c4b125b216f6bf1cc604cff0dc +urllib3==2.4.0 \ + --hash=sha256:414bc6535b787febd7567804cc015fee39daab8ad86268f1310a9250697de466 \ + --hash=sha256:4e16665048960a0900c702d4a66415956a584919c03361cac9f1df5c5dd7e813 # via # botocore # elastic-transport @@ -1352,9 +1366,9 @@ wrapt==1.17.2 \ # via # deprecated # python-can -xlsxwriter==3.2.5 \ - --hash=sha256:4f4824234e1eaf9d95df9a8fe974585ff91d0f5e3d3f12ace5b71e443c1c6abd \ - --hash=sha256:7e88469d607cdc920151c0ab3ce9cf1a83992d4b7bc730c5ffdd1a12115a7dbe +xlsxwriter==3.2.3 \ + --hash=sha256:593f8296e8a91790c6d0378ab08b064f34a642b3feb787cf6738236bd0a4860d \ + --hash=sha256:ad6fd41bdcf1b885876b1f6b7087560aecc9ae5a9cc2ba97dcac7ab2e210d3d5 # via -r requirements-actions.in xmltodict==0.14.2 \ --hash=sha256:201e7c28bb210e374999d1dde6382923ab0ed1a8a5faeece48ab525b7810a553 \ From 552f616db82fc4b6b8106a32d752eea8423cd29a Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:27 +0300 Subject: [PATCH 0854/2141] Revert "[nrf fromtree] tests: cmake: actually test SBOM files generation" This reverts commit dea8f87f84b3e1704bcb06c8abd114bde965093a. Signed-off-by: Jukka Rissanen --- scripts/requirements-actions.in | 1 - scripts/requirements-actions.txt | 392 ++++++++---------- scripts/requirements-run-test.txt | 3 - .../software_bill_of_materials/CMakeLists.txt | 33 +- .../software_bill_of_materials/testcase.yaml | 4 +- 5 files changed, 178 insertions(+), 255 deletions(-) diff --git a/scripts/requirements-actions.in b/scripts/requirements-actions.in index 0fb1eca5ad81..2094546f423a 100644 --- a/scripts/requirements-actions.in +++ b/scripts/requirements-actions.in @@ -30,7 +30,6 @@ python-magic; sys_platform != "win32" pyyaml ruff==0.11.11 setuptools>=70.2.0 -spdx-tools sphinx-lint tabulate tomli>=1.1.0 diff --git a/scripts/requirements-actions.txt b/scripts/requirements-actions.txt index 621d8dbc4aec..065d59923991 100644 --- a/scripts/requirements-actions.txt +++ b/scripts/requirements-actions.txt @@ -12,35 +12,27 @@ astroid==3.3.10 \ --hash=sha256:104fb9cb9b27ea95e847a94c003be03a9e039334a8ebca5ee27dafaf5c5711eb \ --hash=sha256:c332157953060c6deb9caa57303ae0d20b0fbdb2e59b4a4f2a6ba49d0a7961ce # via pylint -awscli==1.40.36 \ - --hash=sha256:4a548d855cafad153e661defab601363ba8a5644873bf9f8dec31d5c0ebbb351 \ - --hash=sha256:960d92bf8b2f7efd142112f277eed7cc82d8af85fceefe4d321a620352b75ebd +awscli==1.40.27 \ + --hash=sha256:92c84a3e9cbe3a7566bc738ad21201d9dad32dd7ab6a7a4906f7e1b29b9385ca \ + --hash=sha256:d1e1047cccd675b48ab215b4012c91673de73ba498f503fd6eda3de1a24995d7 # via -r requirements-actions.in -beartype==0.21.0 \ - --hash=sha256:b6a1bd56c72f31b0a496a36cc55df6e2f475db166ad07fa4acc7e74f4c7f34c0 \ - --hash=sha256:f9a5078f5ce87261c2d22851d19b050b64f6a805439e8793aecf01ce660d3244 - # via spdx-tools -boolean-py==5.0 \ - --hash=sha256:60cbc4bad079753721d32649545505362c754e121570ada4658b852a3a318d95 \ - --hash=sha256:ef28a70bd43115208441b53a045d1549e2f0ec6e3d08a9d142cbc41c1938e8d9 - # via license-expression -botocore==1.38.37 \ - --hash=sha256:06ce46da5420ea7cf542ece4ff1ec9045922fef977adf4bbec618c96c7a478bf \ - --hash=sha256:f8ad063b7dcdbf12f2c1b5a4405f390ce52beff3b2861af2e5169816ee0146f2 +botocore==1.38.28 \ + --hash=sha256:515e1a535a27f17e1381aec1fb48eaa2c2308258c4db0bfd09e4f1cd1f239c44 \ + --hash=sha256:63d5977a10a375c3fc11c8e15e1ae5a4daaf450af135d55c170cc537648edf25 # via # awscli # s3transfer -cachetools==6.1.0 \ - --hash=sha256:1c7bb3cf9193deaf3508b7c5f2a79986c13ea38965c5adcff1f84519cf39163e \ - --hash=sha256:b4c4f404392848db3ce7aac34950d17be4d864da4b8b66911008e430bc544587 +cachetools==6.0.0 \ + --hash=sha256:82e73ba88f7b30228b5507dce1a1f878498fc669d972aef2dde4f3a3c24f103e \ + --hash=sha256:f225782b84438f828328fc2ad74346522f27e5b1440f4e9fd18b20ebfd1aa2cf # via tox canopen==2.3.0 \ --hash=sha256:792084a93c138d5b2a406ddd2d4eb5ce208f03bd8fda60f81ad2bb8d56c6b827 \ --hash=sha256:7a62274af6ded7ee85ee96f4ada3afa38bc8607a91f306dcc202c3c8cf2850d7 # via -r requirements-actions.in -certifi==2025.6.15 \ - --hash=sha256:2e0c7ce7cb5d8f8634ca55d2ba7e6ec2689a2fd6537d8dec1296a477a4910057 \ - --hash=sha256:d747aa5a8b9bbbb1bb8c22bb13e22bd1f18e9796defa16bab421f7f7a317323b +certifi==2025.4.26 \ + --hash=sha256:0a816057ea3cdefcef70270d2c515e4506bbc954f417fa5ade2021213bb8f0c6 \ + --hash=sha256:30350364dfe371162649852c63336a15c70c6510c2ad5015b21c2345311805f3 # via # elastic-transport # requests @@ -213,30 +205,28 @@ charset-normalizer==3.4.2 \ --hash=sha256:fcbe676a55d7445b22c10967bceaaf0ee69407fbe0ece4d032b6eb8d4565982a \ --hash=sha256:fdb20a30fe1175ecabed17cbf7812f7b804b8a315a25f24678bcdf120a90077f # via requests -clang-format==20.1.6 \ - --hash=sha256:0ea008a20951527d35a1e2b8febdca3c47c6f8e9a1bd174601c891e20053ef2e \ - --hash=sha256:11530ff352c64176ba4297ad398452d9fcd442b4a8bb2a804cc7915bc94b96e1 \ - --hash=sha256:12626f058755198b92b26076312cc1052f8dd7868bd6cf61b65d2911154ef6df \ - --hash=sha256:15dbc113b4d2f1eb545adb9b815b96c2d64aff947de9453802e47ef1c5267996 \ - --hash=sha256:2ea00197fe650f29b77dd870cd87891e15d9d2dac75c4e9072f4eee99a928dcb \ - --hash=sha256:5351f353062bb0df9c31b4e84c8a9d6b472f9f0727ebd5ab1f96fd3e792756fa \ - --hash=sha256:58b3ef54bc32304990f1890cc982607f69359e46b0e98350718125bea24566de \ - --hash=sha256:779153a039c8552438dd9a3925f5dad20d8b5a812329703f98cd5da7bb91556c \ - --hash=sha256:8ce12618431d8955026c30a2d19a3ae9ddc6d918ad24a4e00a10f8f130454469 \ - --hash=sha256:8ce920b103447d21ff44d41a7ad412794bde1b737426a126c8ab141f00bbfba8 \ - --hash=sha256:bfc4a9922ee1f7c0ec5a8250cb72e755a1ddc73e5d50866efe00561be6fc69eb \ - --hash=sha256:c93c8b7feed66521349918f741b40ef6eaf85dfa1b5eb1303a49ed4608fd882a \ - --hash=sha256:ce8f5bbacba3f05adc2cd64a1780e36c81b54a2caa0b4c618c611b2b45124930 \ - --hash=sha256:d1d64ccfb14dcd93cd98321191e9fbaef049774d050f0c084b7aede41e79fee2 \ - --hash=sha256:d84fffa03432c400bb560f3c8181c2dfa6be05b9b866f7d0180dfb41e0f91907 \ - --hash=sha256:e1e59c3a23d033df261ce8048c96f0493285cff1b65d3f519b77a47854653d27 +clang-format==20.1.5 \ + --hash=sha256:16c99e744009822d8574b163d679d3a13c81d26beb8512e55a74651b8972f64d \ + --hash=sha256:269d0a12cf6177f2bb806f73130189efac311bd2d24bd5ab8e12f9486b31f591 \ + --hash=sha256:4412731a18ed0749b8357c41bbe277baed514b117345f1f8e3dbc61bf7b6d78e \ + --hash=sha256:45e23bceb0ec646acd14a6274ea92ddc6d959bed4a8c1c338346e4da403b1c96 \ + --hash=sha256:5af73b84c98461bdab8f0b6c1bc49a7935a3362c3183315421607805a0b3e03b \ + --hash=sha256:626e29e1014e044166d856ef439955622e5e6ba50662fe4b4142f41ecebafefe \ + --hash=sha256:6f0d7e54f25374c7849ec639f2e666b35c18bfe76cdacb7e3fdfc92647c99387 \ + --hash=sha256:7abe250990f6eaf89a201cf89f296c18bdb2c135dd44b949a6007ffd31c4522c \ + --hash=sha256:8e0b8e8bdf513f8ac27b82ec940440d836177836d5bc30d1002632e7f4308aab \ + --hash=sha256:9d2b233edaa1323ea9e736f598ba6a845ecb5fa3d21fe88dbb5be12974b8cc78 \ + --hash=sha256:9f82d954ed96cb01a5b6fdcbd87339837b2a310ce65dcd89c88821b6207b6e00 \ + --hash=sha256:c9dbc67e23bafa578367b815425573697a7e3d342e5aed17ae02cb0108007e74 \ + --hash=sha256:cffbcc410ef535a60ab918699ac38d22fa231059cba2bc6c1226a5de69af2c38 \ + --hash=sha256:dba394d7fb285d1adb48a9a46f7241afd2bd8569d63efc76ffe3c381f72c3c7e \ + --hash=sha256:e389a7aa1e99988764060e8fd06b71517dd5d86e3d5285cb9f8eefb1823b4233 \ + --hash=sha256:ee886b41fd7a671a38d207af05006a187b7fc0f5e2463d66fce8c8b4f4cd30c7 # via -r requirements-actions.in click==8.1.3 \ --hash=sha256:7682dc8afb30297001674575ea00d1814d808d6a36af415a82bd481d37ba7b8e \ --hash=sha256:bb4d8133cb15a609f44e8213d9b391b0809795062913b383c62be0ee95b1db48 - # via - # gitlint-core - # spdx-tools + # via gitlint-core colorama==0.4.6 \ --hash=sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44 \ --hash=sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6 @@ -247,44 +237,44 @@ colorama==0.4.6 \ # pytest # tox # west -cryptography==45.0.4 \ - --hash=sha256:0339a692de47084969500ee455e42c58e449461e0ec845a34a6a9b9bf7df7fb8 \ - --hash=sha256:03dbff8411206713185b8cebe31bc5c0eb544799a50c09035733716b386e61a4 \ - --hash=sha256:06509dc70dd71fa56eaa138336244e2fbaf2ac164fc9b5e66828fccfd2b680d6 \ - --hash=sha256:0cf13c77d710131d33e63626bd55ae7c0efb701ebdc2b3a7952b9b23a0412862 \ - --hash=sha256:23b9c3ea30c3ed4db59e7b9619272e94891f8a3a5591d0b656a7582631ccf750 \ - --hash=sha256:25eb4d4d3e54595dc8adebc6bbd5623588991d86591a78c2548ffb64797341e2 \ - --hash=sha256:2882338b2a6e0bd337052e8b9007ced85c637da19ef9ecaf437744495c8c2999 \ - --hash=sha256:3530382a43a0e524bc931f187fc69ef4c42828cf7d7f592f7f249f602b5a4ab0 \ - --hash=sha256:425a9a6ac2823ee6e46a76a21a4e8342d8fa5c01e08b823c1f19a8b74f096069 \ - --hash=sha256:46cf7088bf91bdc9b26f9c55636492c1cce3e7aaf8041bbf0243f5e5325cfb2d \ - --hash=sha256:4828190fb6c4bcb6ebc6331f01fe66ae838bb3bd58e753b59d4b22eb444b996c \ - --hash=sha256:49fe9155ab32721b9122975e168a6760d8ce4cffe423bcd7ca269ba41b5dfac1 \ - --hash=sha256:4ca0f52170e821bc8da6fc0cc565b7bb8ff8d90d36b5e9fdd68e8a86bdf72036 \ - --hash=sha256:51dfbd4d26172d31150d84c19bbe06c68ea4b7f11bbc7b3a5e146b367c311349 \ - --hash=sha256:5f31e6b0a5a253f6aa49be67279be4a7e5a4ef259a9f33c69f7d1b1191939872 \ - --hash=sha256:627ba1bc94f6adf0b0a2e35d87020285ead22d9f648c7e75bb64f367375f3b22 \ - --hash=sha256:680806cf63baa0039b920f4976f5f31b10e772de42f16310a6839d9f21a26b0d \ - --hash=sha256:6a3511ae33f09094185d111160fd192c67aa0a2a8d19b54d36e4c78f651dc5ad \ - --hash=sha256:6a5bf57554e80f75a7db3d4b1dacaa2764611ae166ab42ea9a72bcdb5d577637 \ - --hash=sha256:6b613164cb8425e2f8db5849ffb84892e523bf6d26deb8f9bb76ae86181fa12b \ - --hash=sha256:7405ade85c83c37682c8fe65554759800a4a8c54b2d96e0f8ad114d31b808d57 \ - --hash=sha256:7aad98a25ed8ac917fdd8a9c1e706e5a0956e06c498be1f713b61734333a4507 \ - --hash=sha256:7bedbe4cc930fa4b100fc845ea1ea5788fcd7ae9562e669989c11618ae8d76ee \ - --hash=sha256:7ef2dde4fa9408475038fc9aadfc1fb2676b174e68356359632e980c661ec8f6 \ - --hash=sha256:817ee05c6c9f7a69a16200f0c90ab26d23a87701e2a284bd15156783e46dbcc8 \ - --hash=sha256:944e9ccf67a9594137f942d5b52c8d238b1b4e46c7a0c2891b7ae6e01e7c80a4 \ - --hash=sha256:964bcc28d867e0f5491a564b7debb3ffdd8717928d315d12e0d7defa9e43b723 \ - --hash=sha256:96d4819e25bf3b685199b304a0029ce4a3caf98947ce8a066c9137cc78ad2c58 \ - --hash=sha256:a77c6fb8d76e9c9f99f2f3437c1a4ac287b34eaf40997cfab1e9bd2be175ac39 \ - --hash=sha256:b0a97c927497e3bc36b33987abb99bf17a9a175a19af38a892dc4bbb844d7ee2 \ - --hash=sha256:b97737a3ffbea79eebb062eb0d67d72307195035332501722a9ca86bab9e3ab2 \ - --hash=sha256:bbc505d1dc469ac12a0a064214879eac6294038d6b24ae9f71faae1448a9608d \ - --hash=sha256:c22fe01e53dc65edd1945a2e6f0015e887f84ced233acecb64b4daadb32f5c97 \ - --hash=sha256:ce1678a2ccbe696cf3af15a75bb72ee008d7ff183c9228592ede9db467e64f1b \ - --hash=sha256:e00a6c10a5c53979d6242f123c0a97cff9f3abed7f064fc412c36dc521b5f257 \ - --hash=sha256:eaa3e28ea2235b33220b949c5a0d6cf79baa80eab2eb5607ca8ab7525331b9ff \ - --hash=sha256:f3fe7a5ae34d5a414957cc7f457e2b92076e72938423ac64d215722f6cf49a9e +cryptography==45.0.3 \ + --hash=sha256:00094838ecc7c6594171e8c8a9166124c1197b074cfca23645cee573910d76bc \ + --hash=sha256:050ce5209d5072472971e6efbfc8ec5a8f9a841de5a4db0ebd9c2e392cb81972 \ + --hash=sha256:232954730c362638544758a8160c4ee1b832dc011d2c41a306ad8f7cccc5bb0b \ + --hash=sha256:25286aacb947286620a31f78f2ed1a32cded7be5d8b729ba3fb2c988457639e4 \ + --hash=sha256:2f8f8f0b73b885ddd7f3d8c2b2234a7d3ba49002b0223f58cfde1bedd9563c56 \ + --hash=sha256:38deed72285c7ed699864f964a3f4cf11ab3fb38e8d39cfcd96710cd2b5bb716 \ + --hash=sha256:3ad69eeb92a9de9421e1f6685e85a10fbcfb75c833b42cc9bc2ba9fb00da4710 \ + --hash=sha256:5555365a50efe1f486eed6ac7062c33b97ccef409f5970a0b6f205a7cfab59c8 \ + --hash=sha256:555e5e2d3a53b4fabeca32835878b2818b3f23966a4efb0d566689777c5a12c8 \ + --hash=sha256:57a6500d459e8035e813bd8b51b671977fb149a8c95ed814989da682314d0782 \ + --hash=sha256:5833bb4355cb377ebd880457663a972cd044e7f49585aee39245c0d592904578 \ + --hash=sha256:71320fbefd05454ef2d457c481ba9a5b0e540f3753354fff6f780927c25d19b0 \ + --hash=sha256:7573d9eebaeceeb55285205dbbb8753ac1e962af3d9640791d12b36864065e71 \ + --hash=sha256:92d5f428c1a0439b2040435a1d6bc1b26ebf0af88b093c3628913dd464d13fa1 \ + --hash=sha256:97787952246a77d77934d41b62fb1b6f3581d83f71b44796a4158d93b8f5c490 \ + --hash=sha256:9bb5bf55dcb69f7067d80354d0a348368da907345a2c448b0babc4215ccd3497 \ + --hash=sha256:9cc80ce69032ffa528b5e16d217fa4d8d4bb7d6ba8659c1b4d74a1b0f4235fca \ + --hash=sha256:9e4253ed8f5948a3589b3caee7ad9a5bf218ffd16869c516535325fece163dcc \ + --hash=sha256:9eda14f049d7f09c2e8fb411dda17dd6b16a3c76a1de5e249188a32aeb92de19 \ + --hash=sha256:a2b56de3417fd5f48773ad8e91abaa700b678dc7fe1e0c757e1ae340779acf7b \ + --hash=sha256:af3f92b1dc25621f5fad065288a44ac790c5798e986a34d393ab27d2b27fcff9 \ + --hash=sha256:c5edcb90da1843df85292ef3a313513766a78fbbb83f584a5a58fb001a5a9d57 \ + --hash=sha256:c824c9281cb628015bfc3c59335163d4ca0540d49de4582d6c2637312907e4b1 \ + --hash=sha256:c92519d242703b675ccefd0f0562eb45e74d438e001f8ab52d628e885751fb06 \ + --hash=sha256:ca932e11218bcc9ef812aa497cdf669484870ecbcf2d99b765d6c27a86000942 \ + --hash=sha256:cb6ab89421bc90e0422aca911c69044c2912fc3debb19bb3c1bfe28ee3dff6ab \ + --hash=sha256:cfd84777b4b6684955ce86156cfb5e08d75e80dc2585e10d69e47f014f0a5342 \ + --hash=sha256:d377dde61c5d67eb4311eace661c3efda46c62113ff56bf05e2d679e02aebb5b \ + --hash=sha256:d54ae41e6bd70ea23707843021c778f151ca258081586f0cfa31d936ae43d1b2 \ + --hash=sha256:dc10ec1e9f21f33420cc05214989544727e776286c1c16697178978327b95c9c \ + --hash=sha256:ec21313dd335c51d7877baf2972569f40a4291b76a0ce51391523ae358d05899 \ + --hash=sha256:ec64ee375b5aaa354b2b273c921144a660a511f9df8785e6d1c942967106438e \ + --hash=sha256:ed43d396f42028c1f47b5fec012e9e12631266e3825e95c00e3cf94d472dac49 \ + --hash=sha256:edd6d51869beb7f0d472e902ef231a9b7689508e83880ea16ca3311a00bf5ce7 \ + --hash=sha256:f22af3c78abfbc7cbcdf2c55d23c3e022e1a462ee2481011d518c7fb9c9f3d65 \ + --hash=sha256:fae1e637f527750811588e4582988932c222f8251f7b7ea93739acb624e1487f \ + --hash=sha256:fed5aaca1750e46db870874c9c273cd5182a9e9deb16f06f7bdffdb5c2bde4b9 # via pyjwt deprecated==1.2.18 \ --hash=sha256:422b6f6d859da6f2ef57857761bfb392480502a64c3028ca9bbe86085d72115d \ @@ -444,10 +434,6 @@ intelhex==2.3.0 \ --hash=sha256:87cc5225657524ec6361354be928adfd56bcf2a3dcc646c40f8f094c39c07db4 \ --hash=sha256:892b7361a719f4945237da8ccf754e9513db32f5628852785aea108dcd250093 # via -r requirements-actions.in -isodate==0.7.2 ; python_full_version < '3.11' \ - --hash=sha256:28009937d8031054830160fce6d409ed342816b543597cece116d966c6d99e15 \ - --hash=sha256:4cd1aa0f43ca76f4a6c6c0292a85f40b35ec2e43e315b59f06e6d32171a953e6 - # via rdflib isort==6.0.1 \ --hash=sha256:1cb5df28dfbc742e490c5e41bad6da41b805b0a8be7bc93cd0fb2a8a890ac450 \ --hash=sha256:2dc5d7f65c9678d94c88dfc29161a320eec67328bc97aad576874cb4be1e9615 @@ -469,10 +455,6 @@ junitparser==3.2.0 \ --hash=sha256:b05e89c27e7b74b3c563a078d6e055d95cf397444f8f689b0ca616ebda0b3c65 \ --hash=sha256:e14fdc0a999edfc15889b637390e8ef6ca09a49532416d3bd562857d42d4b96d # via -r requirements-actions.in -license-expression==30.4.1 \ - --hash=sha256:679646bc3261a17690494a3e1cada446e5ee342dbd87dcfa4a0c24cc5dce13ee \ - --hash=sha256:9f02105f9e0fcecba6a85dfbbed7d94ea1c3a70cf23ddbfb5adf3438a6f6fce0 - # via spdx-tools lxml==5.4.0 \ --hash=sha256:00b8686694423ddae324cf614e1b9659c2edb754de617703c3d29ff568448df5 \ --hash=sha256:073eb6dcdf1f587d9b88c8c93528b57eccda40209cf9be549d469b942b41d70b \ @@ -680,100 +662,105 @@ mock==5.2.0 \ --hash=sha256:4e460e818629b4b173f32d08bf30d3af8123afbb8e04bb5707a1fd4799e503f0 \ --hash=sha256:7ba87f72ca0e915175596069dbbcc7c75af7b5e9b9bc107ad6349ede0819982f # via -r requirements-actions.in -msgpack==1.1.1 ; sys_platform != 'win32' \ - --hash=sha256:196a736f0526a03653d829d7d4c5500a97eea3648aebfd4b6743875f28aa2af8 \ - --hash=sha256:1abfc6e949b352dadf4bce0eb78023212ec5ac42f6abfd469ce91d783c149c2a \ - --hash=sha256:1b13fe0fb4aac1aa5320cd693b297fe6fdef0e7bea5518cbc2dd5299f873ae90 \ - --hash=sha256:1d75f3807a9900a7d575d8d6674a3a47e9f227e8716256f35bc6f03fc597ffbf \ - --hash=sha256:2fbbc0b906a24038c9958a1ba7ae0918ad35b06cb449d398b76a7d08470b0ed9 \ - --hash=sha256:33be9ab121df9b6b461ff91baac6f2731f83d9b27ed948c5b9d1978ae28bf157 \ - --hash=sha256:353b6fc0c36fde68b661a12949d7d49f8f51ff5fa019c1e47c87c4ff34b080ed \ - --hash=sha256:36043272c6aede309d29d56851f8841ba907a1a3d04435e43e8a19928e243c1d \ - --hash=sha256:3765afa6bd4832fc11c3749be4ba4b69a0e8d7b728f78e68120a157a4c5d41f0 \ - --hash=sha256:3a89cd8c087ea67e64844287ea52888239cbd2940884eafd2dcd25754fb72232 \ - --hash=sha256:40eae974c873b2992fd36424a5d9407f93e97656d999f43fca9d29f820899084 \ - --hash=sha256:4147151acabb9caed4e474c3344181e91ff7a388b888f1e19ea04f7e73dc7ad5 \ - --hash=sha256:435807eeb1bc791ceb3247d13c79868deb22184e1fc4224808750f0d7d1affc1 \ - --hash=sha256:4835d17af722609a45e16037bb1d4d78b7bdf19d6c0128116d178956618c4e88 \ - --hash=sha256:4a28e8072ae9779f20427af07f53bbb8b4aa81151054e882aee333b158da8752 \ - --hash=sha256:4d3237b224b930d58e9d83c81c0dba7aacc20fcc2f89c1e5423aa0529a4cd142 \ - --hash=sha256:4df2311b0ce24f06ba253fda361f938dfecd7b961576f9be3f3fbd60e87130ac \ - --hash=sha256:4fd6b577e4541676e0cc9ddc1709d25014d3ad9a66caa19962c4f5de30fc09ef \ - --hash=sha256:500e85823a27d6d9bba1d057c871b4210c1dd6fb01fbb764e37e4e8847376323 \ - --hash=sha256:5692095123007180dca3e788bb4c399cc26626da51629a31d40207cb262e67f4 \ - --hash=sha256:5fd1b58e1431008a57247d6e7cc4faa41c3607e8e7d4aaf81f7c29ea013cb458 \ - --hash=sha256:61abccf9de335d9efd149e2fff97ed5974f2481b3353772e8e2dd3402ba2bd57 \ - --hash=sha256:61e35a55a546a1690d9d09effaa436c25ae6130573b6ee9829c37ef0f18d5e78 \ - --hash=sha256:6640fd979ca9a212e4bcdf6eb74051ade2c690b862b679bfcb60ae46e6dc4bfd \ - --hash=sha256:6d489fba546295983abd142812bda76b57e33d0b9f5d5b71c09a583285506f69 \ - --hash=sha256:6f64ae8fe7ffba251fecb8408540c34ee9df1c26674c50c4544d72dbf792e5ce \ - --hash=sha256:71ef05c1726884e44f8b1d1773604ab5d4d17729d8491403a705e649116c9558 \ - --hash=sha256:77b79ce34a2bdab2594f490c8e80dd62a02d650b91a75159a63ec413b8d104cd \ - --hash=sha256:78426096939c2c7482bf31ef15ca219a9e24460289c00dd0b94411040bb73ad2 \ - --hash=sha256:79c408fcf76a958491b4e3b103d1c417044544b68e96d06432a189b43d1215c8 \ - --hash=sha256:7a17ac1ea6ec3c7687d70201cfda3b1e8061466f28f686c24f627cae4ea8efd0 \ - --hash=sha256:7da8831f9a0fdb526621ba09a281fadc58ea12701bc709e7b8cbc362feabc295 \ - --hash=sha256:870b9a626280c86cff9c576ec0d9cbcc54a1e5ebda9cd26dab12baf41fee218c \ - --hash=sha256:88d1e966c9235c1d4e2afac21ca83933ba59537e2e2727a999bf3f515ca2af26 \ - --hash=sha256:88daaf7d146e48ec71212ce21109b66e06a98e5e44dca47d853cbfe171d6c8d2 \ - --hash=sha256:8a8b10fdb84a43e50d38057b06901ec9da52baac6983d3f709d8507f3889d43f \ - --hash=sha256:8b17ba27727a36cb73aabacaa44b13090feb88a01d012c0f4be70c00f75048b4 \ - --hash=sha256:8b65b53204fe1bd037c40c4148d00ef918eb2108d24c9aaa20bc31f9810ce0a8 \ - --hash=sha256:8ddb2bcfd1a8b9e431c8d6f4f7db0773084e107730ecf3472f1dfe9ad583f3d9 \ - --hash=sha256:96decdfc4adcbc087f5ea7ebdcfd3dee9a13358cae6e81d54be962efc38f6338 \ - --hash=sha256:996f2609ddf0142daba4cefd767d6db26958aac8439ee41db9cc0db9f4c4c3a6 \ - --hash=sha256:9d592d06e3cc2f537ceeeb23d38799c6ad83255289bb84c2e5792e5a8dea268a \ - --hash=sha256:a32747b1b39c3ac27d0670122b57e6e57f28eefb725e0b625618d1b59bf9d1e0 \ - --hash=sha256:a494554874691720ba5891c9b0b39474ba43ffb1aaf32a5dac874effb1619e1a \ - --hash=sha256:a8ef6e342c137888ebbfb233e02b8fbd689bb5b5fcc59b34711ac47ebd504478 \ - --hash=sha256:ae497b11f4c21558d95de9f64fff7053544f4d1a17731c866143ed6bb4591238 \ - --hash=sha256:b1ce7f41670c5a69e1389420436f41385b1aa2504c3b0c30620764b15dded2e7 \ - --hash=sha256:b8f93dcddb243159c9e4109c9750ba5b335ab8d48d9522c5308cd05d7e3ce600 \ - --hash=sha256:ba0c325c3f485dc54ec298d8b024e134acf07c10d494ffa24373bea729acf704 \ - --hash=sha256:bb29aaa613c0a1c40d1af111abf025f1732cab333f96f285d6a93b934738a68a \ - --hash=sha256:bba1be28247e68994355e028dcd668316db30c1f758d3241a7b903ac78dcd285 \ - --hash=sha256:cb643284ab0ed26f6957d969fe0dd8bb17beb567beb8998140b5e38a90974f6c \ - --hash=sha256:d182dac0221eb8faef2e6f44701812b467c02674a322c739355c39e94730cdbf \ - --hash=sha256:d275a9e3c81b1093c060c3837e580c37f47c51eca031f7b5fb76f7b8470f5f9b \ - --hash=sha256:d8b55ea20dc59b181d3f47103f113e6f28a5e1c89fd5b67b9140edb442ab67f2 \ - --hash=sha256:da8f41e602574ece93dbbda1fab24650d6bf2a24089f9e9dbb4f5730ec1e58ad \ - --hash=sha256:e4141c5a32b5e37905b5940aacbc59739f036930367d7acce7a64e4dec1f5e0b \ - --hash=sha256:f5be6b6bc52fad84d010cb45433720327ce886009d862f46b26d4d154001994b \ - --hash=sha256:f6d58656842e1b2ddbe07f43f56b10a60f2ba5826164910968f5933e5178af75 +msgpack==1.1.0 ; sys_platform != 'win32' \ + --hash=sha256:06f5fd2f6bb2a7914922d935d3b8bb4a7fff3a9a91cfce6d06c13bc42bec975b \ + --hash=sha256:071603e2f0771c45ad9bc65719291c568d4edf120b44eb36324dcb02a13bfddf \ + --hash=sha256:0907e1a7119b337971a689153665764adc34e89175f9a34793307d9def08e6ca \ + --hash=sha256:0f92a83b84e7c0749e3f12821949d79485971f087604178026085f60ce109330 \ + --hash=sha256:115a7af8ee9e8cddc10f87636767857e7e3717b7a2e97379dc2054712693e90f \ + --hash=sha256:13599f8829cfbe0158f6456374e9eea9f44eee08076291771d8ae93eda56607f \ + --hash=sha256:17fb65dd0bec285907f68b15734a993ad3fc94332b5bb21b0435846228de1f39 \ + --hash=sha256:2137773500afa5494a61b1208619e3871f75f27b03bcfca7b3a7023284140247 \ + --hash=sha256:3180065ec2abbe13a4ad37688b61b99d7f9e012a535b930e0e683ad6bc30155b \ + --hash=sha256:398b713459fea610861c8a7b62a6fec1882759f308ae0795b5413ff6a160cf3c \ + --hash=sha256:3d364a55082fb2a7416f6c63ae383fbd903adb5a6cf78c5b96cc6316dc1cedc7 \ + --hash=sha256:3df7e6b05571b3814361e8464f9304c42d2196808e0119f55d0d3e62cd5ea044 \ + --hash=sha256:41c991beebf175faf352fb940bf2af9ad1fb77fd25f38d9142053914947cdbf6 \ + --hash=sha256:42f754515e0f683f9c79210a5d1cad631ec3d06cea5172214d2176a42e67e19b \ + --hash=sha256:452aff037287acb1d70a804ffd022b21fa2bb7c46bee884dbc864cc9024128a0 \ + --hash=sha256:4676e5be1b472909b2ee6356ff425ebedf5142427842aa06b4dfd5117d1ca8a2 \ + --hash=sha256:46c34e99110762a76e3911fc923222472c9d681f1094096ac4102c18319e6468 \ + --hash=sha256:471e27a5787a2e3f974ba023f9e265a8c7cfd373632247deb225617e3100a3c7 \ + --hash=sha256:4a1964df7b81285d00a84da4e70cb1383f2e665e0f1f2a7027e683956d04b734 \ + --hash=sha256:4b51405e36e075193bc051315dbf29168d6141ae2500ba8cd80a522964e31434 \ + --hash=sha256:4d1b7ff2d6146e16e8bd665ac726a89c74163ef8cd39fa8c1087d4e52d3a2325 \ + --hash=sha256:53258eeb7a80fc46f62fd59c876957a2d0e15e6449a9e71842b6d24419d88ca1 \ + --hash=sha256:534480ee5690ab3cbed89d4c8971a5c631b69a8c0883ecfea96c19118510c846 \ + --hash=sha256:58638690ebd0a06427c5fe1a227bb6b8b9fdc2bd07701bec13c2335c82131a88 \ + --hash=sha256:58dfc47f8b102da61e8949708b3eafc3504509a5728f8b4ddef84bd9e16ad420 \ + --hash=sha256:59caf6a4ed0d164055ccff8fe31eddc0ebc07cf7326a2aaa0dbf7a4001cd823e \ + --hash=sha256:5dbad74103df937e1325cc4bfeaf57713be0b4f15e1c2da43ccdd836393e2ea2 \ + --hash=sha256:5e1da8f11a3dd397f0a32c76165cf0c4eb95b31013a94f6ecc0b280c05c91b59 \ + --hash=sha256:646afc8102935a388ffc3914b336d22d1c2d6209c773f3eb5dd4d6d3b6f8c1cb \ + --hash=sha256:64fc9068d701233effd61b19efb1485587560b66fe57b3e50d29c5d78e7fef68 \ + --hash=sha256:65553c9b6da8166e819a6aa90ad15288599b340f91d18f60b2061f402b9a4915 \ + --hash=sha256:685ec345eefc757a7c8af44a3032734a739f8c45d1b0ac45efc5d8977aa4720f \ + --hash=sha256:6ad622bf7756d5a497d5b6836e7fc3752e2dd6f4c648e24b1803f6048596f701 \ + --hash=sha256:73322a6cc57fcee3c0c57c4463d828e9428275fb85a27aa2aa1a92fdc42afd7b \ + --hash=sha256:74bed8f63f8f14d75eec75cf3d04ad581da6b914001b474a5d3cd3372c8cc27d \ + --hash=sha256:79ec007767b9b56860e0372085f8504db5d06bd6a327a335449508bbee9648fa \ + --hash=sha256:7a946a8992941fea80ed4beae6bff74ffd7ee129a90b4dd5cf9c476a30e9708d \ + --hash=sha256:7ad442d527a7e358a469faf43fda45aaf4ac3249c8310a82f0ccff9164e5dccd \ + --hash=sha256:7c9a35ce2c2573bada929e0b7b3576de647b0defbd25f5139dcdaba0ae35a4cc \ + --hash=sha256:7e7b853bbc44fb03fbdba34feb4bd414322180135e2cb5164f20ce1c9795ee48 \ + --hash=sha256:879a7b7b0ad82481c52d3c7eb99bf6f0645dbdec5134a4bddbd16f3506947feb \ + --hash=sha256:8a706d1e74dd3dea05cb54580d9bd8b2880e9264856ce5068027eed09680aa74 \ + --hash=sha256:8a84efb768fb968381e525eeeb3d92857e4985aacc39f3c47ffd00eb4509315b \ + --hash=sha256:8cf9e8c3a2153934a23ac160cc4cba0ec035f6867c8013cc6077a79823370346 \ + --hash=sha256:8da4bf6d54ceed70e8861f833f83ce0814a2b72102e890cbdfe4b34764cdd66e \ + --hash=sha256:8e59bca908d9ca0de3dc8684f21ebf9a690fe47b6be93236eb40b99af28b6ea6 \ + --hash=sha256:914571a2a5b4e7606997e169f64ce53a8b1e06f2cf2c3a7273aa106236d43dd5 \ + --hash=sha256:a51abd48c6d8ac89e0cfd4fe177c61481aca2d5e7ba42044fd218cfd8ea9899f \ + --hash=sha256:a52a1f3a5af7ba1c9ace055b659189f6c669cf3657095b50f9602af3a3ba0fe5 \ + --hash=sha256:ad33e8400e4ec17ba782f7b9cf868977d867ed784a1f5f2ab46e7ba53b6e1e1b \ + --hash=sha256:b4c01941fd2ff87c2a934ee6055bda4ed353a7846b8d4f341c428109e9fcde8c \ + --hash=sha256:bce7d9e614a04d0883af0b3d4d501171fbfca038f12c77fa838d9f198147a23f \ + --hash=sha256:c40ffa9a15d74e05ba1fe2681ea33b9caffd886675412612d93ab17b58ea2fec \ + --hash=sha256:c5a91481a3cc573ac8c0d9aace09345d989dc4a0202b7fcb312c88c26d4e71a8 \ + --hash=sha256:c921af52214dcbb75e6bdf6a661b23c3e6417f00c603dd2070bccb5c3ef499f5 \ + --hash=sha256:d46cf9e3705ea9485687aa4001a76e44748b609d260af21c4ceea7f2212a501d \ + --hash=sha256:d8ce0b22b890be5d252de90d0e0d119f363012027cf256185fc3d474c44b1b9e \ + --hash=sha256:dd432ccc2c72b914e4cb77afce64aab761c1137cc698be3984eee260bcb2896e \ + --hash=sha256:e0856a2b7e8dcb874be44fea031d22e5b3a19121be92a1e098f46068a11b0870 \ + --hash=sha256:e1f3c3d21f7cf67bcf2da8e494d30a75e4cf60041d98b3f79875afb5b96f3a3f \ + --hash=sha256:f1ba6136e650898082d9d5a5217d5906d1e138024f836ff48691784bbe1adf96 \ + --hash=sha256:f3e9b4936df53b970513eac1758f3882c88658a220b58dcc1e39606dccaaf01c \ + --hash=sha256:f80bc7d47f76089633763f952e67f8214cb7b3ee6bfa489b3cb6a84cfac114cd \ + --hash=sha256:fd2906780f25c8ed5d7b323379f6138524ba793428db5d0e9d226d3fa6aa1788 # via python-can -mypy==1.16.1 \ - --hash=sha256:051e1677689c9d9578b9c7f4d206d763f9bbd95723cd1416fad50db49d52f359 \ - --hash=sha256:08e850ea22adc4d8a4014651575567b0318ede51e8e9fe7a68f25391af699507 \ - --hash=sha256:09aa4f91ada245f0a45dbc47e548fd94e0dd5a8433e0114917dc3b526912a30c \ - --hash=sha256:0a7cfb0fe29fe5a9841b7c8ee6dffb52382c45acdf68f032145b75620acfbd6f \ - --hash=sha256:0ab5eca37b50188163fa7c1b73c685ac66c4e9bdee4a85c9adac0e91d8895e15 \ - --hash=sha256:1256688e284632382f8f3b9e2123df7d279f603c561f099758e66dd6ed4e8bd6 \ - --hash=sha256:13c7cd5b1cb2909aa318a90fd1b7e31f17c50b242953e7dd58345b2a814f6383 \ - --hash=sha256:1f0435cf920e287ff68af3d10a118a73f212deb2ce087619eb4e648116d1fe9b \ - --hash=sha256:211287e98e05352a2e1d4e8759c5490925a7c784ddc84207f4714822f8cf99b6 \ - --hash=sha256:22d76a63a42619bfb90122889b903519149879ddbf2ba4251834727944c8baca \ - --hash=sha256:2c7ce0662b6b9dc8f4ed86eb7a5d505ee3298c04b40ec13b30e572c0e5ae17c4 \ - --hash=sha256:352025753ef6a83cb9e7f2427319bb7875d1fdda8439d1e23de12ab164179574 \ - --hash=sha256:44e7acddb3c48bd2713994d098729494117803616e116032af192871aed80b79 \ - --hash=sha256:472e4e4c100062488ec643f6162dd0d5208e33e2f34544e1fc931372e806c0cc \ - --hash=sha256:4f58ac32771341e38a853c5d0ec0dfe27e18e27da9cdb8bbc882d2249c71a3ee \ - --hash=sha256:58e07fb958bc5d752a280da0e890c538f1515b79a65757bbdc54252ba82e0b40 \ - --hash=sha256:5e198ab3f55924c03ead626ff424cad1732d0d391478dfbf7bb97b34602395da \ - --hash=sha256:5fc2ac4027d0ef28d6ba69a0343737a23c4d1b83672bf38d1fe237bdc0643b37 \ - --hash=sha256:66df38405fd8466ce3517eda1f6640611a0b8e70895e2a9462d1d4323c5eb4b9 \ - --hash=sha256:6bd00a0a2094841c5e47e7374bb42b83d64c527a502e3334e1173a0c24437bab \ - --hash=sha256:7fc688329af6a287567f45cc1cefb9db662defeb14625213a5b7da6e692e2069 \ - --hash=sha256:86042bbf9f5a05ea000d3203cf87aa9d0ccf9a01f73f71c58979eb9249f46d72 \ - --hash=sha256:87ff2c13d58bdc4bbe7dc0dedfe622c0f04e2cb2a492269f3b418df2de05c536 \ - --hash=sha256:af4792433f09575d9eeca5c63d7d90ca4aeceda9d8355e136f80f8967639183d \ - --hash=sha256:b4f0fed1022a63c6fec38f28b7fc77fca47fd490445c69d0a66266c59dd0b88a \ - --hash=sha256:d5d2309511cc56c021b4b4e462907c2b12f669b2dbeb68300110ec27723971be \ - --hash=sha256:ddc91eb318c8751c69ddb200a5937f1232ee8efb4e64e9f4bc475a33719de438 \ - --hash=sha256:dedb6229b2c9086247e21a83c309754b9058b438704ad2f6807f0d8227f6ebdd \ - --hash=sha256:ea16e2a7d2714277e349e24d19a782a663a34ed60864006e8585db08f8ad1782 \ - --hash=sha256:ea7469ee5902c95542bea7ee545f7006508c65c8c54b06dc2c92676ce526f3ea \ - --hash=sha256:f895078594d918f93337a505f8add9bd654d1a24962b4c6ed9390e12531eb31b \ - --hash=sha256:ff9fa5b16e4c1364eb89a4d16bcda9987f05d39604e1e6c35378a2987c1aac2d +mypy==1.16.0 \ + --hash=sha256:021a68568082c5b36e977d54e8f1de978baf401a33884ffcea09bd8e88a98f4c \ + --hash=sha256:089bedc02307c2548eb51f426e085546db1fa7dd87fbb7c9fa561575cf6eb1ff \ + --hash=sha256:09a8da6a0ee9a9770b8ff61b39c0bb07971cda90e7297f4213741b48a0cc8d93 \ + --hash=sha256:0b07e107affb9ee6ce1f342c07f51552d126c32cd62955f59a7db94a51ad12c0 \ + --hash=sha256:15486beea80be24ff067d7d0ede673b001d0d684d0095803b3e6e17a886a2a92 \ + --hash=sha256:29e1499864a3888bca5c1542f2d7232c6e586295183320caa95758fc84034031 \ + --hash=sha256:2e7e0ad35275e02797323a5aa1be0b14a4d03ffdb2e5f2b0489fa07b89c67b21 \ + --hash=sha256:4086883a73166631307fdd330c4a9080ce24913d4f4c5ec596c601b3a4bdd777 \ + --hash=sha256:54066fed302d83bf5128632d05b4ec68412e1f03ef2c300434057d66866cea4b \ + --hash=sha256:55f9076c6ce55dd3f8cd0c6fff26a008ca8e5131b89d5ba6d86bd3f47e736eeb \ + --hash=sha256:6a2322896003ba66bbd1318c10d3afdfe24e78ef12ea10e2acd985e9d684a666 \ + --hash=sha256:7909541fef256527e5ee9c0a7e2aeed78b6cda72ba44298d1334fe7881b05c5c \ + --hash=sha256:82d056e6faa508501af333a6af192c700b33e15865bda49611e3d7d8358ebea2 \ + --hash=sha256:84b94283f817e2aa6350a14b4a8fb2a35a53c286f97c9d30f53b63620e7af8ab \ + --hash=sha256:936ccfdd749af4766be824268bfe22d1db9eb2f34a3ea1d00ffbe5b5265f5491 \ + --hash=sha256:9f826aaa7ff8443bac6a494cf743f591488ea940dd360e7dd330e30dd772a5ab \ + --hash=sha256:a5fcfdb7318c6a8dd127b14b1052743b83e97a970f0edb6c913211507a255e20 \ + --hash=sha256:a7e32297a437cc915599e0578fa6bc68ae6a8dc059c9e009c628e1c47f91495d \ + --hash=sha256:a9e056237c89f1587a3be1a3a70a06a698d25e2479b9a2f57325ddaaffc3567b \ + --hash=sha256:afe420c9380ccec31e744e8baff0d406c846683681025db3531b32db56962d52 \ + --hash=sha256:b4968f14f44c62e2ec4a038c8797a87315be8df7740dc3ee8d3bfe1c6bf5dba8 \ + --hash=sha256:bd4e1ebe126152a7bbaa4daedd781c90c8f9643c79b9748caa270ad542f12bec \ + --hash=sha256:c5436d11e89a3ad16ce8afe752f0f373ae9620841c50883dc96f8b8805620b13 \ + --hash=sha256:c6fb60cbd85dc65d4d63d37cb5c86f4e3a301ec605f606ae3a9173e5cf34997b \ + --hash=sha256:d045d33c284e10a038f5e29faca055b90eee87da3fc63b8889085744ebabb5a1 \ + --hash=sha256:e71d6f0090c2256c713ed3d52711d01859c82608b5d68d4fa01a3fe30df95571 \ + --hash=sha256:eb14a4a871bb8efb1e4a50360d4e3c8d6c601e7a31028a2c79f9bb659b63d730 \ + --hash=sha256:eb5fbc8063cb4fde7787e4c0406aa63094a34a2daf4673f359a1fb64050e9cb2 \ + --hash=sha256:f2622af30bf01d8fc36466231bdd203d120d7a599a6d88fb22bdcb9dbff84090 \ + --hash=sha256:f2ed0e0847a80655afa2c121835b848ed101cc7b8d8d6ecc5205aedc732b1436 \ + --hash=sha256:f56236114c425620875c7cf71700e3d60004858da856c6fc78998ffe767b73d3 \ + --hash=sha256:feec38097f71797da0231997e0de3a58108c51845399669ebc532c815f93866b # via -r requirements-actions.in mypy-extensions==1.1.0 \ --hash=sha256:1be4cccdb0f2482337c4743e60421de3a356cd97508abadd57d47403e94f5505 \ @@ -814,9 +801,7 @@ pluggy==1.6.0 \ ply==3.11 \ --hash=sha256:00c7c1aaa88358b9c765b6d3000c6eec0ba42abca5351b095321aef446081da3 \ --hash=sha256:096f9b8350b65ebd2fd1346b12452efe5b9607f7482813ffca50c22722a807ce - # via - # -r requirements-actions.in - # spdx-tools + # via -r requirements-actions.in polib==1.2.0 \ --hash=sha256:1c77ee1b81feb31df9bca258cbc58db1bbb32d10214b173882452c73af06d62d \ --hash=sha256:f3ef94aefed6e183e342a8a269ae1fc4742ba193186ad76f175938621dbfc26b @@ -884,10 +869,6 @@ pynacl==1.5.0 \ --hash=sha256:a422368fc821589c228f4c49438a368831cb5bbc0eab5ebe1d7fac9dded6567b \ --hash=sha256:e46dae94e34b085175f8abb3b0aaa7da40767865ac82c928eeb9e57e1ea8a543 # via pygithub -pyparsing==3.2.3 \ - --hash=sha256:a749938e02d6fd0b59b356ca504a24982314bb090c383e3cf201c95ef7e2bfcf \ - --hash=sha256:b9c13f1ab8b3b542f72e28f634bad4de758ab3ce4546e4301970ad6fa77c38be - # via rdflib pyproject-api==1.9.1 \ --hash=sha256:43c9918f49daab37e302038fc1aed54a8c7a91a9fa935d00b9a485f37e0f5335 \ --hash=sha256:7d6238d92f8962773dd75b5f0c4a6a27cce092a14b623b811dba656f3b628948 @@ -978,13 +959,8 @@ pyyaml==6.0.2 \ # via # -r requirements-actions.in # awscli - # spdx-tools # west # yamllint -rdflib==7.1.4 \ - --hash=sha256:72f4adb1990fa5241abd22ddaf36d7cafa5d91d9ff2ba13f3086d339b213d997 \ - --hash=sha256:fed46e24f26a788e2ab8e445f7077f00edcf95abb73bcef4b86cefa8b62dd174 - # via spdx-tools regex==2024.11.6 \ --hash=sha256:02a02d2bb04fec86ad61f3ea7f49c015a0681bf76abb9857f945d26159d2968c \ --hash=sha256:02e28184be537f0e75c1f9b2f8847dc51e08e6e171c6bde130b2687e0c33cf60 \ @@ -1081,17 +1057,17 @@ regex==2024.11.6 \ --hash=sha256:fdd6028445d2460f33136c55eeb1f601ab06d74cb3347132e1c24250187500d9 \ --hash=sha256:ff590880083d60acc0433f9c3f713c51f7ac6ebb9adf889c79a261ecf541aa91 # via sphinx-lint -requests==2.32.4 \ - --hash=sha256:27babd3cda2a6d50b30443204ee89830707d396671944c998b5975b031ac2b2c \ - --hash=sha256:27d0316682c8a29834d3264820024b62a36942083d52caf2f14c0591336d3422 +requests==2.32.3 \ + --hash=sha256:55365417734eb18255590a9ff9eb97e9e1da868d4ccd6402399eaf68af20a760 \ + --hash=sha256:70761cfe03c773ceb22aa2f671b4757976145175cdfca038c02654d061d6dcc6 # via pygithub rsa==4.7.2 \ --hash=sha256:78f9a9bf4e7be0c5ded4583326e7461e3a3c5aae24073648b4bdfa797d78c9d2 \ --hash=sha256:9d689e6ca1b3038bc82bf8d23e944b6b6037bc02301a574935b2dd946e0353b9 # via awscli -ruamel-yaml==0.18.14 \ - --hash=sha256:710ff198bb53da66718c7db27eec4fbcc9aa6ca7204e4c1df2f282b6fe5eb6b2 \ - --hash=sha256:7227b76aaec364df15936730efbf7d72b30c0b79b1d578bbb8e3dcb2d81f52b7 +ruamel-yaml==0.18.12 \ + --hash=sha256:5a38fd5ce39d223bebb9e3a6779e86b9427a03fb0bf9f270060f8b149cffe5e2 \ + --hash=sha256:790ba4c48b6a6e6b12b532a7308779eb12d2aaab3a80fdb8389216f28ea2b287 # via pykwalify ruamel-yaml-clib==0.2.12 ; python_full_version < '3.14' and platform_python_implementation == 'CPython' \ --hash=sha256:040ae85536960525ea62868b642bdb0c2cc6021c9f9d507810c0c604e66f5a7b \ @@ -1165,10 +1141,6 @@ s3transfer==0.13.0 \ --hash=sha256:0148ef34d6dd964d0d8cf4311b2b21c474693e57c2e069ec708ce043d2b527be \ --hash=sha256:f5e6db74eb7776a37208001113ea7aa97695368242b364d73e91c981ac522177 # via awscli -semantic-version==2.10.0 \ - --hash=sha256:bdabb6d336998cbb378d4b9db3a4b56a1e3235701dc05ea2690d9a997ed5041c \ - --hash=sha256:de78a3b8e0feda74cabc54aab2da702113e33ac9d9eb9d2389bcf1f58b7d9177 - # via spdx-tools setuptools==80.9.0 \ --hash=sha256:062d34222ad13e0cc312a4c02d73f059e86a4acbfbdea8f8f76b28c99f306922 \ --hash=sha256:f36b47402ecde768dbfafc46e8e4207b4360c654f1f3bb84475f0a28628fb19c @@ -1184,10 +1156,6 @@ smmap==5.0.2 \ --hash=sha256:26ea65a03958fa0c8a1c7e8c7a58fdc77221b8910f6be2131affade476898ad5 \ --hash=sha256:b30115f0def7d7531d22a0fb6502488d879e75b260a9db4d0819cfb25403af5e # via gitdb -spdx-tools==0.8.3 \ - --hash=sha256:638fd9bd8be61901316eb6d063574e16d5403a1870073ec4d9241426a997501a \ - --hash=sha256:68b8f9ce2893b5216bd90b2e63f1c821c2884e4ebc4fd295ebbf1fa8b8a94b93 - # via -r requirements-actions.in sphinx-lint==1.0.0 \ --hash=sha256:6117a0f340b2dc73eadfc57db7531d4477e0929f92a0c1a2f61e6edbc272f0bc \ --hash=sha256:6eafdb44172ce526f405bf36c713eb246f1340ec2d667e7298e2487ed76decd2 @@ -1236,9 +1204,9 @@ tomli==2.2.1 \ # pyproject-api # pytest # tox -tomlkit==0.13.3 \ - --hash=sha256:430cf247ee57df2b94ee3fbe588e71d362a941ebb545dec29b53961d61add2a1 \ - --hash=sha256:c89c649d79ee40629a9fda55f8ace8c6a1b42deb912b2a8fd8d942ddadb606b0 +tomlkit==0.13.2 \ + --hash=sha256:7a974427f6e119197f670fbbbeae7bef749a6c14e793db934baefc1b5f03efde \ + --hash=sha256:fff5fe59a87295b278abd31bec92c15d9bc4a06885ab12bcea52c71119392e79 # via pylint tox==4.26.0 \ --hash=sha256:75f17aaf09face9b97bd41645028d9f722301e912be8b4c65a3f938024560224 \ @@ -1259,10 +1227,6 @@ unidiff==0.7.5 \ --hash=sha256:2e5f0162052248946b9f0970a40e9e124236bf86c82b70821143a6fc1dea2574 \ --hash=sha256:c93bf2265cc1ba2a520e415ab05da587370bc2a3ae9e0414329f54f0c2fc09e8 # via -r requirements-actions.in -uritools==5.0.0 \ - --hash=sha256:68180cad154062bd5b5d9ffcdd464f8de6934414b25462ae807b00b8df9345de \ - --hash=sha256:cead3a49ba8fbca3f91857343849d506d8639718f4a2e51b62e87393b493bd6f - # via spdx-tools urllib3==2.4.0 \ --hash=sha256:414bc6535b787febd7567804cc015fee39daab8ad86268f1310a9250697de466 \ --hash=sha256:4e16665048960a0900c702d4a66415956a584919c03361cac9f1df5c5dd7e813 @@ -1370,10 +1334,6 @@ xlsxwriter==3.2.3 \ --hash=sha256:593f8296e8a91790c6d0378ab08b064f34a642b3feb787cf6738236bd0a4860d \ --hash=sha256:ad6fd41bdcf1b885876b1f6b7087560aecc9ae5a9cc2ba97dcac7ab2e210d3d5 # via -r requirements-actions.in -xmltodict==0.14.2 \ - --hash=sha256:201e7c28bb210e374999d1dde6382923ab0ed1a8a5faeece48ab525b7810a553 \ - --hash=sha256:20cc7d723ed729276e808f26fb6b3599f786cbc37e06c65e192ba77c40f20aac - # via spdx-tools yamllint==1.37.1 \ --hash=sha256:364f0d79e81409f591e323725e6a9f4504c8699ddf2d7263d8d2b539cd66a583 \ --hash=sha256:81f7c0c5559becc8049470d86046b36e96113637bcbe4753ecef06977c00245d diff --git a/scripts/requirements-run-test.txt b/scripts/requirements-run-test.txt index 4b09fd1aa3a9..08ff89b0c545 100644 --- a/scripts/requirements-run-test.txt +++ b/scripts/requirements-run-test.txt @@ -16,6 +16,3 @@ psutil>=5.6.6 # used for CAN <=> host testing python-can>=4.3.0 - -# used for SPDX files validation -spdx-tools diff --git a/tests/application_development/software_bill_of_materials/CMakeLists.txt b/tests/application_development/software_bill_of_materials/CMakeLists.txt index 4c07f6bb2383..90fa8976b917 100644 --- a/tests/application_development/software_bill_of_materials/CMakeLists.txt +++ b/tests/application_development/software_bill_of_materials/CMakeLists.txt @@ -10,35 +10,4 @@ target_sources(app PRIVATE ${ZEPHYR_BASE}/misc/empty_file.c) enable_testing() include(CTest) -set( - SPDX_FILES - app.spdx - zephyr.spdx - build.spdx - modules-deps.spdx -) - -set(SPDX_VERSIONS_TO_TEST "2.2" "2.3") - -foreach(spdx_version ${SPDX_VERSIONS_TO_TEST}) - string(REPLACE "." "_" version_suffix ${spdx_version}) - - add_test( - NAME spdx_gen_${version_suffix} - COMMAND west spdx -d ${CMAKE_BINARY_DIR} --spdx-version ${spdx_version} - ) - - foreach(spdx_file ${SPDX_FILES}) - get_filename_component(basename ${spdx_file} NAME_WE) - - add_test( - NAME spdx_validate_${basename}_${version_suffix} - COMMAND pyspdxtools -i ${CMAKE_BINARY_DIR}/spdx/${spdx_file} - ) - - set_tests_properties( - spdx_validate_${basename}_${version_suffix} - PROPERTIES DEPENDS spdx_gen_${version_suffix} - ) - endforeach() -endforeach() +add_test(NAME spdx_gen COMMAND west spdx -d ${CMAKE_BINARY_DIR}) diff --git a/tests/application_development/software_bill_of_materials/testcase.yaml b/tests/application_development/software_bill_of_materials/testcase.yaml index 3fd2eab28e29..8436b69fdbe9 100644 --- a/tests/application_development/software_bill_of_materials/testcase.yaml +++ b/tests/application_development/software_bill_of_materials/testcase.yaml @@ -2,9 +2,7 @@ common: tags: - spdx integration_platforms: - - qemu_cortex_m3 - platform_allow: - - qemu_cortex_m3 + - native_sim harness: ctest tests: buildsystem.sbom.spdx: {} From c860d3c37e071b032754610d5508621197cf8442 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:27 +0300 Subject: [PATCH 0855/2141] Revert "[nrf fromtree] scripts: ci: add vermin (min python version check)" This reverts commit 3bd95f869510e3b0be9bdd03c8ec9e66455c22c4. Signed-off-by: Jukka Rissanen --- .gitignore | 1 - scripts/ci/check_compliance.py | 60 ----------------------------- scripts/requirements-actions.in | 1 - scripts/requirements-actions.txt | 4 -- scripts/requirements-compliance.txt | 1 - 5 files changed, 67 deletions(-) diff --git a/.gitignore b/.gitignore index c24356df575a..aab3981f52fc 100644 --- a/.gitignore +++ b/.gitignore @@ -102,7 +102,6 @@ MaintainersFormat.txt ModulesMaintainers.txt Nits.txt Pylint.txt -PythonCompat.txt Ruff.txt SphinxLint.txt SysbuildKconfig.txt diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index f1da73f3ec0d..d5f13ee84fce 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -2001,66 +2001,6 @@ def run(self): desc = f"Run 'ruff format {file}'" self.fmtd_failure("error", "Python format error", file, desc=desc) -class PythonCompatCheck(ComplianceTest): - """ - Python Compatibility Check - """ - name = "PythonCompat" - doc = "Check that Python files are compatible with Zephyr minimum supported Python version." - - MAX_VERSION = (3, 10) - MAX_VERSION_STR = f"{MAX_VERSION[0]}.{MAX_VERSION[1]}" - - def run(self): - py_files = [f for f in get_files(filter="d") if f.endswith(".py")] - if not py_files: - return - cmd = ["vermin", "-f", "parsable", "--violations", - f"-t={self.MAX_VERSION_STR}", "--no-make-paths-absolute"] + py_files - try: - result = subprocess.run(cmd, - check=False, - capture_output=True, - cwd=GIT_TOP) - except Exception as ex: - self.error(f"Failed to run vermin: {ex}") - output = result.stdout.decode("utf-8") - failed = False - for line in output.splitlines(): - parts = line.split(":") - if len(parts) < 6: - continue - filename, line_number, column, _, py3ver, feature = parts[:6] - if not line_number: - # Ignore all file-level messages - continue - - desc = None - if py3ver.startswith('!'): - desc = f"{feature} is known to be incompatible with Python 3." - elif py3ver.startswith('~'): - # "no known reason it won't work", just skip - continue - else: - major, minor = map(int, py3ver.split(".")[:2]) - if (major, minor) > self.MAX_VERSION: - desc = f"{feature} requires Python {major}.{minor}, which is higher than " \ - f"Zephyr's minimum supported Python version ({self.MAX_VERSION_STR})." - - if desc is not None: - self.fmtd_failure( - "error", - "PythonCompat", - filename, - line=int(line_number), - col=int(column) if column else None, - desc=desc, - ) - failed = True - if failed: - self.failure("Some Python files use features that are not compatible with Python " \ - f"{self.MAX_VERSION_STR}.") - class TextEncoding(ComplianceTest): """ diff --git a/scripts/requirements-actions.in b/scripts/requirements-actions.in index 2094546f423a..bf4a50e2aa27 100644 --- a/scripts/requirements-actions.in +++ b/scripts/requirements-actions.in @@ -35,7 +35,6 @@ tabulate tomli>=1.1.0 tox unidiff -vermin west>=0.14.0 xlsxwriter yamllint diff --git a/scripts/requirements-actions.txt b/scripts/requirements-actions.txt index 065d59923991..b1997b684398 100644 --- a/scripts/requirements-actions.txt +++ b/scripts/requirements-actions.txt @@ -1235,10 +1235,6 @@ urllib3==2.4.0 \ # elastic-transport # pygithub # requests -vermin==1.6.0 \ - --hash=sha256:6266ca02f55d1c2aa189a610017c132eb2d1934f09e72a955b1eb3820ee6d4ef \ - --hash=sha256:f1fa9ee40f59983dc40e0477eb2b1fa8061a3df4c3b2bcf349add462a5610efb - # via -r requirements-actions.in virtualenv==20.31.2 \ --hash=sha256:36efd0d9650ee985f0cad72065001e66d49a6f24eb44d98980f630686243cf11 \ --hash=sha256:e10c0a9d02835e592521be48b332b6caee6887f332c111aa79a09b9e79efc2af diff --git a/scripts/requirements-compliance.txt b/scripts/requirements-compliance.txt index 19bdcb3071f3..a7134e7ff002 100644 --- a/scripts/requirements-compliance.txt +++ b/scripts/requirements-compliance.txt @@ -13,6 +13,5 @@ python-magic; sys_platform != "win32" ruff==0.11.11 sphinx-lint unidiff -vermin yamllint # zephyr-keep-sorted-stop From def7f9867243bf0015d6b8dd9829fd8d102d2002 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:27 +0300 Subject: [PATCH 0856/2141] Revert "[nrf fromtree] scripts: requirements: update pinned dependencies" This reverts commit cff056bd234fb91722e269d97254efcf846364e4. Signed-off-by: Jukka Rissanen --- scripts/requirements-actions.txt | 34 +++++++++++++++----------------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/scripts/requirements-actions.txt b/scripts/requirements-actions.txt index b1997b684398..61b88c954041 100644 --- a/scripts/requirements-actions.txt +++ b/scripts/requirements-actions.txt @@ -12,13 +12,13 @@ astroid==3.3.10 \ --hash=sha256:104fb9cb9b27ea95e847a94c003be03a9e039334a8ebca5ee27dafaf5c5711eb \ --hash=sha256:c332157953060c6deb9caa57303ae0d20b0fbdb2e59b4a4f2a6ba49d0a7961ce # via pylint -awscli==1.40.27 \ - --hash=sha256:92c84a3e9cbe3a7566bc738ad21201d9dad32dd7ab6a7a4906f7e1b29b9385ca \ - --hash=sha256:d1e1047cccd675b48ab215b4012c91673de73ba498f503fd6eda3de1a24995d7 +awscli==1.40.24 \ + --hash=sha256:6dbd7baebd5e01cd983dc8a816dfaa09155ce1825099ee09fd2044ea60024a3e \ + --hash=sha256:a5d8dffa523f332839ec95501364df45d763c3000f9a61247324e6cfa46a3bf2 # via -r requirements-actions.in -botocore==1.38.28 \ - --hash=sha256:515e1a535a27f17e1381aec1fb48eaa2c2308258c4db0bfd09e4f1cd1f239c44 \ - --hash=sha256:63d5977a10a375c3fc11c8e15e1ae5a4daaf450af135d55c170cc537648edf25 +botocore==1.38.25 \ + --hash=sha256:5a960bd990a11cdb78865e908a58ed712d87d9b419f55ad21c99d7d21f0d6726 \ + --hash=sha256:8c73e97d9662a6c92be33dab66cd1e2b59797154c7ec379ce3bb5d6779d9d78c # via # awscli # s3transfer @@ -840,9 +840,7 @@ pygithub==2.6.1 \ pygments==2.19.1 \ --hash=sha256:61c16d2a8576dc0649d9f39e089b5f02bcd27fba10d8fb4dcc28173f7a45151f \ --hash=sha256:9ea1544ad55cecf4b8242fab6dd35a93bbce657034b0611ee383099054ab6d8c - # via - # gcovr - # pytest + # via gcovr pyjwt==2.10.1 \ --hash=sha256:3cc5772eb20009233caf06e9d8a0577824723b44e6648ee0a2aedb6cf9381953 \ --hash=sha256:dcdd193e30abefd5debf142f9adfcdd2b58004e644f25406ffaebd50bd98dacb @@ -877,9 +875,9 @@ pyserial==3.5 \ --hash=sha256:3c77e014170dfffbd816e6ffc205e9842efb10be9f58ec16d3e8675b4925cddb \ --hash=sha256:c4451db6ba391ca6ca299fb3ec7bae67a5c55dde170964c7a14ceefec02f2cf0 # via -r requirements-actions.in -pytest==8.4.0 \ - --hash=sha256:14d920b48472ea0dbf68e45b96cd1ffda4705f33307dcc86c676c1b5104838a6 \ - --hash=sha256:f40f825768ad76c0977cbacdf1fd37c6f7a468e460ea6a0636078f8972d4517e +pytest==8.3.5 \ + --hash=sha256:c69214aa47deac29fad6c2a4f590b9c4a9fdb16a403176fe154b79c0b4d4d820 \ + --hash=sha256:f4efe70cc14e511565ac476b57c279e12a855b11f48f212af1080ef2263d3845 # via -r requirements-actions.in python-can==4.5.0 \ --hash=sha256:1eec66833c1ac76a7e3d636ee0f8b4ba2752e892bab1c56ce74308b2216b5445 \ @@ -1065,9 +1063,9 @@ rsa==4.7.2 \ --hash=sha256:78f9a9bf4e7be0c5ded4583326e7461e3a3c5aae24073648b4bdfa797d78c9d2 \ --hash=sha256:9d689e6ca1b3038bc82bf8d23e944b6b6037bc02301a574935b2dd946e0353b9 # via awscli -ruamel-yaml==0.18.12 \ - --hash=sha256:5a38fd5ce39d223bebb9e3a6779e86b9427a03fb0bf9f270060f8b149cffe5e2 \ - --hash=sha256:790ba4c48b6a6e6b12b532a7308779eb12d2aaab3a80fdb8389216f28ea2b287 +ruamel-yaml==0.18.11 \ + --hash=sha256:b586a3416676566ed45bf679a0909719f7ea7b58c03a9b6e03f905a1e2cd5076 \ + --hash=sha256:eca06c9fce6ee3220845c4c54e58376586e041a6127e4d1958e12a3142084897 # via pykwalify ruamel-yaml-clib==0.2.12 ; python_full_version < '3.14' and platform_python_implementation == 'CPython' \ --hash=sha256:040ae85536960525ea62868b642bdb0c2cc6021c9f9d507810c0c604e66f5a7b \ @@ -1212,9 +1210,9 @@ tox==4.26.0 \ --hash=sha256:75f17aaf09face9b97bd41645028d9f722301e912be8b4c65a3f938024560224 \ --hash=sha256:a83b3b67b0159fa58e44e646505079e35a43317a62d2ae94725e0586266faeca # via -r requirements-actions.in -typing-extensions==4.14.0 \ - --hash=sha256:8676b788e32f02ab42d9e7c61324048ae4c6d844a399eebace3d4979d75ceef4 \ - --hash=sha256:a1514509136dd0b477638fc68d6a91497af5076466ad0fa6c338e44e359944af +typing-extensions==4.13.2 \ + --hash=sha256:a439e7c04b49fec3e5d3e2beaa21755cadbbdc391694e28ccdd36ca4a1408f8c \ + --hash=sha256:e6c81219bd689f51865d9e372991c540bda33a0379d5573cddb9a3a23f7caaef # via # astroid # elasticsearch From 5a672d2bb47ee8cf8c4fc3c00353cf23d6fb50dc Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:27 +0300 Subject: [PATCH 0857/2141] Revert "[nrf fromtree] scripts/kconfig/cmake: Generate/use env file for zephyr module paths" This reverts commit 0e3da0add10c30ded8d05a9084d0721ccffe53dc. Signed-off-by: Jukka Rissanen --- Kconfig.zephyr | 1 - cmake/modules/kconfig.cmake | 1 - doc/_extensions/zephyr/kconfig/__init__.py | 7 ---- scripts/ci/check_compliance.py | 16 +++------- scripts/zephyr_module.py | 37 +++++++--------------- share/sysbuild/Kconfig | 2 -- 6 files changed, 16 insertions(+), 48 deletions(-) diff --git a/Kconfig.zephyr b/Kconfig.zephyr index ace2652550d3..994730d19332 100644 --- a/Kconfig.zephyr +++ b/Kconfig.zephyr @@ -6,7 +6,6 @@ # SPDX-License-Identifier: Apache-2.0 source "Kconfig.constants" -source "$(KCONFIG_ENV_FILE)" osource "$(APPLICATION_SOURCE_DIR)/VERSION" diff --git a/cmake/modules/kconfig.cmake b/cmake/modules/kconfig.cmake index 1e2cf75f54b2..ac5f1b83e4c3 100644 --- a/cmake/modules/kconfig.cmake +++ b/cmake/modules/kconfig.cmake @@ -134,7 +134,6 @@ zephyr_get(APP_DIR VAR APP_DIR APPLICATION_SOURCE_DIR) set(COMMON_KCONFIG_ENV_SETTINGS PYTHON_EXECUTABLE=${PYTHON_EXECUTABLE} - KCONFIG_ENV_FILE=${KCONFIG_BINARY_DIR}/kconfig_module_dirs.env srctree=${ZEPHYR_BASE} KERNELVERSION=${KERNELVERSION} APPVERSION=${APP_VERSION_STRING} diff --git a/doc/_extensions/zephyr/kconfig/__init__.py b/doc/_extensions/zephyr/kconfig/__init__.py index a76ac87f887b..dfb7a567da83 100644 --- a/doc/_extensions/zephyr/kconfig/__init__.py +++ b/doc/_extensions/zephyr/kconfig/__init__.py @@ -76,18 +76,12 @@ def kconfig_load(app: Sphinx) -> tuple[kconfiglib.Kconfig, kconfiglib.Kconfig, d modules = zephyr_module.parse_modules(ZEPHYR_BASE) # generate Kconfig.modules file - kconfig_module_dirs = "" kconfig = "" sysbuild_kconfig = "" for module in modules: - kconfig_module_dirs += zephyr_module.process_kconfig_module_dir(module.project, - module.meta) kconfig += zephyr_module.process_kconfig(module.project, module.meta) sysbuild_kconfig += zephyr_module.process_sysbuildkconfig(module.project, module.meta) - with open(Path(td) / "kconfig_module_dirs.env", "w") as f: - f.write(kconfig_module_dirs) - with open(Path(td) / "Kconfig.modules", "w") as f: f.write(kconfig) @@ -158,7 +152,6 @@ def kconfig_load(app: Sphinx) -> tuple[kconfiglib.Kconfig, kconfiglib.Kconfig, d os.environ["BOARD"] = "boards" os.environ["KCONFIG_BOARD_DIR"] = str(Path(td) / "boards") - os.environ["KCONFIG_ENV_FILE"] = str(Path(td) / "kconfig_module_dirs.env") # Sysbuild runs first os.environ["CONFIG_"] = "SB_CONFIG_" diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index d5f13ee84fce..5958fa52a7d5 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -515,7 +515,7 @@ def run(self): self.check_no_undef_outside_kconfig(kconf) self.check_disallowed_defconfigs(kconf) - def get_modules(self, _module_dirs_file, modules_file, sysbuild_modules_file, settings_file): + def get_modules(self, modules_file, sysbuild_modules_file, settings_file): """ Get a list of modules and put them in a file that is parsed by Kconfig @@ -730,15 +730,13 @@ def parse_kconfig(self): os.environ["KCONFIG_BINARY_DIR"] = kconfiglib_dir os.environ['DEVICETREE_CONF'] = "dummy" os.environ['TOOLCHAIN_HAS_NEWLIB'] = "y" - os.environ['KCONFIG_ENV_FILE'] = os.path.join(kconfiglib_dir, "kconfig_module_dirs.env") # Older name for DEVICETREE_CONF, for compatibility with older Zephyr # versions that don't have the renaming os.environ["GENERATED_DTS_BOARD_CONF"] = "dummy" # For multi repo support - self.get_modules(os.environ['KCONFIG_ENV_FILE'], - os.path.join(kconfiglib_dir, "Kconfig.modules"), + self.get_modules(os.path.join(kconfiglib_dir, "Kconfig.modules"), os.path.join(kconfiglib_dir, "Kconfig.sysbuild.modules"), os.path.join(kconfiglib_dir, "settings_file.txt")) # For Kconfig.dts support @@ -1323,17 +1321,13 @@ class KconfigBasicNoModulesCheck(KconfigBasicCheck): """ name = "KconfigBasicNoModules" path_hint = "" - EMPTY_FILE_CONTENTS = "# Empty\n" - - def get_modules(self, module_dirs_file, modules_file, sysbuild_modules_file, settings_file): - with open(module_dirs_file, 'w') as fp_module_file: - fp_module_file.write(self.EMPTY_FILE_CONTENTS) + def get_modules(self, modules_file, sysbuild_modules_file, settings_file): with open(modules_file, 'w') as fp_module_file: - fp_module_file.write(self.EMPTY_FILE_CONTENTS) + fp_module_file.write("# Empty\n") with open(sysbuild_modules_file, 'w') as fp_module_file: - fp_module_file.write(self.EMPTY_FILE_CONTENTS) + fp_module_file.write("# Empty\n") class KconfigHWMv2Check(KconfigBasicCheck): diff --git a/scripts/zephyr_module.py b/scripts/zephyr_module.py index 8bf2d00793d7..aeda845639e0 100755 --- a/scripts/zephyr_module.py +++ b/scripts/zephyr_module.py @@ -386,12 +386,6 @@ def kconfig_snippet(meta, path, kconfig_file=None, blobs=False, taint_blobs=Fals return '\n'.join(snippet) -def process_kconfig_module_dir(module, meta): - module_path = PurePath(module) - name_sanitized = meta['name-sanitized'] - return f'ZEPHYR_{name_sanitized.upper()}_MODULE_DIR={module_path.as_posix()}\n' - - def process_kconfig(module, meta): blobs = process_blobs(module, meta) taint_blobs = any(b['status'] != BLOB_NOT_PRESENT for b in blobs) @@ -399,9 +393,11 @@ def process_kconfig(module, meta): module_path = PurePath(module) module_yml = module_path.joinpath('zephyr/module.yml') kconfig_extern = section.get('kconfig-ext', False) + name_sanitized = meta['name-sanitized'] + snippet = f'ZEPHYR_{name_sanitized.upper()}_MODULE_DIR := {module_path.as_posix()}\n' if kconfig_extern: - return kconfig_snippet(meta, module_path, blobs=blobs, taint_blobs=taint_blobs) + return snippet + kconfig_snippet(meta, module_path, blobs=blobs, taint_blobs=taint_blobs) kconfig_setting = section.get('kconfig', None) if not validate_setting(kconfig_setting, module): @@ -411,11 +407,10 @@ def process_kconfig(module, meta): kconfig_file = os.path.join(module, kconfig_setting or 'zephyr/Kconfig') if os.path.isfile(kconfig_file): - return kconfig_snippet(meta, module_path, Path(kconfig_file), - blobs=blobs, taint_blobs=taint_blobs) + return snippet + kconfig_snippet(meta, module_path, Path(kconfig_file), + blobs=blobs, taint_blobs=taint_blobs) else: - name_sanitized = meta['name-sanitized'] - return '\n'.join(kconfig_module_opts(name_sanitized, blobs, taint_blobs)) + '\n' + return snippet + '\n'.join(kconfig_module_opts(name_sanitized, blobs, taint_blobs)) + '\n' def process_sysbuildkconfig(module, meta): @@ -424,9 +419,10 @@ def process_sysbuildkconfig(module, meta): module_yml = module_path.joinpath('zephyr/module.yml') kconfig_extern = section.get('sysbuild-kconfig-ext', False) name_sanitized = meta['name-sanitized'] + snippet = f'ZEPHYR_{name_sanitized.upper()}_MODULE_DIR := {module_path.as_posix()}\n' if kconfig_extern: - return kconfig_snippet(meta, module_path, sysbuild=True) + return snippet + kconfig_snippet(meta, module_path, sysbuild=True) kconfig_setting = section.get('sysbuild-kconfig', None) if not validate_setting(kconfig_setting, module): @@ -437,9 +433,10 @@ def process_sysbuildkconfig(module, meta): if kconfig_setting is not None: kconfig_file = os.path.join(module, kconfig_setting) if os.path.isfile(kconfig_file): - return kconfig_snippet(meta, module_path, Path(kconfig_file)) + return snippet + kconfig_snippet(meta, module_path, Path(kconfig_file)) - return (f'config ZEPHYR_{name_sanitized.upper()}_MODULE\n' + return snippet + \ + (f'config ZEPHYR_{name_sanitized.upper()}_MODULE\n' f' bool\n' f' default y\n') @@ -864,7 +861,6 @@ def main(): help='Path to zephyr repository') args = parser.parse_args() - kconfig_module_dirs = "" kconfig = "" cmake = "" sysbuild_kconfig = "" @@ -877,7 +873,6 @@ def main(): args.modules, args.extra_modules) for module in modules: - kconfig_module_dirs += process_kconfig_module_dir(module.project, module.meta) kconfig += process_kconfig(module.project, module.meta) cmake += process_cmake(module.project, module.meta) sysbuild_kconfig += process_sysbuildkconfig( @@ -886,16 +881,6 @@ def main(): settings += process_settings(module.project, module.meta) twister += process_twister(module.project, module.meta) - if args.kconfig_out or args.sysbuild_kconfig_out: - if args.kconfig_out: - kconfig_module_dirs_out = PurePath(args.kconfig_out).parent / 'kconfig_module_dirs.env' - elif args.sysbuild_kconfig_out: - kconfig_module_dirs_out = PurePath(args.sysbuild_kconfig_out).parent / \ - 'kconfig_module_dirs.env' - - with open(kconfig_module_dirs_out, 'w', encoding="utf-8") as fp: - fp.write(kconfig_module_dirs) - if args.kconfig_out: with open(args.kconfig_out, 'w', encoding="utf-8") as fp: fp.write(kconfig) diff --git a/share/sysbuild/Kconfig b/share/sysbuild/Kconfig index 6bf51245771f..5f689e07399a 100644 --- a/share/sysbuild/Kconfig +++ b/share/sysbuild/Kconfig @@ -2,8 +2,6 @@ # # SPDX-License-Identifier: Apache-2.0 -source "$(KCONFIG_ENV_FILE)" - config BOARD string default "$(BOARD)" From 421ae719904e918abdb29edd1e8fc5f6ccb04a76 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:27 +0300 Subject: [PATCH 0858/2141] Revert "[nrf fromtree] kconfig: Use $(...) instead of ${...} for getting variables" This reverts commit 32dce2ffd63fd3436794ef27b2fed2c5d1c1d9e5. Signed-off-by: Jukka Rissanen --- Kconfig.zephyr | 4 ++-- boards/qemu/x86/Kconfig.defconfig | 2 +- doc/build/sysbuild/images.rst | 6 +++--- drivers/usb/uvb/Kconfig | 2 +- kernel/Kconfig | 2 +- lib/runtime/Kconfig | 2 +- modules/nrf_wifi/bus/Kconfig | 2 +- modules/trusted-firmware-m/Kconfig.tfm | 18 +++++++++--------- samples/drivers/mbox/Kconfig.sysbuild | 8 ++++---- samples/sysbuild/hello_world/Kconfig.sysbuild | 2 +- share/sysbuild/images/firmware_loader/Kconfig | 2 +- subsys/bluetooth/Kconfig.logging | 6 +++--- subsys/testsuite/Kconfig | 2 +- tests/boards/nrf/nrfs/Kconfig.sysbuild | 2 +- .../audio_samples/bap_broadcast_sink/Kconfig | 2 +- .../bap_broadcast_sink/Kconfig.sysbuild | 2 +- .../bap_unicast_client/Kconfig.sysbuild | 2 +- .../audio_samples/cap/acceptor/Kconfig | 2 +- .../cap/acceptor/Kconfig.sysbuild | 2 +- .../audio_samples/cap/initiator/Kconfig | 2 +- .../cap/initiator/Kconfig.sysbuild | 2 +- .../ccp/call_control_client/Kconfig.sysbuild | 2 +- .../ccp/call_control_server/Kconfig.sysbuild | 2 +- .../samples/central_hr_peripheral_hr/Kconfig | 2 +- .../central_hr_peripheral_hr/Kconfig.sysbuild | 2 +- tests/bsim/net/sockets/echo_test/Kconfig | 2 +- tests/cmake/sysbuild_snippets/Kconfig.sysbuild | 2 +- tests/subsys/ipc/ipc_sessions/Kconfig.sysbuild | 2 +- 28 files changed, 44 insertions(+), 44 deletions(-) diff --git a/Kconfig.zephyr b/Kconfig.zephyr index 994730d19332..4993e56c8b24 100644 --- a/Kconfig.zephyr +++ b/Kconfig.zephyr @@ -7,7 +7,7 @@ source "Kconfig.constants" -osource "$(APPLICATION_SOURCE_DIR)/VERSION" +osource "${APPLICATION_SOURCE_DIR}/VERSION" # Include Kconfig.defconfig files first so that they can override defaults and # other symbol/choice properties by adding extra symbol/choice definitions. @@ -967,7 +967,7 @@ config BUILD_OUTPUT_STRIP_PATHS bool "Strip absolute paths from binaries" default y help - If the compiler supports it, strip the $(ZEPHYR_BASE) prefix from the + If the compiler supports it, strip the ${ZEPHYR_BASE} prefix from the __FILE__ macro used in __ASSERT*, in the .noinit."/home/joe/zephyr/fu/bar.c" section names and in any application code. diff --git a/boards/qemu/x86/Kconfig.defconfig b/boards/qemu/x86/Kconfig.defconfig index 5a039094f833..5afe94d68e5d 100644 --- a/boards/qemu/x86/Kconfig.defconfig +++ b/boards/qemu/x86/Kconfig.defconfig @@ -100,7 +100,7 @@ config HAVE_CUSTOM_LINKER_SCRIPT default y config CUSTOM_LINKER_SCRIPT - default "$(ZEPHYR_BASE)/boards/qemu/x86/qemu_x86_tiny.ld" + default "${ZEPHYR_BASE}/boards/qemu/x86/qemu_x86_tiny.ld" config X86_EXTRA_PAGE_TABLE_PAGES # This is needed for gen_mmu.py to map the flash into memory diff --git a/doc/build/sysbuild/images.rst b/doc/build/sysbuild/images.rst index 00075894cefc..3ccfd873e16b 100644 --- a/doc/build/sysbuild/images.rst +++ b/doc/build/sysbuild/images.rst @@ -151,13 +151,13 @@ more complex to create but is the preferred method for adding images to upstream config OTHER_APP_IMAGE_PATH string - default "$(ZEPHYR_MY_IMAGE_MODULE_DIR)/path/to/my_image" if OTHER_APP_IMAGE_MY_IMAGE + default "${ZEPHYR_MY_IMAGE_MODULE_DIR}/path/to/my_image" if OTHER_APP_IMAGE_MY_IMAGE help Source directory of other app image. .. note:: - Remember to have ``source "$(ZEPHYR_BASE)/share/sysbuild/Kconfig"`` in the file if this + Remember to have ``source "${ZEPHYR_BASE}/share/sysbuild/Kconfig"`` in the file if this is being applied in an application ``Kconfig.sysbuild`` file. .. group-tab:: ``sysbuild.cmake`` @@ -212,7 +212,7 @@ This can then be extended by :ref:`modules` like so: default "my_second_image" if OTHER_APP_IMAGE_MY_SECOND_IMAGE config OTHER_APP_IMAGE_PATH - default "$(ZEPHYR_MY_SECOND_IMAGE_MODULE_DIR)/path/to/my_second_image" if OTHER_APP_IMAGE_MY_SECOND_IMAGE + default "${ZEPHYR_MY_SECOND_IMAGE_MODULE_DIR}/path/to/my_second_image" if OTHER_APP_IMAGE_MY_SECOND_IMAGE As can be seen, no additional CMake changes are needed to add an alternative image as the base CMake code will add the replacement image instead of the original image, if selected. diff --git a/drivers/usb/uvb/Kconfig b/drivers/usb/uvb/Kconfig index 039296dd3ba7..77e893cff505 100644 --- a/drivers/usb/uvb/Kconfig +++ b/drivers/usb/uvb/Kconfig @@ -22,6 +22,6 @@ config UVB_MAX_MESSAGES module = UVB module-str = USB virtual bus service -source "$(ZEPHYR_BASE)/subsys/logging/Kconfig.template.log_config" +source "${ZEPHYR_BASE}/subsys/logging/Kconfig.template.log_config" endif # UVB diff --git a/kernel/Kconfig b/kernel/Kconfig index 9afeeaa5e67c..c2976b9f281f 100644 --- a/kernel/Kconfig +++ b/kernel/Kconfig @@ -942,7 +942,7 @@ config STACK_CANARIES_ALL config STACK_CANARIES_EXPLICIT bool "Explicit protection" depends on ENTROPY_GENERATOR || TEST_RANDOM_GENERATOR - depends on "$(ZEPHYR_TOOLCHAIN_VARIANT)" = "zephyr" + depends on "${ZEPHYR_TOOLCHAIN_VARIANT}" = "zephyr" select NEED_LIBC_MEM_PARTITION if !STACK_CANARIES_TLS select REQUIRES_STACK_CANARIES help diff --git a/lib/runtime/Kconfig b/lib/runtime/Kconfig index 9be8ac5b7aea..afb78f5b82b8 100644 --- a/lib/runtime/Kconfig +++ b/lib/runtime/Kconfig @@ -4,7 +4,7 @@ config COMPILER_RT_SUPPORTED bool default y - depends on "$(ZEPHYR_TOOLCHAIN_VARIANT)" = "llvm" + depends on "${ZEPHYR_TOOLCHAIN_VARIANT}" = "llvm" help Selected when the compiler supports compiler-rt runtime library. diff --git a/modules/nrf_wifi/bus/Kconfig b/modules/nrf_wifi/bus/Kconfig index 430cf3ba9ffd..3fed449bb809 100644 --- a/modules/nrf_wifi/bus/Kconfig +++ b/modules/nrf_wifi/bus/Kconfig @@ -43,7 +43,7 @@ config NRF71_ON_IPC module = WIFI_NRF70_BUSLIB module-dep = LOG module-str = Log level for Wi-Fi nRF70 bus library -source "$(ZEPHYR_BASE)/subsys/logging/Kconfig.template.log_config" +source "${ZEPHYR_BASE}/subsys/logging/Kconfig.template.log_config" config WIFI_NRF70_BUSLIB_LOG_LEVEL # Enable error by default diff --git a/modules/trusted-firmware-m/Kconfig.tfm b/modules/trusted-firmware-m/Kconfig.tfm index 55e08ee45e4a..97591ac8a830 100644 --- a/modules/trusted-firmware-m/Kconfig.tfm +++ b/modules/trusted-firmware-m/Kconfig.tfm @@ -23,11 +23,11 @@ config TFM_BOARD default "arm/musca_b1" if BOARD_V2M_MUSCA_B1 default "arm/musca_s1" if BOARD_V2M_MUSCA_S1 default "adi/max32657" if BOARD_MAX32657EVKIT_MAX32657_NS - default "$(ZEPHYR_BASE)/modules/trusted-firmware-m/nordic/nrf9160" if SOC_NRF9160 - default "$(ZEPHYR_BASE)/modules/trusted-firmware-m/nordic/nrf9120" if SOC_NRF9120 - default "$(ZEPHYR_BASE)/modules/trusted-firmware-m/nordic/nrf5340_cpuapp" if SOC_NRF5340_CPUAPP - default "$(ZEPHYR_BASE)/modules/trusted-firmware-m/nordic/nrf54l15_cpuapp" if SOC_NRF54L15_CPUAPP - default "$(ZEPHYR_BASE)/modules/trusted-firmware-m/nordic/nrf54l10_cpuapp" if SOC_NRF54L10_CPUAPP + default "${ZEPHYR_BASE}/modules/trusted-firmware-m/nordic/nrf9160" if SOC_NRF9160 + default "${ZEPHYR_BASE}/modules/trusted-firmware-m/nordic/nrf9120" if SOC_NRF9120 + default "${ZEPHYR_BASE}/modules/trusted-firmware-m/nordic/nrf5340_cpuapp" if SOC_NRF5340_CPUAPP + default "${ZEPHYR_BASE}/modules/trusted-firmware-m/nordic/nrf54l15_cpuapp" if SOC_NRF54L15_CPUAPP + default "${ZEPHYR_BASE}/modules/trusted-firmware-m/nordic/nrf54l10_cpuapp" if SOC_NRF54L10_CPUAPP help The board name used for building TFM. Building with TFM requires that TFM has been ported to the given board/SoC. @@ -256,7 +256,7 @@ config TFM_BL2_SIGNING_KEY_PATH string "Path to private key used to sign BL2 firmware images." help Path to binary BL2 signing private key - Default is $(ZEPHYR_TRUSTED_FIRMWARE_M_MODULE_DIR)/bl1/bl1_2/bl1_dummy_rotpk + Default is ${ZEPHYR_TRUSTED_FIRMWARE_M_MODULE_DIR}/bl1/bl1_2/bl1_dummy_rotpk if it has not been changed on TF-M side for your board endif # TFM_BL1 @@ -281,7 +281,7 @@ config TFM_MCUBOOT_SIGNATURE_TYPE config TFM_KEY_FILE_S string "Path to private key used to sign secure firmware images." - default "$(ZEPHYR_TRUSTED_FIRMWARE_M_MODULE_DIR)/bl2/ext/mcuboot/root-${CONFIG_TFM_MCUBOOT_SIGNATURE_TYPE}.pem" + default "${ZEPHYR_TRUSTED_FIRMWARE_M_MODULE_DIR}/bl2/ext/mcuboot/root-${CONFIG_TFM_MCUBOOT_SIGNATURE_TYPE}.pem" help The path and filename for the .pem file containing the private key that should be used by the BL2 bootloader when signing secure @@ -290,7 +290,7 @@ config TFM_KEY_FILE_S config TFM_KEY_FILE_NS string "Path to private key used to sign non-secure firmware images." - default "$(ZEPHYR_TRUSTED_FIRMWARE_M_MODULE_DIR)/bl2/ext/mcuboot/root-${CONFIG_TFM_MCUBOOT_SIGNATURE_TYPE}_1.pem" + default "${ZEPHYR_TRUSTED_FIRMWARE_M_MODULE_DIR}/bl2/ext/mcuboot/root-${CONFIG_TFM_MCUBOOT_SIGNATURE_TYPE}_1.pem" help The path and filename for the .pem file containing the private key that should be used by the BL2 bootloader when signing non-secure @@ -334,7 +334,7 @@ endchoice config TFM_ETHOS_DRIVER_PATH_LOCAL string "Path to a locally available Ethos-U driver or an empty string" depends on SOC_SERIES_MPS3 || SOC_SERIES_MPS4 - default "$(ZEPHYR_HAL_ETHOS_U_MODULE_DIR)" + default "${ZEPHYR_HAL_ETHOS_U_MODULE_DIR}" help Path to a locally available Ethos-U driver to be used for TF-M builds or an empty string to allow TF-M to automatically fetch the Ethos-U diff --git a/samples/drivers/mbox/Kconfig.sysbuild b/samples/drivers/mbox/Kconfig.sysbuild index 5cffe27038fb..e5408e9bd4de 100644 --- a/samples/drivers/mbox/Kconfig.sysbuild +++ b/samples/drivers/mbox/Kconfig.sysbuild @@ -23,8 +23,8 @@ config REMOTE_BOARD default "nrf54lm20dk/nrf54lm20a/cpuflpr" if $(BOARD) = "nrf54lm20dk" default "ophelia4ev/cpuflpr" if $(BOARD) = "ophelia4ev" default "stm32h747i_disco/stm32h747xx/m4" if $(BOARD) = "stm32h747i_disco" - default "esp32_devkitc/esp32/appcpu" if "$(BOARD)$(BOARD_QUALIFIERS)" = "esp32_devkitc/esp32/procpu" - default "esp32s3_devkitm/esp32s3/appcpu" if "$(BOARD)$(BOARD_QUALIFIERS)" = "esp32s3_devkitm/esp32s3/procpu" - default "esp32c6_devkitc/esp32c6/lpcore" if "$(BOARD)$(BOARD_QUALIFIERS)" = "esp32c6_devkitc/esp32c6/hpcore" - default "bl54l15_dvk/nrf54l15/cpuflpr" if "$(BOARD)$(BOARD_QUALIFIERS)" = "bl54l15_dvk/nrf54l15/cpuapp" + default "esp32_devkitc/esp32/appcpu" if "$(BOARD)${BOARD_QUALIFIERS}" = "esp32_devkitc/esp32/procpu" + default "esp32s3_devkitm/esp32s3/appcpu" if "$(BOARD)${BOARD_QUALIFIERS}" = "esp32s3_devkitm/esp32s3/procpu" + default "esp32c6_devkitc/esp32c6/lpcore" if "$(BOARD)${BOARD_QUALIFIERS}" = "esp32c6_devkitc/esp32c6/hpcore" + default "bl54l15_dvk/nrf54l15/cpuflpr" if "$(BOARD)${BOARD_QUALIFIERS}" = "bl54l15_dvk/nrf54l15/cpuapp" default "bl54l15u_dvk/nrf54l15/cpuflpr" if $(BOARD) = "bl54l15u_dvk" diff --git a/samples/sysbuild/hello_world/Kconfig.sysbuild b/samples/sysbuild/hello_world/Kconfig.sysbuild index 53ed4507b760..edec01b94c98 100644 --- a/samples/sysbuild/hello_world/Kconfig.sysbuild +++ b/samples/sysbuild/hello_world/Kconfig.sysbuild @@ -1,7 +1,7 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -source "$(ZEPHYR_BASE)/share/sysbuild/Kconfig" +source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" config REMOTE_BOARD string "The board used for remote target" diff --git a/share/sysbuild/images/firmware_loader/Kconfig b/share/sysbuild/images/firmware_loader/Kconfig index 2ff27251b929..a5c4283ad5c6 100644 --- a/share/sysbuild/images/firmware_loader/Kconfig +++ b/share/sysbuild/images/firmware_loader/Kconfig @@ -32,6 +32,6 @@ config FIRMWARE_LOADER_IMAGE_NAME config FIRMWARE_LOADER_IMAGE_PATH string - default "$(ZEPHYR_BASE)/samples/subsys/mgmt/mcumgr/smp_svr" if FIRMWARE_LOADER_IMAGE_SMP_SVR + default "${ZEPHYR_BASE}/samples/subsys/mgmt/mcumgr/smp_svr" if FIRMWARE_LOADER_IMAGE_SMP_SVR help Source directory of firmware loader image. diff --git a/subsys/bluetooth/Kconfig.logging b/subsys/bluetooth/Kconfig.logging index 850fb9872302..7ccaf55c2d6b 100644 --- a/subsys/bluetooth/Kconfig.logging +++ b/subsys/bluetooth/Kconfig.logging @@ -358,7 +358,7 @@ endif # BT_VOCS_CLIENT if BT_PBP module = BT_PBP module-str = "Public Broadcast Profile" -source "$(ZEPHYR_BASE)/subsys/logging/Kconfig.template.log_config" +source "${ZEPHYR_BASE}/subsys/logging/Kconfig.template.log_config" endif # BT_PBP endmenu # Audio @@ -539,7 +539,7 @@ endif # BT_IAS_CLIENT if BT_IAS module = BT_IAS module-str = IAS -source "$(ZEPHYR_BASE)/subsys/logging/Kconfig.template.log_config" +source "${ZEPHYR_BASE}/subsys/logging/Kconfig.template.log_config" endif # BT_IAS # OTS (subsys/bluetooth/services/ots/Kconfig) @@ -553,7 +553,7 @@ endif # BT_OTS_CLIENT if BT_OTS module = BT_OTS module-str = BT_OTS -source "$(ZEPHYR_BASE)/subsys/logging/Kconfig.template.log_config" +source "${ZEPHYR_BASE}/subsys/logging/Kconfig.template.log_config" endif # BT_OTS endmenu # Services diff --git a/subsys/testsuite/Kconfig b/subsys/testsuite/Kconfig index 9e72a5696fdb..dd1aff5b6251 100644 --- a/subsys/testsuite/Kconfig +++ b/subsys/testsuite/Kconfig @@ -56,7 +56,7 @@ config COVERAGE_NATIVE_GCOV config COVERAGE_NATIVE_SOURCE bool "Host compiler source based code coverage" depends on NATIVE_BUILD - depends on "$(ZEPHYR_TOOLCHAIN_VARIANT)" = "llvm" + depends on "${ZEPHYR_TOOLCHAIN_VARIANT}" = "llvm" help Build natively with the compiler source based coverage options. Today this is only supported with LLVM diff --git a/tests/boards/nrf/nrfs/Kconfig.sysbuild b/tests/boards/nrf/nrfs/Kconfig.sysbuild index 6c4c8618f3ed..6cc7dc9575af 100644 --- a/tests/boards/nrf/nrfs/Kconfig.sysbuild +++ b/tests/boards/nrf/nrfs/Kconfig.sysbuild @@ -1,7 +1,7 @@ # Copyright (c) 2025 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -source "$(ZEPHYR_BASE)/share/sysbuild/Kconfig" +source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" config REMOTE_BOARD string diff --git a/tests/bsim/bluetooth/audio_samples/bap_broadcast_sink/Kconfig b/tests/bsim/bluetooth/audio_samples/bap_broadcast_sink/Kconfig index 2b474ba2a4ca..040286af18c7 100644 --- a/tests/bsim/bluetooth/audio_samples/bap_broadcast_sink/Kconfig +++ b/tests/bsim/bluetooth/audio_samples/bap_broadcast_sink/Kconfig @@ -1,4 +1,4 @@ # Copyright (c) 2023 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -source "$(ZEPHYR_BASE)/samples/bluetooth/bap_broadcast_sink/Kconfig" +source "${ZEPHYR_BASE}/samples/bluetooth/bap_broadcast_sink/Kconfig" diff --git a/tests/bsim/bluetooth/audio_samples/bap_broadcast_sink/Kconfig.sysbuild b/tests/bsim/bluetooth/audio_samples/bap_broadcast_sink/Kconfig.sysbuild index 5f0b50c75635..b6f4d0678e8b 100644 --- a/tests/bsim/bluetooth/audio_samples/bap_broadcast_sink/Kconfig.sysbuild +++ b/tests/bsim/bluetooth/audio_samples/bap_broadcast_sink/Kconfig.sysbuild @@ -1,7 +1,7 @@ # Copyright (c) 2023 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -source "$(ZEPHYR_BASE)/samples/bluetooth/bap_broadcast_sink/Kconfig.sysbuild" +source "${ZEPHYR_BASE}/samples/bluetooth/bap_broadcast_sink/Kconfig.sysbuild" config NATIVE_SIMULATOR_PRIMARY_MCU_INDEX int diff --git a/tests/bsim/bluetooth/audio_samples/bap_unicast_client/Kconfig.sysbuild b/tests/bsim/bluetooth/audio_samples/bap_unicast_client/Kconfig.sysbuild index 54467d2a2d2e..6db98670507d 100644 --- a/tests/bsim/bluetooth/audio_samples/bap_unicast_client/Kconfig.sysbuild +++ b/tests/bsim/bluetooth/audio_samples/bap_unicast_client/Kconfig.sysbuild @@ -1,7 +1,7 @@ # Copyright (c) 2023 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -source "$(ZEPHYR_BASE)/samples/bluetooth/bap_unicast_client/Kconfig.sysbuild" +source "${ZEPHYR_BASE}/samples/bluetooth/bap_unicast_client/Kconfig.sysbuild" config NATIVE_SIMULATOR_PRIMARY_MCU_INDEX int diff --git a/tests/bsim/bluetooth/audio_samples/cap/acceptor/Kconfig b/tests/bsim/bluetooth/audio_samples/cap/acceptor/Kconfig index 7c94a0933055..8a2dcf8e5ae0 100644 --- a/tests/bsim/bluetooth/audio_samples/cap/acceptor/Kconfig +++ b/tests/bsim/bluetooth/audio_samples/cap/acceptor/Kconfig @@ -1,4 +1,4 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -source "$(ZEPHYR_BASE)/samples/bluetooth/cap_acceptor/Kconfig" +source "${ZEPHYR_BASE}/samples/bluetooth/cap_acceptor/Kconfig" diff --git a/tests/bsim/bluetooth/audio_samples/cap/acceptor/Kconfig.sysbuild b/tests/bsim/bluetooth/audio_samples/cap/acceptor/Kconfig.sysbuild index a73e90e42883..3b2c35e65c55 100644 --- a/tests/bsim/bluetooth/audio_samples/cap/acceptor/Kconfig.sysbuild +++ b/tests/bsim/bluetooth/audio_samples/cap/acceptor/Kconfig.sysbuild @@ -1,7 +1,7 @@ # Copyright (c) 2023-2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -source "$(ZEPHYR_BASE)/samples/bluetooth/cap_acceptor/Kconfig.sysbuild" +source "${ZEPHYR_BASE}/samples/bluetooth/cap_acceptor/Kconfig.sysbuild" config NATIVE_SIMULATOR_PRIMARY_MCU_INDEX int diff --git a/tests/bsim/bluetooth/audio_samples/cap/initiator/Kconfig b/tests/bsim/bluetooth/audio_samples/cap/initiator/Kconfig index b21d8aad4906..7027c92b5900 100644 --- a/tests/bsim/bluetooth/audio_samples/cap/initiator/Kconfig +++ b/tests/bsim/bluetooth/audio_samples/cap/initiator/Kconfig @@ -1,4 +1,4 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -source "$(ZEPHYR_BASE)/samples/bluetooth/cap_initiator/Kconfig" +source "${ZEPHYR_BASE}/samples/bluetooth/cap_initiator/Kconfig" diff --git a/tests/bsim/bluetooth/audio_samples/cap/initiator/Kconfig.sysbuild b/tests/bsim/bluetooth/audio_samples/cap/initiator/Kconfig.sysbuild index fb7ee3a61da4..c9f3abf294f8 100644 --- a/tests/bsim/bluetooth/audio_samples/cap/initiator/Kconfig.sysbuild +++ b/tests/bsim/bluetooth/audio_samples/cap/initiator/Kconfig.sysbuild @@ -1,7 +1,7 @@ # Copyright (c) 2023-2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -source "$(ZEPHYR_BASE)/samples/bluetooth/cap_initiator/Kconfig.sysbuild" +source "${ZEPHYR_BASE}/samples/bluetooth/cap_initiator/Kconfig.sysbuild" config NATIVE_SIMULATOR_PRIMARY_MCU_INDEX int diff --git a/tests/bsim/bluetooth/audio_samples/ccp/call_control_client/Kconfig.sysbuild b/tests/bsim/bluetooth/audio_samples/ccp/call_control_client/Kconfig.sysbuild index fa711c8f6d32..2fdcdcf687c6 100644 --- a/tests/bsim/bluetooth/audio_samples/ccp/call_control_client/Kconfig.sysbuild +++ b/tests/bsim/bluetooth/audio_samples/ccp/call_control_client/Kconfig.sysbuild @@ -1,7 +1,7 @@ # Copyright (c) 2023-2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -source "$(ZEPHYR_BASE)/samples/bluetooth/ccp_call_control_client/Kconfig.sysbuild" +source "${ZEPHYR_BASE}/samples/bluetooth/ccp_call_control_client/Kconfig.sysbuild" config NATIVE_SIMULATOR_PRIMARY_MCU_INDEX int diff --git a/tests/bsim/bluetooth/audio_samples/ccp/call_control_server/Kconfig.sysbuild b/tests/bsim/bluetooth/audio_samples/ccp/call_control_server/Kconfig.sysbuild index 8fe269f15e14..f2b0bb8c607e 100644 --- a/tests/bsim/bluetooth/audio_samples/ccp/call_control_server/Kconfig.sysbuild +++ b/tests/bsim/bluetooth/audio_samples/ccp/call_control_server/Kconfig.sysbuild @@ -1,7 +1,7 @@ # Copyright (c) 2023-2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -source "$(ZEPHYR_BASE)/samples/bluetooth/ccp_call_control_server/Kconfig.sysbuild" +source "${ZEPHYR_BASE}/samples/bluetooth/ccp_call_control_server/Kconfig.sysbuild" config NATIVE_SIMULATOR_PRIMARY_MCU_INDEX int diff --git a/tests/bsim/bluetooth/samples/central_hr_peripheral_hr/Kconfig b/tests/bsim/bluetooth/samples/central_hr_peripheral_hr/Kconfig index 196e362034e0..e2cbc2de9177 100644 --- a/tests/bsim/bluetooth/samples/central_hr_peripheral_hr/Kconfig +++ b/tests/bsim/bluetooth/samples/central_hr_peripheral_hr/Kconfig @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 # source sample's Kconfig, if any -# source "$(ZEPHYR_BASE)/samples/bluetooth/central_hr/Kconfig" +# source "${ZEPHYR_BASE}/samples/bluetooth/central_hr/Kconfig" # OR # source Zephyr Kernel's Kconfig, as below (not both) menu "Zephyr Kernel" diff --git a/tests/bsim/bluetooth/samples/central_hr_peripheral_hr/Kconfig.sysbuild b/tests/bsim/bluetooth/samples/central_hr_peripheral_hr/Kconfig.sysbuild index c0dcdf6e24e0..8a4e25038c49 100644 --- a/tests/bsim/bluetooth/samples/central_hr_peripheral_hr/Kconfig.sysbuild +++ b/tests/bsim/bluetooth/samples/central_hr_peripheral_hr/Kconfig.sysbuild @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 # source the samples' Kconfig.sysbuild, if any -source "$(ZEPHYR_BASE)/samples/bluetooth/central_hr/Kconfig.sysbuild" +source "${ZEPHYR_BASE}/samples/bluetooth/central_hr/Kconfig.sysbuild" config NATIVE_SIMULATOR_PRIMARY_MCU_INDEX int diff --git a/tests/bsim/net/sockets/echo_test/Kconfig b/tests/bsim/net/sockets/echo_test/Kconfig index 2a5bde5e9d0c..7c48b4fca91d 100644 --- a/tests/bsim/net/sockets/echo_test/Kconfig +++ b/tests/bsim/net/sockets/echo_test/Kconfig @@ -1,4 +1,4 @@ # Copyright (c) 2023 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -source "$(ZEPHYR_BASE)/samples/net/sockets/echo_client/Kconfig" +source "${ZEPHYR_BASE}/samples/net/sockets/echo_client/Kconfig" diff --git a/tests/cmake/sysbuild_snippets/Kconfig.sysbuild b/tests/cmake/sysbuild_snippets/Kconfig.sysbuild index bf3fb5fc4b35..e36914325117 100644 --- a/tests/cmake/sysbuild_snippets/Kconfig.sysbuild +++ b/tests/cmake/sysbuild_snippets/Kconfig.sysbuild @@ -19,4 +19,4 @@ config EXPECTED_APP_TEST_FOO_VAL help Expected application value for the test. -source "$(ZEPHYR_BASE)/share/sysbuild/Kconfig" +source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/tests/subsys/ipc/ipc_sessions/Kconfig.sysbuild b/tests/subsys/ipc/ipc_sessions/Kconfig.sysbuild index ad83e2107b6c..3c064f59d525 100644 --- a/tests/subsys/ipc/ipc_sessions/Kconfig.sysbuild +++ b/tests/subsys/ipc/ipc_sessions/Kconfig.sysbuild @@ -4,7 +4,7 @@ # SPDX-License-Identifier: Apache-2.0 # -source "$(ZEPHYR_BASE)/share/sysbuild/Kconfig" +source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" config REMOTE_BOARD string "The board used for remote target" From 15698ffcd98f807a7ba75f007598b5a0459e09e5 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:27 +0300 Subject: [PATCH 0859/2141] Revert "[nrf fromtree] samples: mbox: Add support for ESP32C6" This reverts commit d550fd27201c099371377c1dbfae9ee03b22171b. Signed-off-by: Jukka Rissanen --- samples/drivers/mbox/CMakeLists.txt | 1 - samples/drivers/mbox/Kconfig.sysbuild | 1 - .../mbox/boards/esp32c6_devkitc_hpcore.conf | 1 - .../boards/esp32c6_devkitc_hpcore.overlay | 26 ------------------- samples/drivers/mbox/remote/CMakeLists.txt | 1 - .../boards/esp32c6_devkitc_lpcore.overlay | 26 ------------------- 6 files changed, 56 deletions(-) delete mode 100644 samples/drivers/mbox/boards/esp32c6_devkitc_hpcore.conf delete mode 100644 samples/drivers/mbox/boards/esp32c6_devkitc_hpcore.overlay delete mode 100644 samples/drivers/mbox/remote/boards/esp32c6_devkitc_lpcore.overlay diff --git a/samples/drivers/mbox/CMakeLists.txt b/samples/drivers/mbox/CMakeLists.txt index dc03717d2ce5..e5d5e612c79d 100644 --- a/samples/drivers/mbox/CMakeLists.txt +++ b/samples/drivers/mbox/CMakeLists.txt @@ -23,7 +23,6 @@ if(CONFIG_BOARD_NRF5340DK_NRF5340_CPUAPP OR CONFIG_BOARD_MCX_N9XX_EVK_MCXN947_CPU0 OR CONFIG_BOARD_ESP32_DEVKITC_ESP32_PROCPU OR CONFIG_BOARD_ESP32S3_DEVKITM_ESP32S3_PROCPU OR - CONFIG_BOARD_ESP32C6_DEVKITC_ESP32C6_HPCORE OR CONFIG_BOARD_NRF54H20DK_NRF54H20_CPUAPP OR CONFIG_BOARD_NRF54L09PDK_NRF54L09_CPUAPP OR CONFIG_BOARD_NRF54L15DK_NRF54L15_CPUAPP OR diff --git a/samples/drivers/mbox/Kconfig.sysbuild b/samples/drivers/mbox/Kconfig.sysbuild index e5408e9bd4de..2a79840f389b 100644 --- a/samples/drivers/mbox/Kconfig.sysbuild +++ b/samples/drivers/mbox/Kconfig.sysbuild @@ -25,6 +25,5 @@ config REMOTE_BOARD default "stm32h747i_disco/stm32h747xx/m4" if $(BOARD) = "stm32h747i_disco" default "esp32_devkitc/esp32/appcpu" if "$(BOARD)${BOARD_QUALIFIERS}" = "esp32_devkitc/esp32/procpu" default "esp32s3_devkitm/esp32s3/appcpu" if "$(BOARD)${BOARD_QUALIFIERS}" = "esp32s3_devkitm/esp32s3/procpu" - default "esp32c6_devkitc/esp32c6/lpcore" if "$(BOARD)${BOARD_QUALIFIERS}" = "esp32c6_devkitc/esp32c6/hpcore" default "bl54l15_dvk/nrf54l15/cpuflpr" if "$(BOARD)${BOARD_QUALIFIERS}" = "bl54l15_dvk/nrf54l15/cpuapp" default "bl54l15u_dvk/nrf54l15/cpuflpr" if $(BOARD) = "bl54l15u_dvk" diff --git a/samples/drivers/mbox/boards/esp32c6_devkitc_hpcore.conf b/samples/drivers/mbox/boards/esp32c6_devkitc_hpcore.conf deleted file mode 100644 index 7d425a10aa2c..000000000000 --- a/samples/drivers/mbox/boards/esp32c6_devkitc_hpcore.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_ULP_COPROC_ENABLED=y diff --git a/samples/drivers/mbox/boards/esp32c6_devkitc_hpcore.overlay b/samples/drivers/mbox/boards/esp32c6_devkitc_hpcore.overlay deleted file mode 100644 index a597cd0f12a7..000000000000 --- a/samples/drivers/mbox/boards/esp32c6_devkitc_hpcore.overlay +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2025 Espressif Systems (Shanghai) Co., Ltd. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - chosen { - zephyr,ipc_shm = &shmlp; - zephyr,ipc = &mbox0; - }; - - mbox-consumer { - compatible = "vnd,mbox-consumer"; - mboxes = <&mbox0 0>, <&mbox0 1>; - mbox-names = "tx", "rx"; - }; -}; - -&mbox0 { - status = "okay"; -}; - -&lp_uart { - status = "okay"; -}; diff --git a/samples/drivers/mbox/remote/CMakeLists.txt b/samples/drivers/mbox/remote/CMakeLists.txt index a2c07a2dd2a8..bd4c9e2e20e5 100644 --- a/samples/drivers/mbox/remote/CMakeLists.txt +++ b/samples/drivers/mbox/remote/CMakeLists.txt @@ -21,7 +21,6 @@ if(CONFIG_BOARD_NRF5340DK_NRF5340_CPUNET OR CONFIG_BOARD_MCX_N9XX_EVK_MCXN947_CPU1 OR CONFIG_BOARD_ESP32_DEVKITC_ESP32_APPCPU OR CONFIG_BOARD_ESP32S3_DEVKITM_ESP32S3_APPCPU OR - CONFIG_BOARD_ESP32C6_DEVKITC_ESP32C6_LPCORE OR CONFIG_BOARD_NRF54H20DK_NRF54H20_CPUPPR OR CONFIG_BOARD_NRF54H20DK_NRF54H20_CPUFLPR OR CONFIG_BOARD_NRF54H20DK_NRF54H20_CPURAD OR diff --git a/samples/drivers/mbox/remote/boards/esp32c6_devkitc_lpcore.overlay b/samples/drivers/mbox/remote/boards/esp32c6_devkitc_lpcore.overlay deleted file mode 100644 index 4717edbd985c..000000000000 --- a/samples/drivers/mbox/remote/boards/esp32c6_devkitc_lpcore.overlay +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2024 Felipe Neves. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - chosen { - zephyr,ipc_shm = &shmlp; - zephyr,ipc = &mbox0; - }; - - mbox-consumer { - compatible = "vnd,mbox-consumer"; - mboxes = <&mbox0 1>, <&mbox0 0>; - mbox-names = "tx", "rx"; - }; -}; - -&mbox0 { - status = "okay"; -}; - -&lp_uart { - status = "okay"; -}; From 56ee87d6a872bf2bfe2ccfecbaa5ff3e04c1ae21 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:27 +0300 Subject: [PATCH 0860/2141] Revert "[nrf fromtree] modules: ethos_u: arm: update for MPS4" This reverts commit 370ff7bb18ab2d78790006b8e3fee8586d57adf8. Signed-off-by: Jukka Rissanen --- modules/hal_ethos_u/Kconfig | 5 ++--- modules/trusted-firmware-m/Kconfig.tfm | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/modules/hal_ethos_u/Kconfig b/modules/hal_ethos_u/Kconfig index e7b045c23526..4ca5136cf023 100644 --- a/modules/hal_ethos_u/Kconfig +++ b/modules/hal_ethos_u/Kconfig @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Copyright 2021-2022, 2024-2025 Arm Limited and/or its +# SPDX-FileCopyrightText: Copyright 2021-2022, 2024 Arm Limited and/or its # affiliates # SPDX-License-Identifier: Apache-2.0 @@ -13,8 +13,7 @@ if ARM_ETHOS_U menu "Arm Ethos-U NPU configuration" choice ARM_ETHOS_U_NPU_CONFIG prompt "Arm Ethos-U NPU configuration" - default ARM_ETHOS_U55_128 if SOC_SERIES_MPS3 - default ARM_ETHOS_U85_256 if SOC_SERIES_MPS4 + default ARM_ETHOS_U55_128 config ARM_ETHOS_U55_64 bool "using Ethos-U55 with 64 macs" config ARM_ETHOS_U55_128 diff --git a/modules/trusted-firmware-m/Kconfig.tfm b/modules/trusted-firmware-m/Kconfig.tfm index 97591ac8a830..d1cf81f8f0ac 100644 --- a/modules/trusted-firmware-m/Kconfig.tfm +++ b/modules/trusted-firmware-m/Kconfig.tfm @@ -2,7 +2,7 @@ # Copyright (c) 2019, 2020 Linaro Limited # Copyright (c) 2020, 2021 Nordic Semiconductor ASA -# Copyright 2024-2025 Arm Limited and/or its affiliates +# Copyright 2024 Arm Limited and/or its affiliates # SPDX-License-Identifier: Apache-2.0 config ZEPHYR_TRUSTED_FIRMWARE_M_MODULE @@ -333,7 +333,7 @@ endchoice config TFM_ETHOS_DRIVER_PATH_LOCAL string "Path to a locally available Ethos-U driver or an empty string" - depends on SOC_SERIES_MPS3 || SOC_SERIES_MPS4 + depends on SOC_SERIES_MPS3 default "${ZEPHYR_HAL_ETHOS_U_MODULE_DIR}" help Path to a locally available Ethos-U driver to be used for TF-M builds or From d979e069dd271e15287c8904595406d78ddeb65d Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:27 +0300 Subject: [PATCH 0861/2141] Revert "[nrf fromtree] boards: mps4: Add initial support for corstone315" This reverts commit c7861ae07c2282aed1d25532b179bbf83a3102d4. Signed-off-by: Jukka Rissanen --- boards/arm/mps4/Kconfig.defconfig | 4 +- boards/arm/mps4/Kconfig.mps4 | 1 - boards/arm/mps4/board.cmake | 10 +- boards/arm/mps4/board.yml | 5 - boards/arm/mps4/mps4_corstone315_fvp.dts | 97 ----------------- boards/arm/mps4/mps4_corstone315_fvp.yaml | 26 ----- .../arm/mps4/mps4_corstone315_fvp_defconfig | 19 ---- boards/arm/mps4/mps4_corstone315_fvp_ns.dts | 102 ------------------ boards/arm/mps4/mps4_corstone315_fvp_ns.yaml | 15 --- .../mps4/mps4_corstone315_fvp_ns_defconfig | 19 ---- soc/arm/mps4/Kconfig | 12 --- .../mps4/Kconfig.defconfig.mps4_corstone315 | 9 -- soc/arm/mps4/Kconfig.soc | 5 - soc/arm/soc.yml | 1 - 14 files changed, 5 insertions(+), 320 deletions(-) delete mode 100644 boards/arm/mps4/mps4_corstone315_fvp.dts delete mode 100644 boards/arm/mps4/mps4_corstone315_fvp.yaml delete mode 100644 boards/arm/mps4/mps4_corstone315_fvp_defconfig delete mode 100644 boards/arm/mps4/mps4_corstone315_fvp_ns.dts delete mode 100644 boards/arm/mps4/mps4_corstone315_fvp_ns.yaml delete mode 100644 boards/arm/mps4/mps4_corstone315_fvp_ns_defconfig delete mode 100644 soc/arm/mps4/Kconfig.defconfig.mps4_corstone315 diff --git a/boards/arm/mps4/Kconfig.defconfig b/boards/arm/mps4/Kconfig.defconfig index 96cbd9472eae..b4e987753860 100644 --- a/boards/arm/mps4/Kconfig.defconfig +++ b/boards/arm/mps4/Kconfig.defconfig @@ -1,7 +1,7 @@ # Copyright 2025 Arm Limited and/or its affiliates # SPDX-License-Identifier: Apache-2.0 -if BOARD_MPS4_CORSTONE315_FVP || BOARD_MPS4_CORSTONE320_FVP +if BOARD_MPS4_CORSTONE320_FVP if SERIAL @@ -10,7 +10,7 @@ config UART_INTERRUPT_DRIVEN endif # SERIAL -if ROMSTART_RELOCATION_ROM && (BOARD_MPS4_CORSTONE315_FVP || BOARD_MPS4_CORSTONE320_FVP) +if ROMSTART_RELOCATION_ROM && BOARD_MPS4_CORSTONE320_FVP config ROMSTART_REGION_ADDRESS default $(dt_nodelabel_reg_addr_hex,itcm) diff --git a/boards/arm/mps4/Kconfig.mps4 b/boards/arm/mps4/Kconfig.mps4 index 46ce14cc0620..ffb494cf3377 100644 --- a/boards/arm/mps4/Kconfig.mps4 +++ b/boards/arm/mps4/Kconfig.mps4 @@ -3,5 +3,4 @@ config BOARD_MPS4 select SOC_SERIES_MPS4 - select SOC_MPS4_CORSTONE315 if BOARD_MPS4_CORSTONE315_FVP || BOARD_MPS4_CORSTONE315_FVP_NS select SOC_MPS4_CORSTONE320 if BOARD_MPS4_CORSTONE320_FVP || BOARD_MPS4_CORSTONE320_FVP_NS diff --git a/boards/arm/mps4/board.cmake b/boards/arm/mps4/board.cmake index 4e5044ab1b7c..6497c65c4260 100644 --- a/boards/arm/mps4/board.cmake +++ b/boards/arm/mps4/board.cmake @@ -7,15 +7,10 @@ # -if(CONFIG_BOARD_MPS4_CORSTONE315_FVP OR CONFIG_BOARD_MPS4_CORSTONE315_FVP_NS) - set(SUPPORTED_EMU_PLATFORMS armfvp) - set(ARMFVP_BIN_NAME FVP_Corstone_SSE-315) -elseif(CONFIG_BOARD_MPS4_CORSTONE320_FVP OR CONFIG_BOARD_MPS4_CORSTONE320_FVP_NS) +if(CONFIG_BOARD_MPS4_CORSTONE320_FVP OR CONFIG_BOARD_MPS4_CORSTONE320_FVP_NS) set(SUPPORTED_EMU_PLATFORMS armfvp) set(ARMFVP_BIN_NAME FVP_Corstone_SSE-320) -endif() - -if(CONFIG_BOARD_MPS4_CORSTONE315_FVP OR CONFIG_BOARD_MPS4_CORSTONE320_FVP) + if(CONFIG_BOARD_MPS4_CORSTONE320_FVP) set(ARMFVP_FLAGS # default is '0x11000000' but should match cpu.INITSVTOR which is 0. -C mps4_board.subsystem.iotss3_systemcontrol.INITSVTOR_RST=0 @@ -24,6 +19,7 @@ if(CONFIG_BOARD_MPS4_CORSTONE315_FVP OR CONFIG_BOARD_MPS4_CORSTONE320_FVP) # few MPU tests to fail. -C mps4_board.subsystem.cpu0.MPU_S=16 ) + endif() endif() if(CONFIG_BUILD_WITH_TFM) diff --git a/boards/arm/mps4/board.yml b/boards/arm/mps4/board.yml index 760321039f6d..8c2b411846fb 100644 --- a/boards/arm/mps4/board.yml +++ b/boards/arm/mps4/board.yml @@ -3,11 +3,6 @@ board: full_name: MPS4 vendor: arm socs: - - name: 'corstone315' - variants: - - name: 'fvp' - variants: - - name: 'ns' - name: 'corstone320' variants: - name: 'fvp' diff --git a/boards/arm/mps4/mps4_corstone315_fvp.dts b/boards/arm/mps4/mps4_corstone315_fvp.dts deleted file mode 100644 index 98c87ce7ed7a..000000000000 --- a/boards/arm/mps4/mps4_corstone315_fvp.dts +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright 2025 Arm Limited and/or its affiliates - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/dts-v1/; - -#include -#include -#include -#include - -/ { - compatible = "arm,mps4-fvp"; - #address-cells = <1>; - #size-cells = <1>; - - chosen { - zephyr,console = &uart0; - zephyr,shell-uart = &uart0; - zephyr,sram = &sram; - zephyr,flash = &isram; - }; - - cpus { - #address-cells = <1>; - #size-cells = <0>; - - cpu@0 { - device_type = "cpu"; - compatible = "arm,cortex-m85"; - reg = <0>; - #address-cells = <1>; - #size-cells = <1>; - - mpu: mpu@e000ed90 { - compatible = "arm,armv8.1m-mpu"; - reg = <0xe000ed90 0x40>; - }; - }; - }; - - ethosu { - #address-cells = <1>; - #size-cells = <0>; - interrupt-parent = <&nvic>; - - ethosu0: ethosu@50004000 { - compatible = "arm,ethos-u"; - reg = <0x50004000>; - interrupts = <16 3>; - secure-enable; - privilege-enable; - status = "okay"; - }; - }; - - /* We utilize the secure addresses, if you subtract 0x10000000 - * you'll get the non-secure alias - */ - itcm: itcm@10000000 { /* alias @ 0x0 */ - compatible = "zephyr,memory-region"; - reg = <0x10000000 DT_SIZE_K(32)>; - zephyr,memory-region = "ITCM"; - }; - - sram: sram@12000000 { /* alias @ 0x01000000 */ - compatible = "zephyr,memory-region", "mmio-sram"; - reg = <0x12000000 DT_SIZE_M(2)>; - zephyr,memory-region = "SRAM"; - }; - - dtcm: dtcm@30000000 { /* alias @ 0x20000000 */ - compatible = "zephyr,memory-region"; - reg = <0x30000000 DT_SIZE_K(32)>; - zephyr,memory-region = "DTCM"; - }; - - isram: sram@31000000 { /* alias @ 0x21000000 */ - compatible = "zephyr,memory-region", "mmio-sram"; - reg = <0x31000000 DT_SIZE_M(4)>; - zephyr,memory-region = "ISRAM"; - }; - - soc { - peripheral@50000000 { - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x50000000 0x10000000>; - - #include "mps4_common_soc_peripheral.dtsi" - }; - }; -}; - -#include "mps4_common.dtsi" diff --git a/boards/arm/mps4/mps4_corstone315_fvp.yaml b/boards/arm/mps4/mps4_corstone315_fvp.yaml deleted file mode 100644 index 4af1421bcbc6..000000000000 --- a/boards/arm/mps4/mps4_corstone315_fvp.yaml +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright 2025 Arm Limited and/or its affiliates -# SPDX-License-Identifier: Apache-2.0 - -identifier: mps4/corstone315/fvp -name: Arm MPS4-Corstone315-FVP -type: mcu -arch: arm -ram: 2048 -flash: 4096 -simulation: - - name: armfvp - exec: FVP_Corstone_SSE-315 -toolchain: - - gnuarmemb - - zephyr -supported: - - gpio -testing: - default: true - timeout_multiplier: 4 - ignore_tags: - - drivers - - bluetooth - - net - - timer -vendor: arm diff --git a/boards/arm/mps4/mps4_corstone315_fvp_defconfig b/boards/arm/mps4/mps4_corstone315_fvp_defconfig deleted file mode 100644 index 26d5a732e493..000000000000 --- a/boards/arm/mps4/mps4_corstone315_fvp_defconfig +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2025 Arm Limited and/or its affiliates -# SPDX-License-Identifier: Apache-2.0 - -CONFIG_RUNTIME_NMI=y -CONFIG_ARM_TRUSTZONE_M=y -CONFIG_ARM_MPU=y - -# GPIOs -CONFIG_GPIO=y - -# Serial -CONFIG_CONSOLE=y -CONFIG_UART_CONSOLE=y -CONFIG_SERIAL=y - -# Build a Secure firmware image -CONFIG_TRUSTED_EXECUTION_SECURE=y -# ROMSTART_REGION address and size are defined in Kconfig.defconfig -CONFIG_ROMSTART_RELOCATION_ROM=y diff --git a/boards/arm/mps4/mps4_corstone315_fvp_ns.dts b/boards/arm/mps4/mps4_corstone315_fvp_ns.dts deleted file mode 100644 index cb5a38baf47d..000000000000 --- a/boards/arm/mps4/mps4_corstone315_fvp_ns.dts +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright 2025 Arm Limited and/or its affiliates - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/dts-v1/; - -#include -#include -#include -#include - -/ { - compatible = "arm,mps4-fvp"; - #address-cells = <1>; - #size-cells = <1>; - - chosen { - zephyr,console = &uart0; - zephyr,shell-uart = &uart0; - zephyr,sram = &ram; - zephyr,flash = &code; - }; - - cpus { - #address-cells = <1>; - #size-cells = <0>; - - cpu@0 { - device_type = "cpu"; - compatible = "arm,cortex-m85"; - reg = <0>; - #address-cells = <1>; - #size-cells = <1>; - - mpu: mpu@e000ed90 { - compatible = "arm,armv8.1m-mpu"; - reg = <0xe000ed90 0x40>; - }; - }; - }; - - /* We utilize the non-secure addresses, if you add 0x10000000 - * you'll get the secure alias - */ - itcm: itcm@0 { - compatible = "zephyr,memory-region"; - reg = <0x0 DT_SIZE_K(32)>; - zephyr,memory-region = "ITCM"; - }; - - sram: sram@1000000 { - compatible = "zephyr,memory-region", "mmio-sram"; - reg = <0x1000000 DT_SIZE_M(2)>; - zephyr,memory-region = "SRAM"; - }; - - dtcm: dtcm@20000000 { - compatible = "zephyr,memory-region"; - reg = <0x20000000 DT_SIZE_K(512)>; - zephyr,memory-region = "DTCM"; - }; - - isram: sram@21000000 { - compatible = "zephyr,memory-region", "mmio-sram"; - reg = <0x21000000 DT_SIZE_M(4)>; - zephyr,memory-region = "ISRAM"; - }; - - reserved-memory { - #address-cells = <1>; - #size-cells = <1>; - ranges; - - /* The memory regions defined below must match what the TF-M - * project has defined for that board - a single image boot is - * assumed. Please see the memory layout in: - * https://git.trustedfirmware.org/plugins/gitiles/TF-M/trusted-firmware-m.git/+/HEAD/platform/ext/target/arm/mps4/common/partition/flash_layout.h - */ - - code: memory@28080000 { - reg = <0x28080000 DT_SIZE_K(512)>; - }; - - ram: memory@21020000 { - reg = <0x21020000 DT_SIZE_M(1)>; - }; - }; - - soc { - peripheral@40000000 { - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x40000000 0x10000000>; - - #include "mps4_common_soc_peripheral.dtsi" - }; - }; -}; - -#include "mps4_common.dtsi" diff --git a/boards/arm/mps4/mps4_corstone315_fvp_ns.yaml b/boards/arm/mps4/mps4_corstone315_fvp_ns.yaml deleted file mode 100644 index 01bee24100a2..000000000000 --- a/boards/arm/mps4/mps4_corstone315_fvp_ns.yaml +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright 2025 Arm Limited and/or its affiliates -# SPDX-License-Identifier: Apache-2.0 - -identifier: mps4/corstone315/fvp/ns -name: Arm MPS4-Corstone315-FVP_ns -type: mcu -arch: arm -ram: 1024 -flash: 512 -toolchain: - - gnuarmemb - - zephyr -testing: - only_tags: - - trusted-firmware-m diff --git a/boards/arm/mps4/mps4_corstone315_fvp_ns_defconfig b/boards/arm/mps4/mps4_corstone315_fvp_ns_defconfig deleted file mode 100644 index d59d419011b0..000000000000 --- a/boards/arm/mps4/mps4_corstone315_fvp_ns_defconfig +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2025 Arm Limited and/or its affiliates -# SPDX-License-Identifier: Apache-2.0 - -CONFIG_ARM_TRUSTZONE_M=y -CONFIG_RUNTIME_NMI=y -CONFIG_ARM_MPU=y - -# GPIOs -CONFIG_GPIO=y - -# Serial -CONFIG_CONSOLE=y -CONFIG_UART_CONSOLE=y -CONFIG_SERIAL=y - -# Build a Non-secure firmware image -CONFIG_TRUSTED_EXECUTION_SECURE=n -CONFIG_TRUSTED_EXECUTION_NONSECURE=y -CONFIG_BUILD_WITH_TFM=y diff --git a/soc/arm/mps4/Kconfig b/soc/arm/mps4/Kconfig index ea733d1566dc..0054f715208f 100644 --- a/soc/arm/mps4/Kconfig +++ b/soc/arm/mps4/Kconfig @@ -5,17 +5,6 @@ config SOC_SERIES_MPS4 select ARM select GPIO_MMIO32 if GPIO -config SOC_MPS4_CORSTONE315 - select CPU_CORTEX_M85 - select CPU_HAS_ARM_SAU - select CPU_HAS_ARM_MPU - select CPU_HAS_FPU - select ARMV8_M_DSP - select ARMV8_1_M_MVEI - select ARMV8_1_M_MVEF - select ARMV8_1_M_PMU - select ARM_MPU_PXN if ARM_MPU - config SOC_MPS4_CORSTONE320 select CPU_CORTEX_M85 select CPU_HAS_ARM_SAU @@ -29,5 +18,4 @@ config SOC_MPS4_CORSTONE320 config ARMV8_1_M_PMU_EVENTCNT int - default 8 if SOC_MPS4_CORSTONE315 default 8 if SOC_MPS4_CORSTONE320 diff --git a/soc/arm/mps4/Kconfig.defconfig.mps4_corstone315 b/soc/arm/mps4/Kconfig.defconfig.mps4_corstone315 deleted file mode 100644 index 191b5d45df44..000000000000 --- a/soc/arm/mps4/Kconfig.defconfig.mps4_corstone315 +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright 2025 Arm Limited and/or its affiliates -# SPDX-License-Identifier: Apache-2.0 - -if SOC_MPS4_CORSTONE315 - -config NUM_IRQS - default 232 - -endif diff --git a/soc/arm/mps4/Kconfig.soc b/soc/arm/mps4/Kconfig.soc index 98087bb36763..a557d287f0e8 100644 --- a/soc/arm/mps4/Kconfig.soc +++ b/soc/arm/mps4/Kconfig.soc @@ -10,14 +10,9 @@ config SOC_SERIES_MPS4 config SOC_SERIES default "mps4" if SOC_SERIES_MPS4 -config SOC_MPS4_CORSTONE315 - bool - select SOC_SERIES_MPS4 - config SOC_MPS4_CORSTONE320 bool select SOC_SERIES_MPS4 config SOC - default "corstone315" if SOC_MPS4_CORSTONE315 default "corstone320" if SOC_MPS4_CORSTONE320 diff --git a/soc/arm/soc.yml b/soc/arm/soc.yml index 821da33e9cf9..2caf077656a9 100644 --- a/soc/arm/soc.yml +++ b/soc/arm/soc.yml @@ -17,7 +17,6 @@ family: - name: corstone310 - name: mps4 socs: - - name: corstone315 - name: corstone320 - name: musca socs: From 08fc918b75f60cdf5ac9ae4b42c7b6f27e7a488e Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:27 +0300 Subject: [PATCH 0862/2141] Revert "[nrf fromtree] pinctrl: add support for mps4" This reverts commit a11bf865174f193c117476c330f60e6a4a6ffc59. Signed-off-by: Jukka Rissanen --- boards/arm/mps4/mps4-pinctrl.dtsi | 68 --------------- boards/arm/mps4/mps4_common.dtsi | 2 - .../arm/mps4/mps4_common_soc_peripheral.dtsi | 9 -- drivers/pinctrl/CMakeLists.txt | 1 - drivers/pinctrl/Kconfig | 1 - drivers/pinctrl/Kconfig.arm_mps4 | 9 -- drivers/pinctrl/pinctrl_arm_mps4.c | 36 -------- dts/bindings/pinctrl/arm,mps4-pinctrl.yaml | 82 ------------------- .../dt-bindings/pinctrl/arm-mps4-pinctrl.h | 40 --------- soc/arm/mps4/pinctrl_soc.h | 51 ------------ 10 files changed, 299 deletions(-) delete mode 100644 boards/arm/mps4/mps4-pinctrl.dtsi delete mode 100644 drivers/pinctrl/Kconfig.arm_mps4 delete mode 100644 drivers/pinctrl/pinctrl_arm_mps4.c delete mode 100644 dts/bindings/pinctrl/arm,mps4-pinctrl.yaml delete mode 100644 include/zephyr/dt-bindings/pinctrl/arm-mps4-pinctrl.h delete mode 100644 soc/arm/mps4/pinctrl_soc.h diff --git a/boards/arm/mps4/mps4-pinctrl.dtsi b/boards/arm/mps4/mps4-pinctrl.dtsi deleted file mode 100644 index e8b7e7207037..000000000000 --- a/boards/arm/mps4/mps4-pinctrl.dtsi +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2025 Arm Limited and/or its affiliates - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include - -&pinctrl { - /omit-if-no-ref/ uart3_default: uart3_default { - group1 { - pinmux = ; - }; - - group2 { - pinmux = ; - input-enable; - }; - }; - - /omit-if-no-ref/ uart4_default: uart4_default { - group1 { - pinmux = ; - }; - - group2 { - pinmux = ; - input-enable; - }; - }; - - /omit-if-no-ref/ spi3_default: spi3_default { - group1 { - pinmux = , , - ; - }; - - group2 { - pinmux = ; - input-enable; - }; - }; - - /omit-if-no-ref/ spi4_default: spi4_default { - group1 { - pinmux = , , ; - }; - - group2 { - pinmux = ; - input-enable; - }; - }; - - /omit-if-no-ref/ sbcon2_default: sbcon2_default { - group1 { - pinmux = , ; - input-enable; - }; - }; - - /omit-if-no-ref/ sbcon3_default: sbcon3_default { - group1 { - pinmux = , ; - input-enable; - }; - }; -}; diff --git a/boards/arm/mps4/mps4_common.dtsi b/boards/arm/mps4/mps4_common.dtsi index ad97dae06af5..c2958fc5c075 100644 --- a/boards/arm/mps4/mps4_common.dtsi +++ b/boards/arm/mps4/mps4_common.dtsi @@ -117,5 +117,3 @@ &nvic { arm,num-irq-priority-bits = <3>; }; - -#include "mps4-pinctrl.dtsi" diff --git a/boards/arm/mps4/mps4_common_soc_peripheral.dtsi b/boards/arm/mps4/mps4_common_soc_peripheral.dtsi index 6cc3f405ea76..d94339e4c05c 100644 --- a/boards/arm/mps4/mps4_common_soc_peripheral.dtsi +++ b/boards/arm/mps4/mps4_common_soc_peripheral.dtsi @@ -187,8 +187,6 @@ uart3: uart@8206000 { interrupt-names = "tx", "rx"; clocks = <&sysclk>; current-speed = <115200>; - pinctrl-0 = <&uart3_default>; - pinctrl-names = "default"; }; uart4: uart@8207000 { @@ -198,8 +196,6 @@ uart4: uart@8207000 { interrupt-names = "tx", "rx"; clocks = <&sysclk>; current-speed = <115200>; - pinctrl-0 = <&uart4_default>; - pinctrl-names = "default"; }; uart5: uart@8208000 { @@ -211,8 +207,3 @@ uart5: uart@8208000 { clocks = <&sysclk>; current-speed = <115200>; }; - -pinctrl: pinctrl { - compatible = "arm,mps4-pinctrl"; - status = "okay"; -}; diff --git a/drivers/pinctrl/CMakeLists.txt b/drivers/pinctrl/CMakeLists.txt index 839c288c394e..b325217c6a92 100644 --- a/drivers/pinctrl/CMakeLists.txt +++ b/drivers/pinctrl/CMakeLists.txt @@ -8,7 +8,6 @@ zephyr_library_sources_ifdef(CONFIG_PINCTRL_TELINK_B91 pinctrl_b91.c) zephyr_library_sources_ifdef(CONFIG_PINCTRL_AMBIQ pinctrl_ambiq.c) zephyr_library_sources_ifdef(CONFIG_PINCTRL_ARM_MPS2 pinctrl_arm_mps2.c) zephyr_library_sources_ifdef(CONFIG_PINCTRL_ARM_MPS3 pinctrl_arm_mps3.c) -zephyr_library_sources_ifdef(CONFIG_PINCTRL_ARM_MPS4 pinctrl_arm_mps4.c) zephyr_library_sources_ifdef(CONFIG_PINCTRL_ARM_V2M_BEETLE pinctrl_arm_v2m_beetle.c) zephyr_library_sources_ifdef(CONFIG_PINCTRL_BFLB pinctrl_bflb.c) zephyr_library_sources_ifdef(CONFIG_PINCTRL_GD32_AF pinctrl_gd32_af.c) diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig index e13c4e427ff7..a47c4392a78a 100644 --- a/drivers/pinctrl/Kconfig +++ b/drivers/pinctrl/Kconfig @@ -39,7 +39,6 @@ source "drivers/pinctrl/Kconfig.bflb" source "drivers/pinctrl/Kconfig.ambiq" source "drivers/pinctrl/Kconfig.arm_mps2" source "drivers/pinctrl/Kconfig.arm_mps3" -source "drivers/pinctrl/Kconfig.arm_mps4" source "drivers/pinctrl/Kconfig.arm_v2m_beetle" source "drivers/pinctrl/Kconfig.gd32" source "drivers/pinctrl/Kconfig.it8xxx2" diff --git a/drivers/pinctrl/Kconfig.arm_mps4 b/drivers/pinctrl/Kconfig.arm_mps4 deleted file mode 100644 index ab610a411bae..000000000000 --- a/drivers/pinctrl/Kconfig.arm_mps4 +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright 2025 Arm Limited and/or its affiliates -# SPDX-License-Identifier: Apache-2.0 - -config PINCTRL_ARM_MPS4 - bool "Arm MPS4 pin controller driver" - default y - depends on DT_HAS_ARM_MPS4_PINCTRL_ENABLED - help - Arm MPS4 pinctrl driver diff --git a/drivers/pinctrl/pinctrl_arm_mps4.c b/drivers/pinctrl/pinctrl_arm_mps4.c deleted file mode 100644 index 3a0215b53e60..000000000000 --- a/drivers/pinctrl/pinctrl_arm_mps4.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2025 Arm Limited and/or its affiliates - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include "zephyr/device.h" -#include "zephyr/drivers/gpio.h" -#include -#include -#include - -static const struct device *const gpio_ports[] = {DEVICE_DT_GET_OR_NULL(DT_NODELABEL(gpio0)), - DEVICE_DT_GET_OR_NULL(DT_NODELABEL(gpio1))}; - -static int pinctrl_configure_pin(const pinctrl_soc_pin_t *pin) -{ - uint32_t flags = pin->input_enable ? GPIO_INPUT : GPIO_OUTPUT; - - /* Each gpio has 16 pins, so divide by 16 to get specific gpio*/ - const struct device *gpio_dev = gpio_ports[pin->pin_num >> 4]; - - return cmsdk_ahb_gpio_config(gpio_dev, pin->pin_num % 16, flags); -} - -int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, uintptr_t reg) -{ - ARG_UNUSED(reg); - for (uint8_t i = 0U; i < pin_cnt; i++) { - if (pinctrl_configure_pin(&pins[i]) == -ENOTSUP) { - return -ENOTSUP; - } - } - - return 0; -} diff --git a/dts/bindings/pinctrl/arm,mps4-pinctrl.yaml b/dts/bindings/pinctrl/arm,mps4-pinctrl.yaml deleted file mode 100644 index d08e37cdab2b..000000000000 --- a/dts/bindings/pinctrl/arm,mps4-pinctrl.yaml +++ /dev/null @@ -1,82 +0,0 @@ -# Copyright 2025 Arm Limited and/or its affiliates -# SPDX-License-Identifier: Apache-2.0 - -description: | - The Arm Mps4 pin controller is a node responsible for controlling - pin function selection and pin properties, such as routing a UART3 TX - to pin 1. - - The node has the 'pinctrl' node label set in your SoC's devicetree, - so you can modify it like this: - - &pinctrl { - /* your modifications go here */ - }; - - All device pin configurations should be placed in child nodes of the - 'pinctrl' node, as shown in this example: - - &pinctrl { - /* configuration for the usart0 "default" state */ - uart3_default: uart3_default { - /* group 1 */ - group1 { - /* configure P1 as UART3 TX */ - pinmux = ; - }; - /* group 2 */ - group2 { - /* configure P0 as UART3 RX */ - pinmux = ; - /* enable input on pin 1 */ - input-enable; - }; - }; - }; - - The 'uart3_default' child node encodes the pin configurations for a - particular state of a device; in this case, the default (that is, active) - state. - - As shown, pin configurations are organized in groups within each child node. - Each group can specify a list of pin function selections in the 'pinmux' - property. Here is a list of supported standard pin properties: - - input-enable - - A group can also specify shared pin properties common to all the specified - pins, such as the 'input-enable' property in group 2. - - To link pin configurations with a device, use a pinctrl-N property for some - number N, like this example you could place in your board's DTS file: - - #include "board-pinctrl.dtsi" - - &uart3 { - pinctrl-0 = <&uart3_default>; - pinctrl-1 = <&uart3_sleep>; - pinctrl-names = "default", "sleep"; - }; - - -compatible: "arm,mps4-pinctrl" - -include: base.yaml - -child-binding: - description: | - Definitions for a pinctrl state. - child-binding: - - include: - - name: pincfg-node.yaml - property-allowlist: - - input-enable - - properties: - pinmux: - required: true - type: array - description: | - An array of pins sharing the same group properties. Each - element of the array is an integer constructed from the - pin number and the alternative function of the pin. diff --git a/include/zephyr/dt-bindings/pinctrl/arm-mps4-pinctrl.h b/include/zephyr/dt-bindings/pinctrl/arm-mps4-pinctrl.h deleted file mode 100644 index a2d211499a76..000000000000 --- a/include/zephyr/dt-bindings/pinctrl/arm-mps4-pinctrl.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2025 Arm Limited and/or its affiliates - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#define MPS4_ALT_FUNC_POS 0 -#define MPS4_ALT_FUNC_MASK 0x7 - -#define MPS4_EXP_NUM_POS 3 -#define MPS4_EXP_NUM_MASK 0x1F8 - -#define MPS4_PINCTRL_FUNC_UART 0 -#define MPS4_PINCTRL_FUNC_GPIO 1 -#define MPS4_PINCTRL_FUNC_I2C 2 -#define MPS4_PINCTRL_FUNC_SPI 3 - -#define MPS4_PINMUX(alt_func, exp_num) (exp_num << MPS4_EXP_NUM_POS | \ - alt_func << MPS4_ALT_FUNC_POS) - -/* GPIO 0 */ -#define UART3_RXD_EXP MPS4_PINMUX(MPS4_PINCTRL_FUNC_UART, 0) -#define UART3_TXD_EXP MPS4_PINMUX(MPS4_PINCTRL_FUNC_UART, 1) -#define SPI3_SS_EXP MPS4_PINMUX(MPS4_PINCTRL_FUNC_SPI, 10) -#define SPI3_MOSI_EXP MPS4_PINMUX(MPS4_PINCTRL_FUNC_SPI, 11) -#define SPI3_MISO_EXP MPS4_PINMUX(MPS4_PINCTRL_FUNC_SPI, 12) -#define SPI3_SCK_EXP MPS4_PINMUX(MPS4_PINCTRL_FUNC_SPI, 13) -#define SBCON2_SDA_EXP MPS4_PINMUX(MPS4_PINCTRL_FUNC_I2C, 14) -#define SBCON2_SCL_EXP MPS4_PINMUX(MPS4_PINCTRL_FUNC_I2C, 15) - - -/* GPIO 1 */ -#define UART4_RXD_EXP MPS4_PINMUX(MPS4_PINCTRL_FUNC_UART, 16) -#define UART4_TXD_EXP MPS4_PINMUX(MPS4_PINCTRL_FUNC_UART, 17) -#define SPI4_SS_EXP MPS4_PINMUX(MPS4_PINCTRL_FUNC_SPI, 26) -#define SPI4_MOSI_EXP MPS4_PINMUX(MPS4_PINCTRL_FUNC_SPI, 27) -#define SPI4_MISO_EXP MPS4_PINMUX(MPS4_PINCTRL_FUNC_SPI, 28) -#define SPI4_SCK_EXP MPS4_PINMUX(MPS4_PINCTRL_FUNC_SPI, 29) -#define SBCON3_SDA_EXP MPS4_PINMUX(MPS4_PINCTRL_FUNC_I2C, 30) -#define SBCON3_SCL_EXP MPS4_PINMUX(MPS4_PINCTRL_FUNC_I2C, 31) diff --git a/soc/arm/mps4/pinctrl_soc.h b/soc/arm/mps4/pinctrl_soc.h deleted file mode 100644 index a88e0cee7df6..000000000000 --- a/soc/arm/mps4/pinctrl_soc.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2025 Arm Limited and/or its affiliates - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include - -/** - * @brief Type to hold a pin's pinctrl configuration. - */ -struct mps4_pinctrl_soc_pin { - /** Pin number 0..52 */ - uint32_t pin_num : 6; - /** Alternative function (UART, SPI, etc.) */ - uint32_t alt_func : 3; - /** Enable the pin as an input */ - uint32_t input_enable : 1; -}; - -typedef struct mps4_pinctrl_soc_pin pinctrl_soc_pin_t; - -/** - * @brief Utility macro to initialize each pin. - * - * @param node_id Node identifier. - * @param prop Property name. - * @param idx Property entry index. - */ -#define Z_PINCTRL_STATE_PIN_INIT(node_id, prop, idx) \ - { \ - MPS4_GET_PIN_NUM(DT_PROP_BY_IDX(node_id, prop, idx)), \ - MPS4_GET_PIN_ALT_FUNC(DT_PROP_BY_IDX(node_id, prop, idx)), \ - DT_PROP(node_id, input_enable), \ - }, - -/** - * @brief Utility macro to initialize state pins contained in a given property. - * - * @param node_id Node identifier. - * @param prop Property name describing state pins. - */ -#define Z_PINCTRL_STATE_PINS_INIT(node_id, prop) \ - {DT_FOREACH_CHILD_VARGS(DT_PHANDLE(node_id, prop), \ - DT_FOREACH_PROP_ELEM, pinmux, \ - Z_PINCTRL_STATE_PIN_INIT)} - -#define MPS4_GET_PIN_NUM(pinctrl) \ - (((pinctrl) >> MPS4_EXP_NUM_POS) & MPS4_EXP_NUM_MASK) -#define MPS4_GET_PIN_ALT_FUNC(pinctrl) \ - (((pinctrl) >> MPS4_ALT_FUNC_POS) & MPS4_ALT_FUNC_MASK) From 5911bb1922575d0b6227f1be74e3fc70eacd73f4 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:27 +0300 Subject: [PATCH 0863/2141] Revert "[nrf fromtree] boards: arm: add support for MPS4 Corstone-320" This reverts commit e3f5d4388cbe0cfb72220414db48ac7cac472456. Signed-off-by: Jukka Rissanen --- boards/arm/mps4/Kconfig.defconfig | 23 -- boards/arm/mps4/Kconfig.mps4 | 6 - boards/arm/mps4/board.cmake | 45 ---- boards/arm/mps4/board.yml | 10 - boards/arm/mps4/mps4_common.dtsi | 119 ---------- .../arm/mps4/mps4_common_soc_peripheral.dtsi | 209 ------------------ boards/arm/mps4/mps4_corstone320_fvp.dts | 97 -------- boards/arm/mps4/mps4_corstone320_fvp.yaml | 25 --- .../arm/mps4/mps4_corstone320_fvp_defconfig | 19 -- boards/arm/mps4/mps4_corstone320_fvp_ns.dts | 102 --------- boards/arm/mps4/mps4_corstone320_fvp_ns.yaml | 15 -- .../mps4/mps4_corstone320_fvp_ns_defconfig | 19 -- soc/arm/mps4/CMakeLists.txt | 6 - soc/arm/mps4/Kconfig | 21 -- soc/arm/mps4/Kconfig.defconfig | 11 - .../mps4/Kconfig.defconfig.mps4_corstone320 | 9 - soc/arm/mps4/Kconfig.soc | 18 -- soc/arm/mps4/soc.h | 12 - soc/arm/soc.yml | 3 - 19 files changed, 769 deletions(-) delete mode 100644 boards/arm/mps4/Kconfig.defconfig delete mode 100644 boards/arm/mps4/Kconfig.mps4 delete mode 100644 boards/arm/mps4/board.cmake delete mode 100644 boards/arm/mps4/board.yml delete mode 100644 boards/arm/mps4/mps4_common.dtsi delete mode 100644 boards/arm/mps4/mps4_common_soc_peripheral.dtsi delete mode 100644 boards/arm/mps4/mps4_corstone320_fvp.dts delete mode 100644 boards/arm/mps4/mps4_corstone320_fvp.yaml delete mode 100644 boards/arm/mps4/mps4_corstone320_fvp_defconfig delete mode 100644 boards/arm/mps4/mps4_corstone320_fvp_ns.dts delete mode 100644 boards/arm/mps4/mps4_corstone320_fvp_ns.yaml delete mode 100644 boards/arm/mps4/mps4_corstone320_fvp_ns_defconfig delete mode 100644 soc/arm/mps4/CMakeLists.txt delete mode 100644 soc/arm/mps4/Kconfig delete mode 100644 soc/arm/mps4/Kconfig.defconfig delete mode 100644 soc/arm/mps4/Kconfig.defconfig.mps4_corstone320 delete mode 100644 soc/arm/mps4/Kconfig.soc delete mode 100644 soc/arm/mps4/soc.h diff --git a/boards/arm/mps4/Kconfig.defconfig b/boards/arm/mps4/Kconfig.defconfig deleted file mode 100644 index b4e987753860..000000000000 --- a/boards/arm/mps4/Kconfig.defconfig +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright 2025 Arm Limited and/or its affiliates -# SPDX-License-Identifier: Apache-2.0 - -if BOARD_MPS4_CORSTONE320_FVP - -if SERIAL - -config UART_INTERRUPT_DRIVEN - default y - -endif # SERIAL - -if ROMSTART_RELOCATION_ROM && BOARD_MPS4_CORSTONE320_FVP - -config ROMSTART_REGION_ADDRESS - default $(dt_nodelabel_reg_addr_hex,itcm) - -config ROMSTART_REGION_SIZE - default $(dt_nodelabel_reg_size_hex,itcm,0,k) - -endif - -endif diff --git a/boards/arm/mps4/Kconfig.mps4 b/boards/arm/mps4/Kconfig.mps4 deleted file mode 100644 index ffb494cf3377..000000000000 --- a/boards/arm/mps4/Kconfig.mps4 +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright 2025 Arm Limited and/or its affiliates -# SPDX-License-Identifier: Apache-2.0 - -config BOARD_MPS4 - select SOC_SERIES_MPS4 - select SOC_MPS4_CORSTONE320 if BOARD_MPS4_CORSTONE320_FVP || BOARD_MPS4_CORSTONE320_FVP_NS diff --git a/boards/arm/mps4/board.cmake b/boards/arm/mps4/board.cmake deleted file mode 100644 index 6497c65c4260..000000000000 --- a/boards/arm/mps4/board.cmake +++ /dev/null @@ -1,45 +0,0 @@ -# Copyright 2025 Arm Limited and/or its affiliates -# SPDX-License-Identifier: Apache-2.0 - -# -# Default emulation: -# FVP is used by default for corstone320/fvp. -# - - -if(CONFIG_BOARD_MPS4_CORSTONE320_FVP OR CONFIG_BOARD_MPS4_CORSTONE320_FVP_NS) - set(SUPPORTED_EMU_PLATFORMS armfvp) - set(ARMFVP_BIN_NAME FVP_Corstone_SSE-320) - if(CONFIG_BOARD_MPS4_CORSTONE320_FVP) - set(ARMFVP_FLAGS - # default is '0x11000000' but should match cpu.INITSVTOR which is 0. - -C mps4_board.subsystem.iotss3_systemcontrol.INITSVTOR_RST=0 - # default is 0x8, this change is needed since we split flash into itcm - # and sram and it reduces the number of available mpu regions causing a - # few MPU tests to fail. - -C mps4_board.subsystem.cpu0.MPU_S=16 - ) - endif() -endif() - -if(CONFIG_BUILD_WITH_TFM) - set(ARMFVP_FLAGS ${ARMFVP_FLAGS} -a ${APPLICATION_BINARY_DIR}/zephyr/tfm_merged.hex) -endif() - -# FVP Parameters -# -C indicate a config option in the form of: -# instance.parameter=value -# Run the FVP with --list-params to list all options -set(ARMFVP_FLAGS ${ARMFVP_FLAGS} - -C mps4_board.uart0.out_file=- - -C mps4_board.uart0.unbuffered_output=1 - -C mps4_board.uart1.out_file=- - -C mps4_board.uart1.unbuffered_output=1 - -C mps4_board.uart2.out_file=- - -C mps4_board.uart2.unbuffered_output=1 - -C mps4_board.visualisation.disable-visualisation=1 - -C mps4_board.telnetterminal0.start_telnet=0 - -C mps4_board.telnetterminal1.start_telnet=0 - -C mps4_board.telnetterminal2.start_telnet=0 - -C vis_hdlcd.disable_visualisation=1 - ) diff --git a/boards/arm/mps4/board.yml b/boards/arm/mps4/board.yml deleted file mode 100644 index 8c2b411846fb..000000000000 --- a/boards/arm/mps4/board.yml +++ /dev/null @@ -1,10 +0,0 @@ -board: - name: mps4 - full_name: MPS4 - vendor: arm - socs: - - name: 'corstone320' - variants: - - name: 'fvp' - variants: - - name: 'ns' diff --git a/boards/arm/mps4/mps4_common.dtsi b/boards/arm/mps4/mps4_common.dtsi deleted file mode 100644 index c2958fc5c075..000000000000 --- a/boards/arm/mps4/mps4_common.dtsi +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright 2025 Arm Limited and/or its affiliates - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/* /dts-v1/; */ - -#include -#include -#include -#include -#include - -/ { - aliases { - led0 = &led_0; - led1 = &led_1; - sw0 = &user_button_0; - sw1 = &user_button_1; - }; - - leds { - compatible = "gpio-leds"; - - led_0: led_0 { - gpios = <&gpio_led0 0>; - label = "USERLED0"; - }; - - led_1: led_1 { - gpios = <&gpio_led0 1>; - label = "USERLED1"; - }; - - led_2: led_2 { - gpios = <&gpio_led0 2>; - label = "USERLED2"; - }; - - led_3: led_3 { - gpios = <&gpio_led0 3>; - label = "USERLED3"; - }; - - led_4: led_4 { - gpios = <&gpio_led0 4>; - label = "USERLED4"; - }; - - led_5: led_5 { - gpios = <&gpio_led0 5>; - label = "USERLED5"; - }; - - led_6: led_6 { - gpios = <&gpio_led0 6>; - label = "USERLED6"; - }; - - led_7: led_7 { - gpios = <&gpio_led0 7>; - label = "USERLED7"; - }; - - led_8: led_8 { - gpios = <&gpio_led0 8>; - label = "PB1LED"; - }; - - led_9: led_9 { - gpios = <&gpio_led0 9>; - label = "PB2LED"; - }; - }; - - gpio_keys { - compatible = "gpio-keys"; - - user_button_0: button_0 { - label = "USERPB0"; - gpios = <&gpio_button 0>; - zephyr,code = ; - }; - - user_button_1: button_1 { - label = "USERPB1"; - gpios = <&gpio_button 1>; - zephyr,code = ; - }; - }; - - null_ptr_detect: null_ptr_detect@0 { - compatible = "zephyr,memory-region"; - /* 0 - CONFIG_CORTEX_M_NULL_POINTER_EXCEPTION_PAGE_SIZE> */ - reg = <0x0 0x400>; - zephyr,memory-region = "NULL_PTR_DETECT"; - zephyr,memory-attr = <( DT_MEM_ARM(ATTR_MPU_FLASH) )>; - }; - - /* DDR4 - 2G, alternates non-secure/secure every 256M */ - ddr4: memory@60000000 { - device_type = "memory"; - compatible = "zephyr,memory-region"; - reg = <0x60000000 DT_SIZE_M(256) - 0x70000000 DT_SIZE_M(256) - 0x80000000 DT_SIZE_M(256) - 0x90000000 DT_SIZE_M(256) - 0xa0000000 DT_SIZE_M(256) - 0xb0000000 DT_SIZE_M(256) - 0xc0000000 DT_SIZE_M(256) - 0xd0000000 DT_SIZE_M(256)>; - zephyr,memory-region = "DDR4"; - }; -}; - -&nvic { - arm,num-irq-priority-bits = <3>; -}; diff --git a/boards/arm/mps4/mps4_common_soc_peripheral.dtsi b/boards/arm/mps4/mps4_common_soc_peripheral.dtsi deleted file mode 100644 index d94339e4c05c..000000000000 --- a/boards/arm/mps4/mps4_common_soc_peripheral.dtsi +++ /dev/null @@ -1,209 +0,0 @@ -/* - * Copyright 2025 Arm Limited and/or its affiliates - * - * SPDX-License-Identifier: Apache-2.0 - */ - -sysclk: system-clock { - compatible = "fixed-clock"; - clock-frequency = <25000000>; - #clock-cells = <0>; -}; - -gpio0: gpio@100000 { - compatible = "arm,cmsdk-gpio"; - reg = <0x100000 0x1000>; - interrupts = <69 3>; - gpio-controller; - #gpio-cells = <2>; -}; - -gpio1: gpio@101000 { - compatible = "arm,cmsdk-gpio"; - reg = <0x101000 0x1000>; - interrupts = <70 3>; - gpio-controller; - #gpio-cells = <2>; -}; - -gpio2: gpio@102000 { - compatible = "arm,cmsdk-gpio"; - reg = <0x102000 0x1000>; - interrupts = <71 3>; - gpio-controller; - #gpio-cells = <2>; -}; - -gpio3: gpio@103000 { - compatible = "arm,cmsdk-gpio"; - reg = <0x103000 0x1000>; - interrupts = <72 3>; - gpio-controller; - #gpio-cells = <2>; -}; - -eth0: eth@400000 { - /* Linux has "smsc,lan9115" */ - compatible = "smsc,lan9220"; - /* Actual reg range is ~0x200 */ - reg = <0x400000 0x100000>; - interrupts = <49 3>; -}; - -i2c_touch: i2c@8100000 { - compatible = "arm,versatile-i2c"; - clock-frequency = ; - #address-cells = <1>; - #size-cells = <0>; - reg = <0x8100000 0x1000>; -}; - -i2c_audio_conf: i2c@8101000 { - compatible = "arm,versatile-i2c"; - clock-frequency = ; - #address-cells = <1>; - #size-cells = <0>; - reg = <0x8101000 0x1000>; -}; - -spi_adc: spi@8102000 { - compatible = "arm,pl022"; - reg = <0x8102000 DT_SIZE_K(4)>; - interrupts = <53 3>; - interrupt-names = "shield_adc"; - clocks = <&sysclk>; - #address-cells = <1>; - #size-cells = <0>; -}; - -spi_shield0: spi@8103000 { - compatible = "arm,pl022"; - reg = <0x8103000 DT_SIZE_K(4)>; - interrupts = <54 3>; - interrupt-names = "shield0_spi"; - clocks = <&sysclk>; - #address-cells = <1>; - #size-cells = <0>; - pinctrl-0 = <&spi3_default>; - pinctrl-names = "default"; -}; - -spi_shield1: spi@8104000 { - compatible = "arm,pl022"; - reg = <0x8104000 DT_SIZE_K(4)>; - interrupts = <55 3>; - interrupt-names = "shield1_spi"; - clocks = <&sysclk>; - #address-cells = <1>; - #size-cells = <0>; - pinctrl-0 = <&spi4_default>; - pinctrl-names = "default"; -}; - -i2c_shield0: i2c@8105000 { - compatible = "arm,versatile-i2c"; - clock-frequency = ; - #address-cells = <1>; - #size-cells = <0>; - reg = <0x8105000 0x1000>; - pinctrl-0 = <&sbcon2_default>; - pinctrl-names = "default"; -}; - -i2c_shield1: i2c@8106000 { - compatible = "arm,versatile-i2c"; - clock-frequency = ; - #address-cells = <1>; - #size-cells = <0>; - reg = <0x8106000 0x1000>; - pinctrl-0 = <&sbcon3_default>; - pinctrl-names = "default"; -}; - -i2c_ddr4_eeprom: i2c@8108000 { - compatible = "arm,versatile-i2c"; - clock-frequency = ; - #address-cells = <1>; - #size-cells = <0>; - reg = <0x8108000 0x1000>; -}; - -gpio_led0: mps4_fpgaio@8202000 { - compatible = "arm,mmio32-gpio"; - reg = <0x8202000 0x4>; - gpio-controller; - #gpio-cells = <1>; - ngpios = <8>; -}; - -gpio_button: mps4_fpgaio@8202008 { - compatible = "arm,mmio32-gpio"; - reg = <0x8202008 0x4>; - gpio-controller; - #gpio-cells = <1>; - ngpios = <2>; - direction-input; -}; - -gpio_misc: mps4_fpgaio@820204c { - compatible = "arm,mmio32-gpio"; - reg = <0x820204c 0x4>; - gpio-controller; - #gpio-cells = <1>; - ngpios = <3>; -}; - -uart0: uart@8203000 { - compatible = "arm,cmsdk-uart"; - reg = <0x8203000 0x1000>; - interrupts = <34 3 33 3>; - interrupt-names = "tx", "rx"; - clocks = <&sysclk>; - current-speed = <115200>; -}; - -uart1: uart@8204000 { - compatible = "arm,cmsdk-uart"; - reg = <0x8204000 0x1000>; - interrupts = <36 3 35 3>; - interrupt-names = "tx", "rx"; - clocks = <&sysclk>; - current-speed = <115200>; -}; - -uart2: uart@8205000 { - compatible = "arm,cmsdk-uart"; - reg = <0x8205000 0x1000>; - interrupts = <38 3 37 3>; - interrupt-names = "tx", "rx"; - clocks = <&sysclk>; - current-speed = <115200>; -}; - -uart3: uart@8206000 { - compatible = "arm,cmsdk-uart"; - reg = <0x8206000 0x1000>; - interrupts = <40 3 39 3>; - interrupt-names = "tx", "rx"; - clocks = <&sysclk>; - current-speed = <115200>; -}; - -uart4: uart@8207000 { - compatible = "arm,cmsdk-uart"; - reg = <0x8207000 0x1000>; - interrupts = <42 3 41 3>; - interrupt-names = "tx", "rx"; - clocks = <&sysclk>; - current-speed = <115200>; -}; - -uart5: uart@8208000 { - compatible = "arm,cmsdk-uart"; - status = "disabled"; - reg = <0x8208000 0x1000>; - interrupt-names = "tx", "rx"; - interrupts = <126 3 125 3>; - clocks = <&sysclk>; - current-speed = <115200>; -}; diff --git a/boards/arm/mps4/mps4_corstone320_fvp.dts b/boards/arm/mps4/mps4_corstone320_fvp.dts deleted file mode 100644 index 98c87ce7ed7a..000000000000 --- a/boards/arm/mps4/mps4_corstone320_fvp.dts +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright 2025 Arm Limited and/or its affiliates - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/dts-v1/; - -#include -#include -#include -#include - -/ { - compatible = "arm,mps4-fvp"; - #address-cells = <1>; - #size-cells = <1>; - - chosen { - zephyr,console = &uart0; - zephyr,shell-uart = &uart0; - zephyr,sram = &sram; - zephyr,flash = &isram; - }; - - cpus { - #address-cells = <1>; - #size-cells = <0>; - - cpu@0 { - device_type = "cpu"; - compatible = "arm,cortex-m85"; - reg = <0>; - #address-cells = <1>; - #size-cells = <1>; - - mpu: mpu@e000ed90 { - compatible = "arm,armv8.1m-mpu"; - reg = <0xe000ed90 0x40>; - }; - }; - }; - - ethosu { - #address-cells = <1>; - #size-cells = <0>; - interrupt-parent = <&nvic>; - - ethosu0: ethosu@50004000 { - compatible = "arm,ethos-u"; - reg = <0x50004000>; - interrupts = <16 3>; - secure-enable; - privilege-enable; - status = "okay"; - }; - }; - - /* We utilize the secure addresses, if you subtract 0x10000000 - * you'll get the non-secure alias - */ - itcm: itcm@10000000 { /* alias @ 0x0 */ - compatible = "zephyr,memory-region"; - reg = <0x10000000 DT_SIZE_K(32)>; - zephyr,memory-region = "ITCM"; - }; - - sram: sram@12000000 { /* alias @ 0x01000000 */ - compatible = "zephyr,memory-region", "mmio-sram"; - reg = <0x12000000 DT_SIZE_M(2)>; - zephyr,memory-region = "SRAM"; - }; - - dtcm: dtcm@30000000 { /* alias @ 0x20000000 */ - compatible = "zephyr,memory-region"; - reg = <0x30000000 DT_SIZE_K(32)>; - zephyr,memory-region = "DTCM"; - }; - - isram: sram@31000000 { /* alias @ 0x21000000 */ - compatible = "zephyr,memory-region", "mmio-sram"; - reg = <0x31000000 DT_SIZE_M(4)>; - zephyr,memory-region = "ISRAM"; - }; - - soc { - peripheral@50000000 { - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x50000000 0x10000000>; - - #include "mps4_common_soc_peripheral.dtsi" - }; - }; -}; - -#include "mps4_common.dtsi" diff --git a/boards/arm/mps4/mps4_corstone320_fvp.yaml b/boards/arm/mps4/mps4_corstone320_fvp.yaml deleted file mode 100644 index 624c85808128..000000000000 --- a/boards/arm/mps4/mps4_corstone320_fvp.yaml +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright 2025 Arm Limited and/or its affiliates -# SPDX-License-Identifier: Apache-2.0 - -identifier: mps4/corstone320/fvp -name: Arm MPS4-Corstone320-FVP -type: mcu -arch: arm -ram: 2048 -flash: 4096 -simulation: - - name: armfvp - exec: FVP_Corstone_SSE-320 -toolchain: - - gnuarmemb - - zephyr -supported: - - gpio -testing: - default: true - ignore_tags: - - drivers - - bluetooth - - net - - timer -vendor: arm diff --git a/boards/arm/mps4/mps4_corstone320_fvp_defconfig b/boards/arm/mps4/mps4_corstone320_fvp_defconfig deleted file mode 100644 index 26d5a732e493..000000000000 --- a/boards/arm/mps4/mps4_corstone320_fvp_defconfig +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2025 Arm Limited and/or its affiliates -# SPDX-License-Identifier: Apache-2.0 - -CONFIG_RUNTIME_NMI=y -CONFIG_ARM_TRUSTZONE_M=y -CONFIG_ARM_MPU=y - -# GPIOs -CONFIG_GPIO=y - -# Serial -CONFIG_CONSOLE=y -CONFIG_UART_CONSOLE=y -CONFIG_SERIAL=y - -# Build a Secure firmware image -CONFIG_TRUSTED_EXECUTION_SECURE=y -# ROMSTART_REGION address and size are defined in Kconfig.defconfig -CONFIG_ROMSTART_RELOCATION_ROM=y diff --git a/boards/arm/mps4/mps4_corstone320_fvp_ns.dts b/boards/arm/mps4/mps4_corstone320_fvp_ns.dts deleted file mode 100644 index c511a7cc700b..000000000000 --- a/boards/arm/mps4/mps4_corstone320_fvp_ns.dts +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright 2025 Arm Limited and/or its affiliates - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/dts-v1/; - -#include -#include -#include -#include - -/ { - compatible = "arm,mps4-fvp"; - #address-cells = <1>; - #size-cells = <1>; - - chosen { - zephyr,console = &uart0; - zephyr,shell-uart = &uart0; - zephyr,sram = &ram; - zephyr,flash = &code; - }; - - cpus { - #address-cells = <1>; - #size-cells = <0>; - - cpu@0 { - device_type = "cpu"; - compatible = "arm,cortex-m85"; - reg = <0>; - #address-cells = <1>; - #size-cells = <1>; - - mpu: mpu@e000ed90 { - compatible = "arm,armv8.1m-mpu"; - reg = <0xe000ed90 0x40>; - }; - }; - }; - - /* We utilize the secure addresses, if you subtract 0x10000000 - * you'll get the non-secure alias - */ - itcm: itcm@0 { - compatible = "zephyr,memory-region"; - reg = <0x0 DT_SIZE_K(32)>; - zephyr,memory-region = "ITCM"; - }; - - sram: sram@1000000 { - compatible = "zephyr,memory-region", "mmio-sram"; - reg = <0x1000000 DT_SIZE_M(2)>; - zephyr,memory-region = "SRAM"; - }; - - dtcm: dtcm@20000000 { - compatible = "zephyr,memory-region"; - reg = <0x20000000 DT_SIZE_K(512)>; - zephyr,memory-region = "DTCM"; - }; - - isram: sram@21000000 { - compatible = "zephyr,memory-region", "mmio-sram"; - reg = <0x21000000 DT_SIZE_M(4)>; - zephyr,memory-region = "ISRAM"; - }; - - reserved-memory { - #address-cells = <1>; - #size-cells = <1>; - ranges; - - /* The memory regions defined below must match what the TF-M - * project has defined for that board - a single image boot is - * assumed. Please see the memory layout in: - * https://git.trustedfirmware.org/TF-M/trusted-firmware-m.git/tree/platform/ext/target/mps4/corstone320/common/partition/flash_layout.h - */ - - code: memory@28080000 { - reg = <0x28080000 DT_SIZE_K(512)>; - }; - - ram: memory@21020000 { - reg = <0x21020000 DT_SIZE_M(1)>; - }; - }; - - soc { - peripheral@40000000 { - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x40000000 0x10000000>; - - #include "mps4_common_soc_peripheral.dtsi" - }; - }; -}; - -#include "mps4_common.dtsi" diff --git a/boards/arm/mps4/mps4_corstone320_fvp_ns.yaml b/boards/arm/mps4/mps4_corstone320_fvp_ns.yaml deleted file mode 100644 index 45ee954a3370..000000000000 --- a/boards/arm/mps4/mps4_corstone320_fvp_ns.yaml +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright 2025 Arm Limited and/or its affiliates -# SPDX-License-Identifier: Apache-2.0 - -identifier: mps4/corstone320/fvp/ns -name: Arm MPS4-Corstone320-FVP_ns -type: mcu -arch: arm -ram: 1024 -flash: 512 -toolchain: - - gnuarmemb - - zephyr -testing: - only_tags: - - trusted-firmware-m diff --git a/boards/arm/mps4/mps4_corstone320_fvp_ns_defconfig b/boards/arm/mps4/mps4_corstone320_fvp_ns_defconfig deleted file mode 100644 index d59d419011b0..000000000000 --- a/boards/arm/mps4/mps4_corstone320_fvp_ns_defconfig +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2025 Arm Limited and/or its affiliates -# SPDX-License-Identifier: Apache-2.0 - -CONFIG_ARM_TRUSTZONE_M=y -CONFIG_RUNTIME_NMI=y -CONFIG_ARM_MPU=y - -# GPIOs -CONFIG_GPIO=y - -# Serial -CONFIG_CONSOLE=y -CONFIG_UART_CONSOLE=y -CONFIG_SERIAL=y - -# Build a Non-secure firmware image -CONFIG_TRUSTED_EXECUTION_SECURE=n -CONFIG_TRUSTED_EXECUTION_NONSECURE=y -CONFIG_BUILD_WITH_TFM=y diff --git a/soc/arm/mps4/CMakeLists.txt b/soc/arm/mps4/CMakeLists.txt deleted file mode 100644 index 1cc200dafbb0..000000000000 --- a/soc/arm/mps4/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright 2025 Arm Limited and/or its affiliates -# SPDX-License-Identifier: Apache-2.0 - -zephyr_include_directories(.) - -set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/arm/cortex_m/scripts/linker.ld CACHE INTERNAL "") diff --git a/soc/arm/mps4/Kconfig b/soc/arm/mps4/Kconfig deleted file mode 100644 index 0054f715208f..000000000000 --- a/soc/arm/mps4/Kconfig +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright 2025 Arm Limited and/or its affiliates -# SPDX-License-Identifier: Apache-2.0 - -config SOC_SERIES_MPS4 - select ARM - select GPIO_MMIO32 if GPIO - -config SOC_MPS4_CORSTONE320 - select CPU_CORTEX_M85 - select CPU_HAS_ARM_SAU - select CPU_HAS_ARM_MPU - select CPU_HAS_FPU - select ARMV8_M_DSP - select ARMV8_1_M_MVEI - select ARMV8_1_M_MVEF - select ARMV8_1_M_PMU - select ARM_MPU_PXN if ARM_MPU - -config ARMV8_1_M_PMU_EVENTCNT - int - default 8 if SOC_MPS4_CORSTONE320 diff --git a/soc/arm/mps4/Kconfig.defconfig b/soc/arm/mps4/Kconfig.defconfig deleted file mode 100644 index 667eaadb35cf..000000000000 --- a/soc/arm/mps4/Kconfig.defconfig +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright 2025 Arm Limited and/or its affiliates -# SPDX-License-Identifier: Apache-2.0 - -if SOC_SERIES_MPS4 - -config SYS_CLOCK_HW_CYCLES_PER_SEC - default $(dt_node_int_prop_int,$(dt_nodelabel_path,sysclk),clock-frequency) - -rsource "Kconfig.defconfig.mps4*" - -endif # SOC_SERIES_MPS4 diff --git a/soc/arm/mps4/Kconfig.defconfig.mps4_corstone320 b/soc/arm/mps4/Kconfig.defconfig.mps4_corstone320 deleted file mode 100644 index f7348d7fcadf..000000000000 --- a/soc/arm/mps4/Kconfig.defconfig.mps4_corstone320 +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright 2025 Arm Limited and/or its affiliates -# SPDX-License-Identifier: Apache-2.0 - -if SOC_MPS4_CORSTONE320 - -config NUM_IRQS - default 232 - -endif diff --git a/soc/arm/mps4/Kconfig.soc b/soc/arm/mps4/Kconfig.soc deleted file mode 100644 index a557d287f0e8..000000000000 --- a/soc/arm/mps4/Kconfig.soc +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright 2025 Arm Limited and/or its affiliates -# SPDX-License-Identifier: Apache-2.0 - -config SOC_SERIES_MPS4 - bool - select SOC_FAMILY_ARM - help - Enable support for ARM MPS4 MCU Series - -config SOC_SERIES - default "mps4" if SOC_SERIES_MPS4 - -config SOC_MPS4_CORSTONE320 - bool - select SOC_SERIES_MPS4 - -config SOC - default "corstone320" if SOC_MPS4_CORSTONE320 diff --git a/soc/arm/mps4/soc.h b/soc/arm/mps4/soc.h deleted file mode 100644 index 14ceadbd20a9..000000000000 --- a/soc/arm/mps4/soc.h +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Copyright 2025 Arm Limited and/or its affiliates - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef _SOC_H_ -#define _SOC_H_ - -#include - -#endif /* _SOC_H_ */ diff --git a/soc/arm/soc.yml b/soc/arm/soc.yml index 2caf077656a9..866f34dafd45 100644 --- a/soc/arm/soc.yml +++ b/soc/arm/soc.yml @@ -15,9 +15,6 @@ family: socs: - name: corstone300 - name: corstone310 - - name: mps4 - socs: - - name: corstone320 - name: musca socs: - name: musca_b1 From 2bd326a3140fd0d1e2252ca9a7ea32b3b4aae26c Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:27 +0300 Subject: [PATCH 0864/2141] Revert "[nrf fromtree] scripts: zephyr_module: Add variable with module path" This reverts commit ccc8d2b94034e89c93f3c14d9acfacfeb5829e85. Signed-off-by: Jukka Rissanen --- cmake/modules/kconfig.cmake | 8 +++++++- scripts/zephyr_module.py | 24 ++++++++++-------------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/cmake/modules/kconfig.cmake b/cmake/modules/kconfig.cmake index ac5f1b83e4c3..def17f16ae63 100644 --- a/cmake/modules/kconfig.cmake +++ b/cmake/modules/kconfig.cmake @@ -99,9 +99,15 @@ zephyr_file(CONF_FILES ${BOARD_EXTENSION_DIRS} KCONF board_extension_conf_files # separated list instead. string(REPLACE ";" "?" DTS_ROOT_BINDINGS "${DTS_ROOT_BINDINGS}") -# Export each `ZEPHYR__KCONFIG` to Kconfig. +# Export each `ZEPHYR__MODULE_DIR` to Kconfig. +# This allows Kconfig files to refer relative from a modules root as: +# source "$(ZEPHYR_FOO_MODULE_DIR)/Kconfig" foreach(module_name ${ZEPHYR_MODULE_NAMES}) zephyr_string(SANITIZE TOUPPER MODULE_NAME_UPPER ${module_name}) + list(APPEND + ZEPHYR_KCONFIG_MODULES_DIR + "ZEPHYR_${MODULE_NAME_UPPER}_MODULE_DIR=${ZEPHYR_${MODULE_NAME_UPPER}_MODULE_DIR}" + ) if(ZEPHYR_${MODULE_NAME_UPPER}_KCONFIG) list(APPEND diff --git a/scripts/zephyr_module.py b/scripts/zephyr_module.py index aeda845639e0..8aabe6767845 100755 --- a/scripts/zephyr_module.py +++ b/scripts/zephyr_module.py @@ -393,11 +393,8 @@ def process_kconfig(module, meta): module_path = PurePath(module) module_yml = module_path.joinpath('zephyr/module.yml') kconfig_extern = section.get('kconfig-ext', False) - name_sanitized = meta['name-sanitized'] - snippet = f'ZEPHYR_{name_sanitized.upper()}_MODULE_DIR := {module_path.as_posix()}\n' - if kconfig_extern: - return snippet + kconfig_snippet(meta, module_path, blobs=blobs, taint_blobs=taint_blobs) + return kconfig_snippet(meta, module_path, blobs=blobs, taint_blobs=taint_blobs) kconfig_setting = section.get('kconfig', None) if not validate_setting(kconfig_setting, module): @@ -407,10 +404,12 @@ def process_kconfig(module, meta): kconfig_file = os.path.join(module, kconfig_setting or 'zephyr/Kconfig') if os.path.isfile(kconfig_file): - return snippet + kconfig_snippet(meta, module_path, Path(kconfig_file), - blobs=blobs, taint_blobs=taint_blobs) + return kconfig_snippet(meta, module_path, Path(kconfig_file), + blobs=blobs, taint_blobs=taint_blobs) else: - return snippet + '\n'.join(kconfig_module_opts(name_sanitized, blobs, taint_blobs)) + '\n' + name_sanitized = meta['name-sanitized'] + snippet = kconfig_module_opts(name_sanitized, blobs, taint_blobs) + return '\n'.join(snippet) + '\n' def process_sysbuildkconfig(module, meta): @@ -418,11 +417,8 @@ def process_sysbuildkconfig(module, meta): module_path = PurePath(module) module_yml = module_path.joinpath('zephyr/module.yml') kconfig_extern = section.get('sysbuild-kconfig-ext', False) - name_sanitized = meta['name-sanitized'] - snippet = f'ZEPHYR_{name_sanitized.upper()}_MODULE_DIR := {module_path.as_posix()}\n' - if kconfig_extern: - return snippet + kconfig_snippet(meta, module_path, sysbuild=True) + return kconfig_snippet(meta, module_path, sysbuild=True) kconfig_setting = section.get('sysbuild-kconfig', None) if not validate_setting(kconfig_setting, module): @@ -433,10 +429,10 @@ def process_sysbuildkconfig(module, meta): if kconfig_setting is not None: kconfig_file = os.path.join(module, kconfig_setting) if os.path.isfile(kconfig_file): - return snippet + kconfig_snippet(meta, module_path, Path(kconfig_file)) + return kconfig_snippet(meta, module_path, Path(kconfig_file)) - return snippet + \ - (f'config ZEPHYR_{name_sanitized.upper()}_MODULE\n' + name_sanitized = meta['name-sanitized'] + return (f'config ZEPHYR_{name_sanitized.upper()}_MODULE\n' f' bool\n' f' default y\n') From d18f4bff313de0e34648bf399deb23465df38c15 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:27 +0300 Subject: [PATCH 0865/2141] Revert "[nrf fromtree] drivers: flash_mspi_nor: Fix XIP_DEV_CFG_MASK definition" This reverts commit 9f038bf1860117b8e039a2347a1abaebb38807c5. Signed-off-by: Jukka Rissanen --- drivers/flash/flash_mspi_nor.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/flash/flash_mspi_nor.c b/drivers/flash/flash_mspi_nor.c index a634b3d9118b..f08f8b68a1d0 100644 --- a/drivers/flash/flash_mspi_nor.c +++ b/drivers/flash/flash_mspi_nor.c @@ -16,11 +16,11 @@ LOG_MODULE_REGISTER(flash_mspi_nor, CONFIG_FLASH_LOG_LEVEL); -#define XIP_DEV_CFG_MASK (MSPI_DEVICE_CONFIG_CMD_LEN | \ - MSPI_DEVICE_CONFIG_ADDR_LEN | \ - MSPI_DEVICE_CONFIG_READ_CMD | \ - MSPI_DEVICE_CONFIG_WRITE_CMD | \ - MSPI_DEVICE_CONFIG_RX_DUMMY | \ +#define XIP_DEV_CFG_MASK (MSPI_DEVICE_CONFIG_CMD_LEN || \ + MSPI_DEVICE_CONFIG_ADDR_LEN || \ + MSPI_DEVICE_CONFIG_READ_CMD || \ + MSPI_DEVICE_CONFIG_WRITE_CMD || \ + MSPI_DEVICE_CONFIG_RX_DUMMY || \ MSPI_DEVICE_CONFIG_TX_DUMMY) #define NON_XIP_DEV_CFG_MASK (MSPI_DEVICE_CONFIG_ALL & ~XIP_DEV_CFG_MASK) From ddeebd91be95343860e4195186ed8451bfe29807 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:27 +0300 Subject: [PATCH 0866/2141] Revert "[nrf fromtree] samples: code_relocation_nocopy: Update configuration for nRF54H20 DK" This reverts commit b21162108c368ed4c50eb7373223e3e7f0a093c1. Signed-off-by: Jukka Rissanen --- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 13 ++++--------- .../code_relocation_nocopy/sample.yaml | 1 - 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/samples/application_development/code_relocation_nocopy/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/samples/application_development/code_relocation_nocopy/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index 789c47d3a473..98d67e2ad082 100644 --- a/samples/application_development/code_relocation_nocopy/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/samples/application_development/code_relocation_nocopy/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -2,16 +2,11 @@ status = "okay"; }; -&gpio6 { - status = "okay"; -}; - -&exmif { - status = "okay"; -}; - &mx25uw63 { - status = "okay"; + read-command = <0xEC13>; + command-length = "INSTR_2_BYTE"; + address-length = "ADDR_4_BYTE"; + rx-dummy = <20>; xip-config = <1 0 0x20000000 0>; }; diff --git a/samples/application_development/code_relocation_nocopy/sample.yaml b/samples/application_development/code_relocation_nocopy/sample.yaml index 62929419c534..37e009bc9871 100644 --- a/samples/application_development/code_relocation_nocopy/sample.yaml +++ b/samples/application_development/code_relocation_nocopy/sample.yaml @@ -6,7 +6,6 @@ tests: platform_allow: - qemu_cortex_m3 - nrf5340dk/nrf5340/cpuapp - - nrf54h20dk/nrf54h20/cpuapp - stm32f769i_disco - stm32h7b3i_dk - stm32h573i_dk From 1904638634d2a2429513d1faa8b1733269d1d284 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:27 +0300 Subject: [PATCH 0867/2141] Revert "[nrf fromtree] drivers: flash_mspi_nor: Add support for DDR in mx25u family" This reverts commit 8a2d4d752ce6cb8e801197aa0dca0184a2ce28cf. Signed-off-by: Jukka Rissanen --- drivers/flash/flash_mspi_nor_quirks.h | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/drivers/flash/flash_mspi_nor_quirks.h b/drivers/flash/flash_mspi_nor_quirks.h index d58fbea4ff9b..e6989496b325 100644 --- a/drivers/flash/flash_mspi_nor_quirks.h +++ b/drivers/flash/flash_mspi_nor_quirks.h @@ -123,30 +123,21 @@ struct flash_mspi_nor_quirks flash_quirks_mxicy_mx25r = { #if DT_HAS_COMPAT_STATUS_OKAY(mxicy_mx25u) +#define MXICY_MX25R_OE_MASK BIT(0) + +static uint8_t mxicy_mx25u_oe_payload = MXICY_MX25R_OE_MASK; + static inline int mxicy_mx25u_post_switch_mode(const struct device *dev) { const struct flash_mspi_nor_config *dev_config = dev->config; struct flash_mspi_nor_data *dev_data = dev->data; enum mspi_io_mode io_mode = dev_config->mspi_nor_cfg.io_mode; - uint8_t opi_enable; int rc; if (io_mode != MSPI_IO_MODE_OCTAL) { return 0; } - /* - * TODO - replace this with a generic routine that uses information - * from SFDP header FF87 (Status, Control and Configuration - * Register Map) - */ - - if (dev_config->mspi_nor_cfg.data_rate == MSPI_DATA_RATE_DUAL) { - opi_enable = BIT(1); - } else { - opi_enable = BIT(0); - } - /* Write enable */ rc = cmd_wren(dev); if (rc < 0) { @@ -157,8 +148,8 @@ static inline int mxicy_mx25u_post_switch_mode(const struct device *dev) set_up_xfer(dev, MSPI_TX); dev_data->xfer.addr_length = 4; dev_data->packet.address = 0; - dev_data->packet.data_buf = &opi_enable; - dev_data->packet.num_bytes = sizeof(opi_enable); + dev_data->packet.data_buf = &mxicy_mx25u_oe_payload; + dev_data->packet.num_bytes = sizeof(mxicy_mx25u_oe_payload); return perform_xfer(dev, SPI_NOR_CMD_WR_CFGREG2, false); } From ea98d8a5bdeac7e282105c07704d5eb781103567 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:27 +0300 Subject: [PATCH 0868/2141] Revert "[nrf fromtree] drivers: flash_mspi_nor: Add support for "supply-gpios" property" This reverts commit 0d565bb9fc3d0e46b080624c04709d25e9457638. Signed-off-by: Jukka Rissanen --- drivers/flash/Kconfig.mspi | 3 +- drivers/flash/flash_mspi_nor.c | 97 +++++++++------------------- drivers/flash/flash_mspi_nor.h | 6 -- dts/bindings/mtd/jedec,mspi-nor.yaml | 2 - 4 files changed, 33 insertions(+), 75 deletions(-) diff --git a/drivers/flash/Kconfig.mspi b/drivers/flash/Kconfig.mspi index 5740f3618d76..cab2f3a2bcde 100644 --- a/drivers/flash/Kconfig.mspi +++ b/drivers/flash/Kconfig.mspi @@ -35,8 +35,7 @@ menuconfig FLASH_MSPI_NOR select FLASH_MSPI select FLASH_HAS_EXPLICIT_ERASE select FLASH_JESD216 - select GPIO if $(dt_compat_any_has_prop,$(DT_COMPAT_JEDEC_MSPI_NOR),reset-gpios) \ - || $(dt_compat_any_has_prop,$(DT_COMPAT_JEDEC_MSPI_NOR),supply-gpios) + select GPIO if $(dt_compat_any_has_prop,$(DT_COMPAT_JEDEC_MSPI_NOR),reset-gpios) if FLASH_MSPI_NOR diff --git a/drivers/flash/flash_mspi_nor.c b/drivers/flash/flash_mspi_nor.c index f08f8b68a1d0..cf283b9302af 100644 --- a/drivers/flash/flash_mspi_nor.c +++ b/drivers/flash/flash_mspi_nor.c @@ -848,54 +848,39 @@ static int switch_to_target_io_mode(const struct device *dev) &dev_config->mspi_nor_cfg); } -#if defined(WITH_SUPPLY_GPIO) -static int power_supply(const struct device *dev) -{ - const struct flash_mspi_nor_config *dev_config = dev->config; - int rc; - - if (!gpio_is_ready_dt(&dev_config->supply)) { - LOG_ERR("Device %s is not ready", - dev_config->supply.port->name); - return -ENODEV; - } - - rc = gpio_pin_configure_dt(&dev_config->supply, GPIO_OUTPUT_ACTIVE); - if (rc < 0) { - LOG_ERR("Failed to activate power supply GPIO: %d", rc); - return -EIO; - } - - return 0; -} -#endif - #if defined(WITH_RESET_GPIO) static int gpio_reset(const struct device *dev) { const struct flash_mspi_nor_config *dev_config = dev->config; int rc; - if (!gpio_is_ready_dt(&dev_config->reset)) { - LOG_ERR("Device %s is not ready", - dev_config->reset.port->name); - return -ENODEV; - } + if (dev_config->reset.port) { + if (!gpio_is_ready_dt(&dev_config->reset)) { + LOG_ERR("Device %s is not ready", + dev_config->reset.port->name); + return -ENODEV; + } - rc = gpio_pin_configure_dt(&dev_config->reset, GPIO_OUTPUT_ACTIVE); - if (rc < 0) { - LOG_ERR("Failed to activate RESET: %d", rc); - return -EIO; - } + rc = gpio_pin_configure_dt(&dev_config->reset, + GPIO_OUTPUT_ACTIVE); + if (rc < 0) { + LOG_ERR("Failed to activate RESET: %d", rc); + return -EIO; + } - if (dev_config->reset_pulse_us != 0) { - k_busy_wait(dev_config->reset_pulse_us); - } + if (dev_config->reset_pulse_us != 0) { + k_busy_wait(dev_config->reset_pulse_us); + } - rc = gpio_pin_set_dt(&dev_config->reset, 0); - if (rc < 0) { - LOG_ERR("Failed to deactivate RESET: %d", rc); - return -EIO; + rc = gpio_pin_set_dt(&dev_config->reset, 0); + if (rc < 0) { + LOG_ERR("Failed to deactivate RESET: %d", rc); + return -EIO; + } + + if (dev_config->reset_recovery_us != 0) { + k_busy_wait(dev_config->reset_recovery_us); + } } return 0; @@ -965,6 +950,10 @@ static int soft_reset(const struct device *dev) return rc; } + if (dev_config->reset_recovery_us != 0) { + k_busy_wait(dev_config->reset_recovery_us); + } + return 0; } #endif /* WITH_SOFT_RESET */ @@ -976,7 +965,6 @@ static int flash_chip_init(const struct device *dev) uint8_t id[JESD216_READ_ID_LEN] = {0}; uint16_t dts_cmd = 0; uint32_t sfdp_signature; - bool flash_reset = false; int rc; rc = mspi_dev_config(dev_config->bus, &dev_config->mspi_id, @@ -989,25 +977,12 @@ static int flash_chip_init(const struct device *dev) dev_data->in_target_io_mode = false; -#if defined(WITH_SUPPLY_GPIO) - if (dev_config->supply.port) { - rc = power_supply(dev); - if (rc < 0) { - return rc; - } - - flash_reset = true; - } -#endif - #if defined(WITH_RESET_GPIO) - if (dev_config->reset.port) { - rc = gpio_reset(dev); - if (rc < 0) { - return rc; - } + rc = gpio_reset(dev); - flash_reset = true; + if (rc < 0) { + LOG_ERR("Failed to reset with GPIO: %d", rc); + return rc; } #endif @@ -1017,15 +992,9 @@ static int flash_chip_init(const struct device *dev) if (rc < 0) { return rc; } - - flash_reset = true; } #endif - if (flash_reset && dev_config->reset_recovery_us != 0) { - k_busy_wait(dev_config->reset_recovery_us); - } - if (dev_config->quirks != NULL && dev_config->quirks->pre_init != NULL) { rc = dev_config->quirks->pre_init(dev); @@ -1298,8 +1267,6 @@ BUILD_ASSERT((FLASH_SIZE(inst) % CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE) == 0, \ .mspi_nor_init_cfg = FLASH_INITIAL_CONFIG(inst), \ IF_ENABLED(CONFIG_MSPI_XIP, \ (.xip_cfg = MSPI_XIP_CONFIG_DT_INST(inst),)) \ - IF_ENABLED(WITH_SUPPLY_GPIO, \ - (.supply = GPIO_DT_SPEC_INST_GET_OR(inst, supply_gpios, {0}),)) \ IF_ENABLED(WITH_RESET_GPIO, \ (.reset = GPIO_DT_SPEC_INST_GET_OR(inst, reset_gpios, {0}), \ .reset_pulse_us = DT_INST_PROP_OR(inst, t_reset_pulse, 0) \ diff --git a/drivers/flash/flash_mspi_nor.h b/drivers/flash/flash_mspi_nor.h index 480bccce4729..a32186439825 100644 --- a/drivers/flash/flash_mspi_nor.h +++ b/drivers/flash/flash_mspi_nor.h @@ -16,9 +16,6 @@ extern "C" { #include "jesd216.h" #include "spi_nor.h" -#if DT_ANY_INST_HAS_PROP_STATUS_OKAY(supply_gpios) -#define WITH_SUPPLY_GPIO 1 -#endif #if DT_ANY_INST_HAS_PROP_STATUS_OKAY(reset_gpios) #define WITH_RESET_GPIO 1 #endif @@ -78,9 +75,6 @@ struct flash_mspi_nor_config { #if defined(CONFIG_MSPI_XIP) struct mspi_xip_cfg xip_cfg; #endif -#if defined(WITH_SUPPLY_GPIO) - struct gpio_dt_spec supply; -#endif #if defined(WITH_RESET_GPIO) struct gpio_dt_spec reset; uint32_t reset_pulse_us; diff --git a/dts/bindings/mtd/jedec,mspi-nor.yaml b/dts/bindings/mtd/jedec,mspi-nor.yaml index 348e11cd9833..01eba90ecb2c 100644 --- a/dts/bindings/mtd/jedec,mspi-nor.yaml +++ b/dts/bindings/mtd/jedec,mspi-nor.yaml @@ -35,8 +35,6 @@ properties: type: int description: | Minimum time, in nanoseconds, the flash chip needs to recover after reset. - Such delay is performed when a GPIO or software reset is done, or after - power is supplied to the chip if the "supply-gpios" property is specified. transfer-timeout: type: int From 0698c2807216e7b02e134de03af60255ae121eef Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:27 +0300 Subject: [PATCH 0869/2141] Revert "[nrf fromtree] drivers: flash_mspi_nor: Remove undesirable initial Quad disabling" This reverts commit 8b1bd678d432d313f4beccc9e969367119fd7ac4. Signed-off-by: Jukka Rissanen --- drivers/flash/flash_mspi_nor.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/flash/flash_mspi_nor.c b/drivers/flash/flash_mspi_nor.c index cf283b9302af..8dbc2db08cc2 100644 --- a/drivers/flash/flash_mspi_nor.c +++ b/drivers/flash/flash_mspi_nor.c @@ -962,6 +962,7 @@ static int flash_chip_init(const struct device *dev) { const struct flash_mspi_nor_config *dev_config = dev->config; struct flash_mspi_nor_data *dev_data = dev->data; + enum mspi_io_mode io_mode = dev_config->mspi_nor_cfg.io_mode; uint8_t id[JESD216_READ_ID_LEN] = {0}; uint16_t dts_cmd = 0; uint32_t sfdp_signature; @@ -977,6 +978,28 @@ static int flash_chip_init(const struct device *dev) dev_data->in_target_io_mode = false; + /* Some chips reuse RESET pin for data in Quad modes: + * force single line mode before resetting. + */ + if (dev_data->switch_info.quad_enable_req != JESD216_DW15_QER_VAL_NONE && + (io_mode == MSPI_IO_MODE_SINGLE || + io_mode == MSPI_IO_MODE_QUAD_1_1_4 || + io_mode == MSPI_IO_MODE_QUAD_1_4_4)) { + rc = quad_enable_set(dev, false); + + if (rc < 0) { + LOG_ERR("Failed to switch to single line mode: %d", rc); + return rc; + } + + rc = wait_until_ready(dev, K_USEC(1)); + + if (rc < 0) { + LOG_ERR("Failed waiting for device after switch to single line: %d", rc); + return rc; + } + } + #if defined(WITH_RESET_GPIO) rc = gpio_reset(dev); From 57276280481be59405b2ec74d53ab98a4297dd86 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:28 +0300 Subject: [PATCH 0870/2141] Revert "[nrf fromtree] drivers: flash_mspi_nor: Add Soft Reset" This reverts commit bdd7c438aeaf83e8416d4108c533581ebcd5a8a1. Signed-off-by: Jukka Rissanen --- drivers/flash/flash_mspi_nor.c | 87 +--------------------------- drivers/flash/flash_mspi_nor.h | 6 +- drivers/flash/flash_mspi_nor_sfdp.h | 7 --- dts/bindings/mtd/jedec,mspi-nor.yaml | 6 -- 4 files changed, 4 insertions(+), 102 deletions(-) diff --git a/drivers/flash/flash_mspi_nor.c b/drivers/flash/flash_mspi_nor.c index 8dbc2db08cc2..b4b5589a14f4 100644 --- a/drivers/flash/flash_mspi_nor.c +++ b/drivers/flash/flash_mspi_nor.c @@ -887,77 +887,6 @@ static int gpio_reset(const struct device *dev) } #endif -#if defined(WITH_SOFT_RESET) -static int soft_reset_66_99(const struct device *dev) -{ - int rc; - - set_up_xfer(dev, MSPI_TX); - rc = perform_xfer(dev, SPI_NOR_CMD_RESET_EN, false); - if (rc < 0) { - LOG_ERR("CMD_RESET_EN failed: %d", rc); - return rc; - } - - set_up_xfer(dev, MSPI_TX); - rc = perform_xfer(dev, SPI_NOR_CMD_RESET_MEM, false); - if (rc < 0) { - LOG_ERR("CMD_RESET_MEM failed: %d", rc); - return rc; - } - - return 0; -} - -static int soft_reset(const struct device *dev) -{ - const struct flash_mspi_nor_config *dev_config = dev->config; - struct flash_mspi_nor_data *dev_data = dev->data; - int rc; - - /* If the flash may expect commands sent in multi-line mode, - * send additionally the reset sequence this way. - */ - if (dev_config->multi_io_cmd) { - rc = mspi_dev_config(dev_config->bus, &dev_config->mspi_id, - MSPI_DEVICE_CONFIG_IO_MODE, - &dev_config->mspi_nor_cfg); - if (rc < 0) { - LOG_ERR("%s: dev_config() failed: %d", __func__, rc); - return rc; - } - - dev_data->in_target_io_mode = true; - - rc = soft_reset_66_99(dev); - if (rc < 0) { - return rc; - } - - rc = mspi_dev_config(dev_config->bus, &dev_config->mspi_id, - MSPI_DEVICE_CONFIG_IO_MODE, - &dev_config->mspi_nor_init_cfg); - if (rc < 0) { - LOG_ERR("%s: dev_config() failed: %d", __func__, rc); - return rc; - } - - dev_data->in_target_io_mode = false; - } - - rc = soft_reset_66_99(dev); - if (rc < 0) { - return rc; - } - - if (dev_config->reset_recovery_us != 0) { - k_busy_wait(dev_config->reset_recovery_us); - } - - return 0; -} -#endif /* WITH_SOFT_RESET */ - static int flash_chip_init(const struct device *dev) { const struct flash_mspi_nor_config *dev_config = dev->config; @@ -1009,15 +938,6 @@ static int flash_chip_init(const struct device *dev) } #endif -#if defined(WITH_SOFT_RESET) - if (dev_config->initial_soft_reset) { - rc = soft_reset(dev); - if (rc < 0) { - return rc; - } - } -#endif - if (dev_config->quirks != NULL && dev_config->quirks->pre_init != NULL) { rc = dev_config->quirks->pre_init(dev); @@ -1292,10 +1212,10 @@ BUILD_ASSERT((FLASH_SIZE(inst) % CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE) == 0, \ (.xip_cfg = MSPI_XIP_CONFIG_DT_INST(inst),)) \ IF_ENABLED(WITH_RESET_GPIO, \ (.reset = GPIO_DT_SPEC_INST_GET_OR(inst, reset_gpios, {0}), \ - .reset_pulse_us = DT_INST_PROP_OR(inst, t_reset_pulse, 0) \ - / 1000,)) \ + .reset_pulse_us = DT_INST_PROP_OR(inst, t_reset_pulse, 0) \ + / 1000, \ .reset_recovery_us = DT_INST_PROP_OR(inst, t_reset_recovery, 0) \ - / 1000, \ + / 1000,)) \ .transfer_timeout = DT_INST_PROP(inst, transfer_timeout), \ FLASH_PAGE_LAYOUT_DEFINE(inst) \ .jedec_id = DT_INST_PROP_OR(inst, jedec_id, {0}), \ @@ -1308,7 +1228,6 @@ BUILD_ASSERT((FLASH_SIZE(inst) % CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE) == 0, \ .multiperipheral_bus = DT_PROP(DT_INST_BUS(inst), \ software_multiperipheral), \ IO_MODE_FLAGS(DT_INST_ENUM_IDX(inst, mspi_io_mode)), \ - .initial_soft_reset = DT_INST_PROP(inst, initial_soft_reset), \ }; \ FLASH_PAGE_LAYOUT_CHECK(inst) \ DEVICE_DT_INST_DEFINE(inst, \ diff --git a/drivers/flash/flash_mspi_nor.h b/drivers/flash/flash_mspi_nor.h index a32186439825..13b12d58221b 100644 --- a/drivers/flash/flash_mspi_nor.h +++ b/drivers/flash/flash_mspi_nor.h @@ -19,9 +19,6 @@ extern "C" { #if DT_ANY_INST_HAS_PROP_STATUS_OKAY(reset_gpios) #define WITH_RESET_GPIO 1 #endif -#if DT_ANY_INST_HAS_BOOL_STATUS_OKAY(initial_soft_reset) -#define WITH_SOFT_RESET 1 -#endif #define CMD_EXTENSION_NONE 0 #define CMD_EXTENSION_SAME 1 @@ -78,8 +75,8 @@ struct flash_mspi_nor_config { #if defined(WITH_RESET_GPIO) struct gpio_dt_spec reset; uint32_t reset_pulse_us; -#endif uint32_t reset_recovery_us; +#endif uint32_t transfer_timeout; #if defined(CONFIG_FLASH_PAGE_LAYOUT) struct flash_pages_layout layout; @@ -94,7 +91,6 @@ struct flash_mspi_nor_config { bool multiperipheral_bus : 1; bool multi_io_cmd : 1; bool single_io_addr : 1; - bool initial_soft_reset : 1; }; struct flash_mspi_nor_data { diff --git a/drivers/flash/flash_mspi_nor_sfdp.h b/drivers/flash/flash_mspi_nor_sfdp.h index 8dbecff01e80..e8291a7af2ab 100644 --- a/drivers/flash/flash_mspi_nor_sfdp.h +++ b/drivers/flash/flash_mspi_nor_sfdp.h @@ -6,8 +6,6 @@ #ifdef CONFIG_FLASH_MSPI_NOR_USE_SFDP -#define BFP_DW16_SOFT_RESET_66_99 BIT(4) - #define BFP_DW16_4B_ADDR_ENTER_B7 BIT(0) #define BFP_DW16_4B_ADDR_ENTER_06_B7 BIT(1) #define BFP_DW16_4B_ADDR_PER_CMD BIT(5) @@ -361,11 +359,6 @@ BFP_DW16_4B_ADDR_PER_CMD | \ BFP_DW16_4B_ADDR_ALWAYS)), \ "No supported method of entering 4-byte addressing mode for " \ - DT_NODE_FULL_NAME(DT_DRV_INST(inst))); \ - BUILD_ASSERT(!DT_INST_PROP(inst, initial_soft_reset) || \ - (SFDP_FIELD(inst, sfdp_bfp, 16, GENMASK(13, 8)) \ - & BFP_DW16_SOFT_RESET_66_99), \ - "Cannot use 66h/99h soft reset sequence for " \ DT_NODE_FULL_NAME(DT_DRV_INST(inst))) #else diff --git a/dts/bindings/mtd/jedec,mspi-nor.yaml b/dts/bindings/mtd/jedec,mspi-nor.yaml index 01eba90ecb2c..40bfe3539430 100644 --- a/dts/bindings/mtd/jedec,mspi-nor.yaml +++ b/dts/bindings/mtd/jedec,mspi-nor.yaml @@ -52,9 +52,3 @@ properties: codes for commands that require addresses (like Read, Page Program, or Erase) if those are supported by the flash chip, or if necessary, it will switch the chip to 4-byte addressing mode. - - initial-soft-reset: - type: boolean - description: | - When set, the flash driver performs software reset of the flash chip - at initialization. From d5fd96190ef3c370f8b7c1215c32dda7b5e2d337 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:28 +0300 Subject: [PATCH 0871/2141] Revert "[nrf fromtree] drivers: flash_mspi_nor: Complete handling of QER, add handling of OER" This reverts commit 79bc3aa74768e2d203f73cd9ce9efbdca4b36186. Signed-off-by: Jukka Rissanen --- drivers/flash/flash_mspi_nor.c | 151 ++++---------------------- drivers/flash/flash_mspi_nor_quirks.h | 6 + 2 files changed, 25 insertions(+), 132 deletions(-) diff --git a/drivers/flash/flash_mspi_nor.c b/drivers/flash/flash_mspi_nor.c index b4b5589a14f4..abf9bb85fc8c 100644 --- a/drivers/flash/flash_mspi_nor.c +++ b/drivers/flash/flash_mspi_nor.c @@ -638,138 +638,31 @@ static int dev_pm_action_cb(const struct device *dev, static int quad_enable_set(const struct device *dev, bool enable) { struct flash_mspi_nor_data *dev_data = dev->data; - uint8_t op_code; - uint8_t qe_bit; - uint8_t status_reg; - uint8_t payload_len; - uint8_t payload[2]; int rc; - switch (dev_data->switch_info.quad_enable_req) { - case JESD216_DW15_QER_VAL_S1B6: - op_code = SPI_NOR_CMD_RDSR; - qe_bit = BIT(6); - break; - case JESD216_DW15_QER_VAL_S2B7: - /* Use special Read status register 2 instruction. */ - op_code = 0x3F; - qe_bit = BIT(7); - break; - case JESD216_DW15_QER_VAL_S2B1v1: - case JESD216_DW15_QER_VAL_S2B1v4: - case JESD216_DW15_QER_VAL_S2B1v5: - case JESD216_DW15_QER_VAL_S2B1v6: - op_code = SPI_NOR_CMD_RDSR2; - qe_bit = BIT(1); - break; - default: - LOG_ERR("Unknown Quad Enable Requirement: %u", - dev_data->switch_info.quad_enable_req); - return -ENOTSUP; - } - - rc = cmd_rdsr(dev, op_code, &status_reg); + rc = cmd_wren(dev); if (rc < 0) { + LOG_ERR("Failed to set write enable: %d", rc); return rc; } - if (((status_reg & qe_bit) != 0) == enable) { - /* Nothing to do, the QE bit is already set properly. */ - return 0; - } - - status_reg ^= qe_bit; - - switch (dev_data->switch_info.quad_enable_req) { - default: - case JESD216_DW15_QER_VAL_S1B6: - payload_len = 1; - op_code = SPI_NOR_CMD_WRSR; - break; - case JESD216_DW15_QER_VAL_S2B7: - payload_len = 1; - /* Use special Write status register 2 instruction. */ - op_code = 0x3E; - break; - case JESD216_DW15_QER_VAL_S2B1v1: - case JESD216_DW15_QER_VAL_S2B1v4: - case JESD216_DW15_QER_VAL_S2B1v5: - payload_len = 2; - op_code = SPI_NOR_CMD_WRSR; - break; - case JESD216_DW15_QER_VAL_S2B1v6: - payload_len = 1; - op_code = SPI_NOR_CMD_WRSR2; - break; - } - - if (payload_len == 1) { - payload[0] = status_reg; - } else { - payload[1] = status_reg; + if (dev_data->switch_info.quad_enable_req == JESD216_DW15_QER_VAL_S1B6) { + uint8_t mode_payload = enable ? BIT(6) : 0; - /* When the Write Status command is to be sent with two data - * bytes (this is the case for S2B1v1, S2B1v4, and S2B1v5 QER - * values), the first status register needs to be read and - * sent as the first byte, so that its value is not modified. - */ - rc = cmd_rdsr(dev, SPI_NOR_CMD_RDSR, &payload[0]); + rc = cmd_wrsr(dev, SPI_NOR_CMD_WRSR, 1, &mode_payload); if (rc < 0) { + LOG_ERR("Failed to enable/disable quad mode: %d", rc); return rc; } - } - - rc = cmd_wrsr(dev, op_code, payload_len, payload); - if (rc < 0) { - return rc; - } - - return 0; -} - -static int octal_enable_set(const struct device *dev, bool enable) -{ - struct flash_mspi_nor_data *dev_data = dev->data; - uint8_t op_code; - uint8_t oe_bit; - uint8_t status_reg; - int rc; - - if (dev_data->switch_info.octal_enable_req != OCTAL_ENABLE_REQ_S2B3) { - LOG_ERR("Unknown Octal Enable Requirement: %u", - dev_data->switch_info.octal_enable_req); + } else { + /* TODO: handle all DW15 QER values */ return -ENOTSUP; } - oe_bit = BIT(3); - - /* Use special Read status register 2 instruction 0x65 with one address - * byte 0x02 and one dummy byte. - */ - op_code = 0x65; - set_up_xfer(dev, MSPI_RX); - dev_data->xfer.rx_dummy = 8; - dev_data->xfer.addr_length = 1; - dev_data->packet.address = 0x02; - dev_data->packet.num_bytes = sizeof(uint8_t); - dev_data->packet.data_buf = &status_reg; - rc = perform_xfer(dev, op_code, false); - if (rc < 0) { - LOG_ERR("cmd_rdsr 0x%02x failed: %d", op_code, rc); - return rc; - } - - if (((status_reg & oe_bit) != 0) == enable) { - /* Nothing to do, the OE bit is already set properly. */ - return 0; - } - - status_reg ^= oe_bit; + rc = wait_until_ready(dev, K_USEC(1)); - /* Use special Write status register 2 instruction to clear the bit. */ - op_code = (status_reg & oe_bit) ? SPI_NOR_CMD_WRSR2 : 0x3E; - rc = cmd_wrsr(dev, op_code, 1, &status_reg); if (rc < 0) { + LOG_ERR("Failed waiting until device ready after enabling quad: %d", rc); return rc; } @@ -806,24 +699,18 @@ static int switch_to_target_io_mode(const struct device *dev) int rc = 0; if (dev_data->switch_info.quad_enable_req != JESD216_DW15_QER_VAL_NONE) { - bool quad_needed = io_mode == MSPI_IO_MODE_QUAD_1_1_4 || - io_mode == MSPI_IO_MODE_QUAD_1_4_4; - - rc = quad_enable_set(dev, quad_needed); - if (rc < 0) { - LOG_ERR("Failed to modify Quad Enable bit: %d", rc); - return rc; + /* For Quad 1-1-4 and 1-4-4, entering or leaving mode is defined + * in JEDEC216 BFP DW15 QER + */ + if (io_mode == MSPI_IO_MODE_SINGLE) { + rc = quad_enable_set(dev, false); + } else if (io_mode == MSPI_IO_MODE_QUAD_1_1_4 || + io_mode == MSPI_IO_MODE_QUAD_1_4_4) { + rc = quad_enable_set(dev, true); } - } - if (dev_data->switch_info.octal_enable_req != OCTAL_ENABLE_REQ_NONE) { - bool octal_needed = io_mode == MSPI_IO_MODE_OCTAL_1_1_8 || - io_mode == MSPI_IO_MODE_OCTAL_1_8_8; - - rc = octal_enable_set(dev, octal_needed); if (rc < 0) { - LOG_ERR("Failed to modify Octal Enable bit: %d", rc); - return rc; + LOG_ERR("Failed to modify Quad Enable bit: %d", rc); } } diff --git a/drivers/flash/flash_mspi_nor_quirks.h b/drivers/flash/flash_mspi_nor_quirks.h index e6989496b325..391a075131d3 100644 --- a/drivers/flash/flash_mspi_nor_quirks.h +++ b/drivers/flash/flash_mspi_nor_quirks.h @@ -70,6 +70,12 @@ static inline int mxicy_mx25r_post_switch_mode(const struct device *dev) return 0; } + /* Wait for previous write to finish */ + rc = wait_until_ready(dev, K_USEC(1)); + if (rc < 0) { + return rc; + } + /* Write enable */ rc = cmd_wren(dev); if (rc < 0) { From f7c295d17e5499677dce69e9b23e3f3ff654e288 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:28 +0300 Subject: [PATCH 0872/2141] Revert "[nrf fromtree] drivers: flash_mspi_nor: Refactor handling of commands" This reverts commit 034396afc6d0dc498bd5e8f075f84ae258e58651. Signed-off-by: Jukka Rissanen --- drivers/flash/flash_mspi_nor.c | 771 ++++++++++---------------- drivers/flash/flash_mspi_nor.h | 199 ++++++- drivers/flash/flash_mspi_nor_quirks.h | 68 ++- drivers/flash/flash_mspi_nor_sfdp.h | 17 +- dts/bindings/mtd/jedec,mspi-nor.yaml | 24 +- 5 files changed, 528 insertions(+), 551 deletions(-) diff --git a/drivers/flash/flash_mspi_nor.c b/drivers/flash/flash_mspi_nor.c index abf9bb85fc8c..125aedfa250f 100644 --- a/drivers/flash/flash_mspi_nor.c +++ b/drivers/flash/flash_mspi_nor.c @@ -16,30 +16,12 @@ LOG_MODULE_REGISTER(flash_mspi_nor, CONFIG_FLASH_LOG_LEVEL); -#define XIP_DEV_CFG_MASK (MSPI_DEVICE_CONFIG_CMD_LEN || \ - MSPI_DEVICE_CONFIG_ADDR_LEN || \ - MSPI_DEVICE_CONFIG_READ_CMD || \ - MSPI_DEVICE_CONFIG_WRITE_CMD || \ - MSPI_DEVICE_CONFIG_RX_DUMMY || \ - MSPI_DEVICE_CONFIG_TX_DUMMY) - -#define NON_XIP_DEV_CFG_MASK (MSPI_DEVICE_CONFIG_ALL & ~XIP_DEV_CFG_MASK) - -static void set_up_xfer(const struct device *dev, enum mspi_xfer_direction dir); -static int perform_xfer(const struct device *dev, - uint8_t cmd, bool mem_access); -static int cmd_rdsr(const struct device *dev, uint8_t op_code, uint8_t *sr); -static int wait_until_ready(const struct device *dev, k_timeout_t poll_period); -static int cmd_wren(const struct device *dev); -static int cmd_wrsr(const struct device *dev, uint8_t op_code, - uint8_t sr_cnt, uint8_t *sr); - #include "flash_mspi_nor_quirks.h" -static void set_up_xfer(const struct device *dev, enum mspi_xfer_direction dir) +void flash_mspi_command_set(const struct device *dev, const struct flash_mspi_nor_cmd *cmd) { - const struct flash_mspi_nor_config *dev_config = dev->config; struct flash_mspi_nor_data *dev_data = dev->data; + const struct flash_mspi_nor_config *dev_config = dev->config; memset(&dev_data->xfer, 0, sizeof(dev_data->xfer)); memset(&dev_data->packet, 0, sizeof(dev_data->packet)); @@ -49,186 +31,32 @@ static void set_up_xfer(const struct device *dev, enum mspi_xfer_direction dir) dev_data->xfer.num_packet = 1; dev_data->xfer.timeout = dev_config->transfer_timeout; - dev_data->packet.dir = dir; -} - -static void set_up_xfer_with_addr(const struct device *dev, - enum mspi_xfer_direction dir, - uint32_t addr) -{ - struct flash_mspi_nor_data *dev_data = dev->data; - - set_up_xfer(dev, dir); - dev_data->xfer.addr_length = dev_data->cmd_info.uses_4byte_addr - ? 4 : 3; - dev_data->packet.address = addr; -} - -static uint16_t get_extended_command(const struct device *dev, - uint8_t cmd) -{ - struct flash_mspi_nor_data *dev_data = dev->data; - uint8_t cmd_extension = cmd; - - if (dev_data->cmd_info.cmd_extension == CMD_EXTENSION_INVERSE) { - cmd_extension = ~cmd_extension; - } + dev_data->xfer.cmd_length = cmd->cmd_length; + dev_data->xfer.addr_length = cmd->addr_length; + dev_data->xfer.tx_dummy = (cmd->dir == MSPI_TX) ? + cmd->tx_dummy : dev_config->mspi_nor_cfg.tx_dummy; + dev_data->xfer.rx_dummy = (cmd->dir == MSPI_RX) ? + cmd->rx_dummy : dev_config->mspi_nor_cfg.rx_dummy; - return ((uint16_t)cmd << 8) | cmd_extension; + dev_data->packet.dir = cmd->dir; + dev_data->packet.cmd = cmd->cmd; } -static int perform_xfer(const struct device *dev, - uint8_t cmd, bool mem_access) +static int dev_cfg_apply(const struct device *dev, const struct mspi_dev_cfg *cfg) { const struct flash_mspi_nor_config *dev_config = dev->config; struct flash_mspi_nor_data *dev_data = dev->data; - const struct mspi_dev_cfg *cfg = NULL; - int rc; - - if (dev_data->cmd_info.cmd_extension != CMD_EXTENSION_NONE && - dev_data->in_target_io_mode) { - dev_data->xfer.cmd_length = 2; - dev_data->packet.cmd = get_extended_command(dev, cmd); - } else { - dev_data->xfer.cmd_length = 1; - dev_data->packet.cmd = cmd; - } - - if (dev_config->multi_io_cmd || - dev_config->mspi_nor_cfg.io_mode == MSPI_IO_MODE_SINGLE) { - /* If multiple IO lines are used in all the transfer phases - * or in none of them, there's no need to switch the IO mode. - */ - } else if (mem_access) { - /* For commands accessing the flash memory (read and program), - * ensure that the target IO mode is active. - */ - if (!dev_data->in_target_io_mode) { - cfg = &dev_config->mspi_nor_cfg; - } - } else { - /* For all other commands, switch to Single IO mode if a given - * command needs the data or address phase and in the target IO - * mode multiple IO lines are used in these phases. - */ - if (dev_data->in_target_io_mode) { - if (dev_data->packet.num_bytes != 0 || - (dev_data->xfer.addr_length != 0 && - !dev_config->single_io_addr)) { - /* Only the IO mode is to be changed, so the - * initial configuration structure can be used - * for this operation. - */ - cfg = &dev_config->mspi_nor_init_cfg; - } - } - } - - if (cfg) { - rc = mspi_dev_config(dev_config->bus, &dev_config->mspi_id, - MSPI_DEVICE_CONFIG_IO_MODE, cfg); - if (rc < 0) { - LOG_ERR("%s: dev_config() failed: %d", __func__, rc); - return rc; - } - - dev_data->in_target_io_mode = mem_access; - } - - rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, - &dev_data->xfer); - if (rc < 0) { - LOG_ERR("%s: transceive() failed: %d", __func__, rc); - return rc; - } - - return 0; -} - -static int cmd_rdsr(const struct device *dev, uint8_t op_code, uint8_t *sr) -{ - struct flash_mspi_nor_data *dev_data = dev->data; - int rc; - - set_up_xfer(dev, MSPI_RX); - if (dev_data->in_target_io_mode) { - dev_data->xfer.rx_dummy = dev_data->cmd_info.rdsr_dummy; - dev_data->xfer.addr_length = dev_data->cmd_info.rdsr_addr_4 - ? 4 : 0; - } - dev_data->packet.num_bytes = sizeof(uint8_t); - dev_data->packet.data_buf = sr; - rc = perform_xfer(dev, op_code, false); - if (rc < 0) { - LOG_ERR("%s 0x%02x failed: %d", __func__, op_code, rc); - return rc; - } - - return 0; -} - -static int wait_until_ready(const struct device *dev, k_timeout_t poll_period) -{ - int rc; - uint8_t status_reg; - - while (true) { - rc = cmd_rdsr(dev, SPI_NOR_CMD_RDSR, &status_reg); - if (rc < 0) { - LOG_ERR("%s - status xfer failed: %d", __func__, rc); - return rc; - } - - if (!(status_reg & SPI_NOR_WIP_BIT)) { - break; - } - - k_sleep(poll_period); - } - - return 0; -} - -static int cmd_wren(const struct device *dev) -{ - int rc; - - set_up_xfer(dev, MSPI_TX); - rc = perform_xfer(dev, SPI_NOR_CMD_WREN, false); - if (rc < 0) { - LOG_ERR("%s failed: %d", __func__, rc); - return rc; - } - - return 0; -} -static int cmd_wrsr(const struct device *dev, uint8_t op_code, - uint8_t sr_cnt, uint8_t *sr) -{ - struct flash_mspi_nor_data *dev_data = dev->data; - int rc; - - rc = cmd_wren(dev); - if (rc < 0) { - return rc; - } - - set_up_xfer(dev, MSPI_TX); - dev_data->packet.num_bytes = sr_cnt; - dev_data->packet.data_buf = sr; - rc = perform_xfer(dev, op_code, false); - if (rc < 0) { - LOG_ERR("%s 0x%02x failed: %d", __func__, op_code, rc); - return rc; + if (dev_data->curr_cfg == cfg) { + return 0; } - rc = wait_until_ready(dev, K_USEC(1)); + int rc = mspi_dev_config(dev_config->bus, &dev_config->mspi_id, + MSPI_DEVICE_CONFIG_ALL, cfg); if (rc < 0) { - return rc; + LOG_ERR("Failed to set device config: %p error: %d", cfg, rc); } - - return 0; + return rc; } static int acquire(const struct device *dev) @@ -243,26 +71,15 @@ static int acquire(const struct device *dev) if (rc < 0) { LOG_ERR("pm_device_runtime_get() failed: %d", rc); } else { - enum mspi_dev_cfg_mask mask; - - if (dev_config->multiperipheral_bus) { - mask = NON_XIP_DEV_CFG_MASK; - } else { - mask = MSPI_DEVICE_CONFIG_NONE; - } - /* This acquires the MSPI controller and reconfigures it * if needed for the flash device. */ rc = mspi_dev_config(dev_config->bus, &dev_config->mspi_id, - mask, &dev_config->mspi_nor_cfg); + dev_config->mspi_nor_cfg_mask, + &dev_config->mspi_nor_cfg); if (rc < 0) { LOG_ERR("mspi_dev_config() failed: %d", rc); } else { - if (dev_config->multiperipheral_bus) { - dev_data->in_target_io_mode = true; - } - return 0; } @@ -300,34 +117,10 @@ static inline uint16_t dev_page_size(const struct device *dev) return dev_config->page_size; } -static inline -const struct jesd216_erase_type *dev_erase_types(const struct device *dev) -{ - struct flash_mspi_nor_data *dev_data = dev->data; - - return dev_data->erase_types; -} - -static uint8_t get_rx_dummy(const struct device *dev) -{ - const struct flash_mspi_nor_config *dev_config = dev->config; - struct flash_mspi_nor_data *dev_data = dev->data; - - /* If the number of RX dummy cycles is specified in dts, use that value. */ - if (dev_config->rx_dummy_specified) { - return dev_config->mspi_nor_cfg.rx_dummy; - } - - /* Since it's not yet possible to specify mode bits with MSPI API, - * treat mode bit cycles as just dummy. - */ - return dev_data->cmd_info.read_mode_bit_cycles + - dev_data->cmd_info.read_dummy_cycles; -} - static int api_read(const struct device *dev, off_t addr, void *dest, size_t size) { + const struct flash_mspi_nor_config *dev_config = dev->config; struct flash_mspi_nor_data *dev_data = dev->data; const uint32_t flash_size = dev_flash_size(dev); int rc; @@ -345,11 +138,23 @@ static int api_read(const struct device *dev, off_t addr, void *dest, return rc; } - set_up_xfer_with_addr(dev, MSPI_RX, addr); - dev_data->xfer.rx_dummy = get_rx_dummy(dev); + if (dev_config->jedec_cmds->read.force_single) { + rc = dev_cfg_apply(dev, &dev_config->mspi_nor_init_cfg); + } else { + rc = dev_cfg_apply(dev, &dev_config->mspi_nor_cfg); + } + + if (rc < 0) { + return rc; + } + + /* TODO: get rid of all these hard-coded values for MX25Ux chips */ + flash_mspi_command_set(dev, &dev_config->jedec_cmds->read); + dev_data->packet.address = addr; dev_data->packet.data_buf = dest; dev_data->packet.num_bytes = size; - rc = perform_xfer(dev, dev_data->cmd_info.read_cmd, true); + rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, + &dev_data->xfer); release(dev); @@ -361,9 +166,85 @@ static int api_read(const struct device *dev, off_t addr, void *dest, return 0; } +static int status_get(const struct device *dev, uint8_t *status) +{ + const struct flash_mspi_nor_config *dev_config = dev->config; + struct flash_mspi_nor_data *dev_data = dev->data; + int rc; + + /* Enter command mode */ + if (dev_config->jedec_cmds->status.force_single) { + rc = dev_cfg_apply(dev, &dev_config->mspi_nor_init_cfg); + } else { + rc = dev_cfg_apply(dev, &dev_config->mspi_nor_cfg); + } + + if (rc < 0) { + LOG_ERR("Switching to dev_cfg failed: %d", rc); + return rc; + } + + flash_mspi_command_set(dev, &dev_config->jedec_cmds->status); + dev_data->packet.data_buf = status; + dev_data->packet.num_bytes = sizeof(uint8_t); + + rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, &dev_data->xfer); + + if (rc < 0) { + LOG_ERR("Status xfer failed: %d", rc); + return rc; + } + + return rc; +} + +static int wait_until_ready(const struct device *dev, k_timeout_t poll_period) +{ + int rc; + uint8_t status_reg; + + while (true) { + rc = status_get(dev, &status_reg); + + if (rc < 0) { + LOG_ERR("Wait until ready - status xfer failed: %d", rc); + return rc; + } + + if (!(status_reg & SPI_NOR_WIP_BIT)) { + break; + } + + k_sleep(poll_period); + } + + return 0; +} + +static int write_enable(const struct device *dev) +{ + const struct flash_mspi_nor_config *dev_config = dev->config; + struct flash_mspi_nor_data *dev_data = dev->data; + int rc; + + if (dev_config->jedec_cmds->write_en.force_single) { + rc = dev_cfg_apply(dev, &dev_config->mspi_nor_init_cfg); + } else { + rc = dev_cfg_apply(dev, &dev_config->mspi_nor_cfg); + } + + if (rc < 0) { + return rc; + } + + flash_mspi_command_set(dev, &dev_config->jedec_cmds->write_en); + return mspi_transceive(dev_config->bus, &dev_config->mspi_id, &dev_data->xfer); +} + static int api_write(const struct device *dev, off_t addr, const void *src, size_t size) { + const struct flash_mspi_nor_config *dev_config = dev->config; struct flash_mspi_nor_data *dev_data = dev->data; const uint32_t flash_size = dev_flash_size(dev); const uint16_t page_size = dev_page_size(dev); @@ -388,14 +269,27 @@ static int api_write(const struct device *dev, off_t addr, const void *src, uint16_t page_left = page_size - page_offset; uint16_t to_write = (uint16_t)MIN(size, page_left); - if (cmd_wren(dev) < 0) { + if (write_enable(dev) < 0) { + LOG_ERR("Write enable xfer failed: %d", rc); break; } - set_up_xfer_with_addr(dev, MSPI_TX, addr); + if (dev_config->jedec_cmds->page_program.force_single) { + rc = dev_cfg_apply(dev, &dev_config->mspi_nor_init_cfg); + } else { + rc = dev_cfg_apply(dev, &dev_config->mspi_nor_cfg); + } + + if (rc < 0) { + return rc; + } + + flash_mspi_command_set(dev, &dev_config->jedec_cmds->page_program); + dev_data->packet.address = addr; dev_data->packet.data_buf = (uint8_t *)src; dev_data->packet.num_bytes = to_write; - rc = perform_xfer(dev, dev_data->cmd_info.pp_cmd, true); + rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, + &dev_data->xfer); if (rc < 0) { LOG_ERR("Page program xfer failed: %d", rc); break; @@ -416,28 +310,9 @@ static int api_write(const struct device *dev, off_t addr, const void *src, return rc; } -static const struct jesd216_erase_type *find_best_erase_type( - const struct device *dev, off_t addr, size_t size) -{ - const struct jesd216_erase_type *erase_types = dev_erase_types(dev); - const struct jesd216_erase_type *best_et = NULL; - - for (int i = 0; i < JESD216_NUM_ERASE_TYPES; ++i) { - const struct jesd216_erase_type *et = &erase_types[i]; - - if ((et->exp != 0) - && SPI_NOR_IS_ALIGNED(addr, et->exp) - && (size >= BIT(et->exp)) - && ((best_et == NULL) || (et->exp > best_et->exp))) { - best_et = et; - } - } - - return best_et; -} - static int api_erase(const struct device *dev, off_t addr, size_t size) { + const struct flash_mspi_nor_config *dev_config = dev->config; struct flash_mspi_nor_data *dev_data = dev->data; const uint32_t flash_size = dev_flash_size(dev); int rc = 0; @@ -460,33 +335,45 @@ static int api_erase(const struct device *dev, off_t addr, size_t size) } while (size > 0) { - if (cmd_wren(dev) < 0) { + rc = write_enable(dev); + if (rc < 0) { + LOG_ERR("Write enable failed."); break; } if (size == flash_size) { /* Chip erase. */ - set_up_xfer(dev, MSPI_TX); - rc = perform_xfer(dev, SPI_NOR_CMD_CE, false); + if (dev_config->jedec_cmds->chip_erase.force_single) { + rc = dev_cfg_apply(dev, &dev_config->mspi_nor_init_cfg); + } else { + rc = dev_cfg_apply(dev, &dev_config->mspi_nor_cfg); + } + + if (rc < 0) { + return rc; + } + flash_mspi_command_set(dev, &dev_config->jedec_cmds->chip_erase); size -= flash_size; } else { - const struct jesd216_erase_type *best_et = - find_best_erase_type(dev, addr, size); - - if (best_et != NULL) { - set_up_xfer_with_addr(dev, MSPI_TX, addr); - rc = perform_xfer(dev, best_et->cmd, false); - - addr += BIT(best_et->exp); - size -= BIT(best_et->exp); + /* Sector erase. */ + if (dev_config->jedec_cmds->sector_erase.force_single) { + rc = dev_cfg_apply(dev, &dev_config->mspi_nor_init_cfg); } else { - LOG_ERR("Can't erase %zu at 0x%lx", - size, (long)addr); - rc = -EINVAL; - break; + rc = dev_cfg_apply(dev, &dev_config->mspi_nor_cfg); } + + if (rc < 0) { + return rc; + } + + flash_mspi_command_set(dev, &dev_config->jedec_cmds->sector_erase); + dev_data->packet.address = addr; + addr += SPI_NOR_SECTOR_SIZE; + size -= SPI_NOR_SECTOR_SIZE; } + rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, + &dev_data->xfer); if (rc < 0) { LOG_ERR("Erase command 0x%02x xfer failed: %d", dev_data->packet.cmd, rc); @@ -523,49 +410,30 @@ struct flash_parameters *api_get_parameters(const struct device *dev) return ¶meters; } -static int sfdp_read(const struct device *dev, off_t addr, void *dest, - size_t size) +static int read_jedec_id(const struct device *dev, uint8_t *id) { + const struct flash_mspi_nor_config *dev_config = dev->config; struct flash_mspi_nor_data *dev_data = dev->data; int rc; - set_up_xfer(dev, MSPI_RX); - if (dev_data->in_target_io_mode) { - dev_data->xfer.rx_dummy = dev_data->cmd_info.sfdp_dummy_20 - ? 20 : 8; - dev_data->xfer.addr_length = dev_data->cmd_info.sfdp_addr_4 - ? 4 : 3; + if (dev_config->jedec_cmds->id.force_single) { + rc = dev_cfg_apply(dev, &dev_config->mspi_nor_init_cfg); } else { - dev_data->xfer.rx_dummy = 8; - dev_data->xfer.addr_length = 3; + rc = dev_cfg_apply(dev, &dev_config->mspi_nor_cfg); } - dev_data->packet.address = addr; - dev_data->packet.data_buf = dest; - dev_data->packet.num_bytes = size; - rc = perform_xfer(dev, JESD216_CMD_READ_SFDP, false); + if (rc < 0) { - LOG_ERR("Read SFDP xfer failed: %d", rc); + return rc; } - return rc; -} - -static int read_jedec_id(const struct device *dev, uint8_t *id) -{ - struct flash_mspi_nor_data *dev_data = dev->data; - int rc; - - set_up_xfer(dev, MSPI_RX); - if (dev_data->in_target_io_mode) { - dev_data->xfer.rx_dummy = dev_data->cmd_info.rdid_dummy; - dev_data->xfer.addr_length = dev_data->cmd_info.rdid_addr_4 - ? 4 : 0; - } + flash_mspi_command_set(dev, &dev_config->jedec_cmds->id); dev_data->packet.data_buf = id; dev_data->packet.num_bytes = JESD216_READ_ID_LEN; - rc = perform_xfer(dev, SPI_NOR_CMD_RDID, false); + + rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, + &dev_data->xfer); if (rc < 0) { - LOG_ERR("Read JEDEC ID failed: %d", rc); + LOG_ERR("Read JEDEC ID failed: %d\n", rc); } return rc; @@ -587,6 +455,8 @@ static void api_page_layout(const struct device *dev, static int api_sfdp_read(const struct device *dev, off_t addr, void *dest, size_t size) { + const struct flash_mspi_nor_config *dev_config = dev->config; + struct flash_mspi_nor_data *dev_data = dev->data; int rc; if (size == 0) { @@ -598,7 +468,26 @@ static int api_sfdp_read(const struct device *dev, off_t addr, void *dest, return rc; } - rc = sfdp_read(dev, addr, dest, size); + if (dev_config->jedec_cmds->sfdp.force_single) { + rc = dev_cfg_apply(dev, &dev_config->mspi_nor_init_cfg); + } else { + rc = dev_cfg_apply(dev, &dev_config->mspi_nor_cfg); + } + + if (rc < 0) { + return rc; + } + + flash_mspi_command_set(dev, &dev_config->jedec_cmds->sfdp); + dev_data->packet.address = addr; + dev_data->packet.data_buf = dest; + dev_data->packet.num_bytes = size; + rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, + &dev_data->xfer); + if (rc < 0) { + printk("Read SFDP xfer failed: %d\n", rc); + return rc; + } release(dev); @@ -637,19 +526,31 @@ static int dev_pm_action_cb(const struct device *dev, static int quad_enable_set(const struct device *dev, bool enable) { + const struct flash_mspi_nor_config *dev_config = dev->config; struct flash_mspi_nor_data *dev_data = dev->data; int rc; - rc = cmd_wren(dev); + flash_mspi_command_set(dev, &commands_single.write_en); + rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, + &dev_data->xfer); if (rc < 0) { LOG_ERR("Failed to set write enable: %d", rc); return rc; } if (dev_data->switch_info.quad_enable_req == JESD216_DW15_QER_VAL_S1B6) { + const struct flash_mspi_nor_cmd cmd_status = { + .dir = MSPI_TX, + .cmd = SPI_NOR_CMD_WRSR, + .cmd_length = 1, + }; uint8_t mode_payload = enable ? BIT(6) : 0; - rc = cmd_wrsr(dev, SPI_NOR_CMD_WRSR, 1, &mode_payload); + flash_mspi_command_set(dev, &cmd_status); + dev_data->packet.data_buf = &mode_payload; + dev_data->packet.num_bytes = sizeof(mode_payload); + rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, &dev_data->xfer); + if (rc < 0) { LOG_ERR("Failed to enable/disable quad mode: %d", rc); return rc; @@ -669,29 +570,8 @@ static int quad_enable_set(const struct device *dev, bool enable) return 0; } -static int enter_4byte_addressing_mode(const struct device *dev) -{ - struct flash_mspi_nor_data *dev_data = dev->data; - int rc; - - if (dev_data->switch_info.enter_4byte_addr == ENTER_4BYTE_ADDR_06_B7) { - rc = cmd_wren(dev); - if (rc < 0) { - return rc; - } - } - - set_up_xfer(dev, MSPI_TX); - rc = perform_xfer(dev, 0xB7, false); - if (rc < 0) { - LOG_ERR("Command 0xB7 failed: %d", rc); - return rc; - } - return 0; -} - -static int switch_to_target_io_mode(const struct device *dev) +static int default_io_mode(const struct device *dev) { const struct flash_mspi_nor_config *dev_config = dev->config; struct flash_mspi_nor_data *dev_data = dev->data; @@ -714,25 +594,16 @@ static int switch_to_target_io_mode(const struct device *dev) } } - if (dev_data->switch_info.enter_4byte_addr != ENTER_4BYTE_ADDR_NONE) { - rc = enter_4byte_addressing_mode(dev); - if (rc < 0) { - LOG_ERR("Failed to enter 4-byte addressing mode: %d", rc); - return rc; - } + if ((dev_config->quirks != NULL) && (dev_config->quirks->post_switch_mode != NULL)) { + rc = dev_config->quirks->post_switch_mode(dev); } - if (dev_config->quirks != NULL && - dev_config->quirks->post_switch_mode != NULL) { - rc = dev_config->quirks->post_switch_mode(dev); - if (rc < 0) { - return rc; - } + if (rc < 0) { + LOG_ERR("Failed to change IO mode: %d\n", rc); + return rc; } - return mspi_dev_config(dev_config->bus, &dev_config->mspi_id, - NON_XIP_DEV_CFG_MASK, - &dev_config->mspi_nor_cfg); + return dev_cfg_apply(dev, &dev_config->mspi_nor_cfg); } #if defined(WITH_RESET_GPIO) @@ -780,20 +651,14 @@ static int flash_chip_init(const struct device *dev) struct flash_mspi_nor_data *dev_data = dev->data; enum mspi_io_mode io_mode = dev_config->mspi_nor_cfg.io_mode; uint8_t id[JESD216_READ_ID_LEN] = {0}; - uint16_t dts_cmd = 0; - uint32_t sfdp_signature; int rc; - rc = mspi_dev_config(dev_config->bus, &dev_config->mspi_id, - MSPI_DEVICE_CONFIG_ALL, - &dev_config->mspi_nor_init_cfg); + rc = dev_cfg_apply(dev, &dev_config->mspi_nor_init_cfg); + if (rc < 0) { - LOG_ERR("%s: dev_config() failed: %d", __func__, rc); return rc; } - dev_data->in_target_io_mode = false; - /* Some chips reuse RESET pin for data in Quad modes: * force single line mode before resetting. */ @@ -830,114 +695,51 @@ static int flash_chip_init(const struct device *dev) rc = dev_config->quirks->pre_init(dev); } - /* Allow users to specify commands for Read and Page Program operations - * through dts to override what was taken from SFDP and perhaps altered - * in the pre_init quirk. Also the number of dummy cycles for the Read - * operation can be overridden this way, see get_rx_dummy(). - */ - if (dev_config->mspi_nor_cfg.read_cmd != 0) { - dts_cmd = (uint16_t)dev_config->mspi_nor_cfg.read_cmd; - if (dev_config->mspi_nor_cfg.cmd_length > 1) { - dev_data->cmd_info.read_cmd = (uint8_t)(dts_cmd >> 8); - } else { - dev_data->cmd_info.read_cmd = (uint8_t)dts_cmd; - } - } - if (dev_config->mspi_nor_cfg.write_cmd != 0) { - dts_cmd = (uint16_t)dev_config->mspi_nor_cfg.write_cmd; - if (dev_config->mspi_nor_cfg.cmd_length > 1) { - dev_data->cmd_info.pp_cmd = (uint8_t)(dts_cmd >> 8); - } else { - dev_data->cmd_info.pp_cmd = (uint8_t)dts_cmd; - } - } - if (dts_cmd != 0) { - if (dev_config->mspi_nor_cfg.cmd_length <= 1) { - dev_data->cmd_info.cmd_extension = CMD_EXTENSION_NONE; - } else if ((dts_cmd & 0xFF) == ((dts_cmd >> 8) & 0xFF)) { - dev_data->cmd_info.cmd_extension = CMD_EXTENSION_SAME; - } else { - dev_data->cmd_info.cmd_extension = CMD_EXTENSION_INVERSE; - } - } - - if (dev_config->jedec_id_specified) { - rc = read_jedec_id(dev, id); - if (rc < 0) { - LOG_ERR("Failed to read JEDEC ID: %d", rc); - return rc; - } + flash_mspi_command_set(dev, &commands_single.id); + dev_data->packet.data_buf = id; + dev_data->packet.num_bytes = sizeof(id); - if (memcmp(id, dev_config->jedec_id, sizeof(id)) != 0) { - LOG_ERR("JEDEC ID mismatch, read: %02x %02x %02x, " - "expected: %02x %02x %02x", - id[0], id[1], id[2], - dev_config->jedec_id[0], - dev_config->jedec_id[1], - dev_config->jedec_id[2]); - return -ENODEV; - } + rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, + &dev_data->xfer); + if (rc < 0) { + LOG_ERR("Failed to read JEDEC ID in initial line mode: %d", rc); + return rc; } - rc = switch_to_target_io_mode(dev); + rc = default_io_mode(dev); + if (rc < 0) { - LOG_ERR("Failed to switch to target io mode: %d", rc); + LOG_ERR("Failed to switch to default io mode: %d", rc); return rc; } - dev_data->in_target_io_mode = true; - - if (IS_ENABLED(CONFIG_FLASH_MSPI_NOR_USE_SFDP)) { - /* Read the SFDP signature to test if communication with - * the flash chip can be successfully performed after switching - * to target IO mode. - */ - rc = sfdp_read(dev, 0, &sfdp_signature, sizeof(sfdp_signature)); + /* Reading JEDEC ID for mode that forces single lane would be redundant, + * since it switches back to single lane mode. Use ID from previous read. + */ + if (!dev_config->jedec_cmds->id.force_single) { + rc = read_jedec_id(dev, id); if (rc < 0) { - LOG_ERR("Failed to read SFDP signature: %d", rc); + LOG_ERR("Failed to read JEDEC ID in final line mode: %d", rc); return rc; } + } - if (sfdp_signature != JESD216_SFDP_MAGIC) { - LOG_ERR("SFDP signature mismatch: %08x, expected: %08x", - sfdp_signature, JESD216_SFDP_MAGIC); - return -ENODEV; - } + if (memcmp(id, dev_config->jedec_id, sizeof(id)) != 0) { + LOG_ERR("JEDEC ID mismatch, read: %02x %02x %02x, " + "expected: %02x %02x %02x", + id[0], id[1], id[2], + dev_config->jedec_id[0], + dev_config->jedec_id[1], + dev_config->jedec_id[2]); + return -ENODEV; } #if defined(CONFIG_MSPI_XIP) /* Enable XIP access for this chip if specified so in DT. */ if (dev_config->xip_cfg.enable) { - struct mspi_dev_cfg mspi_cfg = { - .addr_length = dev_data->cmd_info.uses_4byte_addr - ? 4 : 3, - .rx_dummy = get_rx_dummy(dev), - }; - - if (dev_data->cmd_info.cmd_extension != CMD_EXTENSION_NONE) { - mspi_cfg.cmd_length = 2; - mspi_cfg.read_cmd = get_extended_command(dev, - dev_data->cmd_info.read_cmd); - mspi_cfg.write_cmd = get_extended_command(dev, - dev_data->cmd_info.pp_cmd); - } else { - mspi_cfg.cmd_length = 1; - mspi_cfg.read_cmd = dev_data->cmd_info.read_cmd; - mspi_cfg.write_cmd = dev_data->cmd_info.pp_cmd; - } - - rc = mspi_dev_config(dev_config->bus, &dev_config->mspi_id, - XIP_DEV_CFG_MASK, &mspi_cfg); - if (rc < 0) { - LOG_ERR("Failed to configure controller for XIP: %d", - rc); - return rc; - } - rc = mspi_xip_config(dev_config->bus, &dev_config->mspi_id, &dev_config->xip_cfg); if (rc < 0) { - LOG_ERR("Failed to enable XIP: %d", rc); return rc; } } @@ -981,39 +783,6 @@ static int drv_init(const struct device *dev) return rc; } - if (dev_data->cmd_info.read_cmd == 0) { - LOG_ERR("Read command not defined for %s, " - "use \"read-command\" property to specify it.", - dev->name); - return -EINVAL; - } - - if (dev_data->cmd_info.pp_cmd == 0) { - LOG_ERR("Page Program command not defined for %s, " - "use \"write-command\" property to specify it.", - dev->name); - return -EINVAL; - } - - LOG_DBG("%s - size: %u, page %u%s", - dev->name, dev_flash_size(dev), dev_page_size(dev), - dev_data->cmd_info.uses_4byte_addr ? ", 4-byte addressing" : ""); - LOG_DBG("- read command: 0x%02X with %u mode bit and %u dummy cycles", - dev_data->cmd_info.read_cmd, - dev_data->cmd_info.read_mode_bit_cycles, - dev_data->cmd_info.read_dummy_cycles); - LOG_DBG("- page program command: 0x%02X", - dev_data->cmd_info.pp_cmd); - LOG_DBG("- erase types:"); - for (int i = 0; i < JESD216_NUM_ERASE_TYPES; ++i) { - const struct jesd216_erase_type *et = &dev_erase_types(dev)[i]; - - if (et->exp != 0) { - LOG_DBG(" - command: 0x%02X, size: %lu", - et->cmd, BIT(et->exp)); - } - } - k_sem_init(&dev_data->acquired, 1, K_SEM_MAX_LIMIT); return pm_device_driver_init(dev, dev_pm_action_cb); @@ -1046,18 +815,39 @@ static DEVICE_API(flash, drv_api) = { .dqs_enable = false, \ } -#define FLASH_QUIRKS(inst) FLASH_MSPI_QUIRKS_GET(DT_DRV_INST(inst)) +/* Define copies of mspi_io_mode enum values, so they can be used inside + * the COND_CODE_1 macros. + */ +#define _MSPI_IO_MODE_SINGLE 0 +#define _MSPI_IO_MODE_QUAD_1_4_4 6 +#define _MSPI_IO_MODE_OCTAL 7 +BUILD_ASSERT(_MSPI_IO_MODE_SINGLE == MSPI_IO_MODE_SINGLE, + "Please align _MSPI_IO_MODE_SINGLE macro value"); +BUILD_ASSERT(_MSPI_IO_MODE_QUAD_1_4_4 == MSPI_IO_MODE_QUAD_1_4_4, + "Please align _MSPI_IO_MODE_QUAD_1_4_4 macro value"); +BUILD_ASSERT(_MSPI_IO_MODE_OCTAL == MSPI_IO_MODE_OCTAL, + "Please align _MSPI_IO_MODE_OCTAL macro value"); + +/* Define a non-existing extern symbol to get an understandable compile-time error + * if the IO mode is not supported by the driver. + */ +extern const struct flash_mspi_nor_cmds mspi_io_mode_not_supported; + +#define FLASH_CMDS(inst) COND_CODE_1( \ + IS_EQ(DT_INST_ENUM_IDX(inst, mspi_io_mode), _MSPI_IO_MODE_SINGLE), \ + (&commands_single), \ + (COND_CODE_1( \ + IS_EQ(DT_INST_ENUM_IDX(inst, mspi_io_mode), _MSPI_IO_MODE_QUAD_1_4_4), \ + (&commands_quad_1_4_4), \ + (COND_CODE_1( \ + IS_EQ(DT_INST_ENUM_IDX(inst, mspi_io_mode), _MSPI_IO_MODE_OCTAL), \ + (&commands_octal), \ + (&mspi_io_mode_not_supported) \ + )) \ + )) \ +) -#define IO_MODE_FLAGS(io_mode) \ - .multi_io_cmd = (io_mode == MSPI_IO_MODE_DUAL || \ - io_mode == MSPI_IO_MODE_QUAD || \ - io_mode == MSPI_IO_MODE_OCTAL || \ - io_mode == MSPI_IO_MODE_HEX || \ - io_mode == MSPI_IO_MODE_HEX_8_8_16 || \ - io_mode == MSPI_IO_MODE_HEX_8_16_16), \ - .single_io_addr = (io_mode == MSPI_IO_MODE_DUAL_1_1_2 || \ - io_mode == MSPI_IO_MODE_QUAD_1_1_4 || \ - io_mode == MSPI_IO_MODE_OCTAL_1_1_8) +#define FLASH_QUIRKS(inst) FLASH_MSPI_QUIRKS_GET(DT_DRV_INST(inst)) #if defined(CONFIG_FLASH_PAGE_LAYOUT) BUILD_ASSERT((CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE % 4096) == 0, @@ -1084,6 +874,13 @@ BUILD_ASSERT((FLASH_SIZE(inst) % CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE) == 0, \ #endif #define FLASH_MSPI_NOR_INST(inst) \ + BUILD_ASSERT((DT_INST_ENUM_IDX(inst, mspi_io_mode) == \ + MSPI_IO_MODE_SINGLE) || \ + (DT_INST_ENUM_IDX(inst, mspi_io_mode) == \ + MSPI_IO_MODE_QUAD_1_4_4) || \ + (DT_INST_ENUM_IDX(inst, mspi_io_mode) == \ + MSPI_IO_MODE_OCTAL), \ + "Only 1x, 1-4-4 and 8x I/O modes are supported for now"); \ SFDP_BUILD_ASSERTS(inst); \ PM_DEVICE_DT_INST_DEFINE(inst, dev_pm_action_cb); \ DEFAULT_ERASE_TYPES_DEFINE(inst); \ @@ -1095,6 +892,10 @@ BUILD_ASSERT((FLASH_SIZE(inst) % CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE) == 0, \ .mspi_id = MSPI_DEVICE_ID_DT_INST(inst), \ .mspi_nor_cfg = MSPI_DEVICE_CONFIG_DT_INST(inst), \ .mspi_nor_init_cfg = FLASH_INITIAL_CONFIG(inst), \ + .mspi_nor_cfg_mask = DT_PROP(DT_INST_BUS(inst), \ + software_multiperipheral) \ + ? MSPI_DEVICE_CONFIG_ALL \ + : MSPI_DEVICE_CONFIG_NONE, \ IF_ENABLED(CONFIG_MSPI_XIP, \ (.xip_cfg = MSPI_XIP_CONFIG_DT_INST(inst),)) \ IF_ENABLED(WITH_RESET_GPIO, \ @@ -1105,16 +906,12 @@ BUILD_ASSERT((FLASH_SIZE(inst) % CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE) == 0, \ / 1000,)) \ .transfer_timeout = DT_INST_PROP(inst, transfer_timeout), \ FLASH_PAGE_LAYOUT_DEFINE(inst) \ - .jedec_id = DT_INST_PROP_OR(inst, jedec_id, {0}), \ + .jedec_id = DT_INST_PROP(inst, jedec_id), \ + .jedec_cmds = FLASH_CMDS(inst), \ .quirks = FLASH_QUIRKS(inst), \ .default_erase_types = DEFAULT_ERASE_TYPES(inst), \ .default_cmd_info = DEFAULT_CMD_INFO(inst), \ .default_switch_info = DEFAULT_SWITCH_INFO(inst), \ - .jedec_id_specified = DT_INST_NODE_HAS_PROP(inst, jedec_id), \ - .rx_dummy_specified = DT_INST_NODE_HAS_PROP(inst, rx_dummy), \ - .multiperipheral_bus = DT_PROP(DT_INST_BUS(inst), \ - software_multiperipheral), \ - IO_MODE_FLAGS(DT_INST_ENUM_IDX(inst, mspi_io_mode)), \ }; \ FLASH_PAGE_LAYOUT_CHECK(inst) \ DEVICE_DT_INST_DEFINE(inst, \ diff --git a/drivers/flash/flash_mspi_nor.h b/drivers/flash/flash_mspi_nor.h index 13b12d58221b..9c96c334fbe0 100644 --- a/drivers/flash/flash_mspi_nor.h +++ b/drivers/flash/flash_mspi_nor.h @@ -69,6 +69,7 @@ struct flash_mspi_nor_config { struct mspi_dev_id mspi_id; struct mspi_dev_cfg mspi_nor_cfg; struct mspi_dev_cfg mspi_nor_init_cfg; + enum mspi_dev_cfg_mask mspi_nor_cfg_mask; #if defined(CONFIG_MSPI_XIP) struct mspi_xip_cfg xip_cfg; #endif @@ -82,27 +83,213 @@ struct flash_mspi_nor_config { struct flash_pages_layout layout; #endif uint8_t jedec_id[SPI_NOR_MAX_ID_LEN]; + const struct flash_mspi_nor_cmds *jedec_cmds; struct flash_mspi_nor_quirks *quirks; const struct jesd216_erase_type *default_erase_types; struct flash_mspi_nor_cmd_info default_cmd_info; struct flash_mspi_nor_switch_info default_switch_info; - bool jedec_id_specified : 1; - bool rx_dummy_specified : 1; - bool multiperipheral_bus : 1; - bool multi_io_cmd : 1; - bool single_io_addr : 1; }; struct flash_mspi_nor_data { struct k_sem acquired; struct mspi_xfer_packet packet; struct mspi_xfer xfer; + struct mspi_dev_cfg *curr_cfg; struct jesd216_erase_type erase_types[JESD216_NUM_ERASE_TYPES]; struct flash_mspi_nor_cmd_info cmd_info; struct flash_mspi_nor_switch_info switch_info; - bool in_target_io_mode; }; +struct flash_mspi_nor_cmd { + enum mspi_xfer_direction dir; + uint32_t cmd; + uint16_t tx_dummy; + uint16_t rx_dummy; + uint8_t cmd_length; + uint8_t addr_length; + bool force_single; +}; + +struct flash_mspi_nor_cmds { + struct flash_mspi_nor_cmd id; + struct flash_mspi_nor_cmd write_en; + struct flash_mspi_nor_cmd read; + struct flash_mspi_nor_cmd status; + struct flash_mspi_nor_cmd config; + struct flash_mspi_nor_cmd page_program; + struct flash_mspi_nor_cmd sector_erase; + struct flash_mspi_nor_cmd chip_erase; + struct flash_mspi_nor_cmd sfdp; +}; + +const struct flash_mspi_nor_cmds commands_single = { + .id = { + .dir = MSPI_RX, + .cmd = JESD216_CMD_READ_ID, + .cmd_length = 1, + }, + .write_en = { + .dir = MSPI_TX, + .cmd = SPI_NOR_CMD_WREN, + .cmd_length = 1, + }, + .read = { + .dir = MSPI_RX, + .cmd = SPI_NOR_CMD_READ_FAST, + .cmd_length = 1, + .addr_length = 3, + .rx_dummy = 8, + }, + .status = { + .dir = MSPI_RX, + .cmd = SPI_NOR_CMD_RDSR, + .cmd_length = 1, + }, + .config = { + .dir = MSPI_RX, + .cmd = SPI_NOR_CMD_RDCR, + .cmd_length = 1, + }, + .page_program = { + .dir = MSPI_TX, + .cmd = SPI_NOR_CMD_PP, + .cmd_length = 1, + .addr_length = 3, + }, + .sector_erase = { + .dir = MSPI_TX, + .cmd = SPI_NOR_CMD_SE, + .cmd_length = 1, + .addr_length = 3, + }, + .chip_erase = { + .dir = MSPI_TX, + .cmd = SPI_NOR_CMD_CE, + .cmd_length = 1, + }, + .sfdp = { + .dir = MSPI_RX, + .cmd = JESD216_CMD_READ_SFDP, + .cmd_length = 1, + .addr_length = 3, + .rx_dummy = 8, + }, +}; + +const struct flash_mspi_nor_cmds commands_quad_1_4_4 = { + .id = { + .dir = MSPI_RX, + .cmd = JESD216_CMD_READ_ID, + .cmd_length = 1, + .force_single = true, + }, + .write_en = { + .dir = MSPI_TX, + .cmd = SPI_NOR_CMD_WREN, + .cmd_length = 1, + }, + .read = { + .dir = MSPI_RX, + .cmd = SPI_NOR_CMD_4READ, + .cmd_length = 1, + .addr_length = 3, + .rx_dummy = 6, + }, + .status = { + .dir = MSPI_RX, + .cmd = SPI_NOR_CMD_RDSR, + .cmd_length = 1, + .force_single = true, + }, + .config = { + .dir = MSPI_RX, + .cmd = SPI_NOR_CMD_RDCR, + .cmd_length = 1, + .force_single = true, + }, + .page_program = { + .dir = MSPI_TX, + .cmd = SPI_NOR_CMD_PP_1_4_4, + .cmd_length = 1, + .addr_length = 3, + }, + .sector_erase = { + .dir = MSPI_TX, + .cmd = SPI_NOR_CMD_SE, + .cmd_length = 1, + .addr_length = 3, + .force_single = true, + }, + .chip_erase = { + .dir = MSPI_TX, + .cmd = SPI_NOR_CMD_CE, + .cmd_length = 1, + }, + .sfdp = { + .dir = MSPI_RX, + .cmd = JESD216_CMD_READ_SFDP, + .cmd_length = 1, + .addr_length = 3, + .rx_dummy = 8, + .force_single = true, + }, +}; + +const struct flash_mspi_nor_cmds commands_octal = { + .id = { + .dir = MSPI_RX, + .cmd = JESD216_OCMD_READ_ID, + .cmd_length = 2, + .addr_length = 4, + .rx_dummy = 4 + }, + .write_en = { + .dir = MSPI_TX, + .cmd = SPI_NOR_OCMD_WREN, + .cmd_length = 2, + }, + .read = { + .dir = MSPI_RX, + .cmd = SPI_NOR_OCMD_RD, + .cmd_length = 2, + .addr_length = 4, + .rx_dummy = 20, + }, + .status = { + .dir = MSPI_RX, + .cmd = SPI_NOR_OCMD_RDSR, + .cmd_length = 2, + .addr_length = 4, + .rx_dummy = 4, + }, + .page_program = { + .dir = MSPI_TX, + .cmd = SPI_NOR_OCMD_PAGE_PRG, + .cmd_length = 2, + .addr_length = 4, + }, + .sector_erase = { + .dir = MSPI_TX, + .cmd = SPI_NOR_OCMD_SE, + .cmd_length = 2, + .addr_length = 4, + }, + .chip_erase = { + .dir = MSPI_TX, + .cmd = SPI_NOR_OCMD_CE, + .cmd_length = 2, + }, + .sfdp = { + .dir = MSPI_RX, + .cmd = JESD216_OCMD_READ_SFDP, + .cmd_length = 2, + .addr_length = 4, + .rx_dummy = 20, + }, +}; + +void flash_mspi_command_set(const struct device *dev, const struct flash_mspi_nor_cmd *cmd); + #ifdef __cplusplus } #endif diff --git a/drivers/flash/flash_mspi_nor_quirks.h b/drivers/flash/flash_mspi_nor_quirks.h index 391a075131d3..f8a0a147e6b1 100644 --- a/drivers/flash/flash_mspi_nor_quirks.h +++ b/drivers/flash/flash_mspi_nor_quirks.h @@ -71,29 +71,45 @@ static inline int mxicy_mx25r_post_switch_mode(const struct device *dev) } /* Wait for previous write to finish */ - rc = wait_until_ready(dev, K_USEC(1)); - if (rc < 0) { - return rc; - } + do { + flash_mspi_command_set(dev, &dev_config->jedec_cmds->status); + dev_data->packet.data_buf = &status; + dev_data->packet.num_bytes = sizeof(status); + rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, &dev_data->xfer); + if (rc < 0) { + return rc; + } + } while (status & SPI_NOR_WIP_BIT); /* Write enable */ - rc = cmd_wren(dev); + flash_mspi_command_set(dev, &commands_single.write_en); + rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, + &dev_data->xfer); if (rc < 0) { return rc; } /* Write status and config registers */ - set_up_xfer(dev, MSPI_TX); + const struct flash_mspi_nor_cmd cmd_status = { + .dir = MSPI_TX, + .cmd = SPI_NOR_CMD_WRSR, + .cmd_length = 1, + }; + + flash_mspi_command_set(dev, &cmd_status); dev_data->packet.data_buf = mxicy_mx25r_hp_payload; dev_data->packet.num_bytes = sizeof(mxicy_mx25r_hp_payload); - rc = perform_xfer(dev, SPI_NOR_CMD_WRSR, false); + rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, &dev_data->xfer); if (rc < 0) { return rc; } /* Wait for write to end and verify status register */ do { - rc = cmd_rdsr(dev, SPI_NOR_CMD_RDSR, &status); + flash_mspi_command_set(dev, &dev_config->jedec_cmds->status); + dev_data->packet.data_buf = &status; + dev_data->packet.num_bytes = sizeof(status); + rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, &dev_data->xfer); if (rc < 0) { return rc; } @@ -104,10 +120,10 @@ static inline int mxicy_mx25r_post_switch_mode(const struct device *dev) } /* Verify configuration registers */ - set_up_xfer(dev, MSPI_RX); - dev_data->packet.num_bytes = sizeof(config); + flash_mspi_command_set(dev, &dev_config->jedec_cmds->config); dev_data->packet.data_buf = config; - rc = perform_xfer(dev, SPI_NOR_CMD_RDCR, false); + dev_data->packet.num_bytes = sizeof(config); + rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, &dev_data->xfer); if (rc < 0) { return rc; } @@ -145,18 +161,26 @@ static inline int mxicy_mx25u_post_switch_mode(const struct device *dev) } /* Write enable */ - rc = cmd_wren(dev); + flash_mspi_command_set(dev, &commands_single.write_en); + rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, + &dev_data->xfer); if (rc < 0) { return rc; } /* Write config register 2 */ - set_up_xfer(dev, MSPI_TX); - dev_data->xfer.addr_length = 4; - dev_data->packet.address = 0; + const struct flash_mspi_nor_cmd cmd_status = { + .dir = MSPI_TX, + .cmd = SPI_NOR_CMD_WR_CFGREG2, + .cmd_length = 1, + .addr_length = 4, + }; + + flash_mspi_command_set(dev, &cmd_status); dev_data->packet.data_buf = &mxicy_mx25u_oe_payload; dev_data->packet.num_bytes = sizeof(mxicy_mx25u_oe_payload); - return perform_xfer(dev, SPI_NOR_CMD_WR_CFGREG2, false); + rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, &dev_data->xfer); + return rc; } static int mxicy_mx25u_pre_init(const struct device *dev) @@ -184,12 +208,18 @@ static int mxicy_mx25u_pre_init(const struct device *dev) */ /* Read configured number of dummy cycles for memory reading commands. */ - set_up_xfer(dev, MSPI_RX); - dev_data->xfer.addr_length = 4; + const struct flash_mspi_nor_cmd cmd_rd_cr2 = { + .dir = MSPI_RX, + .cmd = SPI_NOR_CMD_RD_CFGREG2, + .cmd_length = 1, + .addr_length = 4, + }; + + flash_mspi_command_set(dev, &cmd_rd_cr2); dev_data->packet.address = 0x300; dev_data->packet.data_buf = &cfg_reg; dev_data->packet.num_bytes = sizeof(cfg_reg); - rc = perform_xfer(dev, SPI_NOR_CMD_RD_CFGREG2, false); + rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, &dev_data->xfer); if (rc < 0) { LOG_ERR("Failed to read Dummy Cycle from CFGREG2"); return rc; diff --git a/drivers/flash/flash_mspi_nor_sfdp.h b/drivers/flash/flash_mspi_nor_sfdp.h index e8291a7af2ab..5fa07a51782c 100644 --- a/drivers/flash/flash_mspi_nor_sfdp.h +++ b/drivers/flash/flash_mspi_nor_sfdp.h @@ -98,7 +98,6 @@ #define USES_4BYTE_ADDR(inst) \ (USES_OCTAL_IO(inst) || \ - DT_INST_PROP(inst, use_4byte_addressing) || \ BFP_DW1_ADDRESS_BYTES(inst) == JESD216_SFDP_BFP_DW1_ADDRBYTES_VAL_4B) #define BFP_ENTER_4BYTE_ADDR_METHODS(inst) \ @@ -346,26 +345,12 @@ BUILD_ASSERT(!USES_8D_8D_8D(inst) || \ BFP_DW18_CMD_EXT(inst) <= BFP_DW18_CMD_EXT_INV, \ "Unsupported Octal Command Extension mode in " \ - DT_NODE_FULL_NAME(DT_DRV_INST(inst))); \ - BUILD_ASSERT(!DT_INST_PROP(inst, use_4byte_addressing) || \ - (BFP_DW1_ADDRESS_BYTES(inst) \ - != JESD216_SFDP_BFP_DW1_ADDRBYTES_VAL_3B), \ - "Cannot use 4-byte addressing for " \ - DT_NODE_FULL_NAME(DT_DRV_INST(inst))); \ - BUILD_ASSERT(!DT_INST_PROP(inst, use_4byte_addressing) || \ - (BFP_ENTER_4BYTE_ADDR_METHODS(inst) \ - & (BFP_DW16_4B_ADDR_ENTER_B7 | \ - BFP_DW16_4B_ADDR_ENTER_06_B7 | \ - BFP_DW16_4B_ADDR_PER_CMD | \ - BFP_DW16_4B_ADDR_ALWAYS)), \ - "No supported method of entering 4-byte addressing mode for " \ DT_NODE_FULL_NAME(DT_DRV_INST(inst))) #else #define USES_4BYTE_ADDR(inst) \ - (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_OCTAL || \ - DT_INST_PROP(inst, use_4byte_addressing)) + (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_OCTAL) #define DEFAULT_CMD_INFO(inst) { \ .pp_cmd = USES_4BYTE_ADDR(inst) \ diff --git a/dts/bindings/mtd/jedec,mspi-nor.yaml b/dts/bindings/mtd/jedec,mspi-nor.yaml index 40bfe3539430..09660b841591 100644 --- a/dts/bindings/mtd/jedec,mspi-nor.yaml +++ b/dts/bindings/mtd/jedec,mspi-nor.yaml @@ -5,20 +5,7 @@ description: Generic NOR flash on MSPI bus compatible: "jedec,mspi-nor" -include: - - name: mspi-device.yaml - - name: jedec,spi-nor-common.yaml - property-allowlist: - - jedec-id - - size - - sfdp-bfp - - sfdp-ff05 - - sfdp-ff84 - - quad-enable-requirements - - has-dpd - - dpd-wakeup-sequence - - t-enter-dpd - - t-exit-dpd +include: [mspi-device.yaml, "jedec,spi-nor-common.yaml"] properties: reset-gpios: @@ -43,12 +30,3 @@ properties: Maximum time, in milliseconds, allowed for a single transfer on the MSPI bus in communication with the flash chip. The default value is the one that was previously hard-coded in the flash_mspi_nor driver. - - use-4byte-addressing: - type: boolean - description: | - Indicates that 4-byte addressing is to be used in communication with - the flash chip. The driver will use dedicated 4-byte address instruction - codes for commands that require addresses (like Read, Page Program, - or Erase) if those are supported by the flash chip, or if necessary, - it will switch the chip to 4-byte addressing mode. From 5e5b5a40ee98357375e559b07140abe269892aff Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:28 +0300 Subject: [PATCH 0873/2141] Revert "[nrf fromtree] drivers: flash_mspi_nor: Get info from dts SFDP arrays" This reverts commit 6c308a75b2b934f22ac07f8474e84a2894e2ced6. Signed-off-by: Jukka Rissanen --- .../nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 7 - .../nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts | 7 - drivers/flash/Kconfig.mspi | 18 - drivers/flash/flash_mspi_nor.c | 46 +- drivers/flash/flash_mspi_nor.h | 50 +-- drivers/flash/flash_mspi_nor_quirks.h | 56 --- drivers/flash/flash_mspi_nor_sfdp.h | 399 ------------------ dts/bindings/mtd/jedec,jesd216.yaml | 12 - 8 files changed, 18 insertions(+), 577 deletions(-) delete mode 100644 drivers/flash/flash_mspi_nor_sfdp.h diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index e086601abae9..2c86129c0f38 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -285,13 +285,6 @@ slot3_partition: &cpurad_slot1_partition { 30 b0 30 b0 f4 bd d5 5c 00 00 00 ff 10 10 00 20 00 00 00 00 00 00 7c 23 48 00 00 00 00 00 88 88 ]; - sfdp-ff05 = [ - 00 ee c0 69 72 72 71 71 00 d8 f7 f6 00 0a 00 00 - 14 45 98 80 - ]; - sfdp-ff84 = [ - 43 06 0f 00 21 dc ff ff - ]; size = <67108864>; has-dpd; t-enter-dpd = <10000>; diff --git a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts index 8920d7966bbf..1c8622c07803 100644 --- a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts +++ b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts @@ -265,13 +265,6 @@ ipc0: &cpuapp_cpurad_ipc { 30 b0 30 b0 f4 bd d5 5c 00 00 00 ff 10 10 00 20 00 00 00 00 00 00 7c 23 48 00 00 00 00 00 88 88 ]; - sfdp-ff05 = [ - 00 ee c0 69 72 72 71 71 00 d8 f7 f6 00 0a 00 00 - 14 45 98 80 - ]; - sfdp-ff84 = [ - 43 06 0f 00 21 dc ff ff - ]; size = <67108864>; has-dpd; t-enter-dpd = <10000>; diff --git a/drivers/flash/Kconfig.mspi b/drivers/flash/Kconfig.mspi index cab2f3a2bcde..d0f244957d21 100644 --- a/drivers/flash/Kconfig.mspi +++ b/drivers/flash/Kconfig.mspi @@ -39,24 +39,6 @@ menuconfig FLASH_MSPI_NOR if FLASH_MSPI_NOR -config FLASH_MSPI_NOR_USE_SFDP - bool "Use Serial Flash Discoverable Parameters (SFDP)" - default $(dt_compat_any_has_prop,$(DT_COMPAT_JEDEC_MSPI_NOR),sfdp-bfp) - help - Use information from SFDP for setting up flash command transfers - and for configuring the flash chip. - - Currently, only build time processing of SFDP structures is supported, - based on dts arrays provided as flash node properties like `sfdp-bfp`, - `sfdp-ff05`, and `sfdp-ff84`. Depending on the IO mode used, some or - all of these properties are required for building the flash driver. - Data for these properties can be obtained with the `drivers/jesd216` - sample. If a given SFDP table is not available in a flash chip, - the related property can be defined as an empty array - this will - prevent a related build assertion from failing and default values - will be assigned to parameters that would otherwise be read from - that SFDP table. - config FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE int "Page size to use for FLASH_LAYOUT feature" depends on FLASH_PAGE_LAYOUT diff --git a/drivers/flash/flash_mspi_nor.c b/drivers/flash/flash_mspi_nor.c index 125aedfa250f..5546ef904c03 100644 --- a/drivers/flash/flash_mspi_nor.c +++ b/drivers/flash/flash_mspi_nor.c @@ -12,12 +12,10 @@ #include #include "flash_mspi_nor.h" -#include "flash_mspi_nor_sfdp.h" +#include "flash_mspi_nor_quirks.h" LOG_MODULE_REGISTER(flash_mspi_nor, CONFIG_FLASH_LOG_LEVEL); -#include "flash_mspi_nor_quirks.h" - void flash_mspi_command_set(const struct device *dev, const struct flash_mspi_nor_cmd *cmd) { struct flash_mspi_nor_data *dev_data = dev->data; @@ -112,9 +110,7 @@ static inline uint32_t dev_flash_size(const struct device *dev) static inline uint16_t dev_page_size(const struct device *dev) { - const struct flash_mspi_nor_config *dev_config = dev->config; - - return dev_config->page_size; + return SPI_NOR_PAGE_SIZE; } static int api_read(const struct device *dev, off_t addr, void *dest, @@ -538,7 +534,7 @@ static int quad_enable_set(const struct device *dev, bool enable) return rc; } - if (dev_data->switch_info.quad_enable_req == JESD216_DW15_QER_VAL_S1B6) { + if (dev_config->dw15_qer == JESD216_DW15_QER_VAL_S1B6) { const struct flash_mspi_nor_cmd cmd_status = { .dir = MSPI_TX, .cmd = SPI_NOR_CMD_WRSR, @@ -574,11 +570,10 @@ static int quad_enable_set(const struct device *dev, bool enable) static int default_io_mode(const struct device *dev) { const struct flash_mspi_nor_config *dev_config = dev->config; - struct flash_mspi_nor_data *dev_data = dev->data; enum mspi_io_mode io_mode = dev_config->mspi_nor_cfg.io_mode; int rc = 0; - if (dev_data->switch_info.quad_enable_req != JESD216_DW15_QER_VAL_NONE) { + if (dev_config->dw15_qer != JESD216_DW15_QER_VAL_NONE) { /* For Quad 1-1-4 and 1-4-4, entering or leaving mode is defined * in JEDEC216 BFP DW15 QER */ @@ -662,7 +657,7 @@ static int flash_chip_init(const struct device *dev) /* Some chips reuse RESET pin for data in Quad modes: * force single line mode before resetting. */ - if (dev_data->switch_info.quad_enable_req != JESD216_DW15_QER_VAL_NONE && + if (dev_config->dw15_qer != JESD216_DW15_QER_VAL_NONE && (io_mode == MSPI_IO_MODE_SINGLE || io_mode == MSPI_IO_MODE_QUAD_1_1_4 || io_mode == MSPI_IO_MODE_QUAD_1_4_4)) { @@ -690,11 +685,6 @@ static int flash_chip_init(const struct device *dev) } #endif - if (dev_config->quirks != NULL && - dev_config->quirks->pre_init != NULL) { - rc = dev_config->quirks->pre_init(dev); - } - flash_mspi_command_set(dev, &commands_single.id); dev_data->packet.data_buf = id; dev_data->packet.num_bytes = sizeof(id); @@ -759,11 +749,6 @@ static int drv_init(const struct device *dev) return -ENODEV; } - memcpy(dev_data->erase_types, dev_config->default_erase_types, - sizeof(dev_data->erase_types)); - dev_data->cmd_info = dev_config->default_cmd_info; - dev_data->switch_info = dev_config->default_switch_info; - rc = pm_device_runtime_get(dev_config->bus); if (rc < 0) { LOG_ERR("pm_device_runtime_get() failed: %d", rc); @@ -815,6 +800,8 @@ static DEVICE_API(flash, drv_api) = { .dqs_enable = false, \ } +#define FLASH_SIZE_INST(inst) (DT_INST_PROP(inst, size) / 8) + /* Define copies of mspi_io_mode enum values, so they can be used inside * the COND_CODE_1 macros. */ @@ -849,17 +836,23 @@ extern const struct flash_mspi_nor_cmds mspi_io_mode_not_supported; #define FLASH_QUIRKS(inst) FLASH_MSPI_QUIRKS_GET(DT_DRV_INST(inst)) +#define FLASH_DW15_QER_VAL(inst) _CONCAT(JESD216_DW15_QER_VAL_, \ + DT_INST_STRING_TOKEN(inst, quad_enable_requirements)) +#define FLASH_DW15_QER(inst) COND_CODE_1(DT_INST_NODE_HAS_PROP(inst, quad_enable_requirements), \ + (FLASH_DW15_QER_VAL(inst)), (JESD216_DW15_QER_VAL_NONE)) + + #if defined(CONFIG_FLASH_PAGE_LAYOUT) BUILD_ASSERT((CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE % 4096) == 0, "MSPI_NOR_FLASH_LAYOUT_PAGE_SIZE must be multiple of 4096"); #define FLASH_PAGE_LAYOUT_DEFINE(inst) \ .layout = { \ .pages_size = CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE, \ - .pages_count = FLASH_SIZE(inst) \ + .pages_count = FLASH_SIZE_INST(inst) \ / CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE, \ }, #define FLASH_PAGE_LAYOUT_CHECK(inst) \ -BUILD_ASSERT((FLASH_SIZE(inst) % CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE) == 0, \ +BUILD_ASSERT((FLASH_SIZE_INST(inst) % CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE) == 0, \ "MSPI_NOR_FLASH_LAYOUT_PAGE_SIZE incompatible with flash size, instance " #inst); #else #define FLASH_PAGE_LAYOUT_DEFINE(inst) @@ -881,14 +874,11 @@ BUILD_ASSERT((FLASH_SIZE(inst) % CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE) == 0, \ (DT_INST_ENUM_IDX(inst, mspi_io_mode) == \ MSPI_IO_MODE_OCTAL), \ "Only 1x, 1-4-4 and 8x I/O modes are supported for now"); \ - SFDP_BUILD_ASSERTS(inst); \ PM_DEVICE_DT_INST_DEFINE(inst, dev_pm_action_cb); \ - DEFAULT_ERASE_TYPES_DEFINE(inst); \ static struct flash_mspi_nor_data dev##inst##_data; \ static const struct flash_mspi_nor_config dev##inst##_config = { \ .bus = DEVICE_DT_GET(DT_INST_BUS(inst)), \ - .flash_size = FLASH_SIZE(inst), \ - .page_size = FLASH_PAGE_SIZE(inst), \ + .flash_size = FLASH_SIZE_INST(inst), \ .mspi_id = MSPI_DEVICE_ID_DT_INST(inst), \ .mspi_nor_cfg = MSPI_DEVICE_CONFIG_DT_INST(inst), \ .mspi_nor_init_cfg = FLASH_INITIAL_CONFIG(inst), \ @@ -909,9 +899,7 @@ BUILD_ASSERT((FLASH_SIZE(inst) % CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE) == 0, \ .jedec_id = DT_INST_PROP(inst, jedec_id), \ .jedec_cmds = FLASH_CMDS(inst), \ .quirks = FLASH_QUIRKS(inst), \ - .default_erase_types = DEFAULT_ERASE_TYPES(inst), \ - .default_cmd_info = DEFAULT_CMD_INFO(inst), \ - .default_switch_info = DEFAULT_SWITCH_INFO(inst), \ + .dw15_qer = FLASH_DW15_QER(inst), \ }; \ FLASH_PAGE_LAYOUT_CHECK(inst) \ DEVICE_DT_INST_DEFINE(inst, \ diff --git a/drivers/flash/flash_mspi_nor.h b/drivers/flash/flash_mspi_nor.h index 9c96c334fbe0..ad957f24bc79 100644 --- a/drivers/flash/flash_mspi_nor.h +++ b/drivers/flash/flash_mspi_nor.h @@ -20,52 +20,9 @@ extern "C" { #define WITH_RESET_GPIO 1 #endif -#define CMD_EXTENSION_NONE 0 -#define CMD_EXTENSION_SAME 1 -#define CMD_EXTENSION_INVERSE 2 - -#define OCTAL_ENABLE_REQ_NONE 0 -#define OCTAL_ENABLE_REQ_S2B3 1 - -#define ENTER_4BYTE_ADDR_NONE 0 -#define ENTER_4BYTE_ADDR_B7 1 -#define ENTER_4BYTE_ADDR_06_B7 2 - -struct flash_mspi_nor_cmd_info { - uint8_t read_cmd; - uint8_t read_mode_bit_cycles : 3; - uint8_t read_dummy_cycles : 5; - uint8_t pp_cmd; - bool uses_4byte_addr : 1; - /* BFP, 18th DWORD, bits 30-29 */ - uint8_t cmd_extension : 2; - /* xSPI Profile 1.0 (ID FF05), 1st DWORD: */ - /* - Read SFDP command address bytes: 4 (true) or 3 */ - bool sfdp_addr_4 : 1; - /* - Read SDFP command dummy cycles: 20 (true) or 8 */ - bool sfdp_dummy_20 : 1; - /* - Read Status Register command address bytes: 4 (true) or 0 */ - bool rdsr_addr_4 : 1; - /* - Read Status Register command dummy cycles: 0, 4, or 8 */ - uint8_t rdsr_dummy : 4; - /* - Read JEDEC ID command parameters; not sure where to get their - * values from, but since for many flash chips they are the same - * as for RDSR, those are taken as defaults, see DEFAULT_CMD_INFO() - */ - bool rdid_addr_4 : 1; - uint8_t rdid_dummy : 4; -}; - -struct flash_mspi_nor_switch_info { - uint8_t quad_enable_req : 3; - uint8_t octal_enable_req : 3; - uint8_t enter_4byte_addr : 2; -}; - struct flash_mspi_nor_config { const struct device *bus; uint32_t flash_size; - uint16_t page_size; struct mspi_dev_id mspi_id; struct mspi_dev_cfg mspi_nor_cfg; struct mspi_dev_cfg mspi_nor_init_cfg; @@ -85,9 +42,7 @@ struct flash_mspi_nor_config { uint8_t jedec_id[SPI_NOR_MAX_ID_LEN]; const struct flash_mspi_nor_cmds *jedec_cmds; struct flash_mspi_nor_quirks *quirks; - const struct jesd216_erase_type *default_erase_types; - struct flash_mspi_nor_cmd_info default_cmd_info; - struct flash_mspi_nor_switch_info default_switch_info; + uint8_t dw15_qer; }; struct flash_mspi_nor_data { @@ -95,9 +50,6 @@ struct flash_mspi_nor_data { struct mspi_xfer_packet packet; struct mspi_xfer xfer; struct mspi_dev_cfg *curr_cfg; - struct jesd216_erase_type erase_types[JESD216_NUM_ERASE_TYPES]; - struct flash_mspi_nor_cmd_info cmd_info; - struct flash_mspi_nor_switch_info switch_info; }; struct flash_mspi_nor_cmd { diff --git a/drivers/flash/flash_mspi_nor_quirks.h b/drivers/flash/flash_mspi_nor_quirks.h index f8a0a147e6b1..eb40ad1938aa 100644 --- a/drivers/flash/flash_mspi_nor_quirks.h +++ b/drivers/flash/flash_mspi_nor_quirks.h @@ -9,13 +9,6 @@ /* Flash chip specific quirks */ struct flash_mspi_nor_quirks { - /* Called at the beginning of the flash chip initialization, - * right after reset if any is performed. Can be used to alter - * structures that define communication with the chip, like - * `cmd_info`, `switch_info`, and `erase_types`, which are set - * to default values at this point. - */ - int (*pre_init)(const struct device *dev); /* Called after switching to default IO mode. */ int (*post_switch_mode)(const struct device *dev); }; @@ -183,56 +176,7 @@ static inline int mxicy_mx25u_post_switch_mode(const struct device *dev) return rc; } -static int mxicy_mx25u_pre_init(const struct device *dev) -{ - const struct flash_mspi_nor_config *dev_config = dev->config; - struct flash_mspi_nor_data *dev_data = dev->data; - static const uint8_t dummy_cycles[8] = { - 20, 18, 16, 14, 12, 10, 8, 6 - }; - uint8_t cfg_reg; - int rc; - - if (dev_config->mspi_nor_cfg.io_mode != MSPI_IO_MODE_OCTAL) { - return 0; - } - - if (dev_config->mspi_nor_cfg.data_rate == MSPI_DATA_RATE_SINGLE) { - dev_data->cmd_info.cmd_extension = CMD_EXTENSION_INVERSE; - } - - /* - * TODO - replace this with a generic routine that uses information - * from SFDP header FF87 (Status, Control and Configuration - * Register Map) - */ - - /* Read configured number of dummy cycles for memory reading commands. */ - const struct flash_mspi_nor_cmd cmd_rd_cr2 = { - .dir = MSPI_RX, - .cmd = SPI_NOR_CMD_RD_CFGREG2, - .cmd_length = 1, - .addr_length = 4, - }; - - flash_mspi_command_set(dev, &cmd_rd_cr2); - dev_data->packet.address = 0x300; - dev_data->packet.data_buf = &cfg_reg; - dev_data->packet.num_bytes = sizeof(cfg_reg); - rc = mspi_transceive(dev_config->bus, &dev_config->mspi_id, &dev_data->xfer); - if (rc < 0) { - LOG_ERR("Failed to read Dummy Cycle from CFGREG2"); - return rc; - } - - dev_data->cmd_info.read_mode_bit_cycles = 0; - dev_data->cmd_info.read_dummy_cycles = dummy_cycles[cfg_reg & 0x7]; - - return 0; -} - struct flash_mspi_nor_quirks flash_quirks_mxicy_mx25u = { - .pre_init = mxicy_mx25u_pre_init, .post_switch_mode = mxicy_mx25u_post_switch_mode, }; diff --git a/drivers/flash/flash_mspi_nor_sfdp.h b/drivers/flash/flash_mspi_nor_sfdp.h deleted file mode 100644 index 5fa07a51782c..000000000000 --- a/drivers/flash/flash_mspi_nor_sfdp.h +++ /dev/null @@ -1,399 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifdef CONFIG_FLASH_MSPI_NOR_USE_SFDP - -#define BFP_DW16_4B_ADDR_ENTER_B7 BIT(0) -#define BFP_DW16_4B_ADDR_ENTER_06_B7 BIT(1) -#define BFP_DW16_4B_ADDR_PER_CMD BIT(5) -#define BFP_DW16_4B_ADDR_ALWAYS BIT(6) - -#define BFP_DW18_CMD_EXT_SAME 0 -#define BFP_DW18_CMD_EXT_INV 1 - -/* 32-bit words in SFDP arrays in devicetree are stored in little-endian byte - * order. See jedec,jesd216.yaml - */ -#define SFDP_DW_BYTE_0_IDX(dw_no) \ - UTIL_DEC(UTIL_DEC(UTIL_DEC(UTIL_DEC(UTIL_X2(UTIL_X2(dw_no)))))) -#define SFDP_DW_BYTE_1_IDX(dw_no) \ - UTIL_DEC(UTIL_DEC(UTIL_DEC(UTIL_X2(UTIL_X2(dw_no))))) -#define SFDP_DW_BYTE_2_IDX(dw_no) \ - UTIL_DEC(UTIL_DEC(UTIL_X2(UTIL_X2(dw_no)))) -#define SFDP_DW_BYTE_3_IDX(dw_no) \ - UTIL_DEC(UTIL_X2(UTIL_X2(dw_no))) -#define SFDP_DW_BYTE(inst, prop, dw_no, byte_idx) \ - DT_INST_PROP_BY_IDX(inst, prop, SFDP_DW_BYTE_##byte_idx##_IDX(dw_no)) -#define SFDP_DW_EXISTS(inst, prop, dw_no) \ - DT_INST_PROP_HAS_IDX(inst, prop, SFDP_DW_BYTE_3_IDX(dw_no)) - -#define SFDP_DW(inst, prop, dw_no) \ - COND_CODE_1(SFDP_DW_EXISTS(inst, prop, dw_no), \ - (((SFDP_DW_BYTE(inst, prop, dw_no, 3) << 24) | \ - (SFDP_DW_BYTE(inst, prop, dw_no, 2) << 16) | \ - (SFDP_DW_BYTE(inst, prop, dw_no, 1) << 8) | \ - (SFDP_DW_BYTE(inst, prop, dw_no, 0) << 0))), \ - (0)) - -#define SFDP_FIELD(inst, prop, dw_no, mask) \ - FIELD_GET(mask, SFDP_DW(inst, prop, dw_no)) - -#define USES_8D_8D_8D(inst) \ - (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_OCTAL && \ - DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_DUAL) -#define USES_8S_8S_8S(inst) \ - (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_OCTAL && \ - DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_SINGLE) -#define USES_1S_8D_8D(inst) \ - (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_OCTAL_1_8_8 && \ - DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_DUAL) -#define USES_1S_8S_8S(inst) \ - (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_OCTAL_1_8_8 && \ - DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_SINGLE) -#define USES_1S_1S_8S(inst) \ - (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_OCTAL_1_1_8 && \ - DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_SINGLE) -#define USES_4S_4D_4D(inst) \ - (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_QUAD && \ - DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_DUAL) -#define USES_4S_4S_4S(inst) \ - (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_QUAD && \ - DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_SINGLE) -#define USES_1S_4D_4D(inst) \ - (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_QUAD_1_4_4 && \ - DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_DUAL) -#define USES_1S_4S_4S(inst) \ - (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_QUAD_1_4_4 && \ - DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_SINGLE) -#define USES_1S_1S_4S(inst) \ - (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_QUAD_1_1_4 && \ - DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_SINGLE) -#define USES_2S_2S_2S(inst) \ - (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_DUAL && \ - DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_SINGLE) -#define USES_1S_2D_2D(inst) \ - (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_DUAL_1_2_2 && \ - DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_DUAL) -#define USES_1S_2S_2S(inst) \ - (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_DUAL_1_2_2 && \ - DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_SINGLE) -#define USES_1S_1S_2S(inst) \ - (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_DUAL_1_1_2 && \ - DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_SINGLE) -#define USES_1S_1D_1D(inst) \ - (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_SINGLE && \ - DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_DUAL) -#define USES_1S_1S_1S(inst) \ - (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_SINGLE && \ - DT_INST_ENUM_IDX(inst, mspi_data_rate) == MSPI_DATA_RATE_SINGLE) - -#define USES_OCTAL_IO(inst) \ - (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_OCTAL) - -#define BFP_DW1_ADDRESS_BYTES(inst) \ - SFDP_FIELD(inst, sfdp_bfp, 1, GENMASK(18, 17)) - -#define USES_4BYTE_ADDR(inst) \ - (USES_OCTAL_IO(inst) || \ - BFP_DW1_ADDRESS_BYTES(inst) == JESD216_SFDP_BFP_DW1_ADDRBYTES_VAL_4B) - -#define BFP_ENTER_4BYTE_ADDR_METHODS(inst) \ - SFDP_FIELD(inst, sfdp_bfp, 16, GENMASK(31, 24)) - -#define HAS_4BYTE_ADDR_CMDS(inst) \ - (BFP_ENTER_4BYTE_ADDR_METHODS(inst) & BFP_DW16_4B_ADDR_PER_CMD) - -#define BFP_DW18_CMD_EXT(inst) \ - SFDP_FIELD(inst, sfdp_bfp, 18, GENMASK(30, 29)) - -#define CMD_EXTENSION(inst) \ - (!USES_8D_8D_8D(inst) ? CMD_EXTENSION_NONE : \ - (BFP_DW18_CMD_EXT(inst) \ - == BFP_DW18_CMD_EXT_INV) ? CMD_EXTENSION_INVERSE \ - : CMD_EXTENSION_SAME) - -/* 1st DWORD of 4-byte Address Instruction Table (ID FF84) indicates commands - * that are supported by the chip. - */ -#define FF84_DW1_BIT(inst, bit) (SFDP_DW(inst, sfdp_ff84, 1) & BIT(bit)) - -#define SFDP_CMD_PP(inst) \ - USES_1S_4S_4S(inst) ? SPI_NOR_CMD_PP_1_4_4 : \ - USES_1S_1S_4S(inst) ? SPI_NOR_CMD_PP_1_1_4 : \ - SPI_NOR_CMD_PP -#define SFDP_CMD_PP_4B(inst) \ - USES_1S_8S_8S(inst) && FF84_DW1_BIT(inst, 24) ? 0x8E : \ - USES_1S_1S_8S(inst) && FF84_DW1_BIT(inst, 23) ? 0x84 : \ - USES_1S_4S_4S(inst) && FF84_DW1_BIT(inst, 8) ? SPI_NOR_CMD_PP_1_4_4_4B : \ - USES_1S_1S_4S(inst) && FF84_DW1_BIT(inst, 7) ? SPI_NOR_CMD_PP_1_1_4_4B : \ - FF84_DW1_BIT(inst, 6) ? SPI_NOR_CMD_PP_4B \ - : 0 -#define SFDP_CMD_FAST_READ(inst) \ - USES_1S_8D_8D(inst) ? 0 : \ - USES_1S_8S_8S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 17, GENMASK(15, 8)) : \ - USES_1S_1S_8S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 17, GENMASK(31, 24)) : \ - USES_4S_4D_4D(inst) ? SFDP_FIELD(inst, sfdp_bfp, 23, GENMASK(31, 24)) : \ - USES_4S_4S_4S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 7, GENMASK(31, 24)) : \ - USES_1S_4D_4D(inst) ? SFDP_FIELD(inst, sfdp_bfp, 23, GENMASK(15, 8)) : \ - USES_1S_4S_4S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 3, GENMASK(15, 8)) : \ - USES_1S_1S_4S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 3, GENMASK(31, 24)) : \ - USES_2S_2S_2S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 6, GENMASK(31, 24)) : \ - USES_1S_2D_2D(inst) ? SFDP_FIELD(inst, sfdp_bfp, 22, GENMASK(31, 24)) : \ - USES_1S_2S_2S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 4, GENMASK(31, 24)) : \ - USES_1S_1S_2S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 4, GENMASK(15, 8)) : \ - USES_1S_1D_1D(inst) ? SFDP_FIELD(inst, sfdp_bfp, 22, GENMASK(15, 8)) : \ - SPI_NOR_CMD_READ_FAST -#define SFDP_CMD_FAST_READ_4B(inst) \ - USES_8D_8D_8D(inst) ? 0xEE : \ - USES_8S_8S_8S(inst) ? 0xEC : \ - USES_1S_8D_8D(inst) && FF84_DW1_BIT(inst, 22) ? 0xFD : \ - USES_1S_8S_8S(inst) && FF84_DW1_BIT(inst, 21) ? 0xCC : \ - USES_1S_1S_8S(inst) && FF84_DW1_BIT(inst, 20) ? 0x7C : \ - USES_4S_4D_4D(inst) ? 0 : \ - USES_4S_4S_4S(inst) ? 0 : \ - USES_1S_4D_4D(inst) && FF84_DW1_BIT(inst, 15) ? 0xEE : \ - USES_1S_4S_4S(inst) && FF84_DW1_BIT(inst, 5) ? 0xEC : \ - USES_1S_1S_4S(inst) && FF84_DW1_BIT(inst, 4) ? 0x6C : \ - USES_2S_2S_2S(inst) ? 0 : \ - USES_1S_2D_2D(inst) && FF84_DW1_BIT(inst, 14) ? 0xBE : \ - USES_1S_2S_2S(inst) && FF84_DW1_BIT(inst, 3) ? 0xBC : \ - USES_1S_1S_2S(inst) && FF84_DW1_BIT(inst, 2) ? 0x3C : \ - USES_1S_1D_1D(inst) && FF84_DW1_BIT(inst, 13) ? 0x0E : \ - FF84_DW1_BIT(inst, 1) ? SPI_NOR_CMD_READ_FAST_4B : \ - 0 - -#define DEFAULT_CMD_INFO(inst) { \ - .pp_cmd = USES_4BYTE_ADDR(inst) && HAS_4BYTE_ADDR_CMDS(inst) \ - ? SFDP_CMD_PP_4B(inst) \ - : SFDP_CMD_PP(inst), \ - .read_cmd = USES_4BYTE_ADDR(inst) && HAS_4BYTE_ADDR_CMDS(inst) \ - ? SFDP_CMD_FAST_READ_4B(inst) \ - : SFDP_CMD_FAST_READ(inst), \ - .read_mode_bit_cycles = \ - USES_1S_8S_8S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 17, GENMASK(7, 5)) : \ - USES_1S_1S_8S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 17, GENMASK(23, 21)) : \ - USES_4S_4D_4D(inst) ? SFDP_FIELD(inst, sfdp_bfp, 23, GENMASK(23, 21)) : \ - USES_4S_4S_4S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 7, GENMASK(23, 21)) : \ - USES_1S_4D_4D(inst) ? SFDP_FIELD(inst, sfdp_bfp, 23, GENMASK(7, 5)) : \ - USES_1S_4S_4S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 3, GENMASK(7, 5)) : \ - USES_1S_1S_4S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 3, GENMASK(23, 21)) : \ - USES_2S_2S_2S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 6, GENMASK(23, 21)) : \ - USES_1S_2D_2D(inst) ? SFDP_FIELD(inst, sfdp_bfp, 22, GENMASK(23, 21)) : \ - USES_1S_2S_2S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 4, GENMASK(23, 21)) : \ - USES_1S_1S_2S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 4, GENMASK(7, 5)) : \ - USES_1S_1D_1D(inst) ? SFDP_FIELD(inst, sfdp_bfp, 22, GENMASK(7, 5)) : \ - USES_1S_1S_1S(inst) ? 0 : \ - 0, \ - .read_dummy_cycles = DT_INST_PROP_OR(inst, rx_dummy, \ - USES_8D_8D_8D(inst) ? SFDP_FIELD(inst, sfdp_ff05, 6, GENMASK(4, 0)) : \ - USES_8S_8S_8S(inst) ? SFDP_FIELD(inst, sfdp_ff05, 6, GENMASK(9, 5)) : \ - USES_1S_8S_8S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 17, GENMASK(4, 0)) : \ - USES_1S_1S_8S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 17, GENMASK(20, 16)) : \ - USES_4S_4D_4D(inst) ? SFDP_FIELD(inst, sfdp_bfp, 23, GENMASK(20, 16)) : \ - USES_4S_4S_4S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 7, GENMASK(20, 16)) : \ - USES_1S_4D_4D(inst) ? SFDP_FIELD(inst, sfdp_bfp, 23, GENMASK(4, 0)) : \ - USES_1S_4S_4S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 3, GENMASK(4, 0)) : \ - USES_1S_1S_4S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 3, GENMASK(20, 16)) : \ - USES_2S_2S_2S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 6, GENMASK(20, 16)) : \ - USES_1S_2D_2D(inst) ? SFDP_FIELD(inst, sfdp_bfp, 22, GENMASK(20, 16)) : \ - USES_1S_2S_2S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 4, GENMASK(20, 16)) : \ - USES_1S_1S_2S(inst) ? SFDP_FIELD(inst, sfdp_bfp, 4, GENMASK(4, 0)) : \ - USES_1S_1D_1D(inst) ? SFDP_FIELD(inst, sfdp_bfp, 22, GENMASK(4, 0)) : \ - USES_1S_1S_1S(inst) ? 8 : \ - 0), \ - .uses_4byte_addr = USES_4BYTE_ADDR(inst), \ - .cmd_extension = CMD_EXTENSION(inst), \ - .sfdp_addr_4 = USES_OCTAL_IO(inst) \ - ? (SFDP_FIELD(inst, sfdp_ff05, 1, BIT(31)) == 0) \ - : false, \ - .sfdp_dummy_20 = USES_OCTAL_IO(inst) \ - ? (SFDP_FIELD(inst, sfdp_ff05, 1, BIT(30)) == 1) \ - : false, \ - .rdsr_addr_4 = USES_OCTAL_IO(inst) \ - ? (SFDP_FIELD(inst, sfdp_ff05, 1, BIT(29)) == 1) \ - : false, \ - .rdsr_dummy = USES_OCTAL_IO(inst) \ - ? (SFDP_FIELD(inst, sfdp_ff05, 1, BIT(28)) ? 8 : 4) \ - : 0, \ - .rdid_addr_4 = USES_OCTAL_IO(inst) \ - ? (SFDP_FIELD(inst, sfdp_ff05, 1, BIT(29)) == 1) \ - : false, \ - .rdid_dummy = USES_OCTAL_IO(inst) \ - ? (SFDP_FIELD(inst, sfdp_ff05, 1, BIT(28)) ? 8 : 4) \ - : 0, } - -/* Erase Types, 8th and 9th DWORD of BSP */ -#define BFP_DW8_CMD_ET_1(inst) SFDP_FIELD(inst, sfdp_bfp, 8, GENMASK(15, 8)) -#define BFP_DW8_EXP_ET_1(inst) SFDP_FIELD(inst, sfdp_bfp, 8, GENMASK(7, 0)) -#define BFP_DW8_CMD_ET_2(inst) SFDP_FIELD(inst, sfdp_bfp, 8, GENMASK(31, 24)) -#define BFP_DW8_EXP_ET_2(inst) SFDP_FIELD(inst, sfdp_bfp, 8, GENMASK(23, 16)) -#define BFP_DW9_CMD_ET_3(inst) SFDP_FIELD(inst, sfdp_bfp, 9, GENMASK(15, 8)) -#define BFP_DW9_EXP_ET_3(inst) SFDP_FIELD(inst, sfdp_bfp, 9, GENMASK(7, 0)) -#define BFP_DW9_CMD_ET_4(inst) SFDP_FIELD(inst, sfdp_bfp, 9, GENMASK(31, 24)) -#define BFP_DW9_EXP_ET_4(inst) SFDP_FIELD(inst, sfdp_bfp, 9, GENMASK(23, 16)) - -/* 4-byte Address instructions for Erase Types defined in 8th and 9th DWORD - * of BFP; 2nd DWORD of 4-byte Address Instruction Table (ID FF84) - */ -#define FF84_DW2_CMD_ET_1(inst) SFDP_FIELD(inst, sfdp_ff84, 2, GENMASK(7, 0)) -#define FF84_DW2_CMD_ET_2(inst) SFDP_FIELD(inst, sfdp_ff84, 2, GENMASK(15, 8)) -#define FF84_DW2_CMD_ET_3(inst) SFDP_FIELD(inst, sfdp_ff84, 2, GENMASK(23, 16)) -#define FF84_DW2_CMD_ET_4(inst) SFDP_FIELD(inst, sfdp_ff84, 2, GENMASK(31, 24)) -/* Support for Erase Types in 4-byte Address mode; table FF84, 1st DWORD */ -#define FF84_DW1_SUP_ET_1(inst) SFDP_FIELD(inst, sfdp_ff84, 1, BIT(9)) -#define FF84_DW1_SUP_ET_2(inst) SFDP_FIELD(inst, sfdp_ff84, 1, BIT(10)) -#define FF84_DW1_SUP_ET_3(inst) SFDP_FIELD(inst, sfdp_ff84, 1, BIT(11)) -#define FF84_DW1_SUP_ET_4(inst) SFDP_FIELD(inst, sfdp_ff84, 1, BIT(12)) - -#define DEFAULT_ERASE_TYPES_DEFINE(inst) \ - static const struct jesd216_erase_type \ - dev##inst##_erase_types[JESD216_NUM_ERASE_TYPES] = \ - COND_CODE_1(SFDP_DW_EXISTS(inst, sfdp_bfp, 8), \ - ({{ .cmd = BFP_DW8_CMD_ET_1(inst), \ - .exp = BFP_DW8_EXP_ET_1(inst), }, \ - { .cmd = BFP_DW8_CMD_ET_2(inst), \ - .exp = BFP_DW8_EXP_ET_2(inst), }, \ - { .cmd = BFP_DW9_CMD_ET_3(inst), \ - .exp = BFP_DW9_EXP_ET_3(inst), }, \ - { .cmd = BFP_DW9_CMD_ET_4(inst), \ - .exp = BFP_DW9_EXP_ET_4(inst), }}), \ - ({{ .cmd = SPI_NOR_CMD_SE, \ - .exp = 0x0C }})); \ - static const struct jesd216_erase_type \ - dev##inst##_erase_types_4b[JESD216_NUM_ERASE_TYPES] = \ - COND_CODE_1(UTIL_AND(SFDP_DW_EXISTS(inst, sfdp_ff84, 2), \ - SFDP_DW_EXISTS(inst, sfdp_bfp, 9)), \ - ({{ .cmd = FF84_DW2_CMD_ET_1(inst), \ - .exp = FF84_DW1_SUP_ET_1(inst) \ - ? BFP_DW8_EXP_ET_1(inst) \ - : 0, }, \ - { .cmd = FF84_DW2_CMD_ET_2(inst), \ - .exp = FF84_DW1_SUP_ET_2(inst) \ - ? BFP_DW8_EXP_ET_2(inst) \ - : 0, }, \ - { .cmd = FF84_DW2_CMD_ET_3(inst), \ - .exp = FF84_DW1_SUP_ET_3(inst) \ - ? BFP_DW9_EXP_ET_3(inst) \ - : 0, }, \ - { .cmd = FF84_DW2_CMD_ET_4(inst), \ - .exp = FF84_DW1_SUP_ET_4(inst) \ - ? BFP_DW9_EXP_ET_4(inst) \ - : 0, }}), \ - ({{ .cmd = SPI_NOR_CMD_SE_4B, \ - .exp = 0x0C }})) - -#define DEFAULT_ERASE_TYPES(inst) \ - USES_4BYTE_ADDR(inst) && HAS_4BYTE_ADDR_CMDS(inst) \ - ? dev##inst##_erase_types_4b \ - : dev##inst##_erase_types - -#define BFP_DW15_QER(inst) \ - SFDP_FIELD(inst, sfdp_bfp, 15, GENMASK(22, 20)) - -#define BFP_DW19_OER(inst) \ - SFDP_FIELD(inst, sfdp_bfp, 19, GENMASK(22, 20)) - -#define ENTER_4BYTE_ADDR(inst) \ - (!USES_4BYTE_ADDR(inst) ? ENTER_4BYTE_ADDR_NONE : \ - (BFP_ENTER_4BYTE_ADDR_METHODS(inst) \ - & (BFP_DW16_4B_ADDR_PER_CMD | \ - BFP_DW16_4B_ADDR_ALWAYS)) ? ENTER_4BYTE_ADDR_NONE : \ - (BFP_ENTER_4BYTE_ADDR_METHODS(inst) \ - & BFP_DW16_4B_ADDR_ENTER_B7) ? ENTER_4BYTE_ADDR_B7 : \ - (BFP_ENTER_4BYTE_ADDR_METHODS(inst) \ - & BFP_DW16_4B_ADDR_ENTER_06_B7) ? ENTER_4BYTE_ADDR_06_B7 : \ - ENTER_4BYTE_ADDR_NONE) - -#define DEFAULT_SWITCH_INFO(inst) { \ - .quad_enable_req = BFP_DW15_QER(inst), \ - .octal_enable_req = BFP_DW19_OER(inst), \ - .enter_4byte_addr = ENTER_4BYTE_ADDR(inst) } - -#define BFP_FLASH_SIZE(dw2) \ - ((dw2 & BIT(31)) \ - ? BIT(MIN(31, (dw2 & BIT_MASK(31)) - 3)) \ - : dw2 / 8) - -#define FLASH_SIZE(inst) \ - (DT_INST_NODE_HAS_PROP(inst, size) \ - ? DT_INST_PROP(inst, size) / 8 \ - : BFP_FLASH_SIZE(SFDP_DW(inst, sfdp_bfp, 2))) - -#define BFP_FLASH_PAGE_EXP(inst) SFDP_FIELD(inst, sfdp_bfp, 11, GENMASK(7, 4)) - -#define FLASH_PAGE_SIZE(inst) \ - (BFP_FLASH_PAGE_EXP(inst) \ - ? BIT(BFP_FLASH_PAGE_EXP(inst)) \ - : SPI_NOR_PAGE_SIZE) - -#define SFDP_BUILD_ASSERTS(inst) \ - BUILD_ASSERT(DT_INST_NODE_HAS_PROP(inst, sfdp_bfp), \ - "sfdp-bfp property needed in " \ - DT_NODE_FULL_NAME(DT_DRV_INST(inst))); \ - BUILD_ASSERT((DT_INST_ENUM_IDX(inst, mspi_io_mode) \ - != MSPI_IO_MODE_OCTAL) || \ - DT_INST_NODE_HAS_PROP(inst, sfdp_ff05), \ - "sfdp-ff05 property needed in " \ - DT_NODE_FULL_NAME(DT_DRV_INST(inst))); \ - BUILD_ASSERT(!USES_4BYTE_ADDR(inst) || \ - DT_INST_NODE_HAS_PROP(inst, sfdp_ff84), \ - "sfdp-ff84 property needed in " \ - DT_NODE_FULL_NAME(DT_DRV_INST(inst))); \ - BUILD_ASSERT(!USES_8D_8D_8D(inst) || \ - BFP_DW18_CMD_EXT(inst) <= BFP_DW18_CMD_EXT_INV, \ - "Unsupported Octal Command Extension mode in " \ - DT_NODE_FULL_NAME(DT_DRV_INST(inst))) - -#else - -#define USES_4BYTE_ADDR(inst) \ - (DT_INST_ENUM_IDX(inst, mspi_io_mode) == MSPI_IO_MODE_OCTAL) - -#define DEFAULT_CMD_INFO(inst) { \ - .pp_cmd = USES_4BYTE_ADDR(inst) \ - ? SPI_NOR_CMD_PP_4B \ - : SPI_NOR_CMD_PP, \ - .read_cmd = USES_4BYTE_ADDR(inst) \ - ? SPI_NOR_CMD_READ_FAST_4B \ - : SPI_NOR_CMD_READ_FAST, \ - .read_mode_bit_cycles = 0, \ - .read_dummy_cycles = 8, \ - .uses_4byte_addr = USES_4BYTE_ADDR(inst), \ - .cmd_extension = CMD_EXTENSION_NONE, \ - .sfdp_addr_4 = false, \ - .sfdp_dummy_20 = false, \ - .rdsr_addr_4 = false, \ - .rdsr_dummy = 0, \ - .rdid_addr_4 = false, \ - .rdid_dummy = 0, } - -#define DEFAULT_ERASE_TYPES_DEFINE(inst) \ - static const struct jesd216_erase_type \ - dev##inst##_erase_types[JESD216_NUM_ERASE_TYPES] = \ - {{ .cmd = SPI_NOR_CMD_SE, \ - .exp = 0x0C }}; \ - static const struct jesd216_erase_type \ - dev##inst##_erase_types_4b[JESD216_NUM_ERASE_TYPES] = \ - {{ .cmd = SPI_NOR_CMD_SE_4B, \ - .exp = 0x0C }} - -#define DEFAULT_ERASE_TYPES(inst) \ - USES_4BYTE_ADDR(inst) ? dev##inst##_erase_types_4b \ - : dev##inst##_erase_types - -#define DEFAULT_SWITCH_INFO(inst) { \ - .quad_enable_req = DT_INST_ENUM_IDX_OR(inst, quad_enable_requirements, \ - JESD216_DW15_QER_VAL_NONE), \ - .octal_enable_req = OCTAL_ENABLE_REQ_NONE, \ - .enter_4byte_addr = ENTER_4BYTE_ADDR_NONE } - -#define FLASH_SIZE(inst) (DT_INST_PROP(inst, size) / 8) - -#define FLASH_PAGE_SIZE(inst) SPI_NOR_PAGE_SIZE - -#define SFDP_BUILD_ASSERTS(inst) - -#endif /* CONFIG_FLASH_MSPI_NOR_USE_SFDP */ diff --git a/dts/bindings/mtd/jedec,jesd216.yaml b/dts/bindings/mtd/jedec,jesd216.yaml index d5f75c74dd3d..c55440456c2a 100644 --- a/dts/bindings/mtd/jedec,jesd216.yaml +++ b/dts/bindings/mtd/jedec,jesd216.yaml @@ -35,18 +35,6 @@ properties: information in cases were runtime retrieval of SFDP data is not desired. - sfdp-ff05: - type: uint8-array - description: | - Contains the 32-bit words in little-endian byte order from the JESD216 - SFDP xSPI Profile 1.0 table. - - sfdp-ff84: - type: uint8-array - description: | - Contains the 32-bit words in little-endian byte order from the JESD216 - SFDP 4-byte Address Instruction Parameter table. - quad-enable-requirements: type: string enum: From 65c933e084ac7b4795d7714ead23f7c01c4c80ac Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:28 +0300 Subject: [PATCH 0874/2141] Revert "[nrf fromtree] drivers: flash_mspi: Implement flash API get_size" This reverts commit 086847880b782e4efcecf3e8256aca207b396cb9. Signed-off-by: Jukka Rissanen --- drivers/flash/flash_mspi_nor.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/flash/flash_mspi_nor.c b/drivers/flash/flash_mspi_nor.c index 5546ef904c03..ae22202e075d 100644 --- a/drivers/flash/flash_mspi_nor.c +++ b/drivers/flash/flash_mspi_nor.c @@ -387,12 +387,6 @@ static int api_erase(const struct device *dev, off_t addr, size_t size) return rc; } -static int api_get_size(const struct device *dev, uint64_t *size) -{ - *size = dev_flash_size(dev); - return 0; -} - static const struct flash_parameters *api_get_parameters(const struct device *dev) { @@ -777,7 +771,6 @@ static DEVICE_API(flash, drv_api) = { .read = api_read, .write = api_write, .erase = api_erase, - .get_size = api_get_size, .get_parameters = api_get_parameters, #if defined(CONFIG_FLASH_PAGE_LAYOUT) .page_layout = api_page_layout, From 292a0662ee6671a7831ad950aa685f15f884169a Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:28 +0300 Subject: [PATCH 0875/2141] Revert "[nrf fromtree] drivers: mspi_dw: Add support for DQS line" This reverts commit a2c68d47df855f27f48e7b594f3f5e2d7d532aaf. Signed-off-by: Jukka Rissanen --- drivers/mspi/mspi_dw.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/mspi/mspi_dw.c b/drivers/mspi/mspi_dw.c index 66f257839aa4..f4e775ead437 100644 --- a/drivers/mspi/mspi_dw.c +++ b/drivers/mspi/mspi_dw.c @@ -691,6 +691,7 @@ static int _api_dev_config(const struct device *dev, } if (param_mask & MSPI_DEVICE_CONFIG_DATA_RATE) { + /* TODO: add support for DDR */ dev_data->spi_ctrlr0 &= ~(SPI_CTRLR0_SPI_DDR_EN_BIT | SPI_CTRLR0_INST_DDR_EN_BIT); switch (cfg->data_rate) { @@ -711,10 +712,10 @@ static int _api_dev_config(const struct device *dev, } if (param_mask & MSPI_DEVICE_CONFIG_DQS) { - dev_data->spi_ctrlr0 &= ~SPI_CTRLR0_SPI_RXDS_EN_BIT; - + /* TODO: add support for DQS */ if (cfg->dqs_enable) { - dev_data->spi_ctrlr0 |= SPI_CTRLR0_SPI_RXDS_EN_BIT; + LOG_ERR("DQS line is not supported."); + return -ENOTSUP; } } From c23c3956dc151e3f7181ee84973b1ebf5622e0b9 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:28 +0300 Subject: [PATCH 0876/2141] Revert "[nrf fromtree] drivers: mspi: mspi_dw: Fix compilation with CONFIG_MSPI_XIP disabled" This reverts commit c89e1b0541b2e68a181f63736b42e76ff45fd925. Signed-off-by: Jukka Rissanen --- drivers/mspi/Kconfig.dw | 1 - drivers/mspi/mspi_dw.c | 32 ++++++++++++++------------------ 2 files changed, 14 insertions(+), 19 deletions(-) diff --git a/drivers/mspi/Kconfig.dw b/drivers/mspi/Kconfig.dw index 06d2e09c8af1..d429cff044c0 100644 --- a/drivers/mspi/Kconfig.dw +++ b/drivers/mspi/Kconfig.dw @@ -8,7 +8,6 @@ config MSPI_DW depends on DT_HAS_SNPS_DESIGNWARE_SSI_ENABLED select PINCTRL if $(dt_compat_any_has_prop,$(DT_COMPAT_SNPS_DESIGNWARE_SSI),pinctrl-0) imply MSPI_XIP - imply MSPI_TIMING if MSPI_DW diff --git a/drivers/mspi/mspi_dw.c b/drivers/mspi/mspi_dw.c index f4e775ead437..0c6d8d151661 100644 --- a/drivers/mspi/mspi_dw.c +++ b/drivers/mspi/mspi_dw.c @@ -1193,22 +1193,6 @@ static int api_transceive(const struct device *dev, return rc; } -#if defined(CONFIG_MSPI_TIMING) -static int api_timing_config(const struct device *dev, - const struct mspi_dev_id *dev_id, - const uint32_t param_mask, void *cfg) -{ - struct mspi_dw_data *dev_data = dev->data; - struct mspi_dw_timing_cfg *config = cfg; - - if (param_mask & MSPI_DW_RX_TIMING_CFG) { - dev_data->rx_sample_dly = config->rx_sample_dly; - return 0; - } - return -ENOTSUP; -} -#endif /* defined(CONFIG_MSPI_TIMING) */ - #if defined(CONFIG_MSPI_XIP) static int _api_xip_config(const struct device *dev, const struct mspi_dev_id *dev_id, @@ -1315,6 +1299,20 @@ static int _api_xip_config(const struct device *dev, return 0; } +static int api_timing_config(const struct device *dev, + const struct mspi_dev_id *dev_id, + const uint32_t param_mask, void *cfg) +{ + struct mspi_dw_data *dev_data = dev->data; + struct mspi_dw_timing_cfg *config = cfg; + + if (param_mask & MSPI_DW_RX_TIMING_CFG) { + dev_data->rx_sample_dly = config->rx_sample_dly; + return 0; + } + return -ENOTSUP; +} + static int api_xip_config(const struct device *dev, const struct mspi_dev_id *dev_id, const struct mspi_xip_cfg *cfg) @@ -1463,9 +1461,7 @@ static DEVICE_API(mspi, drv_api) = { .dev_config = api_dev_config, .get_channel_status = api_get_channel_status, .transceive = api_transceive, -#if defined(CONFIG_MSPI_TIMING) .timing_config = api_timing_config, -#endif #if defined(CONFIG_MSPI_XIP) .xip_config = api_xip_config, #endif From d13eb56464db62a7748a3cb25c33059cc03331e0 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:28 +0300 Subject: [PATCH 0877/2141] Revert "[nrf fromtree] drivers: mspi: mspi_dw: support configuration of TXD_DRIVE_EDGE setting" This reverts commit a6480d2bce7a558a54915ac9091f69e636cbcce5. Signed-off-by: Jukka Rissanen --- drivers/mspi/Kconfig.dw | 21 --------------------- drivers/mspi/mspi_dw.c | 5 +---- 2 files changed, 1 insertion(+), 25 deletions(-) diff --git a/drivers/mspi/Kconfig.dw b/drivers/mspi/Kconfig.dw index d429cff044c0..1ab82da0e854 100644 --- a/drivers/mspi/Kconfig.dw +++ b/drivers/mspi/Kconfig.dw @@ -1,5 +1,4 @@ # Copyright (c) 2024 Nordic Semiconductor ASA -# Copyright (c) 2025 Tenstorrent AI ULC # SPDX-License-Identifier: Apache-2.0 config MSPI_DW @@ -8,23 +7,3 @@ config MSPI_DW depends on DT_HAS_SNPS_DESIGNWARE_SSI_ENABLED select PINCTRL if $(dt_compat_any_has_prop,$(DT_COMPAT_SNPS_DESIGNWARE_SSI),pinctrl-0) imply MSPI_XIP - -if MSPI_DW - -config MSPI_DW_TXD_DIV - int "Designware SSI TX Drive edge divisor" - default 4 - help - Division factor to apply to calculated BAUDR value when writing it - to the TXD_DRIVE_EDGE register in DDR mode. Note that the maximum - value of this register is (BAUDR / 2) - 1. - -config MSPI_DW_TXD_MUL - int "Designware SSI TX Drive edge multiplier" - default 1 - help - Multiplication factor to apply to calculated BAUDR value when writing - it to the TXD_DRIVE_EDGE register in DDR mode. Note that the maximum - value of this register is (BAUDR / 2) - 1. - -endif # MSPI_DW diff --git a/drivers/mspi/mspi_dw.c b/drivers/mspi/mspi_dw.c index 0c6d8d151661..5370da453b0a 100644 --- a/drivers/mspi/mspi_dw.c +++ b/drivers/mspi/mspi_dw.c @@ -956,10 +956,7 @@ static int start_next_packet(const struct device *dev, k_timeout_t timeout) write_rx_sample_dly(dev, dev_data->rx_sample_dly); if (dev_data->spi_ctrlr0 & (SPI_CTRLR0_SPI_DDR_EN_BIT | SPI_CTRLR0_INST_DDR_EN_BIT)) { - int txd = (CONFIG_MSPI_DW_TXD_MUL * dev_data->baudr) / - CONFIG_MSPI_DW_TXD_DIV; - - write_txd_drive_edge(dev, txd); + write_txd_drive_edge(dev, dev_data->baudr / 4); } else { write_txd_drive_edge(dev, 0); } From f48fcd7dcdbd1d1ac7395bd2fb0d073b1f0db63c Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:28 +0300 Subject: [PATCH 0878/2141] Revert "[nrf fromtree] drivers: mspi: mspi_dw: make sure controller is disabled at entry" This reverts commit c1dd79cdff9e19442c89ab717859b170ccf9db1d. Signed-off-by: Jukka Rissanen --- drivers/mspi/mspi_dw.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/mspi/mspi_dw.c b/drivers/mspi/mspi_dw.c index 5370da453b0a..992c5dd10133 100644 --- a/drivers/mspi/mspi_dw.c +++ b/drivers/mspi/mspi_dw.c @@ -1437,9 +1437,6 @@ static int dev_init(const struct device *dev) } } - /* Make sure controller is disabled. */ - write_ssienr(dev, 0); - #if defined(CONFIG_PINCTRL) if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { rc = pinctrl_apply_state(dev_config->pcfg, PINCTRL_STATE_SLEEP); From 0cc23f80a3da552c4f30824880fd63bb9ffc5335 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:28 +0300 Subject: [PATCH 0879/2141] Revert "[nrf fromtree] drivers: mspi: mspi_dw: support DDR mode" This reverts commit 9d9d507a7cd58fa12dfbc6fbde7f0f030ada6c07. Signed-off-by: Jukka Rissanen --- drivers/mspi/mspi_dw.c | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/drivers/mspi/mspi_dw.c b/drivers/mspi/mspi_dw.c index 992c5dd10133..bc2419e7f846 100644 --- a/drivers/mspi/mspi_dw.c +++ b/drivers/mspi/mspi_dw.c @@ -117,7 +117,6 @@ DEFINE_MM_REG_RD(risr, 0x34) DEFINE_MM_REG_RD_WR(dr, 0x60) DEFINE_MM_REG_WR(rx_sample_dly, 0xf0) DEFINE_MM_REG_WR(spi_ctrlr0, 0xf4) -DEFINE_MM_REG_WR(txd_drive_edge, 0xf8) #if defined(CONFIG_MSPI_XIP) DEFINE_MM_REG_WR(xip_incr_inst, 0x100) @@ -692,21 +691,8 @@ static int _api_dev_config(const struct device *dev, if (param_mask & MSPI_DEVICE_CONFIG_DATA_RATE) { /* TODO: add support for DDR */ - dev_data->spi_ctrlr0 &= ~(SPI_CTRLR0_SPI_DDR_EN_BIT | - SPI_CTRLR0_INST_DDR_EN_BIT); - switch (cfg->data_rate) { - case MSPI_DATA_RATE_SINGLE: - break; - case MSPI_DATA_RATE_DUAL: - dev_data->spi_ctrlr0 |= SPI_CTRLR0_INST_DDR_EN_BIT; - /* Also need to set DDR_EN bit */ - __fallthrough; - case MSPI_DATA_RATE_S_D_D: - dev_data->spi_ctrlr0 |= SPI_CTRLR0_SPI_DDR_EN_BIT; - break; - default: - LOG_ERR("Data rate %d not supported", - cfg->data_rate); + if (cfg->data_rate != MSPI_DATA_RATE_SINGLE) { + LOG_ERR("Only single data rate is supported."); return -ENOTSUP; } } @@ -954,12 +940,6 @@ static int start_next_packet(const struct device *dev, k_timeout_t timeout) write_spi_ctrlr0(dev, dev_data->spi_ctrlr0); write_baudr(dev, dev_data->baudr); write_rx_sample_dly(dev, dev_data->rx_sample_dly); - if (dev_data->spi_ctrlr0 & (SPI_CTRLR0_SPI_DDR_EN_BIT | - SPI_CTRLR0_INST_DDR_EN_BIT)) { - write_txd_drive_edge(dev, dev_data->baudr / 4); - } else { - write_txd_drive_edge(dev, 0); - } if (xip_enabled) { write_ssienr(dev, SSIENR_SSIC_EN_BIT); From b07107da9024efb9d8ab7285afa89e32067f9e78 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:28 +0300 Subject: [PATCH 0880/2141] Revert "[nrf fromtree] drivers: mspi: mspi_dw: improve reliability of CS signal" This reverts commit c9a1136d6d54d5e13f988be6347e3e8864672e77. Signed-off-by: Jukka Rissanen --- drivers/mspi/mspi_dw.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/mspi/mspi_dw.c b/drivers/mspi/mspi_dw.c index bc2419e7f846..262f4c6b2a2e 100644 --- a/drivers/mspi/mspi_dw.c +++ b/drivers/mspi/mspi_dw.c @@ -940,6 +940,7 @@ static int start_next_packet(const struct device *dev, k_timeout_t timeout) write_spi_ctrlr0(dev, dev_data->spi_ctrlr0); write_baudr(dev, dev_data->baudr); write_rx_sample_dly(dev, dev_data->rx_sample_dly); + write_ser(dev, BIT(dev_data->dev_id->dev_idx)); if (xip_enabled) { write_ssienr(dev, SSIENR_SSIC_EN_BIT); @@ -1026,17 +1027,8 @@ static int start_next_packet(const struct device *dev, k_timeout_t timeout) } } - /* Prefill TX FIFO with any data we can */ - if (dev_data->dummy_bytes && tx_dummy_bytes(dev)) { - imr = IMR_RXFIM_BIT; - } else if (packet->dir == MSPI_TX && packet->num_bytes) { - tx_data(dev, packet); - } - /* Enable interrupts now and wait until the packet is done. */ write_imr(dev, imr); - /* Write SER to start transfer */ - write_ser(dev, BIT(dev_data->dev_id->dev_idx)); rc = k_sem_take(&dev_data->finished, timeout); if (read_risr(dev) & RISR_RXOIR_BIT) { @@ -1066,8 +1058,6 @@ static int start_next_packet(const struct device *dev, k_timeout_t timeout) } else { write_ssienr(dev, 0); } - /* Clear SER */ - write_ser(dev, 0); if (dev_data->dev_id->ce.port) { int rc2; From 4ea376585818ccdb2faacd8828ed48167e988fc8 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:28 +0300 Subject: [PATCH 0881/2141] Revert "[nrf fromtree] drivers: mspi: mspi_dw: add API to configure RX_DLY timing" This reverts commit e8027d3ae2bd52634012905066a5bb4bfa6e2fe2. Signed-off-by: Jukka Rissanen --- drivers/mspi/mspi_dw.c | 19 ------------------ include/zephyr/drivers/mspi/mspi_dw.h | 29 --------------------------- 2 files changed, 48 deletions(-) delete mode 100644 include/zephyr/drivers/mspi/mspi_dw.h diff --git a/drivers/mspi/mspi_dw.c b/drivers/mspi/mspi_dw.c index 262f4c6b2a2e..d2c4376302ff 100644 --- a/drivers/mspi/mspi_dw.c +++ b/drivers/mspi/mspi_dw.c @@ -17,7 +17,6 @@ #include #include #include -#include #include "mspi_dw.h" @@ -49,7 +48,6 @@ struct mspi_dw_data { uint32_t ctrlr0; uint32_t spi_ctrlr0; uint32_t baudr; - uint32_t rx_sample_dly; #if defined(CONFIG_MSPI_XIP) uint32_t xip_freq; @@ -115,7 +113,6 @@ DEFINE_MM_REG_WR(imr, 0x2c) DEFINE_MM_REG_RD(isr, 0x30) DEFINE_MM_REG_RD(risr, 0x34) DEFINE_MM_REG_RD_WR(dr, 0x60) -DEFINE_MM_REG_WR(rx_sample_dly, 0xf0) DEFINE_MM_REG_WR(spi_ctrlr0, 0xf4) #if defined(CONFIG_MSPI_XIP) @@ -939,7 +936,6 @@ static int start_next_packet(const struct device *dev, k_timeout_t timeout) : 0); write_spi_ctrlr0(dev, dev_data->spi_ctrlr0); write_baudr(dev, dev_data->baudr); - write_rx_sample_dly(dev, dev_data->rx_sample_dly); write_ser(dev, BIT(dev_data->dev_id->dev_idx)); if (xip_enabled) { @@ -1266,20 +1262,6 @@ static int _api_xip_config(const struct device *dev, return 0; } -static int api_timing_config(const struct device *dev, - const struct mspi_dev_id *dev_id, - const uint32_t param_mask, void *cfg) -{ - struct mspi_dw_data *dev_data = dev->data; - struct mspi_dw_timing_cfg *config = cfg; - - if (param_mask & MSPI_DW_RX_TIMING_CFG) { - dev_data->rx_sample_dly = config->rx_sample_dly; - return 0; - } - return -ENOTSUP; -} - static int api_xip_config(const struct device *dev, const struct mspi_dev_id *dev_id, const struct mspi_xip_cfg *cfg) @@ -1425,7 +1407,6 @@ static DEVICE_API(mspi, drv_api) = { .dev_config = api_dev_config, .get_channel_status = api_get_channel_status, .transceive = api_transceive, - .timing_config = api_timing_config, #if defined(CONFIG_MSPI_XIP) .xip_config = api_xip_config, #endif diff --git a/include/zephyr/drivers/mspi/mspi_dw.h b/include/zephyr/drivers/mspi/mspi_dw.h deleted file mode 100644 index b51c9b9cdf05..000000000000 --- a/include/zephyr/drivers/mspi/mspi_dw.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2025 Tenstorrent AI ULC - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef ZEPHYR_INCLUDE_DRIVERS_MSPI_DW_H_ -#define ZEPHYR_INCLUDE_DRIVERS_MSPI_DW_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Designware MSPI configuration structure- this should be passed to the - * MSPI driver when calling mspi_timing_config - */ -struct mspi_dw_timing_cfg { - uint32_t rx_sample_dly; /* RX sample delay, written to RX_SAMPLE_DLY register */ -}; - -/* Configure RX_SAMPLE_DLY register for MSPI DW SSI */ -#define MSPI_DW_RX_TIMING_CFG BIT(0) - -#ifdef __cplusplus -} -#endif - -#endif /* ZEPHYR_INCLUDE_DRIVERS_MSPI_DW_H_ */ From 787d329da81cdba775ba9f85562c954e04df713b Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:28 +0300 Subject: [PATCH 0882/2141] Revert "[nrf fromtree] drivers: mspi: mspi_dw: support newer IP revisions" This reverts commit 17142bc74b809afdb01c0b74da72474c1573337f. Signed-off-by: Jukka Rissanen --- drivers/mspi/mspi_dw.c | 9 ++------- drivers/mspi/mspi_dw.h | 22 ++++++---------------- 2 files changed, 8 insertions(+), 23 deletions(-) diff --git a/drivers/mspi/mspi_dw.c b/drivers/mspi/mspi_dw.c index d2c4376302ff..f6c8c95eb6de 100644 --- a/drivers/mspi/mspi_dw.c +++ b/drivers/mspi/mspi_dw.c @@ -820,9 +820,8 @@ static int start_next_packet(const struct device *dev, k_timeout_t timeout) dev_data->dummy_bytes = 0; dev_data->bytes_to_discard = 0; - dev_data->ctrlr0 &= ~(CTRLR0_TMOD_MASK) - & ~(CTRLR0_DFS_MASK) - & ~(CTRLR0_DFS32_MASK); + dev_data->ctrlr0 &= ~CTRLR0_TMOD_MASK + & ~CTRLR0_DFS_MASK; dev_data->spi_ctrlr0 &= ~SPI_CTRLR0_WAIT_CYCLES_MASK; @@ -831,20 +830,16 @@ static int start_next_packet(const struct device *dev, k_timeout_t timeout) dev_data->xfer.addr_length != 0)) { dev_data->bytes_per_frame_exp = 0; dev_data->ctrlr0 |= FIELD_PREP(CTRLR0_DFS_MASK, 7); - dev_data->ctrlr0 |= FIELD_PREP(CTRLR0_DFS32_MASK, 7); } else { if ((packet->num_bytes % 4) == 0) { dev_data->bytes_per_frame_exp = 2; dev_data->ctrlr0 |= FIELD_PREP(CTRLR0_DFS_MASK, 31); - dev_data->ctrlr0 |= FIELD_PREP(CTRLR0_DFS32_MASK, 31); } else if ((packet->num_bytes % 2) == 0) { dev_data->bytes_per_frame_exp = 1; dev_data->ctrlr0 |= FIELD_PREP(CTRLR0_DFS_MASK, 15); - dev_data->ctrlr0 |= FIELD_PREP(CTRLR0_DFS32_MASK, 15); } else { dev_data->bytes_per_frame_exp = 0; dev_data->ctrlr0 |= FIELD_PREP(CTRLR0_DFS_MASK, 7); - dev_data->ctrlr0 |= FIELD_PREP(CTRLR0_DFS32_MASK, 7); } } diff --git a/drivers/mspi/mspi_dw.h b/drivers/mspi/mspi_dw.h index 28e4bed016e7..c35778cb1c59 100644 --- a/drivers/mspi/mspi_dw.h +++ b/drivers/mspi/mspi_dw.h @@ -1,42 +1,32 @@ /* * Copyright (c) 2024 Nordic Semiconductor ASA - * Copyright (c) 2025 Tenstorrent AI ULC * * SPDX-License-Identifier: Apache-2.0 */ -#if DT_HAS_COMPAT_STATUS_OKAY(snps_designware_ssi_v2) -/* - * Later versions of the SSI have different register offsets. Define a macro - * to use these. - */ -#define SSI_VERSION_2 1 -#endif - /* * This header is part of mspi_dw.c extracted only for clarity. * It is not supposed to be included by any file other than mspi_dw.c. */ /* CTRLR0 - Control Register 0 */ -#define CTRLR0_SPI_FRF_MASK COND_CODE_1(SSI_VERSION_2, GENMASK(22, 21), GENMASK(23, 22)) +#define CTRLR0_SPI_FRF_MASK GENMASK(23, 22) #define CTRLR0_SPI_FRF_STANDARD 0UL #define CTRLR0_SPI_FRF_DUAL 1UL #define CTRLR0_SPI_FRF_QUAD 2UL #define CTRLR0_SPI_FRF_OCTAL 3UL -#define CTRLR0_TMOD_MASK COND_CODE_1(SSI_VERSION_2, GENMASK(9, 8), GENMASK(11, 10)) +#define CTRLR0_TMOD_MASK GENMASK(11, 10) #define CTRLR0_TMOD_TX_RX 0UL #define CTRLR0_TMOD_TX 1UL #define CTRLR0_TMOD_RX 2UL #define CTRLR0_TMOD_EEPROM 3UL -#define CTRLR0_SCPOL_BIT COND_CODE_1(SSI_VERSION_2, BIT(7), BIT(9)) -#define CTRLR0_SCPH_BIT COND_CODE_1(SSI_VERSION_2, BIT(6), BIT(8)) -#define CTRLR0_FRF_MASK COND_CODE_1(SSI_VERSION_2, GENMASK(5, 4), GENMASK(7, 6)) +#define CTRLR0_SCPOL_BIT BIT(9) +#define CTRLR0_SCPH_BIT BIT(8) +#define CTRLR0_FRF_MASK GENMASK(7, 6) #define CTRLR0_FRF_SPI 0UL #define CTRLR0_FRF_SSP 1UL #define CTRLR0_FRF_MICROWIRE 2UL -#define CTRLR0_DFS_MASK COND_CODE_1(SSI_VERSION_2, GENMASK(3, 0), GENMASK(4, 0)) -#define CTRLR0_DFS32_MASK COND_CODE_1(SSI_VERSION_2, GENMASK(20, 16), (0)) +#define CTRLR0_DFS_MASK GENMASK(4, 0) /* CTRLR1- Control Register 1 */ #define CTRLR1_NDF_MASK GENMASK(15, 0) From 5ce7a3dc19f70f4ae407d4c3eea3f84c65cfa950 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:28 +0300 Subject: [PATCH 0883/2141] Revert "[nrf fromtree] drivers: mspi: mspi_dw: properly support multi-level interrupts" This reverts commit 9f644bb7e7ab1b4e0d061330027e128d497a0b9a. Signed-off-by: Jukka Rissanen --- drivers/mspi/mspi_dw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mspi/mspi_dw.c b/drivers/mspi/mspi_dw.c index f6c8c95eb6de..53937f0690c1 100644 --- a/drivers/mspi/mspi_dw.c +++ b/drivers/mspi/mspi_dw.c @@ -1408,10 +1408,10 @@ static DEVICE_API(mspi, drv_api) = { }; #define MSPI_DW_INST_IRQ(idx, inst) \ - IRQ_CONNECT(DT_INST_IRQN_BY_IDX(inst, idx), \ + IRQ_CONNECT(DT_INST_IRQ_BY_IDX(inst, idx, irq), \ DT_INST_IRQ_BY_IDX(inst, idx, priority), \ mspi_dw_isr, DEVICE_DT_INST_GET(inst), 0); \ - irq_enable(DT_INST_IRQN_BY_IDX(inst, idx)) + irq_enable(DT_INST_IRQ_BY_IDX(inst, idx, irq)) #define MSPI_DW_MMIO_ROM_INIT(node_id) \ COND_CODE_1(DT_REG_HAS_NAME(node_id, core), \ From 610b995f7d463660c0a781a5c2d456976830dc04 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:28 +0300 Subject: [PATCH 0884/2141] Revert "[nrf fromtree] drivers: mspi: mspi_dw: make pinctrl include conditional" This reverts commit ee801a9aad329624cd700363a3db9f6f3dedb3e8. Signed-off-by: Jukka Rissanen --- drivers/mspi/mspi_dw.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/mspi/mspi_dw.c b/drivers/mspi/mspi_dw.c index 53937f0690c1..e57511b409aa 100644 --- a/drivers/mspi/mspi_dw.c +++ b/drivers/mspi/mspi_dw.c @@ -1,6 +1,5 @@ /* * Copyright (c) 2024 Nordic Semiconductor ASA - * Copyright (c) 2025 Tenstorrent AI ULC * * SPDX-License-Identifier: Apache-2.0 */ @@ -9,9 +8,7 @@ #include #include -#if defined(CONFIG_PINCTRL) #include -#endif #include #include #include From cccb7f670442955df7f0d15a22c365fe9309c2a7 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:28 +0300 Subject: [PATCH 0885/2141] Revert "[nrf fromtree] drivers: mspi: supply empty vendor specific macros for generic case" This reverts commit ac96822f2db8f5a1b4045a2f64fec445892f44c7. Signed-off-by: Jukka Rissanen --- drivers/mspi/mspi_dw_vendor_specific.h | 38 -------------------------- 1 file changed, 38 deletions(-) diff --git a/drivers/mspi/mspi_dw_vendor_specific.h b/drivers/mspi/mspi_dw_vendor_specific.h index d32a53ac2939..e34d8a5db60b 100644 --- a/drivers/mspi/mspi_dw_vendor_specific.h +++ b/drivers/mspi/mspi_dw_vendor_specific.h @@ -1,6 +1,5 @@ /* * Copyright (c) 2024 Nordic Semiconductor ASA - * Copyright (c) 2025 Tenstorrent AI ULC * * SPDX-License-Identifier: Apache-2.0 */ @@ -97,41 +96,4 @@ static inline int vendor_specific_xip_disable(const struct device *dev, } #endif /* defined(CONFIG_MSPI_XIP) */ -#else -static inline void vendor_specific_init(const struct device *dev) -{ - ARG_UNUSED(dev); -} -static inline void vendor_specific_suspend(const struct device *dev) -{ - ARG_UNUSED(dev); -} -static inline void vendor_specific_resume(const struct device *dev) -{ - ARG_UNUSED(dev); -} -static inline void vendor_specific_irq_clear(const struct device *dev) -{ - ARG_UNUSED(dev); -} -static inline int vendor_specific_xip_enable(const struct device *dev, - const struct mspi_dev_id *dev_id, - const struct mspi_xip_cfg *cfg) -{ - ARG_UNUSED(dev); - ARG_UNUSED(dev_id); - ARG_UNUSED(cfg); - - return 0; -} -static inline int vendor_specific_xip_disable(const struct device *dev, - const struct mspi_dev_id *dev_id, - const struct mspi_xip_cfg *cfg) -{ - ARG_UNUSED(dev); - ARG_UNUSED(dev_id); - ARG_UNUSED(cfg); - - return 0; -} #endif /* DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_exmif) */ From e451892d7ee048372979bada4f418ba356a0ea4b Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:29 +0300 Subject: [PATCH 0886/2141] Revert "[nrf fromtree] tests: drivers: i2s: Add test for 8ch, 32bit, 48k TDM" This reverts commit 72e0c1852b32b48b3c3ebc0183bf960e3f1c1cc5. Signed-off-by: Jukka Rissanen --- tests/drivers/i2s/i2s_additional/Kconfig | 8 ---- .../nrf54h20dk_nrf54h20_cpuapp_aclk.overlay | 16 ------- tests/drivers/i2s/i2s_additional/src/main.c | 43 ++----------------- .../drivers/i2s/i2s_additional/testcase.yaml | 11 ----- 4 files changed, 3 insertions(+), 75 deletions(-) delete mode 100644 tests/drivers/i2s/i2s_additional/boards/nrf54h20dk_nrf54h20_cpuapp_aclk.overlay diff --git a/tests/drivers/i2s/i2s_additional/Kconfig b/tests/drivers/i2s/i2s_additional/Kconfig index ee903546708b..3c80dba48532 100644 --- a/tests/drivers/i2s/i2s_additional/Kconfig +++ b/tests/drivers/i2s/i2s_additional/Kconfig @@ -75,14 +75,6 @@ config I2S_TEST_EIGHT_CHANNELS_UNSUPPORTED When set to 'y', test will check that i2s_configure() returns -EINVAL. When set to 'n', test will do the transmission. -config I2S_TEST_EIGHT_CHANNELS_32B_48K_UNSUPPORTED - bool "Skip test with 8 channels, 32 bit word size and 48k sample rate" - depends on !I2S_TEST_EIGHT_CHANNELS_UNSUPPORTED - help - Skip test that is challenging due to high data throughput. - When set to 'y', test will be skipped. - When set to 'n', test will do the transmission. - config I2S_TEST_DATA_FORMAT_I2S_UNSUPPORTED bool "I2S_FMT_DATA_FORMAT_I2S is not supported by the driver" help diff --git a/tests/drivers/i2s/i2s_additional/boards/nrf54h20dk_nrf54h20_cpuapp_aclk.overlay b/tests/drivers/i2s/i2s_additional/boards/nrf54h20dk_nrf54h20_cpuapp_aclk.overlay deleted file mode 100644 index ad9e06d0793e..000000000000 --- a/tests/drivers/i2s/i2s_additional/boards/nrf54h20dk_nrf54h20_cpuapp_aclk.overlay +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&audiopll { - status = "okay"; - frequency = ; -}; - -&tdm130 { - mck-frequency = <12288000>; - mck-clock-source = "ACLK"; - sck-clock-source = "ACLK"; -}; diff --git a/tests/drivers/i2s/i2s_additional/src/main.c b/tests/drivers/i2s/i2s_additional/src/main.c index 0dcfc052bdf3..e8852850cee5 100644 --- a/tests/drivers/i2s/i2s_additional/src/main.c +++ b/tests/drivers/i2s/i2s_additional/src/main.c @@ -19,7 +19,7 @@ LOG_MODULE_REGISTER(i2s_add, LOG_LEVEL_INF); #define NUMBER_OF_CHANNELS 2 #define FRAME_CLK_FREQ 44100 -#define NUM_BLOCKS 4 +#define NUM_BLOCKS 20 #define TIMEOUT 1000 #define SAMPLES_COUNT 64 @@ -519,9 +519,9 @@ ZTEST(i2s_additional, test_02b_four_channels) #endif /* CONFIG_I2S_TEST_FOUR_CHANNELS_UNSUPPORTED */ } -/** @brief Test I2S transfer with eight channels, 16 bit and 44.1 kHz. +/** @brief Test I2S transfer with eight channels. */ -ZTEST(i2s_additional, test_02c_eight_channels_default) +ZTEST(i2s_additional, test_02c_eight_channels) { struct i2s_config i2s_cfg = default_i2s_cfg; @@ -549,43 +549,6 @@ ZTEST(i2s_additional, test_02c_eight_channels_default) #endif /* CONFIG_I2S_TEST_EIGHT_CHANNELS_UNSUPPORTED */ } -/** @brief Test I2S transfer with eight channels, 32 bit and 48 kHz. - */ -ZTEST(i2s_additional, test_02d_eight_channels_high_throughput) -{ - struct i2s_config i2s_cfg = default_i2s_cfg; - - i2s_cfg.channels = 8; - i2s_cfg.word_size = 32; - i2s_cfg.frame_clk_freq = 48000; - -#if defined(CONFIG_I2S_TEST_EIGHT_CHANNELS_UNSUPPORTED) - int ret; - - ret = i2s_configure(dev_i2s, I2S_DIR_TX, &i2s_cfg); - zassert_equal(ret, -EINVAL, "Unexpected result %d", ret); -#else /* CONFIG_I2S_TEST_EIGHT_CHANNELS_UNSUPPORTED */ - -#if defined(CONFIG_I2S_TEST_EIGHT_CHANNELS_32B_48K_UNSUPPORTED) - /* Skip this test if driver supports 8ch but fails in this configuration. */ - ztest_test_skip(); -#endif - - /* Select format that supports eight channels. */ -#if !defined(CONFIG_I2S_TEST_DATA_FORMAT_PCM_LONG_UNSUPPORTED) - i2s_cfg.format = I2S_FMT_DATA_FORMAT_PCM_LONG; - TC_PRINT("Selected format is I2S_FMT_DATA_FORMAT_PCM_LONG\n"); -#elif !defined(CONFIG_I2S_TEST_DATA_FORMAT_PCM_SHORT_UNSUPPORTED) - i2s_cfg.format = I2S_FMT_DATA_FORMAT_PCM_SHORT; - TC_PRINT("Selected format is I2S_FMT_DATA_FORMAT_PCM_SHORT\n"); -#else -#error "Don't know what format supports eight channels." -#endif - - i2s_dir_both_transfer_long(&i2s_cfg); -#endif /* CONFIG_I2S_TEST_EIGHT_CHANNELS_UNSUPPORTED */ -} - /** @brief Test I2S transfer with format I2S_FMT_DATA_FORMAT_I2S */ ZTEST(i2s_additional, test_03a_format_i2s) diff --git a/tests/drivers/i2s/i2s_additional/testcase.yaml b/tests/drivers/i2s/i2s_additional/testcase.yaml index 77a18c3ab9d3..9dcb82d61f3f 100644 --- a/tests/drivers/i2s/i2s_additional/testcase.yaml +++ b/tests/drivers/i2s/i2s_additional/testcase.yaml @@ -26,17 +26,6 @@ tests: drivers.i2s.additional.gpio_loopback.54h: harness_config: fixture: i2s_loopback - extra_configs: - - CONFIG_I2S_TEST_EIGHT_CHANNELS_32B_48K_UNSUPPORTED=y - platform_allow: - - nrf54h20dk/nrf54h20/cpuapp - integration_platforms: - - nrf54h20dk/nrf54h20/cpuapp - - drivers.i2s.additional.gpio_loopback.54h.aclk: - harness_config: - fixture: i2s_loopback - extra_args: EXTRA_DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_aclk.overlay" platform_allow: - nrf54h20dk/nrf54h20/cpuapp integration_platforms: From 8da08c27a71e3ff7ac293a631e69e243e6fcf8ab Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:29 +0300 Subject: [PATCH 0887/2141] Revert "[nrf fromtree] storage/stream_flash: Add test for buffered data size API" This reverts commit 3722a2f2a16b998bdab8a230dc943e9e6c8367c4. Signed-off-by: Jukka Rissanen --- .../storage/stream/stream_flash/src/main.c | 36 ------------------- 1 file changed, 36 deletions(-) diff --git a/tests/subsys/storage/stream/stream_flash/src/main.c b/tests/subsys/storage/stream/stream_flash/src/main.c index 944892e256f3..b691a7e07926 100644 --- a/tests/subsys/storage/stream/stream_flash/src/main.c +++ b/tests/subsys/storage/stream/stream_flash/src/main.c @@ -276,42 +276,6 @@ ZTEST(lib_stream_flash, test_stream_flash_bytes_written) VERIFY_WRITTEN(BUF_LEN, BUF_LEN); } -ZTEST(lib_stream_flash, test_stream_flash_bytes_buffered) -{ - int rc; - size_t buffered; - - init_target(); - - /* Initially no bytes should be buffered */ - buffered = stream_flash_bytes_buffered(&ctx); - zassert_equal(buffered, 0, "expected no buffered bytes"); - - /* Write partial buffer */ - rc = stream_flash_buffered_write(&ctx, write_buf, BUF_LEN - 128, false); - zassert_equal(rc, 0, "expected success"); - - /* Verify buffered bytes */ - buffered = stream_flash_bytes_buffered(&ctx); - zassert_equal(buffered, BUF_LEN - 128, "expected buffered bytes"); - - /* Write remaining buffer */ - rc = stream_flash_buffered_write(&ctx, write_buf, 128, false); - zassert_equal(rc, 0, "expected success"); - - /* After auto-flush, no bytes should be buffered */ - buffered = stream_flash_bytes_buffered(&ctx); - zassert_equal(buffered, 0, "expected no buffered bytes"); - - /* Write more than buffer size to trigger auto-flush */ - rc = stream_flash_buffered_write(&ctx, write_buf, BUF_LEN + 128, false); - zassert_equal(rc, 0, "expected success"); - - /* Verify buffered bytes */ - buffered = stream_flash_bytes_buffered(&ctx); - zassert_equal(buffered, 128, "expected remaining buffered bytes after auto-flush"); -} - ZTEST(lib_stream_flash, test_stream_flash_buf_size_greater_than_page_size) { int rc; From c3e8b97af173f0031670aa1e6de11c1405d2692a Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:29 +0300 Subject: [PATCH 0888/2141] Revert "[nrf fromtree] storage/stream_flash: Add API to query buffered data size" This reverts commit f1b68e8ddc1c02c29af0513aab38f1a2ecea0454. Signed-off-by: Jukka Rissanen --- include/zephyr/storage/stream_flash.h | 9 --------- subsys/storage/stream/stream_flash.c | 5 ----- 2 files changed, 14 deletions(-) diff --git a/include/zephyr/storage/stream_flash.h b/include/zephyr/storage/stream_flash.h index 6be67896013a..5a1e096e6d10 100644 --- a/include/zephyr/storage/stream_flash.h +++ b/include/zephyr/storage/stream_flash.h @@ -106,15 +106,6 @@ int stream_flash_init(struct stream_flash_ctx *ctx, const struct device *fdev, */ size_t stream_flash_bytes_written(const struct stream_flash_ctx *ctx); -/** - * @brief Read number of bytes buffered for the next flash write. - * - * @param ctx context - * - * @return Number of payload bytes buffered for the next flash write. - */ -size_t stream_flash_bytes_buffered(const struct stream_flash_ctx *ctx); - /** * @brief Process input buffers to be written to flash device in single blocks. * Will store remainder between calls. diff --git a/subsys/storage/stream/stream_flash.c b/subsys/storage/stream/stream_flash.c index c611dde9dc41..8155ef3dfe35 100644 --- a/subsys/storage/stream/stream_flash.c +++ b/subsys/storage/stream/stream_flash.c @@ -307,11 +307,6 @@ size_t stream_flash_bytes_written(const struct stream_flash_ctx *ctx) return ctx->bytes_written; } -size_t stream_flash_bytes_buffered(const struct stream_flash_ctx *ctx) -{ - return ctx->buf_bytes; -} - #ifdef CONFIG_STREAM_FLASH_INSPECT struct _inspect_flash { size_t buf_len; From 57532b8e50bf1dbecdac439a0a2ffe952b11c82c Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:29 +0300 Subject: [PATCH 0889/2141] Revert "[nrf fromlist] samples/smp_svr: Increase stack size required" This reverts commit 3143c022b78224f0edc1a7b3175caf92b8d01cca. Signed-off-by: Jukka Rissanen --- samples/subsys/mgmt/mcumgr/smp_svr/prj.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/prj.conf b/samples/subsys/mgmt/mcumgr/smp_svr/prj.conf index 925ac0c93a27..06a27644bacb 100644 --- a/samples/subsys/mgmt/mcumgr/smp_svr/prj.conf +++ b/samples/subsys/mgmt/mcumgr/smp_svr/prj.conf @@ -8,7 +8,7 @@ CONFIG_FLASH_MAP=y # Some command handlers require a large stack. CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2304 -CONFIG_MAIN_STACK_SIZE=2176 +CONFIG_MAIN_STACK_SIZE=2048 # Ensure an MCUboot-compatible binary is generated. CONFIG_BOOTLOADER_MCUBOOT=y From a6f101bdbc4f9a86c8a8bcba5d1bd03cefab04cb Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:29 +0300 Subject: [PATCH 0890/2141] Revert "[nrf fromlist] mgmt: mcumgr: grp: img_mgmt: Add support for SHA512 in images" This reverts commit 1bf6d60ee693a62e93c8c619cd7292996ae2e9f7. Signed-off-by: Jukka Rissanen --- .../include/mgmt/mcumgr/grp/img_mgmt/img_mgmt_priv.h | 8 -------- subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c | 12 ++++++------ subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt_state.c | 11 ++++------- 3 files changed, 10 insertions(+), 21 deletions(-) diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/include/mgmt/mcumgr/grp/img_mgmt/img_mgmt_priv.h b/subsys/mgmt/mcumgr/grp/img_mgmt/include/mgmt/mcumgr/grp/img_mgmt/img_mgmt_priv.h index d584467ee2bf..133a1abf054f 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/include/mgmt/mcumgr/grp/img_mgmt/img_mgmt_priv.h +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/include/mgmt/mcumgr/grp/img_mgmt/img_mgmt_priv.h @@ -18,14 +18,6 @@ extern "C" { #endif -#ifdef CONFIG_MCUBOOT_BOOTLOADER_USES_SHA512 -#define IMAGE_TLV_SHA IMAGE_TLV_SHA512 -#define IMAGE_SHA_LEN 64 -#else -#define IMAGE_TLV_SHA IMAGE_TLV_SHA256 -#define IMAGE_SHA_LEN 32 -#endif - /** * @brief Ensures the spare slot (slot 1) is fully erased. * diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c index 05e3a9c64889..b53f1b214658 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c @@ -348,7 +348,7 @@ int img_mgmt_read_info(int image_slot, struct image_version *ver, uint8_t *hash, if (tlv.it_type == 0xff && tlv.it_len == 0xffff) { return IMG_MGMT_ERR_INVALID_TLV; } - if (tlv.it_type != IMAGE_TLV_SHA || tlv.it_len != IMAGE_SHA_LEN) { + if (tlv.it_type != IMAGE_TLV_SHA256 || tlv.it_len != IMAGE_HASH_LEN) { /* Non-hash TLV. Skip it. */ data_off += sizeof(tlv) + tlv.it_len; continue; @@ -362,10 +362,10 @@ int img_mgmt_read_info(int image_slot, struct image_version *ver, uint8_t *hash, data_off += sizeof(tlv); if (hash != NULL) { - if (data_off + IMAGE_SHA_LEN > data_end) { + if (data_off + IMAGE_HASH_LEN > data_end) { return IMG_MGMT_ERR_TLV_INVALID_SIZE; } - rc = img_mgmt_read(image_slot, data_off, hash, IMAGE_SHA_LEN); + rc = img_mgmt_read(image_slot, data_off, hash, IMAGE_HASH_LEN); if (rc != 0) { return rc; } @@ -408,13 +408,13 @@ int img_mgmt_find_by_hash(uint8_t *find, struct image_version *ver) { int i; - uint8_t hash[IMAGE_SHA_LEN]; + uint8_t hash[IMAGE_HASH_LEN]; for (i = 0; i < SLOTS_PER_IMAGE * CONFIG_MCUMGR_GRP_IMG_UPDATABLE_IMAGE_NUMBER; i++) { if (img_mgmt_read_info(i, ver, hash, NULL) != 0) { continue; } - if (!memcmp(hash, find, IMAGE_SHA_LEN)) { + if (!memcmp(hash, find, IMAGE_HASH_LEN)) { return i; } } @@ -724,7 +724,7 @@ img_mgmt_upload_good_rsp(struct smp_streamer *ctxt) static int img_mgmt_upload_log(bool is_first, bool is_last, int status) { - uint8_t hash[IMAGE_SHA_LEN]; + uint8_t hash[IMAGE_HASH_LEN]; const uint8_t *hashp; int rc; diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt_state.c b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt_state.c index 984ed7fea27c..384d06137393 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt_state.c +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt_state.c @@ -434,11 +434,8 @@ static bool img_mgmt_state_encode_slot(struct smp_streamer *ctxt, uint32_t slot, zcbor_state_t *zse = ctxt->writer->zs; uint32_t flags; char vers_str[IMG_MGMT_VER_MAX_STR_LEN]; - uint8_t hash[IMAGE_SHA_LEN]; - struct zcbor_string zhash = { - .value = hash, - .len = IMAGE_SHA_LEN, - }; + uint8_t hash[IMAGE_HASH_LEN]; /* SHA256 hash */ + struct zcbor_string zhash = { .value = hash, .len = IMAGE_HASH_LEN }; struct image_version ver; bool ok; int rc = img_mgmt_read_info(slot, &ver, hash, &flags); @@ -782,14 +779,14 @@ img_mgmt_state_write(struct smp_streamer *ctxt) IMG_MGMT_ERR_INVALID_HASH); goto end; } - } else if (zhash.len != IMAGE_SHA_LEN) { + } else if (zhash.len != IMAGE_HASH_LEN) { /* The img_mgmt_find_by_hash does exact length compare * so just fail here. */ ok = smp_add_cmd_err(zse, MGMT_GROUP_ID_IMAGE, IMG_MGMT_ERR_INVALID_HASH); goto end; } else { - uint8_t hash[IMAGE_SHA_LEN]; + uint8_t hash[IMAGE_HASH_LEN]; memcpy(hash, zhash.value, zhash.len); From dd4f658ae939d349c7ab694c55dfa9532bad6d22 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:29 +0300 Subject: [PATCH 0891/2141] Revert "[nrf fromtree] boards: nrf9280pdk: Add revision 0.2.0" This reverts commit b2b59e08ca03fe41222a3c3a6cad6fe11529b9c2. Signed-off-by: Jukka Rissanen --- boards/nordic/nrf9280pdk/board.yml | 7 --- .../nrf9280pdk_nrf9280-pinctrl_0_2_0.dtsi | 53 ------------------- .../nrf9280pdk_nrf9280_cpuapp_0_2_0.overlay | 52 ------------------ .../nrf9280pdk_nrf9280_cpuppr_0_2_0.overlay | 7 --- .../nrf9280pdk_nrf9280_cpurad_0_2_0.overlay | 7 --- 5 files changed, 126 deletions(-) delete mode 100644 boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280-pinctrl_0_2_0.dtsi delete mode 100644 boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp_0_2_0.overlay delete mode 100644 boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuppr_0_2_0.overlay delete mode 100644 boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpurad_0_2_0.overlay diff --git a/boards/nordic/nrf9280pdk/board.yml b/boards/nordic/nrf9280pdk/board.yml index 274b9a84a7b7..2cce133d95c3 100644 --- a/boards/nordic/nrf9280pdk/board.yml +++ b/boards/nordic/nrf9280pdk/board.yml @@ -9,10 +9,3 @@ board: cpucluster: cpuppr - name: iron cpucluster: cpuapp - revision: - format: major.minor.patch - default: 0.2.0 - exact: false - revisions: - - name: 0.1.0 - - name: 0.2.0 diff --git a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280-pinctrl_0_2_0.dtsi b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280-pinctrl_0_2_0.dtsi deleted file mode 100644 index 41ca41e073e4..000000000000 --- a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280-pinctrl_0_2_0.dtsi +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&pinctrl { - /omit-if-no-ref/ uart135_default: uart135_default { - group1 { - psels = , - ; - }; - - group3 { - bias-pull-up; - psels = , - ; - }; - }; - - /omit-if-no-ref/ uart135_sleep: uart135_sleep { - group1 { - low-power-enable; - psels = , - , - , - ; - }; - }; - - /omit-if-no-ref/ uart136_default: uart136_default { - group1 { - psels = , - ; - }; - - group3 { - bias-pull-up; - psels = , - ; - }; - }; - - /omit-if-no-ref/ uart136_sleep: uart136_sleep { - group1 { - low-power-enable; - psels = , - , - , - ; - }; - }; -}; diff --git a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp_0_2_0.overlay b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp_0_2_0.overlay deleted file mode 100644 index 4fa3f667eadd..000000000000 --- a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp_0_2_0.overlay +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include "nrf9280pdk_nrf9280-pinctrl_0_2_0.dtsi" - -/ { - aliases { - pwm-led0 = &pwm_led2; /* Alias for compatibility with samples that use pwm-led0 */ - }; - - leds { - compatible = "gpio-leds"; - - led0: led_0 { - gpios = <&gpio9 0 GPIO_ACTIVE_HIGH>; - label = "Green LED 0"; - }; - - led1: led_1 { - gpios = <&gpio9 1 GPIO_ACTIVE_HIGH>; - label = "Green LED 1"; - }; - - led2: led_2 { - gpios = <&gpio9 2 GPIO_ACTIVE_HIGH>; - label = "Green LED 2"; - }; - - led3: led_3 { - gpios = <&gpio9 3 GPIO_ACTIVE_HIGH>; - label = "Green LED 3"; - }; - }; - - pwmleds { - compatible = "pwm-leds"; - - /delete-node/ pwm_led_0; - - /* - * There is no valid hardware configuration to pass PWM signal on pins 0 and 1. - * First valid config is P9.2. This corresponds to LED 2. - * Signal on PWM130's channel 0 can be passed directly on GPIO Port 9 pin 2. - */ - pwm_led2: pwm_led_2 { - pwms = <&pwm130 0 PWM_MSEC(20) PWM_POLARITY_NORMAL>; - }; - }; -}; diff --git a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuppr_0_2_0.overlay b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuppr_0_2_0.overlay deleted file mode 100644 index f2d986e6cb06..000000000000 --- a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuppr_0_2_0.overlay +++ /dev/null @@ -1,7 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include "nrf9280pdk_nrf9280-pinctrl_0_2_0.dtsi" diff --git a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpurad_0_2_0.overlay b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpurad_0_2_0.overlay deleted file mode 100644 index f2d986e6cb06..000000000000 --- a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpurad_0_2_0.overlay +++ /dev/null @@ -1,7 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include "nrf9280pdk_nrf9280-pinctrl_0_2_0.dtsi" From 5a8a1a28d8937b5130db47083496a109b75aff57 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:29 +0300 Subject: [PATCH 0892/2141] Revert "[nrf fromtree] boards: nrf9280pdk: disable IEEE 802.15.4 support" This reverts commit bfbe1e06ca94859b94a2148db7a583f62dc0ac99. Signed-off-by: Jukka Rissanen --- boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts index 1c8622c07803..4a99911fa21a 100644 --- a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts +++ b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts @@ -24,6 +24,7 @@ zephyr,flash = &mram1x; zephyr,sram = &cpuapp_data; zephyr,shell-uart = &uart136; + zephyr,ieee802154 = &cpuapp_ieee802154; zephyr,bt-hci = &bt_hci_ipc0; nordic,802154-spinel-ipc = &ipc0; zephyr,entropy = &prng; @@ -283,6 +284,10 @@ ipc0: &cpuapp_cpurad_ipc { }; }; +&cpuapp_ieee802154 { + status = "okay"; +}; + zephyr_udc0: &usbhs { status = "okay"; }; From cf5f7a2a3e9431eb370bbbf2b8facb57d6e86475 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:29 +0300 Subject: [PATCH 0893/2141] Revert "[nrf fromtree] samples: Enable Direct XIP through sysbuild" This reverts commit 08ea5d1e78b749c8c31017b9ae0fe6b02fe590cd. Signed-off-by: Jukka Rissanen --- samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml b/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml index 4596e468207b..fd6194cdc4f1 100644 --- a/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml +++ b/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml @@ -97,9 +97,9 @@ tests: # transport. Transport does not affect flags so it does not really matter which is selected, # flags should affect any transport the same way. sample.mcumgr.smp_svr.mcuboot_flags.direct_xip_withrevert: - extra_args: - - EXTRA_CONF_FILE="overlay-serial.conf" - - SB_CONFIG_MCUBOOT_MODE_DIRECT_XIP_WITH_REVERT=y + extra_args: EXTRA_CONF_FILE="overlay-serial.conf" + extra_configs: + - CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP_WITH_REVERT=y platform_allow: - nrf52840dk/nrf52840 - pinnacle_100_dvk From a0b6d590f9b9a9d27a5be3d791fec0cd11d457bc Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:29 +0300 Subject: [PATCH 0894/2141] Revert "[nrf fromtree] Revert "boards: nordic: nRF54L15DK: set HFXO clock latency to 854"" This reverts commit 0f36da36cf5b1bd30a2d426daa3141132352a319. Signed-off-by: Jukka Rissanen --- boards/nordic/nrf54l15dk/nrf54l15dk_common.dtsi | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/boards/nordic/nrf54l15dk/nrf54l15dk_common.dtsi b/boards/nordic/nrf54l15dk/nrf54l15dk_common.dtsi index c030c2c55189..6740544b524a 100644 --- a/boards/nordic/nrf54l15dk/nrf54l15dk_common.dtsi +++ b/boards/nordic/nrf54l15dk/nrf54l15dk_common.dtsi @@ -108,5 +108,9 @@ pinctrl-names = "default", "sleep"; }; +&hfxo { + startup-time-us = <854>; +}; + /* Get a node label for wi-fi spi to use in shield files */ wifi_spi: &spi22 {}; From fc701cb564813cc4d27c48f242821f5075ee6939 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:29 +0300 Subject: [PATCH 0895/2141] Revert "[nrf fromtree] flash: spi_nor: Fix VLA error when building with clang" This reverts commit 620baa90b08d140b0852eab72affcb8197e70b19. Signed-off-by: Jukka Rissanen --- drivers/flash/spi_nor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/flash/spi_nor.c b/drivers/flash/spi_nor.c index b235c166f374..383a6065394b 100644 --- a/drivers/flash/spi_nor.c +++ b/drivers/flash/spi_nor.c @@ -1376,7 +1376,7 @@ static int spi_nor_process_sfdp(const struct device *dev) if (id == JESD216_SFDP_PARAM_ID_BFP) { union { - uint32_t dw[20]; + uint32_t dw[MIN(php->len_dw, 20)]; struct jesd216_bfp bfp; } u_param; const struct jesd216_bfp *bfp = &u_param.bfp; From 50c23f83e94ae9926ca431c4a401038d478f48d4 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:29 +0300 Subject: [PATCH 0896/2141] Revert "[nrf fromtree] drivers: adc: adc_nrfx_saadc: add nRF54LS05B analog pins" This reverts commit 886cc3ddf15affe198ee2e0908f09068a9eaf42e. Signed-off-by: Jukka Rissanen --- drivers/adc/adc_nrfx_saadc.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/adc/adc_nrfx_saadc.c b/drivers/adc/adc_nrfx_saadc.c index 06035e2c3c5d..614973261746 100644 --- a/drivers/adc/adc_nrfx_saadc.c +++ b/drivers/adc/adc_nrfx_saadc.c @@ -76,13 +76,6 @@ static const uint32_t saadc_psels[NRF_SAADC_AIN7 + 1] = { [NRF_SAADC_AIN6] = NRF_PIN_PORT_TO_PIN_NUMBER(11U, 1), [NRF_SAADC_AIN7] = NRF_PIN_PORT_TO_PIN_NUMBER(12U, 1), }; -#elif defined(NRF54LS05B_ENGA_XXAA) -static const uint32_t saadc_psels[NRF_SAADC_AIN3 + 1] = { - [NRF_SAADC_AIN0] = NRF_PIN_PORT_TO_PIN_NUMBER(4U, 1), - [NRF_SAADC_AIN1] = NRF_PIN_PORT_TO_PIN_NUMBER(5U, 1), - [NRF_SAADC_AIN2] = NRF_PIN_PORT_TO_PIN_NUMBER(6U, 1), - [NRF_SAADC_AIN3] = NRF_PIN_PORT_TO_PIN_NUMBER(7U, 1), -}; #endif #else From 9145f720fd4c16bd274d11de3adf282e56962ab8 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:29 +0300 Subject: [PATCH 0897/2141] Revert "[nrf fromtree] soc: nordic: nrf54l: remove redundant inclusion of GLITCHDET" This reverts commit e53ffc9c2a33e81597f021a5e8459dbb6cabcf72. Signed-off-by: Jukka Rissanen --- soc/nordic/nrf54l/soc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/soc/nordic/nrf54l/soc.c b/soc/nordic/nrf54l/soc.c index 76225d70ab74..85043985e51f 100644 --- a/soc/nordic/nrf54l/soc.c +++ b/soc/nordic/nrf54l/soc.c @@ -29,6 +29,7 @@ LOG_MODULE_REGISTER(soc, CONFIG_SOC_LOG_LEVEL); !defined(__ZEPHYR__) #include +#include #include #include #include From 8af1c0990d35190e4101b4a11b52c497aa00ba3c Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:29 +0300 Subject: [PATCH 0898/2141] Revert "[nrf fromtree] manifest: update hal_nordic revision to integrate nrfx 3.14.0" This reverts commit 70886df2617f6620f9c38159ee36d702b78f8f1a. Signed-off-by: Jukka Rissanen --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 17e5d7cf22d1..b8e6b93699ed 100644 --- a/west.yml +++ b/west.yml @@ -200,7 +200,7 @@ manifest: groups: - hal - name: hal_nordic - revision: 54f33f10a0b826174fb145f155afa61ce5a44b93 + revision: a6579483deb33112cc763d05a4a3f8085883c1ac path: modules/hal/nordic groups: - hal From 9444463e8205e9511c014d274b74a63f5546614b Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:29 +0300 Subject: [PATCH 0899/2141] Revert "[nrf fromlist] manifest: tf-m-tests: bring in fix for TF-M 2.2.0" This reverts commit b48a1f26ef887cee5f3c20ee04c1b1db7f43f226. Signed-off-by: Jukka Rissanen --- submanifests/optional.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submanifests/optional.yaml b/submanifests/optional.yaml index 8e8d7904ac59..567f38b7a0e2 100644 --- a/submanifests/optional.yaml +++ b/submanifests/optional.yaml @@ -41,7 +41,7 @@ manifest: groups: - optional - name: tf-m-tests - revision: a90702bcb8fadb6f70daf0ffbb13888dfe63fc99 + revision: a286347e6a5dd37a9a5e960450ffc0260d63fb27 path: modules/tee/tf-m/tf-m-tests remote: upstream groups: From aa8ec91617aaa3e1a37dd158dc3a6f62a039dfbb Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:29 +0300 Subject: [PATCH 0900/2141] Revert "[nrf fromtree] modules: trusted-firmware-m: Update in interface implementation" This reverts commit 143520e2b5171f3ec84c6cdf6223adc72b36fcba. Signed-off-by: Jukka Rissanen --- modules/trusted-firmware-m/interface/interface.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/modules/trusted-firmware-m/interface/interface.c b/modules/trusted-firmware-m/interface/interface.c index 027985b9e9b9..abff7efdc72f 100644 --- a/modules/trusted-firmware-m/interface/interface.c +++ b/modules/trusted-firmware-m/interface/interface.c @@ -53,17 +53,13 @@ int32_t tfm_ns_interface_dispatch(veneer_fn fn, #endif } -#if defined(CONFIG_FPU_SHARING) struct fpu_ctx_full context_buffer; z_arm_save_fp_context(&context_buffer); -#endif result = fn(arg0, arg1, arg2, arg3); -#if defined(CONFIG_FPU_SHARING) z_arm_restore_fp_context(&context_buffer); -#endif if (!isr_mode) { #if !defined(CONFIG_ARM_NONSECURE_PREEMPTIBLE_SECURE_CALLS) From 5a8f89dda2c06a519159f15bf2d6c99c32dc053a Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:29 +0300 Subject: [PATCH 0901/2141] Revert "[nrf fromtree] arch: arm: cortex_m: Modifed FPU save and restore helpers" This reverts commit d9746f46a002b97126e4ff963d0df8dd9cea19c4. Signed-off-by: Jukka Rissanen --- arch/arm/core/cortex_m/fpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/core/cortex_m/fpu.c b/arch/arm/core/cortex_m/fpu.c index 0b8499afd6ed..b937d725c283 100644 --- a/arch/arm/core/cortex_m/fpu.c +++ b/arch/arm/core/cortex_m/fpu.c @@ -16,7 +16,7 @@ void z_arm_save_fp_context(struct fpu_ctx_full *buffer) { -#if defined(CONFIG_FPU) +#if defined(CONFIG_FPU_SHARING) __ASSERT_NO_MSG(buffer != NULL); uint32_t CONTROL = __get_CONTROL(); @@ -44,7 +44,7 @@ void z_arm_save_fp_context(struct fpu_ctx_full *buffer) void z_arm_restore_fp_context(const struct fpu_ctx_full *buffer) { -#if defined(CONFIG_FPU) +#if defined(CONFIG_FPU_SHARING) if (buffer->ctx_saved) { /* Set FPCA first so it is set even if an interrupt happens * during restoration. From 65ed3913508db73a578b58a96b8e5f4a5f7e261e Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:29 +0300 Subject: [PATCH 0902/2141] Revert "[nrf fromtree] tf-m: build: Treat warnings as errors" This reverts commit 5b5eafa8b75d9e881431e5d37436eccd79fd47eb. Signed-off-by: Jukka Rissanen --- modules/trusted-firmware-m/CMakeLists.txt | 5 ----- 1 file changed, 5 deletions(-) diff --git a/modules/trusted-firmware-m/CMakeLists.txt b/modules/trusted-firmware-m/CMakeLists.txt index 5e066130b262..c76812198a32 100644 --- a/modules/trusted-firmware-m/CMakeLists.txt +++ b/modules/trusted-firmware-m/CMakeLists.txt @@ -26,11 +26,6 @@ if (CONFIG_BUILD_WITH_TFM) endif() endif() - # Treat any warning as error - if (CONFIG_COMPILER_WARNINGS_AS_ERRORS) - list(APPEND TFM_CMAKE_ARGS -DCONFIG_TFM_WARNINGS_ARE_ERRORS:BOOL=ON) - endif() - if (CONFIG_TFM_SFN) list(APPEND TFM_CMAKE_ARGS -DCONFIG_TFM_SPM_BACKEND="SFN") else() # CONFIG_TFM_IPC From f4e6151f4212cbba749e3a9e4011daeb9c5482e6 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:30 +0300 Subject: [PATCH 0903/2141] Revert "[nrf fromtree] samples: tfm: tfm_psa_test: Add temporary isolation workaround" This reverts commit 82dae59317f083e90a3323a09ea567e0bd1be37f. Signed-off-by: Jukka Rissanen --- samples/tfm_integration/tfm_psa_test/CMakeLists.txt | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/samples/tfm_integration/tfm_psa_test/CMakeLists.txt b/samples/tfm_integration/tfm_psa_test/CMakeLists.txt index 8b05afab3aa6..03f55dccad13 100644 --- a/samples/tfm_integration/tfm_psa_test/CMakeLists.txt +++ b/samples/tfm_integration/tfm_psa_test/CMakeLists.txt @@ -63,17 +63,6 @@ set_property(TARGET zephyr_property_target -DTEST_PSA_API=${TEST_PSA_API} ) -# Workaround: The TF-M tests require the large TF-M profile because it supports -# the full list of crypto algorithms needed, not because of the isolation level. -# For the TF-M tests the isolation level is irrelevant so we set it to 2 here so -# that we don't exclude the platforms which don't support the isolation level 3. -# This is a short lived workaround because the TF-M cmake logic will do this workaround -# automatically in the future. -set_property(TARGET zephyr_property_target - APPEND PROPERTY TFM_CMAKE_OPTIONS - -DTFM_ISOLATION_LEVEL=2 -) - include(ExternalProject) ExternalProject_Add(tfm_psa_arch_test_app From 79fd06e7241c79bfd92ac4ee316e36b3b806bede Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:30 +0300 Subject: [PATCH 0904/2141] Revert "[nrf fromtree] samples: tfm_psa_test: Set TFM_PROFILE" This reverts commit e3c8913c84e967527b184e0de20c6ee05c9b350d. Signed-off-by: Jukka Rissanen --- samples/tfm_integration/tfm_psa_test/prj.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/tfm_integration/tfm_psa_test/prj.conf b/samples/tfm_integration/tfm_psa_test/prj.conf index ba515d542c8c..bab1254229da 100644 --- a/samples/tfm_integration/tfm_psa_test/prj.conf +++ b/samples/tfm_integration/tfm_psa_test/prj.conf @@ -5,7 +5,7 @@ # CONFIG_BUILD_WITH_TFM=y -CONFIG_TFM_PROFILE_TYPE_LARGE=y +CONFIG_TFM_PROFILE_TYPE_NOT_SET=y CONFIG_TFM_USE_NS_APP=y CONFIG_QEMU_ICOUNT_SHIFT=1 From ae80805e523f79d9d00176f3317d37cd34bc43fd Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:30 +0300 Subject: [PATCH 0905/2141] Revert "[nrf fromtree] tfm-tests: Bump tests to tfm-2.2.0" This reverts commit 3b39377992b19c8eddf0b4322e15a69d2f25c16e. Signed-off-by: Jukka Rissanen --- submanifests/optional.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submanifests/optional.yaml b/submanifests/optional.yaml index 567f38b7a0e2..af2d68d0ef5f 100644 --- a/submanifests/optional.yaml +++ b/submanifests/optional.yaml @@ -41,7 +41,7 @@ manifest: groups: - optional - name: tf-m-tests - revision: a286347e6a5dd37a9a5e960450ffc0260d63fb27 + revision: c712761dd5391bf3f38033643d28a736cae89a19 path: modules/tee/tf-m/tf-m-tests remote: upstream groups: From c1fa821ccbb6659f2fef08bc2f0c6b8d5072dfab Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:30 +0300 Subject: [PATCH 0906/2141] Revert "[nrf fromtree] drivers: nrf_wifi: Disable VHT capabilities for softAP mode" This reverts commit 6e68865b19e49b0bc62215b4b1c7f5401422cccd. Signed-off-by: Jukka Rissanen --- drivers/wifi/nrf_wifi/src/wpa_supp_if.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/wifi/nrf_wifi/src/wpa_supp_if.c b/drivers/wifi/nrf_wifi/src/wpa_supp_if.c index faaddd770c37..21f7600ca80a 100644 --- a/drivers/wifi/nrf_wifi/src/wpa_supp_if.c +++ b/drivers/wifi/nrf_wifi/src/wpa_supp_if.c @@ -1578,7 +1578,6 @@ enum nrf_wifi_status nrf_wifi_parse_sband( band->ht_cap.wpa_supp_ampdu_factor = event->ht_cap.nrf_wifi_ampdu_factor; band->ht_cap.wpa_supp_ampdu_density = event->ht_cap.nrf_wifi_ampdu_density; -#ifndef CONFIG_WIFI_NM_WPA_SUPPLICANT_AP band->vht_cap.wpa_supp_vht_supported = event->vht_cap.nrf_wifi_vht_supported; band->vht_cap.wpa_supp_cap = event->vht_cap.nrf_wifi_cap; @@ -1586,7 +1585,6 @@ enum nrf_wifi_status nrf_wifi_parse_sband( band->vht_cap.vht_mcs.rx_highest = event->vht_cap.vht_mcs.rx_highest; band->vht_cap.vht_mcs.tx_mcs_map = event->vht_cap.vht_mcs.tx_mcs_map; band->vht_cap.vht_mcs.tx_highest = event->vht_cap.vht_mcs.tx_highest; -#endif /* !CONFIG_WIFI_NM_WPA_SUPPLICANT_AP */ band->band = event->band; From e83dfc607000505fa00e2109919394a268fd02e8 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:30 +0300 Subject: [PATCH 0907/2141] Revert "[nrf fromtree] drivers: i2s: nrf_tdm: Allow using 8 channels" This reverts commit 7b7000067d43780fd2217d3ee536d7fe0740fcec. Signed-off-by: Jukka Rissanen --- drivers/i2s/i2s_nrf_tdm.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/i2s/i2s_nrf_tdm.c b/drivers/i2s/i2s_nrf_tdm.c index 45e5b3d18049..c65edb2717bc 100644 --- a/drivers/i2s/i2s_nrf_tdm.c +++ b/drivers/i2s/i2s_nrf_tdm.c @@ -30,10 +30,6 @@ LOG_MODULE_REGISTER(tdm_nrf, CONFIG_I2S_LOG_LEVEL); */ #define NRFX_TDM_STATUS_TRANSFER_STOPPED BIT(1) -/* Maximum clock divider value. Corresponds to CKDIV2. */ -#define NRFX_TDM_MAX_SCK_DIV_VALUE TDM_CONFIG_SCK_DIV_SCKDIV_Max -#define NRFX_TDM_MAX_MCK_DIV_VALUE TDM_CONFIG_MCK_DIV_DIV_Max - #define NRFX_TDM_NUM_OF_CHANNELS (TDM_CONFIG_CHANNEL_NUM_NUM_Max + 1) #define NRFX_TDM_TX_CHANNELS_MASK \ @@ -818,11 +814,11 @@ static int trigger_start(const struct device *dev) nrf_tdm_sck_configure(drv_cfg->p_reg, drv_cfg->sck_src == ACLK ? NRF_TDM_SRC_ACLK : NRF_TDM_SRC_PCLK32M, - nrfx_cfg->sck_setup > NRFX_TDM_MAX_SCK_DIV_VALUE); + false); nrf_tdm_mck_configure(drv_cfg->p_reg, drv_cfg->mck_src == ACLK ? NRF_TDM_SRC_ACLK : NRF_TDM_SRC_PCLK32M, - nrfx_cfg->mck_setup > NRFX_TDM_MAX_MCK_DIV_VALUE); + false); /* If it is required to use certain HF clock, request it to be running * first. If not, start the transfer directly. */ From d6d9685be1cd6972c9800036b611932e6d04b3c6 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:30 +0300 Subject: [PATCH 0908/2141] Revert "[nrf fromtree] modules: Add VID and CID Kconfigs" This reverts commit 94a6f0d75715310e3c3c808118335ba8e00818af. Signed-off-by: Jukka Rissanen --- cmake/mcuboot.cmake | 8 -------- modules/Kconfig.mcuboot | 34 ---------------------------------- 2 files changed, 42 deletions(-) diff --git a/cmake/mcuboot.cmake b/cmake/mcuboot.cmake index 6562193725d6..964d694983b3 100644 --- a/cmake/mcuboot.cmake +++ b/cmake/mcuboot.cmake @@ -124,14 +124,6 @@ function(zephyr_mcuboot_tasks) set(imgtool_args --key "${keyfile}" ${imgtool_args}) endif() - if(CONFIG_MCUBOOT_IMGTOOL_UUID_VID) - set(imgtool_args ${imgtool_args} --vid "${CONFIG_MCUBOOT_IMGTOOL_UUID_VID_NAME}") - endif() - - if(CONFIG_MCUBOOT_IMGTOOL_UUID_CID) - set(imgtool_args ${imgtool_args} --cid "${CONFIG_MCUBOOT_IMGTOOL_UUID_CID_NAME}") - endif() - if(CONFIG_MCUBOOT_IMGTOOL_OVERWRITE_ONLY) # Use overwrite-only instead of swap upgrades. set(imgtool_args --overwrite-only --align 1 ${imgtool_args}) diff --git a/modules/Kconfig.mcuboot b/modules/Kconfig.mcuboot index b4d7f5173357..d6b4465de2d4 100644 --- a/modules/Kconfig.mcuboot +++ b/modules/Kconfig.mcuboot @@ -120,40 +120,6 @@ config MCUBOOT_IMGTOOL_OVERWRITE_ONLY If enabled, --overwrite-only option passed to imgtool to avoid adding the swap status area size when calculating overflow. -config MCUBOOT_IMGTOOL_UUID_VID - bool "Append vendor unique identifier TLV" - help - If enabled, --vid option passed to imgtool with the value set by - the MCUBOOT_IMGTOOL_UUID_VID_NAME option. - -config MCUBOOT_IMGTOOL_UUID_VID_NAME - string "Vendor UUID" - depends on MCUBOOT_IMGTOOL_UUID_VID - help - The vendor unique identifier. - The following formats are supported: - - Domain name (i.e. amce.corp) - - Raw UUID (i.e. 12345678-1234-5678-1234-567812345678) - - Raw HEX UUID (i.e. 12345678123456781234567812345678) - -config MCUBOOT_IMGTOOL_UUID_CID - bool "Append image class unique identifier TLV" - help - If enabled, --cid option passed to imgtool with the value set by - the MCUBOOT_IMGTOOL_UUID_CID_NAME option. - -config MCUBOOT_IMGTOOL_UUID_CID_NAME - string "Image class UUID" - depends on MCUBOOT_IMGTOOL_UUID_CID - help - The image class unique identifier. - The following formats are supported: - - Image class name (i.e. nRF5340_door_lock_btperipheral). - This format requires MCUBOOT_IMGTOOL_UUID_VID_NAME to be defined - as the VID UUID is used as the namespace for image class UUID. - - Raw UUID (i.e. 12345678-1234-5678-1234-567812345678) - - Raw HEX UUID (i.e. 12345678123456781234567812345678) - config MCUBOOT_EXTRA_IMGTOOL_ARGS string "Extra arguments to pass to imgtool when signing" default "" From 8c4abe6c4d181450d76102bf9906643aaa49e3d1 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:30 +0300 Subject: [PATCH 0909/2141] Revert "[nrf fromlist] tests: drivers: clock_control_api: fix Kconfig logic" This reverts commit 64061358cc5d25b97af613202397dec7256f3271. Signed-off-by: Jukka Rissanen --- tests/drivers/clock_control/clock_control_api/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/drivers/clock_control/clock_control_api/Kconfig b/tests/drivers/clock_control/clock_control_api/Kconfig index 9315f3e337bc..dc1e976d824c 100644 --- a/tests/drivers/clock_control/clock_control_api/Kconfig +++ b/tests/drivers/clock_control/clock_control_api/Kconfig @@ -3,7 +3,7 @@ config TEST_NRF_HF_STARTUP_TIME_US int "Delay required for HF clock startup." - default 3000 if SOC_SERIES_NRF91X + default 3000 if CONFIG_SOC_SERIES_NRF91X default 500 depends on SOC_FAMILY_NORDIC_NRF help From 3e8e26124eb22331e81b283853212a38d5766d05 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:30 +0300 Subject: [PATCH 0910/2141] Revert "[nrf fromtree] soc: nordic: nrf54l: make SWO available" This reverts commit a9c15a8b8d74a49a0864cb95f6a1bb41f5141599. Signed-off-by: Jukka Rissanen --- soc/nordic/nrf54l/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/soc/nordic/nrf54l/Kconfig b/soc/nordic/nrf54l/Kconfig index da1781414782..bc88a62efb7e 100644 --- a/soc/nordic/nrf54l/Kconfig +++ b/soc/nordic/nrf54l/Kconfig @@ -22,7 +22,6 @@ config SOC_NRF54L_CPUAPP_COMMON select HAS_HW_NRF_RADIO_IEEE802154 select HAS_POWEROFF select HAS_NORDIC_RAM_CTRL - select HAS_SWO config SOC_NRF54L05_CPUAPP select SOC_NRF54L_CPUAPP_COMMON From a36b7aaac35c9ff36628f9a7ae05313db5362436 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:30 +0300 Subject: [PATCH 0911/2141] Revert "[nrf noup] doc: extensions: kconfig: Add SoC sysbuild Kconfigs" This reverts commit 1d73d0e3cb5ff37fd53c103bb49c1e9b92be75c5. Signed-off-by: Jukka Rissanen --- doc/_extensions/zephyr/kconfig/__init__.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/doc/_extensions/zephyr/kconfig/__init__.py b/doc/_extensions/zephyr/kconfig/__init__.py index dfb7a567da83..eb1903b18982 100644 --- a/doc/_extensions/zephyr/kconfig/__init__.py +++ b/doc/_extensions/zephyr/kconfig/__init__.py @@ -106,9 +106,6 @@ def kconfig_load(app: Sphinx) -> tuple[kconfiglib.Kconfig, kconfiglib.Kconfig, d for folder in soc_folders: f.write('source "' + (Path(folder) / 'Kconfig.soc').as_posix() + '"\n') - if "nordic" in folder: - f.write('osource "' + (Path(folder) / 'Kconfig.sysbuild').as_posix() + '"\n') - with open(Path(td) / "soc" / "Kconfig", "w") as f: for folder in soc_folders: f.write('osource "' + (Path(folder) / 'Kconfig').as_posix() + '"\n') From 13a1fca97a45124f897aabce8156eae55e4ae20d Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:30 +0300 Subject: [PATCH 0912/2141] Revert "[nrf fromtree] driver: nrf_wifi: TWT setup duration" This reverts commit d4d69a4a781859dd8691633988b6b8816b653dc9. Signed-off-by: Jukka Rissanen --- drivers/wifi/nrf_wifi/Kconfig.nrfwifi | 10 ---------- drivers/wifi/nrf_wifi/src/wifi_mgmt.c | 1 - 2 files changed, 11 deletions(-) diff --git a/drivers/wifi/nrf_wifi/Kconfig.nrfwifi b/drivers/wifi/nrf_wifi/Kconfig.nrfwifi index 9b37c302872b..4b3bb0d41ca2 100644 --- a/drivers/wifi/nrf_wifi/Kconfig.nrfwifi +++ b/drivers/wifi/nrf_wifi/Kconfig.nrfwifi @@ -934,14 +934,4 @@ config NRF_WIFI_DYNAMIC_ED help This option enables support for proprietary algorithm to enhance performance in high-traffic channels. - -config NRF_WIFI_TWT_SETUP_TIMEOUT_MS - int "TWT setup timeout (ms)" - range 100 10000 - default 250 - help - Timeout duration (in milliseconds) for the TWT setup procedure. - The STA will transmit a TWT setup request every 100 milliseconds, - continuing until this timeout value is reached. If no response is - received before the timeout expires, the TWT setup is considered failed. endif # WIFI_NRF70 diff --git a/drivers/wifi/nrf_wifi/src/wifi_mgmt.c b/drivers/wifi/nrf_wifi/src/wifi_mgmt.c index e48ae31734a7..e9755e80013e 100644 --- a/drivers/wifi/nrf_wifi/src/wifi_mgmt.c +++ b/drivers/wifi/nrf_wifi/src/wifi_mgmt.c @@ -564,7 +564,6 @@ int nrf_wifi_set_twt(const struct device *dev, twt_info.dialog_token = twt_params->dialog_token; twt_info.twt_wake_ahead_duration = twt_params->setup.twt_wake_ahead_duration; - twt_info.twt_req_timeout = CONFIG_NRF_WIFI_TWT_SETUP_TIMEOUT_MS; status = nrf_wifi_sys_fmac_twt_setup(rpu_ctx_zep->rpu_ctx, vif_ctx_zep->vif_idx, From a002fcdbd12eaa43341d04b16c5c6688cfd2655e Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:30 +0300 Subject: [PATCH 0913/2141] Revert "[nrf fromtree] manifest: Update nrf_wifi revision to fix raw tx" This reverts commit 93c862443b731d8668d31e476c0552db5bf3095b. Signed-off-by: Jukka Rissanen --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index b8e6b93699ed..4d20267c8b48 100644 --- a/west.yml +++ b/west.yml @@ -328,7 +328,7 @@ manifest: revision: 40403f5f2805cca210d2a47c8717d89c4e816cda path: modules/bsim_hw_models/nrf_hw_models - name: nrf_wifi - revision: 5fffeab6496932abb10f9dae53ed3686967aa050 + revision: 787eea1a3c8dd13c86214e204a919e6f9bcebf91 path: modules/lib/nrf_wifi - name: open-amp revision: f7f4d083c7909a39d86e217376c69b416ec4faf3 From 558f5c502a9d06f92fd619f0d6a8df651f820a6a Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:30 +0300 Subject: [PATCH 0914/2141] Revert "[nrf noup] soc: nrf54h: work around missing power domain handling" This reverts commit 20d89eb11a79ec9ca6ee80372af2a725028765ac. Signed-off-by: Jukka Rissanen --- soc/nordic/nrf54h/Kconfig | 5 ----- soc/nordic/nrf54h/soc.c | 12 ------------ 2 files changed, 17 deletions(-) diff --git a/soc/nordic/nrf54h/Kconfig b/soc/nordic/nrf54h/Kconfig index b117ee45ad89..e227a2999101 100644 --- a/soc/nordic/nrf54h/Kconfig +++ b/soc/nordic/nrf54h/Kconfig @@ -95,11 +95,6 @@ config SOC_NRF54H20_CPURAD_ENABLE_CHECK_VTOR help Verify that VTOR is not 0xFFFFFFFF before booting the Radiocore. -config SOC_NRF54H20_DISABLE_ALL_GPIO_RETENTION_WORKAROUND - bool "Disable all GPIO pin retention on boot" - default y - depends on SOC_NRF54H20_CPUAPP || SOC_NRF54H20_CPURAD - config SOC_NRF54H20_CPURAD select SOC_NRF54H20_CPURAD_COMMON diff --git a/soc/nordic/nrf54h/soc.c b/soc/nordic/nrf54h/soc.c index 7c3bc65768f1..a3f67711e455 100644 --- a/soc/nordic/nrf54h/soc.c +++ b/soc/nordic/nrf54h/soc.c @@ -14,7 +14,6 @@ #include #endif -#include #include #include #include @@ -174,17 +173,6 @@ void soc_early_init_hook(void) DT_PROP_OR(DT_NODELABEL(nfct), nfct_pins_as_gpios, 0)) { nrf_nfct_pad_config_enable_set(NRF_NFCT, false); } - - /* This is a workaround for not yet having upstream patches for properly handling - * pin retention. It should be removed as part of the next upmerge. - */ - if (IS_ENABLED(CONFIG_SOC_NRF54H20_DISABLE_ALL_GPIO_RETENTION_WORKAROUND)) { - NRF_GPIO_Type *gpio_regs[GPIO_COUNT] = GPIO_REG_LIST; - - for (int i = 0; i < NRFX_ARRAY_SIZE(gpio_regs); i++) { - nrf_gpio_port_retain_set(gpio_regs[i], 0); - } - } } #if defined(CONFIG_SOC_LATE_INIT_HOOK) From 4030b410054f3e59b10788fe92ca21a633f3384d Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:30 +0300 Subject: [PATCH 0915/2141] Revert "[nrf fromlist] soc: nordic: nrf54h: turn off NRFS DVFS service" This reverts commit 59e68646df7213ce3e782f781fdb872cfdc42f7d. Signed-off-by: Jukka Rissanen --- soc/nordic/nrf54h/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/soc/nordic/nrf54h/Kconfig b/soc/nordic/nrf54h/Kconfig index e227a2999101..56b64f293baf 100644 --- a/soc/nordic/nrf54h/Kconfig +++ b/soc/nordic/nrf54h/Kconfig @@ -28,6 +28,7 @@ config SOC_NRF54H20_CPUAPP_COMMON select HAS_SEGGER_RTT if ZEPHYR_SEGGER_MODULE select NRFS_HAS_AUDIOPLL_SERVICE select NRFS_HAS_CLOCK_SERVICE + select NRFS_HAS_DVFS_SERVICE select NRFS_HAS_GDFS_SERVICE select NRFS_HAS_GDPWR_SERVICE select NRFS_HAS_MRAM_SERVICE From e36999f81ba9ef9589ab30902d8a268b0e7a2551 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:30 +0300 Subject: [PATCH 0916/2141] Revert "[nrf fromtree] drivers: clock control: ironside dvfs hsfll" This reverts commit f4f709d6ba80666656e87fb2428d23bac9cc3698. Signed-off-by: Jukka Rissanen --- drivers/clock_control/CMakeLists.txt | 1 - drivers/clock_control/Kconfig.nrf | 20 -- .../clock_control_nrf_iron_hsfll_local.c | 244 ------------------ .../clock/nordic,nrf-iron-hsfll-local.yaml | 59 ----- dts/vendor/nordic/nrf54h20.dtsi | 2 +- .../nrf_clock_control/src/main.c | 3 +- 6 files changed, 2 insertions(+), 327 deletions(-) delete mode 100644 drivers/clock_control/clock_control_nrf_iron_hsfll_local.c delete mode 100644 dts/bindings/clock/nordic,nrf-iron-hsfll-local.yaml diff --git a/drivers/clock_control/CMakeLists.txt b/drivers/clock_control/CMakeLists.txt index 59e7e3e30260..0bf5e0075ebf 100644 --- a/drivers/clock_control/CMakeLists.txt +++ b/drivers/clock_control/CMakeLists.txt @@ -53,7 +53,6 @@ zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF2_COMMON clock_cont zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF_FLL16M clock_control_nrf_fll16m.c) zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF54H_HFXO clock_control_nrf54h_hfxo.c) zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF_HSFLL_LOCAL clock_control_nrf_hsfll_local.c) -zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF_IRON_HSFLL_LOCAL clock_control_nrf_iron_hsfll_local.c) zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF_LFCLK clock_control_nrf_lfclk.c) zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF_AUXPLL clock_control_nrf_auxpll.c) zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_BOUFFALOLAB_BL60X clock_control_bl60x.c) diff --git a/drivers/clock_control/Kconfig.nrf b/drivers/clock_control/Kconfig.nrf index 53f03cf6bcdc..a7c1be10a126 100644 --- a/drivers/clock_control/Kconfig.nrf +++ b/drivers/clock_control/Kconfig.nrf @@ -282,26 +282,6 @@ config CLOCK_CONTROL_NRF_HSFLL_LOCAL_NRFS_DVFS_TIMEOUT_MS endif # CLOCK_CONTROL_NRF_HSFLL_LOCAL -config CLOCK_CONTROL_NRF_IRON_HSFLL_LOCAL - bool "NRF IronSide HSFLL LOCAL driver support" - depends on DT_HAS_NORDIC_NRF_IRON_HSFLL_LOCAL_ENABLED - select NRF_IRONSIDE_DVFS_SERVICE - select CLOCK_CONTROL_NRF2_COMMON - default y - -if CLOCK_CONTROL_NRF_IRON_HSFLL_LOCAL - -config CLOCK_CONTROL_NRF_IRON_HSFLL_LOCAL_REQ_LOW_FREQ - bool "Local domain scale down after init" - help - Request the lowest operating point after DVFS initialization. - -config CLOCK_CONTROL_NRF_IRON_HSFLL_LOCAL_DVFS_TIMEOUT_MS - int "Timeout waiting for dvfs request to complete" - default 2000 - -endif # CLOCK_CONTROL_NRF_IRON_HSFLL_LOCAL - config CLOCK_CONTROL_NRF_LFCLK bool "NRF LFCLK driver support" depends on DT_HAS_NORDIC_NRF_LFCLK_ENABLED diff --git a/drivers/clock_control/clock_control_nrf_iron_hsfll_local.c b/drivers/clock_control/clock_control_nrf_iron_hsfll_local.c deleted file mode 100644 index ba4e2a3f6bed..000000000000 --- a/drivers/clock_control/clock_control_nrf_iron_hsfll_local.c +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -#define DT_DRV_COMPAT nordic_nrf_iron_hsfll_local - -#include "clock_control_nrf2_common.h" -#include -#include - -#include -LOG_MODULE_DECLARE(clock_control_nrf2, CONFIG_CLOCK_CONTROL_LOG_LEVEL); - -BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) == 1, "multiple instances not supported"); - -#ifdef CONFIG_NRF_IRONSIDE_DVFS_SERVICE -#include - -#define HSFLL_FREQ_LOW MHZ(64) -#define HSFLL_FREQ_MEDLOW MHZ(128) -#define HSFLL_FREQ_HIGH MHZ(320) - -#define IRONSIDE_DVFS_TIMEOUT K_MSEC(CONFIG_CLOCK_CONTROL_NRF_IRON_HSFLL_LOCAL_DVFS_TIMEOUT_MS) - -/* Clock options sorted from lowest to highest frequency */ -static const struct clock_options { - uint32_t frequency; - enum ironside_dvfs_oppoint setting; -} clock_options[] = { - { - .frequency = HSFLL_FREQ_LOW, - .setting = IRONSIDE_DVFS_OPP_LOW, - }, - { - .frequency = HSFLL_FREQ_MEDLOW, - .setting = IRONSIDE_DVFS_OPP_MEDLOW, - }, - { - .frequency = HSFLL_FREQ_HIGH, - .setting = IRONSIDE_DVFS_OPP_HIGH, - }, -}; - -struct hsfll_dev_data { - STRUCT_CLOCK_CONFIG(hsfll, ARRAY_SIZE(clock_options)) clk_cfg; - struct k_timer timer; -}; - -static void hsfll_update_timeout_handler(struct k_timer *timer) -{ - struct hsfll_dev_data *dev_data = CONTAINER_OF(timer, struct hsfll_dev_data, timer); - - clock_config_update_end(&dev_data->clk_cfg, -ETIMEDOUT); -} - -static void hsfll_work_handler(struct k_work *work) -{ - struct hsfll_dev_data *dev_data = CONTAINER_OF(work, struct hsfll_dev_data, clk_cfg.work); - enum ironside_dvfs_oppoint required_setting; - uint8_t to_activate_idx; - int rc; - - to_activate_idx = clock_config_update_begin(work); - required_setting = clock_options[to_activate_idx].setting; - - k_timer_start(&dev_data->timer, IRONSIDE_DVFS_TIMEOUT, K_NO_WAIT); - - /* Request the DVFS service to change the OPP point. */ - rc = ironside_dvfs_change_oppoint(required_setting); - k_timer_stop(&dev_data->timer); - clock_config_update_end(&dev_data->clk_cfg, rc); -} - -static int hsfll_resolve_spec_to_idx(const struct nrf_clock_spec *req_spec) -{ - uint32_t req_frequency; - - if (req_spec->accuracy || req_spec->precision) { - LOG_ERR("invalid specification of accuracy or precision"); - return -EINVAL; - } - - req_frequency = req_spec->frequency == NRF_CLOCK_CONTROL_FREQUENCY_MAX - ? HSFLL_FREQ_HIGH - : req_spec->frequency; - - for (int i = 0; i < ARRAY_SIZE(clock_options); ++i) { - if (req_frequency > clock_options[i].frequency) { - continue; - } - - return i; - } - - LOG_ERR("invalid frequency"); - return -EINVAL; -} - -static void hsfll_get_spec_by_idx(uint8_t idx, struct nrf_clock_spec *spec) -{ - spec->frequency = clock_options[idx].frequency; - spec->accuracy = 0; - spec->precision = 0; -} - -static struct onoff_manager *hsfll_get_mgr_by_idx(const struct device *dev, uint8_t idx) -{ - struct hsfll_dev_data *dev_data = dev->data; - - return &dev_data->clk_cfg.onoff[idx].mgr; -} - -static struct onoff_manager *hsfll_find_mgr_by_spec(const struct device *dev, - const struct nrf_clock_spec *spec) -{ - int idx; - - if (!spec) { - return hsfll_get_mgr_by_idx(dev, 0); - } - - idx = hsfll_resolve_spec_to_idx(spec); - return idx < 0 ? NULL : hsfll_get_mgr_by_idx(dev, idx); -} -#endif /* CONFIG_NRF_IRONSIDE_DVFS_SERVICE */ - -static int api_request_hsfll(const struct device *dev, const struct nrf_clock_spec *spec, - struct onoff_client *cli) -{ -#ifdef CONFIG_NRF_IRONSIDE_DVFS_SERVICE - struct onoff_manager *mgr = hsfll_find_mgr_by_spec(dev, spec); - - if (mgr) { - return clock_config_request(mgr, cli); - } - - return -EINVAL; -#else - return -ENOTSUP; -#endif -} - -static int api_release_hsfll(const struct device *dev, const struct nrf_clock_spec *spec) -{ -#ifdef CONFIG_NRF_IRONSIDE_DVFS_SERVICE - struct onoff_manager *mgr = hsfll_find_mgr_by_spec(dev, spec); - - if (mgr) { - return onoff_release(mgr); - } - - return -EINVAL; -#else - return -ENOTSUP; -#endif -} - -static int api_cancel_or_release_hsfll(const struct device *dev, const struct nrf_clock_spec *spec, - struct onoff_client *cli) -{ -#ifdef CONFIG_NRF_IRONSIDE_DVFS_SERVICE - struct onoff_manager *mgr = hsfll_find_mgr_by_spec(dev, spec); - - if (mgr) { - return onoff_cancel_or_release(mgr, cli); - } - - return -EINVAL; -#else - return -ENOTSUP; -#endif -} - -static int api_resolve_hsfll(const struct device *dev, const struct nrf_clock_spec *req_spec, - struct nrf_clock_spec *res_spec) -{ -#ifdef CONFIG_NRF_IRONSIDE_DVFS_SERVICE - int idx; - - idx = hsfll_resolve_spec_to_idx(req_spec); - if (idx < 0) { - return -EINVAL; - } - - hsfll_get_spec_by_idx(idx, res_spec); - return 0; -#else - return -ENOTSUP; -#endif -} - -static int hsfll_init(const struct device *dev) -{ -#ifdef CONFIG_NRF_IRONSIDE_DVFS_SERVICE - struct hsfll_dev_data *dev_data = dev->data; - int rc; - - rc = clock_config_init(&dev_data->clk_cfg, ARRAY_SIZE(dev_data->clk_cfg.onoff), - hsfll_work_handler); - if (rc < 0) { - return rc; - } - - k_timer_init(&dev_data->timer, hsfll_update_timeout_handler, NULL); - -#endif - - return 0; -} - -static DEVICE_API(nrf_clock_control, hsfll_drv_api) = { - .std_api = { - .on = api_nosys_on_off, - .off = api_nosys_on_off, - }, - .request = api_request_hsfll, - .release = api_release_hsfll, - .cancel_or_release = api_cancel_or_release_hsfll, - .resolve = api_resolve_hsfll, -}; - -#ifdef CONFIG_NRF_IRONSIDE_DVFS_SERVICE -static struct hsfll_dev_data hsfll_data; -#endif - -#ifdef CONFIG_CLOCK_CONTROL_NRF_IRON_HSFLL_LOCAL_REQ_LOW_FREQ -static int dvfs_low_init(void) -{ - static const k_timeout_t timeout = IRONSIDE_DVFS_TIMEOUT; - static const struct device *hsfll_dev = DEVICE_DT_GET(DT_CLOCKS_CTLR(DT_NODELABEL(cpu))); - static const struct nrf_clock_spec clk_spec = {.frequency = HSFLL_FREQ_LOW}; - - return nrf_clock_control_request_sync(hsfll_dev, &clk_spec, timeout); -} - -SYS_INIT(dvfs_low_init, APPLICATION, 0); -#endif - -DEVICE_DT_INST_DEFINE(0, hsfll_init, NULL, - COND_CODE_1(CONFIG_NRF_IRONSIDE_DVFS_SERVICE, - (&hsfll_data), - (NULL)), NULL, PRE_KERNEL_1, - CONFIG_CLOCK_CONTROL_INIT_PRIORITY, &hsfll_drv_api); diff --git a/dts/bindings/clock/nordic,nrf-iron-hsfll-local.yaml b/dts/bindings/clock/nordic,nrf-iron-hsfll-local.yaml deleted file mode 100644 index 65769fb107f7..000000000000 --- a/dts/bindings/clock/nordic,nrf-iron-hsfll-local.yaml +++ /dev/null @@ -1,59 +0,0 @@ -# Copyright (c) 2025 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -description: | - Nordic nRF local HSFLL with IronSide DVFS support - - The local HSFLL mixed-mode IP generates several clock frequencies in the range - from 64 MHz to 400 MHz (in steps of 16 MHz). - - Usage example: - - hsfll: clock@deadbeef { - compatible = "nordic,nrf-hsfll-local"; - reg = <0xdeadbeef 0x1000>; - clocks = <&fll16m>; - clock-frequency = ; - nordic,ficrs = <&ficr NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_VSUP>, - <&ficr NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_COARSE_0>, - <&ficr NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_FINE_0>; - nordic,ficr-names = "vsup", "coarse", "fine"; - }; - - Required FICR entries are for VSUP, COARSE and FINE trim values. - -compatible: "nordic,nrf-iron-hsfll-local" - -include: [base.yaml, fixed-clock.yaml, nordic-nrf-ficr-client.yaml] - -properties: - reg: - required: true - - clocks: - required: true - - clock-frequency: - enum: - - 64000000 - - 80000000 - - 96000000 - - 112000000 - - 128000000 - - 144000000 - - 160000000 - - 176000000 - - 192000000 - - 208000000 - - 224000000 - - 240000000 - - 256000000 - - 272000000 - - 288000000 - - 304000000 - - 320000000 - - 336000000 - - 352000000 - - 368000000 - - 384000000 - - 400000000 diff --git a/dts/vendor/nordic/nrf54h20.dtsi b/dts/vendor/nordic/nrf54h20.dtsi index d06cbde97e02..68884b8a5672 100644 --- a/dts/vendor/nordic/nrf54h20.dtsi +++ b/dts/vendor/nordic/nrf54h20.dtsi @@ -268,7 +268,7 @@ ranges = <0x0 0x52000000 0x1000000>; cpuapp_hsfll: clock@d000 { - compatible = "nordic,nrf-iron-hsfll-local"; + compatible = "nordic,nrf-hsfll-local"; #clock-cells = <0>; reg = <0xd000 0x1000>; clocks = <&fll16m>; diff --git a/tests/drivers/clock_control/nrf_clock_control/src/main.c b/tests/drivers/clock_control/nrf_clock_control/src/main.c index 83fdc98ca193..395e6a0fc000 100644 --- a/tests/drivers/clock_control/nrf_clock_control/src/main.c +++ b/tests/drivers/clock_control/nrf_clock_control/src/main.c @@ -17,8 +17,7 @@ struct test_clk_context { size_t clk_specs_size; }; -#if defined(CONFIG_CLOCK_CONTROL_NRF_HSFLL_LOCAL) || \ - defined(CONFIG_CLOCK_CONTROL_NRF_IRON_HSFLL_LOCAL) +#if defined(CONFIG_CLOCK_CONTROL_NRF_HSFLL_LOCAL) const struct nrf_clock_spec test_clk_specs_hsfll[] = { { .frequency = MHZ(128), From 1c3048e974acb18b410231d4ed942b3b3c4d40d5 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:30 +0300 Subject: [PATCH 0917/2141] Revert "[nrf fromtree] dts: treewide: fix missing use of underscores" This reverts commit 78df52b6c28124714620ed8904a302232f20be7c. Signed-off-by: Jukka Rissanen --- boards/nxp/lpcxpresso55s28/lpcxpresso55s28.dts | 2 +- boards/nxp/lpcxpresso55s69/lpcxpresso55s69_lpc55s69_cpu0.dts | 2 +- boards/nxp/mimxrt1050_evk/mimxrt1050_evk.dtsi | 4 ++-- boards/nxp/mimxrt1060_evk/mimxrt1060_evk.dtsi | 4 ++-- dts/arm/silabs/siwg917.dtsi | 2 +- dts/bindings/display/solomon,ssd1309fb-spi.yaml | 2 +- dts/bindings/led/ti,lp50xx.yaml | 2 +- dts/bindings/pwm/silabs,siwx91x-pwm.yaml | 4 ++-- dts/bindings/usb/nxp,uhc-ehci.yaml | 2 +- dts/bindings/usb/nxp,uhc-ip3516hs.yaml | 2 +- dts/bindings/watchdog/nxp,ewm.yaml | 4 ++-- tests/drivers/pwm/pwm_api/boards/siwx917_rb4338a.overlay | 2 +- 12 files changed, 16 insertions(+), 16 deletions(-) diff --git a/boards/nxp/lpcxpresso55s28/lpcxpresso55s28.dts b/boards/nxp/lpcxpresso55s28/lpcxpresso55s28.dts index 7b6fa3e1fc3a..d9d46ed50ed1 100644 --- a/boards/nxp/lpcxpresso55s28/lpcxpresso55s28.dts +++ b/boards/nxp/lpcxpresso55s28/lpcxpresso55s28.dts @@ -138,7 +138,7 @@ zephyr_uhc1: &usbhhs { pinctrl-0 = <&pinmux_usbhhs>; pinctrl-names = "default"; status = "okay"; - phy-handle = <&usbphy1>; + phy_handle = <&usbphy1>; }; &usbphy1 { diff --git a/boards/nxp/lpcxpresso55s69/lpcxpresso55s69_lpc55s69_cpu0.dts b/boards/nxp/lpcxpresso55s69/lpcxpresso55s69_lpc55s69_cpu0.dts index 5049eec3f5f5..44caca0d3270 100644 --- a/boards/nxp/lpcxpresso55s69/lpcxpresso55s69_lpc55s69_cpu0.dts +++ b/boards/nxp/lpcxpresso55s69/lpcxpresso55s69_lpc55s69_cpu0.dts @@ -165,7 +165,7 @@ zephyr_uhc1: &usbhhs { pinctrl-0 = <&pinmux_usbhhs>; pinctrl-names = "default"; status = "okay"; - phy-handle = <&usbphy1>; + phy_handle = <&usbphy1>; }; &usbphy1 { diff --git a/boards/nxp/mimxrt1050_evk/mimxrt1050_evk.dtsi b/boards/nxp/mimxrt1050_evk/mimxrt1050_evk.dtsi index 15731d8bdcd5..0886b2ac912b 100644 --- a/boards/nxp/mimxrt1050_evk/mimxrt1050_evk.dtsi +++ b/boards/nxp/mimxrt1050_evk/mimxrt1050_evk.dtsi @@ -213,12 +213,12 @@ zephyr_udc0: &usb1 { zephyr_uhc0: &usbh1 { status = "okay"; - phy-handle = <&usbphy1>; + phy_handle = <&usbphy1>; }; zephyr_uhc1: &usbh2 { status = "okay"; - phy-handle = <&usbphy2>; + phy_handle = <&usbphy2>; }; &usbphy1 { diff --git a/boards/nxp/mimxrt1060_evk/mimxrt1060_evk.dtsi b/boards/nxp/mimxrt1060_evk/mimxrt1060_evk.dtsi index c81d10ea18ad..4143a7b6430f 100644 --- a/boards/nxp/mimxrt1060_evk/mimxrt1060_evk.dtsi +++ b/boards/nxp/mimxrt1060_evk/mimxrt1060_evk.dtsi @@ -190,12 +190,12 @@ zephyr_udc0: &usb1 { zephyr_uhc0: &usbh1 { status = "okay"; - phy-handle = <&usbphy1>; + phy_handle = <&usbphy1>; }; zephyr_uhc1: &usbh2 { status = "okay"; - phy-handle = <&usbphy2>; + phy_handle = <&usbphy2>; }; &usbphy1 { diff --git a/dts/arm/silabs/siwg917.dtsi b/dts/arm/silabs/siwg917.dtsi index c1b9c2ad995f..b1404f475b2d 100644 --- a/dts/arm/silabs/siwg917.dtsi +++ b/dts/arm/silabs/siwg917.dtsi @@ -307,7 +307,7 @@ interrupt-names = "pwm"; clocks = <&clock0 SIWX91X_CLK_PWM>; #pwm-cells = <2>; - silabs,ch-prescaler = <64 64 64 64>; + silabs,ch_prescaler = <64 64 64 64>; status = "disabled"; }; diff --git a/dts/bindings/display/solomon,ssd1309fb-spi.yaml b/dts/bindings/display/solomon,ssd1309fb-spi.yaml index 5d58bc732fd2..4a24a35d7cdc 100644 --- a/dts/bindings/display/solomon,ssd1309fb-spi.yaml +++ b/dts/bindings/display/solomon,ssd1309fb-spi.yaml @@ -8,7 +8,7 @@ compatible: "solomon,ssd1309fb" include: ["solomon,ssd1306fb-common.yaml", "spi-device.yaml"] properties: - data-cmd-gpios: + data_cmd-gpios: type: phandle-array required: true description: D/C# pin. diff --git a/dts/bindings/led/ti,lp50xx.yaml b/dts/bindings/led/ti,lp50xx.yaml index 1906d8f34170..91511dbd3039 100644 --- a/dts/bindings/led/ti,lp50xx.yaml +++ b/dts/bindings/led/ti,lp50xx.yaml @@ -12,7 +12,7 @@ properties: type: boolean description: | If enabled the maximum current output is set to 35 mA (25.5 mA else). - log-scale-en: + log_scale_en: type: boolean description: | If enabled a logarithmic dimming scale curve is used for LED brightness diff --git a/dts/bindings/pwm/silabs,siwx91x-pwm.yaml b/dts/bindings/pwm/silabs,siwx91x-pwm.yaml index daec68e9ed72..b8a01f2027b8 100644 --- a/dts/bindings/pwm/silabs,siwx91x-pwm.yaml +++ b/dts/bindings/pwm/silabs,siwx91x-pwm.yaml @@ -12,7 +12,7 @@ properties: "#pwm-cells": const: 2 - silabs,ch-prescaler: + silabs,ch_prescaler: type: array required: true description: | @@ -26,7 +26,7 @@ properties: - 32 - 64 - silabs,pwm-polarity: + silabs,pwm_polarity: type: int required: true description: | diff --git a/dts/bindings/usb/nxp,uhc-ehci.yaml b/dts/bindings/usb/nxp,uhc-ehci.yaml index 919625da151c..5f8657fe7227 100644 --- a/dts/bindings/usb/nxp,uhc-ehci.yaml +++ b/dts/bindings/usb/nxp,uhc-ehci.yaml @@ -8,5 +8,5 @@ compatible: "nxp,uhc-ehci" include: [usb-controller.yaml] properties: - phy-handle: + phy_handle: type: phandle diff --git a/dts/bindings/usb/nxp,uhc-ip3516hs.yaml b/dts/bindings/usb/nxp,uhc-ip3516hs.yaml index d9ebcae8abfc..d09b5b9f056d 100644 --- a/dts/bindings/usb/nxp,uhc-ip3516hs.yaml +++ b/dts/bindings/usb/nxp,uhc-ip3516hs.yaml @@ -8,5 +8,5 @@ compatible: "nxp,uhc-ip3516hs" include: [usb-controller.yaml, pinctrl-device.yaml] properties: - phy-handle: + phy_handle: type: phandle diff --git a/dts/bindings/watchdog/nxp,ewm.yaml b/dts/bindings/watchdog/nxp,ewm.yaml index 69ffdf86abcc..5bd1e6a36ebf 100644 --- a/dts/bindings/watchdog/nxp,ewm.yaml +++ b/dts/bindings/watchdog/nxp,ewm.yaml @@ -19,13 +19,13 @@ properties: description: Watchdog clock divider required: true - input-trigger-en: + input_trigger_en: type: boolean description: | When enabled the ewm_in signal can be used to assert the ewm. - input-trigger-active-high: + input_trigger_active_high: type: boolean description: | When enabled the ewm_in signal is active high. diff --git a/tests/drivers/pwm/pwm_api/boards/siwx917_rb4338a.overlay b/tests/drivers/pwm/pwm_api/boards/siwx917_rb4338a.overlay index 02f1c9da28de..91125d52963f 100644 --- a/tests/drivers/pwm/pwm_api/boards/siwx917_rb4338a.overlay +++ b/tests/drivers/pwm/pwm_api/boards/siwx917_rb4338a.overlay @@ -26,6 +26,6 @@ pwm_channel1: pwm_channel1 { pwms = <&pwm 0 1000000>; }; - silabs,pwm-polarity = ; + silabs,pwm_polarity = ; status = "okay"; }; From 332d3c513b543c6fb89653aaf8c002725847e4b2 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:30 +0300 Subject: [PATCH 0918/2141] Revert "[nrf fromtree] samples: subsys: usb: hid-keyboard: Confirm operation with console" This reverts commit c1bf4336ce6d3a1bf6007c06c9ed8142183e16d1. Signed-off-by: Jukka Rissanen --- samples/subsys/usb/hid-keyboard/sample.yaml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/samples/subsys/usb/hid-keyboard/sample.yaml b/samples/subsys/usb/hid-keyboard/sample.yaml index f53ae514f97c..6161ff90c2cf 100644 --- a/samples/subsys/usb/hid-keyboard/sample.yaml +++ b/samples/subsys/usb/hid-keyboard/sample.yaml @@ -1,17 +1,11 @@ sample: name: USB HID keyboard sample common: + harness: button filter: dt_alias_exists("sw0") and dt_alias_exists("led0") depends_on: - usbd - gpio - tags: usb - timeout: 15 - harness: console - harness_config: - type: one_line - regex: - - "HID keyboard sample is initialized" integration_platforms: - nrf52840dk/nrf52840 - nrf54h20dk/nrf54h20/cpuapp @@ -23,13 +17,17 @@ common: - samd21_xpro - same54_xpro tests: - sample.usbd.hid-keyboard: {} + sample.usbd.hid-keyboard: + tags: usb sample.usbd.hid-keyboard.out-report: + tags: usb extra_args: - EXTRA_DTC_OVERLAY_FILE="out_report.overlay" sample.usbd.hid-keyboard.large-report: + tags: usb extra_args: - EXTRA_DTC_OVERLAY_FILE="large_in_report.overlay" sample.usbd.hid-keyboard.large-out-report: + tags: usb extra_args: - EXTRA_DTC_OVERLAY_FILE="large_out_report.overlay" From 556cd877f638cdf8dee1a6c4ff308c94a43a02bb Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:31 +0300 Subject: [PATCH 0919/2141] Revert "[nrf fromtree] boards: nordic: nrf54lm20dk: Add usbd to supported features" This reverts commit 8cd3b935a445e21c0eafa76f438472460aaf706f. Signed-off-by: Jukka Rissanen --- boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp.yaml b/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp.yaml index e5a2b89087de..765845fa27f0 100644 --- a/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp.yaml +++ b/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp.yaml @@ -20,5 +20,4 @@ supported: - i2s - pwm - spi - - usbd - watchdog From a53b02e8e52acb6bdccd4ccc4470a179edbfaac8 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:31 +0300 Subject: [PATCH 0920/2141] Revert "[nrf fromtree] samples: usb: move the legacy code out of the USB MSC sample" This reverts commit 928f44c8941d281cb934f7db038e6592cca73411. Signed-off-by: Jukka Rissanen --- samples/subsys/usb/legacy/mass/CMakeLists.txt | 9 -- samples/subsys/usb/legacy/mass/README.rst | 32 ----- samples/subsys/usb/legacy/mass/app.overlay | 14 --- samples/subsys/usb/legacy/mass/prj.conf | 14 --- samples/subsys/usb/legacy/mass/sample.yaml | 10 -- samples/subsys/usb/legacy/mass/src/main.c | 27 ----- samples/subsys/usb/mass/README.rst | 2 +- samples/subsys/usb/mass/prj.conf | 21 ++-- samples/subsys/usb/mass/sample.yaml | 112 ++++++++++++++---- samples/subsys/usb/mass/src/main.c | 46 ++++--- samples/subsys/usb/mass/usbd_next_prj.conf | 15 +++ 11 files changed, 149 insertions(+), 153 deletions(-) delete mode 100644 samples/subsys/usb/legacy/mass/CMakeLists.txt delete mode 100644 samples/subsys/usb/legacy/mass/README.rst delete mode 100644 samples/subsys/usb/legacy/mass/app.overlay delete mode 100644 samples/subsys/usb/legacy/mass/prj.conf delete mode 100644 samples/subsys/usb/legacy/mass/sample.yaml delete mode 100644 samples/subsys/usb/legacy/mass/src/main.c create mode 100644 samples/subsys/usb/mass/usbd_next_prj.conf diff --git a/samples/subsys/usb/legacy/mass/CMakeLists.txt b/samples/subsys/usb/legacy/mass/CMakeLists.txt deleted file mode 100644 index f80c6eb9afa6..000000000000 --- a/samples/subsys/usb/legacy/mass/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -cmake_minimum_required(VERSION 3.20.0) -find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -project(mass) - -include(${ZEPHYR_BASE}/samples/subsys/usb/common/common.cmake) -FILE(GLOB app_sources src/*.c) -target_sources(app PRIVATE ${app_sources}) diff --git a/samples/subsys/usb/legacy/mass/README.rst b/samples/subsys/usb/legacy/mass/README.rst deleted file mode 100644 index 8e3ae5319df6..000000000000 --- a/samples/subsys/usb/legacy/mass/README.rst +++ /dev/null @@ -1,32 +0,0 @@ -.. zephyr:code-sample:: legacy-usb-mass - :name: Legacy USB Mass Storage - :relevant-api: _usb_device_core_api - - Expose board's RAM as a USB disk using USB Mass Storage driver. - -Overview -******** - -This sample app demonstrates use of a USB Mass Storage driver by the Zephyr -project. This very simple driver enumerates a board with RAM disk into an USB -disk. This sample can be found under -:zephyr_file:`samples/subsys/usb/legacy/mass` in the Zephyr project tree. - -.. note:: - This samples demonstrate deprecated :ref:`usb_device_stack`. - -Requirements -************ - -This project requires a USB device driver, and either 96KiB of RAM or a FLASH device. - -Building and Running -******************** - -The configurations selects RAM-based disk without any file system. - -.. zephyr-app-commands:: - :zephyr-app: samples/subsys/usb/legacy/mass - :board: reel_board - :goals: build - :compact: diff --git a/samples/subsys/usb/legacy/mass/app.overlay b/samples/subsys/usb/legacy/mass/app.overlay deleted file mode 100644 index ff09a0f8ca73..000000000000 --- a/samples/subsys/usb/legacy/mass/app.overlay +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - ramdisk0 { - compatible = "zephyr,ram-disk"; - disk-name = "RAM"; - sector-size = <512>; - sector-count = <192>; - }; -}; diff --git a/samples/subsys/usb/legacy/mass/prj.conf b/samples/subsys/usb/legacy/mass/prj.conf deleted file mode 100644 index 0954afcd0eec..000000000000 --- a/samples/subsys/usb/legacy/mass/prj.conf +++ /dev/null @@ -1,14 +0,0 @@ -CONFIG_STDOUT_CONSOLE=y - -#USB related configs -CONFIG_USB_DEVICE_STACK=y -CONFIG_USB_DEVICE_PRODUCT="Zephyr MSC sample" -CONFIG_USB_DEVICE_PID=0x0008 -CONFIG_LOG=y -CONFIG_USB_DRIVER_LOG_LEVEL_ERR=y -CONFIG_USB_MASS_STORAGE=y -CONFIG_USB_DEVICE_LOG_LEVEL_ERR=y -CONFIG_USB_MASS_STORAGE_LOG_LEVEL_ERR=y -CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=n - -CONFIG_MAIN_STACK_SIZE=1536 diff --git a/samples/subsys/usb/legacy/mass/sample.yaml b/samples/subsys/usb/legacy/mass/sample.yaml deleted file mode 100644 index f4d1bb2f96d9..000000000000 --- a/samples/subsys/usb/legacy/mass/sample.yaml +++ /dev/null @@ -1,10 +0,0 @@ -sample: - name: Mass Storage -tests: - sample.usb.legacy.mass_ram_none: - min_ram: 128 - depends_on: usb_device - build_only: true - arch_exclude: posix - tags: - - usb diff --git a/samples/subsys/usb/legacy/mass/src/main.c b/samples/subsys/usb/legacy/mass/src/main.c deleted file mode 100644 index 52dfa00294ef..000000000000 --- a/samples/subsys/usb/legacy/mass/src/main.c +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2016 Intel Corporation. - * Copyright (c) 2019-2020 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include - -#include -LOG_MODULE_REGISTER(main, LOG_LEVEL_INF); - -int main(void) -{ - int ret; - - ret = usb_enable(NULL); - if (ret != 0) { - LOG_ERR("Failed to enable USB"); - return 0; - } - - LOG_INF("The device is put in USB mass storage mode"); - - return 0; -} diff --git a/samples/subsys/usb/mass/README.rst b/samples/subsys/usb/mass/README.rst index 910c34e7c1ec..b68f57497b20 100644 --- a/samples/subsys/usb/mass/README.rst +++ b/samples/subsys/usb/mass/README.rst @@ -1,6 +1,6 @@ .. zephyr:code-sample:: usb-mass :name: USB Mass Storage - :relevant-api: usbd_api usbd_msc_device file_system_api + :relevant-api: usbd_api usbd_msc_device _usb_device_core_api file_system_api Expose board's RAM or FLASH as a USB disk using USB Mass Storage driver. diff --git a/samples/subsys/usb/mass/prj.conf b/samples/subsys/usb/mass/prj.conf index dd9d784070de..0954afcd0eec 100644 --- a/samples/subsys/usb/mass/prj.conf +++ b/samples/subsys/usb/mass/prj.conf @@ -1,15 +1,14 @@ -CONFIG_USB_DEVICE_STACK_NEXT=y - CONFIG_STDOUT_CONSOLE=y -CONFIG_SERIAL=y -CONFIG_UART_LINE_CTRL=y -CONFIG_USBD_MSC_CLASS=y -CONFIG_USBD_MSC_LUNS_PER_INSTANCE=3 +#USB related configs +CONFIG_USB_DEVICE_STACK=y +CONFIG_USB_DEVICE_PRODUCT="Zephyr MSC sample" +CONFIG_USB_DEVICE_PID=0x0008 CONFIG_LOG=y -CONFIG_USBD_LOG_LEVEL_WRN=y -CONFIG_UDC_DRIVER_LOG_LEVEL_WRN=y +CONFIG_USB_DRIVER_LOG_LEVEL_ERR=y +CONFIG_USB_MASS_STORAGE=y +CONFIG_USB_DEVICE_LOG_LEVEL_ERR=y +CONFIG_USB_MASS_STORAGE_LOG_LEVEL_ERR=y +CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=n -CONFIG_SAMPLE_USBD_PID=0x0008 -CONFIG_SAMPLE_USBD_PRODUCT="USBD MSC sample" -CONFIG_MAIN_STACK_SIZE=2048 +CONFIG_MAIN_STACK_SIZE=1536 diff --git a/samples/subsys/usb/mass/sample.yaml b/samples/subsys/usb/mass/sample.yaml index 9f3a169be609..4dbf2126798b 100644 --- a/samples/subsys/usb/mass/sample.yaml +++ b/samples/subsys/usb/mass/sample.yaml @@ -1,7 +1,25 @@ sample: name: Mass Storage tests: - sample.usbd.mass_ram_none: + sample.usb.mass_ram_none: + min_ram: 128 + depends_on: usb_device + arch_exclude: posix + extra_args: + - EXTRA_DTC_OVERLAY_FILE="ramdisk.overlay" + extra_configs: + - CONFIG_LOG_DEFAULT_LEVEL=3 + tags: + - msd + - usb + harness: console + harness_config: + type: multi_line + ordered: true + regex: + - "No file system selected" + - "The device is put in USB mass storage mode." + sample.usb_device_next.mass_ram_none: min_ram: 128 depends_on: usbd integration_platforms: @@ -14,8 +32,12 @@ tests: - mimxrt1060_evk/mimxrt1062/qspi - max32690evkit/max32690/m4 extra_args: + - CONF_FILE="usbd_next_prj.conf" - EXTRA_DTC_OVERLAY_FILE="ramdisk.overlay" + extra_configs: + - CONFIG_LOG_DEFAULT_LEVEL=3 tags: + - msd - usb harness: console harness_config: @@ -23,23 +45,43 @@ tests: ordered: true regex: - "No file system selected" - - "The device is put in USB mass storage mode" - sample.usbd.mass_ram_fat: + - "The device is put in USB mass storage mode." + sample.usb.mass_ram_fat: min_ram: 128 - depends_on: usbd - integration_platforms: - - nrf52840dk/nrf52840 - - nrf54h20dk/nrf54h20/cpuapp - - frdm_k64f - - stm32f723e_disco - - nucleo_f413zh - - mimxrt685_evk/mimxrt685s/cm33 - - mimxrt1060_evk/mimxrt1062/qspi + depends_on: usb_device + arch_exclude: posix extra_args: - EXTRA_DTC_OVERLAY_FILE="ramdisk.overlay" extra_configs: + - CONFIG_LOG_DEFAULT_LEVEL=3 - CONFIG_APP_MSC_STORAGE_RAM=y tags: + - msd + - usb + harness: console + harness_config: + type: multi_line + ordered: true + regex: + - "End of files" + - "The device is put in USB mass storage mode." + sample.usb.mass_flash_fatfs: + min_ram: 32 + modules: + - fatfs + depends_on: usb_device + filter: dt_compat_enabled("nordic,qspi-nor") + platform_allow: + - nrf52840dk/nrf52840 + - nrf5340dk/nrf5340/cpuapp + - adafruit_feather_nrf52840/nrf52840/sense + integration_platforms: + - nrf52840dk/nrf52840 + extra_configs: + - CONFIG_LOG_DEFAULT_LEVEL=3 + - CONFIG_APP_MSC_STORAGE_FLASH_FATFS=y + tags: + - msd - usb harness: console harness_config: @@ -47,8 +89,8 @@ tests: ordered: true regex: - "End of files" - - "The device is put in USB mass storage mode" - sample.usbd.mass_flash_fatfs: + - "The device is put in USB mass storage mode." + sample.usb_device_next.mass_flash_fatfs: min_ram: 32 modules: - fatfs @@ -60,18 +102,43 @@ tests: - adafruit_feather_nrf52840/nrf52840/sense integration_platforms: - nrf52840dk/nrf52840 + extra_args: CONF_FILE="usbd_next_prj.conf" extra_configs: + - CONFIG_LOG_DEFAULT_LEVEL=3 - CONFIG_APP_MSC_STORAGE_FLASH_FATFS=y tags: + - msd + - usb + harness: console + harness_config: + type: multi_line + ordered: true + regex: + - "End of files" + - "The device is put in USB mass storage mode." + sample.usb.mass_sdhc_fatfs: + min_ram: 32 + filter: dt_compat_enabled("zephyr,sdmmc-disk") + modules: + - fatfs + depends_on: + - usb_device + - sdhc + extra_configs: + - CONFIG_LOG_DEFAULT_LEVEL=3 + - CONFIG_APP_MSC_STORAGE_SDCARD=y + tags: + - msd - usb harness: console harness_config: + fixture: fixture_sdcard type: multi_line ordered: true regex: - "End of files" - - "The device is put in USB mass storage mode" - sample.usbd.mass_sdhc_fatfs: + - "The device is put in USB mass storage mode." + sample.usb_device_next.mass_sdhc_fatfs: min_ram: 32 filter: dt_compat_enabled("zephyr,sdmmc-disk") modules: @@ -80,8 +147,11 @@ tests: - usbd - sdhc extra_configs: + - CONFIG_LOG_DEFAULT_LEVEL=3 - CONFIG_APP_MSC_STORAGE_SDCARD=y + extra_args: CONF_FILE="usbd_next_prj.conf" tags: + - msd - usb harness: console harness_config: @@ -90,12 +160,12 @@ tests: ordered: true regex: - "End of files" - - "The device is put in USB mass storage mode" - sample.usbd.mass_flash_littlefs: + - "The device is put in USB mass storage mode." + sample.usb.mass_flash_littlefs: modules: - littlefs min_ram: 32 - depends_on: usbd + depends_on: usb_device filter: dt_compat_enabled("nordic,qspi-nor") platform_allow: - nrf52840dk/nrf52840 @@ -104,8 +174,10 @@ tests: integration_platforms: - nrf52840dk/nrf52840 extra_configs: + - CONFIG_LOG_DEFAULT_LEVEL=3 - CONFIG_APP_MSC_STORAGE_FLASH_LITTLEFS=y tags: + - msd - usb harness: console harness_config: @@ -113,4 +185,4 @@ tests: ordered: true regex: - "End of files" - - "The device is put in USB mass storage mode" + - "The device is put in USB mass storage mode." diff --git a/samples/subsys/usb/mass/src/main.c b/samples/subsys/usb/mass/src/main.c index 59a770a51545..df90560d8353 100644 --- a/samples/subsys/usb/mass/src/main.c +++ b/samples/subsys/usb/mass/src/main.c @@ -9,12 +9,13 @@ #include #include +#include #include #include #include #include -LOG_MODULE_REGISTER(main, LOG_LEVEL_INF); +LOG_MODULE_REGISTER(main); #if CONFIG_DISK_DRIVER_FLASH #include @@ -40,6 +41,7 @@ FS_LITTLEFS_DECLARE_DEFAULT_CONFIG(storage); static struct fs_mount_t fs_mnt; +#if defined(CONFIG_USB_DEVICE_STACK_NEXT) static struct usbd_context *sample_usbd; #if CONFIG_DISK_DRIVER_RAM @@ -54,6 +56,28 @@ USBD_DEFINE_MSC_LUN(nand, "NAND", "Zephyr", "FlashDisk", "0.00"); USBD_DEFINE_MSC_LUN(sd, "SD", "Zephyr", "SD", "0.00"); #endif +static int enable_usb_device_next(void) +{ + int err; + + sample_usbd = sample_usbd_init_device(NULL); + if (sample_usbd == NULL) { + LOG_ERR("Failed to initialize USB device"); + return -ENODEV; + } + + err = usbd_enable(sample_usbd); + if (err) { + LOG_ERR("Failed to enable device support"); + return err; + } + + LOG_DBG("USB device support enabled"); + + return 0; +} +#endif /* defined(CONFIG_USB_DEVICE_STACK_NEXT) */ + static int setup_flash(struct fs_mount_t *mnt) { int rc = 0; @@ -191,24 +215,16 @@ int main(void) setup_disk(); - sample_usbd = sample_usbd_init_device(NULL); - if (sample_usbd == NULL) { - LOG_ERR("Failed to initialize USB device"); - return -ENODEV; - } - - ret = usbd_enable(sample_usbd); - if (ret) { - LOG_ERR("Failed to enable device support"); - return ret; - } - +#if defined(CONFIG_USB_DEVICE_STACK_NEXT) + ret = enable_usb_device_next(); +#else + ret = usb_enable(NULL); +#endif if (ret != 0) { LOG_ERR("Failed to enable USB"); return 0; } - LOG_INF("The device is put in USB mass storage mode"); - + LOG_INF("The device is put in USB mass storage mode.\n"); return 0; } diff --git a/samples/subsys/usb/mass/usbd_next_prj.conf b/samples/subsys/usb/mass/usbd_next_prj.conf new file mode 100644 index 000000000000..dd9d784070de --- /dev/null +++ b/samples/subsys/usb/mass/usbd_next_prj.conf @@ -0,0 +1,15 @@ +CONFIG_USB_DEVICE_STACK_NEXT=y + +CONFIG_STDOUT_CONSOLE=y +CONFIG_SERIAL=y +CONFIG_UART_LINE_CTRL=y +CONFIG_USBD_MSC_CLASS=y +CONFIG_USBD_MSC_LUNS_PER_INSTANCE=3 + +CONFIG_LOG=y +CONFIG_USBD_LOG_LEVEL_WRN=y +CONFIG_UDC_DRIVER_LOG_LEVEL_WRN=y + +CONFIG_SAMPLE_USBD_PID=0x0008 +CONFIG_SAMPLE_USBD_PRODUCT="USBD MSC sample" +CONFIG_MAIN_STACK_SIZE=2048 From 8ca20fbd046171faa408cdff5e4ad84fec8c386c Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:31 +0300 Subject: [PATCH 0921/2141] Revert "[nrf fromtree] samples: subsys: usb: mass: Include rpi_pico.overlay" This reverts commit 758c8491095e71ff20ffe5c3b3b5dc6bc5a48410. Signed-off-by: Jukka Rissanen --- samples/subsys/usb/mass/boards/rpi_pico_rp2040_w.overlay | 1 - 1 file changed, 1 deletion(-) delete mode 100644 samples/subsys/usb/mass/boards/rpi_pico_rp2040_w.overlay diff --git a/samples/subsys/usb/mass/boards/rpi_pico_rp2040_w.overlay b/samples/subsys/usb/mass/boards/rpi_pico_rp2040_w.overlay deleted file mode 100644 index 759ce77a4f83..000000000000 --- a/samples/subsys/usb/mass/boards/rpi_pico_rp2040_w.overlay +++ /dev/null @@ -1 +0,0 @@ -#include "rpi_pico.overlay" From 339f8aa7e83e95dd847bc215edb9143bf33682aa Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:31 +0300 Subject: [PATCH 0922/2141] Revert "[nrf fromtree] samples: usb: move the legacy code out of the HID mouse sample" This reverts commit 82e0bf157cf68480d2b1f402e709063ed588dd52. Signed-off-by: Jukka Rissanen --- samples/subsys/usb/hid-mouse/README.rst | 2 +- samples/subsys/usb/hid-mouse/prj.conf | 14 +- samples/subsys/usb/hid-mouse/sample.yaml | 9 + samples/subsys/usb/hid-mouse/src/main.c | 120 +++++++------ .../{app.overlay => usbd_next.overlay} | 0 .../subsys/usb/hid-mouse/usbd_next_prj.conf | 11 ++ .../usb/legacy/hid-mouse/CMakeLists.txt | 9 - .../subsys/usb/legacy/hid-mouse/README.rst | 114 ------------- samples/subsys/usb/legacy/hid-mouse/prj.conf | 13 -- .../subsys/usb/legacy/hid-mouse/sample.yaml | 15 -- .../subsys/usb/legacy/hid-mouse/src/main.c | 158 ------------------ 11 files changed, 101 insertions(+), 364 deletions(-) rename samples/subsys/usb/hid-mouse/{app.overlay => usbd_next.overlay} (100%) create mode 100644 samples/subsys/usb/hid-mouse/usbd_next_prj.conf delete mode 100644 samples/subsys/usb/legacy/hid-mouse/CMakeLists.txt delete mode 100644 samples/subsys/usb/legacy/hid-mouse/README.rst delete mode 100644 samples/subsys/usb/legacy/hid-mouse/prj.conf delete mode 100644 samples/subsys/usb/legacy/hid-mouse/sample.yaml delete mode 100644 samples/subsys/usb/legacy/hid-mouse/src/main.c diff --git a/samples/subsys/usb/hid-mouse/README.rst b/samples/subsys/usb/hid-mouse/README.rst index 0c1d908f05b8..e2f099f98f44 100644 --- a/samples/subsys/usb/hid-mouse/README.rst +++ b/samples/subsys/usb/hid-mouse/README.rst @@ -1,6 +1,6 @@ .. zephyr:code-sample:: usb-hid-mouse :name: USB HID mouse - :relevant-api: usbd_api usbd_hid_device input_interface + :relevant-api: _usb_device_core_api usb_hid_device_api input_interface Implement a basic HID mouse device. diff --git a/samples/subsys/usb/hid-mouse/prj.conf b/samples/subsys/usb/hid-mouse/prj.conf index 9c8894b2126c..b797a7382e81 100644 --- a/samples/subsys/usb/hid-mouse/prj.conf +++ b/samples/subsys/usb/hid-mouse/prj.conf @@ -1,11 +1,13 @@ -CONFIG_USB_DEVICE_STACK_NEXT=y -CONFIG_USBD_HID_SUPPORT=y +CONFIG_USB_DEVICE_STACK=y +CONFIG_USB_DEVICE_HID=y +CONFIG_USB_DEVICE_PRODUCT="Zephyr HID mouse sample" +CONFIG_USB_DEVICE_PID=0x0007 +CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=n CONFIG_LOG=y -CONFIG_USBD_LOG_LEVEL_WRN=y -CONFIG_USBD_HID_LOG_LEVEL_WRN=y -CONFIG_UDC_DRIVER_LOG_LEVEL_WRN=y -CONFIG_SAMPLE_USBD_PID=0x0007 +CONFIG_USB_DRIVER_LOG_LEVEL_ERR=y +CONFIG_USB_DEVICE_LOG_LEVEL_ERR=y CONFIG_GPIO=y CONFIG_INPUT=y +CONFIG_INPUT_MODE_SYNCHRONOUS=y diff --git a/samples/subsys/usb/hid-mouse/sample.yaml b/samples/subsys/usb/hid-mouse/sample.yaml index 0a9e1af37f0f..132c71c928b6 100644 --- a/samples/subsys/usb/hid-mouse/sample.yaml +++ b/samples/subsys/usb/hid-mouse/sample.yaml @@ -6,6 +6,12 @@ common: depends_on: - gpio tests: + sample.usb.hid-mouse: + depends_on: + - usb_device + platform_exclude: + - frdm_mcxn947/mcxn947/cpu0 + tags: usb sample.usb_device_next.hid-mouse: depends_on: - usbd @@ -17,4 +23,7 @@ tests: - nucleo_f413zh - mimxrt1060_evk/mimxrt1062/qspi - max32690evkit/max32690/m4 + extra_args: + - CONF_FILE="usbd_next_prj.conf" + - EXTRA_DTC_OVERLAY_FILE="usbd_next.overlay" tags: usb diff --git a/samples/subsys/usb/hid-mouse/src/main.c b/samples/subsys/usb/hid-mouse/src/main.c index 967591b2a711..4e579832cf9d 100644 --- a/samples/subsys/usb/hid-mouse/src/main.c +++ b/samples/subsys/usb/hid-mouse/src/main.c @@ -15,14 +15,16 @@ #include #include +#include #include -#include +#include #include LOG_MODULE_REGISTER(main, LOG_LEVEL_INF); static const struct gpio_dt_spec led0 = GPIO_DT_SPEC_GET(DT_ALIAS(led0), gpios); static const uint8_t hid_report_desc[] = HID_MOUSE_REPORT_DESC(2); +static enum usb_dc_status_code usb_status; #define MOUSE_BTN_LEFT 0 #define MOUSE_BTN_RIGHT 1 @@ -36,7 +38,22 @@ enum mouse_report_idx { }; K_MSGQ_DEFINE(mouse_msgq, MOUSE_REPORT_COUNT, 2, 1); -static bool mouse_ready; +static K_SEM_DEFINE(ep_write_sem, 0, 1); + +static inline void status_cb(enum usb_dc_status_code status, const uint8_t *param) +{ + usb_status = status; +} + +static ALWAYS_INLINE void rwup_if_suspended(void) +{ + if (IS_ENABLED(CONFIG_USB_DEVICE_REMOTE_WAKEUP)) { + if (usb_status == USB_DC_SUSPEND) { + usb_wakeup_request(); + return; + } + } +} static void input_cb(struct input_event *evt, void *user_data) { @@ -46,9 +63,11 @@ static void input_cb(struct input_event *evt, void *user_data) switch (evt->code) { case INPUT_KEY_0: + rwup_if_suspended(); WRITE_BIT(tmp[MOUSE_BTN_REPORT_IDX], MOUSE_BTN_LEFT, evt->value); break; case INPUT_KEY_1: + rwup_if_suspended(); WRITE_BIT(tmp[MOUSE_BTN_REPORT_IDX], MOUSE_BTN_RIGHT, evt->value); break; case INPUT_KEY_2: @@ -80,30 +99,42 @@ static void input_cb(struct input_event *evt, void *user_data) INPUT_CALLBACK_DEFINE(NULL, input_cb, NULL); -static void mouse_iface_ready(const struct device *dev, const bool ready) +#if defined(CONFIG_USB_DEVICE_STACK_NEXT) +static int enable_usb_device_next(void) { - LOG_INF("HID device %s interface is %s", - dev->name, ready ? "ready" : "not ready"); - mouse_ready = ready; -} + struct usbd_context *sample_usbd; + int err; -static int mouse_get_report(const struct device *dev, - const uint8_t type, const uint8_t id, const uint16_t len, - uint8_t *const buf) -{ - LOG_WRN("Get Report not implemented, Type %u ID %u", type, id); + sample_usbd = sample_usbd_init_device(NULL); + if (sample_usbd == NULL) { + LOG_ERR("Failed to initialize USB device"); + return -ENODEV; + } + + err = usbd_enable(sample_usbd); + if (err) { + LOG_ERR("Failed to enable device support"); + return err; + } + + LOG_DBG("USB device support enabled"); return 0; } +#endif /* defined(CONFIG_USB_DEVICE_STACK_NEXT) */ + +static void int_in_ready_cb(const struct device *dev) +{ + ARG_UNUSED(dev); + k_sem_give(&ep_write_sem); +} -struct hid_device_ops mouse_ops = { - .iface_ready = mouse_iface_ready, - .get_report = mouse_get_report, +static const struct hid_ops ops = { + .int_in_ready = int_in_ready_cb, }; int main(void) { - struct usbd_context *sample_usbd; const struct device *hid_dev; int ret; @@ -112,58 +143,51 @@ int main(void) return 0; } +#if defined(CONFIG_USB_DEVICE_STACK_NEXT) + hid_dev = DEVICE_DT_GET_ONE(zephyr_hid_device); +#else + hid_dev = device_get_binding("HID_0"); +#endif + if (hid_dev == NULL) { + LOG_ERR("Cannot get USB HID Device"); + return 0; + } + ret = gpio_pin_configure_dt(&led0, GPIO_OUTPUT); - if (ret != 0) { + if (ret < 0) { LOG_ERR("Failed to configure the LED pin, error: %d", ret); return 0; } - hid_dev = DEVICE_DT_GET_ONE(zephyr_hid_device); - if (!device_is_ready(hid_dev)) { - LOG_ERR("HID Device is not ready"); - return -EIO; - } + usb_hid_register_device(hid_dev, + hid_report_desc, sizeof(hid_report_desc), + &ops); - ret = hid_device_register(hid_dev, - hid_report_desc, sizeof(hid_report_desc), - &mouse_ops); - if (ret != 0) { - LOG_ERR("Failed to register HID Device, %d", ret); - return ret; - } + usb_hid_init(hid_dev); - sample_usbd = sample_usbd_init_device(NULL); - if (sample_usbd == NULL) { - LOG_ERR("Failed to initialize USB device"); - return -ENODEV; - } - - ret = usbd_enable(sample_usbd); +#if defined(CONFIG_USB_DEVICE_STACK_NEXT) + ret = enable_usb_device_next(); +#else + ret = usb_enable(status_cb); +#endif if (ret != 0) { - LOG_ERR("Failed to enable device support"); - return ret; + LOG_ERR("Failed to enable USB"); + return 0; } - LOG_DBG("USB device support enabled"); - while (true) { UDC_STATIC_BUF_DEFINE(report, MOUSE_REPORT_COUNT); k_msgq_get(&mouse_msgq, &report, K_FOREVER); - if (!mouse_ready) { - LOG_INF("USB HID device is not ready"); - continue; - } - - ret = hid_device_submit_report(hid_dev, MOUSE_REPORT_COUNT, report); + ret = hid_int_ep_write(hid_dev, report, MOUSE_REPORT_COUNT, NULL); if (ret) { - LOG_ERR("HID submit report error, %d", ret); + LOG_ERR("HID write error, %d", ret); } else { + k_sem_take(&ep_write_sem, K_FOREVER); /* Toggle LED on sent report */ (void)gpio_pin_toggle(led0.port, led0.pin); } } - return 0; } diff --git a/samples/subsys/usb/hid-mouse/app.overlay b/samples/subsys/usb/hid-mouse/usbd_next.overlay similarity index 100% rename from samples/subsys/usb/hid-mouse/app.overlay rename to samples/subsys/usb/hid-mouse/usbd_next.overlay diff --git a/samples/subsys/usb/hid-mouse/usbd_next_prj.conf b/samples/subsys/usb/hid-mouse/usbd_next_prj.conf new file mode 100644 index 000000000000..9c8894b2126c --- /dev/null +++ b/samples/subsys/usb/hid-mouse/usbd_next_prj.conf @@ -0,0 +1,11 @@ +CONFIG_USB_DEVICE_STACK_NEXT=y +CONFIG_USBD_HID_SUPPORT=y + +CONFIG_LOG=y +CONFIG_USBD_LOG_LEVEL_WRN=y +CONFIG_USBD_HID_LOG_LEVEL_WRN=y +CONFIG_UDC_DRIVER_LOG_LEVEL_WRN=y +CONFIG_SAMPLE_USBD_PID=0x0007 + +CONFIG_GPIO=y +CONFIG_INPUT=y diff --git a/samples/subsys/usb/legacy/hid-mouse/CMakeLists.txt b/samples/subsys/usb/legacy/hid-mouse/CMakeLists.txt deleted file mode 100644 index d2217c00a472..000000000000 --- a/samples/subsys/usb/legacy/hid-mouse/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -cmake_minimum_required(VERSION 3.20.0) -find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -project(hid-mouse) - -include(${ZEPHYR_BASE}/samples/subsys/usb/common/common.cmake) -FILE(GLOB app_sources src/*.c) -target_sources(app PRIVATE ${app_sources}) diff --git a/samples/subsys/usb/legacy/hid-mouse/README.rst b/samples/subsys/usb/legacy/hid-mouse/README.rst deleted file mode 100644 index aa82e23804a1..000000000000 --- a/samples/subsys/usb/legacy/hid-mouse/README.rst +++ /dev/null @@ -1,114 +0,0 @@ -.. zephyr:code-sample:: legacy-usb-hid-mouse - :name: Legacy USB HID mouse - :relevant-api: _usb_device_core_api usb_hid_device_api input_interface - - Implement a basic HID mouse device. - -Overview -******** - -This sample app demonstrates use of a USB Human Interface Device (HID) driver -by the Zephyr project. This very simple driver enumerates a board with a button -into a mouse that has a left mouse button and optionally (depending on -the number of buttons on the board) a right mouse button, X-axis movement, -and Y-axis movement. -If the USB peripheral driver supports remote wakeup feature, wakeup request -will be performed on every button click if the bus is in suspended state. -This sample can be found under :zephyr_file:`samples/subsys/usb/legacy/hid-mouse` in the -Zephyr project tree. - -.. note:: - This samples demonstrate deprecated :ref:`usb_device_stack`. - -Requirements -************ - -This project requires an USB device driver and uses the :ref:`input` API. -There must be a :dtcompatible:`gpio-keys` group of buttons or keys defined at -the board level that can generate input events, otherwise the example will build -but not work as expected. - -The key mapping in the sample is as follows: - -- ``INPUT_KEY_0``: left button -- ``INPUT_KEY_1``: right button -- ``INPUT_KEY_2``: move the mouse along the x-axis -- ``INPUT_KEY_3``: move the mouse along the y-axis - -An LED must also be configured via the ``led0`` devicetree alias. You may also -see this error if you try to build this sample for an unsupported board: - -.. code-block:: none - - Unsupported board: led0 devicetree alias is not defined - -Building and Running -******************** - -This sample can be built for multiple boards, in this example we will build it -for the nucleo_f070rb board: - -.. zephyr-app-commands:: - :zephyr-app: samples/subsys/usb/legacy/hid-mouse - :board: nucleo_f070rb - :goals: build - :compact: - -After you have built and flashed the sample app image to your board, plug the -board into a host device, for example, a PC running Linux. -The board will be detected as shown by the Linux dmesg command: - -.. code-block:: console - - dmesg | tail -10 - usb 2-2: new full-speed USB device number 2 using at91_ohci - usb 2-2: New USB device found, idVendor=2fe3, idProduct=0007, bcdDevice= 2.03 - usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3 - usb 2-2: Product: Zephyr HID mouse sample - usb 2-2: Manufacturer: ZEPHYR - usb 2-2: SerialNumber: 86FE679A598AC47A - input: ZEPHYR Zephyr HID mouse sample as /devices/soc0/ahb/600000.ohci/usb2/2-2/2-2:1.0/0003:2FE3:0100.0001/input/input0 - hid-generic 0003:2FE3:0100.0001: input: USB HID v1.10 Mouse [ZEPHYR Zephyr HID mouse sample] on usb-at91-2/input0 - -You can also monitor mouse events by using the standard Linux ``evtest`` command -(see the `Ubuntu evtest man page`_ for more information about this tool): - -.. _Ubuntu evtest man page: - http://manpages.ubuntu.com/manpages/trusty/man1/evtest.1.html - -.. code-block:: console - - sudo evtest /dev/input/event0 - Input driver version is 1.0.1 - Input device ID: bus 0x3 vendor 0x2fe3 product 0x7 version 0x110 - Input device name: "ZEPHYR Zephyr HID mouse sample" - Supported events: - Event type 0 (EV_SYN) - Event type 1 (EV_KEY) - Event code 272 (BTN_LEFT) - Event code 273 (BTN_RIGHT) - Event code 274 (BTN_MIDDLE) - Event type 2 (EV_REL) - Event code 0 (REL_X) - Event code 1 (REL_Y) - Event code 8 (REL_WHEEL) - Event type 4 (EV_MSC) - Event code 4 (MSC_SCAN) - Properties: - Testing ... (interrupt to exit) - -When you press the button on your board, it will act as if the left -mouse button was pressed, and this information will be displayed -by ``evtest``: - -.. code-block:: console - - Event: time 1167609663.618515, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90001 - Event: time 1167609663.618515, type 1 (EV_KEY), code 272 (BTN_LEFT), value 1 - Event: time 1167609663.618515, -------------- SYN_REPORT ------------ - Event: time 1167609663.730510, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90001 - Event: time 1167609663.730510, type 1 (EV_KEY), code 272 (BTN_LEFT), value 0 - Event: time 1167609663.730510, -------------- SYN_REPORT ------------ - -If your board has more than one button, they will act as right mouse button, -X-axis movement, and Y-axis movement. diff --git a/samples/subsys/usb/legacy/hid-mouse/prj.conf b/samples/subsys/usb/legacy/hid-mouse/prj.conf deleted file mode 100644 index b797a7382e81..000000000000 --- a/samples/subsys/usb/legacy/hid-mouse/prj.conf +++ /dev/null @@ -1,13 +0,0 @@ -CONFIG_USB_DEVICE_STACK=y -CONFIG_USB_DEVICE_HID=y -CONFIG_USB_DEVICE_PRODUCT="Zephyr HID mouse sample" -CONFIG_USB_DEVICE_PID=0x0007 -CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=n - -CONFIG_LOG=y -CONFIG_USB_DRIVER_LOG_LEVEL_ERR=y -CONFIG_USB_DEVICE_LOG_LEVEL_ERR=y - -CONFIG_GPIO=y -CONFIG_INPUT=y -CONFIG_INPUT_MODE_SYNCHRONOUS=y diff --git a/samples/subsys/usb/legacy/hid-mouse/sample.yaml b/samples/subsys/usb/legacy/hid-mouse/sample.yaml deleted file mode 100644 index 4dc2da907988..000000000000 --- a/samples/subsys/usb/legacy/hid-mouse/sample.yaml +++ /dev/null @@ -1,15 +0,0 @@ -sample: - name: USB HID mouse sample -common: - harness: button - filter: dt_alias_exists("sw0") and dt_alias_exists("led0") - depends_on: - - gpio -tests: - sample.usb.legacy.hid-mouse: - depends_on: - - usb_device - build_only: true - platform_exclude: - - frdm_mcxn947/mcxn947/cpu0 - tags: usb diff --git a/samples/subsys/usb/legacy/hid-mouse/src/main.c b/samples/subsys/usb/legacy/hid-mouse/src/main.c deleted file mode 100644 index e668ce64758a..000000000000 --- a/samples/subsys/usb/legacy/hid-mouse/src/main.c +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright (c) 2018 qianfan Zhao - * Copyright (c) 2018, 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include - -#include -#include -#include -#include -#include - -#include -#include - -#include -LOG_MODULE_REGISTER(main, LOG_LEVEL_INF); - -static const struct gpio_dt_spec led0 = GPIO_DT_SPEC_GET(DT_ALIAS(led0), gpios); -static const uint8_t hid_report_desc[] = HID_MOUSE_REPORT_DESC(2); -static enum usb_dc_status_code usb_status; - -#define MOUSE_BTN_LEFT 0 -#define MOUSE_BTN_RIGHT 1 - -enum mouse_report_idx { - MOUSE_BTN_REPORT_IDX = 0, - MOUSE_X_REPORT_IDX = 1, - MOUSE_Y_REPORT_IDX = 2, - MOUSE_WHEEL_REPORT_IDX = 3, - MOUSE_REPORT_COUNT = 4, -}; - -K_MSGQ_DEFINE(mouse_msgq, MOUSE_REPORT_COUNT, 2, 1); -static K_SEM_DEFINE(ep_write_sem, 0, 1); - -static inline void status_cb(enum usb_dc_status_code status, const uint8_t *param) -{ - usb_status = status; -} - -static ALWAYS_INLINE void rwup_if_suspended(void) -{ - if (IS_ENABLED(CONFIG_USB_DEVICE_REMOTE_WAKEUP)) { - if (usb_status == USB_DC_SUSPEND) { - usb_wakeup_request(); - return; - } - } -} - -static void input_cb(struct input_event *evt, void *user_data) -{ - static uint8_t tmp[MOUSE_REPORT_COUNT]; - - ARG_UNUSED(user_data); - - switch (evt->code) { - case INPUT_KEY_0: - rwup_if_suspended(); - WRITE_BIT(tmp[MOUSE_BTN_REPORT_IDX], MOUSE_BTN_LEFT, evt->value); - break; - case INPUT_KEY_1: - rwup_if_suspended(); - WRITE_BIT(tmp[MOUSE_BTN_REPORT_IDX], MOUSE_BTN_RIGHT, evt->value); - break; - case INPUT_KEY_2: - if (evt->value) { - tmp[MOUSE_X_REPORT_IDX] += 10U; - } - - break; - case INPUT_KEY_3: - if (evt->value) { - tmp[MOUSE_Y_REPORT_IDX] += 10U; - } - - break; - default: - LOG_INF("Unrecognized input code %u value %d", - evt->code, evt->value); - return; - } - - if (k_msgq_put(&mouse_msgq, tmp, K_NO_WAIT) != 0) { - LOG_ERR("Failed to put new input event"); - } - - tmp[MOUSE_X_REPORT_IDX] = 0U; - tmp[MOUSE_Y_REPORT_IDX] = 0U; - -} - -INPUT_CALLBACK_DEFINE(NULL, input_cb, NULL); - -static void int_in_ready_cb(const struct device *dev) -{ - ARG_UNUSED(dev); - k_sem_give(&ep_write_sem); -} - -static const struct hid_ops ops = { - .int_in_ready = int_in_ready_cb, -}; - -int main(void) -{ - const struct device *hid_dev; - int ret; - - if (!gpio_is_ready_dt(&led0)) { - LOG_ERR("LED device %s is not ready", led0.port->name); - return 0; - } - - hid_dev = device_get_binding("HID_0"); - if (hid_dev == NULL) { - LOG_ERR("Cannot get USB HID Device"); - return 0; - } - - ret = gpio_pin_configure_dt(&led0, GPIO_OUTPUT); - if (ret < 0) { - LOG_ERR("Failed to configure the LED pin, error: %d", ret); - return 0; - } - - usb_hid_register_device(hid_dev, - hid_report_desc, sizeof(hid_report_desc), - &ops); - - usb_hid_init(hid_dev); - - ret = usb_enable(status_cb); - if (ret != 0) { - LOG_ERR("Failed to enable USB"); - return 0; - } - - while (true) { - uint8_t __aligned(sizeof(void *)) report[MOUSE_REPORT_COUNT]; - - k_msgq_get(&mouse_msgq, &report, K_FOREVER); - - ret = hid_int_ep_write(hid_dev, report, MOUSE_REPORT_COUNT, NULL); - if (ret) { - LOG_ERR("HID write error, %d", ret); - } else { - k_sem_take(&ep_write_sem, K_FOREVER); - /* Toggle LED on sent report */ - (void)gpio_pin_toggle(led0.port, led0.pin); - } - } - return 0; -} From 49cdc87f9937d51f1e80af4932b76e1d8c858406 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:31 +0300 Subject: [PATCH 0923/2141] Revert "[nrf fromtree] samples: usb: move the legacy code out of the CDC ACM sample" This reverts commit 273273fe9cc22beb95197bc40c4290fa4ca79927. Signed-off-by: Jukka Rissanen --- samples/subsys/usb/cdc_acm/README.rst | 6 +- samples/subsys/usb/cdc_acm/prj.conf | 19 +-- samples/subsys/usb/cdc_acm/sample.yaml | 18 ++ samples/subsys/usb/cdc_acm/src/main.c | 40 ++++- samples/subsys/usb/cdc_acm/usbd_next_prj.conf | 14 ++ .../subsys/usb/legacy/cdc_acm/CMakeLists.txt | 9 - samples/subsys/usb/legacy/cdc_acm/README.rst | 102 ------------ samples/subsys/usb/legacy/cdc_acm/app.overlay | 11 -- samples/subsys/usb/legacy/cdc_acm/prj.conf | 11 -- samples/subsys/usb/legacy/cdc_acm/sample.yaml | 7 - samples/subsys/usb/legacy/cdc_acm/src/main.c | 154 ------------------ 11 files changed, 81 insertions(+), 310 deletions(-) create mode 100644 samples/subsys/usb/cdc_acm/usbd_next_prj.conf delete mode 100644 samples/subsys/usb/legacy/cdc_acm/CMakeLists.txt delete mode 100644 samples/subsys/usb/legacy/cdc_acm/README.rst delete mode 100644 samples/subsys/usb/legacy/cdc_acm/app.overlay delete mode 100644 samples/subsys/usb/legacy/cdc_acm/prj.conf delete mode 100644 samples/subsys/usb/legacy/cdc_acm/sample.yaml delete mode 100644 samples/subsys/usb/legacy/cdc_acm/src/main.c diff --git a/samples/subsys/usb/cdc_acm/README.rst b/samples/subsys/usb/cdc_acm/README.rst index db95373b2530..21ce853ae081 100644 --- a/samples/subsys/usb/cdc_acm/README.rst +++ b/samples/subsys/usb/cdc_acm/README.rst @@ -1,8 +1,8 @@ .. zephyr:code-sample:: usb-cdc-acm - :name: USB CDC ACM UART sample - :relevant-api: usbd_api uart_interface + :name: USB CDC-ACM + :relevant-api: usbd_api _usb_device_core_api uart_interface - Use USB CDC ACM UART driver to implement a serial port echo. + Use USB CDC-ACM driver to implement a serial port echo. Overview ******** diff --git a/samples/subsys/usb/cdc_acm/prj.conf b/samples/subsys/usb/cdc_acm/prj.conf index e0012027ec6a..55e4fe9217fb 100644 --- a/samples/subsys/usb/cdc_acm/prj.conf +++ b/samples/subsys/usb/cdc_acm/prj.conf @@ -1,14 +1,11 @@ -CONFIG_USB_DEVICE_STACK_NEXT=y - CONFIG_STDOUT_CONSOLE=y +CONFIG_USB_DEVICE_STACK=y +CONFIG_USB_DEVICE_PRODUCT="Zephyr CDC ACM sample" +CONFIG_USB_DEVICE_PID=0x0001 +CONFIG_LOG=y +CONFIG_USB_DRIVER_LOG_LEVEL_ERR=y +CONFIG_USB_DEVICE_LOG_LEVEL_ERR=y CONFIG_SERIAL=y +CONFIG_UART_INTERRUPT_DRIVEN=y CONFIG_UART_LINE_CTRL=y -CONFIG_USBD_CDC_ACM_CLASS=y - -CONFIG_LOG=y -CONFIG_USBD_LOG_LEVEL_ERR=y -CONFIG_UDC_DRIVER_LOG_LEVEL_ERR=y -CONFIG_USBD_CDC_ACM_LOG_LEVEL_ERR=y - -CONFIG_SAMPLE_USBD_PID=0x0001 -CONFIG_SAMPLE_USBD_PRODUCT="USBD CDC ACM sample" +CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=n diff --git a/samples/subsys/usb/cdc_acm/sample.yaml b/samples/subsys/usb/cdc_acm/sample.yaml index b9256e74eee5..875bfb335b5c 100644 --- a/samples/subsys/usb/cdc_acm/sample.yaml +++ b/samples/subsys/usb/cdc_acm/sample.yaml @@ -1,9 +1,19 @@ sample: name: CDC ACM USB tests: + sample.usb.cdc-acm: + depends_on: usb_device + tags: usb + arch_exclude: posix + harness: console + harness_config: + type: one_line + regex: + - "Wait for DTR" sample.usb_device_next.cdc-acm: depends_on: usbd tags: usb + extra_args: CONF_FILE="usbd_next_prj.conf" integration_platforms: - nrf52840dk/nrf52840 - nrf54h20dk/nrf54h20/cpuapp @@ -24,6 +34,7 @@ tests: depends_on: usbd tags: usb extra_args: + - CONF_FILE="usbd_next_prj.conf" - DCONFIG_USBD_CDC_ACM_WORKQUEUE=y integration_platforms: - frdm_k64f @@ -32,3 +43,10 @@ tests: type: one_line regex: - "Wait for DTR" + sample.usb.cdc-acm.buildonly: + depends_on: usb_device + tags: usb + arch_allow: posix + build_only: true + integration_platforms: + - native_sim diff --git a/samples/subsys/usb/cdc_acm/src/main.c b/samples/subsys/usb/cdc_acm/src/main.c index c80d253966b7..ab1cbdc6a4c0 100644 --- a/samples/subsys/usb/cdc_acm/src/main.c +++ b/samples/subsys/usb/cdc_acm/src/main.c @@ -4,6 +4,14 @@ * SPDX-License-Identifier: Apache-2.0 */ +/** + * @file + * @brief Sample echo app for CDC ACM class + * + * Sample app for USB CDC ACM class driver. The received data is echoed back + * to the serial port. + */ + #include #include @@ -13,6 +21,7 @@ #include #include +#include #include #include LOG_MODULE_REGISTER(cdc_acm_echo, LOG_LEVEL_INF); @@ -39,6 +48,7 @@ static inline void print_baudrate(const struct device *dev) } } +#if defined(CONFIG_USB_DEVICE_STACK_NEXT) static struct usbd_context *sample_usbd; K_SEM_DEFINE(dtr_sem, 0, 1); @@ -96,6 +106,7 @@ static int enable_usb_device_next(void) return 0; } +#endif /* defined(CONFIG_USB_DEVICE_STACK_NEXT) */ static void interrupt_handler(const struct device *dev, void *user_data) { @@ -167,16 +178,37 @@ int main(void) return 0; } - ret = enable_usb_device_next(); +#if defined(CONFIG_USB_DEVICE_STACK_NEXT) + ret = enable_usb_device_next(); +#else + ret = usb_enable(NULL); +#endif + if (ret != 0) { - LOG_ERR("Failed to enable USB device support"); + LOG_ERR("Failed to enable USB"); return 0; } ring_buf_init(&ringbuf, sizeof(ring_buffer), ring_buffer); LOG_INF("Wait for DTR"); + +#if defined(CONFIG_USB_DEVICE_STACK_NEXT) k_sem_take(&dtr_sem, K_FOREVER); +#else + while (true) { + uint32_t dtr = 0U; + + uart_line_ctrl_get(uart_dev, UART_LINE_CTRL_DTR, &dtr); + if (dtr) { + break; + } else { + /* Give CPU resources to low priority threads. */ + k_sleep(K_MSEC(100)); + } + } +#endif + LOG_INF("DTR set"); /* They are optional, we use them to test the interrupt endpoint */ @@ -193,7 +225,11 @@ int main(void) /* Wait 100ms for the host to do all settings */ k_msleep(100); +#ifndef CONFIG_USB_DEVICE_STACK_NEXT + print_baudrate(uart_dev); +#endif uart_irq_callback_set(uart_dev, interrupt_handler); + /* Enable rx interrupts */ uart_irq_rx_enable(uart_dev); diff --git a/samples/subsys/usb/cdc_acm/usbd_next_prj.conf b/samples/subsys/usb/cdc_acm/usbd_next_prj.conf new file mode 100644 index 000000000000..f08928438b77 --- /dev/null +++ b/samples/subsys/usb/cdc_acm/usbd_next_prj.conf @@ -0,0 +1,14 @@ +CONFIG_USB_DEVICE_STACK_NEXT=y + +CONFIG_STDOUT_CONSOLE=y +CONFIG_SERIAL=y +CONFIG_UART_LINE_CTRL=y +CONFIG_USBD_CDC_ACM_CLASS=y + +CONFIG_LOG=y +CONFIG_USBD_LOG_LEVEL_WRN=y +CONFIG_UDC_DRIVER_LOG_LEVEL_WRN=y +CONFIG_USBD_CDC_ACM_LOG_LEVEL_ERR=y + +CONFIG_SAMPLE_USBD_PID=0x0001 +CONFIG_SAMPLE_USBD_PRODUCT="USBD CDC ACM sample" diff --git a/samples/subsys/usb/legacy/cdc_acm/CMakeLists.txt b/samples/subsys/usb/legacy/cdc_acm/CMakeLists.txt deleted file mode 100644 index c97b49907663..000000000000 --- a/samples/subsys/usb/legacy/cdc_acm/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -cmake_minimum_required(VERSION 3.20.0) -find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -project(cdc_acm) - -include(${ZEPHYR_BASE}/samples/subsys/usb/common/common.cmake) -FILE(GLOB app_sources src/*.c) -target_sources(app PRIVATE ${app_sources}) diff --git a/samples/subsys/usb/legacy/cdc_acm/README.rst b/samples/subsys/usb/legacy/cdc_acm/README.rst deleted file mode 100644 index 1e7a4d153006..000000000000 --- a/samples/subsys/usb/legacy/cdc_acm/README.rst +++ /dev/null @@ -1,102 +0,0 @@ -.. zephyr:code-sample:: legacy-usb-cdc-acm - :name: Legacy USB CDC ACM UART sample - :relevant-api: _usb_device_core_api uart_interface - - Use USB CDC ACM UART driver to implement a serial port echo. - -Overview -******** - -This sample app demonstrates use of a USB Communication Device Class (CDC) -Abstract Control Model (ACM) driver provided by the Zephyr project. -Received data from the serial port is echoed back to the same port -provided by this driver. - -.. note:: - This samples demonstrate deprecated :ref:`usb_device_stack`. - -This sample can be found under :zephyr_file:`samples/subsys/usb/legacy/cdc_acm` in the -Zephyr project tree. - -Requirements -************ - -This project requires an USB device driver, which is available for multiple -boards supported in Zephyr. - -Building and Running -******************** - -Reel Board -=========== - -To see the console output of the app, open a serial port emulator and -attach it to the USB to TTL Serial cable. Build and flash the project: - -.. zephyr-app-commands:: - :zephyr-app: samples/subsys/usb/legacy/cdc_acm - :board: reel_board - :goals: flash - :compact: - -Running -======= - -Plug the board into a host device, for example, a PC running Linux. -The board will be detected as shown by the Linux dmesg command: - -.. code-block:: console - - usb 9-1: new full-speed USB device number 112 using uhci_hcd - usb 9-1: New USB device found, idVendor=8086, idProduct=f8a1 - usb 9-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 - usb 9-1: Product: CDC-ACM - usb 9-1: Manufacturer: Intel - usb 9-1: SerialNumber: 00.01 - cdc_acm 9-1:1.0: ttyACM1: USB ACM device - -The app prints on serial output (UART1), used for the console: - -.. code-block:: console - - Wait for DTR - -Open a serial port emulator, for example minicom -and attach it to detected CDC ACM device: - -.. code-block:: console - - minicom --device /dev/ttyACM1 - -The app should respond on serial output with: - -.. code-block:: console - - DTR set, start test - Baudrate detected: 115200 - -And on ttyACM device, provided by zephyr USB device stack: - -.. code-block:: console - - Send characters to the UART device - Characters read: - -The characters entered in serial port emulator will be echoed back. - -Troubleshooting -=============== - -If the ModemManager runs on your operating system, it will try -to access the CDC ACM device and maybe you can see several characters -including "AT" on the terminal attached to the CDC ACM device. -You can add or extend the udev rule for your board to inform -ModemManager to skip the CDC ACM device. -For this example, it would look like this: - -.. code-block:: none - - ATTRS{idVendor}=="8086" ATTRS{idProduct}=="f8a1", ENV{ID_MM_DEVICE_IGNORE}="1" - -You can use -``/lib/udev/rules.d/77-mm-usb-device-blacklist.rules`` as reference. diff --git a/samples/subsys/usb/legacy/cdc_acm/app.overlay b/samples/subsys/usb/legacy/cdc_acm/app.overlay deleted file mode 100644 index c50d0fd9d69e..000000000000 --- a/samples/subsys/usb/legacy/cdc_acm/app.overlay +++ /dev/null @@ -1,11 +0,0 @@ -/* - * Copyright (c) 2021 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&zephyr_udc0 { - cdc_acm_uart0 { - compatible = "zephyr,cdc-acm-uart"; - }; -}; diff --git a/samples/subsys/usb/legacy/cdc_acm/prj.conf b/samples/subsys/usb/legacy/cdc_acm/prj.conf deleted file mode 100644 index 55e4fe9217fb..000000000000 --- a/samples/subsys/usb/legacy/cdc_acm/prj.conf +++ /dev/null @@ -1,11 +0,0 @@ -CONFIG_STDOUT_CONSOLE=y -CONFIG_USB_DEVICE_STACK=y -CONFIG_USB_DEVICE_PRODUCT="Zephyr CDC ACM sample" -CONFIG_USB_DEVICE_PID=0x0001 -CONFIG_LOG=y -CONFIG_USB_DRIVER_LOG_LEVEL_ERR=y -CONFIG_USB_DEVICE_LOG_LEVEL_ERR=y -CONFIG_SERIAL=y -CONFIG_UART_INTERRUPT_DRIVEN=y -CONFIG_UART_LINE_CTRL=y -CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=n diff --git a/samples/subsys/usb/legacy/cdc_acm/sample.yaml b/samples/subsys/usb/legacy/cdc_acm/sample.yaml deleted file mode 100644 index b61deab71ff2..000000000000 --- a/samples/subsys/usb/legacy/cdc_acm/sample.yaml +++ /dev/null @@ -1,7 +0,0 @@ -sample: - name: CDC ACM USB -tests: - sample.usb.legacy.cdc-acm: - depends_on: usb_device - tags: usb - build_only: true diff --git a/samples/subsys/usb/legacy/cdc_acm/src/main.c b/samples/subsys/usb/legacy/cdc_acm/src/main.c deleted file mode 100644 index d06161f0f5ca..000000000000 --- a/samples/subsys/usb/legacy/cdc_acm/src/main.c +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright (c) 2019 Intel Corporation - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include -#include -#include -#include - -#include -#include -LOG_MODULE_REGISTER(cdc_acm_echo, LOG_LEVEL_INF); - -const struct device *const uart_dev = DEVICE_DT_GET_ONE(zephyr_cdc_acm_uart); - -#define RING_BUF_SIZE 1024 -uint8_t ring_buffer[RING_BUF_SIZE]; - -struct ring_buf ringbuf; - -static bool rx_throttled; - -static inline void print_baudrate(const struct device *dev) -{ - uint32_t baudrate; - int ret; - - ret = uart_line_ctrl_get(dev, UART_LINE_CTRL_BAUD_RATE, &baudrate); - if (ret) { - LOG_WRN("Failed to get baudrate, ret code %d", ret); - } else { - LOG_INF("Baudrate %u", baudrate); - } -} - -static void interrupt_handler(const struct device *dev, void *user_data) -{ - ARG_UNUSED(user_data); - - while (uart_irq_update(dev) && uart_irq_is_pending(dev)) { - if (!rx_throttled && uart_irq_rx_ready(dev)) { - int recv_len, rb_len; - uint8_t buffer[64]; - size_t len = MIN(ring_buf_space_get(&ringbuf), - sizeof(buffer)); - - if (len == 0) { - /* Throttle because ring buffer is full */ - uart_irq_rx_disable(dev); - rx_throttled = true; - continue; - } - - recv_len = uart_fifo_read(dev, buffer, len); - if (recv_len < 0) { - LOG_ERR("Failed to read UART FIFO"); - recv_len = 0; - }; - - rb_len = ring_buf_put(&ringbuf, buffer, recv_len); - if (rb_len < recv_len) { - LOG_ERR("Drop %u bytes", recv_len - rb_len); - } - - LOG_DBG("tty fifo -> ringbuf %d bytes", rb_len); - if (rb_len) { - uart_irq_tx_enable(dev); - } - } - - if (uart_irq_tx_ready(dev)) { - uint8_t buffer[64]; - int rb_len, send_len; - - rb_len = ring_buf_get(&ringbuf, buffer, sizeof(buffer)); - if (!rb_len) { - LOG_DBG("Ring buffer empty, disable TX IRQ"); - uart_irq_tx_disable(dev); - continue; - } - - if (rx_throttled) { - uart_irq_rx_enable(dev); - rx_throttled = false; - } - - send_len = uart_fifo_fill(dev, buffer, rb_len); - if (send_len < rb_len) { - LOG_ERR("Drop %d bytes", rb_len - send_len); - } - - LOG_DBG("ringbuf -> tty fifo %d bytes", send_len); - } - } -} - -int main(void) -{ - int ret; - - if (!device_is_ready(uart_dev)) { - LOG_ERR("CDC ACM device not ready"); - return 0; - } - - ret = usb_enable(NULL); - if (ret != 0) { - LOG_ERR("Failed to enable USB"); - return 0; - } - - ring_buf_init(&ringbuf, sizeof(ring_buffer), ring_buffer); - - LOG_INF("Wait for DTR"); - - while (true) { - uint32_t dtr = 0U; - - uart_line_ctrl_get(uart_dev, UART_LINE_CTRL_DTR, &dtr); - if (dtr) { - break; - } - - k_sleep(K_MSEC(100)); - } - - LOG_INF("DTR set"); - - /* They are optional, we use them to test the interrupt endpoint */ - ret = uart_line_ctrl_set(uart_dev, UART_LINE_CTRL_DCD, 1); - if (ret) { - LOG_WRN("Failed to set DCD, ret code %d", ret); - } - - ret = uart_line_ctrl_set(uart_dev, UART_LINE_CTRL_DSR, 1); - if (ret) { - LOG_WRN("Failed to set DSR, ret code %d", ret); - } - - /* Wait 100ms for the host to do all settings */ - k_msleep(100); - - print_baudrate(uart_dev); - - uart_irq_callback_set(uart_dev, interrupt_handler); - /* Enable rx interrupts */ - uart_irq_rx_enable(uart_dev); - - return 0; -} From 98ad28a8a202f5e1008c56ae3b0570a65d7eeb94 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:31 +0300 Subject: [PATCH 0924/2141] Revert "[nrf fromlist] tests: drivers: spi: spi_loopback: skip timing test when COVERAGE" This reverts commit 5ca258a1523d6f9a9211c51770fa7e7be2fa27ad. Signed-off-by: Jukka Rissanen --- tests/drivers/spi/spi_loopback/src/spi.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/drivers/spi/spi_loopback/src/spi.c b/tests/drivers/spi/spi_loopback/src/spi.c index ad45fd67991b..bb8b9d283b28 100644 --- a/tests/drivers/spi/spi_loopback/src/spi.c +++ b/tests/drivers/spi/spi_loopback/src/spi.c @@ -291,9 +291,6 @@ ZTEST(spi_loopback, test_spi_complete_multiple) /* same as the test_spi_complete_multiple test, but seeing if there is any unreasonable latency */ ZTEST(spi_loopback, test_spi_complete_multiple_timed) { - /* Do not check timing when coverage is enabled */ - Z_TEST_SKIP_IFDEF(CONFIG_COVERAGE); - struct spi_dt_spec *spec = loopback_specs[spec_idx]; const struct spi_buf_set tx = spi_loopback_setup_xfer(tx_bufs_pool, 2, buffer_tx, BUF_SIZE, From 3e2a89088fed99b7b8cdc572898e10824769fe5b Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:31 +0300 Subject: [PATCH 0925/2141] Revert "[nrf fromtree] modules: openthread: platform: logging: Take kconfig into account" This reverts commit 20d3002d636dc6cef77d1059dadc1510f99f640e. Signed-off-by: Jukka Rissanen --- modules/openthread/platform/logging.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/modules/openthread/platform/logging.c b/modules/openthread/platform/logging.c index 2445c9c53ed2..110bd2ecf544 100644 --- a/modules/openthread/platform/logging.c +++ b/modules/openthread/platform/logging.c @@ -5,10 +5,16 @@ */ #include -#include #include +#include #include +#include "openthread-core-zephyr-config.h" + +#define LOG_MODULE_NAME net_openthread +#define LOG_LEVEL LOG_LEVEL_DBG +#include +LOG_MODULE_REGISTER(LOG_MODULE_NAME); #include "platform-zephyr.h" @@ -43,7 +49,7 @@ void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat int level = log_translate(aLogLevel); va_list param_list; - if (level < 0 || level > CONFIG_OPENTHREAD_PLATFORM_LOG_LEVEL) { + if (level < 0) { return; } From d72b87d5a1228b37384d9e23b92828df6bab59a5 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:31 +0300 Subject: [PATCH 0926/2141] Revert "[nrf noup] zms: add lookup cache hash function for legacy ZMS" This reverts commit 476ad665287a8b92e90ba1ec9a1ebd3241018b7a. Signed-off-by: Jukka Rissanen --- subsys/fs/zms/zms.c | 39 --------------------------------------- 1 file changed, 39 deletions(-) diff --git a/subsys/fs/zms/zms.c b/subsys/fs/zms/zms.c index 6d3a2b30a3aa..bc0d4286739c 100644 --- a/subsys/fs/zms/zms.c +++ b/subsys/fs/zms/zms.c @@ -13,12 +13,8 @@ #include #include "zms_priv.h" #ifdef CONFIG_ZMS_LOOKUP_CACHE_FOR_SETTINGS -#ifdef CONFIG_SETTINGS_ZMS_LEGACY -#include -#else #include #endif -#endif #include LOG_MODULE_REGISTER(fs_zms, CONFIG_ZMS_LOG_LEVEL); @@ -36,40 +32,6 @@ static int zms_ate_valid_different_sector(struct zms_fs *fs, const struct zms_at static inline size_t zms_lookup_cache_pos(zms_id_t id) { #ifdef CONFIG_ZMS_LOOKUP_CACHE_FOR_SETTINGS -#ifdef CONFIG_SETTINGS_ZMS_LEGACY - /* - * 1. The ZMS settings backend uses up to (ZMS_NAME_ID_OFFSET - 1) ZMS IDs to - store keys and equal number of ZMS IDs to store values. - * 2. For each key-value pair, the value is stored at ZMS ID greater by exactly - * ZMS_NAME_ID_OFFSET than ZMS ID that holds the key. - * 3. The backend tries to minimize the range of ZMS IDs used to store keys. - * That is, ZMS IDs are allocated sequentially, and freed ZMS IDs are reused - * before allocating new ones. - * - * Therefore, to assure the least number of collisions in the lookup cache, - * the least significant bit of the hash indicates whether the given ZMS ID - * represents a key or a value, and remaining bits of the hash are set to - * the ordinal number of the key-value pair. Consequently, the hash function - * provides the following mapping: - * - * 1st settings key => hash 0 - * 1st settings value => hash 1 - * 2nd settings key => hash 2 - * 2nd settings value => hash 3 - * ... - */ - BUILD_ASSERT(IS_POWER_OF_TWO(ZMS_NAMECNT_ID), "ZMS_NAMECNT_ID is not power of 2"); - BUILD_ASSERT(IS_POWER_OF_TWO(ZMS_NAME_ID_OFFSET), "ZMS_NAME_ID_OFFSET is not power of 2"); - - uint32_t key_value_bit; - uint32_t key_value_ord; - uint32_t hash; - - key_value_bit = (id >> LOG2(ZMS_NAME_ID_OFFSET)) & 1; - key_value_ord = id & (ZMS_NAME_ID_OFFSET - 1); - - hash = ((key_value_ord << 1) | key_value_bit); -#else /* * 1. Settings subsystem is storing the name ID and the linked list node ID * with only one bit difference at BIT(0). @@ -95,7 +57,6 @@ static inline size_t zms_lookup_cache_pos(zms_id_t id) key_value_ll = id & BIT(0); hash = (key_value_hash << 2) | (key_value_bit << 1) | key_value_ll; -#endif /* CONFIG_SETTINGS_ZMS_LEGACY */ #elif defined(CONFIG_ZMS_ID_64BIT) /* 64-bit integer hash function found by https://github.com/skeeto/hash-prospector. */ From 716d930047f5188645d10c1c45b96b84f410cef6 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:31 +0300 Subject: [PATCH 0927/2141] Revert "[nrf fromlist] tests: zms: Add test coverage for ZMS_ID_64BIT" This reverts commit 9311d969c2e501e2f01249d92304193acc20cedb. Signed-off-by: Jukka Rissanen --- tests/subsys/fs/zms/src/main.c | 56 ++++--------------------------- tests/subsys/fs/zms/testcase.yaml | 6 ---- 2 files changed, 6 insertions(+), 56 deletions(-) diff --git a/tests/subsys/fs/zms/src/main.c b/tests/subsys/fs/zms/src/main.c index bcdb739161dc..f307fe1b3a73 100644 --- a/tests/subsys/fs/zms/src/main.c +++ b/tests/subsys/fs/zms/src/main.c @@ -578,19 +578,17 @@ ZTEST_F(zms, test_zms_gc_corrupt_close_ate) int err; Z_TEST_SKIP_IFNDEF(CONFIG_FLASH_SIMULATOR_DOUBLE_WRITES); - memset(&close_ate, 0xff, sizeof(struct zms_ate)); - close_ate.id = ZMS_HEAD_ID; + close_ate.id = 0xffffffff; close_ate.offset = fixture->fs.sector_size - sizeof(struct zms_ate) * 5; close_ate.len = 0; + close_ate.metadata = 0xffffffff; close_ate.cycle_cnt = 1; close_ate.crc8 = 0xff; /* Incorrect crc8 */ - memset(&empty_ate, 0, sizeof(struct zms_ate)); - empty_ate.id = ZMS_HEAD_ID; + empty_ate.id = 0xffffffff; + empty_ate.offset = 0; empty_ate.len = 0xffff; - empty_ate.metadata = FIELD_PREP(ZMS_VERSION_MASK, ZMS_DEFAULT_VERSION) | - FIELD_PREP(ZMS_MAGIC_NUMBER_MASK, ZMS_MAGIC_NUMBER) | - FIELD_PREP(ZMS_ATE_FORMAT_MASK, ZMS_DEFAULT_ATE_FORMAT); + empty_ate.metadata = 0x4201; empty_ate.cycle_cnt = 1; empty_ate.crc8 = crc8_ccitt(0xff, (uint8_t *)&empty_ate + SIZEOF_FIELD(struct zms_ate, crc8), @@ -651,7 +649,7 @@ ZTEST_F(zms, test_zms_gc_corrupt_ate) struct zms_ate close_ate; int err; - close_ate.id = ZMS_HEAD_ID; + close_ate.id = 0xffffffff; close_ate.offset = fixture->fs.sector_size / 2; close_ate.len = 0; close_ate.crc8 = @@ -898,45 +896,3 @@ ZTEST_F(zms, test_zms_cache_hash_quality) ztest_test_skip(); #endif } - -/* - * Test 64 bit ZMS ID support. - */ -ZTEST_F(zms, test_zms_id_64bit) -{ - int err; - ssize_t len; - uint64_t data; - uint64_t filling_id = 0xdeadbeefULL; - - Z_TEST_SKIP_IFNDEF(CONFIG_ZMS_ID_64BIT); - - err = zms_mount(&fixture->fs); - zassert_true(err == 0, "zms_mount call failure: %d", err); - - /* Fill the first sector with writes of different IDs */ - - while (fixture->fs.data_wra + sizeof(data) + sizeof(struct zms_ate) <= - fixture->fs.ate_wra) { - data = filling_id; - len = zms_write(&fixture->fs, (zms_id_t)filling_id, &data, sizeof(data)); - zassert_true(len == sizeof(data), "zms_write failed: %d", len); - - /* Choose the next ID so that its lower 32 bits stay invariant. - * The purpose is to test that ZMS doesn't mistakenly cast the - * 64 bit ID to a 32 bit one somewhere. - */ - filling_id += BIT64(32); - } - - /* Read back the written entries and check that they're all unique */ - - for (uint64_t id = 0xdeadbeefULL; id < filling_id; id += BIT64(32)) { - len = zms_read_hist(&fixture->fs, (zms_id_t)id, &data, sizeof(data), 0); - zassert_true(len == sizeof(data), "zms_read_hist unexpected failure: %d", len); - zassert_equal(data, id, "read unexpected data: %llx instead of %llx", data, id); - - len = zms_read_hist(&fixture->fs, (zms_id_t)id, &data, sizeof(data), 1); - zassert_true(len == -ENOENT, "zms_read_hist unexpected failure: %d", len); - } -} diff --git a/tests/subsys/fs/zms/testcase.yaml b/tests/subsys/fs/zms/testcase.yaml index 14cb7e9c36a2..4949e1be0c6b 100644 --- a/tests/subsys/fs/zms/testcase.yaml +++ b/tests/subsys/fs/zms/testcase.yaml @@ -27,9 +27,3 @@ tests: platform_allow: - native_sim - qemu_x86 - filesystem.zms.id_64bit: - extra_configs: - - CONFIG_ZMS_ID_64BIT=y - - CONFIG_ZMS_LOOKUP_CACHE=y - - CONFIG_ZMS_LOOKUP_CACHE_SIZE=64 - platform_allow: qemu_x86 From 863bdcd705dd0c6daa47994fa187e98d066fa947 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:31 +0300 Subject: [PATCH 0928/2141] Revert "[nrf fromlist] zms: Initial support for 64 bit IDs" This reverts commit 019a9ebb2b08eacf2876dd2a10e9b0c6db97f7a1. Signed-off-by: Jukka Rissanen --- include/zephyr/fs/zms.h | 21 ++------ subsys/fs/zms/Kconfig | 11 ---- subsys/fs/zms/zms.c | 108 ++++++++++++--------------------------- subsys/fs/zms/zms_priv.h | 35 +------------ 4 files changed, 40 insertions(+), 135 deletions(-) diff --git a/include/zephyr/fs/zms.h b/include/zephyr/fs/zms.h index 436f448f6b48..8b776b426f9c 100644 --- a/include/zephyr/fs/zms.h +++ b/include/zephyr/fs/zms.h @@ -77,17 +77,6 @@ struct zms_fs { * @{ */ -/** - * @brief ID type used in the ZMS API. - * - * @note The width of this type depends on @kconfig{CONFIG_ZMS_ID_64BIT}. - */ -#if CONFIG_ZMS_ID_64BIT -typedef uint64_t zms_id_t; -#else -typedef uint32_t zms_id_t; -#endif - /** * @brief Mount a ZMS file system onto the device specified in `fs`. * @@ -138,7 +127,7 @@ int zms_clear(struct zms_fs *fs); * @retval -EINVAL if `len` is invalid. * @retval -ENOSPC if no space is left on the device. */ -ssize_t zms_write(struct zms_fs *fs, zms_id_t id, const void *data, size_t len); +ssize_t zms_write(struct zms_fs *fs, uint32_t id, const void *data, size_t len); /** * @brief Delete an entry from the file system @@ -151,7 +140,7 @@ ssize_t zms_write(struct zms_fs *fs, zms_id_t id, const void *data, size_t len); * @retval -ENXIO if there is a device error. * @retval -EIO if there is a memory read/write error. */ -int zms_delete(struct zms_fs *fs, zms_id_t id); +int zms_delete(struct zms_fs *fs, uint32_t id); /** * @brief Read an entry from the file system. @@ -169,7 +158,7 @@ int zms_delete(struct zms_fs *fs, zms_id_t id); * @retval -EIO if there is a memory read/write error. * @retval -ENOENT if there is no entry with the given `id`. */ -ssize_t zms_read(struct zms_fs *fs, zms_id_t id, void *data, size_t len); +ssize_t zms_read(struct zms_fs *fs, uint32_t id, void *data, size_t len); /** * @brief Read a history entry from the file system. @@ -189,7 +178,7 @@ ssize_t zms_read(struct zms_fs *fs, zms_id_t id, void *data, size_t len); * @retval -EIO if there is a memory read/write error. * @retval -ENOENT if there is no entry with the given `id` and history counter. */ -ssize_t zms_read_hist(struct zms_fs *fs, zms_id_t id, void *data, size_t len, uint32_t cnt); +ssize_t zms_read_hist(struct zms_fs *fs, uint32_t id, void *data, size_t len, uint32_t cnt); /** * @brief Gets the length of the data that is stored in an entry with a given `id` @@ -204,7 +193,7 @@ ssize_t zms_read_hist(struct zms_fs *fs, zms_id_t id, void *data, size_t len, ui * @retval -EIO if there is a memory read/write error. * @retval -ENOENT if there is no entry with the given id and history counter. */ -ssize_t zms_get_data_length(struct zms_fs *fs, zms_id_t id); +ssize_t zms_get_data_length(struct zms_fs *fs, uint32_t id); /** * @brief Calculate the available free space in the file system. diff --git a/subsys/fs/zms/Kconfig b/subsys/fs/zms/Kconfig index 3beb3b0dc34d..f371d75647f1 100644 --- a/subsys/fs/zms/Kconfig +++ b/subsys/fs/zms/Kconfig @@ -15,15 +15,6 @@ config ZMS if ZMS -config ZMS_ID_64BIT - bool "64 bit ZMS IDs" - help - When this option is true, the `zms_id_t` values passed to ZMS APIs will be 64 bit, - as opposed to the default 32 bit. - This option will also change the format of allocation table entries (ATEs) in memory - to accommodate larger IDs. Currently, this will make ZMS unable to mount an existing - file system if it has been initialized with a different ATE format. - config ZMS_LOOKUP_CACHE bool "ZMS lookup cache" help @@ -42,7 +33,6 @@ config ZMS_LOOKUP_CACHE_SIZE config ZMS_DATA_CRC bool "ZMS data CRC" - depends on !ZMS_ID_64BIT config ZMS_CUSTOMIZE_BLOCK_SIZE bool "Customize the size of the buffer used internally for reads and writes" @@ -63,7 +53,6 @@ config ZMS_CUSTOM_BLOCK_SIZE config ZMS_LOOKUP_CACHE_FOR_SETTINGS bool "ZMS Storage lookup cache optimized for settings" depends on ZMS_LOOKUP_CACHE && SETTINGS_ZMS - depends on !ZMS_ID_64BIT help Enable usage of lookup cache based on hashes to get, the best ZMS performance, provided that the ZMS is used only for the purpose of providing the settings diff --git a/subsys/fs/zms/zms.c b/subsys/fs/zms/zms.c index bc0d4286739c..80b86a41cdcb 100644 --- a/subsys/fs/zms/zms.c +++ b/subsys/fs/zms/zms.c @@ -29,8 +29,10 @@ static int zms_ate_valid_different_sector(struct zms_fs *fs, const struct zms_at #ifdef CONFIG_ZMS_LOOKUP_CACHE -static inline size_t zms_lookup_cache_pos(zms_id_t id) +static inline size_t zms_lookup_cache_pos(uint32_t id) { + uint32_t hash = id; + #ifdef CONFIG_ZMS_LOOKUP_CACHE_FOR_SETTINGS /* * 1. Settings subsystem is storing the name ID and the linked list node ID @@ -50,27 +52,14 @@ static inline size_t zms_lookup_cache_pos(zms_id_t id) uint32_t key_value_bit; uint32_t key_value_hash; uint32_t key_value_ll; - uint32_t hash; key_value_bit = (id >> LOG2(ZMS_DATA_ID_OFFSET)) & 1; key_value_hash = (id & ZMS_HASH_MASK) >> (CONFIG_SETTINGS_ZMS_MAX_COLLISIONS_BITS + 1); key_value_ll = id & BIT(0); hash = (key_value_hash << 2) | (key_value_bit << 1) | key_value_ll; - -#elif defined(CONFIG_ZMS_ID_64BIT) - /* 64-bit integer hash function found by https://github.com/skeeto/hash-prospector. */ - uint64_t hash = id; - - hash ^= hash >> 32; - hash *= 0x42ab4abe4c475039ULL; - hash ^= hash >> 31; - hash *= 0xfa90c4424c537791ULL; - hash ^= hash >> 32; #else /* 32-bit integer hash function found by https://github.com/skeeto/hash-prospector. */ - uint32_t hash = id; - hash ^= hash >> 16; hash *= 0x7feb352dU; hash ^= hash >> 15; @@ -250,7 +239,7 @@ static int zms_flash_ate_wrt(struct zms_fs *fs, const struct zms_ate *entry) goto end; } #ifdef CONFIG_ZMS_LOOKUP_CACHE - /* ZMS_HEAD_ID is a special-purpose identifier. Exclude it from the cache */ + /* 0xFFFFFFFF is a special-purpose identifier. Exclude it from the cache */ if (entry->id != ZMS_HEAD_ID) { fs->lookup_cache[zms_lookup_cache_pos(entry->id)] = fs->ate_wra; } @@ -498,7 +487,7 @@ static bool zms_close_ate_valid(struct zms_fs *fs, const struct zms_ate *entry) /* zms_empty_ate_valid validates an sector empty ate. * A valid sector empty ate should be: * - a valid ate - * - with len = 0xffff and id = ZMS_HEAD_ID + * - with len = 0xffff and id = 0xffffffff * return true if valid, false otherwise */ static bool zms_empty_ate_valid(struct zms_fs *fs, const struct zms_ate *entry) @@ -511,7 +500,7 @@ static bool zms_empty_ate_valid(struct zms_fs *fs, const struct zms_ate *entry) * Valid gc_done_ate: * - valid ate * - len = 0 - * - id = ZMS_HEAD_ID + * - id = 0xffffffff * return true if valid, false otherwise */ static bool zms_gc_done_ate_valid(struct zms_fs *fs, const struct zms_ate *entry) @@ -520,18 +509,6 @@ static bool zms_gc_done_ate_valid(struct zms_fs *fs, const struct zms_ate *entry (entry->id == ZMS_HEAD_ID)); } -/* zms_sector_closed checks whether the current sector is closed, which would imply - * that the empty ATE and close ATE are both valid and have matching cycle counters - * - * return true if closed, false otherwise - */ -static bool zms_sector_closed(struct zms_fs *fs, struct zms_ate *empty_ate, - struct zms_ate *close_ate) -{ - return (zms_empty_ate_valid(fs, empty_ate) && zms_close_ate_valid(fs, close_ate) && - (empty_ate->cycle_cnt == close_ate->cycle_cnt)); -} - /* Read empty and close ATE of the sector where belongs address "addr" and * validates that the sector is closed. * retval: 0 if sector is not close @@ -549,7 +526,8 @@ static int zms_validate_closed_sector(struct zms_fs *fs, uint64_t addr, struct z return rc; } - if (zms_sector_closed(fs, empty_ate, close_ate)) { + if (zms_empty_ate_valid(fs, empty_ate) && zms_close_ate_valid(fs, close_ate) && + (empty_ate->cycle_cnt == close_ate->cycle_cnt)) { /* Closed sector validated */ return 1; } @@ -558,7 +536,7 @@ static int zms_validate_closed_sector(struct zms_fs *fs, uint64_t addr, struct z } /* store an entry in flash */ -static int zms_flash_write_entry(struct zms_fs *fs, zms_id_t id, const void *data, size_t len) +static int zms_flash_write_entry(struct zms_fs *fs, uint32_t id, const void *data, size_t len) { int rc; struct zms_ate entry; @@ -571,13 +549,13 @@ static int zms_flash_write_entry(struct zms_fs *fs, zms_id_t id, const void *dat entry.cycle_cnt = fs->sector_cycle; if (len > ZMS_DATA_IN_ATE_SIZE) { -#ifdef CONFIG_ZMS_DATA_CRC - /* only compute CRC if data is to be stored outside of entry */ - entry.data_crc = crc32_ieee(data, len); -#endif + /* only compute CRC if len is greater than 8 bytes */ + if (IS_ENABLED(CONFIG_ZMS_DATA_CRC)) { + entry.data_crc = crc32_ieee(data, len); + } entry.offset = (uint32_t)SECTOR_OFFSET(fs->data_wra); } else if ((len > 0) && (len <= ZMS_DATA_IN_ATE_SIZE)) { - /* Copy data into entry for small data (at most ZMS_DATA_IN_ATE_SIZE bytes) */ + /* Copy data into entry for small data ( < 8B) */ memcpy(&entry.data, data, len); } @@ -710,12 +688,10 @@ static int zms_sector_close(struct zms_fs *fs) struct zms_ate close_ate; struct zms_ate garbage_ate; - /* Initialize all members to 0xff */ - memset(&close_ate, 0xff, sizeof(struct zms_ate)); - close_ate.id = ZMS_HEAD_ID; close_ate.len = 0U; close_ate.offset = (uint32_t)SECTOR_OFFSET(fs->ate_wra + fs->ate_size); + close_ate.metadata = 0xffffffff; close_ate.cycle_cnt = fs->sector_cycle; /* When we close the sector, we must write all non used ATE with @@ -764,13 +740,11 @@ static int zms_add_gc_done_ate(struct zms_fs *fs) { struct zms_ate gc_done_ate; - /* Initialize all members to 0xff */ - memset(&gc_done_ate, 0xff, sizeof(struct zms_ate)); - LOG_DBG("Adding gc done ate at %llx", fs->ate_wra); gc_done_ate.id = ZMS_HEAD_ID; gc_done_ate.len = 0U; gc_done_ate.offset = (uint32_t)SECTOR_OFFSET(fs->data_wra); + gc_done_ate.metadata = 0xffffffff; gc_done_ate.cycle_cnt = fs->sector_cycle; zms_ate_crc8_update(&gc_done_ate); @@ -819,17 +793,14 @@ static int zms_add_empty_ate(struct zms_fs *fs, uint64_t addr) int rc = 0; uint64_t previous_ate_wra; - /* Initialize all members to 0 */ - memset(&empty_ate, 0, sizeof(struct zms_ate)); - addr &= ADDR_SECT_MASK; LOG_DBG("Adding empty ate at %llx", (uint64_t)(addr + fs->sector_size - fs->ate_size)); empty_ate.id = ZMS_HEAD_ID; empty_ate.len = 0xffff; - empty_ate.metadata = FIELD_PREP(ZMS_VERSION_MASK, ZMS_DEFAULT_VERSION) | - FIELD_PREP(ZMS_MAGIC_NUMBER_MASK, ZMS_MAGIC_NUMBER) | - FIELD_PREP(ZMS_ATE_FORMAT_MASK, ZMS_DEFAULT_ATE_FORMAT); + empty_ate.offset = 0U; + empty_ate.metadata = + FIELD_PREP(ZMS_MAGIC_NUMBER_MASK, ZMS_MAGIC_NUMBER) | ZMS_DEFAULT_VERSION; rc = zms_get_sector_cycle(fs, addr, &cycle_cnt); if (rc == -ENOENT) { @@ -922,7 +893,7 @@ static int zms_get_sector_header(struct zms_fs *fs, uint64_t addr, struct zms_at * @retval 1 valid ATE with same ID found * @retval < 0 An error happened */ -static int zms_find_ate_with_id(struct zms_fs *fs, zms_id_t id, uint64_t start_addr, +static int zms_find_ate_with_id(struct zms_fs *fs, uint32_t id, uint64_t start_addr, uint64_t end_addr, struct zms_ate *ate, uint64_t *ate_addr) { int rc; @@ -1073,10 +1044,10 @@ static int zms_gc(struct zms_fs *fs) */ if (wlk_prev_addr == gc_prev_addr) { /* copy needed */ - LOG_DBG("Moving %lld, len %d", (long long)gc_ate.id, gc_ate.len); + LOG_DBG("Moving %d, len %d", gc_ate.id, gc_ate.len); if (gc_ate.len > ZMS_DATA_IN_ATE_SIZE) { - /* Copy Data only when len > ZMS_DATA_IN_ATE_SIZE + /* Copy Data only when len > 8 * Otherwise, Data is already inside ATE */ data_addr = (gc_prev_addr & ADDR_SECT_MASK); @@ -1180,28 +1151,16 @@ static int zms_init(struct zms_fs *fs) for (i = 0; i < fs->sector_count; i++) { addr = zms_close_ate_addr(fs, ((uint64_t)i << ADDR_SECT_SHIFT)); - /* read the header ATEs */ - rc = zms_get_sector_header(fs, addr, &empty_ate, &close_ate); - if (rc) { + /* verify if the sector is closed */ + sec_closed = zms_validate_closed_sector(fs, addr, &empty_ate, &close_ate); + if (sec_closed < 0) { + rc = sec_closed; goto end; } /* update cycle count */ fs->sector_cycle = empty_ate.cycle_cnt; - /* Check the ATE format indicator so that we know how to validate ATEs. - * The metadata field has the same offset and size in all ATE formats - * (the same is guaranteed for crc8 and cycle_cnt). - * Currently, ZMS can only recognize one of its supported ATE formats - * (the one chosen at build time), so their indicators are defined for - * the possibility of a future extension. - * If this indicator is unknown, then consider the header ATEs invalid, - * because we might not be dealing with ZMS contents at all. - */ - if (ZMS_GET_ATE_FORMAT(empty_ate.metadata) != ZMS_DEFAULT_ATE_FORMAT) { - continue; - } - - if (zms_sector_closed(fs, &empty_ate, &close_ate)) { + if (sec_closed == 1) { /* closed sector */ closed_sectors++; /* Let's verify that this is a ZMS storage system */ @@ -1259,8 +1218,7 @@ static int zms_init(struct zms_fs *fs) goto end; } - if ((ZMS_GET_ATE_FORMAT(empty_ate.metadata) == ZMS_DEFAULT_ATE_FORMAT) && - zms_empty_ate_valid(fs, &empty_ate)) { + if (zms_empty_ate_valid(fs, &empty_ate)) { /* Empty ATE is valid, let's verify that this is a ZMS storage system */ if (ZMS_GET_MAGIC_NUMBER(empty_ate.metadata) == ZMS_MAGIC_NUMBER) { zms_magic_exist = true; @@ -1500,7 +1458,7 @@ int zms_mount(struct zms_fs *fs) return 0; } -ssize_t zms_write(struct zms_fs *fs, zms_id_t id, const void *data, size_t len) +ssize_t zms_write(struct zms_fs *fs, uint32_t id, const void *data, size_t len) { int rc; size_t data_size; @@ -1640,12 +1598,12 @@ ssize_t zms_write(struct zms_fs *fs, zms_id_t id, const void *data, size_t len) return rc; } -int zms_delete(struct zms_fs *fs, zms_id_t id) +int zms_delete(struct zms_fs *fs, uint32_t id) { return zms_write(fs, id, NULL, 0); } -ssize_t zms_read_hist(struct zms_fs *fs, zms_id_t id, void *data, size_t len, uint32_t cnt) +ssize_t zms_read_hist(struct zms_fs *fs, uint32_t id, void *data, size_t len, uint32_t cnt) { int rc; int prev_found = 0; @@ -1742,7 +1700,7 @@ ssize_t zms_read_hist(struct zms_fs *fs, zms_id_t id, void *data, size_t len, ui return rc; } -ssize_t zms_read(struct zms_fs *fs, zms_id_t id, void *data, size_t len) +ssize_t zms_read(struct zms_fs *fs, uint32_t id, void *data, size_t len) { int rc; @@ -1755,7 +1713,7 @@ ssize_t zms_read(struct zms_fs *fs, zms_id_t id, void *data, size_t len) return MIN(rc, len); } -ssize_t zms_get_data_length(struct zms_fs *fs, zms_id_t id) +ssize_t zms_get_data_length(struct zms_fs *fs, uint32_t id) { int rc; diff --git a/subsys/fs/zms/zms_priv.h b/subsys/fs/zms/zms_priv.h index 44cfb2f3d280..84f77296f4f3 100644 --- a/subsys/fs/zms/zms_priv.h +++ b/subsys/fs/zms/zms_priv.h @@ -28,6 +28,7 @@ #endif #define ZMS_LOOKUP_CACHE_NO_ADDR GENMASK64(63, 0) +#define ZMS_HEAD_ID GENMASK(31, 0) #define ZMS_VERSION_MASK GENMASK(7, 0) #define ZMS_GET_VERSION(x) FIELD_GET(ZMS_VERSION_MASK, x) @@ -35,28 +36,14 @@ #define ZMS_MAGIC_NUMBER 0x42 /* murmur3a hash of "ZMS" (MSB) */ #define ZMS_MAGIC_NUMBER_MASK GENMASK(15, 8) #define ZMS_GET_MAGIC_NUMBER(x) FIELD_GET(ZMS_MAGIC_NUMBER_MASK, x) -#define ZMS_ATE_FORMAT_MASK GENMASK(19, 16) -#define ZMS_GET_ATE_FORMAT(x) FIELD_GET(ZMS_ATE_FORMAT_MASK, x) #define ZMS_MIN_ATE_NUM 5 #define ZMS_INVALID_SECTOR_NUM -1 - -#define ZMS_ATE_FORMAT_ID_32BIT 0 -#define ZMS_ATE_FORMAT_ID_64BIT 1 - -#if !defined(CONFIG_ZMS_ID_64BIT) -#define ZMS_DEFAULT_ATE_FORMAT ZMS_ATE_FORMAT_ID_32BIT -#define ZMS_HEAD_ID GENMASK(31, 0) -#else -#define ZMS_DEFAULT_ATE_FORMAT ZMS_ATE_FORMAT_ID_64BIT -#define ZMS_HEAD_ID GENMASK64(63, 0) -#endif /* CONFIG_ZMS_ID_64BIT */ +#define ZMS_DATA_IN_ATE_SIZE 8 /** * @ingroup zms_data_structures * ZMS Allocation Table Entry (ATE) structure - * - * @note This structure depends on @kconfig{CONFIG_ZMS_ID_64BIT}. */ struct zms_ate { /** crc8 check of the entry */ @@ -65,8 +52,6 @@ struct zms_ate { uint8_t cycle_cnt; /** data len within sector */ uint16_t len; - -#if ZMS_DEFAULT_ATE_FORMAT == ZMS_ATE_FORMAT_ID_32BIT /** data id */ uint32_t id; union { @@ -90,22 +75,6 @@ struct zms_ate { }; }; }; - -#elif ZMS_DEFAULT_ATE_FORMAT == ZMS_ATE_FORMAT_ID_64BIT - /** data id */ - uint64_t id; - union { - /** data field used to store small sized data */ - uint8_t data[4]; - /** data offset within sector */ - uint32_t offset; - /** Used to store metadata information such as storage version. */ - uint32_t metadata; - }; -#endif /* ZMS_DEFAULT_ATE_FORMAT */ - } __packed; -#define ZMS_DATA_IN_ATE_SIZE SIZEOF_FIELD(struct zms_ate, data) - #endif /* __ZMS_PRIV_H_ */ From 5e24963c967565af699350d90e5e39c498488c12 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:31 +0300 Subject: [PATCH 0929/2141] Revert "[nrf fromtree] modules: hal_nordic: nrfs: Disabling subscription" This reverts commit 28bdaa3f38fbd01abb4d894fd1f2272306694a7a. Signed-off-by: Jukka Rissanen --- drivers/sensor/nordic/temp/Kconfig | 4 ++-- modules/hal_nordic/nrfs/Kconfig | 8 -------- modules/hal_nordic/nrfs/nrfs_config.h | 4 ---- soc/nordic/nrf92/Kconfig | 2 -- .../temp_sensor/boards/nrf54h20dk_nrf54h20_cpuapp.conf | 1 + west.yml | 2 +- 6 files changed, 4 insertions(+), 17 deletions(-) diff --git a/drivers/sensor/nordic/temp/Kconfig b/drivers/sensor/nordic/temp/Kconfig index 6641fcf5cb29..e32fb1b8fdd6 100644 --- a/drivers/sensor/nordic/temp/Kconfig +++ b/drivers/sensor/nordic/temp/Kconfig @@ -28,11 +28,11 @@ config TEMP_NRFS Enable driver for nRF temperature sensor accessed through the nRF Services (nrfs) layer. -if TEMP_NRFS && NRFS_TEMP_SERVICE_SUBSCRIPTION_ENABLED +if TEMP_NRFS module = TEMP_NRFS thread_priority = 10 thread_stack_size = 1024 source "drivers/sensor/Kconfig.trigger_template" -endif +endif # TEMP_NRFS diff --git a/modules/hal_nordic/nrfs/Kconfig b/modules/hal_nordic/nrfs/Kconfig index 166520d9d017..f5d4e92f94de 100644 --- a/modules/hal_nordic/nrfs/Kconfig +++ b/modules/hal_nordic/nrfs/Kconfig @@ -46,9 +46,6 @@ config NRFS_HAS_TEMP_SERVICE config NRFS_HAS_VBUS_DETECTOR_SERVICE bool -config NRFS_TEMP_SERVICE_HAS_SUBSCRIPTION_SERVICE - bool - config NRFS bool "nRF Services Support" select NRFS_LOCAL_DOMAIN if SOC_NRF54H20_CPUAPP || \ @@ -96,11 +93,6 @@ config NRFS_TEMP_SERVICE_ENABLED depends on NRFS_HAS_TEMP_SERVICE default y -config NRFS_TEMP_SERVICE_SUBSCRIPTION_ENABLED - bool "Subscription feature for the temperature service" - depends on NRFS_TEMP_SERVICE_HAS_SUBSCRIPTION_SERVICE - default y - config NRFS_VBUS_DETECTOR_SERVICE_ENABLED bool "VBUS detector for the USB peripheral" depends on NRFS_HAS_VBUS_DETECTOR_SERVICE diff --git a/modules/hal_nordic/nrfs/nrfs_config.h b/modules/hal_nordic/nrfs/nrfs_config.h index 3ef87a8af393..9d1a9b7b6b35 100644 --- a/modules/hal_nordic/nrfs/nrfs_config.h +++ b/modules/hal_nordic/nrfs/nrfs_config.h @@ -12,10 +12,6 @@ #define NRFS_TEMP_SERVICE_ENABLED #endif -#ifdef CONFIG_NRFS_TEMP_SERVICE_SUBSCRIPTION_ENABLED -#define NRFS_TEMP_SERVICE_SUBSCRIPTION_ENABLED -#endif - #ifdef CONFIG_NRFS_MRAM_SERVICE_ENABLED #define NRFS_MRAM_SERVICE_ENABLED #endif diff --git a/soc/nordic/nrf92/Kconfig b/soc/nordic/nrf92/Kconfig index eea33654f57d..a7769c00b6f2 100644 --- a/soc/nordic/nrf92/Kconfig +++ b/soc/nordic/nrf92/Kconfig @@ -28,7 +28,6 @@ config SOC_NRF9230_ENGB_CPUAPP select NRFS_HAS_PMIC_SERVICE select NRFS_HAS_TEMP_SERVICE select NRFS_HAS_VBUS_DETECTOR_SERVICE - select NRFS_TEMP_SERVICE_HAS_SUBSCRIPTION_SERVICE config SOC_NRF9230_ENGB_CPURAD select ARM @@ -47,7 +46,6 @@ config SOC_NRF9230_ENGB_CPURAD select NRFS_HAS_MRAM_SERVICE select NRFS_HAS_PMIC_SERVICE select NRFS_HAS_TEMP_SERVICE - select NRFS_TEMP_SERVICE_HAS_SUBSCRIPTION_SERVICE config SOC_NRF9230_ENGB_CPUPPR select RISCV_CORE_NORDIC_VPR diff --git a/tests/drivers/sensor/temp_sensor/boards/nrf54h20dk_nrf54h20_cpuapp.conf b/tests/drivers/sensor/temp_sensor/boards/nrf54h20dk_nrf54h20_cpuapp.conf index 219e5ebb46ed..371797173d97 100644 --- a/tests/drivers/sensor/temp_sensor/boards/nrf54h20dk_nrf54h20_cpuapp.conf +++ b/tests/drivers/sensor/temp_sensor/boards/nrf54h20dk_nrf54h20_cpuapp.conf @@ -1 +1,2 @@ CONFIG_NRFS=y +CONFIG_TEMP_NRFS_TRIGGER_OWN_THREAD=y diff --git a/west.yml b/west.yml index 4d20267c8b48..b5ace932db27 100644 --- a/west.yml +++ b/west.yml @@ -200,7 +200,7 @@ manifest: groups: - hal - name: hal_nordic - revision: a6579483deb33112cc763d05a4a3f8085883c1ac + revision: 2f5d4e5868ab573eac932fa4bc142565073c3c04 path: modules/hal/nordic groups: - hal From 93a37c0a5c68628586115c8e88c9a96737642408 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:31 +0300 Subject: [PATCH 0930/2141] Revert "[nrf fromtree] bluetooth: host: gatt: destroy key after hash calc completes" This reverts commit 6b0cb071611744ed47c8ddd810443e23f954483b. Signed-off-by: Jukka Rissanen --- subsys/bluetooth/host/gatt.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/subsys/bluetooth/host/gatt.c b/subsys/bluetooth/host/gatt.c index a99a497749f7..12ec91c78e44 100644 --- a/subsys/bluetooth/host/gatt.c +++ b/subsys/bluetooth/host/gatt.c @@ -755,8 +755,6 @@ static int db_hash_finish(struct gen_hash_state *state) size_t mac_length; psa_status_t ret = psa_mac_sign_finish(&(state->operation), db_hash.hash, 16, &mac_length); - psa_destroy_key(state->key); - if (ret != PSA_SUCCESS) { LOG_ERR("CMAC finish failed %d", ret); return -EIO; From 94be392cf593161cc105f477268c3ce559728593 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:31 +0300 Subject: [PATCH 0931/2141] Revert "[nrf fromlist] boards: nordic: nrf54l15dk: Extend ext memory node with reset GPIO" This reverts commit f940b644def12ee10ae0285ea067236e7c375750. Signed-off-by: Jukka Rissanen --- boards/nordic/nrf54l15dk/nrf54l_05_10_15_cpuapp_common.dtsi | 1 - 1 file changed, 1 deletion(-) diff --git a/boards/nordic/nrf54l15dk/nrf54l_05_10_15_cpuapp_common.dtsi b/boards/nordic/nrf54l15dk/nrf54l_05_10_15_cpuapp_common.dtsi index f3c1d924d27c..46f9d797b61a 100644 --- a/boards/nordic/nrf54l15dk/nrf54l_05_10_15_cpuapp_common.dtsi +++ b/boards/nordic/nrf54l15dk/nrf54l_05_10_15_cpuapp_common.dtsi @@ -134,7 +134,6 @@ has-dpd; t-enter-dpd = <10000>; t-exit-dpd = <35000>; - reset-gpios = <&gpio2 0 GPIO_ACTIVE_LOW>; }; }; From 9b30b75d091444d3135116e69c5d6add5718b78d Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:31 +0300 Subject: [PATCH 0932/2141] Revert "[nrf fromtree] scripts: twister: handlers: Append dev-id for runner nrfutil_next" This reverts commit 4e2451d0397c2b95f5d393f72afd4bd6b58ee81e. Signed-off-by: Jukka Rissanen --- .../src/twister_harness/device/hardware_adapter.py | 2 +- scripts/pylib/twister/twisterlib/handlers.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/pylib/pytest-twister-harness/src/twister_harness/device/hardware_adapter.py b/scripts/pylib/pytest-twister-harness/src/twister_harness/device/hardware_adapter.py index 37751f69d86d..79a3a9356448 100644 --- a/scripts/pylib/pytest-twister-harness/src/twister_harness/device/hardware_adapter.py +++ b/scripts/pylib/pytest-twister-harness/src/twister_harness/device/hardware_adapter.py @@ -76,7 +76,7 @@ def _prepare_runner_args(self) -> tuple[list[str], list[str]]: elif runner == "esp32": extra_args.append("--esp-device") extra_args.append(board_id) - elif runner in ('nrfjprog', 'nrfutil', 'nrfutil_next'): + elif runner in ('nrfjprog', 'nrfutil'): extra_args.append('--dev-id') extra_args.append(board_id) elif runner == 'openocd' and self.device_config.product in ['STM32 STLink', 'STLINK-V3']: diff --git a/scripts/pylib/twister/twisterlib/handlers.py b/scripts/pylib/twister/twisterlib/handlers.py index 30c40e01c8e9..dc1ff2589356 100755 --- a/scripts/pylib/twister/twisterlib/handlers.py +++ b/scripts/pylib/twister/twisterlib/handlers.py @@ -566,7 +566,7 @@ def _create_command(self, runner, hardware): board_id = hardware.probe_id or hardware.id product = hardware.product if board_id is not None: - if runner in ("pyocd", "nrfjprog", "nrfutil", "nrfutil_next"): + if runner in ("pyocd", "nrfjprog", "nrfutil"): command_extra_args.append("--dev-id") command_extra_args.append(board_id) elif runner == "esp32": From 09144576da0eac019cc54a9189c6ea0fdc5d9386 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:31 +0300 Subject: [PATCH 0933/2141] Revert "[nrf fromtree] boards: nordic: nrf54lm20dk: Extend ext memory node with reset GPIO" This reverts commit 58e6d5e8c487ce076048e0b54ed6776411b3999e. Signed-off-by: Jukka Rissanen --- boards/nordic/nrf54lm20dk/nrf54lm20a_cpuapp_common.dtsi | 1 - 1 file changed, 1 deletion(-) diff --git a/boards/nordic/nrf54lm20dk/nrf54lm20a_cpuapp_common.dtsi b/boards/nordic/nrf54lm20dk/nrf54lm20a_cpuapp_common.dtsi index 1d916f8189e4..3591a8009486 100644 --- a/boards/nordic/nrf54lm20dk/nrf54lm20a_cpuapp_common.dtsi +++ b/boards/nordic/nrf54lm20dk/nrf54lm20a_cpuapp_common.dtsi @@ -166,6 +166,5 @@ zephyr_udc0: &usbhs { has-dpd; t-enter-dpd = <10000>; t-exit-dpd = <35000>; - reset-gpios = <&gpio2 0 GPIO_ACTIVE_LOW>; }; }; From f0106726cc71b258682affc49655ec7187edf0c3 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:31 +0300 Subject: [PATCH 0934/2141] Revert "[nrf fromlist] tests: zms: Minor improvements" This reverts commit 664645d0256abc6f5ab40a7b617775ce83d7ccb4. Signed-off-by: Jukka Rissanen --- tests/subsys/fs/zms/src/main.c | 9 +-------- tests/subsys/fs/zms/testcase.yaml | 9 ++++----- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/tests/subsys/fs/zms/src/main.c b/tests/subsys/fs/zms/src/main.c index f307fe1b3a73..14d6291970ca 100644 --- a/tests/subsys/fs/zms/src/main.c +++ b/tests/subsys/fs/zms/src/main.c @@ -752,8 +752,6 @@ ZTEST_F(zms, test_zms_cache_init) num = num_matching_cache_entries(ate_addr, false, &fixture->fs); zassert_equal(num, 1, "invalid cache entry after restart"); -#else - ztest_test_skip(); #endif } @@ -782,8 +780,6 @@ ZTEST_F(zms, test_zms_cache_collission) zassert_equal(err, sizeof(data), "zms_read call failure: %d", err); zassert_equal(data, id, "incorrect data read"); } -#else - ztest_test_skip(); #endif } @@ -833,8 +829,6 @@ ZTEST_F(zms, test_zms_cache_gc) num = num_matching_cache_entries(2ULL << ADDR_SECT_SHIFT, true, &fixture->fs); zassert_equal(num, 2, "invalid cache content after gc"); -#else - ztest_test_skip(); #endif } @@ -892,7 +886,6 @@ ZTEST_F(zms, test_zms_cache_hash_quality) TC_PRINT("Cache occupancy: %u\n", (unsigned int)num); zassert_between_inclusive(num, MIN_CACHE_OCCUPANCY, CONFIG_ZMS_LOOKUP_CACHE_SIZE, "too low cache occupancy - poor hash quality"); -#else - ztest_test_skip(); + #endif } diff --git a/tests/subsys/fs/zms/testcase.yaml b/tests/subsys/fs/zms/testcase.yaml index 4949e1be0c6b..bdee4529f2af 100644 --- a/tests/subsys/fs/zms/testcase.yaml +++ b/tests/subsys/fs/zms/testcase.yaml @@ -8,21 +8,20 @@ tests: extra_args: DTC_OVERLAY_FILE=boards/qemu_x86_ev_0x00.overlay platform_allow: qemu_x86 filesystem.zms.sim.no_erase: - extra_configs: - - CONFIG_FLASH_SIMULATOR_EXPLICIT_ERASE=n + extra_args: CONFIG_FLASH_SIMULATOR_EXPLICIT_ERASE=n platform_allow: qemu_x86 filesystem.zms.sim.corrupt_close: - extra_configs: + extra_args: - CONFIG_FLASH_SIMULATOR_EXPLICIT_ERASE=y - CONFIG_FLASH_SIMULATOR_DOUBLE_WRITES=y platform_allow: qemu_x86 filesystem.zms.cache: - extra_configs: + extra_args: - CONFIG_ZMS_LOOKUP_CACHE=y - CONFIG_ZMS_LOOKUP_CACHE_SIZE=64 platform_allow: native_sim filesystem.zms.data_crc: - extra_configs: + extra_args: - CONFIG_ZMS_DATA_CRC=y platform_allow: - native_sim From 1220ae5e352cbb41f79d1bb65a3f1456913f1e56 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:32 +0300 Subject: [PATCH 0935/2141] Revert "[nrf fromlist] drivers: adc: nrfx_saadc: Fix for negative samples correction" This reverts commit 778ca5fed933dba356bc3c8003915749775ac031. Signed-off-by: Jukka Rissanen --- drivers/adc/adc_nrfx_saadc.c | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/drivers/adc/adc_nrfx_saadc.c b/drivers/adc/adc_nrfx_saadc.c index 614973261746..50aef053fd94 100644 --- a/drivers/adc/adc_nrfx_saadc.c +++ b/drivers/adc/adc_nrfx_saadc.c @@ -550,11 +550,10 @@ static void correct_single_ended(const struct adc_sequence *sequence, nrf_saadc_ { int16_t *sample = (int16_t *)buffer; uint8_t selected_channels = sequence->channels; - uint8_t divide_mask = m_data.divide_single_ended_value; - uint8_t single_ended_mask = m_data.single_ended_channels; + uint8_t divide_single_ended_value = m_data.divide_single_ended_value; if (m_data.internal_timer_enabled) { - if (selected_channels & divide_mask) { + if (selected_channels & divide_single_ended_value) { for (int i = 0; i < num_samples; i++) { sample[i] /= 2; } @@ -565,22 +564,20 @@ static void correct_single_ended(const struct adc_sequence *sequence, nrf_saadc_ } } } - return; - } - - for (uint16_t channel_bit = BIT(0); channel_bit <= single_ended_mask; channel_bit <<= 1) { - if (!(channel_bit & selected_channels)) { - continue; - } - - if (channel_bit & single_ended_mask) { - if (channel_bit & divide_mask) { - *sample /= 2; - } else if (*sample < 0) { - *sample = 0; + } else { + uint8_t single_ended_channels = m_data.single_ended_channels; + + for (uint16_t channel_bit = BIT(0); channel_bit <= single_ended_channels; + channel_bit <<= 1) { + if (channel_bit & selected_channels & single_ended_channels) { + if (channel_bit & divide_single_ended_value) { + *sample /= 2; + } else if (*sample < 0) { + *sample = 0; + } } + sample++; } - sample++; } } From a0ea6fd36991d39f65696f4312d26fcc261da32c Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:32 +0300 Subject: [PATCH 0936/2141] Revert "[nrf fromtree] drivers: adc: nrfx: enable negative values for single-ended ADC readings" This reverts commit 77197cecc0575a068c1bd79fcf0aee4eed5ff543. Signed-off-by: Jukka Rissanen --- drivers/adc/adc_nrfx_saadc.c | 46 ++++++---------------- include/zephyr/dt-bindings/adc/nrf-saadc.h | 24 ----------- 2 files changed, 13 insertions(+), 57 deletions(-) diff --git a/drivers/adc/adc_nrfx_saadc.c b/drivers/adc/adc_nrfx_saadc.c index 50aef053fd94..8c21a34f1108 100644 --- a/drivers/adc/adc_nrfx_saadc.c +++ b/drivers/adc/adc_nrfx_saadc.c @@ -100,7 +100,6 @@ BUILD_ASSERT((NRF_SAADC_AIN0 == NRF_SAADC_INPUT_AIN0) && struct driver_data { struct adc_context ctx; uint8_t single_ended_channels; - uint8_t divide_single_ended_value; uint8_t active_channel_cnt; void *mem_reg; void *user_buffer; @@ -192,6 +191,7 @@ static int input_assign(nrf_saadc_input_t *pin_p, if (channel_cfg->differential) { if (channel_cfg->input_negative > ARRAY_SIZE(saadc_psels) || + channel_cfg->input_negative < NRF_SAADC_AIN0 || (IS_ENABLED(CONFIG_NRF_PLATFORM_HALTIUM) && (channel_cfg->input_positive > NRF_SAADC_AIN7) != (channel_cfg->input_negative > NRF_SAADC_AIN7))) { @@ -199,17 +199,14 @@ static int input_assign(nrf_saadc_input_t *pin_p, channel_cfg->input_negative); return -EINVAL; } - *pin_n = channel_cfg->input_negative == NRF_SAADC_GND ? - NRF_SAADC_INPUT_DISABLED : - saadc_psels[channel_cfg->input_negative]; + *pin_n = saadc_psels[channel_cfg->input_negative]; } else { *pin_n = NRF_SAADC_INPUT_DISABLED; } #else *pin_p = channel_cfg->input_positive; - *pin_n = (channel_cfg->differential && (channel_cfg->input_negative != NRF_SAADC_GND)) - ? channel_cfg->input_negative - : NRF_SAADC_INPUT_DISABLED; + *pin_n = channel_cfg->differential ? channel_cfg->input_negative + : NRF_SAADC_INPUT_DISABLED; #endif LOG_DBG("ADC positive input: %d", *pin_p); LOG_DBG("ADC negative input: %d", *pin_n); @@ -359,18 +356,11 @@ static int adc_nrfx_channel_setup(const struct device *dev, * after ADC sequence ends. */ if (channel_cfg->differential) { - if (channel_cfg->input_negative == NRF_SAADC_GND) { - ch_cfg->mode = NRF_SAADC_MODE_SINGLE_ENDED; - m_data.single_ended_channels |= BIT(channel_cfg->channel_id); - m_data.divide_single_ended_value |= BIT(channel_cfg->channel_id); - } else { - ch_cfg->mode = NRF_SAADC_MODE_DIFFERENTIAL; - m_data.single_ended_channels &= ~BIT(channel_cfg->channel_id); - } + ch_cfg->mode = NRF_SAADC_MODE_DIFFERENTIAL; + m_data.single_ended_channels &= ~BIT(channel_cfg->channel_id); } else { ch_cfg->mode = NRF_SAADC_MODE_SINGLE_ENDED; m_data.single_ended_channels |= BIT(channel_cfg->channel_id); - m_data.divide_single_ended_value &= ~BIT(channel_cfg->channel_id); } nrfx_err_t ret = nrfx_saadc_channel_config(&cfg); @@ -549,32 +539,22 @@ static void correct_single_ended(const struct adc_sequence *sequence, nrf_saadc_ uint16_t num_samples) { int16_t *sample = (int16_t *)buffer; - uint8_t selected_channels = sequence->channels; - uint8_t divide_single_ended_value = m_data.divide_single_ended_value; if (m_data.internal_timer_enabled) { - if (selected_channels & divide_single_ended_value) { - for (int i = 0; i < num_samples; i++) { - sample[i] /= 2; - } - } else { - for (int i = 0; i < num_samples; i++) { - if (sample[i] < 0) { - sample[i] = 0; - } + for (int i = 0; i < num_samples; i++) { + if (sample[i] < 0) { + sample[i] = 0; } } } else { + uint8_t selected_channels = sequence->channels; uint8_t single_ended_channels = m_data.single_ended_channels; for (uint16_t channel_bit = BIT(0); channel_bit <= single_ended_channels; channel_bit <<= 1) { - if (channel_bit & selected_channels & single_ended_channels) { - if (channel_bit & divide_single_ended_value) { - *sample /= 2; - } else if (*sample < 0) { - *sample = 0; - } + if ((channel_bit & selected_channels & single_ended_channels) && + (*sample < 0)) { + *sample = 0; } sample++; } diff --git a/include/zephyr/dt-bindings/adc/nrf-saadc.h b/include/zephyr/dt-bindings/adc/nrf-saadc.h index e5a86150cd43..4a3deb95cff9 100644 --- a/include/zephyr/dt-bindings/adc/nrf-saadc.h +++ b/include/zephyr/dt-bindings/adc/nrf-saadc.h @@ -7,30 +7,6 @@ #ifndef ZEPHYR_INCLUDE_DT_BINDINGS_ADC_NRF_SAADC_H_ #define ZEPHYR_INCLUDE_DT_BINDINGS_ADC_NRF_SAADC_H_ -/** - * @brief Short ADC negative input to ground - * - * @details The nRF SAADC hardware only supports differential readings. - * The nRF SAADC SE (single ended) mode is differential with the negative - * input shorted to GND (ground). To use the nRF SAADC SE mode, set the - * negative input to NRF_SAADC_GND: - * - * @code{.dts} - * zephyr,input-positive = ; - * zephyr,input-negative = ; - * @endcode - * - * The nRF SAADC driver also supports using the nRF SAADC SE mode in - * emulated "single-ended" mode, as defined by zephyr. In this mode, - * negative readings will be clamped to 0 by software to emulate the - * behavior of an ADC in "single-ended" mode, as defined by zephyr. To - * do this, only define the positive input: - * - * @code{.dts} - * zephyr,input-positive = ; - * @endcode - */ -#define NRF_SAADC_GND 0 #define NRF_SAADC_AIN0 1 #define NRF_SAADC_AIN1 2 #define NRF_SAADC_AIN2 3 From d55c8b8e7dac709c0511ecea83f13d76b59f1b76 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:32 +0300 Subject: [PATCH 0937/2141] Revert "[nrf fromtree] drivers: adc: nrfx_saadc: Add support for SAADC internal sampling timer" This reverts commit 605e7799371de1ff935617a1e95fa2f38c208c2c. Signed-off-by: Jukka Rissanen --- drivers/adc/adc_nrfx_saadc.c | 169 ++++++++--------------------------- 1 file changed, 35 insertions(+), 134 deletions(-) diff --git a/drivers/adc/adc_nrfx_saadc.c b/drivers/adc/adc_nrfx_saadc.c index 8c21a34f1108..100c3fa66efa 100644 --- a/drivers/adc/adc_nrfx_saadc.c +++ b/drivers/adc/adc_nrfx_saadc.c @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +#define ADC_CONTEXT_USES_KERNEL_TIMER #include "adc_context.h" #include #include @@ -103,20 +104,15 @@ struct driver_data { uint8_t active_channel_cnt; void *mem_reg; void *user_buffer; - struct k_timer timer; - bool internal_timer_enabled; }; static struct driver_data m_data = { + ADC_CONTEXT_INIT_TIMER(m_data, ctx), ADC_CONTEXT_INIT_LOCK(m_data, ctx), ADC_CONTEXT_INIT_SYNC(m_data, ctx), .mem_reg = DMM_DEV_TO_REG(DT_NODELABEL(adc)), - .internal_timer_enabled = false, }; -/* Maximum value of the internal timer interval in microseconds. */ -#define ADC_INTERNAL_TIMER_INTERVAL_MAX_US 128U - /* Forward declaration */ static void event_handler(const nrfx_saadc_evt_t *event); @@ -366,7 +362,7 @@ static int adc_nrfx_channel_setup(const struct device *dev, nrfx_err_t ret = nrfx_saadc_channel_config(&cfg); if (ret != NRFX_SUCCESS) { - LOG_ERR("Cannot configure channel %d: 0x%08x", channel_cfg->channel_id, ret); + LOG_ERR("Cannot configure channel %d: %d", channel_cfg->channel_id, ret); return -EINVAL; } @@ -389,58 +385,22 @@ static void adc_context_start_sampling(struct adc_context *ctx) static void adc_context_update_buffer_pointer(struct adc_context *ctx, bool repeat) { - if (!m_data.internal_timer_enabled) { - void *samples_buffer; - - if (!repeat) { - m_data.user_buffer = - (uint16_t *)m_data.user_buffer + m_data.active_channel_cnt; - } - - int error = dmm_buffer_in_prepare( - m_data.mem_reg, m_data.user_buffer, - NRFX_SAADC_SAMPLES_TO_BYTES(m_data.active_channel_cnt), &samples_buffer); - if (error != 0) { - LOG_ERR("DMM buffer allocation failed err=%d", error); - adc_context_complete(ctx, -EIO); - return; - } - - nrfx_err_t nrfx_err = - nrfx_saadc_buffer_set(samples_buffer, m_data.active_channel_cnt); - if (nrfx_err != NRFX_SUCCESS) { - LOG_ERR("Failed to set buffer: 0x%08x", nrfx_err); - adc_context_complete(ctx, -EIO); - } - } -} - -static inline void adc_context_enable_timer(struct adc_context *ctx) -{ - if (!m_data.internal_timer_enabled) { - k_timer_start(&m_data.timer, K_NO_WAIT, K_USEC(ctx->options.interval_us)); - } else { - nrfx_err_t ret = nrfx_saadc_mode_trigger(); + void *samples_buffer; - if (ret != NRFX_SUCCESS) { - LOG_ERR("Cannot start sampling: 0x%08x", ret); - adc_context_complete(&m_data.ctx, -EIO); - } + if (!repeat) { + m_data.user_buffer = (uint16_t *)m_data.user_buffer + m_data.active_channel_cnt; } -} -static inline void adc_context_disable_timer(struct adc_context *ctx) -{ - if (!m_data.internal_timer_enabled) { - k_timer_stop(&m_data.timer); + int error = dmm_buffer_in_prepare( + m_data.mem_reg, m_data.user_buffer, + NRFX_SAADC_SAMPLES_TO_BYTES(m_data.active_channel_cnt), + &samples_buffer); + if (error != 0) { + LOG_ERR("DMM buffer allocation failed err=%d", error); + adc_context_complete(ctx, -EIO); } -} -static void external_timer_expired_handler(struct k_timer *timer_id) -{ - ARG_UNUSED(timer_id); - - adc_context_request_next_sampling(&m_data.ctx); + nrfx_saadc_buffer_set(samples_buffer, m_data.active_channel_cnt); } static int get_resolution(const struct adc_sequence *sequence, nrf_saadc_resolution_t *resolution) @@ -535,46 +495,24 @@ static bool has_single_ended(const struct adc_sequence *sequence) return sequence->channels & m_data.single_ended_channels; } -static void correct_single_ended(const struct adc_sequence *sequence, nrf_saadc_value_t *buffer, - uint16_t num_samples) +static void correct_single_ended(const struct adc_sequence *sequence, nrf_saadc_value_t *buffer) { + uint16_t channel_bit = BIT(0); + uint8_t selected_channels = sequence->channels; + uint8_t single_ended_channels = m_data.single_ended_channels; int16_t *sample = (int16_t *)buffer; - if (m_data.internal_timer_enabled) { - for (int i = 0; i < num_samples; i++) { - if (sample[i] < 0) { - sample[i] = 0; - } - } - } else { - uint8_t selected_channels = sequence->channels; - uint8_t single_ended_channels = m_data.single_ended_channels; - - for (uint16_t channel_bit = BIT(0); channel_bit <= single_ended_channels; - channel_bit <<= 1) { - if ((channel_bit & selected_channels & single_ended_channels) && - (*sample < 0)) { + while (channel_bit <= single_ended_channels) { + if (channel_bit & selected_channels) { + if ((channel_bit & single_ended_channels) && (*sample < 0)) { *sample = 0; } + sample++; } - } -} -/* The internal timer runs at 16 MHz, so to convert the interval in microseconds - * to the internal timer CC value, we can use the formula: - * interval_cc = interval_us * 16 MHz - * where 16 MHz is the frequency of the internal timer. - * - * The maximum value for interval_cc is 2047, which corresponds to - * approximately 7816 Hz ~ 128us. - * The minimum value for interval_cc is depends on the SoC. - */ -static inline uint16_t interval_to_cc(uint16_t interval_us) -{ - NRFX_ASSERT((interval_us <= ADC_INTERNAL_TIMER_INTERVAL_MAX_US) && (interval_us > 0)); - - return (interval_us * 16) - 1; + channel_bit <<= 1; + } } static int start_read(const struct device *dev, @@ -624,29 +562,10 @@ static int start_read(const struct device *dev, return error; } - if ((active_channel_cnt == 1) && (sequence->options != NULL) && - (sequence->options->callback == NULL) && - (sequence->options->interval_us <= ADC_INTERNAL_TIMER_INTERVAL_MAX_US) && - (sequence->options->interval_us > 0)) { - - nrfx_saadc_adv_config_t adv_config = { - .oversampling = oversampling, - .burst = NRF_SAADC_BURST_DISABLED, - .internal_timer_cc = interval_to_cc(sequence->options->interval_us), - .start_on_end = true, - }; - - m_data.internal_timer_enabled = true; - - nrfx_err = nrfx_saadc_advanced_mode_set(selected_channels, resolution, &adv_config, - event_handler); - } else { - m_data.internal_timer_enabled = false; - - nrfx_err = nrfx_saadc_simple_mode_set(selected_channels, resolution, oversampling, - event_handler); - } - + nrfx_err = nrfx_saadc_simple_mode_set(selected_channels, + resolution, + oversampling, + event_handler); if (nrfx_err != NRFX_SUCCESS) { return -EINVAL; } @@ -659,12 +578,10 @@ static int start_read(const struct device *dev, m_data.active_channel_cnt = active_channel_cnt; m_data.user_buffer = sequence->buffer; - error = dmm_buffer_in_prepare( - m_data.mem_reg, m_data.user_buffer, - (m_data.internal_timer_enabled - ? NRFX_SAADC_SAMPLES_TO_BYTES(1 + sequence->options->extra_samplings) - : NRFX_SAADC_SAMPLES_TO_BYTES(active_channel_cnt)), - &samples_buffer); + error = dmm_buffer_in_prepare(m_data.mem_reg, + m_data.user_buffer, + NRFX_SAADC_SAMPLES_TO_BYTES(active_channel_cnt), + &samples_buffer); if (error != 0) { LOG_ERR("DMM buffer allocation failed err=%d", error); return error; @@ -673,15 +590,7 @@ static int start_read(const struct device *dev, /* Buffer is filled in chunks, each chunk composed of number of samples equal to number * of active channels. Buffer pointer is advanced and reloaded after each chunk. */ - nrfx_err = nrfx_saadc_buffer_set( - samples_buffer, - (m_data.internal_timer_enabled - ? (1 + sequence->options->extra_samplings) - : active_channel_cnt)); - if (nrfx_err != NRFX_SUCCESS) { - LOG_ERR("Failed to set buffer: 0x%08x", nrfx_err); - return -EINVAL; - } + nrfx_saadc_buffer_set(samples_buffer, active_channel_cnt); adc_context_start_read(&m_data.ctx, sequence); @@ -724,15 +633,11 @@ static void event_handler(const nrfx_saadc_evt_t *event) if (event->type == NRFX_SAADC_EVT_DONE) { dmm_buffer_in_release( m_data.mem_reg, m_data.user_buffer, - (m_data.internal_timer_enabled - ? NRFX_SAADC_SAMPLES_TO_BYTES( - 1 + m_data.ctx.sequence.options->extra_samplings) - : NRFX_SAADC_SAMPLES_TO_BYTES(m_data.active_channel_cnt)), + NRFX_SAADC_SAMPLES_TO_BYTES(m_data.active_channel_cnt), event->data.done.p_buffer); if (has_single_ended(&m_data.ctx.sequence)) { - correct_single_ended(&m_data.ctx.sequence, m_data.user_buffer, - event->data.done.size); + correct_single_ended(&m_data.ctx.sequence, m_data.user_buffer); } nrfy_saadc_disable(NRF_SAADC); adc_context_on_sampling_done(&m_data.ctx, DEVICE_DT_INST_GET(0)); @@ -742,8 +647,6 @@ static void event_handler(const nrfx_saadc_evt_t *event) LOG_ERR("Cannot start sampling: 0x%08x", err); adc_context_complete(&m_data.ctx, -EIO); } - } else if (event->type == NRFX_SAADC_EVT_FINISHED) { - adc_context_complete(&m_data.ctx, 0); } } @@ -751,8 +654,6 @@ static int init_saadc(const struct device *dev) { nrfx_err_t err; - k_timer_init(&m_data.timer, external_timer_expired_handler, NULL); - /* The priority value passed here is ignored (see nrfx_glue.h). */ err = nrfx_saadc_init(0); if (err != NRFX_SUCCESS) { From 994fb372772fb3cab1752ea3f4f9976960ceb93a Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:32 +0300 Subject: [PATCH 0938/2141] Revert "[nrf fromlist] boards: nordic: nrf54h20dk: ipc to cpusys with unbound" This reverts commit 6872776607a93ee279176a32a73f4e362ba066d9. Signed-off-by: Jukka Rissanen --- boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf.dtsi | 2 -- 1 file changed, 2 deletions(-) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf.dtsi b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf.dtsi index f7e7d63d548d..f31d909b6f94 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf.dtsi +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf.dtsi @@ -32,7 +32,6 @@ cpuapp_cpusys_ipc: ipc-2-12 { compatible = "zephyr,ipc-icmsg"; - unbound = "enable"; status = "disabled"; dcache-alignment = <32>; mboxes = <&cpuapp_bellboard 6>, @@ -57,7 +56,6 @@ cpurad_cpusys_ipc: ipc-3-12 { compatible = "zephyr,ipc-icmsg"; - unbound = "enable"; status = "disabled"; dcache-alignment = <32>; mboxes = <&cpurad_bellboard 6>, From bdbe615aac657b403b044781ee83374179827c17 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:32 +0300 Subject: [PATCH 0939/2141] Revert "[nrf noup] tests: crypto: Add ENTROPY_GENERATOR in overlays" This reverts commit 6997770e93b3fc57c5325b430fb806f13d345f40. Signed-off-by: Jukka Rissanen --- .../mbedtls_psa/boards/nrf54l05dk_nrf54l05_cpuapp.conf | 6 ------ .../mbedtls_psa/boards/nrf54l15dk_nrf54l10_cpuapp.conf | 6 ------ .../mbedtls_psa/boards/nrf54l15dk_nrf54l15_cpuapp.conf | 6 ------ .../mbedtls_psa/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf | 6 ------ .../mbedtls_psa/boards/nrf54lv10dk_nrf54lv10a_cpuapp.conf | 6 ------ 5 files changed, 30 deletions(-) delete mode 100644 tests/crypto/mbedtls_psa/boards/nrf54l05dk_nrf54l05_cpuapp.conf delete mode 100644 tests/crypto/mbedtls_psa/boards/nrf54l15dk_nrf54l10_cpuapp.conf delete mode 100644 tests/crypto/mbedtls_psa/boards/nrf54l15dk_nrf54l15_cpuapp.conf delete mode 100644 tests/crypto/mbedtls_psa/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf delete mode 100644 tests/crypto/mbedtls_psa/boards/nrf54lv10dk_nrf54lv10a_cpuapp.conf diff --git a/tests/crypto/mbedtls_psa/boards/nrf54l05dk_nrf54l05_cpuapp.conf b/tests/crypto/mbedtls_psa/boards/nrf54l05dk_nrf54l05_cpuapp.conf deleted file mode 100644 index 70c601183ddf..000000000000 --- a/tests/crypto/mbedtls_psa/boards/nrf54l05dk_nrf54l05_cpuapp.conf +++ /dev/null @@ -1,6 +0,0 @@ -# -# Copyright (c) 2024 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause -# -CONFIG_ENTROPY_GENERATOR=y diff --git a/tests/crypto/mbedtls_psa/boards/nrf54l15dk_nrf54l10_cpuapp.conf b/tests/crypto/mbedtls_psa/boards/nrf54l15dk_nrf54l10_cpuapp.conf deleted file mode 100644 index 70c601183ddf..000000000000 --- a/tests/crypto/mbedtls_psa/boards/nrf54l15dk_nrf54l10_cpuapp.conf +++ /dev/null @@ -1,6 +0,0 @@ -# -# Copyright (c) 2024 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause -# -CONFIG_ENTROPY_GENERATOR=y diff --git a/tests/crypto/mbedtls_psa/boards/nrf54l15dk_nrf54l15_cpuapp.conf b/tests/crypto/mbedtls_psa/boards/nrf54l15dk_nrf54l15_cpuapp.conf deleted file mode 100644 index 70c601183ddf..000000000000 --- a/tests/crypto/mbedtls_psa/boards/nrf54l15dk_nrf54l15_cpuapp.conf +++ /dev/null @@ -1,6 +0,0 @@ -# -# Copyright (c) 2024 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause -# -CONFIG_ENTROPY_GENERATOR=y diff --git a/tests/crypto/mbedtls_psa/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf b/tests/crypto/mbedtls_psa/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf deleted file mode 100644 index 70c601183ddf..000000000000 --- a/tests/crypto/mbedtls_psa/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf +++ /dev/null @@ -1,6 +0,0 @@ -# -# Copyright (c) 2024 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause -# -CONFIG_ENTROPY_GENERATOR=y diff --git a/tests/crypto/mbedtls_psa/boards/nrf54lv10dk_nrf54lv10a_cpuapp.conf b/tests/crypto/mbedtls_psa/boards/nrf54lv10dk_nrf54lv10a_cpuapp.conf deleted file mode 100644 index 70c601183ddf..000000000000 --- a/tests/crypto/mbedtls_psa/boards/nrf54lv10dk_nrf54lv10a_cpuapp.conf +++ /dev/null @@ -1,6 +0,0 @@ -# -# Copyright (c) 2024 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause -# -CONFIG_ENTROPY_GENERATOR=y From 108556c2e96a065eb0d7caa8d6190f0159628b63 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:32 +0300 Subject: [PATCH 0940/2141] Revert "[nrf fromtree] tests: vector_table_relocation: fix a mis-use of SRAM_SIZE" This reverts commit 1fe49abe2fccbdacdfbc9b2876d6ca0245963085. Signed-off-by: Jukka Rissanen --- .../application_development/vector_table_relocation/src/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/application_development/vector_table_relocation/src/main.c b/tests/application_development/vector_table_relocation/src/main.c index d5fa7c8ed473..d102f713df53 100644 --- a/tests/application_development/vector_table_relocation/src/main.c +++ b/tests/application_development/vector_table_relocation/src/main.c @@ -55,7 +55,7 @@ ZTEST(vector_table_relocation, test_vector_table_in_ram) printf("VTOR address: 0x%x\n", vtor_address); zassert_true(vtor_address >= CONFIG_SRAM_BASE_ADDRESS && - vtor_address <= CONFIG_SRAM_BASE_ADDRESS + CONFIG_SRAM_SIZE * 1024U, + vtor_address <= CONFIG_SRAM_BASE_ADDRESS + CONFIG_SRAM_SIZE, "Vector table is not in RAM! Address: 0x%x", vtor_address); } From 073ce56d5ea7b7327d86a3fdaf7a3b8c6069d81b Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:32 +0300 Subject: [PATCH 0941/2141] Revert "[nrf fromlist] net: zperf: Improve UDP multicast upload" This reverts commit f637c2ca51eee3c26bcc6a53619f4dd1c64d3b4f. Signed-off-by: Jukka Rissanen --- include/zephyr/net/zperf.h | 1 - subsys/net/lib/zperf/zperf_shell.c | 75 +++++++++-------------- subsys/net/lib/zperf/zperf_udp_uploader.c | 16 +---- 3 files changed, 33 insertions(+), 59 deletions(-) diff --git a/include/zephyr/net/zperf.h b/include/zephyr/net/zperf.h index 3b4e9bbb684e..e26a6076f7a6 100644 --- a/include/zephyr/net/zperf.h +++ b/include/zephyr/net/zperf.h @@ -90,7 +90,6 @@ struct zperf_results { uint64_t client_time_in_us; /**< Client connection time in microseconds */ uint32_t packet_size; /**< Packet size */ uint32_t nb_packets_errors; /**< Number of packet errors */ - bool is_multicast; /**< True if this session used IP multicast */ }; /** diff --git a/subsys/net/lib/zperf/zperf_shell.c b/subsys/net/lib/zperf/zperf_shell.c index 5ebaada1b509..dca889b49a9f 100644 --- a/subsys/net/lib/zperf/zperf_shell.c +++ b/subsys/net/lib/zperf/zperf_shell.c @@ -516,56 +516,41 @@ static void shell_udp_upload_print_stats(const struct shell *sh, client_rate_in_kbps = 0U; } - /* Print warning if no server stats in unicast case; for multicast, - * server stats are not expected. - */ - if (!rate_in_kbps && !results->is_multicast) { + if (!rate_in_kbps) { shell_fprintf(sh, SHELL_ERROR, "LAST PACKET NOT RECEIVED!!!\n"); } - if (results->is_multicast) { - shell_fprintf(sh, SHELL_NORMAL, "Statistics (client only)\n"); - shell_fprintf(sh, SHELL_NORMAL, "Duration:\t\t"); - print_number_64(sh, results->client_time_in_us, TIME_US, TIME_US_UNIT); - shell_fprintf(sh, SHELL_NORMAL, "\n"); - shell_fprintf(sh, SHELL_NORMAL, "Num packets:\t\t%u\n", - results->nb_packets_sent); - shell_fprintf(sh, SHELL_NORMAL, "Rate:\t\t\t"); - print_number(sh, client_rate_in_kbps, KBPS, KBPS_UNIT); - shell_fprintf(sh, SHELL_NORMAL, "\n"); - } else { - shell_fprintf(sh, SHELL_NORMAL, - "Statistics:\t\tserver\t(client)\n"); - shell_fprintf(sh, SHELL_NORMAL, "Duration:\t\t"); - print_number_64(sh, results->time_in_us, TIME_US, - TIME_US_UNIT); - shell_fprintf(sh, SHELL_NORMAL, "\t("); - print_number_64(sh, results->client_time_in_us, TIME_US, - TIME_US_UNIT); - shell_fprintf(sh, SHELL_NORMAL, ")\n"); - - shell_fprintf(sh, SHELL_NORMAL, "Num packets:\t\t%u\t(%u)\n", - results->nb_packets_rcvd, - results->nb_packets_sent); + shell_fprintf(sh, SHELL_NORMAL, + "Statistics:\t\tserver\t(client)\n"); + shell_fprintf(sh, SHELL_NORMAL, "Duration:\t\t"); + print_number_64(sh, results->time_in_us, TIME_US, + TIME_US_UNIT); + shell_fprintf(sh, SHELL_NORMAL, "\t("); + print_number_64(sh, results->client_time_in_us, TIME_US, + TIME_US_UNIT); + shell_fprintf(sh, SHELL_NORMAL, ")\n"); + + shell_fprintf(sh, SHELL_NORMAL, "Num packets:\t\t%u\t(%u)\n", + results->nb_packets_rcvd, + results->nb_packets_sent); - shell_fprintf(sh, SHELL_NORMAL, - "Num packets out order:\t%u\n", - results->nb_packets_outorder); - shell_fprintf(sh, SHELL_NORMAL, "Num packets lost:\t%u\n", - results->nb_packets_lost); - - shell_fprintf(sh, SHELL_NORMAL, "Jitter:\t\t\t"); - print_number(sh, results->jitter_in_us, TIME_US, - TIME_US_UNIT); - shell_fprintf(sh, SHELL_NORMAL, "\n"); - - shell_fprintf(sh, SHELL_NORMAL, "Rate:\t\t\t"); - print_number(sh, rate_in_kbps, KBPS, KBPS_UNIT); - shell_fprintf(sh, SHELL_NORMAL, "\t("); - print_number(sh, client_rate_in_kbps, KBPS, KBPS_UNIT); - shell_fprintf(sh, SHELL_NORMAL, ")\n"); - } + shell_fprintf(sh, SHELL_NORMAL, + "Num packets out order:\t%u\n", + results->nb_packets_outorder); + shell_fprintf(sh, SHELL_NORMAL, "Num packets lost:\t%u\n", + results->nb_packets_lost); + + shell_fprintf(sh, SHELL_NORMAL, "Jitter:\t\t\t"); + print_number(sh, results->jitter_in_us, TIME_US, + TIME_US_UNIT); + shell_fprintf(sh, SHELL_NORMAL, "\n"); + + shell_fprintf(sh, SHELL_NORMAL, "Rate:\t\t\t"); + print_number(sh, rate_in_kbps, KBPS, KBPS_UNIT); + shell_fprintf(sh, SHELL_NORMAL, "\t("); + print_number(sh, client_rate_in_kbps, KBPS, KBPS_UNIT); + shell_fprintf(sh, SHELL_NORMAL, ")\n"); #ifdef CONFIG_ZPERF_SESSION_PER_THREAD if (is_async) { diff --git a/subsys/net/lib/zperf/zperf_udp_uploader.c b/subsys/net/lib/zperf/zperf_udp_uploader.c index f4944d5777fb..344ea39560b6 100644 --- a/subsys/net/lib/zperf/zperf_udp_uploader.c +++ b/subsys/net/lib/zperf/zperf_udp_uploader.c @@ -105,14 +105,10 @@ static inline int zperf_upload_fin(int sock, continue; } - /* For multicast, do not wait for a server ack. Keep resending FIN - * for the configured number of attempts by forcing another loop - * iteration. + /* Multicast only send the negative sequence number packet + * and doesn't wait for a server ack */ - if (is_mcast_pkt) { - ret = 0; - continue; - } else { + if (!is_mcast_pkt) { /* Receive statistics */ ret = zsock_setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, &rcvtimeo, sizeof(rcvtimeo)); @@ -130,11 +126,6 @@ static inline int zperf_upload_fin(int sock, } } - /* In multicast, we never expect a stats reply. Stop here. */ - if (is_mcast_pkt) { - return 0; - } - /* Decode statistics */ if (ret > 0) { zperf_upload_decode_stat(stats, ret, results); @@ -308,7 +299,6 @@ static int udp_upload(int sock, int port, results->client_time_in_us = k_ticks_to_us_ceil64(end_time - start_time); results->packet_size = packet_size; - results->is_multicast = is_mcast_pkt; return 0; } From b30921c767e31ee873a09cb35fe37fb1ff4b0fbb Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:32 +0300 Subject: [PATCH 0942/2141] Revert "[nrf fromtree] bootloader: mcuboot: Fix encryption not being selected in bootloader" This reverts commit 51f0b2c5c449b08826faef7cea0df23e9856ceed. Signed-off-by: Jukka Rissanen --- .../sysbuild/image_configurations/BOOTLOADER_image_default.cmake | 1 - 1 file changed, 1 deletion(-) diff --git a/share/sysbuild/image_configurations/BOOTLOADER_image_default.cmake b/share/sysbuild/image_configurations/BOOTLOADER_image_default.cmake index 1c09b452ee40..1267fc1e1ef6 100644 --- a/share/sysbuild/image_configurations/BOOTLOADER_image_default.cmake +++ b/share/sysbuild/image_configurations/BOOTLOADER_image_default.cmake @@ -80,7 +80,6 @@ foreach(loopkeytype ${keytypes}) endforeach() if(SB_CONFIG_BOOT_ENCRYPTION) - set_config_bool(${image} CONFIG_BOOT_ENCRYPT_IMAGE y) set_config_string(${ZCMAKE_APPLICATION} CONFIG_BOOT_ENCRYPTION_KEY_FILE "${SB_CONFIG_BOOT_ENCRYPTION_KEY_FILE}") if(SB_CONFIG_BOOT_ENCRYPTION_ALG_AES_128) set_config_bool(${ZCMAKE_APPLICATION} CONFIG_BOOT_ENCRYPT_ALG_AES_128 y) From 7f0867de4bf6640d376ba960e886e0f48b3808a3 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:32 +0300 Subject: [PATCH 0943/2141] Revert "[nrf fromtree] bootloader: mcuboot: Changes needed to support AES256" This reverts commit f5564e36c6030a0e4c134642a44bd5b1ba69e599. Signed-off-by: Jukka Rissanen --- cmake/mcuboot.cmake | 7 ------- modules/Kconfig.mcuboot | 16 ---------------- .../BOOTLOADER_image_default.cmake | 9 --------- .../MAIN_image_default.cmake | 8 -------- share/sysbuild/images/bootloader/CMakeLists.txt | 4 ++++ share/sysbuild/images/bootloader/Kconfig | 16 ---------------- 6 files changed, 4 insertions(+), 56 deletions(-) diff --git a/cmake/mcuboot.cmake b/cmake/mcuboot.cmake index 964d694983b3..ac37b175a31b 100644 --- a/cmake/mcuboot.cmake +++ b/cmake/mcuboot.cmake @@ -159,13 +159,6 @@ function(zephyr_mcuboot_tasks) set(imgtool_args --sha 512 ${imgtool_args}) endif() - if(NOT "${keyfile_enc}" STREQUAL "") - if(CONFIG_MCUBOOT_ENCRYPTION_ALG_AES_256) - # Note: this overrides the default behavior of using AES-128 - set(imgtool_args ${imgtool_args} --encrypt-keylen 256) - endif() - endif() - # Extensionless prefix of any output file. set(output ${ZEPHYR_BINARY_DIR}/${KERNEL_NAME}) diff --git a/modules/Kconfig.mcuboot b/modules/Kconfig.mcuboot index d6b4465de2d4..a95dc34b72f7 100644 --- a/modules/Kconfig.mcuboot +++ b/modules/Kconfig.mcuboot @@ -89,22 +89,6 @@ config MCUBOOT_ENCRYPTION_KEY_FILE If left empty, you must encrypt the Zephyr binaries manually. -if MCUBOOT_ENCRYPTION_KEY_FILE != "" - -choice MCUBOOT_ENCRYPTION_ALG - prompt "Algorithm used for image encryption" - default MCUBOOT_ENCRYPTION_ALG_AES_128 - -config MCUBOOT_ENCRYPTION_ALG_AES_128 - bool "Use AES-128 for image encryption" - -config MCUBOOT_ENCRYPTION_ALG_AES_256 - bool "Use AES-256 for image encryption" - -endchoice # MCUBOOT_ENCRYPTION_ALG - -endif # MCUBOOT_ENCRYPTION_KEY_FILE != "" - config MCUBOOT_IMGTOOL_SIGN_VERSION string "Version to pass to imgtool when signing" default "$(APP_VERSION_TWEAK_STRING)" if "$(VERSION_MAJOR)" != "" diff --git a/share/sysbuild/image_configurations/BOOTLOADER_image_default.cmake b/share/sysbuild/image_configurations/BOOTLOADER_image_default.cmake index 1267fc1e1ef6..9125de71fac6 100644 --- a/share/sysbuild/image_configurations/BOOTLOADER_image_default.cmake +++ b/share/sysbuild/image_configurations/BOOTLOADER_image_default.cmake @@ -78,12 +78,3 @@ foreach(loopkeytype ${keytypes}) set_config_bool(${ZCMAKE_APPLICATION} ${loopkeytype} n) endif() endforeach() - -if(SB_CONFIG_BOOT_ENCRYPTION) - set_config_string(${ZCMAKE_APPLICATION} CONFIG_BOOT_ENCRYPTION_KEY_FILE "${SB_CONFIG_BOOT_ENCRYPTION_KEY_FILE}") - if(SB_CONFIG_BOOT_ENCRYPTION_ALG_AES_128) - set_config_bool(${ZCMAKE_APPLICATION} CONFIG_BOOT_ENCRYPT_ALG_AES_128 y) - elseif(SB_CONFIG_BOOT_ENCRYPTION_ALG_AES_256) - set_config_bool(${ZCMAKE_APPLICATION} CONFIG_BOOT_ENCRYPT_ALG_AES_256 y) - endif() -endif() diff --git a/share/sysbuild/image_configurations/MAIN_image_default.cmake b/share/sysbuild/image_configurations/MAIN_image_default.cmake index 96cb18355428..a6c29c8d7569 100644 --- a/share/sysbuild/image_configurations/MAIN_image_default.cmake +++ b/share/sysbuild/image_configurations/MAIN_image_default.cmake @@ -51,12 +51,4 @@ if(SB_CONFIG_BOOTLOADER_MCUBOOT) set_config_bool(${ZCMAKE_APPLICATION} CONFIG_RETENTION_BOOT_MODE y) endif() endif() - - if(SB_CONFIG_BOOT_ENCRYPTION) - if(SB_CONFIG_BOOT_ENCRYPTION_ALG_AES_128) - set_config_bool(${ZCMAKE_APPLICATION} CONFIG_MCUBOOT_ENCRYPTION_ALG_AES_128 y) - elseif(SB_CONFIG_BOOT_ENCRYPTION_ALG_AES_256) - set_config_bool(${ZCMAKE_APPLICATION} CONFIG_MCUBOOT_ENCRYPTION_ALG_AES_256 y) - endif() - endif() endif() diff --git a/share/sysbuild/images/bootloader/CMakeLists.txt b/share/sysbuild/images/bootloader/CMakeLists.txt index 501a1f366f2a..c82f0808c66e 100644 --- a/share/sysbuild/images/bootloader/CMakeLists.txt +++ b/share/sysbuild/images/bootloader/CMakeLists.txt @@ -15,4 +15,8 @@ if(SB_CONFIG_BOOTLOADER_MCUBOOT) sysbuild_add_dependencies(FLASH ${DEFAULT_IMAGE} ${image}) set_config_string(${image} CONFIG_BOOT_SIGNATURE_KEY_FILE "${SB_CONFIG_BOOT_SIGNATURE_KEY_FILE}") + set_config_bool(${image} CONFIG_BOOT_ENCRYPT_IMAGE "${SB_CONFIG_BOOT_ENCRYPTION}") + if(SB_CONFIG_BOOT_ENCRYPTION) + set_config_string(${image} CONFIG_BOOT_ENCRYPTION_KEY_FILE "${SB_CONFIG_BOOT_ENCRYPTION_KEY_FILE}") + endif() endif() diff --git a/share/sysbuild/images/bootloader/Kconfig b/share/sysbuild/images/bootloader/Kconfig index fa4eff374d6f..7a416f2fe239 100644 --- a/share/sysbuild/images/bootloader/Kconfig +++ b/share/sysbuild/images/bootloader/Kconfig @@ -204,20 +204,4 @@ config BOOT_ENCRYPTION_KEY_FILE help Absolute path to encryption key file to use with MCUBoot. -if BOOT_ENCRYPTION - -choice BOOT_ENCRYPTION_ALG - prompt "Algorithm used for image encryption" - default BOOT_ENCRYPTION_ALG_AES_128 - -config BOOT_ENCRYPTION_ALG_AES_128 - bool "Use AES-128 for image encryption" - -config BOOT_ENCRYPTION_ALG_AES_256 - bool "Use AES-256 for image encryption" - -endchoice # BOOT_ENCRYPTION_ALG - -endif # BOOT_ENCRYPTION - endif From c4a580ed21fb00c06a0f6cf07f663e76f4711730 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:32 +0300 Subject: [PATCH 0944/2141] Revert "[nrf fromlist] modules: openthread: configure router selection jitter" This reverts commit 53824876e35648dc8c2d6fb99e3756e7cd4d779f. Signed-off-by: Jukka Rissanen --- modules/openthread/Kconfig.thread | 9 --------- modules/openthread/openthread.c | 11 ----------- 2 files changed, 20 deletions(-) diff --git a/modules/openthread/Kconfig.thread b/modules/openthread/Kconfig.thread index 0633d8bc62d3..01737ef7567b 100644 --- a/modules/openthread/Kconfig.thread +++ b/modules/openthread/Kconfig.thread @@ -256,12 +256,3 @@ config OPENTHREAD_RCP_RESTORATION_MAX_COUNT default 2 help The maximum number of attempts to restore the RCP connection. - -config OPENTHREAD_ROUTER_SELECTION_JITTER_OVERRIDE - bool "Override default router selection jitter" - depends on OPENTHREAD_FTD - -config OPENTHREAD_ROUTER_SELECTION_JITTER - int "OpenThread router selection jitter in seconds" - depends on OPENTHREAD_ROUTER_SELECTION_JITTER_OVERRIDE - default 120 diff --git a/modules/openthread/openthread.c b/modules/openthread/openthread.c index e4124cda7f9b..5bd7f27e8c89 100644 --- a/modules/openthread/openthread.c +++ b/modules/openthread/openthread.c @@ -33,7 +33,6 @@ LOG_MODULE_REGISTER(net_openthread_platform, CONFIG_OPENTHREAD_PLATFORM_LOG_LEVE #include #include #include -#include #include #include #include @@ -99,12 +98,6 @@ LOG_MODULE_REGISTER(net_openthread_platform, CONFIG_OPENTHREAD_PLATFORM_LOG_LEVE #define OT_POLL_PERIOD 0 #endif -#if defined(CONFIG_OPENTHREAD_ROUTER_SELECTION_JITTER) -#define OT_ROUTER_SELECTION_JITTER CONFIG_OPENTHREAD_ROUTER_SELECTION_JITTER -#else -#define OT_ROUTER_SELECTION_JITTER 0 -#endif - #define ZEPHYR_PACKAGE_NAME "Zephyr" #define PACKAGE_VERSION KERNEL_VERSION_STRING @@ -347,10 +340,6 @@ int openthread_init(void) } } - if (IS_ENABLED(CONFIG_OPENTHREAD_ROUTER_SELECTION_JITTER_OVERRIDE)) { - otThreadSetRouterSelectionJitter(openthread_instance, OT_ROUTER_SELECTION_JITTER); - } - openthread_mutex_unlock(); /* Start work queue for the OpenThread module */ From ca3684a46aaf0634dfdadcca3b0a81a66300008c Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:32 +0300 Subject: [PATCH 0945/2141] Revert "[nrf fromtree] net: openthread: Add option to set RCP restoration count." This reverts commit e7e4f8bc6d9ca3d51de2a60a25fd3cce8698b767. Signed-off-by: Jukka Rissanen --- modules/openthread/CMakeLists.txt | 5 ----- modules/openthread/Kconfig.thread | 6 ------ 2 files changed, 11 deletions(-) diff --git a/modules/openthread/CMakeLists.txt b/modules/openthread/CMakeLists.txt index e6d4af115601..02af3687cf58 100644 --- a/modules/openthread/CMakeLists.txt +++ b/modules/openthread/CMakeLists.txt @@ -11,10 +11,6 @@ macro(kconfig_to_ot_option kconfig_option ot_config description) endif() endmacro() -macro(kconfig_to_ot_option_value kconfig_option ot_config description) - set(${ot_config} ${${kconfig_option}} CACHE STRING "${description}" FORCE) -endmacro() - # OpenThread options set(OT_BUILD_EXECUTABLES OFF CACHE BOOL "Disable OpenThread samples") set(OT_BUILTIN_MBEDTLS_MANAGEMENT OFF CACHE BOOL "Use Zephyr's mbedTLS heap") @@ -134,7 +130,6 @@ kconfig_to_ot_option(CONFIG_OPENTHREAD_UPTIME OT_UPTIME "Enable support for trac kconfig_to_ot_option(CONFIG_OPENTHREAD_VERHOEFF_CHECKSUM OT_VERHOEFF_CHECKSUM "Verhoeff checksum") kconfig_to_ot_option(CONFIG_OPENTHREAD_WAKEUP_COORDINATOR OT_WAKEUP_COORDINATOR "Enable Wake-up Coordinator role") kconfig_to_ot_option(CONFIG_OPENTHREAD_WAKEUP_END_DEVICE OT_WAKEUP_END_DEVICE "Enable Wake-up End Device role") -kconfig_to_ot_option_value(CONFIG_OPENTHREAD_RCP_RESTORATION_MAX_COUNT OT_RCP_RESTORATION_MAX_COUNT "Set the maximum number of RCP restoration attempts") if(CONFIG_OPENTHREAD_COPROCESSOR_VENDOR_HOOK_SOURCE) set(OT_NCP_VENDOR_HOOK_SOURCE ${CONFIG_OPENTHREAD_COPROCESSOR_VENDOR_HOOK_SOURCE} CACHE STRING "NCP vendor hook source file name" FORCE) diff --git a/modules/openthread/Kconfig.thread b/modules/openthread/Kconfig.thread index 01737ef7567b..2bababd4fee5 100644 --- a/modules/openthread/Kconfig.thread +++ b/modules/openthread/Kconfig.thread @@ -250,9 +250,3 @@ config OPENTHREAD_MLE_CHILD_TIMEOUT default 240 help The value of MLE child timeout in seconds. - -config OPENTHREAD_RCP_RESTORATION_MAX_COUNT - int "Openthread RCP restoration maximum count" - default 2 - help - The maximum number of attempts to restore the RCP connection. From 5b2c8e4dc50bdbf91f1e280f05884d4de75d4dbe Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:32 +0300 Subject: [PATCH 0946/2141] Revert "[nrf noup] soc: nrf54l: Change logic for KMU reserved area" This reverts commit 793e93e14667c87968d75c1666a9a99b44a054c9. Signed-off-by: Jukka Rissanen --- soc/nordic/nrf54l/CMakeLists.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/soc/nordic/nrf54l/CMakeLists.txt b/soc/nordic/nrf54l/CMakeLists.txt index d84330bffa6a..d986fe9c20d5 100644 --- a/soc/nordic/nrf54l/CMakeLists.txt +++ b/soc/nordic/nrf54l/CMakeLists.txt @@ -7,12 +7,10 @@ zephyr_library_sources( ) zephyr_include_directories(.) -dt_nodelabel(kmu_push_area_node NODELABEL nrf_kmu_reserved_push_area) - # We need a buffer in memory in a static location which can be used by # the KMU peripheral. The KMU has a static destination address, we chose # this address to be 0x20000000, which is the first address in the SRAM. -if(NOT CONFIG_BUILD_WITH_TFM AND CONFIG_PSA_NEED_CRACEN_KMU_DRIVER AND NOT kmu_push_area_node) +if(NOT CONFIG_BUILD_WITH_TFM AND CONFIG_PSA_NEED_CRACEN_KMU_DRIVER AND CONFIG_XIP) # Exclamation mark is printable character with the lowest number in ASCII table. # We are sure that this file will be included first. zephyr_linker_sources(RAM_SECTIONS SORT_KEY ! kmu_push_area_section.ld) From 6386c9f3aded0cdb190e67b92691c686f14ff25a Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:32 +0300 Subject: [PATCH 0947/2141] Revert "[nrf fromlist] scripts: parse module.yml for dts bindings" This reverts commit a922397417e49858aa7a6fd98d8ef79f6dee3666. Signed-off-by: Jukka Rissanen --- scripts/ci/check_compliance.py | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index 5958fa52a7d5..332f6cf08c3c 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -345,24 +345,15 @@ def check_board_file(self, file, vendor_prefixes): def run(self): path = resolve_path_hint(self.path_hint) - module_ymls = [path / "zephyr" / "module.yml", path / "zephyr" / "module.yaml"] vendor_prefixes = {"others"} # add vendor prefixes from the main zephyr repo vendor_prefixes |= get_vendor_prefixes(ZEPHYR_BASE / "dts" / "bindings" / "vendor-prefixes.txt", self.error) - # add vendor prefixes from the current repo - dts_root = None - for module_yml in module_ymls: - if module_yml.is_file(): - with module_yml.open('r', encoding='utf-8') as f: - meta = yaml.load(f.read(), Loader=SafeLoader) - section = meta.get('build', dict()) - build_settings = section.get('settings', None) - if build_settings: - dts_root = build_settings.get('dts_root', None) - if dts_root: - vendor_prefix_file = Path(dts_root) / "dts" / "bindings" / "vendor-prefixes.txt" + # add vendor prefixes from the current repo + dts_roots = get_module_setting_root('dts', path / "zephyr" / "module.yml") + for dts_root in dts_roots: + vendor_prefix_file = dts_root / "dts" / "bindings" / "vendor-prefixes.txt" if vendor_prefix_file.exists(): vendor_prefixes |= get_vendor_prefixes(vendor_prefix_file, self.error) From 7fe5162c53a89f7dba0258760c087b1add6e8223 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:32 +0300 Subject: [PATCH 0948/2141] Revert "[nrf fromtree] scripts: check_compliance: Fix resource leak" This reverts commit 2d0838c2fc9c8994e19a32a6bf50fd9dbbda30e8. Signed-off-by: Jukka Rissanen --- scripts/ci/check_compliance.py | 50 +++++++++++++++++----------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index 332f6cf08c3c..5a441c873f0c 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -291,37 +291,37 @@ def run(self): cmd = [checkpatch] cmd.extend(['--mailback', '--no-tree', '-']) - with subprocess.Popen(('git', 'diff', '--no-ext-diff', COMMIT_RANGE), + diff = subprocess.Popen(('git', 'diff', '--no-ext-diff', COMMIT_RANGE), stdout=subprocess.PIPE, - cwd=GIT_TOP) as diff: - try: - subprocess.run(cmd, - check=True, - stdin=diff.stdout, - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, - shell=False, cwd=GIT_TOP) + cwd=GIT_TOP) + try: + subprocess.run(cmd, + check=True, + stdin=diff.stdout, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + shell=False, cwd=GIT_TOP) - except subprocess.CalledProcessError as ex: - output = ex.output.decode("utf-8") - regex = r'^\s*\S+:(\d+):\s*(ERROR|WARNING):(.+?):(.+)(?:\n|\r\n?)+' \ - r'^\s*#(\d+):\s*FILE:\s*(.+):(\d+):' + except subprocess.CalledProcessError as ex: + output = ex.output.decode("utf-8") + regex = r'^\s*\S+:(\d+):\s*(ERROR|WARNING):(.+?):(.+)(?:\n|\r\n?)+' \ + r'^\s*#(\d+):\s*FILE:\s*(.+):(\d+):' - matches = re.findall(regex, output, re.MULTILINE) + matches = re.findall(regex, output, re.MULTILINE) - # add a guard here for excessive number of errors, do not try and - # process each one of them and instead push this as one failure. - if len(matches) > 500: - self.failure(output) - return + # add a guard here for excessive number of errors, do not try and + # process each one of them and instead push this as one failure. + if len(matches) > 500: + self.failure(output) + return - for m in matches: - self.fmtd_failure(m[1].lower(), m[2], m[5], m[6], col=None, - desc=m[3]) + for m in matches: + self.fmtd_failure(m[1].lower(), m[2], m[5], m[6], col=None, + desc=m[3]) - # If the regex has not matched add the whole output as a failure - if len(matches) == 0: - self.failure(output) + # If the regex has not matched add the whole output as a failure + if len(matches) == 0: + self.failure(output) class BoardYmlCheck(ComplianceTest): From e93bf3e255161400dd9a4d278c531be3101f6c27 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:32 +0300 Subject: [PATCH 0949/2141] Revert "[nrf fromtree] scripts: ci: check_compliance: Add support for modules for Kconfig" This reverts commit 2f556e6769ccef2e66d1607ca0cf6e6dab63aa15. Signed-off-by: Jukka Rissanen --- scripts/ci/check_compliance.py | 59 +++------------------------------- 1 file changed, 5 insertions(+), 54 deletions(-) diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index 5a441c873f0c..7ad88630e170 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -10,7 +10,7 @@ import json import logging import os -from pathlib import Path, PurePath +from pathlib import Path import platform import re import subprocess @@ -31,11 +31,6 @@ from west.manifest import Manifest from west.manifest import ManifestProject -try: - from yaml import CSafeLoader as SafeLoader -except ImportError: - from yaml import SafeLoader - sys.path.insert(0, str(Path(__file__).resolve().parents[1])) from get_maintainer import Maintainers, MaintainersError import list_boards @@ -786,23 +781,6 @@ def get_logging_syms(self, kconf): return set(kconf_syms) - def module_disallowed_check(self, module_path, type, folder, meta, regex): - # Returns a list with lines from git grep which includes Kconfigs from defconfig files - entry = type + '_root' - git_folder = ":" + folder - - if entry in meta['build']['settings']: - tmp_path = module_path.joinpath(meta['build']['settings'][entry]) - - if Path(tmp_path.joinpath(folder)).is_dir(): - tmp_output = git("grep", "--line-number", "-I", "--null", - "--perl-regexp", regex, "--", git_folder, - cwd=tmp_path, ignore_non_zero=True) - - if len(tmp_output) > 0: - return tmp_output.splitlines() - return [] - def check_disallowed_defconfigs(self, kconf): """ Checks that there are no disallowed Kconfigs used in board/SoC defconfig files @@ -845,41 +823,14 @@ def check_disallowed_defconfigs(self, kconf): grep_stdout_boards = git("grep", "--line-number", "-I", "--null", "--perl-regexp", regex_boards, "--", ":boards", - cwd=ZEPHYR_BASE).splitlines() + cwd=ZEPHYR_BASE) grep_stdout_socs = git("grep", "--line-number", "-I", "--null", "--perl-regexp", regex_socs, "--", ":soc", - cwd=ZEPHYR_BASE).splitlines() - - manifest = Manifest.from_file() - for project in manifest.get_projects([]): - if not manifest.is_active(project): - continue - - if not project.is_cloned(): - continue - - module_path = PurePath(project.abspath) - module_yml = module_path.joinpath('zephyr/module.yml') - - if not Path(module_yml).is_file(): - module_yml = module_path.joinpath('zephyr/module.yaml') - - if Path(module_yml).is_file(): - with Path(module_yml).open('r', encoding='utf-8') as f: - meta = yaml.load(f.read(), Loader=SafeLoader) - - if 'build' in meta and 'settings' in meta['build']: - grep_stdout_boards.extend(self.module_disallowed_check(module_path, - 'board', - 'boards', meta, - regex_boards)) - grep_stdout_socs.extend(self.module_disallowed_check(module_path, 'soc', - 'soc', meta, - regex_socs)) + cwd=ZEPHYR_BASE) # Board processing # splitlines() supports various line terminators - for grep_line in grep_stdout_boards: + for grep_line in grep_stdout_boards.splitlines(): path, lineno, line = grep_line.split("\0") # Extract symbol references (might be more than one) within the line @@ -896,7 +847,7 @@ def check_disallowed_defconfigs(self, kconf): # SoCs processing # splitlines() supports various line terminators - for grep_line in grep_stdout_socs: + for grep_line in grep_stdout_socs.splitlines(): path, lineno, line = grep_line.split("\0") # Extract symbol references (might be more than one) within the line From 548c8ed316111264292c42dfe4c3ee10017c18f7 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:32 +0300 Subject: [PATCH 0950/2141] Revert "[nrf fromtree] scripts: ci: Add CI bindings style checker" This reverts commit 70e7ab3812919e7d9562ff4ee243be806d1982f3. Signed-off-by: Jukka Rissanen --- scripts/bindings_properties_allowlist.yaml | 11 -- scripts/ci/check_compliance.py | 117 ++++++--------------- 2 files changed, 30 insertions(+), 98 deletions(-) delete mode 100644 scripts/bindings_properties_allowlist.yaml diff --git a/scripts/bindings_properties_allowlist.yaml b/scripts/bindings_properties_allowlist.yaml deleted file mode 100644 index 100d4d380fbf..000000000000 --- a/scripts/bindings_properties_allowlist.yaml +++ /dev/null @@ -1,11 +0,0 @@ -# This file is a YAML allowlist of property names that are allowed to -# bypass the underscore check in bindings. These properties are exempt -# from the rule that requires using '-' instead of '_'. -# -# The file content can be as shown below: -# - propname1 -# - propname2 -# - ... - -- mmc-hs200-1_8v -- mmc-hs400-1_8v diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index 7ad88630e170..3ee7b62c9b5a 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -21,7 +21,6 @@ import shutil import textwrap import unidiff -import yaml from yamllint import config, linter @@ -36,30 +35,6 @@ import list_boards import list_hardware -sys.path.insert(0, str(Path(__file__).resolve().parents[2] - / "scripts" / "dts" / "python-devicetree" / "src")) -from devicetree import edtlib - - -# Let the user run this script as ./scripts/ci/check_compliance.py without -# making them set ZEPHYR_BASE. -ZEPHYR_BASE = os.environ.get('ZEPHYR_BASE') -if ZEPHYR_BASE: - ZEPHYR_BASE = Path(ZEPHYR_BASE) -else: - ZEPHYR_BASE = Path(__file__).resolve().parents[2] - # Propagate this decision to child processes. - os.environ['ZEPHYR_BASE'] = str(ZEPHYR_BASE) - -# Initialize the property names allowlist -BINDINGS_PROPERTIES_AL = None -with open(Path(__file__).parents[1] / 'bindings_properties_allowlist.yaml') as f: - allowlist = yaml.safe_load(f.read()) - if allowlist is not None: - BINDINGS_PROPERTIES_AL = set(allowlist) - else: - BINDINGS_PROPERTIES_AL = set() - logger = None def git(*args, cwd=None, ignore_non_zero=False): @@ -405,75 +380,32 @@ class DevicetreeBindingsCheck(ComplianceTest): doc = "See https://docs.zephyrproject.org/latest/build/dts/bindings.html for more details." def run(self, full=True): - bindings_diff, bindings = self.get_yaml_bindings() + dts_bindings = self.parse_dt_bindings() - # If no bindings are changed, skip this check. - try: - subprocess.check_call(['git', 'diff', '--quiet', COMMIT_RANGE] - + bindings_diff) - nodiff = True - except subprocess.CalledProcessError: - nodiff = False - if nodiff: - self.skip('no changes to bindings were made') - - for binding in bindings: - self.check(binding, self.check_yaml_property_name) - self.check(binding, self.required_false_check) - - @staticmethod - def check(binding, callback): - while binding is not None: - callback(binding) - binding = binding.child_binding - - def get_yaml_bindings(self): + for dts_binding in dts_bindings: + self.required_false_check(dts_binding) + + def parse_dt_bindings(self): """ - Returns a list of 'dts/bindings/**/*.yaml' + Returns a list of dts/bindings/**/*.yaml files """ - from glob import glob - BINDINGS_PATH = 'dts/bindings/' - bindings_diff_dir, bindings = set(), [] - - for file_name in get_files(filter='d'): - if BINDINGS_PATH in file_name: - p = file_name.partition(BINDINGS_PATH) - bindings_diff_dir.add(os.path.join(p[0], p[1])) - for path in bindings_diff_dir: - yamls = glob(f'{os.fspath(path)}/**/*.yaml', recursive=True) - bindings.extend(yamls) + dt_bindings = [] + for file_name in get_files(filter="d"): + if 'dts/bindings/' in file_name and file_name.endswith('.yaml'): + dt_bindings.append(file_name) - bindings = edtlib.bindings_from_paths(bindings, ignore_errors=True) - return list(bindings_diff_dir), bindings + return dt_bindings - def check_yaml_property_name(self, binding): - """ - Checks if the property names in the binding file contain underscores. - """ - for prop_name in binding.prop2specs: - if '_' in prop_name and prop_name not in BINDINGS_PROPERTIES_AL: - better_prop = prop_name.replace('_', '-') - print(f"Required: In '{binding.path}', " - f"the property '{prop_name}' " - f"should be renamed to '{better_prop}'.") - self.failure( - f"{binding.path}: property '{prop_name}' contains underscores.\n" - f"\tUse '{better_prop}' instead unless this property name is from Linux.\n" - "Or another authoritative upstream source of bindings for " - f"compatible '{binding.compatible}'.\n" - "\tHint: update 'bindings_properties_allowlist.yaml' if you need to " - "override this check for this property." - ) + def required_false_check(self, dts_binding): + with open(dts_binding) as file: + for line_number, line in enumerate(file, 1): + if 'required: false' in line: + self.fmtd_failure( + 'warning', 'Devicetree Bindings', dts_binding, + line_number, col=None, + desc="'required: false' is redundant, please remove") - def required_false_check(self, binding): - raw_props = binding.raw.get('properties', {}) - for prop_name, raw_prop in raw_props.items(): - if raw_prop.get('required') is False: - self.failure( - f'{binding.path}: property "{prop_name}": ' - "'required: false' is redundant, please remove" - ) class KconfigCheck(ComplianceTest): """ @@ -2052,6 +1984,17 @@ def _main(args): # The "real" main(), which is wrapped to catch exceptions and report them # to GitHub. Returns the number of test failures. + global ZEPHYR_BASE + ZEPHYR_BASE = os.environ.get('ZEPHYR_BASE') + if not ZEPHYR_BASE: + # Let the user run this script as ./scripts/ci/check_compliance.py without + # making them set ZEPHYR_BASE. + ZEPHYR_BASE = str(Path(__file__).resolve().parents[2]) + + # Propagate this decision to child processes. + os.environ['ZEPHYR_BASE'] = ZEPHYR_BASE + ZEPHYR_BASE = Path(ZEPHYR_BASE) + # The absolute path of the top-level git directory. Initialize it here so # that issues running Git can be reported to GitHub. global GIT_TOP From ca718119520b05db7d8ce5c2605fedffeba76588 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:33 +0300 Subject: [PATCH 0951/2141] Revert "[nrf fromtree] soc: nordic: common: poweroff: Set VPR to remain in its reset state" This reverts commit 8f6f73e398f415c08bfa9ae7e3b02e03eb66c46e. Signed-off-by: Jukka Rissanen --- soc/nordic/common/poweroff.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/soc/nordic/common/poweroff.c b/soc/nordic/common/poweroff.c index ebce3aae77cd..857b2f38078a 100644 --- a/soc/nordic/common/poweroff.c +++ b/soc/nordic/common/poweroff.c @@ -16,18 +16,12 @@ #endif #if defined(CONFIG_SOC_SERIES_NRF54LX) #include -#include #endif #if defined(CONFIG_HAS_NORDIC_RAM_CTRL) #include #endif -#if defined(CONFIG_SOC_SERIES_NRF54LX) -#define VPR_POWER_IDX 1 -#define VPR_RET_BIT MEMCONF_POWER_RET_MEM0_Pos -#endif - void z_sys_poweroff(void) { #if defined(CONFIG_HAS_NORDIC_RAM_CTRL) @@ -65,9 +59,6 @@ void z_sys_poweroff(void) #endif #if defined(CONFIG_SOC_SERIES_NRF54LX) - /* Set VPR to remain in its reset state when waking from OFF */ - nrf_memconf_ramblock_ret_enable_set(NRF_MEMCONF, VPR_POWER_IDX, VPR_RET_BIT, false); - nrfx_reset_reason_clear(UINT32_MAX); #endif #if defined(CONFIG_SOC_SERIES_NRF51X) || defined(CONFIG_SOC_SERIES_NRF52X) From 0fb893a225aadc13974306b01e03c616fcf65854 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:33 +0300 Subject: [PATCH 0952/2141] Revert "[nrf fromtree] modules: hal_nordic: remove deprecated error code" This reverts commit fa08cc6afe0e53ef1d6db5cc8d7e46f9a99365a4. Signed-off-by: Jukka Rissanen --- drivers/usb/device/usb_dc_nrfx.c | 2 +- modules/hal_nordic/nrfx/nrfx_glue.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/device/usb_dc_nrfx.c b/drivers/usb/device/usb_dc_nrfx.c index c8bbfd40ada8..d7e56167120b 100644 --- a/drivers/usb/device/usb_dc_nrfx.c +++ b/drivers/usb/device/usb_dc_nrfx.c @@ -1914,7 +1914,7 @@ static int usb_init(void) return -EIO; } - /* Ignore the return value, as NRFX_ERROR_ALREADY is not + /* Ignore the return value, as NRFX_ERROR_ALREADY_INITIALIZED is not * a problem here. */ (void)nrfx_power_init(&power_config); diff --git a/modules/hal_nordic/nrfx/nrfx_glue.c b/modules/hal_nordic/nrfx/nrfx_glue.c index 4e7fc94e11de..54696efd122e 100644 --- a/modules/hal_nordic/nrfx/nrfx_glue.c +++ b/modules/hal_nordic/nrfx/nrfx_glue.c @@ -38,7 +38,7 @@ char const *nrfx_error_string_get(nrfx_err_t code) NRFX_ERROR_STRING_CASE(NRFX_ERROR_NULL); NRFX_ERROR_STRING_CASE(NRFX_ERROR_INVALID_ADDR); NRFX_ERROR_STRING_CASE(NRFX_ERROR_BUSY); - NRFX_ERROR_STRING_CASE(NRFX_ERROR_ALREADY); + NRFX_ERROR_STRING_CASE(NRFX_ERROR_ALREADY_INITIALIZED); NRFX_ERROR_STRING_CASE(NRFX_ERROR_DRV_TWI_ERR_OVERRUN); NRFX_ERROR_STRING_CASE(NRFX_ERROR_DRV_TWI_ERR_ANACK); NRFX_ERROR_STRING_CASE(NRFX_ERROR_DRV_TWI_ERR_DNACK); From 701fd97c0d8e18c7b56bcb3b692d0ad25f4e7147 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:33 +0300 Subject: [PATCH 0953/2141] Revert "[nrf fromtree] samples: subsys: ipc: Run multi-endpoint IPC sample on nrf54h20" This reverts commit 06b71687856dd61331c3eaaef08191938e2e9738. Signed-off-by: Jukka Rissanen --- .../ipc_service/multi_endpoint/CMakeLists.txt | 8 ++- .../multi_endpoint/Kconfig.sysbuild | 5 +- .../boards/nrf54h20dk_nrf54h20_cpuapp.conf | 1 - .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 50 ------------------- .../boards/nrf54h20dk_nrf54h20_cpurad.overlay | 50 ------------------- .../ipc_service/multi_endpoint/sample.yaml | 2 - .../ipc/ipc_service/multi_endpoint/src/main.c | 1 - 7 files changed, 8 insertions(+), 109 deletions(-) delete mode 100644 samples/subsys/ipc/ipc_service/multi_endpoint/boards/nrf54h20dk_nrf54h20_cpuapp.conf delete mode 100644 samples/subsys/ipc/ipc_service/multi_endpoint/boards/nrf54h20dk_nrf54h20_cpuapp.overlay delete mode 100644 samples/subsys/ipc/ipc_service/multi_endpoint/remote/boards/nrf54h20dk_nrf54h20_cpurad.overlay diff --git a/samples/subsys/ipc/ipc_service/multi_endpoint/CMakeLists.txt b/samples/subsys/ipc/ipc_service/multi_endpoint/CMakeLists.txt index d8c7b1367e8e..fca156d9fe2d 100644 --- a/samples/subsys/ipc/ipc_service/multi_endpoint/CMakeLists.txt +++ b/samples/subsys/ipc/ipc_service/multi_endpoint/CMakeLists.txt @@ -8,7 +8,11 @@ cmake_minimum_required(VERSION 3.20.0) find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +if(NOT CONFIG_BOARD_NRF5340DK_NRF5340_CPUAPP AND + NOT CONFIG_BOARD_NRF5340BSIM_NRF5340_CPUAPP ) + message(FATAL_ERROR "${BOARD} is not supported for this sample") +endif() + project(ipc_service) -FILE(GLOB app_sources src/*.c) -target_sources(app PRIVATE ${app_sources}) +target_sources(app PRIVATE src/main.c) diff --git a/samples/subsys/ipc/ipc_service/multi_endpoint/Kconfig.sysbuild b/samples/subsys/ipc/ipc_service/multi_endpoint/Kconfig.sysbuild index abaec58fdf45..5e4c6d497cfb 100644 --- a/samples/subsys/ipc/ipc_service/multi_endpoint/Kconfig.sysbuild +++ b/samples/subsys/ipc/ipc_service/multi_endpoint/Kconfig.sysbuild @@ -6,6 +6,5 @@ source "share/sysbuild/Kconfig" config NET_CORE_BOARD string - default "$(BOARD)/nrf5340/cpunet" if $(BOARD) = "nrf5340dk" - default "$(BOARD)/nrf5340/cpunet" if $(BOARD) = "nrf5340bsim" - default "$(BOARD)/nrf54h20/cpurad" if $(BOARD) = "nrf54h20dk" + default "nrf5340dk/nrf5340/cpunet" if $(BOARD) = "nrf5340dk" + default "nrf5340bsim/nrf5340/cpunet" if $(BOARD) = "nrf5340bsim" diff --git a/samples/subsys/ipc/ipc_service/multi_endpoint/boards/nrf54h20dk_nrf54h20_cpuapp.conf b/samples/subsys/ipc/ipc_service/multi_endpoint/boards/nrf54h20dk_nrf54h20_cpuapp.conf deleted file mode 100644 index a6fa5758d9ae..000000000000 --- a/samples/subsys/ipc/ipc_service/multi_endpoint/boards/nrf54h20dk_nrf54h20_cpuapp.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_SOC_NRF54H20_CPURAD_ENABLE=y diff --git a/samples/subsys/ipc/ipc_service/multi_endpoint/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/samples/subsys/ipc/ipc_service/multi_endpoint/boards/nrf54h20dk_nrf54h20_cpuapp.overlay deleted file mode 100644 index 1698d7a800d4..000000000000 --- a/samples/subsys/ipc/ipc_service/multi_endpoint/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ /dev/null @@ -1,50 +0,0 @@ -/ { - reserved-memory { - /delete-node/ memory@2f0bf000; - /delete-node/ memory@2f0bf800; - - cpuapp_cpurad_ipc_shm_a: memory@2f0bf000 { - reg = <0x2f0bf000 DT_SIZE_K(1)>; - }; - - cpurad_cpuapp_ipc_shm_a: memory@2f0bf400 { - reg = <0x2f0bf400 DT_SIZE_K(1)>; - }; - - cpuapp_cpurad_ipc_shm_b: memory@2f0bf800 { - reg = <0x2f0bf800 DT_SIZE_K(1)>; - }; - - cpurad_cpuapp_ipc_shm_b: memory@2f0bfC00 { - reg = <0x2f0bfC00 DT_SIZE_K(1)>; - }; - }; - - ipc { - cpuapp_cpurad_ipc_b: ipc-2-3-b { - compatible = "zephyr,ipc-icbmsg"; - dcache-alignment = <32>; - status = "okay"; - mboxes = <&cpuapp_bellboard 20>, - <&cpurad_bellboard 14>; - }; - }; -}; - -&cpuapp_bellboard { - nordic,interrupt-mapping = <0x146041 0x0>; -}; - -&ipc0 { - tx-region = <&cpuapp_cpurad_ipc_shm_a>; - rx-region = <&cpurad_cpuapp_ipc_shm_a>; -}; - -ipc1: &cpuapp_cpurad_ipc_b { - status = "okay"; - mbox-names = "rx", "tx"; - tx-region = <&cpuapp_cpurad_ipc_shm_b>; - rx-region = <&cpurad_cpuapp_ipc_shm_b>; - tx-blocks = <32>; - rx-blocks = <32>; -}; diff --git a/samples/subsys/ipc/ipc_service/multi_endpoint/remote/boards/nrf54h20dk_nrf54h20_cpurad.overlay b/samples/subsys/ipc/ipc_service/multi_endpoint/remote/boards/nrf54h20dk_nrf54h20_cpurad.overlay deleted file mode 100644 index 26ef0518b8b5..000000000000 --- a/samples/subsys/ipc/ipc_service/multi_endpoint/remote/boards/nrf54h20dk_nrf54h20_cpurad.overlay +++ /dev/null @@ -1,50 +0,0 @@ -/ { - reserved-memory { - /delete-node/ memory@2f0bf000; - /delete-node/ memory@2f0bf800; - - cpuapp_cpurad_ipc_shm_a: memory@2f0bf000 { - reg = <0x2f0bf000 DT_SIZE_K(1)>; - }; - - cpurad_cpuapp_ipc_shm_a: memory@2f0bf400 { - reg = <0x2f0bf400 DT_SIZE_K(1)>; - }; - - cpuapp_cpurad_ipc_shm_b: memory@2f0bf800 { - reg = <0x2f0bf800 DT_SIZE_K(1)>; - }; - - cpurad_cpuapp_ipc_shm_b: memory@2f0bfC00 { - reg = <0x2f0bfC00 DT_SIZE_K(1)>; - }; - }; - - ipc { - cpuapp_cpurad_ipc_b: ipc-2-3-b { - compatible = "zephyr,ipc-icbmsg"; - dcache-alignment = <32>; - status = "okay"; - mboxes = <&cpuapp_bellboard 20>, - <&cpurad_bellboard 14>; - }; - }; -}; - -&cpurad_bellboard { - nordic,interrupt-mapping = <0x5041 0>; -}; - -&ipc0 { - tx-region = <&cpurad_cpuapp_ipc_shm_a>; - rx-region = <&cpuapp_cpurad_ipc_shm_a>; -}; - -ipc1: &cpuapp_cpurad_ipc_b { - status = "okay"; - mbox-names = "tx", "rx"; - tx-region = <&cpurad_cpuapp_ipc_shm_b>; - rx-region = <&cpuapp_cpurad_ipc_shm_b>; - tx-blocks = <32>; - rx-blocks = <32>; -}; diff --git a/samples/subsys/ipc/ipc_service/multi_endpoint/sample.yaml b/samples/subsys/ipc/ipc_service/multi_endpoint/sample.yaml index 1e08253ca2ba..4505f76ac519 100644 --- a/samples/subsys/ipc/ipc_service/multi_endpoint/sample.yaml +++ b/samples/subsys/ipc/ipc_service/multi_endpoint/sample.yaml @@ -17,11 +17,9 @@ tests: platform_allow: - nrf5340dk/nrf5340/cpuapp - nrf5340bsim/nrf5340/cpuapp - - nrf54h20dk/nrf54h20/cpuapp integration_platforms: - nrf5340dk/nrf5340/cpuapp - nrf5340bsim/nrf5340/cpuapp - - nrf54h20dk/nrf54h20/cpuapp tags: ipc sysbuild: true sample.ipc.multi_endpoint.icbmsg: diff --git a/samples/subsys/ipc/ipc_service/multi_endpoint/src/main.c b/samples/subsys/ipc/ipc_service/multi_endpoint/src/main.c index d7d74daaf107..4ad5659df382 100644 --- a/samples/subsys/ipc/ipc_service/multi_endpoint/src/main.c +++ b/samples/subsys/ipc/ipc_service/multi_endpoint/src/main.c @@ -228,7 +228,6 @@ static void ipc1_entry(void *dummy0, void *dummy1, void *dummy2) return; } - printf("Waiting for bind\n"); k_sem_take(&ipc1_bound_sem, K_FOREVER); /* From 5319d826d410d0cda736f22fb8b2e50cb878f0e3 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:33 +0300 Subject: [PATCH 0954/2141] Revert "[nrf fromlist] tests: boards: nrf: qdec: Fix test for nRF54L15" This reverts commit d24c26f9852942beb447cd6a352aa95873fb6b7a. Signed-off-by: Jukka Rissanen --- tests/boards/nrf/qdec/src/main.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/tests/boards/nrf/qdec/src/main.c b/tests/boards/nrf/qdec/src/main.c index 6bc867f8aa9c..9d138d325fb5 100644 --- a/tests/boards/nrf/qdec/src/main.c +++ b/tests/boards/nrf/qdec/src/main.c @@ -60,11 +60,6 @@ static void qdec_trigger_handler(const struct device *dev, const struct sensor_t static void qenc_emulate_work_handler(struct k_work *work) { - /* Check if emulation has been stopped after submitting this work item. */ - if (loopback_currently_under_test == NULL) { - return; - } - if (toggle_a) { gpio_pin_toggle_dt(&loopback_currently_under_test->qenc_phase_a); } else { @@ -118,8 +113,6 @@ static void qenc_emulate_stop(void) k_timer_stop(&qenc_emulate_timer); qenc_emulate_reset_pin(&loopback_currently_under_test->qenc_phase_a); qenc_emulate_reset_pin(&loopback_currently_under_test->qenc_phase_b); - - loopback_currently_under_test = NULL; } } @@ -225,9 +218,6 @@ static void sensor_trigger_set_and_disable(struct qdec_qenc_loopback *loopback) if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { pm_device_runtime_put(loopback->qdec); } - - qenc_emulate_stop(); - k_sem_reset(&sem); } /** @@ -280,7 +270,8 @@ static void sensor_trigger_set_test(struct qdec_qenc_loopback *loopback) } qenc_emulate_stop(); - k_sem_reset(&sem); + /* emulation not working, but there may be old trigger which needs to be cleaned up */ + rc = k_sem_take(&sem, K_MSEC(200)); } /** @@ -580,7 +571,6 @@ static void after(void *fixture) ARG_UNUSED(fixture); qenc_emulate_stop(); - k_sem_reset(&sem); } ZTEST_SUITE(qdec_sensor, NULL, setup, before, after, NULL); From 94a66d5d97c0e8cfcd1714c8279ecb252fba3b75 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:33 +0300 Subject: [PATCH 0955/2141] Revert "[nrf fromtree] manifest: Update nRF hw models to latest" This reverts commit 28dd6d642251104d3f1cf5b27d7641b36d070757. Signed-off-by: Jukka Rissanen --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index b5ace932db27..853d84113a68 100644 --- a/west.yml +++ b/west.yml @@ -325,7 +325,7 @@ manifest: groups: - tools - name: nrf_hw_models - revision: 40403f5f2805cca210d2a47c8717d89c4e816cda + revision: 8b6001d6bdd9e2c8bb858fdb26f696f6d5f73db5 path: modules/bsim_hw_models/nrf_hw_models - name: nrf_wifi revision: 787eea1a3c8dd13c86214e204a919e6f9bcebf91 From 92d9f35ab350c2902505a738f8053fbbe3f3fe76 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:33 +0300 Subject: [PATCH 0956/2141] Revert "[nrf fromlist] tests: kernel: interrupt: generic ISR offset definition for nrf54h20 VPRs" This reverts commit 04dbe2e567ecae84c575a335a22a8aa8895bfbf5. Signed-off-by: Jukka Rissanen --- tests/kernel/gen_isr_table/src/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/kernel/gen_isr_table/src/main.c b/tests/kernel/gen_isr_table/src/main.c index fdea6d3bd985..d3e3291573a7 100644 --- a/tests/kernel/gen_isr_table/src/main.c +++ b/tests/kernel/gen_isr_table/src/main.c @@ -26,7 +26,7 @@ extern uintptr_t _irq_vector_table[]; #define ISR3_OFFSET 17 #define ISR5_OFFSET 18 #define TRIG_CHECK_SIZE 19 -#elif defined(CONFIG_SOC_SERIES_NRF54HX) && defined(CONFIG_RISCV_CORE_NORDIC_VPR) +#elif defined(CONFIG_SOC_NRF54H20_CPUPPR) || defined(CONFIG_SOC_NRF54H20_CPUFLPR) #define ISR1_OFFSET 14 #define ISR3_OFFSET 15 #define ISR5_OFFSET 16 From 17c421d63291aed7b1e668c3571fa827b025aedc Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:33 +0300 Subject: [PATCH 0957/2141] Revert "[nrf fromtree] tests: kernel: interrupt: generic ISR offset definition for nrf54h20 VPRs" This reverts commit 809e846366f267496984d3a14fb40a347dc360a9. Signed-off-by: Jukka Rissanen --- tests/kernel/interrupt/src/nested_irq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/kernel/interrupt/src/nested_irq.c b/tests/kernel/interrupt/src/nested_irq.c index 99ebe7a35e97..6bfc81b8965c 100644 --- a/tests/kernel/interrupt/src/nested_irq.c +++ b/tests/kernel/interrupt/src/nested_irq.c @@ -63,7 +63,7 @@ #define IRQ0_PRIO 1 #define IRQ1_PRIO 2 -#elif defined(CONFIG_SOC_SERIES_NRF54HX) && defined(CONFIG_RISCV_CORE_NORDIC_VPR) +#elif defined(CONFIG_SOC_NRF54H20_CPUPPR) #define IRQ0_LINE 14 #define IRQ1_LINE 15 From 088a6b9e3f7531b8ee0a24dd146e9d378633e393 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:33 +0300 Subject: [PATCH 0958/2141] Revert "[nrf fromtree] net: lib: tls_credentials: add invalid sec tag value" This reverts commit 82973b4f6d2a80e46775d336d20d3d57f09da409. Signed-off-by: Jukka Rissanen --- include/zephyr/net/tls_credentials.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/zephyr/net/tls_credentials.h b/include/zephyr/net/tls_credentials.h index d4bce6cd6fe5..1002eee7e64b 100644 --- a/include/zephyr/net/tls_credentials.h +++ b/include/zephyr/net/tls_credentials.h @@ -77,8 +77,6 @@ enum tls_credential_type { */ typedef int sec_tag_t; -#define SEC_TAG_TLS_INVALID (-1) /**< Invalid secure tag value. */ - /** * @brief Add a TLS credential. * From 01493a33942a4003d160260be666f547e1427e15 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:33 +0300 Subject: [PATCH 0959/2141] Revert "[nrf fromlist] drivers: timer: nrf_rtc: Fix custom wrapping" This reverts commit 139789b0b648c24b1a2dcbd5047725e213cf4f37. Signed-off-by: Jukka Rissanen --- drivers/timer/nrf_rtc_timer.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/timer/nrf_rtc_timer.c b/drivers/timer/nrf_rtc_timer.c index d689365665ed..a70cc19b7e9b 100644 --- a/drivers/timer/nrf_rtc_timer.c +++ b/drivers/timer/nrf_rtc_timer.c @@ -21,12 +21,10 @@ #if (CONFIG_NRF_RTC_COUNTER_BIT_WIDTH < RTC_BIT_WIDTH) #define CUSTOM_COUNTER_BIT_WIDTH 1 -#define WRAP_CH 0 -#define SYS_CLOCK_CH 1 +#define WRAP_CH 1 #include "nrfx_ppi.h" #else #define CUSTOM_COUNTER_BIT_WIDTH 0 -#define SYS_CLOCK_CH 0 #endif #define RTC_PRETICK (IS_ENABLED(CONFIG_SOC_NRF53_RTC_PRETICK) && \ @@ -39,6 +37,7 @@ #define RTC_IRQn NRFX_IRQ_NUMBER_GET(RTC) #define RTC_LABEL rtc1 #define CHAN_COUNT_MAX (RTC1_CC_NUM - (RTC_PRETICK ? 1 : 0)) +#define SYS_CLOCK_CH 0 BUILD_ASSERT(CHAN_COUNT <= CHAN_COUNT_MAX, "Not enough compare channels"); /* Ensure that counter driver for RTC1 is not enabled. */ @@ -276,6 +275,15 @@ static int set_alarm(int32_t chan, uint32_t req_cc, bool exact) */ enum { MIN_CYCLES_FROM_NOW = 3 }; uint32_t cc_val = req_cc; + +#if CUSTOM_COUNTER_BIT_WIDTH + /* If a CC value is 0 when a CLEAR task is set, this will not + * trigger a COMAPRE event. Need to use 1 instead. + */ + if (cc_val % COUNTER_MAX == 0) { + cc_val = 1; + } +#endif uint32_t cc_inc = MIN_CYCLES_FROM_NOW; /* Disable event routing for the channel to avoid getting a COMPARE @@ -291,14 +299,6 @@ static int set_alarm(int32_t chan, uint32_t req_cc, bool exact) for (;;) { uint32_t now; -#if CUSTOM_COUNTER_BIT_WIDTH - /* If a CC value is 0 when a CLEAR task is set, this will not - * trigger a COMAPRE event. Need to use 1 instead. - */ - if ((cc_val & COUNTER_MAX) == 0) { - cc_val = 1; - } -#endif set_comparator(chan, cc_val); /* Enable event routing after the required CC value was set. * Even though the above operation may get repeated (see below), @@ -597,8 +597,8 @@ void rtc_nrf_isr(const void *arg) } #if CUSTOM_COUNTER_BIT_WIDTH - if (nrfy_rtc_int_enable_check(RTC, NRF_RTC_CHANNEL_INT_MASK(WRAP_CH)) && - nrfy_rtc_events_process(RTC, NRF_RTC_CHANNEL_INT_MASK(WRAP_CH))) { + if (nrfy_rtc_int_enable_check(RTC, NRF_RTC_INT_COMPARE1_MASK) && + nrfy_rtc_events_process(RTC, NRF_RTC_INT_COMPARE1_MASK)) { #else if (nrfy_rtc_int_enable_check(RTC, NRF_RTC_INT_OVERFLOW_MASK) && nrfy_rtc_events_process(RTC, NRF_RTC_INT_OVERFLOW_MASK)) { @@ -606,7 +606,7 @@ void rtc_nrf_isr(const void *arg) overflow_cnt++; } - for (int32_t chan = SYS_CLOCK_CH; chan < CHAN_COUNT; chan++) { + for (int32_t chan = 0; chan < CHAN_COUNT; chan++) { process_channel(chan); } } From 876dd963611b40d01a6527ec387d067eb993d23b Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:33 +0300 Subject: [PATCH 0960/2141] Revert "[nrf fromlist] drivers: adc: nrfx: Temporary fix for SAADC power consumption" This reverts commit 2158e6b9d71fe7582c0b3bd6fd8827352b26fc19. Signed-off-by: Jukka Rissanen --- drivers/adc/adc_nrfx_saadc.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/adc/adc_nrfx_saadc.c b/drivers/adc/adc_nrfx_saadc.c index 100c3fa66efa..7d442b482e65 100644 --- a/drivers/adc/adc_nrfx_saadc.c +++ b/drivers/adc/adc_nrfx_saadc.c @@ -639,7 +639,6 @@ static void event_handler(const nrfx_saadc_evt_t *event) if (has_single_ended(&m_data.ctx.sequence)) { correct_single_ended(&m_data.ctx.sequence, m_data.user_buffer); } - nrfy_saadc_disable(NRF_SAADC); adc_context_on_sampling_done(&m_data.ctx, DEVICE_DT_INST_GET(0)); } else if (event->type == NRFX_SAADC_EVT_CALIBRATEDONE) { err = nrfx_saadc_mode_trigger(); From 068f0ac0c401921224334b4aec735aca014bcd43 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:33 +0300 Subject: [PATCH 0961/2141] Revert "[nrf fromlist] doc: secure_storage: document the 30-bit UID" This reverts commit 804a1d59154a63351e29d6cf294e3b462220d5cd. Signed-off-by: Jukka Rissanen --- doc/services/storage/secure_storage/index.rst | 11 +---------- .../internal/zephyr/secure_storage/its/common.h | 1 - 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/doc/services/storage/secure_storage/index.rst b/doc/services/storage/secure_storage/index.rst index 1829b435ea96..57f7dc03b27e 100644 --- a/doc/services/storage/secure_storage/index.rst +++ b/doc/services/storage/secure_storage/index.rst @@ -43,18 +43,9 @@ The secure storage subsystem's implementation of the PSA Secure Storage API: Instead, the PS API directly calls into the Internal Trusted Storage (ITS) API (unless a `custom implementation <#whole-api>`_ of the PS API is provided). -Below are some ways the implementation purposefully deviates from the specification +Below are some ways the implementation deviates from the specification and an explanation why. This is not an exhaustive list. -* The UID type is only 30 bits by default. (Against `2.5 UIDs `_.) - - | This is an optimization done to make it more convenient to directly use the UIDs as - storage entry IDs (e.g., with :ref:`ZMS ` when - :kconfig:option:`CONFIG_SECURE_STORAGE_ITS_STORE_IMPLEMENTATION_ZMS` is enabled). - | Zephyr defines numerical ranges to be used by different users of the API which guarantees that - there are no collisions and that they all fit within 30 bits. - See the header files in :zephyr_file:`include/zephyr/psa` for more information. - * The data stored in the ITS is by default encrypted and authenticated (Against ``1.`` in `3.2. Internal Trusted Storage requirements `_.) diff --git a/subsys/secure_storage/include/internal/zephyr/secure_storage/its/common.h b/subsys/secure_storage/include/internal/zephyr/secure_storage/its/common.h index 6ffc1bc78f57..f0576cba185f 100644 --- a/subsys/secure_storage/include/internal/zephyr/secure_storage/its/common.h +++ b/subsys/secure_storage/include/internal/zephyr/secure_storage/its/common.h @@ -39,7 +39,6 @@ typedef struct { * smaller IDs compared to the 64-bit ones that PSA Secure Storage specifies. * Zephyr defines ranges of IDs to be used by different users of the API (subsystems, application) * which guarantees 1. no collisions and 2. that the IDs used fit within `uid`. - * @see @ref zephyr/psa/key_ids.h and the other header files under `zephyr/psa`. */ typedef struct { psa_storage_uid_t uid : SECURE_STORAGE_ITS_UID_BIT_SIZE; From 98c2b153d04ab57cce586decec0c2d4403467c27 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:33 +0300 Subject: [PATCH 0962/2141] Revert "[nrf fromlist] secure_storage: use %# flag character for hex printing" This reverts commit fdb9ab5d52bacff73a0bc00f47cddfb61d282edd. Signed-off-by: Jukka Rissanen --- subsys/secure_storage/src/its/implementation.c | 2 +- subsys/secure_storage/src/its/store/zms.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/subsys/secure_storage/src/its/implementation.c b/subsys/secure_storage/src/its/implementation.c index 6f33195a0628..a2b7f97c3723 100644 --- a/subsys/secure_storage/src/its/implementation.c +++ b/subsys/secure_storage/src/its/implementation.c @@ -27,7 +27,7 @@ static psa_status_t make_its_uid(secure_storage_its_caller_id_t caller_id, psa_s #ifndef CONFIG_SECURE_STORAGE_64_BIT_UID /* Check that the UID is not bigger than the maximum defined size. */ if (uid & GENMASK64(63, SECURE_STORAGE_ITS_UID_BIT_SIZE)) { - LOG_DBG("UID %u/%#llx cannot be used as it has bits set past " + LOG_DBG("UID %u/0x%llx cannot be used as it has bits set past " "the first " STRINGIFY(SECURE_STORAGE_ITS_UID_BIT_SIZE) " ones.", caller_id, (unsigned long long)uid); return PSA_ERROR_INVALID_ARGUMENT; diff --git a/subsys/secure_storage/src/its/store/zms.c b/subsys/secure_storage/src/its/store/zms.c index 4778e0365e91..3a3bdd64c762 100644 --- a/subsys/secure_storage/src/its/store/zms.c +++ b/subsys/secure_storage/src/its/store/zms.c @@ -69,7 +69,7 @@ psa_status_t secure_storage_its_store_set(secure_storage_its_uid_t uid, } else { psa_ret = PSA_ERROR_STORAGE_FAILURE; } - LOG_DBG("%s %#x with %zu bytes. (%zd)", (psa_ret == PSA_SUCCESS) ? + LOG_DBG("%s 0x%x with %zu bytes. (%zd)", (psa_ret == PSA_SUCCESS) ? "Wrote" : "Failed to write", zms_id, data_length, zms_ret); return psa_ret; } @@ -90,7 +90,7 @@ psa_status_t secure_storage_its_store_get(secure_storage_its_uid_t uid, size_t d } else { psa_ret = PSA_ERROR_STORAGE_FAILURE; } - LOG_DBG("%s %#x for up to %zu bytes. (%zd)", (psa_ret != PSA_ERROR_STORAGE_FAILURE) ? + LOG_DBG("%s 0x%x for up to %zu bytes. (%zd)", (psa_ret != PSA_ERROR_STORAGE_FAILURE) ? "Read" : "Failed to read", zms_id, data_size, zms_ret); return psa_ret; } @@ -101,7 +101,7 @@ psa_status_t secure_storage_its_store_remove(secure_storage_its_uid_t uid) const uint32_t zms_id = zms_id_from(uid); ret = zms_delete(&s_zms, zms_id); - LOG_DBG("%s %#x. (%d)", ret ? "Failed to delete" : "Deleted", zms_id, ret); + LOG_DBG("%s 0x%x. (%d)", ret ? "Failed to delete" : "Deleted", zms_id, ret); return ret ? PSA_ERROR_STORAGE_FAILURE : PSA_SUCCESS; } From 665d0146aa7de8cc3ea7d9112cc6d67861ba2a3a Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:33 +0300 Subject: [PATCH 0963/2141] Revert "[nrf fromlist] samples: psa: specify integration_platforms" This reverts commit 5161a6a58af31aba9075eec78a7eb0134b6e5092. Signed-off-by: Jukka Rissanen --- samples/psa/its/sample.yaml | 2 -- samples/psa/persistent_key/sample.yaml | 2 -- 2 files changed, 4 deletions(-) diff --git a/samples/psa/its/sample.yaml b/samples/psa/its/sample.yaml index d3e7b7e10c9b..8d67cddd1573 100644 --- a/samples/psa/its/sample.yaml +++ b/samples/psa/its/sample.yaml @@ -2,8 +2,6 @@ sample: name: PSA ITS API sample description: Demonstration of PSA Internal Trusted Storage (ITS) API usage. common: - integration_platforms: - - native_sim tags: - psa.secure_storage timeout: 10 diff --git a/samples/psa/persistent_key/sample.yaml b/samples/psa/persistent_key/sample.yaml index 7c5b9d803004..490f2ea8f156 100644 --- a/samples/psa/persistent_key/sample.yaml +++ b/samples/psa/persistent_key/sample.yaml @@ -2,8 +2,6 @@ sample: name: PSA Crypto persistent key sample description: Demonstration of persistent key usage in the PSA Crypto API. common: - integration_platforms: - - native_sim tags: - psa.secure_storage timeout: 10 From c6243055b2f5f1cd1b33c5c49e3f28227c67a6bb Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:33 +0300 Subject: [PATCH 0964/2141] Revert "[nrf fromlist] tests: secure_storage: remove an integration platform" This reverts commit f9e3cfe8473ea45b23eebe781f0a6515139e7762. Signed-off-by: Jukka Rissanen --- tests/subsys/secure_storage/psa/crypto/testcase.yaml | 1 + tests/subsys/secure_storage/psa/its/testcase.yaml | 1 + 2 files changed, 2 insertions(+) diff --git a/tests/subsys/secure_storage/psa/crypto/testcase.yaml b/tests/subsys/secure_storage/psa/crypto/testcase.yaml index 1482d23cb6c7..8755a5a19352 100644 --- a/tests/subsys/secure_storage/psa/crypto/testcase.yaml +++ b/tests/subsys/secure_storage/psa/crypto/testcase.yaml @@ -8,6 +8,7 @@ tests: integration_platforms: - native_sim - nrf54l15dk/nrf54l15/cpuapp + - ophelia4ev/nrf54l15/cpuapp secure_storage.psa.crypto.tfm: filter: CONFIG_BUILD_WITH_TFM extra_args: EXTRA_CONF_FILE=overlay-tfm.conf diff --git a/tests/subsys/secure_storage/psa/its/testcase.yaml b/tests/subsys/secure_storage/psa/its/testcase.yaml index 0125b9d1e210..a871c015117a 100644 --- a/tests/subsys/secure_storage/psa/its/testcase.yaml +++ b/tests/subsys/secure_storage/psa/its/testcase.yaml @@ -2,6 +2,7 @@ common: integration_platforms: - native_sim - nrf54l15dk/nrf54l15/cpuapp + - ophelia4ev/nrf54l15/cpuapp platform_exclude: - qemu_cortex_m0 # settings subsystem initialization fails timeout: 600 From 2456d486f93aab964515f0d821f80b131a9d5803 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:33 +0300 Subject: [PATCH 0965/2141] Revert "[nrf fromlist] tests: secure_storage: psa: its: fix ZMS test" This reverts commit 2f40e49a5a6fdeeb23af70d80f00aabf15fca3a3. Signed-off-by: Jukka Rissanen --- tests/subsys/secure_storage/psa/its/overlay-store_zms.conf | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/subsys/secure_storage/psa/its/overlay-store_zms.conf b/tests/subsys/secure_storage/psa/its/overlay-store_zms.conf index 6c36dd402972..7efe611bc0a4 100644 --- a/tests/subsys/secure_storage/psa/its/overlay-store_zms.conf +++ b/tests/subsys/secure_storage/psa/its/overlay-store_zms.conf @@ -1,4 +1,3 @@ CONFIG_SECURE_STORAGE_ITS_STORE_IMPLEMENTATION_ZMS=y CONFIG_ZMS=y CONFIG_FLASH=y -CONFIG_FLASH_MAP=y From 035c836b7f8cd1ae997e0613fba753a6d43dffce Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:33 +0300 Subject: [PATCH 0966/2141] Revert "[nrf noup] tests: secure_storage: fix test w/ ZMS backend on 54L15" This reverts commit eb02a0210ff85ff00c9bacdf14c692f97d2e4d35. Signed-off-by: Jukka Rissanen --- tests/subsys/secure_storage/psa/its/testcase.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/subsys/secure_storage/psa/its/testcase.yaml b/tests/subsys/secure_storage/psa/its/testcase.yaml index a871c015117a..e0cf75c58955 100644 --- a/tests/subsys/secure_storage/psa/its/testcase.yaml +++ b/tests/subsys/secure_storage/psa/its/testcase.yaml @@ -28,7 +28,6 @@ tests: - EXTRA_DTC_OVERLAY_FILE=zms.overlay - EXTRA_CONF_FILE=\ overlay-secure_storage.conf;overlay-store_zms.conf;overlay-transform_default.conf - - SB_CONFIG_PARTITION_MANAGER=n secure_storage.psa.its.secure_storage.store.zms.64-bit_uids: platform_allow: *zms_platform_allow From c8de2ee7f9aaa600522099259d62feffa7568777 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:33 +0300 Subject: [PATCH 0967/2141] Revert "[nrf fromlist] tests: secure_storage: psa: its: add test scenarios for 64-bit UIDs" This reverts commit 5f0e7cdd3bd0d4096ac6f5368f03ab89f5ed5445. Signed-off-by: Jukka Rissanen --- .../secure_storage/psa/its/testcase.yaml | 28 +++++-------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/tests/subsys/secure_storage/psa/its/testcase.yaml b/tests/subsys/secure_storage/psa/its/testcase.yaml index e0cf75c58955..05f1c1b9a6ac 100644 --- a/tests/subsys/secure_storage/psa/its/testcase.yaml +++ b/tests/subsys/secure_storage/psa/its/testcase.yaml @@ -10,9 +10,10 @@ common: - psa.secure_storage tests: secure_storage.psa.its.secure_storage.store.zms: + filter: CONFIG_SECURE_STORAGE_ITS_STORE_IMPLEMENTATION_ZMS # DT-based filtering is not possible for this test scenario. # Platforms with a storage_partition must be manually added here. - platform_allow: &zms_platform_allow + platform_allow: - native_sim - mps2/an385 - qemu_x86/atom @@ -24,29 +25,14 @@ tests: - nrf9160dk/nrf9160 - nrf9161dk/nrf9161 - ophelia4ev/nrf54l15/cpuapp - extra_args: &zms_extra_args + extra_args: - EXTRA_DTC_OVERLAY_FILE=zms.overlay - - EXTRA_CONF_FILE=\ - overlay-secure_storage.conf;overlay-store_zms.conf;overlay-transform_default.conf - - secure_storage.psa.its.secure_storage.store.zms.64-bit_uids: - platform_allow: *zms_platform_allow - extra_args: *zms_extra_args - extra_configs: - - CONFIG_SECURE_STORAGE_64_BIT_UID=y + - EXTRA_CONF_FILE=overlay-secure_storage.conf;overlay-store_zms.conf;overlay-transform_default.conf secure_storage.psa.its.secure_storage.store.settings: - filter: &settings_filter - CONFIG_SECURE_STORAGE_ITS_STORE_IMPLEMENTATION_SETTINGS - extra_args: &settings_extra_args - "EXTRA_CONF_FILE=\ - overlay-secure_storage.conf;overlay-transform_default.conf;overlay-store_settings.conf" - - secure_storage.psa.its.secure_storage.store.settings.64-bit_uids: - filter: *settings_filter - extra_args: *settings_extra_args - extra_configs: - - CONFIG_SECURE_STORAGE_64_BIT_UID=y + filter: CONFIG_SECURE_STORAGE_ITS_STORE_IMPLEMENTATION_SETTINGS + extra_args: "EXTRA_CONF_FILE=\ + overlay-secure_storage.conf;overlay-transform_default.conf;overlay-store_settings.conf" secure_storage.psa.its.secure_storage.custom.transform: filter: CONFIG_SECURE_STORAGE and not CONFIG_SECURE_STORAGE_ITS_STORE_IMPLEMENTATION_NONE From dc4afb68d189d065687c657a5206ca6f4a17b045 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:34 +0300 Subject: [PATCH 0968/2141] Revert "[nrf fromlist] secure_storage: its: use %l printf length modifier" This reverts commit 2ce069884367ce0ea8a687ef0966dfaf8088a600. Signed-off-by: Jukka Rissanen --- subsys/secure_storage/src/its/implementation.c | 11 ++--------- subsys/secure_storage/src/its/store/settings.c | 6 ------ 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/subsys/secure_storage/src/its/implementation.c b/subsys/secure_storage/src/its/implementation.c index a2b7f97c3723..b39fbf90b002 100644 --- a/subsys/secure_storage/src/its/implementation.c +++ b/subsys/secure_storage/src/its/implementation.c @@ -115,15 +115,8 @@ static bool keep_stored_entry(secure_storage_its_uid_t uid, size_t data_length, if (existing_data_len == data_length && existing_create_flags == create_flags && !memcmp(existing_data, p_data, data_length)) { -#ifdef CONFIG_SECURE_STORAGE_64_BIT_UID - LOG_DBG("Not writing entry %u/%#llx to storage because its stored data" - " (of length %zu) is identical.", uid.caller_id, - (unsigned long long)uid.uid, data_length); -#else - LOG_DBG("Not writing entry %u/%#lx to storage because its stored data" - " (of length %zu) is identical.", uid.caller_id, - (unsigned long)uid.uid, data_length); -#endif + LOG_DBG("Not writing entry %u/%llu to storage because its stored data" + " (of length %zu) is identical.", uid.caller_id, uid.uid, data_length); *ret = PSA_SUCCESS; return true; } diff --git a/subsys/secure_storage/src/its/store/settings.c b/subsys/secure_storage/src/its/store/settings.c index 37973ffb0244..962fa516770a 100644 --- a/subsys/secure_storage/src/its/store/settings.c +++ b/subsys/secure_storage/src/its/store/settings.c @@ -38,15 +38,9 @@ void secure_storage_its_store_settings_get_name( { int ret; -#ifdef CONFIG_SECURE_STORAGE_64_BIT_UID ret = snprintf(name, SECURE_STORAGE_ITS_STORE_SETTINGS_NAME_BUF_SIZE, CONFIG_SECURE_STORAGE_ITS_STORE_SETTINGS_PREFIX "%x/%llx", uid.caller_id, (unsigned long long)uid.uid); -#else - ret = snprintf(name, SECURE_STORAGE_ITS_STORE_SETTINGS_NAME_BUF_SIZE, - CONFIG_SECURE_STORAGE_ITS_STORE_SETTINGS_PREFIX "%x/%lx", - uid.caller_id, (unsigned long)uid.uid); -#endif __ASSERT_NO_MSG(ret > 0 && ret < SECURE_STORAGE_ITS_STORE_SETTINGS_NAME_BUF_SIZE); } From 23116292e773a9c3ec5de6945b886e0fb48a80a7 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:34 +0300 Subject: [PATCH 0969/2141] Revert "[nrf fromlist] secure_storage: make UIDs 32-bit" This reverts commit c784ed16c10cbe33a4cde3488098cf347ef5cf04. Signed-off-by: Jukka Rissanen --- subsys/secure_storage/Kconfig | 11 --- subsys/secure_storage/Kconfig.its_store | 7 +- .../internal/zephyr/secure_storage/its.h | 17 ++-- .../zephyr/secure_storage/its/common.h | 23 +---- .../include/psa/internal_trusted_storage.h | 10 +- .../include/psa/protected_storage.h | 12 +-- .../include/psa/storage_common.h | 4 - .../secure_storage/src/its/implementation.c | 94 +++++-------------- subsys/secure_storage/src/its/store/zms.c | 30 ++++-- 9 files changed, 69 insertions(+), 139 deletions(-) diff --git a/subsys/secure_storage/Kconfig b/subsys/secure_storage/Kconfig index b0ac8c08a14c..3fe8eb0f76a7 100644 --- a/subsys/secure_storage/Kconfig +++ b/subsys/secure_storage/Kconfig @@ -25,17 +25,6 @@ module = SECURE_STORAGE module-str = secure_storage source "subsys/logging/Kconfig.template.log_config" -config SECURE_STORAGE_64_BIT_UID - bool "Make psa_storage_uid_t 64-bit" - help - Zephyr, by default, uses a 30-bit psa_storage_uid_t, which allows using only 32 bits to - identify entries. - UID ranges are defined for the different users of the API which guarantees that all the - UIDs fit within 30 bits. See for example the zephyr/psa/key_ids.h header file. - Enable this for backward compatibility if you are updating an existing installation with - stored entries that was using Zephyr prior to 4.3 or if for some reason you need the full - 64-bit UID range. - choice SECURE_STORAGE_ITS_IMPLEMENTATION prompt "Internal Trusted Storage (ITS) API implementation" diff --git a/subsys/secure_storage/Kconfig.its_store b/subsys/secure_storage/Kconfig.its_store index c924def563fa..ccd15b968a7c 100644 --- a/subsys/secure_storage/Kconfig.its_store +++ b/subsys/secure_storage/Kconfig.its_store @@ -17,7 +17,7 @@ config SECURE_STORAGE_ITS_STORE_IMPLEMENTATION_ZMS depends on ZMS help This implementation of the ITS store module makes direct use of ZMS for storage. - It needs a secure_storage_its_partition devicetree chosen property that points + It needs a `secure_storage_its_partition` devicetree chosen property that points to a fixed storage partition that will be dedicated to the ITS. It has lower overhead compared to the settings-based implementation, both in terms of runtime execution and storage space, and also ROM footprint if the settings subsystem is disabled. @@ -78,8 +78,7 @@ config SECURE_STORAGE_ITS_STORE_SETTINGS_PREFIX config SECURE_STORAGE_ITS_STORE_SETTINGS_NAME_MAX_LEN int "Maximum setting name length" range 2 64 - default 0 if SECURE_STORAGE_ITS_STORE_SETTINGS_NAME_CUSTOM - default 22 if SECURE_STORAGE_64_BIT_UID - default 14 + default 22 if !SECURE_STORAGE_ITS_STORE_SETTINGS_NAME_CUSTOM + default 0 endif # SECURE_STORAGE_ITS_STORE_IMPLEMENTATION_SETTINGS diff --git a/subsys/secure_storage/include/internal/zephyr/secure_storage/its.h b/subsys/secure_storage/include/internal/zephyr/secure_storage/its.h index c19dd7be7b63..009bb5e061af 100644 --- a/subsys/secure_storage/include/internal/zephyr/secure_storage/its.h +++ b/subsys/secure_storage/include/internal/zephyr/secure_storage/its.h @@ -14,21 +14,18 @@ #include "its/common.h" /** @brief See `psa_its_set()`, to which this function is analogous. */ -psa_status_t secure_storage_its_set(secure_storage_its_caller_id_t caller_id, psa_storage_uid_t uid, - size_t data_length, const void *p_data, - psa_storage_create_flags_t create_flags); +psa_status_t secure_storage_its_set(secure_storage_its_uid_t uid, size_t data_length, + const void *p_data, psa_storage_create_flags_t create_flags); /** @brief See `psa_its_get()`, to which this function is analogous. */ -psa_status_t secure_storage_its_get(secure_storage_its_caller_id_t caller_id, psa_storage_uid_t uid, - size_t data_offset, size_t data_size, - void *p_data, size_t *p_data_length); +psa_status_t secure_storage_its_get(secure_storage_its_uid_t uid, size_t data_offset, + size_t data_size, void *p_data, size_t *p_data_length); /** @brief See `psa_its_get_info()`, to which this function is analogous. */ -psa_status_t secure_storage_its_get_info(secure_storage_its_caller_id_t caller_id, - psa_storage_uid_t uid, struct psa_storage_info_t *p_info); +psa_status_t secure_storage_its_get_info(secure_storage_its_uid_t uid, + struct psa_storage_info_t *p_info); /** @brief See `psa_its_remove()`, to which this function is analogous. */ -psa_status_t secure_storage_its_remove(secure_storage_its_caller_id_t caller_id, - psa_storage_uid_t uid); +psa_status_t secure_storage_its_remove(secure_storage_its_uid_t uid); #endif diff --git a/subsys/secure_storage/include/internal/zephyr/secure_storage/its/common.h b/subsys/secure_storage/include/internal/zephyr/secure_storage/its/common.h index f0576cba185f..cd953086950a 100644 --- a/subsys/secure_storage/include/internal/zephyr/secure_storage/its/common.h +++ b/subsys/secure_storage/include/internal/zephyr/secure_storage/its/common.h @@ -12,7 +12,8 @@ #include /** @brief The ID of the caller from which the ITS API call originates. - * This is used to namespace the different callers and possibly treat them differently. + * This is used to prevent ID collisions between different callers that are not aware + * of each other and so might use the same numerical IDs, e.g. PSA Crypto and PSA ITS. */ typedef enum { SECURE_STORAGE_ITS_CALLER_PSA_ITS, @@ -21,32 +22,12 @@ typedef enum { SECURE_STORAGE_ITS_CALLER_COUNT } secure_storage_its_caller_id_t; -#ifdef CONFIG_SECURE_STORAGE_64_BIT_UID - /** The UID (caller + entry IDs) of an ITS entry. */ typedef struct { psa_storage_uid_t uid; secure_storage_its_caller_id_t caller_id; } __packed secure_storage_its_uid_t; -#else - -#define SECURE_STORAGE_ITS_UID_BIT_SIZE 30 -#define SECURE_STORAGE_ITS_CALLER_ID_BIT_SIZE 2 - -/** @brief The UID (caller + entry IDs) of an ITS entry. - * This is a packed, 32-bit version of `psa_storage_uid_t` which allows storing - * smaller IDs compared to the 64-bit ones that PSA Secure Storage specifies. - * Zephyr defines ranges of IDs to be used by different users of the API (subsystems, application) - * which guarantees 1. no collisions and 2. that the IDs used fit within `uid`. - */ -typedef struct { - psa_storage_uid_t uid : SECURE_STORAGE_ITS_UID_BIT_SIZE; - secure_storage_its_caller_id_t caller_id : SECURE_STORAGE_ITS_CALLER_ID_BIT_SIZE; -} secure_storage_its_uid_t; - -#endif /* CONFIG_SECURE_STORAGE_64_BIT_UID */ - #ifdef CONFIG_SECURE_STORAGE_ITS_TRANSFORM_MODULE /** The maximum size, in bytes, of an entry's data after it has been transformed for storage. */ diff --git a/subsys/secure_storage/include/psa/internal_trusted_storage.h b/subsys/secure_storage/include/psa/internal_trusted_storage.h index 06a09e34988b..a8c3b77c601a 100644 --- a/subsys/secure_storage/include/psa/internal_trusted_storage.h +++ b/subsys/secure_storage/include/psa/internal_trusted_storage.h @@ -16,6 +16,7 @@ #else #define ITS_CALLER_ID SECURE_STORAGE_ITS_CALLER_PSA_ITS #endif +#define ITS_UID (secure_storage_its_uid_t){.uid = uid, .caller_id = ITS_CALLER_ID} /** @endcond */ #include @@ -49,7 +50,7 @@ static ALWAYS_INLINE psa_status_t psa_its_set(psa_storage_uid_t uid, size_t data_length, const void *p_data, psa_storage_create_flags_t create_flags) { - return secure_storage_its_set(ITS_CALLER_ID, uid, data_length, p_data, create_flags); + return secure_storage_its_set(ITS_UID, data_length, p_data, create_flags); } /** @@ -75,8 +76,7 @@ static ALWAYS_INLINE psa_status_t psa_its_get(psa_storage_uid_t uid, size_t data_offset, size_t data_size, void *p_data, size_t *p_data_length) { - return secure_storage_its_get(ITS_CALLER_ID, uid, data_offset, - data_size, p_data, p_data_length); + return secure_storage_its_get(ITS_UID, data_offset, data_size, p_data, p_data_length); } /** @@ -96,7 +96,7 @@ static ALWAYS_INLINE /** @endcond */ psa_status_t psa_its_get_info(psa_storage_uid_t uid, struct psa_storage_info_t *p_info) { - return secure_storage_its_get_info(ITS_CALLER_ID, uid, p_info); + return secure_storage_its_get_info(ITS_UID, p_info); } /** @@ -117,7 +117,7 @@ static ALWAYS_INLINE /** @endcond */ psa_status_t psa_its_remove(psa_storage_uid_t uid) { - return secure_storage_its_remove(ITS_CALLER_ID, uid); + return secure_storage_its_remove(ITS_UID); } #undef ITS_UID diff --git a/subsys/secure_storage/include/psa/protected_storage.h b/subsys/secure_storage/include/psa/protected_storage.h index 40d731b04254..7c20d3097a2a 100644 --- a/subsys/secure_storage/include/psa/protected_storage.h +++ b/subsys/secure_storage/include/psa/protected_storage.h @@ -12,7 +12,8 @@ /** @cond INTERNAL_HIDDEN */ #ifdef CONFIG_SECURE_STORAGE_PS_IMPLEMENTATION_ITS #include "../internal/zephyr/secure_storage/its.h" -#define ITS_CALLER_ID SECURE_STORAGE_ITS_CALLER_PSA_PS +#define ITS_UID (secure_storage_its_uid_t){.uid = uid, \ + .caller_id = SECURE_STORAGE_ITS_CALLER_PSA_PS} #else #include "../internal/zephyr/secure_storage/ps.h" #endif @@ -49,7 +50,7 @@ psa_status_t psa_ps_set(psa_storage_uid_t uid, size_t data_length, const void *p_data, psa_storage_create_flags_t create_flags) { #ifdef CONFIG_SECURE_STORAGE_PS_IMPLEMENTATION_ITS - return secure_storage_its_set(ITS_CALLER_ID, uid, data_length, p_data, create_flags); + return secure_storage_its_set(ITS_UID, data_length, p_data, create_flags); #else return secure_storage_ps_set(uid, data_length, p_data, create_flags); #endif @@ -82,8 +83,7 @@ psa_status_t psa_ps_get(psa_storage_uid_t uid, size_t data_offset, size_t data_size, void *p_data, size_t *p_data_length) { #ifdef CONFIG_SECURE_STORAGE_PS_IMPLEMENTATION_ITS - return secure_storage_its_get(ITS_CALLER_ID, uid, data_offset, - data_size, p_data, p_data_length); + return secure_storage_its_get(ITS_UID, data_offset, data_size, p_data, p_data_length); #else return secure_storage_ps_get(uid, data_offset, data_size, p_data, p_data_length); #endif @@ -110,7 +110,7 @@ static ALWAYS_INLINE psa_status_t psa_ps_get_info(psa_storage_uid_t uid, struct psa_storage_info_t *p_info) { #ifdef CONFIG_SECURE_STORAGE_PS_IMPLEMENTATION_ITS - return secure_storage_its_get_info(ITS_CALLER_ID, uid, p_info); + return secure_storage_its_get_info(ITS_UID, p_info); #else return secure_storage_ps_get_info(uid, p_info); #endif @@ -138,7 +138,7 @@ static ALWAYS_INLINE psa_status_t psa_ps_remove(psa_storage_uid_t uid) { #ifdef CONFIG_SECURE_STORAGE_PS_IMPLEMENTATION_ITS - return secure_storage_its_remove(ITS_CALLER_ID, uid); + return secure_storage_its_remove(ITS_UID); #else return secure_storage_ps_remove(uid); #endif diff --git a/subsys/secure_storage/include/psa/storage_common.h b/subsys/secure_storage/include/psa/storage_common.h index 2bd0f7cce732..d5bed2a692e7 100644 --- a/subsys/secure_storage/include/psa/storage_common.h +++ b/subsys/secure_storage/include/psa/storage_common.h @@ -20,11 +20,7 @@ #include /** UID type for identifying entries. */ -#ifdef CONFIG_SECURE_STORAGE_64_BIT_UID typedef uint64_t psa_storage_uid_t; -#else -typedef uint32_t psa_storage_uid_t; -#endif /** Flags used when creating an entry. */ typedef uint32_t psa_storage_create_flags_t; diff --git a/subsys/secure_storage/src/its/implementation.c b/subsys/secure_storage/src/its/implementation.c index b39fbf90b002..2ad937d45d27 100644 --- a/subsys/secure_storage/src/its/implementation.c +++ b/subsys/secure_storage/src/its/implementation.c @@ -11,33 +11,6 @@ LOG_MODULE_DECLARE(secure_storage, CONFIG_SECURE_STORAGE_LOG_LEVEL); -#ifndef CONFIG_SECURE_STORAGE_64_BIT_UID -BUILD_ASSERT(sizeof(secure_storage_its_uid_t) == 4); /* ITS UIDs are 32-bit */ -BUILD_ASSERT(1 << SECURE_STORAGE_ITS_CALLER_ID_BIT_SIZE >= SECURE_STORAGE_ITS_CALLER_COUNT); -BUILD_ASSERT(SECURE_STORAGE_ITS_CALLER_ID_BIT_SIZE + SECURE_STORAGE_ITS_UID_BIT_SIZE == 32); -#endif - -static psa_status_t make_its_uid(secure_storage_its_caller_id_t caller_id, psa_storage_uid_t uid, - secure_storage_its_uid_t *its_uid) -{ - if (uid == 0) { - return PSA_ERROR_INVALID_ARGUMENT; - } - -#ifndef CONFIG_SECURE_STORAGE_64_BIT_UID - /* Check that the UID is not bigger than the maximum defined size. */ - if (uid & GENMASK64(63, SECURE_STORAGE_ITS_UID_BIT_SIZE)) { - LOG_DBG("UID %u/0x%llx cannot be used as it has bits set past " - "the first " STRINGIFY(SECURE_STORAGE_ITS_UID_BIT_SIZE) " ones.", - caller_id, (unsigned long long)uid); - return PSA_ERROR_INVALID_ARGUMENT; - } -#endif /* !CONFIG_SECURE_STORAGE_64_BIT_UID */ - - *its_uid = (secure_storage_its_uid_t){.caller_id = caller_id, .uid = uid}; - return PSA_SUCCESS; -} - static void log_failed_operation(const char *operation, const char *preposition, psa_status_t ret) { LOG_ERR("Failed to %s data %s storage. (%d)", operation, preposition, ret); @@ -144,17 +117,12 @@ static psa_status_t store_entry(secure_storage_its_uid_t uid, size_t data_length return ret; } -psa_status_t secure_storage_its_set(secure_storage_its_caller_id_t caller_id, psa_storage_uid_t uid, - size_t data_length, const void *p_data, - psa_storage_create_flags_t create_flags) +psa_status_t secure_storage_its_set(secure_storage_its_uid_t uid, size_t data_length, + const void *p_data, psa_storage_create_flags_t create_flags) { psa_status_t ret; - secure_storage_its_uid_t its_uid; - if (make_its_uid(caller_id, uid, &its_uid) != PSA_SUCCESS) { - return PSA_ERROR_INVALID_ARGUMENT; - } - if (p_data == NULL && data_length != 0) { + if (uid.uid == 0 || (p_data == NULL && data_length != 0)) { return PSA_ERROR_INVALID_ARGUMENT; } if (create_flags & ~SECURE_STORAGE_ALL_CREATE_FLAGS) { @@ -166,49 +134,43 @@ psa_status_t secure_storage_its_set(secure_storage_its_caller_id_t caller_id, ps return PSA_ERROR_INSUFFICIENT_STORAGE; } - if (keep_stored_entry(its_uid, data_length, p_data, create_flags, &ret)) { + if (keep_stored_entry(uid, data_length, p_data, create_flags, &ret)) { return ret; } - ret = store_entry(its_uid, data_length, p_data, create_flags); + ret = store_entry(uid, data_length, p_data, create_flags); return ret; } -psa_status_t secure_storage_its_get(secure_storage_its_caller_id_t caller_id, psa_storage_uid_t uid, - size_t data_offset, size_t data_size, - void *p_data, size_t *p_data_length) -{ - psa_status_t ret; - secure_storage_its_uid_t its_uid; - uint8_t stored_data[SECURE_STORAGE_ITS_TRANSFORM_MAX_STORED_DATA_SIZE]; - size_t stored_data_len; - psa_storage_create_flags_t create_flags; - if (make_its_uid(caller_id, uid, &its_uid) != PSA_SUCCESS) { - return PSA_ERROR_INVALID_ARGUMENT; - } - if ((p_data == NULL && data_size != 0) || p_data_length == NULL) { +psa_status_t secure_storage_its_get(secure_storage_its_uid_t uid, size_t data_offset, + size_t data_size, void *p_data, size_t *p_data_length) +{ + if (uid.uid == 0 || (p_data == NULL && data_size != 0) || p_data_length == NULL) { return PSA_ERROR_INVALID_ARGUMENT; } if (data_size == 0) { *p_data_length = 0; return PSA_SUCCESS; } + psa_status_t ret; + uint8_t stored_data[SECURE_STORAGE_ITS_TRANSFORM_MAX_STORED_DATA_SIZE]; + size_t stored_data_len; + psa_storage_create_flags_t create_flags; - - ret = get_stored_data(its_uid, stored_data, &stored_data_len); + ret = get_stored_data(uid, stored_data, &stored_data_len); if (ret != PSA_SUCCESS) { return ret; } if (data_offset == 0 && data_size >= SECURE_STORAGE_ITS_TRANSFORM_DATA_SIZE(stored_data_len)) { /* All the data fits directly in the provided buffer. */ - return transform_stored_data(its_uid, stored_data_len, stored_data, data_size, - p_data, p_data_length, &create_flags); + return transform_stored_data(uid, stored_data_len, stored_data, data_size, p_data, + p_data_length, &create_flags); } uint8_t data[CONFIG_SECURE_STORAGE_ITS_MAX_DATA_SIZE]; size_t data_len; - ret = transform_stored_data(its_uid, stored_data_len, stored_data, sizeof(data), data, + ret = transform_stored_data(uid, stored_data_len, stored_data, sizeof(data), data, &data_len, &create_flags); if (ret == PSA_SUCCESS) { if (data_offset > data_len) { @@ -222,47 +184,41 @@ psa_status_t secure_storage_its_get(secure_storage_its_caller_id_t caller_id, ps return ret; } -psa_status_t secure_storage_its_get_info(secure_storage_its_caller_id_t caller_id, - psa_storage_uid_t uid, struct psa_storage_info_t *p_info) +psa_status_t secure_storage_its_get_info(secure_storage_its_uid_t uid, + struct psa_storage_info_t *p_info) { psa_status_t ret; - secure_storage_its_uid_t its_uid; uint8_t data[CONFIG_SECURE_STORAGE_ITS_MAX_DATA_SIZE]; - if (make_its_uid(caller_id, uid, &its_uid) != PSA_SUCCESS) { - return PSA_ERROR_INVALID_ARGUMENT; - } - if (p_info == NULL) { + if (uid.uid == 0 || p_info == NULL) { return PSA_ERROR_INVALID_ARGUMENT; } - ret = get_entry(its_uid, sizeof(data), data, &p_info->size, &p_info->flags); + ret = get_entry(uid, sizeof(data), data, &p_info->size, &p_info->flags); if (ret == PSA_SUCCESS) { p_info->capacity = p_info->size; } return ret; } -psa_status_t secure_storage_its_remove(secure_storage_its_caller_id_t caller_id, - psa_storage_uid_t uid) +psa_status_t secure_storage_its_remove(secure_storage_its_uid_t uid) { psa_status_t ret; - secure_storage_its_uid_t its_uid; psa_storage_create_flags_t create_flags; uint8_t data[CONFIG_SECURE_STORAGE_ITS_MAX_DATA_SIZE]; size_t data_len; - if (make_its_uid(caller_id, uid, &its_uid) != PSA_SUCCESS) { + if (uid.uid == 0) { return PSA_ERROR_INVALID_ARGUMENT; } - ret = get_entry(its_uid, sizeof(data), data, &data_len, &create_flags); + ret = get_entry(uid, sizeof(data), data, &data_len, &create_flags); if (ret == PSA_SUCCESS && (create_flags & PSA_STORAGE_FLAG_WRITE_ONCE)) { return PSA_ERROR_NOT_PERMITTED; } /* Allow overwriting corrupted entries as well to not be stuck with them forever. */ if (ret == PSA_SUCCESS || ret == PSA_ERROR_STORAGE_FAILURE) { - ret = secure_storage_its_store_remove(its_uid); + ret = secure_storage_its_store_remove(uid); if (ret != PSA_SUCCESS) { log_failed_operation("remove", "from", ret); return PSA_ERROR_STORAGE_FAILURE; diff --git a/subsys/secure_storage/src/its/store/zms.c b/subsys/secure_storage/src/its/store/zms.c index 3a3bdd64c762..ede296952ab5 100644 --- a/subsys/secure_storage/src/its/store/zms.c +++ b/subsys/secure_storage/src/its/store/zms.c @@ -33,26 +33,26 @@ static int init_zms(void) } SYS_INIT(init_zms, APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY); -#ifdef CONFIG_SECURE_STORAGE_64_BIT_UID - /* Bit position of the ITS caller ID in the ZMS entry ID. */ #define ITS_CALLER_ID_POS 30 /* Make sure that every ITS caller ID fits in ZMS entry IDs at the defined position. */ BUILD_ASSERT(1 << (32 - ITS_CALLER_ID_POS) >= SECURE_STORAGE_ITS_CALLER_COUNT); -static uint32_t zms_id_from(secure_storage_its_uid_t uid) +static bool has_forbidden_bits_set(secure_storage_its_uid_t uid) { - __ASSERT_NO_MSG(!(uid.uid & GENMASK64(63, ITS_CALLER_ID_POS))); - return (uint32_t)uid.uid | (uid.caller_id << ITS_CALLER_ID_POS); + if (uid.uid & GENMASK64(63, ITS_CALLER_ID_POS)) { + LOG_DBG("UID %u/0x%llx cannot be used as it has bits set past " + "the first " STRINGIFY(ITS_CALLER_ID_POS) " ones.", + uid.caller_id, (unsigned long long)uid.uid); + return true; + } + return false; } -#else static uint32_t zms_id_from(secure_storage_its_uid_t uid) { - BUILD_ASSERT(sizeof(uid) == sizeof(uint32_t)); - return *(uint32_t *)&uid; + return (uint32_t)uid.uid | (uid.caller_id << ITS_CALLER_ID_POS); } -#endif /* CONFIG_SECURE_STORAGE_64_BIT_UID */ psa_status_t secure_storage_its_store_set(secure_storage_its_uid_t uid, size_t data_length, const void *data) @@ -61,6 +61,10 @@ psa_status_t secure_storage_its_store_set(secure_storage_its_uid_t uid, ssize_t zms_ret; const uint32_t zms_id = zms_id_from(uid); + if (has_forbidden_bits_set(uid)) { + return PSA_ERROR_INVALID_ARGUMENT; + } + zms_ret = zms_write(&s_zms, zms_id, data, data_length); if (zms_ret == data_length) { psa_ret = PSA_SUCCESS; @@ -81,6 +85,10 @@ psa_status_t secure_storage_its_store_get(secure_storage_its_uid_t uid, size_t d ssize_t zms_ret; const uint32_t zms_id = zms_id_from(uid); + if (has_forbidden_bits_set(uid)) { + return PSA_ERROR_INVALID_ARGUMENT; + } + zms_ret = zms_read(&s_zms, zms_id, data, data_size); if (zms_ret > 0) { *data_length = zms_ret; @@ -100,6 +108,10 @@ psa_status_t secure_storage_its_store_remove(secure_storage_its_uid_t uid) int ret; const uint32_t zms_id = zms_id_from(uid); + if (has_forbidden_bits_set(uid)) { + return PSA_ERROR_INVALID_ARGUMENT; + } + ret = zms_delete(&s_zms, zms_id); LOG_DBG("%s 0x%x. (%d)", ret ? "Failed to delete" : "Deleted", zms_id, ret); From 8c6db68b4b37bef2bbfc4e9fcc9e1bfc158eea2c Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:34 +0300 Subject: [PATCH 0970/2141] Revert "[nrf fromlist] soc: nordic: ironside: dvfs: check abb analog status more than once" This reverts commit c867cec99e85127132360620f53c4c5f45a3f56d. Signed-off-by: Jukka Rissanen --- soc/nordic/ironside/Kconfig | 9 ++++----- soc/nordic/ironside/dvfs.c | 10 ---------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/soc/nordic/ironside/Kconfig b/soc/nordic/ironside/Kconfig index 3136e3bd5f47..6eeacf067718 100644 --- a/soc/nordic/ironside/Kconfig +++ b/soc/nordic/ironside/Kconfig @@ -65,12 +65,11 @@ config NRF_IRONSIDE_DVFS_SERVICE if NRF_IRONSIDE_DVFS_SERVICE -config NRF_IRONSIDE_ABB_STATUSANA_CHECK_MAX_ATTEMPTS - int "IRONSside DVFS ABB analog status check maximum attempts" - range 0 255 - default 50 +config NRF_IRONSIDE_DVFS_OPPOINT_CHANGE_MUTEX_TIMEOUT_MS + int "IRONSside DVFS change oppoint mutex timeout" + default 100 help - Maximum attempts with 10us intervals before busy status will be reported. + Maximum timeout when waiting for DVFS oppoint change mutex lock. endif # NRF_IRONSIDE_DVFS_SERVICE diff --git a/soc/nordic/ironside/dvfs.c b/soc/nordic/ironside/dvfs.c index 6c7a86cd0ad4..7793ff015b1e 100644 --- a/soc/nordic/ironside/dvfs.c +++ b/soc/nordic/ironside/dvfs.c @@ -18,9 +18,6 @@ static enum ironside_dvfs_oppoint current_dvfs_oppoint = IRONSIDE_DVFS_OPP_HIGH; #error "Unsupported SoC series for IronSide DVFS" #endif -#define ABB_STATUSANA_CHECK_MAX_ATTEMPTS (CONFIG_NRF_IRONSIDE_ABB_STATUSANA_CHECK_MAX_ATTEMPTS) -#define ABB_STATUSANA_CHECK_INTERVAL_US (10U) - struct dvfs_hsfll_data_t { uint32_t new_f_mult; uint32_t new_f_trim_entry; @@ -132,13 +129,6 @@ static inline bool ironside_dvfs_is_abb_locked(NRF_ABB_Type *abb) /* Temporary workaround until STATUSANA register is visible. */ volatile const uint32_t *statusana = (uint32_t *)abb + ABB_STATUSANA_REG_OFFSET; - uint8_t status_read_attempts = ABB_STATUSANA_CHECK_MAX_ATTEMPTS; - - while ((*statusana & ABB_STATUSANA_LOCKED_L_Msk) == 0 && status_read_attempts > 0) { - k_busy_wait(ABB_STATUSANA_CHECK_INTERVAL_US); - status_read_attempts--; - } - return ((*statusana & ABB_STATUSANA_LOCKED_L_Msk) != 0); } From 66f717d52e2ea88ff3b4d76ee58ff523827cdee2 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:34 +0300 Subject: [PATCH 0971/2141] Revert "[nrf noup] soc: nordic: ironside: fix typo in Kconfig" This reverts commit ec8bfd85d4ec9a7e883345312633c8dfae54e9d2. Signed-off-by: Jukka Rissanen --- soc/nordic/ironside/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soc/nordic/ironside/Kconfig b/soc/nordic/ironside/Kconfig index 6eeacf067718..2430090c943b 100644 --- a/soc/nordic/ironside/Kconfig +++ b/soc/nordic/ironside/Kconfig @@ -69,7 +69,7 @@ config NRF_IRONSIDE_DVFS_OPPOINT_CHANGE_MUTEX_TIMEOUT_MS int "IRONSside DVFS change oppoint mutex timeout" default 100 help - Maximum timeout when waiting for DVFS oppoint change mutex lock. + Maximum tiemout when waiting for DVFS oppoint change mutex lock. endif # NRF_IRONSIDE_DVFS_SERVICE From 363a9d6f2fdecac79c8f9d8e7404d59b3daf917e Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:34 +0300 Subject: [PATCH 0972/2141] Revert "[nrf fromtree] boards/nordic/nrf54h20dk: added prototype s2ram_context section" This reverts commit 820b875fa19140ac5cb1f7f917edaba9890dc159. Signed-off-by: Jukka Rissanen --- .../nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index 2c86129c0f38..0eb2fc235a5c 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -333,20 +333,3 @@ zephyr_udc0: &usbhs { memory-regions = <&cpuapp_dma_region>; status = "okay"; }; - -/* Trim this RAM block for making room on all run-time common S2RAM cpu context. */ -&cpuapp_ram0 { - reg = <0x22000000 (DT_SIZE_K(32)-32)>; - ranges = <0x0 0x22000000 (0x8000-0x20)>; -}; - -/ { - soc { - /* run-time common S2RAM cpu context RAM */ - pm_s2ram: cpuapp_s2ram@22007fe0 { - compatible = "zephyr,memory-region", "mmio-sram"; - reg = <0x22007fe0 32>; - zephyr,memory-region = "pm_s2ram_context"; - }; - }; -}; From dfa5a39b193a6964b9498e41ac8e304eae61b2ad Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:34 +0300 Subject: [PATCH 0973/2141] Revert "[nrf fromtree] arch/arm/core/cortex_m: optional memory section for _cp_context" This reverts commit eb125ac902754194d2cfcc8a603f29262c18ceb9. Signed-off-by: Jukka Rissanen --- arch/arm/core/cortex_m/pm_s2ram.c | 14 +------------- subsys/pm/Kconfig | 3 --- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/arch/arm/core/cortex_m/pm_s2ram.c b/arch/arm/core/cortex_m/pm_s2ram.c index 81a4ae20a4f6..2657d48dc32a 100644 --- a/arch/arm/core/cortex_m/pm_s2ram.c +++ b/arch/arm/core/cortex_m/pm_s2ram.c @@ -1,6 +1,5 @@ /* * Copyright (c) 2022, Carlo Caione - * Copyright (c) 2025 Nordic Semiconductor ASA * * SPDX-License-Identifier: Apache-2.0 */ @@ -15,18 +14,7 @@ /** * CPU context for S2RAM */ - -#if DT_NODE_EXISTS(DT_NODELABEL(pm_s2ram)) &&\ - DT_NODE_HAS_COMPAT(DT_NODELABEL(pm_s2ram), zephyr_memory_region) - -/* Linker section name is given by `zephyr,memory-region` property of - * `zephyr,memory-region` compatible DT node with nodelabel `pm_s2ram`. - */ -__attribute__((section(DT_PROP(DT_NODELABEL(pm_s2ram), zephyr_memory_region)))) -#else -__noinit -#endif -_cpu_context_t _cpu_context; +__noinit _cpu_context_t _cpu_context; #ifndef CONFIG_PM_S2RAM_CUSTOM_MARKING /** diff --git a/subsys/pm/Kconfig b/subsys/pm/Kconfig index 7cc347369b98..c2bca1c5f04c 100644 --- a/subsys/pm/Kconfig +++ b/subsys/pm/Kconfig @@ -38,9 +38,6 @@ config PM_S2RAM depends on ARCH_HAS_SUSPEND_TO_RAM help This option enables suspend-to-RAM (S2RAM). - When enabled on Cortex-M, and a 'zephyr,memory-region' compatible node with nodelabel - 'pm_s2ram' is defined in DT, _cpu_context symbol (located in arch/arm/core/cortex_m/pm_s2ram.c) - is placed in linker section given by 'zephyr,memory-region' property of aforementioned node. config PM_S2RAM_CUSTOM_MARKING bool "Use custom marking functions" From d12a7b156e2d08164aeaeb0b2a676975fbdf0cbc Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:34 +0300 Subject: [PATCH 0974/2141] Revert "[nrf fromlist] soc: nordic: Use default SYS_CLOCK_TICKS_PER_SEC for PPR core" This reverts commit e78ab1d9e5814a0043b5fbfa8359fd021ec1f8fe. Signed-off-by: Jukka Rissanen --- soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuppr | 2 ++ soc/nordic/nrf92/Kconfig.defconfig.nrf9280_cpuppr | 3 +++ 2 files changed, 5 insertions(+) diff --git a/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuppr b/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuppr index e7f9a57a44cd..bf7c12a3a694 100644 --- a/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuppr +++ b/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuppr @@ -6,6 +6,8 @@ if SOC_NRF54H20_CPUPPR config NUM_IRQS default 496 +config SYS_CLOCK_TICKS_PER_SEC + default 1000 # # As PPR has limited memory most of tests does not fit with asserts enabled. config ASSERT diff --git a/soc/nordic/nrf92/Kconfig.defconfig.nrf9280_cpuppr b/soc/nordic/nrf92/Kconfig.defconfig.nrf9280_cpuppr index 1280c0e63c0f..8e52b3611aa2 100644 --- a/soc/nordic/nrf92/Kconfig.defconfig.nrf9280_cpuppr +++ b/soc/nordic/nrf92/Kconfig.defconfig.nrf9280_cpuppr @@ -6,6 +6,9 @@ if SOC_NRF9280_CPUPPR config NUM_IRQS default 496 +config SYS_CLOCK_TICKS_PER_SEC + default 1000 + config RV_BOOT_HART default 13 if SOC_NRF9230_ENGB From 14cd8f2e5b0e018adb7ccc9c2afb5e413730d7a7 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:34 +0300 Subject: [PATCH 0975/2141] Revert "[nrf fromlist] Bluetooth: Host: Add req/rsp l2cap validation" This reverts commit 7f148155976055f98e2549d6904d724a2fbb213c. Signed-off-by: Jukka Rissanen --- include/zephyr/bluetooth/l2cap.h | 2 - subsys/bluetooth/host/l2cap.c | 70 +++++++++----------------------- 2 files changed, 19 insertions(+), 53 deletions(-) diff --git a/include/zephyr/bluetooth/l2cap.h b/include/zephyr/bluetooth/l2cap.h index ee5203281d90..380b52ad508d 100644 --- a/include/zephyr/bluetooth/l2cap.h +++ b/include/zephyr/bluetooth/l2cap.h @@ -264,8 +264,6 @@ struct bt_l2cap_le_chan { uint16_t psm; /** Helps match request context during CoC */ uint8_t ident; - /** Opcode of the pending request. Used to match responses with requests. */ - uint8_t pending_req; bt_security_t required_sec_level; /* Response Timeout eXpired (RTX) timer */ diff --git a/subsys/bluetooth/host/l2cap.c b/subsys/bluetooth/host/l2cap.c index 466dd1e27c51..caf5424717bc 100644 --- a/subsys/bluetooth/host/l2cap.c +++ b/subsys/bluetooth/host/l2cap.c @@ -80,11 +80,8 @@ NET_BUF_POOL_FIXED_DEFINE(disc_pool, 1, sizeof(struct bt_l2cap_disconn_req)), CONFIG_BT_CONN_TX_USER_DATA_SIZE, NULL); -#define ANY_OPCODE 0x100 -#define l2cap_lookup_ident(conn, ident, req_opcode) \ - __l2cap_lookup_ident(conn, ident, req_opcode, false) -#define l2cap_remove_ident(conn, ident, req_opcode) \ - __l2cap_lookup_ident(conn, ident, req_opcode, true) +#define l2cap_lookup_ident(conn, ident) __l2cap_lookup_ident(conn, ident, false) +#define l2cap_remove_ident(conn, ident) __l2cap_lookup_ident(conn, ident, true) static sys_slist_t servers = SYS_SLIST_STATIC_INIT(&servers); #endif /* CONFIG_BT_L2CAP_DYNAMIC_CHANNEL */ @@ -142,15 +139,13 @@ static struct bt_l2cap_le_chan *l2cap_chan_alloc_cid(struct bt_conn *conn, } static struct bt_l2cap_le_chan * -__l2cap_lookup_ident(struct bt_conn *conn, uint16_t ident, uint16_t req_opcode, bool remove) +__l2cap_lookup_ident(struct bt_conn *conn, uint16_t ident, bool remove) { struct bt_l2cap_chan *chan; sys_snode_t *prev = NULL; SYS_SLIST_FOR_EACH_CONTAINER(&conn->channels, chan, node) { - if ((BT_L2CAP_LE_CHAN(chan)->ident == ident) && - ((BT_L2CAP_LE_CHAN(chan)->pending_req == req_opcode) || - (req_opcode == ANY_OPCODE))) { + if (BT_L2CAP_LE_CHAN(chan)->ident == ident) { if (remove) { sys_slist_remove(&conn->channels, prev, &chan->node); @@ -308,7 +303,7 @@ static void l2cap_rtx_timeout(struct k_work *work) bt_l2cap_chan_del(&chan->chan); /* Remove other channels if pending on the same ident */ - while ((chan = l2cap_remove_ident(conn, chan->ident, chan->pending_req))) { + while ((chan = l2cap_remove_ident(conn, chan->ident))) { bt_l2cap_chan_del(&chan->chan); } } @@ -528,23 +523,15 @@ static int l2cap_le_conn_req(struct bt_l2cap_le_chan *ch) { struct net_buf *buf; struct bt_l2cap_le_conn_req *req; - uint8_t ident; - ident = get_ident(); + ch->ident = get_ident(); - buf = l2cap_create_le_sig_pdu(BT_L2CAP_LE_CONN_REQ, ident, sizeof(*req)); + buf = l2cap_create_le_sig_pdu(BT_L2CAP_LE_CONN_REQ, + ch->ident, sizeof(*req)); if (!buf) { return -ENOMEM; } - /* TODO Ident handling/setting should ideally be done in l2cap_chan_send_req after the - * request is successfully sent on the channel but will require special considerations for - * functions such as l2cap_ecred_conn_req and bt_l2cap_ecred_chan_reconfigure where the - * ident is set for multiple channels, but the request is only sent on one. - */ - ch->ident = ident; - ch->pending_req = BT_L2CAP_LE_CONN_REQ; - req = net_buf_add(buf, sizeof(*req)); req->psm = sys_cpu_to_le16(ch->psm); req->scid = sys_cpu_to_le16(ch->rx.cid); @@ -603,7 +590,6 @@ static int l2cap_ecred_conn_req(struct bt_l2cap_chan **chan, int channels) "The MTU shall be the same for channels in the same request."); ch->ident = ident; - ch->pending_req = BT_L2CAP_ECRED_CONN_REQ; net_buf_add_le16(buf, ch->rx.cid); } @@ -1799,7 +1785,7 @@ static void le_ecred_reconf_rsp(struct bt_l2cap *l2cap, uint8_t ident, rsp = net_buf_pull_mem(buf, sizeof(*rsp)); result = sys_le16_to_cpu(rsp->result); - while ((ch = l2cap_lookup_ident(conn, ident, BT_L2CAP_ECRED_RECONF_REQ))) { + while ((ch = l2cap_lookup_ident(conn, ident))) { /* Stop timer started on REQ send. The timer is only set on one * of the channels, but we don't want to make assumptions on * which one it is. @@ -1812,7 +1798,6 @@ static void le_ecred_reconf_rsp(struct bt_l2cap *l2cap, uint8_t ident, ch->pending_rx_mtu = 0; ch->ident = 0U; - ch->pending_req = 0U; if (ch->chan.ops->reconfigured) { ch->chan.ops->reconfigured(&ch->chan); @@ -1958,7 +1943,7 @@ static void le_ecred_conn_rsp(struct bt_l2cap *l2cap, uint8_t ident, LOG_DBG("mtu 0x%04x mps 0x%04x credits 0x%04x result %u", mtu, mps, credits, result); - chan = l2cap_lookup_ident(conn, ident, BT_L2CAP_ECRED_CONN_REQ); + chan = l2cap_lookup_ident(conn, ident); if (chan) { psm = chan->psm; } else { @@ -1968,7 +1953,7 @@ static void le_ecred_conn_rsp(struct bt_l2cap *l2cap, uint8_t ident, switch (result) { case BT_L2CAP_LE_ERR_AUTHENTICATION: case BT_L2CAP_LE_ERR_ENCRYPTION: - while ((chan = l2cap_lookup_ident(conn, ident, BT_L2CAP_ECRED_CONN_REQ))) { + while ((chan = l2cap_lookup_ident(conn, ident))) { /* Cancel RTX work */ k_work_cancel_delayable(&chan->rtx_work); @@ -1988,7 +1973,7 @@ static void le_ecred_conn_rsp(struct bt_l2cap *l2cap, uint8_t ident, case BT_L2CAP_LE_ERR_SCID_IN_USE: /* Some connections refused – not enough resources available */ case BT_L2CAP_LE_ERR_NO_RESOURCES: - while ((chan = l2cap_lookup_ident(conn, ident, BT_L2CAP_ECRED_CONN_REQ))) { + while ((chan = l2cap_lookup_ident(conn, ident))) { struct bt_l2cap_chan *c; /* Cancel RTX work */ @@ -2044,7 +2029,6 @@ static void le_ecred_conn_rsp(struct bt_l2cap *l2cap, uint8_t ident, chan->tx.cid = dcid; chan->ident = 0U; - chan->pending_req = 0U; chan->tx.mtu = mtu; chan->tx.mps = mps; @@ -2065,7 +2049,7 @@ static void le_ecred_conn_rsp(struct bt_l2cap *l2cap, uint8_t ident, break; case BT_L2CAP_LE_ERR_PSM_NOT_SUPP: default: - while ((chan = l2cap_remove_ident(conn, ident, BT_L2CAP_ECRED_CONN_REQ))) { + while ((chan = l2cap_remove_ident(conn, ident))) { bt_l2cap_chan_del(&chan->chan); } break; @@ -2104,9 +2088,9 @@ static void le_conn_rsp(struct bt_l2cap *l2cap, uint8_t ident, if (result == BT_L2CAP_LE_SUCCESS || result == BT_L2CAP_LE_ERR_AUTHENTICATION || result == BT_L2CAP_LE_ERR_ENCRYPTION) { - chan = l2cap_lookup_ident(conn, ident, BT_L2CAP_LE_CONN_REQ); + chan = l2cap_lookup_ident(conn, ident); } else { - chan = l2cap_remove_ident(conn, ident, BT_L2CAP_LE_CONN_REQ); + chan = l2cap_remove_ident(conn, ident); } if (!chan) { @@ -2119,7 +2103,6 @@ static void le_conn_rsp(struct bt_l2cap *l2cap, uint8_t ident, /* Reset ident since it got a response */ chan->ident = 0U; - chan->pending_req = 0U; switch (result) { case BT_L2CAP_LE_SUCCESS: @@ -2179,17 +2162,7 @@ static void le_disconn_rsp(struct bt_l2cap *l2cap, uint8_t ident, return; } - chan = l2cap_lookup_ident(conn, ident, BT_L2CAP_DISCONN_REQ); - if (!chan) { - LOG_ERR("Cannot find channel for ident %u", ident); - return; - } - scid = sys_le16_to_cpu(rsp->scid); - if (scid != chan->rx.cid) { - LOG_ERR("Invalid scid 0x%04x", scid); - return; - } LOG_DBG("dcid 0x%04x scid 0x%04x", sys_le16_to_cpu(rsp->dcid), scid); @@ -2257,7 +2230,7 @@ static void reject_cmd(struct bt_l2cap *l2cap, uint8_t ident, struct bt_conn *conn = l2cap->chan.chan.conn; struct bt_l2cap_le_chan *chan; - while ((chan = l2cap_remove_ident(conn, ident, ANY_OPCODE))) { + while ((chan = l2cap_remove_ident(conn, ident))) { bt_l2cap_chan_del(&chan->chan); } } @@ -3124,7 +3097,6 @@ int bt_l2cap_ecred_chan_reconfigure(struct bt_l2cap_chan **chans, uint16_t mtu) ch = BT_L2CAP_LE_CHAN(chans[j]); ch->ident = ident; - ch->pending_req = BT_L2CAP_ECRED_RECONF_REQ; ch->pending_rx_mtu = mtu; net_buf_add_le16(buf, ch->rx.cid); @@ -3212,7 +3184,6 @@ int bt_l2cap_ecred_chan_reconfigure_explicit(struct bt_l2cap_chan **chans, size_ ch = BT_L2CAP_LE_CHAN(chans[i]); ch->ident = ident; - ch->pending_req = BT_L2CAP_ECRED_RECONF_REQ; ch->pending_rx_mtu = mtu; net_buf_add_le16(buf, ch->rx.cid); @@ -3265,7 +3236,6 @@ int bt_l2cap_chan_disconnect(struct bt_l2cap_chan *chan) struct net_buf *buf; struct bt_l2cap_disconn_req *req; struct bt_l2cap_le_chan *le_chan; - uint8_t ident; if (!conn) { return -ENOTCONN; @@ -3280,16 +3250,14 @@ int bt_l2cap_chan_disconnect(struct bt_l2cap_chan *chan) LOG_DBG("chan %p scid 0x%04x dcid 0x%04x", chan, le_chan->rx.cid, le_chan->tx.cid); - ident = get_ident(); + le_chan->ident = get_ident(); - buf = l2cap_create_le_sig_pdu(BT_L2CAP_DISCONN_REQ, ident, sizeof(*req)); + buf = l2cap_create_le_sig_pdu(BT_L2CAP_DISCONN_REQ, + le_chan->ident, sizeof(*req)); if (!buf) { return -ENOMEM; } - le_chan->ident = ident; - le_chan->pending_req = BT_L2CAP_DISCONN_REQ; - req = net_buf_add(buf, sizeof(*req)); req->dcid = sys_cpu_to_le16(le_chan->tx.cid); req->scid = sys_cpu_to_le16(le_chan->rx.cid); From f62043d898a2dbe1e70e3c17e227d567308f9fa2 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:34 +0300 Subject: [PATCH 0976/2141] Revert "[nrf fromtree] bluetooth: host: add frame space update support" This reverts commit 8df4dd094d35868f76e51c002a3cd76312a6f38a. Signed-off-by: Jukka Rissanen --- include/zephyr/bluetooth/conn.h | 117 -------------------------- include/zephyr/bluetooth/hci_types.h | 39 --------- subsys/bluetooth/Kconfig | 18 +--- subsys/bluetooth/controller/Kconfig | 11 --- subsys/bluetooth/host/conn.c | 72 ---------------- subsys/bluetooth/host/conn_internal.h | 3 - subsys/bluetooth/host/hci_core.c | 37 -------- subsys/bluetooth/host/shell/bt.c | 90 -------------------- tests/bluetooth/shell/testcase.yaml | 6 -- 9 files changed, 2 insertions(+), 391 deletions(-) diff --git a/include/zephyr/bluetooth/conn.h b/include/zephyr/bluetooth/conn.h index c6d8ce2015f8..2da6b2c91d63 100644 --- a/include/zephyr/bluetooth/conn.h +++ b/include/zephyr/bluetooth/conn.h @@ -273,86 +273,6 @@ struct bt_conn_le_read_all_remote_feat_complete { const uint8_t *features; }; -#define BT_CONN_LE_FRAME_SPACE_TYPES_MASK_ACL_IFS \ - (BT_HCI_LE_FRAME_SPACE_UPDATE_SPACING_TYPE_IFS_ACL_CP_MASK | \ - BT_HCI_LE_FRAME_SPACE_UPDATE_SPACING_TYPE_IFS_ACL_PC_MASK) - -#define BT_CONN_LE_FRAME_SPACE_TYPES_MASK_ACL \ - (BT_HCI_LE_FRAME_SPACE_UPDATE_SPACING_TYPE_IFS_ACL_CP_MASK | \ - BT_HCI_LE_FRAME_SPACE_UPDATE_SPACING_TYPE_IFS_ACL_PC_MASK | \ - BT_HCI_LE_FRAME_SPACE_UPDATE_SPACING_TYPE_MCES_MASK) - -#define BT_CONN_LE_FRAME_SPACE_TYPES_MASK_CIS \ - (BT_HCI_LE_FRAME_SPACE_UPDATE_SPACING_TYPE_IFS_CIS_MASK | \ - BT_HCI_LE_FRAME_SPACE_UPDATE_SPACING_TYPE_MSS_CIS_MASK) - -/** Maximum frame space in microseconds. - * As defined in Bluetooth Core Specification, Vol 4, Part E, Section 7.8.151. - */ -#define BT_CONN_LE_FRAME_SPACE_MAX (10000U) - -/** Frame space update initiator. */ -enum bt_conn_le_frame_space_update_initiator { - /** Initiated by local host */ - BT_CONN_LE_FRAME_SPACE_UPDATE_INITIATOR_LOCAL_HOST = - BT_HCI_LE_FRAME_SPACE_UPDATE_INITIATOR_LOCAL_HOST, - /** Initiated by local controller */ - BT_CONN_LE_FRAME_SPACE_UPDATE_INITIATOR_LOCAL_CONTROLLER = - BT_HCI_LE_FRAME_SPACE_UPDATE_INITIATOR_LOCAL_CONTROLLER, - /** Initiated by peer */ - BT_CONN_LE_FRAME_SPACE_UPDATE_INITIATOR_PEER = - BT_HCI_LE_FRAME_SPACE_UPDATE_INITIATOR_PEER -}; - -/** Frame space update params */ -struct bt_conn_le_frame_space_update_param { - /** Phy mask of the PHYs to be updated. - * Refer to BT_HCI_LE_FRAME_SPACE_UPDATE_PHY_* for values. - */ - uint8_t phys; - /** Spacing types mask of the spacing types to be updated. - * Refer to BT_HCI_LE_FRAME_SPACE_UPDATE_SPACING_TYPE_* and - * BT_CONN_LE_FRAME_SPACE_TYPES_MASK_* for values. - */ - uint16_t spacing_types; - /** Minimum frame space in microseconds. - * Bluetooth Core Specification, Vol 4, Part E, Section 7.8.151 - * allows for a range of frame space from 0 to 10000 microseconds. - * The actual supported frame space values will be dependent on - * the controller's capabilities. - */ - uint16_t frame_space_min; - /** Maximum frame space in microseconds. - * Bluetooth Core Specification, Vol 4, Part E, Section 7.8.151 - * allows for a range of frame space from 0 to 10000 microseconds. - * The actual supported frame space values will be dependent on - * the controller's capabilities. - */ - uint16_t frame_space_max; -}; - -/** Frame space updated callback params */ -struct bt_conn_le_frame_space_updated { - /** HCI Status from LE Frame Space Update Complete event. - * The remaining parameters will be invalid if status is not - * @ref BT_HCI_ERR_SUCCESS. - */ - uint8_t status; - /** Initiator of the frame space update. */ - enum bt_conn_le_frame_space_update_initiator initiator; - /** Updated frame space in microseconds. */ - uint16_t frame_space; - /** Phy mask of the PHYs updated. - * Refer to BT_HCI_LE_FRAME_SPACE_UPDATE_PHY_* for values. - */ - uint8_t phys; - /** Spacing types mask of the spacing types updated. - * Refer to BT_HCI_LE_FRAME_SPACE_UPDATE_SPACING_TYPE_* and - * BT_CONN_LE_FRAME_SPACE_TYPES_MASK_* for values. - */ - uint16_t spacing_types; -}; - /** Connection Type */ enum __packed bt_conn_type { /** LE Connection Type */ @@ -1305,23 +1225,6 @@ int bt_conn_le_subrate_request(struct bt_conn *conn, */ int bt_conn_le_read_all_remote_features(struct bt_conn *conn, uint8_t pages_requested); -/** @brief Update frame space. - * - * Request a change to the frame space parameters of a connection. - * This function will trigger the frame_space_updated callback when the - * procedure is completed. - * - * @kconfig_dep{CONFIG_BT_FRAME_SPACE_UPDATE}. - * - * @param conn @ref BT_CONN_TYPE_LE connection object. - * @param params Frame Space Update parameters. - * - * @return Zero on success or (negative) error code on failure. - * @return -EINVAL @p conn is not a valid @ref BT_CONN_TYPE_LE connection. - */ -int bt_conn_le_frame_space_update(struct bt_conn *conn, - const struct bt_conn_le_frame_space_update_param *params); - /** @brief Update the connection parameters. * * If the local device is in the peripheral role then updating the connection @@ -2032,26 +1935,6 @@ struct bt_conn_cb { const struct bt_conn_le_read_all_remote_feat_complete *params); #endif /* CONFIG_BT_LE_EXTENDED_FEAT_SET */ -#if defined(CONFIG_BT_FRAME_SPACE_UPDATE) - /** @brief Frame Space Update Complete event. - * - * This callback notifies the application that the frame space of - * the connection may have changed. - * The frame space update parameters will be invalid - * if status is not @ref BT_HCI_ERR_SUCCESS. - * - * This callback can be triggered by calling @ref - * bt_conn_le_frame_space_update, by the procedure running - * autonomously in the controller or by the peer. - * - * @param conn Connection object. - * @param params New frame space update parameters. - */ - void (*frame_space_updated)( - struct bt_conn *conn, - const struct bt_conn_le_frame_space_updated *params); -#endif /* CONFIG_BT_FRAME_SPACE_UPDATE */ - #if defined(CONFIG_BT_CHANNEL_SOUNDING) /** @brief LE CS Read Remote Supported Capabilities Complete event. * diff --git a/include/zephyr/bluetooth/hci_types.h b/include/zephyr/bluetooth/hci_types.h index cc4cdad93646..877617362c66 100644 --- a/include/zephyr/bluetooth/hci_types.h +++ b/include/zephyr/bluetooth/hci_types.h @@ -208,7 +208,6 @@ struct bt_hci_cmd_hdr { #define BT_LE_FEAT_BIT_CHANNEL_SOUNDING_HOST 47 #define BT_LE_FEAT_BIT_CHANNEL_SOUNDING_TONE_QUAL_IND 48 #define BT_LE_FEAT_BIT_EXTENDED_FEAT_SET 63 -#define BT_LE_FEAT_BIT_FRAME_SPACE_UPDATE 65 #define BT_LE_FEAT_TEST(feat, n) (feat[(n) >> 3] & \ BIT((n) & 7)) @@ -287,8 +286,6 @@ struct bt_hci_cmd_hdr { BT_LE_FEAT_BIT_CHANNEL_SOUNDING_HOST) #define BT_FEAT_LE_EXTENDED_FEAT_SET(feat) BT_LE_FEAT_TEST(feat, \ BT_LE_FEAT_BIT_EXTENDED_FEAT_SET) -#define BT_FEAT_LE_FRAME_SPACE_UPDATE_SET(feat) BT_LE_FEAT_TEST(feat, \ - BT_LE_FEAT_BIT_FRAME_SPACE_UPDATE) #define BT_FEAT_LE_CIS(feat) (BT_FEAT_LE_CIS_CENTRAL(feat) | \ BT_FEAT_LE_CIS_PERIPHERAL(feat)) @@ -2818,30 +2815,6 @@ struct bt_hci_cp_le_cs_remove_config { #define BT_HCI_OP_LE_CS_TEST_END BT_OP(BT_OGF_LE, 0x0096) /* 0x2096 */ -#define BT_HCI_LE_FRAME_SPACE_UPDATE_PHY_1M_MASK BIT(0) -#define BT_HCI_LE_FRAME_SPACE_UPDATE_PHY_2M_MASK BIT(1) -#define BT_HCI_LE_FRAME_SPACE_UPDATE_PHY_CODED_MASK BIT(2) - -#define BT_HCI_LE_FRAME_SPACE_UPDATE_SPACING_TYPE_IFS_ACL_CP_MASK BIT(0) -#define BT_HCI_LE_FRAME_SPACE_UPDATE_SPACING_TYPE_IFS_ACL_PC_MASK BIT(1) -#define BT_HCI_LE_FRAME_SPACE_UPDATE_SPACING_TYPE_MCES_MASK BIT(2) -#define BT_HCI_LE_FRAME_SPACE_UPDATE_SPACING_TYPE_IFS_CIS_MASK BIT(3) -#define BT_HCI_LE_FRAME_SPACE_UPDATE_SPACING_TYPE_MSS_CIS_MASK BIT(4) - -#define BT_HCI_LE_FRAME_SPACE_UPDATE_INITIATOR_LOCAL_HOST (0) -#define BT_HCI_LE_FRAME_SPACE_UPDATE_INITIATOR_LOCAL_CONTROLLER (1) -#define BT_HCI_LE_FRAME_SPACE_UPDATE_INITIATOR_PEER (2) - -struct bt_hci_cp_le_frame_space_update { - uint16_t handle; - uint16_t frame_space_min; - uint16_t frame_space_max; - uint8_t phys; - uint16_t spacing_types; -} __packed; - -#define BT_HCI_OP_LE_FRAME_SPACE_UPDATE BT_OP(BT_OGF_LE, 0x009D) /* 0x209D */ - /* Event definitions */ #define BT_HCI_EVT_UNKNOWN 0x00 @@ -4031,16 +4004,6 @@ struct bt_hci_evt_le_cs_procedure_enable_complete { uint16_t max_procedure_len; } __packed; -#define BT_HCI_EVT_LE_FRAME_SPACE_UPDATE_COMPLETE 0x35 -struct bt_hci_evt_le_frame_space_update_complete { - uint8_t status; - uint16_t handle; - uint8_t initiator; - uint16_t frame_space; - uint8_t phys; - uint16_t spacing_types; -} __packed; - /* Event mask bits */ #define BT_EVT_BIT(n) (1ULL << (n)) @@ -4142,8 +4105,6 @@ struct bt_hci_evt_le_frame_space_update_complete { #define BT_EVT_MASK_LE_CS_SUBEVENT_RESULT_CONTINUE BT_EVT_BIT(49) #define BT_EVT_MASK_LE_CS_TEST_END_COMPLETE BT_EVT_BIT(50) -#define BT_EVT_MASK_LE_FRAME_SPACE_UPDATE_COMPLETE BT_EVT_BIT(52) - /** HCI Error Codes, BT Core Spec v5.4 [Vol 1, Part F]. */ #define BT_HCI_ERR_SUCCESS 0x00 #define BT_HCI_ERR_UNKNOWN_CMD 0x01 diff --git a/subsys/bluetooth/Kconfig b/subsys/bluetooth/Kconfig index 7e8fa5dca6ec..3c297f370b0c 100644 --- a/subsys/bluetooth/Kconfig +++ b/subsys/bluetooth/Kconfig @@ -115,18 +115,10 @@ config BT_CONN_TX help Hidden configuration that is true if ACL or broadcast ISO is enabled -config BT_LE_LOCAL_MINIMUM_REQUIRED_FEATURE_PAGE - int - default 1 if BT_FRAME_SPACE_UPDATE - default 0 - depends on BT_LE_EXTENDED_FEAT_SET - help - Minimum required feature page that must be supported. - config BT_LE_MAX_LOCAL_SUPPORTED_FEATURE_PAGE int "Maximum supported feature page" - default BT_LE_LOCAL_MINIMUM_REQUIRED_FEATURE_PAGE - range BT_LE_LOCAL_MINIMUM_REQUIRED_FEATURE_PAGE 10 + default 0 + range 0 10 depends on BT_LE_EXTENDED_FEAT_SET help Maximum feature page that can be stored for local supported features. @@ -220,12 +212,6 @@ config BT_SUBRATING Enable support for LE Connection Subrating feature that is defined in the Bluetooth Core specification, Version 5.4 | Vol 6, Part B, Section 4.6.35. -config BT_FRAME_SPACE_UPDATE - bool "Frame Space Update" - depends on (!HAS_BT_CTLR || BT_CTLR_FRAME_SPACE_UPDATE_SUPPORT) && BT_CONN && BT_LE_EXTENDED_FEAT_SET - help - Enable support for Bluetooth 6.0 Frame Space Update feature. - config BT_CHANNEL_SOUNDING bool "Channel Sounding [EXPERIMENTAL]" select EXPERIMENTAL diff --git a/subsys/bluetooth/controller/Kconfig b/subsys/bluetooth/controller/Kconfig index 3b2c5beae802..c7e7030ba287 100644 --- a/subsys/bluetooth/controller/Kconfig +++ b/subsys/bluetooth/controller/Kconfig @@ -125,9 +125,6 @@ config BT_CTLR_LE_PATH_LOSS_MONITORING_SUPPORT config BT_CTLR_SUBRATING_SUPPORT bool -config BT_CTLR_FRAME_SPACE_UPDATE_SUPPORT - bool - config BT_CTLR_CHANNEL_SOUNDING_SUPPORT bool @@ -1173,14 +1170,6 @@ config BT_CTLR_SUBRATING Enable support for Bluetooth v5.3 LE Connection Subrating in the Controller. -config BT_CTLR_FRAME_SPACE_UPDATE - bool "Frame Space Update" - depends on BT_CTLR_FRAME_SPACE_UPDATE_SUPPORT - default y if BT_FRAME_SPACE_UPDATE - help - Enable support for Bluetooth 6.0 Frame Space Update - in the Controller. - config BT_CTLR_CHANNEL_SOUNDING bool "Channel Sounding support" depends on BT_CTLR_CHANNEL_SOUNDING_SUPPORT diff --git a/subsys/bluetooth/host/conn.c b/subsys/bluetooth/host/conn.c index 10c112507277..f930d85b3347 100644 --- a/subsys/bluetooth/host/conn.c +++ b/subsys/bluetooth/host/conn.c @@ -3402,78 +3402,6 @@ int bt_conn_le_read_all_remote_features(struct bt_conn *conn, uint8_t pages_requ } #endif /* CONFIG_BT_LE_EXTENDED_FEAT_SET */ -#if defined(CONFIG_BT_FRAME_SPACE_UPDATE) -void notify_frame_space_update_complete(struct bt_conn *conn, - struct bt_conn_le_frame_space_updated *params) -{ - if (IS_ENABLED(CONFIG_BT_CONN_DYNAMIC_CALLBACKS)) { - struct bt_conn_cb *callback; - - SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { - if (callback->frame_space_updated != NULL) { - callback->frame_space_updated(conn, params); - } - } - } - - STRUCT_SECTION_FOREACH(bt_conn_cb, cb) - { - if (cb->frame_space_updated != NULL) { - cb->frame_space_updated(conn, params); - } - } -} - -static bool frame_space_update_param_valid(const struct bt_conn_le_frame_space_update_param *param) -{ - if (param->frame_space_min > BT_CONN_LE_FRAME_SPACE_MAX || - param->frame_space_max > BT_CONN_LE_FRAME_SPACE_MAX || - param->frame_space_min > param->frame_space_max) { - return false; - } - - if (param->spacing_types == 0) { - return false; - } - - if (param->phys == 0) { - return false; - } - - return true; -} - -int bt_conn_le_frame_space_update(struct bt_conn *conn, - const struct bt_conn_le_frame_space_update_param *param) -{ - struct bt_hci_cp_le_frame_space_update *cp; - struct net_buf *buf; - - if (!bt_conn_is_type(conn, BT_CONN_TYPE_LE)) { - LOG_DBG("Invalid connection type: %u for %p", conn->type, conn); - return -EINVAL; - } - - if (!frame_space_update_param_valid(param)) { - return -EINVAL; - } - - buf = bt_hci_cmd_alloc(K_FOREVER); - if (buf == NULL) { - return -ENOBUFS; - } - - cp = net_buf_add(buf, sizeof(*cp)); - cp->handle = sys_cpu_to_le16(conn->handle); - cp->frame_space_min = sys_cpu_to_le16(param->frame_space_min); - cp->frame_space_max = sys_cpu_to_le16(param->frame_space_max); - cp->spacing_types = sys_cpu_to_le16(param->spacing_types); - cp->phys = param->phys; - - return bt_hci_cmd_send_sync(BT_HCI_OP_LE_FRAME_SPACE_UPDATE, buf, NULL); -} -#endif /* CONFIG_BT_FRAME_SPACE_UPDATE */ - #if defined(CONFIG_BT_CHANNEL_SOUNDING) void notify_remote_cs_capabilities(struct bt_conn *conn, uint8_t status, struct bt_conn_le_cs_capabilities *params) diff --git a/subsys/bluetooth/host/conn_internal.h b/subsys/bluetooth/host/conn_internal.h index a31ca85c315b..495de9114462 100644 --- a/subsys/bluetooth/host/conn_internal.h +++ b/subsys/bluetooth/host/conn_internal.h @@ -517,9 +517,6 @@ void notify_subrate_change(struct bt_conn *conn, void notify_read_all_remote_feat_complete(struct bt_conn *conn, struct bt_conn_le_read_all_remote_feat_complete *params); -void notify_frame_space_update_complete(struct bt_conn *conn, - struct bt_conn_le_frame_space_updated *params); - void notify_remote_cs_capabilities(struct bt_conn *conn, uint8_t status, struct bt_conn_le_cs_capabilities *params); diff --git a/subsys/bluetooth/host/hci_core.c b/subsys/bluetooth/host/hci_core.c index 1f649689c7af..1fe19b5373b7 100644 --- a/subsys/bluetooth/host/hci_core.c +++ b/subsys/bluetooth/host/hci_core.c @@ -1831,33 +1831,6 @@ static void le_read_all_remote_feat_complete(struct net_buf *buf) } #endif /* CONFIG_BT_LE_EXTENDED_FEAT_SET */ -#if defined(CONFIG_BT_FRAME_SPACE_UPDATE) -static void le_frame_space_update_complete(struct net_buf *buf) -{ - struct bt_hci_evt_le_frame_space_update_complete *evt = (void *)buf->data; - struct bt_conn *conn; - struct bt_conn_le_frame_space_updated params; - uint16_t handle = sys_le16_to_cpu(evt->handle); - - conn = bt_conn_lookup_handle(handle, BT_CONN_TYPE_LE); - if (conn == NULL) { - LOG_ERR("Unknown conn handle 0x%04X", handle); - return; - } - - params.status = evt->status; - - if (params.status == BT_HCI_ERR_SUCCESS) { - params.phys = evt->phys; - params.spacing_types = evt->spacing_types; - params.frame_space = evt->frame_space; - params.initiator = evt->initiator; - } - - notify_frame_space_update_complete(conn, ¶ms); -} -#endif /* CONFIG_BT_FRAME_SPACE_UPDATE */ - #if defined(CONFIG_BT_DATA_LEN_UPDATE) static void le_data_len_change(struct net_buf *buf) { @@ -2985,11 +2958,6 @@ static const struct event_handler meta_events[] = { le_read_all_remote_feat_complete, sizeof(struct bt_hci_evt_le_read_all_remote_feat_complete)), #endif /* CONFIG_BT_LE_EXTENDED_FEAT_SET */ -#if defined(CONFIG_BT_FRAME_SPACE_UPDATE) - EVENT_HANDLER(BT_HCI_EVT_LE_FRAME_SPACE_UPDATE_COMPLETE, - le_frame_space_update_complete, - sizeof(struct bt_hci_evt_le_frame_space_update_complete)), -#endif /* CONFIG_BT_FRAME_SPACE_UPDATE */ #endif /* CONFIG_BT_CONN */ #if defined(CONFIG_BT_CHANNEL_SOUNDING) EVENT_HANDLER(BT_HCI_EVT_LE_CS_READ_REMOTE_SUPPORTED_CAPABILITIES_COMPLETE, @@ -3556,11 +3524,6 @@ static int le_set_event_mask(void) BT_FEAT_LE_EXTENDED_FEAT_SET(bt_dev.le.features)) { mask |= BT_EVT_MASK_LE_READ_ALL_REMOTE_FEAT_COMPLETE; } - - if (IS_ENABLED(CONFIG_BT_FRAME_SPACE_UPDATE) && - BT_FEAT_LE_FRAME_SPACE_UPDATE_SET(bt_dev.le.features)) { - mask |= BT_EVT_MASK_LE_FRAME_SPACE_UPDATE_COMPLETE; - } } if (IS_ENABLED(CONFIG_BT_SMP) && diff --git a/subsys/bluetooth/host/shell/bt.c b/subsys/bluetooth/host/shell/bt.c index d9f7467104a9..0946939f22cf 100644 --- a/subsys/bluetooth/host/shell/bt.c +++ b/subsys/bluetooth/host/shell/bt.c @@ -1041,38 +1041,6 @@ void read_all_remote_feat_complete(struct bt_conn *conn, } #endif -#if defined(CONFIG_BT_FRAME_SPACE_UPDATE) -static const char *frame_space_initiator_to_str( - enum bt_conn_le_frame_space_update_initiator initiator) -{ - switch (initiator) { - case BT_CONN_LE_FRAME_SPACE_UPDATE_INITIATOR_LOCAL_HOST: - return "Local Host"; - case BT_CONN_LE_FRAME_SPACE_UPDATE_INITIATOR_LOCAL_CONTROLLER: - return "Local Controller"; - case BT_CONN_LE_FRAME_SPACE_UPDATE_INITIATOR_PEER: - return "Peer"; - default: - return "Unknown"; - } -} - -void frame_space_updated(struct bt_conn *conn, - const struct bt_conn_le_frame_space_updated *params) -{ - if (params->status != BT_HCI_ERR_SUCCESS) { - bt_shell_print("Frame space update failed (HCI status 0x%02x)", - params->status); - return; - } - - bt_shell_print( - "Frame space updated: frame space %d us, PHYs 0x%04x, spacing types 0x%04x, initiator %s", - params->frame_space, params->phys, params->spacing_types, - frame_space_initiator_to_str(params->initiator)); -} -#endif - #if defined(CONFIG_BT_CHANNEL_SOUNDING) void print_remote_cs_capabilities(struct bt_conn *conn, uint8_t status, @@ -1255,9 +1223,6 @@ BT_CONN_CB_DEFINE(conn_callbacks) = { #if defined(CONFIG_BT_LE_EXTENDED_FEAT_SET) .read_all_remote_feat_complete = read_all_remote_feat_complete, #endif -#if defined(CONFIG_BT_FRAME_SPACE_UPDATE) - .frame_space_updated = frame_space_updated, -#endif #if defined(CONFIG_BT_CHANNEL_SOUNDING) .le_cs_read_remote_capabilities_complete = print_remote_cs_capabilities, .le_cs_read_remote_fae_table_complete = print_remote_cs_fae_table, @@ -3378,55 +3343,6 @@ static int cmd_read_all_remote_features(const struct shell *sh, size_t argc, cha } #endif -#if defined(CONFIG_BT_FRAME_SPACE_UPDATE) -static int cmd_frame_space_update(const struct shell *sh, size_t argc, char *argv[]) -{ - int err = 0; - struct bt_conn_le_frame_space_update_param params; - - if (default_conn == NULL) { - shell_error(sh, "Conn handle error, at least one connection is required."); - return -ENOEXEC; - } - - params.frame_space_min = shell_strtoul(argv[1], 10, &err); - if (err) { - shell_help(sh); - shell_error(sh, "Could not parse frame_space_min input"); - return SHELL_CMD_HELP_PRINTED; - } - - params.frame_space_max = shell_strtoul(argv[2], 10, &err); - if (err) { - shell_help(sh); - shell_error(sh, "Could not parse frame_space_max input"); - return SHELL_CMD_HELP_PRINTED; - } - - params.phys = shell_strtoul(argv[3], 16, &err); - if (err) { - shell_help(sh); - shell_error(sh, "Could not parse phys input"); - return SHELL_CMD_HELP_PRINTED; - } - - params.spacing_types = shell_strtoul(argv[4], 16, &err); - if (err) { - shell_help(sh); - shell_error(sh, "Could not parse spacing_types input"); - return SHELL_CMD_HELP_PRINTED; - } - - err = bt_conn_le_frame_space_update(default_conn, ¶ms); - if (err != 0) { - shell_error(sh, "bt_conn_le_frame_space_update returned error %d", err); - return -ENOEXEC; - } - - return 0; -} -#endif - #if defined(CONFIG_BT_CONN) #if defined(CONFIG_BT_CENTRAL) static int bt_do_connect_le(int *ercd, size_t argc, char *argv[]) @@ -5182,12 +5098,6 @@ SHELL_STATIC_SUBCMD_SET_CREATE(bt_cmds, SHELL_CMD_ARG(read-all-remote-features, NULL, "", cmd_read_all_remote_features, 2, 0), #endif -#if defined(CONFIG_BT_FRAME_SPACE_UPDATE) - SHELL_CMD_ARG(frame-space-update, NULL, - "[frame_space_min ] [frame_space_max ] [phys ] " - "[spacing_types ]", - cmd_frame_space_update, 5, 0), -#endif #if defined(CONFIG_BT_BROADCASTER) SHELL_CMD_ARG(advertise, NULL, " [mode: discov, non_discov] " diff --git a/tests/bluetooth/shell/testcase.yaml b/tests/bluetooth/shell/testcase.yaml index 45812ca51323..0517acd65ad4 100644 --- a/tests/bluetooth/shell/testcase.yaml +++ b/tests/bluetooth/shell/testcase.yaml @@ -40,12 +40,6 @@ tests: - CONFIG_BT_LE_EXTENDED_FEAT_SET=y - CONFIG_BT_LL_SW_SPLIT=n build_only: true - bluetooth.shell.frame_space_update: - extra_configs: - - CONFIG_BT_FRAME_SPACE_UPDATE=y - - CONFIG_BT_LE_EXTENDED_FEAT_SET=y - - CONFIG_BT_LL_SW_SPLIT=n - build_only: true bluetooth.shell.channel_sounding: extra_configs: - CONFIG_BT_CHANNEL_SOUNDING=y From 2de0d36d252a019311bd5b7a9e010d8425aee823 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:34 +0300 Subject: [PATCH 0977/2141] Revert "[nrf fromtree] bluetooth: host: Fix BT_LE_LOCAL_SUPPORTED_FEATURES_SIZE define" This reverts commit 6c44930b7af9522a832e46b20d23012df1a8dab2. Signed-off-by: Jukka Rissanen --- include/zephyr/bluetooth/bluetooth.h | 9 ++++----- subsys/bluetooth/Kconfig | 3 ++- subsys/bluetooth/host/conn.c | 10 ++++------ 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/include/zephyr/bluetooth/bluetooth.h b/include/zephyr/bluetooth/bluetooth.h index 750155d211e4..a061b0564bfb 100644 --- a/include/zephyr/bluetooth/bluetooth.h +++ b/include/zephyr/bluetooth/bluetooth.h @@ -77,11 +77,10 @@ extern "C" { * The value of 8 correspond to page 0 in the LE Controller supported features. * 24 bytes are required for all subsequent supported feature pages. */ -#define BT_LE_LOCAL_SUPPORTED_FEATURES_SIZE \ - (BT_HCI_LE_BYTES_PAGE_0_FEATURE_PAGE + \ - COND_CODE_1(CONFIG_BT_LE_MAX_LOCAL_SUPPORTED_FEATURE_PAGE, \ - (CONFIG_BT_LE_MAX_LOCAL_SUPPORTED_FEATURE_PAGE \ - * BT_HCI_LE_BYTES_PER_FEATURE_PAGE), \ +#define BT_LE_LOCAL_SUPPORTED_FEATURES_SIZE \ + (BT_HCI_LE_BYTES_PAGE_0_FEATURE_PAGE + \ + COND_CODE_1(CONFIG_BT_LE_MAX_LOCAL_SUPPORTED_FEATURE_PAGE, \ + CONFIG_BT_LE_MAX_LOCAL_SUPPORTED_FEATURE_PAGE * BT_HCI_LE_BYTES_PER_FEATURE_PAGE, \ (0U))) /** Opaque type representing an advertiser. */ diff --git a/subsys/bluetooth/Kconfig b/subsys/bluetooth/Kconfig index 3c297f370b0c..26efaf7832d7 100644 --- a/subsys/bluetooth/Kconfig +++ b/subsys/bluetooth/Kconfig @@ -121,7 +121,8 @@ config BT_LE_MAX_LOCAL_SUPPORTED_FEATURE_PAGE range 0 10 depends on BT_LE_EXTENDED_FEAT_SET help - Maximum feature page that can be stored for local supported features. + Maximum supported feature page that can be stored locally and fetched + from the remote connection with the LL Extended Feature Set feature. config BT_LE_EXTENDED_FEAT_SET bool "LL Extended Feature Set" diff --git a/subsys/bluetooth/host/conn.c b/subsys/bluetooth/host/conn.c index f930d85b3347..3a2adf814b9f 100644 --- a/subsys/bluetooth/host/conn.c +++ b/subsys/bluetooth/host/conn.c @@ -3357,13 +3357,11 @@ int bt_conn_le_subrate_request(struct bt_conn *conn, void notify_read_all_remote_feat_complete(struct bt_conn *conn, struct bt_conn_le_read_all_remote_feat_complete *params) { - if (IS_ENABLED(CONFIG_BT_CONN_DYNAMIC_CALLBACKS)) { - struct bt_conn_cb *callback; + struct bt_conn_cb *callback; - SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { - if (callback->read_all_remote_feat_complete != NULL) { - callback->read_all_remote_feat_complete(conn, params); - } + SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { + if (callback->read_all_remote_feat_complete != NULL) { + callback->read_all_remote_feat_complete(conn, params); } } From 61671d1f729a3aa651caeeef0fb72e9d330968ce Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:34 +0300 Subject: [PATCH 0978/2141] Revert "[nrf fromtree] Bluetooth: Add configuration to control the dynamic connection callbacks" This reverts commit 208b1b9dca7bb336cf5a20496477ac5cf3dd6e9f. Signed-off-by: Jukka Rissanen --- .../central_hr/overlay-static_callbacks.conf | 2 - samples/bluetooth/central_hr/prj_minimal.conf | 1 - .../overlay-static_callbacks.conf | 2 - .../bluetooth/peripheral_hr/prj_minimal.conf | 1 - subsys/bluetooth/Kconfig | 10 - subsys/bluetooth/host/conn.c | 258 +++++++----------- tests/bluetooth/gatt/testcase.yaml | 14 - tests/bluetooth/shell/testcase.yaml | 6 - ...ntral_hr_peripheral_hr_static_callbacks.sh | 24 -- tests/bsim/bluetooth/samples/compile.sh | 9 - 10 files changed, 104 insertions(+), 223 deletions(-) delete mode 100644 samples/bluetooth/central_hr/overlay-static_callbacks.conf delete mode 100644 samples/bluetooth/peripheral_hr/overlay-static_callbacks.conf delete mode 100755 tests/bsim/bluetooth/samples/central_hr_peripheral_hr/tests_scripts/central_hr_peripheral_hr_static_callbacks.sh diff --git a/samples/bluetooth/central_hr/overlay-static_callbacks.conf b/samples/bluetooth/central_hr/overlay-static_callbacks.conf deleted file mode 100644 index 528958ad3a92..000000000000 --- a/samples/bluetooth/central_hr/overlay-static_callbacks.conf +++ /dev/null @@ -1,2 +0,0 @@ -# Disable connection dynamic callbacks -CONFIG_BT_CONN_DYNAMIC_CALLBACKS=n diff --git a/samples/bluetooth/central_hr/prj_minimal.conf b/samples/bluetooth/central_hr/prj_minimal.conf index 983b5a934d71..3ea96d693c71 100644 --- a/samples/bluetooth/central_hr/prj_minimal.conf +++ b/samples/bluetooth/central_hr/prj_minimal.conf @@ -87,7 +87,6 @@ CONFIG_BT_GATT_SERVICE_CHANGED=n CONFIG_BT_GAP_PERIPHERAL_PREF_PARAMS=n CONFIG_BT_SETTINGS_CCC_LAZY_LOADING=y CONFIG_BT_HCI_VS=n -CONFIG_BT_CONN_DYNAMIC_CALLBACKS=n # Disable Bluetooth controller features not needed CONFIG_BT_CTLR_PRIVACY=n diff --git a/samples/bluetooth/peripheral_hr/overlay-static_callbacks.conf b/samples/bluetooth/peripheral_hr/overlay-static_callbacks.conf deleted file mode 100644 index 528958ad3a92..000000000000 --- a/samples/bluetooth/peripheral_hr/overlay-static_callbacks.conf +++ /dev/null @@ -1,2 +0,0 @@ -# Disable connection dynamic callbacks -CONFIG_BT_CONN_DYNAMIC_CALLBACKS=n diff --git a/samples/bluetooth/peripheral_hr/prj_minimal.conf b/samples/bluetooth/peripheral_hr/prj_minimal.conf index 76cac20ec5ef..8f9c2b85cb14 100644 --- a/samples/bluetooth/peripheral_hr/prj_minimal.conf +++ b/samples/bluetooth/peripheral_hr/prj_minimal.conf @@ -93,7 +93,6 @@ CONFIG_BT_GATT_SERVICE_CHANGED=n CONFIG_BT_GAP_PERIPHERAL_PREF_PARAMS=n CONFIG_BT_SETTINGS_CCC_LAZY_LOADING=y CONFIG_BT_HCI_VS=n -CONFIG_BT_CONN_DYNAMIC_CALLBACKS=n # Disable Bluetooth controller features not needed CONFIG_BT_CTLR_PRIVACY=n diff --git a/subsys/bluetooth/Kconfig b/subsys/bluetooth/Kconfig index 26efaf7832d7..c98c7a5ff538 100644 --- a/subsys/bluetooth/Kconfig +++ b/subsys/bluetooth/Kconfig @@ -131,16 +131,6 @@ config BT_LE_EXTENDED_FEAT_SET Enable support for the LL Extended Feature Set feature. if BT_CONN -config BT_CONN_DYNAMIC_CALLBACKS - bool "Dynamic connection callbacks" - default y - help - Enable support for dynamic connection callbacks. This links in - bt_conn_cb_register(). Disabling this config is safe. It will make - uses of this and associated APIs fail to link. Note: Static registration - through BT_CONN_CB_DEFINE() is always available and does not depend on - this config. - config BT_HCI_ACL_FLOW_CONTROL bool "Controller to Host ACL flow control support" # Enable if building a Host-only build diff --git a/subsys/bluetooth/host/conn.c b/subsys/bluetooth/host/conn.c index 3a2adf814b9f..abcc3d861ff9 100644 --- a/subsys/bluetooth/host/conn.c +++ b/subsys/bluetooth/host/conn.c @@ -1650,13 +1650,11 @@ static void tx_complete_work(struct k_work *work) static void notify_recycled_conn_slot(void) { #if defined(CONFIG_BT_CONN) - if (IS_ENABLED(CONFIG_BT_CONN_DYNAMIC_CALLBACKS)) { - struct bt_conn_cb *callback; + struct bt_conn_cb *callback; - SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { - if (callback->recycled) { - callback->recycled(); - } + SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { + if (callback->recycled) { + callback->recycled(); } } @@ -1831,13 +1829,11 @@ void bt_conn_connected(struct bt_conn *conn) #if defined(CONFIG_BT_CLASSIC) void bt_conn_role_changed(struct bt_conn *conn, uint8_t status) { - if (IS_ENABLED(CONFIG_BT_CONN_DYNAMIC_CALLBACKS)) { - struct bt_conn_cb *callback; + struct bt_conn_cb *callback; - SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { - if (callback->role_changed) { - callback->role_changed(conn, status); - } + SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { + if (callback->role_changed) { + callback->role_changed(conn, status); } } @@ -1912,14 +1908,12 @@ int bt_conn_disconnect(struct bt_conn *conn, uint8_t reason) static void notify_connected(struct bt_conn *conn) { - if (IS_ENABLED(CONFIG_BT_CONN_DYNAMIC_CALLBACKS)) { - struct bt_conn_cb *callback; + struct bt_conn_cb *callback; - SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { + SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { - if (callback->connected) { - callback->connected(conn, conn->err); - } + if (callback->connected) { + callback->connected(conn, conn->err); } } @@ -1932,13 +1926,11 @@ static void notify_connected(struct bt_conn *conn) static void notify_disconnected(struct bt_conn *conn) { - if (IS_ENABLED(CONFIG_BT_CONN_DYNAMIC_CALLBACKS)) { - struct bt_conn_cb *callback; + struct bt_conn_cb *callback; - SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { - if (callback->disconnected) { - callback->disconnected(conn, conn->err); - } + SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { + if (callback->disconnected) { + callback->disconnected(conn, conn->err); } } @@ -1961,13 +1953,11 @@ void notify_remote_info(struct bt_conn *conn) return; } - if (IS_ENABLED(CONFIG_BT_CONN_DYNAMIC_CALLBACKS)) { - struct bt_conn_cb *callback; + struct bt_conn_cb *callback; - SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { - if (callback->remote_info_available) { - callback->remote_info_available(conn, &remote_info); - } + SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { + if (callback->remote_info_available) { + callback->remote_info_available(conn, &remote_info); } } @@ -1992,14 +1982,13 @@ void notify_le_param_updated(struct bt_conn *conn) atomic_clear_bit(conn->flags, BT_CONN_PERIPHERAL_PARAM_SET); } - if (IS_ENABLED(CONFIG_BT_CONN_DYNAMIC_CALLBACKS)) { - struct bt_conn_cb *callback; + struct bt_conn_cb *callback; - SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { - if (callback->le_param_updated) { - callback->le_param_updated(conn, conn->le.interval, - conn->le.latency, conn->le.timeout); - } + SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { + if (callback->le_param_updated) { + callback->le_param_updated(conn, conn->le.interval, + conn->le.latency, + conn->le.timeout); } } @@ -2015,13 +2004,11 @@ void notify_le_param_updated(struct bt_conn *conn) #if defined(CONFIG_BT_USER_DATA_LEN_UPDATE) void notify_le_data_len_updated(struct bt_conn *conn) { - if (IS_ENABLED(CONFIG_BT_CONN_DYNAMIC_CALLBACKS)) { - struct bt_conn_cb *callback; + struct bt_conn_cb *callback; - SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { - if (callback->le_data_len_updated) { - callback->le_data_len_updated(conn, &conn->le.data_len); - } + SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { + if (callback->le_data_len_updated) { + callback->le_data_len_updated(conn, &conn->le.data_len); } } @@ -2036,13 +2023,11 @@ void notify_le_data_len_updated(struct bt_conn *conn) #if defined(CONFIG_BT_USER_PHY_UPDATE) void notify_le_phy_updated(struct bt_conn *conn) { - if (IS_ENABLED(CONFIG_BT_CONN_DYNAMIC_CALLBACKS)) { - struct bt_conn_cb *callback; + struct bt_conn_cb *callback; - SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { - if (callback->le_phy_updated) { - callback->le_phy_updated(conn, &conn->le.phy); - } + SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { + if (callback->le_phy_updated) { + callback->le_phy_updated(conn, &conn->le.phy); } } @@ -2060,24 +2045,22 @@ bool le_param_req(struct bt_conn *conn, struct bt_le_conn_param *param) return false; } - if (IS_ENABLED(CONFIG_BT_CONN_DYNAMIC_CALLBACKS)) { - struct bt_conn_cb *callback; + struct bt_conn_cb *callback; - SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { - if (!callback->le_param_req) { - continue; - } + SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { + if (!callback->le_param_req) { + continue; + } - if (!callback->le_param_req(conn, param)) { - return false; - } + if (!callback->le_param_req(conn, param)) { + return false; + } - /* The callback may modify the parameters so we need to - * double-check that it returned valid parameters. - */ - if (!bt_le_conn_params_valid(param)) { - return false; - } + /* The callback may modify the parameters so we need to + * double-check that it returned valid parameters. + */ + if (!bt_le_conn_params_valid(param)) { + return false; } } @@ -2464,13 +2447,12 @@ void bt_conn_identity_resolved(struct bt_conn *conn) rpa = &conn->le.init_addr; } - if (IS_ENABLED(CONFIG_BT_CONN_DYNAMIC_CALLBACKS)) { - struct bt_conn_cb *callback; - SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { - if (callback->identity_resolved) { - callback->identity_resolved(conn, rpa, &conn->le.dst); - } + struct bt_conn_cb *callback; + + SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { + if (callback->identity_resolved) { + callback->identity_resolved(conn, rpa, &conn->le.dst); } } @@ -2584,13 +2566,11 @@ void bt_conn_security_changed(struct bt_conn *conn, uint8_t hci_err, bt_iso_security_changed(conn, hci_err); } - if (IS_ENABLED(CONFIG_BT_CONN_DYNAMIC_CALLBACKS)) { - struct bt_conn_cb *callback; + struct bt_conn_cb *callback; - SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { - if (callback->security_changed) { - callback->security_changed(conn, conn->sec_level, err); - } + SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { + if (callback->security_changed) { + callback->security_changed(conn, conn->sec_level, err); } } @@ -2688,8 +2668,6 @@ bt_security_t bt_conn_get_security(const struct bt_conn *conn) } #endif /* CONFIG_BT_SMP */ -#if defined(CONFIG_BT_CONN_DYNAMIC_CALLBACKS) - int bt_conn_cb_register(struct bt_conn_cb *cb) { if (sys_slist_find(&conn_cbs, &cb->_node, NULL)) { @@ -2714,8 +2692,6 @@ int bt_conn_cb_unregister(struct bt_conn_cb *cb) return 0; } -#endif /* CONFIG_BT_CONN_DYNAMIC_CALLBACKS */ - bool bt_conn_exists_le(uint8_t id, const bt_addr_le_t *peer) { struct bt_conn *conn = bt_conn_lookup_addr_le(id, peer); @@ -3027,13 +3003,11 @@ static int bt_conn_get_tx_power_level(struct bt_conn *conn, uint8_t type, void notify_tx_power_report(struct bt_conn *conn, struct bt_conn_le_tx_power_report report) { - if (IS_ENABLED(CONFIG_BT_CONN_DYNAMIC_CALLBACKS)) { - struct bt_conn_cb *callback; + struct bt_conn_cb *callback; - SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { - if (callback->tx_power_report) { - callback->tx_power_report(conn, &report); - } + SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { + if (callback->tx_power_report) { + callback->tx_power_report(conn, &report); } } @@ -3174,13 +3148,11 @@ int bt_conn_le_get_tx_power_level(struct bt_conn *conn, void notify_path_loss_threshold_report(struct bt_conn *conn, struct bt_conn_le_path_loss_threshold_report report) { - if (IS_ENABLED(CONFIG_BT_CONN_DYNAMIC_CALLBACKS)) { - struct bt_conn_cb *callback; + struct bt_conn_cb *callback; - SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { - if (callback->path_loss_threshold_report) { - callback->path_loss_threshold_report(conn, &report); - } + SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { + if (callback->path_loss_threshold_report) { + callback->path_loss_threshold_report(conn, &report); } } @@ -3247,13 +3219,11 @@ int bt_conn_le_set_path_loss_mon_enable(struct bt_conn *conn, bool reporting_ena void notify_subrate_change(struct bt_conn *conn, const struct bt_conn_le_subrate_changed params) { - if (IS_ENABLED(CONFIG_BT_CONN_DYNAMIC_CALLBACKS)) { - struct bt_conn_cb *callback; + struct bt_conn_cb *callback; - SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { - if (callback->subrate_changed) { - callback->subrate_changed(conn, ¶ms); - } + SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { + if (callback->subrate_changed) { + callback->subrate_changed(conn, ¶ms); } } @@ -3404,14 +3374,11 @@ int bt_conn_le_read_all_remote_features(struct bt_conn *conn, uint8_t pages_requ void notify_remote_cs_capabilities(struct bt_conn *conn, uint8_t status, struct bt_conn_le_cs_capabilities *params) { - if (IS_ENABLED(CONFIG_BT_CONN_DYNAMIC_CALLBACKS)) { - struct bt_conn_cb *callback; + struct bt_conn_cb *callback; - SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { - if (callback->le_cs_read_remote_capabilities_complete) { - callback->le_cs_read_remote_capabilities_complete(conn, status, - params); - } + SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { + if (callback->le_cs_read_remote_capabilities_complete) { + callback->le_cs_read_remote_capabilities_complete(conn, status, params); } } @@ -3425,14 +3392,11 @@ void notify_remote_cs_capabilities(struct bt_conn *conn, uint8_t status, void notify_remote_cs_fae_table(struct bt_conn *conn, uint8_t status, struct bt_conn_le_cs_fae_table *params) { - if (IS_ENABLED(CONFIG_BT_CONN_DYNAMIC_CALLBACKS)) { - struct bt_conn_cb *callback; + struct bt_conn_cb *callback; - SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { - if (callback->le_cs_read_remote_fae_table_complete) { - callback->le_cs_read_remote_fae_table_complete(conn, status, - params); - } + SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { + if (callback->le_cs_read_remote_fae_table_complete) { + callback->le_cs_read_remote_fae_table_complete(conn, status, params); } } @@ -3446,13 +3410,11 @@ void notify_remote_cs_fae_table(struct bt_conn *conn, uint8_t status, void notify_cs_config_created(struct bt_conn *conn, uint8_t status, struct bt_conn_le_cs_config *params) { - if (IS_ENABLED(CONFIG_BT_CONN_DYNAMIC_CALLBACKS)) { - struct bt_conn_cb *callback; + struct bt_conn_cb *callback; - SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { - if (callback->le_cs_config_complete) { - callback->le_cs_config_complete(conn, status, params); - } + SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { + if (callback->le_cs_config_complete) { + callback->le_cs_config_complete(conn, status, params); } } @@ -3465,13 +3427,11 @@ void notify_cs_config_created(struct bt_conn *conn, uint8_t status, void notify_cs_config_removed(struct bt_conn *conn, uint8_t config_id) { - if (IS_ENABLED(CONFIG_BT_CONN_DYNAMIC_CALLBACKS)) { - struct bt_conn_cb *callback; + struct bt_conn_cb *callback; - SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { - if (callback->le_cs_config_removed) { - callback->le_cs_config_removed(conn, config_id); - } + SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { + if (callback->le_cs_config_removed) { + callback->le_cs_config_removed(conn, config_id); } } @@ -3484,13 +3444,11 @@ void notify_cs_config_removed(struct bt_conn *conn, uint8_t config_id) void notify_cs_security_enable_available(struct bt_conn *conn, uint8_t status) { - if (IS_ENABLED(CONFIG_BT_CONN_DYNAMIC_CALLBACKS)) { - struct bt_conn_cb *callback; + struct bt_conn_cb *callback; - SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { - if (callback->le_cs_security_enable_complete) { - callback->le_cs_security_enable_complete(conn, status); - } + SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { + if (callback->le_cs_security_enable_complete) { + callback->le_cs_security_enable_complete(conn, status); } } @@ -3504,13 +3462,11 @@ void notify_cs_security_enable_available(struct bt_conn *conn, uint8_t status) void notify_cs_procedure_enable_available(struct bt_conn *conn, uint8_t status, struct bt_conn_le_cs_procedure_enable_complete *params) { - if (IS_ENABLED(CONFIG_BT_CONN_DYNAMIC_CALLBACKS)) { - struct bt_conn_cb *callback; + struct bt_conn_cb *callback; - SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { - if (callback->le_cs_procedure_enable_complete) { - callback->le_cs_procedure_enable_complete(conn, status, params); - } + SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { + if (callback->le_cs_procedure_enable_complete) { + callback->le_cs_procedure_enable_complete(conn, status, params); } } @@ -3523,13 +3479,11 @@ void notify_cs_procedure_enable_available(struct bt_conn *conn, uint8_t status, void notify_cs_subevent_result(struct bt_conn *conn, struct bt_conn_le_cs_subevent_result *result) { - if (IS_ENABLED(CONFIG_BT_CONN_DYNAMIC_CALLBACKS)) { - struct bt_conn_cb *callback; + struct bt_conn_cb *callback; - SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { - if (callback->le_cs_subevent_data_available) { - callback->le_cs_subevent_data_available(conn, result); - } + SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { + if (callback->le_cs_subevent_data_available) { + callback->le_cs_subevent_data_available(conn, result); } } @@ -4311,13 +4265,11 @@ void bt_hci_le_df_connection_iq_report_common(uint8_t event, struct net_buf *buf return; } - if (IS_ENABLED(CONFIG_BT_CONN_DYNAMIC_CALLBACKS)) { - struct bt_conn_cb *callback; + struct bt_conn_cb *callback; - SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { - if (callback->cte_report_cb) { - callback->cte_report_cb(conn, &iq_report); - } + SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { + if (callback->cte_report_cb) { + callback->cte_report_cb(conn, &iq_report); } } @@ -4357,13 +4309,11 @@ void bt_hci_le_df_cte_req_failed(struct net_buf *buf) return; } - if (IS_ENABLED(CONFIG_BT_CONN_DYNAMIC_CALLBACKS)) { - struct bt_conn_cb *callback; + struct bt_conn_cb *callback; - SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { - if (callback->cte_report_cb) { - callback->cte_report_cb(conn, &iq_report); - } + SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { + if (callback->cte_report_cb) { + callback->cte_report_cb(conn, &iq_report); } } diff --git a/tests/bluetooth/gatt/testcase.yaml b/tests/bluetooth/gatt/testcase.yaml index ff18a0c663fd..37e14f0b9686 100644 --- a/tests/bluetooth/gatt/testcase.yaml +++ b/tests/bluetooth/gatt/testcase.yaml @@ -28,17 +28,3 @@ tests: tags: - bluetooth - gatt - bluetooth.gatt.no_bt_conn_dynamic_callbacks: - extra_args: - - EXTRA_DTC_OVERLAY_FILE="test.overlay" - - CONFIG_BT_CONN_DYNAMIC_CALLBACKS=n - platform_allow: - - native_sim - - native_sim/native/64 - - qemu_x86 - - qemu_cortex_m3 - integration_platforms: - - native_sim - tags: - - bluetooth - - gatt diff --git a/tests/bluetooth/shell/testcase.yaml b/tests/bluetooth/shell/testcase.yaml index 0517acd65ad4..673f13e481ca 100644 --- a/tests/bluetooth/shell/testcase.yaml +++ b/tests/bluetooth/shell/testcase.yaml @@ -92,12 +92,6 @@ tests: extra_args: CONF_FILE="audio.conf" build_only: true tags: bluetooth - bluetooth.shell.audio.no_bt_conn_dynamic_callbacks: - extra_args: - - CONF_FILE="audio.conf" - - CONFIG_BT_CONN_DYNAMIC_CALLBACKS=n - build_only: true - tags: bluetooth bluetooth.shell.audio.no_testing: extra_args: CONF_FILE="audio.conf" build_only: true diff --git a/tests/bsim/bluetooth/samples/central_hr_peripheral_hr/tests_scripts/central_hr_peripheral_hr_static_callbacks.sh b/tests/bsim/bluetooth/samples/central_hr_peripheral_hr/tests_scripts/central_hr_peripheral_hr_static_callbacks.sh deleted file mode 100755 index f6567efdc2a8..000000000000 --- a/tests/bsim/bluetooth/samples/central_hr_peripheral_hr/tests_scripts/central_hr_peripheral_hr_static_callbacks.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env bash -# Copyright 2025 Demant A/S -# SPDX-License-Identifier: Apache-2.0 - -source ${ZEPHYR_BASE}/tests/bsim/sh_common.source - -simulation_id="central_hr_peripheral_hr_static_callbacks_test" -test_long_name="$(guess_test_long_name)" -verbosity_level=2 -EXECUTE_TIMEOUT=60 - -cd ${BSIM_OUT_PATH}/bin - -Execute ./bs_${BOARD_TS}_samples_bluetooth_peripheral_hr_prj_conf_overlay-static_callbacks_conf \ - -v=${verbosity_level} -s=${simulation_id} -d=0 - -Execute ./bs_${BOARD_TS}_${test_long_name}_prj_conf_overlay-static_callbacks_conf \ - -v=${verbosity_level} -s=${simulation_id} -d=1 \ - -testid=central_hr_peripheral_hr - -Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s=${simulation_id} \ - -D=2 -sim_length=12e6 $@ - -wait_for_background_jobs #Wait for all programs in background and return != 0 if any fails diff --git a/tests/bsim/bluetooth/samples/compile.sh b/tests/bsim/bluetooth/samples/compile.sh index 33a9827a3001..f189445c36b0 100755 --- a/tests/bsim/bluetooth/samples/compile.sh +++ b/tests/bsim/bluetooth/samples/compile.sh @@ -37,15 +37,6 @@ app=tests/bsim/bluetooth/samples/central_hr_peripheral_hr \ extra_conf_file=${ZEPHYR_BASE}/samples/bluetooth/central_hr/prj.conf \ conf_overlay=${ZEPHYR_BASE}/samples/bluetooth/central_hr/overlay-phy_coded.conf \ compile -app=samples/bluetooth/peripheral_hr \ - sysbuild=1 \ - conf_overlay=overlay-static_callbacks.conf \ - compile -app=tests/bsim/bluetooth/samples/central_hr_peripheral_hr \ - sysbuild=1 \ - extra_conf_file=${ZEPHYR_BASE}/samples/bluetooth/central_hr/prj.conf \ - conf_overlay=${ZEPHYR_BASE}/samples/bluetooth/central_hr/overlay-static_callbacks.conf \ - compile if [ ${BOARD} == "nrf52_bsim/native" ]; then app=tests/bsim/bluetooth/samples/battery_service \ conf_file=prj.conf \ From 44be55c8185ef847f06412a11f7685ea86a257de Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:34 +0300 Subject: [PATCH 0979/2141] Revert "[nrf fromtree] Bluetooth: Host: Conn callbacks registration with BT_CONN_CB_DEFINE" This reverts commit 46f3f280968375c9e7340b4b28b80a10d98f1f3b. Signed-off-by: Jukka Rissanen --- subsys/bluetooth/host/gatt.c | 22 +++++++++++----------- subsys/bluetooth/host/shell/bt.c | 6 +++++- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/subsys/bluetooth/host/gatt.c b/subsys/bluetooth/host/gatt.c index 12ec91c78e44..be642fec9fe7 100644 --- a/subsys/bluetooth/host/gatt.c +++ b/subsys/bluetooth/host/gatt.c @@ -1511,17 +1511,6 @@ static void gatt_store_ccc_cf(uint8_t id, const bt_addr_le_t *peer_addr) } } -#if defined(CONFIG_BT_SETTINGS) && defined(CONFIG_BT_SMP) -BT_CONN_CB_DEFINE(gatt_conn_cb) = { - /* Also update the address of CCC or CF writes that happened before the - * identity resolution. Note that to increase security in the future, we - * might want to explicitly not do this and treat a bonded device as a - * brand-new peer. - */ - .identity_resolved = bt_gatt_identity_resolved, -}; -#endif /* CONFIG_BT_SETTINGS && CONFIG_BT_SMP */ - static void bt_gatt_service_init(void) { if (atomic_test_and_set_bit(gatt_flags, GATT_SERVICE_INITIALIZED)) { @@ -1578,6 +1567,17 @@ void bt_gatt_init(void) * and CF storage on pairing complete. */ bt_conn_auth_info_cb_register(&gatt_conn_auth_info_cb); + + static struct bt_conn_cb gatt_conn_cb = { + .identity_resolved = bt_gatt_identity_resolved, + }; + + /* Also update the address of CCC or CF writes that happened before the + * identity resolution. Note that to increase security in the future, we + * might want to explicitly not do this and treat a bonded device as a + * brand-new peer. + */ + bt_conn_cb_register(&gatt_conn_cb); #endif /* CONFIG_BT_SETTINGS && CONFIG_BT_SMP */ } diff --git a/subsys/bluetooth/host/shell/bt.c b/subsys/bluetooth/host/shell/bt.c index 0946939f22cf..611ce0afcec4 100644 --- a/subsys/bluetooth/host/shell/bt.c +++ b/subsys/bluetooth/host/shell/bt.c @@ -1191,7 +1191,7 @@ static void le_cs_config_removed(struct bt_conn *conn, uint8_t config_id) } #endif -BT_CONN_CB_DEFINE(conn_callbacks) = { +static struct bt_conn_cb conn_callbacks = { .connected = connected, .disconnected = disconnected, .le_param_req = le_param_req, @@ -1374,6 +1374,10 @@ static void bt_ready(int err) #if defined(CONFIG_BT_CONN) default_conn = NULL; + + /* Unregister to avoid register repeatedly */ + bt_conn_cb_unregister(&conn_callbacks); + bt_conn_cb_register(&conn_callbacks); #endif /* CONFIG_BT_CONN */ #if defined(CONFIG_BT_PER_ADV_SYNC) From 25f44eec9b977431aa8214528d218c6ec4795c5f Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:34 +0300 Subject: [PATCH 0980/2141] Revert "[nrf fromtree] Bluetooth: Audio: Conn callbacks registration with BT_CONN_CB_DEFINE" This reverts commit 307315be45f6ccea17485944fb15c5319ba26445. Signed-off-by: Jukka Rissanen --- subsys/bluetooth/audio/bap_unicast_client.c | 8 +++++++- subsys/bluetooth/audio/csip_set_member.c | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/subsys/bluetooth/audio/bap_unicast_client.c b/subsys/bluetooth/audio/bap_unicast_client.c index 3db8e8a7b9c0..1f081ee805b1 100644 --- a/subsys/bluetooth/audio/bap_unicast_client.c +++ b/subsys/bluetooth/audio/bap_unicast_client.c @@ -4456,13 +4456,14 @@ static void unicast_client_disconnected(struct bt_conn *conn, uint8_t reason) unicast_client_ep_reset(conn, reason); } -BT_CONN_CB_DEFINE(conn_cbs) = { +static struct bt_conn_cb conn_cbs = { .disconnected = unicast_client_disconnected, }; int bt_bap_unicast_client_discover(struct bt_conn *conn, enum bt_audio_dir dir) { struct unicast_client *client; + static bool conn_cb_registered; uint8_t role; int err; @@ -4495,6 +4496,11 @@ int bt_bap_unicast_client_discover(struct bt_conn *conn, enum bt_audio_dir dir) client->disc_params.start_handle = BT_ATT_FIRST_ATTRIBUTE_HANDLE; client->disc_params.end_handle = BT_ATT_LAST_ATTRIBUTE_HANDLE; + if (!conn_cb_registered) { + bt_conn_cb_register(&conn_cbs); + conn_cb_registered = true; + } + err = bt_gatt_discover(conn, &client->disc_params); if (err != 0) { atomic_clear_bit(client->flags, UNICAST_CLIENT_FLAG_BUSY); diff --git a/subsys/bluetooth/audio/csip_set_member.c b/subsys/bluetooth/audio/csip_set_member.c index c38929846b4a..d41230a16683 100644 --- a/subsys/bluetooth/audio/csip_set_member.c +++ b/subsys/bluetooth/audio/csip_set_member.c @@ -647,7 +647,7 @@ static void csip_bond_deleted(uint8_t id, const bt_addr_le_t *peer) } } -BT_CONN_CB_DEFINE(conn_callbacks) = { +static struct bt_conn_cb conn_callbacks = { .disconnected = csip_disconnected, .security_changed = csip_security_changed, }; @@ -926,6 +926,7 @@ int bt_csip_set_member_register(const struct bt_csip_set_member_register_param * for (size_t i = 0U; i < ARRAY_SIZE(svc_insts); i++) { k_mutex_init(&svc_insts[i].mutex); } + bt_conn_cb_register(&conn_callbacks); bt_conn_auth_info_cb_register(&auth_callbacks); first_register = true; } From 970ea42c91b570956f0e3728336b8b1021f8f6f8 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:34 +0300 Subject: [PATCH 0981/2141] Revert "[nrf fromtree] bluetooth: classic: add role switch API" This reverts commit 0c9f335f663bab986df74ec88351c675e74d7aed. Signed-off-by: Jukka Rissanen --- include/zephyr/bluetooth/conn.h | 23 ----- include/zephyr/bluetooth/hci_types.h | 38 -------- subsys/bluetooth/host/classic/Kconfig | 6 -- subsys/bluetooth/host/classic/br.c | 35 ------- subsys/bluetooth/host/classic/conn_br.c | 101 -------------------- subsys/bluetooth/host/classic/shell/bredr.c | 77 --------------- subsys/bluetooth/host/classic/shell/bredr.h | 20 ---- subsys/bluetooth/host/shell/bt.c | 6 -- 8 files changed, 306 deletions(-) delete mode 100644 subsys/bluetooth/host/classic/shell/bredr.h diff --git a/include/zephyr/bluetooth/conn.h b/include/zephyr/bluetooth/conn.h index 2da6b2c91d63..e74aeaa0fb5e 100644 --- a/include/zephyr/bluetooth/conn.h +++ b/include/zephyr/bluetooth/conn.h @@ -2746,29 +2746,6 @@ struct bt_conn *bt_conn_lookup_addr_br(const bt_addr_t *peer); */ const bt_addr_t *bt_conn_get_dst_br(const struct bt_conn *conn); -/** @brief Change the role of the conn. - * - * @param conn Connection object. - * @param role The role that want to switch as, the value is @ref BT_HCI_ROLE_CENTRAL and - * @ref BT_HCI_ROLE_PERIPHERAL from hci_types.h. - * - * @return Zero on success or (negative) error code on failure. - * @return -ENOBUFS HCI command buffer is not available. - * @return -EINVAL @p conn is not a valid @ref BT_CONN_TYPE_BR connection - */ -int bt_conn_br_switch_role(const struct bt_conn *conn, uint8_t role); - -/** @brief Enable/disable role switch of the connection by setting the connection's link policy. - * - * @param conn Connection object. - * @param enable Value enable/disable role switch of controller. - * - * @return Zero on success or (negative) error code on failure. - * @return -ENOBUFS HCI command buffer is not available. - * @return -EINVAL @p conn is not a valid @ref BT_CONN_TYPE_BR connection. - */ -int bt_conn_br_set_role_switch_enable(const struct bt_conn *conn, bool enable); - #ifdef __cplusplus } #endif diff --git a/include/zephyr/bluetooth/hci_types.h b/include/zephyr/bluetooth/hci_types.h index 877617362c66..a20852712394 100644 --- a/include/zephyr/bluetooth/hci_types.h +++ b/include/zephyr/bluetooth/hci_types.h @@ -365,7 +365,6 @@ struct bt_hci_cmd_hdr { /* OpCode Group Fields */ #define BT_OGF_LINK_CTRL 0x01 -#define BT_OGF_LINK_POLICY 0x02 #define BT_OGF_BASEBAND 0x03 #define BT_OGF_INFO 0x04 #define BT_OGF_STATUS 0x05 @@ -561,43 +560,6 @@ struct bt_hci_cp_io_capability_neg_reply { uint8_t reason; } __packed; -#define BT_HCI_OP_SWITCH_ROLE BT_OP(BT_OGF_LINK_POLICY, 0x000b) -struct bt_hci_cp_switch_role { - bt_addr_t bdaddr; - uint8_t role; -} __packed; - -#define BT_HCI_LINK_POLICY_SETTINGS_ENABLE_ROLE_SWITCH BIT(0) -#define BT_HCI_LINK_POLICY_SETTINGS_ENABLE_HOLD_MODE BIT(1) -#define BT_HCI_LINK_POLICY_SETTINGS_ENABLE_SNIFF_SWITCH BIT(2) - -#define BT_HCI_OP_READ_LINK_POLICY_SETTINGS BT_OP(BT_OGF_LINK_POLICY, 0x000c) -struct bt_hci_cp_read_link_policy_settings { - uint16_t handle; -} __packed; -struct bt_hci_rp_read_link_policy_settings { - uint8_t status; - uint16_t handle; - uint16_t link_policy_settings; -} __packed; - -#define BT_HCI_OP_WRITE_LINK_POLICY_SETTINGS BT_OP(BT_OGF_LINK_POLICY, 0x000d) -struct bt_hci_cp_write_link_policy_settings { - uint16_t handle; - uint16_t link_policy_settings; -} __packed; - -#define BT_HCI_OP_READ_DEFAULT_LINK_POLICY_SETTINGS BT_OP(BT_OGF_LINK_POLICY, 0x000e) -struct bt_hci_rp_read_default_link_policy_settings { - uint8_t status; - uint16_t default_link_policy_settings; -} __packed; - -#define BT_HCI_OP_WRITE_DEFAULT_LINK_POLICY_SETTINGS BT_OP(BT_OGF_LINK_POLICY, 0x000f) -struct bt_hci_cp_write_default_link_policy_settings { - uint16_t default_link_policy_settings; -} __packed; - #define BT_HCI_OP_SET_EVENT_MASK BT_OP(BT_OGF_BASEBAND, 0x0001) /* 0x0c01 */ struct bt_hci_cp_set_event_mask { uint8_t events[8]; diff --git a/subsys/bluetooth/host/classic/Kconfig b/subsys/bluetooth/host/classic/Kconfig index beacfc316288..5d95a6375f56 100644 --- a/subsys/bluetooth/host/classic/Kconfig +++ b/subsys/bluetooth/host/classic/Kconfig @@ -508,12 +508,6 @@ config BT_COD consult the following link: https://www.bluetooth.com/specifications/assigned-numbers -config BT_DEFAULT_ROLE_SWITCH_ENABLE - bool "Default Bluetooth Role Switch Enable/Disable State" - help - This option sets the controller's default link policy to - enable/disable the role switch. - endif # BT_CLASSIC endmenu diff --git a/subsys/bluetooth/host/classic/br.c b/subsys/bluetooth/host/classic/br.c index f9265dc948ba..f7cc28fb45f7 100644 --- a/subsys/bluetooth/host/classic/br.c +++ b/subsys/bluetooth/host/classic/br.c @@ -800,10 +800,7 @@ int bt_br_init(void) struct bt_hci_cp_write_ssp_mode *ssp_cp; struct bt_hci_cp_write_inquiry_mode *inq_cp; struct bt_hci_write_local_name *name_cp; - struct bt_hci_rp_read_default_link_policy_settings *rp; - struct net_buf *rsp; int err; - uint16_t default_link_policy_settings; /* Read extended local features */ if (BT_FEAT_EXT_FEATURES(bt_dev.features)) { @@ -909,38 +906,6 @@ int bt_br_init(void) } } - err = bt_hci_cmd_send_sync(BT_HCI_OP_READ_DEFAULT_LINK_POLICY_SETTINGS, NULL, &rsp); - if (err) { - return err; - } - - rp = (void *)rsp->data; - default_link_policy_settings = rp->default_link_policy_settings; - - bool should_enable = IS_ENABLED(CONFIG_BT_DEFAULT_ROLE_SWITCH_ENABLE); - bool is_enabled = (default_link_policy_settings & - BT_HCI_LINK_POLICY_SETTINGS_ENABLE_ROLE_SWITCH); - - /* Enable/Disable the default role switch */ - if (should_enable != is_enabled) { - struct bt_hci_cp_write_default_link_policy_settings *policy_cp; - - default_link_policy_settings ^= BT_HCI_LINK_POLICY_SETTINGS_ENABLE_ROLE_SWITCH; - - buf = bt_hci_cmd_alloc(K_FOREVER); - if (!buf) { - return -ENOBUFS; - } - - policy_cp = net_buf_add(buf, sizeof(*policy_cp)); - policy_cp->default_link_policy_settings = default_link_policy_settings; - - err = bt_hci_cmd_send_sync(BT_HCI_OP_WRITE_DEFAULT_LINK_POLICY_SETTINGS, buf, NULL); - if (err) { - return err; - } - } - return 0; } diff --git a/subsys/bluetooth/host/classic/conn_br.c b/subsys/bluetooth/host/classic/conn_br.c index 29cb2e2dfd48..582d560c4df3 100644 --- a/subsys/bluetooth/host/classic/conn_br.c +++ b/subsys/bluetooth/host/classic/conn_br.c @@ -170,104 +170,3 @@ void bt_br_acl_recv(struct bt_conn *conn, struct net_buf *buf, bool complete) net_buf_unref(buf); } - -int bt_conn_br_switch_role(const struct bt_conn *conn, uint8_t role) -{ - struct net_buf *buf; - struct bt_hci_cp_switch_role *cp; - - CHECKIF(conn == NULL) { - LOG_DBG("conn is NULL"); - return -EINVAL; - } - - if (!bt_conn_is_type(conn, BT_CONN_TYPE_BR)) { - LOG_DBG("Invalid connection type: %u for %p", conn->type, conn); - return -EINVAL; - } - - buf = bt_hci_cmd_alloc(K_FOREVER); - if (!buf) { - return -ENOBUFS; - } - - cp = net_buf_add(buf, sizeof(*cp)); - bt_addr_copy(&cp->bdaddr, &conn->br.dst); - cp->role = role; - - return bt_hci_cmd_send_sync(BT_HCI_OP_SWITCH_ROLE, buf, NULL); -} - -static int bt_conn_br_read_link_policy_settings(const struct bt_conn *conn, - uint16_t *link_policy_settings) -{ - int err; - struct net_buf *buf; - struct bt_hci_cp_read_link_policy_settings *cp; - struct bt_hci_rp_read_link_policy_settings *rp; - struct net_buf *rsp; - - buf = bt_hci_cmd_alloc(K_FOREVER); - if (!buf) { - return -ENOBUFS; - } - - cp = net_buf_add(buf, sizeof(*cp)); - cp->handle = sys_cpu_to_le16(conn->handle); - - err = bt_hci_cmd_send_sync(BT_HCI_OP_READ_LINK_POLICY_SETTINGS, buf, &rsp); - if (!err) { - rp = (void *)rsp->data; - *link_policy_settings = rp->link_policy_settings; - } - - return err; -} - -static int bt_conn_br_write_link_policy_settings(const struct bt_conn *conn, - uint16_t link_policy_settings) -{ - struct net_buf *buf; - struct bt_hci_cp_write_link_policy_settings *cp; - - buf = bt_hci_cmd_alloc(K_FOREVER); - if (!buf) { - return -ENOBUFS; - } - - cp = net_buf_add(buf, sizeof(*cp)); - cp->handle = sys_cpu_to_le16(conn->handle); - cp->link_policy_settings = link_policy_settings; - - return bt_hci_cmd_send_sync(BT_HCI_OP_WRITE_LINK_POLICY_SETTINGS, buf, NULL); -} - -int bt_conn_br_set_role_switch_enable(const struct bt_conn *conn, bool enable) -{ - int err; - uint16_t link_policy_settings; - bool is_enabled; - - CHECKIF(conn == NULL) { - LOG_DBG("conn is NULL"); - return -EINVAL; - } - - if (!bt_conn_is_type(conn, BT_CONN_TYPE_BR)) { - LOG_DBG("Invalid connection type: %u for %p", conn->type, conn); - return -EINVAL; - } - - err = bt_conn_br_read_link_policy_settings(conn, &link_policy_settings); - if (err) { - return err; - } - - is_enabled = (link_policy_settings & BT_HCI_LINK_POLICY_SETTINGS_ENABLE_ROLE_SWITCH); - if (enable == is_enabled) { - return 0; - } - - link_policy_settings ^= BT_HCI_LINK_POLICY_SETTINGS_ENABLE_ROLE_SWITCH; - return bt_conn_br_write_link_policy_settings(conn, link_policy_settings); -} diff --git a/subsys/bluetooth/host/classic/shell/bredr.c b/subsys/bluetooth/host/classic/shell/bredr.c index d5c1d09a082d..8770d3acbd2e 100644 --- a/subsys/bluetooth/host/classic/shell/bredr.c +++ b/subsys/bluetooth/host/classic/shell/bredr.c @@ -1207,80 +1207,6 @@ static int cmd_info(const struct shell *sh, size_t argc, char *argv[]) return err; } -void role_changed(struct bt_conn *conn, uint8_t status) -{ - struct bt_conn_info info; - int err; - - bt_shell_print("Role changed (HCI status 0x%02x)", status); - - err = bt_conn_get_info(conn, &info); - if (err) { - bt_shell_print("Failed to get info"); - return; - } - - bt_shell_print("Current role is: %s", get_conn_role_str(info.role)); -} - -static int cmd_switch_role(const struct shell *sh, size_t argc, char *argv[]) -{ - int err; - const char *action; - uint8_t role; - - if (!default_conn) { - shell_print(sh, "Not connected"); - return -ENOEXEC; - } - - action = argv[1]; - - if (!strcmp(action, "central")) { - role = BT_HCI_ROLE_CENTRAL; - } else if (!strcmp(action, "peripheral")) { - role = BT_HCI_ROLE_PERIPHERAL; - } else { - shell_help(sh); - return SHELL_CMD_HELP_PRINTED; - } - - err = bt_conn_br_switch_role(default_conn, role); - - if (err) { - shell_error(sh, "fail to change role (err %d)", err); - } - - return 0; -} - -static int cmd_set_role_switchable(const struct shell *sh, size_t argc, char *argv[]) -{ - int err = 0; - bool enable; - - if (!default_conn) { - shell_print(sh, "Not connected"); - return -ENOEXEC; - } - - enable = shell_strtobool(argv[1], 10, &err); - if (err) { - shell_help(sh); - return SHELL_CMD_HELP_PRINTED; - } - - err = bt_conn_br_set_role_switch_enable(default_conn, enable); - - if (err) { - shell_error(sh, "fail to set role switchable (err %d)", err); - } else { - shell_print(sh, "success"); - } - - return 0; -} - static int cmd_default_handler(const struct shell *sh, size_t argc, char **argv) { if (argc == 1) { @@ -1344,9 +1270,6 @@ SHELL_STATIC_SUBCMD_SET_CREATE(br_cmds, SHELL_CMD_ARG(oob, NULL, NULL, cmd_oob, 1, 0), SHELL_CMD_ARG(pscan, NULL, "", cmd_connectable, 2, 0), SHELL_CMD_ARG(sdp-find, NULL, "", cmd_sdp_find_record, 2, 0), - SHELL_CMD_ARG(switch-role, NULL, "", cmd_switch_role, 2, 0), - SHELL_CMD_ARG(set-role-switchable, NULL, "", - cmd_set_role_switchable, 2, 0), SHELL_SUBCMD_SET_END ); diff --git a/subsys/bluetooth/host/classic/shell/bredr.h b/subsys/bluetooth/host/classic/shell/bredr.h deleted file mode 100644 index 1cc3396c63f1..000000000000 --- a/subsys/bluetooth/host/classic/shell/bredr.h +++ /dev/null @@ -1,20 +0,0 @@ -/** @file - * @brief Bluetooth shell functions - * - * This is not to be included by the application. - */ - -/* - * Copyright 2025 NXP - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef __BREDR_H -#define __BREDR_H -#include -#include - -void role_changed(struct bt_conn *conn, uint8_t status); - -#endif /* __BREDR_H */ diff --git a/subsys/bluetooth/host/shell/bt.c b/subsys/bluetooth/host/shell/bt.c index 611ce0afcec4..05d841e37449 100644 --- a/subsys/bluetooth/host/shell/bt.c +++ b/subsys/bluetooth/host/shell/bt.c @@ -53,9 +53,6 @@ #include "controller/ll_sw/shell/ll.h" #endif /* CONFIG_BT_LL_SW_SPLIT */ #include "host/shell/bt.h" -#if defined(CONFIG_BT_CLASSIC) -#include "host/classic/shell/bredr.h" -#endif static bool no_settings_load; @@ -1229,9 +1226,6 @@ static struct bt_conn_cb conn_callbacks = { .le_cs_config_complete = le_cs_config_created, .le_cs_config_removed = le_cs_config_removed, #endif -#if defined(CONFIG_BT_CLASSIC) - .role_changed = role_changed, -#endif }; #endif /* CONFIG_BT_CONN */ From cece24ff2c03bd305f309d131e6cd5d1c671d8eb Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:34 +0300 Subject: [PATCH 0982/2141] Revert "[nrf fromtree] bluetooth: classic: add role changed callback" This reverts commit 009cc9b41f3790e4ae6d4bac05e6ccad95c19184. Signed-off-by: Jukka Rissanen --- include/zephyr/bluetooth/conn.h | 11 ----------- subsys/bluetooth/host/classic/br.c | 16 ++++++++-------- subsys/bluetooth/host/conn.c | 19 ------------------- subsys/bluetooth/host/conn_internal.h | 2 -- 4 files changed, 8 insertions(+), 40 deletions(-) diff --git a/include/zephyr/bluetooth/conn.h b/include/zephyr/bluetooth/conn.h index e74aeaa0fb5e..bf8a31603b85 100644 --- a/include/zephyr/bluetooth/conn.h +++ b/include/zephyr/bluetooth/conn.h @@ -2033,17 +2033,6 @@ struct bt_conn_cb { #endif -#if defined(CONFIG_BT_CLASSIC) - /** @brief The role of the connection has changed. - * - * This callback notifies the application that the role switch procedure has completed. - * - * @param conn Connection object. - * @param status HCI status of role change event. - */ - void (*role_changed)(struct bt_conn *conn, uint8_t status); -#endif - /** @internal Internally used field for list handling */ sys_snode_t _node; }; diff --git a/subsys/bluetooth/host/classic/br.c b/subsys/bluetooth/host/classic/br.c index f7cc28fb45f7..994fcfbd22c7 100644 --- a/subsys/bluetooth/host/classic/br.c +++ b/subsys/bluetooth/host/classic/br.c @@ -681,22 +681,22 @@ void bt_hci_role_change(struct net_buf *buf) LOG_DBG("status 0x%02x role %u addr %s", evt->status, evt->role, bt_addr_str(&evt->bdaddr)); + if (evt->status) { + return; + } + conn = bt_conn_lookup_addr_br(&evt->bdaddr); if (!conn) { LOG_ERR("Can't find conn for %s", bt_addr_str(&evt->bdaddr)); return; } - if (evt->status == 0) { - if (evt->role == BT_HCI_ROLE_PERIPHERAL) { - conn->role = BT_CONN_ROLE_PERIPHERAL; - } else { - conn->role = BT_CONN_ROLE_CENTRAL; - } + if (evt->role) { + conn->role = BT_CONN_ROLE_PERIPHERAL; + } else { + conn->role = BT_CONN_ROLE_CENTRAL; } - bt_conn_role_changed(conn, evt->status); - bt_conn_unref(conn); } diff --git a/subsys/bluetooth/host/conn.c b/subsys/bluetooth/host/conn.c index abcc3d861ff9..b8f63abf801e 100644 --- a/subsys/bluetooth/host/conn.c +++ b/subsys/bluetooth/host/conn.c @@ -1826,25 +1826,6 @@ void bt_conn_connected(struct bt_conn *conn) notify_connected(conn); } -#if defined(CONFIG_BT_CLASSIC) -void bt_conn_role_changed(struct bt_conn *conn, uint8_t status) -{ - struct bt_conn_cb *callback; - - SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { - if (callback->role_changed) { - callback->role_changed(conn, status); - } - } - - STRUCT_SECTION_FOREACH(bt_conn_cb, cb) { - if (cb->role_changed) { - cb->role_changed(conn, status); - } - } -} -#endif - static int conn_disconnect(struct bt_conn *conn, uint8_t reason) { int err; diff --git a/subsys/bluetooth/host/conn_internal.h b/subsys/bluetooth/host/conn_internal.h index 495de9114462..7d3cc1303942 100644 --- a/subsys/bluetooth/host/conn_internal.h +++ b/subsys/bluetooth/host/conn_internal.h @@ -490,8 +490,6 @@ void bt_conn_set_state(struct bt_conn *conn, bt_conn_state_t state); void bt_conn_connected(struct bt_conn *conn); -void bt_conn_role_changed(struct bt_conn *conn, uint8_t status); - int bt_conn_le_conn_update(struct bt_conn *conn, const struct bt_le_conn_param *param); From 6a805711ad1211a9a95fe2f9cbed7e3e4df0a230 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:34 +0300 Subject: [PATCH 0983/2141] Revert "[nrf fromtree] bluetooth: mesh: remove unused functionality" This reverts commit 534fd57c6f0ef128eb638366e9bc5d88c5c1e618. Signed-off-by: Jukka Rissanen --- subsys/bluetooth/host/shell/bt.c | 4 ++ subsys/bluetooth/mesh/shell/CMakeLists.txt | 2 + subsys/bluetooth/mesh/shell/hci.c | 76 ++++++++++++++++++++++ subsys/bluetooth/mesh/shell/hci.h | 7 ++ 4 files changed, 89 insertions(+) create mode 100644 subsys/bluetooth/mesh/shell/hci.c create mode 100644 subsys/bluetooth/mesh/shell/hci.h diff --git a/subsys/bluetooth/host/shell/bt.c b/subsys/bluetooth/host/shell/bt.c index 05d841e37449..cc30ad7fbb19 100644 --- a/subsys/bluetooth/host/shell/bt.c +++ b/subsys/bluetooth/host/shell/bt.c @@ -53,6 +53,7 @@ #include "controller/ll_sw/shell/ll.h" #endif /* CONFIG_BT_LL_SW_SPLIT */ #include "host/shell/bt.h" +#include "mesh/shell/hci.h" static bool no_settings_load; @@ -5241,6 +5242,9 @@ SHELL_STATIC_SUBCMD_SET_CREATE(bt_cmds, #endif #endif /* CONFIG_BT_SMP || CONFIG_BT_CLASSIC) */ #endif /* CONFIG_BT_CONN */ +#if defined(CONFIG_BT_HCI_MESH_EXT) + SHELL_CMD(mesh_adv, NULL, HELP_ONOFF, cmd_mesh_adv), +#endif /* CONFIG_BT_HCI_MESH_EXT */ #if defined(CONFIG_BT_LL_SW_SPLIT) SHELL_CMD(ll-addr, NULL, "", cmd_ll_addr_read), diff --git a/subsys/bluetooth/mesh/shell/CMakeLists.txt b/subsys/bluetooth/mesh/shell/CMakeLists.txt index e90e55428469..0a8e948fc436 100644 --- a/subsys/bluetooth/mesh/shell/CMakeLists.txt +++ b/subsys/bluetooth/mesh/shell/CMakeLists.txt @@ -36,3 +36,5 @@ zephyr_library_sources_ifdef(CONFIG_BT_MESH_OD_PRIV_PROXY_CLI od_priv_proxy.c) zephyr_library_sources_ifdef(CONFIG_BT_MESH_SOL_PDU_RPL_CLI sol_pdu_rpl.c) zephyr_library_sources_ifdef(CONFIG_BT_MESH_SHELL_BRG_CFG_CLI brg_cfg.c) + +zephyr_library_sources_ifdef(CONFIG_BT_HCI_MESH_EXT hci.c) diff --git a/subsys/bluetooth/mesh/shell/hci.c b/subsys/bluetooth/mesh/shell/hci.c new file mode 100644 index 000000000000..191a47c24115 --- /dev/null +++ b/subsys/bluetooth/mesh/shell/hci.c @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2017-2018 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "../host/hci_core.h" + +#if defined(CONFIG_BT_HCI_MESH_EXT) +int cmd_mesh_adv(const struct shell *sh, size_t argc, char *argv[]) +{ + struct net_buf *buf; + int err; + + if (argc < 2) { + return -EINVAL; + } + + if (!strcmp(argv[1], "on")) { + struct bt_hci_cp_mesh_advertise *cp; + + buf = bt_hci_cmd_alloc(K_FOREVER); + if (!buf) { + return -ENOBUFS; + } + + net_buf_add_u8(buf, BT_HCI_OC_MESH_ADVERTISE); + + /* TODO: fetch and fill cmdline params */ + cp = net_buf_add(buf, sizeof(*cp)); + cp->adv_slot = 0U; + cp->own_addr_type = 0x01; + memset(&cp->random_addr, 0, sizeof(bt_addr_t)); + cp->ch_map = 0x07; + cp->tx_power = 0; + cp->min_tx_delay = 0U; + cp->max_tx_delay = 0x32; + cp->retx_count = 0x07; + cp->retx_interval = 0x00; + cp->scan_delay = 0x0a; + cp->scan_duration = sys_cpu_to_le16(0x0064); + cp->scan_filter = 0x00; + cp->data_len = 0U; + memset(cp->data, 0, sizeof(cp->data)); + } else if (!strcmp(argv[1], "off")) { + struct bt_hci_cp_mesh_advertise_cancel *cp; + + buf = bt_hci_cmd_alloc(K_FOREVER); + if (!buf) { + return -ENOBUFS; + } + + net_buf_add_u8(buf, BT_HCI_OC_MESH_ADVERTISE_CANCEL); + + cp = net_buf_add(buf, sizeof(*cp)); + cp->adv_slot = 0U; + } else { + return -EINVAL; + } + + err = bt_hci_cmd_send_sync(BT_HCI_OP_VS_MESH, buf, NULL); + + return err; +} +#endif /* CONFIG_BT_HCI_MESH_EXT */ diff --git a/subsys/bluetooth/mesh/shell/hci.h b/subsys/bluetooth/mesh/shell/hci.h new file mode 100644 index 000000000000..81dcb0d892e7 --- /dev/null +++ b/subsys/bluetooth/mesh/shell/hci.h @@ -0,0 +1,7 @@ +/* + * Copyright (c) 2017 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +int cmd_mesh_adv(const struct shell *sh, size_t argc, char *argv[]); From ae1deac06b286b04bc9cf27fa89d209b9e1c161f Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:35 +0300 Subject: [PATCH 0984/2141] Revert "[nrf fromtree] bluetooth: host: Add support for extended feature set feature" This reverts commit 579aa3120082320a027414816202b9e4f88edc41. Signed-off-by: Jukka Rissanen --- include/zephyr/bluetooth/bluetooth.h | 12 +--- include/zephyr/bluetooth/conn.h | 58 ------------------ include/zephyr/bluetooth/hci_types.h | 36 +---------- subsys/bluetooth/Kconfig | 15 ----- subsys/bluetooth/common/Kconfig | 2 +- subsys/bluetooth/controller/Kconfig | 11 ---- subsys/bluetooth/host/conn.c | 47 --------------- subsys/bluetooth/host/conn_internal.h | 3 - subsys/bluetooth/host/hci_core.c | 86 ++------------------------- subsys/bluetooth/host/shell/bt.c | 66 -------------------- tests/bluetooth/shell/testcase.yaml | 6 -- 11 files changed, 11 insertions(+), 331 deletions(-) diff --git a/include/zephyr/bluetooth/bluetooth.h b/include/zephyr/bluetooth/bluetooth.h index a061b0564bfb..7f287f1c3448 100644 --- a/include/zephyr/bluetooth/bluetooth.h +++ b/include/zephyr/bluetooth/bluetooth.h @@ -34,7 +34,6 @@ #include #include #include -#include #include #include #include @@ -72,16 +71,11 @@ extern "C" { #define BT_ID_DEFAULT 0 /** - * @brief Number of octets for local supported features + * @brief Number of octets for local supported * - * The value of 8 correspond to page 0 in the LE Controller supported features. - * 24 bytes are required for all subsequent supported feature pages. + * The value of 8 correspond to page 0 in the LE Controller supported features */ -#define BT_LE_LOCAL_SUPPORTED_FEATURES_SIZE \ - (BT_HCI_LE_BYTES_PAGE_0_FEATURE_PAGE + \ - COND_CODE_1(CONFIG_BT_LE_MAX_LOCAL_SUPPORTED_FEATURE_PAGE, \ - CONFIG_BT_LE_MAX_LOCAL_SUPPORTED_FEATURE_PAGE * BT_HCI_LE_BYTES_PER_FEATURE_PAGE, \ - (0U))) +#define BT_LE_LOCAL_SUPPORTED_FEATURES_SIZE 8 /** Opaque type representing an advertiser. */ struct bt_le_ext_adv; diff --git a/include/zephyr/bluetooth/conn.h b/include/zephyr/bluetooth/conn.h index bf8a31603b85..8bc060bb05b5 100644 --- a/include/zephyr/bluetooth/conn.h +++ b/include/zephyr/bluetooth/conn.h @@ -252,27 +252,6 @@ struct bt_conn_le_subrate_changed { uint16_t supervision_timeout; }; -/** Read all remote features complete callback params */ -struct bt_conn_le_read_all_remote_feat_complete { - /** @brief HCI Status from LE Read All Remote Features Complete event. - * - * The remaining parameters will be unchanged if status is not @ref BT_HCI_ERR_SUCCESS. - */ - uint8_t status; - /** Number of pages supported by remote device. */ - uint8_t max_remote_page; - /** Number of pages fetched from remote device. */ - uint8_t max_valid_page; - /** @brief Pointer to array of size 248, with feature bits of remote supported features. - * - * Page 0 being 8 bytes, with the following 10 pages of 24 bytes. - * Refer to BT_LE_FEAT_BIT_* for values. - * Refer to the BT_FEAT_LE_* macros for value comparison. - * See Bluetooth Core Specification, Vol 6, Part B, Section 4.6. - */ - const uint8_t *features; -}; - /** Connection Type */ enum __packed bt_conn_type { /** LE Connection Type */ @@ -1207,24 +1186,6 @@ int bt_conn_le_subrate_set_defaults(const struct bt_conn_le_subrate_param *param int bt_conn_le_subrate_request(struct bt_conn *conn, const struct bt_conn_le_subrate_param *params); -/** @brief Read remote feature pages. - * - * Request remote feature pages, from 0 up to pages_requested or the number - * of pages supported by the peer. There is a maximum of 10 pages. - * This function will trigger the read_all_remote_feat_complete callback - * when the procedure is completed. - * - * @kconfig_dep{CONFIG_BT_LE_EXTENDED_FEAT_SET} - * - * @param conn @ref BT_CONN_TYPE_LE connection object. - * @param pages_requested Number of feature pages to be requested from peer. - * There is a maximum of 10 pages. - * - * @return Zero on success or (negative) error code on failure. - * @return -EINVAL @p conn is not a valid @ref BT_CONN_TYPE_LE connection. - */ -int bt_conn_le_read_all_remote_features(struct bt_conn *conn, uint8_t pages_requested); - /** @brief Update the connection parameters. * * If the local device is in the peripheral role then updating the connection @@ -1916,25 +1877,6 @@ struct bt_conn_cb { const struct bt_conn_le_subrate_changed *params); #endif /* CONFIG_BT_SUBRATING */ -#if defined(CONFIG_BT_LE_EXTENDED_FEAT_SET) - /** @brief Read all remote features complete event. - * - * This callback notifies the application that a 'read all remote - * features' procedure of the connection is completed. The other params - * will not be populated if status is not @ref BT_HCI_ERR_SUCCESS. - * - * This callback can be triggered by calling @ref - * bt_conn_le_read_all_remote_features or by the procedure running - * autonomously in the controller. - * - * @param conn Connection object. - * @param params Remote features. - */ - void (*read_all_remote_feat_complete)( - struct bt_conn *conn, - const struct bt_conn_le_read_all_remote_feat_complete *params); -#endif /* CONFIG_BT_LE_EXTENDED_FEAT_SET */ - #if defined(CONFIG_BT_CHANNEL_SOUNDING) /** @brief LE CS Read Remote Supported Capabilities Complete event. * diff --git a/include/zephyr/bluetooth/hci_types.h b/include/zephyr/bluetooth/hci_types.h index a20852712394..0b2c1b1a3976 100644 --- a/include/zephyr/bluetooth/hci_types.h +++ b/include/zephyr/bluetooth/hci_types.h @@ -207,7 +207,7 @@ struct bt_hci_cmd_hdr { #define BT_LE_FEAT_BIT_CHANNEL_SOUNDING 46 #define BT_LE_FEAT_BIT_CHANNEL_SOUNDING_HOST 47 #define BT_LE_FEAT_BIT_CHANNEL_SOUNDING_TONE_QUAL_IND 48 -#define BT_LE_FEAT_BIT_EXTENDED_FEAT_SET 63 +#define BT_LE_FEAT_BIT_LL_EXTENDED_FEAT_SET 63 #define BT_LE_FEAT_TEST(feat, n) (feat[(n) >> 3] & \ BIT((n) & 7)) @@ -284,8 +284,6 @@ struct bt_hci_cmd_hdr { BT_LE_FEAT_BIT_CHANNEL_SOUNDING) #define BT_FEAT_LE_CHANNEL_SOUNDING_HOST(feat) BT_LE_FEAT_TEST(feat, \ BT_LE_FEAT_BIT_CHANNEL_SOUNDING_HOST) -#define BT_FEAT_LE_EXTENDED_FEAT_SET(feat) BT_LE_FEAT_TEST(feat, \ - BT_LE_FEAT_BIT_EXTENDED_FEAT_SET) #define BT_FEAT_LE_CIS(feat) (BT_FEAT_LE_CIS_CENTRAL(feat) | \ BT_FEAT_LE_CIS_PERIPHERAL(feat)) @@ -2440,22 +2438,6 @@ struct bt_hci_cp_le_tx_test_v4 { uint8_t ant_ids[0]; } __packed; -#define BT_HCI_OP_LE_READ_ALL_LOCAL_SUPPORTED_FEATURES BT_OP(BT_OGF_LE, 0x0087) /* 0x2087 */ -struct bt_hci_rp_le_read_all_local_supported_features { - uint8_t status; - uint8_t max_page; - uint8_t features[248]; -} __packed; - -#define BT_READ_ALL_LOCAL_FEATURES_SUPPORTED(supported_commands) \ - BT_CMD_TEST(supported_commands, 47, 2) - -#define BT_HCI_OP_LE_READ_ALL_REMOTE_FEATURES BT_OP(BT_OGF_LE, 0x0088) /* 0x2088 */ -struct bt_hci_cp_le_read_all_remote_features { - uint16_t handle; - uint8_t pages_requested; -} __packed; - #define BT_HCI_TX_TEST_POWER_MIN -0x7F #define BT_HCI_TX_TEST_POWER_MAX 0x14 @@ -3570,20 +3552,6 @@ struct bt_hci_evt_le_cis_established_v2 { uint8_t framing; } __packed; -#define BT_HCI_EVT_LE_READ_ALL_REMOTE_FEAT_COMPLETE 0x2b - -#define BT_HCI_LE_FEATURE_PAGE_MAX 10 -#define BT_HCI_LE_BYTES_PER_FEATURE_PAGE 24 -#define BT_HCI_LE_BYTES_PAGE_0_FEATURE_PAGE 8 - -struct bt_hci_evt_le_read_all_remote_feat_complete { - uint8_t status; - uint16_t handle; - uint8_t max_remote_page; - uint8_t max_valid_page; - uint8_t features[248]; -} __packed; - #define BT_HCI_LE_CS_INITIATOR_ROLE_MASK BIT(0) #define BT_HCI_LE_CS_REFLECTOR_ROLE_MASK BIT(1) @@ -4056,8 +4024,6 @@ struct bt_hci_evt_le_cs_procedure_enable_complete { #define BT_EVT_MASK_LE_ENH_CONN_COMPLETE_V2 BT_EVT_BIT(40) #define BT_EVT_MASK_LE_CIS_ESTABLISHED_V2 BT_EVT_BIT(41) -#define BT_EVT_MASK_LE_READ_ALL_REMOTE_FEAT_COMPLETE BT_EVT_BIT(42) - #define BT_EVT_MASK_LE_CS_READ_REMOTE_SUPPORTED_CAPABILITIES_COMPLETE BT_EVT_BIT(43) #define BT_EVT_MASK_LE_CS_READ_REMOTE_FAE_TABLE_COMPLETE BT_EVT_BIT(44) #define BT_EVT_MASK_LE_CS_SECURITY_ENABLE_COMPLETE BT_EVT_BIT(45) diff --git a/subsys/bluetooth/Kconfig b/subsys/bluetooth/Kconfig index c98c7a5ff538..68d08819e1c3 100644 --- a/subsys/bluetooth/Kconfig +++ b/subsys/bluetooth/Kconfig @@ -115,21 +115,6 @@ config BT_CONN_TX help Hidden configuration that is true if ACL or broadcast ISO is enabled -config BT_LE_MAX_LOCAL_SUPPORTED_FEATURE_PAGE - int "Maximum supported feature page" - default 0 - range 0 10 - depends on BT_LE_EXTENDED_FEAT_SET - help - Maximum supported feature page that can be stored locally and fetched - from the remote connection with the LL Extended Feature Set feature. - -config BT_LE_EXTENDED_FEAT_SET - bool "LL Extended Feature Set" - depends on !HAS_BT_CTLR || BT_CTLR_EXTENDED_FEAT_SET_SUPPORT - help - Enable support for the LL Extended Feature Set feature. - if BT_CONN config BT_HCI_ACL_FLOW_CONTROL bool "Controller to Host ACL flow control support" diff --git a/subsys/bluetooth/common/Kconfig b/subsys/bluetooth/common/Kconfig index 60328a1dd35a..2b7b698d8f8e 100644 --- a/subsys/bluetooth/common/Kconfig +++ b/subsys/bluetooth/common/Kconfig @@ -119,7 +119,7 @@ config BT_BUF_ACL_RX_COUNT config BT_BUF_EVT_RX_SIZE int "Maximum supported HCI Event buffer length" - default $(UINT8_MAX) if (BT_EXT_ADV && BT_OBSERVER) || BT_PER_ADV_SYNC || BT_DF_CONNECTION_CTE_RX || BT_CLASSIC || BT_CHANNEL_SOUNDING || BT_LE_EXTENDED_FEAT_SET + default $(UINT8_MAX) if (BT_EXT_ADV && BT_OBSERVER) || BT_PER_ADV_SYNC || BT_DF_CONNECTION_CTE_RX || BT_CLASSIC || BT_CHANNEL_SOUNDING # LE Read Supported Commands command complete event. default 68 range 68 $(UINT8_MAX) diff --git a/subsys/bluetooth/controller/Kconfig b/subsys/bluetooth/controller/Kconfig index c7e7030ba287..16a40b7f4375 100644 --- a/subsys/bluetooth/controller/Kconfig +++ b/subsys/bluetooth/controller/Kconfig @@ -128,9 +128,6 @@ config BT_CTLR_SUBRATING_SUPPORT config BT_CTLR_CHANNEL_SOUNDING_SUPPORT bool -config BT_CTLR_EXTENDED_FEAT_SET_SUPPORT - bool - # Virtual option that all local LL implementations should select config HAS_BT_CTLR bool @@ -1179,14 +1176,6 @@ config BT_CTLR_CHANNEL_SOUNDING Enable support for Bluetooth 6.0 Channel Sounding in the Controller. -config BT_CTLR_EXTENDED_FEAT_SET - bool "LL Extended Feature Set support" - depends on BT_CTLR_EXTENDED_FEAT_SET_SUPPORT - default y if BT_LE_EXTENDED_FEAT_SET - help - Enable support for Bluetooth 6.0 LL Extended Feature Set - in the Controller. - rsource "Kconfig.df" rsource "Kconfig.ll_sw_split" rsource "Kconfig.dtm" diff --git a/subsys/bluetooth/host/conn.c b/subsys/bluetooth/host/conn.c index b8f63abf801e..a74a04295278 100644 --- a/subsys/bluetooth/host/conn.c +++ b/subsys/bluetooth/host/conn.c @@ -3304,53 +3304,6 @@ int bt_conn_le_subrate_request(struct bt_conn *conn, } #endif /* CONFIG_BT_SUBRATING */ -#if defined(CONFIG_BT_LE_EXTENDED_FEAT_SET) -void notify_read_all_remote_feat_complete(struct bt_conn *conn, - struct bt_conn_le_read_all_remote_feat_complete *params) -{ - struct bt_conn_cb *callback; - - SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { - if (callback->read_all_remote_feat_complete != NULL) { - callback->read_all_remote_feat_complete(conn, params); - } - } - - STRUCT_SECTION_FOREACH(bt_conn_cb, cb) - { - if (cb->read_all_remote_feat_complete != NULL) { - cb->read_all_remote_feat_complete(conn, params); - } - } -} - -int bt_conn_le_read_all_remote_features(struct bt_conn *conn, uint8_t pages_requested) -{ - struct bt_hci_cp_le_read_all_remote_features *cp; - struct net_buf *buf; - - if (!bt_conn_is_type(conn, BT_CONN_TYPE_LE)) { - LOG_DBG("Invalid connection type: %u for %p", conn->type, conn); - return -EINVAL; - } - - if (pages_requested > BT_HCI_LE_FEATURE_PAGE_MAX) { - return -EINVAL; - } - - buf = bt_hci_cmd_alloc(K_FOREVER); - if (buf == NULL) { - return -ENOBUFS; - } - - cp = net_buf_add(buf, sizeof(*cp)); - cp->handle = sys_cpu_to_le16(conn->handle); - cp->pages_requested = pages_requested; - - return bt_hci_cmd_send_sync(BT_HCI_OP_LE_READ_ALL_REMOTE_FEATURES, buf, NULL); -} -#endif /* CONFIG_BT_LE_EXTENDED_FEAT_SET */ - #if defined(CONFIG_BT_CHANNEL_SOUNDING) void notify_remote_cs_capabilities(struct bt_conn *conn, uint8_t status, struct bt_conn_le_cs_capabilities *params) diff --git a/subsys/bluetooth/host/conn_internal.h b/subsys/bluetooth/host/conn_internal.h index 7d3cc1303942..909c0ebd22ef 100644 --- a/subsys/bluetooth/host/conn_internal.h +++ b/subsys/bluetooth/host/conn_internal.h @@ -512,9 +512,6 @@ void notify_path_loss_threshold_report(struct bt_conn *conn, void notify_subrate_change(struct bt_conn *conn, struct bt_conn_le_subrate_changed params); -void notify_read_all_remote_feat_complete(struct bt_conn *conn, - struct bt_conn_le_read_all_remote_feat_complete *params); - void notify_remote_cs_capabilities(struct bt_conn *conn, uint8_t status, struct bt_conn_le_cs_capabilities *params); diff --git a/subsys/bluetooth/host/hci_core.c b/subsys/bluetooth/host/hci_core.c index 1fe19b5373b7..9de787388b17 100644 --- a/subsys/bluetooth/host/hci_core.c +++ b/subsys/bluetooth/host/hci_core.c @@ -1800,37 +1800,6 @@ static void le_remote_feat_complete(struct net_buf *buf) bt_conn_unref(conn); } -#if defined(CONFIG_BT_LE_EXTENDED_FEAT_SET) -static void le_read_all_remote_feat_complete(struct net_buf *buf) -{ - struct bt_hci_evt_le_read_all_remote_feat_complete *evt = (void *)buf->data; - struct bt_conn *conn; - struct bt_conn_le_read_all_remote_feat_complete params; - uint16_t handle = sys_le16_to_cpu(evt->handle); - - LOG_DBG("Read all remote feature complete: 0x%02x %s handle %u", evt->status, - bt_hci_err_to_str(evt->status), handle); - - conn = bt_conn_lookup_handle(handle, BT_CONN_TYPE_LE); - if (conn == NULL) { - LOG_ERR("Unknown conn handle 0x%04X", handle); - return; - } - - params.status = evt->status; - - if (params.status == BT_HCI_ERR_SUCCESS) { - params.max_remote_page = evt->max_remote_page; - params.max_valid_page = evt->max_valid_page; - params.features = evt->features; - } - - notify_read_all_remote_feat_complete(conn, ¶ms); - - bt_conn_unref(conn); -} -#endif /* CONFIG_BT_LE_EXTENDED_FEAT_SET */ - #if defined(CONFIG_BT_DATA_LEN_UPDATE) static void le_data_len_change(struct net_buf *buf) { @@ -2953,11 +2922,6 @@ static const struct event_handler meta_events[] = { EVENT_HANDLER(BT_HCI_EVT_LE_ENH_CONN_COMPLETE_V2, le_enh_conn_complete_v2, sizeof(struct bt_hci_evt_le_enh_conn_complete_v2)), #endif /* CONFIG_BT_PER_ADV_RSP || CONFIG_BT_PER_ADV_SYNC_RSP */ -#if defined(CONFIG_BT_LE_EXTENDED_FEAT_SET) - EVENT_HANDLER(BT_HCI_EVT_LE_READ_ALL_REMOTE_FEAT_COMPLETE, - le_read_all_remote_feat_complete, - sizeof(struct bt_hci_evt_le_read_all_remote_feat_complete)), -#endif /* CONFIG_BT_LE_EXTENDED_FEAT_SET */ #endif /* CONFIG_BT_CONN */ #if defined(CONFIG_BT_CHANNEL_SOUNDING) EVENT_HANDLER(BT_HCI_EVT_LE_CS_READ_REMOTE_SUPPORTED_CAPABILITIES_COMPLETE, @@ -3194,47 +3158,9 @@ static void read_le_features_complete(struct net_buf *buf) LOG_DBG("status 0x%02x %s", rp->status, bt_hci_err_to_str(rp->status)); - memcpy(bt_dev.le.features, rp->features, sizeof(rp->features)); -} - -static void read_le_all_supported_features_complete(struct net_buf *buf) -{ - struct bt_hci_rp_le_read_all_local_supported_features *rp = (void *)buf->data; - - LOG_DBG("status 0x%02x %s", rp->status, bt_hci_err_to_str(rp->status)); - memcpy(bt_dev.le.features, rp->features, sizeof(bt_dev.le.features)); } -static int read_le_local_supported_features(void) -{ - struct net_buf *rsp; - int err; - - /* Read Low Energy Supported Features */ - if (IS_ENABLED(CONFIG_BT_LE_EXTENDED_FEAT_SET) && - BT_READ_ALL_LOCAL_FEATURES_SUPPORTED(bt_dev.supported_commands)) { - err = bt_hci_cmd_send_sync(BT_HCI_OP_LE_READ_ALL_LOCAL_SUPPORTED_FEATURES, NULL, - &rsp); - if (err != 0) { - return err; - } - - read_le_all_supported_features_complete(rsp); - } else { - err = bt_hci_cmd_send_sync(BT_HCI_OP_LE_READ_LOCAL_FEATURES, NULL, - &rsp); - if (err != 0) { - return err; - } - - read_le_features_complete(rsp); - } - - net_buf_unref(rsp); - return 0; -} - #if defined(CONFIG_BT_CONN) #if !defined(CONFIG_BT_CLASSIC) static void read_buffer_size_complete(struct net_buf *buf) @@ -3519,11 +3445,6 @@ static int le_set_event_mask(void) BT_FEAT_LE_CONN_SUBRATING(bt_dev.le.features)) { mask |= BT_EVT_MASK_LE_SUBRATE_CHANGE; } - - if (IS_ENABLED(CONFIG_BT_LE_EXTENDED_FEAT_SET) && - BT_FEAT_LE_EXTENDED_FEAT_SET(bt_dev.le.features)) { - mask |= BT_EVT_MASK_LE_READ_ALL_REMOTE_FEAT_COMPLETE; - } } if (IS_ENABLED(CONFIG_BT_SMP) && @@ -3662,11 +3583,16 @@ static int le_init(void) return -ENODEV; } - err = read_le_local_supported_features(); + /* Read Low Energy Supported Features */ + err = bt_hci_cmd_send_sync(BT_HCI_OP_LE_READ_LOCAL_FEATURES, NULL, + &rsp); if (err) { return err; } + read_le_features_complete(rsp); + net_buf_unref(rsp); + if (IS_ENABLED(CONFIG_BT_ISO) && BT_FEAT_LE_ISO(bt_dev.le.features)) { err = le_init_iso(); diff --git a/subsys/bluetooth/host/shell/bt.c b/subsys/bluetooth/host/shell/bt.c index cc30ad7fbb19..1550644018ef 100644 --- a/subsys/bluetooth/host/shell/bt.c +++ b/subsys/bluetooth/host/shell/bt.c @@ -1008,37 +1008,6 @@ void subrate_changed(struct bt_conn *conn, } #endif -#if defined(CONFIG_BT_LE_EXTENDED_FEAT_SET) -void read_all_remote_feat_complete(struct bt_conn *conn, - const struct bt_conn_le_read_all_remote_feat_complete *params) -{ - if (params->status == BT_HCI_ERR_SUCCESS) { - uint8_t number_of_bytes = BT_HCI_LE_BYTES_PAGE_0_FEATURE_PAGE; - - if (params->max_valid_page > 0) { - number_of_bytes += - (params->max_valid_page * BT_HCI_LE_BYTES_PER_FEATURE_PAGE); - } - - bt_shell_fprintf_print( - "Read all remote features complete, Max Remote Page %d, LE Features: 0x", - params->max_remote_page); - - for (int i = number_of_bytes - 1; i >= 0; i--) { - uint8_t features = params->features[i]; - char features_str[(2 * sizeof(uint8_t)) + 1]; - - bin2hex(&features, sizeof(features), features_str, sizeof(features_str)); - bt_shell_fprintf_print("%s", features_str); - } - bt_shell_fprintf_print("\n"); - } else { - bt_shell_print("Read all remote features failed (HCI status 0x%02x)", - params->status); - } -} -#endif - #if defined(CONFIG_BT_CHANNEL_SOUNDING) void print_remote_cs_capabilities(struct bt_conn *conn, uint8_t status, @@ -1218,9 +1187,6 @@ static struct bt_conn_cb conn_callbacks = { #if defined(CONFIG_BT_SUBRATING) .subrate_changed = subrate_changed, #endif -#if defined(CONFIG_BT_LE_EXTENDED_FEAT_SET) - .read_all_remote_feat_complete = read_all_remote_feat_complete, -#endif #if defined(CONFIG_BT_CHANNEL_SOUNDING) .le_cs_read_remote_capabilities_complete = print_remote_cs_capabilities, .le_cs_read_remote_fae_table_complete = print_remote_cs_fae_table, @@ -3314,34 +3280,6 @@ static int cmd_subrate_request(const struct shell *sh, size_t argc, char *argv[] } #endif -#if defined(CONFIG_BT_LE_EXTENDED_FEAT_SET) -static int cmd_read_all_remote_features(const struct shell *sh, size_t argc, char *argv[]) -{ - int err = 0; - - if (default_conn == NULL) { - shell_error(sh, "Conn handle error, at least one connection is required."); - return -ENOEXEC; - } - - uint8_t pages_requested = shell_strtoul(argv[1], 10, &err); - - if (err != 0) { - shell_help(sh); - shell_error(sh, "Could not parse input for pages_requested"); - return SHELL_CMD_HELP_PRINTED; - } - - err = bt_conn_le_read_all_remote_features(default_conn, pages_requested); - if (err != 0) { - shell_error(sh, "bt_conn_le_read_all_remote_features returned error %d", err); - return -ENOEXEC; - } - - return 0; -} -#endif - #if defined(CONFIG_BT_CONN) #if defined(CONFIG_BT_CENTRAL) static int bt_do_connect_le(int *ercd, size_t argc, char *argv[]) @@ -5093,10 +5031,6 @@ SHELL_STATIC_SUBCMD_SET_CREATE(bt_cmds, " ", cmd_subrate_request, 6, 0), #endif -#if defined(CONFIG_BT_LE_EXTENDED_FEAT_SET) - SHELL_CMD_ARG(read-all-remote-features, NULL, "", - cmd_read_all_remote_features, 2, 0), -#endif #if defined(CONFIG_BT_BROADCASTER) SHELL_CMD_ARG(advertise, NULL, " [mode: discov, non_discov] " diff --git a/tests/bluetooth/shell/testcase.yaml b/tests/bluetooth/shell/testcase.yaml index 673f13e481ca..812aee24eeb3 100644 --- a/tests/bluetooth/shell/testcase.yaml +++ b/tests/bluetooth/shell/testcase.yaml @@ -34,12 +34,6 @@ tests: - CONFIG_BT_SUBRATING=y - CONFIG_BT_LL_SW_SPLIT=n build_only: true - bluetooth.shell.extended_feature_set: - extra_configs: - - CONFIG_BT_LE_MAX_LOCAL_SUPPORTED_FEATURE_PAGE=10 - - CONFIG_BT_LE_EXTENDED_FEAT_SET=y - - CONFIG_BT_LL_SW_SPLIT=n - build_only: true bluetooth.shell.channel_sounding: extra_configs: - CONFIG_BT_CHANNEL_SOUNDING=y From 926b3d9ed773834e051a747d5f21e78de62017d2 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:35 +0300 Subject: [PATCH 0985/2141] Revert "[nrf fromtree] bluetooth: host: hci_core: allow both orders of version and feature events" This reverts commit 5684f5eeed7d513efcc806aaa69bb8f274776515. Signed-off-by: Jukka Rissanen --- subsys/bluetooth/host/hci_core.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/subsys/bluetooth/host/hci_core.c b/subsys/bluetooth/host/hci_core.c index 9de787388b17..7263bc39ed4e 100644 --- a/subsys/bluetooth/host/hci_core.c +++ b/subsys/bluetooth/host/hci_core.c @@ -1792,8 +1792,7 @@ static void le_remote_feat_complete(struct net_buf *buf) atomic_set_bit(conn->flags, BT_CONN_LE_FEATURES_EXCHANGED); if (IS_ENABLED(CONFIG_BT_REMOTE_INFO) && - (!IS_ENABLED(CONFIG_BT_REMOTE_VERSION) || - atomic_test_bit(conn->flags, BT_CONN_AUTO_VERSION_INFO))) { + !IS_ENABLED(CONFIG_BT_REMOTE_VERSION)) { notify_remote_info(conn); } @@ -2373,8 +2372,7 @@ static void bt_hci_evt_read_remote_version_complete(struct net_buf *buf) atomic_set_bit(conn->flags, BT_CONN_AUTO_VERSION_INFO); - if (IS_ENABLED(CONFIG_BT_REMOTE_INFO) && - atomic_test_bit(conn->flags, BT_CONN_LE_FEATURES_EXCHANGED)) { + if (IS_ENABLED(CONFIG_BT_REMOTE_INFO)) { /* Remote features is already present */ notify_remote_info(conn); } From dfa2b470314664894e159597f95a9e068ed49d1a Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:35 +0300 Subject: [PATCH 0986/2141] Revert "[nrf fromtree] kconfig: fix typo in (soc, subsys)" This reverts commit 149b89ae09b5658fdd4ede74ee5275e8a7ac3cd9. Signed-off-by: Jukka Rissanen --- soc/atmel/sam0/common/Kconfig.samd2x | 2 +- soc/espressif/esp32s3/Kconfig | 3 +-- soc/intel/intel_adsp/Kconfig | 4 ++-- soc/intel/intel_adsp/Kconfig.defconfig | 2 +- soc/nxp/imxrt/imxrt118x/Kconfig | 4 ++-- soc/nxp/rw/Kconfig | 2 +- soc/renesas/rx/Kconfig | 2 +- soc/silabs/Kconfig | 2 +- soc/st/stm32/Kconfig | 2 +- soc/st/stm32/Kconfig.defconfig | 2 +- subsys/bluetooth/controller/Kconfig | 2 +- subsys/canbus/isotp/Kconfig | 2 +- subsys/debug/coredump/Kconfig | 2 +- subsys/ipc/ipc_service/backends/Kconfig | 10 +++++----- subsys/logging/Kconfig.processing | 2 +- subsys/mgmt/ec_host_cmd/Kconfig.logging | 2 +- subsys/mgmt/mcumgr/smp/Kconfig | 4 ++-- 17 files changed, 24 insertions(+), 25 deletions(-) diff --git a/soc/atmel/sam0/common/Kconfig.samd2x b/soc/atmel/sam0/common/Kconfig.samd2x index c9de00e3249b..11f76f608a14 100644 --- a/soc/atmel/sam0/common/Kconfig.samd2x +++ b/soc/atmel/sam0/common/Kconfig.samd2x @@ -8,7 +8,7 @@ config SOC_ATMEL_SAMD_NVM_WAIT_STATES default 1 help Wait states to set for NVM. Consult the datasheet as these are highly - dependent on the device operating conditions. + dependent on the device operationg conditions. config SOC_ATMEL_SAMD_OSC32K bool "Internal 32.768 kHz RC oscillator" diff --git a/soc/espressif/esp32s3/Kconfig b/soc/espressif/esp32s3/Kconfig index 5fa2d4607e8b..99ebadeb4405 100644 --- a/soc/espressif/esp32s3/Kconfig +++ b/soc/espressif/esp32s3/Kconfig @@ -152,8 +152,7 @@ config MAC_BB_PD help If enabled, the MAC and baseband of Wi-Fi and Bluetooth will be powered down when PHY is disabled. Enabling this setting reduces power consumption - by a small amount but increases RAM use by approximately 4KB (Wi-Fi only), - 2KB (Bluetooth only) or 5.3KB (Wi-Fi + Bluetooth). + by a small amount but increases RAM use by approximat endmenu # Cache config diff --git a/soc/intel/intel_adsp/Kconfig b/soc/intel/intel_adsp/Kconfig index 2d87adb03066..096c4336876e 100644 --- a/soc/intel/intel_adsp/Kconfig +++ b/soc/intel/intel_adsp/Kconfig @@ -141,8 +141,8 @@ config XTENSA_WAITI_BUG config ADSP_IDLE_CLOCK_GATING bool "DSP clock gating in Idle" help - When true, FW will run with enabled clock gating. This option changes - HW configuration of a DSP. Every time core goes to the WAITI state + When true, FW will run with enabled clock gating. This options change + HW configuration of a DSP. Evry time core goes to the WAITI state (wait for interrupt) during idle, the clock can be gated (however, this does not mean that this will happen). diff --git a/soc/intel/intel_adsp/Kconfig.defconfig b/soc/intel/intel_adsp/Kconfig.defconfig index 1d8312e7fb6c..5a2ff345e259 100644 --- a/soc/intel/intel_adsp/Kconfig.defconfig +++ b/soc/intel/intel_adsp/Kconfig.defconfig @@ -18,7 +18,7 @@ config XTENSA_RPO_CACHE def_bool y # console can't handle the amount of data coming from many tests, so introduce -# a delay between testcases. +# a delay beween testcases. if ZTEST config ZTEST_TEST_DELAY_MS default 100 diff --git a/soc/nxp/imxrt/imxrt118x/Kconfig b/soc/nxp/imxrt/imxrt118x/Kconfig index 1ec08a043113..d62af3d1b518 100644 --- a/soc/nxp/imxrt/imxrt118x/Kconfig +++ b/soc/nxp/imxrt/imxrt118x/Kconfig @@ -40,11 +40,11 @@ config IMAGE_CONTAINER_OFFSET default 0x1000 help Image container is a boot image format that is used by ROM. Container - format consists of container header, image array entry, signature block + format consists container header, image arrary entry, signature block and user program images and data. The boot ROM expects container data to be saved in external memory. -# Note- This config presents the offset between container header and user +# Note- This config present the offest between container header and user # image. If ROM_START_OFFSET changed, you also need to change CONTAINER_USER_IMAGE_OFFSET # value. CONTAINER_USER_IMAGE_OFFSET = ROM_START_OFFSET - IMAGE_CONTAINER_OFFSET. config CONTAINER_USER_IMAGE_OFFSET diff --git a/soc/nxp/rw/Kconfig b/soc/nxp/rw/Kconfig index 63a2e28b7320..a32483ad0c12 100644 --- a/soc/nxp/rw/Kconfig +++ b/soc/nxp/rw/Kconfig @@ -39,7 +39,7 @@ config FLASH_CONFIG_OFFSET default 0x400 help The flash config offset provides the boot ROM with the on-board - flash type and parameters. The boot ROM requires a fixed flash config + flash type and parameters. The boot ROM requires a fixed flash conifg offset for FlexSPI device. config IMAGE_VECTOR_TABLE_OFFSET diff --git a/soc/renesas/rx/Kconfig b/soc/renesas/rx/Kconfig index 2f5253bf5412..f0670b850e3a 100644 --- a/soc/renesas/rx/Kconfig +++ b/soc/renesas/rx/Kconfig @@ -10,7 +10,7 @@ config RENESAS_NONE_USED_PORT_INIT bool "Initialize unused ports" default y help - Initialize the unused pins of RX MCU followed by in the "Handling of + Initialize the unsed pins of RX MCU followed by in the "Handling of Unused Pins" section of PORT chapter of RX MCU of User's manual. Note: please MUST set "BSP_PACKAGE_PINS" definition to your device of pin type in r_bsp_config.h. diff --git a/soc/silabs/Kconfig b/soc/silabs/Kconfig index 1fb5535ac671..dcf8de541c63 100644 --- a/soc/silabs/Kconfig +++ b/soc/silabs/Kconfig @@ -9,7 +9,7 @@ if SOC_FAMILY_SILABS_S0 || SOC_FAMILY_SILABS_S1 || SOC_FAMILY_SILABS_S2 config SOC_GECKO_SDID int help - Sometimes, Gecko SDK refers to the chipset using the internal ID. This + Gecko SDK sometime refere to the chipset using the internal ID. This entry reflects this ID. config SOC_GECKO_BURTC diff --git a/soc/st/stm32/Kconfig b/soc/st/stm32/Kconfig index a14d9ea81824..59a245fb17a9 100644 --- a/soc/st/stm32/Kconfig +++ b/soc/st/stm32/Kconfig @@ -36,7 +36,7 @@ config STM32_ENABLE_DEBUG_SLEEP_STOP Some STM32 parts disable the DBGMCU in sleep/stop modes because of power consumption. As a side-effects this prevents debuggers from attaching w/o resetting the target. This - effectively destroys the use-case of `west attach`. Also + effectivly destroys the use-case of `west attach`. Also SEGGER RTT and similar technologies need this. config SWJ_ANALOG_PRIORITY diff --git a/soc/st/stm32/Kconfig.defconfig b/soc/st/stm32/Kconfig.defconfig index 26055f9eb606..18f343b9324c 100644 --- a/soc/st/stm32/Kconfig.defconfig +++ b/soc/st/stm32/Kconfig.defconfig @@ -3,7 +3,7 @@ # Copyright (c) 2017, I-SENSE group of ICCS # SPDX-License-Identifier: Apache-2.0 -# Default configurations applied to the whole STM32 family +# Default configurations appplied tp the whole STM32 family if SOC_FAMILY_STM32 diff --git a/subsys/bluetooth/controller/Kconfig b/subsys/bluetooth/controller/Kconfig index 16a40b7f4375..60726163581c 100644 --- a/subsys/bluetooth/controller/Kconfig +++ b/subsys/bluetooth/controller/Kconfig @@ -128,7 +128,7 @@ config BT_CTLR_SUBRATING_SUPPORT config BT_CTLR_CHANNEL_SOUNDING_SUPPORT bool -# Virtual option that all local LL implementations should select +# Virtual option that all local LL implemenations should select config HAS_BT_CTLR bool diff --git a/subsys/canbus/isotp/Kconfig b/subsys/canbus/isotp/Kconfig index c643f22ca187..281692cf95ed 100644 --- a/subsys/canbus/isotp/Kconfig +++ b/subsys/canbus/isotp/Kconfig @@ -87,7 +87,7 @@ config ISOTP_RX_SF_FF_BUF_COUNT default 4 help This buffer is used for first and single frames. It is extra because the - buffer has to be ready for the first reception in isr context and therefore + buffer has to be ready for the first reception in isr context and therefor is allocated when binding. Each buffer will occupy CAN_MAX_DLEN - 1 byte + header (sizeof(struct net_buf)) amount of data. diff --git a/subsys/debug/coredump/Kconfig b/subsys/debug/coredump/Kconfig index c4e93605988d..1e763e522e19 100644 --- a/subsys/debug/coredump/Kconfig +++ b/subsys/debug/coredump/Kconfig @@ -45,7 +45,7 @@ config DEBUG_COREDUMP_BACKEND_INTEL_ADSP_MEM_WINDOW help Core dump is done via memory window slot[1]. It is Intel ADSP memory region shared with xtensa DSP. - Window 2 slot [1] is reserved for debugging information. + Window 2 slot [1] is reserved for debuging information. config DEBUG_COREDUMP_BACKEND_OTHER bool "Backend subsystem for coredump defined out of tree" diff --git a/subsys/ipc/ipc_service/backends/Kconfig b/subsys/ipc/ipc_service/backends/Kconfig index bb8b444898f9..8230465e246a 100644 --- a/subsys/ipc/ipc_service/backends/Kconfig +++ b/subsys/ipc/ipc_service/backends/Kconfig @@ -23,7 +23,7 @@ config IPC_SERVICE_BACKEND_ICMSG depends on DT_HAS_ZEPHYR_IPC_ICMSG_ENABLED select IPC_SERVICE_ICMSG help - Choosing this backend results in single endpoint implementation based + Chosing this backend results in single endpoint implementation based on circular packet buffer. config IPC_SERVICE_BACKEND_ICMSG_ME_INITIATOR @@ -33,8 +33,8 @@ config IPC_SERVICE_BACKEND_ICMSG_ME_INITIATOR depends on DT_HAS_ZEPHYR_IPC_ICMSG_ME_INITIATOR_ENABLED select IPC_SERVICE_ICMSG_ME help - Choosing this backend results in multi endpoint implementation based - on circular packet buffer. This enables endpoint discovery initiator + Chosing this backend results in multi endpoint implementation based + on circular packet buffer. This enables enpoint discovery initiator role. config IPC_SERVICE_BACKEND_ICMSG_ME_FOLLOWER @@ -44,8 +44,8 @@ config IPC_SERVICE_BACKEND_ICMSG_ME_FOLLOWER depends on DT_HAS_ZEPHYR_IPC_ICMSG_ME_FOLLOWER_ENABLED select IPC_SERVICE_ICMSG_ME help - Choosing this backend results in multi endpoint implementation based - on circular packet buffer. This enables endpoint discovery follower + Chosing this backend results in multi endpoint implementation based + on circular packet buffer. This enables enpoint discovery follower role. rsource "Kconfig.icmsg_me" diff --git a/subsys/logging/Kconfig.processing b/subsys/logging/Kconfig.processing index c13c8a76a913..f354e8b5df61 100644 --- a/subsys/logging/Kconfig.processing +++ b/subsys/logging/Kconfig.processing @@ -114,7 +114,7 @@ config LOG_PROCESS_THREAD_PRIORITY depends on LOG_PROCESS_THREAD_CUSTOM_PRIORITY help The priority of the log processing thread. - When not set the priority is set to K_LOWEST_APPLICATION_THREAD_PRIO. + When not set the prority is set to K_LOWEST_APPLICATION_THREAD_PRIO. endif # LOG_PROCESS_THREAD diff --git a/subsys/mgmt/ec_host_cmd/Kconfig.logging b/subsys/mgmt/ec_host_cmd/Kconfig.logging index ca2253099294..96de59e39cd0 100644 --- a/subsys/mgmt/ec_host_cmd/Kconfig.logging +++ b/subsys/mgmt/ec_host_cmd/Kconfig.logging @@ -8,7 +8,7 @@ config EC_HOST_CMD_LOG_DBG_BUFFERS depends on EC_HC_LOG_LEVEL_DBG help Every command is logged with the debug logging level. Use this config - to decide if full request and response buffers are logged alongside + to decide, if full reqest and response buffers are logged alongside other command parameters. config EC_HOST_CMD_LOG_SUPPRESSED_NUMBER diff --git a/subsys/mgmt/mcumgr/smp/Kconfig b/subsys/mgmt/mcumgr/smp/Kconfig index aab861fa9cf9..b460067dd844 100644 --- a/subsys/mgmt/mcumgr/smp/Kconfig +++ b/subsys/mgmt/mcumgr/smp/Kconfig @@ -31,7 +31,7 @@ config MCUMGR_SMP_CBOR_MIN_DECODING_LEVELS help Minimal decoding levels, map/list encapsulation, required to be supported by zcbor decoding of SMP responses - is auto generated from MCUMGR_SMP_CBOR_MIN_DECODING_LEVEL_? options. + is auto genereated from MCUMGR_SMP_CBOR_MIN_DECODING_LEVEL_? options. A group or command that adds additional maps/lists above the base map, which is already taken into account, should select one of the MCUMGR_SMP_CBOR_MIN_DECODING_LEVEL_?. @@ -87,7 +87,7 @@ config MCUMGR_SMP_CBOR_MIN_ENCODING_LEVELS help Minimal encoding levels, map/list encapsulation, required to be supported by zcbor encoding of SMP responses - is auto generated from MCUMGR_SMP_CBOR_MIN_ENCODING_LEVEL_? options. + is auto genereated from MCUMGR_SMP_CBOR_MIN_ENCODING_LEVEL_? options. A group or command that adds additional maps/lists above the base map, which is already taken into account, should select one of the MCUMGR_SMP_CBOR_MIN_ENCODING_LEVEL_?. From 8ef0c229f2f6169e277f7d11bd9efd7eacb74fab Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:35 +0300 Subject: [PATCH 0987/2141] Revert "[nrf fromtree] drivers: flash: nordic: nrf_mramc update" This reverts commit 142b7e6a6ba865e99abca1f326a302df7e5647c1. Signed-off-by: Jukka Rissanen --- drivers/flash/soc_flash_nrf_mramc.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/flash/soc_flash_nrf_mramc.c b/drivers/flash/soc_flash_nrf_mramc.c index 7e3a88af2b23..716e7c0f2504 100644 --- a/drivers/flash/soc_flash_nrf_mramc.c +++ b/drivers/flash/soc_flash_nrf_mramc.c @@ -10,7 +10,7 @@ #include #include #if defined(CONFIG_SOC_FLASH_NRF_MRAMC_FLUSH_CACHE) -#include +#include #endif LOG_MODULE_REGISTER(flash_nrf_mramc, CONFIG_FLASH_LOG_LEVEL); @@ -112,7 +112,13 @@ static int nrf_mramc_write(const struct device *dev, off_t offset, * and not number of bytes */ nrfx_mramc_words_write(addr, data, len / WRITE_BLOCK_SIZE); - +#if defined(CONFIG_SOC_FLASH_NRF_MRAMC_FLUSH_CACHE) + if (nrf_cache_enable_check(NRF_ICACHE)) { + while (nrf_cache_busy_check(NRF_ICACHE)) { + } + nrf_cache_invalidate(NRF_ICACHE); + } +#endif return 0; } @@ -138,7 +144,11 @@ static int nrf_mramc_erase(const struct device *dev, off_t offset, size_t size) */ nrfx_mramc_area_erase(addr, size / WRITE_BLOCK_SIZE); #if defined(CONFIG_SOC_FLASH_NRF_MRAMC_FLUSH_CACHE) - sys_cache_instr_invd_all(); + if (nrf_cache_enable_check(NRF_ICACHE)) { + while (nrf_cache_busy_check(NRF_ICACHE)) { + } + nrf_cache_invalidate(NRF_ICACHE); + } #endif return 0; } From bcbd57b3a06e2063eee0d19c7edaec0055b49ff0 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:35 +0300 Subject: [PATCH 0988/2141] Revert "[nrf fromtree] drivers: flash: nordic: fix nrf-mramc indentation" This reverts commit d1bf6d42716c9e662dd55393c842e83eb5d41f9f. Signed-off-by: Jukka Rissanen --- drivers/flash/soc_flash_nrf_mramc.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/flash/soc_flash_nrf_mramc.c b/drivers/flash/soc_flash_nrf_mramc.c index 716e7c0f2504..c08f8f32851c 100644 --- a/drivers/flash/soc_flash_nrf_mramc.c +++ b/drivers/flash/soc_flash_nrf_mramc.c @@ -4,14 +4,14 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include - -#include -#include -#include -#if defined(CONFIG_SOC_FLASH_NRF_MRAMC_FLUSH_CACHE) -#include -#endif + #include + + #include + #include + #include + #if defined(CONFIG_SOC_FLASH_NRF_MRAMC_FLUSH_CACHE) + #include + #endif LOG_MODULE_REGISTER(flash_nrf_mramc, CONFIG_FLASH_LOG_LEVEL); From a6c7e57d10f890427ac96a44e2730483324ffc10 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:35 +0300 Subject: [PATCH 0989/2141] Revert "[nrf fromlist] boards: nordic: nrf54h20dk: Disable EXMIF and GPIO6 by default" This reverts commit 63febf7715f82807e3b70eb33b3365a7372412a8. Signed-off-by: Jukka Rissanen --- .../nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 4 ++-- .../jesd216/boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 10 ---------- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 10 ---------- .../common/boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 10 ---------- 4 files changed, 2 insertions(+), 32 deletions(-) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index 0eb2fc235a5c..85a2539c3ffe 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -264,14 +264,14 @@ slot3_partition: &cpurad_slot1_partition { }; &gpio6 { - status = "disabled"; + status = "okay"; }; &exmif { pinctrl-0 = <&exmif_default>; pinctrl-1 = <&exmif_sleep>; pinctrl-names = "default", "sleep"; - status = "disabled"; + status = "okay"; mx25uw63: mx25uw6345g@0 { compatible = "mxicy,mx25u", "jedec,mspi-nor"; diff --git a/samples/drivers/jesd216/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/samples/drivers/jesd216/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index 22c24c32f6d8..b8f138ad2b2e 100644 --- a/samples/drivers/jesd216/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/samples/drivers/jesd216/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -4,16 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -&gpio6 { - status = "okay"; - zephyr,pm-device-runtime-auto; -}; - -&exmif { - status = "okay"; - zephyr,pm-device-runtime-auto; -}; - &mx25uw63 { status = "okay"; }; diff --git a/samples/drivers/spi_flash/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/samples/drivers/spi_flash/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index 22c24c32f6d8..b8f138ad2b2e 100644 --- a/samples/drivers/spi_flash/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/samples/drivers/spi_flash/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -4,16 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -&gpio6 { - status = "okay"; - zephyr,pm-device-runtime-auto; -}; - -&exmif { - status = "okay"; - zephyr,pm-device-runtime-auto; -}; - &mx25uw63 { status = "okay"; }; diff --git a/tests/drivers/flash/common/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/flash/common/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index 22c24c32f6d8..b8f138ad2b2e 100644 --- a/tests/drivers/flash/common/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/tests/drivers/flash/common/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -4,16 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -&gpio6 { - status = "okay"; - zephyr,pm-device-runtime-auto; -}; - -&exmif { - status = "okay"; - zephyr,pm-device-runtime-auto; -}; - &mx25uw63 { status = "okay"; }; From 432479d801ebd92758c1f86a728cf4909da41f9a Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:35 +0300 Subject: [PATCH 0990/2141] Revert "[nrf fromlist] openthread: Use OPENTHREAD instead of L2_OPENTHREAD in dependencies" This reverts commit f39f7647e2526ffc081096e8b764693d620a93c9. Signed-off-by: Jukka Rissanen --- modules/mbedtls/Kconfig.mbedtls | 2 +- subsys/logging/backends/Kconfig.spinel | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/mbedtls/Kconfig.mbedtls b/modules/mbedtls/Kconfig.mbedtls index 87ab5ed44e4d..2d8f260b5d13 100644 --- a/modules/mbedtls/Kconfig.mbedtls +++ b/modules/mbedtls/Kconfig.mbedtls @@ -485,7 +485,7 @@ config MBEDTLS_ENTROPY_POLL_ZEPHYR config MBEDTLS_OPENTHREAD_OPTIMIZATIONS_ENABLED bool "MbedTLS optimizations for OpenThread" - depends on OPENTHREAD + depends on NET_L2_OPENTHREAD default y if !NET_SOCKETS_SOCKOPT_TLS help Enable some OpenThread specific mbedTLS optimizations that allows to diff --git a/subsys/logging/backends/Kconfig.spinel b/subsys/logging/backends/Kconfig.spinel index 94ed1f040a94..d2d29370aa35 100644 --- a/subsys/logging/backends/Kconfig.spinel +++ b/subsys/logging/backends/Kconfig.spinel @@ -4,7 +4,7 @@ config LOG_BACKEND_SPINEL bool "OpenThread dedicated Spinel protocol backend" depends on !LOG_BACKEND_UART - depends on OPENTHREAD + depends on NET_L2_OPENTHREAD help When enabled, backend will use OpenThread dedicated SPINEL protocol for logging. This protocol is byte oriented and wraps given messages into serial frames. From 95693441cb7fe8d677cc5f9498ad214579564b6a Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:35 +0300 Subject: [PATCH 0991/2141] Revert "[nrf fromlist] drivers: spi: nrfx: release constlat mode on suspend" This reverts commit f1b32dd21614cb36651a29e6b37c795581839489. Signed-off-by: Jukka Rissanen --- drivers/spi/spi_nrfx_spim.c | 2 +- drivers/spi/spi_nrfx_spis.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi_nrfx_spim.c b/drivers/spi/spi_nrfx_spim.c index ef832713936c..c8a0566b68a6 100644 --- a/drivers/spi/spi_nrfx_spim.c +++ b/drivers/spi/spi_nrfx_spim.c @@ -806,7 +806,7 @@ static void spim_suspend(const struct device *dev) #if SPIM_CROSS_DOMAIN_PINS_HANDLE int err; - err = nrf_sys_event_release_global_constlat(); + err = nrf_sys_event_request_global_constlat(); (void)err; __ASSERT_NO_MSG(err >= 0); #else diff --git a/drivers/spi/spi_nrfx_spis.c b/drivers/spi/spi_nrfx_spis.c index 71256b84fc33..c6e551eafc32 100644 --- a/drivers/spi/spi_nrfx_spis.c +++ b/drivers/spi/spi_nrfx_spis.c @@ -451,7 +451,7 @@ static void spi_nrfx_suspend(const struct device *dev) #if SPIS_CROSS_DOMAIN_PINS_HANDLE int err; - err = nrf_sys_event_release_global_constlat(); + err = nrf_sys_event_request_global_constlat(); (void)err; __ASSERT_NO_MSG(err >= 0); #else From f19cd0fceeb61aef2a5765a8aacec564d2c87076 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:35 +0300 Subject: [PATCH 0992/2141] Revert "[nrf fromlist] tests: drivers: counter_nrf_rtc: test fixed top on nRF52832" This reverts commit dcf7fbdde4ca060152ca71b820b9be3a02707ce2. Signed-off-by: Jukka Rissanen --- .../fixed_top/boards/nrf52dk_nrf52832.overlay | 8 -------- .../counter/counter_nrf_rtc/fixed_top/testcase.yaml | 1 - 2 files changed, 9 deletions(-) delete mode 100644 tests/drivers/counter/counter_nrf_rtc/fixed_top/boards/nrf52dk_nrf52832.overlay diff --git a/tests/drivers/counter/counter_nrf_rtc/fixed_top/boards/nrf52dk_nrf52832.overlay b/tests/drivers/counter/counter_nrf_rtc/fixed_top/boards/nrf52dk_nrf52832.overlay deleted file mode 100644 index ebfed9cf9032..000000000000 --- a/tests/drivers/counter/counter_nrf_rtc/fixed_top/boards/nrf52dk_nrf52832.overlay +++ /dev/null @@ -1,8 +0,0 @@ -&rtc0 { - status = "okay"; - fixed-top; -}; -&rtc2 { - status = "okay"; - fixed-top; -}; diff --git a/tests/drivers/counter/counter_nrf_rtc/fixed_top/testcase.yaml b/tests/drivers/counter/counter_nrf_rtc/fixed_top/testcase.yaml index 763c6896d079..38dda6dc88ce 100644 --- a/tests/drivers/counter/counter_nrf_rtc/fixed_top/testcase.yaml +++ b/tests/drivers/counter/counter_nrf_rtc/fixed_top/testcase.yaml @@ -5,7 +5,6 @@ tests: - counter depends_on: counter platform_allow: - - nrf52dk/nrf52832 - nrf52840dk/nrf52840 - nrf52_bsim - nrf54h20dk/nrf54h20/cpuapp From 45539449d40f31e8cb869ff96cb3bb3d65383b8f Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:35 +0300 Subject: [PATCH 0993/2141] Revert "[nrf fromlist] drivers: timer: nrf_rtc_timer: Allow use of custom bit width" This reverts commit a0459930f3cd7393326f35475a93aad9121d074d. Signed-off-by: Jukka Rissanen --- drivers/timer/Kconfig.nrf_rtc | 7 -- drivers/timer/nrf_rtc_timer.c | 77 ++------------------ include/zephyr/drivers/timer/nrf_rtc_timer.h | 2 +- tests/drivers/timer/nrf_rtc_timer/src/main.c | 11 +-- 4 files changed, 9 insertions(+), 88 deletions(-) diff --git a/drivers/timer/Kconfig.nrf_rtc b/drivers/timer/Kconfig.nrf_rtc index 82228d453caf..729dc8d362a7 100644 --- a/drivers/timer/Kconfig.nrf_rtc +++ b/drivers/timer/Kconfig.nrf_rtc @@ -9,7 +9,6 @@ config NRF_RTC_TIMER depends on SOC_COMPATIBLE_NRF select TICKLESS_CAPABLE select SYSTEM_TIMER_HAS_DISABLE_SUPPORT - select NRFX_PPI if SOC_NRF52832 depends on !$(dt_nodelabel_enabled,rtc1) help This module implements a kernel device driver for the nRF Real Time @@ -43,10 +42,4 @@ config NRF_RTC_TIMER_TRIGGER_OVERFLOW When enabled, a function can be used to trigger RTC overflow and effectively shift time into the future. -config NRF_RTC_COUNTER_BIT_WIDTH - int - default 15 if SOC_NRF52832 - default 24 - range 15 24 - endif # NRF_RTC_TIMER diff --git a/drivers/timer/nrf_rtc_timer.c b/drivers/timer/nrf_rtc_timer.c index a70cc19b7e9b..0fdf951f925b 100644 --- a/drivers/timer/nrf_rtc_timer.c +++ b/drivers/timer/nrf_rtc_timer.c @@ -17,34 +17,23 @@ #include #include -#define RTC_BIT_WIDTH 24 - -#if (CONFIG_NRF_RTC_COUNTER_BIT_WIDTH < RTC_BIT_WIDTH) -#define CUSTOM_COUNTER_BIT_WIDTH 1 -#define WRAP_CH 1 -#include "nrfx_ppi.h" -#else -#define CUSTOM_COUNTER_BIT_WIDTH 0 -#endif - #define RTC_PRETICK (IS_ENABLED(CONFIG_SOC_NRF53_RTC_PRETICK) && \ IS_ENABLED(CONFIG_SOC_NRF5340_CPUNET)) #define EXT_CHAN_COUNT CONFIG_NRF_RTC_TIMER_USER_CHAN_COUNT -#define CHAN_COUNT (EXT_CHAN_COUNT + 1 + CUSTOM_COUNTER_BIT_WIDTH) +#define CHAN_COUNT (EXT_CHAN_COUNT + 1) #define RTC NRF_RTC1 #define RTC_IRQn NRFX_IRQ_NUMBER_GET(RTC) #define RTC_LABEL rtc1 #define CHAN_COUNT_MAX (RTC1_CC_NUM - (RTC_PRETICK ? 1 : 0)) -#define SYS_CLOCK_CH 0 BUILD_ASSERT(CHAN_COUNT <= CHAN_COUNT_MAX, "Not enough compare channels"); /* Ensure that counter driver for RTC1 is not enabled. */ BUILD_ASSERT(DT_NODE_HAS_STATUS(DT_NODELABEL(RTC_LABEL), disabled), "Counter for RTC1 must be disabled"); -#define COUNTER_BIT_WIDTH CONFIG_NRF_RTC_COUNTER_BIT_WIDTH +#define COUNTER_BIT_WIDTH 24U #define COUNTER_SPAN BIT(COUNTER_BIT_WIDTH) #define COUNTER_MAX (COUNTER_SPAN - 1U) #define COUNTER_HALF_SPAN (COUNTER_SPAN / 2U) @@ -150,7 +139,7 @@ uint32_t z_nrf_rtc_timer_capture_task_address_get(int32_t chan) { #if defined(RTC_TASKS_CAPTURE_TASKS_CAPTURE_Msk) __ASSERT_NO_MSG(chan >= 0 && chan < CHAN_COUNT); - if (chan == SYS_CLOCK_CH) { + if (chan == 0) { return 0; } @@ -275,15 +264,6 @@ static int set_alarm(int32_t chan, uint32_t req_cc, bool exact) */ enum { MIN_CYCLES_FROM_NOW = 3 }; uint32_t cc_val = req_cc; - -#if CUSTOM_COUNTER_BIT_WIDTH - /* If a CC value is 0 when a CLEAR task is set, this will not - * trigger a COMAPRE event. Need to use 1 instead. - */ - if (cc_val % COUNTER_MAX == 0) { - cc_val = 1; - } -#endif uint32_t cc_inc = MIN_CYCLES_FROM_NOW; /* Disable event routing for the channel to avoid getting a COMPARE @@ -447,17 +427,6 @@ uint64_t z_nrf_rtc_timer_read(void) uint32_t cntr = counter(); -#if CUSTOM_COUNTER_BIT_WIDTH - /* If counter is equal to it maximum value while val is greater - * than anchor, then we can assume that overflow has been recorded - * in the overflow_cnt, but clear task has not been triggered yet. - * Treat counter as if it has been cleared. - */ - if ((cntr == COUNTER_MAX) && (val > anchor)) { - cntr = 0; - } -#endif - val += cntr; if (cntr < OVERFLOW_RISK_RANGE_END) { @@ -596,13 +565,8 @@ void rtc_nrf_isr(const void *arg) rtc_pretick_rtc1_isr_hook(); } -#if CUSTOM_COUNTER_BIT_WIDTH - if (nrfy_rtc_int_enable_check(RTC, NRF_RTC_INT_COMPARE1_MASK) && - nrfy_rtc_events_process(RTC, NRF_RTC_INT_COMPARE1_MASK)) { -#else if (nrfy_rtc_int_enable_check(RTC, NRF_RTC_INT_OVERFLOW_MASK) && nrfy_rtc_events_process(RTC, NRF_RTC_INT_OVERFLOW_MASK)) { -#endif overflow_cnt++; } @@ -661,7 +625,7 @@ int z_nrf_rtc_timer_trigger_overflow(void) uint64_t now = z_nrf_rtc_timer_read(); if (err == 0) { - sys_clock_timeout_handler(SYS_CLOCK_CH, now, NULL); + sys_clock_timeout_handler(0, now, NULL); } bail: full_int_unlock(mcu_critical_state); @@ -718,7 +682,7 @@ void sys_clock_set_timeout(int32_t ticks, bool idle) uint64_t target_time = cyc + last_count; - compare_set(SYS_CLOCK_CH, target_time, sys_clock_timeout_handler, NULL, false); + compare_set(0, target_time, sys_clock_timeout_handler, NULL, false); } uint32_t sys_clock_elapsed(void) @@ -738,9 +702,7 @@ uint32_t sys_clock_cycle_get_32(void) static void int_event_disable_rtc(void) { uint32_t mask = NRF_RTC_INT_TICK_MASK | -#if !CUSTOM_COUNTER_BIT_WIDTH NRF_RTC_INT_OVERFLOW_MASK | -#endif NRF_RTC_INT_COMPARE0_MASK | NRF_RTC_INT_COMPARE1_MASK | NRF_RTC_INT_COMPARE2_MASK | @@ -772,9 +734,7 @@ static int sys_clock_driver_init(void) nrfy_rtc_int_enable(RTC, NRF_RTC_CHANNEL_INT_MASK(chan)); } -#if !CUSTOM_COUNTER_BIT_WIDTH nrfy_rtc_int_enable(RTC, NRF_RTC_INT_OVERFLOW_MASK); -#endif NVIC_ClearPendingIRQ(RTC_IRQn); @@ -787,13 +747,13 @@ static int sys_clock_driver_init(void) int_mask = BIT_MASK(CHAN_COUNT); if (CONFIG_NRF_RTC_TIMER_USER_CHAN_COUNT) { - alloc_mask = BIT_MASK(CHAN_COUNT) & ~BIT(SYS_CLOCK_CH); + alloc_mask = BIT_MASK(EXT_CHAN_COUNT) << 1; } uint32_t initial_timeout = IS_ENABLED(CONFIG_TICKLESS_KERNEL) ? MAX_CYCLES : CYC_PER_TICK; - compare_set(SYS_CLOCK_CH, initial_timeout, sys_clock_timeout_handler, NULL, false); + compare_set(0, initial_timeout, sys_clock_timeout_handler, NULL, false); #if defined(CONFIG_CLOCK_CONTROL_NRF) static const enum nrf_lfclk_start_mode mode = @@ -806,29 +766,6 @@ static int sys_clock_driver_init(void) z_nrf_clock_control_lf_on(mode); #endif -#if CUSTOM_COUNTER_BIT_WIDTH - /* WRAP_CH reserved for wrapping. */ - alloc_mask &= ~BIT(WRAP_CH); - - nrf_rtc_event_t evt = NRF_RTC_CHANNEL_EVENT_ADDR(WRAP_CH); - nrfx_err_t result; - nrf_ppi_channel_t ch; - - nrfy_rtc_event_enable(RTC, NRF_RTC_CHANNEL_INT_MASK(WRAP_CH)); - nrfy_rtc_cc_set(RTC, WRAP_CH, COUNTER_MAX); - uint32_t evt_addr; - uint32_t task_addr; - - evt_addr = nrfy_rtc_event_address_get(RTC, evt); - task_addr = nrfy_rtc_task_address_get(RTC, NRF_RTC_TASK_CLEAR); - - result = nrfx_ppi_channel_alloc(&ch); - if (result != NRFX_SUCCESS) { - return -ENODEV; - } - (void)nrfx_ppi_channel_assign(ch, evt_addr, task_addr); - (void)nrfx_ppi_channel_enable(ch); -#endif return 0; } diff --git a/include/zephyr/drivers/timer/nrf_rtc_timer.h b/include/zephyr/drivers/timer/nrf_rtc_timer.h index de1ad940cf54..57340098c23b 100644 --- a/include/zephyr/drivers/timer/nrf_rtc_timer.h +++ b/include/zephyr/drivers/timer/nrf_rtc_timer.h @@ -15,7 +15,7 @@ extern "C" { /** @brief Maximum allowed time span that is considered to be in the future. */ -#define NRF_RTC_TIMER_MAX_SCHEDULE_SPAN BIT(CONFIG_NRF_RTC_COUNTER_BIT_WIDTH - 1) +#define NRF_RTC_TIMER_MAX_SCHEDULE_SPAN BIT(23) /** @brief RTC timer compare event handler. * diff --git a/tests/drivers/timer/nrf_rtc_timer/src/main.c b/tests/drivers/timer/nrf_rtc_timer/src/main.c index 00393c8587d4..ebdb1c18a3f6 100644 --- a/tests/drivers/timer/nrf_rtc_timer/src/main.c +++ b/tests/drivers/timer/nrf_rtc_timer/src/main.c @@ -321,11 +321,7 @@ ZTEST(nrf_rtc_timer, test_resetting_cc) struct test_data test_data = { .target_time = now + 5, .window = 0, - /* For lower bit width, target_time may be equal to maximum counter value. - * In such case, due to PPI connection clearing the timer, counter value - * read in the handler may be slightly off the set counter value. - */ - .delay = (CONFIG_NRF_RTC_COUNTER_BIT_WIDTH < 24) ? 2 : 0, + .delay = 0, .err = -EINVAL }; @@ -365,11 +361,6 @@ static void overflow_sched_handler(int32_t id, uint64_t expire_time, */ ZTEST(nrf_rtc_timer, test_overflow) { - /* For bit width lower than default 24, overflow injection is not possible. */ - if (CONFIG_NRF_RTC_COUNTER_BIT_WIDTH < 24) { - ztest_test_skip(); - } - PRINT("RTC ticks before overflow injection: %u\r\n", (uint32_t)z_nrf_rtc_timer_read()); From d0ca9be341a48576ec7967c34f03badc4079beba Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:35 +0300 Subject: [PATCH 0994/2141] Revert "[nrf fromlist] soc: nordic: uicr: Populate UICR.VERSION field in gen_uicr.py" This reverts commit 7d913ca2a706b2f2a49e8c9e8c80178cf2ef0539. Signed-off-by: Jukka Rissanen --- soc/nordic/common/uicr/gen_uicr.py | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/soc/nordic/common/uicr/gen_uicr.py b/soc/nordic/common/uicr/gen_uicr.py index 5888786e928f..50f96eab566f 100644 --- a/soc/nordic/common/uicr/gen_uicr.py +++ b/soc/nordic/common/uicr/gen_uicr.py @@ -17,10 +17,6 @@ from elftools.elf.elffile import ELFFile from intelhex import IntelHex -# The UICR format version produced by this script -UICR_FORMAT_VERSION_MAJOR = 2 -UICR_FORMAT_VERSION_MINOR = 0 - # Name of the ELF section containing PERIPHCONF entries. # Must match the name used in the linker script. PERIPHCONF_SECTION = "uicr_periphconf_entry" @@ -49,14 +45,6 @@ class PeriphconfEntry(c.LittleEndianStructure): PERIPHCONF_ENTRY_SIZE = c.sizeof(PeriphconfEntry) -class Version(c.LittleEndianStructure): - _pack_ = 1 - _fields_ = [ - ("MINOR", c.c_uint16), - ("MAJOR", c.c_uint16), - ] - - class Approtect(c.LittleEndianStructure): _pack_ = 1 _fields_ = [ @@ -116,7 +104,7 @@ class Mpcconf(c.LittleEndianStructure): class Uicr(c.LittleEndianStructure): _pack_ = 1 _fields_ = [ - ("VERSION", Version), + ("VERSION", c.c_uint32), ("RESERVED", c.c_uint32), ("LOCK", c.c_uint32), ("RESERVED1", c.c_uint32), @@ -183,9 +171,6 @@ def main() -> None: init_values = DISABLED_VALUE.to_bytes(4, "little") * (c.sizeof(Uicr) // 4) uicr = Uicr.from_buffer_copy(init_values) - uicr.VERSION.MAJOR = UICR_FORMAT_VERSION_MAJOR - uicr.VERSION.MINOR = UICR_FORMAT_VERSION_MINOR - kconfig_str = args.in_config.read() kconfig = parse_kconfig(kconfig_str) From 826c073e167683077557a4b45a07fa143588d21f Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:35 +0300 Subject: [PATCH 0995/2141] Revert "[nrf fromtree] Bluetooth: Host: Use MTU min for l2cap test" This reverts commit 7de47337d2a38ff9e5221986072ce1e8c9f6aaaa. Signed-off-by: Jukka Rissanen --- tests/bsim/bluetooth/host/l2cap/many_conns/src/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/bsim/bluetooth/host/l2cap/many_conns/src/main.c b/tests/bsim/bluetooth/host/l2cap/many_conns/src/main.c index a4f45bc1890c..ff9f3030d1eb 100644 --- a/tests/bsim/bluetooth/host/l2cap/many_conns/src/main.c +++ b/tests/bsim/bluetooth/host/l2cap/many_conns/src/main.c @@ -29,7 +29,7 @@ DEFINE_FLAG_STATIC(flag_l2cap_connected); #define NUM_PERIPHERALS CONFIG_BT_MAX_CONN #define L2CAP_CHANS NUM_PERIPHERALS #define SDU_NUM 1 -#define SDU_LEN 23 +#define SDU_LEN 10 /* Only one SDU per link will be transmitted */ NET_BUF_POOL_DEFINE(sdu_tx_pool, From 754a4b793625ab15868785e863adca542941521d Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:35 +0300 Subject: [PATCH 0996/2141] Revert "[nrf fromtree] Bluetooth: Host: Add conn rsp param check" This reverts commit 4c976e3ff28fceec1203f5a86cd5399675795f0a. Signed-off-by: Jukka Rissanen --- include/zephyr/bluetooth/l2cap.h | 14 ------- subsys/bluetooth/host/l2cap.c | 52 +++++--------------------- subsys/bluetooth/host/l2cap_internal.h | 3 -- 3 files changed, 9 insertions(+), 60 deletions(-) diff --git a/include/zephyr/bluetooth/l2cap.h b/include/zephyr/bluetooth/l2cap.h index 380b52ad508d..f8781d791f01 100644 --- a/include/zephyr/bluetooth/l2cap.h +++ b/include/zephyr/bluetooth/l2cap.h @@ -111,20 +111,6 @@ extern "C" { */ #define BT_L2CAP_ECRED_MIN_MPS 64 -/** @brief L2CAP maximum MTU - * - * The maximum MTU for an L2CAP Based Connection. This is the same with or without ECRED. This - * requirement is taken from text in Core 3.A.4.22 and 3.A.4.26 v6.0. - */ -#define BT_L2CAP_MAX_MTU UINT16_MAX - -/** @brief L2CAP maximum MPS - * - * The maximum MPS for an L2CAP Based Connection. This is the same with or without ECRED. This - * requirement is taken from text in Core 3.A.4.22 and 3.A.4.26 v6.0. - */ -#define BT_L2CAP_MAX_MPS 65533 - /** @brief The maximum number of channels in ECRED L2CAP signaling PDUs * * Currently, this is the maximum number of channels referred to in the diff --git a/subsys/bluetooth/host/l2cap.c b/subsys/bluetooth/host/l2cap.c index caf5424717bc..9ecdc72c0aa7 100644 --- a/subsys/bluetooth/host/l2cap.c +++ b/subsys/bluetooth/host/l2cap.c @@ -1479,6 +1479,11 @@ static void le_conn_req(struct bt_l2cap *l2cap, uint8_t ident, LOG_DBG("psm 0x%02x scid 0x%04x mtu %u mps %u credits %u", psm, scid, mtu, mps, credits); + if (mtu < L2CAP_LE_MIN_MTU || mps < L2CAP_LE_MIN_MPS) { + LOG_ERR("Invalid LE-Conn Req params: mtu %u mps %u", mtu, mps); + return; + } + buf = l2cap_create_le_sig_pdu(BT_L2CAP_LE_CONN_RSP, ident, sizeof(*rsp)); if (!buf) { @@ -1488,16 +1493,6 @@ static void le_conn_req(struct bt_l2cap *l2cap, uint8_t ident, rsp = net_buf_add(buf, sizeof(*rsp)); (void)memset(rsp, 0, sizeof(*rsp)); - /* Validate parameters. Requirements are from Core Spec v6.0, Vol 3.A.4.22. Valid credit - * range is from 0 to UINT16_MAX, thus no credit validation is needed. - */ - if (!IN_RANGE(mtu, L2CAP_LE_MIN_MTU, BT_L2CAP_MAX_MTU) || - !IN_RANGE(mps, L2CAP_LE_MIN_MPS, BT_L2CAP_MAX_MPS)) { - LOG_ERR("Invalid le conn req params: mtu %u mps %u", mtu, mps); - result = BT_L2CAP_LE_ERR_UNACCEPT_PARAMS; - goto rsp; - } - /* Check if there is a server registered */ server = bt_l2cap_server_lookup_psm(psm); if (!server) { @@ -1583,12 +1578,8 @@ static void le_ecred_conn_req(struct bt_l2cap *l2cap, uint8_t ident, LOG_DBG("psm 0x%02x mtu %u mps %u credits %u", psm, mtu, mps, credits); - /* Validate parameters. Requirements are from Core Spec v6.0, Vol 3.A.4.25. */ - if (!IN_RANGE(mtu, BT_L2CAP_ECRED_MIN_MTU, BT_L2CAP_MAX_MTU) || - !IN_RANGE(mps, BT_L2CAP_ECRED_MIN_MPS, BT_L2CAP_MAX_MPS) || - !IN_RANGE(credits, BT_L2CAP_ECRED_CREDITS_MIN, BT_L2CAP_ECRED_CREDITS_MAX)) { - LOG_ERR("Invalid le ecred conn req params: mtu %u mps %u credits %u", mtu, mps, - credits); + if (mtu < BT_L2CAP_ECRED_MIN_MTU || mps < BT_L2CAP_ECRED_MIN_MPS) { + LOG_ERR("Invalid ecred conn req params. mtu %u mps %u", mtu, mps); result = BT_L2CAP_LE_ERR_INVALID_PARAMS; goto response; } @@ -1991,24 +1982,13 @@ static void le_ecred_conn_rsp(struct bt_l2cap *l2cap, uint8_t ident, LOG_DBG("dcid 0x%04x", dcid); - /* Validate parameters before assignment. Requirements are from Core Spec - * v6.0, Vol 3.A.4.26. If a Destination CID is 0x0000, the channel was not + /* If a Destination CID is 0x0000, the channel was not * established. */ - if (dcid == 0U) { + if (!dcid) { bt_l2cap_chan_remove(conn, &chan->chan); bt_l2cap_chan_del(&chan->chan); continue; - } else if (!L2CAP_LE_CID_IS_DYN(dcid) || - !IN_RANGE(mtu, BT_L2CAP_ECRED_MIN_MTU, BT_L2CAP_MAX_MTU) || - !IN_RANGE(mps, BT_L2CAP_ECRED_MIN_MPS, BT_L2CAP_MAX_MPS) || - !IN_RANGE(credits, BT_L2CAP_ECRED_CREDITS_MIN, - BT_L2CAP_ECRED_CREDITS_MAX)) { - LOG_WRN("Invalid ecred conn rsp params: dcid 0x%04x mtu %u mps %u " - "credits %u. Disconnecting.", - dcid, mtu, mps, credits); - bt_conn_disconnect(conn, BT_HCI_ERR_UNACCEPT_CONN_PARAM); - return; } c = bt_l2cap_le_lookup_tx_cid(conn, dcid); @@ -2106,20 +2086,6 @@ static void le_conn_rsp(struct bt_l2cap *l2cap, uint8_t ident, switch (result) { case BT_L2CAP_LE_SUCCESS: - /* Validate parameters on successful connection. Requirements are from Core Spec - * v6.0, Vol 3.A.4.23. Valid credit range is from 0 to UINT16_MAX, thus no credit - * validation is needed. - */ - if ((!L2CAP_LE_CID_IS_DYN(dcid) || - !IN_RANGE(mtu, L2CAP_LE_MIN_MTU, BT_L2CAP_MAX_MTU) || - !IN_RANGE(mps, L2CAP_LE_MIN_MPS, BT_L2CAP_MAX_MPS))) { - LOG_WRN("Invalid conn rsp params: dcid 0x%04x mtu %u mps %u. " - "Disconnecting.", - dcid, mtu, mps); - bt_conn_disconnect(conn, BT_HCI_ERR_UNACCEPT_CONN_PARAM); - return; - } - chan->tx.cid = dcid; chan->tx.mtu = mtu; chan->tx.mps = mps; diff --git a/subsys/bluetooth/host/l2cap_internal.h b/subsys/bluetooth/host/l2cap_internal.h index 61fa7416dd5d..07bd428334ae 100644 --- a/subsys/bluetooth/host/l2cap_internal.h +++ b/subsys/bluetooth/host/l2cap_internal.h @@ -125,9 +125,6 @@ struct bt_l2cap_le_credits { uint16_t credits; } __packed; -#define BT_L2CAP_ECRED_CREDITS_MIN 1 -#define BT_L2CAP_ECRED_CREDITS_MAX UINT16_MAX - #define BT_L2CAP_ECRED_CONN_REQ 0x17 struct bt_l2cap_ecred_conn_req { uint16_t psm; From 9d8b65369a7b59b1787bda6a9e9421ef4a24bbea Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:35 +0300 Subject: [PATCH 0997/2141] Revert "[nrf fromtree] Bluetooth: Host: Add l2cap credit param checks" This reverts commit b07b1bba4aec25dc602f00301a2a8ed72bc4b0de. Signed-off-by: Jukka Rissanen --- subsys/bluetooth/host/l2cap.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/subsys/bluetooth/host/l2cap.c b/subsys/bluetooth/host/l2cap.c index 9ecdc72c0aa7..ac3bd8eeb2b1 100644 --- a/subsys/bluetooth/host/l2cap.c +++ b/subsys/bluetooth/host/l2cap.c @@ -2158,17 +2158,6 @@ static void le_credits(struct bt_l2cap *l2cap, uint8_t ident, cid = sys_le16_to_cpu(ev->cid); credits = sys_le16_to_cpu(ev->credits); - if (!L2CAP_LE_CID_IS_DYN(cid)) { - LOG_WRN("Can't add credits to non-dynamic channel %p (cid 0x%04x)", &l2cap->chan, - cid); - return; - } - - if (credits == 0U) { - LOG_WRN("Ignoring zero credit packet"); - return; - } - LOG_DBG("cid 0x%04x credits %u", cid, credits); chan = bt_l2cap_le_lookup_tx_cid(conn, cid); From 4ad74248aa76da9877515d84449655e05e9c0c96 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:35 +0300 Subject: [PATCH 0998/2141] Revert "[nrf fromtree] Bluetooth: Host: l2cap: Fix MPS/MTU confusion" This reverts commit 01ec0ff5bd167631bc8078b88ac1767f9ac6d866. Signed-off-by: Jukka Rissanen --- subsys/bluetooth/host/l2cap.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/subsys/bluetooth/host/l2cap.c b/subsys/bluetooth/host/l2cap.c index ac3bd8eeb2b1..9fa5638d9617 100644 --- a/subsys/bluetooth/host/l2cap.c +++ b/subsys/bluetooth/host/l2cap.c @@ -46,7 +46,6 @@ LOG_MODULE_REGISTER(bt_l2cap, CONFIG_BT_L2CAP_LOG_LEVEL); #define CHAN_RX(_w) CONTAINER_OF(_w, struct bt_l2cap_le_chan, rx_work) #define L2CAP_LE_MIN_MTU 23 -#define L2CAP_LE_MIN_MPS 23 #define L2CAP_LE_MAX_CREDITS (BT_BUF_ACL_RX_COUNT - 1) @@ -1479,7 +1478,7 @@ static void le_conn_req(struct bt_l2cap *l2cap, uint8_t ident, LOG_DBG("psm 0x%02x scid 0x%04x mtu %u mps %u credits %u", psm, scid, mtu, mps, credits); - if (mtu < L2CAP_LE_MIN_MTU || mps < L2CAP_LE_MIN_MPS) { + if (mtu < L2CAP_LE_MIN_MTU || mps < L2CAP_LE_MIN_MTU) { LOG_ERR("Invalid LE-Conn Req params: mtu %u mps %u", mtu, mps); return; } @@ -1578,7 +1577,7 @@ static void le_ecred_conn_req(struct bt_l2cap *l2cap, uint8_t ident, LOG_DBG("psm 0x%02x mtu %u mps %u credits %u", psm, mtu, mps, credits); - if (mtu < BT_L2CAP_ECRED_MIN_MTU || mps < BT_L2CAP_ECRED_MIN_MPS) { + if (mtu < BT_L2CAP_ECRED_MIN_MTU || mps < BT_L2CAP_ECRED_MIN_MTU) { LOG_ERR("Invalid ecred conn req params. mtu %u mps %u", mtu, mps); result = BT_L2CAP_LE_ERR_INVALID_PARAMS; goto response; @@ -1686,7 +1685,7 @@ static void le_ecred_reconf_req(struct bt_l2cap *l2cap, uint8_t ident, mtu = sys_le16_to_cpu(req->mtu); mps = sys_le16_to_cpu(req->mps); - if (mps < BT_L2CAP_ECRED_MIN_MPS) { + if (mps < BT_L2CAP_ECRED_MIN_MTU) { result = BT_L2CAP_RECONF_OTHER_UNACCEPT; goto response; } From c7e501ddb359cd75f62e742fd3003b27d6732da9 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:36 +0300 Subject: [PATCH 0999/2141] Revert "[nrf fromtree] bluetooth: host: gatt: fix null-ptr access if no include-svc userdata" This reverts commit 57d8acee344a9fcc77116a02cee99624a548bf9a. Signed-off-by: Jukka Rissanen --- include/zephyr/bluetooth/gatt.h | 1 - subsys/bluetooth/host/gatt.c | 4 ---- 2 files changed, 5 deletions(-) diff --git a/include/zephyr/bluetooth/gatt.h b/include/zephyr/bluetooth/gatt.h index 2c7d36a67588..3597c7c5fdb1 100644 --- a/include/zephyr/bluetooth/gatt.h +++ b/include/zephyr/bluetooth/gatt.h @@ -918,7 +918,6 @@ ssize_t bt_gatt_attr_read_service(struct bt_conn *conn, * Read include service attribute value from local database storing the result * into buffer after encoding it. * @note Only use this with attributes which user_data is a ``bt_gatt_include``. - * The function returns EINVAL if @p attr or @p attr->user_data is NULL. * * @param conn Connection object. * @param attr Attribute to read. diff --git a/subsys/bluetooth/host/gatt.c b/subsys/bluetooth/host/gatt.c index be642fec9fe7..3092801554a1 100644 --- a/subsys/bluetooth/host/gatt.c +++ b/subsys/bluetooth/host/gatt.c @@ -1917,10 +1917,6 @@ ssize_t bt_gatt_attr_read_included(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, uint16_t len, uint16_t offset) { - if ((attr == NULL) || (attr->user_data == NULL)) { - return -EINVAL; - } - struct bt_gatt_attr *incl = attr->user_data; uint16_t handle = bt_gatt_attr_get_handle(incl); struct bt_uuid *uuid = incl->user_data; From 407550d60a8bc8bba5f12f22fce1d6c39d6bbc99 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:36 +0300 Subject: [PATCH 1000/2141] Revert "[nrf fromtree] Bluetooth: Host: Fix SMP Pairing failed code on invalid Public Key" This reverts commit 8720fcc41232657f771b09ec1627b1bbc279d471. Signed-off-by: Jukka Rissanen --- subsys/bluetooth/host/smp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/bluetooth/host/smp.c b/subsys/bluetooth/host/smp.c index ff920fb0f3a3..805b18f33c48 100644 --- a/subsys/bluetooth/host/smp.c +++ b/subsys/bluetooth/host/smp.c @@ -4499,7 +4499,7 @@ static uint8_t smp_public_key(struct bt_smp *smp, struct net_buf *buf) } } else if (!bt_pub_key_is_valid(smp->pkey)) { LOG_WRN("Received invalid public key"); - return BT_SMP_ERR_DHKEY_CHECK_FAILED; + return BT_SMP_ERR_INVALID_PARAMS; } if (IS_ENABLED(CONFIG_BT_CENTRAL) && From f2aded5f799802ec8e3acc1604bf0416dc731dd0 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:36 +0300 Subject: [PATCH 1001/2141] Revert "[nrf fromtree] Bluetooth: Host: Update LE legacy pairing check" This reverts commit 2c900ff71beb178c58b4d0f295e003bfbce94da8. Signed-off-by: Jukka Rissanen --- subsys/bluetooth/host/smp.c | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/subsys/bluetooth/host/smp.c b/subsys/bluetooth/host/smp.c index 805b18f33c48..916bb661bb98 100644 --- a/subsys/bluetooth/host/smp.c +++ b/subsys/bluetooth/host/smp.c @@ -2555,35 +2555,22 @@ static uint8_t legacy_pairing_req(struct bt_smp *smp) static uint8_t legacy_pairing_random(struct bt_smp *smp) { struct bt_conn *conn = smp->chan.chan.conn; - uint8_t tmp[16], cfm_i[16]; + uint8_t tmp[16]; int err; LOG_DBG(""); - /* calculate LP_CONFIRM_R */ + /* calculate confirmation */ err = smp_c1(smp->tk, smp->rrnd, smp->preq, smp->prsp, &conn->le.init_addr, &conn->le.resp_addr, tmp); if (err) { return BT_SMP_ERR_UNSPECIFIED; } - /* calculate LP_CONFIRM_I */ - err = smp_c1(smp->tk, smp->prnd, smp->preq, smp->prsp, - &conn->le.init_addr, &conn->le.resp_addr, cfm_i); - if (err) { - return BT_SMP_ERR_UNSPECIFIED; - } - LOG_DBG("pcnf %s", bt_hex(smp->pcnf, 16)); - LOG_DBG("cfm (remote) %s", bt_hex(tmp, 16)); - LOG_DBG("cfm (local) %s", bt_hex(cfm_i, 16)); + LOG_DBG("cfm %s", bt_hex(tmp, 16)); - /* Core Specification, Vol 3, Part H, section 2.3.5.5 (Errata ES-24491): If the computed - * LP_CONFIRM_R value is not equal to the received LP_CONFIRM_R value, or the received - * LP_CONFIRM_R value is equal to the LP_CONFIRM_I value, fail pairing. - */ - if (memcmp(smp->pcnf, tmp, sizeof(smp->pcnf)) || - !memcmp(smp->pcnf, cfm_i, sizeof(smp->pcnf))) { + if (memcmp(smp->pcnf, tmp, sizeof(smp->pcnf))) { return BT_SMP_ERR_CONFIRM_FAILED; } From c02ede7c9a72a2e2404fe3230e7ef44fda03af81 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:36 +0300 Subject: [PATCH 1002/2141] Revert "[nrf fromlist] drivers: nrf_wifi: Add check for minimum RX buffer size" This reverts commit 39a962774d40381bdd99f94f7efa14c102035434. Signed-off-by: Jukka Rissanen --- drivers/wifi/nrf_wifi/src/fmac_main.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/wifi/nrf_wifi/src/fmac_main.c b/drivers/wifi/nrf_wifi/src/fmac_main.c index 125ffd7a9a10..f2d9aa55af9f 100644 --- a/drivers/wifi/nrf_wifi/src/fmac_main.c +++ b/drivers/wifi/nrf_wifi/src/fmac_main.c @@ -79,8 +79,6 @@ BUILD_ASSERT(CONFIG_NRF70_TX_MAX_DATA_SIZE % 4 == 0, "TX buffer size must be a multiple of 4"); BUILD_ASSERT(CONFIG_NRF70_RX_MAX_DATA_SIZE % 4 == 0, "RX buffer size must be a multiple of 4"); -BUILD_ASSERT(CONFIG_NRF70_RX_MAX_DATA_SIZE >= 400, - "RX buffer size must be at least 400 bytes"); static const unsigned char aggregation = 1; static const unsigned char max_num_tx_agg_sessions = 4; From facf3078bd1652d6243a474ec2fac1ee5c8b7bbb Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:36 +0300 Subject: [PATCH 1003/2141] Revert "[nrf fromtree] net: l2: wifi: Fix the default keepalive value" This reverts commit 8277731e86e2d7bab82d1ac72c8419c583a7bf3b. Signed-off-by: Jukka Rissanen --- subsys/net/l2/wifi/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/l2/wifi/Kconfig b/subsys/net/l2/wifi/Kconfig index 49d061c7439c..7728678cc979 100644 --- a/subsys/net/l2/wifi/Kconfig +++ b/subsys/net/l2/wifi/Kconfig @@ -158,7 +158,7 @@ endif # WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE config WIFI_MGMT_BSS_MAX_IDLE_TIME int "BSS max idle timeout in seconds" range 0 64000 - default 300 + default 30 help As per 802.11-2020: 11.21.13 BSS max idle period management If dot11WirelessManagementImplemented is true, dot11BSSMaxIdlePeriod is From 34ce09a13171551bc01eab8a320df10d6acd495a Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:36 +0300 Subject: [PATCH 1004/2141] Revert "[nrf fromtree] net: l2: wifi: Configure BSS max idle period" This reverts commit 9c45c9847cf12b71026a1241dfc06bf52da3f1a9. Signed-off-by: Jukka Rissanen --- drivers/wifi/nrf_wifi/inc/fmac_main.h | 1 - drivers/wifi/nrf_wifi/inc/wifi_mgmt.h | 3 -- drivers/wifi/nrf_wifi/src/fmac_main.c | 4 -- drivers/wifi/nrf_wifi/src/wifi_mgmt.c | 53 ------------------------- drivers/wifi/nrf_wifi/src/wpa_supp_if.c | 6 +-- include/zephyr/net/wifi_mgmt.h | 16 -------- modules/hostap/src/supp_api.c | 13 ------ modules/hostap/src/supp_api.h | 8 ---- modules/hostap/src/supp_main.c | 1 - subsys/net/l2/wifi/Kconfig | 16 -------- subsys/net/l2/wifi/wifi_mgmt.c | 25 ------------ subsys/net/l2/wifi/wifi_shell.c | 32 --------------- 12 files changed, 2 insertions(+), 176 deletions(-) diff --git a/drivers/wifi/nrf_wifi/inc/fmac_main.h b/drivers/wifi/nrf_wifi/inc/fmac_main.h index 7a863d8b614a..c193515ae2dd 100644 --- a/drivers/wifi/nrf_wifi/inc/fmac_main.h +++ b/drivers/wifi/nrf_wifi/inc/fmac_main.h @@ -91,7 +91,6 @@ struct nrf_wifi_vif_ctx_zep { struct k_work_delayable nrf_wifi_rpu_recovery_bringup_work; #endif /* CONFIG_NRF_WIFI_RPU_RECOVERY */ int rts_threshold_value; - unsigned short bss_max_idle_period; }; struct nrf_wifi_vif_ctx_map { diff --git a/drivers/wifi/nrf_wifi/inc/wifi_mgmt.h b/drivers/wifi/nrf_wifi/inc/wifi_mgmt.h index 9b84427cdca4..a4ae20302100 100644 --- a/drivers/wifi/nrf_wifi/inc/wifi_mgmt.h +++ b/drivers/wifi/nrf_wifi/inc/wifi_mgmt.h @@ -77,7 +77,4 @@ int nrf_wifi_set_rts_threshold(const struct device *dev, int nrf_wifi_get_rts_threshold(const struct device *dev, unsigned int *rts_threshold); - -int nrf_wifi_set_bss_max_idle_period(const struct device *dev, - unsigned short bss_max_idle_period); #endif /* __ZEPHYR_WIFI_MGMT_H__ */ diff --git a/drivers/wifi/nrf_wifi/src/fmac_main.c b/drivers/wifi/nrf_wifi/src/fmac_main.c index f2d9aa55af9f..379c3242b182 100644 --- a/drivers/wifi/nrf_wifi/src/fmac_main.c +++ b/drivers/wifi/nrf_wifi/src/fmac_main.c @@ -858,9 +858,6 @@ static int nrf_wifi_drv_main_zep(const struct device *dev) #endif /* CONFIG_NRF70_RADIO_TEST */ k_mutex_init(&rpu_drv_priv_zep.rpu_ctx_zep.rpu_lock); -#ifndef CONFIG_NRF70_RADIO_TEST - vif_ctx_zep->bss_max_idle_period = USHRT_MAX; -#endif /* !CONFIG_NRF70_RADIO_TEST */ return 0; #ifdef CONFIG_NRF70_RADIO_TEST fmac_deinit: @@ -888,7 +885,6 @@ static const struct wifi_mgmt_ops nrf_wifi_mgmt_ops = { .get_power_save_config = nrf_wifi_get_power_save_config, .set_rts_threshold = nrf_wifi_set_rts_threshold, .get_rts_threshold = nrf_wifi_get_rts_threshold, - .set_bss_max_idle_period = nrf_wifi_set_bss_max_idle_period, #endif #ifdef CONFIG_NRF70_SYSTEM_WITH_RAW_MODES .mode = nrf_wifi_mode, diff --git a/drivers/wifi/nrf_wifi/src/wifi_mgmt.c b/drivers/wifi/nrf_wifi/src/wifi_mgmt.c index e9755e80013e..a323faf21dd6 100644 --- a/drivers/wifi/nrf_wifi/src/wifi_mgmt.c +++ b/drivers/wifi/nrf_wifi/src/wifi_mgmt.c @@ -1077,56 +1077,3 @@ int nrf_wifi_get_rts_threshold(const struct device *dev, return ret; } - -int nrf_wifi_set_bss_max_idle_period(const struct device *dev, - unsigned short bss_max_idle_period) -{ - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - int ret = -1; - - if (!dev) { - LOG_ERR("%s: dev is NULL", __func__); - return ret; - } - - vif_ctx_zep = dev->data; - - if (!vif_ctx_zep) { - LOG_ERR("%s: vif_ctx_zep is NULL", __func__); - return ret; - } - - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - - if (!rpu_ctx_zep) { - LOG_ERR("%s: rpu_ctx_zep is NULL", __func__); - return ret; - } - - - if (!rpu_ctx_zep->rpu_ctx) { - LOG_ERR("%s: RPU context not initialized", __func__); - return ret; - } - - if (((int)bss_max_idle_period < 0) || - (bss_max_idle_period > 64000)) { - /* 0 or value less than 64000 is passed to f/w. - * All other values considered as invalid. - */ - LOG_ERR("%s: Invalid max_idle_period value : %d", - __func__, (int)bss_max_idle_period); - return ret; - } - - k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); - - vif_ctx_zep->bss_max_idle_period = bss_max_idle_period; - - ret = 0; - - k_mutex_unlock(&vif_ctx_zep->vif_lock); - - return ret; -} diff --git a/drivers/wifi/nrf_wifi/src/wpa_supp_if.c b/drivers/wifi/nrf_wifi/src/wpa_supp_if.c index 21f7600ca80a..34af00e6d388 100644 --- a/drivers/wifi/nrf_wifi/src/wpa_supp_if.c +++ b/drivers/wifi/nrf_wifi/src/wpa_supp_if.c @@ -931,10 +931,8 @@ int nrf_wifi_wpa_supp_associate(void *if_priv, struct wpa_driver_associate_param assoc_info.use_mfp = NRF_WIFI_MFP_REQUIRED; } - if (vif_ctx_zep->bss_max_idle_period == USHRT_MAX) { - assoc_info.bss_max_idle_time = CONFIG_WIFI_MGMT_BSS_MAX_IDLE_TIME; - } else { - assoc_info.bss_max_idle_time = vif_ctx_zep->bss_max_idle_period; + if (params->bss_max_idle_period) { + assoc_info.bss_max_idle_time = params->bss_max_idle_period; } assoc_info.conn_type = NRF_WIFI_CONN_TYPE_OPEN; diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index 4232a88d9556..2c895afb36d0 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -133,8 +133,6 @@ enum net_request_wifi_cmd { NET_REQUEST_WIFI_CMD_CANDIDATE_SCAN, /** AP WPS config */ NET_REQUEST_WIFI_CMD_AP_WPS_CONFIG, - /** Configure BSS maximum idle period */ - NET_REQUEST_WIFI_CMD_BSS_MAX_IDLE_PERIOD, /** @cond INTERNAL_HIDDEN */ NET_REQUEST_WIFI_CMD_MAX /** @endcond */ @@ -319,11 +317,6 @@ NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_START_ROAMING); NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_NEIGHBOR_REP_COMPLETE); -#define NET_REQUEST_WIFI_BSS_MAX_IDLE_PERIOD \ - (NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_BSS_MAX_IDLE_PERIOD) - -NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_BSS_MAX_IDLE_PERIOD); - /** @cond INTERNAL_HIDDEN */ enum { @@ -1595,15 +1588,6 @@ struct wifi_mgmt_ops { * @return 0 if ok, < 0 if error */ int (*start_11r_roaming)(const struct device *dev); - /** Set BSS max idle period - * - * @param dev Pointer to the device structure for the driver instance. - * @param BSS max idle period value - * - * @return 0 if ok, < 0 if error - */ - int (*set_bss_max_idle_period)(const struct device *dev, - unsigned short bss_max_idle_period); }; /** Wi-Fi management offload API */ diff --git a/modules/hostap/src/supp_api.c b/modules/hostap/src/supp_api.c index 3679808b3d4b..cde1ef95f478 100644 --- a/modules/hostap/src/supp_api.c +++ b/modules/hostap/src/supp_api.c @@ -1811,19 +1811,6 @@ int supplicant_legacy_roam(const struct device *dev) return ret; } -int supplicant_set_bss_max_idle_period(const struct device *dev, - unsigned short bss_max_idle_period) -{ - const struct wifi_mgmt_ops *const wifi_mgmt_api = get_wifi_mgmt_api(dev); - - if (!wifi_mgmt_api || !wifi_mgmt_api->set_bss_max_idle_period) { - wpa_printf(MSG_ERROR, "set_bss_max_idle_period is not supported"); - return -ENOTSUP; - } - - return wifi_mgmt_api->set_bss_max_idle_period(dev, bss_max_idle_period); -} - #ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_WNM int supplicant_btm_query(const struct device *dev, uint8_t reason) { diff --git a/modules/hostap/src/supp_api.h b/modules/hostap/src/supp_api.h index 9d2b90b50fe0..ddd3c3d66988 100644 --- a/modules/hostap/src/supp_api.h +++ b/modules/hostap/src/supp_api.h @@ -305,14 +305,6 @@ int supplicant_get_wifi_conn_params(const struct device *dev, */ int supplicant_wps_config(const struct device *dev, struct wifi_wps_config_params *params); -/** @ Set Wi-Fi max idle period - * - * @param dev Wi-Fi interface handle to use - * @param bss_max_idle_period Maximum idle period to set - * @return 0 for OK; -1 for ERROR - */ -int supplicant_set_bss_max_idle_period(const struct device *dev, - unsigned short bss_max_idle_period); #ifdef CONFIG_AP int set_ap_bandwidth(const struct device *dev, enum wifi_frequency_bandwidths bandwidth); diff --git a/modules/hostap/src/supp_main.c b/modules/hostap/src/supp_main.c index 9336cb2bf747..4549ab3160d2 100644 --- a/modules/hostap/src/supp_main.c +++ b/modules/hostap/src/supp_main.c @@ -83,7 +83,6 @@ static const struct wifi_mgmt_ops mgmt_ops = { #endif .get_conn_params = supplicant_get_wifi_conn_params, .wps_config = supplicant_wps_config, - .set_bss_max_idle_period = supplicant_set_bss_max_idle_period, #ifdef CONFIG_AP .ap_enable = supplicant_ap_enable, .ap_disable = supplicant_ap_disable, diff --git a/subsys/net/l2/wifi/Kconfig b/subsys/net/l2/wifi/Kconfig index 7728678cc979..4b1d309066c3 100644 --- a/subsys/net/l2/wifi/Kconfig +++ b/subsys/net/l2/wifi/Kconfig @@ -154,19 +154,3 @@ config HEAP_MEM_POOL_ADD_SIZE_WIFI_CERT endif # WIFI_SHELL_RUNTIME_CERTIFICATES endif # WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE - -config WIFI_MGMT_BSS_MAX_IDLE_TIME - int "BSS max idle timeout in seconds" - range 0 64000 - default 30 - help - As per 802.11-2020: 11.21.13 BSS max idle period management - If dot11WirelessManagementImplemented is true, dot11BSSMaxIdlePeriod is - nonzero and dot11BSSMaxIdlePeriodIndicationByNonAPSTA is true, then a - non-S1G non-AP STA shall include a BSS Max Idle Period element - in the (Re)Association Request frame. If the BSS Max Idle Period - element is present in the (Re)Association Request frame received - by a non-S1G AP that has dot11BSSMaxIdlePeriodIndicationByNonAPSTA - equal to true, then the non-S1G AP may choose the non-AP STA’s - preferred maximum idle period. The non-S1G AP indicates its chosen - value to the non-S1G STA in the (Re)Association Response frame. diff --git a/subsys/net/l2/wifi/wifi_mgmt.c b/subsys/net/l2/wifi/wifi_mgmt.c index f16f2581374f..0183faab1d50 100644 --- a/subsys/net/l2/wifi/wifi_mgmt.c +++ b/subsys/net/l2/wifi/wifi_mgmt.c @@ -1403,31 +1403,6 @@ static int wifi_set_enterprise_creds(uint64_t mgmt_request, struct net_if *iface NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_ENTERPRISE_CREDS, wifi_set_enterprise_creds); #endif -static int wifi_set_bss_max_idle_period(uint64_t mgmt_request, struct net_if *iface, - void *data, size_t len) -{ - const struct device *dev = net_if_get_device(iface); - const struct wifi_mgmt_ops *const wifi_mgmt_api = get_wifi_api(iface); - unsigned short *bss_max_idle_period = data; - - if (wifi_mgmt_api == NULL || wifi_mgmt_api->set_bss_max_idle_period == NULL) { - return -ENOTSUP; - } - - if (!net_if_is_admin_up(iface)) { - return -ENETDOWN; - } - - if (!data || len != sizeof(*bss_max_idle_period)) { - return -EINVAL; - } - - return wifi_mgmt_api->set_bss_max_idle_period(dev, *bss_max_idle_period); -} - -NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_BSS_MAX_IDLE_PERIOD, - wifi_set_bss_max_idle_period); - #ifdef CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS void wifi_mgmt_raise_raw_scan_result_event(struct net_if *iface, struct wifi_raw_scan_result *raw_scan_result) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index b23d407da641..8a5468ba81b1 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -3455,32 +3455,6 @@ static int cmd_wifi_pmksa_flush(const struct shell *sh, size_t argc, char *argv[ return 0; } - -static int cmd_wifi_set_bss_max_idle_period(const struct shell *sh, size_t argc, char *argv[]) -{ - struct net_if *iface = get_iface(IFACE_TYPE_STA, argc, argv); - unsigned short bss_max_idle_period = 0; - int idx = 1; - unsigned long val = 0; - - if (!parse_number(sh, &val, argv[idx++], "bss_max_idle_period", 0, USHRT_MAX)) { - return -EINVAL; - } - - bss_max_idle_period = (unsigned short)val; - - if (net_mgmt(NET_REQUEST_WIFI_BSS_MAX_IDLE_PERIOD, iface, - &bss_max_idle_period, sizeof(bss_max_idle_period))) { - shell_fprintf(sh, SHELL_WARNING, - "Setting BSS maximum idle period failed.\n"); - return -ENOEXEC; - } - - shell_fprintf(sh, SHELL_NORMAL, "BSS max idle period: %hu\n", bss_max_idle_period); - - return 0; -} - SHELL_STATIC_SUBCMD_SET_CREATE( wifi_cmd_ap, SHELL_CMD_ARG(disable, NULL, "Disable Access Point mode.\n" @@ -3956,12 +3930,6 @@ SHELL_SUBCMD_ADD((wifi), ps_exit_strategy, NULL, cmd_wifi_ps_exit_strategy, 2, 2); -SHELL_SUBCMD_ADD((wifi), bss_max_idle_period, NULL, - ".\n" - "[-i, --iface=] : Interface index.\n", - cmd_wifi_set_bss_max_idle_period, - 2, 2); - SHELL_CMD_REGISTER(wifi, &wifi_commands, "Wi-Fi commands", NULL); static int wifi_shell_init(void) From 77b56f6965cda38bbaac673dfcb6e308d5c7db39 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:36 +0300 Subject: [PATCH 1005/2141] Revert "[nrf fromtree] net: events: Add missing net_mgmt.h include" This reverts commit 2cf4a21ae0008f40c499943e9ba7ec794ab0385b. Signed-off-by: Jukka Rissanen --- include/zephyr/net/net_event.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/zephyr/net/net_event.h b/include/zephyr/net/net_event.h index 556a78ae99e9..3a948ca5ef96 100644 --- a/include/zephyr/net/net_event.h +++ b/include/zephyr/net/net_event.h @@ -13,7 +13,6 @@ #define ZEPHYR_INCLUDE_NET_NET_EVENT_H_ #include -#include #include #ifdef __cplusplus From 8fb5c44a7d4d3c34a8ba5dc67029521a6ce02716 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:36 +0300 Subject: [PATCH 1006/2141] Revert "[nrf fromtree] net: ppp: stats: Fix net_mgmt request handler format" This reverts commit 22479b9c1f1d4915b4adc2bec36021f2e86f7c9b. Signed-off-by: Jukka Rissanen --- subsys/net/l2/ppp/ppp_stats.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/l2/ppp/ppp_stats.c b/subsys/net/l2/ppp/ppp_stats.c index ee831b3953da..9dafef154b30 100644 --- a/subsys/net/l2/ppp/ppp_stats.c +++ b/subsys/net/l2/ppp/ppp_stats.c @@ -17,7 +17,7 @@ LOG_MODULE_REGISTER(net_ppp_stats, CONFIG_NET_L2_PPP_LOG_LEVEL); #if defined(CONFIG_NET_STATISTICS_USER_API) -static int ppp_stats_get(uint64_t mgmt_request, struct net_if *iface, +static int ppp_stats_get(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { size_t len_chk = 0; From 812f753045b21b4ad26752c41f82c39f20de43a7 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:36 +0300 Subject: [PATCH 1007/2141] Revert "[nrf fromtree] net: mgmt: Increment API major version number" This reverts commit f5093d3789c7b9fd38ab1c17d62a74854c5d70c6. Signed-off-by: Jukka Rissanen --- include/zephyr/net/net_mgmt.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/zephyr/net/net_mgmt.h b/include/zephyr/net/net_mgmt.h index 1c5f0aebeaa9..9c559b7fd8b9 100644 --- a/include/zephyr/net/net_mgmt.h +++ b/include/zephyr/net/net_mgmt.h @@ -24,7 +24,7 @@ extern "C" { * @brief Network Management * @defgroup net_mgmt Network Management * @since 1.7 - * @version 2.0.0 + * @version 1.0.0 * @ingroup networking * @{ */ From 660e349011b9d83d863feb3537363a52cef347ab Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:36 +0300 Subject: [PATCH 1008/2141] Revert "[nrf fromtree] doc: migration: 4.2: Add information about net_mgmt API changes" This reverts commit 2b89705e9b89a5779bcdccfe853d2c0d08074a16. Signed-off-by: Jukka Rissanen --- doc/releases/migration-guide-4.2.rst | 15 --------------- doc/releases/release-notes-4.2.rst | 7 ------- 2 files changed, 22 deletions(-) diff --git a/doc/releases/migration-guide-4.2.rst b/doc/releases/migration-guide-4.2.rst index 9b31f4a16348..08a2a3d0e33d 100644 --- a/doc/releases/migration-guide-4.2.rst +++ b/doc/releases/migration-guide-4.2.rst @@ -509,21 +509,6 @@ Networking need to update their response callback implementations. To retain current behavior, simply return 0 from the callback. -* The API signature of ``net_mgmt`` event handler :c:type:`net_mgmt_event_handler_t` and - request handler :c:type:`net_mgmt_request_handler_t` has changed. The management event - type is changed from ``uint32_t`` to ``uint64_t``. The change allows event number values - to be bit masks instead of enum values. The layer code still stays as a enum value. - The :c:macro:`NET_MGMT_LAYER_CODE` and :c:macro:`NET_MGMT_GET_COMMAND` can be used to get - the layer code and management event command from the actual event value in the request or - event handlers if needed. - -* The socket options for ``net_mgmt`` type sockets cannot directly be network management - event types as those are now ``uint64_t`` and the socket option expects a normal 32 bit - integer value. Because of this, a new ``SO_NET_MGMT_ETHERNET_SET_QAV_PARAM`` - and ``SO_NET_MGMT_ETHERNET_GET_QAV_PARAM`` socket options are created that will replace - the previously used ``NET_REQUEST_ETHERNET_GET_QAV_PARAM`` and - ``NET_REQUEST_ETHERNET_GET_QAV_PARAM`` options. - OpenThread ========== diff --git a/doc/releases/release-notes-4.2.rst b/doc/releases/release-notes-4.2.rst index 80e0f5868def..00c655568802 100644 --- a/doc/releases/release-notes-4.2.rst +++ b/doc/releases/release-notes-4.2.rst @@ -111,13 +111,6 @@ Deprecated APIs and options was deprecated since Zephyr 4.0, and users were advised to migrate to alternative crypto backends. -Stable API changes in this release -================================== - -* The API signature of ``net_mgmt`` event handler :c:type:`net_mgmt_event_handler_t` - and request handler :c:type:`net_mgmt_request_handler_t` has changed. The event value - type is changed from ``uint32_t`` to ``uint64_t``. - New APIs and options ==================== From 1b33bb437a30a973e8848d33387f26f7143f041f Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:36 +0300 Subject: [PATCH 1009/2141] Revert "[nrf fromtree] net: socket: mgmt: Create proper socket options for net_mgmt sockets" This reverts commit 664e66c32f9ff1dc86a0fed3fea82b55cce36bfa. Signed-off-by: Jukka Rissanen --- include/zephyr/net/socket_net_mgmt.h | 13 ------------- subsys/net/lib/sockets/sockets_net_mgmt.c | 4 ++-- tests/net/socket/net_mgmt/src/main.c | 21 ++++----------------- 3 files changed, 6 insertions(+), 32 deletions(-) diff --git a/include/zephyr/net/socket_net_mgmt.h b/include/zephyr/net/socket_net_mgmt.h index 595a92bbad93..337648d5d188 100644 --- a/include/zephyr/net/socket_net_mgmt.h +++ b/include/zephyr/net/socket_net_mgmt.h @@ -42,19 +42,6 @@ extern "C" { /** @endcond */ -/** - * @name Socket options for NET_MGMT sockets - * @{ - */ - -/** Set Ethernet Qav parameters */ -#define SO_NET_MGMT_ETHERNET_SET_QAV_PARAM 1 - -/** Get Ethernet Qav parameters */ -#define SO_NET_MGMT_ETHERNET_GET_QAV_PARAM 2 - -/** @} */ /* for @name */ - /** * struct sockaddr_nm - The sockaddr structure for NET_MGMT sockets * diff --git a/subsys/net/lib/sockets/sockets_net_mgmt.c b/subsys/net/lib/sockets/sockets_net_mgmt.c index dcb4194ec85d..0b45416c1f2d 100644 --- a/subsys/net/lib/sockets/sockets_net_mgmt.c +++ b/subsys/net/lib/sockets/sockets_net_mgmt.c @@ -237,7 +237,7 @@ static int znet_mgmt_getsockopt(struct net_mgmt_socket *mgmt, int level, } if (IS_ENABLED(CONFIG_NET_L2_ETHERNET_MGMT)) { - if (optname == SO_NET_MGMT_ETHERNET_GET_QAV_PARAM) { + if (optname == NET_REQUEST_ETHERNET_GET_QAV_PARAM) { int ret; ret = net_mgmt(NET_REQUEST_ETHERNET_GET_QAV_PARAM, @@ -274,7 +274,7 @@ static int znet_mgmt_setsockopt(struct net_mgmt_socket *mgmt, int level, } if (IS_ENABLED(CONFIG_NET_L2_ETHERNET_MGMT)) { - if (optname == SO_NET_MGMT_ETHERNET_SET_QAV_PARAM) { + if (optname == NET_REQUEST_ETHERNET_SET_QAV_PARAM) { int ret; ret = net_mgmt(NET_REQUEST_ETHERNET_SET_QAV_PARAM, diff --git a/tests/net/socket/net_mgmt/src/main.c b/tests/net/socket/net_mgmt/src/main.c index 89901beda7b2..a5d6ead46793 100644 --- a/tests/net/socket/net_mgmt/src/main.c +++ b/tests/net/socket/net_mgmt/src/main.c @@ -20,19 +20,6 @@ LOG_MODULE_REGISTER(net_test, CONFIG_NET_SOCKETS_LOG_LEVEL); #define STACK_SIZE 1024 #define THREAD_PRIORITY K_PRIO_COOP(8) -/* Use a base value for socket options that are not implemented. - * This is used to check if the socket option is implemented or not. - */ -#define NOT_IMPLEMENTED_SOCKET_OPTION_BASE (INT32_MAX - 1000) - -#if !defined(SO_NET_MGMT_ETHERNET_GET_PRIORITY_QUEUES_NUM) -#define SO_NET_MGMT_ETHERNET_GET_PRIORITY_QUEUES_NUM (NOT_IMPLEMENTED_SOCKET_OPTION_BASE + 1) -#endif /* !defined(SO_NET_MGMT_ETHERNET_GET_PRIORITY_QUEUES_NUM) */ - -#if !defined(SO_NET_MGMT_ETHERNET_SET_MAC_ADDRESS) -#define SO_NET_MGMT_ETHERNET_SET_MAC_ADDRESS (NOT_IMPLEMENTED_SOCKET_OPTION_BASE + 2) -#endif /* !defined(SO_NET_MGMT_ETHERNET_SET_MAC_ADDRESS) */ - static struct net_if *default_iface; static ZTEST_BMEM int fd; @@ -515,7 +502,7 @@ static void test_ethernet_set_qav(void) params.qav_param.enabled = true; ret = zsock_setsockopt(fd, SOL_NET_MGMT_RAW, - SO_NET_MGMT_ETHERNET_SET_QAV_PARAM, + NET_REQUEST_ETHERNET_SET_QAV_PARAM, ¶ms, sizeof(params)); zassert_equal(ret, 0, "Cannot set Qav parameters"); } @@ -542,7 +529,7 @@ static void test_ethernet_get_qav(void) params.qav_param.type = ETHERNET_QAV_PARAM_TYPE_STATUS; ret = zsock_getsockopt(fd, SOL_NET_MGMT_RAW, - SO_NET_MGMT_ETHERNET_GET_QAV_PARAM, + NET_REQUEST_ETHERNET_GET_QAV_PARAM, ¶ms, &optlen); zassert_equal(ret, 0, "Cannot get Qav parameters (%d)", ret); zassert_equal(optlen, sizeof(params), "Invalid optlen (%d)", optlen); @@ -569,7 +556,7 @@ static void test_ethernet_get_unknown_option(void) memset(¶ms, 0, sizeof(params)); ret = zsock_getsockopt(fd, SOL_NET_MGMT_RAW, - SO_NET_MGMT_ETHERNET_GET_PRIORITY_QUEUES_NUM, + NET_REQUEST_ETHERNET_GET_PRIORITY_QUEUES_NUM, ¶ms, &optlen); zassert_equal(ret, -1, "Could get prio queue parameters (%d)", errno); zassert_equal(errno, EINVAL, "prio queue get parameters"); @@ -594,7 +581,7 @@ static void test_ethernet_set_unknown_option(void) memset(¶ms, 0, sizeof(params)); ret = zsock_setsockopt(fd, SOL_NET_MGMT_RAW, - SO_NET_MGMT_ETHERNET_SET_MAC_ADDRESS, + NET_REQUEST_ETHERNET_SET_MAC_ADDRESS, ¶ms, optlen); zassert_equal(ret, -1, "Could set promisc_mode parameters (%d)", errno); zassert_equal(errno, EINVAL, "promisc_mode set parameters"); From a78ae21de94e307003994a3a2fd4ec71d9b6ee9d Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:36 +0300 Subject: [PATCH 1010/2141] Revert "[nrf fromtree] net: mgmt: Convert the mgmt API to use 64-bit masks" This reverts commit 8b3dda735e1b57360d80423698f4897c7a790c8b. Signed-off-by: Jukka Rissanen --- .../networking/api/coap_server.rst | 2 +- doc/connectivity/networking/api/net_mgmt.rst | 6 +- drivers/modem/modem_cellular.c | 2 +- drivers/wifi/esp32/src/esp_wifi_drv.c | 2 +- include/zephyr/net/coap_mgmt.h | 20 +- include/zephyr/net/conn_mgr_connectivity.h | 14 +- include/zephyr/net/ethernet_mgmt.h | 20 +- include/zephyr/net/ieee802154_mgmt.h | 11 +- include/zephyr/net/net_event.h | 245 ++++++------------ include/zephyr/net/net_mgmt.h | 85 +++--- include/zephyr/net/ppp.h | 20 +- include/zephyr/net/socket_net_mgmt.h | 2 +- include/zephyr/net/wifi_mgmt.h | 63 ++--- modules/hostap/src/supp_events.h | 27 +- modules/hostap/src/supp_main.c | 4 +- samples/boards/nxp/s32/netc/src/main.c | 2 +- samples/net/capture/src/main.c | 4 +- samples/net/cloud/mqtt_azure/src/main.c | 2 +- samples/net/cloud/tagoio_http_post/src/wifi.c | 2 +- samples/net/common/net_sample_common.c | 2 +- samples/net/dhcpv4_client/src/main.c | 2 +- samples/net/dns_resolve/src/main.c | 2 +- samples/net/dsa/src/main.c | 2 +- samples/net/ipv4_autoconf/src/main.c | 2 +- samples/net/lwm2m_client/src/lwm2m-client.c | 4 +- samples/net/mqtt_sn_publisher/src/main.c | 2 +- .../secure_mqtt_sensor_actuator/src/main.c | 2 +- samples/net/sockets/coap_download/src/main.c | 2 +- samples/net/sockets/coap_server/src/events.c | 2 +- .../sockets/dumb_http_server_mt/src/main.c | 2 +- .../net/sockets/echo_client/src/echo-client.c | 4 +- .../net/sockets/echo_server/src/echo-server.c | 2 +- samples/net/sockets/packet/src/packet.c | 2 +- samples/net/sockets/txtime/src/main.c | 2 +- samples/net/wifi/apsta_mode/src/main.c | 2 +- samples/subsys/mgmt/updatehub/src/main.c | 2 +- subsys/logging/backends/log_backend_net.c | 2 +- subsys/mgmt/mcumgr/transport/src/smp_udp.c | 2 +- subsys/net/conn_mgr/conn_mgr_connectivity.c | 4 +- subsys/net/conn_mgr/events_handler.c | 16 +- subsys/net/ip/ipv4_autoconf.c | 2 +- subsys/net/ip/ipv6_pe.c | 2 +- subsys/net/ip/net_mgmt.c | 36 +-- subsys/net/ip/net_stats.c | 2 +- subsys/net/ip/pmtu.c | 1 + subsys/net/l2/ethernet/arp.c | 4 +- subsys/net/l2/ethernet/ethernet_mgmt.c | 4 +- subsys/net/l2/ethernet/ethernet_stats.c | 2 +- subsys/net/l2/ethernet/lldp/lldp.c | 4 +- subsys/net/l2/ieee802154/ieee802154_mgmt.c | 18 +- subsys/net/l2/ieee802154/ieee802154_shell.c | 4 +- subsys/net/l2/openthread/openthread.c | 2 +- subsys/net/l2/ppp/ppp_l2.c | 2 +- subsys/net/l2/virtual/virtual_mgmt.c | 4 +- subsys/net/l2/wifi/wifi_mgmt.c | 66 ++--- subsys/net/l2/wifi/wifi_shell.c | 4 +- subsys/net/lib/coap/coap.c | 2 +- subsys/net/lib/coap/coap_server.c | 2 +- subsys/net/lib/config/init.c | 26 +- subsys/net/lib/config/init_clock_sntp.c | 2 +- subsys/net/lib/dhcpv4/dhcpv4.c | 4 +- subsys/net/lib/dhcpv6/dhcpv6.c | 2 +- subsys/net/lib/dns/llmnr_responder.c | 2 +- subsys/net/lib/dns/mdns_responder.c | 8 +- subsys/net/lib/ptp/port.c | 2 +- subsys/net/lib/shell/events.c | 6 +- subsys/net/lib/sockets/sockets_net_mgmt.c | 4 +- subsys/shell/backends/shell_mqtt.c | 2 +- tests/boards/espressif/ethernet/src/main.c | 2 +- tests/boards/espressif/wifi/src/main.c | 2 +- tests/net/conn_mgr_conn/src/main.c | 2 +- tests/net/conn_mgr_monitor/src/main.c | 18 +- tests/net/conn_mgr_nsos/src/main.c | 2 +- tests/net/dhcpv4/client/prj.conf | 3 - tests/net/dhcpv4/client/src/main.c | 4 +- tests/net/dhcpv6/src/main.c | 2 +- tests/net/hostname/src/main.c | 2 +- .../ieee802154/l2/src/ieee802154_shell_test.c | 2 +- tests/net/igmp/src/main.c | 6 +- tests/net/lib/dns_addremove/src/main.c | 2 +- tests/net/mgmt/src/mgmt.c | 43 ++- tests/net/mld/src/main.c | 6 +- tests/net/pmtu/src/main.c | 6 +- 83 files changed, 370 insertions(+), 546 deletions(-) diff --git a/doc/connectivity/networking/api/coap_server.rst b/doc/connectivity/networking/api/coap_server.rst index 91ae5ecde47f..a2d0d1b77c1f 100644 --- a/doc/connectivity/networking/api/coap_server.rst +++ b/doc/connectivity/networking/api/coap_server.rst @@ -243,7 +243,7 @@ following example simply prints when an event occurs. #define COAP_EVENTS_SET (NET_EVENT_COAP_OBSERVER_ADDED | NET_EVENT_COAP_OBSERVER_REMOVED | \ NET_EVENT_COAP_SERVICE_STARTED | NET_EVENT_COAP_SERVICE_STOPPED) - void coap_event_handler(uint64_t mgmt_event, struct net_if *iface, + void coap_event_handler(uint32_t mgmt_event, struct net_if *iface, void *info, size_t info_length, void *user_data) { switch (mgmt_event) { diff --git a/doc/connectivity/networking/api/net_mgmt.rst b/doc/connectivity/networking/api/net_mgmt.rst index 7c47a63eee2a..2973ee82b041 100644 --- a/doc/connectivity/networking/api/net_mgmt.rst +++ b/doc/connectivity/networking/api/net_mgmt.rst @@ -97,7 +97,7 @@ An example follows. struct net_mgmt_event_callback ipv4_callback; void callback_handler(struct net_mgmt_event_callback *cb, - uint64_t mgmt_event, + uint32_t mgmt_event, struct net_if *iface) { if (mgmt_event == NET_EVENT_IF_xxx) { @@ -139,7 +139,7 @@ Or similarly using :c:macro:`NET_MGMT_REGISTER_EVENT_HANDLER`. #define EVENT_IFACE_SET (NET_EVENT_IF_xxx | NET_EVENT_IF_yyy) #define EVENT_IPV4_SET (NET_EVENT_IPV4_xxx | NET_EVENT_IPV4_yyy) - static void event_handler(uint64_t mgmt_event, struct net_if *iface, + static void event_handler(uint32_t mgmt_event, struct net_if *iface, void *info, size_t info_length, void *user_data) { @@ -183,7 +183,7 @@ You define your handler modeled with this signature: .. code-block:: c - static int your_handler(uint64_t mgmt_event, struct net_if *iface, + static int your_handler(uint32_t mgmt_event, struct net_if *iface, void *data, size_t len); and then register it with an associated mgmt_request code: diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index 8eb87fd36082..1c00525b7d86 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -1774,7 +1774,7 @@ static int modem_cellular_pm_action(const struct device *dev, enum pm_device_act } #endif /* CONFIG_PM_DEVICE */ -static void net_mgmt_event_handler(struct net_mgmt_event_callback *cb, uint64_t mgmt_event, +static void net_mgmt_event_handler(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, struct net_if *iface) { struct modem_cellular_data *data = diff --git a/drivers/wifi/esp32/src/esp_wifi_drv.c b/drivers/wifi/esp32/src/esp_wifi_drv.c index 72c4c5127173..305994d6a328 100644 --- a/drivers/wifi/esp32/src/esp_wifi_drv.c +++ b/drivers/wifi/esp32/src/esp_wifi_drv.c @@ -77,7 +77,7 @@ struct esp32_wifi_runtime { static struct net_mgmt_event_callback esp32_dhcp_cb; -static void wifi_event_handler(struct net_mgmt_event_callback *cb, uint64_t mgmt_event, +static void wifi_event_handler(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, struct net_if *iface) { switch (mgmt_event) { diff --git a/include/zephyr/net/coap_mgmt.h b/include/zephyr/net/coap_mgmt.h index 0cc25a9cb18d..961ca18d1ab1 100644 --- a/include/zephyr/net/coap_mgmt.h +++ b/include/zephyr/net/coap_mgmt.h @@ -40,25 +40,13 @@ struct coap_service; struct coap_resource; struct coap_observer; -enum { - NET_EVENT_COAP_CMD_SERVICE_STARTED_VAL, - NET_EVENT_COAP_CMD_SERVICE_STOPPED_VAL, - NET_EVENT_COAP_CMD_OBSERVER_ADDED_VAL, - NET_EVENT_COAP_CMD_OBSERVER_REMOVED_VAL, - - NET_EVENT_COAP_CMD_MAX -}; - -BUILD_ASSERT(NET_EVENT_COAP_CMD_MAX <= NET_MGMT_MAX_COMMANDS, - "Number of events in net_event_coap_cmd exceeds the limit"); - enum net_event_coap_cmd { /* Service events */ - NET_MGMT_CMD(NET_EVENT_COAP_CMD_SERVICE_STARTED), - NET_MGMT_CMD(NET_EVENT_COAP_CMD_SERVICE_STOPPED), + NET_EVENT_COAP_CMD_SERVICE_STARTED = 1, + NET_EVENT_COAP_CMD_SERVICE_STOPPED, /* Observer events */ - NET_MGMT_CMD(NET_EVENT_COAP_CMD_OBSERVER_ADDED), - NET_MGMT_CMD(NET_EVENT_COAP_CMD_OBSERVER_REMOVED), + NET_EVENT_COAP_CMD_OBSERVER_ADDED, + NET_EVENT_COAP_CMD_OBSERVER_REMOVED, }; /** @endcond */ diff --git a/include/zephyr/net/conn_mgr_connectivity.h b/include/zephyr/net/conn_mgr_connectivity.h index cb0f63fcfac0..d1b0ea8106a5 100644 --- a/include/zephyr/net/conn_mgr_connectivity.h +++ b/include/zephyr/net/conn_mgr_connectivity.h @@ -41,19 +41,9 @@ extern "C" { NET_MGMT_EVENT_BIT) #define NET_MGMT_CONN_IF_EVENT (NET_MGMT_IFACE_BIT | NET_MGMT_CONN_BASE) -enum { - NET_EVENT_CONN_CMD_IF_TIMEOUT_VAL, - NET_EVENT_CONN_CMD_IF_FATAL_ERROR_VAL, - - NET_EVENT_CONN_CMD_MAX -}; - -BUILD_ASSERT(NET_EVENT_CONN_CMD_MAX <= NET_MGMT_MAX_COMMANDS, - "Number of events in net_event_conn_cmd exceeds the limit"); - enum net_event_conn_cmd { - NET_MGMT_CMD(NET_EVENT_CONN_CMD_IF_TIMEOUT), - NET_MGMT_CMD(NET_EVENT_CONN_CMD_IF_FATAL_ERROR), + NET_EVENT_CONN_CMD_IF_TIMEOUT = 1, + NET_EVENT_CONN_CMD_IF_FATAL_ERROR, }; /** @endcond */ diff --git a/include/zephyr/net/ethernet_mgmt.h b/include/zephyr/net/ethernet_mgmt.h index 79306e9195aa..750e899da20b 100644 --- a/include/zephyr/net/ethernet_mgmt.h +++ b/include/zephyr/net/ethernet_mgmt.h @@ -188,23 +188,11 @@ struct ethernet_req_params { }; }; -enum { - NET_EVENT_ETHERNET_CMD_CARRIER_ON_VAL, - NET_EVENT_ETHERNET_CMD_CARRIER_OFF_VAL, - NET_EVENT_ETHERNET_CMD_VLAN_TAG_ENABLED_VAL, - NET_EVENT_ETHERNET_CMD_VLAN_TAG_DISABLED_VAL, - - NET_EVENT_ETHERNET_CMD_MAX -}; - -BUILD_ASSERT(NET_EVENT_ETHERNET_CMD_MAX <= NET_MGMT_MAX_COMMANDS, - "Number of events in net_event_ethernet_cmd exceeds the limit"); - enum net_event_ethernet_cmd { - NET_MGMT_CMD(NET_EVENT_ETHERNET_CMD_CARRIER_ON), - NET_MGMT_CMD(NET_EVENT_ETHERNET_CMD_CARRIER_OFF), - NET_MGMT_CMD(NET_EVENT_ETHERNET_CMD_VLAN_TAG_ENABLED), - NET_MGMT_CMD(NET_EVENT_ETHERNET_CMD_VLAN_TAG_DISABLED), + NET_EVENT_ETHERNET_CMD_CARRIER_ON = 1, + NET_EVENT_ETHERNET_CMD_CARRIER_OFF, + NET_EVENT_ETHERNET_CMD_VLAN_TAG_ENABLED, + NET_EVENT_ETHERNET_CMD_VLAN_TAG_DISABLED, }; #define NET_EVENT_ETHERNET_CARRIER_ON \ diff --git a/include/zephyr/net/ieee802154_mgmt.h b/include/zephyr/net/ieee802154_mgmt.h index 970f8a89a9c6..bf20b49b7208 100644 --- a/include/zephyr/net/ieee802154_mgmt.h +++ b/include/zephyr/net/ieee802154_mgmt.h @@ -255,17 +255,8 @@ NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_IEEE802154_GET_SECURITY_SETTINGS); * @cond INTERNAL_HIDDEN */ -enum { - NET_EVENT_IEEE802154_CMD_SCAN_RESULT_VAL, - - NET_EVENT_IEEE802154_CMD_MAX -}; - -BUILD_ASSERT(NET_EVENT_IEEE802154_CMD_MAX <= NET_MGMT_MAX_COMMANDS, - "Number of events in net_event_ieee802154_cmd exceeds the limit"); - enum net_event_ieee802154_cmd { - NET_MGMT_CMD(NET_EVENT_IEEE802154_CMD_SCAN_RESULT), + NET_EVENT_IEEE802154_CMD_SCAN_RESULT = 1, }; /** diff --git a/include/zephyr/net/net_event.h b/include/zephyr/net/net_event.h index 3a948ca5ef96..0b8c995cd3e9 100644 --- a/include/zephyr/net/net_event.h +++ b/include/zephyr/net/net_event.h @@ -34,23 +34,11 @@ extern "C" { NET_MGMT_LAYER(NET_IF_LAYER) | \ NET_MGMT_LAYER_CODE(NET_IF_CORE_CODE)) -enum { - NET_EVENT_IF_CMD_DOWN_VAL, - NET_EVENT_IF_CMD_UP_VAL, - NET_EVENT_IF_CMD_ADMIN_DOWN_VAL, - NET_EVENT_IF_CMD_ADMIN_UP_VAL, - - NET_EVENT_IF_CMD_MAX -}; - -BUILD_ASSERT(NET_EVENT_IF_CMD_MAX <= NET_MGMT_MAX_COMMANDS, - "Number of events in net_event_if_cmd exceeds the limit"); - enum net_event_if_cmd { - NET_MGMT_CMD(NET_EVENT_IF_CMD_DOWN), - NET_MGMT_CMD(NET_EVENT_IF_CMD_UP), - NET_MGMT_CMD(NET_EVENT_IF_CMD_ADMIN_DOWN), - NET_MGMT_CMD(NET_EVENT_IF_CMD_ADMIN_UP), + NET_EVENT_IF_CMD_DOWN = 1, + NET_EVENT_IF_CMD_UP, + NET_EVENT_IF_CMD_ADMIN_DOWN, + NET_EVENT_IF_CMD_ADMIN_UP, }; /* IPv6 Events */ @@ -61,65 +49,32 @@ enum net_event_if_cmd { NET_MGMT_LAYER(NET_IPV6_LAYER) | \ NET_MGMT_LAYER_CODE(NET_IPV6_CORE_CODE)) -enum { - NET_EVENT_IPV6_CMD_ADDR_ADD_VAL, - NET_EVENT_IPV6_CMD_ADDR_DEL_VAL, - NET_EVENT_IPV6_CMD_MADDR_ADD_VAL, - NET_EVENT_IPV6_CMD_MADDR_DEL_VAL, - NET_EVENT_IPV6_CMD_PREFIX_ADD_VAL, - NET_EVENT_IPV6_CMD_PREFIX_DEL_VAL, - NET_EVENT_IPV6_CMD_MCAST_JOIN_VAL, - NET_EVENT_IPV6_CMD_MCAST_LEAVE_VAL, - NET_EVENT_IPV6_CMD_ROUTER_ADD_VAL, - NET_EVENT_IPV6_CMD_ROUTER_DEL_VAL, - NET_EVENT_IPV6_CMD_ROUTE_ADD_VAL, - NET_EVENT_IPV6_CMD_ROUTE_DEL_VAL, - NET_EVENT_IPV6_CMD_DAD_SUCCEED_VAL, - NET_EVENT_IPV6_CMD_DAD_FAILED_VAL, - NET_EVENT_IPV6_CMD_NBR_ADD_VAL, - NET_EVENT_IPV6_CMD_NBR_DEL_VAL, - NET_EVENT_IPV6_CMD_DHCP_START_VAL, - NET_EVENT_IPV6_CMD_DHCP_BOUND_VAL, - NET_EVENT_IPV6_CMD_DHCP_STOP_VAL, - NET_EVENT_IPV6_CMD_ADDR_DEPRECATED_VAL, - NET_EVENT_IPV6_CMD_PE_ENABLED_VAL, - NET_EVENT_IPV6_CMD_PE_DISABLED_VAL, - NET_EVENT_IPV6_CMD_PE_FILTER_ADD_VAL, - NET_EVENT_IPV6_CMD_PE_FILTER_DEL_VAL, - NET_EVENT_IPV6_CMD_PMTU_CHANGED_VAL, - - NET_EVENT_IPV6_CMD_MAX -}; - -BUILD_ASSERT(NET_EVENT_IPV6_CMD_MAX <= NET_MGMT_MAX_COMMANDS, - "Number of events in net_event_ipv6_cmd exceeds the limit"); - enum net_event_ipv6_cmd { - NET_MGMT_CMD(NET_EVENT_IPV6_CMD_ADDR_ADD), - NET_MGMT_CMD(NET_EVENT_IPV6_CMD_ADDR_DEL), - NET_MGMT_CMD(NET_EVENT_IPV6_CMD_MADDR_ADD), - NET_MGMT_CMD(NET_EVENT_IPV6_CMD_MADDR_DEL), - NET_MGMT_CMD(NET_EVENT_IPV6_CMD_PREFIX_ADD), - NET_MGMT_CMD(NET_EVENT_IPV6_CMD_PREFIX_DEL), - NET_MGMT_CMD(NET_EVENT_IPV6_CMD_MCAST_JOIN), - NET_MGMT_CMD(NET_EVENT_IPV6_CMD_MCAST_LEAVE), - NET_MGMT_CMD(NET_EVENT_IPV6_CMD_ROUTER_ADD), - NET_MGMT_CMD(NET_EVENT_IPV6_CMD_ROUTER_DEL), - NET_MGMT_CMD(NET_EVENT_IPV6_CMD_ROUTE_ADD), - NET_MGMT_CMD(NET_EVENT_IPV6_CMD_ROUTE_DEL), - NET_MGMT_CMD(NET_EVENT_IPV6_CMD_DAD_SUCCEED), - NET_MGMT_CMD(NET_EVENT_IPV6_CMD_DAD_FAILED), - NET_MGMT_CMD(NET_EVENT_IPV6_CMD_NBR_ADD), - NET_MGMT_CMD(NET_EVENT_IPV6_CMD_NBR_DEL), - NET_MGMT_CMD(NET_EVENT_IPV6_CMD_DHCP_START), - NET_MGMT_CMD(NET_EVENT_IPV6_CMD_DHCP_BOUND), - NET_MGMT_CMD(NET_EVENT_IPV6_CMD_DHCP_STOP), - NET_MGMT_CMD(NET_EVENT_IPV6_CMD_ADDR_DEPRECATED), - NET_MGMT_CMD(NET_EVENT_IPV6_CMD_PE_ENABLED), - NET_MGMT_CMD(NET_EVENT_IPV6_CMD_PE_DISABLED), - NET_MGMT_CMD(NET_EVENT_IPV6_CMD_PE_FILTER_ADD), - NET_MGMT_CMD(NET_EVENT_IPV6_CMD_PE_FILTER_DEL), - NET_MGMT_CMD(NET_EVENT_IPV6_CMD_PMTU_CHANGED), + NET_EVENT_IPV6_CMD_ADDR_ADD = 1, + NET_EVENT_IPV6_CMD_ADDR_DEL, + NET_EVENT_IPV6_CMD_MADDR_ADD, + NET_EVENT_IPV6_CMD_MADDR_DEL, + NET_EVENT_IPV6_CMD_PREFIX_ADD, + NET_EVENT_IPV6_CMD_PREFIX_DEL, + NET_EVENT_IPV6_CMD_MCAST_JOIN, + NET_EVENT_IPV6_CMD_MCAST_LEAVE, + NET_EVENT_IPV6_CMD_ROUTER_ADD, + NET_EVENT_IPV6_CMD_ROUTER_DEL, + NET_EVENT_IPV6_CMD_ROUTE_ADD, + NET_EVENT_IPV6_CMD_ROUTE_DEL, + NET_EVENT_IPV6_CMD_DAD_SUCCEED, + NET_EVENT_IPV6_CMD_DAD_FAILED, + NET_EVENT_IPV6_CMD_NBR_ADD, + NET_EVENT_IPV6_CMD_NBR_DEL, + NET_EVENT_IPV6_CMD_DHCP_START, + NET_EVENT_IPV6_CMD_DHCP_BOUND, + NET_EVENT_IPV6_CMD_DHCP_STOP, + NET_EVENT_IPV6_CMD_ADDR_DEPRECATED, + NET_EVENT_IPV6_CMD_PE_ENABLED, + NET_EVENT_IPV6_CMD_PE_DISABLED, + NET_EVENT_IPV6_CMD_PE_FILTER_ADD, + NET_EVENT_IPV6_CMD_PE_FILTER_DEL, + NET_EVENT_IPV6_CMD_PMTU_CHANGED, }; /* IPv4 Events*/ @@ -130,45 +85,22 @@ enum net_event_ipv6_cmd { NET_MGMT_LAYER(NET_IPV4_LAYER) | \ NET_MGMT_LAYER_CODE(NET_IPV4_CORE_CODE)) -enum { - NET_EVENT_IPV4_CMD_ADDR_ADD_VAL, - NET_EVENT_IPV4_CMD_ADDR_DEL_VAL, - NET_EVENT_IPV4_CMD_MADDR_ADD_VAL, - NET_EVENT_IPV4_CMD_MADDR_DEL_VAL, - NET_EVENT_IPV4_CMD_ROUTER_ADD_VAL, - NET_EVENT_IPV4_CMD_ROUTER_DEL_VAL, - NET_EVENT_IPV4_CMD_DHCP_START_VAL, - NET_EVENT_IPV4_CMD_DHCP_BOUND_VAL, - NET_EVENT_IPV4_CMD_DHCP_STOP_VAL, - NET_EVENT_IPV4_CMD_MCAST_JOIN_VAL, - NET_EVENT_IPV4_CMD_MCAST_LEAVE_VAL, - NET_EVENT_IPV4_CMD_ACD_SUCCEED_VAL, - NET_EVENT_IPV4_CMD_ACD_FAILED_VAL, - NET_EVENT_IPV4_CMD_ACD_CONFLICT_VAL, - NET_EVENT_IPV4_CMD_PMTU_CHANGED_VAL, - - NET_EVENT_IPV4_CMD_MAX -}; - -BUILD_ASSERT(NET_EVENT_IPV4_CMD_MAX <= NET_MGMT_MAX_COMMANDS, - "Number of events in net_event_ipv4_cmd exceeds the limit"); - enum net_event_ipv4_cmd { - NET_MGMT_CMD(NET_EVENT_IPV4_CMD_ADDR_ADD), - NET_MGMT_CMD(NET_EVENT_IPV4_CMD_ADDR_DEL), - NET_MGMT_CMD(NET_EVENT_IPV4_CMD_MADDR_ADD), - NET_MGMT_CMD(NET_EVENT_IPV4_CMD_MADDR_DEL), - NET_MGMT_CMD(NET_EVENT_IPV4_CMD_ROUTER_ADD), - NET_MGMT_CMD(NET_EVENT_IPV4_CMD_ROUTER_DEL), - NET_MGMT_CMD(NET_EVENT_IPV4_CMD_DHCP_START), - NET_MGMT_CMD(NET_EVENT_IPV4_CMD_DHCP_BOUND), - NET_MGMT_CMD(NET_EVENT_IPV4_CMD_DHCP_STOP), - NET_MGMT_CMD(NET_EVENT_IPV4_CMD_MCAST_JOIN), - NET_MGMT_CMD(NET_EVENT_IPV4_CMD_MCAST_LEAVE), - NET_MGMT_CMD(NET_EVENT_IPV4_CMD_ACD_SUCCEED), - NET_MGMT_CMD(NET_EVENT_IPV4_CMD_ACD_FAILED), - NET_MGMT_CMD(NET_EVENT_IPV4_CMD_ACD_CONFLICT), - NET_MGMT_CMD(NET_EVENT_IPV4_CMD_PMTU_CHANGED), + NET_EVENT_IPV4_CMD_ADDR_ADD = 1, + NET_EVENT_IPV4_CMD_ADDR_DEL, + NET_EVENT_IPV4_CMD_MADDR_ADD, + NET_EVENT_IPV4_CMD_MADDR_DEL, + NET_EVENT_IPV4_CMD_ROUTER_ADD, + NET_EVENT_IPV4_CMD_ROUTER_DEL, + NET_EVENT_IPV4_CMD_DHCP_START, + NET_EVENT_IPV4_CMD_DHCP_BOUND, + NET_EVENT_IPV4_CMD_DHCP_STOP, + NET_EVENT_IPV4_CMD_MCAST_JOIN, + NET_EVENT_IPV4_CMD_MCAST_LEAVE, + NET_EVENT_IPV4_CMD_ACD_SUCCEED, + NET_EVENT_IPV4_CMD_ACD_FAILED, + NET_EVENT_IPV4_CMD_ACD_CONFLICT, + NET_EVENT_IPV4_CMD_PMTU_CHANGED, }; /* L4 network events */ @@ -179,45 +111,22 @@ enum net_event_ipv4_cmd { NET_MGMT_LAYER(NET_L4_LAYER) | \ NET_MGMT_LAYER_CODE(NET_L4_CORE_CODE)) -enum { - NET_EVENT_L4_CMD_CONNECTED_VAL, - NET_EVENT_L4_CMD_DISCONNECTED_VAL, - NET_EVENT_L4_CMD_IPV4_CONNECTED_VAL, - NET_EVENT_L4_CMD_IPV4_DISCONNECTED_VAL, - NET_EVENT_L4_CMD_IPV6_CONNECTED_VAL, - NET_EVENT_L4_CMD_IPV6_DISCONNECTED_VAL, - NET_EVENT_L4_CMD_DNS_SERVER_ADD_VAL, - NET_EVENT_L4_CMD_DNS_SERVER_DEL_VAL, - NET_EVENT_L4_CMD_HOSTNAME_CHANGED_VAL, - NET_EVENT_L4_CMD_CAPTURE_STARTED_VAL, - NET_EVENT_L4_CMD_CAPTURE_STOPPED_VAL, - NET_EVENT_L4_CMD_VPN_CONNECTED_VAL, - NET_EVENT_L4_CMD_VPN_DISCONNECTED_VAL, - NET_EVENT_L4_CMD_VPN_PEER_ADD_VAL, - NET_EVENT_L4_CMD_VPN_PEER_DEL_VAL, - - NET_EVENT_L4_CMD_MAX -}; - -BUILD_ASSERT(NET_EVENT_L4_CMD_MAX <= NET_MGMT_MAX_COMMANDS, - "Number of events in net_event_l4_cmd exceeds the limit"); - enum net_event_l4_cmd { - NET_MGMT_CMD(NET_EVENT_L4_CMD_CONNECTED), - NET_MGMT_CMD(NET_EVENT_L4_CMD_DISCONNECTED), - NET_MGMT_CMD(NET_EVENT_L4_CMD_IPV4_CONNECTED), - NET_MGMT_CMD(NET_EVENT_L4_CMD_IPV4_DISCONNECTED), - NET_MGMT_CMD(NET_EVENT_L4_CMD_IPV6_CONNECTED), - NET_MGMT_CMD(NET_EVENT_L4_CMD_IPV6_DISCONNECTED), - NET_MGMT_CMD(NET_EVENT_L4_CMD_DNS_SERVER_ADD), - NET_MGMT_CMD(NET_EVENT_L4_CMD_DNS_SERVER_DEL), - NET_MGMT_CMD(NET_EVENT_L4_CMD_HOSTNAME_CHANGED), - NET_MGMT_CMD(NET_EVENT_L4_CMD_CAPTURE_STARTED), - NET_MGMT_CMD(NET_EVENT_L4_CMD_CAPTURE_STOPPED), - NET_MGMT_CMD(NET_EVENT_L4_CMD_VPN_CONNECTED), - NET_MGMT_CMD(NET_EVENT_L4_CMD_VPN_DISCONNECTED), - NET_MGMT_CMD(NET_EVENT_L4_CMD_VPN_PEER_ADD), - NET_MGMT_CMD(NET_EVENT_L4_CMD_VPN_PEER_DEL), + NET_EVENT_L4_CMD_CONNECTED = 1, + NET_EVENT_L4_CMD_DISCONNECTED, + NET_EVENT_L4_CMD_IPV4_CONNECTED, + NET_EVENT_L4_CMD_IPV4_DISCONNECTED, + NET_EVENT_L4_CMD_IPV6_CONNECTED, + NET_EVENT_L4_CMD_IPV6_DISCONNECTED, + NET_EVENT_L4_CMD_DNS_SERVER_ADD, + NET_EVENT_L4_CMD_DNS_SERVER_DEL, + NET_EVENT_L4_CMD_HOSTNAME_CHANGED, + NET_EVENT_L4_CMD_CAPTURE_STARTED, + NET_EVENT_L4_CMD_CAPTURE_STOPPED, + NET_EVENT_L4_CMD_VPN_CONNECTED, + NET_EVENT_L4_CMD_VPN_DISCONNECTED, + NET_EVENT_L4_CMD_VPN_PEER_ADD, + NET_EVENT_L4_CMD_VPN_PEER_DEL, }; /** @endcond */ @@ -244,11 +153,11 @@ enum net_event_l4_cmd { /** Event emitted when an IPv6 address is removed from the system. */ #define NET_EVENT_IPV6_ADDR_DEL \ - (NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_ADDR_DEL) + (NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_ADDR_DEL) /** Event emitted when an IPv6 multicast address is added to the system. */ #define NET_EVENT_IPV6_MADDR_ADD \ - (NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_MADDR_ADD) + (NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_MADDR_ADD) /** Event emitted when an IPv6 multicast address is removed from the system. */ #define NET_EVENT_IPV6_MADDR_DEL \ @@ -256,19 +165,19 @@ enum net_event_l4_cmd { /** Event emitted when an IPv6 prefix is added to the system. */ #define NET_EVENT_IPV6_PREFIX_ADD \ - (NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_PREFIX_ADD) + (NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_PREFIX_ADD) /** Event emitted when an IPv6 prefix is removed from the system. */ #define NET_EVENT_IPV6_PREFIX_DEL \ - (NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_PREFIX_DEL) + (NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_PREFIX_DEL) /** Event emitted when an IPv6 multicast group is joined. */ #define NET_EVENT_IPV6_MCAST_JOIN \ - (NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_MCAST_JOIN) + (NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_MCAST_JOIN) /** Event emitted when an IPv6 multicast group is left. */ #define NET_EVENT_IPV6_MCAST_LEAVE \ - (NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_MCAST_LEAVE) + (NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_MCAST_LEAVE) /** Event emitted when an IPv6 router is added to the system. */ #define NET_EVENT_IPV6_ROUTER_ADD \ @@ -304,15 +213,15 @@ enum net_event_l4_cmd { /** Event emitted when an IPv6 DHCP client starts. */ #define NET_EVENT_IPV6_DHCP_START \ - (NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_DHCP_START) + (NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_DHCP_START) /** Event emitted when an IPv6 DHCP client address is bound. */ #define NET_EVENT_IPV6_DHCP_BOUND \ - (NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_DHCP_BOUND) + (NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_DHCP_BOUND) /** Event emitted when an IPv6 DHCP client is stopped. */ #define NET_EVENT_IPV6_DHCP_STOP \ - (NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_DHCP_STOP) + (NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_DHCP_STOP) /** IPv6 address is deprecated. */ #define NET_EVENT_IPV6_ADDR_DEPRECATED \ @@ -344,11 +253,11 @@ enum net_event_l4_cmd { /** Event emitted when an IPv4 address is removed from the system. */ #define NET_EVENT_IPV4_ADDR_DEL \ - (NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_ADDR_DEL) + (NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_ADDR_DEL) /** Event emitted when an IPv4 multicast address is added to the system. */ #define NET_EVENT_IPV4_MADDR_ADD \ - (NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_MADDR_ADD) + (NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_MADDR_ADD) /** Event emitted when an IPv4 multicast address is removed from the system. */ #define NET_EVENT_IPV4_MADDR_DEL \ @@ -356,31 +265,31 @@ enum net_event_l4_cmd { /** Event emitted when an IPv4 router is added to the system. */ #define NET_EVENT_IPV4_ROUTER_ADD \ - (NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_ROUTER_ADD) + (NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_ROUTER_ADD) /** Event emitted when an IPv4 router is removed from the system. */ #define NET_EVENT_IPV4_ROUTER_DEL \ - (NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_ROUTER_DEL) + (NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_ROUTER_DEL) /** Event emitted when an IPv4 DHCP client is started. */ #define NET_EVENT_IPV4_DHCP_START \ - (NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_DHCP_START) + (NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_DHCP_START) /** Event emitted when an IPv4 DHCP client address is bound. */ #define NET_EVENT_IPV4_DHCP_BOUND \ - (NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_DHCP_BOUND) + (NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_DHCP_BOUND) /** Event emitted when an IPv4 DHCP client is stopped. */ #define NET_EVENT_IPV4_DHCP_STOP \ - (NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_DHCP_STOP) + (NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_DHCP_STOP) /** Event emitted when an IPv4 multicast group is joined. */ #define NET_EVENT_IPV4_MCAST_JOIN \ - (NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_MCAST_JOIN) + (NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_MCAST_JOIN) /** Event emitted when an IPv4 multicast group is left. */ #define NET_EVENT_IPV4_MCAST_LEAVE \ - (NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_MCAST_LEAVE) + (NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_MCAST_LEAVE) /** Event emitted when an IPv4 address conflict detection succeeds. */ #define NET_EVENT_IPV4_ACD_SUCCEED \ diff --git a/include/zephyr/net/net_mgmt.h b/include/zephyr/net/net_mgmt.h index 9c559b7fd8b9..04e95cbb5ec1 100644 --- a/include/zephyr/net/net_mgmt.h +++ b/include/zephyr/net/net_mgmt.h @@ -14,6 +14,7 @@ #include #include +#include #include #ifdef __cplusplus @@ -35,30 +36,38 @@ struct net_if; /** * @brief NET MGMT event mask basics, normalizing parts of bit fields */ -#define NET_MGMT_EVENT_MASK GENMASK64(63, 63) /* 0x8000000000000000 */ -#define NET_MGMT_ON_IFACE_MASK GENMASK64(62, 62) /* 0x4000000000000000 */ -#define NET_MGMT_LAYER_MASK GENMASK64(61, 60) /* 0x3000000000000000 */ -#define NET_MGMT_SYNC_EVENT_MASK GENMASK64(59, 59) /* 0x0800000000000000 */ -#define NET_MGMT_LAYER_CODE_MASK GENMASK64(58, 52) /* 0x07F0000000000000 */ -#define NET_MGMT_COMMAND_MASK GENMASK64(51, 0) /* 0x000FFFFFFFFFFFFF */ +#define NET_MGMT_EVENT_MASK 0x80000000 +#define NET_MGMT_ON_IFACE_MASK 0x40000000 +#define NET_MGMT_LAYER_MASK 0x30000000 +#define NET_MGMT_SYNC_EVENT_MASK 0x08000000 +#define NET_MGMT_LAYER_CODE_MASK 0x07FF0000 +#define NET_MGMT_COMMAND_MASK 0x0000FFFF + +#define NET_MGMT_EVENT_BIT BIT(31) +#define NET_MGMT_IFACE_BIT BIT(30) +#define NET_MGMT_SYNC_EVENT_BIT BIT(27) + +#define NET_MGMT_LAYER(_layer) (_layer << 28) +#define NET_MGMT_LAYER_CODE(_code) (_code << 16) + +#define NET_MGMT_EVENT(mgmt_request) \ + (mgmt_request & NET_MGMT_EVENT_MASK) -#define NET_MGMT_MAX_COMMANDS 52 /* TODO: figure out the value from mask */ +#define NET_MGMT_ON_IFACE(mgmt_request) \ + (mgmt_request & NET_MGMT_ON_IFACE_MASK) -#define NET_MGMT_EVENT_BIT BIT64(63) -#define NET_MGMT_IFACE_BIT BIT64(62) -#define NET_MGMT_SYNC_EVENT_BIT BIT64(59) +#define NET_MGMT_EVENT_SYNCHRONOUS(mgmt_request) \ + (mgmt_request & NET_MGMT_SYNC_EVENT_MASK) -#define NET_MGMT_LAYER(_layer) FIELD_PREP(NET_MGMT_LAYER_MASK, (_layer)) -#define NET_MGMT_LAYER_CODE(_code) FIELD_PREP(NET_MGMT_LAYER_CODE_MASK, (_code)) +#define NET_MGMT_GET_LAYER(mgmt_request) \ + ((mgmt_request & NET_MGMT_LAYER_MASK) >> 28) -#define NET_MGMT_EVENT(mgmt_request) FIELD_GET(NET_MGMT_EVENT_MASK, mgmt_request) -#define NET_MGMT_ON_IFACE(mgmt_request) FIELD_GET(NET_MGMT_ON_IFACE_MASK, mgmt_request) -#define NET_MGMT_EVENT_SYNCHRONOUS(mgmt_request) FIELD_GET(NET_MGMT_SYNC_EVENT_MASK, mgmt_request) -#define NET_MGMT_GET_LAYER(mgmt_request) FIELD_GET(NET_MGMT_LAYER_MASK, mgmt_request) -#define NET_MGMT_GET_LAYER_CODE(mgmt_request) FIELD_GET(NET_MGMT_LAYER_CODE_MASK, mgmt_request) -#define NET_MGMT_GET_COMMAND(mgmt_request) FIELD_GET(NET_MGMT_COMMAND_MASK, mgmt_request) +#define NET_MGMT_GET_LAYER_CODE(mgmt_request) \ + ((mgmt_request & NET_MGMT_LAYER_CODE_MASK) >> 16) + +#define NET_MGMT_GET_COMMAND(mgmt_request) \ + (mgmt_request & NET_MGMT_COMMAND_MASK) -#define NET_MGMT_CMD(cmd) cmd = BIT64(cmd ##_VAL) /* Useful generic definitions */ #define NET_MGMT_LAYER_L2 1 @@ -93,8 +102,6 @@ enum net_mgmt_layer_code { NET_MGMT_LAYER_CODE_RESERVED = 0x7F /**< Reserved layer code for future use */ }; -#include - /** * @typedef net_mgmt_request_handler_t * @brief Signature which all Net MGMT request handler need to follow @@ -106,7 +113,7 @@ enum net_mgmt_layer_code { * NULL otherwise. * @param len Length in byte of the memory pointed by data. */ -typedef int (*net_mgmt_request_handler_t)(uint64_t mgmt_request, +typedef int (*net_mgmt_request_handler_t)(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len); @@ -127,7 +134,7 @@ typedef int (*net_mgmt_request_handler_t)(uint64_t mgmt_request, * @param _mgmt_request Management event identifier */ #define NET_MGMT_DEFINE_REQUEST_HANDLER(_mgmt_request) \ - extern int net_mgmt_##_mgmt_request(uint64_t mgmt_request, \ + extern int net_mgmt_##_mgmt_request(uint32_t mgmt_request, \ struct net_if *iface, \ void *data, size_t len) @@ -151,7 +158,7 @@ struct net_mgmt_event_callback; * if it's an event on an iface. NULL otherwise. */ typedef void (*net_mgmt_event_handler_t)(struct net_mgmt_event_callback *cb, - uint64_t mgmt_event, + uint32_t mgmt_event, struct net_if *iface); /** @@ -195,11 +202,11 @@ struct net_mgmt_event_callback { * receive events from multiple layers, one must have multiple * listeners registered, one for each layer being listened. */ - uint64_t event_mask; + uint32_t event_mask; /** Internal place holder when a synchronous event wait is * successfully unlocked on a event. */ - uint64_t raised_event; + uint32_t raised_event; }; }; @@ -214,7 +221,7 @@ struct net_mgmt_event_callback { * @param info_length Length in bytes of the memory pointed by @p info. * @param user_data Data provided by the user to the handler. */ -typedef void (*net_mgmt_event_static_handler_t)(uint64_t mgmt_event, +typedef void (*net_mgmt_event_static_handler_t)(uint32_t mgmt_event, struct net_if *iface, void *info, size_t info_length, void *user_data); @@ -223,7 +230,7 @@ typedef void (*net_mgmt_event_static_handler_t)(uint64_t mgmt_event, /* Structure for event handler registered at compile time */ struct net_mgmt_event_static_handler { - uint64_t event_mask; + uint32_t event_mask; net_mgmt_event_static_handler_t handler; void *user_data; }; @@ -260,7 +267,7 @@ struct net_mgmt_event_static_handler { static inline void net_mgmt_init_event_callback(struct net_mgmt_event_callback *cb, net_mgmt_event_handler_t handler, - uint64_t mgmt_event_mask) + uint32_t mgmt_event_mask) { __ASSERT(cb, "Callback pointer should not be NULL"); __ASSERT(handler, "Handler pointer should not be NULL"); @@ -306,7 +313,7 @@ void net_mgmt_del_event_callback(struct net_mgmt_event_callback *cb); * is not defined. */ #if defined(CONFIG_NET_MGMT_EVENT) -void net_mgmt_event_notify_with_info(uint64_t mgmt_event, struct net_if *iface, +void net_mgmt_event_notify_with_info(uint32_t mgmt_event, struct net_if *iface, const void *info, size_t length); #else #define net_mgmt_event_notify_with_info(...) @@ -319,7 +326,7 @@ void net_mgmt_event_notify_with_info(uint64_t mgmt_event, struct net_if *iface, * based on an iface. NULL otherwise. */ #if defined(CONFIG_NET_MGMT_EVENT) -static inline void net_mgmt_event_notify(uint64_t mgmt_event, +static inline void net_mgmt_event_notify(uint32_t mgmt_event, struct net_if *iface) { net_mgmt_event_notify_with_info(mgmt_event, iface, NULL, 0); @@ -349,15 +356,15 @@ static inline void net_mgmt_event_notify(uint64_t mgmt_event, * actual event. */ #ifdef CONFIG_NET_MGMT_EVENT -int net_mgmt_event_wait(uint64_t mgmt_event_mask, - uint64_t *raised_event, +int net_mgmt_event_wait(uint32_t mgmt_event_mask, + uint32_t *raised_event, struct net_if **iface, const void **info, size_t *info_length, k_timeout_t timeout); #else -static inline int net_mgmt_event_wait(uint64_t mgmt_event_mask, - uint64_t *raised_event, +static inline int net_mgmt_event_wait(uint32_t mgmt_event_mask, + uint32_t *raised_event, struct net_if **iface, const void **info, size_t *info_length, @@ -394,15 +401,15 @@ static inline int net_mgmt_event_wait(uint64_t mgmt_event_mask, */ #ifdef CONFIG_NET_MGMT_EVENT int net_mgmt_event_wait_on_iface(struct net_if *iface, - uint64_t mgmt_event_mask, - uint64_t *raised_event, + uint32_t mgmt_event_mask, + uint32_t *raised_event, const void **info, size_t *info_length, k_timeout_t timeout); #else static inline int net_mgmt_event_wait_on_iface(struct net_if *iface, - uint64_t mgmt_event_mask, - uint64_t *raised_event, + uint32_t mgmt_event_mask, + uint32_t *raised_event, const void **info, size_t *info_length, k_timeout_t timeout) diff --git a/include/zephyr/net/ppp.h b/include/zephyr/net/ppp.h index 82e026483806..7028e4f2d0f6 100644 --- a/include/zephyr/net/ppp.h +++ b/include/zephyr/net/ppp.h @@ -574,23 +574,11 @@ void net_ppp_init(struct net_if *iface); NET_MGMT_LAYER_CODE(NET_PPP_CODE)) #define NET_PPP_EVENT (NET_PPP_BASE | NET_MGMT_EVENT_BIT) -enum { - NET_EVENT_PPP_CMD_CARRIER_ON_VAL, - NET_EVENT_PPP_CMD_CARRIER_OFF_VAL, - NET_EVENT_PPP_CMD_PHASE_RUNNING_VAL, - NET_EVENT_PPP_CMD_PHASE_DEAD_VAL, - - NET_EVENT_PPP_CMD_MAX -}; - -BUILD_ASSERT(NET_EVENT_PPP_CMD_MAX <= NET_MGMT_MAX_COMMANDS, - "Number of events in net_event_ppp_cmd exceeds the limit"); - enum net_event_ppp_cmd { - NET_MGMT_CMD(NET_EVENT_PPP_CMD_CARRIER_ON), - NET_MGMT_CMD(NET_EVENT_PPP_CMD_CARRIER_OFF), - NET_MGMT_CMD(NET_EVENT_PPP_CMD_PHASE_RUNNING), - NET_MGMT_CMD(NET_EVENT_PPP_CMD_PHASE_DEAD), + NET_EVENT_PPP_CMD_CARRIER_ON = 1, + NET_EVENT_PPP_CMD_CARRIER_OFF, + NET_EVENT_PPP_CMD_PHASE_RUNNING, + NET_EVENT_PPP_CMD_PHASE_DEAD, }; struct net_if; diff --git a/include/zephyr/net/socket_net_mgmt.h b/include/zephyr/net/socket_net_mgmt.h index 337648d5d188..8f3c5829ad3f 100644 --- a/include/zephyr/net/socket_net_mgmt.h +++ b/include/zephyr/net/socket_net_mgmt.h @@ -73,7 +73,7 @@ struct sockaddr_nm { uintptr_t nm_pid; /** net_mgmt mask */ - uint64_t nm_mask; + uint32_t nm_mask; }; diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index 2c895afb36d0..5477b6a3c0e9 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -317,73 +317,44 @@ NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_START_ROAMING); NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_NEIGHBOR_REP_COMPLETE); -/** @cond INTERNAL_HIDDEN */ - -enum { - NET_EVENT_WIFI_CMD_SCAN_RESULT_VAL, - NET_EVENT_WIFI_CMD_SCAN_DONE_VAL, - NET_EVENT_WIFI_CMD_CONNECT_RESULT_VAL, - NET_EVENT_WIFI_CMD_DISCONNECT_RESULT_VAL, - NET_EVENT_WIFI_CMD_IFACE_STATUS_VAL, - NET_EVENT_WIFI_CMD_TWT_VAL, - NET_EVENT_WIFI_CMD_TWT_SLEEP_STATE_VAL, - NET_EVENT_WIFI_CMD_RAW_SCAN_RESULT_VAL, - NET_EVENT_WIFI_CMD_DISCONNECT_COMPLETE_VAL, - NET_EVENT_WIFI_CMD_SIGNAL_CHANGE_VAL, - NET_EVENT_WIFI_CMD_NEIGHBOR_REP_RECEIVED_VAL, - NET_EVENT_WIFI_CMD_NEIGHBOR_REP_COMPLETE_VAL, - NET_EVENT_WIFI_CMD_AP_ENABLE_RESULT_VAL, - NET_EVENT_WIFI_CMD_AP_DISABLE_RESULT_VAL, - NET_EVENT_WIFI_CMD_AP_STA_CONNECTED_VAL, - NET_EVENT_WIFI_CMD_AP_STA_DISCONNECTED_VAL, - NET_EVENT_WIFI_CMD_SUPPLICANT_VAL, - - NET_EVENT_WIFI_CMD_MAX, -}; - -BUILD_ASSERT(NET_EVENT_WIFI_CMD_MAX <= NET_MGMT_MAX_COMMANDS, - "Number of events in net_event_wifi_cmd exceeds the limit"); - -/** @endcond */ - /** @brief Wi-Fi management events */ enum net_event_wifi_cmd { /** Scan results available */ - NET_MGMT_CMD(NET_EVENT_WIFI_CMD_SCAN_RESULT), + NET_EVENT_WIFI_CMD_SCAN_RESULT = 1, /** Scan done */ - NET_MGMT_CMD(NET_EVENT_WIFI_CMD_SCAN_DONE), + NET_EVENT_WIFI_CMD_SCAN_DONE, /** Connect result */ - NET_MGMT_CMD(NET_EVENT_WIFI_CMD_CONNECT_RESULT), + NET_EVENT_WIFI_CMD_CONNECT_RESULT, /** Disconnect result */ - NET_MGMT_CMD(NET_EVENT_WIFI_CMD_DISCONNECT_RESULT), + NET_EVENT_WIFI_CMD_DISCONNECT_RESULT, /** Interface status */ - NET_MGMT_CMD(NET_EVENT_WIFI_CMD_IFACE_STATUS), + NET_EVENT_WIFI_CMD_IFACE_STATUS, /** TWT events */ - NET_MGMT_CMD(NET_EVENT_WIFI_CMD_TWT), + NET_EVENT_WIFI_CMD_TWT, /** TWT sleep status: awake or sleeping, can be used by application * to determine if it can send data or not. */ - NET_MGMT_CMD(NET_EVENT_WIFI_CMD_TWT_SLEEP_STATE), + NET_EVENT_WIFI_CMD_TWT_SLEEP_STATE, /** Raw scan results available */ - NET_MGMT_CMD(NET_EVENT_WIFI_CMD_RAW_SCAN_RESULT), + NET_EVENT_WIFI_CMD_RAW_SCAN_RESULT, /** Disconnect complete */ - NET_MGMT_CMD(NET_EVENT_WIFI_CMD_DISCONNECT_COMPLETE), + NET_EVENT_WIFI_CMD_DISCONNECT_COMPLETE, /** Signal change event */ - NET_MGMT_CMD(NET_EVENT_WIFI_CMD_SIGNAL_CHANGE), + NET_EVENT_WIFI_CMD_SIGNAL_CHANGE, /** Neighbor Report */ - NET_MGMT_CMD(NET_EVENT_WIFI_CMD_NEIGHBOR_REP_RECEIVED), + NET_EVENT_WIFI_CMD_NEIGHBOR_REP_RECEIVED, /** Neighbor Report complete */ - NET_MGMT_CMD(NET_EVENT_WIFI_CMD_NEIGHBOR_REP_COMPLETE), + NET_EVENT_WIFI_CMD_NEIGHBOR_REP_COMPLETE, /** AP mode enable result */ - NET_MGMT_CMD(NET_EVENT_WIFI_CMD_AP_ENABLE_RESULT), + NET_EVENT_WIFI_CMD_AP_ENABLE_RESULT, /** AP mode disable result */ - NET_MGMT_CMD(NET_EVENT_WIFI_CMD_AP_DISABLE_RESULT), + NET_EVENT_WIFI_CMD_AP_DISABLE_RESULT, /** STA connected to AP */ - NET_MGMT_CMD(NET_EVENT_WIFI_CMD_AP_STA_CONNECTED), + NET_EVENT_WIFI_CMD_AP_STA_CONNECTED, /** STA disconnected from AP */ - NET_MGMT_CMD(NET_EVENT_WIFI_CMD_AP_STA_DISCONNECTED), + NET_EVENT_WIFI_CMD_AP_STA_DISCONNECTED, /** Supplicant specific event */ - NET_MGMT_CMD(NET_EVENT_WIFI_CMD_SUPPLICANT), + NET_EVENT_WIFI_CMD_SUPPLICANT, }; /** Event emitted for Wi-Fi scan result */ diff --git a/modules/hostap/src/supp_events.h b/modules/hostap/src/supp_events.h index 1c74af528492..09c30e7a37f5 100644 --- a/modules/hostap/src/supp_events.h +++ b/modules/hostap/src/supp_events.h @@ -17,27 +17,14 @@ NET_MGMT_IFACE_BIT) #define NET_MGMT_SUPPLICANT_EVENT (NET_MGMT_EVENT_BIT | NET_MGMT_SUPPLICANT_BASE) -enum { - NET_EVENT_SUPPLICANT_CMD_READY_VAL, - NET_EVENT_SUPPLICANT_CMD_NOT_READY_VAL, - NET_EVENT_SUPPLICANT_CMD_IFACE_ADDED_VAL, - NET_EVENT_SUPPLICANT_CMD_IFACE_REMOVING_VAL, - NET_EVENT_SUPPLICANT_CMD_IFACE_REMOVED_VAL, - NET_EVENT_SUPPLICANT_CMD_INT_EVENT_VAL, - - NET_EVENT_SUPPLICANT_CMD_MAX -}; - -BUILD_ASSERT(NET_EVENT_SUPPLICANT_CMD_MAX <= NET_MGMT_MAX_COMMANDS, - "Number of events in net_event_supplicant_cmd exceeds the limit"); - enum net_event_supplicant_cmd { - NET_MGMT_CMD(NET_EVENT_SUPPLICANT_CMD_READY), - NET_MGMT_CMD(NET_EVENT_SUPPLICANT_CMD_NOT_READY), - NET_MGMT_CMD(NET_EVENT_SUPPLICANT_CMD_IFACE_ADDED), - NET_MGMT_CMD(NET_EVENT_SUPPLICANT_CMD_IFACE_REMOVING), - NET_MGMT_CMD(NET_EVENT_SUPPLICANT_CMD_IFACE_REMOVED), - NET_MGMT_CMD(NET_EVENT_SUPPLICANT_CMD_INT_EVENT), + NET_EVENT_SUPPLICANT_CMD_READY = 1, + NET_EVENT_SUPPLICANT_CMD_NOT_READY, + NET_EVENT_SUPPLICANT_CMD_IFACE_ADDED, + NET_EVENT_SUPPLICANT_CMD_IFACE_REMOVING, + NET_EVENT_SUPPLICANT_CMD_IFACE_REMOVED, + NET_EVENT_SUPPLICANT_CMD_INT_EVENT, + NET_EVENT_WIFI_CMD_MAX }; #define NET_EVENT_SUPPLICANT_READY \ diff --git a/modules/hostap/src/supp_main.c b/modules/hostap/src/supp_main.c index 4549ab3160d2..c2a4866b9218 100644 --- a/modules/hostap/src/supp_main.c +++ b/modules/hostap/src/supp_main.c @@ -484,14 +484,14 @@ static void submit_iface_work(struct supplicant_context *ctx, } #ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_INF_MON static void interface_handler(struct net_mgmt_event_callback *cb, - uint64_t mgmt_event, struct net_if *iface) + uint32_t mgmt_event, struct net_if *iface) { if ((mgmt_event & INTERFACE_EVENT_MASK) != mgmt_event) { return; } if (!is_wanted_interface(iface)) { - LOG_DBG("Ignoring event (0x%" PRIx64 ") from interface %d (%p)", + LOG_DBG("Ignoring event (0x%02x) from interface %d (%p)", mgmt_event, net_if_get_by_iface(iface), iface); return; } diff --git a/samples/boards/nxp/s32/netc/src/main.c b/samples/boards/nxp/s32/netc/src/main.c index 09e6cea98836..8399a7dd9b5d 100644 --- a/samples/boards/nxp/s32/netc/src/main.c +++ b/samples/boards/nxp/s32/netc/src/main.c @@ -69,7 +69,7 @@ static int setup_iface(struct net_if *iface, const char *ipv6_addr, } static void iface_up_handler(struct net_mgmt_event_callback *cb, - uint64_t mgmt_event, struct net_if *iface) + uint32_t mgmt_event, struct net_if *iface) { if (mgmt_event == NET_EVENT_IF_UP) { k_sem_give(&iface_up); diff --git a/samples/net/capture/src/main.c b/samples/net/capture/src/main.c index 1b68ee30afa8..3feafc4eb254 100644 --- a/samples/net/capture/src/main.c +++ b/samples/net/capture/src/main.c @@ -285,7 +285,7 @@ static int init_app(void) #define EVENT_MASK (NET_EVENT_CAPTURE_STARTED | NET_EVENT_CAPTURE_STOPPED) static void event_handler(struct net_mgmt_event_callback *cb, - uint64_t mgmt_event, struct net_if *iface) + uint32_t mgmt_event, struct net_if *iface) { ARG_UNUSED(iface); ARG_UNUSED(cb); @@ -307,7 +307,7 @@ int main(void) { static struct net_mgmt_event_callback mgmt_cb; struct net_if *iface; - uint64_t event; + uint32_t event; int ret; LOG_INF("Starting network capture sample"); diff --git a/samples/net/cloud/mqtt_azure/src/main.c b/samples/net/cloud/mqtt_azure/src/main.c index 538461af2d1c..841c1fb7ebe0 100644 --- a/samples/net/cloud/mqtt_azure/src/main.c +++ b/samples/net/cloud/mqtt_azure/src/main.c @@ -487,7 +487,7 @@ static void abort_mqtt_connection(void) } static void l4_event_handler(struct net_mgmt_event_callback *cb, - uint64_t mgmt_event, struct net_if *iface) + uint32_t mgmt_event, struct net_if *iface) { if ((mgmt_event & L4_EVENT_MASK) != mgmt_event) { return; diff --git a/samples/net/cloud/tagoio_http_post/src/wifi.c b/samples/net/cloud/tagoio_http_post/src/wifi.c index a0cd121d62b3..f9eb52b7a594 100644 --- a/samples/net/cloud/tagoio_http_post/src/wifi.c +++ b/samples/net/cloud/tagoio_http_post/src/wifi.c @@ -26,7 +26,7 @@ static void handle_wifi_connect_result(struct net_mgmt_event_callback *cb) } static void wifi_mgmt_event_handler(struct net_mgmt_event_callback *cb, - uint64_t mgmt_event, struct net_if *iface) + uint32_t mgmt_event, struct net_if *iface) { switch (mgmt_event) { case NET_EVENT_WIFI_CONNECT_RESULT: diff --git a/samples/net/common/net_sample_common.c b/samples/net/common/net_sample_common.c index 0b570a64feb1..e1b91c911222 100644 --- a/samples/net/common/net_sample_common.c +++ b/samples/net/common/net_sample_common.c @@ -20,7 +20,7 @@ LOG_MODULE_REGISTER(net_samples_common, LOG_LEVEL_DBG); static struct net_mgmt_event_callback l4_cb; static K_SEM_DEFINE(network_connected, 0, 1); -static void l4_event_handler(struct net_mgmt_event_callback *cb, uint64_t event, +static void l4_event_handler(struct net_mgmt_event_callback *cb, uint32_t event, struct net_if *iface) { switch (event) { diff --git a/samples/net/dhcpv4_client/src/main.c b/samples/net/dhcpv4_client/src/main.c index 72f7a17f273c..00d48949d739 100644 --- a/samples/net/dhcpv4_client/src/main.c +++ b/samples/net/dhcpv4_client/src/main.c @@ -38,7 +38,7 @@ static void start_dhcpv4_client(struct net_if *iface, void *user_data) } static void handler(struct net_mgmt_event_callback *cb, - uint64_t mgmt_event, + uint32_t mgmt_event, struct net_if *iface) { int i = 0; diff --git a/samples/net/dns_resolve/src/main.c b/samples/net/dns_resolve/src/main.c index 5302f5698742..23e5645d0b45 100644 --- a/samples/net/dns_resolve/src/main.c +++ b/samples/net/dns_resolve/src/main.c @@ -198,7 +198,7 @@ static void print_dhcpv4_addr(struct net_if *iface, struct net_if_addr *if_addr, } static void ipv4_addr_add_handler(struct net_mgmt_event_callback *cb, - uint64_t mgmt_event, + uint32_t mgmt_event, struct net_if *iface) { diff --git a/samples/net/dsa/src/main.c b/samples/net/dsa/src/main.c index a84b2cef7a9d..16d41af59993 100644 --- a/samples/net/dsa/src/main.c +++ b/samples/net/dsa/src/main.c @@ -54,7 +54,7 @@ static void dsa_iface_find_cb(struct net_if *iface, void *user_data) static struct net_mgmt_event_callback mgmt_cb; static void event_handler(struct net_mgmt_event_callback *cb, - uint64_t mgmt_event, struct net_if *iface) + uint32_t mgmt_event, struct net_if *iface) { ARG_UNUSED(iface); ARG_UNUSED(cb); diff --git a/samples/net/ipv4_autoconf/src/main.c b/samples/net/ipv4_autoconf/src/main.c index 9dd9fa53bb71..c4e93105cf73 100644 --- a/samples/net/ipv4_autoconf/src/main.c +++ b/samples/net/ipv4_autoconf/src/main.c @@ -25,7 +25,7 @@ LOG_MODULE_REGISTER(net_ipv4_autoconf_sample, LOG_LEVEL_DBG); static struct net_mgmt_event_callback mgmt_cb; static void handler(struct net_mgmt_event_callback *cb, - uint64_t mgmt_event, + uint32_t mgmt_event, struct net_if *iface) { int i = 0; diff --git a/samples/net/lwm2m_client/src/lwm2m-client.c b/samples/net/lwm2m_client/src/lwm2m-client.c index 7c15f84502c7..9127769ff6b8 100644 --- a/samples/net/lwm2m_client/src/lwm2m-client.c +++ b/samples/net/lwm2m_client/src/lwm2m-client.c @@ -334,7 +334,7 @@ static void on_net_event_l4_connected(void) } static void l4_event_handler(struct net_mgmt_event_callback *cb, - uint64_t event, + uint32_t event, struct net_if *iface) { switch (event) { @@ -356,7 +356,7 @@ static void l4_event_handler(struct net_mgmt_event_callback *cb, } static void connectivity_event_handler(struct net_mgmt_event_callback *cb, - uint64_t event, + uint32_t event, struct net_if *iface) { if (event == NET_EVENT_CONN_IF_FATAL_ERROR) { diff --git a/samples/net/mqtt_sn_publisher/src/main.c b/samples/net/mqtt_sn_publisher/src/main.c index fddeb4c976fe..65436daea4d5 100644 --- a/samples/net/mqtt_sn_publisher/src/main.c +++ b/samples/net/mqtt_sn_publisher/src/main.c @@ -30,7 +30,7 @@ K_SEM_DEFINE(run_app, 0, 1); #define EVENT_MASK (NET_EVENT_L4_CONNECTED | NET_EVENT_L4_DISCONNECTED) -static void net_event_handler(struct net_mgmt_event_callback *cb, uint64_t mgmt_event, +static void net_event_handler(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, struct net_if *iface) { if ((mgmt_event & EVENT_MASK) != mgmt_event) { diff --git a/samples/net/secure_mqtt_sensor_actuator/src/main.c b/samples/net/secure_mqtt_sensor_actuator/src/main.c index 9b6872a69cfc..64993139e900 100644 --- a/samples/net/secure_mqtt_sensor_actuator/src/main.c +++ b/samples/net/secure_mqtt_sensor_actuator/src/main.c @@ -30,7 +30,7 @@ static struct net_mgmt_event_callback net_l4_mgmt_cb; K_SEM_DEFINE(net_conn_sem, 0, 1); static void net_l4_evt_handler(struct net_mgmt_event_callback *cb, - uint64_t mgmt_event, struct net_if *iface) + uint32_t mgmt_event, struct net_if *iface) { switch (mgmt_event) { case NET_EVENT_L4_CONNECTED: diff --git a/samples/net/sockets/coap_download/src/main.c b/samples/net/sockets/coap_download/src/main.c index 2e1ee6c59d33..bb15551cfba4 100644 --- a/samples/net/sockets/coap_download/src/main.c +++ b/samples/net/sockets/coap_download/src/main.c @@ -21,7 +21,7 @@ static int64_t start_time; /* This struct contains (potentially large) TX and RX buffers, so allocate statically */ static struct coap_client client = {0}; -static void net_event_handler(uint64_t mgmt_event, struct net_if *iface, void *info, +static void net_event_handler(uint32_t mgmt_event, struct net_if *iface, void *info, size_t info_length, void *user_data) { if (NET_EVENT_L4_CONNECTED == mgmt_event) { diff --git a/samples/net/sockets/coap_server/src/events.c b/samples/net/sockets/coap_server/src/events.c index 8c621214a7d5..3f843fba0171 100644 --- a/samples/net/sockets/coap_server/src/events.c +++ b/samples/net/sockets/coap_server/src/events.c @@ -13,7 +13,7 @@ LOG_MODULE_DECLARE(net_coap_service_sample); #define COAP_EVENTS_SET (NET_EVENT_COAP_OBSERVER_ADDED | NET_EVENT_COAP_OBSERVER_REMOVED | \ NET_EVENT_COAP_SERVICE_STARTED | NET_EVENT_COAP_SERVICE_STOPPED) -void coap_event_handler(uint64_t mgmt_event, struct net_if *iface, +void coap_event_handler(uint32_t mgmt_event, struct net_if *iface, void *info, size_t info_length, void *user_data) { ARG_UNUSED(iface); diff --git a/samples/net/sockets/dumb_http_server_mt/src/main.c b/samples/net/sockets/dumb_http_server_mt/src/main.c index 4c8a10219239..ed19fa968332 100644 --- a/samples/net/sockets/dumb_http_server_mt/src/main.c +++ b/samples/net/sockets/dumb_http_server_mt/src/main.c @@ -98,7 +98,7 @@ K_THREAD_DEFINE(tcp6_thread_id, STACK_SIZE, NET_EVENT_L4_DISCONNECTED) static void event_handler(struct net_mgmt_event_callback *cb, - uint64_t mgmt_event, struct net_if *iface) + uint32_t mgmt_event, struct net_if *iface) { if ((mgmt_event & EVENT_MASK) != mgmt_event) { return; diff --git a/samples/net/sockets/echo_client/src/echo-client.c b/samples/net/sockets/echo_client/src/echo-client.c index 9c451b9c3ccf..3ca9ddc8aa03 100644 --- a/samples/net/sockets/echo_client/src/echo-client.c +++ b/samples/net/sockets/echo_client/src/echo-client.c @@ -229,7 +229,7 @@ static int check_our_ipv6_sockets(int sock, } static void ipv6_event_handler(struct net_mgmt_event_callback *cb, - uint64_t mgmt_event, struct net_if *iface) + uint32_t mgmt_event, struct net_if *iface) { static char addr_str[INET6_ADDRSTRLEN]; @@ -297,7 +297,7 @@ static void ipv6_event_handler(struct net_mgmt_event_callback *cb, } static void event_handler(struct net_mgmt_event_callback *cb, - uint64_t mgmt_event, struct net_if *iface) + uint32_t mgmt_event, struct net_if *iface) { if ((mgmt_event & EVENT_MASK) != mgmt_event) { return; diff --git a/samples/net/sockets/echo_server/src/echo-server.c b/samples/net/sockets/echo_server/src/echo-server.c index c4dc98b40044..fd6bd4f6acf0 100644 --- a/samples/net/sockets/echo_server/src/echo-server.c +++ b/samples/net/sockets/echo_server/src/echo-server.c @@ -82,7 +82,7 @@ static void stop_udp_and_tcp(void) } static void event_handler(struct net_mgmt_event_callback *cb, - uint64_t mgmt_event, struct net_if *iface) + uint32_t mgmt_event, struct net_if *iface) { ARG_UNUSED(iface); ARG_UNUSED(cb); diff --git a/samples/net/sockets/packet/src/packet.c b/samples/net/sockets/packet/src/packet.c index e4354254b3e8..3b3af25c7ab8 100644 --- a/samples/net/sockets/packet/src/packet.c +++ b/samples/net/sockets/packet/src/packet.c @@ -229,7 +229,7 @@ static void send_packet(void) } static void iface_up_handler(struct net_mgmt_event_callback *cb, - uint64_t mgmt_event, struct net_if *iface) + uint32_t mgmt_event, struct net_if *iface) { if (mgmt_event == NET_EVENT_IF_UP) { k_sem_give(&iface_up); diff --git a/samples/net/sockets/txtime/src/main.c b/samples/net/sockets/txtime/src/main.c index 870e10f8ff7c..d4bc85a3f2a5 100644 --- a/samples/net/sockets/txtime/src/main.c +++ b/samples/net/sockets/txtime/src/main.c @@ -71,7 +71,7 @@ static void quit(void) } static void event_handler(struct net_mgmt_event_callback *cb, - uint64_t mgmt_event, struct net_if *iface) + uint32_t mgmt_event, struct net_if *iface) { static bool dhcpv4_done; diff --git a/samples/net/wifi/apsta_mode/src/main.c b/samples/net/wifi/apsta_mode/src/main.c index aa0d0cb28cbb..eb90b1c21046 100644 --- a/samples/net/wifi/apsta_mode/src/main.c +++ b/samples/net/wifi/apsta_mode/src/main.c @@ -36,7 +36,7 @@ static struct wifi_connect_req_params sta_config; static struct net_mgmt_event_callback cb; -static void wifi_event_handler(struct net_mgmt_event_callback *cb, uint64_t mgmt_event, +static void wifi_event_handler(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, struct net_if *iface) { switch (mgmt_event) { diff --git a/samples/subsys/mgmt/updatehub/src/main.c b/samples/subsys/mgmt/updatehub/src/main.c index 9f9af6ae0037..73d64a1a6947 100644 --- a/samples/subsys/mgmt/updatehub/src/main.c +++ b/samples/subsys/mgmt/updatehub/src/main.c @@ -63,7 +63,7 @@ void start_updatehub(void) } static void event_handler(struct net_mgmt_event_callback *cb, - uint64_t mgmt_event, struct net_if *iface) + uint32_t mgmt_event, struct net_if *iface) { if ((mgmt_event & EVENT_MASK) != mgmt_event) { return; diff --git a/subsys/logging/backends/log_backend_net.c b/subsys/logging/backends/log_backend_net.c index b0e3ca5c4258..11f0612724f2 100644 --- a/subsys/logging/backends/log_backend_net.c +++ b/subsys/logging/backends/log_backend_net.c @@ -367,7 +367,7 @@ const struct log_backend *log_backend_net_get(void) } #if defined(CONFIG_LOG_BACKEND_NET_USE_CONNECTION_MANAGER) -static void l4_event_handler(uint64_t mgmt_event, struct net_if *iface, void *info, +static void l4_event_handler(uint32_t mgmt_event, struct net_if *iface, void *info, size_t info_length, void *user_data) { ARG_UNUSED(iface); diff --git a/subsys/mgmt/mcumgr/transport/src/smp_udp.c b/subsys/mgmt/mcumgr/transport/src/smp_udp.c index e3da22e67312..8067b36d6e63 100644 --- a/subsys/mgmt/mcumgr/transport/src/smp_udp.c +++ b/subsys/mgmt/mcumgr/transport/src/smp_udp.c @@ -280,7 +280,7 @@ static void smp_udp_open_iface(struct net_if *iface, void *user_data) } } -static void smp_udp_net_event_handler(struct net_mgmt_event_callback *cb, uint64_t mgmt_event, +static void smp_udp_net_event_handler(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, struct net_if *iface) { ARG_UNUSED(cb); diff --git a/subsys/net/conn_mgr/conn_mgr_connectivity.c b/subsys/net/conn_mgr/conn_mgr_connectivity.c index 905b5b07d1c5..5bf8e3f58be8 100644 --- a/subsys/net/conn_mgr/conn_mgr_connectivity.c +++ b/subsys/net/conn_mgr/conn_mgr_connectivity.c @@ -315,7 +315,7 @@ static void conn_mgr_conn_handle_iface_down(struct net_if *iface) } static struct net_mgmt_event_callback conn_mgr_conn_iface_cb; -static void conn_mgr_conn_iface_handler(struct net_mgmt_event_callback *cb, uint64_t mgmt_event, +static void conn_mgr_conn_iface_handler(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, struct net_if *iface) { if ((mgmt_event & CONN_MGR_CONN_IFACE_EVENTS_MASK) != mgmt_event) { @@ -333,7 +333,7 @@ static void conn_mgr_conn_iface_handler(struct net_mgmt_event_callback *cb, uint } static struct net_mgmt_event_callback conn_mgr_conn_self_cb; -static void conn_mgr_conn_self_handler(struct net_mgmt_event_callback *cb, uint64_t mgmt_event, +static void conn_mgr_conn_self_handler(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, struct net_if *iface) { if ((mgmt_event & CONN_MGR_CONN_SELF_EVENTS_MASK) != mgmt_event) { diff --git a/subsys/net/conn_mgr/events_handler.c b/subsys/net/conn_mgr/events_handler.c index 2a0c6fefc28e..8f15a8b6c622 100644 --- a/subsys/net/conn_mgr/events_handler.c +++ b/subsys/net/conn_mgr/events_handler.c @@ -19,12 +19,12 @@ static struct net_mgmt_event_callback ipv6_events_cb; static struct net_mgmt_event_callback ipv4_events_cb; static void conn_mgr_iface_events_handler(struct net_mgmt_event_callback *cb, - uint64_t mgmt_event, + uint32_t mgmt_event, struct net_if *iface) { int idx; - NET_DBG("%s event 0x%" PRIx64 " received on iface %d (%p)", "Iface", mgmt_event, + NET_DBG("%s event 0x%x received on iface %d (%p)", "Iface", mgmt_event, net_if_get_by_iface(iface), iface); if ((mgmt_event & CONN_MGR_IFACE_EVENTS_MASK) != mgmt_event) { @@ -55,12 +55,12 @@ static void conn_mgr_iface_events_handler(struct net_mgmt_event_callback *cb, #if defined(CONFIG_NET_IPV6) static void conn_mgr_ipv6_events_handler(struct net_mgmt_event_callback *cb, - uint64_t mgmt_event, + uint32_t mgmt_event, struct net_if *iface) { int idx; - NET_DBG("%s event 0x%" PRIx64 " received on iface %d (%p)", "IPv6", mgmt_event, + NET_DBG("%s event 0x%x received on iface %d (%p)", "IPv6", mgmt_event, net_if_get_by_iface(iface), iface); if ((mgmt_event & CONN_MGR_IPV6_EVENTS_MASK) != mgmt_event) { @@ -101,7 +101,7 @@ static void conn_mgr_ipv6_events_handler(struct net_mgmt_event_callback *cb, #else static inline void conn_mgr_ipv6_events_handler(struct net_mgmt_event_callback *cb, - uint64_t mgmt_event, + uint32_t mgmt_event, struct net_if *iface) { ARG_UNUSED(cb); @@ -112,12 +112,12 @@ void conn_mgr_ipv6_events_handler(struct net_mgmt_event_callback *cb, #if defined(CONFIG_NET_IPV4) static void conn_mgr_ipv4_events_handler(struct net_mgmt_event_callback *cb, - uint64_t mgmt_event, + uint32_t mgmt_event, struct net_if *iface) { int idx; - NET_DBG("%s event 0x%" PRIx64 " received on iface %d (%p)", "IPv4", mgmt_event, + NET_DBG("%s event 0x%x received on iface %d (%p)", "IPv4", mgmt_event, net_if_get_by_iface(iface), iface); if ((mgmt_event & CONN_MGR_IPV4_EVENTS_MASK) != mgmt_event) { @@ -159,7 +159,7 @@ static void conn_mgr_ipv4_events_handler(struct net_mgmt_event_callback *cb, #else static inline void conn_mgr_ipv4_events_handler(struct net_mgmt_event_callback *cb, - uint64_t mgmt_event, + uint32_t mgmt_event, struct net_if *iface) { ARG_UNUSED(cb); diff --git a/subsys/net/ip/ipv4_autoconf.c b/subsys/net/ip/ipv4_autoconf.c index ad399622a994..f08608f3b7e2 100644 --- a/subsys/net/ip/ipv4_autoconf.c +++ b/subsys/net/ip/ipv4_autoconf.c @@ -55,7 +55,7 @@ static inline void ipv4_autoconf_addr_set(struct net_if_ipv4_autoconf *ipv4auto) } static void acd_event_handler(struct net_mgmt_event_callback *cb, - uint64_t mgmt_event, struct net_if *iface) + uint32_t mgmt_event, struct net_if *iface) { struct net_if_config *cfg; struct in_addr *addr; diff --git a/subsys/net/ip/ipv6_pe.c b/subsys/net/ip/ipv6_pe.c index bb03683db39f..4379dc47e7e5 100644 --- a/subsys/net/ip/ipv6_pe.c +++ b/subsys/net/ip/ipv6_pe.c @@ -501,7 +501,7 @@ static void ipv6_pe_recheck_filters(bool is_denylist) #if CONFIG_NET_IPV6_PE_FILTER_PREFIX_COUNT > 0 static void send_filter_event(struct in6_addr *addr, bool is_denylist, - uint64_t event_type) + int event_type) { if (IS_ENABLED(CONFIG_NET_MGMT_EVENT_INFO)) { struct net_event_ipv6_pe_filter info; diff --git a/subsys/net/ip/net_mgmt.c b/subsys/net/ip/net_mgmt.c index d48a54e56110..4fbc1a1b5997 100644 --- a/subsys/net/ip/net_mgmt.c +++ b/subsys/net/ip/net_mgmt.c @@ -27,7 +27,7 @@ struct mgmt_event_entry { #endif /* CONFIG_NET_MGMT_EVENT_QUEUE */ size_t info_length; #endif /* CONFIG_NET_MGMT_EVENT_INFO */ - uint64_t event; + uint32_t event; struct net_if *iface; }; @@ -47,7 +47,7 @@ K_KERNEL_STACK_DEFINE(mgmt_stack, CONFIG_NET_MGMT_EVENT_STACK_SIZE); static struct k_work_q mgmt_work_q_obj; #endif -static uint64_t global_event_mask; +static uint32_t global_event_mask; static sys_slist_t event_callbacks = SYS_SLIST_STATIC_INIT(&event_callbacks); /* Forward declaration for the actual caller */ @@ -67,7 +67,7 @@ static struct k_work_q *mgmt_work_q = COND_CODE_1(CONFIG_NET_MGMT_EVENT_SYSTEM_W static void mgmt_event_work_handler(struct k_work *work); static K_WORK_DEFINE(mgmt_work, mgmt_event_work_handler); -static inline void mgmt_push_event(uint64_t mgmt_event, struct net_if *iface, +static inline void mgmt_push_event(uint32_t mgmt_event, struct net_if *iface, const void *info, size_t length) { #ifndef CONFIG_NET_MGMT_EVENT_INFO @@ -85,7 +85,7 @@ static inline void mgmt_push_event(uint64_t mgmt_event, struct net_if *iface, memcpy(new_event.info, info, length); new_event.info_length = length; } else { - NET_ERR("Event 0x%" PRIx64 " info length %zu > max size %zu", + NET_ERR("Event %u info length %zu > max size %zu", mgmt_event, length, NET_EVENT_INFO_MAX_SIZE); (void)k_mutex_unlock(&net_mgmt_event_lock); @@ -99,7 +99,7 @@ static inline void mgmt_push_event(uint64_t mgmt_event, struct net_if *iface, if (k_msgq_put(&event_msgq, &new_event, K_MSEC(CONFIG_NET_MGMT_EVENT_QUEUE_TIMEOUT)) != 0) { - NET_WARN("Failure to push event (0x%" PRIx64 "), " + NET_WARN("Failure to push event (%u), " "try increasing the 'CONFIG_NET_MGMT_EVENT_QUEUE_SIZE' " "or 'CONFIG_NET_MGMT_EVENT_QUEUE_TIMEOUT' options.", mgmt_event); @@ -128,7 +128,7 @@ static void mgmt_event_work_handler(struct k_work *work) #else -static inline void mgmt_push_event(uint64_t event, struct net_if *iface, +static inline void mgmt_push_event(uint32_t event, struct net_if *iface, const void *info, size_t length) { #ifndef CONFIG_NET_MGMT_EVENT_INFO @@ -149,7 +149,7 @@ static inline void mgmt_push_event(uint64_t event, struct net_if *iface, #endif /* CONFIG_NET_MGMT_EVENT_QUEUE */ -static inline void mgmt_add_event_mask(uint64_t event_mask) +static inline void mgmt_add_event_mask(uint32_t event_mask) { global_event_mask |= event_mask; } @@ -169,7 +169,7 @@ static inline void mgmt_rebuild_global_event_mask(void) } } -static inline bool mgmt_is_event_handled(uint64_t mgmt_event) +static inline bool mgmt_is_event_handled(uint32_t mgmt_event) { return (((NET_MGMT_GET_LAYER(mgmt_event) & NET_MGMT_GET_LAYER(global_event_mask)) == @@ -188,7 +188,7 @@ static inline void mgmt_run_slist_callbacks(const struct mgmt_event_entry * cons struct net_mgmt_event_callback *cb, *tmp; /* Readable layer code is starting from 1, thus the increment */ - NET_DBG("Event layer 0x%" PRIx64 " code 0x%" PRIx64 " cmd 0x%" PRIx64, + NET_DBG("Event layer %u code %u cmd %u", NET_MGMT_GET_LAYER(mgmt_event->event) + 1, NET_MGMT_GET_LAYER_CODE(mgmt_event->event), NET_MGMT_GET_COMMAND(mgmt_event->event)); @@ -283,8 +283,8 @@ static void mgmt_run_callbacks(const struct mgmt_event_entry * const mgmt_event) } static int mgmt_event_wait_call(struct net_if *iface, - uint64_t mgmt_event_mask, - uint64_t *raised_event, + uint32_t mgmt_event_mask, + uint32_t *raised_event, struct net_if **event_iface, const void **info, size_t *info_length, @@ -303,7 +303,7 @@ static int mgmt_event_wait_call(struct net_if *iface, sync_data.iface = iface; } - NET_DBG("Synchronous event 0x%" PRIx64 " wait %p", sync.event_mask, &sync); + NET_DBG("Synchronous event 0x%08x wait %p", sync.event_mask, &sync); net_mgmt_add_event_callback(&sync); @@ -367,12 +367,12 @@ void net_mgmt_del_event_callback(struct net_mgmt_event_callback *cb) (void)k_mutex_unlock(&net_mgmt_callback_lock); } -void net_mgmt_event_notify_with_info(uint64_t mgmt_event, struct net_if *iface, +void net_mgmt_event_notify_with_info(uint32_t mgmt_event, struct net_if *iface, const void *info, size_t length) { if (mgmt_is_event_handled(mgmt_event)) { /* Readable layer code is starting from 1, thus the increment */ - NET_DBG("Notifying Event layer 0x%" PRIx64 " code 0x%" PRIx64 " type 0x%" PRIx64, + NET_DBG("Notifying Event layer %u code %u type %u", NET_MGMT_GET_LAYER(mgmt_event) + 1, NET_MGMT_GET_LAYER_CODE(mgmt_event), NET_MGMT_GET_COMMAND(mgmt_event)); @@ -381,8 +381,8 @@ void net_mgmt_event_notify_with_info(uint64_t mgmt_event, struct net_if *iface, } } -int net_mgmt_event_wait(uint64_t mgmt_event_mask, - uint64_t *raised_event, +int net_mgmt_event_wait(uint32_t mgmt_event_mask, + uint32_t *raised_event, struct net_if **iface, const void **info, size_t *info_length, @@ -394,8 +394,8 @@ int net_mgmt_event_wait(uint64_t mgmt_event_mask, } int net_mgmt_event_wait_on_iface(struct net_if *iface, - uint64_t mgmt_event_mask, - uint64_t *raised_event, + uint32_t mgmt_event_mask, + uint32_t *raised_event, const void **info, size_t *info_length, k_timeout_t timeout) diff --git a/subsys/net/ip/net_stats.c b/subsys/net/ip/net_stats.c index 9e7d0bb6fc7b..5da625faeb6d 100644 --- a/subsys/net/ip/net_stats.c +++ b/subsys/net/ip/net_stats.c @@ -252,7 +252,7 @@ void net_print_statistics(void) #if defined(CONFIG_NET_STATISTICS_USER_API) -static int net_stats_get(uint64_t mgmt_request, struct net_if *iface, +static int net_stats_get(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { size_t len_chk = 0; diff --git a/subsys/net/ip/pmtu.c b/subsys/net/ip/pmtu.c index cdd09ed0ca83..be2c3355a6b4 100644 --- a/subsys/net/ip/pmtu.c +++ b/subsys/net/ip/pmtu.c @@ -12,6 +12,7 @@ LOG_MODULE_REGISTER(net_pmtu, CONFIG_NET_PMTU_LOG_LEVEL); #include +#include #include #include #include "pmtu.h" diff --git a/subsys/net/l2/ethernet/arp.c b/subsys/net/l2/ethernet/arp.c index d49ab054eaa9..af816185fe1b 100644 --- a/subsys/net/l2/ethernet/arp.c +++ b/subsys/net/l2/ethernet/arp.c @@ -569,7 +569,7 @@ static void notify_all_ipv4_addr(struct net_if *iface) } static void iface_event_handler(struct net_mgmt_event_callback *cb, - uint64_t mgmt_event, struct net_if *iface) + uint32_t mgmt_event, struct net_if *iface) { ARG_UNUSED(cb); @@ -586,7 +586,7 @@ static void iface_event_handler(struct net_mgmt_event_callback *cb, } static void ipv4_event_handler(struct net_mgmt_event_callback *cb, - uint64_t mgmt_event, struct net_if *iface) + uint32_t mgmt_event, struct net_if *iface) { struct in_addr *ipaddr; diff --git a/subsys/net/l2/ethernet/ethernet_mgmt.c b/subsys/net/l2/ethernet/ethernet_mgmt.c index 15efbc4f37c3..3f1b6735318a 100644 --- a/subsys/net/l2/ethernet/ethernet_mgmt.c +++ b/subsys/net/l2/ethernet/ethernet_mgmt.c @@ -25,7 +25,7 @@ static inline bool is_hw_caps_supported(const struct device *dev, return ((api->get_capabilities(dev) & caps) != 0); } -static int ethernet_set_config(uint64_t mgmt_request, +static int ethernet_set_config(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { @@ -255,7 +255,7 @@ NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_ETHERNET_SET_TXINJECTION_MODE, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_ETHERNET_SET_MAC_FILTER, ethernet_set_config); -static int ethernet_get_config(uint64_t mgmt_request, +static int ethernet_get_config(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { diff --git a/subsys/net/l2/ethernet/ethernet_stats.c b/subsys/net/l2/ethernet/ethernet_stats.c index 57d354623f66..ccbbd53e2f2d 100644 --- a/subsys/net/l2/ethernet/ethernet_stats.c +++ b/subsys/net/l2/ethernet/ethernet_stats.c @@ -17,7 +17,7 @@ LOG_MODULE_REGISTER(net_ethernet_stats, CONFIG_NET_L2_ETHERNET_LOG_LEVEL); #if defined(CONFIG_NET_STATISTICS_USER_API) -static int eth_stats_get(uint64_t mgmt_request, struct net_if *iface, +static int eth_stats_get(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { size_t len_chk = 0; diff --git a/subsys/net/l2/ethernet/lldp/lldp.c b/subsys/net/l2/ethernet/lldp/lldp.c index 230e69eb6b81..2895691d6f0a 100644 --- a/subsys/net/l2/ethernet/lldp/lldp.c +++ b/subsys/net/l2/ethernet/lldp/lldp.c @@ -234,7 +234,7 @@ static int lldp_check_iface(struct net_if *iface) return 0; } -static int lldp_start(struct net_if *iface, uint64_t mgmt_event) +static int lldp_start(struct net_if *iface, uint32_t mgmt_event) { struct ethernet_context *ctx; int ret, slot; @@ -328,7 +328,7 @@ int net_lldp_register_callback(struct net_if *iface, net_lldp_recv_cb_t recv_cb) } static void iface_event_handler(struct net_mgmt_event_callback *evt_cb, - uint64_t mgmt_event, struct net_if *iface) + uint32_t mgmt_event, struct net_if *iface) { lldp_start(iface, mgmt_event); } diff --git a/subsys/net/l2/ieee802154/ieee802154_mgmt.c b/subsys/net/l2/ieee802154/ieee802154_mgmt.c index 3c654c375b67..993bcc12ae91 100644 --- a/subsys/net/l2/ieee802154/ieee802154_mgmt.c +++ b/subsys/net/l2/ieee802154/ieee802154_mgmt.c @@ -74,7 +74,7 @@ enum net_verdict ieee802154_handle_beacon(struct net_if *iface, return NET_CONTINUE; } -static int ieee802154_cancel_scan(uint64_t mgmt_request, struct net_if *iface, +static int ieee802154_cancel_scan(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { struct ieee802154_context *ctx = net_if_l2_data(iface); @@ -94,7 +94,7 @@ static int ieee802154_cancel_scan(uint64_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_IEEE802154_CANCEL_SCAN, ieee802154_cancel_scan); -static int ieee802154_scan(uint64_t mgmt_request, struct net_if *iface, +static int ieee802154_scan(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct ieee802154_phy_supported_channels *supported_channels; @@ -437,7 +437,7 @@ enum net_verdict ieee802154_handle_mac_command(struct net_if *iface, return NET_DROP; } -static int ieee802154_associate(uint64_t mgmt_request, struct net_if *iface, +static int ieee802154_associate(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { struct ieee802154_context *ctx = net_if_l2_data(iface); @@ -631,7 +631,7 @@ static int ieee802154_associate(uint64_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_IEEE802154_ASSOCIATE, ieee802154_associate); -static int ieee802154_disassociate(uint64_t mgmt_request, struct net_if *iface, +static int ieee802154_disassociate(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { struct ieee802154_context *ctx = net_if_l2_data(iface); @@ -706,7 +706,7 @@ static int ieee802154_disassociate(uint64_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_IEEE802154_DISASSOCIATE, ieee802154_disassociate); -static int ieee802154_set_ack(uint64_t mgmt_request, struct net_if *iface, +static int ieee802154_set_ack(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { struct ieee802154_context *ctx = net_if_l2_data(iface); @@ -733,7 +733,7 @@ NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_IEEE802154_SET_ACK, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_IEEE802154_UNSET_ACK, ieee802154_set_ack); -static int ieee802154_set_parameters(uint64_t mgmt_request, +static int ieee802154_set_parameters(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { @@ -851,7 +851,7 @@ NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_IEEE802154_SET_SHORT_ADDR, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_IEEE802154_SET_TX_POWER, ieee802154_set_parameters); -static int ieee802154_get_parameters(uint64_t mgmt_request, +static int ieee802154_get_parameters(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { @@ -914,7 +914,7 @@ NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_IEEE802154_GET_TX_POWER, #ifdef CONFIG_NET_L2_IEEE802154_SECURITY -static int ieee802154_set_security_settings(uint64_t mgmt_request, +static int ieee802154_set_security_settings(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { @@ -953,7 +953,7 @@ static int ieee802154_set_security_settings(uint64_t mgmt_request, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_IEEE802154_SET_SECURITY_SETTINGS, ieee802154_set_security_settings); -static int ieee802154_get_security_settings(uint64_t mgmt_request, +static int ieee802154_get_security_settings(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { diff --git a/subsys/net/l2/ieee802154/ieee802154_shell.c b/subsys/net/l2/ieee802154/ieee802154_shell.c index 777e7c6e46f3..8a4e6ab0b6c3 100644 --- a/subsys/net/l2/ieee802154/ieee802154_shell.c +++ b/subsys/net/l2/ieee802154/ieee802154_shell.c @@ -209,7 +209,7 @@ static inline char *print_coordinator_address(char *buf, int buf_len) } static void scan_result_cb(struct net_mgmt_event_callback *cb, - uint64_t mgmt_event, struct net_if *iface) + uint32_t mgmt_event, struct net_if *iface) { char buf[64]; @@ -224,7 +224,7 @@ static int cmd_ieee802154_scan(const struct shell *sh, size_t argc, char *argv[]) { struct net_if *iface = net_if_get_ieee802154(); - uint64_t scan_type; + uint32_t scan_type; int ret = 0; if (argc < 3) { diff --git a/subsys/net/l2/openthread/openthread.c b/subsys/net/l2/openthread/openthread.c index 4ed6a34162f8..6ddeadf8dfcf 100644 --- a/subsys/net/l2/openthread/openthread.c +++ b/subsys/net/l2/openthread/openthread.c @@ -34,7 +34,7 @@ static struct openthread_state_changed_callback ot_l2_state_changed_cb; #ifdef CONFIG_NET_MGMT_EVENT static struct net_mgmt_event_callback ip6_addr_cb; -static void ipv6_addr_event_handler(struct net_mgmt_event_callback *cb, uint64_t mgmt_event, +static void ipv6_addr_event_handler(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, struct net_if *iface) { if (net_if_l2(iface) != &NET_L2_GET_NAME(OPENTHREAD)) { diff --git a/subsys/net/l2/ppp/ppp_l2.c b/subsys/net/l2/ppp/ppp_l2.c index ae573a6e7cee..5521d76470e3 100644 --- a/subsys/net/l2/ppp/ppp_l2.c +++ b/subsys/net/l2/ppp/ppp_l2.c @@ -474,7 +474,7 @@ static void tx_handler(void *p1, void *p2, void *p3) } } -static void net_ppp_mgmt_evt_handler(struct net_mgmt_event_callback *cb, uint64_t mgmt_event, +static void net_ppp_mgmt_evt_handler(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, struct net_if *iface) { struct ppp_context *ctx; diff --git a/subsys/net/l2/virtual/virtual_mgmt.c b/subsys/net/l2/virtual/virtual_mgmt.c index c6187e0dd9f5..1210fc59083e 100644 --- a/subsys/net/l2/virtual/virtual_mgmt.c +++ b/subsys/net/l2/virtual/virtual_mgmt.c @@ -13,7 +13,7 @@ LOG_MODULE_REGISTER(net_virtual_mgmt, CONFIG_NET_L2_VIRTUAL_LOG_LEVEL); #include #include -static int virtual_interface_set_config(uint64_t mgmt_request, +static int virtual_interface_set_config(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { @@ -89,7 +89,7 @@ NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_VIRTUAL_INTERFACE_SET_LINK_TYPE, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_VIRTUAL_INTERFACE_SET_PRIVATE_KEY, virtual_interface_set_config); -static int virtual_interface_get_config(uint64_t mgmt_request, +static int virtual_interface_get_config(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { diff --git a/subsys/net/l2/wifi/wifi_mgmt.c b/subsys/net/l2/wifi/wifi_mgmt.c index 0183faab1d50..dc52c42a5c2f 100644 --- a/subsys/net/l2/wifi/wifi_mgmt.c +++ b/subsys/net/l2/wifi/wifi_mgmt.c @@ -371,7 +371,7 @@ static const struct wifi_mgmt_ops *const get_wifi_api(struct net_if *iface) return off_api ? off_api->wifi_mgmt_api : NULL; } -static int wifi_connect(uint64_t mgmt_request, struct net_if *iface, +static int wifi_connect(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { struct wifi_connect_req_params *params = @@ -475,7 +475,7 @@ static void scan_result_cb(struct net_if *iface, int status, #endif /* CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS_ONLY */ } -static int wifi_scan(uint64_t mgmt_request, struct net_if *iface, +static int wifi_scan(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -504,7 +504,7 @@ static int wifi_scan(uint64_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_SCAN, wifi_scan); -static int wifi_disconnect(uint64_t mgmt_request, struct net_if *iface, +static int wifi_disconnect(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -546,7 +546,7 @@ void wifi_mgmt_raise_disconnect_result_event(struct net_if *iface, int status) } #ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_ROAMING -static int wifi_start_roaming(uint64_t mgmt_request, struct net_if *iface, +static int wifi_start_roaming(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -589,7 +589,7 @@ static int wifi_start_roaming(uint64_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_START_ROAMING, wifi_start_roaming); -static int wifi_neighbor_rep_complete(uint64_t mgmt_request, struct net_if *iface, +static int wifi_neighbor_rep_complete(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -684,7 +684,7 @@ void wifi_mgmt_raise_neighbor_rep_recv_event(struct net_if *iface, char *inbuf, } #endif -static int wifi_ap_enable(uint64_t mgmt_request, struct net_if *iface, +static int wifi_ap_enable(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { struct wifi_connect_req_params *params = @@ -705,7 +705,7 @@ static int wifi_ap_enable(uint64_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_AP_ENABLE, wifi_ap_enable); -static int wifi_ap_disable(uint64_t mgmt_request, struct net_if *iface, +static int wifi_ap_disable(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -724,7 +724,7 @@ static int wifi_ap_disable(uint64_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_AP_DISABLE, wifi_ap_disable); -static int wifi_ap_sta_disconnect(uint64_t mgmt_request, struct net_if *iface, +static int wifi_ap_sta_disconnect(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -752,7 +752,7 @@ static int wifi_ap_sta_disconnect(uint64_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_AP_STA_DISCONNECT, wifi_ap_sta_disconnect); -static int wifi_ap_config_params(uint64_t mgmt_request, struct net_if *iface, +static int wifi_ap_config_params(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -790,7 +790,7 @@ static int wifi_ap_config_params(uint64_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_AP_CONFIG_PARAM, wifi_ap_config_params); -static int wifi_ap_set_rts_threshold(uint64_t mgmt_request, struct net_if *iface, +static int wifi_ap_set_rts_threshold(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -814,7 +814,7 @@ static int wifi_ap_set_rts_threshold(uint64_t mgmt_request, struct net_if *iface NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_AP_RTS_THRESHOLD, wifi_ap_set_rts_threshold); -static int wifi_iface_status(uint64_t mgmt_request, struct net_if *iface, +static int wifi_iface_status(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -842,7 +842,7 @@ void wifi_mgmt_raise_iface_status_event(struct net_if *iface, } #ifdef CONFIG_NET_STATISTICS_WIFI -static int wifi_iface_stats(uint64_t mgmt_request, struct net_if *iface, +static int wifi_iface_stats(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -861,7 +861,7 @@ static int wifi_iface_stats(uint64_t mgmt_request, struct net_if *iface, } NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_STATS_GET_WIFI, wifi_iface_stats); -static int wifi_iface_stats_reset(uint64_t mgmt_request, struct net_if *iface, +static int wifi_iface_stats_reset(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -876,7 +876,7 @@ static int wifi_iface_stats_reset(uint64_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_STATS_RESET_WIFI, wifi_iface_stats_reset); #endif /* CONFIG_NET_STATISTICS_WIFI */ -static int wifi_11k_cfg(uint64_t mgmt_request, struct net_if *iface, +static int wifi_11k_cfg(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -902,7 +902,7 @@ static int wifi_11k_cfg(uint64_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_11K_CONFIG, wifi_11k_cfg); -static int wifi_11k_neighbor_request(uint64_t mgmt_request, struct net_if *iface, +static int wifi_11k_neighbor_request(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -923,7 +923,7 @@ static int wifi_11k_neighbor_request(uint64_t mgmt_request, struct net_if *iface NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_11K_NEIGHBOR_REQUEST, wifi_11k_neighbor_request); -static int wifi_set_power_save(uint64_t mgmt_request, struct net_if *iface, +static int wifi_set_power_save(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -977,7 +977,7 @@ static int wifi_set_power_save(uint64_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_PS, wifi_set_power_save); -static int wifi_get_power_save_config(uint64_t mgmt_request, struct net_if *iface, +static int wifi_get_power_save_config(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -1001,7 +1001,7 @@ static int wifi_get_power_save_config(uint64_t mgmt_request, struct net_if *ifac NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_PS_CONFIG, wifi_get_power_save_config); -static int wifi_set_twt(uint64_t mgmt_request, struct net_if *iface, +static int wifi_set_twt(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -1068,7 +1068,7 @@ static int wifi_set_twt(uint64_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_TWT, wifi_set_twt); -static int wifi_set_btwt(uint64_t mgmt_request, struct net_if *iface, +static int wifi_set_btwt(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -1108,7 +1108,7 @@ void wifi_mgmt_raise_twt_event(struct net_if *iface, struct wifi_twt_params *twt sizeof(struct wifi_twt_params)); } -static int wifi_reg_domain(uint64_t mgmt_request, struct net_if *iface, +static int wifi_reg_domain(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -1140,7 +1140,7 @@ void wifi_mgmt_raise_twt_sleep_state(struct net_if *iface, sizeof(twt_sleep_state)); } -static int wifi_mode(uint64_t mgmt_request, struct net_if *iface, +static int wifi_mode(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -1164,7 +1164,7 @@ static int wifi_mode(uint64_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_MODE, wifi_mode); -static int wifi_packet_filter(uint64_t mgmt_request, struct net_if *iface, +static int wifi_packet_filter(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -1188,7 +1188,7 @@ static int wifi_packet_filter(uint64_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_PACKET_FILTER, wifi_packet_filter); -static int wifi_channel(uint64_t mgmt_request, struct net_if *iface, +static int wifi_channel(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -1212,7 +1212,7 @@ static int wifi_channel(uint64_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_CHANNEL, wifi_channel); -static int wifi_get_version(uint64_t mgmt_request, struct net_if *iface, +static int wifi_get_version(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -1228,7 +1228,7 @@ static int wifi_get_version(uint64_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_VERSION, wifi_get_version); -static int wifi_btm_query(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) +static int wifi_btm_query(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); const struct wifi_mgmt_ops *const wifi_mgmt_api = get_wifi_api(iface); @@ -1252,7 +1252,7 @@ static int wifi_btm_query(uint64_t mgmt_request, struct net_if *iface, void *dat NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_BTM_QUERY, wifi_btm_query); -static int wifi_get_connection_params(uint64_t mgmt_request, struct net_if *iface, +static int wifi_get_connection_params(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -1272,7 +1272,7 @@ static int wifi_get_connection_params(uint64_t mgmt_request, struct net_if *ifac NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_CONN_PARAMS, wifi_get_connection_params); -static int wifi_wps_config(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) +static int wifi_wps_config(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); const struct wifi_mgmt_ops *const wifi_mgmt_api = get_wifi_api(iface); @@ -1291,7 +1291,7 @@ static int wifi_wps_config(uint64_t mgmt_request, struct net_if *iface, void *da NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_WPS_CONFIG, wifi_wps_config); -static int wifi_set_rts_threshold(uint64_t mgmt_request, struct net_if *iface, +static int wifi_set_rts_threshold(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -1316,7 +1316,7 @@ static int wifi_set_rts_threshold(uint64_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_RTS_THRESHOLD, wifi_set_rts_threshold); #ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_DPP -static int wifi_dpp(uint64_t mgmt_request, struct net_if *iface, +static int wifi_dpp(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -1338,7 +1338,7 @@ NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_DPP, wifi_dpp); #endif /* CONFIG_WIFI_NM_WPA_SUPPLICANT_DPP */ -static int wifi_pmksa_flush(uint64_t mgmt_request, struct net_if *iface, +static int wifi_pmksa_flush(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -1357,7 +1357,7 @@ static int wifi_pmksa_flush(uint64_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_PMKSA_FLUSH, wifi_pmksa_flush); -static int wifi_get_rts_threshold(uint64_t mgmt_request, struct net_if *iface, +static int wifi_get_rts_threshold(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -1382,7 +1382,7 @@ static int wifi_get_rts_threshold(uint64_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_RTS_THRESHOLD_CONFIG, wifi_get_rts_threshold); #ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE -static int wifi_set_enterprise_creds(uint64_t mgmt_request, struct net_if *iface, +static int wifi_set_enterprise_creds(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -1721,7 +1721,7 @@ static int add_static_network_config(struct net_if *iface) #endif /* defined(CONFIG_WIFI_CREDENTIALS_STATIC) */ } -static int connect_stored_command(uint64_t mgmt_request, struct net_if *iface, void *data, +static int connect_stored_command(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { int ret = 0; diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 8a5468ba81b1..07514b53a336 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -518,7 +518,7 @@ static void handle_wifi_neighbor_rep_complete(struct net_mgmt_event_callback *cb #endif static void wifi_mgmt_event_handler(struct net_mgmt_event_callback *cb, - uint64_t mgmt_event, struct net_if *iface) + uint32_t mgmt_event, struct net_if *iface) { switch (mgmt_event) { case NET_EVENT_WIFI_CONNECT_RESULT: @@ -556,7 +556,7 @@ static void wifi_mgmt_event_handler(struct net_mgmt_event_callback *cb, } static void wifi_mgmt_scan_event_handler(struct net_mgmt_event_callback *cb, - uint64_t mgmt_event, struct net_if *iface) + uint32_t mgmt_event, struct net_if *iface) { switch (mgmt_event) { case NET_EVENT_WIFI_SCAN_RESULT: diff --git a/subsys/net/lib/coap/coap.c b/subsys/net/lib/coap/coap.c index 4ba5f4d309ef..b1d00a46f1dd 100644 --- a/subsys/net/lib/coap/coap.c +++ b/subsys/net/lib/coap/coap.c @@ -1956,7 +1956,7 @@ void coap_observer_init(struct coap_observer *observer, static inline void coap_observer_raise_event(struct coap_resource *resource, struct coap_observer *observer, - uint64_t mgmt_event) + uint32_t mgmt_event) { #ifdef CONFIG_NET_MGMT_EVENT_INFO const struct net_event_coap_observer net_event = { diff --git a/subsys/net/lib/coap/coap_server.c b/subsys/net/lib/coap/coap_server.c index 27e4267167ff..6ab85ede3f1a 100644 --- a/subsys/net/lib/coap/coap_server.c +++ b/subsys/net/lib/coap/coap_server.c @@ -385,7 +385,7 @@ static inline bool coap_service_in_section(const struct coap_service *service) STRUCT_SECTION_END(coap_service) > service; } -static inline void coap_service_raise_event(const struct coap_service *service, uint64_t mgmt_event) +static inline void coap_service_raise_event(const struct coap_service *service, uint32_t mgmt_event) { #if defined(CONFIG_NET_MGMT_EVENT_INFO) const struct net_event_coap_service net_event = { diff --git a/subsys/net/lib/config/init.c b/subsys/net/lib/config/init.c index 22500fd8f844..56b6bc03b6cf 100644 --- a/subsys/net/lib/config/init.c +++ b/subsys/net/lib/config/init.c @@ -102,7 +102,7 @@ static void print_dhcpv4_info(struct net_if *iface) static struct net_mgmt_event_callback mgmt4_cb; static void ipv4_addr_add_handler(struct net_mgmt_event_callback *cb, - uint64_t mgmt_event, + uint32_t mgmt_event, struct net_if *iface) { if (mgmt_event == NET_EVENT_IPV4_ADDR_ADD) { @@ -244,7 +244,7 @@ static struct net_mgmt_event_callback mgmt6_cb; static struct in6_addr laddr; static void ipv6_event_handler(struct net_mgmt_event_callback *cb, - uint64_t mgmt_event, struct net_if *iface) + uint32_t mgmt_event, struct net_if *iface) { struct net_if_ipv6 *ipv6 = iface->config.ip.ipv6; int i; @@ -310,7 +310,7 @@ static void ipv6_event_handler(struct net_mgmt_event_callback *cb, static void setup_ipv6(struct net_if *iface, uint32_t flags) { struct net_if_addr *ifaddr; - uint64_t mask = NET_EVENT_IPV6_DAD_SUCCEED; + uint32_t mask = NET_EVENT_IPV6_DAD_SUCCEED; if (sizeof(CONFIG_NET_CONFIG_MY_IPV6_ADDR) == 1) { /* Empty address, skip setting ANY address in this case */ @@ -330,10 +330,20 @@ static void setup_ipv6(struct net_if *iface, uint32_t flags) net_mgmt_init_event_callback(&mgmt6_cb, ipv6_event_handler, mask); net_mgmt_add_event_callback(&mgmt6_cb); - ifaddr = net_if_ipv6_addr_add(iface, &laddr, NET_ADDR_MANUAL, 0); - if (!ifaddr) { - NET_ERR("Cannot add %s to interface", - CONFIG_NET_CONFIG_MY_IPV6_ADDR); + /* + * check for CMD_ADDR_ADD bit here, NET_EVENT_IPV6_ADDR_ADD is + * a combination of _NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_ADDR_ADD + * so it will always return != NET_EVENT_IPV6_CMD_ADDR_ADD if any other + * event is set (for instance NET_EVENT_IPV6_ROUTER_ADD) + */ + if ((mask & NET_EVENT_IPV6_CMD_ADDR_ADD) == + NET_EVENT_IPV6_CMD_ADDR_ADD) { + ifaddr = net_if_ipv6_addr_add(iface, &laddr, + NET_ADDR_MANUAL, 0); + if (!ifaddr) { + NET_ERR("Cannot add %s to interface", + CONFIG_NET_CONFIG_MY_IPV6_ADDR); + } } exit: @@ -353,7 +363,7 @@ static void setup_ipv6(struct net_if *iface, uint32_t flags) #if defined(CONFIG_NET_NATIVE) static void iface_up_handler(struct net_mgmt_event_callback *cb, - uint64_t mgmt_event, struct net_if *iface) + uint32_t mgmt_event, struct net_if *iface) { if (mgmt_event == NET_EVENT_IF_UP) { NET_INFO("Interface %d (%p) coming up", diff --git a/subsys/net/lib/config/init_clock_sntp.c b/subsys/net/lib/config/init_clock_sntp.c index 0e2b9aa13626..dd63564f9c02 100644 --- a/subsys/net/lib/config/init_clock_sntp.c +++ b/subsys/net/lib/config/init_clock_sntp.c @@ -89,7 +89,7 @@ static void sntp_resync_handler(struct k_work *work) #endif /* CONFIG_NET_CONFIG_SNTP_INIT_RESYNC */ #ifdef CONFIG_NET_CONFIG_SNTP_INIT_USE_CONNECTION_MANAGER -static void l4_event_handler(uint64_t mgmt_event, struct net_if *iface, void *info, +static void l4_event_handler(uint32_t mgmt_event, struct net_if *iface, void *info, size_t info_length, void *user_data) { ARG_UNUSED(iface); diff --git a/subsys/net/lib/dhcpv4/dhcpv4.c b/subsys/net/lib/dhcpv4/dhcpv4.c index f9a20bb7dfed..2096bf330d9e 100644 --- a/subsys/net/lib/dhcpv4/dhcpv4.c +++ b/subsys/net/lib/dhcpv4/dhcpv4.c @@ -1637,7 +1637,7 @@ static enum net_verdict net_dhcpv4_input(struct net_conn *conn, } static void dhcpv4_iface_event_handler(struct net_mgmt_event_callback *cb, - uint64_t mgmt_event, struct net_if *iface) + uint32_t mgmt_event, struct net_if *iface) { sys_snode_t *node = NULL; @@ -1699,7 +1699,7 @@ static void dhcpv4_iface_event_handler(struct net_mgmt_event_callback *cb, #if defined(CONFIG_NET_IPV4_ACD) static void dhcpv4_acd_event_handler(struct net_mgmt_event_callback *cb, - uint64_t mgmt_event, struct net_if *iface) + uint32_t mgmt_event, struct net_if *iface) { sys_snode_t *node = NULL; struct in_addr *addr; diff --git a/subsys/net/lib/dhcpv6/dhcpv6.c b/subsys/net/lib/dhcpv6/dhcpv6.c index 88770bac66d9..c1282c2a6f12 100644 --- a/subsys/net/lib/dhcpv6/dhcpv6.c +++ b/subsys/net/lib/dhcpv6/dhcpv6.c @@ -2200,7 +2200,7 @@ static void dhcpv6_timeout(struct k_work *work) } static void dhcpv6_iface_event_handler(struct net_mgmt_event_callback *cb, - uint64_t mgmt_event, struct net_if *iface) + uint32_t mgmt_event, struct net_if *iface) { sys_snode_t *node = NULL; diff --git a/subsys/net/lib/dns/llmnr_responder.c b/subsys/net/lib/dns/llmnr_responder.c index f0f1f57ff289..bf330e243745 100644 --- a/subsys/net/lib/dns/llmnr_responder.c +++ b/subsys/net/lib/dns/llmnr_responder.c @@ -117,7 +117,7 @@ static void create_ipv4_dst_addr(struct sockaddr_in *src_addr, #endif static void llmnr_iface_event_handler(struct net_mgmt_event_callback *cb, - uint64_t mgmt_event, struct net_if *iface) + uint32_t mgmt_event, struct net_if *iface) { if (mgmt_event == NET_EVENT_IF_UP) { #if defined(CONFIG_NET_IPV4) diff --git a/subsys/net/lib/dns/mdns_responder.c b/subsys/net/lib/dns/mdns_responder.c index 8642364bc2b7..29f1c657ae1e 100644 --- a/subsys/net/lib/dns/mdns_responder.c +++ b/subsys/net/lib/dns/mdns_responder.c @@ -157,7 +157,7 @@ static void mark_needs_announce(struct net_if *iface, bool needs_announce) #endif /* CONFIG_MDNS_RESPONDER_PROBE */ static void mdns_iface_event_handler(struct net_mgmt_event_callback *cb, - uint64_t mgmt_event, struct net_if *iface) + uint32_t mgmt_event, struct net_if *iface) { if (mgmt_event == NET_EVENT_IF_UP) { @@ -958,7 +958,7 @@ static void probing(struct k_work *work) } static void mdns_addr_event_handler(struct net_mgmt_event_callback *cb, - uint64_t mgmt_event, struct net_if *iface) + uint32_t mgmt_event, struct net_if *iface) { uint32_t probe_delay = sys_rand32_get() % 250; bool probe_started = false; @@ -1110,7 +1110,7 @@ static void mdns_addr_event_handler(struct net_mgmt_event_callback *cb, } static void mdns_conn_event_handler(struct net_mgmt_event_callback *cb, - uint64_t mgmt_event, struct net_if *iface) + uint32_t mgmt_event, struct net_if *iface) { if (mgmt_event == NET_EVENT_L4_DISCONNECTED) { /* Clear the failed probes counter so that we can start @@ -1823,7 +1823,7 @@ static void do_init_listener(struct k_work *work) static int mdns_responder_init(void) { - uint64_t flags = NET_EVENT_IF_UP; + uint32_t flags = NET_EVENT_IF_UP; external_records = NULL; external_records_count = 0; diff --git a/subsys/net/lib/ptp/port.c b/subsys/net/lib/ptp/port.c index d3f803cb3915..24abec002c8d 100644 --- a/subsys/net/lib/ptp/port.c +++ b/subsys/net/lib/ptp/port.c @@ -964,7 +964,7 @@ int port_state_update(struct ptp_port *port, enum ptp_port_event event, bool tt_ } static void port_link_monitor(struct net_mgmt_event_callback *cb, - uint64_t mgmt_event, + uint32_t mgmt_event, struct net_if *iface) { ARG_UNUSED(cb); diff --git a/subsys/net/lib/shell/events.c b/subsys/net/lib/shell/events.c index 51afbc85fc9f..6b27dc2e4b0b 100644 --- a/subsys/net/lib/shell/events.c +++ b/subsys/net/lib/shell/events.c @@ -44,7 +44,7 @@ static const char unknown_event_str[] = ""; struct event_msg { struct net_if *iface; size_t len; - uint64_t event; + uint32_t event; uint8_t data[MAX_EVENT_INFO_SIZE]; }; @@ -52,7 +52,7 @@ K_MSGQ_DEFINE(event_mon_msgq, sizeof(struct event_msg), CONFIG_NET_MGMT_EVENT_QUEUE_SIZE, sizeof(intptr_t)); static void event_handler(struct net_mgmt_event_callback *cb, - uint64_t mgmt_event, struct net_if *iface) + uint32_t mgmt_event, struct net_if *iface) { struct event_msg msg; int ret; @@ -563,7 +563,7 @@ static void event_mon_handler(const struct shell *sh, void *p2, void *p3) } if (desc == unknown_event_str) { - PR_INFO("EVENT: %s [%d] %s%s%s%s%s (0x%" PRIx64 ")\n", layer_str, + PR_INFO("EVENT: %s [%d] %s%s%s%s%s (0x%08x)\n", layer_str, net_if_get_by_iface(msg.iface), desc, desc2 ? " " : "", desc2 ? desc2 : "", info ? " " : "", info ? info : "", msg.event); diff --git a/subsys/net/lib/sockets/sockets_net_mgmt.c b/subsys/net/lib/sockets/sockets_net_mgmt.c index 0b45416c1f2d..909893e0444c 100644 --- a/subsys/net/lib/sockets/sockets_net_mgmt.c +++ b/subsys/net/lib/sockets/sockets_net_mgmt.c @@ -31,7 +31,7 @@ __net_socket struct net_mgmt_socket { uintptr_t pid; /* net_mgmt mask */ - uint64_t mask; + uint32_t mask; /* Message allocation timeout */ k_timeout_t alloc_timeout; @@ -145,7 +145,7 @@ static ssize_t znet_mgmt_recvfrom(struct net_mgmt_socket *mgmt, void *buf, { struct sockaddr_nm *nm_addr = (struct sockaddr_nm *)src_addr; k_timeout_t timeout = mgmt->wait_timeout; - uint64_t raised_event = 0; + uint32_t raised_event = 0; uint8_t *copy_to = buf; struct net_mgmt_msghdr hdr; struct net_if *iface; diff --git a/subsys/shell/backends/shell_mqtt.c b/subsys/shell/backends/shell_mqtt.c index d77cbac67423..28bd39f4b0de 100644 --- a/subsys/shell/backends/shell_mqtt.c +++ b/subsys/shell/backends/shell_mqtt.c @@ -508,7 +508,7 @@ static void net_disconnect_handler(struct k_work *work) } /* Network connection event handler */ -static void network_evt_handler(struct net_mgmt_event_callback *cb, uint64_t mgmt_event, +static void network_evt_handler(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, struct net_if *iface) { struct shell_mqtt *sh = sh_mqtt; diff --git a/tests/boards/espressif/ethernet/src/main.c b/tests/boards/espressif/ethernet/src/main.c index e9c397d795fd..b64bc946366a 100644 --- a/tests/boards/espressif/ethernet/src/main.c +++ b/tests/boards/espressif/ethernet/src/main.c @@ -30,7 +30,7 @@ static uint8_t ntp_server[4]; static struct net_mgmt_event_callback mgmt_cb; static struct net_dhcpv4_option_callback dhcp_cb; -static void ipv4_event(struct net_mgmt_event_callback *cb, uint64_t mgmt_event, +static void ipv4_event(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, struct net_if *iface) { if ((mgmt_event != NET_EVENT_IPV4_ADDR_ADD) || diff --git a/tests/boards/espressif/wifi/src/main.c b/tests/boards/espressif/wifi/src/main.c index 931927ef25da..bbccdb9b2a95 100644 --- a/tests/boards/espressif/wifi/src/main.c +++ b/tests/boards/espressif/wifi/src/main.c @@ -93,7 +93,7 @@ static void wifi_disconnect_result(struct net_mgmt_event_callback *cb) } } -static void wifi_mgmt_event_handler(struct net_mgmt_event_callback *cb, uint64_t mgmt_event, +static void wifi_mgmt_event_handler(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, struct net_if *iface) { switch (mgmt_event) { diff --git a/tests/net/conn_mgr_conn/src/main.c b/tests/net/conn_mgr_conn/src/main.c index 940d142b8dbd..b66e246b12de 100644 --- a/tests/net/conn_mgr_conn/src/main.c +++ b/tests/net/conn_mgr_conn/src/main.c @@ -95,7 +95,7 @@ static struct event_stats { struct net_mgmt_event_callback conn_mgr_conn_callback; static void conn_mgr_conn_handler(struct net_mgmt_event_callback *cb, - uint64_t event, struct net_if *iface) + uint32_t event, struct net_if *iface) { k_mutex_lock(&event_mutex, K_FOREVER); diff --git a/tests/net/conn_mgr_monitor/src/main.c b/tests/net/conn_mgr_monitor/src/main.c index e1e1cd67081b..cd8242c10d15 100644 --- a/tests/net/conn_mgr_monitor/src/main.c +++ b/tests/net/conn_mgr_monitor/src/main.c @@ -38,12 +38,12 @@ #define DAD_WAIT_TIME EVENT_WAIT_TIME #endif -#define TEST_EXPECT_L4_CONNECTED NET_EVENT_L4_CMD_CONNECTED -#define TEST_EXPECT_L4_DISCONNECTED NET_EVENT_L4_CMD_DISCONNECTED -#define TEST_EXPECT_L4_IPV6_CONNECTED NET_EVENT_L4_CMD_IPV6_CONNECTED -#define TEST_EXPECT_L4_IPV6_DISCONNECTED NET_EVENT_L4_CMD_IPV6_DISCONNECTED -#define TEST_EXPECT_L4_IPV4_CONNECTED NET_EVENT_L4_CMD_IPV4_CONNECTED -#define TEST_EXPECT_L4_IPV4_DISCONNECTED NET_EVENT_L4_CMD_IPV4_DISCONNECTED +#define TEST_EXPECT_L4_CONNECTED BIT(NET_EVENT_L4_CMD_CONNECTED) +#define TEST_EXPECT_L4_DISCONNECTED BIT(NET_EVENT_L4_CMD_DISCONNECTED) +#define TEST_EXPECT_L4_IPV6_CONNECTED BIT(NET_EVENT_L4_CMD_IPV6_CONNECTED) +#define TEST_EXPECT_L4_IPV6_DISCONNECTED BIT(NET_EVENT_L4_CMD_IPV6_DISCONNECTED) +#define TEST_EXPECT_L4_IPV4_CONNECTED BIT(NET_EVENT_L4_CMD_IPV4_CONNECTED) +#define TEST_EXPECT_L4_IPV4_DISCONNECTED BIT(NET_EVENT_L4_CMD_IPV4_DISCONNECTED) #define TEST_EXPECT_CLEAR(event) (global_stats.expected_events &= ~event) @@ -162,7 +162,7 @@ static struct test_stats get_reset_stats(void) /* Callback hooks */ struct net_mgmt_event_callback l4_callback; -void l4_handler(struct net_mgmt_event_callback *cb, uint64_t event, struct net_if *iface) +void l4_handler(struct net_mgmt_event_callback *cb, uint32_t event, struct net_if *iface) { if (event == NET_EVENT_L4_CONNECTED) { k_mutex_lock(&stats_mutex, K_FOREVER); @@ -187,7 +187,7 @@ void l4_handler(struct net_mgmt_event_callback *cb, uint64_t event, struct net_i struct net_mgmt_event_callback conn_callback; -void conn_handler(struct net_mgmt_event_callback *cb, uint64_t event, struct net_if *iface) +void conn_handler(struct net_mgmt_event_callback *cb, uint32_t event, struct net_if *iface) { if (event == NET_EVENT_L4_IPV6_CONNECTED) { k_mutex_lock(&stats_mutex, K_FOREVER); @@ -224,7 +224,7 @@ void conn_handler(struct net_mgmt_event_callback *cb, uint64_t event, struct net } } -static void wait_for_events(uint64_t event_mask, k_timeout_t timeout) +static void wait_for_events(uint32_t event_mask, k_timeout_t timeout) { k_mutex_lock(&stats_mutex, K_FOREVER); k_sem_reset(&event_sem); diff --git a/tests/net/conn_mgr_nsos/src/main.c b/tests/net/conn_mgr_nsos/src/main.c index d4e014accff8..41c4273f262f 100644 --- a/tests/net/conn_mgr_nsos/src/main.c +++ b/tests/net/conn_mgr_nsos/src/main.c @@ -15,7 +15,7 @@ K_SEM_DEFINE(l4_connected, 0, 1); K_SEM_DEFINE(l4_disconnected, 0, 1); -static void l4_event_handler(struct net_mgmt_event_callback *cb, uint64_t event, +static void l4_event_handler(struct net_mgmt_event_callback *cb, uint32_t event, struct net_if *iface) { switch (event) { diff --git a/tests/net/dhcpv4/client/prj.conf b/tests/net/dhcpv4/client/prj.conf index 5ac775854822..5b126f90a14c 100644 --- a/tests/net/dhcpv4/client/prj.conf +++ b/tests/net/dhcpv4/client/prj.conf @@ -20,7 +20,6 @@ CONFIG_NET_MGMT_EVENT=y CONFIG_NET_MGMT_EVENT_INFO=y CONFIG_DNS_RESOLVER=y -CONFIG_DNS_RESOLVER_MAX_SERVERS=3 # Turn off UDP checksum checking as the test fails otherwise. CONFIG_NET_UDP_CHECKSUM=n @@ -32,5 +31,3 @@ CONFIG_NET_DHCPV4_INITIAL_DELAY_MAX=2 CONFIG_NET_DHCPV4_LOG_LEVEL_DBG=y CONFIG_LOG_BUFFER_SIZE=8192 - -CONFIG_ZVFS_POLL_MAX=5 diff --git a/tests/net/dhcpv4/client/src/main.c b/tests/net/dhcpv4/client/src/main.c index 7c87ab4d4786..654a98d2cbee 100644 --- a/tests/net/dhcpv4/client/src/main.c +++ b/tests/net/dhcpv4/client/src/main.c @@ -493,7 +493,7 @@ static struct net_dhcpv4_option_callback opt_vs_invalid_cb; static int event_count; static void receiver_cb(struct net_mgmt_event_callback *cb, - uint64_t nm_event, struct net_if *iface) + uint32_t nm_event, struct net_if *iface) { if (nm_event != NET_EVENT_IPV4_ADDR_ADD && nm_event != NET_EVENT_DNS_SERVER_ADD && @@ -694,7 +694,7 @@ ZTEST(dhcpv4_tests, test_dhcp) #elif defined(CONFIG_NET_DHCPV4_OPTION_CALLBACKS) while (event_count < 10) { #elif defined(CONFIG_NET_DHCPV4_OPTION_PRINT_IGNORED) - while (event_count < 1) { + while (event_count < 2) { #else while (event_count < 5) { #endif diff --git a/tests/net/dhcpv6/src/main.c b/tests/net/dhcpv6/src/main.c index b1375383c678..c5046a2746a2 100644 --- a/tests/net/dhcpv6/src/main.c +++ b/tests/net/dhcpv6/src/main.c @@ -178,7 +178,7 @@ static struct net_pkt *test_dhcpv6_create_message( return NULL; } -static void evt_handler(struct net_mgmt_event_callback *cb, uint64_t mgmt_event, +static void evt_handler(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, struct net_if *iface) { ARG_UNUSED(cb); diff --git a/tests/net/hostname/src/main.c b/tests/net/hostname/src/main.c index b5c0664d2ef7..bfc2fd926f8e 100644 --- a/tests/net/hostname/src/main.c +++ b/tests/net/hostname/src/main.c @@ -101,7 +101,7 @@ static void net_iface_init(struct net_if *iface) #ifdef CONFIG_NET_MGMT_EVENT static void hostname_changed(struct net_mgmt_event_callback *cb, - uint64_t mgmt_event, struct net_if *iface) + uint32_t mgmt_event, struct net_if *iface) { if (mgmt_event == NET_EVENT_HOSTNAME_CHANGED) { #ifdef CONFIG_NET_MGMT_EVENT_INFO diff --git a/tests/net/ieee802154/l2/src/ieee802154_shell_test.c b/tests/net/ieee802154/l2/src/ieee802154_shell_test.c index 5964025e0231..0281b699edbe 100644 --- a/tests/net/ieee802154/l2/src/ieee802154_shell_test.c +++ b/tests/net/ieee802154/l2/src/ieee802154_shell_test.c @@ -50,7 +50,7 @@ static bool expected_association_permitted_bit; #define EXPECTED_PAYLOAD_DATA EXPECTED_ENDDEVICE_EXT_ADDR_LE #define EXPECTED_PAYLOAD_LEN 8 -static void scan_result_cb(struct net_mgmt_event_callback *cb, uint64_t mgmt_event, +static void scan_result_cb(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, struct net_if *iface) { struct ieee802154_context *ctx = net_if_l2_data(iface); diff --git a/tests/net/igmp/src/main.c b/tests/net/igmp/src/main.c index e2f201dd4eee..7878c5953eb4 100644 --- a/tests/net/igmp/src/main.c +++ b/tests/net/igmp/src/main.c @@ -227,7 +227,7 @@ NET_DEVICE_INIT(net_test_igmp, "net_test_igmp", 127); static void group_joined(struct net_mgmt_event_callback *cb, - uint64_t nm_event, struct net_if *iface) + uint32_t nm_event, struct net_if *iface) { if (nm_event != NET_EVENT_IPV4_MCAST_JOIN) { /* Spurious callback. */ @@ -240,7 +240,7 @@ static void group_joined(struct net_mgmt_event_callback *cb, } static void group_left(struct net_mgmt_event_callback *cb, - uint64_t nm_event, struct net_if *iface) + uint32_t nm_event, struct net_if *iface) { if (nm_event != NET_EVENT_IPV4_MCAST_LEAVE) { /* Spurious callback. */ @@ -253,7 +253,7 @@ static void group_left(struct net_mgmt_event_callback *cb, } static struct mgmt_events { - uint64_t event; + uint32_t event; net_mgmt_event_handler_t handler; struct net_mgmt_event_callback cb; } mgmt_events[] = { diff --git a/tests/net/lib/dns_addremove/src/main.c b/tests/net/lib/dns_addremove/src/main.c index f8f9fdc1c806..1b6f55efd730 100644 --- a/tests/net/lib/dns_addremove/src/main.c +++ b/tests/net/lib/dns_addremove/src/main.c @@ -139,7 +139,7 @@ NET_DEVICE_INIT_INSTANCE(net_iface1_test, 127); static void dns_evt_handler(struct net_mgmt_event_callback *cb, - uint64_t mgmt_event, struct net_if *iface) + uint32_t mgmt_event, struct net_if *iface) { if (mgmt_event == NET_EVENT_DNS_SERVER_ADD) { k_sem_give(&dns_added); diff --git a/tests/net/mgmt/src/mgmt.c b/tests/net/mgmt/src/mgmt.c index 288dcc353b21..004b60adb971 100644 --- a/tests/net/mgmt/src/mgmt.c +++ b/tests/net/mgmt/src/mgmt.c @@ -28,7 +28,7 @@ LOG_MODULE_REGISTER(net_test, CONFIG_NET_MGMT_EVENT_LOG_LEVEL); MAX(sizeof(TEST_INFO_STRING), sizeof(struct in6_addr)) /* Notifier infra */ -static uint64_t event2throw; +static uint32_t event2throw; static uint32_t throw_times; static uint32_t throw_sleep; static bool with_info; @@ -38,7 +38,7 @@ static struct k_thread thrower_thread_data; static struct k_sem thrower_lock; /* Receiver infra */ -static uint64_t rx_event; +static uint32_t rx_event; static uint32_t rx_calls; static size_t info_length_in_test; static struct net_mgmt_event_callback rx_cb; @@ -49,7 +49,7 @@ static struct in6_addr addr6 = { { { 0xfe, 0x80, 0, 0, 0, 0, 0, 0, static char info_data[TEST_MGMT_EVENT_INFO_SIZE]; -static int test_mgmt_request(uint64_t mgmt_request, +static int test_mgmt_request(uint32_t mgmt_request, struct net_if *iface, void *data, uint32_t len) { uint32_t *test_data = data; @@ -67,14 +67,14 @@ static int test_mgmt_request(uint64_t mgmt_request, NET_MGMT_REGISTER_REQUEST_HANDLER(TEST_MGMT_REQUEST, test_mgmt_request); -static void test_mgmt_event_handler(uint64_t mgmt_event, struct net_if *iface, void *info, +static void test_mgmt_event_handler(uint32_t mgmt_event, struct net_if *iface, void *info, size_t info_length, void *user_data) { if (!with_static) { return; } - TC_PRINT("\t\tReceived static event 0x%" PRIx64 "\n", mgmt_event); + TC_PRINT("\t\tReceived static event 0x%08X\n", mgmt_event); ARG_UNUSED(user_data); @@ -144,7 +144,7 @@ static void thrower_thread(void *p1, void *p2, void *p3) while (1) { k_sem_take(&thrower_lock, K_FOREVER); - TC_PRINT("\tThrowing event 0x%" PRIx64 " %u times\n", + TC_PRINT("\tThrowing event 0x%08X %u times\n", event2throw, throw_times); for (; throw_times; throw_times--) { @@ -168,9 +168,9 @@ static void thrower_thread(void *p1, void *p2, void *p3) } static void receiver_cb(struct net_mgmt_event_callback *cb, - uint64_t nm_event, struct net_if *iface) + uint32_t nm_event, struct net_if *iface) { - TC_PRINT("\t\tReceived event 0x%" PRIx64 "\n", nm_event); + TC_PRINT("\t\tReceived event 0x%08X\n", nm_event); if (with_info && cb->info) { if (cb->info_length != info_length_in_test) { @@ -208,15 +208,14 @@ static int sending_event(uint32_t times, bool receiver, bool info) k_msleep(THREAD_SLEEP); if (receiver) { - TC_PRINT("\tReceived 0x%" PRIx64 " %u times\n", + TC_PRINT("\tReceived 0x%08X %u times\n", rx_event, rx_calls); zassert_equal(rx_event, event2throw, "rx_event check failed"); zassert_equal(rx_calls, times, "rx_calls check failed"); net_mgmt_del_event_callback(&rx_cb); - rx_event = 0ULL; - rx_calls = 0U; + rx_event = rx_calls = 0U; } return TC_PASS; @@ -234,7 +233,7 @@ static int test_sending_event_info(uint32_t times, bool receiver) static int test_synchronous_event_listener(uint32_t times, bool on_iface) { - uint64_t event_mask; + uint32_t event_mask; int ret; TC_PRINT("- Synchronous event listener %s\n", @@ -284,14 +283,13 @@ static int test_static_event_listener(uint32_t times, bool info) /* Let the network stack to proceed */ k_msleep(THREAD_SLEEP); - TC_PRINT("\tReceived 0x%" PRIx64 " %u times\n", + TC_PRINT("\tReceived 0x%08X %u times\n", rx_event, rx_calls); zassert_equal(rx_event, event2throw, "rx_event check failed"); zassert_equal(rx_calls, times, "rx_calls check failed"); - rx_event = 0ULL; - rx_calls = 0U; + rx_event = rx_calls = 0U; with_static = false; return TC_PASS; @@ -299,12 +297,12 @@ static int test_static_event_listener(uint32_t times, bool info) static void initialize_event_tests(void) { - event2throw = 0ULL; + event2throw = 0U; throw_times = 0U; throw_sleep = 0; with_info = false; - rx_event = 0ULL; + rx_event = 0U; rx_calls = 0U; k_sem_init(&thrower_lock, 0, UINT_MAX); @@ -320,9 +318,9 @@ static void initialize_event_tests(void) NULL, NULL, NULL, K_PRIO_COOP(7), 0, K_NO_WAIT); } -static int test_core_event(uint64_t event, bool (*func)(void)) +static int test_core_event(uint32_t event, bool (*func)(void)) { - TC_PRINT("- Triggering core event: 0x%" PRIx64 "\n", event); + TC_PRINT("- Triggering core event: 0x%08X\n", event); info_length_in_test = sizeof(struct in6_addr); memcpy(info_data, &addr6, sizeof(addr6)); @@ -338,11 +336,10 @@ static int test_core_event(uint64_t event, bool (*func)(void)) zassert_true(rx_calls > 0 && rx_calls != -1, "rx_calls empty"); zassert_equal(rx_event, event, "rx_event check failed, " - "0x%" PRIx64 " vs 0x%" PRIx64, rx_event, event); + "0x%08x vs 0x%08x", rx_event, event); net_mgmt_del_event_callback(&rx_cb); - rx_event = 0ULL; - rx_calls = 0U; + rx_event = rx_calls = 0U; return TC_PASS; } @@ -429,7 +426,7 @@ ZTEST(mgmt_fn_test_suite, test_mgmt) static K_SEM_DEFINE(wait_for_event_processing, 0, 1); static void net_mgmt_event_handler(struct net_mgmt_event_callback *cb, - uint64_t mgmt_event, struct net_if *iface) + uint32_t mgmt_event, struct net_if *iface) { static int cb_call_count; diff --git a/tests/net/mld/src/main.c b/tests/net/mld/src/main.c index 0036b5853af3..1c95fe5409dc 100644 --- a/tests/net/mld/src/main.c +++ b/tests/net/mld/src/main.c @@ -238,7 +238,7 @@ static void test_iface_carrier_off_on(void) } static void group_joined(struct net_mgmt_event_callback *cb, - uint64_t nm_event, struct net_if *iface) + uint32_t nm_event, struct net_if *iface) { if (nm_event != NET_EVENT_IPV6_MCAST_JOIN) { /* Spurious callback. */ @@ -254,7 +254,7 @@ static void group_joined(struct net_mgmt_event_callback *cb, } static void group_left(struct net_mgmt_event_callback *cb, - uint64_t nm_event, struct net_if *iface) + uint32_t nm_event, struct net_if *iface) { if (nm_event != NET_EVENT_IPV6_MCAST_LEAVE) { /* Spurious callback. */ @@ -270,7 +270,7 @@ static void group_left(struct net_mgmt_event_callback *cb, } static struct mgmt_events { - uint64_t event; + uint32_t event; net_mgmt_event_handler_t handler; struct net_mgmt_event_callback cb; } mgmt_events[] = { diff --git a/tests/net/pmtu/src/main.c b/tests/net/pmtu/src/main.c index d744a4415f43..54d225a259e2 100644 --- a/tests/net/pmtu/src/main.c +++ b/tests/net/pmtu/src/main.c @@ -103,7 +103,7 @@ static K_SEM_DEFINE(wait_pmtu_changed, 0, UINT_MAX); static bool is_pmtu_changed; static void ipv6_pmtu_changed(struct net_mgmt_event_callback *cb, - uint64_t mgmt_event, + uint32_t mgmt_event, struct net_if *iface) { ARG_UNUSED(cb); @@ -123,7 +123,7 @@ static void ipv6_pmtu_changed(struct net_mgmt_event_callback *cb, } static void ipv4_pmtu_changed(struct net_mgmt_event_callback *cb, - uint64_t mgmt_event, + uint32_t mgmt_event, struct net_if *iface) { ARG_UNUSED(cb); @@ -143,7 +143,7 @@ static void ipv4_pmtu_changed(struct net_mgmt_event_callback *cb, } static struct mgmt_events { - uint64_t event; + uint32_t event; net_mgmt_event_handler_t handler; struct net_mgmt_event_callback cb; } mgmt_events[] = { From 7b0af6a5df07c7426c4204fecca577c8c674267d Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:36 +0300 Subject: [PATCH 1011/2141] Revert "[nrf fromlist] drivers: adc: nrfx_saadc: Add support for DMM" This reverts commit 05746fdc63754ddf8eee3ce25485760dbcb86df4. Signed-off-by: Jukka Rissanen --- drivers/adc/adc_nrfx_saadc.c | 72 +++++++++++++++++++----------------- 1 file changed, 38 insertions(+), 34 deletions(-) diff --git a/drivers/adc/adc_nrfx_saadc.c b/drivers/adc/adc_nrfx_saadc.c index 7d442b482e65..2ba7b6efd008 100644 --- a/drivers/adc/adc_nrfx_saadc.c +++ b/drivers/adc/adc_nrfx_saadc.c @@ -13,7 +13,6 @@ #include #include #include -#include LOG_MODULE_REGISTER(adc_nrfx_saadc, CONFIG_ADC_LOG_LEVEL); @@ -98,19 +97,34 @@ BUILD_ASSERT((NRF_SAADC_AIN0 == NRF_SAADC_INPUT_AIN0) && "Definitions from nrf-adc.h do not match those from nrf_saadc.h"); #endif +#if defined(CONFIG_NRF_PLATFORM_HALTIUM) +#include +/* Haltium devices always use bounce buffers in RAM */ +static uint16_t adc_samples_buffer[SAADC_CH_NUM] DMM_MEMORY_SECTION(DT_NODELABEL(adc)); + +#define ADC_BUFFER_IN_RAM + +#endif /* defined(CONFIG_NRF_PLATFORM_HALTIUM) */ + struct driver_data { struct adc_context ctx; uint8_t single_ended_channels; + nrf_saadc_value_t *buffer; /* Pointer to the buffer with converted samples. */ uint8_t active_channel_cnt; - void *mem_reg; + +#if defined(ADC_BUFFER_IN_RAM) + void *samples_buffer; void *user_buffer; +#endif }; static struct driver_data m_data = { ADC_CONTEXT_INIT_TIMER(m_data, ctx), ADC_CONTEXT_INIT_LOCK(m_data, ctx), ADC_CONTEXT_INIT_SYNC(m_data, ctx), - .mem_reg = DMM_DEV_TO_REG(DT_NODELABEL(adc)), +#if defined(ADC_BUFFER_IN_RAM) + .samples_buffer = adc_samples_buffer, +#endif }; /* Forward declaration */ @@ -378,29 +392,22 @@ static void adc_context_start_sampling(struct adc_context *ctx) if (ret != NRFX_SUCCESS) { LOG_ERR("Cannot start sampling: 0x%08x", ret); - adc_context_complete(ctx, -EIO); + adc_context_complete(&m_data.ctx, -EIO); } } } static void adc_context_update_buffer_pointer(struct adc_context *ctx, bool repeat) { - void *samples_buffer; - if (!repeat) { +#if defined(ADC_BUFFER_IN_RAM) m_data.user_buffer = (uint16_t *)m_data.user_buffer + m_data.active_channel_cnt; - } +#else + nrf_saadc_value_t *buffer = (uint16_t *)m_data.buffer + m_data.active_channel_cnt; - int error = dmm_buffer_in_prepare( - m_data.mem_reg, m_data.user_buffer, - NRFX_SAADC_SAMPLES_TO_BYTES(m_data.active_channel_cnt), - &samples_buffer); - if (error != 0) { - LOG_ERR("DMM buffer allocation failed err=%d", error); - adc_context_complete(ctx, -EIO); + nrfx_saadc_buffer_set(buffer, m_data.active_channel_cnt); +#endif } - - nrfx_saadc_buffer_set(samples_buffer, m_data.active_channel_cnt); } static int get_resolution(const struct adc_sequence *sequence, nrf_saadc_resolution_t *resolution) @@ -495,12 +502,12 @@ static bool has_single_ended(const struct adc_sequence *sequence) return sequence->channels & m_data.single_ended_channels; } -static void correct_single_ended(const struct adc_sequence *sequence, nrf_saadc_value_t *buffer) +static void correct_single_ended(const struct adc_sequence *sequence) { uint16_t channel_bit = BIT(0); uint8_t selected_channels = sequence->channels; uint8_t single_ended_channels = m_data.single_ended_channels; - int16_t *sample = (int16_t *)buffer; + int16_t *sample = (int16_t *)m_data.buffer; while (channel_bit <= single_ended_channels) { if (channel_bit & selected_channels) { @@ -525,7 +532,6 @@ static int start_read(const struct device *dev, nrf_saadc_oversample_t oversampling; uint8_t active_channel_cnt = 0U; uint8_t channel_id = 0U; - void *samples_buffer; /* Signal an error if channel selection is invalid (no channels or * a non-existing one is selected). @@ -576,21 +582,16 @@ static int start_read(const struct device *dev, } m_data.active_channel_cnt = active_channel_cnt; +#if defined(ADC_BUFFER_IN_RAM) m_data.user_buffer = sequence->buffer; - error = dmm_buffer_in_prepare(m_data.mem_reg, - m_data.user_buffer, - NRFX_SAADC_SAMPLES_TO_BYTES(active_channel_cnt), - &samples_buffer); - if (error != 0) { - LOG_ERR("DMM buffer allocation failed err=%d", error); - return error; - } - + nrfx_saadc_buffer_set(m_data.samples_buffer, active_channel_cnt); +#else /* Buffer is filled in chunks, each chunk composed of number of samples equal to number * of active channels. Buffer pointer is advanced and reloaded after each chunk. */ - nrfx_saadc_buffer_set(samples_buffer, active_channel_cnt); + nrfx_saadc_buffer_set(sequence->buffer, active_channel_cnt); +#endif adc_context_start_read(&m_data.ctx, sequence); @@ -631,14 +632,17 @@ static void event_handler(const nrfx_saadc_evt_t *event) nrfx_err_t err; if (event->type == NRFX_SAADC_EVT_DONE) { - dmm_buffer_in_release( - m_data.mem_reg, m_data.user_buffer, - NRFX_SAADC_SAMPLES_TO_BYTES(m_data.active_channel_cnt), - event->data.done.p_buffer); + m_data.buffer = event->data.done.p_buffer; if (has_single_ended(&m_data.ctx.sequence)) { - correct_single_ended(&m_data.ctx.sequence, m_data.user_buffer); + correct_single_ended(&m_data.ctx.sequence); } + +#if defined(ADC_BUFFER_IN_RAM) + memcpy(m_data.user_buffer, m_data.samples_buffer, + NRFX_SAADC_SAMPLES_TO_BYTES(m_data.active_channel_cnt)); +#endif + adc_context_on_sampling_done(&m_data.ctx, DEVICE_DT_INST_GET(0)); } else if (event->type == NRFX_SAADC_EVT_CALIBRATEDONE) { err = nrfx_saadc_mode_trigger(); From 5040ea4f34ab5a843430beeafdee38f7dad9f4d1 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:36 +0300 Subject: [PATCH 1012/2141] Revert "[nrf fromtree] soc: nordic: 54h20: fix typo ETX -> EXT" This reverts commit 64848a42d2b6c12fc6f3ed89fad4272195ceadd8. Signed-off-by: Jukka Rissanen --- soc/nordic/nrf54h/bicr/bicr-schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soc/nordic/nrf54h/bicr/bicr-schema.json b/soc/nordic/nrf54h/bicr/bicr-schema.json index a43107a12b6d..70e133f6ae01 100644 --- a/soc/nordic/nrf54h/bicr/bicr-schema.json +++ b/soc/nordic/nrf54h/bicr/bicr-schema.json @@ -193,7 +193,7 @@ ], "enum": [ "CRYSTAL", - "EXT_SINE", + "ETX_SINE", "EXT_SQUARE" ], "default": "CRYSTAL" From d913258191575b4e1a5adacf8a3e1eecb047950b Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:36 +0300 Subject: [PATCH 1013/2141] Revert "[nrf fromtree] soc: nordic: 54h20: bicr: Fix order of enum" This reverts commit f10e671ae2b0ecfadb48592d51fae88800ce836b. Signed-off-by: Jukka Rissanen --- soc/nordic/nrf54h/bicr/bicr-schema.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/soc/nordic/nrf54h/bicr/bicr-schema.json b/soc/nordic/nrf54h/bicr/bicr-schema.json index 70e133f6ae01..b43b7236a6b7 100644 --- a/soc/nordic/nrf54h/bicr/bicr-schema.json +++ b/soc/nordic/nrf54h/bicr/bicr-schema.json @@ -11,8 +11,8 @@ "title": "Power supply scheme", "enumNames": [ "Unconfigured (system will not boot)", - "Both VDD and VDDH supplied with 1.8 V (inductor present)", - "VDDH supplied with 2.1-5.5 V and VDD regulated by the chip (inductor present)" + "VDDH supplied with 2.1-5.5 V and VDD regulated by the chip (inductor present)", + "Both VDD and VDDH supplied with 1.8 V (inductor present)" ], "enum": [ "UNCONFIGURED", From 71e2eb89522b48af913a0c2714dfb7916fcb5f09 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:37 +0300 Subject: [PATCH 1014/2141] Revert "[nrf noup] samples: bluetooth: mesh: update stack sizes" This reverts commit 8876f35b0208e315d554ca1fec6f66643340fd0d. Signed-off-by: Jukka Rissanen --- samples/bluetooth/mesh_provisioner/prj.conf | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/samples/bluetooth/mesh_provisioner/prj.conf b/samples/bluetooth/mesh_provisioner/prj.conf index 0e5f6490edee..241767805164 100644 --- a/samples/bluetooth/mesh_provisioner/prj.conf +++ b/samples/bluetooth/mesh_provisioner/prj.conf @@ -1,10 +1,6 @@ #CONFIG_INIT_STACKS=y -# Stack sizes from thread analysis + 50% margin, rounded to nearest 100 -CONFIG_MAIN_STACK_SIZE=4400 -CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4800 -CONFIG_BT_MESH_SETTINGS_WORKQ_STACK_SIZE=1700 -CONFIG_BT_MESH_ADV_STACK_SIZE=4000 -CONFIG_BT_RX_STACK_SIZE=3300 +CONFIG_MAIN_STACK_SIZE=2048 +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048 # The Bluetooth API should not be used from a preemptive thread: CONFIG_MAIN_THREAD_PRIORITY=-2 From ed07e32b79eb5ca6746123a753d8475fbd513a6d Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:37 +0300 Subject: [PATCH 1015/2141] Revert "[nrf fromlist] tests: boards: nrf: qdec: Fix test for multiple instances" This reverts commit e6948df926e1027caeb3914a2dc37430aca3d09c. Signed-off-by: Jukka Rissanen --- .../boards/bl54l15_dvk_nrf54l15_common.dtsi | 14 +- .../boards/bl54l15u_dvk_nrf54l15_common.dtsi | 14 +- .../qdec/boards/nrf52840dk_nrf52840.overlay | 7 - .../boards/nrf5340dk_nrf5340_cpuapp.overlay | 14 +- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 25 +- .../boards/nrf54l15dk_nrf54l15_common.dtsi | 45 ++- .../boards/nrf54lm20dk_nrf54lm20_common.dtsi | 14 +- .../qdec/dts/bindings/test-qdec-loopback.yaml | 20 -- tests/boards/nrf/qdec/src/main.c | 313 ++++++++++-------- 9 files changed, 229 insertions(+), 237 deletions(-) delete mode 100644 tests/boards/nrf/qdec/dts/bindings/test-qdec-loopback.yaml diff --git a/tests/boards/nrf/qdec/boards/bl54l15_dvk_nrf54l15_common.dtsi b/tests/boards/nrf/qdec/boards/bl54l15_dvk_nrf54l15_common.dtsi index 19ca5e83647f..4db67a49a5e0 100644 --- a/tests/boards/nrf/qdec/boards/bl54l15_dvk_nrf54l15_common.dtsi +++ b/tests/boards/nrf/qdec/boards/bl54l15_dvk_nrf54l15_common.dtsi @@ -5,6 +5,12 @@ */ / { + aliases { + qdec0 = &qdec20; + qenca = &phase_a; + qencb = &phase_b; + }; + encoder-emulate { compatible = "gpio-leds"; @@ -16,14 +22,6 @@ gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>; }; }; - - qdec_loopbacks: loopbacks { - compatible = "test-qdec-loopbacks"; - loopback0 { - qdec = <&qdec20>; - qenc-emul-gpios = <&phase_a &phase_b>; - }; - }; }; &pinctrl { diff --git a/tests/boards/nrf/qdec/boards/bl54l15u_dvk_nrf54l15_common.dtsi b/tests/boards/nrf/qdec/boards/bl54l15u_dvk_nrf54l15_common.dtsi index 19ca5e83647f..4db67a49a5e0 100644 --- a/tests/boards/nrf/qdec/boards/bl54l15u_dvk_nrf54l15_common.dtsi +++ b/tests/boards/nrf/qdec/boards/bl54l15u_dvk_nrf54l15_common.dtsi @@ -5,6 +5,12 @@ */ / { + aliases { + qdec0 = &qdec20; + qenca = &phase_a; + qencb = &phase_b; + }; + encoder-emulate { compatible = "gpio-leds"; @@ -16,14 +22,6 @@ gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>; }; }; - - qdec_loopbacks: loopbacks { - compatible = "test-qdec-loopbacks"; - loopback0 { - qdec = <&qdec20>; - qenc-emul-gpios = <&phase_a &phase_b>; - }; - }; }; &pinctrl { diff --git a/tests/boards/nrf/qdec/boards/nrf52840dk_nrf52840.overlay b/tests/boards/nrf/qdec/boards/nrf52840dk_nrf52840.overlay index a495df07f7ca..f227fb95c382 100644 --- a/tests/boards/nrf/qdec/boards/nrf52840dk_nrf52840.overlay +++ b/tests/boards/nrf/qdec/boards/nrf52840dk_nrf52840.overlay @@ -22,13 +22,6 @@ }; }; - qdec_loopbacks: loopbacks { - compatible = "test-qdec-loopbacks"; - loopback0 { - qdec = <&qdec0>; - qenc-emul-gpios = <&phase_a &phase_b>; - }; - }; }; &pinctrl { diff --git a/tests/boards/nrf/qdec/boards/nrf5340dk_nrf5340_cpuapp.overlay b/tests/boards/nrf/qdec/boards/nrf5340dk_nrf5340_cpuapp.overlay index d1f008c81936..ed6a5587f5b3 100644 --- a/tests/boards/nrf/qdec/boards/nrf5340dk_nrf5340_cpuapp.overlay +++ b/tests/boards/nrf/qdec/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -4,6 +4,12 @@ */ / { + aliases { + qdec0 = &qdec1; + qenca = &phase_a; + qencb = &phase_b; + }; + encoder-emulate { compatible = "gpio-leds"; phase_a: phase_a { @@ -15,14 +21,6 @@ gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>; }; }; - - qdec_loopbacks: loopbacks { - compatible = "test-qdec-loopbacks"; - loopback0 { - qdec = <&qdec1>; - qenc-emul-gpios = <&phase_a &phase_b>; - }; - }; }; &pinctrl { diff --git a/tests/boards/nrf/qdec/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/boards/nrf/qdec/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index 7e43c70dac0f..78f3aa09ace4 100644 --- a/tests/boards/nrf/qdec/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/tests/boards/nrf/qdec/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -11,12 +11,21 @@ */ / { + aliases { + qdec0 = &qdec130; + qdec1 = &qdec131; + qenca = &phase_a; + qencb = &phase_b; + qenca1 = &phase_a1; + qencb1 = &phase_b1; + }; + encoder-emulate { compatible = "gpio-leds"; - phase_a0: phase_a0 { + phase_a: phase_a { gpios = <&gpio2 9 GPIO_ACTIVE_HIGH>; }; - phase_b0: phase_b0 { + phase_b: phase_b { gpios = <&gpio2 11 GPIO_ACTIVE_HIGH>; }; phase_a1: phase_a1 { @@ -26,18 +35,6 @@ gpios = <&gpio7 1 GPIO_ACTIVE_HIGH>; }; }; - - qdec_loopbacks: loopbacks { - compatible = "test-qdec-loopbacks"; - loopback0 { - qdec = <&qdec130>; - qenc-emul-gpios = <&phase_a0 &phase_b0>; - }; - loopback1 { - qdec = <&qdec131>; - qenc-emul-gpios = <&phase_a1 &phase_b1>; - }; - }; }; &pinctrl { diff --git a/tests/boards/nrf/qdec/boards/nrf54l15dk_nrf54l15_common.dtsi b/tests/boards/nrf/qdec/boards/nrf54l15dk_nrf54l15_common.dtsi index f27294146527..06a490d1da08 100644 --- a/tests/boards/nrf/qdec/boards/nrf54l15dk_nrf54l15_common.dtsi +++ b/tests/boards/nrf/qdec/boards/nrf54l15dk_nrf54l15_common.dtsi @@ -4,38 +4,35 @@ */ /* Required loopbacks - * P1.8 <-> P1.9 - * P1.10 <-> P1.11 - * P1.12 <-> P1.13 - * P1.14 <-> P2.10 + * P1.8 <-> P1.9 + * P1.10 >-> P1.11 + * P2.8 <-> P2.9 + * P2.10 <-> P1.14 */ / { + aliases { + qdec0 = &qdec20; + qdec1 = &qdec21; + qenca = &phase_a; + qencb = &phase_b; + qenca1 = &phase_a1; + qencb1 = &phase_b1; + }; + encoder-emulate { compatible = "gpio-leds"; - phase_a0: phase_a0 { + phase_a: phase_a { gpios = <&gpio1 9 GPIO_ACTIVE_HIGH>; }; - phase_b0: phase_b0 { + phase_b: phase_b { gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>; }; phase_a1: phase_a1 { - gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>; + gpios = <&gpio2 9 GPIO_ACTIVE_HIGH>; }; phase_b1: phase_b1 { - gpios = <&gpio2 10 GPIO_ACTIVE_HIGH>; - }; - }; - - qdec_loopbacks: loopbacks { - compatible = "test-qdec-loopbacks"; - loopback0 { - qdec = <&qdec20>; - qenc-emul-gpios = <&phase_a0 &phase_b0>; - }; - loopback1 { - qdec = <&qdec21>; - qenc-emul-gpios = <&phase_a1 &phase_b1>; + gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>; }; }; }; @@ -58,15 +55,15 @@ qdec_21_pinctrl: qdec_21_pinctrl { group1 { - psels = , - ; + psels = , + ; }; }; qdec_21_sleep_pinctrl: qdec_21_sleep_pinctrl { group1 { - psels = , - ; + psels = , + ; low-power-enable; }; }; diff --git a/tests/boards/nrf/qdec/boards/nrf54lm20dk_nrf54lm20_common.dtsi b/tests/boards/nrf/qdec/boards/nrf54lm20dk_nrf54lm20_common.dtsi index 6f8f3a184312..84e7b1dbc30f 100644 --- a/tests/boards/nrf/qdec/boards/nrf54lm20dk_nrf54lm20_common.dtsi +++ b/tests/boards/nrf/qdec/boards/nrf54lm20dk_nrf54lm20_common.dtsi @@ -11,6 +11,12 @@ */ / { + aliases { + qdec0 = &qdec20; + qenca = &phase_a; + qencb = &phase_b; + }; + encoder-emulate { compatible = "gpio-leds"; phase_a: phase_a { @@ -20,14 +26,6 @@ gpios = <&gpio1 23 GPIO_ACTIVE_HIGH>; }; }; - - qdec_loopbacks: loopbacks { - compatible = "test-qdec-loopbacks"; - loopback0 { - qdec = <&qdec20>; - qenc-emul-gpios = <&phase_a &phase_b>; - }; - }; }; &pinctrl { diff --git a/tests/boards/nrf/qdec/dts/bindings/test-qdec-loopback.yaml b/tests/boards/nrf/qdec/dts/bindings/test-qdec-loopback.yaml deleted file mode 100644 index e03b2ff3bc32..000000000000 --- a/tests/boards/nrf/qdec/dts/bindings/test-qdec-loopback.yaml +++ /dev/null @@ -1,20 +0,0 @@ -description: | - Binding describing loopbacks required to run tests/boards/nrf/qdec test in Zephyr. - -compatible: "test-qdec-loopbacks" - -child-binding: - description: | - Binding describing a single loopback pair consisting of a QDEC device and two "gpio-leds" pins - working as a quadrature encoder for the test. - properties: - qdec: - type: phandle - required: true - description: Node of the QDEC device used to capture quadrature signal in the loopback. - qenc-emul-gpios: - type: phandles - required: true - description: | - Children nodes of "gpio-leds" compatible used to generate quadrature signal. The first - phandles outputs phase A signal, the second one outputs phase B signal. diff --git a/tests/boards/nrf/qdec/src/main.c b/tests/boards/nrf/qdec/src/main.c index 9d138d325fb5..7df97be2a432 100644 --- a/tests/boards/nrf/qdec/src/main.c +++ b/tests/boards/nrf/qdec/src/main.c @@ -11,40 +11,27 @@ #include #include -/** - * Structure grouping gpio pins used for QENC emulation connected with a QDEC device - * with a loopback. - */ -struct qdec_qenc_loopback { - struct gpio_dt_spec qenc_phase_a; - struct gpio_dt_spec qenc_phase_b; - - const struct device *qdec; - uint32_t qdec_config_step; -}; - static K_SEM_DEFINE(sem, 0, 1); - -#define GET_QDEC_QENC_LOOPBACK(x) \ - { \ - .qenc_phase_a = GPIO_DT_SPEC_GET(DT_PHANDLE_BY_IDX(x, qenc_emul_gpios, 0), gpios), \ - .qenc_phase_b = GPIO_DT_SPEC_GET(DT_PHANDLE_BY_IDX(x, qenc_emul_gpios, 1), gpios), \ - .qdec = DEVICE_DT_GET(DT_PHANDLE(x, qdec)), \ - .qdec_config_step = DT_PROP_BY_PHANDLE(x, qdec, steps) \ - } - - -struct qdec_qenc_loopback loopbacks[] = { - DT_FOREACH_CHILD_SEP(DT_NODELABEL(qdec_loopbacks), GET_QDEC_QENC_LOOPBACK, (,)) -}; - -#define TESTED_QDEC_COUNT ARRAY_SIZE(loopbacks) - +static const struct gpio_dt_spec phase_a = GPIO_DT_SPEC_GET(DT_ALIAS(qenca), gpios); +static const struct gpio_dt_spec phase_b = GPIO_DT_SPEC_GET(DT_ALIAS(qencb), gpios); +static const struct device *const qdec_dev = DEVICE_DT_GET(DT_ALIAS(qdec0)); +static const uint32_t qdec_config_step = DT_PROP(DT_ALIAS(qdec0), steps); + +/* Disable testing second QDEC instance + * until the issue with multiple + * QDEC instances support is resolved + */ +#if DT_NODE_EXISTS(DT_ALIAS(qdecX)) +#define SECOND_QDEC_INSTANCE + +static const struct gpio_dt_spec phase_a1 = GPIO_DT_SPEC_GET(DT_ALIAS(qenca1), gpios); +static const struct gpio_dt_spec phase_b1 = GPIO_DT_SPEC_GET(DT_ALIAS(qencb1), gpios); +static const struct device *const qdec_1_dev = DEVICE_DT_GET(DT_ALIAS(qdec1)); +static const uint32_t qdec_1_config_step = DT_PROP(DT_ALIAS(qdec1), steps); +#endif static struct sensor_trigger qdec_trigger = {.type = SENSOR_TRIG_DATA_READY, .chan = SENSOR_CHAN_ROTATION}; - static bool toggle_a = true; -static struct qdec_qenc_loopback *loopback_currently_under_test; static void qdec_trigger_handler(const struct device *dev, const struct sensor_trigger *trigger) { @@ -61,9 +48,15 @@ static void qdec_trigger_handler(const struct device *dev, const struct sensor_t static void qenc_emulate_work_handler(struct k_work *work) { if (toggle_a) { - gpio_pin_toggle_dt(&loopback_currently_under_test->qenc_phase_a); + gpio_pin_toggle_dt(&phase_a); +#if defined(SECOND_QDEC_INSTANCE) + gpio_pin_toggle_dt(&phase_a1); +#endif } else { - gpio_pin_toggle_dt(&loopback_currently_under_test->qenc_phase_b); + gpio_pin_toggle_dt(&phase_b); +#if defined(SECOND_QDEC_INSTANCE) + gpio_pin_toggle_dt(&phase_b1); +#endif } toggle_a = !toggle_a; } @@ -96,46 +89,52 @@ static void qenc_emulate_setup_pin(const struct gpio_dt_spec *gpio_dt) zassert_true(rc == 0, "%s: pin configure failed: %d", gpio_dt->port->name, rc); } -static void qenc_emulate_start(struct qdec_qenc_loopback *loopback, k_timeout_t period, - bool forward) +static void qenc_emulate_start(k_timeout_t period, bool forward) { - qenc_emulate_reset_pin(&loopback->qenc_phase_a); - qenc_emulate_reset_pin(&loopback->qenc_phase_b); + qenc_emulate_reset_pin(&phase_a); + qenc_emulate_reset_pin(&phase_b); +#if defined(SECOND_QDEC_INSTANCE) + qenc_emulate_reset_pin(&phase_a1); + qenc_emulate_reset_pin(&phase_b1); +#endif toggle_a = !forward; - loopback_currently_under_test = loopback; + k_timer_start(&qenc_emulate_timer, period, period); } static void qenc_emulate_stop(void) { - if (loopback_currently_under_test) { - k_timer_stop(&qenc_emulate_timer); - qenc_emulate_reset_pin(&loopback_currently_under_test->qenc_phase_a); - qenc_emulate_reset_pin(&loopback_currently_under_test->qenc_phase_b); - } + k_timer_stop(&qenc_emulate_timer); + + qenc_emulate_reset_pin(&phase_a); + qenc_emulate_reset_pin(&phase_b); +#if defined(SECOND_QDEC_INSTANCE) + qenc_emulate_reset_pin(&phase_a1); + qenc_emulate_reset_pin(&phase_b1); +#endif } -static void qenc_emulate_verify_reading(struct qdec_qenc_loopback *loopback, - int emulator_period_ms, int emulation_duration_ms, bool forward, - bool overflow_expected) +static void qenc_emulate_verify_reading(const struct device *const dev, int emulator_period_ms, + int emulation_duration_ms, bool forward, bool overflow_expected, + const uint32_t config_step) { int rc; struct sensor_value val = {0}; int32_t expected_steps = emulation_duration_ms / emulator_period_ms; - int32_t expected_reading = 360 * expected_steps / loopback->qdec_config_step; - int32_t delta = expected_reading / 4; + int32_t expected_reading = 360 * expected_steps / config_step; + int32_t delta = expected_reading / 5; if (!forward) { expected_reading *= -1; } - qenc_emulate_start(loopback, K_MSEC(emulator_period_ms), forward); + qenc_emulate_start(K_MSEC(emulator_period_ms), forward); /* wait for some readings */ k_msleep(emulation_duration_ms); - rc = sensor_sample_fetch(loopback->qdec); + rc = sensor_sample_fetch(dev); if (!overflow_expected) { zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); @@ -143,7 +142,7 @@ static void qenc_emulate_verify_reading(struct qdec_qenc_loopback *loopback, zassert_true(rc == -EOVERFLOW, "Failed to detect overflow"); } - rc = sensor_channel_get(loopback->qdec, SENSOR_CHAN_ROTATION, &val); + rc = sensor_channel_get(dev, SENSOR_CHAN_ROTATION, &val); zassert_true(rc == 0, "Failed to get sample (%d)", rc); TC_PRINT("Expected reading: %d, actual value: %d, delta: %d\n", @@ -158,31 +157,31 @@ static void qenc_emulate_verify_reading(struct qdec_qenc_loopback *loopback, /* wait and get readings to clear state */ k_msleep(100); - rc = sensor_sample_fetch(loopback->qdec); + rc = sensor_sample_fetch(dev); zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); - rc = sensor_channel_get(loopback->qdec, SENSOR_CHAN_ROTATION, &val); + rc = sensor_channel_get(dev, SENSOR_CHAN_ROTATION, &val); zassert_true(rc == 0, "Failed to get sample (%d)", rc); } -static void sensor_trigger_set_and_disable(struct qdec_qenc_loopback *loopback) +static void sensor_trigger_set_and_disable(const struct device *const dev) { int rc; if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_get(loopback->qdec); + pm_device_runtime_get(dev); } k_sem_give(&sem); qdec_trigger.type = SENSOR_TRIG_DATA_READY; qdec_trigger.chan = SENSOR_CHAN_ALL; - rc = sensor_trigger_set(loopback->qdec, &qdec_trigger, qdec_trigger_handler); + rc = sensor_trigger_set(dev, &qdec_trigger, qdec_trigger_handler); zassume_true(rc != -ENOSYS, "sensor_trigger_set not supported"); zassert_true(rc == 0, "sensor_trigger_set failed: %d", rc); - qenc_emulate_start(loopback, K_MSEC(10), true); + qenc_emulate_start(K_MSEC(10), true); /* emulation working, handler should be called */ rc = k_sem_take(&sem, K_MSEC(200)); @@ -194,7 +193,7 @@ static void sensor_trigger_set_and_disable(struct qdec_qenc_loopback *loopback) rc = k_sem_take(&sem, K_MSEC(200)); if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_put(loopback->qdec); + pm_device_runtime_put(dev); } /* there should be no triggers now*/ @@ -202,21 +201,21 @@ static void sensor_trigger_set_and_disable(struct qdec_qenc_loopback *loopback) zassert_true(rc == -EAGAIN, "qdec handler should not be triggered (%d)", rc); if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_get(loopback->qdec); + pm_device_runtime_get(dev); } /* register empty trigger - disable trigger */ - rc = sensor_trigger_set(loopback->qdec, &qdec_trigger, NULL); + rc = sensor_trigger_set(dev, &qdec_trigger, NULL); zassert_true(rc == 0, "sensor_trigger_set failed: %d", rc); - qenc_emulate_start(loopback, K_MSEC(10), true); + qenc_emulate_start(K_MSEC(10), true); /* emulation working, but handler not set, thus should not be called */ rc = k_sem_take(&sem, K_MSEC(200)); zassert_true(rc == -EAGAIN, "qdec handler should not be triggered (%d)", rc); if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_put(loopback->qdec); + pm_device_runtime_put(dev); } } @@ -228,50 +227,49 @@ static void sensor_trigger_set_and_disable(struct qdec_qenc_loopback *loopback) */ ZTEST(qdec_sensor, test_sensor_trigger_set_and_disable) { - for (size_t i = 0; i < TESTED_QDEC_COUNT; i++) { - TC_PRINT("Testing QDEC index %d, address: %p\n", i, loopbacks[i].qdec); - sensor_trigger_set_and_disable(&loopbacks[i]); - } + TC_PRINT("Testing QDEC-0, address: %p\n", qdec_dev); + sensor_trigger_set_and_disable(qdec_dev); +#if defined(SECOND_QDEC_INSTANCE) + TC_PRINT("Testing QDEC-1, address: %p\n", qdec_1_dev); + sensor_trigger_set_and_disable(qdec_1_dev); +#endif + } -static void sensor_trigger_set_test(struct qdec_qenc_loopback *loopback) +static void sensor_trigger_set_test(const struct device *const dev) { int rc; struct sensor_value val = {0}; if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_get(loopback->qdec); + pm_device_runtime_get(dev); } qdec_trigger.type = SENSOR_TRIG_DATA_READY; qdec_trigger.chan = SENSOR_CHAN_ROTATION; - rc = sensor_trigger_set(loopback->qdec, &qdec_trigger, qdec_trigger_handler); + rc = sensor_trigger_set(dev, &qdec_trigger, qdec_trigger_handler); zassume_true(rc != -ENOSYS, "sensor_trigger_set not supported"); zassert_true(rc == 0, "sensor_trigger_set failed: %d", rc); - qenc_emulate_start(loopback, K_MSEC(10), true); + qenc_emulate_start(K_MSEC(10), true); /* emulation working now */ rc = k_sem_take(&sem, K_MSEC(200)); zassert_true(rc == 0, "qdec handler should be triggered (%d)", rc); - rc = sensor_sample_fetch(loopback->qdec); + rc = sensor_sample_fetch(dev); zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); - rc = sensor_channel_get(loopback->qdec, SENSOR_CHAN_ROTATION, &val); + rc = sensor_channel_get(dev, SENSOR_CHAN_ROTATION, &val); zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); TC_PRINT("QDEC reading: %d\n", val.val1); zassert_true(val.val1 != 0, "No readings from QDEC"); if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_put(loopback->qdec); + pm_device_runtime_put(dev); } - - qenc_emulate_stop(); - /* emulation not working, but there may be old trigger which needs to be cleaned up */ - rc = k_sem_take(&sem, K_MSEC(200)); } /** @@ -282,37 +280,39 @@ static void sensor_trigger_set_test(struct qdec_qenc_loopback *loopback) */ ZTEST(qdec_sensor, test_sensor_trigger_set) { - for (size_t i = 0; i < TESTED_QDEC_COUNT; i++) { - TC_PRINT("Testing QDEC index %d, address: %p\n", i, loopbacks[i].qdec); - sensor_trigger_set_test(&loopbacks[i]); - } + TC_PRINT("Testing QDEC-0, address: %p\n", qdec_dev); + sensor_trigger_set_test(qdec_dev); +#if defined(SECOND_QDEC_INSTANCE) + TC_PRINT("Testing QDEC-1, address: %p\n", qdec_1_dev); + sensor_trigger_set_test(qdec_1_dev); +#endif } -static void sensor_trigger_set_negative(struct qdec_qenc_loopback *loopback) +static void sensor_trigger_set_negative(const struct device *const dev) { int rc; if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_get(loopback->qdec); + pm_device_runtime_get(dev); } - rc = sensor_trigger_set(loopback->qdec, &qdec_trigger, qdec_trigger_handler); + rc = sensor_trigger_set(dev, &qdec_trigger, qdec_trigger_handler); zassume_true(rc != -ENOSYS, "sensor_trigger_set not supported"); qdec_trigger.type = SENSOR_TRIG_MAX; qdec_trigger.chan = SENSOR_CHAN_ROTATION; - rc = sensor_trigger_set(loopback->qdec, &qdec_trigger, qdec_trigger_handler); + rc = sensor_trigger_set(dev, &qdec_trigger, qdec_trigger_handler); zassume_true(rc < 0, "sensor_trigger_set should fail due to invalid trigger type"); qdec_trigger.type = SENSOR_TRIG_DATA_READY; qdec_trigger.chan = SENSOR_CHAN_MAX; - rc = sensor_trigger_set(loopback->qdec, &qdec_trigger, qdec_trigger_handler); + rc = sensor_trigger_set(dev, &qdec_trigger, qdec_trigger_handler); zassume_true(rc < 0, "sensor_trigger_set should fail due to invalid channel"); if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_put(loopback->qdec); + pm_device_runtime_put(dev); } } @@ -324,10 +324,12 @@ static void sensor_trigger_set_negative(struct qdec_qenc_loopback *loopback) */ ZTEST(qdec_sensor, test_sensor_trigger_set_negative) { - for (size_t i = 0; i < TESTED_QDEC_COUNT; i++) { - TC_PRINT("Testing QDEC index %d, address: %p\n", i, loopbacks[i].qdec); - sensor_trigger_set_negative(&loopbacks[i]); - } + TC_PRINT("Testing QDEC-0, address: %p\n", qdec_dev); + sensor_trigger_set_negative(qdec_dev); +#if defined(SECOND_QDEC_INSTANCE) + TC_PRINT("Testing QDEC-1, address: %p\n", qdec_1_dev); + sensor_trigger_set_negative(qdec_1_dev); +#endif } /** @@ -338,22 +340,37 @@ ZTEST(qdec_sensor, test_sensor_trigger_set_negative) */ ZTEST(qdec_sensor, test_qdec_readings) { - for (size_t i = 0; i < TESTED_QDEC_COUNT; i++) { - if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_get(loopbacks[i].qdec); - } - - TC_PRINT("Testing QDEC index %d, address: %p\n", i, loopbacks[i].qdec); - qenc_emulate_verify_reading(&loopbacks[i], 10, 100, true, false); - qenc_emulate_verify_reading(&loopbacks[i], 2, 500, true, false); - qenc_emulate_verify_reading(&loopbacks[i], 10, 200, false, false); - qenc_emulate_verify_reading(&loopbacks[i], 1, 1000, false, true); - qenc_emulate_verify_reading(&loopbacks[i], 1, 1000, true, true); - - if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_put(loopbacks[i].qdec); - } + if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { + pm_device_runtime_get(qdec_dev); } + + TC_PRINT("Testing QDEC-0, address: %p\n", qdec_dev); + qenc_emulate_verify_reading(qdec_dev, 10, 100, true, false, qdec_config_step); + qenc_emulate_verify_reading(qdec_dev, 2, 500, true, false, qdec_config_step); + qenc_emulate_verify_reading(qdec_dev, 10, 200, false, false, qdec_config_step); + qenc_emulate_verify_reading(qdec_dev, 1, 1000, false, true, qdec_config_step); + qenc_emulate_verify_reading(qdec_dev, 1, 1000, true, true, qdec_config_step); + + if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { + pm_device_runtime_put(qdec_dev); + } + +#if defined(SECOND_QDEC_INSTANCE) + if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { + pm_device_runtime_get(qdec_1_dev); + } + + TC_PRINT("Testing QDEC-1, address: %p\n", qdec_1_dev); + qenc_emulate_verify_reading(qdec_1_dev, 10, 100, true, false, qdec_1_config_step); + qenc_emulate_verify_reading(qdec_1_dev, 2, 500, true, false, qdec_1_config_step); + qenc_emulate_verify_reading(qdec_1_dev, 10, 200, false, false, qdec_1_config_step); + qenc_emulate_verify_reading(qdec_1_dev, 1, 1000, false, true, qdec_1_config_step); + qenc_emulate_verify_reading(qdec_1_dev, 1, 1000, true, true, qdec_1_config_step); + + if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { + pm_device_runtime_put(qdec_1_dev); + } +#endif } static void sensor_channel_get_empty(const struct device *const dev) @@ -402,38 +419,40 @@ static void sensor_channel_get_empty(const struct device *const dev) */ ZTEST(qdec_sensor, test_sensor_channel_get_empty) { - for (size_t i = 0; i < TESTED_QDEC_COUNT; i++) { - TC_PRINT("Testing QDEC index %d, address: %p\n", i, loopbacks[i].qdec); - sensor_channel_get_empty(loopbacks[i].qdec); - } + TC_PRINT("Testing QDEC-0, address: %p\n", qdec_dev); + sensor_channel_get_empty(qdec_dev); +#if defined(SECOND_QDEC_INSTANCE) + TC_PRINT("Testing QDEC-1, address: %p\n", qdec_1_dev); + sensor_channel_get_empty(qdec_1_dev); +#endif } -static void sensor_channel_get_test(struct qdec_qenc_loopback *loopback) +static void sensor_channel_get_test(const struct device *const dev) { int rc; struct sensor_value val_first = {0}; struct sensor_value val_second = {0}; if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_get(loopback->qdec); + pm_device_runtime_get(qdec_dev); } - qenc_emulate_start(loopback, K_MSEC(10), true); + qenc_emulate_start(K_MSEC(10), true); /* wait for some readings*/ k_msleep(100); - rc = sensor_sample_fetch(loopback->qdec); + rc = sensor_sample_fetch(qdec_dev); zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); - rc = sensor_channel_get(loopback->qdec, SENSOR_CHAN_ROTATION, &val_first); + rc = sensor_channel_get(qdec_dev, SENSOR_CHAN_ROTATION, &val_first); zassert_true(rc == 0, "Failed to get sample (%d)", rc); zassert_true(val_first.val1 != 0, "No readings from QDEC"); /* wait for more readings*/ k_msleep(200); - rc = sensor_channel_get(loopback->qdec, SENSOR_CHAN_ROTATION, &val_second); + rc = sensor_channel_get(qdec_dev, SENSOR_CHAN_ROTATION, &val_second); zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); zassert_true(val_second.val1 != 0, "No readings from QDEC"); @@ -451,7 +470,7 @@ static void sensor_channel_get_test(struct qdec_qenc_loopback *loopback) val_second.val2); if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_put(loopback->qdec); + pm_device_runtime_put(qdec_dev); } } @@ -463,36 +482,38 @@ static void sensor_channel_get_test(struct qdec_qenc_loopback *loopback) */ ZTEST(qdec_sensor, test_sensor_channel_get) { - for (size_t i = 0; i < TESTED_QDEC_COUNT; i++) { - TC_PRINT("Testing QDEC index %d, address: %p\n", i, loopbacks[i].qdec); - sensor_channel_get_test(&loopbacks[i]); - } + TC_PRINT("Testing QDEC-0, address: %p\n", qdec_dev); + sensor_channel_get_test(qdec_dev); +#if defined(SECOND_QDEC_INSTANCE) + TC_PRINT("Testing QDEC-1, address: %p\n", qdec_1_dev); + sensor_channel_get_test(qdec_1_dev); +#endif } -static void sensor_channel_get_negative(struct qdec_qenc_loopback *loopback) +static void sensor_channel_get_negative(const struct device *const dev) { int rc; struct sensor_value val = {0}; if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_get(loopback->qdec); + pm_device_runtime_get(dev); } - qenc_emulate_start(loopback, K_MSEC(10), true); + qenc_emulate_start(K_MSEC(10), true); /* wait for some readings*/ k_msleep(100); - rc = sensor_sample_fetch(loopback->qdec); + rc = sensor_sample_fetch(dev); zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); - rc = sensor_channel_get(loopback->qdec, SENSOR_CHAN_MAX, &val); + rc = sensor_channel_get(dev, SENSOR_CHAN_MAX, &val); zassert_true(rc < 0, "Should failed to get sample (%d)", rc); zassert_true(val.val1 == 0, "Some readings from QDEC: %d", val.val1); zassert_true(val.val2 == 0, "Some readings from QDEC: %d", val.val2); if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_put(loopback->qdec); + pm_device_runtime_put(dev); } } @@ -504,10 +525,12 @@ static void sensor_channel_get_negative(struct qdec_qenc_loopback *loopback) */ ZTEST(qdec_sensor, test_sensor_channel_get_negative) { - for (size_t i = 0; i < TESTED_QDEC_COUNT; i++) { - TC_PRINT("Testing QDEC index %d, address: %p\n", i, loopbacks[i].qdec); - sensor_channel_get_negative(&loopbacks[i]); - } + TC_PRINT("Testing QDEC-0, address: %p\n", qdec_dev); + sensor_channel_get_negative(qdec_dev); +#if defined(SECOND_QDEC_INSTANCE) + TC_PRINT("Testing QDEC-1, address: %p\n", qdec_1_dev); + sensor_channel_get_negative(qdec_1_dev); +#endif } static void sensor_sample_fetch_test(const struct device *const dev) @@ -540,22 +563,32 @@ static void sensor_sample_fetch_test(const struct device *const dev) */ ZTEST(qdec_sensor, test_sensor_sample_fetch) { - for (size_t i = 0; i < TESTED_QDEC_COUNT; i++) { - TC_PRINT("Testing QDEC index %d, address: %p\n", i, loopbacks[i].qdec); - sensor_sample_fetch_test(loopbacks[i].qdec); - } + TC_PRINT("Testing QDEC-0, address: %p\n", qdec_dev); + sensor_sample_fetch_test(qdec_dev); +#if defined(SECOND_QDEC_INSTANCE) + TC_PRINT("Testing QDEC-1, address: %p\n", qdec_1_dev); + sensor_sample_fetch_test(qdec_1_dev); +#endif } static void *setup(void) { - for (size_t i = 0; i < TESTED_QDEC_COUNT; i++) { - int rc = device_is_ready(loopbacks[i].qdec); + int rc; - zassert_true(rc, "QDEC index %d not ready: %d", i, rc); + rc = device_is_ready(qdec_dev); + zassert_true(rc, "QDEC device not ready: %d", rc); + + qenc_emulate_setup_pin(&phase_a); + qenc_emulate_setup_pin(&phase_b); + +#if defined(SECOND_QDEC_INSTANCE) + rc = device_is_ready(qdec_1_dev); + zassert_true(rc, "QDEC 1 device not ready: %d", rc); + + qenc_emulate_setup_pin(&phase_a1); + qenc_emulate_setup_pin(&phase_b1); +#endif - qenc_emulate_setup_pin(&loopbacks[i].qenc_phase_a); - qenc_emulate_setup_pin(&loopbacks[i].qenc_phase_b); - } return NULL; } From 095aca08c148eec948fa7cc69649708b38148584 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:37 +0300 Subject: [PATCH 1016/2141] Revert "[nrf fromtree] tests: boards: nrf: qdec: Disable testing of 2nd instance until fixed" This reverts commit 64d730258d9ebfdb61cd2098ebbf3e1c1bf7dd51. Signed-off-by: Jukka Rissanen --- tests/boards/nrf/qdec/src/main.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tests/boards/nrf/qdec/src/main.c b/tests/boards/nrf/qdec/src/main.c index 7df97be2a432..0df3ee2ab952 100644 --- a/tests/boards/nrf/qdec/src/main.c +++ b/tests/boards/nrf/qdec/src/main.c @@ -17,11 +17,7 @@ static const struct gpio_dt_spec phase_b = GPIO_DT_SPEC_GET(DT_ALIAS(qencb), gpi static const struct device *const qdec_dev = DEVICE_DT_GET(DT_ALIAS(qdec0)); static const uint32_t qdec_config_step = DT_PROP(DT_ALIAS(qdec0), steps); -/* Disable testing second QDEC instance - * until the issue with multiple - * QDEC instances support is resolved - */ -#if DT_NODE_EXISTS(DT_ALIAS(qdecX)) +#if DT_NODE_EXISTS(DT_ALIAS(qdec1)) #define SECOND_QDEC_INSTANCE static const struct gpio_dt_spec phase_a1 = GPIO_DT_SPEC_GET(DT_ALIAS(qenca1), gpios); From 6bd20a8b6f45ff5b4c2aaffb5e52eaae3b0f9898 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:37 +0300 Subject: [PATCH 1017/2141] Revert "[nrf fromtree] tests: boards: nrf: qdec: Add testing with multiple QDEC instances" This reverts commit bb1a8e3fa07b0841fdacf487e1cebdf660915eef. Signed-off-by: Jukka Rissanen --- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 57 +--- .../boards/nrf54l15dk_nrf54l15_common.dtsi | 53 +--- tests/boards/nrf/qdec/src/main.c | 272 +++++------------- 3 files changed, 82 insertions(+), 300 deletions(-) diff --git a/tests/boards/nrf/qdec/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/boards/nrf/qdec/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index 78f3aa09ace4..7e6da5a34582 100644 --- a/tests/boards/nrf/qdec/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/tests/boards/nrf/qdec/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -3,21 +3,11 @@ * SPDX-License-Identifier: Apache-2.0 */ -/* Required loopbacks - * P2.08 <-> P2.09 - * P2.10 <-> P2.11 - * P1.02 <-> P1.03 - * P7.01 <-> P1.05 - */ - / { aliases { qdec0 = &qdec130; - qdec1 = &qdec131; qenca = &phase_a; qencb = &phase_b; - qenca1 = &phase_a1; - qencb1 = &phase_b1; }; encoder-emulate { @@ -28,73 +18,34 @@ phase_b: phase_b { gpios = <&gpio2 11 GPIO_ACTIVE_HIGH>; }; - phase_a1: phase_a1 { - gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>; - }; - phase_b1: phase_b1 { - gpios = <&gpio7 1 GPIO_ACTIVE_HIGH>; - }; }; }; &pinctrl { - qdec_130_pinctrl: qdec_130_pinctrl { + qdec_pinctrl: qdec_pinctrl { group1 { psels = , ; }; }; - qdec_130_sleep_pinctrl: qdec_130_sleep_pinctrl { + qdec_sleep_pinctrl: qdec_sleep_pinctrl { group1 { psels = , ; low-power-enable; }; }; - - qdec_131_pinctrl: qdec_131_pinctrl { - group1 { - psels = , - ; - }; - }; - - qdec_131_sleep_pinctrl: qdec_131_sleep_pinctrl { - group1 { - psels = , - ; - low-power-enable; - }; - }; -}; - -&gpio1 { - status = "okay"; }; &gpio2 { status = "okay"; }; -&gpio7 { - status = "okay"; -}; - &qdec130 { status = "okay"; - pinctrl-0 = <&qdec_130_pinctrl>; - pinctrl-1 = <&qdec_130_sleep_pinctrl>; - pinctrl-names = "default", "sleep"; - steps = <127>; - led-pre = <500>; - zephyr,pm-device-runtime-auto; -}; - -&qdec131 { - status = "okay"; - pinctrl-0 = <&qdec_131_pinctrl>; - pinctrl-1 = <&qdec_131_sleep_pinctrl>; + pinctrl-0 = <&qdec_pinctrl>; + pinctrl-1 = <&qdec_sleep_pinctrl>; pinctrl-names = "default", "sleep"; steps = <127>; led-pre = <500>; diff --git a/tests/boards/nrf/qdec/boards/nrf54l15dk_nrf54l15_common.dtsi b/tests/boards/nrf/qdec/boards/nrf54l15dk_nrf54l15_common.dtsi index 06a490d1da08..3fa426569b8b 100644 --- a/tests/boards/nrf/qdec/boards/nrf54l15dk_nrf54l15_common.dtsi +++ b/tests/boards/nrf/qdec/boards/nrf54l15dk_nrf54l15_common.dtsi @@ -3,21 +3,11 @@ * SPDX-License-Identifier: Apache-2.0 */ -/* Required loopbacks - * P1.8 <-> P1.9 - * P1.10 >-> P1.11 - * P2.8 <-> P2.9 - * P2.10 <-> P1.14 - */ - / { aliases { qdec0 = &qdec20; - qdec1 = &qdec21; qenca = &phase_a; qencb = &phase_b; - qenca1 = &phase_a1; - qencb1 = &phase_b1; }; encoder-emulate { @@ -28,69 +18,34 @@ phase_b: phase_b { gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>; }; - phase_a1: phase_a1 { - gpios = <&gpio2 9 GPIO_ACTIVE_HIGH>; - }; - phase_b1: phase_b1 { - gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>; - }; }; }; &pinctrl { - qdec_20_pinctrl: qdec_20_pinctrl { + qdec_pinctrl: qdec_pinctrl { group1 { psels = , ; }; }; - qdec_20_sleep_pinctrl: qdec_20_sleep_pinctrl { + qdec_sleep_pinctrl: qdec_sleep_pinctrl { group1 { psels = , ; low-power-enable; }; }; - - qdec_21_pinctrl: qdec_21_pinctrl { - group1 { - psels = , - ; - }; - }; - - qdec_21_sleep_pinctrl: qdec_21_sleep_pinctrl { - group1 { - psels = , - ; - low-power-enable; - }; - }; }; &gpio1 { status = "okay"; }; -&gpio2 { - status = "okay"; -}; - &qdec20 { status = "okay"; - pinctrl-0 = <&qdec_20_pinctrl>; - pinctrl-1 = <&qdec_20_sleep_pinctrl>; - pinctrl-names = "default", "sleep"; - steps = <127>; - led-pre = <500>; - zephyr,pm-device-runtime-auto; -}; - -&qdec21 { - status = "okay"; - pinctrl-0 = <&qdec_21_pinctrl>; - pinctrl-1 = <&qdec_21_sleep_pinctrl>; + pinctrl-0 = <&qdec_pinctrl>; + pinctrl-1 = <&qdec_sleep_pinctrl>; pinctrl-names = "default", "sleep"; steps = <127>; led-pre = <500>; diff --git a/tests/boards/nrf/qdec/src/main.c b/tests/boards/nrf/qdec/src/main.c index 0df3ee2ab952..d87feb22f42f 100644 --- a/tests/boards/nrf/qdec/src/main.c +++ b/tests/boards/nrf/qdec/src/main.c @@ -16,15 +16,6 @@ static const struct gpio_dt_spec phase_a = GPIO_DT_SPEC_GET(DT_ALIAS(qenca), gpi static const struct gpio_dt_spec phase_b = GPIO_DT_SPEC_GET(DT_ALIAS(qencb), gpios); static const struct device *const qdec_dev = DEVICE_DT_GET(DT_ALIAS(qdec0)); static const uint32_t qdec_config_step = DT_PROP(DT_ALIAS(qdec0), steps); - -#if DT_NODE_EXISTS(DT_ALIAS(qdec1)) -#define SECOND_QDEC_INSTANCE - -static const struct gpio_dt_spec phase_a1 = GPIO_DT_SPEC_GET(DT_ALIAS(qenca1), gpios); -static const struct gpio_dt_spec phase_b1 = GPIO_DT_SPEC_GET(DT_ALIAS(qencb1), gpios); -static const struct device *const qdec_1_dev = DEVICE_DT_GET(DT_ALIAS(qdec1)); -static const uint32_t qdec_1_config_step = DT_PROP(DT_ALIAS(qdec1), steps); -#endif static struct sensor_trigger qdec_trigger = {.type = SENSOR_TRIG_DATA_READY, .chan = SENSOR_CHAN_ROTATION}; static bool toggle_a = true; @@ -33,6 +24,7 @@ static void qdec_trigger_handler(const struct device *dev, const struct sensor_t { zassert_not_null(dev); zassert_not_null(trigger); + zassert_equal_ptr(dev, qdec_dev); /* trigger should be stored as a pointer in a driver * thus this address should match */ @@ -45,14 +37,8 @@ static void qenc_emulate_work_handler(struct k_work *work) { if (toggle_a) { gpio_pin_toggle_dt(&phase_a); -#if defined(SECOND_QDEC_INSTANCE) - gpio_pin_toggle_dt(&phase_a1); -#endif } else { gpio_pin_toggle_dt(&phase_b); -#if defined(SECOND_QDEC_INSTANCE) - gpio_pin_toggle_dt(&phase_b1); -#endif } toggle_a = !toggle_a; } @@ -89,10 +75,6 @@ static void qenc_emulate_start(k_timeout_t period, bool forward) { qenc_emulate_reset_pin(&phase_a); qenc_emulate_reset_pin(&phase_b); -#if defined(SECOND_QDEC_INSTANCE) - qenc_emulate_reset_pin(&phase_a1); - qenc_emulate_reset_pin(&phase_b1); -#endif toggle_a = !forward; @@ -105,20 +87,15 @@ static void qenc_emulate_stop(void) qenc_emulate_reset_pin(&phase_a); qenc_emulate_reset_pin(&phase_b); -#if defined(SECOND_QDEC_INSTANCE) - qenc_emulate_reset_pin(&phase_a1); - qenc_emulate_reset_pin(&phase_b1); -#endif } -static void qenc_emulate_verify_reading(const struct device *const dev, int emulator_period_ms, - int emulation_duration_ms, bool forward, bool overflow_expected, - const uint32_t config_step) +static void qenc_emulate_verify_reading(int emulator_period_ms, int emulation_duration_ms, + bool forward, bool overflow_expected) { int rc; struct sensor_value val = {0}; int32_t expected_steps = emulation_duration_ms / emulator_period_ms; - int32_t expected_reading = 360 * expected_steps / config_step; + int32_t expected_reading = 360 * expected_steps / qdec_config_step; int32_t delta = expected_reading / 5; if (!forward) { @@ -127,10 +104,10 @@ static void qenc_emulate_verify_reading(const struct device *const dev, int emul qenc_emulate_start(K_MSEC(emulator_period_ms), forward); - /* wait for some readings */ + /* wait for some readings*/ k_msleep(emulation_duration_ms); - rc = sensor_sample_fetch(dev); + rc = sensor_sample_fetch(qdec_dev); if (!overflow_expected) { zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); @@ -138,11 +115,9 @@ static void qenc_emulate_verify_reading(const struct device *const dev, int emul zassert_true(rc == -EOVERFLOW, "Failed to detect overflow"); } - rc = sensor_channel_get(dev, SENSOR_CHAN_ROTATION, &val); + rc = sensor_channel_get(qdec_dev, SENSOR_CHAN_ROTATION, &val); zassert_true(rc == 0, "Failed to get sample (%d)", rc); - TC_PRINT("Expected reading: %d, actual value: %d, delta: %d\n", - expected_reading, val.val1, delta); if (!overflow_expected) { zassert_within(val.val1, expected_reading, delta, "Expected reading: %d, but got: %d", expected_reading, val.val1); @@ -153,26 +128,30 @@ static void qenc_emulate_verify_reading(const struct device *const dev, int emul /* wait and get readings to clear state */ k_msleep(100); - rc = sensor_sample_fetch(dev); + rc = sensor_sample_fetch(qdec_dev); zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); - rc = sensor_channel_get(dev, SENSOR_CHAN_ROTATION, &val); + rc = sensor_channel_get(qdec_dev, SENSOR_CHAN_ROTATION, &val); zassert_true(rc == 0, "Failed to get sample (%d)", rc); } -static void sensor_trigger_set_and_disable(const struct device *const dev) +/** + * @brief sensor_trigger_set test disable trigger + * + * Confirm trigger happens after set and stops after being disabled + * + */ +ZTEST(qdec_sensor, test_sensor_trigger_set_and_disable) { int rc; if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_get(dev); + pm_device_runtime_get(qdec_dev); } - k_sem_give(&sem); - qdec_trigger.type = SENSOR_TRIG_DATA_READY; qdec_trigger.chan = SENSOR_CHAN_ALL; - rc = sensor_trigger_set(dev, &qdec_trigger, qdec_trigger_handler); + rc = sensor_trigger_set(qdec_dev, &qdec_trigger, qdec_trigger_handler); zassume_true(rc != -ENOSYS, "sensor_trigger_set not supported"); zassert_true(rc == 0, "sensor_trigger_set failed: %d", rc); @@ -189,7 +168,7 @@ static void sensor_trigger_set_and_disable(const struct device *const dev) rc = k_sem_take(&sem, K_MSEC(200)); if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_put(dev); + pm_device_runtime_put(qdec_dev); } /* there should be no triggers now*/ @@ -197,11 +176,11 @@ static void sensor_trigger_set_and_disable(const struct device *const dev) zassert_true(rc == -EAGAIN, "qdec handler should not be triggered (%d)", rc); if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_get(dev); + pm_device_runtime_get(qdec_dev); } /* register empty trigger - disable trigger */ - rc = sensor_trigger_set(dev, &qdec_trigger, NULL); + rc = sensor_trigger_set(qdec_dev, &qdec_trigger, NULL); zassert_true(rc == 0, "sensor_trigger_set failed: %d", rc); qenc_emulate_start(K_MSEC(10), true); @@ -211,39 +190,28 @@ static void sensor_trigger_set_and_disable(const struct device *const dev) zassert_true(rc == -EAGAIN, "qdec handler should not be triggered (%d)", rc); if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_put(dev); + pm_device_runtime_put(qdec_dev); } } /** - * @brief sensor_trigger_set test disable trigger + * @brief sensor_trigger_set test * - * Confirm trigger happens after set and stops after being disabled + * Confirm trigger happens after set * */ -ZTEST(qdec_sensor, test_sensor_trigger_set_and_disable) -{ - TC_PRINT("Testing QDEC-0, address: %p\n", qdec_dev); - sensor_trigger_set_and_disable(qdec_dev); -#if defined(SECOND_QDEC_INSTANCE) - TC_PRINT("Testing QDEC-1, address: %p\n", qdec_1_dev); - sensor_trigger_set_and_disable(qdec_1_dev); -#endif - -} - -static void sensor_trigger_set_test(const struct device *const dev) +ZTEST(qdec_sensor, test_sensor_trigger_set) { int rc; struct sensor_value val = {0}; if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_get(dev); + pm_device_runtime_get(qdec_dev); } qdec_trigger.type = SENSOR_TRIG_DATA_READY; qdec_trigger.chan = SENSOR_CHAN_ROTATION; - rc = sensor_trigger_set(dev, &qdec_trigger, qdec_trigger_handler); + rc = sensor_trigger_set(qdec_dev, &qdec_trigger, qdec_trigger_handler); zassume_true(rc != -ENOSYS, "sensor_trigger_set not supported"); zassert_true(rc == 0, "sensor_trigger_set failed: %d", rc); @@ -254,80 +222,54 @@ static void sensor_trigger_set_test(const struct device *const dev) rc = k_sem_take(&sem, K_MSEC(200)); zassert_true(rc == 0, "qdec handler should be triggered (%d)", rc); - rc = sensor_sample_fetch(dev); + rc = sensor_sample_fetch(qdec_dev); zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); - rc = sensor_channel_get(dev, SENSOR_CHAN_ROTATION, &val); + rc = sensor_channel_get(qdec_dev, SENSOR_CHAN_ROTATION, &val); zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); TC_PRINT("QDEC reading: %d\n", val.val1); zassert_true(val.val1 != 0, "No readings from QDEC"); if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_put(dev); + pm_device_runtime_put(qdec_dev); } } /** - * @brief sensor_trigger_set test + * @brief sensor_trigger_set test negative * - * Confirm trigger happens after set + * Confirm setting trigger with invalid data does not work * */ -ZTEST(qdec_sensor, test_sensor_trigger_set) -{ - TC_PRINT("Testing QDEC-0, address: %p\n", qdec_dev); - sensor_trigger_set_test(qdec_dev); -#if defined(SECOND_QDEC_INSTANCE) - TC_PRINT("Testing QDEC-1, address: %p\n", qdec_1_dev); - sensor_trigger_set_test(qdec_1_dev); -#endif -} - -static void sensor_trigger_set_negative(const struct device *const dev) +ZTEST(qdec_sensor, test_sensor_trigger_set_negative) { int rc; if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_get(dev); + pm_device_runtime_get(qdec_dev); } - rc = sensor_trigger_set(dev, &qdec_trigger, qdec_trigger_handler); + rc = sensor_trigger_set(qdec_dev, &qdec_trigger, qdec_trigger_handler); zassume_true(rc != -ENOSYS, "sensor_trigger_set not supported"); qdec_trigger.type = SENSOR_TRIG_MAX; qdec_trigger.chan = SENSOR_CHAN_ROTATION; - rc = sensor_trigger_set(dev, &qdec_trigger, qdec_trigger_handler); + rc = sensor_trigger_set(qdec_dev, &qdec_trigger, qdec_trigger_handler); zassume_true(rc < 0, "sensor_trigger_set should fail due to invalid trigger type"); qdec_trigger.type = SENSOR_TRIG_DATA_READY; qdec_trigger.chan = SENSOR_CHAN_MAX; - rc = sensor_trigger_set(dev, &qdec_trigger, qdec_trigger_handler); + rc = sensor_trigger_set(qdec_dev, &qdec_trigger, qdec_trigger_handler); zassume_true(rc < 0, "sensor_trigger_set should fail due to invalid channel"); if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_put(dev); + pm_device_runtime_put(qdec_dev); } } -/** - * @brief sensor_trigger_set test negative - * - * Confirm setting trigger with invalid data does not work - * - */ -ZTEST(qdec_sensor, test_sensor_trigger_set_negative) -{ - TC_PRINT("Testing QDEC-0, address: %p\n", qdec_dev); - sensor_trigger_set_negative(qdec_dev); -#if defined(SECOND_QDEC_INSTANCE) - TC_PRINT("Testing QDEC-1, address: %p\n", qdec_1_dev); - sensor_trigger_set_negative(qdec_1_dev); -#endif -} - /** * @brief QDEC readings tests * @@ -340,90 +282,68 @@ ZTEST(qdec_sensor, test_qdec_readings) pm_device_runtime_get(qdec_dev); } - TC_PRINT("Testing QDEC-0, address: %p\n", qdec_dev); - qenc_emulate_verify_reading(qdec_dev, 10, 100, true, false, qdec_config_step); - qenc_emulate_verify_reading(qdec_dev, 2, 500, true, false, qdec_config_step); - qenc_emulate_verify_reading(qdec_dev, 10, 200, false, false, qdec_config_step); - qenc_emulate_verify_reading(qdec_dev, 1, 1000, false, true, qdec_config_step); - qenc_emulate_verify_reading(qdec_dev, 1, 1000, true, true, qdec_config_step); + qenc_emulate_verify_reading(10, 100, true, false); + qenc_emulate_verify_reading(2, 500, true, false); + qenc_emulate_verify_reading(10, 200, false, false); + qenc_emulate_verify_reading(1, 1000, false, true); + qenc_emulate_verify_reading(1, 1000, true, true); if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { pm_device_runtime_put(qdec_dev); } - -#if defined(SECOND_QDEC_INSTANCE) - if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_get(qdec_1_dev); - } - - TC_PRINT("Testing QDEC-1, address: %p\n", qdec_1_dev); - qenc_emulate_verify_reading(qdec_1_dev, 10, 100, true, false, qdec_1_config_step); - qenc_emulate_verify_reading(qdec_1_dev, 2, 500, true, false, qdec_1_config_step); - qenc_emulate_verify_reading(qdec_1_dev, 10, 200, false, false, qdec_1_config_step); - qenc_emulate_verify_reading(qdec_1_dev, 1, 1000, false, true, qdec_1_config_step); - qenc_emulate_verify_reading(qdec_1_dev, 1, 1000, true, true, qdec_1_config_step); - - if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_put(qdec_1_dev); - } -#endif } -static void sensor_channel_get_empty(const struct device *const dev) +/** + * @brief sensor_channel_get test with no emulation + * + * Confirm getting empty reading from QDEC + * + */ +ZTEST(qdec_sensor, test_sensor_channel_get_empty) { int rc; struct sensor_value val = {0}; if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_get(dev); + pm_device_runtime_get(qdec_dev); } /* wait for potential new readings */ k_msleep(100); - rc = sensor_sample_fetch(dev); + rc = sensor_sample_fetch(qdec_dev); zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); /* get readings but ignore them, as they may include reading from time * when emulation was still working (i.e. during previous test) */ - rc = sensor_channel_get(dev, SENSOR_CHAN_ROTATION, &val); + rc = sensor_channel_get(qdec_dev, SENSOR_CHAN_ROTATION, &val); zassert_true(rc == 0, "Failed to get sample (%d)", rc); /* wait for potential new readings */ k_msleep(100); - rc = sensor_sample_fetch(dev); + rc = sensor_sample_fetch(qdec_dev); zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); /* emulation was not working, expect no readings */ - rc = sensor_channel_get(dev, SENSOR_CHAN_ROTATION, &val); + rc = sensor_channel_get(qdec_dev, SENSOR_CHAN_ROTATION, &val); zassert_true(rc == 0, "Failed to get sample (%d)", rc); zassert_true(val.val1 == 0, "Expected no readings but got: %d", val.val1); zassert_true(val.val2 == 0, "Expected no readings but got: %d", val.val2); if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_put(dev); + pm_device_runtime_put(qdec_dev); } } /** - * @brief sensor_channel_get test with no emulation + * @brief sensor_channel_get test with emulation * - * Confirm getting empty reading from QDEC + * Confirm getting readings from QDEC * */ -ZTEST(qdec_sensor, test_sensor_channel_get_empty) -{ - TC_PRINT("Testing QDEC-0, address: %p\n", qdec_dev); - sensor_channel_get_empty(qdec_dev); -#if defined(SECOND_QDEC_INSTANCE) - TC_PRINT("Testing QDEC-1, address: %p\n", qdec_1_dev); - sensor_channel_get_empty(qdec_1_dev); -#endif -} - -static void sensor_channel_get_test(const struct device *const dev) +ZTEST(qdec_sensor, test_sensor_channel_get) { int rc; struct sensor_value val_first = {0}; @@ -471,28 +391,18 @@ static void sensor_channel_get_test(const struct device *const dev) } /** - * @brief sensor_channel_get test with emulation + * @brief sensor_channel_get test negative * - * Confirm getting readings from QDEC + * Confirm getting readings from QDEC with invalid channel * */ -ZTEST(qdec_sensor, test_sensor_channel_get) -{ - TC_PRINT("Testing QDEC-0, address: %p\n", qdec_dev); - sensor_channel_get_test(qdec_dev); -#if defined(SECOND_QDEC_INSTANCE) - TC_PRINT("Testing QDEC-1, address: %p\n", qdec_1_dev); - sensor_channel_get_test(qdec_1_dev); -#endif -} - -static void sensor_channel_get_negative(const struct device *const dev) +ZTEST(qdec_sensor, test_sensor_channel_get_negative) { int rc; struct sensor_value val = {0}; if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_get(dev); + pm_device_runtime_get(qdec_dev); } qenc_emulate_start(K_MSEC(10), true); @@ -500,73 +410,47 @@ static void sensor_channel_get_negative(const struct device *const dev) /* wait for some readings*/ k_msleep(100); - rc = sensor_sample_fetch(dev); + rc = sensor_sample_fetch(qdec_dev); zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); - rc = sensor_channel_get(dev, SENSOR_CHAN_MAX, &val); + rc = sensor_channel_get(qdec_dev, SENSOR_CHAN_MAX, &val); zassert_true(rc < 0, "Should failed to get sample (%d)", rc); zassert_true(val.val1 == 0, "Some readings from QDEC: %d", val.val1); zassert_true(val.val2 == 0, "Some readings from QDEC: %d", val.val2); if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_put(dev); + pm_device_runtime_put(qdec_dev); } } /** - * @brief sensor_channel_get test negative + * @brief sensor_sample_fetch(_chan) test * - * Confirm getting readings from QDEC with invalid channel + * Confirm fetching work with QDEC specific channel - rotation * */ -ZTEST(qdec_sensor, test_sensor_channel_get_negative) -{ - TC_PRINT("Testing QDEC-0, address: %p\n", qdec_dev); - sensor_channel_get_negative(qdec_dev); -#if defined(SECOND_QDEC_INSTANCE) - TC_PRINT("Testing QDEC-1, address: %p\n", qdec_1_dev); - sensor_channel_get_negative(qdec_1_dev); -#endif -} - -static void sensor_sample_fetch_test(const struct device *const dev) +ZTEST(qdec_sensor, test_sensor_sample_fetch) { int rc; if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_get(dev); + pm_device_runtime_get(qdec_dev); } - rc = sensor_sample_fetch(dev); + rc = sensor_sample_fetch(qdec_dev); zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); - rc = sensor_sample_fetch_chan(dev, SENSOR_CHAN_ROTATION); + rc = sensor_sample_fetch_chan(qdec_dev, SENSOR_CHAN_ROTATION); zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); - rc = sensor_sample_fetch_chan(dev, SENSOR_CHAN_MAX); + rc = sensor_sample_fetch_chan(qdec_dev, SENSOR_CHAN_MAX); zassert_true(rc < 0, "Should fail to fetch sample from invalid channel (%d)", rc); if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_put(dev); + pm_device_runtime_put(qdec_dev); } } -/** - * @brief sensor_sample_fetch(_chan) test - * - * Confirm fetching work with QDEC specific channel - rotation - * - */ -ZTEST(qdec_sensor, test_sensor_sample_fetch) -{ - TC_PRINT("Testing QDEC-0, address: %p\n", qdec_dev); - sensor_sample_fetch_test(qdec_dev); -#if defined(SECOND_QDEC_INSTANCE) - TC_PRINT("Testing QDEC-1, address: %p\n", qdec_1_dev); - sensor_sample_fetch_test(qdec_1_dev); -#endif -} - static void *setup(void) { int rc; @@ -577,14 +461,6 @@ static void *setup(void) qenc_emulate_setup_pin(&phase_a); qenc_emulate_setup_pin(&phase_b); -#if defined(SECOND_QDEC_INSTANCE) - rc = device_is_ready(qdec_1_dev); - zassert_true(rc, "QDEC 1 device not ready: %d", rc); - - qenc_emulate_setup_pin(&phase_a1); - qenc_emulate_setup_pin(&phase_b1); -#endif - return NULL; } From af585c0279ce84494efd3cd82ed7b08d081503b8 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:37 +0300 Subject: [PATCH 1018/2141] Revert "[nrf fromtree] Bluetooth: Mesh: Blob Server considers friendship" This reverts commit 1ed3c0dd5c9ddbccd5a1c19a5720d27880c7dd69. Signed-off-by: Jukka Rissanen --- subsys/bluetooth/mesh/blob_srv.c | 28 ++-------------------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/subsys/bluetooth/mesh/blob_srv.c b/subsys/bluetooth/mesh/blob_srv.c index c022352b040c..2d4ec561f834 100644 --- a/subsys/bluetooth/mesh/blob_srv.c +++ b/subsys/bluetooth/mesh/blob_srv.c @@ -151,12 +151,8 @@ static int pull_req_max(const struct bt_mesh_blob_srv *srv) BLOB_CHUNK_SDU_LEN(srv->state.xfer.chunk_size), BT_MESH_APP_SEG_SDU_MAX); - /* It is possible that the friend node cannot hold all segments per chunk. In this - * case, we should request at least 1 chunk. As requesting `0` would be invalid. - */ - count = MAX(1, MIN(CONFIG_BT_MESH_BLOB_SRV_PULL_REQ_COUNT, - bt_mesh.lpn.queue_size / segments_per_chunk)); - + count = MIN(CONFIG_BT_MESH_BLOB_SRV_PULL_REQ_COUNT, + bt_mesh.lpn.queue_size / segments_per_chunk); } #endif @@ -825,27 +821,7 @@ static int handle_info_get(const struct bt_mesh_model *mod, struct bt_mesh_msg_c net_buf_simple_add_u8(&rsp, BLOB_BLOCK_SIZE_LOG_MIN); net_buf_simple_add_u8(&rsp, BLOB_BLOCK_SIZE_LOG_MAX); net_buf_simple_add_le16(&rsp, CONFIG_BT_MESH_BLOB_CHUNK_COUNT_MAX); - -#if defined(CONFIG_BT_MESH_LOW_POWER) - /* If friendship is established, then chunk size is according to friend's queue size. - * Chunk size = (Queue size * Segment size) - (Opcode (1) - Chunk Number (2) - * - 8 byte MIC (max)) - */ - if (bt_mesh_lpn_established() && bt_mesh.lpn.queue_size > 0) { - uint16_t chunk_size = (bt_mesh.lpn.queue_size * 12) - 11; - - chunk_size = MIN(chunk_size, BLOB_RX_CHUNK_SIZE); - net_buf_simple_add_le16(&rsp, chunk_size); - if (bt_mesh.lpn.queue_size <= 2) { - LOG_WRN("FndQ too small %u", bt_mesh.lpn.queue_size); - } - } else { - net_buf_simple_add_le16(&rsp, BLOB_RX_CHUNK_SIZE); - } -#else net_buf_simple_add_le16(&rsp, BLOB_RX_CHUNK_SIZE); -#endif - net_buf_simple_add_le32(&rsp, CONFIG_BT_MESH_BLOB_SIZE_MAX); net_buf_simple_add_le16(&rsp, MTU_SIZE_MAX); net_buf_simple_add_u8(&rsp, BT_MESH_BLOB_XFER_MODE_ALL); From 096ec6d878208f0cfa48ed43652b1477ede5092b Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:37 +0300 Subject: [PATCH 1019/2141] Revert "[nrf fromtree] dts: nordic: Fix GPREGRET addresses for nRF54LM20A" This reverts commit b57c64b8fcf5a7e5e3b7a501074d364d36471f18. Signed-off-by: Jukka Rissanen --- dts/vendor/nordic/nrf54lm20a.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dts/vendor/nordic/nrf54lm20a.dtsi b/dts/vendor/nordic/nrf54lm20a.dtsi index d1e6d1b0d28a..d673ae94e509 100644 --- a/dts/vendor/nordic/nrf54lm20a.dtsi +++ b/dts/vendor/nordic/nrf54lm20a.dtsi @@ -800,19 +800,19 @@ #address-cells = <1>; #size-cells = <1>; - gpregret1: gpregret1@500 { + gpregret1: gpregret1@51c { #address-cells = <1>; #size-cells = <1>; compatible = "nordic,nrf-gpregret"; - reg = <0x500 0x1>; + reg = <0x51c 0x1>; status = "disabled"; }; - gpregret2: gpregret2@504 { + gpregret2: gpregret2@520 { #address-cells = <1>; #size-cells = <1>; compatible = "nordic,nrf-gpregret"; - reg = <0x504 0x1>; + reg = <0x520 0x1>; status = "disabled"; }; }; From 65f07bceac668884af4c6f23dee2d152049b1e63 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:37 +0300 Subject: [PATCH 1020/2141] Revert "[nrf fromtree] soc: nordic: Extend address validation to cover GPREGRET" This reverts commit d45132712f2f0a846c04f0c171ec9fcbd43d8d1a. Signed-off-by: Jukka Rissanen --- soc/nordic/validate_base_addresses.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/soc/nordic/validate_base_addresses.c b/soc/nordic/validate_base_addresses.c index 7426364417fe..f3c9c8bf2145 100644 --- a/soc/nordic/validate_base_addresses.c +++ b/soc/nordic/validate_base_addresses.c @@ -73,19 +73,13 @@ #define NRF_WDT0 NRF_WDT #endif -#if !defined(NRF_POWER_GPREGRET1) && defined(NRF_POWER) #if defined(CONFIG_SOC_SERIES_NRF51X) || defined(CONFIG_SOC_SERIES_NRF52X) -#define NRF_POWER_GPREGRET1 (&NRF_POWER->GPREGRET) -#else -#define NRF_POWER_GPREGRET1 (&NRF_POWER->GPREGRET[0]) -#endif +#if !defined(NRF_POWER_GPREGRET1) && defined(NRF_POWER_BASE) +#define NRF_POWER_GPREGRET1 (0x51c + NRF_POWER_BASE) #endif -#if !defined(NRF_POWER_GPREGRET2) && defined(NRF_POWER) -#if defined(CONFIG_SOC_SERIES_NRF51X) || defined(CONFIG_SOC_SERIES_NRF52X) -#define NRF_POWER_GPREGRET2 (&NRF_POWER->GPREGRET2) -#else -#define NRF_POWER_GPREGRET2 (&NRF_POWER->GPREGRET[1]) +#if !defined(NRF_POWER_GPREGRET2) && defined(NRF_POWER_BASE) +#define NRF_POWER_GPREGRET2 (0x520 + NRF_POWER_BASE) #endif #endif @@ -373,5 +367,9 @@ CHECK_DT_REG(cpurad_wdt010, NRF_RADIOCORE_WDT010); CHECK_DT_REG(cpurad_wdt011, NRF_RADIOCORE_WDT011); CHECK_DT_REG(wdt131, NRF_WDT131); CHECK_DT_REG(wdt132, NRF_WDT132); + +/* nRF51/nRF52-specific addresses */ +#if defined(CONFIG_SOC_SERIES_NRF51X) || defined(CONFIG_SOC_SERIES_NRF52X) CHECK_DT_REG(gpregret1, NRF_POWER_GPREGRET1); CHECK_DT_REG(gpregret2, NRF_POWER_GPREGRET2); +#endif From cb83c8ed355308e0b89d5bb577355aaa706f8c4d Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:37 +0300 Subject: [PATCH 1021/2141] Revert "[nrf fromlist] samples: nordic: system_off: check for supported reset causes" This reverts commit 49957e518f5cd614529c2bc69e606e870629c1af. Signed-off-by: Jukka Rissanen --- samples/boards/nordic/system_off/src/main.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/samples/boards/nordic/system_off/src/main.c b/samples/boards/nordic/system_off/src/main.c index b4c2eeb2b1bb..d119eff87dac 100644 --- a/samples/boards/nordic/system_off/src/main.c +++ b/samples/boards/nordic/system_off/src/main.c @@ -31,17 +31,8 @@ static const struct gpio_dt_spec sw0 = GPIO_DT_SPEC_GET(DT_ALIAS(sw0), gpios); static const struct device *comp_dev = DEVICE_DT_GET(DT_NODELABEL(comp)); #endif -int print_reset_cause(uint32_t reset_cause) +void print_reset_cause(uint32_t reset_cause) { - int32_t ret; - uint32_t supported; - - ret = hwinfo_get_supported_reset_cause((uint32_t *) &supported); - - if (ret || !(reset_cause & supported)) { - return -ENOTSUP; - } - if (reset_cause & RESET_DEBUG) { printf("Reset by debugger.\n"); } else if (reset_cause & RESET_CLOCK) { @@ -51,8 +42,6 @@ int print_reset_cause(uint32_t reset_cause) } else { printf("Other wake up cause 0x%08X.\n", reset_cause); } - - return 0; } int main(void) @@ -68,12 +57,7 @@ int main(void) printf("\n%s system off demo\n", CONFIG_BOARD); hwinfo_get_reset_cause(&reset_cause); - rc = print_reset_cause(reset_cause); - - if (rc < 0) { - printf("Reset cause not supported.\n"); - return 0; - } + print_reset_cause(reset_cause); if (IS_ENABLED(CONFIG_APP_USE_RETAINED_MEM)) { bool retained_ok = retained_validate(); From f09f825aec1eb593fde921f6ad831eaa639f38a9 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:37 +0300 Subject: [PATCH 1022/2141] Revert "[nrf fromlist] drivers: hwinfo: nrf: extend supported reset reasons" This reverts commit d6ac46be53344353db054fd4a6068868d1b99457. Signed-off-by: Jukka Rissanen --- drivers/hwinfo/hwinfo_nrf.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/drivers/hwinfo/hwinfo_nrf.c b/drivers/hwinfo/hwinfo_nrf.c index 3d3314ddf581..f5a6ed38a20f 100644 --- a/drivers/hwinfo/hwinfo_nrf.c +++ b/drivers/hwinfo/hwinfo_nrf.c @@ -207,15 +207,6 @@ int z_impl_hwinfo_get_supported_reset_cause(uint32_t *supported) | RESET_SOFTWARE | RESET_CPU_LOCKUP | RESET_LOW_POWER_WAKE -#if NRFX_RESET_REASON_HAS_VBUS - | RESET_POR -#endif -#if NRFX_RESET_REASON_HAS_GRTC - | RESET_CLOCK -#endif -#if defined(NRFX_RESET_REASON_TAMPC_MASK) || defined(NRFX_RESET_REASON_SECTAMPER_MASK) - | RESET_SECURITY -#endif | RESET_DEBUG); return 0; From d48f2d5f9d86ee6581049409e96789063a1706a7 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:37 +0300 Subject: [PATCH 1023/2141] Revert "[nrf fromlist] drivers: firmware: remove duplicate function definitions" This reverts commit 10fd4547f9aba742598e82a3975222fe7b07e267. Signed-off-by: Jukka Rissanen --- include/zephyr/drivers/firmware/tisci/tisci.h | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/include/zephyr/drivers/firmware/tisci/tisci.h b/include/zephyr/drivers/firmware/tisci/tisci.h index 38fc58b91214..8097d6d44059 100644 --- a/include/zephyr/drivers/firmware/tisci/tisci.h +++ b/include/zephyr/drivers/firmware/tisci/tisci.h @@ -891,6 +891,44 @@ int tisci_cmd_set_fwl_region(const struct device *dev, const struct tisci_msg_fw */ int tisci_cmd_get_fwl_region(const struct device *dev, struct tisci_msg_fwl_region *region); +/* INCLUDE_ZEPHYR_DRIVERS_TISCI_H_ */ + +/* Firewall Management Functions */ +/* ... previous firewall functions ... */ + +/** + * @brief Get firewall region configuration + * + * Retrieves the configuration of a firewall region including permissions, + * addresses, and control settings. + * + * @param dev Pointer to the TI SCI device + * @param region Pointer to store the firewall region configuration. + * The fwl_id, region, and n_permission_regs fields must be + * set before calling this function. + * + * @return 0 if successful, or an error code + */ +int tisci_cmd_get_fwl_region(const struct device *dev, struct tisci_msg_fwl_region *region); + +/* Firewall Management Functions */ +/* ... previous firewall functions ... */ + +/** + * @brief Get firewall region configuration + * + * Retrieves the configuration of a firewall region including permissions, + * addresses, and control settings. + * + * @param dev Pointer to the TI SCI device + * @param region Pointer to store the firewall region configuration. + * The fwl_id, region, and n_permission_regs fields must be + * set before calling this function. + * + * @return 0 if successful, or an error code + */ +int tisci_cmd_get_fwl_region(const struct device *dev, struct tisci_msg_fwl_region *region); + /* Firewall Management Functions */ /* ... previous firewall functions ... */ From 9ea7cdd8c7f36a48151dc1ecb688a480a0b70d93 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:37 +0300 Subject: [PATCH 1024/2141] Revert "[nrf fromtree] manifest: Update nRF hw models to latest" This reverts commit 2c70598db1380173cedfaf193c93d9c540fdd72e. Signed-off-by: Jukka Rissanen --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 853d84113a68..6ec17c12dce4 100644 --- a/west.yml +++ b/west.yml @@ -325,7 +325,7 @@ manifest: groups: - tools - name: nrf_hw_models - revision: 8b6001d6bdd9e2c8bb858fdb26f696f6d5f73db5 + revision: 6e5961223f81aa2707c555db138819a5c1b7942c path: modules/bsim_hw_models/nrf_hw_models - name: nrf_wifi revision: 787eea1a3c8dd13c86214e204a919e6f9bcebf91 From ae5412c7083aa200b32af888b6119c30096a06ce Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:37 +0300 Subject: [PATCH 1025/2141] Revert "[nrf fromtree] manifest: Update nRF hw models to latest" This reverts commit c09cc2f94af10b1996f9e0c726d25f252c434af0. Signed-off-by: Jukka Rissanen --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 6ec17c12dce4..41fa45c86936 100644 --- a/west.yml +++ b/west.yml @@ -325,7 +325,7 @@ manifest: groups: - tools - name: nrf_hw_models - revision: 6e5961223f81aa2707c555db138819a5c1b7942c + revision: 968d55ff22579080466bf2f482596dd6e35361c6 path: modules/bsim_hw_models/nrf_hw_models - name: nrf_wifi revision: 787eea1a3c8dd13c86214e204a919e6f9bcebf91 From 90d5b0d54f56f43318f76360ea3a077e705daaf1 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:37 +0300 Subject: [PATCH 1026/2141] Revert "[nrf fromlist] doc: extensions: kconfig: Add support for sysbuild" This reverts commit 6fb16ab25d1adff73dbde6b89defcc6ce8a20734. Signed-off-by: Jukka Rissanen --- doc/_extensions/zephyr/kconfig/__init__.py | 276 ++++++++++----------- 1 file changed, 130 insertions(+), 146 deletions(-) diff --git a/doc/_extensions/zephyr/kconfig/__init__.py b/doc/_extensions/zephyr/kconfig/__init__.py index eb1903b18982..6bf828a9088e 100644 --- a/doc/_extensions/zephyr/kconfig/__init__.py +++ b/doc/_extensions/zephyr/kconfig/__init__.py @@ -70,24 +70,19 @@ ZEPHYR_BASE = Path(__file__).parents[4] -def kconfig_load(app: Sphinx) -> tuple[kconfiglib.Kconfig, kconfiglib.Kconfig, dict[str, str]]: +def kconfig_load(app: Sphinx) -> tuple[kconfiglib.Kconfig, dict[str, str]]: """Load Kconfig""" with TemporaryDirectory() as td: modules = zephyr_module.parse_modules(ZEPHYR_BASE) # generate Kconfig.modules file kconfig = "" - sysbuild_kconfig = "" for module in modules: kconfig += zephyr_module.process_kconfig(module.project, module.meta) - sysbuild_kconfig += zephyr_module.process_sysbuildkconfig(module.project, module.meta) with open(Path(td) / "Kconfig.modules", "w") as f: f.write(kconfig) - with open(Path(td) / "Kconfig.sysbuild.modules", "w") as f: - f.write(sysbuild_kconfig) - # generate dummy Kconfig.dts file kconfig = "" @@ -150,13 +145,6 @@ def kconfig_load(app: Sphinx) -> tuple[kconfiglib.Kconfig, kconfiglib.Kconfig, d os.environ["BOARD"] = "boards" os.environ["KCONFIG_BOARD_DIR"] = str(Path(td) / "boards") - # Sysbuild runs first - os.environ["CONFIG_"] = "SB_CONFIG_" - sysbuild_output = kconfiglib.Kconfig(ZEPHYR_BASE / "share" / "sysbuild" / "Kconfig") - - # Normal Kconfig runs second - os.environ["CONFIG_"] = "CONFIG_" - # insert external Kconfigs to the environment module_paths = dict() for module in modules: @@ -184,7 +172,7 @@ def kconfig_load(app: Sphinx) -> tuple[kconfiglib.Kconfig, kconfiglib.Kconfig, d if kconfig.exists(): os.environ[f"ZEPHYR_{name_var}_KCONFIG"] = str(kconfig) - return kconfiglib.Kconfig(ZEPHYR_BASE / "Kconfig"), sysbuild_output, module_paths + return kconfiglib.Kconfig(ZEPHYR_BASE / "Kconfig"), module_paths class KconfigSearchNode(nodes.Element): @@ -344,15 +332,13 @@ def add_option(self, option): def sc_fmt(sc): - prefix = os.environ["CONFIG_"] - if isinstance(sc, kconfiglib.Symbol): if sc.nodes: - return f'{prefix}{sc.name}' + return f'CONFIG_{sc.name}' elif isinstance(sc, kconfiglib.Choice): if not sc.name: return "<choice>" - return f'<choice {prefix}{sc.name}>' + return f'<choice CONFIG_{sc.name}>' return kconfiglib.standard_sc_expr_str(sc) @@ -364,139 +350,137 @@ def kconfig_build_resources(app: Sphinx) -> None: return with progress_message("Building Kconfig database..."): - kconfig, sysbuild_kconfig, module_paths = kconfig_load(app) + kconfig, module_paths = kconfig_load(app) db = list() - for kconfig_obj in [kconfig, sysbuild_kconfig]: - os.environ["CONFIG_"] = kconfig_obj.config_prefix - for sc in sorted( - chain(kconfig_obj.unique_defined_syms, kconfig_obj.unique_choices), - key=lambda sc: sc.name if sc.name else "", - ): - # skip nameless symbols - if not sc.name: + for sc in sorted( + chain(kconfig.unique_defined_syms, kconfig.unique_choices), + key=lambda sc: sc.name if sc.name else "", + ): + # skip nameless symbols + if not sc.name: + continue + + # store alternative defaults (from defconfig files) + alt_defaults = list() + for node in sc.nodes: + if "defconfig" not in node.filename: continue - # store alternative defaults (from defconfig files) - alt_defaults = list() - for node in sc.nodes: - if "defconfig" not in str(node.filename): - continue - - for value, cond in node.orig_defaults: - fmt = kconfiglib.expr_str(value, sc_fmt) - if cond is not sc.kconfig.y: - fmt += f" if {kconfiglib.expr_str(cond, sc_fmt)}" - alt_defaults.append([fmt, node.filename]) - - # build list of symbols that select/imply the current one - # note: all reverse dependencies are ORed together, and conditionals - # (e.g. select/imply A if B) turns into A && B. So we first split - # by OR to include all entries, and we split each one by AND to just - # take the first entry. - selected_by = list() - if isinstance(sc, kconfiglib.Symbol) and sc.rev_dep != sc.kconfig.n: - for select in kconfiglib.split_expr(sc.rev_dep, kconfiglib.OR): - sym = kconfiglib.split_expr(select, kconfiglib.AND)[0] - selected_by.append(f"{kconfig_obj.config_prefix}{sym.name}") - - implied_by = list() - if isinstance(sc, kconfiglib.Symbol) and sc.weak_rev_dep != sc.kconfig.n: - for select in kconfiglib.split_expr(sc.weak_rev_dep, kconfiglib.OR): - sym = kconfiglib.split_expr(select, kconfiglib.AND)[0] - implied_by.append(f"{kconfig_obj.config_prefix}{sym.name}") - - # only process nodes with prompt or help - nodes = [node for node in sc.nodes if node.prompt or node.help] - - inserted_paths = list() - for node in nodes: - # avoid duplicate symbols by forcing unique paths. this can - # happen due to dependencies on 0, a trick used by some modules - path = f"{node.filename}:{node.linenr}" - if path in inserted_paths: - continue - inserted_paths.append(path) - - dependencies = None - if node.dep is not sc.kconfig.y: - dependencies = kconfiglib.expr_str(node.dep, sc_fmt) - - defaults = list() - for value, cond in node.orig_defaults: - fmt = kconfiglib.expr_str(value, sc_fmt) - if cond is not sc.kconfig.y: - fmt += f" if {kconfiglib.expr_str(cond, sc_fmt)}" - defaults.append(fmt) - - selects = list() - for value, cond in node.orig_selects: - fmt = kconfiglib.expr_str(value, sc_fmt) - if cond is not sc.kconfig.y: - fmt += f" if {kconfiglib.expr_str(cond, sc_fmt)}" - selects.append(fmt) - - implies = list() - for value, cond in node.orig_implies: - fmt = kconfiglib.expr_str(value, sc_fmt) - if cond is not sc.kconfig.y: - fmt += f" if {kconfiglib.expr_str(cond, sc_fmt)}" - implies.append(fmt) - - ranges = list() - for min, max, cond in node.orig_ranges: - fmt = ( - f"[{kconfiglib.expr_str(min, sc_fmt)}, " - f"{kconfiglib.expr_str(max, sc_fmt)}]" - ) - if cond is not sc.kconfig.y: - fmt += f" if {kconfiglib.expr_str(cond, sc_fmt)}" - ranges.append(fmt) - - choices = list() - if isinstance(sc, kconfiglib.Choice): - for sym in sc.syms: - choices.append(kconfiglib.expr_str(sym, sc_fmt)) - - menupath = "" - iternode = node - while iternode.parent is not iternode.kconfig.top_node: - iternode = iternode.parent - if iternode.prompt: - title = iternode.prompt[0] - else: - title = kconfiglib.standard_sc_expr_str(iternode.item) - menupath = f" > {title}" + menupath - - menupath = "(Top)" + menupath - - filename = str(node.filename) - for name, path in module_paths.items(): - path += "/" - if str(node.filename).startswith(path): - filename = str(node.filename).replace(path, f"/") - break - - db.append( - { - "name": f"{kconfig_obj.config_prefix}{sc.name}", - "prompt": node.prompt[0] if node.prompt else None, - "type": kconfiglib.TYPE_TO_STR[sc.type], - "help": node.help, - "dependencies": dependencies, - "defaults": defaults, - "alt_defaults": alt_defaults, - "selects": selects, - "selected_by": selected_by, - "implies": implies, - "implied_by": implied_by, - "ranges": ranges, - "choices": choices, - "filename": filename, - "linenr": node.linenr, - "menupath": menupath, - } + for value, cond in node.orig_defaults: + fmt = kconfiglib.expr_str(value, sc_fmt) + if cond is not sc.kconfig.y: + fmt += f" if {kconfiglib.expr_str(cond, sc_fmt)}" + alt_defaults.append([fmt, node.filename]) + + # build list of symbols that select/imply the current one + # note: all reverse dependencies are ORed together, and conditionals + # (e.g. select/imply A if B) turns into A && B. So we first split + # by OR to include all entries, and we split each one by AND to just + # take the first entry. + selected_by = list() + if isinstance(sc, kconfiglib.Symbol) and sc.rev_dep != sc.kconfig.n: + for select in kconfiglib.split_expr(sc.rev_dep, kconfiglib.OR): + sym = kconfiglib.split_expr(select, kconfiglib.AND)[0] + selected_by.append(f"CONFIG_{sym.name}") + + implied_by = list() + if isinstance(sc, kconfiglib.Symbol) and sc.weak_rev_dep != sc.kconfig.n: + for select in kconfiglib.split_expr(sc.weak_rev_dep, kconfiglib.OR): + sym = kconfiglib.split_expr(select, kconfiglib.AND)[0] + implied_by.append(f"CONFIG_{sym.name}") + + # only process nodes with prompt or help + nodes = [node for node in sc.nodes if node.prompt or node.help] + + inserted_paths = list() + for node in nodes: + # avoid duplicate symbols by forcing unique paths. this can + # happen due to dependencies on 0, a trick used by some modules + path = f"{node.filename}:{node.linenr}" + if path in inserted_paths: + continue + inserted_paths.append(path) + + dependencies = None + if node.dep is not sc.kconfig.y: + dependencies = kconfiglib.expr_str(node.dep, sc_fmt) + + defaults = list() + for value, cond in node.orig_defaults: + fmt = kconfiglib.expr_str(value, sc_fmt) + if cond is not sc.kconfig.y: + fmt += f" if {kconfiglib.expr_str(cond, sc_fmt)}" + defaults.append(fmt) + + selects = list() + for value, cond in node.orig_selects: + fmt = kconfiglib.expr_str(value, sc_fmt) + if cond is not sc.kconfig.y: + fmt += f" if {kconfiglib.expr_str(cond, sc_fmt)}" + selects.append(fmt) + + implies = list() + for value, cond in node.orig_implies: + fmt = kconfiglib.expr_str(value, sc_fmt) + if cond is not sc.kconfig.y: + fmt += f" if {kconfiglib.expr_str(cond, sc_fmt)}" + implies.append(fmt) + + ranges = list() + for min, max, cond in node.orig_ranges: + fmt = ( + f"[{kconfiglib.expr_str(min, sc_fmt)}, " + f"{kconfiglib.expr_str(max, sc_fmt)}]" ) + if cond is not sc.kconfig.y: + fmt += f" if {kconfiglib.expr_str(cond, sc_fmt)}" + ranges.append(fmt) + + choices = list() + if isinstance(sc, kconfiglib.Choice): + for sym in sc.syms: + choices.append(kconfiglib.expr_str(sym, sc_fmt)) + + menupath = "" + iternode = node + while iternode.parent is not iternode.kconfig.top_node: + iternode = iternode.parent + if iternode.prompt: + title = iternode.prompt[0] + else: + title = kconfiglib.standard_sc_expr_str(iternode.item) + menupath = f" > {title}" + menupath + + menupath = "(Top)" + menupath + + filename = node.filename + for name, path in module_paths.items(): + path += "/" + if node.filename.startswith(path): + filename = node.filename.replace(path, f"/") + break + + db.append( + { + "name": f"CONFIG_{sc.name}", + "prompt": node.prompt[0] if node.prompt else None, + "type": kconfiglib.TYPE_TO_STR[sc.type], + "help": node.help, + "dependencies": dependencies, + "defaults": defaults, + "alt_defaults": alt_defaults, + "selects": selects, + "selected_by": selected_by, + "implies": implies, + "implied_by": implied_by, + "ranges": ranges, + "choices": choices, + "filename": filename, + "linenr": node.linenr, + "menupath": menupath, + } + ) app.env.kconfig_db = db # type: ignore From 5c896a2b06c52edae1ae1d8dc33388f3fb0dbe45 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:37 +0300 Subject: [PATCH 1027/2141] Revert "[nrf noup] bluetooth: host: Allow auto swap feature without privacy" This reverts commit c1ddd14ed35f577e22cdd0021781a70bda2a0926. Signed-off-by: Jukka Rissanen --- subsys/bluetooth/host/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/bluetooth/host/Kconfig b/subsys/bluetooth/host/Kconfig index da1928758fd9..3830745417ae 100644 --- a/subsys/bluetooth/host/Kconfig +++ b/subsys/bluetooth/host/Kconfig @@ -633,7 +633,7 @@ config BT_ID_UNPAIR_MATCHING_BONDS config BT_ID_AUTO_SWAP_MATCHING_BONDS bool "Automatically swap conflicting entries in the Resolving List" depends on !BT_ID_UNPAIR_MATCHING_BONDS - depends on BT_SMP && BT_PERIPHERAL && !BT_CENTRAL + depends on BT_PRIVACY && BT_PERIPHERAL && !BT_CENTRAL help If this option is enabled, the Host will not add a new bond with the same peer address (or IRK) to the Resolving List if there is From b8ff98c73901a16b1a9d996dfca7fe1570e8f903 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:37 +0300 Subject: [PATCH 1028/2141] Revert "[nrf fromtree] cmake: mcuboot: SHA512/pure image signing" This reverts commit c136755381da8ba816a7be35bc0ff8050fc559df. Signed-off-by: Jukka Rissanen --- cmake/mcuboot.cmake | 7 ------- modules/Kconfig.mcuboot | 12 ------------ 2 files changed, 19 deletions(-) diff --git a/cmake/mcuboot.cmake b/cmake/mcuboot.cmake index ac37b175a31b..d2fcf68e8897 100644 --- a/cmake/mcuboot.cmake +++ b/cmake/mcuboot.cmake @@ -152,13 +152,6 @@ function(zephyr_mcuboot_tasks) set(imgtool_args --align ${write_block_size} ${imgtool_args}) endif() - # Set proper hash calculation algorithm for signing - if(CONFIG_MCUBOOT_BOOTLOADER_SIGNATURE_TYPE_PURE) - set(imgtool_args --pure ${imgtool_args}) - elseif(CONFIG_MCUBOOT_BOOTLOADER_USES_SHA512) - set(imgtool_args --sha 512 ${imgtool_args}) - endif() - # Extensionless prefix of any output file. set(output ${ZEPHYR_BINARY_DIR}/${KERNEL_NAME}) diff --git a/modules/Kconfig.mcuboot b/modules/Kconfig.mcuboot index a95dc34b72f7..c02ee43f5eb8 100644 --- a/modules/Kconfig.mcuboot +++ b/modules/Kconfig.mcuboot @@ -288,18 +288,6 @@ config MCUBOOT_BOOTLOADER_NO_DOWNGRADE MCUBOOT_DOWNGRADE_PREVENTION option enabled. endif -config MCUBOOT_BOOTLOADER_USES_SHA512 - bool "MCUboot uses SHA512 for image hash" - help - MCUboot has been compiled to verify images using SHA512. - -config MCUBOOT_BOOTLOADER_SIGNATURE_TYPE_PURE - bool "Signature is verified over an image rather than sha of an image" - help - MCUboot has been compiled to verify images using pure signature - verification, i.e., the signature is verified over the image rather - than the SHA of the image. - config MCUBOOT_APPLICATION_FIRMWARE_UPDATER bool "Application is firmware updater image" depends on MCUBOOT_BOOTLOADER_MODE_FIRMWARE_UPDATER From c9c6bb390873f13fa70358370b0601d07638a5dc Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:37 +0300 Subject: [PATCH 1029/2141] Revert "[nrf fromlist] samples: bluetooth: Add support for nRF54lm20a to two samples" This reverts commit 8d7b9c9d00552a89eb04755435e24d555894d819. Signed-off-by: Jukka Rissanen --- samples/bluetooth/beacon/sample.yaml | 2 -- samples/bluetooth/peripheral_hr/sample.yaml | 2 -- 2 files changed, 4 deletions(-) diff --git a/samples/bluetooth/beacon/sample.yaml b/samples/bluetooth/beacon/sample.yaml index 00215341924f..819ac3d30024 100644 --- a/samples/bluetooth/beacon/sample.yaml +++ b/samples/bluetooth/beacon/sample.yaml @@ -10,7 +10,6 @@ tests: - nrf52dk/nrf52832 - nrf54l15dk/nrf54l15/cpuapp - ophelia4ev/nrf54l15/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp tags: bluetooth integration_platforms: - qemu_cortex_m3 @@ -18,7 +17,6 @@ tests: - nrf52dk/nrf52832 - nrf54l15dk/nrf54l15/cpuapp - ophelia4ev/nrf54l15/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp sample.bluetooth.beacon-coex: extra_args: - CONF_FILE="prj-coex.conf" diff --git a/samples/bluetooth/peripheral_hr/sample.yaml b/samples/bluetooth/peripheral_hr/sample.yaml index 22bc7667461e..8b0722d169fd 100644 --- a/samples/bluetooth/peripheral_hr/sample.yaml +++ b/samples/bluetooth/peripheral_hr/sample.yaml @@ -15,7 +15,6 @@ tests: - nrf5340dk/nrf5340/cpuapp - nrf54l15dk/nrf54l15/cpuapp - ophelia4ev/nrf54l15/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp integration_platforms: - qemu_cortex_m3 - nrf52_bsim @@ -26,7 +25,6 @@ tests: - nrf5340dk/nrf5340/cpuapp - nrf54l15dk/nrf54l15/cpuapp - ophelia4ev/nrf54l15/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp tags: bluetooth sample.bluetooth.peripheral_hr.minimal: harness: bluetooth From 73daa1c0cbe15a701a14a57acc7775daa9e9f46a Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:38 +0300 Subject: [PATCH 1030/2141] Revert "[nrf noup] samples: bluetooth: Add support for nRF54lm20a to hci_uart" This reverts commit 1512388b59efaa75c4f87e7139b878d0a58d8101. Signed-off-by: Jukka Rissanen --- .../boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 12 ------------ samples/bluetooth/hci_uart/sample.yaml | 4 ---- 2 files changed, 16 deletions(-) delete mode 100644 samples/bluetooth/hci_uart/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay diff --git a/samples/bluetooth/hci_uart/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/samples/bluetooth/hci_uart/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay deleted file mode 100644 index 0388a57baecf..000000000000 --- a/samples/bluetooth/hci_uart/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&uart20 { - compatible = "nordic,nrf-uarte"; - current-speed = <1000000>; - status = "okay"; - hw-flow-control; -}; diff --git a/samples/bluetooth/hci_uart/sample.yaml b/samples/bluetooth/hci_uart/sample.yaml index 4dc5c6e90368..97ad6c561b2e 100644 --- a/samples/bluetooth/hci_uart/sample.yaml +++ b/samples/bluetooth/hci_uart/sample.yaml @@ -8,14 +8,10 @@ tests: - nrf52dk/nrf52832 - nrf52840dk/nrf52840 - nrf21540dk/nrf52840 - - nrf54l15dk/nrf54l15/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp integration_platforms: - nrf52dk/nrf52832 - nrf52840dk/nrf52840 - nrf21540dk/nrf52840 - - nrf54l15dk/nrf54l15/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp tags: - uart - bluetooth From 6676e6f1775750fbeec754007922411197781af0 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:38 +0300 Subject: [PATCH 1031/2141] Revert "[nrf noup] boards: arm: nrf9131ek: enable tfm" This reverts commit 797a60e8542a450d615b7fd1007f3c407fae87b8. Signed-off-by: Jukka Rissanen --- boards/nordic/nrf9131ek/Kconfig.defconfig | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/boards/nordic/nrf9131ek/Kconfig.defconfig b/boards/nordic/nrf9131ek/Kconfig.defconfig index 1a30d006b4c6..e1d8de241c0a 100644 --- a/boards/nordic/nrf9131ek/Kconfig.defconfig +++ b/boards/nordic/nrf9131ek/Kconfig.defconfig @@ -8,22 +8,3 @@ config HW_STACK_PROTECTION config BOARD_NRF9131EK select USE_DT_CODE_PARTITION if BOARD_NRF9131EK_NRF9131_NS - -if BOARD_NRF9131EK_NRF9131 || BOARD_NRF9131EK_NRF9131_NS - -# By default, if we build for a Non-Secure version of the board, -# enable building with TF-M as the Secure Execution Environment. -config BUILD_WITH_TFM - default y if BOARD_NRF9131EK_NRF9131_NS - -if BUILD_WITH_TFM - -# By default, if we build with TF-M, instruct build system to -# flash the combined TF-M (Secure) & Zephyr (Non Secure) image -config TFM_FLASH_MERGED_BINARY - bool - default y - -endif # BUILD_WITH_TFM - -endif # BOARD_NRF9131EK_NRF9131 || BOARD_NRF9131EK_NRF9131_NS From d50db0831a7ec44673c816c0efb8c2c7406f772d Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:38 +0300 Subject: [PATCH 1032/2141] Revert "[nrf noup] boards: nordic: nrf7002dk: Bring back NS variants" This reverts commit c1643faea535faad9caf5852960c2d9cb09db101. Signed-off-by: Jukka Rissanen --- boards/nordic/nrf7002dk/CMakeLists.txt | 11 --- boards/nordic/nrf7002dk/Kconfig | 4 +- boards/nordic/nrf7002dk/Kconfig.defconfig | 72 ------------------- boards/nordic/nrf7002dk/Kconfig.nrf7002dk | 4 +- boards/nordic/nrf7002dk/board.cmake | 18 +---- boards/nordic/nrf7002dk/board.yml | 4 -- .../nrf7002dk_nrf5340_cpuapp_nrf7001_ns.dts | 39 ---------- .../nrf7002dk_nrf5340_cpuapp_nrf7001_ns.yaml | 19 ----- ...7002dk_nrf5340_cpuapp_nrf7001_ns_defconfig | 24 ------- .../nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.dts | 40 ----------- .../nrf7002dk_nrf5340_cpuapp_ns.yaml | 19 ----- .../nrf7002dk_nrf5340_cpuapp_ns_defconfig | 23 ------ 12 files changed, 4 insertions(+), 273 deletions(-) delete mode 100644 boards/nordic/nrf7002dk/CMakeLists.txt delete mode 100644 boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns.dts delete mode 100644 boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns.yaml delete mode 100644 boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns_defconfig delete mode 100644 boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.dts delete mode 100644 boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.yaml delete mode 100644 boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns_defconfig diff --git a/boards/nordic/nrf7002dk/CMakeLists.txt b/boards/nordic/nrf7002dk/CMakeLists.txt deleted file mode 100644 index db20255712bc..000000000000 --- a/boards/nordic/nrf7002dk/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -if((CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP OR - CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NS OR - CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 OR - CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS) AND - CONFIG_BOARD_ENABLE_CPUNET) - zephyr_library() - zephyr_library_sources(nrf5340_cpunet_reset.c) -endif() diff --git a/boards/nordic/nrf7002dk/Kconfig b/boards/nordic/nrf7002dk/Kconfig index d4b7030a65ab..fa6c8097ae32 100644 --- a/boards/nordic/nrf7002dk/Kconfig +++ b/boards/nordic/nrf7002dk/Kconfig @@ -10,9 +10,7 @@ config MBOX_NRFX_IPC default MBOX if BOARD_NRF7002DK_NRF5340_CPUAPP || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 config BT_HCI_IPC default y if BT diff --git a/boards/nordic/nrf7002dk/Kconfig.defconfig b/boards/nordic/nrf7002dk/Kconfig.defconfig index 0d89a0089968..48510d6e24f8 100644 --- a/boards/nordic/nrf7002dk/Kconfig.defconfig +++ b/boards/nordic/nrf7002dk/Kconfig.defconfig @@ -9,75 +9,3 @@ config HW_STACK_PROTECTION default ARCH_HAS_STACK_PROTECTION endif # BOARD_NRF7002DK - -if BOARD_NRF7002DK_NRF5340_CPUAPP || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS - -# By default, if we build for a Non-Secure version of the board, -# force building with TF-M as the Secure Execution Environment. -config BUILD_WITH_TFM - default y if BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS - -if BUILD_WITH_TFM - -# By default, if we build with TF-M, instruct build system to -# flash the combined TF-M (Secure) & Zephyr (Non Secure) image -config TFM_FLASH_MERGED_BINARY - bool - default y - -endif # BUILD_WITH_TFM - -# Code Partition: -# -# 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- -# secure image (TRUSTED_EXECUTION_SECURE=y), the secure FW image shall always -# be restricted to the size of its code partition. -# -# For the non-secure version of the board, the firmware -# must be linked into the code-partition (non-secure) defined in DT, regardless. -# Apply this configuration below by setting the Kconfig symbols used by -# the linker according to the information extracted from DT partitions. - -# SRAM Partition: -# -# If the secure firmware is to be combined with a non-secure image -# (TRUSTED_EXECUTION_SECURE=y), the secure FW image SRAM shall always -# be restricted to the secure image SRAM partition (sram-secure-partition). -# Otherwise (if TRUSTED_EXECUTION_SECURE is not set) the whole zephyr,sram -# may be used by the image. -# -# For the non-secure version of the board, the firmware image SRAM is -# always restricted to the allocated non-secure SRAM partition. -# -# Workaround for not being able to have commas in macro arguments -DT_CHOSEN_Z_CODE_PARTITION := zephyr,code-partition -DT_CHOSEN_Z_SRAM_PARTITION := zephyr,sram-secure-partition - -if (BOARD_NRF7002DK_NRF5340_CPUAPP || BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001) && \ - TRUSTED_EXECUTION_SECURE - -config FLASH_LOAD_SIZE - default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) - -config SRAM_SIZE - default $(dt_chosen_reg_size_int,$(DT_CHOSEN_Z_SRAM_PARTITION),0,K) - -endif - -if BOARD_NRF7002DK_NRF5340_CPUAPP_NS || BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS - -config FLASH_LOAD_OFFSET - default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) - -config FLASH_LOAD_SIZE - default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) - -endif - -endif diff --git a/boards/nordic/nrf7002dk/Kconfig.nrf7002dk b/boards/nordic/nrf7002dk/Kconfig.nrf7002dk index 91f52ee6f08c..61b9e818f367 100644 --- a/boards/nordic/nrf7002dk/Kconfig.nrf7002dk +++ b/boards/nordic/nrf7002dk/Kconfig.nrf7002dk @@ -4,6 +4,4 @@ config BOARD_NRF7002DK select SOC_NRF5340_CPUNET_QKAA if BOARD_NRF7002DK_NRF5340_CPUNET select SOC_NRF5340_CPUAPP_QKAA if BOARD_NRF7002DK_NRF5340_CPUAPP || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 diff --git a/boards/nordic/nrf7002dk/board.cmake b/boards/nordic/nrf7002dk/board.cmake index 11a27910eebc..f85bbc86f485 100644 --- a/boards/nordic/nrf7002dk/board.cmake +++ b/boards/nordic/nrf7002dk/board.cmake @@ -1,24 +1,10 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -if(CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NS OR - CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS) - set(TFM_PUBLIC_KEY_FORMAT "full") -endif() - -if(CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP OR - CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NS OR - CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 OR - CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS) +if(CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP OR CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001) board_runner_args(nrfutil "--ext-mem-config-file=${BOARD_DIR}/support/nrf7002dk_spi_nrfutil_config.json") board_runner_args(jlink "--device=nrf5340_xxaa_app" "--speed=4000") -endif() - -if(CONFIG_TFM_FLASH_MERGED_BINARY) - set_property(TARGET runners_yaml_props_target PROPERTY hex_file "${CMAKE_BINARY_DIR}/zephyr/tfm_merged.hex") -endif() - -if(CONFIG_BOARD_NRF7002DK_NRF5340_CPUNET) +elseif(CONFIG_BOARD_NRF7002DK_NRF5340_CPUNET) board_runner_args(jlink "--device=nrf5340_xxaa_net" "--speed=4000") endif() diff --git a/boards/nordic/nrf7002dk/board.yml b/boards/nordic/nrf7002dk/board.yml index 39db5dcfa3a7..4f41341e4423 100644 --- a/boards/nordic/nrf7002dk/board.yml +++ b/boards/nordic/nrf7002dk/board.yml @@ -5,9 +5,5 @@ board: socs: - name: nrf5340 variants: - - name: ns - cpucluster: cpuapp - name: nrf7001 cpucluster: cpuapp - variants: - - name: ns diff --git a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns.dts b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns.dts deleted file mode 100644 index 5ff28accf3fc..000000000000 --- a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns.dts +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/dts-v1/; -#include -#include "nrf5340_cpuapp_common.dtsi" - -/ { - model = "Nordic NRF5340 DK NRF5340 Application"; - compatible = "nordic,nrf5340-dk-nrf5340-cpuapp"; - - chosen { - zephyr,sram = &sram0_ns; - zephyr,flash = &flash0; - zephyr,code-partition = &slot0_ns_partition; - zephyr,entropy = &psa_rng; - zephyr,wifi = &wlan0; - }; - - psa_rng: psa-rng { - compatible = "zephyr,psa-crypto-rng"; - status = "okay"; - }; -}; - -&qspi { - nrf70: nrf7001@1 { - compatible = "nordic,nrf7001-qspi"; - status = "okay"; - reg = <1>; - qspi-frequency = <24000000>; - qspi-quad-mode; - - #include "nrf70_common.dtsi" - }; -}; diff --git a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns.yaml b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns.yaml deleted file mode 100644 index 165759691260..000000000000 --- a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns.yaml +++ /dev/null @@ -1,19 +0,0 @@ -identifier: nrf7002dk/nrf5340/cpuapp/nrf7001/ns -name: NRF7002-DK-NRF7001-NRF5340-application-MCU-Non-Secure -type: mcu -arch: arm -toolchain: - - gnuarmemb - - xtools - - zephyr -ram: 192 -flash: 192 -supported: - - gpio - - i2c - - pwm - - watchdog - - usbd - - usb_device - - netif:openthread -vendor: nordic diff --git a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns_defconfig b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns_defconfig deleted file mode 100644 index 2c435653140a..000000000000 --- a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns_defconfig +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -# Enable MPU -CONFIG_ARM_MPU=y - -# Enable hardware stack protection -CONFIG_HW_STACK_PROTECTION=y - -# Enable TrustZone-M -CONFIG_ARM_TRUSTZONE_M=y - -# This Board implies building Non-Secure firmware -CONFIG_TRUSTED_EXECUTION_NONSECURE=y - -# enable GPIO -CONFIG_GPIO=y - -# Enable uart driver -CONFIG_SERIAL=y - -# enable console -CONFIG_CONSOLE=y -CONFIG_UART_CONSOLE=y diff --git a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.dts b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.dts deleted file mode 100644 index 0deb8ccc1bf5..000000000000 --- a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.dts +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/dts-v1/; -#include -#include "nrf5340_cpuapp_common.dtsi" - -/ { - model = "Nordic NRF5340 DK NRF5340 Application"; - compatible = "nordic,nrf5340-dk-nrf5340-cpuapp"; - - chosen { - zephyr,sram = &sram0_ns_app; - zephyr,flash = &flash0; - zephyr,code-partition = &slot0_ns_partition; - zephyr,entropy = &psa_rng; - zephyr,wifi = &wlan0; - }; - - psa_rng: psa-rng { - compatible = "zephyr,psa-crypto-rng"; - status = "okay"; - }; -}; - -&qspi { - nrf70: nrf7002@1 { - compatible = "nordic,nrf7002-qspi"; - status = "okay"; - reg = <1>; - qspi-frequency = <24000000>; - qspi-quad-mode; - - #include "nrf70_common.dtsi" - #include "nrf70_common_5g.dtsi" - }; -}; diff --git a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.yaml b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.yaml deleted file mode 100644 index ea43785b4559..000000000000 --- a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.yaml +++ /dev/null @@ -1,19 +0,0 @@ -identifier: nrf7002dk/nrf5340/cpuapp/ns -name: NRF7002-DK-NRF5340-application-MCU-Non-Secure -type: mcu -arch: arm -toolchain: - - gnuarmemb - - xtools - - zephyr -ram: 192 -flash: 192 -supported: - - gpio - - i2c - - pwm - - watchdog - - usbd - - usb_device - - netif:openthread -vendor: nordic diff --git a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns_defconfig b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns_defconfig deleted file mode 100644 index 1886b926bfd5..000000000000 --- a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns_defconfig +++ /dev/null @@ -1,23 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -# Enable MPU -CONFIG_ARM_MPU=y - -# Enable hardware stack protection -CONFIG_HW_STACK_PROTECTION=y - -# Enable TrustZone-M -CONFIG_ARM_TRUSTZONE_M=y - -# This Board implies building Non-Secure firmware -CONFIG_TRUSTED_EXECUTION_NONSECURE=y - -# enable GPIO -CONFIG_GPIO=y - -# Enable uart driver -CONFIG_SERIAL=y - -# enable console -CONFIG_CONSOLE=y -CONFIG_UART_CONSOLE=y From ef6e8d1891a6992ddad4d1e712c8a897bc292755 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:38 +0300 Subject: [PATCH 1033/2141] Revert "[nrf noup] modules: hal_nordic: require nrf-regtool" This reverts commit e606b2aaf5ebd69b03c5fd92c99d9ef1d9c7e96a. Signed-off-by: Jukka Rissanen --- modules/hal_nordic/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/hal_nordic/CMakeLists.txt b/modules/hal_nordic/CMakeLists.txt index e5b1ab60dfca..b6f352864123 100644 --- a/modules/hal_nordic/CMakeLists.txt +++ b/modules/hal_nordic/CMakeLists.txt @@ -13,7 +13,6 @@ if(CONFIG_NRF_REGTOOL_GENERATE_UICR) endif() if(DEFINED nrf_regtool_components) find_package(nrf-regtool 9.2.0 - REQUIRED COMPONENTS ${nrf_regtool_components} PATHS ${CMAKE_CURRENT_LIST_DIR}/nrf-regtool NO_CMAKE_PATH From 10296752a2a867e1e220e2e4f6ad14481d9f62a8 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:38 +0300 Subject: [PATCH 1034/2141] Revert "[nrf noup] samples: lwm2m_client: Add support for nRF91x" This reverts commit 1b4e2efade1fa707bf264d4da17fa6b78e9d67fa. Signed-off-by: Jukka Rissanen --- samples/net/lwm2m_client/overlay-nrf91x.conf | 53 -------------------- 1 file changed, 53 deletions(-) delete mode 100644 samples/net/lwm2m_client/overlay-nrf91x.conf diff --git a/samples/net/lwm2m_client/overlay-nrf91x.conf b/samples/net/lwm2m_client/overlay-nrf91x.conf deleted file mode 100644 index 7b902178e078..000000000000 --- a/samples/net/lwm2m_client/overlay-nrf91x.conf +++ /dev/null @@ -1,53 +0,0 @@ -# Configuration file for nRF91x -# This file is merged with prj.conf in the application folder, and options -# set here will take precedence if they are present in both files. - -# General -CONFIG_MAIN_STACK_SIZE=4096 - -CONFIG_NET_SOCKETS=y -CONFIG_NET_NATIVE=y -CONFIG_NET_SOCKETS_OFFLOAD=y - -CONFIG_NET_CONFIG_MY_IPV6_ADDR="" -CONFIG_NET_CONFIG_PEER_IPV6_ADDR="" -CONFIG_NET_CONFIG_MY_IPV4_ADDR="" -CONFIG_NET_CONFIG_MY_IPV4_GW="" - -CONFIG_NET_CONFIG_NEED_IPV6=n -CONFIG_NET_CONFIG_NEED_IPV4=n -CONFIG_NET_CONFIG_AUTO_INIT=n - -# Modem related configurations -CONFIG_NRF_MODEM_LIB_NET_IF=y -CONFIG_NRF_MODEM_LIB_NET_IF_AUTO_DOWN=n -CONFIG_NRF_MODEM_LIB_NET_IF_AUTO_CONNECT=n -CONFIG_NRF_MODEM_LIB_NET_IF_AUTO_START=n -CONFIG_NRF_MODEM_LIB_ON_FAULT_APPLICATION_SPECIFIC=y - -CONFIG_LTE_LINK_CONTROL_LOG_LEVEL_DBG=n -CONFIG_NRF_MODEM_LIB_NET_IF_LOG_LEVEL_DBG=n - -# Disable Duplicate Address Detection (DAD) -# due to not being properly implemented for offloaded interfaces. -CONFIG_NET_IPV6_NBR_CACHE=n -CONFIG_NET_IPV6_MLD=n - -# Zephyr NET Connection Manager and Connectivity layer. -CONFIG_NET_CONNECTION_MANAGER=y -CONFIG_NET_CONNECTION_MANAGER_MONITOR_STACK_SIZE=1024 - -CONFIG_NET_SAMPLE_LWM2M_ID="nrf91x" -CONFIG_NET_SAMPLE_LWM2M_SERVER="coaps://leshan.eclipseprojects.io:5684" -CONFIG_LWM2M_DNS_SUPPORT=y - -## Enable DTLS support -CONFIG_LWM2M_DTLS_SUPPORT=y -CONFIG_LWM2M_TLS_SESSION_CACHING=y -CONFIG_LWM2M_DTLS_CID=y -CONFIG_TLS_CREDENTIALS=y - -## Crypto -CONFIG_OBERON_BACKEND=y -CONFIG_NORDIC_SECURITY_BACKEND=y -CONFIG_MBEDTLS_SHA256_C=y From 42213352dc1c1e0304b4a243530800db94e8a976 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:38 +0300 Subject: [PATCH 1035/2141] Revert "[nrf noup] bluetooth: conn: Skip buffer ref count check in send_buf" This reverts commit cc098c6faa2fbcac2be22af3586102d17e81e5ea. Signed-off-by: Jukka Rissanen --- subsys/bluetooth/host/conn.c | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/subsys/bluetooth/host/conn.c b/subsys/bluetooth/host/conn.c index a74a04295278..489792d3098b 100644 --- a/subsys/bluetooth/host/conn.c +++ b/subsys/bluetooth/host/conn.c @@ -702,27 +702,19 @@ static int send_buf(struct bt_conn *conn, struct net_buf *buf, uint16_t frag_len = MIN(conn_mtu(conn), len); - /* If ATT sent callback is delayed until data transmission - * is done by BLE controller, the transmitted buffer may - * have an additional reference. The reference is used to - * extend lifetime of the net buffer until the data - * transmission is confirmed by ACK of the remote. + /* Check that buf->ref is 1 or 2. It would be 1 if this was + * the only reference (e.g. buf was removed from the conn + * tx_queue). It would be 2 if the tx_data_pull kept it on + * the tx_queue for segmentation. * - * send_buf function can be called multiple times, if buffer - * has to be fragmented over HCI. In that case, the callback - * is provided as an argument only for the last transmitted - * fragment. The `buf->ref == 1` (or 2) check is skipped - * because it's impossible to properly validate number of - * references for the sent fragments if buffers may have the - * additional reference. - * - * Otherwise, check that buf->ref is 1 or 2. It would be 1 - * if this was the only reference (e.g. buf was removed from - * the conn tx_queue). It would be 2 if the tx_data_pull - * kept it on the tx_queue for segmentation. + * Allow for an additional buffer reference if callback is + * provided. This can be used to extend lifetime of the net + * buffer until the data transmission is confirmed by ACK of + * the remote. */ - __ASSERT_NO_MSG(IS_ENABLED(CONFIG_BT_ATT_SENT_CB_AFTER_TX) || (buf->ref == 1) || - (buf->ref == 2)); + if (buf->ref > 2 + (cb ? 1 : 0)) { + __ASSERT_NO_MSG(false); + } /* The reference is always transferred to the frag, so when * the frag is destroyed, the parent reference is decremented. From 35c130c06aa6282cd569b1e92640f06b4c94729c Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:38 +0300 Subject: [PATCH 1036/2141] Revert "[nrf noup] bluetooth: conn: Allow for an extra ref in bt_l2cap_send_pdu" This reverts commit 90daf74e59ef2ef4d6d385d39632fa9cd736c80a. Signed-off-by: Jukka Rissanen --- subsys/bluetooth/host/conn.c | 17 +++++------------ subsys/bluetooth/host/l2cap.c | 8 ++------ 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/subsys/bluetooth/host/conn.c b/subsys/bluetooth/host/conn.c index 489792d3098b..9e9f18c040a0 100644 --- a/subsys/bluetooth/host/conn.c +++ b/subsys/bluetooth/host/conn.c @@ -702,19 +702,12 @@ static int send_buf(struct bt_conn *conn, struct net_buf *buf, uint16_t frag_len = MIN(conn_mtu(conn), len); - /* Check that buf->ref is 1 or 2. It would be 1 if this was - * the only reference (e.g. buf was removed from the conn - * tx_queue). It would be 2 if the tx_data_pull kept it on - * the tx_queue for segmentation. - * - * Allow for an additional buffer reference if callback is - * provided. This can be used to extend lifetime of the net - * buffer until the data transmission is confirmed by ACK of - * the remote. + /* Check that buf->ref is 1 or 2. It would be 1 if this + * was the only reference (e.g. buf was removed + * from the conn tx_queue). It would be 2 if the + * tx_data_pull kept it on the tx_queue for segmentation. */ - if (buf->ref > 2 + (cb ? 1 : 0)) { - __ASSERT_NO_MSG(false); - } + __ASSERT_NO_MSG((buf->ref == 1) || (buf->ref == 2)); /* The reference is always transferred to the frag, so when * the frag is destroyed, the parent reference is decremented. diff --git a/subsys/bluetooth/host/l2cap.c b/subsys/bluetooth/host/l2cap.c index 9fa5638d9617..ac6fc60dbad6 100644 --- a/subsys/bluetooth/host/l2cap.c +++ b/subsys/bluetooth/host/l2cap.c @@ -729,17 +729,13 @@ int bt_l2cap_send_pdu(struct bt_l2cap_le_chan *le_chan, struct net_buf *pdu, return -ENOTCONN; } - /* Allow for an additional buffer reference if callback is provided. This can be used to - * extend lifetime of the net buffer until the data transmission is confirmed by ACK of the - * remote. - */ - if (pdu->ref > 1 + (cb ? 1 : 0)) { + if (pdu->ref != 1) { /* The host may alter the buf contents when fragmenting. Higher * layers cannot expect the buf contents to stay intact. Extra * refs suggests a silent data corruption would occur if not for * this error. */ - LOG_ERR("Expecting up to %d refs, got %d", cb ? 2 : 1, pdu->ref); + LOG_ERR("Expecting 1 ref, got %d", pdu->ref); return -EINVAL; } From a34e4baba8b509b9e78dc2dd2acbfb9f74ff08a9 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:38 +0300 Subject: [PATCH 1037/2141] Revert "[nrf noup] ci: update test_spec label for E2E DFU tests" This reverts commit 1b7ccc6e935529a3a464097925b31d69a3a9f9f2. Signed-off-by: Jukka Rissanen --- .github/test-spec.yml | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/.github/test-spec.yml b/.github/test-spec.yml index 76def875e0be..5337249f7dab 100644 --- a/.github/test-spec.yml +++ b/.github/test-spec.yml @@ -49,33 +49,6 @@ - "tests/subsys/dfu/**/*" - "tests/subsys/mgmt/mcumgr/**/*" -"CI-dfu-test": - - "boards/nordic/**/*" - - "drivers/bluetooth/**/*" - - "drivers/console/**/*" - - "drivers/flash/**/*" - - "drivers/mbox/**/*" - - "drivers/serial/**/*" - - "drivers/spi/**/*" - - "dts/arm/nordic/nrf54h*" - - "dts/common/nordic/*" - - "dts/riscv/nordic/nrf54h*" - - "include/dfu/**/*" - - "include/mgmt/mcumgr/**/*" - - "include/zephyr/**/*" - - "samples/subsys/mgmt/mcumgr/smp_svr/**/*" - - "scripts/west_commands/build.py" - - "scripts/west_commands/flash.py" - - "scripts/west_commands/runners/core.py" - - "scripts/west_commands/runners/nrf_common.py" - - "scripts/west_commands/runners/nrfutil.py" - - "soc/nordic/nrf54h/**/*" - - "subsys/bluetooth/**/*" - - "subsys/dfu/**/*" - - "subsys/logging/**/*" - - "subsys/mgmt/mcumgr/**/*" - - "subsys/tracing/**/*" - "CI-tfm-test": - "boards/nordic/nrf5340dk/**/*" - "boards/nordic/nrf9160dk/**/*" From e9af225d0d8b64e45033d3f00c65a2ed3b0444d3 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:38 +0300 Subject: [PATCH 1038/2141] Revert "[nrf noup] boards: nordic: nrf54lm20 adjust ROM_START_OFFSET" This reverts commit cd135b25e4e48e649c8fdfa97abee3989c5300f6. Signed-off-by: Jukka Rissanen --- boards/nordic/nrf54lm20dk/Kconfig.defconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/boards/nordic/nrf54lm20dk/Kconfig.defconfig b/boards/nordic/nrf54lm20dk/Kconfig.defconfig index 2efb752c97be..266f0f7c13d4 100644 --- a/boards/nordic/nrf54lm20dk/Kconfig.defconfig +++ b/boards/nordic/nrf54lm20dk/Kconfig.defconfig @@ -4,7 +4,6 @@ if BOARD_NRF54LM20DK_NRF54LM20A_CPUAPP config ROM_START_OFFSET - default 0 if PARTITION_MANAGER_ENABLED default 0x800 if BOOTLOADER_MCUBOOT endif # BOARD_NRF54LM20DK_NRF54LM20A_CPUAPP From 540cde56e08bf36f30efcd51ca23bd00ed250715 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:38 +0300 Subject: [PATCH 1039/2141] Revert "[nrf noup] modem: backend: uart: SLM optimized modem UART backend" This reverts commit 3290b8b98587cafc91c483cdd217a40f9c51bad0. Signed-off-by: Jukka Rissanen --- include/zephyr/modem/backend/uart_slm.h | 61 --- subsys/modem/backends/CMakeLists.txt | 1 - subsys/modem/backends/Kconfig | 23 - .../modem/backends/modem_backend_uart_slm.c | 514 ------------------ 4 files changed, 599 deletions(-) delete mode 100644 include/zephyr/modem/backend/uart_slm.h delete mode 100644 subsys/modem/backends/modem_backend_uart_slm.c diff --git a/include/zephyr/modem/backend/uart_slm.h b/include/zephyr/modem/backend/uart_slm.h deleted file mode 100644 index e522c6cf791e..000000000000 --- a/include/zephyr/modem/backend/uart_slm.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include -#include - -#ifndef ZEPHYR_MODEM_BACKEND_UART_SLM_ -#define ZEPHYR_MODEM_BACKEND_UART_SLM_ - -#ifdef __cplusplus -extern "C" { -#endif - -struct slm_rx_queue_event { - uint8_t *buf; - size_t len; -}; - -struct modem_backend_uart_slm { - const struct device *uart; - struct modem_pipe pipe; - struct k_work_delayable receive_ready_work; - struct k_work transmit_idle_work; - -#ifdef CONFIG_MODEM_STATS - struct modem_stats_buffer receive_buf_stats; - struct modem_stats_buffer transmit_buf_stats; -#endif - struct ring_buf transmit_rb; - struct k_work rx_disabled_work; - atomic_t state; - - struct k_mem_slab rx_slab; - struct k_msgq rx_queue; - struct slm_rx_queue_event rx_event; - struct slm_rx_queue_event rx_queue_buf[CONFIG_MODEM_BACKEND_UART_SLM_BUFFER_COUNT]; - uint32_t rx_buf_size; - uint8_t rx_buf_count; -}; - -struct modem_backend_uart_slm_config { - const struct device *uart; - uint8_t *receive_buf; /* Address must be word-aligned. */ - uint32_t receive_buf_size; - uint8_t *transmit_buf; - uint32_t transmit_buf_size; -}; - -struct modem_pipe *modem_backend_uart_slm_init(struct modem_backend_uart_slm *backend, - const struct modem_backend_uart_slm_config *config); - -#ifdef __cplusplus -} -#endif - -#endif /* ZEPHYR_MODEM_BACKEND_UART_SLM_ */ diff --git a/subsys/modem/backends/CMakeLists.txt b/subsys/modem/backends/CMakeLists.txt index 787697a84e18..e2247a8a09dd 100644 --- a/subsys/modem/backends/CMakeLists.txt +++ b/subsys/modem/backends/CMakeLists.txt @@ -10,4 +10,3 @@ if(CONFIG_MODEM_BACKEND_UART_ASYNC) zephyr_library_sources_ifdef(CONFIG_MODEM_BACKEND_UART_ASYNC_HWFC modem_backend_uart_async_hwfc.c) zephyr_library_sources_ifndef(CONFIG_MODEM_BACKEND_UART_ASYNC_HWFC modem_backend_uart_async.c) endif() -zephyr_library_sources_ifdef(CONFIG_MODEM_BACKEND_UART_SLM modem_backend_uart_slm.c) diff --git a/subsys/modem/backends/Kconfig b/subsys/modem/backends/Kconfig index 5f8d804ed35c..2ce81c6dce11 100644 --- a/subsys/modem/backends/Kconfig +++ b/subsys/modem/backends/Kconfig @@ -64,26 +64,3 @@ endif # MODEM_BACKEND_UART_ASYNC_HWFC endif # MODEM_BACKEND_UART_ASYNC endif # MODEM_BACKEND_UART - -config MODEM_BACKEND_UART_SLM - bool "SLM-optimized modem UART backend" - select MODEM_PIPE - select RING_BUFFER - depends on UART_ASYNC_API - -if MODEM_BACKEND_UART_SLM - -config MODEM_BACKEND_UART_SLM_BUFFER_COUNT - int "SLM modem UART backend buffer count" - range 2 4 - default 3 - -config MODEM_BACKEND_UART_SLM_TRANSMIT_TIMEOUT_MS - int "SLM modem UART transmit timeout in milliseconds" - default 1000 - -config MODEM_BACKEND_UART_SLM_RECEIVE_IDLE_TIMEOUT_MS - int "SLM modem UART receive idle timeout in milliseconds" - default 30 - -endif # MODEM_BACKEND_UART_SLM diff --git a/subsys/modem/backends/modem_backend_uart_slm.c b/subsys/modem/backends/modem_backend_uart_slm.c deleted file mode 100644 index f1aa1b0bb402..000000000000 --- a/subsys/modem/backends/modem_backend_uart_slm.c +++ /dev/null @@ -1,514 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include - -#include -LOG_MODULE_REGISTER(modem_backend_uart_slm, CONFIG_MODEM_MODULES_LOG_LEVEL); - -#include -#include -#include - -struct rx_buf_t { - atomic_t ref_counter; - uint8_t buf[]; -}; - -static inline struct rx_buf_t *block_start_get(struct modem_backend_uart_slm *backend, uint8_t *buf) -{ - size_t block_num; - - /* Find the correct block. */ - block_num = (((size_t)buf - sizeof(struct rx_buf_t) - (size_t)backend->rx_slab.buffer) / - backend->rx_buf_size); - - return (struct rx_buf_t *)&backend->rx_slab.buffer[block_num * backend->rx_buf_size]; -} - -static struct rx_buf_t *rx_buf_alloc(struct modem_backend_uart_slm *backend) -{ - struct rx_buf_t *buf; - - if (k_mem_slab_alloc(&backend->rx_slab, (void **)&buf, K_NO_WAIT)) { - return NULL; - } - atomic_set(&buf->ref_counter, 1); - - return buf; -} - -static void rx_buf_ref(struct modem_backend_uart_slm *backend, void *buf) -{ - atomic_inc(&(block_start_get(backend, buf)->ref_counter)); -} - -static void rx_buf_unref(struct modem_backend_uart_slm *backend, void *buf) -{ - struct rx_buf_t *uart_buf = block_start_get(backend, buf); - atomic_t ref_counter = atomic_dec(&uart_buf->ref_counter); - - if (ref_counter == 1) { - k_mem_slab_free(&backend->rx_slab, (void *)uart_buf); - } -} - -enum { - MODEM_BACKEND_UART_SLM_STATE_OPEN_BIT, - MODEM_BACKEND_UART_SLM_STATE_TRANSMIT_BIT, - MODEM_BACKEND_UART_SLM_STATE_RECOVERY_BIT, -}; - -static int modem_backend_uart_slm_rx_enable(struct modem_backend_uart_slm *backend) -{ - int ret; - struct rx_buf_t *buf = rx_buf_alloc(backend); - - if (!buf) { - return -ENOMEM; - } - - ret = uart_rx_enable(backend->uart, buf->buf, - backend->rx_buf_size - sizeof(struct rx_buf_t), - CONFIG_MODEM_BACKEND_UART_SLM_RECEIVE_IDLE_TIMEOUT_MS * 1000); - if (ret) { - rx_buf_unref(backend, buf->buf); - return ret; - } - - return 0; -} - -static void modem_backend_uart_slm_rx_recovery(struct modem_backend_uart_slm *backend) -{ - int err; - - if (!atomic_test_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_RECOVERY_BIT)) { - return; - } - - err = modem_backend_uart_slm_rx_enable(backend); - if (err) { - LOG_DBG("RX recovery failed: %d", err); - return; - } - - if (!atomic_test_and_clear_bit(&backend->state, - MODEM_BACKEND_UART_SLM_STATE_RECOVERY_BIT)) { - /* Closed during recovery. */ - uart_rx_disable(backend->uart); - } else { - LOG_DBG("RX recovery success"); - } -} - -static bool modem_backend_uart_slm_is_uart_stopped(const struct modem_backend_uart_slm *backend) -{ - if (!atomic_test_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_OPEN_BIT) && - !atomic_test_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_RECOVERY_BIT) && - !atomic_test_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_TRANSMIT_BIT)) { - return true; - } - - return false; -} - -static bool modem_backend_uart_slm_is_open(const struct modem_backend_uart_slm *backend) -{ - return atomic_test_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_OPEN_BIT); -} - -static void modem_backend_uart_slm_event_handler(const struct device *dev, struct uart_event *evt, - void *user_data) -{ - struct modem_backend_uart_slm *backend = (struct modem_backend_uart_slm *)user_data; - struct slm_rx_queue_event rx_event; - int err; - - switch (evt->type) { - case UART_TX_DONE: - ring_buf_get_finish(&backend->transmit_rb, evt->data.tx.len); - atomic_clear_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_TRANSMIT_BIT); - k_work_submit(&backend->transmit_idle_work); - break; - - case UART_TX_ABORTED: - ring_buf_get_finish(&backend->transmit_rb, evt->data.tx.len); - if (!modem_backend_uart_slm_is_open(backend)) { - /* When we are closing, send the remaining data after re-open. */ - atomic_clear_bit(&backend->state, - MODEM_BACKEND_UART_SLM_STATE_TRANSMIT_BIT); - break; - } - if (evt->data.tx.len != 0) { - /* If we were able to send some data, attempt to send the remaining - * data before releasing the transmit bit. - */ - uint8_t *buf; - size_t bytes_to_transmit = - ring_buf_get_claim(&backend->transmit_rb, &buf, - ring_buf_capacity_get(&backend->transmit_rb)); - - err = uart_tx(backend->uart, buf, bytes_to_transmit, - CONFIG_MODEM_BACKEND_UART_SLM_TRANSMIT_TIMEOUT_MS * 1000L); - if (err) { - LOG_ERR("Failed to %s %u bytes. (%d)", "start async transmit for", - bytes_to_transmit, err); - atomic_clear_bit(&backend->state, - MODEM_BACKEND_UART_SLM_STATE_TRANSMIT_BIT); - } - break; - } - - /* We were not able to send anything. Start dropping data. */ - LOG_ERR("Transmit aborted (%u bytes dropped)", - ring_buf_size_get(&backend->transmit_rb)); - atomic_clear_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_TRANSMIT_BIT); - k_work_submit(&backend->transmit_idle_work); - break; - - case UART_RX_BUF_REQUEST: - struct rx_buf_t *buf = rx_buf_alloc(backend); - - if (!buf) { - LOG_DBG("No receive buffer, disabling RX"); - break; - } - err = uart_rx_buf_rsp(backend->uart, buf->buf, - backend->rx_buf_size - sizeof(struct rx_buf_t)); - if (err) { - LOG_ERR("uart_rx_buf_rsp: %d", err); - rx_buf_unref(backend, buf->buf); - } - break; - - case UART_RX_BUF_RELEASED: - if (evt->data.rx_buf.buf) { - rx_buf_unref(backend, evt->data.rx_buf.buf); - } - break; - - case UART_RX_RDY: - if (evt->data.rx.buf) { - rx_buf_ref(backend, evt->data.rx.buf); - rx_event.buf = &evt->data.rx.buf[evt->data.rx.offset]; - rx_event.len = evt->data.rx.len; - err = k_msgq_put(&backend->rx_queue, &rx_event, K_NO_WAIT); - if (err) { - LOG_WRN("RX queue overflow: %d (dropped %u)", err, - evt->data.rx.len); - rx_buf_unref(backend, evt->data.rx.buf); - break; - } - k_work_schedule(&backend->receive_ready_work, K_NO_WAIT); - } - break; - - case UART_RX_DISABLED: - if (atomic_test_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_OPEN_BIT)) { - if (!atomic_test_and_set_bit(&backend->state, - MODEM_BACKEND_UART_SLM_STATE_RECOVERY_BIT)) { - k_work_schedule(&backend->receive_ready_work, K_NO_WAIT); - LOG_DBG("RX recovery started"); - } - } - break; - - case UART_RX_STOPPED: - LOG_WRN("Receive stopped for reasons: %u", (uint8_t)evt->data.rx_stop.reason); - break; - - default: - break; - } - - if (modem_backend_uart_slm_is_uart_stopped(backend)) { - k_work_submit(&backend->rx_disabled_work); - } -} - -static int modem_backend_uart_slm_open(void *data) -{ - struct modem_backend_uart_slm *backend = (struct modem_backend_uart_slm *)data; - struct rx_buf_t *rx_buf = rx_buf_alloc(backend); - int ret; - - if (!rx_buf) { - return -ENOMEM; - } - - atomic_clear(&backend->state); - atomic_set_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_TRANSMIT_BIT); - atomic_set_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_OPEN_BIT); - - if (!ring_buf_is_empty(&backend->transmit_rb)) { - /* Transmit was aborted due to modem_backend_uart_slm_close. - * Send the remaining data before allowing further transmits. - */ - uint8_t *tx_buf; - const uint32_t tx_buf_size = ring_buf_get_claim( - &backend->transmit_rb, &tx_buf, ring_buf_size_get(&backend->transmit_rb)); - - ret = uart_tx(backend->uart, tx_buf, tx_buf_size, - CONFIG_MODEM_BACKEND_UART_SLM_TRANSMIT_TIMEOUT_MS * 1000L); - if (ret) { - LOG_ERR("Failed to %s %u bytes. (%d)", "start async transmit for", - tx_buf_size, ret); - atomic_clear_bit(&backend->state, - MODEM_BACKEND_UART_SLM_STATE_TRANSMIT_BIT); - } - } else { - /* Previous transmit was not aborted. */ - atomic_clear_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_TRANSMIT_BIT); - } - - ret = uart_rx_enable(backend->uart, rx_buf->buf, - backend->rx_buf_size - sizeof(struct rx_buf_t), - CONFIG_MODEM_BACKEND_UART_SLM_RECEIVE_IDLE_TIMEOUT_MS * 1000L); - if (ret < 0) { - rx_buf_unref(backend, rx_buf->buf); - atomic_clear_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_OPEN_BIT); - return ret; - } - - modem_pipe_notify_opened(&backend->pipe); - return 0; -} - -#ifdef CONFIG_MODEM_STATS -static uint32_t get_transmit_buf_size(const struct modem_backend_uart_slm *backend) -{ - return ring_buf_capacity_get(&backend->transmit_rb); -} - -static uint32_t get_receive_buf_size(struct modem_backend_uart_slm *backend) -{ - return (backend->rx_buf_size - sizeof(struct rx_buf_t)) * backend->rx_buf_count; -} - -static void advertise_transmit_buf_stats(struct modem_backend_uart_slm *backend, uint32_t length) -{ - modem_stats_buffer_advertise_length(&backend->transmit_buf_stats, length); -} - -static void advertise_receive_buf_stats(struct modem_backend_uart_slm *backend, uint32_t reserved) -{ - modem_stats_buffer_advertise_length(&backend->receive_buf_stats, reserved); -} -#endif - -static int modem_backend_uart_slm_transmit(void *data, const uint8_t *buf, size_t size) -{ - struct modem_backend_uart_slm *backend = (struct modem_backend_uart_slm *)data; - bool transmitting; - uint32_t bytes_to_transmit; - int ret; - uint8_t *tx_buf; - - if (!modem_backend_uart_slm_is_open(backend)) { - return -EPERM; - } - - transmitting = - atomic_test_and_set_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_TRANSMIT_BIT); - if (transmitting) { - return 0; - } - - /* Copy buf to transmit ring buffer which is passed to UART. */ - ring_buf_reset(&backend->transmit_rb); - ring_buf_put(&backend->transmit_rb, buf, size); - bytes_to_transmit = ring_buf_get_claim(&backend->transmit_rb, &tx_buf, size); - - ret = uart_tx(backend->uart, tx_buf, bytes_to_transmit, - CONFIG_MODEM_BACKEND_UART_SLM_TRANSMIT_TIMEOUT_MS * 1000L); - -#ifdef CONFIG_MODEM_STATS - advertise_transmit_buf_stats(backend, bytes_to_transmit); -#endif - - if (ret != 0) { - LOG_ERR("Failed to %s %u bytes. (%d)", "start async transmit for", - bytes_to_transmit, ret); - atomic_clear_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_TRANSMIT_BIT); - - return ret; - } - - return (int)bytes_to_transmit; -} - -static int modem_backend_uart_slm_receive(void *data, uint8_t *buf, size_t size) -{ - struct modem_backend_uart_slm *backend = (struct modem_backend_uart_slm *)data; - size_t received = 0; - size_t copy_size = 0; - -#ifdef CONFIG_MODEM_STATS - struct slm_rx_queue_event rx_event; - size_t reserved = backend->rx_event.len; - - for (int i = 0; i < k_msgq_num_used_get(&backend->rx_queue); i++) { - if (k_msgq_peek_at(&backend->rx_queue, &rx_event, i)) { - break; - } - reserved += rx_event.len; - } - advertise_receive_buf_stats(backend, reserved); -#endif - while (size > received) { - /* Keeping track of the rx_event allows us to receive less than what the event - * indicates. - */ - if (backend->rx_event.len == 0) { - if (k_msgq_get(&backend->rx_queue, &backend->rx_event, K_NO_WAIT)) { - break; - } - } - copy_size = MIN(size - received, backend->rx_event.len); - memcpy(buf, backend->rx_event.buf, copy_size); - buf += copy_size; - received += copy_size; - backend->rx_event.buf += copy_size; - backend->rx_event.len -= copy_size; - - if (backend->rx_event.len == 0) { - rx_buf_unref(backend, backend->rx_event.buf); - } - } - - if (backend->rx_event.len != 0 || k_msgq_num_used_get(&backend->rx_queue) != 0) { - k_work_schedule(&backend->receive_ready_work, K_NO_WAIT); - } - - modem_backend_uart_slm_rx_recovery(backend); - - return (int)received; -} - -static int modem_backend_uart_slm_close(void *data) -{ - struct modem_backend_uart_slm *backend = (struct modem_backend_uart_slm *)data; - - atomic_clear_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_OPEN_BIT); - uart_tx_abort(backend->uart); - - if (!atomic_test_and_clear_bit(&backend->state, - MODEM_BACKEND_UART_SLM_STATE_RECOVERY_BIT)) { - /* Disable the RX, if recovery is not ongoing. */ - uart_rx_disable(backend->uart); - } - - return 0; -} - -static void modem_backend_uart_slm_receive_ready_handler(struct k_work *item) -{ - struct modem_backend_uart_slm *backend = - CONTAINER_OF(k_work_delayable_from_work(item), struct modem_backend_uart_slm, - receive_ready_work); - - modem_pipe_notify_receive_ready(&backend->pipe); -} - -static void modem_backend_uart_slm_transmit_idle_handler(struct k_work *item) -{ - struct modem_backend_uart_slm *backend = - CONTAINER_OF(item, struct modem_backend_uart_slm, transmit_idle_work); - - modem_pipe_notify_transmit_idle(&backend->pipe); -} - -static void modem_backend_uart_slm_notify_closed(struct k_work *item) -{ - - struct modem_backend_uart_slm *backend = - CONTAINER_OF(item, struct modem_backend_uart_slm, rx_disabled_work); - - modem_pipe_notify_closed(&backend->pipe); -} - -#ifdef CONFIG_MODEM_STATS -static void init_stats(struct modem_backend_uart_slm *backend) -{ - char name[CONFIG_MODEM_STATS_BUFFER_NAME_SIZE]; - uint32_t receive_buf_size; - uint32_t transmit_buf_size; - - receive_buf_size = get_receive_buf_size(backend); - transmit_buf_size = get_transmit_buf_size(backend); - - snprintk(name, sizeof(name), "%s_%s", backend->uart->name, "rx"); - modem_stats_buffer_init(&backend->receive_buf_stats, name, receive_buf_size); - snprintk(name, sizeof(name), "%s_%s", backend->uart->name, "tx"); - modem_stats_buffer_init(&backend->transmit_buf_stats, name, transmit_buf_size); -} -#endif - -static const struct modem_pipe_api modem_backend_uart_slm_api = { - .open = modem_backend_uart_slm_open, - .transmit = modem_backend_uart_slm_transmit, - .receive = modem_backend_uart_slm_receive, - .close = modem_backend_uart_slm_close, -}; - -struct modem_pipe *modem_backend_uart_slm_init(struct modem_backend_uart_slm *backend, - const struct modem_backend_uart_slm_config *config) -{ - int err; - - __ASSERT_NO_MSG(config->uart != NULL); - __ASSERT_NO_MSG(config->receive_buf != NULL); - __ASSERT_NO_MSG(config->receive_buf_size > 1); - __ASSERT_NO_MSG((config->receive_buf_size % 2) == 0); - __ASSERT_NO_MSG(config->transmit_buf != NULL); - __ASSERT_NO_MSG(config->transmit_buf_size > 0); - - memset(backend, 0x00, sizeof(*backend)); - backend->uart = config->uart; - k_work_init_delayable(&backend->receive_ready_work, - modem_backend_uart_slm_receive_ready_handler); - k_work_init(&backend->transmit_idle_work, modem_backend_uart_slm_transmit_idle_handler); - k_work_init(&backend->rx_disabled_work, modem_backend_uart_slm_notify_closed); - - err = uart_callback_set(backend->uart, modem_backend_uart_slm_event_handler, backend); - if (err) { - LOG_ERR("uart_callback_set failed. (%d)", err); - return NULL; - } - - int32_t buf_size = (int32_t)config->receive_buf_size; - - backend->rx_buf_count = CONFIG_MODEM_BACKEND_UART_SLM_BUFFER_COUNT; - - /* k_mem_slab_init requires a word-aligned buffer. */ - __ASSERT((uintptr_t)config->receive_buf % sizeof(void *) == 0, - "Receive buffer is not word-aligned"); - - /* Make sure all the buffers will be aligned. */ - buf_size -= (config->receive_buf_size % (sizeof(uint32_t) * backend->rx_buf_count)); - backend->rx_buf_size = buf_size / backend->rx_buf_count; - __ASSERT_NO_MSG(backend->rx_buf_size > sizeof(struct rx_buf_t)); - - /* Initialize the RX buffers and event queue. */ - err = k_mem_slab_init(&backend->rx_slab, config->receive_buf, backend->rx_buf_size, - backend->rx_buf_count); - if (err) { - LOG_ERR("k_mem_slab_init failed. (%d)", err); - return NULL; - } - k_msgq_init(&backend->rx_queue, (char *)backend->rx_queue_buf, - sizeof(struct slm_rx_queue_event), CONFIG_MODEM_BACKEND_UART_SLM_BUFFER_COUNT); - - ring_buf_init(&backend->transmit_rb, config->transmit_buf_size, config->transmit_buf); - - modem_pipe_init(&backend->pipe, backend, &modem_backend_uart_slm_api); - -#ifdef CONFIG_MODEM_STATS - init_stats(backend); -#endif - return &backend->pipe; -} From 7e773a4db7a3e062013f5d24c225f7cdbd897ef1 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:38 +0300 Subject: [PATCH 1040/2141] Revert "[nrf noup] boards: xiao_ble: Add static partition manager configuration" This reverts commit f8d62960ff1247572cc783278a6fd42900e8621a. Signed-off-by: Jukka Rissanen --- boards/seeed/xiao_ble/pm_static.yml | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 boards/seeed/xiao_ble/pm_static.yml diff --git a/boards/seeed/xiao_ble/pm_static.yml b/boards/seeed/xiao_ble/pm_static.yml deleted file mode 100644 index 02915293177c..000000000000 --- a/boards/seeed/xiao_ble/pm_static.yml +++ /dev/null @@ -1,18 +0,0 @@ -# Mirror of partitions defined in nrf52840_partition_uf2_sdv7.dtsi -# Default flash layout for nrf52840 using UF2 and SoftDevice s140 v7 - -softdevice_reserved: - address: 0x00 - size: 0x27000 - -app: - address: 0x27000 - size: 0xC5000 - -settings_storage: - address: 0xEC000 - size: 0x8000 - -uf2_partition: - address: 0xF4000 - size: 0xC000 From 12cda442869ef0a5fb270c9b5b6e1e24bf2eb0b4 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:38 +0300 Subject: [PATCH 1041/2141] Revert "[nrf noup] boards: nrf54h20dk: Enable default images for sysbuild" This reverts commit 91e50002e9f067dff6727639670c1719308e9a6a. Signed-off-by: Jukka Rissanen --- boards/nordic/nrf54h20dk/Kconfig.sysbuild | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 boards/nordic/nrf54h20dk/Kconfig.sysbuild diff --git a/boards/nordic/nrf54h20dk/Kconfig.sysbuild b/boards/nordic/nrf54h20dk/Kconfig.sysbuild deleted file mode 100644 index 29bd62b49927..000000000000 --- a/boards/nordic/nrf54h20dk/Kconfig.sysbuild +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2025 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -if BOARD_NRF54H20DK_NRF54H20_CPURAD - -config NRF_DEFAULT_EMPTY - default y - -endif # BOARD_NRF54H20DK_NRF54H20_CPURAD From 69b1dfd0eb1da2c559f282b341eb85319e4f0ecd Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:38 +0300 Subject: [PATCH 1042/2141] Revert "[nrf noup] bluetooth: host: Add support for bonding with same peer" This reverts commit 1890dbafd139c48deecd082099fb036fb4ca1649. Signed-off-by: Jukka Rissanen --- include/zephyr/bluetooth/bluetooth.h | 10 -- subsys/bluetooth/host/Kconfig | 18 --- subsys/bluetooth/host/adv.c | 52 ------- subsys/bluetooth/host/adv.h | 1 - subsys/bluetooth/host/hci_core.h | 23 +-- subsys/bluetooth/host/id.c | 217 ++------------------------- subsys/bluetooth/host/id.h | 23 --- subsys/bluetooth/host/keys.c | 79 +--------- subsys/bluetooth/host/keys.h | 6 - subsys/bluetooth/host/smp.c | 18 +-- tests/bluetooth/host/id/mocks/adv.c | 1 - tests/bluetooth/host/id/mocks/adv.h | 4 +- tests/bluetooth/host/id/mocks/keys.c | 1 - tests/bluetooth/host/id/mocks/keys.h | 4 +- 14 files changed, 30 insertions(+), 427 deletions(-) diff --git a/include/zephyr/bluetooth/bluetooth.h b/include/zephyr/bluetooth/bluetooth.h index 7f287f1c3448..c68327647599 100644 --- a/include/zephyr/bluetooth/bluetooth.h +++ b/include/zephyr/bluetooth/bluetooth.h @@ -1489,10 +1489,6 @@ struct bt_le_per_adv_param { * This error code is only guaranteed when using Zephyr * controller, for other controllers code returned in * this case may be -EIO. - * @return -EPERM When @kconfig{CONFIG_BT_PRIVACY} and - * @kconfig{CONFIG_BT_ID_AUTO_SWAP_MATCHING_BONDS} are enabled and connectable - * advertising is requested, and the given local identity has a conflicting - * key with another local identity for which advertising is already started. */ int bt_le_adv_start(const struct bt_le_adv_param *param, const struct bt_data *ad, size_t ad_len, @@ -1620,12 +1616,6 @@ struct bt_le_ext_adv_start_param { * * @param adv Advertising set object. * @param param Advertise start parameters. - * - * @return Zero on success or (negative) error code otherwise. - * @return -EPERM When @kconfig{CONFIG_BT_PRIVACY} and - * @kconfig{CONFIG_BT_ID_AUTO_SWAP_MATCHING_BONDS} are enabled and connectable - * advertising is requested, and the given local identity has a conflicting - * key with another local identity for which advertising is already started. */ int bt_le_ext_adv_start(struct bt_le_ext_adv *adv, const struct bt_le_ext_adv_start_param *param); diff --git a/subsys/bluetooth/host/Kconfig b/subsys/bluetooth/host/Kconfig index 3830745417ae..7611761bb453 100644 --- a/subsys/bluetooth/host/Kconfig +++ b/subsys/bluetooth/host/Kconfig @@ -630,24 +630,6 @@ config BT_ID_UNPAIR_MATCHING_BONDS link-layer. The Host does not have control over this acknowledgment, and the order of distribution is fixed by the specification. -config BT_ID_AUTO_SWAP_MATCHING_BONDS - bool "Automatically swap conflicting entries in the Resolving List" - depends on !BT_ID_UNPAIR_MATCHING_BONDS - depends on BT_PRIVACY && BT_PERIPHERAL && !BT_CENTRAL - help - If this option is enabled, the Host will not add a new bond with - the same peer address (or IRK) to the Resolving List if there is - already a bond with the same peer address (or IRK) on another local - identity. - - In case of Peripheral, the Host will swap the existing entry in the - Resolving List with the new one, so that the new bond will be used for - address resolution for the new local identity if the device starts - advertising with the new local identity. - - Important: this option is supported exclusively in the Peripheral - role. Excluding the Central role. - config BT_ID_ALLOW_UNAUTH_OVERWRITE bool "Allow unauthenticated pairing with same peer with other local identity" depends on !BT_SMP_ALLOW_UNAUTH_OVERWRITE diff --git a/subsys/bluetooth/host/adv.c b/subsys/bluetooth/host/adv.c index 2d7d65aaaeb8..25a538614e3a 100644 --- a/subsys/bluetooth/host/adv.c +++ b/subsys/bluetooth/host/adv.c @@ -272,25 +272,6 @@ struct bt_le_ext_adv *bt_hci_adv_lookup_handle(uint8_t handle) #endif /* CONFIG_BT_BROADCASTER */ #endif /* defined(CONFIG_BT_EXT_ADV) */ -struct bt_le_ext_adv *bt_adv_lookup_by_id(uint8_t id) -{ -#if defined(CONFIG_BT_EXT_ADV) - for (size_t i = 0; i < ARRAY_SIZE(adv_pool); i++) { - if (atomic_test_bit(adv_pool[i].flags, BT_ADV_CREATED) && - adv_pool[i].id == id) { - return &adv_pool[i]; - } - } -#else - if (atomic_test_bit(bt_dev.adv.flags, BT_ADV_CREATED) && bt_dev.adv.id == id) { - return &bt_dev.adv; - } -#endif - - return NULL; -} - - void bt_le_ext_adv_foreach(void (*func)(struct bt_le_ext_adv *adv, void *data), void *data) { @@ -1040,14 +1021,6 @@ int bt_le_adv_start_legacy(struct bt_le_ext_adv *adv, adv->id = param->id; bt_dev.adv_conn_id = adv->id; - if (IS_ENABLED(CONFIG_BT_ID_AUTO_SWAP_MATCHING_BONDS)) { - err = bt_id_resolving_list_check_and_update(adv->id, param->peer); - if (err) { - LOG_ERR("Failed to check and update resolving list: %d", err); - return err; - } - } - err = bt_id_set_adv_own_addr(adv, param->options, dir_adv, &set_param.own_addr_type); if (err) { @@ -1363,15 +1336,6 @@ int bt_le_adv_start_ext(struct bt_le_ext_adv *adv, } adv->id = param->id; - - if (IS_ENABLED(CONFIG_BT_ID_AUTO_SWAP_MATCHING_BONDS)) { - err = bt_id_resolving_list_check_and_update(adv->id, param->peer); - if (err) { - LOG_ERR("Failed to check and update resolving list: %d", err); - return err; - } - } - err = le_ext_adv_param_set(adv, param, sd != NULL); if (err) { return err; @@ -1727,22 +1691,6 @@ int bt_le_ext_adv_start(struct bt_le_ext_adv *adv, return -EALREADY; } - if (IS_ENABLED(CONFIG_BT_ID_AUTO_SWAP_MATCHING_BONDS)) { - const bt_addr_le_t *peer; - - if (bt_addr_le_eq(&adv->target_addr, BT_ADDR_LE_ANY)) { - peer = NULL; - } else { - peer = &adv->target_addr; - } - - err = bt_id_resolving_list_check_and_update(adv->id, peer); - if (err) { - LOG_ERR("Failed to check and update resolving list: %d", err); - return err; - } - } - if (IS_ENABLED(CONFIG_BT_PERIPHERAL) && atomic_test_bit(adv->flags, BT_ADV_CONNECTABLE)) { err = le_adv_start_add_conn(adv, &conn); diff --git a/subsys/bluetooth/host/adv.h b/subsys/bluetooth/host/adv.h index 1bd15854db28..65ad51135ce0 100644 --- a/subsys/bluetooth/host/adv.h +++ b/subsys/bluetooth/host/adv.h @@ -25,4 +25,3 @@ int bt_le_adv_set_enable_ext(struct bt_le_ext_adv *adv, int bt_le_adv_set_enable_legacy(struct bt_le_ext_adv *adv, bool enable); int bt_le_lim_adv_cancel_timeout(struct bt_le_ext_adv *adv); void bt_adv_reset_adv_pool(void); -struct bt_le_ext_adv *bt_adv_lookup_by_id(uint8_t id); diff --git a/subsys/bluetooth/host/hci_core.h b/subsys/bluetooth/host/hci_core.h index 74c2711b3e4c..b6ebdba31a7e 100644 --- a/subsys/bluetooth/host/hci_core.h +++ b/subsys/bluetooth/host/hci_core.h @@ -500,28 +500,7 @@ struct bt_keys; void bt_id_add(struct bt_keys *keys); void bt_id_del(struct bt_keys *keys); -/** @brief Find a conflict in the resolving list for a candidate IRK. - * - * @param candidate The candidate keys to check for conflicts. - * @param all If true, check all IRKs, otherwise check only added keys. - * - * @return The conflicting key if there is one, or NULL if no conflict was found. - */ -struct bt_keys *bt_id_find_conflict(struct bt_keys *candidate, bool all); - -/** * @brief Find multiple conflicts in the resolving list for a candidate IRK. - * - * This function iterates over all keys (added and not added to the Resolving List). If there are - * multiple conflicts, this function will return true. Otherwise, it will return false. - * - * If @c firt_conflict is not NULL, it will be set to the first found conflict. - * - * @param candidate The candidate key to check for conflicts. - * @param first_conflict Pointer to store the first found conflict, if any. Can be NULL. - * - * @return True if there are multiple conflicts, otherwise it returns false. - */ -bool bt_id_find_conflict_multiple(struct bt_keys *candidate, struct bt_keys **first_conflict); +struct bt_keys *bt_id_find_conflict(struct bt_keys *candidate); int bt_setup_random_id_addr(void); int bt_setup_public_id_addr(void); diff --git a/subsys/bluetooth/host/id.c b/subsys/bluetooth/host/id.c index 436feb32c1be..e52294cf5386 100644 --- a/subsys/bluetooth/host/id.c +++ b/subsys/bluetooth/host/id.c @@ -942,33 +942,9 @@ void bt_id_pending_keys_update(void) } } -static bool keys_conflict_check(const struct bt_keys *candidate, const struct bt_keys *resident) -{ - bool addr_conflict; - bool irk_conflict; - - addr_conflict = bt_addr_le_eq(&candidate->addr, &resident->addr); - - /* All-zero IRK is "no IRK", and does not conflict with other Zero-IRKs. */ - irk_conflict = (!bt_irk_eq(&candidate->irk, &(struct bt_irk){}) && - bt_irk_eq(&candidate->irk, &resident->irk)); - - if (addr_conflict || irk_conflict) { - LOG_DBG("Resident : addr %s and IRK %s", bt_addr_le_str(&resident->addr), - bt_hex(resident->irk.val, sizeof(resident->irk.val))); - LOG_DBG("Candidate: addr %s and IRK %s", bt_addr_le_str(&candidate->addr), - bt_hex(candidate->irk.val, sizeof(candidate->irk.val))); - - return true; - } - - return false; -} - struct bt_id_conflict { struct bt_keys *candidate; struct bt_keys *found; - bool check_all_irk; }; /* The Controller Resolve List is constrained by 7.8.38 "LE Add Device To @@ -980,6 +956,8 @@ struct bt_id_conflict { void find_rl_conflict(struct bt_keys *resident, void *user_data) { struct bt_id_conflict *conflict = user_data; + bool addr_conflict; + bool irk_conflict; __ASSERT_NO_MSG(conflict != NULL); __ASSERT_NO_MSG(conflict->candidate != NULL); @@ -992,26 +970,30 @@ void find_rl_conflict(struct bt_keys *resident, void *user_data) } /* Test against committed bonds only. */ - if (!conflict->check_all_irk && (resident->state & BT_KEYS_ID_ADDED) == 0) { - /* If the resident bond is not committed, we cannot have a conflict. */ + if ((resident->state & BT_KEYS_ID_ADDED) == 0) { return; } - if (resident->id == conflict->candidate->id) { - /* If the IDs are the same, we cannot have a conflict. */ - return; - } + addr_conflict = bt_addr_le_eq(&conflict->candidate->addr, &resident->addr); + + /* All-zero IRK is "no IRK", and does not conflict with other Zero-IRKs. */ + irk_conflict = (!bt_irk_eq(&conflict->candidate->irk, &(struct bt_irk){}) && + bt_irk_eq(&conflict->candidate->irk, &resident->irk)); + + if (addr_conflict || irk_conflict) { + LOG_DBG("Resident : addr %s and IRK %s", bt_addr_le_str(&resident->addr), + bt_hex(resident->irk.val, sizeof(resident->irk.val))); + LOG_DBG("Candidate: addr %s and IRK %s", bt_addr_le_str(&conflict->candidate->addr), + bt_hex(conflict->candidate->irk.val, sizeof(conflict->candidate->irk.val))); - if (keys_conflict_check(conflict->candidate, resident)) { conflict->found = resident; } } -struct bt_keys *bt_id_find_conflict(struct bt_keys *candidate, bool check_all_irk) +struct bt_keys *bt_id_find_conflict(struct bt_keys *candidate) { struct bt_id_conflict conflict = { .candidate = candidate, - .check_all_irk = check_all_irk, }; bt_keys_foreach_type(BT_KEYS_IRK, find_rl_conflict, &conflict); @@ -1019,59 +1001,6 @@ struct bt_keys *bt_id_find_conflict(struct bt_keys *candidate, bool check_all_ir return conflict.found; } -struct bt_id_conflict_multiple { - struct bt_keys *candidate; - struct bt_keys *found; - bool found_multiple; -}; - -void find_rl_conflict_multiple(struct bt_keys *resident, void *user_data) -{ - struct bt_id_conflict_multiple *conflict = user_data; - - __ASSERT_NO_MSG(conflict != NULL); - __ASSERT_NO_MSG(conflict->candidate != NULL); - __ASSERT_NO_MSG(resident != NULL); - - if (conflict->found_multiple) { - /* If we already found enough conflicts, we can stop searching. */ - return; - } - - if (resident->id == conflict->candidate->id) { - /* If the IDs are the same, we cannot have a conflict. */ - return; - } - - if (keys_conflict_check(conflict->candidate, resident)) { - if (conflict->found) { - conflict->found_multiple = true; - - LOG_WRN("Found multiple conflicts for %s: addr %s and IRK %s", - bt_addr_le_str(&conflict->candidate->addr), - bt_addr_le_str(&resident->addr), - bt_hex(resident->irk.val, sizeof(resident->irk.val))); - } else { - conflict->found = resident; - } - } -} - -bool bt_id_find_conflict_multiple(struct bt_keys *candidate, struct bt_keys **first_conflict) -{ - struct bt_id_conflict_multiple conflict = { - .candidate = candidate, - }; - - bt_keys_foreach_type(BT_KEYS_IRK, find_rl_conflict_multiple, &conflict); - - if (first_conflict != NULL) { - *first_conflict = conflict.found; - } - - return conflict.found_multiple; -} - void bt_id_add(struct bt_keys *keys) { CHECKIF(keys == NULL) { @@ -1323,122 +1252,6 @@ void bt_id_del(struct bt_keys *keys) bt_le_ext_adv_foreach(adv_unpause_enabled, NULL); } } - -static int conflict_check_and_replace(uint8_t id, struct bt_keys *keys) -{ - /* For the given key check if it has conflicts with other keys in the Resolving List - * (such keys have BT_KEYS_ID_ADDED state and BT_KEYS_ID_CONFLICT flag set). If it does, we - * need to remove the conflicting key from the Resolving List and add the new key. - * - * If the key is not in the Resolving List, we can add the new key right away. - * - * If advertiser for the conflicting key is enabled, we cannot remove the key from the - * Resolving List, so we return an error. - */ - - struct bt_keys *conflict; - const struct bt_le_ext_adv *adv; - - if (!(keys->flags & BT_KEYS_ID_CONFLICT)) { - LOG_DBG("Key has no conflicts for id %u addr %s", id, bt_addr_le_str(&keys->addr)); - return 0; - } - - if (keys->state & BT_KEYS_ID_ADDED) { - LOG_DBG("Key is already added to resolving list for id %u addr %s", id, - bt_addr_le_str(&keys->addr)); - return 0; - } - - /* bt_id_find_conflict returns only keys added to the Resolving List (state is - * BT_KEYS_ID_ADDED). If the key has conflict, but no keys were added (for example, if the - * last added key was removed after bt_unpair()), then this function will return NULL. Then, - * we don't need to remove a conflicting key from the Resolving List. Otherwise, we need to - * remove the conflicting key from the Resolving List before adding the new key. - */ - conflict = bt_id_find_conflict(keys, false); - if (conflict != NULL) { - __ASSERT_NO_MSG((conflict->flags & BT_KEYS_ID_CONFLICT) != 0); - - LOG_DBG("Found conflicting key with id %u addr %s", conflict->id, - bt_addr_le_str(&conflict->addr)); - - adv = bt_adv_lookup_by_id(conflict->id); - if (adv && atomic_test_bit(adv->flags, BT_ADV_ENABLED)) { - LOG_WRN("Cannot remove the conflicting key from the Resolving List while" - " advertising"); - return -EPERM; - } - - /* Drop BT_KEYS_ID_PENDING_DEL flag if we were about to delete the keys since we - * delete it here. - */ - conflict->state &= ~BT_KEYS_ID_PENDING_DEL; - bt_id_del(conflict); - } - - bt_id_add(keys); - - return 0; -} - -struct bt_id_resolve { - uint8_t id; - int err; -}; - -static void check_and_add_keys_for_id(struct bt_keys *keys, void *data) -{ - struct bt_id_resolve *resolve = data; - - if (resolve->err) { - /* Skipping other keys because we got error. */ - return; - } - - if (resolve->id != keys->id) { - /* We are only interested in keys for the given id */ - return; - } - - resolve->err = conflict_check_and_replace(resolve->id, keys); -} - -int bt_id_resolving_list_check_and_update(uint8_t id, const bt_addr_le_t *peer) -{ - int err; - - if (peer == NULL) { - struct bt_id_resolve resolve = { - .id = id, - }; - - LOG_DBG("Updating resolving list for id %u without peer address", id); - - bt_keys_foreach_type(BT_KEYS_IRK, check_and_add_keys_for_id, &resolve); - err = resolve.err; - } else { - struct bt_keys *keys; - - LOG_DBG("Updating resolving list for id %u addr %s", id, bt_addr_le_str(peer)); - - keys = bt_keys_get_addr(id, peer); - if (!keys) { - LOG_DBG("No keys found for id %u addr %s", id, bt_addr_le_str(peer)); - return -ENOENT; - } - - err = conflict_check_and_replace(id, keys); - } - - if (err) { - LOG_ERR("Failed to update resolving list for id %u addr %s (err %d)", id, - peer ? bt_addr_le_str(peer) : "NULL", err); - return err; - } - - return err; -} #endif /* defined(CONFIG_BT_SMP) */ void bt_id_get(bt_addr_le_t *addrs, size_t *count) diff --git a/subsys/bluetooth/host/id.h b/subsys/bluetooth/host/id.h index cd66784a5037..8824d3bb496b 100644 --- a/subsys/bluetooth/host/id.h +++ b/subsys/bluetooth/host/id.h @@ -60,26 +60,3 @@ void bt_id_pending_keys_update(void); void bt_id_pending_keys_update_set(struct bt_keys *keys, uint8_t flag); void bt_id_adv_limited_stopped(struct bt_le_ext_adv *adv); - -/** - * @brief Check and update the resolving list for a given identity. - * - * This function checks if the resolving list contains the keys for the given - * identity and peer address. If the keys are not present, it adds them to the - * resolving list. If the keys are present, it checks for conflicts with - * existing keys in the resolving list. If a conflict is found, it replaces - * the conflicting key with the new key. - * - * If the peer address is NULL, it updates the resolving list for all keys that belong to the given - * identity. - * - * If for any of the keys belonging to the given identity a conflict is found and the advertiser for - * that key is enabled, the function returns an error. - * - * @param id The identity ID to check and update. - * @param peer The peer address to check against the resolving list. - * - * @return 0 on success, or a negative error code on failure. - * @return -EPERM if a conflict is found and the advertiser for the conflicting key is enabled. - */ -int bt_id_resolving_list_check_and_update(uint8_t id, const bt_addr_le_t *peer); diff --git a/subsys/bluetooth/host/keys.c b/subsys/bluetooth/host/keys.c index 4ae1d5b7a96a..6341fc1e58e8 100644 --- a/subsys/bluetooth/host/keys.c +++ b/subsys/bluetooth/host/keys.c @@ -310,57 +310,16 @@ void bt_keys_add_type(struct bt_keys *keys, enum bt_keys_type type) keys->keys |= type; } -static void add_id_cb(struct k_work *work) -{ - bt_id_pending_keys_update(); -} - -static K_WORK_DEFINE(add_id_work, add_id_cb); - void bt_keys_clear(struct bt_keys *keys) { - struct bt_keys *conflict = NULL; - __ASSERT_NO_MSG(keys != NULL); LOG_DBG("%s (keys 0x%04x)", bt_addr_le_str(&keys->addr), keys->keys); - if (IS_ENABLED(CONFIG_BT_ID_AUTO_SWAP_MATCHING_BONDS) && - (keys->flags & BT_KEYS_ID_CONFLICT) != 0) { - /* We need to check how many conflicting keys left. If there is only one conflicting - * key left, we can remove the BT_KEYS_ID_CONFLICT flag from it so that Host don't - * need to check and update the Resolving List whenever this is needed. The key - * should be re-added to the Resolving List. - */ - bool found_multiple; - - found_multiple = bt_id_find_conflict_multiple(keys, &conflict); - if (conflict) { - if (found_multiple || (conflict->state & BT_KEYS_ID_ADDED) != 0) { - /* If we found multiple conflicting keys or the conflicting key - * is already added to the ID list, we don't need to clear the - * conflict flag for it and re-add it to the Resolving List. - */ - conflict = NULL; - } else { - /* Clear the conflict flag for the conflicting key */ - conflict->flags &= ~BT_KEYS_ID_CONFLICT; - } - } - } - if (keys->state & BT_KEYS_ID_ADDED) { bt_id_del(keys); } - if (conflict) { - /* Re-add the conflicting key to the Resolving List if it was the last conflicting - * key. - */ - bt_id_pending_keys_update_set(conflict, BT_KEYS_ID_PENDING_ADD); - k_work_submit(&add_id_work); - } - if (IS_ENABLED(CONFIG_BT_SETTINGS)) { /* Delete stored keys from flash */ bt_settings_delete_keys(keys->id, &keys->addr); @@ -388,28 +347,6 @@ int bt_keys_store(struct bt_keys *keys) return 0; } -static void check_and_set_id_conflict_flag(struct bt_keys *keys) -{ - struct bt_keys *conflict; - - if (!IS_ENABLED(CONFIG_BT_ID_AUTO_SWAP_MATCHING_BONDS)) { - /* If auto-swap is not enabled, we don't need to check for conflicts */ - return; - } - - /* Use bt_id_find_conflict() to check if there are any conflicting keys for the given keys. - * If there is at least one, set the BT_KEYS_ID_CONFLICT flag for both the keys and the - * conflicting key. - */ - conflict = bt_id_find_conflict(keys, true); - if (conflict != NULL) { - LOG_DBG("Found conflicting key %p.", conflict); - - keys->flags |= BT_KEYS_ID_CONFLICT; - conflict->flags |= BT_KEYS_ID_CONFLICT; - } -} - static int keys_set(const char *name, size_t len_rd, settings_read_cb read_cb, void *cb_arg) { @@ -490,8 +427,6 @@ static int keys_set(const char *name, size_t len_rd, settings_read_cb read_cb, memcpy(keys->storage_start, val, len); } - check_and_set_id_conflict_flag(keys); - LOG_DBG("Successfully restored keys for %s", bt_addr_le_str(&addr)); #if defined(CONFIG_BT_KEYS_OVERWRITE_OLDEST) if (aging_counter_val < keys->aging_counter) { @@ -501,17 +436,17 @@ static int keys_set(const char *name, size_t len_rd, settings_read_cb read_cb, return 0; } +static void add_id_cb(struct k_work *work) +{ + bt_id_pending_keys_update(); +} + +static K_WORK_DEFINE(add_id_work, add_id_cb); + static void id_add(struct bt_keys *keys, void *user_data) { __ASSERT_NO_MSG(keys != NULL); - if (keys->flags & BT_KEYS_ID_CONFLICT) { - /* If the keys have the conflict flag set, we don't want to add them to the ID list, - * as this will cause issues with resolving list. - */ - return; - } - bt_id_pending_keys_update_set(keys, BT_KEYS_ID_PENDING_ADD); k_work_submit(&add_id_work); } diff --git a/subsys/bluetooth/host/keys.h b/subsys/bluetooth/host/keys.h index 185fd610e779..b53635ce2c56 100644 --- a/subsys/bluetooth/host/keys.h +++ b/subsys/bluetooth/host/keys.h @@ -45,12 +45,6 @@ enum { /* Bit 2 and 3 might accidentally exist in old stored keys */ BT_KEYS_SC = BIT(4), BT_KEYS_OOB = BIT(5), - /** Indicates that the keys are in conflict with existing keys. - * - * This is used to indicate that the keys being added conflict with - * existing keys from different identity. - */ - BT_KEYS_ID_CONFLICT = BIT(6), }; struct bt_ltk { diff --git a/subsys/bluetooth/host/smp.c b/subsys/bluetooth/host/smp.c index 916bb661bb98..3c4fc29fe243 100644 --- a/subsys/bluetooth/host/smp.c +++ b/subsys/bluetooth/host/smp.c @@ -909,7 +909,7 @@ static void smp_br_id_add_replace(struct bt_keys *keys) bt_id_del(keys); } - conflict = bt_id_find_conflict(keys, false); + conflict = bt_id_find_conflict(keys); if (conflict != NULL) { int err; @@ -919,7 +919,7 @@ static void smp_br_id_add_replace(struct bt_keys *keys) __ASSERT_NO_MSG(!err); } - __ASSERT_NO_MSG(!bt_id_find_conflict(keys, false)); + __ASSERT_NO_MSG(!bt_id_find_conflict(keys)); bt_id_add(keys); } @@ -4048,24 +4048,16 @@ static uint8_t smp_id_add_replace(struct bt_smp *smp, struct bt_keys *new_bond) */ __ASSERT_NO_MSG(!(smp->remote_dist & BT_SMP_DIST_ID_KEY)); - conflict = bt_id_find_conflict(new_bond, IS_ENABLED(CONFIG_BT_ID_AUTO_SWAP_MATCHING_BONDS)); + conflict = bt_id_find_conflict(new_bond); if (conflict) { LOG_DBG("New bond conflicts with a bond on id %d.", conflict->id); } - if (conflict && !IS_ENABLED(CONFIG_BT_ID_AUTO_SWAP_MATCHING_BONDS) && - !IS_ENABLED(CONFIG_BT_ID_UNPAIR_MATCHING_BONDS)) { + if (conflict && !IS_ENABLED(CONFIG_BT_ID_UNPAIR_MATCHING_BONDS)) { LOG_WRN("Refusing new pairing. The old bond must be unpaired first."); return BT_SMP_ERR_AUTH_REQUIREMENTS; } - if (conflict && IS_ENABLED(CONFIG_BT_ID_AUTO_SWAP_MATCHING_BONDS)) { - LOG_WRN("Conflict detected with %p. Don't add key to Resolve List.", conflict); - new_bond->flags |= BT_KEYS_ID_CONFLICT; - conflict->flags |= BT_KEYS_ID_CONFLICT; - return 0; - } - if (conflict && IS_ENABLED(CONFIG_BT_ID_UNPAIR_MATCHING_BONDS)) { bool trust_ok; int unpair_err; @@ -4082,7 +4074,7 @@ static uint8_t smp_id_add_replace(struct bt_smp *smp, struct bt_keys *new_bond) __ASSERT_NO_MSG(!unpair_err); } - __ASSERT_NO_MSG(!bt_id_find_conflict(new_bond, false)); + __ASSERT_NO_MSG(!bt_id_find_conflict(new_bond)); bt_id_add(new_bond); return 0; } diff --git a/tests/bluetooth/host/id/mocks/adv.c b/tests/bluetooth/host/id/mocks/adv.c index a22123dea3da..2c2d4f3f3c7a 100644 --- a/tests/bluetooth/host/id/mocks/adv.c +++ b/tests/bluetooth/host/id/mocks/adv.c @@ -15,4 +15,3 @@ DEFINE_FAKE_VALUE_FUNC(int, bt_le_adv_set_enable_legacy, struct bt_le_ext_adv *, DEFINE_FAKE_VALUE_FUNC(int, bt_le_adv_set_enable_ext, struct bt_le_ext_adv *, bool, const struct bt_le_ext_adv_start_param *); DEFINE_FAKE_VOID_FUNC(bt_le_ext_adv_foreach, bt_le_ext_adv_foreach_cb, void *); -DEFINE_FAKE_VALUE_FUNC(struct bt_le_ext_adv *, bt_adv_lookup_by_id, uint8_t); diff --git a/tests/bluetooth/host/id/mocks/adv.h b/tests/bluetooth/host/id/mocks/adv.h index 1602ddf47185..bfb744001596 100644 --- a/tests/bluetooth/host/id/mocks/adv.h +++ b/tests/bluetooth/host/id/mocks/adv.h @@ -18,8 +18,7 @@ typedef void (*bt_le_ext_adv_foreach_cb)(struct bt_le_ext_adv *adv, void *data); FAKE(bt_le_adv_lookup_legacy) \ FAKE(bt_le_ext_adv_get_index) \ FAKE(bt_le_adv_set_enable_ext) \ - FAKE(bt_le_ext_adv_foreach) \ - FAKE(bt_adv_lookup_by_id) + FAKE(bt_le_ext_adv_foreach) DECLARE_FAKE_VALUE_FUNC(int, bt_le_adv_set_enable, struct bt_le_ext_adv *, bool); DECLARE_FAKE_VALUE_FUNC(struct bt_le_ext_adv *, bt_le_adv_lookup_legacy); @@ -28,4 +27,3 @@ DECLARE_FAKE_VALUE_FUNC(int, bt_le_adv_set_enable_legacy, struct bt_le_ext_adv * DECLARE_FAKE_VALUE_FUNC(int, bt_le_adv_set_enable_ext, struct bt_le_ext_adv *, bool, const struct bt_le_ext_adv_start_param *); DECLARE_FAKE_VOID_FUNC(bt_le_ext_adv_foreach, bt_le_ext_adv_foreach_cb, void *); -DECLARE_FAKE_VALUE_FUNC(struct bt_le_ext_adv *, bt_adv_lookup_by_id, uint8_t); diff --git a/tests/bluetooth/host/id/mocks/keys.c b/tests/bluetooth/host/id/mocks/keys.c index 61f73569c469..f885ab875c0f 100644 --- a/tests/bluetooth/host/id/mocks/keys.c +++ b/tests/bluetooth/host/id/mocks/keys.c @@ -10,4 +10,3 @@ DEFINE_FAKE_VALUE_FUNC(struct bt_keys *, bt_keys_find_irk, uint8_t, const bt_addr_le_t *); DEFINE_FAKE_VOID_FUNC(bt_keys_foreach_type, enum bt_keys_type, bt_keys_foreach_type_cb, void *); -DEFINE_FAKE_VALUE_FUNC(struct bt_keys *, bt_keys_get_addr, uint8_t, const bt_addr_le_t *); diff --git a/tests/bluetooth/host/id/mocks/keys.h b/tests/bluetooth/host/id/mocks/keys.h index 1912472b78de..b6901e315ab9 100644 --- a/tests/bluetooth/host/id/mocks/keys.h +++ b/tests/bluetooth/host/id/mocks/keys.h @@ -15,9 +15,7 @@ typedef void (*bt_keys_foreach_type_cb)(struct bt_keys *keys, void *data); /* List of fakes used by this unit tester */ #define KEYS_FFF_FAKES_LIST(FAKE) \ FAKE(bt_keys_find_irk) \ - FAKE(bt_keys_foreach_type) \ - FAKE(bt_keys_get_addr) + FAKE(bt_keys_foreach_type) DECLARE_FAKE_VALUE_FUNC(struct bt_keys *, bt_keys_find_irk, uint8_t, const bt_addr_le_t *); DECLARE_FAKE_VOID_FUNC(bt_keys_foreach_type, enum bt_keys_type, bt_keys_foreach_type_cb, void *); -DECLARE_FAKE_VALUE_FUNC(struct bt_keys *, bt_keys_get_addr, uint8_t, const bt_addr_le_t *); From f3433765b5c8f7488a28b0fe5ed1e6027565355c Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:38 +0300 Subject: [PATCH 1043/2141] Revert "[nrf noup] zephyr: doc: fix board page" This reverts commit 45023b2d4f10fbbcb6f0be9da7d666a1cc5dee46. Signed-off-by: Jukka Rissanen --- boards/index.rst | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/boards/index.rst b/boards/index.rst index 2ffe426fc24b..3cc92770cfeb 100644 --- a/boards/index.rst +++ b/boards/index.rst @@ -12,8 +12,33 @@ template available under :zephyr_file:`doc/templates/board.tmpl`. Shields are hardware add-ons that can be stacked on top of a board to add extra functionality. Refer to the :ref:`shield_porting_guide` for more information on how to port a shield. +.. admonition:: Search Tips + :class: dropdown + + * Use the form below to filter the list of supported boards and shields. If a field is left + empty, it will not be used in the filtering process. + + * Filtering by name and vendor is available for both boards and shields. The rest of the fields + apply only to boards. + + * A board/shield must meet **all** criteria selected across different fields. For example, if you + select both a vendor and an architecture, only boards that match both will be displayed. Within + a single field, selecting multiple options (such as two architectures) will show boards + matching **either** option. + + * The list of supported hardware features for each board is automatically generated using + information from the Devicetree. It may not be reflecting the full list of supported features + since some of them may not be enabled by default. + + * Can't find your exact board? Don't worry! If a similar board with the same or a closely related + MCU exists, you can use it as a :ref:`starting point ` for adding + support for your own board. + .. toctree:: :maxdepth: 2 :glob: + :hidden: */index + +.. zephyr:board-catalog:: From 5097962f2a5f672df9dce90bb94f77a13432f8ff Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:38 +0300 Subject: [PATCH 1044/2141] Revert "[nrf noup] ci: Update CI-boot-test patterns and remove SUIT labels" This reverts commit b68aa7bd7be4df7d7d6cb924c1f963cb590b9ce9. Signed-off-by: Jukka Rissanen --- .github/test-spec.yml | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/.github/test-spec.yml b/.github/test-spec.yml index 5337249f7dab..6da6bdbaa87d 100644 --- a/.github/test-spec.yml +++ b/.github/test-spec.yml @@ -39,7 +39,6 @@ # Not necessary to run tests on changes to this repo. "CI-boot-test": - - "boards/nordic/**/*" - "subsys/mgmt/mcumgr/**/*" - "subsys/dfu/**/*" - "include/mgmt/mcumgr/**/*" @@ -365,3 +364,29 @@ - "tests/boards/nordic/**/*" - "tests/drivers/**/*" - "tests/kernel/**/*" + +"CI-suit-dfu-test": + - "subsys/mgmt/mcumgr/**/*" + - "include/mgmt/mcumgr/**/*" + - "samples/subsys/mgmt/mcumgr/smp_svr/**/*" + - "subsys/bluetooth/**/*" + - "drivers/bluetooth/**/*" + - "drivers/flash/**/*" + - "drivers/spi/**/*" + - "drivers/mbox/**/*" + - "drivers/serial/**/*" + - "drivers/console/**/*" + - "drivers/gpio/**/*" + - "dts/common/nordic/*" + - "dts/arm/nordic/nrf54h*/**/*" + - "dts/riscv/nordic/nrf54h*/**/*" + - "boards/nordic/nrf54h*/**/*" + - "soc/nordic/nrf54h/**/*" + - "include/zephyr/**/*" + - "subsys/logging/**/*" + - "subsys/tracing/**/*" + - "scripts/west_commands/build.py" + - "scripts/west_commands/flash.py" + - "scripts/west_commands/runners/nrfutil.py" + - "scripts/west_commands/runners/core.py" + - "scripts/west_commands/runners/nrf_common.py" From 6047beaa9986c715f50de041eed82e491825516d Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:38 +0300 Subject: [PATCH 1045/2141] Revert "[nrf noup] scripts: ci: check_compliance: Add NCS sysbuild Kconfigs" This reverts commit 77ba279d1f02d409714133c72ca70852193d5e3c. Signed-off-by: Jukka Rissanen --- scripts/ci/check_compliance.py | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index 3ee7b62c9b5a..31bb02c22f88 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -1241,30 +1241,6 @@ class SysbuildKconfigCheck(KconfigCheck): "SUIT_MPI_GENERATE", # Used by nRF runners to program provisioning data "SUIT_MPI_RAD_AREA_PATH", # Used by nRF runners to program provisioning data # zephyr-keep-sorted-stop - - # NCS-specific allowlist - # zephyr-keep-sorted-start re(^\s+") - "APP_CPUNET_RUN", # Used by sample - "APP_DFU", # Used by sample - "BT_FAST_PAIR", # Legacy/removed, used in migration documentation - "COMP_DATA_LAYOUT_ARRAY", # Used by test - "COMP_DATA_LAYOUT_MULTIPLE", # Used by test - "COMP_DATA_LAYOUT_SINGLE", # Used by test - "DTM_NO_DFE", # Used by DTM application - "DTM_TRANSPORT_HCI", # Used by DTM application - "INCLUDE_REMOTE_IMAGE", # Used by machine learning application - "MCUBOOT_FPROTECT_ALLOW_COMBINED_REGIONS", # Used in migration documentation - "ML_APP_INCLUDE_REMOTE_IMAGE", # Used by machine learning application - "ML_APP_REMOTE_BOARD", # Used by machine learning application - "MY_APP_IMAGE_ABC", # Used in documentation - "REMOTE_GLOBAL_DOMAIN_CLOCK_FREQUENCY_SWITCHING", # Used in tests - "SOC_FLASH_NRF_RADIO_SYNC_RPC", # Used in documentation - "SUIT_ENVELOPE_", # Used by jinja - "SUIT_ENVELOPE_SEQUENCE_NUM", # Legacy/removed, used in migration documentation - "SUIT_MPI_", # Used by jinja - "SUIT_RECOVERY_APPLICATION_CUSTOM", # Used in documentation - "SUPPORT_NETCORE_PERIPHERAL_RADIO_TEST", # Used by wifi radio test sample - # zephyr-keep-sorted-stop } From ac0b96e14c3c4a2c5ae5b571168ca11f90f5f54f Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:39 +0300 Subject: [PATCH 1046/2141] Revert "[nrf noup] ci: NCS-specific CI tweaks" This reverts commit ad003a38b2a4230828df44ea025f179a64256947. Signed-off-by: Jukka Rissanen --- .github/workflows/commit-tags.yml | 28 -------------------------- .github/workflows/compliance.yml | 13 +++++++----- Jenkinsfile | 5 ----- scripts/gitlint/zephyr_commit_rules.py | 4 ++-- 4 files changed, 10 insertions(+), 40 deletions(-) delete mode 100644 .github/workflows/commit-tags.yml delete mode 100644 Jenkinsfile diff --git a/.github/workflows/commit-tags.yml b/.github/workflows/commit-tags.yml deleted file mode 100644 index 828f02971678..000000000000 --- a/.github/workflows/commit-tags.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Commit tags - -on: - pull_request: - types: [synchronize, opened, reopened, edited, labeled, unlabeled, - milestoned, demilestoned, assigned, unassigned, ready_for_review, - review_requested] - -jobs: - commit_tags: - runs-on: ubuntu-22.04 - name: Run commit tags checks on patch series (PR) - steps: - - name: Update PATH for west - run: | - echo "$HOME/.local/bin" >> $GITHUB_PATH - - - name: Checkout the code - uses: actions/checkout@v3 - with: - ref: ${{ github.event.pull_request.head.sha }} - fetch-depth: 0 - - - name: Run the commit tags - uses: nrfconnect/action-commit-tags@main - with: - target: . - upstream: zephyrproject-rtos/zephyr/main diff --git a/.github/workflows/compliance.yml b/.github/workflows/compliance.yml index 22744e8a6ac1..9d1621cc4d3a 100644 --- a/.github/workflows/compliance.yml +++ b/.github/workflows/compliance.yml @@ -34,8 +34,8 @@ jobs: git config --global user.name "Your Name" git remote -v # Ensure there's no merge commits in the PR - #[[ "$(git rev-list --merges --count origin/${BASE_REF}..)" == "0" ]] || \ - #(echo "::error ::Merge commits not allowed, rebase instead";false) + [[ "$(git rev-list --merges --count origin/${BASE_REF}..)" == "0" ]] || \ + (echo "::error ::Merge commits not allowed, rebase instead";false) rm -fr ".git/rebase-apply" rm -fr ".git/rebase-merge" git rebase origin/${BASE_REF} @@ -72,9 +72,12 @@ jobs: git log --pretty=oneline | head -n 10 # Increase rename limit to allow for large PRs git config diff.renameLimit 10000 - ./scripts/ci/check_compliance.py --annotate -e KconfigBasic -e SysbuildKconfigBasic \ - -e Kconfig -e SysbuildKconfig -e KconfigBasicNoModules -e SysbuildKconfigBasicNoModules \ - -e ModulesMaintainers -c origin/${BASE_REF}.. + excludes="-e KconfigBasic -e SysbuildKconfigBasic -e ClangFormat" + # The signed-off-by check for dependabot should be skipped + if [ "${{ github.actor }}" == "dependabot[bot]" ]; then + excludes="$excludes -e Identity" + fi + ./scripts/ci/check_compliance.py --annotate $excludes -c origin/${BASE_REF}.. - name: upload-results uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index 3b9cf0022399..000000000000 --- a/Jenkinsfile +++ /dev/null @@ -1,5 +0,0 @@ -@Library("CI_LIB") _ - -def pipeline = new ncs.sdk_zephyr.Main() - -pipeline.run(JOB_NAME) diff --git a/scripts/gitlint/zephyr_commit_rules.py b/scripts/gitlint/zephyr_commit_rules.py index ef317e22684c..a2c9cd3cb7fe 100644 --- a/scripts/gitlint/zephyr_commit_rules.py +++ b/scripts/gitlint/zephyr_commit_rules.py @@ -78,7 +78,7 @@ class TitleMaxLengthRevert(LineRule): name = "title-max-length-no-revert" id = "UC5" target = CommitMessageTitle - options_spec = [IntOption('line-length', 120, "Max line length")] + options_spec = [IntOption('line-length', 75, "Max line length")] violation_message = "Commit title exceeds max length ({0}>{1})" def validate(self, line, _commit): @@ -103,7 +103,7 @@ class MaxLineLengthExceptions(LineRule): name = "max-line-length-with-exceptions" id = "UC4" target = CommitMessageBody - options_spec = [IntOption('line-length', 120, "Max line length")] + options_spec = [IntOption('line-length', 75, "Max line length")] violation_message = "Commit message body line exceeds max length ({0}>{1})" def validate(self, line, _commit): From 41afbbc7f4753e538c02881f3b297aa6252cad89 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:39 +0300 Subject: [PATCH 1047/2141] Revert "[nrf noup] tests: bluetooth: tester: Enable PSA RNG on nRF54H20" This reverts commit 892f60bbd28790a22fbaa5631fd32aaa6a6f755f. Signed-off-by: Jukka Rissanen --- .../boards/nrf54h20dk_nrf54h20_cpuapp.conf | 7 ---- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 14 ------- tests/bluetooth/tester/sysbuild.cmake | 7 ++++ .../boards/nrf54h20dk_nrf54h20_cpurad.conf | 40 ------------------- .../boards/nrf54h20dk_nrf54h20_cpurad.overlay | 13 ------ .../tester/sysbuild/hci_ipc/prj.conf | 23 ----------- 6 files changed, 7 insertions(+), 97 deletions(-) delete mode 100644 tests/bluetooth/tester/sysbuild/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.conf delete mode 100644 tests/bluetooth/tester/sysbuild/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.overlay delete mode 100644 tests/bluetooth/tester/sysbuild/hci_ipc/prj.conf diff --git a/tests/bluetooth/tester/boards/nrf54h20dk_nrf54h20_cpuapp.conf b/tests/bluetooth/tester/boards/nrf54h20dk_nrf54h20_cpuapp.conf index 51b0ef5fa8d4..5bb1c4d82846 100644 --- a/tests/bluetooth/tester/boards/nrf54h20dk_nrf54h20_cpuapp.conf +++ b/tests/bluetooth/tester/boards/nrf54h20dk_nrf54h20_cpuapp.conf @@ -22,10 +22,3 @@ CONFIG_LOG_DEFAULT_LEVEL=3 CONFIG_BTTESTER_LOG_LEVEL_DBG=y CONFIG_UART_INTERRUPT_DRIVEN=y - -# Enable PSA RNG -CONFIG_PSA_CRYPTO_DRIVER_OBERON=n -CONFIG_PSA_SSF_CRYPTO_CLIENT=y -CONFIG_SSF_PSA_CRYPTO_SERVICE_ENABLED=y -CONFIG_MBEDTLS_PSA_CRYPTO_C=y -CONFIG_NRF_SECURITY=y diff --git a/tests/bluetooth/tester/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/bluetooth/tester/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index 4f9de686b7e5..e6d4f675f57a 100644 --- a/tests/bluetooth/tester/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/tests/bluetooth/tester/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -12,17 +12,3 @@ status = "okay"; hw-flow-control; }; - -// Enable PSA RNG -/ { - chosen { - zephyr,entropy = &psa_rng; - }; - - psa_rng: psa-rng { - compatible = "zephyr,psa-crypto-rng"; - status = "okay"; - }; - - /delete-node/ prng; -}; diff --git a/tests/bluetooth/tester/sysbuild.cmake b/tests/bluetooth/tester/sysbuild.cmake index b640a7d04936..bcd564733c53 100644 --- a/tests/bluetooth/tester/sysbuild.cmake +++ b/tests/bluetooth/tester/sysbuild.cmake @@ -18,6 +18,13 @@ if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) ) endif() + if(SB_CONFIG_SOC_NRF54H20_CPUAPP) + set(${NET_APP}_CONF_FILE + ${NET_APP_SRC_DIR}/nrf54h20_cpurad-bt_ll_softdevice.conf + CACHE INTERNAL "" + ) + endif() + set(${NET_APP}_EXTRA_CONF_FILE ${APP_DIR}/overlay-bt_ll_sw_split.conf CACHE INTERNAL "" diff --git a/tests/bluetooth/tester/sysbuild/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.conf b/tests/bluetooth/tester/sysbuild/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.conf deleted file mode 100644 index b7d64a9e6a08..000000000000 --- a/tests/bluetooth/tester/sysbuild/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.conf +++ /dev/null @@ -1,40 +0,0 @@ -CONFIG_IPC_SERVICE=y -CONFIG_MBOX=y - -CONFIG_ISR_STACK_SIZE=1024 -CONFIG_IDLE_STACK_SIZE=256 -CONFIG_MAIN_STACK_SIZE=1024 -CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=512 -CONFIG_IPC_SERVICE_BACKEND_RPMSG_WQ_STACK_SIZE=512 -CONFIG_HEAP_MEM_POOL_SIZE=8192 - -CONFIG_BT=y -CONFIG_BT_HCI_RAW=y - -CONFIG_BT_BUF_EVT_RX_COUNT=16 -CONFIG_BT_BUF_EVT_RX_SIZE=255 -CONFIG_BT_BUF_ACL_RX_SIZE=255 -CONFIG_BT_BUF_ACL_TX_SIZE=251 -CONFIG_BT_BUF_CMD_TX_SIZE=255 - -# Host -CONFIG_BT_BROADCASTER=y -CONFIG_BT_PERIPHERAL=y -CONFIG_BT_OBSERVER=y -CONFIG_BT_CENTRAL=y -CONFIG_BT_EXT_ADV=y -CONFIG_BT_PER_ADV=y -CONFIG_BT_PER_ADV_SYNC=y - -# Controller -CONFIG_BT_LL_SW_SPLIT=n -CONFIG_BT_LL_SOFTDEVICE=y -CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 -CONFIG_BT_CTLR_SCAN_DATA_LEN_MAX=191 - -# Enable PSA RNG -CONFIG_PSA_CRYPTO_DRIVER_OBERON=n -CONFIG_PSA_SSF_CRYPTO_CLIENT=y -CONFIG_SSF_PSA_CRYPTO_SERVICE_ENABLED=y -CONFIG_MBEDTLS_PSA_CRYPTO_C=y -CONFIG_NRF_SECURITY=y diff --git a/tests/bluetooth/tester/sysbuild/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.overlay b/tests/bluetooth/tester/sysbuild/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.overlay deleted file mode 100644 index e34567fe834a..000000000000 --- a/tests/bluetooth/tester/sysbuild/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.overlay +++ /dev/null @@ -1,13 +0,0 @@ -// Enable PSA RNG -/ { - chosen { - zephyr,entropy = &psa_rng; - }; - - psa_rng: psa-rng { - compatible = "zephyr,psa-crypto-rng"; - status = "okay"; - }; - - /delete-node/ prng; -}; diff --git a/tests/bluetooth/tester/sysbuild/hci_ipc/prj.conf b/tests/bluetooth/tester/sysbuild/hci_ipc/prj.conf deleted file mode 100644 index 08b1aed9e7f6..000000000000 --- a/tests/bluetooth/tester/sysbuild/hci_ipc/prj.conf +++ /dev/null @@ -1,23 +0,0 @@ -CONFIG_IPC_SERVICE=y -CONFIG_MBOX=y - -CONFIG_HEAP_MEM_POOL_SIZE=4096 - -CONFIG_MAIN_STACK_SIZE=512 -CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=512 - -CONFIG_BT=y -CONFIG_BT_HCI_RAW=y -CONFIG_BT_MAX_CONN=16 - - -# Workaround: Unable to allocate command buffer when using K_NO_WAIT since -# Host number of completed commands does not follow normal flow control. -CONFIG_BT_BUF_CMD_TX_COUNT=10 - -# Enable and adjust the below value as necessary -# CONFIG_BT_BUF_EVT_RX_COUNT=16 -# CONFIG_BT_BUF_EVT_RX_SIZE=255 -# CONFIG_BT_BUF_ACL_RX_SIZE=255 -# CONFIG_BT_BUF_ACL_TX_SIZE=251 -# CONFIG_BT_BUF_CMD_TX_SIZE=255 From 2e1afb0b19af4118c844bfb07099c16a5667d1e8 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:39 +0300 Subject: [PATCH 1048/2141] Revert "[nrf noup] mgmt: mcumgr: Fix nRF5340 network core hook" This reverts commit 730c36b0bbb62f31816baeb0f3efaa84dc522c90. Signed-off-by: Jukka Rissanen --- subsys/mgmt/mcumgr/CMakeLists.txt | 13 ++++++------- subsys/mgmt/mcumgr/Kconfig | 2 +- subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c | 15 ++++++++++++--- subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig | 8 -------- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/subsys/mgmt/mcumgr/CMakeLists.txt b/subsys/mgmt/mcumgr/CMakeLists.txt index 3bb21e16f798..ad088eca0677 100644 --- a/subsys/mgmt/mcumgr/CMakeLists.txt +++ b/subsys/mgmt/mcumgr/CMakeLists.txt @@ -17,11 +17,10 @@ add_subdirectory_ifdef(CONFIG_SMP_CLIENT smp_client) zephyr_library_link_libraries(mgmt_mcumgr) -if(CONFIG_MCUMGR_GRP_IMG_NRF5340_BOOTUTIL_HOOK) - zephyr_include_directories( - ${ZEPHYR_MCUBOOT_MODULE_DIR}/boot/bootutil/include - ${ZEPHYR_MCUBOOT_MODULE_DIR}/boot/zephyr/include - ) - - zephyr_library_sources(bootutil_hooks/nrf53_hooks.c) +if (CONFIG_BOOT_IMAGE_ACCESS_HOOKS) + zephyr_include_directories( + ${ZEPHYR_MCUBOOT_MODULE_DIR}/boot/bootutil/include + ${ZEPHYR_MCUBOOT_MODULE_DIR}/boot/zephyr/include + ) + zephyr_library_sources(bootutil_hooks/nrf53_hooks.c) endif() diff --git a/subsys/mgmt/mcumgr/Kconfig b/subsys/mgmt/mcumgr/Kconfig index c45cb7f81d6b..1c6a3a2a5162 100644 --- a/subsys/mgmt/mcumgr/Kconfig +++ b/subsys/mgmt/mcumgr/Kconfig @@ -6,7 +6,7 @@ menuconfig MCUMGR bool "mcumgr Support" depends on NET_BUF depends on ZCBOR - imply BOOT_IMAGE_ACCESS_HOOKS if SOC_NRF5340_CPUAPP && MCUMGR_GRP_IMG && MCUBOOT_NETWORK_CORE_IMAGE_NUMBER > -1 + imply BOOT_IMAGE_ACCESS_HOOKS if (SOC_NRF5340_CPUAPP_QKAA && MCUMGR_GRP_IMG) help This option enables the mcumgr management library. diff --git a/subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c b/subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c index b372ce4e4945..f1ac8a168e65 100644 --- a/subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c +++ b/subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c @@ -8,10 +8,19 @@ #include #include "bootutil/bootutil_public.h" -int boot_read_swap_state_primary_slot_hook(int image_index, struct boot_swap_state *state) +#if CONFIG_MCUBOOT_NETWORK_CORE_IMAGE_NUMBER != -1 +/* Sysbuild */ +#define NET_CORE_IMAGE CONFIG_MCUBOOT_NETWORK_CORE_IMAGE_NUMBER +#else +/* Legacy child/parent */ +#define NET_CORE_IMAGE 1 +#endif + +int boot_read_swap_state_primary_slot_hook(int image_index, + struct boot_swap_state *state) { - if (image_index == CONFIG_MCUBOOT_NETWORK_CORE_IMAGE_NUMBER) { - /* Pretend that primary slot of the network core update image is unpopulated */ + if (image_index == NET_CORE_IMAGE) { + /* Pretend that primary slot of image 1 unpopulated */ state->magic = BOOT_MAGIC_UNSET; state->swap_type = BOOT_SWAP_TYPE_NONE; state->image_num = image_index; diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig b/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig index d95f9b5849a5..5f122fcf71fc 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig @@ -227,14 +227,6 @@ config MCUMGR_GRP_IMG_QSPI_XIP_SPLIT_IMAGE sysbuild if needed. This enables selecting the correct slot when running a QSPI XIP split image application in DirectXIP mode. -config MCUMGR_GRP_IMG_NRF5340_BOOTUTIL_HOOK - bool "nRF5340 network core bootutil hook" - depends on SOC_NRF5340_CPUAPP && BOOT_IMAGE_ACCESS_HOOKS && MCUBOOT_NETWORK_CORE_IMAGE_NUMBER > -1 - default y - help - This option will enable a bootutil hook that populates the network core update image - slot with dummy data to allow for uploading a firmware update to the network core. - module = MCUMGR_GRP_IMG module-str = mcumgr_grp_img source "subsys/logging/Kconfig.template.log_config" From 6f3e986b0058330f25dca7e5c1792e9a8ee7e972 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:39 +0300 Subject: [PATCH 1049/2141] Revert "[nrf noup] tests: crypto: Set size for PSA slot" This reverts commit 39b7cf4e0af13a0a08afd68b0b94976dc0ce8bac. Signed-off-by: Jukka Rissanen --- tests/crypto/secp256r1/mbedtls.conf | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/crypto/secp256r1/mbedtls.conf b/tests/crypto/secp256r1/mbedtls.conf index c4ea620de55f..bbc2eb0e6563 100644 --- a/tests/crypto/secp256r1/mbedtls.conf +++ b/tests/crypto/secp256r1/mbedtls.conf @@ -1,7 +1,6 @@ CONFIG_MBEDTLS=y CONFIG_MBEDTLS_PSA_CRYPTO_C=y CONFIG_MBEDTLS_PSA_P256M_DRIVER_ENABLED=y -CONFIG_MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE=65 CONFIG_MBEDTLS_PSA_STATIC_KEY_SLOTS=y CONFIG_MBEDTLS_PSA_KEY_SLOT_COUNT=2 From dd2fc4690141045941262c8a3c3390602224c50b Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:39 +0300 Subject: [PATCH 1050/2141] Revert "[nrf noup] Bluetooth: update experimental for qualification" This reverts commit a29db90830b199845cccdcf81544fc0129a228f9. Signed-off-by: Jukka Rissanen --- subsys/bluetooth/controller/Kconfig | 4 +--- subsys/bluetooth/host/Kconfig.l2cap | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/subsys/bluetooth/controller/Kconfig b/subsys/bluetooth/controller/Kconfig index 60726163581c..2cc9600d27f0 100644 --- a/subsys/bluetooth/controller/Kconfig +++ b/subsys/bluetooth/controller/Kconfig @@ -143,12 +143,10 @@ config BT_CTLR the HAS_BT_CTLR option. config BT_LL_SW_SPLIT - bool "Software-based Bluetooth LE Link Layer [EXPERIMENTAL]" + bool "Software-based Bluetooth LE Link Layer" default y depends on DT_HAS_ZEPHYR_BT_HCI_LL_SW_SPLIT_ENABLED select HAS_BT_CTLR - select EXPERIMENTAL - select ENTROPY_GENERATOR help Use Zephyr software Bluetooth LE Link Layer ULL LLL split implementation. diff --git a/subsys/bluetooth/host/Kconfig.l2cap b/subsys/bluetooth/host/Kconfig.l2cap index 34e862378c5e..2841e7d8a129 100644 --- a/subsys/bluetooth/host/Kconfig.l2cap +++ b/subsys/bluetooth/host/Kconfig.l2cap @@ -52,7 +52,7 @@ config BT_L2CAP_DYNAMIC_CHANNEL allowing the creation of dynamic L2CAP Channels. config BT_L2CAP_ECRED - bool "L2CAP Enhanced Credit Based Flow Control support [EXPERIMENTAL]" + bool "L2CAP Enhanced Credit Based Flow Control support" depends on BT_L2CAP_DYNAMIC_CHANNEL help This option enables support for LE Connection oriented Channels with From 29296906f8bb4239d3327c655977fc6d1d002208 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:39 +0300 Subject: [PATCH 1051/2141] Revert "[nrf noup] drivers: pinctrl: Add SDP MSPI pin configuration" This reverts commit 2e74ea72fa61061c4caf1beb6dda304473838774. Signed-off-by: Jukka Rissanen --- drivers/pinctrl/pinctrl_nrf.c | 32 ----------- .../zephyr/dt-bindings/pinctrl/nrf-pinctrl.h | 56 ------------------- 2 files changed, 88 deletions(-) diff --git a/drivers/pinctrl/pinctrl_nrf.c b/drivers/pinctrl/pinctrl_nrf.c index 34c0107b591b..65a073102607 100644 --- a/drivers/pinctrl/pinctrl_nrf.c +++ b/drivers/pinctrl/pinctrl_nrf.c @@ -112,18 +112,6 @@ static const nrf_gpio_pin_drive_t drive_modes[NRF_DRIVE_COUNT] = { #define NRF_PSEL_TDM(reg, line) ((NRF_TDM_Type *)reg)->PSEL.line #endif -#if DT_HAS_COMPAT_STATUS_OKAY(nordic_hpf_mspi_controller) || \ - defined(CONFIG_MSPI_HPF) || \ - DT_ANY_COMPAT_HAS_PROP_STATUS_OKAY(nordic_nrf_vpr_coprocessor, pinctrl_0) -#if defined(CONFIG_SOC_SERIES_NRF54LX) -#define NRF_PSEL_SDP_MSPI(psel) \ - nrf_gpio_pin_control_select(psel, NRF_GPIO_PIN_SEL_VPR); -#elif defined(CONFIG_SOC_SERIES_NRF54HX) -/* On nRF54H, pin routing is controlled by secure domain, via UICR. */ -#define NRF_PSEL_SDP_MSPI(psel) -#endif -#endif /* DT_HAS_COMPAT_STATUS_OKAY(nordic_hpf_mspi_controller) || ... */ - int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, uintptr_t reg) { @@ -477,26 +465,6 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, input = NRF_GPIO_PIN_INPUT_CONNECT; break; #endif /* defined(NRF_PSEL_TWIS) */ -#if defined(NRF_PSEL_SDP_MSPI) - case NRF_FUN_SDP_MSPI_CS0: - case NRF_FUN_SDP_MSPI_CS1: - case NRF_FUN_SDP_MSPI_CS2: - case NRF_FUN_SDP_MSPI_CS3: - case NRF_FUN_SDP_MSPI_CS4: - case NRF_FUN_SDP_MSPI_SCK: - case NRF_FUN_SDP_MSPI_DQ0: - case NRF_FUN_SDP_MSPI_DQ1: - case NRF_FUN_SDP_MSPI_DQ2: - case NRF_FUN_SDP_MSPI_DQ3: - case NRF_FUN_SDP_MSPI_DQ4: - case NRF_FUN_SDP_MSPI_DQ5: - case NRF_FUN_SDP_MSPI_DQ6: - case NRF_FUN_SDP_MSPI_DQ7: - NRF_PSEL_SDP_MSPI(psel); - dir = NRF_GPIO_PIN_DIR_OUTPUT; - input = NRF_GPIO_PIN_INPUT_CONNECT; - break; -#endif /* defined(NRF_PSEL_SDP_MSPI) */ default: return -ENOTSUP; } diff --git a/include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h b/include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h index 088cfce648bb..9de74061e8da 100644 --- a/include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h +++ b/include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h @@ -172,62 +172,6 @@ #define NRF_FUN_GRTC_CLKOUT_FAST 55U /** GRTC slow clock output */ #define NRF_FUN_GRTC_CLKOUT_32K 56U -/** SDP_MSPI clock pin */ -#define NRF_FUN_SDP_MSPI_SCK 57U -/** SDP_MSPI data pin 0 */ -#define NRF_FUN_SDP_MSPI_DQ0 58U -/** SDP_MSPI data pin 1 */ -#define NRF_FUN_SDP_MSPI_DQ1 59U -/** SDP_MSPI data pin 2 */ -#define NRF_FUN_SDP_MSPI_DQ2 60U -/** SDP_MSPI data pin 3 */ -#define NRF_FUN_SDP_MSPI_DQ3 61U -/** SDP_MSPI data pin 4 */ -#define NRF_FUN_SDP_MSPI_DQ4 62U -/** SDP_MSPI data pin 5 */ -#define NRF_FUN_SDP_MSPI_DQ5 63U -/** SDP_MSPI data pin 6 */ -#define NRF_FUN_SDP_MSPI_DQ6 64U -/** SDP_MSPI data pin 7 */ -#define NRF_FUN_SDP_MSPI_DQ7 65U -/** SDP_MSPI chip select 0 */ -#define NRF_FUN_SDP_MSPI_CS0 66U -/** SDP_MSPI chip select 1 */ -#define NRF_FUN_SDP_MSPI_CS1 67U -/** SDP_MSPI chip select 2 */ -#define NRF_FUN_SDP_MSPI_CS2 68U -/** SDP_MSPI chip select 3 */ -#define NRF_FUN_SDP_MSPI_CS3 69U -/** SDP_MSPI chip select 4 */ -#define NRF_FUN_SDP_MSPI_CS4 70U -/** High-Performance Framework MSPI clock pin */ -#define NRF_FUN_HPF_MSPI_SCK NRF_FUN_SDP_MSPI_SCK -/** High-Performance Framework MSPI data pin 0 */ -#define NRF_FUN_HPF_MSPI_DQ0 NRF_FUN_SDP_MSPI_DQ0 -/** High-Performance Framework MSPI data pin 1 */ -#define NRF_FUN_HPF_MSPI_DQ1 NRF_FUN_SDP_MSPI_DQ1 -/** High-Performance Framework MSPI data pin 2 */ -#define NRF_FUN_HPF_MSPI_DQ2 NRF_FUN_SDP_MSPI_DQ2 -/** High-Performance Framework MSPI data pin 3 */ -#define NRF_FUN_HPF_MSPI_DQ3 NRF_FUN_SDP_MSPI_DQ3 -/** High-Performance Framework MSPI data pin 4 */ -#define NRF_FUN_HPF_MSPI_DQ4 NRF_FUN_SDP_MSPI_DQ4 -/** High-Performance Framework MSPI data pin 5 */ -#define NRF_FUN_HPF_MSPI_DQ5 NRF_FUN_SDP_MSPI_DQ5 -/** High-Performance Framework MSPI data pin 6 */ -#define NRF_FUN_HPF_MSPI_DQ6 NRF_FUN_SDP_MSPI_DQ6 -/** High-Performance Framework MSPI data pin 7 */ -#define NRF_FUN_HPF_MSPI_DQ7 NRF_FUN_SDP_MSPI_DQ7 -/** High-Performance Framework MSPI chip select pin 0 */ -#define NRF_FUN_HPF_MSPI_CS0 NRF_FUN_SDP_MSPI_CS0 -/** High-Performance Framework MSPI chip select pin 1 */ -#define NRF_FUN_HPF_MSPI_CS1 NRF_FUN_SDP_MSPI_CS1 -/** High-Performance Framework MSPI chip select pin 2 */ -#define NRF_FUN_HPF_MSPI_CS2 NRF_FUN_SDP_MSPI_CS2 -/** High-Performance Framework MSPI chip select pin 3 */ -#define NRF_FUN_HPF_MSPI_CS3 NRF_FUN_SDP_MSPI_CS3 -/** High-Performance Framework MSPI chip select pin 4 */ -#define NRF_FUN_HPF_MSPI_CS4 NRF_FUN_SDP_MSPI_CS4 /** TDM SCK in master mode */ #define NRF_FUN_TDM_SCK_M 71U /** TDM SCK in slave mode */ From dddd763e0c6cadcac5c95b5bb8a8c7ce93be83f6 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:39 +0300 Subject: [PATCH 1052/2141] Revert "[nrf noup] drivers: spi_dw: Bring back custom EXMIF peripheral handling" This reverts commit e2ee4c0ffea72be2e9385b81594cbad94ac00ae9. Signed-off-by: Jukka Rissanen --- drivers/pinctrl/pinctrl_nrf.c | 3 +- drivers/spi/spi_dw.c | 32 +--------------------- dts/bindings/spi/nordic,nrf-exmif-spi.yaml | 8 ------ 3 files changed, 2 insertions(+), 41 deletions(-) delete mode 100644 dts/bindings/spi/nordic,nrf-exmif-spi.yaml diff --git a/drivers/pinctrl/pinctrl_nrf.c b/drivers/pinctrl/pinctrl_nrf.c index 65a073102607..07941fcb5ad5 100644 --- a/drivers/pinctrl/pinctrl_nrf.c +++ b/drivers/pinctrl/pinctrl_nrf.c @@ -428,8 +428,7 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, input = NRF_GPIO_PIN_INPUT_CONNECT; break; #endif /* DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_can) */ -#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_exmif) || \ - DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_exmif_spi) +#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_exmif) /* Pin routing is controlled by secure domain, via UICR */ case NRF_FUN_EXMIF_CK: case NRF_FUN_EXMIF_DQ0: diff --git a/drivers/spi/spi_dw.c b/drivers/spi/spi_dw.c index 6941bfdaaa77..bd10447e4429 100644 --- a/drivers/spi/spi_dw.c +++ b/drivers/spi/spi_dw.c @@ -41,14 +41,6 @@ LOG_MODULE_REGISTER(spi_dw); #include #endif -#ifdef CONFIG_HAS_NRFX -#include -#endif - -#ifdef CONFIG_SOC_NRF54H20_GPD -#include -#endif - static inline bool spi_dw_is_slave(struct spi_dw_data *spi) { return (IS_ENABLED(CONFIG_SPI_SLAVE) && @@ -266,7 +258,6 @@ static int spi_dw_configure(const struct device *dev, /* Baud rate and Slave select, for master only */ write_baudr(dev, SPI_DW_CLK_DIVIDER(info->clock_frequency, config->frequency)); - write_ser(dev, BIT(config->slave)); } if (spi_dw_is_slave(spi)) { @@ -521,10 +512,6 @@ void spi_dw_isr(const struct device *dev) uint32_t int_status; int error; -#ifdef CONFIG_HAS_NRFX - NRF_EXMIF->EVENTS_CORE = 0; -#endif - int_status = read_isr(dev); LOG_DBG("SPI %p int_status 0x%x - (tx: %d, rx: %d)", dev, int_status, @@ -573,18 +560,6 @@ int spi_dw_init(const struct device *dev) DEVICE_MMIO_MAP(dev, K_MEM_CACHE_NONE); -#ifdef CONFIG_HAS_NRFX - NRF_EXMIF->INTENSET = BIT(0); - NRF_EXMIF->TASKS_START = 1; - -#ifdef CONFIG_SOC_NRF54H20_GPD - err = nrf_gpd_request(NRF_GPD_FAST_ACTIVE1); - if (err < 0) { - return err; - } -#endif -#endif - info->config_func(); /* Masking interrupt and making sure controller is disabled */ @@ -609,11 +584,6 @@ int spi_dw_init(const struct device *dev) return 0; } -#define REG_ADDR(inst) \ - COND_CODE_1(DT_NODE_HAS_COMPAT(DT_DRV_INST(inst), nordic_nrf_exmif_spi), \ - (Z_DEVICE_MMIO_NAMED_ROM_INITIALIZER(core, DT_DRV_INST(inst))), \ - (DEVICE_MMIO_ROM_INIT(DT_DRV_INST(inst)))) - #define SPI_CFG_IRQS_SINGLE_ERR_LINE(inst) \ IRQ_CONNECT(DT_INST_IRQ_BY_NAME(inst, rx_avail, irq), \ DT_INST_IRQ_BY_NAME(inst, rx_avail, priority), \ @@ -686,7 +656,7 @@ COND_CODE_1(IS_EQ(DT_NUM_IRQS(DT_DRV_INST(inst)), 1), \ SPI_CONTEXT_CS_GPIOS_INITIALIZE(DT_DRV_INST(inst), ctx) \ }; \ static const struct spi_dw_config spi_dw_config_##inst = { \ - REG_ADDR(inst), \ + DEVICE_MMIO_ROM_INIT(DT_DRV_INST(inst)), \ .clock_frequency = COND_CODE_1( \ DT_NODE_HAS_PROP(DT_INST_PHANDLE(inst, clocks), clock_frequency), \ (DT_INST_PROP_BY_PHANDLE(inst, clocks, clock_frequency)), \ diff --git a/dts/bindings/spi/nordic,nrf-exmif-spi.yaml b/dts/bindings/spi/nordic,nrf-exmif-spi.yaml deleted file mode 100644 index d988b4146878..000000000000 --- a/dts/bindings/spi/nordic,nrf-exmif-spi.yaml +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -description: Nordic External Memory Interface (EXMIF) used in SPI mode only - -compatible: "nordic,nrf-exmif-spi" - -include: snps,designware-spi.yaml From 06d27a6a5a58d26ddf775041315095eef96c66db Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:39 +0300 Subject: [PATCH 1053/2141] Revert "[nrf noup] entropy: Add fake entropy nRF PRNG driver" This reverts commit e2aa08c6d7cbba17349065d497885731a21715df. Signed-off-by: Jukka Rissanen --- .../nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 6 -- .../nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts | 5 - .../nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts | 6 -- .../nrf9280pdk/nrf9280pdk_nrf9280_cpurad.dts | 5 - drivers/entropy/CMakeLists.txt | 7 -- drivers/entropy/Kconfig | 1 - drivers/entropy/Kconfig.nrf_prng | 19 ---- drivers/entropy/fake_entropy_nrf_prng.c | 101 ------------------ dts/arm/nordic/nrf54l20_enga_cpuapp.dtsi | 9 -- dts/bindings/rng/nordic,nrf-prng.yaml | 8 -- 10 files changed, 167 deletions(-) delete mode 100644 drivers/entropy/Kconfig.nrf_prng delete mode 100644 drivers/entropy/fake_entropy_nrf_prng.c delete mode 100644 dts/bindings/rng/nordic,nrf-prng.yaml diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index 85a2539c3ffe..47255b0c9947 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -27,7 +27,6 @@ zephyr,bt-hci = &bt_hci_ipc0; nordic,802154-spinel-ipc = &ipc0; zephyr,canbus = &can120; - zephyr,entropy = &prng; }; aliases { @@ -108,11 +107,6 @@ pwms = <&pwm130 0 PWM_MSEC(20) PWM_POLARITY_NORMAL>; }; }; - - prng: prng { - compatible = "nordic,entropy-prng"; - status = "okay"; - }; }; &cpuapp_bellboard { diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts index 7e1a1c8e9e04..5473d9a7405a 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts @@ -28,11 +28,6 @@ zephyr,ieee802154 = &cpurad_ieee802154; zephyr,bt-hci-ipc = &ipc0; nordic,802154-spinel-ipc = &ipc0; - zephyr,entropy = &prng; - }; - prng: prng { - compatible = "nordic,entropy-prng"; - status = "okay"; }; aliases { diff --git a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts index 4a99911fa21a..f4cce12f4b1a 100644 --- a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts +++ b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts @@ -27,7 +27,6 @@ zephyr,ieee802154 = &cpuapp_ieee802154; zephyr,bt-hci = &bt_hci_ipc0; nordic,802154-spinel-ipc = &ipc0; - zephyr,entropy = &prng; }; aliases { @@ -109,11 +108,6 @@ pwms = <&pwm130 0 PWM_MSEC(20) PWM_POLARITY_NORMAL>; }; }; - - prng: prng { - compatible = "nordic,entropy-prng"; - status = "okay"; - }; }; &cpuapp_ram0x_region { diff --git a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpurad.dts b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpurad.dts index d6c03bc4a514..5efa7dbd471c 100644 --- a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpurad.dts +++ b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpurad.dts @@ -28,11 +28,6 @@ zephyr,ieee802154 = &cpurad_ieee802154; zephyr,bt-hci-ipc = &ipc0; nordic,802154-spinel-ipc = &ipc0; - zephyr,entropy = &prng; - }; - prng: prng { - compatible = "nordic,entropy-prng"; - status = "okay"; }; aliases { diff --git a/drivers/entropy/CMakeLists.txt b/drivers/entropy/CMakeLists.txt index e038bbfe1b65..eaf858add89b 100644 --- a/drivers/entropy/CMakeLists.txt +++ b/drivers/entropy/CMakeLists.txt @@ -45,11 +45,4 @@ zephyr_library_sources_ifdef(CONFIG_ENTROPY_SY1XX_TRNG entropy_sy1xx_tr zephyr_library_sources_ifdef(CONFIG_ENTROPY_TELINK_B91_TRNG entropy_b91_trng.c) # zephyr-keep-sorted-stop -if (CONFIG_FAKE_ENTROPY_NRF_PRNG) - zephyr_library_sources(fake_entropy_nrf_prng.c) - - message(WARNING "\nA nRF PRNG is used, which does not produce real random bits." - "This is not secure and should therefore never be used in a product.") -endif() - zephyr_library_link_libraries_ifdef(CONFIG_BUILD_WITH_TFM tfm_api) diff --git a/drivers/entropy/Kconfig b/drivers/entropy/Kconfig index c52ac96e6bfc..e0a2080b343b 100644 --- a/drivers/entropy/Kconfig +++ b/drivers/entropy/Kconfig @@ -36,7 +36,6 @@ source "drivers/entropy/Kconfig.neorv32" source "drivers/entropy/Kconfig.npcx" source "drivers/entropy/Kconfig.nrf5" source "drivers/entropy/Kconfig.nrf_cracen" -source "drivers/entropy/Kconfig.nrf_prng" source "drivers/entropy/Kconfig.nxp" source "drivers/entropy/Kconfig.psa_crypto" source "drivers/entropy/Kconfig.renesas_ra" diff --git a/drivers/entropy/Kconfig.nrf_prng b/drivers/entropy/Kconfig.nrf_prng deleted file mode 100644 index e81db4de4b15..000000000000 --- a/drivers/entropy/Kconfig.nrf_prng +++ /dev/null @@ -1,19 +0,0 @@ -# nRF fake entropy prng generator driver configuration - -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -if ENTROPY_GENERATOR - -config FAKE_ENTROPY_NRF_PRNG - bool "A fake nRF entropy driver" - default y - depends on DT_HAS_NORDIC_ENTROPY_PRNG_ENABLED - depends on (SOC_SERIES_NRF54HX || SOC_SERIES_NRF92X || SOC_SERIES_NRF54LX) - select ENTROPY_HAS_DRIVER - help - This is a super simple PRNG driver that can be used on nRF platforms that - do not have an entropy source. - This is NOT SAFE to use for cryptographic operations! - -endif diff --git a/drivers/entropy/fake_entropy_nrf_prng.c b/drivers/entropy/fake_entropy_nrf_prng.c deleted file mode 100644 index 8624c8444057..000000000000 --- a/drivers/entropy/fake_entropy_nrf_prng.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include -#include -#include -#include - -#define DT_DRV_COMPAT nordic_entropy_prng - -/* This file implements a pseudo-RNG - * https://vigna.di.unimi.it/xorshift/xoshiro128plus.c - */ - -static uint32_t s[4]; - -static inline uint32_t rotl(const uint32_t x, int k) -{ - return (x << k) | (x >> (32 - k)); -} - -static uint32_t rng_next(void) -{ - const uint32_t result = rotl(s[0] + s[3], 7) + s[0]; - - const uint32_t t = s[1] << 9; - - s[2] ^= s[0]; - s[3] ^= s[1]; - s[1] ^= s[2]; - s[0] ^= s[3]; - - s[2] ^= t; - - s[3] = rotl(s[3], 11); - - return result; -} - -static int entropy_prng_get_entropy(const struct device *dev, uint8_t *buffer, uint16_t length) -{ - ARG_UNUSED(dev); - - while (length) { - /* - * Note that only 1 thread (Zephyr thread or HW models), runs at - * a time, therefore there is no need to use random_r() - */ - uint32_t value = rng_next(); - - size_t to_copy = MIN(length, sizeof(long)); - - memcpy(buffer, &value, to_copy); - buffer += to_copy; - length -= to_copy; - } - - return 0; -} - -static int entropy_prng_get_entropy_isr(const struct device *dev, uint8_t *buf, uint16_t len, - uint32_t flags) -{ - ARG_UNUSED(flags); - - int err; - - /* - * entropy_prng_get_entropy() is also safe for ISRs - * and always produces data. - */ - err = entropy_prng_get_entropy(dev, buf, len); - if (err < 0) { - return err; - } else { - return len; - } -} - -static int entropy_prng_init(const struct device *dev) -{ - ARG_UNUSED(dev); - - /* Picked some arbitrary initial seed. */ - s[0] = 0xAF568BC0; - s[1] = 0xAC34307E; - s[2] = 0x9B7F6DD1; - s[3] = 0xD84319FC; - return 0; -} - -static const struct entropy_driver_api entropy_prng_api_funcs = { - .get_entropy = entropy_prng_get_entropy, .get_entropy_isr = entropy_prng_get_entropy_isr}; - -DEVICE_DT_INST_DEFINE(0, entropy_prng_init, NULL, NULL, NULL, PRE_KERNEL_1, - CONFIG_ENTROPY_INIT_PRIORITY, &entropy_prng_api_funcs); diff --git a/dts/arm/nordic/nrf54l20_enga_cpuapp.dtsi b/dts/arm/nordic/nrf54l20_enga_cpuapp.dtsi index 5c7e5db30014..2df3fc596767 100644 --- a/dts/arm/nordic/nrf54l20_enga_cpuapp.dtsi +++ b/dts/arm/nordic/nrf54l20_enga_cpuapp.dtsi @@ -16,10 +16,6 @@ nvic: &cpuapp_nvic {}; /delete-node/ &cpuflpr_clic; / { - chosen { - zephyr,entropy = &prng; - }; - soc { compatible = "simple-bus"; interrupt-parent = <&cpuapp_nvic>; @@ -30,11 +26,6 @@ nvic: &cpuapp_nvic {}; compatible = "zephyr,psa-crypto-rng"; status = "disabled"; }; - - prng: prng { - compatible = "nordic,entropy-prng"; - status = "okay"; - }; }; &cpuflpr_vpr { diff --git a/dts/bindings/rng/nordic,nrf-prng.yaml b/dts/bindings/rng/nordic,nrf-prng.yaml deleted file mode 100644 index 8936393a0b65..000000000000 --- a/dts/bindings/rng/nordic,nrf-prng.yaml +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - -description: This is a super simple PRNG - -compatible: "nordic,entropy-prng" - -include: base.yaml From 9a9dacb168eaef54033d51741f21c1b86abeea17 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:39 +0300 Subject: [PATCH 1054/2141] Revert "[nrf noup] samples: bluetooth: hci_ipc: increase main stack size for Cracen driver on nRF54H20" This reverts commit 316cce07af745093d8056a50ff27c88e15f7d9b6. Signed-off-by: Jukka Rissanen --- .../bluetooth/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.conf | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 samples/bluetooth/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.conf diff --git a/samples/bluetooth/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.conf b/samples/bluetooth/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.conf deleted file mode 100644 index 296e68366389..000000000000 --- a/samples/bluetooth/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.conf +++ /dev/null @@ -1,2 +0,0 @@ -# Increase stack size for Cracen driver. -CONFIG_MAIN_STACK_SIZE=1024 From e1584bb13a13ee9a91d84f8cc5b9432f89f9a712 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:39 +0300 Subject: [PATCH 1055/2141] Revert "[nrf noup] samples: bluetooth: mesh: Disable secure storage for real targets." This reverts commit f331133c270974e2a33087c12dab21419fc0b0ba. Signed-off-by: Jukka Rissanen --- samples/bluetooth/mesh/boards/qemu_x86.conf | 6 ------ samples/bluetooth/mesh/prj.conf | 2 +- samples/bluetooth/mesh_demo/boards/qemu_x86.conf | 6 ------ samples/bluetooth/mesh_demo/prj.conf | 2 +- samples/bluetooth/mesh_provisioner/boards/qemu_x86.conf | 6 ------ samples/bluetooth/mesh_provisioner/prj.conf | 2 +- samples/boards/nordic/mesh/onoff-app/prj.conf | 2 +- .../nordic/mesh/onoff_level_lighting_vnd_app/prj.conf | 2 +- tests/bluetooth/mesh_shell/boards/qemu_x86.conf | 6 ------ tests/bluetooth/mesh_shell/prj.conf | 2 +- 10 files changed, 6 insertions(+), 30 deletions(-) delete mode 100644 samples/bluetooth/mesh/boards/qemu_x86.conf delete mode 100644 samples/bluetooth/mesh_demo/boards/qemu_x86.conf delete mode 100644 samples/bluetooth/mesh_provisioner/boards/qemu_x86.conf delete mode 100644 tests/bluetooth/mesh_shell/boards/qemu_x86.conf diff --git a/samples/bluetooth/mesh/boards/qemu_x86.conf b/samples/bluetooth/mesh/boards/qemu_x86.conf deleted file mode 100644 index bfb57193b782..000000000000 --- a/samples/bluetooth/mesh/boards/qemu_x86.conf +++ /dev/null @@ -1,6 +0,0 @@ -# nrf_security only supports Cortex-M via PSA crypto libraries. -# Enforcing usage of built-in Mbed TLS for native simulator. -CONFIG_NRF_SECURITY=n -CONFIG_MBEDTLS_ENABLE_HEAP=n -CONFIG_TRUSTED_STORAGE=n -CONFIG_SECURE_STORAGE=y diff --git a/samples/bluetooth/mesh/prj.conf b/samples/bluetooth/mesh/prj.conf index cd7d6532b614..14b19316a866 100644 --- a/samples/bluetooth/mesh/prj.conf +++ b/samples/bluetooth/mesh/prj.conf @@ -5,7 +5,7 @@ CONFIG_FLASH=y CONFIG_FLASH_MAP=y CONFIG_NVS=y CONFIG_SETTINGS=y -# CONFIG_SECURE_STORAGE=y +CONFIG_SECURE_STORAGE=y CONFIG_HWINFO=y CONFIG_BT=y diff --git a/samples/bluetooth/mesh_demo/boards/qemu_x86.conf b/samples/bluetooth/mesh_demo/boards/qemu_x86.conf deleted file mode 100644 index bfb57193b782..000000000000 --- a/samples/bluetooth/mesh_demo/boards/qemu_x86.conf +++ /dev/null @@ -1,6 +0,0 @@ -# nrf_security only supports Cortex-M via PSA crypto libraries. -# Enforcing usage of built-in Mbed TLS for native simulator. -CONFIG_NRF_SECURITY=n -CONFIG_MBEDTLS_ENABLE_HEAP=n -CONFIG_TRUSTED_STORAGE=n -CONFIG_SECURE_STORAGE=y diff --git a/samples/bluetooth/mesh_demo/prj.conf b/samples/bluetooth/mesh_demo/prj.conf index b7016b02c65b..bcb738ae5bd1 100644 --- a/samples/bluetooth/mesh_demo/prj.conf +++ b/samples/bluetooth/mesh_demo/prj.conf @@ -31,7 +31,7 @@ CONFIG_FLASH_MAP=y CONFIG_NVS=y CONFIG_SETTINGS=y CONFIG_BT_MESH_RPL_STORE_TIMEOUT=600 -# CONFIG_SECURE_STORAGE=y +CONFIG_SECURE_STORAGE=y # Limit the number of key slots in PSA Crypto core to reduce # RAM footprint diff --git a/samples/bluetooth/mesh_provisioner/boards/qemu_x86.conf b/samples/bluetooth/mesh_provisioner/boards/qemu_x86.conf deleted file mode 100644 index bfb57193b782..000000000000 --- a/samples/bluetooth/mesh_provisioner/boards/qemu_x86.conf +++ /dev/null @@ -1,6 +0,0 @@ -# nrf_security only supports Cortex-M via PSA crypto libraries. -# Enforcing usage of built-in Mbed TLS for native simulator. -CONFIG_NRF_SECURITY=n -CONFIG_MBEDTLS_ENABLE_HEAP=n -CONFIG_TRUSTED_STORAGE=n -CONFIG_SECURE_STORAGE=y diff --git a/samples/bluetooth/mesh_provisioner/prj.conf b/samples/bluetooth/mesh_provisioner/prj.conf index 241767805164..10949c5480db 100644 --- a/samples/bluetooth/mesh_provisioner/prj.conf +++ b/samples/bluetooth/mesh_provisioner/prj.conf @@ -45,7 +45,7 @@ CONFIG_FLASH_MAP=y CONFIG_NVS=y CONFIG_SETTINGS=y CONFIG_BT_MESH_RPL_STORE_TIMEOUT=600 -# CONFIG_SECURE_STORAGE=y +CONFIG_SECURE_STORAGE=y #CONFIG_BT_MESH_LOG_LEVEL_DBG=y #CONFIG_BT_MESH_SETTINGS_LOG_LEVEL_DBG=y diff --git a/samples/boards/nordic/mesh/onoff-app/prj.conf b/samples/boards/nordic/mesh/onoff-app/prj.conf index 0783579e795e..0e67042b2653 100644 --- a/samples/boards/nordic/mesh/onoff-app/prj.conf +++ b/samples/boards/nordic/mesh/onoff-app/prj.conf @@ -9,7 +9,7 @@ CONFIG_FLASH=y CONFIG_FLASH_MAP=y CONFIG_NVS=y CONFIG_SETTINGS=y -# CONFIG_SECURE_STORAGE=y +CONFIG_SECURE_STORAGE=y CONFIG_BT_MESH_RPL_STORE_TIMEOUT=600 diff --git a/samples/boards/nordic/mesh/onoff_level_lighting_vnd_app/prj.conf b/samples/boards/nordic/mesh/onoff_level_lighting_vnd_app/prj.conf index 96b5466b4a16..3bb984208c70 100644 --- a/samples/boards/nordic/mesh/onoff_level_lighting_vnd_app/prj.conf +++ b/samples/boards/nordic/mesh/onoff_level_lighting_vnd_app/prj.conf @@ -7,7 +7,7 @@ CONFIG_FLASH=y CONFIG_FLASH_MAP=y CONFIG_NVS=y CONFIG_SETTINGS=y -# CONFIG_SECURE_STORAGE=y +CONFIG_SECURE_STORAGE=y CONFIG_BT_OBSERVER=y CONFIG_BT_BROADCASTER=y diff --git a/tests/bluetooth/mesh_shell/boards/qemu_x86.conf b/tests/bluetooth/mesh_shell/boards/qemu_x86.conf deleted file mode 100644 index bfb57193b782..000000000000 --- a/tests/bluetooth/mesh_shell/boards/qemu_x86.conf +++ /dev/null @@ -1,6 +0,0 @@ -# nrf_security only supports Cortex-M via PSA crypto libraries. -# Enforcing usage of built-in Mbed TLS for native simulator. -CONFIG_NRF_SECURITY=n -CONFIG_MBEDTLS_ENABLE_HEAP=n -CONFIG_TRUSTED_STORAGE=n -CONFIG_SECURE_STORAGE=y diff --git a/tests/bluetooth/mesh_shell/prj.conf b/tests/bluetooth/mesh_shell/prj.conf index aab2745d359f..2af600295680 100644 --- a/tests/bluetooth/mesh_shell/prj.conf +++ b/tests/bluetooth/mesh_shell/prj.conf @@ -14,7 +14,7 @@ CONFIG_FLASH=y CONFIG_FLASH_MAP=y CONFIG_NVS=y CONFIG_SETTINGS=y -# CONFIG_SECURE_STORAGE=y +CONFIG_SECURE_STORAGE=y CONFIG_BT=y CONFIG_BT_OBSERVER=y From 2d9f89bc19d6ae299abb5ff44f944251bf817822 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:39 +0300 Subject: [PATCH 1056/2141] Revert "[nrf noup] modules: hal_nordic: adjust nrfx reservations to NCS" This reverts commit 609c11851694ecaee87cda239066273e2410b8e3. Signed-off-by: Jukka Rissanen --- modules/hal_nordic/nrfx/Kconfig | 2 +- .../nrfx/nrfx_config_reserved_resources_ncs.h | 948 ------------------ 2 files changed, 1 insertion(+), 949 deletions(-) delete mode 100644 modules/hal_nordic/nrfx/nrfx_config_reserved_resources_ncs.h diff --git a/modules/hal_nordic/nrfx/Kconfig b/modules/hal_nordic/nrfx/Kconfig index 5fe8f70377e2..b7f459ea177b 100644 --- a/modules/hal_nordic/nrfx/Kconfig +++ b/modules/hal_nordic/nrfx/Kconfig @@ -1294,6 +1294,6 @@ endmenu config NRFX_RESERVED_RESOURCES_HEADER string - default "nrfx_config_reserved_resources_ncs.h" + default "nrfx_reserved_resources.h" endmenu # "nrfx drivers" diff --git a/modules/hal_nordic/nrfx/nrfx_config_reserved_resources_ncs.h b/modules/hal_nordic/nrfx/nrfx_config_reserved_resources_ncs.h deleted file mode 100644 index ec8a9acaf7b5..000000000000 --- a/modules/hal_nordic/nrfx/nrfx_config_reserved_resources_ncs.h +++ /dev/null @@ -1,948 +0,0 @@ -/* - * Copyright (c) 2024, Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef NRFX_CONFIG_RESERVED_RESOURCES_H__ -#define NRFX_CONFIG_RESERVED_RESOURCES_H__ - -/** @brief Bitmask that defines GPIOTE130 channels reserved for use outside - * of the nrfx library. - */ -#define NRFX_GPIOTE130_CHANNELS_USED \ - (~NRFX_CONFIG_MASK_DT(DT_NODELABEL(gpiote130), owned_channels) | \ - NRFX_CONFIG_MASK_DT(DT_NODELABEL(gpiote130), child_owned_channels)) - -/** @brief Bitmask that defines GPIOTE131 channels reserved for use outside - * of the nrfx library. - */ -#define NRFX_GPIOTE131_CHANNELS_USED \ - (~NRFX_CONFIG_MASK_DT(DT_NODELABEL(gpiote131), owned_channels) | \ - NRFX_CONFIG_MASK_DT(DT_NODELABEL(gpiote131), child_owned_channels)) - -/** @brief Bitmask that defines EGU instances that are reserved for use outside - * of the nrfx library. - */ -#define NRFX_EGUS_USED 0 - -/** @brief Bitmask that defines TIMER instances that are reserved for use outside - * of the nrfx library. - */ -#define NRFX_TIMERS_USED 0 - -/* If the GRTC system timer driver is to be used, prepare definitions required - * by the nrfx_grtc driver (NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK and - * NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS) based on information from devicetree. - */ -#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_grtc) -#define NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK \ - (NRFX_CONFIG_MASK_DT(DT_INST(0, nordic_nrf_grtc), owned_channels) & \ - ~NRFX_CONFIG_MASK_DT(DT_INST(0, nordic_nrf_grtc), child_owned_channels)) -#define NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS \ - (DT_PROP_LEN_OR(DT_INST(0, nordic_nrf_grtc), owned_channels, 0) - \ - DT_PROP_LEN_OR(DT_INST(0, nordic_nrf_grtc), child_owned_channels, 0)) -#endif /* DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_grtc) */ - -/* - * The enabled Bluetooth controller subsystem is responsible for providing - * definitions of the BT_CTLR_USED_* symbols used below in a file named - * bt_ctlr_used_resources.h and for adding its location to global include - * paths so that the file can be included here for all Zephyr libraries that - * are to be built. - */ -#if defined(CONFIG_BT_LL_SW_SPLIT) -#include -#if defined(CONFIG_SOC_SERIES_NRF51X) || defined(CONFIG_SOC_COMPATIBLE_NRF52X) -#define NRFX_PPI_CHANNELS_USED_BY_BT_CTLR BT_CTLR_USED_PPI_CHANNELS -#define NRFX_PPI_GROUPS_USED_BY_BT_CTLR BT_CTLR_USED_PPI_GROUPS -#elif defined(CONFIG_SOC_COMPATIBLE_NRF53X) -#define NRFX_DPPI0_CHANNELS_USED_BY_BT_CTLR BT_CTLR_USED_PPI_CHANNELS -#define NRFX_DPPI0_GROUPS_USED_BY_BT_CTLR BT_CTLR_USED_PPI_GROUPS -#elif defined(CONFIG_SOC_COMPATIBLE_NRF54LX) -#define NRFX_DPPI10_CHANNELS_USED_BY_BT_CTLR BT_CTLR_USED_PPI_CHANNELS -#define NRFX_DPPI10_GROUPS_USED_BY_BT_CTLR BT_CTLR_USED_PPI_GROUPS -#endif -#endif /* defined(CONFIG_BT_LL_SW_SPLIT) */ - -#if defined(CONFIG_BT_LL_SOFTDEVICE) -/* Define auxiliary symbols needed for SDC device dispatch. */ -#if defined(CONFIG_SOC_COMPATIBLE_NRF52X) -#define NRF52_SERIES -#elif defined(CONFIG_SOC_COMPATIBLE_NRF53X) -#define NRF53_SERIES -#elif defined(CONFIG_SOC_COMPATIBLE_NRF54LX) -#define NRF54L_SERIES -#elif defined(CONFIG_SOC_SERIES_NRF71X) -#define NRF71_SERIES -#elif defined(CONFIG_SOC_SERIES_NRF54HX) -#define NRF54H_SERIES -#endif -#include -#if defined(CONFIG_SOC_COMPATIBLE_NRF52X) -#define NRFX_PPI_CHANNELS_USED_BY_BT_CTLR SDC_PPI_CHANNELS_USED_MASK -#elif defined(CONFIG_SOC_COMPATIBLE_NRF53X) -#define NRFX_DPPI0_CHANNELS_USED_BY_BT_CTLR SDC_DPPI_CHANNELS_USED_MASK -#elif defined(CONFIG_SOC_COMPATIBLE_NRF54LX) || defined(CONFIG_SOC_SERIES_NRF71X) -#define NRFX_DPPI10_CHANNELS_USED_BY_BT_CTLR SDC_DPPIC10_CHANNELS_USED_MASK -#define NRFX_DPPI00_CHANNELS_USED_BY_BT_CTLR SDC_DPPIC00_CHANNELS_USED_MASK -#define NRFX_PPIB_00_10_CHANNELS_USED_BY_BT_CTLR \ - (SDC_PPIB00_CHANNELS_USED_MASK | SDC_PPIB10_CHANNELS_USED_MASK) -#elif defined(CONFIG_SOC_SERIES_NRF54HX) -#define NRFX_DPPI020_CHANNELS_USED_BY_BT_CTLR SDC_DPPIC020_CHANNELS_USED_MASK -#define NRFX_DPPI030_CHANNELS_USED_BY_BT_CTLR SDC_DPPIC030_CHANNELS_USED_MASK -#define NRFX_PPIB_020_030_CHANNELS_USED_BY_BT_CTLR \ - (SDC_PPIB020_CHANNELS_USED_MASK | SDC_PPIB030_CHANNELS_USED_MASK) -#else -#error Unsupported chip family -#endif -#endif /* defined(CONFIG_BT_LL_SOFTDEVICE) */ - -#if defined(CONFIG_NRF_802154_RADIO_DRIVER) -#if defined(CONFIG_SOC_COMPATIBLE_NRF52X) -#include <../src/nrf_802154_peripherals_nrf52.h> -#define NRFX_PPI_CHANNELS_USED_BY_802154_DRV NRF_802154_PPI_CHANNELS_USED_MASK -#define NRFX_PPI_GROUPS_USED_BY_802154_DRV NRF_802154_PPI_GROUPS_USED_MASK -#elif defined(CONFIG_SOC_COMPATIBLE_NRF53X) -#include <../src/nrf_802154_peripherals_nrf53.h> -#define NRFX_DPPI0_CHANNELS_USED_BY_802154_DRV NRF_802154_DPPI_CHANNELS_USED_MASK -#define NRFX_DPPI0_GROUPS_USED_BY_802154_DRV NRF_802154_DPPI_GROUPS_USED_MASK -#elif defined(CONFIG_SOC_COMPATIBLE_NRF54LX) -#include <../src/nrf_802154_peripherals_nrf54l.h> -#define NRFX_DPPI10_CHANNELS_USED_BY_802154_DRV NRF_802154_DPPI_CHANNELS_USED_MASK -#define NRFX_DPPI10_GROUPS_USED_BY_802154_DRV NRF_802154_DPPI_GROUPS_USED_MASK -#elif defined(CONFIG_SOC_SERIES_NRF54HX) -#include <../src/nrf_802154_peripherals_nrf54h.h> -#define NRFX_DPPI020_CHANNELS_USED_BY_802154_DRV NRF_802154_DPPI_CHANNELS_USED_MASK -#define NRFX_DPPI020_GROUPS_USED_BY_802154_DRV NRF_802154_DPPI_GROUPS_USED_MASK -#else -#error Unsupported chip family -#endif -#endif /* CONFIG_NRF_802154_RADIO_DRIVER */ - -#if defined(CONFIG_MPSL) -#include -#if defined(CONFIG_SOC_COMPATIBLE_NRF52X) -#define NRFX_PPI_CHANNELS_USED_BY_MPSL MPSL_PPI_CHANNELS_USED_MASK -#elif defined(CONFIG_SOC_COMPATIBLE_NRF53X) -#define NRFX_DPPI0_CHANNELS_USED_BY_MPSL MPSL_DPPIC_CHANNELS_USED_MASK -#elif defined(CONFIG_SOC_COMPATIBLE_NRF54LX) || defined(CONFIG_SOC_SERIES_NRF71X) -#define NRFX_DPPI10_CHANNELS_USED_BY_MPSL MPSL_DPPIC10_CHANNELS_USED_MASK -#define NRFX_DPPI20_CHANNELS_USED_BY_MPSL MPSL_DPPIC20_CHANNELS_USED_MASK -#define NRFX_PPIB_11_21_CHANNELS_USED_BY_MPSL \ - (MPSL_PPIB11_CHANNELS_USED_MASK | MPSL_PPIB21_CHANNELS_USED_MASK) -#elif defined(CONFIG_SOC_SERIES_NRF54HX) -#define NRFX_DPPI020_CHANNELS_USED_BY_MPSL MPSL_DPPIC020_CHANNELS_USED_MASK -#else -#error Unsupported chip family -#endif -#endif - -#ifndef NRFX_DPPI0_CHANNELS_USED_BY_BT_CTLR -#define NRFX_DPPI0_CHANNELS_USED_BY_BT_CTLR 0 -#endif -#ifndef NRFX_DPPI0_GROUPS_USED_BY_BT_CTLR -#define NRFX_DPPI0_GROUPS_USED_BY_BT_CTLR 0 -#endif -#ifndef NRFX_DPPI0_CHANNELS_USED_BY_802154_DRV -#define NRFX_DPPI0_CHANNELS_USED_BY_802154_DRV 0 -#endif -#ifndef NRFX_DPPI0_GROUPS_USED_BY_802154_DRV -#define NRFX_DPPI0_GROUPS_USED_BY_802154_DRV 0 -#endif -#ifndef NRFX_DPPI0_CHANNELS_USED_BY_MPSL -#define NRFX_DPPI0_CHANNELS_USED_BY_MPSL 0 -#endif -#ifndef NRFX_DPPI0_GROUPS_USED_BY_MPSL -#define NRFX_DPPI0_GROUPS_USED_BY_MPSL 0 -#endif - -#ifndef NRFX_DPPI00_CHANNELS_USED_BY_BT_CTLR -#define NRFX_DPPI00_CHANNELS_USED_BY_BT_CTLR 0 -#endif -#ifndef NRFX_DPPI00_GROUPS_USED_BY_BT_CTLR -#define NRFX_DPPI00_GROUPS_USED_BY_BT_CTLR 0 -#endif -#ifndef NRFX_DPPI00_CHANNELS_USED_BY_802154_DRV -#define NRFX_DPPI00_CHANNELS_USED_BY_802154_DRV 0 -#endif -#ifndef NRFX_DPPI00_GROUPS_USED_BY_802154_DRV -#define NRFX_DPPI00_GROUPS_USED_BY_802154_DRV 0 -#endif -#ifndef NRFX_DPPI00_CHANNELS_USED_BY_MPSL -#define NRFX_DPPI00_CHANNELS_USED_BY_MPSL 0 -#endif -#ifndef NRFX_DPPI00_GROUPS_USED_BY_MPSL -#define NRFX_DPPI00_GROUPS_USED_BY_MPSL 0 -#endif - -#ifndef NRFX_DPPI10_CHANNELS_USED_BY_BT_CTLR -#define NRFX_DPPI10_CHANNELS_USED_BY_BT_CTLR 0 -#endif -#ifndef NRFX_DPPI10_GROUPS_USED_BY_BT_CTLR -#define NRFX_DPPI10_GROUPS_USED_BY_BT_CTLR 0 -#endif -#ifndef NRFX_DPPI10_CHANNELS_USED_BY_802154_DRV -#define NRFX_DPPI10_CHANNELS_USED_BY_802154_DRV 0 -#endif -#ifndef NRFX_DPPI10_GROUPS_USED_BY_802154_DRV -#define NRFX_DPPI10_GROUPS_USED_BY_802154_DRV 0 -#endif -#ifndef NRFX_DPPI10_CHANNELS_USED_BY_MPSL -#define NRFX_DPPI10_CHANNELS_USED_BY_MPSL 0 -#endif -#ifndef NRFX_DPPI10_GROUPS_USED_BY_MPSL -#define NRFX_DPPI10_GROUPS_USED_BY_MPSL 0 -#endif - -#ifndef NRFX_DPPI20_CHANNELS_USED_BY_BT_CTLR -#define NRFX_DPPI20_CHANNELS_USED_BY_BT_CTLR 0 -#endif -#ifndef NRFX_DPPI20_GROUPS_USED_BY_BT_CTLR -#define NRFX_DPPI20_GROUPS_USED_BY_BT_CTLR 0 -#endif -#ifndef NRFX_DPPI20_CHANNELS_USED_BY_802154_DRV -#define NRFX_DPPI20_CHANNELS_USED_BY_802154_DRV 0 -#endif -#ifndef NRFX_DPPI20_GROUPS_USED_BY_802154_DRV -#define NRFX_DPPI20_GROUPS_USED_BY_802154_DRV 0 -#endif -#ifndef NRFX_DPPI20_CHANNELS_USED_BY_MPSL -#define NRFX_DPPI20_CHANNELS_USED_BY_MPSL 0 -#endif -#ifndef NRFX_DPPI20_GROUPS_USED_BY_MPSL -#define NRFX_DPPI20_GROUPS_USED_BY_MPSL 0 -#endif - -#ifndef NRFX_DPPI30_CHANNELS_USED_BY_BT_CTLR -#define NRFX_DPPI30_CHANNELS_USED_BY_BT_CTLR 0 -#endif -#ifndef NRFX_DPPI30_GROUPS_USED_BY_BT_CTLR -#define NRFX_DPPI30_GROUPS_USED_BY_BT_CTLR 0 -#endif -#ifndef NRFX_DPPI30_CHANNELS_USED_BY_802154_DRV -#define NRFX_DPPI30_CHANNELS_USED_BY_802154_DRV 0 -#endif -#ifndef NRFX_DPPI30_GROUPS_USED_BY_802154_DRV -#define NRFX_DPPI30_GROUPS_USED_BY_802154_DRV 0 -#endif -#ifndef NRFX_DPPI30_CHANNELS_USED_BY_MPSL -#define NRFX_DPPI30_CHANNELS_USED_BY_MPSL 0 -#endif -#ifndef NRFX_DPPI30_GROUPS_USED_BY_MPSL -#define NRFX_DPPI30_GROUPS_USED_BY_MPSL 0 -#endif - -#ifndef NRFX_DPPI020_CHANNELS_USED_BY_BT_CTLR -#define NRFX_DPPI020_CHANNELS_USED_BY_BT_CTLR 0 -#endif -#ifndef NRFX_DPPI020_GROUPS_USED_BY_BT_CTLR -#define NRFX_DPPI020_GROUPS_USED_BY_BT_CTLR 0 -#endif -#ifndef NRFX_DPPI020_CHANNELS_USED_BY_802154_DRV -#define NRFX_DPPI020_CHANNELS_USED_BY_802154_DRV 0 -#endif -#ifndef NRFX_DPPI020_GROUPS_USED_BY_802154_DRV -#define NRFX_DPPI020_GROUPS_USED_BY_802154_DRV 0 -#endif -#ifndef NRFX_DPPI020_CHANNELS_USED_BY_MPSL -#define NRFX_DPPI020_CHANNELS_USED_BY_MPSL 0 -#endif -#ifndef NRFX_DPPI020_GROUPS_USED_BY_MPSL -#define NRFX_DPPI020_GROUPS_USED_BY_MPSL 0 -#endif - -#ifndef NRFX_DPPI030_CHANNELS_USED_BY_BT_CTLR -#define NRFX_DPPI030_CHANNELS_USED_BY_BT_CTLR 0 -#endif -#ifndef NRFX_DPPI030_GROUPS_USED_BY_BT_CTLR -#define NRFX_DPPI030_GROUPS_USED_BY_BT_CTLR 0 -#endif -#ifndef NRFX_DPPI030_CHANNELS_USED_BY_802154_DRV -#define NRFX_DPPI030_CHANNELS_USED_BY_802154_DRV 0 -#endif -#ifndef NRFX_DPPI030_GROUPS_USED_BY_802154_DRV -#define NRFX_DPPI030_GROUPS_USED_BY_802154_DRV 0 -#endif -#ifndef NRFX_DPPI030_CHANNELS_USED_BY_MPSL -#define NRFX_DPPI030_CHANNELS_USED_BY_MPSL 0 -#endif -#ifndef NRFX_DPPI030_GROUPS_USED_BY_MPSL -#define NRFX_DPPI030_GROUPS_USED_BY_MPSL 0 -#endif - -#ifndef NRFX_DPPI120_CHANNELS_USED_BY_BT_CTLR -#define NRFX_DPPI120_CHANNELS_USED_BY_BT_CTLR 0 -#endif -#ifndef NRFX_DPPI120_GROUPS_USED_BY_BT_CTLR -#define NRFX_DPPI120_GROUPS_USED_BY_BT_CTLR 0 -#endif -#ifndef NRFX_DPPI120_CHANNELS_USED_BY_802154_DRV -#define NRFX_DPPI120_CHANNELS_USED_BY_802154_DRV 0 -#endif -#ifndef NRFX_DPPI120_GROUPS_USED_BY_802154_DRV -#define NRFX_DPPI120_GROUPS_USED_BY_802154_DRV 0 -#endif -#ifndef NRFX_DPPI120_CHANNELS_USED_BY_MPSL -#define NRFX_DPPI120_CHANNELS_USED_BY_MPSL 0 -#endif -#ifndef NRFX_DPPI120_GROUPS_USED_BY_MPSL -#define NRFX_DPPI120_GROUPS_USED_BY_MPSL 0 -#endif - -#ifndef NRFX_DPPI130_CHANNELS_USED_BY_BT_CTLR -#define NRFX_DPPI130_CHANNELS_USED_BY_BT_CTLR 0 -#endif -#ifndef NRFX_DPPI130_GROUPS_USED_BY_BT_CTLR -#define NRFX_DPPI130_GROUPS_USED_BY_BT_CTLR 0 -#endif -#ifndef NRFX_DPPI130_CHANNELS_USED_BY_802154_DRV -#define NRFX_DPPI130_CHANNELS_USED_BY_802154_DRV 0 -#endif -#ifndef NRFX_DPPI130_GROUPS_USED_BY_802154_DRV -#define NRFX_DPPI130_GROUPS_USED_BY_802154_DRV 0 -#endif -#ifndef NRFX_DPPI130_CHANNELS_USED_BY_MPSL -#define NRFX_DPPI130_CHANNELS_USED_BY_MPSL 0 -#endif -#ifndef NRFX_DPPI130_GROUPS_USED_BY_MPSL -#define NRFX_DPPI130_GROUPS_USED_BY_MPSL 0 -#endif - -#ifndef NRFX_DPPI131_CHANNELS_USED_BY_BT_CTLR -#define NRFX_DPPI131_CHANNELS_USED_BY_BT_CTLR 0 -#endif -#ifndef NRFX_DPPI131_GROUPS_USED_BY_BT_CTLR -#define NRFX_DPPI131_GROUPS_USED_BY_BT_CTLR 0 -#endif -#ifndef NRFX_DPPI131_CHANNELS_USED_BY_802154_DRV -#define NRFX_DPPI131_CHANNELS_USED_BY_802154_DRV 0 -#endif -#ifndef NRFX_DPPI131_GROUPS_USED_BY_802154_DRV -#define NRFX_DPPI131_GROUPS_USED_BY_802154_DRV 0 -#endif -#ifndef NRFX_DPPI131_CHANNELS_USED_BY_MPSL -#define NRFX_DPPI131_CHANNELS_USED_BY_MPSL 0 -#endif -#ifndef NRFX_DPPI131_GROUPS_USED_BY_MPSL -#define NRFX_DPPI131_GROUPS_USED_BY_MPSL 0 -#endif - -#ifndef NRFX_DPPI132_CHANNELS_USED_BY_BT_CTLR -#define NRFX_DPPI132_CHANNELS_USED_BY_BT_CTLR 0 -#endif -#ifndef NRFX_DPPI132_GROUPS_USED_BY_BT_CTLR -#define NRFX_DPPI132_GROUPS_USED_BY_BT_CTLR 0 -#endif -#ifndef NRFX_DPPI132_CHANNELS_USED_BY_802154_DRV -#define NRFX_DPPI132_CHANNELS_USED_BY_802154_DRV 0 -#endif -#ifndef NRFX_DPPI132_GROUPS_USED_BY_802154_DRV -#define NRFX_DPPI132_GROUPS_USED_BY_802154_DRV 0 -#endif -#ifndef NRFX_DPPI132_CHANNELS_USED_BY_MPSL -#define NRFX_DPPI132_CHANNELS_USED_BY_MPSL 0 -#endif -#ifndef NRFX_DPPI132_GROUPS_USED_BY_MPSL -#define NRFX_DPPI132_GROUPS_USED_BY_MPSL 0 -#endif - -#ifndef NRFX_DPPI133_CHANNELS_USED_BY_BT_CTLR -#define NRFX_DPPI133_CHANNELS_USED_BY_BT_CTLR 0 -#endif -#ifndef NRFX_DPPI133_GROUPS_USED_BY_BT_CTLR -#define NRFX_DPPI133_GROUPS_USED_BY_BT_CTLR 0 -#endif -#ifndef NRFX_DPPI133_CHANNELS_USED_BY_802154_DRV -#define NRFX_DPPI133_CHANNELS_USED_BY_802154_DRV 0 -#endif -#ifndef NRFX_DPPI133_GROUPS_USED_BY_802154_DRV -#define NRFX_DPPI133_GROUPS_USED_BY_802154_DRV 0 -#endif -#ifndef NRFX_DPPI133_CHANNELS_USED_BY_MPSL -#define NRFX_DPPI133_CHANNELS_USED_BY_MPSL 0 -#endif -#ifndef NRFX_DPPI133_GROUPS_USED_BY_MPSL -#define NRFX_DPPI133_GROUPS_USED_BY_MPSL 0 -#endif - -#ifndef NRFX_DPPI134_CHANNELS_USED_BY_BT_CTLR -#define NRFX_DPPI134_CHANNELS_USED_BY_BT_CTLR 0 -#endif -#ifndef NRFX_DPPI134_GROUPS_USED_BY_BT_CTLR -#define NRFX_DPPI134_GROUPS_USED_BY_BT_CTLR 0 -#endif -#ifndef NRFX_DPPI134_CHANNELS_USED_BY_802154_DRV -#define NRFX_DPPI134_CHANNELS_USED_BY_802154_DRV 0 -#endif -#ifndef NRFX_DPPI134_GROUPS_USED_BY_802154_DRV -#define NRFX_DPPI134_GROUPS_USED_BY_802154_DRV 0 -#endif -#ifndef NRFX_DPPI134_CHANNELS_USED_BY_MPSL -#define NRFX_DPPI134_CHANNELS_USED_BY_MPSL 0 -#endif -#ifndef NRFX_DPPI134_GROUPS_USED_BY_MPSL -#define NRFX_DPPI134_GROUPS_USED_BY_MPSL 0 -#endif - -#ifndef NRFX_DPPI135_CHANNELS_USED_BY_BT_CTLR -#define NRFX_DPPI135_CHANNELS_USED_BY_BT_CTLR 0 -#endif -#ifndef NRFX_DPPI135_GROUPS_USED_BY_BT_CTLR -#define NRFX_DPPI135_GROUPS_USED_BY_BT_CTLR 0 -#endif -#ifndef NRFX_DPPI135_CHANNELS_USED_BY_802154_DRV -#define NRFX_DPPI135_CHANNELS_USED_BY_802154_DRV 0 -#endif -#ifndef NRFX_DPPI135_GROUPS_USED_BY_802154_DRV -#define NRFX_DPPI135_GROUPS_USED_BY_802154_DRV 0 -#endif -#ifndef NRFX_DPPI135_CHANNELS_USED_BY_MPSL -#define NRFX_DPPI135_CHANNELS_USED_BY_MPSL 0 -#endif -#ifndef NRFX_DPPI135_GROUPS_USED_BY_MPSL -#define NRFX_DPPI135_GROUPS_USED_BY_MPSL 0 -#endif - -#ifndef NRFX_DPPI136_CHANNELS_USED_BY_BT_CTLR -#define NRFX_DPPI136_CHANNELS_USED_BY_BT_CTLR 0 -#endif -#ifndef NRFX_DPPI136_GROUPS_USED_BY_BT_CTLR -#define NRFX_DPPI136_GROUPS_USED_BY_BT_CTLR 0 -#endif -#ifndef NRFX_DPPI136_CHANNELS_USED_BY_802154_DRV -#define NRFX_DPPI136_CHANNELS_USED_BY_802154_DRV 0 -#endif -#ifndef NRFX_DPPI136_GROUPS_USED_BY_802154_DRV -#define NRFX_DPPI136_GROUPS_USED_BY_802154_DRV 0 -#endif -#ifndef NRFX_DPPI136_CHANNELS_USED_BY_MPSL -#define NRFX_DPPI136_CHANNELS_USED_BY_MPSL 0 -#endif -#ifndef NRFX_DPPI136_GROUPS_USED_BY_MPSL -#define NRFX_DPPI136_GROUPS_USED_BY_MPSL 0 -#endif - -#ifndef NRFX_PPI_CHANNELS_USED_BY_BT_CTLR -#define NRFX_PPI_CHANNELS_USED_BY_BT_CTLR 0 -#endif -#ifndef NRFX_PPI_GROUPS_USED_BY_BT_CTLR -#define NRFX_PPI_GROUPS_USED_BY_BT_CTLR 0 -#endif - -#ifndef NRFX_PPI_CHANNELS_USED_BY_802154_DRV -#define NRFX_PPI_CHANNELS_USED_BY_802154_DRV 0 -#endif -#ifndef NRFX_PPI_GROUPS_USED_BY_802154_DRV -#define NRFX_PPI_GROUPS_USED_BY_802154_DRV 0 -#endif - -#ifndef NRFX_PPI_CHANNELS_USED_BY_MPSL -#define NRFX_PPI_CHANNELS_USED_BY_MPSL 0 -#endif -#ifndef NRFX_PPI_GROUPS_USED_BY_MPSL -#define NRFX_PPI_GROUPS_USED_BY_MPSL 0 -#endif - -#ifndef NRFX_PPIB_00_10_CHANNELS_USED_BY_BT_CTLR -#define NRFX_PPIB_00_10_CHANNELS_USED_BY_BT_CTLR 0 -#endif -#ifndef NRFX_PPIB_00_10_CHANNELS_USED_BY_802154_DRV -#define NRFX_PPIB_00_10_CHANNELS_USED_BY_802154_DRV 0 -#endif -#ifndef NRFX_PPIB_00_10_CHANNELS_USED_BY_MPSL -#define NRFX_PPIB_00_10_CHANNELS_USED_BY_MPSL 0 -#endif - -#ifndef NRFX_PPIB_01_20_CHANNELS_USED_BY_BT_CTLR -#define NRFX_PPIB_01_20_CHANNELS_USED_BY_BT_CTLR 0 -#endif -#ifndef NRFX_PPIB_01_20_CHANNELS_USED_BY_802154_DRV -#define NRFX_PPIB_01_20_CHANNELS_USED_BY_802154_DRV 0 -#endif -#ifndef NRFX_PPIB_01_20_CHANNELS_USED_BY_MPSL -#define NRFX_PPIB_01_20_CHANNELS_USED_BY_MPSL 0 -#endif - -#ifndef NRFX_PPIB_11_21_CHANNELS_USED_BY_BT_CTLR -#define NRFX_PPIB_11_21_CHANNELS_USED_BY_BT_CTLR 0 -#endif -#ifndef NRFX_PPIB_11_21_CHANNELS_USED_BY_802154_DRV -#define NRFX_PPIB_11_21_CHANNELS_USED_BY_802154_DRV 0 -#endif -#ifndef NRFX_PPIB_11_21_CHANNELS_USED_BY_MPSL -#define NRFX_PPIB_11_21_CHANNELS_USED_BY_MPSL 0 -#endif - -#ifndef NRFX_PPIB_22_30_CHANNELS_USED_BY_BT_CTLR -#define NRFX_PPIB_22_30_CHANNELS_USED_BY_BT_CTLR 0 -#endif -#ifndef NRFX_PPIB_22_30_CHANNELS_USED_BY_802154_DRV -#define NRFX_PPIB_22_30_CHANNELS_USED_BY_802154_DRV 0 -#endif -#ifndef NRFX_PPIB_22_30_CHANNELS_USED_BY_MPSL -#define NRFX_PPIB_22_30_CHANNELS_USED_BY_MPSL 0 -#endif - -#ifndef NRFX_PPIB_02_03_CHANNELS_USED_BY_BT_CTLR -#define NRFX_PPIB_02_03_CHANNELS_USED_BY_BT_CTLR 0 -#endif -#ifndef NRFX_PPIB_02_03_CHANNELS_USED_BY_802154_DRV -#define NRFX_PPIB_02_03_CHANNELS_USED_BY_802154_DRV 0 -#endif -#ifndef NRFX_PPIB_02_03_CHANNELS_USED_BY_MPSL -#define NRFX_PPIB_02_03_CHANNELS_USED_BY_MPSL 0 -#endif - -#ifndef NRFX_PPIB_04_12_CHANNELS_USED_BY_BT_CTLR -#define NRFX_PPIB_04_12_CHANNELS_USED_BY_BT_CTLR 0 -#endif -#ifndef NRFX_PPIB_04_12_CHANNELS_USED_BY_802154_DRV -#define NRFX_PPIB_04_12_CHANNELS_USED_BY_802154_DRV 0 -#endif -#ifndef NRFX_PPIB_04_12_CHANNELS_USED_BY_MPSL -#define NRFX_PPIB_04_12_CHANNELS_USED_BY_MPSL 0 -#endif - -#ifndef NRFX_PPIB_020_030_CHANNELS_USED_BY_BT_CTLR -#define NRFX_PPIB_020_030_CHANNELS_USED_BY_BT_CTLR 0 -#endif -#ifndef NRFX_PPIB_020_030_CHANNELS_USED_BY_802154_DRV -#define NRFX_PPIB_020_030_CHANNELS_USED_BY_802154_DRV 0 -#endif -#ifndef NRFX_PPIB_020_030_CHANNELS_USED_BY_MPSL -#define NRFX_PPIB_020_030_CHANNELS_USED_BY_MPSL 0 -#endif - -#if defined(NRF_802154_VERIFY_PERIPHS_ALLOC_AGAINST_MPSL) - -BUILD_ASSERT((NRFX_DPPI0_CHANNELS_USED_BY_802154_DRV & NRFX_DPPI0_CHANNELS_USED_BY_MPSL) == 0, - "PPI channels used by the IEEE802.15.4 radio driver overlap with those " - "assigned to the MPSL."); - -BUILD_ASSERT((NRFX_DPPI0_GROUPS_USED_BY_802154_DRV & NRFX_DPPI0_GROUPS_USED_BY_MPSL) == 0, - "PPI groups used by the IEEE802.15.4 radio driver overlap with those " - "assigned to the MPSL."); - -BUILD_ASSERT((NRFX_DPPI00_CHANNELS_USED_BY_802154_DRV & NRFX_DPPI00_CHANNELS_USED_BY_MPSL) == 0, - "PPI channels used by the IEEE802.15.4 radio driver overlap with those " - "assigned to the MPSL."); - -BUILD_ASSERT((NRFX_DPPI00_GROUPS_USED_BY_802154_DRV & NRFX_DPPI00_GROUPS_USED_BY_MPSL) == 0, - "PPI groups used by the IEEE802.15.4 radio driver overlap with those " - "assigned to the MPSL."); - -BUILD_ASSERT((NRFX_DPPI10_CHANNELS_USED_BY_802154_DRV & NRFX_DPPI10_CHANNELS_USED_BY_MPSL) == 0, - "PPI channels used by the IEEE802.15.4 radio driver overlap with those " - "assigned to the MPSL."); - -BUILD_ASSERT((NRFX_DPPI10_GROUPS_USED_BY_802154_DRV & NRFX_DPPI10_GROUPS_USED_BY_MPSL) == 0, - "PPI groups used by the IEEE802.15.4 radio driver overlap with those " - "assigned to the MPSL."); - -BUILD_ASSERT((NRFX_DPPI20_CHANNELS_USED_BY_802154_DRV & NRFX_DPPI20_CHANNELS_USED_BY_MPSL) == 0, - "PPI channels used by the IEEE802.15.4 radio driver overlap with those " - "assigned to the MPSL."); - -BUILD_ASSERT((NRFX_DPPI20_GROUPS_USED_BY_802154_DRV & NRFX_DPPI20_GROUPS_USED_BY_MPSL) == 0, - "PPI groups used by the IEEE802.15.4 radio driver overlap with those " - "assigned to the MPSL."); - -BUILD_ASSERT((NRFX_DPPI30_CHANNELS_USED_BY_802154_DRV & NRFX_DPPI30_CHANNELS_USED_BY_MPSL) == 0, - "PPI channels used by the IEEE802.15.4 radio driver overlap with those " - "assigned to the MPSL."); - -BUILD_ASSERT((NRFX_DPPI30_GROUPS_USED_BY_802154_DRV & NRFX_DPPI30_GROUPS_USED_BY_MPSL) == 0, - "PPI groups used by the IEEE802.15.4 radio driver overlap with those " - "assigned to the MPSL."); - -BUILD_ASSERT((NRFX_DPPI020_CHANNELS_USED_BY_802154_DRV & NRFX_DPPI020_CHANNELS_USED_BY_MPSL) == 0, - "PPI channels used by the IEEE802.15.4 radio driver overlap with those " - "assigned to the MPSL."); - -BUILD_ASSERT((NRFX_DPPI020_GROUPS_USED_BY_802154_DRV & NRFX_DPPI020_GROUPS_USED_BY_MPSL) == 0, - "PPI groups used by the IEEE802.15.4 radio driver overlap with those " - "assigned to the MPSL."); - -BUILD_ASSERT((NRFX_DPPI030_CHANNELS_USED_BY_802154_DRV & NRFX_DPPI030_CHANNELS_USED_BY_MPSL) == 0, - "PPI channels used by the IEEE802.15.4 radio driver overlap with those " - "assigned to the MPSL."); - -BUILD_ASSERT((NRFX_DPPI030_GROUPS_USED_BY_802154_DRV & NRFX_DPPI030_GROUPS_USED_BY_MPSL) == 0, - "PPI groups used by the IEEE802.15.4 radio driver overlap with those " - "assigned to the MPSL."); - -BUILD_ASSERT((NRFX_DPPI120_CHANNELS_USED_BY_802154_DRV & NRFX_DPPI120_CHANNELS_USED_BY_MPSL) == 0, - "PPI channels used by the IEEE802.15.4 radio driver overlap with those " - "assigned to the MPSL."); - -BUILD_ASSERT((NRFX_DPPI120_GROUPS_USED_BY_802154_DRV & NRFX_DPPI120_GROUPS_USED_BY_MPSL) == 0, - "PPI groups used by the IEEE802.15.4 radio driver overlap with those " - "assigned to the MPSL."); - -BUILD_ASSERT((NRFX_DPPI130_CHANNELS_USED_BY_802154_DRV & NRFX_DPPI130_CHANNELS_USED_BY_MPSL) == 0, - "PPI channels used by the IEEE802.15.4 radio driver overlap with those " - "assigned to the MPSL."); - -BUILD_ASSERT((NRFX_DPPI130_GROUPS_USED_BY_802154_DRV & NRFX_DPPI130_GROUPS_USED_BY_MPSL) == 0, - "PPI groups used by the IEEE802.15.4 radio driver overlap with those " - "assigned to the MPSL."); - -BUILD_ASSERT((NRFX_DPPI131_CHANNELS_USED_BY_802154_DRV & NRFX_DPPI131_CHANNELS_USED_BY_MPSL) == 0, - "PPI channels used by the IEEE802.15.4 radio driver overlap with those " - "assigned to the MPSL."); - -BUILD_ASSERT((NRFX_DPPI131_GROUPS_USED_BY_802154_DRV & NRFX_DPPI131_GROUPS_USED_BY_MPSL) == 0, - "PPI groups used by the IEEE802.15.4 radio driver overlap with those " - "assigned to the MPSL."); - -BUILD_ASSERT((NRFX_DPPI132_CHANNELS_USED_BY_802154_DRV & NRFX_DPPI132_CHANNELS_USED_BY_MPSL) == 0, - "PPI channels used by the IEEE802.15.4 radio driver overlap with those " - "assigned to the MPSL."); - -BUILD_ASSERT((NRFX_DPPI132_GROUPS_USED_BY_802154_DRV & NRFX_DPPI132_GROUPS_USED_BY_MPSL) == 0, - "PPI groups used by the IEEE802.15.4 radio driver overlap with those " - "assigned to the MPSL."); - -BUILD_ASSERT((NRFX_DPPI133_CHANNELS_USED_BY_802154_DRV & NRFX_DPPI133_CHANNELS_USED_BY_MPSL) == 0, - "PPI channels used by the IEEE802.15.4 radio driver overlap with those " - "assigned to the MPSL."); - -BUILD_ASSERT((NRFX_DPPI133_GROUPS_USED_BY_802154_DRV & NRFX_DPPI133_GROUPS_USED_BY_MPSL) == 0, - "PPI groups used by the IEEE802.15.4 radio driver overlap with those " - "assigned to the MPSL."); - -BUILD_ASSERT((NRFX_DPPI134_CHANNELS_USED_BY_802154_DRV & NRFX_DPPI134_CHANNELS_USED_BY_MPSL) == 0, - "PPI channels used by the IEEE802.15.4 radio driver overlap with those " - "assigned to the MPSL."); - -BUILD_ASSERT((NRFX_DPPI134_GROUPS_USED_BY_802154_DRV & NRFX_DPPI134_GROUPS_USED_BY_MPSL) == 0, - "PPI groups used by the IEEE802.15.4 radio driver overlap with those " - "assigned to the MPSL."); - -BUILD_ASSERT((NRFX_DPPI135_CHANNELS_USED_BY_802154_DRV & NRFX_DPPI135_CHANNELS_USED_BY_MPSL) == 0, - "PPI channels used by the IEEE802.15.4 radio driver overlap with those " - "assigned to the MPSL."); - -BUILD_ASSERT((NRFX_DPPI135_GROUPS_USED_BY_802154_DRV & NRFX_DPPI135_GROUPS_USED_BY_MPSL) == 0, - "PPI groups used by the IEEE802.15.4 radio driver overlap with those " - "assigned to the MPSL."); - -BUILD_ASSERT((NRFX_DPPI136_CHANNELS_USED_BY_802154_DRV & NRFX_DPPI136_CHANNELS_USED_BY_MPSL) == 0, - "PPI channels used by the IEEE802.15.4 radio driver overlap with those " - "assigned to the MPSL."); - -BUILD_ASSERT((NRFX_DPPI136_GROUPS_USED_BY_802154_DRV & NRFX_DPPI136_GROUPS_USED_BY_MPSL) == 0, - "PPI groups used by the IEEE802.15.4 radio driver overlap with those " - "assigned to the MPSL."); - -BUILD_ASSERT((NRFX_PPI_CHANNELS_USED_BY_802154_DRV & NRFX_PPI_CHANNELS_USED_BY_MPSL) == 0, - "PPI channels used by the IEEE802.15.4 radio driver overlap with those " - "assigned to the MPSL."); - -BUILD_ASSERT((NRFX_PPI_GROUPS_USED_BY_802154_DRV & NRFX_PPI_GROUPS_USED_BY_MPSL) == 0, - "PPI groups used by the IEEE802.15.4 radio driver overlap with those " - "assigned to the MPSL."); - -BUILD_ASSERT((NRFX_PPIB_00_10_CHANNELS_USED_BY_802154_DRV & - NRFX_PPIB_00_10_CHANNELS_USED_BY_MPSL) == 0, - "PPI channels used by the IEEE802.15.4 radio driver overlap with those " - "assigned to the MPSL."); - -BUILD_ASSERT((NRFX_PPIB_01_20_CHANNELS_USED_BY_802154_DRV & - NRFX_PPIB_01_20_CHANNELS_USED_BY_MPSL) == 0, - "PPI channels used by the IEEE802.15.4 radio driver overlap with those " - "assigned to the MPSL."); - -BUILD_ASSERT((NRFX_PPIB_11_21_CHANNELS_USED_BY_802154_DRV & - NRFX_PPIB_11_21_CHANNELS_USED_BY_MPSL) == 0, - "PPI channels used by the IEEE802.15.4 radio driver overlap with those " - "assigned to the MPSL."); - -BUILD_ASSERT((NRFX_PPIB_22_30_CHANNELS_USED_BY_802154_DRV & - NRFX_PPIB_22_30_CHANNELS_USED_BY_MPSL) == 0, - "PPI channels used by the IEEE802.15.4 radio driver overlap with those " - "assigned to the MPSL."); - -BUILD_ASSERT((NRFX_PPIB_02_03_CHANNELS_USED_BY_802154_DRV & - NRFX_PPIB_02_03_CHANNELS_USED_BY_MPSL) == 0, - "PPI channels used by the IEEE802.15.4 radio driver overlap with those " - "assigned to the MPSL."); - -BUILD_ASSERT((NRFX_PPIB_04_12_CHANNELS_USED_BY_802154_DRV & - NRFX_PPIB_04_12_CHANNELS_USED_BY_MPSL) == 0, - "PPI channels used by the IEEE802.15.4 radio driver overlap with those " - "assigned to the MPSL."); - -BUILD_ASSERT((NRFX_PPIB_020_030_CHANNELS_USED_BY_802154_DRV & - NRFX_PPIB_020_030_CHANNELS_USED_BY_MPSL) == 0, - "PPI channels used by the IEEE802.15.4 radio driver overlap with those " - "assigned to the MPSL."); - -#endif /* NRF_802154_VERIFY_PERIPHS_ALLOC_AGAINST_MPSL */ - -/** @brief Bitmask that defines DPPI channels that are reserved for use outside - * of the nrfx library. - */ -#define NRFX_DPPI0_CHANNELS_USED \ - (NRFX_DPPI0_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI0_CHANNELS_USED_BY_802154_DRV | \ - NRFX_DPPI0_CHANNELS_USED_BY_MPSL) - -/** @brief Bitmask that defines DPPI groups that are reserved for use outside - * of the nrfx library. - */ -#define NRFX_DPPI0_GROUPS_USED \ - (NRFX_DPPI0_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI0_GROUPS_USED_BY_802154_DRV | \ - NRFX_DPPI0_GROUPS_USED_BY_MPSL) - -/** @brief Bitmask that defines DPPI channels that are reserved for use outside - * of the nrfx library. - */ -#define NRFX_DPPI00_CHANNELS_USED \ - (NRFX_DPPI00_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI00_CHANNELS_USED_BY_802154_DRV | \ - NRFX_DPPI00_CHANNELS_USED_BY_MPSL) - -/** @brief Bitmask that defines DPPI groups that are reserved for use outside - * of the nrfx library. - */ -#define NRFX_DPPI00_GROUPS_USED \ - (NRFX_DPPI00_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI00_GROUPS_USED_BY_802154_DRV | \ - NRFX_DPPI00_GROUPS_USED_BY_MPSL) - -/** @brief Bitmask that defines DPPI channels that are reserved for use outside - * of the nrfx library. - */ -#define NRFX_DPPI10_CHANNELS_USED \ - (NRFX_DPPI10_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI10_CHANNELS_USED_BY_802154_DRV | \ - NRFX_DPPI10_CHANNELS_USED_BY_MPSL) - -/** @brief Bitmask that defines DPPI groups that are reserved for use outside - * of the nrfx library. - */ -#define NRFX_DPPI10_GROUPS_USED \ - (NRFX_DPPI10_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI10_GROUPS_USED_BY_802154_DRV | \ - NRFX_DPPI10_GROUPS_USED_BY_MPSL) - -/** @brief Bitmask that defines DPPI channels that are reserved for use outside - * of the nrfx library. - */ -#define NRFX_DPPI20_CHANNELS_USED \ - (NRFX_DPPI20_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI20_CHANNELS_USED_BY_802154_DRV | \ - NRFX_DPPI20_CHANNELS_USED_BY_MPSL) - -/** @brief Bitmask that defines DPPI groups that are reserved for use outside - * of the nrfx library. - */ -#define NRFX_DPPI20_GROUPS_USED \ - (NRFX_DPPI20_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI20_GROUPS_USED_BY_802154_DRV | \ - NRFX_DPPI20_GROUPS_USED_BY_MPSL) - -/** @brief Bitmask that defines DPPI channels that are reserved for use outside - * of the nrfx library. - */ -#define NRFX_DPPI30_CHANNELS_USED \ - (NRFX_DPPI30_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI30_CHANNELS_USED_BY_802154_DRV | \ - NRFX_DPPI30_CHANNELS_USED_BY_MPSL) - -/** @brief Bitmask that defines DPPI groups that are reserved for use outside - * of the nrfx library. - */ -#define NRFX_DPPI30_GROUPS_USED \ - (NRFX_DPPI30_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI30_GROUPS_USED_BY_802154_DRV | \ - NRFX_DPPI30_GROUPS_USED_BY_MPSL) - -/** @brief Bitmask that defines DPPI channels that are reserved for use outside - * of the nrfx library. - */ -#define NRFX_DPPI020_CHANNELS_USED \ - (NRFX_DPPI020_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI020_CHANNELS_USED_BY_802154_DRV | \ - NRFX_DPPI020_CHANNELS_USED_BY_MPSL) - -/** @brief Bitmask that defines DPPI groups that are reserved for use outside - * of the nrfx library. - */ -#define NRFX_DPPI020_GROUPS_USED \ - (NRFX_DPPI020_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI020_GROUPS_USED_BY_802154_DRV | \ - NRFX_DPPI020_GROUPS_USED_BY_MPSL) - -/** @brief Bitmask that defines DPPI channels that are reserved for use outside - * of the nrfx library. - */ -#define NRFX_DPPI030_CHANNELS_USED \ - (NRFX_DPPI030_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI030_CHANNELS_USED_BY_802154_DRV | \ - NRFX_DPPI030_CHANNELS_USED_BY_MPSL) - -/** @brief Bitmask that defines DPPI groups that are reserved for use outside - * of the nrfx library. - */ -#define NRFX_DPPI030_GROUPS_USED \ - (NRFX_DPPI030_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI030_GROUPS_USED_BY_802154_DRV | \ - NRFX_DPPI030_GROUPS_USED_BY_MPSL) - -/** @brief Bitmask that defines DPPI channels that are reserved for use outside - * of the nrfx library. - */ -#define NRFX_DPPI120_CHANNELS_USED \ - (NRFX_DPPI120_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI120_CHANNELS_USED_BY_802154_DRV | \ - NRFX_DPPI120_CHANNELS_USED_BY_MPSL) - -/** @brief Bitmask that defines DPPI groups that are reserved for use outside - * of the nrfx library. - */ -#define NRFX_DPPI120_GROUPS_USED \ - (NRFX_DPPI120_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI120_GROUPS_USED_BY_802154_DRV | \ - NRFX_DPPI120_GROUPS_USED_BY_MPSL) - -/** @brief Bitmask that defines DPPI channels that are reserved for use outside - * of the nrfx library. - */ -#define NRFX_DPPI130_CHANNELS_USED \ - (NRFX_DPPI130_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI130_CHANNELS_USED_BY_802154_DRV | \ - NRFX_DPPI130_CHANNELS_USED_BY_MPSL) - -/** @brief Bitmask that defines DPPI groups that are reserved for use outside - * of the nrfx library. - */ -#define NRFX_DPPI130_GROUPS_USED \ - (NRFX_DPPI130_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI130_GROUPS_USED_BY_802154_DRV | \ - NRFX_DPPI130_GROUPS_USED_BY_MPSL) - -/** @brief Bitmask that defines DPPI channels that are reserved for use outside - * of the nrfx library. - */ -#define NRFX_DPPI131_CHANNELS_USED \ - (NRFX_DPPI131_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI131_CHANNELS_USED_BY_802154_DRV | \ - NRFX_DPPI131_CHANNELS_USED_BY_MPSL) - -/** @brief Bitmask that defines DPPI groups that are reserved for use outside - * of the nrfx library. - */ -#define NRFX_DPPI131_GROUPS_USED \ - (NRFX_DPPI131_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI131_GROUPS_USED_BY_802154_DRV | \ - NRFX_DPPI131_GROUPS_USED_BY_MPSL) - -/** @brief Bitmask that defines DPPI channels that are reserved for use outside - * of the nrfx library. - */ -#define NRFX_DPPI132_CHANNELS_USED \ - (NRFX_DPPI132_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI132_CHANNELS_USED_BY_802154_DRV | \ - NRFX_DPPI132_CHANNELS_USED_BY_MPSL) - -/** @brief Bitmask that defines DPPI groups that are reserved for use outside - * of the nrfx library. - */ -#define NRFX_DPPI132_GROUPS_USED \ - (NRFX_DPPI132_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI132_GROUPS_USED_BY_802154_DRV | \ - NRFX_DPPI132_GROUPS_USED_BY_MPSL) - -/** @brief Bitmask that defines DPPI channels that are reserved for use outside - * of the nrfx library. - */ -#define NRFX_DPPI133_CHANNELS_USED \ - (NRFX_DPPI133_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI133_CHANNELS_USED_BY_802154_DRV | \ - NRFX_DPPI133_CHANNELS_USED_BY_MPSL) - -/** @brief Bitmask that defines DPPI groups that are reserved for use outside - * of the nrfx library. - */ -#define NRFX_DPPI133_GROUPS_USED \ - (NRFX_DPPI133_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI133_GROUPS_USED_BY_802154_DRV | \ - NRFX_DPPI133_GROUPS_USED_BY_MPSL) - -/** @brief Bitmask that defines DPPI channels that are reserved for use outside - * of the nrfx library. - */ -#define NRFX_DPPI134_CHANNELS_USED \ - (NRFX_DPPI134_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI134_CHANNELS_USED_BY_802154_DRV | \ - NRFX_DPPI134_CHANNELS_USED_BY_MPSL) - -/** @brief Bitmask that defines DPPI groups that are reserved for use outside - * of the nrfx library. - */ -#define NRFX_DPPI134_GROUPS_USED \ - (NRFX_DPPI134_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI134_GROUPS_USED_BY_802154_DRV | \ - NRFX_DPPI134_GROUPS_USED_BY_MPSL) - -/** @brief Bitmask that defines DPPI channels that are reserved for use outside - * of the nrfx library. - */ -#define NRFX_DPPI135_CHANNELS_USED \ - (NRFX_DPPI135_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI135_CHANNELS_USED_BY_802154_DRV | \ - NRFX_DPPI135_CHANNELS_USED_BY_MPSL) - -/** @brief Bitmask that defines DPPI groups that are reserved for use outside - * of the nrfx library. - */ -#define NRFX_DPPI135_GROUPS_USED \ - (NRFX_DPPI135_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI135_GROUPS_USED_BY_802154_DRV | \ - NRFX_DPPI135_GROUPS_USED_BY_MPSL) - -/** @brief Bitmask that defines DPPI channels that are reserved for use outside - * of the nrfx library. - */ -#define NRFX_DPPI136_CHANNELS_USED \ - (NRFX_DPPI136_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI136_CHANNELS_USED_BY_802154_DRV | \ - NRFX_DPPI136_CHANNELS_USED_BY_MPSL) - -/** @brief Bitmask that defines DPPI groups that are reserved for use outside - * of the nrfx library. - */ -#define NRFX_DPPI136_GROUPS_USED \ - (NRFX_DPPI136_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI136_GROUPS_USED_BY_802154_DRV | \ - NRFX_DPPI136_GROUPS_USED_BY_MPSL) - -/** @brief Bitmask that defines PPI channels that are reserved for use outside - * of the nrfx library. - */ -#define NRFX_PPI_CHANNELS_USED \ - (NRFX_PPI_CHANNELS_USED_BY_BT_CTLR | NRFX_PPI_CHANNELS_USED_BY_802154_DRV | \ - NRFX_PPI_CHANNELS_USED_BY_MPSL | NRFX_PPI_CHANNELS_USED_BY_SD) - -#define NRFX_DPPI_CHANNELS_USED NRFX_DPPI0_CHANNELS_USED -#define NRFX_DPPI_GROUPS_USED NRFX_DPPI0_GROUPS_USED - -/** @brief Bitmask that defines PPI groups that are reserved for use outside - * of the nrfx library. - */ -#define NRFX_PPI_GROUPS_USED \ - (NRFX_PPI_GROUPS_USED_BY_BT_CTLR | NRFX_PPI_GROUPS_USED_BY_802154_DRV | \ - NRFX_PPI_GROUPS_USED_BY_MPSL | NRFX_PPI_GROUPS_USED_BY_SD) - -#define NRFX_PPIB_INTERCONNECT_00_10_CHANNELS_USED \ - (NRFX_PPIB_00_10_CHANNELS_USED_BY_BT_CTLR | NRFX_PPIB_00_10_CHANNELS_USED_BY_802154_DRV | \ - NRFX_PPIB_00_10_CHANNELS_USED_BY_MPSL) - -#define NRFX_PPIB_INTERCONNECT_01_20_CHANNELS_USED \ - (NRFX_PPIB_01_20_CHANNELS_USED_BY_BT_CTLR | NRFX_PPIB_01_20_CHANNELS_USED_BY_802154_DRV | \ - NRFX_PPIB_01_20_CHANNELS_USED_BY_MPSL) - -#define NRFX_PPIB_INTERCONNECT_11_21_CHANNELS_USED \ - (NRFX_PPIB_11_21_CHANNELS_USED_BY_BT_CTLR | NRFX_PPIB_11_21_CHANNELS_USED_BY_802154_DRV | \ - NRFX_PPIB_11_21_CHANNELS_USED_BY_MPSL) - -#define NRFX_PPIB_INTERCONNECT_22_30_CHANNELS_USED \ - (NRFX_PPIB_22_30_CHANNELS_USED_BY_BT_CTLR | NRFX_PPIB_22_30_CHANNELS_USED_BY_802154_DRV | \ - NRFX_PPIB_22_30_CHANNELS_USED_BY_MPSL) - -#define NRFX_PPIB_INTERCONNECT_02_03_CHANNELS_USED \ - (NRFX_PPIB_02_03_CHANNELS_USED_BY_BT_CTLR | NRFX_PPIB_02_03_CHANNELS_USED_BY_802154_DRV | \ - NRFX_PPIB_02_03_CHANNELS_USED_BY_MPSL) - -#define NRFX_PPIB_INTERCONNECT_04_12_CHANNELS_USED \ - (NRFX_PPIB_04_12_CHANNELS_USED_BY_BT_CTLR | NRFX_PPIB_04_12_CHANNELS_USED_BY_802154_DRV | \ - NRFX_PPIB_04_12_CHANNELS_USED_BY_MPSL) - -#define NRFX_PPIB_INTERCONNECT_020_030_CHANNELS_USED \ - (NRFX_PPIB_020_030_CHANNELS_USED_BY_BT_CTLR | \ - NRFX_PPIB_020_030_CHANNELS_USED_BY_802154_DRV | NRFX_PPIB_020_030_CHANNELS_USED_BY_MPSL) - -#if defined(CONFIG_SOFTDEVICE) -#include -#define NRFX_PPI_CHANNELS_USED_BY_SD SD_PPI_CHANNELS_USED -#define NRFX_PPI_GROUPS_USED_BY_SD SD_PPI_GROUPS_USED -#else -#define NRFX_PPI_CHANNELS_USED_BY_SD 0 -#define NRFX_PPI_GROUPS_USED_BY_SD 0 -#endif - -#endif /* NRFX_CONFIG_RESERVED_RESOURCES_H__ */ From bfda3952c2dc496bad817361ed81c23c54385518 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:39 +0300 Subject: [PATCH 1057/2141] Revert "[nrf noup] dts: Select SoftDevice Controller on nRF54L09" This reverts commit e40f5313c37dc245a8812643924cdba02afe1252. Signed-off-by: Jukka Rissanen --- boards/nordic/nrf54l09pdk/nrf54l09_cpuapp_common.dtsi | 4 ++-- dts/arm/nordic/nrf54l09_enga_cpuapp.dtsi | 4 ++-- dts/vendor/nordic/nrf54l09.dtsi | 8 +++----- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/boards/nordic/nrf54l09pdk/nrf54l09_cpuapp_common.dtsi b/boards/nordic/nrf54l09pdk/nrf54l09_cpuapp_common.dtsi index e1347c35948c..7d0c880c2de3 100644 --- a/boards/nordic/nrf54l09pdk/nrf54l09_cpuapp_common.dtsi +++ b/boards/nordic/nrf54l09pdk/nrf54l09_cpuapp_common.dtsi @@ -18,7 +18,7 @@ zephyr,bt-c2h-uart = &uart20; zephyr,flash-controller = &rram_controller; zephyr,flash = &cpuapp_rram; - zephyr,bt-hci = &bt_hci_sdc; + zephyr,bt-hci = &bt_hci_controller; zephyr,ieee802154 = &ieee802154; }; }; @@ -119,7 +119,7 @@ status = "okay"; }; -&bt_hci_sdc { +&bt_hci_controller { status = "okay"; }; diff --git a/dts/arm/nordic/nrf54l09_enga_cpuapp.dtsi b/dts/arm/nordic/nrf54l09_enga_cpuapp.dtsi index 6c7f34d3b21e..1dfc5ce133c0 100644 --- a/dts/arm/nordic/nrf54l09_enga_cpuapp.dtsi +++ b/dts/arm/nordic/nrf54l09_enga_cpuapp.dtsi @@ -17,7 +17,7 @@ nvic: &cpuapp_nvic {}; / { chosen { - zephyr,bt-hci = &bt_hci_sdc; + zephyr,bt-hci = &bt_hci_controller; zephyr,entropy = &prng; }; @@ -38,7 +38,7 @@ nvic: &cpuapp_nvic {}; }; }; -&bt_hci_sdc { +&bt_hci_controller { status = "okay"; }; diff --git a/dts/vendor/nordic/nrf54l09.dtsi b/dts/vendor/nordic/nrf54l09.dtsi index 90ecc49b877c..3dc17dabd9ba 100644 --- a/dts/vendor/nordic/nrf54l09.dtsi +++ b/dts/vendor/nordic/nrf54l09.dtsi @@ -221,11 +221,9 @@ status = "disabled"; }; - bt_hci_sdc: bt_hci_sdc { - compatible = "nordic,bt-hci-sdc"; - status = "disabled"; - }; - + /* Note: In the nRF Connect SDK the SoftDevice Controller + * is added and set as the default Bluetooth Controller. + */ bt_hci_controller: bt_hci_controller { compatible = "zephyr,bt-hci-ll-sw-split"; status = "disabled"; From ae694f703cfbc57b0aca331d9afadafe26a1a22e Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:39 +0300 Subject: [PATCH 1058/2141] Revert "[nrf noup] entropy: Add fake entropy nRF PRNG driver" This reverts commit a0d10324b63734e313e07415908fcca08936e5fb. Signed-off-by: Jukka Rissanen --- dts/arm/nordic/nrf54l09_enga_cpuapp.dtsi | 6 ------ 1 file changed, 6 deletions(-) diff --git a/dts/arm/nordic/nrf54l09_enga_cpuapp.dtsi b/dts/arm/nordic/nrf54l09_enga_cpuapp.dtsi index 1dfc5ce133c0..fc359cdb0ac9 100644 --- a/dts/arm/nordic/nrf54l09_enga_cpuapp.dtsi +++ b/dts/arm/nordic/nrf54l09_enga_cpuapp.dtsi @@ -18,7 +18,6 @@ nvic: &cpuapp_nvic {}; / { chosen { zephyr,bt-hci = &bt_hci_controller; - zephyr,entropy = &prng; }; soc { @@ -31,11 +30,6 @@ nvic: &cpuapp_nvic {}; compatible = "zephyr,psa-crypto-rng"; status = "disabled"; }; - - prng: prng { - compatible = "nordic,entropy-prng"; - status = "okay"; - }; }; &bt_hci_controller { From 742ec0ec1a7ab4aa6bfbf68a03a471d3cab6856e Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:39 +0300 Subject: [PATCH 1059/2141] Revert "[nrf noup] ble: Adding missing AES config for BT_CRYPTO" This reverts commit b3b520b40258b238a58133f568353a852ca8eb87. Signed-off-by: Jukka Rissanen --- subsys/bluetooth/crypto/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/subsys/bluetooth/crypto/Kconfig b/subsys/bluetooth/crypto/Kconfig index 0f46a0f59a0f..0856daf9d9a5 100644 --- a/subsys/bluetooth/crypto/Kconfig +++ b/subsys/bluetooth/crypto/Kconfig @@ -8,7 +8,6 @@ config BT_CRYPTO select PSA_WANT_KEY_TYPE_AES select PSA_WANT_ALG_CMAC select PSA_WANT_ALG_ECB_NO_PADDING - imply MBEDTLS_CIPHER_AES_ENABLED if !BUILD_WITH_TFM imply MBEDTLS_AES_ROM_TABLES if MBEDTLS_PSA_CRYPTO_C help This option enables the Bluetooth Cryptographic Toolbox. From 5e4a325982b438406b33bd80fc6e3db8cc5edac1 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:39 +0300 Subject: [PATCH 1060/2141] Revert "[nrf noup] bluetooth: Temporary Kconfig fix for BT RPC configuration" This reverts commit 8797d168475faaa8c96cab970881b8ee35dfa2c1. Signed-off-by: Jukka Rissanen --- drivers/bluetooth/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/bluetooth/Kconfig b/drivers/bluetooth/Kconfig index e64a33f663ce..a1680af6583d 100644 --- a/drivers/bluetooth/Kconfig +++ b/drivers/bluetooth/Kconfig @@ -12,7 +12,7 @@ menuconfig BT_DRIVERS bool "Bluetooth drivers" default y - depends on BT && BT_HCI + depends on BT if BT_DRIVERS From ed72c3f324ecc1051e7e4a5a7402bac9cf9ea9d0 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:39 +0300 Subject: [PATCH 1061/2141] Revert "[nrf noup] tests: arm_irq_vector_table: Disable starting of SSF client" This reverts commit 1449016262127173218fd276fab23c4b97800c7d. Signed-off-by: Jukka Rissanen --- .../arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpuapp.conf | 1 - .../arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpurad.conf | 1 - 2 files changed, 2 deletions(-) diff --git a/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpuapp.conf b/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpuapp.conf index 025c842f70bb..0bcc82e646b1 100644 --- a/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpuapp.conf +++ b/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpuapp.conf @@ -1,2 +1 @@ CONFIG_SOC_NRF54H20_GPD=n -CONFIG_SSF_CLIENT_SYS_INIT=n diff --git a/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpurad.conf b/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpurad.conf index 025c842f70bb..0bcc82e646b1 100644 --- a/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpurad.conf +++ b/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpurad.conf @@ -1,2 +1 @@ CONFIG_SOC_NRF54H20_GPD=n -CONFIG_SSF_CLIENT_SYS_INIT=n From ae4ef37e85ef149fac0822f82586d6b154a6b6d3 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:39 +0300 Subject: [PATCH 1062/2141] Revert "[nrf noup] Revert "mbedtls: auto-select MBEDTLS_CIPHER_AES_ENABLED when built-in in PSA"" This reverts commit a83567fd12f3f2f0e5dc1a4c6ed6d667e7154bb0. Signed-off-by: Jukka Rissanen --- modules/mbedtls/Kconfig.mbedtls | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/mbedtls/Kconfig.mbedtls b/modules/mbedtls/Kconfig.mbedtls index 2d8f260b5d13..7b5122670e5e 100644 --- a/modules/mbedtls/Kconfig.mbedtls +++ b/modules/mbedtls/Kconfig.mbedtls @@ -283,6 +283,7 @@ config MBEDTLS_SOME_CIPHER_ENABLED config MBEDTLS_CIPHER_AES_ENABLED bool "AES block cipher" + default y if PSA_WANT_KEY_TYPE_AES && MBEDTLS_PSA_CRYPTO_C if MBEDTLS_CIPHER_AES_ENABLED From ffe57c4eba22b886a4365d0c5aeca6ef067e8647 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:40 +0300 Subject: [PATCH 1063/2141] Revert "[nrf noup] samples/tests: Add TF-M sysbuild config files" This reverts commit 0d882bd5dfc71bf18fd548404dc30d6674308f09. Signed-off-by: Jukka Rissanen --- samples/subsys/usb/dfu/sysbuild.conf | 1 - tests/drivers/flash/common/sysbuild.conf | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 samples/subsys/usb/dfu/sysbuild.conf create mode 100644 tests/drivers/flash/common/sysbuild.conf diff --git a/samples/subsys/usb/dfu/sysbuild.conf b/samples/subsys/usb/dfu/sysbuild.conf deleted file mode 100644 index 47f00ff3cff8..000000000000 --- a/samples/subsys/usb/dfu/sysbuild.conf +++ /dev/null @@ -1 +0,0 @@ -SB_CONFIG_BOOTLOADER_MCUBOOT=y diff --git a/tests/drivers/flash/common/sysbuild.conf b/tests/drivers/flash/common/sysbuild.conf new file mode 100644 index 000000000000..6408669a8474 --- /dev/null +++ b/tests/drivers/flash/common/sysbuild.conf @@ -0,0 +1 @@ +SB_CONFIG_PARTITION_MANAGER=n From af1b3e80fadc35e2020bc91a3531fb8408a1fe05 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:40 +0300 Subject: [PATCH 1064/2141] Revert "[nrf noup] soc: nrf54l: Add custom section for KMU" This reverts commit e9da911d1d201b953c920a536f1c1c6b0cda5327. Signed-off-by: Jukka Rissanen --- soc/nordic/nrf54l/CMakeLists.txt | 9 --------- soc/nordic/nrf54l/kmu_push_area_section.ld | 19 ------------------- 2 files changed, 28 deletions(-) delete mode 100644 soc/nordic/nrf54l/kmu_push_area_section.ld diff --git a/soc/nordic/nrf54l/CMakeLists.txt b/soc/nordic/nrf54l/CMakeLists.txt index d986fe9c20d5..cebbda571b68 100644 --- a/soc/nordic/nrf54l/CMakeLists.txt +++ b/soc/nordic/nrf54l/CMakeLists.txt @@ -6,12 +6,3 @@ zephyr_library_sources( ../validate_rram_partitions.c ) zephyr_include_directories(.) - -# We need a buffer in memory in a static location which can be used by -# the KMU peripheral. The KMU has a static destination address, we chose -# this address to be 0x20000000, which is the first address in the SRAM. -if(NOT CONFIG_BUILD_WITH_TFM AND CONFIG_PSA_NEED_CRACEN_KMU_DRIVER AND CONFIG_XIP) -# Exclamation mark is printable character with the lowest number in ASCII table. -# We are sure that this file will be included first. -zephyr_linker_sources(RAM_SECTIONS SORT_KEY ! kmu_push_area_section.ld) -endif() diff --git a/soc/nordic/nrf54l/kmu_push_area_section.ld b/soc/nordic/nrf54l/kmu_push_area_section.ld deleted file mode 100644 index e8c8cd9f09ad..000000000000 --- a/soc/nordic/nrf54l/kmu_push_area_section.ld +++ /dev/null @@ -1,19 +0,0 @@ -# This section must be loaded first of all the -# custom sections because we want it to be placed -# at the top address of RAM. -SECTION_PROLOGUE(NRF_KMU_RESERVED_PUSH_SECTION,(NOLOAD) ,) -{ - __nrf_kmu_reserved_push_area = .; - *(.nrf_kmu_reserved_push_area) - __nrf_kmu_reserved_push_area_end = .; -} GROUP_NOLOAD_LINK_IN(RAMABLE_REGION, RAMABLE_REGION) - -# It doesn't seem to be possible to enforce placing a section -# at a specific address in memory using the Zephyr SECTION macros. -# So this assert is necessary to avoid accidentatly moving this -# section to a different address. -ASSERT(__nrf_kmu_reserved_push_area == RAM_ADDR, "Error: \ - The section NRF_KMU_RESERVED_PUSH_SECTION needs to be \ - placed on the top RAM address but it is not, please edit \ - your linker scripts to make sure that it is placed on \ - the to RAM address.") From 559d9632ce032b6e21aede0acb20a0c52627fe38 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:40 +0300 Subject: [PATCH 1065/2141] Revert "[nrf noup] dts: Select SoftDevice Controller DTS binding as default" This reverts commit 6d216e1a427579ef6fba03c6cb0fa90d4d9e1504. Signed-off-by: Jukka Rissanen --- .../nrf54l20pdk/nrf54l20_cpuapp_common.dtsi | 4 +- dts/arm/nordic/nrf52805.dtsi | 11 +- dts/arm/nordic/nrf52810.dtsi | 11 +- dts/arm/nordic/nrf52811.dtsi | 11 +- dts/arm/nordic/nrf52820.dtsi | 11 +- dts/arm/nordic/nrf52832.dtsi | 11 +- dts/arm/nordic/nrf52833.dtsi | 11 +- dts/arm/nordic/nrf52840.dtsi | 11 +- dts/arm/nordic/nrf5340_cpunet.dtsi | 11 +- dts/arm/nordic/nrf54h20_cpurad.dtsi | 4 +- dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi | 4 +- dts/vendor/nordic/nrf54h20.dtsi | 7 +- dts/vendor/nordic/nrf54l20.dtsi | 7 +- dts/vendor/nordic/nrf54l_05_10_15.dtsi | 8 +- .../bluetooth/bap_broadcast_sink/sample.yaml | 4 +- .../bap_broadcast_sink/sysbuild.cmake | 4 - .../bap_broadcast_source/sample.yaml | 4 +- .../bap_broadcast_source/sysbuild.cmake | 4 - .../bluetooth/bap_unicast_client/sample.yaml | 4 +- .../bap_unicast_client/sysbuild.cmake | 4 - .../bluetooth/bap_unicast_server/sample.yaml | 4 +- .../bap_unicast_server/sysbuild.cmake | 4 - samples/bluetooth/beacon/sample.yaml | 4 +- samples/bluetooth/cap_acceptor/sample.yaml | 4 +- samples/bluetooth/cap_acceptor/sysbuild.cmake | 4 - samples/bluetooth/cap_initiator/sample.yaml | 4 +- .../bluetooth/cap_initiator/sysbuild.cmake | 4 - .../direction_finding_central/sample.yaml | 15 +-- .../sample.yaml | 14 +-- .../sample.yaml | 14 +-- .../direction_finding_peripheral/sample.yaml | 15 +-- samples/bluetooth/hci_ipc/sample.yaml | 34 ++---- samples/bluetooth/hci_uart/sample.yaml | 18 +--- samples/bluetooth/hci_vs_scan_req/sample.yaml | 2 - samples/bluetooth/iso_central/sample.yaml | 6 +- .../pbp_public_broadcast_sink/sample.yaml | 4 +- .../pbp_public_broadcast_sink/sysbuild.cmake | 4 - .../pbp_public_broadcast_source/sample.yaml | 4 +- .../sysbuild.cmake | 4 - .../bt-ll-sw-split/bt-ll-sw-split.overlay | 4 - .../controller/ll_sw/nordic/lll/lll.c | 2 +- .../controller/ctrl_api/testcase.yaml | 2 - .../controller/ctrl_chmu/testcase.yaml | 2 - .../controller/ctrl_cis_create/testcase.yaml | 2 - .../ctrl_cis_terminate/testcase.yaml | 2 - .../controller/ctrl_collision/testcase.yaml | 2 - .../controller/ctrl_conn_update/testcase.yaml | 11 +- .../controller/ctrl_cte_req/testcase.yaml | 2 - .../ctrl_data_length_update/testcase.yaml | 10 +- .../controller/ctrl_encrypt/testcase.yaml | 2 - .../ctrl_feature_exchange/testcase.yaml | 2 - .../controller/ctrl_hci/testcase.yaml | 2 - .../controller/ctrl_invalid/testcase.yaml | 2 - .../controller/ctrl_le_ping/testcase.yaml | 2 - .../ctrl_min_used_chans/testcase.yaml | 2 - .../controller/ctrl_phy_update/testcase.yaml | 6 +- .../controller/ctrl_sca_update/testcase.yaml | 2 - .../controller/ctrl_sw_privacy/testcase.yaml | 2 - .../controller/ctrl_terminate/testcase.yaml | 2 - .../ctrl_tx_buffer_alloc/testcase.yaml | 22 +--- .../controller/ctrl_tx_queue/testcase.yaml | 2 - .../controller/ctrl_unsupported/testcase.yaml | 6 +- .../controller/ctrl_user_ext/testcase.yaml | 2 - .../controller/ctrl_version/testcase.yaml | 2 - .../df/connection_cte_req/testcase.yaml | 2 - .../df/connection_cte_tx_params/testcase.yaml | 2 - .../connectionless_cte_chains/testcase.yaml | 2 - .../df/connectionless_cte_rx/testcase.yaml | 2 - .../df/connectionless_cte_tx/testcase.yaml | 2 - tests/bluetooth/init/testcase.yaml | 101 +++++------------- 70 files changed, 127 insertions(+), 389 deletions(-) diff --git a/boards/nordic/nrf54l20pdk/nrf54l20_cpuapp_common.dtsi b/boards/nordic/nrf54l20pdk/nrf54l20_cpuapp_common.dtsi index f719b2d93920..614ffbca4de3 100644 --- a/boards/nordic/nrf54l20pdk/nrf54l20_cpuapp_common.dtsi +++ b/boards/nordic/nrf54l20pdk/nrf54l20_cpuapp_common.dtsi @@ -18,7 +18,7 @@ zephyr,bt-c2h-uart = &uart20; zephyr,flash-controller = &rram_controller; zephyr,flash = &cpuapp_rram; - zephyr,bt-hci = &bt_hci_sdc; + zephyr,bt-hci = &bt_hci_controller; zephyr,ieee802154 = &ieee802154; }; }; @@ -122,7 +122,7 @@ status = "okay"; }; -&bt_hci_sdc { +&bt_hci_controller { status = "okay"; }; diff --git a/dts/arm/nordic/nrf52805.dtsi b/dts/arm/nordic/nrf52805.dtsi index 2134605c9f86..45a54f97b061 100644 --- a/dts/arm/nordic/nrf52805.dtsi +++ b/dts/arm/nordic/nrf52805.dtsi @@ -11,7 +11,7 @@ / { chosen { - zephyr,bt-hci = &bt_hci_sdc; + zephyr,bt-hci = &bt_hci_controller; zephyr,entropy = &rng; zephyr,flash-controller = &flash_controller; }; @@ -106,13 +106,12 @@ status = "okay"; ble-2mbps-supported; - bt_hci_sdc: bt_hci_sdc { - compatible = "nordic,bt-hci-sdc"; - status = "okay"; - }; + /* Note: In the nRF Connect SDK the SoftDevice Controller + * is added and set as the default Bluetooth Controller. + */ bt_hci_controller: bt_hci_controller { compatible = "zephyr,bt-hci-ll-sw-split"; - status = "disabled"; + status = "okay"; }; }; diff --git a/dts/arm/nordic/nrf52810.dtsi b/dts/arm/nordic/nrf52810.dtsi index 6e09220e78bb..217758dd1614 100644 --- a/dts/arm/nordic/nrf52810.dtsi +++ b/dts/arm/nordic/nrf52810.dtsi @@ -7,7 +7,7 @@ / { chosen { - zephyr,bt-hci = &bt_hci_sdc; + zephyr,bt-hci = &bt_hci_controller; zephyr,entropy = &rng; zephyr,flash-controller = &flash_controller; }; @@ -110,13 +110,12 @@ status = "okay"; ble-2mbps-supported; - bt_hci_sdc: bt_hci_sdc { - compatible = "nordic,bt-hci-sdc"; - status = "okay"; - }; + /* Note: In the nRF Connect SDK the SoftDevice Controller + * is added and set as the default Bluetooth Controller. + */ bt_hci_controller: bt_hci_controller { compatible = "zephyr,bt-hci-ll-sw-split"; - status = "disabled"; + status = "okay"; }; }; diff --git a/dts/arm/nordic/nrf52811.dtsi b/dts/arm/nordic/nrf52811.dtsi index 12d0a0ea4d6f..670f569c0ace 100644 --- a/dts/arm/nordic/nrf52811.dtsi +++ b/dts/arm/nordic/nrf52811.dtsi @@ -11,7 +11,7 @@ / { chosen { - zephyr,bt-hci = &bt_hci_sdc; + zephyr,bt-hci = &bt_hci_controller; zephyr,entropy = &rng; zephyr,flash-controller = &flash_controller; }; @@ -122,13 +122,12 @@ status = "disabled"; }; - bt_hci_sdc: bt_hci_sdc { - compatible = "nordic,bt-hci-sdc"; - status = "okay"; - }; + /* Note: In the nRF Connect SDK the SoftDevice Controller + * is added and set as the default Bluetooth Controller. + */ bt_hci_controller: bt_hci_controller { compatible = "zephyr,bt-hci-ll-sw-split"; - status = "disabled"; + status = "okay"; }; }; diff --git a/dts/arm/nordic/nrf52820.dtsi b/dts/arm/nordic/nrf52820.dtsi index d15fbb2ae4e3..50c8d2ba07f0 100644 --- a/dts/arm/nordic/nrf52820.dtsi +++ b/dts/arm/nordic/nrf52820.dtsi @@ -11,7 +11,7 @@ / { chosen { - zephyr,bt-hci = &bt_hci_sdc; + zephyr,bt-hci = &bt_hci_controller; zephyr,entropy = &rng; zephyr,flash-controller = &flash_controller; }; @@ -124,13 +124,12 @@ status = "disabled"; }; - bt_hci_sdc: bt_hci_sdc { - compatible = "nordic,bt-hci-sdc"; - status = "okay"; - }; + /* Note: In the nRF Connect SDK another Bluetooth controller + * is added and set as the default. + */ bt_hci_controller: bt_hci_controller { compatible = "zephyr,bt-hci-ll-sw-split"; - status = "disabled"; + status = "okay"; }; }; diff --git a/dts/arm/nordic/nrf52832.dtsi b/dts/arm/nordic/nrf52832.dtsi index eef2297c43b1..7bd62c707545 100644 --- a/dts/arm/nordic/nrf52832.dtsi +++ b/dts/arm/nordic/nrf52832.dtsi @@ -7,7 +7,7 @@ / { chosen { - zephyr,bt-hci = &bt_hci_sdc; + zephyr,bt-hci = &bt_hci_controller; zephyr,entropy = &rng; zephyr,flash-controller = &flash_controller; }; @@ -110,13 +110,12 @@ status = "okay"; ble-2mbps-supported; - bt_hci_sdc: bt_hci_sdc { - compatible = "nordic,bt-hci-sdc"; - status = "okay"; - }; + /* Note: In the nRF Connect SDK the SoftDevice Controller + * is added and set as the default Bluetooth Controller. + */ bt_hci_controller: bt_hci_controller { compatible = "zephyr,bt-hci-ll-sw-split"; - status = "disabled"; + status = "okay"; }; }; diff --git a/dts/arm/nordic/nrf52833.dtsi b/dts/arm/nordic/nrf52833.dtsi index 1b3620aa01cb..8202ddc45431 100644 --- a/dts/arm/nordic/nrf52833.dtsi +++ b/dts/arm/nordic/nrf52833.dtsi @@ -11,7 +11,7 @@ / { chosen { - zephyr,bt-hci = &bt_hci_sdc; + zephyr,bt-hci = &bt_hci_controller; zephyr,entropy = &rng; zephyr,flash-controller = &flash_controller; }; @@ -124,13 +124,12 @@ status = "disabled"; }; - bt_hci_sdc: bt_hci_sdc { - compatible = "nordic,bt-hci-sdc"; - status = "okay"; - }; + /* Note: In the nRF Connect SDK the SoftDevice Controller + * is added and set as the default Bluetooth Controller. + */ bt_hci_controller: bt_hci_controller { compatible = "zephyr,bt-hci-ll-sw-split"; - status = "disabled"; + status = "okay"; }; }; diff --git a/dts/arm/nordic/nrf52840.dtsi b/dts/arm/nordic/nrf52840.dtsi index f19383ba7e75..bcbfd926c9bb 100644 --- a/dts/arm/nordic/nrf52840.dtsi +++ b/dts/arm/nordic/nrf52840.dtsi @@ -7,7 +7,7 @@ / { chosen { - zephyr,bt-hci = &bt_hci_sdc; + zephyr,bt-hci = &bt_hci_controller; zephyr,entropy = &cryptocell; zephyr,flash-controller = &flash_controller; }; @@ -112,13 +112,12 @@ status = "disabled"; }; - bt_hci_sdc: bt_hci_sdc { - compatible = "nordic,bt-hci-sdc"; - status = "okay"; - }; + /* Note: In the nRF Connect SDK the SoftDevice Controller + * is added and set as the default Bluetooth Controller. + */ bt_hci_controller: bt_hci_controller { compatible = "zephyr,bt-hci-ll-sw-split"; - status = "disabled"; + status = "okay"; }; }; diff --git a/dts/arm/nordic/nrf5340_cpunet.dtsi b/dts/arm/nordic/nrf5340_cpunet.dtsi index be0fad16d66b..4f9164767f1a 100644 --- a/dts/arm/nordic/nrf5340_cpunet.dtsi +++ b/dts/arm/nordic/nrf5340_cpunet.dtsi @@ -9,7 +9,7 @@ / { chosen { - zephyr,bt-hci = &bt_hci_sdc; + zephyr,bt-hci = &bt_hci_controller; zephyr,entropy = &rng; zephyr,flash-controller = &flash_controller; }; @@ -102,13 +102,12 @@ status = "disabled"; }; - bt_hci_sdc: bt_hci_sdc { - compatible = "nordic,bt-hci-sdc"; - status = "okay"; - }; + /* Note: In the nRF Connect SDK the SoftDevice Controller + * is added and set as the default Bluetooth Controller. + */ bt_hci_controller: bt_hci_controller { compatible = "zephyr,bt-hci-ll-sw-split"; - status = "disabled"; + status = "okay"; }; }; diff --git a/dts/arm/nordic/nrf54h20_cpurad.dtsi b/dts/arm/nordic/nrf54h20_cpurad.dtsi index e8ff2dac3a4a..2cfda47afc55 100644 --- a/dts/arm/nordic/nrf54h20_cpurad.dtsi +++ b/dts/arm/nordic/nrf54h20_cpurad.dtsi @@ -24,7 +24,7 @@ wdt011: &cpurad_wdt011 {}; / { chosen { - zephyr,bt-hci = &bt_hci_sdc; + zephyr,bt-hci = &bt_hci_controller; }; soc { @@ -104,6 +104,6 @@ wdt011: &cpurad_wdt011 {}; status = "okay"; }; -&bt_hci_sdc { +&bt_hci_controller { status = "okay"; }; diff --git a/dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi b/dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi index 80875058f5fd..8b0339eda399 100644 --- a/dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi +++ b/dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi @@ -15,7 +15,7 @@ nvic: &cpuapp_nvic {}; / { chosen { - zephyr,bt-hci = &bt_hci_sdc; + zephyr,bt-hci = &bt_hci_controller; zephyr,entropy = &psa_rng; }; @@ -36,7 +36,7 @@ nvic: &cpuapp_nvic {}; }; }; -&bt_hci_sdc { +&bt_hci_controller { status = "okay"; }; diff --git a/dts/vendor/nordic/nrf54h20.dtsi b/dts/vendor/nordic/nrf54h20.dtsi index 68884b8a5672..8dcd8700b274 100644 --- a/dts/vendor/nordic/nrf54h20.dtsi +++ b/dts/vendor/nordic/nrf54h20.dtsi @@ -450,10 +450,9 @@ status = "disabled"; }; - bt_hci_sdc: bt_hci_sdc { - compatible = "nordic,bt-hci-sdc"; - status = "disabled"; - }; + /* Note: In the nRF Connect SDK the SoftDevice Controller + * is added and set as the default Bluetooth Controller. + */ bt_hci_controller: bt_hci_controller { compatible = "zephyr,bt-hci-ll-sw-split"; status = "disabled"; diff --git a/dts/vendor/nordic/nrf54l20.dtsi b/dts/vendor/nordic/nrf54l20.dtsi index bee70effa0e8..de63a005c1de 100644 --- a/dts/vendor/nordic/nrf54l20.dtsi +++ b/dts/vendor/nordic/nrf54l20.dtsi @@ -261,10 +261,9 @@ status = "disabled"; }; - bt_hci_sdc: bt_hci_sdc { - compatible = "nordic,bt-hci-sdc"; - status = "disabled"; - }; + /* Note: In the nRF Connect SDK the SoftDevice Controller + * is added and set as the default Bluetooth Controller. + */ bt_hci_controller: bt_hci_controller { compatible = "zephyr,bt-hci-ll-sw-split"; status = "disabled"; diff --git a/dts/vendor/nordic/nrf54l_05_10_15.dtsi b/dts/vendor/nordic/nrf54l_05_10_15.dtsi index 95c273750387..aa259713d2fd 100644 --- a/dts/vendor/nordic/nrf54l_05_10_15.dtsi +++ b/dts/vendor/nordic/nrf54l_05_10_15.dtsi @@ -250,11 +250,9 @@ status = "disabled"; }; - bt_hci_sdc: bt_hci_sdc { - compatible = "nordic,bt-hci-sdc"; - status = "disabled"; - }; - + /* Note: In the nRF Connect SDK the SoftDevice Controller + * is added and set as the default Bluetooth Controller. + */ bt_hci_controller: bt_hci_controller { compatible = "zephyr,bt-hci-ll-sw-split"; status = "disabled"; diff --git a/samples/bluetooth/bap_broadcast_sink/sample.yaml b/samples/bluetooth/bap_broadcast_sink/sample.yaml index 148b8b641697..5d06dee0bf89 100644 --- a/samples/bluetooth/bap_broadcast_sink/sample.yaml +++ b/samples/bluetooth/bap_broadcast_sink/sample.yaml @@ -24,7 +24,5 @@ tests: - nrf52_bsim - nrf52833dk/nrf52833 - nrf52840dongle/nrf52840 - extra_args: - - EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf - - SNIPPET="bt-ll-sw-split" + extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf tags: bluetooth diff --git a/samples/bluetooth/bap_broadcast_sink/sysbuild.cmake b/samples/bluetooth/bap_broadcast_sink/sysbuild.cmake index d5d260789ff7..2523aac8ea76 100644 --- a/samples/bluetooth/bap_broadcast_sink/sysbuild.cmake +++ b/samples/bluetooth/bap_broadcast_sink/sysbuild.cmake @@ -18,10 +18,6 @@ if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) CACHE INTERNAL "" ) - list(APPEND ${NET_APP}_SNIPPET ${SNIPPET}) - list(APPEND ${NET_APP}_SNIPPET bt-ll-sw-split) - set(${NET_APP}_SNIPPET ${${NET_APP}_SNIPPET} CACHE STRING "" FORCE) - native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) endif() diff --git a/samples/bluetooth/bap_broadcast_source/sample.yaml b/samples/bluetooth/bap_broadcast_source/sample.yaml index 5f745cd08950..5e5b01d942d0 100644 --- a/samples/bluetooth/bap_broadcast_source/sample.yaml +++ b/samples/bluetooth/bap_broadcast_source/sample.yaml @@ -36,7 +36,5 @@ tests: - nrf52_bsim - nrf52833dk/nrf52833 - nrf52840dongle/nrf52840 - extra_args: - - EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf - - SNIPPET="bt-ll-sw-split" + extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf tags: bluetooth diff --git a/samples/bluetooth/bap_broadcast_source/sysbuild.cmake b/samples/bluetooth/bap_broadcast_source/sysbuild.cmake index d5d260789ff7..2523aac8ea76 100644 --- a/samples/bluetooth/bap_broadcast_source/sysbuild.cmake +++ b/samples/bluetooth/bap_broadcast_source/sysbuild.cmake @@ -18,10 +18,6 @@ if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) CACHE INTERNAL "" ) - list(APPEND ${NET_APP}_SNIPPET ${SNIPPET}) - list(APPEND ${NET_APP}_SNIPPET bt-ll-sw-split) - set(${NET_APP}_SNIPPET ${${NET_APP}_SNIPPET} CACHE STRING "" FORCE) - native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) endif() diff --git a/samples/bluetooth/bap_unicast_client/sample.yaml b/samples/bluetooth/bap_unicast_client/sample.yaml index 44f32934ce99..7283090b8781 100644 --- a/samples/bluetooth/bap_unicast_client/sample.yaml +++ b/samples/bluetooth/bap_unicast_client/sample.yaml @@ -22,7 +22,5 @@ tests: - nrf52840dk/nrf52840 integration_platforms: - nrf52dk/nrf52832 - extra_args: - - EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf - - SNIPPET="bt-ll-sw-split" + extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf tags: bluetooth diff --git a/samples/bluetooth/bap_unicast_client/sysbuild.cmake b/samples/bluetooth/bap_unicast_client/sysbuild.cmake index d5d260789ff7..2523aac8ea76 100644 --- a/samples/bluetooth/bap_unicast_client/sysbuild.cmake +++ b/samples/bluetooth/bap_unicast_client/sysbuild.cmake @@ -18,10 +18,6 @@ if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) CACHE INTERNAL "" ) - list(APPEND ${NET_APP}_SNIPPET ${SNIPPET}) - list(APPEND ${NET_APP}_SNIPPET bt-ll-sw-split) - set(${NET_APP}_SNIPPET ${${NET_APP}_SNIPPET} CACHE STRING "" FORCE) - native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) endif() diff --git a/samples/bluetooth/bap_unicast_server/sample.yaml b/samples/bluetooth/bap_unicast_server/sample.yaml index 266ced73f66d..068f752b626b 100644 --- a/samples/bluetooth/bap_unicast_server/sample.yaml +++ b/samples/bluetooth/bap_unicast_server/sample.yaml @@ -22,7 +22,5 @@ tests: - nrf52840dk/nrf52840 integration_platforms: - nrf52dk/nrf52832 - extra_args: - - EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf - - SNIPPET="bt-ll-sw-split" + extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf tags: bluetooth diff --git a/samples/bluetooth/bap_unicast_server/sysbuild.cmake b/samples/bluetooth/bap_unicast_server/sysbuild.cmake index d5d260789ff7..2523aac8ea76 100644 --- a/samples/bluetooth/bap_unicast_server/sysbuild.cmake +++ b/samples/bluetooth/bap_unicast_server/sysbuild.cmake @@ -18,10 +18,6 @@ if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) CACHE INTERNAL "" ) - list(APPEND ${NET_APP}_SNIPPET ${SNIPPET}) - list(APPEND ${NET_APP}_SNIPPET bt-ll-sw-split) - set(${NET_APP}_SNIPPET ${${NET_APP}_SNIPPET} CACHE STRING "" FORCE) - native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) endif() diff --git a/samples/bluetooth/beacon/sample.yaml b/samples/bluetooth/beacon/sample.yaml index 819ac3d30024..f6f08790092f 100644 --- a/samples/bluetooth/beacon/sample.yaml +++ b/samples/bluetooth/beacon/sample.yaml @@ -18,9 +18,7 @@ tests: - nrf54l15dk/nrf54l15/cpuapp - ophelia4ev/nrf54l15/cpuapp sample.bluetooth.beacon-coex: - extra_args: - - CONF_FILE="prj-coex.conf" - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE="prj-coex.conf" harness: bluetooth platform_allow: - nrf52840dk/nrf52840 diff --git a/samples/bluetooth/cap_acceptor/sample.yaml b/samples/bluetooth/cap_acceptor/sample.yaml index 9061f44679fb..824e744eecaf 100644 --- a/samples/bluetooth/cap_acceptor/sample.yaml +++ b/samples/bluetooth/cap_acceptor/sample.yaml @@ -26,7 +26,5 @@ tests: - nrf52833dk/nrf52833 - nrf52840dk/nrf52840 - nrf52840dongle/nrf52840 - extra_args: - - EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf - - SNIPPET="bt-ll-sw-split" + extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf tags: bluetooth diff --git a/samples/bluetooth/cap_acceptor/sysbuild.cmake b/samples/bluetooth/cap_acceptor/sysbuild.cmake index d5d260789ff7..2523aac8ea76 100644 --- a/samples/bluetooth/cap_acceptor/sysbuild.cmake +++ b/samples/bluetooth/cap_acceptor/sysbuild.cmake @@ -18,10 +18,6 @@ if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) CACHE INTERNAL "" ) - list(APPEND ${NET_APP}_SNIPPET ${SNIPPET}) - list(APPEND ${NET_APP}_SNIPPET bt-ll-sw-split) - set(${NET_APP}_SNIPPET ${${NET_APP}_SNIPPET} CACHE STRING "" FORCE) - native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) endif() diff --git a/samples/bluetooth/cap_initiator/sample.yaml b/samples/bluetooth/cap_initiator/sample.yaml index e3e557f48301..b4f593c99129 100644 --- a/samples/bluetooth/cap_initiator/sample.yaml +++ b/samples/bluetooth/cap_initiator/sample.yaml @@ -26,7 +26,5 @@ tests: - nrf52833dk/nrf52833 - nrf52840dk/nrf52840 - nrf52840dongle/nrf52840 - extra_args: - - EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf - - SNIPPET="bt-ll-sw-split" + extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf tags: bluetooth diff --git a/samples/bluetooth/cap_initiator/sysbuild.cmake b/samples/bluetooth/cap_initiator/sysbuild.cmake index d5d260789ff7..2523aac8ea76 100644 --- a/samples/bluetooth/cap_initiator/sysbuild.cmake +++ b/samples/bluetooth/cap_initiator/sysbuild.cmake @@ -18,10 +18,6 @@ if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) CACHE INTERNAL "" ) - list(APPEND ${NET_APP}_SNIPPET ${SNIPPET}) - list(APPEND ${NET_APP}_SNIPPET bt-ll-sw-split) - set(${NET_APP}_SNIPPET ${${NET_APP}_SNIPPET} CACHE STRING "" FORCE) - native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) endif() diff --git a/samples/bluetooth/direction_finding_central/sample.yaml b/samples/bluetooth/direction_finding_central/sample.yaml index ffdf634c6e3e..b7a118e6cdc8 100644 --- a/samples/bluetooth/direction_finding_central/sample.yaml +++ b/samples/bluetooth/direction_finding_central/sample.yaml @@ -14,24 +14,15 @@ tests: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 - nrf5340dk/nrf5340/cpuapp - sample.bluetooth.direction_finding.central.aod_with_controller: + sample.bluetooth.direction_finding.central.aod: harness: bluetooth - extra_args: - - EXTRA_CONF_FILE="overlay-aod.conf" - - SNIPPET="bt-ll-sw-split" + extra_args: EXTRA_CONF_FILE="overlay-aod.conf" platform_allow: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 + - nrf5340dk/nrf5340/cpuapp tags: bluetooth integration_platforms: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 - sample.bluetooth.direction_finding.central.aod_host_only: - harness: bluetooth - extra_args: - - OVERLAY_CONFIG="overlay-aod.conf" - platform_allow: - - nrf5340dk/nrf5340/cpuapp - tags: bluetooth - integration_platforms: - nrf5340dk/nrf5340/cpuapp diff --git a/samples/bluetooth/direction_finding_connectionless_rx/sample.yaml b/samples/bluetooth/direction_finding_connectionless_rx/sample.yaml index c500cc80dcec..8e6097de58ae 100644 --- a/samples/bluetooth/direction_finding_connectionless_rx/sample.yaml +++ b/samples/bluetooth/direction_finding_connectionless_rx/sample.yaml @@ -12,22 +12,14 @@ tests: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 - nrf5340dk/nrf5340/cpuapp - sample.bluetooth.direction_finding_connectionless_rx.aod_with_controller: + sample.bluetooth.direction_finding_connectionless_rx.aod: harness: bluetooth - extra_args: - - EXTRA_CONF_FILE="overlay-aod.conf" - - SNIPPET="bt-ll-sw-split" + extra_args: EXTRA_CONF_FILE="overlay-aod.conf" platform_allow: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 + - nrf5340dk/nrf5340/cpuapp integration_platforms: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 - sample.bluetooth.direction_finding_connectionless_rx.aod_host_only: - harness: bluetooth - extra_args: - - OVERLAY_CONFIG="overlay-aod.conf" - platform_allow: - - nrf5340dk/nrf5340/cpuapp - integration_platforms: - nrf5340dk/nrf5340/cpuapp diff --git a/samples/bluetooth/direction_finding_connectionless_tx/sample.yaml b/samples/bluetooth/direction_finding_connectionless_tx/sample.yaml index 2a4fa93d19d5..78d21b2c95f5 100644 --- a/samples/bluetooth/direction_finding_connectionless_tx/sample.yaml +++ b/samples/bluetooth/direction_finding_connectionless_tx/sample.yaml @@ -12,22 +12,14 @@ tests: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 - nrf5340dk/nrf5340/cpuapp - sample.bluetooth.direction_finding_connectionless.aoa_with_controller: + sample.bluetooth.direction_finding_connectionless.aoa: harness: bluetooth - extra_args: - - EXTRA_CONF_FILE="overlay-aoa.conf" - - SNIPPET="bt-ll-sw-split" + extra_args: EXTRA_CONF_FILE="overlay-aoa.conf" platform_allow: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 + - nrf5340dk/nrf5340/cpuapp integration_platforms: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 - sample.bluetooth.direction_finding_connectionless.aoa_host_only: - harness: bluetooth - extra_args: - - OVERLAY_CONFIG="overlay-aoa.conf" - platform_allow: - - nrf5340dk/nrf5340/cpuapp - integration_platforms: - nrf5340dk/nrf5340/cpuapp diff --git a/samples/bluetooth/direction_finding_peripheral/sample.yaml b/samples/bluetooth/direction_finding_peripheral/sample.yaml index 01f612ad08a0..f300cb415cc5 100644 --- a/samples/bluetooth/direction_finding_peripheral/sample.yaml +++ b/samples/bluetooth/direction_finding_peripheral/sample.yaml @@ -14,24 +14,15 @@ tests: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 - nrf5340dk/nrf5340/cpuapp - sample.bluetooth.direction_finding.peripheral.aod_with_controller: + sample.bluetooth.direction_finding.peripheral.aod: harness: bluetooth - extra_args: - - EXTRA_CONF_FILE="overlay-aoa.conf" - - SNIPPET="bt-ll-sw-split" + extra_args: EXTRA_CONF_FILE="overlay-aoa.conf" platform_allow: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 + - nrf5340dk/nrf5340/cpuapp tags: bluetooth integration_platforms: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 - sample.bluetooth.direction_finding.peripheral.aod_host_only: - harness: bluetooth - extra_args: - - OVERLAY_CONFIG="overlay-aoa.conf" - platform_allow: - - nrf5340dk/nrf5340/cpuapp - tags: bluetooth - integration_platforms: - nrf5340dk/nrf5340/cpuapp diff --git a/samples/bluetooth/hci_ipc/sample.yaml b/samples/bluetooth/hci_ipc/sample.yaml index 3763478b6b33..b758b2547688 100644 --- a/samples/bluetooth/hci_ipc/sample.yaml +++ b/samples/bluetooth/hci_ipc/sample.yaml @@ -15,9 +15,7 @@ tests: sample.bluetooth.hci_ipc.iso_broadcast.bt_ll_sw_split: harness: bluetooth tags: bluetooth - extra_args: - - CONF_FILE="nrf5340_cpunet_iso_broadcast-bt_ll_sw_split.conf" - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE="nrf5340_cpunet_iso_broadcast-bt_ll_sw_split.conf" platform_allow: - nrf5340dk/nrf5340/cpunet - nrf5340_audio_dk/nrf5340/cpunet @@ -27,9 +25,7 @@ tests: sample.bluetooth.hci_ipc.iso_receive.bt_ll_sw_split: harness: bluetooth tags: bluetooth - extra_args: - - CONF_FILE="nrf5340_cpunet_iso_receive-bt_ll_sw_split.conf" - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE="nrf5340_cpunet_iso_receive-bt_ll_sw_split.conf" platform_allow: - nrf5340dk/nrf5340/cpunet - nrf5340_audio_dk/nrf5340/cpunet @@ -39,9 +35,7 @@ tests: sample.bluetooth.hci_ipc.bis.bt_ll_sw_split: harness: bluetooth tags: bluetooth - extra_args: - - CONF_FILE="nrf5340_cpunet_bis-bt_ll_sw_split.conf" - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE="nrf5340_cpunet_bis-bt_ll_sw_split.conf" platform_allow: - nrf5340dk/nrf5340/cpunet - nrf5340_audio_dk/nrf5340/cpunet @@ -51,9 +45,7 @@ tests: sample.bluetooth.hci_ipc.iso_central.bt_ll_sw_split: harness: bluetooth tags: bluetooth - extra_args: - - CONF_FILE="nrf5340_cpunet_iso_central-bt_ll_sw_split.conf" - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE="nrf5340_cpunet_iso_central-bt_ll_sw_split.conf" platform_allow: - nrf5340dk/nrf5340/cpunet - nrf5340_audio_dk/nrf5340/cpunet @@ -63,9 +55,7 @@ tests: sample.bluetooth.hci_ipc.iso_peripheral.bt_ll_sw_split: harness: bluetooth tags: bluetooth - extra_args: - - CONF_FILE="nrf5340_cpunet_iso_peripheral-bt_ll_sw_split.conf" - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE="nrf5340_cpunet_iso_peripheral-bt_ll_sw_split.conf" platform_allow: - nrf5340dk/nrf5340/cpunet - nrf5340_audio_dk/nrf5340/cpunet @@ -75,9 +65,7 @@ tests: sample.bluetooth.hci_ipc.cis.bt_ll_sw_split: harness: bluetooth tags: bluetooth - extra_args: - - CONF_FILE="nrf5340_cpunet_cis-bt_ll_sw_split.conf" - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE="nrf5340_cpunet_cis-bt_ll_sw_split.conf" platform_allow: - nrf5340dk/nrf5340/cpunet - nrf5340_audio_dk/nrf5340/cpunet @@ -87,9 +75,7 @@ tests: sample.bluetooth.hci_ipc.iso.bt_ll_sw_split: harness: bluetooth tags: bluetooth - extra_args: - - CONF_FILE="nrf5340_cpunet_iso-bt_ll_sw_split.conf" - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE="nrf5340_cpunet_iso-bt_ll_sw_split.conf" platform_allow: - nrf5340dk/nrf5340/cpunet - nrf5340_audio_dk/nrf5340/cpunet @@ -113,7 +99,6 @@ tests: extra_args: - CONF_FILE="nrf5340_cpunet_df-bt_ll_sw_split.conf" - DTC_OVERLAY_FILE="nrf5340_cpunet_df-bt_ll_sw_split.overlay" - - SNIPPET="bt-ll-sw-split" platform_allow: nrf5340dk/nrf5340/cpunet integration_platforms: - nrf5340dk/nrf5340/cpunet @@ -124,16 +109,13 @@ tests: - CONF_FILE="nrf5340_cpunet_df-bt_ll_sw_split.conf" - DTC_OVERLAY_FILE="nrf5340_cpunet_df-bt_ll_sw_split.overlay" - CONFIG_BT_CTLR_PHY_CODED=n - - SNIPPET="bt-ll-sw-split" platform_allow: nrf5340dk/nrf5340/cpunet integration_platforms: - nrf5340dk/nrf5340/cpunet sample.bluetooth.hci_ipc.mesh.bt_ll_sw_split: harness: bluetooth tags: bluetooth - extra_args: - - CONF_FILE="nrf5340_cpunet_bt_mesh-bt_ll_sw_split.conf" - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE="nrf5340_cpunet_bt_mesh-bt_ll_sw_split.conf" platform_allow: nrf5340dk/nrf5340/cpunet integration_platforms: - nrf5340dk/nrf5340/cpunet diff --git a/samples/bluetooth/hci_uart/sample.yaml b/samples/bluetooth/hci_uart/sample.yaml index 97ad6c561b2e..b555a74ac5bc 100644 --- a/samples/bluetooth/hci_uart/sample.yaml +++ b/samples/bluetooth/hci_uart/sample.yaml @@ -20,9 +20,7 @@ tests: platform_allow: nrf52833dk/nrf52833 integration_platforms: - nrf52833dk/nrf52833 - extra_args: - - DTC_OVERLAY_FILE=./boards/nrf52833dk_nrf52833_df.overlay - - SNIPPET="bt-ll-sw-split" + extra_args: DTC_OVERLAY_FILE=./boards/nrf52833dk_nrf52833_df.overlay extra_configs: - CONFIG_BT_CTLR_DF=y tags: @@ -31,9 +29,7 @@ tests: sample.bluetooth.hci_uart.nrf5340_netcore.df: harness: bluetooth platform_allow: nrf5340dk/nrf5340/cpunet - extra_args: - - DTC_OVERLAY_FILE=./boards/nrf5340dk_nrf5340_cpunet_df.overlay - - SNIPPET="bt-ll-sw-split" + extra_args: DTC_OVERLAY_FILE=./boards/nrf5340dk_nrf5340_cpunet_df.overlay extra_configs: - CONFIG_BT_CTLR_DF=y tags: @@ -44,9 +40,7 @@ tests: platform_allow: nrf52833dk/nrf52833 integration_platforms: - nrf52833dk/nrf52833 - extra_args: - - DTC_OVERLAY_FILE=./boards/nrf52833dk_nrf52833_df.overlay - - SNIPPET="bt-ll-sw-split" + extra_args: DTC_OVERLAY_FILE=./boards/nrf52833dk_nrf52833_df.overlay extra_configs: - CONFIG_BT_CTLR_DF=y - CONFIG_BT_CTLR_DTM_HCI_DF_IQ_REPORT=y @@ -56,9 +50,7 @@ tests: sample.bluetooth.hci_uart.nrf5340_netcore.df.iq_report: harness: bluetooth platform_allow: nrf5340dk/nrf5340/cpunet - extra_args: - - DTC_OVERLAY_FILE=./boards/nrf5340dk_nrf5340_cpunet_df.overlay - - SNIPPET="bt-ll-sw-split" + extra_args: DTC_OVERLAY_FILE=./boards/nrf5340dk_nrf5340_cpunet_df.overlay extra_configs: - CONFIG_BT_CTLR_DF=y - CONFIG_BT_CTLR_DTM_HCI_DF_IQ_REPORT=y @@ -92,7 +84,6 @@ tests: extra_args: - EXTRA_CONF_FILE=overlay-all-bt_ll_sw_split.conf - DTC_OVERLAY_FILE=./boards/nrf52833dk_nrf52833_df.overlay - - SNIPPET="bt-ll-sw-split" tags: - uart - bluetooth @@ -104,7 +95,6 @@ tests: extra_args: - EXTRA_CONF_FILE=overlay-all-bt_ll_sw_split.conf - DTC_OVERLAY_FILE=./boards/nrf54l15dk_nrf54l15_cpuapp_df.overlay - - SNIPPET="bt-ll-sw-split" tags: - uart - bluetooth diff --git a/samples/bluetooth/hci_vs_scan_req/sample.yaml b/samples/bluetooth/hci_vs_scan_req/sample.yaml index 49526522d16e..245a83aa0d96 100644 --- a/samples/bluetooth/hci_vs_scan_req/sample.yaml +++ b/samples/bluetooth/hci_vs_scan_req/sample.yaml @@ -9,6 +9,4 @@ tests: - nrf52dk/nrf52832 extra_configs: - CONFIG_BT_LL_SW_SPLIT=y - extra_args: - - SNIPPET="bt-ll-sw-split" tags: bluetooth diff --git a/samples/bluetooth/iso_central/sample.yaml b/samples/bluetooth/iso_central/sample.yaml index 57254ee809ab..3a7dedd404ae 100644 --- a/samples/bluetooth/iso_central/sample.yaml +++ b/samples/bluetooth/iso_central/sample.yaml @@ -11,11 +11,11 @@ tests: sample.bluetooth.iso_central.bt_ll_sw_split: harness: bluetooth platform_allow: + - qemu_cortex_m3 + - qemu_x86 - nrf52_bsim - nrf52833dk/nrf52833 integration_platforms: - nrf52833dk/nrf52833 - extra_args: - - EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf - - SNIPPET="bt-ll-sw-split" + extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf tags: bluetooth diff --git a/samples/bluetooth/pbp_public_broadcast_sink/sample.yaml b/samples/bluetooth/pbp_public_broadcast_sink/sample.yaml index 901d40b00d4f..d7c816ee5b76 100644 --- a/samples/bluetooth/pbp_public_broadcast_sink/sample.yaml +++ b/samples/bluetooth/pbp_public_broadcast_sink/sample.yaml @@ -23,7 +23,5 @@ tests: integration_platforms: - nrf52_bsim - nrf52833dk/nrf52833 - extra_args: - - EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf - - SNIPPET="bt-ll-sw-split" + extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf tags: bluetooth diff --git a/samples/bluetooth/pbp_public_broadcast_sink/sysbuild.cmake b/samples/bluetooth/pbp_public_broadcast_sink/sysbuild.cmake index d5d260789ff7..2523aac8ea76 100644 --- a/samples/bluetooth/pbp_public_broadcast_sink/sysbuild.cmake +++ b/samples/bluetooth/pbp_public_broadcast_sink/sysbuild.cmake @@ -18,10 +18,6 @@ if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) CACHE INTERNAL "" ) - list(APPEND ${NET_APP}_SNIPPET ${SNIPPET}) - list(APPEND ${NET_APP}_SNIPPET bt-ll-sw-split) - set(${NET_APP}_SNIPPET ${${NET_APP}_SNIPPET} CACHE STRING "" FORCE) - native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) endif() diff --git a/samples/bluetooth/pbp_public_broadcast_source/sample.yaml b/samples/bluetooth/pbp_public_broadcast_source/sample.yaml index 1d2e31306e29..80c907042119 100644 --- a/samples/bluetooth/pbp_public_broadcast_source/sample.yaml +++ b/samples/bluetooth/pbp_public_broadcast_source/sample.yaml @@ -23,7 +23,5 @@ tests: integration_platforms: - nrf52_bsim - nrf52833dk/nrf52833 - extra_args: - - EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf - - SNIPPET="bt-ll-sw-split" + extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf tags: bluetooth diff --git a/samples/bluetooth/pbp_public_broadcast_source/sysbuild.cmake b/samples/bluetooth/pbp_public_broadcast_source/sysbuild.cmake index e0a7fd9d175d..d3bf7be5b6c3 100644 --- a/samples/bluetooth/pbp_public_broadcast_source/sysbuild.cmake +++ b/samples/bluetooth/pbp_public_broadcast_source/sysbuild.cmake @@ -18,10 +18,6 @@ if(NOT("${SB_CONFIG_NET_CORE_BOARD}" STREQUAL "")) CACHE INTERNAL "" ) - list(APPEND ${NET_APP}_SNIPPET ${SNIPPET}) - list(APPEND ${NET_APP}_SNIPPET bt-ll-sw-split) - set(${NET_APP}_SNIPPET ${${NET_APP}_SNIPPET} CACHE STRING "" FORCE) - native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) endif() diff --git a/snippets/bt-ll-sw-split/bt-ll-sw-split.overlay b/snippets/bt-ll-sw-split/bt-ll-sw-split.overlay index a57a0e82ba6e..04bf83ef44d4 100644 --- a/snippets/bt-ll-sw-split/bt-ll-sw-split.overlay +++ b/snippets/bt-ll-sw-split/bt-ll-sw-split.overlay @@ -2,10 +2,6 @@ status = "okay"; }; -&bt_hci_sdc { - status = "disabled"; -}; - / { chosen { zephyr,bt-hci = &bt_hci_controller; diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c index f93ea59f38e3..d3e1f77b3553 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c @@ -62,7 +62,7 @@ static struct { /* FIXME: This could probably use a chosen entropy device instead on relying on * the nodelabel being the same as for the old nrf rng. */ -static const struct device *const dev_entropy = DEVICE_DT_GET(DT_CHOSEN(zephyr_entropy)); +static const struct device *const dev_entropy = DEVICE_DT_GET(DT_NODELABEL(rng)); #endif /* CONFIG_ENTROPY_HAS_DRIVER */ static int init_reset(void); diff --git a/tests/bluetooth/controller/ctrl_api/testcase.yaml b/tests/bluetooth/controller/ctrl_api/testcase.yaml index 21f178bf9b2b..19bf6c9ab490 100644 --- a/tests/bluetooth/controller/ctrl_api/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_api/testcase.yaml @@ -6,5 +6,3 @@ common: tests: bluetooth.controller.ctrl_api.test: type: unit - extra_args: - - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_chmu/testcase.yaml b/tests/bluetooth/controller/ctrl_chmu/testcase.yaml index 9c3ee6264335..f7e8068d60ec 100644 --- a/tests/bluetooth/controller/ctrl_chmu/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_chmu/testcase.yaml @@ -6,5 +6,3 @@ common: tests: bluetooth.controller.ctrl_chmu.test: type: unit - extra_args: - - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_cis_create/testcase.yaml b/tests/bluetooth/controller/ctrl_cis_create/testcase.yaml index 2371d7063eb7..99612a89bc31 100644 --- a/tests/bluetooth/controller/ctrl_cis_create/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_cis_create/testcase.yaml @@ -6,5 +6,3 @@ common: tests: bluetooth.controller.ctrl_cis_create.test: type: unit - extra_args: - - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_cis_terminate/testcase.yaml b/tests/bluetooth/controller/ctrl_cis_terminate/testcase.yaml index a98229ba45f3..956172a89b20 100644 --- a/tests/bluetooth/controller/ctrl_cis_terminate/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_cis_terminate/testcase.yaml @@ -6,5 +6,3 @@ common: tests: bluetooth.controller.ctrl_cis_terminate.test: type: unit - extra_args: - - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_collision/testcase.yaml b/tests/bluetooth/controller/ctrl_collision/testcase.yaml index daa8f3bc6c3d..6086a9a4ebc8 100644 --- a/tests/bluetooth/controller/ctrl_collision/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_collision/testcase.yaml @@ -6,5 +6,3 @@ common: tests: bluetooth.controller.ctrl_collision.test: type: unit - extra_args: - - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_conn_update/testcase.yaml b/tests/bluetooth/controller/ctrl_conn_update/testcase.yaml index fc4ecb0b647d..5b0bda4b9088 100644 --- a/tests/bluetooth/controller/ctrl_conn_update/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_conn_update/testcase.yaml @@ -7,18 +7,11 @@ common: tests: bluetooth.controller.ctrl_conn_update.test: type: unit - extra_args: - - SNIPPET="bt-ll-sw-split" bluetooth.controller.ctrl_conn_update.apm_test: type: unit - extra_args: - - CONF_FILE=prj_apm.conf - - SNIPPET="bt-ll-sw-split" - + extra_args: CONF_FILE=prj_apm.conf bluetooth.controller.ctrl_conn_update.no_param_req_test: type: unit - extra_args: - - CONF_FILE=prj_no_param_req.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_no_param_req.conf diff --git a/tests/bluetooth/controller/ctrl_cte_req/testcase.yaml b/tests/bluetooth/controller/ctrl_cte_req/testcase.yaml index c6288aecc433..fd6ff51118d9 100644 --- a/tests/bluetooth/controller/ctrl_cte_req/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_cte_req/testcase.yaml @@ -6,5 +6,3 @@ common: tests: bluetooth.controller.ctrl_cte_req.test: type: unit - extra_args: - - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_data_length_update/testcase.yaml b/tests/bluetooth/controller/ctrl_data_length_update/testcase.yaml index c7d1174e12bf..9778af435b4a 100644 --- a/tests/bluetooth/controller/ctrl_data_length_update/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_data_length_update/testcase.yaml @@ -6,17 +6,11 @@ common: tests: bluetooth.controller.ctrl_data_length_update.test: type: unit - extra_args: - - SNIPPET="bt-ll-sw-split" bluetooth.controller.ctrl_data_length_update.test_nocodedphy: type: unit - extra_args: - - CONF_FILE=prj_nocoded.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_nocoded.conf bluetooth.controller.ctrl_data_length_update.test_nophy: type: unit - extra_args: - - CONF_FILE=prj_nophy.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_nophy.conf diff --git a/tests/bluetooth/controller/ctrl_encrypt/testcase.yaml b/tests/bluetooth/controller/ctrl_encrypt/testcase.yaml index 86dd5bfe4d30..d5bb2cb8b110 100644 --- a/tests/bluetooth/controller/ctrl_encrypt/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_encrypt/testcase.yaml @@ -6,5 +6,3 @@ common: tests: bluetooth.controller.ctrl_encrypt.test: type: unit - extra_args: - - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_feature_exchange/testcase.yaml b/tests/bluetooth/controller/ctrl_feature_exchange/testcase.yaml index 087e49575ff7..257542f36120 100644 --- a/tests/bluetooth/controller/ctrl_feature_exchange/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_feature_exchange/testcase.yaml @@ -6,5 +6,3 @@ common: tests: bluetooth.controller.ctrl_feature_exchange.test: type: unit - extra_args: - - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_hci/testcase.yaml b/tests/bluetooth/controller/ctrl_hci/testcase.yaml index 5e00c85f6f43..c750ebc8dd8e 100644 --- a/tests/bluetooth/controller/ctrl_hci/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_hci/testcase.yaml @@ -6,5 +6,3 @@ common: tests: bluetooth.controller.ctrl_hci.test: type: unit - extra_args: - - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_invalid/testcase.yaml b/tests/bluetooth/controller/ctrl_invalid/testcase.yaml index cee54e6b09ed..2d1741931e37 100644 --- a/tests/bluetooth/controller/ctrl_invalid/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_invalid/testcase.yaml @@ -6,5 +6,3 @@ common: tests: bluetooth.controller.ctrl_invalid.test: type: unit - extra_args: - - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_le_ping/testcase.yaml b/tests/bluetooth/controller/ctrl_le_ping/testcase.yaml index 54178905da17..b6a77528f32d 100644 --- a/tests/bluetooth/controller/ctrl_le_ping/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_le_ping/testcase.yaml @@ -6,5 +6,3 @@ common: tests: bluetooth.controller.ctrl_le_ping.test: type: unit - extra_args: - - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_min_used_chans/testcase.yaml b/tests/bluetooth/controller/ctrl_min_used_chans/testcase.yaml index a9445cbf8c4d..0991b0cdd43c 100644 --- a/tests/bluetooth/controller/ctrl_min_used_chans/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_min_used_chans/testcase.yaml @@ -6,5 +6,3 @@ common: tests: bluetooth.controller.ctrl_min_used_chans.test: type: unit - extra_args: - - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_phy_update/testcase.yaml b/tests/bluetooth/controller/ctrl_phy_update/testcase.yaml index d5c49d587a8f..1d7da169f1d8 100644 --- a/tests/bluetooth/controller/ctrl_phy_update/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_phy_update/testcase.yaml @@ -6,10 +6,6 @@ common: tests: bluetooth.controller.ctrl_phy_update.test: type: unit - extra_args: - - SNIPPET="bt-ll-sw-split" bluetooth.controller.ctrl_phy_update.test_reduced_buf: type: unit - extra_args: - - CONF_FILE=prj_rx_cnt.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_rx_cnt.conf diff --git a/tests/bluetooth/controller/ctrl_sca_update/testcase.yaml b/tests/bluetooth/controller/ctrl_sca_update/testcase.yaml index cbc3c3faf720..cbf63aa1b575 100644 --- a/tests/bluetooth/controller/ctrl_sca_update/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_sca_update/testcase.yaml @@ -6,5 +6,3 @@ common: tests: bluetooth.controller.ctrl_sca_update.test: type: unit - extra_args: - - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_sw_privacy/testcase.yaml b/tests/bluetooth/controller/ctrl_sw_privacy/testcase.yaml index ac5dd6e957eb..778606d69549 100644 --- a/tests/bluetooth/controller/ctrl_sw_privacy/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_sw_privacy/testcase.yaml @@ -4,5 +4,3 @@ common: tests: bluetooth.ctrl_sw_privacy.test: platform_allow: nrf52_bsim - extra_args: - - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_terminate/testcase.yaml b/tests/bluetooth/controller/ctrl_terminate/testcase.yaml index 6b1409e9653e..cbe639401ea3 100644 --- a/tests/bluetooth/controller/ctrl_terminate/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_terminate/testcase.yaml @@ -6,5 +6,3 @@ common: tests: bluetooth.controller.ctrl_terminate.test: type: unit - extra_args: - - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_tx_buffer_alloc/testcase.yaml b/tests/bluetooth/controller/ctrl_tx_buffer_alloc/testcase.yaml index 363986bd3d35..614eb7fe94c0 100644 --- a/tests/bluetooth/controller/ctrl_tx_buffer_alloc/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_tx_buffer_alloc/testcase.yaml @@ -6,35 +6,23 @@ common: tests: bluetooth.controller.ctrl_tx_buffer_alloc.test_0_per_conn: type: unit - extra_args: - - SNIPPET="bt-ll-sw-split" bluetooth.controller.ctrl_tx_buffer_alloc.test_1_per_conn: type: unit - extra_args: - - CONF_FILE=prj_1.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_1.conf bluetooth.controller.ctrl_tx_buffer_alloc.test_2_per_conn: type: unit - extra_args: - - CONF_FILE=prj_2.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_2.conf bluetooth.controller.ctrl_tx_buffer_alloc.test_3_per_conn: type: unit - extra_args: - - CONF_FILE=prj_3.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_3.conf bluetooth.controller.ctrl_tx_buffer_alloc.test_max_per_conn_alloc: type: unit - extra_args: - - CONF_FILE=prj_max.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_max.conf bluetooth.controller.ctrl_tx_buffer_alloc.test_max_common_alloc: type: unit - extra_args: - - CONF_FILE=prj_max_common.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_max_common.conf diff --git a/tests/bluetooth/controller/ctrl_tx_queue/testcase.yaml b/tests/bluetooth/controller/ctrl_tx_queue/testcase.yaml index 282b620b317a..295ad891a630 100644 --- a/tests/bluetooth/controller/ctrl_tx_queue/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_tx_queue/testcase.yaml @@ -5,5 +5,3 @@ common: tests: bluetooth.ctrl_tx_queue.test: type: unit - extra_args: - - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_unsupported/testcase.yaml b/tests/bluetooth/controller/ctrl_unsupported/testcase.yaml index 48b18af93536..28aba1a752a8 100644 --- a/tests/bluetooth/controller/ctrl_unsupported/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_unsupported/testcase.yaml @@ -6,11 +6,7 @@ common: tests: bluetooth.controller.ctrl_unsupported.default.test: type: unit - extra_args: - - SNIPPET="bt-ll-sw-split" bluetooth.controller.ctrl_unsupported.test: type: unit - extra_args: - - CONF_FILE=prj_unsupported.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_unsupported.conf diff --git a/tests/bluetooth/controller/ctrl_user_ext/testcase.yaml b/tests/bluetooth/controller/ctrl_user_ext/testcase.yaml index be963df24a8a..af319a7a7191 100644 --- a/tests/bluetooth/controller/ctrl_user_ext/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_user_ext/testcase.yaml @@ -4,5 +4,3 @@ common: tests: bluetooth.ctrl_user_ext.test: platform_allow: nrf52_bsim - extra_args: - - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_version/testcase.yaml b/tests/bluetooth/controller/ctrl_version/testcase.yaml index 5df86b9bca9f..6badcbc72547 100644 --- a/tests/bluetooth/controller/ctrl_version/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_version/testcase.yaml @@ -6,5 +6,3 @@ common: tests: bluetooth.controller.ctrl_version.test: type: unit - extra_args: - - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/df/connection_cte_req/testcase.yaml b/tests/bluetooth/df/connection_cte_req/testcase.yaml index fbfe4b0d9a1a..768aba4a51f5 100644 --- a/tests/bluetooth/df/connection_cte_req/testcase.yaml +++ b/tests/bluetooth/df/connection_cte_req/testcase.yaml @@ -2,5 +2,3 @@ tests: bluetooth.df.conection_cte_req: platform_allow: nrf52_bsim tags: bluetooth - extra_args: - - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/df/connection_cte_tx_params/testcase.yaml b/tests/bluetooth/df/connection_cte_tx_params/testcase.yaml index a9986c5b0e53..38a23b0950e3 100644 --- a/tests/bluetooth/df/connection_cte_tx_params/testcase.yaml +++ b/tests/bluetooth/df/connection_cte_tx_params/testcase.yaml @@ -2,5 +2,3 @@ tests: bluetooth.df.conection_cte_tx_params: platform_allow: nrf52_bsim tags: bluetooth - extra_args: - - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/df/connectionless_cte_chains/testcase.yaml b/tests/bluetooth/df/connectionless_cte_chains/testcase.yaml index 844a7bbb524e..6aa5bb0f0c1c 100644 --- a/tests/bluetooth/df/connectionless_cte_chains/testcase.yaml +++ b/tests/bluetooth/df/connectionless_cte_chains/testcase.yaml @@ -2,5 +2,3 @@ tests: bluetooth.df.connectionless_cte_chains: platform_allow: nrf52_bsim tags: bluetooth - extra_args: - - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/df/connectionless_cte_rx/testcase.yaml b/tests/bluetooth/df/connectionless_cte_rx/testcase.yaml index c8f08a908436..f839b1910eb2 100644 --- a/tests/bluetooth/df/connectionless_cte_rx/testcase.yaml +++ b/tests/bluetooth/df/connectionless_cte_rx/testcase.yaml @@ -2,5 +2,3 @@ tests: bluetooth.df.connectionless_cte_rx: platform_allow: nrf52_bsim tags: bluetooth - extra_args: - - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/df/connectionless_cte_tx/testcase.yaml b/tests/bluetooth/df/connectionless_cte_tx/testcase.yaml index 491cc0e7e599..77d651d0cbc2 100644 --- a/tests/bluetooth/df/connectionless_cte_tx/testcase.yaml +++ b/tests/bluetooth/df/connectionless_cte_tx/testcase.yaml @@ -2,5 +2,3 @@ tests: bluetooth.df.connectionless_cte_tx: platform_allow: nrf52_bsim tags: bluetooth - extra_args: - - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/init/testcase.yaml b/tests/bluetooth/init/testcase.yaml index a5cc40cd39e7..dd44257e0128 100644 --- a/tests/bluetooth/init/testcase.yaml +++ b/tests/bluetooth/init/testcase.yaml @@ -74,9 +74,7 @@ tests: extra_args: CONF_FILE=prj_9.conf platform_allow: qemu_cortex_m3 bluetooth.init.test_ctlr: - extra_args: - - CONF_FILE=prj_ctlr.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_ctlr.conf platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -88,9 +86,7 @@ tests: - nrf51dk/nrf51822 - rv32m1_vega/openisa_rv32m1/ri5cy bluetooth.init.test_ctlr_4_0: - extra_args: - - CONF_FILE=prj_ctlr_4_0.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_ctlr_4_0.conf platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -99,9 +95,7 @@ tests: - nrf52dk/nrf52832 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_4_0_dbg: - extra_args: - - CONF_FILE=prj_ctlr_4_0_dbg.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_ctlr_4_0_dbg.conf platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -110,9 +104,7 @@ tests: - nrf52dk/nrf52832 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_tiny: - extra_args: - - CONF_FILE=prj_ctlr_tiny.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_ctlr_tiny.conf platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -124,7 +116,6 @@ tests: extra_args: - CONF_FILE=prj_ctlr_dbg.conf - DTC_OVERLAY_FILE=pa_lna.overlay - - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -135,7 +126,6 @@ tests: extra_args: - CONF_FILE=prj_ctlr_5_x_dbg.conf - DTC_OVERLAY_FILE=pa_lna.overlay - - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -147,7 +137,6 @@ tests: - CONF_FILE=prj_ctlr.conf - CONFIG_BT_CTLR_ADVANCED_FEATURES=y - CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER=y - - SNIPPET="bt-ll-sw-split" platform_allow: - nrf5340dk/nrf5340/cpunet - nrf52840dk/nrf52840 @@ -157,16 +146,13 @@ tests: bluetooth.init.test_ctlr_ticker: extra_args: - CONF_FILE=prj_ctlr_ticker.conf - - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 integration_platforms: - nrf52dk/nrf52832 bluetooth.init.test_ctlr_broadcaster: - extra_args: - - CONF_FILE=prj_ctlr_broadcaster.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_ctlr_broadcaster.conf platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -175,9 +161,7 @@ tests: integration_platforms: - nrf52dk/nrf52832 bluetooth.init.test_ctlr_peripheral: - extra_args: - - CONF_FILE=prj_ctlr_peripheral.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_ctlr_peripheral.conf platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -186,9 +170,7 @@ tests: integration_platforms: - nrf52dk/nrf52832 bluetooth.init.test_ctlr_peripheral_priv: - extra_args: - - CONF_FILE=prj_ctlr_peripheral_priv.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_ctlr_peripheral_priv.conf platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -197,9 +179,7 @@ tests: integration_platforms: - nrf52840dk/nrf52840 bluetooth.init.test_ctlr_observer: - extra_args: - - CONF_FILE=prj_ctlr_observer.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_ctlr_observer.conf platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -208,9 +188,7 @@ tests: integration_platforms: - nrf52dk/nrf52832 bluetooth.init.test_ctlr_central: - extra_args: - - CONF_FILE=prj_ctlr_central.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_ctlr_central.conf platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -220,9 +198,7 @@ tests: - nrf52dk/nrf52832 - rv32m1_vega/openisa_rv32m1/ri5cy bluetooth.init.test_ctlr_central_priv: - extra_args: - - CONF_FILE=prj_ctlr_central_priv.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_ctlr_central_priv.conf platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -232,9 +208,7 @@ tests: - nrf52dk/nrf52832 - rv32m1_vega/openisa_rv32m1/ri5cy bluetooth.init.test_ctlr_broadcaster_ext: - extra_args: - - CONF_FILE=prj_ctlr_broadcaster_ext.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_ctlr_broadcaster_ext.conf platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -243,9 +217,7 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_peripheral_ext: - extra_args: - - CONF_FILE=prj_ctlr_peripheral_ext.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_ctlr_peripheral_ext.conf platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -254,9 +226,7 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_peripheral_ext_priv: - extra_args: - - CONF_FILE=prj_ctlr_peripheral_ext_priv.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_ctlr_peripheral_ext_priv.conf platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -265,9 +235,7 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_oberver_ext: - extra_args: - - CONF_FILE=prj_ctlr_observer_ext.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_ctlr_observer_ext.conf platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -276,9 +244,7 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_central_ext: - extra_args: - - CONF_FILE=prj_ctlr_central_ext.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_ctlr_central_ext.conf platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -287,9 +253,7 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_central_ext_priv: - extra_args: - - CONF_FILE=prj_ctlr_central_ext_priv.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_ctlr_central_ext_priv.conf platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -298,9 +262,7 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_per_adv: - extra_args: - - CONF_FILE=prj_ctlr_per_adv.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_ctlr_per_adv.conf platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -309,9 +271,7 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_per_adv_no_adi: - extra_args: - - CONF_FILE=prj_ctlr_per_adv_no_adi.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_ctlr_per_adv_no_adi.conf platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -320,9 +280,7 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_per_sync: - extra_args: - - CONF_FILE=prj_ctlr_per_sync.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_ctlr_per_sync.conf platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -331,9 +289,7 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_per_sync_no_adi: - extra_args: - - CONF_FILE=prj_ctlr_per_sync_no_adi.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_ctlr_per_sync_no_adi.conf platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -342,9 +298,7 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_per_sync_no_filter: - extra_args: - - CONF_FILE=prj_ctlr_per_sync_no_filter.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_ctlr_per_sync_no_filter.conf platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -353,9 +307,7 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_peripheral_iso: - extra_args: - - CONF_FILE=prj_ctlr_peripheral_iso.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_ctlr_peripheral_iso.conf platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -364,9 +316,7 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_central_iso: - extra_args: - - CONF_FILE=prj_ctlr_central_iso.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_ctlr_central_iso.conf platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -385,9 +335,7 @@ tests: - DTC_OVERLAY_FILE=h5.overlay platform_allow: qemu_cortex_m3 bluetooth.init.test_llcp: - extra_args: - - CONF_FILE=prj_llcp.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_llcp.conf platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -399,7 +347,6 @@ tests: extra_args: - CONF_FILE=prj_ctlr.conf - CONFIG_BT_RECV_WORKQ_BT=y - - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 bluetooth.init.test_host_6_x: From 1fcb42ef60026f159c46d36878a4d5df0f972ea6 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:40 +0300 Subject: [PATCH 1066/2141] Revert "[nrf noup] dts: choose a crypto accelerator for entropy" This reverts commit 53fae56efca3c201e8faa1433b7c3ee98b4e6dd6. Signed-off-by: Jukka Rissanen --- dts/arm/nordic/nrf52840.dtsi | 4 ++-- dts/arm/nordic/nrf5340_cpuapp.dtsi | 4 ++-- dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi | 4 ++-- dts/arm/nordic/nrf91.dtsi | 3 +-- soc/nordic/common/Kconfig.peripherals | 6 ++---- 5 files changed, 9 insertions(+), 12 deletions(-) diff --git a/dts/arm/nordic/nrf52840.dtsi b/dts/arm/nordic/nrf52840.dtsi index bcbfd926c9bb..dab5f7620585 100644 --- a/dts/arm/nordic/nrf52840.dtsi +++ b/dts/arm/nordic/nrf52840.dtsi @@ -8,7 +8,7 @@ / { chosen { zephyr,bt-hci = &bt_hci_controller; - zephyr,entropy = &cryptocell; + zephyr,entropy = &rng; zephyr,flash-controller = &flash_controller; }; @@ -572,7 +572,7 @@ reg = <0x5002a000 0x1000>, <0x5002b000 0x1000>; reg-names = "wrapper", "core"; interrupts = <42 NRF_DEFAULT_IRQ_PRIORITY>; - status = "okay"; + status = "disabled"; }; }; }; diff --git a/dts/arm/nordic/nrf5340_cpuapp.dtsi b/dts/arm/nordic/nrf5340_cpuapp.dtsi index d3df6da31997..30aaf9c99479 100644 --- a/dts/arm/nordic/nrf5340_cpuapp.dtsi +++ b/dts/arm/nordic/nrf5340_cpuapp.dtsi @@ -34,7 +34,7 @@ }; chosen { - zephyr,entropy = &cryptocell; + zephyr,entropy = &rng_hci; zephyr,flash-controller = &flash_controller; }; @@ -104,7 +104,7 @@ reg = <0x50844000 0x1000>, <0x50845000 0x1000>; reg-names = "wrapper", "core"; interrupts = <68 NRF_DEFAULT_IRQ_PRIORITY>; - status = "okay"; + status = "disabled"; }; }; diff --git a/dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi b/dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi index 8b0339eda399..3f1fe655b6e5 100644 --- a/dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi +++ b/dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi @@ -16,7 +16,7 @@ nvic: &cpuapp_nvic {}; / { chosen { zephyr,bt-hci = &bt_hci_controller; - zephyr,entropy = &psa_rng; + zephyr,entropy = &rng; }; soc { @@ -32,7 +32,7 @@ nvic: &cpuapp_nvic {}; psa_rng: psa-rng { compatible = "zephyr,psa-crypto-rng"; - status = "okay"; + status = "disabled"; }; }; diff --git a/dts/arm/nordic/nrf91.dtsi b/dts/arm/nordic/nrf91.dtsi index 7b7d48916519..1747dcea74a9 100644 --- a/dts/arm/nordic/nrf91.dtsi +++ b/dts/arm/nordic/nrf91.dtsi @@ -28,7 +28,6 @@ }; chosen { - zephyr,entropy = &cryptocell; zephyr,flash-controller = &flash_controller; }; @@ -52,7 +51,7 @@ reg = <0x50840000 0x1000>, <0x50841000 0x1000>; reg-names = "wrapper", "core"; interrupts = <64 NRF_DEFAULT_IRQ_PRIORITY>; - status = "okay"; + status = "disabled"; }; ctrlap: ctrlap@50006000 { diff --git a/soc/nordic/common/Kconfig.peripherals b/soc/nordic/common/Kconfig.peripherals index 90bd21f84663..083fcc4e0891 100644 --- a/soc/nordic/common/Kconfig.peripherals +++ b/soc/nordic/common/Kconfig.peripherals @@ -13,12 +13,10 @@ config HAS_HW_NRF_BPROT def_bool $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF_BPROT)) config HAS_HW_NRF_CC310 - def_bool $(dt_compat_enabled,$(DT_COMPAT_ARM_CRYPTOCELL_310)) || \ - ($(dt_nodelabel_enabled,psa_rng) && SOC_SERIES_NRF91X) + def_bool $(dt_compat_enabled,$(DT_COMPAT_ARM_CRYPTOCELL_310)) config HAS_HW_NRF_CC312 - def_bool $(dt_compat_enabled,$(DT_COMPAT_ARM_CRYPTOCELL_312)) || \ - ($(dt_nodelabel_enabled,psa_rng) && SOC_NRF5340_CPUAPP) + def_bool $(dt_compat_enabled,$(DT_COMPAT_ARM_CRYPTOCELL_312)) config HAS_HW_NRF_CCM def_bool $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF_CCM)) From db90fd681335bf5a46e2bd0761226fe88a5253a6 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:40 +0300 Subject: [PATCH 1067/2141] Revert "[nrf noup] Bluetooth: Mesh: Disable processing of ext ADV packets" This reverts commit bc11d5db02692ffaa2a6e75ec939f2b9fa404d03. Signed-off-by: Jukka Rissanen --- subsys/bluetooth/mesh/Kconfig | 11 ----------- subsys/bluetooth/mesh/adv_ext.c | 12 ------------ 2 files changed, 23 deletions(-) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index 7e4adf4c78ab..bd0350307ba2 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -214,17 +214,6 @@ config BT_MESH_ADV_EXT_FRIEND_SEPARATE messages as close to the start of the ReceiveWindow as possible, thus reducing the scanning time on the Low Power node. -config BT_MESH_ADV_EXT_ACCEPT_EXT_ADV_PACKETS - bool "Reject or accept extended advertising packets" - depends on BT_LL_SOFTDEVICE - help - Configure the scanner and initiator to either reject or accept extended - advertising packets by the SoftDevice Controller. This is set to false - by default, to prevent loss of scan time when receiving a pointer packet - while scanning for Bluetooth Mesh packets. Set to true if extended - advertising packets are to be received by the SoftDevice Controller for - purposes other than Bluetooth Mesh. - endif # BT_MESH_ADV_EXT endchoice diff --git a/subsys/bluetooth/mesh/adv_ext.c b/subsys/bluetooth/mesh/adv_ext.c index c74f0a40d99a..0e6f6120f73f 100644 --- a/subsys/bluetooth/mesh/adv_ext.c +++ b/subsys/bluetooth/mesh/adv_ext.c @@ -519,18 +519,6 @@ void bt_mesh_adv_init(void) K_PRIO_COOP(MESH_WORKQ_PRIORITY), NULL); k_thread_name_set(&bt_mesh_workq.thread, "BT MESH WQ"); } - -#if defined(CONFIG_BT_LL_SOFTDEVICE) - const sdc_hci_cmd_vs_scan_accept_ext_adv_packets_set_t cmd_params = { - .accept_ext_adv_packets = IS_ENABLED(CONFIG_BT_MESH_ADV_EXT_ACCEPT_EXT_ADV_PACKETS), - }; - - int err = sdc_hci_cmd_vs_scan_accept_ext_adv_packets_set(&cmd_params); - - if (err) { - LOG_ERR("Failed to set accept_ext_adv_packets: %d", err); - } -#endif } static struct bt_mesh_ext_adv *adv_instance_find(struct bt_le_ext_adv *instance) From b8cf83d7935bdb58db1b8079fc36ed85731e624f Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:40 +0300 Subject: [PATCH 1068/2141] Revert "[nrf noup] tests: bluetooth: tester: sysbuild configurable 53/54H" This reverts commit 63f0faef7bd0ccffd1970b1677efa04b696b8d70. Signed-off-by: Jukka Rissanen --- .../nrf54h20_cpurad-bt_ll_softdevice.conf | 33 ------------------- tests/bluetooth/tester/Kconfig.sysbuild | 1 - tests/bluetooth/tester/sysbuild.cmake | 16 ++------- 3 files changed, 2 insertions(+), 48 deletions(-) delete mode 100644 samples/bluetooth/hci_ipc/nrf54h20_cpurad-bt_ll_softdevice.conf diff --git a/samples/bluetooth/hci_ipc/nrf54h20_cpurad-bt_ll_softdevice.conf b/samples/bluetooth/hci_ipc/nrf54h20_cpurad-bt_ll_softdevice.conf deleted file mode 100644 index 1f7748e5cd7d..000000000000 --- a/samples/bluetooth/hci_ipc/nrf54h20_cpurad-bt_ll_softdevice.conf +++ /dev/null @@ -1,33 +0,0 @@ -CONFIG_IPC_SERVICE=y -CONFIG_MBOX=y - -CONFIG_ISR_STACK_SIZE=1024 -CONFIG_IDLE_STACK_SIZE=256 -CONFIG_MAIN_STACK_SIZE=512 -CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=512 -CONFIG_IPC_SERVICE_BACKEND_RPMSG_WQ_STACK_SIZE=512 -CONFIG_HEAP_MEM_POOL_SIZE=8192 - -CONFIG_BT=y -CONFIG_BT_HCI_RAW=y - -CONFIG_BT_BUF_EVT_RX_COUNT=16 -CONFIG_BT_BUF_EVT_RX_SIZE=255 -CONFIG_BT_BUF_ACL_RX_SIZE=255 -CONFIG_BT_BUF_ACL_TX_SIZE=251 -CONFIG_BT_BUF_CMD_TX_SIZE=255 - -# Host -CONFIG_BT_BROADCASTER=y -CONFIG_BT_PERIPHERAL=y -CONFIG_BT_OBSERVER=y -CONFIG_BT_CENTRAL=y -CONFIG_BT_EXT_ADV=y -CONFIG_BT_PER_ADV=y -CONFIG_BT_PER_ADV_SYNC=y - -# Controller -CONFIG_BT_LL_SW_SPLIT=n -CONFIG_BT_LL_SOFTDEVICE=y -CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 -CONFIG_BT_CTLR_SCAN_DATA_LEN_MAX=191 diff --git a/tests/bluetooth/tester/Kconfig.sysbuild b/tests/bluetooth/tester/Kconfig.sysbuild index e14a6e1aa8e0..69e4d5a97fbe 100644 --- a/tests/bluetooth/tester/Kconfig.sysbuild +++ b/tests/bluetooth/tester/Kconfig.sysbuild @@ -5,7 +5,6 @@ source "share/sysbuild/Kconfig" config NET_CORE_BOARD string - default "nrf54h20dk/nrf54h20/cpurad" if "$(BOARD)" = "nrf54h20dk" default "nrf5340dk/nrf5340/cpunet" if "$(BOARD)" = "nrf5340dk" default "nrf5340_audio_dk/nrf5340/cpunet" if "$(BOARD)" = "nrf5340_audio_dk" default "nrf5340bsim/nrf5340/cpunet" if $(BOARD_TARGET_STRING) = "NRF5340BSIM_NRF5340_CPUAPP" diff --git a/tests/bluetooth/tester/sysbuild.cmake b/tests/bluetooth/tester/sysbuild.cmake index bcd564733c53..a9ddf1279471 100644 --- a/tests/bluetooth/tester/sysbuild.cmake +++ b/tests/bluetooth/tester/sysbuild.cmake @@ -2,6 +2,8 @@ # SPDX-License-Identifier: Apache-2.0 if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) + # For builds in the nrf5340, we build the netcore image with the controller + set(NET_APP hci_ipc) set(NET_APP_SRC_DIR ${ZEPHYR_BASE}/samples/bluetooth/${NET_APP}) @@ -11,20 +13,6 @@ if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) BOARD ${SB_CONFIG_NET_CORE_BOARD} ) - if(SB_CONFIG_SOC_NRF5340_CPUAPP) - set(${NET_APP}_SNIPPET - "bt-ll-sw-split" - CACHE INTERNAL "" - ) - endif() - - if(SB_CONFIG_SOC_NRF54H20_CPUAPP) - set(${NET_APP}_CONF_FILE - ${NET_APP_SRC_DIR}/nrf54h20_cpurad-bt_ll_softdevice.conf - CACHE INTERNAL "" - ) - endif() - set(${NET_APP}_EXTRA_CONF_FILE ${APP_DIR}/overlay-bt_ll_sw_split.conf CACHE INTERNAL "" From 7d881ec89219a969822a522796f9e1d7293adf85 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:40 +0300 Subject: [PATCH 1069/2141] Revert "[nrf noup] net: tests: crypto: Adding legacy Crypto support ipv6 tests" This reverts commit 462b528e3f91ce8139309d0d07c8bc64edc65042. Signed-off-by: Jukka Rissanen --- tests/net/ipv6/prj.conf | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/net/ipv6/prj.conf b/tests/net/ipv6/prj.conf index c8dda7728952..51cfa883727d 100644 --- a/tests/net/ipv6/prj.conf +++ b/tests/net/ipv6/prj.conf @@ -33,7 +33,6 @@ CONFIG_NET_IF_MAX_IPV6_COUNT=2 CONFIG_NET_IPV6_PE=y CONFIG_NET_IPV6_PE_FILTER_PREFIX_COUNT=2 CONFIG_NET_IPV6_PE_PREFER_PUBLIC_ADDRESSES=n -CONFIG_MBEDTLS_LEGACY_CRYPTO_C=y # Increase the stack a bit for mps2/an385 CONFIG_NET_RX_STACK_SIZE=1700 From 8a6a17eaf0a5c302a786849504055b9dc48d481f Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:40 +0300 Subject: [PATCH 1070/2141] Revert "[nrf noup] net: tests: Add legacy crypto API support for big_http_download" This reverts commit d9e0b36c715d2afa68d885ae3a0435efd4cac4a9. Signed-off-by: Jukka Rissanen --- samples/net/sockets/big_http_download/prj.conf | 1 - 1 file changed, 1 deletion(-) diff --git a/samples/net/sockets/big_http_download/prj.conf b/samples/net/sockets/big_http_download/prj.conf index 8677e7113e4b..a406f314dfb2 100644 --- a/samples/net/sockets/big_http_download/prj.conf +++ b/samples/net/sockets/big_http_download/prj.conf @@ -3,7 +3,6 @@ CONFIG_REQUIRES_FULL_LIBC=y CONFIG_MBEDTLS=y CONFIG_MBEDTLS_ENABLE_HEAP=y CONFIG_MBEDTLS_MD=y -CONFIG_MBEDTLS_LEGACY_CRYPTO_C=y CONFIG_MAIN_STACK_SIZE=2536 # Networking config From f908075bedc94a76c162d53c46af826c121f21af Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:40 +0300 Subject: [PATCH 1071/2141] Revert "[nrf noup] mbedtls: Don't enable auto-generation of Mbed TLS files" This reverts commit d268008fb254d5fcb01e92931864fca8165a1246. Signed-off-by: Jukka Rissanen --- tests/crypto/mbedtls/CMakeLists.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/crypto/mbedtls/CMakeLists.txt b/tests/crypto/mbedtls/CMakeLists.txt index 47670bead010..7ebdc9d76a9a 100644 --- a/tests/crypto/mbedtls/CMakeLists.txt +++ b/tests/crypto/mbedtls/CMakeLists.txt @@ -6,5 +6,15 @@ project(mbedtls) set(output_file ${PROJECT_BINARY_DIR}/mbedtls-check.timestamp) +add_custom_command( + COMMENT "Check Mbed TLS auto-generated files" + COMMAND + ${PYTHON_EXECUTABLE} ${ZEPHYR_BASE}/modules/mbedtls/create_psa_files.py --check + OUTPUT + ${output_file} +) + +add_custom_target(check_mbedtls_auto_generated_files ALL DEPENDS ${output_file}) + FILE(GLOB app_sources src/*.c) target_sources(app PRIVATE ${app_sources}) From 552bbe847ae19c8cfe91da633bac8212b1f55249 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:40 +0300 Subject: [PATCH 1072/2141] Revert "[nrf noup] samples: net: Enable Wi-Fi driver in sysbuild builds" This reverts commit ccf6152219b7547248f52b752f19f770ad444c66. Signed-off-by: Jukka Rissanen --- samples/net/dns_resolve/Kconfig.sysbuild | 13 ------------- samples/net/ipv4_autoconf/Kconfig.sysbuild | 13 ------------- samples/net/lwm2m_client/Kconfig.sysbuild | 13 ------------- samples/net/mdns_responder/Kconfig.sysbuild | 13 ------------- samples/net/mqtt_publisher/Kconfig.sysbuild | 13 ------------- samples/net/mqtt_sn_publisher/Kconfig.sysbuild | 13 ------------- samples/net/sockets/coap_server/Kconfig.sysbuild | 13 ------------- samples/net/sockets/echo_async/Kconfig.sysbuild | 13 ------------- samples/net/sockets/echo_client/Kconfig.sysbuild | 13 ------------- samples/net/sockets/echo_server/Kconfig.sysbuild | 13 ------------- samples/net/sockets/http_get/Kconfig.sysbuild | 13 ------------- samples/net/sockets/sntp_client/Kconfig.sysbuild | 13 ------------- samples/net/syslog_net/Kconfig.sysbuild | 13 ------------- samples/net/telnet/Kconfig.sysbuild | 13 ------------- samples/net/wifi/Kconfig.sysbuild | 13 ------------- samples/net/wifi/shell/sample.yaml | 2 -- 16 files changed, 197 deletions(-) delete mode 100644 samples/net/dns_resolve/Kconfig.sysbuild delete mode 100644 samples/net/ipv4_autoconf/Kconfig.sysbuild delete mode 100644 samples/net/lwm2m_client/Kconfig.sysbuild delete mode 100644 samples/net/mdns_responder/Kconfig.sysbuild delete mode 100644 samples/net/mqtt_publisher/Kconfig.sysbuild delete mode 100644 samples/net/mqtt_sn_publisher/Kconfig.sysbuild delete mode 100644 samples/net/sockets/coap_server/Kconfig.sysbuild delete mode 100644 samples/net/sockets/echo_async/Kconfig.sysbuild delete mode 100644 samples/net/sockets/echo_client/Kconfig.sysbuild delete mode 100644 samples/net/sockets/echo_server/Kconfig.sysbuild delete mode 100644 samples/net/sockets/http_get/Kconfig.sysbuild delete mode 100644 samples/net/sockets/sntp_client/Kconfig.sysbuild delete mode 100644 samples/net/syslog_net/Kconfig.sysbuild delete mode 100644 samples/net/telnet/Kconfig.sysbuild delete mode 100644 samples/net/wifi/Kconfig.sysbuild diff --git a/samples/net/dns_resolve/Kconfig.sysbuild b/samples/net/dns_resolve/Kconfig.sysbuild deleted file mode 100644 index 158551060c56..000000000000 --- a/samples/net/dns_resolve/Kconfig.sysbuild +++ /dev/null @@ -1,13 +0,0 @@ -# -# Copyright (c) 2024 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: Apache-2.0 -# - -config WIFI_NRF70 - default y if BOARD_NRF7002DK_NRF5340_CPUAPP || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS - -source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/samples/net/ipv4_autoconf/Kconfig.sysbuild b/samples/net/ipv4_autoconf/Kconfig.sysbuild deleted file mode 100644 index 158551060c56..000000000000 --- a/samples/net/ipv4_autoconf/Kconfig.sysbuild +++ /dev/null @@ -1,13 +0,0 @@ -# -# Copyright (c) 2024 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: Apache-2.0 -# - -config WIFI_NRF70 - default y if BOARD_NRF7002DK_NRF5340_CPUAPP || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS - -source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/samples/net/lwm2m_client/Kconfig.sysbuild b/samples/net/lwm2m_client/Kconfig.sysbuild deleted file mode 100644 index 158551060c56..000000000000 --- a/samples/net/lwm2m_client/Kconfig.sysbuild +++ /dev/null @@ -1,13 +0,0 @@ -# -# Copyright (c) 2024 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: Apache-2.0 -# - -config WIFI_NRF70 - default y if BOARD_NRF7002DK_NRF5340_CPUAPP || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS - -source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/samples/net/mdns_responder/Kconfig.sysbuild b/samples/net/mdns_responder/Kconfig.sysbuild deleted file mode 100644 index 158551060c56..000000000000 --- a/samples/net/mdns_responder/Kconfig.sysbuild +++ /dev/null @@ -1,13 +0,0 @@ -# -# Copyright (c) 2024 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: Apache-2.0 -# - -config WIFI_NRF70 - default y if BOARD_NRF7002DK_NRF5340_CPUAPP || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS - -source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/samples/net/mqtt_publisher/Kconfig.sysbuild b/samples/net/mqtt_publisher/Kconfig.sysbuild deleted file mode 100644 index 158551060c56..000000000000 --- a/samples/net/mqtt_publisher/Kconfig.sysbuild +++ /dev/null @@ -1,13 +0,0 @@ -# -# Copyright (c) 2024 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: Apache-2.0 -# - -config WIFI_NRF70 - default y if BOARD_NRF7002DK_NRF5340_CPUAPP || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS - -source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/samples/net/mqtt_sn_publisher/Kconfig.sysbuild b/samples/net/mqtt_sn_publisher/Kconfig.sysbuild deleted file mode 100644 index 158551060c56..000000000000 --- a/samples/net/mqtt_sn_publisher/Kconfig.sysbuild +++ /dev/null @@ -1,13 +0,0 @@ -# -# Copyright (c) 2024 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: Apache-2.0 -# - -config WIFI_NRF70 - default y if BOARD_NRF7002DK_NRF5340_CPUAPP || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS - -source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/samples/net/sockets/coap_server/Kconfig.sysbuild b/samples/net/sockets/coap_server/Kconfig.sysbuild deleted file mode 100644 index 158551060c56..000000000000 --- a/samples/net/sockets/coap_server/Kconfig.sysbuild +++ /dev/null @@ -1,13 +0,0 @@ -# -# Copyright (c) 2024 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: Apache-2.0 -# - -config WIFI_NRF70 - default y if BOARD_NRF7002DK_NRF5340_CPUAPP || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS - -source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/samples/net/sockets/echo_async/Kconfig.sysbuild b/samples/net/sockets/echo_async/Kconfig.sysbuild deleted file mode 100644 index 158551060c56..000000000000 --- a/samples/net/sockets/echo_async/Kconfig.sysbuild +++ /dev/null @@ -1,13 +0,0 @@ -# -# Copyright (c) 2024 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: Apache-2.0 -# - -config WIFI_NRF70 - default y if BOARD_NRF7002DK_NRF5340_CPUAPP || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS - -source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/samples/net/sockets/echo_client/Kconfig.sysbuild b/samples/net/sockets/echo_client/Kconfig.sysbuild deleted file mode 100644 index 158551060c56..000000000000 --- a/samples/net/sockets/echo_client/Kconfig.sysbuild +++ /dev/null @@ -1,13 +0,0 @@ -# -# Copyright (c) 2024 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: Apache-2.0 -# - -config WIFI_NRF70 - default y if BOARD_NRF7002DK_NRF5340_CPUAPP || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS - -source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/samples/net/sockets/echo_server/Kconfig.sysbuild b/samples/net/sockets/echo_server/Kconfig.sysbuild deleted file mode 100644 index 158551060c56..000000000000 --- a/samples/net/sockets/echo_server/Kconfig.sysbuild +++ /dev/null @@ -1,13 +0,0 @@ -# -# Copyright (c) 2024 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: Apache-2.0 -# - -config WIFI_NRF70 - default y if BOARD_NRF7002DK_NRF5340_CPUAPP || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS - -source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/samples/net/sockets/http_get/Kconfig.sysbuild b/samples/net/sockets/http_get/Kconfig.sysbuild deleted file mode 100644 index 158551060c56..000000000000 --- a/samples/net/sockets/http_get/Kconfig.sysbuild +++ /dev/null @@ -1,13 +0,0 @@ -# -# Copyright (c) 2024 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: Apache-2.0 -# - -config WIFI_NRF70 - default y if BOARD_NRF7002DK_NRF5340_CPUAPP || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS - -source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/samples/net/sockets/sntp_client/Kconfig.sysbuild b/samples/net/sockets/sntp_client/Kconfig.sysbuild deleted file mode 100644 index 158551060c56..000000000000 --- a/samples/net/sockets/sntp_client/Kconfig.sysbuild +++ /dev/null @@ -1,13 +0,0 @@ -# -# Copyright (c) 2024 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: Apache-2.0 -# - -config WIFI_NRF70 - default y if BOARD_NRF7002DK_NRF5340_CPUAPP || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS - -source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/samples/net/syslog_net/Kconfig.sysbuild b/samples/net/syslog_net/Kconfig.sysbuild deleted file mode 100644 index 158551060c56..000000000000 --- a/samples/net/syslog_net/Kconfig.sysbuild +++ /dev/null @@ -1,13 +0,0 @@ -# -# Copyright (c) 2024 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: Apache-2.0 -# - -config WIFI_NRF70 - default y if BOARD_NRF7002DK_NRF5340_CPUAPP || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS - -source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/samples/net/telnet/Kconfig.sysbuild b/samples/net/telnet/Kconfig.sysbuild deleted file mode 100644 index 158551060c56..000000000000 --- a/samples/net/telnet/Kconfig.sysbuild +++ /dev/null @@ -1,13 +0,0 @@ -# -# Copyright (c) 2024 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: Apache-2.0 -# - -config WIFI_NRF70 - default y if BOARD_NRF7002DK_NRF5340_CPUAPP || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS - -source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/samples/net/wifi/Kconfig.sysbuild b/samples/net/wifi/Kconfig.sysbuild deleted file mode 100644 index 158551060c56..000000000000 --- a/samples/net/wifi/Kconfig.sysbuild +++ /dev/null @@ -1,13 +0,0 @@ -# -# Copyright (c) 2024 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: Apache-2.0 -# - -config WIFI_NRF70 - default y if BOARD_NRF7002DK_NRF5340_CPUAPP || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS - -source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/samples/net/wifi/shell/sample.yaml b/samples/net/wifi/shell/sample.yaml index 8543e6bfb38b..5f72e0686116 100644 --- a/samples/net/wifi/shell/sample.yaml +++ b/samples/net/wifi/shell/sample.yaml @@ -58,7 +58,6 @@ tests: - nrf7002dk/nrf5340/cpuapp/nrf7001 sample.net.wifi.nrf7002ek: extra_args: - - SB_CONFIG_WIFI_NRF70=y - CONFIG_BUILD_ONLY_NO_BLOBS=y - SHIELD=nrf7002ek platform_allow: @@ -70,7 +69,6 @@ tests: sample.net.wifi.nrf7002eb: extra_args: - CONFIG_NRF70_UTIL=y - - SB_CONFIG_WIFI_NRF70=y - CONFIG_BUILD_ONLY_NO_BLOBS=y - SHIELD=nrf7002eb platform_allow: From 8d85e1df651c0fb5c07caf497917d5a3b4e29c81 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:40 +0300 Subject: [PATCH 1073/2141] Revert "[nrf noup] lib: os: zvfs: Remove EXPERIMENTAL from ZVFS" This reverts commit f52f65458f060758f18daf2b572383b6938eceae. Signed-off-by: Jukka Rissanen --- lib/os/zvfs/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/os/zvfs/Kconfig b/lib/os/zvfs/Kconfig index 495d5c849685..a9c9518a1d5d 100644 --- a/lib/os/zvfs/Kconfig +++ b/lib/os/zvfs/Kconfig @@ -6,6 +6,7 @@ menuconfig ZVFS bool "Zephyr virtual filesystem (ZVFS) support [EXPERIMENTAL]" select FDTABLE + select EXPERIMENTAL help ZVFS is a central, Zephyr-native library that provides a common interoperable API for all types of file descriptors such as those from the non-virtual FS, sockets, eventfds, FILE *'s From ffceca3a9ca44ea72fd29add01d77a4da45f786f Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:40 +0300 Subject: [PATCH 1074/2141] Revert "[nrf noup] kernel: banner: Make function weak" This reverts commit 717e659b48410693135e5e630579ab4671633cb7. Signed-off-by: Jukka Rissanen --- kernel/banner.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/banner.c b/kernel/banner.c index a16784cb975c..5cadda0a5e98 100644 --- a/kernel/banner.c +++ b/kernel/banner.c @@ -24,7 +24,7 @@ #endif /* BUILD_VERSION */ #endif /* !BANNER_VERSION */ -__weak void boot_banner(void) +void boot_banner(void) { #if defined(CONFIG_BOOT_DELAY) && (CONFIG_BOOT_DELAY > 0) #ifdef CONFIG_BOOT_BANNER From e6e219ac5703d34264159629071a6ee3f79ec2c8 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:40 +0300 Subject: [PATCH 1075/2141] Revert "[nrf noup] mbedtls: Don't select PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_BASIC" This reverts commit 34341c43b31bb2c60c84b98e4322b465edd0e433. Signed-off-by: Jukka Rissanen --- modules/mbedtls/Kconfig.mbedtls | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/mbedtls/Kconfig.mbedtls b/modules/mbedtls/Kconfig.mbedtls index 7b5122670e5e..b4c5f48a4287 100644 --- a/modules/mbedtls/Kconfig.mbedtls +++ b/modules/mbedtls/Kconfig.mbedtls @@ -117,7 +117,6 @@ config MBEDTLS_KEY_EXCHANGE_RSA_ENABLED select PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_IMPORT if PSA_CRYPTO_CLIENT select PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_EXPORT if PSA_CRYPTO_CLIENT select PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_GENERATE if PSA_CRYPTO_CLIENT - select PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_DERIVE if PSA_CRYPTO_CLIENT config MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED bool "DHE-RSA based ciphersuite modes" From f8736ed1a355987b765c20ac719f3df550608049 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:40 +0300 Subject: [PATCH 1076/2141] Revert "[nrf noup] mbedtls: Adding missing configuration for RSA key type derive" This reverts commit 414a6c3008ad17b54a22682962c6eddfa47d6368. Signed-off-by: Jukka Rissanen --- modules/mbedtls/Kconfig.psa.auto | 5 ----- 1 file changed, 5 deletions(-) diff --git a/modules/mbedtls/Kconfig.psa.auto b/modules/mbedtls/Kconfig.psa.auto index b235c30380fb..834252432b52 100644 --- a/modules/mbedtls/Kconfig.psa.auto +++ b/modules/mbedtls/Kconfig.psa.auto @@ -298,9 +298,4 @@ config PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_GENERATE select PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY default y if PSA_CRYPTO_ENABLE_ALL -config PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_DERIVE - bool "PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_DERIVE" if !MBEDTLS_PROMPTLESS - select PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY - default y if PSA_CRYPTO_ENABLE_ALL - endif # PSA_CRYPTO_CLIENT From 3cb8b470387e28a9f59865e21e31da742529cf8a Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:40 +0300 Subject: [PATCH 1077/2141] Revert "[nrf noup] mbedtls: Adding helptext warnings for weak crypto" This reverts commit 76dee8cd798e036c3d034df18006e06c1b9431f6. Signed-off-by: Jukka Rissanen --- modules/mbedtls/Kconfig.psa.auto | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/modules/mbedtls/Kconfig.psa.auto b/modules/mbedtls/Kconfig.psa.auto index 834252432b52..fa8cdbc7b536 100644 --- a/modules/mbedtls/Kconfig.psa.auto +++ b/modules/mbedtls/Kconfig.psa.auto @@ -88,9 +88,7 @@ config PSA_WANT_ALG_HMAC config PSA_WANT_ALG_MD5 bool "PSA_WANT_ALG_MD5" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL - help - Warning: The MD5 hash is weak and deprecated and is only recommended - for use in legacy protocols. + config PSA_WANT_ALG_PBKDF2_HMAC bool "PSA_WANT_ALG_PBKDF2_HMAC" if !MBEDTLS_PROMPTLESS @@ -121,9 +119,6 @@ config PSA_WANT_ALG_RSA_PSS config PSA_WANT_ALG_SHA_1 bool "PSA_WANT_ALG_SHA_1" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL - help - Warning: The SHA-1 hash is weak and deprecated and is only recommended - for use in legacy protocols. config PSA_WANT_ALG_SHA_224 bool "PSA_WANT_ALG_SHA_224" if !MBEDTLS_PROMPTLESS From 54148f948a67669778bbdc5db2b5a78dfbfd982c Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:41 +0300 Subject: [PATCH 1078/2141] Revert "[nrf noup] mbedtls: Add dependency logic for PSA crypto configurations" This reverts commit 2abfddff4d8f12849a31dd0842e0a7a07825847e. Signed-off-by: Jukka Rissanen --- modules/mbedtls/Kconfig.psa.auto | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/modules/mbedtls/Kconfig.psa.auto b/modules/mbedtls/Kconfig.psa.auto index fa8cdbc7b536..56a81dd6efda 100644 --- a/modules/mbedtls/Kconfig.psa.auto +++ b/modules/mbedtls/Kconfig.psa.auto @@ -71,7 +71,6 @@ config PSA_WANT_ALG_GCM config PSA_WANT_ALG_HKDF bool "PSA_WANT_ALG_HKDF" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL - depends on PSA_WANT_ALG_HMAC config PSA_WANT_ALG_HKDF_EXTRACT bool "PSA_WANT_ALG_HKDF_EXTRACT" if !MBEDTLS_PROMPTLESS @@ -93,12 +92,11 @@ config PSA_WANT_ALG_MD5 config PSA_WANT_ALG_PBKDF2_HMAC bool "PSA_WANT_ALG_PBKDF2_HMAC" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL - depends on PSA_WANT_ALG_HMAC config PSA_WANT_ALG_PBKDF2_AES_CMAC_PRF_128 bool "PSA_WANT_ALG_PBKDF2_AES_CMAC_PRF_128" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL - depends on PSA_WANT_ALG_CMAC + config PSA_WANT_ALG_RSA_OAEP bool "PSA_WANT_ALG_RSA_OAEP" if !MBEDTLS_PROMPTLESS @@ -155,22 +153,18 @@ config PSA_WANT_ALG_SHA3_512 config PSA_WANT_ALG_STREAM_CIPHER bool "PSA_WANT_ALG_STREAM_CIPHER" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL - select PSA_WANT_KEY_TYPE_CHACHA20 config PSA_WANT_ALG_TLS12_PRF bool "PSA_WANT_ALG_TLS12_PRF" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL - depends on PSA_WANT_ALG_HMAC config PSA_WANT_ALG_TLS12_PSK_TO_MS bool "PSA_WANT_ALG_TLS12_PSK_TO_MS" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL - depends on PSA_WANT_ALG_HMAC config PSA_WANT_ALG_TLS12_ECJPAKE_TO_PMS bool "PSA_WANT_ALG_TLS12_ECJPAKE_TO_PMS" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL - depends on PSA_WANT_ALG_SHA_256 config PSA_WANT_ECC_BRAINPOOL_P_R1_256 bool "PSA_WANT_ECC_BRAINPOOL_P_R1_256" if !MBEDTLS_PROMPTLESS @@ -243,8 +237,7 @@ config PSA_WANT_KEY_TYPE_AES config PSA_WANT_KEY_TYPE_CHACHA20 bool "PSA_WANT_KEY_TYPE_CHACHA20" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL - depends on PSA_WANT_ALG_CHACHA20_POLY1305 || \ - PSA_WANT_ALG_STREAM_CIPHER + config PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY bool "PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY" if !MBEDTLS_PROMPTLESS @@ -260,37 +253,30 @@ config PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY config PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT bool "PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT" if !MBEDTLS_PROMPTLESS - select PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY default y if PSA_CRYPTO_ENABLE_ALL config PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_EXPORT bool "PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_EXPORT" if !MBEDTLS_PROMPTLESS - select PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY default y if PSA_CRYPTO_ENABLE_ALL config PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_GENERATE bool "PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_GENERATE" if !MBEDTLS_PROMPTLESS - select PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY default y if PSA_CRYPTO_ENABLE_ALL config PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_DERIVE bool "PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_DERIVE" if !MBEDTLS_PROMPTLESS - select PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY default y if PSA_CRYPTO_ENABLE_ALL config PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_IMPORT bool "PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_IMPORT" if !MBEDTLS_PROMPTLESS - select PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY default y if PSA_CRYPTO_ENABLE_ALL config PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_EXPORT bool "PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_EXPORT" if !MBEDTLS_PROMPTLESS - select PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY default y if PSA_CRYPTO_ENABLE_ALL config PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_GENERATE bool "PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_GENERATE" if !MBEDTLS_PROMPTLESS - select PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY default y if PSA_CRYPTO_ENABLE_ALL endif # PSA_CRYPTO_CLIENT From f2f95dbee59375fedf27fc07f597cb5376f2b79c Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:41 +0300 Subject: [PATCH 1079/2141] Revert "[nrf noup] mbedtls: Remove unsupported algorithms in PSA crypto" This reverts commit 32fa048131dc1eb8dd223c99c3e40649efb720bf. Signed-off-by: Jukka Rissanen --- modules/mbedtls/Kconfig.psa.auto | 61 +++++++++++++++++++++++++++++++ modules/mbedtls/Kconfig.psa.logic | 7 ++++ 2 files changed, 68 insertions(+) diff --git a/modules/mbedtls/Kconfig.psa.auto b/modules/mbedtls/Kconfig.psa.auto index 56a81dd6efda..08b1bbc02410 100644 --- a/modules/mbedtls/Kconfig.psa.auto +++ b/modules/mbedtls/Kconfig.psa.auto @@ -36,6 +36,10 @@ config PSA_WANT_ALG_CMAC bool "PSA_WANT_ALG_CMAC" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL +config PSA_WANT_ALG_CFB + bool "PSA_WANT_ALG_CFB" if !MBEDTLS_PROMPTLESS + default y if PSA_CRYPTO_ENABLE_ALL + config PSA_WANT_ALG_CHACHA20_POLY1305 bool "PSA_WANT_ALG_CHACHA20_POLY1305" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL @@ -56,6 +60,10 @@ config PSA_WANT_ALG_ECDH bool "PSA_WANT_ALG_ECDH" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL +config PSA_WANT_ALG_FFDH + bool "PSA_WANT_ALG_FFDH" if !MBEDTLS_PROMPTLESS + default y if PSA_CRYPTO_ENABLE_ALL + config PSA_WANT_ALG_ECDSA bool "PSA_WANT_ALG_ECDSA" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL @@ -88,6 +96,9 @@ config PSA_WANT_ALG_MD5 bool "PSA_WANT_ALG_MD5" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL +config PSA_WANT_ALG_OFB + bool "PSA_WANT_ALG_OFB" if !MBEDTLS_PROMPTLESS + default y if PSA_CRYPTO_ENABLE_ALL config PSA_WANT_ALG_PBKDF2_HMAC bool "PSA_WANT_ALG_PBKDF2_HMAC" if !MBEDTLS_PROMPTLESS @@ -97,6 +108,9 @@ config PSA_WANT_ALG_PBKDF2_AES_CMAC_PRF_128 bool "PSA_WANT_ALG_PBKDF2_AES_CMAC_PRF_128" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL +config PSA_WANT_ALG_RIPEMD160 + bool "PSA_WANT_ALG_RIPEMD160" if !MBEDTLS_PROMPTLESS + default y if PSA_CRYPTO_ENABLE_ALL config PSA_WANT_ALG_RSA_OAEP bool "PSA_WANT_ALG_RSA_OAEP" if !MBEDTLS_PROMPTLESS @@ -214,6 +228,26 @@ config PSA_WANT_ECC_SECP_R1_521 bool "PSA_WANT_ECC_SECP_R1_521" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL +config PSA_WANT_DH_RFC7919_2048 + bool "PSA_WANT_DH_RFC7919_2048" if !MBEDTLS_PROMPTLESS + default y if PSA_CRYPTO_ENABLE_ALL + +config PSA_WANT_DH_RFC7919_3072 + bool "PSA_WANT_DH_RFC7919_3072" if !MBEDTLS_PROMPTLESS + default y if PSA_CRYPTO_ENABLE_ALL + +config PSA_WANT_DH_RFC7919_4096 + bool "PSA_WANT_DH_RFC7919_4096" if !MBEDTLS_PROMPTLESS + default y if PSA_CRYPTO_ENABLE_ALL + +config PSA_WANT_DH_RFC7919_6144 + bool "PSA_WANT_DH_RFC7919_6144" if !MBEDTLS_PROMPTLESS + default y if PSA_CRYPTO_ENABLE_ALL + +config PSA_WANT_DH_RFC7919_8192 + bool "PSA_WANT_DH_RFC7919_8192" if !MBEDTLS_PROMPTLESS + default y if PSA_CRYPTO_ENABLE_ALL + config PSA_WANT_KEY_TYPE_DERIVE bool "PSA_WANT_KEY_TYPE_DERIVE" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL @@ -234,15 +268,30 @@ config PSA_WANT_KEY_TYPE_AES bool "PSA_WANT_KEY_TYPE_AES" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL +config PSA_WANT_KEY_TYPE_ARIA + bool "PSA_WANT_KEY_TYPE_ARIA" if !MBEDTLS_PROMPTLESS + default y if PSA_CRYPTO_ENABLE_ALL + +config PSA_WANT_KEY_TYPE_CAMELLIA + bool "PSA_WANT_KEY_TYPE_CAMELLIA" if !MBEDTLS_PROMPTLESS + default y if PSA_CRYPTO_ENABLE_ALL + config PSA_WANT_KEY_TYPE_CHACHA20 bool "PSA_WANT_KEY_TYPE_CHACHA20" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL +config PSA_WANT_KEY_TYPE_DES + bool "PSA_WANT_KEY_TYPE_DES" if !MBEDTLS_PROMPTLESS + default y if PSA_CRYPTO_ENABLE_ALL config PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY bool "PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL +config PSA_WANT_KEY_TYPE_DH_PUBLIC_KEY + bool "PSA_WANT_KEY_TYPE_DH_PUBLIC_KEY" if !MBEDTLS_PROMPTLESS + default y if PSA_CRYPTO_ENABLE_ALL + config PSA_WANT_KEY_TYPE_RAW_DATA bool "PSA_WANT_KEY_TYPE_RAW_DATA" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL @@ -279,4 +328,16 @@ config PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_GENERATE bool "PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_GENERATE" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL +config PSA_WANT_KEY_TYPE_DH_KEY_PAIR_IMPORT + bool "PSA_WANT_KEY_TYPE_DH_KEY_PAIR_IMPORT" if !MBEDTLS_PROMPTLESS + default y if PSA_CRYPTO_ENABLE_ALL + +config PSA_WANT_KEY_TYPE_DH_KEY_PAIR_EXPORT + bool "PSA_WANT_KEY_TYPE_DH_KEY_PAIR_EXPORT" if !MBEDTLS_PROMPTLESS + default y if PSA_CRYPTO_ENABLE_ALL + +config PSA_WANT_KEY_TYPE_DH_KEY_PAIR_GENERATE + bool "PSA_WANT_KEY_TYPE_DH_KEY_PAIR_GENERATE" if !MBEDTLS_PROMPTLESS + default y if PSA_CRYPTO_ENABLE_ALL + endif # PSA_CRYPTO_CLIENT diff --git a/modules/mbedtls/Kconfig.psa.logic b/modules/mbedtls/Kconfig.psa.logic index 2de81163dc1f..dcea9e354052 100644 --- a/modules/mbedtls/Kconfig.psa.logic +++ b/modules/mbedtls/Kconfig.psa.logic @@ -18,3 +18,10 @@ config PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_BASIC depends on PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_IMPORT || \ PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_EXPORT || \ PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_GENERATE + +config PSA_WANT_KEY_TYPE_DH_KEY_PAIR_BASIC + bool + default y + depends on PSA_WANT_KEY_TYPE_DH_KEY_PAIR_IMPORT || \ + PSA_WANT_KEY_TYPE_DH_KEY_PAIR_EXPORT || \ + PSA_WANT_KEY_TYPE_DH_KEY_PAIR_GENERATE From 37f00e72c7b99e917b6018903ef7fa0cf66c00db Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:41 +0300 Subject: [PATCH 1080/2141] Revert "[nrf noup] mbedtls: Enable PSA_WANT_GENERATE_RANDOM for PSA RNG" This reverts commit 3c07722fbc78e7432f561696e82bf77982f4550a. Signed-off-by: Jukka Rissanen --- drivers/entropy/Kconfig.psa_crypto | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/entropy/Kconfig.psa_crypto b/drivers/entropy/Kconfig.psa_crypto index 18514a071d1c..d06001225b05 100644 --- a/drivers/entropy/Kconfig.psa_crypto +++ b/drivers/entropy/Kconfig.psa_crypto @@ -7,7 +7,6 @@ config ENTROPY_PSA_CRYPTO_RNG bool "PSA Crypto Random source Entropy driver" depends on DT_HAS_ZEPHYR_PSA_CRYPTO_RNG_ENABLED select ENTROPY_HAS_DRIVER - select PSA_WANT_GENERATE_RANDOM default y help Enable the PSA Crypto source Entropy driver. From bddd22cd721b4adee30087b1cad181198a325464 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:41 +0300 Subject: [PATCH 1081/2141] Revert "[nrf noup] modules: mbedtls: Disable configurations in Kconfig.tls-generic" This reverts commit c62b6ebb411e687814e89652273b333a4b47bbae. Signed-off-by: Jukka Rissanen --- modules/mbedtls/Kconfig.mbedtls | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/modules/mbedtls/Kconfig.mbedtls b/modules/mbedtls/Kconfig.mbedtls index b4c5f48a4287..e534ba0c10a8 100644 --- a/modules/mbedtls/Kconfig.mbedtls +++ b/modules/mbedtls/Kconfig.mbedtls @@ -7,8 +7,6 @@ menu "Mbed TLS configuration" depends on MBEDTLS_BUILTIN && MBEDTLS_CFG_FILE = "config-mbedtls.h" -if !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) - menu "TLS" config MBEDTLS_TLS_VERSION_1_2 @@ -42,8 +40,6 @@ endif # MBEDTLS_TLS_VERSION_1_2 || MBEDTLS_TLS_VERSION_1_3 endmenu # TLS -endif # !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) - menu "Ciphersuite configuration" comment "Supported key exchange modes" @@ -64,8 +60,6 @@ config MBEDTLS_GENPRIME_ENABLED endif # MBEDTLS_RSA_C -if !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) - config MBEDTLS_KEY_EXCHANGE_ALL_ENABLED bool "All available ciphersuite modes" select MBEDTLS_MD @@ -98,8 +92,6 @@ config MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED bool "RSA-PSK based ciphersuite modes" depends on MBEDTLS_PKCS1_V15 || MBEDTLS_PKCS1_V21 -endif # !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) - config MBEDTLS_PSK_MAX_LEN int "Max size of TLS pre-shared keys" default 32 @@ -107,8 +99,6 @@ config MBEDTLS_PSK_MAX_LEN Max size of TLS pre-shared keys, in bytes. It has no effect if no PSK key exchange is used. -if !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) - config MBEDTLS_KEY_EXCHANGE_RSA_ENABLED bool "RSA-only based ciphersuite modes" depends on MBEDTLS_MD @@ -246,12 +236,8 @@ config MBEDTLS_ECP_NIST_OPTIM endif -endif # !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) - comment "Supported ciphers and cipher modes" -if !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) - config MBEDTLS_CIPHER_ALL_ENABLED bool "All available ciphers and modes" select MBEDTLS_CIPHER_AES_ENABLED @@ -342,12 +328,8 @@ config MBEDTLS_CMAC bool "CMAC (Cipher-based Message Authentication Code) mode for block ciphers." depends on MBEDTLS_CIPHER_AES_ENABLED || MBEDTLS_CIPHER_DES_ENABLED -endif # !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) - comment "Supported hash algorithms" -if !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) - config MBEDTLS_HASH_ALL_ENABLED bool "All available MAC methods" select MBEDTLS_MD5 @@ -388,14 +370,10 @@ config MBEDTLS_SHA512 config MBEDTLS_POLY1305 bool "Poly1305 hash family" -endif # !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) - endmenu comment "Random number generators" -if !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) - config MBEDTLS_CTR_DRBG_ENABLED bool "CTR_DRBG AES-256-based random generator" depends on MBEDTLS_CIPHER_AES_ENABLED @@ -405,21 +383,15 @@ config MBEDTLS_HMAC_DRBG_ENABLED bool "HMAC_DRBG random generator" select MBEDTLS_MD -endif # !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) - comment "Other configurations" config MBEDTLS_CIPHER bool "generic cipher layer." default y if PSA_WANT_ALG_CMAC -if !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) - config MBEDTLS_MD bool "generic message digest layer." -endif # !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) - config MBEDTLS_ASN1_PARSE_C bool "Support for ASN1 parser functions" @@ -459,8 +431,6 @@ config MBEDTLS_HAVE_ASM of asymmetric cryptography, however this might have an impact on the code size. -if !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) - config MBEDTLS_ENTROPY_C bool "Mbed TLS entropy accumulator" depends on MBEDTLS_SHA256 || MBEDTLS_SHA384 || MBEDTLS_SHA512 @@ -469,8 +439,6 @@ config MBEDTLS_ENTROPY_C mostly used in conjunction with CTR_DRBG or HMAC_DRBG to create a deterministic random number generator. -endif # !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) - config MBEDTLS_ENTROPY_POLL_ZEPHYR bool "Provide entropy data to Mbed TLS through entropy driver or random generator" default y From 365196d8b2d192c70cbf90f6c062d405946224c9 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:41 +0300 Subject: [PATCH 1082/2141] Revert "[nrf noup] samples: basic: blinky: add eGPIO tests configuration" This reverts commit 40b222de413d542f187f039da8eb1e9e3d9a359d. Signed-off-by: Jukka Rissanen --- .../boards/nrf54l15dk_nrf54l15_cpuapp_hpf_gpio.overlay | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 samples/basic/blinky/boards/nrf54l15dk_nrf54l15_cpuapp_hpf_gpio.overlay diff --git a/samples/basic/blinky/boards/nrf54l15dk_nrf54l15_cpuapp_hpf_gpio.overlay b/samples/basic/blinky/boards/nrf54l15dk_nrf54l15_cpuapp_hpf_gpio.overlay deleted file mode 100644 index bd1ceb2f8945..000000000000 --- a/samples/basic/blinky/boards/nrf54l15dk_nrf54l15_cpuapp_hpf_gpio.overlay +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -&led0 { - gpios = <&hpf_gpio 9 GPIO_ACTIVE_HIGH>; -}; From 5a3a0ab423a329df0baf17252c3a3b4f4d272414 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:41 +0300 Subject: [PATCH 1083/2141] Revert "[nrf noup] boards/nordic/nrf54l15dk: Set ROM offset by PM" This reverts commit cea66ec75f604cbdc74f67165cb50ea478c716cd. Signed-off-by: Jukka Rissanen --- boards/nordic/nrf54l15dk/Kconfig.defconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/boards/nordic/nrf54l15dk/Kconfig.defconfig b/boards/nordic/nrf54l15dk/Kconfig.defconfig index fb63aaecb441..0661366e911d 100644 --- a/boards/nordic/nrf54l15dk/Kconfig.defconfig +++ b/boards/nordic/nrf54l15dk/Kconfig.defconfig @@ -8,7 +8,6 @@ if BOARD_NRF54L15DK_NRF54L05_CPUAPP || BOARD_NRF54L15DK_NRF54L10_CPUAPP || \ BOARD_NRF54L15DK_NRF54L15_CPUAPP config ROM_START_OFFSET - default 0 if PARTITION_MANAGER_ENABLED default 0x800 if BOOTLOADER_MCUBOOT endif # BOARD_NRF54L15DK_NRF54L05_CPUAPP || BOARD_NRF54L15DK_NRF54L10_CPUAPP || \ From f17b2aeecafd1843f63e6c20ca256c45d89db5d9 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:41 +0300 Subject: [PATCH 1084/2141] Revert "[nrf noup] mgmt: mcumgr: grp: img_mgmt: Add handling for QSPI XIP" This reverts commit a5b67c16269292d3f1f921238591cb8cb848c004. Signed-off-by: Jukka Rissanen --- subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig | 8 -------- subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c | 8 -------- 2 files changed, 16 deletions(-) diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig b/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig index 5f122fcf71fc..0915d70e8706 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig @@ -219,14 +219,6 @@ config MCUMGR_GRP_IMG_SLOT_INFO_HOOKS This will enable the slot info function hooks which can be used to add additional information to responses. -config MCUMGR_GRP_IMG_QSPI_XIP_SPLIT_IMAGE - bool "QSPI XIP Split image mode" - depends on MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP - help - This option should not be selected by users and should automatically be selected by - sysbuild if needed. This enables selecting the correct slot when running a QSPI XIP - split image application in DirectXIP mode. - module = MCUMGR_GRP_IMG module-str = mcumgr_grp_img source "subsys/logging/Kconfig.template.log_config" diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c index b53f1b214658..d0303360f691 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c @@ -235,14 +235,6 @@ int img_mgmt_active_slot(int image) /* Multi image does not support DirectXIP or RAM load currently */ #if CONFIG_MCUMGR_GRP_IMG_UPDATABLE_IMAGE_NUMBER > 1 slot = (image << 1); - -#if defined(CONFIG_MCUMGR_GRP_IMG_QSPI_XIP_SPLIT_IMAGE) || \ - defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP) || \ - defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP_WITH_REVERT) - if (FIXED_PARTITION_IS_RUNNING_APP_PARTITION(slot1_partition)) { - slot += 1; - } -#endif #elif defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_RAM_LOAD) /* RAM load requires querying bootloader */ int rc; From 94700f1a28dc8af2ffe04782fa4dfd8d9a4fae3f Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:41 +0300 Subject: [PATCH 1085/2141] Revert "[nrf noup] board: nordic_ thingy53: Enable QSPI by default" This reverts commit 20671bcf45981a4491aea49326e530978e79d792. Signed-off-by: Jukka Rissanen --- boards/nordic/thingy53/Kconfig.defconfig | 3 --- 1 file changed, 3 deletions(-) diff --git a/boards/nordic/thingy53/Kconfig.defconfig b/boards/nordic/thingy53/Kconfig.defconfig index b7f33e89bf1b..badcb5c20e5d 100644 --- a/boards/nordic/thingy53/Kconfig.defconfig +++ b/boards/nordic/thingy53/Kconfig.defconfig @@ -97,9 +97,6 @@ config MCUBOOT_USB_SUPPORT bool default n -config NORDIC_QSPI_NOR - default y - endif # BOARD_THINGY53_NRF5340_CPUAPP || BOARD_THINGY53_NRF5340_CPUAPP_NS if BOARD_THINGY53_NRF5340_CPUNET From ecb289fdbe516a5a1e04786cc621993efdafeb22 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:41 +0300 Subject: [PATCH 1086/2141] Revert "[nrf noup] bluetooth: att: Allow ATT sent callback after data TX is done" This reverts commit 5b9ea8c24b78a4be7e83f5cdbe1fead42b659f44. Signed-off-by: Jukka Rissanen --- subsys/bluetooth/host/Kconfig.gatt | 17 ----------------- subsys/bluetooth/host/att.c | 17 +---------------- 2 files changed, 1 insertion(+), 33 deletions(-) diff --git a/subsys/bluetooth/host/Kconfig.gatt b/subsys/bluetooth/host/Kconfig.gatt index 221bc413c4bc..a04241a3e94f 100644 --- a/subsys/bluetooth/host/Kconfig.gatt +++ b/subsys/bluetooth/host/Kconfig.gatt @@ -38,23 +38,6 @@ config BT_ATT_RETRY_ON_SEC_ERR If an ATT request fails due to insufficient security, the host will try to elevate the security level and retry the ATT request. -config BT_ATT_SENT_CB_AFTER_TX - bool "Delay ATT sent callback until data transmission is done by controller [EXPERIMENTAL]" - select EXPERIMENTAL - help - By default, the BLE stack calls sent callback for ATT data when the - data is passed to BLE controller for transmission. Enabling this - Kconfig option delays calling the sent callback until data - transmission is finished by BLE controller (the callback is called - upon receiving the Number of Completed Packets HCI Event). - - The feature is not available in Zephyr RTOS (it's specific to NCS - Zephyr fork). It is a temporary solution allowing to control flow of - GATT notifications with HID reports for HID use-case. - - Enabling this option may require increasing CONFIG_BT_CONN_TX_MAX in - configuration, because ATT would use additional TX contexts. - config BT_EATT bool "Enhanced ATT Bearers support [EXPERIMENTAL]" depends on BT_L2CAP_ECRED diff --git a/subsys/bluetooth/host/att.c b/subsys/bluetooth/host/att.c index 7fac12a6fb97..98b310f4b4b0 100644 --- a/subsys/bluetooth/host/att.c +++ b/subsys/bluetooth/host/att.c @@ -328,13 +328,6 @@ static void att_disconnect(struct bt_att_chan *chan) } } -static void chan_sent_cb(struct bt_conn *conn, void *user_data, int err) -{ - struct net_buf *nb = user_data; - - net_buf_unref(nb); -} - /* In case of success the ownership of the buffer is transferred to the stack * which takes care of releasing it when it completes transmitting to the * controller. @@ -428,15 +421,7 @@ static int chan_send(struct bt_att_chan *chan, struct net_buf *buf) data->att_chan = chan; - if (IS_ENABLED(CONFIG_BT_ATT_SENT_CB_AFTER_TX)) { - err = bt_l2cap_send_pdu(&chan->chan, buf, chan_sent_cb, net_buf_ref(buf)); - if (err) { - net_buf_unref(buf); - } - } else { - err = bt_l2cap_send_pdu(&chan->chan, buf, NULL, NULL); - } - + err = bt_l2cap_send_pdu(&chan->chan, buf, NULL, NULL); if (err) { if (err == -ENOBUFS) { LOG_ERR("Ran out of TX buffers or contexts."); From bdd7ce0be1a4d650bf73684fc1a02121681f08c2 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:41 +0300 Subject: [PATCH 1087/2141] Revert "[nrf noup] dts: Add Bluetooth Controller to nRF54H20" This reverts commit 6f17dc3e1d057a260efb291a63f4d2d94cb94d6d. Signed-off-by: Jukka Rissanen --- dts/arm/nordic/nrf54h20_cpurad.dtsi | 8 -------- dts/vendor/nordic/nrf54h20.dtsi | 8 -------- 2 files changed, 16 deletions(-) diff --git a/dts/arm/nordic/nrf54h20_cpurad.dtsi b/dts/arm/nordic/nrf54h20_cpurad.dtsi index 2cfda47afc55..2d2fdee8d270 100644 --- a/dts/arm/nordic/nrf54h20_cpurad.dtsi +++ b/dts/arm/nordic/nrf54h20_cpurad.dtsi @@ -23,10 +23,6 @@ wdt011: &cpurad_wdt011 {}; /delete-node/ &cpuflpr; / { - chosen { - zephyr,bt-hci = &bt_hci_controller; - }; - soc { compatible = "simple-bus"; interrupt-parent = <&cpurad_nvic>; @@ -103,7 +99,3 @@ wdt011: &cpurad_wdt011 {}; &dppic020 { status = "okay"; }; - -&bt_hci_controller { - status = "okay"; -}; diff --git a/dts/vendor/nordic/nrf54h20.dtsi b/dts/vendor/nordic/nrf54h20.dtsi index 8dcd8700b274..05ae6df5d0f6 100644 --- a/dts/vendor/nordic/nrf54h20.dtsi +++ b/dts/vendor/nordic/nrf54h20.dtsi @@ -449,14 +449,6 @@ compatible = "nordic,nrf-ieee802154"; status = "disabled"; }; - - /* Note: In the nRF Connect SDK the SoftDevice Controller - * is added and set as the default Bluetooth Controller. - */ - bt_hci_controller: bt_hci_controller { - compatible = "zephyr,bt-hci-ll-sw-split"; - status = "disabled"; - }; }; ccm030: ccm@3a000 { From bffcf75e9f5df2e38ecdb4dfb440929425e44791 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:41 +0300 Subject: [PATCH 1088/2141] Revert "[nrf noup] drivers: flash: kconfig: nrf_rram region resolution" This reverts commit 73823d3b105fd8547e1363ec07d91d0da1665ba1. Signed-off-by: Jukka Rissanen --- drivers/flash/Kconfig.nrf_rram | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/flash/Kconfig.nrf_rram b/drivers/flash/Kconfig.nrf_rram index a59560e86a46..3dea687a0f80 100644 --- a/drivers/flash/Kconfig.nrf_rram +++ b/drivers/flash/Kconfig.nrf_rram @@ -70,14 +70,14 @@ config SOC_FLASH_NRF_TIMEOUT_MULTIPLIER config NRF_RRAM_REGION_ADDRESS_RESOLUTION hex - default 0x1000 + default 0x400 help RRAMC's region protection address resolution. Applies to region with configurable start address. config NRF_RRAM_REGION_SIZE_UNIT hex - default 0x1000 + default 0x400 help Base unit for the size of RRAMC's region protection. From fcda239fd1a94ce26304559b786aa5a66e9a184e Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:41 +0300 Subject: [PATCH 1089/2141] Revert "[nrf noup] ci: Enable action-manifest-pr" This reverts commit 7cf6f4fa8083e27ae79ba2c3160a870a1054380e. Signed-off-by: Jukka Rissanen --- .github/workflows/manifest-PR.yml | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 .github/workflows/manifest-PR.yml diff --git a/.github/workflows/manifest-PR.yml b/.github/workflows/manifest-PR.yml deleted file mode 100644 index a871aa381ded..000000000000 --- a/.github/workflows/manifest-PR.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: handle manifest PR -on: - pull_request_target: - types: [opened, synchronize, closed] - branches: - - main - - -jobs: - call-manifest-pr-action: - runs-on: ubuntu-latest - steps: - - name: handle manifest PR - uses: nrfconnect/action-manifest-pr@main - with: - token: ${{ secrets.NCS_GITHUB_TOKEN }} - manifest-pr-title-details: ${{ github.event.pull_request.title }} From 98e0d7d34237fd061b635637b407a494fd8ae89d Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:41 +0300 Subject: [PATCH 1090/2141] Revert "[nrf noup] soc: nordic: nrf54l: Skip clock configuration from ns" This reverts commit 4a163d030c88bc9d9a8c3f2069d4140d1f990d1c. Signed-off-by: Jukka Rissanen --- soc/nordic/nrf54l/Kconfig | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/soc/nordic/nrf54l/Kconfig b/soc/nordic/nrf54l/Kconfig index bc88a62efb7e..2d968a57bbe5 100644 --- a/soc/nordic/nrf54l/Kconfig +++ b/soc/nordic/nrf54l/Kconfig @@ -62,18 +62,10 @@ config SOC_NRF54LM20A_ENGA_CPUFLPR if SOC_SERIES_NRF54LX config SOC_NRF54LX_SKIP_CLOCK_CONFIG - bool - prompt "Skip clock frequency configuration in system initialization" if TRUSTED_EXECUTION_SECURE - default y if TRUSTED_EXECUTION_NONSECURE + bool "Skip clock frequency configuration in system initialization" help - With this option, the CPU clock frequency is not set during this - Zephyr image's system initialization. The CPU runs with either - the HW reset values, or with the configuration set by an image - earlier in the boot chain. - - Note that for security reasons it is not supported to configure - the clock peripheral (NRF_OSCILLATORS) from the non-secure - domain. + With this option, the CPU clock frequency is not set during system initialization. + The CPU runs with the default, hardware-selected frequency. config SOC_NRF54LX_DISABLE_FICR_TRIMCNF bool "Disable trimming of the device" From a4484c67290fd76e7c8eb7a55add3fe24abd53cf Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:41 +0300 Subject: [PATCH 1091/2141] Revert "[nrf noup] settings: nvs: use dedicated lookup cache hash function" This reverts commit 1deb982783fff1ca9368fbe649123fbdeedfd304. Signed-off-by: Jukka Rissanen --- subsys/fs/nvs/Kconfig | 9 --------- subsys/fs/nvs/nvs.c | 46 ------------------------------------------- 2 files changed, 55 deletions(-) diff --git a/subsys/fs/nvs/Kconfig b/subsys/fs/nvs/Kconfig index 21798932f521..48915c2f048e 100644 --- a/subsys/fs/nvs/Kconfig +++ b/subsys/fs/nvs/Kconfig @@ -29,15 +29,6 @@ config NVS_LOOKUP_CACHE_SIZE Number of entries in Non-volatile Storage lookup cache. It is recommended that it be a power of 2. -config NVS_LOOKUP_CACHE_FOR_SETTINGS - bool "Non-volatile Storage lookup cache optimized for settings" - depends on NVS_LOOKUP_CACHE - help - Use the lookup cache hash function that results in the least number of - collissions and, in turn, the best NVS performance provided that the NVS - is used as the settings backend only. This option should NOT be enabled - if the NVS is also written to directly, outside the settings layer. - config NVS_DATA_CRC bool "Non-volatile Storage CRC protection on the data" help diff --git a/subsys/fs/nvs/nvs.c b/subsys/fs/nvs/nvs.c index 103b605d5fcc..2e553fdbf554 100644 --- a/subsys/fs/nvs/nvs.c +++ b/subsys/fs/nvs/nvs.c @@ -13,11 +13,6 @@ #include #include "nvs_priv.h" -#ifdef CONFIG_NVS_LOOKUP_CACHE_FOR_SETTINGS -#include -#include -#endif - #include LOG_MODULE_REGISTER(fs_nvs, CONFIG_NVS_LOG_LEVEL); @@ -26,45 +21,6 @@ static int nvs_ate_valid(struct nvs_fs *fs, const struct nvs_ate *entry); #ifdef CONFIG_NVS_LOOKUP_CACHE -#ifdef CONFIG_NVS_LOOKUP_CACHE_FOR_SETTINGS - -static inline size_t nvs_lookup_cache_pos(uint16_t id) -{ - /* - * 1. The NVS settings backend uses up to (NVS_NAME_ID_OFFSET - 1) NVS IDs to - store keys and equal number of NVS IDs to store values. - * 2. For each key-value pair, the value is stored at NVS ID greater by exactly - * NVS_NAME_ID_OFFSET than NVS ID that holds the key. - * 3. The backend tries to minimize the range of NVS IDs used to store keys. - * That is, NVS IDs are allocated sequentially, and freed NVS IDs are reused - * before allocating new ones. - * - * Therefore, to assure the least number of collisions in the lookup cache, - * the least significant bit of the hash indicates whether the given NVS ID - * represents a key or a value, and remaining bits of the hash are set to - * the ordinal number of the key-value pair. Consequently, the hash function - * provides the following mapping: - * - * 1st settings key => hash 0 - * 1st settings value => hash 1 - * 2nd settings key => hash 2 - * 2nd settings value => hash 3 - * ... - */ - BUILD_ASSERT(IS_POWER_OF_TWO(NVS_NAMECNT_ID), "NVS_NAMECNT_ID is not power of 2"); - BUILD_ASSERT(IS_POWER_OF_TWO(NVS_NAME_ID_OFFSET), "NVS_NAME_ID_OFFSET is not power of 2"); - - uint16_t key_value_bit; - uint16_t key_value_ord; - - key_value_bit = (id >> LOG2(NVS_NAME_ID_OFFSET)) & 1; - key_value_ord = id & (NVS_NAME_ID_OFFSET - 1); - - return ((key_value_ord << 1) | key_value_bit) % CONFIG_NVS_LOOKUP_CACHE_SIZE; -} - -#else /* CONFIG_NVS_LOOKUP_CACHE_FOR_SETTINGS */ - static inline size_t nvs_lookup_cache_pos(uint16_t id) { uint16_t hash; @@ -80,8 +36,6 @@ static inline size_t nvs_lookup_cache_pos(uint16_t id) return hash % CONFIG_NVS_LOOKUP_CACHE_SIZE; } -#endif /* CONFIG_NVS_LOOKUP_CACHE_FOR_SETTINGS */ - static int nvs_lookup_cache_rebuild(struct nvs_fs *fs) { int rc; From a767ee917d014ea2910329fb327fc20d0c262308 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:41 +0300 Subject: [PATCH 1092/2141] Revert "[nrf noup] samples: sysbuild: hello_world: support PM on nRF53" This reverts commit 470fcc9ac884ec9698e1d838160c7c3aadf706e0. Signed-off-by: Jukka Rissanen --- samples/sysbuild/hello_world/sysbuild.cmake | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/samples/sysbuild/hello_world/sysbuild.cmake b/samples/sysbuild/hello_world/sysbuild.cmake index 8f8fc49dbff3..c7c2615c665a 100644 --- a/samples/sysbuild/hello_world/sysbuild.cmake +++ b/samples/sysbuild/hello_world/sysbuild.cmake @@ -11,17 +11,5 @@ ExternalZephyrProject_Add( BOARD ${SB_CONFIG_REMOTE_BOARD} ) -if(SB_CONFIG_SOC_SERIES_NRF53X) - set_property(GLOBAL APPEND PROPERTY PM_DOMAINS CPUNET) - set_property(GLOBAL APPEND PROPERTY PM_CPUNET_IMAGES remote) - set_property(GLOBAL PROPERTY DOMAIN_APP_CPUNET remote) - set(CPUNET_PM_DOMAIN_DYNAMIC_PARTITION remote CACHE INTERNAL "") -else(SB_CONFIG_SOC_SERIES_NRF54LX) - set_property(GLOBAL APPEND PROPERTY PM_DOMAINS CPUFLPR) - set_property(GLOBAL APPEND PROPERTY PM_CPUFLPR_IMAGES remote) - set_property(GLOBAL PROPERTY DOMAIN_APP_CPUFLPR remote) - set(CPUFLPR_PM_DOMAIN_DYNAMIC_PARTITION remote CACHE INTERNAL "") -endif() - add_dependencies(${DEFAULT_IMAGE} remote) sysbuild_add_dependencies(FLASH ${DEFAULT_IMAGE} remote) From 39abaf5c8a2e1f58e48270fb6e189e9911e1615b Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:41 +0300 Subject: [PATCH 1093/2141] Revert "[nrf noup] board: nordic: thingy53: Default to update only MCUboot type" This reverts commit a06f9582999650d0f950952b4799510871e23948. Signed-off-by: Jukka Rissanen --- boards/nordic/thingy53/Kconfig.sysbuild | 7 ------- 1 file changed, 7 deletions(-) diff --git a/boards/nordic/thingy53/Kconfig.sysbuild b/boards/nordic/thingy53/Kconfig.sysbuild index df489c1dd546..c03d191b3708 100644 --- a/boards/nordic/thingy53/Kconfig.sysbuild +++ b/boards/nordic/thingy53/Kconfig.sysbuild @@ -7,10 +7,6 @@ choice BOOTLOADER default BOOTLOADER_MCUBOOT endchoice -choice MCUBOOT_MODE - default MCUBOOT_MODE_OVERWRITE_ONLY -endchoice - config SECURE_BOOT_NETCORE default y @@ -20,9 +16,6 @@ config NETCORE_APP_UPDATE config NRF_DEFAULT_EMPTY default y if SECURE_BOOT_NETCORE -config MCUBOOT_USE_ALL_AVAILABLE_RAM - default y if BOARD_THINGY53_NRF5340_CPUAPP_NS && BOOTLOADER_MCUBOOT - endif # BOARD_THINGY53_NRF5340_CPUAPP || BOARD_THINGY53_NRF5340_CPUAPP_NS config PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY From 2822f41fad1ce192d309df258f34ea92d0c71cf1 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:42 +0300 Subject: [PATCH 1094/2141] =?UTF-8?q?Revert=20"[nrf=20noup]=C2=A0Bluetooth?= =?UTF-8?q?:=20Mesh:=20remove=20legacy=20adv=20support"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 10b13619fcdedaa5ae25f62eb7acd86f5f768635. Signed-off-by: Jukka Rissanen --- subsys/bluetooth/mesh/Kconfig | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index bd0350307ba2..cd3d46190971 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -59,16 +59,12 @@ choice BT_MESH_ADV menuconfig BT_MESH_ADV_LEGACY bool "Legacy advertising" - depends on BT_LL_SW_SPLIT help Use legacy advertising commands for mesh sending. Legacy - advertising is significantly slower than the extended advertising. + advertising is significantly slower than the extended advertising, but + is supported by all controllers. - WARNING: This feature is not supported in NCS. The legacy advertiser will not work - with SDC, as attempting to start an advertisement during the scanner duty cycle - will result in an error. The Zephyr Link Layer can be used experimentally as an - alternative. - The legacy advertiser can occasionally do more message + WARNING: The legacy advertiser can occasionally do more message retransmissions than requested because of limitations of HCI interface API. From 07b05be07f1090bfe7107eb6b2989fb09558f78f Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:42 +0300 Subject: [PATCH 1095/2141] Revert "[nrf noup] kernel: Disable boot banner if NCS_BOOT_BANNER is enabled" This reverts commit 4b7a867eabe9e6e3724e8b3c210b9506c9c2cfef. Signed-off-by: Jukka Rissanen --- kernel/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/kernel/Kconfig b/kernel/Kconfig index c2976b9f281f..838d44afbf9e 100644 --- a/kernel/Kconfig +++ b/kernel/Kconfig @@ -457,7 +457,6 @@ config SKIP_BSS_CLEAR config BOOT_BANNER bool "Boot banner" default y - depends on !NCS_BOOT_BANNER select PRINTK select EARLY_CONSOLE help From 5c8fd174c800b17e502c93e6d07bcd9617c475ac Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:42 +0300 Subject: [PATCH 1096/2141] Revert "[nrf noup] tree-wide: support NCS Partition Manager (PM) definitions" This reverts commit 5c2eecf1ef8bc3bc714dff8adf8f023bd921227a. Signed-off-by: Jukka Rissanen --- arch/arm/core/mpu/arm_mpu_regions.c | 13 ----- cmake/linker/ld/target.cmake | 1 - cmake/linker/lld/target.cmake | 1 - cmake/modules/kernel.cmake | 4 -- drivers/flash/soc_flash_nrf.c | 11 ---- drivers/flash/soc_flash_nrf_rram.c | 11 ---- .../arch/arm/cortex_m/scripts/linker.ld | 50 ------------------- include/zephyr/storage/flash_map.h | 6 --- lib/heap/Kconfig | 2 +- lib/libc/common/source/stdlib/malloc.c | 18 +------ subsys/dfu/boot/mcuboot_shell.c | 40 --------------- subsys/fs/littlefs_fs.c | 7 +-- subsys/ipc/rpmsg_service/rpmsg_backend.h | 27 ---------- 13 files changed, 4 insertions(+), 187 deletions(-) diff --git a/arch/arm/core/mpu/arm_mpu_regions.c b/arch/arm/core/mpu/arm_mpu_regions.c index 383fd573513c..0bf7a219c27d 100644 --- a/arch/arm/core/mpu/arm_mpu_regions.c +++ b/arch/arm/core/mpu/arm_mpu_regions.c @@ -8,9 +8,6 @@ #include #include -#if USE_PARTITION_MANAGER -#include -#endif static const struct arm_mpu_region mpu_regions[] = { #ifdef CONFIG_XIP @@ -27,14 +24,6 @@ static const struct arm_mpu_region mpu_regions[] = { /* Region 1 */ MPU_REGION_ENTRY("SRAM_0", -#if USE_PARTITION_MANAGER - PM_SRAM_ADDRESS, -#if defined(CONFIG_ARMV8_M_BASELINE) || defined(CONFIG_ARMV8_M_MAINLINE) - REGION_RAM_ATTR(PM_SRAM_ADDRESS, PM_SRAM_SIZE)), -#else - REGION_RAM_ATTR(REGION_SRAM_SIZE)), -#endif -#else CONFIG_SRAM_BASE_ADDRESS, #if defined(CONFIG_ARMV8_M_BASELINE) || defined(CONFIG_ARMV8_M_MAINLINE) REGION_RAM_ATTR(CONFIG_SRAM_BASE_ADDRESS, \ @@ -42,8 +31,6 @@ static const struct arm_mpu_region mpu_regions[] = { #else REGION_RAM_ATTR(REGION_SRAM_SIZE)), #endif - -#endif /* USE_PARTITION_MANAGER */ }; const struct arm_mpu_config mpu_config = { diff --git a/cmake/linker/ld/target.cmake b/cmake/linker/ld/target.cmake index cee3dd011bc5..733accda7820 100644 --- a/cmake/linker/ld/target.cmake +++ b/cmake/linker/ld/target.cmake @@ -80,7 +80,6 @@ macro(configure_linker_script linker_script_gen linker_pass_define) ${current_includes} ${soc_linker_script_includes} ${template_script_defines} - -DUSE_PARTITION_MANAGER=$ -E ${LINKER_SCRIPT} -P # Prevent generation of debug `#line' directives. -o ${linker_script_gen} diff --git a/cmake/linker/lld/target.cmake b/cmake/linker/lld/target.cmake index bdea4f1ec922..b6b96525e706 100644 --- a/cmake/linker/lld/target.cmake +++ b/cmake/linker/lld/target.cmake @@ -52,7 +52,6 @@ macro(configure_linker_script linker_script_gen linker_pass_define) -imacros ${AUTOCONF_H} ${current_includes} ${template_script_defines} - -DUSE_PARTITION_MANAGER=$ -E ${LINKER_SCRIPT} -P # Prevent generation of debug `#line' directives. -o ${linker_script_gen} diff --git a/cmake/modules/kernel.cmake b/cmake/modules/kernel.cmake index 5c8fa184b208..c6319611c8c3 100644 --- a/cmake/modules/kernel.cmake +++ b/cmake/modules/kernel.cmake @@ -256,7 +256,3 @@ if("${CMAKE_EXTRA_GENERATOR}" STREQUAL "Eclipse CDT4") include(${ZEPHYR_BASE}/cmake/ide/eclipse_cdt4_generator_amendment.cmake) eclipse_cdt4_generator_amendment(1) endif() - -if(ZEPHYR_NRF_MODULE_DIR) - include(${ZEPHYR_NRF_MODULE_DIR}/cmake/partition_manager.cmake) -endif() diff --git a/drivers/flash/soc_flash_nrf.c b/drivers/flash/soc_flash_nrf.c index 574739082dc4..9e1ba68319ff 100644 --- a/drivers/flash/soc_flash_nrf.c +++ b/drivers/flash/soc_flash_nrf.c @@ -37,11 +37,6 @@ LOG_MODULE_REGISTER(flash_nrf); #define SOC_NV_FLASH_NODE DT_INST(0, soc_nv_flash) -#if CONFIG_TRUSTED_EXECUTION_NONSECURE && USE_PARTITION_MANAGER -#include -#include -#endif /* CONFIG_TRUSTED_EXECUTION_NONSECURE && USE_PARTITION_MANAGER */ - #ifndef CONFIG_SOC_FLASH_NRF_RADIO_SYNC_NONE #define FLASH_SLOT_WRITE 7500 #if defined(CONFIG_SOC_FLASH_NRF_PARTIAL_ERASE) @@ -171,12 +166,6 @@ static int flash_nrf_read(const struct device *dev, off_t addr, } #endif -#if CONFIG_TRUSTED_EXECUTION_NONSECURE && USE_PARTITION_MANAGER && PM_APP_ADDRESS - if (addr < PM_APP_ADDRESS) { - return soc_secure_mem_read(data, (void *)addr, len); - } -#endif - nrf_nvmc_buffer_read(data, (uint32_t)addr, len); return 0; diff --git a/drivers/flash/soc_flash_nrf_rram.c b/drivers/flash/soc_flash_nrf_rram.c index d46e3524ea8d..d26a15cf7236 100644 --- a/drivers/flash/soc_flash_nrf_rram.c +++ b/drivers/flash/soc_flash_nrf_rram.c @@ -54,11 +54,6 @@ LOG_MODULE_REGISTER(flash_nrf_rram, CONFIG_FLASH_LOG_LEVEL); #define WRITE_BLOCK_SIZE_FROM_DT DT_PROP(RRAM, write_block_size) #define ERASE_VALUE 0xFF -#if CONFIG_TRUSTED_EXECUTION_NONSECURE && USE_PARTITION_MANAGER -#include -#include -#endif /* CONFIG_TRUSTED_EXECUTION_NONSECURE && USE_PARTITION_MANAGER */ - #ifdef CONFIG_MULTITHREADING static struct k_sem sem_lock; #define SYNC_INIT() k_sem_init(&sem_lock, 1, 1) @@ -284,12 +279,6 @@ static int nrf_rram_read(const struct device *dev, off_t addr, void *data, size_ } addr += RRAM_START; -#if CONFIG_TRUSTED_EXECUTION_NONSECURE && USE_PARTITION_MANAGER && PM_APP_ADDRESS - if (addr < PM_APP_ADDRESS) { - return soc_secure_mem_read(data, (void *)addr, len); - } -#endif - memcpy(data, (void *)addr, len); return 0; diff --git a/include/zephyr/arch/arm/cortex_m/scripts/linker.ld b/include/zephyr/arch/arm/cortex_m/scripts/linker.ld index ae4fbcaeddac..278620dfaf02 100644 --- a/include/zephyr/arch/arm/cortex_m/scripts/linker.ld +++ b/include/zephyr/arch/arm/cortex_m/scripts/linker.ld @@ -34,39 +34,6 @@ #define ROMSTART_REGION ROMABLE_REGION #endif -#if USE_PARTITION_MANAGER - -#include - -#if CONFIG_NCS_IS_VARIANT_IMAGE && defined(PM_S0_ID) -/* We are linking against S1, create symbol containing the flash ID of S0. - * This is used when writing code operating on the "other" slot. - */ -_image_1_primary_slot_id = PM_S0_ID; - -#else /* ! CONFIG_NCS_IS_VARIANT_IMAGE */ - -#ifdef PM_S1_ID -/* We are linking against S0, create symbol containing the flash ID of S1. - * This is used when writing code operating on the "other" slot. - */ -_image_1_primary_slot_id = PM_S1_ID; -#endif /* PM_S1_ID */ - -#endif /* CONFIG_NCS_IS_VARIANT_IMAGE */ - -#define ROM_ADDR PM_ADDRESS -#define ROM_SIZE PM_SIZE - -#if defined(CONFIG_PM_USE_CONFIG_SRAM_SIZE) -#define RAM_SIZE CONFIG_PM_SRAM_SIZE -#else -#define RAM_SIZE PM_SRAM_SIZE -#endif -#define RAM_ADDR PM_SRAM_ADDRESS - -#else /* ! USE_PARTITION_MANAGER */ - #if !defined(CONFIG_XIP) && (CONFIG_FLASH_SIZE == 0) #define ROM_ADDR RAM_ADDR #else @@ -88,23 +55,6 @@ _image_1_primary_slot_id = PM_S1_ID; #define RAM_SIZE (CONFIG_SRAM_SIZE * 1K) #define RAM_ADDR CONFIG_SRAM_BASE_ADDRESS -#endif /* USE_PARTITION_MANAGER */ - -#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_ccm), okay) -#define CCM_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_ccm)) -#define CCM_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_ccm)) -#endif - -#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_itcm), okay) -#define ITCM_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_itcm)) -#define ITCM_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_itcm)) -#endif - -#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_dtcm), okay) -#define DTCM_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_dtcm)) -#define DTCM_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_dtcm)) -#endif - #if defined(CONFIG_CUSTOM_SECTION_ALIGN) _region_min_align = CONFIG_CUSTOM_SECTION_MIN_ALIGN_SIZE; #else diff --git a/include/zephyr/storage/flash_map.h b/include/zephyr/storage/flash_map.h index f62f1c217185..d8ba414abd3d 100644 --- a/include/zephyr/storage/flash_map.h +++ b/include/zephyr/storage/flash_map.h @@ -348,10 +348,6 @@ const char *flash_area_label(const struct flash_area *fa); */ uint8_t flash_area_erased_val(const struct flash_area *fa); -#if USE_PARTITION_MANAGER -#include -#else - /** * Returns non-0 value if fixed-partition of given DTS node label exists. * @@ -473,8 +469,6 @@ DT_FOREACH_STATUS_OKAY(fixed_partitions, FOR_EACH_PARTITION_TABLE) #undef FOR_EACH_PARTITION_TABLE /** @endcond */ -#endif /* USE_PARTITION_MANAGER */ - #ifdef __cplusplus } #endif diff --git a/lib/heap/Kconfig b/lib/heap/Kconfig index 9a39ab8ad73b..0d97da3e340b 100644 --- a/lib/heap/Kconfig +++ b/lib/heap/Kconfig @@ -81,7 +81,7 @@ config HEAP_LISTENER choice prompt "Supported heap sizes" depends on !64BIT - default SYS_HEAP_SMALL_ONLY if (SRAM_SIZE <= 256) && !PARTITION_MANAGER_ENABLED + default SYS_HEAP_SMALL_ONLY if (SRAM_SIZE <= 256) default SYS_HEAP_AUTO help Heaps using reduced-size chunk headers can accommodate so called diff --git a/lib/libc/common/source/stdlib/malloc.c b/lib/libc/common/source/stdlib/malloc.c index 2821ae8173ac..2b01e152f009 100644 --- a/lib/libc/common/source/stdlib/malloc.c +++ b/lib/libc/common/source/stdlib/malloc.c @@ -25,20 +25,6 @@ #include LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); -#if USE_PARTITION_MANAGER - -#include - -#define RAM_SIZE PM_SRAM_SIZE -#define RAM_ADDR PM_SRAM_ADDRESS - -#else /* ! USE_PARTITION_MANAGER */ - -#define RAM_SIZE (KB((size_t) CONFIG_SRAM_SIZE)) -#define RAM_ADDR CONFIG_SRAM_BASE_ADDRESS - -#endif /* USE_PARTITION_MANAGER */ - #ifdef CONFIG_COMMON_LIBC_MALLOC #if (CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE != 0) @@ -120,8 +106,8 @@ static POOL_SECTION unsigned char __aligned(HEAP_ALIGN) malloc_arena[HEAP_SIZE]; extern char _heap_sentry[]; # define HEAP_SIZE ROUND_DOWN((POINTER_TO_UINT(_heap_sentry) - HEAP_BASE), HEAP_ALIGN) # else -# define HEAP_SIZE ROUND_DOWN((RAM_SIZE - \ - ((size_t) HEAP_BASE - (size_t) RAM_ADDR)), HEAP_ALIGN) +# define HEAP_SIZE ROUND_DOWN((KB((size_t) CONFIG_SRAM_SIZE) - \ + ((size_t) HEAP_BASE - (size_t) CONFIG_SRAM_BASE_ADDRESS)), HEAP_ALIGN) # endif /* else CONFIG_XTENSA */ # endif /* else CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE > 0 */ diff --git a/subsys/dfu/boot/mcuboot_shell.c b/subsys/dfu/boot/mcuboot_shell.c index e167bc1e39b8..be4e558713f1 100644 --- a/subsys/dfu/boot/mcuboot_shell.c +++ b/subsys/dfu/boot/mcuboot_shell.c @@ -20,16 +20,6 @@ #endif #endif -#if USE_PARTITION_MANAGER -#include - -#ifdef CONFIG_NCS_IS_VARIANT_IMAGE -#define ACTIVE_IMAGE_ID PM_MCUBOOT_SECONDARY_ID -#else -#define ACTIVE_IMAGE_ID PM_MCUBOOT_PRIMARY_ID -#endif -#endif - struct area_desc { const char *name; unsigned int id; @@ -103,35 +93,6 @@ static int cmd_mcuboot_erase(const struct shell *sh, size_t argc, id = strtoul(argv[1], NULL, 0); /* Check if this is the parent (MCUboot) or own slot and if so, deny the request */ -#if USE_PARTITION_MANAGER -#ifdef PM_MCUBOOT_ID - if (id == PM_MCUBOOT_ID || id == PM_MCUBOOT_PAD_ID) { - shell_error(sh, "Cannot erase boot partition"); - return -EACCES; - } -#endif - -#ifdef PM_APP_ID - if (id == PM_APP_ID) { - shell_error(sh, "Cannot erase this area"); - return -EACCES; - } -#endif - -#ifdef PM_MCUBOOT_PRIMARY_APP_ID - if (id == PM_MCUBOOT_PRIMARY_APP_ID) { - shell_error(sh, "Cannot erase this area"); - return -EACCES; - } -#endif - -#ifdef ACTIVE_IMAGE_ID - if (id == ACTIVE_IMAGE_ID) { - shell_error(sh, "Cannot erase active partitions"); - return -EACCES; - } -#endif -#else #if FIXED_PARTITION_EXISTS(boot_partition) if (id == FIXED_PARTITION_ID(boot_partition)) { shell_error(sh, "Cannot erase boot partition"); @@ -144,7 +105,6 @@ static int cmd_mcuboot_erase(const struct shell *sh, size_t argc, shell_error(sh, "Cannot erase active partitions"); return -EACCES; } -#endif #endif err = boot_erase_img_bank(id); diff --git a/subsys/fs/littlefs_fs.c b/subsys/fs/littlefs_fs.c index 5abbf95f949e..7cf8aaa44c7b 100644 --- a/subsys/fs/littlefs_fs.c +++ b/subsys/fs/littlefs_fs.c @@ -1103,12 +1103,7 @@ struct fs_mount_t FS_FSTAB_ENTRY(DT_DRV_INST(inst)) = { \ .type = FS_LITTLEFS, \ .mnt_point = DT_INST_PROP(inst, mount_point), \ .fs_data = &fs_data_##inst, \ - .storage_dev = (void *) \ - COND_CODE_1(USE_PARTITION_MANAGER, \ - (COND_CODE_1(FIXED_PARTITION_EXISTS(littlefs_storage), \ - (FIXED_PARTITION_ID(littlefs_storage)), \ - (FIXED_PARTITION_ID(storage)))), \ - (DT_FIXED_PARTITION_ID(FS_PARTITION(inst)))), \ + .storage_dev = (void *)DT_FIXED_PARTITION_ID(FS_PARTITION(inst)), \ .flags = FSTAB_ENTRY_DT_MOUNT_FLAGS(DT_DRV_INST(inst)), \ }; diff --git a/subsys/ipc/rpmsg_service/rpmsg_backend.h b/subsys/ipc/rpmsg_service/rpmsg_backend.h index 9996e1d74d9b..a74e46b85207 100644 --- a/subsys/ipc/rpmsg_service/rpmsg_backend.h +++ b/subsys/ipc/rpmsg_service/rpmsg_backend.h @@ -13,35 +13,8 @@ extern "C" { #endif -#if CONFIG_PARTITION_MANAGER_ENABLED - -#include "pm_config.h" - -#if defined(PM_RPMSG_NRF53_SRAM_ADDRESS) || defined(PM__RPMSG_NRF53_SRAM_ADDRESS) - -#if defined(PM_RPMSG_NRF53_SRAM_ADDRESS) -#define VDEV_START_ADDR PM_RPMSG_NRF53_SRAM_ADDRESS -#define VDEV_SIZE PM_RPMSG_NRF53_SRAM_SIZE -#else -/* The current image is a child image in a different domain than the image - * which defined the required values. To reach the values of the parent domain - * we use the 'PM__' variant of the define. - */ -#define VDEV_START_ADDR PM__RPMSG_NRF53_SRAM_ADDRESS -#define VDEV_SIZE PM__RPMSG_NRF53_SRAM_SIZE -#endif /* defined(PM_RPMSG_NRF53_SRAM_ADDRESS) */ - -#else #define VDEV_START_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_ipc_shm)) #define VDEV_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_ipc_shm)) -#endif /* defined(PM_RPMSG_NRF53_SRAM_ADDRESS) || defined(PM__RPMSG_NRF53_SRAM_ADDRESS) */ - -#else - -#define VDEV_START_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_ipc_shm)) -#define VDEV_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_ipc_shm)) - -#endif /* CONFIG_PARTITION_MANAGER_ENABLED */ #define VDEV_STATUS_ADDR VDEV_START_ADDR #define VDEV_STATUS_SIZE 0x400 From ddf337b2e406d1f7d4e07038b66651d3ca7c9b12 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:42 +0300 Subject: [PATCH 1097/2141] Revert "[nrf noup] include: net: add NCS extensions" This reverts commit d7a627775d65077527e6272d627e2b88bfecc9cd. Signed-off-by: Jukka Rissanen --- include/zephyr/net/socket.h | 1 - include/zephyr/net/socket_ncs.h | 170 -------------------------------- 2 files changed, 171 deletions(-) delete mode 100644 include/zephyr/net/socket_ncs.h diff --git a/include/zephyr/net/socket.h b/include/zephyr/net/socket.h index 4a0823bc069f..ae398bb61177 100644 --- a/include/zephyr/net/socket.h +++ b/include/zephyr/net/socket.h @@ -35,7 +35,6 @@ #include #include #include -#include #include #ifdef __cplusplus diff --git a/include/zephyr/net/socket_ncs.h b/include/zephyr/net/socket_ncs.h deleted file mode 100644 index 92a8447c47fb..000000000000 --- a/include/zephyr/net/socket_ncs.h +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright (c) 2021 Nordic Semiconductor - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef ZEPHYR_INCLUDE_NET_SOCKET_NCS_H_ -#define ZEPHYR_INCLUDE_NET_SOCKET_NCS_H_ - -/** - * @file - * @brief NCS specific additions to the BSD sockets API definitions - */ - -#ifdef __cplusplus -extern "C" { -#endif - -/* When CONFIG_NET_SOCKETS_OFFLOAD is enabled, offloaded sockets take precedence - * when creating a new socket. Combine this flag with a socket type when - * creating a socket, to enforce native socket creation (e. g. SOCK_STREAM | SOCK_NATIVE). - * If it's desired to create a native TLS socket, but still offload the - * underlying TCP/UDP socket, use e. g. SOCK_STREAM | SOCK_NATIVE_TLS. - */ -#define SOCK_NATIVE 0x80000000 -#define SOCK_NATIVE_TLS 0x40000000 - -/** Define a base for NCS specific socket options to prevent overlaps with Zephyr's socket options. - */ -#define NET_SOCKET_NCS_BASE 1000 - -/* NCS specific TLS level socket options */ - -/** Socket option to set DTLS handshake timeout, specifically for nRF sockets. - * The option accepts an integer, indicating the total handshake timeout, - * including retransmissions, in seconds. - * Accepted values for the option are: 1, 3, 7, 15, 31, 63, 123. - */ -#define TLS_DTLS_HANDSHAKE_TIMEO (NET_SOCKET_NCS_BASE + 18) - -/** Socket option to save DTLS connection, specifically for nRF sockets. - */ -#define TLS_DTLS_CONN_SAVE (NET_SOCKET_NCS_BASE + 19) - -/** Socket option to load DTLS connection, specifically for nRF sockets. - */ -#define TLS_DTLS_CONN_LOAD (NET_SOCKET_NCS_BASE + 20) - -/** Socket option to get result of latest TLS/DTLS completed handshakes end status, - * specifically for nRF sockets. - * The option accepts an integer, indicating the setting. - * Accepted vaules for the option are: 0 and 1. - */ -#define TLS_DTLS_HANDSHAKE_STATUS (NET_SOCKET_NCS_BASE + 21) - -/* Valid values for TLS_DTLS_HANDSHAKE_TIMEO option */ -#define TLS_DTLS_HANDSHAKE_TIMEO_NONE 0 /**< No timeout */ -#define TLS_DTLS_HANDSHAKE_TIMEO_1S 1 /**< 1 second */ -#define TLS_DTLS_HANDSHAKE_TIMEO_3S 3 /**< 1s + 2s */ -#define TLS_DTLS_HANDSHAKE_TIMEO_7S 7 /**< 1s + 2s + 4s */ -#define TLS_DTLS_HANDSHAKE_TIMEO_15S 15 /**< 1s + 2s + 4s + 8s */ -#define TLS_DTLS_HANDSHAKE_TIMEO_31S 31 /**< 1s + 2s + 4s + 8s + 16s */ -#define TLS_DTLS_HANDSHAKE_TIMEO_63S 63 /**< 1s + 2s + 4s + 8s + 16s + 32s */ -#define TLS_DTLS_HANDSHAKE_TIMEO_123S 123 /**< 1s + 2s + 4s + 8s + 16s + 32s + 60s */ - -/* Valid values for TLS_DTLS_HANDSHAKE_STATUS option */ -#define TLS_DTLS_HANDSHAKE_STATUS_FULL 0 -#define TLS_DTLS_HANDSHAKE_STATUS_CACHED 1 - -/* NCS specific socket options */ - -/** sockopt: enable sending data as part of exceptional events */ -#define SO_EXCEPTIONAL_DATA (NET_SOCKET_NCS_BASE + 33) -/** sockopt: Keep socket open when its PDN connection is lost - * or the device is put into flight mode. - */ -#define SO_KEEPOPEN (NET_SOCKET_NCS_BASE + 34) -/** sockopt: bind to PDN */ -#define SO_BINDTOPDN (NET_SOCKET_NCS_BASE + 40) - -/** sockopt: Release assistance indication (RAI). - * The option accepts an integer, indicating the type of RAI. - * Accepted values for the option are: @ref RAI_NO_DATA, @ref RAI_LAST, @ref RAI_ONE_RESP, - * @ref RAI_ONGOING, @ref RAI_WAIT_MORE. - */ -#define SO_RAI (NET_SOCKET_NCS_BASE + 61) - -/** Release assistance indication (RAI). - * Indicate that the application does not intend to send more data. - * This applies immediately and lets the modem exit connected mode more - * quickly. - * - * @note This requires the socket to be connected. - */ -#define RAI_NO_DATA 1 -/** Release assistance indication (RAI). - * Indicate that the application does not intend to send more data - * after the next call to send() or sendto(). - * This lets the modem exit connected mode more quickly after sending the data. - */ -#define RAI_LAST 2 -/** Release assistance indication (RAI). - * Indicate that the application is expecting to receive just one data packet - * after the next call to send() or sendto(). - * This lets the modem exit connected mode more quickly after having received the data. - */ -#define RAI_ONE_RESP 3 -/** Release assistance indication (RAI). - * Indicate that the socket is in active use by a client application. - * This lets the modem stay in connected mode longer. - */ -#define RAI_ONGOING 4 -/** Release assistance indication (RAI). - * Indicate that the socket is in active use by a server application. - * This lets the modem stay in connected mode longer. - */ -#define RAI_WAIT_MORE 5 - -/* NCS specific IPPROTO_ALL level socket options */ - -/** IPv4 and IPv6 protocol level (pseudo-val) for nRF sockets. */ -#define IPPROTO_ALL 512 -/** sockopt: disable all replies to unexpected traffics */ -#define SO_SILENCE_ALL (NET_SOCKET_NCS_BASE + 30) - -/* NCS specific IPPROTO_IP level socket options */ - -/** sockopt: enable IPv4 ICMP replies */ -#define SO_IP_ECHO_REPLY (NET_SOCKET_NCS_BASE + 31) - -/* NCS specific IPPROTO_IPV6 level socket options */ - -/** sockopt: enable IPv6 ICMP replies */ -#define SO_IPV6_ECHO_REPLY (NET_SOCKET_NCS_BASE + 32) - -/** sockopt: Delay IPv6 address refresh during power saving mode */ -#define SO_IPV6_DELAYED_ADDR_REFRESH (NET_SOCKET_NCS_BASE + 62) - -/* NCS specific TCP level socket options */ - -/** sockopt: Configurable TCP server session timeout in minutes. - * Range is 0 to 135. 0 is no timeout and 135 is 2 h 15 min. Default is 0 (no timeout). - */ -#define SO_TCP_SRV_SESSTIMEO (NET_SOCKET_NCS_BASE + 55) - -/* NCS specific gettaddrinfo() flags */ - -/** Assume `service` contains a Packet Data Network (PDN) ID. - * When specified together with the AI_NUMERICSERV flag, - * `service` shall be formatted as follows: "port:pdn_id" - * where "port" is the port number and "pdn_id" is the PDN ID. - * Example: "8080:1", port 8080 PDN ID 1. - * Example: "42:0", port 42 PDN ID 0. - */ -#define AI_PDNSERV 0x1000 - -/* NCS specific send() and sendto() flags */ - -/** Request a blocking send operation until the request is acknowledged. - * When used in send() or sendto(), the request will not return until the - * send operation is completed by lower layers, or until the timeout, given by the SO_SNDTIMEO - * socket option, is reached. Valid timeout values are 1 to 600 seconds. - */ -#define MSG_WAITACK 0x200 - -#ifdef __cplusplus -} -#endif - -#endif /* ZEPHYR_INCLUDE_NET_SOCKET_NCS_H_ */ From 0e77c694793bff7f31fb5db9ae0d6093c4625a73 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:42 +0300 Subject: [PATCH 1098/2141] Revert "[nrf noup] board: nordic: thingy53: Enable default images for sysbuild" This reverts commit f730f82960010af1f6fd988d15842de0920dc9af. Signed-off-by: Jukka Rissanen --- boards/nordic/thingy53/Kconfig.sysbuild | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/boards/nordic/thingy53/Kconfig.sysbuild b/boards/nordic/thingy53/Kconfig.sysbuild index c03d191b3708..2110f226e6b1 100644 --- a/boards/nordic/thingy53/Kconfig.sysbuild +++ b/boards/nordic/thingy53/Kconfig.sysbuild @@ -1,22 +1,5 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -if BOARD_THINGY53_NRF5340_CPUAPP || BOARD_THINGY53_NRF5340_CPUAPP_NS - -choice BOOTLOADER - default BOOTLOADER_MCUBOOT -endchoice - -config SECURE_BOOT_NETCORE - default y - -config NETCORE_APP_UPDATE - default y if SECURE_BOOT_NETCORE - -config NRF_DEFAULT_EMPTY - default y if SECURE_BOOT_NETCORE - -endif # BOARD_THINGY53_NRF5340_CPUAPP || BOARD_THINGY53_NRF5340_CPUAPP_NS - config PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY default y if BOOTLOADER_MCUBOOT From eaf626d98c75f25bfb0aa95764242e01faf95f0c Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:42 +0300 Subject: [PATCH 1099/2141] Revert "[nrf noup] scripts: west: build: Use sysbuild by default if in NCS dir" This reverts commit 5bbb2c8dd32e564667eb7b6bc3bd27f9f58e1bfb. Signed-off-by: Jukka Rissanen --- scripts/west_commands/build.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/scripts/west_commands/build.py b/scripts/west_commands/build.py index 1b7bf3b80a18..90d1a037e4f7 100644 --- a/scripts/west_commands/build.py +++ b/scripts/west_commands/build.py @@ -624,12 +624,7 @@ def _run_cmake(self, board, origin, cmake_opts): if user_args: cmake_opts.extend(shlex.split(user_args)) - config_sysbuild = config_getboolean('sysbuild', None) - - if config_sysbuild is None: - # If no option is set, then enable sysbuild globally - config_sysbuild = True - + config_sysbuild = config_getboolean('sysbuild', False) if self.args.sysbuild or (config_sysbuild and not self.args.no_sysbuild): cmake_opts.extend([f'-S{SYSBUILD_PROJ_DIR}', f'-DAPP_DIR:PATH={self.source_dir}']) From 1cf43d5ece868a734bed552bc8c5e64024a0308c Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:42 +0300 Subject: [PATCH 1100/2141] Revert "[nrf noup] boards: nordic: thingy53: Add sysbuild Kconfig file" This reverts commit fa07e94d6a760f8a4e025b408f3ddd5db47acaf5. Signed-off-by: Jukka Rissanen --- boards/nordic/thingy53/Kconfig.sysbuild | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 boards/nordic/thingy53/Kconfig.sysbuild diff --git a/boards/nordic/thingy53/Kconfig.sysbuild b/boards/nordic/thingy53/Kconfig.sysbuild deleted file mode 100644 index 2110f226e6b1..000000000000 --- a/boards/nordic/thingy53/Kconfig.sysbuild +++ /dev/null @@ -1,5 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -config PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY - default y if BOOTLOADER_MCUBOOT From 04c7e47eac74b588294ceb0def28b0c1e2a84261 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:42 +0300 Subject: [PATCH 1101/2141] Revert "[nrf noup] samples: psa_crypto: Remove support for Nordic boards" This reverts commit 27f225d5ae6e3f73b609970b81881d504f1b956d. Signed-off-by: Jukka Rissanen --- samples/tfm_integration/psa_crypto/sample.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/samples/tfm_integration/psa_crypto/sample.yaml b/samples/tfm_integration/psa_crypto/sample.yaml index 7d287985bf3c..ea9844730fc1 100644 --- a/samples/tfm_integration/psa_crypto/sample.yaml +++ b/samples/tfm_integration/psa_crypto/sample.yaml @@ -16,6 +16,8 @@ tests: platform_allow: - mps2/an521/cpu0/ns - v2m_musca_s1/musca_s1/ns + - nrf5340dk/nrf5340/cpuapp/ns + - nrf9160dk/nrf9160/ns - stm32l562e_dk/stm32l562xx/ns - bl5340_dvk/nrf5340/cpuapp/ns - max32657evkit/max32657/ns From fd100eb75f16937dec63fc53578c7c2765a827ba Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:42 +0300 Subject: [PATCH 1102/2141] Revert "[nrf noup] boards: thingy53_nrf5340: Enable MCUboot by default" This reverts commit ce70796db5dd9a8d99c55732c0292bbeffc38f77. Signed-off-by: Jukka Rissanen --- boards/nordic/thingy53/Kconfig.defconfig | 6 ------ boards/nordic/thingy53/thingy53_nrf5340_common.dtsi | 1 - 2 files changed, 7 deletions(-) diff --git a/boards/nordic/thingy53/Kconfig.defconfig b/boards/nordic/thingy53/Kconfig.defconfig index badcb5c20e5d..1aa0d7d082ec 100644 --- a/boards/nordic/thingy53/Kconfig.defconfig +++ b/boards/nordic/thingy53/Kconfig.defconfig @@ -8,12 +8,6 @@ config HW_STACK_PROTECTION if BOARD_THINGY53_NRF5340_CPUAPP || BOARD_THINGY53_NRF5340_CPUAPP_NS -config BOOTLOADER_MCUBOOT - default y if !MCUBOOT - -config BOARD_ENABLE_CPUNET - default y if !MCUBOOT - # Code Partition: # # For the secure version of the board the firmware is linked at the beginning diff --git a/boards/nordic/thingy53/thingy53_nrf5340_common.dtsi b/boards/nordic/thingy53/thingy53_nrf5340_common.dtsi index 900b9d06e658..3f2f2d5f0606 100644 --- a/boards/nordic/thingy53/thingy53_nrf5340_common.dtsi +++ b/boards/nordic/thingy53/thingy53_nrf5340_common.dtsi @@ -13,7 +13,6 @@ zephyr,bt-hci = &bt_hci_ipc0; nordic,802154-spinel-ipc = &ipc0; zephyr,ieee802154 = &ieee802154; - nordic,pm-ext-flash = &mx25r64; }; buttons { From e3a974e308d79b75723d7ad92bb1a19b3adb6339 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:42 +0300 Subject: [PATCH 1103/2141] Revert "[nrf noup] boards: arm: thingy53: Disable USB CDC added by MCUBoot" This reverts commit 6d1e3772d63562e2e30fa3176805538d2f0c4117. Signed-off-by: Jukka Rissanen --- boards/nordic/thingy53/Kconfig.defconfig | 7 ------- 1 file changed, 7 deletions(-) diff --git a/boards/nordic/thingy53/Kconfig.defconfig b/boards/nordic/thingy53/Kconfig.defconfig index 1aa0d7d082ec..c1139f0dca10 100644 --- a/boards/nordic/thingy53/Kconfig.defconfig +++ b/boards/nordic/thingy53/Kconfig.defconfig @@ -84,13 +84,6 @@ endif # !TRUSTED_EXECUTION_SECURE source "boards/common/usb/Kconfig.cdc_acm_serial.defconfig" -# By default, a USB CDC ACM instance is already enabled in the board's DTS. -# It is not necessary for nRF Connect SDK to add another instance if MCUBoot -# bootloader is built as a child image. -config MCUBOOT_USB_SUPPORT - bool - default n - endif # BOARD_THINGY53_NRF5340_CPUAPP || BOARD_THINGY53_NRF5340_CPUAPP_NS if BOARD_THINGY53_NRF5340_CPUNET From 49fbdcad0613abf9efd44c9d7f04c8b48e4149bc Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:42 +0300 Subject: [PATCH 1104/2141] Revert "[nrf noup] boards: thingy53_nrf5340: Add common partition map" This reverts commit afef9ef461a574f57a785bf220060468ad3ebbde. Signed-off-by: Jukka Rissanen --- .../pm_static_thingy53_nrf5340_cpuapp.yml | 55 -------------- .../pm_static_thingy53_nrf5340_cpuapp_ns.yml | 73 ------------------- 2 files changed, 128 deletions(-) delete mode 100644 boards/nordic/thingy53/pm_static_thingy53_nrf5340_cpuapp.yml delete mode 100644 boards/nordic/thingy53/pm_static_thingy53_nrf5340_cpuapp_ns.yml diff --git a/boards/nordic/thingy53/pm_static_thingy53_nrf5340_cpuapp.yml b/boards/nordic/thingy53/pm_static_thingy53_nrf5340_cpuapp.yml deleted file mode 100644 index 7a48d51ec334..000000000000 --- a/boards/nordic/thingy53/pm_static_thingy53_nrf5340_cpuapp.yml +++ /dev/null @@ -1,55 +0,0 @@ -app: - address: 0x10200 - region: flash_primary - size: 0xdfe00 -mcuboot: - address: 0x0 - region: flash_primary - size: 0x10000 -mcuboot_pad: - address: 0x10000 - region: flash_primary - size: 0x200 -mcuboot_primary: - address: 0x10000 - orig_span: &id001 - - mcuboot_pad - - app - region: flash_primary - size: 0xe0000 - span: *id001 -mcuboot_primary_app: - address: 0x10200 - orig_span: &id002 - - app - region: flash_primary - size: 0xdfe00 - span: *id002 -settings_storage: - address: 0xf0000 - region: flash_primary - size: 0x10000 -mcuboot_primary_1: - address: 0x0 - size: 0x40000 - device: flash_ctrl - region: ram_flash -mcuboot_secondary: - address: 0x00000 - size: 0xe0000 - device: MX25R64 - region: external_flash -mcuboot_secondary_1: - address: 0xe0000 - size: 0x40000 - device: MX25R64 - region: external_flash -external_flash: - address: 0x120000 - size: 0x6e0000 - device: MX25R64 - region: external_flash -pcd_sram: - address: 0x20000000 - size: 0x2000 - region: sram_primary diff --git a/boards/nordic/thingy53/pm_static_thingy53_nrf5340_cpuapp_ns.yml b/boards/nordic/thingy53/pm_static_thingy53_nrf5340_cpuapp_ns.yml deleted file mode 100644 index 70ffe6d9c124..000000000000 --- a/boards/nordic/thingy53/pm_static_thingy53_nrf5340_cpuapp_ns.yml +++ /dev/null @@ -1,73 +0,0 @@ -mcuboot: - address: 0x0 - region: flash_primary - size: 0x10000 -mcuboot_pad: - address: 0x10000 - region: flash_primary - size: 0x200 -tfm_secure: - address: 0x10000 - size: 0xc000 - span: [mcuboot_pad, tfm] -tfm_nonsecure: - address: 0x1c000 - size: 0xd4000 - span: [app] -tfm: - address: 0x10200 - region: flash_primary - size: 0xbe00 -app: - address: 0x1c000 - region: flash_primary - size: 0xd4000 -mcuboot_primary: - address: 0x10000 - orig_span: &id001 - - mcuboot_pad - - tfm - - app - region: flash_primary - size: 0xe0000 - span: *id001 -mcuboot_primary_app: - address: 0x10200 - orig_span: &id002 - - tfm - - app - region: flash_primary - size: 0xdfe00 - span: *id002 -nonsecure_storage: - address: 0xf0000 - size: 0x10000 - span: [settings_storage] -settings_storage: - address: 0xf0000 - region: flash_primary - size: 0x10000 -mcuboot_primary_1: - address: 0x0 - size: 0x40000 - device: flash_ctrl - region: ram_flash -mcuboot_secondary: - address: 0x00000 - size: 0xe0000 - device: MX25R64 - region: external_flash -mcuboot_secondary_1: - address: 0xe0000 - size: 0x40000 - device: MX25R64 - region: external_flash -external_flash: - address: 0x120000 - size: 0x6e0000 - device: MX25R64 - region: external_flash -pcd_sram: - address: 0x20000000 - size: 0x2000 - region: sram_primary From bb32e2ca69ed092bb497016a779aa032f9e0523f Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:42 +0300 Subject: [PATCH 1105/2141] Revert "[nrf noup] soc: arm: nRF91: Add SPU Flash/RAM alignment" This reverts commit a562d9663033995572b1e3269c687cbb343773e0. Signed-off-by: Jukka Rissanen --- soc/nordic/nrf53/Kconfig | 22 ++++++++-------------- soc/nordic/nrf91/Kconfig | 20 -------------------- 2 files changed, 8 insertions(+), 34 deletions(-) diff --git a/soc/nordic/nrf53/Kconfig b/soc/nordic/nrf53/Kconfig index 1a747bec9ea6..d90bf28846ae 100644 --- a/soc/nordic/nrf53/Kconfig +++ b/soc/nordic/nrf53/Kconfig @@ -167,15 +167,12 @@ config NRF_SPU_FLASH_REGION_SIZE help FLASH region size for the NRF_SPU peripheral -config NRF_TRUSTZONE_FLASH_REGION_SIZE +config NRF_SPU_FLASH_REGION_ALIGNMENT hex - default NRF_SPU_FLASH_REGION_SIZE + default 0x4000 help - Define the flash region size from a TrustZone perspective. - This is used when we set the security attributes(S/NSC/NS) of a region - in TrustZone enabled devices. - In practice this option defines the granularity of the security attributes, - i.e. the smallest region that can be set to secure or non-secure. + FLASH regions must be aligned to this value due to SPU HW + limitations. config NRF_SPU_RAM_REGION_SIZE hex @@ -183,15 +180,12 @@ config NRF_SPU_RAM_REGION_SIZE help RAM region size for the NRF_SPU peripheral -config NRF_TRUSTZONE_RAM_REGION_SIZE +config NRF_SPU_RAM_REGION_ALIGNMENT hex - default NRF_SPU_RAM_REGION_SIZE + default 0x2000 help - Define the RAM region size from a TrustZone perspective. - This is used when we set the security attributes(S/NSC/NS) of a region - in TrustZone enabled devices. - In practice this option defines the granularity of the security attributes, - i.e. the smallest region that can be set to secure or non-secure. + RAM regions must be aligned to this value due to SPU HW + limitations. config SOC_NRF_GPIO_FORWARDER_FOR_NRF5340 bool "Forward GPIO pins to network core" diff --git a/soc/nordic/nrf91/Kconfig b/soc/nordic/nrf91/Kconfig index 9f55cdd77ed9..ed38eff73a2d 100644 --- a/soc/nordic/nrf91/Kconfig +++ b/soc/nordic/nrf91/Kconfig @@ -24,16 +24,6 @@ config NRF_SPU_FLASH_REGION_SIZE help FLASH region size for the NRF_SPU peripheral -config NRF_TRUSTZONE_FLASH_REGION_SIZE - hex - default NRF_SPU_FLASH_REGION_SIZE - help - Define the flash region size from a TrustZone perspective. - This is used when we set the security attributes(S/NSC/NS) of a region - in TrustZone enabled devices. - In practice this option defines the granularity of the security attributes, - i.e. the smallest region that can be set to secure or non-secure. - config NRF_SPU_RAM_REGION_SIZE hex default 0x2000 @@ -44,14 +34,4 @@ config NRF_ENABLE_ICACHE bool "Instruction cache (I-Cache)" default y -config NRF_TRUSTZONE_RAM_REGION_SIZE - hex - default NRF_SPU_RAM_REGION_SIZE - help - Define the RAM region size from a TrustZone perspective. - This is used when we set the security attributes(S/NSC/NS) of a region - in TrustZone enabled devices. - In practice this option defines the granularity of the security attributes, - i.e. the smallest region that can be set to secure or non-secure. - endif # SOC_SERIES_NRF91X From 201729699502890846169d1893ee9f9a31c74530 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:42 +0300 Subject: [PATCH 1106/2141] Revert "[nrf noup] soc: arm: nRF53: Add SPU Flash/RAM alignment" This reverts commit bc60d5ca3563061a00c35873e3e5c225e6de3750. Signed-off-by: Jukka Rissanen --- soc/nordic/nrf53/Kconfig | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/soc/nordic/nrf53/Kconfig b/soc/nordic/nrf53/Kconfig index d90bf28846ae..8aade63f54a1 100644 --- a/soc/nordic/nrf53/Kconfig +++ b/soc/nordic/nrf53/Kconfig @@ -167,26 +167,12 @@ config NRF_SPU_FLASH_REGION_SIZE help FLASH region size for the NRF_SPU peripheral -config NRF_SPU_FLASH_REGION_ALIGNMENT - hex - default 0x4000 - help - FLASH regions must be aligned to this value due to SPU HW - limitations. - config NRF_SPU_RAM_REGION_SIZE hex default 0x2000 help RAM region size for the NRF_SPU peripheral -config NRF_SPU_RAM_REGION_ALIGNMENT - hex - default 0x2000 - help - RAM regions must be aligned to this value due to SPU HW - limitations. - config SOC_NRF_GPIO_FORWARDER_FOR_NRF5340 bool "Forward GPIO pins to network core" depends on NRF_SOC_SECURE_SUPPORTED From 932a3a0a8ed92d9bc4d97ce2d8082bca5f6f93a0 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:42 +0300 Subject: [PATCH 1107/2141] Revert "[nrf noup] net: mqtt: add native TLS support" This reverts commit 3fbd1c5c3c5217423087ea1075acc4b5b79ac330. Signed-off-by: Jukka Rissanen --- doc/connectivity/networking/api/mqtt.rst | 3 --- include/zephyr/net/mqtt.h | 3 --- subsys/net/lib/mqtt/mqtt_transport_socket_tls.c | 7 +------ 3 files changed, 1 insertion(+), 12 deletions(-) diff --git a/doc/connectivity/networking/api/mqtt.rst b/doc/connectivity/networking/api/mqtt.rst index 3d222d53816a..9a167ffe665a 100644 --- a/doc/connectivity/networking/api/mqtt.rst +++ b/doc/connectivity/networking/api/mqtt.rst @@ -150,7 +150,6 @@ additional configuration information: tls_config->sec_tag_list = m_sec_tags; tls_config->sec_tag_count = ARRAY_SIZE(m_sec_tags); tls_config->hostname = MQTT_BROKER_HOSTNAME; - tls_config->set_native_tls = true; In this sample code, the ``m_sec_tags`` array holds a list of tags, referencing TLS credentials that the MQTT library should use for authentication. We do not specify @@ -163,8 +162,6 @@ Note, that TLS credentials referenced by the ``m_sec_tags`` array must be registered in the system first. For more information on how to do that, refer to :ref:`secure sockets documentation `. -Finally, ``set_native_tls`` can be optionally set to enable native TLS support instead of offloading TLS operations to the modem. - An example of how to use TLS with MQTT is also present in :zephyr:code-sample:`mqtt-publisher` sample application. diff --git a/include/zephyr/net/mqtt.h b/include/zephyr/net/mqtt.h index 797f8f339d7f..d63cc1316249 100644 --- a/include/zephyr/net/mqtt.h +++ b/include/zephyr/net/mqtt.h @@ -773,9 +773,6 @@ struct mqtt_sec_config { /** Indicates the preference for copying certificates to the heap. */ int cert_nocopy; - - /** Set socket to native TLS */ - bool set_native_tls; }; /** @brief MQTT transport type. */ diff --git a/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c b/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c index 617dec4b4d26..68a101e6c846 100644 --- a/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c +++ b/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c @@ -22,15 +22,10 @@ int mqtt_client_tls_connect(struct mqtt_client *client) { const struct sockaddr *broker = client->broker; struct mqtt_sec_config *tls_config = &client->transport.tls.config; - int type = SOCK_STREAM; int ret; - if (tls_config->set_native_tls) { - type |= SOCK_NATIVE_TLS; - } - client->transport.tls.sock = zsock_socket(broker->sa_family, - type, IPPROTO_TLS_1_2); + SOCK_STREAM, IPPROTO_TLS_1_2); if (client->transport.tls.sock < 0) { return -errno; } From 55dce96d64f5df1ffcde15c058eb3b6a152f4c59 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:42 +0300 Subject: [PATCH 1108/2141] Revert "[nrf noup] net: mqtt: Provide option to enable TLS session caching" This reverts commit e15a1164f1ce13a1b67291fdc880e31d8cf63abd. Signed-off-by: Jukka Rissanen --- include/zephyr/net/mqtt.h | 3 --- subsys/net/lib/mqtt/mqtt_transport_socket_tls.c | 10 ---------- 2 files changed, 13 deletions(-) diff --git a/include/zephyr/net/mqtt.h b/include/zephyr/net/mqtt.h index d63cc1316249..b992714afd32 100644 --- a/include/zephyr/net/mqtt.h +++ b/include/zephyr/net/mqtt.h @@ -763,9 +763,6 @@ struct mqtt_sec_config { uint32_t alpn_protocol_name_count; #endif - /** Indicates the preference for enabling TLS session caching. */ - int session_cache; - /** Peer hostname for ceritificate verification. * May be NULL to skip hostname verification. */ diff --git a/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c b/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c index 68a101e6c846..2ff337eef343 100644 --- a/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c +++ b/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c @@ -109,16 +109,6 @@ int mqtt_client_tls_connect(struct mqtt_client *client) } } - if (tls_config->session_cache == TLS_SESSION_CACHE_ENABLED) { - ret = zsock_setsockopt(client->transport.tls.sock, SOL_TLS, - TLS_SESSION_CACHE, - &tls_config->session_cache, - sizeof(tls_config->session_cache)); - if (ret < 0) { - goto error; - } - } - if (tls_config->cert_nocopy != TLS_CERT_NOCOPY_NONE) { ret = zsock_setsockopt(client->transport.tls.sock, SOL_TLS, TLS_CERT_NOCOPY, &tls_config->cert_nocopy, From cf4d34faeda714f365e4e814d477640a90b10135 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:42 +0300 Subject: [PATCH 1109/2141] Revert "[nrf noup] test: schedule_api: Use Minimal C library" This reverts commit 8cb54eb26cbce8c31af83154d863dd72bca036a4. Signed-off-by: Jukka Rissanen --- tests/kernel/pipe/deprecated/pipe_api/prj.conf | 1 - tests/kernel/sched/schedule_api/prj.conf | 1 - tests/kernel/sched/schedule_api/prj_multiq.conf | 1 - 3 files changed, 3 deletions(-) diff --git a/tests/kernel/pipe/deprecated/pipe_api/prj.conf b/tests/kernel/pipe/deprecated/pipe_api/prj.conf index df3270adfdf8..02d8fd3dd565 100644 --- a/tests/kernel/pipe/deprecated/pipe_api/prj.conf +++ b/tests/kernel/pipe/deprecated/pipe_api/prj.conf @@ -6,4 +6,3 @@ CONFIG_MP_MAX_NUM_CPUS=1 CONFIG_ZTEST_FATAL_HOOK=y CONFIG_PIPES=y CONFIG_DEPRECATION_TEST=y -CONFIG_MINIMAL_LIBC=y diff --git a/tests/kernel/sched/schedule_api/prj.conf b/tests/kernel/sched/schedule_api/prj.conf index 8b649a3b7fca..a5ceef694331 100644 --- a/tests/kernel/sched/schedule_api/prj.conf +++ b/tests/kernel/sched/schedule_api/prj.conf @@ -7,4 +7,3 @@ CONFIG_MAX_THREAD_BYTES=6 CONFIG_TEST_USERSPACE=y CONFIG_MP_MAX_NUM_CPUS=1 CONFIG_ZTEST_FATAL_HOOK=y -CONFIG_MINIMAL_LIBC=y diff --git a/tests/kernel/sched/schedule_api/prj_multiq.conf b/tests/kernel/sched/schedule_api/prj_multiq.conf index 84c9d80ac619..c8dd4bf786bc 100644 --- a/tests/kernel/sched/schedule_api/prj_multiq.conf +++ b/tests/kernel/sched/schedule_api/prj_multiq.conf @@ -7,4 +7,3 @@ CONFIG_MP_MAX_NUM_CPUS=1 CONFIG_ZTEST_FATAL_HOOK=y CONFIG_NUM_COOP_PRIORITIES=30 CONFIG_NUM_PREEMPT_PRIORITIES=40 -CONFIG_MINIMAL_LIBC=y From a32626d9414c407d0c9319e8a10bbaf88deb5b99 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:42 +0300 Subject: [PATCH 1110/2141] Revert "[nrf noup] modules: mbedtls: Use help for DISABLE_MBEDTLS_BUILTIN info" This reverts commit c289b579cd65da72777519d2305d1c7cf46ad609. Signed-off-by: Jukka Rissanen --- modules/mbedtls/Kconfig | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/modules/mbedtls/Kconfig b/modules/mbedtls/Kconfig index aa8c479e89f7..f7bc6a609f1f 100644 --- a/modules/mbedtls/Kconfig +++ b/modules/mbedtls/Kconfig @@ -43,11 +43,10 @@ config MBEDTLS_LIBRARY endchoice +# subsystems cannot deselect MBEDTLS_BUILTIN, but they can select +# DISABLE_MBEDTLS_BUILTIN. config DISABLE_MBEDTLS_BUILTIN bool - help - Subsystems cannot deselect MBEDTLS_BUILTIN, but they can select - DISABLE_MBEDTLS_BUILTIN. config CUSTOM_MBEDTLS_CFG_FILE bool "Custom mbed TLS configuration file" From 48780d5425dc253d631fdabd3eb27993f859d612 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:43 +0300 Subject: [PATCH 1111/2141] Revert "[nrf noup] dfu/boot/mcuboot: fix confirmation in case of USE_PARTITION_MANAGER" This reverts commit b24d5100b9a635d4bb2bc2e041b5fdbc0ad452a0. Signed-off-by: Jukka Rissanen --- subsys/dfu/boot/mcuboot.c | 44 --------------------------------------- 1 file changed, 44 deletions(-) diff --git a/subsys/dfu/boot/mcuboot.c b/subsys/dfu/boot/mcuboot.c index 2984efe0906c..5683d23a87ad 100644 --- a/subsys/dfu/boot/mcuboot.c +++ b/subsys/dfu/boot/mcuboot.c @@ -49,48 +49,6 @@ enum IMAGE_INDEXES { IMAGE_INDEX_2 }; -#if USE_PARTITION_MANAGER -#include - -#if CONFIG_MCUBOOT_APPLICATION_IMAGE_NUMBER != -1 -/* Sysbuild */ -#ifdef CONFIG_MCUBOOT -/* lib is part of MCUboot -> operate on the primary application slot */ -#define ACTIVE_SLOT_FLASH_AREA_ID PM_MCUBOOT_PRIMARY_ID -#else -/* TODO: Add firmware loader support */ -/* lib is part of the app -> operate on active slot */ -#if defined(CONFIG_NCS_IS_VARIANT_IMAGE) -#define ACTIVE_SLOT_FLASH_AREA_ID PM_MCUBOOT_SECONDARY_ID -#else -#define ACTIVE_SLOT_FLASH_AREA_ID PM_MCUBOOT_PRIMARY_ID -#endif -#endif /* CONFIG_MCUBOOT */ -#else -/* Legacy child/parent */ -#if CONFIG_BUILD_WITH_TFM - #define PM_ADDRESS_OFFSET (PM_MCUBOOT_PAD_SIZE + PM_TFM_SIZE) -#else - #define PM_ADDRESS_OFFSET (PM_MCUBOOT_PAD_SIZE) -#endif - -#ifdef CONFIG_MCUBOOT - /* lib is part of MCUboot -> operate on the primary application slot */ - #define ACTIVE_SLOT_FLASH_AREA_ID PM_MCUBOOT_PRIMARY_ID -#else - /* lib is part of the App -> operate on active slot */ -#if (PM_ADDRESS - PM_ADDRESS_OFFSET) == PM_MCUBOOT_PRIMARY_ADDRESS - #define ACTIVE_SLOT_FLASH_AREA_ID PM_MCUBOOT_PRIMARY_ID -#elif (PM_ADDRESS - PM_ADDRESS_OFFSET) == PM_MCUBOOT_SECONDARY_ADDRESS - #define ACTIVE_SLOT_FLASH_AREA_ID PM_MCUBOOT_SECONDARY_ID -#else - #error Missing partition definitions. -#endif -#endif /* CONFIG_MCUBOOT */ -#endif /* CONFIG_MCUBOOT_APPLICATION_IMAGE_NUMBER != -1 */ - -#else - #if defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_RAM_LOAD) /* For RAM LOAD mode, the active image must be fetched from the bootloader */ #define ACTIVE_SLOT_FLASH_AREA_ID boot_fetch_active_slot() @@ -100,8 +58,6 @@ enum IMAGE_INDEXES { #define ACTIVE_SLOT_FLASH_AREA_ID DT_FIXED_PARTITION_ID(DT_CHOSEN(zephyr_code_partition)) #endif -#endif /* USE_PARTITION_MANAGER */ - /* * Raw (on-flash) representation of the v1 image header. */ From c12421340e03240846a5420e84b4cd55827f65e7 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:43 +0300 Subject: [PATCH 1112/2141] Revert "[nrf noup] Bluetooth: Mesh: Fix adv randomness bug" This reverts commit 43189afa7eec1ea93bd83e7c7fb2284779723402. Signed-off-by: Jukka Rissanen --- subsys/bluetooth/mesh/adv_ext.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/subsys/bluetooth/mesh/adv_ext.c b/subsys/bluetooth/mesh/adv_ext.c index 0e6f6120f73f..7caff2f91d2b 100644 --- a/subsys/bluetooth/mesh/adv_ext.c +++ b/subsys/bluetooth/mesh/adv_ext.c @@ -568,10 +568,8 @@ int bt_mesh_adv_enable(void) return err; } - if (IS_ENABLED(CONFIG_BT_LL_SOFTDEVICE) && - IS_ENABLED(CONFIG_BT_MESH_ADV_EXT_FRIEND_SEPARATE) && - advs[i].tags == BT_MESH_ADV_TAG_BIT_FRIEND) { - err = set_adv_randomness(advs[i].instance->handle, 0); + if (IS_ENABLED(CONFIG_BT_LL_SOFTDEVICE) && adv->tag & BT_MESH_FRIEND_ADV) { + err = set_adv_randomness(adv->instance->handle, 0); if (err) { LOG_ERR("Failed to set zero randomness: %d", err); } From 30a7b5a6d639aad89b14627f77e456c6f1811022 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:43 +0300 Subject: [PATCH 1113/2141] Revert "[nrf noup] Bluetooth: Mesh: zero randomization for friend's adv" This reverts commit 71c24b8a084e7ae6290b678ce2e4418d75720a39. Signed-off-by: Jukka Rissanen --- subsys/bluetooth/mesh/Kconfig | 2 +- subsys/bluetooth/mesh/adv_ext.c | 32 -------------------------------- 2 files changed, 1 insertion(+), 33 deletions(-) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index cd3d46190971..e51ad2ccac0e 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -1705,7 +1705,7 @@ config BT_MESH_LPN_INIT_POLL_TIMEOUT config BT_MESH_LPN_SCAN_LATENCY int "Latency for enabling scanning" range 0 50 - default 2 + default 15 help Latency in milliseconds that it takes to enable scanning. This is in practice how much time in advance before the Receive Window diff --git a/subsys/bluetooth/mesh/adv_ext.c b/subsys/bluetooth/mesh/adv_ext.c index 7caff2f91d2b..b056f74a5876 100644 --- a/subsys/bluetooth/mesh/adv_ext.c +++ b/subsys/bluetooth/mesh/adv_ext.c @@ -13,9 +13,6 @@ #include #include #include -#if defined(CONFIG_BT_LL_SOFTDEVICE) -#include -#endif #include "common/bt_str.h" @@ -152,28 +149,6 @@ static inline struct bt_mesh_ext_adv *gatt_adv_get(void) } } -static int set_adv_randomness(uint8_t handle, int rand_us) -{ -#if defined(CONFIG_BT_LL_SOFTDEVICE) - struct net_buf *buf; - sdc_hci_cmd_vs_set_adv_randomness_t *cmd_params; - - buf = bt_hci_cmd_alloc(K_FOREVER); - if (!buf) { - LOG_ERR("Could not allocate command buffer"); - return -ENOMEM; - } - - cmd_params = net_buf_add(buf, sizeof(*cmd_params)); - cmd_params->adv_handle = handle; - cmd_params->rand_us = rand_us; - - return bt_hci_cmd_send_sync(SDC_HCI_OPCODE_CMD_VS_SET_ADV_RANDOMNESS, buf, NULL); -#else - return 0; -#endif /* defined(CONFIG_BT_LL_SOFTDEVICE) */ -} - static int adv_start(struct bt_mesh_ext_adv *ext_adv, const struct bt_le_adv_param *param, struct bt_le_ext_adv_start_param *start, @@ -567,13 +542,6 @@ int bt_mesh_adv_enable(void) if (err) { return err; } - - if (IS_ENABLED(CONFIG_BT_LL_SOFTDEVICE) && adv->tag & BT_MESH_FRIEND_ADV) { - err = set_adv_randomness(adv->instance->handle, 0); - if (err) { - LOG_ERR("Failed to set zero randomness: %d", err); - } - } } return 0; From c905268bbce7573d16bf2f5d8db20cd20c97b536 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:43 +0300 Subject: [PATCH 1114/2141] Revert "[nrf noup] modules: tfm: Add Kconfig for CRYPTO_PAKE_MODULE_ENABLED" This reverts commit 821fa521c423a67c7ac013a36345241f7841e4a8. Signed-off-by: Jukka Rissanen --- modules/trusted-firmware-m/Kconfig.tfm.crypto_modules | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/modules/trusted-firmware-m/Kconfig.tfm.crypto_modules b/modules/trusted-firmware-m/Kconfig.tfm.crypto_modules index 9604319ca012..02d3580c22f3 100644 --- a/modules/trusted-firmware-m/Kconfig.tfm.crypto_modules +++ b/modules/trusted-firmware-m/Kconfig.tfm.crypto_modules @@ -88,17 +88,6 @@ config TFM_CRYPTO_KEY_DERIVATION_MODULE_ENABLED is not used. Note that key agreement is under key derivation in the current implementation. -config TFM_CRYPTO_PAKE_MODULE_ENABLED - bool "PAKE crypto module" - default y - depends on PSA_HAS_PAKE_SUPPORT - depends on NRF_SECURITY - depends on PSA_CRYPTO_DRIVER_OBERON || PSA_CRYPTO_DRIVER_CRACEN - help - Enables the PAKE crypto module within the crypto partition. - Unset this option if the functionality provided by 'crypto_pake.c' - is not used. - endif # TFM_PARTITION_CRYPTO endif # BUILD_WITH_TFM From a9602275a5b0a25a6fb0e826e78c74b928a71f6d Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:43 +0300 Subject: [PATCH 1115/2141] Revert "[nrf noup] samples/tests: Disable PM for some sysbuild builds" This reverts commit d1cb7a90e291f4b336ff4729bc5fa7923f228df5. Signed-off-by: Jukka Rissanen --- samples/boards/nordic/nrf53_sync_rtc/sysbuild.conf | 1 - samples/drivers/mbox/sysbuild.conf | 1 - samples/subsys/ipc/ipc_service/icmsg/sysbuild.conf | 1 - samples/subsys/ipc/ipc_service/multi_endpoint/sysbuild.conf | 1 - samples/subsys/ipc/ipc_service/static_vrings/sysbuild.conf | 1 - samples/subsys/logging/multidomain/sysbuild.conf | 1 - tests/boot/mcuboot_recovery_retention/sysbuild.conf | 1 - tests/boot/test_mcuboot/sysbuild.conf | 1 - tests/drivers/flash/common/sysbuild.conf | 1 - tests/drivers/flash/negative_tests/sysbuild.conf | 1 - tests/subsys/fs/fcb/sysbuild.conf | 1 - tests/subsys/fs/littlefs/sysbuild.conf | 1 - 12 files changed, 12 deletions(-) delete mode 100644 samples/boards/nordic/nrf53_sync_rtc/sysbuild.conf delete mode 100644 samples/drivers/mbox/sysbuild.conf delete mode 100644 samples/subsys/ipc/ipc_service/icmsg/sysbuild.conf delete mode 100644 samples/subsys/ipc/ipc_service/multi_endpoint/sysbuild.conf delete mode 100644 samples/subsys/ipc/ipc_service/static_vrings/sysbuild.conf delete mode 100644 samples/subsys/logging/multidomain/sysbuild.conf delete mode 100644 tests/drivers/flash/common/sysbuild.conf delete mode 100644 tests/drivers/flash/negative_tests/sysbuild.conf delete mode 100644 tests/subsys/fs/fcb/sysbuild.conf delete mode 100644 tests/subsys/fs/littlefs/sysbuild.conf diff --git a/samples/boards/nordic/nrf53_sync_rtc/sysbuild.conf b/samples/boards/nordic/nrf53_sync_rtc/sysbuild.conf deleted file mode 100644 index 6408669a8474..000000000000 --- a/samples/boards/nordic/nrf53_sync_rtc/sysbuild.conf +++ /dev/null @@ -1 +0,0 @@ -SB_CONFIG_PARTITION_MANAGER=n diff --git a/samples/drivers/mbox/sysbuild.conf b/samples/drivers/mbox/sysbuild.conf deleted file mode 100644 index 6408669a8474..000000000000 --- a/samples/drivers/mbox/sysbuild.conf +++ /dev/null @@ -1 +0,0 @@ -SB_CONFIG_PARTITION_MANAGER=n diff --git a/samples/subsys/ipc/ipc_service/icmsg/sysbuild.conf b/samples/subsys/ipc/ipc_service/icmsg/sysbuild.conf deleted file mode 100644 index 6408669a8474..000000000000 --- a/samples/subsys/ipc/ipc_service/icmsg/sysbuild.conf +++ /dev/null @@ -1 +0,0 @@ -SB_CONFIG_PARTITION_MANAGER=n diff --git a/samples/subsys/ipc/ipc_service/multi_endpoint/sysbuild.conf b/samples/subsys/ipc/ipc_service/multi_endpoint/sysbuild.conf deleted file mode 100644 index 6408669a8474..000000000000 --- a/samples/subsys/ipc/ipc_service/multi_endpoint/sysbuild.conf +++ /dev/null @@ -1 +0,0 @@ -SB_CONFIG_PARTITION_MANAGER=n diff --git a/samples/subsys/ipc/ipc_service/static_vrings/sysbuild.conf b/samples/subsys/ipc/ipc_service/static_vrings/sysbuild.conf deleted file mode 100644 index 6408669a8474..000000000000 --- a/samples/subsys/ipc/ipc_service/static_vrings/sysbuild.conf +++ /dev/null @@ -1 +0,0 @@ -SB_CONFIG_PARTITION_MANAGER=n diff --git a/samples/subsys/logging/multidomain/sysbuild.conf b/samples/subsys/logging/multidomain/sysbuild.conf deleted file mode 100644 index 6408669a8474..000000000000 --- a/samples/subsys/logging/multidomain/sysbuild.conf +++ /dev/null @@ -1 +0,0 @@ -SB_CONFIG_PARTITION_MANAGER=n diff --git a/tests/boot/mcuboot_recovery_retention/sysbuild.conf b/tests/boot/mcuboot_recovery_retention/sysbuild.conf index 3b5b3c963800..47f00ff3cff8 100644 --- a/tests/boot/mcuboot_recovery_retention/sysbuild.conf +++ b/tests/boot/mcuboot_recovery_retention/sysbuild.conf @@ -1,2 +1 @@ SB_CONFIG_BOOTLOADER_MCUBOOT=y -SB_CONFIG_PARTITION_MANAGER=n diff --git a/tests/boot/test_mcuboot/sysbuild.conf b/tests/boot/test_mcuboot/sysbuild.conf index 3b5b3c963800..47f00ff3cff8 100644 --- a/tests/boot/test_mcuboot/sysbuild.conf +++ b/tests/boot/test_mcuboot/sysbuild.conf @@ -1,2 +1 @@ SB_CONFIG_BOOTLOADER_MCUBOOT=y -SB_CONFIG_PARTITION_MANAGER=n diff --git a/tests/drivers/flash/common/sysbuild.conf b/tests/drivers/flash/common/sysbuild.conf deleted file mode 100644 index 6408669a8474..000000000000 --- a/tests/drivers/flash/common/sysbuild.conf +++ /dev/null @@ -1 +0,0 @@ -SB_CONFIG_PARTITION_MANAGER=n diff --git a/tests/drivers/flash/negative_tests/sysbuild.conf b/tests/drivers/flash/negative_tests/sysbuild.conf deleted file mode 100644 index 6408669a8474..000000000000 --- a/tests/drivers/flash/negative_tests/sysbuild.conf +++ /dev/null @@ -1 +0,0 @@ -SB_CONFIG_PARTITION_MANAGER=n diff --git a/tests/subsys/fs/fcb/sysbuild.conf b/tests/subsys/fs/fcb/sysbuild.conf deleted file mode 100644 index 6408669a8474..000000000000 --- a/tests/subsys/fs/fcb/sysbuild.conf +++ /dev/null @@ -1 +0,0 @@ -SB_CONFIG_PARTITION_MANAGER=n diff --git a/tests/subsys/fs/littlefs/sysbuild.conf b/tests/subsys/fs/littlefs/sysbuild.conf deleted file mode 100644 index 6408669a8474..000000000000 --- a/tests/subsys/fs/littlefs/sysbuild.conf +++ /dev/null @@ -1 +0,0 @@ -SB_CONFIG_PARTITION_MANAGER=n From 8d1411cabffdb1ef44332f37ddede50c3a434488 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:43 +0300 Subject: [PATCH 1116/2141] Revert "[nrf noup] samples&tests: Restore a few CONFIG_NEWLIB_LIBC_NANO=n" This reverts commit a6e6112a4c064a3d280153bc8644236153105c0e. Signed-off-by: Jukka Rissanen --- tests/lib/newlib/heap_listener/prj.conf | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/lib/newlib/heap_listener/prj.conf b/tests/lib/newlib/heap_listener/prj.conf index 7282777ff1ca..e5a5dc6df4c1 100644 --- a/tests/lib/newlib/heap_listener/prj.conf +++ b/tests/lib/newlib/heap_listener/prj.conf @@ -1,4 +1,3 @@ CONFIG_ZTEST=y CONFIG_NEWLIB_LIBC=y -CONFIG_NEWLIB_LIBC_NANO=n CONFIG_NEWLIB_LIBC_HEAP_LISTENER=y From adb791180dd4b13ab74f84d7001fc1b6ab30c541 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:43 +0300 Subject: [PATCH 1117/2141] Revert "[nrf noup] samples: mgmt: mcumgr smp_svr: Migrate child image config" This reverts commit cda7620299116bde3df5639d50b9c1b9169ee1e3. Signed-off-by: Jukka Rissanen --- .../subsys/mgmt/mcumgr/smp_svr/sysbuild/hci_rpmsg.conf | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 samples/subsys/mgmt/mcumgr/smp_svr/sysbuild/hci_rpmsg.conf diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/sysbuild/hci_rpmsg.conf b/samples/subsys/mgmt/mcumgr/smp_svr/sysbuild/hci_rpmsg.conf deleted file mode 100644 index 98260877332f..000000000000 --- a/samples/subsys/mgmt/mcumgr/smp_svr/sysbuild/hci_rpmsg.conf +++ /dev/null @@ -1,10 +0,0 @@ -# -# Copyright (c) 2022 Nordic Semiconductor -# -# SPDX-License-Identifier: Apache-2.0 -# - -CONFIG_BT_MAX_CONN=2 -CONFIG_BT_BUF_ACL_RX_SIZE=502 -CONFIG_BT_BUF_ACL_TX_SIZE=502 -CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 From dff3af8caf1f9e4528f5b0da180abb43b9232f9b Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:43 +0300 Subject: [PATCH 1118/2141] Revert "[nrf noup] samples: bluetooth: hci_pow_ctrl: Migrate child image config" This reverts commit 757558096a07cc71ee4afc0f6aebe766bbb61d01. Signed-off-by: Jukka Rissanen --- samples/bluetooth/hci_pwr_ctrl/sysbuild/hci_rpmsg.conf | 1 - 1 file changed, 1 deletion(-) delete mode 100644 samples/bluetooth/hci_pwr_ctrl/sysbuild/hci_rpmsg.conf diff --git a/samples/bluetooth/hci_pwr_ctrl/sysbuild/hci_rpmsg.conf b/samples/bluetooth/hci_pwr_ctrl/sysbuild/hci_rpmsg.conf deleted file mode 100644 index e6749ae63990..000000000000 --- a/samples/bluetooth/hci_pwr_ctrl/sysbuild/hci_rpmsg.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_BT_CTLR_TX_PWR_DYNAMIC_CONTROL=y From 473d6ad6e15a360df0dc96d8903b63376c4b5e60 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:43 +0300 Subject: [PATCH 1119/2141] Revert "[nrf noup] mgmt/mcumgr: Bootutil hooks to handle image-1" This reverts commit c82b5f3d3859c3aa32c1157bd4225a2186a47856. Signed-off-by: Jukka Rissanen --- subsys/mgmt/mcumgr/CMakeLists.txt | 8 ----- subsys/mgmt/mcumgr/Kconfig | 1 - .../mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c | 35 ------------------- 3 files changed, 44 deletions(-) delete mode 100644 subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c diff --git a/subsys/mgmt/mcumgr/CMakeLists.txt b/subsys/mgmt/mcumgr/CMakeLists.txt index ad088eca0677..39d4a4ca8ce0 100644 --- a/subsys/mgmt/mcumgr/CMakeLists.txt +++ b/subsys/mgmt/mcumgr/CMakeLists.txt @@ -16,11 +16,3 @@ add_subdirectory(transport) add_subdirectory_ifdef(CONFIG_SMP_CLIENT smp_client) zephyr_library_link_libraries(mgmt_mcumgr) - -if (CONFIG_BOOT_IMAGE_ACCESS_HOOKS) - zephyr_include_directories( - ${ZEPHYR_MCUBOOT_MODULE_DIR}/boot/bootutil/include - ${ZEPHYR_MCUBOOT_MODULE_DIR}/boot/zephyr/include - ) - zephyr_library_sources(bootutil_hooks/nrf53_hooks.c) -endif() diff --git a/subsys/mgmt/mcumgr/Kconfig b/subsys/mgmt/mcumgr/Kconfig index 1c6a3a2a5162..49bd17f46691 100644 --- a/subsys/mgmt/mcumgr/Kconfig +++ b/subsys/mgmt/mcumgr/Kconfig @@ -6,7 +6,6 @@ menuconfig MCUMGR bool "mcumgr Support" depends on NET_BUF depends on ZCBOR - imply BOOT_IMAGE_ACCESS_HOOKS if (SOC_NRF5340_CPUAPP_QKAA && MCUMGR_GRP_IMG) help This option enables the mcumgr management library. diff --git a/subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c b/subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c deleted file mode 100644 index f1ac8a168e65..000000000000 --- a/subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include "bootutil/bootutil_public.h" - -#if CONFIG_MCUBOOT_NETWORK_CORE_IMAGE_NUMBER != -1 -/* Sysbuild */ -#define NET_CORE_IMAGE CONFIG_MCUBOOT_NETWORK_CORE_IMAGE_NUMBER -#else -/* Legacy child/parent */ -#define NET_CORE_IMAGE 1 -#endif - -int boot_read_swap_state_primary_slot_hook(int image_index, - struct boot_swap_state *state) -{ - if (image_index == NET_CORE_IMAGE) { - /* Pretend that primary slot of image 1 unpopulated */ - state->magic = BOOT_MAGIC_UNSET; - state->swap_type = BOOT_SWAP_TYPE_NONE; - state->image_num = image_index; - state->copy_done = BOOT_FLAG_UNSET; - state->image_ok = BOOT_FLAG_UNSET; - - /* Prevent bootutil from trying to obtain true info */ - return 0; - } - - return BOOT_HOOK_REGULAR; -} From 0e07545f64ee3bbccb8ec7b7eb3c59a1b46ef482 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:43 +0300 Subject: [PATCH 1120/2141] Revert "[nrf noup] mcumgr: img_mgmt: Fix check for chosen code partition" This reverts commit 6b04ceee078c40901b3ddd15e821fde8333d5f5c. Signed-off-by: Jukka Rissanen --- subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c index d0303360f691..035a765798ee 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c @@ -43,23 +43,6 @@ #if !defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_RAM_LOAD) -#if USE_PARTITION_MANAGER -#include - -#ifdef PM_MCUBOOT_SECONDARY_PAD_SIZE -BUILD_ASSERT(PM_MCUBOOT_PAD_SIZE == PM_MCUBOOT_SECONDARY_PAD_SIZE); -#endif - -#if CONFIG_BUILD_WITH_TFM - #define PM_ADDRESS_OFFSET (PM_MCUBOOT_PAD_SIZE + PM_TFM_SIZE) -#else - #define PM_ADDRESS_OFFSET (PM_MCUBOOT_PAD_SIZE) -#endif - -#define FIXED_PARTITION_IS_RUNNING_APP_PARTITION(label) \ - (FIXED_PARTITION_OFFSET(label) == (PM_ADDRESS - PM_ADDRESS_OFFSET)) - -#else /* ! USE_PARTITION_MANAGER */ #ifndef CONFIG_FLASH_LOAD_OFFSET #error MCUmgr requires application to be built with CONFIG_FLASH_LOAD_OFFSET set \ to be able to figure out application running slot. @@ -67,7 +50,6 @@ BUILD_ASSERT(PM_MCUBOOT_PAD_SIZE == PM_MCUBOOT_SECONDARY_PAD_SIZE); #define FIXED_PARTITION_IS_RUNNING_APP_PARTITION(label) \ (FIXED_PARTITION_OFFSET(label) == CONFIG_FLASH_LOAD_OFFSET) -#endif /* USE_PARTITION_MANAGER */ BUILD_ASSERT(sizeof(struct image_header) == IMAGE_HEADER_SIZE, "struct image_header not required size"); From 00c9659f20cdb9d776940349d114a7e7bec4bf9a Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:43 +0300 Subject: [PATCH 1121/2141] Revert "[nrf noup] drivers/flashdisk: Add support for Partition Manager" This reverts commit a01de066f17e286537b4979a04ca69c286806bc9. Signed-off-by: Jukka Rissanen --- drivers/disk/flashdisk.c | 78 ---------------------------------------- 1 file changed, 78 deletions(-) diff --git a/drivers/disk/flashdisk.c b/drivers/disk/flashdisk.c index 4d8e3f1eee01..1ac3d15ba62f 100644 --- a/drivers/disk/flashdisk.c +++ b/drivers/disk/flashdisk.c @@ -469,8 +469,6 @@ static const struct disk_operations flash_disk_ops = { .ioctl = disk_flash_access_ioctl, }; -#ifndef USE_PARTITION_MANAGER -/* The non-Partition manager, DTS based generators below */ #define DT_DRV_COMPAT zephyr_flash_disk #define PARTITION_PHANDLE(n) DT_PHANDLE_BY_IDX(DT_DRV_INST(n), partition, 0) @@ -512,82 +510,6 @@ DT_INST_FOREACH_STATUS_OKAY(VERIFY_CACHE_SIZE_IS_NOT_ZERO_IF_NOT_READ_ONLY) "Devicetree node " DT_NODE_PATH(DT_DRV_INST(n)) \ " has cache size which is not a multiple of its sector size"); DT_INST_FOREACH_STATUS_OKAY(VERIFY_CACHE_SIZE_IS_MULTIPLY_OF_SECTOR_SIZE) -#else /* ifndef USE_PARTITION_MANAGER */ -/* Partition Manager based generators below */ - -/* Gets the PM_..._EXTRA_PARAM_##param value */ -#define PM_FLASH_DISK_ENTRY_EXTRA_PARAM(name, param) PM_##name##_EXTRA_PARAM_disk_##param - -/* Gets the PM_..._NAME value which is originally cased, as in yaml, partition name */ -#define PM_FLASH_DISK_ENTRY_PARTITION_NAME(name) PM_##name##_NAME - -/* Generates flashdiskN_cache variable name, where N is partition ID */ -#define PM_FLASH_DISK_CACHE_VARIABLE(n) UTIL_CAT(flashdisk, UTIL_CAT(FIXED_PARTITION_ID(n), _cache)) - -/* Generate cache buffers */ -#define CACHE_SIZE(n) (COND_CODE_1(PM_FLASH_DISK_ENTRY_EXTRA_PARAM(n, read_only), (0), (1)) * \ - PM_FLASH_DISK_ENTRY_EXTRA_PARAM(n, cache_size)) -#define DEFINE_FLASHDISKS_CACHE(n) \ - static uint8_t __aligned(4) PM_FLASH_DISK_CACHE_VARIABLE(n)[CACHE_SIZE(n)]; - -PM_FOREACH_AFFILIATED_TO_disk(DEFINE_FLASHDISKS_CACHE) - -/* Generated single Flash Disk device data from Partition Manager partition. - * Partition is required to have type set to disk in partition definitions: - * type: disk - * and following extra params can be provided: - * extra_params: { - * name = "", - * cache_size = , - * sector_size = , - * read_only = - * } - * where: - * is mandatory device name that will be used by Disk Access and FAT FS to mount device; - * is cache r/w cache size, which is mandatory if read_only = 0 or not present, - * and should be multiple of ; - * is mandatory device sector size information, usually should be erase page size, - * for flash devices, for example 4096 bytes; - * read_only is optional, if not present then assumed false; can be 0(false) or 1(true). - */ -#define DEFINE_FLASHDISKS_DEVICE(n) \ -{ \ - .info = { \ - .ops = &flash_disk_ops, \ - .name = STRINGIFY(PM_FLASH_DISK_ENTRY_EXTRA_PARAM(n, name)), \ - }, \ - .area_id = FIXED_PARTITION_ID(n), \ - .offset = FIXED_PARTITION_OFFSET(n), \ - .cache = PM_FLASH_DISK_CACHE_VARIABLE(n), \ - .cache_size = sizeof(PM_FLASH_DISK_CACHE_VARIABLE(n)), \ - .size = FIXED_PARTITION_SIZE(n), \ - .sector_size = PM_FLASH_DISK_ENTRY_EXTRA_PARAM(n, sector_size), \ -}, - -/* The bellow used PM_FOREACH_TYPE_disk is generated by Partition Manager foreach - * loop macro. The lower case _disk is type name for which the macro has been generated; - * partition entry can have multiple types set and foreach macro will be generated - * for every type found across partition definitions. - */ -static struct flashdisk_data flash_disks[] = { - PM_FOREACH_AFFILIATED_TO_disk(DEFINE_FLASHDISKS_DEVICE) -}; - -#define VERIFY_CACHE_SIZE_IS_NOT_ZERO_IF_NOT_READ_ONLY(n) \ - COND_CODE_1(PM_FLASH_DISK_ENTRY_EXTRA_PARAM(n, read_only), \ - (/* cache-size is not used for read-only disks */), \ - (BUILD_ASSERT(PM_FLASH_DISK_ENTRY_EXTRA_PARAM(n, cache_size) != 0, \ - "Flash disk partition " STRINGIFY(PM_FLASH_DISK_ENTRY_PARTITION_NAME(n))\ - " must have non-zero cache-size");)) -PM_FOREACH_AFFILIATED_TO_disk(VERIFY_CACHE_SIZE_IS_NOT_ZERO_IF_NOT_READ_ONLY) - -#define VERIFY_CACHE_SIZE_IS_MULTIPLY_OF_SECTOR_SIZE(n) \ - BUILD_ASSERT(PM_FLASH_DISK_ENTRY_EXTRA_PARAM(n, cache_size) % \ - PM_FLASH_DISK_ENTRY_EXTRA_PARAM(n, sector_size) == 0, \ - "Devicetree node " STRINGIFY(PM_FLASH_DISK_ENTRY_PARTITION_NAME(n)) \ - " has cache size which is not a multiple of its sector size"); -PM_FOREACH_AFFILIATED_TO_disk(VERIFY_CACHE_SIZE_IS_MULTIPLY_OF_SECTOR_SIZE) -#endif /* USE_PARTITION_MANAGER */ static int disk_flash_init(void) { From a85f79be1e07521fca820bc67e6783dab17b32f5 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:43 +0300 Subject: [PATCH 1122/2141] Revert "[nrf noup] modules: mbedtls: Add include folders" This reverts commit a3505ca86f9f4bb9a1d33116259bb2d7e08196db. Signed-off-by: Jukka Rissanen --- modules/mbedtls/CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/modules/mbedtls/CMakeLists.txt b/modules/mbedtls/CMakeLists.txt index 8801e1ecdf17..61c7400017da 100644 --- a/modules/mbedtls/CMakeLists.txt +++ b/modules/mbedtls/CMakeLists.txt @@ -40,8 +40,6 @@ zephyr_interface_library_named(mbedTLS) # Add regular includes target_include_directories(mbedTLS INTERFACE ${ZEPHYR_CURRENT_MODULE_DIR}/include - ${ZEPHYR_CURRENT_MODULE_DIR}/include/library - ${ZEPHYR_CURRENT_MODULE_DIR}/library configs include ) From 9c98d506adf00af4b598d31336c23ec438dcef9c Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:43 +0300 Subject: [PATCH 1123/2141] Revert "[nrf noup] modules: mbedtls: Allow MBEDTLS_BUILTIN to be deselected" This reverts commit 0556e7f7d3e2e046bb334ef2133c071179caf189. Signed-off-by: Jukka Rissanen --- modules/mbedtls/Kconfig | 6 ------ 1 file changed, 6 deletions(-) diff --git a/modules/mbedtls/Kconfig b/modules/mbedtls/Kconfig index f7bc6a609f1f..bf165473f17f 100644 --- a/modules/mbedtls/Kconfig +++ b/modules/mbedtls/Kconfig @@ -29,7 +29,6 @@ choice MBEDTLS_IMPLEMENTATION config MBEDTLS_BUILTIN bool "Use Zephyr in-tree mbedTLS version" - depends on ! DISABLE_MBEDTLS_BUILTIN help Link with mbedTLS sources included with Zephyr distribution. Included mbedTLS version is well integrated with and supported @@ -43,11 +42,6 @@ config MBEDTLS_LIBRARY endchoice -# subsystems cannot deselect MBEDTLS_BUILTIN, but they can select -# DISABLE_MBEDTLS_BUILTIN. -config DISABLE_MBEDTLS_BUILTIN - bool - config CUSTOM_MBEDTLS_CFG_FILE bool "Custom mbed TLS configuration file" help From 386f8834dd1f0d5e9d72a44173e580ea70e5310c Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:43 +0300 Subject: [PATCH 1124/2141] Revert "[nrf noup] modules: tf-m: use of PSA_HAS_XXXX_SUPPORT" This reverts commit 5620a796e91d9e65c6a02d7585ca8909eb674c77. Signed-off-by: Jukka Rissanen --- modules/trusted-firmware-m/Kconfig.tfm.crypto_modules | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/modules/trusted-firmware-m/Kconfig.tfm.crypto_modules b/modules/trusted-firmware-m/Kconfig.tfm.crypto_modules index 02d3580c22f3..1d70a2c44d29 100644 --- a/modules/trusted-firmware-m/Kconfig.tfm.crypto_modules +++ b/modules/trusted-firmware-m/Kconfig.tfm.crypto_modules @@ -10,7 +10,6 @@ if TFM_PARTITION_CRYPTO config TFM_CRYPTO_RNG_MODULE_ENABLED bool "Random number generator crypto module" default y - depends on PSA_WANT_GENERATE_RANDOM && NRF_SECURITY help Enables the random number generator module within the crypto partition. Unset this option if 'psa_generate_random' is not used. @@ -18,7 +17,6 @@ config TFM_CRYPTO_RNG_MODULE_ENABLED config TFM_CRYPTO_KEY_MODULE_ENABLED bool "KEY crypto module" default y - depends on PSA_HAS_KEY_SUPPORT && NRF_SECURITY help Enables the KEY crypto module within the crypto partition. Unset this option if the functionality provided by 'crypto_key_management.c' @@ -27,7 +25,6 @@ config TFM_CRYPTO_KEY_MODULE_ENABLED config TFM_CRYPTO_AEAD_MODULE_ENABLED bool "AEAD crypto module" default y - depends on PSA_HAS_AEAD_SUPPORT && NRF_SECURITY help Enables the AEAD crypto module within the crypto partition. Unset this option if the functionality provided by 'crypto_aead.c' @@ -36,7 +33,6 @@ config TFM_CRYPTO_AEAD_MODULE_ENABLED config TFM_CRYPTO_MAC_MODULE_ENABLED bool "MAC crypto module" default y - depends on PSA_HAS_MAC_SUPPORT && NRF_SECURITY help Enables the MAC crypto module within the crypto partition. Unset this option if the functionality provided by 'crypto_mac.c' @@ -45,7 +41,6 @@ config TFM_CRYPTO_MAC_MODULE_ENABLED config TFM_CRYPTO_HASH_MODULE_ENABLED bool "HASH crypto module" default y - depends on PSA_HAS_HASH_SUPPORT && NRF_SECURITY help Enables the HASH crypto module within the crypto partition. Unset this option if the functionality provided by 'crypto_hash.c' @@ -54,7 +49,6 @@ config TFM_CRYPTO_HASH_MODULE_ENABLED config TFM_CRYPTO_CIPHER_MODULE_ENABLED bool "CIPHER crypto module" default y - depends on PSA_HAS_CIPHER_SUPPORT && NRF_SECURITY help Enables the CIPHER crypto module within the crypto partition. Unset this option if the functionality provided by 'crypto_cipher.c' @@ -63,7 +57,6 @@ config TFM_CRYPTO_CIPHER_MODULE_ENABLED config TFM_CRYPTO_ASYM_ENCRYPT_MODULE_ENABLED bool "ASYM ENCRYPT crypto module" default y - depends on PSA_HAS_ASYM_ENCRYPT_SUPPORT && NRF_SECURITY help Enables the ASYM ENCRYPT crypto module within the crypto partition. Unset this option if the encrypt functionality provided by 'crypto_asymmetric.c' @@ -72,7 +65,6 @@ config TFM_CRYPTO_ASYM_ENCRYPT_MODULE_ENABLED config TFM_CRYPTO_ASYM_SIGN_MODULE_ENABLED bool "ASYM SIGN crypto module" default y - depends on PSA_HAS_ASYM_SIGN_SUPPORT && NRF_SECURITY help Enables the ASYM SIGN crypto module within the crypto partition. Unset this option if the sign functionality provided by 'crypto_asymmetric.c' @@ -81,12 +73,10 @@ config TFM_CRYPTO_ASYM_SIGN_MODULE_ENABLED config TFM_CRYPTO_KEY_DERIVATION_MODULE_ENABLED bool "KEY DERIVATION crypto module" default y - depends on (PSA_HAS_KEY_DERIVATION || PSA_HAS_KEY_AGREEMENT) && NRF_SECURITY help Enables the KEY_DERIVATION crypto module within the crypto partition. Unset this option if the functionality provided by 'crypto_key_derivation.c' is not used. - Note that key agreement is under key derivation in the current implementation. endif # TFM_PARTITION_CRYPTO From 45c0781d662b572fd4704330611d8e0bedfb2652 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:43 +0300 Subject: [PATCH 1125/2141] Revert "[nrf noup] doc: remove Kconfig search" This reverts commit 68cba0c8e64da160f49c2296ef956fe1512369d9. Signed-off-by: Jukka Rissanen --- MAINTAINERS.yml | 1 + doc/build/kconfig/setting.rst | 6 ++++-- doc/develop/application/index.rst | 5 +++-- doc/kconfig.rst | 8 ++++++++ 4 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 doc/kconfig.rst diff --git a/MAINTAINERS.yml b/MAINTAINERS.yml index 77296a734a6d..3e7c3048b538 100644 --- a/MAINTAINERS.yml +++ b/MAINTAINERS.yml @@ -1041,6 +1041,7 @@ Documentation: - doc/images/Zephyr-Kite-in-tree.png - doc/index-tex.rst - doc/index.rst + - doc/kconfig.rst - doc/templates/sample.tmpl - doc/templates/board.tmpl - boards/index.rst diff --git a/doc/build/kconfig/setting.rst b/doc/build/kconfig/setting.rst index 6fe1feaed7d3..ad62d86eb3d4 100644 --- a/doc/build/kconfig/setting.rst +++ b/doc/build/kconfig/setting.rst @@ -7,7 +7,8 @@ The :ref:`menuconfig and guiconfig interfaces ` can be used to test out configurations during application development. This page explains how to make settings permanent. -All Kconfig options can be searched in the Kconfig search page. +All Kconfig options can be searched in the :ref:`Kconfig search page +`. .. note:: @@ -114,7 +115,8 @@ Assignments in configuration files are only respected if the dependencies for the symbol are satisfied. A warning is printed otherwise. To figure out what the dependencies of a symbol are, use one of the :ref:`interactive configuration interfaces ` (you can jump directly to a symbol with -:kbd:`/`), or look up the symbol in the Kconfig search page. +:kbd:`/`), or look up the symbol in the :ref:`Kconfig search page +`. .. _initial-conf: diff --git a/doc/develop/application/index.rst b/doc/develop/application/index.rst index 42d53040bd29..7dc4539677ea 100644 --- a/doc/develop/application/index.rst +++ b/doc/develop/application/index.rst @@ -648,8 +648,9 @@ started. See :ref:`setting_configuration_values` for detailed documentation on setting Kconfig configuration values. The :ref:`initial-conf` section on the same page -explains how the initial configuration is derived. See :ref:`hardening` for -security information related with Kconfig options. +explains how the initial configuration is derived. See :ref:`kconfig-search` +for a complete list of configuration options. +See :ref:`hardening` for security information related with Kconfig options. The other pages in the :ref:`Kconfig section of the manual ` are also worth going through, especially if you planning to add new configuration diff --git a/doc/kconfig.rst b/doc/kconfig.rst new file mode 100644 index 000000000000..1123de2adbd9 --- /dev/null +++ b/doc/kconfig.rst @@ -0,0 +1,8 @@ +:orphan: + +.. _kconfig-search: + +Kconfig Search +============== + +.. kconfig:search:: From 69ab8f90f16f8b5b3449b7d58b84ec612f538c83 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:44 +0300 Subject: [PATCH 1126/2141] Revert "[nrf noup] Revert "twister: Use natural sort when generating hardware map"" This reverts commit 0250cd1c9fb33c0d9b5da883b24bdfdb7df522c2. Signed-off-by: Jukka Rissanen --- scripts/pylib/twister/twisterlib/hardwaremap.py | 2 +- scripts/requirements-run-test.txt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/pylib/twister/twisterlib/hardwaremap.py b/scripts/pylib/twister/twisterlib/hardwaremap.py index 5c0c5eb12385..d3308b8cbe3f 100644 --- a/scripts/pylib/twister/twisterlib/hardwaremap.py +++ b/scripts/pylib/twister/twisterlib/hardwaremap.py @@ -386,7 +386,7 @@ def save(self, hwm_file): boot_ids = [] # use existing map - self.detected.sort(key=lambda x: x.serial or '') + self.detected = natsorted(self.detected, key=lambda x: x.serial or '') if os.path.exists(hwm_file): with open(hwm_file) as yaml_file: hwm = yaml.load(yaml_file, Loader=SafeLoader) diff --git a/scripts/requirements-run-test.txt b/scripts/requirements-run-test.txt index 08ff89b0c545..d3a4be916735 100644 --- a/scripts/requirements-run-test.txt +++ b/scripts/requirements-run-test.txt @@ -7,6 +7,7 @@ pyocd>=0.35.0 # used by twister for board/hardware map tabulate +natsort # used by mcuboot cbor>=1.0.0 From 9627a3014320fc0b2dfea9077afb8e48ecc9b6ac Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:44 +0300 Subject: [PATCH 1127/2141] Revert "[nrf noup] tests: drivers: build_all: regulator: use old schema" This reverts commit e6f28400604c1307aa5768438749b9686e891947. Signed-off-by: Jukka Rissanen --- tests/drivers/build_all/regulator/testcase.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/drivers/build_all/regulator/testcase.yaml b/tests/drivers/build_all/regulator/testcase.yaml index b662f0ac2050..30d494aca231 100644 --- a/tests/drivers/build_all/regulator/testcase.yaml +++ b/tests/drivers/build_all/regulator/testcase.yaml @@ -3,7 +3,9 @@ tests: drivers.regulator.build: - tags: drivers regulator + tags: + - drivers + - regulator build_only: true platform_allow: - native_sim From 18a1efa7929c919de9deed6c553c1ce2681ba8ac Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:44 +0300 Subject: [PATCH 1128/2141] Revert "[nrf noup] ci: add .github/test-spec.yml" This reverts commit fc65d19b1f987439ab158c74e32f2085060baf09. Signed-off-by: Jukka Rissanen --- .github/test-spec.yml | 392 ------------------------------------------ 1 file changed, 392 deletions(-) delete mode 100644 .github/test-spec.yml diff --git a/.github/test-spec.yml b/.github/test-spec.yml deleted file mode 100644 index 6da6bdbaa87d..000000000000 --- a/.github/test-spec.yml +++ /dev/null @@ -1,392 +0,0 @@ -# This is the Jenkins ci variant of the .github/labler.yaml - -"CI-run-zephyr-twister": - - any: - - "!.github/**/*" - - "!doc/**/*" - - "!CODEOWNERS" - - "!LICENSE" - - "!**/*.rst" - - "!VERSION" - - "!submanifests/**/*" - - "!MAINTAINERS.yml" - - "!version.h.in" - - "!Jenkinsfile" - - "!**/*.md" - -"CI-iot-zephyr-lwm2m-test": - - "drivers/console/**/*" - - "drivers/flash/**/*" - - "subsys/dfu/boot/**/*" - - "subsys/net/ip/**/*" - - "subsys/net/lib/http/**/*" - - "subsys/net/lib/lwm2m//**/*" - - "subsys/net/**/*" - -"CI-iot-samples-test": - - "boards/nordic/nrf9160dk/**/*" - - "dts/arm/nordic/nrf9160*" - - "include/net/**/*" - - "subsys/net/lib/**/*" - -"CI-iot-libraries-test": - - "boards/nordic/nrf9160dk/**/*" - - "dts/arm/nordic/nrf9160*" - - "include/net/socket_ncs.h" - - "subsys/testsuite/ztest/**/*" - -"CI-lwm2m-test": null -# Not necessary to run tests on changes to this repo. - -"CI-boot-test": - - "subsys/mgmt/mcumgr/**/*" - - "subsys/dfu/**/*" - - "include/mgmt/mcumgr/**/*" - - "include/dfu/**/*" - - "samples/subsys/mgmt/mcumgr/smp_svr/**/*" - - "tests/boot/**/*" - - "tests/subsys/dfu/**/*" - - "tests/subsys/mgmt/mcumgr/**/*" - -"CI-tfm-test": - - "boards/nordic/nrf5340dk/**/*" - - "boards/nordic/nrf9160dk/**/*" - - "drivers/entropy/*" - - "dts/arm/nordic/nrf5340*" - - "dts/arm/nordic/nrf9160*" - - "modules/trusted-firmware-m/**/*" - - "samples/tfm_integration/**/*" - -"CI-ble-test": - - any: - - "drivers/bluetooth/**/*" - - any: - - "dts/arm/nordic/nrf5*" - - any: - - "subsys/bluetooth/**/*" - - "!subsys/bluetooth/mesh/**/*" - - "!subsys/bluetooth/audio/**/*" - - any: - - "include/zephyr/bluetooth/**/*" - - "!include/zephyr/bluetooth/mesh/**/*" - - "samples/bluetooth/hci_ipc/**/*" - -"CI-ble-samples-test": - - any: - - "drivers/bluetooth/**/*" - - any: - - "dts/arm/nordic/nrf5*" - - any: - - "subsys/bluetooth/**/*" - - "!subsys/bluetooth/mesh/**/*" - - "!subsys/bluetooth/audio/**/*" - - any: - - "include/zephyr/bluetooth/**/*" - - "!include/zephyr/bluetooth/mesh/**/*" - - "samples/bluetooth/**/*" - -"CI-mesh-test": - - "subsys/bluetooth/mesh/**/*" - - "include/zephyr/bluetooth/mesh/**/*" - - "samples/bluetooth/mesh/**/*" - - "samples/bluetooth/mesh_demo/**/*" - - "samples/bluetooth/mesh_provisioner/**/*" - - "tests/bluetooth/mesh/**/*" - - "tests/bluetooth/mesh_shell/**/*" - -"CI-thingy91-test": - - "boards/nordic/nrf9160dk/**/*" - - "arch/x86/core/**/*" - - "arch/x86/include/**/*" - - "drivers/console/**/*" - - "drivers/ethernet/**/*" - - "drivers/flash/**/*" - - "drivers/hwinfo/**/*" - - "drivers/interrupt_controller/**/*" - - "drivers/net/**/*" - - "drivers/serial/**/*" - - "drivers/timer/**/*" - - "include/**/*" - - "kernel/**/*" - - "lib/libc/common/source/stdlib/**/*" - - "lib/libc/newlib/**/*" - - "lib/libc/picolibc/**/*" - - "lib/os/**/*" - - "lib/posix/**/*" - - "misc/**/*" - - "modules/mbedtls/**/*" - - "soc/x86/ia32/**/*" - - "subsys/fs/fcb/**/*" - - "subsys/logging/**/*" - - "subsys/net/**/*" - - "subsys/random/**/*" - - "subsys/settings/include/**/*" - - "subsys/settings/src/**/*" - - "subsys/stats/**/*" - - "subsys/storage/flash_map/**/*" - - "subsys/storage/stream/**/*" - - "subsys/tracing/**/*" - -"CI-desktop-test": - - "drivers/bluetooth/*" - - "subsys/bluetooth/*" - - "include/zephyr/bluetooth/*" - -"CI-crypto-test": - - "boards/nordic/nrf52840dk/**/*" - - "boards/nordic/nrf5340dk/**/*" - - "boards/nordic/nrf9160dk/**/*" - - "drivers/entropy/*" - - "drivers/serial/**/*" - - "dts/arm/nordic/nrf52840*" - - "dts/arm/nordic/nrf5340*" - - "dts/arm/nordic/nrf9160*" - - "include/drivers/serial/**/*" - - "modules/mbedtls/**/*" - -"CI-fem-test": - - "boards/nordic/**/*" - - "drivers/bluetooth/hci/**/*" - - "drivers/entropy/**/*" - - "dts/bindings/**/*" - - "include/zephyr/net/**/*" - - "include/zephyr/arch/**/*" - - "lib/libc/**/*" - - "lib/open-amp/**/*" - - "modules/hal_nordic/**/*" - - "modules/mbedtls/**/*" - - "modules/openthread/**/*" - - "modules/trusted-firmware-m/**/*" - - "samples/net/sockets/echo_*/**/*" - - "share/**/*" - - "soc/nordic/**/*" - - "subsys/net/**/*" - - "subsys/settings/**/*" - - "subsys/bluetooth/shell/**/*" - - "subsys/ipc/**/*" - - "Kconfig" - - "CMakeLists.txt" - -"CI-rs-test": - - "boards/nordic/**/*" - - "drivers/bluetooth/hci/**/*" - - "drivers/entropy/**/*" - - "dts/bindings/**/*" - - "include/zephyr/net/**/*" - - "include/zephyr/arch/**/*" - - "lib/libc/**/*" - - "lib/open-amp/**/*" - - "modules/hal_nordic/**/*" - - "modules/mbedtls/**/*" - - "modules/openthread/**/*" - - "modules/trusted-firmware-m/**/*" - - "samples/net/sockets/echo_*/**/*" - - "share/**/*" - - "soc/nordic/**/*" - - "subsys/net/**/*" - - "subsys/settings/**/*" - - "subsys/bluetooth/shell/**/*" - - "subsys/ipc/**/*" - - "Kconfig" - - "CMakeLists.txt" - -"CI-thread-test": - - "include/zephyr/net/**/*" - - "modules/mbedtls/**/*" - - "modules/openthread/**/*" - - "samples/net/openthread/**/*" - - "soc/nordic/**/*" - - "subsys/net/**/*" - - "subsys/settings/**/*" - -"CI-nfc-test": - - "drivers/bluetooth/hci/**/*" - - "drivers/entropy/**/*" - - "drivers/flash/**/*" - - "drivers/mbox/**/*" - - "drivers/spi/**/*" - - "lib/crc/**/*" - - "modules/hal_nordic/**/*" - - "soc/nordic/**/*" - - "subsys/ipc/ipc_service/**/*" - - "subsys/fs/**/*" - - "subsys/mem_mgmt/**/*" - - "subsys/net/**/*" - - "subsys/random/**/*" - - "subsys/settings/**/*" - - "subsys/shell/**/*" - - "subsys/storage/**/*" - - any: - - "subsys/bluetooth/**/*" - - "!subsys/bluetooth/mesh/**/*" - -"CI-matter-test": - - "include/dfu/**/*" - - "include/mgmt/mcumgr/**/*" - - "soc/nordic/**/*" - - "subsys/dfu/**/*" - - "subsys/settings/**/*" - - "subsys/net/**/*" - - "subsys/mgmt/mcumgr/**/*" - - "drivers/net/**/*" - - "samples/bluetooth/hci_ipc/**/*" - - any: - - "subsys/bluetooth/**/*" - - "!subsys/bluetooth/mesh/**/*" - - "!subsys/bluetooth/audio/**/*" - -"CI-find-my-test": - - "boards/nordic/**/*" - - "drivers/bluetooth/**/*" - - "drivers/entropy/**/*" - - "drivers/flash/**/*" - - "drivers/usb/**/*" - - "drivers/regulator/**/*" - - "soc/nordic/**/*" - - "subsys/dfu/**/*" - - "subsys/fs/**/*" - - "subsys/ipc/**/*" - - "subsys/net/**/*" - - "subsys/random/**/*" - - "subsys/settings/**/*" - - "subsys/storage/**/*" - - "subsys/tracing/**/*" - - "subsys/usb/device/**/*" - - any: - - "subsys/bluetooth/**/*" - - "!subsys/bluetooth/mesh/**/*" - -"CI-rpc-test": - - "subsys/ipc/ipc_service/**/*" - - "subsys/random/**/*" - - "soc/nordic/nrf53/**/*" - -"CI-modemshell-test": - - "include/net/**/*" - - "include/posix/**/*" - - "include/shell/**/*" - - "drivers/net/**/*" - - "drivers/serial/**/*" - - "drivers/wifi/**/*" - - "subsys/shell/**/*" - - "subsys/net/**/*" - - "subsys/settings/**/*" - -"CI-positioning-test": - - "include/net/**/*" - - "include/posix/**/*" - - "drivers/net/**/*" - - "drivers/wifi/**/*" - - "subsys/net/**/*" - - "subsys/settings/**/*" - -"CI-cloud-test": - - "include/zephyr/dfu/**/*" - - "include/zephyr/net/**/*" - - "include/zephyr/posix/**/*" - - "include/zephyr/settings/**/*" - - "drivers/led/**/*" - - "drivers/net/**/*" - - "drivers/sensor/**/*" - - "drivers/serial/**/*" - - "drivers/wifi/**/*" - - "lib/posix/**/*" - - "soc/nordic/**/*" - - "subsys/dfu/**/*" - - "subsys/net/**/*" - - "subsys/settings/**/*" - -"CI-wifi": - - "subsys/net/l2/wifi/**/*" - - "subsys/net/l2/ethernet/**/*" - -"CI-audio-test": - - "boards/nordic/nrf5340_audio_dk/**/*" - - "drivers/flash/**/*" - - "drivers/spi/**/*" - - "drivers/gpio/**/*" - - "drivers/i2c/**/*" - - "drivers/watchdog/**/*" - - "include/dfu/**/*" - - "include/mgmt/mcumgr/**/*" - - "samples/bluetooth/hci_ipc/**/*" - - "soc/nordic/**/*" - - "subsys/bluetooth/audio/**/*" - - "subsys/bluetooth/host/**/*" - - "subsys/dfu/**/*" - - "subsys/fs/**/*" - - "subsys/mgmt/mcumgr/**/*" - - "subsys/sd/**/*" - - "subsys/storage/**/*" - - "subsys/task_wdt/**/*" - - "subsys/usb/**/*" - - "subsys/zbus/**/*" - -"CI-pmic-samples-test": - - "samples/shields/npm1300_ek/**/*" - - "boards/shields/npm1300_ek/**/*" - - "**/**npm1300**/**" - - "drivers/regulator/regulator_common.c" - - "drivers/regulator/regulator_shell.c" - - "drivers/gpio/gpio_shell.c" - - "drivers/sensor/sensor_shell.c" - -"CI-test-low-level": - - "arch/**/*" - - "boards/nordic/nrf54*/**/*" - - "drivers/**/*" - - "dts/**/*" - - "include/zephyr/**/*" - - "kernel/**/*" - - "modules/hal_nordic/**/*" - - "samples/basic/blinky_pwm/**/*" - - "samples/basic/fade_led/**/*" - - "samples/boards/nrf/**/*" - - "samples/boards/nordic/**/*" - - "samples/drivers/adc/**/*" - - "samples/drivers/jesd216/**/*" - - "samples/drivers/mbox/**/*" - - "samples/drivers/soc_flash_nrf/**/*" - - "samples/drivers/spi_flash/**/*" - - "samples/drivers/watchdog/**/*" - - "samples/hello_world/**/*" - - "samples/sensor/**/*" - - "samples/subsys/ipc/**/*" - - "samples/subsys/logging/**/*" - - "samples/subsys/settings/**/*" - - "samples/subsys/usb/cdc_acm/**/*" - - "samples/subsys/usb/mass/**/*" - - "samples/synchronization/**/*" - - "subsys/logging/**/*" - - "subsys/settings/**/*" - - "tests/arch/**/*" - - "tests/boards/nrf/**/*" - - "tests/boards/nordic/**/*" - - "tests/drivers/**/*" - - "tests/kernel/**/*" - -"CI-suit-dfu-test": - - "subsys/mgmt/mcumgr/**/*" - - "include/mgmt/mcumgr/**/*" - - "samples/subsys/mgmt/mcumgr/smp_svr/**/*" - - "subsys/bluetooth/**/*" - - "drivers/bluetooth/**/*" - - "drivers/flash/**/*" - - "drivers/spi/**/*" - - "drivers/mbox/**/*" - - "drivers/serial/**/*" - - "drivers/console/**/*" - - "drivers/gpio/**/*" - - "dts/common/nordic/*" - - "dts/arm/nordic/nrf54h*/**/*" - - "dts/riscv/nordic/nrf54h*/**/*" - - "boards/nordic/nrf54h*/**/*" - - "soc/nordic/nrf54h/**/*" - - "include/zephyr/**/*" - - "subsys/logging/**/*" - - "subsys/tracing/**/*" - - "scripts/west_commands/build.py" - - "scripts/west_commands/flash.py" - - "scripts/west_commands/runners/nrfutil.py" - - "scripts/west_commands/runners/core.py" - - "scripts/west_commands/runners/nrf_common.py" From ec8d18b75a3cea349668ec6ca660d733fb2c6156 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:44 +0300 Subject: [PATCH 1129/2141] Revert "[nrf noup] ci: scripts: add quarantine file" This reverts commit 88c7330e9305bcb19c46cb7f4d03db556753bab1. Signed-off-by: Jukka Rissanen --- scripts/quarantine.yaml | 88 ----------------------------------------- 1 file changed, 88 deletions(-) delete mode 100644 scripts/quarantine.yaml diff --git a/scripts/quarantine.yaml b/scripts/quarantine.yaml deleted file mode 100644 index 20c4f9248ea9..000000000000 --- a/scripts/quarantine.yaml +++ /dev/null @@ -1,88 +0,0 @@ -# The configurations resulting as a product of scenarios and platforms -# will be skipped if quarantine is used. More details here: -# https://docs.zephyrproject.org/latest/guides/test/twister.html#quarantine - -- scenarios: - - testing.ztest.busy_sim - - testing.ztest.busy_sim_nrf52840dk_pin - platforms: - - nrf52840dk_nrf52840 - -# Already reported, but will not be fixed (look at the discussion): -# https://github.com/zephyrproject-rtos/zephyr/issues/44947 -- scenarios: - - libraries.cmsis_dsp.matrix.unary_f64 - platforms: - - nrf5340dk_nrf5340_cpunet - - qemu_cortex_m3 - comment: "Flash overflows" - -# Already reported, but will not be fixed (look at the discussion): -# https://github.com/zephyrproject-rtos/zephyr/issues/44947 -- scenarios: - - libraries.cmsis_dsp.matrix.binary_f16 - - libraries.cmsis_dsp.matrix.binary_f16.fpu - platforms: - - nrf5340dk_nrf5340_cpuapp_ns - comment: "Flash overflows" - -# Already reported, but will not be fixed (look at the discussion): -# https://github.com/zephyrproject-rtos/zephyr/issues/44947 -- scenarios: - - libraries.cmsis_dsp.matrix.binary_q15 - - libraries.cmsis_dsp.matrix.binary_q15.fpu - - libraries.cmsis_dsp.matrix.unary_f32 - - libraries.cmsis_dsp.matrix.unary_f32.fpu - - libraries.cmsis_dsp.matrix.unary_f64 - - libraries.cmsis_dsp.matrix.unary_f64.fpu - platforms: - - nrf5340dk_nrf5340_cpuapp_ns - - nrf9160dk_nrf9160_ns - comment: "Flash overflows" - -# libsdl2-dev package should be added into docker image -- scenarios: - - sample.boards.nrf.nrf_led_matrix - - sample.display.lvgl.gui - platforms: - - native_posix - comment: "libsdl2-dev package not available" - -- scenarios: - - sample.net.sockets.echo_server.usbnet - - sample.net.sockets.echo_server.usbnet_composite - platforms: - - nrf5340dk_nrf5340_cpuapp_ns - comment: "Ram/flash overflows, also in the upstream" - -- scenarios: - - sample.net.zperf.netusb_ecm - - sample.net.zperf.netusb_eem - - sample.net.zperf.netusb_rndis - platforms: - - nrf52833dk_nrf52833 - - nrf5340dk_nrf5340_cpuapp_ns - comment: "Ram/flash overflows, also in the upstream" - -- scenarios: - - net.mqtt.tls - platforms: - - nrf5340dk_nrf5340_cpuapp_ns - - nrf9160dk_nrf9160_ns - comment: "Ram/flash overflows, also in the upstream" - -- scenarios: - - kernel.common.picolibc - - libraries.picolibc - - libraries.libc.picolibc.mem_alloc - - libraries.picolibc.sprintf_new - platforms: - - nrf52dk_nrf52832 - comment: "Ram overflows, also in the upstream" - -- scenarios: - - sample.psa_crypto - platforms: - - nrf5340dk_nrf5340_cpuapp_ns - - nrf9160dk_nrf9160_ns - comment: "Due to using sdk-zephyr manifest instead of nrf. Should be fixed after the change" From 40c0725eb4581c23418a61e0275aebba9b602a74 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:44 +0300 Subject: [PATCH 1130/2141] Revert "[nrf noup] ci: set `ZEPHYR__KCONFIG` for NCS modules" This reverts commit 26572f95c09d9c063ad9dda85b6e6368f015ce94. Signed-off-by: Jukka Rissanen --- scripts/ci/check_compliance.py | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index 31bb02c22f88..cd97ea96717f 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -458,13 +458,6 @@ def get_modules(self, modules_file, sysbuild_modules_file, settings_file): modules = [name for name in os.listdir(modules_dir) if modules_dir / name / 'Kconfig'] - nrf_modules_dir = ZEPHYR_BASE / Path('../nrf/modules') - nrf_modules = [] - if os.path.exists(nrf_modules_dir): - nrf_modules = [name for name in os.listdir(nrf_modules_dir) if - os.path.exists(os.path.join(nrf_modules_dir, name, - 'Kconfig'))] - with open(modules_file, 'r') as fp_module_file: content = fp_module_file.read() @@ -474,31 +467,8 @@ def get_modules(self, modules_file, sysbuild_modules_file, settings_file): re.sub('[^a-zA-Z0-9]', '_', module).upper(), modules_dir / module / 'Kconfig' )) - for module in nrf_modules: - fp_module_file.write("ZEPHYR_{}_KCONFIG = {}\n".format( - re.sub('[^a-zA-Z0-9]', '_', module).upper(), - nrf_modules_dir / module / 'Kconfig' - )) - fp_module_file.write("NCS_{}_KCONFIG = {}\n".format( - re.sub('[^a-zA-Z0-9]', '_', module).upper(), - modules_dir / module / 'Kconfig' - )) - # Add NRF as static entry as workaround for ext Kconfig root support - fp_module_file.write("ZEPHYR_NRF_KCONFIG = {}\n".format( - nrf_modules_dir / '..' / 'Kconfig.nrf' - )) fp_module_file.write(content) - with open(sysbuild_modules_file, 'r') as fp_sysbuild_module_file: - content = fp_sysbuild_module_file.read() - - with open(sysbuild_modules_file, 'w') as fp_sysbuild_module_file: - # Add NRF as static entry as workaround for ext Kconfig root support - fp_sysbuild_module_file.write("SYSBUILD_NRF_KCONFIG = {}\n".format( - nrf_modules_dir / '..' / 'sysbuild' / 'Kconfig.sysbuild' - )) - fp_sysbuild_module_file.write(content) - def get_kconfig_dts(self, kconfig_dts_file, settings_file): """ Generate the Kconfig.dts using dts/bindings as the source. From 96260a881bb2245d59a43d07b88da7051fed4bcb Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:44 +0300 Subject: [PATCH 1131/2141] Revert "[nrf fromlist] samples: boards: nordic: spis_wakeup: fix boot for h20" This reverts commit 98158522b81f9b0f7926731714063c80dec0eaa5. Signed-off-by: Jukka Rissanen --- .../nordic/spis_wakeup/boards/nrf54h20dk_nrf54h20_cpuapp.conf | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 samples/boards/nordic/spis_wakeup/boards/nrf54h20dk_nrf54h20_cpuapp.conf diff --git a/samples/boards/nordic/spis_wakeup/boards/nrf54h20dk_nrf54h20_cpuapp.conf b/samples/boards/nordic/spis_wakeup/boards/nrf54h20dk_nrf54h20_cpuapp.conf deleted file mode 100644 index 61643e48fbfd..000000000000 --- a/samples/boards/nordic/spis_wakeup/boards/nrf54h20dk_nrf54h20_cpuapp.conf +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright (c) 2025 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -CONFIG_SOC_NRF54H20_CPURAD_ENABLE=y From 2ccf09bbc3abd63cae37040d153483c26c9c8921 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:44 +0300 Subject: [PATCH 1132/2141] Revert "[nrf fromlist] drivers: nrf_wifi: Fix the interoperability issues" This reverts commit 91510521ffd06a8fadad9c73db8cf13e555f3cff. Signed-off-by: Jukka Rissanen --- drivers/wifi/nrf_wifi/Kconfig.nrfwifi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/wifi/nrf_wifi/Kconfig.nrfwifi b/drivers/wifi/nrf_wifi/Kconfig.nrfwifi index 4b3bb0d41ca2..af3e7827dcbf 100644 --- a/drivers/wifi/nrf_wifi/Kconfig.nrfwifi +++ b/drivers/wifi/nrf_wifi/Kconfig.nrfwifi @@ -840,7 +840,7 @@ if NRF_WIFI_FEAT_KEEPALIVE config NRF_WIFI_KEEPALIVE_PERIOD_S int "Keepalive period in seconds" range 30 3600 - default 30 + default 60 help Keepalive period in seconds to send keepalive packets to the AP. endif From 1a3d41e5fc3f4fee097150f28265d65a1d0895b0 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:44 +0300 Subject: [PATCH 1133/2141] Revert "[nrf fromtree] manifest: hostap: Pull feature to add driver processing delay to capa" This reverts commit 47f186c0e50d052ccafb9b9b70caba717b5280c2. Signed-off-by: Jukka Rissanen --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 41fa45c86936..c4c3f8ceda51 100644 --- a/west.yml +++ b/west.yml @@ -281,7 +281,7 @@ manifest: - hal - name: hostap path: modules/lib/hostap - revision: c55683ce514953277be5566fceb38c4c2485f1e1 + revision: 7fda615fcccd577af7339b4198400c39ac14f8f8 - name: liblc3 revision: 48bbd3eacd36e99a57317a0a4867002e0b09e183 path: modules/lib/liblc3 From c1e75ac69a8e48210ee8d6c387bed6ff610f5216 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:44 +0300 Subject: [PATCH 1134/2141] Revert "[nrf fromtree] manifest: hostap: Pull support to dump keys" This reverts commit 9d2a54e5529f39fb05228bbeaa6e937d30eddc3c. Signed-off-by: Jukka Rissanen --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index c4c3f8ceda51..94e1638cb45f 100644 --- a/west.yml +++ b/west.yml @@ -281,7 +281,7 @@ manifest: - hal - name: hostap path: modules/lib/hostap - revision: 7fda615fcccd577af7339b4198400c39ac14f8f8 + revision: e942f86e865d5b24bbbe8b0c333f030cbbe62bfb - name: liblc3 revision: 48bbd3eacd36e99a57317a0a4867002e0b09e183 path: modules/lib/liblc3 From b2b01391db390caff1522e43818e499108bb0851 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:44 +0300 Subject: [PATCH 1135/2141] Revert "[nrf fromtree] drivers: nrf_wifi: Fix the issue of delayed keepalive" This reverts commit 8d67a0f289f02ed16ef4644fb6f7df4562ce8aa5. Signed-off-by: Jukka Rissanen --- drivers/wifi/nrf_wifi/src/wpa_supp_if.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/wifi/nrf_wifi/src/wpa_supp_if.c b/drivers/wifi/nrf_wifi/src/wpa_supp_if.c index 34af00e6d388..22aa04165507 100644 --- a/drivers/wifi/nrf_wifi/src/wpa_supp_if.c +++ b/drivers/wifi/nrf_wifi/src/wpa_supp_if.c @@ -1805,11 +1805,6 @@ int nrf_wifi_supp_get_capa(void *if_priv, struct wpa_driver_capa *capa) capa->extended_capa_mask = rpu_ctx_zep->extended_capa_mask; capa->extended_capa_len = rpu_ctx_zep->extended_capa_len; } - /* Based on testing, this works to fix the disconnection due to delayed - * keepalive to the AP - */ - capa->driver_tx_processing_delay_ms = 1000; - out: k_mutex_unlock(&vif_ctx_zep->vif_lock); return status; From 05a9227510f5ef175119925b5535c3ae8a729806 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:44 +0300 Subject: [PATCH 1136/2141] Revert "[nrf fromlist] mgmt: mcumgr: grp: img_mgmt: Show firmware loader slot info" This reverts commit b924e1adc5fa06b1e53e0f1088795a1a4529a271. Signed-off-by: Jukka Rissanen --- .../mcumgr/grp/img_mgmt/src/img_mgmt_state.c | 50 +------------------ .../mcumgr/grp/img_mgmt/src/zephyr_img_mgmt.c | 2 +- 2 files changed, 3 insertions(+), 49 deletions(-) diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt_state.c b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt_state.c index 384d06137393..5333d651c9f9 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt_state.c +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt_state.c @@ -58,11 +58,6 @@ LOG_MODULE_DECLARE(mcumgr_img_grp, CONFIG_MCUMGR_GRP_IMG_LOG_LEVEL); #define DIRECT_XIP_BOOT_FOREVER 3 #endif -#if defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_FIRMWARE_UPDATER) && \ - CONFIG_MCUMGR_GRP_IMG_UPDATABLE_IMAGE_NUMBER > 1 -#warning "MCUmgr img mgmt only supports 1 image" -#endif - /** * Collects information about the specified image slot. */ @@ -201,6 +196,7 @@ int img_mgmt_get_next_boot_slot(int image, enum img_mgmt_next_boot_type *type) #else #if defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP_WITH_REVERT) + static int read_directxip_state(int slot) { struct boot_swap_state bss; @@ -233,8 +229,6 @@ static int read_directxip_state(int slot) } #endif /* defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP_WITH_REVERT) */ -#if defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP) || \ - defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP_WITH_REVERT) int img_mgmt_get_next_boot_slot(int image, enum img_mgmt_next_boot_type *type) { struct image_version aver; @@ -307,14 +301,12 @@ int img_mgmt_get_next_boot_slot(int image, enum img_mgmt_next_boot_type *type) return return_slot; } -#endif /* defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP) || \ - * defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP_WITH_REVERT) - */ #endif /* !defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP) && \ * !defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP_WITH_REVERT) && \ * !defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_FIRMWARE_UPDATER) */ + /** * Indicates whether any image slot is pending (i.e., whether a test swap will * happen on the next reboot. @@ -502,7 +494,6 @@ static bool img_mgmt_state_encode_slot(struct smp_streamer *ctxt, uint32_t slot, /** * Command handler: image state read */ -#if !defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_FIRMWARE_UPDATER) int img_mgmt_state_read(struct smp_streamer *ctxt) { @@ -560,43 +551,6 @@ img_mgmt_state_read(struct smp_streamer *ctxt) return ok ? MGMT_ERR_EOK : MGMT_ERR_EMSGSIZE; } -#else -int -img_mgmt_state_read(struct smp_streamer *ctxt) -{ - zcbor_state_t *zse = ctxt->writer->zs; - uint32_t i; - bool ok; - - ok = zcbor_tstr_put_lit(zse, "images") && - zcbor_list_start_encode(zse, 2); - - img_mgmt_take_lock(); - - for (i = 0; ok && i < CONFIG_MCUMGR_GRP_IMG_UPDATABLE_IMAGE_NUMBER; i++) { - /* _a is active slot, _o is opposite slot */ - int slot_a = img_mgmt_active_slot(i); - int slot_o = img_mgmt_get_opposite_slot(slot_a); - int flags_a = REPORT_SLOT_ACTIVE; - int flags_o = REPORT_SLOT_CONFIRMED; - - ok = img_mgmt_state_encode_slot(ctxt, slot_o, flags_o) && - img_mgmt_state_encode_slot(ctxt, slot_a, flags_a); - } - - /* Ending list encoding for two slots per image */ - ok = ok && zcbor_list_end_encode(zse, 2); - /* splitStatus is always 0 so in frugal list it is not present at all */ - if (!IS_ENABLED(CONFIG_MCUMGR_GRP_IMG_FRUGAL_LIST) && ok) { - ok = zcbor_tstr_put_lit(zse, "splitStatus") && - zcbor_int32_put(zse, 0); - } - - img_mgmt_release_lock(); - - return ok ? MGMT_ERR_EOK : MGMT_ERR_EMSGSIZE; -} -#endif /* !defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_FIRMWARE_UPDATER) */ static int img_mgmt_set_next_boot_slot_common(int slot, int active_slot, bool confirm) { diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/src/zephyr_img_mgmt.c b/subsys/mgmt/mcumgr/grp/img_mgmt/src/zephyr_img_mgmt.c index d4972b573ccf..b43b250ad16e 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/src/zephyr_img_mgmt.c +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/src/zephyr_img_mgmt.c @@ -140,11 +140,11 @@ img_mgmt_flash_area_id(int slot) fa_id = FIXED_PARTITION_ID(SLOT0_PARTITION); break; +#if !defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_FIRMWARE_UPDATER) case 1: fa_id = FIXED_PARTITION_ID(SLOT1_PARTITION); break; -#if !defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_FIRMWARE_UPDATER) #if FIXED_PARTITION_EXISTS(SLOT2_PARTITION) case 2: fa_id = FIXED_PARTITION_ID(SLOT2_PARTITION); From d7f2c0e01b2b65419fcbaacdf76057958522ed75 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:44 +0300 Subject: [PATCH 1137/2141] Revert "[nrf fromtree] tests: fs: littlefs: Fix nRF54L15-based dtc overlay files" This reverts commit a1604e234eceb23779c387d5907294e4457b76e0. Signed-off-by: Jukka Rissanen --- .../fs/littlefs/boards/bl54l15_dvk_nrf54l15_cpuapp.overlay | 6 ++++-- .../fs/littlefs/boards/bl54l15u_dvk_nrf54l15_cpuapp.overlay | 6 ++++-- .../fs/littlefs/boards/nrf54l15dk_nrf54l15_cpuapp.overlay | 6 ++++-- .../fs/littlefs/boards/ophelia4ev_nrf54l15_cpuapp.overlay | 6 ++++-- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/tests/subsys/fs/littlefs/boards/bl54l15_dvk_nrf54l15_cpuapp.overlay b/tests/subsys/fs/littlefs/boards/bl54l15_dvk_nrf54l15_cpuapp.overlay index f0cf923b4e7e..31e324265bc6 100644 --- a/tests/subsys/fs/littlefs/boards/bl54l15_dvk_nrf54l15_cpuapp.overlay +++ b/tests/subsys/fs/littlefs/boards/bl54l15_dvk_nrf54l15_cpuapp.overlay @@ -5,7 +5,9 @@ * SPDX-License-Identifier: Apache-2.0 */ +/delete-node/ &slot0_ns_partition; /delete-node/ &slot1_partition; +/delete-node/ &slot1_ns_partition; &cpuapp_rram { partitions { @@ -13,9 +15,9 @@ #address-cells = <1>; #size-cells = <1>; - small_partition: partition@b6000 { + small_partition: partition@67000 { label = "small"; - reg = <0x000b6000 0x00010000>; + reg = <0x00067000 0x00010000>; }; }; }; diff --git a/tests/subsys/fs/littlefs/boards/bl54l15u_dvk_nrf54l15_cpuapp.overlay b/tests/subsys/fs/littlefs/boards/bl54l15u_dvk_nrf54l15_cpuapp.overlay index f0cf923b4e7e..31e324265bc6 100644 --- a/tests/subsys/fs/littlefs/boards/bl54l15u_dvk_nrf54l15_cpuapp.overlay +++ b/tests/subsys/fs/littlefs/boards/bl54l15u_dvk_nrf54l15_cpuapp.overlay @@ -5,7 +5,9 @@ * SPDX-License-Identifier: Apache-2.0 */ +/delete-node/ &slot0_ns_partition; /delete-node/ &slot1_partition; +/delete-node/ &slot1_ns_partition; &cpuapp_rram { partitions { @@ -13,9 +15,9 @@ #address-cells = <1>; #size-cells = <1>; - small_partition: partition@b6000 { + small_partition: partition@67000 { label = "small"; - reg = <0x000b6000 0x00010000>; + reg = <0x00067000 0x00010000>; }; }; }; diff --git a/tests/subsys/fs/littlefs/boards/nrf54l15dk_nrf54l15_cpuapp.overlay b/tests/subsys/fs/littlefs/boards/nrf54l15dk_nrf54l15_cpuapp.overlay index d7b166fa1e02..292e98c96a03 100644 --- a/tests/subsys/fs/littlefs/boards/nrf54l15dk_nrf54l15_cpuapp.overlay +++ b/tests/subsys/fs/littlefs/boards/nrf54l15dk_nrf54l15_cpuapp.overlay @@ -4,7 +4,9 @@ * SPDX-License-Identifier: Apache-2.0 */ +/delete-node/ &slot0_ns_partition; /delete-node/ &slot1_partition; +/delete-node/ &slot1_ns_partition; &cpuapp_rram { partitions { @@ -12,9 +14,9 @@ #address-cells = <1>; #size-cells = <1>; - small_partition: partition@b6000 { + small_partition: partition@67000 { label = "small"; - reg = <0x000b6000 0x00010000>; + reg = <0x00067000 0x00010000>; }; }; }; diff --git a/tests/subsys/fs/littlefs/boards/ophelia4ev_nrf54l15_cpuapp.overlay b/tests/subsys/fs/littlefs/boards/ophelia4ev_nrf54l15_cpuapp.overlay index 807d42c43da6..64bfe273c9d7 100644 --- a/tests/subsys/fs/littlefs/boards/ophelia4ev_nrf54l15_cpuapp.overlay +++ b/tests/subsys/fs/littlefs/boards/ophelia4ev_nrf54l15_cpuapp.overlay @@ -4,7 +4,9 @@ * SPDX-License-Identifier: Apache-2.0 */ +/delete-node/ &slot0_ns_partition; /delete-node/ &slot1_partition; +/delete-node/ &slot1_ns_partition; &cpuapp_rram { partitions { @@ -12,9 +14,9 @@ #address-cells = <1>; #size-cells = <1>; - small_partition: partition@b6000 { + small_partition: partition@67000 { label = "small"; - reg = <0x000b6000 0x00010000>; + reg = <0x00067000 0x00010000>; }; }; }; From 5a043ce82efceca870e0eb62c44e1529b592f8d4 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:44 +0300 Subject: [PATCH 1138/2141] Revert "[nrf fromlist] soc: nordic: nrf54h: Add DT_NODE_EXISTS check" This reverts commit 1b785f57b67170f8c163fa617783a91013ce9b1f. Signed-off-by: Jukka Rissanen --- soc/nordic/nrf54h/soc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soc/nordic/nrf54h/soc.c b/soc/nordic/nrf54h/soc.c index a3f67711e455..a20815b2227e 100644 --- a/soc/nordic/nrf54h/soc.c +++ b/soc/nordic/nrf54h/soc.c @@ -216,7 +216,7 @@ void soc_late_init_hook(void) DT_REG_ADDR(DT_NODELABEL(cpurad_slot0_partition)) + CONFIG_ROM_START_OFFSET); } -#elif DT_NODE_EXISTS(DT_NODELABEL(cpurad_slot0_partition)) +#else radiocore_address = (void *)(DT_REG_ADDR(DT_GPARENT(DT_NODELABEL(cpurad_slot0_partition))) + DT_REG_ADDR(DT_NODELABEL(cpurad_slot0_partition)) + From f48c2721ca0fdfc00eec9680dcfb913701d173f9 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:44 +0300 Subject: [PATCH 1139/2141] Revert "[nrf fromtree] Bluetooth: Decode Bluetooth 6.1 version number" This reverts commit c61e3f3ce2b475d212dfe16f88fa5f1eea11a460. Signed-off-by: Jukka Rissanen --- include/zephyr/bluetooth/hci_types.h | 1 - subsys/bluetooth/host/hci_core.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/include/zephyr/bluetooth/hci_types.h b/include/zephyr/bluetooth/hci_types.h index 0b2c1b1a3976..2123556b4555 100644 --- a/include/zephyr/bluetooth/hci_types.h +++ b/include/zephyr/bluetooth/hci_types.h @@ -858,7 +858,6 @@ struct bt_hci_rp_configure_data_path { #define BT_HCI_VERSION_5_3 12 #define BT_HCI_VERSION_5_4 13 #define BT_HCI_VERSION_6_0 14 -#define BT_HCI_VERSION_6_1 15 #define BT_HCI_OP_READ_LOCAL_VERSION_INFO BT_OP(BT_OGF_INFO, 0x0001) /* 0x1001 */ struct bt_hci_rp_read_local_version_info { diff --git a/subsys/bluetooth/host/hci_core.c b/subsys/bluetooth/host/hci_core.c index 7263bc39ed4e..3a866c6346d6 100644 --- a/subsys/bluetooth/host/hci_core.c +++ b/subsys/bluetooth/host/hci_core.c @@ -3843,7 +3843,7 @@ const char *bt_hci_get_ver_str(uint8_t core_version) { const char * const str[] = { "1.0b", "1.1", "1.2", "2.0", "2.1", "3.0", "4.0", "4.1", "4.2", - "5.0", "5.1", "5.2", "5.3", "5.4", "6.0", "6.1" + "5.0", "5.1", "5.2", "5.3", "5.4", "6.0" }; if (core_version < ARRAY_SIZE(str)) { From 106d00766fe7cd2970e0821faad9f3987c18bc57 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:44 +0300 Subject: [PATCH 1140/2141] Revert "[nrf fromtree] drivers: flash_mspi_nor: Make transfer timeout configurable" This reverts commit 7f2380fed7aafab23b4c64e20aa96dfeb77d77ba. Signed-off-by: Jukka Rissanen --- drivers/flash/flash_mspi_nor.c | 3 +-- drivers/flash/flash_mspi_nor.h | 1 - dts/bindings/mtd/jedec,mspi-nor.yaml | 8 -------- 3 files changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/flash/flash_mspi_nor.c b/drivers/flash/flash_mspi_nor.c index ae22202e075d..b7ca6341d3ae 100644 --- a/drivers/flash/flash_mspi_nor.c +++ b/drivers/flash/flash_mspi_nor.c @@ -27,7 +27,7 @@ void flash_mspi_command_set(const struct device *dev, const struct flash_mspi_no dev_data->xfer.xfer_mode = MSPI_PIO; dev_data->xfer.packets = &dev_data->packet; dev_data->xfer.num_packet = 1; - dev_data->xfer.timeout = dev_config->transfer_timeout; + dev_data->xfer.timeout = 10; dev_data->xfer.cmd_length = cmd->cmd_length; dev_data->xfer.addr_length = cmd->addr_length; @@ -887,7 +887,6 @@ BUILD_ASSERT((FLASH_SIZE_INST(inst) % CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE) == / 1000, \ .reset_recovery_us = DT_INST_PROP_OR(inst, t_reset_recovery, 0) \ / 1000,)) \ - .transfer_timeout = DT_INST_PROP(inst, transfer_timeout), \ FLASH_PAGE_LAYOUT_DEFINE(inst) \ .jedec_id = DT_INST_PROP(inst, jedec_id), \ .jedec_cmds = FLASH_CMDS(inst), \ diff --git a/drivers/flash/flash_mspi_nor.h b/drivers/flash/flash_mspi_nor.h index ad957f24bc79..35a0bff4c215 100644 --- a/drivers/flash/flash_mspi_nor.h +++ b/drivers/flash/flash_mspi_nor.h @@ -35,7 +35,6 @@ struct flash_mspi_nor_config { uint32_t reset_pulse_us; uint32_t reset_recovery_us; #endif - uint32_t transfer_timeout; #if defined(CONFIG_FLASH_PAGE_LAYOUT) struct flash_pages_layout layout; #endif diff --git a/dts/bindings/mtd/jedec,mspi-nor.yaml b/dts/bindings/mtd/jedec,mspi-nor.yaml index 09660b841591..5bad8f54b5dc 100644 --- a/dts/bindings/mtd/jedec,mspi-nor.yaml +++ b/dts/bindings/mtd/jedec,mspi-nor.yaml @@ -22,11 +22,3 @@ properties: type: int description: | Minimum time, in nanoseconds, the flash chip needs to recover after reset. - - transfer-timeout: - type: int - default: 10 - description: | - Maximum time, in milliseconds, allowed for a single transfer on the MSPI - bus in communication with the flash chip. The default value is the one - that was previously hard-coded in the flash_mspi_nor driver. From 21bf48b8e76459ad0840a705f1ef8b8cfde7e388 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:44 +0300 Subject: [PATCH 1141/2141] Revert "[nrf fromlist] soc: nordic: ironside: run clang-format on some files" This reverts commit e125145b9ea8e0945d52b170e3a34f7d87aae0bb. Signed-off-by: Jukka Rissanen --- soc/nordic/ironside/include/nrf_ironside/dvfs.h | 15 ++++++++------- soc/nordic/ironside/include/nrf_ironside/update.h | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/soc/nordic/ironside/include/nrf_ironside/dvfs.h b/soc/nordic/ironside/include/nrf_ironside/dvfs.h index f48c8a6344a2..e2cb03c249e0 100644 --- a/soc/nordic/ironside/include/nrf_ironside/dvfs.h +++ b/soc/nordic/ironside/include/nrf_ironside/dvfs.h @@ -31,19 +31,19 @@ enum ironside_dvfs_oppoint { */ /** The requested DVFS oppoint is not allowed. */ -#define IRONSIDE_DVFS_ERROR_WRONG_OPPOINT (1) +#define IRONSIDE_DVFS_ERROR_WRONG_OPPOINT (1) /** Waiting for mutex lock timed out, or hardware is busy. */ -#define IRONSIDE_DVFS_ERROR_BUSY (2) +#define IRONSIDE_DVFS_ERROR_BUSY (2) /** There is configuration error in the DVFS service. */ -#define IRONSIDE_DVFS_ERROR_OPPOINT_DATA (3) +#define IRONSIDE_DVFS_ERROR_OPPOINT_DATA (3) /** The caller does not have permission to change the DVFS oppoint. */ -#define IRONSIDE_DVFS_ERROR_PERMISSION (4) +#define IRONSIDE_DVFS_ERROR_PERMISSION (4) /** The requested DVFS oppoint is already set, no change needed. */ #define IRONSIDE_DVFS_ERROR_NO_CHANGE_NEEDED (5) /** The operation timed out, possibly due to a hardware issue. */ -#define IRONSIDE_DVFS_ERROR_TIMEOUT (6) +#define IRONSIDE_DVFS_ERROR_TIMEOUT (6) /** The DVFS oppoint change operation is not allowed in the ISR context. */ -#define IRONSIDE_DVFS_ERROR_ISR_NOT_ALLOWED (7) +#define IRONSIDE_DVFS_ERROR_ISR_NOT_ALLOWED (7) /** * @} @@ -80,7 +80,8 @@ int ironside_dvfs_change_oppoint(enum ironside_dvfs_oppoint dvfs_oppoint); */ static inline bool ironside_dvfs_is_oppoint_valid(enum ironside_dvfs_oppoint dvfs_oppoint) { - if (dvfs_oppoint != IRONSIDE_DVFS_OPP_HIGH && dvfs_oppoint != IRONSIDE_DVFS_OPP_MEDLOW && + if (dvfs_oppoint != IRONSIDE_DVFS_OPP_HIGH && + dvfs_oppoint != IRONSIDE_DVFS_OPP_MEDLOW && dvfs_oppoint != IRONSIDE_DVFS_OPP_LOW) { return false; } diff --git a/soc/nordic/ironside/include/nrf_ironside/update.h b/soc/nordic/ironside/include/nrf_ironside/update.h index c0f021a91ed5..8152a77f5f7c 100644 --- a/soc/nordic/ironside/include/nrf_ironside/update.h +++ b/soc/nordic/ironside/include/nrf_ironside/update.h @@ -40,7 +40,7 @@ /* Index of the update blob pointer within the service buffer. */ #define IRONSIDE_UPDATE_SERVICE_UPDATE_PTR_IDX (0) /* Index of the return code within the service buffer. */ -#define IRONSIDE_UPDATE_SERVICE_RETCODE_IDX (0) +#define IRONSIDE_UPDATE_SERVICE_RETCODE_IDX (0) /** * @brief IronSide update blob. From de41de128ab063d6080912d08d544f5af0203a41 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:45 +0300 Subject: [PATCH 1142/2141] Revert "[nrf fromlist] boards: nordic: nrf54h20dk: Add ETM to JLinkScript" This reverts commit d45353ccd301fea2fb90e10102b05b4d44167fa6. Signed-off-by: Jukka Rissanen --- .../support/nrf54h20_cpuapp.JLinkScript | 169 ------------------ 1 file changed, 169 deletions(-) diff --git a/boards/nordic/nrf54h20dk/support/nrf54h20_cpuapp.JLinkScript b/boards/nordic/nrf54h20dk/support/nrf54h20_cpuapp.JLinkScript index 9738ec77f437..b1b968573991 100644 --- a/boards/nordic/nrf54h20dk/support/nrf54h20_cpuapp.JLinkScript +++ b/boards/nordic/nrf54h20dk/support/nrf54h20_cpuapp.JLinkScript @@ -1,175 +1,6 @@ __constant U32 _CPUCONF_ADDR = 0x52011000; __constant U32 _CPUCONF_CPUWAIT_OFFSET = 0x50C; -// ATBFUNNEL -__constant U32 _ATBFUNNEL211_ADDR = 0xBF04D000; -__constant U32 _ATBFUNNEL212_ADDR = 0xBF04E000; -__constant U32 _ATBFUNNEL_CTRLREG_OFFSET = 0x0; -__constant U32 _HOLDTIME_4 = 0x300; -__constant U32 _ENS0 = 0x1; -__constant U32 _ENS1 = 0x2; -__constant U32 _ENS2 = 0x4; - -// ATBREPLICATOR -__constant U32 _ATBREPLICATOR212_ADDR = 0xBF04A000; -__constant U32 _ATBREPLICATOR213_ADDR = 0xBF04B000; -__constant U32 _ATBREPLICATOR_IDFILTER0_OFFSET = 0x0; -__constant U32 _ATBREPLICATOR_IDFILTER1_OFFSET = 0x4; -__constant U32 _ID_NONE = 0xFFFFFFFF; -__constant U32 _ID1x = 0xFFFFFFFD; - -// TSGEN -__constant U32 _TSGEN_ADDR = 0xBF041000; -__constant U32 _TSGEN_CNTCR_OFFSET = 0x0; -__constant U32 _TSGEN_CNTFID0_OFFSET = 0x20; -// Clock rate = TDD Freq. / 8 -__constant U32 _TS_CLOCKRATE = 40000000; - -// CTI -__constant U32 _CTI210_ADDR = 0xBF046000; -__constant U32 _CTICONTROL_OFFSET = 0x0; -__constant U32 _CTIOUTEN_OFFSET = 0xA0; -__constant U32 _CTIGATE_OFFSET = 0x140; -__constant U32 _TPIU_FLUSH_TRIG = 0x2; - -// TPIU -__constant U32 _TPIU_ADDR = 0xBF043000; -__constant U32 _CURRENTPORTSIZE_OFFSET = 0x4; -__constant U32 _FFCR_OFFSET = 0x304; -__constant U32 _FSCR_OFFSET = 0x308; -__constant U32 _ENFCONT = 0x02; -__constant U32 _FONFLIN = 0x10; -__constant U32 _ENFTC = 0x1; -__constant U32 _TPIU_SYNC_FRAME_COUNT = 0x8; -__constant U32 _CURRENTPORTSIZE_4 = 0x8; - -// TDDCONF -__constant U32 _TDDCONF_ADDR = 0xBF001000; -__constant U32 _TRACEPORTSPEED_OFFSET = 0x408; -__constant U32 _SPEED80MHZ = 0x0; - -// CoreSight general -__constant U32 _CORESIGHT_CLAIMSET_OFFSET = 0xFA0; -__constant U32 _CORESIGHT_CLAIMCLR_OFFSET = 0xFA4; -__constant U32 _CORESIGHT_LAR_OFFSET = 0xFB0; -__constant U32 _CORESIGHT_UNLOCK_KEY = 0xC5ACCE55; - -// GPIO P7 -__constant U32 _P7_ADDR = 0x5F938E00; -__constant U32 _PIN_CNF3_OFFSET = 0x8C; -__constant U32 _PIN_CNF4_OFFSET = 0x90; -__constant U32 _PIN_CNF5_OFFSET = 0x94; -__constant U32 _PIN_CNF6_OFFSET = 0x98; -__constant U32 _PIN_CNF7_OFFSET = 0x9C; -__constant U32 _PIN_CNF_TPIU_CLOCK_VALUE = 0x80000503; -__constant U32 _PIN_CNF_TPIU_DATA_VALUE = 0x00000503; - -// Settings -__constant U32 _DEBUGGER_CLAIM_MASK = 0x2; - -// Used to check if we have already set up tracing -int _needCoresightSetup = 1; - -// Unlock a CoreSight peripheral -void _CSUnlock(U32 addr) -{ - JLINK_MEM_WriteU32(addr + _CORESIGHT_LAR_OFFSET, _CORESIGHT_UNLOCK_KEY); -} - -// Lock a CoreSight peripheral -void _CSLock(U32 addr) -{ - JLINK_MEM_WriteU32(addr + _CORESIGHT_LAR_OFFSET, 0); -} - -// Set claim bits in the CoreSight peripheral to indicate to the firmware that it -// has been configured by the host debugger -void _CSClaim(U32 addr) -{ - JLINK_MEM_WriteU32(addr + _CORESIGHT_CLAIMSET_OFFSET, _DEBUGGER_CLAIM_MASK); -} - -// Set up CoreSight and other necessary configuration so to enable ETM -> TPIU tracing. -int _SetupETMTPIUTrace(void) -{ - // Set up ATB funnels/replicators to route ApplicationDomain ETM to TPIU - _CSUnlock(_ATBFUNNEL212_ADDR); - JLINK_MEM_WriteU32(_ATBFUNNEL212_ADDR + _ATBFUNNEL_CTRLREG_OFFSET, _HOLDTIME_4 | _ENS0); - _CSClaim(_ATBFUNNEL212_ADDR); - _CSLock(_ATBFUNNEL212_ADDR); - - _CSUnlock(_ATBREPLICATOR212_ADDR); - JLINK_MEM_WriteU32(_ATBREPLICATOR212_ADDR + _ATBREPLICATOR_IDFILTER0_OFFSET, _ID_NONE); - JLINK_MEM_WriteU32(_ATBREPLICATOR212_ADDR + _ATBREPLICATOR_IDFILTER1_OFFSET, _ID1x); - _CSLock(_ATBREPLICATOR212_ADDR); - _CSClaim(_ATBREPLICATOR212_ADDR); - _CSLock(_ATBREPLICATOR212_ADDR); - - _CSUnlock(_ATBFUNNEL211_ADDR); - JLINK_MEM_WriteU32(_ATBFUNNEL211_ADDR + _ATBFUNNEL_CTRLREG_OFFSET, _HOLDTIME_4 | _ENS0); - _CSClaim(_ATBFUNNEL211_ADDR); - _CSLock(_ATBFUNNEL211_ADDR); - - _CSUnlock(_ATBREPLICATOR213_ADDR); - JLINK_MEM_WriteU32(_ATBREPLICATOR213_ADDR + _ATBREPLICATOR_IDFILTER0_OFFSET, _ID1x); - JLINK_MEM_WriteU32(_ATBREPLICATOR213_ADDR + _ATBREPLICATOR_IDFILTER1_OFFSET, _ID_NONE); - _CSClaim(_ATBREPLICATOR213_ADDR); - _CSLock(_ATBREPLICATOR213_ADDR); - - // Configure timestamp generator for the correct clock rate - JLINK_MEM_WriteU32(_TSGEN_ADDR + _TSGEN_CNTFID0_OFFSET, _TS_CLOCKRATE); - JLINK_MEM_WriteU32(_TSGEN_ADDR + _TSGEN_CNTCR_OFFSET, 1); - _CSClaim(_TSGEN_ADDR); - - // Configure CTI1 for TPIU formatter flushing - _CSUnlock(_CTI210_ADDR); - JLINK_MEM_WriteU32(_CTI210_ADDR + _CTIOUTEN_OFFSET, _TPIU_FLUSH_TRIG); - JLINK_MEM_WriteU32(_CTI210_ADDR + _CTIGATE_OFFSET, _TPIU_FLUSH_TRIG); - JLINK_MEM_WriteU32(_CTI210_ADDR + _CTICONTROL_OFFSET, 1); - _CSClaim(_CTI210_ADDR); - _CSLock(_CTI210_ADDR); - - // Configure TPIU for port size 4, continuous formatting - _CSUnlock(_TPIU_ADDR); - JLINK_MEM_WriteU32(_TPIU_ADDR + _CURRENTPORTSIZE_OFFSET, _CURRENTPORTSIZE_4); - JLINK_MEM_WriteU32(_TPIU_ADDR + _FFCR_OFFSET, _ENFCONT | _FONFLIN | _ENFTC); - JLINK_MEM_WriteU32(_TPIU_ADDR + _FSCR_OFFSET, _TPIU_SYNC_FRAME_COUNT); - _CSClaim(_TPIU_ADDR); - _CSLock(_TPIU_ADDR); - - // Configure the trace pins - JLINK_MEM_WriteU32(_P7_ADDR + _PIN_CNF3_OFFSET, _PIN_CNF_TPIU_CLOCK_VALUE); - JLINK_MEM_WriteU32(_P7_ADDR + _PIN_CNF4_OFFSET, _PIN_CNF_TPIU_DATA_VALUE); - JLINK_MEM_WriteU32(_P7_ADDR + _PIN_CNF5_OFFSET, _PIN_CNF_TPIU_DATA_VALUE); - JLINK_MEM_WriteU32(_P7_ADDR + _PIN_CNF6_OFFSET, _PIN_CNF_TPIU_DATA_VALUE); - JLINK_MEM_WriteU32(_P7_ADDR + _PIN_CNF7_OFFSET, _PIN_CNF_TPIU_DATA_VALUE); - - return 0; -} - -int ConfigTargetSettings(void) -{ - JLINK_ExecCommand("CORESIGHT_AddAP = Index=0 Type=AHB-AP"); - CORESIGHT_IndexAHBAPToUse = 0; - - // Adjust trace sample delay to compensate for timing when using 320MHz - JLINK_ExecCommand("TraceSampleAdjust TD = 1000"); - - return 0; -} - -int OnTraceStart(void) -{ - // Set up CoreSight if not already configured - if (_needCoresightSetup) { - _SetupETMTPIUTrace(); - _needCoresightSetup = 0; - } - - return 0; -} - - int SetupTarget(void) { JLINK_TARGET_Halt(); From a0fe2ee2a0d9251a8d1ee1b12ee6ce4874bd7115 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:45 +0300 Subject: [PATCH 1143/2141] Revert "[nrf fromlist] soc: nrf54h: Configure CTRLSEL and pin for TRACE" This reverts commit bdd753cd1311d72ab043800c4913d417d3e71020. Signed-off-by: Jukka Rissanen --- soc/nordic/nrf54h/soc.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/soc/nordic/nrf54h/soc.c b/soc/nordic/nrf54h/soc.c index a20815b2227e..d51ade98911a 100644 --- a/soc/nordic/nrf54h/soc.c +++ b/soc/nordic/nrf54h/soc.c @@ -22,7 +22,6 @@ #include #include #include -#include #if defined(CONFIG_SOC_NRF54H20_CPURAD_ENABLE) #include @@ -184,13 +183,6 @@ void soc_late_init_hook(void) err_tdd = ironside_se_tdd_configure(IRONSIDE_SE_TDD_CONFIG_ON_DEFAULT); __ASSERT(err_tdd == 0, "err_tdd was %d", err_tdd); - - UICR_GPIO_PIN_CNF_CTRLSEL_SET(NRF_P7, 3, GPIO_PIN_CNF_CTRLSEL_TND); - UICR_GPIO_PIN_CNF_CTRLSEL_SET(NRF_P7, 4, GPIO_PIN_CNF_CTRLSEL_TND); - UICR_GPIO_PIN_CNF_CTRLSEL_SET(NRF_P7, 5, GPIO_PIN_CNF_CTRLSEL_TND); - UICR_GPIO_PIN_CNF_CTRLSEL_SET(NRF_P7, 6, GPIO_PIN_CNF_CTRLSEL_TND); - UICR_GPIO_PIN_CNF_CTRLSEL_SET(NRF_P7, 7, GPIO_PIN_CNF_CTRLSEL_TND); - #endif #if defined(CONFIG_SOC_NRF54H20_CPURAD_ENABLE) From 76769700f6763492163d0ce6068bd28a8a9c17ab Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:45 +0300 Subject: [PATCH 1144/2141] Revert "[nrf fromlist] soc: nordic: ironside: Add TDD" This reverts commit bd9a022166c48254d021f64c5b61d7f47bbf6215. Signed-off-by: Jukka Rissanen --- soc/nordic/ironside/CMakeLists.txt | 1 - soc/nordic/ironside/Kconfig | 6 --- .../ironside/include/nrf_ironside/tdd.h | 38 ------------------- soc/nordic/ironside/tdd.c | 28 -------------- soc/nordic/nrf54h/Kconfig | 13 +------ soc/nordic/nrf54h/soc.c | 22 ++--------- 6 files changed, 5 insertions(+), 103 deletions(-) delete mode 100644 soc/nordic/ironside/include/nrf_ironside/tdd.h delete mode 100644 soc/nordic/ironside/tdd.c diff --git a/soc/nordic/ironside/CMakeLists.txt b/soc/nordic/ironside/CMakeLists.txt index 98e721541d7f..cf68e8a13529 100644 --- a/soc/nordic/ironside/CMakeLists.txt +++ b/soc/nordic/ironside/CMakeLists.txt @@ -6,6 +6,5 @@ zephyr_library() zephyr_library_sources_ifdef(CONFIG_NRF_IRONSIDE_CALL call.c) zephyr_library_sources_ifdef(CONFIG_NRF_IRONSIDE_BOOT_REPORT boot_report.c) zephyr_library_sources_ifdef(CONFIG_NRF_IRONSIDE_CPUCONF_SERVICE cpuconf.c) -zephyr_library_sources_ifdef(CONFIG_NRF_IRONSIDE_TDD_SERVICE tdd.c) zephyr_library_sources_ifdef(CONFIG_NRF_IRONSIDE_UPDATE_SERVICE update.c) zephyr_library_sources_ifdef(CONFIG_NRF_IRONSIDE_DVFS_SERVICE dvfs.c) diff --git a/soc/nordic/ironside/Kconfig b/soc/nordic/ironside/Kconfig index 2430090c943b..a9e68bba0b28 100644 --- a/soc/nordic/ironside/Kconfig +++ b/soc/nordic/ironside/Kconfig @@ -37,12 +37,6 @@ config NRF_IRONSIDE_CPUCONF_SERVICE help Service used to boot local domain cores. -config NRF_IRONSIDE_TDD_SERVICE - bool "IronSide TDD service" - select NRF_IRONSIDE_CALL - help - Service used to control the trace and debug domain. - config NRF_IRONSIDE_UPDATE_SERVICE bool "IronSide update service" select NRF_IRONSIDE_CALL diff --git a/soc/nordic/ironside/include/nrf_ironside/tdd.h b/soc/nordic/ironside/include/nrf_ironside/tdd.h deleted file mode 100644 index d065b1619a68..000000000000 --- a/soc/nordic/ironside/include/nrf_ironside/tdd.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef ZEPHYR_SOC_NORDIC_IRONSIDE_INCLUDE_NRF_IRONSIDE_TDD_H_ -#define ZEPHYR_SOC_NORDIC_IRONSIDE_INCLUDE_NRF_IRONSIDE_TDD_H_ - -#include - -#include - -#define IRONSIDE_SE_TDD_SERVICE_ERROR_INVALID_CONFIG (1) - -#define IRONSIDE_SE_CALL_ID_TDD_V0 4 - -#define IRONSIDE_SE_TDD_SERVICE_REQ_CONFIG_IDX 0 -#define IRONSIDE_SE_TDD_SERVICE_RSP_RETCODE_IDX 0 - -enum ironside_se_tdd_config { - RESERVED0 = 0, /* Reserved */ - /** Turn off the TDD */ - IRONSIDE_SE_TDD_CONFIG_OFF = 1, - /** Turn on the TDD with default configuration */ - IRONSIDE_SE_TDD_CONFIG_ON_DEFAULT = 2, -}; - -/** - * @brief Control the Trace and Debug Domain (TDD). - * - * @param config The configuration to be applied. - * - * @retval 0 on success. - * @retval -IRONSIDE_SE_TDD_ERROR_EINVAL on invalid argument. - */ -int ironside_se_tdd_configure(const enum ironside_se_tdd_config config); - -#endif /* ZEPHYR_SOC_NORDIC_IRONSIDE_INCLUDE_NRF_IRONSIDE_TDD_H_ */ diff --git a/soc/nordic/ironside/tdd.c b/soc/nordic/ironside/tdd.c deleted file mode 100644 index eee5691cf362..000000000000 --- a/soc/nordic/ironside/tdd.c +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include - -int ironside_se_tdd_configure(const enum ironside_se_tdd_config config) -{ - int err; - struct ironside_call_buf *const buf = ironside_call_alloc(); - - buf->id = IRONSIDE_SE_CALL_ID_TDD_V0; - buf->args[IRONSIDE_SE_TDD_SERVICE_REQ_CONFIG_IDX] = (uint32_t)config; - - ironside_call_dispatch(buf); - - if (buf->status == IRONSIDE_CALL_STATUS_RSP_SUCCESS) { - err = buf->args[IRONSIDE_SE_TDD_SERVICE_RSP_RETCODE_IDX]; - } else { - err = buf->status; - } - - ironside_call_release(buf); - - return err; -} diff --git a/soc/nordic/nrf54h/Kconfig b/soc/nordic/nrf54h/Kconfig index 56b64f293baf..7889287b4a4b 100644 --- a/soc/nordic/nrf54h/Kconfig +++ b/soc/nordic/nrf54h/Kconfig @@ -8,6 +8,7 @@ config SOC_SERIES_NRF54HX select HAS_NRFX select HAS_NORDIC_DRIVERS select SOC_EARLY_INIT_HOOK if ARM + select SOC_LATE_INIT_HOOK if SOC_NRF54H20_CPURAD_ENABLE select NRF_PLATFORM_HALTIUM select EXPERIMENTAL if MCUBOOT @@ -67,23 +68,11 @@ config SOC_NRF54H20_CPURAD_COMMON select HAS_PM select HAS_POWEROFF -config SOC_NRF54H20_TDD_ENABLE - bool "Power and configure the trace and debug domain (TDD)" - depends on SOC_NRF54H20_CPUAPP - select NRF_IRONSIDE_TDD_SERVICE - select SOC_LATE_INIT_HOOK - help - This will at application boot time request that the trace and - debug domain (TDD) is powered up and configured. - This allows configuring the coresight peripherals from - the application domain. - config SOC_NRF54H20_CPURAD_ENABLE bool "Boot the nRF54H20 Radio core" default y if NRF_802154_SER_HOST || BT_HCI_HOST depends on SOC_NRF54H20_CPUAPP select NRF_IRONSIDE_CPUCONF_SERVICE - select SOC_LATE_INIT_HOOK help This will at application boot time enable clock to the Radiocore, and also power will be requested to the Radiocore diff --git a/soc/nordic/nrf54h/soc.c b/soc/nordic/nrf54h/soc.c index d51ade98911a..5f52a091fa84 100644 --- a/soc/nordic/nrf54h/soc.c +++ b/soc/nordic/nrf54h/soc.c @@ -26,9 +26,6 @@ #if defined(CONFIG_SOC_NRF54H20_CPURAD_ENABLE) #include #endif -#if defined(CONFIG_SOC_NRF54H20_TDD_ENABLE) -#include -#endif LOG_MODULE_REGISTER(soc, CONFIG_SOC_LOG_LEVEL); @@ -174,19 +171,10 @@ void soc_early_init_hook(void) } } -#if defined(CONFIG_SOC_LATE_INIT_HOOK) - +#if defined(CONFIG_SOC_NRF54H20_CPURAD_ENABLE) void soc_late_init_hook(void) { -#if defined(CONFIG_SOC_NRF54H20_TDD_ENABLE) - int err_tdd; - - err_tdd = ironside_se_tdd_configure(IRONSIDE_SE_TDD_CONFIG_ON_DEFAULT); - __ASSERT(err_tdd == 0, "err_tdd was %d", err_tdd); -#endif - -#if defined(CONFIG_SOC_NRF54H20_CPURAD_ENABLE) - int err_cpuconf; + int err; /* The msg will be used for communication prior to IPC * communication being set up. But at this moment no such @@ -225,10 +213,8 @@ void soc_late_init_hook(void) /* Don't wait as this is not yet supported. */ bool cpu_wait = false; - err_cpuconf = ironside_cpuconf(NRF_PROCESSOR_RADIOCORE, radiocore_address, cpu_wait, msg, - msg_size); - __ASSERT(err_cpuconf == 0, "err_cpuconf was %d", err_cpuconf); -#endif + err = ironside_cpuconf(NRF_PROCESSOR_RADIOCORE, radiocore_address, cpu_wait, msg, msg_size); + __ASSERT(err == 0, "err was %d", err); } #endif From 5522d55d1cf713ee14157b59dc38a3fce36fed7c Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:45 +0300 Subject: [PATCH 1145/2141] Revert "[nrf fromtree] soc: nordic: ironside: Fix bleeding config" This reverts commit 8c49e07c567e284bbbed4aa675c5d0a74eadaaa0. Signed-off-by: Jukka Rissanen --- soc/nordic/CMakeLists.txt | 2 +- soc/nordic/ironside/CMakeLists.txt | 3 +++ soc/nordic/nrf54h/soc.c | 3 --- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/soc/nordic/CMakeLists.txt b/soc/nordic/CMakeLists.txt index 0c9e9184d6dc..cba58ae51875 100644 --- a/soc/nordic/CMakeLists.txt +++ b/soc/nordic/CMakeLists.txt @@ -47,4 +47,4 @@ endif() add_subdirectory(${SOC_SERIES}) add_subdirectory(common) -add_subdirectory_ifdef(CONFIG_NRF_IRONSIDE ironside) +add_subdirectory(ironside) diff --git a/soc/nordic/ironside/CMakeLists.txt b/soc/nordic/ironside/CMakeLists.txt index cf68e8a13529..a0a18fc94a8a 100644 --- a/soc/nordic/ironside/CMakeLists.txt +++ b/soc/nordic/ironside/CMakeLists.txt @@ -2,8 +2,11 @@ # SPDX-License-Identifier: Apache-2.0 zephyr_include_directories(include) + zephyr_library() + zephyr_library_sources_ifdef(CONFIG_NRF_IRONSIDE_CALL call.c) + zephyr_library_sources_ifdef(CONFIG_NRF_IRONSIDE_BOOT_REPORT boot_report.c) zephyr_library_sources_ifdef(CONFIG_NRF_IRONSIDE_CPUCONF_SERVICE cpuconf.c) zephyr_library_sources_ifdef(CONFIG_NRF_IRONSIDE_UPDATE_SERVICE update.c) diff --git a/soc/nordic/nrf54h/soc.c b/soc/nordic/nrf54h/soc.c index 5f52a091fa84..797081298041 100644 --- a/soc/nordic/nrf54h/soc.c +++ b/soc/nordic/nrf54h/soc.c @@ -22,10 +22,7 @@ #include #include #include - -#if defined(CONFIG_SOC_NRF54H20_CPURAD_ENABLE) #include -#endif LOG_MODULE_REGISTER(soc, CONFIG_SOC_LOG_LEVEL); From 16a4741e86e1e9cc79713408326eea51928d61c2 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:45 +0300 Subject: [PATCH 1146/2141] Revert "[nrf fromtree] soc: nrf54h: don't boot radio core if VTOR is not programmed" This reverts commit d8199513c3c9151c4fb067632c23e4450fb9e78f. Signed-off-by: Jukka Rissanen --- soc/nordic/nrf54h/Kconfig | 7 ------- soc/nordic/nrf54h/soc.c | 7 ------- 2 files changed, 14 deletions(-) diff --git a/soc/nordic/nrf54h/Kconfig b/soc/nordic/nrf54h/Kconfig index 7889287b4a4b..97423a04e9b7 100644 --- a/soc/nordic/nrf54h/Kconfig +++ b/soc/nordic/nrf54h/Kconfig @@ -78,13 +78,6 @@ config SOC_NRF54H20_CPURAD_ENABLE Radiocore, and also power will be requested to the Radiocore subsystem. The Radiocore will then start executing instructions. -config SOC_NRF54H20_CPURAD_ENABLE_CHECK_VTOR - bool "Check VTOR before booting Radio core" - default y - depends on SOC_NRF54H20_CPURAD_ENABLE - help - Verify that VTOR is not 0xFFFFFFFF before booting the Radiocore. - config SOC_NRF54H20_CPURAD select SOC_NRF54H20_CPURAD_COMMON diff --git a/soc/nordic/nrf54h/soc.c b/soc/nordic/nrf54h/soc.c index 797081298041..cdff23103555 100644 --- a/soc/nordic/nrf54h/soc.c +++ b/soc/nordic/nrf54h/soc.c @@ -200,13 +200,6 @@ void soc_late_init_hook(void) CONFIG_ROM_START_OFFSET); #endif - if (IS_ENABLED(CONFIG_SOC_NRF54H20_CPURAD_ENABLE_CHECK_VTOR) && - sys_read32((mem_addr_t)radiocore_address) == 0xFFFFFFFFUL) { - LOG_ERR("Radiocore is not programmed, it will not be started"); - - return; - } - /* Don't wait as this is not yet supported. */ bool cpu_wait = false; From 260ba6f2a96f424b66de6b702ec9e5c017ab27e2 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:45 +0300 Subject: [PATCH 1147/2141] Revert "[nrf fromtree] west: runners: nrf: don't recover twice on nrf54h" This reverts commit 1871cdbd417ea23ebe66ff2a7c1669c0c32337a9. Signed-off-by: Jukka Rissanen --- scripts/west_commands/runners/nrf_common.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/west_commands/runners/nrf_common.py b/scripts/west_commands/runners/nrf_common.py index a7401084ef31..ba1d0dfdc323 100644 --- a/scripts/west_commands/runners/nrf_common.py +++ b/scripts/west_commands/runners/nrf_common.py @@ -320,7 +320,8 @@ def recover_target(self): # recover operation unlocks the core and then flashes a small image that # keeps the debug access port open, recovering the network core last # would result in that small image being deleted from the app core. - if self.family in ('nrf53', 'nrf92'): + # In the case of the 54H, the order is indifferent. + if self.family in ('nrf53', 'nrf54h', 'nrf92'): self.exec_op('recover', core='Network') self.exec_op('recover') From c46c1ab3ea9eaed2643ec7296f66a59a5a5252fd Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:45 +0300 Subject: [PATCH 1148/2141] Revert "[nrf fromtree] west: runners: nrf: Program UICR/PERIPHCONF artifacts if present" This reverts commit 39b677e13129bf1e7d77af0819eb9292b642b27e. Signed-off-by: Jukka Rissanen --- scripts/west_commands/runners/nrf_common.py | 26 +++------------------ 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/scripts/west_commands/runners/nrf_common.py b/scripts/west_commands/runners/nrf_common.py index ba1d0dfdc323..e08186537720 100644 --- a/scripts/west_commands/runners/nrf_common.py +++ b/scripts/west_commands/runners/nrf_common.py @@ -369,9 +369,9 @@ def program_hex(self): if self.family in ('nrf54h', 'nrf92'): erase_arg = 'ERASE_NONE' - regtool_generated_uicr = self.build_conf.getboolean('CONFIG_NRF_REGTOOL_GENERATE_UICR') + generated_uicr = self.build_conf.getboolean('CONFIG_NRF_REGTOOL_GENERATE_UICR') - if regtool_generated_uicr and not self.hex_get_uicrs().get(core): + if generated_uicr and not self.hex_get_uicrs().get(core): raise RuntimeError( f"Expected a UICR to be contained in: {self.hex_}\n" "Please ensure that the correct version of nrf-regtool is " @@ -434,27 +434,7 @@ def program_hex(self): core='Application', ) - if self.build_conf.getboolean("CONFIG_NRF_HALTIUM_GENERATE_UICR"): - zephyr_build_dir = Path(self.cfg.build_dir) / 'zephyr' - - self.op_program( - str(zephyr_build_dir / 'uicr.hex'), - 'ERASE_NONE', - None, - defer=True, - core='Application', - ) - - if self.build_conf.getboolean("CONFIG_NRF_HALTIUM_UICR_PERIPHCONF"): - self.op_program( - str(zephyr_build_dir / 'periphconf.hex'), - 'ERASE_NONE', - None, - defer=True, - core='Application', - ) - - if not self.erase and regtool_generated_uicr: + if not self.erase and generated_uicr: self.exec_op('erase', core=core, kind='uicr') else: if self.erase: From 2d28b3b2ba211d8fb2eba20c4437b562dee9722c Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:45 +0300 Subject: [PATCH 1149/2141] Revert "[nrf fromtree] soc: nordic: add IronSide SE compatible UICR support" This reverts commit ed57bd891abe731ba2cbafeb0f4e1329ed51572d. Signed-off-by: Jukka Rissanen --- .../nrf54h20dk_nrf54h20-memory_map.dtsi | 4 - soc/nordic/common/CMakeLists.txt | 4 - soc/nordic/common/Kconfig | 1 - soc/nordic/common/uicr/CMakeLists.txt | 36 -- soc/nordic/common/uicr/Kconfig | 31 -- soc/nordic/common/uicr/gen_uicr.py | 270 --------------- soc/nordic/common/uicr/uicr.h | 308 ------------------ soc/nordic/common/uicr/uicr.ld | 11 - 8 files changed, 665 deletions(-) delete mode 100644 soc/nordic/common/uicr/CMakeLists.txt delete mode 100644 soc/nordic/common/uicr/Kconfig delete mode 100644 soc/nordic/common/uicr/gen_uicr.py delete mode 100644 soc/nordic/common/uicr/uicr.h delete mode 100644 soc/nordic/common/uicr/uicr.ld diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi index b6a53955c60e..aa6ebc629cc2 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi @@ -162,9 +162,5 @@ storage_partition: partition@1a4000 { reg = <0x1a4000 DT_SIZE_K(40)>; }; - - periphconf_partition: partition@1ae000 { - reg = <0x1ae000 DT_SIZE_K(8)>; - }; }; }; diff --git a/soc/nordic/common/CMakeLists.txt b/soc/nordic/common/CMakeLists.txt index 825be4842fb7..ac75d0838696 100644 --- a/soc/nordic/common/CMakeLists.txt +++ b/soc/nordic/common/CMakeLists.txt @@ -3,10 +3,6 @@ add_subdirectory_ifdef(CONFIG_RISCV_CORE_NORDIC_VPR vpr) -if(CONFIG_NRF_PERIPHCONF_SECTION OR CONFIG_NRF_HALTIUM_GENERATE_UICR) - add_subdirectory(uicr) -endif() - # Let SystemInit() be called in place of soc_reset_hook() by default. zephyr_linker_symbol(SYMBOL soc_reset_hook EXPR "@SystemInit@") diff --git a/soc/nordic/common/Kconfig b/soc/nordic/common/Kconfig index 782d9452b677..059274fd299f 100644 --- a/soc/nordic/common/Kconfig +++ b/soc/nordic/common/Kconfig @@ -49,4 +49,3 @@ source "subsys/logging/Kconfig.template.log_config" endif # MRAM_LATENCY rsource "vpr/Kconfig" -rsource "uicr/Kconfig" diff --git a/soc/nordic/common/uicr/CMakeLists.txt b/soc/nordic/common/uicr/CMakeLists.txt deleted file mode 100644 index 0bde6b47f576..000000000000 --- a/soc/nordic/common/uicr/CMakeLists.txt +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright (c) 2025 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -if(CONFIG_NRF_PERIPHCONF_SECTION) - zephyr_linker_sources(SECTIONS uicr.ld) -endif() - -if(CONFIG_NRF_HALTIUM_GENERATE_UICR) - if(CONFIG_NRF_PERIPHCONF_SECTION) - set(in_periphconf_elf_arg - --in-periphconf-elf $ - ) - endif() - - if(CONFIG_NRF_HALTIUM_UICR_PERIPHCONF) - set(periphconf_hex_file ${PROJECT_BINARY_DIR}/periphconf.hex) - set(out_periphconf_hex_arg - --out-periphconf-hex ${periphconf_hex_file} - ) - list(APPEND optional_byproducts ${periphconf_hex_file}) - endif() - - set(uicr_hex_file ${PROJECT_BINARY_DIR}/uicr.hex) - set_property(GLOBAL APPEND PROPERTY extra_post_build_commands - COMMAND ${CMAKE_COMMAND} -E env PYTHONPATH=${ZEPHYR_BASE}/scripts/dts/python-devicetree/src - ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_LIST_DIR}/gen_uicr.py - --in-config ${DOTCONFIG} - --in-edt-pickle ${EDT_PICKLE} - ${in_periphconf_elf_arg} - ${out_periphconf_hex_arg} - --out-uicr-hex ${uicr_hex_file} - ) - set_property(GLOBAL APPEND PROPERTY extra_post_build_byproducts - ${uicr_hex_file} ${optional_byproducts} - ) -endif() diff --git a/soc/nordic/common/uicr/Kconfig b/soc/nordic/common/uicr/Kconfig deleted file mode 100644 index f132510a7a5d..000000000000 --- a/soc/nordic/common/uicr/Kconfig +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright (c) 2025 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -config NRF_HALTIUM_GENERATE_UICR - bool "Generate UICR file" - depends on SOC_NRF54H20_CPUAPP - default y - help - Generate UICR HEX file. - -if NRF_HALTIUM_GENERATE_UICR - -config NRF_HALTIUM_UICR_PERIPHCONF - bool "Initialize global domain peripherals" - default y - help - Generates a blob containing static global domain peripheral initialization - values extracted from the build artifacts, and configures UICR.PERIPHCONF - to point at the blob. The initialization values are then loaded ahead of - ahead of the application boot. - -endif - -config NRF_PERIPHCONF_SECTION - bool "Populate global peripheral initialization section" - default y if SOC_NRF54H20_CPUAPP - depends on LINKER_DEVNULL_SUPPORT - imply LINKER_DEVNULL_MEMORY - help - Include static global domain peripheral initialization values from the - build in a dedicated section in the devnull region. diff --git a/soc/nordic/common/uicr/gen_uicr.py b/soc/nordic/common/uicr/gen_uicr.py deleted file mode 100644 index 50f96eab566f..000000000000 --- a/soc/nordic/common/uicr/gen_uicr.py +++ /dev/null @@ -1,270 +0,0 @@ -""" -Copyright (c) 2025 Nordic Semiconductor ASA -SPDX-License-Identifier: Apache-2.0 -""" - -from __future__ import annotations - -import argparse -import ctypes as c -import math -import pickle -import re -import sys -from collections import defaultdict -from itertools import groupby - -from elftools.elf.elffile import ELFFile -from intelhex import IntelHex - -# Name of the ELF section containing PERIPHCONF entries. -# Must match the name used in the linker script. -PERIPHCONF_SECTION = "uicr_periphconf_entry" - -# Expected nodelabel of the UICR devicetree node, used to extract its location from the devicetree. -UICR_NODELABEL = "uicr" -# Nodelabel of the PERIPHCONF devicetree node, used to extract its location from the devicetree. -PERIPHCONF_NODELABEL = "periphconf_partition" - -# Common values for representing enabled/disabled in the UICR format. -ENABLED_VALUE = 0xFFFF_FFFF -DISABLED_VALUE = 0xBD23_28A8 - - -class ScriptError(RuntimeError): ... - - -class PeriphconfEntry(c.LittleEndianStructure): - _pack_ = 1 - _fields_ = [ - ("regptr", c.c_uint32), - ("value", c.c_uint32), - ] - - -PERIPHCONF_ENTRY_SIZE = c.sizeof(PeriphconfEntry) - - -class Approtect(c.LittleEndianStructure): - _pack_ = 1 - _fields_ = [ - ("APPLICATION", c.c_uint32), - ("RADIOCORE", c.c_uint32), - ("RESERVED", c.c_uint32), - ("CORESIGHT", c.c_uint32), - ] - - -class Protectedmem(c.LittleEndianStructure): - _pack_ = 1 - _fields_ = [ - ("ENABLE", c.c_uint32), - ("SIZE4KB", c.c_uint32), - ] - - -class Recovery(c.LittleEndianStructure): - _pack_ = 1 - _fields_ = [ - ("ENABLE", c.c_uint32), - ("PROCESSOR", c.c_uint32), - ("INITSVTOR", c.c_uint32), - ("SIZE4KB", c.c_uint32), - ] - - -class Its(c.LittleEndianStructure): - _pack_ = 1 - _fields_ = [ - ("ENABLE", c.c_uint32), - ("ADDRESS", c.c_uint32), - ("APPLICATIONSIZE", c.c_uint32), - ("RADIOCORESIZE", c.c_uint32), - ] - - -class Periphconf(c.LittleEndianStructure): - _pack_ = 1 - _fields_ = [ - ("ENABLE", c.c_uint32), - ("ADDRESS", c.c_uint32), - ("MAXCOUNT", c.c_uint32), - ] - - -class Mpcconf(c.LittleEndianStructure): - _pack_ = 1 - _fields_ = [ - ("ENABLE", c.c_uint32), - ("ADDRESS", c.c_uint32), - ("MAXCOUNT", c.c_uint32), - ] - - -class Uicr(c.LittleEndianStructure): - _pack_ = 1 - _fields_ = [ - ("VERSION", c.c_uint32), - ("RESERVED", c.c_uint32), - ("LOCK", c.c_uint32), - ("RESERVED1", c.c_uint32), - ("APPROTECT", Approtect), - ("ERASEPROTECT", c.c_uint32), - ("PROTECTEDMEM", Protectedmem), - ("RECOVERY", Recovery), - ("ITS", Its), - ("RESERVED2", c.c_uint32 * 7), - ("PERIPHCONF", Periphconf), - ("MPCCONF", Mpcconf), - ] - - -def main() -> None: - parser = argparse.ArgumentParser( - allow_abbrev=False, - description=( - "Generate artifacts for the UICR and associated configuration blobs from application " - "build outputs. User Information Configuration Registers (UICR), in the context of " - "certain Nordic SoCs, are used to configure system resources, like memory and " - "peripherals, and to protect the device in various ways." - ), - ) - parser.add_argument( - "--in-config", - required=True, - type=argparse.FileType("r"), - help="Path to the .config file from the application build", - ) - parser.add_argument( - "--in-edt-pickle", - required=True, - type=argparse.FileType("rb"), - help="Path to the edt.pickle file from the application build", - ) - parser.add_argument( - "--in-periphconf-elf", - dest="in_periphconf_elfs", - default=[], - action="append", - type=argparse.FileType("rb"), - help=( - "Path to an ELF file to extract PERIPHCONF data from. Can be provided multiple times. " - "The PERIPHCONF data from each ELF file is combined in a single list which is sorted " - "by ascending address and cleared of duplicate entries." - ), - ) - parser.add_argument( - "--out-uicr-hex", - required=True, - type=argparse.FileType("w", encoding="utf-8"), - help="Path to write the generated UICR HEX file to", - ) - parser.add_argument( - "--out-periphconf-hex", - default=None, - type=argparse.FileType("w", encoding="utf-8"), - help="Path to write the generated PERIPHCONF HEX file to", - ) - args = parser.parse_args() - - try: - init_values = DISABLED_VALUE.to_bytes(4, "little") * (c.sizeof(Uicr) // 4) - uicr = Uicr.from_buffer_copy(init_values) - - kconfig_str = args.in_config.read() - kconfig = parse_kconfig(kconfig_str) - - edt = pickle.load(args.in_edt_pickle) - - try: - periphconf_partition = edt.label2node[PERIPHCONF_NODELABEL] - except LookupError as e: - raise ScriptError( - "Failed to find a PERIPHCONF partition in the devicetree. " - f"Expected a DT node with label '{PERIPHCONF_NODELABEL}'." - ) from e - - flash_base_address = periphconf_partition.flash_controller.regs[0].addr - periphconf_address = flash_base_address + periphconf_partition.regs[0].addr - periphconf_size = periphconf_partition.regs[0].size - - periphconf_combined = extract_and_combine_periphconfs(args.in_periphconf_elfs) - padding_len = periphconf_size - len(periphconf_combined) - periphconf_final = periphconf_combined + bytes([0xFF for _ in range(padding_len)]) - - if kconfig.get("CONFIG_NRF_HALTIUM_UICR_PERIPHCONF") == "y": - uicr.PERIPHCONF.ENABLE = ENABLED_VALUE - uicr.PERIPHCONF.ADDRESS = periphconf_address - uicr.PERIPHCONF.MAXCOUNT = math.floor(periphconf_size / 8) - - try: - uicr_node = edt.label2node[UICR_NODELABEL] - except LookupError as e: - raise ScriptError( - "Failed to find UICR node in the devicetree. " - f"Expected a DT node with label '{UICR_NODELABEL}'." - ) from e - - uicr_hex = IntelHex() - uicr_hex.frombytes(bytes(uicr), offset=uicr_node.regs[0].addr) - - uicr_hex.write_hex_file(args.out_uicr_hex) - - if args.out_periphconf_hex is not None: - periphconf_hex = IntelHex() - periphconf_hex.frombytes(periphconf_final, offset=periphconf_address) - periphconf_hex.write_hex_file(args.out_periphconf_hex) - - except ScriptError as e: - print(f"Error: {e!s}") - sys.exit(1) - - -def extract_and_combine_periphconfs(elf_files: list[argparse.FileType]) -> bytes: - combined_periphconf = [] - - for in_file in elf_files: - elf = ELFFile(in_file) - conf_section = elf.get_section_by_name(PERIPHCONF_SECTION) - if conf_section is None: - continue - - conf_section_data = conf_section.data() - num_entries = len(conf_section_data) // PERIPHCONF_ENTRY_SIZE - periphconf = (PeriphconfEntry * num_entries).from_buffer_copy(conf_section_data) - combined_periphconf.extend(periphconf) - - combined_periphconf.sort(key=lambda e: e.regptr) - deduplicated_periphconf = [] - - for regptr, regptr_entries in groupby(combined_periphconf, key=lambda e: e.regptr): - entries = list(regptr_entries) - if len(entries) > 1: - unique_values = {e.value for e in entries} - if len(unique_values) > 1: - raise ScriptError( - f"PERIPHCONF has conflicting values for register 0x{regptr:09_x}: " - + ", ".join([f"0x{val:09_x}" for val in unique_values]) - ) - deduplicated_periphconf.append(entries[0]) - - final_periphconf = (PeriphconfEntry * len(deduplicated_periphconf))() - for i, entry in enumerate(deduplicated_periphconf): - final_periphconf[i] = entry - - return bytes(final_periphconf) - - -def parse_kconfig(content: str) -> dict[str, str | None]: - result = defaultdict(None) - match_iter = re.finditer( - r"^(?P(SB_)?CONFIG_[^=\s]+)=(?P[^\s#])+$", content, re.MULTILINE - ) - for match in match_iter: - result[match["config"]] = match["value"] - - return result - - -if __name__ == "__main__": - main() diff --git a/soc/nordic/common/uicr/uicr.h b/soc/nordic/common/uicr/uicr.h deleted file mode 100644 index 7ceb12429e22..000000000000 --- a/soc/nordic/common/uicr/uicr.h +++ /dev/null @@ -1,308 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef SOC_NORDIC_COMMON_UICR_UICR_H_ -#define SOC_NORDIC_COMMON_UICR_UICR_H_ - -#include -#include -#include -#include -#include - -/** Entry in the PERIPHCONF table. */ -struct uicr_periphconf_entry { - /** Register pointer. */ - uint32_t regptr; - /** Register value. */ - uint32_t value; -} __packed; - -/** @brief Add an entry to the PERIPHCONF table section. - * - * This should typically not be used directly. - * Prefer to use one of the higher level macros. - */ -#define UICR_PERIPHCONF_ADD(_regptr, _value) \ - static STRUCT_SECTION_ITERABLE(uicr_periphconf_entry, \ - _UICR_PERIPHCONF_ENTRY_NAME(__COUNTER__)) = { \ - .regptr = (_regptr), \ - .value = (_value), \ - } - -#define _UICR_PERIPHCONF_ENTRY_NAME(_id) __UICR_PERIPHCONF_ENTRY_NAME(_id) -#define __UICR_PERIPHCONF_ENTRY_NAME(_id) _uicr_periphconf_entry_##_id - -/** @brief Add a PERIPHCONF entry for a SPU PERIPH[n].PERM register value. - * - * @param _spu Global domain SPU instance address. - * @param _index Peripheral slave index on the bus (PERIPH[n] register index). - * @param _secattr If true, set SECATTR to secure, otherwise set it to non-secure. - * @param _dmasec If true, set DMASEC to secure, otherwise set it to non-secure. - * @param _ownerid OWNERID field value. - */ -#define UICR_SPU_PERIPH_PERM_SET(_spu, _index, _secattr, _dmasec, _ownerid) \ - UICR_PERIPHCONF_ADD((uint32_t)&((NRF_SPU_Type *)(_spu))->PERIPH[(_index)].PERM, \ - (uint32_t)((((_ownerid) << SPU_PERIPH_PERM_OWNERID_Pos) & \ - SPU_PERIPH_PERM_OWNERID_Msk) | \ - (((_secattr) ? SPU_PERIPH_PERM_SECATTR_Secure \ - : SPU_PERIPH_PERM_SECATTR_NonSecure) \ - << SPU_PERIPH_PERM_SECATTR_Pos) | \ - (((_dmasec) ? SPU_PERIPH_PERM_DMASEC_Secure \ - : SPU_PERIPH_PERM_DMASEC_NonSecure) \ - << SPU_PERIPH_PERM_DMASEC_Pos) | \ - (SPU_PERIPH_PERM_LOCK_Locked << SPU_PERIPH_PERM_LOCK_Pos))) - -/** @brief Add a PERIPHCONF entry for a SPU FEATURE.IPCT.CH[n] register value. - * - * @param _spu Global domain SPU instance address. - * @param _index Feature index. - * @param _secattr If true, set SECATTR to secure, otherwise set it to non-secure. - * @param _ownerid OWNERID field value. - */ -#define UICR_SPU_FEATURE_IPCT_CH_SET(_spu, _index, _secattr, _ownerid) \ - UICR_PERIPHCONF_ADD((uint32_t)&((NRF_SPU_Type *)(_spu))->FEATURE.IPCT.CH[_index], \ - _UICR_SPU_FEATURE_VAL(_secattr, _ownerid)) - -/** @brief Add a PERIPHCONF entry for a SPU FEATURE.IPCT.INTERRUPT[n] register value. - * - * @param _spu Global domain SPU instance address. - * @param _index Feature index. - * @param _secattr If true, set SECATTR to secure, otherwise set it to non-secure. - * @param _ownerid OWNERID field value. - */ -#define UICR_SPU_FEATURE_IPCT_INTERRUPT_SET(_spu, _index, _secattr, _ownerid) \ - UICR_PERIPHCONF_ADD((uint32_t)&((NRF_SPU_Type *)(_spu))->FEATURE.IPCT.INTERRUPT[_index], \ - _UICR_SPU_FEATURE_VAL(_secattr, _ownerid)) - -/** @brief Add a PERIPHCONF entry for a SPU FEATURE.DPPIC.CH[n] register value. - * - * @param _spu Global domain SPU instance address. - * @param _index Feature index. - * @param _secattr If true, set SECATTR to secure, otherwise set it to non-secure. - * @param _ownerid OWNERID field value. - */ -#define UICR_SPU_FEATURE_DPPIC_CH_SET(_spu, _index, _secattr, _ownerid) \ - UICR_PERIPHCONF_ADD((uint32_t)&((NRF_SPU_Type *)(_spu))->FEATURE.DPPIC.CH[_index], \ - _UICR_SPU_FEATURE_VAL(_secattr, _ownerid)) - -/** @brief Add a PERIPHCONF entry for a SPU FEATURE.DPPIC.CHG[n] register value. - * - * @param _spu Global domain SPU instance address. - * @param _index Register index. - * @param _secattr If true, set SECATTR to secure, otherwise set it to non-secure. - * @param _ownerid OWNERID field value. - */ -#define UICR_SPU_FEATURE_DPPIC_CHG_SET(_spu, _index, _secattr, _ownerid) \ - UICR_PERIPHCONF_ADD((uint32_t)&((NRF_SPU_Type *)(_spu))->FEATURE.DPPIC.CHG[_index], \ - _UICR_SPU_FEATURE_VAL(_secattr, _ownerid)) - -/** @brief Add a PERIPHCONF entry for a SPU FEATURE.GPIOTE[n].CH[m] register value. - * - * @param _spu Global domain SPU instance address. - * @param _index Feature index (GPIOTE[n] register index). - * @param _subindex Feature subindex (CH[m] register index). - * @param _secattr If true, set the SECATTR to secure, otherwise set it to non-secure. - * @param _ownerid OWNERID field value. - */ -#define UICR_SPU_FEATURE_GPIOTE_CH_SET(_spu, _index, _subindex, _secattr, _ownerid) \ - UICR_PERIPHCONF_ADD( \ - (uint32_t)&((NRF_SPU_Type *)(_spu))->FEATURE.GPIOTE[_index].CH[_subindex], \ - _UICR_SPU_FEATURE_VAL(_secattr, _ownerid)) - -/** @brief Add a PERIPHCONF entry for a SPU FEATURE.GPIOTE.INTERRUPT[n] register value. - * - * @param _spu Global domain SPU instance address. - * @param _index Feature index. - * @param _subindex Feature subindex. - * @param _secattr If true, set SECATTR to secure, otherwise set it to non-secure. - * @param _ownerid OWNERID field value. - */ -#define UICR_SPU_FEATURE_GPIOTE_INTERRUPT_SET(_spu, _index, _subindex, _secattr, _ownerid) \ - UICR_PERIPHCONF_ADD( \ - (uint32_t)&((NRF_SPU_Type *)(_spu))->FEATURE.GPIOTE[_index].INTERRUPT[_subindex], \ - _UICR_SPU_FEATURE_VAL(_secattr, _ownerid)) - -/** @brief Add a PERIPHCONF entry for a SPU FEATURE.GPIO[n].PIN[m] register value. - * - * @param _spu Global domain SPU instance address. - * @param _index Feature index. - * @param _subindex Feature subindex. - * @param _secattr If true, set SECATTR to secure, otherwise set it to non-secure. - * @param _ownerid OWNERID field value. - */ -#define UICR_SPU_FEATURE_GPIO_PIN_SET(_spu, _index, _subindex, _secattr, _ownerid) \ - UICR_PERIPHCONF_ADD( \ - (uint32_t)&((NRF_SPU_Type *)(_spu))->FEATURE.GPIO[_index].PIN[_subindex], \ - _UICR_SPU_FEATURE_VAL(_secattr, _ownerid)) - -/** @brief Add a PERIPHCONF entry for a SPU FEATURE.GRTC.CC[n] register value. - * - * @param _spu Global domain SPU instance address. - * @param _index Feature index. - * @param _secattr If true, set SECATTR to secure, otherwise set it to non-secure. - * @param _ownerid OWNERID field value. - */ -#define UICR_SPU_FEATURE_GRTC_CC_SET(_spu, _index, _secattr, _ownerid) \ - UICR_PERIPHCONF_ADD((uint32_t)&((NRF_SPU_Type *)(_spu))->FEATURE.GRTC.CC[_index], \ - _UICR_SPU_FEATURE_VAL(_secattr, _ownerid)) - -/* Common macro for encoding a SPU FEATURE.* register value. - * Note that the MDK SPU_FEATURE_IPCT_CH_ macros are used for all since all the FEATURE registers - * have the same layout with different naming. - */ -#define _UICR_SPU_FEATURE_VAL(_secattr, _ownerid) \ - (uint32_t)((((_ownerid) << SPU_FEATURE_IPCT_CH_OWNERID_Pos) & \ - SPU_FEATURE_IPCT_CH_OWNERID_Msk) | \ - (((_secattr) ? SPU_FEATURE_IPCT_CH_SECATTR_Secure \ - : SPU_FEATURE_IPCT_CH_SECATTR_NonSecure) \ - << SPU_FEATURE_IPCT_CH_SECATTR_Pos) | \ - (SPU_FEATURE_IPCT_CH_LOCK_Locked << SPU_FEATURE_IPCT_CH_LOCK_Pos)) - -/** @brief Add PERIPHCONF entries for configuring IPCMAP CHANNEL.SOURCE[n] and CHANNEL.SINK[n]. - * - * @param _index CHANNEL.SOURCE[n]/CHANNEL.SINK[n] register index. - * @param _source_domain DOMAIN field value in CHANNEL[n].SOURCE. - * @param _source_ch SOURCE field value in CHANNEL[n].SOURCE. - * @param _sink_domain DOMAIN field value in CHANNEL[n].SINK. - * @param _sink_ch SINK field value in CHANNEL[n].SINK. - */ -#define UICR_IPCMAP_CHANNEL_CFG(_index, _source_domain, _source_ch, _sink_domain, _sink_ch) \ - UICR_IPCMAP_CHANNEL_SOURCE_SET(_index, _source_domain, _source_ch, 1); \ - UICR_IPCMAP_CHANNEL_SINK_SET(_index, _sink_domain, _sink_ch) - -#define UICR_IPCMAP_CHANNEL_SOURCE_SET(_index, _domain, _ch, _enable) \ - UICR_PERIPHCONF_ADD((uint32_t)&NRF_IPCMAP->CHANNEL[(_index)].SOURCE, \ - (uint32_t)((((_domain) << IPCMAP_CHANNEL_SOURCE_DOMAIN_Pos) & \ - IPCMAP_CHANNEL_SOURCE_DOMAIN_Msk) | \ - (((_ch) << IPCMAP_CHANNEL_SOURCE_SOURCE_Pos) & \ - IPCMAP_CHANNEL_SOURCE_SOURCE_Msk) | \ - (((_enable) ? IPCMAP_CHANNEL_SOURCE_ENABLE_Enabled \ - : IPCMAP_CHANNEL_SOURCE_ENABLE_Disabled) \ - << IPCMAP_CHANNEL_SOURCE_ENABLE_Pos))) - -#define UICR_IPCMAP_CHANNEL_SINK_SET(_index, _domain, _ch) \ - UICR_PERIPHCONF_ADD((uint32_t)&NRF_IPCMAP->CHANNEL[(_index)].SINK, \ - (uint32_t)((((_domain) << IPCMAP_CHANNEL_SINK_DOMAIN_Pos) & \ - IPCMAP_CHANNEL_SINK_DOMAIN_Msk) | \ - (((_ch) << IPCMAP_CHANNEL_SINK_SINK_Pos) & \ - IPCMAP_CHANNEL_SINK_SINK_Msk))) - -/** @brief Add a PERIPHCONF entry for an IRQMAP IRQ[n].SINK register value. - * - * @param _irqnum IRQ number (IRQ[n] register index). - * @param _processor Processor to route the interrupt to (PROCESSORID field value). - */ -#define UICR_IRQMAP_IRQ_SINK_SET(_irqnum, _processor) \ - UICR_PERIPHCONF_ADD((uint32_t)&NRF_IRQMAP->IRQ[(_irqnum)].SINK, \ - (uint32_t)(((_processor) << IRQMAP_IRQ_SINK_PROCESSORID_Pos) & \ - IRQMAP_IRQ_SINK_PROCESSORID_Msk)) - -/** @brief Add a PERIPHCONF entry for configuring a GPIO PIN_CNF[n] CTRLSEL field value. - * - * @param _gpio GPIO instance address. - * @param _pin Pin number (PIN_CNF[n] register index). - * @param _ctrlsel CTRLSEL field value. - */ -#define UICR_GPIO_PIN_CNF_CTRLSEL_SET(_gpio, _pin, _ctrlsel) \ - UICR_PERIPHCONF_ADD( \ - (uint32_t)&((NRF_GPIO_Type *)(_gpio))->PIN_CNF[(_pin)], \ - ((GPIO_PIN_CNF_ResetValue) | \ - (uint32_t)(((_ctrlsel) << GPIO_PIN_CNF_CTRLSEL_Pos) & GPIO_PIN_CNF_CTRLSEL_Msk))) - -/** @brief Add a PERIPHCONF entry for a PPIB SUBSCRIBE_SEND[n] register. - * - * @param _ppib Global domain PPIB instance address. - * @param _ppib_ch PPIB channel number. - */ -#define UICR_PPIB_SUBSCRIBE_SEND_ENABLE(_ppib, _ppib_ch) \ - UICR_PERIPHCONF_ADD((uint32_t)&((NRF_PPIB_Type *)(_ppib))->SUBSCRIBE_SEND[(_ppib_ch)], \ - (uint32_t)PPIB_SUBSCRIBE_SEND_EN_Msk) - -/** @brief Add a PERIPHCONF entry for a PPIB PUBLISH_RECEIVE[n] register. - * - * @param _ppib Global domain PPIB instance address. - * @param _ppib_ch PPIB channel number. - */ -#define UICR_PPIB_PUBLISH_RECEIVE_ENABLE(_ppib, _ppib_ch) \ - UICR_PERIPHCONF_ADD((uint32_t)&((NRF_PPIB_Type *)(_ppib))->PUBLISH_RECEIVE[(_ppib_ch)], \ - (uint32_t)PPIB_PUBLISH_RECEIVE_EN_Msk) - -/* The definitions below are not currently available in the MDK but are needed for the macros - * above. When they are, this can be deleted. - */ -#ifndef IPCMAP_CHANNEL_SOURCE_SOURCE_Msk - -typedef struct { - __IOM uint32_t SOURCE; - __IOM uint32_t SINK; -} NRF_IPCMAP_CHANNEL_Type; - -#define IPCMAP_CHANNEL_SOURCE_SOURCE_Pos (0UL) -#define IPCMAP_CHANNEL_SOURCE_SOURCE_Msk (0xFUL << IPCMAP_CHANNEL_SOURCE_SOURCE_Pos) -#define IPCMAP_CHANNEL_SOURCE_DOMAIN_Pos (8UL) -#define IPCMAP_CHANNEL_SOURCE_DOMAIN_Msk (0xFUL << IPCMAP_CHANNEL_SOURCE_DOMAIN_Pos) -#define IPCMAP_CHANNEL_SOURCE_ENABLE_Pos (31UL) -#define IPCMAP_CHANNEL_SOURCE_ENABLE_Disabled (0x0UL) -#define IPCMAP_CHANNEL_SOURCE_ENABLE_Enabled (0x1UL) -#define IPCMAP_CHANNEL_SINK_SINK_Pos (0UL) -#define IPCMAP_CHANNEL_SINK_SINK_Msk (0xFUL << IPCMAP_CHANNEL_SINK_SINK_Pos) -#define IPCMAP_CHANNEL_SINK_DOMAIN_Pos (8UL) -#define IPCMAP_CHANNEL_SINK_DOMAIN_Msk (0xFUL << IPCMAP_CHANNEL_SINK_DOMAIN_Pos) - -typedef struct { - __IM uint32_t RESERVED[256]; - __IOM NRF_IPCMAP_CHANNEL_Type CHANNEL[16]; -} NRF_IPCMAP_Type; - -#endif /* IPCMAP_CHANNEL_SOURCE_SOURCE_Msk */ - -#ifndef NRF_IPCMAP -#define NRF_IPCMAP ((NRF_IPCMAP_Type *)0x5F923000UL) -#endif - -#ifndef IRQMAP_IRQ_SINK_PROCESSORID_Msk - -typedef struct { - __IOM uint32_t SINK; -} NRF_IRQMAP_IRQ_Type; - -#define IRQMAP_IRQ_SINK_PROCESSORID_Pos (8UL) -#define IRQMAP_IRQ_SINK_PROCESSORID_Msk (0xFUL << IRQMAP_IRQ_SINK_PROCESSORID_Pos) - -typedef struct { - __IM uint32_t RESERVED[256]; - __IOM NRF_IRQMAP_IRQ_Type IRQ[480]; -} NRF_IRQMAP_Type; - -#endif /* IRQMAP_IRQ_SINK_PROCESSORID_Msk */ - -#ifndef NRF_IRQMAP -#define NRF_IRQMAP ((NRF_IRQMAP_Type *)0x5F924000UL) -#endif /* NRF_IRQMAP */ - -#ifndef GPIO_PIN_CNF_CTRLSEL_Pos - -#define GPIO_PIN_CNF_CTRLSEL_Pos (28UL) -#define GPIO_PIN_CNF_CTRLSEL_Msk (0x7UL << GPIO_PIN_CNF_CTRLSEL_Pos) -#define GPIO_PIN_CNF_CTRLSEL_Min (0x0UL) -#define GPIO_PIN_CNF_CTRLSEL_Max (0x7UL) -#define GPIO_PIN_CNF_CTRLSEL_GPIO (0x0UL) -#define GPIO_PIN_CNF_CTRLSEL_VPR (0x1UL) -#define GPIO_PIN_CNF_CTRLSEL_GRC (0x1UL) -#define GPIO_PIN_CNF_CTRLSEL_SecureDomain (0x2UL) -#define GPIO_PIN_CNF_CTRLSEL_PWM (0x2UL) -#define GPIO_PIN_CNF_CTRLSEL_I3C (0x2UL) -#define GPIO_PIN_CNF_CTRLSEL_Serial (0x3UL) -#define GPIO_PIN_CNF_CTRLSEL_HSSPI (0x3UL) -#define GPIO_PIN_CNF_CTRLSEL_RadioCore (0x4UL) -#define GPIO_PIN_CNF_CTRLSEL_EXMIF (0x4UL) -#define GPIO_PIN_CNF_CTRLSEL_CELL (0x4UL) -#define GPIO_PIN_CNF_CTRLSEL_DTB (0x6UL) -#define GPIO_PIN_CNF_CTRLSEL_TND (0x7UL) - -#endif /* GPIO_PIN_CNF_CTRLSEL_Pos */ - -#endif /* SOC_NORDIC_COMMON_UICR_UICR_H_ */ diff --git a/soc/nordic/common/uicr/uicr.ld b/soc/nordic/common/uicr/uicr.ld deleted file mode 100644 index 210495b1c66c..000000000000 --- a/soc/nordic/common/uicr/uicr.ld +++ /dev/null @@ -1,11 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -#include - -SECTION_PROLOGUE(uicr_periphconf_entry,(COPY),SUBALIGN(Z_LINK_ITERABLE_SUBALIGN)) -{ - Z_LINK_ITERABLE(uicr_periphconf_entry); -} GROUP_ROM_LINK_IN(DEVNULL_REGION, DEVNULL_REGION) From f267ec06354b576108a1d279f2016e9239c0fe30 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:45 +0300 Subject: [PATCH 1150/2141] Revert "[nrf fromtree] dts: nordic: update UICR definition on nrf54h20" This reverts commit 3ad7a6d1a6bfb5b71213a96732ed58ed66086cf2. Signed-off-by: Jukka Rissanen --- dts/vendor/nordic/nrf54h20.dtsi | 11 +++++++++-- soc/nordic/validate_base_addresses.c | 4 ---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/dts/vendor/nordic/nrf54h20.dtsi b/dts/vendor/nordic/nrf54h20.dtsi index 05ae6df5d0f6..241a8206f9af 100644 --- a/dts/vendor/nordic/nrf54h20.dtsi +++ b/dts/vendor/nordic/nrf54h20.dtsi @@ -226,12 +226,13 @@ write-block-size = <16>; }; - uicr: uicr@fff8000 { - compatible = "nordic,nrf-uicr"; + cpuapp_uicr: uicr@fff8000 { + compatible = "nordic,nrf-uicr-v2"; reg = <0xfff8000 DT_SIZE_K(2)>; #address-cells = <1>; #size-cells = <1>; ranges = <0x0 0xfff8000 DT_SIZE_K(2)>; + domain = <2>; bicr: bicr@7b0 { compatible = "nordic,nrf-bicr"; @@ -239,6 +240,12 @@ }; }; + cpurad_uicr: uicr@fffa000 { + compatible = "nordic,nrf-uicr-v2"; + reg = <0xfffa000 DT_SIZE_K(2)>; + domain = <3>; + }; + ficr: ficr@fffe000 { compatible = "nordic,nrf-ficr"; reg = <0xfffe000 DT_SIZE_K(2)>; diff --git a/soc/nordic/validate_base_addresses.c b/soc/nordic/validate_base_addresses.c index f3c9c8bf2145..1c5c39f74ec1 100644 --- a/soc/nordic/validate_base_addresses.c +++ b/soc/nordic/validate_base_addresses.c @@ -335,11 +335,7 @@ CHECK_DT_REG(uart134, NRF_UARTE134); CHECK_DT_REG(uart135, NRF_UARTE135); CHECK_DT_REG(uart136, NRF_UARTE136); CHECK_DT_REG(uart137, NRF_UARTE137); -#if !defined(CONFIG_SOC_SERIES_NRF54HX) CHECK_DT_REG(uicr, NRF_UICR); -#else -CHECK_DT_REG(uicr, NRF_APPLICATION_UICR); -#endif CHECK_DT_REG(cpuapp_uicr, NRF_APPLICATION_UICR); CHECK_DT_REG(bicr, NRF_APPLICATION_BICR); CHECK_DT_REG(cpurad_uicr, NRF_RADIOCORE_UICR); From e20a03e29c0fb0416a2039e7d44fffe27143d03d Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:45 +0300 Subject: [PATCH 1151/2141] Revert "[nrf fromtree] boards: nordic: nrf54h20dk: refactor RAM memory map" This reverts commit 75718fa236c519a4ae9e28a06671182983d2adc2. Signed-off-by: Jukka Rissanen --- .../nrf54h20dk_nrf54h20-memory_map.dtsi | 135 +++++++++++++----- .../nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 12 ++ .../nrf54h20dk_nrf54h20_cpuapp_0_9_0.yaml | 2 +- .../nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts | 8 ++ dts/vendor/nordic/nrf54h20.dtsi | 1 + .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 5 + .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 4 + .../soc/nrf54h20_cpuapp.overlay | 4 + .../nordic-ppr/soc/nrf54h20_cpuapp.overlay | 4 + .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 8 ++ .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 4 + 11 files changed, 153 insertions(+), 34 deletions(-) create mode 100644 tests/arch/common/ramfunc/boards/nrf54h20dk_nrf54h20_cpuapp.overlay diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi index aa6ebc629cc2..7f568005a225 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi @@ -7,20 +7,62 @@ / { reserved-memory { - cpuapp_data: memory@2f000000 { - reg = <0x2f000000 DT_SIZE_K(760)>; + cpuapp_ram0x_region: memory@2f010000 { + compatible = "nordic,owned-memory"; + reg = <0x2f010000 DT_SIZE_K(260)>; + status = "disabled"; + nordic,access = ; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x2f010000 0x41000>; + + cpuapp_data: memory@1000 { + reg = <0x1000 DT_SIZE_K(256)>; + }; }; - etr_buffer: memory@2f0be000 { - reg = <0x2f0be000 DT_SIZE_K(4)>; + cpurad_ram0x_region: memory@2f051000 { + compatible = "nordic,owned-memory"; + reg = <0x2f051000 DT_SIZE_K(4)>; + status = "disabled"; + nordic,access = ; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x2f051000 0x1000>; }; - cpuapp_cpurad_ipc_shm: memory@2f0bf000 { - reg = <0x2f0bf000 DT_SIZE_K(2)>; + etr_buf_ram0x_region: memory@2f0be000 { + compatible = "nordic,owned-memory"; + reg = <0x2f0be000 DT_SIZE_K(4)>; + status = "disabled"; + nordic,access = ; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x2f0be000 0x1000>; + + /* TODO In future move this region to cpuapp_ram0x_region. */ + etr_buffer: memory@0 { + reg = <0x0 DT_SIZE_K(4)>; + }; }; - cpurad_cpuapp_ipc_shm: memory@2f0bf800 { - reg = <0x2f0bf800 DT_SIZE_K(2)>; + cpuapp_cpurad_ram0x_region: memory@2f0bf000 { + compatible = "nordic,owned-memory"; + reg = <0x2f0bf000 DT_SIZE_K(4)>; + status = "disabled"; + nordic,access = , + ; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x2f0bf000 0x1000>; + + cpuapp_cpurad_ipc_shm: memory@0 { + reg = <0x0 DT_SIZE_K(2)>; + }; + + cpurad_cpuapp_ipc_shm: memory@800 { + reg = <0x800 DT_SIZE_K(2)>; + }; }; cpuapp_cpusys_ipc_shm: memory@2f88f600 { @@ -63,53 +105,80 @@ reg = <0x2f88fd00 0x200>; }; - cpuflpr_code_data: memory@2f890000 { - reg = <0x2f890000 DT_SIZE_K(46)>; - }; + /* + * NOTE: FLPR has a direct bridge with RAM21 that bypasses MPC. + * This means that when this region is marked as non-executable, + * only FLPR can execute code from it. + */ + ram21_region: memory@2f890000 { + compatible = "nordic,owned-memory"; + status = "disabled"; + reg = <0x2f890000 DT_SIZE_K(64)>; + nordic,access = ; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x2f890000 0x10000>; - cpuapp_cpuflpr_ipc_shm: memory@2f89b800 { - reg = <0x2f89b800 DT_SIZE_K(1)>; - }; + cpuflpr_code_data: memory@0 { + reg = <0x0 DT_SIZE_K(46)>; + }; - cpuflpr_cpuapp_ipc_shm: memory@2f89bc00 { - reg = <0x2f89bc00 DT_SIZE_K(1)>; + cpuapp_cpuflpr_ipc_shm: memory@b800 { + reg = <0xb800 DT_SIZE_K(1)>; + }; + + cpuflpr_cpuapp_ipc_shm: memory@bc00 { + reg = <0xbc00 DT_SIZE_K(1)>; + }; + + dma_fast_region: memory@c000 { + compatible = "zephyr,memory-region"; + reg = <0xc000 DT_SIZE_K(16)>; + status = "disabled"; + #memory-region-cells = <0>; + zephyr,memory-region = "DMA_RAM21"; + zephyr,memory-attr = <( DT_MEM_DMA | DT_MEM_CACHEABLE )>; + }; }; - dma_fast_region: memory@2f89c000 { - compatible = "zephyr,memory-region"; - reg = <0x2f89c000 DT_SIZE_K(16)>; + cpuppr_ram3x_region: memory@2fc00000 { + compatible = "nordic,owned-memory"; + reg = <0x2fc00000 DT_SIZE_K(64)>; status = "disabled"; - #memory-region-cells = <0>; - zephyr,memory-region = "DMA_RAM21"; - zephyr,memory-attr = <( DT_MEM_DMA | DT_MEM_CACHEABLE )>; - }; + nordic,access = ; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x2fc00000 0x10000>; - cpuppr_code_data: memory@2fc00000 { - reg = <0x2fc00000 DT_SIZE_K(62)>; - }; + cpuppr_code_data: memory@0 { + reg = <0x0 DT_SIZE_K(62)>; + }; - cpuapp_cpuppr_ipc_shm: memory@2fc0f800 { - reg = <0x2fc0f800 DT_SIZE_K(1)>; - }; + cpuapp_cpuppr_ipc_shm: memory@f800 { + reg = <0xf800 DT_SIZE_K(1)>; + }; - cpuppr_cpuapp_ipc_shm: memory@2fc0fc00 { - reg = <0x2fc0fc00 DT_SIZE_K(1)>; + cpuppr_cpuapp_ipc_shm: memory@fc00 { + reg = <0xfc00 DT_SIZE_K(1)>; + }; }; cpuapp_dma_region: memory@2fc12000 { - compatible = "zephyr,memory-region"; + compatible = "nordic,owned-memory", "zephyr,memory-region"; reg = <0x2fc12000 DT_SIZE_K(4)>; status = "disabled"; #memory-region-cells = <0>; + nordic,access = ; zephyr,memory-region = "DMA_RAM3x_APP"; zephyr,memory-attr = <( DT_MEM_DMA )>; }; cpurad_dma_region: memory@2fc13000 { - compatible = "zephyr,memory-region"; + compatible = "nordic,owned-memory", "zephyr,memory-region"; reg = <0x2fc13000 DT_SIZE_K(1)>; status = "disabled"; #memory-region-cells = <0>; + nordic,access = ; zephyr,memory-region = "DMA_RAM3x_RAD"; zephyr,memory-attr = <( DT_MEM_DMA )>; }; diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index 47255b0c9947..16c573d127e1 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -109,6 +109,18 @@ }; }; +&cpuapp_ram0x_region { + status = "okay"; +}; + +&etr_buf_ram0x_region { + status = "okay"; +}; + +&ram21_region { + status = "okay"; +}; + &cpuapp_bellboard { status = "okay"; interrupts = <96 NRF_DEFAULT_IRQ_PRIORITY>; diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_0_9_0.yaml b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_0_9_0.yaml index 4e82987d28e5..832689be8e1d 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_0_9_0.yaml +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_0_9_0.yaml @@ -9,7 +9,7 @@ toolchain: - gnuarmemb - zephyr sysbuild: true -ram: 760 +ram: 256 flash: 392 supported: - adc diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts index 5473d9a7405a..2813d5b11741 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts @@ -36,6 +36,14 @@ }; }; +&cpuapp_cpurad_ram0x_region { + status = "okay"; +}; + +&cpurad_ram0x_region { + status = "okay"; +}; + &cpurad_bellboard { status = "okay"; interrupts = <96 NRF_DEFAULT_IRQ_PRIORITY>; diff --git a/dts/vendor/nordic/nrf54h20.dtsi b/dts/vendor/nordic/nrf54h20.dtsi index 241a8206f9af..b57c718a9e2b 100644 --- a/dts/vendor/nordic/nrf54h20.dtsi +++ b/dts/vendor/nordic/nrf54h20.dtsi @@ -14,6 +14,7 @@ #include #include #include +#include #include /delete-node/ &sw_pwm; diff --git a/samples/application_development/code_relocation_nocopy/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/samples/application_development/code_relocation_nocopy/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index 98d67e2ad082..ab53f12725d7 100644 --- a/samples/application_development/code_relocation_nocopy/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/samples/application_development/code_relocation_nocopy/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -1,5 +1,10 @@ +&cpuapp_ram0x_region { + nordic,access = ; +}; + &xip_region { status = "okay"; + nordic,access = ; }; &mx25uw63 { diff --git a/samples/boards/nordic/coresight_stm/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/samples/boards/nordic/coresight_stm/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index 970377c4d896..bf5ba18d2044 100644 --- a/samples/boards/nordic/coresight_stm/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/samples/boards/nordic/coresight_stm/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -7,6 +7,10 @@ status = "okay"; }; +&cpuppr_ram3x_region { + status = "okay"; +}; + &cpuflpr_vpr { status = "okay"; }; diff --git a/snippets/nordic-ppr-xip/soc/nrf54h20_cpuapp.overlay b/snippets/nordic-ppr-xip/soc/nrf54h20_cpuapp.overlay index 2d884a3455a2..4d02921660b5 100644 --- a/snippets/nordic-ppr-xip/soc/nrf54h20_cpuapp.overlay +++ b/snippets/nordic-ppr-xip/soc/nrf54h20_cpuapp.overlay @@ -3,6 +3,10 @@ * SPDX-License-Identifier: Apache-2.0 */ +&cpuppr_ram3x_region { + status = "okay"; +}; + &cpuppr_vpr { execution-memory = <&cpuppr_code_partition>; /delete-property/ source-memory; diff --git a/snippets/nordic-ppr/soc/nrf54h20_cpuapp.overlay b/snippets/nordic-ppr/soc/nrf54h20_cpuapp.overlay index ae635c9ca9b6..75128f42a13f 100644 --- a/snippets/nordic-ppr/soc/nrf54h20_cpuapp.overlay +++ b/snippets/nordic-ppr/soc/nrf54h20_cpuapp.overlay @@ -3,6 +3,10 @@ * SPDX-License-Identifier: Apache-2.0 */ +&cpuppr_ram3x_region { + status = "okay"; +}; + &uart135 { status = "reserved"; }; diff --git a/tests/arch/common/ramfunc/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/arch/common/ramfunc/boards/nrf54h20dk_nrf54h20_cpuapp.overlay new file mode 100644 index 000000000000..ad84324a3e94 --- /dev/null +++ b/tests/arch/common/ramfunc/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -0,0 +1,8 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +&cpuapp_ram0x_region { + nordic,access = ; +}; diff --git a/tests/boards/nrf/coresight_stm/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/boards/nrf/coresight_stm/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index 970377c4d896..bf5ba18d2044 100644 --- a/tests/boards/nrf/coresight_stm/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/tests/boards/nrf/coresight_stm/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -7,6 +7,10 @@ status = "okay"; }; +&cpuppr_ram3x_region { + status = "okay"; +}; + &cpuflpr_vpr { status = "okay"; }; From d21361b95de5d440e18af47ef47cf49bfa4fd5a9 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:45 +0300 Subject: [PATCH 1152/2141] Revert "[nrf fromtree] boards: nordic: update nrf54h20dk memory map" This reverts commit 9f67617e6ecb8990d82b4836c68d70af6e729caa. Signed-off-by: Jukka Rissanen --- .../nrf54h20dk_nrf54h20-memory_map.dtsi | 22 +++++++++---------- .../nrf54h20dk_nrf54h20_cpuapp_0_9_0.yaml | 2 +- .../nrf54h20dk_nrf54h20_cpurad_0_9_0.yaml | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi index 7f568005a225..cd595d6cd5dd 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi @@ -200,16 +200,16 @@ #address-cells = <1>; #size-cells = <1>; - cpuapp_boot_partition: partition@30000 { - reg = <0x30000 DT_SIZE_K(64)>; + cpuapp_boot_partition: partition@2c000 { + reg = <0x2c000 DT_SIZE_K(64)>; }; - cpuapp_slot0_partition: partition@40000 { - reg = <0x40000 DT_SIZE_K(328)>; + cpuapp_slot0_partition: partition@3c000 { + reg = <0x3c000 DT_SIZE_K(336)>; }; - cpurad_slot0_partition: partition@92000 { - reg = <0x92000 DT_SIZE_K(328)>; + cpurad_slot0_partition: partition@90000 { + reg = <0x90000 DT_SIZE_K(336)>; }; cpuppr_code_partition: partition@e4000 { @@ -221,15 +221,15 @@ }; cpuapp_slot1_partition: partition@100000 { - reg = <0x100000 DT_SIZE_K(328)>; + reg = <0x100000 DT_SIZE_K(336)>; }; - cpurad_slot1_partition: partition@152000 { - reg = <0x152000 DT_SIZE_K(328)>; + cpurad_slot1_partition: partition@154000 { + reg = <0x154000 DT_SIZE_K(336)>; }; - storage_partition: partition@1a4000 { - reg = <0x1a4000 DT_SIZE_K(40)>; + storage_partition: partition@1a8000 { + reg = <0x1a8000 DT_SIZE_K(40)>; }; }; }; diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_0_9_0.yaml b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_0_9_0.yaml index 832689be8e1d..1884ce0a4d0d 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_0_9_0.yaml +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_0_9_0.yaml @@ -10,7 +10,7 @@ toolchain: - zephyr sysbuild: true ram: 256 -flash: 392 +flash: 296 supported: - adc - can diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_0_9_0.yaml b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_0_9_0.yaml index 8567494d1e3a..de557fcc2cdb 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_0_9_0.yaml +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_0_9_0.yaml @@ -10,7 +10,7 @@ toolchain: - zephyr sysbuild: true ram: 192 -flash: 328 +flash: 256 supported: - counter - gpio From 044606941ae6e43a55ca0472fed0ca6c96bc6216 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:45 +0300 Subject: [PATCH 1153/2141] Revert "[nrf fromtree] modules: hal_nordic: Remove nrf-regtool support for nRF54H" This reverts commit eda8866442f8461d437d881115863965d281e035. Signed-off-by: Jukka Rissanen --- modules/hal_nordic/Kconfig.nrf_regtool | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/hal_nordic/Kconfig.nrf_regtool b/modules/hal_nordic/Kconfig.nrf_regtool index 12f7a53f471c..396ec2050a05 100644 --- a/modules/hal_nordic/Kconfig.nrf_regtool +++ b/modules/hal_nordic/Kconfig.nrf_regtool @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 menu "nrf-regtool options" - depends on SOC_SERIES_NRF92X + depends on SOC_SERIES_NRF54HX || SOC_SERIES_NRF92X config NRF_REGTOOL_GENERATE_UICR bool "Generate UICR" From 43444ede1b10652b5e0a491670216c7dccfc8b51 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:45 +0300 Subject: [PATCH 1154/2141] Revert "[nrf fromtree] boards: nrf54h20dk: Limit app core FLASH_LOAD_SIZE" This reverts commit b1e4c7852981379374f30da895e3d72380706c48. Signed-off-by: Jukka Rissanen --- boards/nordic/nrf54h20dk/Kconfig.defconfig | 7 ------- 1 file changed, 7 deletions(-) diff --git a/boards/nordic/nrf54h20dk/Kconfig.defconfig b/boards/nordic/nrf54h20dk/Kconfig.defconfig index 069ed7b6eba6..1800fb1775fb 100644 --- a/boards/nordic/nrf54h20dk/Kconfig.defconfig +++ b/boards/nordic/nrf54h20dk/Kconfig.defconfig @@ -22,13 +22,6 @@ if !USE_DT_CODE_PARTITION config FLASH_LOAD_OFFSET default $(dt_nodelabel_reg_addr_hex,cpuapp_boot_partition) -# This is meant to span 'cpuapp_boot_partition' and 'cpuapp_slot0_partition' -# in the default memory map. -config FLASH_LOAD_SIZE - default $(add_hex, $(dt_nodelabel_reg_addr_hex,cpuapp_slot0_partition), \ - $(dt_nodelabel_reg_size_hex,cpuapp_slot0_partition), \ - -$(dt_nodelabel_reg_addr_hex,cpuapp_boot_partition)) - endif # !USE_DT_CODE_PARTITION endif # BOARD_NRF54H20DK_NRF54H20_CPUAPP From a763064662e63938603b7a228a966e13630808b4 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:45 +0300 Subject: [PATCH 1155/2141] Revert "[nrf fromtree] boards: nrf54h20dk: Merge iron variants into the base variants" This reverts commit 738229c484b65c98a33b991daa0436bc7469b443. Signed-off-by: Jukka Rissanen --- boards/nordic/nrf54h20dk/Kconfig.defconfig | 28 ++--- boards/nordic/nrf54h20dk/Kconfig.nrf54h20dk | 8 +- boards/nordic/nrf54h20dk/board.cmake | 7 +- boards/nordic/nrf54h20dk/board.yml | 4 + .../nrf54h20dk_nrf54h20-ipc_conf.dtsi | 8 +- .../nrf54h20dk_nrf54h20-ipc_conf_iron.dtsi | 30 +++++ .../nrf54h20dk_nrf54h20-memory_map.dtsi | 98 +++++++++-------- .../nrf54h20dk_nrf54h20-memory_map_iron.dtsi | 104 ++++++++++++++++++ .../nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 27 ++--- .../nrf54h20dk_nrf54h20_cpuapp_defconfig | 2 + .../nrf54h20dk_nrf54h20_cpuapp_iron.dts | 45 ++++++++ ...nrf54h20dk_nrf54h20_cpuapp_iron_0_9_0.yaml | 25 +++++ .../nrf54h20dk_nrf54h20_cpuapp_iron_defconfig | 26 +++++ .../nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts | 11 +- .../nrf54h20dk_nrf54h20_cpurad_iron.dts | 29 +++++ ...nrf54h20dk_nrf54h20_cpurad_iron_0_9_0.yaml | 20 ++++ .../nrf54h20dk_nrf54h20_cpurad_iron_defconfig | 25 +++++ dts/vendor/nordic/nrf54h20.dtsi | 4 + .../nordic/nrf_ironside/update/README.rst | 6 +- .../nordic/nrf_ironside/update/sample.yaml | 4 +- .../nrf54h20dk_nrf54h20_cpuapp_iron.overlay | 3 + samples/drivers/mbox/sample.yaml | 1 - .../nrf54h20dk_nrf54h20_cpuapp_iron.overlay | 8 ++ .../subsys/mgmt/mcumgr/smp_svr/sample.yaml | 2 +- .../nrf54h20dk_nrf54h20_cpuapp_iron.conf | 4 + samples/sysbuild/hello_world/sample.yaml | 10 +- .../nrf54h20dk_nrf54h20_cpurad_iron.conf | 1 + scripts/west_commands/runners/nrf_common.py | 6 +- soc/nordic/ironside/Kconfig | 4 +- soc/nordic/nrf54h/Kconfig | 4 +- .../nrf54h/Kconfig.defconfig.nrf54h20_cpuapp | 3 + .../nrf54h/Kconfig.defconfig.nrf54h20_cpurad | 3 + soc/nordic/nrf54h/Kconfig.soc | 5 + tests/boards/nrf/nrfs/prj.conf | 2 - .../nrf54h20dk_nrf54h20_cpuapp_iron.overlay | 6 + .../nrf54h20dk_nrf54h20_cpuapp_iron.conf | 2 + .../nrf54h20dk_nrf54h20_cpuapp_iron.overlay | 8 ++ tests/subsys/ipc/ipc_sessions/testcase.yaml | 1 - 38 files changed, 469 insertions(+), 115 deletions(-) create mode 100644 boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf_iron.dtsi create mode 100644 boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map_iron.dtsi create mode 100644 boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_iron.dts create mode 100644 boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_iron_0_9_0.yaml create mode 100644 boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_iron_defconfig create mode 100644 boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_iron.dts create mode 100644 boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_iron_0_9_0.yaml create mode 100644 boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_iron_defconfig create mode 100644 samples/drivers/counter/alarm/boards/nrf54h20dk_nrf54h20_cpuapp_iron.overlay create mode 100644 samples/drivers/watchdog/boards/nrf54h20dk_nrf54h20_cpuapp_iron.overlay create mode 100644 samples/sysbuild/hello_world/boards/nrf54h20dk_nrf54h20_cpuapp_iron.conf create mode 100644 samples/sysbuild/hello_world/sysbuild/nrf54h20dk_nrf54h20_cpurad_iron.conf create mode 100644 tests/drivers/adc/adc_api/boards/nrf54h20dk_nrf54h20_cpuapp_iron.overlay create mode 100644 tests/drivers/watchdog/wdt_basic_api/boards/nrf54h20dk_nrf54h20_cpuapp_iron.conf create mode 100644 tests/drivers/watchdog/wdt_basic_api/boards/nrf54h20dk_nrf54h20_cpuapp_iron.overlay diff --git a/boards/nordic/nrf54h20dk/Kconfig.defconfig b/boards/nordic/nrf54h20dk/Kconfig.defconfig index 1800fb1775fb..3a6ba6b6d263 100644 --- a/boards/nordic/nrf54h20dk/Kconfig.defconfig +++ b/boards/nordic/nrf54h20dk/Kconfig.defconfig @@ -12,18 +12,6 @@ config BT_HCI_IPC config MAX_THREAD_BYTES default 3 if USERSPACE -config ROM_START_OFFSET - default 0x800 if BOOTLOADER_MCUBOOT - -if !USE_DT_CODE_PARTITION - -# Application core firmware must start at this offset when not using MCUboot. -# However, the default 'zephyr,code-partition' in DT is set for MCUboot. -config FLASH_LOAD_OFFSET - default $(dt_nodelabel_reg_addr_hex,cpuapp_boot_partition) - -endif # !USE_DT_CODE_PARTITION - endif # BOARD_NRF54H20DK_NRF54H20_CPUAPP if BOARD_NRF54H20DK_NRF54H20_CPURAD @@ -31,7 +19,21 @@ if BOARD_NRF54H20DK_NRF54H20_CPURAD config MAX_THREAD_BYTES default 3 if USERSPACE +endif # BOARD_NRF54H20DK_NRF54H20_CPURAD + +if BOARD_NRF54H20DK_NRF54H20_CPUAPP_IRON + config ROM_START_OFFSET default 0x800 if BOOTLOADER_MCUBOOT -endif # BOARD_NRF54H20DK_NRF54H20_CPURAD +config FLASH_LOAD_OFFSET + default 0x2c000 if !USE_DT_CODE_PARTITION + +endif # BOARD_NRF54H20DK_NRF54H20_CPUAPP_IRON + +if BOARD_NRF54H20DK_NRF54H20_CPURAD_IRON + +config ROM_START_OFFSET + default 0x800 if BOOTLOADER_MCUBOOT + +endif # BOARD_NRF54H20DK_NRF54H20_CPURAD_IRON diff --git a/boards/nordic/nrf54h20dk/Kconfig.nrf54h20dk b/boards/nordic/nrf54h20dk/Kconfig.nrf54h20dk index 62ad7a0d21c1..c509f968db6d 100644 --- a/boards/nordic/nrf54h20dk/Kconfig.nrf54h20dk +++ b/boards/nordic/nrf54h20dk/Kconfig.nrf54h20dk @@ -2,9 +2,13 @@ # SPDX-License-Identifier: Apache-2.0 config BOARD_NRF54H20DK - select SOC_NRF54H20_CPUAPP if BOARD_NRF54H20DK_NRF54H20_CPUAPP - select SOC_NRF54H20_CPURAD if BOARD_NRF54H20DK_NRF54H20_CPURAD + select SOC_NRF54H20_CPUAPP if (BOARD_NRF54H20DK_NRF54H20_CPUAPP || \ + BOARD_NRF54H20DK_NRF54H20_CPUAPP_IRON) + select SOC_NRF54H20_CPURAD if (BOARD_NRF54H20DK_NRF54H20_CPURAD || \ + BOARD_NRF54H20DK_NRF54H20_CPURAD_IRON) select SOC_NRF54H20_CPUPPR if (BOARD_NRF54H20DK_NRF54H20_CPUPPR || \ BOARD_NRF54H20DK_NRF54H20_CPUPPR_XIP) select SOC_NRF54H20_CPUFLPR if (BOARD_NRF54H20DK_NRF54H20_CPUFLPR || \ BOARD_NRF54H20DK_NRF54H20_CPUFLPR_XIP) + select SOC_NRF54H20_IRON if (BOARD_NRF54H20DK_NRF54H20_CPUAPP_IRON || \ + BOARD_NRF54H20DK_NRF54H20_CPURAD_IRON) diff --git a/boards/nordic/nrf54h20dk/board.cmake b/boards/nordic/nrf54h20dk/board.cmake index b9383042b0c7..093155e93222 100644 --- a/boards/nordic/nrf54h20dk/board.cmake +++ b/boards/nordic/nrf54h20dk/board.cmake @@ -2,7 +2,10 @@ include(${ZEPHYR_BASE}/boards/common/nrfutil.board.cmake) -if(CONFIG_BOARD_NRF54H20DK_NRF54H20_CPUAPP OR CONFIG_BOARD_NRF54H20DK_NRF54H20_CPURAD) +if(CONFIG_BOARD_NRF54H20DK_NRF54H20_CPUAPP OR + CONFIG_BOARD_NRF54H20DK_NRF54H20_CPURAD OR + CONFIG_BOARD_NRF54H20DK_NRF54H20_CPUAPP_IRON OR + CONFIG_BOARD_NRF54H20DK_NRF54H20_CPURAD_IRON) if(CONFIG_SOC_NRF54H20_CPUAPP) set(JLINKSCRIPTFILE ${CMAKE_CURRENT_LIST_DIR}/support/nrf54h20_cpuapp.JLinkScript) else() @@ -14,7 +17,7 @@ if(CONFIG_BOARD_NRF54H20DK_NRF54H20_CPUAPP OR CONFIG_BOARD_NRF54H20DK_NRF54H20_C endif() if(CONFIG_BOARD_NRF54H20DK_NRF54H20_CPUPPR OR CONFIG_BOARD_NRF54H20DK_NRF54H20_CPUFLPR) - if(CONFIG_SOC_NRF54H20_CPUPPR) + if(CONFIG_BOARD_NRF54H20DK_NRF54H20_CPUPPR) set(JLINKSCRIPTFILE ${CMAKE_CURRENT_LIST_DIR}/support/nrf54h20_cpuppr.JLinkScript) else() set(JLINKSCRIPTFILE ${CMAKE_CURRENT_LIST_DIR}/support/nrf54h20_cpuflpr.JLinkScript) diff --git a/boards/nordic/nrf54h20dk/board.yml b/boards/nordic/nrf54h20dk/board.yml index 2d3d40c20e0b..a54cf1ae549f 100644 --- a/boards/nordic/nrf54h20dk/board.yml +++ b/boards/nordic/nrf54h20dk/board.yml @@ -9,6 +9,10 @@ board: cpucluster: cpuppr - name: xip cpucluster: cpuflpr + - name: iron + cpucluster: cpuapp + - name: iron + cpucluster: cpurad revision: format: major.minor.patch default: "0.9.0" diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf.dtsi b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf.dtsi index f31d909b6f94..94cda5e8ee2e 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf.dtsi +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf.dtsi @@ -7,17 +7,17 @@ / { ipc { cpusec_cpuapp_ipc: ipc-1-2 { - compatible = "nordic,ironside-call"; + compatible = "zephyr,ipc-icmsg"; status = "disabled"; - memory-region = <&cpusec_cpuapp_ipc_shm>; + dcache-alignment = <32>; mboxes = <&cpusec_bellboard 12>, <&cpuapp_bellboard 0>; }; cpusec_cpurad_ipc: ipc-1-3 { - compatible = "nordic,ironside-call"; + compatible = "zephyr,ipc-icmsg"; status = "disabled"; - memory-region = <&cpusec_cpurad_ipc_shm>; + dcache-alignment = <32>; mboxes = <&cpusec_bellboard 18>, <&cpurad_bellboard 0>; }; diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf_iron.dtsi b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf_iron.dtsi new file mode 100644 index 000000000000..a44db40538d2 --- /dev/null +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf_iron.dtsi @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* This file is to be merged with the original ipc_conf.dtsi in the future. */ + +/ { + ipc { + /delete-node/ ipc-1-2; + /delete-node/ ipc-1-3; + + cpusec_cpuapp_ipc: ipc-1-2 { + compatible = "nordic,ironside-call"; + memory-region = <&cpusec_cpuapp_ipc_shm>; + mboxes = <&cpusec_bellboard 12>, + <&cpuapp_bellboard 0>; + status = "disabled"; + }; + + cpusec_cpurad_ipc: ipc-1-3 { + compatible = "nordic,ironside-call"; + memory-region = <&cpusec_cpurad_ipc_shm>; + mboxes = <&cpusec_bellboard 18>, + <&cpurad_bellboard 0>; + status = "disabled"; + }; + }; +}; diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi index cd595d6cd5dd..f29374025540 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi @@ -16,6 +16,14 @@ #size-cells = <1>; ranges = <0x0 0x2f010000 0x41000>; + cpusec_cpuapp_ipc_shm: memory@0 { + reg = <0x0 DT_SIZE_K(2)>; + }; + + cpuapp_cpusec_ipc_shm: memory@800 { + reg = <0x800 DT_SIZE_K(2)>; + }; + cpuapp_data: memory@1000 { reg = <0x1000 DT_SIZE_K(256)>; }; @@ -29,6 +37,14 @@ #address-cells = <1>; #size-cells = <1>; ranges = <0x0 0x2f051000 0x1000>; + + cpusec_cpurad_ipc_shm: memory@0 { + reg = <0x0 DT_SIZE_K(2)>; + }; + + cpurad_cpusec_ipc_shm: memory@800 { + reg = <0x800 DT_SIZE_K(2)>; + }; }; etr_buf_ram0x_region: memory@2f0be000 { @@ -65,44 +81,20 @@ }; }; - cpuapp_cpusys_ipc_shm: memory@2f88f600 { - reg = <0x2f88f600 0x80>; - }; - - cpusys_cpuapp_ipc_shm: memory@2f88f680 { - reg = <0x2f88f680 0x80>; - }; - - cpurad_cpusys_ipc_shm: memory@2f88f700 { - reg = <0x2f88f700 0x80>; + cpuapp_cpusys_ipc_shm: memory@2f88fce0 { + reg = <0x2f88fce0 0x80>; }; - cpusys_cpurad_ipc_shm: memory@2f88f780 { - reg = <0x2f88f780 0x80>; + cpusys_cpuapp_ipc_shm: memory@2f88fd60 { + reg = <0x2f88fd60 0x80>; }; - cpusec_cpurad_ipc_shm: memory@2f88f800 { - reg = <0x2f88f800 0x80>; + cpurad_cpusys_ipc_shm: memory@2f88fe00 { + reg = <0x2f88fe00 0x80>; }; - cpurad_ironside_se_event_report: memory@2f88f880 { - reg = <0x2f88f880 0x100>; - }; - - cpurad_ironside_se_boot_report: memory@2f88f980 { - reg = <0x2f88f980 0x200>; - }; - - cpusec_cpuapp_ipc_shm: memory@2f88fb80 { - reg = <0x2f88fb80 0x80>; - }; - - cpuapp_ironside_se_event_report: memory@2f88fc00 { - reg = <0x2f88fc00 0x100>; - }; - - cpuapp_ironside_se_boot_report: memory@2f88fd00 { - reg = <0x2f88fd00 0x200>; + cpusys_cpurad_ipc_shm: memory@2f88fe80 { + reg = <0x2f88fe80 0x80>; }; /* @@ -195,21 +187,27 @@ }; &mram1x { - partitions { - compatible = "fixed-partitions"; + cpurad_rx_partitions: cpurad-rx-partitions { + compatible = "nordic,owned-partitions", "fixed-partitions"; + status = "disabled"; + nordic,access = ; #address-cells = <1>; #size-cells = <1>; - cpuapp_boot_partition: partition@2c000 { - reg = <0x2c000 DT_SIZE_K(64)>; + cpurad_slot0_partition: partition@54000 { + reg = <0x54000 DT_SIZE_K(256)>; }; + }; - cpuapp_slot0_partition: partition@3c000 { - reg = <0x3c000 DT_SIZE_K(336)>; - }; + cpuapp_rx_partitions: cpuapp-rx-partitions { + compatible = "nordic,owned-partitions", "fixed-partitions"; + status = "disabled"; + nordic,access = ; + #address-cells = <1>; + #size-cells = <1>; - cpurad_slot0_partition: partition@90000 { - reg = <0x90000 DT_SIZE_K(336)>; + cpuapp_slot0_partition: partition@94000 { + reg = <0x94000 DT_SIZE_K(320)>; }; cpuppr_code_partition: partition@e4000 { @@ -219,17 +217,21 @@ cpuflpr_code_partition: partition@f4000 { reg = <0xf4000 DT_SIZE_K(48)>; }; + }; - cpuapp_slot1_partition: partition@100000 { - reg = <0x100000 DT_SIZE_K(336)>; - }; + cpuapp_rw_partitions: cpuapp-rw-partitions { + compatible = "nordic,owned-partitions", "fixed-partitions"; + status = "disabled"; + nordic,access = ; + #address-cells = <1>; + #size-cells = <1>; - cpurad_slot1_partition: partition@154000 { - reg = <0x154000 DT_SIZE_K(336)>; + dfu_partition: partition@100000 { + reg = < 0x100000 DT_SIZE_K(908) >; }; - storage_partition: partition@1a8000 { - reg = <0x1a8000 DT_SIZE_K(40)>; + storage_partition: partition@1e3000 { + reg = < 0x1e3000 DT_SIZE_K(40) >; }; }; }; diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map_iron.dtsi b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map_iron.dtsi new file mode 100644 index 000000000000..2977e83758b4 --- /dev/null +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map_iron.dtsi @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* This file is to be merged with the original memory_map.dtsi in the future. + * The following nodes will be replaced: + */ +/delete-node/ &cpuapp_cpusec_ipc_shm; +/delete-node/ &cpuapp_cpusys_ipc_shm; +/delete-node/ &cpurad_cpusec_ipc_shm; +/delete-node/ &cpurad_cpusys_ipc_shm; +/delete-node/ &cpusec_cpuapp_ipc_shm; +/delete-node/ &cpusec_cpurad_ipc_shm; +/delete-node/ &cpusys_cpuapp_ipc_shm; +/delete-node/ &cpusys_cpurad_ipc_shm; +/delete-node/ &cpuapp_rw_partitions; +/delete-node/ &cpuapp_rx_partitions; +/delete-node/ &cpurad_rx_partitions; + +/ { + reserved-memory { + cpuapp_cpusys_ipc_shm: memory@2f88f600 { + reg = <0x2f88f600 0x80>; + }; + + cpusys_cpuapp_ipc_shm: memory@2f88f680 { + reg = <0x2f88f680 0x80>; + }; + + cpurad_cpusys_ipc_shm: memory@2f88f700 { + reg = <0x2f88f700 0x80>; + }; + + cpusys_cpurad_ipc_shm: memory@2f88f780 { + reg = <0x2f88f780 0x80>; + }; + + cpusec_cpurad_ipc_shm: memory@2f88f800 { + reg = <0x2f88f800 0x80>; + }; + + cpurad_ironside_se_event_report: memory@2f88f880 { + reg = <0x2f88f880 0x100>; + }; + + cpurad_ironside_se_boot_report: memory@2f88f980 { + reg = <0x2f88f980 0x200>; + }; + + cpusec_cpuapp_ipc_shm: memory@2f88fb80 { + reg = <0x2f88fb80 0x80>; + }; + + cpuapp_ironside_se_event_report: memory@2f88fc00 { + reg = <0x2f88fc00 0x100>; + }; + + cpuapp_ironside_se_boot_report: memory@2f88fd00 { + reg = <0x2f88fd00 0x200>; + }; + }; +}; + +&mram1x { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + cpuapp_boot_partition: partition@2c000 { + reg = <0x2c000 DT_SIZE_K(64)>; + }; + + cpuapp_slot0_partition: partition@3c000 { + reg = <0x3c000 DT_SIZE_K(336)>; + }; + + cpurad_slot0_partition: partition@90000 { + reg = <0x90000 DT_SIZE_K(336)>; + }; + + cpuppr_code_partition: partition@e4000 { + reg = <0xe4000 DT_SIZE_K(64)>; + }; + + cpuflpr_code_partition: partition@f4000 { + reg = <0xf4000 DT_SIZE_K(48)>; + }; + + cpuapp_slot1_partition: partition@100000 { + reg = <0x100000 DT_SIZE_K(336)>; + }; + + cpurad_slot1_partition: partition@154000 { + reg = <0x154000 DT_SIZE_K(336)>; + }; + + storage_partition: partition@1a8000 { + reg = <0x1a8000 DT_SIZE_K(40)>; + }; + }; +}; diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index 16c573d127e1..9cbc9035d4f8 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -18,11 +18,10 @@ chosen { zephyr,console = &uart136; - zephyr,code-partition = &slot0_partition; + zephyr,code-partition = &cpuapp_slot0_partition; zephyr,flash = &mram1x; zephyr,sram = &cpuapp_data; zephyr,shell-uart = &uart136; - zephyr,uart-mcumgr = &uart136; zephyr,ieee802154 = &cpuapp_ieee802154; zephyr,bt-hci = &bt_hci_ipc0; nordic,802154-spinel-ipc = &ipc0; @@ -146,6 +145,8 @@ &cpusec_cpuapp_ipc { status = "okay"; mbox-names = "tx", "rx"; + tx-region = <&cpuapp_cpusec_ipc_shm>; + rx-region = <&cpusec_cpuapp_ipc_shm>; }; &cpusec_bellboard { @@ -189,26 +190,12 @@ ipc0: &cpuapp_cpurad_ipc { status = "okay"; }; -ironside_se_boot_report: &cpuapp_ironside_se_boot_report {}; - -boot_partition: &cpuapp_boot_partition { - label = "mcuboot"; -}; - -slot0_partition: &cpuapp_slot0_partition { - label = "image-0"; -}; - -slot1_partition: &cpuapp_slot1_partition { - label = "image-1"; -}; - -slot2_partition: &cpurad_slot0_partition { - label = "image-2"; +&cpuapp_rx_partitions { + status = "okay"; }; -slot3_partition: &cpurad_slot1_partition { - label = "image-3"; +&cpuapp_rw_partitions { + status = "okay"; }; &cpuppr_vpr { diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_defconfig b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_defconfig index 5b27932f7855..d3ce90b8a380 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_defconfig +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_defconfig @@ -8,6 +8,8 @@ CONFIG_SERIAL=y CONFIG_CONSOLE=y CONFIG_UART_CONSOLE=y +CONFIG_USE_DT_CODE_PARTITION=y + # Enable MPU CONFIG_ARM_MPU=y diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_iron.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_iron.dts new file mode 100644 index 000000000000..e822cf2c9119 --- /dev/null +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_iron.dts @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "nrf54h20dk_nrf54h20_cpuapp.dts" +#include "nrf54h20dk_nrf54h20-ipc_conf_iron.dtsi" +#include "nrf54h20dk_nrf54h20-memory_map_iron.dtsi" + +/delete-node/ &cpusec_cpurad_ipc; + +/ { + chosen { + zephyr,code-partition = &slot0_partition; + zephyr,uart-mcumgr = &uart136; + }; +}; + +&cpusec_cpuapp_ipc { + mbox-names = "tx", "rx"; + status = "okay"; +}; + +ironside_se_boot_report: &cpuapp_ironside_se_boot_report {}; + +boot_partition: &cpuapp_boot_partition { + label = "mcuboot"; +}; + +slot0_partition: &cpuapp_slot0_partition { + label = "image-0"; +}; + +slot1_partition: &cpuapp_slot1_partition { + label = "image-1"; +}; + +slot2_partition: &cpurad_slot0_partition { + label = "image-2"; +}; + +slot3_partition: &cpurad_slot1_partition { + label = "image-3"; +}; diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_iron_0_9_0.yaml b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_iron_0_9_0.yaml new file mode 100644 index 000000000000..563a8b4ac1b7 --- /dev/null +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_iron_0_9_0.yaml @@ -0,0 +1,25 @@ +# Copyright (c) 2025 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +identifier: nrf54h20dk/nrf54h20/cpuapp/iron +name: nRF54H20-DK-nRF54H20-Application (IronSide compatible) (revision 0.9.0) +type: mcu +arch: arm +toolchain: + - gnuarmemb + - xtools + - zephyr +sysbuild: true +ram: 256 +flash: 480 +supported: + - adc + - can + - counter + - gpio + - i2c + - pwm + - retained_mem + - spi + - watchdog + - usbd diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_iron_defconfig b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_iron_defconfig new file mode 100644 index 000000000000..bf3b6ac01e47 --- /dev/null +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_iron_defconfig @@ -0,0 +1,26 @@ +# Copyright (c) 2025 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +# Enable UART driver +CONFIG_SERIAL=y + +# Enable console +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y + +# Enable MPU +CONFIG_ARM_MPU=y + +# MPU-based null-pointer dereferencing detection cannot be applied +# as the (0x0 - 0x400) region is unmapped for this target. +CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y + +# Enable cache +CONFIG_CACHE_MANAGEMENT=y +CONFIG_EXTERNAL_CACHE=y + +# Enable GPIO +CONFIG_GPIO=y + +# UICR generation is not supported, and when reintroduced will not use nrf-regtool. +CONFIG_NRF_REGTOOL_GENERATE_UICR=n diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts index 2813d5b11741..ebeb2aeeafff 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts @@ -24,7 +24,6 @@ zephyr,flash = &mram1x; zephyr,sram = &cpurad_ram0; zephyr,shell-uart = &uart135; - zephyr,uart-mcumgr = &uart135; zephyr,ieee802154 = &cpurad_ieee802154; zephyr,bt-hci-ipc = &ipc0; nordic,802154-spinel-ipc = &ipc0; @@ -63,6 +62,8 @@ &cpusec_cpurad_ipc { status = "okay"; mbox-names = "tx", "rx"; + tx-region = <&cpurad_cpusec_ipc_shm>; + rx-region = <&cpusec_cpurad_ipc_shm>; }; &cpusec_bellboard { @@ -89,12 +90,8 @@ ipc0: &cpuapp_cpurad_ipc { status = "okay"; }; -slot0_partition: &cpurad_slot0_partition { - label = "image-0"; -}; - -slot1_partition: &cpurad_slot1_partition { - label = "image-1"; +&cpurad_rx_partitions { + status = "okay"; }; &grtc { diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_iron.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_iron.dts new file mode 100644 index 000000000000..16b599f554e4 --- /dev/null +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_iron.dts @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "nrf54h20dk_nrf54h20_cpurad.dts" +#include "nrf54h20dk_nrf54h20-ipc_conf_iron.dtsi" +#include "nrf54h20dk_nrf54h20-memory_map_iron.dtsi" + +/ { + chosen { + zephyr,code-partition = &cpurad_slot0_partition; + zephyr,uart-mcumgr = &uart135; + }; +}; + +&cpusec_cpurad_ipc { + mbox-names = "tx", "rx"; + status = "okay"; +}; + +slot0_partition: &cpurad_slot0_partition { + label = "image-0"; +}; + +slot1_partition: &cpurad_slot1_partition { + label = "image-1"; +}; diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_iron_0_9_0.yaml b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_iron_0_9_0.yaml new file mode 100644 index 000000000000..034b9f7e27dd --- /dev/null +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_iron_0_9_0.yaml @@ -0,0 +1,20 @@ +# Copyright (c) 2025 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +identifier: nrf54h20dk/nrf54h20/cpurad/iron +name: nRF54H20-DK-nRF54H20-Radio (IronSide SE compatible) (revision 0.9.0) +type: mcu +arch: arm +toolchain: + - gnuarmemb + - xtools + - zephyr +sysbuild: true +ram: 192 +flash: 336 +supported: + - counter + - gpio + - pwm + - retained_mem + - spi diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_iron_defconfig b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_iron_defconfig new file mode 100644 index 000000000000..4d247d805269 --- /dev/null +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_iron_defconfig @@ -0,0 +1,25 @@ +# Copyright (c) 2025 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +# Enable UART driver +CONFIG_SERIAL=y + +# Enable console +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y + +CONFIG_USE_DT_CODE_PARTITION=y + +# Enable MPU +CONFIG_ARM_MPU=y + +# MPU-based null-pointer dereferencing detection cannot be applied +# as the (0x0 - 0x400) region is unmapped for this target. +CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y + +# Enable cache +CONFIG_CACHE_MANAGEMENT=y +CONFIG_EXTERNAL_CACHE=y + +# UICR generation is not supported, and when reintroduced will not use nrf-regtool. +CONFIG_NRF_REGTOOL_GENERATE_UICR=n diff --git a/dts/vendor/nordic/nrf54h20.dtsi b/dts/vendor/nordic/nrf54h20.dtsi index b57c718a9e2b..c72fedef84a6 100644 --- a/dts/vendor/nordic/nrf54h20.dtsi +++ b/dts/vendor/nordic/nrf54h20.dtsi @@ -152,6 +152,10 @@ reserved-memory { #address-cells = <1>; #size-cells = <1>; + + suit_storage_partition: memory@e1ed000 { + reg = <0xe1ed000 DT_SIZE_K(20)>; + }; }; clocks { diff --git a/samples/boards/nordic/nrf_ironside/update/README.rst b/samples/boards/nordic/nrf_ironside/update/README.rst index 484d97d0adda..af72d23f3917 100644 --- a/samples/boards/nordic/nrf_ironside/update/README.rst +++ b/samples/boards/nordic/nrf_ironside/update/README.rst @@ -25,8 +25,8 @@ The update procedure works as follows: Once the operation has completed, you can read the boot report to verify that the update has taken place. -Building and running the application for nrf54h20dk/nrf54h20/cpuapp -******************************************************************* +Building and running the application for nrf54h20dk/nrf54h20/cpuapp/iron +************************************************************************ .. note:: You can use this application only when there is already a version of IronSide SE installed on the device. @@ -55,7 +55,7 @@ Building and running the application for nrf54h20dk/nrf54h20/cpuapp .. zephyr-app-commands:: :zephyr-app: samples/boards/nordic/nrf_ironside/update - :board: nrf54h20dk/nrf54h20/cpuapp + :board: nrf54h20dk/nrf54h20/cpuapp/iron :goals: flash #. Trigger a reset: diff --git a/samples/boards/nordic/nrf_ironside/update/sample.yaml b/samples/boards/nordic/nrf_ironside/update/sample.yaml index 3a5d9477da2f..cc127d9eb6dd 100644 --- a/samples/boards/nordic/nrf_ironside/update/sample.yaml +++ b/samples/boards/nordic/nrf_ironside/update/sample.yaml @@ -5,8 +5,8 @@ common: build_only: true tags: nrf_ironside integration_platforms: - - nrf54h20dk/nrf54h20/cpuapp + - nrf54h20dk/nrf54h20/cpuapp/iron tests: sample.boards.nordic.nrf_ironside.update: - platform_allow: nrf54h20dk/nrf54h20/cpuapp + platform_allow: nrf54h20dk/nrf54h20/cpuapp/iron diff --git a/samples/drivers/counter/alarm/boards/nrf54h20dk_nrf54h20_cpuapp_iron.overlay b/samples/drivers/counter/alarm/boards/nrf54h20dk_nrf54h20_cpuapp_iron.overlay new file mode 100644 index 000000000000..f65b4dd3b0ba --- /dev/null +++ b/samples/drivers/counter/alarm/boards/nrf54h20dk_nrf54h20_cpuapp_iron.overlay @@ -0,0 +1,3 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +#include "nrf54h20dk_nrf54h20_common.dtsi" diff --git a/samples/drivers/mbox/sample.yaml b/samples/drivers/mbox/sample.yaml index c18533c2c180..8a25dc0b3bf7 100644 --- a/samples/drivers/mbox/sample.yaml +++ b/samples/drivers/mbox/sample.yaml @@ -65,7 +65,6 @@ tests: integration_platforms: - nrf54h20dk/nrf54h20/cpuapp extra_args: - - mbox_CONFIG_SOC_NRF54H20_CPURAD_ENABLE=y - SB_CONF_FILE=sysbuild/nrf54h20dk_nrf54h20_cpurad.conf sysbuild: true harness: console diff --git a/samples/drivers/watchdog/boards/nrf54h20dk_nrf54h20_cpuapp_iron.overlay b/samples/drivers/watchdog/boards/nrf54h20dk_nrf54h20_cpuapp_iron.overlay new file mode 100644 index 000000000000..102abfc8ef27 --- /dev/null +++ b/samples/drivers/watchdog/boards/nrf54h20dk_nrf54h20_cpuapp_iron.overlay @@ -0,0 +1,8 @@ +/* + * Copyright 2025 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +&wdt010 { + status = "okay"; +}; diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml b/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml index fd6194cdc4f1..8ede9b77d07b 100644 --- a/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml +++ b/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml @@ -88,7 +88,7 @@ tests: - mimxrt685_evk/mimxrt685s/cm33 - rd_rw612_bga - nrf52840dk/nrf52840 - - nrf54h20dk/nrf54h20/cpuapp + - nrf54h20dk/nrf54h20/cpuapp/iron - pinnacle_100_dvk - mg100 integration_platforms: diff --git a/samples/sysbuild/hello_world/boards/nrf54h20dk_nrf54h20_cpuapp_iron.conf b/samples/sysbuild/hello_world/boards/nrf54h20dk_nrf54h20_cpuapp_iron.conf new file mode 100644 index 000000000000..ca2bc07e4f29 --- /dev/null +++ b/samples/sysbuild/hello_world/boards/nrf54h20dk_nrf54h20_cpuapp_iron.conf @@ -0,0 +1,4 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_SOC_NRF54H20_CPURAD_ENABLE=y diff --git a/samples/sysbuild/hello_world/sample.yaml b/samples/sysbuild/hello_world/sample.yaml index e638594c634e..c8ca9cbe4c0d 100644 --- a/samples/sysbuild/hello_world/sample.yaml +++ b/samples/sysbuild/hello_world/sample.yaml @@ -25,9 +25,13 @@ tests: - nrf54h20dk/nrf54h20/cpuapp integration_platforms: - nrf54h20dk/nrf54h20/cpuapp - extra_args: - - SB_CONF_FILE=sysbuild/nrf54h20dk_nrf54h20_cpurad.conf - - hello_world_CONFIG_SOC_NRF54H20_CPURAD_ENABLE=y + extra_args: SB_CONF_FILE=sysbuild/nrf54h20dk_nrf54h20_cpurad.conf + + sample.sysbuild.hello_world.nrf54h20dk_cpuapp_cpurad.iron: + platform_allow: + - nrf54h20dk/nrf54h20/cpuapp/iron + extra_args: SB_CONF_FILE=sysbuild/nrf54h20dk_nrf54h20_cpurad_iron.conf + sample.sysbuild.hello_world.nrf54h20dk_cpuapp_cpuppr: platform_allow: - nrf54h20dk/nrf54h20/cpuapp diff --git a/samples/sysbuild/hello_world/sysbuild/nrf54h20dk_nrf54h20_cpurad_iron.conf b/samples/sysbuild/hello_world/sysbuild/nrf54h20dk_nrf54h20_cpurad_iron.conf new file mode 100644 index 000000000000..8d4a230adbe1 --- /dev/null +++ b/samples/sysbuild/hello_world/sysbuild/nrf54h20dk_nrf54h20_cpurad_iron.conf @@ -0,0 +1 @@ +SB_CONFIG_REMOTE_BOARD="nrf54h20dk/nrf54h20/cpurad/iron" diff --git a/scripts/west_commands/runners/nrf_common.py b/scripts/west_commands/runners/nrf_common.py index e08186537720..a6af477c61a9 100644 --- a/scripts/west_commands/runners/nrf_common.py +++ b/scripts/west_commands/runners/nrf_common.py @@ -379,7 +379,7 @@ def program_hex(self): ) if self.erase: - if self.family == 'nrf54h': + if self.build_conf.get('CONFIG_SOC_NRF54H20_IRON'): self.exec_op('erase', kind='all') else: self.exec_op('erase', core='Application', kind='all') @@ -464,8 +464,8 @@ def program_hex(self): self.logger.debug(f'Erase modes: chip:{erase_arg} ext_mem:' f'{ext_mem_erase_opt}') - # Temp hack while waiting for nrfutil Network support for NRF54H20 with IronSide - if self.family == 'nrf54h' and core == 'Network': + # Temp hack while waiting for NRF54H20_IRON support for Network in nrfutil + if self.build_conf.get('CONFIG_SOC_NRF54H20_IRON') and core == "Network": core = "Application" self.op_program(self.hex_, erase_arg, ext_mem_erase_opt, defer=True, core=core) diff --git a/soc/nordic/ironside/Kconfig b/soc/nordic/ironside/Kconfig index a9e68bba0b28..8a91adf8ed0e 100644 --- a/soc/nordic/ironside/Kconfig +++ b/soc/nordic/ironside/Kconfig @@ -3,7 +3,7 @@ config NRF_IRONSIDE bool - depends on SOC_NRF54H20 || SOC_NRF9280_IRON + depends on SOC_NRF54H20_IRON || SOC_NRF9280_IRON help This is selected by drivers interacting with Nordic IronSide firmware. @@ -28,7 +28,7 @@ config NRF_IRONSIDE_CALL_INIT_PRIORITY endif # NRF_IRONSIDE_CALL menu "Nordic IronSide services" - depends on SOC_NRF54H20 || SOC_NRF9280_IRON + depends on SOC_NRF54H20_IRON || SOC_NRF9280_IRON config NRF_IRONSIDE_CPUCONF_SERVICE bool "IronSide CPUCONF service" diff --git a/soc/nordic/nrf54h/Kconfig b/soc/nordic/nrf54h/Kconfig index 97423a04e9b7..ed9fc86f2fc9 100644 --- a/soc/nordic/nrf54h/Kconfig +++ b/soc/nordic/nrf54h/Kconfig @@ -10,7 +10,6 @@ config SOC_SERIES_NRF54HX select SOC_EARLY_INIT_HOOK if ARM select SOC_LATE_INIT_HOOK if SOC_NRF54H20_CPURAD_ENABLE select NRF_PLATFORM_HALTIUM - select EXPERIMENTAL if MCUBOOT config SOC_NRF54H20_CPUAPP_COMMON bool @@ -89,3 +88,6 @@ config SOC_NRF54H20_CPUFLPR rsource "bicr/Kconfig" rsource "gpd/Kconfig" + +config SOC_NRF54H20_IRON + select EXPERIMENTAL if MCUBOOT diff --git a/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuapp b/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuapp index 69bde826ba41..595cc2d38860 100644 --- a/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuapp +++ b/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuapp @@ -8,6 +8,9 @@ if SOC_NRF54H20_CPUAPP config NUM_IRQS default 471 +config NRF_REGTOOL_GENERATE_UICR + default y + config SHELL_BACKEND_SERIAL default n if NRF_ETR_SHELL diff --git a/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpurad b/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpurad index 8f86835b92c5..1fffdeae6d2e 100644 --- a/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpurad +++ b/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpurad @@ -8,6 +8,9 @@ if SOC_NRF54H20_CPURAD config NUM_IRQS default 471 +config NRF_REGTOOL_GENERATE_UICR + default y + config PM default y diff --git a/soc/nordic/nrf54h/Kconfig.soc b/soc/nordic/nrf54h/Kconfig.soc index 459854e13b2d..62d5293bfe32 100644 --- a/soc/nordic/nrf54h/Kconfig.soc +++ b/soc/nordic/nrf54h/Kconfig.soc @@ -33,5 +33,10 @@ config SOC_NRF54H20_CPUFLPR help nRF54H20 CPUFLPR +config SOC_NRF54H20_IRON + bool + help + Indicates that local domain firmware is compatible with Nordic IronSide SE. + config SOC default "nrf54h20" if SOC_NRF54H20 diff --git a/tests/boards/nrf/nrfs/prj.conf b/tests/boards/nrf/nrfs/prj.conf index ee3da6976c4e..c1a01949d601 100644 --- a/tests/boards/nrf/nrfs/prj.conf +++ b/tests/boards/nrf/nrfs/prj.conf @@ -19,5 +19,3 @@ CONFIG_LOG=y CONFIG_LOG_MODE_IMMEDIATE=n CONFIG_CONSOLE=y CONFIG_UART_CONSOLE=y - -CONFIG_SOC_NRF54H20_CPURAD_ENABLE=y diff --git a/tests/drivers/adc/adc_api/boards/nrf54h20dk_nrf54h20_cpuapp_iron.overlay b/tests/drivers/adc/adc_api/boards/nrf54h20dk_nrf54h20_cpuapp_iron.overlay new file mode 100644 index 000000000000..0e01ff40bb9e --- /dev/null +++ b/tests/drivers/adc/adc_api/boards/nrf54h20dk_nrf54h20_cpuapp_iron.overlay @@ -0,0 +1,6 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "nrf54h20dk_nrf54h20_common.dtsi" diff --git a/tests/drivers/watchdog/wdt_basic_api/boards/nrf54h20dk_nrf54h20_cpuapp_iron.conf b/tests/drivers/watchdog/wdt_basic_api/boards/nrf54h20dk_nrf54h20_cpuapp_iron.conf new file mode 100644 index 000000000000..45e31e2fae42 --- /dev/null +++ b/tests/drivers/watchdog/wdt_basic_api/boards/nrf54h20dk_nrf54h20_cpuapp_iron.conf @@ -0,0 +1,2 @@ +# Disable dcache +CONFIG_DCACHE=n diff --git a/tests/drivers/watchdog/wdt_basic_api/boards/nrf54h20dk_nrf54h20_cpuapp_iron.overlay b/tests/drivers/watchdog/wdt_basic_api/boards/nrf54h20dk_nrf54h20_cpuapp_iron.overlay new file mode 100644 index 000000000000..102abfc8ef27 --- /dev/null +++ b/tests/drivers/watchdog/wdt_basic_api/boards/nrf54h20dk_nrf54h20_cpuapp_iron.overlay @@ -0,0 +1,8 @@ +/* + * Copyright 2025 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +&wdt010 { + status = "okay"; +}; diff --git a/tests/subsys/ipc/ipc_sessions/testcase.yaml b/tests/subsys/ipc/ipc_sessions/testcase.yaml index a4d34a394dd8..f76a61b8d68e 100644 --- a/tests/subsys/ipc/ipc_sessions/testcase.yaml +++ b/tests/subsys/ipc/ipc_sessions/testcase.yaml @@ -20,7 +20,6 @@ tests: - nrf54h20dk/nrf54h20/cpuapp extra_args: - CONFIG_IPC_TEST_SKIP_CORE_RESET=y - - CONFIG_SOC_NRF54H20_CPURAD_ENABLE=y sample.ipc.ipc_sessions.nrf54h20dk_cpuapp_cpuppr: platform_allow: - nrf54h20dk/nrf54h20/cpuapp From 427a1d620f9fe1cbab9c116f1f90099b8db7d312 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:45 +0300 Subject: [PATCH 1156/2141] Revert "[nrf fromtree] tests: boards: nrf: nrfs: Build main image for app core only" This reverts commit dd86ab537cee1ac7917810a8c48a51aaf29a69f0. Signed-off-by: Jukka Rissanen --- tests/boards/nrf/nrfs/Kconfig.sysbuild | 1 + tests/boards/nrf/nrfs/testcase.yaml | 2 ++ 2 files changed, 3 insertions(+) diff --git a/tests/boards/nrf/nrfs/Kconfig.sysbuild b/tests/boards/nrf/nrfs/Kconfig.sysbuild index 6cc7dc9575af..f281257725fc 100644 --- a/tests/boards/nrf/nrfs/Kconfig.sysbuild +++ b/tests/boards/nrf/nrfs/Kconfig.sysbuild @@ -6,3 +6,4 @@ source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" config REMOTE_BOARD string default "$(BOARD)/nrf54h20/cpurad" if SOC_NRF54H20_CPUAPP + default "$(BOARD)/nrf54h20/cpuapp" if SOC_NRF54H20_CPURAD diff --git a/tests/boards/nrf/nrfs/testcase.yaml b/tests/boards/nrf/nrfs/testcase.yaml index d1974f00d7c0..315c3cf7f375 100644 --- a/tests/boards/nrf/nrfs/testcase.yaml +++ b/tests/boards/nrf/nrfs/testcase.yaml @@ -1,8 +1,10 @@ common: platform_allow: - nrf54h20dk/nrf54h20/cpuapp + - nrf54h20dk/nrf54h20/cpurad integration_platforms: - nrf54h20dk/nrf54h20/cpuapp + - nrf54h20dk/nrf54h20/cpurad tags: - nrfs harness: ztest From d1a2e441d41f20ab689e95df451915b762afaadd Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:46 +0300 Subject: [PATCH 1157/2141] Revert "[nrf fromtree] samples: drivers: mbox: switch nrf54h20 cpuapp and cpurad remotes" This reverts commit bff309cc23e793fdb8efc94eceedf1983c29a7e2. Signed-off-by: Jukka Rissanen --- samples/drivers/mbox/CMakeLists.txt | 1 + samples/drivers/mbox/Kconfig.sysbuild | 1 + .../boards/nrf54h20dk_nrf54h20_cpurad.overlay | 0 samples/drivers/mbox/remote/CMakeLists.txt | 2 +- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 0 samples/drivers/mbox/sample.yaml | 12 +++++------- .../mbox/sysbuild/nrf54h20dk_nrf54h20_cpurad.conf | 1 - 7 files changed, 8 insertions(+), 9 deletions(-) rename samples/drivers/mbox/{remote => }/boards/nrf54h20dk_nrf54h20_cpurad.overlay (100%) rename samples/drivers/mbox/{ => remote}/boards/nrf54h20dk_nrf54h20_cpuapp.overlay (100%) delete mode 100644 samples/drivers/mbox/sysbuild/nrf54h20dk_nrf54h20_cpurad.conf diff --git a/samples/drivers/mbox/CMakeLists.txt b/samples/drivers/mbox/CMakeLists.txt index e5d5e612c79d..d6bada1a50ed 100644 --- a/samples/drivers/mbox/CMakeLists.txt +++ b/samples/drivers/mbox/CMakeLists.txt @@ -24,6 +24,7 @@ if(CONFIG_BOARD_NRF5340DK_NRF5340_CPUAPP OR CONFIG_BOARD_ESP32_DEVKITC_ESP32_PROCPU OR CONFIG_BOARD_ESP32S3_DEVKITM_ESP32S3_PROCPU OR CONFIG_BOARD_NRF54H20DK_NRF54H20_CPUAPP OR + CONFIG_BOARD_NRF54H20DK_NRF54H20_CPURAD OR CONFIG_BOARD_NRF54L09PDK_NRF54L09_CPUAPP OR CONFIG_BOARD_NRF54L15DK_NRF54L15_CPUAPP OR CONFIG_BOARD_NRF54LM20DK_NRF54LM20A_CPUAPP OR diff --git a/samples/drivers/mbox/Kconfig.sysbuild b/samples/drivers/mbox/Kconfig.sysbuild index 2a79840f389b..76d3d240abce 100644 --- a/samples/drivers/mbox/Kconfig.sysbuild +++ b/samples/drivers/mbox/Kconfig.sysbuild @@ -18,6 +18,7 @@ config REMOTE_BOARD default "lpcxpresso55s69/lpc55s69/cpu1" if $(BOARD) = "lpcxpresso55s69" default "frdm_mcxn947/mcxn947/cpu1" if $(BOARD) = "frdm_mcxn947" default "mcx_n9xx_evk/mcxn947/cpu1" if $(BOARD) = "mcx_n9xx_evk" + default "nrf54h20dk/nrf54h20/cpuapp" if "$(BOARD)${BOARD_QUALIFIERS}" = "nrf54h20dk/nrf54h20/cpurad" default "nrf54l09pdk/nrf54l09/cpuflpr" if $(BOARD) = "nrf54l09pdk" default "nrf54l15dk/nrf54l15/cpuflpr" if $(BOARD) = "nrf54l15dk" default "nrf54lm20dk/nrf54lm20a/cpuflpr" if $(BOARD) = "nrf54lm20dk" diff --git a/samples/drivers/mbox/remote/boards/nrf54h20dk_nrf54h20_cpurad.overlay b/samples/drivers/mbox/boards/nrf54h20dk_nrf54h20_cpurad.overlay similarity index 100% rename from samples/drivers/mbox/remote/boards/nrf54h20dk_nrf54h20_cpurad.overlay rename to samples/drivers/mbox/boards/nrf54h20dk_nrf54h20_cpurad.overlay diff --git a/samples/drivers/mbox/remote/CMakeLists.txt b/samples/drivers/mbox/remote/CMakeLists.txt index bd4c9e2e20e5..c84efec11977 100644 --- a/samples/drivers/mbox/remote/CMakeLists.txt +++ b/samples/drivers/mbox/remote/CMakeLists.txt @@ -23,7 +23,7 @@ if(CONFIG_BOARD_NRF5340DK_NRF5340_CPUNET OR CONFIG_BOARD_ESP32S3_DEVKITM_ESP32S3_APPCPU OR CONFIG_BOARD_NRF54H20DK_NRF54H20_CPUPPR OR CONFIG_BOARD_NRF54H20DK_NRF54H20_CPUFLPR OR - CONFIG_BOARD_NRF54H20DK_NRF54H20_CPURAD OR + CONFIG_BOARD_NRF54H20DK_NRF54H20_CPUAPP OR CONFIG_BOARD_NRF54L09PDK_NRF54L09_CPUFLPR OR CONFIG_BOARD_NRF54L15DK_NRF54L15_CPUFLPR OR CONFIG_BOARD_NRF54LM20DK_NRF54LM20A_CPUFLPR OR diff --git a/samples/drivers/mbox/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/samples/drivers/mbox/remote/boards/nrf54h20dk_nrf54h20_cpuapp.overlay similarity index 100% rename from samples/drivers/mbox/boards/nrf54h20dk_nrf54h20_cpuapp.overlay rename to samples/drivers/mbox/remote/boards/nrf54h20dk_nrf54h20_cpuapp.overlay diff --git a/samples/drivers/mbox/sample.yaml b/samples/drivers/mbox/sample.yaml index 8a25dc0b3bf7..809d5e091dc4 100644 --- a/samples/drivers/mbox/sample.yaml +++ b/samples/drivers/mbox/sample.yaml @@ -59,21 +59,19 @@ tests: - "Ping \\(on channel 16\\)" - "Pong \\(on channel 14\\)" - sample.drivers.mbox.nrf54h20_app_rad: + sample.drivers.mbox.nrf54h20_rad_app: platform_allow: - - nrf54h20dk/nrf54h20/cpuapp + - nrf54h20dk/nrf54h20/cpurad integration_platforms: - - nrf54h20dk/nrf54h20/cpuapp - extra_args: - - SB_CONF_FILE=sysbuild/nrf54h20dk_nrf54h20_cpurad.conf + - nrf54h20dk/nrf54h20/cpurad sysbuild: true harness: console harness_config: type: multi_line ordered: false regex: - - "Ping \\(on channel 12\\)" - - "Pong \\(on channel 18\\)" + - "Ping \\(on channel 18\\)" + - "Pong \\(on channel 12\\)" sample.drivers.mbox.nrf54l: platform_allow: diff --git a/samples/drivers/mbox/sysbuild/nrf54h20dk_nrf54h20_cpurad.conf b/samples/drivers/mbox/sysbuild/nrf54h20dk_nrf54h20_cpurad.conf deleted file mode 100644 index dd863e78d993..000000000000 --- a/samples/drivers/mbox/sysbuild/nrf54h20dk_nrf54h20_cpurad.conf +++ /dev/null @@ -1 +0,0 @@ -SB_CONFIG_REMOTE_BOARD="nrf54h20dk/nrf54h20/cpurad" From f324a225817490f8917481d52b3692df735ff0ab Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:46 +0300 Subject: [PATCH 1158/2141] Revert "[nrf fromtree] soc: Boot matching radio slot" This reverts commit 66adbc0343e431f68c12690588692bb3016238f8. Signed-off-by: Jukka Rissanen --- soc/nordic/nrf54h/soc.c | 34 ++++++---------------------------- 1 file changed, 6 insertions(+), 28 deletions(-) diff --git a/soc/nordic/nrf54h/soc.c b/soc/nordic/nrf54h/soc.c index cdff23103555..0c43c6175720 100644 --- a/soc/nordic/nrf54h/soc.c +++ b/soc/nordic/nrf54h/soc.c @@ -32,15 +32,6 @@ LOG_MODULE_REGISTER(soc, CONFIG_SOC_LOG_LEVEL); #define HSFLL_NODE DT_NODELABEL(cpurad_hsfll) #endif -#ifdef CONFIG_USE_DT_CODE_PARTITION -#define FLASH_LOAD_OFFSET DT_REG_ADDR(DT_CHOSEN(zephyr_code_partition)) -#elif defined(CONFIG_FLASH_LOAD_OFFSET) -#define FLASH_LOAD_OFFSET CONFIG_FLASH_LOAD_OFFSET -#endif - -#define PARTITION_IS_RUNNING_APP_PARTITION(label) \ - (DT_REG_ADDR(DT_NODELABEL(label)) == FLASH_LOAD_OFFSET) - sys_snode_t soc_node; #define FICR_ADDR_GET(node_id, name) \ @@ -53,6 +44,8 @@ sys_snode_t soc_node; ADDRESS_DOMAIN_Msk | \ ADDRESS_BUS_Msk))) +#define DT_NODELABEL_CPURAD_SLOT0_PARTITION DT_NODELABEL(cpurad_slot0_partition) + static void power_domain_init(void) { /* @@ -179,26 +172,11 @@ void soc_late_init_hook(void) */ uint8_t *msg = NULL; size_t msg_size = 0; - void *radiocore_address = NULL; - -#if DT_NODE_EXISTS(DT_NODELABEL(cpurad_slot1_partition)) - if (PARTITION_IS_RUNNING_APP_PARTITION(slot1_partition)) { - radiocore_address = - (void *)(DT_REG_ADDR(DT_GPARENT(DT_NODELABEL(cpurad_slot1_partition))) + - DT_REG_ADDR(DT_NODELABEL(cpurad_slot1_partition)) + - CONFIG_ROM_START_OFFSET); - } else { - radiocore_address = - (void *)(DT_REG_ADDR(DT_GPARENT(DT_NODELABEL(cpurad_slot0_partition))) + - DT_REG_ADDR(DT_NODELABEL(cpurad_slot0_partition)) + - CONFIG_ROM_START_OFFSET); - } -#else - radiocore_address = - (void *)(DT_REG_ADDR(DT_GPARENT(DT_NODELABEL(cpurad_slot0_partition))) + - DT_REG_ADDR(DT_NODELABEL(cpurad_slot0_partition)) + + + void *radiocore_address = + (void *)(DT_REG_ADDR(DT_GPARENT(DT_NODELABEL_CPURAD_SLOT0_PARTITION)) + + DT_REG_ADDR(DT_NODELABEL_CPURAD_SLOT0_PARTITION) + CONFIG_ROM_START_OFFSET); -#endif /* Don't wait as this is not yet supported. */ bool cpu_wait = false; From a83df9ac9196ad9501bf756fd35b59a1c1714f17 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:46 +0300 Subject: [PATCH 1159/2141] Revert "[nrf fromtree] boards: nordic: Enable CONFIG_HW_STACK_PROTECTION conditionally" This reverts commit 401d0637330a495b11e8587a83fd7c8ddea1872e. Signed-off-by: Jukka Rissanen --- boards/nordic/nrf21540dk/Kconfig.defconfig | 3 --- .../nordic/nrf21540dk/nrf21540dk_nrf52840_defconfig | 3 +++ boards/nordic/nrf52833dk/Kconfig.defconfig | 3 --- .../nordic/nrf52833dk/nrf52833dk_nrf52820_defconfig | 3 +++ .../nordic/nrf52833dk/nrf52833dk_nrf52833_defconfig | 3 +++ boards/nordic/nrf52840dk/Kconfig.defconfig | 3 --- .../nordic/nrf52840dk/nrf52840dk_nrf52811_defconfig | 3 +++ .../nordic/nrf52840dk/nrf52840dk_nrf52840_defconfig | 3 +++ boards/nordic/nrf52840dongle/Kconfig.defconfig | 3 --- .../nrf52840dongle/nrf52840dongle_nrf52840_defconfig | 3 +++ boards/nordic/nrf52dk/Kconfig.defconfig | 11 ----------- boards/nordic/nrf52dk/nrf52dk_nrf52805_defconfig | 3 +++ boards/nordic/nrf52dk/nrf52dk_nrf52810_defconfig | 3 +++ boards/nordic/nrf52dk/nrf52dk_nrf52832_defconfig | 3 +++ boards/nordic/nrf5340_audio_dk/Kconfig.defconfig | 3 --- .../nrf5340_audio_dk_nrf5340_cpuapp_defconfig | 2 ++ .../nrf5340_audio_dk_nrf5340_cpuapp_ns_defconfig | 2 ++ .../nrf5340_audio_dk_nrf5340_cpunet_defconfig | 3 +++ boards/nordic/nrf5340dk/Kconfig.defconfig | 3 --- .../nrf5340dk/nrf5340dk_nrf5340_cpuapp_defconfig | 3 +++ .../nrf5340dk/nrf5340dk_nrf5340_cpuapp_ns_defconfig | 3 +++ .../nrf5340dk/nrf5340dk_nrf5340_cpunet_defconfig | 3 +++ boards/nordic/nrf54h20dk/Kconfig.defconfig | 3 --- .../nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_defconfig | 3 +++ .../nrf54h20dk_nrf54h20_cpuapp_iron_defconfig | 3 +++ .../nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_defconfig | 3 +++ .../nrf54h20dk_nrf54h20_cpurad_iron_defconfig | 3 +++ boards/nordic/nrf54l09pdk/Kconfig.defconfig | 3 --- .../nrf54l09pdk/nrf54l09pdk_nrf54l09_cpuapp_defconfig | 3 +++ boards/nordic/nrf54l15dk/Kconfig.defconfig | 3 --- .../nrf54l15dk/nrf54l15dk_nrf54l05_cpuapp_defconfig | 3 +++ .../nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_defconfig | 3 +++ .../nrf54l15dk_nrf54l10_cpuapp_ns_defconfig | 1 + .../nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp_defconfig | 3 +++ .../nrf54l15dk_nrf54l15_cpuapp_ns_defconfig | 1 + boards/nordic/nrf54l20pdk/Kconfig.defconfig | 3 --- .../nrf54l20pdk/nrf54l20pdk_nrf54l20_cpuapp_defconfig | 3 +++ boards/nordic/nrf7002dk/Kconfig.defconfig | 11 ----------- .../nrf7002dk/nrf7002dk_nrf5340_cpuapp_defconfig | 3 +++ .../nrf7002dk_nrf5340_cpuapp_nrf7001_defconfig | 3 +++ .../nrf7002dk/nrf7002dk_nrf5340_cpunet_defconfig | 3 +++ boards/nordic/nrf9131ek/Kconfig.defconfig | 3 --- boards/nordic/nrf9131ek/nrf9131ek_nrf9131_defconfig | 3 +++ .../nordic/nrf9131ek/nrf9131ek_nrf9131_ns_defconfig | 3 +++ boards/nordic/nrf9151dk/Kconfig.defconfig | 3 --- boards/nordic/nrf9151dk/nrf9151dk_nrf9151_defconfig | 3 +++ .../nordic/nrf9151dk/nrf9151dk_nrf9151_ns_defconfig | 3 +++ boards/nordic/nrf9160dk/Kconfig.defconfig | 3 --- boards/nordic/nrf9160dk/nrf9160dk_nrf52840_defconfig | 3 +++ boards/nordic/nrf9160dk/nrf9160dk_nrf9160_defconfig | 3 +++ .../nordic/nrf9160dk/nrf9160dk_nrf9160_ns_defconfig | 3 +++ boards/nordic/nrf9161dk/Kconfig.defconfig | 3 --- boards/nordic/nrf9161dk/nrf9161dk_nrf9161_defconfig | 3 +++ .../nordic/nrf9161dk/nrf9161dk_nrf9161_ns_defconfig | 3 +++ boards/nordic/nrf9280pdk/Kconfig.defconfig | 3 --- .../nrf9280pdk/nrf9280pdk_nrf9280_cpuapp_defconfig | 3 +++ .../nrf9280pdk/nrf9280pdk_nrf9280_cpurad_defconfig | 3 +++ boards/nordic/thingy52/Kconfig.defconfig | 3 --- boards/nordic/thingy52/thingy52_nrf52832_defconfig | 3 +++ boards/nordic/thingy53/Kconfig.defconfig | 3 --- .../nordic/thingy53/thingy53_nrf5340_cpuapp_defconfig | 3 +++ .../thingy53/thingy53_nrf5340_cpuapp_ns_defconfig | 3 +++ .../nordic/thingy53/thingy53_nrf5340_cpunet_defconfig | 3 +++ 63 files changed, 126 insertions(+), 73 deletions(-) delete mode 100644 boards/nordic/nrf52dk/Kconfig.defconfig delete mode 100644 boards/nordic/nrf7002dk/Kconfig.defconfig diff --git a/boards/nordic/nrf21540dk/Kconfig.defconfig b/boards/nordic/nrf21540dk/Kconfig.defconfig index 6f2eea3c9980..31642d144099 100644 --- a/boards/nordic/nrf21540dk/Kconfig.defconfig +++ b/boards/nordic/nrf21540dk/Kconfig.defconfig @@ -5,7 +5,4 @@ if BOARD_NRF21540DK -config HW_STACK_PROTECTION - default ARCH_HAS_STACK_PROTECTION - endif # BOARD_NRF21540DK diff --git a/boards/nordic/nrf21540dk/nrf21540dk_nrf52840_defconfig b/boards/nordic/nrf21540dk/nrf21540dk_nrf52840_defconfig index 7167aca850a0..14367293292d 100644 --- a/boards/nordic/nrf21540dk/nrf21540dk_nrf52840_defconfig +++ b/boards/nordic/nrf21540dk/nrf21540dk_nrf52840_defconfig @@ -3,6 +3,9 @@ # Enable MPU CONFIG_ARM_MPU=y +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y + # enable GPIO CONFIG_GPIO=y diff --git a/boards/nordic/nrf52833dk/Kconfig.defconfig b/boards/nordic/nrf52833dk/Kconfig.defconfig index d016c17667e0..dc6fbbdcf3d9 100644 --- a/boards/nordic/nrf52833dk/Kconfig.defconfig +++ b/boards/nordic/nrf52833dk/Kconfig.defconfig @@ -5,7 +5,4 @@ if BOARD_NRF52833DK -config HW_STACK_PROTECTION - default ARCH_HAS_STACK_PROTECTION - endif # BOARD_NRF52833DK diff --git a/boards/nordic/nrf52833dk/nrf52833dk_nrf52820_defconfig b/boards/nordic/nrf52833dk/nrf52833dk_nrf52820_defconfig index 7167aca850a0..14367293292d 100644 --- a/boards/nordic/nrf52833dk/nrf52833dk_nrf52820_defconfig +++ b/boards/nordic/nrf52833dk/nrf52833dk_nrf52820_defconfig @@ -3,6 +3,9 @@ # Enable MPU CONFIG_ARM_MPU=y +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y + # enable GPIO CONFIG_GPIO=y diff --git a/boards/nordic/nrf52833dk/nrf52833dk_nrf52833_defconfig b/boards/nordic/nrf52833dk/nrf52833dk_nrf52833_defconfig index 7167aca850a0..14367293292d 100644 --- a/boards/nordic/nrf52833dk/nrf52833dk_nrf52833_defconfig +++ b/boards/nordic/nrf52833dk/nrf52833dk_nrf52833_defconfig @@ -3,6 +3,9 @@ # Enable MPU CONFIG_ARM_MPU=y +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y + # enable GPIO CONFIG_GPIO=y diff --git a/boards/nordic/nrf52840dk/Kconfig.defconfig b/boards/nordic/nrf52840dk/Kconfig.defconfig index 96aa4159c27e..478445b229bc 100644 --- a/boards/nordic/nrf52840dk/Kconfig.defconfig +++ b/boards/nordic/nrf52840dk/Kconfig.defconfig @@ -5,7 +5,4 @@ if BOARD_NRF52840DK -config HW_STACK_PROTECTION - default ARCH_HAS_STACK_PROTECTION - endif # BOARD_NRF52840DK diff --git a/boards/nordic/nrf52840dk/nrf52840dk_nrf52811_defconfig b/boards/nordic/nrf52840dk/nrf52840dk_nrf52811_defconfig index d94d5ee46d15..c076e7d88975 100644 --- a/boards/nordic/nrf52840dk/nrf52840dk_nrf52811_defconfig +++ b/boards/nordic/nrf52840dk/nrf52840dk_nrf52811_defconfig @@ -5,6 +5,9 @@ # Enable MPU CONFIG_ARM_MPU=y +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y + # Enable UART CONFIG_SERIAL=y diff --git a/boards/nordic/nrf52840dk/nrf52840dk_nrf52840_defconfig b/boards/nordic/nrf52840dk/nrf52840dk_nrf52840_defconfig index 7167aca850a0..14367293292d 100644 --- a/boards/nordic/nrf52840dk/nrf52840dk_nrf52840_defconfig +++ b/boards/nordic/nrf52840dk/nrf52840dk_nrf52840_defconfig @@ -3,6 +3,9 @@ # Enable MPU CONFIG_ARM_MPU=y +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y + # enable GPIO CONFIG_GPIO=y diff --git a/boards/nordic/nrf52840dongle/Kconfig.defconfig b/boards/nordic/nrf52840dongle/Kconfig.defconfig index 931786859b2d..5bdbb6ce63bd 100644 --- a/boards/nordic/nrf52840dongle/Kconfig.defconfig +++ b/boards/nordic/nrf52840dongle/Kconfig.defconfig @@ -6,9 +6,6 @@ if BOARD_NRF52840DONGLE -config HW_STACK_PROTECTION - default ARCH_HAS_STACK_PROTECTION - # To let the nRF5 bootloader load an application, the application # must be linked after Nordic MBR, that is factory-programmed on the board. diff --git a/boards/nordic/nrf52840dongle/nrf52840dongle_nrf52840_defconfig b/boards/nordic/nrf52840dongle/nrf52840dongle_nrf52840_defconfig index bb029eee81eb..ffaccd75ea8b 100644 --- a/boards/nordic/nrf52840dongle/nrf52840dongle_nrf52840_defconfig +++ b/boards/nordic/nrf52840dongle/nrf52840dongle_nrf52840_defconfig @@ -3,6 +3,9 @@ # Enable MPU CONFIG_ARM_MPU=y +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y + # enable GPIO CONFIG_GPIO=y diff --git a/boards/nordic/nrf52dk/Kconfig.defconfig b/boards/nordic/nrf52dk/Kconfig.defconfig deleted file mode 100644 index fbe5fabf7590..000000000000 --- a/boards/nordic/nrf52dk/Kconfig.defconfig +++ /dev/null @@ -1,11 +0,0 @@ -# nRF52 DK board configuration - -# Copyright (c) 2025 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -if BOARD_NRF52DK - -config HW_STACK_PROTECTION - default ARCH_HAS_STACK_PROTECTION - -endif # BOARD_NRF52DK diff --git a/boards/nordic/nrf52dk/nrf52dk_nrf52805_defconfig b/boards/nordic/nrf52dk/nrf52dk_nrf52805_defconfig index 4e65cf49c0cb..a4b09719b930 100644 --- a/boards/nordic/nrf52dk/nrf52dk_nrf52805_defconfig +++ b/boards/nordic/nrf52dk/nrf52dk_nrf52805_defconfig @@ -3,6 +3,9 @@ # Enable MPU CONFIG_ARM_MPU=y +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y + # Enable GPIO CONFIG_GPIO=y diff --git a/boards/nordic/nrf52dk/nrf52dk_nrf52810_defconfig b/boards/nordic/nrf52dk/nrf52dk_nrf52810_defconfig index e721f2360a12..a6749163af41 100644 --- a/boards/nordic/nrf52dk/nrf52dk_nrf52810_defconfig +++ b/boards/nordic/nrf52dk/nrf52dk_nrf52810_defconfig @@ -3,6 +3,9 @@ # Enable MPU CONFIG_ARM_MPU=y +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y + # enable GPIO CONFIG_GPIO=y diff --git a/boards/nordic/nrf52dk/nrf52dk_nrf52832_defconfig b/boards/nordic/nrf52dk/nrf52dk_nrf52832_defconfig index 7167aca850a0..14367293292d 100644 --- a/boards/nordic/nrf52dk/nrf52dk_nrf52832_defconfig +++ b/boards/nordic/nrf52dk/nrf52dk_nrf52832_defconfig @@ -3,6 +3,9 @@ # Enable MPU CONFIG_ARM_MPU=y +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y + # enable GPIO CONFIG_GPIO=y diff --git a/boards/nordic/nrf5340_audio_dk/Kconfig.defconfig b/boards/nordic/nrf5340_audio_dk/Kconfig.defconfig index 0ba5af149073..7084af10d6bf 100644 --- a/boards/nordic/nrf5340_audio_dk/Kconfig.defconfig +++ b/boards/nordic/nrf5340_audio_dk/Kconfig.defconfig @@ -3,9 +3,6 @@ # Copyright (c) 2019 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -config HW_STACK_PROTECTION - default ARCH_HAS_STACK_PROTECTION - if BOARD_NRF5340_AUDIO_DK_NRF5340_CPUAPP || BOARD_NRF5340_AUDIO_DK_NRF5340_CPUAPP_NS # Code Partition: diff --git a/boards/nordic/nrf5340_audio_dk/nrf5340_audio_dk_nrf5340_cpuapp_defconfig b/boards/nordic/nrf5340_audio_dk/nrf5340_audio_dk_nrf5340_cpuapp_defconfig index 13a1136435c7..516f0cf7407a 100644 --- a/boards/nordic/nrf5340_audio_dk/nrf5340_audio_dk_nrf5340_cpuapp_defconfig +++ b/boards/nordic/nrf5340_audio_dk/nrf5340_audio_dk_nrf5340_cpuapp_defconfig @@ -3,6 +3,8 @@ CONFIG_ARM_MPU=y +CONFIG_HW_STACK_PROTECTION=y + CONFIG_ARM_TRUSTZONE_M=y CONFIG_GPIO=y diff --git a/boards/nordic/nrf5340_audio_dk/nrf5340_audio_dk_nrf5340_cpuapp_ns_defconfig b/boards/nordic/nrf5340_audio_dk/nrf5340_audio_dk_nrf5340_cpuapp_ns_defconfig index 604e4311a6d9..5883909a4f02 100644 --- a/boards/nordic/nrf5340_audio_dk/nrf5340_audio_dk_nrf5340_cpuapp_ns_defconfig +++ b/boards/nordic/nrf5340_audio_dk/nrf5340_audio_dk_nrf5340_cpuapp_ns_defconfig @@ -3,6 +3,8 @@ CONFIG_ARM_MPU=y +CONFIG_HW_STACK_PROTECTION=y + CONFIG_ARM_TRUSTZONE_M=y CONFIG_TRUSTED_EXECUTION_NONSECURE=y diff --git a/boards/nordic/nrf5340_audio_dk/nrf5340_audio_dk_nrf5340_cpunet_defconfig b/boards/nordic/nrf5340_audio_dk/nrf5340_audio_dk_nrf5340_cpunet_defconfig index 2225f146d9be..56940c43a096 100644 --- a/boards/nordic/nrf5340_audio_dk/nrf5340_audio_dk_nrf5340_cpunet_defconfig +++ b/boards/nordic/nrf5340_audio_dk/nrf5340_audio_dk_nrf5340_cpunet_defconfig @@ -3,6 +3,9 @@ # Enable MPU CONFIG_ARM_MPU=y +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y + # Enable GPIO CONFIG_GPIO=y diff --git a/boards/nordic/nrf5340dk/Kconfig.defconfig b/boards/nordic/nrf5340dk/Kconfig.defconfig index 497113310bfa..6ba50229174d 100644 --- a/boards/nordic/nrf5340dk/Kconfig.defconfig +++ b/boards/nordic/nrf5340dk/Kconfig.defconfig @@ -3,9 +3,6 @@ # Copyright (c) 2019-2020 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -config HW_STACK_PROTECTION - default ARCH_HAS_STACK_PROTECTION - if BOARD_NRF5340DK_NRF5340_CPUAPP || BOARD_NRF5340DK_NRF5340_CPUAPP_NS # Code Partition: diff --git a/boards/nordic/nrf5340dk/nrf5340dk_nrf5340_cpuapp_defconfig b/boards/nordic/nrf5340dk/nrf5340dk_nrf5340_cpuapp_defconfig index 5b38cedf4b55..db40370dad01 100644 --- a/boards/nordic/nrf5340dk/nrf5340dk_nrf5340_cpuapp_defconfig +++ b/boards/nordic/nrf5340dk/nrf5340dk_nrf5340_cpuapp_defconfig @@ -3,6 +3,9 @@ # Enable MPU CONFIG_ARM_MPU=y +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y + # Enable TrustZone-M CONFIG_ARM_TRUSTZONE_M=y diff --git a/boards/nordic/nrf5340dk/nrf5340dk_nrf5340_cpuapp_ns_defconfig b/boards/nordic/nrf5340dk/nrf5340dk_nrf5340_cpuapp_ns_defconfig index 1da4e29c8914..1886b926bfd5 100644 --- a/boards/nordic/nrf5340dk/nrf5340dk_nrf5340_cpuapp_ns_defconfig +++ b/boards/nordic/nrf5340dk/nrf5340dk_nrf5340_cpuapp_ns_defconfig @@ -3,6 +3,9 @@ # Enable MPU CONFIG_ARM_MPU=y +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y + # Enable TrustZone-M CONFIG_ARM_TRUSTZONE_M=y diff --git a/boards/nordic/nrf5340dk/nrf5340dk_nrf5340_cpunet_defconfig b/boards/nordic/nrf5340dk/nrf5340dk_nrf5340_cpunet_defconfig index fd8622d4e368..394287267539 100644 --- a/boards/nordic/nrf5340dk/nrf5340dk_nrf5340_cpunet_defconfig +++ b/boards/nordic/nrf5340dk/nrf5340dk_nrf5340_cpunet_defconfig @@ -3,6 +3,9 @@ # Enable MPU CONFIG_ARM_MPU=y +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y + # enable GPIO CONFIG_GPIO=y diff --git a/boards/nordic/nrf54h20dk/Kconfig.defconfig b/boards/nordic/nrf54h20dk/Kconfig.defconfig index 3a6ba6b6d263..4023f3b02320 100644 --- a/boards/nordic/nrf54h20dk/Kconfig.defconfig +++ b/boards/nordic/nrf54h20dk/Kconfig.defconfig @@ -1,9 +1,6 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -config HW_STACK_PROTECTION - default ARCH_HAS_STACK_PROTECTION - if BOARD_NRF54H20DK_NRF54H20_CPUAPP config BT_HCI_IPC diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_defconfig b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_defconfig index d3ce90b8a380..e1ba596d1358 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_defconfig +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_defconfig @@ -13,6 +13,9 @@ CONFIG_USE_DT_CODE_PARTITION=y # Enable MPU CONFIG_ARM_MPU=y +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y + # MPU-based null-pointer dereferencing detection cannot be applied # as the (0x0 - 0x400) region is unmapped for this target. CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_iron_defconfig b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_iron_defconfig index bf3b6ac01e47..01f3bec39321 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_iron_defconfig +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_iron_defconfig @@ -11,6 +11,9 @@ CONFIG_UART_CONSOLE=y # Enable MPU CONFIG_ARM_MPU=y +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y + # MPU-based null-pointer dereferencing detection cannot be applied # as the (0x0 - 0x400) region is unmapped for this target. CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_defconfig b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_defconfig index 87bdd63ea7df..27df01dee128 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_defconfig +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_defconfig @@ -13,6 +13,9 @@ CONFIG_USE_DT_CODE_PARTITION=y # Enable MPU CONFIG_ARM_MPU=y +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y + # MPU-based null-pointer dereferencing detection cannot be applied # as the (0x0 - 0x400) region is unmapped for this target. CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_iron_defconfig b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_iron_defconfig index 4d247d805269..0ee0a96f99d7 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_iron_defconfig +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_iron_defconfig @@ -13,6 +13,9 @@ CONFIG_USE_DT_CODE_PARTITION=y # Enable MPU CONFIG_ARM_MPU=y +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y + # MPU-based null-pointer dereferencing detection cannot be applied # as the (0x0 - 0x400) region is unmapped for this target. CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y diff --git a/boards/nordic/nrf54l09pdk/Kconfig.defconfig b/boards/nordic/nrf54l09pdk/Kconfig.defconfig index 22c20a6a52e7..f6c1efe188bf 100644 --- a/boards/nordic/nrf54l09pdk/Kconfig.defconfig +++ b/boards/nordic/nrf54l09pdk/Kconfig.defconfig @@ -3,9 +3,6 @@ if BOARD_NRF54L09PDK_NRF54L09_CPUAPP -config HW_STACK_PROTECTION - default ARCH_HAS_STACK_PROTECTION - config ROM_START_OFFSET default 0x800 if BOOTLOADER_MCUBOOT diff --git a/boards/nordic/nrf54l09pdk/nrf54l09pdk_nrf54l09_cpuapp_defconfig b/boards/nordic/nrf54l09pdk/nrf54l09pdk_nrf54l09_cpuapp_defconfig index 33481a8f2302..80996ce11ade 100644 --- a/boards/nordic/nrf54l09pdk/nrf54l09pdk_nrf54l09_cpuapp_defconfig +++ b/boards/nordic/nrf54l09pdk/nrf54l09pdk_nrf54l09_cpuapp_defconfig @@ -13,3 +13,6 @@ CONFIG_GPIO=y # Enable MPU CONFIG_ARM_MPU=y + +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y diff --git a/boards/nordic/nrf54l15dk/Kconfig.defconfig b/boards/nordic/nrf54l15dk/Kconfig.defconfig index 0661366e911d..04c1d9ddc234 100644 --- a/boards/nordic/nrf54l15dk/Kconfig.defconfig +++ b/boards/nordic/nrf54l15dk/Kconfig.defconfig @@ -1,9 +1,6 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -config HW_STACK_PROTECTION - default ARCH_HAS_STACK_PROTECTION - if BOARD_NRF54L15DK_NRF54L05_CPUAPP || BOARD_NRF54L15DK_NRF54L10_CPUAPP || \ BOARD_NRF54L15DK_NRF54L15_CPUAPP diff --git a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l05_cpuapp_defconfig b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l05_cpuapp_defconfig index 33481a8f2302..80996ce11ade 100644 --- a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l05_cpuapp_defconfig +++ b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l05_cpuapp_defconfig @@ -13,3 +13,6 @@ CONFIG_GPIO=y # Enable MPU CONFIG_ARM_MPU=y + +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y diff --git a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_defconfig b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_defconfig index 33481a8f2302..80996ce11ade 100644 --- a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_defconfig +++ b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_defconfig @@ -13,3 +13,6 @@ CONFIG_GPIO=y # Enable MPU CONFIG_ARM_MPU=y + +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y diff --git a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns_defconfig b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns_defconfig index d9f869918bfe..1d759be671ca 100644 --- a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns_defconfig +++ b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns_defconfig @@ -2,6 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 CONFIG_ARM_MPU=y +CONFIG_HW_STACK_PROTECTION=y CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y CONFIG_ARM_TRUSTZONE_M=y diff --git a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp_defconfig b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp_defconfig index 33481a8f2302..80996ce11ade 100644 --- a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp_defconfig +++ b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp_defconfig @@ -13,3 +13,6 @@ CONFIG_GPIO=y # Enable MPU CONFIG_ARM_MPU=y + +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y diff --git a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp_ns_defconfig b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp_ns_defconfig index d9f869918bfe..1d759be671ca 100644 --- a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp_ns_defconfig +++ b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp_ns_defconfig @@ -2,6 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 CONFIG_ARM_MPU=y +CONFIG_HW_STACK_PROTECTION=y CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y CONFIG_ARM_TRUSTZONE_M=y diff --git a/boards/nordic/nrf54l20pdk/Kconfig.defconfig b/boards/nordic/nrf54l20pdk/Kconfig.defconfig index 4eac6259089d..406a65c88269 100644 --- a/boards/nordic/nrf54l20pdk/Kconfig.defconfig +++ b/boards/nordic/nrf54l20pdk/Kconfig.defconfig @@ -3,9 +3,6 @@ if BOARD_NRF54L20PDK_NRF54L20_CPUAPP -config HW_STACK_PROTECTION - default ARCH_HAS_STACK_PROTECTION - config ROM_START_OFFSET default 0x800 if BOOTLOADER_MCUBOOT diff --git a/boards/nordic/nrf54l20pdk/nrf54l20pdk_nrf54l20_cpuapp_defconfig b/boards/nordic/nrf54l20pdk/nrf54l20pdk_nrf54l20_cpuapp_defconfig index 33481a8f2302..80996ce11ade 100644 --- a/boards/nordic/nrf54l20pdk/nrf54l20pdk_nrf54l20_cpuapp_defconfig +++ b/boards/nordic/nrf54l20pdk/nrf54l20pdk_nrf54l20_cpuapp_defconfig @@ -13,3 +13,6 @@ CONFIG_GPIO=y # Enable MPU CONFIG_ARM_MPU=y + +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y diff --git a/boards/nordic/nrf7002dk/Kconfig.defconfig b/boards/nordic/nrf7002dk/Kconfig.defconfig deleted file mode 100644 index 48510d6e24f8..000000000000 --- a/boards/nordic/nrf7002dk/Kconfig.defconfig +++ /dev/null @@ -1,11 +0,0 @@ -# nRF7002 DK board configuration - -# Copyright (c) 2025 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -if BOARD_NRF7002DK - -config HW_STACK_PROTECTION - default ARCH_HAS_STACK_PROTECTION - -endif # BOARD_NRF7002DK diff --git a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_defconfig b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_defconfig index a3e0cd632513..49f3e03e2632 100644 --- a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_defconfig +++ b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_defconfig @@ -3,6 +3,9 @@ # Enable MPU CONFIG_ARM_MPU=y +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y + # Enable TrustZone-M CONFIG_ARM_TRUSTZONE_M=y diff --git a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_defconfig b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_defconfig index e9003b078914..33a414dc3805 100644 --- a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_defconfig +++ b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_defconfig @@ -4,6 +4,9 @@ # Enable MPU CONFIG_ARM_MPU=y +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y + # Enable TrustZone-M CONFIG_ARM_TRUSTZONE_M=y diff --git a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpunet_defconfig b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpunet_defconfig index 2225f146d9be..56940c43a096 100644 --- a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpunet_defconfig +++ b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpunet_defconfig @@ -3,6 +3,9 @@ # Enable MPU CONFIG_ARM_MPU=y +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y + # Enable GPIO CONFIG_GPIO=y diff --git a/boards/nordic/nrf9131ek/Kconfig.defconfig b/boards/nordic/nrf9131ek/Kconfig.defconfig index e1d8de241c0a..3e422198078b 100644 --- a/boards/nordic/nrf9131ek/Kconfig.defconfig +++ b/boards/nordic/nrf9131ek/Kconfig.defconfig @@ -3,8 +3,5 @@ # Copyright (c) 2023 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -config HW_STACK_PROTECTION - default ARCH_HAS_STACK_PROTECTION - config BOARD_NRF9131EK select USE_DT_CODE_PARTITION if BOARD_NRF9131EK_NRF9131_NS diff --git a/boards/nordic/nrf9131ek/nrf9131ek_nrf9131_defconfig b/boards/nordic/nrf9131ek/nrf9131ek_nrf9131_defconfig index dc9001bd6108..c486d8323821 100644 --- a/boards/nordic/nrf9131ek/nrf9131ek_nrf9131_defconfig +++ b/boards/nordic/nrf9131ek/nrf9131ek_nrf9131_defconfig @@ -3,6 +3,9 @@ # Enable MPU CONFIG_ARM_MPU=y +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y + # Enable TrustZone-M CONFIG_ARM_TRUSTZONE_M=y diff --git a/boards/nordic/nrf9131ek/nrf9131ek_nrf9131_ns_defconfig b/boards/nordic/nrf9131ek/nrf9131ek_nrf9131_ns_defconfig index 0699ae4a7857..d15d371416bc 100644 --- a/boards/nordic/nrf9131ek/nrf9131ek_nrf9131_ns_defconfig +++ b/boards/nordic/nrf9131ek/nrf9131ek_nrf9131_ns_defconfig @@ -3,6 +3,9 @@ # Enable MPU CONFIG_ARM_MPU=y +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y + # Enable TrustZone-M CONFIG_ARM_TRUSTZONE_M=y diff --git a/boards/nordic/nrf9151dk/Kconfig.defconfig b/boards/nordic/nrf9151dk/Kconfig.defconfig index 308f6f7441e5..cfdc9c5f87e6 100644 --- a/boards/nordic/nrf9151dk/Kconfig.defconfig +++ b/boards/nordic/nrf9151dk/Kconfig.defconfig @@ -2,9 +2,6 @@ # Copyright (c) 2023 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -# -config HW_STACK_PROTECTION - default ARCH_HAS_STACK_PROTECTION if BOARD_NRF9151DK_NRF9151 || BOARD_NRF9151DK_NRF9151_NS diff --git a/boards/nordic/nrf9151dk/nrf9151dk_nrf9151_defconfig b/boards/nordic/nrf9151dk/nrf9151dk_nrf9151_defconfig index dc9001bd6108..c486d8323821 100644 --- a/boards/nordic/nrf9151dk/nrf9151dk_nrf9151_defconfig +++ b/boards/nordic/nrf9151dk/nrf9151dk_nrf9151_defconfig @@ -3,6 +3,9 @@ # Enable MPU CONFIG_ARM_MPU=y +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y + # Enable TrustZone-M CONFIG_ARM_TRUSTZONE_M=y diff --git a/boards/nordic/nrf9151dk/nrf9151dk_nrf9151_ns_defconfig b/boards/nordic/nrf9151dk/nrf9151dk_nrf9151_ns_defconfig index 244b153235f5..2a74dd56f414 100644 --- a/boards/nordic/nrf9151dk/nrf9151dk_nrf9151_ns_defconfig +++ b/boards/nordic/nrf9151dk/nrf9151dk_nrf9151_ns_defconfig @@ -3,6 +3,9 @@ # Enable MPU CONFIG_ARM_MPU=y +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y + # Enable TrustZone-M CONFIG_ARM_TRUSTZONE_M=y diff --git a/boards/nordic/nrf9160dk/Kconfig.defconfig b/boards/nordic/nrf9160dk/Kconfig.defconfig index f27b36a40d16..b92acdd3f106 100644 --- a/boards/nordic/nrf9160dk/Kconfig.defconfig +++ b/boards/nordic/nrf9160dk/Kconfig.defconfig @@ -3,9 +3,6 @@ # Copyright (c) 2018-2020 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -config HW_STACK_PROTECTION - default ARCH_HAS_STACK_PROTECTION - if BOARD_NRF9160DK_NRF9160 || BOARD_NRF9160DK_NRF9160_NS config BOARD_NRF9160DK diff --git a/boards/nordic/nrf9160dk/nrf9160dk_nrf52840_defconfig b/boards/nordic/nrf9160dk/nrf9160dk_nrf52840_defconfig index 1863ff54588a..cfe82dd26781 100644 --- a/boards/nordic/nrf9160dk/nrf9160dk_nrf52840_defconfig +++ b/boards/nordic/nrf9160dk/nrf9160dk_nrf52840_defconfig @@ -3,6 +3,9 @@ # Enable MPU CONFIG_ARM_MPU=y +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y + # Enable UART driver CONFIG_SERIAL=y diff --git a/boards/nordic/nrf9160dk/nrf9160dk_nrf9160_defconfig b/boards/nordic/nrf9160dk/nrf9160dk_nrf9160_defconfig index dc9001bd6108..c486d8323821 100644 --- a/boards/nordic/nrf9160dk/nrf9160dk_nrf9160_defconfig +++ b/boards/nordic/nrf9160dk/nrf9160dk_nrf9160_defconfig @@ -3,6 +3,9 @@ # Enable MPU CONFIG_ARM_MPU=y +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y + # Enable TrustZone-M CONFIG_ARM_TRUSTZONE_M=y diff --git a/boards/nordic/nrf9160dk/nrf9160dk_nrf9160_ns_defconfig b/boards/nordic/nrf9160dk/nrf9160dk_nrf9160_ns_defconfig index 786906c85fca..624f98b1da39 100644 --- a/boards/nordic/nrf9160dk/nrf9160dk_nrf9160_ns_defconfig +++ b/boards/nordic/nrf9160dk/nrf9160dk_nrf9160_ns_defconfig @@ -3,6 +3,9 @@ # Enable MPU CONFIG_ARM_MPU=y +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y + # Enable TrustZone-M CONFIG_ARM_TRUSTZONE_M=y diff --git a/boards/nordic/nrf9161dk/Kconfig.defconfig b/boards/nordic/nrf9161dk/Kconfig.defconfig index 52e4067ecfa7..28490a3c65d9 100644 --- a/boards/nordic/nrf9161dk/Kconfig.defconfig +++ b/boards/nordic/nrf9161dk/Kconfig.defconfig @@ -3,9 +3,6 @@ # Copyright (c) 2023 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -config HW_STACK_PROTECTION - default ARCH_HAS_STACK_PROTECTION - if BOARD_NRF9161DK_NRF9161 || BOARD_NRF9161DK_NRF9161_NS config BOARD_NRF9161DK diff --git a/boards/nordic/nrf9161dk/nrf9161dk_nrf9161_defconfig b/boards/nordic/nrf9161dk/nrf9161dk_nrf9161_defconfig index dc9001bd6108..c486d8323821 100644 --- a/boards/nordic/nrf9161dk/nrf9161dk_nrf9161_defconfig +++ b/boards/nordic/nrf9161dk/nrf9161dk_nrf9161_defconfig @@ -3,6 +3,9 @@ # Enable MPU CONFIG_ARM_MPU=y +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y + # Enable TrustZone-M CONFIG_ARM_TRUSTZONE_M=y diff --git a/boards/nordic/nrf9161dk/nrf9161dk_nrf9161_ns_defconfig b/boards/nordic/nrf9161dk/nrf9161dk_nrf9161_ns_defconfig index 244b153235f5..2a74dd56f414 100644 --- a/boards/nordic/nrf9161dk/nrf9161dk_nrf9161_ns_defconfig +++ b/boards/nordic/nrf9161dk/nrf9161dk_nrf9161_ns_defconfig @@ -3,6 +3,9 @@ # Enable MPU CONFIG_ARM_MPU=y +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y + # Enable TrustZone-M CONFIG_ARM_TRUSTZONE_M=y diff --git a/boards/nordic/nrf9280pdk/Kconfig.defconfig b/boards/nordic/nrf9280pdk/Kconfig.defconfig index 24669fc7f1e6..ae7cb48cbc3b 100644 --- a/boards/nordic/nrf9280pdk/Kconfig.defconfig +++ b/boards/nordic/nrf9280pdk/Kconfig.defconfig @@ -1,9 +1,6 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -config HW_STACK_PROTECTION - default ARCH_HAS_STACK_PROTECTION - if BOARD_NRF9280PDK_NRF9280_CPUAPP config BT_HCI_IPC diff --git a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp_defconfig b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp_defconfig index d3ce90b8a380..e1ba596d1358 100644 --- a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp_defconfig +++ b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp_defconfig @@ -13,6 +13,9 @@ CONFIG_USE_DT_CODE_PARTITION=y # Enable MPU CONFIG_ARM_MPU=y +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y + # MPU-based null-pointer dereferencing detection cannot be applied # as the (0x0 - 0x400) region is unmapped for this target. CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y diff --git a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpurad_defconfig b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpurad_defconfig index 87bdd63ea7df..27df01dee128 100644 --- a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpurad_defconfig +++ b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpurad_defconfig @@ -13,6 +13,9 @@ CONFIG_USE_DT_CODE_PARTITION=y # Enable MPU CONFIG_ARM_MPU=y +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y + # MPU-based null-pointer dereferencing detection cannot be applied # as the (0x0 - 0x400) region is unmapped for this target. CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y diff --git a/boards/nordic/thingy52/Kconfig.defconfig b/boards/nordic/thingy52/Kconfig.defconfig index f9902cf481d3..9e50838b5c2e 100644 --- a/boards/nordic/thingy52/Kconfig.defconfig +++ b/boards/nordic/thingy52/Kconfig.defconfig @@ -5,7 +5,4 @@ if BOARD_THINGY52 -config HW_STACK_PROTECTION - default ARCH_HAS_STACK_PROTECTION - endif # BOARD_THINGY52 diff --git a/boards/nordic/thingy52/thingy52_nrf52832_defconfig b/boards/nordic/thingy52/thingy52_nrf52832_defconfig index d142c1ed38e2..401a71ab47a5 100644 --- a/boards/nordic/thingy52/thingy52_nrf52832_defconfig +++ b/boards/nordic/thingy52/thingy52_nrf52832_defconfig @@ -7,6 +7,9 @@ CONFIG_REGULATOR=y # Enable MPU CONFIG_ARM_MPU=y +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y + # Enable RTT CONFIG_USE_SEGGER_RTT=y diff --git a/boards/nordic/thingy53/Kconfig.defconfig b/boards/nordic/thingy53/Kconfig.defconfig index c1139f0dca10..d149d360f859 100644 --- a/boards/nordic/thingy53/Kconfig.defconfig +++ b/boards/nordic/thingy53/Kconfig.defconfig @@ -3,9 +3,6 @@ # Copyright (c) 2021 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -config HW_STACK_PROTECTION - default ARCH_HAS_STACK_PROTECTION - if BOARD_THINGY53_NRF5340_CPUAPP || BOARD_THINGY53_NRF5340_CPUAPP_NS # Code Partition: diff --git a/boards/nordic/thingy53/thingy53_nrf5340_cpuapp_defconfig b/boards/nordic/thingy53/thingy53_nrf5340_cpuapp_defconfig index 7aac6819966d..de1c1fd59643 100644 --- a/boards/nordic/thingy53/thingy53_nrf5340_cpuapp_defconfig +++ b/boards/nordic/thingy53/thingy53_nrf5340_cpuapp_defconfig @@ -3,6 +3,9 @@ # Enable MPU CONFIG_ARM_MPU=y +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y + # Enable TrustZone-M CONFIG_ARM_TRUSTZONE_M=y diff --git a/boards/nordic/thingy53/thingy53_nrf5340_cpuapp_ns_defconfig b/boards/nordic/thingy53/thingy53_nrf5340_cpuapp_ns_defconfig index f831ec5148ed..39dc91517e07 100644 --- a/boards/nordic/thingy53/thingy53_nrf5340_cpuapp_ns_defconfig +++ b/boards/nordic/thingy53/thingy53_nrf5340_cpuapp_ns_defconfig @@ -3,6 +3,9 @@ # Enable MPU CONFIG_ARM_MPU=y +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y + # Enable TrustZone-M CONFIG_ARM_TRUSTZONE_M=y diff --git a/boards/nordic/thingy53/thingy53_nrf5340_cpunet_defconfig b/boards/nordic/thingy53/thingy53_nrf5340_cpunet_defconfig index 341b44317281..c115d16a9d05 100644 --- a/boards/nordic/thingy53/thingy53_nrf5340_cpunet_defconfig +++ b/boards/nordic/thingy53/thingy53_nrf5340_cpunet_defconfig @@ -3,5 +3,8 @@ # Enable MPU CONFIG_ARM_MPU=y +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y + # Enable GPIO CONFIG_GPIO=y From 37f87142fabc561ef9c4898a26b7a17d4f99a682 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:46 +0300 Subject: [PATCH 1160/2141] Revert "[nrf fromtree] boards: nordic: Use dts for non-secure partitions" This reverts commit c57026d76594a40abc9e3851c7f924e3b73f3757. Signed-off-by: Jukka Rissanen --- boards/nordic/nrf5340dk/Kconfig.defconfig | 26 ++++++++++++++---- boards/nordic/nrf54l15dk/Kconfig.defconfig | 14 +++++++--- boards/nordic/nrf9131ek/Kconfig.defconfig | 32 ++++++++++++++++++++-- boards/nordic/nrf9151dk/Kconfig.defconfig | 28 +++++++++++++++++-- boards/nordic/nrf9160dk/Kconfig.defconfig | 28 +++++++++++++++++-- boards/nordic/nrf9161dk/Kconfig.defconfig | 28 +++++++++++++++++-- 6 files changed, 138 insertions(+), 18 deletions(-) diff --git a/boards/nordic/nrf5340dk/Kconfig.defconfig b/boards/nordic/nrf5340dk/Kconfig.defconfig index 6ba50229174d..b6186d4e0745 100644 --- a/boards/nordic/nrf5340dk/Kconfig.defconfig +++ b/boards/nordic/nrf5340dk/Kconfig.defconfig @@ -3,7 +3,7 @@ # Copyright (c) 2019-2020 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -if BOARD_NRF5340DK_NRF5340_CPUAPP || BOARD_NRF5340DK_NRF5340_CPUAPP_NS +if BOARD_NRF5340DK_NRF5340_CPUAPP || BOARD_NRF5340DK_NRF5340_CPUAPP_NS # Code Partition: # @@ -29,19 +29,29 @@ if BOARD_NRF5340DK_NRF5340_CPUAPP || BOARD_NRF5340DK_NRF5340_CPUAPP_NS # For the non-secure version of the board, the firmware image SRAM is # always restricted to the allocated non-secure SRAM partition. # +# Workaround for not being able to have commas in macro arguments +DT_CHOSEN_Z_CODE_PARTITION := zephyr,code-partition +DT_CHOSEN_Z_SRAM_PARTITION := zephyr,sram-secure-partition if BOARD_NRF5340DK_NRF5340_CPUAPP && TRUSTED_EXECUTION_SECURE -# Workaround for not being able to have commas in macro arguments -DT_CHOSEN_Z_SRAM_PARTITION := zephyr,sram-secure-partition +config FLASH_LOAD_SIZE + default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) config SRAM_SIZE default $(dt_chosen_reg_size_int,$(DT_CHOSEN_Z_SRAM_PARTITION),0,K) endif # BOARD_NRF5340DK_NRF5340_CPUAPP && TRUSTED_EXECUTION_SECURE -config BOARD_NRF5340DK - select USE_DT_CODE_PARTITION if BOARD_NRF5340DK_NRF5340_CPUAPP_NS +if BOARD_NRF5340DK_NRF5340_CPUAPP_NS + +config FLASH_LOAD_OFFSET + default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) + +config FLASH_LOAD_SIZE + default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) + +endif # BOARD_NRF5340DK_NRF5340_CPUAPP_NS config BT_HCI_IPC default y if BT @@ -50,4 +60,8 @@ config HEAP_MEM_POOL_ADD_SIZE_BOARD int default 4096 if BT_HCI_IPC -endif # BOARD_NRF5340DK_NRF5340_CPUAPP || BOARD_NRF5340DK_NRF5340_CPUAPP_NS +endif # BOARD_NRF5340DK_NRF5340_CPUAPP || BOARD_NRF5340DK_NRF5340_CPUAPP_NS + +if BOARD_NRF5340DK_NRF5340_CPUNET + +endif # BOARD_NRF5340DK_NRF5340_CPUNET diff --git a/boards/nordic/nrf54l15dk/Kconfig.defconfig b/boards/nordic/nrf54l15dk/Kconfig.defconfig index 04c1d9ddc234..9628b1fdf963 100644 --- a/boards/nordic/nrf54l15dk/Kconfig.defconfig +++ b/boards/nordic/nrf54l15dk/Kconfig.defconfig @@ -1,6 +1,10 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 +# Workaround for not being able to have commas in macro arguments +DT_CHOSEN_Z_CODE_PARTITION := zephyr,code-partition +DT_CHOSEN_Z_SRAM_PARTITION := zephyr,sram-secure-partition + if BOARD_NRF54L15DK_NRF54L05_CPUAPP || BOARD_NRF54L15DK_NRF54L10_CPUAPP || \ BOARD_NRF54L15DK_NRF54L15_CPUAPP @@ -12,13 +16,15 @@ endif # BOARD_NRF54L15DK_NRF54L05_CPUAPP || BOARD_NRF54L15DK_NRF54L10_CPUAPP || if BOARD_NRF54L15DK_NRF54L15_CPUAPP_NS || BOARD_NRF54L15DK_NRF54L10_CPUAPP_NS -config BOARD_NRF54L15DK - select USE_DT_CODE_PARTITION if BOARD_NRF54L15DK_NRF54L15_CPUAPP_NS || \ - BOARD_NRF54L15DK_NRF54L10_CPUAPP_NS - config BT_CTLR default BT +config FLASH_LOAD_OFFSET + default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) + +config FLASH_LOAD_SIZE + default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) + # By default, if we build for a Non-Secure version of the board, # enable building with TF-M as the Secure Execution Environment. config BUILD_WITH_TFM diff --git a/boards/nordic/nrf9131ek/Kconfig.defconfig b/boards/nordic/nrf9131ek/Kconfig.defconfig index 3e422198078b..b63e7ef8d34c 100644 --- a/boards/nordic/nrf9131ek/Kconfig.defconfig +++ b/boards/nordic/nrf9131ek/Kconfig.defconfig @@ -3,5 +3,33 @@ # Copyright (c) 2023 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -config BOARD_NRF9131EK - select USE_DT_CODE_PARTITION if BOARD_NRF9131EK_NRF9131_NS +if BOARD_NRF9131EK_NRF9131 || BOARD_NRF9131EK_NRF9131_NS + +# 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- +# secure image (TRUSTED_EXECUTION_SECURE=y), the secure FW image shall always +# be restricted to the size of its code partition. +# For the non-secure version of the board, the firmware +# must be linked into the code-partition (non-secure) defined in DT, regardless. +# Apply this configuration below by setting the Kconfig symbols used by +# the linker according to the information extracted from DT partitions. + +# Workaround for not being able to have commas in macro arguments +DT_CHOSEN_Z_CODE_PARTITION := zephyr,code-partition + +config FLASH_LOAD_SIZE + default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) + depends on BOARD_NRF9131EK_NRF9131 && TRUSTED_EXECUTION_SECURE + +if BOARD_NRF9131EK_NRF9131_NS + +config FLASH_LOAD_OFFSET + default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) + +config FLASH_LOAD_SIZE + default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) + +endif # BOARD_NRF9131EK_NRF9131_NS + +endif # BOARD_NRF9131EK_NRF9131 || BOARD_NRF9131EK_NRF9131_NS diff --git a/boards/nordic/nrf9151dk/Kconfig.defconfig b/boards/nordic/nrf9151dk/Kconfig.defconfig index cfdc9c5f87e6..21f036f76079 100644 --- a/boards/nordic/nrf9151dk/Kconfig.defconfig +++ b/boards/nordic/nrf9151dk/Kconfig.defconfig @@ -5,8 +5,32 @@ if BOARD_NRF9151DK_NRF9151 || BOARD_NRF9151DK_NRF9151_NS -config BOARD_NRF9151DK - select USE_DT_CODE_PARTITION if BOARD_NRF9151DK_NRF9151_NS +# 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- +# secure image (TRUSTED_EXECUTION_SECURE=y), the secure FW image shall always +# be restricted to the size of its code partition. +# For the non-secure version of the board, the firmware +# must be linked into the code-partition (non-secure) defined in DT, regardless. +# Apply this configuration below by setting the Kconfig symbols used by +# the linker according to the information extracted from DT partitions. + +# Workaround for not being able to have commas in macro arguments +DT_CHOSEN_Z_CODE_PARTITION := zephyr,code-partition + +config FLASH_LOAD_SIZE + default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) + depends on BOARD_NRF9151DK_NRF9151 && TRUSTED_EXECUTION_SECURE + +if BOARD_NRF9151DK_NRF9151_NS + +config FLASH_LOAD_OFFSET + default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) + +config FLASH_LOAD_SIZE + default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) + +endif # BOARD_NRF9151DK_NRF9151_NS config BT_HCI_VS default y if BT diff --git a/boards/nordic/nrf9160dk/Kconfig.defconfig b/boards/nordic/nrf9160dk/Kconfig.defconfig index b92acdd3f106..b26c68ef5319 100644 --- a/boards/nordic/nrf9160dk/Kconfig.defconfig +++ b/boards/nordic/nrf9160dk/Kconfig.defconfig @@ -5,8 +5,32 @@ if BOARD_NRF9160DK_NRF9160 || BOARD_NRF9160DK_NRF9160_NS -config BOARD_NRF9160DK - select USE_DT_CODE_PARTITION if BOARD_NRF9160DK_NRF9160_NS +# 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- +# secure image (TRUSTED_EXECUTION_SECURE=y), the secure FW image shall always +# be restricted to the size of its code partition. +# For the non-secure version of the board, the firmware +# must be linked into the code-partition (non-secure) defined in DT, regardless. +# Apply this configuration below by setting the Kconfig symbols used by +# the linker according to the information extracted from DT partitions. + +# Workaround for not being able to have commas in macro arguments +DT_CHOSEN_Z_CODE_PARTITION := zephyr,code-partition + +config FLASH_LOAD_SIZE + default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) + depends on BOARD_NRF9160DK_NRF9160 && TRUSTED_EXECUTION_SECURE + +if BOARD_NRF9160DK_NRF9160_NS + +config FLASH_LOAD_OFFSET + default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) + +config FLASH_LOAD_SIZE + default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) + +endif # BOARD_NRF9160DK_NRF9160_NS config BT_HCI_VS default y if BT diff --git a/boards/nordic/nrf9161dk/Kconfig.defconfig b/boards/nordic/nrf9161dk/Kconfig.defconfig index 28490a3c65d9..3790d580a295 100644 --- a/boards/nordic/nrf9161dk/Kconfig.defconfig +++ b/boards/nordic/nrf9161dk/Kconfig.defconfig @@ -5,8 +5,32 @@ if BOARD_NRF9161DK_NRF9161 || BOARD_NRF9161DK_NRF9161_NS -config BOARD_NRF9161DK - select USE_DT_CODE_PARTITION if BOARD_NRF9161DK_NRF9161_NS +# 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- +# secure image (TRUSTED_EXECUTION_SECURE=y), the secure FW image shall always +# be restricted to the size of its code partition. +# For the non-secure version of the board, the firmware +# must be linked into the code-partition (non-secure) defined in DT, regardless. +# Apply this configuration below by setting the Kconfig symbols used by +# the linker according to the information extracted from DT partitions. + +# Workaround for not being able to have commas in macro arguments +DT_CHOSEN_Z_CODE_PARTITION := zephyr,code-partition + +config FLASH_LOAD_SIZE + default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) + depends on BOARD_NRF9161DK_NRF9161 && TRUSTED_EXECUTION_SECURE + +if BOARD_NRF9161DK_NRF9161_NS + +config FLASH_LOAD_OFFSET + default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) + +config FLASH_LOAD_SIZE + default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) + +endif # BOARD_NRF9161DK_NRF9161_NS config BT_HCI_VS default y if BT From ecc92053bbbfa30e9fa04d993c5e15ed3b1394ed Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:46 +0300 Subject: [PATCH 1161/2141] Revert "[nrf fromtree] soc: nordic: move nrf_ironside from drivers/firmware to soc/nordic" This reverts commit 8da799d316d7d18984b2d24229f614659ed9328b. Signed-off-by: Jukka Rissanen --- drivers/firmware/CMakeLists.txt | 1 + drivers/firmware/Kconfig | 1 + .../firmware/nrf_ironside}/CMakeLists.txt | 2 -- .../ironside => drivers/firmware/nrf_ironside}/Kconfig | 0 .../firmware/nrf_ironside}/boot_report.c | 2 +- .../ironside => drivers/firmware/nrf_ironside}/call.c | 2 +- .../ironside => drivers/firmware/nrf_ironside}/cpuconf.c | 4 ++-- .../ironside => drivers/firmware/nrf_ironside}/dvfs.c | 4 ++-- .../ironside => drivers/firmware/nrf_ironside}/update.c | 4 ++-- dts/bindings/{misc => firmware}/nordic,ironside-call.yaml | 0 .../zephyr/drivers/firmware}/nrf_ironside/boot_report.h | 6 +++--- .../zephyr/drivers/firmware}/nrf_ironside/call.h | 6 +++--- .../zephyr/drivers/firmware}/nrf_ironside/cpuconf.h | 8 ++++---- .../zephyr/drivers/firmware}/nrf_ironside/dvfs.h | 6 +++--- .../zephyr/drivers/firmware}/nrf_ironside/update.h | 6 +++--- samples/boards/nordic/nrf_ironside/update/src/main.c | 4 ++-- soc/nordic/CMakeLists.txt | 1 - soc/nordic/nrf54h/soc.c | 2 +- 18 files changed, 29 insertions(+), 30 deletions(-) rename {soc/nordic/ironside => drivers/firmware/nrf_ironside}/CMakeLists.txt (92%) rename {soc/nordic/ironside => drivers/firmware/nrf_ironside}/Kconfig (100%) rename {soc/nordic/ironside => drivers/firmware/nrf_ironside}/boot_report.c (89%) rename {soc/nordic/ironside => drivers/firmware/nrf_ironside}/call.c (98%) rename {soc/nordic/ironside => drivers/firmware/nrf_ironside}/cpuconf.c (92%) rename {soc/nordic/ironside => drivers/firmware/nrf_ironside}/dvfs.c (97%) rename {soc/nordic/ironside => drivers/firmware/nrf_ironside}/update.c (83%) rename dts/bindings/{misc => firmware}/nordic,ironside-call.yaml (100%) rename {soc/nordic/ironside/include => include/zephyr/drivers/firmware}/nrf_ironside/boot_report.h (91%) rename {soc/nordic/ironside/include => include/zephyr/drivers/firmware}/nrf_ironside/call.h (91%) rename {soc/nordic/ironside/include => include/zephyr/drivers/firmware}/nrf_ironside/cpuconf.h (89%) rename {soc/nordic/ironside/include => include/zephyr/drivers/firmware}/nrf_ironside/dvfs.h (92%) rename {soc/nordic/ironside/include => include/zephyr/drivers/firmware}/nrf_ironside/update.h (90%) diff --git a/drivers/firmware/CMakeLists.txt b/drivers/firmware/CMakeLists.txt index cb6cec899638..caed354c3972 100644 --- a/drivers/firmware/CMakeLists.txt +++ b/drivers/firmware/CMakeLists.txt @@ -2,5 +2,6 @@ # zephyr-keep-sorted-start add_subdirectory_ifdef(CONFIG_ARM_SCMI scmi) +add_subdirectory_ifdef(CONFIG_NRF_IRONSIDE nrf_ironside) add_subdirectory_ifdef(CONFIG_TISCI tisci) # zephyr-keep-sorted-stop diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig index 8cca2f588ed2..3c92ec3bb6e2 100644 --- a/drivers/firmware/Kconfig +++ b/drivers/firmware/Kconfig @@ -11,6 +11,7 @@ config ARM_SCMI Interface (SCMI). # zephyr-keep-sorted-start +source "drivers/firmware/nrf_ironside/Kconfig" source "drivers/firmware/scmi/Kconfig" source "drivers/firmware/tisci/Kconfig" # zephyr-keep-sorted-stop diff --git a/soc/nordic/ironside/CMakeLists.txt b/drivers/firmware/nrf_ironside/CMakeLists.txt similarity index 92% rename from soc/nordic/ironside/CMakeLists.txt rename to drivers/firmware/nrf_ironside/CMakeLists.txt index a0a18fc94a8a..ddc46bd69b1e 100644 --- a/soc/nordic/ironside/CMakeLists.txt +++ b/drivers/firmware/nrf_ironside/CMakeLists.txt @@ -1,8 +1,6 @@ # Copyright (c) 2025 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -zephyr_include_directories(include) - zephyr_library() zephyr_library_sources_ifdef(CONFIG_NRF_IRONSIDE_CALL call.c) diff --git a/soc/nordic/ironside/Kconfig b/drivers/firmware/nrf_ironside/Kconfig similarity index 100% rename from soc/nordic/ironside/Kconfig rename to drivers/firmware/nrf_ironside/Kconfig diff --git a/soc/nordic/ironside/boot_report.c b/drivers/firmware/nrf_ironside/boot_report.c similarity index 89% rename from soc/nordic/ironside/boot_report.c rename to drivers/firmware/nrf_ironside/boot_report.c index ead0afca947f..ee3e5ff30423 100644 --- a/soc/nordic/ironside/boot_report.c +++ b/drivers/firmware/nrf_ironside/boot_report.c @@ -5,7 +5,7 @@ #include #include -#include +#include #define IRONSIDE_SE_BOOT_REPORT_ADDR DT_REG_ADDR(DT_NODELABEL(ironside_se_boot_report)) diff --git a/soc/nordic/ironside/call.c b/drivers/firmware/nrf_ironside/call.c similarity index 98% rename from soc/nordic/ironside/call.c rename to drivers/firmware/nrf_ironside/call.c index de4f59943f6a..f120c0175490 100644 --- a/soc/nordic/ironside/call.c +++ b/drivers/firmware/nrf_ironside/call.c @@ -3,9 +3,9 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include #include #include +#include #include #include #include diff --git a/soc/nordic/ironside/cpuconf.c b/drivers/firmware/nrf_ironside/cpuconf.c similarity index 92% rename from soc/nordic/ironside/cpuconf.c rename to drivers/firmware/nrf_ironside/cpuconf.c index 264772a09e25..a8377ae0f936 100644 --- a/soc/nordic/ironside/cpuconf.c +++ b/drivers/firmware/nrf_ironside/cpuconf.c @@ -9,8 +9,8 @@ #include #include -#include -#include +#include +#include #define CPU_PARAMS_CPU_OFFSET (0) #define CPU_PARAMS_CPU_MASK (0xF) diff --git a/soc/nordic/ironside/dvfs.c b/drivers/firmware/nrf_ironside/dvfs.c similarity index 97% rename from soc/nordic/ironside/dvfs.c rename to drivers/firmware/nrf_ironside/dvfs.c index 7793ff015b1e..dd1e64f6d346 100644 --- a/soc/nordic/ironside/dvfs.c +++ b/drivers/firmware/nrf_ironside/dvfs.c @@ -5,8 +5,8 @@ #include #include -#include -#include +#include +#include static enum ironside_dvfs_oppoint current_dvfs_oppoint = IRONSIDE_DVFS_OPP_HIGH; diff --git a/soc/nordic/ironside/update.c b/drivers/firmware/nrf_ironside/update.c similarity index 83% rename from soc/nordic/ironside/update.c rename to drivers/firmware/nrf_ironside/update.c index a56407a3fa14..8de21303b05c 100644 --- a/soc/nordic/ironside/update.c +++ b/drivers/firmware/nrf_ironside/update.c @@ -3,8 +3,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include -#include +#include +#include int ironside_update(const struct ironside_update_blob *update) { diff --git a/dts/bindings/misc/nordic,ironside-call.yaml b/dts/bindings/firmware/nordic,ironside-call.yaml similarity index 100% rename from dts/bindings/misc/nordic,ironside-call.yaml rename to dts/bindings/firmware/nordic,ironside-call.yaml diff --git a/soc/nordic/ironside/include/nrf_ironside/boot_report.h b/include/zephyr/drivers/firmware/nrf_ironside/boot_report.h similarity index 91% rename from soc/nordic/ironside/include/nrf_ironside/boot_report.h rename to include/zephyr/drivers/firmware/nrf_ironside/boot_report.h index 7cd512675334..509c05babcbf 100644 --- a/soc/nordic/ironside/include/nrf_ironside/boot_report.h +++ b/include/zephyr/drivers/firmware/nrf_ironside/boot_report.h @@ -3,8 +3,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -#ifndef ZEPHYR_SOC_NORDIC_IRONSIDE_INCLUDE_NRF_IRONSIDE_BOOT_REPORT_H_ -#define ZEPHYR_SOC_NORDIC_IRONSIDE_INCLUDE_NRF_IRONSIDE_BOOT_REPORT_H_ +#ifndef ZEPHYR_INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_NRF_IRONSIDE_BOOT_REPORT_H_ +#define ZEPHYR_INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_NRF_IRONSIDE_BOOT_REPORT_H_ #include #include @@ -74,4 +74,4 @@ struct ironside_boot_report { */ int ironside_boot_report_get(const struct ironside_boot_report **report); -#endif /* ZEPHYR_SOC_NORDIC_IRONSIDE_INCLUDE_NRF_IRONSIDE_BOOT_REPORT_H_ */ +#endif /* ZEPHYR_INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_NRF_IRONSIDE_BOOT_REPORT_H_ */ diff --git a/soc/nordic/ironside/include/nrf_ironside/call.h b/include/zephyr/drivers/firmware/nrf_ironside/call.h similarity index 91% rename from soc/nordic/ironside/include/nrf_ironside/call.h rename to include/zephyr/drivers/firmware/nrf_ironside/call.h index 9a2431c7d580..d67e97622025 100644 --- a/soc/nordic/ironside/include/nrf_ironside/call.h +++ b/include/zephyr/drivers/firmware/nrf_ironside/call.h @@ -3,8 +3,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -#ifndef ZEPHYR_SOC_NORDIC_IRONSIDE_INCLUDE_NRF_IRONSIDE_CALL_H_ -#define ZEPHYR_SOC_NORDIC_IRONSIDE_INCLUDE_NRF_IRONSIDE_CALL_H_ +#ifndef ZEPHYR_INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_NRF_IRONSIDE_CALL_H_ +#define ZEPHYR_INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_NRF_IRONSIDE_CALL_H_ #include @@ -79,4 +79,4 @@ void ironside_call_dispatch(struct ironside_call_buf *buf); */ void ironside_call_release(struct ironside_call_buf *buf); -#endif /* ZEPHYR_SOC_NORDIC_IRONSIDE_INCLUDE_NRF_IRONSIDE_CALL_H_ */ +#endif /* ZEPHYR_INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_NRF_IRONSIDE_CALL_H_ */ diff --git a/soc/nordic/ironside/include/nrf_ironside/cpuconf.h b/include/zephyr/drivers/firmware/nrf_ironside/cpuconf.h similarity index 89% rename from soc/nordic/ironside/include/nrf_ironside/cpuconf.h rename to include/zephyr/drivers/firmware/nrf_ironside/cpuconf.h index 49e562b13698..bed8932868fe 100644 --- a/soc/nordic/ironside/include/nrf_ironside/cpuconf.h +++ b/include/zephyr/drivers/firmware/nrf_ironside/cpuconf.h @@ -3,14 +3,14 @@ * SPDX-License-Identifier: Apache-2.0 */ -#ifndef ZEPHYR_SOC_NORDIC_IRONSIDE_INCLUDE_NRF_IRONSIDE_CPUCONF_H_ -#define ZEPHYR_SOC_NORDIC_IRONSIDE_INCLUDE_NRF_IRONSIDE_CPUCONF_H_ +#ifndef ZEPHYR_INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_NRF_IRONSIDE_CPUCONF_H_ +#define ZEPHYR_INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_NRF_IRONSIDE_CPUCONF_H_ #include #include +#include #include #include -#include /** * @name CPUCONF service error codes. @@ -71,4 +71,4 @@ BUILD_ASSERT(IRONSIDE_CPUCONF_NUM_ARGS <= NRF_IRONSIDE_CALL_NUM_ARGS); int ironside_cpuconf(NRF_PROCESSORID_Type cpu, const void *vector_table, bool cpu_wait, const uint8_t *msg, size_t msg_size); -#endif /* ZEPHYR_SOC_NORDIC_IRONSIDE_INCLUDE_NRF_IRONSIDE_CPUCONF_H_ */ +#endif /* ZEPHYR_INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_NRF_IRONSIDE_CPUCONF_H_ */ diff --git a/soc/nordic/ironside/include/nrf_ironside/dvfs.h b/include/zephyr/drivers/firmware/nrf_ironside/dvfs.h similarity index 92% rename from soc/nordic/ironside/include/nrf_ironside/dvfs.h rename to include/zephyr/drivers/firmware/nrf_ironside/dvfs.h index e2cb03c249e0..5a80f062bd76 100644 --- a/soc/nordic/ironside/include/nrf_ironside/dvfs.h +++ b/include/zephyr/drivers/firmware/nrf_ironside/dvfs.h @@ -3,8 +3,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -#ifndef ZEPHYR_SOC_NORDIC_IRONSIDE_INCLUDE_NRF_IRONSIDE_DVFS_H_ -#define ZEPHYR_SOC_NORDIC_IRONSIDE_INCLUDE_NRF_IRONSIDE_DVFS_H_ +#ifndef ZEPHYR_INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_NRF_IRONSIDE_DVFS_H_ +#define ZEPHYR_INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_NRF_IRONSIDE_DVFS_H_ #include #include @@ -89,4 +89,4 @@ static inline bool ironside_dvfs_is_oppoint_valid(enum ironside_dvfs_oppoint dvf return true; } -#endif /* ZEPHYR_SOC_NORDIC_IRONSIDE_INCLUDE_NRF_IRONSIDE_DVFS_H_ */ +#endif /* ZEPHYR_INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_NRF_IRONSIDE_DVFS_H_ */ diff --git a/soc/nordic/ironside/include/nrf_ironside/update.h b/include/zephyr/drivers/firmware/nrf_ironside/update.h similarity index 90% rename from soc/nordic/ironside/include/nrf_ironside/update.h rename to include/zephyr/drivers/firmware/nrf_ironside/update.h index 8152a77f5f7c..5da02c97e6dd 100644 --- a/soc/nordic/ironside/include/nrf_ironside/update.h +++ b/include/zephyr/drivers/firmware/nrf_ironside/update.h @@ -3,8 +3,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -#ifndef ZEPHYR_SOC_NORDIC_IRONSIDE_INCLUDE_NRF_IRONSIDE_UPDATE_H_ -#define ZEPHYR_SOC_NORDIC_IRONSIDE_INCLUDE_NRF_IRONSIDE_UPDATE_H_ +#ifndef ZEPHYR_INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_NRF_IRONSIDE_UPDATE_H_ +#define ZEPHYR_INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_NRF_IRONSIDE_UPDATE_H_ #include #include @@ -69,4 +69,4 @@ struct ironside_update_blob { */ int ironside_update(const struct ironside_update_blob *update); -#endif /* ZEPHYR_SOC_NORDIC_IRONSIDE_INCLUDE_NRF_IRONSIDE_UPDATE_H_ */ +#endif /* ZEPHYR_INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_NRF_IRONSIDE_UPDATE_H_ */ diff --git a/samples/boards/nordic/nrf_ironside/update/src/main.c b/samples/boards/nordic/nrf_ironside/update/src/main.c index 11fb88245190..17098d93d3b4 100644 --- a/samples/boards/nordic/nrf_ironside/update/src/main.c +++ b/samples/boards/nordic/nrf_ironside/update/src/main.c @@ -4,8 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include -#include +#include +#include #include LOG_MODULE_REGISTER(app, LOG_LEVEL_INF); diff --git a/soc/nordic/CMakeLists.txt b/soc/nordic/CMakeLists.txt index cba58ae51875..5aec1af88200 100644 --- a/soc/nordic/CMakeLists.txt +++ b/soc/nordic/CMakeLists.txt @@ -47,4 +47,3 @@ endif() add_subdirectory(${SOC_SERIES}) add_subdirectory(common) -add_subdirectory(ironside) diff --git a/soc/nordic/nrf54h/soc.c b/soc/nordic/nrf54h/soc.c index 0c43c6175720..e55f56242b90 100644 --- a/soc/nordic/nrf54h/soc.c +++ b/soc/nordic/nrf54h/soc.c @@ -22,7 +22,7 @@ #include #include #include -#include +#include LOG_MODULE_REGISTER(soc, CONFIG_SOC_LOG_LEVEL); From 886dda3da711cdb49478c9f0b9618de0ae1aa214 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:46 +0300 Subject: [PATCH 1162/2141] Revert "[nrf fromtree] drivers: firmware: nrf_ironside: Update the spelling" This reverts commit 049e7818669cd74d7ef545145376d4ed15c3161f. Signed-off-by: Jukka Rissanen --- ...nrf54h20dk_nrf54h20_cpuapp_iron_0_9_0.yaml | 2 +- ...nrf54h20dk_nrf54h20_cpurad_iron_0_9_0.yaml | 2 +- drivers/firmware/nrf_ironside/Kconfig | 22 +++++++++---------- drivers/firmware/nrf_ironside/dvfs.c | 6 ++--- .../firmware/nordic,ironside-call.yaml | 2 +- .../firmware/nrf_ironside/boot_report.h | 14 ++++++------ .../drivers/firmware/nrf_ironside/call.h | 8 +++---- .../drivers/firmware/nrf_ironside/cpuconf.h | 2 +- .../drivers/firmware/nrf_ironside/dvfs.h | 10 ++++----- .../drivers/firmware/nrf_ironside/update.h | 12 +++++----- .../boards/nordic/nrf_ironside/update/Kconfig | 2 +- .../nordic/nrf_ironside/update/README.rst | 20 ++++++++--------- .../nordic/nrf_ironside/update/sample.yaml | 4 ++-- .../nordic/nrf_ironside/update/src/main.c | 2 +- soc/nordic/nrf54h/Kconfig.soc | 2 +- soc/nordic/nrf92/Kconfig.soc | 2 +- 16 files changed, 56 insertions(+), 56 deletions(-) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_iron_0_9_0.yaml b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_iron_0_9_0.yaml index 563a8b4ac1b7..eefca56fe0c3 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_iron_0_9_0.yaml +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_iron_0_9_0.yaml @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 identifier: nrf54h20dk/nrf54h20/cpuapp/iron -name: nRF54H20-DK-nRF54H20-Application (IronSide compatible) (revision 0.9.0) +name: nRF54H20-DK-nRF54H20-Application (IRONside compatible) (revision 0.9.0) type: mcu arch: arm toolchain: diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_iron_0_9_0.yaml b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_iron_0_9_0.yaml index 034b9f7e27dd..ef71cfa924c0 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_iron_0_9_0.yaml +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_iron_0_9_0.yaml @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 identifier: nrf54h20dk/nrf54h20/cpurad/iron -name: nRF54H20-DK-nRF54H20-Radio (IronSide SE compatible) (revision 0.9.0) +name: nRF54H20-DK-nRF54H20-Radio (IRONside SE compatible) (revision 0.9.0) type: mcu arch: arm toolchain: diff --git a/drivers/firmware/nrf_ironside/Kconfig b/drivers/firmware/nrf_ironside/Kconfig index 8a91adf8ed0e..4c313618638e 100644 --- a/drivers/firmware/nrf_ironside/Kconfig +++ b/drivers/firmware/nrf_ironside/Kconfig @@ -5,7 +5,7 @@ config NRF_IRONSIDE bool depends on SOC_NRF54H20_IRON || SOC_NRF9280_IRON help - This is selected by drivers interacting with Nordic IronSide firmware. + This is selected by drivers interacting with Nordic IRONside firmware. config NRF_IRONSIDE_CALL bool @@ -14,44 +14,44 @@ config NRF_IRONSIDE_CALL select EVENTS select MBOX help - This is selected by features that require support for IronSide calls. + This is selected by features that require support for IRONside calls. if NRF_IRONSIDE_CALL config NRF_IRONSIDE_CALL_INIT_PRIORITY - int "IronSide calls' initialization priority" + int "IRONside calls' initialization priority" default 41 help - Initialization priority of IronSide calls. It must be below MBOX_INIT_PRIORITY, + Initialization priority of IRONside calls. It must be below MBOX_INIT_PRIORITY, but higher than the priority of any feature that selects NRF_IRONSIDE_CALL. endif # NRF_IRONSIDE_CALL -menu "Nordic IronSide services" +menu "Nordic IRONside services" depends on SOC_NRF54H20_IRON || SOC_NRF9280_IRON config NRF_IRONSIDE_CPUCONF_SERVICE - bool "IronSide CPUCONF service" + bool "IRONside CPUCONF service" depends on SOC_NRF54H20_CPUAPP || SOC_NRF9280_CPUAPP select NRF_IRONSIDE_CALL help Service used to boot local domain cores. config NRF_IRONSIDE_UPDATE_SERVICE - bool "IronSide update service" + bool "IRONside update service" select NRF_IRONSIDE_CALL help - Service used to update the IronSide SE firmware. + Service used to update the IRONside SE firmware. config NRF_IRONSIDE_BOOT_REPORT - bool "IronSide boot report" + bool "IRONside boot report" depends on $(dt_nodelabel_exists,ironside_se_boot_report) select NRF_IRONSIDE help - Support for parsing the Boot Report populated by Nordic IronSide firmware. + Support for parsing the Boot Report populated by Nordic IRONside firmware. config NRF_IRONSIDE_DVFS_SERVICE - bool "IronSide DVFS service" + bool "IRONside DVFS service" depends on SOC_NRF54H20_CPUAPP select NRF_IRONSIDE_CALL help diff --git a/drivers/firmware/nrf_ironside/dvfs.c b/drivers/firmware/nrf_ironside/dvfs.c index dd1e64f6d346..c814024b3edd 100644 --- a/drivers/firmware/nrf_ironside/dvfs.c +++ b/drivers/firmware/nrf_ironside/dvfs.c @@ -15,7 +15,7 @@ static enum ironside_dvfs_oppoint current_dvfs_oppoint = IRONSIDE_DVFS_OPP_HIGH; #define ABB_STATUSANA_LOCKED_L_Msk (0x1UL << ABB_STATUSANA_LOCKED_L_Pos) #define ABB_STATUSANA_REG_OFFSET (0x102UL) #else -#error "Unsupported SoC series for IronSide DVFS" +#error "Unsupported SoC series for IRONside DVFS" #endif struct dvfs_hsfll_data_t { @@ -133,8 +133,8 @@ static inline bool ironside_dvfs_is_abb_locked(NRF_ABB_Type *abb) } /** - * @brief Request DVFS oppoint change from IronSide secure domain. - * This function will send a request over IPC to the IronSide secure domain + * @brief Request DVFS oppoint change from IRONside secure domain. + * This function will send a request over IPC to the IRONside secure domain * This function is synchronous and will return when the request is completed. * * @param oppoint @ref enum ironside_dvfs_oppoint diff --git a/dts/bindings/firmware/nordic,ironside-call.yaml b/dts/bindings/firmware/nordic,ironside-call.yaml index a2605ff22943..14f39cb0b74c 100644 --- a/dts/bindings/firmware/nordic,ironside-call.yaml +++ b/dts/bindings/firmware/nordic,ironside-call.yaml @@ -1,7 +1,7 @@ # Copyright (c) 2025 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -description: IPC configuration for Nordic IronSide calls +description: IPC configuration for Nordic IRONside calls compatible: "nordic,ironside-call" diff --git a/include/zephyr/drivers/firmware/nrf_ironside/boot_report.h b/include/zephyr/drivers/firmware/nrf_ironside/boot_report.h index 509c05babcbf..8a209b8788da 100644 --- a/include/zephyr/drivers/firmware/nrf_ironside/boot_report.h +++ b/include/zephyr/drivers/firmware/nrf_ironside/boot_report.h @@ -9,14 +9,14 @@ #include #include -/** Constant used to check if an Nordic IronSide SE boot report has been written. */ +/** Constant used to check if an Nordic IRONside SE boot report has been written. */ #define IRONSIDE_BOOT_REPORT_MAGIC (0x4d69546fUL) /** Length of the local domain context buffer in bytes. */ #define IRONSIDE_BOOT_REPORT_LOCAL_DOMAIN_CONTEXT_SIZE (16UL) /** Length of the random data buffer in bytes. */ #define IRONSIDE_BOOT_REPORT_RANDOM_DATA_SIZE (32UL) -/** @brief IronSide version structure. */ +/** @brief IRONside version structure. */ struct ironside_version { /** Wrapping sequence number ranging from 1-126, incremented for each release. */ uint8_t seqnum; @@ -43,13 +43,13 @@ struct ironside_boot_report_uicr_error { } description; }; -/** @brief IronSide boot report. */ +/** @brief IRONside boot report. */ struct ironside_boot_report { /** Magic value used to identify valid boot report */ uint32_t magic; - /** Firmware version of IronSide SE. */ + /** Firmware version of IRONside SE. */ struct ironside_version ironside_se_version; - /** Firmware version of IronSide SE recovery firmware. */ + /** Firmware version of IRONside SE recovery firmware. */ struct ironside_version ironside_se_recovery_version; /** Copy of SICR.UROT.UPDATE.STATUS.*/ uint32_t ironside_update_status; @@ -64,9 +64,9 @@ struct ironside_boot_report { }; /** - * @brief Get a pointer to the IronSide boot report. + * @brief Get a pointer to the IRONside boot report. * - * @param[out] report Will be set to point to the IronSide boot report. + * @param[out] report Will be set to point to the IRONside boot report. * * @retval 0 if successful. * @retval -EFAULT if the magic field in the report is incorrect. diff --git a/include/zephyr/drivers/firmware/nrf_ironside/call.h b/include/zephyr/drivers/firmware/nrf_ironside/call.h index d67e97622025..178b9371cdb7 100644 --- a/include/zephyr/drivers/firmware/nrf_ironside/call.h +++ b/include/zephyr/drivers/firmware/nrf_ironside/call.h @@ -8,7 +8,7 @@ #include -/** @brief Maximum number of arguments to an IronSide call. +/** @brief Maximum number of arguments to an IRONside call. * * This is chosen so that the containing message buffer size is minimal but * cache line aligned. @@ -50,7 +50,7 @@ struct ironside_call_buf { */ /** - * @brief Allocate memory for an IronSide call. + * @brief Allocate memory for an IRONside call. * * This function will block when no buffers are available, until one is * released by another thread on the client side. @@ -60,7 +60,7 @@ struct ironside_call_buf { struct ironside_call_buf *ironside_call_alloc(void); /** - * @brief Dispatch an IronSide call. + * @brief Dispatch an IRONside call. * * This function will block until a response is received from the server. * @@ -71,7 +71,7 @@ struct ironside_call_buf *ironside_call_alloc(void); void ironside_call_dispatch(struct ironside_call_buf *buf); /** - * @brief Release an IronSide call buffer. + * @brief Release an IRONside call buffer. * * This function must be called after processing the response. * diff --git a/include/zephyr/drivers/firmware/nrf_ironside/cpuconf.h b/include/zephyr/drivers/firmware/nrf_ironside/cpuconf.h index bed8932868fe..d769a319def7 100644 --- a/include/zephyr/drivers/firmware/nrf_ironside/cpuconf.h +++ b/include/zephyr/drivers/firmware/nrf_ironside/cpuconf.h @@ -63,7 +63,7 @@ BUILD_ASSERT(IRONSIDE_CPUCONF_NUM_ARGS <= NRF_IRONSIDE_CALL_NUM_ARGS); * If the given msg_size is less than that, the remaining bytes are set to zero. * * @retval 0 on success or if the CPU has already booted. - * @retval Positive non-0 error status if reported by IronSide call. + * @retval Positive non-0 error status if reported by IRONside call. * @retval -IRONSIDE_CPUCONF_ERROR_WRONG_CPU if cpu is unrecognized * @retval -IRONSIDE_CPUCONF_ERROR_MESSAGE_TOO_LARGE if msg_size is greater than * IRONSIDE_CPUCONF_SERVICE_MSG_MAX_SIZE. diff --git a/include/zephyr/drivers/firmware/nrf_ironside/dvfs.h b/include/zephyr/drivers/firmware/nrf_ironside/dvfs.h index 5a80f062bd76..7d6587bb3c0c 100644 --- a/include/zephyr/drivers/firmware/nrf_ironside/dvfs.h +++ b/include/zephyr/drivers/firmware/nrf_ironside/dvfs.h @@ -18,15 +18,15 @@ enum ironside_dvfs_oppoint { }; /** - * @brief Number of DVFS oppoints supported by IronSide. + * @brief Number of DVFS oppoints supported by IRONside. * - * This is the number of different DVFS oppoints that can be set on IronSide. + * This is the number of different DVFS oppoints that can be set on IRONside. * The oppoints are defined in the `ironside_dvfs_oppoint` enum. */ #define IRONSIDE_DVFS_OPPOINT_COUNT (3) /** - * @name IronSide DVFS service error codes. + * @name IRONside DVFS service error codes. * @{ */ @@ -49,10 +49,10 @@ enum ironside_dvfs_oppoint { * @} */ -/* IronSide call identifiers with implicit versions. +/* IRONside call identifiers with implicit versions. * * With the initial "version 0", the service ABI is allowed to break until the - * first production release of IronSide SE. + * first production release of IRONside SE. */ #define IRONSIDE_CALL_ID_DVFS_SERVICE_V0 3 diff --git a/include/zephyr/drivers/firmware/nrf_ironside/update.h b/include/zephyr/drivers/firmware/nrf_ironside/update.h index 5da02c97e6dd..62191b3285b3 100644 --- a/include/zephyr/drivers/firmware/nrf_ironside/update.h +++ b/include/zephyr/drivers/firmware/nrf_ironside/update.h @@ -30,10 +30,10 @@ /** Length of the update signature in bytes. */ #define IRONSIDE_UPDATE_SIGNATURE_LENGTH (64) -/* IronSide call identifiers with implicit versions. +/* IRONside call identifiers with implicit versions. * * With the initial "version 0", the service ABI is allowed to break until the - * first production release of IronSide SE. + * first production release of IRONside SE. */ #define IRONSIDE_CALL_ID_UPDATE_SERVICE_V0 1 @@ -43,7 +43,7 @@ #define IRONSIDE_UPDATE_SERVICE_RETCODE_IDX (0) /** - * @brief IronSide update blob. + * @brief IRONside update blob. */ struct ironside_update_blob { uint8_t manifest[IRONSIDE_UPDATE_MANIFEST_LENGTH]; @@ -53,9 +53,9 @@ struct ironside_update_blob { }; /** - * @brief Request a firmware upgrade of the IronSide SE. + * @brief Request a firmware upgrade of the IRONside SE. * - * This invokes the IronSide SE update service. The device must be restarted for the update + * This invokes the IRONside SE update service. The device must be restarted for the update * to be installed. Check the update status in the application boot report to see if the update * was successfully installed. * @@ -63,7 +63,7 @@ struct ironside_update_blob { * * @retval -IRONSIDE_UPDATE_ERROR_NOT_PERMITTED if missing access to the update candidate. * @retval -IRONSIDE_UPDATE_ERROR_SICR_WRITE_FAILED if writing update parameters to SICR failed. - * @returns Positive non-0 error status if reported by IronSide call. + * @returns Positive non-0 error status if reported by IRONside call. * @returns 0 on a successful request (although the update itself may still fail). * */ diff --git a/samples/boards/nordic/nrf_ironside/update/Kconfig b/samples/boards/nordic/nrf_ironside/update/Kconfig index 12d3350ef79a..702b943ff607 100644 --- a/samples/boards/nordic/nrf_ironside/update/Kconfig +++ b/samples/boards/nordic/nrf_ironside/update/Kconfig @@ -6,6 +6,6 @@ config UPDATE_BLOB_ADDRESS default 0xe100000 help Address of the update blob. The default value matches the placement of the - update blobs delivered with the IronSide SE firmware. + update blobs delivered with the IRONside SE firmware. source "Kconfig.zephyr" diff --git a/samples/boards/nordic/nrf_ironside/update/README.rst b/samples/boards/nordic/nrf_ironside/update/README.rst index af72d23f3917..2f44feedf067 100644 --- a/samples/boards/nordic/nrf_ironside/update/README.rst +++ b/samples/boards/nordic/nrf_ironside/update/README.rst @@ -1,24 +1,24 @@ .. zephyr:code-sample:: nrf_ironside_update - :name: Nordic IronSide SE firmware update + :name: Nordic IRONside SE firmware update - Update the Nordic IronSide SE firmware. + Update the Nordic IRONside SE firmware. Overview ******** -The Nordic IronSide SE Update sample updates the IronSide SE firmware on a SoC that already has IronSide SE installed. -It can update both the main image and the recovery image of IronSide SE using the IronSide SE firmware release ZIP file. +The Nordic IRONside SE Update sample updates the IRONside SE firmware on a SoC that already has IRONside SE installed. +It can update both the main image and the recovery image of IRONside SE using the IRONside SE firmware release ZIP file. Update procedure **************** The update procedure works as follows: -1. The application invokes the IronSide SE update service and passes the parameters that correspond to the location of the HEX file of the IronSide SE firmware update. +1. The application invokes the IRONside SE update service and passes the parameters that correspond to the location of the HEX file of the IRONside SE firmware update. #. The application prints the return value of the service call and outputs information from the update HEX file. -#. After the service call completes, the IronSide SE firmware updates the internal state of the device. +#. After the service call completes, the IRONside SE firmware updates the internal state of the device. #. The firmware installs the update during the next device boot. This operation can take several seconds. @@ -29,9 +29,9 @@ Building and running the application for nrf54h20dk/nrf54h20/cpuapp/iron ************************************************************************ .. note:: - You can use this application only when there is already a version of IronSide SE installed on the device. + You can use this application only when there is already a version of IRONside SE installed on the device. -1. Unzip the IronSide SE release ZIP to get the update hex file: +1. Unzip the IRONside SE release ZIP to get the update hex file: .. code-block:: console @@ -39,13 +39,13 @@ Building and running the application for nrf54h20dk/nrf54h20/cpuapp/iron #. Program the appropriate update hex file from the release ZIP using one (not both) of the following commands: - a) To update IronSide SE firmware: + a) To update IRONside SE firmware: .. code-block:: console nrfutil device program --traits jlink --firmware update/ironside_se_update.hex - b) To update IronSide SE recovery firmware: + b) To update IRONside SE recovery firmware: .. code-block:: console diff --git a/samples/boards/nordic/nrf_ironside/update/sample.yaml b/samples/boards/nordic/nrf_ironside/update/sample.yaml index cc127d9eb6dd..af3c24624b88 100644 --- a/samples/boards/nordic/nrf_ironside/update/sample.yaml +++ b/samples/boards/nordic/nrf_ironside/update/sample.yaml @@ -1,6 +1,6 @@ sample: - name: Nordic IronSide SE update service - description: Demonstrates how to update the Nordic IronSide SE firmware + name: Nordic IRONside SE update service + description: Demonstrates how to update the Nordic IRONside SE firmware common: build_only: true tags: nrf_ironside diff --git a/samples/boards/nordic/nrf_ironside/update/src/main.c b/samples/boards/nordic/nrf_ironside/update/src/main.c index 17098d93d3b4..a06603ca9b28 100644 --- a/samples/boards/nordic/nrf_ironside/update/src/main.c +++ b/samples/boards/nordic/nrf_ironside/update/src/main.c @@ -28,7 +28,7 @@ int main(void) LOG_HEXDUMP_INF((void *)report->random_data, sizeof(report->random_data), "random data"); err = ironside_update(update); - LOG_INF("IronSide update retval: 0x%x", err); + LOG_INF("IRONside update retval: 0x%x", err); if (err == 0) { LOG_HEXDUMP_INF(update->manifest, sizeof(update->manifest), "Update manifest:"); diff --git a/soc/nordic/nrf54h/Kconfig.soc b/soc/nordic/nrf54h/Kconfig.soc index 62d5293bfe32..ac9101c177ca 100644 --- a/soc/nordic/nrf54h/Kconfig.soc +++ b/soc/nordic/nrf54h/Kconfig.soc @@ -36,7 +36,7 @@ config SOC_NRF54H20_CPUFLPR config SOC_NRF54H20_IRON bool help - Indicates that local domain firmware is compatible with Nordic IronSide SE. + Indicates that local domain firmware is compatible with Nordic IRONside SE. config SOC default "nrf54h20" if SOC_NRF54H20 diff --git a/soc/nordic/nrf92/Kconfig.soc b/soc/nordic/nrf92/Kconfig.soc index 6ad2fb8a0147..49891687a297 100644 --- a/soc/nordic/nrf92/Kconfig.soc +++ b/soc/nordic/nrf92/Kconfig.soc @@ -65,7 +65,7 @@ config SOC_NRF9280_CPUPPR config SOC_NRF9280_IRON bool help - Indicates that local domain firmware is compatible with Nordic IronSide SE. + Indicates that local domain firmware is compatible with Nordic IRONside SE. config SOC default "nrf9280" if SOC_NRF9280 From b0efafda4ec271cabe0ed06ae376ec268d4c2f11 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:46 +0300 Subject: [PATCH 1163/2141] Revert "[nrf fromtree] drivers: nrf_ironside: dvfs abb analog status workaround" This reverts commit f2a9184cfbe788df5ee926fcbdc20d6d1d975d78. Signed-off-by: Jukka Rissanen --- drivers/firmware/nrf_ironside/dvfs.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/drivers/firmware/nrf_ironside/dvfs.c b/drivers/firmware/nrf_ironside/dvfs.c index c814024b3edd..89208f71fb7d 100644 --- a/drivers/firmware/nrf_ironside/dvfs.c +++ b/drivers/firmware/nrf_ironside/dvfs.c @@ -10,14 +10,6 @@ static enum ironside_dvfs_oppoint current_dvfs_oppoint = IRONSIDE_DVFS_OPP_HIGH; -#if defined(CONFIG_SOC_SERIES_NRF54HX) -#define ABB_STATUSANA_LOCKED_L_Pos (0UL) -#define ABB_STATUSANA_LOCKED_L_Msk (0x1UL << ABB_STATUSANA_LOCKED_L_Pos) -#define ABB_STATUSANA_REG_OFFSET (0x102UL) -#else -#error "Unsupported SoC series for IRONside DVFS" -#endif - struct dvfs_hsfll_data_t { uint32_t new_f_mult; uint32_t new_f_trim_entry; @@ -126,10 +118,7 @@ static void ironside_dvfs_change_oppoint_complete(enum ironside_dvfs_oppoint dvf static inline bool ironside_dvfs_is_abb_locked(NRF_ABB_Type *abb) { /* Check if ABB analog part is locked. */ - /* Temporary workaround until STATUSANA register is visible. */ - volatile const uint32_t *statusana = (uint32_t *)abb + ABB_STATUSANA_REG_OFFSET; - - return ((*statusana & ABB_STATUSANA_LOCKED_L_Msk) != 0); + return ((abb->STATUSANA & ABB_STATUSANA_LOCKED_Msk) != 0); } /** From 8d8f9cdf73f6c1e9781c892b3e687c5050265ee3 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:46 +0300 Subject: [PATCH 1164/2141] Revert "[nrf fromtree] drivers: firmware: TISCI driver support" This reverts commit 4d841693325072528d19cbf11d5d2820701250b1. Signed-off-by: Jukka Rissanen --- drivers/firmware/CMakeLists.txt | 1 - drivers/firmware/Kconfig | 1 - drivers/firmware/tisci/CMakeLists.txt | 6 - drivers/firmware/tisci/Kconfig | 22 - drivers/firmware/tisci/tisci.c | 1602 --------------- drivers/firmware/tisci/tisci.h | 1820 ----------------- dts/bindings/firmware/ti,k2g-sci.yaml | 25 - include/zephyr/drivers/firmware/tisci/tisci.h | 1037 ---------- 8 files changed, 4514 deletions(-) delete mode 100644 drivers/firmware/tisci/CMakeLists.txt delete mode 100644 drivers/firmware/tisci/Kconfig delete mode 100644 drivers/firmware/tisci/tisci.c delete mode 100644 drivers/firmware/tisci/tisci.h delete mode 100644 dts/bindings/firmware/ti,k2g-sci.yaml delete mode 100644 include/zephyr/drivers/firmware/tisci/tisci.h diff --git a/drivers/firmware/CMakeLists.txt b/drivers/firmware/CMakeLists.txt index caed354c3972..062106cf92b3 100644 --- a/drivers/firmware/CMakeLists.txt +++ b/drivers/firmware/CMakeLists.txt @@ -3,5 +3,4 @@ # zephyr-keep-sorted-start add_subdirectory_ifdef(CONFIG_ARM_SCMI scmi) add_subdirectory_ifdef(CONFIG_NRF_IRONSIDE nrf_ironside) -add_subdirectory_ifdef(CONFIG_TISCI tisci) # zephyr-keep-sorted-stop diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig index 3c92ec3bb6e2..3e3afe9ffdd2 100644 --- a/drivers/firmware/Kconfig +++ b/drivers/firmware/Kconfig @@ -13,7 +13,6 @@ config ARM_SCMI # zephyr-keep-sorted-start source "drivers/firmware/nrf_ironside/Kconfig" source "drivers/firmware/scmi/Kconfig" -source "drivers/firmware/tisci/Kconfig" # zephyr-keep-sorted-stop endmenu diff --git a/drivers/firmware/tisci/CMakeLists.txt b/drivers/firmware/tisci/CMakeLists.txt deleted file mode 100644 index 29d27c0f3f5f..000000000000 --- a/drivers/firmware/tisci/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright (c) 2025, Texas Instruments -# SPDX-License-Identifier: Apache-2.0 - -zephyr_library() - -zephyr_library_sources_ifdef(CONFIG_TISCI tisci.c) diff --git a/drivers/firmware/tisci/Kconfig b/drivers/firmware/tisci/Kconfig deleted file mode 100644 index 2cce10593419..000000000000 --- a/drivers/firmware/tisci/Kconfig +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright (c) 2025, Texas Instruments -# SPDX-License-Identifier: Apache-2.0 - -config TISCI - bool "TISCI Firmware driver" - default y - depends on DT_HAS_TI_K2G_SCI_ENABLED - select MBOX - help - TISCI firmware driver is a frontend interface - to TI System Controller interface firmware through - secureproxy mailbox. - -if TISCI - -config TISCI_INIT_PRIORITY - int "TISCI init priority" - default KERNEL_INIT_PRIORITY_OBJECTS - help - Init priority for the TISCI driver. - -endif diff --git a/drivers/firmware/tisci/tisci.c b/drivers/firmware/tisci/tisci.c deleted file mode 100644 index 0206289bcbed..000000000000 --- a/drivers/firmware/tisci/tisci.c +++ /dev/null @@ -1,1602 +0,0 @@ -/* - * Copyright (c) 2025, Texas Instruments - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#define DT_DRV_COMPAT ti_k2g_sci -#include -#include -#include "tisci.h" -#include -#include -#include -#define LOG_LEVEL CONFIG_MBOX_LOG_LEVEL -#include -LOG_MODULE_REGISTER(ti_k2g_sci); - -/** - * @struct tisci_config - TISCI device configuration structure - * @mbox_tx: Mailbox transmit channel specification. - * @mbox_rx: Mailbox receive channel specification. - * @host_id: Host ID for the device. - * @max_msg_size: Maximum supported message size in bytes. - * @max_rx_timeout_ms: Maximum receive timeout in milliseconds. - */ -struct tisci_config { - struct mbox_dt_spec mbox_tx; - struct mbox_dt_spec mbox_rx; - uint32_t host_id; - int max_msg_size; - int max_rx_timeout_ms; -}; - -/** - * @struct tisci_xfer - TISCI transfer details - * @param tx_message: Transmit message - * @param rx_message: Received message - */ -struct tisci_xfer { - struct mbox_msg tx_message; - struct rx_msg rx_message; -}; - -/** - * @struct tisci_data - Runtime data for TISCI device communication - * @xfer: Structure holding the current transfer details, including buffers and status. - * @seq: Current transfer sequence number, used to track message order. - * @rx_message: Structure for storing the most recently received message. - * @data_sem: Semaphore used to synchronize access to the data structure. - */ -struct tisci_data { - struct tisci_xfer xfer; - uint8_t seq; - struct rx_msg rx_message; - struct k_sem data_sem; -}; - -/* Core/Setup Functions */ -static struct tisci_xfer *tisci_setup_one_xfer(const struct device *dev, uint16_t msg_type, - uint32_t msg_flags, void *req_buf, - size_t tx_message_size, void *resp_buf, - size_t rx_message_size) -{ - struct tisci_data *data = dev->data; - - k_sem_take(&data->data_sem, K_FOREVER); - - const struct tisci_config *config = dev->config; - struct tisci_xfer *xfer = &data->xfer; - struct tisci_msg_hdr *hdr; - - if (rx_message_size > config->max_msg_size || tx_message_size > config->max_msg_size || - (rx_message_size > 0 && rx_message_size < sizeof(*hdr)) || - tx_message_size < sizeof(*hdr)) { - return NULL; - } - - data->seq++; - - xfer->tx_message.data = req_buf; - xfer->tx_message.size = tx_message_size; - xfer->rx_message.buf = resp_buf; - xfer->rx_message.size = (uint8_t)rx_message_size; - - hdr = (struct tisci_msg_hdr *)req_buf; - hdr->seq = data->seq; - hdr->type = msg_type; - hdr->host = config->host_id; - hdr->flags = msg_flags; - - if (rx_message_size) { - hdr->flags = hdr->flags | TISCI_FLAG_REQ_ACK_ON_PROCESSED; - } - - return xfer; -} - -static void callback(const struct device *dev, mbox_channel_id_t channel_id, void *user_data, - struct mbox_msg *mbox_data) -{ - struct rx_msg *msg = user_data; - - k_sem_give(msg->response_ready_sem); -} - -static bool tisci_is_response_ack(void *r) -{ - struct tisci_msg_hdr *hdr = (struct tisci_msg_hdr *)r; - - return hdr->flags & TISCI_FLAG_RESP_GENERIC_ACK ? true : false; -} - -static int tisci_get_response(const struct device *dev, struct tisci_xfer *xfer) -{ - if (!dev) { - return -EINVAL; - } - - struct tisci_data *data = dev->data; - const struct tisci_config *config = dev->config; - struct tisci_msg_hdr *hdr; - - if (!xfer->rx_message.buf) { - LOG_ERR("No response buffer provided"); - return -EINVAL; - } - - if (k_sem_take(data->rx_message.response_ready_sem, K_MSEC(config->max_rx_timeout_ms)) != - 0) { - LOG_ERR("Timeout waiting for response"); - return -ETIMEDOUT; - } - - if (xfer->rx_message.size > config->max_msg_size) { - LOG_ERR("rx_message.size [ %d ] > max_msg_size\n", xfer->rx_message.size); - return -EINVAL; - } - - if (data->rx_message.size < xfer->rx_message.size) { - LOG_ERR("rx_message.size [ %d ] < xfer->rx_message.size\n", data->rx_message.size); - return -EINVAL; - } - - memcpy(xfer->rx_message.buf, data->rx_message.buf, xfer->rx_message.size); - hdr = (struct tisci_msg_hdr *)xfer->rx_message.buf; - - /* Sanity check for message response */ - if (hdr->seq != data->seq) { - LOG_ERR("HDR seq != data seq [%d != %d]\n", hdr->seq, data->seq); - return -EINVAL; - } - - k_sem_give(&data->data_sem); - return 0; -} - -static int tisci_do_xfer(const struct device *dev, struct tisci_xfer *xfer) -{ - if (!dev) { - return -EINVAL; - } - - const struct tisci_config *config = dev->config; - struct mbox_msg *msg = &xfer->tx_message; - int ret; - - ret = mbox_send_dt(&config->mbox_tx, msg); - if (ret < 0) { - LOG_ERR("Could not send (%d)\n", ret); - return ret; - } - - /* Get response if requested */ - if (xfer->rx_message.size) { - ret = tisci_get_response(dev, xfer); - if (ret) { - return ret; - } - if (!tisci_is_response_ack(xfer->rx_message.buf)) { - LOG_ERR("TISCI Response in NACK\n"); - return -ENODEV; - } - } - - return 0; -} - -/* Clock Management Functions */ -int tisci_cmd_get_clock_state(const struct device *dev, uint32_t dev_id, uint8_t clk_id, - uint8_t *programmed_state, uint8_t *current_state) -{ - struct tisci_msg_resp_get_clock_state resp; - struct tisci_msg_req_get_clock_state req; - struct tisci_xfer *xfer; - int ret; - - if (!programmed_state && !current_state) { - return -EINVAL; - } - - xfer = tisci_setup_one_xfer(dev, TISCI_MSG_GET_CLOCK_STATE, 0, &req, sizeof(req), &resp, - sizeof(resp)); - if (!xfer) { - LOG_ERR("Failed to setup transfer"); - return -EINVAL; - } - - req.dev_id = dev_id; - req.clk_id = clk_id; - ret = tisci_do_xfer(dev, xfer); - if (ret) { - LOG_ERR("Failed to get clock state (ret=%d)", ret); - return ret; - } - - if (programmed_state) { - *programmed_state = resp.programmed_state; - } - if (current_state) { - *current_state = resp.current_state; - } - return 0; -} - -int tisci_cmd_clk_is_auto(const struct device *dev, uint32_t dev_id, uint8_t clk_id, - bool *req_state) -{ - uint8_t state = 0; - int ret; - - if (!req_state) { - return -EINVAL; - } - - ret = tisci_cmd_get_clock_state(dev, dev_id, clk_id, &state, NULL); - if (ret) { - return ret; - } - - *req_state = (state == MSG_CLOCK_SW_STATE_AUTO); - return 0; -} - -int tisci_cmd_clk_is_on(const struct device *dev, uint32_t dev_id, uint8_t clk_id, bool *req_state, - bool *curr_state) -{ - uint8_t c_state = 0, r_state = 0; - int ret; - - if (!req_state && !curr_state) { - return -EINVAL; - } - - ret = tisci_cmd_get_clock_state(dev, dev_id, clk_id, &r_state, &c_state); - if (ret) { - return ret; - } - - if (req_state) { - *req_state = (r_state == MSG_CLOCK_SW_STATE_REQ); - } - if (curr_state) { - *curr_state = (c_state == MSG_CLOCK_HW_STATE_READY); - } - return 0; -} - -int tisci_cmd_clk_is_off(const struct device *dev, uint32_t dev_id, uint8_t clk_id, bool *req_state, - bool *curr_state) -{ - uint8_t c_state = 0, r_state = 0; - int ret; - - if (!req_state && !curr_state) { - return -EINVAL; - } - - ret = tisci_cmd_get_clock_state(dev, dev_id, clk_id, &r_state, &c_state); - if (ret) { - return ret; - } - - if (req_state) { - *req_state = (r_state == MSG_CLOCK_SW_STATE_UNREQ); - } - if (curr_state) { - *curr_state = (c_state == MSG_CLOCK_HW_STATE_NOT_READY); - } - return 0; -} - -int tisci_cmd_clk_get_match_freq(const struct device *dev, uint32_t dev_id, uint8_t clk_id, - uint64_t min_freq, uint64_t target_freq, uint64_t max_freq, - uint64_t *match_freq) -{ - struct tisci_msg_resp_query_clock_freq resp; - struct tisci_msg_req_query_clock_freq req; - struct tisci_xfer *xfer; - int ret; - - if (!match_freq) { - return -EINVAL; - } - - xfer = tisci_setup_one_xfer(dev, TISCI_MSG_QUERY_CLOCK_FREQ, 0, &req, sizeof(req), &resp, - sizeof(resp)); - if (!xfer) { - LOG_ERR("Failed to setup transfer"); - return -EINVAL; - } - - req.dev_id = dev_id; - req.clk_id = clk_id; - req.min_freq_hz = min_freq; - req.target_freq_hz = target_freq; - req.max_freq_hz = max_freq; - - ret = tisci_do_xfer(dev, xfer); - if (ret) { - LOG_ERR("Failed to get matching clock frequency (ret=%d)", ret); - return ret; - } - - *match_freq = resp.freq_hz; - - return 0; -} - -int tisci_cmd_clk_set_freq(const struct device *dev, uint32_t dev_id, uint8_t clk_id, - uint64_t min_freq, uint64_t target_freq, uint64_t max_freq) -{ - struct tisci_msg_req_set_clock_freq req; - struct tisci_msg_resp_set_clock_freq resp; - struct tisci_xfer *xfer; - int ret; - - xfer = tisci_setup_one_xfer(dev, TISCI_MSG_SET_CLOCK_FREQ, 0, &req, sizeof(req), &resp, - sizeof(resp)); - if (!xfer) { - LOG_ERR("Failed to setup transfer"); - return -EINVAL; - } - - req.dev_id = dev_id; - req.clk_id = clk_id; - req.min_freq_hz = min_freq; - req.target_freq_hz = target_freq; - req.max_freq_hz = max_freq; - - ret = tisci_do_xfer(dev, xfer); - if (ret) { - LOG_ERR("Failed to set clock frequency (ret=%d)", ret); - return ret; - } - - return 0; -} - -int tisci_cmd_clk_get_freq(const struct device *dev, uint32_t dev_id, uint8_t clk_id, - uint64_t *freq) -{ - struct tisci_msg_resp_get_clock_freq resp; - struct tisci_msg_req_get_clock_freq req; - struct tisci_xfer *xfer; - int ret; - - if (!freq) { - return -EINVAL; - } - - xfer = tisci_setup_one_xfer(dev, TISCI_MSG_GET_CLOCK_FREQ, 0, &req, sizeof(req), &resp, - sizeof(resp)); - if (!xfer) { - LOG_ERR("Failed to setup transfer"); - return -EINVAL; - } - - req.dev_id = dev_id; - req.clk_id = clk_id; - - ret = tisci_do_xfer(dev, xfer); - if (ret) { - LOG_ERR("Failed to get clock frequency (ret=%d)", ret); - return ret; - } - - *freq = resp.freq_hz; - - return 0; -} - -int tisci_set_clock_state(const struct device *dev, uint32_t dev_id, uint8_t clk_id, uint32_t flags, - uint8_t state) -{ - struct tisci_msg_req_set_clock_state req; - struct tisci_msg_resp_set_clock_state resp; - struct tisci_xfer *xfer; - int ret; - - xfer = tisci_setup_one_xfer(dev, TISCI_MSG_SET_CLOCK_STATE, flags, &req, sizeof(req), &resp, - sizeof(resp)); - if (!xfer) { - LOG_ERR("Failed to setup transfer"); - return -EINVAL; - } - - req.dev_id = dev_id; - req.clk_id = clk_id; - req.request_state = state; - - ret = tisci_do_xfer(dev, xfer); - if (ret) { - LOG_ERR("Failed to set clock state (ret=%d)", ret); - return ret; - } - - return 0; -} - -int tisci_cmd_clk_set_parent(const struct device *dev, uint32_t dev_id, uint8_t clk_id, - uint8_t parent_id) -{ - struct tisci_msg_req_set_clock_parent req; - struct tisci_msg_resp_set_clock_parent resp; - struct tisci_xfer *xfer; - int ret; - - xfer = tisci_setup_one_xfer(dev, TISCI_MSG_SET_CLOCK_PARENT, 0, &req, sizeof(req), &resp, - sizeof(resp)); - - req.dev_id = dev_id; - req.clk_id = clk_id; - req.parent_id = parent_id; - - ret = tisci_do_xfer(dev, xfer); - if (ret) { - LOG_ERR("Failed to set clock parent (ret=%d)", ret); - return ret; - } - - return 0; -} - -int tisci_cmd_clk_get_parent(const struct device *dev, uint32_t dev_id, uint8_t clk_id, - uint8_t *parent_id) -{ - struct tisci_msg_resp_get_clock_parent resp; - struct tisci_msg_req_get_clock_parent req; - struct tisci_xfer *xfer; - int ret; - - if (!parent_id) { - return -EINVAL; - } - - xfer = tisci_setup_one_xfer(dev, TISCI_MSG_GET_CLOCK_PARENT, 0, &req, sizeof(req), &resp, - sizeof(resp)); - if (!xfer) { - LOG_ERR("Failed to setup transfer"); - return -EINVAL; - } - - req.dev_id = dev_id; - req.clk_id = clk_id; - - ret = tisci_do_xfer(dev, xfer); - if (ret) { - LOG_ERR("Failed to get clock parent (ret=%d)", ret); - return ret; - } - - *parent_id = resp.parent_id; - - return 0; -} - -int tisci_cmd_clk_get_num_parents(const struct device *dev, uint32_t dev_id, uint8_t clk_id, - uint8_t *num_parents) -{ - struct tisci_msg_resp_get_clock_num_parents resp; - struct tisci_msg_req_get_clock_num_parents req; - struct tisci_xfer *xfer; - int ret; - - if (!num_parents) { - return -EINVAL; - } - - xfer = tisci_setup_one_xfer(dev, TISCI_MSG_GET_NUM_CLOCK_PARENTS, 0, &req, sizeof(req), - &resp, sizeof(resp)); - if (!xfer) { - LOG_ERR("Failed to setup transfer"); - return -EINVAL; - } - - req.dev_id = dev_id; - req.clk_id = clk_id; - - ret = tisci_do_xfer(dev, xfer); - if (ret) { - LOG_ERR("Failed to get number of clock parents (ret=%d)", ret); - return ret; - } - - *num_parents = resp.num_parents; - - return 0; -} - -int tisci_cmd_get_clock(const struct device *dev, uint32_t dev_id, uint8_t clk_id, bool needs_ssc, - bool can_change_freq, bool enable_input_term) -{ - uint32_t flags = 0; - - flags |= needs_ssc ? MSG_FLAG_CLOCK_ALLOW_SSC : 0; - flags |= can_change_freq ? MSG_FLAG_CLOCK_ALLOW_FREQ_CHANGE : 0; - flags |= enable_input_term ? MSG_FLAG_CLOCK_INPUT_TERM : 0; - - return tisci_set_clock_state(dev, dev_id, clk_id, flags, MSG_CLOCK_SW_STATE_REQ); -} - -int tisci_cmd_idle_clock(const struct device *dev, uint32_t dev_id, uint8_t clk_id) -{ - - return tisci_set_clock_state(dev, dev_id, clk_id, 0, MSG_CLOCK_SW_STATE_UNREQ); -} - -int tisci_cmd_put_clock(const struct device *dev, uint32_t dev_id, uint8_t clk_id) -{ - - return tisci_set_clock_state(dev, dev_id, clk_id, 0, MSG_CLOCK_SW_STATE_UNREQ); -} - -/* Device Management Functions */ -int tisci_set_device_state(const struct device *dev, uint32_t dev_id, uint32_t flags, uint8_t state) -{ - struct tisci_msg_req_set_device_state req; - struct tisci_msg_resp_set_device_state resp; - struct tisci_xfer *xfer; - int ret; - - xfer = tisci_setup_one_xfer(dev, TISCI_MSG_SET_DEVICE_STATE, flags, &req, sizeof(req), - &resp, sizeof(resp)); - if (!xfer) { - LOG_ERR("Failed to setup transfer"); - return -EINVAL; - } - - req.id = dev_id; - req.state = state; - - ret = tisci_do_xfer(dev, xfer); - if (ret) { - LOG_ERR("Failed to set device state (ret=%d)", ret); - return ret; - } - - return 0; -} - -int tisci_set_device_state_no_wait(const struct device *dev, uint32_t dev_id, uint32_t flags, - uint8_t state) -{ - struct tisci_msg_req_set_device_state req; - struct tisci_msg_resp_set_device_state resp; - struct tisci_xfer *xfer; - int ret; - - xfer = tisci_setup_one_xfer(dev, TISCI_MSG_SET_DEVICE_STATE, - flags | TISCI_FLAG_REQ_GENERIC_NORESPONSE, &req, sizeof(req), - &resp, sizeof(resp)); - if (!xfer) { - LOG_ERR("Failed to setup transfer"); - return -EINVAL; - } - - req.id = dev_id; - req.state = state; - - ret = tisci_do_xfer(dev, xfer); - if (ret) { - LOG_ERR("Failed to set device state without wait (ret=%d)", ret); - return ret; - } - - return 0; -} - -int tisci_get_device_state(const struct device *dev, uint32_t dev_id, uint32_t *clcnt, - uint32_t *resets, uint8_t *p_state, uint8_t *c_state) -{ - struct tisci_msg_resp_get_device_state resp; - struct tisci_msg_req_get_device_state req; - struct tisci_xfer *xfer; - int ret; - - if (!clcnt && !resets && !p_state && !c_state) { - return -EINVAL; - } - - xfer = tisci_setup_one_xfer(dev, TISCI_MSG_GET_DEVICE_STATE, 0, &req, sizeof(req), &resp, - sizeof(resp)); - if (!xfer) { - LOG_ERR("Failed to setup transfer"); - return -EINVAL; - } - - req.id = dev_id; - - ret = tisci_do_xfer(dev, xfer); - if (ret) { - LOG_ERR("Failed to get device state (ret=%d)", ret); - return ret; - } - - if (clcnt) { - *clcnt = resp.context_loss_count; - } - if (resets) { - *resets = resp.resets; - } - if (p_state) { - *p_state = resp.programmed_state; - } - if (c_state) { - *c_state = resp.current_state; - } - - return 0; -} - -int tisci_cmd_get_device(const struct device *dev, uint32_t dev_id) -{ - - return tisci_set_device_state(dev, dev_id, 0, MSG_DEVICE_SW_STATE_ON); -} - -int tisci_cmd_get_device_exclusive(const struct device *dev, uint32_t dev_id) -{ - - return tisci_set_device_state(dev, dev_id, MSG_FLAG_DEVICE_EXCLUSIVE, - MSG_DEVICE_SW_STATE_ON); -} - -int tisci_cmd_idle_device(const struct device *dev, uint32_t dev_id) -{ - - return tisci_set_device_state(dev, dev_id, 0, MSG_DEVICE_SW_STATE_RETENTION); -} - -int tisci_cmd_idle_device_exclusive(const struct device *dev, uint32_t dev_id) -{ - - return tisci_set_device_state(dev, dev_id, MSG_FLAG_DEVICE_EXCLUSIVE, - MSG_DEVICE_SW_STATE_RETENTION); -} - -int tisci_cmd_put_device(const struct device *dev, uint32_t dev_id) -{ - - return tisci_set_device_state(dev, dev_id, 0, MSG_DEVICE_SW_STATE_AUTO_OFF); -} - -int tisci_cmd_dev_is_valid(const struct device *dev, uint32_t dev_id) -{ - uint8_t unused; - - return tisci_get_device_state(dev, dev_id, NULL, NULL, NULL, &unused); -} - -int tisci_cmd_dev_get_clcnt(const struct device *dev, uint32_t dev_id, uint32_t *count) -{ - - return tisci_get_device_state(dev, dev_id, count, NULL, NULL, NULL); -} - -int tisci_cmd_dev_is_idle(const struct device *dev, uint32_t dev_id, bool *r_state) -{ - int ret; - uint8_t state; - - if (!r_state) { - return -EINVAL; - } - - ret = tisci_get_device_state(dev, dev_id, NULL, NULL, &state, NULL); - if (ret) { - return ret; - } - - *r_state = (state == MSG_DEVICE_SW_STATE_RETENTION); - - return 0; -} - -int tisci_cmd_dev_is_stop(const struct device *dev, uint32_t dev_id, bool *r_state, - bool *curr_state) -{ - int ret; - uint8_t p_state, c_state; - - if (!r_state && !curr_state) { - return -EINVAL; - } - - ret = tisci_get_device_state(dev, dev_id, NULL, NULL, &p_state, &c_state); - if (ret) { - return ret; - } - - if (r_state) { - *r_state = (p_state == MSG_DEVICE_SW_STATE_AUTO_OFF); - } - if (curr_state) { - *curr_state = (c_state == MSG_DEVICE_HW_STATE_OFF); - } - - return 0; -} - -int tisci_cmd_dev_is_on(const struct device *dev, uint32_t dev_id, bool *r_state, bool *curr_state) -{ - int ret; - uint8_t p_state, c_state; - - if (!r_state && !curr_state) { - return -EINVAL; - } - - ret = tisci_get_device_state(dev, dev_id, NULL, NULL, &p_state, &c_state); - if (ret) { - return ret; - } - - if (r_state) { - *r_state = (p_state == MSG_DEVICE_SW_STATE_ON); - } - if (curr_state) { - *curr_state = (c_state == MSG_DEVICE_HW_STATE_ON); - } - - return 0; -} - -int tisci_cmd_dev_is_trans(const struct device *dev, uint32_t dev_id, bool *curr_state) -{ - int ret; - uint8_t state; - - if (!curr_state) { - return -EINVAL; - } - - ret = tisci_get_device_state(dev, dev_id, NULL, NULL, NULL, &state); - if (ret) { - return ret; - } - - *curr_state = (state == MSG_DEVICE_HW_STATE_TRANS); - - return 0; -} - -int tisci_cmd_set_device_resets(const struct device *dev, uint32_t dev_id, uint32_t reset_state) -{ - struct tisci_msg_req_set_device_resets req; - struct tisci_msg_resp_set_device_resets resp; - struct tisci_xfer *xfer; - int ret; - - xfer = tisci_setup_one_xfer(dev, TISCI_MSG_SET_DEVICE_RESETS, 0, &req, sizeof(req), &resp, - sizeof(resp)); - if (!xfer) { - LOG_ERR("Failed to setup transfer"); - return -EINVAL; - } - - req.id = dev_id; - req.resets = reset_state; - - ret = tisci_do_xfer(dev, xfer); - if (ret) { - LOG_ERR("Failed to set device resets (ret=%d)", ret); - return ret; - } - - return 0; -} - -int tisci_cmd_get_device_resets(const struct device *dev, uint32_t dev_id, uint32_t *reset_state) -{ - - return tisci_get_device_state(dev, dev_id, NULL, reset_state, NULL, NULL); -} - -/* Processor Management Functions */ -int tisci_cmd_proc_request(const struct device *dev, uint8_t proc_id) -{ - struct tisci_msg_req_proc_request req; - struct tisci_msg_resp_proc_request resp; - struct tisci_xfer *xfer; - int ret; - - xfer = tisci_setup_one_xfer(dev, TISCI_MSG_PROC_REQUEST, 0, &req, sizeof(req), &resp, - sizeof(resp)); - if (!xfer) { - LOG_ERR("Failed to setup transfer"); - return -EINVAL; - } - - req.processor_id = proc_id; - - ret = tisci_do_xfer(dev, xfer); - if (ret) { - LOG_ERR("Failed to request processor control (ret=%d)", ret); - return ret; - } - - return 0; -} - -int tisci_cmd_proc_release(const struct device *dev, uint8_t proc_id) -{ - struct tisci_msg_req_proc_release req; - struct tisci_msg_resp_proc_release resp; - struct tisci_xfer *xfer; - int ret; - - xfer = tisci_setup_one_xfer(dev, TISCI_MSG_PROC_RELEASE, 0, &req, sizeof(req), &resp, - sizeof(resp)); - if (!xfer) { - LOG_ERR("Failed to setup transfer"); - return -EINVAL; - } - - req.processor_id = proc_id; - - ret = tisci_do_xfer(dev, xfer); - if (ret) { - LOG_ERR("Failed to release processor control (ret=%d)", ret); - return ret; - } - - return 0; -} - -int tisci_cmd_proc_handover(const struct device *dev, uint8_t proc_id, uint8_t host_id) -{ - struct tisci_msg_req_proc_handover req; - struct tisci_msg_resp_proc_handover resp; - struct tisci_xfer *xfer; - int ret; - - xfer = tisci_setup_one_xfer(dev, TISCI_MSG_PROC_HANDOVER, 0, &req, sizeof(req), &resp, - sizeof(resp)); - if (!xfer) { - LOG_ERR("Failed to setup transfer"); - return -EINVAL; - } - - req.processor_id = proc_id; - req.host_id = host_id; - - ret = tisci_do_xfer(dev, xfer); - if (ret) { - LOG_ERR("Failed to handover processor control (ret=%d)", ret); - return ret; - } - - return 0; -} - -int tisci_cmd_set_proc_boot_cfg(const struct device *dev, uint8_t proc_id, uint64_t bootvector, - uint32_t config_flags_set, uint32_t config_flags_clear) -{ - struct tisci_msg_req_set_proc_boot_config req; - struct tisci_msg_resp_set_proc_boot_config resp; - struct tisci_xfer *xfer; - int ret; - - xfer = tisci_setup_one_xfer(dev, TISCI_MSG_SET_PROC_BOOT_CONFIG, 0, &req, sizeof(req), - &resp, sizeof(resp)); - if (!xfer) { - LOG_ERR("Failed to setup transfer"); - return -EINVAL; - } - - req.processor_id = proc_id; - req.bootvector_low = bootvector & TISCI_ADDR_LOW_MASK; - req.bootvector_high = (bootvector & TISCI_ADDR_HIGH_MASK) >> TISCI_ADDR_HIGH_SHIFT; - req.config_flags_set = config_flags_set; - req.config_flags_clear = config_flags_clear; - - ret = tisci_do_xfer(dev, xfer); - if (ret) { - LOG_ERR("Failed to set processor boot configuration (ret=%d)", ret); - return ret; - } - - return 0; -} - -int tisci_cmd_set_proc_boot_ctrl(const struct device *dev, uint8_t proc_id, - uint32_t control_flags_set, uint32_t control_flags_clear) -{ - struct tisci_msg_req_set_proc_boot_ctrl req; - struct tisci_msg_resp_set_proc_boot_ctrl resp; - struct tisci_xfer *xfer; - int ret; - - xfer = tisci_setup_one_xfer(dev, TISCI_MSG_SET_PROC_BOOT_CTRL, 0, &req, sizeof(req), &resp, - sizeof(resp)); - if (!xfer) { - LOG_ERR("Failed to setup transfer"); - return -EINVAL; - } - - req.processor_id = proc_id; - req.control_flags_set = control_flags_set; - req.control_flags_clear = control_flags_clear; - - ret = tisci_do_xfer(dev, xfer); - if (ret) { - LOG_ERR("Failed to set processor boot control (ret=%d)", ret); - return ret; - } - - return 0; -} - -int tisci_cmd_proc_auth_boot_image(const struct device *dev, uint64_t *image_addr, - uint32_t *image_size) -{ - struct tisci_msg_req_proc_auth_boot_image req; - struct tisci_msg_resp_proc_auth_boot_image resp; - struct tisci_xfer *xfer; - int ret; - - if (!image_addr) { - return -EINVAL; - } - - xfer = tisci_setup_one_xfer(dev, TISCI_MSG_PROC_AUTH_BOOT_IMAGE, 0, &req, sizeof(req), - &resp, sizeof(resp)); - if (!xfer) { - LOG_ERR("Failed to setup transfer"); - return -EINVAL; - } - - req.cert_addr_low = *image_addr & TISCI_ADDR_LOW_MASK; - req.cert_addr_high = (*image_addr & TISCI_ADDR_HIGH_MASK) >> TISCI_ADDR_HIGH_SHIFT; - - ret = tisci_do_xfer(dev, xfer); - if (ret) { - LOG_ERR("Failed to authenticate boot image (ret=%d)", ret); - return ret; - } - - *image_addr = - (resp.image_addr_low & TISCI_ADDR_LOW_MASK) | - (((uint64_t)resp.image_addr_high << TISCI_ADDR_HIGH_SHIFT) & TISCI_ADDR_HIGH_MASK); - - if (image_size) { - *image_size = resp.image_size; - } - - return 0; -} - -int tisci_cmd_get_proc_boot_status(const struct device *dev, uint8_t proc_id, uint64_t *bv, - uint32_t *cfg_flags, uint32_t *ctrl_flags, uint32_t *sts_flags) -{ - struct tisci_msg_resp_get_proc_boot_status resp; - struct tisci_msg_req_get_proc_boot_status req; - struct tisci_xfer *xfer; - int ret; - - if (!bv && !cfg_flags && !ctrl_flags && !sts_flags) { - return -EINVAL; - } - - xfer = tisci_setup_one_xfer(dev, TISCI_MSG_GET_PROC_BOOT_STATUS, 0, &req, sizeof(req), - &resp, sizeof(resp)); - if (!xfer) { - LOG_ERR("Failed to setup transfer"); - return -EINVAL; - } - - req.processor_id = proc_id; - - ret = tisci_do_xfer(dev, xfer); - if (ret) { - LOG_ERR("Failed to get processor boot status (ret=%d)", ret); - return ret; - } - - if (bv) { - *bv = (resp.bootvector_low & TISCI_ADDR_LOW_MASK) | - (((uint64_t)resp.bootvector_high << TISCI_ADDR_HIGH_SHIFT) & - TISCI_ADDR_HIGH_MASK); - } - if (cfg_flags) { - *cfg_flags = resp.config_flags; - } - if (ctrl_flags) { - *ctrl_flags = resp.control_flags; - } - if (sts_flags) { - *sts_flags = resp.status_flags; - } - - return 0; -} - -/* Resource Management Functions */ -int tisci_get_resource_range(const struct device *dev, uint32_t dev_id, uint8_t subtype, - uint8_t s_host, uint16_t *range_start, uint16_t *range_num) -{ - struct tisci_msg_resp_get_resource_range resp; - struct tisci_msg_req_get_resource_range req; - struct tisci_xfer *xfer; - int ret; - - if (!s_host) { - return -EINVAL; - } - if (!range_start && !range_num) { - return -EINVAL; - } - - xfer = tisci_setup_one_xfer(dev, TISCI_MSG_GET_RESOURCE_RANGE, 0, &req, sizeof(req), &resp, - sizeof(resp)); - if (!xfer) { - LOG_ERR("Failed to setup transfer"); - return -EINVAL; - } - - req.secondary_host = s_host; - req.type = dev_id & MSG_RM_RESOURCE_TYPE_MASK; - req.subtype = subtype & MSG_RM_RESOURCE_SUBTYPE_MASK; - - ret = tisci_do_xfer(dev, xfer); - if (ret) { - LOG_ERR("Failed to get resource range (ret=%d)", ret); - return ret; - } - - if (!resp.range_start && !resp.range_num) { - return -ENODEV; - } - - if (range_start) { - *range_start = resp.range_start; - } - if (range_num) { - *range_num = resp.range_num; - } - - return 0; -} - -int tisci_cmd_get_resource_range(const struct device *dev, uint32_t dev_id, uint8_t subtype, - uint16_t *range_start, uint16_t *range_num) -{ - return tisci_get_resource_range(dev, dev_id, subtype, TISCI_IRQ_SECONDARY_HOST_INVALID, - range_start, range_num); -} - -int tisci_cmd_get_resource_range_from_shost(const struct device *dev, uint32_t dev_id, - uint8_t subtype, uint8_t s_host, uint16_t *range_start, - uint16_t *range_num) -{ - return tisci_get_resource_range(dev, dev_id, subtype, s_host, range_start, range_num); -} - -/* Board Configuration Functions */ - -int cmd_set_board_config_using_msg(const struct device *dev, uint16_t msg_type, uint64_t addr, - uint32_t size) -{ - struct tisci_msg_board_config_req req; - struct tisci_msg_board_config_resp resp; - struct tisci_xfer *xfer; - int ret; - - xfer = tisci_setup_one_xfer(dev, msg_type, 0, &req, sizeof(req), &resp, sizeof(resp)); - if (!xfer) { - LOG_ERR(" Failed to setup board config transfer"); - return -EINVAL; - } - - req.boardcfgp_high = (addr >> 32) & 0xFFFFFFFFU; - req.boardcfgp_low = addr & 0xFFFFFFFFU; - req.boardcfg_size = size; - - ret = tisci_do_xfer(dev, xfer); - if (ret) { - LOG_ERR("Board config transfer failed (ret=%d)", ret); - return ret; - } - - return 0; -} - -/* Version/Revision Function */ -int tisci_cmd_get_revision(const struct device *dev, struct tisci_version_info *ver) -{ - struct tisci_msg_hdr hdr; - struct tisci_msg_resp_version rev_info; - struct tisci_xfer *xfer; - int ret; - - if (!ver) { - return -EINVAL; - } - - xfer = tisci_setup_one_xfer(dev, TISCI_MSG_VERSION, 0, &hdr, sizeof(hdr), &rev_info, - sizeof(rev_info)); - if (!xfer) { - LOG_ERR("Failed to setup transfer"); - return -EINVAL; - } - - ret = tisci_do_xfer(dev, xfer); - if (ret) { - LOG_ERR("Failed to get version (ret=%d)", ret); - return ret; - } - - ver->abi_major = rev_info.abi_major; - ver->abi_minor = rev_info.abi_minor; - ver->firmware_revision = rev_info.firmware_revision; - strncpy(ver->firmware_description, rev_info.firmware_description, - sizeof(ver->firmware_description)); - return 0; -} - -/* System Control Functions */ - -int tisci_cmd_sys_reset(const struct device *dev) -{ - struct tisci_msg_req_reboot req; - struct tisci_msg_resp_reboot resp; - struct tisci_xfer *xfer; - int ret; - - xfer = tisci_setup_one_xfer(dev, TISCI_MSG_SYS_RESET, 0, &req, sizeof(req), &resp, - sizeof(resp)); - if (!xfer) { - LOG_ERR(" Failed to setup system reset transfer"); - return -EINVAL; - } - - req.domain = 0; - - ret = tisci_do_xfer(dev, xfer); - if (ret) { - LOG_ERR("System reset request failed (ret=%d)", ret); - return ret; - } - - return 0; -} - -/* Memory Management Functions */ - -int tisci_cmd_query_msmc(const struct device *dev, uint64_t *msmc_start, uint64_t *msmc_end) -{ - struct tisci_msg_resp_query_msmc resp; - struct tisci_msg_hdr req; - struct tisci_xfer *xfer; - int ret; - - if (!msmc_start || !msmc_end) { - return -EINVAL; - } - - xfer = tisci_setup_one_xfer(dev, TISCI_MSG_QUERY_MSMC, 0, &req, sizeof(req), &resp, - sizeof(resp)); - if (!xfer) { - LOG_ERR(" Failed to setup MSMC query transfer"); - return -EINVAL; - } - - ret = tisci_do_xfer(dev, xfer); - if (ret) { - LOG_ERR("MSMC query failed (ret=%d)", ret); - return ret; - } - - *msmc_start = - ((uint64_t)resp.msmc_start_high << TISCI_ADDR_HIGH_SHIFT) | resp.msmc_start_low; - *msmc_end = ((uint64_t)resp.msmc_end_high << TISCI_ADDR_HIGH_SHIFT) | resp.msmc_end_low; - - return 0; -} - -/* Firewall Management Functions */ - -int tisci_cmd_set_fwl_region(const struct device *dev, const struct tisci_msg_fwl_region *region) -{ - struct tisci_msg_fwl_set_firewall_region_req req; - struct tisci_msg_fwl_set_firewall_region_resp resp; - struct tisci_xfer *xfer; - int ret; - - if (!region) { - return -EINVAL; - } - - xfer = tisci_setup_one_xfer(dev, TISCI_MSG_FWL_SET, 0, &req, sizeof(req), &resp, - sizeof(resp)); - if (!xfer) { - LOG_ERR(" Failed to setup firewall config transfer"); - return -EINVAL; - } - - req.fwl_id = region->fwl_id; - req.region = region->region; - req.n_permission_regs = region->n_permission_regs; - req.control = region->control; - memcpy(req.permissions, region->permissions, sizeof(uint32_t) * FWL_MAX_PRIVID_SLOTS); - req.start_address = region->start_address; - req.end_address = region->end_address; - - ret = tisci_do_xfer(dev, xfer); - if (ret) { - LOG_ERR("Firewall config transfer failed (ret=%d)", ret); - return ret; - } - - return 0; -} - -int tisci_cmd_get_fwl_region(const struct device *dev, struct tisci_msg_fwl_region *region) -{ - struct tisci_msg_fwl_get_firewall_region_req req; - struct tisci_msg_fwl_get_firewall_region_resp resp; - struct tisci_xfer *xfer; - int ret; - - if (!region) { - return -EINVAL; - } - - xfer = tisci_setup_one_xfer(dev, TISCI_MSG_FWL_GET, 0, &req, sizeof(req), &resp, - sizeof(resp)); - if (!xfer) { - LOG_ERR(" Failed to setup firewall query transfer"); - return -EINVAL; - } - - req.fwl_id = region->fwl_id; - req.region = region->region; - req.n_permission_regs = region->n_permission_regs; - - ret = tisci_do_xfer(dev, xfer); - if (ret) { - LOG_ERR("Firewall query transfer failed (ret=%d)", ret); - return ret; - } - - region->fwl_id = resp.fwl_id; - region->region = resp.region; - region->n_permission_regs = resp.n_permission_regs; - region->control = resp.control; - memcpy(region->permissions, resp.permissions, sizeof(uint32_t) * FWL_MAX_PRIVID_SLOTS); - region->start_address = resp.start_address; - region->end_address = resp.end_address; - - return 0; -} - -int tisci_cmd_change_fwl_owner(const struct device *dev, struct tisci_msg_fwl_owner *owner) -{ - struct tisci_msg_fwl_change_owner_info_req req; - struct tisci_msg_fwl_change_owner_info_resp resp; - struct tisci_xfer *xfer; - int ret; - - if (!owner) { - return -EINVAL; - } - - xfer = tisci_setup_one_xfer(dev, TISCI_MSG_FWL_CHANGE_OWNER, 0, &req, sizeof(req), &resp, - sizeof(resp)); - if (!xfer) { - LOG_ERR(" Failed to setup firewall owner change transfer"); - return -EINVAL; - } - - req.fwl_id = owner->fwl_id; - req.region = owner->region; - req.owner_index = owner->owner_index; - - ret = tisci_do_xfer(dev, xfer); - if (ret) { - LOG_ERR("Firewall owner change failed (ret=%d)", ret); - return ret; - } - - owner->fwl_id = resp.fwl_id; - owner->region = resp.region; - owner->owner_index = resp.owner_index; - owner->owner_privid = resp.owner_privid; - owner->owner_permission_bits = resp.owner_permission_bits; - - return 0; -} - -/* UDMAP Management Functions */ - -int tisci_cmd_rm_udmap_tx_ch_cfg(const struct device *dev, - const struct tisci_msg_rm_udmap_tx_ch_cfg *params) -{ - struct tisci_msg_rm_udmap_tx_ch_cfg_req req; - struct tisci_msg_rm_udmap_tx_ch_cfg_resp resp; - struct tisci_xfer *xfer; - int ret; - - if (!params) { - return -EINVAL; - } - - xfer = tisci_setup_one_xfer(dev, TISCI_MSG_RM_UDMAP_TX_CH_CFG, 0, &req, sizeof(req), &resp, - sizeof(resp)); - if (!xfer) { - LOG_ERR(" Failed to setup UDMAP TX channel config transfer"); - return -EINVAL; - } - - /* Copy all configuration parameters */ - req.valid_params = params->valid_params; - req.nav_id = params->nav_id; - req.index = params->index; - req.tx_pause_on_err = params->tx_pause_on_err; - req.tx_filt_einfo = params->tx_filt_einfo; - req.tx_filt_pswords = params->tx_filt_pswords; - req.tx_atype = params->tx_atype; - req.tx_chan_type = params->tx_chan_type; - req.tx_supr_tdpkt = params->tx_supr_tdpkt; - req.tx_fetch_size = params->tx_fetch_size; - req.tx_credit_count = params->tx_credit_count; - req.txcq_qnum = params->txcq_qnum; - req.tx_priority = params->tx_priority; - req.tx_qos = params->tx_qos; - req.tx_orderid = params->tx_orderid; - req.fdepth = params->fdepth; - req.tx_sched_priority = params->tx_sched_priority; - req.tx_burst_size = params->tx_burst_size; - req.tx_tdtype = params->tx_tdtype; - req.extended_ch_type = params->extended_ch_type; - - ret = tisci_do_xfer(dev, xfer); - if (ret) { - LOG_ERR("UDMAP TX channel %u config failed (ret=%d)", params->index, ret); - return ret; - } - - LOG_DBG("UDMAP TX channel %u configured successfully", params->index); - return 0; -} - -int tisci_cmd_rm_udmap_rx_ch_cfg(const struct device *dev, - const struct tisci_msg_rm_udmap_rx_ch_cfg *params) -{ - struct tisci_msg_rm_udmap_rx_ch_cfg_req req; - struct tisci_msg_rm_udmap_rx_ch_cfg_resp resp; - struct tisci_xfer *xfer; - int ret; - - if (!params) { - return -EINVAL; - } - - xfer = tisci_setup_one_xfer(dev, TISCI_MSG_RM_UDMAP_RX_CH_CFG, 0, &req, sizeof(req), &resp, - sizeof(resp)); - if (!xfer) { - LOG_ERR(" Failed to setup UDMAP RX channel config transfer"); - return -EINVAL; - } - - /* Copy all configuration parameters */ - req.valid_params = params->valid_params; - req.nav_id = params->nav_id; - req.index = params->index; - req.rx_fetch_size = params->rx_fetch_size; - req.rxcq_qnum = params->rxcq_qnum; - req.rx_priority = params->rx_priority; - req.rx_qos = params->rx_qos; - req.rx_orderid = params->rx_orderid; - req.rx_sched_priority = params->rx_sched_priority; - req.flowid_start = params->flowid_start; - req.flowid_cnt = params->flowid_cnt; - req.rx_pause_on_err = params->rx_pause_on_err; - req.rx_atype = params->rx_atype; - req.rx_chan_type = params->rx_chan_type; - req.rx_ignore_short = params->rx_ignore_short; - req.rx_ignore_long = params->rx_ignore_long; - - ret = tisci_do_xfer(dev, xfer); - if (ret) { - LOG_ERR("UDMAP RX channel %u config failed (ret=%d)", params->index, ret); - return ret; - } - - LOG_DBG("UDMAP RX channel %u configured successfully", params->index); - return 0; -} - -/* PSI-L Management Functions */ - -int tisci_cmd_rm_psil_pair(const struct device *dev, uint32_t nav_id, uint32_t src_thread, - uint32_t dst_thread) -{ - struct tisci_msg_psil_pair_req req; - struct tisci_msg_psil_pair_resp resp; - struct tisci_xfer *xfer; - int ret; - - xfer = tisci_setup_one_xfer(dev, TISCI_MSG_RM_PSIL_PAIR, 0, &req, sizeof(req), &resp, - sizeof(resp)); - if (!xfer) { - LOG_ERR(" Failed to setup PSI-L pair transfer"); - return -EINVAL; - } - - req.nav_id = nav_id; - req.src_thread = src_thread; - req.dst_thread = dst_thread; - - ret = tisci_do_xfer(dev, xfer); - if (ret) { - LOG_ERR("PSI-L pair failed nav:%u %u->%u (ret=%d)", nav_id, src_thread, dst_thread, - ret); - return ret; - } - - LOG_DBG("PSI-L pair successful nav:%u %u->%u", nav_id, src_thread, dst_thread); - return 0; -} - -int tisci_cmd_rm_psil_unpair(const struct device *dev, uint32_t nav_id, uint32_t src_thread, - uint32_t dst_thread) -{ - struct tisci_msg_psil_unpair_req req; - struct tisci_msg_psil_unpair_resp resp; - struct tisci_xfer *xfer; - int ret; - - xfer = tisci_setup_one_xfer(dev, TISCI_MSG_RM_PSIL_UNPAIR, 0, &req, sizeof(req), &resp, - sizeof(resp)); - if (!xfer) { - LOG_ERR(" Failed to setup PSI-L unpair transfer"); - return -EINVAL; - } - - req.nav_id = nav_id; - req.src_thread = src_thread; - req.dst_thread = dst_thread; - - ret = tisci_do_xfer(dev, xfer); - if (ret) { - LOG_ERR("PSI-L unpair failed %u->%u (ret=%d)", src_thread, dst_thread, ret); - return ret; - } - - LOG_DBG("PSI-L unpair successful %u->%u", src_thread, dst_thread); - return 0; -} - -/* Interrupt Management Functions */ -int tisci_cmd_rm_irq_set(const struct device *dev, struct tisci_irq_set_req *client_req) -{ - struct tisci_xfer *xfer; - struct tisci_msg_rm_irq_set_resp resp = {0}; - int ret; - - if (!client_req) { - return -EINVAL; - } - - struct tisci_msg_rm_irq_set_req req = { - .hdr = {0}, - .valid_params = client_req->valid_params, - .src_id = client_req->src_id, - .src_index = client_req->src_index, - .dst_id = client_req->dst_id, - .dst_host_irq = client_req->dst_host_irq, - .ia_id = client_req->ia_id, - .vint = client_req->vint, - .global_event = client_req->global_event, - .vint_status_bit_index = client_req->vint_status_bit_index, - .secondary_host = client_req->secondary_host, - }; - - xfer = tisci_setup_one_xfer(dev, TISCI_MSG_RM_IRQ_SET, 0, &req, sizeof(req), &resp, - sizeof(resp)); - if (!xfer) { - LOG_ERR("Failed to setup transfer"); - return -EINVAL; - } - - ret = tisci_do_xfer(dev, xfer); - if (ret) { - LOG_ERR("Failed to set IRQ (ret=%d)", ret); - return ret; - } - - return 0; -} - -int tisci_cmd_rm_irq_release(const struct device *dev, struct tisci_irq_release_req *client_req) -{ - struct tisci_xfer *xfer; - struct tisci_msg_rm_irq_release_resp resp = {0}; - int ret; - - if (!client_req) { - return -EINVAL; - } - - struct tisci_msg_rm_irq_release_req req = { - .hdr = {0}, - .valid_params = client_req->valid_params, - .src_id = client_req->src_id, - .src_index = client_req->src_index, - .dst_id = client_req->dst_id, - .dst_host_irq = client_req->dst_host_irq, - .ia_id = client_req->ia_id, - .vint = client_req->vint, - .global_event = client_req->global_event, - .vint_status_bit_index = client_req->vint_status_bit_index, - .secondary_host = client_req->secondary_host, - }; - - xfer = tisci_setup_one_xfer(dev, TISCI_MSG_RM_IRQ_RELEASE, 0, &req, sizeof(req), &resp, - sizeof(resp)); - if (!xfer) { - LOG_ERR("Failed to setup transfer"); - return -EINVAL; - } - - ret = tisci_do_xfer(dev, xfer); - if (ret) { - LOG_ERR("Failed to release IRQ (ret=%d)", ret); - return ret; - } - - return 0; -} - -/* Init function */ -static int tisci_init(const struct device *dev) -{ - const struct tisci_config *config = dev->config; - struct tisci_data *data = dev->data; - int ret; - - k_sem_init(data->rx_message.response_ready_sem, 0, 1); - - ret = mbox_register_callback_dt(&config->mbox_rx, callback, &data->rx_message); - if (ret < 0) { - LOG_ERR("Could not register callback (%d)\n", ret); - return ret; - } - - ret = mbox_set_enabled_dt(&config->mbox_rx, true); - if (ret < 0) { - LOG_ERR("Could not enable RX channel (%d)\n", ret); - return ret; - } - return 0; -} - -/* Device Tree Instantiation */ -#define TISCI_DEFINE(_n) \ - static uint8_t rx_message_buf_##_n[MAILBOX_MBOX_SIZE] = {0}; \ - static struct k_sem response_ready_sem_##_n; \ - static struct tisci_data tisci_data_##_n = { \ - .seq = 0, \ - .rx_message = \ - { \ - .buf = rx_message_buf_##_n, \ - .size = sizeof(rx_message_buf_##_n), \ - .response_ready_sem = &response_ready_sem_##_n, \ - }, \ - .data_sem = Z_SEM_INITIALIZER(tisci_data_##_n.data_sem, 1, 1), \ - }; \ - static const struct tisci_config tisci_config_##_n = { \ - .mbox_tx = MBOX_DT_SPEC_INST_GET(_n, tx), \ - .mbox_rx = MBOX_DT_SPEC_INST_GET(_n, rx), \ - .host_id = DT_INST_PROP(_n, ti_host_id), \ - .max_msg_size = MAILBOX_MBOX_SIZE, \ - .max_rx_timeout_ms = 10000, \ - }; \ - DEVICE_DT_INST_DEFINE(_n, tisci_init, NULL, &tisci_data_##_n, &tisci_config_##_n, \ - PRE_KERNEL_1, CONFIG_TISCI_INIT_PRIORITY, NULL); - -DT_INST_FOREACH_STATUS_OKAY(TISCI_DEFINE) diff --git a/drivers/firmware/tisci/tisci.h b/drivers/firmware/tisci/tisci.h deleted file mode 100644 index 59d3898c7c46..000000000000 --- a/drivers/firmware/tisci/tisci.h +++ /dev/null @@ -1,1820 +0,0 @@ -/* - * Copyright (c) 2025, Texas Instruments - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/** - * @file - * @brief Texas Instruments System Control Interface (TISCI) Protocol - * - */ - -#ifndef INCLUDE_ZEPHYR_DRIVERS_TISCI_PROTOCOL_H_ -#define INCLUDE_ZEPHYR_DRIVERS_TISCI_PROTOCOL_H_ - -#include "zephyr/kernel.h" -#include -#include - -#ifndef __packed -#define __packed __attribute__((__packed__)) -#endif - -#define TISCI_MSG_ENABLE_WDT 0x0000 -#define TISCI_MSG_WAKE_RESET 0x0001 -#define TISCI_MSG_VERSION 0x0002 -#define TISCI_MSG_WAKE_REASON 0x0003 -#define TISCI_MSG_GOODBYE 0x0004 -#define TISCI_MSG_SYS_RESET 0x0005 -#define TISCI_MSG_BOARD_CONFIG 0x000b -#define TISCI_MSG_BOARD_CONFIG_RM 0x000c -#define TISCI_MSG_BOARD_CONFIG_SECURITY 0x000d -#define TISCI_MSG_BOARD_CONFIG_PM 0x000e -#define TISCI_MSG_QUERY_MSMC 0x0020 - -/* Device requests */ -#define TISCI_MSG_SET_DEVICE_STATE 0x0200 -#define TISCI_MSG_GET_DEVICE_STATE 0x0201 -#define TISCI_MSG_SET_DEVICE_RESETS 0x0202 - -/* Clock requests */ -#define TISCI_MSG_SET_CLOCK_STATE 0x0100 -#define TISCI_MSG_GET_CLOCK_STATE 0x0101 -#define TISCI_MSG_SET_CLOCK_PARENT 0x0102 -#define TISCI_MSG_GET_CLOCK_PARENT 0x0103 -#define TISCI_MSG_GET_NUM_CLOCK_PARENTS 0x0104 -#define TISCI_MSG_SET_CLOCK_FREQ 0x010c -#define TISCI_MSG_QUERY_CLOCK_FREQ 0x010d -#define TISCI_MSG_GET_CLOCK_FREQ 0x010e - -/* Processor Control Messages */ -#define TISCI_MSG_PROC_REQUEST 0xc000 -#define TISCI_MSG_PROC_RELEASE 0xc001 -#define TISCI_MSG_PROC_HANDOVER 0xc005 -#define TISCI_MSG_SET_PROC_BOOT_CONFIG 0xc100 -#define TISCI_MSG_SET_PROC_BOOT_CTRL 0xc101 -#define TISCI_MSG_PROC_AUTH_BOOT_IMAGE 0xc120 -#define TISCI_MSG_GET_PROC_BOOT_STATUS 0xc400 -#define TISCI_MSG_WAIT_PROC_BOOT_STATUS 0xc401 - -/* Resource Management Requests */ -/* RM TISCI message to request a resource range assignment for a host */ -#define TISCI_MSG_GET_RESOURCE_RANGE 0x1500 -/* RM TISCI message to set an IRQ between a peripheral and host processor */ -#define TISCI_MSG_RM_IRQ_SET (0x1000U) -/* RM TISCI message to release a configured IRQ */ -#define TISCI_MSG_RM_IRQ_RELEASE (0x1001U) - -/* NAVSS resource management */ -/* Ringacc requests */ -#define TISCI_MSG_RM_RING_CFG 0x1110 - -/* PSI-L requests */ -#define TISCI_MSG_RM_PSIL_PAIR 0x1280 -#define TISCI_MSG_RM_PSIL_UNPAIR 0x1281 - -#define TISCI_MSG_RM_UDMAP_TX_ALLOC 0x1200 -#define TISCI_MSG_RM_UDMAP_TX_FREE 0x1201 -#define TISCI_MSG_RM_UDMAP_RX_ALLOC 0x1210 -#define TISCI_MSG_RM_UDMAP_RX_FREE 0x1211 -#define TISCI_MSG_RM_UDMAP_FLOW_CFG 0x1220 -#define TISCI_MSG_RM_UDMAP_OPT_FLOW_CFG 0x1221 - -#define TISCI_MSG_RM_UDMAP_TX_CH_CFG 0x1205 -#define TISCI_MSG_RM_UDMAP_RX_CH_CFG 0x1215 -#define TISCI_MSG_RM_UDMAP_FLOW_SIZE_THRESH_CFG 0x1231 - -#define TISCI_MSG_FWL_SET 0x9000 -#define TISCI_MSG_FWL_GET 0x9001 -#define TISCI_MSG_FWL_CHANGE_OWNER 0x9002 - -/** - * @struct rx_msg - * @brief Received message details - * @param seq: Message sequence number - * @param size: Message size in bytes - * @param buf: Buffer for message data - * @param response_ready_sem: Semaphore to signal when a response is ready - */ -struct rx_msg { - uint8_t seq; - size_t size; - void *buf; - struct k_sem *response_ready_sem; -}; - -/** - * @struct tisci_msg_hdr - * @brief Generic Message Header for All messages and responses - * @param type: Type of messages: One of TISCI_MSG* values - * @param host: Host of the message - * @param seq: Message identifier indicating a transfer sequence - * @param flags: Flag for the message - */ -struct tisci_msg_hdr { - uint16_t type; - uint8_t host; - uint8_t seq; -#define TISCI_MSG_FLAG(val) (1 << (val)) -#define TISCI_FLAG_REQ_GENERIC_NORESPONSE 0x0 -#define TISCI_FLAG_REQ_ACK_ON_RECEIVED TISCI_MSG_FLAG(0) -#define TISCI_FLAG_REQ_ACK_ON_PROCESSED TISCI_MSG_FLAG(1) -#define TISCI_FLAG_RESP_GENERIC_NACK 0x0 -#define TISCI_FLAG_RESP_GENERIC_ACK TISCI_MSG_FLAG(1) - /* Additional Flags */ - uint32_t flags; -} __packed; - -/** - * @struct tisci_secure_msg_hdr - * @brief Header that prefixes all TISCI messages sent - * via secure transport. - * @param checksum: crc16 checksum for the entire message - * @param reserved: Reserved for future use. - */ -struct tisci_secure_msg_hdr { - uint16_t checksum; - uint16_t reserved; -} __packed; - -/** - * @struct tisci_msg_resp_version - * @brief Response for a message - * - * In general, ABI version changes follow the rule that minor version increments - * are backward compatible. Major revision changes in ABI may not be - * backward compatible. - * - * Response to a generic message with message type TISCI_MSG_VERSION - * @param hdr: Generic header - * @param firmware_description: String describing the firmware - * @param firmware_revision: Firmware revision - * @param abi_major: Major version of the ABI that firmware supports - * @param abi_minor: Minor version of the ABI that firmware supports - */ -struct tisci_msg_resp_version { - struct tisci_msg_hdr hdr; - char firmware_description[32]; - uint16_t firmware_revision; - uint8_t abi_major; - uint8_t abi_minor; -} __packed; - -/** - * @struct tisci_msg_req_reboot - * @brief Reboot the SoC - * @param hdr: Generic Header - * @param domain: Domain to be reset, 0 for full SoC reboot. - * - * Request type is TISCI_MSG_SYS_RESET, responded with a generic - * ACK/NACK message. - */ -struct tisci_msg_req_reboot { - struct tisci_msg_hdr hdr; - uint8_t domain; -} __packed; - -/** - * @struct tisci_msg_resp_reboot - * @brief Response to system reset (generic ACK/NACK) - */ -struct tisci_msg_resp_reboot { - struct tisci_msg_hdr hdr; -} __packed; - -/** - * @struct tisci_msg_board_config_req - * @brief Board configuration message - * @param hdr: Generic Header - * @param boardcfgp_low: Lower 32 bit of the pointer pointing to the board - * configuration data - * @param boardcfgp_high: Upper 32 bit of the pointer pointing to the board - * configuration data - * @param boardcfg_size: Size of board configuration data object - * Request type is TISCI_MSG_BOARD_CONFIG, responded with a generic - * ACK/NACK message. - */ -struct tisci_msg_board_config_req { - struct tisci_msg_hdr hdr; - uint32_t boardcfgp_low; - uint32_t boardcfgp_high; - uint16_t boardcfg_size; -} __packed; - -/** - * @struct tisci_msg_board_config_resp - * @brief Response to board config request (generic ACK/NACK) - * @param hdr: Generic Header - */ -struct tisci_msg_board_config_resp { - struct tisci_msg_hdr hdr; -} __packed; - -/** - * @struct tisci_msg_resp_query_msmc - * @brief Query msmc message response structure - * @param hdr: Generic Header - * @param msmc_start_low: Lower 32 bit of msmc start - * @param msmc_start_high: Upper 32 bit of msmc start - * @param msmc_end_low: Lower 32 bit of msmc end - * @param msmc_end_high: Upper 32 bit of msmc end - * - * @brief Response to a generic message with message type TISCI_MSG_QUERY_MSMC - */ -struct tisci_msg_resp_query_msmc { - struct tisci_msg_hdr hdr; - uint32_t msmc_start_low; - uint32_t msmc_start_high; - uint32_t msmc_end_low; - uint32_t msmc_end_high; -} __packed; - -/** - * @struct tisci_msg_req_set_device_state - * @brief Set the desired state of the device - * @param hdr: Generic header - * @param id: Indicates which device to modify - * @param reserved: Reserved space in message, must be 0 for backward compatibility - * @param state: The desired state of the device. - * - * Certain flags can also be set to alter the device state: - * MSG_FLAG_DEVICE_WAKE_ENABLED - Configure the device to be a wake source. - * The meaning of this flag will vary slightly from device to device and from - * SoC to SoC but it generally allows the device to wake the SoC out of deep - * suspend states. - * MSG_FLAG_DEVICE_RESET_ISO - Enable reset isolation for this device. - * MSG_FLAG_DEVICE_EXCLUSIVE - Claim this device exclusively. When passed - * with STATE_RETENTION or STATE_ON, it will claim the device exclusively. - * If another host already has this device set to STATE_RETENTION or STATE_ON, - * the message will fail. Once successful, other hosts attempting to set - * STATE_RETENTION or STATE_ON will fail. - * - * Request type is TISCI_MSG_SET_DEVICE_STATE, responded with a generic - * ACK/NACK message. - */ -struct tisci_msg_req_set_device_state { - /* Additional hdr->flags options */ -#define MSG_FLAG_DEVICE_WAKE_ENABLED TISCI_MSG_FLAG(8) -#define MSG_FLAG_DEVICE_RESET_ISO TISCI_MSG_FLAG(9) -#define MSG_FLAG_DEVICE_EXCLUSIVE TISCI_MSG_FLAG(10) - struct tisci_msg_hdr hdr; - uint32_t id; - uint32_t reserved; - -#define MSG_DEVICE_SW_STATE_AUTO_OFF 0 -#define MSG_DEVICE_SW_STATE_RETENTION 1 -#define MSG_DEVICE_SW_STATE_ON 2 - uint8_t state; -} __packed; - -/** - * @struct tisci_msg_resp_set_device_state - * @brief Response to set device state (generic ACK/NACK) - */ -struct tisci_msg_resp_set_device_state { - struct tisci_msg_hdr hdr; -} __packed; - -/** - * @struct tisci_msg_req_get_device_state - * @brief Request to get device. - * @param hdr: Generic header - * @param id: Device Identifier - * - * Request type is TISCI_MSG_GET_DEVICE_STATE, responded device state - * information - */ -struct tisci_msg_req_get_device_state { - struct tisci_msg_hdr hdr; - uint32_t id; -} __packed; - -/** - * @struct tisci_msg_resp_get_device_state - * @brief Response to get device request. - * @param hdr: Generic header - * @param context_loss_count: Indicates how many times the device has lost context. A - * driver can use this monotonic counter to determine if the device has - * lost context since the last time this message was exchanged. - * @param resets: Programmed state of the reset lines. - * @param programmed_state: The state as programmed by set_device. - * - Uses the MSG_DEVICE_SW_* macros - * @param current_state: The actual state of the hardware. - * - * Response to request TISCI_MSG_GET_DEVICE_STATE. - */ -struct tisci_msg_resp_get_device_state { - struct tisci_msg_hdr hdr; - uint32_t context_loss_count; - uint32_t resets; - uint8_t programmed_state; -#define MSG_DEVICE_HW_STATE_OFF 0 -#define MSG_DEVICE_HW_STATE_ON 1 -#define MSG_DEVICE_HW_STATE_TRANS 2 - uint8_t current_state; -} __packed; - -/** - * @struct tisci_msg_req_set_device_reset - * @brief Set the desired resets configuration of the device - * @param hdr: Generic header - * @param id: Indicates which device to modify - * @param resets: A bit field of resets for the device. The meaning, behavior, - * and usage of the reset flags are device specific. 0 for a bit - * indicates releasing the reset represented by that bit while 1 - * indicates keeping it held. - * - * Request type is TISCI_MSG_SET_DEVICE_RESETS, responded with a generic - * ACK/NACK message. - */ -struct tisci_msg_req_set_device_resets { - struct tisci_msg_hdr hdr; - uint32_t id; - uint32_t resets; -} __packed; - -/** - * @struct tisci_msg_resp_set_device_resets - * @brief Response to set device resets request (generic ACK/NACK) - */ -struct tisci_msg_resp_set_device_resets { - struct tisci_msg_hdr hdr; -} __packed; - -/** - * @struct tisci_msg_req_set_clock_state - * @brief Request to setup a Clock state - * @param hdr: Generic Header, Certain flags can be set specific to the clocks: - * MSG_FLAG_CLOCK_ALLOW_SSC: Allow this clock to be modified - * via spread spectrum clocking. - * MSG_FLAG_CLOCK_ALLOW_FREQ_CHANGE: Allow this clock's - * frequency to be changed while it is running so long as it - * is within the min/max limits. - * MSG_FLAG_CLOCK_INPUT_TERM: Enable input termination, this - * is only applicable to clock inputs on the SoC pseudo-device. - * @param dev_id: Device identifier this request is for - * @param clk_id: Clock identifier for the device for this request. - * Each device has it's own set of clock inputs. This indexes - * which clock input to modify. - * @param request_state: Request the state for the clock to be set to. - * MSG_CLOCK_SW_STATE_UNREQ: The IP does not require this clock, - * it can be disabled, regardless of the state of the device - * MSG_CLOCK_SW_STATE_AUTO: Allow the System Controller to - * automatically manage the state of this clock. If the device - * is enabled, then the clock is enabled. If the device is set - * to off or retention, then the clock is internally set as not - * being required by the device.(default) - * MSG_CLOCK_SW_STATE_REQ: Configure the clock to be enabled, - * regardless of the state of the device. - * - * Normally, all required clocks are managed by TISCI entity, this is used - * only for specific control *IF* required. Auto managed state is - * MSG_CLOCK_SW_STATE_AUTO, in other states, TISCI entity assume remote - * will explicitly control. - * - * Request type is TISCI_MSG_SET_CLOCK_STATE, response is a generic - * ACK or NACK message. - */ -struct tisci_msg_req_set_clock_state { - /* Additional hdr->flags options */ -#define MSG_FLAG_CLOCK_ALLOW_SSC TISCI_MSG_FLAG(8) -#define MSG_FLAG_CLOCK_ALLOW_FREQ_CHANGE TISCI_MSG_FLAG(9) -#define MSG_FLAG_CLOCK_INPUT_TERM TISCI_MSG_FLAG(10) - struct tisci_msg_hdr hdr; - uint32_t dev_id; - uint8_t clk_id; -#define MSG_CLOCK_SW_STATE_UNREQ 0 -#define MSG_CLOCK_SW_STATE_AUTO 1 -#define MSG_CLOCK_SW_STATE_REQ 2 - uint8_t request_state; -} __packed; - -/** - * @struct tisci_msg_resp_set_clock_state - * @brief Response to set clock state (generic ACK/NACK) - */ -struct tisci_msg_resp_set_clock_state { - struct tisci_msg_hdr hdr; -} __packed; - -/** - * @struct tisci_msg_req_get_clock_state - * @brief Request for clock state - * @param hdr: Generic Header - * @param dev_id: Device identifier this request is for - * @param clk_id: Clock identifier for the device for this request. - * Each device has it's own set of clock inputs. This indexes - * which clock input to get state of. - * - * Request type is TISCI_MSG_GET_CLOCK_STATE, response is state - * of the clock - */ -struct tisci_msg_req_get_clock_state { - struct tisci_msg_hdr hdr; - uint32_t dev_id; - uint8_t clk_id; -} __packed; - -/** - * @struct tisci_msg_resp_get_clock_state - * @brief Response to get clock state - * @param hdr: Generic Header - * @param programmed_state: Any programmed state of the clock. This is one of - * MSG_CLOCK_SW_STATE* values. - * @param current_state: Current state of the clock. This is one of: - * MSG_CLOCK_HW_STATE_NOT_READY: Clock is not ready - * MSG_CLOCK_HW_STATE_READY: Clock is ready - * - * Response to TISCI_MSG_GET_CLOCK_STATE. - */ -struct tisci_msg_resp_get_clock_state { - struct tisci_msg_hdr hdr; - uint8_t programmed_state; -#define MSG_CLOCK_HW_STATE_NOT_READY 0 -#define MSG_CLOCK_HW_STATE_READY 1 - uint8_t current_state; -} __packed; - -/** - * @struct tisci_msg_req_set_clock_parent - * @brief Set the clock parent - * @param hdr: Generic Header - * @param dev_id: Device identifier this request is for - * @param clk_id: Clock identifier for the device for this request. - * Each device has it's own set of clock inputs. This indexes - * which clock input to modify. - * @param parent_id: The new clock parent is selectable by an index via this - * parameter. - * - * Request type is TISCI_MSG_SET_CLOCK_PARENT, response is generic - * ACK / NACK message. - */ -struct tisci_msg_req_set_clock_parent { - struct tisci_msg_hdr hdr; - uint32_t dev_id; - uint8_t clk_id; - uint8_t parent_id; -} __packed; - -/** - * @struct tisci_msg_resp_set_clock_parent - * @brief Response to set clock parent (generic ACK/NACK) - */ -struct tisci_msg_resp_set_clock_parent { - struct tisci_msg_hdr hdr; -} __packed; - -/** - * @struct tisci_msg_req_get_clock_parent - * @brief Get the clock parent - * @param hdr: Generic Header - * @param dev_id: Device identifier this request is for - * @param clk_id: Clock identifier for the device for this request. - * Each device has it's own set of clock inputs. This indexes - * which clock input to get the parent for. - * - * Request type is TISCI_MSG_GET_CLOCK_PARENT, response is parent information - */ -struct tisci_msg_req_get_clock_parent { - struct tisci_msg_hdr hdr; - uint32_t dev_id; - uint8_t clk_id; -} __packed; - -/** - * @struct tisci_msg_resp_get_clock_parent - * @brief Response with clock parent - * @param hdr: Generic Header - * @param parent_id: The current clock parent - * - * Response to TISCI_MSG_GET_CLOCK_PARENT. - */ -struct tisci_msg_resp_get_clock_parent { - struct tisci_msg_hdr hdr; - uint8_t parent_id; -} __packed; - -/** - * @struct tisci_msg_req_get_clock_num_parents - * @brief Request to get clock parents - * @param hdr: Generic header - * @param dev_id: Device identifier this request is for - * @param clk_id: Clock identifier for the device for this request. - * - * This request provides information about how many clock parent options - * are available for a given clock to a device. This is typically used - * for input clocks. - * - * Request type is TISCI_MSG_GET_NUM_CLOCK_PARENTS, response is appropriate - * message, or NACK in case of inability to satisfy request. - */ -struct tisci_msg_req_get_clock_num_parents { - struct tisci_msg_hdr hdr; - uint32_t dev_id; - uint8_t clk_id; -} __packed; - -/** - * @struct tisci_msg_resp_get_clock_num_parents - * @brief Response for get clk parents - * @param hdr: Generic header - * @param num_parents: Number of clock parents - * - * Response to TISCI_MSG_GET_NUM_CLOCK_PARENTS - */ -struct tisci_msg_resp_get_clock_num_parents { - struct tisci_msg_hdr hdr; - uint8_t num_parents; -} __packed; - -/** - * @struct tisci_msg_req_query_clock_freq - * @brief Request to query a frequency - * @param hdr: Generic Header - * @param dev_id: Device identifier this request is for - * @param min_freq_hz: The minimum allowable frequency in Hz. This is the minimum - * allowable programmed frequency and does not account for clock - * tolerances and jitter. - * @param target_freq_hz: The target clock frequency. A frequency will be found - * as close to this target frequency as possible. - * @param max_freq_hz: The maximum allowable frequency in Hz. This is the maximum - * allowable programmed frequency and does not account for clock - * tolerances and jitter. - * @param clk_id: Clock identifier for the device for this request. - * - * NOTE: Normally clock frequency management is automatically done by TISCI - * entity. In case of specific requests, TISCI evaluates capability to achieve - * requested frequency within provided range and responds with - * result message. - * - * Request type is TISCI_MSG_QUERY_CLOCK_FREQ, response is appropriate message, - * or NACK in case of inability to satisfy request. - */ -struct tisci_msg_req_query_clock_freq { - struct tisci_msg_hdr hdr; - uint32_t dev_id; - uint64_t min_freq_hz; - uint64_t target_freq_hz; - uint64_t max_freq_hz; - uint8_t clk_id; -} __packed; - -/** - * @struct tisci_msg_resp_query_clock_freq - * @brief Response to a clock frequency query - * @param hdr: Generic Header - * @param freq_hz: Frequency that is the best match in Hz. - * - * Response to request type TISCI_MSG_QUERY_CLOCK_FREQ. NOTE: if the request - * cannot be satisfied, the message will be of type NACK. - */ -struct tisci_msg_resp_query_clock_freq { - struct tisci_msg_hdr hdr; - uint64_t freq_hz; -} __packed; - -/** - * @struct tisci_msg_req_set_clock_freq - * @brief Request to setup a clock frequency - * @param hdr: Generic Header - * @param dev_id: Device identifier this request is for - * @param min_freq_hz: The minimum allowable frequency in Hz. This is the minimum - * allowable programmed frequency and does not account for clock - * tolerances and jitter. - * @param target_freq_hz: The target clock frequency. The clock will be programmed - * at a rate as close to this target frequency as possible. - * @param max_freq_hz: The maximum allowable frequency in Hz. This is the maximum - * allowable programmed frequency and does not account for clock - * tolerances and jitter. - * @param clk_id: Clock identifier for the device for this request. - * - * NOTE: Normally clock frequency management is automatically done by TISCI - * entity. In case of specific requests, TISCI evaluates capability to achieve - * requested range and responds with success/failure message. - * - * This sets the desired frequency for a clock within an allowable - * range. This message will fail on an enabled clock unless - * MSG_FLAG_CLOCK_ALLOW_FREQ_CHANGE is set for the clock. Additionally, - * if other clocks have their frequency modified due to this message, - * they also must have the MSG_FLAG_CLOCK_ALLOW_FREQ_CHANGE or be disabled. - * - * Calling set frequency on a clock input to the SoC pseudo-device will - * inform the PMMC of that clock's frequency. Setting a frequency of - * zero will indicate the clock is disabled. - * - * Calling set frequency on clock outputs from the SoC pseudo-device will - * function similarly to setting the clock frequency on a device. - * - * Request type is TISCI_MSG_SET_CLOCK_FREQ, response is a generic ACK/NACK - * message. - */ -struct tisci_msg_req_set_clock_freq { - struct tisci_msg_hdr hdr; - uint32_t dev_id; - uint64_t min_freq_hz; - uint64_t target_freq_hz; - uint64_t max_freq_hz; - uint8_t clk_id; -} __packed; - -/** - * @struct tisci_msg_resp_set_clock_freq - * @brief Response to set clock frequency (generic ACK/NACK) - */ -struct tisci_msg_resp_set_clock_freq { - struct tisci_msg_hdr hdr; -} __packed; - -/** - * @struct tisci_msg_req_get_clock_freq - * @brief Request to get the clock frequency - * @param hdr: Generic Header - * @param dev_id: Device identifier this request is for - * @param clk_id: Clock identifier for the device for this request. - * - * NOTE: Normally clock frequency management is automatically done by TISCI - * entity. In some cases, clock frequencies are configured by host. - * - * Request type is TISCI_MSG_GET_CLOCK_FREQ, responded with clock frequency - * that the clock is currently at. - */ -struct tisci_msg_req_get_clock_freq { - struct tisci_msg_hdr hdr; - uint32_t dev_id; - uint8_t clk_id; -} __packed; - -/** - * @struct tisci_msg_resp_get_clock_freq - * @brief Response of clock frequency request - * @param hdr: Generic Header - * @param freq_hz: Frequency that the clock is currently on, in Hz. - * - * Response to request type TISCI_MSG_GET_CLOCK_FREQ. - */ -struct tisci_msg_resp_get_clock_freq { - struct tisci_msg_hdr hdr; - uint64_t freq_hz; -} __packed; - -#define TISCI_IRQ_SECONDARY_HOST_INVALID 0xff - -/** - * @struct tisci_msg_req_get_resource_range - * @brief Request to get a host's assigned - * range of resources. - * @param hdr: Generic Header - * @param type: Unique resource assignment type - * @param subtype: Resource assignment subtype within the resource type. - * @param secondary_host: Host processing entity to which the resources are - * allocated. This is required only when the destination - * host id id different from ti sci interface host id, - * else TISCI_IRQ_SECONDARY_HOST_INVALID can be passed. - * - * Request type is TISCI_MSG_GET_RESOURCE_RANGE. Responded with requested - * resource range which is of type TISCI_MSG_GET_RESOURCE_RANGE. - */ -struct tisci_msg_req_get_resource_range { - struct tisci_msg_hdr hdr; -#define MSG_RM_RESOURCE_TYPE_MASK GENMASK(9, 0) -#define MSG_RM_RESOURCE_SUBTYPE_MASK GENMASK(5, 0) - uint16_t type; - uint8_t subtype; - uint8_t secondary_host; -} __packed; - -/** - * @struct tisci_msg_resp_get_resource_range - * @brief Response to resource get range. - * @param hdr: Generic Header - * @param range_start: Start index of the resource range. - * @param range_num: Number of resources in the range. - * - * Response to request TISCI_MSG_GET_RESOURCE_RANGE. - */ -struct tisci_msg_resp_get_resource_range { - struct tisci_msg_hdr hdr; - uint16_t range_start; - uint16_t range_num; -} __packed; -#define TISCI_ADDR_LOW_MASK GENMASK64(31, 0) -#define TISCI_ADDR_HIGH_MASK GENMASK64(63, 32) -#define TISCI_ADDR_HIGH_SHIFT 32 - -/** - * @struct tisci_msg_req_proc_request - * @brief Request a processor - * - * @param hdr: Generic Header - * @param processor_id: ID of processor - * - * Request type is TISCI_MSG_PROC_REQUEST, response is a generic ACK/NACK - * message. - */ -struct tisci_msg_req_proc_request { - struct tisci_msg_hdr hdr; - uint8_t processor_id; -} __packed; - -/** - * @struct tisci_msg_resp_proc_request - * @brief Response to processor request (generic ACK/NACK) - */ -struct tisci_msg_resp_proc_request { - struct tisci_msg_hdr hdr; -} __packed; - -/** - * @struct tisci_msg_req_proc_release - * @brief Release a processor - * - * @param hdr: Generic Header - * @param processor_id: ID of processor - * - * Request type is TISCI_MSG_PROC_RELEASE, response is a generic ACK/NACK - * message. - */ -struct tisci_msg_req_proc_release { - struct tisci_msg_hdr hdr; - uint8_t processor_id; -} __packed; - -/** - * @struct tisci_msg_resp_proc_release - * @brief Response to processor release (generic ACK/NACK) - */ -struct tisci_msg_resp_proc_release { - struct tisci_msg_hdr hdr; -} __packed; - -/** - * @struct tisci_msg_req_proc_handover - * @brief Handover a processor to a host - * - * @param hdr: Generic Header - * @param processor_id: ID of processor - * @param host_id: New Host we want to give control to - * - * Request type is TISCI_MSG_PROC_HANDOVER, response is a generic ACK/NACK - * message. - */ -struct tisci_msg_req_proc_handover { - struct tisci_msg_hdr hdr; - uint8_t processor_id; - uint8_t host_id; -} __packed; - -/** - * @struct tisci_msg_resp_proc_handover - * @brief Response to processor handover (generic ACK/NACK) - */ -struct tisci_msg_resp_proc_handover { - struct tisci_msg_hdr hdr; -} __packed; - -/* A53 Config Flags */ -#define PROC_BOOT_CFG_FLAG_ARMV8_DBG_EN 0x00000001 -#define PROC_BOOT_CFG_FLAG_ARMV8_DBG_NIDEN 0x00000002 -#define PROC_BOOT_CFG_FLAG_ARMV8_DBG_SPIDEN 0x00000004 -#define PROC_BOOT_CFG_FLAG_ARMV8_DBG_SPNIDEN 0x00000008 -#define PROC_BOOT_CFG_FLAG_ARMV8_AARCH32 0x00000100 - -/* R5 Config Flags */ -#define PROC_BOOT_CFG_FLAG_R5_DBG_EN 0x00000001 -#define PROC_BOOT_CFG_FLAG_R5_DBG_NIDEN 0x00000002 -#define PROC_BOOT_CFG_FLAG_R5_LOCKSTEP 0x00000100 -#define PROC_BOOT_CFG_FLAG_R5_TEINIT 0x00000200 -#define PROC_BOOT_CFG_FLAG_R5_NMFI_EN 0x00000400 -#define PROC_BOOT_CFG_FLAG_R5_TCM_RSTBASE 0x00000800 -#define PROC_BOOT_CFG_FLAG_R5_BTCM_EN 0x00001000 -#define PROC_BOOT_CFG_FLAG_R5_ATCM_EN 0x00002000 - -/** - * @struct tisci_msg_req_set_proc_boot_config - * @brief Set Processor boot configuration - * @param hdr: Generic Header - * @param processor_id: ID of processor - * @param bootvector_low: Lower 32bit (Little Endian) of boot vector - * @param bootvector_high: Higher 32bit (Little Endian) of boot vector - * @param config_flags_set: Optional Processor specific Config Flags to set. - * Setting a bit here implies required bit sets to 1. - * @param config_flags_clear: Optional Processor specific Config Flags to clear. - * Setting a bit here implies required bit gets cleared. - * - * Request type is TISCI_MSG_SET_PROC_BOOT_CONFIG, response is a generic - * ACK/NACK message. - */ -struct tisci_msg_req_set_proc_boot_config { - struct tisci_msg_hdr hdr; - uint8_t processor_id; - uint32_t bootvector_low; - uint32_t bootvector_high; - uint32_t config_flags_set; - uint32_t config_flags_clear; -} __packed; - -/** - * @struct tisci_msg_resp_set_proc_boot_config - * @brief Response to set processor boot config (generic ACK/NACK) - */ -struct tisci_msg_resp_set_proc_boot_config { - struct tisci_msg_hdr hdr; -} __packed; - -/* R5 Control Flags */ -#define PROC_BOOT_CTRL_FLAG_R5_CORE_HALT 0x00000001 - -/** - * @struct tisci_msg_req_set_proc_boot_ctrl - * @brief Set Processor boot control flags - * @param hdr: Generic Header - * @param processor_id: ID of processor - * @param control_flags_set: Optional Processor specific Control Flags to set. - * Setting a bit here implies required bit sets to 1. - * @param control_flags_clear:Optional Processor specific Control Flags to clear. - * Setting a bit here implies required bit gets cleared. - * - * Request type is TISCI_MSG_SET_PROC_BOOT_CTRL, response is a generic ACK/NACK - * message. - */ -struct tisci_msg_req_set_proc_boot_ctrl { - struct tisci_msg_hdr hdr; - uint8_t processor_id; - uint32_t control_flags_set; - uint32_t control_flags_clear; -} __packed; - -/** - * @struct tisci_msg_resp_set_proc_boot_ctrl - * @brief Response to set processor boot control (generic ACK/NACK) - */ -struct tisci_msg_resp_set_proc_boot_ctrl { - struct tisci_msg_hdr hdr; -} __packed; - -/** - * @struct tisci_msg_req_proc_auth_start_image - * @brief Authenticate and start image - * @param hdr: Generic Header - * @param cert_addr_low: Lower 32bit (Little Endian) of certificate - * @param cert_addr_high: Higher 32bit (Little Endian) of certificate - * - * Request type is TISCI_MSG_PROC_AUTH_BOOT_IMAGE, response is a generic - * ACK/NACK message. - */ -struct tisci_msg_req_proc_auth_boot_image { - struct tisci_msg_hdr hdr; - uint32_t cert_addr_low; - uint32_t cert_addr_high; -} __packed; - -struct tisci_msg_resp_proc_auth_boot_image { - struct tisci_msg_hdr hdr; - uint32_t image_addr_low; - uint32_t image_addr_high; - uint32_t image_size; -} __packed; - -/** - * @struct tisci_msg_req_get_proc_boot_status - * @brief Get processor boot status - * @param hdr: Generic Header - * @param processor_id: ID of processor - * - * Request type is TISCI_MSG_GET_PROC_BOOT_STATUS, response is appropriate - * message, or NACK in case of inability to satisfy request. - */ -struct tisci_msg_req_get_proc_boot_status { - struct tisci_msg_hdr hdr; - uint8_t processor_id; -} __packed; - -/* ARMv8 Status Flags */ -#define PROC_BOOT_STATUS_FLAG_ARMV8_WFE 0x00000001 -#define PROC_BOOT_STATUS_FLAG_ARMV8_WFI 0x00000002 - -/* R5 Status Flags */ -#define PROC_BOOT_STATUS_FLAG_R5_WFE 0x00000001 -#define PROC_BOOT_STATUS_FLAG_R5_WFI 0x00000002 -#define PROC_BOOT_STATUS_FLAG_R5_CLK_GATED 0x00000004 -#define PROC_BOOT_STATUS_FLAG_R5_LOCKSTEP_PERMITTED 0x00000100 - -/** - * @struct tisci_msg_resp_get_proc_boot_status - * @brief Processor boot status response - * @param hdr: Generic Header - * @param processor_id: ID of processor - * @param bootvector_low: Lower 32bit (Little Endian) of boot vector - * @param bootvector_high: Higher 32bit (Little Endian) of boot vector - * @param config_flags: Optional Processor specific Config Flags set. - * @param control_flags: Optional Processor specific Control Flags. - * @param status_flags: Optional Processor specific Status Flags set. - * - * Response to TISCI_MSG_GET_PROC_BOOT_STATUS. - */ -struct tisci_msg_resp_get_proc_boot_status { - struct tisci_msg_hdr hdr; - uint8_t processor_id; - uint32_t bootvector_low; - uint32_t bootvector_high; - uint32_t config_flags; - uint32_t control_flags; - uint32_t status_flags; -} __packed; - -/** - * @struct tisci_msg_req_wait_proc_boot_status - * @brief Wait for a processor boot status - * @param hdr: Generic Header - * @param processor_id: ID of processor - * @param num_wait_iterations: Total number of iterations we will check before - * we will timeout and give up - * @param num_match_iterations: How many iterations should we have continued - * status to account for status bits glitching. - * This is to make sure that match occurs for - * consecutive checks. This implies that the - * worst case should consider that the stable - * time should at the worst be num_wait_iterations - * num_match_iterations to prevent timeout. - * @param delay_per_iteration_us: Specifies how long to wait (in micro seconds) - * between each status checks. This is the minimum - * duration, and overhead of register reads and - * checks are on top of this and can vary based on - * varied conditions. - * @param delay_before_iterations_us: Specifies how long to wait (in micro seconds) - * before the very first check in the first - * iteration of status check loop. This is the - * minimum duration, and overhead of register - * reads and checks are. - * @param status_flags_1_set_all_wait:If non-zero, Specifies that all bits of the - * status matching this field requested MUST be 1. - * @param status_flags_1_set_any_wait:If non-zero, Specifies that at least one of the - * bits matching this field requested MUST be 1. - * @param status_flags_1_clr_all_wait:If non-zero, Specifies that all bits of the - * status matching this field requested MUST be 0. - * @param status_flags_1_clr_any_wait:If non-zero, Specifies that at least one of the - * bits matching this field requested MUST be 0. - * - * Request type is TISCI_MSG_WAIT_PROC_BOOT_STATUS, response is appropriate - * message, or NACK in case of inability to satisfy request. - */ -struct tisci_msg_req_wait_proc_boot_status { - struct tisci_msg_hdr hdr; - uint8_t processor_id; - uint8_t num_wait_iterations; - uint8_t num_match_iterations; - uint8_t delay_per_iteration_us; - uint8_t delay_before_iterations_us; - uint32_t status_flags_1_set_all_wait; - uint32_t status_flags_1_set_any_wait; - uint32_t status_flags_1_clr_all_wait; - uint32_t status_flags_1_clr_any_wait; -} __packed; - -/** - * @struct tisci_msg_rm_ring_cfg_req - * @brief Configure a Navigator Subsystem ring - * - * Configures the non-real-time registers of a Navigator Subsystem ring. - * @param hdr: Generic Header - * @param valid_params: Bitfield defining validity of ring configuration parameters. - * The ring configuration fields are not valid, and will not be used for - * ring configuration, if their corresponding valid bit is zero. - * Valid bit usage: - * 0 - Valid bit for tisci_msg_rm_ring_cfg_req addr_lo - * 1 - Valid bit for tisci_msg_rm_ring_cfg_req addr_hi - * 2 - Valid bit for tisci_msg_rm_ring_cfg_req count - * 3 - Valid bit for tisci_msg_rm_ring_cfg_req mode - * 4 - Valid bit for tisci_msg_rm_ring_cfg_req size - * 5 - Valid bit for tisci_msg_rm_ring_cfg_req order_id - * @param nav_id: Device ID of Navigator Subsystem from which the ring is allocated - * @param index: ring index to be configured. - * @param addr_lo: 32 LSBs of ring base address to be programmed into the ring's - * RING_BA_LO register - * @param addr_hi: 16 MSBs of ring base address to be programmed into the ring's - * RING_BA_HI register. - * @param count: Number of ring elements. Must be even if mode is CREDENTIALS or QM - * modes. - * @param mode: Specifies the mode the ring is to be configured. - * @param size: Specifies encoded ring element size. To calculate the encoded size use - * the formula (log2(size_bytes) - 2), where size_bytes cannot be - * greater than 256. - * @param order_id: Specifies the ring's bus order ID. - */ -struct tisci_msg_rm_ring_cfg_req { - struct tisci_msg_hdr hdr; - uint32_t valid_params; - uint16_t nav_id; - uint16_t index; - uint32_t addr_lo; - uint32_t addr_hi; - uint32_t count; - uint8_t mode; - uint8_t size; - uint8_t order_id; -} __packed; - -/** - * @struct tisci_msg_rm_ring_cfg_resp - * @brief Response to configuring a ring. - * - * @param hdr: Generic Header - */ -struct tisci_msg_rm_ring_cfg_resp { - struct tisci_msg_hdr hdr; -} __packed; - -/** - * @struct tisci_msg_rm_ring_get_cfg_req - * @brief Get RA ring's configuration - * - * Gets the configuration of the non-real-time register fields of a ring. The - * host, or a supervisor of the host, who owns the ring must be the requesting - * host. The values of the non-real-time registers are returned in - * tisci_msg_rm_ring_get_cfg_resp. - * - * @param hdr: Generic Header - * @param nav_id: Device ID of Navigator Subsystem from which the ring is allocated - * @param index: ring index. - */ -struct tisci_msg_rm_ring_get_cfg_req { - struct tisci_msg_hdr hdr; - uint16_t nav_id; - uint16_t index; -} __packed; - -/** - * @struct tisci_msg_rm_ring_get_cfg_resp - * @brief Ring get configuration response - * - * Response received by host processor after RM has handled - * @ref tisci_msg_rm_ring_get_cfg_req. The response contains the ring's - * non-real-time register values. - * - * @param hdr: Generic Header - * @param addr_lo: Ring 32 LSBs of base address - * @param addr_hi: Ring 16 MSBs of base address. - * @param count: Ring number of elements. - * @param mode: Ring mode. - * @param size: encoded Ring element size - * @param order_id: ing order ID. - */ -struct tisci_msg_rm_ring_get_cfg_resp { - struct tisci_msg_hdr hdr; - uint32_t addr_lo; - uint32_t addr_hi; - uint32_t count; - uint8_t mode; - uint8_t size; - uint8_t order_id; -} __packed; - -/** - * @struct tisci_msg_psil_pair_req - * @brief Pairs a PSI-L source thread to a destination - * thread - * @param hdr: Generic Header - * @param nav_id: SoC Navigator Subsystem device ID whose PSI-L config proxy is - * used to pair the source and destination threads. - * @param src_thread: PSI-L source thread ID within the PSI-L System thread map. - * - * UDMAP transmit channels mapped to source threads will have their - * TCHAN_THRD_ID register programmed with the destination thread if the pairing - * is successful. - - * @param dst_thread: PSI-L destination thread ID within the PSI-L System thread map. - * PSI-L destination threads start at index 0x8000. The request is NACK'd if - * the destination thread is not greater than or equal to 0x8000. - * - * UDMAP receive channels mapped to destination threads will have their - * RCHAN_THRD_ID register programmed with the source thread if the pairing - * is successful. - * - * Request type is TISCI_MSG_RM_PSIL_PAIR, response is a generic ACK or NACK - * message. - */ -struct tisci_msg_psil_pair_req { - struct tisci_msg_hdr hdr; - uint32_t nav_id; - uint32_t src_thread; - uint32_t dst_thread; -} __packed; - -/** - * @struct tisci_msg_psil_pair_resp - * @brief Response to PSI-L thread pair request (generic ACK/NACK) - * @param hdr: Generic Header - */ -struct tisci_msg_psil_pair_resp { - struct tisci_msg_hdr hdr; -} __packed; - -/** - * @struct tisci_msg_psil_unpair_req - * @brief Unpairs a PSI-L source thread from a destination thread - * @param hdr: Generic Header - * @param nav_id: SoC Navigator Subsystem device ID whose PSI-L config proxy is - * used to unpair the source and destination threads. - * @param src_thread: PSI-L source thread ID within the PSI-L System thread map. - * - * UDMAP transmit channels mapped to source threads will have their - * TCHAN_THRD_ID register cleared if the unpairing is successful. - * - * @param dst_thread: PSI-L destination thread ID within the PSI-L System thread map. - * PSI-L destination threads start at index 0x8000. The request is NACK'd if - * the destination thread is not greater than or equal to 0x8000. - * - * UDMAP receive channels mapped to destination threads will have their - * RCHAN_THRD_ID register cleared if the unpairing is successful. - * - * Request type is TISCI_MSG_RM_PSIL_UNPAIR, response is a generic ACK or NACK - * message. - */ -struct tisci_msg_psil_unpair_req { - struct tisci_msg_hdr hdr; - uint32_t nav_id; - uint32_t src_thread; - uint32_t dst_thread; -} __packed; - -/** - * @struct tisci_msg_psil_unpair_resp - * @brief Response to PSI-L thread unpair request (generic ACK/NACK) - * @param hdr: Generic Header - */ -struct tisci_msg_psil_unpair_resp { - struct tisci_msg_hdr hdr; -} __packed; - -/** - * Configures a Navigator Subsystem UDMAP transmit channel - * - * Configures the non-real-time registers of a Navigator Subsystem UDMAP - * transmit channel. The channel index must be assigned to the host defined - * in the TISCI header via the RM board configuration resource assignment - * range list. - * - * @param hdr: Generic Header - * - * @param valid_params: Bitfield defining validity of tx channel configuration - * parameters. The tx channel configuration fields are not valid, and will not - * be used for ch configuration, if their corresponding valid bit is zero. - * Valid bit usage: - * 0 - Valid bit for tisci_msg_rm_udmap_tx_ch_cfg::tx_pause_on_err - * 1 - Valid bit for tisci_msg_rm_udmap_tx_ch_cfg::tx_atype - * 2 - Valid bit for tisci_msg_rm_udmap_tx_ch_cfg::tx_chan_type - * 3 - Valid bit for tisci_msg_rm_udmap_tx_ch_cfg::tx_fetch_size - * 4 - Valid bit for tisci_msg_rm_udmap_tx_ch_cfg::txcq_qnum - * 5 - Valid bit for tisci_msg_rm_udmap_tx_ch_cfg::tx_priority - * 6 - Valid bit for tisci_msg_rm_udmap_tx_ch_cfg::tx_qos - * 7 - Valid bit for tisci_msg_rm_udmap_tx_ch_cfg::tx_orderid - * 8 - Valid bit for tisci_msg_rm_udmap_tx_ch_cfg::tx_sched_priority - * 9 - Valid bit for tisci_msg_rm_udmap_tx_ch_cfg::tx_filt_einfo - * 10 - Valid bit for tisci_msg_rm_udmap_tx_ch_cfg::tx_filt_pswords - * 11 - Valid bit for tisci_msg_rm_udmap_tx_ch_cfg::tx_supr_tdpkt - * 12 - Valid bit for tisci_msg_rm_udmap_tx_ch_cfg::tx_credit_count - * 13 - Valid bit for tisci_msg_rm_udmap_tx_ch_cfg::fdepth - * 14 - Valid bit for tisci_msg_rm_udmap_tx_ch_cfg::tx_burst_size - * 15 - Valid bit for tisci_msg_rm_udmap_tx_ch_cfg::tx_tdtype - * 16 - Valid bit for tisci_msg_rm_udmap_tx_ch_cfg::extended_ch_type - * - * @param nav_id: SoC device ID of Navigator Subsystem where tx channel is located - * - * @param index: UDMAP transmit channel index. - * - * @param tx_pause_on_err: UDMAP transmit channel pause on error configuration to - * be programmed into the tx_pause_on_err field of the channel's TCHAN_TCFG - * register. - * - * @param tx_filt_einfo: UDMAP transmit channel extended packet information passing - * configuration to be programmed into the tx_filt_einfo field of the - * channel's TCHAN_TCFG register. - * - * @param tx_filt_pswords: UDMAP transmit channel protocol specific word passing - * configuration to be programmed into the tx_filt_pswords field of the - * channel's TCHAN_TCFG register. - * - * @param tx_atype: UDMAP transmit channel non Ring Accelerator access pointer - * interpretation configuration to be programmed into the tx_atype field of - * the channel's TCHAN_TCFG register. - * - * @param tx_chan_type: UDMAP transmit channel functional channel type and work - * passing mechanism configuration to be programmed into the tx_chan_type - * field of the channel's TCHAN_TCFG register. - * - * @param tx_supr_tdpkt: UDMAP transmit channel teardown packet generation suppression - * configuration to be programmed into the tx_supr_tdpkt field of the channel's - * TCHAN_TCFG register. - * - * @param tx_fetch_size: UDMAP transmit channel number of 32-bit descriptor words to - * fetch configuration to be programmed into the tx_fetch_size field of the - * channel's TCHAN_TCFG register. The user must make sure to set the maximum - * word count that can pass through the channel for any allowed descriptor type. - * - * @param tx_credit_count: UDMAP transmit channel transfer request credit count - * configuration to be programmed into the count field of the TCHAN_TCREDIT - * register. Specifies how many credits for complete TRs are available. - * - * @param txcq_qnum: UDMAP transmit channel completion queue configuration to be - * programmed into the txcq_qnum field of the TCHAN_TCQ register. The specified - * completion queue must be assigned to the host, or a subordinate of the host, - * requesting configuration of the transmit channel. - * - * @param tx_priority: UDMAP transmit channel transmit priority value to be programmed - * into the priority field of the channel's TCHAN_TPRI_CTRL register. - * - * @param tx_qos: UDMAP transmit channel transmit qos value to be programmed into the - * qos field of the channel's TCHAN_TPRI_CTRL register. - * - * @param tx_orderid: UDMAP transmit channel bus order id value to be programmed into - * the orderid field of the channel's TCHAN_TPRI_CTRL register. - * - * @param fdepth: UDMAP transmit channel FIFO depth configuration to be programmed - * into the fdepth field of the TCHAN_TFIFO_DEPTH register. Sets the number of - * Tx FIFO bytes which are allowed to be stored for the channel. Check the UDMAP - * section of the TRM for restrictions regarding this parameter. - * - * @param tx_sched_priority: UDMAP transmit channel tx scheduling priority - * configuration to be programmed into the priority field of the channel's - * TCHAN_TST_SCHED register. - * - * @param tx_burst_size: UDMAP transmit channel burst size configuration to be - * programmed into the tx_burst_size field of the TCHAN_TCFG register. - * - * @param tx_tdtype: UDMAP transmit channel teardown type configuration to be - * programmed into the tdtype field of the TCHAN_TCFG register: - * 0 - Return immediately - * 1 - Wait for completion message from remote peer - * - * @param extended_ch_type: Valid for BCDMA. - * 0 - the channel is split tx channel (tchan) - * 1 - the channel is block copy channel (bchan) - */ -struct tisci_msg_rm_udmap_tx_ch_cfg_req { - struct tisci_msg_hdr hdr; - uint32_t valid_params; - uint16_t nav_id; - uint16_t index; - uint8_t tx_pause_on_err; - uint8_t tx_filt_einfo; - uint8_t tx_filt_pswords; - uint8_t tx_atype; - uint8_t tx_chan_type; - uint8_t tx_supr_tdpkt; - uint16_t tx_fetch_size; - uint8_t tx_credit_count; - uint16_t txcq_qnum; - uint8_t tx_priority; - uint8_t tx_qos; - uint8_t tx_orderid; - uint16_t fdepth; - uint8_t tx_sched_priority; - uint8_t tx_burst_size; - uint8_t tx_tdtype; - uint8_t extended_ch_type; -} __packed; - -/** - * @struct tisci_msg_rm_udmap_tx_ch_cfg_resp - * @brief Response to UDMAP transmit channel configuration request (generic ACK/NACK) - * @param hdr: Generic Header - */ -struct tisci_msg_rm_udmap_tx_ch_cfg_resp { - struct tisci_msg_hdr hdr; -} __packed; - -/** - * Configures a Navigator Subsystem UDMAP receive channel - * - * Configures the non-real-time registers of a Navigator Subsystem UDMAP - * receive channel. The channel index must be assigned to the host defined - * in the TISCI header via the RM board configuration resource assignment - * range list. - * - * @param hdr: Generic Header - * - * @param valid_params: Bitfield defining validity of rx channel configuration - * parameters. - * The rx channel configuration fields are not valid, and will not be used for - * ch configuration, if their corresponding valid bit is zero. - * Valid bit usage: - * 0 - Valid bit for @ref tisci_msg_rm_udmap_rx_ch_cfg_req::rx_pause_on_err - * 1 - Valid bit for @ref tisci_msg_rm_udmap_rx_ch_cfg_req::rx_atype - * 2 - Valid bit for @ref tisci_msg_rm_udmap_rx_ch_cfg_req::rx_chan_type - * 3 - Valid bit for @ref tisci_msg_rm_udmap_rx_ch_cfg_req::rx_fetch_size - * 4 - Valid bit for @ref tisci_msg_rm_udmap_rx_ch_cfg_req::rxcq_qnum - * 5 - Valid bit for @ref tisci_msg_rm_udmap_rx_ch_cfg_req::rx_priority - * 6 - Valid bit for @ref tisci_msg_rm_udmap_rx_ch_cfg_req::rx_qos - * 7 - Valid bit for @ref tisci_msg_rm_udmap_rx_ch_cfg_req::rx_orderid - * 8 - Valid bit for @ref tisci_msg_rm_udmap_rx_ch_cfg_req::rx_sched_priority - * 9 - Valid bit for @ref tisci_msg_rm_udmap_rx_ch_cfg_req::flowid_start - * 10 - Valid bit for @ref tisci_msg_rm_udmap_rx_ch_cfg_req::flowid_cnt - * 11 - Valid bit for @ref tisci_msg_rm_udmap_rx_ch_cfg_req::rx_ignore_short - * 12 - Valid bit for @ref tisci_msg_rm_udmap_rx_ch_cfg_req::rx_ignore_long - * - * @param nav_id: SoC device ID of Navigator Subsystem where rx channel is located - * - * @param index: UDMAP receive channel index. - * - * @param rx_fetch_size: UDMAP receive channel number of 32-bit descriptor words to - * fetch configuration to be programmed into the rx_fetch_size field of the - * channel's RCHAN_RCFG register. - * - * @param rxcq_qnum: UDMAP receive channel completion queue configuration to be - * programmed into the rxcq_qnum field of the RCHAN_RCQ register. - * The specified completion queue must be assigned to the host, or a subordinate - * of the host, requesting configuration of the receive channel. - * - * @param rx_priority: UDMAP receive channel receive priority value to be programmed - * into the priority field of the channel's RCHAN_RPRI_CTRL register. - * - * @param rx_qos: UDMAP receive channel receive qos value to be programmed into the - * qos field of the channel's RCHAN_RPRI_CTRL register. - * - * @param rx_orderid: UDMAP receive channel bus order id value to be programmed into - * the orderid field of the channel's RCHAN_RPRI_CTRL register. - * - * @param rx_sched_priority: UDMAP receive channel rx scheduling priority - * configuration to be programmed into the priority field of the channel's - * RCHAN_RST_SCHED register. - * - * @param flowid_start: UDMAP receive channel additional flows starting index - * configuration to program into the flow_start field of the RCHAN_RFLOW_RNG - * register. Specifies the starting index for flow IDs the receive channel is to - * make use of beyond the default flow. flowid_start and @ref flowid_cnt must be - * set as valid and configured together. The starting flow ID set by - * @ref flowid_cnt must be a flow index within the Navigator Subsystem's subset - * of flows beyond the default flows statically mapped to receive channels. - * The additional flows must be assigned to the host, or a subordinate of the - * host, requesting configuration of the receive channel. - * - * @param flowid_cnt: UDMAP receive channel additional flows count configuration to - * program into the flowid_cnt field of the RCHAN_RFLOW_RNG register. - * This field specifies how many flow IDs are in the additional contiguous range - * of legal flow IDs for the channel. @ref flowid_start and flowid_cnt must be - * set as valid and configured together. Disabling the valid_params field bit - * for flowid_cnt indicates no flow IDs other than the default are to be - * allocated and used by the receive channel. @ref flowid_start plus flowid_cnt - * cannot be greater than the number of receive flows in the receive channel's - * Navigator Subsystem. The additional flows must be assigned to the host, or a - * subordinate of the host, requesting configuration of the receive channel. - * - * @param rx_pause_on_err: UDMAP receive channel pause on error configuration to be - * programmed into the rx_pause_on_err field of the channel's RCHAN_RCFG - * register. - * - * @param rx_atype: UDMAP receive channel non Ring Accelerator access pointer - * interpretation configuration to be programmed into the rx_atype field of the - * channel's RCHAN_RCFG register. - * - * @param rx_chan_type: UDMAP receive channel functional channel type and work passing - * mechanism configuration to be programmed into the rx_chan_type field of the - * channel's RCHAN_RCFG register. - * - * @param rx_ignore_short: UDMAP receive channel short packet treatment configuration - * to be programmed into the rx_ignore_short field of the RCHAN_RCFG register. - * - * @param rx_ignore_long: UDMAP receive channel long packet treatment configuration to - * be programmed into the rx_ignore_long field of the RCHAN_RCFG register. - */ -struct tisci_msg_rm_udmap_rx_ch_cfg_req { - struct tisci_msg_hdr hdr; - uint32_t valid_params; - uint16_t nav_id; - uint16_t index; - uint16_t rx_fetch_size; - uint16_t rxcq_qnum; - uint8_t rx_priority; - uint8_t rx_qos; - uint8_t rx_orderid; - uint8_t rx_sched_priority; - uint16_t flowid_start; - uint16_t flowid_cnt; - uint8_t rx_pause_on_err; - uint8_t rx_atype; - uint8_t rx_chan_type; - uint8_t rx_ignore_short; - uint8_t rx_ignore_long; -} __packed; - -/** - * @struct tisci_msg_rm_udmap_rx_ch_cfg_resp - * @brief Response to UDMAP receive channel configuration request (generic ACK/NACK) - * @param hdr: Generic Header - */ -struct tisci_msg_rm_udmap_rx_ch_cfg_resp { - struct tisci_msg_hdr hdr; -} __packed; - -/** - * Configures a Navigator Subsystem UDMAP receive flow - * - * Configures a Navigator Subsystem UDMAP receive flow's registers. - * Configuration does not include the flow registers which handle size-based - * free descriptor queue routing. - * - * The flow index must be assigned to the host defined in the TISCI header via - * the RM board configuration resource assignment range list. - * - * @param hdr: Standard TISCI header - * - * Valid params - * Bitfield defining validity of rx flow configuration parameters. The - * rx flow configuration fields are not valid, and will not be used for flow - * configuration, if their corresponding valid bit is zero. Valid bit usage: - * 0 - Valid bit for reftisci_msg_rm_udmap_flow_cfg_req::rx_einfo_present - * 1 - Valid bit for reftisci_msg_rm_udmap_flow_cfg_req::rx_psinfo_present - * 2 - Valid bit for reftisci_msg_rm_udmap_flow_cfg_req::rx_error_handling - * 3 - Valid bit for reftisci_msg_rm_udmap_flow_cfg_req::rx_desc_type - * 4 - Valid bit for reftisci_msg_rm_udmap_flow_cfg_req::rx_sop_offset - * 5 - Valid bit for reftisci_msg_rm_udmap_flow_cfg_req::rx_dest_qnum - * 6 - Valid bit for reftisci_msg_rm_udmap_flow_cfg_req::rx_src_tag_hi - * 7 - Valid bit for reftisci_msg_rm_udmap_flow_cfg_req::rx_src_tag_lo - * 8 - Valid bit for reftisci_msg_rm_udmap_flow_cfg_req::rx_dest_tag_hi - * 9 - Valid bit for reftisci_msg_rm_udmap_flow_cfg_req::rx_dest_tag_lo - * 10 - Valid bit for reftisci_msg_rm_udmap_flow_cfg_req::rx_src_tag_hi_sel - * 11 - Valid bit for reftisci_msg_rm_udmap_flow_cfg_req::rx_src_tag_lo_sel - * 12 - Valid bit for reftisci_msg_rm_udmap_flow_cfg_req::rx_dest_tag_hi_sel - * 13 - Valid bit for reftisci_msg_rm_udmap_flow_cfg_req::rx_dest_tag_lo_sel - * 14 - Valid bit for reftisci_msg_rm_udmap_flow_cfg_req::rx_fdq0_sz0_qnum - * 15 - Valid bit for reftisci_msg_rm_udmap_flow_cfg_req::rx_fdq1_sz0_qnum - * 16 - Valid bit for reftisci_msg_rm_udmap_flow_cfg_req::rx_fdq2_sz0_qnum - * 17 - Valid bit for reftisci_msg_rm_udmap_flow_cfg_req::rx_fdq3_sz0_qnum - * 18 - Valid bit for reftisci_msg_rm_udmap_flow_cfg_req::rx_ps_location - * - * @param nav_id: SoC device ID of Navigator Subsystem from which the receive flow is - * allocated - * - * @param flow_index: UDMAP receive flow index for non-optional configuration. - * - * @param rx_einfo_present: - * UDMAP receive flow extended packet info present configuration to be - * programmed into the rx_einfo_present field of the flow's RFLOW_RFA register. - * - * @param rx_psinfo_present: - * UDMAP receive flow PS words present configuration to be programmed into the - * rx_psinfo_present field of the flow's RFLOW_RFA register. - * - * @param rx_error_handling: - * UDMAP receive flow error handling configuration to be programmed into the - * rx_error_handling field of the flow's RFLOW_RFA register. - * - * @param rx_desc_type: - * UDMAP receive flow descriptor type configuration to be programmed into the - * rx_desc_type field field of the flow's RFLOW_RFA register. - * - * @param rx_sop_offset: - * UDMAP receive flow start of packet offset configuration to be programmed - * into the rx_sop_offset field of the RFLOW_RFA register. See the UDMAP - * section of the TRM for more information on this setting. Valid values for - * this field are 0-255 bytes. - * - * @param rx_dest_qnum: - * UDMAP receive flow destination queue configuration to be programmed into the - * rx_dest_qnum field of the flow's RFLOW_RFA register. The specified - * destination queue must be valid within the Navigator Subsystem and must be - * owned by the host, or a subordinate of the host, requesting allocation and - * configuration of the receive flow. - * - * @param rx_src_tag_hi: - * UDMAP receive flow source tag high byte constant configuration to be - * programmed into the rx_src_tag_hi field of the flow's RFLOW_RFB register. - * See the UDMAP section of the TRM for more information on this setting. - * - * @param rx_src_tag_lo: - * UDMAP receive flow source tag low byte constant configuration to be - * programmed into the rx_src_tag_lo field of the flow's RFLOW_RFB register. - * See the UDMAP section of the TRM for more information on this setting. - * - * @param rx_dest_tag_hi: - * UDMAP receive flow destination tag high byte constant configuration to be - * programmed into the rx_dest_tag_hi field of the flow's RFLOW_RFB register. - * See the UDMAP section of the TRM for more information on this setting. - * - * @param rx_dest_tag_lo: - * UDMAP receive flow destination tag low byte constant configuration to be - * programmed into the rx_dest_tag_lo field of the flow's RFLOW_RFB register. - * See the UDMAP section of the TRM for more information on this setting. - * - * @param rx_src_tag_hi_sel: - * UDMAP receive flow source tag high byte selector configuration to be - * programmed into the rx_src_tag_hi_sel field of the RFLOW_RFC register. See - * the UDMAP section of the TRM for more information on this setting. - * - * @param rx_src_tag_lo_sel: - * UDMAP receive flow source tag low byte selector configuration to be - * programmed into the rx_src_tag_lo_sel field of the RFLOW_RFC register. See - * the UDMAP section of the TRM for more information on this setting. - * - * @param rx_dest_tag_hi_sel: - * UDMAP receive flow destination tag high byte selector configuration to be - * programmed into the rx_dest_tag_hi_sel field of the RFLOW_RFC register. See - * the UDMAP section of the TRM for more information on this setting. - * - * @param rx_dest_tag_lo_sel: - * UDMAP receive flow destination tag low byte selector configuration to be - * programmed into the rx_dest_tag_lo_sel field of the RFLOW_RFC register. See - * the UDMAP section of the TRM for more information on this setting. - * - * @param rx_fdq0_sz0_qnum: - * UDMAP receive flow free descriptor queue 0 configuration to be programmed - * into the rx_fdq0_sz0_qnum field of the flow's RFLOW_RFD register. See the - * UDMAP section of the TRM for more information on this setting. The specified - * free queue must be valid within the Navigator Subsystem and must be owned - * by the host, or a subordinate of the host, requesting allocation and - * configuration of the receive flow. - * - * @param rx_fdq1_qnum: - * UDMAP receive flow free descriptor queue 1 configuration to be programmed - * into the rx_fdq1_qnum field of the flow's RFLOW_RFD register. See the - * UDMAP section of the TRM for more information on this setting. The specified - * free queue must be valid within the Navigator Subsystem and must be owned - * by the host, or a subordinate of the host, requesting allocation and - * configuration of the receive flow. - * - * @param rx_fdq2_qnum: - * UDMAP receive flow free descriptor queue 2 configuration to be programmed - * into the rx_fdq2_qnum field of the flow's RFLOW_RFE register. See the - * UDMAP section of the TRM for more information on this setting. The specified - * free queue must be valid within the Navigator Subsystem and must be owned - * by the host, or a subordinate of the host, requesting allocation and - * configuration of the receive flow. - * - * @param rx_fdq3_qnum: - * UDMAP receive flow free descriptor queue 3 configuration to be programmed - * into the rx_fdq3_qnum field of the flow's RFLOW_RFE register. See the - * UDMAP section of the TRM for more information on this setting. The specified - * free queue must be valid within the Navigator Subsystem and must be owned - * by the host, or a subordinate of the host, requesting allocation and - * configuration of the receive flow. - * - * @param rx_ps_location: - * UDMAP receive flow PS words location configuration to be programmed into the - * rx_ps_location field of the flow's RFLOW_RFA register. - */ -struct tisci_msg_rm_udmap_flow_cfg_req { - struct tisci_msg_hdr hdr; - uint32_t valid_params; - uint16_t nav_id; - uint16_t flow_index; - uint8_t rx_einfo_present; - uint8_t rx_psinfo_present; - uint8_t rx_error_handling; - uint8_t rx_desc_type; - uint16_t rx_sop_offset; - uint16_t rx_dest_qnum; - uint8_t rx_src_tag_hi; - uint8_t rx_src_tag_lo; - uint8_t rx_dest_tag_hi; - uint8_t rx_dest_tag_lo; - uint8_t rx_src_tag_hi_sel; - uint8_t rx_src_tag_lo_sel; - uint8_t rx_dest_tag_hi_sel; - uint8_t rx_dest_tag_lo_sel; - uint16_t rx_fdq0_sz0_qnum; - uint16_t rx_fdq1_qnum; - uint16_t rx_fdq2_qnum; - uint16_t rx_fdq3_qnum; - uint8_t rx_ps_location; -} __packed; - -/** - * Response to configuring a Navigator Subsystem UDMAP receive flow - * - * @param hdr: Standard TISCI header - */ -struct tisci_msg_rm_udmap_flow_cfg_resp { - struct tisci_msg_hdr hdr; -} __packed; - -#define FWL_MAX_PRIVID_SLOTS 3U - -/** - * @struct tisci_msg_fwl_set_firewall_region_req - * @brief Request for configuring the firewall permissions. - * - * @param hdr: Generic Header - * - * @param fwl_id: Firewall ID in question - * @param region: Region or channel number to set config info - * This field is unused in case of a simple firewall and must be initialized - * to zero. In case of a region based firewall, this field indicates the - * region in question. (index starting from 0) In case of a channel based - * firewall, this field indicates the channel in question (index starting - * from 0) - * @param n_permission_regs: Number of permission registers to set - * @param control: Contents of the firewall CONTROL register to set - * @param permissions: Contents of the firewall PERMISSION register to set - * @param start_address: Contents of the firewall START_ADDRESS register to set - * @param end_address: Contents of the firewall END_ADDRESS register to set - */ - -struct tisci_msg_fwl_set_firewall_region_req { - struct tisci_msg_hdr hdr; - uint16_t fwl_id; - uint16_t region; - uint32_t n_permission_regs; - uint32_t control; - uint32_t permissions[FWL_MAX_PRIVID_SLOTS]; - uint64_t start_address; - uint64_t end_address; -} __packed; - -/** - * @struct tisci_msg_fwl_set_firewall_region_resp - * @brief Response to set firewall region (generic ACK/NACK) - */ -struct tisci_msg_fwl_set_firewall_region_resp { - struct tisci_msg_hdr hdr; -} __packed; - -/** - * @struct tisci_msg_fwl_get_firewall_region_req - * @brief Request for retrieving the firewall permissions - * - * @param hdr: Generic Header - * - * @param fwl_id: Firewall ID in question - * @param region: Region or channel number to get config info - * This field is unused in case of a simple firewall and must be initialized - * to zero. In case of a region based firewall, this field indicates the - * region in question (index starting from 0). In case of a channel based - * firewall, this field indicates the channel in question (index starting - * from 0). - * @param n_permission_regs: Number of permission registers to retrieve - */ -struct tisci_msg_fwl_get_firewall_region_req { - struct tisci_msg_hdr hdr; - uint16_t fwl_id; - uint16_t region; - uint32_t n_permission_regs; -} __packed; - -/** - * @struct tisci_msg_fwl_get_firewall_region_resp - * @brief Response for retrieving the firewall permissions - * - * @param hdr: Generic Header - * - * @param fwl_id: Firewall ID in question - * @param region: Region or channel number to set config info This field is - * unused in case of a simple firewall and must be initialized to zero. In - * case of a region based firewall, this field indicates the region in - * question. (index starting from 0) In case of a channel based firewall, this - * field indicates the channel in question (index starting from 0) - * @param n_permission_regs: Number of permission registers retrieved - * @param control: Contents of the firewall CONTROL register - * @param permissions: Contents of the firewall PERMISSION registers - * @param start_address: Contents of the firewall START_ADDRESS - * register This is not applicable for - * channelized firewalls. - * @param end_address: Contents of the firewall END_ADDRESS register This is not applicable for - * channelized firewalls. - */ -struct tisci_msg_fwl_get_firewall_region_resp { - struct tisci_msg_hdr hdr; - uint16_t fwl_id; - uint16_t region; - uint32_t n_permission_regs; - uint32_t control; - uint32_t permissions[FWL_MAX_PRIVID_SLOTS]; - uint64_t start_address; - uint64_t end_address; -} __packed; - -/** - * @struct tisci_msg_fwl_change_owner_info_req - * @brief Request for a firewall owner change - * - * @param hdr: Generic Header - * - * @param fwl_id: Firewall ID in question - * @param region: Region or channel number if applicable - * @param owner_index: New owner index to transfer ownership to - */ -struct tisci_msg_fwl_change_owner_info_req { - struct tisci_msg_hdr hdr; - uint16_t fwl_id; - uint16_t region; - uint8_t owner_index; -} __packed; - -/** - * @struct tisci_msg_fwl_change_owner_info_resp - * @brief Response for a firewall owner change - * - * @param hdr: Generic Header - * - * @param fwl_id: Firewall ID specified in request - * @param region: Region or channel number specified in request - * @param owner_index: Owner index specified in request - * @param owner_privid: New owner priv-ID returned by DMSC. - * @param owner_permission_bits: New owner permission bits returned by DMSC. - */ - -struct tisci_msg_fwl_change_owner_info_resp { - struct tisci_msg_hdr hdr; - uint16_t fwl_id; - uint16_t region; - uint8_t owner_index; - uint8_t owner_privid; - uint16_t owner_permission_bits; -} __packed; - -/** - * @brief Request to set up an interrupt route. - * - * Configures peripherals within the interrupt subsystem according to the - * valid configuration provided. - * - * @param hdr Standard TISCI header. - * @param valid_params Bitfield defining validity of interrupt route set parameters. - * Each bit corresponds to a field's validity. - * @param src_id ID of interrupt source peripheral. - * @param src_index Interrupt source index within source peripheral. - * @param dst_id SoC IR device ID (valid if TISCI_MSG_VALUE_RM_DST_ID_VALID is set). - * @param dst_host_irq SoC IR output index (valid if TISCI_MSG_VALUE_RM_DST_HOST_IRQ_VALID - * is set). - * @param ia_id Device ID of interrupt aggregator (valid if - * TISCI_MSG_VALUE_RM_IA_ID_VALID is set). - * @param vint Virtual interrupt number (valid if TISCI_MSG_VALUE_RM_VINT_VALID is - * set). - * @param global_event Global event mapped to interrupt aggregator (valid if - * TISCI_MSG_VALUE_RM_GLOBAL_EVENT_VALID is set). - * @param vint_status_bit_index Virtual interrupt status bit (valid if - * TISCI_MSG_VALUE_RM_VINT_STATUS_BIT_INDEX_VALID is set). - * @param secondary_host Secondary host value (valid if - * TISCI_MSG_VALUE_RM_SECONDARY_HOST_VALID is set). - */ -struct tisci_msg_rm_irq_set_req { - struct tisci_msg_hdr hdr; - uint32_t valid_params; - uint16_t src_id; - uint16_t src_index; - uint16_t dst_id; - uint16_t dst_host_irq; - uint16_t ia_id; - uint16_t vint; - uint16_t global_event; - uint8_t vint_status_bit_index; - uint8_t secondary_host; -} __packed; - -/** - * @brief Response to setting a peripheral to processor interrupt. - * - * @param hdr Standard TISCI header. - */ -struct tisci_msg_rm_irq_set_resp { - struct tisci_msg_hdr hdr; -} __packed; - -/** - * @brief Request to release interrupt peripheral resources. - * - * Releases interrupt peripheral resources according to the valid configuration provided. - * - * @param hdr Standard TISCI header. - * @param valid_params Bitfield defining validity of interrupt route release parameters. - * Each bit corresponds to a field's validity. - * @param src_id ID of interrupt source peripheral. - * @param src_index Interrupt source index within source peripheral. - * @param dst_id SoC IR device ID (valid if TISCI_MSG_VALUE_RM_DST_ID_VALID is set). - * @param dst_host_irq SoC IR output index (valid if TISCI_MSG_VALUE_RM_DST_HOST_IRQ_VALID - * is set). - * @param ia_id Device ID of interrupt aggregator (valid if - * TISCI_MSG_VALUE_RM_IA_ID_VALID is set). - * @param vint Virtual interrupt number (valid if TISCI_MSG_VALUE_RM_VINT_VALID is - * set). - * @param global_event Global event mapped to interrupt aggregator (valid if - * TISCI_MSG_VALUE_RM_GLOBAL_EVENT_VALID is set). - * @param vint_status_bit_index Virtual interrupt status bit (valid if - * TISCI_MSG_VALUE_RM_VINT_STATUS_BIT_INDEX_VALID is set). - * @param secondary_host Secondary host value (valid if - * TISCI_MSG_VALUE_RM_SECONDARY_HOST_VALID is set). - */ -struct tisci_msg_rm_irq_release_req { - struct tisci_msg_hdr hdr; - uint32_t valid_params; - uint16_t src_id; - uint16_t src_index; - uint16_t dst_id; - uint16_t dst_host_irq; - uint16_t ia_id; - uint16_t vint; - uint16_t global_event; - uint8_t vint_status_bit_index; - uint8_t secondary_host; -} __packed; - -/** - * @brief Response to releasing a peripheral to processor interrupt. - * - * @param hdr Standard TISCI header. - */ -struct tisci_msg_rm_irq_release_resp { - struct tisci_msg_hdr hdr; -} __packed; - -#endif /* INCLUDE_ZEPHYR_DRIVERS_MISC_TISCI_H_ */ diff --git a/dts/bindings/firmware/ti,k2g-sci.yaml b/dts/bindings/firmware/ti,k2g-sci.yaml deleted file mode 100644 index ebdbcb97dd5b..000000000000 --- a/dts/bindings/firmware/ti,k2g-sci.yaml +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright 2025 Texas Instruments Incorporated. -# SPDX-License-Identifier: Apache-2.0 - -description: TISCI Client Driver - -compatible: "ti,k2g-sci" - -include: [base.yaml] - -properties: - reg: - required: true - - ti,host-id: - type: int - required: true - description: Host ID for processor - - mboxes: - description: phandle to the MBOX controller (TX and RX are required) - required: true - - mbox-names: - description: MBOX channel names (must be called "tx" and "rx") - required: true diff --git a/include/zephyr/drivers/firmware/tisci/tisci.h b/include/zephyr/drivers/firmware/tisci/tisci.h deleted file mode 100644 index 8097d6d44059..000000000000 --- a/include/zephyr/drivers/firmware/tisci/tisci.h +++ /dev/null @@ -1,1037 +0,0 @@ -/* - * Copyright (c) 2025, Texas Instruments - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/** - * @file - * @brief Public APIs for the TISCI driver - * - */ - -#ifndef INCLUDE_ZEPHYR_DRIVERS_TISCI_H_ -#define INCLUDE_ZEPHYR_DRIVERS_TISCI_H_ - -#include - -#define MAILBOX_MBOX_SIZE 60 - -/** - * @struct tisci_version_info - * @brief version information structure - * @param abi_major: Major ABI version. Change here implies risk of backward - * compatibility break. - * @param abi_minor: Minor ABI version. Change here implies new feature addition, - * or compatible change in ABI. - * @param firmware_revision: Firmware revision (not usually used). - * @param firmware_description: Firmware description (not usually used). - */ -struct tisci_version_info { - uint8_t abi_major; - uint8_t abi_minor; - uint16_t firmware_revision; - char firmware_description[32]; -}; - -/** - * @struct tisci_msg_fwl_region_cfg - * @brief Request and Response for firewalls settings - * - * @param fwl_id: Firewall ID in question - * @param region: Region or channel number to set config info - * This field is unused in case of a simple firewall and must be initialized - * to zero. In case of a region based firewall, this field indicates the - * region in question. (index starting from 0) In case of a channel based - * firewall, this field indicates the channel in question (index starting - * from 0) - * @param n_permission_regs: Number of permission registers to set - * @param control: Contents of the firewall CONTROL register to set - * @param permissions: Contents of the firewall PERMISSION register to set - * @param start_address: Contents of the firewall START_ADDRESS register to set - * @param end_address: Contents of the firewall END_ADDRESS register to set - */ -struct tisci_msg_fwl_region { - uint16_t fwl_id; - uint16_t region; - uint32_t n_permission_regs; - uint32_t control; - uint32_t permissions[3]; - uint64_t start_address; - uint64_t end_address; -}; - -/** - * @brief Request and Response for firewall owner change - * @struct tisci_msg_fwl_owner - * @param fwl_id: Firewall ID in question - * @param region: Region or channel number to set config info - * This field is unused in case of a simple firewall and must be initialized - * to zero. In case of a region based firewall, this field indicates the - * region in question. (index starting from 0) In case of a channel based - * firewall, this field indicates the channel in question (index starting - * from 0) - * @param n_permission_regs: Number of permission registers <= 3 - * @param control: Control register value for this region - * @param owner_index: New owner index to change to. Owner indexes are setup in DMSC firmware boot - *configuration data - * @param owner_privid: New owner priv-id, used to lookup owner_index is not known, must be set to - *zero otherwise - * @param owner_permission_bits: New owner permission bits - */ -struct tisci_msg_fwl_owner { - uint16_t fwl_id; - uint16_t region; - uint8_t owner_index; - uint8_t owner_privid; - uint16_t owner_permission_bits; -}; - -/** - * Configures a Navigator Subsystem UDMAP transmit channel - * - * Configures a Navigator Subsystem UDMAP transmit channel registers. - * See tisci_msg_rm_udmap_tx_ch_cfg_req - */ -struct tisci_msg_rm_udmap_tx_ch_cfg { - uint32_t valid_params; -#define TISCI_MSG_VALUE_RM_UDMAP_CH_TX_FILT_EINFO_VALID BIT(9) -#define TISCI_MSG_VALUE_RM_UDMAP_CH_TX_FILT_PSWORDS_VALID BIT(10) -#define TISCI_MSG_VALUE_RM_UDMAP_CH_TX_SUPR_TDPKT_VALID BIT(11) -#define TISCI_MSG_VALUE_RM_UDMAP_CH_TX_CREDIT_COUNT_VALID BIT(12) -#define TISCI_MSG_VALUE_RM_UDMAP_CH_TX_FDEPTH_VALID BIT(13) -#define TISCI_MSG_VALUE_RM_UDMAP_CH_TX_TDTYPE_VALID BIT(15) -#define TISCI_MSG_VALUE_RM_UDMAP_CH_EXTENDED_CH_TYPE_VALID BIT(16) - uint16_t nav_id; - uint16_t index; - uint8_t tx_pause_on_err; - uint8_t tx_filt_einfo; - uint8_t tx_filt_pswords; - uint8_t tx_atype; - uint8_t tx_chan_type; - uint8_t tx_supr_tdpkt; - uint16_t tx_fetch_size; - uint8_t tx_credit_count; - uint16_t txcq_qnum; - uint8_t tx_priority; - uint8_t tx_qos; - uint8_t tx_orderid; - uint16_t fdepth; - uint8_t tx_sched_priority; - uint8_t tx_burst_size; - uint8_t tx_tdtype; - uint8_t extended_ch_type; -}; - -/** - * Configures a Navigator Subsystem UDMAP receive channel - * - * Configures a Navigator Subsystem UDMAP receive channel registers. - * See tisci_msg_rm_udmap_rx_ch_cfg_req - */ -struct tisci_msg_rm_udmap_rx_ch_cfg { - uint32_t valid_params; -#define TISCI_MSG_VALUE_RM_UDMAP_CH_RX_FLOWID_START_VALID BIT(9) -#define TISCI_MSG_VALUE_RM_UDMAP_CH_RX_FLOWID_CNT_VALID BIT(10) -#define TISCI_MSG_VALUE_RM_UDMAP_CH_RX_IGNORE_SHORT_VALID BIT(11) -#define TISCI_MSG_VALUE_RM_UDMAP_CH_RX_IGNORE_LONG_VALID BIT(12) - uint16_t nav_id; - uint16_t index; - uint16_t rx_fetch_size; - uint16_t rxcq_qnum; - uint8_t rx_priority; - uint8_t rx_qos; - uint8_t rx_orderid; - uint8_t rx_sched_priority; - uint16_t flowid_start; - uint16_t flowid_cnt; - uint8_t rx_pause_on_err; - uint8_t rx_atype; - uint8_t rx_chan_type; - uint8_t rx_ignore_short; - uint8_t rx_ignore_long; - uint8_t rx_burst_size; -}; - -#define TISCI_MSG_VALUE_RM_DST_ID_VALID (1u << 0u) -#define TISCI_MSG_VALUE_RM_DST_HOST_IRQ_VALID (1u << 1u) -#define TISCI_MSG_VALUE_RM_IA_ID_VALID (1u << 2u) -#define TISCI_MSG_VALUE_RM_VINT_VALID (1u << 3u) -#define TISCI_MSG_VALUE_RM_GLOBAL_EVENT_VALID (1u << 4u) -#define TISCI_MSG_VALUE_RM_VINT_STATUS_BIT_INDEX_VALID (1u << 5u) - -/** - * @brief Request to set up an interrupt route. - * - * Configures peripherals within the interrupt subsystem according to the - * valid configuration provided. - * - * @param valid_params Bitfield defining validity of interrupt route set parameters. - * Each bit corresponds to a field's validity. - * @param src_id ID of interrupt source peripheral. - * @param src_index Interrupt source index within source peripheral. - * @param dst_id SoC IR device ID (valid if TISCI_MSG_VALUE_RM_DST_ID_VALID is set). - * @param dst_host_irq SoC IR output index (valid if TISCI_MSG_VALUE_RM_DST_HOST_IRQ_VALID - * is set). - * @param ia_id Device ID of interrupt aggregator (valid if - * TISCI_MSG_VALUE_RM_IA_ID_VALID is set). - * @param vint Virtual interrupt number (valid if TISCI_MSG_VALUE_RM_VINT_VALID is - * set). - * @param global_event Global event mapped to interrupt aggregator (valid if - * TISCI_MSG_VALUE_RM_GLOBAL_EVENT_VALID is set). - * @param vint_status_bit_index Virtual interrupt status bit (valid if - * TISCI_MSG_VALUE_RM_VINT_STATUS_BIT_INDEX_VALID is set). - * @param secondary_host Secondary host value (valid if - * TISCI_MSG_VALUE_RM_SECONDARY_HOST_VALID is set). - */ -struct tisci_irq_set_req { - uint32_t valid_params; - uint16_t src_id; - uint16_t src_index; - uint16_t dst_id; - uint16_t dst_host_irq; - uint16_t ia_id; - uint16_t vint; - uint16_t global_event; - uint8_t vint_status_bit_index; - uint8_t secondary_host; -}; - -/** - * @brief Request to release interrupt peripheral resources. - * - * Releases interrupt peripheral resources according to the valid configuration provided. - * - * @param valid_params Bitfield defining validity of interrupt route release parameters. - * Each bit corresponds to a field's validity. - * @param src_id ID of interrupt source peripheral. - * @param src_index Interrupt source index within source peripheral. - * @param dst_id SoC IR device ID (valid if TISCI_MSG_VALUE_RM_DST_ID_VALID is set). - * @param dst_host_irq SoC IR output index (valid if TISCI_MSG_VALUE_RM_DST_HOST_IRQ_VALID - * is set). - * @param ia_id Device ID of interrupt aggregator (valid if - * TISCI_MSG_VALUE_RM_IA_ID_VALID is set). - * @param vint Virtual interrupt number (valid if TISCI_MSG_VALUE_RM_VINT_VALID is - * set). - * @param global_event Global event mapped to interrupt aggregator (valid if - * TISCI_MSG_VALUE_RM_GLOBAL_EVENT_VALID is set). - * @param vint_status_bit_index Virtual interrupt status bit (valid if - * TISCI_MSG_VALUE_RM_VINT_STATUS_BIT_INDEX_VALID is set). - * @param secondary_host Secondary host value (valid if - * TISCI_MSG_VALUE_RM_SECONDARY_HOST_VALID is set). - */ - -struct tisci_irq_release_req { - uint32_t valid_params; - uint16_t src_id; - uint16_t src_index; - uint16_t dst_id; - uint16_t dst_host_irq; - uint16_t ia_id; - uint16_t vint; - uint16_t global_event; - uint8_t vint_status_bit_index; - uint8_t secondary_host; -}; - -/* Version/Revision Functions */ - -/** - * @brief Get the revision information of the TI SCI firmware - * - * Queries the TI SCI firmware for its version and revision information. - * The retrieved information is stored in the provided @p ver structure. - * - * @param dev Pointer to the TI SCI device - * @param ver Pointer to a structure where the firmware version information will be stored - * - * @return 0 if successful, or a negative error code on failure - */ -int tisci_cmd_get_revision(const struct device *dev, struct tisci_version_info *ver); - -/* Clock Management Functions */ - -/** - * @brief Get the state of a clock - * - * @param dev Pointer to the TI SCI device - * @param dev_id Device identifier for this request - * @param clk_id Clock identifier for the device for this request - * @param programmed_state Pointer to store the requested state of the clock - * @param current_state Pointer to store the current state of the clock - * - * @return 0 if successful, or an error code - */ -int tisci_cmd_get_clock_state(const struct device *dev, uint32_t dev_id, uint8_t clk_id, - uint8_t *programmed_state, uint8_t *current_state); - -/** - * @brief Set the state of a clock - * - * @param dev Pointer to the TI SCI device - * @param dev_id Device identifier for this request - * @param clk_id Clock identifier for the device for this request - * @param flags Header flags as needed - * @param state State to request for the clock - * - * @return 0 if successful, or an error code - */ -int tisci_set_clock_state(const struct device *dev, uint32_t dev_id, uint8_t clk_id, uint32_t flags, - uint8_t state); - -/** - * @brief Check if the clock is ON - * - * @param dev Pointer to the TI SCI device - * @param dev_id Device identifier for this request - * @param clk_id Clock identifier for the device for this request - * @param req_state Pointer to store whether the clock is managed and enabled - * @param curr_state Pointer to store whether the clock is ready for operation - * - * @return 0 if successful, or an error code - */ -int tisci_cmd_clk_is_on(const struct device *dev, uint32_t dev_id, uint8_t clk_id, bool *req_state, - bool *curr_state); - -/** - * @brief Check if the clock is OFF - * - * @param dev Pointer to the TI SCI device - * @param dev_id Device identifier for this request - * @param clk_id Clock identifier for the device for this request - * @param req_state Pointer to store whether the clock is managed and disabled - * @param curr_state Pointer to store whether the clock is NOT ready for operation - * - * @return 0 if successful, or an error code - */ -int tisci_cmd_clk_is_off(const struct device *dev, uint32_t dev_id, uint8_t clk_id, bool *req_state, - bool *curr_state); - -/** - * @brief Check if the clock is being auto-managed - * - * @param dev Pointer to the TI SCI device - * @param dev_id Device identifier for this request - * @param clk_id Clock identifier for the device for this request - * @param req_state Pointer to store whether the clock is auto-managed - * - * @return 0 if successful, or an error code - */ -int tisci_cmd_clk_is_auto(const struct device *dev, uint32_t dev_id, uint8_t clk_id, - bool *req_state); - -/** - * @brief Get the current frequency of a clock - * - * @param dev Pointer to the TI SCI device - * @param dev_id Device identifier for this request - * @param clk_id Clock identifier for the device for this request - * @param freq Pointer to store the current frequency in Hz - * - * @return 0 if successful, or an error code - */ -int tisci_cmd_clk_get_freq(const struct device *dev, uint32_t dev_id, uint8_t clk_id, - uint64_t *freq); - -/** - * @brief Set a frequency for a clock - * - * @param dev Pointer to the TI SCI device - * @param dev_id Device identifier for this request - * @param clk_id Clock identifier for the device for this request - * @param min_freq Minimum allowable frequency in Hz - * @param target_freq Target clock frequency in Hz - * @param max_freq Maximum allowable frequency in Hz - * - * @return 0 if successful, or an error code - */ -int tisci_cmd_clk_set_freq(const struct device *dev, uint32_t dev_id, uint8_t clk_id, - uint64_t min_freq, uint64_t target_freq, uint64_t max_freq); - -/** - * @brief Get a matching frequency for a clock - * - * Finds a frequency that matches the requested range for a clock. - * - * @param dev Pointer to the TI SCI device - * @param dev_id Device identifier for this request - * @param clk_id Clock identifier for the device for this request - * @param min_freq Minimum allowable frequency in Hz - * @param target_freq Target clock frequency in Hz - * @param max_freq Maximum allowable frequency in Hz - * @param match_freq Pointer to store the matched frequency in Hz - * - * @return 0 if successful, or an error code - */ -int tisci_cmd_clk_get_match_freq(const struct device *dev, uint32_t dev_id, uint8_t clk_id, - uint64_t min_freq, uint64_t target_freq, uint64_t max_freq, - uint64_t *match_freq); - -/** - * @brief Set the parent clock for a clock - * - * @param dev Pointer to the TI SCI device - * @param dev_id Device identifier for this request - * @param clk_id Clock identifier for the device for this request - * @param parent_id Identifier of the parent clock to set - * - * @return 0 if successful, or an error code - */ -int tisci_cmd_clk_set_parent(const struct device *dev, uint32_t dev_id, uint8_t clk_id, - uint8_t parent_id); - -/** - * @brief Get the parent clock for a clock - * - * @param dev Pointer to the TI SCI device - * @param dev_id Device identifier for this request - * @param clk_id Clock identifier for the device for this request - * @param parent_id Pointer to store the identifier of the parent clock - * - * @return 0 if successful, or an error code - */ -int tisci_cmd_clk_get_parent(const struct device *dev, uint32_t dev_id, uint8_t clk_id, - uint8_t *parent_id); - -/** - * @brief Get the number of parent clocks for a clock - * - * @param dev Pointer to the TI SCI device - * @param dev_id Device identifier for this request - * @param clk_id Clock identifier for the device for this request - * @param num_parents Pointer to store the number of parent clocks - * - * @return 0 if successful, or an error code - */ -int tisci_cmd_clk_get_num_parents(const struct device *dev, uint32_t dev_id, uint8_t clk_id, - uint8_t *num_parents); - -/** - * @brief Get control of a clock from TI SCI - * - * @param dev Pointer to the TI SCI device - * @param dev_id Device identifier for this request - * @param clk_id Clock identifier for the device for this request - * @param needs_ssc 'true' if Spread Spectrum clock is desired, else 'false' - * @param can_change_freq 'true' if frequency change is desired, else 'false' - * @param enable_input_term 'true' if input termination is desired, else 'false' - * - * @return 0 if successful, or an error code - */ -int tisci_cmd_get_clock(const struct device *dev, uint32_t dev_id, uint8_t clk_id, bool needs_ssc, - bool can_change_freq, bool enable_input_term); - -/** - * @brief Idle a clock that is under control of TI SCI - * - * @param dev Pointer to the TI SCI device - * @param dev_id Device identifier for this request - * @param clk_id Clock identifier for the device for this request - * - * @return 0 if successful, or an error code - */ -int tisci_cmd_idle_clock(const struct device *dev, uint32_t dev_id, uint8_t clk_id); - -/** - * @brief Release a clock from control back to TI SCI - * - * @param dev Pointer to the TI SCI device - * @param dev_id Device identifier for this request - * @param clk_id Clock identifier for the device for this request - * - * @return 0 if successful, or an error code - */ -int tisci_cmd_put_clock(const struct device *dev, uint32_t dev_id, uint8_t clk_id); - -/* Device Management Functions */ - -/** - * @brief Set the state of a device - * - * @param dev Pointer to the TI SCI device - * @param dev_id Device identifier for this request - * @param flags Flags to set for the device - * @param state State to move the device to: - * - 0: Device is off - * - 1: Device is on - * - 2: Device is in retention - * - 3: Device is in reset - * - * @return 0 if successful, or an error code - */ -int tisci_set_device_state(const struct device *dev, uint32_t dev_id, uint32_t flags, - uint8_t state); - -/** - * @brief Set the state of a device without waiting for a response - * - * @param dev Pointer to the TI SCI device - * @param dev_id Device identifier for this request - * @param flags Flags to set for the device - * @param state State to move the device to: - * - 0: Device is off - * - 1: Device is on - * - 2: Device is in retention - * - 3: Device is in reset - * - * @return 0 if successful, or an error code - */ -int tisci_set_device_state_no_wait(const struct device *dev, uint32_t dev_id, uint32_t flags, - uint8_t state); - -/** - * @brief Get the state of a device - * - * @param dev Pointer to the TI SCI device - * @param dev_id Device identifier for this request - * @param clcnt Pointer to store the Context Loss Count - * @param resets Pointer to store the reset count - * @param p_state Pointer to store the programmed state - * @param c_state Pointer to store the current state - * - * @return 0 if successful, or an error code - */ -int tisci_get_device_state(const struct device *dev, uint32_t dev_id, uint32_t *clcnt, - uint32_t *resets, uint8_t *p_state, uint8_t *c_state); - -/** - * @brief Request exclusive access to a device managed by TISCI - * - * @param dev Pointer to the TI SCI device - * @param dev_id Device identifier for this request - * - * @return 0 if successful, or an error code - */ -int tisci_cmd_get_device(const struct device *dev, uint32_t dev_id); -int tisci_cmd_get_device_exclusive(const struct device *dev, uint32_t dev_id); - -/** - * @brief Command to idle a device managed by TISCI - * - * @param dev Pointer to the TI SCI device - * @param dev_id Device identifier for this request - * - * @return 0 if successful, or an error code - */ -int tisci_cmd_idle_device(const struct device *dev, uint32_t dev_id); -int tisci_cmd_idle_device_exclusive(const struct device *dev, uint32_t dev_id); - -/** - * @brief Command to release a device managed by TISCI - * - * @param dev Pointer to the TI SCI device - * @param dev_id Device identifier for this request - * - * @return 0 if successful, or an error code - */ -int tisci_cmd_put_device(const struct device *dev, uint32_t dev_id); - -/** - * @brief Check if a device ID is valid - * - * @param dev Pointer to the TI SCI device - * @param dev_id Device identifier for this request - * - * @return 0 if the device ID is valid, or an error code - */ -int tisci_cmd_dev_is_valid(const struct device *dev, uint32_t dev_id); - -/** - * @brief Get the context loss counter for a device - * - * @param dev Pointer to the TI SCI device - * @param dev_id Device identifier for this request - * @param count Pointer to store the context loss counter - * - * @return 0 if successful, or an error code - */ -int tisci_cmd_dev_get_clcnt(const struct device *dev, uint32_t dev_id, uint32_t *count); - -/** - * @brief Check if the device is requested to be idle - * - * @param dev Pointer to the TI SCI device - * @param dev_id Device identifier for this request - * @param r_state Pointer to store the result (true if requested to be idle) - * - * @return 0 if successful, or an error code - */ -int tisci_cmd_dev_is_idle(const struct device *dev, uint32_t dev_id, bool *r_state); - -/** - * @brief Check if the device is requested to be stopped - * - * @param dev Pointer to the TI SCI device - * @param dev_id Device identifier for this request - * @param r_state Pointer to store the result (true if requested to be stopped) - * @param curr_state Pointer to store the result (true if currently stopped) - * - * @return 0 if successful, or an error code - */ -int tisci_cmd_dev_is_stop(const struct device *dev, uint32_t dev_id, bool *r_state, - bool *curr_state); - -/** - * @brief Check if the device is requested to be ON - * - * @param dev Pointer to the TI SCI device - * @param dev_id Device identifier for this request - * @param r_state Pointer to store the result (true if requested to be ON) - * @param curr_state Pointer to store the result (true if currently ON and active) - * - * @return 0 if successful, or an error code - */ -int tisci_cmd_dev_is_on(const struct device *dev, uint32_t dev_id, bool *r_state, bool *curr_state); - -/** - * @brief Check if the device is currently transitioning - * - * @param dev Pointer to the TI SCI device - * @param dev_id Device identifier for this request - * @param curr_state Pointer to store the result (true if currently transitioning) - * - * @return 0 if successful, or an error code - */ -int tisci_cmd_dev_is_trans(const struct device *dev, uint32_t dev_id, bool *curr_state); - -/** - * @brief Set resets for a device managed by TISCI - * - * @param dev Pointer to the TI SCI device - * @param dev_id Device identifier for this request - * @param reset_state Device-specific reset bit field - * - * @return 0 if successful, or an error code - */ -int tisci_cmd_set_device_resets(const struct device *dev, uint32_t dev_id, uint32_t reset_state); - -/** - * @brief Get reset state for a device managed by TISCI - * - * @param dev Pointer to the TI SCI device - * @param dev_id Device identifier for this request - * @param reset_state Pointer to store the reset state - * - * @return 0 if successful, or an error code - */ -int tisci_cmd_get_device_resets(const struct device *dev, uint32_t dev_id, uint32_t *reset_state); - -/* Resource Management Functions */ - -/** - * @brief Get a range of resources assigned to a host - * - * @param dev Pointer to the TI SCI device - * @param dev_id TISCI device ID - * @param subtype Resource assignment subtype being requested - * @param s_host Host processor ID to which the resources are allocated - * @param range_start Pointer to store the start index of the resource range - * @param range_num Pointer to store the number of resources in the range - * - * @return 0 if successful, or an error code - */ -int tisci_get_resource_range(const struct device *dev, uint32_t dev_id, uint8_t subtype, - uint8_t s_host, uint16_t *range_start, uint16_t *range_num); - -/** - * @brief Get a range of resources assigned to the host - * - * @param dev Pointer to the TI SCI device - * @param dev_id TISCI device ID - * @param subtype Resource assignment subtype being requested - * @param range_start Pointer to store the start index of the resource range - * @param range_num Pointer to store the number of resources in the range - * - * @return 0 if successful, or an error code - */ -int tisci_cmd_get_resource_range(const struct device *dev, uint32_t dev_id, uint8_t subtype, - uint16_t *range_start, uint16_t *range_num); - -/** - * @brief Get a range of resources assigned to a specified host - * - * @param dev Pointer to the TI SCI device - * @param dev_id TISCI device ID - * @param subtype Resource assignment subtype being requested - * @param s_host Host processor ID to which the resources are allocated - * @param range_start Pointer to store the start index of the resource range - * @param range_num Pointer to store the number of resources in the range - * - * @return 0 if successful, or an error code - */ -int tisci_cmd_get_resource_range_from_shost(const struct device *dev, uint32_t dev_id, - uint8_t subtype, uint8_t s_host, uint16_t *range_start, - uint16_t *range_num); - -/* Processor Management Functions */ - -/** - * @brief Command to request a physical processor control - * - * @param dev Pointer to the TI SCI device - * @param proc_id Processor ID this request is for - * - * @return 0 if successful, or an error code - */ -int tisci_cmd_proc_request(const struct device *dev, uint8_t proc_id); - -/** - * @brief Command to release a physical processor control - * - * @param dev Pointer to the TI SCI device - * @param proc_id Processor ID this request is for - * - * @return 0 if successful, or an error code - */ -int tisci_cmd_proc_release(const struct device *dev, uint8_t proc_id); - -/** - * @brief Command to handover a physical processor control to a host - * in the processor's access control list - * - * @param dev Pointer to the TI SCI device - * @param proc_id Processor ID this request is for - * @param host_id Host ID to get the control of the processor - * - * @return 0 if successful, or an error code - */ -int tisci_cmd_proc_handover(const struct device *dev, uint8_t proc_id, uint8_t host_id); - -/** - * @brief Command to set the processor boot configuration flags - * - * @param dev Pointer to the TI SCI device - * @param proc_id Processor ID this request is for - * @param bootvector Boot vector address - * @param config_flags_set Configuration flags to be set - * @param config_flags_clear Configuration flags to be cleared - * - * @return 0 if successful, or an error code - */ -int tisci_cmd_set_proc_boot_cfg(const struct device *dev, uint8_t proc_id, uint64_t bootvector, - uint32_t config_flags_set, uint32_t config_flags_clear); - -/** - * @brief Command to set the processor boot control flags - * - * @param dev Pointer to the TI SCI device - * @param proc_id Processor ID this request is for - * @param control_flags_set Control flags to be set - * @param control_flags_clear Control flags to be cleared - * - * @return 0 if successful, or an error code - */ -int tisci_cmd_set_proc_boot_ctrl(const struct device *dev, uint8_t proc_id, - uint32_t control_flags_set, uint32_t control_flags_clear); - -/** - * @brief Command to authenticate and load the image, then set the processor configuration flags - * - * @param dev Pointer to the TI SCI device - * @param image_addr Pointer to the memory address of the payload image and certificate - * @param image_size Pointer to the size of the image after authentication - * - * @return 0 if successful, or an error code - */ -int tisci_cmd_proc_auth_boot_image(const struct device *dev, uint64_t *image_addr, - uint32_t *image_size); - -/** - * @brief Command to get the processor boot status - * - * @param dev Pointer to the TI SCI device - * @param proc_id Processor ID this request is for - * @param bv Pointer to store the boot vector - * @param cfg_flags Pointer to store the configuration flags - * @param ctrl_flags Pointer to store the control flags - * @param sts_flags Pointer to store the status flags - * - * @return 0 if successful, or an error code - */ -int tisci_cmd_get_proc_boot_status(const struct device *dev, uint8_t proc_id, uint64_t *bv, - uint32_t *cfg_flags, uint32_t *ctrl_flags, uint32_t *sts_flags); - -/** - * @brief Helper function to wait for a processor boot status without requesting or waiting for a - * response - * - * @param dev Pointer to the TI SCI device - * @param proc_id Processor ID this request is for - * @param num_wait_iterations Total number of iterations to check before timeout - * @param num_match_iterations Number of consecutive matches required to confirm status - * @param delay_per_iteration_us Delay in microseconds between each status check - * @param delay_before_iterations_us Delay in microseconds before the first status check - * @param status_flags_1_set_all_wait Flags that must all be set to 1 - * @param status_flags_1_set_any_wait Flags where at least one must be set to 1 - * @param status_flags_1_clr_all_wait Flags that must all be cleared to 0 - * @param status_flags_1_clr_any_wait Flags where at least one must be cleared to 0 - * - * @return 0 if successful, or an error code - */ -int tisci_proc_wait_boot_status_no_wait(const struct device *dev, uint8_t proc_id, - uint8_t num_wait_iterations, uint8_t num_match_iterations, - uint8_t delay_per_iteration_us, - uint8_t delay_before_iterations_us, - uint32_t status_flags_1_set_all_wait, - uint32_t status_flags_1_set_any_wait, - uint32_t status_flags_1_clr_all_wait, - uint32_t status_flags_1_clr_any_wait); - -/** - * @brief Command to shutdown a core without requesting or waiting for a response - * - * @param dev Pointer to the TI SCI device - * @param proc_id Processor ID this request is for - * - * @return 0 if successful, or an error code - */ -int tisci_cmd_proc_shutdown_no_wait(const struct device *dev, uint8_t proc_id); - -/* Board Configuration Functions */ - -/** - * @brief Set board configuration using a specified message type - * - * Sends a board configuration message to the TI SCI firmware with configuration - * data from a specified memory location. - * - * @param dev Pointer to the TI SCI device - * @param msg_type TISCI message type for board configuration - * @param addr Physical address of board configuration data - * @param size Size of board configuration data in bytes - * - * @return 0 if successful, or an error code - */ -int cmd_set_board_config_using_msg(const struct device *dev, uint16_t msg_type, uint64_t addr, - uint32_t size); - -/* Ring Configuration Function */ - -/** - * @brief Configure a RA ring - * - * @param dev Pointer to the TI SCI device - * @param valid_params Bitfield defining validity of ring configuration parameters - * @param nav_id Device ID of Navigator Subsystem from which the ring is allocated - * @param index Ring index - * @param addr_lo The ring base address low 32 bits - * @param addr_hi The ring base address high 32 bits - * @param count Number of ring elements - * @param mode The mode of the ring - * @param size The ring element size - * @param order_id Specifies the ring's bus order ID - * - * @return 0 if successful, or an error code - */ -int tisci_cmd_ring_config(const struct device *dev, uint32_t valid_params, uint16_t nav_id, - uint16_t index, uint32_t addr_lo, uint32_t addr_hi, uint32_t count, - uint8_t mode, uint8_t size, uint8_t order_id); - -/* System Control Functions */ - -/** - * @brief Request a system reset - * - * Commands the TI SCI firmware to perform a system reset. - * - * @param dev Pointer to the TI SCI device - * - * @return 0 if successful, or an error code - */ -int tisci_cmd_sys_reset(const struct device *dev); - -/* Memory Management Functions */ - -/** - * @brief Query the available MSMC memory range - * - * Queries the TI SCI firmware for the currently available MSMC (Multi-Standard - * Shared Memory Controller) memory range. - * - * @param dev Pointer to the TI SCI device - * @param msmc_start Pointer to store the MSMC start address - * @param msmc_end Pointer to store the MSMC end address - * - * @return 0 if successful, or an error code - */ -int tisci_cmd_query_msmc(const struct device *dev, uint64_t *msmc_start, uint64_t *msmc_end); - -/* Firewall Management Functions */ - -/** - * @brief Configure a firewall region - * - * Sets up a firewall region with the specified configuration parameters - * including permissions, addresses, and control settings. - * - * @param dev Pointer to the TI SCI device - * @param region Pointer to the firewall region configuration parameters - * - * @return 0 if successful, or an error code - */ -int tisci_cmd_set_fwl_region(const struct device *dev, const struct tisci_msg_fwl_region *region); - -/* INCLUDE_ZEPHYR_DRIVERS_TISCI_H_ */ - -/* Firewall Management Functions */ -/* ... previous firewall functions ... */ - -/** - * @brief Get firewall region configuration - * - * Retrieves the configuration of a firewall region including permissions, - * addresses, and control settings. - * - * @param dev Pointer to the TI SCI device - * @param region Pointer to store the firewall region configuration. - * The fwl_id, region, and n_permission_regs fields must be - * set before calling this function. - * - * @return 0 if successful, or an error code - */ -int tisci_cmd_get_fwl_region(const struct device *dev, struct tisci_msg_fwl_region *region); - -/* INCLUDE_ZEPHYR_DRIVERS_TISCI_H_ */ - -/* Firewall Management Functions */ -/* ... previous firewall functions ... */ - -/** - * @brief Get firewall region configuration - * - * Retrieves the configuration of a firewall region including permissions, - * addresses, and control settings. - * - * @param dev Pointer to the TI SCI device - * @param region Pointer to store the firewall region configuration. - * The fwl_id, region, and n_permission_regs fields must be - * set before calling this function. - * - * @return 0 if successful, or an error code - */ -int tisci_cmd_get_fwl_region(const struct device *dev, struct tisci_msg_fwl_region *region); - -/* Firewall Management Functions */ -/* ... previous firewall functions ... */ - -/** - * @brief Get firewall region configuration - * - * Retrieves the configuration of a firewall region including permissions, - * addresses, and control settings. - * - * @param dev Pointer to the TI SCI device - * @param region Pointer to store the firewall region configuration. - * The fwl_id, region, and n_permission_regs fields must be - * set before calling this function. - * - * @return 0 if successful, or an error code - */ -int tisci_cmd_get_fwl_region(const struct device *dev, struct tisci_msg_fwl_region *region); - -/* Firewall Management Functions */ -/* ... previous firewall functions ... */ - -/** - * @brief Change firewall region owner - * - * Changes the ownership of a firewall region and retrieves updated - * ownership information. - * - * @param dev Pointer to the TI SCI device - * @param owner Pointer to firewall owner configuration. - * On input: contains fwl_id, region, and owner_index - * On output: contains updated ownership information - * - * @return 0 if successful, or an error code - */ -int tisci_cmd_change_fwl_owner(const struct device *dev, struct tisci_msg_fwl_owner *owner); - -/* UDMAP Management Functions */ - -/** - * @brief Configure a UDMAP transmit channel - * - * Configures the non-real-time registers of a Navigator Subsystem UDMAP - * transmit channel. - * - * @param dev Pointer to the TI SCI device - * @param params Pointer to the transmit channel configuration parameters - * - * @return 0 if successful, or an error code - */ -int tisci_cmd_rm_udmap_tx_ch_cfg(const struct device *dev, - const struct tisci_msg_rm_udmap_tx_ch_cfg *params); - -/** - * @brief Configure a UDMAP receive channel - * - * Configures the non-real-time registers of a Navigator Subsystem UDMAP - * receive channel. - * - * @param dev Pointer to the TI SCI device - * @param params Pointer to the receive channel configuration parameters - * - * @return 0 if successful, or an error code - */ -int tisci_cmd_rm_udmap_rx_ch_cfg(const struct device *dev, - const struct tisci_msg_rm_udmap_rx_ch_cfg *params); - -/* PSI-L Management Functions */ - -/** - * @brief Pair PSI-L source thread to destination thread - * - * Pairs a PSI-L source thread to a destination thread in the - * Navigator Subsystem. - * - * @param dev Pointer to the TI SCI device - * @param nav_id Navigator Subsystem device ID - * @param src_thread Source thread ID - * @param dst_thread Destination thread ID - * - * @return 0 if successful, or an error code - */ -int tisci_cmd_rm_psil_pair(const struct device *dev, uint32_t nav_id, uint32_t src_thread, - uint32_t dst_thread); - -/** - * @brief Unpair PSI-L source thread from destination thread - * - * Unpairs a PSI-L source thread from a destination thread in the - * Navigator Subsystem. - * - * @param dev Pointer to the TI SCI device - * @param nav_id Navigator Subsystem device ID - * @param src_thread Source thread ID - * @param dst_thread Destination thread ID - * - * @return 0 if successful, or an error code - */ -int tisci_cmd_rm_psil_unpair(const struct device *dev, uint32_t nav_id, uint32_t src_thread, - uint32_t dst_thread); - -/** - * @brief Set a Navigator Subsystem IRQ - * - * Sets up an interrupt route in the Navigator Subsystem using the provided request structure. - * - * @param dev Pointer to the TI SCI device - * @param req Pointer to the IRQ set request structure - * - * @return 0 if successful, or an error code - */ -int tisci_cmd_rm_irq_set(const struct device *dev, struct tisci_irq_set_req *req); - -/** - * @brief Release a Navigator Subsystem IRQ - * - * Releases an interrupt route in the Navigator Subsystem using the provided request structure. - * - * @param dev Pointer to the TI SCI device - * @param req Pointer to the IRQ release request structure - * - * @return 0 if successful, or an error code - */ -int tisci_cmd_rm_irq_release(const struct device *dev, struct tisci_irq_release_req *req); -#endif From 371ce85c4b886f1d2179037858b4994796039f96 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:46 +0300 Subject: [PATCH 1165/2141] Revert "[nrf fromtree] drivers: firmware: nrf_ironside: add nrf9280 to CPUCONF service" This reverts commit ef6adf71bfd81180aa64d785732d9abc26012c7b. Signed-off-by: Jukka Rissanen --- drivers/firmware/nrf_ironside/Kconfig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/firmware/nrf_ironside/Kconfig b/drivers/firmware/nrf_ironside/Kconfig index 4c313618638e..13866aba52d4 100644 --- a/drivers/firmware/nrf_ironside/Kconfig +++ b/drivers/firmware/nrf_ironside/Kconfig @@ -3,7 +3,7 @@ config NRF_IRONSIDE bool - depends on SOC_NRF54H20_IRON || SOC_NRF9280_IRON + depends on SOC_NRF54H20_IRON help This is selected by drivers interacting with Nordic IRONside firmware. @@ -28,11 +28,11 @@ config NRF_IRONSIDE_CALL_INIT_PRIORITY endif # NRF_IRONSIDE_CALL menu "Nordic IRONside services" - depends on SOC_NRF54H20_IRON || SOC_NRF9280_IRON + depends on SOC_NRF54H20_IRON config NRF_IRONSIDE_CPUCONF_SERVICE bool "IRONside CPUCONF service" - depends on SOC_NRF54H20_CPUAPP || SOC_NRF9280_CPUAPP + depends on SOC_NRF54H20_CPUAPP select NRF_IRONSIDE_CALL help Service used to boot local domain cores. From 30937013b8a7052606b8845649f08f161f12375a Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:46 +0300 Subject: [PATCH 1166/2141] Revert "[nrf fromtree] drivers: nrf_ironside dvfs service" This reverts commit f3fd75707ce42d24b2349dcd82b92040a2503c4f. Signed-off-by: Jukka Rissanen --- drivers/firmware/nrf_ironside/CMakeLists.txt | 1 - drivers/firmware/nrf_ironside/Kconfig | 17 -- drivers/firmware/nrf_ironside/dvfs.c | 184 ------------------ .../drivers/firmware/nrf_ironside/dvfs.h | 92 --------- modules/hal_nordic/nrfs/CMakeLists.txt | 4 +- 5 files changed, 2 insertions(+), 296 deletions(-) delete mode 100644 drivers/firmware/nrf_ironside/dvfs.c delete mode 100644 include/zephyr/drivers/firmware/nrf_ironside/dvfs.h diff --git a/drivers/firmware/nrf_ironside/CMakeLists.txt b/drivers/firmware/nrf_ironside/CMakeLists.txt index ddc46bd69b1e..bc2adf842edc 100644 --- a/drivers/firmware/nrf_ironside/CMakeLists.txt +++ b/drivers/firmware/nrf_ironside/CMakeLists.txt @@ -8,4 +8,3 @@ zephyr_library_sources_ifdef(CONFIG_NRF_IRONSIDE_CALL call.c) zephyr_library_sources_ifdef(CONFIG_NRF_IRONSIDE_BOOT_REPORT boot_report.c) zephyr_library_sources_ifdef(CONFIG_NRF_IRONSIDE_CPUCONF_SERVICE cpuconf.c) zephyr_library_sources_ifdef(CONFIG_NRF_IRONSIDE_UPDATE_SERVICE update.c) -zephyr_library_sources_ifdef(CONFIG_NRF_IRONSIDE_DVFS_SERVICE dvfs.c) diff --git a/drivers/firmware/nrf_ironside/Kconfig b/drivers/firmware/nrf_ironside/Kconfig index 13866aba52d4..e009df4df058 100644 --- a/drivers/firmware/nrf_ironside/Kconfig +++ b/drivers/firmware/nrf_ironside/Kconfig @@ -50,21 +50,4 @@ config NRF_IRONSIDE_BOOT_REPORT help Support for parsing the Boot Report populated by Nordic IRONside firmware. -config NRF_IRONSIDE_DVFS_SERVICE - bool "IRONside DVFS service" - depends on SOC_NRF54H20_CPUAPP - select NRF_IRONSIDE_CALL - help - Service used to handle DVFS operating point requests. - -if NRF_IRONSIDE_DVFS_SERVICE - -config NRF_IRONSIDE_DVFS_OPPOINT_CHANGE_MUTEX_TIMEOUT_MS - int "IRONSside DVFS change oppoint mutex timeout" - default 100 - help - Maximum tiemout when waiting for DVFS oppoint change mutex lock. - -endif # NRF_IRONSIDE_DVFS_SERVICE - endmenu diff --git a/drivers/firmware/nrf_ironside/dvfs.c b/drivers/firmware/nrf_ironside/dvfs.c deleted file mode 100644 index 89208f71fb7d..000000000000 --- a/drivers/firmware/nrf_ironside/dvfs.c +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ -#include -#include - -#include -#include - -static enum ironside_dvfs_oppoint current_dvfs_oppoint = IRONSIDE_DVFS_OPP_HIGH; - -struct dvfs_hsfll_data_t { - uint32_t new_f_mult; - uint32_t new_f_trim_entry; - uint32_t max_hsfll_freq; -}; - -static const struct dvfs_hsfll_data_t dvfs_hsfll_data[] = { - /* ABB oppoint 0.8V */ - { - .new_f_mult = 20, - .new_f_trim_entry = 0, - .max_hsfll_freq = 320000000, - }, - /* ABB oppoint 0.6V */ - { - .new_f_mult = 8, - .new_f_trim_entry = 2, - .max_hsfll_freq = 128000000, - }, - /* ABB oppoint 0.5V */ - { - .new_f_mult = 4, - .new_f_trim_entry = 3, - .max_hsfll_freq = 64000000, - }, -}; - -BUILD_ASSERT(ARRAY_SIZE(dvfs_hsfll_data) == (IRONSIDE_DVFS_OPPOINT_COUNT), - "dvfs_hsfll_data size must match number of DVFS oppoints"); - -/** - * @brief Check if the requested oppoint change operation is downscaling. - * - * @param target_freq_setting The target oppoint to check. - * @return true if the current oppoint is higher than the target, false otherwise. - */ -static bool ironside_dvfs_is_downscaling(enum ironside_dvfs_oppoint target_freq_setting) -{ - return current_dvfs_oppoint < target_freq_setting; -} - -/** - * @brief Configure hsfll depending on selected oppoint - * - * @param enum oppoint target operation point - */ -static void ironside_dvfs_configure_hsfll(enum ironside_dvfs_oppoint oppoint) -{ - nrf_hsfll_trim_t hsfll_trim = {}; - uint8_t freq_trim_idx = dvfs_hsfll_data[oppoint].new_f_trim_entry; - -#if defined(NRF_APPLICATION) - hsfll_trim.vsup = NRF_FICR->TRIM.APPLICATION.HSFLL.TRIM.VSUP; - hsfll_trim.coarse = NRF_FICR->TRIM.APPLICATION.HSFLL.TRIM.COARSE[freq_trim_idx]; - hsfll_trim.fine = NRF_FICR->TRIM.APPLICATION.HSFLL.TRIM.FINE[freq_trim_idx]; -#if NRF_HSFLL_HAS_TCOEF_TRIM - hsfll_trim.tcoef = NRF_FICR->TRIM.APPLICATION.HSFLL.TRIM.TCOEF; -#endif -#else -#error "Only application core is supported for DVFS" -#endif - - nrf_hsfll_clkctrl_mult_set(NRF_HSFLL, dvfs_hsfll_data[oppoint].new_f_mult); - nrf_hsfll_trim_set(NRF_HSFLL, &hsfll_trim); - nrf_barrier_w(); - - nrf_hsfll_task_trigger(NRF_HSFLL, NRF_HSFLL_TASK_FREQ_CHANGE); - /* Trigger hsfll task one more time, SEE PAC-4078 */ - nrf_hsfll_task_trigger(NRF_HSFLL, NRF_HSFLL_TASK_FREQ_CHANGE); -} - -/* Function handling steps for DVFS oppoint change. */ -static void ironside_dvfs_prepare_to_scale(enum ironside_dvfs_oppoint dvfs_oppoint) -{ - if (ironside_dvfs_is_downscaling(dvfs_oppoint)) { - ironside_dvfs_configure_hsfll(dvfs_oppoint); - } -} - -/* Update MDK variable which is used by nrfx_coredep_delay_us (k_busy_wait). */ -static void ironside_dvfs_update_core_clock(enum ironside_dvfs_oppoint dvfs_oppoint) -{ - extern uint32_t SystemCoreClock; - - SystemCoreClock = dvfs_hsfll_data[dvfs_oppoint].max_hsfll_freq; -} - -/* Perform scaling finnish procedure. */ -static void ironside_dvfs_change_oppoint_complete(enum ironside_dvfs_oppoint dvfs_oppoint) -{ - if (!ironside_dvfs_is_downscaling(dvfs_oppoint)) { - ironside_dvfs_configure_hsfll(dvfs_oppoint); - } - - current_dvfs_oppoint = dvfs_oppoint; - ironside_dvfs_update_core_clock(dvfs_oppoint); -} - -/** - * @brief Check if ABB analog part is locked. - * - * @param abb Pointer to ABB peripheral. - * - * @return true if ABB is locked, false otherwise. - */ -static inline bool ironside_dvfs_is_abb_locked(NRF_ABB_Type *abb) -{ - /* Check if ABB analog part is locked. */ - return ((abb->STATUSANA & ABB_STATUSANA_LOCKED_Msk) != 0); -} - -/** - * @brief Request DVFS oppoint change from IRONside secure domain. - * This function will send a request over IPC to the IRONside secure domain - * This function is synchronous and will return when the request is completed. - * - * @param oppoint @ref enum ironside_dvfs_oppoint - * @return int - */ -static int ironside_dvfs_req_oppoint(enum ironside_dvfs_oppoint oppoint) -{ - int err; - - struct ironside_call_buf *const buf = ironside_call_alloc(); - - buf->id = IRONSIDE_CALL_ID_DVFS_SERVICE_V0; - buf->args[IRONSIDE_DVFS_SERVICE_OPPOINT_IDX] = oppoint; - - ironside_call_dispatch(buf); - - if (buf->status == IRONSIDE_CALL_STATUS_RSP_SUCCESS) { - err = buf->args[IRONSIDE_DVFS_SERVICE_RETCODE_IDX]; - } else { - err = buf->status; - } - - ironside_call_release(buf); - - return err; -} - -int ironside_dvfs_change_oppoint(enum ironside_dvfs_oppoint dvfs_oppoint) -{ - int status = 0; - - if (!ironside_dvfs_is_oppoint_valid(dvfs_oppoint)) { - return -IRONSIDE_DVFS_ERROR_WRONG_OPPOINT; - } - - if (!ironside_dvfs_is_abb_locked(NRF_ABB)) { - return -IRONSIDE_DVFS_ERROR_BUSY; - } - - if (dvfs_oppoint == current_dvfs_oppoint) { - return status; - } - - if (k_is_in_isr()) { - return -IRONSIDE_DVFS_ERROR_ISR_NOT_ALLOWED; - } - - ironside_dvfs_prepare_to_scale(dvfs_oppoint); - - status = ironside_dvfs_req_oppoint(dvfs_oppoint); - - if (status != 0) { - return status; - } - ironside_dvfs_change_oppoint_complete(dvfs_oppoint); - - return status; -} diff --git a/include/zephyr/drivers/firmware/nrf_ironside/dvfs.h b/include/zephyr/drivers/firmware/nrf_ironside/dvfs.h deleted file mode 100644 index 7d6587bb3c0c..000000000000 --- a/include/zephyr/drivers/firmware/nrf_ironside/dvfs.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef ZEPHYR_INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_NRF_IRONSIDE_DVFS_H_ -#define ZEPHYR_INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_NRF_IRONSIDE_DVFS_H_ - -#include -#include -#include -#include - -enum ironside_dvfs_oppoint { - IRONSIDE_DVFS_OPP_HIGH = 0, - IRONSIDE_DVFS_OPP_MEDLOW = 1, - IRONSIDE_DVFS_OPP_LOW = 2 -}; - -/** - * @brief Number of DVFS oppoints supported by IRONside. - * - * This is the number of different DVFS oppoints that can be set on IRONside. - * The oppoints are defined in the `ironside_dvfs_oppoint` enum. - */ -#define IRONSIDE_DVFS_OPPOINT_COUNT (3) - -/** - * @name IRONside DVFS service error codes. - * @{ - */ - -/** The requested DVFS oppoint is not allowed. */ -#define IRONSIDE_DVFS_ERROR_WRONG_OPPOINT (1) -/** Waiting for mutex lock timed out, or hardware is busy. */ -#define IRONSIDE_DVFS_ERROR_BUSY (2) -/** There is configuration error in the DVFS service. */ -#define IRONSIDE_DVFS_ERROR_OPPOINT_DATA (3) -/** The caller does not have permission to change the DVFS oppoint. */ -#define IRONSIDE_DVFS_ERROR_PERMISSION (4) -/** The requested DVFS oppoint is already set, no change needed. */ -#define IRONSIDE_DVFS_ERROR_NO_CHANGE_NEEDED (5) -/** The operation timed out, possibly due to a hardware issue. */ -#define IRONSIDE_DVFS_ERROR_TIMEOUT (6) -/** The DVFS oppoint change operation is not allowed in the ISR context. */ -#define IRONSIDE_DVFS_ERROR_ISR_NOT_ALLOWED (7) - -/** - * @} - */ - -/* IRONside call identifiers with implicit versions. - * - * With the initial "version 0", the service ABI is allowed to break until the - * first production release of IRONside SE. - */ -#define IRONSIDE_CALL_ID_DVFS_SERVICE_V0 3 - -/* Index of the DVFS oppoint within the service buffer. */ -#define IRONSIDE_DVFS_SERVICE_OPPOINT_IDX (0) -/* Index of the return code within the service buffer. */ -#define IRONSIDE_DVFS_SERVICE_RETCODE_IDX (0) - -/** - * @brief Change the current DVFS oppoint. - * - * This function will request a change of the current DVFS oppoint to the - * specified value. It will block until the change is applied. - * - * @param dvfs_oppoint The new DVFS oppoint to set. - * @return int 0 on success, negative error code on failure. - */ -int ironside_dvfs_change_oppoint(enum ironside_dvfs_oppoint dvfs_oppoint); - -/** - * @brief Check if the given oppoint is valid. - * - * @param dvfs_oppoint The oppoint to check. - * @return true if the oppoint is valid, false otherwise. - */ -static inline bool ironside_dvfs_is_oppoint_valid(enum ironside_dvfs_oppoint dvfs_oppoint) -{ - if (dvfs_oppoint != IRONSIDE_DVFS_OPP_HIGH && - dvfs_oppoint != IRONSIDE_DVFS_OPP_MEDLOW && - dvfs_oppoint != IRONSIDE_DVFS_OPP_LOW) { - return false; - } - - return true; -} - -#endif /* ZEPHYR_INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_NRF_IRONSIDE_DVFS_H_ */ diff --git a/modules/hal_nordic/nrfs/CMakeLists.txt b/modules/hal_nordic/nrfs/CMakeLists.txt index dcc7c340ed3e..d94c2da32a82 100644 --- a/modules/hal_nordic/nrfs/CMakeLists.txt +++ b/modules/hal_nordic/nrfs/CMakeLists.txt @@ -14,12 +14,12 @@ if(CONFIG_NRFS) zephyr_include_directories(${INC_DIR}) zephyr_include_directories(${INC_DIR}/services) - zephyr_include_directories_ifdef(CONFIG_NRFS_HAS_DVFS_SERVICE ${HELPERS_DIR}) + zephyr_include_directories(${HELPERS_DIR}) zephyr_include_directories(.) zephyr_include_directories(${CMAKE_CURRENT_SOURCE_DIR}/backends) zephyr_include_directories_ifdef(CONFIG_NRFS_DVFS_LOCAL_DOMAIN ${CMAKE_CURRENT_SOURCE_DIR}/dvfs) - zephyr_library_sources_ifdef(CONFIG_NRFS_HAS_DVFS_SERVICE ${HELPERS_DIR}/dvfs_oppoint.c) + zephyr_library_sources(${HELPERS_DIR}/dvfs_oppoint.c) if(CONFIG_NRFS_LOCAL_DOMAIN) zephyr_library_sources_ifdef(CONFIG_NRFS_AUDIOPLL_SERVICE_ENABLED ${SRC_DIR}/services/nrfs_audiopll.c) From 1d4b1edcb676e9a5407209464e174491249ee01c Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:46 +0300 Subject: [PATCH 1167/2141] Revert "[nrf fromtree] drivers: mspi_dw: Prevent RX FIFO overflows in Single IO mode" This reverts commit d02d1b4e91f6318201e909db240659347a6da515. Signed-off-by: Jukka Rissanen --- drivers/mspi/mspi_dw.c | 47 +++++++----------------------------------- 1 file changed, 7 insertions(+), 40 deletions(-) diff --git a/drivers/mspi/mspi_dw.c b/drivers/mspi/mspi_dw.c index e57511b409aa..adc59e765b11 100644 --- a/drivers/mspi/mspi_dw.c +++ b/drivers/mspi/mspi_dw.c @@ -78,13 +78,6 @@ struct mspi_dw_config { const struct gpio_dt_spec *ce_gpios; uint8_t ce_gpios_len; uint8_t tx_fifo_depth_minus_1; - /* Maximum number of items allowed in the TX FIFO when transmitting - * dummy bytes; it must be at least one less than the RX FIFO depth - * to account for a byte that can be partially received (i.e. in - * the shifting register) when tx_dummy_bytes() calculates how many - * bytes can be written to the TX FIFO to not overflow the RX FIFO. - */ - uint8_t max_queued_dummy_bytes; uint8_t tx_fifo_threshold; uint8_t rx_fifo_threshold; DECLARE_REG_ACCESS(); @@ -158,11 +151,7 @@ static void tx_data(const struct device *dev, if (buf_pos >= buf_end) { /* Set the threshold to 0 to get the next interrupt - * when the FIFO is completely emptied. This also sets - * the TX start level to 0, so if the transmission was - * not started so far because the FIFO was not filled - * up completely (the start level was set to maximum - * in start_next_packet()), it will be started now. + * when the FIFO is completely emptied. */ write_txftlr(dev, 0); break; @@ -181,22 +170,11 @@ static bool tx_dummy_bytes(const struct device *dev) { struct mspi_dw_data *dev_data = dev->data; const struct mspi_dw_config *dev_config = dev->config; - uint8_t fifo_room = dev_config->max_queued_dummy_bytes + uint8_t fifo_room = dev_config->tx_fifo_depth_minus_1 + 1 - FIELD_GET(TXFLR_TXTFL_MASK, read_txflr(dev)); - uint8_t rx_fifo_items = FIELD_GET(RXFLR_RXTFL_MASK, read_rxflr(dev)); uint16_t dummy_bytes = dev_data->dummy_bytes; const uint8_t dummy_val = 0; - /* Subtract the number of items that are already stored in the RX - * FIFO to avoid overflowing it; `max_queued_dummy_bytes` accounts - * that one byte that can be partially received, thus not included - * in the value from the RXFLR register. - */ - if (fifo_room <= rx_fifo_items) { - return false; - } - fifo_room -= rx_fifo_items; - if (dummy_bytes > fifo_room) { dev_data->dummy_bytes = dummy_bytes - fifo_room; @@ -211,10 +189,8 @@ static bool tx_dummy_bytes(const struct device *dev) write_dr(dev, dummy_val); } while (--dummy_bytes); - /* Set the TX start level to 0, so that the transmission will be - * started now if it hasn't been yet. The threshold value is also - * set to 0 here, but it doesn't really matter, as the interrupt - * will be anyway disabled. + /* Set the threshold to 0 to get the next interrupt when the FIFO is + * completely emptied. */ write_txftlr(dev, 0); @@ -314,16 +290,12 @@ static void mspi_dw_isr(const struct device *dev) if (int_status & ISR_TXEIS_BIT) { if (tx_dummy_bytes(dev)) { - /* All the required dummy bytes were - * written to the FIFO; disable the TXE - * interrupt, as it's no longer needed. - */ write_imr(dev, IMR_RXFIM_BIT); } int_status = read_isr(dev); } - } while (int_status != 0); + } while (int_status); } if (finished) { @@ -951,11 +923,8 @@ static int start_next_packet(const struct device *dev, k_timeout_t timeout) * clock stretching feature does not work yet, or in Standard * SPI mode, where the clock stretching is not available at all. */ - uint8_t start_level = dev_data->dummy_bytes != 0 - ? dev_config->max_queued_dummy_bytes - 1 - : dev_config->tx_fifo_depth_minus_1; - - write_txftlr(dev, FIELD_PREP(TXFTLR_TXFTHR_MASK, start_level) | + write_txftlr(dev, FIELD_PREP(TXFTLR_TXFTHR_MASK, + dev_config->tx_fifo_depth_minus_1) | FIELD_PREP(TXFTLR_TFT_MASK, dev_config->tx_fifo_threshold)); } else { @@ -1437,8 +1406,6 @@ static DEVICE_API(mspi, drv_api) = { TX_FIFO_DEPTH(inst)) #define MSPI_DW_FIFO_PROPS(inst) \ .tx_fifo_depth_minus_1 = TX_FIFO_DEPTH(inst) - 1, \ - .max_queued_dummy_bytes = MIN(RX_FIFO_DEPTH(inst) - 1, \ - TX_FIFO_DEPTH(inst)), \ .tx_fifo_threshold = \ DT_INST_PROP_OR(inst, tx_fifo_threshold, \ 7 * TX_FIFO_DEPTH(inst) / 8 - 1), \ From d9fdac2c86cee0d7c3c29f51ea7b87955cae900a Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:46 +0300 Subject: [PATCH 1168/2141] Revert "[nrf fromlist] drivers: spi: nrfx_spim: use dmm" This reverts commit 9f730b0351edec58ebd933480fd9907fe14638d2. Signed-off-by: Jukka Rissanen --- drivers/spi/spi_nrfx_spim.c | 75 +++++++++++++++++++------------------ 1 file changed, 38 insertions(+), 37 deletions(-) diff --git a/drivers/spi/spi_nrfx_spim.c b/drivers/spi/spi_nrfx_spim.c index c8a0566b68a6..438a1b22999f 100644 --- a/drivers/spi/spi_nrfx_spim.c +++ b/drivers/spi/spi_nrfx_spim.c @@ -16,7 +16,6 @@ #ifdef CONFIG_SOC_NRF54H20_GPD #include #endif -#include #ifdef CONFIG_SOC_NRF52832_ALLOW_SPIM_DESPITE_PAN_58 #include #endif @@ -124,6 +123,9 @@ struct spi_nrfx_config { #endif uint32_t wake_pin; nrfx_gpiote_t wake_gpiote; +#ifdef CONFIG_DCACHE + uint32_t mem_attr; +#endif #ifdef USE_CLOCK_REQUESTS const struct device *clk_dev; struct nrf_clock_spec clk_spec; @@ -132,7 +134,6 @@ struct spi_nrfx_config { bool cross_domain; int8_t default_port; #endif - void *mem_reg; }; static void event_handler(const nrfx_spim_evt_t *p_event, void *p_context); @@ -503,6 +504,11 @@ static void transfer_next_chunk(const struct device *dev) } memcpy(dev_data->tx_buffer, tx_buf, chunk_len); +#ifdef CONFIG_DCACHE + if (dev_config->mem_attr & DT_MEM_CACHEABLE) { + sys_cache_data_flush_range(dev_data->tx_buffer, chunk_len); + } +#endif tx_buf = dev_data->tx_buffer; } @@ -519,20 +525,10 @@ static void transfer_next_chunk(const struct device *dev) dev_data->chunk_len = chunk_len; - xfer.tx_length = spi_context_tx_buf_on(ctx) ? chunk_len : 0; - xfer.rx_length = spi_context_rx_buf_on(ctx) ? chunk_len : 0; - - error = dmm_buffer_out_prepare(dev_config->mem_reg, tx_buf, xfer.tx_length, - (void **)&xfer.p_tx_buffer); - if (error != 0) { - goto out_alloc_failed; - } - - error = dmm_buffer_in_prepare(dev_config->mem_reg, rx_buf, xfer.rx_length, - (void **)&xfer.p_rx_buffer); - if (error != 0) { - goto in_alloc_failed; - } + xfer.p_tx_buffer = tx_buf; + xfer.tx_length = spi_context_tx_buf_on(ctx) ? chunk_len : 0; + xfer.p_rx_buffer = rx_buf; + xfer.rx_length = spi_context_rx_buf_on(ctx) ? chunk_len : 0; #ifdef CONFIG_SOC_NRF52832_ALLOW_SPIM_DESPITE_PAN_58 if (xfer.rx_length == 1 && xfer.tx_length <= 1) { @@ -555,15 +551,8 @@ static void transfer_next_chunk(const struct device *dev) anomaly_58_workaround_clear(dev_data); #endif } - - /* On nrfx_spim_xfer() error */ - dmm_buffer_in_release(dev_config->mem_reg, rx_buf, xfer.rx_length, - (void **)&xfer.p_rx_buffer); -in_alloc_failed: - dmm_buffer_out_release(dev_config->mem_reg, (void **)&xfer.p_tx_buffer); } -out_alloc_failed: finish_transaction(dev, error); } @@ -571,7 +560,9 @@ static void event_handler(const nrfx_spim_evt_t *p_event, void *p_context) { const struct device *dev = p_context; struct spi_nrfx_data *dev_data = dev->data; +#ifdef CONFIG_DCACHE const struct spi_nrfx_config *dev_config = dev->config; +#endif if (p_event->type == NRFX_SPIM_EVENT_DONE) { /* Chunk length is set to 0 when a transaction is aborted @@ -585,21 +576,15 @@ static void event_handler(const nrfx_spim_evt_t *p_event, void *p_context) #ifdef CONFIG_SOC_NRF52832_ALLOW_SPIM_DESPITE_PAN_58 anomaly_58_workaround_clear(dev_data); #endif - - if (spi_context_tx_buf_on(&dev_data->ctx)) { - dmm_buffer_out_release(dev_config->mem_reg, - (void **)p_event->xfer_desc.p_tx_buffer); - } - - if (spi_context_rx_buf_on(&dev_data->ctx)) { - dmm_buffer_in_release(dev_config->mem_reg, dev_data->ctx.rx_buf, - dev_data->chunk_len, p_event->xfer_desc.p_rx_buffer); - } - #ifdef SPI_BUFFER_IN_RAM if (spi_context_rx_buf_on(&dev_data->ctx) && p_event->xfer_desc.p_rx_buffer != NULL && p_event->xfer_desc.p_rx_buffer != dev_data->ctx.rx_buf) { +#ifdef CONFIG_DCACHE + if (dev_config->mem_attr & DT_MEM_CACHEABLE) { + sys_cache_data_invd_range(dev_data->rx_buffer, dev_data->chunk_len); + } +#endif (void)memcpy(dev_data->ctx.rx_buf, dev_data->rx_buffer, dev_data->chunk_len); @@ -893,6 +878,8 @@ static int spi_nrfx_deinit(const struct device *dev) return 0; } +#define SPIM_MEM_REGION(idx) DT_PHANDLE(SPIM(idx), memory_regions) + #define SPI_NRFX_SPIM_EXTENDED_CONFIG(idx) \ IF_ENABLED(NRFX_SPIM_EXTENDED_ENABLED, \ (.dcx_pin = NRF_SPIM_PIN_NOT_CONNECTED, \ @@ -901,6 +888,13 @@ static int spi_nrfx_deinit(const struct device *dev) ()) \ )) +#define SPIM_GET_MEM_ATTR(idx) \ + COND_CODE_1(SPIM_HAS_PROP(idx, memory_regions), \ + (COND_CODE_1(DT_NODE_HAS_PROP(SPIM_MEM_REGION(idx), zephyr_memory_attr), \ + (DT_PROP(SPIM_MEM_REGION(idx), zephyr_memory_attr)), \ + (0))), \ + (0)) + /* Fast instances depend on the global HSFLL clock controller (as they need * to request the highest frequency from it to operate correctly), so they * must be initialized after that controller driver, hence the default SPI @@ -927,10 +921,10 @@ static int spi_nrfx_deinit(const struct device *dev) IF_ENABLED(SPI_BUFFER_IN_RAM, \ (static uint8_t spim_##idx##_tx_buffer \ [CONFIG_SPI_NRFX_RAM_BUFFER_SIZE] \ - DMM_MEMORY_SECTION(SPIM(idx)); \ + SPIM_MEMORY_SECTION(idx); \ static uint8_t spim_##idx##_rx_buffer \ [CONFIG_SPI_NRFX_RAM_BUFFER_SIZE] \ - DMM_MEMORY_SECTION(SPIM(idx));)) \ + SPIM_MEMORY_SECTION(idx);)) \ static struct spi_nrfx_data spi_##idx##_data = { \ IF_ENABLED(CONFIG_MULTITHREADING, \ (SPI_CONTEXT_INIT_LOCK(spi_##idx##_data, ctx),)) \ @@ -967,6 +961,8 @@ static int spi_nrfx_deinit(const struct device *dev) .wake_pin = NRF_DT_GPIOS_TO_PSEL_OR(SPIM(idx), wake_gpios, \ WAKE_PIN_NOT_USED), \ .wake_gpiote = WAKE_GPIOTE_INSTANCE(SPIM(idx)), \ + IF_ENABLED(CONFIG_DCACHE, \ + (.mem_attr = SPIM_GET_MEM_ATTR(idx),)) \ IF_ENABLED(USE_CLOCK_REQUESTS, \ (.clk_dev = SPIM_REQUESTS_CLOCK(SPIM(idx)) \ ? DEVICE_DT_GET(DT_CLOCKS_CTLR(SPIM(idx))) \ @@ -979,7 +975,6 @@ static int spi_nrfx_deinit(const struct device *dev) .default_port = \ DT_PROP_OR(DT_PHANDLE(SPIM(idx), \ default_gpio_port), port, -1),)) \ - .mem_reg = DMM_DEV_TO_REG(SPIM(idx)), \ }; \ BUILD_ASSERT(!SPIM_HAS_PROP(idx, wake_gpios) || \ !(DT_GPIO_FLAGS(SPIM(idx), wake_gpios) & GPIO_ACTIVE_LOW),\ @@ -994,6 +989,12 @@ static int spi_nrfx_deinit(const struct device *dev) POST_KERNEL, SPIM_INIT_PRIORITY(idx), \ &spi_nrfx_driver_api) +#define SPIM_MEMORY_SECTION(idx) \ + COND_CODE_1(SPIM_HAS_PROP(idx, memory_regions), \ + (__attribute__((__section__(LINKER_DT_NODE_REGION_NAME( \ + SPIM_MEM_REGION(idx)))))), \ + ()) + #define COND_NRF_SPIM_DEVICE(unused, prefix, i, _) \ IF_ENABLED(CONFIG_HAS_HW_NRF_SPIM##prefix##i, (SPI_NRFX_SPIM_DEFINE(prefix##i);)) From 5fb4bdbb28176abf9fb4ae2bc9b3c4d18e26da25 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:46 +0300 Subject: [PATCH 1169/2141] Revert "[nrf fromtree] net: shell: dns: Print info about DHCP added servers" This reverts commit 340fef3ef4029059bc999aee4212bb7b879beb1d. Signed-off-by: Jukka Rissanen --- subsys/net/lib/shell/dns.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/subsys/net/lib/shell/dns.c b/subsys/net/lib/shell/dns.c index e01b58096c3f..6c6285990d88 100644 --- a/subsys/net/lib/shell/dns.c +++ b/subsys/net/lib/shell/dns.c @@ -93,30 +93,22 @@ static void print_dns_info(const struct shell *sh, } if (ctx->servers[i].dns_server.sa_family == AF_INET) { - PR("\t%s:%u%s%s%s%s%s\n", + PR("\t%s:%u%s%s\n", net_sprint_ipv4_addr( &net_sin(&ctx->servers[i].dns_server)-> sin_addr), ntohs(net_sin(&ctx->servers[i].dns_server)->sin_port), printable_iface(iface_name, " via ", ""), - printable_iface(iface_name, iface_name, ""), - ctx->servers[i].source != DNS_SOURCE_UNKNOWN ? " (" : "", - ctx->servers[i].source != DNS_SOURCE_UNKNOWN ? - dns_get_source_str(ctx->servers[i].source) : "", - ctx->servers[i].source != DNS_SOURCE_UNKNOWN ? ")" : ""); + printable_iface(iface_name, iface_name, "")); } else if (ctx->servers[i].dns_server.sa_family == AF_INET6) { - PR("\t[%s]:%u%s%s%s%s%s\n", + PR("\t[%s]:%u%s%s\n", net_sprint_ipv6_addr( &net_sin6(&ctx->servers[i].dns_server)-> sin6_addr), ntohs(net_sin6(&ctx->servers[i].dns_server)->sin6_port), printable_iface(iface_name, " via ", ""), - printable_iface(iface_name, iface_name, ""), - ctx->servers[i].source != DNS_SOURCE_UNKNOWN ? " (" : "", - ctx->servers[i].source != DNS_SOURCE_UNKNOWN ? - dns_get_source_str(ctx->servers[i].source) : "", - ctx->servers[i].source != DNS_SOURCE_UNKNOWN ? ")" : ""); + printable_iface(iface_name, iface_name, "")); } } From 7d8e50319462585029806cd98e2ffa1447416e42 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:46 +0300 Subject: [PATCH 1170/2141] Revert "[nrf fromtree] net: dhcp: Remove only added DNS servers when stopping" This reverts commit 0fff66f43b44a46715b1a9516b98fb8e05747775. Signed-off-by: Jukka Rissanen --- include/zephyr/net/dns_resolve.h | 13 ------------- subsys/net/lib/dhcpv4/dhcpv4.c | 11 ++--------- subsys/net/lib/dhcpv6/dhcpv6.c | 11 ++--------- subsys/net/lib/dns/resolve.c | 20 +------------------- 4 files changed, 5 insertions(+), 50 deletions(-) diff --git a/include/zephyr/net/dns_resolve.h b/include/zephyr/net/dns_resolve.h index 400af6b77e67..e8789e8621d0 100644 --- a/include/zephyr/net/dns_resolve.h +++ b/include/zephyr/net/dns_resolve.h @@ -586,19 +586,6 @@ int dns_resolve_reconfigure_with_interfaces(struct dns_resolve_context *ctx, */ int dns_resolve_remove(struct dns_resolve_context *ctx, int if_index); -/** - * @brief Remove servers from the DNS resolving context that were added by - * a specific source. - * - * @param ctx DNS context - * @param if_index Network interface from which the DNS servers are removed. - * @param source Source of the DNS servers, e.g., manual, DHCPv4/6, etc. - * - * @return 0 if ok, <0 if error. - */ -int dns_resolve_remove_source(struct dns_resolve_context *ctx, int if_index, - enum dns_server_source source); - /** * @brief Cancel a pending DNS query. * diff --git a/subsys/net/lib/dhcpv4/dhcpv4.c b/subsys/net/lib/dhcpv4/dhcpv4.c index 2096bf330d9e..5dce854aa905 100644 --- a/subsys/net/lib/dhcpv4/dhcpv4.c +++ b/subsys/net/lib/dhcpv4/dhcpv4.c @@ -1677,9 +1677,8 @@ static void dhcpv4_iface_event_handler(struct net_mgmt_event_callback *cb, * comes back up. */ if (IS_ENABLED(CONFIG_NET_DHCPV4_DNS_SERVER_VIA_INTERFACE)) { - dns_resolve_remove_source(dns_resolve_get_default(), - net_if_get_by_iface(iface), - DNS_SOURCE_DHCPV4); + dns_resolve_remove(dns_resolve_get_default(), + net_if_get_by_iface(iface)); } } } else if (mgmt_event == NET_EVENT_IF_UP) { @@ -1945,12 +1944,6 @@ void net_dhcpv4_stop(struct net_if *iface) NET_DBG("state=%s", net_dhcpv4_state_name(iface->config.dhcpv4.state)); - if (IS_ENABLED(CONFIG_NET_DHCPV4_DNS_SERVER_VIA_INTERFACE)) { - dns_resolve_remove_source(dns_resolve_get_default(), - net_if_get_by_iface(iface), - DNS_SOURCE_DHCPV4); - } - sys_slist_find_and_remove(&dhcpv4_ifaces, &iface->config.dhcpv4.node); diff --git a/subsys/net/lib/dhcpv6/dhcpv6.c b/subsys/net/lib/dhcpv6/dhcpv6.c index c1282c2a6f12..d8b1e3d7a6dc 100644 --- a/subsys/net/lib/dhcpv6/dhcpv6.c +++ b/subsys/net/lib/dhcpv6/dhcpv6.c @@ -2226,9 +2226,8 @@ static void dhcpv6_iface_event_handler(struct net_mgmt_event_callback *cb, * comes back up. */ if (IS_ENABLED(CONFIG_NET_DHCPV6_DNS_SERVER_VIA_INTERFACE)) { - dns_resolve_remove_source(dns_resolve_get_default(), - net_if_get_by_iface(iface), - DNS_SOURCE_DHCPV6); + dns_resolve_remove(dns_resolve_get_default(), + net_if_get_by_iface(iface)); } } else if (mgmt_event == NET_EVENT_IF_UP) { NET_DBG("Interface %p coming up", iface); @@ -2324,12 +2323,6 @@ void net_dhcpv6_stop(struct net_if *iface) (void)dhcpv6_enter_state(iface, NET_DHCPV6_DISABLED); - if (IS_ENABLED(CONFIG_NET_DHCPV6_DNS_SERVER_VIA_INTERFACE)) { - dns_resolve_remove_source(dns_resolve_get_default(), - net_if_get_by_iface(iface), - DNS_SOURCE_DHCPV6); - } - sys_slist_find_and_remove(&dhcpv6_ifaces, &iface->config.dhcpv6.node); diff --git a/subsys/net/lib/dns/resolve.c b/subsys/net/lib/dns/resolve.c index 9025501971ee..2b8d6f975fb0 100644 --- a/subsys/net/lib/dns/resolve.c +++ b/subsys/net/lib/dns/resolve.c @@ -2163,9 +2163,7 @@ int dns_resolve_reconfigure(struct dns_resolve_context *ctx, source); } -static int dns_resolve_remove_and_check_source(struct dns_resolve_context *ctx, int if_index, - bool check_source, - enum dns_server_source source) +int dns_resolve_remove(struct dns_resolve_context *ctx, int if_index) { int i; int ret = -ENOENT; @@ -2190,10 +2188,6 @@ static int dns_resolve_remove_and_check_source(struct dns_resolve_context *ctx, continue; } - if (check_source && ctx->servers[i].source != source) { - continue; - } - ctx->servers[i].if_index = 0; /* See comment in dns_resolve_close_locked() about @@ -2215,18 +2209,6 @@ static int dns_resolve_remove_and_check_source(struct dns_resolve_context *ctx, return st; } -int dns_resolve_remove(struct dns_resolve_context *ctx, int if_index) -{ - return dns_resolve_remove_and_check_source(ctx, if_index, false, - DNS_SOURCE_UNKNOWN); -} - -int dns_resolve_remove_source(struct dns_resolve_context *ctx, int if_index, - enum dns_server_source source) -{ - return dns_resolve_remove_and_check_source(ctx, if_index, true, source); -} - struct dns_resolve_context *dns_resolve_get_default(void) { return &dns_default_ctx; From 7143c7426018fdc103e4c640a5fd47de11b9e0d7 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:46 +0300 Subject: [PATCH 1171/2141] Revert "[nrf fromtree] net: dns: Save info about source when configuring DNS servers" This reverts commit e4b17cd2922ce9e9f3fb1c708faa780c7ac1150b. Signed-off-by: Jukka Rissanen --- drivers/modem/hl7800.c | 3 +- drivers/wifi/esp_at/esp.c | 3 +- include/zephyr/net/dns_resolve.h | 38 +--------------- subsys/net/ip/ipv6_nbr.c | 3 +- subsys/net/l2/ppp/ipcp.c | 3 +- subsys/net/lib/dhcpv4/dhcpv4.c | 6 +-- subsys/net/lib/dhcpv6/dhcpv6.c | 6 +-- subsys/net/lib/dns/resolve.c | 61 +++++--------------------- tests/net/lib/dns_addremove/src/main.c | 3 +- 9 files changed, 23 insertions(+), 103 deletions(-) diff --git a/drivers/modem/hl7800.c b/drivers/modem/hl7800.c index 330642906393..58e4f663838d 100644 --- a/drivers/modem/hl7800.c +++ b/drivers/modem/hl7800.c @@ -1966,8 +1966,7 @@ static void dns_work_cb(struct k_work *work) } } else { LOG_DBG("Reconfiguring DNS resolver"); - ret = dns_resolve_reconfigure(dnsCtx, (const char **)dns_servers_str, NULL, - DNS_SOURCE_MANUAL); + ret = dns_resolve_reconfigure(dnsCtx, (const char **)dns_servers_str, NULL); if (ret < 0) { LOG_ERR("dns_resolve_reconfigure fail (%d)", ret); retry = true; diff --git a/drivers/wifi/esp_at/esp.c b/drivers/wifi/esp_at/esp.c index 427d548350bf..25c47412c4cc 100644 --- a/drivers/wifi/esp_at/esp.c +++ b/drivers/wifi/esp_at/esp.c @@ -506,8 +506,7 @@ static void esp_dns_work(struct k_work *work) dnsctx = dns_resolve_get_default(); err = dns_resolve_reconfigure_with_interfaces(dnsctx, NULL, dns_servers, - interfaces, - DNS_SOURCE_MANUAL); + interfaces); if (err) { LOG_ERR("Could not set DNS servers: %d", err); } diff --git a/include/zephyr/net/dns_resolve.h b/include/zephyr/net/dns_resolve.h index e8789e8621d0..62781b518921 100644 --- a/include/zephyr/net/dns_resolve.h +++ b/include/zephyr/net/dns_resolve.h @@ -42,24 +42,6 @@ enum dns_query_type { DNS_QUERY_TYPE_AAAA = 28 }; -/** - * Entity that added the DNS server. - */ -enum dns_server_source { - /** Source is unknown */ - DNS_SOURCE_UNKNOWN = 0, - /** Server information is added manually, for example by an application */ - DNS_SOURCE_MANUAL, - /** Server information is from DHCPv4 server */ - DNS_SOURCE_DHCPV4, - /** Server information is from DHCPv6 server */ - DNS_SOURCE_DHCPV6, - /** Server information is from IPv6 SLAAC (router advertisement) */ - DNS_SOURCE_IPV6_RA, - /** Server information is from PPP */ - DNS_SOURCE_PPP, -}; - /** Max size of the resolved name. */ #ifndef DNS_MAX_NAME_SIZE #define DNS_MAX_NAME_SIZE 20 @@ -363,9 +345,6 @@ struct dns_resolve_context { */ int if_index; - /** Source of the DNS server, e.g., manual, DHCPv4/6, etc. */ - enum dns_server_source source; - /** Is this server mDNS one */ uint8_t is_mdns : 1; @@ -539,14 +518,12 @@ int dns_resolve_close(struct dns_resolve_context *ctx); * @param servers_sa DNS server addresses as struct sockaddr. The array * is NULL terminated. Port numbers are optional in struct sockaddr, the * default will be used if set to 0. - * @param source Source of the DNS servers, e.g., manual, DHCPv4/6, etc. * * @return 0 if ok, <0 if error. */ int dns_resolve_reconfigure(struct dns_resolve_context *ctx, const char *servers_str[], - const struct sockaddr *servers_sa[], - enum dns_server_source source); + const struct sockaddr *servers_sa[]); /** * @brief Reconfigure DNS resolving context with new server list and @@ -566,15 +543,13 @@ int dns_resolve_reconfigure(struct dns_resolve_context *ctx, * @param interfaces Network interfaces to which the DNS servers are bound. * This is an array of network interface indices. The array must be * the same length as the servers_str and servers_sa arrays. - * @param source Source of the DNS servers, e.g., manual, DHCPv4/6, etc. * * @return 0 if ok, <0 if error. */ int dns_resolve_reconfigure_with_interfaces(struct dns_resolve_context *ctx, const char *servers_str[], const struct sockaddr *servers_sa[], - int interfaces[], - enum dns_server_source source); + int interfaces[]); /** * @brief Remove servers from the DNS resolving context. @@ -726,15 +701,6 @@ static inline int dns_cancel_addr_info(uint16_t dns_id) /** @cond INTERNAL_HIDDEN */ -/** - * @brief Get string representation of the DNS server source. - * - * @param source Source of the DNS server. - * - * @return String representation of the DNS server source. - */ -const char *dns_get_source_str(enum dns_server_source source); - /** * @brief Initialize DNS subsystem. */ diff --git a/subsys/net/ip/ipv6_nbr.c b/subsys/net/ip/ipv6_nbr.c index 1cf7e53ad489..19a0405f6ea8 100644 --- a/subsys/net/ip/ipv6_nbr.c +++ b/subsys/net/ip/ipv6_nbr.c @@ -2509,8 +2509,7 @@ static inline bool handle_ra_rdnss(struct net_pkt *pkt, uint8_t len) /* TODO: Handle lifetime. */ ctx = dns_resolve_get_default(); ret = dns_resolve_reconfigure_with_interfaces(ctx, NULL, dns_servers, - interfaces, - DNS_SOURCE_IPV6_RA); + interfaces); if (ret < 0) { NET_DBG("Failed to set RDNSS resolve address: %d", ret); } diff --git a/subsys/net/l2/ppp/ipcp.c b/subsys/net/l2/ppp/ipcp.c index 320b78a0c0c3..f376a3997a3d 100644 --- a/subsys/net/l2/ppp/ipcp.c +++ b/subsys/net/l2/ppp/ipcp.c @@ -376,8 +376,7 @@ static void ipcp_set_dns_servers(struct ppp_fsm *fsm) dnsctx = dns_resolve_get_default(); ret = dns_resolve_reconfigure_with_interfaces(dnsctx, NULL, dns_servers, - interfaces, - DNS_SOURCE_PPP); + interfaces); if (ret < 0) { NET_ERR("Could not set DNS servers"); return; diff --git a/subsys/net/lib/dhcpv4/dhcpv4.c b/subsys/net/lib/dhcpv4/dhcpv4.c index 5dce854aa905..c475b1fb4d26 100644 --- a/subsys/net/lib/dhcpv4/dhcpv4.c +++ b/subsys/net/lib/dhcpv4/dhcpv4.c @@ -1185,11 +1185,9 @@ static bool dhcpv4_parse_options(struct net_pkt *pkt, status = dns_resolve_reconfigure_with_interfaces(ctx, NULL, dns_servers, - interfaces, - DNS_SOURCE_DHCPV4); + interfaces); } else { - status = dns_resolve_reconfigure(ctx, NULL, dns_servers, - DNS_SOURCE_DHCPV4); + status = dns_resolve_reconfigure(ctx, NULL, dns_servers); } if (status < 0) { diff --git a/subsys/net/lib/dhcpv6/dhcpv6.c b/subsys/net/lib/dhcpv6/dhcpv6.c index d8b1e3d7a6dc..2e1441b0331e 100644 --- a/subsys/net/lib/dhcpv6/dhcpv6.c +++ b/subsys/net/lib/dhcpv6/dhcpv6.c @@ -1426,11 +1426,9 @@ static int dhcpv6_handle_dns_server_option(struct net_pkt *pkt) status = dns_resolve_reconfigure_with_interfaces(ctx, NULL, dns_servers, - interfaces, - DNS_SOURCE_DHCPV6); + interfaces); } else { - status = dns_resolve_reconfigure(ctx, NULL, dns_servers, - DNS_SOURCE_DHCPV6); + status = dns_resolve_reconfigure(ctx, NULL, dns_servers); } if (status < 0) { diff --git a/subsys/net/lib/dns/resolve.c b/subsys/net/lib/dns/resolve.c index 2b8d6f975fb0..234d48ba8435 100644 --- a/subsys/net/lib/dns/resolve.c +++ b/subsys/net/lib/dns/resolve.c @@ -488,34 +488,13 @@ static int get_free_slot(struct dns_resolve_context *ctx) return -ENOENT; } -const char *dns_get_source_str(enum dns_server_source source) -{ - switch (source) { - case DNS_SOURCE_UNKNOWN: - return "unknown"; - case DNS_SOURCE_MANUAL: - return "manual"; - case DNS_SOURCE_DHCPV4: - __fallthrough; - case DNS_SOURCE_DHCPV6: - return "DHCP"; - case DNS_SOURCE_IPV6_RA: - return "IPv6 RA"; - case DNS_SOURCE_PPP: - return "PPP"; - } - - return ""; -} - /* Must be invoked with context lock held */ static int dns_resolve_init_locked(struct dns_resolve_context *ctx, const char *servers[], const struct sockaddr *servers_sa[], const struct net_socket_service_desc *svc, uint16_t port, int interfaces[], - bool do_cleanup, - enum dns_server_source source) + bool do_cleanup) { #if defined(CONFIG_NET_IPV6) struct sockaddr_in6 local_addr6 = { @@ -629,8 +608,6 @@ static int dns_resolve_init_locked(struct dns_resolve_context *ctx, } } - ctx->servers[idx].source = source; - addr = &ctx->servers[idx].dns_server; (void)memset(addr, 0, sizeof(*addr)); @@ -647,16 +624,13 @@ static int dns_resolve_init_locked(struct dns_resolve_context *ctx, dns_postprocess_server(ctx, idx); - NET_DBG("[%d] %.*s%s%s%s%s%s%s%s", i, (int)server_len, servers[i], + NET_DBG("[%d] %.*s%s%s%s%s", i, (int)server_len, servers[i], IS_ENABLED(CONFIG_MDNS_RESOLVER) ? (ctx->servers[i].is_mdns ? " mDNS" : "") : "", IS_ENABLED(CONFIG_LLMNR_RESOLVER) ? (ctx->servers[i].is_llmnr ? " LLMNR" : "") : "", iface_str != NULL ? " via " : "", - iface_str != NULL ? iface_str : "", - source != DNS_SOURCE_UNKNOWN ? " (" : "", - source != DNS_SOURCE_UNKNOWN ? dns_get_source_str(source) : "", - source != DNS_SOURCE_UNKNOWN ? ")" : ""); + iface_str != NULL ? iface_str : ""); idx++; } @@ -682,8 +656,6 @@ static int dns_resolve_init_locked(struct dns_resolve_context *ctx, break; } - ctx->servers[idx].source = source; - memcpy(&ctx->servers[idx].dns_server, servers_sa[i], sizeof(ctx->servers[idx].dns_server)); @@ -696,7 +668,7 @@ static int dns_resolve_init_locked(struct dns_resolve_context *ctx, dns_postprocess_server(ctx, idx); - NET_DBG("[%d] %s%s%s%s%s%s%s%s", i, + NET_DBG("[%d] %s%s%s%s%s", i, net_sprint_addr(servers_sa[i]->sa_family, &net_sin(servers_sa[i])->sin_addr), IS_ENABLED(CONFIG_MDNS_RESOLVER) ? @@ -704,10 +676,7 @@ static int dns_resolve_init_locked(struct dns_resolve_context *ctx, IS_ENABLED(CONFIG_LLMNR_RESOLVER) ? (ctx->servers[i].is_llmnr ? " LLMNR" : "") : "", interfaces != NULL ? " via " : "", - interfaces != NULL ? iface_str : "", - source != DNS_SOURCE_UNKNOWN ? " (" : "", - source != DNS_SOURCE_UNKNOWN ? dns_get_source_str(source) : "", - source != DNS_SOURCE_UNKNOWN ? ")" : ""); + interfaces != NULL ? iface_str : ""); idx++; } @@ -902,7 +871,7 @@ int dns_resolve_init_with_svc(struct dns_resolve_context *ctx, const char *serve } ret = dns_resolve_init_locked(ctx, servers, servers_sa, svc, port, - interfaces, true, DNS_SOURCE_UNKNOWN); + interfaces, true); k_mutex_unlock(&lock); @@ -2086,8 +2055,7 @@ static int do_dns_resolve_reconfigure(struct dns_resolve_context *ctx, const char *servers[], const struct sockaddr *servers_sa[], int interfaces[], - bool do_close, - enum dns_server_source source) + bool do_close) { int err; @@ -2124,8 +2092,7 @@ static int do_dns_resolve_reconfigure(struct dns_resolve_context *ctx, err = dns_resolve_init_locked(ctx, servers, servers_sa, &resolve_svc, 0, interfaces, - do_close, - source); + do_close); unlock: k_mutex_unlock(&ctx->lock); @@ -2137,30 +2104,26 @@ static int do_dns_resolve_reconfigure(struct dns_resolve_context *ctx, int dns_resolve_reconfigure_with_interfaces(struct dns_resolve_context *ctx, const char *servers[], const struct sockaddr *servers_sa[], - int interfaces[], - enum dns_server_source source) + int interfaces[]) { return do_dns_resolve_reconfigure(ctx, servers, servers_sa, interfaces, IS_ENABLED(CONFIG_DNS_RECONFIGURE_CLEANUP) ? - true : false, - source); + true : false); } int dns_resolve_reconfigure(struct dns_resolve_context *ctx, const char *servers[], - const struct sockaddr *servers_sa[], - enum dns_server_source source) + const struct sockaddr *servers_sa[]) { return do_dns_resolve_reconfigure(ctx, servers, servers_sa, NULL, IS_ENABLED(CONFIG_DNS_RECONFIGURE_CLEANUP) ? - true : false, - source); + true : false); } int dns_resolve_remove(struct dns_resolve_context *ctx, int if_index) diff --git a/tests/net/lib/dns_addremove/src/main.c b/tests/net/lib/dns_addremove/src/main.c index 1b6f55efd730..3ff9bb2aabe2 100644 --- a/tests/net/lib/dns_addremove/src/main.c +++ b/tests/net/lib/dns_addremove/src/main.c @@ -466,8 +466,7 @@ ZTEST(dns_addremove, test_dns_reconfigure_callback) "Timeout while waiting for DNS added callback"); } - ret = dns_resolve_reconfigure(&resv_ipv4, dns2_servers_str, NULL, - DNS_SOURCE_MANUAL); + ret = dns_resolve_reconfigure(&resv_ipv4, dns2_servers_str, NULL); zassert_equal(ret, 0, "Cannot reconfigure DNS server"); /* Wait for DNS removed callback after reconfiguring DNS */ From fc0a534eb4d6cd30dda5220e9bb79e16117532c1 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:47 +0300 Subject: [PATCH 1172/2141] Revert "[nrf fromtree] net: ppp: Bind DNS to device ppp network interface" This reverts commit 1da2e9f7b65d9e013745bd2b17b22a5234396df0. Signed-off-by: Jukka Rissanen --- subsys/net/l2/ppp/ipcp.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/subsys/net/l2/ppp/ipcp.c b/subsys/net/l2/ppp/ipcp.c index f376a3997a3d..1cea54de2f39 100644 --- a/subsys/net/l2/ppp/ipcp.c +++ b/subsys/net/l2/ppp/ipcp.c @@ -362,8 +362,6 @@ static void ipcp_set_dns_servers(struct ppp_fsm *fsm) (struct sockaddr *) &dns2, NULL }; - int ifindex = net_if_get_by_iface(ctx->iface); - int interfaces[2] = { ifindex, ifindex }; int ret; if (!dns1.sin_addr.s_addr) { @@ -375,8 +373,7 @@ static void ipcp_set_dns_servers(struct ppp_fsm *fsm) } dnsctx = dns_resolve_get_default(); - ret = dns_resolve_reconfigure_with_interfaces(dnsctx, NULL, dns_servers, - interfaces); + ret = dns_resolve_reconfigure(dnsctx, NULL, dns_servers); if (ret < 0) { NET_ERR("Could not set DNS servers"); return; From 827cae38605c1050425bcebd1ea74e71401d51b8 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:47 +0300 Subject: [PATCH 1173/2141] Revert "[nrf fromtree] drivers: wifi: esp_at: Bind DNS to device net interface" This reverts commit 939bc466cf7bf16a5339dab7f4ae19b3992a41a4. Signed-off-by: Jukka Rissanen --- drivers/wifi/esp_at/esp.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/wifi/esp_at/esp.c b/drivers/wifi/esp_at/esp.c index 25c47412c4cc..c68ea98ee0f9 100644 --- a/drivers/wifi/esp_at/esp.c +++ b/drivers/wifi/esp_at/esp.c @@ -490,23 +490,18 @@ static void esp_dns_work(struct k_work *work) struct dns_resolve_context *dnsctx; struct sockaddr_in *addrs = data->dns_addresses; const struct sockaddr *dns_servers[ESP_MAX_DNS + 1] = {}; - int interfaces[ESP_MAX_DNS]; size_t i; - int err, ifindex; - - ifindex = net_if_get_by_ifindex(data->net_iface); + int err; for (i = 0; i < ESP_MAX_DNS; i++) { if (!addrs[i].sin_addr.s_addr) { break; } dns_servers[i] = (struct sockaddr *) &addrs[i]; - interfaces[i] = ifindex; } dnsctx = dns_resolve_get_default(); - err = dns_resolve_reconfigure_with_interfaces(dnsctx, NULL, dns_servers, - interfaces); + err = dns_resolve_reconfigure(dnsctx, NULL, dns_servers); if (err) { LOG_ERR("Could not set DNS servers: %d", err); } From dafb9b5ad6f6d7565d69da27f144ac80fab62acd Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:47 +0300 Subject: [PATCH 1174/2141] Revert "[nrf fromtree] net: shell: conn: Print packet socket information correctly" This reverts commit a7bc8d7f849701b991df0252373873bb85af6bfe. Signed-off-by: Jukka Rissanen --- subsys/net/lib/shell/conn.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/subsys/net/lib/shell/conn.c b/subsys/net/lib/shell/conn.c index ca852f1d15d0..32dc32fcf444 100644 --- a/subsys/net/lib/shell/conn.c +++ b/subsys/net/lib/shell/conn.c @@ -89,8 +89,6 @@ static void conn_handler_cb(struct net_conn *conn, void *user_data) } else if (conn->local_addr.sa_family == AF_UNSPEC) { snprintk(addr_local, sizeof(addr_local), "AF_UNSPEC"); - } else if (conn->local_addr.sa_family == AF_PACKET) { - snprintk(addr_local, sizeof(addr_local), "AF_PACKET"); } else { snprintk(addr_local, sizeof(addr_local), "AF_UNK(%d)", conn->local_addr.sa_family); From 5e21fffeb9f3b988f493e255e38c3e844d2aad8f Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:47 +0300 Subject: [PATCH 1175/2141] Revert "[nrf fromtree] net: dns: Add uninitialized state to resolver context" This reverts commit cfc8a779844ac270c8c99be6c288f2dd2a3174a5. Signed-off-by: Jukka Rissanen --- include/zephyr/net/dns_resolve.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/zephyr/net/dns_resolve.h b/include/zephyr/net/dns_resolve.h index 62781b518921..05ee7154d1cb 100644 --- a/include/zephyr/net/dns_resolve.h +++ b/include/zephyr/net/dns_resolve.h @@ -320,7 +320,6 @@ typedef void (*dns_resolve_cb_t)(enum dns_resolve_status status, /** @cond INTERNAL_HIDDEN */ enum dns_resolve_context_state { - DNS_RESOLVE_CONTEXT_UNINITIALIZED = 0, DNS_RESOLVE_CONTEXT_ACTIVE, DNS_RESOLVE_CONTEXT_DEACTIVATING, DNS_RESOLVE_CONTEXT_INACTIVE, From 68ceb5cea94d72e3ff6962d94037389b11990393 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:47 +0300 Subject: [PATCH 1176/2141] Revert "[nrf fromtree] net: dns: Properly cleanup DNS servers per network interface" This reverts commit 4ca5fae37bd240dd1175e8e57b5cef86cdd0c0a7. Signed-off-by: Jukka Rissanen --- include/zephyr/net/dns_resolve.h | 10 - subsys/net/ip/Kconfig.stack | 1 - subsys/net/ip/ipv6_nbr.c | 6 +- subsys/net/lib/dhcpv4/dhcpv4.c | 10 - subsys/net/lib/dhcpv6/dhcpv6.c | 10 - subsys/net/lib/dns/Kconfig | 13 - subsys/net/lib/dns/resolve.c | 479 +++++---------------- tests/net/lib/dns_addremove/src/main.c | 20 +- tests/net/lib/dns_addremove/testcase.yaml | 3 - tests/net/lib/dns_dispatcher/src/main.c | 7 +- tests/net/lib/dns_dispatcher/testcase.yaml | 6 - 11 files changed, 130 insertions(+), 435 deletions(-) diff --git a/include/zephyr/net/dns_resolve.h b/include/zephyr/net/dns_resolve.h index 05ee7154d1cb..49043bd1733b 100644 --- a/include/zephyr/net/dns_resolve.h +++ b/include/zephyr/net/dns_resolve.h @@ -550,16 +550,6 @@ int dns_resolve_reconfigure_with_interfaces(struct dns_resolve_context *ctx, const struct sockaddr *servers_sa[], int interfaces[]); -/** - * @brief Remove servers from the DNS resolving context. - * - * @param ctx DNS context - * @param if_index Network interface from which the DNS servers are removed. - * - * @return 0 if ok, <0 if error. - */ -int dns_resolve_remove(struct dns_resolve_context *ctx, int if_index); - /** * @brief Cancel a pending DNS query. * diff --git a/subsys/net/ip/Kconfig.stack b/subsys/net/ip/Kconfig.stack index ed8853d13942..c02fe47bafcd 100644 --- a/subsys/net/ip/Kconfig.stack +++ b/subsys/net/ip/Kconfig.stack @@ -17,7 +17,6 @@ config NET_TX_STACK_SIZE config NET_RX_STACK_SIZE int "RX thread stack size" - default 1792 if DNS_RESOLVER default 1500 help Set the RX thread stack size in bytes. The RX thread is waiting diff --git a/subsys/net/ip/ipv6_nbr.c b/subsys/net/ip/ipv6_nbr.c index 19a0405f6ea8..b64a73ed5378 100644 --- a/subsys/net/ip/ipv6_nbr.c +++ b/subsys/net/ip/ipv6_nbr.c @@ -2469,9 +2469,6 @@ static inline bool handle_ra_rdnss(struct net_pkt *pkt, uint8_t len) const struct sockaddr *dns_servers[] = { (struct sockaddr *)&dns, NULL }; - int interfaces[] = { - net_if_get_by_iface(net_pkt_iface(pkt)) - }; size_t rdnss_size; int ret; @@ -2508,8 +2505,7 @@ static inline bool handle_ra_rdnss(struct net_pkt *pkt, uint8_t len) /* TODO: Handle lifetime. */ ctx = dns_resolve_get_default(); - ret = dns_resolve_reconfigure_with_interfaces(ctx, NULL, dns_servers, - interfaces); + ret = dns_resolve_reconfigure(ctx, NULL, dns_servers); if (ret < 0) { NET_DBG("Failed to set RDNSS resolve address: %d", ret); } diff --git a/subsys/net/lib/dhcpv4/dhcpv4.c b/subsys/net/lib/dhcpv4/dhcpv4.c index c475b1fb4d26..6dedcab3cd90 100644 --- a/subsys/net/lib/dhcpv4/dhcpv4.c +++ b/subsys/net/lib/dhcpv4/dhcpv4.c @@ -1668,16 +1668,6 @@ static void dhcpv4_iface_event_handler(struct net_mgmt_event_callback *cb, if (!net_if_ipv4_addr_rm(iface, &iface->config.dhcpv4.requested_ip)) { NET_DBG("Failed to remove addr from iface"); } - - /* Remove DNS servers as interface is gone. We only need to - * do this for this interface. If using global setting, the - * DNS servers are removed automatically when the interface - * comes back up. - */ - if (IS_ENABLED(CONFIG_NET_DHCPV4_DNS_SERVER_VIA_INTERFACE)) { - dns_resolve_remove(dns_resolve_get_default(), - net_if_get_by_iface(iface)); - } } } else if (mgmt_event == NET_EVENT_IF_UP) { NET_DBG("Interface %p coming up", iface); diff --git a/subsys/net/lib/dhcpv6/dhcpv6.c b/subsys/net/lib/dhcpv6/dhcpv6.c index 2e1441b0331e..f5984273cc3d 100644 --- a/subsys/net/lib/dhcpv6/dhcpv6.c +++ b/subsys/net/lib/dhcpv6/dhcpv6.c @@ -2217,16 +2217,6 @@ static void dhcpv6_iface_event_handler(struct net_mgmt_event_callback *cb, if (mgmt_event == NET_EVENT_IF_DOWN) { NET_DBG("Interface %p going down", iface); dhcpv6_set_timeout(iface, UINT64_MAX); - - /* Remove DNS servers as interface is gone. We only need to - * do this for this interface. If using global setting, the - * DNS servers are removed automatically when the interface - * comes back up. - */ - if (IS_ENABLED(CONFIG_NET_DHCPV6_DNS_SERVER_VIA_INTERFACE)) { - dns_resolve_remove(dns_resolve_get_default(), - net_if_get_by_iface(iface)); - } } else if (mgmt_event == NET_EVENT_IF_UP) { NET_DBG("Interface %p coming up", iface); dhcpv6_enter_state(iface, NET_DHCPV6_INIT); diff --git a/subsys/net/lib/dns/Kconfig b/subsys/net/lib/dns/Kconfig index a413f04f6567..c3f3ba6bc998 100644 --- a/subsys/net/lib/dns/Kconfig +++ b/subsys/net/lib/dns/Kconfig @@ -121,19 +121,6 @@ config DNS_SERVER5 endif # DNS_SERVER_IP_ADDRESSES -config DNS_RECONFIGURE_CLEANUP - bool "Cleanup old DNS server entries when reconfiguring" - help - If calling dns_resolve_reconfigure() when new DNS servers - are being set, for example if receiving new ones from DHCP server, - remove the old entries before setting up the new ones. - If you have only one network interface, then this can be enabled. - If you have multiple network interfaces, then this should be disabled - because the later configuration update would remove the entries - set by the other network interface configuration. - The previous default in Zephyr 4.1 or earlier was to have this enabled. - The current default in Zephyr 4.2 is to disable this option. - config DNS_NUM_CONCUR_QUERIES int "Number of simultaneous DNS queries per one DNS context" default 1 diff --git a/subsys/net/lib/dns/resolve.c b/subsys/net/lib/dns/resolve.c index 234d48ba8435..447d0a783225 100644 --- a/subsys/net/lib/dns/resolve.c +++ b/subsys/net/lib/dns/resolve.c @@ -81,7 +81,6 @@ NET_BUF_POOL_DEFINE(dns_qname_pool, DNS_RESOLVER_BUF_CTR, DNS_CACHE_DEFINE(dns_cache, CONFIG_DNS_RESOLVER_CACHE_MAX_ENTRIES); #endif /* CONFIG_DNS_RESOLVER_CACHE */ -static K_MUTEX_DEFINE(lock); static int init_called; static struct dns_resolve_context dns_default_ctx; @@ -415,86 +414,12 @@ static int bind_to_iface(int sock, const struct sockaddr *addr, int if_index) return ret; } -static bool is_server_name_found(struct dns_resolve_context *ctx, - const char *server, size_t server_len, - const char *iface_str) -{ - ARRAY_FOR_EACH(ctx->servers, i) { - if (ctx->servers[i].dns_server.sa_family == AF_INET || - ctx->servers[i].dns_server.sa_family == AF_INET6) { - char addr_str[INET6_ADDRSTRLEN]; - size_t addr_len; - - if (net_addr_ntop(ctx->servers[i].dns_server.sa_family, - &net_sin(&ctx->servers[i].dns_server)->sin_addr, - addr_str, sizeof(addr_str)) < 0) { - continue; - } - - addr_len = strlen(addr_str); - if (addr_len != server_len || - strncmp(addr_str, server, server_len) != 0) { - continue; - } - - if (iface_str != NULL && ctx->servers[i].if_index > 0) { - char iface_name[IFNAMSIZ]; - - net_if_get_name(net_if_get_by_index( - ctx->servers[i].if_index), - iface_name, sizeof(iface_name)); - - if (strcmp(iface_name, iface_str) != 0) { - continue; - } - } - - return true; - } - } - - return false; -} - -static bool is_server_addr_found(struct dns_resolve_context *ctx, - const struct sockaddr *addr, - int if_index) -{ - ARRAY_FOR_EACH(ctx->servers, i) { - if (ctx->servers[i].dns_server.sa_family == addr->sa_family && - memcmp(&ctx->servers[i].dns_server, addr, - sizeof(ctx->servers[i].dns_server)) == 0) { - if (if_index == 0 || - (if_index > 0 && - ctx->servers[i].if_index != if_index)) { - continue; - } - - return true; - } - } - - return false; -} - -static int get_free_slot(struct dns_resolve_context *ctx) -{ - ARRAY_FOR_EACH(ctx->servers, i) { - if (ctx->servers[i].dns_server.sa_family == 0) { - return i; - } - } - - return -ENOENT; -} - /* Must be invoked with context lock held */ static int dns_resolve_init_locked(struct dns_resolve_context *ctx, const char *servers[], const struct sockaddr *servers_sa[], const struct net_socket_service_desc *svc, - uint16_t port, int interfaces[], - bool do_cleanup) + uint16_t port, int interfaces[]) { #if defined(CONFIG_NET_IPV6) struct sockaddr_in6 local_addr6 = { @@ -520,20 +445,17 @@ static int dns_resolve_init_locked(struct dns_resolve_context *ctx, return -ENOENT; } - if (do_cleanup) { - if (ctx->state != DNS_RESOLVE_CONTEXT_INACTIVE) { - ret = -ENOTEMPTY; - NET_DBG("DNS resolver context is not inactive (%d)", ctx->state); - goto fail; - } + if (ctx->state != DNS_RESOLVE_CONTEXT_INACTIVE) { + ret = -ENOTEMPTY; + goto fail; + } - ARRAY_FOR_EACH(ctx->servers, j) { - ctx->servers[j].sock = -1; - } + ARRAY_FOR_EACH(ctx->servers, j) { + ctx->servers[j].sock = -1; + } - ARRAY_FOR_EACH(ctx->fds, j) { - ctx->fds[j].fd = -1; - } + ARRAY_FOR_EACH(ctx->fds, j) { + ctx->fds[j].fd = -1; } /* If user has provided a list of servers in string format, then @@ -542,146 +464,78 @@ static int dns_resolve_init_locked(struct dns_resolve_context *ctx, * The interfaces parameter should point to an array that is the * the same length as the servers_sa parameter array. */ - for (i = 0; servers != NULL && idx < SERVER_COUNT && servers[i] != NULL; i++) { - const char *iface_str; - size_t server_len; - struct sockaddr *addr; - bool found; - - iface_str = strstr(servers[i], "%"); - if (iface_str != NULL) { - server_len = iface_str - servers[i]; - iface_str++; - - if (server_len == 0) { - NET_DBG("Empty server name"); - continue; - } - - found = is_server_name_found(ctx, servers[i], - server_len, iface_str); - if (found) { - NET_DBG("Server %.*s already exists", - (int)server_len, servers[i]); - continue; - } + if (servers) { + for (i = 0; idx < SERVER_COUNT && servers[i]; i++) { + const char *iface_str; + size_t server_len; - /* Figure out if there are free slots where to add - * the server. - */ - idx = get_free_slot(ctx); - if (idx < 0) { - NET_DBG("No free slots for server %.*s", - (int)server_len, servers[i]); - break; - } + struct sockaddr *addr = &ctx->servers[idx].dns_server; - /* Skip empty interface name */ - if (iface_str[0] == '\0') { - ctx->servers[idx].if_index = 0; - iface_str = NULL; - } else { - ctx->servers[idx].if_index = - net_if_get_by_name(iface_str); - } + iface_str = strstr(servers[i], "%"); + if (iface_str) { + server_len = iface_str - servers[i]; + iface_str++; - } else { - server_len = strlen(servers[i]); - if (server_len == 0) { - NET_DBG("Empty server name"); - continue; - } + if (server_len == 0) { + NET_DBG("Empty server name"); + continue; + } - found = is_server_name_found(ctx, servers[i], - server_len, NULL); - if (found) { - NET_DBG("Server %.*s already exists", - (int)server_len, servers[i]); - continue; - } + /* Skip empty interface name */ + if (iface_str[0] == '\0') { + ctx->servers[idx].if_index = 0; + iface_str = NULL; + } else { + ctx->servers[idx].if_index = + net_if_get_by_name(iface_str); + } - idx = get_free_slot(ctx); - if (idx < 0) { - NET_DBG("No free slots for server %.*s", - (int)server_len, servers[i]); - break; + } else { + server_len = strlen(servers[i]); + ctx->servers[idx].if_index = 0; } - } - addr = &ctx->servers[idx].dns_server; + (void)memset(addr, 0, sizeof(*addr)); - (void)memset(addr, 0, sizeof(*addr)); + ret = net_ipaddr_parse(servers[i], server_len, addr); + if (!ret) { + if (servers[i] != NULL && servers[i][0] != '\0') { + NET_DBG("Invalid server address %.*s", + (int)server_len, servers[i]); + } - ret = net_ipaddr_parse(servers[i], server_len, addr); - if (!ret) { - if (servers[i][0] != '\0') { - NET_DBG("Invalid server address %.*s", - (int)server_len, servers[i]); + continue; } - continue; - } - - dns_postprocess_server(ctx, idx); - - NET_DBG("[%d] %.*s%s%s%s%s", i, (int)server_len, servers[i], - IS_ENABLED(CONFIG_MDNS_RESOLVER) ? - (ctx->servers[i].is_mdns ? " mDNS" : "") : "", - IS_ENABLED(CONFIG_LLMNR_RESOLVER) ? - (ctx->servers[i].is_llmnr ? " LLMNR" : "") : "", - iface_str != NULL ? " via " : "", - iface_str != NULL ? iface_str : ""); - idx++; - } - - for (i = 0; servers_sa != NULL && idx < SERVER_COUNT && servers_sa[i] != NULL; i++) { - char iface_str[IFNAMSIZ] = { 0 }; - bool found; - - found = is_server_addr_found(ctx, servers_sa[i], interfaces[i]); - if (found) { - NET_DBG("Server %s already exists", - net_sprint_addr(ctx->servers[i].dns_server.sa_family, - &net_sin(&ctx->servers[i].dns_server)->sin_addr)); - continue; - } + dns_postprocess_server(ctx, idx); - /* Figure out if there are free slots where to add the server. - */ - idx = get_free_slot(ctx); - if (idx < 0) { - NET_DBG("No free slots for server %s", - net_sprint_addr(ctx->servers[i].dns_server.sa_family, - &net_sin(&ctx->servers[i].dns_server)->sin_addr)); - break; + NET_DBG("[%d] %.*s%s%s%s%s", i, (int)server_len, servers[i], + IS_ENABLED(CONFIG_MDNS_RESOLVER) ? + (ctx->servers[i].is_mdns ? " mDNS" : "") : "", + IS_ENABLED(CONFIG_LLMNR_RESOLVER) ? + (ctx->servers[i].is_llmnr ? " LLMNR" : "") : "", + iface_str != NULL ? " via " : "", + iface_str != NULL ? iface_str : ""); + idx++; } + } - memcpy(&ctx->servers[idx].dns_server, servers_sa[i], - sizeof(ctx->servers[idx].dns_server)); + if (servers_sa) { + for (i = 0; idx < SERVER_COUNT && servers_sa[i]; i++) { + memcpy(&ctx->servers[idx].dns_server, servers_sa[i], + sizeof(ctx->servers[idx].dns_server)); - if (interfaces != NULL) { - ctx->servers[idx].if_index = interfaces[i]; + if (interfaces != NULL) { + ctx->servers[idx].if_index = interfaces[idx]; + } - net_if_get_name(net_if_get_by_index(ctx->servers[idx].if_index), - iface_str, sizeof(iface_str)); + dns_postprocess_server(ctx, idx); + idx++; } - - dns_postprocess_server(ctx, idx); - - NET_DBG("[%d] %s%s%s%s%s", i, - net_sprint_addr(servers_sa[i]->sa_family, - &net_sin(servers_sa[i])->sin_addr), - IS_ENABLED(CONFIG_MDNS_RESOLVER) ? - (ctx->servers[i].is_mdns ? " mDNS" : "") : "", - IS_ENABLED(CONFIG_LLMNR_RESOLVER) ? - (ctx->servers[i].is_llmnr ? " LLMNR" : "") : "", - interfaces != NULL ? " via " : "", - interfaces != NULL ? iface_str : ""); - idx++; } for (i = 0, count = 0; - i < SERVER_COUNT && ctx->servers[i].dns_server.sa_family != 0; i++) { + i < SERVER_COUNT && ctx->servers[i].dns_server.sa_family; i++) { if (ctx->servers[i].dns_server.sa_family == AF_INET6) { #if defined(CONFIG_NET_IPV6) @@ -717,16 +571,6 @@ static int dns_resolve_init_locked(struct dns_resolve_context *ctx, goto fail; } - if (ctx->servers[i].sock >= 0) { - /* Socket already exists, so skip it */ - NET_DBG("Socket %d already exists for %s", - ctx->servers[i].sock, - net_sprint_addr(ctx->servers[i].dns_server.sa_family, - &net_sin(&ctx->servers[i].dns_server)->sin_addr)); - count++; - continue; - } - ret = zsock_socket(ctx->servers[i].dns_server.sa_family, SOCK_DGRAM, IPPROTO_UDP); if (ret < 0) { @@ -745,7 +589,6 @@ static int dns_resolve_init_locked(struct dns_resolve_context *ctx, if (ret < 0) { zsock_close(ctx->servers[i].sock); ctx->servers[i].sock = -1; - ctx->servers[i].dns_server.sa_family = 0; continue; } @@ -794,8 +637,6 @@ static int dns_resolve_init_locked(struct dns_resolve_context *ctx, if (ret < 0) { NET_DBG("Cannot set %s to socket (%d)", "polling", ret); zsock_close(ctx->servers[i].sock); - ctx->servers[i].sock = -1; - ctx->servers[i].dns_server.sa_family = 0; continue; } @@ -854,28 +695,20 @@ int dns_resolve_init_with_svc(struct dns_resolve_context *ctx, const char *serve const struct net_socket_service_desc *svc, uint16_t port, int interfaces[]) { - int ret; - if (!ctx) { return -ENOENT; } - k_mutex_lock(&lock, K_FOREVER); - - /* Do cleanup only if we are starting the context for the first time */ - if (init_called == 0) { - (void)memset(ctx, 0, sizeof(*ctx)); - - (void)k_mutex_init(&ctx->lock); - ctx->state = DNS_RESOLVE_CONTEXT_INACTIVE; - } - - ret = dns_resolve_init_locked(ctx, servers, servers_sa, svc, port, - interfaces, true); + (void)memset(ctx, 0, sizeof(*ctx)); - k_mutex_unlock(&lock); + (void)k_mutex_init(&ctx->lock); + ctx->state = DNS_RESOLVE_CONTEXT_INACTIVE; - return ret; + /* As this function is called only once during system init, there is no + * reason to acquire lock. + */ + return dns_resolve_init_locked(ctx, servers, servers_sa, svc, port, + interfaces); } int dns_resolve_init(struct dns_resolve_context *ctx, const char *servers[], @@ -1906,51 +1739,10 @@ int dns_resolve_name(struct dns_resolve_context *ctx, user_data, timeout, true); } -static int dns_server_close(struct dns_resolve_context *ctx, - int server_idx) -{ - struct net_if *iface; - - if (ctx->servers[server_idx].sock < 0) { - return -ENOENT; - } - - (void)dns_dispatcher_unregister(&ctx->servers[server_idx].dispatcher); - - if (ctx->servers[server_idx].dns_server.sa_family == AF_INET6) { - iface = net_if_ipv6_select_src_iface( - &net_sin6(&ctx->servers[server_idx].dns_server)->sin6_addr); - } else { - iface = net_if_ipv4_select_src_iface( - &net_sin(&ctx->servers[server_idx].dns_server)->sin_addr); - } - - if (IS_ENABLED(CONFIG_NET_MGMT_EVENT_INFO)) { - net_mgmt_event_notify_with_info( - NET_EVENT_DNS_SERVER_DEL, - iface, - (void *)&ctx->servers[server_idx].dns_server, - sizeof(struct sockaddr)); - } else { - net_mgmt_event_notify(NET_EVENT_DNS_SERVER_DEL, iface); - } - - zsock_close(ctx->servers[server_idx].sock); - - ctx->servers[server_idx].sock = -1; - ctx->servers[server_idx].dns_server.sa_family = 0; - - ARRAY_FOR_EACH(ctx->fds, j) { - ctx->fds[j].fd = -1; - } - - return 0; -} - /* Must be invoked with context lock held */ static int dns_resolve_close_locked(struct dns_resolve_context *ctx) { - int i, ret; + int i; if (ctx->state != DNS_RESOLVE_CONTEXT_ACTIVE) { return -ENOENT; @@ -1970,10 +1762,44 @@ static int dns_resolve_close_locked(struct dns_resolve_context *ctx) k_mutex_unlock(&ctx->lock); for (i = 0; i < SERVER_COUNT; i++) { - ret = dns_server_close(ctx, i); - if (ret < 0) { - NET_DBG("Cannot close DNS server %d (%d)", i, ret); + struct net_if *iface; + + if (ctx->servers[i].sock < 0) { + continue; + } + + (void)dns_dispatcher_unregister(&ctx->servers[i].dispatcher); + + if (ctx->servers[i].dns_server.sa_family == AF_INET6) { + iface = net_if_ipv6_select_src_iface( + &net_sin6(&ctx->servers[i].dns_server)->sin6_addr); + } else { + iface = net_if_ipv4_select_src_iface( + &net_sin(&ctx->servers[i].dns_server)->sin_addr); + } + + if (IS_ENABLED(CONFIG_NET_MGMT_EVENT_INFO)) { + net_mgmt_event_notify_with_info( + NET_EVENT_DNS_SERVER_DEL, + iface, + (void *)&ctx->servers[i].dns_server, + sizeof(struct sockaddr)); + } else { + net_mgmt_event_notify(NET_EVENT_DNS_SERVER_DEL, + iface); } + + zsock_close(ctx->servers[i].sock); + + ARRAY_FOR_EACH(ctx->fds, j) { + if (ctx->fds[j].fd == ctx->servers[i].sock) { + ctx->fds[j].fd = -1; + } + } + + (void)dns_dispatcher_unregister(&ctx->servers[i].dispatcher); + + ctx->servers[i].sock = -1; } if (--init_called <= 0) { @@ -2051,11 +1877,10 @@ static bool dns_servers_exists(struct dns_resolve_context *ctx, return true; } -static int do_dns_resolve_reconfigure(struct dns_resolve_context *ctx, - const char *servers[], - const struct sockaddr *servers_sa[], - int interfaces[], - bool do_close) +int dns_resolve_reconfigure_with_interfaces(struct dns_resolve_context *ctx, + const char *servers[], + const struct sockaddr *servers_sa[], + int interfaces[]) { int err; @@ -2063,7 +1888,6 @@ static int do_dns_resolve_reconfigure(struct dns_resolve_context *ctx, return -ENOENT; } - k_mutex_lock(&lock, K_FOREVER); k_mutex_lock(&ctx->lock, K_FOREVER); if (dns_servers_exists(ctx, servers, servers_sa)) { @@ -2077,99 +1901,32 @@ static int do_dns_resolve_reconfigure(struct dns_resolve_context *ctx, goto unlock; } - if (ctx->state == DNS_RESOLVE_CONTEXT_ACTIVE && - (do_close || init_called == 0)) { + if (ctx->state == DNS_RESOLVE_CONTEXT_ACTIVE) { dns_resolve_cancel_all(ctx); err = dns_resolve_close_locked(ctx); if (err) { goto unlock; } - - /* Make sure we do fresh start once */ - do_close = true; } err = dns_resolve_init_locked(ctx, servers, servers_sa, - &resolve_svc, 0, interfaces, - do_close); + &resolve_svc, 0, interfaces); unlock: k_mutex_unlock(&ctx->lock); - k_mutex_unlock(&lock); return err; } -int dns_resolve_reconfigure_with_interfaces(struct dns_resolve_context *ctx, - const char *servers[], - const struct sockaddr *servers_sa[], - int interfaces[]) -{ - return do_dns_resolve_reconfigure(ctx, - servers, - servers_sa, - interfaces, - IS_ENABLED(CONFIG_DNS_RECONFIGURE_CLEANUP) ? - true : false); -} - int dns_resolve_reconfigure(struct dns_resolve_context *ctx, const char *servers[], const struct sockaddr *servers_sa[]) { - return do_dns_resolve_reconfigure(ctx, - servers, - servers_sa, - NULL, - IS_ENABLED(CONFIG_DNS_RECONFIGURE_CLEANUP) ? - true : false); -} - -int dns_resolve_remove(struct dns_resolve_context *ctx, int if_index) -{ - int i; - int ret = -ENOENT; - int st = 0; - - if (!ctx) { - return -ENOENT; - } - - if (if_index <= 0) { - /* If network interface index is 0, then do nothing. - * If your want to remove all the servers, then just call - * dns_resolve_close() directly. - */ - return -EINVAL; - } - - k_mutex_lock(&ctx->lock, K_FOREVER); - - for (i = 0; i < SERVER_COUNT; i++) { - if (ctx->servers[i].if_index != if_index) { - continue; - } - - ctx->servers[i].if_index = 0; - - /* See comment in dns_resolve_close_locked() about - * releasing the lock before closing the server socket. - */ - k_mutex_unlock(&ctx->lock); - - ret = dns_server_close(ctx, i); - - k_mutex_lock(&ctx->lock, K_FOREVER); - - if (ret < 0) { - st = ret; - } - } - - k_mutex_unlock(&ctx->lock); - - return st; + return dns_resolve_reconfigure_with_interfaces(ctx, + servers, + servers_sa, + NULL); } struct dns_resolve_context *dns_resolve_get_default(void) diff --git a/tests/net/lib/dns_addremove/src/main.c b/tests/net/lib/dns_addremove/src/main.c index 3ff9bb2aabe2..eb8d25a5fa51 100644 --- a/tests/net/lib/dns_addremove/src/main.c +++ b/tests/net/lib/dns_addremove/src/main.c @@ -470,17 +470,15 @@ ZTEST(dns_addremove, test_dns_reconfigure_callback) zassert_equal(ret, 0, "Cannot reconfigure DNS server"); /* Wait for DNS removed callback after reconfiguring DNS */ - if (IS_ENABLED(CONFIG_DNS_RECONFIGURE_CLEANUP)) { - if (k_sem_take(&dns_removed, WAIT_TIME)) { - zassert_true(false, - "Timeout while waiting for DNS removed callback"); - } - - /* Wait for DNS added callback after reconfiguring DNS */ - if (k_sem_take(&dns_added, WAIT_TIME)) { - zassert_true(false, - "Timeout while waiting for DNS added callback"); - } + if (k_sem_take(&dns_removed, WAIT_TIME)) { + zassert_true(false, + "Timeout while waiting for DNS removed callback"); + } + + /* Wait for DNS added callback after reconfiguring DNS */ + if (k_sem_take(&dns_added, WAIT_TIME)) { + zassert_true(false, + "Timeout while waiting for DNS added callback"); } ret = dns_resolve_close(&resv_ipv4); diff --git a/tests/net/lib/dns_addremove/testcase.yaml b/tests/net/lib/dns_addremove/testcase.yaml index a6f56003f46b..5551a41cfbaa 100644 --- a/tests/net/lib/dns_addremove/testcase.yaml +++ b/tests/net/lib/dns_addremove/testcase.yaml @@ -14,6 +14,3 @@ tests: net.dns.no_ipv4: extra_configs: - CONFIG_NET_IPV4=n - net.dns.addremove.reconfigure_cleanup: - extra_configs: - - CONFIG_DNS_RECONFIGURE_CLEANUP=y diff --git a/tests/net/lib/dns_dispatcher/src/main.c b/tests/net/lib/dns_dispatcher/src/main.c index e0353e8ac1f7..21e604660666 100644 --- a/tests/net/lib/dns_dispatcher/src/main.c +++ b/tests/net/lib/dns_dispatcher/src/main.c @@ -175,14 +175,11 @@ static void *test_init(void) ZTEST(dns_dispatcher, test_dns_dispatcher) { struct dns_resolve_context *ctx; - int ret, sock1, sock2 = -1; + int sock1, sock2 = -1; ctx = dns_resolve_get_default(); - dns_resolve_close(ctx); - - ret = dns_resolve_init_default(ctx); - zassert_equal(ret, 0, "Cannot initialize DNS resolver (%d)", ret); + dns_resolve_init_default(ctx); sock1 = ctx->servers[0].sock; diff --git a/tests/net/lib/dns_dispatcher/testcase.yaml b/tests/net/lib/dns_dispatcher/testcase.yaml index b3ffd7c64795..314097ece661 100644 --- a/tests/net/lib/dns_dispatcher/testcase.yaml +++ b/tests/net/lib/dns_dispatcher/testcase.yaml @@ -8,9 +8,3 @@ common: tests: net.dns.dispatch: min_ram: 21 - net.dns.dispatch.ctx_cleanup: - extra_configs: - - CONFIG_DNS_RECONFIGURE_CLEANUP=y - net.dns.dispatch.ctx_no_cleanup: - extra_configs: - - CONFIG_DNS_RECONFIGURE_CLEANUP=n From 17092b47e9bcc1777cf811ccbe3237f268d0f114 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:47 +0300 Subject: [PATCH 1177/2141] Revert "[nrf fromtree] net: dhcpv6: Honor network interface for DNS servers" This reverts commit 564862d8c0479b1bb95aecd4e9864286ac83b239. Signed-off-by: Jukka Rissanen --- subsys/net/lib/dhcpv6/Kconfig | 17 ----------------- subsys/net/lib/dhcpv6/dhcpv6.c | 20 +------------------- 2 files changed, 1 insertion(+), 36 deletions(-) diff --git a/subsys/net/lib/dhcpv6/Kconfig b/subsys/net/lib/dhcpv6/Kconfig index 7fda850ec5ee..dad049dac77a 100644 --- a/subsys/net/lib/dhcpv6/Kconfig +++ b/subsys/net/lib/dhcpv6/Kconfig @@ -31,23 +31,6 @@ config NET_DHCPV6_OPTION_DNS_ADDRESS option from the server, and if available, use obtained information to configure DNS resolver. -config NET_DHCPV6_DNS_SERVER_VIA_INTERFACE - bool "Make DNS servers specific to the network interface" - depends on NET_DHCPV6_OPTION_DNS_ADDRESS - default y - help - If this is set, then if the system has multiple network interfaces - and each has DHCP enabled, then assign DNS servers received from that - network interface, to that specific interface. - If this option is not set, then any interface can be used for all - the configured DNS server addresses when doing DNS queries. - Example: We receive DNS server 2001:db8::1:53 DHCPv6 option from Wi-Fi - interface and DNS server 2001:db8::2:53 from Ethernet interface. - When this option is set, the DNS resolver will use DNS server - 2001:db8::1:53 when sending DNS query to the Wi-Fi interface and DNS - server 2001:db8::2:53 when sending DNS query to the Ethernet - interface. - if NET_DHCPV6 module = NET_DHCPV6 module-dep = NET_LOG diff --git a/subsys/net/lib/dhcpv6/dhcpv6.c b/subsys/net/lib/dhcpv6/dhcpv6.c index f5984273cc3d..29dd652d428c 100644 --- a/subsys/net/lib/dhcpv6/dhcpv6.c +++ b/subsys/net/lib/dhcpv6/dhcpv6.c @@ -1412,25 +1412,7 @@ static int dhcpv6_handle_dns_server_option(struct net_pkt *pkt) } ctx = dns_resolve_get_default(); - - if (IS_ENABLED(CONFIG_NET_DHCPV6_DNS_SERVER_VIA_INTERFACE)) { - /* If we are using the interface to resolve DNS servers, - * we need to save the interface index. - */ - int ifindex = net_if_get_by_iface(net_pkt_iface(pkt)); - int interfaces[MAX_DNS_SERVERS]; - - for (uint8_t i = 0; i < server_count; i++) { - interfaces[i] = ifindex; - } - - status = dns_resolve_reconfigure_with_interfaces(ctx, NULL, - dns_servers, - interfaces); - } else { - status = dns_resolve_reconfigure(ctx, NULL, dns_servers); - } - + status = dns_resolve_reconfigure(ctx, NULL, dns_servers); if (status < 0) { NET_DBG("Failed to reconfigure DNS resolver from DHCPv6 " "option: %d", status); From a790879e3bcea827a05550df647a5d359458497d Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:47 +0300 Subject: [PATCH 1178/2141] Revert "[nrf fromtree] net: dhcpv4: Honor network interface for DNS servers" This reverts commit feb37b6e1b4e4a8111b4d1a5689b587cc6240846. Signed-off-by: Jukka Rissanen --- subsys/net/lib/dhcpv4/Kconfig | 17 ----------------- subsys/net/lib/dhcpv4/dhcpv4.c | 20 +------------------- 2 files changed, 1 insertion(+), 36 deletions(-) diff --git a/subsys/net/lib/dhcpv4/Kconfig b/subsys/net/lib/dhcpv4/Kconfig index cf7603ae65a0..52dcfc099b56 100644 --- a/subsys/net/lib/dhcpv4/Kconfig +++ b/subsys/net/lib/dhcpv4/Kconfig @@ -96,23 +96,6 @@ config NET_DHCPV4_OPTION_PRINT_IGNORED received and ignored. If this is not set, then we print these as unknown options. -config NET_DHCPV4_DNS_SERVER_VIA_INTERFACE - bool "Make DNS servers specific to the network interface" - depends on NET_DHCPV4_OPTION_DNS_ADDRESS - default y - help - If this is set, then if the system has multiple network interfaces - and each has DHCP enabled, then assign DNS servers received from that - network interface, to that specific interface. - If this option is not set, then any interface can be used for all - the configured DNS server addresses when doing DNS queries. - Example: We receive DNS server 192.0.2.53 DHCPv4 option from Wi-Fi - interface and DNS server 198.51.100.53 from Ethernet interface. - When this option is set, the DNS resolver will use DNS server - 192.0.2.53 when sending DNS query to the Wi-Fi interface and DNS - server 198.51.100.53 when sending DNS query to the Ethernet - interface. - endif # NET_DHCPV4 config NET_DHCPV4_SERVER diff --git a/subsys/net/lib/dhcpv4/dhcpv4.c b/subsys/net/lib/dhcpv4/dhcpv4.c index 6dedcab3cd90..f7d7447b27dc 100644 --- a/subsys/net/lib/dhcpv4/dhcpv4.c +++ b/subsys/net/lib/dhcpv4/dhcpv4.c @@ -1171,25 +1171,7 @@ static bool dhcpv4_parse_options(struct net_pkt *pkt, for (uint8_t i = 0; i < dns_servers_cnt; i++) { dnses[i].sin_family = AF_INET; } - - if (IS_ENABLED(CONFIG_NET_DHCPV4_DNS_SERVER_VIA_INTERFACE)) { - /* If we are using the interface to resolve DNS servers, - * we need to save the interface index. - */ - int ifindex = net_if_get_by_iface(iface); - int interfaces[MAX_DNS_SERVERS]; - - for (uint8_t i = 0; i < dns_servers_cnt; i++) { - interfaces[i] = ifindex; - } - - status = dns_resolve_reconfigure_with_interfaces(ctx, NULL, - dns_servers, - interfaces); - } else { - status = dns_resolve_reconfigure(ctx, NULL, dns_servers); - } - + status = dns_resolve_reconfigure(ctx, NULL, dns_servers); if (status < 0) { NET_DBG("options_dns, failed to set " "resolve address: %d", status); From a0f5caa7cb5f968fbbe852b610e706926bfcd6b2 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:47 +0300 Subject: [PATCH 1179/2141] Revert "[nrf fromtree] net: dns: Allow reconfiguration with network interfaces" This reverts commit 2dd096115023603c781939e2a4dfb2ea4be3fdc0. Signed-off-by: Jukka Rissanen --- include/zephyr/net/dns_resolve.h | 26 -------------------------- subsys/net/lib/dns/resolve.c | 20 ++++---------------- 2 files changed, 4 insertions(+), 42 deletions(-) diff --git a/include/zephyr/net/dns_resolve.h b/include/zephyr/net/dns_resolve.h index 49043bd1733b..3413a0083958 100644 --- a/include/zephyr/net/dns_resolve.h +++ b/include/zephyr/net/dns_resolve.h @@ -524,32 +524,6 @@ int dns_resolve_reconfigure(struct dns_resolve_context *ctx, const char *servers_str[], const struct sockaddr *servers_sa[]); -/** - * @brief Reconfigure DNS resolving context with new server list and - * allowing servers to be specified to a specific network interface. - * - * @param ctx DNS context - * @param servers_str DNS server addresses using textual strings. The - * array is NULL terminated. The port number can be given in the string. - * Syntax for the server addresses with or without port numbers: - * IPv4 : 10.0.9.1 - * IPv4 + port : 10.0.9.1:5353 - * IPv6 : 2001:db8::22:42 - * IPv6 + port : [2001:db8::22:42]:5353 - * @param servers_sa DNS server addresses as struct sockaddr. The array - * is NULL terminated. Port numbers are optional in struct sockaddr, the - * default will be used if set to 0. - * @param interfaces Network interfaces to which the DNS servers are bound. - * This is an array of network interface indices. The array must be - * the same length as the servers_str and servers_sa arrays. - * - * @return 0 if ok, <0 if error. - */ -int dns_resolve_reconfigure_with_interfaces(struct dns_resolve_context *ctx, - const char *servers_str[], - const struct sockaddr *servers_sa[], - int interfaces[]); - /** * @brief Cancel a pending DNS query. * diff --git a/subsys/net/lib/dns/resolve.c b/subsys/net/lib/dns/resolve.c index 447d0a783225..813b7cd8f6c4 100644 --- a/subsys/net/lib/dns/resolve.c +++ b/subsys/net/lib/dns/resolve.c @@ -1877,10 +1877,9 @@ static bool dns_servers_exists(struct dns_resolve_context *ctx, return true; } -int dns_resolve_reconfigure_with_interfaces(struct dns_resolve_context *ctx, - const char *servers[], - const struct sockaddr *servers_sa[], - int interfaces[]) +int dns_resolve_reconfigure(struct dns_resolve_context *ctx, + const char *servers[], + const struct sockaddr *servers_sa[]) { int err; @@ -1910,8 +1909,7 @@ int dns_resolve_reconfigure_with_interfaces(struct dns_resolve_context *ctx, } } - err = dns_resolve_init_locked(ctx, servers, servers_sa, - &resolve_svc, 0, interfaces); + err = dns_resolve_init_locked(ctx, servers, servers_sa, &resolve_svc, 0, NULL); unlock: k_mutex_unlock(&ctx->lock); @@ -1919,16 +1917,6 @@ int dns_resolve_reconfigure_with_interfaces(struct dns_resolve_context *ctx, return err; } -int dns_resolve_reconfigure(struct dns_resolve_context *ctx, - const char *servers[], - const struct sockaddr *servers_sa[]) -{ - return dns_resolve_reconfigure_with_interfaces(ctx, - servers, - servers_sa, - NULL); -} - struct dns_resolve_context *dns_resolve_get_default(void) { return &dns_default_ctx; From b4e973c027391db435c8f4966b32e6ff34535c61 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:47 +0300 Subject: [PATCH 1180/2141] Revert "[nrf fromtree] drivers: udc_dwc2: Fix incomplete iso handling race" This reverts commit 424f0f92b93334678d77e3ccb22d307c3cd2e6c5. Signed-off-by: Jukka Rissanen --- drivers/usb/udc/udc_dwc2.c | 98 ++++++++++---------------------------- 1 file changed, 24 insertions(+), 74 deletions(-) diff --git a/drivers/usb/udc/udc_dwc2.c b/drivers/usb/udc/udc_dwc2.c index 4ef5dc1825cb..599dfcd8b5d7 100644 --- a/drivers/usb/udc/udc_dwc2.c +++ b/drivers/usb/udc/udc_dwc2.c @@ -141,7 +141,6 @@ struct udc_dwc2_data { unsigned int enumdone : 1; unsigned int enumspd : 2; unsigned int pending_dout_feed : 1; - unsigned int ignore_ep0_nakeff : 1; enum dwc2_suspend_type suspend_type; /* Number of endpoints including control endpoint */ uint8_t numdeveps; @@ -486,6 +485,7 @@ static int dwc2_tx_fifo_write(const struct device *dev, mem_addr_t dieptsiz_reg = (mem_addr_t)&base->in_ep[ep_idx].dieptsiz; /* TODO: use dwc2_get_dxepctl_reg() */ mem_addr_t diepctl_reg = (mem_addr_t)&base->in_ep[ep_idx].diepctl; + mem_addr_t diepint_reg = (mem_addr_t)&base->in_ep[ep_idx].diepint; uint32_t diepctl; uint32_t max_xfersize, max_pktcnt, pktcnt; @@ -617,6 +617,9 @@ static int dwc2_tx_fifo_write(const struct device *dev, } sys_write32(diepctl, diepctl_reg); + /* Clear IN Endpoint NAK Effective interrupt in case it was set */ + sys_write32(USB_DWC2_DIEPINT_INEPNAKEFF, diepint_reg); + if (dwc2_in_completer_mode(dev)) { const uint8_t *src = buf->data; @@ -808,20 +811,7 @@ static void dwc2_handle_xfer_next(const struct device *dev, if (USB_EP_DIR_IS_OUT(cfg->addr)) { dwc2_prep_rx(dev, buf, cfg); } else { - int err; - - if (cfg->addr == USB_CONTROL_EP_IN && - udc_ctrl_stage_is_status_in(dev)) { - /* It was observed that EPENA results in INEPNAKEFF - * interrupt which leads to endpoint disable. It is not - * clear how to prevent this without violating sequence - * described in Programming Guide, so just set a flag - * for interrupt handler to ignore it. - */ - priv->ignore_ep0_nakeff = 1; - } - - err = dwc2_tx_fifo_write(dev, cfg, buf); + int err = dwc2_tx_fifo_write(dev, cfg, buf); if (cfg->addr == USB_CONTROL_EP_IN) { /* Feed a buffer for the next setup packet after arming @@ -872,7 +862,6 @@ static int dwc2_handle_evt_setup(const struct device *dev) * transfer beforehand. In Buffer DMA the SETUP can be copied to any EP0 * OUT buffer. If there is any buffer queued, it is obsolete now. */ - priv->ignore_ep0_nakeff = 0; udc_dwc2_ep_disable(dev, cfg_in, false, true); atomic_and(&priv->xfer_finished, ~(BIT(0) | BIT(16))); @@ -2669,21 +2658,7 @@ static inline void dwc2_handle_iepint(const struct device *dev) } if (status & USB_DWC2_DIEPINT_INEPNAKEFF) { - uint32_t diepctl = sys_read32(diepctl_reg); - - if (!(diepctl & USB_DWC2_DEPCTL_NAKSTS)) { - /* Ignore stale NAK effective interrupt */ - } else if (n == 0 && priv->ignore_ep0_nakeff) { - /* Status stage enabled endpoint. NAK will be - * cleared in STSPHSERCVD interrupt. - */ - } else if (diepctl & USB_DWC2_DEPCTL_EPENA) { - diepctl &= ~USB_DWC2_DEPCTL_EPENA; - diepctl |= USB_DWC2_DEPCTL_EPDIS; - sys_write32(diepctl, diepctl_reg); - } else if (priv->iso_in_rearm & (BIT(n))) { - priv->iso_in_rearm &= ~BIT(n); - } + sys_set_bits(diepctl_reg, USB_DWC2_DEPCTL_EPDIS); } if (status & USB_DWC2_DIEPINT_EPDISBLD) { @@ -2701,13 +2676,6 @@ static inline void dwc2_handle_iepint(const struct device *dev) if ((usb_dwc2_get_depctl_eptype(diepctl) == USB_DWC2_DEPCTL_EPTYPE_ISO) && (priv->iso_in_rearm & BIT(n))) { struct udc_ep_config *cfg = udc_get_ep_cfg(dev, n | USB_EP_DIR_IN); - struct net_buf *buf; - - /* Data is no longer relevant, discard it */ - buf = udc_buf_get(cfg); - if (buf) { - udc_submit_ep_event(dev, buf, 0); - } /* Try to queue next packet before SOF */ dwc2_handle_xfer_next(dev, cfg); @@ -2869,17 +2837,9 @@ static inline void dwc2_handle_oepint(const struct device *dev) if ((usb_dwc2_get_depctl_eptype(doepctl) == USB_DWC2_DEPCTL_EPTYPE_ISO) && (priv->iso_out_rearm & BIT(n))) { struct udc_ep_config *cfg; - struct net_buf *buf; - - cfg = udc_get_ep_cfg(dev, n | USB_EP_DIR_OUT); - - /* Discard disabled transfer buffer */ - buf = udc_buf_get(cfg); - if (buf) { - udc_submit_ep_event(dev, buf, 0); - } /* Try to queue next packet before SOF */ + cfg = udc_get_ep_cfg(dev, n | USB_EP_DIR_OUT); dwc2_handle_xfer_next(dev, cfg); priv->iso_out_rearm &= ~BIT(n); @@ -2923,6 +2883,7 @@ static void dwc2_handle_incompisoin(const struct device *dev) /* Check if endpoint didn't receive ISO IN data */ if ((diepctl & mask) == val) { struct udc_ep_config *cfg; + struct net_buf *buf; cfg = udc_get_ep_cfg(dev, i | USB_EP_DIR_IN); __ASSERT_NO_MSG(cfg && cfg->stat.enabled && @@ -2930,7 +2891,13 @@ static void dwc2_handle_incompisoin(const struct device *dev) udc_dwc2_ep_disable(dev, cfg, false, false); - rearm |= BIT(i); + buf = udc_buf_get(cfg); + if (buf) { + /* Data is no longer relevant */ + udc_submit_ep_event(dev, buf, 0); + + rearm |= BIT(i); + } } eps &= ~BIT(i); @@ -2973,6 +2940,7 @@ static void dwc2_handle_incompisoout(const struct device *dev) /* Check if endpoint didn't receive ISO OUT data */ if ((doepctl & mask) == val) { struct udc_ep_config *cfg; + struct net_buf *buf; cfg = udc_get_ep_cfg(dev, i); __ASSERT_NO_MSG(cfg && cfg->stat.enabled && @@ -2980,7 +2948,12 @@ static void dwc2_handle_incompisoout(const struct device *dev) udc_dwc2_ep_disable(dev, cfg, false, false); - rearm |= BIT(i); + buf = udc_buf_get(cfg); + if (buf) { + udc_submit_ep_event(dev, buf, 0); + + rearm |= BIT(i); + } } eps &= ~BIT(i); @@ -3011,31 +2984,8 @@ static void dwc2_handle_goutnakeff(const struct device *dev) doepctl_reg = (mem_addr_t)&base->out_ep[ep_idx].doepctl; doepctl = sys_read32(doepctl_reg); - if (!(doepctl & USB_DWC2_DEPCTL_EPENA)) { - /* While endpoint was enabled when application requested - * to disable it, there is a race window between setting - * DCTL SGOUTNAK bit and it becoming effective. During - * the window, it is possible for host to actually send - * OUT DATA packet ending the transfer which disables - * the endpoint. - * - * If we arrived here due to INCOMPISOOUT, clearing - * the rearm flag is enough. - */ - if (priv->iso_out_rearm & BIT(ep_idx)) { - priv->iso_out_rearm &= ~BIT(ep_idx); - } - - /* If application requested STALL then set it here, but - * otherwise there's nothing to do. - */ - if (!(priv->ep_out_stall & BIT(ep_idx))) { - continue; - } - } else if (ep_idx != 0) { - /* Only set EPDIS if EPENA is set, but do not set it for - * endpoint 0 which cannot be disabled by application. - */ + /* The application cannot disable control OUT endpoint 0. */ + if (ep_idx != 0) { doepctl |= USB_DWC2_DEPCTL_EPDIS; } From 26b6084d0876deea9b380dfde2ddfdbe71ab4e46 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:47 +0300 Subject: [PATCH 1181/2141] Revert "[nrf fromtree] drivers: udc_dwc2: Rearm isochronous OUT endpoints during incompisoout" This reverts commit b04c3d73d9b44d3db3f82102a4a36753a942bca9. Signed-off-by: Jukka Rissanen --- drivers/usb/udc/udc_dwc2.c | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/drivers/usb/udc/udc_dwc2.c b/drivers/usb/udc/udc_dwc2.c index 599dfcd8b5d7..fca8f607ec74 100644 --- a/drivers/usb/udc/udc_dwc2.c +++ b/drivers/usb/udc/udc_dwc2.c @@ -121,7 +121,6 @@ struct udc_dwc2_data { /* Isochronous endpoint enabled (IN on bits 0-15, OUT on bits 16-31) */ uint32_t iso_enabled; uint16_t iso_in_rearm; - uint16_t iso_out_rearm; uint16_t ep_out_disable; uint16_t ep_out_stall; uint16_t txf_set; @@ -2777,7 +2776,6 @@ static inline void dwc2_handle_oepint(const struct device *dev) while (epint) { uint8_t n = find_lsb_set(epint) - 1; mem_addr_t doepint_reg = (mem_addr_t)&base->out_ep[n].doepint; - mem_addr_t doepctl_reg = (mem_addr_t)&base->out_ep[n].doepctl; uint32_t doepint; uint32_t status; @@ -2830,20 +2828,7 @@ static inline void dwc2_handle_oepint(const struct device *dev) } if (status & USB_DWC2_DOEPINT_EPDISBLD) { - uint32_t doepctl = sys_read32(doepctl_reg); - k_event_post(&priv->ep_disabled, BIT(16 + n)); - - if ((usb_dwc2_get_depctl_eptype(doepctl) == USB_DWC2_DEPCTL_EPTYPE_ISO) && - (priv->iso_out_rearm & BIT(n))) { - struct udc_ep_config *cfg; - - /* Try to queue next packet before SOF */ - cfg = udc_get_ep_cfg(dev, n | USB_EP_DIR_OUT); - dwc2_handle_xfer_next(dev, cfg); - - priv->iso_out_rearm &= ~BIT(n); - } } epint &= ~BIT(n); @@ -2928,7 +2913,6 @@ static void dwc2_handle_incompisoout(const struct device *dev) ((priv->sof_num & 1) ? USB_DWC2_DEPCTL_DPID : 0) | USB_DWC2_DEPCTL_USBACTEP; uint32_t eps = (priv->iso_enabled & 0xFFFF0000UL) >> 16; - uint16_t rearm = 0; while (eps) { uint8_t i = find_lsb_set(eps) - 1; @@ -2951,17 +2935,12 @@ static void dwc2_handle_incompisoout(const struct device *dev) buf = udc_buf_get(cfg); if (buf) { udc_submit_ep_event(dev, buf, 0); - - rearm |= BIT(i); } } eps &= ~BIT(i); } - /* Mark endpoints to re-arm in EPDISBLD handler */ - priv->iso_out_rearm = rearm; - sys_write32(USB_DWC2_GINTSTS_INCOMPISOOUT, gintsts_reg); } From 073d405aa55a0ff7579ffc0f408013f38e19becd Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:47 +0300 Subject: [PATCH 1182/2141] Revert "[nrf fromtree] usb: device_next: uac2: Double buffering on feedback endpoint" This reverts commit 594ae1ce8da1737d8e5f3e4c95cbf65f4918cf46. Signed-off-by: Jukka Rissanen --- subsys/usb/device_next/class/usbd_uac2.c | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/subsys/usb/device_next/class/usbd_uac2.c b/subsys/usb/device_next/class/usbd_uac2.c index 3a53b5c5d217..945970c18c51 100644 --- a/subsys/usb/device_next/class/usbd_uac2.c +++ b/subsys/usb/device_next/class/usbd_uac2.c @@ -29,7 +29,7 @@ LOG_MODULE_REGISTER(usbd_uac2, CONFIG_USBD_UAC2_LOG_LEVEL); + AS_HAS_ISOCHRONOUS_DATA_ENDPOINT(node) \ + AS_IS_USB_ISO_IN(node) /* ISO IN double buffering */ \ + AS_IS_USB_ISO_OUT(node) /* ISO OUT double buffering */ \ - + 2 * AS_HAS_EXPLICIT_FEEDBACK_ENDPOINT(node))) + + AS_HAS_EXPLICIT_FEEDBACK_ENDPOINT(node))) #define COUNT_UAC2_EP_BUFFERS(i) \ + DT_PROP(DT_DRV_INST(i), interrupt_endpoint) \ DT_INST_FOREACH_CHILD(i, COUNT_UAC2_AS_ENDPOINT_BUFFERS) @@ -88,7 +88,6 @@ struct uac2_ctx { atomic_t as_queued; atomic_t as_double; uint32_t fb_queued; - uint32_t fb_double; }; /* UAC2 device constant data */ @@ -442,11 +441,7 @@ static void write_explicit_feedback(struct usbd_class_data *const c_data, LOG_ERR("Failed to enqueue net_buf for 0x%02x", ep); net_buf_unref(buf); } else { - if (ctx->fb_queued & BIT(as_idx)) { - ctx->fb_double |= BIT(as_idx); - } else { - ctx->fb_queued |= BIT(as_idx); - } + ctx->fb_queued |= BIT(as_idx); } } @@ -818,17 +813,7 @@ static int uac2_request(struct usbd_class_data *const c_data, struct net_buf *bu terminal = cfg->as_terminals[as_idx]; if (is_feedback) { - bool clear_double = buf->frags; - - if (ctx->fb_queued & BIT(as_idx)) { - ctx->fb_queued &= ~BIT(as_idx); - } else { - clear_double = true; - } - - if (clear_double) { - ctx->fb_double &= ~BIT(as_idx); - } + ctx->fb_queued &= ~BIT(as_idx); } else if (!atomic_test_and_clear_bit(&ctx->as_queued, as_idx) || buf->frags) { atomic_clear_bit(&ctx->as_double, as_idx); } @@ -895,7 +880,7 @@ static void uac2_sof(struct usbd_class_data *const c_data) * for now to allow faster recovery (i.e. reduce workload to be * done during this frame). */ - if (ctx->fb_queued & ctx->fb_double & BIT(as_idx)) { + if (ctx->fb_queued & BIT(as_idx)) { continue; } From b15c457fc04c9baa6c26c41810cade6b932e9408 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:47 +0300 Subject: [PATCH 1183/2141] Revert "[nrf fromtree] usb: device_next: uac2: Do not leak buffer on failed enqueue" This reverts commit d7181027a06dc72738383cb1ff38ace206d06db3. Signed-off-by: Jukka Rissanen --- subsys/usb/device_next/class/usbd_uac2.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/subsys/usb/device_next/class/usbd_uac2.c b/subsys/usb/device_next/class/usbd_uac2.c index 945970c18c51..00a8fa5b826c 100644 --- a/subsys/usb/device_next/class/usbd_uac2.c +++ b/subsys/usb/device_next/class/usbd_uac2.c @@ -399,8 +399,6 @@ static void schedule_iso_out_read(struct usbd_class_data *const c_data, if (ret) { LOG_ERR("Failed to enqueue net_buf for 0x%02x", ep); net_buf_unref(buf); - ctx->ops->data_recv_cb(dev, terminal, - data_buf, 0, ctx->user_data); atomic_clear_bit(queued_bits, as_idx); } } From 7aa24b0b9892bb32e670328f682e27f5a5228b19 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:47 +0300 Subject: [PATCH 1184/2141] Revert "[nrf fromtree] usb: device_next: uac2: Double buffering on data OUT endpoints" This reverts commit bd9592bb773cc04dfc7e1b848ff95c152363fa34. Signed-off-by: Jukka Rissanen --- subsys/usb/device_next/class/usbd_uac2.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/subsys/usb/device_next/class/usbd_uac2.c b/subsys/usb/device_next/class/usbd_uac2.c index 00a8fa5b826c..0b08673abd24 100644 --- a/subsys/usb/device_next/class/usbd_uac2.c +++ b/subsys/usb/device_next/class/usbd_uac2.c @@ -28,7 +28,6 @@ LOG_MODULE_REGISTER(usbd_uac2, CONFIG_USBD_UAC2_LOG_LEVEL); IF_ENABLED(DT_NODE_HAS_COMPAT(node, zephyr_uac2_audio_streaming), ( \ + AS_HAS_ISOCHRONOUS_DATA_ENDPOINT(node) \ + AS_IS_USB_ISO_IN(node) /* ISO IN double buffering */ \ - + AS_IS_USB_ISO_OUT(node) /* ISO OUT double buffering */ \ + AS_HAS_EXPLICIT_FEEDBACK_ENDPOINT(node))) #define COUNT_UAC2_EP_BUFFERS(i) \ + DT_PROP(DT_DRV_INST(i), interrupt_endpoint) \ @@ -349,7 +348,6 @@ static void schedule_iso_out_read(struct usbd_class_data *const c_data, const struct uac2_cfg *cfg = dev->config; struct uac2_ctx *ctx = dev->data; struct net_buf *buf; - atomic_t *queued_bits = &ctx->as_queued; void *data_buf; int as_idx = terminal_to_as_interface(dev, terminal); int ret; @@ -366,19 +364,16 @@ static void schedule_iso_out_read(struct usbd_class_data *const c_data, return; } - if (atomic_test_and_set_bit(queued_bits, as_idx)) { - queued_bits = &ctx->as_double; - if (atomic_test_and_set_bit(queued_bits, as_idx)) { - /* Transfer already double queued - nothing to do */ - return; - } + if (atomic_test_and_set_bit(&ctx->as_queued, as_idx)) { + /* Transfer already queued - do not requeue */ + return; } /* Prepare transfer to read audio OUT data from host */ data_buf = ctx->ops->get_recv_buf(dev, terminal, mps, ctx->user_data); if (!data_buf) { LOG_ERR("No data buffer for terminal %d", terminal); - atomic_clear_bit(queued_bits, as_idx); + atomic_clear_bit(&ctx->as_queued, as_idx); return; } @@ -391,7 +386,7 @@ static void schedule_iso_out_read(struct usbd_class_data *const c_data, */ ctx->ops->data_recv_cb(dev, terminal, data_buf, 0, ctx->user_data); - atomic_clear_bit(queued_bits, as_idx); + atomic_clear_bit(&ctx->as_queued, as_idx); return; } @@ -399,7 +394,7 @@ static void schedule_iso_out_read(struct usbd_class_data *const c_data, if (ret) { LOG_ERR("Failed to enqueue net_buf for 0x%02x", ep); net_buf_unref(buf); - atomic_clear_bit(queued_bits, as_idx); + atomic_clear_bit(&ctx->as_queued, as_idx); } } @@ -819,10 +814,6 @@ static int uac2_request(struct usbd_class_data *const c_data, struct net_buf *bu if (USB_EP_DIR_IS_OUT(ep)) { ctx->ops->data_recv_cb(dev, terminal, buf->__buf, buf->len, ctx->user_data); - if (buf->frags) { - ctx->ops->data_recv_cb(dev, terminal, buf->frags->__buf, - buf->frags->len, ctx->user_data); - } } else if (!is_feedback) { ctx->ops->buf_release_cb(dev, terminal, buf->__buf, ctx->user_data); if (buf->frags) { From dccc9ca0b404330488e13fb9282edc9b83d391b2 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:47 +0300 Subject: [PATCH 1185/2141] Revert "[nrf fromtree] usb: device_next: uac2: Remove unnecessary plus signs" This reverts commit 102db0ae7a983108ce5cb012560dfd3fc4788986. Signed-off-by: Jukka Rissanen --- subsys/usb/device_next/class/usbd_uac2.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/subsys/usb/device_next/class/usbd_uac2.c b/subsys/usb/device_next/class/usbd_uac2.c index 0b08673abd24..efa3fd6cdf32 100644 --- a/subsys/usb/device_next/class/usbd_uac2.c +++ b/subsys/usb/device_next/class/usbd_uac2.c @@ -26,9 +26,9 @@ LOG_MODULE_REGISTER(usbd_uac2, CONFIG_USBD_UAC2_LOG_LEVEL); #define COUNT_UAC2_AS_ENDPOINT_BUFFERS(node) \ IF_ENABLED(DT_NODE_HAS_COMPAT(node, zephyr_uac2_audio_streaming), ( \ - + AS_HAS_ISOCHRONOUS_DATA_ENDPOINT(node) \ - + AS_IS_USB_ISO_IN(node) /* ISO IN double buffering */ \ - + AS_HAS_EXPLICIT_FEEDBACK_ENDPOINT(node))) + + AS_HAS_ISOCHRONOUS_DATA_ENDPOINT(node) + \ + + AS_IS_USB_ISO_IN(node) /* ISO IN double buffering */ + \ + AS_HAS_EXPLICIT_FEEDBACK_ENDPOINT(node))) #define COUNT_UAC2_EP_BUFFERS(i) \ + DT_PROP(DT_DRV_INST(i), interrupt_endpoint) \ DT_INST_FOREACH_CHILD(i, COUNT_UAC2_AS_ENDPOINT_BUFFERS) From 4c305bed787792e948d7e24781387748fdad7443 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:47 +0300 Subject: [PATCH 1186/2141] Revert "[nrf fromtree] usb: device_next: hid: Fix endpoint address getters" This reverts commit b000e11ccf58bacf48f189177d79ffc2297f66de. Signed-off-by: Jukka Rissanen --- subsys/usb/device_next/class/usbd_hid.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/subsys/usb/device_next/class/usbd_hid.c b/subsys/usb/device_next/class/usbd_hid.c index d978aea0d27c..d5476a88ed69 100644 --- a/subsys/usb/device_next/class/usbd_hid.c +++ b/subsys/usb/device_next/class/usbd_hid.c @@ -84,29 +84,19 @@ struct hid_device_data { static inline uint8_t hid_get_in_ep(struct usbd_class_data *const c_data) { - struct usbd_context *uds_ctx = usbd_class_get_ctx(c_data); const struct device *dev = usbd_class_get_private(c_data); const struct hid_device_config *dcfg = dev->config; struct usbd_hid_descriptor *desc = dcfg->desc; - if (USBD_SUPPORTS_HIGH_SPEED && usbd_bus_speed(uds_ctx) == USBD_SPEED_HS) { - return desc->hs_in_ep.bEndpointAddress; - } - return desc->in_ep.bEndpointAddress; } static inline uint8_t hid_get_out_ep(struct usbd_class_data *const c_data) { - struct usbd_context *uds_ctx = usbd_class_get_ctx(c_data); const struct device *dev = usbd_class_get_private(c_data); const struct hid_device_config *dcfg = dev->config; struct usbd_hid_descriptor *desc = dcfg->desc; - if (USBD_SUPPORTS_HIGH_SPEED && usbd_bus_speed(uds_ctx) == USBD_SPEED_HS) { - return desc->hs_out_ep.bEndpointAddress; - } - return desc->out_ep.bEndpointAddress; } From f83130e69a0bae46cf6d80fafdc2b3bcd63cbb87 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:47 +0300 Subject: [PATCH 1187/2141] Revert "[nrf fromtree] samples: usb: uac2: implicit: Stop processing micophone data" This reverts commit cd96efdf9c5ce474cbb592c17aa39c6cc47a83e2. Signed-off-by: Jukka Rissanen --- samples/subsys/usb/uac2_implicit_feedback/src/main.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/samples/subsys/usb/uac2_implicit_feedback/src/main.c b/samples/subsys/usb/uac2_implicit_feedback/src/main.c index 12abdf4fe681..b7720fe03317 100644 --- a/samples/subsys/usb/uac2_implicit_feedback/src/main.c +++ b/samples/subsys/usb/uac2_implicit_feedback/src/main.c @@ -93,7 +93,6 @@ static void uac2_terminal_update_cb(const struct device *dev, uint8_t terminal, !ctx->microphone_enabled) { i2s_trigger(ctx->i2s_dev, I2S_DIR_BOTH, I2S_TRIGGER_DROP); ctx->i2s_started = false; - ctx->rx_started = false; ctx->i2s_counter = 0; ctx->plus_ones = ctx->minus_ones = 0; if (ctx->pending_mic_samples) { @@ -173,7 +172,6 @@ static void uac2_data_recv_cb(const struct device *dev, uint8_t terminal, ret = i2s_write(ctx->i2s_dev, buf, size); if (ret < 0) { ctx->i2s_started = false; - ctx->rx_started = false; ctx->i2s_counter = 0; ctx->plus_ones = ctx->minus_ones = 0; if (ctx->pending_mic_samples) { From ece59270bf3710068a065ff3e2434ebfb8c0f060 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:48 +0300 Subject: [PATCH 1188/2141] Revert "[nrf fromlist] tests: drivers: pwm_gpio_loopback: Add more channels" This reverts commit 9fd04855d0ec375e7608cb4fc76351505be06640. Signed-off-by: Jukka Rissanen --- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 32 +++++++------------ .../boards/nrf54l15dk_nrf54l15_cpuapp.overlay | 30 ++--------------- 2 files changed, 14 insertions(+), 48 deletions(-) diff --git a/tests/drivers/pwm/pwm_gpio_loopback/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/pwm/pwm_gpio_loopback/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index 7eb6ff84af33..8b5846df92d2 100644 --- a/tests/drivers/pwm/pwm_gpio_loopback/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/tests/drivers/pwm/pwm_gpio_loopback/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -4,55 +4,45 @@ * * Test requires wire connection between: * - PWM130 OUT[0] at P0.00 <-> GPIO input at P0.01 - * - PWM130 OUT[1] at P0.02 <-> GPIO input at P0.04 - * - PWM130 OUT[2] at P0.03 <-> GPIO input at P0.05 - * - PWM130 OUT[3] at P0.06 <-> GPIO input at P0.07 * - PWM120 OUT[0] at P7.00 <-> GPIO input at P1.09 + * - PWM120 OUT[1] at P7.01 <-> GPIO input at P1.05 */ / { zephyr,user { pwms = <&pwm130 0 160000 PWM_POLARITY_NORMAL>, - <&pwm130 1 160000 PWM_POLARITY_NORMAL>, - <&pwm130 2 160000 PWM_POLARITY_NORMAL>, - <&pwm130 3 160000 PWM_POLARITY_NORMAL>, - <&pwm120 0 80000 PWM_POLARITY_NORMAL>; + <&pwm120 0 80000 PWM_POLARITY_NORMAL>, + <&pwm120 1 80000 PWM_POLARITY_NORMAL>; gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>, - <&gpio0 4 GPIO_ACTIVE_HIGH>, - <&gpio0 5 GPIO_ACTIVE_HIGH>, - <&gpio0 7 GPIO_ACTIVE_HIGH>, - <&gpio1 9 GPIO_ACTIVE_HIGH>; + <&gpio1 9 GPIO_ACTIVE_HIGH>, + <&gpio1 5 GPIO_ACTIVE_HIGH>; }; }; &pinctrl { pwm130_default: pwm130_default { group1 { - psels = , - , - , - ; + psels = ; }; }; pwm130_sleep: pwm130_sleep { group1 { - psels = , - , - , - ; + psels = ; low-power-enable; }; }; pwm120_default: pwm120_default { group1 { - psels = ; + psels = , + ; }; }; pwm120_sleep: pwm120_sleep { group1 { - psels = ; + psels = , + ; low-power-enable; }; }; diff --git a/tests/drivers/pwm/pwm_gpio_loopback/boards/nrf54l15dk_nrf54l15_cpuapp.overlay b/tests/drivers/pwm/pwm_gpio_loopback/boards/nrf54l15dk_nrf54l15_cpuapp.overlay index 69b0c8c5bed6..4ecece178922 100644 --- a/tests/drivers/pwm/pwm_gpio_loopback/boards/nrf54l15dk_nrf54l15_cpuapp.overlay +++ b/tests/drivers/pwm/pwm_gpio_loopback/boards/nrf54l15dk_nrf54l15_cpuapp.overlay @@ -3,36 +3,12 @@ * SPDX-License-Identifier: Apache-2.0 * * Test requires jumper between: - * - PWM20 OUT[0] at P1.08 <-> GPIO input at P1.09 - * - PWM20 OUT[1] at P1.10 <-> GPIO input at P1.11 - * - PWM20 OUT[2] at P1.12 <-> GPIO input at P1.13 + * - PWM20 OUT[0] at P1.10 <-> GPIO input at P1.11 */ / { zephyr,user { - pwms = <&pwm20 0 160000 PWM_POLARITY_NORMAL>, - <&pwm20 1 160000 PWM_POLARITY_NORMAL>, - <&pwm20 2 160000 PWM_POLARITY_NORMAL>; - gpios = <&gpio1 9 GPIO_ACTIVE_HIGH>, - <&gpio1 11 GPIO_ACTIVE_HIGH>, - <&gpio1 13 GPIO_ACTIVE_HIGH>; - }; -}; - -&pinctrl { - pwm20_default: pwm20_default { - group1 { - psels = , - , - ; - }; - }; - - pwm20_sleep: pwm20_sleep { - group1 { - psels = , - , - ; - }; + pwms = <&pwm20 0 160000 PWM_POLARITY_NORMAL>; + gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>; }; }; From b631fb0ba4b2f07c827c428540d3a4461ee04e2e Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:48 +0300 Subject: [PATCH 1189/2141] Revert "[nrf fromlist] tests: drivers: pwm_gpio_loopback: Test improvement" This reverts commit 87b4e2ceea2b1195582054a2c3d00a7db6480def. Signed-off-by: Jukka Rissanen --- .../drivers/pwm/pwm_gpio_loopback/src/main.c | 23 ++++++------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/tests/drivers/pwm/pwm_gpio_loopback/src/main.c b/tests/drivers/pwm/pwm_gpio_loopback/src/main.c index d1552712cafe..122189906344 100644 --- a/tests/drivers/pwm/pwm_gpio_loopback/src/main.c +++ b/tests/drivers/pwm/pwm_gpio_loopback/src/main.c @@ -234,25 +234,16 @@ ZTEST(pwm_gpio_loopback, test_pwm) ZTEST(pwm_gpio_loopback, test_pwm_cross) { - uint8_t duty[TEST_PWM_COUNT]; - const int duty_step = 25; - const int duty_variations = 5; - - /* Initial sweep with increasing duty cycles */ for (int i = 0; i < TEST_PWM_COUNT; i++) { - duty[i] = (i % duty_variations) * duty_step; - test_run(&pwms_dt[i], &gpios_dt[i], duty[i], true); + /* Test case: [Duty: 40%] */ + test_run(&pwms_dt[i], &gpios_dt[i], 40, true); } - /* Repeat test with persistent config checks and rotated duty cycles */ - for (int j = 1; j < duty_variations; j++) { - for (int i = 0; i < TEST_PWM_COUNT; i++) { - test_run(&pwms_dt[i], &gpios_dt[i], duty[i], false); - } - for (int i = 0; i < TEST_PWM_COUNT; i++) { - duty[i] = ((j + i) % duty_variations) * duty_step; - test_run(&pwms_dt[i], &gpios_dt[i], duty[i], true); - } + /* Set all channels and check if they retain the original + * configuration without calling pwm_set again + */ + for (int i = 0; i < TEST_PWM_COUNT; i++) { + test_run(&pwms_dt[i], &gpios_dt[i], 40, false); } } From 3a800f8306ab3de896b48aa04e62962d100c8beb Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:48 +0300 Subject: [PATCH 1190/2141] Revert "[nrf fromlist] drivers: spi: nrfx_spis: fix buffer freeing on error" This reverts commit 4ce95e842d6c97dd3ae374f2e93769c45f37314b. Signed-off-by: Jukka Rissanen --- drivers/spi/spi_nrfx_spis.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi_nrfx_spis.c b/drivers/spi/spi_nrfx_spis.c index c6e551eafc32..daa75d7e7fff 100644 --- a/drivers/spi/spi_nrfx_spis.c +++ b/drivers/spi/spi_nrfx_spis.c @@ -243,9 +243,9 @@ static int prepare_for_transfer(const struct device *dev, return 0; buffers_set_failed: - dmm_buffer_in_release(dev_config->mem_reg, rx_buf, rx_buf_len, dmm_rx_buf); + dmm_buffer_in_release(dev_config->mem_reg, rx_buf, rx_buf_len, rx_buf); in_alloc_failed: - dmm_buffer_out_release(dev_config->mem_reg, (void *)dmm_tx_buf); + dmm_buffer_out_release(dev_config->mem_reg, (void *)tx_buf); out_alloc_failed: return err; } From 0128c5cd6ccaddc487dc77fd477b578e17b7056e Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:48 +0300 Subject: [PATCH 1191/2141] Revert "[nrf fromlist] tests: drivers: spi: controller_peripheral: add direct variant" This reverts commit c8aad717b270ffbf924dad0e5d358a8fbdd0d1f0. Signed-off-by: Jukka Rissanen --- tests/drivers/spi/spi_controller_peripheral/Kconfig | 7 ------- .../drivers/spi/spi_controller_peripheral/src/main.c | 9 +++------ .../spi/spi_controller_peripheral/testcase.yaml | 11 ----------- 3 files changed, 3 insertions(+), 24 deletions(-) diff --git a/tests/drivers/spi/spi_controller_peripheral/Kconfig b/tests/drivers/spi/spi_controller_peripheral/Kconfig index c98c3a27ff20..f6472dae4abf 100644 --- a/tests/drivers/spi/spi_controller_peripheral/Kconfig +++ b/tests/drivers/spi/spi_controller_peripheral/Kconfig @@ -11,11 +11,4 @@ config TESTED_SPI_MODE 2: CPOL 1 (Active low), CPHA 0 (leading) 3: CPOL 1 (Active low), CPHA 1 (trailing) -config PREALLOC_BUFFERS - bool "Preallocate buffers" - default y - help - Preallocate buffers used for transaction - using `memory-region` property. - source "Kconfig.zephyr" diff --git a/tests/drivers/spi/spi_controller_peripheral/src/main.c b/tests/drivers/spi/spi_controller_peripheral/src/main.c index 7e15bb325368..04c6c27d11a7 100644 --- a/tests/drivers/spi/spi_controller_peripheral/src/main.c +++ b/tests/drivers/spi/spi_controller_peripheral/src/main.c @@ -41,12 +41,9 @@ static struct k_poll_event async_evt_spim = K_POLL_EVENT_INITIALIZER(K_POLL_TYPE_SIGNAL, K_POLL_MODE_NOTIFY_ONLY, &async_sig_spim); #define MEMORY_SECTION(node) \ - COND_CODE_1(IS_ENABLED(CONFIG_PREALLOC_BUFFERS), \ - (COND_CODE_1(DT_NODE_HAS_PROP(node, memory_regions), \ - (__attribute__((__section__( \ - LINKER_DT_NODE_REGION_NAME(DT_PHANDLE(node, \ - memory_regions)))))), \ - ())), \ + COND_CODE_1(DT_NODE_HAS_PROP(node, memory_regions), \ + (__attribute__((__section__( \ + LINKER_DT_NODE_REGION_NAME(DT_PHANDLE(node, memory_regions)))))), \ ()) static uint8_t spim_buffer[32] MEMORY_SECTION(DT_BUS(DT_NODELABEL(dut_spi_dt))); diff --git a/tests/drivers/spi/spi_controller_peripheral/testcase.yaml b/tests/drivers/spi/spi_controller_peripheral/testcase.yaml index 5f243dd6cf68..f385c3073e92 100644 --- a/tests/drivers/spi/spi_controller_peripheral/testcase.yaml +++ b/tests/drivers/spi/spi_controller_peripheral/testcase.yaml @@ -117,14 +117,3 @@ tests: - nrf54h20dk/nrf54h20/cpuppr - nrf54l20pdk/nrf54l20/cpuapp - ophelia4ev/nrf54l15/cpuapp - - drivers.spi.direct_xfer: - extra_configs: - - CONFIG_SPI_NRFX_RAM_BUFFER_SIZE=0 - filter: CONFIG_SOC_FAMILY_NORDIC_NRF - - drivers.spi.direct_xfer.no_prealloc: - extra_configs: - - CONFIG_SPI_NRFX_RAM_BUFFER_SIZE=0 - - CONFIG_PREALLOC_BUFFERS=n - filter: CONFIG_SOC_FAMILY_NORDIC_NRF From 72a7b7c62e0c3ab9b7a6b85ca2c59b3a41d195cf Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:48 +0300 Subject: [PATCH 1192/2141] Revert "[nrf fromtree] boards: shields: add npm1304_ek shield" This reverts commit ba1a3a62b9f2f57334bf9e2691779f6d3f1f187e. Signed-off-by: Jukka Rissanen --- boards/shields/npm1300_ek/doc/index.rst | 7 +- boards/shields/npm1304_ek/Kconfig.shield | 5 - boards/shields/npm1304_ek/doc/index.rst | 30 ----- boards/shields/npm1304_ek/npm1304_ek.overlay | 86 -------------- boards/shields/npm1304_ek/shield.yml | 11 -- doc/_scripts/redirects.py | 1 - samples/shields/npm1300_ek/CMakeLists.txt | 11 ++ samples/shields/npm1300_ek/doc/index.rst | 71 +++++++++++ .../nrf52dk_nrf52832.overlay} | 7 +- .../{npm13xx_ek => npm1300_ek}/prj.conf | 0 samples/shields/npm1300_ek/sample.yaml | 12 ++ .../{npm13xx_ek => npm1300_ek}/src/main.c | 30 ++--- samples/shields/npm13xx_ek/CMakeLists.txt | 17 --- .../boards/nrf52dk_nrf52832.overlay | 10 -- samples/shields/npm13xx_ek/doc/index.rst | 110 ------------------ samples/shields/npm13xx_ek/npm1304.overlay | 36 ------ samples/shields/npm13xx_ek/sample.yaml | 17 --- 17 files changed, 113 insertions(+), 348 deletions(-) delete mode 100644 boards/shields/npm1304_ek/Kconfig.shield delete mode 100644 boards/shields/npm1304_ek/doc/index.rst delete mode 100644 boards/shields/npm1304_ek/npm1304_ek.overlay delete mode 100644 boards/shields/npm1304_ek/shield.yml create mode 100644 samples/shields/npm1300_ek/CMakeLists.txt create mode 100644 samples/shields/npm1300_ek/doc/index.rst rename samples/shields/{npm13xx_ek/npm1300.overlay => npm1300_ek/nrf52dk_nrf52832.overlay} (88%) rename samples/shields/{npm13xx_ek => npm1300_ek}/prj.conf (100%) create mode 100644 samples/shields/npm1300_ek/sample.yaml rename samples/shields/{npm13xx_ek => npm1300_ek}/src/main.c (81%) delete mode 100644 samples/shields/npm13xx_ek/CMakeLists.txt delete mode 100644 samples/shields/npm13xx_ek/boards/nrf52dk_nrf52832.overlay delete mode 100644 samples/shields/npm13xx_ek/doc/index.rst delete mode 100644 samples/shields/npm13xx_ek/npm1304.overlay delete mode 100644 samples/shields/npm13xx_ek/sample.yaml diff --git a/boards/shields/npm1300_ek/doc/index.rst b/boards/shields/npm1300_ek/doc/index.rst index 5193523dde8c..816c31a5fff3 100644 --- a/boards/shields/npm1300_ek/doc/index.rst +++ b/boards/shields/npm1300_ek/doc/index.rst @@ -22,5 +22,10 @@ Usage ***** The shield can be used in any application by setting ``--shield npm1300_ek`` -when invoking ``west build``. You can check :zephyr:code-sample:`npm13xx_ek` for a +when invoking ``west build``. You can check :zephyr:code-sample:`npm1300_ek` for a comprehensive sample. + +References +********** + +TBC diff --git a/boards/shields/npm1304_ek/Kconfig.shield b/boards/shields/npm1304_ek/Kconfig.shield deleted file mode 100644 index d86b2525d1ca..000000000000 --- a/boards/shields/npm1304_ek/Kconfig.shield +++ /dev/null @@ -1,5 +0,0 @@ -# Copyright (c) 2025 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -config SHIELD_NPM1304_EK - def_bool $(shields_list_contains,npm1304_ek) diff --git a/boards/shields/npm1304_ek/doc/index.rst b/boards/shields/npm1304_ek/doc/index.rst deleted file mode 100644 index 2c47ed1ffd60..000000000000 --- a/boards/shields/npm1304_ek/doc/index.rst +++ /dev/null @@ -1,30 +0,0 @@ -.. _npm1304_ek: - -nPM1304 EK -########## - -Overview -******** - -The nPM1304 EK lets you test different functions and features of the nPM1304 -Power Management Integrated Circuit (PMIC). - -Requirements -************ - -The nPM1304 EK board is not a direct fit into an Arduino connector. However, -the Zephyr shield is expected to be connected to the Arduino shield connectors. -That is, you need to connect the I2C lines to the ``arduino_i2c`` bus. This allows to -use the shield with any host board that supports the Arduino connector. - -Usage -***** - -To use the shield in any application, build it with the following command: - -.. zephyr-app-commands:: - :board: your_board - :shield: npm1304_ek - :goals: build - -For a comprehensive sample, refer to :zephyr:code-sample:`npm13xx_ek`. diff --git a/boards/shields/npm1304_ek/npm1304_ek.overlay b/boards/shields/npm1304_ek/npm1304_ek.overlay deleted file mode 100644 index 37e6961c5fdb..000000000000 --- a/boards/shields/npm1304_ek/npm1304_ek.overlay +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (C) 2025 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include - -&arduino_i2c { - npm1304_ek_pmic: pmic@6b { - compatible = "nordic,npm1304"; - reg = <0x6b>; - - npm1304_ek_gpio: gpio-controller { - compatible = "nordic,npm1304-gpio"; - gpio-controller; - #gpio-cells = <2>; - ngpios = <5>; - }; - - npm1304_ek_regulators: regulators { - compatible = "nordic,npm1304-regulator"; - - /* limits are set to min/max allowed values */ - npm1304_ek_buck1: BUCK1 { - regulator-min-microvolt = <1000000>; - regulator-max-microvolt = <3300000>; - }; - - npm1304_ek_buck2: BUCK2 { - regulator-min-microvolt = <1000000>; - regulator-max-microvolt = <3300000>; - }; - - npm1304_ek_ldo1: LDO1 { - regulator-min-microvolt = <1000000>; - regulator-max-microvolt = <3300000>; - }; - - npm1304_ek_ldo2: LDO2 { - regulator-min-microvolt = <1000000>; - regulator-max-microvolt = <3300000>; - }; - }; - - npm1304_ek_charger: charger { - compatible = "nordic,npm1304-charger"; - term-microvolt = <4150000>; - term-warm-microvolt = <4000000>; - current-microamp = <4000>; - vbus-limit-microamp = <500000>; - thermistor-ohms = <10000>; - thermistor-beta = <3380>; - charging-enable; - }; - - npm1304_ek_buttons: buttons { - compatible = "gpio-keys"; - - pmic_button0: pmic_button_0 { - gpios = <&npm1304_ek_gpio 0 GPIO_ACTIVE_LOW>; - label = "Pmic button switch 0"; - zephyr,code = ; - }; - - pmic_button1: pmic_button_1 { - gpios = <&npm1304_ek_gpio 1 GPIO_ACTIVE_LOW>; - label = "Pmic button switch 1"; - zephyr,code = ; - }; - - pmic_button2: pmic_button_2 { - gpios = <&npm1304_ek_gpio 2 GPIO_ACTIVE_LOW>; - label = "Pmic button switch 2"; - zephyr,code = ; - }; - }; - - npm1304_ek_leds: leds { - compatible = "nordic,npm1304-led"; - nordic,led0-mode = "error"; - nordic,led1-mode = "charging"; - nordic,led2-mode = "host"; - }; - }; -}; diff --git a/boards/shields/npm1304_ek/shield.yml b/boards/shields/npm1304_ek/shield.yml deleted file mode 100644 index 88e19fb84bea..000000000000 --- a/boards/shields/npm1304_ek/shield.yml +++ /dev/null @@ -1,11 +0,0 @@ -shield: - name: npm1304_ek - full_name: nPM1304 EK - vendor: nordic - supported_features: - - mfd - - input - - gpio - - led - - regulator - - sensor diff --git a/doc/_scripts/redirects.py b/doc/_scripts/redirects.py index ba7525fbdb0b..1c1e9e29942e 100644 --- a/doc/_scripts/redirects.py +++ b/doc/_scripts/redirects.py @@ -302,7 +302,6 @@ ('samples/sensor/max44009/README', 'samples/sensor/light_polling/README'), ('samples/sensor/wsen_hids/README', 'samples/sensor/sensor'), ('samples/sensor/wsen_itds/README', 'samples/sensor/sensor'), - ('samples/shields/npm1300_ek/doc/index', 'samples/shields/npm13xx_ek/doc/index'), ('samples/subsys/video/capture/README', 'samples/drivers/video/capture/README'), ('samples/subsys/video/tcpserversink/README', 'samples/drivers/video/tcpserversink/README'), ('samples/subsys/video/video', 'samples/drivers/video/video'), diff --git a/samples/shields/npm1300_ek/CMakeLists.txt b/samples/shields/npm1300_ek/CMakeLists.txt new file mode 100644 index 000000000000..09e4de1cc52e --- /dev/null +++ b/samples/shields/npm1300_ek/CMakeLists.txt @@ -0,0 +1,11 @@ +# Copyright (c) 2023 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) + +set(SHIELD npm1300_ek) + +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) + +project(npm1300_ek) +target_sources(app PRIVATE src/main.c) diff --git a/samples/shields/npm1300_ek/doc/index.rst b/samples/shields/npm1300_ek/doc/index.rst new file mode 100644 index 000000000000..be2e8db34cf3 --- /dev/null +++ b/samples/shields/npm1300_ek/doc/index.rst @@ -0,0 +1,71 @@ +.. zephyr:code-sample:: npm1300_ek + :name: nPM1300 EK + + Interact with the nPM1300 PMIC using the shell interface. + +Overview +******** + +This sample is provided for evaluation of the :ref:`npm1300_ek`. +The sample provides a shell interface to support the features of the +nPM1300 PMIC, including: + +- Regulators (BUCK1/2, LDO1/2) +- GPIO + +Requirements +************ + +The shield needs to be wired to a host board supporting the Arduino connector. + +Examples and images to follow + +Building and Running +******************** + +The sample is designed so that it can run on any platform. For example, when +building for the nRF52 DK, the following command can be used: + +.. zephyr-app-commands:: + :zephyr-app: samples/shields/npm1300_ek + :board: nrf52dk/nrf52832 + :goals: build + :compact: + +Note that this sample automatically sets ``SHIELD`` to ``npm1300_ek``. Once +flashed, you should boot into the shell interface. The ``regulator`` command is +provided to test the PMIC. Below you can find details for each subcommand. + +Regulators +========== + +The ``regulator`` shell interface provides several subcommand to test +the regulators embedded in the PMIC. Below you can find some command examples. + +.. code-block:: bash + + # list all the supported voltages by BUCK1 + regulator vlist BUCK1 + 1.000 V + 1.100 V + ... + +.. code-block:: bash + + # enable BUCK2 + regulator enable BUCK2 + # disable BUCK2 + regulator disable BUCK2 + +.. code-block:: bash + + # set BUCK2 voltage to exactly 2V + regulator vset BUCK2 2V + # obtain the actual BUCK1 configured voltage + regulator vget BUCK1 + 1.800 V + # set BUCK1 voltage to a value between 2.35V and 2.45V + regulator set BUCK1 2.35V 2.45V + # obtain the actual BUCK1 configured voltage + regulator get BUCK1 + 2.400 V diff --git a/samples/shields/npm13xx_ek/npm1300.overlay b/samples/shields/npm1300_ek/nrf52dk_nrf52832.overlay similarity index 88% rename from samples/shields/npm13xx_ek/npm1300.overlay rename to samples/shields/npm1300_ek/nrf52dk_nrf52832.overlay index 408c1b8715d0..e4f2cca20ce5 100644 --- a/samples/shields/npm13xx_ek/npm1300.overlay +++ b/samples/shields/npm1300_ek/nrf52dk_nrf52832.overlay @@ -1,7 +1,12 @@ /* - * Copyright (C) 2025 Nordic Semiconductor ASA + * Copyright (C) 2023 Nordic Semiconductor ASA * SPDX-License-Identifier: Apache-2.0 */ + &i2c0_default { + group1 { + bias-pull-up; + }; +}; &npm1300_ek_regulators { dvs-gpios = <&gpio0 17 GPIO_ACTIVE_LOW>, diff --git a/samples/shields/npm13xx_ek/prj.conf b/samples/shields/npm1300_ek/prj.conf similarity index 100% rename from samples/shields/npm13xx_ek/prj.conf rename to samples/shields/npm1300_ek/prj.conf diff --git a/samples/shields/npm1300_ek/sample.yaml b/samples/shields/npm1300_ek/sample.yaml new file mode 100644 index 000000000000..de89e80d79ea --- /dev/null +++ b/samples/shields/npm1300_ek/sample.yaml @@ -0,0 +1,12 @@ +# Copyright (c) 2023 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +sample: + name: nPM1300 EK +tests: + sample.shields.npm1300_ek: + platform_allow: nrf52dk/nrf52832 + harness: shield + tags: shield + extra_args: SHIELD=npm1300_ek + depends_on: arduino_i2c diff --git a/samples/shields/npm13xx_ek/src/main.c b/samples/shields/npm1300_ek/src/main.c similarity index 81% rename from samples/shields/npm13xx_ek/src/main.c rename to samples/shields/npm1300_ek/src/main.c index 0473c5662353..9ecffb69e219 100644 --- a/samples/shields/npm13xx_ek/src/main.c +++ b/samples/shields/npm1300_ek/src/main.c @@ -19,25 +19,15 @@ #define SLEEP_TIME_MS 100 #define UPDATE_TIME_MS 2000 -#if CONFIG_SHIELD_NPM1300_EK -#define SHIELD_LABEL(component) DT_NODELABEL(npm1300_ek_ ## component) -#elif CONFIG_SHIELD_NPM1304_EK -#define SHIELD_LABEL(component) DT_NODELABEL(npm1304_ek_ ## component) -#else -#error "either npm1300_ek or npm1304_ek shield should be selected" -#endif - -#define NPM13XX_DEVICE(dev) DEVICE_DT_GET(SHIELD_LABEL(dev)) - static const struct gpio_dt_spec button1 = GPIO_DT_SPEC_GET(DT_ALIAS(sw0), gpios); -static const struct device *regulators = NPM13XX_DEVICE(regulators); +static const struct device *regulators = DEVICE_DT_GET(DT_NODELABEL(npm1300_ek_regulators)); -static const struct device *charger = NPM13XX_DEVICE(charger); +static const struct device *charger = DEVICE_DT_GET(DT_NODELABEL(npm1300_ek_charger)); -static const struct device *leds = NPM13XX_DEVICE(leds); +static const struct device *leds = DEVICE_DT_GET(DT_NODELABEL(npm1300_ek_leds)); -static const struct device *pmic = NPM13XX_DEVICE(pmic); +static const struct device *pmic = DEVICE_DT_GET(DT_NODELABEL(npm1300_ek_pmic)); void configure_ui(void) { @@ -63,14 +53,9 @@ void configure_ui(void) } } -static void event_callback(const struct device *dev, struct gpio_callback *cb, uint32_t events) +static void event_callback(const struct device *dev, struct gpio_callback *cb, uint32_t pins) { - if (events & BIT(NPM13XX_EVENT_SHIPHOLD_PRESS)) { - printk("SHPHLD pressed\n"); - } - if (events & BIT(NPM13XX_EVENT_SHIPHOLD_RELEASE)) { - printk("SHPHLD released\n"); - } + printk("Event detected\n"); } void configure_events(void) @@ -83,8 +68,7 @@ void configure_events(void) /* Setup callback for shiphold button press */ static struct gpio_callback event_cb; - gpio_init_callback(&event_cb, event_callback, BIT(NPM13XX_EVENT_SHIPHOLD_PRESS) | - BIT(NPM13XX_EVENT_SHIPHOLD_RELEASE)); + gpio_init_callback(&event_cb, event_callback, BIT(NPM13XX_EVENT_SHIPHOLD_PRESS)); mfd_npm13xx_add_callback(pmic, &event_cb); } diff --git a/samples/shields/npm13xx_ek/CMakeLists.txt b/samples/shields/npm13xx_ek/CMakeLists.txt deleted file mode 100644 index f3432a12e0b6..000000000000 --- a/samples/shields/npm13xx_ek/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (c) 2023 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -cmake_minimum_required(VERSION 3.20.0) - -if(SHIELD STREQUAL "npm1300_ek") - set(EXTRA_DTC_OVERLAY_FILE npm1300.overlay) -elseif(SHIELD STREQUAL "npm1304_ek") - set(EXTRA_DTC_OVERLAY_FILE npm1304.overlay) -else() - message(FATAL_ERROR "either npm1300_ek or npm1304_ek must be selected with --shield") -endif() - -find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) - -project(npm13xx_ek) -target_sources(app PRIVATE src/main.c) diff --git a/samples/shields/npm13xx_ek/boards/nrf52dk_nrf52832.overlay b/samples/shields/npm13xx_ek/boards/nrf52dk_nrf52832.overlay deleted file mode 100644 index 14a68cf79128..000000000000 --- a/samples/shields/npm13xx_ek/boards/nrf52dk_nrf52832.overlay +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright (C) 2023 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -&i2c0_default { - group1 { - bias-pull-up; - }; -}; diff --git a/samples/shields/npm13xx_ek/doc/index.rst b/samples/shields/npm13xx_ek/doc/index.rst deleted file mode 100644 index 892e5f45a657..000000000000 --- a/samples/shields/npm13xx_ek/doc/index.rst +++ /dev/null @@ -1,110 +0,0 @@ -.. zephyr:code-sample:: npm13xx_ek - :name: nPM13xx EK - - Interact with an nPM1300 or nPM1304 PMIC using the shell interface and buttons. - -Overview -******** - -This sample is provided for evaluation of :ref:`npm1300_ek` and :ref:`npm1304_ek`. The sample -demonstrates use of Dynamic Voltage Scaling (DVS) regulator API feature which allows to switch -between chosen voltage levels or regulator modes by toggling configured GPIOs with a single -regulator API call. - -It also provides a shell interface to support the features of the nPM1300 and nPM1304 PMICs, -including: - -- Regulators (BUCK1/2, LDO1/2) -- GPIO - -Requirements -************ - -The shield needs to be wired to a host board featuring the Arduino I2C connector. PMIC's GPIO3 acts -as an interrupt output, pins GPIO1 and GPIO2 are configured to control regulator modes (controlled -by the MCU software through DVS). - -In addition, PMIC's VDDIO pin should be connected to an appropriate voltage reference. - -E.g. for an nRF52 Series DK the wiring is as follows: - - +------------------+-------+-------+-------+-------+-------+-------+-----+ - | nPM13xx EK pins | SDA | SCL | GPIO1 | GPIO2 | GPIO3 | VDDIO | GND | - +------------------+-------+-------+-------+-------+-------+-------+-----+ - | nRF52 DK pins | P0.26 | P0.27 | P0.17 | P0.18 | P0.22 | VDD | GND | - +------------------+-------+-------+-------+-------+-------+-------+-----+ - -Building and Running -******************** - -The sample is designed so that it can run on any platform (references to host GPIOs connected to -the nPM13xx EK need to be updated in the ``npm13xx.overlay`` files to reflect chosen HW). - -For example, when building for the nRF52 DK and the nPM1300 EK, the following command can be used: - -.. zephyr-app-commands:: - :zephyr-app: samples/shields/npm13xx_ek - :board: nrf52dk/nrf52832 - :shield: npm1300_ek - :goals: build - :compact: - -Testing -******* - -After flashing the sample FW, you need to connect to the shell interface, where in case of -successful initialization you will see the nPM13xx PMIC status messages containing charger status -and battery voltage, current and temperature. Pressing and releasing the SHPHLD button on the EK -will generate interrupts and these events will also be printed in the shell. - -Pressing a dedicated button on the host DK (Button 1 on an nRF52 Series DK) will cycle DVS states. - - +-------------------------------------+----------------+---------------+---------------+ - | **DVS state** (GPIO1 | GPIO2 level) | **BUCK2 mode** | **LDO1 mode** | **LDO2 mode** | - +-------------------------------------+----------------+---------------+---------------+ - | **0** (HIGH | HIGH) | OFF | OFF | OFF | - +-------------------------------------+----------------+---------------+---------------+ - | **1** (LOW | HIGH) | ON retention | OFF | OFF | - +-------------------------------------+----------------+---------------+---------------+ - | **2** (HIGH | LOW) | OFF | ON | ON | - +-------------------------------------+----------------+---------------+---------------+ - | **3** (LOW | LOW) | ON PWM | ON | ON | - +-------------------------------------+----------------+---------------+---------------+ - -.. note:: - On an nRF52 Series DK, DVS pins are also used for the onboard LED1 and LED2, so you can observe - the DVS state pins visually: an LED lights up when the respective pin is LOW - -Regulators -********** - -The ``regulator`` shell interface provides several subcommand to test -the regulators embedded in the PMIC. Below you can find some command examples. - -.. code-block:: console - - # list all the supported voltages by BUCK1 - uart:~$ regulator vlist BUCK1 - 1.000 V - 1.100 V - ... - -.. code-block:: console - - # enable BUCK2 - uart:~$ regulator enable BUCK2 - # disable BUCK2 - uart:~$ regulator disable BUCK2 - -.. code-block:: console - - # set BUCK2 voltage to exactly 2V - uart:~$ regulator vset BUCK2 2V - # obtain the actual BUCK1 configured voltage - uart:~$ regulator vget BUCK1 - 1.800 V - # set BUCK1 voltage to a value between 2.35V and 2.45V - uart:~$ regulator set BUCK1 2.35V 2.45V - # obtain the actual BUCK1 configured voltage - uart:~$ regulator get BUCK1 - 2.400 V diff --git a/samples/shields/npm13xx_ek/npm1304.overlay b/samples/shields/npm13xx_ek/npm1304.overlay deleted file mode 100644 index 010c7d4897a1..000000000000 --- a/samples/shields/npm13xx_ek/npm1304.overlay +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2025 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -&npm1304_ek_regulators { - dvs-gpios = <&gpio0 17 GPIO_ACTIVE_LOW>, - <&gpio0 18 GPIO_ACTIVE_LOW>; -}; - -&npm1304_ek_buck1 { - regulator-init-microvolt = <2000000>; -}; - -&npm1304_ek_buck2 { - regulator-init-microvolt = <3300000>; - retention-microvolt = <2500000>; - enable-gpio-config = <1 GPIO_ACTIVE_LOW>; - retention-gpio-config = <2 GPIO_ACTIVE_HIGH>; - pwm-gpio-config = <2 GPIO_ACTIVE_LOW>; -}; - -&npm1304_ek_ldo1 { - regulator-initial-mode = ; - enable-gpio-config = <2 GPIO_ACTIVE_LOW>; -}; - -&npm1304_ek_ldo2 { - regulator-initial-mode = ; - enable-gpio-config = <2 GPIO_ACTIVE_LOW>; -}; - -&npm1304_ek_pmic { - host-int-gpios = <&gpio0 22 0>; - pmic-int-pin = <3>; -}; diff --git a/samples/shields/npm13xx_ek/sample.yaml b/samples/shields/npm13xx_ek/sample.yaml deleted file mode 100644 index 98c68d54e32e..000000000000 --- a/samples/shields/npm13xx_ek/sample.yaml +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (c) 2023 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -sample: - name: nPM13xx EK -common: - platform_allow: nrf52dk/nrf52832 - depends_on: arduino_i2c - tags: - - shield - - regulator - - sensor -tests: - sample.shields.npm1300_ek: - extra_args: SHIELD=npm1300_ek - sample.shields.npm1304_ek: - extra_args: SHIELD=npm1304_ek From 2dd16f2dd606b0e8dbb2aea3dd5c8f1e32a45967 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:48 +0300 Subject: [PATCH 1193/2141] Revert "[nrf fromtree] samples: fs: fs_sample: Fix nrf54l15 dts overlay files" This reverts commit 1e7c322c576ac40b778665b12e7560eaebecd125. Signed-off-by: Jukka Rissanen --- .../fs/fs_sample/boards/bl54l15_dvk_nrf54l15_cpuapp.overlay | 2 ++ .../fs/fs_sample/boards/bl54l15u_dvk_nrf54l15_cpuapp.overlay | 2 ++ .../fs/fs_sample/boards/nrf54l15dk_nrf54l15_cpuapp.overlay | 3 ++- .../fs/fs_sample/boards/ophelia4ev_nrf54l15_cpuapp.overlay | 2 ++ 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/samples/subsys/fs/fs_sample/boards/bl54l15_dvk_nrf54l15_cpuapp.overlay b/samples/subsys/fs/fs_sample/boards/bl54l15_dvk_nrf54l15_cpuapp.overlay index 5a063e3b862f..2311a0397029 100644 --- a/samples/subsys/fs/fs_sample/boards/bl54l15_dvk_nrf54l15_cpuapp.overlay +++ b/samples/subsys/fs/fs_sample/boards/bl54l15_dvk_nrf54l15_cpuapp.overlay @@ -11,6 +11,8 @@ */ /delete-node/ &slot0_partition; /delete-node/ &slot1_partition; +/delete-node/ &slot0_ns_partition; +/delete-node/ &slot1_ns_partition; /delete-node/ &storage_partition; &cpuapp_rram { diff --git a/samples/subsys/fs/fs_sample/boards/bl54l15u_dvk_nrf54l15_cpuapp.overlay b/samples/subsys/fs/fs_sample/boards/bl54l15u_dvk_nrf54l15_cpuapp.overlay index 5a063e3b862f..2311a0397029 100644 --- a/samples/subsys/fs/fs_sample/boards/bl54l15u_dvk_nrf54l15_cpuapp.overlay +++ b/samples/subsys/fs/fs_sample/boards/bl54l15u_dvk_nrf54l15_cpuapp.overlay @@ -11,6 +11,8 @@ */ /delete-node/ &slot0_partition; /delete-node/ &slot1_partition; +/delete-node/ &slot0_ns_partition; +/delete-node/ &slot1_ns_partition; /delete-node/ &storage_partition; &cpuapp_rram { diff --git a/samples/subsys/fs/fs_sample/boards/nrf54l15dk_nrf54l15_cpuapp.overlay b/samples/subsys/fs/fs_sample/boards/nrf54l15dk_nrf54l15_cpuapp.overlay index b75448218933..391afea75a40 100644 --- a/samples/subsys/fs/fs_sample/boards/nrf54l15dk_nrf54l15_cpuapp.overlay +++ b/samples/subsys/fs/fs_sample/boards/nrf54l15dk_nrf54l15_cpuapp.overlay @@ -10,6 +10,8 @@ */ /delete-node/ &slot0_partition; /delete-node/ &slot1_partition; +/delete-node/ &slot0_ns_partition; +/delete-node/ &slot1_ns_partition; /delete-node/ &storage_partition; &cpuapp_rram { @@ -21,7 +23,6 @@ slot0_partition: parition@10000 { reg = <0x00010000 DT_SIZE_K(300)>; }; - slot1_partition: partition@5b000 { reg = <0x0005b000 DT_SIZE_K(300)>; }; diff --git a/samples/subsys/fs/fs_sample/boards/ophelia4ev_nrf54l15_cpuapp.overlay b/samples/subsys/fs/fs_sample/boards/ophelia4ev_nrf54l15_cpuapp.overlay index 339c971683a1..da13128938aa 100644 --- a/samples/subsys/fs/fs_sample/boards/ophelia4ev_nrf54l15_cpuapp.overlay +++ b/samples/subsys/fs/fs_sample/boards/ophelia4ev_nrf54l15_cpuapp.overlay @@ -10,6 +10,8 @@ */ /delete-node/ &slot0_partition; /delete-node/ &slot1_partition; +/delete-node/ &slot0_ns_partition; +/delete-node/ &slot1_ns_partition; /delete-node/ &storage_partition; &cpuapp_rram { From bcaa8b187ab21843e52db5b5afabeb989269d90d Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:48 +0300 Subject: [PATCH 1194/2141] Revert "[nrf fromtree] boards: nordic: nrf54l05: Change to use common dts partitioning file" This reverts commit c49eabe0283c50d6f00e952ec298d3e2d3ac4435. Signed-off-by: Jukka Rissanen --- .../nrf54l15dk/nrf54l15dk_nrf54l05_cpuapp.dts | 44 ++++++++++++++++++- .../nrf54l15dk_nrf54l05_cpuapp.yaml | 2 +- dts/vendor/nordic/nrf54l05_partition.dtsi | 38 ---------------- 3 files changed, 43 insertions(+), 41 deletions(-) delete mode 100644 dts/vendor/nordic/nrf54l05_partition.dtsi diff --git a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l05_cpuapp.dts b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l05_cpuapp.dts index 2c30c7270059..23ae87ccb110 100644 --- a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l05_cpuapp.dts +++ b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l05_cpuapp.dts @@ -25,5 +25,45 @@ ranges = <0x0 0x20000000 DT_SIZE_K(96)>; }; -/* Include default memory partition configuration file */ -#include +&cpuapp_rram { + reg = <0x0 DT_SIZE_K(500)>; +}; + +/* These partition sizes assume no FLPR area in RRAM */ +&cpuapp_rram { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x0 DT_SIZE_K(64)>; + }; + + slot0_partition: partition@10000 { + label = "image-0"; + reg = <0x10000 DT_SIZE_K(100)>; + }; + + slot0_ns_partition: partition@29000 { + label = "image-0-nonsecure"; + reg = <0x29000 DT_SIZE_K(100)>; + }; + + slot1_partition: partition@42000 { + label = "image-1"; + reg = <0x42000 DT_SIZE_K(100)>; + }; + + slot1_ns_partition: partition@5b000 { + label = "image-1-nonsecure"; + reg = <0x5b000 DT_SIZE_K(100)>; + }; + + storage_partition: partition@74000 { + label = "storage"; + reg = <0x74000 DT_SIZE_K(36)>; + }; + }; +}; diff --git a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l05_cpuapp.yaml b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l05_cpuapp.yaml index cda8efcd610a..2a41fbf2ca10 100644 --- a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l05_cpuapp.yaml +++ b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l05_cpuapp.yaml @@ -10,7 +10,7 @@ toolchain: - zephyr sysbuild: true ram: 96 -flash: 500 +flash: 100 supported: - adc - counter diff --git a/dts/vendor/nordic/nrf54l05_partition.dtsi b/dts/vendor/nordic/nrf54l05_partition.dtsi deleted file mode 100644 index aa2ea04bce0d..000000000000 --- a/dts/vendor/nordic/nrf54l05_partition.dtsi +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&cpuapp_rram { - reg = <0x0 DT_SIZE_K(500)>; -}; - -/* These partition sizes assume no FLPR area in RRAM */ -&cpuapp_rram { - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - boot_partition: partition@0 { - label = "mcuboot"; - reg = <0x0 DT_SIZE_K(64)>; - }; - - slot0_partition: partition@10000 { - label = "image-0"; - reg = <0x10000 DT_SIZE_K(200)>; - }; - - slot1_partition: partition@42000 { - label = "image-1"; - reg = <0x42000 DT_SIZE_K(200)>; - }; - - storage_partition: partition@74000 { - label = "storage"; - reg = <0x74000 DT_SIZE_K(36)>; - }; - }; -}; From 4663e04adad8a84d50cfd72c347586bb5bc4364d Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:48 +0300 Subject: [PATCH 1195/2141] Revert "[nrf fromtree] boards: nordic: nrf54l15_ns: Change to use common dts partitioning file" This reverts commit 02d21dd590dbb7439d999f0bdb05ec76a9df6927. Signed-off-by: Jukka Rissanen --- .../bl54l15_dvk_nrf54l15_cpuapp_ns.dts | 48 +++++++++++++- .../bl54l15u_dvk_nrf54l15_cpuapp_ns.dts | 48 +++++++++++++- .../nrf54l15dk_nrf54l15_cpuapp_ns.dts | 48 +++++++++++++- .../panb511evb_nrf54l15_cpuapp_ns.dts | 48 +++++++++++++- .../raytac_an54l15q_db_nrf54l15_cpuapp_ns.dts | 48 +++++++++++++- dts/vendor/nordic/nrf54l15_ns_partition.dtsi | 62 ------------------- 6 files changed, 225 insertions(+), 77 deletions(-) delete mode 100644 dts/vendor/nordic/nrf54l15_ns_partition.dtsi diff --git a/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l15_cpuapp_ns.dts b/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l15_cpuapp_ns.dts index bca01b2b0624..38712ba70744 100644 --- a/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l15_cpuapp_ns.dts +++ b/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l15_cpuapp_ns.dts @@ -58,6 +58,51 @@ }; }; +&cpuapp_rram { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + /* nRF54L15 has 1524 kB of non volatile memory (RRAM) but the + * last 96kB are reserved for the FLPR MCU. + * + * This static layout needs to be the same with the upstream TF-M layout in the + * header flash_layout.h of the relevant platform. Any updates in the layout + * needs to happen both in the flash_layout.h and in this file at the same time. + */ + slot0_partition: partition@0 { + label = "image-0"; + reg = <0x0000000 DT_SIZE_K(512)>; + }; + + tfm_ps_partition: partition@80000 { + label = "tfm-ps"; + reg = <0x00080000 DT_SIZE_K(16)>; + }; + + tfm_its_partition: partition@84000 { + label = "tfm-its"; + reg = <0x00084000 DT_SIZE_K(16)>; + }; + + tfm_otp_partition: partition@88000 { + label = "tfm-otp"; + reg = <0x00088000 DT_SIZE_K(8)>; + }; + + slot0_ns_partition: partition@8A000 { + label = "image-0-nonsecure"; + reg = <0x0008A000 DT_SIZE_K(844)>; + }; + + storage_partition: partition@15D000 { + label = "storage"; + reg = <0x00015D000 DT_SIZE_K(32)>; + }; + }; +}; + &uart30 { /* Disable so that TF-M can use this UART */ status = "disabled"; @@ -67,6 +112,3 @@ pinctrl-1 = <&uart30_sleep>; pinctrl-names = "default", "sleep"; }; - -/* Include default memory partition configuration file */ -#include diff --git a/boards/ezurio/bl54l15u_dvk/bl54l15u_dvk_nrf54l15_cpuapp_ns.dts b/boards/ezurio/bl54l15u_dvk/bl54l15u_dvk_nrf54l15_cpuapp_ns.dts index 6530b554d343..f03eb6a5e810 100644 --- a/boards/ezurio/bl54l15u_dvk/bl54l15u_dvk_nrf54l15_cpuapp_ns.dts +++ b/boards/ezurio/bl54l15u_dvk/bl54l15u_dvk_nrf54l15_cpuapp_ns.dts @@ -58,6 +58,51 @@ }; }; +&cpuapp_rram { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + /* nRF54L15 has 1524 kB of non volatile memory (RRAM) but the + * last 96kB are reserved for the FLPR MCU. + * + * This static layout needs to be the same with the upstream TF-M layout in the + * header flash_layout.h of the relevant platform. Any updates in the layout + * needs to happen both in the flash_layout.h and in this file at the same time. + */ + slot0_partition: partition@0 { + label = "image-0"; + reg = <0x0000000 DT_SIZE_K(512)>; + }; + + tfm_ps_partition: partition@80000 { + label = "tfm-ps"; + reg = <0x00080000 DT_SIZE_K(16)>; + }; + + tfm_its_partition: partition@84000 { + label = "tfm-its"; + reg = <0x00084000 DT_SIZE_K(16)>; + }; + + tfm_otp_partition: partition@88000 { + label = "tfm-otp"; + reg = <0x00088000 DT_SIZE_K(8)>; + }; + + slot0_ns_partition: partition@8A000 { + label = "image-0-nonsecure"; + reg = <0x0008A000 DT_SIZE_K(844)>; + }; + + storage_partition: partition@15D000 { + label = "storage"; + reg = <0x00015D000 DT_SIZE_K(32)>; + }; + }; +}; + &uart30 { /* Disable so that TF-M can use this UART */ status = "disabled"; @@ -67,6 +112,3 @@ pinctrl-1 = <&uart30_sleep>; pinctrl-names = "default", "sleep"; }; - -/* Include default memory partition configuration file */ -#include diff --git a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp_ns.dts b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp_ns.dts index f78a1f864e2f..3a7ca70eaedf 100644 --- a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp_ns.dts +++ b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp_ns.dts @@ -57,6 +57,51 @@ }; }; +&cpuapp_rram { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + /* nRF54L15 has 1524 kB of non volatile memory (RRAM) but the + * last 96kB are reserved for the FLPR MCU. + * + * This static layout needs to be the same with the upstream TF-M layout in the + * header flash_layout.h of the relevant platform. Any updates in the layout + * needs to happen both in the flash_layout.h and in this file at the same time. + */ + slot0_partition: partition@0 { + label = "image-0"; + reg = <0x0000000 DT_SIZE_K(512)>; + }; + + tfm_ps_partition: partition@80000 { + label = "tfm-ps"; + reg = <0x00080000 DT_SIZE_K(16)>; + }; + + tfm_its_partition: partition@84000 { + label = "tfm-its"; + reg = <0x00084000 DT_SIZE_K(16)>; + }; + + tfm_otp_partition: partition@88000 { + label = "tfm-otp"; + reg = <0x00088000 DT_SIZE_K(8)>; + }; + + slot0_ns_partition: partition@8A000 { + label = "image-0-nonsecure"; + reg = <0x0008A000 DT_SIZE_K(844)>; + }; + + storage_partition: partition@15D000 { + label = "storage"; + reg = <0x00015D000 DT_SIZE_K(32)>; + }; + }; +}; + &uart30 { /* Disable so that TF-M can use this UART */ status = "disabled"; @@ -66,6 +111,3 @@ pinctrl-1 = <&uart30_sleep>; pinctrl-names = "default", "sleep"; }; - -/* Include default memory partition configuration file */ -#include diff --git a/boards/panasonic/panb511evb/panb511evb_nrf54l15_cpuapp_ns.dts b/boards/panasonic/panb511evb/panb511evb_nrf54l15_cpuapp_ns.dts index 4f5ea3033165..f4aeab933f8c 100644 --- a/boards/panasonic/panb511evb/panb511evb_nrf54l15_cpuapp_ns.dts +++ b/boards/panasonic/panb511evb/panb511evb_nrf54l15_cpuapp_ns.dts @@ -57,6 +57,51 @@ }; }; +&cpuapp_rram { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + /* nRF54L15 has 1524 kB of non volatile memory (RRAM) but the + * last 96kB are reserved for the FLPR MCU. + * + * This static layout needs to be the same with the upstream TF-M layout in the + * header flash_layout.h of the relevant platform. Any updates in the layout + * needs to happen both in the flash_layout.h and in this file at the same time. + */ + slot0_partition: partition@0 { + label = "image-0"; + reg = <0x0000000 DT_SIZE_K(512)>; + }; + + tfm_ps_partition: partition@80000 { + label = "tfm-ps"; + reg = <0x00080000 DT_SIZE_K(16)>; + }; + + tfm_its_partition: partition@84000 { + label = "tfm-its"; + reg = <0x00084000 DT_SIZE_K(16)>; + }; + + tfm_otp_partition: partition@88000 { + label = "tfm-otp"; + reg = <0x00088000 DT_SIZE_K(8)>; + }; + + slot0_ns_partition: partition@8A000 { + label = "image-0-nonsecure"; + reg = <0x0008A000 DT_SIZE_K(844)>; + }; + + storage_partition: partition@15D000 { + label = "storage"; + reg = <0x00015D000 DT_SIZE_K(32)>; + }; + }; +}; + &uart20 { /* Disable so that TF-M can use this UART */ status = "disabled"; @@ -66,6 +111,3 @@ pinctrl-1 = <&uart20_sleep>; pinctrl-names = "default", "sleep"; }; - -/* Include default memory partition configuration file */ -#include diff --git a/boards/raytac/an54l15q_db/raytac_an54l15q_db_nrf54l15_cpuapp_ns.dts b/boards/raytac/an54l15q_db/raytac_an54l15q_db_nrf54l15_cpuapp_ns.dts index d6395d7fd71a..db7a01aead83 100644 --- a/boards/raytac/an54l15q_db/raytac_an54l15q_db_nrf54l15_cpuapp_ns.dts +++ b/boards/raytac/an54l15q_db/raytac_an54l15q_db_nrf54l15_cpuapp_ns.dts @@ -58,6 +58,51 @@ }; }; +&cpuapp_rram { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + /* nRF54L15 has 1524 kB of non volatile memory (RRAM) but the + * last 96kB are reserved for the FLPR MCU. + * + * This static layout needs to be the same with the upstream TF-M layout in the + * header flash_layout.h of the relevant platform. Any updates in the layout + * needs to happen both in the flash_layout.h and in this file at the same time. + */ + slot0_partition: partition@0 { + label = "image-0"; + reg = <0x0000000 DT_SIZE_K(512)>; + }; + + tfm_ps_partition: partition@80000 { + label = "tfm-ps"; + reg = <0x00080000 DT_SIZE_K(16)>; + }; + + tfm_its_partition: partition@84000 { + label = "tfm-its"; + reg = <0x00084000 DT_SIZE_K(16)>; + }; + + tfm_otp_partition: partition@88000 { + label = "tfm-otp"; + reg = <0x00088000 DT_SIZE_K(8)>; + }; + + slot0_ns_partition: partition@8A000 { + label = "image-0-nonsecure"; + reg = <0x0008A000 DT_SIZE_K(844)>; + }; + + storage_partition: partition@15D000 { + label = "storage"; + reg = <0x00015D000 DT_SIZE_K(32)>; + }; + }; +}; + &uart30 { /* Disable so that TF-M can use this UART */ status = "disabled"; @@ -66,6 +111,3 @@ pinctrl-1 = <&uart30_sleep>; pinctrl-names = "default", "sleep"; }; - -/* Include default memory partition configuration file */ -#include diff --git a/dts/vendor/nordic/nrf54l15_ns_partition.dtsi b/dts/vendor/nordic/nrf54l15_ns_partition.dtsi deleted file mode 100644 index ac15dc79f33c..000000000000 --- a/dts/vendor/nordic/nrf54l15_ns_partition.dtsi +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&cpuapp_rram { - /* - * Default NVM layout on NRF54L15 Application MCU without BL2: - * This layout matches (by necessity) that in the TF-M repository: - * - * 0x0000_0000 Secure image primary (512 KB) - * 0x0008_0000 Protected Storage Area (16 KB) - * 0x0008_4000 Internal Trusted Storage Area (16 KB) - * 0x0008_8000 OTP / NV counters area (8 KB) - * 0x0008_A000 Non-secure image primary (844 KB) - * 0x0015_D000 Non-secure storage, used when built with NRF_NS_STORAGE=ON, - * otherwise unused (32 KB) - */ - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - /* nRF54L15 has 1524 kB of non volatile memory (RRAM) but the - * last 96kB are reserved for the FLPR MCU. - * - * This static layout needs to be the same with the upstream TF-M layout in the - * header flash_layout.h of the relevant platform. Any updates in the layout - * needs to happen both in the flash_layout.h and in this file at the same time. - */ - slot0_partition: partition@0 { - label = "image-0"; - reg = <0x0000000 DT_SIZE_K(512)>; - }; - - tfm_ps_partition: partition@80000 { - label = "tfm-ps"; - reg = <0x00080000 DT_SIZE_K(16)>; - }; - - tfm_its_partition: partition@84000 { - label = "tfm-its"; - reg = <0x00084000 DT_SIZE_K(16)>; - }; - - tfm_otp_partition: partition@88000 { - label = "tfm-otp"; - reg = <0x00088000 DT_SIZE_K(8)>; - }; - - slot0_ns_partition: partition@8A000 { - label = "image-0-nonsecure"; - reg = <0x0008A000 DT_SIZE_K(844)>; - }; - - storage_partition: partition@15D000 { - label = "storage"; - reg = <0x00015D000 DT_SIZE_K(32)>; - }; - }; -}; From cf738ac84584ca008ccfbccf46d0773bd0d36393 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:48 +0300 Subject: [PATCH 1196/2141] Revert "[nrf fromtree] boards: nordic: nrf54l15: Change to use common dts partitioning file" This reverts commit a72fadce3c365308402894aea22c83bf96226157. Signed-off-by: Jukka Rissanen --- .../bl54l15_dvk_nrf54l15_cpuapp.dts | 40 ++++++++++++++++- .../bl54l15_dvk_nrf54l15_cpuapp.yaml | 2 +- .../bl54l15u_dvk_nrf54l15_cpuapp.dts | 40 ++++++++++++++++- .../bl54l15u_dvk_nrf54l15_cpuapp.yaml | 2 +- .../nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp.dts | 41 +++++++++++++++++- .../nrf54l15dk_nrf54l15_cpuapp.yaml | 2 +- .../panb511evb/panb511evb_nrf54l15_cpuapp.dts | 40 ++++++++++++++++- .../panb511evb_nrf54l15_cpuapp.yaml | 2 +- .../raytac_an54l15q_db_nrf54l15_cpuapp.dts | 40 ++++++++++++++++- .../raytac_an54l15q_db_nrf54l15_cpuapp.yaml | 2 +- .../ophelia4ev/ophelia4ev_nrf54l15_cpuapp.dts | 43 +++++++++++++++++-- .../ophelia4ev_nrf54l15_cpuapp.yaml | 2 +- dts/vendor/nordic/nrf54l15_partition.dtsi | 33 -------------- 13 files changed, 237 insertions(+), 52 deletions(-) delete mode 100644 dts/vendor/nordic/nrf54l15_partition.dtsi diff --git a/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l15_cpuapp.dts b/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l15_cpuapp.dts index 50a03e2d48f7..ef92bda99301 100644 --- a/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l15_cpuapp.dts +++ b/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l15_cpuapp.dts @@ -20,5 +20,41 @@ }; }; -/* Include default memory partition configuration file */ -#include +&cpuapp_rram { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x0 DT_SIZE_K(64)>; + }; + + slot0_partition: partition@10000 { + label = "image-0"; + reg = <0x10000 DT_SIZE_K(324)>; + }; + + slot0_ns_partition: partition@61000 { + label = "image-0-nonsecure"; + reg = <0x61000 DT_SIZE_K(324)>; + }; + + slot1_partition: partition@b2000 { + label = "image-1"; + reg = <0xb2000 DT_SIZE_K(324)>; + }; + + slot1_ns_partition: partition@103000 { + label = "image-1-nonsecure"; + reg = <0x103000 DT_SIZE_K(324)>; + }; + + /* 32k from 0x154000 to 0x15bfff reserved for TF-M partitions */ + storage_partition: partition@15c000 { + label = "storage"; + reg = <0x15c000 DT_SIZE_K(36)>; + }; + }; +}; diff --git a/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l15_cpuapp.yaml b/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l15_cpuapp.yaml index 066929a10a6a..abcf0f54482a 100644 --- a/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l15_cpuapp.yaml +++ b/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l15_cpuapp.yaml @@ -11,7 +11,7 @@ toolchain: - zephyr sysbuild: true ram: 188 -flash: 1428 +flash: 324 supported: - adc - counter diff --git a/boards/ezurio/bl54l15u_dvk/bl54l15u_dvk_nrf54l15_cpuapp.dts b/boards/ezurio/bl54l15u_dvk/bl54l15u_dvk_nrf54l15_cpuapp.dts index 00ffc3f5449c..7ea5099aa3f5 100644 --- a/boards/ezurio/bl54l15u_dvk/bl54l15u_dvk_nrf54l15_cpuapp.dts +++ b/boards/ezurio/bl54l15u_dvk/bl54l15u_dvk_nrf54l15_cpuapp.dts @@ -20,5 +20,41 @@ }; }; -/* Include default memory partition configuration file */ -#include +&cpuapp_rram { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x0 DT_SIZE_K(64)>; + }; + + slot0_partition: partition@10000 { + label = "image-0"; + reg = <0x10000 DT_SIZE_K(324)>; + }; + + slot0_ns_partition: partition@61000 { + label = "image-0-nonsecure"; + reg = <0x61000 DT_SIZE_K(324)>; + }; + + slot1_partition: partition@b2000 { + label = "image-1"; + reg = <0xb2000 DT_SIZE_K(324)>; + }; + + slot1_ns_partition: partition@103000 { + label = "image-1-nonsecure"; + reg = <0x103000 DT_SIZE_K(324)>; + }; + + /* 32k from 0x154000 to 0x15bfff reserved for TF-M partitions */ + storage_partition: partition@15c000 { + label = "storage"; + reg = <0x15c000 DT_SIZE_K(36)>; + }; + }; +}; diff --git a/boards/ezurio/bl54l15u_dvk/bl54l15u_dvk_nrf54l15_cpuapp.yaml b/boards/ezurio/bl54l15u_dvk/bl54l15u_dvk_nrf54l15_cpuapp.yaml index d210534c8b55..264368c2baf1 100644 --- a/boards/ezurio/bl54l15u_dvk/bl54l15u_dvk_nrf54l15_cpuapp.yaml +++ b/boards/ezurio/bl54l15u_dvk/bl54l15u_dvk_nrf54l15_cpuapp.yaml @@ -11,7 +11,7 @@ toolchain: - zephyr sysbuild: true ram: 188 -flash: 1428 +flash: 324 supported: - adc - counter diff --git a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp.dts b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp.dts index 6e6629025612..b2d96daa1925 100644 --- a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp.dts +++ b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp.dts @@ -19,5 +19,42 @@ }; }; -/* Include default memory partition configuration file */ -#include +&cpuapp_rram { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x0 DT_SIZE_K(64)>; + }; + + slot0_partition: partition@10000 { + label = "image-0"; + reg = <0x10000 DT_SIZE_K(324)>; + }; + + slot0_ns_partition: partition@61000 { + label = "image-0-nonsecure"; + reg = <0x61000 DT_SIZE_K(324)>; + }; + + slot1_partition: partition@b2000 { + label = "image-1"; + reg = <0xb2000 DT_SIZE_K(324)>; + }; + + slot1_ns_partition: partition@103000 { + label = "image-1-nonsecure"; + reg = <0x103000 DT_SIZE_K(324)>; + }; + + /* 32k from 0x154000 to 0x15bfff reserved for TF-M partitions */ + + storage_partition: partition@15c000 { + label = "storage"; + reg = <0x15c000 DT_SIZE_K(36)>; + }; + }; +}; diff --git a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp.yaml b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp.yaml index e23a2a0073a9..3fbfefe01a39 100644 --- a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp.yaml +++ b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp.yaml @@ -10,7 +10,7 @@ toolchain: - zephyr sysbuild: true ram: 188 -flash: 1428 +flash: 324 supported: - adc - counter diff --git a/boards/panasonic/panb511evb/panb511evb_nrf54l15_cpuapp.dts b/boards/panasonic/panb511evb/panb511evb_nrf54l15_cpuapp.dts index 04616affd146..c79847a3b57b 100644 --- a/boards/panasonic/panb511evb/panb511evb_nrf54l15_cpuapp.dts +++ b/boards/panasonic/panb511evb/panb511evb_nrf54l15_cpuapp.dts @@ -19,5 +19,41 @@ }; }; -/* Include default memory partition configuration file */ -#include +&cpuapp_rram { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x0 DT_SIZE_K(64)>; + }; + + slot0_partition: partition@10000 { + label = "image-0"; + reg = <0x10000 DT_SIZE_K(324)>; + }; + + slot0_ns_partition: partition@61000 { + label = "image-0-nonsecure"; + reg = <0x61000 DT_SIZE_K(324)>; + }; + + slot1_partition: partition@b2000 { + label = "image-1"; + reg = <0xb2000 DT_SIZE_K(324)>; + }; + + slot1_ns_partition: partition@103000 { + label = "image-1-nonsecure"; + reg = <0x103000 DT_SIZE_K(324)>; + }; + + /* 32k from 0x154000 to 0x15bfff reserved for TF-M partitions */ + storage_partition: partition@15c000 { + label = "storage"; + reg = <0x15c000 DT_SIZE_K(36)>; + }; + }; +}; diff --git a/boards/panasonic/panb511evb/panb511evb_nrf54l15_cpuapp.yaml b/boards/panasonic/panb511evb/panb511evb_nrf54l15_cpuapp.yaml index db252d56047d..e911ee9e54c3 100644 --- a/boards/panasonic/panb511evb/panb511evb_nrf54l15_cpuapp.yaml +++ b/boards/panasonic/panb511evb/panb511evb_nrf54l15_cpuapp.yaml @@ -10,7 +10,7 @@ toolchain: - zephyr sysbuild: true ram: 188 -flash: 1428 +flash: 324 supported: - adc - counter diff --git a/boards/raytac/an54l15q_db/raytac_an54l15q_db_nrf54l15_cpuapp.dts b/boards/raytac/an54l15q_db/raytac_an54l15q_db_nrf54l15_cpuapp.dts index d347ef16ac14..d9362a6ddb0e 100644 --- a/boards/raytac/an54l15q_db/raytac_an54l15q_db_nrf54l15_cpuapp.dts +++ b/boards/raytac/an54l15q_db/raytac_an54l15q_db_nrf54l15_cpuapp.dts @@ -21,5 +21,41 @@ }; }; -/* Include default memory partition configuration file */ -#include +&cpuapp_rram { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x0 DT_SIZE_K(64)>; + }; + + slot0_partition: partition@10000 { + label = "image-0"; + reg = <0x10000 DT_SIZE_K(324)>; + }; + + slot0_ns_partition: partition@61000 { + label = "image-0-nonsecure"; + reg = <0x61000 DT_SIZE_K(324)>; + }; + + slot1_partition: partition@b2000 { + label = "image-1"; + reg = <0xb2000 DT_SIZE_K(324)>; + }; + + slot1_ns_partition: partition@103000 { + label = "image-1-nonsecure"; + reg = <0x103000 DT_SIZE_K(324)>; + }; + + /* 32k from 0x154000 to 0x15bfff reserved for TF-M partitions */ + storage_partition: partition@15c000 { + label = "storage"; + reg = <0x15c000 DT_SIZE_K(36)>; + }; + }; +}; diff --git a/boards/raytac/an54l15q_db/raytac_an54l15q_db_nrf54l15_cpuapp.yaml b/boards/raytac/an54l15q_db/raytac_an54l15q_db_nrf54l15_cpuapp.yaml index 7a5e9a84f960..4e3b90674758 100644 --- a/boards/raytac/an54l15q_db/raytac_an54l15q_db_nrf54l15_cpuapp.yaml +++ b/boards/raytac/an54l15q_db/raytac_an54l15q_db_nrf54l15_cpuapp.yaml @@ -12,7 +12,7 @@ toolchain: - zephyr sysbuild: true ram: 188 -flash: 1428 +flash: 324 supported: - adc - counter diff --git a/boards/we/ophelia4ev/ophelia4ev_nrf54l15_cpuapp.dts b/boards/we/ophelia4ev/ophelia4ev_nrf54l15_cpuapp.dts index 2380fcd5b8d3..73b135891a8a 100644 --- a/boards/we/ophelia4ev/ophelia4ev_nrf54l15_cpuapp.dts +++ b/boards/we/ophelia4ev/ophelia4ev_nrf54l15_cpuapp.dts @@ -26,6 +26,46 @@ }; }; +&cpuapp_rram { + partitions { + compatible = "fixed-partitions"; + + #address-cells = <1>; + #size-cells = <1>; + + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x0 DT_SIZE_K(64)>; + }; + + slot0_partition: partition@10000 { + label = "image-0"; + reg = <0x10000 DT_SIZE_K(324)>; + }; + + slot0_ns_partition: partition@61000 { + label = "image-0-nonsecure"; + reg = <0x61000 DT_SIZE_K(324)>; + }; + + slot1_partition: partition@b2000 { + label = "image-1"; + reg = <0xb2000 DT_SIZE_K(324)>; + }; + + slot1_ns_partition: partition@103000 { + label = "image-1-nonsecure"; + reg = <0x103000 DT_SIZE_K(324)>; + }; + + /* 32k from 0x154000 to 0x15bfff reserved for TF-M partitions */ + storage_partition: partition@15c000 { + label = "storage"; + reg = <0x15c000 DT_SIZE_K(36)>; + }; + }; +}; + &cpuapp_sram { status = "okay"; }; @@ -132,6 +172,3 @@ &adc { status = "okay"; }; - -/* Include default memory partition configuration file */ -#include diff --git a/boards/we/ophelia4ev/ophelia4ev_nrf54l15_cpuapp.yaml b/boards/we/ophelia4ev/ophelia4ev_nrf54l15_cpuapp.yaml index 6e8bd507277d..87fee9c3d62b 100644 --- a/boards/we/ophelia4ev/ophelia4ev_nrf54l15_cpuapp.yaml +++ b/boards/we/ophelia4ev/ophelia4ev_nrf54l15_cpuapp.yaml @@ -10,7 +10,7 @@ toolchain: - zephyr sysbuild: true ram: 188 -flash: 1428 +flash: 324 supported: - adc - counter diff --git a/dts/vendor/nordic/nrf54l15_partition.dtsi b/dts/vendor/nordic/nrf54l15_partition.dtsi deleted file mode 100644 index 4988de3ed544..000000000000 --- a/dts/vendor/nordic/nrf54l15_partition.dtsi +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&cpuapp_rram { - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - boot_partition: partition@0 { - label = "mcuboot"; - reg = <0x0 DT_SIZE_K(64)>; - }; - - slot0_partition: partition@10000 { - label = "image-0"; - reg = <0x10000 DT_SIZE_K(664)>; - }; - - slot1_partition: partition@b6000 { - label = "image-1"; - reg = <0xb6000 DT_SIZE_K(664)>; - }; - - storage_partition: partition@15c000 { - label = "storage"; - reg = <0x15c000 DT_SIZE_K(36)>; - }; - }; -}; From 5cdb48f2065bf914734e692889d5285377987083 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:48 +0300 Subject: [PATCH 1197/2141] Revert "[nrf fromtree] boards: nordic: nrf54l10_cpuapp_ns: Add workaround for partitions" This reverts commit db3708451536f016792c7e6bd7ec2002b956a068. Signed-off-by: Jukka Rissanen --- boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp_ns.dts | 3 --- boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns.dts | 3 --- 2 files changed, 6 deletions(-) diff --git a/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp_ns.dts b/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp_ns.dts index 39a986ae2b67..02d900390cca 100644 --- a/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp_ns.dts +++ b/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp_ns.dts @@ -59,9 +59,6 @@ }; &cpuapp_rram { - /* TODO: revert this hack when TF-M update is available that fixes partition sizes */ - reg = <0x0 DT_SIZE_K(1022)>; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns.dts b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns.dts index cd644d845d5e..f1aa851ed2d9 100644 --- a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns.dts +++ b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns.dts @@ -58,9 +58,6 @@ }; &cpuapp_rram { - /* TODO: revert this hack when TF-M update is available that fixes partition sizes */ - reg = <0x0 DT_SIZE_K(1022)>; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; From bb94dfdd36dceae6ddddc331c2403a23923b3adc Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:48 +0300 Subject: [PATCH 1198/2141] Revert "[nrf fromtree] boards: nordic: nrf54l10: Change to use common dts partitioning file" This reverts commit 9e518534b01e8d2829a3db4baed5fad0a862a479. Signed-off-by: Jukka Rissanen --- .../bl54l15_dvk_nrf54l10_cpuapp.dts | 48 ++++++++++++++++++- .../bl54l15_dvk_nrf54l10_cpuapp.yaml | 2 +- .../nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp.dts | 48 ++++++++++++++++++- .../nrf54l15dk_nrf54l10_cpuapp.yaml | 2 +- dts/vendor/nordic/nrf54l10_partition.dtsi | 38 --------------- 5 files changed, 94 insertions(+), 44 deletions(-) delete mode 100644 dts/vendor/nordic/nrf54l10_partition.dtsi diff --git a/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp.dts b/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp.dts index 0654c4139c5a..3d9336bbeab9 100644 --- a/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp.dts +++ b/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp.dts @@ -26,5 +26,49 @@ ranges = <0x0 0x20000000 DT_SIZE_K(192)>; }; -/* Include default memory partition configuration file */ -#include +&cpuapp_rram { + reg = <0x0 DT_SIZE_K(1022)>; +}; + +/* These partition sizes assume no FLPR area in RRAM */ +&cpuapp_rram { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x0 DT_SIZE_K(64)>; + }; + + slot0_partition: partition@10000 { + label = "image-0"; + reg = <0x10000 DT_SIZE_K(224)>; + }; + + slot0_ns_partition: partition@48000 { + label = "image-0-nonsecure"; + reg = <0x48000 DT_SIZE_K(224)>; + }; + + slot1_partition: partition@80000 { + label = "image-1"; + reg = <0x80000 DT_SIZE_K(224)>; + }; + + slot1_ns_partition: partition@b8000 { + label = "image-1-nonsecure"; + reg = <0xb8000 DT_SIZE_K(224)>; + }; + + /* 32K from 0xf0000 to 0xf7fff reserved for TF-M partitions */ + + storage_partition: partition@f8000 { + label = "storage"; + reg = <0xf8000 DT_SIZE_K(28)>; + }; + + /* 2K from 0xff000 to 0xff7ff unused */ + }; +}; diff --git a/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp.yaml b/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp.yaml index 13bdefd1b7ed..0a53875b7494 100644 --- a/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp.yaml +++ b/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp.yaml @@ -11,7 +11,7 @@ toolchain: - zephyr sysbuild: true ram: 192 -flash: 1012 +flash: 230 supported: - adc - counter diff --git a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp.dts b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp.dts index e3ee6b5434fc..020fdd16af2f 100644 --- a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp.dts +++ b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp.dts @@ -25,5 +25,49 @@ ranges = <0x0 0x20000000 DT_SIZE_K(192)>; }; -/* Include default memory partition configuration file */ -#include +&cpuapp_rram { + reg = <0x0 DT_SIZE_K(1022)>; +}; + +/* These partition sizes assume no FLPR area in RRAM */ +&cpuapp_rram { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x0 DT_SIZE_K(64)>; + }; + + slot0_partition: partition@10000 { + label = "image-0"; + reg = <0x10000 DT_SIZE_K(224)>; + }; + + slot0_ns_partition: partition@48000 { + label = "image-0-nonsecure"; + reg = <0x48000 DT_SIZE_K(224)>; + }; + + slot1_partition: partition@80000 { + label = "image-1"; + reg = <0x80000 DT_SIZE_K(224)>; + }; + + slot1_ns_partition: partition@b8000 { + label = "image-1-nonsecure"; + reg = <0xb8000 DT_SIZE_K(224)>; + }; + + /* 32K from 0xf0000 to 0xf7fff reserved for TF-M partitions */ + + storage_partition: partition@f8000 { + label = "storage"; + reg = <0xf8000 DT_SIZE_K(28)>; + }; + + /* 2K from 0xff000 to 0xff7ff unused */ + }; +}; diff --git a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp.yaml b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp.yaml index 0be5ece7d0eb..d56468281ac4 100644 --- a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp.yaml +++ b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp.yaml @@ -10,7 +10,7 @@ toolchain: - zephyr sysbuild: true ram: 192 -flash: 1012 +flash: 230 supported: - adc - counter diff --git a/dts/vendor/nordic/nrf54l10_partition.dtsi b/dts/vendor/nordic/nrf54l10_partition.dtsi deleted file mode 100644 index e73b1c5f0e3f..000000000000 --- a/dts/vendor/nordic/nrf54l10_partition.dtsi +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&cpuapp_rram { - reg = <0x0 DT_SIZE_K(1012)>; -}; - -/* These partition sizes assume no FLPR area in RRAM */ -&cpuapp_rram { - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - boot_partition: partition@0 { - label = "mcuboot"; - reg = <0x0 DT_SIZE_K(64)>; - }; - - slot0_partition: partition@10000 { - label = "image-0"; - reg = <0x10000 DT_SIZE_K(456)>; - }; - - slot1_partition: partition@82000 { - label = "image-1"; - reg = <0x82000 DT_SIZE_K(456)>; - }; - - storage_partition: partition@f4000 { - label = "storage"; - reg = <0xf4000 DT_SIZE_K(36)>; - }; - }; -}; From 6f85272a77e17d63396235233a46d63d4f9d03fb Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:48 +0300 Subject: [PATCH 1199/2141] Revert "[nrf fromtree] dts: vendor: nordic: nrf54l10: Fix wrong size of NVM" This reverts commit 8620d6150ce43432ac3d140f8abc8c489ff0efcc. Signed-off-by: Jukka Rissanen --- dts/vendor/nordic/nrf54l10.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dts/vendor/nordic/nrf54l10.dtsi b/dts/vendor/nordic/nrf54l10.dtsi index 800c4081f283..a515fbb42f53 100644 --- a/dts/vendor/nordic/nrf54l10.dtsi +++ b/dts/vendor/nordic/nrf54l10.dtsi @@ -25,14 +25,14 @@ }; &cpuapp_rram { - reg = <0x0 DT_SIZE_K(950)>; + reg = <0x0 DT_SIZE_K(960)>; }; -/* 950 + 62 = 1012KB */ +/* 960 + 62 = 1022KB */ &rram_controller { - cpuflpr_rram: rram@ed800 { + cpuflpr_rram: rram@f0000 { compatible = "soc-nv-flash"; - reg = <0xed800 DT_SIZE_K(62)>; + reg = <0xf0000 DT_SIZE_K(62)>; erase-block-size = <4096>; write-block-size = <16>; }; From 5aea0876dd1a8cf6f00680cadbf3f856a4ffea60 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:48 +0300 Subject: [PATCH 1200/2141] Revert "[nrf fromlist] tests: drivers: gpio_basic_api: Add nrf_sense_edge test for nrf54l15dk" This reverts commit 5a47376a429951a35db9fc5d4624bd2af8c63a01. Signed-off-by: Jukka Rissanen --- .../gpio/gpio_basic_api/boards/nrf54l_sense_edge.overlay | 9 --------- tests/drivers/gpio/gpio_basic_api/testcase.yaml | 5 ----- 2 files changed, 14 deletions(-) delete mode 100644 tests/drivers/gpio/gpio_basic_api/boards/nrf54l_sense_edge.overlay diff --git a/tests/drivers/gpio/gpio_basic_api/boards/nrf54l_sense_edge.overlay b/tests/drivers/gpio/gpio_basic_api/boards/nrf54l_sense_edge.overlay deleted file mode 100644 index 59839fa9265b..000000000000 --- a/tests/drivers/gpio/gpio_basic_api/boards/nrf54l_sense_edge.overlay +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&gpio1 { - sense-edge-mask = <0xC00>; -}; diff --git a/tests/drivers/gpio/gpio_basic_api/testcase.yaml b/tests/drivers/gpio/gpio_basic_api/testcase.yaml index 805579296876..325b22efa1c0 100644 --- a/tests/drivers/gpio/gpio_basic_api/testcase.yaml +++ b/tests/drivers/gpio/gpio_basic_api/testcase.yaml @@ -24,11 +24,6 @@ tests: extra_args: "DTC_OVERLAY_FILE=boards/nrf52840dk_nrf52840.overlay;\ boards/nrf52840dk_nrf52840_sense_edge.overlay" - drivers.gpio.nrf_sense_edge.nrf54l: - platform_allow: - - nrf54l15dk/nrf54l15/cpuapp - extra_args: "EXTRA_DTC_OVERLAY_FILE=boards/nrf54l_sense_edge.overlay" - drivers.gpio.mr_canhubk3_wkpu: platform_allow: mr_canhubk3 extra_args: "DTC_OVERLAY_FILE=boards/mr_canhubk3_wkpu.overlay" From fd53793dc9a531c6a8986ef658ad0ddf6c6fc5f3 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:48 +0300 Subject: [PATCH 1201/2141] Revert "[nrf fromtree] tests: drivers: flash: Add MSPI flash test in single I/O mode" This reverts commit 8ec7d71d0755163e82eec1b8e88ecd7b2f8fdfc7. Signed-off-by: Jukka Rissanen --- .../common/boards/mx25uw63_single_io.overlay | 62 ------------------- tests/drivers/flash/common/testcase.yaml | 5 -- 2 files changed, 67 deletions(-) delete mode 100644 tests/drivers/flash/common/boards/mx25uw63_single_io.overlay diff --git a/tests/drivers/flash/common/boards/mx25uw63_single_io.overlay b/tests/drivers/flash/common/boards/mx25uw63_single_io.overlay deleted file mode 100644 index a24ba4e54896..000000000000 --- a/tests/drivers/flash/common/boards/mx25uw63_single_io.overlay +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&pinctrl { - - /delete-node/ exmif_default; - /delete-node/ exmif_sleep; - - exmif_default: exmif_default { - group1 { - psels = , - , - , - , - , - , - , - , - , - ; - nordic,drive-mode = ; - }; - }; - - exmif_sleep: exmif_sleep { - group1 { - low-power-enable; - psels = , - , - , - , - , - , - , - , - , - ; - }; - }; - -}; - -&gpio6 { - status = "okay"; -}; - -&exmif { - status = "okay"; - pinctrl-0 = <&exmif_default>; - pinctrl-1 = <&exmif_sleep>; - pinctrl-names = "default", "sleep"; - ce-gpios = <&gpio6 3 GPIO_ACTIVE_LOW>; -}; - -&mx25uw63 { - status = "okay"; - mspi-max-frequency = ; - mspi-io-mode = "MSPI_IO_MODE_SINGLE"; -}; diff --git a/tests/drivers/flash/common/testcase.yaml b/tests/drivers/flash/common/testcase.yaml index 0a35ec04cd95..0433d024ff15 100644 --- a/tests/drivers/flash/common/testcase.yaml +++ b/tests/drivers/flash/common/testcase.yaml @@ -151,8 +151,3 @@ tests: extra_args: - DTC_OVERLAY_FILE="./boards/${BOARD}_ospi_b_nor.overlay" - CONF_FILE="./prj.conf ./boards/${BOARD}_ospi_b_nor.conf" - drivers.flash.common.mspi_single_io: - platform_allow: - - nrf54h20dk/nrf54h20/cpuapp - extra_args: - - EXTRA_DTC_OVERLAY_FILE=boards/mx25uw63_single_io.overlay From 008cce68cc4a0b947e61997bde3f3d1275570efe Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:48 +0300 Subject: [PATCH 1202/2141] Revert "[nrf fromlist] drivers: serial: nrfx_uarte: Add mode with TIMER byte counting" This reverts commit 2b7fae8f92faf11993a2fbaee758c56f48bbd060. Signed-off-by: Jukka Rissanen --- drivers/serial/Kconfig.nrfx | 26 - drivers/serial/Kconfig.nrfx_uart_instance | 7 - drivers/serial/uart_nrfx_uarte.c | 1028 ++------------------- 3 files changed, 88 insertions(+), 973 deletions(-) diff --git a/drivers/serial/Kconfig.nrfx b/drivers/serial/Kconfig.nrfx index 7baa53b9c420..8bcb9e49b662 100644 --- a/drivers/serial/Kconfig.nrfx +++ b/drivers/serial/Kconfig.nrfx @@ -78,32 +78,6 @@ config UART_ASYNC_TX_CACHE_SIZE in RAM, because EasyDMA in UARTE peripherals can only transfer data from RAM. -config UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER - bool "Use TIMER to count RX bytes" - depends on UART_ASYNC_API - depends on UART_NRFX_UARTE_LEGACY_SHIM - depends on !ARCH_POSIX # Mode not supported on BSIM target - select NRFX_GPPI - -config UART_NRFX_UARTE_BOUNCE_BUF_LEN - int "RX bounce buffer size" - depends on UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER - default 256 - range 64 1024 - help - Buffer is used when workaround with bounce buffers is applied - -config UART_NRFX_UARTE_BOUNCE_BUF_SWAP_LATENCY - int "RX bounce buffer swap latency (in microseconds)" - depends on UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER - default 300 - help - Option decides how long before current bounce buffer is filled driver - attempts to swap the buffer. It must be long enough to ensure that - space following the buffer is not overwritten. Too high value results - in more frequent buffer swaps so it impacts performance. Setting should - take into account potential interrupt handling latency. - config UART_NRFX_UARTE_DIRECT_ISR bool "Use direct ISR" diff --git a/drivers/serial/Kconfig.nrfx_uart_instance b/drivers/serial/Kconfig.nrfx_uart_instance index 82ffaa10fcb9..b1a68d691c45 100644 --- a/drivers/serial/Kconfig.nrfx_uart_instance +++ b/drivers/serial/Kconfig.nrfx_uart_instance @@ -18,13 +18,6 @@ config UART_$(nrfx_uart_num)_ASYNC help This option enables UART Asynchronous API support on port $(nrfx_uart_num). -config UART_$(nrfx_uart_num)_COUNT_BYTES_WITH_TIMER - bool - depends on $(dt_nodelabel_has_prop,uart$(nrfx_uart_num),timer) - depends on HAS_HW_NRF_UARTE$(nrfx_uart_num) - default y - imply UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER - config UART_$(nrfx_uart_num)_ENHANCED_POLL_OUT bool "Efficient poll out on port $(nrfx_uart_num)" depends on !$(dt_nodelabel_bool_prop,uart$(nrfx_uart_num),endtx-stoptx-supported) diff --git a/drivers/serial/uart_nrfx_uarte.c b/drivers/serial/uart_nrfx_uarte.c index 149a48d88b27..995d11134733 100644 --- a/drivers/serial/uart_nrfx_uarte.c +++ b/drivers/serial/uart_nrfx_uarte.c @@ -188,16 +188,6 @@ BUILD_ASSERT(IS_ENABLED(CONFIG_CLOCK_CONTROL)); /* Size of hardware fifo in RX path. */ #define UARTE_HW_RX_FIFO_SIZE 5 -/* TIMER CC channels for counting bytes with TIMER. */ -/* Channel used for capturing current counter value. */ -#define UARTE_TIMER_CAPTURE_CH 0 -/* Channel used to get compare event when number of received bytes reaches user buffer size. */ -#define UARTE_TIMER_USR_CNT_CH 1 -/* Channel used to get compare event when bounce buffer need to be switched. */ -#define UARTE_TIMER_BUF_SWITCH_CH 2 -/* Magic byte that is used to fill the buffer. */ -#define UARTE_MAGIC_BYTE 0xAA - #ifdef UARTE_ANY_ASYNC struct uarte_async_tx { @@ -211,30 +201,6 @@ struct uarte_async_tx { bool pending; }; -/* Structure with data for Count Bytes With Timer receiver mode (cbwt). */ -struct uarte_async_rx_cbwt { - uint8_t *curr_bounce_buf; - uint8_t *anomaly_byte_addr; - uint32_t usr_rd_off; - uint32_t usr_wr_off; - uint32_t bounce_off; - uint32_t bounce_limit; - uint32_t last_cnt; - uint32_t cc_usr; - uint32_t cc_swap; -#ifdef CONFIG_UART_USE_RUNTIME_CONFIGURE - size_t bounce_buf_swap_len; -#endif -#ifdef UARTE_ANY_CACHE - uint8_t *anomaly_byte_dst; - uint8_t anomaly_byte; -#endif - uint8_t bounce_idx; - uint8_t ppi_ch; - bool in_irq; - bool discard_fifo; -}; - struct uarte_async_rx { struct k_timer timer; #ifdef CONFIG_HAS_NORDIC_DMM @@ -246,9 +212,8 @@ struct uarte_async_rx { size_t offset; uint8_t *next_buf; size_t next_buf_len; -#if defined(CONFIG_UART_NRFX_UARTE_ENHANCED_RX) || \ - defined(CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER) -#if !defined(UARTE_HAS_FRAME_TIMEOUT) || defined(CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER) +#ifdef CONFIG_UART_NRFX_UARTE_ENHANCED_RX +#if !defined(UARTE_HAS_FRAME_TIMEOUT) uint32_t idle_cnt; #endif k_timeout_t timeout; @@ -321,10 +286,6 @@ struct uarte_nrfx_data { #define UARTE_FLAG_POLL_OUT BIT(3) /* Flag indicating that a workaround for not working frame timeout is active. */ #define UARTE_FLAG_FTIMEOUT_WATCH BIT(4) -/* Flag indicating that UART_RX_BUF_REQUEST event need to be called from the interrupt context. */ -#define UARTE_FLAG_RX_BUF_REQ BIT(5) -/* Flag indicating that CC value in TIMER was set too late. */ -#define UARTE_FLAG_LATE_CC BIT(6) /* If enabled then ENDTX is PPI'ed to TXSTOP */ #define UARTE_CFG_FLAG_PPI_ENDTX BIT(0) @@ -343,12 +304,6 @@ struct uarte_nrfx_data { /* Indicates that workaround for spurious RXTO during restart shall be applied. */ #define UARTE_CFG_FLAG_SPURIOUS_RXTO BIT(3) -/* Indicates that UARTE/TIMER interrupt priority differs from system clock (GRTC/RTC). */ -#define UARTE_CFG_FLAG_VAR_IRQ BIT(4) - -/* Indicates that instance needs special handling of BAUDRATE register. */ -#define UARTE_CFG_FLAG_VOLATILE_BAUDRATE BIT(5) - /* Formula for getting the baudrate settings is following: * 2^12 * (2^20 / (f_PCLK / desired_baudrate)) where f_PCLK is a frequency that * drives the UARTE. @@ -385,14 +340,6 @@ struct uarte_nrfx_data { (baudrate) == 921600 ? NRF_UARTE_BAUDRATE_921600 : \ (baudrate) == 1000000 ? NRF_UARTE_BAUDRATE_1000000 : 0) -#define UARTE_MIN_BUF_SWAP_LEN 10 - -#define UARTE_US_TO_BYTES(baudrate) \ - DIV_ROUND_UP((CONFIG_UART_NRFX_UARTE_BOUNCE_BUF_SWAP_LATENCY * baudrate), 10000000) - -#define UARTE_BUF_SWAP_LEN(bounce_buf_len, baudrate) \ - ((bounce_buf_len) - MAX(UARTE_MIN_BUF_SWAP_LEN, UARTE_US_TO_BYTES(baudrate))) - #define LOW_POWER_ENABLED(_config) \ (IS_ENABLED(UARTE_ANY_LOW_POWER) && \ !IS_ENABLED(CONFIG_PM_DEVICE) && \ @@ -439,15 +386,6 @@ struct uarte_nrfx_config { #endif /* CONFIG_UART_USE_RUNTIME_CONFIGURE */ #ifdef UARTE_ANY_ASYNC -#ifdef CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER - NRF_TIMER_Type * timer_regs; - IRQn_Type timer_irqn; - IRQn_Type uarte_irqn; - uint8_t *bounce_buf[2]; - size_t bounce_buf_len; - size_t bounce_buf_swap_len; - struct uarte_async_rx_cbwt *cbwt_data; -#endif nrfx_timer_t timer; uint8_t *tx_cache; uint8_t *rx_flush_buf; @@ -467,12 +405,6 @@ struct uarte_nrfx_config { (IS_ENABLED(UARTE_ANY_HW_ASYNC) ? \ (config->flags & UARTE_CFG_FLAG_HW_BYTE_COUNTING) : false) -/* Determine if instance is using an approach with counting bytes with TIMER (cbwt). */ -#define IS_CBWT(dev) \ - COND_CODE_1(CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER, \ - ((((const struct uarte_nrfx_config *)dev->config)->cbwt_data != NULL)), \ - (false)) - static inline NRF_UARTE_Type *get_uarte_instance(const struct device *dev) { const struct uarte_nrfx_config *config = dev->config; @@ -669,23 +601,10 @@ static int baudrate_set(const struct device *dev, uint32_t baudrate) return -EINVAL; } -#ifdef CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER - if (IS_CBWT(dev)) { - struct uarte_async_rx_cbwt *cbwt_data = config->cbwt_data; - - cbwt_data->bounce_buf_swap_len = UARTE_BUF_SWAP_LEN(config->bounce_buf_len, - baudrate); - } -#endif - #ifdef UARTE_BAUDRATE_RETENTION_WORKAROUND - if (config->flags & UARTE_CFG_FLAG_VOLATILE_BAUDRATE) { - struct uarte_nrfx_data *data = dev->data; + struct uarte_nrfx_data *data = dev->data; - data->nrf_baudrate = nrf_baudrate; - } else { - nrf_uarte_baudrate_set(get_uarte_instance(dev), nrf_baudrate); - } + data->nrf_baudrate = nrf_baudrate; #else nrf_uarte_baudrate_set(get_uarte_instance(dev), nrf_baudrate); #endif @@ -873,11 +792,9 @@ static void uarte_periph_enable(const struct device *dev) } #endif #if UARTE_BAUDRATE_RETENTION_WORKAROUND - if (config->flags & UARTE_CFG_FLAG_VOLATILE_BAUDRATE) { - nrf_uarte_baudrate_set(uarte, - COND_CODE_1(CONFIG_UART_USE_RUNTIME_CONFIGURE, - (data->nrf_baudrate), (config->nrf_baudrate))); - } + nrf_uarte_baudrate_set(uarte, + COND_CODE_1(CONFIG_UART_USE_RUNTIME_CONFIGURE, + (data->nrf_baudrate), (config->nrf_baudrate))); #endif #ifdef UARTE_ANY_ASYNC @@ -977,17 +894,13 @@ static void rx_buf_release(const struct device *dev, uint8_t *buf) user_callback(dev, &evt); } -static void rx_disable_finalize(const struct device *dev) +static void notify_rx_disable(const struct device *dev) { const struct uarte_nrfx_config *cfg = dev->config; - struct uarte_nrfx_data *data = dev->data; - struct uarte_async_rx *async_rx = &data->async->rx; struct uart_event evt = { .type = UART_RX_DISABLED, }; - async_rx->enabled = false; - if (LOW_POWER_ENABLED(cfg)) { uint32_t key = irq_lock(); @@ -1005,42 +918,28 @@ static void rx_disable_finalize(const struct device *dev) } } -static int rx_disable(const struct device *dev, bool api) +static int uarte_nrfx_rx_disable(const struct device *dev) { struct uarte_nrfx_data *data = dev->data; struct uarte_async_rx *async_rx = &data->async->rx; NRF_UARTE_Type *uarte = get_uarte_instance(dev); int key; + if (async_rx->buf == NULL) { + return -EFAULT; + } + k_timer_stop(&async_rx->timer); key = irq_lock(); -#ifdef CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER - const struct uarte_nrfx_config *cfg = dev->config; - struct uarte_async_rx_cbwt *cbwt_data = cfg->cbwt_data; - - if (cbwt_data) { - nrf_timer_event_clear(cfg->timer_regs, - nrf_timer_compare_event_get(UARTE_TIMER_BUF_SWITCH_CH)); - nrf_timer_event_clear(cfg->timer_regs, - nrf_timer_compare_event_get(UARTE_TIMER_USR_CNT_CH)); - nrf_timer_int_disable(cfg->timer_regs, - nrf_timer_compare_int_get(UARTE_TIMER_BUF_SWITCH_CH) | - nrf_timer_compare_int_get(UARTE_TIMER_USR_CNT_CH)); - nrf_uarte_shorts_disable(cfg->uarte_regs, NRF_UARTE_SHORT_ENDRX_STARTRX); - } -#endif - if (async_rx->next_buf != NULL) { nrf_uarte_shorts_disable(uarte, NRF_UARTE_SHORT_ENDRX_STARTRX); nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_RXSTARTED); } async_rx->enabled = false; - if (api) { - async_rx->discard_fifo = true; - } + async_rx->discard_fifo = true; nrf_uarte_task_trigger(uarte, NRF_UARTE_TASK_STOPRX); irq_unlock(key); @@ -1048,18 +947,6 @@ static int rx_disable(const struct device *dev, bool api) return 0; } -static int uarte_nrfx_rx_disable(const struct device *dev) -{ - struct uarte_nrfx_data *data = dev->data; - struct uarte_async_rx *async_rx = &data->async->rx; - - if (async_rx->buf == NULL) { - return -EFAULT; - } - - return rx_disable(dev, true); -} - #if !defined(CONFIG_UART_NRFX_UARTE_ENHANCED_RX) static void timer_handler(nrf_timer_event_t event_type, void *p_context) { } @@ -1084,10 +971,10 @@ static int uarte_nrfx_rx_counting_init(const struct device *dev) if (ret != NRFX_SUCCESS) { LOG_ERR("Timer already initialized"); return -EINVAL; + } else { + nrfx_timer_clear(&cfg->timer); } - nrfx_timer_clear(&cfg->timer); - ret = nrfx_gppi_channel_alloc(&data->async->rx.cnt.ppi); if (ret != NRFX_SUCCESS) { LOG_ERR("Failed to allocate PPI Channel"); @@ -1105,653 +992,6 @@ static int uarte_nrfx_rx_counting_init(const struct device *dev) } #endif /* !defined(CONFIG_UART_NRFX_UARTE_ENHANCED_RX) */ -#ifdef CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER - -static uint32_t get_byte_cnt(NRF_TIMER_Type *timer) -{ - nrf_timer_task_trigger(timer, nrf_timer_capture_task_get(UARTE_TIMER_CAPTURE_CH)); - - nrf_barrier_w(); - - return nrf_timer_cc_get(timer, UARTE_TIMER_CAPTURE_CH); -} - -static void rx_buf_req(const struct device *dev) -{ - struct uart_event evt = { - .type = UART_RX_BUF_REQUEST, - }; - - user_callback(dev, &evt); -} - -static bool notify_rx_rdy(const struct device *dev) -{ - const struct uarte_nrfx_config *cfg = dev->config; - struct uarte_nrfx_data *data = dev->data; - struct uarte_async_rx *async_rx = &data->async->rx; - struct uarte_async_rx_cbwt *cbwt_data = cfg->cbwt_data; - size_t len = cbwt_data->usr_wr_off - cbwt_data->usr_rd_off; - - if (len == 0) { - return async_rx->buf != NULL; - } - - struct uart_event evt = { - .type = UART_RX_RDY, - .data.rx.buf = async_rx->buf, - .data.rx.len = len, - .data.rx.offset = cbwt_data->usr_rd_off - }; - user_callback(dev, &evt); - cbwt_data->usr_rd_off += len; - - if (cbwt_data->usr_rd_off == async_rx->buf_len) { - rx_buf_release(dev, async_rx->buf); - async_rx->buf = async_rx->next_buf; - async_rx->buf_len = async_rx->next_buf_len; - async_rx->next_buf_len = 0; - async_rx->next_buf = 0; - cbwt_data->usr_rd_off = 0; - cbwt_data->usr_wr_off = 0; - - if (async_rx->buf_len == 0) { - return false; - } - - /* Set past value to ensure that event will not expire after clearing but - * before setting the new value. - */ - nrf_timer_cc_set(cfg->timer_regs, UARTE_TIMER_USR_CNT_CH, cbwt_data->cc_usr - 1); - nrf_timer_event_clear(cfg->timer_regs, - nrf_timer_compare_event_get(UARTE_TIMER_USR_CNT_CH)); - cbwt_data->cc_usr += async_rx->buf_len; - nrf_timer_cc_set(cfg->timer_regs, UARTE_TIMER_USR_CNT_CH, cbwt_data->cc_usr); - - /* Check if CC is already in the past. In that case trigger CC handling.*/ - if (cbwt_data->cc_usr <= get_byte_cnt(cfg->timer_regs)) { - atomic_or(&data->flags, UARTE_FLAG_LATE_CC); - NRFX_IRQ_PENDING_SET(cfg->timer_irqn); - } else { - atomic_and(&data->flags, ~UARTE_FLAG_LATE_CC); - } - } - - return true; -} - -static void anomaly_byte_handle(const struct device *dev) -{ - const struct uarte_nrfx_config *cfg = dev->config; - struct uarte_async_rx_cbwt *cbwt_data = cfg->cbwt_data; - uint8_t curr_byte, anomaly_byte; - uint32_t diff; - - if (cbwt_data->anomaly_byte_addr == NULL) { - return; - } - - diff = cfg->uarte_regs->DMA.RX.PTR - (uint32_t)cbwt_data->curr_bounce_buf; - /* Anomaly can be checked only if more than 1 byte is received to the current buffer. */ - if (diff < 2) { - return; - } - - if (IS_ENABLED(UARTE_ANY_CACHE) && (cfg->flags & UARTE_CFG_FLAG_CACHEABLE)) { - sys_cache_data_invd_range(cbwt_data->curr_bounce_buf, 1); - sys_cache_data_invd_range(cbwt_data->anomaly_byte_addr, 1); - } - - curr_byte = cbwt_data->curr_bounce_buf[0]; - anomaly_byte = *cbwt_data->anomaly_byte_addr; - if ((curr_byte == UARTE_MAGIC_BYTE) && (anomaly_byte != UARTE_MAGIC_BYTE)) { -#ifdef UARTE_ANY_CACHE - if (cfg->flags & UARTE_CFG_FLAG_CACHEABLE) { - /* We cannot write directly to curr_bounce_buf as it is written by - * DMA and with cache operations data may be overwritten. Copying - * need to be postponed to the moment when user buffer is filled. - */ - cbwt_data->anomaly_byte = anomaly_byte; - cbwt_data->anomaly_byte_dst = &cbwt_data->curr_bounce_buf[0]; - } else { - cbwt_data->curr_bounce_buf[0] = anomaly_byte; - } -#else - cbwt_data->curr_bounce_buf[0] = anomaly_byte; -#endif - } - - cbwt_data->anomaly_byte_addr = NULL; -} - -static uint32_t fill_usr_buf(const struct device *dev, uint32_t len) -{ - const struct uarte_nrfx_config *cfg = dev->config; - struct uarte_nrfx_data *data = dev->data; - struct uarte_async_rx *async_rx = &data->async->rx; - struct uarte_async_rx_cbwt *cbwt_data = cfg->cbwt_data; - - uint8_t *buf = cfg->bounce_buf[cbwt_data->bounce_idx]; - uint32_t usr_rem = async_rx->buf_len - cbwt_data->usr_wr_off; - uint32_t bounce_rem = cbwt_data->bounce_limit - cbwt_data->bounce_off; - uint32_t cpy_len = MIN(bounce_rem, MIN(usr_rem, len)); - - __ASSERT(cpy_len + cbwt_data->bounce_off <= cfg->bounce_buf_len, - "Exceeding the buffer cpy_len:%d off:%d limit:%d", - cpy_len, cbwt_data->bounce_off, cbwt_data->bounce_limit); - - if (IS_ENABLED(UARTE_ANY_CACHE) && (cfg->flags & UARTE_CFG_FLAG_CACHEABLE)) { - sys_cache_data_invd_range(&buf[cbwt_data->bounce_off], cpy_len); - } - - memcpy(&async_rx->buf[cbwt_data->usr_wr_off], &buf[cbwt_data->bounce_off], cpy_len); -#ifdef UARTE_ANY_CACHE - if ((buf == cbwt_data->anomaly_byte_dst) && (cbwt_data->bounce_off == 0)) { - async_rx->buf[cbwt_data->usr_wr_off] = cbwt_data->anomaly_byte; - cbwt_data->anomaly_byte_dst = NULL; - } -#endif - cbwt_data->bounce_off += cpy_len; - cbwt_data->usr_wr_off += cpy_len; - cbwt_data->last_cnt += cpy_len; - if (cbwt_data->bounce_off == cbwt_data->bounce_limit) { - /* Bounce buffer drained */ - cbwt_data->bounce_idx = cbwt_data->bounce_idx == 0 ? 1 : 0; - cbwt_data->bounce_off = 0; - cbwt_data->bounce_limit = cfg->bounce_buf_len; - } - - return cpy_len; -} - -static bool update_usr_buf(const struct device *dev, uint32_t len, bool notify_any, bool buf_req) -{ - const struct uarte_nrfx_config *cfg = dev->config; - struct uarte_nrfx_data *data = dev->data; - struct uarte_async_rx *async_rx = &data->async->rx; - struct uarte_async_rx_cbwt *cbwt_data = cfg->cbwt_data; - - anomaly_byte_handle(dev); - - do { - uint32_t cpy_len = len ? fill_usr_buf(dev, len) : 0; - bool usr_buf_full = cbwt_data->usr_wr_off == async_rx->buf_len; - - len -= cpy_len; - if (((len == 0) && notify_any) || usr_buf_full) { - if (!notify_rx_rdy(dev)) { - return false; - } - - if (usr_buf_full && buf_req) { - rx_buf_req(dev); - } - } - } while (len > 0); - - return true; -} - -static void prepare_bounce_buf(const struct device *dev, uint8_t *buf, - size_t swap_len, size_t len) -{ - const struct uarte_nrfx_config *cfg = dev->config; - - buf[0] = UARTE_MAGIC_BYTE; - for (size_t i = swap_len; i < len; i++) { - buf[i] = UARTE_MAGIC_BYTE; - } - - if (IS_ENABLED(UARTE_ANY_CACHE) && (cfg->flags & UARTE_CFG_FLAG_CACHEABLE)) { - sys_cache_data_flush_range(buf, 1); - sys_cache_data_flush_range(&buf[swap_len], len); - } -} - -/* This function is responsible for swapping the bounce buffer and it is the most - * tricky part of the solution. Receiver is continuously working and we want to - * change DMA pointer on the fly. DMA is also incrementing that pointer so there are - * moments in the reception when updating the pointer will result in different behavior. - * - * There are two main cases that need to be handled: - * 1. PTR is updated and there was no byte boundary (in the middle of a byte or there is - * no byte on the line). It is a safe spot. - * - * The most common and simplest case. PTR is update but since - * DMA already started the reception of the previous byte it means that next byte will - * be stored in the previous PTR and bytes following that byte will be stored to the - * new bounce buffer - * - * 2. Updating the pointer collided with byte boundary. - * - * RXDRDY and RXSTARTED events are used to detect if collision occurred. - * There are few scenarios that may happen and the driver must detect which one occurred. - * Detection is done by reading back the PTR register. Following cases are considered: - * - * - PTR did not change. It means that it was written after byte boundary. It is the same - * case as if PTR was updated in the safe spot. - * - * - PTR is updated by 1. There is an anomaly and it is unclear where next byte will be - * copied. PTR state indicates that it should be copied to the beginning of the new - * bounce buffer but it might be copied to the previous bounce buffer. Both locations - * are written with a magic byte (0xAA) and later on it is checked which location has - * changed and if byte was written to the previous bounce buffer it is copied to the - * start of the new bounce buffer. - * - * - PTR is not updated with the new bounce buffer location. DMA is incrementing PTR content - * and it is possible that SW writes new value between read and modify and DMA may - * overwrite value written by the driver. In that case reception continuous to the - * previous bounce buffer and swap procedure need to be repeated. - */ -static int bounce_buf_swap(const struct device *dev, uint8_t *prev_bounce_buf) -{ - const struct uarte_nrfx_config *cfg = dev->config; - struct uarte_async_rx_cbwt *cbwt_data = cfg->cbwt_data; - uint32_t prev_buf_cnt, new_cnt, cnt, ptr; - uint32_t prev_buf_inc = 1; - int key; - - key = irq_lock(); - /* Clear events that indicates byte boundary and set PTR. If events are set - * after PTR is set then we know that setting PTR collided with byte boundary. - */ - nrf_uarte_event_clear(cfg->uarte_regs, NRF_UARTE_EVENT_RXSTARTED); - nrf_uarte_event_clear(cfg->uarte_regs, NRF_UARTE_EVENT_RXDRDY); - cfg->uarte_regs->DMA.RX.PTR = (uint32_t)cbwt_data->curr_bounce_buf; - cnt = get_byte_cnt(cfg->timer_regs); - - if (!nrf_uarte_event_check(cfg->uarte_regs, NRF_UARTE_EVENT_RXDRDY) && - !nrf_uarte_event_check(cfg->uarte_regs, NRF_UARTE_EVENT_RXSTARTED)) { - /* RXDRDY did not happen when PTR was set. Safest case. PTR was updated - * correctly. Last byte will be received to the previous buffer. - */ - new_cnt = 0; - prev_buf_cnt = cnt - cbwt_data->last_cnt; - goto no_collision; - } - - /* Setting PTR collided with byte boundary we need to detect what happened. */ - while (!nrf_uarte_event_check(cfg->uarte_regs, NRF_UARTE_EVENT_RXSTARTED)) { - } - - /* Read pointer when there is no new byte coming. */ - do { - cnt = get_byte_cnt(cfg->timer_regs); - ptr = cfg->uarte_regs->DMA.RX.PTR; - } while (cnt != get_byte_cnt(cfg->timer_regs)); - - new_cnt = ptr - (uint32_t)cbwt_data->curr_bounce_buf; - prev_buf_cnt = cnt - cbwt_data->last_cnt; - - if (new_cnt == 0) { - /* New PTR is not incremented. It was written after LIST post ENDRX - * incrementation. - */ - } else if (new_cnt == 1) { - /* new_cnt == 1. New PTR incremented. It's possible that data is already - * copied to that new location or it is written to the tail of the previous - * bounce buffer. We try to detect what happens. - */ - prev_buf_inc = 0; - cbwt_data->anomaly_byte_addr = - &prev_bounce_buf[cbwt_data->bounce_off + prev_buf_cnt]; - } else if (new_cnt <= cfg->bounce_buf_len) { - prev_buf_inc = 0; - prev_buf_cnt = cnt - cbwt_data->last_cnt - (new_cnt - 1); - } else { - /* New PTR value is not set. Re-set PTR is needed. Transfer continues to - * previous buffer whole buffer swapping need to be repeat. - */ - irq_unlock(key); - return -EAGAIN; - } - -no_collision: - cbwt_data->bounce_limit = cbwt_data->bounce_off + prev_buf_cnt + prev_buf_inc; - __ASSERT(cbwt_data->bounce_limit < cfg->bounce_buf_len, - "Too high limit (%d, max:%d), increase latency", - cbwt_data->bounce_limit, cfg->bounce_buf_len); - irq_unlock(key); - - return prev_buf_cnt; -} - -static size_t get_swap_len(const struct device *dev) -{ - const struct uarte_nrfx_config *cfg = dev->config; -#ifdef CONFIG_UART_USE_RUNTIME_CONFIGURE - struct uarte_async_rx_cbwt *cbwt_data = cfg->cbwt_data; - - return cbwt_data->bounce_buf_swap_len; -#else - return cfg->bounce_buf_swap_len; -#endif -} - -static void bounce_buf_switch(const struct device *dev) -{ - const struct uarte_nrfx_config *cfg = dev->config; - struct uarte_async_rx_cbwt *cbwt_data = cfg->cbwt_data; - int new_data = cbwt_data->cc_swap - cbwt_data->last_cnt; - uint8_t *prev_bounce_buf = cbwt_data->curr_bounce_buf; - int prev_cnt; - - /* Fill user buffer with all pending data. */ - if (!update_usr_buf(dev, new_data < 0 ? 0 : new_data, false, true)) { - rx_disable(dev, false); - return; - } - - cbwt_data->curr_bounce_buf = (cbwt_data->curr_bounce_buf == cfg->bounce_buf[0]) ? - cfg->bounce_buf[1] : cfg->bounce_buf[0]; - prepare_bounce_buf(dev, cbwt_data->curr_bounce_buf, get_swap_len(dev), - cfg->bounce_buf_len); - - /* Swapping may need retry. */ - while ((prev_cnt = bounce_buf_swap(dev, prev_bounce_buf)) < 0) { - } - - /* Update user buffer with data that was received during swapping. */ - if (update_usr_buf(dev, prev_cnt, false, true)) { - /* Set compare event for next moment when bounce buffers need to be swapped. */ - cbwt_data->cc_swap += get_swap_len(dev); - __ASSERT(cbwt_data->cc_swap > get_byte_cnt(cfg->timer_regs), - "Setting CC too late next:%d cnt:%d", - cbwt_data->cc_swap, get_byte_cnt(cfg->timer_regs)); - nrf_timer_cc_set(cfg->timer_regs, UARTE_TIMER_BUF_SWITCH_CH, cbwt_data->cc_swap); - } else { - /* Stop RX. */ - rx_disable(dev, false); - } -} - -static void usr_buf_complete(const struct device *dev) -{ - const struct uarte_nrfx_config *cfg = dev->config; - struct uarte_nrfx_data *data = dev->data; - struct uarte_async_rx *async_rx = &data->async->rx; - struct uarte_async_rx_cbwt *cbwt_data = cfg->cbwt_data; - uint32_t rem = async_rx->buf_len - cbwt_data->usr_wr_off; - - __ASSERT_NO_MSG(rem <= (get_byte_cnt(cfg->timer_regs) - cbwt_data->last_cnt)); - - if (!update_usr_buf(dev, rem, true, true)) { - /* Stop RX if there is no next buffer. */ - rx_disable(dev, false); - } -} - -static void notify_new_data(const struct device *dev, bool buf_req) -{ - const struct uarte_nrfx_config *cfg = dev->config; - struct uarte_async_rx_cbwt *cbwt_data = cfg->cbwt_data; - uint32_t cnt = get_byte_cnt(cfg->timer_regs); - uint32_t new_data = cnt - cbwt_data->last_cnt; - - (void)update_usr_buf(dev, new_data, true, buf_req); -} - -static void cbwt_rx_timeout(struct k_timer *timer) -{ - const struct device *dev = k_timer_user_data_get(timer); - const struct uarte_nrfx_config *cfg = dev->config; - struct uarte_nrfx_data *data = dev->data; - struct uarte_async_rx_cbwt *cbwt_data = cfg->cbwt_data; - struct uarte_async_rx *async_rx = &data->async->rx; - - if (nrf_uarte_event_check(cfg->uarte_regs, NRF_UARTE_EVENT_RXDRDY)) { - nrf_uarte_event_clear(cfg->uarte_regs, NRF_UARTE_EVENT_RXDRDY); - async_rx->idle_cnt = 0; - } else { - async_rx->idle_cnt++; - if (async_rx->idle_cnt == (RX_TIMEOUT_DIV - 1)) { - if (cfg->flags & UARTE_CFG_FLAG_VAR_IRQ) { - if (cbwt_data->in_irq) { - /* TIMER or UARTE interrupt preempted. Lets try again - * later. - */ - k_timer_start(timer, async_rx->timeout, K_NO_WAIT); - return; - } - irq_disable(cfg->uarte_irqn); - irq_disable(cfg->timer_irqn); - } - - nrf_uarte_int_enable(cfg->uarte_regs, NRF_UARTE_INT_RXDRDY_MASK); - notify_new_data(dev, true); - - if (cfg->flags & UARTE_CFG_FLAG_VAR_IRQ) { - irq_enable(cfg->uarte_irqn); - irq_enable(cfg->timer_irqn); - } - return; - } - } - - k_timer_start(timer, async_rx->timeout, K_NO_WAIT); -} - -static void cbwt_rx_flush_handle(const struct device *dev) -{ - const struct uarte_nrfx_config *cfg = dev->config; - NRF_UARTE_Type *uarte = get_uarte_instance(dev); - struct uarte_async_rx_cbwt *cbwt_data = cfg->cbwt_data; - uint32_t rem_data = get_byte_cnt(cfg->timer_regs) - cbwt_data->last_cnt; - uint32_t bbuf_rem_data = cbwt_data->bounce_limit - cbwt_data->bounce_off; - uint32_t amount; - uint8_t *dst; - - nrf_uarte_rx_buffer_set(uarte, cfg->rx_flush_buf, UARTE_HW_RX_FIFO_SIZE); - nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_RXSTARTED); - nrf_uarte_task_trigger(uarte, NRF_UARTE_TASK_FLUSHRX); - while (!nrf_uarte_event_check(uarte, NRF_UARTE_EVENT_ENDRX)) { - /* empty */ - } - - nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_ENDRX); - if (!nrf_uarte_event_check(uarte, NRF_UARTE_EVENT_RXSTARTED)) { - /* FIFO is empty. */ - return; - } - - nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_RXSTARTED); - amount = nrf_uarte_rx_amount_get(uarte); - - if (rem_data <= bbuf_rem_data) { - /* instead of -1 it should be -amount but RXDRDY event is not generated - * for bytes following first that goes to FIFO they are generated during flushing. - */ - dst = &cfg->bounce_buf[cbwt_data->bounce_idx][cbwt_data->bounce_off + rem_data - 1]; - } else { - /* See comment in if clause. */ - dst = &cbwt_data->curr_bounce_buf[rem_data - bbuf_rem_data - 1]; - } - - if (IS_ENABLED(UARTE_ANY_CACHE) && (cfg->flags & UARTE_CFG_FLAG_CACHEABLE)) { - sys_cache_data_invd_range(cfg->rx_flush_buf, amount); - sys_cache_data_invd_range(dst, amount); - } - - memcpy(dst, cfg->rx_flush_buf, amount); -} - -static void cbwt_rxto_isr(const struct device *dev, bool do_flush) -{ - const struct uarte_nrfx_config *cfg = dev->config; - struct uarte_nrfx_data *data = dev->data; - struct uarte_async_rx *async_rx = &data->async->rx; - struct uarte_async_rx_cbwt *cbwt_data = cfg->cbwt_data; - - if (async_rx->buf) { - notify_new_data(dev, false); - } - - if (async_rx->buf) { - rx_buf_release(dev, async_rx->buf); - async_rx->buf = NULL; - } - - if (async_rx->next_buf) { - rx_buf_release(dev, async_rx->next_buf); - async_rx->next_buf = NULL; - } - - if (do_flush) { - cbwt_rx_flush_handle(dev); - } - - if (async_rx->discard_fifo) { - cbwt_data->discard_fifo = async_rx->discard_fifo; - async_rx->discard_fifo = false; - } - nrf_timer_task_trigger(cfg->timer_regs, NRF_TIMER_TASK_STOP); - rx_disable_finalize(dev); -} - -static bool timer_ch_evt_check_clear(NRF_TIMER_Type *timer, uint32_t ch) -{ - nrf_timer_event_t evt = nrf_timer_compare_event_get(ch); - - if (nrf_timer_event_check(timer, evt)) { - nrf_timer_event_clear(timer, evt); - return true; - } - - return false; -} - -static void timer_isr(const void *arg) -{ - const struct device *dev = arg; - const struct uarte_nrfx_config *cfg = dev->config; - struct uarte_nrfx_data *data = dev->data; - struct uarte_async_rx_cbwt *cbwt_data = cfg->cbwt_data; - static const uint32_t flags_to_check = UARTE_FLAG_RX_BUF_REQ | - UARTE_FLAG_TRIG_RXTO | - UARTE_FLAG_LATE_CC; - uint32_t flags = atomic_and(&data->flags, ~flags_to_check); - - cbwt_data->in_irq = true; - - if (timer_ch_evt_check_clear(cfg->timer_regs, UARTE_TIMER_USR_CNT_CH) || - (flags & UARTE_FLAG_LATE_CC)) { - usr_buf_complete(dev); - } - - /* Must be after user buf complet CC handling. */ - if (timer_ch_evt_check_clear(cfg->timer_regs, UARTE_TIMER_BUF_SWITCH_CH)) { - bounce_buf_switch(dev); - } - - if (flags & UARTE_FLAG_RX_BUF_REQ) { - rx_buf_req(dev); - } - - if (flags & UARTE_FLAG_TRIG_RXTO) { - cbwt_rxto_isr(dev, false); - } - - cbwt_data->in_irq = false; -} - -static void cbwt_rx_enable(const struct device *dev, bool with_timeout) -{ - const struct uarte_nrfx_config *cfg = dev->config; - struct uarte_nrfx_data *data = dev->data; - struct uarte_async_rx *async_rx = &data->async->rx; - struct uarte_async_rx_cbwt *cbwt_data = cfg->cbwt_data; - uint32_t rem_data; - uint32_t len = async_rx->buf_len; - uint32_t rx_int_mask = NRF_UARTE_INT_RXTO_MASK | - (with_timeout ? NRF_UARTE_INT_RXDRDY_MASK : 0); - - if (cbwt_data->discard_fifo) { - rem_data = 0; - cbwt_data->discard_fifo = false; - } else { - rem_data = get_byte_cnt(cfg->timer_regs) - cbwt_data->last_cnt; - } - - cbwt_data->usr_rd_off = 0; - cbwt_data->usr_wr_off = 0; - - if (rem_data >= len) { - atomic_or(&data->flags, UARTE_FLAG_TRIG_RXTO); - NRFX_IRQ_PENDING_SET(cfg->timer_irqn); - return; - } else if (rem_data) { - (void)update_usr_buf(dev, rem_data, false, true); - len -= rem_data; - } - - prepare_bounce_buf(dev, cfg->bounce_buf[0], get_swap_len(dev), cfg->bounce_buf_len); - - cbwt_data->last_cnt = 0; - cbwt_data->bounce_off = 0; - cbwt_data->bounce_idx = 0; - cbwt_data->curr_bounce_buf = cfg->bounce_buf[0]; - cbwt_data->bounce_limit = cfg->bounce_buf_len; - /* Enable ArrayList. */ - nrf_uarte_shorts_enable(cfg->uarte_regs, NRF_UARTE_SHORT_ENDRX_STARTRX); - nrf_uarte_event_clear(cfg->uarte_regs, NRF_UARTE_EVENT_RXDRDY); - nrf_uarte_int_enable(cfg->uarte_regs, rx_int_mask); - nrf_uarte_rx_buffer_set(cfg->uarte_regs, cbwt_data->curr_bounce_buf, 1); - - nrf_timer_event_clear(cfg->timer_regs, - nrf_timer_compare_event_get(UARTE_TIMER_BUF_SWITCH_CH)); - nrf_timer_event_clear(cfg->timer_regs, - nrf_timer_compare_event_get(UARTE_TIMER_USR_CNT_CH)); - nrf_timer_int_enable(cfg->timer_regs, - nrf_timer_compare_int_get(UARTE_TIMER_BUF_SWITCH_CH) | - nrf_timer_compare_int_get(UARTE_TIMER_USR_CNT_CH)); - nrf_timer_task_trigger(cfg->timer_regs, NRF_TIMER_TASK_CLEAR); - nrf_timer_task_trigger(cfg->timer_regs, NRF_TIMER_TASK_START); - cbwt_data->cc_usr = len; - cbwt_data->cc_swap = get_swap_len(dev); - nrf_timer_cc_set(cfg->timer_regs, UARTE_TIMER_BUF_SWITCH_CH, get_swap_len(dev)); - nrf_timer_cc_set(cfg->timer_regs, UARTE_TIMER_USR_CNT_CH, len); - - atomic_or(&data->flags, UARTE_FLAG_RX_BUF_REQ); - nrf_uarte_task_trigger(cfg->uarte_regs, NRF_UARTE_TASK_STARTRX); - NRFX_IRQ_PENDING_SET(cfg->timer_irqn); -} - -static int cbwt_uarte_async_init(const struct device *dev) -{ - /* As this approach does not use nrfx_timer driver but only HAL special setup - * function is used. - */ - const struct uarte_nrfx_config *cfg = dev->config; - struct uarte_async_rx_cbwt *cbwt_data = cfg->cbwt_data; - static const uint32_t rx_int_mask = NRF_UARTE_INT_ERROR_MASK | - NRF_UARTE_INT_RXTO_MASK; - uint32_t evt = nrf_uarte_event_address_get(cfg->uarte_regs, NRF_UARTE_EVENT_RXDRDY); - uint32_t tsk = nrf_timer_task_address_get(cfg->timer_regs, NRF_TIMER_TASK_COUNT); - nrfx_err_t ret; - - nrf_timer_mode_set(cfg->timer_regs, NRF_TIMER_MODE_COUNTER); - nrf_timer_bit_width_set(cfg->timer_regs, NRF_TIMER_BIT_WIDTH_32); - - ret = nrfx_gppi_channel_alloc(&cbwt_data->ppi_ch); - if (ret != NRFX_SUCCESS) { - return -ENOMEM; - } - - nrfx_gppi_channel_endpoints_setup(cbwt_data->ppi_ch, evt, tsk); - nrfx_gppi_channels_enable(BIT(cbwt_data->ppi_ch)); - -#ifdef CONFIG_UART_USE_RUNTIME_CONFIGURE - cbwt_data->bounce_buf_swap_len = cfg->bounce_buf_swap_len; -#endif - - /* Enable EasyDMA LIST feature (it is exposed in SPIM but not in UARTE). */ - *(volatile uint32_t *)((uint32_t)cfg->uarte_regs + 0x714) = 1; - nrf_uarte_int_enable(cfg->uarte_regs, rx_int_mask); - - return 0; -} -#endif /* CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER */ - static int uarte_async_init(const struct device *dev) { struct uarte_nrfx_data *data = dev->data; @@ -1764,17 +1004,6 @@ static int uarte_async_init(const struct device *dev) ((IS_ENABLED(CONFIG_UART_NRFX_UARTE_ENHANCED_RX) && !IS_ENABLED(UARTE_HAS_FRAME_TIMEOUT)) ? NRF_UARTE_INT_RXDRDY_MASK : 0); - k_timer_init(&data->async->rx.timer, rx_timeout, NULL); - k_timer_user_data_set(&data->async->rx.timer, (void *)dev); - k_timer_init(&data->async->tx.timer, tx_timeout, NULL); - k_timer_user_data_set(&data->async->tx.timer, (void *)dev); - -#ifdef CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER - if (IS_CBWT(dev)) { - return cbwt_uarte_async_init(dev); - } -#endif - #if !defined(CONFIG_UART_NRFX_UARTE_ENHANCED_RX) int ret = uarte_nrfx_rx_counting_init(dev); @@ -1785,6 +1014,11 @@ static int uarte_async_init(const struct device *dev) nrf_uarte_int_enable(uarte, rx_int_mask); + k_timer_init(&data->async->rx.timer, rx_timeout, NULL); + k_timer_user_data_set(&data->async->rx.timer, (void *)dev); + k_timer_init(&data->async->tx.timer, tx_timeout, NULL); + k_timer_user_data_set(&data->async->tx.timer, (void *)dev); + return 0; } @@ -1933,7 +1167,6 @@ static uint32_t us_to_bauds(uint32_t baudrate, int32_t timeout) } #endif - static int uarte_nrfx_rx_enable(const struct device *dev, uint8_t *buf, size_t len, int32_t timeout) @@ -1943,11 +1176,6 @@ static int uarte_nrfx_rx_enable(const struct device *dev, uint8_t *buf, const struct uarte_nrfx_config *cfg = dev->config; NRF_UARTE_Type *uarte = get_uarte_instance(dev); -#if defined(CONFIG_UART_NRFX_UARTE_ENHANCED_RX) || \ - defined(CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER) - bool with_timeout = timeout != SYS_FOREVER_US; -#endif - if (cfg->disable_rx) { __ASSERT(false, "TX only UARTE instance"); return -ENOTSUP; @@ -1962,45 +1190,35 @@ static int uarte_nrfx_rx_enable(const struct device *dev, uint8_t *buf, } #ifdef CONFIG_HAS_NORDIC_DMM - if (!IS_CBWT(dev)) { - void *dma_buf; - int ret = 0; + uint8_t *dma_buf; + int ret = 0; - ret = dmm_buffer_in_prepare(cfg->mem_reg, buf, len, &dma_buf); - if (ret < 0) { - return ret; - } - - async_rx->usr_buf = buf; - buf = dma_buf; + ret = dmm_buffer_in_prepare(cfg->mem_reg, buf, len, (void **)&dma_buf); + if (ret < 0) { + return ret; } -#endif -#if defined(CONFIG_UART_NRFX_UARTE_ENHANCED_RX) || \ - defined(CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER) + async_rx->usr_buf = buf; + buf = dma_buf; +#endif +#ifdef CONFIG_UART_NRFX_UARTE_ENHANCED_RX #ifdef UARTE_HAS_FRAME_TIMEOUT - if (!IS_CBWT(dev) && with_timeout) { + if (timeout != SYS_FOREVER_US) { uint32_t baudrate = COND_CODE_1(CONFIG_UART_USE_RUNTIME_CONFIGURE, - (data->uart_config.baudrate), (cfg->baudrate)); + (data->uart_config.baudrate), (cfg->baudrate)); + + async_rx->timeout = K_USEC(timeout); nrf_uarte_frame_timeout_set(uarte, us_to_bauds(baudrate, timeout)); nrf_uarte_shorts_enable(uarte, NRF_UARTE_SHORT_FRAME_TIMEOUT_STOPRX); - } -#endif -#if !defined(UARTE_HAS_FRAME_TIMEOUT) || defined(CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER) - async_rx->idle_cnt = 0; -#endif - - if (with_timeout) { - if (!IS_CBWT(dev) && IS_ENABLED(UARTE_HAS_FRAME_TIMEOUT)) { - async_rx->timeout = K_USEC(timeout); - } else { - async_rx->timeout = with_timeout ? - K_USEC(timeout / RX_TIMEOUT_DIV) : K_NO_WAIT; - } } else { async_rx->timeout = K_NO_WAIT; } +#else + async_rx->timeout = (timeout == SYS_FOREVER_US) ? + K_NO_WAIT : K_USEC(timeout / RX_TIMEOUT_DIV); + async_rx->idle_cnt = 0; +#endif /* UARTE_HAS_FRAME_TIMEOUT */ #else async_rx->timeout_us = timeout; async_rx->timeout_slab = timeout / RX_TIMEOUT_DIV; @@ -2028,20 +1246,8 @@ static int uarte_nrfx_rx_enable(const struct device *dev, uint8_t *buf, } } pm_device_runtime_get(dev); - } else if (LOW_POWER_ENABLED(cfg)) { - unsigned int key = irq_lock(); - - uarte_enable_locked(dev, UARTE_FLAG_LOW_POWER_RX); - irq_unlock(key); } -#ifdef CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER - if (IS_CBWT(dev)) { - cbwt_rx_enable(dev, with_timeout); - return 0; - } -#endif - if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME) || LOW_POWER_ENABLED(cfg)) { if (async_rx->flush_cnt) { int cpy_len = MIN(len, async_rx->flush_cnt); @@ -2078,7 +1284,7 @@ static int uarte_nrfx_rx_enable(const struct device *dev, uint8_t *buf, return 0; } else { #ifdef CONFIG_UART_NRFX_UARTE_ENHANCED_RX - if (with_timeout) { + if (!K_TIMEOUT_EQ(async_rx->timeout, K_NO_WAIT)) { nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_RXDRDY); k_timer_start(&async_rx->timer, async_rx->timeout, K_NO_WAIT); @@ -2103,6 +1309,13 @@ static int uarte_nrfx_rx_enable(const struct device *dev, uint8_t *buf, async_rx->enabled = true; + if (LOW_POWER_ENABLED(cfg)) { + unsigned int key = irq_lock(); + + uarte_enable_locked(dev, UARTE_FLAG_LOW_POWER_RX); + irq_unlock(key); + } + nrf_uarte_task_trigger(uarte, NRF_UARTE_TASK_STARTRX); return 0; @@ -2121,33 +1334,29 @@ static int uarte_nrfx_rx_buf_rsp(const struct device *dev, uint8_t *buf, err = -EACCES; } else if (async_rx->next_buf == NULL) { #ifdef CONFIG_HAS_NORDIC_DMM - if (!IS_CBWT(dev)) { - uint8_t *dma_buf; - const struct uarte_nrfx_config *config = dev->config; + uint8_t *dma_buf; + const struct uarte_nrfx_config *config = dev->config; - err = dmm_buffer_in_prepare(config->mem_reg, buf, len, (void **)&dma_buf); - if (err < 0) { - return err; - } - async_rx->next_usr_buf = buf; - buf = dma_buf; + err = dmm_buffer_in_prepare(config->mem_reg, buf, len, (void **)&dma_buf); + if (err < 0) { + return err; } + async_rx->next_usr_buf = buf; + buf = dma_buf; #endif async_rx->next_buf = buf; async_rx->next_buf_len = len; - if (!IS_CBWT(dev)) { - nrf_uarte_rx_buffer_set(uarte, buf, len); - /* If buffer is shorter than RX FIFO then there is a risk that due - * to interrupt handling latency ENDRX event is not handled on time - * and due to ENDRX_STARTRX short data will start to be overwritten. - * In that case short is not enabled and ENDRX event handler will - * manually start RX for that buffer. Thanks to RX FIFO there is - * 5 byte time for doing that. If interrupt latency is higher and - * there is no HWFC in both cases data will be lost or corrupted. - */ - if (len >= UARTE_HW_RX_FIFO_SIZE) { - nrf_uarte_shorts_enable(uarte, NRF_UARTE_SHORT_ENDRX_STARTRX); - } + nrf_uarte_rx_buffer_set(uarte, buf, len); + /* If buffer is shorter than RX FIFO then there is a risk that due + * to interrupt handling latency ENDRX event is not handled on time + * and due to ENDRX_STARTRX short data will start to be overwritten. + * In that case short is not enabled and ENDRX event handler will + * manually start RX for that buffer. Thanks to RX FIFO there is + * 5 byte time for doing that. If interrupt latency is higher and + * there is no HWFC in both cases data will be lost or corrupted. + */ + if (len >= UARTE_HW_RX_FIFO_SIZE) { + nrf_uarte_shorts_enable(uarte, NRF_UARTE_SHORT_ENDRX_STARTRX); } err = 0; } else { @@ -2197,13 +1406,6 @@ static void rx_timeout(struct k_timer *timer) NRF_UARTE_Type *uarte = get_uarte_instance(dev); #ifdef UARTE_HAS_FRAME_TIMEOUT -#ifdef CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER - if (IS_CBWT(dev)) { - cbwt_rx_timeout(timer); - return; - } -#endif - struct uarte_nrfx_data *data = dev->data; struct uarte_async_rx *async_rx = &data->async->rx; bool rxdrdy = nrf_uarte_event_check(uarte, NRF_UARTE_EVENT_RXDRDY); @@ -2350,7 +1552,7 @@ static void error_isr(const struct device *dev) nrf_uarte_errorsrc_clear(uarte, err); user_callback(dev, &evt); - (void)rx_disable(dev, false); + (void) uarte_nrfx_rx_disable(dev); } static void rxstarted_isr(const struct device *dev) @@ -2569,6 +1771,7 @@ static void rxto_isr(const struct device *dev) * In the second case, additionally, data from the UARTE internal RX * FIFO need to be discarded. */ + async_rx->enabled = false; if (async_rx->discard_fifo) { async_rx->discard_fifo = false; #if !defined(CONFIG_UART_NRFX_UARTE_ENHANCED_RX) @@ -2596,7 +1799,15 @@ static void rxto_isr(const struct device *dev) #endif nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_RXDRDY); #endif - rx_disable_finalize(dev); + + if (LOW_POWER_ENABLED(config)) { + uint32_t key = irq_lock(); + + uarte_disable_locked(dev, UARTE_FLAG_LOW_POWER_RX); + irq_unlock(key); + } + + notify_rx_disable(dev); } static void txstopped_isr(const struct device *dev) @@ -2686,12 +1897,10 @@ static void txstopped_isr(const struct device *dev) static void rxdrdy_isr(const struct device *dev) { -#if !defined(UARTE_HAS_FRAME_TIMEOUT) || defined(CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER) +#if !defined(UARTE_HAS_FRAME_TIMEOUT) struct uarte_nrfx_data *data = dev->data; -#if defined(CONFIG_UART_NRFX_UARTE_ENHANCED_RX) || \ - defined(CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER) - +#if defined(CONFIG_UART_NRFX_UARTE_ENHANCED_RX) NRF_UARTE_Type *uarte = get_uarte_instance(dev); data->async->rx.idle_cnt = 0; @@ -2723,9 +1932,8 @@ static void uarte_nrfx_isr_async(const void *arg) struct uarte_async_rx *async_rx = &data->async->rx; uint32_t imask = nrf_uarte_int_enable_check(uarte, UINT32_MAX); - if ((IS_CBWT(dev) || - !(HW_RX_COUNTING_ENABLED(config) || IS_ENABLED(UARTE_HAS_FRAME_TIMEOUT))) && - event_check_clear(uarte, NRF_UARTE_EVENT_RXDRDY, NRF_UARTE_INT_RXDRDY_MASK, imask)) { + if (!(HW_RX_COUNTING_ENABLED(config) || IS_ENABLED(UARTE_HAS_FRAME_TIMEOUT)) + && event_check_clear(uarte, NRF_UARTE_EVENT_RXDRDY, NRF_UARTE_INT_RXDRDY_MASK, imask)) { rxdrdy_isr(dev); } @@ -2753,12 +1961,6 @@ static void uarte_nrfx_isr_async(const void *arg) rxstarted_isr(dev); } -#ifdef CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER - if (IS_CBWT(dev) && - event_check_clear(uarte, NRF_UARTE_EVENT_RXTO, NRF_UARTE_INT_RXTO_MASK, imask)) { - cbwt_rxto_isr(dev, true); - } else -#endif /* RXTO must be handled after ENDRX which should notify the buffer. * Skip if ENDRX is set when RXTO is set. It means that * ENDRX occurred after check for ENDRX in isr which may happen when @@ -2783,8 +1985,7 @@ static void uarte_nrfx_isr_async(const void *arg) txstopped_isr(dev); } - if (!IS_CBWT(dev) && - (atomic_and(&data->flags, ~UARTE_FLAG_TRIG_RXTO) & UARTE_FLAG_TRIG_RXTO)) { + if (atomic_and(&data->flags, ~UARTE_FLAG_TRIG_RXTO) & UARTE_FLAG_TRIG_RXTO) { #ifdef CONFIG_HAS_NORDIC_DMM int ret; @@ -2799,7 +2000,7 @@ static void uarte_nrfx_isr_async(const void *arg) rx_buf_release(dev, async_rx->buf); async_rx->buf_len = 0; async_rx->buf = NULL; - rx_disable_finalize(dev); + notify_rx_disable(dev); } } @@ -3413,46 +2614,6 @@ static int uarte_instance_init(const struct device *dev, return pm_device_driver_init(dev, uarte_nrfx_pm_action); } - -#define UARTE_TIMER_REG(idx) (NRF_TIMER_Type *)DT_REG_ADDR(DT_PHANDLE(UARTE(idx), timer)) - -#define UARTE_TIMER_IRQN(idx) DT_IRQN(DT_PHANDLE(UARTE(idx), timer)) - -#define UARTE_TIMER_IRQ_PRIO(idx) DT_IRQ(DT_PHANDLE(UARTE(idx), timer), priority) - -#define UARTE_COUNT_BYTES_WITH_TIMER_CONFIG(idx) \ - IF_ENABLED(UARTE_HAS_PROP(idx, timer), \ - (.timer_regs = UARTE_TIMER_REG(idx), \ - .timer_irqn = UARTE_TIMER_IRQN(idx), \ - .uarte_irqn = DT_IRQN(UARTE(idx)), \ - .bounce_buf = { \ - uart##idx##_bounce_buf, \ - &uart##idx##_bounce_buf[sizeof(uart##idx##_bounce_buf) / 2] \ - }, \ - .bounce_buf_len = sizeof(uart##idx##_bounce_buf) / 2, \ - .bounce_buf_swap_len = UARTE_BUF_SWAP_LEN(sizeof(uart##idx##_bounce_buf) / 2,\ - UARTE_US_TO_BYTES(UARTE_PROP(idx, current_speed))), \ - .cbwt_data = &uart##idx##_bounce_data,)) - -#define UARTE_COUNT_BYTES_WITH_TIMER_VALIDATE_CONFIG(idx) \ - __ASSERT_NO_MSG(UARTE_TIMER_IRQ_PRIO(idx) == DT_IRQ(UARTE(idx), priority)) - -#define UARTE_TIMER_IRQ_CONNECT(idx, func) \ - IF_ENABLED(UTIL_AND(IS_ENABLED(CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER), \ - UARTE_HAS_PROP(idx, timer)), \ - (UARTE_COUNT_BYTES_WITH_TIMER_VALIDATE_CONFIG(idx); \ - IRQ_CONNECT(UARTE_TIMER_IRQN(idx), UARTE_TIMER_IRQ_PRIO(idx), func, \ - DEVICE_DT_GET(UARTE(idx)), 0); \ - irq_enable(UARTE_TIMER_IRQN(idx));)) - -/* Macro sets flag to indicate that uart use different interrupt priority than the system clock. */ -#define UARTE_HAS_VAR_PRIO(idx) \ - COND_CODE_1(UTIL_AND(IS_ENABLED(CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER), \ - UARTE_HAS_PROP(idx, timer)), \ - ((DT_IRQ(UARTE(idx), priority) != DT_IRQ(DT_NODELABEL(grtc), priority)) ? \ - UARTE_CFG_FLAG_VAR_IRQ : 0), (0)) - - #define UARTE_GET_ISR(idx) \ COND_CODE_1(CONFIG_UART_##idx##_ASYNC, (uarte_nrfx_isr_async), (uarte_nrfx_isr_int)) @@ -3468,18 +2629,16 @@ static int uarte_instance_init(const struct device *dev, )) /* Depending on configuration standard or direct IRQ is connected. */ -#define UARTE_IRQ_CONNECT(idx, irqn, prio) \ - COND_CODE_1(CONFIG_UART_NRFX_UARTE_NO_IRQ, (), \ - (COND_CODE_1(CONFIG_UART_NRFX_UARTE_DIRECT_ISR, \ - (IRQ_DIRECT_CONNECT(irqn, prio, uarte_##idx##_direct_isr, 0)), \ - (IRQ_CONNECT(irqn, prio, UARTE_GET_ISR(idx), \ - DEVICE_DT_GET(UARTE(idx)), 0))))) +#define UARTE_IRQ_CONNECT(idx, irqn, prio) \ + COND_CODE_1(CONFIG_UART_NRFX_UARTE_NO_IRQ, (), \ + (COND_CODE_1(CONFIG_UART_NRFX_UARTE_DIRECT_ISR, \ + (IRQ_DIRECT_CONNECT(irqn, prio, uarte_##idx##_direct_isr, 0)), \ + (IRQ_CONNECT(irqn, prio, UARTE_GET_ISR(idx), DEVICE_DT_GET(UARTE(idx)), 0))))) #define UARTE_IRQ_CONFIGURE(idx) \ do { \ UARTE_IRQ_CONNECT(idx, DT_IRQN(UARTE(idx)), DT_IRQ(UARTE(idx), priority)); \ irq_enable(DT_IRQN(UARTE(idx))); \ - UARTE_TIMER_IRQ_CONNECT(idx, timer_isr) \ } while (false) /* Low power mode is used when disable_rx is not defined or in async mode if @@ -3570,12 +2729,6 @@ static int uarte_instance_init(const struct device *dev, UARTE_INT_DRIVEN(idx); \ PINCTRL_DT_DEFINE(UARTE(idx)); \ IF_ENABLED(CONFIG_UART_##idx##_ASYNC, ( \ - IF_ENABLED(UTIL_AND(IS_ENABLED(CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER), \ - UARTE_HAS_PROP(idx, timer)), \ - (static uint8_t uart##idx##_bounce_buf[CONFIG_UART_NRFX_UARTE_BOUNCE_BUF_LEN] \ - DMM_MEMORY_SECTION(UARTE(idx)); \ - static struct uarte_async_rx_cbwt uart##idx##_bounce_data; \ - )) \ static uint8_t \ uarte##idx##_tx_cache[CONFIG_UART_ASYNC_TX_CACHE_SIZE] \ DMM_MEMORY_SECTION(UARTE(idx)); \ @@ -3617,10 +2770,6 @@ static int uarte_instance_init(const struct device *dev, (IS_ENABLED(CONFIG_UART_NRFX_UARTE_SPURIOUS_RXTO_WORKAROUND) && \ INSTANCE_IS_HIGH_SPEED(_, /*empty*/, idx, _) ? \ UARTE_CFG_FLAG_SPURIOUS_RXTO : 0) | \ - ((IS_ENABLED(UARTE_BAUDRATE_RETENTION_WORKAROUND) && \ - UARTE_IS_CACHEABLE(idx)) ? \ - UARTE_CFG_FLAG_VOLATILE_BAUDRATE : 0) | \ - UARTE_HAS_VAR_PRIO(idx) | \ USE_LOW_POWER(idx), \ UARTE_DISABLE_RX_INIT(UARTE(idx)), \ .poll_out_byte = &uarte##idx##_poll_out_byte, \ @@ -3628,8 +2777,6 @@ static int uarte_instance_init(const struct device *dev, IF_ENABLED(CONFIG_UART_##idx##_ASYNC, \ (.tx_cache = uarte##idx##_tx_cache, \ .rx_flush_buf = uarte##idx##_flush_buf,)) \ - IF_ENABLED(CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER, \ - (UARTE_COUNT_BYTES_WITH_TIMER_CONFIG(idx))) \ IF_ENABLED(CONFIG_UART_##idx##_NRF_HW_ASYNC, \ (.timer = NRFX_TIMER_INSTANCE( \ CONFIG_UART_##idx##_NRF_HW_ASYNC_TIMER),)) \ @@ -3681,4 +2828,5 @@ static int uarte_instance_init(const struct device *dev, #define COND_UART_NRF_UARTE_DEVICE(unused, prefix, i, _) \ IF_ENABLED(CONFIG_HAS_HW_NRF_UARTE##prefix##i, (UART_NRF_UARTE_DEVICE(prefix##i);)) + UARTE_FOR_EACH_INSTANCE(COND_UART_NRF_UARTE_DEVICE, (), ()) From ecd49b79e43272ed1ccf98f9cee0476158dbcb45 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:48 +0300 Subject: [PATCH 1203/2141] Revert "[nrf fromlist] drivers: serial: nrfx_uarte: Prepare code for extension" This reverts commit d3fb28f406efd0b218b85a5e749be9a95992260b. Signed-off-by: Jukka Rissanen --- drivers/serial/uart_nrfx_uarte.c | 133 ++++++++++++++----------------- 1 file changed, 61 insertions(+), 72 deletions(-) diff --git a/drivers/serial/uart_nrfx_uarte.c b/drivers/serial/uart_nrfx_uarte.c index 995d11134733..cf864a594297 100644 --- a/drivers/serial/uart_nrfx_uarte.c +++ b/drivers/serial/uart_nrfx_uarte.c @@ -875,78 +875,6 @@ static void tx_start(const struct device *dev, const uint8_t *buf, size_t len) static void rx_timeout(struct k_timer *timer); static void tx_timeout(struct k_timer *timer); -static void user_callback(const struct device *dev, struct uart_event *evt) -{ - struct uarte_nrfx_data *data = dev->data; - - if (data->async->user_callback) { - data->async->user_callback(dev, evt, data->async->user_data); - } -} - -static void rx_buf_release(const struct device *dev, uint8_t *buf) -{ - struct uart_event evt = { - .type = UART_RX_BUF_RELEASED, - .data.rx_buf.buf = buf, - }; - - user_callback(dev, &evt); -} - -static void notify_rx_disable(const struct device *dev) -{ - const struct uarte_nrfx_config *cfg = dev->config; - struct uart_event evt = { - .type = UART_RX_DISABLED, - }; - - if (LOW_POWER_ENABLED(cfg)) { - uint32_t key = irq_lock(); - - uarte_disable_locked(dev, UARTE_FLAG_LOW_POWER_RX); - irq_unlock(key); - } - - user_callback(dev, (struct uart_event *)&evt); - - /* runtime PM is put after the callback. In case uart is re-enabled from that - * callback we avoid suspending/resuming the device. - */ - if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_put_async(dev, K_NO_WAIT); - } -} - -static int uarte_nrfx_rx_disable(const struct device *dev) -{ - struct uarte_nrfx_data *data = dev->data; - struct uarte_async_rx *async_rx = &data->async->rx; - NRF_UARTE_Type *uarte = get_uarte_instance(dev); - int key; - - if (async_rx->buf == NULL) { - return -EFAULT; - } - - k_timer_stop(&async_rx->timer); - - key = irq_lock(); - - if (async_rx->next_buf != NULL) { - nrf_uarte_shorts_disable(uarte, NRF_UARTE_SHORT_ENDRX_STARTRX); - nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_RXSTARTED); - } - - async_rx->enabled = false; - async_rx->discard_fifo = true; - - nrf_uarte_task_trigger(uarte, NRF_UARTE_TASK_STOPRX); - irq_unlock(key); - - return 0; -} - #if !defined(CONFIG_UART_NRFX_UARTE_ENHANCED_RX) static void timer_handler(nrf_timer_event_t event_type, void *p_context) { } @@ -1145,6 +1073,15 @@ static int uarte_nrfx_tx_abort(const struct device *dev) return 0; } +static void user_callback(const struct device *dev, struct uart_event *evt) +{ + struct uarte_nrfx_data *data = dev->data; + + if (data->async->user_callback) { + data->async->user_callback(dev, evt, data->async->user_data); + } +} + static void notify_uart_rx_rdy(const struct device *dev, size_t len) { struct uarte_nrfx_data *data = dev->data; @@ -1158,6 +1095,29 @@ static void notify_uart_rx_rdy(const struct device *dev, size_t len) user_callback(dev, &evt); } +static void rx_buf_release(const struct device *dev, uint8_t *buf) +{ + struct uart_event evt = { + .type = UART_RX_BUF_RELEASED, + .data.rx_buf.buf = buf, + }; + + user_callback(dev, &evt); +} + +static void notify_rx_disable(const struct device *dev) +{ + struct uart_event evt = { + .type = UART_RX_DISABLED, + }; + + user_callback(dev, (struct uart_event *)&evt); + + if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { + pm_device_runtime_put_async(dev, K_NO_WAIT); + } +} + #ifdef UARTE_HAS_FRAME_TIMEOUT static uint32_t us_to_bauds(uint32_t baudrate, int32_t timeout) { @@ -1384,6 +1344,35 @@ static int uarte_nrfx_callback_set(const struct device *dev, return 0; } +static int uarte_nrfx_rx_disable(const struct device *dev) +{ + struct uarte_nrfx_data *data = dev->data; + struct uarte_async_rx *async_rx = &data->async->rx; + NRF_UARTE_Type *uarte = get_uarte_instance(dev); + int key; + + if (async_rx->buf == NULL) { + return -EFAULT; + } + + k_timer_stop(&async_rx->timer); + + key = irq_lock(); + + if (async_rx->next_buf != NULL) { + nrf_uarte_shorts_disable(uarte, NRF_UARTE_SHORT_ENDRX_STARTRX); + nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_RXSTARTED); + } + + async_rx->enabled = false; + async_rx->discard_fifo = true; + + nrf_uarte_task_trigger(uarte, NRF_UARTE_TASK_STOPRX); + irq_unlock(key); + + return 0; +} + static void tx_timeout(struct k_timer *timer) { const struct device *dev = k_timer_user_data_get(timer); From ec3491d99df74bf02ad162157b861f648b195416 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:49 +0300 Subject: [PATCH 1204/2141] Revert "[nrf fromlist] tests: drivers: uart: async_dual: Optimize test data handling" This reverts commit 29526b1e69a2ac46c13da6ca44251bdaa73f14e1. Signed-off-by: Jukka Rissanen --- tests/drivers/uart/uart_async_dual/src/main.c | 152 +++++++----------- 1 file changed, 58 insertions(+), 94 deletions(-) diff --git a/tests/drivers/uart/uart_async_dual/src/main.c b/tests/drivers/uart/uart_async_dual/src/main.c index 160d8c761040..c2ad5d8a0a0c 100644 --- a/tests/drivers/uart/uart_async_dual/src/main.c +++ b/tests/drivers/uart/uart_async_dual/src/main.c @@ -61,25 +61,6 @@ ZTEST_DMEM struct dut_data duts[] = { #endif }; -/* Array that contains potential payload. It is used to memcmp against incoming packets. */ -static const uint8_t test_buf[256] = { - 255, 254, 253, 252, 251, 250, 249, 248, 247, 246, 245, 244, 243, 242, 241, - 240, 239, 238, 237, 236, 235, 234, 233, 232, 231, 230, 229, 228, 227, 226, - 225, 224, 223, 222, 221, 220, 219, 218, 217, 216, 215, 214, 213, 212, 211, - 210, 209, 208, 207, 206, 205, 204, 203, 202, 201, 200, 199, 198, 197, 196, - 195, 194, 193, 192, 191, 190, 189, 188, 187, 186, 185, 184, 183, 182, 181, - 180, 179, 178, 177, 176, 175, 174, 173, 172, 171, 170, 169, 168, 167, 166, - 165, 164, 163, 162, 161, 160, 159, 158, 157, 156, 155, 154, 153, 152, 151, - 150, 149, 148, 147, 146, 145, 144, 143, 142, 141, 140, 139, 138, 137, 136, - 135, 134, 133, 132, 131, 130, 129, 128, 127, 126, 125, 124, 123, 122, 121, - 120, 119, 118, 117, 116, 115, 114, 113, 112, 111, 110, 109, 108, 107, 106, - 105, 104, 103, 102, 101, 100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, - 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, - 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, - 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, - 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, - 9, 8, 7, 6, 5, 4, 3, 2, 1, 0}; - static void pm_check(const struct device *dev, const struct device *second_dev, bool exp_on, int line) { @@ -147,8 +128,6 @@ enum test_rx_mode { RX_ALL, }; -typedef bool (*test_on_rx_rdy_t)(const struct device *dev, uint8_t *buf, size_t len); - struct test_rx_data { uint8_t hdr[1]; uint8_t buf[256]; @@ -161,7 +140,6 @@ struct test_rx_data { struct k_sem sem; uint32_t timeout; uint32_t buf_idx; - test_on_rx_rdy_t on_rx_rdy; }; static struct test_tx_data tx_data; @@ -299,86 +277,75 @@ static void on_tx_done(const struct device *dev, struct uart_event *evt) try_tx(dev, true); } -static bool on_rx_rdy_rx_all(const struct device *dev, uint8_t *buf, size_t len) +static void on_rx_rdy(const struct device *dev, struct uart_event *evt) { - bool ok; - - if (rx_data.payload_idx == 0) { - rx_data.payload_idx = buf[0] - 1; - buf++; - len--; - } - - ok = memcmp(buf, &test_buf[256 - rx_data.payload_idx], len) == 0; - rx_data.payload_idx -= len; - - return ok; -} - -static bool on_rx_rdy_hdr(const struct device *dev, uint8_t *buf, size_t len); - -static bool on_rx_rdy_payload(const struct device *dev, uint8_t *buf, size_t len) -{ - bool ok; + uint32_t len = evt->data.rx.len; + uint32_t off = evt->data.rx.offset; int err; - ok = memcmp(buf, &test_buf[255 - rx_data.payload_idx], len) == 0; - if (!ok) { - for (int i = 0; i < len; i++) { - if (buf[i] != test_buf[255 - rx_data.payload_idx + i]) { - zassert_true(false, "Byte %d expected: %02x got: %02x", - i, buf[i], test_buf[255 - rx_data.payload_idx + i]); - } - } - rx_data.cont = false; - tx_data.cont = false; - zassert_true(ok); - return false; + if (!rx_data.cont) { + return; } - rx_data.payload_idx -= len; - - if (rx_data.payload_idx == 0) { - rx_data.state = RX_HDR; - rx_data.on_rx_rdy = on_rx_rdy_hdr; - if ((rx_data.mode == RX_CONT) && rx_data.buf_req) { - rx_data.buf_req = false; + rx_data.rx_cnt += evt->data.rx.len; + if (evt->data.rx.buf == rx_data.hdr) { + if (rx_data.hdr[0] == 1) { + /* single byte packet. */ err = uart_rx_buf_rsp(dev, rx_data.hdr, 1); zassert_equal(err, 0); + return; } - } - - return true; -} - -static bool on_rx_rdy_hdr(const struct device *dev, uint8_t *buf, size_t len) -{ - int err; - zassert_equal(buf, rx_data.hdr); - zassert_equal(len, 1); - if (rx_data.hdr[0] == 1) { - /* single byte packet. */ + zassert_equal(rx_data.payload_idx, 0); + rx_data.state = RX_PAYLOAD; + rx_data.payload_idx = rx_data.hdr[0] - 1; if ((rx_data.mode == RX_CONT) && rx_data.buf_req) { - err = uart_rx_buf_rsp(dev, rx_data.hdr, 1); - zassert_equal(err, 0); + size_t l = rx_data.hdr[0] - 1; + + zassert_true(l > 0); + rx_data.buf_req = false; + err = uart_rx_buf_rsp(dev, rx_data.buf, rx_data.hdr[0] - 1); } - return true; - } + } else { + for (int i = 0; i < len; i++) { + bool ok; - zassert_equal(rx_data.payload_idx, 0); - rx_data.on_rx_rdy = on_rx_rdy_payload; - rx_data.payload_idx = rx_data.hdr[0] - 1; - rx_data.state = RX_PAYLOAD; - if ((rx_data.mode == RX_CONT) && rx_data.buf_req) { - size_t l = rx_data.hdr[0] - 1; + if ((rx_data.mode == RX_ALL) && (rx_data.payload_idx == 0)) { + rx_data.payload_idx = evt->data.rx.buf[off + i]; + ok = true; + } else { + ok = evt->data.rx.buf[off + i] == (uint8_t)rx_data.payload_idx; + } - zassert_true(l > 0); - rx_data.buf_req = false; - err = uart_rx_buf_rsp(dev, rx_data.buf, buf[0] - 1); - } + if (!ok) { + LOG_ERR("Unexpected data at %d, exp:%02x got:%02x", + i, rx_data.payload_idx, evt->data.rx.buf[off + i]); + } - return true; + zassert_true(ok, "Unexpected data at %d, exp:%02x got:%02x", + i, len - i, evt->data.rx.buf[off + i]); + if (!ok) { + rx_data.cont = false; + tx_data.cont = false; + /* Avoid flood of errors as we are in the interrupt and ztest + * cannot abort from here. + */ + return; + } + rx_data.payload_idx--; + if (rx_data.payload_idx == 0) { + if (rx_data.mode != RX_ALL) { + zassert_equal(i + 1, len, "len:%d i:%d", len, i); + } + rx_data.state = RX_HDR; + if ((rx_data.mode == RX_CONT) && rx_data.buf_req) { + rx_data.buf_req = false; + err = uart_rx_buf_rsp(dev, rx_data.hdr, 1); + zassert_equal(err, 0); + } + } + } + } } static void on_rx_buf_req(const struct device *dev) @@ -418,6 +385,7 @@ static void on_rx_dis(const struct device *dev, struct uart_event *evt, void *us return; } + zassert_true(len > 0); err = uart_rx_enable(dev, buf, len, data->timeout); zassert_equal(err, 0, "Unexpected err:%d", err); @@ -449,11 +417,7 @@ static void uart_callback(const struct device *dev, struct uart_event *evt, void break; case UART_RX_RDY: zassert_true(dev == rx_dev); - if (rx_data.cont) { - rx_data.on_rx_rdy(dev, &evt->data.rx.buf[evt->data.rx.offset], - evt->data.rx.len); - rx_data.rx_cnt += evt->data.rx.len; - } + on_rx_rdy(dev, evt); break; case UART_RX_BUF_RELEASED: zassert_true(dev == rx_dev); @@ -552,7 +516,7 @@ static void var_packet(uint32_t baudrate, enum test_tx_mode tx_mode, tx_data.rx_timeout = rx_data.timeout; rx_data.cont = true; rx_data.rx_cnt = 0; - rx_data.on_rx_rdy = rx_mode == RX_ALL ? on_rx_rdy_rx_all : on_rx_rdy_hdr; + rx_data.state = RX_HDR; rx_data.mode = rx_mode; ring_buf_init(&tx_data.rbuf, sizeof(tx_data.buf), tx_data.buf); From fa12ee094e9d97496e7bddd7a29e9ceae9fc9436 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:49 +0300 Subject: [PATCH 1205/2141] Revert "[nrf fromlist] tests: drivers: uart: async_dual: Extend nrf54h20dk configuration" This reverts commit 95ceeea1d07954d763c357cbe667def4ea1fd17f. Signed-off-by: Jukka Rissanen --- .../boards/nrf54h20dk_nrf54h20_common.dtsi | 22 ------------------- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 12 ---------- 2 files changed, 34 deletions(-) diff --git a/tests/drivers/uart/uart_async_dual/boards/nrf54h20dk_nrf54h20_common.dtsi b/tests/drivers/uart/uart_async_dual/boards/nrf54h20dk_nrf54h20_common.dtsi index 84ad9194e62a..79dac0ca9607 100644 --- a/tests/drivers/uart/uart_async_dual/boards/nrf54h20dk_nrf54h20_common.dtsi +++ b/tests/drivers/uart/uart_async_dual/boards/nrf54h20dk_nrf54h20_common.dtsi @@ -60,16 +60,6 @@ }; }; -&timer134 { - status = "reserved"; -}; - -&dppic135 { - owned-channels = <0>; - source-channels = <0>; - status = "okay"; -}; - dut: &uart134 { status = "okay"; current-speed = <115200>; @@ -77,7 +67,6 @@ dut: &uart134 { pinctrl-1 = <&uart134_alt_sleep>; pinctrl-names = "default", "sleep"; hw-flow-control; - timer = <&timer134>; zephyr,pm-device-runtime-auto; }; @@ -91,23 +80,12 @@ dut_aux: &uart137 { zephyr,pm-device-runtime-auto; }; -&dppic120 { - owned-channels = <0>; - source-channels = <0>; - status = "okay"; -}; - -&timer120 { - status = "reserved"; -}; - dut2: &uart120 { pinctrl-0 = <&uart120_default_alt>; pinctrl-1 = <&uart120_sleep_alt>; pinctrl-names = "default", "sleep"; current-speed = <115200>; hw-flow-control; - timer = <&timer120>; zephyr,pm-device-runtime-auto; }; diff --git a/tests/drivers/uart/uart_async_dual/sysbuild/vpr_launcher/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/uart/uart_async_dual/sysbuild/vpr_launcher/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index 65a2c52016e6..fcdc838a54e4 100644 --- a/tests/drivers/uart/uart_async_dual/sysbuild/vpr_launcher/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/tests/drivers/uart/uart_async_dual/sysbuild/vpr_launcher/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -9,15 +9,3 @@ status = "reserved"; interrupt-parent = <&cpuppr_clic>; }; - -&timer134 { - interrupt-parent = <&cpuppr_clic>; -}; - -&dppic135 { - child-owned-channels = <0>; -}; - -&uart136 { - current-speed = <1000000>; -}; From 2dc89d555a32160d21c1d84a32896d5a4454291e Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:49 +0300 Subject: [PATCH 1206/2141] Revert "[nrf fromlist] tests: drivers: uart: async_dual: Update configuration for nrf54l" This reverts commit 9880309e77a33c49f91906f9355d845f11984432. Signed-off-by: Jukka Rissanen --- .../boards/nrf54l15dk_nrf54l15_cpuapp.overlay | 1 - .../boards/nrf54l15dk_nrf54l15_cpuapp.overlay | 7 ------- 2 files changed, 8 deletions(-) diff --git a/tests/drivers/uart/uart_async_api/boards/nrf54l15dk_nrf54l15_cpuapp.overlay b/tests/drivers/uart/uart_async_api/boards/nrf54l15dk_nrf54l15_cpuapp.overlay index d8995e369711..a1e29cbf0ffc 100644 --- a/tests/drivers/uart/uart_async_api/boards/nrf54l15dk_nrf54l15_cpuapp.overlay +++ b/tests/drivers/uart/uart_async_api/boards/nrf54l15dk_nrf54l15_cpuapp.overlay @@ -42,7 +42,6 @@ dut: &uart21 { pinctrl-1 = <&uart21_sleep_alt>; pinctrl-names = "default", "sleep"; current-speed = <115200>; - timer = <&timer21>; }; dut2: &uart00 { diff --git a/tests/drivers/uart/uart_async_dual/boards/nrf54l15dk_nrf54l15_cpuapp.overlay b/tests/drivers/uart/uart_async_dual/boards/nrf54l15dk_nrf54l15_cpuapp.overlay index 69c5c1830961..cd0649411531 100644 --- a/tests/drivers/uart/uart_async_dual/boards/nrf54l15dk_nrf54l15_cpuapp.overlay +++ b/tests/drivers/uart/uart_async_dual/boards/nrf54l15dk_nrf54l15_cpuapp.overlay @@ -38,10 +38,6 @@ }; }; -&timer21 { - status = "reserved"; -}; - dut: &uart21 { status = "okay"; current-speed = <115200>; @@ -49,8 +45,6 @@ dut: &uart21 { pinctrl-1 = <&uart21_sleep>; pinctrl-names = "default", "sleep"; hw-flow-control; - timer = <&timer21>; - zephyr,pm-device-runtime-auto; }; dut_aux: &uart22 { @@ -60,7 +54,6 @@ dut_aux: &uart22 { pinctrl-1 = <&uart22_sleep>; pinctrl-names = "default", "sleep"; hw-flow-control; - zephyr,pm-device-runtime-auto; }; &timer20 { From d333b48d2069388b08420b5d41c21ede45a2b607 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:49 +0300 Subject: [PATCH 1207/2141] Revert "[nrf fromlist] tests: drivers: uart: async_dual: Extend testing" This reverts commit bac4ea5d135b521c269cbceb231467468e0b49a6. Signed-off-by: Jukka Rissanen --- tests/drivers/uart/uart_async_dual/Kconfig | 8 - tests/drivers/uart/uart_async_dual/src/main.c | 218 ++++-------------- .../uart/uart_async_dual/testcase.yaml | 15 -- 3 files changed, 50 insertions(+), 191 deletions(-) diff --git a/tests/drivers/uart/uart_async_dual/Kconfig b/tests/drivers/uart/uart_async_dual/Kconfig index f0087aa48e3b..6e80ec3a7957 100644 --- a/tests/drivers/uart/uart_async_dual/Kconfig +++ b/tests/drivers/uart/uart_async_dual/Kconfig @@ -16,13 +16,5 @@ config PM_RUNTIME_IN_TEST select PM_DEVICE select PM_DEVICE_RUNTIME -config TEST_CHOPPED_TX - bool "Test chopped TX data" - default y - help - When enabled then test cases that transmits TX packets in random chunks are - performed. Some driver implementation do not support case when new TX data - collides with handling of the RX timeout. - # Include Zephyr's Kconfig source "Kconfig" diff --git a/tests/drivers/uart/uart_async_dual/src/main.c b/tests/drivers/uart/uart_async_dual/src/main.c index c2ad5d8a0a0c..d14e0f88a11e 100644 --- a/tests/drivers/uart/uart_async_dual/src/main.c +++ b/tests/drivers/uart/uart_async_dual/src/main.c @@ -28,10 +28,9 @@ LOG_MODULE_REGISTER(test); #endif #define TX_TIMEOUT 100000 -#define RX_TIMEOUT_BYTES 50 +#define RX_TIMEOUT 2000 #define MAX_PACKET_LEN 128 -#define MIN_PACKET_LEN 10 struct dut_data { const struct device *dev; @@ -101,7 +100,6 @@ static const struct device *tx_dev; enum test_tx_mode { TX_BULK, TX_PACKETS, - TX_CHOPPED, }; struct test_tx_data { @@ -113,8 +111,6 @@ struct test_tx_data { volatile bool cont; volatile enum test_tx_mode mode; struct k_sem sem; - uint32_t idx; - uint32_t rx_timeout; }; enum test_rx_state { @@ -125,21 +121,17 @@ enum test_rx_state { enum test_rx_mode { RX_CONT, RX_DIS, - RX_ALL, }; struct test_rx_data { uint8_t hdr[1]; uint8_t buf[256]; uint32_t rx_cnt; - uint32_t payload_idx; enum test_rx_state state; enum test_rx_mode mode; volatile bool cont; bool buf_req; struct k_sem sem; - uint32_t timeout; - uint32_t buf_idx; }; static struct test_tx_data tx_data; @@ -151,8 +143,8 @@ static void fill_tx(struct test_tx_data *data) uint32_t len; int err; - if (data->mode != TX_BULK) { - err = k_sem_take(&data->sem, K_MSEC(200)); + if (data->mode == TX_PACKETS) { + err = k_sem_take(&data->sem, K_MSEC(100)); if (err < 0 && !data->cont) { return; } @@ -161,10 +153,9 @@ static void fill_tx(struct test_tx_data *data) uint8_t len = sys_rand8_get(); len = len % MAX_PACKET_LEN; - len = MAX(MIN_PACKET_LEN, len); + len = MAX(2, len); data->packet_len = len; - data->idx = 0; for (int i = 0; i < len; i++) { data->buf[i] = len - i; } @@ -172,11 +163,12 @@ static void fill_tx(struct test_tx_data *data) return; } - while ((len = ring_buf_put_claim(&data->rbuf, &buf, 255)) > 0) { + while ((len = ring_buf_put_claim(&data->rbuf, &buf, 255)) > 1) { uint8_t r = (sys_rand8_get() % MAX_PACKET_LEN) % len; - uint8_t packet_len = MAX(r, MIN_PACKET_LEN); + uint8_t packet_len = MAX(r, 2); + uint8_t rem = len - packet_len; - packet_len = (len <= MIN_PACKET_LEN) ? len : packet_len; + packet_len = (rem < 3) ? len : packet_len; buf[0] = packet_len; for (int i = 1; i < packet_len; i++) { buf[i] = packet_len - i; @@ -197,7 +189,7 @@ static void try_tx(const struct device *dev, bool irq) return; } - if (tx_data.mode == TX_PACKETS) { + if ((tx_data.mode == TX_PACKETS) && (tx_data.packet_len > 0)) { uint8_t len = tx_data.packet_len; tx_data.packet_len = 0; @@ -207,50 +199,19 @@ static void try_tx(const struct device *dev, bool irq) err, irq, tx_data.cont); return; } + zassert_true(tx_data.mode == TX_BULK); - if (tx_data.mode == TX_BULK) { - if (!atomic_cas(&tx_data.busy, 0, 1)) { - return; - } - - len = ring_buf_get_claim(&tx_data.rbuf, &buf, 255); - if (len > 0) { - err = uart_tx(dev, buf, len, TX_TIMEOUT); - zassert_equal(err, 0, - "Unexpected err:%d irq:%d cont:%d\n", - err, irq, tx_data.cont); - } else { - tx_data.busy = 0; - } + if (!atomic_cas(&tx_data.busy, 0, 1)) { return; } - zassert_true(tx_data.mode == TX_CHOPPED); - - uint32_t rem = tx_data.packet_len - tx_data.idx; - - if (tx_data.packet_len > 12) { - len = sys_rand8_get() % (tx_data.packet_len / 4); - } else { - len = 0; + len = ring_buf_get_claim(&tx_data.rbuf, &buf, 255); + if (len > 0) { + err = uart_tx(dev, buf, len, TX_TIMEOUT); + zassert_equal(err, 0, + "Unexpected err:%d irq:%d cont:%d\n", + err, irq, tx_data.cont); } - len = MAX(3, len); - len = MIN(rem, len); - - buf = &tx_data.buf[tx_data.idx]; - tx_data.idx += len; - - err = uart_tx(dev, buf, len, TX_TIMEOUT); - zassert_equal(err, 0, - "Unexpected err:%d irq:%d cont:%d\n", - err, irq, tx_data.cont); -} - -static void tx_backoff(uint32_t rx_timeout) -{ - uint32_t delay = (rx_timeout / 2) + (sys_rand32_get() % rx_timeout); - - k_busy_wait(delay); } static void on_tx_done(const struct device *dev, struct uart_event *evt) @@ -260,17 +221,6 @@ static void on_tx_done(const struct device *dev, struct uart_event *evt) return; } - if (tx_data.mode == TX_CHOPPED) { - if (tx_data.idx == tx_data.packet_len) { - k_sem_give(&tx_data.sem); - } else { - - tx_backoff(tx_data.rx_timeout); - try_tx(dev, true); - } - return; - } - /* Finish previous data chunk and start new if any pending. */ ring_buf_get_finish(&tx_data.rbuf, evt->data.tx.len); atomic_set(&tx_data.busy, 0); @@ -289,16 +239,7 @@ static void on_rx_rdy(const struct device *dev, struct uart_event *evt) rx_data.rx_cnt += evt->data.rx.len; if (evt->data.rx.buf == rx_data.hdr) { - if (rx_data.hdr[0] == 1) { - /* single byte packet. */ - err = uart_rx_buf_rsp(dev, rx_data.hdr, 1); - zassert_equal(err, 0); - return; - } - - zassert_equal(rx_data.payload_idx, 0); rx_data.state = RX_PAYLOAD; - rx_data.payload_idx = rx_data.hdr[0] - 1; if ((rx_data.mode == RX_CONT) && rx_data.buf_req) { size_t l = rx_data.hdr[0] - 1; @@ -307,19 +248,16 @@ static void on_rx_rdy(const struct device *dev, struct uart_event *evt) err = uart_rx_buf_rsp(dev, rx_data.buf, rx_data.hdr[0] - 1); } } else { - for (int i = 0; i < len; i++) { - bool ok; + /* Payload received */ + rx_data.state = RX_HDR; + zassert_equal(len, rx_data.hdr[0] - 1); - if ((rx_data.mode == RX_ALL) && (rx_data.payload_idx == 0)) { - rx_data.payload_idx = evt->data.rx.buf[off + i]; - ok = true; - } else { - ok = evt->data.rx.buf[off + i] == (uint8_t)rx_data.payload_idx; - } + for (int i = 0; i < len; i++) { + bool ok = evt->data.rx.buf[off + i] == (uint8_t)(len - i); if (!ok) { LOG_ERR("Unexpected data at %d, exp:%02x got:%02x", - i, rx_data.payload_idx, evt->data.rx.buf[off + i]); + i, len - i, evt->data.rx.buf[off + i]); } zassert_true(ok, "Unexpected data at %d, exp:%02x got:%02x", @@ -332,52 +270,21 @@ static void on_rx_rdy(const struct device *dev, struct uart_event *evt) */ return; } - rx_data.payload_idx--; - if (rx_data.payload_idx == 0) { - if (rx_data.mode != RX_ALL) { - zassert_equal(i + 1, len, "len:%d i:%d", len, i); - } - rx_data.state = RX_HDR; - if ((rx_data.mode == RX_CONT) && rx_data.buf_req) { - rx_data.buf_req = false; - err = uart_rx_buf_rsp(dev, rx_data.hdr, 1); - zassert_equal(err, 0); - } - } + } + if ((rx_data.mode == RX_CONT) && rx_data.buf_req) { + rx_data.buf_req = false; + err = uart_rx_buf_rsp(dev, rx_data.hdr, 1); } } } -static void on_rx_buf_req(const struct device *dev) -{ - if (rx_data.mode != RX_ALL) { - rx_data.buf_req = true; - return; - } - - size_t len = sizeof(rx_data.buf) / 2; - uint8_t *buf = &rx_data.buf[len * rx_data.buf_idx]; - - rx_data.buf_idx = (rx_data.buf_idx + 1) & 0x1; - uart_rx_buf_rsp(dev, buf, len); -} - static void on_rx_dis(const struct device *dev, struct uart_event *evt, void *user_data) { ARG_UNUSED(evt); struct test_rx_data *data = user_data; int err; - uint8_t *buf; - uint32_t len; - - if (data->mode == RX_ALL) { - buf = data->buf; - len = sizeof(data->buf) / 2; - } else { - buf = (data->state == RX_HDR) ? data->hdr : data->buf; - len = (data->state == RX_HDR) ? 1 : (data->hdr[0] - 1); - data->buf_idx = 1; - } + uint8_t *buf = (data->state == RX_HDR) ? data->hdr : data->buf; + uint32_t len = (data->state == RX_HDR) ? 1 : (data->hdr[0] - 1); data->buf_req = false; @@ -387,7 +294,7 @@ static void on_rx_dis(const struct device *dev, struct uart_event *evt, void *us zassert_true(len > 0); - err = uart_rx_enable(dev, buf, len, data->timeout); + err = uart_rx_enable(dev, buf, len, RX_TIMEOUT); zassert_equal(err, 0, "Unexpected err:%d", err); } @@ -423,8 +330,8 @@ static void uart_callback(const struct device *dev, struct uart_event *evt, void zassert_true(dev == rx_dev); break; case UART_RX_BUF_REQUEST: + rx_data.buf_req = true; zassert_true(dev == rx_dev); - on_rx_buf_req(dev); break; case UART_RX_DISABLED: zassert_true(dev == rx_dev); @@ -439,7 +346,7 @@ static void uart_callback(const struct device *dev, struct uart_event *evt, void } } -static void config_baudrate(uint32_t rate, bool hwfc) +static void config_baudrate(uint32_t rate) { struct uart_config config; int err; @@ -447,7 +354,6 @@ static void config_baudrate(uint32_t rate, bool hwfc) err = uart_config_get(rx_dev, &config); zassert_equal(err, 0, "Unexpected err:%d", err); - config.flow_ctrl = hwfc ? UART_CFG_FLOW_CTRL_RTS_CTS : UART_CFG_FLOW_CTRL_NONE; config.baudrate = rate; err = uart_configure(rx_dev, &config); @@ -490,14 +396,13 @@ static void report_progress(uint32_t start) * * Test has busy simulator running if it is enabled in the configuration. */ -static void var_packet(uint32_t baudrate, enum test_tx_mode tx_mode, - enum test_rx_mode rx_mode, bool hwfc) +static void var_packet_hwfc(uint32_t baudrate, bool tx_packets, bool cont) { int err; uint32_t load = 0; uint32_t start = k_uptime_get_32(); - config_baudrate(baudrate, hwfc); + config_baudrate(baudrate); if (IS_ENABLED(CONFIG_TEST_BUSY_SIM)) { uint32_t active_avg = (baudrate == 1000000) ? 5 : 30; @@ -509,15 +414,13 @@ static void var_packet(uint32_t baudrate, enum test_tx_mode tx_mode, memset(&tx_data, 0, sizeof(tx_data)); memset(&rx_data, 0, sizeof(rx_data)); tx_data.cont = true; - tx_data.mode = tx_mode; - k_sem_init(&tx_data.sem, (tx_mode != TX_BULK) ? 1 : 0, 1); + tx_data.mode = tx_packets ? TX_PACKETS : TX_BULK; + k_sem_init(&tx_data.sem, tx_packets ? 1 : 0, 1); - rx_data.timeout = (RX_TIMEOUT_BYTES * 1000000 * 10) / baudrate; - tx_data.rx_timeout = rx_data.timeout; rx_data.cont = true; rx_data.rx_cnt = 0; rx_data.state = RX_HDR; - rx_data.mode = rx_mode; + rx_data.mode = cont ? RX_CONT : RX_DIS; ring_buf_init(&tx_data.rbuf, sizeof(tx_data.buf), tx_data.buf); @@ -556,82 +459,62 @@ static void var_packet(uint32_t baudrate, enum test_tx_mode tx_mode, /* Flush all TX data that may be already started. */ k_msleep(10); - (void)uart_rx_enable(rx_dev, rx_data.buf, sizeof(rx_data.buf), rx_data.timeout); + (void)uart_rx_enable(rx_dev, rx_data.buf, sizeof(rx_data.buf), RX_TIMEOUT); k_msleep(10); (void)uart_rx_disable(rx_dev); k_msleep(10); TC_PRINT("Received %d bytes for %d ms, CPU load:%d.%d\n", rx_data.rx_cnt, CONFIG_UART_ASYNC_DUAL_TEST_TIMEOUT, load / 10, load % 10); - zassert_true(rx_data.rx_cnt > 1000, "Unexpected RX cnt: %d", rx_data.rx_cnt); + zassert_true(rx_data.rx_cnt > 1000, "Unexected RX cnt: %d", rx_data.rx_cnt); } ZTEST(uart_async_dual, test_var_packets_tx_bulk_dis_hwfc) { /* TX in bulk mode, RX in DIS mode, 115k2 */ - var_packet(115200, TX_BULK, RX_DIS, true); + var_packet_hwfc(115200, false, false); } ZTEST(uart_async_dual, test_var_packets_tx_bulk_cont_hwfc) { /* TX in bulk mode, RX in CONT mode, 115k2 */ - var_packet(115200, TX_BULK, RX_CONT, true); + var_packet_hwfc(115200, false, true); } ZTEST(uart_async_dual, test_var_packets_tx_bulk_dis_hwfc_1m) { /* TX in bulk mode, RX in DIS mode, 1M */ - var_packet(1000000, TX_BULK, RX_DIS, true); + var_packet_hwfc(1000000, false, false); } ZTEST(uart_async_dual, test_var_packets_tx_bulk_cont_hwfc_1m) { /* TX in bulk mode, RX in CONT mode, 1M */ - var_packet(1000000, TX_BULK, RX_CONT, true); + var_packet_hwfc(1000000, false, true); } ZTEST(uart_async_dual, test_var_packets_dis_hwfc) { /* TX in packet mode, RX in DIS mode, 115k2 */ - var_packet(115200, TX_PACKETS, RX_DIS, true); + var_packet_hwfc(115200, true, false); } ZTEST(uart_async_dual, test_var_packets_cont_hwfc) { /* TX in packet mode, RX in CONT mode, 115k2 */ - var_packet(115200, TX_PACKETS, RX_CONT, true); + var_packet_hwfc(115200, true, true); } ZTEST(uart_async_dual, test_var_packets_dis_hwfc_1m) { /* TX in packet mode, RX in DIS mode, 1M */ - var_packet(1000000, TX_PACKETS, RX_DIS, true); + var_packet_hwfc(1000000, true, false); } ZTEST(uart_async_dual, test_var_packets_cont_hwfc_1m) { /* TX in packet mode, RX in CONT mode, 1M */ - var_packet(1000000, TX_PACKETS, RX_CONT, true); -} - -ZTEST(uart_async_dual, test_var_packets_chopped_all) -{ - if (!IS_ENABLED(CONFIG_TEST_CHOPPED_TX)) { - ztest_test_skip(); - } - - /* TX in chopped mode, RX in receive ALL mode, 115k2 */ - var_packet(115200, TX_CHOPPED, RX_ALL, false); -} - -ZTEST(uart_async_dual, test_var_packets_chopped_all_1m) -{ - if (!IS_ENABLED(CONFIG_TEST_CHOPPED_TX)) { - ztest_test_skip(); - } - - /* TX in chopped mode, RX in receive ALL mode, 1M */ - var_packet(1000000, TX_CHOPPED, RX_ALL, false); + var_packet_hwfc(1000000, true, true); } static void hci_like_callback(const struct device *dev, struct uart_event *evt, void *user_data) @@ -680,7 +563,7 @@ static bool rx(uint8_t *buf, size_t len) { int err; - err = uart_rx_enable(rx_dev, buf, len, rx_data.timeout); + err = uart_rx_enable(rx_dev, buf, len, RX_TIMEOUT); zassert_equal(err, 0, "Unexpected err:%d", err); err = k_sem_take(&rx_data.sem, K_MSEC(100)); @@ -868,7 +751,7 @@ static void hci_like_test(uint32_t baudrate) int err; uint32_t load = 0; - config_baudrate(baudrate, true); + config_baudrate(baudrate); if (IS_ENABLED(CONFIG_TEST_BUSY_SIM)) { uint32_t active_avg = (baudrate == 1000000) ? 10 : 50; @@ -882,7 +765,6 @@ static void hci_like_test(uint32_t baudrate) tx_data.cnt = 0; tx_data.cont = true; rx_data.cont = true; - rx_data.timeout = (RX_TIMEOUT_BYTES * 1000000 * 10) / baudrate; k_sem_init(&tx_data.sem, 1, 1); k_sem_init(&rx_data.sem, 0, 1); @@ -920,7 +802,7 @@ static void hci_like_test(uint32_t baudrate) k_msleep(10); PM_CHECK(tx_dev, rx_dev, false); - (void)uart_rx_enable(rx_dev, rx_data.buf, sizeof(rx_data.buf), rx_data.timeout); + (void)uart_rx_enable(rx_dev, rx_data.buf, sizeof(rx_data.buf), RX_TIMEOUT); k_msleep(1); (void)uart_rx_disable(rx_dev); diff --git a/tests/drivers/uart/uart_async_dual/testcase.yaml b/tests/drivers/uart/uart_async_dual/testcase.yaml index 1722d5e5e7d1..1a2d811bbfe9 100644 --- a/tests/drivers/uart/uart_async_dual/testcase.yaml +++ b/tests/drivers/uart/uart_async_dual/testcase.yaml @@ -73,18 +73,3 @@ tests: - nrf52_bsim extra_configs: - CONFIG_PM_RUNTIME_IN_TEST=y - drivers.uart.async_dual.no_tx_chopped: - harness: ztest - harness_config: - fixture: uart_loopback - depends_on: gpio - platform_allow: - - nrf54l15dk/nrf54l15/cpuapp - - nrf54h20dk/nrf54h20/cpuapp - - nrf54h20dk/nrf54h20/cpurad - - nrf54h20dk/nrf54h20/cpuppr - - nrf9160dk/nrf9160 - - nrf52_bsim - extra_configs: - - CONFIG_TEST_CHOPPED_TX=n - - CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER=n From 8cc3dc4a1cdba08b9f429cda33a6c0d371ef507d Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:49 +0300 Subject: [PATCH 1208/2141] Revert "[nrf fromlist] tests: drivers: uart: async_dual: Add progress report" This reverts commit 249e3bf5abbe03e3a493915ca89b3ad585207022. Signed-off-by: Jukka Rissanen --- tests/drivers/uart/uart_async_dual/src/main.c | 26 ------------------- 1 file changed, 26 deletions(-) diff --git a/tests/drivers/uart/uart_async_dual/src/main.c b/tests/drivers/uart/uart_async_dual/src/main.c index d14e0f88a11e..37ce73120acb 100644 --- a/tests/drivers/uart/uart_async_dual/src/main.c +++ b/tests/drivers/uart/uart_async_dual/src/main.c @@ -365,26 +365,6 @@ static void config_baudrate(uint32_t rate) } } -static void report_progress(uint32_t start) -{ - static const uint32_t inc = CONFIG_UART_ASYNC_DUAL_TEST_TIMEOUT / 20; - static uint32_t next; - static uint32_t progress; - - if ((k_uptime_get_32() - start < inc) && progress) { - /* Reset state. */ - next = inc; - progress = 0; - } - - if (k_uptime_get_32() > (start + next)) { - progress += 5; - TC_PRINT("\r%d%%", progress); - next += inc; - } -} - - /* Test is running following scenario. Transmitter is sending packets which * has 1 byte header with length followed by the payload. Transmitter can send * packets in two modes: bulk where data is send in chunks without gaps between @@ -400,7 +380,6 @@ static void var_packet_hwfc(uint32_t baudrate, bool tx_packets, bool cont) { int err; uint32_t load = 0; - uint32_t start = k_uptime_get_32(); config_baudrate(baudrate); @@ -441,10 +420,8 @@ static void var_packet_hwfc(uint32_t baudrate, bool tx_packets, bool cont) while (tx_data.cont || rx_data.cont) { fill_tx(&tx_data); k_msleep(1); - report_progress(start); try_tx(tx_dev, false); } - TC_PRINT("\n"); if (IS_ENABLED(CONFIG_CPU_LOAD)) { load = cpu_load_get(true); @@ -676,7 +653,6 @@ static void hci_like_rx(void) uint8_t len; bool cont; bool explicit_pm = IS_ENABLED(CONFIG_PM_RUNTIME_IN_TEST); - uint32_t start = k_uptime_get_32(); while (1) { if (explicit_pm) { @@ -728,9 +704,7 @@ static void hci_like_rx(void) PM_CHECK(rx_dev, tx_dev, false); check_payload(rx_data.buf, len); - report_progress(start); } - TC_PRINT("\n"); } #define HCI_LIKE_TX_STACK_SIZE 2048 From f803314c61e663b69854494066e97ad00f0de8ae Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:49 +0300 Subject: [PATCH 1209/2141] Revert "[nrf fromlist] dts: bindings: serial: nrf-uarte: Add timer property" This reverts commit b83628773c322abb2347726371b6a63441188e33. Signed-off-by: Jukka Rissanen --- dts/bindings/serial/nordic,nrf-uarte.yaml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/dts/bindings/serial/nordic,nrf-uarte.yaml b/dts/bindings/serial/nordic,nrf-uarte.yaml index c8eb2bbc758d..4e9ccb0dd400 100644 --- a/dts/bindings/serial/nordic,nrf-uarte.yaml +++ b/dts/bindings/serial/nordic,nrf-uarte.yaml @@ -24,11 +24,3 @@ properties: type: boolean description: | UARTE allows usage of cross domain pins with constant latency mode required. - - timer: - type: phandle - description: | - Timer instance used to count received bytes. Due to issues with frame timeout - feature it is required to reliably receive data in cases where flow control - is not used and new byte can appear on the line when frame timeout expires - but before it is handled. From deb2a155583a842a1cd5fcbead7fc97ce50ba968 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:49 +0300 Subject: [PATCH 1210/2141] Revert "[nrf fromtree] samples: boards: nrf: clock_control: Add memory-regions prop to uart sample" This reverts commit 446f35c7cd3690c685b006d8e6172897293091fd. Signed-off-by: Jukka Rissanen --- samples/boards/nordic/clock_control/configs/uart135.overlay | 1 - 1 file changed, 1 deletion(-) diff --git a/samples/boards/nordic/clock_control/configs/uart135.overlay b/samples/boards/nordic/clock_control/configs/uart135.overlay index 51f8f5102c03..0e81f4cd2aa7 100644 --- a/samples/boards/nordic/clock_control/configs/uart135.overlay +++ b/samples/boards/nordic/clock_control/configs/uart135.overlay @@ -12,5 +12,4 @@ &uart135 { status = "okay"; - memory-regions = <&cpuapp_dma_region>; }; From 3568b7cb94614e1b9b964957d2173cd76a8f6f39 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:49 +0300 Subject: [PATCH 1211/2141] Revert "[nrf fromtree] drivers: nrf: add build asserts for memory-regions property" This reverts commit 15ec1e7e05122e68d24b6150f12db18b1b3d3a56. Signed-off-by: Jukka Rissanen --- drivers/adc/adc_nrfx_saadc.c | 2 -- drivers/audio/dmic_nrfx_pdm.c | 1 - drivers/i2c/i2c_nrfx_twim.c | 1 - drivers/i2c/i2c_nrfx_twim_rtio.c | 1 - drivers/i2c/i2c_nrfx_twis.c | 1 - drivers/i2s/i2s_nrf_tdm.c | 1 - drivers/pwm/pwm_nrfx.c | 1 - drivers/serial/uart_nrfx_uarte.c | 1 - drivers/spi/spi_nrfx_spim.c | 1 - drivers/spi/spi_nrfx_spis.c | 1 - soc/nordic/common/soc_nrf_common.h | 13 ------------- 11 files changed, 24 deletions(-) diff --git a/drivers/adc/adc_nrfx_saadc.c b/drivers/adc/adc_nrfx_saadc.c index 2ba7b6efd008..274a43157e04 100644 --- a/drivers/adc/adc_nrfx_saadc.c +++ b/drivers/adc/adc_nrfx_saadc.c @@ -709,7 +709,5 @@ static DEVICE_API(adc, adc_nrfx_driver_api) = { /* Validate configuration of all channels. */ DT_FOREACH_CHILD(DT_DRV_INST(0), VALIDATE_CHANNEL_CONFIG) -NRF_DT_CHECK_NODE_HAS_REQUIRED_MEMORY_REGIONS(DT_DRV_INST(0)); - DEVICE_DT_INST_DEFINE(0, init_saadc, NULL, NULL, NULL, POST_KERNEL, CONFIG_ADC_INIT_PRIORITY, &adc_nrfx_driver_api); diff --git a/drivers/audio/dmic_nrfx_pdm.c b/drivers/audio/dmic_nrfx_pdm.c index 433aea66bbc3..b2fcb7abb868 100644 --- a/drivers/audio/dmic_nrfx_pdm.c +++ b/drivers/audio/dmic_nrfx_pdm.c @@ -728,7 +728,6 @@ static const struct _dmic_ops dmic_ops = { .clk_src = PDM_CLK_SRC(idx), \ .mem_reg = DMM_DEV_TO_REG(PDM(idx)), \ }; \ - NRF_DT_CHECK_NODE_HAS_REQUIRED_MEMORY_REGIONS(PDM(idx)); \ BUILD_ASSERT(PDM_CLK_SRC(idx) != ACLK || \ NRF_PDM_HAS_SELECTABLE_CLOCK, \ "Clock source ACLK is not available."); \ diff --git a/drivers/i2c/i2c_nrfx_twim.c b/drivers/i2c/i2c_nrfx_twim.c index e3c307231ab1..b6c37f455dc1 100644 --- a/drivers/i2c/i2c_nrfx_twim.c +++ b/drivers/i2c/i2c_nrfx_twim.c @@ -253,7 +253,6 @@ static DEVICE_API(i2c, i2c_nrfx_twim_driver_api) = { #define I2C_NRFX_TWIM_DEVICE(idx) \ NRF_DT_CHECK_NODE_HAS_PINCTRL_SLEEP(I2C(idx)); \ - NRF_DT_CHECK_NODE_HAS_REQUIRED_MEMORY_REGIONS(I2C(idx)); \ BUILD_ASSERT(I2C_FREQUENCY(idx) != \ I2C_NRFX_TWIM_INVALID_FREQUENCY, \ "Wrong I2C " #idx " frequency setting in dts"); \ diff --git a/drivers/i2c/i2c_nrfx_twim_rtio.c b/drivers/i2c/i2c_nrfx_twim_rtio.c index 0ddf5ffdd777..5eef549ba2e7 100644 --- a/drivers/i2c/i2c_nrfx_twim_rtio.c +++ b/drivers/i2c/i2c_nrfx_twim_rtio.c @@ -254,7 +254,6 @@ static int i2c_nrfx_twim_rtio_deinit(const struct device *dev) #define I2C_NRFX_TWIM_RTIO_DEVICE(idx) \ NRF_DT_CHECK_NODE_HAS_PINCTRL_SLEEP(I2C(idx)); \ - NRF_DT_CHECK_NODE_HAS_REQUIRED_MEMORY_REGIONS(I2C(idx)); \ BUILD_ASSERT(I2C_FREQUENCY(idx) != I2C_NRFX_TWIM_INVALID_FREQUENCY, \ "Wrong I2C " #idx " frequency setting in dts"); \ static void irq_connect##idx(void) \ diff --git a/drivers/i2c/i2c_nrfx_twis.c b/drivers/i2c/i2c_nrfx_twis.c index be55c851f3a7..dca3a457cf22 100644 --- a/drivers/i2c/i2c_nrfx_twis.c +++ b/drivers/i2c/i2c_nrfx_twis.c @@ -325,7 +325,6 @@ static int shim_nrf_twis_deinit(const struct device *dev) _CONCAT_4(shim_nrf_twis_, name, _, id) #define SHIM_NRF_TWIS_DEVICE_DEFINE(id) \ - NRF_DT_CHECK_NODE_HAS_REQUIRED_MEMORY_REGIONS(SHIM_NRF_TWIS_NODE(id)); \ static void SHIM_NRF_TWIS_NAME(id, irq_connect)(void) \ { \ IRQ_CONNECT( \ diff --git a/drivers/i2s/i2s_nrf_tdm.c b/drivers/i2s/i2s_nrf_tdm.c index c65edb2717bc..f8fa4773d37e 100644 --- a/drivers/i2s/i2s_nrf_tdm.c +++ b/drivers/i2s/i2s_nrf_tdm.c @@ -1192,7 +1192,6 @@ static DEVICE_API(i2s, tdm_nrf_drv_api) = { BUILD_ASSERT((TDM_SCK_CLK_SRC(idx) != ACLK && TDM_MCK_CLK_SRC(idx) != ACLK) || \ DT_NODE_HAS_STATUS_OKAY(NODE_ACLK), \ "Clock source ACLK requires the audiopll node."); \ - NRF_DT_CHECK_NODE_HAS_REQUIRED_MEMORY_REGIONS(TDM(idx)); \ DEVICE_DT_DEFINE(TDM(idx), tdm_nrf_init##idx, NULL, &tdm_nrf_data##idx, &tdm_nrf_cfg##idx, \ POST_KERNEL, CONFIG_I2S_INIT_PRIORITY, &tdm_nrf_drv_api); diff --git a/drivers/pwm/pwm_nrfx.c b/drivers/pwm/pwm_nrfx.c index e5a046fd9754..6a106c128412 100644 --- a/drivers/pwm/pwm_nrfx.c +++ b/drivers/pwm/pwm_nrfx.c @@ -496,7 +496,6 @@ static int pwm_nrfx_init(const struct device *dev) #define PWM_NRFX_DEVICE(idx) \ NRF_DT_CHECK_NODE_HAS_PINCTRL_SLEEP(PWM(idx)); \ - NRF_DT_CHECK_NODE_HAS_REQUIRED_MEMORY_REGIONS(PWM(idx)); \ static struct pwm_nrfx_data pwm_nrfx_##idx##_data; \ static uint16_t pwm_##idx##_seq_values[NRF_PWM_CHANNEL_COUNT] \ PWM_MEMORY_SECTION(idx); \ diff --git a/drivers/serial/uart_nrfx_uarte.c b/drivers/serial/uart_nrfx_uarte.c index cf864a594297..20b6cad541de 100644 --- a/drivers/serial/uart_nrfx_uarte.c +++ b/drivers/serial/uart_nrfx_uarte.c @@ -2714,7 +2714,6 @@ static int uarte_instance_init(const struct device *dev, #define UART_NRF_UARTE_DEVICE(idx) \ NRF_DT_CHECK_NODE_HAS_PINCTRL_SLEEP(UARTE(idx)); \ - NRF_DT_CHECK_NODE_HAS_REQUIRED_MEMORY_REGIONS(UARTE(idx)); \ UARTE_INT_DRIVEN(idx); \ PINCTRL_DT_DEFINE(UARTE(idx)); \ IF_ENABLED(CONFIG_UART_##idx##_ASYNC, ( \ diff --git a/drivers/spi/spi_nrfx_spim.c b/drivers/spi/spi_nrfx_spim.c index 438a1b22999f..f1d6f8125d67 100644 --- a/drivers/spi/spi_nrfx_spim.c +++ b/drivers/spi/spi_nrfx_spim.c @@ -912,7 +912,6 @@ static int spi_nrfx_deinit(const struct device *dev) #define SPI_NRFX_SPIM_DEFINE(idx) \ NRF_DT_CHECK_NODE_HAS_PINCTRL_SLEEP(SPIM(idx)); \ - NRF_DT_CHECK_NODE_HAS_REQUIRED_MEMORY_REGIONS(SPIM(idx)); \ static void irq_connect##idx(void) \ { \ IRQ_CONNECT(DT_IRQN(SPIM(idx)), DT_IRQ(SPIM(idx), priority), \ diff --git a/drivers/spi/spi_nrfx_spis.c b/drivers/spi/spi_nrfx_spis.c index daa75d7e7fff..8ab8de979555 100644 --- a/drivers/spi/spi_nrfx_spis.c +++ b/drivers/spi/spi_nrfx_spis.c @@ -571,7 +571,6 @@ static int spi_nrfx_init(const struct device *dev) } #define SPI_NRFX_SPIS_DEFINE(idx) \ - NRF_DT_CHECK_NODE_HAS_REQUIRED_MEMORY_REGIONS(SPIS(idx)); \ static void irq_connect##idx(void) \ { \ IRQ_CONNECT(DT_IRQN(SPIS(idx)), DT_IRQ(SPIS(idx), priority), \ diff --git a/soc/nordic/common/soc_nrf_common.h b/soc/nordic/common/soc_nrf_common.h index e2ff929a5034..dd6fb8866bfc 100644 --- a/soc/nordic/common/soc_nrf_common.h +++ b/soc/nordic/common/soc_nrf_common.h @@ -236,19 +236,6 @@ DT_PINCTRL_HAS_NAME(node_id, sleep), \ DT_NODE_PATH(node_id) " defined without sleep state") -/** - * Error out the build if CONFIG_HAS_NORDIC_DMM=y and memory-regions property is not defined - * or the status of the selected memory region is not "okay" - * - * @param node Devicetree node. - */ -#define NRF_DT_CHECK_NODE_HAS_REQUIRED_MEMORY_REGIONS(node_id) \ - IF_ENABLED(CONFIG_HAS_NORDIC_DMM, \ - (BUILD_ASSERT(( \ - DT_NODE_HAS_PROP(node_id, memory_regions) && \ - DT_NODE_HAS_STATUS_OKAY(DT_PHANDLE_BY_IDX(node_id, memory_regions, 0))), \ - DT_NODE_PATH(node_id) " defined without memory regions"))) - /** @brief Get clock frequency that is used for the given node. * * Macro checks if node has clock property and if yes then if clock has clock_frequency property From 976b3fe60a7888c81473d235e463918e303dfad2 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:49 +0300 Subject: [PATCH 1212/2141] Revert "[nrf fromlist] tests: drivers: gpio: basic_api: Add nrf54h20/cpurad GPIOTE0 config" This reverts commit eb31114fcac56d0ab45f245ab8063a6d3abb200d. Signed-off-by: Jukka Rissanen --- ...nrf54h20dk_nrf54h20_cpurad_gpiote0.overlay | 28 ------------------- .../drivers/gpio/gpio_basic_api/testcase.yaml | 7 ----- 2 files changed, 35 deletions(-) delete mode 100644 tests/drivers/gpio/gpio_basic_api/boards/nrf54h20dk_nrf54h20_cpurad_gpiote0.overlay diff --git a/tests/drivers/gpio/gpio_basic_api/boards/nrf54h20dk_nrf54h20_cpurad_gpiote0.overlay b/tests/drivers/gpio/gpio_basic_api/boards/nrf54h20dk_nrf54h20_cpurad_gpiote0.overlay deleted file mode 100644 index 0c8f7dbe06c9..000000000000 --- a/tests/drivers/gpio/gpio_basic_api/boards/nrf54h20dk_nrf54h20_cpurad_gpiote0.overlay +++ /dev/null @@ -1,28 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - -&pinctrl { - gpiote0_default_alt: gpiote0_default_alt { - group1 { - psels = ; - }; - }; -}; - -/ { - resources { - compatible = "test-gpio-basic-api"; - out-gpios = <&gpio1 5 0>; - in-gpios = <&gpio1 4 0>; - }; -}; - -&gpio1 { - status = "okay"; - gpiote-instance = <&gpiote0>; -}; - -&gpiote0 { - status = "okay"; - pinctrl-0 = <&gpiote0_default_alt>; - pinctrl-names = "default"; -}; diff --git a/tests/drivers/gpio/gpio_basic_api/testcase.yaml b/tests/drivers/gpio/gpio_basic_api/testcase.yaml index 325b22efa1c0..71f55e493cce 100644 --- a/tests/drivers/gpio/gpio_basic_api/testcase.yaml +++ b/tests/drivers/gpio/gpio_basic_api/testcase.yaml @@ -111,10 +111,3 @@ tests: platform_allow: - siwx917_rb4338a extra_args: "DTC_OVERLAY_FILE=boards/siwx917_rb4338a-uulp.overlay" - drivers.gpio.2pin.nrf54h20_cpurad_gpiote0: - harness_config: - fixture: i2s_loopback # Loopback includes the pin pair needed for that test - platform_allow: - - nrf54h20dk/nrf54h20/cpurad - extra_args: - - DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpurad_gpiote0.overlay" From 009d8e300806b16742b0d3bc640f3873ccaa59e4 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:49 +0300 Subject: [PATCH 1213/2141] Revert "[nrf fromlist] tests: drivers: gpio: basic_api: Improve test" This reverts commit 444ba1c7294dc85618cc5c260c1498116591cd68. Signed-off-by: Jukka Rissanen --- .../drivers/gpio/gpio_basic_api/src/test_callback_manage.c | 7 ++----- .../drivers/gpio/gpio_basic_api/src/test_config_trigger.c | 6 ------ 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/tests/drivers/gpio/gpio_basic_api/src/test_callback_manage.c b/tests/drivers/gpio/gpio_basic_api/src/test_callback_manage.c index d302e9930324..4c521c8e2a0e 100644 --- a/tests/drivers/gpio/gpio_basic_api/src/test_callback_manage.c +++ b/tests/drivers/gpio/gpio_basic_api/src/test_callback_manage.c @@ -66,19 +66,16 @@ static int init_callback(const struct device *dev_in, const struct device *dev_o static void trigger_callback(const struct device *dev_in, const struct device *dev_out, int enable_cb) { - int rc; - gpio_pin_set(dev_out, PIN_OUT, 0); k_sleep(K_MSEC(100)); cb_cnt[0] = 0; cb_cnt[1] = 0; if (enable_cb == 1) { - rc = gpio_pin_interrupt_configure(dev_in, PIN_IN, GPIO_INT_EDGE_RISING); + gpio_pin_interrupt_configure(dev_in, PIN_IN, GPIO_INT_EDGE_RISING); } else { - rc = gpio_pin_interrupt_configure(dev_in, PIN_IN, GPIO_INT_DISABLE); + gpio_pin_interrupt_configure(dev_in, PIN_IN, GPIO_INT_DISABLE); } - zassert_equal(rc, 0); k_sleep(K_MSEC(100)); gpio_pin_set(dev_out, PIN_OUT, 1); k_sleep(K_MSEC(1000)); diff --git a/tests/drivers/gpio/gpio_basic_api/src/test_config_trigger.c b/tests/drivers/gpio/gpio_basic_api/src/test_config_trigger.c index 38c5401bcd6c..881020a7281f 100644 --- a/tests/drivers/gpio/gpio_basic_api/src/test_config_trigger.c +++ b/tests/drivers/gpio/gpio_basic_api/src/test_config_trigger.c @@ -68,9 +68,6 @@ ZTEST(after_flash_gpio_config_trigger, test_gpio_config_twice_trigger) k_sleep(K_MSEC(10)); zassert_between_inclusive(cb_cnt, 0, 1, "Got %d interrupts", cb_cnt); - ret = gpio_pin_interrupt_configure(dev_in, PIN_IN, GPIO_INT_DISABLE); - zassert_ok(ret, "interrupt disabling failed"); - gpio_remove_callback(dev_in, &drv_data->gpio_cb); } @@ -118,8 +115,5 @@ ZTEST(after_flash_gpio_config_trigger, test_gpio_config_trigger) k_sleep(K_MSEC(10)); zassert_between_inclusive(cb_cnt, 0, 1, "Got %d interrupts", cb_cnt); - ret = gpio_pin_interrupt_configure(dev_in, PIN_IN, GPIO_INT_DISABLE); - zassert_ok(ret, "interrupt disabling failed"); - gpio_remove_callback(dev_in, &drv_data->gpio_cb); } From 0cb22ba8815dfe7b868c66919ff745c5d1e4a287 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:49 +0300 Subject: [PATCH 1214/2141] Revert "[nrf fromlist] drivers: gpio: nrfx: Add support for GPIOTE0 on cpurad" This reverts commit 579af8877d140192461f14fbd7faf96344b1a358. Signed-off-by: Jukka Rissanen --- drivers/gpio/gpio_nrfx.c | 128 +++++++++------------------------------ 1 file changed, 27 insertions(+), 101 deletions(-) diff --git a/drivers/gpio/gpio_nrfx.c b/drivers/gpio/gpio_nrfx.c index f7c57156361e..0a94b84c67fd 100644 --- a/drivers/gpio/gpio_nrfx.c +++ b/drivers/gpio/gpio_nrfx.c @@ -20,26 +20,6 @@ #include #endif -#define GPIOTE_PHANDLE(id) DT_INST_PHANDLE(id, gpiote_instance) -#define GPIOTE_PROP(idx, prop) DT_PROP(GPIOTE(idx), prop) - -#define IS_NO_PORT_INSTANCE(id) DT_PROP_OR(GPIOTE_PHANDLE(id), no_port_event, 0) || -#define IS_FIXED_CH_INSTANCE(id) DT_PROP_OR(GPIOTE_PHANDLE(id), fixed_channels_supported, 0) || - -#if DT_INST_FOREACH_STATUS_OKAY(IS_NO_PORT_INSTANCE) 0 -#define GPIOTE_NO_PORT_EVT_SUPPORT 1 -#endif - -#if DT_INST_FOREACH_STATUS_OKAY(IS_FIXED_CH_INSTANCE) 0 -#define GPIOTE_FIXED_CH_SUPPORT 1 -#endif - -#if defined(GPIOTE_NO_PORT_EVT_SUPPORT) || defined(GPIOTE_FIXED_CH_SUPPORT) -#define GPIOTE_FEATURE_FLAG 1 -#define GPIOTE_FLAG_NO_PORT_EVT BIT(0) -#define GPIOTE_FLAG_FIXED_CHAN BIT(1) -#endif - struct gpio_nrfx_data { /* gpio_driver_data needs to be first */ struct gpio_driver_data common; @@ -53,9 +33,6 @@ struct gpio_nrfx_cfg { uint32_t edge_sense; uint8_t port_num; nrfx_gpiote_t gpiote; -#if defined(GPIOTE_FEATURE_FLAG) - uint32_t flags; -#endif #ifdef CONFIG_SOC_NRF54H20_GPD uint8_t pad_pd; #endif @@ -203,7 +180,6 @@ static int gpio_nrfx_pin_configure(const struct device *port, gpio_pin_t pin, abs_pin, &input_pin_config); if (err != NRFX_SUCCESS) { ret = -EINVAL; - goto end; } } @@ -235,21 +211,13 @@ static int gpio_nrfx_pin_configure(const struct device *port, gpio_pin_t pin, } if (IS_ENABLED(CONFIG_GPIO_NRFX_INTERRUPT) && free_ch) { -#ifdef GPIOTE_FEATURE_FLAG - /* Fixed channel was used, no need to free. */ - if (cfg->flags & GPIOTE_FLAG_FIXED_CHAN) { - goto end; - } -#endif err = nrfx_gpiote_channel_free(&cfg->gpiote, ch); __ASSERT_NO_MSG(err == NRFX_SUCCESS); } end: gpio_nrfx_gpd_retain_set(port, BIT(pin)); - int pm_ret = pm_device_runtime_put(port); - - return (ret != 0) ? ret : pm_ret; + return pm_device_runtime_put(port); } #ifdef CONFIG_GPIO_GET_CONFIG @@ -425,37 +393,6 @@ static nrfx_gpiote_trigger_t get_trigger(enum gpio_int_mode mode, NRFX_GPIOTE_TRIGGER_LOTOHI; } -static nrfx_err_t chan_alloc(const struct gpio_nrfx_cfg *cfg, gpio_pin_t pin, uint8_t *ch) -{ -#ifdef GPIOTE_FEATURE_FLAG - if (cfg->flags & GPIOTE_FLAG_FIXED_CHAN) { - /* Currently fixed channel relation is only present in one instance (GPIOTE0 on - * cpurad). The rules are following: - * - GPIOTE0 can only be used with P1 (pins 4-11) and P2 (pins (0-11)) - * - P1: channel => pin - 4, e.g. P1.4 => channel 0, P1.5 => channel 1 - * - P2: channel => pin % 8, e.g. P2.0 => channel 0, P2.8 => channel 0 - */ - nrfx_err_t err = NRFX_SUCCESS; - - if (cfg->port_num == 1) { - if (pin < 4) { - err = NRFX_ERROR_INVALID_PARAM; - } else { - *ch = pin - 4; - } - } else if (cfg->port_num == 2) { - *ch = pin & 0x7; - } else { - err = NRFX_ERROR_INVALID_PARAM; - } - - return err; - } -#endif - - return nrfx_gpiote_channel_alloc(&cfg->gpiote, ch); -} - static int gpio_nrfx_pin_interrupt_configure(const struct device *port, gpio_pin_t pin, enum gpio_int_mode mode, @@ -491,7 +428,7 @@ static int gpio_nrfx_pin_interrupt_configure(const struct device *port, (nrf_gpio_pin_dir_get(abs_pin) == NRF_GPIO_PIN_DIR_INPUT)) { err = nrfx_gpiote_channel_get(&cfg->gpiote, abs_pin, &ch); if (err == NRFX_ERROR_INVALID_PARAM) { - err = chan_alloc(cfg, pin, &ch); + err = nrfx_gpiote_channel_alloc(&cfg->gpiote, &ch); if (err != NRFX_SUCCESS) { return -ENOMEM; } @@ -499,11 +436,6 @@ static int gpio_nrfx_pin_interrupt_configure(const struct device *port, trigger_config.p_in_channel = &ch; } else { -#ifdef GPIOTE_FEATURE_FLAG - if (cfg->flags & GPIOTE_FLAG_NO_PORT_EVT) { - return -ENOTSUP; - } -#endif /* If edge mode with channel was previously used and we are changing to sense or * level triggered, we must free the channel. */ @@ -709,6 +641,7 @@ static DEVICE_API(gpio, gpio_nrfx_drv_api_funcs) = { #endif }; +#define GPIOTE_PHANDLE(id) DT_INST_PHANDLE(id, gpiote_instance) #define GPIOTE_INST(id) DT_PROP(GPIOTE_PHANDLE(id), instance) #define GPIOTE_INSTANCE(id) \ @@ -735,37 +668,30 @@ static DEVICE_API(gpio, gpio_nrfx_drv_api_funcs) = { #define PAD_PD(inst) #endif -#define GPIO_NRF_DEVICE(id) \ - GPIOTE_CHECK(id); \ - static const struct gpio_nrfx_cfg gpio_nrfx_p##id##_cfg = { \ - .common = { \ - .port_pin_mask = \ - GPIO_PORT_PIN_MASK_FROM_DT_INST(id), \ - }, \ - .port = _CONCAT(NRF_P, DT_INST_PROP(id, port)), \ - .port_num = DT_INST_PROP(id, port), \ - .edge_sense = DT_INST_PROP_OR(id, sense_edge_mask, 0), \ - .gpiote = GPIOTE_INSTANCE(id), \ - IF_ENABLED(GPIOTE_FEATURE_FLAG, \ - (.flags = \ - (DT_PROP_OR(GPIOTE_PHANDLE(id), no_port_event, 0) ? \ - GPIOTE_FLAG_NO_PORT_EVT : 0) | \ - (DT_PROP_OR(GPIOTE_PHANDLE(id), fixed_channels_supported, 0) ? \ - GPIOTE_FLAG_FIXED_CHAN : 0),) \ - ) \ - PAD_PD(id) \ - }; \ - \ - static struct gpio_nrfx_data gpio_nrfx_p##id##_data; \ - \ - PM_DEVICE_DT_INST_DEFINE(id, gpio_nrfx_pm_hook); \ - \ - DEVICE_DT_INST_DEFINE(id, gpio_nrfx_init, \ - PM_DEVICE_DT_INST_GET(id), \ - &gpio_nrfx_p##id##_data, \ - &gpio_nrfx_p##id##_cfg, \ - PRE_KERNEL_1, \ - CONFIG_GPIO_INIT_PRIORITY, \ +#define GPIO_NRF_DEVICE(id) \ + GPIOTE_CHECK(id); \ + static const struct gpio_nrfx_cfg gpio_nrfx_p##id##_cfg = { \ + .common = { \ + .port_pin_mask = \ + GPIO_PORT_PIN_MASK_FROM_DT_INST(id), \ + }, \ + .port = _CONCAT(NRF_P, DT_INST_PROP(id, port)), \ + .port_num = DT_INST_PROP(id, port), \ + .edge_sense = DT_INST_PROP_OR(id, sense_edge_mask, 0), \ + .gpiote = GPIOTE_INSTANCE(id), \ + PAD_PD(id) \ + }; \ + \ + static struct gpio_nrfx_data gpio_nrfx_p##id##_data; \ + \ + PM_DEVICE_DT_INST_DEFINE(id, gpio_nrfx_pm_hook); \ + \ + DEVICE_DT_INST_DEFINE(id, gpio_nrfx_init, \ + PM_DEVICE_DT_INST_GET(id), \ + &gpio_nrfx_p##id##_data, \ + &gpio_nrfx_p##id##_cfg, \ + PRE_KERNEL_1, \ + CONFIG_GPIO_INIT_PRIORITY, \ &gpio_nrfx_drv_api_funcs); DT_INST_FOREACH_STATUS_OKAY(GPIO_NRF_DEVICE) From 0e9e33bff154f61b4e9bef79df122d3d02645077 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:49 +0300 Subject: [PATCH 1215/2141] Revert "[nrf fromlist] modules: hal_nordic: nrfx: Add GPIOTE config flag" This reverts commit 033ae0fc80adb92e4a86cc97c9c58863c09e88f4. Signed-off-by: Jukka Rissanen --- modules/hal_nordic/nrfx/Kconfig | 4 ---- modules/hal_nordic/nrfx/nrfx_kconfig.h | 3 --- 2 files changed, 7 deletions(-) diff --git a/modules/hal_nordic/nrfx/Kconfig b/modules/hal_nordic/nrfx/Kconfig index b7f459ea177b..b918a2023c37 100644 --- a/modules/hal_nordic/nrfx/Kconfig +++ b/modules/hal_nordic/nrfx/Kconfig @@ -226,10 +226,6 @@ config NRFX_GPIOTE131 depends on $(dt_nodelabel_exists,gpiote131) select NRFX_GPIOTE -config NRFX_GPIOTE_NONUNIFORM_INSTANCES - def_bool $(dt_nodelabel_enabled,gpiote0) - depends on $(dt_nodelabel_bool_prop,gpiote0,fixed-channels-supported) - config NRFX_GPIOTE_NUM_OF_EVT_HANDLERS int "Number of event handlers" depends on NRFX_GPIOTE diff --git a/modules/hal_nordic/nrfx/nrfx_kconfig.h b/modules/hal_nordic/nrfx/nrfx_kconfig.h index 6e3583743bc9..5aa856f22997 100644 --- a/modules/hal_nordic/nrfx/nrfx_kconfig.h +++ b/modules/hal_nordic/nrfx/nrfx_kconfig.h @@ -207,9 +207,6 @@ #ifdef CONFIG_NRFX_GPIOTE131 #define NRFX_GPIOTE131_ENABLED 1 #endif -#ifdef CONFIG_NRFX_GPIOTE_NONUNIFORM_INSTANCES -#define NRFX_GPIOTE_CONFIG_NONUNIFORM_INSTANCES 1 -#endif #ifdef CONFIG_NRFX_GPIOTE_NUM_OF_EVT_HANDLERS #define NRFX_GPIOTE_CONFIG_NUM_OF_EVT_HANDLERS CONFIG_NRFX_GPIOTE_NUM_OF_EVT_HANDLERS From d037c6d7a16132894bec14835cb0bc5321891176 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:49 +0300 Subject: [PATCH 1216/2141] Revert "[nrf fromlist] dts: bindings: gpio: nrf-gpiote: Extend description" This reverts commit f54a8aa973f3225c6fe3a92fa648d3c08292d270. Signed-off-by: Jukka Rissanen --- dts/bindings/gpio/nordic,nrf-gpiote.yaml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/dts/bindings/gpio/nordic,nrf-gpiote.yaml b/dts/bindings/gpio/nordic,nrf-gpiote.yaml index 90914c712d20..b9180857e44f 100644 --- a/dts/bindings/gpio/nordic,nrf-gpiote.yaml +++ b/dts/bindings/gpio/nordic,nrf-gpiote.yaml @@ -8,7 +8,6 @@ compatible: "nordic,nrf-gpiote" include: - base.yaml - nordic,split-channels.yaml - - pinctrl-device.yaml properties: reg: @@ -17,17 +16,6 @@ properties: interrupts: required: true - no-port-event: - type: boolean - description: | - Indicates that the GPIOTE instance does not support PORT event. - - fixed-channels-supported: - type: boolean - description: | - Indicates that the GPIOTE instance has fixed connection between pins and TE channels. - It means that a specific TE channel must be used for a given pin. - instance: type: int required: true From 2105fb914247119485de8284767aff3ba39fd71c Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:49 +0300 Subject: [PATCH 1217/2141] Revert "[nrf fromlist] dts: vendor: nordic: nrf54h20: Add gpiote0 node" This reverts commit 6eba812c4b9374ba0741a8fe43610f8838735728. Signed-off-by: Jukka Rissanen --- dts/vendor/nordic/nrf54h20.dtsi | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/dts/vendor/nordic/nrf54h20.dtsi b/dts/vendor/nordic/nrf54h20.dtsi index c72fedef84a6..042725a16171 100644 --- a/dts/vendor/nordic/nrf54h20.dtsi +++ b/dts/vendor/nordic/nrf54h20.dtsi @@ -391,16 +391,6 @@ interrupts = <37 NRF_DEFAULT_IRQ_PRIORITY>; }; - gpiote0: gpiote@27000 { - compatible = "nordic,nrf-gpiote"; - reg = <0x27000 0x1000>; - status = "disabled"; - interrupts = <39 NRF_DEFAULT_IRQ_PRIORITY>; - instance = <0>; - no-port-event; - fixed-channels-supported; - }; - timer020: timer@28000 { compatible = "nordic,nrf-timer"; reg = <0x28000 0x1000>; From f388c06f1513a54701f37c2f18140850993ab2f9 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:49 +0300 Subject: [PATCH 1218/2141] Revert "[nrf fromlist] modules: hal_nordic: Bump nrf-regtool to 9.2.0" This reverts commit b71414bca9ca54ce33c349b88487564fab5eedc3. Signed-off-by: Jukka Rissanen --- modules/hal_nordic/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/hal_nordic/CMakeLists.txt b/modules/hal_nordic/CMakeLists.txt index b6f352864123..11c28246828b 100644 --- a/modules/hal_nordic/CMakeLists.txt +++ b/modules/hal_nordic/CMakeLists.txt @@ -12,7 +12,7 @@ if(CONFIG_NRF_REGTOOL_GENERATE_UICR) list(APPEND nrf_regtool_components GENERATE:UICR) endif() if(DEFINED nrf_regtool_components) - find_package(nrf-regtool 9.2.0 + find_package(nrf-regtool 9.1.0 COMPONENTS ${nrf_regtool_components} PATHS ${CMAKE_CURRENT_LIST_DIR}/nrf-regtool NO_CMAKE_PATH From 0ec20568dc38e4ed62f9c266ae6b7203f3bccafc Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:49 +0300 Subject: [PATCH 1219/2141] Revert "[nrf fromlist] modules: hal_nordic: nrfx: Add support for custom NRFX_DIR on Sysbuild" This reverts commit 46684e34c2443deedc147edb47a9718ef9f66627. Signed-off-by: Jukka Rissanen --- modules/hal_nordic/nrfx/CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/modules/hal_nordic/nrfx/CMakeLists.txt b/modules/hal_nordic/nrfx/CMakeLists.txt index dc31c3a13caa..d063046cfa86 100644 --- a/modules/hal_nordic/nrfx/CMakeLists.txt +++ b/modules/hal_nordic/nrfx/CMakeLists.txt @@ -5,8 +5,6 @@ zephyr_library() # The nrfx source directory can be override through the definition of the NRFX_DIR symbol # during the invocation of the build system -zephyr_get(NRFX_DIR SYSBUILD GLOBAL) - if(NOT DEFINED NRFX_DIR) set(NRFX_DIR ${ZEPHYR_CURRENT_MODULE_DIR}/nrfx CACHE PATH "nrfx Directory") endif() From afad03739bc815d60260f0bdba477a3a23d223cd Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:50 +0300 Subject: [PATCH 1220/2141] Revert "[nrf fromtree] net: ppp: Allow peer-options to be rejected" This reverts commit 09a153cef1d3a36e6ca5b423c97f82c1d197b059. Signed-off-by: Jukka Rissanen --- subsys/net/l2/ppp/ipcp.c | 35 ++--------------------------------- subsys/net/l2/ppp/options.c | 30 +----------------------------- 2 files changed, 3 insertions(+), 62 deletions(-) diff --git a/subsys/net/l2/ppp/ipcp.c b/subsys/net/l2/ppp/ipcp.c index 1cea54de2f39..afa92b293648 100644 --- a/subsys/net/l2/ppp/ipcp.c +++ b/subsys/net/l2/ppp/ipcp.c @@ -228,37 +228,6 @@ static int ipcp_server_nak_ip_address(struct ppp_fsm *fsm, #endif #if defined(CONFIG_NET_L2_PPP_OPTION_SERVE_DNS) - -static int ipcp_dns1_address_parse(struct ppp_fsm *fsm, struct net_pkt *pkt, - void *user_data) -{ - struct ppp_context *ctx = - CONTAINER_OF(fsm, struct ppp_context, ipcp.fsm); - int ret; - - ret = ipcp_dns_address_parse(fsm, pkt, user_data); - - if (ret == -EINVAL && ctx->ipcp.peer_options.dns1_address.s_addr == INADDR_ANY) { - return -ENOTSUP; - } - return ret; -} - -static int ipcp_dns2_address_parse(struct ppp_fsm *fsm, struct net_pkt *pkt, - void *user_data) -{ - struct ppp_context *ctx = - CONTAINER_OF(fsm, struct ppp_context, ipcp.fsm); - int ret; - - ret = ipcp_dns_address_parse(fsm, pkt, user_data); - - if (ret == -EINVAL && ctx->ipcp.peer_options.dns2_address.s_addr == INADDR_ANY) { - return -ENOTSUP; - } - return ret; -} - static int ipcp_server_nak_dns1_address(struct ppp_fsm *fsm, struct net_pkt *ret_pkt, void *user_data) @@ -294,9 +263,9 @@ static const struct ppp_peer_option_info ipcp_peer_options[] = { PPP_PEER_OPTION(IPCP_OPTION_IP_ADDRESS, ipcp_ip_address_parse, NULL), #endif #if defined(CONFIG_NET_L2_PPP_OPTION_SERVE_DNS) - PPP_PEER_OPTION(IPCP_OPTION_DNS1, ipcp_dns1_address_parse, + PPP_PEER_OPTION(IPCP_OPTION_DNS1, ipcp_dns_address_parse, ipcp_server_nak_dns1_address), - PPP_PEER_OPTION(IPCP_OPTION_DNS2, ipcp_dns2_address_parse, + PPP_PEER_OPTION(IPCP_OPTION_DNS2, ipcp_dns_address_parse, ipcp_server_nak_dns2_address), #endif }; diff --git a/subsys/net/l2/ppp/options.c b/subsys/net/l2/ppp/options.c index 694d338c9b76..6fd8c15de6e0 100644 --- a/subsys/net/l2/ppp/options.c +++ b/subsys/net/l2/ppp/options.c @@ -144,38 +144,14 @@ static int ppp_parse_option_conf_req_supported(struct net_pkt *pkt, { struct ppp_parse_option_conf_req_data *parse_data = user_data; struct ppp_fsm *fsm = parse_data->fsm; - struct net_pkt *ret_pkt = parse_data->ret_pkt; - struct net_pkt_cursor cursor; const struct ppp_peer_option_info *option_info = ppp_peer_option_info_get(parse_data->options_info, parse_data->num_options_info, code); int ret; - net_pkt_cursor_backup(pkt, &cursor); ret = option_info->parse(fsm, pkt, parse_data->user_data); - if (ret == -ENOTSUP) { - net_pkt_cursor_restore(pkt, &cursor); - parse_data->rej_count++; - if (parse_data->nack_count != 0) { - /* Remove any NACKed data, if we need to reject something first */ - net_pkt_update_length(ret_pkt, 0); - net_pkt_cursor_init(ret_pkt); - parse_data->nack_count = 0; - } - net_pkt_write_u8(ret_pkt, code); - net_pkt_write_u8(ret_pkt, len + sizeof(code) + sizeof(len)); - if (len > 0) { - net_pkt_copy(ret_pkt, pkt, len); - } - return 0; - } else if (ret == -EINVAL) { - if (parse_data->rej_count != 0) { - /* If we have already rejected some options, we - * cannot NACK anything in the same packet. - */ - return 0; - } + if (ret == -EINVAL) { parse_data->nack_count++; ret = option_info->nack(fsm, parse_data->ret_pkt, parse_data->user_data); @@ -226,10 +202,6 @@ int ppp_config_info_req(struct ppp_fsm *fsm, return -EINVAL; } - if (parse_data.rej_count) { - return PPP_CONFIGURE_REJ; - } - if (parse_data.nack_count) { return PPP_CONFIGURE_NACK; } From 3916aa00745b669baa0222fd8984565d59031559 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:50 +0300 Subject: [PATCH 1221/2141] Revert "[nrf fromtree] net: ppp: ipcp: Don't request DNS if not needed" This reverts commit c1cace5e91f5221960b61cae57188d7483759be2. Signed-off-by: Jukka Rissanen --- include/zephyr/net/ppp.h | 4 --- subsys/net/l2/ppp/ipcp.c | 58 +++++++++++++++++++--------------------- 2 files changed, 27 insertions(+), 35 deletions(-) diff --git a/include/zephyr/net/ppp.h b/include/zephyr/net/ppp.h index 7028e4f2d0f6..a2b63b7dd1ec 100644 --- a/include/zephyr/net/ppp.h +++ b/include/zephyr/net/ppp.h @@ -353,11 +353,7 @@ struct ppp_my_option_data { uint32_t flags; }; -#if defined(CONFIG_NET_L2_PPP_OPTION_DNS_USE) #define IPCP_NUM_MY_OPTIONS 3 -#else -#define IPCP_NUM_MY_OPTIONS 1 -#endif #define IPV6CP_NUM_MY_OPTIONS 1 enum ppp_flags { diff --git a/subsys/net/l2/ppp/ipcp.c b/subsys/net/l2/ppp/ipcp.c index afa92b293648..b345802e68e3 100644 --- a/subsys/net/l2/ppp/ipcp.c +++ b/subsys/net/l2/ppp/ipcp.c @@ -42,6 +42,16 @@ static int ipcp_add_ip_address(struct ppp_context *ctx, struct net_pkt *pkt) return ipcp_add_address(ctx, pkt, &ctx->ipcp.my_options.address); } +static int ipcp_add_dns1(struct ppp_context *ctx, struct net_pkt *pkt) +{ + return ipcp_add_address(ctx, pkt, &ctx->ipcp.my_options.dns1_address); +} + +static int ipcp_add_dns2(struct ppp_context *ctx, struct net_pkt *pkt) +{ + return ipcp_add_address(ctx, pkt, &ctx->ipcp.my_options.dns2_address); +} + static int ipcp_ack_check_address(struct net_pkt *pkt, size_t oplen, struct in_addr *addr) { @@ -71,6 +81,20 @@ static int ipcp_ack_ip_address(struct ppp_context *ctx, struct net_pkt *pkt, &ctx->ipcp.my_options.address); } +static int ipcp_ack_dns1(struct ppp_context *ctx, struct net_pkt *pkt, + uint8_t oplen) +{ + return ipcp_ack_check_address(pkt, oplen, + &ctx->ipcp.my_options.dns1_address); +} + +static int ipcp_ack_dns2(struct ppp_context *ctx, struct net_pkt *pkt, + uint8_t oplen) +{ + return ipcp_ack_check_address(pkt, oplen, + &ctx->ipcp.my_options.dns2_address); +} + static int ipcp_nak_override_address(struct net_pkt *pkt, size_t oplen, struct in_addr *addr) { @@ -88,31 +112,6 @@ static int ipcp_nak_ip_address(struct ppp_context *ctx, struct net_pkt *pkt, &ctx->ipcp.my_options.address); } -#if defined(CONFIG_NET_L2_PPP_OPTION_DNS_USE) -static int ipcp_add_dns1(struct ppp_context *ctx, struct net_pkt *pkt) -{ - return ipcp_add_address(ctx, pkt, &ctx->ipcp.my_options.dns1_address); -} - -static int ipcp_add_dns2(struct ppp_context *ctx, struct net_pkt *pkt) -{ - return ipcp_add_address(ctx, pkt, &ctx->ipcp.my_options.dns2_address); -} - -static int ipcp_ack_dns1(struct ppp_context *ctx, struct net_pkt *pkt, - uint8_t oplen) -{ - return ipcp_ack_check_address(pkt, oplen, - &ctx->ipcp.my_options.dns1_address); -} - -static int ipcp_ack_dns2(struct ppp_context *ctx, struct net_pkt *pkt, - uint8_t oplen) -{ - return ipcp_ack_check_address(pkt, oplen, - &ctx->ipcp.my_options.dns2_address); -} - static int ipcp_nak_dns1(struct ppp_context *ctx, struct net_pkt *pkt, uint8_t oplen) { @@ -126,24 +125,21 @@ static int ipcp_nak_dns2(struct ppp_context *ctx, struct net_pkt *pkt, return ipcp_nak_override_address(pkt, oplen, &ctx->ipcp.my_options.dns2_address); } -#endif /* CONFIG_NET_L2_PPP_OPTION_DNS_USE */ static const struct ppp_my_option_info ipcp_my_options[] = { PPP_MY_OPTION(IPCP_OPTION_IP_ADDRESS, ipcp_add_ip_address, ipcp_ack_ip_address, ipcp_nak_ip_address), -#if defined(CONFIG_NET_L2_PPP_OPTION_DNS_USE) PPP_MY_OPTION(IPCP_OPTION_DNS1, ipcp_add_dns1, ipcp_ack_dns1, ipcp_nak_dns1), PPP_MY_OPTION(IPCP_OPTION_DNS2, ipcp_add_dns2, ipcp_ack_dns2, ipcp_nak_dns2), -#endif }; BUILD_ASSERT(ARRAY_SIZE(ipcp_my_options) == IPCP_NUM_MY_OPTIONS); static struct net_pkt *ipcp_config_info_add(struct ppp_fsm *fsm) { - return ppp_my_options_add(fsm, IPCP_NUM_MY_OPTIONS * IP_ADDRESS_OPTION_LEN); + return ppp_my_options_add(fsm, 3 * IP_ADDRESS_OPTION_LEN); } struct ipcp_peer_option_data { @@ -236,7 +232,7 @@ static int ipcp_server_nak_dns1_address(struct ppp_fsm *fsm, CONTAINER_OF(fsm, struct ppp_context, ipcp.fsm); (void)net_pkt_write_u8(ret_pkt, IPCP_OPTION_DNS1); - (void)ipcp_add_address(ctx, ret_pkt, &ctx->ipcp.peer_options.dns1_address); + ipcp_add_dns1(ctx, ret_pkt); return 0; } @@ -249,7 +245,7 @@ static int ipcp_server_nak_dns2_address(struct ppp_fsm *fsm, CONTAINER_OF(fsm, struct ppp_context, ipcp.fsm); (void)net_pkt_write_u8(ret_pkt, IPCP_OPTION_DNS2); - (void)ipcp_add_address(ctx, ret_pkt, &ctx->ipcp.peer_options.dns2_address); + ipcp_add_dns2(ctx, ret_pkt); return 0; } From fbe7e05bba77d91467b7dfa50eaaf87d54603f48 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:50 +0300 Subject: [PATCH 1222/2141] Revert "[nrf fromtree] boards: nordic: nrf7002dk: Fix the newline between the groups" This reverts commit b2334710d73e234fc16c3dfd95120d66e5d3ce93. Signed-off-by: Jukka Rissanen --- boards/nordic/nrf7002dk/nrf5340_cpuapp_common_pinctrl.dtsi | 2 -- 1 file changed, 2 deletions(-) diff --git a/boards/nordic/nrf7002dk/nrf5340_cpuapp_common_pinctrl.dtsi b/boards/nordic/nrf7002dk/nrf5340_cpuapp_common_pinctrl.dtsi index e6bda0940dbe..08fcadc2244e 100644 --- a/boards/nordic/nrf7002dk/nrf5340_cpuapp_common_pinctrl.dtsi +++ b/boards/nordic/nrf7002dk/nrf5340_cpuapp_common_pinctrl.dtsi @@ -59,7 +59,6 @@ ; bias-pull-down; }; - group2 { psels = ; bias-pull-up; @@ -76,7 +75,6 @@ bias-pull-down; low-power-enable; }; - group2 { psels = ; bias-pull-up; From b6e0d57c2a022c61faafc2bb2d12f561563725e6 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:50 +0300 Subject: [PATCH 1223/2141] Revert "[nrf fromtree] boards: nordic: nrf7002dk: Fix DTS warning" This reverts commit e09502fc2e6dbb07bc146f064e92fd396fd3288f. Signed-off-by: Jukka Rissanen --- boards/nordic/nrf7002dk/nrf5340_cpuapp_common_pinctrl.dtsi | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/boards/nordic/nrf7002dk/nrf5340_cpuapp_common_pinctrl.dtsi b/boards/nordic/nrf7002dk/nrf5340_cpuapp_common_pinctrl.dtsi index 08fcadc2244e..d8f78cfd40c0 100644 --- a/boards/nordic/nrf7002dk/nrf5340_cpuapp_common_pinctrl.dtsi +++ b/boards/nordic/nrf7002dk/nrf5340_cpuapp_common_pinctrl.dtsi @@ -73,13 +73,12 @@ , ; bias-pull-down; - low-power-enable; }; group2 { psels = ; bias-pull-up; - low-power-enable; }; + low-power-enable; }; uart1_default: uart1_default { From 56cc2ae531de9bc73c8ce30403daa3d50189cc65 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:50 +0300 Subject: [PATCH 1224/2141] Revert "[nrf fromtree] dts: bindings: Add missing nRF Wi-Fi interface" This reverts commit 89622e20bf7f8fe4abbcca6c3e1509f07c3f39e1. Signed-off-by: Jukka Rissanen --- dts/bindings/wifi/nordic,wlan.yaml | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 dts/bindings/wifi/nordic,wlan.yaml diff --git a/dts/bindings/wifi/nordic,wlan.yaml b/dts/bindings/wifi/nordic,wlan.yaml deleted file mode 100644 index 9c704bc9586f..000000000000 --- a/dts/bindings/wifi/nordic,wlan.yaml +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright (c) 2025 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -description: | - Nordic Wi-Fi network interface. - - This binding defines a Wi-Fi network interface for Nordic nRF70 series - Wi-Fi chips. The interface is used to identify and name Wi-Fi network - interfaces like wlan0. - -compatible: "nordic,wlan" From e6e4d03d44ca64c38cfcd9229436ec75a67555f1 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:50 +0300 Subject: [PATCH 1225/2141] Revert "[nrf fromlist] manifest: nrf_wifi: Pull fix for raw TX" This reverts commit 290cf97630249480d287a76fbae8f9b1f77071a6. Signed-off-by: Jukka Rissanen --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 94e1638cb45f..67424489a9a6 100644 --- a/west.yml +++ b/west.yml @@ -328,7 +328,7 @@ manifest: revision: 968d55ff22579080466bf2f482596dd6e35361c6 path: modules/bsim_hw_models/nrf_hw_models - name: nrf_wifi - revision: 787eea1a3c8dd13c86214e204a919e6f9bcebf91 + revision: 00801cbaf83600ba9e39b010928401e817a93fdc path: modules/lib/nrf_wifi - name: open-amp revision: f7f4d083c7909a39d86e217376c69b416ec4faf3 From e6019db0e2057ce153bd23bd2617863b2782d625 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:50 +0300 Subject: [PATCH 1226/2141] Revert "[nrf fromtree] manifest: nrf_wifi: Pull fix for processing patch feature flags" This reverts commit d64be7ff9e9ceed45720ce09544d15a3c0f7400d. Signed-off-by: Jukka Rissanen --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 67424489a9a6..acf99c65b106 100644 --- a/west.yml +++ b/west.yml @@ -328,7 +328,7 @@ manifest: revision: 968d55ff22579080466bf2f482596dd6e35361c6 path: modules/bsim_hw_models/nrf_hw_models - name: nrf_wifi - revision: 00801cbaf83600ba9e39b010928401e817a93fdc + revision: 5f59c2336c69f28ae83f93812a1d726f9fceabfe path: modules/lib/nrf_wifi - name: open-amp revision: f7f4d083c7909a39d86e217376c69b416ec4faf3 From d00e06d61abe0b43b5b1d9a69a0713196ec7a82e Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:50 +0300 Subject: [PATCH 1227/2141] Revert "[nrf fromlist] drivers: nrf_wifi: Fix defaults to avoid false recovery" This reverts commit 593cc07e7c9eba3954346539608deaf4073411c2. Signed-off-by: Jukka Rissanen --- drivers/wifi/nrf_wifi/Kconfig.nrfwifi | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/wifi/nrf_wifi/Kconfig.nrfwifi b/drivers/wifi/nrf_wifi/Kconfig.nrfwifi index af3e7827dcbf..414900f581b9 100644 --- a/drivers/wifi/nrf_wifi/Kconfig.nrfwifi +++ b/drivers/wifi/nrf_wifi/Kconfig.nrfwifi @@ -748,12 +748,11 @@ config NRF_WIFI_RPU_RECOVERY_PS_ACTIVE_TIMEOUT_MS config NRF_WIFI_RPU_MIN_TIME_TO_ENTER_SLEEP_MS int "Minimum idle time to enter sleep in milliseconds" - range 100 40000 - default 5000 + range 100 5000 + default 1000 help Minimum time the host should de-assert WAKEUP_NOW and let RPU enter - sleep mode, assuming there is no activity. Please note that higher values - of this value may increase the power consumption. + sleep mode, assuming there is no activity. config NRF_WIFI_RPU_RECOVERY_DEBUG bool "RPU recovery debug logs" From ba10404169e4925b398c27d65e8a43c79c224518 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:50 +0300 Subject: [PATCH 1228/2141] Revert "[nrf fromlist] net: ip: Use rate limited version" This reverts commit 65087d8f5442a22df1e710eb633ce5edd590dc5a. Signed-off-by: Jukka Rissanen --- subsys/net/ip/net_if.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subsys/net/ip/net_if.c b/subsys/net/ip/net_if.c index 8c5e7b81548f..b541787a0d98 100644 --- a/subsys/net/ip/net_if.c +++ b/subsys/net/ip/net_if.c @@ -262,8 +262,8 @@ static bool net_if_tx(struct net_if *iface, struct net_pkt *pkt) status = net_if_l2(iface)->send(iface, pkt); net_if_tx_unlock(iface); if (status < 0) { - NET_WARN_RATELIMIT("iface %d pkt %p send failure status %d", - net_if_get_by_iface(iface), pkt, status); + NET_WARN("iface %d pkt %p send failure status %d", + net_if_get_by_iface(iface), pkt, status); } if (IS_ENABLED(CONFIG_NET_PKT_TXTIME_STATS) || From 5008397090dd1023d73ac330a71b3d7c459b733f Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:50 +0300 Subject: [PATCH 1229/2141] Revert "[nrf fromlist] net: Add ratelimited variants" This reverts commit f6f6fd04956190ae9e94ea20f790430cd5aac7cf. Signed-off-by: Jukka Rissanen --- include/zephyr/net/net_core.h | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/include/zephyr/net/net_core.h b/include/zephyr/net/net_core.h index 505683eb139b..e4b18418b3a5 100644 --- a/include/zephyr/net/net_core.h +++ b/include/zephyr/net/net_core.h @@ -61,14 +61,8 @@ extern "C" { #define NET_WARN(fmt, ...) LOG_WRN(fmt, ##__VA_ARGS__) #define NET_INFO(fmt, ...) LOG_INF(fmt, ##__VA_ARGS__) -/* Rate-limited network logging macros */ -#define NET_ERR_RATELIMIT(fmt, ...) LOG_ERR_RATELIMIT(fmt, ##__VA_ARGS__) -#define NET_WARN_RATELIMIT(fmt, ...) LOG_WRN_RATELIMIT(fmt, ##__VA_ARGS__) -#define NET_INFO_RATELIMIT(fmt, ...) LOG_INF_RATELIMIT(fmt, ##__VA_ARGS__) -#define NET_DBG_RATELIMIT(fmt, ...) LOG_DBG_RATELIMIT(fmt, ##__VA_ARGS__) - -#define NET_HEXDUMP_DBG(_data, _length, _str) LOG_HEXDUMP_DBG(_data, _length, _str) -#define NET_HEXDUMP_ERR(_data, _length, _str) LOG_HEXDUMP_ERR(_data, _length, _str) +#define NET_HEXDUMP_DBG(_data, _length, _str) LOG_HEXDUMP_DBG(_data, _length, _str) +#define NET_HEXDUMP_ERR(_data, _length, _str) LOG_HEXDUMP_ERR(_data, _length, _str) #define NET_HEXDUMP_WARN(_data, _length, _str) LOG_HEXDUMP_WRN(_data, _length, _str) #define NET_HEXDUMP_INFO(_data, _length, _str) LOG_HEXDUMP_INF(_data, _length, _str) From 0df53012c570f7fe33562e668b6ab4ddac5cca56 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:50 +0300 Subject: [PATCH 1230/2141] Revert "[nrf noup] logging: Add ratelimited variants" This reverts commit 4ba4327b0faa1db6243f111d83e4a8eb66b2754f. Signed-off-by: Jukka Rissanen --- doc/services/logging/index.rst | 99 ----- include/zephyr/logging/log.h | 375 ------------------ subsys/logging/Kconfig | 50 --- .../logging/log_ratelimited/CMakeLists.txt | 9 - tests/subsys/logging/log_ratelimited/prj.conf | 18 - .../log_ratelimited/test_log_ratelimited.c | 62 --- .../logging/log_ratelimited/testcase.yaml | 23 -- 7 files changed, 636 deletions(-) delete mode 100644 tests/subsys/logging/log_ratelimited/CMakeLists.txt delete mode 100644 tests/subsys/logging/log_ratelimited/prj.conf delete mode 100644 tests/subsys/logging/log_ratelimited/test_log_ratelimited.c delete mode 100644 tests/subsys/logging/log_ratelimited/testcase.yaml diff --git a/doc/services/logging/index.rst b/doc/services/logging/index.rst index be6831616550..86f5e97d8c96 100644 --- a/doc/services/logging/index.rst +++ b/doc/services/logging/index.rst @@ -32,7 +32,6 @@ Summary of the logging features: - Support for logging floating point variables and long long arguments. - Built-in copying of transient strings used as arguments. - Support for multi-domain logging. -- Rate-limited logging macros to prevent log flooding when messages are generated frequently. Logging API is highly configurable at compile time as well as at run time. Using Kconfig options (see :ref:`logging_kconfig`) logs can be gradually removed from @@ -60,16 +59,6 @@ The warning level also exposes the following additional macro: - :c:macro:`LOG_WRN_ONCE` for warnings where only the first occurrence is of interest. -Rate-limited logging macros are also available for all severity levels to prevent log flooding: - -- ``LOG_X_RATELIMIT`` for rate-limited standard printf-like messages using default rate, e.g. :c:macro:`LOG_ERR_RATELIMIT`. -- ``LOG_X_RATELIMIT_RATE`` for rate-limited standard printf-like messages with custom rate, e.g. :c:macro:`LOG_ERR_RATELIMIT_RATE`. -- ``LOG_HEXDUMP_X_RATELIMIT`` for rate-limited data dumping using default rate, e.g. :c:macro:`LOG_HEXDUMP_WRN_RATELIMIT`. -- ``LOG_HEXDUMP_X_RATELIMIT_RATE`` for rate-limited data dumping with custom rate, e.g. :c:macro:`LOG_HEXDUMP_WRN_RATELIMIT_RATE`. - -The convenience macros use the default rate specified by ``CONFIG_LOG_RATELIMIT_INTERVAL_MS``, -while the explicit rate macros take a rate parameter (in milliseconds) that specifies the minimum interval between log messages. - There are two configuration categories: configurations per module and global configuration. When logging is enabled globally, it works for modules. However, modules can disable logging locally. Every module can specify its own logging @@ -352,94 +341,6 @@ If logs are processed from a thread (user or internal) then it is possible to en a feature which will wake up processing thread when certain amount of log messages are buffered (see :kconfig:option:`CONFIG_LOG_PROCESS_TRIGGER_THRESHOLD`). -.. _logging_ratelimited: - -Rate-limited logging -******************** - -Rate-limited logging macros provide a way to prevent log flooding when messages are -generated frequently. These macros ensure that log messages are not output more -frequently than a specified interval, similar to Linux's ``printk_ratelimited`` -functionality. - -The rate-limited logging system provides two types of macros: - -**Convenience macros (using default rate):** -- :c:macro:`LOG_ERR_RATELIMIT` - Rate-limited error messages -- :c:macro:`LOG_WRN_RATELIMIT` - Rate-limited warning messages -- :c:macro:`LOG_INF_RATELIMIT` - Rate-limited info messages -- :c:macro:`LOG_DBG_RATELIMIT` - Rate-limited debug messages -- :c:macro:`LOG_HEXDUMP_ERR_RATELIMIT` - Rate-limited error hexdump -- :c:macro:`LOG_HEXDUMP_WRN_RATELIMIT` - Rate-limited warning hexdump -- :c:macro:`LOG_HEXDUMP_INF_RATELIMIT` - Rate-limited info hexdump -- :c:macro:`LOG_HEXDUMP_DBG_RATELIMIT` - Rate-limited debug hexdump - -**Explicit rate macros (with custom rate):** -- :c:macro:`LOG_ERR_RATELIMIT_RATE` - Rate-limited error messages with custom rate -- :c:macro:`LOG_WRN_RATELIMIT_RATE` - Rate-limited warning messages with custom rate -- :c:macro:`LOG_INF_RATELIMIT_RATE` - Rate-limited info messages with custom rate -- :c:macro:`LOG_DBG_RATELIMIT_RATE` - Rate-limited debug messages with custom rate -- :c:macro:`LOG_HEXDUMP_ERR_RATELIMIT_RATE` - Rate-limited error hexdump with custom rate -- :c:macro:`LOG_HEXDUMP_WRN_RATELIMIT_RATE` - Rate-limited warning hexdump with custom rate -- :c:macro:`LOG_HEXDUMP_INF_RATELIMIT_RATE` - Rate-limited info hexdump with custom rate -- :c:macro:`LOG_HEXDUMP_DBG_RATELIMIT_RATE` - Rate-limited debug hexdump with custom rate - -The convenience macros use the default rate specified by :kconfig:option:`CONFIG_LOG_RATELIMIT_INTERVAL_MS` -(5000ms by default). The explicit rate macros take a rate parameter (in milliseconds) that specifies -the minimum interval between log messages. The rate limiting is per-macro-call-site, meaning -that each unique call to a rate-limited macro has its own independent rate limit. - -Example usage: - -.. code-block:: c - - #include - #include - - LOG_MODULE_REGISTER(my_module, CONFIG_LOG_DEFAULT_LEVEL); - - void process_data(void) - { - /* Convenience macros using default rate (CONFIG_LOG_RATELIMIT_INTERVAL_MS) */ - LOG_WRN_RATELIMIT("Data processing warning: %d", error_code); - LOG_ERR_RATELIMIT("Critical error occurred: %s", error_msg); - LOG_INF_RATELIMIT("Processing status: %d items", item_count); - LOG_HEXDUMP_WRN_RATELIMIT(data_buffer, data_len, "Data buffer:"); - - /* Explicit rate macros with custom intervals */ - LOG_WRN_RATELIMIT_RATE(1000, "Fast rate warning: %d", error_code); - LOG_ERR_RATELIMIT_RATE(30000, "Slow rate error: %s", error_msg); - LOG_INF_RATELIMIT_RATE(2000, "Custom rate status: %d items", item_count); - LOG_HEXDUMP_ERR_RATELIMIT_RATE(5000, data_buffer, data_len, "Error data:"); - } - -Rate-limited logging is particularly useful for: - -- Error conditions that might occur frequently but don't need to flood the logs -- Status updates in tight loops or high-frequency callbacks -- Debug information that could overwhelm the logging system -- Network or I/O operations that might fail repeatedly - -Configuration -============== - -Rate-limited logging can be configured using the following Kconfig options: - -- :kconfig:option:`CONFIG_LOG_RATELIMIT` - Master switch to enable/disable rate-limited logging -- :kconfig:option:`CONFIG_LOG_RATELIMIT_INTERVAL_MS` - Default interval for convenience macros (5000ms) - -When :kconfig:option:`CONFIG_LOG_RATELIMIT` is disabled, the behavior of rate-limited macros is controlled -by the :kconfig:option:`CONFIG_LOG_RATELIMIT_FALLBACK` choice: - -- :kconfig:option:`CONFIG_LOG_RATELIMIT_FALLBACK_LOG` - All rate-limited macros behave as regular logging macros -- :kconfig:option:`CONFIG_LOG_RATELIMIT_FALLBACK_DROP` - All rate-limited macros expand to no-ops (default) - -This allows you to control whether rate-limited log macros should always print or be completely -suppressed when rate limiting is not available. - -The rate limiting is implemented using static variables and :c:func:`k_uptime_get_32` -to track the last log time for each call site. - .. _logging_panic: Logging panic diff --git a/include/zephyr/logging/log.h b/include/zephyr/logging/log.h index 84601af43935..2358b332ef4e 100644 --- a/include/zephyr/logging/log.h +++ b/include/zephyr/logging/log.h @@ -10,7 +10,6 @@ #include #include #include -#include #if CONFIG_USERSPACE && CONFIG_LOG_ALWAYS_RUNTIME #include @@ -97,340 +96,6 @@ extern "C" { } \ } while (0) -#if defined(CONFIG_LOG_RATELIMIT) || defined(__DOXYGEN__) -/** - * @brief Core rate-limited logging macro - * - * @details Internal macro that provides rate-limited logging functionality. - * Uses atomic operations to ensure thread safety in multi-threaded environments. - * Only one thread can successfully log a message within the specified rate limit period. - * - * @param _level Log level (LOG_LEVEL_ERR, LOG_LEVEL_WRN, etc.) - * @param _rate_ms Minimum interval in milliseconds between log messages. - * @param _skipped_msg Message to show when messages are skipped. - * @param _log_func Logging function to call (Z_LOG or Z_LOG_HEXDUMP) - * @param ... Arguments to pass to the logging function. - */ -#define _LOG_RATELIMIT_CORE(_level, _rate_ms, _skipped_msg, _log_func, ...) \ - do { \ - static atomic_t __last_log_time ; \ - static atomic_t __skipped_count ; \ - uint32_t __now = k_uptime_get_32(); \ - uint32_t __last = atomic_get(&__last_log_time); \ - uint32_t __diff = __now - __last; \ - if (unlikely(__diff >= (_rate_ms))) { \ - if (atomic_cas(&__last_log_time, __last, __now)) { \ - uint32_t __skipped = atomic_clear(&__skipped_count); \ - if (__skipped > 0) { \ - Z_LOG(_level, _skipped_msg, __skipped); \ - } \ - _log_func(_level, __VA_ARGS__); \ - } else { \ - atomic_inc(&__skipped_count); \ - } \ - } else { \ - atomic_inc(&__skipped_count); \ - } \ - } while (0) - -/** - * @brief Rate-limited logging macros - * - * @details These macros provide rate-limited logging functionality to prevent - * log flooding when messages are generated frequently. Each macro ensures that - * log messages are not output more frequently than a specified interval. - * Rate limiting is per-macro-call-site, meaning each unique call has its own - * independent rate limit. - * - * The macros use atomic operations to ensure thread safety in multi-threaded - * environments. Only one thread can successfully log a message within the - * specified rate limit period. - * - * @see CONFIG_LOG_RATELIMIT_INTERVAL_MS - */ - -/** - * @brief Writes a WARNING level message to the log with rate limiting. - * - * @details It's meant for situations that warrant investigation but could clutter - * the logs if output too frequently. The message will be logged at most once - * per specified interval in milliseconds. - * - * @param _rate_ms Minimum interval in milliseconds between log messages. - * @param ... A string optionally containing printk valid conversion specifier, - * followed by as many values as specifiers. - */ -#define LOG_WRN_RATELIMIT_RATE(_rate_ms, ...) \ - _LOG_RATELIMIT_CORE(LOG_LEVEL_WRN, _rate_ms, "Skipped %d messages", Z_LOG, __VA_ARGS__) - -/** - * @brief Writes a WARNING level message to the log with rate limiting. - * - * @details It's meant for situations that warrant investigation but could clutter - * the logs if output too frequently. The message will be logged at most once - * per default interval (see CONFIG_LOG_RATELIMIT_INTERVAL_MS). - * - * @param ... A string optionally containing printk valid conversion specifier, - * followed by as many values as specifiers. - */ -#define LOG_WRN_RATELIMIT(...) \ - LOG_WRN_RATELIMIT_RATE(CONFIG_LOG_RATELIMIT_INTERVAL_MS, __VA_ARGS__) - -/** - * @brief Writes an ERROR level message to the log with rate limiting. - * - * @details It's meant to report severe errors, such as those from which it's - * not possible to recover, but with rate limiting to prevent log flooding. - * The message will be logged at most once per specified interval in milliseconds. - * - * @param _rate_ms Minimum interval in milliseconds between log messages. - * @param ... A string optionally containing printk valid conversion specifier, - * followed by as many values as specifiers. - */ -#define LOG_ERR_RATELIMIT_RATE(_rate_ms, ...) \ - _LOG_RATELIMIT_CORE(LOG_LEVEL_ERR, _rate_ms, "Skipped %d messages", Z_LOG, __VA_ARGS__) - -/** - * @brief Writes an ERROR level message to the log with rate limiting. - * - * @details It's meant to report severe errors, such as those from which it's - * not possible to recover, but with rate limiting to prevent log flooding. - * The message will be logged at most once per default interval (see - * CONFIG_LOG_RATELIMIT_INTERVAL_MS). - * - * @param ... A string optionally containing printk valid conversion specifier, - * followed by as many values as specifiers. - */ -#define LOG_ERR_RATELIMIT(...) \ - LOG_ERR_RATELIMIT_RATE(CONFIG_LOG_RATELIMIT_INTERVAL_MS, __VA_ARGS__) - -/** - * @brief Writes an INFO level message to the log with rate limiting. - * - * @details It's meant to write generic user oriented messages with rate limiting - * to prevent log flooding. The message will be logged at most once per specified - * interval in milliseconds. - * - * @param _rate_ms Minimum interval in milliseconds between log messages. - * @param ... A string optionally containing printk valid conversion specifier, - * followed by as many values as specifiers. - */ -#define LOG_INF_RATELIMIT_RATE(_rate_ms, ...) \ - _LOG_RATELIMIT_CORE(LOG_LEVEL_INF, _rate_ms, "Skipped %d messages", Z_LOG, __VA_ARGS__) - -/** - * @brief Writes an INFO level message to the log with rate limiting. - * - * @details It's meant to write generic user oriented messages with rate limiting - * to prevent log flooding. The message will be logged at most once per default - * interval (see CONFIG_LOG_RATELIMIT_INTERVAL_MS). - * - * @param ... A string optionally containing printk valid conversion specifier, - * followed by as many values as specifiers. - */ -#define LOG_INF_RATELIMIT(...) \ - LOG_INF_RATELIMIT_RATE(CONFIG_LOG_RATELIMIT_INTERVAL_MS, __VA_ARGS__) - -/** - * @brief Writes a DEBUG level message to the log with rate limiting. - * - * @details It's meant to write developer oriented information with rate limiting - * to prevent log flooding. The message will be logged at most once per specified - * interval in milliseconds. - * - * @param _rate_ms Minimum interval in milliseconds between log messages. - * @param ... A string optionally containing printk valid conversion specifier, - * followed by as many values as specifiers. - */ -#define LOG_DBG_RATELIMIT_RATE(_rate_ms, ...) \ - _LOG_RATELIMIT_CORE(LOG_LEVEL_DBG, _rate_ms, "Skipped %d messages", Z_LOG, __VA_ARGS__) - -/** - * @brief Writes a DEBUG level message to the log with rate limiting. - * - * @details It's meant to write developer oriented information with rate limiting - * to prevent log flooding. The message will be logged at most once per default - * interval (see CONFIG_LOG_RATELIMIT_INTERVAL_MS). - * - * @param ... A string optionally containing printk valid conversion specifier, - * followed by as many values as specifiers. - */ -#define LOG_DBG_RATELIMIT(...) \ - LOG_DBG_RATELIMIT_RATE(CONFIG_LOG_RATELIMIT_INTERVAL_MS, __VA_ARGS__) - -/** - * @brief Writes an ERROR level hexdump message to the log with rate limiting. - * - * @details It's meant to report severe errors, such as those from which it's - * not possible to recover, but with rate limiting to prevent log flooding. - * The message will be logged at most once per specified interval in milliseconds. - * - * @param _rate_ms Minimum interval in milliseconds between log messages. - * @param _data Pointer to the data to be logged. - * @param _length Length of data (in bytes). - * @param _str Persistent, raw string. - */ -#define LOG_HEXDUMP_ERR_RATELIMIT_RATE(_rate_ms, _data, _length, _str) \ - _LOG_RATELIMIT_CORE(LOG_LEVEL_ERR, _rate_ms, "Skipped %d hexdump messages", \ - Z_LOG_HEXDUMP, _data, _length, _str) - -/** - * @brief Writes an ERROR level hexdump message to the log with rate limiting. - * - * @details It's meant to report severe errors, such as those from which it's - * not possible to recover, but with rate limiting to prevent log flooding. - * The message will be logged at most once per default interval (see - * CONFIG_LOG_RATELIMIT_INTERVAL_MS). - * - * @param _data Pointer to the data to be logged. - * @param _length Length of data (in bytes). - * @param _str Persistent, raw string. - */ -#define LOG_HEXDUMP_ERR_RATELIMIT(_data, _length, _str) \ - LOG_HEXDUMP_ERR_RATELIMIT_RATE(CONFIG_LOG_RATELIMIT_INTERVAL_MS, _data, _length, _str) - -/** - * @brief Writes a WARNING level hexdump message to the log with rate limiting. - * - * @details It's meant to register messages related to unusual situations that - * are not necessarily errors, but with rate limiting to prevent log flooding. - * The message will be logged at most once per specified interval in milliseconds. - * - * @param _rate_ms Minimum interval in milliseconds between log messages. - * @param _data Pointer to the data to be logged. - * @param _length Length of data (in bytes). - * @param _str Persistent, raw string. - */ -#define LOG_HEXDUMP_WRN_RATELIMIT_RATE(_rate_ms, _data, _length, _str) \ - _LOG_RATELIMIT_CORE(LOG_LEVEL_WRN, _rate_ms, "Skipped %d hexdump messages", \ - Z_LOG_HEXDUMP, _data, _length, _str) - -/** - * @brief Writes a WARNING level hexdump message to the log with rate limiting. - * - * @details It's meant to register messages related to unusual situations that - * are not necessarily errors, but with rate limiting to prevent log flooding. - * The message will be logged at most once per default interval (see - * CONFIG_LOG_RATELIMIT_INTERVAL_MS). - * - * @param _data Pointer to the data to be logged. - * @param _length Length of data (in bytes). - * @param _str Persistent, raw string. - */ -#define LOG_HEXDUMP_WRN_RATELIMIT(_data, _length, _str) \ - LOG_HEXDUMP_WRN_RATELIMIT_RATE(CONFIG_LOG_RATELIMIT_INTERVAL_MS, _data, _length, _str) - -/** - * @brief Writes an INFO level hexdump message to the log with rate limiting. - * - * @details It's meant to write generic user oriented messages with rate limiting - * to prevent log flooding. The message will be logged at most once per specified - * interval in milliseconds. - * - * @param _rate_ms Minimum interval in milliseconds between log messages. - * @param _data Pointer to the data to be logged. - * @param _length Length of data (in bytes). - * @param _str Persistent, raw string. - */ -#define LOG_HEXDUMP_INF_RATELIMIT_RATE(_rate_ms, _data, _length, _str) \ - _LOG_RATELIMIT_CORE(LOG_LEVEL_INF, _rate_ms, "Skipped %d hexdump messages", \ - Z_LOG_HEXDUMP, _data, _length, _str) - -/** - * @brief Writes an INFO level hexdump message to the log with rate limiting. - * - * @details It's meant to write generic user oriented messages with rate limiting - * to prevent log flooding. The message will be logged at most once per default - * interval (see CONFIG_LOG_RATELIMIT_INTERVAL_MS). - * - * @param _data Pointer to the data to be logged. - * @param _length Length of data (in bytes). - * @param _str Persistent, raw string. - */ -#define LOG_HEXDUMP_INF_RATELIMIT(_data, _length, _str) \ - LOG_HEXDUMP_INF_RATELIMIT_RATE(CONFIG_LOG_RATELIMIT_INTERVAL_MS, _data, _length, _str) - -/** - * @brief Writes a DEBUG level hexdump message to the log with rate limiting. - * - * @details It's meant to write developer oriented information with rate limiting - * to prevent log flooding. The message will be logged at most once per specified - * interval in milliseconds. - * - * @param _rate_ms Minimum interval in milliseconds between log messages. - * @param _data Pointer to the data to be logged. - * @param _length Length of data (in bytes). - * @param _str Persistent, raw string. - */ -#define LOG_HEXDUMP_DBG_RATELIMIT_RATE(_rate_ms, _data, _length, _str) \ - _LOG_RATELIMIT_CORE(LOG_LEVEL_DBG, _rate_ms, "Skipped %d hexdump messages", \ - Z_LOG_HEXDUMP, _data, _length, _str) - -/** - * @brief Writes a DEBUG level hexdump message to the log with rate limiting. - * - * @details It's meant to write developer oriented information with rate limiting - * to prevent log flooding. The message will be logged at most once per default - * interval (see CONFIG_LOG_RATELIMIT_INTERVAL_MS). - * - * @param _data Pointer to the data to be logged. - * @param _length Length of data (in bytes). - * @param _str Persistent, raw string. - */ -#define LOG_HEXDUMP_DBG_RATELIMIT(_data, _length, _str) \ - LOG_HEXDUMP_DBG_RATELIMIT_RATE(CONFIG_LOG_RATELIMIT_INTERVAL_MS, _data, _length, _str) - -#else /* CONFIG_LOG_RATELIMIT */ - -/* Rate-limited logging macros when CONFIG_LOG_RATELIMIT is disabled */ -#if defined(CONFIG_LOG_RATELIMIT_FALLBACK_DROP) -/* Fallback: Drop all prints (no output) */ -#define LOG_WRN_RATELIMIT_RATE(_rate_ms, ...) (void)0 -#define LOG_WRN_RATELIMIT(...) (void)0 -#define LOG_ERR_RATELIMIT_RATE(_rate_ms, ...) (void)0 -#define LOG_ERR_RATELIMIT(...) (void)0 -#define LOG_INF_RATELIMIT_RATE(_rate_ms, ...) (void)0 -#define LOG_INF_RATELIMIT(...) (void)0 -#define LOG_DBG_RATELIMIT_RATE(_rate_ms, ...) (void)0 -#define LOG_DBG_RATELIMIT(...) (void)0 -#define LOG_HEXDUMP_ERR_RATELIMIT_RATE(_rate_ms, _data, _length, _str) (void)0 -#define LOG_HEXDUMP_ERR_RATELIMIT(_data, _length, _str) (void)0 -#define LOG_HEXDUMP_WRN_RATELIMIT_RATE(_rate_ms, _data, _length, _str) (void)0 -#define LOG_HEXDUMP_WRN_RATELIMIT(_data, _length, _str) (void)0 -#define LOG_HEXDUMP_INF_RATELIMIT_RATE(_rate_ms, _data, _length, _str) (void)0 -#define LOG_HEXDUMP_INF_RATELIMIT(_data, _length, _str) (void)0 -#define LOG_HEXDUMP_DBG_RATELIMIT_RATE(_rate_ms, _data, _length, _str) (void)0 -#define LOG_HEXDUMP_DBG_RATELIMIT(_data, _length, _str) (void)0 -#else /* Catch all, not just CONFIG_LOG_RATELIMIT_FALLBACK_LOG */ -/* Fallback: Log all prints (ignore rate limiting) */ -#define LOG_WRN_RATELIMIT_RATE(_rate_ms, ...) LOG_WRN(__VA_ARGS__) -#define LOG_WRN_RATELIMIT(...) LOG_WRN(__VA_ARGS__) -#define LOG_ERR_RATELIMIT_RATE(_rate_ms, ...) LOG_ERR(__VA_ARGS__) -#define LOG_ERR_RATELIMIT(...) LOG_ERR(__VA_ARGS__) -#define LOG_INF_RATELIMIT_RATE(_rate_ms, ...) LOG_INF(__VA_ARGS__) -#define LOG_INF_RATELIMIT(...) LOG_INF(__VA_ARGS__) -#define LOG_DBG_RATELIMIT_RATE(_rate_ms, ...) LOG_DBG(__VA_ARGS__) -#define LOG_DBG_RATELIMIT(...) LOG_DBG(__VA_ARGS__) -#define LOG_HEXDUMP_ERR_RATELIMIT_RATE(_rate_ms, _data, _length, _str) \ - LOG_HEXDUMP_ERR(_data, _length, _str) -#define LOG_HEXDUMP_ERR_RATELIMIT(_data, _length, _str) \ - LOG_HEXDUMP_ERR(_data, _length, _str) -#define LOG_HEXDUMP_WRN_RATELIMIT_RATE(_rate_ms, _data, _length, _str) \ - LOG_HEXDUMP_WRN(_data, _length, _str) -#define LOG_HEXDUMP_WRN_RATELIMIT(_data, _length, _str) \ - LOG_HEXDUMP_WRN(_data, _length, _str) -#define LOG_HEXDUMP_INF_RATELIMIT_RATE(_rate_ms, _data, _length, _str) \ - LOG_HEXDUMP_INF(_data, _length, _str) -#define LOG_HEXDUMP_INF_RATELIMIT(_data, _length, _str) \ - LOG_HEXDUMP_INF(_data, _length, _str) -#define LOG_HEXDUMP_DBG_RATELIMIT_RATE(_rate_ms, _data, _length, _str) \ - LOG_HEXDUMP_DBG(_data, _length, _str) -#define LOG_HEXDUMP_DBG_RATELIMIT(_data, _length, _str) \ - LOG_HEXDUMP_DBG(_data, _length, _str) -#endif - -#endif /* CONFIG_LOG_RATELIMIT */ - /** * @brief Unconditionally print raw log message. * @@ -834,46 +499,6 @@ extern struct k_mem_partition k_log_partition; #define LOG_HEXDUMP_WRN(...) (void) 0 #define LOG_HEXDUMP_DBG(...) (void) 0 #define LOG_HEXDUMP_INF(...) (void) 0 - -#undef LOG_ERR_RATELIMIT -#undef LOG_WRN_RATELIMIT -#undef LOG_INF_RATELIMIT -#undef LOG_DBG_RATELIMIT - -#undef LOG_ERR_RATELIMIT_RATE -#undef LOG_WRN_RATELIMIT_RATE -#undef LOG_INF_RATELIMIT_RATE -#undef LOG_DBG_RATELIMIT_RATE - -#undef LOG_HEXDUMP_ERR_RATELIMIT -#undef LOG_HEXDUMP_WRN_RATELIMIT -#undef LOG_HEXDUMP_INF_RATELIMIT -#undef LOG_HEXDUMP_DBG_RATELIMIT - -#undef LOG_HEXDUMP_ERR_RATELIMIT_RATE -#undef LOG_HEXDUMP_WRN_RATELIMIT_RATE -#undef LOG_HEXDUMP_INF_RATELIMIT_RATE -#undef LOG_HEXDUMP_DBG_RATELIMIT_RATE - -#define LOG_ERR_RATELIMIT(...) (void) 0 -#define LOG_WRN_RATELIMIT(...) (void) 0 -#define LOG_INF_RATELIMIT(...) (void) 0 -#define LOG_DBG_RATELIMIT(...) (void) 0 - -#define LOG_HEXDUMP_ERR_RATELIMIT(...) (void) 0 -#define LOG_HEXDUMP_WRN_RATELIMIT(...) (void) 0 -#define LOG_HEXDUMP_INF_RATELIMIT(...) (void) 0 -#define LOG_HEXDUMP_DBG_RATELIMIT(...) (void) 0 - -#define LOG_ERR_RATELIMIT_RATE(...) (void) 0 -#define LOG_WRN_RATELIMIT_RATE(...) (void) 0 -#define LOG_INF_RATELIMIT_RATE(...) (void) 0 -#define LOG_DBG_RATELIMIT_RATE(...) (void) 0 - -#define LOG_HEXDUMP_ERR_RATELIMIT_RATE(...) (void) 0 -#define LOG_HEXDUMP_WRN_RATELIMIT_RATE(...) (void) 0 -#define LOG_HEXDUMP_INF_RATELIMIT_RATE(...) (void) 0 -#define LOG_HEXDUMP_DBG_RATELIMIT_RATE(...) (void) 0 #endif /** diff --git a/subsys/logging/Kconfig b/subsys/logging/Kconfig index 00a91f43c14c..f7a7b32b8047 100644 --- a/subsys/logging/Kconfig +++ b/subsys/logging/Kconfig @@ -49,56 +49,6 @@ endif rsource "Kconfig.misc" -config LOG_RATELIMIT - bool "Rate-limited logging macros" - default y - help - When enabled, provides rate-limited logging macros that prevent - log flooding when messages are generated frequently. Rate limiting - is per-macro-call-site, meaning each unique call has its own - independent rate limit. - -if LOG_RATELIMIT - -config LOG_RATELIMIT_INTERVAL_MS - int "Default rate limit interval (milliseconds)" - default 5000 - range 100 60000 - help - Default interval between rate-limited log messages. - This is used by the convenience macros LOG_*_RATELIMIT - when no explicit rate is provided. Can be overridden per call - using LOG_*_RATELIMIT_RATE macros. -endif # LOG_RATELIMIT - -if !LOG_RATELIMIT -choice LOG_RATELIMIT_FALLBACK - prompt "Fallback behavior for rate-limited logging macros" - default LOG_RATELIMIT_FALLBACK_DROP - help - Select fallback behavior for rate-limited logging macros when - LOG_RATELIMIT is disabled. - - - "Log all prints": All log prints are output, i.e., rate limiting is ignored. - - "Drop all prints": All log prints using rate-limited macros are dropped. - - This option allows you to control whether rate-limited log macros - should always print or be completely suppressed when rate limiting - is not available. - -config LOG_RATELIMIT_FALLBACK_LOG - bool "Log all prints (ignore rate limiting)" - help - All log prints using rate-limited macros are output as normal logs. - -config LOG_RATELIMIT_FALLBACK_DROP - bool "Drop all prints" - help - All log prints using rate-limited macros are dropped (no output). - -endchoice -endif # !LOG_RATELIMIT - endif # LOG config LOG_OUTPUT diff --git a/tests/subsys/logging/log_ratelimited/CMakeLists.txt b/tests/subsys/logging/log_ratelimited/CMakeLists.txt deleted file mode 100644 index 29df5637b030..000000000000 --- a/tests/subsys/logging/log_ratelimited/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2025 -# SPDX-License-Identifier: Apache-2.0 - -cmake_minimum_required(VERSION 3.20.0) -find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -project(log_ratelimited_test) - -FILE(GLOB app_sources *.c) -target_sources(app PRIVATE ${app_sources}) diff --git a/tests/subsys/logging/log_ratelimited/prj.conf b/tests/subsys/logging/log_ratelimited/prj.conf deleted file mode 100644 index e3621aa1a7ed..000000000000 --- a/tests/subsys/logging/log_ratelimited/prj.conf +++ /dev/null @@ -1,18 +0,0 @@ -CONFIG_MAIN_THREAD_PRIORITY=5 -CONFIG_ZTEST=y -CONFIG_TEST_USERSPACE=y -CONFIG_TEST_LOGGING_DEFAULTS=n -CONFIG_LOG=y -CONFIG_LOG_OUTPUT=y -CONFIG_LOG_PRINTK=n -CONFIG_LOG_BACKEND_UART=y -CONFIG_LOG_BUFFER_SIZE=768 -CONFIG_KERNEL_LOG_LEVEL_OFF=y -CONFIG_SOC_LOG_LEVEL_OFF=y -CONFIG_ARCH_LOG_LEVEL_OFF=y -CONFIG_LOG_FUNC_NAME_PREFIX_DBG=n -CONFIG_LOG_PROCESS_THREAD=n -CONFIG_ASSERT=y -CONFIG_MAIN_STACK_SIZE=4096 -CONFIG_LOG_DEFAULT_LEVEL=4 -CONFIG_LOG_RATELIMIT=y diff --git a/tests/subsys/logging/log_ratelimited/test_log_ratelimited.c b/tests/subsys/logging/log_ratelimited/test_log_ratelimited.c deleted file mode 100644 index ea22fe57964e..000000000000 --- a/tests/subsys/logging/log_ratelimited/test_log_ratelimited.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2025 - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include - -LOG_MODULE_REGISTER(test_log_ratelimited, CONFIG_LOG_DEFAULT_LEVEL); - -#ifndef CONFIG_LOG_RATELIMIT_FALLBACK_DROP -/* Test data for hexdump */ -static uint8_t test_data[] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08}; -#endif /* CONFIG_LOG_RATELIMIT_FALLBACK_DROP */ - -/** - * @brief Test compilation of all rate-limited macros. - * This test primarily checks for compilation errors and does not assert log - * counts, as log levels might filter some messages depending on Kconfig. - */ -ZTEST(log_ratelimited, test_compilation) -{ - /* This test only checks if the macros compile without errors. */ - /* Call each macro once to ensure compilation. */ - LOG_ERR_RATELIMIT("Compilation test: Error message"); - LOG_WRN_RATELIMIT("Compilation test: Warning message"); - LOG_INF_RATELIMIT("Compilation test: Info message"); - LOG_DBG_RATELIMIT("Compilation test: Debug message"); - - LOG_ERR_RATELIMIT_RATE(100, "Compilation test: Error message with rate"); - LOG_WRN_RATELIMIT_RATE(100, "Compilation test: Warning message with rate"); - LOG_INF_RATELIMIT_RATE(100, "Compilation test: Info message with rate"); - LOG_DBG_RATELIMIT_RATE(100, "Compilation test: Debug message with rate"); - - LOG_HEXDUMP_ERR_RATELIMIT(test_data, sizeof(test_data), - "Compilation test: Error hexdump"); - LOG_HEXDUMP_WRN_RATELIMIT(test_data, sizeof(test_data), - "Compilation test: Warning hexdump"); - LOG_HEXDUMP_INF_RATELIMIT(test_data, sizeof(test_data), - "Compilation test: Info hexdump"); - LOG_HEXDUMP_DBG_RATELIMIT(test_data, sizeof(test_data), - "Compilation test: Debug hexdump"); - - LOG_HEXDUMP_ERR_RATELIMIT_RATE(100, test_data, sizeof(test_data), - "Compilation test: Error hexdump with rate"); - LOG_HEXDUMP_WRN_RATELIMIT_RATE(100, test_data, sizeof(test_data), - "Compilation test: Warning hexdump with rate"); - LOG_HEXDUMP_INF_RATELIMIT_RATE(100, test_data, sizeof(test_data), - "Compilation test: Info hexdump with rate"); - LOG_HEXDUMP_DBG_RATELIMIT_RATE(100, test_data, sizeof(test_data), - "Compilation test: Debug hexdump with rate"); - - zassert_true(true, "All rate-limited macros compile successfully"); -} - - -/* Define the test suite and specify the setup function to be called before each - * test case. - */ -ZTEST_SUITE(log_ratelimited, NULL, NULL, NULL, NULL, NULL); diff --git a/tests/subsys/logging/log_ratelimited/testcase.yaml b/tests/subsys/logging/log_ratelimited/testcase.yaml deleted file mode 100644 index 5fa2d18a5626..000000000000 --- a/tests/subsys/logging/log_ratelimited/testcase.yaml +++ /dev/null @@ -1,23 +0,0 @@ -common: - integration_platforms: - - native_sim - tags: - - logging - platform_allow: - - native_sim - -tests: - logging.log_ratelimited: - build_only: true - extra_configs: - - CONFIG_LOG_RATELIMIT_INTERVAL_MS=1000 - logging.log_ratelimited.fallback_drop: - build_only: true - extra_configs: - - CONFIG_LOG_RATELIMIT=n - - CONFIG_LOG_RATELIMIT_FALLBACK_DROP=y - logging.log_ratelimited.fallback_log: - build_only: true - extra_configs: - - CONFIG_LOG_RATELIMIT=n - - CONFIG_LOG_RATELIMIT_FALLBACK_LOG=y From 2538af6473f8a670cd232fd2bd452f0966af6aa0 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:50 +0300 Subject: [PATCH 1231/2141] Revert "[nrf fromtree] modules: nrf_wifi: Fix build error" This reverts commit 446998834133fc1ef18874055f99531700a34f6e. Signed-off-by: Jukka Rissanen --- modules/nrf_wifi/os/shim.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/nrf_wifi/os/shim.c b/modules/nrf_wifi/os/shim.c index 79137e46e13f..6fb329cfd069 100644 --- a/modules/nrf_wifi/os/shim.c +++ b/modules/nrf_wifi/os/shim.c @@ -199,11 +199,11 @@ static void *zep_shim_spinlock_alloc(void) { struct k_mutex *lock = NULL; - lock = k_heap_aligned_alloc(wifi_ctrl_pool, WORD_SIZE, sizeof(*lock), K_FOREVER); - if (!lock) { + slock = k_heap_aligned_alloc(wifi_ctrl_pool, WORD_SIZE, sizeof(*slock), K_FOREVER); + if (!slock) { LOG_ERR("%s: Unable to allocate memory for spinlock", __func__); } else { - memset(lock, 0, sizeof(*lock)); + memset(slock, 0, sizeof(*slock)); } return lock; From 618ff5f348562ad81c600fa3c67746c3982693d4 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:50 +0300 Subject: [PATCH 1232/2141] Revert "[nrf fromtree] Revert "modules: nrf_wifi: Use spinlocks"" This reverts commit 34e6741ed4104a5eb1dd68061f4848f6ca569d3c. Signed-off-by: Jukka Rissanen --- modules/nrf_wifi/os/shim.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/modules/nrf_wifi/os/shim.c b/modules/nrf_wifi/os/shim.c index 6fb329cfd069..fba771284c66 100644 --- a/modules/nrf_wifi/os/shim.c +++ b/modules/nrf_wifi/os/shim.c @@ -195,9 +195,14 @@ static void zep_shim_qspi_cpy_to(void *priv, unsigned long addr, const void *src } #endif /* !CONFIG_NRF71_ON_IPC */ +struct zep_shim_spinlock { + struct k_spinlock lock; + k_spinlock_key_t key; +}; + static void *zep_shim_spinlock_alloc(void) { - struct k_mutex *lock = NULL; + struct zep_shim_spinlock *slock = NULL; slock = k_heap_aligned_alloc(wifi_ctrl_pool, WORD_SIZE, sizeof(*slock), K_FOREVER); if (!slock) { @@ -206,7 +211,7 @@ static void *zep_shim_spinlock_alloc(void) memset(slock, 0, sizeof(*slock)); } - return lock; + return slock; } static void zep_shim_spinlock_free(void *lock) @@ -218,29 +223,38 @@ static void zep_shim_spinlock_free(void *lock) static void zep_shim_spinlock_init(void *lock) { - k_mutex_init(lock); + /* No explicit initialization needed for k_spinlock_t */ + ARG_UNUSED(lock); } static void zep_shim_spinlock_take(void *lock) { - k_mutex_lock(lock, K_FOREVER); + struct zep_shim_spinlock *slock = (struct zep_shim_spinlock *)lock; + + slock->key = k_spin_lock(&slock->lock); } static void zep_shim_spinlock_rel(void *lock) { - k_mutex_unlock(lock); + struct zep_shim_spinlock *slock = (struct zep_shim_spinlock *)lock; + + k_spin_unlock(&slock->lock, slock->key); } static void zep_shim_spinlock_irq_take(void *lock, unsigned long *flags) { + struct zep_shim_spinlock *slock = (struct zep_shim_spinlock *)lock; + ARG_UNUSED(flags); - k_mutex_lock(lock, K_FOREVER); + slock->key = k_spin_lock(&slock->lock); } static void zep_shim_spinlock_irq_rel(void *lock, unsigned long *flags) { + struct zep_shim_spinlock *slock = (struct zep_shim_spinlock *)lock; + ARG_UNUSED(flags); - k_mutex_unlock(lock); + k_spin_unlock(&slock->lock, slock->key); } static int zep_shim_pr_dbg(const char *fmt, va_list args) From 80c0a62db199bba15b2c636be96c292e3016c51c Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:50 +0300 Subject: [PATCH 1233/2141] Revert "[nrf fromtree] modified: nrf_wifi: Refactor heap calls" This reverts commit 4142fcf4c635d8db389b4551e0a45700be0ae596. Signed-off-by: Jukka Rissanen --- modules/nrf_wifi/os/shim.c | 47 ++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/modules/nrf_wifi/os/shim.c b/modules/nrf_wifi/os/shim.c index fba771284c66..a92720b6dce8 100644 --- a/modules/nrf_wifi/os/shim.c +++ b/modules/nrf_wifi/os/shim.c @@ -34,14 +34,7 @@ LOG_MODULE_REGISTER(wifi_nrf, CONFIG_WIFI_NRF70_LOG_LEVEL); -/* Memory pool management - unified pool-based API */ -#if defined(CONFIG_NRF_WIFI_GLOBAL_HEAP) -/* Use global system heap */ -extern struct sys_heap _system_heap; -static struct k_heap * const wifi_ctrl_pool = &_system_heap; -static struct k_heap * const wifi_data_pool = &_system_heap; -#else -/* Use dedicated heaps */ +#if !defined(CONFIG_NRF_WIFI_GLOBAL_HEAP) #if defined(CONFIG_NOCACHE_MEMORY) K_HEAP_DEFINE_NOCACHE(wifi_drv_ctrl_mem_pool, CONFIG_NRF_WIFI_CTRL_HEAP_SIZE); K_HEAP_DEFINE_NOCACHE(wifi_drv_data_mem_pool, CONFIG_NRF_WIFI_DATA_HEAP_SIZE); @@ -49,8 +42,6 @@ K_HEAP_DEFINE_NOCACHE(wifi_drv_data_mem_pool, CONFIG_NRF_WIFI_DATA_HEAP_SIZE); K_HEAP_DEFINE(wifi_drv_ctrl_mem_pool, CONFIG_NRF_WIFI_CTRL_HEAP_SIZE); K_HEAP_DEFINE(wifi_drv_data_mem_pool, CONFIG_NRF_WIFI_DATA_HEAP_SIZE); #endif /* CONFIG_NOCACHE_MEMORY */ -static struct k_heap * const wifi_ctrl_pool = &wifi_drv_ctrl_mem_pool; -static struct k_heap * const wifi_data_pool = &wifi_drv_data_mem_pool; #endif /* CONFIG_NRF_WIFI_GLOBAL_HEAP */ #define WORD_SIZE 4 @@ -61,14 +52,22 @@ static void *zep_shim_mem_alloc(size_t size) { size_t size_aligned = ROUND_UP(size, 4); - return k_heap_aligned_alloc(wifi_ctrl_pool, WORD_SIZE, size_aligned, K_FOREVER); +#if defined(CONFIG_NRF_WIFI_GLOBAL_HEAP) + return k_malloc(size_aligned); +#else /* CONFIG_NRF_WIFI_GLOBAL_HEAP */ + return k_heap_aligned_alloc(&wifi_drv_ctrl_mem_pool, WORD_SIZE, size_aligned, K_FOREVER); +#endif /* CONFIG_NRF_WIFI_GLOBAL_HEAP */ } static void *zep_shim_data_mem_alloc(size_t size) { size_t size_aligned = ROUND_UP(size, 4); - return k_heap_aligned_alloc(wifi_data_pool, WORD_SIZE, size_aligned, K_FOREVER); +#if defined(CONFIG_NRF_WIFI_GLOBAL_HEAP) + return k_malloc(size_aligned); +#else /* CONFIG_NRF_WIFI_GLOBAL_HEAP */ + return k_heap_aligned_alloc(&wifi_drv_data_mem_pool, WORD_SIZE, size_aligned, K_FOREVER); +#endif /* CONFIG_NRF_WIFI_GLOBAL_HEAP */ } static void *zep_shim_mem_zalloc(size_t size) @@ -112,14 +111,22 @@ static void *zep_shim_data_mem_zalloc(size_t size) static void zep_shim_mem_free(void *buf) { if (buf) { - k_heap_free(wifi_ctrl_pool, buf); +#if defined(CONFIG_NRF_WIFI_GLOBAL_HEAP) + k_free(buf); +#else /* CONFIG_NRF_WIFI_GLOBAL_HEAP */ + k_heap_free(&wifi_drv_ctrl_mem_pool, buf); +#endif /* CONFIG_NRF_WIFI_GLOBAL_HEAP */ } } static void zep_shim_data_mem_free(void *buf) { if (buf) { - k_heap_free(wifi_data_pool, buf); +#if defined(CONFIG_NRF_WIFI_GLOBAL_HEAP) + k_free(buf); +#else /* CONFIG_NRF_WIFI_GLOBAL_HEAP */ + k_heap_free(&wifi_drv_data_mem_pool, buf); +#endif /* CONFIG_NRF_WIFI_GLOBAL_HEAP */ } } @@ -204,11 +211,9 @@ static void *zep_shim_spinlock_alloc(void) { struct zep_shim_spinlock *slock = NULL; - slock = k_heap_aligned_alloc(wifi_ctrl_pool, WORD_SIZE, sizeof(*slock), K_FOREVER); + slock = k_calloc(sizeof(*slock), sizeof(char)); if (!slock) { LOG_ERR("%s: Unable to allocate memory for spinlock", __func__); - } else { - memset(slock, 0, sizeof(*slock)); } return slock; @@ -216,9 +221,11 @@ static void *zep_shim_spinlock_alloc(void) static void zep_shim_spinlock_free(void *lock) { - if (lock) { - k_heap_free(wifi_ctrl_pool, lock); - } +#if defined(CONFIG_NRF_WIFI_GLOBAL_HEAP) + k_free(lock); +#else + k_heap_free(&wifi_drv_ctrl_mem_pool, lock); +#endif } static void zep_shim_spinlock_init(void *lock) From a9ee61656841e302ff5f1a0082fbed20d6cfac5d Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:50 +0300 Subject: [PATCH 1234/2141] Revert "[nrf fromtree] modules: nrf_wifi: Use spinlocks" This reverts commit 4e7cb9a82e8dcbd607868c597f07da8c0ec6d94f. Signed-off-by: Jukka Rissanen --- modules/nrf_wifi/os/shim.c | 37 ++++++++++++------------------------- 1 file changed, 12 insertions(+), 25 deletions(-) diff --git a/modules/nrf_wifi/os/shim.c b/modules/nrf_wifi/os/shim.c index a92720b6dce8..df460d5ab53e 100644 --- a/modules/nrf_wifi/os/shim.c +++ b/modules/nrf_wifi/os/shim.c @@ -202,66 +202,53 @@ static void zep_shim_qspi_cpy_to(void *priv, unsigned long addr, const void *src } #endif /* !CONFIG_NRF71_ON_IPC */ -struct zep_shim_spinlock { - struct k_spinlock lock; - k_spinlock_key_t key; -}; - static void *zep_shim_spinlock_alloc(void) { - struct zep_shim_spinlock *slock = NULL; + struct k_mutex *lock = NULL; + + lock = zep_shim_mem_zalloc(sizeof(*lock)); - slock = k_calloc(sizeof(*slock), sizeof(char)); - if (!slock) { + if (!lock) { LOG_ERR("%s: Unable to allocate memory for spinlock", __func__); } - return slock; + return lock; } static void zep_shim_spinlock_free(void *lock) { #if defined(CONFIG_NRF_WIFI_GLOBAL_HEAP) k_free(lock); -#else +#else /* CONFIG_NRF_WIFI_GLOBAL_HEAP */ k_heap_free(&wifi_drv_ctrl_mem_pool, lock); -#endif +#endif /* CONFIG_NRF_WIFI_GLOBAL_HEAP */ } static void zep_shim_spinlock_init(void *lock) { - /* No explicit initialization needed for k_spinlock_t */ - ARG_UNUSED(lock); + k_mutex_init(lock); } static void zep_shim_spinlock_take(void *lock) { - struct zep_shim_spinlock *slock = (struct zep_shim_spinlock *)lock; - - slock->key = k_spin_lock(&slock->lock); + k_mutex_lock(lock, K_FOREVER); } static void zep_shim_spinlock_rel(void *lock) { - struct zep_shim_spinlock *slock = (struct zep_shim_spinlock *)lock; - - k_spin_unlock(&slock->lock, slock->key); + k_mutex_unlock(lock); } static void zep_shim_spinlock_irq_take(void *lock, unsigned long *flags) { - struct zep_shim_spinlock *slock = (struct zep_shim_spinlock *)lock; - ARG_UNUSED(flags); - slock->key = k_spin_lock(&slock->lock); + k_mutex_lock(lock, K_FOREVER); } static void zep_shim_spinlock_irq_rel(void *lock, unsigned long *flags) { - struct zep_shim_spinlock *slock = (struct zep_shim_spinlock *)lock; - ARG_UNUSED(flags); - k_spin_unlock(&slock->lock, slock->key); + k_mutex_unlock(lock); } static int zep_shim_pr_dbg(const char *fmt, va_list args) From 1d2579168eda2822735e2846ffdacb678811af06 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:50 +0300 Subject: [PATCH 1235/2141] Revert "[nrf fromlist] drivers: spi: nrfx_spi(m/s): enable cross domain pins for nRF54L15" This reverts commit 018480248f63ca34c4fd9e343be9a54f0aa30d42. Signed-off-by: Jukka Rissanen --- drivers/spi/spi_nrfx_spim.c | 102 ++--------------- drivers/spi/spi_nrfx_spis.c | 106 +++--------------- dts/bindings/spi/nordic,nrf-spi-common.yaml | 10 -- dts/vendor/nordic/nrf54l_05_10_15.dtsi | 4 - ...l15dk_nrf54l15_cpuapp_cross_domain.overlay | 73 ------------ .../spi_controller_peripheral/testcase.yaml | 15 --- 6 files changed, 22 insertions(+), 288 deletions(-) delete mode 100644 tests/drivers/spi/spi_controller_peripheral/boards/nrf54l15dk_nrf54l15_cpuapp_cross_domain.overlay diff --git a/drivers/spi/spi_nrfx_spim.c b/drivers/spi/spi_nrfx_spim.c index f1d6f8125d67..0646c67b4a33 100644 --- a/drivers/spi/spi_nrfx_spim.c +++ b/drivers/spi/spi_nrfx_spim.c @@ -43,16 +43,6 @@ LOG_MODULE_REGISTER(spi_nrfx_spim, CONFIG_SPI_LOG_LEVEL); #define SPI_BUFFER_IN_RAM 1 #endif -/* - * We use NODELABEL here because the nrfx API requires us to call - * functions which are named according to SoC peripheral instance - * being operated on. Since DT_INST() makes no guarantees about that, - * it won't work. - */ -#define SPIM(idx) DT_NODELABEL(spi##idx) -#define SPIM_PROP(idx, prop) DT_PROP(SPIM(idx), prop) -#define SPIM_HAS_PROP(idx, prop) DT_NODE_HAS_PROP(SPIM(idx), prop) - #if defined(CONFIG_CLOCK_CONTROL_NRF_HSFLL_GLOBAL) #define SPIM_REQUESTS_CLOCK(node) \ DT_NODE_HAS_COMPAT(DT_CLOCKS_CTLR(node), nordic_nrf_hsfll_global) @@ -69,28 +59,6 @@ BUILD_ASSERT(!IS_ENABLED(CONFIG_PM_DEVICE_SYSTEM_MANAGED)); #define SPIM_REQUESTS_CLOCK(node) 0 #endif -#define SPIM_PINS_CROSS_DOMAIN(unused, prefix, idx, _) \ - COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(SPIM(prefix##idx)), \ - (SPIM_PROP(idx, cross_domain_pins_supported)), \ - (0)) - -#if NRFX_FOREACH_PRESENT(SPIM, SPIM_PINS_CROSS_DOMAIN, (||), (0)) -#include -/* Certain SPIM instances support usage of cross domain pins in form of dedicated pins on - * a port different from the default one. - */ -#define SPIM_CROSS_DOMAIN_SUPPORTED 1 -#endif - -#if SPIM_CROSS_DOMAIN_SUPPORTED && defined(CONFIG_NRF_SYS_EVENT) -#include -/* To use cross domain pins, constant latency mode needs to be applied, which is - * handled via nrf_sys_event requests. - */ -#define SPIM_CROSS_DOMAIN_PINS_HANDLE 1 -#endif - - struct spi_nrfx_data { struct spi_context ctx; const struct device *dev; @@ -130,10 +98,6 @@ struct spi_nrfx_config { const struct device *clk_dev; struct nrf_clock_spec clk_spec; #endif -#if SPIM_CROSS_DOMAIN_SUPPORTED - bool cross_domain; - int8_t default_port; -#endif }; static void event_handler(const nrfx_spim_evt_t *p_event, void *p_context); @@ -183,32 +147,6 @@ static inline void release_clock(const struct device *dev) #endif } -#if SPIM_CROSS_DOMAIN_SUPPORTED -static bool spim_has_cross_domain_connection(const struct spi_nrfx_config *config) -{ - const struct pinctrl_dev_config *pcfg = config->pcfg; - const struct pinctrl_state *state; - int ret; - - ret = pinctrl_lookup_state(pcfg, PINCTRL_STATE_DEFAULT, &state); - if (ret < 0) { - LOG_ERR("Unable to read pin state"); - return false; - } - - for (uint8_t i = 0U; i < state->pin_cnt; i++) { - uint32_t pin = NRF_GET_PIN(state->pins[i]); - - if ((pin != NRF_PIN_DISCONNECTED) && - (nrf_gpio_pin_port_number_extract(&pin) != config->default_port)) { - return true; - } - } - - return false; -} -#endif - static inline void finalize_spi_transaction(const struct device *dev, bool deactivate_cs) { struct spi_nrfx_data *dev_data = dev->data; @@ -750,19 +688,6 @@ static int spim_resume(const struct device *dev) #ifdef CONFIG_SOC_NRF54H20_GPD nrf_gpd_retain_pins_set(dev_config->pcfg, false); #endif -#if SPIM_CROSS_DOMAIN_SUPPORTED - if (dev_config->cross_domain && spim_has_cross_domain_connection(dev_config)) { -#if SPIM_CROSS_DOMAIN_PINS_HANDLE - int err; - - err = nrf_sys_event_request_global_constlat(); - (void)err; - __ASSERT_NO_MSG(err >= 0); -#else - __ASSERT(false, "NRF_SYS_EVENT needs to be enabled to use cross domain pins.\n"); -#endif - } -#endif return IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME) ? request_clock(dev) : 0; } @@ -786,19 +711,6 @@ static void spim_suspend(const struct device *dev) #ifdef CONFIG_SOC_NRF54H20_GPD nrf_gpd_retain_pins_set(dev_config->pcfg, true); #endif -#if SPIM_CROSS_DOMAIN_SUPPORTED - if (dev_config->cross_domain && spim_has_cross_domain_connection(dev_config)) { -#if SPIM_CROSS_DOMAIN_PINS_HANDLE - int err; - - err = nrf_sys_event_request_global_constlat(); - (void)err; - __ASSERT_NO_MSG(err >= 0); -#else - __ASSERT(false, "NRF_SYS_EVENT needs to be enabled to use cross domain pins.\n"); -#endif - } -#endif (void)pinctrl_apply_state(dev_config->pcfg, PINCTRL_STATE_SLEEP); } @@ -878,6 +790,15 @@ static int spi_nrfx_deinit(const struct device *dev) return 0; } +/* + * We use NODELABEL here because the nrfx API requires us to call + * functions which are named according to SoC peripheral instance + * being operated on. Since DT_INST() makes no guarantees about that, + * it won't work. + */ +#define SPIM(idx) DT_NODELABEL(spi##idx) +#define SPIM_PROP(idx, prop) DT_PROP(SPIM(idx), prop) +#define SPIM_HAS_PROP(idx, prop) DT_NODE_HAS_PROP(SPIM(idx), prop) #define SPIM_MEM_REGION(idx) DT_PHANDLE(SPIM(idx), memory_regions) #define SPI_NRFX_SPIM_EXTENDED_CONFIG(idx) \ @@ -969,11 +890,6 @@ static int spi_nrfx_deinit(const struct device *dev) .clk_spec = { \ .frequency = NRF_CLOCK_CONTROL_FREQUENCY_MAX, \ },)) \ - IF_ENABLED(SPIM_PINS_CROSS_DOMAIN(_, /*empty*/, idx, _), \ - (.cross_domain = true, \ - .default_port = \ - DT_PROP_OR(DT_PHANDLE(SPIM(idx), \ - default_gpio_port), port, -1),)) \ }; \ BUILD_ASSERT(!SPIM_HAS_PROP(idx, wake_gpios) || \ !(DT_GPIO_FLAGS(SPIM(idx), wake_gpios) & GPIO_ACTIVE_LOW),\ diff --git a/drivers/spi/spi_nrfx_spis.c b/drivers/spi/spi_nrfx_spis.c index 8ab8de979555..ceb479c0441f 100644 --- a/drivers/spi/spi_nrfx_spis.c +++ b/drivers/spi/spi_nrfx_spis.c @@ -36,38 +36,6 @@ LOG_MODULE_REGISTER(spi_nrfx_spis, CONFIG_SPI_LOG_LEVEL); BUILD_ASSERT(!IS_ENABLED(CONFIG_PM_DEVICE_SYSTEM_MANAGED)); #endif -/* - * Current factors requiring use of DT_NODELABEL: - * - * - HAL design (requirement of drv_inst_idx in nrfx_spis_t) - * - Name-based HAL IRQ handlers, e.g. nrfx_spis_0_irq_handler - */ -#define SPIS_NODE(idx) COND_CODE_1(SPIS_IS_FAST(idx), (spis##idx), (spi##idx)) -#define SPIS(idx) DT_NODELABEL(SPIS_NODE(idx)) -#define SPIS_PROP(idx, prop) DT_PROP(SPIS(idx), prop) -#define SPIS_HAS_PROP(idx, prop) DT_NODE_HAS_PROP(SPIS(idx), prop) - -#define SPIS_PINS_CROSS_DOMAIN(unused, prefix, idx, _) \ - COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(SPIS(prefix##idx)), \ - (SPIS_PROP(idx, cross_domain_pins_supported)), \ - (0)) - -#if NRFX_FOREACH_PRESENT(SPIS, SPIS_PINS_CROSS_DOMAIN, (||), (0)) -#include -/* Certain SPIM instances support usage of cross domain pins in form of dedicated pins on - * a port different from the default one. - */ -#define SPIS_CROSS_DOMAIN_SUPPORTED 1 -#endif - -#if SPIS_CROSS_DOMAIN_SUPPORTED && defined(CONFIG_NRF_SYS_EVENT) -#include -/* To use cross domain pins, constant latency mode needs to be applied, which is - * handled via nrf_sys_event requests. - */ -#define SPIS_CROSS_DOMAIN_PINS_HANDLE 1 -#endif - struct spi_nrfx_data { struct spi_context ctx; const struct device *dev; @@ -90,38 +58,8 @@ struct spi_nrfx_config { const struct pinctrl_dev_config *pcfg; struct gpio_dt_spec wake_gpio; void *mem_reg; -#if SPIS_CROSS_DOMAIN_SUPPORTED - bool cross_domain; - int8_t default_port; -#endif }; -#if SPIS_CROSS_DOMAIN_SUPPORTED -static bool spis_has_cross_domain_connection(const struct spi_nrfx_config *config) -{ - const struct pinctrl_dev_config *pcfg = config->pcfg; - const struct pinctrl_state *state; - int ret; - - ret = pinctrl_lookup_state(pcfg, PINCTRL_STATE_DEFAULT, &state); - if (ret < 0) { - LOG_ERR("Unable to read pin state"); - return false; - } - - for (uint8_t i = 0U; i < state->pin_cnt; i++) { - uint32_t pin = NRF_GET_PIN(state->pins[i]); - - if ((pin != NRF_PIN_DISCONNECTED) && - (nrf_gpio_pin_port_number_extract(&pin) != config->default_port)) { - return true; - } - } - - return false; -} -#endif - static inline nrf_spis_mode_t get_nrf_spis_mode(uint16_t operation) { if (SPI_MODE_GET(operation) & SPI_MODE_CPOL) { @@ -446,19 +384,6 @@ static void spi_nrfx_suspend(const struct device *dev) nrf_gpd_retain_pins_set(dev_config->pcfg, true); } #endif -#if SPIS_CROSS_DOMAIN_SUPPORTED - if (dev_config->cross_domain && spis_has_cross_domain_connection(dev_config)) { -#if SPIS_CROSS_DOMAIN_PINS_HANDLE - int err; - - err = nrf_sys_event_request_global_constlat(); - (void)err; - __ASSERT_NO_MSG(err >= 0); -#else - __ASSERT(false, "NRF_SYS_EVENT needs to be enabled to use cross domain pins.\n"); -#endif - } -#endif (void)pinctrl_apply_state(dev_config->pcfg, PINCTRL_STATE_SLEEP); } @@ -474,19 +399,6 @@ static void spi_nrfx_resume(const struct device *dev) nrf_gpd_retain_pins_set(dev_config->pcfg, false); } #endif -#if SPIS_CROSS_DOMAIN_SUPPORTED - if (dev_config->cross_domain && spis_has_cross_domain_connection(dev_config)) { -#if SPIS_CROSS_DOMAIN_PINS_HANDLE - int err; - - err = nrf_sys_event_request_global_constlat(); - (void)err; - __ASSERT_NO_MSG(err >= 0); -#else - __ASSERT(false, "NRF_SYS_EVENT needs to be enabled to use cross domain pins.\n"); -#endif - } -#endif if (dev_config->wake_gpio.port == NULL) { nrf_spis_enable(dev_config->spis.p_reg); @@ -570,6 +482,19 @@ static int spi_nrfx_init(const struct device *dev) return pm_device_driver_init(dev, spi_nrfx_pm_action); } +/* + * Current factors requiring use of DT_NODELABEL: + * + * - HAL design (requirement of drv_inst_idx in nrfx_spis_t) + * - Name-based HAL IRQ handlers, e.g. nrfx_spis_0_irq_handler + */ + +#define SPIS_NODE(idx) COND_CODE_1(SPIS_IS_FAST(idx), (spis##idx), (spi##idx)) + +#define SPIS(idx) DT_NODELABEL(SPIS_NODE(idx)) + +#define SPIS_PROP(idx, prop) DT_PROP(SPIS(idx), prop) + #define SPI_NRFX_SPIS_DEFINE(idx) \ static void irq_connect##idx(void) \ { \ @@ -608,11 +533,6 @@ static int spi_nrfx_init(const struct device *dev) NRFX_MHZ_TO_HZ(16UL),)) \ .wake_gpio = GPIO_DT_SPEC_GET_OR(SPIS(idx), wake_gpios, {0}), \ .mem_reg = DMM_DEV_TO_REG(SPIS(idx)), \ - IF_ENABLED(SPIS_PINS_CROSS_DOMAIN(_, /*empty*/, idx, _), \ - (.cross_domain = true, \ - .default_port = \ - DT_PROP_OR(DT_PHANDLE(SPIS(idx), \ - default_gpio_port), port, -1),)) \ }; \ BUILD_ASSERT(!DT_NODE_HAS_PROP(SPIS(idx), wake_gpios) || \ !(DT_GPIO_FLAGS(SPIS(idx), wake_gpios) & GPIO_ACTIVE_LOW),\ diff --git a/dts/bindings/spi/nordic,nrf-spi-common.yaml b/dts/bindings/spi/nordic,nrf-spi-common.yaml index e76d785b2f42..dc81950aed3d 100644 --- a/dts/bindings/spi/nordic,nrf-spi-common.yaml +++ b/dts/bindings/spi/nordic,nrf-spi-common.yaml @@ -61,13 +61,3 @@ properties: and SPI master again keeps the line in the low state Please note that the line must be configured and properly handled on both sides for the mechanism to work correctly. - - default-gpio-port: - type: phandle - description: | - SPI default GPIO port. - - cross-domain-pins-supported: - type: boolean - description: | - SPI allows usage of cross domain pins with constant latency mode required. diff --git a/dts/vendor/nordic/nrf54l_05_10_15.dtsi b/dts/vendor/nordic/nrf54l_05_10_15.dtsi index aa259713d2fd..9a41f013b3ed 100644 --- a/dts/vendor/nordic/nrf54l_05_10_15.dtsi +++ b/dts/vendor/nordic/nrf54l_05_10_15.dtsi @@ -311,8 +311,6 @@ rx-delay-supported; rx-delay = <1>; status = "disabled"; - default-gpio-port = <&gpio1>; - cross-domain-pins-supported; }; uart20: uart@c6000 { @@ -354,8 +352,6 @@ rx-delay-supported; rx-delay = <1>; status = "disabled"; - default-gpio-port = <&gpio1>; - cross-domain-pins-supported; }; uart21: uart@c7000 { diff --git a/tests/drivers/spi/spi_controller_peripheral/boards/nrf54l15dk_nrf54l15_cpuapp_cross_domain.overlay b/tests/drivers/spi/spi_controller_peripheral/boards/nrf54l15dk_nrf54l15_cpuapp_cross_domain.overlay deleted file mode 100644 index f2e1ac5ce4ec..000000000000 --- a/tests/drivers/spi/spi_controller_peripheral/boards/nrf54l15dk_nrf54l15_cpuapp_cross_domain.overlay +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&pinctrl { - spi21_default_alt: spi21_default_alt { - group1 { - psels = , - , - ; - }; - }; - - spi21_sleep_alt: spi21_sleep_alt { - group1 { - psels = , - , - ; - low-power-enable; - }; - }; - - spi22_default_alt: spi22_default_alt { - group1 { - psels = , - , - , - ; - }; - }; - - spi22_sleep_alt: spi22_sleep_alt { - group1 { - psels = , - , - , - ; - low-power-enable; - }; - }; -}; - -&gpio2 { - status = "okay"; -}; - -&spi21 { - status = "okay"; - pinctrl-0 = <&spi21_default_alt>; - pinctrl-1 = <&spi21_sleep_alt>; - pinctrl-names = "default", "sleep"; - overrun-character = <0x00>; - cs-gpios = <&gpio2 10 GPIO_ACTIVE_LOW>; - zephyr,pm-device-runtime-auto; - dut_spi_dt: test-spi-dev@0 { - compatible = "vnd,spi-device"; - reg = <0>; - spi-max-frequency = ; - }; -}; - -dut_spis: &spi22 { - compatible = "nordic,nrf-spis"; - status = "okay"; - def-char = <0x00>; - pinctrl-0 = <&spi22_default_alt>; - pinctrl-1 = <&spi22_sleep_alt>; - pinctrl-names = "default", "sleep"; - /delete-property/rx-delay-supported; - /delete-property/rx-delay; -}; diff --git a/tests/drivers/spi/spi_controller_peripheral/testcase.yaml b/tests/drivers/spi/spi_controller_peripheral/testcase.yaml index f385c3073e92..10365d8014dc 100644 --- a/tests/drivers/spi/spi_controller_peripheral/testcase.yaml +++ b/tests/drivers/spi/spi_controller_peripheral/testcase.yaml @@ -102,18 +102,3 @@ tests: - CONFIG_PM_DEVICE=y - CONFIG_PM_DEVICE_RUNTIME=y filter: CONFIG_SOC_FAMILY_NORDIC_NRF - - drivers.spi.spi_cross_domain: - harness_config: - fixture: spi_p1_p2_loopback - extra_configs: - - CONFIG_TESTED_SPI_MODE=0 - - CONFIG_NRF_SYS_EVENT=y - extra_args: DTC_OVERLAY_FILE="boards/nrf54l15dk_nrf54l15_cpuapp_cross_domain.overlay" - platform_exclude: - - nrf52840dk/nrf52840 - - nrf54h20dk/nrf54h20/cpuapp - - nrf54h20dk/nrf54h20/cpurad - - nrf54h20dk/nrf54h20/cpuppr - - nrf54l20pdk/nrf54l20/cpuapp - - ophelia4ev/nrf54l15/cpuapp From b26cfd0bc840ef9504894e832f6b5957b808b347 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:51 +0300 Subject: [PATCH 1236/2141] Revert "[nrf fromlist] drivers: serial: nrfx_uarte: enable cross domain pins for nRF54L15" This reverts commit 20db3ee4cf31537296f92c68cea67cb7707c8f3d. Signed-off-by: Jukka Rissanen --- drivers/serial/uart_nrfx_uarte.c | 82 ------------------- dts/bindings/serial/nordic,nrf-uarte.yaml | 10 --- dts/vendor/nordic/nrf54l_05_10_15.dtsi | 4 - ...l15dk_nrf54l15_cpuapp_cross_domain.overlay | 31 ------- .../uart/uart_elementary/testcase.yaml | 9 -- 5 files changed, 136 deletions(-) delete mode 100644 tests/drivers/uart/uart_elementary/boards/nrf54l15dk_nrf54l15_cpuapp_cross_domain.overlay diff --git a/drivers/serial/uart_nrfx_uarte.c b/drivers/serial/uart_nrfx_uarte.c index 20b6cad541de..1c75f4432280 100644 --- a/drivers/serial/uart_nrfx_uarte.c +++ b/drivers/serial/uart_nrfx_uarte.c @@ -148,27 +148,6 @@ BUILD_ASSERT(IS_ENABLED(CONFIG_CLOCK_CONTROL)); */ #define UARTE_ANY_HIGH_SPEED (UARTE_FOR_EACH_INSTANCE(INSTANCE_IS_HIGH_SPEED, (||), (0))) -#define UARTE_PINS_CROSS_DOMAIN(unused, prefix, idx, _) \ - COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(UARTE(prefix##idx)), \ - (UARTE_PROP(idx, cross_domain_pins_supported)), \ - (0)) - -#if UARTE_FOR_EACH_INSTANCE(UARTE_PINS_CROSS_DOMAIN, (||), (0)) -#include -/* Certain UARTE instances support usage of cross domain pins in form of dedicated pins on - * a port different from the default one. - */ -#define UARTE_CROSS_DOMAIN_PINS_SUPPORTED 1 -#endif - -#if UARTE_CROSS_DOMAIN_PINS_SUPPORTED && defined(CONFIG_NRF_SYS_EVENT) -#include -/* To use cross domain pins, constant latency mode needs to be applied, which is - * handled via nrf_sys_event requests. - */ -#define UARTE_CROSS_DOMAIN_PINS_HANDLE 1 -#endif - #ifdef UARTE_ANY_CACHE /* uart120 instance does not retain BAUDRATE register when ENABLE=0. When this instance * is used then baudrate must be set after enabling the peripheral and not before. @@ -392,10 +371,6 @@ struct uarte_nrfx_config { #endif uint8_t *poll_out_byte; uint8_t *poll_in_byte; -#if UARTE_CROSS_DOMAIN_PINS_SUPPORTED - bool cross_domain; - int8_t default_port; -#endif }; /* Using Macro instead of static inline function to handle NO_OPTIMIZATIONS case @@ -469,32 +444,6 @@ static void uarte_disable_locked(const struct device *dev, uint32_t dis_mask) nrf_uarte_disable(get_uarte_instance(dev)); } -#if UARTE_CROSS_DOMAIN_PINS_SUPPORTED -static bool uarte_has_cross_domain_connection(const struct uarte_nrfx_config *config) -{ - const struct pinctrl_dev_config *pcfg = config->pcfg; - const struct pinctrl_state *state; - int ret; - - ret = pinctrl_lookup_state(pcfg, PINCTRL_STATE_DEFAULT, &state); - if (ret < 0) { - LOG_ERR("Unable to read pin state"); - return false; - } - - for (uint8_t i = 0U; i < state->pin_cnt; i++) { - uint32_t pin = NRF_GET_PIN(state->pins[i]); - - if ((pin != NRF_PIN_DISCONNECTED) && - (nrf_gpio_pin_port_number_extract(&pin) != config->default_port)) { - return true; - } - } - - return false; -} -#endif - #if defined(UARTE_ANY_NONE_ASYNC) && !defined(CONFIG_UART_NRFX_UARTE_NO_IRQ) /** * @brief Interrupt service routine. @@ -778,19 +727,6 @@ static void uarte_periph_enable(const struct device *dev) #ifdef CONFIG_SOC_NRF54H20_GPD nrf_gpd_retain_pins_set(config->pcfg, false); #endif -#if UARTE_CROSS_DOMAIN_PINS_SUPPORTED - if (config->cross_domain && uarte_has_cross_domain_connection(config)) { -#if UARTE_CROSS_DOMAIN_PINS_HANDLE - int err; - - err = nrf_sys_event_request_global_constlat(); - (void)err; - __ASSERT_NO_MSG(err >= 0); -#else - __ASSERT(false, "NRF_SYS_EVENT needs to be enabled to use cross domain pins.\n"); -#endif - } -#endif #if UARTE_BAUDRATE_RETENTION_WORKAROUND nrf_uarte_baudrate_set(uarte, COND_CODE_1(CONFIG_UART_USE_RUNTIME_CONFIGURE, @@ -2475,19 +2411,6 @@ static void uarte_pm_suspend(const struct device *dev) #ifdef CONFIG_SOC_NRF54H20_GPD nrf_gpd_retain_pins_set(cfg->pcfg, true); #endif -#if UARTE_CROSS_DOMAIN_PINS_SUPPORTED - if (cfg->cross_domain && uarte_has_cross_domain_connection(cfg)) { -#if UARTE_CROSS_DOMAIN_PINS_HANDLE - int err; - - err = nrf_sys_event_release_global_constlat(); - (void)err; - __ASSERT_NO_MSG(err >= 0); -#else - __ASSERT(false, "NRF_SYS_EVENT needs to be enabled to use cross domain pins.\n"); -#endif - } -#endif nrf_uarte_disable(uarte); @@ -2775,11 +2698,6 @@ static int uarte_instance_init(const struct device *dev, .accuracy = 0, \ .precision = NRF_CLOCK_CONTROL_PRECISION_DEFAULT,\ },)) \ - IF_ENABLED(UARTE_PINS_CROSS_DOMAIN(_, /*empty*/, idx, _), \ - (.cross_domain = true, \ - .default_port = \ - DT_PROP_OR(DT_PHANDLE(UARTE(idx), \ - default_gpio_port), port, -1),)) \ }; \ UARTE_DIRECT_ISR_DECLARE(idx) \ static int uarte_##idx##_init(const struct device *dev) \ diff --git a/dts/bindings/serial/nordic,nrf-uarte.yaml b/dts/bindings/serial/nordic,nrf-uarte.yaml index 4e9ccb0dd400..e6ba4c0b2147 100644 --- a/dts/bindings/serial/nordic,nrf-uarte.yaml +++ b/dts/bindings/serial/nordic,nrf-uarte.yaml @@ -14,13 +14,3 @@ properties: type: boolean description: | UARTE has RX frame timeout HW feature. - - default-gpio-port: - type: phandle - description: | - UARTE default GPIO port. - - cross-domain-pins-supported: - type: boolean - description: | - UARTE allows usage of cross domain pins with constant latency mode required. diff --git a/dts/vendor/nordic/nrf54l_05_10_15.dtsi b/dts/vendor/nordic/nrf54l_05_10_15.dtsi index 9a41f013b3ed..004454191f01 100644 --- a/dts/vendor/nordic/nrf54l_05_10_15.dtsi +++ b/dts/vendor/nordic/nrf54l_05_10_15.dtsi @@ -320,8 +320,6 @@ status = "disabled"; endtx-stoptx-supported; frame-timeout-supported; - default-gpio-port = <&gpio1>; - cross-domain-pins-supported; }; i2c21: i2c@c7000 { @@ -361,8 +359,6 @@ status = "disabled"; endtx-stoptx-supported; frame-timeout-supported; - default-gpio-port = <&gpio1>; - cross-domain-pins-supported; }; i2c22: i2c@c8000 { diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54l15dk_nrf54l15_cpuapp_cross_domain.overlay b/tests/drivers/uart/uart_elementary/boards/nrf54l15dk_nrf54l15_cpuapp_cross_domain.overlay deleted file mode 100644 index 493631951607..000000000000 --- a/tests/drivers/uart/uart_elementary/boards/nrf54l15dk_nrf54l15_cpuapp_cross_domain.overlay +++ /dev/null @@ -1,31 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - -&pinctrl { - uart21_default: uart21_default { - group1 { - psels = , - , - , - ; - }; - }; - - uart21_sleep: uart21_sleep { - group1 { - psels = , - , - , - ; - low-power-enable; - }; - }; -}; - -dut: &uart21 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart21_default>; - pinctrl-1 = <&uart21_sleep>; - pinctrl-names = "default", "sleep"; - hw-flow-control; -}; diff --git a/tests/drivers/uart/uart_elementary/testcase.yaml b/tests/drivers/uart/uart_elementary/testcase.yaml index 7afdc874269d..de3d18a50eea 100644 --- a/tests/drivers/uart/uart_elementary/testcase.yaml +++ b/tests/drivers/uart/uart_elementary/testcase.yaml @@ -97,12 +97,3 @@ tests: extra_configs: - CONFIG_DUAL_UART_TEST=y - CONFIG_SETUP_MISMATCH_TEST=y - drivers.uart.uart_elementary_cross_domain: - filter: CONFIG_SERIAL_SUPPORT_INTERRUPT - harness_config: - fixture: uart_p1_p2_loopback - platform_allow: - - nrf54l15dk/nrf54l15/cpuapp - extra_args: DTC_OVERLAY_FILE="boards/nrf54l15dk_nrf54l15_cpuapp_cross_domain.overlay" - extra_configs: - - CONFIG_NRF_SYS_EVENT=y From fc4525cc8ce8fc5219087fb78c12868283c900d7 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:51 +0300 Subject: [PATCH 1237/2141] Revert "[nrf fromlist] tests: nrf: comp: fix VDD reference dependency" This reverts commit adb6384b92f3f31900197975a37a936eac5e4483. Signed-off-by: Jukka Rissanen --- tests/boards/nrf/comp/src/test.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/boards/nrf/comp/src/test.c b/tests/boards/nrf/comp/src/test.c index 1d1876e76faa..2195f0e1ea94 100644 --- a/tests/boards/nrf/comp/src/test.c +++ b/tests/boards/nrf/comp/src/test.c @@ -93,11 +93,8 @@ ZTEST(comparator_runtime_configure, test_comp_config_se_vdd) #ifdef COMP_REFSEL_REFSEL_AVDDAO1V8 conf.refsel = COMP_NRF_COMP_REFSEL_AVDDAO1V8; -#elif defined(COMP_REFSEL_REFSEL_VDD) - conf.refsel = COMP_NRF_COMP_REFSEL_VDD; #else - /* Use internal 1.2 V derived from VDD */ - conf.refsel = COMP_NRF_COMP_REFSEL_INT_1V2; + conf.refsel = COMP_NRF_COMP_REFSEL_VDD; #endif rc = comp_nrf_comp_configure_se(test_dev, &conf); zassert_equal(rc, 0, "Cannot configure comparator."); From 8e824c3c86ae0bffbb570a3faca0f3aa591bb978 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:51 +0300 Subject: [PATCH 1238/2141] Revert "[nrf fromlist] drivers: adc: nrfx_saadc: remove VDD and DVDD inputs for nRF54LV10A" This reverts commit 19ec391a40c62bafb3ac6e3afc249d23f0f57773. Signed-off-by: Jukka Rissanen --- drivers/adc/adc_nrfx_saadc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/adc/adc_nrfx_saadc.c b/drivers/adc/adc_nrfx_saadc.c index 274a43157e04..bb0b4d5ab0ab 100644 --- a/drivers/adc/adc_nrfx_saadc.c +++ b/drivers/adc/adc_nrfx_saadc.c @@ -66,7 +66,7 @@ static const uint32_t saadc_psels[NRF_SAADC_DVDD + 1] = { [NRF_SAADC_DVDD] = NRF_SAADC_INPUT_DVDD, }; #elif defined(NRF54LV10A_ENGA_XXAA) -static const uint32_t saadc_psels[NRF_SAADC_AIN7 + 1] = { +static const uint32_t saadc_psels[NRF_SAADC_DVDD + 1] = { [NRF_SAADC_AIN0] = NRF_PIN_PORT_TO_PIN_NUMBER(0U, 1), [NRF_SAADC_AIN1] = NRF_PIN_PORT_TO_PIN_NUMBER(1U, 1), [NRF_SAADC_AIN2] = NRF_PIN_PORT_TO_PIN_NUMBER(2U, 1), @@ -75,6 +75,8 @@ static const uint32_t saadc_psels[NRF_SAADC_AIN7 + 1] = { [NRF_SAADC_AIN5] = NRF_PIN_PORT_TO_PIN_NUMBER(10U, 1), [NRF_SAADC_AIN6] = NRF_PIN_PORT_TO_PIN_NUMBER(11U, 1), [NRF_SAADC_AIN7] = NRF_PIN_PORT_TO_PIN_NUMBER(12U, 1), + [NRF_SAADC_VDD] = NRF_SAADC_INPUT_VDD, + [NRF_SAADC_DVDD] = NRF_SAADC_INPUT_DVDD, }; #endif From 73a4f5f6fb21abf13b0f09162563752a376aaa3f Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:51 +0300 Subject: [PATCH 1239/2141] Revert "[nrf fromlist] manifest: update hal_nordic revision to integrate nrfx 3.13.0" This reverts commit 2ca44cd5586e5362976046cbbe6531efe2947801. Signed-off-by: Jukka Rissanen --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index acf99c65b106..20d4800519a9 100644 --- a/west.yml +++ b/west.yml @@ -200,7 +200,7 @@ manifest: groups: - hal - name: hal_nordic - revision: 2f5d4e5868ab573eac932fa4bc142565073c3c04 + revision: 9587b1dcb83d24ab74e89837843a5f7d573f7059 path: modules/hal/nordic groups: - hal From cf10afe0f18e7b626c7376697867fa210700017f Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:51 +0300 Subject: [PATCH 1240/2141] Revert "[nrf fromtree] drivers: adc: nrfx_saadc: Fix SAADC shim for nRF54LV10A" This reverts commit 9f47f6c1b7315fa2d1f189c8867269605a222891. Signed-off-by: Jukka Rissanen --- drivers/adc/adc_nrfx_saadc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/adc/adc_nrfx_saadc.c b/drivers/adc/adc_nrfx_saadc.c index bb0b4d5ab0ab..f9f136f25093 100644 --- a/drivers/adc/adc_nrfx_saadc.c +++ b/drivers/adc/adc_nrfx_saadc.c @@ -283,7 +283,7 @@ static int gain_set(nrf_saadc_channel_config_t *ch_cfg, enum adc_gain gain) #endif default: #else - if (gain != ADC_GAIN_1) { + if (ch_cfg->gain != ADC_GAIN_1) { #endif /* defined(NRF_SAADC_HAS_CH_GAIN) */ LOG_ERR("Selected ADC gain is not valid"); return -EINVAL; From f48e500e9ea5ad8a371dc092b47477310dcf5ce9 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:51 +0300 Subject: [PATCH 1241/2141] Revert "[nrf fromtree] drivers: adc: rework Nordic SAADC driver" This reverts commit 812e93bc9f8fc0a0721b46fd94f4b69f78a379fd. Signed-off-by: Jukka Rissanen --- drivers/adc/Kconfig.nrfx | 1 - drivers/adc/adc_nrfx_saadc.c | 518 ++++++++++++++++++++--------------- 2 files changed, 297 insertions(+), 222 deletions(-) diff --git a/drivers/adc/Kconfig.nrfx b/drivers/adc/Kconfig.nrfx index 0a602f5b97bf..d411d5c99e10 100644 --- a/drivers/adc/Kconfig.nrfx +++ b/drivers/adc/Kconfig.nrfx @@ -27,6 +27,5 @@ config ADC_NRFX_SAADC default y depends on DT_HAS_NORDIC_NRF_SAADC_ENABLED select ADC_CONFIGURABLE_INPUTS - select NRFX_SAADC help Enable support for nrfx SAADC driver. diff --git a/drivers/adc/adc_nrfx_saadc.c b/drivers/adc/adc_nrfx_saadc.c index f9f136f25093..54719a1136df 100644 --- a/drivers/adc/adc_nrfx_saadc.c +++ b/drivers/adc/adc_nrfx_saadc.c @@ -6,15 +6,18 @@ #define ADC_CONTEXT_USES_KERNEL_TIMER #include "adc_context.h" -#include +#include #include #include #include #include +#include +#include + +#define LOG_LEVEL CONFIG_ADC_LOG_LEVEL #include #include - -LOG_MODULE_REGISTER(adc_nrfx_saadc, CONFIG_ADC_LOG_LEVEL); +LOG_MODULE_REGISTER(adc_nrfx_saadc); #define DT_DRV_COMPAT nordic_nrf_saadc @@ -100,9 +103,16 @@ BUILD_ASSERT((NRF_SAADC_AIN0 == NRF_SAADC_INPUT_AIN0) && #endif #if defined(CONFIG_NRF_PLATFORM_HALTIUM) -#include + /* Haltium devices always use bounce buffers in RAM */ -static uint16_t adc_samples_buffer[SAADC_CH_NUM] DMM_MEMORY_SECTION(DT_NODELABEL(adc)); + +#define SAADC_MEMORY_SECTION \ + COND_CODE_1(DT_NODE_HAS_PROP(DT_NODELABEL(adc), memory_regions), \ + (__attribute__((__section__(LINKER_DT_NODE_REGION_NAME( \ + DT_PHANDLE(DT_NODELABEL(adc), memory_regions)))))), \ + ()) + +static uint16_t adc_samples_buffer[SAADC_CH_NUM] SAADC_MEMORY_SECTION; #define ADC_BUFFER_IN_RAM @@ -110,13 +120,14 @@ static uint16_t adc_samples_buffer[SAADC_CH_NUM] DMM_MEMORY_SECTION(DT_NODELABEL struct driver_data { struct adc_context ctx; + + uint8_t positive_inputs[SAADC_CH_NUM]; uint8_t single_ended_channels; - nrf_saadc_value_t *buffer; /* Pointer to the buffer with converted samples. */ - uint8_t active_channel_cnt; #if defined(ADC_BUFFER_IN_RAM) void *samples_buffer; void *user_buffer; + uint8_t active_channels; #endif }; @@ -129,37 +140,41 @@ static struct driver_data m_data = { #endif }; -/* Forward declaration */ -static void event_handler(const nrfx_saadc_evt_t *event); +/* Helper function to convert number of samples to the byte representation. */ +static uint32_t samples_to_bytes(uint16_t number_of_samples) +{ + return number_of_samples * 2; +} /* Helper function to convert acquisition time to register TACQ value. */ -static int acq_time_set(nrf_saadc_channel_config_t *ch_cfg, uint16_t acquisition_time) +static int adc_convert_acq_time(uint16_t acquisition_time, nrf_saadc_acqtime_t *p_tacq_val) { + int result = 0; + #if NRF_SAADC_HAS_ACQTIME_ENUM switch (acquisition_time) { case ADC_ACQ_TIME(ADC_ACQ_TIME_MICROSECONDS, 3): - ch_cfg->acq_time = NRF_SAADC_ACQTIME_3US; + *p_tacq_val = NRF_SAADC_ACQTIME_3US; break; case ADC_ACQ_TIME(ADC_ACQ_TIME_MICROSECONDS, 5): - ch_cfg->acq_time = NRF_SAADC_ACQTIME_5US; + *p_tacq_val = NRF_SAADC_ACQTIME_5US; break; case ADC_ACQ_TIME_DEFAULT: case ADC_ACQ_TIME(ADC_ACQ_TIME_MICROSECONDS, 10): - ch_cfg->acq_time = NRF_SAADC_ACQTIME_10US; + *p_tacq_val = NRF_SAADC_ACQTIME_10US; break; case ADC_ACQ_TIME(ADC_ACQ_TIME_MICROSECONDS, 15): - ch_cfg->acq_time = NRF_SAADC_ACQTIME_15US; + *p_tacq_val = NRF_SAADC_ACQTIME_15US; break; case ADC_ACQ_TIME(ADC_ACQ_TIME_MICROSECONDS, 20): - ch_cfg->acq_time = NRF_SAADC_ACQTIME_20US; + *p_tacq_val = NRF_SAADC_ACQTIME_20US; break; case ADC_ACQ_TIME_MAX: case ADC_ACQ_TIME(ADC_ACQ_TIME_MICROSECONDS, 40): - ch_cfg->acq_time = NRF_SAADC_ACQTIME_40US; + *p_tacq_val = NRF_SAADC_ACQTIME_40US; break; default: - LOG_ERR("Selected ADC acquisition time is not valid"); - return -EINVAL; + result = -EINVAL; } #else #define MINIMUM_ACQ_TIME_IN_NS 125 @@ -176,138 +191,130 @@ static int acq_time_set(nrf_saadc_channel_config_t *ch_cfg, uint16_t acquisition tacq = (nrf_saadc_acqtime_t)(acq_time / MINIMUM_ACQ_TIME_IN_NS) - 1; if ((tacq > NRF_SAADC_ACQTIME_MAX) || (acq_time < MINIMUM_ACQ_TIME_IN_NS)) { - LOG_ERR("Selected ADC acquisition time is not valid"); - return -EINVAL; + result = -EINVAL; } else { - ch_cfg->acq_time = tacq; + *p_tacq_val = tacq; } #endif - LOG_DBG("ADC acquisition_time: %d", acquisition_time); - - return 0; + return result; } -static int input_assign(nrf_saadc_input_t *pin_p, - nrf_saadc_input_t *pin_n, - const struct adc_channel_cfg *channel_cfg) +static int saadc_pm_hook(const struct device *dev, enum pm_device_action action) { -#if (NRF_SAADC_HAS_AIN_AS_PIN) - if (channel_cfg->input_positive > ARRAY_SIZE(saadc_psels) || - channel_cfg->input_positive < NRF_SAADC_AIN0) { - LOG_ERR("Invalid analog positive input number: %d", channel_cfg->input_positive); - return -EINVAL; - } + ARG_UNUSED(dev); - *pin_p = saadc_psels[channel_cfg->input_positive]; + switch (action) { + case PM_DEVICE_ACTION_SUSPEND: + nrf_saadc_disable(NRF_SAADC); + return 0; - if (channel_cfg->differential) { - if (channel_cfg->input_negative > ARRAY_SIZE(saadc_psels) || - channel_cfg->input_negative < NRF_SAADC_AIN0 || - (IS_ENABLED(CONFIG_NRF_PLATFORM_HALTIUM) && - (channel_cfg->input_positive > NRF_SAADC_AIN7) != - (channel_cfg->input_negative > NRF_SAADC_AIN7))) { - LOG_ERR("Invalid analog negative input number: %d", - channel_cfg->input_negative); - return -EINVAL; - } - *pin_n = saadc_psels[channel_cfg->input_negative]; - } else { - *pin_n = NRF_SAADC_INPUT_DISABLED; + case PM_DEVICE_ACTION_RESUME: + nrf_saadc_enable(NRF_SAADC); + return 0; + + default: + break; } -#else - *pin_p = channel_cfg->input_positive; - *pin_n = channel_cfg->differential ? channel_cfg->input_negative - : NRF_SAADC_INPUT_DISABLED; -#endif - LOG_DBG("ADC positive input: %d", *pin_p); - LOG_DBG("ADC negative input: %d", *pin_n); - return 0; + return -ENOTSUP; } -static int gain_set(nrf_saadc_channel_config_t *ch_cfg, enum adc_gain gain) +/* Implementation of the ADC driver API function: adc_channel_setup. */ +static int adc_nrfx_channel_setup(const struct device *dev, + const struct adc_channel_cfg *channel_cfg) { + nrf_saadc_channel_config_t config = { +#if NRF_SAADC_HAS_CH_CONFIG_RES + .resistor_p = NRF_SAADC_RESISTOR_DISABLED, + .resistor_n = NRF_SAADC_RESISTOR_DISABLED, +#endif +#if NRF_SAADC_HAS_CH_BURST + .burst = NRF_SAADC_BURST_DISABLED, +#endif + }; + uint8_t channel_id = channel_cfg->channel_id; + uint32_t input_negative = channel_cfg->input_negative; + + if (channel_id >= SAADC_CH_NUM) { + return -EINVAL; + } + #if NRF_SAADC_HAS_CH_GAIN - switch (gain) { + switch (channel_cfg->gain) { #if defined(SAADC_CH_CONFIG_GAIN_Gain1_6) case ADC_GAIN_1_6: - ch_cfg->gain = NRF_SAADC_GAIN1_6; + config.gain = NRF_SAADC_GAIN1_6; break; #endif #if defined(SAADC_CH_CONFIG_GAIN_Gain1_5) case ADC_GAIN_1_5: - ch_cfg->gain = NRF_SAADC_GAIN1_5; + config.gain = NRF_SAADC_GAIN1_5; break; #endif #if defined(SAADC_CH_CONFIG_GAIN_Gain1_4) || defined(SAADC_CH_CONFIG_GAIN_Gain2_8) case ADC_GAIN_1_4: - ch_cfg->gain = NRF_SAADC_GAIN1_4; + config.gain = NRF_SAADC_GAIN1_4; break; #endif #if defined(SAADC_CH_CONFIG_GAIN_Gain2_7) case ADC_GAIN_2_7: - ch_cfg->gain = NRF_SAADC_GAIN2_7; + config.gain = NRF_SAADC_GAIN2_7; break; #endif #if defined(SAADC_CH_CONFIG_GAIN_Gain1_3) || defined(SAADC_CH_CONFIG_GAIN_Gain2_6) case ADC_GAIN_1_3: - ch_cfg->gain = NRF_SAADC_GAIN1_3; + config.gain = NRF_SAADC_GAIN1_3; break; #endif #if defined(SAADC_CH_CONFIG_GAIN_Gain2_5) case ADC_GAIN_2_5: - ch_cfg->gain = NRF_SAADC_GAIN2_5; + config.gain = NRF_SAADC_GAIN2_5; break; #endif #if defined(SAADC_CH_CONFIG_GAIN_Gain1_2) || defined(SAADC_CH_CONFIG_GAIN_Gain2_4) case ADC_GAIN_1_2: - ch_cfg->gain = NRF_SAADC_GAIN1_2; + config.gain = NRF_SAADC_GAIN1_2; break; #endif #if defined(SAADC_CH_CONFIG_GAIN_Gain2_3) case ADC_GAIN_2_3: - ch_cfg->gain = NRF_SAADC_GAIN2_3; + config.gain = NRF_SAADC_GAIN2_3; break; #endif case ADC_GAIN_1: - ch_cfg->gain = NRF_SAADC_GAIN1; + config.gain = NRF_SAADC_GAIN1; break; case ADC_GAIN_2: - ch_cfg->gain = NRF_SAADC_GAIN2; + config.gain = NRF_SAADC_GAIN2; break; #if defined(SAADC_CH_CONFIG_GAIN_Gain4) case ADC_GAIN_4: - ch_cfg->gain = NRF_SAADC_GAIN4; + config.gain = NRF_SAADC_GAIN4; break; #endif default: #else - if (ch_cfg->gain != ADC_GAIN_1) { + if (channel_cfg->gain != ADC_GAIN_1) { #endif /* defined(NRF_SAADC_HAS_CH_GAIN) */ LOG_ERR("Selected ADC gain is not valid"); return -EINVAL; } - return 0; -} - -static int reference_set(nrf_saadc_channel_config_t *ch_cfg, enum adc_reference reference) -{ - switch (reference) { + switch (channel_cfg->reference) { #if defined(SAADC_CH_CONFIG_REFSEL_Internal) case ADC_REF_INTERNAL: - ch_cfg->reference = NRF_SAADC_REFERENCE_INTERNAL; + config.reference = NRF_SAADC_REFERENCE_INTERNAL; break; #endif #if defined(SAADC_CH_CONFIG_REFSEL_VDD1_4) case ADC_REF_VDD_1_4: - ch_cfg->reference = NRF_SAADC_REFERENCE_VDD4; + config.reference = NRF_SAADC_REFERENCE_VDD4; break; #endif #if defined(SAADC_CH_CONFIG_REFSEL_External) case ADC_REF_EXTERNAL0: - ch_cfg->reference = NRF_SAADC_REFERENCE_EXTERNAL; + config.reference = NRF_SAADC_REFERENCE_EXTERNAL; break; #endif default: @@ -315,130 +322,133 @@ static int reference_set(nrf_saadc_channel_config_t *ch_cfg, enum adc_reference return -EINVAL; } - return 0; -} - -/* Implementation of the ADC driver API function: adc_channel_setup. */ -static int adc_nrfx_channel_setup(const struct device *dev, - const struct adc_channel_cfg *channel_cfg) -{ - int err; - nrf_saadc_channel_config_t *ch_cfg; - nrfx_saadc_channel_t cfg = { - .channel_config = { -#if NRF_SAADC_HAS_CH_CONFIG_RES - .resistor_p = NRF_SAADC_RESISTOR_DISABLED, - .resistor_n = NRF_SAADC_RESISTOR_DISABLED, -#endif -#if NRF_SAADC_HAS_CH_BURST - .burst = NRF_SAADC_BURST_DISABLED, -#endif - }, - .channel_index = channel_cfg->channel_id, - }; + int ret = adc_convert_acq_time(channel_cfg->acquisition_time, &config.acq_time); - if (channel_cfg->channel_id >= SAADC_CH_NUM) { - LOG_ERR("Invalid channel ID: %d", channel_cfg->channel_id); + if (ret) { + LOG_ERR("Selected ADC acquisition time is not valid"); return -EINVAL; } - ch_cfg = &cfg.channel_config; - - err = input_assign(&cfg.pin_p, &cfg.pin_n, channel_cfg); - if (err != 0) { - return err; - } - - err = gain_set(ch_cfg, channel_cfg->gain); - if (err != 0) { - return err; - } - - err = reference_set(ch_cfg, channel_cfg->reference); - if (err != 0) { - return err; - } - - err = acq_time_set(ch_cfg, channel_cfg->acquisition_time); - if (err != 0) { - return err; - } - /* Store channel mode to allow correcting negative readings in single-ended mode * after ADC sequence ends. */ if (channel_cfg->differential) { - ch_cfg->mode = NRF_SAADC_MODE_DIFFERENTIAL; + config.mode = NRF_SAADC_MODE_DIFFERENTIAL; m_data.single_ended_channels &= ~BIT(channel_cfg->channel_id); } else { - ch_cfg->mode = NRF_SAADC_MODE_SINGLE_ENDED; + config.mode = NRF_SAADC_MODE_SINGLE_ENDED; m_data.single_ended_channels |= BIT(channel_cfg->channel_id); } - nrfx_err_t ret = nrfx_saadc_channel_config(&cfg); - - if (ret != NRFX_SUCCESS) { - LOG_ERR("Cannot configure channel %d: %d", channel_cfg->channel_id, ret); +#if (NRF_SAADC_HAS_AIN_AS_PIN) + if ((channel_cfg->input_positive >= ARRAY_SIZE(saadc_psels)) || + (channel_cfg->input_positive < NRF_SAADC_AIN0)) { return -EINVAL; } + if (config.mode == NRF_SAADC_MODE_DIFFERENTIAL) { +#if defined(CONFIG_NRF_PLATFORM_HALTIUM) + if ((input_negative > NRF_SAADC_AIN7) != + (channel_cfg->input_positive > NRF_SAADC_AIN7)) { +#else + if (input_negative > NRF_SAADC_AIN7 || + input_negative < NRF_SAADC_AIN0) { +#endif + return -EINVAL; + } + + input_negative = saadc_psels[input_negative]; + } else { + input_negative = NRF_SAADC_INPUT_DISABLED; + } +#endif + /* Store the positive input selection in a dedicated array, + * to get it later when the channel is selected for a sampling + * and to mark the channel as configured (ready to be selected). + */ + m_data.positive_inputs[channel_id] = channel_cfg->input_positive; + + nrf_saadc_channel_init(NRF_SAADC, channel_id, &config); + /* Keep the channel disabled in hardware (set positive input to + * NRF_SAADC_INPUT_DISABLED) until it is selected to be included + * in a sampling sequence. + */ + nrf_saadc_channel_input_set(NRF_SAADC, + channel_id, + NRF_SAADC_INPUT_DISABLED, + input_negative); + return 0; } static void adc_context_start_sampling(struct adc_context *ctx) { +#if defined(CONFIG_PM_DEVICE_RUNTIME) + pm_device_runtime_get(DEVICE_DT_INST_GET(0)); +#else + nrf_saadc_enable(NRF_SAADC); +#endif + if (ctx->sequence.calibrate) { - nrfx_saadc_offset_calibrate(event_handler); + nrf_saadc_task_trigger(NRF_SAADC, + NRF_SAADC_TASK_CALIBRATEOFFSET); } else { - nrfx_err_t ret = nrfx_saadc_mode_trigger(); - - if (ret != NRFX_SUCCESS) { - LOG_ERR("Cannot start sampling: 0x%08x", ret); - adc_context_complete(&m_data.ctx, -EIO); - } + nrf_saadc_task_trigger(NRF_SAADC, NRF_SAADC_TASK_START); + nrf_saadc_task_trigger(NRF_SAADC, NRF_SAADC_TASK_SAMPLE); } } -static void adc_context_update_buffer_pointer(struct adc_context *ctx, bool repeat) +static void adc_context_update_buffer_pointer(struct adc_context *ctx, + bool repeat) { + ARG_UNUSED(ctx); + if (!repeat) { #if defined(ADC_BUFFER_IN_RAM) - m_data.user_buffer = (uint16_t *)m_data.user_buffer + m_data.active_channel_cnt; + m_data.user_buffer = (uint8_t *)m_data.user_buffer + + samples_to_bytes(nrfy_saadc_amount_get(NRF_SAADC)); #else - nrf_saadc_value_t *buffer = (uint16_t *)m_data.buffer + m_data.active_channel_cnt; - - nrfx_saadc_buffer_set(buffer, m_data.active_channel_cnt); + nrf_saadc_value_t *buffer = + (uint8_t *)nrf_saadc_buffer_pointer_get(NRF_SAADC) + + samples_to_bytes(nrfy_saadc_amount_get(NRF_SAADC)); + nrfy_saadc_buffer_pointer_set(NRF_SAADC, buffer); #endif } } -static int get_resolution(const struct adc_sequence *sequence, nrf_saadc_resolution_t *resolution) +static int set_resolution(const struct adc_sequence *sequence) { + nrf_saadc_resolution_t nrf_resolution; + switch (sequence->resolution) { - case 8: - *resolution = NRF_SAADC_RESOLUTION_8BIT; + case 8: + nrf_resolution = NRF_SAADC_RESOLUTION_8BIT; break; case 10: - *resolution = NRF_SAADC_RESOLUTION_10BIT; + nrf_resolution = NRF_SAADC_RESOLUTION_10BIT; break; case 12: - *resolution = NRF_SAADC_RESOLUTION_12BIT; + nrf_resolution = NRF_SAADC_RESOLUTION_12BIT; break; case 14: - *resolution = NRF_SAADC_RESOLUTION_14BIT; + nrf_resolution = NRF_SAADC_RESOLUTION_14BIT; break; default: - LOG_ERR("ADC resolution value %d is not valid", sequence->resolution); + LOG_ERR("ADC resolution value %d is not valid", + sequence->resolution); return -EINVAL; } + nrf_saadc_resolution_set(NRF_SAADC, nrf_resolution); return 0; } -static int get_oversampling(const struct adc_sequence *sequence, uint8_t active_channel_cnt, - nrf_saadc_oversample_t *oversampling) +static int set_oversampling(const struct adc_sequence *sequence, + uint8_t active_channels) { - if ((active_channel_cnt > 1) && (sequence->oversampling > 0)) { + nrf_saadc_oversample_t nrf_oversampling; + + if ((active_channels > 1) && (sequence->oversampling > 0)) { LOG_ERR( "Oversampling is supported for single channel only"); return -EINVAL; @@ -446,45 +456,48 @@ static int get_oversampling(const struct adc_sequence *sequence, uint8_t active_ switch (sequence->oversampling) { case 0: - *oversampling = NRF_SAADC_OVERSAMPLE_DISABLED; + nrf_oversampling = NRF_SAADC_OVERSAMPLE_DISABLED; break; case 1: - *oversampling = NRF_SAADC_OVERSAMPLE_2X; + nrf_oversampling = NRF_SAADC_OVERSAMPLE_2X; break; case 2: - *oversampling = NRF_SAADC_OVERSAMPLE_4X; + nrf_oversampling = NRF_SAADC_OVERSAMPLE_4X; break; case 3: - *oversampling = NRF_SAADC_OVERSAMPLE_8X; + nrf_oversampling = NRF_SAADC_OVERSAMPLE_8X; break; case 4: - *oversampling = NRF_SAADC_OVERSAMPLE_16X; + nrf_oversampling = NRF_SAADC_OVERSAMPLE_16X; break; case 5: - *oversampling = NRF_SAADC_OVERSAMPLE_32X; + nrf_oversampling = NRF_SAADC_OVERSAMPLE_32X; break; case 6: - *oversampling = NRF_SAADC_OVERSAMPLE_64X; + nrf_oversampling = NRF_SAADC_OVERSAMPLE_64X; break; case 7: - *oversampling = NRF_SAADC_OVERSAMPLE_128X; + nrf_oversampling = NRF_SAADC_OVERSAMPLE_128X; break; case 8: - *oversampling = NRF_SAADC_OVERSAMPLE_256X; + nrf_oversampling = NRF_SAADC_OVERSAMPLE_256X; break; default: - LOG_ERR("Oversampling value %d is not valid", sequence->oversampling); + LOG_ERR("Oversampling value %d is not valid", + sequence->oversampling); return -EINVAL; } + nrf_saadc_oversample_set(NRF_SAADC, nrf_oversampling); return 0; } -static int check_buffer_size(const struct adc_sequence *sequence, uint8_t active_channel_cnt) +static int check_buffer_size(const struct adc_sequence *sequence, + uint8_t active_channels) { size_t needed_buffer_size; - needed_buffer_size = NRFX_SAADC_SAMPLES_TO_BYTES(active_channel_cnt); + needed_buffer_size = samples_to_bytes(active_channels); if (sequence->options) { needed_buffer_size *= (1 + sequence->options->extra_samplings); @@ -492,7 +505,7 @@ static int check_buffer_size(const struct adc_sequence *sequence, uint8_t active if (sequence->buffer_size < needed_buffer_size) { LOG_ERR("Provided buffer is too small (%u/%u)", - sequence->buffer_size, needed_buffer_size); + sequence->buffer_size, needed_buffer_size); return -ENOMEM; } @@ -509,7 +522,7 @@ static void correct_single_ended(const struct adc_sequence *sequence) uint16_t channel_bit = BIT(0); uint8_t selected_channels = sequence->channels; uint8_t single_ended_channels = m_data.single_ended_channels; - int16_t *sample = (int16_t *)m_data.buffer; + int16_t *sample = nrf_saadc_buffer_pointer_get(NRF_SAADC); while (channel_bit <= single_ended_channels) { if (channel_bit & selected_channels) { @@ -527,13 +540,11 @@ static void correct_single_ended(const struct adc_sequence *sequence) static int start_read(const struct device *dev, const struct adc_sequence *sequence) { - nrfx_err_t nrfx_err; int error; uint32_t selected_channels = sequence->channels; - nrf_saadc_resolution_t resolution; - nrf_saadc_oversample_t oversampling; - uint8_t active_channel_cnt = 0U; - uint8_t channel_id = 0U; + uint8_t active_channels; + uint8_t channel_id; + nrf_saadc_burst_t burst; /* Signal an error if channel selection is invalid (no channels or * a non-existing one is selected). @@ -544,55 +555,88 @@ static int start_read(const struct device *dev, return -EINVAL; } + active_channels = 0U; + + /* Enable only the channels selected for the pointed sequence. + * Disable all the rest. + */ + channel_id = 0U; do { if (selected_channels & BIT(channel_id)) { - /* Signal an error if a selected channel has not been configured yet. */ - if (0 == (nrfx_saadc_channels_configured_get() & BIT(channel_id))) { - LOG_ERR("Channel %u not configured", channel_id); + /* Signal an error if a selected channel has not been + * configured yet. + */ + if (m_data.positive_inputs[channel_id] == 0U) { + LOG_ERR("Channel %u not configured", + channel_id); return -EINVAL; } - ++active_channel_cnt; + /* When oversampling is used, the burst mode needs to + * be activated. Unfortunately, this mode cannot be + * activated permanently in the channel setup, because + * then the multiple channel sampling fails (the END + * event is not generated) after switching to a single + * channel sampling and back. Thus, when oversampling + * is not used (hence, the multiple channel sampling is + * possible), the burst mode have to be deactivated. + */ + burst = (sequence->oversampling != 0U ? + NRF_SAADC_BURST_ENABLED : NRF_SAADC_BURST_DISABLED); +#if NRF_SAADC_HAS_CH_BURST + nrf_saadc_channel_burst_set(NRF_SAADC, channel_id, burst); +#else + nrf_saadc_burst_set(NRF_SAADC, burst); +#endif + nrf_saadc_channel_pos_input_set( + NRF_SAADC, + channel_id, +#if NRF_SAADC_HAS_AIN_AS_PIN + saadc_psels[m_data.positive_inputs[channel_id]] +#else + m_data.positive_inputs[channel_id] +#endif + ); + ++active_channels; + } else { + burst = NRF_SAADC_BURST_DISABLED; +#if NRF_SAADC_HAS_CH_BURST + nrf_saadc_channel_burst_set(NRF_SAADC, channel_id, burst); +#else + nrf_saadc_burst_set(NRF_SAADC, burst); +#endif + nrf_saadc_channel_pos_input_set( + NRF_SAADC, + channel_id, + NRF_SAADC_INPUT_DISABLED); } } while (++channel_id < SAADC_CH_NUM); - if (active_channel_cnt == 0) { - LOG_ERR("No channel configured"); - return -EINVAL; - } - - error = get_resolution(sequence, &resolution); + error = set_resolution(sequence); if (error) { return error; } - error = get_oversampling(sequence, active_channel_cnt, &oversampling); + error = set_oversampling(sequence, active_channels); if (error) { return error; } - nrfx_err = nrfx_saadc_simple_mode_set(selected_channels, - resolution, - oversampling, - event_handler); - if (nrfx_err != NRFX_SUCCESS) { - return -EINVAL; - } - - error = check_buffer_size(sequence, active_channel_cnt); + error = check_buffer_size(sequence, active_channels); if (error) { return error; } - m_data.active_channel_cnt = active_channel_cnt; #if defined(ADC_BUFFER_IN_RAM) m_data.user_buffer = sequence->buffer; + m_data.active_channels = active_channels; - nrfx_saadc_buffer_set(m_data.samples_buffer, active_channel_cnt); + nrf_saadc_buffer_init(NRF_SAADC, + (nrf_saadc_value_t *)m_data.samples_buffer, + active_channels); #else - /* Buffer is filled in chunks, each chunk composed of number of samples equal to number - * of active channels. Buffer pointer is advanced and reloaded after each chunk. - */ - nrfx_saadc_buffer_set(sequence->buffer, active_channel_cnt); + nrf_saadc_buffer_init(NRF_SAADC, + (nrf_saadc_value_t *)sequence->buffer, + active_channels); #endif adc_context_start_read(&m_data.ctx, sequence); @@ -629,12 +673,18 @@ static int adc_nrfx_read_async(const struct device *dev, } #endif /* CONFIG_ADC_ASYNC */ -static void event_handler(const nrfx_saadc_evt_t *event) +static void saadc_irq_handler(const struct device *dev) { - nrfx_err_t err; + if (nrf_saadc_event_check(NRF_SAADC, NRF_SAADC_EVENT_END)) { + nrf_saadc_event_clear(NRF_SAADC, NRF_SAADC_EVENT_END); - if (event->type == NRFX_SAADC_EVT_DONE) { - m_data.buffer = event->data.done.p_buffer; + nrf_saadc_task_trigger(NRF_SAADC, NRF_SAADC_TASK_STOP); + +#if defined(CONFIG_PM_DEVICE_RUNTIME) + pm_device_runtime_put(DEVICE_DT_INST_GET(0)); +#else + nrf_saadc_disable(NRF_SAADC); +#endif if (has_single_ended(&m_data.ctx.sequence)) { correct_single_ended(&m_data.ctx.sequence); @@ -642,35 +692,39 @@ static void event_handler(const nrfx_saadc_evt_t *event) #if defined(ADC_BUFFER_IN_RAM) memcpy(m_data.user_buffer, m_data.samples_buffer, - NRFX_SAADC_SAMPLES_TO_BYTES(m_data.active_channel_cnt)); + samples_to_bytes(m_data.active_channels)); #endif - adc_context_on_sampling_done(&m_data.ctx, DEVICE_DT_INST_GET(0)); - } else if (event->type == NRFX_SAADC_EVT_CALIBRATEDONE) { - err = nrfx_saadc_mode_trigger(); - if (err != NRFX_SUCCESS) { - LOG_ERR("Cannot start sampling: 0x%08x", err); - adc_context_complete(&m_data.ctx, -EIO); - } + adc_context_on_sampling_done(&m_data.ctx, dev); + } else if (nrf_saadc_event_check(NRF_SAADC, + NRF_SAADC_EVENT_CALIBRATEDONE)) { + nrf_saadc_event_clear(NRF_SAADC, NRF_SAADC_EVENT_CALIBRATEDONE); + + /* + * The workaround for Nordic nRF52832 anomalies 86 and + * 178 is an explicit STOP after CALIBRATEOFFSET + * before issuing START. + */ + nrf_saadc_task_trigger(NRF_SAADC, NRF_SAADC_TASK_STOP); + nrf_saadc_task_trigger(NRF_SAADC, NRF_SAADC_TASK_START); + nrf_saadc_task_trigger(NRF_SAADC, NRF_SAADC_TASK_SAMPLE); } } static int init_saadc(const struct device *dev) { - nrfx_err_t err; - - /* The priority value passed here is ignored (see nrfx_glue.h). */ - err = nrfx_saadc_init(0); - if (err != NRFX_SUCCESS) { - LOG_ERR("Failed to initialize device: %s", dev->name); - return -EIO; - } + nrf_saadc_event_clear(NRF_SAADC, NRF_SAADC_EVENT_END); + nrf_saadc_event_clear(NRF_SAADC, NRF_SAADC_EVENT_CALIBRATEDONE); + nrf_saadc_int_enable(NRF_SAADC, + NRF_SAADC_INT_END | NRF_SAADC_INT_CALIBRATEDONE); + NRFX_IRQ_ENABLE(DT_INST_IRQN(0)); - IRQ_CONNECT(DT_INST_IRQN(0), DT_INST_IRQ(0, priority), nrfx_isr, nrfx_saadc_irq_handler, 0); + IRQ_CONNECT(DT_INST_IRQN(0), DT_INST_IRQ(0, priority), + saadc_irq_handler, DEVICE_DT_INST_GET(0), 0); adc_context_unlock_unconditionally(&m_data.ctx); - return 0; + return pm_device_driver_init(dev, saadc_pm_hook); } static DEVICE_API(adc, adc_nrfx_driver_api) = { @@ -709,7 +763,29 @@ static DEVICE_API(adc, adc_nrfx_driver_api) = { "1v8 inputs cannot be mixed with 3v3 inputs"); /* Validate configuration of all channels. */ -DT_FOREACH_CHILD(DT_DRV_INST(0), VALIDATE_CHANNEL_CONFIG) +#define VALIDATE_CHANNELS_CONFIG(inst) DT_FOREACH_CHILD(DT_DRV_INST(inst), VALIDATE_CHANNEL_CONFIG) -DEVICE_DT_INST_DEFINE(0, init_saadc, NULL, NULL, NULL, POST_KERNEL, - CONFIG_ADC_INIT_PRIORITY, &adc_nrfx_driver_api); +/* + * There is only one instance on supported SoCs, so inst is guaranteed + * to be 0 if any instance is okay. (We use adc_0 above, so the driver + * is relying on the numeric instance value in a way that happens to + * be safe.) + * + * Just in case that assumption becomes invalid in the future, we use + * a BUILD_ASSERT(). + */ +#define SAADC_INIT(inst) \ + BUILD_ASSERT((inst) == 0, \ + "multiple instances not supported"); \ + VALIDATE_CHANNELS_CONFIG(inst) \ + PM_DEVICE_DT_INST_DEFINE(0, saadc_pm_hook, 1); \ + DEVICE_DT_INST_DEFINE(0, \ + init_saadc, \ + PM_DEVICE_DT_INST_GET(0), \ + NULL, \ + NULL, \ + POST_KERNEL, \ + CONFIG_ADC_INIT_PRIORITY, \ + &adc_nrfx_driver_api); + +DT_INST_FOREACH_STATUS_OKAY(SAADC_INIT) From 9c9e0207eadbe4904673cecf2554da2175472936 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:51 +0300 Subject: [PATCH 1242/2141] Revert "[nrf fromtree] modules: hal_nordic: nrfx: Update NRFX API version to 3.12" This reverts commit 52154394a286dddc16b522599f2f5f144b38bec6. Signed-off-by: Jukka Rissanen --- modules/hal_nordic/nrfx/nrfx_config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index fac2341c1c55..4a2d5af18b64 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -9,7 +9,7 @@ /* Define nrfx API version used in Zephyr. */ #define NRFX_CONFIG_API_VER_MAJOR 3 -#define NRFX_CONFIG_API_VER_MINOR 12 +#define NRFX_CONFIG_API_VER_MINOR 8 #define NRFX_CONFIG_API_VER_MICRO 0 /* Macros used in zephyr-specific config files. */ From 1f80871acad5c0498b42aae949a628f802aaa889 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:51 +0300 Subject: [PATCH 1243/2141] Revert "[nrf fromtree] drivers: adc_nrfx_saadc: Remove dead and misleading code" This reverts commit 79a29d4e2fc05a59ff10f8287a7f79f36c452b54. Signed-off-by: Jukka Rissanen --- drivers/adc/adc_nrfx_saadc.c | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/drivers/adc/adc_nrfx_saadc.c b/drivers/adc/adc_nrfx_saadc.c index 54719a1136df..986cca49af8f 100644 --- a/drivers/adc/adc_nrfx_saadc.c +++ b/drivers/adc/adc_nrfx_saadc.c @@ -141,8 +141,12 @@ static struct driver_data m_data = { }; /* Helper function to convert number of samples to the byte representation. */ -static uint32_t samples_to_bytes(uint16_t number_of_samples) +static uint32_t samples_to_bytes(const struct adc_sequence *sequence, uint16_t number_of_samples) { + if (NRF_SAADC_8BIT_SAMPLE_WIDTH == 8 && sequence->resolution == 8) { + return number_of_samples; + } + return number_of_samples * 2; } @@ -406,11 +410,11 @@ static void adc_context_update_buffer_pointer(struct adc_context *ctx, if (!repeat) { #if defined(ADC_BUFFER_IN_RAM) m_data.user_buffer = (uint8_t *)m_data.user_buffer + - samples_to_bytes(nrfy_saadc_amount_get(NRF_SAADC)); + samples_to_bytes(&ctx->sequence, nrfy_saadc_amount_get(NRF_SAADC)); #else nrf_saadc_value_t *buffer = (uint8_t *)nrf_saadc_buffer_pointer_get(NRF_SAADC) + - samples_to_bytes(nrfy_saadc_amount_get(NRF_SAADC)); + samples_to_bytes(&ctx->sequence, nrfy_saadc_amount_get(NRF_SAADC)); nrfy_saadc_buffer_pointer_set(NRF_SAADC, buffer); #endif } @@ -497,7 +501,7 @@ static int check_buffer_size(const struct adc_sequence *sequence, { size_t needed_buffer_size; - needed_buffer_size = samples_to_bytes(active_channels); + needed_buffer_size = samples_to_bytes(sequence, active_channels); if (sequence->options) { needed_buffer_size *= (1 + sequence->options->extra_samplings); @@ -542,6 +546,7 @@ static int start_read(const struct device *dev, { int error; uint32_t selected_channels = sequence->channels; + uint8_t resolution = sequence->resolution; uint8_t active_channels; uint8_t channel_id; nrf_saadc_burst_t burst; @@ -571,6 +576,22 @@ static int start_read(const struct device *dev, channel_id); return -EINVAL; } + /* Signal an error if the channel is configured as + * single ended with a resolution which is identical + * to the sample bit size. The SAADC's "single ended" + * mode is really differential mode with the + * negative input tied to ground. We can therefore + * observe negative values if the positive input falls + * below ground. If the sample bitsize is larger than + * the resolution, we can detect negative values and + * correct them to 0 after the sequencen has ended. + */ + if ((m_data.single_ended_channels & BIT(channel_id)) && + (NRF_SAADC_8BIT_SAMPLE_WIDTH == 8 && resolution == 8)) { + LOG_ERR("Channel %u invalid single ended resolution", + channel_id); + return -EINVAL; + } /* When oversampling is used, the burst mode needs to * be activated. Unfortunately, this mode cannot be * activated permanently in the channel setup, because @@ -692,7 +713,7 @@ static void saadc_irq_handler(const struct device *dev) #if defined(ADC_BUFFER_IN_RAM) memcpy(m_data.user_buffer, m_data.samples_buffer, - samples_to_bytes(m_data.active_channels)); + samples_to_bytes(&m_data.ctx.sequence, m_data.active_channels)); #endif adc_context_on_sampling_done(&m_data.ctx, dev); From 95a4a4c67674303fa29da58d28836c87de7d8109 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:51 +0300 Subject: [PATCH 1244/2141] Revert "[nrf fromtree] manifest: Update hal_nordic with updated cracen hal and rng driver" This reverts commit 24d020f2f5652ee4e9110c190210e25a9078d969. Signed-off-by: Jukka Rissanen --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 20d4800519a9..d15e692caa4d 100644 --- a/west.yml +++ b/west.yml @@ -200,7 +200,7 @@ manifest: groups: - hal - name: hal_nordic - revision: 9587b1dcb83d24ab74e89837843a5f7d573f7059 + revision: 71308dc6d8c021887ce5d98a36cafe9517375a91 path: modules/hal/nordic groups: - hal From 49d7d17782a29e3c734114c7f32e589f3b1397a3 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:51 +0300 Subject: [PATCH 1245/2141] Revert "[nrf fromtree] tests: drivers: adc: Fix License in board overlay" This reverts commit f18ae796f22bc1f12a1ed8a73484b4a4d8019eb0. Signed-off-by: Jukka Rissanen --- .../boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/drivers/adc/adc_accuracy_test/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/adc/adc_accuracy_test/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay index b11dcebc3d3e..bc68f3c8d34f 100644 --- a/tests/drivers/adc/adc_accuracy_test/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ b/tests/drivers/adc/adc_accuracy_test/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -1,7 +1,7 @@ /* * Copyright (c) 2025 Nordic Semiconductor ASA * - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause */ /* From d7d3b9a18fc122cf728b32a8abfc0c11b8694108 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:51 +0300 Subject: [PATCH 1246/2141] Revert "[nrf fromtree] samples: drivers: adc: Fix License in board overlays" This reverts commit 1c01e1ddefa29efcab98de30f52c8e4ae994cb01. Signed-off-by: Jukka Rissanen --- .../adc/adc_dt/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 2 +- .../adc_sequence/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/drivers/adc/adc_dt/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/samples/drivers/adc/adc_dt/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay index a93e578fca7a..8953de6a5475 100644 --- a/samples/drivers/adc/adc_dt/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ b/samples/drivers/adc/adc_dt/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -1,7 +1,7 @@ /* * Copyright (c) 2025 Nordic Semiconductor ASA * - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause */ / { diff --git a/samples/drivers/adc/adc_sequence/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/samples/drivers/adc/adc_sequence/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay index a83d64e864e5..a85e9e7e611c 100644 --- a/samples/drivers/adc/adc_sequence/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ b/samples/drivers/adc/adc_sequence/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -1,7 +1,7 @@ /* * Copyright (c) 2025 Nordic Semiconductor ASA * - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause */ / { From de65d3e8c6c03caeafb2a031f52ffbefca100364 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:51 +0300 Subject: [PATCH 1247/2141] Revert "[nrf fromtree] tests: bsim: add early disconnect tests for iso and l2cap" This reverts commit 4c20b69ea6d6358ed106feaabb635892dfd10896. Signed-off-by: Jukka Rissanen --- tests/bsim/bluetooth/host/iso/cis/prj.conf | 1 - .../bluetooth/host/iso/cis/src/cis_central.c | 18 +- .../host/iso/cis/src/cis_peripheral.c | 36 ---- .../cis/tests_scripts/cis_early_disconnect.sh | 29 --- .../stress/overlay-early-disconnect.conf | 1 - .../bluetooth/host/l2cap/stress/src/main.c | 203 +----------------- .../bluetooth/host/l2cap/stress/testcase.yaml | 4 - .../tests_scripts/l2cap_early_disconnect.sh | 47 ---- 8 files changed, 12 insertions(+), 327 deletions(-) delete mode 100755 tests/bsim/bluetooth/host/iso/cis/tests_scripts/cis_early_disconnect.sh delete mode 100644 tests/bsim/bluetooth/host/l2cap/stress/overlay-early-disconnect.conf delete mode 100755 tests/bsim/bluetooth/host/l2cap/stress/tests_scripts/l2cap_early_disconnect.sh diff --git a/tests/bsim/bluetooth/host/iso/cis/prj.conf b/tests/bsim/bluetooth/host/iso/cis/prj.conf index 06f028232967..4ad0a0fd319a 100644 --- a/tests/bsim/bluetooth/host/iso/cis/prj.conf +++ b/tests/bsim/bluetooth/host/iso/cis/prj.conf @@ -16,7 +16,6 @@ CONFIG_BT_ISO_TX_MTU=200 CONFIG_BT_ISO_RX_MTU=200 CONFIG_BT_ISO_LOG_LEVEL_DBG=y -CONFIG_NET_BUF_POOL_USAGE=y # Controller Connected ISO configs CONFIG_BT_CTLR_CENTRAL_ISO=y diff --git a/tests/bsim/bluetooth/host/iso/cis/src/cis_central.c b/tests/bsim/bluetooth/host/iso/cis/src/cis_central.c index e3b6ee9284fe..dc7d46100a9e 100644 --- a/tests/bsim/bluetooth/host/iso/cis/src/cis_central.c +++ b/tests/bsim/bluetooth/host/iso/cis/src/cis_central.c @@ -154,11 +154,6 @@ static void iso_disconnected(struct bt_iso_chan *chan, uint8_t reason) err = bt_iso_remove_data_path(chan, BT_HCI_DATAPATH_DIR_HOST_TO_CTLR); TEST_ASSERT(err == 0, "Failed to remove ISO data path: %d", err); - - if (seq_num < 100) { - printk("Channel disconnected early, bumping seq_num to 1000 to end test\n"); - seq_num = 1000; - } } static void sdu_sent_cb(struct bt_iso_chan *chan) @@ -467,16 +462,9 @@ static void test_main(void) k_sleep(K_USEC(interval_us)); } - if (seq_num == 100) { - disconnect_cis(); - disconnect_acl(); - terminate_cig(); - } - - /* check that all buffers returned to pool */ - TEST_ASSERT(atomic_get(&tx_pool.avail_count) == ENQUEUE_COUNT, - "tx_pool has non returned buffers, should be %u but is %u", - ENQUEUE_COUNT, atomic_get(&tx_pool.avail_count)); + disconnect_cis(); + disconnect_acl(); + terminate_cig(); TEST_PASS("Test passed"); } diff --git a/tests/bsim/bluetooth/host/iso/cis/src/cis_peripheral.c b/tests/bsim/bluetooth/host/iso/cis/src/cis_peripheral.c index e8b3ff37a9d5..96b8865c1f4e 100644 --- a/tests/bsim/bluetooth/host/iso/cis/src/cis_peripheral.c +++ b/tests/bsim/bluetooth/host/iso/cis/src/cis_peripheral.c @@ -35,9 +35,6 @@ static const struct bt_data ad[] = { }; static struct bt_iso_chan iso_chan; -static size_t disconnect_after_recv_cnt; -static size_t iso_recv_cnt; - /** Print data as d_0 d_1 d_2 ... d_(n-2) d_(n-1) d_(n) to show the 3 first and 3 last octets * * Examples: @@ -75,26 +72,14 @@ static void iso_print_data(uint8_t *data, size_t data_len) printk("\t %s\n", data_str); } -static void disconnect_device(struct bt_conn *conn, void *data) -{ - int err = bt_conn_disconnect(conn, BT_HCI_ERR_REMOTE_USER_TERM_CONN); - - TEST_ASSERT(!err, "Failed to initate disconnect (err %d)", err); -} - static void iso_recv(struct bt_iso_chan *chan, const struct bt_iso_recv_info *info, struct net_buf *buf) { - iso_recv_cnt++; if (info->flags & BT_ISO_FLAGS_VALID) { printk("Incoming data channel %p len %u\n", chan, buf->len); iso_print_data(buf->data, buf->len); SET_FLAG(flag_data_received); } - if (disconnect_after_recv_cnt && (iso_recv_cnt >= disconnect_after_recv_cnt)) { - printk("Disconnecting\n"); - bt_conn_foreach(BT_CONN_TYPE_LE, disconnect_device, NULL); - } } static void iso_connected(struct bt_iso_chan *chan) @@ -204,33 +189,12 @@ static void test_main(void) } } -static void test_main_early_disconnect(void) -{ - init(); - - disconnect_after_recv_cnt = 10; - - while (true) { - adv_connect(); - bt_testlib_conn_wait_free(); - - if (IS_FLAG_SET(flag_data_received)) { - TEST_PASS("Test passed"); - } - } -} - static const struct bst_test_instance test_def[] = { { .test_id = "peripheral", .test_descr = "Peripheral", .test_main_f = test_main, }, - { - .test_id = "peripheral_early_disconnect", - .test_descr = "Peripheral that tests early disconnect", - .test_main_f = test_main_early_disconnect, - }, BSTEST_END_MARKER, }; diff --git a/tests/bsim/bluetooth/host/iso/cis/tests_scripts/cis_early_disconnect.sh b/tests/bsim/bluetooth/host/iso/cis/tests_scripts/cis_early_disconnect.sh deleted file mode 100755 index bac2c2e82a11..000000000000 --- a/tests/bsim/bluetooth/host/iso/cis/tests_scripts/cis_early_disconnect.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env bash -# Copyright (c) 2025 Google LLC -# SPDX-License-Identifier: Apache-2.0 - -source ${ZEPHYR_BASE}/tests/bsim/sh_common.source - -# Tests cleanup within the ble stack for ISO connections when -# peripheral disconnects early while the central still has -# buffers queued for sending. Using the base code, which -# has the central sending 100 ISO packets, the peripheral -# triggers a disconnect after receiving 10 packets. -# The central checks that all tx_pool buffers have been -# returned to the pool after the disconnect. -simulation_id="iso_cis_early_disconnect" -verbosity_level=2 -EXECUTE_TIMEOUT=120 - -cd ${BSIM_OUT_PATH}/bin - -Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_host_iso_cis_prj_conf \ - -v=${verbosity_level} -s=${simulation_id} -d=0 -testid=central - -Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_host_iso_cis_prj_conf \ - -v=${verbosity_level} -s=${simulation_id} -d=1 -testid=peripheral_early_disconnect - -Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s=${simulation_id} \ - -D=2 -sim_length=30e6 $@ - -wait_for_background_jobs diff --git a/tests/bsim/bluetooth/host/l2cap/stress/overlay-early-disconnect.conf b/tests/bsim/bluetooth/host/l2cap/stress/overlay-early-disconnect.conf deleted file mode 100644 index 94dfb1ed30d0..000000000000 --- a/tests/bsim/bluetooth/host/l2cap/stress/overlay-early-disconnect.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_BT_L2CAP_SEG_RECV=y diff --git a/tests/bsim/bluetooth/host/l2cap/stress/src/main.c b/tests/bsim/bluetooth/host/l2cap/stress/src/main.c index a411354bb791..d05f4e4f0a74 100644 --- a/tests/bsim/bluetooth/host/l2cap/stress/src/main.c +++ b/tests/bsim/bluetooth/host/l2cap/stress/src/main.c @@ -17,7 +17,6 @@ #include #include "babblekit/testcase.h" #include "babblekit/flags.h" -#include "bsim_args_runner.h" #define LOG_MODULE_NAME main #include @@ -32,18 +31,6 @@ DEFINE_FLAG_STATIC(flag_l2cap_connected); #define SDU_LEN 3000 #define RESCHEDULE_DELAY K_MSEC(100) -/* The early_disconnect test has the peripheral disconnect at various - * times: - * - * Peripheral 1: disconnects after all 20 SDUs as before - * Peripheral 2: disconnects immediately before receiving anything - * Peripheral 3: disconnects after receiving first SDU - * Peripheral 4: disconnects after receiving first PDU in second SDU - * Peripheral 5: disconnects after receiving third PDU in third SDU - * Peripheral 6: disconnects atfer receiving tenth PDU in tenth SDU - */ -static unsigned int device_nbr; - static void sdu_destroy(struct net_buf *buf) { LOG_DBG("%p", buf); @@ -69,7 +56,7 @@ NET_BUF_POOL_DEFINE(sdu_rx_pool, 8, rx_destroy); static uint8_t tx_data[SDU_LEN]; -static uint16_t sdu_rx_cnt; +static uint16_t rx_cnt; static uint8_t disconnect_counter; struct test_ctx { @@ -151,66 +138,10 @@ void sent_cb(struct bt_l2cap_chan *chan) continue_sending(ctx); } -#ifdef CONFIG_BT_L2CAP_SEG_RECV -static void disconnect_device_no_wait(struct bt_conn *conn, void *data) -{ - int err; - - err = bt_conn_disconnect(conn, BT_HCI_ERR_REMOTE_USER_TERM_CONN); - TEST_ASSERT(!err, "Failed to initate disconnect (err %d)", err); - - UNSET_FLAG(is_connected); -} - -static void seg_recv_cb(struct bt_l2cap_chan *chan, size_t sdu_len, off_t seg_offset, - struct net_buf_simple *seg) -{ - static size_t pdu_rx_cnt; - - if ((seg_offset + seg->len) == sdu_len) { - /* last segment/PDU of a SDU */ - LOG_DBG("len %d", seg->len); - sdu_rx_cnt++; - pdu_rx_cnt = 0; - } else { - LOG_DBG("SDU %u, pdu %u at seg_offset %u, len %u", - sdu_rx_cnt, pdu_rx_cnt, seg_offset, seg->len); - pdu_rx_cnt++; - } - - /* Verify SDU data matches TX'd data. */ - int pos = memcmp(seg->data, &tx_data[seg_offset], seg->len); - - if (pos != 0) { - LOG_ERR("RX data doesn't match TX: pos %d", seg_offset); - LOG_HEXDUMP_ERR(seg->data, seg->len, "RX data"); - LOG_HEXDUMP_INF(tx_data, seg->len, "TX data"); - - for (uint16_t p = 0; p < seg->len; p++) { - __ASSERT(seg->data[p] == tx_data[p + seg_offset], - "Failed rx[%d]=%x != expect[%d]=%x", - p, seg->data[p], p, tx_data[p + seg_offset]); - } - } - - if (((device_nbr == 4) && (sdu_rx_cnt >= 1) && (pdu_rx_cnt == 1)) || - ((device_nbr == 5) && (sdu_rx_cnt >= 2) && (pdu_rx_cnt == 3)) || - ((device_nbr == 6) && (sdu_rx_cnt >= 9) && (pdu_rx_cnt == 10))) { - LOG_INF("disconnecting after receiving PDU %u of SDU %u", - pdu_rx_cnt - 1, sdu_rx_cnt); - bt_conn_foreach(BT_CONN_TYPE_LE, disconnect_device_no_wait, NULL); - return; - } - - if (is_connected) { - bt_l2cap_chan_give_credits(chan, 1); - } -} -#else /* CONFIG_BT_L2CAP_SEG_RECV */ int recv_cb(struct bt_l2cap_chan *chan, struct net_buf *buf) { LOG_DBG("len %d", buf->len); - sdu_rx_cnt++; + rx_cnt++; /* Verify SDU data matches TX'd data. */ int pos = memcmp(buf->data, tx_data, buf->len); @@ -229,7 +160,6 @@ int recv_cb(struct bt_l2cap_chan *chan, struct net_buf *buf) return 0; } -#endif /* CONFIG_BT_L2CAP_SEG_RECV */ void l2cap_chan_connected_cb(struct bt_l2cap_chan *l2cap_chan) { @@ -237,41 +167,25 @@ void l2cap_chan_connected_cb(struct bt_l2cap_chan *l2cap_chan) CONTAINER_OF(l2cap_chan, struct bt_l2cap_le_chan, chan); SET_FLAG(flag_l2cap_connected); - LOG_DBG("%x (tx mtu %d mps %d cr %ld) (tx mtu %d mps %d cr %ld)", + LOG_DBG("%x (tx mtu %d mps %d) (tx mtu %d mps %d)", l2cap_chan, chan->tx.mtu, chan->tx.mps, - atomic_get(&chan->tx.credits), chan->rx.mtu, - chan->rx.mps, - atomic_get(&chan->rx.credits)); + chan->rx.mps); } -void l2cap_chan_disconnected_cb(struct bt_l2cap_chan *l2cap_chan) +void l2cap_chan_disconnected_cb(struct bt_l2cap_chan *chan) { UNSET_FLAG(flag_l2cap_connected); - LOG_DBG("%p", l2cap_chan); - for (int i = 0; i < L2CAP_CHANS; i++) { - if (&contexts[i].le_chan == CONTAINER_OF(l2cap_chan, - struct bt_l2cap_le_chan, chan)) { - if (contexts[i].tx_left > 0) { - LOG_INF("setting tx_left to 0 because of disconnect"); - contexts[i].tx_left = 0; - } - break; - } - } + LOG_DBG("%p", chan); } static struct bt_l2cap_chan_ops ops = { .connected = l2cap_chan_connected_cb, .disconnected = l2cap_chan_disconnected_cb, .alloc_buf = alloc_buf_cb, -#ifdef CONFIG_BT_L2CAP_SEG_RECV - .seg_recv = seg_recv_cb, -#else .recv = recv_cb, -#endif .sent = sent_cb, }; @@ -320,10 +234,6 @@ int server_accept_cb(struct bt_conn *conn, struct bt_l2cap_server *server, memset(le_chan, 0, sizeof(*le_chan)); le_chan->chan.ops = &ops; le_chan->rx.mtu = SDU_LEN; -#ifdef CONFIG_BT_L2CAP_SEG_RECV - le_chan->rx.mps = BT_L2CAP_RX_MTU; - le_chan->rx.credits = CONFIG_BT_BUF_ACL_RX_COUNT_EXTRA; -#endif *chan = &le_chan->chan; return 0; @@ -425,93 +335,15 @@ static void test_peripheral_main(void) LOG_DBG("Registered server PSM %x", psm); LOG_DBG("Peripheral waiting for transfer completion"); - while (sdu_rx_cnt < SDU_NUM) { - k_msleep(100); - } - - bt_conn_foreach(BT_CONN_TYPE_LE, disconnect_device, NULL); - - WAIT_FOR_FLAG_UNSET(is_connected); - LOG_INF("Total received: %d", sdu_rx_cnt); - - /* check that all buffers returned to pool */ - TEST_ASSERT(atomic_get(&sdu_tx_pool.avail_count) == CONFIG_BT_MAX_CONN, - "sdu_tx_pool has non returned buffers, should be %u but is %u", - CONFIG_BT_MAX_CONN, atomic_get(&sdu_tx_pool.avail_count)); - TEST_ASSERT(atomic_get(&sdu_rx_pool.avail_count) == CONFIG_BT_MAX_CONN, - "sdu_rx_pool has non returned buffers, should be %u but is %u", - CONFIG_BT_MAX_CONN, atomic_get(&sdu_rx_pool.avail_count)); - - TEST_PASS("L2CAP STRESS Peripheral passed"); -} - -static void test_peripheral_early_disconnect_main(void) -{ - device_nbr = bsim_args_get_global_device_nbr(); - LOG_DBG("*L2CAP STRESS EARLY DISCONNECT Peripheral started*"); - int err; - - /* Prepare tx_data */ - for (size_t i = 0; i < sizeof(tx_data); i++) { - tx_data[i] = (uint8_t)i; - } - - err = bt_enable(NULL); - if (err) { - TEST_FAIL("Can't enable Bluetooth (err %d)", err); - return; - } - - LOG_DBG("Peripheral Bluetooth initialized."); - LOG_DBG("Connectable advertising..."); - err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, NULL, 0, NULL, 0); - if (err) { - TEST_FAIL("Advertising failed to start (err %d)", err); - return; - } - - LOG_DBG("Advertising started."); - LOG_DBG("Peripheral waiting for connection..."); - WAIT_FOR_FLAG(is_connected); - LOG_DBG("Peripheral Connected."); - - int psm = l2cap_server_register(BT_SECURITY_L1); - - LOG_DBG("Registered server PSM %x", psm); - - if (device_nbr == 2) { - LOG_INF("disconnecting before receiving any SDU"); - k_msleep(1000); - goto disconnect; - } - - LOG_DBG("Peripheral waiting for transfer completion"); - while (sdu_rx_cnt < SDU_NUM) { - if ((device_nbr == 3) && (sdu_rx_cnt >= 1)) { - LOG_INF("disconnecting after receiving SDU %u", sdu_rx_cnt); - break; - } - + while (rx_cnt < SDU_NUM) { k_msleep(100); - if (!is_connected) { - goto done; - } } -disconnect: bt_conn_foreach(BT_CONN_TYPE_LE, disconnect_device, NULL); -done: - WAIT_FOR_FLAG_UNSET(is_connected); - LOG_INF("Total received: %d", sdu_rx_cnt); + LOG_INF("Total received: %d", rx_cnt); - /* check that all buffers returned to pool */ - TEST_ASSERT(atomic_get(&sdu_tx_pool.avail_count) == CONFIG_BT_MAX_CONN, - "sdu_tx_pool has non returned buffers, should be %u but is %u", - CONFIG_BT_MAX_CONN, atomic_get(&sdu_tx_pool.avail_count)); - TEST_ASSERT(atomic_get(&sdu_rx_pool.avail_count) == CONFIG_BT_MAX_CONN, - "sdu_rx_pool has non returned buffers, should be %u but is %u", - CONFIG_BT_MAX_CONN, atomic_get(&sdu_rx_pool.avail_count)); + TEST_ASSERT(rx_cnt == SDU_NUM, "Did not receive expected no of SDUs"); TEST_PASS("L2CAP STRESS Peripheral passed"); } @@ -573,10 +405,6 @@ static void connect_l2cap_channel(struct bt_conn *conn, void *data) le_chan->chan.ops = &ops; le_chan->rx.mtu = SDU_LEN; -#ifdef CONFIG_BT_L2CAP_SEG_RECV - le_chan->rx.mps = BT_L2CAP_RX_MTU; - le_chan->rx.credits = CONFIG_BT_BUF_ACL_RX_COUNT_EXTRA; -#endif UNSET_FLAG(flag_l2cap_connected); @@ -633,14 +461,6 @@ static void test_central_main(void) } LOG_DBG("All peripherals disconnected."); - /* check that all buffers returned to pool */ - TEST_ASSERT(atomic_get(&sdu_tx_pool.avail_count) == CONFIG_BT_MAX_CONN, - "sdu_tx_pool has non returned buffers, should be %u but is %u", - CONFIG_BT_MAX_CONN, atomic_get(&sdu_tx_pool.avail_count)); - TEST_ASSERT(atomic_get(&sdu_rx_pool.avail_count) == CONFIG_BT_MAX_CONN, - "sdu_rx_pool has non returned buffers, should be %u but is %u", - CONFIG_BT_MAX_CONN, atomic_get(&sdu_rx_pool.avail_count)); - TEST_PASS("L2CAP STRESS Central passed"); } @@ -650,11 +470,6 @@ static const struct bst_test_instance test_def[] = { .test_descr = "Peripheral L2CAP STRESS", .test_main_f = test_peripheral_main }, - { - .test_id = "peripheral_early_disconnect", - .test_descr = "Peripheral L2CAP STRESS EARLY DISCONNECT", - .test_main_f = test_peripheral_early_disconnect_main, - }, { .test_id = "central", .test_descr = "Central L2CAP STRESS", diff --git a/tests/bsim/bluetooth/host/l2cap/stress/testcase.yaml b/tests/bsim/bluetooth/host/l2cap/stress/testcase.yaml index 8fbe85a3b646..f872f5873dae 100644 --- a/tests/bsim/bluetooth/host/l2cap/stress/testcase.yaml +++ b/tests/bsim/bluetooth/host/l2cap/stress/testcase.yaml @@ -10,10 +10,6 @@ tests: bluetooth.host.l2cap.stress: harness_config: bsim_exe_name: tests_bsim_bluetooth_host_l2cap_stress_prj_conf - bluetooth.host.l2cap.stress_early_disconnect: - harness_config: - bsim_exe_name: tests_bsim_bluetooth_host_l2cap_stress_prj_conf_overlay-early-disc_conf - extra_args: EXTRA_CONF_FILE="overlay-early-disconnect.conf" bluetooth.host.l2cap.stress_nofrag: harness_config: bsim_exe_name: tests_bsim_bluetooth_host_l2cap_stress_prj_conf_overlay-nofrag_conf diff --git a/tests/bsim/bluetooth/host/l2cap/stress/tests_scripts/l2cap_early_disconnect.sh b/tests/bsim/bluetooth/host/l2cap/stress/tests_scripts/l2cap_early_disconnect.sh deleted file mode 100755 index 8741839e762f..000000000000 --- a/tests/bsim/bluetooth/host/l2cap/stress/tests_scripts/l2cap_early_disconnect.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env bash -# Copyright (c) 2025 Google LLC -# SPDX-License-Identifier: Apache-2.0 - -source ${ZEPHYR_BASE}/tests/bsim/sh_common.source - -# Tests cleanup within the ble stack for L2CAP connections when -# peripheral disconnects early while the central still has -# buffers queued for sending. Using the base code, which -# has the central sending 20 SDUs to 6 different peripherals, -# the test has the peripherals disconnect as follows: -# -# Peripheral 1: disconnects after all 20 SDUs as before -# Peripheral 2: disconnects immediately before receiving anything -# Peripheral 3: disconnects after receiving first SDU -# Peripheral 4: disconnects after receiving first PDU in second SDU -# Peripheral 5: disconnects after receiving third PDU in third SDU -# Peripheral 6: disconnects atfer receiving tenth PDU in tenth SDU -# -# The central and peripherals check that all tx_pool and rx_pool -# buffers have been returned after the disconnect. -simulation_id="l2cap_stress_early_disconnect" -verbosity_level=2 -EXECUTE_TIMEOUT=240 - -bsim_exe=./bs_${BOARD_TS}_tests_bsim_bluetooth_host_l2cap_stress_prj_conf_overlay-early-disc_conf - -cd ${BSIM_OUT_PATH}/bin - -Execute "${bsim_exe}" -v=${verbosity_level} -s=${simulation_id} -d=0 -testid=central -rs=43 - -Execute "${bsim_exe}" -v=${verbosity_level} -s=${simulation_id} -d=1 \ - -testid=peripheral_early_disconnect -rs=42 -Execute "${bsim_exe}" -v=${verbosity_level} -s=${simulation_id} -d=2 \ - -testid=peripheral_early_disconnect -rs=10 -Execute "${bsim_exe}" -v=${verbosity_level} -s=${simulation_id} -d=3 \ - -testid=peripheral_early_disconnect -rs=23 -Execute "${bsim_exe}" -v=${verbosity_level} -s=${simulation_id} -d=4 \ - -testid=peripheral_early_disconnect -rs=7884 -Execute "${bsim_exe}" -v=${verbosity_level} -s=${simulation_id} -d=5 \ - -testid=peripheral_early_disconnect -rs=230 -Execute "${bsim_exe}" -v=${verbosity_level} -s=${simulation_id} -d=6 \ - -testid=peripheral_early_disconnect -rs=9 - -Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s=${simulation_id} -D=7 -sim_length=400e6 $@ - -wait_for_background_jobs From b7d4e127e36704487d7f5db63a5a311394787453 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:51 +0300 Subject: [PATCH 1248/2141] Revert "[nrf fromtree] bluetooth: fix bug when destroying tx queue buffers on disconnect" This reverts commit 720dc042525938bf5bf340c6ddf0b9d697eb5c9c. Signed-off-by: Jukka Rissanen --- subsys/bluetooth/host/classic/l2cap_br.c | 16 +--- subsys/bluetooth/host/conn.c | 111 +++++++++++++++-------- subsys/bluetooth/host/conn_internal.h | 14 +-- subsys/bluetooth/host/iso.c | 31 +++---- subsys/bluetooth/host/l2cap.c | 30 +++--- 5 files changed, 104 insertions(+), 98 deletions(-) diff --git a/subsys/bluetooth/host/classic/l2cap_br.c b/subsys/bluetooth/host/classic/l2cap_br.c index 1d8616013e99..66343aa512df 100644 --- a/subsys/bluetooth/host/classic/l2cap_br.c +++ b/subsys/bluetooth/host/classic/l2cap_br.c @@ -1574,8 +1574,6 @@ struct net_buf *l2cap_br_data_pull(struct bt_conn *conn, size_t amount, size_t * return NULL; } - __ASSERT_NO_MSG(conn->state == BT_CONN_CONNECTED); - struct bt_l2cap_br_chan *br_chan; br_chan = CONTAINER_OF(pdu_ready, struct bt_l2cap_br_chan, _pdu_ready); @@ -1593,15 +1591,13 @@ struct net_buf *l2cap_br_data_pull(struct bt_conn *conn, size_t amount, size_t * __ASSERT(tx_pdu, "signaled ready but no PDUs in the TX queue"); - struct net_buf *q_pdu = CONTAINER_OF(tx_pdu, struct net_buf, node); + struct net_buf *pdu = CONTAINER_OF(tx_pdu, struct net_buf, node); - if (bt_buf_has_view(q_pdu)) { - LOG_ERR("already have view on %p", q_pdu); + if (bt_buf_has_view(pdu)) { + LOG_ERR("already have view on %p", pdu); return NULL; } - struct net_buf *pdu = net_buf_ref(q_pdu); - /* We can't interleave ACL fragments from different channels for the * same ACL conn -> we have to wait until a full L2 PDU is transferred * before switching channels. @@ -1609,15 +1605,13 @@ struct net_buf *l2cap_br_data_pull(struct bt_conn *conn, size_t amount, size_t * bool last_frag = amount >= pdu->len; if (last_frag) { - LOG_DBG("last frag, removing %p", q_pdu); + LOG_DBG("last frag, removing %p", pdu); __maybe_unused bool found; - found = sys_slist_find_and_remove(&br_chan->_pdu_tx_queue, &q_pdu->node); + found = sys_slist_find_and_remove(&br_chan->_pdu_tx_queue, &pdu->node); __ASSERT_NO_MSG(found); - net_buf_unref(q_pdu); - LOG_DBG("chan %p done", br_chan); lower_data_ready(br_chan); diff --git a/subsys/bluetooth/host/conn.c b/subsys/bluetooth/host/conn.c index 9e9f18c040a0..0c34dc0b6160 100644 --- a/subsys/bluetooth/host/conn.c +++ b/subsys/bluetooth/host/conn.c @@ -649,7 +649,7 @@ static bool is_acl_conn(struct bt_conn *conn) } static int send_buf(struct bt_conn *conn, struct net_buf *buf, - size_t len, bt_conn_tx_cb_t cb, void *ud) + size_t len, void *cb, void *ud) { struct net_buf *frag = NULL; struct bt_conn_tx *tx = NULL; @@ -659,15 +659,13 @@ static int send_buf(struct bt_conn *conn, struct net_buf *buf, if (buf->len == 0) { __ASSERT_NO_MSG(0); - err = -EMSGSIZE; - goto error_return; + return -EMSGSIZE; } if (bt_buf_has_view(buf)) { __ASSERT_NO_MSG(0); - err = -EIO; - goto error_return; + return -EIO; } LOG_DBG("conn %p buf %p len %zu buf->len %u cb %p ud %p", @@ -682,8 +680,7 @@ static int send_buf(struct bt_conn *conn, struct net_buf *buf, */ __ASSERT(0, "No controller bufs"); - err = -ENOMEM; - goto error_return; + return -ENOMEM; } /* Allocate and set the TX context */ @@ -692,9 +689,8 @@ static int send_buf(struct bt_conn *conn, struct net_buf *buf, /* See big comment above */ if (!tx) { __ASSERT(0, "No TX context"); - k_sem_give(bt_conn_get_pkts(conn)); - err = -ENOMEM; - goto error_return; + + return -ENOMEM; } tx->cb = cb; @@ -702,17 +698,18 @@ static int send_buf(struct bt_conn *conn, struct net_buf *buf, uint16_t frag_len = MIN(conn_mtu(conn), len); - /* Check that buf->ref is 1 or 2. It would be 1 if this - * was the only reference (e.g. buf was removed - * from the conn tx_queue). It would be 2 if the - * tx_data_pull kept it on the tx_queue for segmentation. - */ - __ASSERT_NO_MSG((buf->ref == 1) || (buf->ref == 2)); + __ASSERT_NO_MSG(buf->ref == 1); - /* The reference is always transferred to the frag, so when - * the frag is destroyed, the parent reference is decremented. - */ - frag = get_data_frag(buf, frag_len); + if (buf->len > frag_len) { + LOG_DBG("keep %p around", buf); + frag = get_data_frag(net_buf_ref(buf), frag_len); + } else { + LOG_DBG("move %p ref in", buf); + /* Move the ref into `frag` for the last TX. That way `buf` will + * get destroyed when `frag` is destroyed. + */ + frag = get_data_frag(buf, frag_len); + } /* Caller is supposed to check we have all resources to send */ __ASSERT_NO_MSG(frag != NULL); @@ -726,7 +723,7 @@ static int send_buf(struct bt_conn *conn, struct net_buf *buf, conn->next_is_frag = false; } - LOG_DBG("send frag: buf %p len %d", frag, frag_len); + LOG_DBG("send frag: buf %p len %d", buf, frag_len); /* At this point, the buffer is either a fragment or a full HCI packet. * The flags are also valid. @@ -769,26 +766,15 @@ static int send_buf(struct bt_conn *conn, struct net_buf *buf, */ net_buf_unref(frag); - /* `buf` might not get destroyed right away because it may - * still be on a conn tx_queue, and its `tx` pointer will still - * be reachable. Make sure that we don't try to use the - * destroyed context later. + /* `buf` might not get destroyed right away, and its `tx` + * pointer will still be reachable. Make sure that we don't try + * to use the destroyed context later. */ conn_tx_destroy(conn, tx); k_sem_give(bt_conn_get_pkts(conn)); /* Merge HCI driver errors */ return -EIO; - -error_return: - /* Runtime handling of fatal errors when ASSERTS are disabled. - * Unref the buf and invoke callback with the error. - */ - net_buf_unref(buf); - if (cb) { - cb(conn, ud, err); - } - return err; } static struct k_poll_signal conn_change = @@ -970,8 +956,8 @@ struct bt_conn *get_conn_ready(void) sys_slist_remove(&bt_dev.le.conn_ready, prev, &conn->_conn_ready); (void)atomic_set(&conn->_conn_ready_lock, 0); - /* Append connection to list if it is connected and still has data */ - if (conn->has_data(conn) && (conn->state == BT_CONN_CONNECTED)) { + /* Append connection to list if it still has data */ + if (conn->has_data(conn)) { LOG_DBG("appending %p to back of TX queue", conn); bt_conn_data_ready(conn); } @@ -999,6 +985,30 @@ static void acl_get_and_clear_cb(struct bt_conn *conn, struct net_buf *buf, } #endif /* defined(CONFIG_BT_CONN) */ +/* Acts as a "null-routed" bt_send(). This fn will decrease the refcount of + * `buf` and call the user callback with an error code. + */ +static void destroy_and_callback(struct bt_conn *conn, + struct net_buf *buf, + bt_conn_tx_cb_t cb, + void *ud) +{ + if (!cb) { + conn->get_and_clear_cb(conn, buf, &cb, &ud); + } + + LOG_DBG("pop: cb %p userdata %p", cb, ud); + + /* bt_send() would've done an unref. Do it here also, so the buffer is + * hopefully destroyed and the user callback can allocate a new one. + */ + net_buf_unref(buf); + + if (cb) { + cb(conn, ud, -ESHUTDOWN); + } +} + static volatile bool _suspend_tx; #if defined(CONFIG_BT_TESTING) @@ -1041,7 +1051,17 @@ void bt_conn_tx_processor(void) if (conn->state != BT_CONN_CONNECTED) { LOG_WRN("conn %p: not connected", conn); - goto raise_and_exit; + + /* Call the user callbacks & destroy (final-unref) the buffers + * we were supposed to send. + */ + buf = conn->tx_data_pull(conn, SIZE_MAX, &buf_len); + while (buf) { + destroy_and_callback(conn, buf, cb, ud); + buf = conn->tx_data_pull(conn, SIZE_MAX, &buf_len); + } + + goto exit; } /* now that we are guaranteed resources, we can pull data from the upper @@ -1075,12 +1095,25 @@ void bt_conn_tx_processor(void) int err = send_buf(conn, buf, buf_len, cb, ud); if (err) { + /* -EIO means `unrecoverable error`. It can be an assertion that + * failed or an error from the HCI driver. + * + * -ENOMEM means we thought we had all the resources to send the + * buf (ie. TX context + controller buffer) but one of them was + * not available. This is likely due to a failure of + * assumption, likely that we have been pre-empted somehow and + * that `tx_processor()` has been re-entered. + * + * In both cases, we destroy the buffer and mark the connection + * as dead. + */ LOG_ERR("Fatal error (%d). Disconnecting %p", err, conn); + destroy_and_callback(conn, buf, cb, ud); bt_conn_disconnect(conn, BT_HCI_ERR_REMOTE_USER_TERM_CONN); + goto exit; } -raise_and_exit: /* Always kick the TX work. It will self-suspend if it doesn't get * resources or there is nothing left to send. */ diff --git a/subsys/bluetooth/host/conn_internal.h b/subsys/bluetooth/host/conn_internal.h index 909c0ebd22ef..41f396a1aeed 100644 --- a/subsys/bluetooth/host/conn_internal.h +++ b/subsys/bluetooth/host/conn_internal.h @@ -288,22 +288,10 @@ struct bt_conn { #endif /* Callback into the higher-layers (L2CAP / ISO) to return a buffer for - * sending `amount` of bytes to HCI. Will only be called when - * the state is connected. The higher-layer is responsible for purging - * the remaining buffers on disconnect. + * sending `amount` of bytes to HCI. * * Scheduling from which channel to pull (e.g. for L2CAP) is done at the * upper layer's discretion. - * - * Details about the returned net_buf when it is not NULL: - * - If the net_buf->len <= *length, then the net_buf has been removed - * from the tx_queue of the connection and the caller is now the - * owner of the only reference to the net_buf. - * - Otherwise, the net_buf is still on the tx_queue of the connection, - * and the callback has incremented the reference count to account - * for it having a reference still. - * - The caller must consume *length bytes from the net_buf before - * calling this function again. */ struct net_buf * (*tx_data_pull)(struct bt_conn *conn, size_t amount, diff --git a/subsys/bluetooth/host/iso.c b/subsys/bluetooth/host/iso.c index a59158a43d31..eb6eaa783504 100644 --- a/subsys/bluetooth/host/iso.c +++ b/subsys/bluetooth/host/iso.c @@ -454,18 +454,10 @@ void bt_iso_connected(struct bt_conn *iso) static void bt_iso_chan_disconnected(struct bt_iso_chan *chan, uint8_t reason) { const uint8_t conn_type = chan->iso->iso.info.type; - struct net_buf *buf; - LOG_DBG("%p, reason 0x%02x", chan, reason); __ASSERT(chan->iso != NULL, "NULL conn for iso chan %p", chan); - /* release buffers from tx_queue */ - while ((buf = k_fifo_get(&chan->iso->iso.txq, K_NO_WAIT))) { - __ASSERT_NO_MSG(!bt_buf_has_view(buf)); - net_buf_unref(buf); - } - bt_iso_chan_set_state(chan, BT_ISO_STATE_DISCONNECTED); bt_conn_set_state(chan->iso, BT_CONN_DISCONNECT_COMPLETE); @@ -783,8 +775,7 @@ void bt_iso_recv(struct bt_conn *iso, struct net_buf *buf, uint8_t flags) static bool iso_has_data(struct bt_conn *conn) { #if defined(CONFIG_BT_ISO_TX) - return ((conn->iso.chan->state == BT_ISO_STATE_CONNECTED) && - !k_fifo_is_empty(&conn->iso.txq)); + return !k_fifo_is_empty(&conn->iso.txq); #else /* !CONFIG_BT_ISO_TX */ return false; #endif /* CONFIG_BT_ISO_TX */ @@ -798,9 +789,9 @@ static struct net_buf *iso_data_pull(struct bt_conn *conn, size_t amount, size_t /* Leave the PDU buffer in the queue until we have sent all its * fragments. */ - struct net_buf *q_frag = k_fifo_peek_head(&conn->iso.txq); + struct net_buf *frag = k_fifo_peek_head(&conn->iso.txq); - if (!q_frag) { + if (!frag) { BT_ISO_DATA_DBG("signaled ready but no frag available"); /* Service other connections */ bt_tx_irq_raise(); @@ -808,10 +799,13 @@ static struct net_buf *iso_data_pull(struct bt_conn *conn, size_t amount, size_t return NULL; } - __ASSERT_NO_MSG(conn->state == BT_CONN_CONNECTED); - if (conn->iso.chan->state != BT_ISO_STATE_CONNECTED) { + __maybe_unused struct net_buf *b = k_fifo_get(&conn->iso.txq, K_NO_WAIT); + LOG_DBG("channel has been disconnected"); + __ASSERT_NO_MSG(b == frag); + + net_buf_unref(b); /* Service other connections */ bt_tx_irq_raise(); @@ -819,7 +813,7 @@ static struct net_buf *iso_data_pull(struct bt_conn *conn, size_t amount, size_t return NULL; } - if (bt_buf_has_view(q_frag)) { + if (bt_buf_has_view(frag)) { /* This should not happen. conn.c should wait until the view is * destroyed before requesting more data. */ @@ -827,16 +821,13 @@ static struct net_buf *iso_data_pull(struct bt_conn *conn, size_t amount, size_t return NULL; } - struct net_buf *frag = net_buf_ref(q_frag); bool last_frag = amount >= frag->len; if (last_frag) { - q_frag = k_fifo_get(&conn->iso.txq, K_NO_WAIT); + __maybe_unused struct net_buf *b = k_fifo_get(&conn->iso.txq, K_NO_WAIT); BT_ISO_DATA_DBG("last frag, pop buf"); - __ASSERT_NO_MSG(q_frag == frag); - - net_buf_unref(q_frag); + __ASSERT_NO_MSG(b == frag); } *length = frag->len; diff --git a/subsys/bluetooth/host/l2cap.c b/subsys/bluetooth/host/l2cap.c index ac6fc60dbad6..433eb8faef09 100644 --- a/subsys/bluetooth/host/l2cap.c +++ b/subsys/bluetooth/host/l2cap.c @@ -83,6 +83,11 @@ NET_BUF_POOL_FIXED_DEFINE(disc_pool, 1, #define l2cap_remove_ident(conn, ident) __l2cap_lookup_ident(conn, ident, true) static sys_slist_t servers = SYS_SLIST_STATIC_INIT(&servers); + +static void l2cap_tx_buf_destroy(struct bt_conn *conn, struct net_buf *buf, int err) +{ + net_buf_unref(buf); +} #endif /* CONFIG_BT_L2CAP_DYNAMIC_CHANNEL */ /* L2CAP signalling channel specific context */ @@ -252,7 +257,6 @@ void bt_l2cap_chan_del(struct bt_l2cap_chan *chan) { const struct bt_l2cap_chan_ops *ops = chan->ops; struct bt_l2cap_le_chan *le_chan = BT_L2CAP_LE_CHAN(chan); - struct net_buf *buf; LOG_DBG("conn %p chan %p", chan->conn, chan); @@ -265,7 +269,9 @@ void bt_l2cap_chan_del(struct bt_l2cap_chan *chan) /* Remove buffers on the PDU TX queue. We can't do that in * `l2cap_chan_destroy()` as it is not called for fixed channels. */ - while ((buf = k_fifo_get(&le_chan->tx_queue, K_NO_WAIT))) { + while (chan_has_data(le_chan)) { + struct net_buf *buf = k_fifo_get(&le_chan->tx_queue, K_NO_WAIT); + net_buf_unref(buf); } @@ -913,22 +919,20 @@ struct net_buf *l2cap_data_pull(struct bt_conn *conn, * For SDUs we do the same, we keep it in the queue until all the * segments have been sent, adding the PDU headers just-in-time. */ - struct net_buf *fifo_pdu = k_fifo_peek_head(&lechan->tx_queue); + struct net_buf *pdu = k_fifo_peek_head(&lechan->tx_queue); /* We don't have anything to send for the current channel. We could * however have something to send on another channel that is attached to * the same ACL connection. Re-trigger the TX processor: it will call us * again and this time we will select another channel to pull data from. */ - if (!fifo_pdu) { + if (!pdu) { bt_tx_irq_raise(); return NULL; } - __ASSERT_NO_MSG(conn->state == BT_CONN_CONNECTED); - - if (bt_buf_has_view(fifo_pdu)) { - LOG_ERR("already have view on %p", fifo_pdu); + if (bt_buf_has_view(pdu)) { + LOG_ERR("already have view on %p", pdu); return NULL; } @@ -942,8 +946,6 @@ struct net_buf *l2cap_data_pull(struct bt_conn *conn, return NULL; } - struct net_buf *pdu = net_buf_ref(fifo_pdu); - /* Add PDU header */ if (lechan->_pdu_remaining == 0) { struct bt_l2cap_hdr *hdr; @@ -973,11 +975,9 @@ struct net_buf *l2cap_data_pull(struct bt_conn *conn, if (last_frag && last_seg) { LOG_DBG("last frag of last seg, dequeuing %p", pdu); - fifo_pdu = k_fifo_get(&lechan->tx_queue, K_NO_WAIT); + __maybe_unused struct net_buf *b = k_fifo_get(&lechan->tx_queue, K_NO_WAIT); - __ASSERT_NO_MSG(fifo_pdu == pdu); - - net_buf_unref(fifo_pdu); + __ASSERT_NO_MSG(b == pdu); } if (last_frag && L2CAP_LE_CID_IS_DYN(lechan->tx.cid)) { @@ -2290,7 +2290,7 @@ static void l2cap_chan_shutdown(struct bt_l2cap_chan *chan) /* Remove buffers on the TX queue */ while ((buf = k_fifo_get(&le_chan->tx_queue, K_NO_WAIT))) { - net_buf_unref(buf); + l2cap_tx_buf_destroy(chan->conn, buf, -ESHUTDOWN); } /* Remove buffers on the RX queue */ From 6f521240fc5f549e4ebc17b71ea9068dc2d38fd1 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:51 +0300 Subject: [PATCH 1249/2141] Revert "[nrf fromtree] tests: drivers: clock_control: nrf_lf_clock_start: Run on nrf54lm20dk" This reverts commit 09917ddd26f3eae14126804fdf093e6bef790785. Signed-off-by: Jukka Rissanen --- tests/drivers/clock_control/nrf_lf_clock_start/testcase.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/drivers/clock_control/nrf_lf_clock_start/testcase.yaml b/tests/drivers/clock_control/nrf_lf_clock_start/testcase.yaml index 0b1f9ae3c931..2a4bba57a711 100644 --- a/tests/drivers/clock_control/nrf_lf_clock_start/testcase.yaml +++ b/tests/drivers/clock_control/nrf_lf_clock_start/testcase.yaml @@ -51,7 +51,6 @@ tests: - nrf5340dk/nrf5340/cpuapp - nrf5340dk/nrf5340/cpunet - nrf54l15dk/nrf54l15/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: - nrf51dk/nrf51822 From ae2542d8e849c9bc2f14a130e2212f63b35d597b Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:51 +0300 Subject: [PATCH 1250/2141] Revert "[nrf fromtree] serial: nrfx_uarte: initial pin state to SLEEP" This reverts commit cfacaa878a05971309d67ad2133c763c22057842. Signed-off-by: Jukka Rissanen --- drivers/serial/uart_nrfx_uarte.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/serial/uart_nrfx_uarte.c b/drivers/serial/uart_nrfx_uarte.c index 1c75f4432280..cd8aab9a4753 100644 --- a/drivers/serial/uart_nrfx_uarte.c +++ b/drivers/serial/uart_nrfx_uarte.c @@ -2490,11 +2490,6 @@ static int uarte_instance_init(const struct device *dev, ((struct pinctrl_dev_config *)cfg->pcfg)->reg = (uintptr_t)cfg->uarte_regs; } - /* Apply sleep state by default. - * If PM is disabled, the default state will be applied in pm_device_driver_init. - */ - (void)pinctrl_apply_state(cfg->pcfg, PINCTRL_STATE_SLEEP); - #ifdef CONFIG_UART_USE_RUNTIME_CONFIGURE err = uarte_nrfx_configure(dev, &((struct uarte_nrfx_data *)dev->data)->uart_config); if (err) { From 17f607d8c819c9458290fdfc3500ff4c3e75a219 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:52 +0300 Subject: [PATCH 1251/2141] Revert "[nrf fromtree] drivers: serial: nrfx_uarte: use ifdef instead of IS_ENABLED" This reverts commit 75441a0dfc0eba138ff390837cf4762a44968ab7. Signed-off-by: Jukka Rissanen --- drivers/serial/uart_nrfx_uarte.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/serial/uart_nrfx_uarte.c b/drivers/serial/uart_nrfx_uarte.c index cd8aab9a4753..46c5a8b83d2e 100644 --- a/drivers/serial/uart_nrfx_uarte.c +++ b/drivers/serial/uart_nrfx_uarte.c @@ -1611,11 +1611,11 @@ static void endrx_isr(const struct device *dev) } irq_unlock(key); -#ifdef UARTE_HAS_FRAME_TIMEOUT - if (start_timeout && !K_TIMEOUT_EQ(async_rx->timeout, K_NO_WAIT)) { - k_timer_start(&async_rx->timer, async_rx->timeout, K_NO_WAIT); + if (IS_ENABLED(UARTE_HAS_FRAME_TIMEOUT)) { + if (start_timeout && !K_TIMEOUT_EQ(async_rx->timeout, K_NO_WAIT)) { + k_timer_start(&async_rx->timer, async_rx->timeout, K_NO_WAIT); + } } -#endif } #if !defined(CONFIG_UART_NRFX_UARTE_ENHANCED_RX) From 9bf5a704f49801cc2b9d42cc0c04e6ce629df2d1 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:52 +0300 Subject: [PATCH 1252/2141] Revert "[nrf fromtree] tests: drivers: uart: uart_mix_fifo_poll: Cleanup after nRF54LM20 rename" This reverts commit 56d98e478ea766904b728c243e0999f500b6ed22. Signed-off-by: Jukka Rissanen --- .../nrf54l20pdk_nrf54l20_cpuapp.overlay | 43 +++++++++++++++++++ .../uart/uart_mix_fifo_poll/testcase.yaml | 9 ++-- 2 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 tests/drivers/uart/uart_mix_fifo_poll/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay diff --git a/tests/drivers/uart/uart_mix_fifo_poll/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/tests/drivers/uart/uart_mix_fifo_poll/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay new file mode 100644 index 000000000000..945b8628e7a6 --- /dev/null +++ b/tests/drivers/uart/uart_mix_fifo_poll/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + uart21_default: uart21_default { + group1 { + psels = , + , + , + ; + }; + }; + + uart21_sleep: uart21_sleep { + group1 { + psels = , + , + , + ; + low-power-enable; + }; + }; +}; + +dut: &uart21 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart21_default>; + pinctrl-1 = <&uart21_sleep>; + pinctrl-names = "default", "sleep"; + hw-flow-control; +}; + +counter_dev: &timer00 { + status = "okay"; +}; + +&grtc { + interrupts = <228 2>; +}; diff --git a/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml b/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml index fee2d1f46463..5a85af65735e 100644 --- a/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml +++ b/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml @@ -5,19 +5,20 @@ common: depends_on: gpio harness: ztest platform_allow: - - nrf52_bsim - nrf52840dk/nrf52840 - nrf9160dk/nrf9160 - nrf5340dk/nrf5340/cpuapp - nrf5340bsim/nrf5340/cpuapp - - nrf54h20dk/nrf54h20/cpuapp - - nrf54h20dk/nrf54h20/cpurad - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf54l15bsim/nrf54l15/cpuapp + - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - nrf54lm20bsim/nrf54lm20a/cpuapp + - nrf54l15bsim/nrf54l15/cpuapp + - nrf54h20dk/nrf54h20/cpuapp + - nrf54h20dk/nrf54h20/cpurad - ophelia4ev/nrf54l15/cpuapp + - nrf52_bsim integration_platforms: - nrf52840dk/nrf52840 harness_config: From 8ccc1434f5149080588c5a28498dc55b1bbcd640 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:52 +0300 Subject: [PATCH 1253/2141] Revert "[nrf fromtree] soc: Add SOC_COMPATIBLE_NRF54LM20* options" This reverts commit 8b197fdd0a5472489d603d8d3e53323d7977ed0a. Signed-off-by: Jukka Rissanen --- soc/Kconfig | 6 ------ 1 file changed, 6 deletions(-) diff --git a/soc/Kconfig b/soc/Kconfig index cf1bde8aa4d4..a1ea1f97896b 100644 --- a/soc/Kconfig +++ b/soc/Kconfig @@ -49,12 +49,6 @@ config SOC_COMPATIBLE_NRF54L15 config SOC_COMPATIBLE_NRF54L15_CPUAPP bool -config SOC_COMPATIBLE_NRF54LM20A - bool - -config SOC_COMPATIBLE_NRF54LM20A_CPUAPP - bool - config SOC_DEPRECATED_RELEASE string help From b2b0a1112ee49a3c32e1d286968473676a073775 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:52 +0300 Subject: [PATCH 1254/2141] Revert "[nrf fromtree] boards nrf_bsim: Add a new nrf54lm20bsim target" This reverts commit a8f8ee87de2906fccb6e9954b71c68908a9d0b29. Signed-off-by: Jukka Rissanen --- boards/native/nrf_bsim/Kconfig | 10 -- boards/native/nrf_bsim/Kconfig.nrf54lm20bsim | 5 - boards/native/nrf_bsim/board.yml | 5 - boards/native/nrf_bsim/board_soc.h | 2 +- .../nrf54lm20bsim_nrf54lm20a_cpuapp.dts | 144 ------------------ .../nrf54lm20bsim_nrf54lm20a_cpuapp.yaml | 17 --- .../nrf54lm20bsim_nrf54lm20a_cpuapp_defconfig | 8 - modules/hal_nordic/nrfx/CMakeLists.txt | 2 - 8 files changed, 1 insertion(+), 192 deletions(-) delete mode 100644 boards/native/nrf_bsim/Kconfig.nrf54lm20bsim delete mode 100644 boards/native/nrf_bsim/nrf54lm20bsim_nrf54lm20a_cpuapp.dts delete mode 100644 boards/native/nrf_bsim/nrf54lm20bsim_nrf54lm20a_cpuapp.yaml delete mode 100644 boards/native/nrf_bsim/nrf54lm20bsim_nrf54lm20a_cpuapp_defconfig diff --git a/boards/native/nrf_bsim/Kconfig b/boards/native/nrf_bsim/Kconfig index 3596ccec0240..a8865941d741 100644 --- a/boards/native/nrf_bsim/Kconfig +++ b/boards/native/nrf_bsim/Kconfig @@ -45,16 +45,6 @@ config BOARD_NRF54L15BSIM_NRF54L15_CPUAPP Will produce a console Linux process which can be executed natively. It needs the BabbleSim simulator both in compile time and to execute -config BOARD_NRF54LM20BSIM_NRF54LM20A_CPUAPP - bool - select SOC_SERIES_BSIM_NRF54LX - select SOC_COMPATIBLE_NRF54LM20A - select SOC_COMPATIBLE_NRF54LM20A_CPUAPP - select CLOCK_CONTROL - help - Simulated NRF54LM20 Application core - Will produce a console Linux process which can be executed natively. - It needs the BabbleSim simulator both in compile time and to execute if SOC_SERIES_BSIM_NRFXX diff --git a/boards/native/nrf_bsim/Kconfig.nrf54lm20bsim b/boards/native/nrf_bsim/Kconfig.nrf54lm20bsim deleted file mode 100644 index f5d8f6400971..000000000000 --- a/boards/native/nrf_bsim/Kconfig.nrf54lm20bsim +++ /dev/null @@ -1,5 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -config BOARD_NRF54LM20BSIM - select SOC_POSIX diff --git a/boards/native/nrf_bsim/board.yml b/boards/native/nrf_bsim/board.yml index 0a94a177d500..0ba40b336773 100644 --- a/boards/native/nrf_bsim/board.yml +++ b/boards/native/nrf_bsim/board.yml @@ -14,10 +14,5 @@ boards: vendor: zephyr socs: - name: nrf54l15 -- name: nrf54lm20bsim - full_name: nRF54LM20 simulated boards (BabbleSim) - vendor: zephyr - socs: - - name: nrf54lm20a # Note the 53 and 54 are referring to the real SOC yamls, but we only use their name and cpu-cluster # definitions. In practice these board uses the same native SOC (SOC_POSIX) as the nrf52_bsim diff --git a/boards/native/nrf_bsim/board_soc.h b/boards/native/nrf_bsim/board_soc.h index ee77478caabb..e0b1cb60a594 100644 --- a/boards/native/nrf_bsim/board_soc.h +++ b/boards/native/nrf_bsim/board_soc.h @@ -38,7 +38,7 @@ #define OFFLOAD_SW_IRQ EGU0_IRQn #elif defined(CONFIG_BOARD_NRF5340BSIM_NRF5340_CPUNET) #define OFFLOAD_SW_IRQ SWI0_IRQn -#elif defined(CONFIG_SOC_SERIES_BSIM_NRF54LX) +#elif defined(CONFIG_BOARD_NRF54L15BSIM) #define OFFLOAD_SW_IRQ SWI00_IRQn #endif diff --git a/boards/native/nrf_bsim/nrf54lm20bsim_nrf54lm20a_cpuapp.dts b/boards/native/nrf_bsim/nrf54lm20bsim_nrf54lm20a_cpuapp.dts deleted file mode 100644 index bd424f2e15ec..000000000000 --- a/boards/native/nrf_bsim/nrf54lm20bsim_nrf54lm20a_cpuapp.dts +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/dts-v1/; - -#include -#include -#include <../boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a-pinctrl.dtsi> - -/ { - model = "Nordic NRF54LM20 BSIM NRF54LM20A Application MCU"; - compatible = "bsim,nrf54lm20-bsim-nrf54lm20a-cpuapp", "bsim,nrf54"; - - chosen { - zephyr,console = &uart20; - zephyr,entropy = &rng; - zephyr,bt-c2h-uart = &uart20; - zephyr,flash-controller = &rram_controller; - zephyr,flash = &cpuapp_rram; - }; - - /delete-node/ cpus; - /delete-node/ sw-pwm; - - soc { - /delete-node/ memory@20000000; - /delete-node/ memory@20067c00; - - peripheral@50000000 { - /delete-node/ vpr@4c000; - /delete-node/ interrupt-controller@f0000000; - /delete-node/spi@4d000; - /delete-node/usbhs@5a000; - /delete-node/i2c@c6000; - /delete-node/spi@c6000; - /delete-node/i2c@c7000; - /delete-node/spi@c7000; - /delete-node/i2c@c8000; - /delete-node/spi@c8000; - /delete-node/pdm@d0000; - /delete-node/pdm@d1000; - /delete-node/pwm@d2000; - /delete-node/pwm@d3000; - /delete-node/pwm@d4000; - /delete-node/adc@d5000; - /delete-node/nfct@d6000; - /delete-node/qdec@e0000; - /delete-node/qdec@e1000; - /delete-node/tdm@e8000; - /delete-node/i2c@ed000; - /delete-node/spi@ed000; - /delete-node/i2c@ee000; - /delete-node/spi@ee000; - /delete-node/i2c@104000; - /delete-node/spi@104000; - /delete-node/comparator@106000; - /delete-node/watchdog@108000; - /delete-node/watchdog@109000; - /delete-node/regulator@120000; - }; - }; - - rng: rng { - status = "okay"; - compatible = "nordic,nrf-cracen-ctrdrbg"; - }; - - psa_rng: psa-rng { - status = "disabled"; - }; -}; - -&grtc { - owned-channels = <0 1 2 3 4 5 6 7 8 9 10 11>; - /* Channels 7-11 reserved for Zero Latency IRQs, 3-4 for FLPR */ - child-owned-channels = <3 4 7 8 9 10 11>; - status = "okay"; -}; - -&cpuapp_rram { - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - storage_partition: partition@0 { - label = "storage"; - reg = <0x0 DT_SIZE_K(500)>; - }; - }; -}; - -&uart20 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart20_default>; - pinctrl-1 = <&uart20_sleep>; - pinctrl-names = "default", "sleep"; -}; - -&uart30 { - current-speed = <115200>; - pinctrl-0 = <&uart30_default>; - pinctrl-1 = <&uart30_sleep>; - pinctrl-names = "default", "sleep"; -}; - -&gpio0 { - status = "okay"; -}; - -&gpio1 { - status = "okay"; -}; - -&gpio2 { - status = "okay"; -}; - -&gpiote20 { - status = "okay"; -}; - -&gpiote30 { - status = "okay"; -}; - -&temp { - status = "okay"; -}; - -&radio { - status = "okay"; - /* These features are not yet supported by the RADIO model */ - /delete-property/ dfe-supported; - /delete-property/ cs-supported; -}; - -&clock { - status = "okay"; -}; diff --git a/boards/native/nrf_bsim/nrf54lm20bsim_nrf54lm20a_cpuapp.yaml b/boards/native/nrf_bsim/nrf54lm20bsim_nrf54lm20a_cpuapp.yaml deleted file mode 100644 index 7941cd317ee5..000000000000 --- a/boards/native/nrf_bsim/nrf54lm20bsim_nrf54lm20a_cpuapp.yaml +++ /dev/null @@ -1,17 +0,0 @@ -identifier: nrf54lm20bsim/nrf54lm20a/cpuapp -name: NRF54LM20 BabbleSim - Application Core target -type: native -arch: posix -simulation: - - name: native -env: - - BSIM_OUT_PATH -toolchain: - - zephyr -supported: - - counter - - gpio -testing: - ignore_tags: - - modem - - bsim_skip_CI diff --git a/boards/native/nrf_bsim/nrf54lm20bsim_nrf54lm20a_cpuapp_defconfig b/boards/native/nrf_bsim/nrf54lm20bsim_nrf54lm20a_cpuapp_defconfig deleted file mode 100644 index 0fde4e01b583..000000000000 --- a/boards/native/nrf_bsim/nrf54lm20bsim_nrf54lm20a_cpuapp_defconfig +++ /dev/null @@ -1,8 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 -# Copyright (c) 2023 Nordic Semiconductor ASA - -CONFIG_CONSOLE=y -CONFIG_NO_OPTIMIZATIONS=y - -# Start SYSCOUNTER on driver init -CONFIG_NRF_GRTC_START_SYSCOUNTER=y diff --git a/modules/hal_nordic/nrfx/CMakeLists.txt b/modules/hal_nordic/nrfx/CMakeLists.txt index d063046cfa86..35c46e235f25 100644 --- a/modules/hal_nordic/nrfx/CMakeLists.txt +++ b/modules/hal_nordic/nrfx/CMakeLists.txt @@ -66,8 +66,6 @@ zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54L20_ENGA_CPUFLPR NRF_FLPR) zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54LM20A_ENGA NRF54LM20A_ENGA_XXAA) zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54LM20A_ENGA_CPUAPP NRF_APPLICATION) zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54LM20A_ENGA_CPUFLPR NRF_FLPR) -zephyr_compile_definitions_ifdef(CONFIG_SOC_COMPATIBLE_NRF54LM20A NRF54LM20A_ENGA_XXAA) -zephyr_compile_definitions_ifdef(CONFIG_SOC_COMPATIBLE_NRF54LM20A_CPUAPP NRF_APPLICATION) zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF9120 NRF9120_XXAA) zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF9160 NRF9160_XXAA) From ef834d40800e17191ed346a1846ba93dbf4a7d51 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:52 +0300 Subject: [PATCH 1255/2141] Revert "[nrf fromtree] tests: drivers: uart: uart_pm: Cleanup after nRF54LM20 rename" This reverts commit 096eef02e4213cc668a08ba62670f393778f0c6d. Signed-off-by: Jukka Rissanen --- .../nrf54l20pdk_nrf54l20_cpuapp.overlay | 36 +++++++++++++++++++ tests/drivers/uart/uart_pm/testcase.yaml | 27 ++++++++------ 2 files changed, 52 insertions(+), 11 deletions(-) create mode 100644 tests/drivers/uart/uart_pm/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay diff --git a/tests/drivers/uart/uart_pm/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/tests/drivers/uart/uart_pm/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay new file mode 100644 index 000000000000..033aab401ac0 --- /dev/null +++ b/tests/drivers/uart/uart_pm/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + uart21_default: uart21_default { + group1 { + psels = , + ; + }; + }; + + uart21_sleep: uart21_sleep { + group1 { + psels = , + ; + low-power-enable; + }; + }; +}; + +/ { + chosen { + zephyr,console = &uart20; + }; +}; + +dut: &uart21 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart21_default>; + pinctrl-1 = <&uart21_sleep>; + pinctrl-names = "default", "sleep"; +}; diff --git a/tests/drivers/uart/uart_pm/testcase.yaml b/tests/drivers/uart/uart_pm/testcase.yaml index d775e30ae71d..767e56b45926 100644 --- a/tests/drivers/uart/uart_pm/testcase.yaml +++ b/tests/drivers/uart/uart_pm/testcase.yaml @@ -4,15 +4,16 @@ common: - uart harness: ztest platform_allow: - - nrf52_bsim - nrf52840dk/nrf52840 - - nrf5340bsim/nrf5340/cpuapp - - nrf54h20dk/nrf54h20/cpuapp - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf54l15bsim/nrf54l15/cpuapp + - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - nrf54lm20bsim/nrf54lm20a/cpuapp + - nrf54l15bsim/nrf54l15/cpuapp + - nrf54h20dk/nrf54h20/cpuapp + - nrf52_bsim + - nrf5340bsim/nrf5340/cpuapp - ophelia4ev/nrf54l15/cpuapp harness_config: fixture: gpio_loopback @@ -33,14 +34,15 @@ tests: - CONFIG_UART_0_ENHANCED_POLL_OUT=n extra_args: DTC_OVERLAY_FILE="boards/nrf52840dk_nrf52840.overlay;nrf_rx_disable.overlay" platform_exclude: - - nrf52_bsim - - nrf5340bsim/nrf5340/cpuapp - - nrf54h20dk/nrf54h20/cpuapp - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf54l15bsim/nrf54l15/cpuapp + - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - nrf54lm20bsim/nrf54lm20a/cpuapp + - nrf54l15bsim/nrf54l15/cpuapp + - nrf54h20dk/nrf54h20/cpuapp + - nrf52_bsim + - nrf5340bsim/nrf5340/cpuapp - ophelia4ev/nrf54l15/cpuapp drivers.uart.pm.enhanced_poll: @@ -49,10 +51,11 @@ tests: - CONFIG_UART_ASYNC_API=n - CONFIG_UART_0_ENHANCED_POLL_OUT=y platform_exclude: - - nrf54h20dk/nrf54h20/cpuapp - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp + - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp + - nrf54h20dk/nrf54h20/cpuapp - ophelia4ev/nrf54l15/cpuapp drivers.uart.pm.int_driven: @@ -69,10 +72,11 @@ tests: - CONFIG_UART_ASYNC_API=n - CONFIG_UART_0_ENHANCED_POLL_OUT=y platform_exclude: - - nrf54h20dk/nrf54h20/cpuapp - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp + - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp + - nrf54h20dk/nrf54h20/cpuapp - ophelia4ev/nrf54l15/cpuapp drivers.uart.pm.async: @@ -95,8 +99,9 @@ tests: - CONFIG_NRFX_TIMER2=y - CONFIG_UART_0_ENHANCED_POLL_OUT=y platform_exclude: - - nrf54h20dk/nrf54h20/cpuapp - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp + - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp + - nrf54h20dk/nrf54h20/cpuapp - ophelia4ev/nrf54l15/cpuapp From 4bfa017479d056c19e5373fe89c4326acdbf4a3d Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:52 +0300 Subject: [PATCH 1256/2141] Revert "[nrf fromtree] tests/drivers/uart/: Add overlays for the nrf54lm20bsim" This reverts commit aea9e183d4168ddf5994ab74759ba48b141621de. Signed-off-by: Jukka Rissanen --- .../boards/nrf54lm20bsim_nrf54lm20a_cpuapp.overlay | 3 --- .../boards/nrf54lm20bsim_nrf54lm20a_cpuapp.overlay | 7 ------- tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml | 1 - .../uart_pm/boards/nrf54lm20bsim_nrf54lm20a_cpuapp.overlay | 3 --- tests/drivers/uart/uart_pm/testcase.yaml | 2 -- 5 files changed, 16 deletions(-) delete mode 100644 tests/drivers/uart/uart_async_api/boards/nrf54lm20bsim_nrf54lm20a_cpuapp.overlay delete mode 100644 tests/drivers/uart/uart_mix_fifo_poll/boards/nrf54lm20bsim_nrf54lm20a_cpuapp.overlay delete mode 100644 tests/drivers/uart/uart_pm/boards/nrf54lm20bsim_nrf54lm20a_cpuapp.overlay diff --git a/tests/drivers/uart/uart_async_api/boards/nrf54lm20bsim_nrf54lm20a_cpuapp.overlay b/tests/drivers/uart/uart_async_api/boards/nrf54lm20bsim_nrf54lm20a_cpuapp.overlay deleted file mode 100644 index aef400ac2b1f..000000000000 --- a/tests/drivers/uart/uart_async_api/boards/nrf54lm20bsim_nrf54lm20a_cpuapp.overlay +++ /dev/null @@ -1,3 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - -#include "nrf54lm20dk_nrf54lm20a_cpuapp.overlay" diff --git a/tests/drivers/uart/uart_mix_fifo_poll/boards/nrf54lm20bsim_nrf54lm20a_cpuapp.overlay b/tests/drivers/uart/uart_mix_fifo_poll/boards/nrf54lm20bsim_nrf54lm20a_cpuapp.overlay deleted file mode 100644 index 8e7299a0d758..000000000000 --- a/tests/drivers/uart/uart_mix_fifo_poll/boards/nrf54lm20bsim_nrf54lm20a_cpuapp.overlay +++ /dev/null @@ -1,7 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include "nrf54lm20dk_nrf54lm20a_cpuapp.overlay" diff --git a/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml b/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml index 5a85af65735e..1ad54eb0dc5b 100644 --- a/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml +++ b/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml @@ -13,7 +13,6 @@ common: - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - - nrf54lm20bsim/nrf54lm20a/cpuapp - nrf54l15bsim/nrf54l15/cpuapp - nrf54h20dk/nrf54h20/cpuapp - nrf54h20dk/nrf54h20/cpurad diff --git a/tests/drivers/uart/uart_pm/boards/nrf54lm20bsim_nrf54lm20a_cpuapp.overlay b/tests/drivers/uart/uart_pm/boards/nrf54lm20bsim_nrf54lm20a_cpuapp.overlay deleted file mode 100644 index aef400ac2b1f..000000000000 --- a/tests/drivers/uart/uart_pm/boards/nrf54lm20bsim_nrf54lm20a_cpuapp.overlay +++ /dev/null @@ -1,3 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - -#include "nrf54lm20dk_nrf54lm20a_cpuapp.overlay" diff --git a/tests/drivers/uart/uart_pm/testcase.yaml b/tests/drivers/uart/uart_pm/testcase.yaml index 767e56b45926..8385db6bf866 100644 --- a/tests/drivers/uart/uart_pm/testcase.yaml +++ b/tests/drivers/uart/uart_pm/testcase.yaml @@ -9,7 +9,6 @@ common: - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - - nrf54lm20bsim/nrf54lm20a/cpuapp - nrf54l15bsim/nrf54l15/cpuapp - nrf54h20dk/nrf54h20/cpuapp - nrf52_bsim @@ -38,7 +37,6 @@ tests: - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - - nrf54lm20bsim/nrf54lm20a/cpuapp - nrf54l15bsim/nrf54l15/cpuapp - nrf54h20dk/nrf54h20/cpuapp - nrf52_bsim From 2468e4e816a961bd611c0517afd18b9b2eb27751 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:52 +0300 Subject: [PATCH 1257/2141] Revert "[nrf fromtree] Revert "drivers: serial: nrfx_uarte: Deprecate CONFIG_UART_x_NRF_HW_ASYNC"" This reverts commit b4f0e223669f1a0ea7dca1088254455fabe43e21. Signed-off-by: Jukka Rissanen --- drivers/serial/Kconfig.nrfx | 2 +- drivers/serial/Kconfig.nrfx_uart_instance | 7 ++++++- samples/net/cellular_modem/boards/nrf9160dk_nrf52840.conf | 3 --- .../net/cellular_modem/boards/nrf9160dk_nrf9160_ns.conf | 3 --- .../uart_async_api/boards/nrf5340bsim_nrf5340_cpuapp.conf | 2 -- .../uart_async_api/boards/nrf5340dk_nrf5340_cpuapp.conf | 2 -- .../uart/uart_async_api/boards/nrf9160dk_nrf9160.conf | 2 -- .../uart/uart_errors/boards/nrf5340dk_nrf5340_cpuapp.conf | 2 -- tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml | 3 --- tests/drivers/uart/uart_pm/testcase.yaml | 6 ------ 10 files changed, 7 insertions(+), 25 deletions(-) delete mode 100644 tests/drivers/uart/uart_async_api/boards/nrf5340bsim_nrf5340_cpuapp.conf delete mode 100644 tests/drivers/uart/uart_errors/boards/nrf5340dk_nrf5340_cpuapp.conf diff --git a/drivers/serial/Kconfig.nrfx b/drivers/serial/Kconfig.nrfx index 8bcb9e49b662..f91980c058b5 100644 --- a/drivers/serial/Kconfig.nrfx +++ b/drivers/serial/Kconfig.nrfx @@ -60,7 +60,7 @@ config UART_NRFX_UARTE_ENHANCED_RX bool "Enhanced RX handling" depends on UART_ASYNC_API depends on UART_NRFX_UARTE_LEGACY_SHIM - default y if !(UART_0_NRF_HW_ASYNC || UART_1_NRF_HW_ASYNC || UART_2_NRF_HW_ASYNC) + default y help Enable RX handling mode which is switching buffers on timeout. This is an enhancement compared to other two modes (default and hardware assisted). diff --git a/drivers/serial/Kconfig.nrfx_uart_instance b/drivers/serial/Kconfig.nrfx_uart_instance index b1a68d691c45..fa93a8144828 100644 --- a/drivers/serial/Kconfig.nrfx_uart_instance +++ b/drivers/serial/Kconfig.nrfx_uart_instance @@ -49,18 +49,23 @@ config UART_$(nrfx_uart_num)_NRF_TX_BUFFER_SIZE particular SoC. config UART_$(nrfx_uart_num)_NRF_HW_ASYNC - bool "Use hardware RX byte counting" + bool "[DEPRECATED] Use hardware RX byte counting" depends on HAS_HW_NRF_UARTE$(nrfx_uart_num) depends on UART_ASYNC_API depends on UART_NRFX_UARTE_LEGACY_SHIM + depends on !UART_NRFX_UARTE_ENHANCED_RX depends on HAS_HW_NRF_PPI || HAS_HW_NRF_DPPIC select NRFX_GPPI + select DEPRECATED help If default driver uses interrupts to count incoming bytes, it is possible that with higher speeds and/or high cpu load some data can be lost. It is recommended to use hardware byte counting in such scenarios. Hardware RX byte counting requires timer instance and one PPI channel. + This options is deprecated. Use UART_NRFX_UARTE_ENHANCED_RX which supports + reliable byte counting without additional HW resources (TIMER and (D)PPI). + config UART_$(nrfx_uart_num)_NRF_ASYNC_LOW_POWER bool "Low power mode" depends on HAS_HW_NRF_UARTE$(nrfx_uart_num) diff --git a/samples/net/cellular_modem/boards/nrf9160dk_nrf52840.conf b/samples/net/cellular_modem/boards/nrf9160dk_nrf52840.conf index 6cf67ab5f984..226ce728a19a 100644 --- a/samples/net/cellular_modem/boards/nrf9160dk_nrf52840.conf +++ b/samples/net/cellular_modem/boards/nrf9160dk_nrf52840.conf @@ -1,9 +1,6 @@ CONFIG_UART_ASYNC_API=y CONFIG_UART_1_ASYNC=y CONFIG_UART_1_INTERRUPT_DRIVEN=n -# Enable HW RX byte counting. This especially matters at higher baud rates. -CONFIG_UART_1_NRF_HW_ASYNC=y -CONFIG_UART_1_NRF_HW_ASYNC_TIMER=1 # Align with the Serial LTE Modem (SLM) application. CONFIG_MODEM_CELLULAR_UART_BUFFER_SIZES=6000 diff --git a/samples/net/cellular_modem/boards/nrf9160dk_nrf9160_ns.conf b/samples/net/cellular_modem/boards/nrf9160dk_nrf9160_ns.conf index a3cfb7919db5..907cc9baed1f 100644 --- a/samples/net/cellular_modem/boards/nrf9160dk_nrf9160_ns.conf +++ b/samples/net/cellular_modem/boards/nrf9160dk_nrf9160_ns.conf @@ -1,9 +1,6 @@ CONFIG_UART_ASYNC_API=y CONFIG_UART_1_ASYNC=y CONFIG_UART_1_INTERRUPT_DRIVEN=n -# Enable HW RX byte counting. This especially matters at higher baud rates. -CONFIG_UART_1_NRF_HW_ASYNC=y -CONFIG_UART_1_NRF_HW_ASYNC_TIMER=1 # Align with the Serial LTE Modem (SLM) application. CONFIG_MODEM_CELLULAR_UART_BUFFER_SIZES=6000 diff --git a/tests/drivers/uart/uart_async_api/boards/nrf5340bsim_nrf5340_cpuapp.conf b/tests/drivers/uart/uart_async_api/boards/nrf5340bsim_nrf5340_cpuapp.conf deleted file mode 100644 index e7a460fde6bb..000000000000 --- a/tests/drivers/uart/uart_async_api/boards/nrf5340bsim_nrf5340_cpuapp.conf +++ /dev/null @@ -1,2 +0,0 @@ -CONFIG_UART_1_NRF_HW_ASYNC_TIMER=1 -CONFIG_UART_NRFX_UARTE_ENHANCED_RX=y diff --git a/tests/drivers/uart/uart_async_api/boards/nrf5340dk_nrf5340_cpuapp.conf b/tests/drivers/uart/uart_async_api/boards/nrf5340dk_nrf5340_cpuapp.conf index 396d23ba5ae3..d70069646c93 100644 --- a/tests/drivers/uart/uart_async_api/boards/nrf5340dk_nrf5340_cpuapp.conf +++ b/tests/drivers/uart/uart_async_api/boards/nrf5340dk_nrf5340_cpuapp.conf @@ -1,3 +1 @@ -CONFIG_UART_1_NRF_HW_ASYNC=y -CONFIG_UART_1_NRF_HW_ASYNC_TIMER=1 CONFIG_VAR_LENGTH_BUFFER_TEST_BUADRATE_LIMIT=57600 diff --git a/tests/drivers/uart/uart_async_api/boards/nrf9160dk_nrf9160.conf b/tests/drivers/uart/uart_async_api/boards/nrf9160dk_nrf9160.conf index 4f738f955e10..83e126780f99 100644 --- a/tests/drivers/uart/uart_async_api/boards/nrf9160dk_nrf9160.conf +++ b/tests/drivers/uart/uart_async_api/boards/nrf9160dk_nrf9160.conf @@ -1,4 +1,2 @@ CONFIG_ARM_MPU=n CONFIG_VAR_LENGTH_BUFFER_TEST_BUADRATE_LIMIT=57600 -CONFIG_UART_1_NRF_HW_ASYNC=y -CONFIG_UART_1_NRF_HW_ASYNC_TIMER=2 diff --git a/tests/drivers/uart/uart_errors/boards/nrf5340dk_nrf5340_cpuapp.conf b/tests/drivers/uart/uart_errors/boards/nrf5340dk_nrf5340_cpuapp.conf deleted file mode 100644 index 025b92361475..000000000000 --- a/tests/drivers/uart/uart_errors/boards/nrf5340dk_nrf5340_cpuapp.conf +++ /dev/null @@ -1,2 +0,0 @@ -CONFIG_UART_1_NRF_HW_ASYNC=y -CONFIG_UART_1_NRF_HW_ASYNC_TIMER=1 diff --git a/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml b/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml index 1ad54eb0dc5b..a901abda9e43 100644 --- a/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml +++ b/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml @@ -78,9 +78,6 @@ tests: - CONFIG_UART_0_INTERRUPT_DRIVEN=n - CONFIG_UART_0_ASYNC=y - CONFIG_UART_0_ENHANCED_POLL_OUT=y - - CONFIG_UART_0_NRF_HW_ASYNC=y - - CONFIG_UART_0_NRF_HW_ASYNC_TIMER=2 - - CONFIG_NRFX_TIMER2=y platform_allow: - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp diff --git a/tests/drivers/uart/uart_pm/testcase.yaml b/tests/drivers/uart/uart_pm/testcase.yaml index 8385db6bf866..9bb360677577 100644 --- a/tests/drivers/uart/uart_pm/testcase.yaml +++ b/tests/drivers/uart/uart_pm/testcase.yaml @@ -82,9 +82,6 @@ tests: - CONFIG_UART_INTERRUPT_DRIVEN=n - CONFIG_UART_ASYNC_API=y - CONFIG_UART_0_ASYNC=y - - CONFIG_UART_0_NRF_HW_ASYNC=y - - CONFIG_UART_0_NRF_HW_ASYNC_TIMER=2 - - CONFIG_NRFX_TIMER2=y - CONFIG_UART_0_ENHANCED_POLL_OUT=n drivers.uart.pm.async.enhanced_poll: @@ -92,9 +89,6 @@ tests: - CONFIG_UART_INTERRUPT_DRIVEN=n - CONFIG_UART_ASYNC_API=y - CONFIG_UART_0_ASYNC=y - - CONFIG_UART_0_NRF_HW_ASYNC=y - - CONFIG_UART_0_NRF_HW_ASYNC_TIMER=2 - - CONFIG_NRFX_TIMER2=y - CONFIG_UART_0_ENHANCED_POLL_OUT=y platform_exclude: - nrf54l09pdk/nrf54l09/cpuapp From 29a31aeb120e934039e22613e2bd69e5648d7d8c Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:52 +0300 Subject: [PATCH 1258/2141] Revert "[nrf fromlist] drivers: wifi: Pass the connection type" This reverts commit 7a76eef93b6f5222a92fa820c39f7099465c0f05. Signed-off-by: Jukka Rissanen --- drivers/wifi/nrf_wifi/src/wpa_supp_if.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/wifi/nrf_wifi/src/wpa_supp_if.c b/drivers/wifi/nrf_wifi/src/wpa_supp_if.c index 22aa04165507..d06f0792fa28 100644 --- a/drivers/wifi/nrf_wifi/src/wpa_supp_if.c +++ b/drivers/wifi/nrf_wifi/src/wpa_supp_if.c @@ -935,11 +935,6 @@ int nrf_wifi_wpa_supp_associate(void *if_priv, struct wpa_driver_associate_param assoc_info.bss_max_idle_time = params->bss_max_idle_period; } - assoc_info.conn_type = NRF_WIFI_CONN_TYPE_OPEN; - if (!(params->key_mgmt_suite & WPA_KEY_MGMT_NONE)) { - assoc_info.conn_type = NRF_WIFI_CONN_TYPE_SECURE; - } - status = nrf_wifi_sys_fmac_assoc(rpu_ctx_zep->rpu_ctx, vif_ctx_zep->vif_idx, &assoc_info); if (status != NRF_WIFI_STATUS_SUCCESS) { From e08a035ccced84b1bde4375613291da5277dc27a Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:52 +0300 Subject: [PATCH 1259/2141] Revert "[nrf fromlist] net: l2: wifi: Refactor certificates processing code into common file" This reverts commit b1410c56652b1ab9182a3529ebc8b1add1d4a741. Signed-off-by: Jukka Rissanen --- include/zephyr/net/wifi_certs.h | 38 -- modules/hostap/Kconfig | 2 - subsys/net/l2/wifi/CMakeLists.txt | 1 - subsys/net/l2/wifi/Kconfig | 5 - subsys/net/l2/wifi/wifi_certs.c | 366 ------------------ subsys/net/l2/wifi/wifi_shell.c | 292 +++++++++++++- .../wifi_credentials/wifi_credentials_shell.c | 246 +++++++++++- 7 files changed, 525 insertions(+), 425 deletions(-) delete mode 100644 include/zephyr/net/wifi_certs.h delete mode 100644 subsys/net/l2/wifi/wifi_certs.c diff --git a/include/zephyr/net/wifi_certs.h b/include/zephyr/net/wifi_certs.h deleted file mode 100644 index ea9e02cf104c..000000000000 --- a/include/zephyr/net/wifi_certs.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef WIFI_CERTS_H__ -#define WIFI_CERTS_H__ - -#include -#include -#include - -/** - * Set Wi-Fi Enterprise credentials. - * - * Sets up the required credentials for Enterprise mode in both - * Access Point and Station modes. - * - * Certificates typically used: - * - CA certificate - * - Client certificate - * - Client private key - * - Server certificate and server key (for AP mode) - * - * @param iface Network interface - * @param is_ap AP or Station mode - * - * @return 0 if ok, < 0 if error - */ -int wifi_set_enterprise_credentials(struct net_if *iface, bool is_ap); - -/** - * Clear Wi-Fi enterprise credentials - */ -void wifi_clear_enterprise_credentials(void); - -#endif /* WIFI_CERTS_H__ */ diff --git a/modules/hostap/Kconfig b/modules/hostap/Kconfig index 8e5f7d348a8a..f900fea0e85e 100644 --- a/modules/hostap/Kconfig +++ b/modules/hostap/Kconfig @@ -221,7 +221,6 @@ config WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE select MBEDTLS_X509_CRL_PARSE_C select MBEDTLS_TLS_VERSION_1_2 select NOT_SECURE - select WIFI_CERTIFICATE_LIB depends on !WIFI_NM_WPA_SUPPLICANT_CRYPTO_NONE help Enable Enterprise Crypto support for WiFi. This feature @@ -330,7 +329,6 @@ config WIFI_NM_HOSTAPD_AP config WIFI_NM_HOSTAPD_CRYPTO_ENTERPRISE bool "Hostapd crypto enterprise support" - select WIFI_CERTIFICATE_LIB depends on WIFI_NM_HOSTAPD_AP if WIFI_NM_HOSTAPD_CRYPTO_ENTERPRISE diff --git a/subsys/net/l2/wifi/CMakeLists.txt b/subsys/net/l2/wifi/CMakeLists.txt index 63fb98fa6cf3..e1e9606bfd2a 100644 --- a/subsys/net/l2/wifi/CMakeLists.txt +++ b/subsys/net/l2/wifi/CMakeLists.txt @@ -13,7 +13,6 @@ zephyr_library_include_directories_ifdef( ) zephyr_library_sources_ifdef(CONFIG_NET_L2_WIFI_MGMT wifi_mgmt.c) -zephyr_library_sources_ifdef(CONFIG_WIFI_CERTIFICATE_LIB wifi_certs.c) zephyr_library_sources_ifdef(CONFIG_NET_L2_WIFI_SHELL wifi_shell.c) zephyr_library_sources_ifdef(CONFIG_WIFI_NM wifi_nm.c) zephyr_library_sources_ifdef(CONFIG_NET_L2_WIFI_UTILS wifi_utils.c) diff --git a/subsys/net/l2/wifi/Kconfig b/subsys/net/l2/wifi/Kconfig index 4b1d309066c3..a2e029a592be 100644 --- a/subsys/net/l2/wifi/Kconfig +++ b/subsys/net/l2/wifi/Kconfig @@ -126,11 +126,6 @@ config WIFI_ENT_IDENTITY_MAX_USERS help This option defines the maximum number of identity users allowed connection. -config WIFI_CERTIFICATE_LIB - bool - help - Enable this option to process certificates in enterprise mode. - if WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE config WIFI_SHELL_RUNTIME_CERTIFICATES diff --git a/subsys/net/l2/wifi/wifi_certs.c b/subsys/net/l2/wifi/wifi_certs.c deleted file mode 100644 index 545010cbf77a..000000000000 --- a/subsys/net/l2/wifi/wifi_certs.c +++ /dev/null @@ -1,366 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -LOG_MODULE_REGISTER(net_wifi_certs, CONFIG_NET_L2_WIFI_MGMT_LOG_LEVEL); - -#include -#include -#include -#include -#include -#include - -static struct wifi_enterprise_creds_params enterprise_creds_params = { 0 }; - -#ifdef CONFIG_WIFI_SHELL_RUNTIME_CERTIFICATES -#include -enum wifi_enterprise_cert_sec_tags { - WIFI_CERT_CA_SEC_TAG = 0x1020001, - WIFI_CERT_CLIENT_KEY_SEC_TAG, - WIFI_CERT_SERVER_KEY_SEC_TAG, - WIFI_CERT_CLIENT_SEC_TAG, - WIFI_CERT_SERVER_SEC_TAG, - /* Phase 2 */ - WIFI_CERT_CA_P2_SEC_TAG, - WIFI_CERT_CLIENT_KEY_P2_SEC_TAG, - WIFI_CERT_CLIENT_P2_SEC_TAG, -}; - -struct wifi_cert_data { - enum tls_credential_type type; - uint32_t sec_tag; - uint8_t **data; - size_t *len; -}; -#else -static const char ca_cert_test[] = { - #include - '\0' -}; - -static const char client_cert_test[] = { - #include - '\0' -}; - -static const char client_key_test[] = { - #include - '\0' -}; - -static const char ca_cert2_test[] = { - #include - '\0'}; - -static const char client_cert2_test[] = { - #include - '\0'}; - -static const char client_key2_test[] = { - #include - '\0'}; - -static const char server_cert_test[] = { - #include - '\0' -}; - -static const char server_key_test[] = { - #include - '\0' -}; -#endif /* CONFIG_WIFI_SHELL_RUNTIME_CERTIFICATES */ - -#ifdef CONFIG_WIFI_SHELL_RUNTIME_CERTIFICATES -static int process_certificates(struct wifi_cert_data *certs, size_t cert_count) -{ - for (size_t i = 0; i < cert_count; i++) { - int err; - size_t len = 0; - uint8_t *cert_tmp; - - err = tls_credential_get(certs[i].sec_tag, certs[i].type, NULL, &len); - if (err != -EFBIG) { - LOG_ERR("Failed to get credential tag: %d length, err: %d", - certs[i].sec_tag, err); - return err; - } - - cert_tmp = k_malloc(len); - if (!cert_tmp) { - LOG_ERR("Failed to allocate memory for credential tag: %d", - certs[i].sec_tag); - return -ENOMEM; - } - - err = tls_credential_get(certs[i].sec_tag, certs[i].type, cert_tmp, &len); - if (err) { - LOG_ERR("Failed to get credential tag: %d", certs[i].sec_tag); - k_free(cert_tmp); - return err; - } - - *certs[i].data = cert_tmp; - *certs[i].len = len; - } - - return 0; -} - -static void set_enterprise_creds_params(bool is_ap) -{ - struct wifi_cert_data certs_common[] = { - { - .type = TLS_CREDENTIAL_CA_CERTIFICATE, - .sec_tag = WIFI_CERT_CA_SEC_TAG, - .data = &enterprise_creds_params.ca_cert, - .len = &enterprise_creds_params.ca_cert_len, - }, - }; - struct wifi_cert_data certs_sta[] = { - { - .type = TLS_CREDENTIAL_PRIVATE_KEY, - .sec_tag = WIFI_CERT_CLIENT_KEY_SEC_TAG, - .data = &enterprise_creds_params.client_key, - .len = &enterprise_creds_params.client_key_len, - }, - { - .type = TLS_CREDENTIAL_PUBLIC_CERTIFICATE, - .sec_tag = WIFI_CERT_CLIENT_SEC_TAG, - .data = &enterprise_creds_params.client_cert, - .len = &enterprise_creds_params.client_cert_len, - }, - { - .type = TLS_CREDENTIAL_CA_CERTIFICATE, - .sec_tag = WIFI_CERT_CA_P2_SEC_TAG, - .data = &enterprise_creds_params.ca_cert2, - .len = &enterprise_creds_params.ca_cert2_len, - }, - { - .type = TLS_CREDENTIAL_PRIVATE_KEY, - .sec_tag = WIFI_CERT_CLIENT_KEY_P2_SEC_TAG, - .data = &enterprise_creds_params.client_key2, - .len = &enterprise_creds_params.client_key2_len, - }, - { - .type = TLS_CREDENTIAL_PUBLIC_CERTIFICATE, - .sec_tag = WIFI_CERT_CLIENT_P2_SEC_TAG, - .data = &enterprise_creds_params.client_cert2, - .len = &enterprise_creds_params.client_cert2_len, - }, - }; - - struct wifi_cert_data certs_ap[] = { - { - .type = TLS_CREDENTIAL_PUBLIC_CERTIFICATE, - .sec_tag = WIFI_CERT_SERVER_SEC_TAG, - .data = &enterprise_creds_params.server_cert, - .len = &enterprise_creds_params.server_cert_len, - }, - { - .type = TLS_CREDENTIAL_PRIVATE_KEY, - .sec_tag = WIFI_CERT_SERVER_KEY_SEC_TAG, - .data = &enterprise_creds_params.server_key, - .len = &enterprise_creds_params.server_key_len, - }, - }; - - memset(&enterprise_creds_params, 0, sizeof(struct wifi_enterprise_creds_params)); - - /* Process common certificates */ - if (process_certificates(certs_common, ARRAY_SIZE(certs_common)) != 0) { - goto cleanup; - } - - /* Process STA-specific certificates */ - if (!is_ap) { - if (process_certificates(certs_sta, ARRAY_SIZE(certs_sta)) != 0) { - goto cleanup; - } - } - - /* Process AP-specific certificates if is_ap is true */ - if (is_ap) { - if (process_certificates(certs_ap, ARRAY_SIZE(certs_ap)) != 0) { - goto cleanup; - } - } - - return; - -cleanup: - for (size_t i = 0; i < ARRAY_SIZE(certs_common); i++) { - if (certs_common[i].data) { - k_free(*certs_common[i].data); - } - } - - if (!is_ap) { - for (size_t i = 0; i < ARRAY_SIZE(certs_sta); i++) { - if (certs_sta[i].data) { - k_free(*certs_sta[i].data); - } - } - } - - if (is_ap) { - for (size_t i = 0; i < ARRAY_SIZE(certs_ap); i++) { - if (certs_ap[i].data) { - k_free(*certs_ap[i].data); - } - } - } -} - -void wifi_clear_enterprise_credentials(void) -{ - size_t i; - - const uint8_t *certs[] = { - enterprise_creds_params.ca_cert, - enterprise_creds_params.client_cert, - enterprise_creds_params.client_key, - enterprise_creds_params.server_cert, - enterprise_creds_params.server_key, - enterprise_creds_params.ca_cert2, - enterprise_creds_params.client_cert2, - enterprise_creds_params.client_key2, - }; - - for (i = 0; i < ARRAY_SIZE(certs); i++) { - k_free((void *)certs[i]); - } - memset(&enterprise_creds_params, 0, sizeof(struct wifi_enterprise_creds_params)); -} -#else -int config_process_blob(struct wpa_config *config, char *name, uint8_t *data, - uint32_t data_len) -{ - struct wpa_config_blob *blob; - - if (!data || !data_len) { - return -1; - } - - blob = os_zalloc(sizeof(*blob)); - if (blob == NULL) { - return -1; - } - - blob->data = os_zalloc(data_len); - if (blob->data == NULL) { - os_free(blob); - return -1; - } - - blob->name = os_strdup(name); - - if (blob->name == NULL) { - wpa_config_free_blob(blob); - return -1; - } - - os_memcpy(blob->data, data, data_len); - blob->len = data_len; - - wpa_config_set_blob(config, blob); - - return 0; -} - -int process_certificates(void) -{ - struct wpa_supplicant *wpa_s; - int ret; - char if_name[CONFIG_NET_INTERFACE_NAME_LEN + 1]; - struct net_if *iface = net_if_get_wifi_sta(); - - ret = net_if_get_name(iface, if_name, sizeof(if_name)); - if (!ret) { - LOG_ERR("Cannot get interface name (%d)", ret); - return -1; - } - - wpa_s = zephyr_get_handle_by_ifname(if_name); - if (!wpa_s) { - LOG_ERR("Unable to find the interface: %s, quitting", if_name); - return -1; - } - - wifi_set_enterprise_credentials(iface, 0); - - if (config_process_blob(wpa_s->conf, "ca_cert", - enterprise_creds_params.ca_cert, - enterprise_creds_params.ca_cert_len)) { - return -1; - } - - if (config_process_blob(wpa_s->conf, "client_cert", - enterprise_creds_params.client_cert, - enterprise_creds_params.client_cert_len)) { - return -1; - } - - if (config_process_blob(wpa_s->conf, "private_key", - enterprise_creds_params.client_key, - enterprise_creds_params.client_key_len)) { - return -1; - } - - return 0; -} - -static void set_enterprise_creds_params(bool is_ap) -{ - enterprise_creds_params.ca_cert = (uint8_t *)ca_cert_test; - enterprise_creds_params.ca_cert_len = ARRAY_SIZE(ca_cert_test); - - if (!is_ap) { - enterprise_creds_params.client_cert = (uint8_t *)client_cert_test; - enterprise_creds_params.client_cert_len = ARRAY_SIZE(client_cert_test); - enterprise_creds_params.client_key = (uint8_t *)client_key_test; - enterprise_creds_params.client_key_len = ARRAY_SIZE(client_key_test); - enterprise_creds_params.ca_cert2 = (uint8_t *)ca_cert2_test; - enterprise_creds_params.ca_cert2_len = ARRAY_SIZE(ca_cert2_test); - enterprise_creds_params.client_cert2 = (uint8_t *)client_cert2_test; - enterprise_creds_params.client_cert2_len = ARRAY_SIZE(client_cert2_test); - enterprise_creds_params.client_key2 = (uint8_t *)client_key2_test; - enterprise_creds_params.client_key2_len = ARRAY_SIZE(client_key2_test); - - return; - } - - enterprise_creds_params.server_cert = (uint8_t *)server_cert_test; - enterprise_creds_params.server_cert_len = ARRAY_SIZE(server_cert_test); - enterprise_creds_params.server_key = (uint8_t *)server_key_test; - enterprise_creds_params.server_key_len = ARRAY_SIZE(server_key_test); -} - -void wifi_clear_enterprise_credentials(void) -{ - /** - * No operation needed because Wi-Fi credentials - * are statically configured at build time and - * no dynamic memory needs to be freed. - */ -} -#endif /* CONFIG_WIFI_SHELL_RUNTIME_CERTIFICATES */ - -int wifi_set_enterprise_credentials(struct net_if *iface, bool is_ap) -{ -#ifdef CONFIG_WIFI_SHELL_RUNTIME_CERTIFICATES - wifi_clear_enterprise_credentials(); -#endif /* CONFIG_WIFI_SHELL_RUNTIME_CERTIFICATES */ - set_enterprise_creds_params(is_ap); - if (net_mgmt(NET_REQUEST_WIFI_ENTERPRISE_CREDS, iface, - &enterprise_creds_params, sizeof(enterprise_creds_params))) { - LOG_WRN("Set enterprise credentials failed\n"); - return -1; - } - - return 0; -} diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 07514b53a336..346b68e1dae7 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -30,10 +30,67 @@ LOG_MODULE_REGISTER(net_wifi_shell, LOG_LEVEL_INF); #include "net_shell_private.h" #include +#if defined CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE || \ + defined CONFIG_WIFI_NM_HOSTAPD_CRYPTO_ENTERPRISE +#ifdef CONFIG_WIFI_SHELL_RUNTIME_CERTIFICATES +#include +enum wifi_enterprise_cert_sec_tags { + WIFI_CERT_CA_SEC_TAG = 0x1020001, + WIFI_CERT_CLIENT_KEY_SEC_TAG, + WIFI_CERT_SERVER_KEY_SEC_TAG, + WIFI_CERT_CLIENT_SEC_TAG, + WIFI_CERT_SERVER_SEC_TAG, + /* Phase 2 */ + WIFI_CERT_CA_P2_SEC_TAG, + WIFI_CERT_CLIENT_KEY_P2_SEC_TAG, + WIFI_CERT_CLIENT_P2_SEC_TAG, +}; -#ifdef CONFIG_WIFI_CERTIFICATE_LIB -#include -#endif +struct wifi_cert_data { + enum tls_credential_type type; + uint32_t sec_tag; + uint8_t **data; + size_t *len; +}; +#else +static const char ca_cert_test[] = { + #include + '\0' +}; + +static const char client_cert_test[] = { + #include + '\0' +}; + +static const char client_key_test[] = { + #include + '\0' +}; + +static const char ca_cert2_test[] = { + #include + '\0'}; + +static const char client_cert2_test[] = { + #include + '\0'}; + +static const char client_key2_test[] = { + #include + '\0'}; + +static const char server_cert_test[] = { + #include + '\0' +}; + +static const char server_key_test[] = { + #include + '\0' +}; +#endif /* CONFIG_WIFI_SHELL_RUNTIME_CERTIFICATES */ +#endif /* CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE */ #define WIFI_SHELL_MODULE "wifi" @@ -71,6 +128,12 @@ static struct { }; uint8_t all; }; +#if defined CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE || \ + defined CONFIG_WIFI_NM_HOSTAPD_CRYPTO_ENTERPRISE +#ifdef CONFIG_WIFI_SHELL_RUNTIME_CERTIFICATES + struct wifi_enterprise_creds_params enterprise_creds_params; +#endif /* CONFIG_WIFI_SHELL_RUNTIME_CERTIFICATES */ +#endif /* CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE */ } context; static struct net_mgmt_event_callback wifi_shell_mgmt_cb; @@ -138,6 +201,223 @@ static struct net_if *get_iface(enum iface_type type, int argc, char *argv[]) return iface; } +#if defined CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE || \ + defined CONFIG_WIFI_NM_HOSTAPD_CRYPTO_ENTERPRISE +#ifdef CONFIG_WIFI_SHELL_RUNTIME_CERTIFICATES +static int process_certificates(struct wifi_cert_data *certs, size_t cert_count) +{ + for (size_t i = 0; i < cert_count; i++) { + int err; + size_t len = 0; + uint8_t *cert_tmp; + + err = tls_credential_get(certs[i].sec_tag, certs[i].type, NULL, &len); + if (err != -EFBIG) { + LOG_ERR("Failed to get credential tag: %d length, err: %d", + certs[i].sec_tag, err); + return err; + } + + cert_tmp = k_malloc(len); + if (!cert_tmp) { + LOG_ERR("Failed to allocate memory for credential tag: %d", + certs[i].sec_tag); + return -ENOMEM; + } + + err = tls_credential_get(certs[i].sec_tag, certs[i].type, cert_tmp, &len); + if (err) { + LOG_ERR("Failed to get credential tag: %d", certs[i].sec_tag); + k_free(cert_tmp); + return err; + } + + *certs[i].data = cert_tmp; + *certs[i].len = len; + } + + return 0; +} + +static void set_enterprise_creds_params(struct wifi_enterprise_creds_params *params, + bool is_ap) +{ + struct wifi_cert_data certs_common[] = { + { + .type = TLS_CREDENTIAL_CA_CERTIFICATE, + .sec_tag = WIFI_CERT_CA_SEC_TAG, + .data = ¶ms->ca_cert, + .len = ¶ms->ca_cert_len, + }, + }; + + struct wifi_cert_data certs_sta[] = { + { + .type = TLS_CREDENTIAL_PRIVATE_KEY, + .sec_tag = WIFI_CERT_CLIENT_KEY_SEC_TAG, + .data = ¶ms->client_key, + .len = ¶ms->client_key_len, + }, + { + .type = TLS_CREDENTIAL_PUBLIC_CERTIFICATE, + .sec_tag = WIFI_CERT_CLIENT_SEC_TAG, + .data = ¶ms->client_cert, + .len = ¶ms->client_cert_len, + }, + { + .type = TLS_CREDENTIAL_CA_CERTIFICATE, + .sec_tag = WIFI_CERT_CA_P2_SEC_TAG, + .data = ¶ms->ca_cert2, + .len = ¶ms->ca_cert2_len, + }, + { + .type = TLS_CREDENTIAL_PRIVATE_KEY, + .sec_tag = WIFI_CERT_CLIENT_KEY_P2_SEC_TAG, + .data = ¶ms->client_key2, + .len = ¶ms->client_key2_len, + }, + { + .type = TLS_CREDENTIAL_PUBLIC_CERTIFICATE, + .sec_tag = WIFI_CERT_CLIENT_P2_SEC_TAG, + .data = ¶ms->client_cert2, + .len = ¶ms->client_cert2_len, + }, + }; + + struct wifi_cert_data certs_ap[] = { + { + .type = TLS_CREDENTIAL_PUBLIC_CERTIFICATE, + .sec_tag = WIFI_CERT_SERVER_SEC_TAG, + .data = ¶ms->server_cert, + .len = ¶ms->server_cert_len, + }, + { + .type = TLS_CREDENTIAL_PRIVATE_KEY, + .sec_tag = WIFI_CERT_SERVER_KEY_SEC_TAG, + .data = ¶ms->server_key, + .len = ¶ms->server_key_len, + }, + }; + + memset(params, 0, sizeof(*params)); + + /* Process common certificates */ + if (process_certificates(certs_common, ARRAY_SIZE(certs_common)) != 0) { + goto cleanup; + } + + /* Process STA-specific certificates */ + if (!is_ap) { + if (process_certificates(certs_sta, ARRAY_SIZE(certs_sta)) != 0) { + goto cleanup; + } + } + + /* Process AP-specific certificates if is_ap is true */ + if (is_ap) { + if (process_certificates(certs_ap, ARRAY_SIZE(certs_ap)) != 0) { + goto cleanup; + } + } + + memcpy(&context.enterprise_creds_params, params, sizeof(*params)); + return; + +cleanup: + for (size_t i = 0; i < ARRAY_SIZE(certs_common); i++) { + if (certs_common[i].data) { + k_free(*certs_common[i].data); + } + } + + if (!is_ap) { + for (size_t i = 0; i < ARRAY_SIZE(certs_sta); i++) { + if (certs_sta[i].data) { + k_free(*certs_sta[i].data); + } + } + } + + if (is_ap) { + for (size_t i = 0; i < ARRAY_SIZE(certs_ap); i++) { + if (certs_ap[i].data) { + k_free(*certs_ap[i].data); + } + } + } +} + +static void clear_enterprise_creds_params(struct wifi_enterprise_creds_params *params) +{ + size_t i; + + if (!params) { + return; + } + + const uint8_t *certs[] = { + params->ca_cert, + params->client_cert, + params->client_key, + params->server_cert, + params->server_key, + params->ca_cert2, + params->client_cert2, + params->client_key2, + }; + + for (i = 0; i < ARRAY_SIZE(certs); i++) { + k_free((void *)certs[i]); + } + memset(params, 0, sizeof(*params)); +} +#else +static void set_enterprise_creds_params(struct wifi_enterprise_creds_params *params, + bool is_ap) +{ + params->ca_cert = (uint8_t *)ca_cert_test; + params->ca_cert_len = ARRAY_SIZE(ca_cert_test); + + if (!is_ap) { + params->client_cert = (uint8_t *)client_cert_test; + params->client_cert_len = ARRAY_SIZE(client_cert_test); + params->client_key = (uint8_t *)client_key_test; + params->client_key_len = ARRAY_SIZE(client_key_test); + params->ca_cert2 = (uint8_t *)ca_cert2_test; + params->ca_cert2_len = ARRAY_SIZE(ca_cert2_test); + params->client_cert2 = (uint8_t *)client_cert2_test; + params->client_cert2_len = ARRAY_SIZE(client_cert2_test); + params->client_key2 = (uint8_t *)client_key2_test; + params->client_key2_len = ARRAY_SIZE(client_key2_test); + + return; + } + + params->server_cert = (uint8_t *)server_cert_test; + params->server_cert_len = ARRAY_SIZE(server_cert_test); + params->server_key = (uint8_t *)server_key_test; + params->server_key_len = ARRAY_SIZE(server_key_test); +} +#endif /* CONFIG_WIFI_SHELL_RUNTIME_CERTIFICATES */ + +static int wifi_set_enterprise_creds(const struct shell *sh, struct net_if *iface, + bool is_ap) +{ + struct wifi_enterprise_creds_params params = {0}; + +#ifdef CONFIG_WIFI_SHELL_RUNTIME_CERTIFICATES + clear_enterprise_creds_params(&context.enterprise_creds_params); +#endif /* CONFIG_WIFI_SHELL_RUNTIME_CERTIFICATES */ + set_enterprise_creds_params(¶ms, is_ap); + if (net_mgmt(NET_REQUEST_WIFI_ENTERPRISE_CREDS, iface, ¶ms, sizeof(params))) { + PR_WARNING("Set enterprise credentials failed\n"); + return -1; + } + + return 0; +} +#endif + static bool parse_number(const struct shell *sh, long *param, char *str, char *pname, long min, long max) { @@ -954,7 +1234,7 @@ static int cmd_wifi_connect(const struct shell *sh, size_t argc, cnx_params.security == WIFI_SECURITY_TYPE_EAP_PEAP_GTC || cnx_params.security == WIFI_SECURITY_TYPE_EAP_TTLS_MSCHAPV2 || cnx_params.security == WIFI_SECURITY_TYPE_EAP_PEAP_TLS) { - wifi_set_enterprise_credentials(iface, 0); + wifi_set_enterprise_creds(sh, iface, 0); } #endif @@ -998,7 +1278,7 @@ static int cmd_wifi_disconnect(const struct shell *sh, size_t argc, #ifdef CONFIG_WIFI_SHELL_RUNTIME_CERTIFICATES /* Clear the certificates */ - wifi_clear_enterprise_credentials(); + clear_enterprise_creds_params(&context.enterprise_creds_params); #endif /* CONFIG_WIFI_SHELL_RUNTIME_CERTIFICATES */ return 0; @@ -2011,7 +2291,7 @@ static int cmd_wifi_ap_disable(const struct shell *sh, size_t argc, #ifdef CONFIG_WIFI_SHELL_RUNTIME_CERTIFICATES /* Clear the certificates */ - wifi_clear_enterprise_credentials(); + clear_enterprise_creds_params(&context.enterprise_creds_params); #endif /* CONFIG_WIFI_SHELL_RUNTIME_CERTIFICATES */ return 0; diff --git a/subsys/net/lib/wifi_credentials/wifi_credentials_shell.c b/subsys/net/lib/wifi_credentials/wifi_credentials_shell.c index 3966a2404bcb..c5b8c2a88a39 100644 --- a/subsys/net/lib/wifi_credentials/wifi_credentials_shell.c +++ b/subsys/net/lib/wifi_credentials/wifi_credentials_shell.c @@ -22,15 +22,247 @@ #include -#ifdef CONFIG_WIFI_CERTIFICATE_LIB -#include -#endif - LOG_MODULE_REGISTER(wifi_credentials_shell, CONFIG_WIFI_CREDENTIALS_LOG_LEVEL); #define MAX_BANDS_STR_LEN 64 #define MACSTR "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx" +#ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE +#ifdef CONFIG_WIFI_CREDENTIALS_RUNTIME_CERTIFICATES +#include +enum wifi_enterprise_cert_sec_tags { + WIFI_CERT_CA_SEC_TAG = 0x1020001, + WIFI_CERT_CLIENT_KEY_SEC_TAG, + WIFI_CERT_SERVER_KEY_SEC_TAG, + WIFI_CERT_CLIENT_SEC_TAG, + WIFI_CERT_SERVER_SEC_TAG, + /* Phase 2 */ + WIFI_CERT_CA_P2_SEC_TAG, + WIFI_CERT_CLIENT_KEY_P2_SEC_TAG, + WIFI_CERT_CLIENT_P2_SEC_TAG, +}; + +struct wifi_cert_data { + enum tls_credential_type type; + uint32_t sec_tag; + uint8_t **data; + size_t *len; +}; +#else +static const char ca_cert_test[] = { + #include + '\0' +}; + +static const char client_cert_test[] = { + #include + '\0' +}; + +static const char client_key_test[] = { + #include + '\0' +}; + +static const char ca_cert2_test[] = { + #include + '\0'}; + +static const char client_cert2_test[] = { + #include + '\0'}; + +static const char client_key2_test[] = { + #include + '\0'}; +#endif /* CONFIG_WIFI_CREDENTIALS_RUNTIME_CERTIFICATES */ +#endif /* CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE */ + +#if defined CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE +#ifdef CONFIG_WIFI_CREDENTIALS_RUNTIME_CERTIFICATES + +struct wifi_enterprise_creds_params enterprise_creds_params; + +static int process_certificates(struct wifi_cert_data *certs, size_t cert_count) +{ + for (size_t i = 0; i < cert_count; i++) { + int err; + size_t len = 0; + uint8_t *cert_tmp; + + err = tls_credential_get(certs[i].sec_tag, certs[i].type, NULL, &len); + if (err != -EFBIG) { + LOG_ERR("Failed to get credential tag: %d length, err: %d", + certs[i].sec_tag, err); + return err; + } + + cert_tmp = k_malloc(len); + if (!cert_tmp) { + LOG_ERR("Failed to allocate memory for credential tag: %d", + certs[i].sec_tag); + return -ENOMEM; + } + + err = tls_credential_get(certs[i].sec_tag, certs[i].type, cert_tmp, &len); + if (err) { + LOG_ERR("Failed to get credential tag: %d", certs[i].sec_tag); + k_free(cert_tmp); + return err; + } + + *certs[i].data = cert_tmp; + *certs[i].len = len; + } + + return 0; +} + +static void set_enterprise_creds_params(struct wifi_enterprise_creds_params *params, + bool is_ap) +{ + struct wifi_cert_data certs_common[] = { + { + .type = TLS_CREDENTIAL_CA_CERTIFICATE, + .sec_tag = WIFI_CERT_CA_SEC_TAG, + .data = ¶ms->ca_cert, + .len = ¶ms->ca_cert_len, + }, + }; + + struct wifi_cert_data certs_sta[] = { + { + .type = TLS_CREDENTIAL_PRIVATE_KEY, + .sec_tag = WIFI_CERT_CLIENT_KEY_SEC_TAG, + .data = ¶ms->client_key, + .len = ¶ms->client_key_len, + }, + { + .type = TLS_CREDENTIAL_PUBLIC_CERTIFICATE, + .sec_tag = WIFI_CERT_CLIENT_SEC_TAG, + .data = ¶ms->client_cert, + .len = ¶ms->client_cert_len, + }, + { + .type = TLS_CREDENTIAL_CA_CERTIFICATE, + .sec_tag = WIFI_CERT_CA_P2_SEC_TAG, + .data = ¶ms->ca_cert2, + .len = ¶ms->ca_cert2_len, + }, + { + .type = TLS_CREDENTIAL_PRIVATE_KEY, + .sec_tag = WIFI_CERT_CLIENT_KEY_P2_SEC_TAG, + .data = ¶ms->client_key2, + .len = ¶ms->client_key2_len, + }, + { + .type = TLS_CREDENTIAL_PUBLIC_CERTIFICATE, + .sec_tag = WIFI_CERT_CLIENT_P2_SEC_TAG, + .data = ¶ms->client_cert2, + .len = ¶ms->client_cert2_len, + }, + }; + + memset(params, 0, sizeof(*params)); + + /* Process common certificates */ + if (process_certificates(certs_common, ARRAY_SIZE(certs_common)) != 0) { + goto cleanup; + } + + /* Process STA-specific certificates */ + if (!is_ap) { + if (process_certificates(certs_sta, ARRAY_SIZE(certs_sta)) != 0) { + goto cleanup; + } + } + + memcpy(&enterprise_creds_params, params, sizeof(*params)); + return; + +cleanup: + for (size_t i = 0; i < ARRAY_SIZE(certs_common); i++) { + if (certs_common[i].data) { + k_free(*certs_common[i].data); + *certs_common[i].data = NULL; + } + } + + if (!is_ap) { + for (size_t i = 0; i < ARRAY_SIZE(certs_sta); i++) { + if (certs_sta[i].data) { + k_free(*certs_sta[i].data); + *certs_sta[i].data = NULL; + } + } + } + +} + +static void clear_enterprise_creds_params(struct wifi_enterprise_creds_params *params) +{ + if (params == NULL) { + return; + } + + const uint8_t *certs[] = { + params->ca_cert, + params->client_cert, + params->client_key, + params->ca_cert2, + params->client_cert2, + params->client_key2, + }; + + for (size_t i = 0; i < ARRAY_SIZE(certs); i++) { + k_free((void *)certs[i]); + } + memset(params, 0, sizeof(*params)); +} +#else +static void set_enterprise_creds_params(struct wifi_enterprise_creds_params *params, + bool is_ap) +{ + params->ca_cert = (uint8_t *)ca_cert_test; + params->ca_cert_len = ARRAY_SIZE(ca_cert_test); + + if (!is_ap) { + params->client_cert = (uint8_t *)client_cert_test; + params->client_cert_len = ARRAY_SIZE(client_cert_test); + params->client_key = (uint8_t *)client_key_test; + params->client_key_len = ARRAY_SIZE(client_key_test); + params->ca_cert2 = (uint8_t *)ca_cert2_test; + params->ca_cert2_len = ARRAY_SIZE(ca_cert2_test); + params->client_cert2 = (uint8_t *)client_cert2_test; + params->client_cert2_len = ARRAY_SIZE(client_cert2_test); + params->client_key2 = (uint8_t *)client_key2_test; + params->client_key2_len = ARRAY_SIZE(client_key2_test); + + return; + } +} +#endif /* CONFIG_WIFI_CREDENTIALS_RUNTIME_CERTIFICATES */ + +static int wifi_set_enterprise_creds(const struct shell *sh, struct net_if *iface, + bool is_ap) +{ + struct wifi_enterprise_creds_params params = {0}; + +#ifdef CONFIG_WIFI_SHELL_RUNTIME_CERTIFICATES + clear_enterprise_creds_params(&enterprise_creds_params); +#endif /* CONFIG_WIFI_SHELL_RUNTIME_CERTIFICATES */ + + set_enterprise_creds_params(¶ms, is_ap); + + if (net_mgmt(NET_REQUEST_WIFI_ENTERPRISE_CREDS, iface, ¶ms, sizeof(params))) { + shell_warn(sh, "Set enterprise credentials failed\n"); + return -1; + } + + return 0; +} +#endif /* CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE */ + static void print_network_info(void *cb_arg, const char *ssid, size_t ssid_len) { int ret = 0; @@ -298,7 +530,7 @@ static int cmd_add_network(const struct shell *sh, size_t argc, char *argv[]) creds.header.type == WIFI_SECURITY_TYPE_EAP_PEAP_GTC || creds.header.type == WIFI_SECURITY_TYPE_EAP_TTLS_MSCHAPV2 || creds.header.type == WIFI_SECURITY_TYPE_EAP_PEAP_TLS) { - wifi_set_enterprise_credentials(iface, 0); + wifi_set_enterprise_creds(sh, iface, 0); } #endif /* CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE */ @@ -321,7 +553,7 @@ static int cmd_delete_network(const struct shell *sh, size_t argc, char *argv[]) #ifdef CONFIG_WIFI_SHELL_RUNTIME_CERTIFICATES /* Clear the certificates */ - wifi_clear_enterprise_credentials(); + clear_enterprise_creds_params(&enterprise_creds_params); #endif /* CONFIG_WIFI_SHELL_RUNTIME_CERTIFICATES */ return wifi_credentials_delete_by_ssid(argv[1], strlen(argv[1])); @@ -340,7 +572,7 @@ static int cmd_auto_connect(const struct shell *sh, size_t argc, char *argv[]) struct net_if *iface = net_if_get_wifi_sta(); #ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE - wifi_set_enterprise_credentials(iface, 0); + wifi_set_enterprise_creds(sh, iface, 0); #endif /* CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE */ int rc = net_mgmt(NET_REQUEST_WIFI_CONNECT_STORED, iface, NULL, 0); From ed4b4262de7cdfb3a58f6c150cc350f45f4e8879 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:52 +0300 Subject: [PATCH 1260/2141] Revert "[nrf fromlist] modules: hostap: Define dedicated heap for supplicant" This reverts commit c4fd75aff63a850f9e97af5da2b2b101554f0a95. Signed-off-by: Jukka Rissanen --- modules/hostap/Kconfig | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/modules/hostap/Kconfig b/modules/hostap/Kconfig index f900fea0e85e..199f38d23862 100644 --- a/modules/hostap/Kconfig +++ b/modules/hostap/Kconfig @@ -24,24 +24,6 @@ config WIFI_NM_WPA_SUPPLICANT if WIFI_NM_WPA_SUPPLICANT -config WIFI_NM_WPA_SUPPLICANT_GLOBAL_HEAP - bool "Use Zephyr kernel heap for Wi-Fi driver" - default y - help - Enable this option to use K_HEAP for memory allocations in supplicant. - -if !WIFI_NM_WPA_SUPPLICANT_GLOBAL_HEAP -config WIFI_NM_WPA_SUPPLICANT_HEAP - int "Dedicated memory pool for wpa_supplicant" - def_int 66560 if WIFI_NM_HOSTAPD_AP - def_int 55000 if WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE && WIFI_CREDENTIALS - def_int 48000 if WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE - def_int 41808 if WIFI_NM_WPA_SUPPLICANT_AP - # 30K is mandatory, but might need more for long duration use cases - def_int 30000 -endif # !WIFI_NM_WPA_SUPPLICANT_GLOBAL_HEAP - -if WIFI_NM_WPA_SUPPLICANT_GLOBAL_HEAP config HEAP_MEM_POOL_ADD_SIZE_HOSTAP def_int 66560 if WIFI_NM_HOSTAPD_AP def_int 55000 if WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE && WIFI_CREDENTIALS @@ -49,8 +31,6 @@ config HEAP_MEM_POOL_ADD_SIZE_HOSTAP def_int 41808 if WIFI_NM_WPA_SUPPLICANT_AP # 30K is mandatory, but might need more for long duration use cases def_int 30000 -endif # WIFI_NM_WPA_SUPPLICANT_GLOBAL_HEAP - config WIFI_NM_WPA_SUPPLICANT_THREAD_STACK_SIZE int "Stack size for wpa_supplicant thread" From 1fbb7c307f9e8a3cd516cc1f08cb94bd56055a62 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:52 +0300 Subject: [PATCH 1261/2141] Revert "[nrf fromlist] wifi: Fix fractional part of Tx rate by converting to float" This reverts commit ae694c3e15d6fa771c6303615dab81ae4b4a3a5a. Signed-off-by: Jukka Rissanen --- include/zephyr/net/wifi_mgmt.h | 2 +- subsys/net/l2/wifi/wifi_shell.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index 5477b6a3c0e9..8c6654f3ef5f 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -672,7 +672,7 @@ struct wifi_iface_status { /** is TWT capable? */ bool twt_capable; /** The current 802.11 PHY TX data rate (in Mbps) */ - float current_phy_tx_rate; + int current_phy_tx_rate; }; /** @brief Wi-Fi power save parameters */ diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 346b68e1dae7..af0db05855fa 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1484,7 +1484,7 @@ static int cmd_wifi_status(const struct shell *sh, size_t argc, char *argv[]) PR("DTIM: %d\n", status.dtim_period); PR("TWT: %s\n", status.twt_capable ? "Supported" : "Not supported"); - PR("Current PHY TX rate (Mbps) : %.1f\n", (double)status.current_phy_tx_rate); + PR("Current PHY TX rate (Mbps) : %d\n", status.current_phy_tx_rate); } return 0; From 58fb61a55b7ec078f986b8d733cd244ec54e1a0c Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:52 +0300 Subject: [PATCH 1262/2141] Revert "[nrf fromtree] hostap: Add CONFIG_HS20 Kconfig for Hotspot 2.0" This reverts commit c5a57b4b22ed8b55093ea43eb97928d461570497. Signed-off-by: Jukka Rissanen --- modules/hostap/Kconfig | 3 --- 1 file changed, 3 deletions(-) diff --git a/modules/hostap/Kconfig b/modules/hostap/Kconfig index 199f38d23862..2056a43e8729 100644 --- a/modules/hostap/Kconfig +++ b/modules/hostap/Kconfig @@ -564,9 +564,6 @@ config ACS config IEEE80211AC bool -config HS20 - bool - config IEEE80211R bool depends on !WIFI_NM_WPA_SUPPLICANT_CRYPTO_NONE From 76eb544961aa53ae20f09add2470e2da02e266d8 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:52 +0300 Subject: [PATCH 1263/2141] Revert "[nrf fromlist] nrf_wifi: Fix the DTS compat for nRF71" This reverts commit 96ad8409c0241431894720b6539ee28b63a8f175. Signed-off-by: Jukka Rissanen --- drivers/wifi/nrf_wifi/Kconfig.nrfwifi | 2 +- modules/nrf_wifi/bus/Kconfig | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/wifi/nrf_wifi/Kconfig.nrfwifi b/drivers/wifi/nrf_wifi/Kconfig.nrfwifi index 414900f581b9..8d414276038e 100644 --- a/drivers/wifi/nrf_wifi/Kconfig.nrfwifi +++ b/drivers/wifi/nrf_wifi/Kconfig.nrfwifi @@ -6,7 +6,7 @@ # # TODO: Use DTS generated Kconfig once the board support is added -DT_COMPAT_NORDIC_WIFI71 := nordic,nrf7120 +DT_COMPAT_NORDIC_WIFI71 := nordic,wifi71 menuconfig WIFI_NRF70 bool "nRF70 driver" diff --git a/modules/nrf_wifi/bus/Kconfig b/modules/nrf_wifi/bus/Kconfig index 3fed449bb809..fe6b0f345537 100644 --- a/modules/nrf_wifi/bus/Kconfig +++ b/modules/nrf_wifi/bus/Kconfig @@ -10,7 +10,7 @@ DT_COMPAT_NORDIC_NRF7001_QSPI := nordic,nrf7001-qspi DT_COMPAT_NORDIC_NRF7001_SPI := nordic,nrf7001-spi DT_COMPAT_NORDIC_NRF7000_QSPI := nordic,nrf7000-qspi DT_COMPAT_NORDIC_NRF7000_SPI := nordic,nrf7000-spi -DT_COMPAT_NORDIC_WIFI71 := nordic,nrf7120 +DT_COMPAT_NORDIC_WIFI71 := nordic,wifi71 menuconfig NRF70_BUSLIB bool "NRF70 Bus Library" From 616b5e1c623f528b0046e7e829d6311231ca668c Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:52 +0300 Subject: [PATCH 1264/2141] Revert "[nrf fromtree] drivers: flash: nordic: Introduce nrf_mramc driver" This reverts commit 424e7a54749ab3564bfdbebc24d047294771f087. Signed-off-by: Jukka Rissanen --- drivers/flash/CMakeLists.txt | 1 - drivers/flash/Kconfig | 1 - drivers/flash/Kconfig.nrf_mramc | 26 --- drivers/flash/soc_flash_nrf_mramc.c | 221 ------------------ .../flash_controller/nordic,nrf-mramc.yaml | 16 -- modules/hal_nordic/nrfx/CMakeLists.txt | 1 - modules/hal_nordic/nrfx/Kconfig | 4 - modules/hal_nordic/nrfx/Kconfig.logging | 4 - modules/hal_nordic/nrfx/nrfx_kconfig.h | 7 - 9 files changed, 281 deletions(-) delete mode 100644 drivers/flash/Kconfig.nrf_mramc delete mode 100644 drivers/flash/soc_flash_nrf_mramc.c delete mode 100644 dts/bindings/flash_controller/nordic,nrf-mramc.yaml diff --git a/drivers/flash/CMakeLists.txt b/drivers/flash/CMakeLists.txt index 9c82932b5243..b72aa37a3608 100644 --- a/drivers/flash/CMakeLists.txt +++ b/drivers/flash/CMakeLists.txt @@ -53,7 +53,6 @@ zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_MAX32 flash_max32.c) zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_MCUX soc_flash_mcux.c) zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_NRF soc_flash_nrf.c) zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_NRF_MRAM soc_flash_nrf_mram.c) -zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_NRF_MRAMC soc_flash_nrf_mramc.c) zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_NRF_RRAM soc_flash_nrf_rram.c) zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_NUMAKER soc_flash_numaker.c) zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_NUMAKER_RMC soc_flash_numaker_rmc.c) diff --git a/drivers/flash/Kconfig b/drivers/flash/Kconfig index 8e18b2deef69..cfa34d3e1c41 100644 --- a/drivers/flash/Kconfig +++ b/drivers/flash/Kconfig @@ -186,7 +186,6 @@ source "drivers/flash/Kconfig.nordic_qspi_nor" source "drivers/flash/Kconfig.npcx_fiu" source "drivers/flash/Kconfig.nrf" source "drivers/flash/Kconfig.nrf_mram" -source "drivers/flash/Kconfig.nrf_mramc" source "drivers/flash/Kconfig.nrf_rram" source "drivers/flash/Kconfig.numaker" source "drivers/flash/Kconfig.numaker_rmc" diff --git a/drivers/flash/Kconfig.nrf_mramc b/drivers/flash/Kconfig.nrf_mramc deleted file mode 100644 index 1637baec8969..000000000000 --- a/drivers/flash/Kconfig.nrf_mramc +++ /dev/null @@ -1,26 +0,0 @@ -# -# Copyright (c) 2025 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: Apache-2.0 -# - -config SOC_FLASH_NRF_MRAMC - bool "Nordic Semiconductor flash driver for MRAM using MRAM Controller" - default y - depends on DT_HAS_NORDIC_NRF_MRAMC_ENABLED - select NRFX_MRAMC - select FLASH_HAS_DRIVER_ENABLED - select FLASH_HAS_PAGE_LAYOUT - select FLASH_HAS_NO_EXPLICIT_ERASE - select SOC_FLASH_NRF_MRAMC_FLUSH_CACHE - imply MPU_ALLOW_FLASH_WRITE if ARM_MPU - help - Enables Nordic Semiconductor flash driver for MRAMC in direct write mode. - -config SOC_FLASH_NRF_MRAMC_FLUSH_CACHE - bool "Invalidate MRAM cache after erase operations" - default y - depends on SOC_FLASH_NRF_MRAMC - help - Enables invalidation of the MRAM cache after write and erase operations to - ensure data read consistency. diff --git a/drivers/flash/soc_flash_nrf_mramc.c b/drivers/flash/soc_flash_nrf_mramc.c deleted file mode 100644 index c08f8f32851c..000000000000 --- a/drivers/flash/soc_flash_nrf_mramc.c +++ /dev/null @@ -1,221 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - - #include - - #include - #include - #include - #if defined(CONFIG_SOC_FLASH_NRF_MRAMC_FLUSH_CACHE) - #include - #endif - -LOG_MODULE_REGISTER(flash_nrf_mramc, CONFIG_FLASH_LOG_LEVEL); - -#define DT_DRV_COMPAT nordic_nrf_mramc - -#define _ADD_SIZE(node_id) + DT_REG_SIZE(node_id) -#define _WBS(node_id) DT_PROP(node_id, write_block_size), -#define _EBS(node_id) DT_PROP(node_id, erase_block_size), - -#define MRAM_SIZE (0 DT_INST_FOREACH_CHILD_STATUS_OKAY(0, _ADD_SIZE)) -#define ERASE_VALUE (uint8_t)NRFY_MRAMC_WORD_AFTER_ERASED - -/* Use DT_FOREACH_CHILD_STATUS_OKAY of mramc with _FIRST() helper - * macro to get the write block size and erase block size from - * the first child node. - */ -#define WBS_LIST DT_INST_FOREACH_CHILD_STATUS_OKAY(0, _WBS) -#define EBS_LIST DT_INST_FOREACH_CHILD_STATUS_OKAY(0, _EBS) - -#define _FIRST_HELPER(first, ...) first -#define _FIRST(...) _FIRST_HELPER(__VA_ARGS__) - -#define WRITE_BLOCK_SIZE _FIRST(WBS_LIST) -#define ERASE_BLOCK_SIZE _FIRST(EBS_LIST) - -BUILD_ASSERT((ERASE_BLOCK_SIZE % WRITE_BLOCK_SIZE) == 0, - "erase-block-size expected to be a multiple of write-block-size"); - -/** - * @param[in] addr Address of mram memory. - * @param[in] len Number of bytes for the intended operation. - * @param[in] must_align Require MRAM word alignment, if applicable. - * - * @return true if the address and length are valid, false otherwise. - */ -static bool validate_action(uint32_t addr, size_t len, bool must_align) -{ - if (!nrfx_mramc_valid_address_check(addr, true)) { - LOG_ERR("Invalid address: %x", addr); - return false; - } - - if (!nrfx_mramc_fits_memory_check(addr, true, len)) { - LOG_ERR("Address %x with length %zu exceeds MRAM size", addr, len); - return false; - } - - if (must_align && !(nrfx_is_word_aligned((void const *)addr))) { - LOG_ERR("Address %x is not word aligned", addr); - return false; - } - - return true; -} - -static int nrf_mramc_read(const struct device *dev, off_t offset, void *data, size_t len) -{ - ARG_UNUSED(dev); - uint32_t addr = NRFX_MRAMC_MAP_TO_ADDR(offset); - - if (data == NULL) { - LOG_ERR("Data pointer is NULL"); - return -EINVAL; - } - - /* Validate addr and length in the range */ - if (!validate_action(addr, len, false)) { - return -EINVAL; - } - - LOG_DBG("read: %x:%zu", addr, len); - - /* Buffer read number of bytes and store in data pointer. - */ - nrfx_mramc_buffer_read(data, addr, len); - return 0; -} - -static int nrf_mramc_write(const struct device *dev, off_t offset, - const void *data, size_t len) -{ - ARG_UNUSED(dev); - uint32_t addr = NRFX_MRAMC_MAP_TO_ADDR(offset); - - if (data == NULL) { - LOG_ERR("Data pointer is NULL"); - return -EINVAL; - } - - /* Validate addr and length in the range */ - if (!validate_action(addr, len, true)) { - return -EINVAL; - } - - LOG_DBG("write: %x:%zu", addr, len); - - /* Words write function takes second argument as number of write blocks - * and not number of bytes - */ - nrfx_mramc_words_write(addr, data, len / WRITE_BLOCK_SIZE); -#if defined(CONFIG_SOC_FLASH_NRF_MRAMC_FLUSH_CACHE) - if (nrf_cache_enable_check(NRF_ICACHE)) { - while (nrf_cache_busy_check(NRF_ICACHE)) { - } - nrf_cache_invalidate(NRF_ICACHE); - } -#endif - return 0; -} - -static int nrf_mramc_erase(const struct device *dev, off_t offset, size_t size) -{ - ARG_UNUSED(dev); - uint32_t addr = NRFX_MRAMC_MAP_TO_ADDR(offset); - - /* Validate addr and length in the range */ - if (size == 0) { - LOG_DBG("No data to erase"); - return 0; - } - - if (!validate_action(addr, size, true)) { - return -EINVAL; - } - - LOG_DBG("erase: %p:%zu", (void *)addr, size); - - /* Erase function takes second argument as number of write blocks - * and not number of bytes - */ - nrfx_mramc_area_erase(addr, size / WRITE_BLOCK_SIZE); -#if defined(CONFIG_SOC_FLASH_NRF_MRAMC_FLUSH_CACHE) - if (nrf_cache_enable_check(NRF_ICACHE)) { - while (nrf_cache_busy_check(NRF_ICACHE)) { - } - nrf_cache_invalidate(NRF_ICACHE); - } -#endif - return 0; -} - -static int nrf_mramc_get_size(const struct device *dev, uint64_t *size) -{ - ARG_UNUSED(dev); - *size = nrfx_mramc_memory_size_get(); - return 0; -} - -static const struct flash_parameters *nrf_mramc_get_parameters(const struct device *dev) -{ - ARG_UNUSED(dev); - - static const struct flash_parameters parameters = { - .write_block_size = WRITE_BLOCK_SIZE, - .erase_value = ERASE_VALUE, - .caps = { - .no_explicit_erase = true, - }, - }; - - return ¶meters; -} - -#if defined(CONFIG_FLASH_PAGE_LAYOUT) -static void nrf_mramc_page_layout(const struct device *dev, - const struct flash_pages_layout **layout, size_t *layout_size) -{ - ARG_UNUSED(dev); - - static const struct flash_pages_layout pages_layout = { - .pages_count = MRAM_SIZE / (ERASE_BLOCK_SIZE), - .pages_size = ERASE_BLOCK_SIZE, - }; - - *layout = &pages_layout; - *layout_size = 1; -} -#endif - -static int mramc_sys_init(const struct device *dev) -{ - ARG_UNUSED(dev); - - nrfx_mramc_config_t config = NRFX_MRAMC_DEFAULT_CONFIG(); - nrfx_err_t err = nrfx_mramc_init(&config, NULL); - - if (err != NRFX_SUCCESS) { - LOG_ERR("Failed to initialize MRAMC: %d", err); - return -EIO; - } - LOG_DBG("MRAMC initialized successfully"); - return 0; -} - -static DEVICE_API(flash, nrf_mram_api) = { - .read = nrf_mramc_read, - .write = nrf_mramc_write, - .erase = nrf_mramc_erase, - .get_size = nrf_mramc_get_size, - .get_parameters = nrf_mramc_get_parameters, -#if defined(CONFIG_FLASH_PAGE_LAYOUT) - .page_layout = nrf_mramc_page_layout, -#endif -}; - -DEVICE_DT_INST_DEFINE(0, mramc_sys_init, NULL, NULL, NULL, POST_KERNEL, CONFIG_FLASH_INIT_PRIORITY, - &nrf_mram_api); diff --git a/dts/bindings/flash_controller/nordic,nrf-mramc.yaml b/dts/bindings/flash_controller/nordic,nrf-mramc.yaml deleted file mode 100644 index 0afef7563b36..000000000000 --- a/dts/bindings/flash_controller/nordic,nrf-mramc.yaml +++ /dev/null @@ -1,16 +0,0 @@ -# -# Copyright (c) 2025 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: Apache-2.0 -# - -description: | - Nordic MRAMC (Magnetoresistive Random Access Memory Controller) - - The Magnetoresistive random access memory controller (MRAMC) is used for writing - the internal MRAM memory, the secure information configuration registers (SICR), - and the user information configuration registers (UICR). - -compatible: "nordic,nrf-mramc" - -include: base.yaml diff --git a/modules/hal_nordic/nrfx/CMakeLists.txt b/modules/hal_nordic/nrfx/CMakeLists.txt index 35c46e235f25..1d18d708d747 100644 --- a/modules/hal_nordic/nrfx/CMakeLists.txt +++ b/modules/hal_nordic/nrfx/CMakeLists.txt @@ -135,7 +135,6 @@ zephyr_library_sources_ifdef(CONFIG_NRFX_GRTC ${SRC_DIR}/nrfx_grtc.c) zephyr_library_sources_ifdef(CONFIG_NRFX_I2S ${SRC_DIR}/nrfx_i2s.c) zephyr_library_sources_ifdef(CONFIG_NRFX_IPC ${SRC_DIR}/nrfx_ipc.c) zephyr_library_sources_ifdef(CONFIG_NRFX_LPCOMP ${SRC_DIR}/nrfx_lpcomp.c) -zephyr_library_sources_ifdef(CONFIG_NRFX_MRAMC ${SRC_DIR}/nrfx_mramc.c) zephyr_library_sources_ifdef(CONFIG_NRFX_NFCT ${SRC_DIR}/nrfx_nfct.c) zephyr_library_sources_ifdef(CONFIG_NRFX_NVMC ${SRC_DIR}/nrfx_nvmc.c) zephyr_library_sources_ifdef(CONFIG_NRFX_PDM ${SRC_DIR}/nrfx_pdm.c) diff --git a/modules/hal_nordic/nrfx/Kconfig b/modules/hal_nordic/nrfx/Kconfig index b918a2023c37..80610599e60b 100644 --- a/modules/hal_nordic/nrfx/Kconfig +++ b/modules/hal_nordic/nrfx/Kconfig @@ -265,10 +265,6 @@ config NRFX_LPCOMP bool "LPCOMP driver" depends on $(dt_nodelabel_exists,comp) && !SOC_NRF52810 && !SOC_NRF52811 && !SOC_NRF52820 -config NRFX_MRAMC - bool "MRAMC driver" - depends on $(dt_has_compat,$(DT_COMPAT_NORDIC_NRF_MRAMC)) - config NRFX_NFCT bool "NFCT driver" depends on $(dt_nodelabel_exists,nfct) diff --git a/modules/hal_nordic/nrfx/Kconfig.logging b/modules/hal_nordic/nrfx/Kconfig.logging index 322660f40d1a..2bf247218807 100644 --- a/modules/hal_nordic/nrfx/Kconfig.logging +++ b/modules/hal_nordic/nrfx/Kconfig.logging @@ -44,10 +44,6 @@ config NRFX_LPCOMP_LOG bool "LPCOMP driver logging" depends on NRFX_LPCOMP -config NRFX_MRAMC_LOG - bool "MRAMC driver logging" - depends on NRFX_MRAMC - config NRFX_NFCT_LOG bool "NFCT driver logging" depends on NRFX_NFCT diff --git a/modules/hal_nordic/nrfx/nrfx_kconfig.h b/modules/hal_nordic/nrfx/nrfx_kconfig.h index 5aa856f22997..191855b3ff0e 100644 --- a/modules/hal_nordic/nrfx/nrfx_kconfig.h +++ b/modules/hal_nordic/nrfx/nrfx_kconfig.h @@ -239,13 +239,6 @@ #define NRFX_LPCOMP_CONFIG_LOG_ENABLED 1 #endif -#ifdef CONFIG_NRFX_MRAMC -#define NRFX_MRAMC_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_MRAMC_LOG -#define NRFX_MRAMC_CONFIG_LOG_ENABLED 1 -#endif - #ifdef CONFIG_NRFX_NFCT #define NRFX_NFCT_ENABLED 1 #endif From 63dd0743ee795917fe382b607c3ac6e1197c9298 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:52 +0300 Subject: [PATCH 1265/2141] Revert "[nrf fromtree] tests: kernel: timer: timer_behavior: Fix max_stddev calculation" This reverts commit aa5352afba7a4843dbb0f9f36974d5b30ad850a1. Signed-off-by: Jukka Rissanen --- tests/kernel/timer/timer_behavior/src/jitter_drift.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/kernel/timer/timer_behavior/src/jitter_drift.c b/tests/kernel/timer/timer_behavior/src/jitter_drift.c index c3e06b024688..82e178fb6020 100644 --- a/tests/kernel/timer/timer_behavior/src/jitter_drift.c +++ b/tests/kernel/timer/timer_behavior/src/jitter_drift.c @@ -237,8 +237,8 @@ static void do_test_using(void (*sample_collection_fn)(void), const char *mechan - expected_time_drift_us; double time_diff_us_abs = time_diff_us >= 0.0 ? time_diff_us : -time_diff_us; - /* If max stddev is lower than a single clock tick then round it up. */ - uint32_t max_stddev = MAX(k_ticks_to_us_ceil32(1), CONFIG_TIMER_TEST_MAX_STDDEV); + /* If max stddev is lower than a single clock cycle then round it up. */ + uint32_t max_stddev = MAX(k_cyc_to_us_ceil32(1), CONFIG_TIMER_TEST_MAX_STDDEV); TC_PRINT("timer clock rate %u, kernel tick rate %d\n", sys_clock_hw_cycles_per_sec(), CONFIG_SYS_CLOCK_TICKS_PER_SEC); From 288b951e44c926cf7f42e3f9e2c80574107c8317 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:52 +0300 Subject: [PATCH 1266/2141] Revert "[nrf fromtree] tests: drivers: clock_control: Cleanup after nRF54LM20 rename" This reverts commit 00bd8639325531cb110d9469bc31fff8147c428c. Signed-off-by: Jukka Rissanen --- .../boards/nrf54l20pdk_nrf54l20_cpuapp.conf | 1 + .../clock_control/clock_control_api/testcase.yaml | 2 ++ .../clock_control/nrf_clock_calibration/testcase.yaml | 2 +- .../clock_control/nrf_lf_clock_start/testcase.yaml | 9 ++++++++- tests/drivers/clock_control/onoff/testcase.yaml | 2 +- 5 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 tests/drivers/clock_control/clock_control_api/boards/nrf54l20pdk_nrf54l20_cpuapp.conf diff --git a/tests/drivers/clock_control/clock_control_api/boards/nrf54l20pdk_nrf54l20_cpuapp.conf b/tests/drivers/clock_control/clock_control_api/boards/nrf54l20pdk_nrf54l20_cpuapp.conf new file mode 100644 index 000000000000..11d42321cbc3 --- /dev/null +++ b/tests/drivers/clock_control/clock_control_api/boards/nrf54l20pdk_nrf54l20_cpuapp.conf @@ -0,0 +1 @@ +CONFIG_TEST_NRF_HF_STARTUP_TIME_US=1000 diff --git a/tests/drivers/clock_control/clock_control_api/testcase.yaml b/tests/drivers/clock_control/clock_control_api/testcase.yaml index 4a192e5e3a72..98f8920e162a 100644 --- a/tests/drivers/clock_control/clock_control_api/testcase.yaml +++ b/tests/drivers/clock_control/clock_control_api/testcase.yaml @@ -23,6 +23,7 @@ tests: - nrf9160dk/nrf9160 - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp + - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: @@ -34,6 +35,7 @@ tests: - nrf52840dk/nrf52840 - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp + - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: diff --git a/tests/drivers/clock_control/nrf_clock_calibration/testcase.yaml b/tests/drivers/clock_control/nrf_clock_calibration/testcase.yaml index 4600202f0f1b..3cdc785cbc74 100644 --- a/tests/drivers/clock_control/nrf_clock_calibration/testcase.yaml +++ b/tests/drivers/clock_control/nrf_clock_calibration/testcase.yaml @@ -1,6 +1,5 @@ tests: drivers.clock.nrf5_clock_calibration: - timeout: 30 tags: - drivers - clock_control @@ -10,6 +9,7 @@ tests: - nrf52840dk/nrf52840 - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp + - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: diff --git a/tests/drivers/clock_control/nrf_lf_clock_start/testcase.yaml b/tests/drivers/clock_control/nrf_lf_clock_start/testcase.yaml index 2a4bba57a711..94cc046d6963 100644 --- a/tests/drivers/clock_control/nrf_lf_clock_start/testcase.yaml +++ b/tests/drivers/clock_control/nrf_lf_clock_start/testcase.yaml @@ -4,7 +4,6 @@ common: - clock_control integration_platforms: - nrf51dk/nrf51822 - timeout: 30 tests: drivers.clock.nrf_lf_clock_start_xtal_stable: platform_allow: @@ -16,6 +15,7 @@ tests: - nrf5340dk/nrf5340/cpunet - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp + - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp extra_configs: @@ -34,6 +34,7 @@ tests: - nrf5340dk/nrf5340/cpunet - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp + - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp extra_configs: @@ -67,6 +68,7 @@ tests: - nrf5340dk/nrf5340/cpunet - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp + - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: @@ -84,6 +86,7 @@ tests: - nrf5340dk/nrf5340/cpunet - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp + - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: @@ -101,6 +104,7 @@ tests: - nrf5340dk/nrf5340/cpunet - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp + - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: @@ -118,6 +122,7 @@ tests: - nrf5340dk/nrf5340/cpunet - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp + - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: @@ -135,6 +140,7 @@ tests: - nrf5340dk/nrf5340/cpunet - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp + - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: @@ -152,6 +158,7 @@ tests: - nrf5340dk/nrf5340/cpunet - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp + - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: diff --git a/tests/drivers/clock_control/onoff/testcase.yaml b/tests/drivers/clock_control/onoff/testcase.yaml index c26eeca5e3d1..51c263dad29a 100644 --- a/tests/drivers/clock_control/onoff/testcase.yaml +++ b/tests/drivers/clock_control/onoff/testcase.yaml @@ -9,9 +9,9 @@ tests: - nrf52840dk/nrf52840 - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp + - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - nrf9160dk/nrf9160 - ophelia4ev/nrf54l15/cpuapp integration_platforms: - nrf51dk/nrf51822 - timeout: 30 From 8a1e7e851e110cfb41af02acba2b7001c0e461d6 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:53 +0300 Subject: [PATCH 1267/2141] Revert "[nrf fromtree] tests: subsys: fs: fcb: Cleanup after nRF54LM20 rename" This reverts commit 87b5ed75aa56c17bf53178e58aa0eb05600df061. Signed-off-by: Jukka Rissanen --- tests/subsys/fs/fcb/testcase.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/subsys/fs/fcb/testcase.yaml b/tests/subsys/fs/fcb/testcase.yaml index c915dd56840b..bd5067ecccec 100644 --- a/tests/subsys/fs/fcb/testcase.yaml +++ b/tests/subsys/fs/fcb/testcase.yaml @@ -14,6 +14,7 @@ tests: platform_allow: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp + - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp - native_sim From 0a6db1a4fcef367318087434423d731c2babfabf Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:53 +0300 Subject: [PATCH 1268/2141] Revert "[nrf fromtree] tests: kernel: timer: timer_behavior: Cleanup after nRF54LM20 rename" This reverts commit 3c191f9f52ef07855029ccb2153a7cdfbf60f870. Signed-off-by: Jukka Rissanen --- .../timer/timer_behavior/boards/nrf54l20pdk_nrf54l20_cpuapp.conf | 1 + 1 file changed, 1 insertion(+) create mode 100644 tests/kernel/timer/timer_behavior/boards/nrf54l20pdk_nrf54l20_cpuapp.conf diff --git a/tests/kernel/timer/timer_behavior/boards/nrf54l20pdk_nrf54l20_cpuapp.conf b/tests/kernel/timer/timer_behavior/boards/nrf54l20pdk_nrf54l20_cpuapp.conf new file mode 100644 index 000000000000..4b13bc80c7f3 --- /dev/null +++ b/tests/kernel/timer/timer_behavior/boards/nrf54l20pdk_nrf54l20_cpuapp.conf @@ -0,0 +1 @@ +CONFIG_SYS_CLOCK_TICKS_PER_SEC=10000 From 0caba7e619fcaa74e113c48946f6ec18228a5908 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:53 +0300 Subject: [PATCH 1269/2141] Revert "[nrf fromtree] tests: drivers: watchodg: Cleanup after nRF54LM20 rename" This reverts commit a3ec88e69598522ba08afcf25547c25516001e69. Signed-off-by: Jukka Rissanen --- .../boards/nrf54l20pdk_nrf54l20_cpuapp.overlay | 9 +++++++++ .../boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay} | 0 .../boards/nrf54l20pdk_nrf54l20_cpuapp.overlay | 9 +++++++++ tests/drivers/watchdog/wdt_error_cases/testcase.yaml | 5 +++-- .../boards/nrf54l20pdk_nrf54l20_cpuapp.overlay | 9 +++++++++ tests/drivers/watchdog/wdt_variables/testcase.yaml | 2 +- 6 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 tests/drivers/watchdog/wdt_basic_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay rename tests/drivers/watchdog/{wdt_variables/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay => wdt_basic_api/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay} (100%) create mode 100644 tests/drivers/watchdog/wdt_error_cases/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay create mode 100644 tests/drivers/watchdog/wdt_variables/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay diff --git a/tests/drivers/watchdog/wdt_basic_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/tests/drivers/watchdog/wdt_basic_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay new file mode 100644 index 000000000000..8d3dce3b3800 --- /dev/null +++ b/tests/drivers/watchdog/wdt_basic_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&wdt31 { + status = "okay"; +}; diff --git a/tests/drivers/watchdog/wdt_variables/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay b/tests/drivers/watchdog/wdt_basic_api/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay similarity index 100% rename from tests/drivers/watchdog/wdt_variables/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay rename to tests/drivers/watchdog/wdt_basic_api/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay diff --git a/tests/drivers/watchdog/wdt_error_cases/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/tests/drivers/watchdog/wdt_error_cases/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay new file mode 100644 index 000000000000..8d3dce3b3800 --- /dev/null +++ b/tests/drivers/watchdog/wdt_error_cases/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&wdt31 { + status = "okay"; +}; diff --git a/tests/drivers/watchdog/wdt_error_cases/testcase.yaml b/tests/drivers/watchdog/wdt_error_cases/testcase.yaml index f8da32ca72de..951afe9034e0 100644 --- a/tests/drivers/watchdog/wdt_error_cases/testcase.yaml +++ b/tests/drivers/watchdog/wdt_error_cases/testcase.yaml @@ -10,10 +10,11 @@ tests: platform_allow: - nrf5340dk/nrf5340/cpuapp - nrf54l09pdk/nrf54l09/cpuapp - - nrf54h20dk/nrf54h20/cpuapp - - nrf54h20dk/nrf54h20/cpurad - nrf54l15dk/nrf54l15/cpuapp + - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp + - nrf54h20dk/nrf54h20/cpuapp + - nrf54h20dk/nrf54h20/cpurad - nrf9280pdk/nrf9280/cpuapp - nrf9280pdk/nrf9280/cpurad - ophelia4ev/nrf54l15/cpuapp diff --git a/tests/drivers/watchdog/wdt_variables/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/tests/drivers/watchdog/wdt_variables/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay new file mode 100644 index 000000000000..dc1ea1a9ddc9 --- /dev/null +++ b/tests/drivers/watchdog/wdt_variables/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&wdt31 { + status = "okay"; +}; diff --git a/tests/drivers/watchdog/wdt_variables/testcase.yaml b/tests/drivers/watchdog/wdt_variables/testcase.yaml index b504cb5b6b8d..d033e4f255e4 100644 --- a/tests/drivers/watchdog/wdt_variables/testcase.yaml +++ b/tests/drivers/watchdog/wdt_variables/testcase.yaml @@ -16,8 +16,8 @@ tests: - nrf54h20dk/nrf54h20/cpuppr - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp + - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuflpr - ophelia4ev/nrf54l15/cpuapp integration_platforms: - nrf54l15dk/nrf54l15/cpuapp From a8f096990026994eddb7e1a99b6c0ce30640d0d1 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:53 +0300 Subject: [PATCH 1270/2141] Revert "[nrf fromtree] tests: drivers: uart: uart_errors: Cleanup after nRF54LM20 rename" This reverts commit 35f8205ac7fc9d506f1bbcdae6dbfec3e655cdd7. Signed-off-by: Jukka Rissanen --- .../nrf54l20pdk_nrf54l20_cpuapp.overlay | 54 +++++++++++++++++++ tests/drivers/uart/uart_errors/testcase.yaml | 3 +- 2 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 tests/drivers/uart/uart_errors/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay diff --git a/tests/drivers/uart/uart_errors/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/tests/drivers/uart/uart_errors/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay new file mode 100644 index 000000000000..babbc740133f --- /dev/null +++ b/tests/drivers/uart/uart_errors/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay @@ -0,0 +1,54 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +&pinctrl { + uart21_default: uart21_default { + group1 { + psels = , + ; + }; + }; + + uart21_sleep: uart21_sleep { + group1 { + psels = , + ; + low-power-enable; + }; + }; + + uart22_default: uart22_default { + group1 { + psels = + ; + bias-pull-up; + }; + group2 { + psels = ; + }; + }; + + uart22_sleep: uart22_sleep { + group1 { + psels = , + ; + low-power-enable; + }; + }; +}; + +dut: &uart21 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart21_default>; + pinctrl-1 = <&uart21_sleep>; + pinctrl-names = "default", "sleep"; +}; + +dut_aux: &uart22 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart22_default>; + pinctrl-1 = <&uart22_sleep>; + pinctrl-names = "default", "sleep"; + disable-rx; +}; diff --git a/tests/drivers/uart/uart_errors/testcase.yaml b/tests/drivers/uart/uart_errors/testcase.yaml index c17f071b8535..522935adccaf 100644 --- a/tests/drivers/uart/uart_errors/testcase.yaml +++ b/tests/drivers/uart/uart_errors/testcase.yaml @@ -6,13 +6,13 @@ common: harness: ztest harness_config: fixture: gpio_loopback - timeout: 30 tests: drivers.uart.uart_errors.int_driven: filter: CONFIG_SERIAL_SUPPORT_INTERRUPT platform_allow: - nrf54h20dk/nrf54h20/cpuapp - nrf54l15dk/nrf54l15/cpuapp + - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - nrf5340dk/nrf5340/cpuapp - ophelia4ev/nrf54l15/cpuapp @@ -21,6 +21,7 @@ tests: platform_allow: - nrf54h20dk/nrf54h20/cpuapp - nrf54l15dk/nrf54l15/cpuapp + - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - nrf5340dk/nrf5340/cpuapp - ophelia4ev/nrf54l15/cpuapp From 10406a552c5ae9981f6376bdad8b01fde93d53d6 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:53 +0300 Subject: [PATCH 1271/2141] Revert "[nrf fromtree] tests: drivers: uart: uart_elementary: Cleanup after nRF54LM20 rename" This reverts commit 2b3435759b7c0fdf036c5b8deea3645429e59f7f. Signed-off-by: Jukka Rissanen --- ...54l15dk_nrf54l15_cpuapp_dual_uart.overlay} | 0 ...54l15dk_nrf54l15_cpuflpr_dual_uart.overlay | 51 ++++++++++++++ .../nrf54l20pdk_nrf54l20_cpuapp.overlay | 31 ++++++++ .../nrf54l20pdk_nrf54l20_cpuflpr.overlay | 31 ++++++++ .../boards/nrf54lm20dk_nrf54lm20_common.dtsi | 7 -- .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 2 - .../nrf54lm20dk_nrf54lm20a_cpuflpr.overlay | 2 - .../nrf54lm20dk_nrf54lm20a_dual_uart.overlay | 7 -- .../uart/uart_elementary/testcase.yaml | 70 ++++++++++++------- 9 files changed, 156 insertions(+), 45 deletions(-) rename tests/drivers/uart/uart_elementary/boards/{nrf54l15dk_nrf54l15_dual_uart.overlay => nrf54l15dk_nrf54l15_cpuapp_dual_uart.overlay} (100%) create mode 100644 tests/drivers/uart/uart_elementary/boards/nrf54l15dk_nrf54l15_cpuflpr_dual_uart.overlay create mode 100644 tests/drivers/uart/uart_elementary/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay create mode 100644 tests/drivers/uart/uart_elementary/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54l15dk_nrf54l15_dual_uart.overlay b/tests/drivers/uart/uart_elementary/boards/nrf54l15dk_nrf54l15_cpuapp_dual_uart.overlay similarity index 100% rename from tests/drivers/uart/uart_elementary/boards/nrf54l15dk_nrf54l15_dual_uart.overlay rename to tests/drivers/uart/uart_elementary/boards/nrf54l15dk_nrf54l15_cpuapp_dual_uart.overlay diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54l15dk_nrf54l15_cpuflpr_dual_uart.overlay b/tests/drivers/uart/uart_elementary/boards/nrf54l15dk_nrf54l15_cpuflpr_dual_uart.overlay new file mode 100644 index 000000000000..2031f7a24441 --- /dev/null +++ b/tests/drivers/uart/uart_elementary/boards/nrf54l15dk_nrf54l15_cpuflpr_dual_uart.overlay @@ -0,0 +1,51 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +&pinctrl { + uart21_default: uart21_default { + group1 { + psels = , + ; + bias-pull-up; + }; + }; + + uart21_sleep: uart21_sleep { + group1 { + psels = , + ; + low-power-enable; + }; + }; + + uart22_default: uart22_default { + group1 { + psels = , + ; + bias-pull-up; + }; + }; + + uart22_sleep: uart22_sleep { + group1 { + psels = , + ; + low-power-enable; + }; + }; +}; + +dut: &uart21 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart21_default>; + pinctrl-1 = <&uart21_sleep>; + pinctrl-names = "default", "sleep"; +}; + +dut_aux: &uart22 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart22_default>; + pinctrl-1 = <&uart22_sleep>; + pinctrl-names = "default", "sleep"; +}; diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/tests/drivers/uart/uart_elementary/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay new file mode 100644 index 000000000000..cf481b7a1614 --- /dev/null +++ b/tests/drivers/uart/uart_elementary/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay @@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +&pinctrl { + uart21_default: uart21_default { + group1 { + psels = , + , + , + ; + }; + }; + + uart21_sleep: uart21_sleep { + group1 { + psels = , + , + , + ; + low-power-enable; + }; + }; +}; + +dut: &uart21 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart21_default>; + pinctrl-1 = <&uart21_sleep>; + pinctrl-names = "default", "sleep"; + hw-flow-control; +}; diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay b/tests/drivers/uart/uart_elementary/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay new file mode 100644 index 000000000000..cf481b7a1614 --- /dev/null +++ b/tests/drivers/uart/uart_elementary/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay @@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +&pinctrl { + uart21_default: uart21_default { + group1 { + psels = , + , + , + ; + }; + }; + + uart21_sleep: uart21_sleep { + group1 { + psels = , + , + , + ; + low-power-enable; + }; + }; +}; + +dut: &uart21 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart21_default>; + pinctrl-1 = <&uart21_sleep>; + pinctrl-names = "default", "sleep"; + hw-flow-control; +}; diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20_common.dtsi b/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20_common.dtsi index 33d060d30ced..dd9f0b93be04 100644 --- a/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20_common.dtsi +++ b/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20_common.dtsi @@ -1,10 +1,3 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - -/* Test requires loopbacks: - * P1.13 - P1.14 - * P1.23 - P1.24 - */ - &pinctrl { uart21_default: uart21_default { group1 { diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay index 03676317e382..5210e41ef553 100644 --- a/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ b/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -1,3 +1 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - #include "nrf54lm20dk_nrf54lm20_common.dtsi" diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay b/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay index 03676317e382..5210e41ef553 100644 --- a/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay +++ b/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay @@ -1,3 +1 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - #include "nrf54lm20dk_nrf54lm20_common.dtsi" diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20a_dual_uart.overlay b/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20a_dual_uart.overlay index 72e7e968d0b7..0dcede29d924 100644 --- a/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20a_dual_uart.overlay +++ b/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20a_dual_uart.overlay @@ -1,10 +1,3 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - -/* Test requires loopbacks: - * P1.13 - P1.14 - * P1.23 - P1.24 - */ - &pinctrl { uart21_default: uart21_default { group1 { diff --git a/tests/drivers/uart/uart_elementary/testcase.yaml b/tests/drivers/uart/uart_elementary/testcase.yaml index de3d18a50eea..83aba78e8282 100644 --- a/tests/drivers/uart/uart_elementary/testcase.yaml +++ b/tests/drivers/uart/uart_elementary/testcase.yaml @@ -15,7 +15,9 @@ tests: - nrf54l09pdk/nrf54l09/cpuflpr - nrf54l15dk/nrf54l15/cpuapp - nrf54l15dk/nrf54l15/cpuflpr + - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp + - nrf54l20pdk/nrf54l20/cpuflpr - nrf54lm20dk/nrf54lm20a/cpuflpr - nrf5340dk/nrf5340/cpuapp - ophelia4ev/nrf54l15/cpuapp @@ -55,45 +57,59 @@ tests: drivers.uart.uart_elementary_dual_nrf54l: filter: CONFIG_SERIAL_SUPPORT_INTERRUPT platform_allow: - - nrf54l09pdk/nrf54l09/cpuapp - - nrf54l09pdk/nrf54l09/cpuflpr - nrf54l15dk/nrf54l15/cpuapp - - nrf54l15dk/nrf54l15/cpuflpr + - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuflpr - ophelia4ev/nrf54l15/cpuapp - - ophelia4ev/nrf54l15/cpuflpr - extra_args: - - platform:nrf54l09pdk/nrf54l09/cpuapp:"DTC_OVERLAY_FILE=boards/nrf54l09pdk_nrf54l09_dual_uart.overlay" - - platform:nrf54l09pdk/nrf54l09/cpuflpr:"DTC_OVERLAY_FILE=boards/nrf54l09pdk_nrf54l09_dual_uart.overlay" - - platform:nrf54l15dk/nrf54l15/cpuapp:"DTC_OVERLAY_FILE=boards/nrf54l15dk_nrf54l15_dual_uart.overlay" - - platform:nrf54l15dk/nrf54l15/cpuflpr:"DTC_OVERLAY_FILE=boards/nrf54l15dk_nrf54l15_dual_uart.overlay" - - platform:nrf54lm20dk/nrf54lm20a/cpuapp:"DTC_OVERLAY_FILE=boards/nrf54lm20dk_nrf54lm20a_dual_uart.overlay" - - platform:nrf54lm20dk/nrf54lm20a/cpuflpr:"DTC_OVERLAY_FILE=boards/nrf54lm20dk_nrf54lm20a_dual_uart.overlay" - - platform:ophelia4ev/nrf54l15/cpuapp:"DTC_OVERLAY_FILE=boards/nrf54l15dk_nrf54l15_dual_uart.overlay" - - platform:ophelia4ev/nrf54l15/cpuflpr:"DTC_OVERLAY_FILE=boards/nrf54l15dk_nrf54l15_dual_uart.overlay" + extra_args: DTC_OVERLAY_FILE="boards/nrf54l15dk_nrf54l15_cpuapp_dual_uart.overlay" extra_configs: - CONFIG_DUAL_UART_TEST=y drivers.uart.uart_elementary_dual_setup_mismatch_nrf54l: filter: CONFIG_SERIAL_SUPPORT_INTERRUPT platform_allow: - - nrf54l09pdk/nrf54l09/cpuapp - - nrf54l09pdk/nrf54l09/cpuflpr - nrf54l15dk/nrf54l15/cpuapp - - nrf54l15dk/nrf54l15/cpuflpr + - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuflpr - ophelia4ev/nrf54l15/cpuapp + extra_args: DTC_OVERLAY_FILE="boards/nrf54l15dk_nrf54l15_cpuapp_dual_uart.overlay" + extra_configs: + - CONFIG_DUAL_UART_TEST=y + - CONFIG_SETUP_MISMATCH_TEST=y + drivers.uart.uart_elementary_dual_nrf54l_cpuflpr: + filter: CONFIG_SERIAL_SUPPORT_INTERRUPT + platform_allow: + - nrf54l15dk/nrf54l15/cpuflpr + - nrf54l20pdk/nrf54l20/cpuflpr + - nrf54lm20dk/nrf54lm20a/cpuflpr + - ophelia4ev/nrf54l15/cpuflpr + extra_args: DTC_OVERLAY_FILE="boards/nrf54l15dk_nrf54l15_cpuflpr_dual_uart.overlay" + extra_configs: + - CONFIG_DUAL_UART_TEST=y + drivers.uart.uart_elementary_dual_setup_mismatch_nrf54l_cpuflpr: + filter: CONFIG_SERIAL_SUPPORT_INTERRUPT + platform_allow: + - nrf54l15dk/nrf54l15/cpuflpr + - nrf54l20pdk/nrf54l20/cpuflpr + - nrf54lm20dk/nrf54lm20a/cpuflpr - ophelia4ev/nrf54l15/cpuflpr - extra_args: - - platform:nrf54l09pdk/nrf54l09/cpuapp:"DTC_OVERLAY_FILE=boards/nrf54l09pdk_nrf54l09_dual_uart.overlay" - - platform:nrf54l09pdk/nrf54l09/cpuflpr:"DTC_OVERLAY_FILE=boards/nrf54l09pdk_nrf54l09_dual_uart.overlay" - - platform:nrf54l15dk/nrf54l15/cpuapp:"DTC_OVERLAY_FILE=boards/nrf54l15dk_nrf54l15_dual_uart.overlay" - - platform:nrf54l15dk/nrf54l15/cpuflpr:"DTC_OVERLAY_FILE=boards/nrf54l15dk_nrf54l15_dual_uart.overlay" - - platform:nrf54lm20dk/nrf54lm20a/cpuapp:"DTC_OVERLAY_FILE=boards/nrf54lm20dk_nrf54lm20a_dual_uart.overlay" - - platform:nrf54lm20dk/nrf54lm20a/cpuflpr:"DTC_OVERLAY_FILE=boards/nrf54lm20dk_nrf54lm20a_dual_uart.overlay" - - platform:ophelia4ev/nrf54l15/cpuapp:"DTC_OVERLAY_FILE=boards/nrf54l15dk_nrf54l15_dual_uart.overlay" - - platform:ophelia4ev/nrf54l15/cpuflpr:"DTC_OVERLAY_FILE=boards/nrf54l15dk_nrf54l15_dual_uart.overlay" + extra_args: DTC_OVERLAY_FILE="boards/nrf54l15dk_nrf54l15_cpuflpr_dual_uart.overlay" + extra_configs: + - CONFIG_DUAL_UART_TEST=y + - CONFIG_SETUP_MISMATCH_TEST=y + drivers.uart.uart_elementary_dual_nrf54l09: + filter: CONFIG_SERIAL_SUPPORT_INTERRUPT + platform_allow: + - nrf54l09pdk/nrf54l09/cpuapp + - nrf54l09pdk/nrf54l09/cpuflpr + extra_args: DTC_OVERLAY_FILE="boards/nrf54l09pdk_nrf54l09_dual_uart.overlay" + extra_configs: + - CONFIG_DUAL_UART_TEST=y + drivers.uart.uart_elementary_dual_setup_mismatch_nrf54l09: + filter: CONFIG_SERIAL_SUPPORT_INTERRUPT + platform_allow: + - nrf54l09pdk/nrf54l09/cpuapp + - nrf54l09pdk/nrf54l09/cpuflpr + extra_args: DTC_OVERLAY_FILE="boards/nrf54l09pdk_nrf54l09_dual_uart.overlay" extra_configs: - CONFIG_DUAL_UART_TEST=y - CONFIG_SETUP_MISMATCH_TEST=y From 893d74fb567bc2c5cd90cc18bdbf45154f12a700 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:53 +0300 Subject: [PATCH 1272/2141] Revert "[nrf fromtree] tests: drivers: uart: uart_async_api: Cleanup after nRF54LM20 rename" This reverts commit 7ef16031c7ea9b925876bfff45746859f3927b79. Signed-off-by: Jukka Rissanen --- .../nrf54l20pdk_nrf54l20_cpuapp.overlay | 26 ++++++++++++ .../boards/nrf54lm20dk_nrf54lm20_common.dtsi | 6 --- .../boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf | 1 - ...f54lm20dk_nrf54lm20a_cpuapp_uart00.overlay | 42 ------------------- .../drivers/uart/uart_async_api/testcase.yaml | 8 ---- 5 files changed, 26 insertions(+), 57 deletions(-) create mode 100644 tests/drivers/uart/uart_async_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay delete mode 100644 tests/drivers/uart/uart_async_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf delete mode 100644 tests/drivers/uart/uart_async_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp_uart00.overlay diff --git a/tests/drivers/uart/uart_async_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/tests/drivers/uart/uart_async_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay new file mode 100644 index 000000000000..ed4a2de1891c --- /dev/null +++ b/tests/drivers/uart/uart_async_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay @@ -0,0 +1,26 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +&pinctrl { + uart21_default_alt: uart21_default_alt { + group1 { + psels = , + ; + }; + }; + + uart21_sleep_alt: uart21_sleep_alt { + group1 { + psels = , + ; + low-power-enable; + }; + }; +}; + +dut: &uart21 { + status = "okay"; + pinctrl-0 = <&uart21_default_alt>; + pinctrl-1 = <&uart21_sleep_alt>; + pinctrl-names = "default", "sleep"; + current-speed = <115200>; +}; diff --git a/tests/drivers/uart/uart_async_api/boards/nrf54lm20dk_nrf54lm20_common.dtsi b/tests/drivers/uart/uart_async_api/boards/nrf54lm20dk_nrf54lm20_common.dtsi index 8a8a0363b652..ec39ed93ecf4 100644 --- a/tests/drivers/uart/uart_async_api/boards/nrf54lm20dk_nrf54lm20_common.dtsi +++ b/tests/drivers/uart/uart_async_api/boards/nrf54lm20dk_nrf54lm20_common.dtsi @@ -1,9 +1,3 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - /* Test requires following loopback: * P1.13 - P1.14 */ diff --git a/tests/drivers/uart/uart_async_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf b/tests/drivers/uart/uart_async_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf deleted file mode 100644 index d70069646c93..000000000000 --- a/tests/drivers/uart/uart_async_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_VAR_LENGTH_BUFFER_TEST_BUADRATE_LIMIT=57600 diff --git a/tests/drivers/uart/uart_async_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp_uart00.overlay b/tests/drivers/uart/uart_async_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp_uart00.overlay deleted file mode 100644 index 5f129663e55e..000000000000 --- a/tests/drivers/uart/uart_async_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp_uart00.overlay +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/* Test requires following loopback: - * P2.02 - P2.00 - */ - -&pinctrl { - uart00_default_alt: uart00_default_alt { - group1 { - psels = ; - }; - - group2 { - psels = ; - bias-pull-up; - }; - }; - - uart00_sleep_alt: uart00_sleep_alt { - group1 { - psels = , - ; - low-power-enable; - }; - }; -}; - -dut: &uart00 { - status = "okay"; - pinctrl-0 = <&uart00_default_alt>; - pinctrl-1 = <&uart00_sleep_alt>; - pinctrl-names = "default", "sleep"; - current-speed = <4000000>; -}; - -&gpio2 { - status = "okay"; -}; diff --git a/tests/drivers/uart/uart_async_api/testcase.yaml b/tests/drivers/uart/uart_async_api/testcase.yaml index 3e6c28ddd390..efcf3af94534 100644 --- a/tests/drivers/uart/uart_async_api/testcase.yaml +++ b/tests/drivers/uart/uart_async_api/testcase.yaml @@ -18,14 +18,6 @@ tests: - platform:mimxrt685_evk/mimxrt685s/cm33:"DTC_OVERLAY_FILE=nxp/dut_flexcomm4.overlay" - platform:mimxrt595_evk/mimxrt595s/cm33:"DTC_OVERLAY_FILE=nxp/dut_flexcomm12.overlay" - platform:frdm_rw612/rw612:"DTC_OVERLAY_FILE=nxp/dut_lpc_flexcomm0.overlay" - drivers.uart.async_api.fast: - harness: ztest - harness_config: - fixture: uart_fast_loopback - platform_allow: - - nrf54lm20dk/nrf54lm20a/cpuapp - extra_args: - - DTC_OVERLAY_FILE="boards/nrf54lm20dk_nrf54lm20a_cpuapp_uart00.overlay" drivers.uart.wide: filter: CONFIG_SERIAL_SUPPORT_ASYNC and not CONFIG_UART_MCUX_LPUART harness: ztest From c8f94fef494d5ec89917bfa3ae90009049058b0b Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:53 +0300 Subject: [PATCH 1273/2141] Revert "[nrf fromtree] tests: drivers: uart: async_api: update wba55cg clock frequency" This reverts commit a835e255dbba7ab851e96432b55413f56c5a0c74. Signed-off-by: Jukka Rissanen --- .../uart/uart_async_api/boards/nucleo_wba55cg.overlay | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tests/drivers/uart/uart_async_api/boards/nucleo_wba55cg.overlay b/tests/drivers/uart/uart_async_api/boards/nucleo_wba55cg.overlay index df1b3856c1a8..9fc34bb26a2b 100644 --- a/tests/drivers/uart/uart_async_api/boards/nucleo_wba55cg.overlay +++ b/tests/drivers/uart/uart_async_api/boards/nucleo_wba55cg.overlay @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -&rcc { - clocks = <&clk_hsi>; - clock-frequency = ; -}; - dut: &lpuart1 { dmas = <&gpdma1 0 16 STM32_DMA_PERIPH_TX &gpdma1 1 15 STM32_DMA_PERIPH_RX>; From bd5f99a163dce19eee2804875fd1a943748b99f2 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:53 +0300 Subject: [PATCH 1274/2141] Revert "[nrf fromtree] tests: drivers: uart_async_api: add tx buffer in nocache memory" This reverts commit 33d8754094c1c047300546f2a3bdb2f9bf32f1b1. Signed-off-by: Jukka Rissanen --- tests/drivers/uart/uart_async_api/src/test_uart_async.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/tests/drivers/uart/uart_async_api/src/test_uart_async.c b/tests/drivers/uart/uart_async_api/src/test_uart_async.c index 936600c96fcb..4feec039001f 100644 --- a/tests/drivers/uart/uart_async_api/src/test_uart_async.c +++ b/tests/drivers/uart/uart_async_api/src/test_uart_async.c @@ -1068,12 +1068,7 @@ static void *var_buf_length_setup(void) static void test_uart_async_var_buf(size_t buf_len, size_t tx_len) { int ret; - -#if NOCACHE_MEM -static __aligned(sizeof(void *)) uint8_t tx_buffer[VAR_LENGTH_TX_BUF_SIZE] __used __NOCACHE; -#else -static ZTEST_BMEM uint8_t tx_buffer[VAR_LENGTH_TX_BUF_SIZE]; -#endif /* NOCACHE_MEM */ + uint8_t tx_buffer[VAR_LENGTH_TX_BUF_SIZE]; for (size_t i = 0; i < VAR_LENGTH_TX_BUF_SIZE; ++i) { tx_buffer[i] = tx_len; From 71527d0afb744125f2610ebe0ec33eb55cdc1254 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:53 +0300 Subject: [PATCH 1275/2141] Revert "[nrf fromtree] tests: drivers: uart: Add support test uart_async for ek_ra8p1" This reverts commit cb99f75b590c542056fa95e10a9d4d548a0b5542. Signed-off-by: Jukka Rissanen --- .../ek_ra8p1_r7ka8p1kflcac_cm85.overlay | 32 ------------------- 1 file changed, 32 deletions(-) delete mode 100644 tests/drivers/uart/uart_async_api/boards/ek_ra8p1_r7ka8p1kflcac_cm85.overlay diff --git a/tests/drivers/uart/uart_async_api/boards/ek_ra8p1_r7ka8p1kflcac_cm85.overlay b/tests/drivers/uart/uart_async_api/boards/ek_ra8p1_r7ka8p1kflcac_cm85.overlay deleted file mode 100644 index ac9bd7768dd0..000000000000 --- a/tests/drivers/uart/uart_async_api/boards/ek_ra8p1_r7ka8p1kflcac_cm85.overlay +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2025 Renesas Electronics Corporation - * SPDX-License-Identifier: Apache-2.0 - */ - -&pinctrl { - sci2_default: sci2_default { - group1 { - /* tx */ - psels = ; - drive-strength = "medium"; - }; - - group2 { - /* rx */ - psels = ; - }; - }; -}; - -&sci2 { - interrupts = <30 1>, <31 1>, <32 1>, <33 1>; - interrupt-names = "rxi", "txi", "tei", "eri"; - pinctrl-0 = <&sci2_default>; - pinctrl-names = "default"; - status = "okay"; - - dut: uart { - current-speed = <115200>; - status = "okay"; - }; -}; From 92a270bdf2786c90537bd3c620dab1399b46aedc Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:53 +0300 Subject: [PATCH 1276/2141] Revert "[nrf fromtree] tests: drivers: uart: async_api: add stm32u3 boards overlays" This reverts commit 276b5c7731a477e390486cb57d97b75b5303c00a. Signed-off-by: Jukka Rissanen --- .../uart_async_api/boards/nucleo_u385rg_q.overlay | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 tests/drivers/uart/uart_async_api/boards/nucleo_u385rg_q.overlay diff --git a/tests/drivers/uart/uart_async_api/boards/nucleo_u385rg_q.overlay b/tests/drivers/uart/uart_async_api/boards/nucleo_u385rg_q.overlay deleted file mode 100644 index 87bd131e1ca6..000000000000 --- a/tests/drivers/uart/uart_async_api/boards/nucleo_u385rg_q.overlay +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright (c) 2025 STMicroelectronics - * - * SPDX-License-Identifier: Apache-2.0 - */ - -dut: &lpuart1 { - dmas = <&gpdma1 0 35 STM32_DMA_PERIPH_TX - &gpdma1 1 34 STM32_DMA_PERIPH_RX>; - dma-names = "tx", "rx"; -}; - -&gpdma1 { - status = "okay"; -}; From 55e83e7ce2b2e768f37b44fba4b719fc7175b7e7 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:53 +0300 Subject: [PATCH 1277/2141] Revert "[nrf fromtree] tests: drivers: uart: async_api: Fix chain write" This reverts commit 097c8a28d1888f416411c9948d67806960d4fd93. Signed-off-by: Jukka Rissanen --- tests/drivers/uart/uart_async_api/src/test_uart_async.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/drivers/uart/uart_async_api/src/test_uart_async.c b/tests/drivers/uart/uart_async_api/src/test_uart_async.c index 4feec039001f..e08616566430 100644 --- a/tests/drivers/uart/uart_async_api/src/test_uart_async.c +++ b/tests/drivers/uart/uart_async_api/src/test_uart_async.c @@ -17,7 +17,7 @@ #define NOCACHE_MEM 0 #endif /* CONFIG_NOCACHE_MEMORY */ -K_SEM_DEFINE(tx_done, 0, 2); +K_SEM_DEFINE(tx_done, 0, 1); K_SEM_DEFINE(tx_aborted, 0, 1); K_SEM_DEFINE(rx_rdy, 0, 1); K_SEM_DEFINE(rx_buf_coherency, 0, 255); @@ -833,8 +833,8 @@ static void test_chained_write_callback(const struct device *dev, switch (evt->type) { case UART_TX_DONE: if (chained_write_next_buf) { - chained_write_next_buf = false; uart_tx(dev, chained_write_tx_bufs[1], 10, 100 * USEC_PER_MSEC); + chained_write_next_buf = false; } tx_sent = 1; k_sem_give(&tx_done); From 0a737f7d549b75dc48c41ad8fa098de86b42c6bc Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:53 +0300 Subject: [PATCH 1278/2141] Revert "[nrf fromtree] tests: drivers: spi: spi_loopback: Cleanup after nRF54LM20 rename" This reverts commit 90758227e5cb1fd6bc8a07c714b871ec9bfb9d61. Signed-off-by: Jukka Rissanen --- ...ay => nrf54l20pdk_nrf54l20_cpuapp.overlay} | 26 ++++++------------- .../boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf | 1 - .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 2 -- tests/drivers/spi/spi_loopback/testcase.yaml | 15 +++++------ 4 files changed, 15 insertions(+), 29 deletions(-) rename tests/drivers/spi/spi_loopback/boards/{nrf54lm20dk_nrf54lm20a_cpuapp_spi00.overlay => nrf54l20pdk_nrf54l20_cpuapp.overlay} (59%) delete mode 100644 tests/drivers/spi/spi_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf diff --git a/tests/drivers/spi/spi_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp_spi00.overlay b/tests/drivers/spi/spi_loopback/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay similarity index 59% rename from tests/drivers/spi/spi_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp_spi00.overlay rename to tests/drivers/spi/spi_loopback/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay index 2d1015eaf24b..48840969d8e6 100644 --- a/tests/drivers/spi/spi_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp_spi00.overlay +++ b/tests/drivers/spi/spi_loopback/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay @@ -4,28 +4,20 @@ * SPDX-License-Identifier: Apache-2.0 */ -/* Test requires following loopback: - * P2.02 - P2.04 - */ - &pinctrl { spi00_default: spi00_default { group1 { - psels = ; - }; - - group2 { - psels = , - ; - nordic,drive-mode = ; + psels = , + , + ; }; }; spi00_sleep: spi00_sleep { group1 { - psels = , - , - ; + psels = , + , + ; low-power-enable; }; }; @@ -38,17 +30,15 @@ pinctrl-names = "default", "sleep"; overrun-character = <0x00>; zephyr,pm-device-runtime-auto; - slow@0 { compatible = "test-spi-loopback-slow"; reg = <0>; - spi-max-frequency = ; + spi-max-frequency = ; }; - dut_fast: fast@0 { compatible = "test-spi-loopback-fast"; reg = <0>; - spi-max-frequency = ; + spi-max-frequency = ; }; }; diff --git a/tests/drivers/spi/spi_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf b/tests/drivers/spi/spi_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf deleted file mode 100644 index ad922ab8d26f..000000000000 --- a/tests/drivers/spi/spi_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_SPI_IDEAL_TRANSFER_DURATION_SCALING=12 diff --git a/tests/drivers/spi/spi_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/spi/spi_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay index 1dcb91c0f5be..d6e037cdbdfd 100644 --- a/tests/drivers/spi/spi_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ b/tests/drivers/spi/spi_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -34,13 +34,11 @@ pinctrl-names = "default", "sleep"; overrun-character = <0x00>; zephyr,pm-device-runtime-auto; - slow@0 { compatible = "test-spi-loopback-slow"; reg = <0>; spi-max-frequency = ; }; - dut_fast: fast@0 { compatible = "test-spi-loopback-fast"; reg = <0>; diff --git a/tests/drivers/spi/spi_loopback/testcase.yaml b/tests/drivers/spi/spi_loopback/testcase.yaml index 746cc03c81a8..e64aa8cdbf3e 100644 --- a/tests/drivers/spi/spi_loopback/testcase.yaml +++ b/tests/drivers/spi/spi_loopback/testcase.yaml @@ -238,6 +238,8 @@ tests: extra_args: EXTRA_DTC_OVERLAY_FILE="boards/nrf_at_1mhz.overlay" platform_allow: - nrf54l15dk/nrf54l15/cpuapp + - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp harness: console harness_config: fixture: spi_loopback @@ -248,26 +250,23 @@ tests: extra_args: EXTRA_DTC_OVERLAY_FILE="boards/nrf_at_8mhz.overlay" platform_allow: - nrf54l15dk/nrf54l15/cpuapp + - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp drivers.spi.nrf54l_16mhz: extra_args: EXTRA_DTC_OVERLAY_FILE="boards/nrf_at_16mhz.overlay" platform_allow: - nrf54l15dk/nrf54l15/cpuapp + - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp drivers.spi.nrf54l_32mhz: extra_args: EXTRA_DTC_OVERLAY_FILE="boards/nrf_at_32mhz.overlay" platform_allow: - nrf54l15dk/nrf54l15/cpuapp - - ophelia4ev/nrf54l15/cpuapp - drivers.spi.nrf54lm20_16mhz_32mhz: - harness: ztest - harness_config: - fixture: spi_fast_loopback - extra_args: - - DTC_OVERLAY_FILE="boards/nrf54lm20dk_nrf54lm20a_cpuapp_spi00.overlay" - platform_allow: + - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp + - ophelia4ev/nrf54l15/cpuapp drivers.spi.ke1xz_flexio_spi.loopback: extra_args: DTC_OVERLAY_FILE="boards/frdm_ke1xz_flexio_spi.overlay" filter: CONFIG_DT_HAS_NXP_FLEXIO_ENABLED and From c5e48b8907aa76de7dc3fa1e918de65cf9ca2090 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:53 +0300 Subject: [PATCH 1279/2141] Revert "[nrf fromtree] tests: spi_loopback: Fix same_buf_cmd test" This reverts commit ab75d58b5309dcf789dc5e8c044d0c2e6fc84d46. Signed-off-by: Jukka Rissanen --- tests/drivers/spi/spi_loopback/src/spi.c | 33 ++++++++++-------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/tests/drivers/spi/spi_loopback/src/spi.c b/tests/drivers/spi/spi_loopback/src/spi.c index bb8b9d283b28..e3ad4043c169 100644 --- a/tests/drivers/spi/spi_loopback/src/spi.c +++ b/tests/drivers/spi/spi_loopback/src/spi.c @@ -599,17 +599,18 @@ ZTEST(spi_loopback, test_nop_nil_bufs) /* nothing really to check here, check is done in spi_loopback_transceive */ } -/* test using the same buffer set for RX and TX will write same data back */ +/* test using the same buffer for RX and TX will write same data back */ ZTEST(spi_loopback, test_spi_write_back) { struct spi_dt_spec *spec = loopback_specs[spec_idx]; - - struct spi_buf buf = {.buf = buffer_rx, .len = BUF_SIZE}; - struct spi_buf_set set = {.buffers = &buf, .count = 1}; + const struct spi_buf_set tx = spi_loopback_setup_xfer(rx_bufs_pool, 1, + buffer_rx, BUF_SIZE); + const struct spi_buf_set rx = spi_loopback_setup_xfer(rx_bufs_pool, 1, + buffer_rx, BUF_SIZE); memcpy(buffer_rx, tx_data, sizeof(tx_data)); - spi_loopback_transceive(spec, &set, &set); + spi_loopback_transceive(spec, &tx, &rx); spi_loopback_compare_bufs(tx_data, buffer_rx, BUF_SIZE, buffer_print_tx, buffer_print_rx); @@ -619,25 +620,19 @@ ZTEST(spi_loopback, test_spi_write_back) ZTEST(spi_loopback, test_spi_same_buf_cmd) { struct spi_dt_spec *spec = loopback_specs[spec_idx]; + const struct spi_buf_set tx = spi_loopback_setup_xfer(rx_bufs_pool, 2, + buffer_rx, 1, + NULL, BUF_SIZE - 1); + const struct spi_buf_set rx = spi_loopback_setup_xfer(rx_bufs_pool, 1, + NULL, BUF_SIZE - 1, + buffer_rx+(BUF_SIZE - 1), 1); - struct spi_buf buf[2] = { - {.buf = buffer_rx, .len = 1}, - {.buf = buffer_rx+1, .len = BUF_SIZE - 1} - }; - - const struct spi_buf_set tx = {.buffers = buf, .count = 1}; - const struct spi_buf_set rx = {.buffers = buf, .count = 2}; - - memcpy(buffer_rx, tx_data, BUF_SIZE); + memcpy(buffer_rx, tx_data, sizeof(tx_data)); spi_loopback_transceive(spec, &tx, &rx); - spi_loopback_compare_bufs(tx_data, buffer_rx, 1, + spi_loopback_compare_bufs(tx_data, buffer_rx, BUF_SIZE, buffer_print_tx, buffer_print_rx); - - char zeros[BUF_SIZE - 1] = {0}; - - zassert_ok(memcmp(buffer_rx+1, zeros, BUF_SIZE - 1)); } From d4c5eb2a440a3819cdc58b317b91cf0f22eab1d2 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:53 +0300 Subject: [PATCH 1280/2141] Revert "[nrf fromtree] tests: spi_loopback: skip hold_on_cs test if not supported" This reverts commit d18433fbd8c74ffb1a4dd0234730fca12f322c81. Signed-off-by: Jukka Rissanen --- tests/drivers/spi/spi_loopback/src/spi.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/drivers/spi/spi_loopback/src/spi.c b/tests/drivers/spi/spi_loopback/src/spi.c index e3ad4043c169..9d6c8718472c 100644 --- a/tests/drivers/spi/spi_loopback/src/spi.c +++ b/tests/drivers/spi/spi_loopback/src/spi.c @@ -1017,8 +1017,6 @@ ZTEST(spi_extra_api_features, test_spi_hold_on_cs) early_exit: hold_spec->config.operation &= ~SPI_HOLD_ON_CS; zassert_false(ret, "SPI transceive failed, code %d", ret); - /* if there was no error then it was meant to be a skip at this point */ - ztest_test_skip(); } /* From 6a653a7292b80e7ce4db41bf93b8b35ff8fa27ff Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:53 +0300 Subject: [PATCH 1281/2141] Revert "[nrf fromtree] tests: drivers: spi: Add MAX32657 overlay files" This reverts commit 435493aecb400ded359d5026f3398357824d9227. Signed-off-by: Jukka Rissanen --- .../boards/max32657evkit_max32657.conf | 6 ----- .../boards/max32657evkit_max32657.overlay | 25 ------------------- .../boards/max32657evkit_max32657_ns.conf | 6 ----- .../boards/max32657evkit_max32657_ns.overlay | 18 ------------- 4 files changed, 55 deletions(-) delete mode 100644 tests/drivers/spi/spi_loopback/boards/max32657evkit_max32657.conf delete mode 100644 tests/drivers/spi/spi_loopback/boards/max32657evkit_max32657.overlay delete mode 100644 tests/drivers/spi/spi_loopback/boards/max32657evkit_max32657_ns.conf delete mode 100644 tests/drivers/spi/spi_loopback/boards/max32657evkit_max32657_ns.overlay diff --git a/tests/drivers/spi/spi_loopback/boards/max32657evkit_max32657.conf b/tests/drivers/spi/spi_loopback/boards/max32657evkit_max32657.conf deleted file mode 100644 index 87c673fcdaff..000000000000 --- a/tests/drivers/spi/spi_loopback/boards/max32657evkit_max32657.conf +++ /dev/null @@ -1,6 +0,0 @@ -# -# Copyright (c) 2024 Analog Devices, Inc. -# -# SPDX-License-Identifier: Apache-2.0 -# -CONFIG_SPI_MAX32_INTERRUPT=y diff --git a/tests/drivers/spi/spi_loopback/boards/max32657evkit_max32657.overlay b/tests/drivers/spi/spi_loopback/boards/max32657evkit_max32657.overlay deleted file mode 100644 index 83a4a0b60da6..000000000000 --- a/tests/drivers/spi/spi_loopback/boards/max32657evkit_max32657.overlay +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2024 Analog Devices, Inc. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&dma1 { - status = "okay"; -}; - -&spi0 { - dmas = <&dma1 1 MAX32_DMA_SLOT_SPI_TX>, <&dma1 2 MAX32_DMA_SLOT_SPI_RX>; - dma-names = "tx", "rx"; - - slow@1 { - compatible = "test-spi-loopback-slow"; - reg = <1>; - spi-max-frequency = <128000>; - }; - fast@1 { - compatible = "test-spi-loopback-fast"; - reg = <1>; - spi-max-frequency = <500000>; - }; -}; diff --git a/tests/drivers/spi/spi_loopback/boards/max32657evkit_max32657_ns.conf b/tests/drivers/spi/spi_loopback/boards/max32657evkit_max32657_ns.conf deleted file mode 100644 index 87c673fcdaff..000000000000 --- a/tests/drivers/spi/spi_loopback/boards/max32657evkit_max32657_ns.conf +++ /dev/null @@ -1,6 +0,0 @@ -# -# Copyright (c) 2024 Analog Devices, Inc. -# -# SPDX-License-Identifier: Apache-2.0 -# -CONFIG_SPI_MAX32_INTERRUPT=y diff --git a/tests/drivers/spi/spi_loopback/boards/max32657evkit_max32657_ns.overlay b/tests/drivers/spi/spi_loopback/boards/max32657evkit_max32657_ns.overlay deleted file mode 100644 index ee529c8bf487..000000000000 --- a/tests/drivers/spi/spi_loopback/boards/max32657evkit_max32657_ns.overlay +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright (c) 2024 Analog Devices, Inc. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&spi0 { - slow@1 { - compatible = "test-spi-loopback-slow"; - reg = <1>; - spi-max-frequency = <128000>; - }; - fast@1 { - compatible = "test-spi-loopback-fast"; - reg = <1>; - spi-max-frequency = <500000>; - }; -}; From afa181b0b37d416d8e003bae2457c91a2ffd0733 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:54 +0300 Subject: [PATCH 1282/2141] Revert "[nrf fromtree] tests: drivers: spi: spi_loopback: Add testcase for cc23x0" This reverts commit 3a1c2e37328d2be463d89734500f3cecff60881a. Signed-off-by: Jukka Rissanen --- .../spi_loopback/boards/lp_em_cc2340r5.conf | 1 - .../spi_loopback/boards/lp_em_cc2340r5.overlay | 18 ------------------ tests/drivers/spi/spi_loopback/testcase.yaml | 7 ------- 3 files changed, 26 deletions(-) delete mode 100644 tests/drivers/spi/spi_loopback/boards/lp_em_cc2340r5.conf delete mode 100644 tests/drivers/spi/spi_loopback/boards/lp_em_cc2340r5.overlay diff --git a/tests/drivers/spi/spi_loopback/boards/lp_em_cc2340r5.conf b/tests/drivers/spi/spi_loopback/boards/lp_em_cc2340r5.conf deleted file mode 100644 index 469620fed4e2..000000000000 --- a/tests/drivers/spi/spi_loopback/boards/lp_em_cc2340r5.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_SPI_LOOPBACK_MODE_LOOP=y diff --git a/tests/drivers/spi/spi_loopback/boards/lp_em_cc2340r5.overlay b/tests/drivers/spi/spi_loopback/boards/lp_em_cc2340r5.overlay deleted file mode 100644 index 98594dcc472d..000000000000 --- a/tests/drivers/spi/spi_loopback/boards/lp_em_cc2340r5.overlay +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright (c) 2024 BayLibre, SAS - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&spi0 { - slow@0 { - compatible = "test-spi-loopback-slow"; - reg = <0>; - spi-max-frequency = <2000000>; - }; - fast@0 { - compatible = "test-spi-loopback-fast"; - reg = <0>; - spi-max-frequency = <3000000>; - }; -}; diff --git a/tests/drivers/spi/spi_loopback/testcase.yaml b/tests/drivers/spi/spi_loopback/testcase.yaml index e64aa8cdbf3e..c92c763ec571 100644 --- a/tests/drivers/spi/spi_loopback/testcase.yaml +++ b/tests/drivers/spi/spi_loopback/testcase.yaml @@ -314,10 +314,3 @@ tests: filter: CONFIG_SOC_FAMILY_SILABS_SIWX91X platform_allow: - siwx917_rb4338a - drivers.spi.cc23x0.loopback.dma.no_async: - filter: CONFIG_SOC_FAMILY_TI_SIMPLELINK - platform_allow: - - lp_em_cc2340r5 - extra_configs: - - CONFIG_SPI_CC23X0_DMA_DRIVEN=y - - CONFIG_SPI_ASYNC=n From ad83338178492b1e0e1780c3b89a8332c8488f9e Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:54 +0300 Subject: [PATCH 1283/2141] Revert "[nrf fromtree] drivers: spi: nxp: fix PCS broken issue and PCS_HOLD_ON support" This reverts commit b2c404f595d756b94d5f94f6d46ceebbf3de434a. Signed-off-by: Jukka Rissanen --- drivers/spi/spi_nxp_lpspi/spi_nxp_lpspi_dma.c | 264 ++++++------------ .../mimxrt1060_evk_mimxrt1062_qspi_C.overlay | 1 - .../mimxrt1170_evk_mimxrt1176_cm7_A.overlay | 3 +- 3 files changed, 83 insertions(+), 185 deletions(-) diff --git a/drivers/spi/spi_nxp_lpspi/spi_nxp_lpspi_dma.c b/drivers/spi/spi_nxp_lpspi/spi_nxp_lpspi_dma.c index 0213a808afa7..5b14a66fc19c 100644 --- a/drivers/spi/spi_nxp_lpspi/spi_nxp_lpspi_dma.c +++ b/drivers/spi/spi_nxp_lpspi/spi_nxp_lpspi_dma.c @@ -1,5 +1,5 @@ /* - * Copyright 2018, 2024-2025 NXP + * Copyright 2018, 2024 NXP * * SPDX-License-Identifier: Apache-2.0 */ @@ -12,19 +12,6 @@ LOG_MODULE_DECLARE(spi_lpspi, CONFIG_SPI_LOG_LEVEL); #include #include "spi_nxp_lpspi_priv.h" -/* These states indicate what's the status of RX and TX, also synchronization - * status of DMA size of the next DMA transfer. - */ -typedef enum { - LPSPI_TRANSFER_STATE_NULL, - LPSPI_TRANSFER_STATE_ONGOING, - LPSPI_TRANSFER_STATE_NEXT_DMA_SIZE_UPDATED, - LPSPI_TRANSFER_STATE_TX_DONE, - LPSPI_TRANSFER_STATE_RX_DONE, - LPSPI_TRANSFER_STATE_RX_TX_DONE, - LPSPI_TRANSFER_STATE_INVALID = 0xFFFFFFFFUL, -} lpspi_transfer_state_t; - /* dummy memory used for transferring NOP when tx buf is null */ static uint32_t tx_nop_val; /* check compliance says no init to 0, but should be 0 in bss */ /* dummy memory for transferring to when RX buf is null */ @@ -35,58 +22,17 @@ struct spi_dma_stream { uint32_t channel; struct dma_config dma_cfg; struct dma_block_config dma_blk_cfg; + bool chunk_done; }; struct spi_nxp_dma_data { struct spi_dma_stream dma_rx; struct spi_dma_stream dma_tx; - - lpspi_transfer_state_t state; - /* This DMA size is used in callback function for RX and TX context update. - * because of old LPSPI IP limitation, RX complete depend on next TX DMA transfer start, - * so TX and RX not always start at the same time while we can only calculate DMA transfer - * size once and update the buffer pointers at the same time. - */ - size_t synchronize_dma_size; }; -/* - * Issue a TCR (Transmit Command Register) command to properly end RX DMA transfers - * on certain LPSPI versions. The behavior depends on: - * - * 1. LPSPI Hardware Version: - * - Version 1 (RT1170, RT10xx, Kinetis K series): TCR issue always required - * - Version 2 (RT1180, MCXN, RT700, K32W, S32K3xx, MCXL10): TCR issue not needed - * - * 2. SPI_HOLD_ON_CS Configuration: - * - If enabled: Keeps chip select (PCS) asserted between transfers - * - If disabled: Deasserts PCS after each transfer - * - * This function checks the LPSPI version and SPI_HOLD_ON_CS setting to determine - * if a TCR command is needed. For version 1, TCR is always issued. For version 2, - * TCR is only issued if SPI_HOLD_ON_CS is not set. Therefore, SPI_HOLD_ON_CS is not - * supported for version 1. - * - * The LPSPI version can be read from the VERID register, which is typically the - * first register in the memory map. - */ -static void spi_mcux_issue_TCR(const struct device *dev) -{ - LPSPI_Type *base = (LPSPI_Type *)DEVICE_MMIO_NAMED_GET(dev, reg_base); - const struct spi_config *spi_cfg = DEV_DATA(dev)->ctx.config; - uint8_t major_ver = (base->VERID & LPSPI_VERID_MAJOR_MASK) >> LPSPI_VERID_MAJOR_SHIFT; - - /* On old LPSPI versions, we always have to issue TCR, or transaction will never end. - * On a newer LPSPI version, only issue TCR when hold on CS feature is disabled. - */ - if (major_ver < 2 || !(spi_cfg->operation & SPI_HOLD_ON_CS)) { - base->TCR &= ~LPSPI_TCR_CONTC_MASK; - } -} - static struct dma_block_config *lpspi_dma_common_load(struct spi_dma_stream *stream, - const struct device *dev, const uint8_t *buf, - size_t len) + const struct device *dev, + const uint8_t *buf, size_t len) { struct dma_block_config *blk_cfg = &stream->dma_blk_cfg; @@ -145,35 +91,30 @@ static int lpspi_dma_rx_load(const struct device *dev, uint8_t *buf, size_t len) return dma_config(stream->dma_dev, stream->channel, &stream->dma_cfg); } -/* Return values: - * positive value if a data chunk is loaded successfully and return the data chunk size loaded; - * negative value if error happens and return the error code; - * 0 if no data is loaded; - */ -static int lpspi_dma_rxtx_load(const struct device *dev) +static inline int lpspi_dma_rxtx_load(const struct device *dev) { struct lpspi_data *data = dev->data; struct spi_nxp_dma_data *dma_data = (struct spi_nxp_dma_data *)data->driver_data; struct spi_dma_stream *rx = &dma_data->dma_rx; struct spi_dma_stream *tx = &dma_data->dma_tx; struct spi_context *ctx = &data->ctx; - size_t dma_size = spi_context_max_continuous_chunk(ctx); + size_t next_chunk_size = spi_context_max_continuous_chunk(ctx); int ret = 0; - if (dma_size == 0) { + if (next_chunk_size == 0) { /* In case both buffers are 0 length, we should not even be here * and attempting to set up a DMA transfer like this will cause * errors that lock up the system in some cases with eDMA. */ - return 0; + return -ENODATA; } - ret = lpspi_dma_tx_load(dev, ctx->tx_buf, dma_size); + ret = lpspi_dma_tx_load(dev, ctx->tx_buf, next_chunk_size); if (ret != 0) { return ret; } - ret = lpspi_dma_rx_load(dev, ctx->rx_buf, dma_size); + ret = lpspi_dma_rx_load(dev, ctx->rx_buf, next_chunk_size); if (ret != 0) { return ret; } @@ -183,17 +124,24 @@ static int lpspi_dma_rxtx_load(const struct device *dev) return ret; } - ret = dma_start(tx->dma_dev, tx->channel); - if (ret != 0) { - return ret; - } + return dma_start(tx->dma_dev, tx->channel); +} - return dma_size; +static int lpspi_dma_next_fill(const struct device *dev) +{ + struct lpspi_data *data = (struct lpspi_data *)dev->data; + struct spi_nxp_dma_data *dma_data = (struct spi_nxp_dma_data *)data->driver_data; + struct spi_dma_stream *rx = &dma_data->dma_rx; + struct spi_dma_stream *tx = &dma_data->dma_tx; + + rx->chunk_done = false; + tx->chunk_done = false; + + return lpspi_dma_rxtx_load(dev); } static void spi_mcux_dma_callback(const struct device *dev, void *arg, uint32_t channel, int status) { - /* arg directly holds the spi device */ const struct device *spi_dev = arg; LPSPI_Type *base = (LPSPI_Type *)DEVICE_MMIO_NAMED_GET(spi_dev, reg_base); struct lpspi_data *data = (struct lpspi_data *)spi_dev->data; @@ -201,98 +149,63 @@ static void spi_mcux_dma_callback(const struct device *dev, void *arg, uint32_t struct spi_dma_stream *rx = &dma_data->dma_rx; struct spi_dma_stream *tx = &dma_data->dma_tx; struct spi_context *ctx = &data->ctx; - char debug_char = (channel == dma_data->dma_tx.channel) ? 'T' : 'R'; - int ret = 0; + char debug_char; if (status < 0) { - ret = status; goto error; + } else { + /* don't care about positive values, normalize to "okay" = 0 */ + status = 0; } - if (channel != dma_data->dma_tx.channel && channel != dma_data->dma_rx.channel) { - ret = -EIO; + if (channel == rx->channel) { + spi_context_update_rx(ctx, 1, rx->dma_blk_cfg.block_size); + debug_char = 'R'; + rx->chunk_done = true; + } else if (channel == tx->channel) { + spi_context_update_tx(ctx, 1, tx->dma_blk_cfg.block_size); + debug_char = 'T'; + tx->chunk_done = true; + } else { + /* invalid channel */ + status = -EIO; goto error; } - switch (dma_data->state) { - case LPSPI_TRANSFER_STATE_ONGOING: - spi_context_update_tx(ctx, 1, tx->dma_blk_cfg.block_size); - spi_context_update_rx(ctx, 1, rx->dma_blk_cfg.block_size); - /* Calculate next DMA transfer size */ - dma_data->synchronize_dma_size = spi_context_max_continuous_chunk(ctx); - LOG_DBG("tx len:%d rx len:%d next dma size:%d", ctx->tx_len, ctx->rx_len, - dma_data->synchronize_dma_size); - if (dma_data->synchronize_dma_size > 0) { - ret = (channel == dma_data->dma_tx.channel) - ? lpspi_dma_tx_load(spi_dev, ctx->tx_buf, - dma_data->synchronize_dma_size) - : lpspi_dma_rx_load(spi_dev, ctx->rx_buf, - dma_data->synchronize_dma_size); - - if (ret != 0) { - goto error; - } - - ret = dma_start(dev, channel); - if (ret != 0) { - goto error; - } - dma_data->state = LPSPI_TRANSFER_STATE_NEXT_DMA_SIZE_UPDATED; - } else { - ret = dma_stop(dev, channel); - if (ret != 0) { - goto error; - } - /* This is the end of the transfer. */ - if (channel == dma_data->dma_tx.channel) { - spi_mcux_issue_TCR(spi_dev); - dma_data->state = LPSPI_TRANSFER_STATE_TX_DONE; - base->DER &= ~LPSPI_DER_TDDE_MASK; - } else { - dma_data->state = LPSPI_TRANSFER_STATE_RX_DONE; - base->DER &= ~LPSPI_DER_RDDE_MASK; - } - } - break; - case LPSPI_TRANSFER_STATE_NEXT_DMA_SIZE_UPDATED: - ret = (channel == dma_data->dma_tx.channel) - ? lpspi_dma_tx_load(spi_dev, ctx->tx_buf, - dma_data->synchronize_dma_size) - : lpspi_dma_rx_load(spi_dev, ctx->rx_buf, - dma_data->synchronize_dma_size); - dma_data->synchronize_dma_size = 0; - - if (ret != 0) { - goto error; - } - - ret = dma_start(dev, channel); - if (ret != 0) { - goto error; - } - dma_data->state = LPSPI_TRANSFER_STATE_ONGOING; - break; - - case LPSPI_TRANSFER_STATE_TX_DONE: - case LPSPI_TRANSFER_STATE_RX_DONE: - dma_data->state = LPSPI_TRANSFER_STATE_RX_TX_DONE; - /* TX and RX both done here. */ - spi_context_complete(ctx, spi_dev, 0); - spi_context_cs_control(ctx, false); - break; - - default: - LOG_ERR("unknown spi stransfer state:%d", dma_data->state); - ret = -EIO; + LOG_DBG("DMA %cX Block Complete", debug_char); + + /* wait for the other channel to finish if needed */ + if (!rx->chunk_done || !tx->chunk_done) { + return; + } + + + while ((IS_ENABLED(CONFIG_SOC_FAMILY_NXP_IMXRT) || + IS_ENABLED(CONFIG_SOC_FAMILY_KINETIS)) && + (base->SR & LPSPI_SR_MBF_MASK)) { + /* wait until module is idle */ + } + + if (spi_context_max_continuous_chunk(ctx) == 0) { + goto done; + } + + status = lpspi_dma_next_fill(spi_dev); + if (status) { goto error; } - LOG_DBG("DMA %cX Block Complete", debug_char); return; error: - LOG_ERR("DMA callback error with channel %d.", channel); - spi_context_complete(ctx, spi_dev, ret); + LOG_ERR("DMA callback error with channel %d err %d.", channel, status); +done: + base->DER &= ~(LPSPI_DER_TDDE_MASK | LPSPI_DER_RDDE_MASK); + base->TCR &= ~LPSPI_TCR_CONT_MASK; + lpspi_wait_tx_fifo_empty(spi_dev); spi_context_cs_control(ctx, false); + base->CR |= LPSPI_CR_RTF_MASK | LPSPI_CR_RRF_MASK; + spi_context_complete(ctx, spi_dev, status); + spi_context_release(ctx, status); } static int transceive_dma(const struct device *dev, const struct spi_config *spi_cfg, @@ -301,9 +214,7 @@ static int transceive_dma(const struct device *dev, const struct spi_config *spi { LPSPI_Type *base = (LPSPI_Type *)DEVICE_MMIO_NAMED_GET(dev, reg_base); struct lpspi_data *data = dev->data; - struct spi_nxp_dma_data *dma_data = (struct spi_nxp_dma_data *)data->driver_data; struct spi_context *ctx = &data->ctx; - uint8_t major_ver = (base->VERID & LPSPI_VERID_MAJOR_MASK) >> LPSPI_VERID_MAJOR_SHIFT; int ret; spi_context_lock(ctx, asynchronous, cb, userdata, spi_cfg); @@ -313,41 +224,30 @@ static int transceive_dma(const struct device *dev, const struct spi_config *spi goto out; } - /* Check CS hold on feature for DMA mode, it is not supported on some platform. */ - if ((spi_cfg->operation & SPI_HOLD_ON_CS) && major_ver < 2) { - LOG_ERR("SPI CS hold on feature is not supported on this platform."); - return -ENOTSUP; - } - - /* Always use continuous mode to satisfy SPI API requirements. */ - base->TCR |= LPSPI_TCR_CONT_MASK | LPSPI_TCR_CONTC_MASK; + spi_context_buffers_setup(ctx, tx_bufs, rx_bufs, 1); - /* Please set both watermarks as 0 because there are some synchronize requirements - * between RX and TX on RT platform. TX and RX DMA callback must be called in interleaved - * mode, a none-zero TX watermark may break this. - */ - base->FCR = LPSPI_FCR_TXWATER(0) | LPSPI_FCR_RXWATER(0); - spi_context_buffers_setup(&data->ctx, tx_bufs, rx_bufs, 1); - - /* Set next dma size is invalid. */ - dma_data->synchronize_dma_size = 0; - dma_data->state = LPSPI_TRANSFER_STATE_NULL; - - /* Load dma block */ - ret = lpspi_dma_rxtx_load(dev); - if (ret <= 0) { + ret = lpspi_dma_next_fill(dev); + if (ret == -ENODATA) { + /* No transfer to do? So just exit */ + ret = 0; + goto out; + } else if (ret) { goto out; } - dma_data->state = LPSPI_TRANSFER_STATE_ONGOING; - /* Set CS line just before DMA transfer. */ + if (!(IS_ENABLED(CONFIG_SOC_FAMILY_NXP_IMXRT) || IS_ENABLED(CONFIG_SOC_FAMILY_KINETIS))) { + base->TCR |= LPSPI_TCR_CONT_MASK; + } + spi_context_cs_control(ctx, true); - /* Enable DMA Requests */ + + base->CR |= LPSPI_CR_RTF_MASK | LPSPI_CR_RRF_MASK; + base->DER |= LPSPI_DER_TDDE_MASK | LPSPI_DER_RDDE_MASK; ret = spi_context_wait_for_completion(ctx); - if (ret) { - spi_context_cs_control(ctx, false); + if (ret >= 0) { + return ret; } out: spi_context_release(ctx, ret); diff --git a/tests/drivers/spi/spi_loopback/boards/mimxrt1060_evk_mimxrt1062_qspi_C.overlay b/tests/drivers/spi/spi_loopback/boards/mimxrt1060_evk_mimxrt1062_qspi_C.overlay index 328dd4198e0c..979062e18d9e 100644 --- a/tests/drivers/spi/spi_loopback/boards/mimxrt1060_evk_mimxrt1062_qspi_C.overlay +++ b/tests/drivers/spi/spi_loopback/boards/mimxrt1060_evk_mimxrt1062_qspi_C.overlay @@ -4,7 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/* Short J17-pin4 and J17-pin5, populate R356, R350,R346, R362 to enable Pins for SPI1. */ &lpspi1 { slow@0 { compatible = "test-spi-loopback-slow"; diff --git a/tests/drivers/spi/spi_loopback/boards/mimxrt1170_evk_mimxrt1176_cm7_A.overlay b/tests/drivers/spi/spi_loopback/boards/mimxrt1170_evk_mimxrt1176_cm7_A.overlay index 57f6c86b644d..bbddef98ad63 100644 --- a/tests/drivers/spi/spi_loopback/boards/mimxrt1170_evk_mimxrt1176_cm7_A.overlay +++ b/tests/drivers/spi/spi_loopback/boards/mimxrt1170_evk_mimxrt1176_cm7_A.overlay @@ -1,10 +1,9 @@ /* - * Copyright 2023, 2025 NXP + * Copyright 2023 NXP * * SPDX-License-Identifier: Apache-2.0 */ -/* Short J10-pin8 and J10-pin10. */ &lpspi1 { dmas = <&edma0 0 36>, <&edma0 1 37>; dma-names = "rx", "tx"; From cac87b74cc26337db159f57fbb708add6b7a2d72 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:54 +0300 Subject: [PATCH 1284/2141] Revert "[nrf fromtree] tests: drivers: spi_loopback: fix buffers alignment size" This reverts commit b5096ac80acf422a7312627b56ee0319f511fa83. Signed-off-by: Jukka Rissanen --- tests/drivers/spi/spi_loopback/src/spi.c | 39 +++++++++--------------- 1 file changed, 15 insertions(+), 24 deletions(-) diff --git a/tests/drivers/spi/spi_loopback/src/spi.c b/tests/drivers/spi/spi_loopback/src/spi.c index 9d6c8718472c..d3d44d79f466 100644 --- a/tests/drivers/spi/spi_loopback/src/spi.c +++ b/tests/drivers/spi/spi_loopback/src/spi.c @@ -66,49 +66,40 @@ const struct gpio_dt_spec mosi_pin = GPIO_DT_SPEC_GET_OR(DT_PATH(zephyr_user), m ******************** */ -#ifdef CONFIG_NOCACHE_MEMORY +#if CONFIG_NOCACHE_MEMORY #define __NOCACHE __attribute__((__section__(".nocache"))) #elif defined(CONFIG_DT_DEFINED_NOCACHE) #define __NOCACHE __attribute__((__section__(CONFIG_DT_DEFINED_NOCACHE_NAME))) #else /* CONFIG_NOCACHE_MEMORY */ #define __NOCACHE -#if CONFIG_DCACHE_LINE_SIZE != 0 -#define __BUF_ALIGN __aligned(CONFIG_DCACHE_LINE_SIZE) -#else -#define __BUF_ALIGN __aligned(DT_PROP_OR(DT_PATH(cpus, cpu_0), d_cache_line_size, 32)) -#endif #endif /* CONFIG_NOCACHE_MEMORY */ -#ifndef __BUF_ALIGN -#define __BUF_ALIGN __aligned(32) -#endif - #define BUF_SIZE 18 static const char tx_data[BUF_SIZE] = "0123456789abcdef-\0"; -static __BUF_ALIGN char buffer_tx[BUF_SIZE] __NOCACHE; -static __BUF_ALIGN char buffer_rx[BUF_SIZE] __NOCACHE; +static __aligned(32) char buffer_tx[BUF_SIZE] __NOCACHE; +static __aligned(32) char buffer_rx[BUF_SIZE] __NOCACHE; #define BUF2_SIZE 36 static const char tx2_data[BUF2_SIZE] = "Thequickbrownfoxjumpsoverthelazydog\0"; -static __BUF_ALIGN char buffer2_tx[BUF2_SIZE] __NOCACHE; -static __BUF_ALIGN char buffer2_rx[BUF2_SIZE] __NOCACHE; +static __aligned(32) char buffer2_tx[BUF2_SIZE] __NOCACHE; +static __aligned(32) char buffer2_rx[BUF2_SIZE] __NOCACHE; #define BUF3_SIZE CONFIG_SPI_LARGE_BUFFER_SIZE static const char large_tx_data[BUF3_SIZE] = "Thequickbrownfoxjumpsoverthelazydog\0"; -static __BUF_ALIGN char large_buffer_tx[BUF3_SIZE] __NOCACHE; -static __BUF_ALIGN char large_buffer_rx[BUF3_SIZE] __NOCACHE; +static __aligned(32) char large_buffer_tx[BUF3_SIZE] __NOCACHE; +static __aligned(32) char large_buffer_rx[BUF3_SIZE] __NOCACHE; #define BUFWIDE_SIZE 12 static const uint16_t tx_data_16[] = {0x1234, 0x5678, 0x9ABC, 0xDEF0, 0xFF00, 0x00FF, 0xAAAA, 0x5555, 0xF0F0, 0x0F0F, 0xA5A5, 0x5A5A}; -static __BUF_ALIGN uint16_t buffer_tx_16[BUFWIDE_SIZE] __NOCACHE; -static __BUF_ALIGN uint16_t buffer_rx_16[BUFWIDE_SIZE] __NOCACHE; +static __aligned(32) uint16_t buffer_tx_16[BUFWIDE_SIZE] __NOCACHE; +static __aligned(32) uint16_t buffer_rx_16[BUFWIDE_SIZE] __NOCACHE; static const uint32_t tx_data_32[] = {0x12345678, 0x56781234, 0x9ABCDEF0, 0xDEF09ABC, 0xFFFF0000, 0x0000FFFF, 0x00FF00FF, 0xFF00FF00, 0xAAAA5555, 0x5555AAAA, 0xAA55AA55, 0x55AA55AA}; -static __BUF_ALIGN uint32_t buffer_tx_32[BUFWIDE_SIZE] __NOCACHE; -static __BUF_ALIGN uint32_t buffer_rx_32[BUFWIDE_SIZE] __NOCACHE; +static __aligned(32) uint32_t buffer_tx_32[BUFWIDE_SIZE] __NOCACHE; +static __aligned(32) uint32_t buffer_rx_32[BUFWIDE_SIZE] __NOCACHE; /* ******************** @@ -676,7 +667,7 @@ ZTEST(spi_loopback, test_spi_word_size_9) { struct spi_dt_spec *spec = loopback_specs[spec_idx]; - static __BUF_ALIGN uint16_t tx_data_9[BUFWIDE_SIZE]; + static __aligned(32) uint16_t tx_data_9[BUFWIDE_SIZE]; for (int i = 0; i < BUFWIDE_SIZE; i++) { tx_data_9[i] = tx_data_16[i] & 0x1FF; @@ -700,7 +691,7 @@ ZTEST(spi_loopback, test_spi_word_size_24) { struct spi_dt_spec *spec = loopback_specs[spec_idx]; - static __BUF_ALIGN uint32_t tx_data_24[BUFWIDE_SIZE]; + static __aligned(32) uint32_t tx_data_24[BUFWIDE_SIZE]; for (int i = 0; i < BUFWIDE_SIZE; i++) { tx_data_24[i] = tx_data_32[i] & 0xFFFFFF; @@ -726,8 +717,8 @@ static struct k_thread thread[3]; static K_SEM_DEFINE(thread_sem, 0, 3); static K_SEM_DEFINE(sync_sem, 0, 1); -static uint8_t __BUF_ALIGN tx_buffer[3][32] __NOCACHE; -static uint8_t __BUF_ALIGN rx_buffer[3][32] __NOCACHE; +static uint8_t __aligned(32) tx_buffer[3][32] __NOCACHE; +static uint8_t __aligned(32) rx_buffer[3][32] __NOCACHE; atomic_t thread_test_fails; From a2f7d98acf56cae458e653b28f0bf8e4883cfee9 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:54 +0300 Subject: [PATCH 1285/2141] Revert "[nrf fromtree] tests: drivers: spi: Add support spi_loopback for ek_ra8p1" This reverts commit ee516c959a47e42c62ff8504b475b0f400fc6faf. Signed-off-by: Jukka Rissanen --- .../boards/ek_ra8p1_r7ka8p1kflcac_cm85.conf | 6 ----- .../ek_ra8p1_r7ka8p1kflcac_cm85.overlay | 23 ------------------- 2 files changed, 29 deletions(-) delete mode 100644 tests/drivers/spi/spi_loopback/boards/ek_ra8p1_r7ka8p1kflcac_cm85.conf delete mode 100644 tests/drivers/spi/spi_loopback/boards/ek_ra8p1_r7ka8p1kflcac_cm85.overlay diff --git a/tests/drivers/spi/spi_loopback/boards/ek_ra8p1_r7ka8p1kflcac_cm85.conf b/tests/drivers/spi/spi_loopback/boards/ek_ra8p1_r7ka8p1kflcac_cm85.conf deleted file mode 100644 index 9c7b8ccf32d3..000000000000 --- a/tests/drivers/spi/spi_loopback/boards/ek_ra8p1_r7ka8p1kflcac_cm85.conf +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright (c) 2025 Renesas Electronics Corporation -# SPDX-License-Identifier: Apache-2.0 - -CONFIG_SPI_LOOPBACK_MODE_LOOP=y -CONFIG_SPI_B_INTERRUPT=y -CONFIG_SPI_B_RA_DTC=y diff --git a/tests/drivers/spi/spi_loopback/boards/ek_ra8p1_r7ka8p1kflcac_cm85.overlay b/tests/drivers/spi/spi_loopback/boards/ek_ra8p1_r7ka8p1kflcac_cm85.overlay deleted file mode 100644 index 69a4204a1ab9..000000000000 --- a/tests/drivers/spi/spi_loopback/boards/ek_ra8p1_r7ka8p1kflcac_cm85.overlay +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2025 Renesas Electronics Corporation - * SPDX-License-Identifier: Apache-2.0 - */ - -#include - -&spi1 { - rx-dtc; - tx-dtc; - - slow@0 { - compatible = "test-spi-loopback-slow"; - reg = <0>; - spi-max-frequency = <2000000>; - }; - - fast@0 { - compatible = "test-spi-loopback-fast"; - reg = <0>; - spi-max-frequency = <3000000>; - }; -}; From 548714463a51ba9b9971c7f7ec733b22e64d75ba Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:54 +0300 Subject: [PATCH 1286/2141] Revert "[nrf fromtree] tests: drivers: spi: Add support ek_ra2l1 for spi_loopback test" This reverts commit 7d1b3d22d979ddfee148236d6664ac7e1d2f3202. Signed-off-by: Jukka Rissanen --- .../spi/spi_loopback/boards/ek_ra2l1.conf | 3 -- .../spi/spi_loopback/boards/ek_ra2l1.overlay | 45 ------------------- 2 files changed, 48 deletions(-) delete mode 100644 tests/drivers/spi/spi_loopback/boards/ek_ra2l1.conf delete mode 100644 tests/drivers/spi/spi_loopback/boards/ek_ra2l1.overlay diff --git a/tests/drivers/spi/spi_loopback/boards/ek_ra2l1.conf b/tests/drivers/spi/spi_loopback/boards/ek_ra2l1.conf deleted file mode 100644 index 65750ba31314..000000000000 --- a/tests/drivers/spi/spi_loopback/boards/ek_ra2l1.conf +++ /dev/null @@ -1,3 +0,0 @@ -CONFIG_SPI_LOOPBACK_MODE_LOOP=y -CONFIG_SPI_INTERRUPT=y -CONFIG_SPI_RA_DTC=y diff --git a/tests/drivers/spi/spi_loopback/boards/ek_ra2l1.overlay b/tests/drivers/spi/spi_loopback/boards/ek_ra2l1.overlay deleted file mode 100644 index b87c78182093..000000000000 --- a/tests/drivers/spi/spi_loopback/boards/ek_ra2l1.overlay +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2025 Renesas Electronics Corporation - * SPDX-License-Identifier: Apache-2.0 - */ - -&spi0 { - rx-dtc; - tx-dtc; - - slow@0 { - compatible = "test-spi-loopback-slow"; - reg = <0>; - spi-max-frequency = <2000000>; - }; - - fast@0 { - compatible = "test-spi-loopback-fast"; - reg = <0>; - spi-max-frequency = <3000000>; - }; -}; - -&pinctrl { - spi0_default: spi0_default { - group1 { - /* MISO MOSI RSPCK */ - psels = , - , - ; - }; - }; -}; - -&spi0 { - pinctrl-0 = <&spi0_default>; - pinctrl-names = "default"; - cs-gpios = <&ioport1 3 GPIO_ACTIVE_LOW>; - interrupts = <8 1>, <9 1>, <10 1>, <19 1>; - interrupt-names = "rxi", "txi", "tei", "eri"; - status = "okay"; -}; - -&ioport1 { - status = "okay"; -}; From 352b858b5b2f194c4234a03c63a54667ebc49c71 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:54 +0300 Subject: [PATCH 1287/2141] Revert "[nrf fromtree] tests: spi: siwx91x: board config file update" This reverts commit 0bf0e5f93631b88423352d666464e05a5aa41b77. Signed-off-by: Jukka Rissanen --- tests/drivers/spi/spi_loopback/boards/siwx917_rb4338a.conf | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/drivers/spi/spi_loopback/boards/siwx917_rb4338a.conf b/tests/drivers/spi/spi_loopback/boards/siwx917_rb4338a.conf index 940add570e6f..368ff560c98f 100644 --- a/tests/drivers/spi/spi_loopback/boards/siwx917_rb4338a.conf +++ b/tests/drivers/spi/spi_loopback/boards/siwx917_rb4338a.conf @@ -1,2 +1 @@ CONFIG_SPI_SILABS_SIWX91X_GSPI_DMA=y -CONFIG_SPI_IDEAL_TRANSFER_DURATION_SCALING=24 From 44d425f3a11d6e1b41a001b98031b49aa19df49d Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:54 +0300 Subject: [PATCH 1288/2141] Revert "[nrf fromtree] tests: drivers: spi: remove useless files and testcases" This reverts commit d72989085916b3200a8421ff3562b041be8cbeea. Signed-off-by: Jukka Rissanen --- ...y-stm32-spi-16bits-dma-dt-nocache-mem.conf | 14 ++++++ .../overlay-stm32-spi-16bits-dma.conf | 11 +++++ .../overlay-stm32-spi-16bits.conf | 6 +++ .../overlay-stm32-spi-16bits.overlay | 43 +++++++++++++++++++ tests/drivers/spi/spi_loopback/testcase.yaml | 34 +++++++++++++++ 5 files changed, 108 insertions(+) create mode 100644 tests/drivers/spi/spi_loopback/overlay-stm32-spi-16bits-dma-dt-nocache-mem.conf create mode 100644 tests/drivers/spi/spi_loopback/overlay-stm32-spi-16bits-dma.conf create mode 100644 tests/drivers/spi/spi_loopback/overlay-stm32-spi-16bits.conf create mode 100644 tests/drivers/spi/spi_loopback/overlay-stm32-spi-16bits.overlay diff --git a/tests/drivers/spi/spi_loopback/overlay-stm32-spi-16bits-dma-dt-nocache-mem.conf b/tests/drivers/spi/spi_loopback/overlay-stm32-spi-16bits-dma-dt-nocache-mem.conf new file mode 100644 index 000000000000..4bb96e35f58f --- /dev/null +++ b/tests/drivers/spi/spi_loopback/overlay-stm32-spi-16bits-dma-dt-nocache-mem.conf @@ -0,0 +1,14 @@ +# +# Copyright (c) 2023 Graphcore Ltd, All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# + +# enable DMA mode for SPI loopback test +CONFIG_SPI_STM32_DMA=y +CONFIG_SPI_STM32_INTERRUPT=n +CONFIG_SPI_ASYNC=n +CONFIG_NOCACHE_MEMORY=n +CONFIG_DT_DEFINED_NOCACHE=y +CONFIG_DT_DEFINED_NOCACHE_NAME="SRAM2" +CONFIG_SPI_LOOPBACK_16BITS_FRAMES=y diff --git a/tests/drivers/spi/spi_loopback/overlay-stm32-spi-16bits-dma.conf b/tests/drivers/spi/spi_loopback/overlay-stm32-spi-16bits-dma.conf new file mode 100644 index 000000000000..c49efea868aa --- /dev/null +++ b/tests/drivers/spi/spi_loopback/overlay-stm32-spi-16bits-dma.conf @@ -0,0 +1,11 @@ +# +# Copyright (c) 2023 Graphcore Ltd, All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# + +# enable DMA mode for SPI loopback test +CONFIG_SPI_STM32_DMA=y +CONFIG_SPI_STM32_INTERRUPT=n +CONFIG_SPI_ASYNC=n +CONFIG_SPI_LOOPBACK_16BITS_FRAMES=y diff --git a/tests/drivers/spi/spi_loopback/overlay-stm32-spi-16bits.conf b/tests/drivers/spi/spi_loopback/overlay-stm32-spi-16bits.conf new file mode 100644 index 000000000000..00ca04782b48 --- /dev/null +++ b/tests/drivers/spi/spi_loopback/overlay-stm32-spi-16bits.conf @@ -0,0 +1,6 @@ +# +# Copyright (c) 2023 Graphcore Ltd, All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +CONFIG_SPI_LOOPBACK_16BITS_FRAMES=y diff --git a/tests/drivers/spi/spi_loopback/overlay-stm32-spi-16bits.overlay b/tests/drivers/spi/spi_loopback/overlay-stm32-spi-16bits.overlay new file mode 100644 index 000000000000..b2df25ac8609 --- /dev/null +++ b/tests/drivers/spi/spi_loopback/overlay-stm32-spi-16bits.overlay @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2023 Graphcore Ltd, All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* Set div-q to get test clk freq into acceptable SPI freq range */ +&pll { + /delete-property/ div-q; + div-q = <8>; +}; + +&sram2 { + zephyr,memory-attr = < DT_MEM_ARM(ATTR_MPU_RAM_NOCACHE) >; +}; + +&spi1 { + dmas = <&dmamux1 0 38 (STM32_DMA_PERIPH_TX | STM32_DMA_PRIORITY_HIGH | STM32_DMA_MEM_16BITS | STM32_DMA_PERIPH_16BITS) + &dmamux1 1 37 (STM32_DMA_PERIPH_RX | STM32_DMA_PRIORITY_HIGH | STM32_DMA_MEM_16BITS | STM32_DMA_PERIPH_16BITS)>; + dma-names = "tx", "rx"; + slow@0 { + compatible = "test-spi-loopback-slow"; + reg = <0>; + spi-max-frequency = <500000>; + }; + fast@0 { + compatible = "test-spi-loopback-fast"; + reg = <0>; + spi-max-frequency = <16000000>; + }; +}; + +&dma1 { + status = "okay"; +}; + +&dma2 { + status = "okay"; +}; + +&dmamux1 { + status = "okay"; +}; diff --git a/tests/drivers/spi/spi_loopback/testcase.yaml b/tests/drivers/spi/spi_loopback/testcase.yaml index c92c763ec571..ab3322a8d1fa 100644 --- a/tests/drivers/spi/spi_loopback/testcase.yaml +++ b/tests/drivers/spi/spi_loopback/testcase.yaml @@ -51,6 +51,17 @@ tests: - robokit1 integration_platforms: - sam_e70_xplained/same70q21 + drivers.spi.stm32_spi_16bits_frames.loopback: + extra_args: + - EXTRA_CONF_FILE="overlay-stm32-spi-16bits.conf" + - DTC_OVERLAY_FILE="overlay-stm32-spi-16bits.overlay" + platform_allow: + - nucleo_h743zi + - nucleo_h753zi + - nucleo_h745zi_q/stm32h745xx/m4 + - nucleo_h745zi_q/stm32h745xx/m7 + integration_platforms: + - nucleo_h743zi drivers.spi.stm32_spi_dma.loopback: extra_args: EXTRA_CONF_FILE="overlay-stm32-spi-dma.conf" platform_allow: @@ -87,6 +98,29 @@ tests: - nucleo_h745zi_q/stm32h745xx/m7 integration_platforms: - nucleo_h743zi + drivers.spi.stm32_spi_16bits_frames_dma.loopback: + extra_args: + - EXTRA_CONF_FILE="overlay-stm32-spi-16bits-dma.conf" + - DTC_OVERLAY_FILE="overlay-stm32-spi-16bits.overlay" + platform_allow: + - nucleo_h743zi + - nucleo_h753zi + - nucleo_h745zi_q/stm32h745xx/m4 + - nucleo_h745zi_q/stm32h745xx/m7 + integration_platforms: + - nucleo_h743zi + drivers.spi.stm32_spi_16bits_frames_dma_dt_nocache_mem.loopback: + extra_args: + - EXTRA_CONF_FILE="overlay-stm32-spi-16bits-dma-dt-nocache-mem.conf" + - DTC_OVERLAY_FILE="overlay-stm32-spi-16bits.overlay" + filter: CONFIG_CPU_HAS_DCACHE + platform_allow: + - nucleo_h743zi + - nucleo_h753zi + - nucleo_h745zi_q/stm32h745xx/m4 + - nucleo_h745zi_q/stm32h745xx/m7 + integration_platforms: + - nucleo_h743zi drivers.spi.stm32_spi_interrupt.loopback: extra_args: EXTRA_CONF_FILE="overlay-stm32-spi-interrupt.conf" platform_allow: From 2927fd1c5e2742eec44e355c2d30e3c2b72c8c21 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:54 +0300 Subject: [PATCH 1289/2141] Revert "[nrf fromtree] tests: drivers: spi: spi_loopback: handle rx/tx buffers nocache memory" This reverts commit af7a24bd8ce22d3c3a8e382f400e0dbaa664dd1f. Signed-off-by: Jukka Rissanen --- tests/drivers/spi/spi_loopback/src/spi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/drivers/spi/spi_loopback/src/spi.c b/tests/drivers/spi/spi_loopback/src/spi.c index d3d44d79f466..1e6b99ae9477 100644 --- a/tests/drivers/spi/spi_loopback/src/spi.c +++ b/tests/drivers/spi/spi_loopback/src/spi.c @@ -717,8 +717,8 @@ static struct k_thread thread[3]; static K_SEM_DEFINE(thread_sem, 0, 3); static K_SEM_DEFINE(sync_sem, 0, 1); -static uint8_t __aligned(32) tx_buffer[3][32] __NOCACHE; -static uint8_t __aligned(32) rx_buffer[3][32] __NOCACHE; +static uint8_t __aligned(32) tx_buffer[3][32]; +static uint8_t __aligned(32) rx_buffer[3][32]; atomic_t thread_test_fails; From 6fce6aa6054b4f89cacff087a35a4f44ef058ec6 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:54 +0300 Subject: [PATCH 1290/2141] Revert "[nrf fromtree] tests: drivers: spi_loopback: add latency tolerance for some boards" This reverts commit 9f79c54364bb75b24ccc7ada1de620da21bbf945. Signed-off-by: Jukka Rissanen --- tests/drivers/spi/spi_loopback/boards/nucleo_c071rb.conf | 1 - tests/drivers/spi/spi_loopback/boards/nucleo_f746zg.conf | 1 - tests/drivers/spi/spi_loopback/boards/nucleo_wb55rg.conf | 1 - tests/drivers/spi/spi_loopback/boards/nucleo_wba55cg.conf | 1 - tests/drivers/spi/spi_loopback/boards/nucleo_wl55jc.conf | 1 - tests/drivers/spi/spi_loopback/boards/stm32f3_disco.conf | 1 - 6 files changed, 6 deletions(-) delete mode 100644 tests/drivers/spi/spi_loopback/boards/nucleo_wb55rg.conf delete mode 100644 tests/drivers/spi/spi_loopback/boards/nucleo_wba55cg.conf delete mode 100644 tests/drivers/spi/spi_loopback/boards/nucleo_wl55jc.conf diff --git a/tests/drivers/spi/spi_loopback/boards/nucleo_c071rb.conf b/tests/drivers/spi/spi_loopback/boards/nucleo_c071rb.conf index 093e1f09d89d..895eddcb0c02 100644 --- a/tests/drivers/spi/spi_loopback/boards/nucleo_c071rb.conf +++ b/tests/drivers/spi/spi_loopback/boards/nucleo_c071rb.conf @@ -1,2 +1 @@ CONFIG_SPI_LARGE_BUFFER_SIZE=4500 -CONFIG_SPI_IDEAL_TRANSFER_DURATION_SCALING=20 diff --git a/tests/drivers/spi/spi_loopback/boards/nucleo_f746zg.conf b/tests/drivers/spi/spi_loopback/boards/nucleo_f746zg.conf index 72f647378205..c448e14811f7 100644 --- a/tests/drivers/spi/spi_loopback/boards/nucleo_f746zg.conf +++ b/tests/drivers/spi/spi_loopback/boards/nucleo_f746zg.conf @@ -1,2 +1 @@ CONFIG_NOCACHE_MEMORY=y -CONFIG_SPI_IDEAL_TRANSFER_DURATION_SCALING=10 diff --git a/tests/drivers/spi/spi_loopback/boards/nucleo_wb55rg.conf b/tests/drivers/spi/spi_loopback/boards/nucleo_wb55rg.conf deleted file mode 100644 index a527ab8f28d1..000000000000 --- a/tests/drivers/spi/spi_loopback/boards/nucleo_wb55rg.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_SPI_IDEAL_TRANSFER_DURATION_SCALING=22 diff --git a/tests/drivers/spi/spi_loopback/boards/nucleo_wba55cg.conf b/tests/drivers/spi/spi_loopback/boards/nucleo_wba55cg.conf deleted file mode 100644 index 1753e2d75c3c..000000000000 --- a/tests/drivers/spi/spi_loopback/boards/nucleo_wba55cg.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_SPI_IDEAL_TRANSFER_DURATION_SCALING=50 diff --git a/tests/drivers/spi/spi_loopback/boards/nucleo_wl55jc.conf b/tests/drivers/spi/spi_loopback/boards/nucleo_wl55jc.conf deleted file mode 100644 index 725924348b53..000000000000 --- a/tests/drivers/spi/spi_loopback/boards/nucleo_wl55jc.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_SPI_IDEAL_TRANSFER_DURATION_SCALING=15 diff --git a/tests/drivers/spi/spi_loopback/boards/stm32f3_disco.conf b/tests/drivers/spi/spi_loopback/boards/stm32f3_disco.conf index 016bb0000d97..469620fed4e2 100644 --- a/tests/drivers/spi/spi_loopback/boards/stm32f3_disco.conf +++ b/tests/drivers/spi/spi_loopback/boards/stm32f3_disco.conf @@ -1,2 +1 @@ CONFIG_SPI_LOOPBACK_MODE_LOOP=y -CONFIG_SPI_IDEAL_TRANSFER_DURATION_SCALING=15 From 2500c9df4f217277e7ecaea78dcd4b67c220c429 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:54 +0300 Subject: [PATCH 1291/2141] Revert "[nrf fromtree] tests: drivers: spi: spi_loopback: enable nucleo_c071rb to run test again" This reverts commit 3591996aab8a02ed34945283da4fac64fb72fec9. Signed-off-by: Jukka Rissanen --- tests/drivers/spi/spi_loopback/boards/nucleo_c071rb.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/drivers/spi/spi_loopback/boards/nucleo_c071rb.conf b/tests/drivers/spi/spi_loopback/boards/nucleo_c071rb.conf index 895eddcb0c02..5e05f18f57a0 100644 --- a/tests/drivers/spi/spi_loopback/boards/nucleo_c071rb.conf +++ b/tests/drivers/spi/spi_loopback/boards/nucleo_c071rb.conf @@ -1 +1 @@ -CONFIG_SPI_LARGE_BUFFER_SIZE=4500 +CONFIG_SPI_LARGE_BUFFER_SIZE=8000 From da27de3a51f9668d1e7522226c112682e54e9d7f Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:54 +0300 Subject: [PATCH 1292/2141] Revert "[nrf fromtree] tests: drivers: spi: spi_loopback: Add NULL spi_buf_set test" This reverts commit fb2fba2bdbeb9c5e128f1ac0cb597163cef0c8df. Signed-off-by: Jukka Rissanen --- tests/drivers/spi/spi_loopback/src/spi.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/tests/drivers/spi/spi_loopback/src/spi.c b/tests/drivers/spi/spi_loopback/src/spi.c index 1e6b99ae9477..39a2efb94647 100644 --- a/tests/drivers/spi/spi_loopback/src/spi.c +++ b/tests/drivers/spi/spi_loopback/src/spi.c @@ -572,13 +572,6 @@ ZTEST(spi_loopback, test_spi_null_rx_buf_set) spi_loopback_transceive(spec, &tx, NULL); } -ZTEST(spi_loopback, test_spi_null_tx_rx_buf_set) -{ - struct spi_dt_spec *spec = loopback_specs[spec_idx]; - - spi_loopback_transceive(spec, NULL, NULL); -} - ZTEST(spi_loopback, test_nop_nil_bufs) { struct spi_dt_spec *spec = loopback_specs[spec_idx]; From 76d67552b32e141197c92d589c298bf913a5c6b2 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:54 +0300 Subject: [PATCH 1293/2141] Revert "[nrf fromtree] tests: spi: loopback: get spi controller before timed transfer" This reverts commit 5336faa47576ef444d8dd58c8ad00310a427bae3. Signed-off-by: Jukka Rissanen --- tests/drivers/spi/spi_loopback/src/spi.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/tests/drivers/spi/spi_loopback/src/spi.c b/tests/drivers/spi/spi_loopback/src/spi.c index 39a2efb94647..4a744bf35547 100644 --- a/tests/drivers/spi/spi_loopback/src/spi.c +++ b/tests/drivers/spi/spi_loopback/src/spi.c @@ -293,19 +293,11 @@ ZTEST(spi_loopback, test_spi_complete_multiple_timed) uint32_t start_time, end_time, cycles_spent; uint64_t time_spent_us, expected_transfer_time_us, latency_measurement; - /* - * spi_loopback_transceive() does an inline pm_device_runtime_get(), but since we are - * timing the transfer, we need to get the SPI controller before we start the measurement. - */ - zassert_ok(pm_device_runtime_get(spec->bus)); - /* since this is a test program, there shouldn't be much to interfere with measurement */ start_time = k_cycle_get_32(); spi_loopback_transceive(spec, &tx, &rx); end_time = k_cycle_get_32(); - zassert_ok(pm_device_runtime_put(spec->bus)); - if (end_time >= start_time) { cycles_spent = end_time - start_time; } else { From c5cfa57b438abb6a499809c8e6924c368fd9693b Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:54 +0300 Subject: [PATCH 1294/2141] Revert "[nrf fromtree] tests: drivers: spi: Add configuration for SPI test on RX130" This reverts commit 3bdeaeaa7108ed383e4db88730c5df1c26a93036. Signed-off-by: Jukka Rissanen --- .../spi_loopback/boards/rsk_rx130_512kb.overlay | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 tests/drivers/spi/spi_loopback/boards/rsk_rx130_512kb.overlay diff --git a/tests/drivers/spi/spi_loopback/boards/rsk_rx130_512kb.overlay b/tests/drivers/spi/spi_loopback/boards/rsk_rx130_512kb.overlay deleted file mode 100644 index ae5393b88116..000000000000 --- a/tests/drivers/spi/spi_loopback/boards/rsk_rx130_512kb.overlay +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (c) 2025 Renesas Electronics Corporation - * SPDX-License-Identifier: Apache-2.0 - */ - -&rspi0 { - slow@0 { - compatible = "test-spi-loopback-slow"; - reg = <0>; - spi-max-frequency = <1000000>; - }; - fast@0 { - compatible = "test-spi-loopback-fast"; - reg = <0>; - spi-max-frequency = <3000000>; - }; -}; From 74868dfba00d8ba4f685f50cb2b0520783778265 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:54 +0300 Subject: [PATCH 1295/2141] Revert "[nrf fromtree] tests: drivers: spi_loopback: Fix NULL rx buff testcase" This reverts commit fd0737fb29668f75a520d45d82e10693890e757c. Signed-off-by: Jukka Rissanen --- tests/drivers/spi/spi_loopback/src/spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/drivers/spi/spi_loopback/src/spi.c b/tests/drivers/spi/spi_loopback/src/spi.c index 4a744bf35547..fd2302a4ec0b 100644 --- a/tests/drivers/spi/spi_loopback/src/spi.c +++ b/tests/drivers/spi/spi_loopback/src/spi.c @@ -559,7 +559,7 @@ ZTEST(spi_loopback, test_spi_null_rx_buf_set) { struct spi_dt_spec *spec = loopback_specs[spec_idx]; const struct spi_buf_set tx = spi_loopback_setup_xfer(tx_bufs_pool, 1, - buffer_tx, BUF_SIZE); + NULL, BUF_SIZE); spi_loopback_transceive(spec, &tx, NULL); } From fff82b6c6c665ef58398809c985ec00f511b79a1 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:54 +0300 Subject: [PATCH 1296/2141] Revert "[nrf fromtree] tests: drivers: spi: spi_error_cases: Cleanup after nRF54LM20 rename" This reverts commit 78dfbbb4bdd608fedd4ed855b0c44e8fcd10d9ec. Signed-off-by: Jukka Rissanen --- .../nrf54l20pdk_nrf54l20_cpuapp.overlay | 78 +++++++++++++++++++ .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 1 - .../drivers/spi/spi_error_cases/testcase.yaml | 2 +- 3 files changed, 79 insertions(+), 2 deletions(-) create mode 100644 tests/drivers/spi/spi_error_cases/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay diff --git a/tests/drivers/spi/spi_error_cases/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/tests/drivers/spi/spi_error_cases/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay new file mode 100644 index 000000000000..c723ff2cbd27 --- /dev/null +++ b/tests/drivers/spi/spi_error_cases/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + spi22_default_alt: spi22_default_alt { + group1 { + psels = , + , + ; + }; + }; + + spi22_sleep_alt: spi22_sleep_alt { + group1 { + psels = , + , + ; + low-power-enable; + }; + }; + + spi21_default_alt: spi21_default_alt { + group1 { + psels = , + , + , + ; + }; + }; + + spi21_sleep_alt: spi21_sleep_alt { + group1 { + psels = , + , + , + ; + low-power-enable; + }; + }; + +}; + + +&gpio1 { + status = "okay"; +}; + +&spi22 { + status = "okay"; + pinctrl-0 = <&spi22_default_alt>; + pinctrl-1 = <&spi22_sleep_alt>; + pinctrl-names = "default", "sleep"; + overrun-character = <0x00>; + cs-gpios = <&gpio1 0 GPIO_ACTIVE_LOW>; + dut_spi_dt: test-spi-dev@0 { + compatible = "vnd,spi-device"; + reg = <0>; + spi-max-frequency = <4000000>; + }; +}; + +dut_spis: &spi21 { + compatible = "nordic,nrf-spis"; + status = "okay"; + def-char = <0x00>; + pinctrl-0 = <&spi21_default_alt>; + pinctrl-1 = <&spi21_sleep_alt>; + pinctrl-names = "default", "sleep"; + /delete-property/rx-delay-supported; + /delete-property/rx-delay; +}; + +&uicr { + nfct-pins-as-gpios; +}; diff --git a/tests/drivers/spi/spi_error_cases/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/spi/spi_error_cases/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay index 25d68cd4dfa6..541fdbb96dee 100644 --- a/tests/drivers/spi/spi_error_cases/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ b/tests/drivers/spi/spi_error_cases/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -62,7 +62,6 @@ overrun-character = <0x00>; cs-gpios = <&gpio1 3 GPIO_ACTIVE_LOW>; zephyr,pm-device-runtime-auto; - dut_spi_dt: test-spi-dev@0 { compatible = "vnd,spi-device"; reg = <0>; diff --git a/tests/drivers/spi/spi_error_cases/testcase.yaml b/tests/drivers/spi/spi_error_cases/testcase.yaml index 9ad509baddb0..8e5ae335edd3 100644 --- a/tests/drivers/spi/spi_error_cases/testcase.yaml +++ b/tests/drivers/spi/spi_error_cases/testcase.yaml @@ -6,13 +6,13 @@ common: harness: ztest harness_config: fixture: gpio_spi_loopback - timeout: 30 tests: drivers.spi.spi_error_cases: platform_allow: - nrf52840dk/nrf52840 - nrf54l15dk/nrf54l15/cpuapp - nrf54h20dk/nrf54h20/cpuapp + - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: From c1535d718844a53a7bb683112f85fd87b5d75b43 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:55 +0300 Subject: [PATCH 1297/2141] Revert "[nrf fromtree] tests: drivers: spi: spi_controller_peripheral: Disable on nRF54L20pdk" This reverts commit ffefffbb4bc65810f9e3e505671e275ed272b297. Signed-off-by: Jukka Rissanen --- .../nrf54l20pdk_nrf54l20_cpuapp.overlay | 79 +++++++++++++++++++ .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 1 - .../spi_controller_peripheral/testcase.yaml | 11 ++- 3 files changed, 86 insertions(+), 5 deletions(-) create mode 100644 tests/drivers/spi/spi_controller_peripheral/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay diff --git a/tests/drivers/spi/spi_controller_peripheral/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/tests/drivers/spi/spi_controller_peripheral/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay new file mode 100644 index 000000000000..fe004aa76959 --- /dev/null +++ b/tests/drivers/spi/spi_controller_peripheral/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + spi22_default_alt: spi22_default_alt { + group1 { + psels = , + , + ; + }; + }; + + spi22_sleep_alt: spi22_sleep_alt { + group1 { + psels = , + , + ; + low-power-enable; + }; + }; + + spi21_default_alt: spi21_default_alt { + group1 { + psels = , + , + , + ; + }; + }; + + spi21_sleep_alt: spi21_sleep_alt { + group1 { + psels = , + , + , + ; + low-power-enable; + }; + }; + +}; + + +&gpio1 { + status = "okay"; +}; + +&spi22 { + status = "okay"; + pinctrl-0 = <&spi22_default_alt>; + pinctrl-1 = <&spi22_sleep_alt>; + pinctrl-names = "default", "sleep"; + overrun-character = <0x00>; + cs-gpios = <&gpio1 0 GPIO_ACTIVE_LOW>; + zephyr,pm-device-runtime-auto; + dut_spi_dt: test-spi-dev@0 { + compatible = "vnd,spi-device"; + reg = <0>; + spi-max-frequency = ; + }; +}; + +dut_spis: &spi21 { + compatible = "nordic,nrf-spis"; + status = "okay"; + def-char = <0x00>; + pinctrl-0 = <&spi21_default_alt>; + pinctrl-1 = <&spi21_sleep_alt>; + pinctrl-names = "default", "sleep"; + /delete-property/rx-delay-supported; + /delete-property/rx-delay; +}; + +&uicr { + nfct-pins-as-gpios; +}; diff --git a/tests/drivers/spi/spi_controller_peripheral/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/spi/spi_controller_peripheral/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay index 25d68cd4dfa6..541fdbb96dee 100644 --- a/tests/drivers/spi/spi_controller_peripheral/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ b/tests/drivers/spi/spi_controller_peripheral/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -62,7 +62,6 @@ overrun-character = <0x00>; cs-gpios = <&gpio1 3 GPIO_ACTIVE_LOW>; zephyr,pm-device-runtime-auto; - dut_spi_dt: test-spi-dev@0 { compatible = "vnd,spi-device"; reg = <0>; diff --git a/tests/drivers/spi/spi_controller_peripheral/testcase.yaml b/tests/drivers/spi/spi_controller_peripheral/testcase.yaml index 10365d8014dc..cfcf7c149f00 100644 --- a/tests/drivers/spi/spi_controller_peripheral/testcase.yaml +++ b/tests/drivers/spi/spi_controller_peripheral/testcase.yaml @@ -8,11 +8,12 @@ common: fixture: gpio_spi_loopback platform_allow: - nrf52840dk/nrf52840 + - nrf54l15dk/nrf54l15/cpuapp + - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - nrf54h20dk/nrf54h20/cpuapp - nrf54h20dk/nrf54h20/cpurad - nrf54h20dk/nrf54h20/cpuppr - - nrf54l15dk/nrf54l15/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp tests: @@ -78,9 +79,10 @@ tests: extra_args: DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_fast.overlay" platform_exclude: - nrf52840dk/nrf52840 + - nrf54l15dk/nrf54l15/cpuapp - nrf54h20dk/nrf54h20/cpurad - nrf54h20dk/nrf54h20/cpuppr - - nrf54l15dk/nrf54l15/cpuapp + - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp @@ -91,9 +93,10 @@ tests: extra_args: DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_fast_spis.overlay" platform_exclude: - nrf52840dk/nrf52840 + - nrf54l15dk/nrf54l15/cpuapp - nrf54h20dk/nrf54h20/cpurad - nrf54h20dk/nrf54h20/cpuppr - - nrf54l15dk/nrf54l15/cpuapp + - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp From afa7526015c2274d771c6fc4fdd7a6bd2808c475 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:55 +0300 Subject: [PATCH 1298/2141] Revert "[nrf fromtree] tests: spi: Add overlay for frdm_mcxa156 dual test" This reverts commit f71141c302d80ed541476f14498d998b0a50eb23. Signed-off-by: Jukka Rissanen --- .../boards/frdm_mcxa156.overlay | 31 ------------------- .../spi/spi_controller_peripheral/src/main.c | 3 +- 2 files changed, 1 insertion(+), 33 deletions(-) delete mode 100644 tests/drivers/spi/spi_controller_peripheral/boards/frdm_mcxa156.overlay diff --git a/tests/drivers/spi/spi_controller_peripheral/boards/frdm_mcxa156.overlay b/tests/drivers/spi/spi_controller_peripheral/boards/frdm_mcxa156.overlay deleted file mode 100644 index c533c11b4fd0..000000000000 --- a/tests/drivers/spi/spi_controller_peripheral/boards/frdm_mcxa156.overlay +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2025 NXP - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include - -/ { - zephyr,user { - peripheral-cs = <1>; - }; -}; - -&lpspi0 { - dut_spi_dt: test-spi-dev@0 { - compatible = "vnd,spi-device"; - reg = <0>; - spi-max-frequency = <10000000>; - }; - transfer-delay = <100>; - sck-pcs-delay = <10>; - pcs-sck-delay = <10>; - /* lower the master interrupt priority so slave can interrupt */ - interrupts = <28 1>; - label = "spi_master"; -}; - -dut_spis: &lpspi1 { - label = "spi_slave"; -}; diff --git a/tests/drivers/spi/spi_controller_peripheral/src/main.c b/tests/drivers/spi/spi_controller_peripheral/src/main.c index 04c6c27d11a7..997e6f5f91f4 100644 --- a/tests/drivers/spi/spi_controller_peripheral/src/main.c +++ b/tests/drivers/spi/spi_controller_peripheral/src/main.c @@ -28,8 +28,7 @@ static struct spi_dt_spec spim = SPI_DT_SPEC_GET(DT_NODELABEL(dut_spi_dt), SPIM_OP, 0); static const struct device *spis_dev = DEVICE_DT_GET(DT_NODELABEL(dut_spis)); static const struct spi_config spis_config = { - .operation = SPIS_OP, - .slave = DT_PROP_OR(DT_PATH(zephyr_user), peripheral_cs, 0), + .operation = SPIS_OP }; static struct k_poll_signal async_sig = K_POLL_SIGNAL_INITIALIZER(async_sig); From 3ae2f05702a6c9edfcdbb70166f80be159f27dfe Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:55 +0300 Subject: [PATCH 1299/2141] Revert "[nrf fromtree] tests: drivers: spi: Add support spi_controller_peripheral for RA" This reverts commit c0c66df803c8cd341275a719c2f7d76c6138bc15. Signed-off-by: Jukka Rissanen --- .../boards/ek_ra2a1.conf | 6 --- .../boards/ek_ra2a1.overlay | 50 ----------------- .../boards/ek_ra4m1.conf | 6 --- .../boards/ek_ra4m1.overlay | 50 ----------------- .../boards/ek_ra6e2.conf | 6 --- .../boards/ek_ra6e2.overlay | 52 ------------------ .../boards/ek_ra6m1.conf | 6 --- .../boards/ek_ra6m1.overlay | 54 ------------------- .../boards/ek_ra6m2.conf | 6 --- .../boards/ek_ra6m2.overlay | 54 ------------------- .../boards/ek_ra6m3.conf | 6 --- .../boards/ek_ra6m3.overlay | 54 ------------------- .../boards/ek_ra6m4.conf | 6 --- .../boards/ek_ra6m4.overlay | 52 ------------------ .../boards/ek_ra6m5.conf | 6 --- .../boards/ek_ra6m5.overlay | 52 ------------------ .../boards/fpb_ra6e2.conf | 6 --- .../boards/fpb_ra6e2.overlay | 52 ------------------ 18 files changed, 524 deletions(-) delete mode 100644 tests/drivers/spi/spi_controller_peripheral/boards/ek_ra2a1.conf delete mode 100644 tests/drivers/spi/spi_controller_peripheral/boards/ek_ra2a1.overlay delete mode 100644 tests/drivers/spi/spi_controller_peripheral/boards/ek_ra4m1.conf delete mode 100644 tests/drivers/spi/spi_controller_peripheral/boards/ek_ra4m1.overlay delete mode 100644 tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6e2.conf delete mode 100644 tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6e2.overlay delete mode 100644 tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m1.conf delete mode 100644 tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m1.overlay delete mode 100644 tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m2.conf delete mode 100644 tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m2.overlay delete mode 100644 tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m3.conf delete mode 100644 tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m3.overlay delete mode 100644 tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m4.conf delete mode 100644 tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m4.overlay delete mode 100644 tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m5.conf delete mode 100644 tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m5.overlay delete mode 100644 tests/drivers/spi/spi_controller_peripheral/boards/fpb_ra6e2.conf delete mode 100644 tests/drivers/spi/spi_controller_peripheral/boards/fpb_ra6e2.overlay diff --git a/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra2a1.conf b/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra2a1.conf deleted file mode 100644 index d241d5b09565..000000000000 --- a/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra2a1.conf +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright (c) 2025 Renesas Electronics Corporation -# SPDX-License-Identifier: Apache-2.0 - -CONFIG_SPI_INTERRUPT=y -CONFIG_SPI_RA_DTC=y -CONFIG_TESTED_SPI_MODE=1 diff --git a/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra2a1.overlay b/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra2a1.overlay deleted file mode 100644 index d9660d950ac9..000000000000 --- a/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra2a1.overlay +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2025 Renesas Electronics Corporation - * SPDX-License-Identifier: Apache-2.0 - */ - -&pinctrl { - spi0_default_alt: spi0_default_alt { - group1 { - /* MISO MOSI RSPCK */ - psels = , - , - ; - }; - }; - - spi1_default_alt: spi1_default_alt { - group1 { - /* MISO MOSI RSPCK */ - psels = , - , - ; - }; - }; -}; - -&spi0 { - rx-dtc; - tx-dtc; - status = "okay"; - pinctrl-0 = <&spi0_default_alt>; - pinctrl-names = "default"; - cs-gpios = <&ioport1 12 GPIO_ACTIVE_LOW>; - interrupts = <24 1>, <25 1>, <26 1>, <27 1>; - interrupt-names = "rxi", "txi", "tei", "eri"; - - dut_spi_dt: test-spi-dev@0 { - compatible = "vnd,spi-device"; - reg = <0>; - spi-max-frequency = <1000000>; - }; -}; - -dut_spis: &spi1 { - rx-dtc; - tx-dtc; - status = "okay"; - pinctrl-0 = <&spi1_default_alt>; - pinctrl-names = "default"; - cs-gpios = <&ioport2 6 GPIO_ACTIVE_LOW>; -}; diff --git a/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra4m1.conf b/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra4m1.conf deleted file mode 100644 index d241d5b09565..000000000000 --- a/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra4m1.conf +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright (c) 2025 Renesas Electronics Corporation -# SPDX-License-Identifier: Apache-2.0 - -CONFIG_SPI_INTERRUPT=y -CONFIG_SPI_RA_DTC=y -CONFIG_TESTED_SPI_MODE=1 diff --git a/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra4m1.overlay b/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra4m1.overlay deleted file mode 100644 index 8efced0263c8..000000000000 --- a/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra4m1.overlay +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2025 Renesas Electronics Corporation - * SPDX-License-Identifier: Apache-2.0 - */ - -&pinctrl { - spi0_default_alt: spi0_default_alt { - group1 { - /* MISO MOSI RSPCK */ - psels = , - , - ; - }; - }; - - spi1_default_alt: spi1_default_alt { - group1 { - /* MISO MOSI RSPCK SSL */ - psels = , - , - , - ; - }; - }; -}; - -&spi0 { - rx-dtc; - tx-dtc; - status = "okay"; - pinctrl-0 = <&spi0_default_alt>; - pinctrl-names = "default"; - cs-gpios = <&ioport4 13 GPIO_ACTIVE_LOW>; - interrupts = <23 1>, <24 1>, <25 1>, <26 1>; - interrupt-names = "rxi", "txi", "tei", "eri"; - - dut_spi_dt: test-spi-dev@0 { - compatible = "vnd,spi-device"; - reg = <0>; - spi-max-frequency = <1000000>; - }; -}; - -dut_spis: &spi1 { - rx-dtc; - tx-dtc; - status = "okay"; - pinctrl-0 = <&spi1_default_alt>; - pinctrl-names = "default"; -}; diff --git a/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6e2.conf b/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6e2.conf deleted file mode 100644 index d241d5b09565..000000000000 --- a/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6e2.conf +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright (c) 2025 Renesas Electronics Corporation -# SPDX-License-Identifier: Apache-2.0 - -CONFIG_SPI_INTERRUPT=y -CONFIG_SPI_RA_DTC=y -CONFIG_TESTED_SPI_MODE=1 diff --git a/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6e2.overlay b/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6e2.overlay deleted file mode 100644 index e58fa671a9ac..000000000000 --- a/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6e2.overlay +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2025 Renesas Electronics Corporation - * SPDX-License-Identifier: Apache-2.0 - */ - -&pinctrl { - spi0_default_alt: spi0_default_alt { - group1 { - /* MISO MOSI RSPCK */ - psels = , - , - ; - }; - }; - - spi1_default_alt: spi1_default_alt { - group1 { - /* MISO MOSI RSPCK SSL */ - psels = , - , - , - ; - }; - }; -}; - -&ioport1 { - status = "okay"; -}; - -&spi0 { - rx-dtc; - tx-dtc; - status = "okay"; - pinctrl-0 = <&spi0_default_alt>; - pinctrl-names = "default"; - cs-gpios = <&ioport3 1 GPIO_ACTIVE_LOW>; - - dut_spi_dt: test-spi-dev@0 { - compatible = "vnd,spi-device"; - reg = <0>; - spi-max-frequency = <1000000>; - }; -}; - -dut_spis: &spi1 { - rx-dtc; - tx-dtc; - status = "okay"; - pinctrl-0 = <&spi1_default_alt>; - pinctrl-names = "default"; -}; diff --git a/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m1.conf b/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m1.conf deleted file mode 100644 index d241d5b09565..000000000000 --- a/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m1.conf +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright (c) 2025 Renesas Electronics Corporation -# SPDX-License-Identifier: Apache-2.0 - -CONFIG_SPI_INTERRUPT=y -CONFIG_SPI_RA_DTC=y -CONFIG_TESTED_SPI_MODE=1 diff --git a/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m1.overlay b/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m1.overlay deleted file mode 100644 index 521edfef0678..000000000000 --- a/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m1.overlay +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2025 Renesas Electronics Corporation - * SPDX-License-Identifier: Apache-2.0 - */ - -&pinctrl { - spi0_default_alt: spi0_default_alt { - group1 { - /* MISO MOSI RSPCK */ - psels = , - , - ; - }; - }; - - spi1_default_alt: spi1_default_alt { - group1 { - /* MISO MOSI RSPCK SSL */ - psels = , - , - , - ; - }; - }; -}; - -&ioport1 { - status = "okay"; -}; - -&spi0 { - rx-dtc; - tx-dtc; - status = "okay"; - pinctrl-0 = <&spi0_default_alt>; - pinctrl-names = "default"; - cs-gpios = <&ioport1 3 GPIO_ACTIVE_LOW>; - - dut_spi_dt: test-spi-dev@0 { - compatible = "vnd,spi-device"; - reg = <0>; - spi-max-frequency = <1000000>; - }; -}; - -dut_spis: &spi1 { - rx-dtc; - tx-dtc; - status = "okay"; - pinctrl-0 = <&spi1_default_alt>; - pinctrl-names = "default"; - interrupts = <92 1>, <93 1>, <94 1>, <95 1>; - interrupt-names = "rxi", "txi", "tei", "eri"; -}; diff --git a/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m2.conf b/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m2.conf deleted file mode 100644 index d241d5b09565..000000000000 --- a/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m2.conf +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright (c) 2025 Renesas Electronics Corporation -# SPDX-License-Identifier: Apache-2.0 - -CONFIG_SPI_INTERRUPT=y -CONFIG_SPI_RA_DTC=y -CONFIG_TESTED_SPI_MODE=1 diff --git a/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m2.overlay b/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m2.overlay deleted file mode 100644 index 521edfef0678..000000000000 --- a/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m2.overlay +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2025 Renesas Electronics Corporation - * SPDX-License-Identifier: Apache-2.0 - */ - -&pinctrl { - spi0_default_alt: spi0_default_alt { - group1 { - /* MISO MOSI RSPCK */ - psels = , - , - ; - }; - }; - - spi1_default_alt: spi1_default_alt { - group1 { - /* MISO MOSI RSPCK SSL */ - psels = , - , - , - ; - }; - }; -}; - -&ioport1 { - status = "okay"; -}; - -&spi0 { - rx-dtc; - tx-dtc; - status = "okay"; - pinctrl-0 = <&spi0_default_alt>; - pinctrl-names = "default"; - cs-gpios = <&ioport1 3 GPIO_ACTIVE_LOW>; - - dut_spi_dt: test-spi-dev@0 { - compatible = "vnd,spi-device"; - reg = <0>; - spi-max-frequency = <1000000>; - }; -}; - -dut_spis: &spi1 { - rx-dtc; - tx-dtc; - status = "okay"; - pinctrl-0 = <&spi1_default_alt>; - pinctrl-names = "default"; - interrupts = <92 1>, <93 1>, <94 1>, <95 1>; - interrupt-names = "rxi", "txi", "tei", "eri"; -}; diff --git a/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m3.conf b/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m3.conf deleted file mode 100644 index d241d5b09565..000000000000 --- a/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m3.conf +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright (c) 2025 Renesas Electronics Corporation -# SPDX-License-Identifier: Apache-2.0 - -CONFIG_SPI_INTERRUPT=y -CONFIG_SPI_RA_DTC=y -CONFIG_TESTED_SPI_MODE=1 diff --git a/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m3.overlay b/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m3.overlay deleted file mode 100644 index 03de19136a13..000000000000 --- a/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m3.overlay +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2025 Renesas Electronics Corporation - * SPDX-License-Identifier: Apache-2.0 - */ - -&pinctrl { - spi0_default_alt: spi0_default_alt { - group1 { - /* MISO MOSI RSPCK */ - psels = , - , - ; - }; - }; - - spi1_default_alt: spi1_default_alt { - group1 { - /* MISO MOSI RSPCK SSL */ - psels = , - , - , - ; - }; - }; -}; - -&ioport1 { - status = "okay"; -}; - -&spi0 { - rx-dtc; - tx-dtc; - status = "okay"; - pinctrl-0 = <&spi0_default_alt>; - pinctrl-names = "default"; - cs-gpios = <&ioport1 3 GPIO_ACTIVE_LOW>; - - dut_spi_dt: test-spi-dev@0 { - compatible = "vnd,spi-device"; - reg = <0>; - spi-max-frequency = <1000000>; - }; -}; - -dut_spis: &spi1 { - rx-dtc; - tx-dtc; - status = "okay"; - pinctrl-0 = <&spi1_default_alt>; - pinctrl-names = "default"; - interrupts = <92 1>, <93 1>, <94 1>, <95 1>; - interrupt-names = "rxi", "txi", "tei", "eri"; -}; diff --git a/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m4.conf b/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m4.conf deleted file mode 100644 index d241d5b09565..000000000000 --- a/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m4.conf +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright (c) 2025 Renesas Electronics Corporation -# SPDX-License-Identifier: Apache-2.0 - -CONFIG_SPI_INTERRUPT=y -CONFIG_SPI_RA_DTC=y -CONFIG_TESTED_SPI_MODE=1 diff --git a/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m4.overlay b/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m4.overlay deleted file mode 100644 index 1cf25c94f2b7..000000000000 --- a/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m4.overlay +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2025 Renesas Electronics Corporation - * SPDX-License-Identifier: Apache-2.0 - */ - -&pinctrl { - spi0_default_alt: spi0_default_alt { - group1 { - /* MISO MOSI RSPCK */ - psels = , - , - ; - }; - }; - - spi1_default_alt: spi1_default_alt { - group1 { - /* MISO MOSI RSPCK SSL */ - psels = , - , - , - ; - }; - }; -}; - -&ioport1 { - status = "okay"; -}; - -&spi0 { - rx-dtc; - tx-dtc; - status = "okay"; - pinctrl-0 = <&spi0_default_alt>; - pinctrl-names = "default"; - cs-gpios = <&ioport1 8 GPIO_ACTIVE_LOW>; - - dut_spi_dt: test-spi-dev@0 { - compatible = "vnd,spi-device"; - reg = <0>; - spi-max-frequency = <1000000>; - }; -}; - -dut_spis: &spi1 { - rx-dtc; - tx-dtc; - status = "okay"; - pinctrl-0 = <&spi1_default_alt>; - pinctrl-names = "default"; -}; diff --git a/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m5.conf b/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m5.conf deleted file mode 100644 index d241d5b09565..000000000000 --- a/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m5.conf +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright (c) 2025 Renesas Electronics Corporation -# SPDX-License-Identifier: Apache-2.0 - -CONFIG_SPI_INTERRUPT=y -CONFIG_SPI_RA_DTC=y -CONFIG_TESTED_SPI_MODE=1 diff --git a/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m5.overlay b/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m5.overlay deleted file mode 100644 index 1cf25c94f2b7..000000000000 --- a/tests/drivers/spi/spi_controller_peripheral/boards/ek_ra6m5.overlay +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2025 Renesas Electronics Corporation - * SPDX-License-Identifier: Apache-2.0 - */ - -&pinctrl { - spi0_default_alt: spi0_default_alt { - group1 { - /* MISO MOSI RSPCK */ - psels = , - , - ; - }; - }; - - spi1_default_alt: spi1_default_alt { - group1 { - /* MISO MOSI RSPCK SSL */ - psels = , - , - , - ; - }; - }; -}; - -&ioport1 { - status = "okay"; -}; - -&spi0 { - rx-dtc; - tx-dtc; - status = "okay"; - pinctrl-0 = <&spi0_default_alt>; - pinctrl-names = "default"; - cs-gpios = <&ioport1 8 GPIO_ACTIVE_LOW>; - - dut_spi_dt: test-spi-dev@0 { - compatible = "vnd,spi-device"; - reg = <0>; - spi-max-frequency = <1000000>; - }; -}; - -dut_spis: &spi1 { - rx-dtc; - tx-dtc; - status = "okay"; - pinctrl-0 = <&spi1_default_alt>; - pinctrl-names = "default"; -}; diff --git a/tests/drivers/spi/spi_controller_peripheral/boards/fpb_ra6e2.conf b/tests/drivers/spi/spi_controller_peripheral/boards/fpb_ra6e2.conf deleted file mode 100644 index d241d5b09565..000000000000 --- a/tests/drivers/spi/spi_controller_peripheral/boards/fpb_ra6e2.conf +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright (c) 2025 Renesas Electronics Corporation -# SPDX-License-Identifier: Apache-2.0 - -CONFIG_SPI_INTERRUPT=y -CONFIG_SPI_RA_DTC=y -CONFIG_TESTED_SPI_MODE=1 diff --git a/tests/drivers/spi/spi_controller_peripheral/boards/fpb_ra6e2.overlay b/tests/drivers/spi/spi_controller_peripheral/boards/fpb_ra6e2.overlay deleted file mode 100644 index e58fa671a9ac..000000000000 --- a/tests/drivers/spi/spi_controller_peripheral/boards/fpb_ra6e2.overlay +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2025 Renesas Electronics Corporation - * SPDX-License-Identifier: Apache-2.0 - */ - -&pinctrl { - spi0_default_alt: spi0_default_alt { - group1 { - /* MISO MOSI RSPCK */ - psels = , - , - ; - }; - }; - - spi1_default_alt: spi1_default_alt { - group1 { - /* MISO MOSI RSPCK SSL */ - psels = , - , - , - ; - }; - }; -}; - -&ioport1 { - status = "okay"; -}; - -&spi0 { - rx-dtc; - tx-dtc; - status = "okay"; - pinctrl-0 = <&spi0_default_alt>; - pinctrl-names = "default"; - cs-gpios = <&ioport3 1 GPIO_ACTIVE_LOW>; - - dut_spi_dt: test-spi-dev@0 { - compatible = "vnd,spi-device"; - reg = <0>; - spi-max-frequency = <1000000>; - }; -}; - -dut_spis: &spi1 { - rx-dtc; - tx-dtc; - status = "okay"; - pinctrl-0 = <&spi1_default_alt>; - pinctrl-names = "default"; -}; From ee201b18c0f80986388b0da8105ad6e968566eb4 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:55 +0300 Subject: [PATCH 1300/2141] Revert "[nrf fromtree] tests: drivers: sensor: temp_sensor: Cleanup after nRF54LM20 rename" This reverts commit be29496b415f11167ec1a79b5a59fbfc963d269d. Signed-off-by: Jukka Rissanen --- .../boards/nrf54l20pdk_nrf54l20_cpuapp.overlay | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 tests/drivers/sensor/temp_sensor/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay diff --git a/tests/drivers/sensor/temp_sensor/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/tests/drivers/sensor/temp_sensor/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay new file mode 100644 index 000000000000..b1f2a2b9ec59 --- /dev/null +++ b/tests/drivers/sensor/temp_sensor/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +temp_sensor: &temp { + status = "okay"; +}; From 290aa3032c22b5e6cf05647abf4b4c1dd675caf1 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:55 +0300 Subject: [PATCH 1301/2141] Revert "[nrf fromtree] tests: drivers: retianed_mem: api: Cleanup after nRF54LM20 rename" This reverts commit 7afa0ecf6f992b1e741b31629c644c1f7cafcd43. Signed-off-by: Jukka Rissanen --- .../boards/nrf54l20pdk_nrf54l20_cpuapp.conf | 1 + .../nrf54l20pdk_nrf54l20_cpuapp.overlay | 25 +++++++++++++++++++ tests/drivers/retained_mem/api/testcase.yaml | 1 + 3 files changed, 27 insertions(+) create mode 100644 tests/drivers/retained_mem/api/boards/nrf54l20pdk_nrf54l20_cpuapp.conf create mode 100644 tests/drivers/retained_mem/api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay diff --git a/tests/drivers/retained_mem/api/boards/nrf54l20pdk_nrf54l20_cpuapp.conf b/tests/drivers/retained_mem/api/boards/nrf54l20pdk_nrf54l20_cpuapp.conf new file mode 100644 index 000000000000..c15ba3ed96da --- /dev/null +++ b/tests/drivers/retained_mem/api/boards/nrf54l20pdk_nrf54l20_cpuapp.conf @@ -0,0 +1 @@ +CONFIG_POWEROFF=y diff --git a/tests/drivers/retained_mem/api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/tests/drivers/retained_mem/api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay new file mode 100644 index 000000000000..dc81069eca5f --- /dev/null +++ b/tests/drivers/retained_mem/api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay @@ -0,0 +1,25 @@ +/ { + cpuapp_sram@2007ec00 { + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0x2007ec00 DT_SIZE_K(4)>; + zephyr,memory-region = "RetainedMem"; + status = "okay"; + + retainedmem0: retainedmem { + compatible = "zephyr,retained-ram"; + status = "okay"; + }; + }; + + aliases { + retainedmemtestdevice = &retainedmem0; + }; +}; + +&cpuapp_sram { + /* Shrink SRAM size to avoid overlap with retained memory region: + * 511 - 4 = 507KB = 0x7ec00 + */ + reg = <0x20000000 DT_SIZE_K(507)>; + ranges = <0x0 0x20000000 0x7ec00>; +}; diff --git a/tests/drivers/retained_mem/api/testcase.yaml b/tests/drivers/retained_mem/api/testcase.yaml index 88bd6ae16ff4..ddcc005a16ac 100644 --- a/tests/drivers/retained_mem/api/testcase.yaml +++ b/tests/drivers/retained_mem/api/testcase.yaml @@ -14,6 +14,7 @@ tests: - nrf54l15dk/nrf54l05/cpuapp - nrf54l15dk/nrf54l10/cpuapp - nrf54l15dk/nrf54l15/cpuapp + - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: From 109e82c5e7ce0efb4cd57cea5e80dcd4f260a1e7 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:55 +0300 Subject: [PATCH 1302/2141] Revert "[nrf fromtree] tests: drivers: pwm: pwm_gpio_loopback: Enable test on nrf54lm20dk" This reverts commit a61cbeb6ea3be414cf12154fc0a012e6aa51a6cf. Signed-off-by: Jukka Rissanen --- .../boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf | 1 - .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 36 ------------------- .../pwm/pwm_gpio_loopback/testcase.yaml | 1 - 3 files changed, 38 deletions(-) delete mode 100644 tests/drivers/pwm/pwm_gpio_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf delete mode 100644 tests/drivers/pwm/pwm_gpio_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay diff --git a/tests/drivers/pwm/pwm_gpio_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf b/tests/drivers/pwm/pwm_gpio_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf deleted file mode 100644 index 795414a504ab..000000000000 --- a/tests/drivers/pwm/pwm_gpio_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_SKIP_EDGE_NUM=4 diff --git a/tests/drivers/pwm/pwm_gpio_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/pwm/pwm_gpio_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay deleted file mode 100644 index 89ff80dcb677..000000000000 --- a/tests/drivers/pwm/pwm_gpio_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - * - * Test requires jumper between: - * - PWM20 OUT[0] at P1.29 <-> GPIO input at P1.00 - */ - -/ { - zephyr,user { - pwms = <&pwm20 0 160000 PWM_POLARITY_NORMAL>; - gpios = <&gpio1 0 GPIO_ACTIVE_HIGH>; - }; -}; - -&pinctrl { - pwm20_alt: pwm20_alt { - group1 { - psels = ; - }; - }; - - pwm20_alt_sleep: pwm20_alt_sleep { - group1 { - psels = ; - low-power-enable; - }; - }; -}; - -&pwm20 { - status = "okay"; - pinctrl-0 = <&pwm20_alt>; - pinctrl-1 = <&pwm20_alt_sleep>; - pinctrl-names = "default", "sleep"; -}; diff --git a/tests/drivers/pwm/pwm_gpio_loopback/testcase.yaml b/tests/drivers/pwm/pwm_gpio_loopback/testcase.yaml index 99e22b54374b..7173c8c27206 100644 --- a/tests/drivers/pwm/pwm_gpio_loopback/testcase.yaml +++ b/tests/drivers/pwm/pwm_gpio_loopback/testcase.yaml @@ -20,5 +20,4 @@ tests: platform_allow: - nrf54h20dk/nrf54h20/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp From 59d06d68e8a445fcb9a39146cf40893a4e9540e9 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:55 +0300 Subject: [PATCH 1303/2141] Revert "[nrf fromtree] tests: drivers: i2s: i2s_speed: Cleanup after nRF54LM20 rename" This reverts commit e97e2089ee0d97a22c1d27109418d0cae0397450. Signed-off-by: Jukka Rissanen --- .../nrf54l20pdk_nrf54l20_cpuapp.overlay | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 tests/drivers/i2s/i2s_speed/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay diff --git a/tests/drivers/i2s/i2s_speed/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/tests/drivers/i2s/i2s_speed/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay new file mode 100644 index 000000000000..09a2cb0459c8 --- /dev/null +++ b/tests/drivers/i2s/i2s_speed/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* i2s-node0 is the transmitter/receiver */ + +/ { + aliases { + i2s-node0 = &tdm; + }; +}; + +&pinctrl { + tdm_default_alt: tdm_default_alt { + group1 { + psels = , + , + , + ; + }; + }; +}; + +&tdm { + status = "okay"; + pinctrl-0 = <&tdm_default_alt>; + pinctrl-names = "default"; +}; From fa410c4076da68c23eb4ec280559bb80119c8d26 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:55 +0300 Subject: [PATCH 1304/2141] Revert "[nrf fromtree] tests: drivers: i2s: i2s_api: Cleanup after nRF54LM20 rename" This reverts commit c33da1a26e8fc434bc6f907f74371ffd98c5dc4b. Signed-off-by: Jukka Rissanen --- .../nrf54l20pdk_nrf54l20_cpuapp.overlay | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 tests/drivers/i2s/i2s_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay diff --git a/tests/drivers/i2s/i2s_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/tests/drivers/i2s/i2s_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay new file mode 100644 index 000000000000..09a2cb0459c8 --- /dev/null +++ b/tests/drivers/i2s/i2s_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* i2s-node0 is the transmitter/receiver */ + +/ { + aliases { + i2s-node0 = &tdm; + }; +}; + +&pinctrl { + tdm_default_alt: tdm_default_alt { + group1 { + psels = , + , + , + ; + }; + }; +}; + +&tdm { + status = "okay"; + pinctrl-0 = <&tdm_default_alt>; + pinctrl-names = "default"; +}; From f7bc923d1ef0471b14ad4a82e295e6ca7dd572fd Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:55 +0300 Subject: [PATCH 1305/2141] Revert "[nrf fromtree] tests: drivers: i2s: i2s_additional: Enable test on nrf54lm20dk" This reverts commit ecc4c9dd57394f4b7de062b8d1aa58cae266434c. Signed-off-by: Jukka Rissanen --- ...0a_cpuapp.overlay => nrf54lm20pdk_nrf54lm20a_cpuapp.overlay} | 0 tests/drivers/i2s/i2s_additional/testcase.yaml | 2 -- 2 files changed, 2 deletions(-) rename tests/drivers/i2s/i2s_additional/boards/{nrf54lm20dk_nrf54lm20a_cpuapp.overlay => nrf54lm20pdk_nrf54lm20a_cpuapp.overlay} (100%) diff --git a/tests/drivers/i2s/i2s_additional/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/i2s/i2s_additional/boards/nrf54lm20pdk_nrf54lm20a_cpuapp.overlay similarity index 100% rename from tests/drivers/i2s/i2s_additional/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay rename to tests/drivers/i2s/i2s_additional/boards/nrf54lm20pdk_nrf54lm20a_cpuapp.overlay diff --git a/tests/drivers/i2s/i2s_additional/testcase.yaml b/tests/drivers/i2s/i2s_additional/testcase.yaml index 9dcb82d61f3f..c45a5482b7f4 100644 --- a/tests/drivers/i2s/i2s_additional/testcase.yaml +++ b/tests/drivers/i2s/i2s_additional/testcase.yaml @@ -16,12 +16,10 @@ tests: - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp integration_platforms: - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp drivers.i2s.additional.gpio_loopback.54h: harness_config: From ae272b522a6cb10754ba9115a10097f9bd7bff1a Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:55 +0300 Subject: [PATCH 1306/2141] Revert "[nrf fromtree] tests: drivers: i2c: i2c_target_api: Cleanup after nRF54LM20 rename" This reverts commit ce520ebeb547e1c31d0fe079a39b1658811612ab. Signed-off-by: Jukka Rissanen --- .../boards/nrf54l20pdk_nrf54l20_cpuapp.conf | 1 + .../nrf54l20pdk_nrf54l20_cpuapp.overlay | 68 +++++++++++++++++++ .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 6 -- .../drivers/i2c/i2c_target_api/testcase.yaml | 2 +- 4 files changed, 70 insertions(+), 7 deletions(-) create mode 100644 tests/drivers/i2c/i2c_target_api/boards/nrf54l20pdk_nrf54l20_cpuapp.conf create mode 100644 tests/drivers/i2c/i2c_target_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay diff --git a/tests/drivers/i2c/i2c_target_api/boards/nrf54l20pdk_nrf54l20_cpuapp.conf b/tests/drivers/i2c/i2c_target_api/boards/nrf54l20pdk_nrf54l20_cpuapp.conf new file mode 100644 index 000000000000..2510d6673c1b --- /dev/null +++ b/tests/drivers/i2c/i2c_target_api/boards/nrf54l20pdk_nrf54l20_cpuapp.conf @@ -0,0 +1 @@ +CONFIG_I2C_NRFX_TWIS_BUF_SIZE=256 diff --git a/tests/drivers/i2c/i2c_target_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/tests/drivers/i2c/i2c_target_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay new file mode 100644 index 000000000000..f04022cf8f35 --- /dev/null +++ b/tests/drivers/i2c/i2c_target_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay @@ -0,0 +1,68 @@ +/* + * SDA = P1.8 and P1.9 + * SCL = P1.14 and P1.15 + */ + +&pinctrl { + i2c21_default: i2c21_default { + group1 { + psels = , + ; + bias-pull-up; + }; + }; + + i2c21_sleep: i2c21_sleep { + group1 { + psels = , + ; + low-power-enable; + }; + }; + + i2c22_default: i2c22_default { + group1 { + psels = , + ; + bias-pull-up; + }; + }; + + i2c22_sleep: i2c22_sleep { + group1 { + psels = , + ; + low-power-enable; + }; + }; +}; + +&i2c21 { + pinctrl-0 = <&i2c21_default>; + pinctrl-1 = <&i2c21_sleep>; + pinctrl-names = "default", "sleep"; + zephyr,concat-buf-size = <256>; + status = "okay"; + + eeprom1: eeprom@56 { + compatible = "zephyr,i2c-target-eeprom"; + reg = <0x56>; + address-width = <8>; + size = <256>; + }; +}; + +&i2c22 { + compatible = "nordic,nrf-twis"; + pinctrl-0 = <&i2c22_default>; + pinctrl-1 = <&i2c22_sleep>; + pinctrl-names = "default", "sleep"; + status = "okay"; + + eeprom0: eeprom@54 { + compatible = "zephyr,i2c-target-eeprom"; + reg = <0x54>; + address-width = <8>; + size = <256>; + }; +}; diff --git a/tests/drivers/i2c/i2c_target_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/i2c/i2c_target_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay index f6d76c7253c2..3459599351ba 100644 --- a/tests/drivers/i2c/i2c_target_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ b/tests/drivers/i2c/i2c_target_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -1,9 +1,3 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - /* * SDA = P1.13 and P1.14 * SCL = P1.23 and P1.24 diff --git a/tests/drivers/i2c/i2c_target_api/testcase.yaml b/tests/drivers/i2c/i2c_target_api/testcase.yaml index 8c95390a72c0..7f888f95e123 100644 --- a/tests/drivers/i2c/i2c_target_api/testcase.yaml +++ b/tests/drivers/i2c/i2c_target_api/testcase.yaml @@ -64,8 +64,8 @@ tests: - nrf5340dk/nrf5340/cpuapp - nrf54h20dk/nrf54h20/cpuapp - nrf54l15dk/nrf54l15/cpuapp + - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: - max32690evkit/max32690/m4 - - nrf54l15dk/nrf54l15/cpuapp From 41a9aacffc65c7b5c563366853f493e9946b3de0 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:55 +0300 Subject: [PATCH 1307/2141] Revert "[nrf fromtree] tests: drivers: gpio: gpio_basic_api: Cleanup after nRF54LM20 rename" This reverts commit 05bc31c35dd033829b327518ef8237699a95ee31. Signed-off-by: Jukka Rissanen --- .../nrf54l20pdk_nrf54l20_common.overlay | 21 +++++++++++++++++++ .../nrf54l20pdk_nrf54l20_cpuapp.overlay | 7 +++++++ .../nrf54l20pdk_nrf54l20_cpuflpr.overlay | 7 +++++++ 3 files changed, 35 insertions(+) create mode 100644 tests/drivers/gpio/gpio_basic_api/boards/nrf54l20pdk_nrf54l20_common.overlay create mode 100644 tests/drivers/gpio/gpio_basic_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay create mode 100644 tests/drivers/gpio/gpio_basic_api/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay diff --git a/tests/drivers/gpio/gpio_basic_api/boards/nrf54l20pdk_nrf54l20_common.overlay b/tests/drivers/gpio/gpio_basic_api/boards/nrf54l20pdk_nrf54l20_common.overlay new file mode 100644 index 000000000000..8eb1b3c9f9ff --- /dev/null +++ b/tests/drivers/gpio/gpio_basic_api/boards/nrf54l20pdk_nrf54l20_common.overlay @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + resources { + compatible = "test-gpio-basic-api"; + out-gpios = <&gpio1 10 0>; + in-gpios = <&gpio1 11 0>; + }; +}; + +&gpiote20 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; diff --git a/tests/drivers/gpio/gpio_basic_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/tests/drivers/gpio/gpio_basic_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay new file mode 100644 index 000000000000..3ed56c4a6c81 --- /dev/null +++ b/tests/drivers/gpio/gpio_basic_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay @@ -0,0 +1,7 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "nrf54l20pdk_nrf54l20_common.overlay" diff --git a/tests/drivers/gpio/gpio_basic_api/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay b/tests/drivers/gpio/gpio_basic_api/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay new file mode 100644 index 000000000000..91c033f0f941 --- /dev/null +++ b/tests/drivers/gpio/gpio_basic_api/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay @@ -0,0 +1,7 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "nrf54l20pdk_nrf54l20_common.overlay" From 0ccf28ef5543b00e8c52d9abea0bc033d9a3cb75 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:55 +0300 Subject: [PATCH 1308/2141] Revert "[nrf fromtree] tests: drivers: flash: negative_tests: Cleanup after nRF54LM20 rename" This reverts commit 7961ea2e40a08554222ee5d3d720030f81ac1b9b. Signed-off-by: Jukka Rissanen --- tests/drivers/flash/negative_tests/testcase.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/drivers/flash/negative_tests/testcase.yaml b/tests/drivers/flash/negative_tests/testcase.yaml index 7a55212aa3f5..3321a0273ba4 100644 --- a/tests/drivers/flash/negative_tests/testcase.yaml +++ b/tests/drivers/flash/negative_tests/testcase.yaml @@ -5,8 +5,9 @@ common: tests: drivers.flash.negative_tests: platform_allow: - - nrf54h20dk/nrf54h20/cpuapp - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp + - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp + - nrf54h20dk/nrf54h20/cpuapp - ophelia4ev/nrf54l15/cpuapp From 207ecc25565b73bc19ee72128f105ff5510bfbe8 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:55 +0300 Subject: [PATCH 1309/2141] Revert "[nrf fromtree] tests: drivers: flash: common: Cleanup after nRF54LM20 rename" This reverts commit 9c2ac9b66ba71b50e330f8ada6ed7a6f30b8c8e6. Signed-off-by: Jukka Rissanen --- .../flash/common/boards/nrf54l20pdk_nrf54l20_cpuapp.conf | 4 ++++ .../common/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 9 --------- tests/drivers/flash/common/testcase.yaml | 9 ++------- 3 files changed, 6 insertions(+), 16 deletions(-) create mode 100644 tests/drivers/flash/common/boards/nrf54l20pdk_nrf54l20_cpuapp.conf delete mode 100644 tests/drivers/flash/common/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay diff --git a/tests/drivers/flash/common/boards/nrf54l20pdk_nrf54l20_cpuapp.conf b/tests/drivers/flash/common/boards/nrf54l20pdk_nrf54l20_cpuapp.conf new file mode 100644 index 000000000000..821a5e77e5b5 --- /dev/null +++ b/tests/drivers/flash/common/boards/nrf54l20pdk_nrf54l20_cpuapp.conf @@ -0,0 +1,4 @@ +CONFIG_FCB=y +CONFIG_FLASH_MAP=y +CONFIG_SETTINGS=y +CONFIG_SETTINGS_FCB=y diff --git a/tests/drivers/flash/common/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/flash/common/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay deleted file mode 100644 index 8a5afda2ab00..000000000000 --- a/tests/drivers/flash/common/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&mx25r64 { - status = "okay"; -}; diff --git a/tests/drivers/flash/common/testcase.yaml b/tests/drivers/flash/common/testcase.yaml index 0433d024ff15..cabd1ffa0c66 100644 --- a/tests/drivers/flash/common/testcase.yaml +++ b/tests/drivers/flash/common/testcase.yaml @@ -37,8 +37,6 @@ tests: filter: ((CONFIG_FLASH_HAS_DRIVER_ENABLED and not CONFIG_TRUSTED_EXECUTION_NONSECURE) and (dt_label_with_parent_compat_enabled("storage_partition", "fixed-partitions") or dt_label_with_parent_compat_enabled("storage_partition", "nordic,owned-partitions"))) - platform_exclude: - - nrf54lm20dk/nrf54lm20a/cpuapp integration_platforms: - qemu_x86 - mimxrt1060_evk/mimxrt1062/qspi @@ -48,13 +46,10 @@ tests: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l10/cpuapp - nrf54l15dk/nrf54l15/cpuapp + - nrf54l20pdk/nrf54l20/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - nrf54h20dk/nrf54h20/cpuapp - ophelia4ev/nrf54l15/cpuapp - drivers.flash.common.nrf54lm20a: - platform_allow: - - nrf54lm20dk/nrf54lm20a/cpuapp - harness_config: - fixture: external_flash drivers.flash.common.tfm_ns: build_only: true filter: (CONFIG_FLASH_HAS_DRIVER_ENABLED and CONFIG_TRUSTED_EXECUTION_NONSECURE From 3b1eabf22ee3a13ea2a4921d762bdaa66384a821 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:55 +0300 Subject: [PATCH 1310/2141] Revert "[nrf fromtree] tests: drivers: flash: common: Fix page size when no erase is required" This reverts commit a0452de0058be9ce382626ac65bbe559f380f458. Signed-off-by: Jukka Rissanen --- tests/drivers/flash/common/src/main.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/tests/drivers/flash/common/src/main.c b/tests/drivers/flash/common/src/main.c index ab0e63bb6092..03b3c08a6cf9 100644 --- a/tests/drivers/flash/common/src/main.c +++ b/tests/drivers/flash/common/src/main.c @@ -87,8 +87,7 @@ static void flash_driver_before(void *arg) TC_PRINT("No devices with erase requirement present\n"); erase_value = 0x55; page_info.start_offset = TEST_AREA_OFFSET; - /* test_flash_copy uses 2 pages, so split the test area */ - page_info.size = (TEST_AREA_MAX - TEST_AREA_OFFSET) / 2; + page_info.size = TEST_AREA_MAX - TEST_AREA_OFFSET; } @@ -112,10 +111,6 @@ static void flash_driver_before(void *arg) zassert_true((TEST_AREA_OFFSET + EXPECTED_SIZE) <= TEST_AREA_MAX, "Test area exceeds flash size"); - /* Check if test region is suitable for test_flash_copy */ - zassert_true((TEST_AREA_OFFSET + 2 * page_info.size) <= TEST_AREA_MAX, - "test_flash_copy needs 2 flash pages"); - /* Check if flash is cleared */ if (IS_ENABLED(CONFIG_FLASH_HAS_EXPLICIT_ERASE) && ebw_required) { bool is_buf_clear = true; From 5df509187da7cf70ba25d26d7329f9a5e4a196ae Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:56 +0300 Subject: [PATCH 1311/2141] Revert "[nrf fromtree] tests: drivers: flash: Add support "common" for Renesas OSPI_B" This reverts commit 876fd2b657036090816aebce0b9acb19d087965d. Signed-off-by: Jukka Rissanen --- tests/drivers/flash/common/boards/ek_ra8d1.overlay | 4 ---- .../flash/common/boards/ek_ra8d1_ospi_b_nor.conf | 4 ---- .../flash/common/boards/ek_ra8d1_ospi_b_nor.overlay | 10 ---------- tests/drivers/flash/common/boards/ek_ra8m1.overlay | 4 ---- .../flash/common/boards/ek_ra8m1_ospi_b_nor.conf | 4 ---- .../flash/common/boards/ek_ra8m1_ospi_b_nor.overlay | 10 ---------- tests/drivers/flash/common/src/main.c | 10 +--------- tests/drivers/flash/common/testcase.yaml | 7 ------- 8 files changed, 1 insertion(+), 52 deletions(-) delete mode 100644 tests/drivers/flash/common/boards/ek_ra8d1_ospi_b_nor.conf delete mode 100644 tests/drivers/flash/common/boards/ek_ra8d1_ospi_b_nor.overlay delete mode 100644 tests/drivers/flash/common/boards/ek_ra8m1_ospi_b_nor.conf delete mode 100644 tests/drivers/flash/common/boards/ek_ra8m1_ospi_b_nor.overlay diff --git a/tests/drivers/flash/common/boards/ek_ra8d1.overlay b/tests/drivers/flash/common/boards/ek_ra8d1.overlay index ee45617b0097..8e42c66387c7 100644 --- a/tests/drivers/flash/common/boards/ek_ra8d1.overlay +++ b/tests/drivers/flash/common/boards/ek_ra8d1.overlay @@ -18,7 +18,3 @@ }; }; }; - -&s28hl512t { - status = "disabled"; -}; diff --git a/tests/drivers/flash/common/boards/ek_ra8d1_ospi_b_nor.conf b/tests/drivers/flash/common/boards/ek_ra8d1_ospi_b_nor.conf deleted file mode 100644 index 349d703d783c..000000000000 --- a/tests/drivers/flash/common/boards/ek_ra8d1_ospi_b_nor.conf +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright (c) 2025 Renesas Electronics Corporation -# SPDX-License-Identifier: Apache-2.0 - -CONFIG_TEST_DRIVER_FLASH_SIZE=67108864 diff --git a/tests/drivers/flash/common/boards/ek_ra8d1_ospi_b_nor.overlay b/tests/drivers/flash/common/boards/ek_ra8d1_ospi_b_nor.overlay deleted file mode 100644 index cb05c656afaa..000000000000 --- a/tests/drivers/flash/common/boards/ek_ra8d1_ospi_b_nor.overlay +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright (c) 2025 Renesas Electronics Corporation - * SPDX-License-Identifier: Apache-2.0 - */ - -/delete-node/ &storage_partition; - -&s28hl512t { - status = "okay"; -}; diff --git a/tests/drivers/flash/common/boards/ek_ra8m1.overlay b/tests/drivers/flash/common/boards/ek_ra8m1.overlay index ee45617b0097..8e42c66387c7 100644 --- a/tests/drivers/flash/common/boards/ek_ra8m1.overlay +++ b/tests/drivers/flash/common/boards/ek_ra8m1.overlay @@ -18,7 +18,3 @@ }; }; }; - -&s28hl512t { - status = "disabled"; -}; diff --git a/tests/drivers/flash/common/boards/ek_ra8m1_ospi_b_nor.conf b/tests/drivers/flash/common/boards/ek_ra8m1_ospi_b_nor.conf deleted file mode 100644 index 349d703d783c..000000000000 --- a/tests/drivers/flash/common/boards/ek_ra8m1_ospi_b_nor.conf +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright (c) 2025 Renesas Electronics Corporation -# SPDX-License-Identifier: Apache-2.0 - -CONFIG_TEST_DRIVER_FLASH_SIZE=67108864 diff --git a/tests/drivers/flash/common/boards/ek_ra8m1_ospi_b_nor.overlay b/tests/drivers/flash/common/boards/ek_ra8m1_ospi_b_nor.overlay deleted file mode 100644 index cb05c656afaa..000000000000 --- a/tests/drivers/flash/common/boards/ek_ra8m1_ospi_b_nor.overlay +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright (c) 2025 Renesas Electronics Corporation - * SPDX-License-Identifier: Apache-2.0 - */ - -/delete-node/ &storage_partition; - -&s28hl512t { - status = "okay"; -}; diff --git a/tests/drivers/flash/common/src/main.c b/tests/drivers/flash/common/src/main.c index 03b3c08a6cf9..fa2fd053fd81 100644 --- a/tests/drivers/flash/common/src/main.c +++ b/tests/drivers/flash/common/src/main.c @@ -12,8 +12,6 @@ #if defined(CONFIG_NORDIC_QSPI_NOR) #define TEST_AREA_DEV_NODE DT_INST(0, nordic_qspi_nor) -#elif defined(CONFIG_FLASH_RENESAS_RA_OSPI_B) -#define TEST_AREA_DEV_NODE DT_INST(0, renesas_ra_ospi_b_nor) #elif defined(CONFIG_SPI_NOR) #define TEST_AREA_DEV_NODE DT_INST(0, jedec_spi_nor) #elif defined(CONFIG_FLASH_MSPI_NOR) @@ -34,18 +32,12 @@ #elif defined(TEST_AREA_DEV_NODE) #define TEST_AREA_DEVICE DEVICE_DT_GET(TEST_AREA_DEV_NODE) -#if defined CONFIG_FLASH_RENESAS_RA_OSPI_B -#define TEST_AREA_OFFSET 0x40000 -#else #define TEST_AREA_OFFSET 0xff000 -#endif #if DT_NODE_HAS_PROP(TEST_AREA_DEV_NODE, size_in_bytes) #define TEST_AREA_MAX DT_PROP(TEST_AREA_DEV_NODE, size_in_bytes) -#elif DT_NODE_HAS_PROP(TEST_AREA_DEV_NODE, size) -#define TEST_AREA_MAX (DT_PROP(TEST_AREA_DEV_NODE, size) / 8) #else -#define TEST_AREA_MAX DT_REG_SIZE(TEST_AREA_DEV_NODE) +#define TEST_AREA_MAX (DT_PROP(TEST_AREA_DEV_NODE, size) / 8) #endif #else diff --git a/tests/drivers/flash/common/testcase.yaml b/tests/drivers/flash/common/testcase.yaml index cabd1ffa0c66..a46ecb50e11d 100644 --- a/tests/drivers/flash/common/testcase.yaml +++ b/tests/drivers/flash/common/testcase.yaml @@ -139,10 +139,3 @@ tests: filter: dt_compat_enabled("soc-nv-flash") and dt_compat_enabled("jedec,spi-nor") extra_args: - CONFIG_SPI_NOR=n - drivers.flash.common.ra_ospi_b_nor: - platform_allow: - - ek_ra8m1 - - ek_ra8d1 - extra_args: - - DTC_OVERLAY_FILE="./boards/${BOARD}_ospi_b_nor.overlay" - - CONF_FILE="./prj.conf ./boards/${BOARD}_ospi_b_nor.conf" From cb7038b83baab4119141614a7ae431e31bc57780 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:56 +0300 Subject: [PATCH 1312/2141] Revert "[nrf fromtree] tests: drivers: counter: counter_basic_api: Cleanup after nRF54LM20 rename" This reverts commit 72768a79687f96c2d11144165a53953ca2cfe865. Signed-off-by: Jukka Rissanen --- .../boards/nrf54l20pdk_nrf54l20_common.dtsi | 36 +++++++++++++++++++ .../nrf54l20pdk_nrf54l20_cpuapp.overlay | 3 ++ .../nrf54l20pdk_nrf54l20_cpuflpr.overlay | 3 ++ 3 files changed, 42 insertions(+) create mode 100644 tests/drivers/counter/counter_basic_api/boards/nrf54l20pdk_nrf54l20_common.dtsi create mode 100644 tests/drivers/counter/counter_basic_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay create mode 100644 tests/drivers/counter/counter_basic_api/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay diff --git a/tests/drivers/counter/counter_basic_api/boards/nrf54l20pdk_nrf54l20_common.dtsi b/tests/drivers/counter/counter_basic_api/boards/nrf54l20pdk_nrf54l20_common.dtsi new file mode 100644 index 000000000000..729416752870 --- /dev/null +++ b/tests/drivers/counter/counter_basic_api/boards/nrf54l20pdk_nrf54l20_common.dtsi @@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +&timer00 { + prescaler = <6>; + status = "okay"; +}; + +&timer10 { + prescaler = <4>; + status = "okay"; +}; + +&timer20 { + prescaler = <4>; + status = "okay"; +}; + +&timer21 { + prescaler = <4>; + status = "okay"; +}; + +&timer22 { + prescaler = <4>; + status = "okay"; +}; + +&timer23 { + prescaler = <4>; + status = "okay"; +}; + +&timer24 { + prescaler = <4>; + status = "okay"; +}; diff --git a/tests/drivers/counter/counter_basic_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/tests/drivers/counter/counter_basic_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay new file mode 100644 index 000000000000..42b2852a09f8 --- /dev/null +++ b/tests/drivers/counter/counter_basic_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay @@ -0,0 +1,3 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +#include "nrf54l20pdk_nrf54l20_common.dtsi" diff --git a/tests/drivers/counter/counter_basic_api/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay b/tests/drivers/counter/counter_basic_api/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay new file mode 100644 index 000000000000..42b2852a09f8 --- /dev/null +++ b/tests/drivers/counter/counter_basic_api/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay @@ -0,0 +1,3 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +#include "nrf54l20pdk_nrf54l20_common.dtsi" From bc16142c3b17f090ee26e67fdb95a82d45d2a33a Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:56 +0300 Subject: [PATCH 1313/2141] Revert "[nrf fromtree] tests: drivers: comparator: gpio_loopback: Enable test on nrf54lm20dk" This reverts commit df2fdfe5be6749b681f3ce45e2685fbd58170cd7. Signed-off-by: Jukka Rissanen --- .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 25 ------------------- .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 16 ------------ .../snippets/nrf_comp/snippet.yml | 9 +++---- .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 12 --------- .../snippets/nrf_lpcomp/snippet.yml | 9 +++---- .../comparator/gpio_loopback/testcase.yaml | 6 ++--- 6 files changed, 8 insertions(+), 69 deletions(-) delete mode 100644 tests/drivers/comparator/gpio_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay delete mode 100644 tests/drivers/comparator/gpio_loopback/snippets/nrf_comp/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay delete mode 100644 tests/drivers/comparator/gpio_loopback/snippets/nrf_lpcomp/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay diff --git a/tests/drivers/comparator/gpio_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/comparator/gpio_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay deleted file mode 100644 index 831e235d4c7a..000000000000 --- a/tests/drivers/comparator/gpio_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include - -/* - * P1.30 looped back to P1.31 (AIN1) - */ - -/ { - aliases { - test-comp = ∁ - }; - - zephyr,user { - test-gpios = <&gpio1 30 GPIO_ACTIVE_HIGH>; - }; -}; - -&gpio1 { - status = "okay"; -}; diff --git a/tests/drivers/comparator/gpio_loopback/snippets/nrf_comp/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/comparator/gpio_loopback/snippets/nrf_comp/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay deleted file mode 100644 index 2709df531950..000000000000 --- a/tests/drivers/comparator/gpio_loopback/snippets/nrf_comp/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&comp { - main-mode = "SE"; - psel = "AIN1"; /* P1.31 */ - refsel = "INT_1V2"; - sp-mode = "HIGH"; - th-up = <63>; - th-down = <59>; - isource = "DISABLED"; - status = "okay"; -}; diff --git a/tests/drivers/comparator/gpio_loopback/snippets/nrf_comp/snippet.yml b/tests/drivers/comparator/gpio_loopback/snippets/nrf_comp/snippet.yml index 9d876bfded03..79fffefe7f4c 100644 --- a/tests/drivers/comparator/gpio_loopback/snippets/nrf_comp/snippet.yml +++ b/tests/drivers/comparator/gpio_loopback/snippets/nrf_comp/snippet.yml @@ -4,18 +4,15 @@ name: gpio_loopback_nrf_comp boards: - nrf5340dk/nrf5340/cpuapp: - append: - EXTRA_DTC_OVERLAY_FILE: boards/nrf5340dk_nrf5340_cpuapp.overlay nrf54h20dk/nrf54h20/cpuapp: append: EXTRA_DTC_OVERLAY_FILE: boards/nrf54h20dk_nrf54h20_cpuapp.overlay nrf54l15dk/nrf54l15/cpuapp: append: EXTRA_DTC_OVERLAY_FILE: boards/nrf54l15dk_nrf54l15_cpuapp.overlay - nrf54lm20dk/nrf54lm20a/cpuapp: - append: - EXTRA_DTC_OVERLAY_FILE: boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay ophelia4ev/nrf54l15/cpuapp: append: EXTRA_DTC_OVERLAY_FILE: boards/nrf54l15dk_nrf54l15_cpuapp.overlay + nrf5340dk/nrf5340/cpuapp: + append: + EXTRA_DTC_OVERLAY_FILE: boards/nrf5340dk_nrf5340_cpuapp.overlay diff --git a/tests/drivers/comparator/gpio_loopback/snippets/nrf_lpcomp/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/comparator/gpio_loopback/snippets/nrf_lpcomp/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay deleted file mode 100644 index 0f51a9951a16..000000000000 --- a/tests/drivers/comparator/gpio_loopback/snippets/nrf_lpcomp/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&comp { - compatible = "nordic,nrf-lpcomp"; - psel = "AIN1"; /* P1.31 */ - refsel = "VDD_4_8"; - status = "okay"; -}; diff --git a/tests/drivers/comparator/gpio_loopback/snippets/nrf_lpcomp/snippet.yml b/tests/drivers/comparator/gpio_loopback/snippets/nrf_lpcomp/snippet.yml index c2a2005af4d3..82a32cb517ef 100644 --- a/tests/drivers/comparator/gpio_loopback/snippets/nrf_lpcomp/snippet.yml +++ b/tests/drivers/comparator/gpio_loopback/snippets/nrf_lpcomp/snippet.yml @@ -4,18 +4,15 @@ name: gpio_loopback_nrf_lpcomp boards: - nrf5340dk/nrf5340/cpuapp: - append: - EXTRA_DTC_OVERLAY_FILE: boards/nrf5340dk_nrf5340_cpuapp.overlay nrf54h20dk/nrf54h20/cpuapp: append: EXTRA_DTC_OVERLAY_FILE: boards/nrf54h20dk_nrf54h20_cpuapp.overlay nrf54l15dk/nrf54l15/cpuapp: append: EXTRA_DTC_OVERLAY_FILE: boards/nrf54l15dk_nrf54l15_cpuapp.overlay - nrf54lm20dk/nrf54lm20a/cpuapp: - append: - EXTRA_DTC_OVERLAY_FILE: boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay ophelia4ev/nrf54l15/cpuapp: append: EXTRA_DTC_OVERLAY_FILE: boards/nrf54l15dk_nrf54l15_cpuapp.overlay + nrf5340dk/nrf5340/cpuapp: + append: + EXTRA_DTC_OVERLAY_FILE: boards/nrf5340dk_nrf5340_cpuapp.overlay diff --git a/tests/drivers/comparator/gpio_loopback/testcase.yaml b/tests/drivers/comparator/gpio_loopback/testcase.yaml index bf0e7d127a0c..cfeeabe3a691 100644 --- a/tests/drivers/comparator/gpio_loopback/testcase.yaml +++ b/tests/drivers/comparator/gpio_loopback/testcase.yaml @@ -20,17 +20,15 @@ tests: extra_args: - SNIPPET="gpio_loopback_nrf_comp" platform_allow: - - nrf5340dk/nrf5340/cpuapp - nrf54h20dk/nrf54h20/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp + - nrf5340dk/nrf5340/cpuapp - ophelia4ev/nrf54l15/cpuapp drivers.comparator.gpio_loopback.nrf_lpcomp: extra_args: - SNIPPET="gpio_loopback_nrf_lpcomp" platform_allow: - - nrf5340dk/nrf5340/cpuapp - nrf54h20dk/nrf54h20/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp + - nrf5340dk/nrf5340/cpuapp - ophelia4ev/nrf54l15/cpuapp From 3a66d84d33227ad27c68383d6b36b011c5ef8d2e Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:56 +0300 Subject: [PATCH 1314/2141] Revert "[nrf fromtree] tests: drivers: comparator: Add support gpio_loopback for ek_ra8p1" This reverts commit 6708442e4a60dfd78779a55068ff331262f97580. Signed-off-by: Jukka Rissanen --- .../ek_ra8p1_r7ka8p1kflcac_cm85.overlay | 41 ------------------- 1 file changed, 41 deletions(-) delete mode 100644 tests/drivers/comparator/gpio_loopback/boards/ek_ra8p1_r7ka8p1kflcac_cm85.overlay diff --git a/tests/drivers/comparator/gpio_loopback/boards/ek_ra8p1_r7ka8p1kflcac_cm85.overlay b/tests/drivers/comparator/gpio_loopback/boards/ek_ra8p1_r7ka8p1kflcac_cm85.overlay deleted file mode 100644 index cccbaf04e932..000000000000 --- a/tests/drivers/comparator/gpio_loopback/boards/ek_ra8p1_r7ka8p1kflcac_cm85.overlay +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2025 Renesas Electronics Corporation - * SPDX-License-Identifier: Apache-2.0 - */ - -#include - -/ { - aliases { - test-comp = &acmphs0; - }; - - zephyr,user { - test-gpios = <&ioport6 0 GPIO_ACTIVE_HIGH>; - }; -}; - -&pinctrl { - acmphs0_ivcmp0: acmphs0_ivcmp0 { - group1 { - /* CH0 IVCMP0 */ - psels = ; - renesas,analog-enable; - }; - }; -}; - -&acmphs_global { - status = "okay"; - - acmphs0 { - pinctrl-0 = <&acmphs0_ivcmp0>; - pinctrl-names = "default"; - interrupts = <90 12>; - interrupt-names = "hs"; - reference-input-source = "ivref2"; - compare-input-source = "ivcmp0"; - noise-filter = <1>; - status = "okay"; - }; -}; From ab927f537f4eb03839ea3faf9c8d9421769b1dae Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:56 +0300 Subject: [PATCH 1315/2141] Revert "[nrf fromtree] drivers: comparator: add it51xxx_evb analog comparator driver" This reverts commit 5f066f4842297dde8eb22e10fe6a021679c2f828. Signed-off-by: Jukka Rissanen --- boards/ite/it515xx_evb/it515xx_evb.dts | 8 - drivers/comparator/CMakeLists.txt | 1 - drivers/comparator/Kconfig | 1 - drivers/comparator/Kconfig.it51xxx_vcmp | 15 - drivers/comparator/comparator_it51xxx_vcmp.c | 408 ------------------ dts/bindings/comparator/ite,it51xxx-vcmp.yaml | 65 --- dts/riscv/ite/it51xxx.dtsi | 33 +- .../dt-bindings/comparator/it51xxx-vcmp.h | 21 - .../gpio_loopback/boards/it515xx_evb.conf | 4 - .../gpio_loopback/boards/it515xx_evb.overlay | 24 -- 10 files changed, 1 insertion(+), 579 deletions(-) delete mode 100644 drivers/comparator/Kconfig.it51xxx_vcmp delete mode 100644 drivers/comparator/comparator_it51xxx_vcmp.c delete mode 100644 dts/bindings/comparator/ite,it51xxx-vcmp.yaml delete mode 100644 include/zephyr/dt-bindings/comparator/it51xxx-vcmp.h delete mode 100644 tests/drivers/comparator/gpio_loopback/boards/it515xx_evb.conf delete mode 100644 tests/drivers/comparator/gpio_loopback/boards/it515xx_evb.overlay diff --git a/boards/ite/it515xx_evb/it515xx_evb.dts b/boards/ite/it515xx_evb/it515xx_evb.dts index 08c99ca1ebcb..926c93bd921f 100644 --- a/boards/ite/it515xx_evb/it515xx_evb.dts +++ b/boards/ite/it515xx_evb/it515xx_evb.dts @@ -153,11 +153,3 @@ &sha256 { status = "okay"; }; - -/* voltage comparator for test */ -&vcmp1 { - status = "okay"; - threshold-mv = <1500>; - scan-period = <0x4>; - io-channels = <&adc0 3>; -}; diff --git a/drivers/comparator/CMakeLists.txt b/drivers/comparator/CMakeLists.txt index bdbc9ce815cc..5d8ef0554616 100644 --- a/drivers/comparator/CMakeLists.txt +++ b/drivers/comparator/CMakeLists.txt @@ -8,7 +8,6 @@ zephyr_library() zephyr_library_sources_ifdef(CONFIG_USERSPACE comparator_handlers.c) zephyr_library_sources_ifdef(CONFIG_COMPARATOR_SILABS_ACMP comparator_silabs_acmp.c) zephyr_library_sources_ifdef(CONFIG_COMPARATOR_FAKE_COMP comparator_fake_comp.c) -zephyr_library_sources_ifdef(CONFIG_COMPARATOR_IT51XXX_VCMP comparator_it51xxx_vcmp.c) zephyr_library_sources_ifdef(CONFIG_COMPARATOR_MCUX_ACMP comparator_mcux_acmp.c) zephyr_library_sources_ifdef(CONFIG_COMPARATOR_NRF_COMP comparator_nrf_comp.c) zephyr_library_sources_ifdef(CONFIG_COMPARATOR_NRF_LPCOMP comparator_nrf_lpcomp.c) diff --git a/drivers/comparator/Kconfig b/drivers/comparator/Kconfig index 07707385b05d..2cc02c240851 100644 --- a/drivers/comparator/Kconfig +++ b/drivers/comparator/Kconfig @@ -20,7 +20,6 @@ config COMPARATOR_INIT_PRIORITY rsource "Kconfig.fake_comp" rsource "Kconfig.silabs_acmp" -rsource "Kconfig.it51xxx_vcmp" rsource "Kconfig.mcux_acmp" rsource "Kconfig.nrf_comp" rsource "Kconfig.nrf_lpcomp" diff --git a/drivers/comparator/Kconfig.it51xxx_vcmp b/drivers/comparator/Kconfig.it51xxx_vcmp deleted file mode 100644 index 2881beb779ac..000000000000 --- a/drivers/comparator/Kconfig.it51xxx_vcmp +++ /dev/null @@ -1,15 +0,0 @@ -# ITE Voltage Comparator driver configuration options - -# Copyright (c) 2025 ITE Technology Corporation. -# SPDX-License-Identifier: Apache-2.0 - -config COMPARATOR_IT51XXX_VCMP - bool "ITE it51xxx Voltage Comparator" - default y - depends on ADC_ITE_IT51XXX - depends on DT_HAS_ITE_IT51XXX_VCMP_ENABLED - depends on DYNAMIC_INTERRUPTS - help - This option enables the ITE it51xxx voltage comparator, - it51xxx supports three 10-bit threshold voltage comparator - channels, and the input of each comparator comes from ADC pin. diff --git a/drivers/comparator/comparator_it51xxx_vcmp.c b/drivers/comparator/comparator_it51xxx_vcmp.c deleted file mode 100644 index e0a3e11b0c0d..000000000000 --- a/drivers/comparator/comparator_it51xxx_vcmp.c +++ /dev/null @@ -1,408 +0,0 @@ -/* - * Copyright (c) 2025 ITE Technology Corporation. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#define DT_DRV_COMPAT ite_it51xxx_vcmp - -#include -#include -#include -#include -#include -#include - -#include - -#include -LOG_MODULE_REGISTER(comparator_it51xxx_vcmp, CONFIG_COMPARATOR_LOG_LEVEL); - -#define VCMP_CHANNEL_ID_REG_MASK GENMASK(2, 0) -#define VCMP_THRESHOLD BIT(10) -#ifdef CONFIG_ADC_IT51XXX_VOL_FULL_SCALE -#define VCMP_MAX_MVOLT 3300 -#else -#define VCMP_MAX_MVOLT 3000 -#endif - -/* 0x20, 0x28, 0x2c: Voltage Comparator n Control Register (VCMPnCTL) (n=0 to 2) */ -#define REG_VCMP_VCMP0CTL 0x20 -#define REG_VCMP_VCMP1CTL 0x28 -#define REG_VCMP_VCMP2CTL 0x2C -#define VCMP_CMPEN BIT(7) -#define VCMP_CMPINTEN BIT(6) -#define VCMP_GREATER_THRESHOLD BIT(5) -#define VCMP_CMP_EDGE_SENSED_MODE BIT(4) -const uint8_t vcmp_ctrl_reg[VCMP_CHANNEL_CNT] = {REG_VCMP_VCMP0CTL, REG_VCMP_VCMP1CTL, - REG_VCMP_VCMP2CTL}; - -/* 0x21, 0x29, 0x2D: Voltage Comparator n Status and Control Register (VCMPnSCTL) (n=0 to 2) */ -#define REG_VCMP_VCMP0SCTL 0x21 -#define REG_VCMP_VCMP1SCTL 0x29 -#define REG_VCMP_VCMP2SCTL 0x2D -#define VCMP_CMPXRTIS BIT(6) -const uint8_t vcmp_status_ctrl_reg[VCMP_CHANNEL_CNT] = {REG_VCMP_VCMP0SCTL, REG_VCMP_VCMP1SCTL, - REG_VCMP_VCMP2SCTL}; - -/* 0x22, 0x2A, 0x2E: Voltage Comparator 0~2 MSB Threshold Data Buffer (10-bit resolution) */ -#define REG_VCMP_CH_THRDATM 0x02 - -/* 0x23, 0x2B, 0x2F: Voltage Comparator 0~2 LSB Threshold Data Buffer (10-bit resolution) */ -#define REG_VCMP_CH_THRDATL 0x03 - -/* 0x33: Voltage Comparator Scan Period 2 (VCMPSCP2) */ -#define REG_VCMP_VCMPSCP2 0x33 -#define SCAN_PERIOD_MASK GENMASK(7, 4) - -/* Device config */ -struct vcmp_it51xxx_config { - /* Voltage comparator channel base address */ - uintptr_t base_ch; - /* Voltage comparator base address */ - uintptr_t reg_base; - /* Voltage comparator module irq */ - int irq; - /* Voltage comparator channel */ - int vcmp_ch; - /* Comparator 0/1/2 Scan Period */ - uint8_t scan_period; - /* Threshold assert value in mv */ - int32_t threshold_mv; - /* Pointer of ADC device that will be performing measurement */ - const struct device *adc; - /* Channel identifier */ - uint8_t channel_id; -}; - -/* Driver data */ -struct vcmp_it51xxx_data { - /* ADC channel config */ - struct adc_channel_cfg adc_ch_cfg; - comparator_callback_t user_cb; - void *user_cb_data; - uint8_t interrupt_mask; - atomic_t triggered; - /* Pointer of voltage comparator device */ - const struct device *vcmp; -}; -/* - * Because all the three voltage comparators use the same interrupt number, the - * 'irq_connect_dynamic' call in the driver init function sets the passed-in dev pointer in isr - * function to the first instantiated voltage comparator. - * - * For example, when setting vcmp2 and vcmp3 to 'status = "okay";' in dts file, each time an - * interrupt is triggered,the passed-in 'const struct device *dev' argument in isr function always - * points to vcmp2 device. - * - * To access the 'struct vcmp_it51xxx_data' of respective voltage comparator instance, we - * use a array to store their address. - */ -static struct vcmp_it51xxx_data *vcmp_data[VCMP_CHANNEL_CNT]; - -static void vcmp_irq_handler(const struct device *dev) -{ - struct vcmp_it51xxx_data *const data = dev->data; - - if (data->user_cb == NULL) { - atomic_set_bit(&data->triggered, 0); - return; - } - - data->user_cb(dev, data->user_cb_data); - atomic_clear_bit(&data->triggered, 0); -} - -static void clear_vcmp_status(const struct device *dev, int channel) -{ - const struct vcmp_it51xxx_config *const cfg = dev->config; - const uintptr_t reg_base = cfg->reg_base; - - sys_write8(sys_read8(reg_base + vcmp_status_ctrl_reg[channel]), - reg_base + vcmp_status_ctrl_reg[channel]); -} - -static int vcmp_set_threshold(const struct device *dev, int32_t threshold_mv) -{ - const struct vcmp_it51xxx_config *const cfg = dev->config; - const uintptr_t base_ch = cfg->base_ch; - int32_t reg_val; - - /* - * Tranfrom threshold from mv to raw - * NOTE: CMPXTHRDAT[9:0] = threshold(mv) * 1024 / 3000(mv) - */ - reg_val = (threshold_mv * VCMP_THRESHOLD / VCMP_MAX_MVOLT); - - if (reg_val >= VCMP_THRESHOLD) { - LOG_ERR("Vcmp%d threshold only support 10-bits", cfg->vcmp_ch); - return -ENOTSUP; - } - - /* Set threshold raw value */ - sys_write8(reg_val & 0xff, base_ch + REG_VCMP_CH_THRDATL); - sys_write8((reg_val >> 8) & 0xff, base_ch + REG_VCMP_CH_THRDATM); - - return 0; -} - -static void vcmp_set_attr(const struct device *dev, enum comparator_trigger trigger) -{ - const struct vcmp_it51xxx_config *const cfg = dev->config; - const uintptr_t base_ch = cfg->base_ch; - - /* Set lower or higher threshold */ - if (trigger == COMPARATOR_TRIGGER_RISING_EDGE) { - sys_write8(sys_read8(base_ch) | VCMP_GREATER_THRESHOLD, base_ch); - } else { - sys_write8(sys_read8(base_ch) & ~VCMP_GREATER_THRESHOLD, base_ch); - } -} - -static void vcmp_enable(const struct device *dev, bool enable) -{ - const struct vcmp_it51xxx_config *const cfg = dev->config; - const uintptr_t base_ch = cfg->base_ch; - - if (enable) { - /* Enable voltage comparator interrupt */ - sys_write8(sys_read8(base_ch) | VCMP_CMPINTEN, base_ch); - /* Start voltage comparator */ - sys_write8(sys_read8(base_ch) | VCMP_CMPEN, base_ch); - } else { - /* Disable voltage comparator interrupt */ - sys_write8(sys_read8(base_ch) & ~VCMP_CMPINTEN, base_ch); - /* Stop voltage comparator */ - sys_write8(sys_read8(base_ch) & ~VCMP_CMPEN, base_ch); - } -} - -static int it51xxx_vcmp_get_output(const struct device *dev) -{ - ARG_UNUSED(dev); - - LOG_ERR("Unsupported function: %s", __func__); - - return -ENOTSUP; -} - -static int it51xxx_vcmp_set_trigger(const struct device *dev, enum comparator_trigger trigger) -{ - const struct vcmp_it51xxx_config *cfg = dev->config; - struct vcmp_it51xxx_data *data = dev->data; - - /* Disable VCMP interrupt */ - vcmp_enable(dev, false); - - /* W/C voltage comparator specific channel interrupt status */ - clear_vcmp_status(dev, cfg->vcmp_ch); - - switch (trigger) { - case COMPARATOR_TRIGGER_BOTH_EDGES: - LOG_ERR("Unsupported trigger: COMPARATOR_TRIGGER_BOTH_EDGES"); - return -ENOTSUP; - case COMPARATOR_TRIGGER_RISING_EDGE: - data->interrupt_mask = COMPARATOR_TRIGGER_RISING_EDGE; - vcmp_set_attr(dev, COMPARATOR_TRIGGER_RISING_EDGE); - break; - case COMPARATOR_TRIGGER_FALLING_EDGE: - data->interrupt_mask = COMPARATOR_TRIGGER_FALLING_EDGE; - vcmp_set_attr(dev, COMPARATOR_TRIGGER_FALLING_EDGE); - break; - case COMPARATOR_TRIGGER_NONE: - data->interrupt_mask = 0; - break; - default: - return -EINVAL; - } - - if (data->interrupt_mask) { - vcmp_enable(dev, true); - } - - return 0; -} - -static int it51xxx_vcmp_set_trigger_callback(const struct device *dev, - comparator_callback_t callback, void *user_data) -{ - struct vcmp_it51xxx_data *data = dev->data; - - /* Disable voltage comparator and interrupt */ - vcmp_enable(dev, false); - - data->user_cb = callback; - data->user_cb_data = user_data; - - if (callback != NULL && atomic_test_and_clear_bit(&data->triggered, 0)) { - callback(dev, user_data); - } - - /* Re-enable currently set VCMP interrupt */ - if (data->interrupt_mask) { - vcmp_enable(dev, true); - } - - return 0; -} - -static int it51xxx_vcmp_trigger_is_pending(const struct device *dev) -{ - struct vcmp_it51xxx_data *data = dev->data; - - return atomic_test_and_clear_bit(&data->triggered, 0); -} - -/* - * All voltage comparator channels share one irq interrupt, so we - * need to handle all channels, when the interrupt fired. - */ -static void vcmp_it51xxx_isr(const struct device *dev) -{ - const struct vcmp_it51xxx_config *const cfg = dev->config; - const uintptr_t reg_base = cfg->reg_base; - /* - * Comparator n Trigger Mode (CMPnTMOD) - * false (0): Less than or equal to CMPnTHRDAT [9:0] - * true (1): Greater than CMPnTHRDAT [9:0] - */ - bool comparator_mode; - - /* Find out which voltage comparator triggered */ - for (int idx = VCMP_CHANNEL_0; idx < VCMP_CHANNEL_CNT; idx++) { - if (sys_read8(reg_base + vcmp_status_ctrl_reg[idx]) & VCMP_CMPXRTIS) { - struct vcmp_it51xxx_data *data = vcmp_data[idx]; - - comparator_mode = - sys_read8(reg_base + vcmp_ctrl_reg[idx]) & VCMP_GREATER_THRESHOLD; - - if ((comparator_mode && data && - data->interrupt_mask == COMPARATOR_TRIGGER_RISING_EDGE) || - (!comparator_mode && data && - data->interrupt_mask == COMPARATOR_TRIGGER_FALLING_EDGE)) { - - vcmp_irq_handler(data->vcmp); - } - - if (comparator_mode) { - sys_write8(sys_read8(reg_base + vcmp_ctrl_reg[idx]) & - ~VCMP_GREATER_THRESHOLD, - reg_base + vcmp_ctrl_reg[idx]); - } else { - sys_write8(sys_read8(reg_base + vcmp_ctrl_reg[idx]) | - VCMP_GREATER_THRESHOLD, - reg_base + vcmp_ctrl_reg[idx]); - } - - /* W/C voltage comparator specific channel interrupt status */ - clear_vcmp_status(dev, idx); - } - } - - /* W/C voltage comparator irq interrupt status */ - ite_intc_isr_clear(cfg->irq); -} - -static int vcmp_it51xxx_init(const struct device *dev) -{ - const struct vcmp_it51xxx_config *const cfg = dev->config; - struct vcmp_it51xxx_data *const data = dev->data; - uintptr_t base_ch = cfg->base_ch; - uintptr_t reg_vcmpscp2 = cfg->reg_base + REG_VCMP_VCMPSCP2; - uint8_t reg_value; - int err; - - data->adc_ch_cfg.gain = ADC_GAIN_1; - data->adc_ch_cfg.reference = ADC_REF_INTERNAL; - data->adc_ch_cfg.acquisition_time = ADC_ACQ_TIME_DEFAULT; - data->adc_ch_cfg.channel_id = cfg->channel_id; - - /* Disable voltage comparator and interrupt */ - vcmp_enable(dev, false); - - /* - * ADC channel signal output to voltage comparator, - * so we need to set ADC channel to alternate mode first. - */ - if (!device_is_ready(cfg->adc)) { - LOG_ERR("ADC device not ready"); - return -ENODEV; - } - - err = adc_channel_setup(cfg->adc, &data->adc_ch_cfg); - if (err) { - return err; - } - - /* Select which ADC channel output voltage into comparator */ - reg_value = FIELD_PREP(GENMASK(7, 3), sys_read8(base_ch)); - reg_value |= data->adc_ch_cfg.channel_id & VCMP_CHANNEL_ID_REG_MASK; - sys_write8(reg_value, base_ch); - - /* Set VCMP to Edge Sense Mode */ - sys_write8(sys_read8(base_ch) | VCMP_CMP_EDGE_SENSED_MODE, base_ch); - - /* Store the address of driver data for later access in ISR function*/ - if (cfg->vcmp_ch >= VCMP_CHANNEL_CNT) { - LOG_ERR("invalid volt comparator channel setting(%d)", cfg->vcmp_ch); - return -EINVAL; - } - vcmp_data[cfg->vcmp_ch] = dev->data; - - /* - * Set minimum scan period for "all" voltage comparator - * Three voltage comparators share a scan period setting and use the fastest one - */ - if (cfg->scan_period < FIELD_GET(SCAN_PERIOD_MASK, sys_read8(reg_vcmpscp2))) { - sys_write8(FIELD_PREP(SCAN_PERIOD_MASK, cfg->scan_period), reg_vcmpscp2); - } - - /* Data must keep device reference for later access in ISR function */ - data->vcmp = dev; - - err = vcmp_set_threshold(dev, cfg->threshold_mv); - if (err) { - return err; - } - - /* - * All voltage comparator channels share one irq interrupt, - * so if the irq is enabled before, we needn't to enable again. - * And we will figure out the triggered channel in vcmp_it51xxx_isr(). - */ - if (!irq_is_enabled(cfg->irq)) { - ite_intc_isr_clear(cfg->irq); - irq_connect_dynamic(cfg->irq, 0, (void (*)(const void *))vcmp_it51xxx_isr, - (const void *)dev, 0); - irq_enable(cfg->irq); - } - - return 0; -} - -static DEVICE_API(comparator, it51xxx_vcmp_api) = { - .get_output = it51xxx_vcmp_get_output, - .set_trigger = it51xxx_vcmp_set_trigger, - .set_trigger_callback = it51xxx_vcmp_set_trigger_callback, - .trigger_is_pending = it51xxx_vcmp_trigger_is_pending, -}; - -#define VCMP_IT51XXX_INIT(inst) \ - static const struct vcmp_it51xxx_config vcmp_it51xxx_cfg_##inst = { \ - .base_ch = DT_INST_REG_ADDR_BY_IDX(inst, 0), \ - .reg_base = DT_INST_REG_ADDR_BY_IDX(inst, 1), \ - .irq = DT_INST_IRQN(inst), \ - .vcmp_ch = DT_INST_PROP(inst, vcmp_ch), \ - .scan_period = DT_INST_PROP(inst, scan_period), \ - .threshold_mv = DT_INST_PROP(inst, threshold_mv), \ - .adc = DEVICE_DT_GET(DT_INST_IO_CHANNELS_CTLR(inst)), \ - .channel_id = (uint8_t)DT_INST_IO_CHANNELS_INPUT(inst), \ - }; \ - \ - static struct vcmp_it51xxx_data vcmp_it51xxx_data_##inst; \ - \ - DEVICE_DT_INST_DEFINE(inst, vcmp_it51xxx_init, NULL, &vcmp_it51xxx_data_##inst, \ - &vcmp_it51xxx_cfg_##inst, POST_KERNEL, \ - CONFIG_COMPARATOR_INIT_PRIORITY, &it51xxx_vcmp_api); - -DT_INST_FOREACH_STATUS_OKAY(VCMP_IT51XXX_INIT) diff --git a/dts/bindings/comparator/ite,it51xxx-vcmp.yaml b/dts/bindings/comparator/ite,it51xxx-vcmp.yaml deleted file mode 100644 index 08fd821f7984..000000000000 --- a/dts/bindings/comparator/ite,it51xxx-vcmp.yaml +++ /dev/null @@ -1,65 +0,0 @@ -# Copyright (c) 2025 ITE Technology Corporation. -# SPDX-License-Identifier: Apache-2.0 - -description: ITE, it51xxx Voltage Comparator node - -compatible: "ite,it51xxx-vcmp" - -include: base.yaml - -properties: - reg: - required: true - - interrupts: - required: true - - vcmp-ch: - type: int - required: true - description: | - Voltage comparator channel. - Check include/zephyr/dt-bindings/comparator/it51xxx-vcmp.h file for - pre-defined values. - - threshold-mv: - type: int - required: true - description: | - 16-bit value in milli-volts present on ADC data as threshold assert. - - io-channels: - type: phandle-array - required: true - description: | - ADC channel that will perform measurement. - - scan-period: - type: int - description: | - 0x1: Set comparator scan period to 100US - 0x2: Set comparator scan period to 200US - 0x3: Set comparator scan period to 400US - 0x4: Set comparator scan period to 600US - 0x5: Set comparator scan period to 800US - 0x6: Set comparator scan period to 1MS - 0x7: Set comparator scan period to 1.5MS - 0x8: Set comparator scan period to 2MS - 0x9: Set comparator scan period to 2.5MS - 0xA: Set comparator scan period to 3MS - 0xB: Set comparator scan period to 4MS - 0xC: Set comparator scan period to 5MS - default: 0x4 - enum: - - 0x1 - - 0x2 - - 0x3 - - 0x4 - - 0x5 - - 0x6 - - 0x7 - - 0x8 - - 0x9 - - 0xA - - 0xB - - 0xC diff --git a/dts/riscv/ite/it51xxx.dtsi b/dts/riscv/ite/it51xxx.dtsi index 16633f3c6b22..8f3b008276ef 100644 --- a/dts/riscv/ite/it51xxx.dtsi +++ b/dts/riscv/ite/it51xxx.dtsi @@ -6,10 +6,9 @@ #include #include -#include #include -#include #include +#include #include #include #include @@ -85,36 +84,6 @@ #io-channel-cells = <1>; }; - vcmp0: vcmp@f04520 { - compatible = "ite,it51xxx-vcmp"; - interrupt-parent = <&intc>; - interrupts = ; - reg = <0xf04520 0x08 - 0xf04500 0xc1>; /* vcmp base address */ - vcmp-ch = ; - status = "disabled"; - }; - - vcmp1: vcmp@f04528 { - compatible = "ite,it51xxx-vcmp"; - interrupt-parent = <&intc>; - interrupts = ; - reg = <0xf04528 0x08 - 0xf04500 0xc1>; /* vcmp base address */ - vcmp-ch = ; - status = "disabled"; - }; - - vcmp2: vcmp@f0452c { - compatible = "ite,it51xxx-vcmp"; - interrupt-parent = <&intc>; - interrupts = ; - reg = <0xf0452c 0x08 - 0xf04500 0xc1>; /* vcmp base address */ - vcmp-ch = ; - status = "disabled"; - }; - gpiogcr: gpio-gcr@f01600 { compatible = "ite,it51xxx-gpiogcr"; reg = <0x00f01600 0x100>; diff --git a/include/zephyr/dt-bindings/comparator/it51xxx-vcmp.h b/include/zephyr/dt-bindings/comparator/it51xxx-vcmp.h deleted file mode 100644 index 1296a8d5b319..000000000000 --- a/include/zephyr/dt-bindings/comparator/it51xxx-vcmp.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2025 ITE Corporation. - * - * SPDX-License-Identifier: Apache-2.0 - */ -#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_COMPARATOR_IT51XXX_VCMP_H_ -#define ZEPHYR_INCLUDE_DT_BINDINGS_COMPARATOR_IT51XXX_VCMP_H_ - -/** - * @name it51xxx voltage comparator channel references - * @{ - */ - -#define VCMP_CHANNEL_0 0 -#define VCMP_CHANNEL_1 1 -#define VCMP_CHANNEL_2 2 -#define VCMP_CHANNEL_CNT 3 - -/** @} */ - -#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_COMPARATOR_IT51XXX_VCMP_H_ */ diff --git a/tests/drivers/comparator/gpio_loopback/boards/it515xx_evb.conf b/tests/drivers/comparator/gpio_loopback/boards/it515xx_evb.conf deleted file mode 100644 index a51e33c8c63f..000000000000 --- a/tests/drivers/comparator/gpio_loopback/boards/it515xx_evb.conf +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright (c) 2025 ITE Technology Corporation -# SPDX-License-Identifier: Apache-2.0 - -CONFIG_ADC=y diff --git a/tests/drivers/comparator/gpio_loopback/boards/it515xx_evb.overlay b/tests/drivers/comparator/gpio_loopback/boards/it515xx_evb.overlay deleted file mode 100644 index 6c119b300177..000000000000 --- a/tests/drivers/comparator/gpio_loopback/boards/it515xx_evb.overlay +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) 2025 ITE Technology Corporation - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include - -/ { - aliases { - test-comp = &vcmp1; - }; - - zephyr,user { - test-gpios = <&gpioa 1 GPIO_ACTIVE_HIGH>; - }; -}; - -&vcmp1 { - status = "okay"; - threshold-mv = <1500>; - scan-period = <0x4>; - io-channels = <&adc0 3>; -}; From c57b41fcf3134e68396f6b365d006c8da8853abe Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:56 +0300 Subject: [PATCH 1316/2141] Revert "[nrf fromtree] tests: drivers: audio: dmic_api: Cleanup after nRF54LM20 rename" This reverts commit d56d138cfdcb54a3d7f0e7b34d21c1d849c84817. Signed-off-by: Jukka Rissanen --- .../nrf54l20pdk_nrf54l20_cpuapp.overlay | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 tests/drivers/audio/dmic_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay diff --git a/tests/drivers/audio/dmic_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/tests/drivers/audio/dmic_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay new file mode 100644 index 000000000000..440ef9828ae8 --- /dev/null +++ b/tests/drivers/audio/dmic_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + aliases { + dmic-dev = &pdm20; + }; +}; + +&pinctrl { + pdm20_default_alt: pdm20_default_alt { + group1 { + psels = , + ; + }; + }; +}; + +dmic_dev: &pdm20 { + status = "okay"; + pinctrl-0 = <&pdm20_default_alt>; + pinctrl-names = "default"; + clock-source = "PCLK32M"; +}; From 8fb47f180a931297fd6e0b21fe3078a50aa777c5 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:56 +0300 Subject: [PATCH 1317/2141] Revert "[nrf fromtree] tests: drivers: adc: adc_error_cases: Cleanup after nRF54LM20 rename" This reverts commit fb16e9c77041d0afcfd31c747a3e8185d4e14d70. Signed-off-by: Jukka Rissanen --- .../boards/nrf54l20pdk_nrf54l20_cpuapp.overlay | 15 +++++++++++++++ tests/drivers/adc/adc_error_cases/testcase.yaml | 1 + 2 files changed, 16 insertions(+) create mode 100644 tests/drivers/adc/adc_error_cases/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay diff --git a/tests/drivers/adc/adc_error_cases/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/tests/drivers/adc/adc_error_cases/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay new file mode 100644 index 000000000000..c50279ce8f64 --- /dev/null +++ b/tests/drivers/adc/adc_error_cases/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay @@ -0,0 +1,15 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2025 Nordic Semiconductor ASA + */ + +/ { + aliases { + adc = &adc; + }; +}; + +&adc { + status = "okay"; +}; diff --git a/tests/drivers/adc/adc_error_cases/testcase.yaml b/tests/drivers/adc/adc_error_cases/testcase.yaml index d9d389ab78ad..f902aa21af02 100644 --- a/tests/drivers/adc/adc_error_cases/testcase.yaml +++ b/tests/drivers/adc/adc_error_cases/testcase.yaml @@ -9,6 +9,7 @@ tests: platform_allow: - nrf52840dk/nrf52840 - nrf54l15dk/nrf54l15/cpuapp + - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - nrf54h20dk/nrf54h20/cpuapp - ophelia4ev/nrf54l15/cpuapp From 670766e2b79915b7f5e04c045d5f1eff33fa4e16 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:56 +0300 Subject: [PATCH 1318/2141] Revert "[nrf fromtree] tests: drivers: adc: adc_api: Cleanup after nRF54LM20 rename" This reverts commit 9aff91b9c2ba1748cfe9f1f9e056515f25f490e2. Signed-off-by: Jukka Rissanen --- .../nrf54l20pdk_nrf54l20_cpuapp.overlay | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 tests/drivers/adc/adc_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay diff --git a/tests/drivers/adc/adc_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/tests/drivers/adc/adc_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay new file mode 100644 index 000000000000..e1ca1190b33a --- /dev/null +++ b/tests/drivers/adc/adc_api/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay @@ -0,0 +1,44 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2025 Nordic Semiconductor ASA + */ + +/ { + zephyr,user { + io-channels = <&adc 0>, <&adc 1> , <&adc 2>; + }; +}; + +&adc { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + channel@0 { + reg = <0>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,input-positive = ; + zephyr,resolution = <10>; + }; + + channel@1 { + reg = <1>; + zephyr,gain = "ADC_GAIN_1_4"; + zephyr,reference = "ADC_REF_EXTERNAL0"; + zephyr,acquisition-time = ; + zephyr,input-positive = ; + zephyr,resolution = <12>; + }; + + channel@2 { + reg = <2>; + zephyr,gain = "ADC_GAIN_2_3"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,input-positive = ; + zephyr,resolution = <10>; + }; +}; From 2698e71398a5ab4e158b3de9b9d6e977e59bf188 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:56 +0300 Subject: [PATCH 1319/2141] Revert "[nrf fromtree] tests: drivers: adc: adc_accuracy_test: Enable test on nrf54lm20dk" This reverts commit 84e9367b1eb4f048008669e179937cab3116eed0. Signed-off-by: Jukka Rissanen --- .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 32 ------------------- .../adc/adc_accuracy_test/testcase.yaml | 4 +-- 2 files changed, 1 insertion(+), 35 deletions(-) delete mode 100644 tests/drivers/adc/adc_accuracy_test/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay diff --git a/tests/drivers/adc/adc_accuracy_test/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/adc/adc_accuracy_test/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay deleted file mode 100644 index bc68f3c8d34f..000000000000 --- a/tests/drivers/adc/adc_accuracy_test/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/* - * Test requires loopback P1.06 to VDDIO - */ - -/ { - zephyr,user { - io-channels = <&adc 0>; - reference-mv = <1800>; - expected-accuracy = <64>; - }; -}; - -&adc { - #address-cells = <1>; - #size-cells = <0>; - status = "okay"; - - channel@0 { - reg = <0>; - zephyr,gain = "ADC_GAIN_1_2"; - zephyr,reference = "ADC_REF_INTERNAL"; - zephyr,acquisition-time = ; - zephyr,input-positive = ; /* P1.06 */ - zephyr,resolution = <14>; - }; -}; diff --git a/tests/drivers/adc/adc_accuracy_test/testcase.yaml b/tests/drivers/adc/adc_accuracy_test/testcase.yaml index b3179bfd5ed1..51a4cd53e2a4 100644 --- a/tests/drivers/adc/adc_accuracy_test/testcase.yaml +++ b/tests/drivers/adc/adc_accuracy_test/testcase.yaml @@ -21,9 +21,8 @@ tests: - frdm_mcxc242 - frdm_mcxc444 - nrf52840dk/nrf52840 - - nrf54h20dk/nrf54h20/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp + - nrf54h20dk/nrf54h20/cpuapp - ophelia4ev/nrf54l15/cpuapp - ek_ra8d1 - mck_ra8t1 @@ -45,4 +44,3 @@ tests: - xg29_rb4412a integration_platforms: - frdm_kl25z - - nrf54l15dk/nrf54l15/cpuapp From 79e786a386e0ab9927ad84bb4cf88a3cc835f4c3 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:56 +0300 Subject: [PATCH 1320/2141] Revert "[nrf fromtree] tests: boards: nrf: qdec: Cleanup after nRF54LM20 rename" This reverts commit 3c1254d4a06fa56f5db845df4b43f12ee99d38d9. Signed-off-by: Jukka Rissanen --- .../boards/nrf54l20pdk_nrf54l20_common.dtsi | 53 +++++++++++++++++++ .../nrf54l20pdk_nrf54l20_cpuapp.overlay | 6 +++ .../nrf54l20pdk_nrf54l20_cpuflpr.overlay | 6 +++ tests/boards/nrf/qdec/testcase.yaml | 4 +- 4 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 tests/boards/nrf/qdec/boards/nrf54l20pdk_nrf54l20_common.dtsi create mode 100644 tests/boards/nrf/qdec/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay create mode 100644 tests/boards/nrf/qdec/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay diff --git a/tests/boards/nrf/qdec/boards/nrf54l20pdk_nrf54l20_common.dtsi b/tests/boards/nrf/qdec/boards/nrf54l20pdk_nrf54l20_common.dtsi new file mode 100644 index 000000000000..f7810df33c04 --- /dev/null +++ b/tests/boards/nrf/qdec/boards/nrf54l20pdk_nrf54l20_common.dtsi @@ -0,0 +1,53 @@ +/* + * Copyright 2025 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + aliases { + qdec0 = &qdec20; + qenca = &phase_a; + qencb = &phase_b; + }; + + encoder-emulate { + compatible = "gpio-leds"; + phase_a: phase_a { + gpios = <&gpio1 9 GPIO_ACTIVE_HIGH>; + }; + phase_b: phase_b { + gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&pinctrl { + qdec_pinctrl: qdec_pinctrl { + group1 { + psels = , + ; + }; + }; + + qdec_sleep_pinctrl: qdec_sleep_pinctrl { + group1 { + psels = , + ; + low-power-enable; + }; + }; +}; + +&gpio1 { + status = "okay"; +}; + +&qdec20 { + status = "okay"; + pinctrl-0 = <&qdec_pinctrl>; + pinctrl-1 = <&qdec_sleep_pinctrl>; + pinctrl-names = "default", "sleep"; + steps = <127>; + led-pre = <500>; + zephyr,pm-device-runtime-auto; +}; diff --git a/tests/boards/nrf/qdec/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/tests/boards/nrf/qdec/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay new file mode 100644 index 000000000000..a16bac11f177 --- /dev/null +++ b/tests/boards/nrf/qdec/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay @@ -0,0 +1,6 @@ +/* + * Copyright 2024 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "nrf54l20pdk_nrf54l20_common.dtsi" diff --git a/tests/boards/nrf/qdec/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay b/tests/boards/nrf/qdec/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay new file mode 100644 index 000000000000..638d63e5c544 --- /dev/null +++ b/tests/boards/nrf/qdec/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay @@ -0,0 +1,6 @@ +/* + * Copyright 2025 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "nrf54l20pdk_nrf54l20_common.dtsi" diff --git a/tests/boards/nrf/qdec/testcase.yaml b/tests/boards/nrf/qdec/testcase.yaml index 2908a68a6d14..312761b44596 100644 --- a/tests/boards/nrf/qdec/testcase.yaml +++ b/tests/boards/nrf/qdec/testcase.yaml @@ -5,7 +5,9 @@ common: - nrf54h20dk/nrf54h20/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l15dk/nrf54l15/cpuflpr + - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp + - nrf54l20pdk/nrf54l20/cpuflpr - nrf54lm20dk/nrf54lm20a/cpuflpr integration_platforms: - nrf52840dk/nrf52840 @@ -13,8 +15,6 @@ common: - nrf54h20dk/nrf54h20/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l15dk/nrf54l15/cpuflpr - - nrf54lm20dk/nrf54lm20a/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuflpr harness: ztest harness_config: fixture: gpio_loopback From c55fb4edd73347eaf6204e7e96b488a1c50b65a5 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:56 +0300 Subject: [PATCH 1321/2141] Revert "[nrf fromtree] tests: boards: nrf: i2c: i2c_slave: Cleanup after nRF54LM20 rename" This reverts commit 0b46bef7e934ffdaa3e7d69f419342919934080a. Signed-off-by: Jukka Rissanen --- .../boards/nrf54l20pdk_nrf54l20_cpuapp.conf | 1 + .../nrf54l20pdk_nrf54l20_cpuapp.overlay | 61 +++++++++++++++++++ .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 7 +-- tests/boards/nrf/i2c/i2c_slave/testcase.yaml | 16 ++--- 4 files changed, 71 insertions(+), 14 deletions(-) create mode 100644 tests/boards/nrf/i2c/i2c_slave/boards/nrf54l20pdk_nrf54l20_cpuapp.conf create mode 100644 tests/boards/nrf/i2c/i2c_slave/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay diff --git a/tests/boards/nrf/i2c/i2c_slave/boards/nrf54l20pdk_nrf54l20_cpuapp.conf b/tests/boards/nrf/i2c/i2c_slave/boards/nrf54l20pdk_nrf54l20_cpuapp.conf new file mode 100644 index 000000000000..b01af3b36a7b --- /dev/null +++ b/tests/boards/nrf/i2c/i2c_slave/boards/nrf54l20pdk_nrf54l20_cpuapp.conf @@ -0,0 +1 @@ +CONFIG_NRFX_TWIS22=y diff --git a/tests/boards/nrf/i2c/i2c_slave/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/tests/boards/nrf/i2c/i2c_slave/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay new file mode 100644 index 000000000000..0003711755d3 --- /dev/null +++ b/tests/boards/nrf/i2c/i2c_slave/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay @@ -0,0 +1,61 @@ +/ { + aliases { + i2c-slave = &i2c22; + }; +}; + +&pinctrl { + i2c21_default_alt: i2c21_default_alt { + group1 { + psels = , + ; + }; + }; + + i2c21_sleep_alt: i2c21_sleep_alt { + group1 { + psels = , + ; + low-power-enable; + }; + }; + + i2c22_default_alt: i2c22_default_alt { + group1 { +/* Temporary workaround as it is currently not possible + * to configure pins for TWIS with pinctrl. + */ + psels = , + ; + bias-pull-up; + }; + }; + + i2c22_sleep_alt: i2c22_sleep_alt { + group1 { + psels = , + ; + low-power-enable; + }; + }; +}; + +dut_twim: &i2c21 { + compatible = "nordic,nrf-twim"; + status = "okay"; + pinctrl-0 = <&i2c21_default_alt>; + pinctrl-1 = <&i2c21_sleep_alt>; + pinctrl-names = "default", "sleep"; + clock-frequency = ; + sensor: sensor@54 { + reg = <0x54>; + }; +}; + +&i2c22 { + compatible = "nordic,nrf-twis"; + status = "okay"; + pinctrl-0 = <&i2c22_default_alt>; + pinctrl-1 = <&i2c22_sleep_alt>; + pinctrl-names = "default", "sleep"; +}; diff --git a/tests/boards/nrf/i2c/i2c_slave/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/boards/nrf/i2c/i2c_slave/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay index 3767afee0e7c..029c9830186b 100644 --- a/tests/boards/nrf/i2c/i2c_slave/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ b/tests/boards/nrf/i2c/i2c_slave/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -1,14 +1,10 @@ -/* - * Copyright 2025 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - /* * Two loopbacks are required: * P1.13 - P1.14 * P1.23 - P1.24 */ + / { aliases { i2c-slave = &i2c22; @@ -57,7 +53,6 @@ dut_twim: &i2c21 { pinctrl-0 = <&i2c21_default_alt>; pinctrl-1 = <&i2c21_sleep_alt>; pinctrl-names = "default", "sleep"; - sensor: sensor@54 { reg = <0x54>; }; diff --git a/tests/boards/nrf/i2c/i2c_slave/testcase.yaml b/tests/boards/nrf/i2c/i2c_slave/testcase.yaml index 02a2ee5f7518..e125548a49ac 100644 --- a/tests/boards/nrf/i2c/i2c_slave/testcase.yaml +++ b/tests/boards/nrf/i2c/i2c_slave/testcase.yaml @@ -12,32 +12,32 @@ tests: platform_allow: - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp - - nrf54h20dk/nrf54h20/cpuapp - - nrf54h20dk/nrf54h20/cpuppr - nrf54l15dk/nrf54l15/cpuapp + - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp + - nrf54h20dk/nrf54h20/cpuapp + - nrf54h20dk/nrf54h20/cpuppr integration_platforms: - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp + - nrf54l15dk/nrf54l15/cpuapp - nrf54h20dk/nrf54h20/cpuapp - nrf54h20dk/nrf54h20/cpuppr - - nrf54l15dk/nrf54l15/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp boards.nrf.i2c.i2c_slave.fast: platform_allow: - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp - - nrf54h20dk/nrf54h20/cpuapp - - nrf54h20dk/nrf54h20/cpuppr - nrf54l15dk/nrf54l15/cpuapp + - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp + - nrf54h20dk/nrf54h20/cpuapp + - nrf54h20dk/nrf54h20/cpuppr integration_platforms: - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp + - nrf54l15dk/nrf54l15/cpuapp - nrf54h20dk/nrf54h20/cpuapp - nrf54h20dk/nrf54h20/cpuppr - - nrf54l15dk/nrf54l15/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp extra_args: - EXTRA_DTC_OVERLAY_FILE="boards/i2c_speed_fast.overlay" boards.nrf.i2c.i2c_slave.fast_plus: From 848e3a9bb3993a100f902a799f6a6f6631aea399 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:56 +0300 Subject: [PATCH 1322/2141] Revert "[nrf fromtree] tests: boards: nrf: hwinfo: Cleanup after nRF54LM20 rename" This reverts commit b3c198515bb63fc4a79219ed98d6190f575d1976. Signed-off-by: Jukka Rissanen --- .../boards/nrf54l20pdk_nrf54l20_cpuapp.overlay | 9 +++++++++ tests/boards/nrf/hwinfo/reset_cause/testcase.yaml | 1 + 2 files changed, 10 insertions(+) create mode 100644 tests/boards/nrf/hwinfo/reset_cause/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay diff --git a/tests/boards/nrf/hwinfo/reset_cause/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/tests/boards/nrf/hwinfo/reset_cause/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay new file mode 100644 index 000000000000..dc1ea1a9ddc9 --- /dev/null +++ b/tests/boards/nrf/hwinfo/reset_cause/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&wdt31 { + status = "okay"; +}; diff --git a/tests/boards/nrf/hwinfo/reset_cause/testcase.yaml b/tests/boards/nrf/hwinfo/reset_cause/testcase.yaml index da37f9ef614d..9fd5911c2846 100644 --- a/tests/boards/nrf/hwinfo/reset_cause/testcase.yaml +++ b/tests/boards/nrf/hwinfo/reset_cause/testcase.yaml @@ -38,6 +38,7 @@ tests: - nrf54h20dk/nrf54h20/cpuapp - nrf54h20dk/nrf54h20/cpurad - nrf54l15dk/nrf54l15/cpuapp + - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp integration_platforms: - nrf54h20dk/nrf54h20/cpuapp From b51072d6119b6b0e976b3508c091725625924ed6 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:56 +0300 Subject: [PATCH 1323/2141] Revert "[nrf fromtree] tests: boards: nrf: comp: Enable test on nrf54lm20dk" This reverts commit a201385108cd3dfd2a78116a419fce9158e0d476. Signed-off-by: Jukka Rissanen --- .../boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf | 4 --- .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 33 ------------------- tests/boards/nrf/comp/testcase.yaml | 1 - 3 files changed, 38 deletions(-) delete mode 100644 tests/boards/nrf/comp/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf delete mode 100644 tests/boards/nrf/comp/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay diff --git a/tests/boards/nrf/comp/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf b/tests/boards/nrf/comp/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf deleted file mode 100644 index 3a7f6a038761..000000000000 --- a/tests/boards/nrf/comp/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf +++ /dev/null @@ -1,4 +0,0 @@ -CONFIG_TEST_COMP_SE_PSEL_AIN_INDEX=1 -CONFIG_TEST_COMP_SE_EXTREFSEL_AIN_INDEX=4 -CONFIG_TEST_COMP_DIFF_PSEL_AIN_INDEX=6 -CONFIG_TEST_COMP_DIFF_EXTREFSEL_AIN_INDEX=5 diff --git a/tests/boards/nrf/comp/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/boards/nrf/comp/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay deleted file mode 100644 index 55d1937a4fee..000000000000 --- a/tests/boards/nrf/comp/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ /dev/null @@ -1,33 +0,0 @@ -/* Two loopbacks are used - * Each loopback is between analog input and GPIO. - * first-gpios (P1.03) -> AIN6 (P1.04) - * second-gpios (P1.30, AIN2) -> AIN1 (P1.31) - * AIN4 (P1.06) tied to VDD - */ - -/ { - aliases { - test-comp = ∁ - }; - - zephyr,user { - first-gpios = <&gpio1 3 GPIO_ACTIVE_HIGH>; - second-gpios = <&gpio1 30 GPIO_ACTIVE_HIGH>; - }; -}; - -&gpio1 { - status = "okay"; -}; - -&comp { - status = "okay"; - psel = "AIN4"; - refsel = "AREF"; - extrefsel= "AIN3"; - sp-mode = "NORMAL"; - th-up = <36>; - th-down = <30>; - isource = "DISABLED"; - enable-hyst; -}; diff --git a/tests/boards/nrf/comp/testcase.yaml b/tests/boards/nrf/comp/testcase.yaml index 6d158d284eea..d5ac3d9c267f 100644 --- a/tests/boards/nrf/comp/testcase.yaml +++ b/tests/boards/nrf/comp/testcase.yaml @@ -12,4 +12,3 @@ tests: platform_allow: - nrf54h20dk/nrf54h20/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp From c36390089c159cf7280be07d0d2c85ff7f0ad6eb Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:56 +0300 Subject: [PATCH 1324/2141] Revert "[nrf fromtree] samples: sensor: qdec: Enable sample on nrf54lm20dk" This reverts commit 607e1be8d008fad2d610fba7eb573bd36b1fa660. Signed-off-by: Jukka Rissanen --- .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 49 ------------------- samples/sensor/qdec/sample.yaml | 6 +-- 2 files changed, 2 insertions(+), 53 deletions(-) delete mode 100644 samples/sensor/qdec/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay diff --git a/samples/sensor/qdec/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/samples/sensor/qdec/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay deleted file mode 100644 index d7045779d8a0..000000000000 --- a/samples/sensor/qdec/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2025 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -/* - * Two loopbacks are required: - * P1.13 - P1.14 - * P1.23 - P1.24 - */ - -/ { - aliases { - qdec0 = &qdec20; - qenca = &phase_a; - qencb = &phase_b; - }; - - encoder-emulate { - compatible = "gpio-leds"; - phase_a: phase_a { - gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>; - }; - phase_b: phase_b { - gpios = <&gpio1 23 GPIO_ACTIVE_HIGH>; - }; - }; -}; - -&pinctrl { - qdec_pinctrl: qdec_pinctrl { - group1 { - psels = , - ; - }; - }; -}; - -&gpio1 { - status = "okay"; -}; - -&qdec20 { - status = "okay"; - pinctrl-0 = <&qdec_pinctrl>; - pinctrl-names = "default"; - steps = <120>; - led-pre = <500>; -}; diff --git a/samples/sensor/qdec/sample.yaml b/samples/sensor/qdec/sample.yaml index fbff236caf1d..8fe374bc8b58 100644 --- a/samples/sensor/qdec/sample.yaml +++ b/samples/sensor/qdec/sample.yaml @@ -31,16 +31,14 @@ tests: platform_allow: - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp - - nrf54h20dk/nrf54h20/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp + - nrf54h20dk/nrf54h20/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp - - nrf54h20dk/nrf54h20/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp + - nrf54h20dk/nrf54h20/cpuapp - ophelia4ev/nrf54l15/cpuapp harness_config: fixture: gpio_loopback From 2c635f072880cc2d16230c265e735555cd7273c1 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:56 +0300 Subject: [PATCH 1325/2141] Revert "[nrf fromtree] samples: drivers: watchdog: Cleanup after nRF54LM20 rename" This reverts commit bd2f8097d51ae5b0e9a6fb46b16a982c42529355. Signed-off-by: Jukka Rissanen --- .../watchdog/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay | 8 ++++++++ .../watchdog/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay | 8 ++++++++ 2 files changed, 16 insertions(+) create mode 100644 samples/drivers/watchdog/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay create mode 100644 samples/drivers/watchdog/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay diff --git a/samples/drivers/watchdog/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/samples/drivers/watchdog/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay new file mode 100644 index 000000000000..5c765a8a8963 --- /dev/null +++ b/samples/drivers/watchdog/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay @@ -0,0 +1,8 @@ +/* + * Copyright 2024 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +&wdt31 { + status = "okay"; +}; diff --git a/samples/drivers/watchdog/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay b/samples/drivers/watchdog/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay new file mode 100644 index 000000000000..cfb41e09b99e --- /dev/null +++ b/samples/drivers/watchdog/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay @@ -0,0 +1,8 @@ +/* + * Copyright 2025 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +&wdt31 { + status = "okay"; +}; From fa1dcfd6ed266d705685e78333ca64ee113e4f96 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:56 +0300 Subject: [PATCH 1326/2141] Revert "[nrf fromtree] samples: drivers: spi_flash: Enable sample on nrf54lm20dk" This reverts commit 55e6d51591bf0cbbf461c7d708ab72a60937c63d. Signed-off-by: Jukka Rissanen --- .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 9 ------- samples/drivers/spi_flash/sample.yaml | 26 +++---------------- 2 files changed, 4 insertions(+), 31 deletions(-) delete mode 100644 samples/drivers/spi_flash/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay diff --git a/samples/drivers/spi_flash/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/samples/drivers/spi_flash/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay deleted file mode 100644 index 8a5afda2ab00..000000000000 --- a/samples/drivers/spi_flash/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&mx25r64 { - status = "okay"; -}; diff --git a/samples/drivers/spi_flash/sample.yaml b/samples/drivers/spi_flash/sample.yaml index 39d94c905da1..351e33997a0b 100644 --- a/samples/drivers/spi_flash/sample.yaml +++ b/samples/drivers/spi_flash/sample.yaml @@ -1,19 +1,16 @@ sample: name: SPI Flash Sample -common: - tags: - - spi - - flash - depends_on: spi tests: sample.drivers.spi.flash: + tags: + - spi + - flash filter: dt_compat_enabled("jedec,spi-nor") or dt_compat_enabled("st,stm32-qspi-nor") or dt_compat_enabled("st,stm32-ospi-nor") or dt_compat_enabled("st,stm32-xspi-nor") or dt_compat_enabled("nordic,qspi-nor") or dt_compat_enabled("jedec,mspi-nor") platform_exclude: - hifive_unmatched/fu740/s7 - hifive_unmatched/fu740/u74 - - nrf54lm20dk/nrf54lm20a/cpuapp harness: console harness_config: type: multi_line @@ -24,19 +21,4 @@ tests: - "Test 2: Flash write" - "Attempting to write 4 bytes" - "Data read matches data written. Good!!" - sample.drivers.spi.flash.nrf54lm20: - platform_allow: - - nrf54lm20dk/nrf54lm20a/cpuapp - integration_platforms: - - nrf54lm20dk/nrf54lm20a/cpuapp - harness: console - harness_config: - fixture: external_flash - type: multi_line - ordered: true - regex: - - "Test 1: Flash erase" - - "Flash erase succeeded!" - - "Test 2: Flash write" - - "Attempting to write 4 bytes" - - "Data read matches data written. Good!!" + depends_on: spi From 7816892eb6b347045bcb9130083e9f78e2940a1a Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:57 +0300 Subject: [PATCH 1327/2141] Revert "[nrf fromtree] samples: drivers: spi_bitbang: Enable sample on nrf54* targets" This reverts commit 3bd1cb452c9ba417d68845bb1da4209402d934d5. Signed-off-by: Jukka Rissanen --- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 23 ------------------- .../boards/nrf54l15dk_nrf54l15_cpuapp.overlay | 23 ------------------- .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 23 ------------------- samples/drivers/spi_bitbang/sample.yaml | 9 +------- 4 files changed, 1 insertion(+), 77 deletions(-) delete mode 100644 samples/drivers/spi_bitbang/boards/nrf54h20dk_nrf54h20_cpuapp.overlay delete mode 100644 samples/drivers/spi_bitbang/boards/nrf54l15dk_nrf54l15_cpuapp.overlay delete mode 100644 samples/drivers/spi_bitbang/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay diff --git a/samples/drivers/spi_bitbang/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/samples/drivers/spi_bitbang/boards/nrf54h20dk_nrf54h20_cpuapp.overlay deleted file mode 100644 index 255834ffd9a5..000000000000 --- a/samples/drivers/spi_bitbang/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/* - * Test requires loopback between P0.06 and P0.07. - * No other driver on SPI_CLK and SPI_CS. - */ - -/ { - spibb0: spibb0 { - compatible = "zephyr,spi-bitbang"; - status="okay"; - #address-cells = <1>; - #size-cells = <0>; - clk-gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>; - mosi-gpios = <&gpio0 6 GPIO_ACTIVE_HIGH>; - miso-gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>; - cs-gpios = <&gpio0 8 GPIO_ACTIVE_LOW>; - }; -}; diff --git a/samples/drivers/spi_bitbang/boards/nrf54l15dk_nrf54l15_cpuapp.overlay b/samples/drivers/spi_bitbang/boards/nrf54l15dk_nrf54l15_cpuapp.overlay deleted file mode 100644 index 6a35bb70f9ec..000000000000 --- a/samples/drivers/spi_bitbang/boards/nrf54l15dk_nrf54l15_cpuapp.overlay +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/* - * Test requires loopback between P1.10 and P1.11 - * No other driver on SPI_CLK and SPI_CS. - */ - -/ { - spibb0: spibb0 { - compatible = "zephyr,spi-bitbang"; - status="okay"; - #address-cells = <1>; - #size-cells = <0>; - clk-gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>; - mosi-gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>; - miso-gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>; - cs-gpios = <&gpio1 14 GPIO_ACTIVE_LOW>; - }; -}; diff --git a/samples/drivers/spi_bitbang/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/samples/drivers/spi_bitbang/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay deleted file mode 100644 index 9a27384fc40d..000000000000 --- a/samples/drivers/spi_bitbang/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/* - * Test requires loopback between P1.13 and P1.14 - * No other driver on SPI_CLK and SPI_CS. - */ - -/ { - spibb0: spibb0 { - compatible = "zephyr,spi-bitbang"; - status="okay"; - #address-cells = <1>; - #size-cells = <0>; - clk-gpios = <&gpio1 23 GPIO_ACTIVE_HIGH>; - mosi-gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>; - miso-gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>; - cs-gpios = <&gpio1 30 GPIO_ACTIVE_LOW>; - }; -}; diff --git a/samples/drivers/spi_bitbang/sample.yaml b/samples/drivers/spi_bitbang/sample.yaml index c90f02313f2b..57fb178b0930 100644 --- a/samples/drivers/spi_bitbang/sample.yaml +++ b/samples/drivers/spi_bitbang/sample.yaml @@ -6,14 +6,7 @@ tests: - drivers - spi - gpio - platform_allow: - - nrf52840dk/nrf52840 - - nrf54h20dk/nrf54h20/cpuapp - - nrf54l15dk/nrf54l15/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - integration_platforms: - - nrf52840dk/nrf52840 - - nrf54l15dk/nrf54l15/cpuapp + platform_allow: nrf52840dk/nrf52840 depends_on: gpio harness: console harness_config: From 41154e80f9ebfe045ba7778fb718efb25702b70a Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:57 +0300 Subject: [PATCH 1328/2141] Revert "[nrf fromtree] samples: drivers: mbox: Cleanup after nRF54LM20 rename" This reverts commit 44b8333b73f517fa9bc4bc6fa07b1d6266f88854. Signed-off-by: Jukka Rissanen --- samples/drivers/mbox/CMakeLists.txt | 1 + samples/drivers/mbox/Kconfig.sysbuild | 1 + .../nrf54l20pdk_nrf54l20_cpuapp.overlay | 20 ++++++++++++++++ samples/drivers/mbox/remote/CMakeLists.txt | 1 + .../nrf54l20pdk_nrf54l20_cpuflpr.overlay | 24 +++++++++++++++++++ samples/drivers/mbox/sample.yaml | 4 ++++ samples/drivers/mbox/sysbuild.cmake | 1 - 7 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 samples/drivers/mbox/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay create mode 100644 samples/drivers/mbox/remote/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay diff --git a/samples/drivers/mbox/CMakeLists.txt b/samples/drivers/mbox/CMakeLists.txt index d6bada1a50ed..696b2317aa7c 100644 --- a/samples/drivers/mbox/CMakeLists.txt +++ b/samples/drivers/mbox/CMakeLists.txt @@ -27,6 +27,7 @@ if(CONFIG_BOARD_NRF5340DK_NRF5340_CPUAPP OR CONFIG_BOARD_NRF54H20DK_NRF54H20_CPURAD OR CONFIG_BOARD_NRF54L09PDK_NRF54L09_CPUAPP OR CONFIG_BOARD_NRF54L15DK_NRF54L15_CPUAPP OR + CONFIG_BOARD_NRF54L20PDK_NRF54L20_CPUAPP OR CONFIG_BOARD_NRF54LM20DK_NRF54LM20A_CPUAPP OR CONFIG_BOARD_STM32H747I_DISCO_STM32H747XX_M7 OR CONFIG_BOARD_BL54L15_DVK_NRF54L15_CPUAPP OR diff --git a/samples/drivers/mbox/Kconfig.sysbuild b/samples/drivers/mbox/Kconfig.sysbuild index 76d3d240abce..97402056c14e 100644 --- a/samples/drivers/mbox/Kconfig.sysbuild +++ b/samples/drivers/mbox/Kconfig.sysbuild @@ -21,6 +21,7 @@ config REMOTE_BOARD default "nrf54h20dk/nrf54h20/cpuapp" if "$(BOARD)${BOARD_QUALIFIERS}" = "nrf54h20dk/nrf54h20/cpurad" default "nrf54l09pdk/nrf54l09/cpuflpr" if $(BOARD) = "nrf54l09pdk" default "nrf54l15dk/nrf54l15/cpuflpr" if $(BOARD) = "nrf54l15dk" + default "nrf54l20pdk/nrf54l20/cpuflpr" if $(BOARD) = "nrf54l20pdk" default "nrf54lm20dk/nrf54lm20a/cpuflpr" if $(BOARD) = "nrf54lm20dk" default "ophelia4ev/cpuflpr" if $(BOARD) = "ophelia4ev" default "stm32h747i_disco/stm32h747xx/m4" if $(BOARD) = "stm32h747i_disco" diff --git a/samples/drivers/mbox/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/samples/drivers/mbox/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay new file mode 100644 index 000000000000..fd2f23402f5e --- /dev/null +++ b/samples/drivers/mbox/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay @@ -0,0 +1,20 @@ +/* + * Copyright 2025 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + mbox-consumer { + compatible = "vnd,mbox-consumer"; + mboxes = <&cpuapp_vevif_rx 20>, <&cpuapp_vevif_tx 21>; + mbox-names = "rx", "tx"; + }; +}; + +&cpuapp_vevif_rx { + status = "okay"; +}; + +&cpuapp_vevif_tx { + status = "okay"; +}; diff --git a/samples/drivers/mbox/remote/CMakeLists.txt b/samples/drivers/mbox/remote/CMakeLists.txt index c84efec11977..48df8f0cb5b2 100644 --- a/samples/drivers/mbox/remote/CMakeLists.txt +++ b/samples/drivers/mbox/remote/CMakeLists.txt @@ -26,6 +26,7 @@ if(CONFIG_BOARD_NRF5340DK_NRF5340_CPUNET OR CONFIG_BOARD_NRF54H20DK_NRF54H20_CPUAPP OR CONFIG_BOARD_NRF54L09PDK_NRF54L09_CPUFLPR OR CONFIG_BOARD_NRF54L15DK_NRF54L15_CPUFLPR OR + CONFIG_BOARD_NRF54L20PDK_NRF54L20_CPUFLPR OR CONFIG_BOARD_NRF54LM20DK_NRF54LM20A_CPUFLPR OR CONFIG_BOARD_STM32H747I_DISCO_STM32H747XX_M4 OR CONFIG_BOARD_BL54L15_DVK_NRF54L15_CPUFLPR OR diff --git a/samples/drivers/mbox/remote/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay b/samples/drivers/mbox/remote/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay new file mode 100644 index 000000000000..ea88120ad065 --- /dev/null +++ b/samples/drivers/mbox/remote/boards/nrf54l20pdk_nrf54l20_cpuflpr.overlay @@ -0,0 +1,24 @@ +/* + * Copyright 2025 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + mbox-consumer { + compatible = "vnd,mbox-consumer"; + mboxes = <&cpuflpr_vevif_rx 21>, <&cpuflpr_vevif_tx 20>; + mbox-names = "rx", "tx"; + }; +}; + +&cpuflpr_vevif_rx { + status = "okay"; +}; + +&cpuflpr_vevif_tx { + status = "okay"; +}; + +&uart30 { + /delete-property/ hw-flow-control; +}; diff --git a/samples/drivers/mbox/sample.yaml b/samples/drivers/mbox/sample.yaml index 809d5e091dc4..1aee77b1c677 100644 --- a/samples/drivers/mbox/sample.yaml +++ b/samples/drivers/mbox/sample.yaml @@ -12,6 +12,7 @@ tests: - nrf54h20dk/nrf54h20/cpurad - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp + - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp integration_platforms: - nrf5340bsim/nrf5340/cpuapp @@ -77,6 +78,7 @@ tests: platform_allow: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp + - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp integration_platforms: - nrf54l15dk/nrf54l15/cpuapp @@ -94,6 +96,7 @@ tests: platform_allow: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp + - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp integration_platforms: - nrf54l15dk/nrf54l15/cpuapp @@ -114,6 +117,7 @@ tests: platform_allow: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp + - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp integration_platforms: - nrf54l15dk/nrf54l15/cpuapp diff --git a/samples/drivers/mbox/sysbuild.cmake b/samples/drivers/mbox/sysbuild.cmake index 0644500ca486..318027335147 100644 --- a/samples/drivers/mbox/sysbuild.cmake +++ b/samples/drivers/mbox/sysbuild.cmake @@ -14,7 +14,6 @@ ExternalZephyrProject_Add( APPLICATION ${REMOTE_APP} SOURCE_DIR ${APP_DIR}/${REMOTE_APP} BOARD ${SB_CONFIG_REMOTE_BOARD} - BOARD_REVISION ${BOARD_REVISION} ) native_simulator_set_child_images(${DEFAULT_IMAGE} ${REMOTE_APP}) From 648f6671af8f1aead9fe59f9d3a6cab3ed36fe1e Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:57 +0300 Subject: [PATCH 1329/2141] Revert "[nrf fromtree] samples: drivers: jesd216: Enable sample on nrf54lm20dk" This reverts commit 542d6893b1e9517667c6a964069ca5e40d0623b4. Signed-off-by: Jukka Rissanen --- .../boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 9 --------- samples/drivers/jesd216/sample.yaml | 13 ------------- 2 files changed, 22 deletions(-) delete mode 100644 samples/drivers/jesd216/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay diff --git a/samples/drivers/jesd216/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/samples/drivers/jesd216/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay deleted file mode 100644 index 8a5afda2ab00..000000000000 --- a/samples/drivers/jesd216/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&mx25r64 { - status = "okay"; -}; diff --git a/samples/drivers/jesd216/sample.yaml b/samples/drivers/jesd216/sample.yaml index a5b661c492ce..4be5e5defbbe 100644 --- a/samples/drivers/jesd216/sample.yaml +++ b/samples/drivers/jesd216/sample.yaml @@ -21,7 +21,6 @@ tests: - hifive_unmatched/fu740/u74 - mimxrt1170_evk/mimxrt1176/cm7 - mimxrt1170_evk/mimxrt1176/cm4 - - nrf54lm20dk/nrf54lm20a/cpuapp filter: dt_compat_enabled("jedec,spi-nor") or dt_compat_enabled("jedec,mspi-nor") depends_on: spi sample.drivers.jesd216.nrf52840dk_spi: @@ -30,18 +29,6 @@ tests: platform_allow: nrf52840dk/nrf52840 integration_platforms: - nrf52840dk/nrf52840 - sample.drivers.jesd216.nrf54lm20: - platform_allow: - - nrf54lm20dk/nrf54lm20a/cpuapp - integration_platforms: - - nrf54lm20dk/nrf54lm20a/cpuapp - harness_config: - fixture: external_flash - type: multi_line - ordered: true - regex: - - "sfdp-bfp =" - - "jedec-id =" sample.drivers.stm32.jesd216: filter: dt_compat_enabled("st,stm32-xspi-nor") or dt_compat_enabled("st,stm32-ospi-nor") From ec4f91624e2723488d7d8cf21faa3bcb3f0c011f Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:57 +0300 Subject: [PATCH 1330/2141] Revert "[nrf fromtree] samples: drivers: i2c: rtio_loopback: Enable sample on nrf54lm20dk" This reverts commit 0d0d6409cad69af02fb9e716a3d439cbb04cd4a3. Signed-off-by: Jukka Rissanen --- .../boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf | 4 -- .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 67 ------------------- samples/drivers/i2c/rtio_loopback/sample.yaml | 3 +- 3 files changed, 1 insertion(+), 73 deletions(-) delete mode 100644 samples/drivers/i2c/rtio_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf delete mode 100644 samples/drivers/i2c/rtio_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay diff --git a/samples/drivers/i2c/rtio_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf b/samples/drivers/i2c/rtio_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf deleted file mode 100644 index 7dfef7da2839..000000000000 --- a/samples/drivers/i2c/rtio_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright (c) 2025 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -CONFIG_I2C_NRFX_TWIS_BUF_SIZE=256 diff --git a/samples/drivers/i2c/rtio_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/samples/drivers/i2c/rtio_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay deleted file mode 100644 index 1fc56cc63298..000000000000 --- a/samples/drivers/i2c/rtio_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/* - * SDA = P1.13 and P1.14 - * SCL = P1.23 and P1.24 - */ - -/ { - aliases { - i2c-controller = &i2c21; - i2c-controller-target = &i2c22; - }; -}; - -&pinctrl { - i2c21_default: i2c21_default { - group1 { - psels = , - ; - bias-pull-up; - }; - }; - - i2c21_sleep: i2c21_sleep { - group1 { - psels = , - ; - low-power-enable; - }; - }; - - i2c22_default: i2c22_default { - group1 { - psels = , - ; - bias-pull-up; - }; - }; - - i2c22_sleep: i2c22_sleep { - group1 { - psels = , - ; - low-power-enable; - }; - }; -}; - -&i2c21 { - pinctrl-0 = <&i2c21_default>; - pinctrl-1 = <&i2c21_sleep>; - pinctrl-names = "default", "sleep"; - zephyr,concat-buf-size = <256>; - status = "okay"; -}; - -&i2c22 { - compatible = "nordic,nrf-twis"; - pinctrl-0 = <&i2c22_default>; - pinctrl-1 = <&i2c22_sleep>; - pinctrl-names = "default", "sleep"; - status = "okay"; -}; diff --git a/samples/drivers/i2c/rtio_loopback/sample.yaml b/samples/drivers/i2c/rtio_loopback/sample.yaml index a356a2697fdd..a18bfb940703 100644 --- a/samples/drivers/i2c/rtio_loopback/sample.yaml +++ b/samples/drivers/i2c/rtio_loopback/sample.yaml @@ -14,9 +14,8 @@ tests: platform_allow: - b_u585i_iot02a - nrf5340dk/nrf5340/cpuapp - - nrf54h20dk/nrf54h20/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp + - nrf54h20dk/nrf54h20/cpuapp - nucleo_f401re - nucleo_h503rb - ophelia4ev/nrf54l15/cpuapp From 653006cc3ab30d3253a55e5cb78b10314fb221ca Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:57 +0300 Subject: [PATCH 1331/2141] Revert "[nrf fromtree] samples: drivers: i2c: rtio_loopback: add nucleo_f401re/nucleo_h503rb" This reverts commit 315cc6e208e4f1eccf5159d6623389573dd45361. Signed-off-by: Jukka Rissanen --- .../boards/nucleo_f401re.overlay | 18 ----------- .../boards/nucleo_h503rb.overlay | 32 ------------------- samples/drivers/i2c/rtio_loopback/sample.yaml | 2 -- 3 files changed, 52 deletions(-) delete mode 100644 samples/drivers/i2c/rtio_loopback/boards/nucleo_f401re.overlay delete mode 100644 samples/drivers/i2c/rtio_loopback/boards/nucleo_h503rb.overlay diff --git a/samples/drivers/i2c/rtio_loopback/boards/nucleo_f401re.overlay b/samples/drivers/i2c/rtio_loopback/boards/nucleo_f401re.overlay deleted file mode 100644 index ffd09691a216..000000000000 --- a/samples/drivers/i2c/rtio_loopback/boards/nucleo_f401re.overlay +++ /dev/null @@ -1,18 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - -/* I2C bus pins are exposed on the ST morpho and Arduino headers. - * - * Bus SDA SCL - * Pin Hdr Pin Hdr - * i2c1 PB9 CN5:9 PB8 CN5:10 - * i2c3 PC9 CN10:1 PA8 CN9:8 - * - * Short Pin PB9 to PC9, and PB8 to PA8, for the test to pass. - */ - -/ { - aliases { - i2c-controller = &i2c1; - i2c-controller-target = &i2c3; - }; -}; diff --git a/samples/drivers/i2c/rtio_loopback/boards/nucleo_h503rb.overlay b/samples/drivers/i2c/rtio_loopback/boards/nucleo_h503rb.overlay deleted file mode 100644 index b53a0560eb64..000000000000 --- a/samples/drivers/i2c/rtio_loopback/boards/nucleo_h503rb.overlay +++ /dev/null @@ -1,32 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - -/* I2C bus pins are exposed on the ST morpho and Arduino headers. - * - * Bus SDA SCL - * Pin Hdr Pin Hdr - * i2c1 PB7 CN5:9 PB6 CN5:10/CN10:3 - * i2c2 PB4 CN9:6/CN10:27 PB5 CN9:5/CN10:29 - * - * Short Pin PB7 to PB4, and PB6 to PB5, for the test to pass. - */ - -/ { - aliases { - i2c-controller = &i2c1; - i2c-controller-target = &i2c2; - }; -}; - -&i2c1 { - pinctrl-0 = <&i2c1_scl_pb6 &i2c1_sda_pb7>; - pinctrl-names = "default"; - clock-frequency = ; - status = "okay"; -}; - -&i2c2 { - pinctrl-0 = <&i2c2_scl_pb5 &i2c2_sda_pb4>; - pinctrl-names = "default"; - clock-frequency = ; - status = "okay"; -}; diff --git a/samples/drivers/i2c/rtio_loopback/sample.yaml b/samples/drivers/i2c/rtio_loopback/sample.yaml index a18bfb940703..cf081c7670c7 100644 --- a/samples/drivers/i2c/rtio_loopback/sample.yaml +++ b/samples/drivers/i2c/rtio_loopback/sample.yaml @@ -16,6 +16,4 @@ tests: - nrf5340dk/nrf5340/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54h20dk/nrf54h20/cpuapp - - nucleo_f401re - - nucleo_h503rb - ophelia4ev/nrf54l15/cpuapp From cf65db264c0d81606558496531f5f28758910821 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:57 +0300 Subject: [PATCH 1332/2141] Revert "[nrf fromtree] samples: drivers: counter: alarm: Cleanup platform_allow for nrf54*" This reverts commit 7584dae8ce9f9269b8301340f3f8cdb91ddf8bbd. Signed-off-by: Jukka Rissanen --- .../alarm/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay | 9 +++++++++ samples/drivers/counter/alarm/sample.yaml | 7 ------- 2 files changed, 9 insertions(+), 7 deletions(-) create mode 100644 samples/drivers/counter/alarm/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay diff --git a/samples/drivers/counter/alarm/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/samples/drivers/counter/alarm/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay new file mode 100644 index 000000000000..0847233437ba --- /dev/null +++ b/samples/drivers/counter/alarm/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay @@ -0,0 +1,9 @@ +/ { + chosen { + counter = &timer24; + }; +}; + +&timer24 { + status = "okay"; +}; diff --git a/samples/drivers/counter/alarm/sample.yaml b/samples/drivers/counter/alarm/sample.yaml index 1b4c34b9146f..c3f141f680d1 100644 --- a/samples/drivers/counter/alarm/sample.yaml +++ b/samples/drivers/counter/alarm/sample.yaml @@ -21,13 +21,6 @@ tests: - nrf51dk/nrf51822 - nrf52dk/nrf52832 - nrf52840dk/nrf52840 - - nrf54h20dk/nrf54h20/cpuapp - - nrf54h20dk/nrf54h20/cpuflpr - - nrf54h20dk/nrf54h20/cpuppr - - nrf54h20dk/nrf54h20/cpurad - - nrf54l15dk/nrf54l15/cpuapp - - nrf54l15dk/nrf54l15/cpuflpr - - nrf54lm20dk/nrf54lm20a/cpuapp - nrf9160dk/nrf9160 - samd20_xpro - bl5340_dvk/nrf5340/cpuapp From 9f0e5f3a650e97ee2c87c547b9e58e5f2c2b860d Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:57 +0300 Subject: [PATCH 1333/2141] Revert "[nrf fromtree] samples: drivers: audio: dmic: Cleanup after nRF54LM20 rename" This reverts commit 8032459514ca951644ab1a2fff64bd3f918a3ad0. Signed-off-by: Jukka Rissanen --- .../nrf54l20pdk_nrf54l20_cpuapp.overlay | 21 +++++++++++++++++++ .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 4 ---- 2 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 samples/drivers/audio/dmic/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay diff --git a/samples/drivers/audio/dmic/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/samples/drivers/audio/dmic/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay new file mode 100644 index 000000000000..3699a9e9563e --- /dev/null +++ b/samples/drivers/audio/dmic/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + pdm20_default_alt: pdm20_default_alt { + group1 { + psels = , + ; + }; + }; +}; + +dmic_dev: &pdm20 { + status = "okay"; + pinctrl-0 = <&pdm20_default_alt>; + pinctrl-names = "default"; + clock-source = "PCLK32M"; +}; diff --git a/samples/drivers/audio/dmic/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/samples/drivers/audio/dmic/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay index b3e08098722d..c850cede53d0 100644 --- a/samples/drivers/audio/dmic/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ b/samples/drivers/audio/dmic/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -4,10 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/* Test requires loopback between P1.23 and P1.24. - * For best performance, PDM_CLK shall be on 'Clock pin'. - */ - &pinctrl { pdm20_default_alt: pdm20_default_alt { group1 { From b2df87548f3f1fe026920d22b0d7f088cfb6fc19 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:57 +0300 Subject: [PATCH 1334/2141] Revert "[nrf fromtree] samples: drivers: adc: adc_sequence: Enable sample on nrf54lm20dk" This reverts commit 0c5e5ca00cbb8239f73e1f6afcd44b5781b58f20. Signed-off-by: Jukka Rissanen --- .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 50 ------------------- samples/drivers/adc/adc_sequence/sample.yaml | 6 +-- 2 files changed, 2 insertions(+), 54 deletions(-) delete mode 100644 samples/drivers/adc/adc_sequence/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay diff --git a/samples/drivers/adc/adc_sequence/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/samples/drivers/adc/adc_sequence/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay deleted file mode 100644 index a85e9e7e611c..000000000000 --- a/samples/drivers/adc/adc_sequence/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/ { - aliases { - adc0 = &adc; - }; -}; - -&adc { - #address-cells = <1>; - #size-cells = <0>; - status = "okay"; - - channel@0 { - reg = <0>; - zephyr,gain = "ADC_GAIN_1"; - zephyr,reference = "ADC_REF_INTERNAL"; - zephyr,acquisition-time = ; - zephyr,input-positive = ; /* P1.06 */ - }; - - channel@1 { - reg = <1>; - zephyr,gain = "ADC_GAIN_1"; - zephyr,reference = "ADC_REF_INTERNAL"; - zephyr,acquisition-time = ; - zephyr,input-positive = ; /* P1.30 */ - }; - - channel@2 { - reg = <2>; - zephyr,gain = "ADC_GAIN_1"; - zephyr,reference = "ADC_REF_INTERNAL"; - zephyr,acquisition-time = ; - zephyr,input-positive = ; /* 0.9 V internal */ - }; - - channel@7 { - reg = <7>; - zephyr,gain = "ADC_GAIN_1"; - zephyr,reference = "ADC_REF_INTERNAL"; - zephyr,acquisition-time = ; - zephyr,input-positive = ; /* P1.04 */ - zephyr,input-negative = ; /* P1.03 */ - }; -}; diff --git a/samples/drivers/adc/adc_sequence/sample.yaml b/samples/drivers/adc/adc_sequence/sample.yaml index affa120345ba..09edd4cc03ce 100644 --- a/samples/drivers/adc/adc_sequence/sample.yaml +++ b/samples/drivers/adc/adc_sequence/sample.yaml @@ -18,9 +18,8 @@ tests: - cy8cproto_063_ble - cy8cproto_062_4343w - nrf52840dk/nrf52840 - - nrf54h20dk/nrf54h20/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp + - nrf54h20dk/nrf54h20/cpuapp - ophelia4ev/nrf54l15/cpuapp - raytac_an54l15q_db/nrf54l15/cpuapp - ucans32k1sic @@ -30,9 +29,8 @@ tests: - nrf52840dk/nrf52840 sample.drivers.adc.adc_sequence.8bit: platform_allow: - - nrf54h20dk/nrf54h20/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp + - nrf54h20dk/nrf54h20/cpuapp integration_platforms: - nrf54l15dk/nrf54l15/cpuapp extra_configs: From 435f6e2c628acfc096f7cf0843cc4a83a8b36f70 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:57 +0300 Subject: [PATCH 1335/2141] Revert "[nrf fromtree] samples: drivers: adc: Add variant for 8-bit resolution on nRF54x" This reverts commit 7babfb39f48bd4eebadd5dee62567fefb25111cb. Signed-off-by: Jukka Rissanen --- samples/drivers/adc/adc_sequence/sample.yaml | 31 +++++++------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/samples/drivers/adc/adc_sequence/sample.yaml b/samples/drivers/adc/adc_sequence/sample.yaml index 09edd4cc03ce..9a824045d130 100644 --- a/samples/drivers/adc/adc_sequence/sample.yaml +++ b/samples/drivers/adc/adc_sequence/sample.yaml @@ -1,19 +1,10 @@ sample: name: ADC driver sequence sample -common: - tags: - - adc - depends_on: adc - harness: console - timeout: 10 - harness_config: - type: multi_line - regex: - - "ADC sequence reading \\[\\d+\\]:" - - "- .+, channel \\d+, \\d+ sequence samples:" - - "- - \\d+ (= \\d+mV)|(\\(value in mV not available\\))" tests: sample.drivers.adc.adc_sequence: + tags: + - adc + depends_on: adc platform_allow: - cy8cproto_063_ble - cy8cproto_062_4343w @@ -27,11 +18,11 @@ tests: - stm32f3_disco integration_platforms: - nrf52840dk/nrf52840 - sample.drivers.adc.adc_sequence.8bit: - platform_allow: - - nrf54l15dk/nrf54l15/cpuapp - - nrf54h20dk/nrf54h20/cpuapp - integration_platforms: - - nrf54l15dk/nrf54l15/cpuapp - extra_configs: - - CONFIG_SEQUENCE_RESOLUTION=8 + harness: console + timeout: 10 + harness_config: + type: multi_line + regex: + - "ADC sequence reading \\[\\d+\\]:" + - "- .+, channel \\d+, \\d+ sequence samples:" + - "- - \\d+ (= \\d+mV)|(\\(value in mV not available\\))" From f9c1a41e4fd27c2e4399a45c720c24f03fe36322 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:57 +0300 Subject: [PATCH 1336/2141] Revert "[nrf fromtree] samples: drivers: adc_sequence: Remove misleading parts of nRF overlays" This reverts commit 8a76c39ec17e3b7672d120ade2d2c89543075a17. Signed-off-by: Jukka Rissanen --- .../adc_sequence/boards/nrf52840dk_nrf52840.overlay | 1 + .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 12 ++++++++++++ .../boards/nrf54l15dk_nrf54l15_cpuapp.overlay | 12 ++++++++++++ 3 files changed, 25 insertions(+) diff --git a/samples/drivers/adc/adc_sequence/boards/nrf52840dk_nrf52840.overlay b/samples/drivers/adc/adc_sequence/boards/nrf52840dk_nrf52840.overlay index 99a0e7089ca7..34107d84748e 100644 --- a/samples/drivers/adc/adc_sequence/boards/nrf52840dk_nrf52840.overlay +++ b/samples/drivers/adc/adc_sequence/boards/nrf52840dk_nrf52840.overlay @@ -28,5 +28,6 @@ zephyr,reference = "ADC_REF_INTERNAL"; zephyr,acquisition-time = ; zephyr,input-positive = ; + zephyr,oversampling = <8>; }; }; diff --git a/samples/drivers/adc/adc_sequence/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/samples/drivers/adc/adc_sequence/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index d4f9e8db7c2b..24cce679375a 100644 --- a/samples/drivers/adc/adc_sequence/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/samples/drivers/adc/adc_sequence/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -10,6 +10,12 @@ }; }; +/ { + zephyr,user { + io-channels = <&adc 0>, <&adc 1>, <&adc 2>, <&adc 7>; + }; +}; + &adc { #address-cells = <1>; #size-cells = <0>; @@ -20,6 +26,7 @@ zephyr,reference = "ADC_REF_INTERNAL"; zephyr,acquisition-time = ; zephyr,input-positive = ; /* P1.01 */ + zephyr,resolution = <10>; }; channel@1 { @@ -28,6 +35,8 @@ zephyr,reference = "ADC_REF_INTERNAL"; zephyr,acquisition-time = ; zephyr,input-positive = ; /* P1.02 */ + zephyr,resolution = <12>; + zephyr,oversampling = <8>; }; channel@2 { @@ -37,6 +46,8 @@ zephyr,acquisition-time = ; zephyr,input-positive = ; /* P9.01 */ zephyr,vref-mv = <3686>; /* 3.6V * 1024 */ + zephyr,resolution = <12>; + zephyr,oversampling = <8>; }; channel@7 { @@ -46,5 +57,6 @@ zephyr,acquisition-time = ; zephyr,input-positive = ; /* P1.03 */ zephyr,input-negative = ; /* P1.07 */ + zephyr,resolution = <12>; }; }; diff --git a/samples/drivers/adc/adc_sequence/boards/nrf54l15dk_nrf54l15_cpuapp.overlay b/samples/drivers/adc/adc_sequence/boards/nrf54l15dk_nrf54l15_cpuapp.overlay index 87b8e373f1db..7fedbe52ad2f 100644 --- a/samples/drivers/adc/adc_sequence/boards/nrf54l15dk_nrf54l15_cpuapp.overlay +++ b/samples/drivers/adc/adc_sequence/boards/nrf54l15dk_nrf54l15_cpuapp.overlay @@ -4,6 +4,12 @@ * Copyright (c) 2024 Nordic Semiconductor ASA */ +/ { + zephyr,user { + io-channels = <&adc 0>, <&adc 1>, <&adc 2>, <&adc 7>; + }; +}; + / { aliases { adc0 = &adc; @@ -20,6 +26,7 @@ zephyr,reference = "ADC_REF_INTERNAL"; zephyr,acquisition-time = ; zephyr,input-positive = ; /* P1.11 */ + zephyr,resolution = <10>; }; channel@1 { @@ -28,6 +35,8 @@ zephyr,reference = "ADC_REF_INTERNAL"; zephyr,acquisition-time = ; zephyr,input-positive = ; /* P1.06 */ + zephyr,resolution = <12>; + zephyr,oversampling = <8>; }; channel@2 { @@ -36,6 +45,8 @@ zephyr,reference = "ADC_REF_INTERNAL"; zephyr,acquisition-time = ; zephyr,input-positive = ; /* 0.9 V internal */ + zephyr,resolution = <12>; + zephyr,oversampling = <8>; }; channel@7 { @@ -45,5 +56,6 @@ zephyr,acquisition-time = ; zephyr,input-positive = ; /* P1.13 */ zephyr,input-negative = ; /* P1.14 */ + zephyr,resolution = <12>; }; }; From 4811cfa2831968b5df040e1e1b169e329fb3c504 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:57 +0300 Subject: [PATCH 1337/2141] Revert "[nrf fromtree] samples: drivers: adc: adc_dt: Enable sample on nrf54lm20dk" This reverts commit 23fb232f5a3357992357380c75db1f52d065d7ff. Signed-off-by: Jukka Rissanen --- .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 56 ------------------- samples/drivers/adc/adc_dt/sample.yaml | 3 +- 2 files changed, 1 insertion(+), 58 deletions(-) delete mode 100644 samples/drivers/adc/adc_dt/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay diff --git a/samples/drivers/adc/adc_dt/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/samples/drivers/adc/adc_dt/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay deleted file mode 100644 index 8953de6a5475..000000000000 --- a/samples/drivers/adc/adc_dt/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/ { - zephyr,user { - io-channels = <&adc 0>, <&adc 1>, <&adc 2>, <&adc 7>; - }; -}; - -&adc { - #address-cells = <1>; - #size-cells = <0>; - status = "okay"; - - channel@0 { - reg = <0>; - zephyr,gain = "ADC_GAIN_1"; - zephyr,reference = "ADC_REF_INTERNAL"; - zephyr,acquisition-time = ; - zephyr,input-positive = ; /* P1.06 */ - zephyr,resolution = <10>; - }; - - channel@1 { - reg = <1>; - zephyr,gain = "ADC_GAIN_1"; - zephyr,reference = "ADC_REF_INTERNAL"; - zephyr,acquisition-time = ; - zephyr,input-positive = ; /* P1.30 */ - zephyr,resolution = <12>; - zephyr,oversampling = <8>; - }; - - channel@2 { - reg = <2>; - zephyr,gain = "ADC_GAIN_1"; - zephyr,reference = "ADC_REF_INTERNAL"; - zephyr,acquisition-time = ; - zephyr,input-positive = ; - zephyr,resolution = <12>; - zephyr,oversampling = <8>; - }; - - channel@7 { - reg = <7>; - zephyr,gain = "ADC_GAIN_1"; - zephyr,reference = "ADC_REF_INTERNAL"; - zephyr,acquisition-time = ; - zephyr,input-positive = ; /* P1.04 */ - zephyr,input-negative = ; /* P1.03 */ - zephyr,resolution = <12>; - }; -}; diff --git a/samples/drivers/adc/adc_dt/sample.yaml b/samples/drivers/adc/adc_dt/sample.yaml index 2a32be6983b2..1592685e9f72 100644 --- a/samples/drivers/adc/adc_dt/sample.yaml +++ b/samples/drivers/adc/adc_dt/sample.yaml @@ -15,9 +15,8 @@ tests: - stm32h735g_disco - nrf51dk/nrf51822 - nrf52840dk/nrf52840 - - nrf54h20dk/nrf54h20/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp + - nrf54h20dk/nrf54h20/cpuapp - ophelia4ev/nrf54l15/cpuapp - mec172xevb_assy6906 - gd32f350r_eval From e9810657605cd419922f82f20534d28649d59d02 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:57 +0300 Subject: [PATCH 1338/2141] Revert "[nrf fromtree] samples: boards: nordic: system_off: Cleanup after nRF54LM20 rename" This reverts commit 196735ca2526e9ae81282be1953e6cfc9d74b331. Signed-off-by: Jukka Rissanen --- .../nrf54l20pdk_nrf54l20_cpuapp.overlay | 25 +++++++++++++++++++ samples/boards/nordic/system_off/sample.yaml | 4 +++ 2 files changed, 29 insertions(+) create mode 100644 samples/boards/nordic/system_off/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay diff --git a/samples/boards/nordic/system_off/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay b/samples/boards/nordic/system_off/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay new file mode 100644 index 000000000000..3a79636a4833 --- /dev/null +++ b/samples/boards/nordic/system_off/boards/nrf54l20pdk_nrf54l20_cpuapp.overlay @@ -0,0 +1,25 @@ +/ { + cpuapp_sram@2007ec00 { + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0x2007ec00 DT_SIZE_K(4)>; + zephyr,memory-region = "RetainedMem"; + status = "okay"; + + retainedmem0: retainedmem { + compatible = "zephyr,retained-ram"; + status = "okay"; + }; + }; + + aliases { + retainedmemdevice = &retainedmem0; + }; +}; + +&cpuapp_sram { + /* Shrink SRAM size to avoid overlap with retained memory region: + * 511 - 4 = 507KB = 0x7ec00 + */ + reg = <0x20000000 DT_SIZE_K(507)>; + ranges = <0x0 0x20000000 0x7ec00>; +}; diff --git a/samples/boards/nordic/system_off/sample.yaml b/samples/boards/nordic/system_off/sample.yaml index b11f3439e7f6..9b0e39a6cea1 100644 --- a/samples/boards/nordic/system_off/sample.yaml +++ b/samples/boards/nordic/system_off/sample.yaml @@ -14,6 +14,7 @@ tests: - nrf54l15dk/nrf54l05/cpuapp - nrf54l15dk/nrf54l10/cpuapp - nrf54l15dk/nrf54l15/cpuapp + - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp harness: console harness_config: @@ -33,6 +34,7 @@ tests: - nrf54l15dk/nrf54l05/cpuapp - nrf54l15dk/nrf54l10/cpuapp - nrf54l15dk/nrf54l15/cpuapp + - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp extra_configs: - CONFIG_APP_USE_RETAINED_MEM=y @@ -52,6 +54,7 @@ tests: - nrf54l15dk/nrf54l05/cpuapp - nrf54l15dk/nrf54l10/cpuapp - nrf54l15dk/nrf54l15/cpuapp + - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp extra_configs: - CONFIG_GRTC_WAKEUP_ENABLE=y @@ -76,6 +79,7 @@ tests: - nrf54l15dk/nrf54l05/cpuapp - nrf54l15dk/nrf54l10/cpuapp - nrf54l15dk/nrf54l15/cpuapp + - nrf54l20pdk/nrf54l20/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp extra_configs: - CONFIG_APP_USE_RETAINED_MEM=y From 9bbe64e32236d1a1e34590f3e369f0541b581165 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:57 +0300 Subject: [PATCH 1339/2141] Revert "[nrf fromtree] drivers: ieee802154: nrf5: prevent negative timestamps" This reverts commit 7fe19a72a85c5e1389250ef76db13b7fff5f9883. Signed-off-by: Jukka Rissanen --- drivers/ieee802154/ieee802154_nrf5.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/ieee802154/ieee802154_nrf5.c b/drivers/ieee802154/ieee802154_nrf5.c index aa67a1f99e15..e5051e731f43 100644 --- a/drivers/ieee802154/ieee802154_nrf5.c +++ b/drivers/ieee802154/ieee802154_nrf5.c @@ -1121,12 +1121,8 @@ void nrf_802154_received_timestamp_raw(uint8_t *data, int8_t power, uint8_t lqi, nrf5_data.rx_frames[i].lqi = lqi; #if defined(CONFIG_NET_PKT_TIMESTAMP) - if (time != NRF_802154_NO_TIMESTAMP) { - nrf5_data.rx_frames[i].time = - nrf_802154_timestamp_end_to_phr_convert(time, data[0]); - } else { - nrf5_data.rx_frames[i].time = 0; - } + nrf5_data.rx_frames[i].time = + nrf_802154_timestamp_end_to_phr_convert(time, data[0]); #endif nrf5_data.rx_frames[i].ack_fpb = nrf5_data.last_frame_ack_fpb; From 533a861dcc95c775788331cbe73704c7be81bd5b Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:57 +0300 Subject: [PATCH 1340/2141] Revert "[nrf fromtree] drivers: ieee802154: nrf5: drop packets that are too long" This reverts commit 14324541dbc20b242c6d6e5ff0a16acdd10a06fa. Signed-off-by: Jukka Rissanen --- drivers/ieee802154/ieee802154_nrf5.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/ieee802154/ieee802154_nrf5.c b/drivers/ieee802154/ieee802154_nrf5.c index e5051e731f43..25ec35961c79 100644 --- a/drivers/ieee802154/ieee802154_nrf5.c +++ b/drivers/ieee802154/ieee802154_nrf5.c @@ -179,12 +179,7 @@ static void nrf5_rx_thread(void *arg1, void *arg2, void *arg3) } #if defined(CONFIG_NET_BUF_DATA_SIZE) - if (pkt_len > CONFIG_NET_BUF_DATA_SIZE) { - LOG_ERR("Received a frame exceeding the buffer size (%u): %u", - CONFIG_NET_BUF_DATA_SIZE, pkt_len); - LOG_HEXDUMP_ERR(rx_frame->psdu, rx_frame->psdu[0] + 1, "Received PSDU"); - goto drop; - } + __ASSERT_NO_MSG(pkt_len <= CONFIG_NET_BUF_DATA_SIZE); #endif LOG_DBG("Frame received"); @@ -237,9 +232,7 @@ static void nrf5_rx_thread(void *arg1, void *arg2, void *arg3) rx_frame->psdu = NULL; nrf_802154_buffer_free_raw(psdu); - if (pkt) { - net_pkt_unref(pkt); - } + net_pkt_unref(pkt); } } From f64eff2f7a13a2c7613bfb81beac14464c325e78 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:57 +0300 Subject: [PATCH 1341/2141] Revert "[nrf fromtree] lib: zvfs: Add default eventfd count for hostap" This reverts commit 7393d5b087e428f72bcedecd9da7260744ee01f9. Signed-off-by: Jukka Rissanen --- lib/os/zvfs/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/os/zvfs/Kconfig b/lib/os/zvfs/Kconfig index a9c9518a1d5d..101e2cce0864 100644 --- a/lib/os/zvfs/Kconfig +++ b/lib/os/zvfs/Kconfig @@ -26,7 +26,6 @@ if ZVFS_EVENTFD config ZVFS_EVENTFD_MAX int "Maximum number of ZVFS eventfd's" - default 8 if WIFI_NM_WPA_SUPPLICANT default 1 range 1 4096 help From fe4937bd177585c2fc9c3a71886da5a8337f41ca Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:57 +0300 Subject: [PATCH 1342/2141] Revert "[nrf fromlist] drivers: nrf_wifi: Fix deadlock in display scan and recovery" This reverts commit 6ec35ab31bc406a96f282cd0520aff5fba8ca664. Signed-off-by: Jukka Rissanen --- drivers/wifi/nrf_wifi/inc/fmac_main.h | 1 - drivers/wifi/nrf_wifi/src/fmac_main.c | 30 ++++++--------------------- 2 files changed, 6 insertions(+), 25 deletions(-) diff --git a/drivers/wifi/nrf_wifi/inc/fmac_main.h b/drivers/wifi/nrf_wifi/inc/fmac_main.h index c193515ae2dd..2f49ed8b055f 100644 --- a/drivers/wifi/nrf_wifi/inc/fmac_main.h +++ b/drivers/wifi/nrf_wifi/inc/fmac_main.h @@ -52,7 +52,6 @@ struct nrf_wifi_vif_ctx_zep { uint16_t max_bss_cnt; unsigned int scan_res_cnt; struct k_work_delayable scan_timeout_work; - struct k_work disp_scan_res_work; struct net_eth_addr mac_addr; int if_type; diff --git a/drivers/wifi/nrf_wifi/src/fmac_main.c b/drivers/wifi/nrf_wifi/src/fmac_main.c index 379c3242b182..92a58be9a099 100644 --- a/drivers/wifi/nrf_wifi/src/fmac_main.c +++ b/drivers/wifi/nrf_wifi/src/fmac_main.c @@ -171,8 +171,12 @@ void nrf_wifi_event_proc_scan_done_zep(void *vif_ctx, switch (vif_ctx_zep->scan_type) { #ifdef CONFIG_NET_L2_WIFI_MGMT case SCAN_DISPLAY: - /* Schedule scan result processing in system workqueue to avoid deadlock */ - k_work_submit(&vif_ctx_zep->disp_scan_res_work); + status = nrf_wifi_disp_scan_res_get_zep(vif_ctx_zep); + if (status != NRF_WIFI_STATUS_SUCCESS) { + LOG_ERR("%s: nrf_wifi_disp_scan_res_get_zep failed", __func__); + return; + } + vif_ctx_zep->scan_in_progress = false; break; #endif /* CONFIG_NET_L2_WIFI_MGMT */ #ifdef CONFIG_NRF70_STA_MODE @@ -238,26 +242,6 @@ void nrf_wifi_scan_timeout_work(struct k_work *work) vif_ctx_zep->scan_in_progress = false; } -void nrf_wifi_disp_scan_res_work_handler(struct k_work *work) -{ - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - - vif_ctx_zep = CONTAINER_OF(work, struct nrf_wifi_vif_ctx_zep, disp_scan_res_work); - - if (!vif_ctx_zep) { - LOG_ERR("%s: vif_ctx_zep is NULL", __func__); - return; - } - - status = nrf_wifi_disp_scan_res_get_zep(vif_ctx_zep); - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: nrf_wifi_disp_scan_res_get_zep failed", __func__); - return; - } - vif_ctx_zep->scan_in_progress = false; -} - #ifdef CONFIG_NRF70_STA_MODE static void nrf_wifi_process_rssi_from_rx(void *vif_ctx, signed short signal) @@ -853,8 +837,6 @@ static int nrf_wifi_drv_main_zep(const struct device *dev) #else k_work_init_delayable(&vif_ctx_zep->scan_timeout_work, nrf_wifi_scan_timeout_work); - k_work_init(&vif_ctx_zep->disp_scan_res_work, - nrf_wifi_disp_scan_res_work_handler); #endif /* CONFIG_NRF70_RADIO_TEST */ k_mutex_init(&rpu_drv_priv_zep.rpu_ctx_zep.rpu_lock); From f28606ac1a0a98e81c4336e7fe6a0f6c5d1c1708 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:57 +0300 Subject: [PATCH 1343/2141] Revert "[nrf fromlist] modules: nrf_wifi: Fix bustest QSPI crash" This reverts commit ee7e5ec43237eccdf624b22e5833dd3b209aa635. Signed-off-by: Jukka Rissanen --- .../zephyr/drivers/wifi/nrf_wifi/bus/rpu_hw_if.h | 5 ----- modules/nrf_wifi/bus/qspi_if.c | 15 +++++++++------ 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/include/zephyr/drivers/wifi/nrf_wifi/bus/rpu_hw_if.h b/include/zephyr/drivers/wifi/nrf_wifi/bus/rpu_hw_if.h index 2fecce9cdc7f..2524b64ab505 100644 --- a/include/zephyr/drivers/wifi/nrf_wifi/bus/rpu_hw_if.h +++ b/include/zephyr/drivers/wifi/nrf_wifi/bus/rpu_hw_if.h @@ -31,11 +31,6 @@ enum { NUM_MEM_BLOCKS }; -/* Keeping it higher to avoid changing it ofter, but modify this value - * if rpu_7002_memmap is changed. - */ -#define NRF_WIFI_QSPI_SLAVE_MAX_LATENCY 4 - extern char blk_name[][15]; extern uint32_t rpu_7002_memmap[][3]; diff --git a/modules/nrf_wifi/bus/qspi_if.c b/modules/nrf_wifi/bus/qspi_if.c index 97bab6335c44..949aa591274a 100644 --- a/modules/nrf_wifi/bus/qspi_if.c +++ b/modules/nrf_wifi/bus/qspi_if.c @@ -23,8 +23,8 @@ #include #include -#include #include "spi_nor.h" +#include "osal_api.h" /* The QSPI bus node which the NRF70 is on */ #define QSPI_IF_BUS_NODE DT_NODELABEL(qspi) @@ -1290,14 +1290,15 @@ int qspi_read(unsigned int addr, void *data, int len) int qspi_hl_readw(unsigned int addr, void *data) { int status; + uint8_t *rxb = NULL; uint32_t len = 4; - uint8_t rxb[4 + (NRF_WIFI_QSPI_SLAVE_MAX_LATENCY * 4)]; - len += (4 * qspi_cfg->qspi_slave_latency); + len = len + (4 * qspi_cfg->qspi_slave_latency); - if (len > sizeof(rxb)) { - LOG_ERR("%s: len exceeded, check NRF_WIFI_QSPI_SLAVE_MAX_LATENCY (len=%u, rxb=%zu)", - __func__, (unsigned int)len, sizeof(rxb)); + rxb = nrf_wifi_osal_mem_alloc(len); + + if (rxb == NULL) { + LOG_ERR("%s: ERROR ENOMEM line %d", __func__, __LINE__); return -ENOMEM; } @@ -1313,6 +1314,8 @@ int qspi_hl_readw(unsigned int addr, void *data) *(uint32_t *)data = *(uint32_t *)(rxb + (len - 4)); + nrf_wifi_osal_mem_free(rxb); + return status; } From 1e102731e01c49c8b63f6bf03ddf155c53b80b70 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:58 +0300 Subject: [PATCH 1344/2141] Revert "[nrf fromtree] manifest: hostap: Pull fix for warning in interface down" This reverts commit f602a47bdf6ea3a2ee4374fdf731887c55cc43ba. Signed-off-by: Jukka Rissanen --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index d15e692caa4d..e1ff77d7c2be 100644 --- a/west.yml +++ b/west.yml @@ -281,7 +281,7 @@ manifest: - hal - name: hostap path: modules/lib/hostap - revision: e942f86e865d5b24bbbe8b0c333f030cbbe62bfb + revision: bc5d22f5838d017b889d1452a5854f9a32895414 - name: liblc3 revision: 48bbd3eacd36e99a57317a0a4867002e0b09e183 path: modules/lib/liblc3 From 93036b4ed28632a18a211bc3051640dfd8bb5ce6 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:58 +0300 Subject: [PATCH 1345/2141] Revert "[nrf fromtree] manifest: Use k_fifo for IPC in hostap" This reverts commit 7e7af912181ef1558dc827f28b41f2bc42925e29. Signed-off-by: Jukka Rissanen --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index e1ff77d7c2be..c7f54a8dda81 100644 --- a/west.yml +++ b/west.yml @@ -281,7 +281,7 @@ manifest: - hal - name: hostap path: modules/lib/hostap - revision: bc5d22f5838d017b889d1452a5854f9a32895414 + revision: cf270006050cf944af699301c7f4de2b427cd862 - name: liblc3 revision: 48bbd3eacd36e99a57317a0a4867002e0b09e183 path: modules/lib/liblc3 From 9e71c7ec05d8ad87577257af40e9235e0199fcba Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:58 +0300 Subject: [PATCH 1346/2141] Revert "[nrf fromtree] manifest: hostap: sync for coverity fix" This reverts commit 99b2e349decfd5a91294552de7c253aa540e86ad. Signed-off-by: Jukka Rissanen --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index c7f54a8dda81..9e29918fb21b 100644 --- a/west.yml +++ b/west.yml @@ -281,7 +281,7 @@ manifest: - hal - name: hostap path: modules/lib/hostap - revision: cf270006050cf944af699301c7f4de2b427cd862 + revision: 8412f4b23b6267ee6035d25515a23aaf243f6ad7 - name: liblc3 revision: 48bbd3eacd36e99a57317a0a4867002e0b09e183 path: modules/lib/liblc3 From 229b8ec13e0fab37b3466a0fe9de357f3679f054 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:58 +0300 Subject: [PATCH 1347/2141] Revert "[nrf fromtree] modules: hostap: set the cipher suites for WPA2 & WPA3 SAE mode" This reverts commit 00420dcf6bbbd37e0e43e26c5dae2dbe20289a2e. Signed-off-by: Jukka Rissanen --- modules/hostap/src/supp_api.c | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/modules/hostap/src/supp_api.c b/modules/hostap/src/supp_api.c index cde1ef95f478..c459171329b9 100644 --- a/modules/hostap/src/supp_api.c +++ b/modules/hostap/src/supp_api.c @@ -752,14 +752,6 @@ static int wpas_add_and_config_network(struct wpa_supplicant *wpa_s, goto out; } } - - if (!wpa_cli_cmd_v("set_network %d group CCMP", resp.network_id)) { - goto out; - } - - if (!wpa_cli_cmd_v("set_network %d pairwise CCMP", resp.network_id)) { - goto out; - } } else if (params->security == WIFI_SECURITY_TYPE_PSK_SHA256) { if (!wpa_cli_cmd_v("set_network %d psk \"%s\"", resp.network_id, psk_null_terminated)) { @@ -770,14 +762,6 @@ static int wpas_add_and_config_network(struct wpa_supplicant *wpa_s, resp.network_id)) { goto out; } - - if (!wpa_cli_cmd_v("set_network %d group CCMP", resp.network_id)) { - goto out; - } - - if (!wpa_cli_cmd_v("set_network %d pairwise CCMP", resp.network_id)) { - goto out; - } } else if (params->security == WIFI_SECURITY_TYPE_PSK || params->security == WIFI_SECURITY_TYPE_WPA_PSK) { if (!wpa_cli_cmd_v("set_network %d psk \"%s\"", @@ -795,15 +779,6 @@ static int wpas_add_and_config_network(struct wpa_supplicant *wpa_s, resp.network_id)) { goto out; } - } else { - if (!wpa_cli_cmd_v("set_network %d group CCMP", resp.network_id)) { - goto out; - } - - if (!wpa_cli_cmd_v("set_network %d pairwise CCMP", - resp.network_id)) { - goto out; - } } } else if (params->security == WIFI_SECURITY_TYPE_WPA_AUTO_PERSONAL) { if (!wpa_cli_cmd_v("set_network %d psk \"%s\"", resp.network_id, @@ -831,14 +806,6 @@ static int wpas_add_and_config_network(struct wpa_supplicant *wpa_s, resp.network_id)) { goto out; } - - if (!wpa_cli_cmd_v("set_network %d group CCMP", resp.network_id)) { - goto out; - } - - if (!wpa_cli_cmd_v("set_network %d pairwise CCMP", resp.network_id)) { - goto out; - } #ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE } else if (is_eap_valid_security(params->security)) { if (process_cipher_config(params, &cipher_config)) { From 0e15c05698c7162a804b549f3f55a6196df3b6e3 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:58 +0300 Subject: [PATCH 1348/2141] Revert "[nrf fromtree] modules: hostap: Set default stack size for softAP mode" This reverts commit 7b47aaad615c6ffa50d4c2c9a20654c320f4180d. Signed-off-by: Jukka Rissanen --- modules/hostap/Kconfig | 2 -- 1 file changed, 2 deletions(-) diff --git a/modules/hostap/Kconfig b/modules/hostap/Kconfig index 2056a43e8729..743cbf372047 100644 --- a/modules/hostap/Kconfig +++ b/modules/hostap/Kconfig @@ -37,8 +37,6 @@ config WIFI_NM_WPA_SUPPLICANT_THREAD_STACK_SIZE # TODO: Providing higher stack size for Enterprise mode to fix stack # overflow issues. Need to identify the cause for higher stack usage. default 8192 if WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE - # This is needed to handle stack overflow issues on nRF Wi-Fi drivers. - default 5900 if WIFI_NM_WPA_SUPPLICANT_AP default 5800 config WIFI_NM_WPA_SUPPLICANT_WQ_STACK_SIZE From f2103c0cb23d84a309678934ee99682fa128f520 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:58 +0300 Subject: [PATCH 1349/2141] Revert "[nrf fromtree] modules: hostap: supp_events: Fix possible null deference" This reverts commit 0e4a96918d01cbb7b09a745c3e70fb1a6c550dbb. Signed-off-by: Jukka Rissanen --- modules/hostap/src/supp_events.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/modules/hostap/src/supp_events.c b/modules/hostap/src/supp_events.c index c4175a416bea..f13552e8416b 100644 --- a/modules/hostap/src/supp_events.c +++ b/modules/hostap/src/supp_events.c @@ -304,15 +304,13 @@ int supplicant_send_wifi_mgmt_ap_sta_event(void *ctx, { struct sta_info *sta = data; struct wpa_supplicant *ap_ctx = ctx; - char *ifname; + char *ifname = ap_ctx->ifname; struct wifi_ap_sta_info sta_info = { 0 }; if (!ap_ctx || !sta) { return -EINVAL; } - ifname = ap_ctx->ifname; - memcpy(sta_info.mac, sta->addr, sizeof(sta_info.mac)); if (event == NET_EVENT_WIFI_CMD_AP_STA_CONNECTED) { From 5a472d787cd781dc558518f65bd8009ab29cccd6 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:58 +0300 Subject: [PATCH 1350/2141] Revert "[nrf fromtree] modules: hostap: hapd_events: Fix possible null deference" This reverts commit bd413c5868af9b981d8ca6c6d81e562d86dc2b8b. Signed-off-by: Jukka Rissanen --- modules/hostap/src/hapd_events.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/modules/hostap/src/hapd_events.c b/modules/hostap/src/hapd_events.c index deb4c1705de6..2d297b71aff6 100644 --- a/modules/hostap/src/hapd_events.c +++ b/modules/hostap/src/hapd_events.c @@ -69,15 +69,13 @@ int hostapd_send_wifi_mgmt_ap_sta_event(struct hostapd_iface *ap_ctx, void *data) { struct sta_info *sta = data; - char *ifname; + char *ifname = ap_ctx->bss[0]->conf->iface; struct wifi_ap_sta_info sta_info = { 0 }; if (!ap_ctx || !sta) { return -EINVAL; } - ifname = ap_ctx->bss[0]->conf->iface; - memcpy(sta_info.mac, sta->addr, sizeof(sta_info.mac)); if (event == NET_EVENT_WIFI_CMD_AP_STA_CONNECTED) { From b9e3814e02d04d82e163e318aa223e1a6ea10595 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:58 +0300 Subject: [PATCH 1351/2141] Revert "[nrf fromtree] build: kconfig: Add support for warning insecure features" This reverts commit 938330eeffad4f051e5e05bf30e20c6d0a0e2839. Signed-off-by: Jukka Rissanen --- Kconfig.zephyr | 6 ------ scripts/kconfig/kconfig.py | 12 ------------ share/sysbuild/Kconfig | 6 ------ 3 files changed, 24 deletions(-) diff --git a/Kconfig.zephyr b/Kconfig.zephyr index 4993e56c8b24..9baae3922090 100644 --- a/Kconfig.zephyr +++ b/Kconfig.zephyr @@ -1030,12 +1030,6 @@ config WARN_EXPERIMENTAL Print a warning when the Kconfig tree is parsed if any experimental features are enabled. -config NOT_SECURE - bool - help - Symbol to be selected by a feature to inidicate that feature is - not secure. - config TAINT bool help diff --git a/scripts/kconfig/kconfig.py b/scripts/kconfig/kconfig.py index 74f8513138f0..feb0b447a884 100755 --- a/scripts/kconfig/kconfig.py +++ b/scripts/kconfig/kconfig.py @@ -93,8 +93,6 @@ def main(): if kconf.syms.get('WARN_EXPERIMENTAL', kconf.y).tri_value == 2: check_experimental(kconf) - check_not_secure(kconf) - # Hack: Force all symbols to be evaluated, to catch warnings generated # during evaluation. Wait till the end to write the actual output files, so # that we don't generate any output if there are warnings-turned-errors. @@ -268,16 +266,6 @@ def check_experimental(kconf): selector_name = split_expr(selector, AND)[0].name warn(f'Experimental symbol {selector_name} is enabled.') -def check_not_secure(kconf): - not_secure = kconf.syms.get('NOT_SECURE') - dep_expr = kconf.n if not_secure is None else not_secure.rev_dep - - if dep_expr is not kconf.n: - selectors = [s for s in split_expr(dep_expr, OR) if expr_value(s) == 2] - for selector in selectors: - selector_name = split_expr(selector, AND)[0].name - warn(f'Not secure symbol {selector_name} is enabled.') - def promptless(sym): # Returns True if 'sym' has no prompt. Since the symbol might be defined in diff --git a/share/sysbuild/Kconfig b/share/sysbuild/Kconfig index 5f689e07399a..e2076941380a 100644 --- a/share/sysbuild/Kconfig +++ b/share/sysbuild/Kconfig @@ -69,12 +69,6 @@ config WARN_DEPRECATED Print a warning when the Kconfig tree is parsed if any deprecated features are enabled. -config NOT_SECURE - bool - help - Symbol to be selected by a feature to inidicate that feature is - not secure. - rsource "images/Kconfig" menu "Build options" From 2767d9576cd335dfb3bb5262754424adf1b43dd2 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:58 +0300 Subject: [PATCH 1352/2141] Revert "[nrf fromtree] modules: hostap: supp_api: Fix possible null deference" This reverts commit a6ffe954d7c1bead7465efbb33dc1ef1d7407e6f. Signed-off-by: Jukka Rissanen --- modules/hostap/src/supp_api.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/modules/hostap/src/supp_api.c b/modules/hostap/src/supp_api.c index c459171329b9..f58a9f7f78aa 100644 --- a/modules/hostap/src/supp_api.c +++ b/modules/hostap/src/supp_api.c @@ -1287,8 +1287,8 @@ int supplicant_status(const struct device *dev, struct wifi_iface_status *status struct wpa_ssid *ssid = wpa_s->current_ssid; u8 channel; struct signal_poll_resp signal_poll; - u8 *_ssid; - size_t ssid_len; + u8 *_ssid = ssid->ssid; + size_t ssid_len = ssid->ssid_len; struct status_resp cli_status; int proto; int key_mgmt; @@ -1299,8 +1299,6 @@ int supplicant_status(const struct device *dev, struct wifi_iface_status *status goto out; } - _ssid = ssid->ssid; - ssid_len = ssid->ssid_len; proto = ssid->proto; key_mgmt = ssid->key_mgmt; sae_pwe = wpa_s->conf->sae_pwe; @@ -1491,15 +1489,9 @@ int supplicant_11k_cfg(const struct device *dev, struct wifi_11k_params *params) int supplicant_11k_neighbor_request(const struct device *dev, struct wifi_11k_params *params) { - int ssid_len; + int ssid_len = strlen(params->ssid); - if (params == NULL) { - return -1; - } - - ssid_len = strlen(params->ssid); - - if (ssid_len > 0) { + if (params != NULL && ssid_len > 0) { if (ssid_len > WIFI_SSID_MAX_LEN) { wpa_printf(MSG_ERROR, "%s: ssid too long %u", __func__, ssid_len); From d2574e571138bfd75caaa0f40cc3812264674b53 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:58 +0300 Subject: [PATCH 1353/2141] Revert "[nrf fromtree] hostap: Set enterprise crypto insecure" This reverts commit 8c78f8c69f3dec9b128228cf9478ff633eca06a4. Signed-off-by: Jukka Rissanen --- modules/hostap/Kconfig | 5 ----- 1 file changed, 5 deletions(-) diff --git a/modules/hostap/Kconfig b/modules/hostap/Kconfig index 743cbf372047..6c8d88483cb2 100644 --- a/modules/hostap/Kconfig +++ b/modules/hostap/Kconfig @@ -198,12 +198,7 @@ config WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE select MBEDTLS_SERVER_NAME_INDICATION if MBEDTLS_BUILTIN select MBEDTLS_X509_CRL_PARSE_C select MBEDTLS_TLS_VERSION_1_2 - select NOT_SECURE depends on !WIFI_NM_WPA_SUPPLICANT_CRYPTO_NONE - help - Enable Enterprise Crypto support for WiFi. This feature - is considered NOT SECURE due the lack of certificate - validation. if WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE config EAP_TLS From 9d94cc868f6990783502ba2dd59dfd5061e72c54 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:58 +0300 Subject: [PATCH 1354/2141] Revert "[nrf fromtree] modules: hostap: fix connection termination report" This reverts commit 6cc5f638cf2d9653887140b4d4166c1dd2735f60. Signed-off-by: Jukka Rissanen --- modules/hostap/src/supp_events.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/modules/hostap/src/supp_events.c b/modules/hostap/src/supp_events.c index f13552e8416b..596ffa6ff560 100644 --- a/modules/hostap/src/supp_events.c +++ b/modules/hostap/src/supp_events.c @@ -224,24 +224,20 @@ int supplicant_send_wifi_mgmt_conn_event(void *ctx, int status_code) int supplicant_send_wifi_mgmt_disc_event(void *ctx, int reason_code) { struct wpa_supplicant *wpa_s = ctx; + int status = wpas_to_wifi_mgmt_disconn_status(reason_code); enum net_event_wifi_cmd event; - int status; if (!wpa_s || !wpa_s->current_ssid) { return -EINVAL; } if (wpa_s->wpa_state >= WPA_COMPLETED) { - /* Disconnect event code & status */ - status = wpas_to_wifi_mgmt_disconn_status(reason_code); if (wpa_s->current_ssid->mode == WPAS_MODE_AP) { event = NET_EVENT_WIFI_CMD_AP_DISABLE_RESULT; } else { event = NET_EVENT_WIFI_CMD_DISCONNECT_RESULT; } } else { - /* Connect event code & status */ - status = WIFI_STATUS_CONN_FAIL; if (wpa_s->current_ssid->mode == WPAS_MODE_AP) { event = NET_EVENT_WIFI_CMD_AP_ENABLE_RESULT; } else { From 5db78fe00e079d38e6aa0bea31a85d02c2b3772b Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:58 +0300 Subject: [PATCH 1355/2141] Revert "[nrf fromtree] modules: hostap: Fix EAP dependencies" This reverts commit a53d104799903cdfa61a39af955a1dd260753b97. Signed-off-by: Jukka Rissanen --- modules/hostap/Kconfig | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/modules/hostap/Kconfig b/modules/hostap/Kconfig index 6c8d88483cb2..11feefbb42d9 100644 --- a/modules/hostap/Kconfig +++ b/modules/hostap/Kconfig @@ -200,7 +200,6 @@ config WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE select MBEDTLS_TLS_VERSION_1_2 depends on !WIFI_NM_WPA_SUPPLICANT_CRYPTO_NONE -if WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE config EAP_TLS bool "EAP-TLS support" @@ -259,8 +258,7 @@ config EAP_ALL select EAP_GTC select EAP_TTLS select EAP_MSCHAPV2 - default y -endif # WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE + default y if WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE config WIFI_NM_WPA_SUPPLICANT_WPA3 bool "WPA3 support" @@ -304,7 +302,6 @@ config WIFI_NM_HOSTAPD_CRYPTO_ENTERPRISE bool "Hostapd crypto enterprise support" depends on WIFI_NM_HOSTAPD_AP -if WIFI_NM_HOSTAPD_CRYPTO_ENTERPRISE config EAP_SERVER_TLS bool "EAP-TLS server support" @@ -333,9 +330,7 @@ config EAP_SERVER_ALL select EAP_SERVER_PEAP select EAP_SERVER_GTC select EAP_SERVER_TTLS - default y - -endif # WIFI_NM_HOSTAPD_CRYPTO_ENTERPRISE + default y if WIFI_NM_HOSTAPD_CRYPTO_ENTERPRISE config WIFI_NM_WPA_SUPPLICANT_BSS_MAX_IDLE_TIME int "BSS max idle timeout in seconds" From a35b04ee33bce5df2d4463297e383231f52cfa99 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:58 +0300 Subject: [PATCH 1356/2141] Revert "[nrf fromtree] hostap: Replace wifi event mechanism by k_fifo" This reverts commit b567a543af1492984c401af6bc10b2cb8f326e2c. Signed-off-by: Jukka Rissanen --- modules/hostap/Kconfig | 3 +- modules/hostap/src/supp_main.c | 171 ++++++++++++++++----------------- subsys/net/lib/sockets/Kconfig | 5 + 3 files changed, 87 insertions(+), 92 deletions(-) diff --git a/modules/hostap/Kconfig b/modules/hostap/Kconfig index 11feefbb42d9..1dfe35410177 100644 --- a/modules/hostap/Kconfig +++ b/modules/hostap/Kconfig @@ -13,12 +13,11 @@ config WIFI_NM_WPA_SUPPLICANT select XSI_SINGLE_PROCESS select NET_SOCKETS select NET_SOCKETS_PACKET + select NET_SOCKETPAIR select NET_L2_WIFI_MGMT select WIFI_NM select EXPERIMENTAL select COMMON_LIBC_MALLOC - select ZVFS - select ZVFS_EVENTFD help WPA supplicant as a network management backend for WIFI_NM. diff --git a/modules/hostap/src/supp_main.c b/modules/hostap/src/supp_main.c index c2a4866b9218..5ba2ef5b10ce 100644 --- a/modules/hostap/src/supp_main.c +++ b/modules/hostap/src/supp_main.c @@ -11,7 +11,6 @@ LOG_MODULE_REGISTER(wifi_supplicant, CONFIG_WIFI_NM_WPA_SUPPLICANT_LOG_LEVEL); #include #include #include -#include #if !defined(CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_NONE) && !defined(CONFIG_MBEDTLS_ENABLE_HEAP) #include @@ -45,7 +44,6 @@ static K_THREAD_STACK_DEFINE(iface_wq_stack, CONFIG_WIFI_NM_WPA_SUPPLICANT_WQ_ST #include "fst/fst.h" #include "includes.h" #include "wpa_cli_zephyr.h" -#include "ctrl_iface_zephyr.h" #ifdef CONFIG_WIFI_NM_HOSTAPD_AP #include "hostapd.h" #include "hapd_main.h" @@ -111,8 +109,7 @@ struct supplicant_context { struct net_mgmt_event_callback cb; struct net_if *iface; char if_name[CONFIG_NET_INTERFACE_NAME_LEN + 1]; - struct k_fifo fifo; - int sock; + int event_socketpair[2]; struct k_work iface_work; struct k_work_q iface_wq; int (*iface_handler)(struct supplicant_context *ctx, struct net_if *iface); @@ -142,25 +139,39 @@ struct k_work_q *get_workq(void) return &get_default_context()->iface_wq; } -/* found in hostap/wpa_supplicant/ctrl_iface_zephyr.c */ -extern int send_data(struct k_fifo *fifo, int sock, const char *buf, size_t len, int flags); - int zephyr_wifi_send_event(const struct wpa_supplicant_event_msg *msg) { struct supplicant_context *ctx; + struct pollfd fds[1]; int ret; /* TODO: Fix this to get the correct container */ ctx = get_default_context(); - if (ctx->sock < 0) { + if (ctx->event_socketpair[1] < 0) { ret = -ENOENT; goto out; } - ret = send_data(&ctx->fifo, ctx->sock, - (const char *)msg, sizeof(*msg), 0); - if (ret != 0) { + fds[0].fd = ctx->event_socketpair[0]; + fds[0].events = POLLOUT; + fds[0].revents = 0; + + ret = zsock_poll(fds, 1, WRITE_TIMEOUT); + if (ret < 0) { + ret = -errno; + LOG_ERR("Cannot write event (%d)", ret); + goto out; + } + + ret = zsock_send(ctx->event_socketpair[1], msg, sizeof(*msg), 0); + if (ret < 0) { + ret = -errno; + LOG_WRN("Event send failed (%d)", ret); + goto out; + } + + if (ret != sizeof(*msg)) { ret = -EMSGSIZE; LOG_WRN("Event partial send (%d)", ret); goto out; @@ -551,105 +562,84 @@ static int setup_interface_monitoring(struct supplicant_context *ctx, struct net static void event_socket_handler(int sock, void *eloop_ctx, void *user_data) { struct supplicant_context *ctx = user_data; - struct wpa_supplicant_event_msg event_msg; - struct zephyr_msg *msg; - zvfs_eventfd_t value; + struct wpa_supplicant_event_msg msg; + int ret; ARG_UNUSED(eloop_ctx); + ARG_UNUSED(ctx); - do { - zvfs_eventfd_read(sock, &value); - - msg = k_fifo_get(&ctx->fifo, K_NO_WAIT); - if (msg == NULL) { - LOG_ERR("fifo(event): %s", "empty"); - return; - } - - if (msg->data == NULL) { - LOG_ERR("fifo(event): %s", "no data"); - goto out; - } - - if (msg->len != sizeof(event_msg)) { - LOG_ERR("Received incomplete message: got: %d, expected:%d", - msg->len, sizeof(event_msg)); - goto out; - } + ret = zsock_recv(sock, &msg, sizeof(msg), 0); + if (ret < 0) { + LOG_ERR("Failed to recv the message (%d)", -errno); + return; + } - memcpy(&event_msg, msg->data, sizeof(event_msg)); + if (ret != sizeof(msg)) { + LOG_ERR("Received incomplete message: got: %d, expected:%d", + ret, sizeof(msg)); + return; + } - LOG_DBG("Passing message %d to wpa_supplicant", event_msg.event); + LOG_DBG("Passing message %d to wpa_supplicant", msg.event); - if (event_msg.global) { - wpa_supplicant_event_global(event_msg.ctx, event_msg.event, - event_msg.data); + if (msg.global) { + wpa_supplicant_event_global(msg.ctx, msg.event, msg.data); #ifdef CONFIG_WIFI_NM_HOSTAPD_AP - } else if (event_msg.hostapd) { - hostapd_event(event_msg.ctx, event_msg.event, event_msg.data); + } else if (msg.hostapd) { + hostapd_event(msg.ctx, msg.event, msg.data); #endif - } else { - wpa_supplicant_event(event_msg.ctx, event_msg.event, event_msg.data); - } - - if (event_msg.data) { - union wpa_event_data *data = event_msg.data; - - /* Free up deep copied data */ - if (event_msg.event == EVENT_AUTH) { - os_free((char *)data->auth.ies); - } else if (event_msg.event == EVENT_RX_MGMT) { - os_free((char *)data->rx_mgmt.frame); - } else if (event_msg.event == EVENT_TX_STATUS) { - os_free((char *)data->tx_status.data); - } else if (event_msg.event == EVENT_ASSOC) { - os_free((char *)data->assoc_info.addr); - os_free((char *)data->assoc_info.req_ies); - os_free((char *)data->assoc_info.resp_ies); - os_free((char *)data->assoc_info.resp_frame); - } else if (event_msg.event == EVENT_ASSOC_REJECT) { - os_free((char *)data->assoc_reject.bssid); - os_free((char *)data->assoc_reject.resp_ies); - } else if (event_msg.event == EVENT_DEAUTH) { - os_free((char *)data->deauth_info.addr); - os_free((char *)data->deauth_info.ie); - } else if (event_msg.event == EVENT_DISASSOC) { - os_free((char *)data->disassoc_info.addr); - os_free((char *)data->disassoc_info.ie); - } else if (event_msg.event == EVENT_UNPROT_DEAUTH) { - os_free((char *)data->unprot_deauth.sa); - os_free((char *)data->unprot_deauth.da); - } else if (event_msg.event == EVENT_UNPROT_DISASSOC) { - os_free((char *)data->unprot_disassoc.sa); - os_free((char *)data->unprot_disassoc.da); - } - - os_free(event_msg.data); + } else { + wpa_supplicant_event(msg.ctx, msg.event, msg.data); + } + + if (msg.data) { + union wpa_event_data *data = msg.data; + + /* Free up deep copied data */ + if (msg.event == EVENT_AUTH) { + os_free((char *)data->auth.ies); + } else if (msg.event == EVENT_RX_MGMT) { + os_free((char *)data->rx_mgmt.frame); + } else if (msg.event == EVENT_TX_STATUS) { + os_free((char *)data->tx_status.data); + } else if (msg.event == EVENT_ASSOC) { + os_free((char *)data->assoc_info.addr); + os_free((char *)data->assoc_info.req_ies); + os_free((char *)data->assoc_info.resp_ies); + os_free((char *)data->assoc_info.resp_frame); + } else if (msg.event == EVENT_ASSOC_REJECT) { + os_free((char *)data->assoc_reject.bssid); + os_free((char *)data->assoc_reject.resp_ies); + } else if (msg.event == EVENT_DEAUTH) { + os_free((char *)data->deauth_info.addr); + os_free((char *)data->deauth_info.ie); + } else if (msg.event == EVENT_DISASSOC) { + os_free((char *)data->disassoc_info.addr); + os_free((char *)data->disassoc_info.ie); + } else if (msg.event == EVENT_UNPROT_DEAUTH) { + os_free((char *)data->unprot_deauth.sa); + os_free((char *)data->unprot_deauth.da); + } else if (msg.event == EVENT_UNPROT_DISASSOC) { + os_free((char *)data->unprot_disassoc.sa); + os_free((char *)data->unprot_disassoc.da); } -out: - os_free(msg->data); - os_free(msg); - - } while (!k_fifo_is_empty(&ctx->fifo)); + os_free(msg.data); + } } static int register_supplicant_event_socket(struct supplicant_context *ctx) { int ret; - ret = zvfs_eventfd(0, ZVFS_EFD_NONBLOCK); + ret = socketpair(AF_UNIX, SOCK_STREAM, 0, ctx->event_socketpair); if (ret < 0) { ret = -errno; LOG_ERR("Failed to initialize socket (%d)", ret); return ret; } - ctx->sock = ret; - - k_fifo_init(&ctx->fifo); - - eloop_register_read_sock(ctx->sock, event_socket_handler, NULL, ctx); + eloop_register_read_sock(ctx->event_socketpair[0], event_socket_handler, NULL, ctx); return 0; } @@ -717,7 +707,7 @@ static void handler(void) supplicant_generate_state_event(ctx->if_name, NET_EVENT_SUPPLICANT_CMD_NOT_READY, 0); - eloop_unregister_read_sock(ctx->sock); + eloop_unregister_read_sock(ctx->event_socketpair[0]); zephyr_global_wpa_ctrl_deinit(); @@ -726,7 +716,8 @@ static void handler(void) out: wpa_supplicant_deinit(ctx->supplicant); - close(ctx->sock); + zsock_close(ctx->event_socketpair[0]); + zsock_close(ctx->event_socketpair[1]); err: os_free(params.pid_file); diff --git a/subsys/net/lib/sockets/Kconfig b/subsys/net/lib/sockets/Kconfig index 791fc464d38e..6662582aed88 100644 --- a/subsys/net/lib/sockets/Kconfig +++ b/subsys/net/lib/sockets/Kconfig @@ -350,6 +350,7 @@ if NET_SOCKETPAIR config NET_SOCKETPAIR_BUFFER_SIZE int "Size of the intermediate buffer, in bytes" + default 1024 if WIFI_NM_WPA_SUPPLICANT default 64 range 1 4096 help @@ -371,6 +372,8 @@ if NET_SOCKETPAIR_STATIC config NET_SOCKETPAIR_MAX int "How many socketpairs to pre-allocate" + default 6 if WIFI_NM_HOSTAPD_AP + default 4 if WIFI_NM_WPA_SUPPLICANT default 1 endif # NET_SOCKETPAIR_STATIC @@ -379,6 +382,8 @@ if NET_SOCKETPAIR_HEAP config HEAP_MEM_POOL_ADD_SIZE_SOCKETPAIR int + default 9136 if WIFI_NM_HOSTAPD_AP + default 6852 if WIFI_NM_WPA_SUPPLICANT default 296 endif # NET_SOCKETPAIR_HEAP From 1186dfb55a33bc83f59b44b7cbb2667de211da5a Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:58 +0300 Subject: [PATCH 1357/2141] Revert "[nrf fromtree] modules: hostap: Fix getting error stations twt capability issue." This reverts commit c1a5f870cd59abf4b796f8bd8f48783de25484ea. Signed-off-by: Jukka Rissanen --- modules/hostap/src/hapd_events.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/modules/hostap/src/hapd_events.c b/modules/hostap/src/hapd_events.c index 2d297b71aff6..c71015f7f920 100644 --- a/modules/hostap/src/hapd_events.c +++ b/modules/hostap/src/hapd_events.c @@ -35,17 +35,10 @@ static enum wifi_link_mode hapd_get_sta_link_mode(struct hostapd_iface *iface, } } -#define HE_MACCAP_TWT_REQUESTER BIT(1) - -static bool hapd_get_sta_he_twt_capable(struct hostapd_iface *iface, struct sta_info *sta) +static bool hapd_is_twt_capable(struct hostapd_iface *iface, struct sta_info *sta) { #ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_11AX - if (sta->flags & WLAN_STA_HE) { - return (sta->he_capab->he_mac_capab_info[0] - & HE_MACCAP_TWT_REQUESTER ? true : false); - } else { - return false; - } + return hostapd_get_he_twt_responder(iface->bss[0], IEEE80211_MODE_AP); #else return false; #endif @@ -80,7 +73,7 @@ int hostapd_send_wifi_mgmt_ap_sta_event(struct hostapd_iface *ap_ctx, if (event == NET_EVENT_WIFI_CMD_AP_STA_CONNECTED) { sta_info.link_mode = hapd_get_sta_link_mode(ap_ctx, sta); - sta_info.twt_capable = hapd_get_sta_he_twt_capable(ap_ctx, sta); + sta_info.twt_capable = hapd_is_twt_capable(ap_ctx, sta); } return supplicant_send_wifi_mgmt_event(ifname, From 3a325abe66a1e3ee8d7dc043673a97581b3bc326 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:58 +0300 Subject: [PATCH 1358/2141] Revert "[nrf fromtree] net: wifi: shell: Enable Wi-Fi credentials support" This reverts commit bdc2044a028c6df716cdf015c5d08e1a9a32b907. Signed-off-by: Jukka Rissanen --- modules/hostap/Kconfig | 1 - snippets/wifi-credentials/README.rst | 29 ------------------- snippets/wifi-credentials/snippet.yml | 3 -- .../wifi-credentials/wifi-credentials.conf | 8 ----- 4 files changed, 41 deletions(-) delete mode 100644 snippets/wifi-credentials/README.rst delete mode 100644 snippets/wifi-credentials/snippet.yml delete mode 100644 snippets/wifi-credentials/wifi-credentials.conf diff --git a/modules/hostap/Kconfig b/modules/hostap/Kconfig index 1dfe35410177..95dd2531503e 100644 --- a/modules/hostap/Kconfig +++ b/modules/hostap/Kconfig @@ -25,7 +25,6 @@ if WIFI_NM_WPA_SUPPLICANT config HEAP_MEM_POOL_ADD_SIZE_HOSTAP def_int 66560 if WIFI_NM_HOSTAPD_AP - def_int 55000 if WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE && WIFI_CREDENTIALS def_int 48000 if WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE def_int 41808 if WIFI_NM_WPA_SUPPLICANT_AP # 30K is mandatory, but might need more for long duration use cases diff --git a/snippets/wifi-credentials/README.rst b/snippets/wifi-credentials/README.rst deleted file mode 100644 index 283bc3958585..000000000000 --- a/snippets/wifi-credentials/README.rst +++ /dev/null @@ -1,29 +0,0 @@ -.. _snippet-wifi-credentials: - -Wi-Fi Credentials Snippet (wifi-credential) -########################################### - -.. code-block:: console - - west build -S wifi-credentials [...] - -Can also be used along with the :ref:`snippet-wifi-enterprise` snippet. - -.. code-block:: console - - west build -S "wifi-enterprise,wifi-credentials" [...] - -Overview -******** - -This snippet enables Wi-Fi credentials support. - -Requirements -************ - -Hardware support for: - -- :kconfig:option:`CONFIG_WIFI` -- :kconfig:option:`CONFIG_WIFI_USE_NATIVE_NETWORKING` -- :kconfig:option:`CONFIG_WIFI_NM_WPA_SUPPLICANT` -- :kconfig:option:`CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE` diff --git a/snippets/wifi-credentials/snippet.yml b/snippets/wifi-credentials/snippet.yml deleted file mode 100644 index 6046c0865dc2..000000000000 --- a/snippets/wifi-credentials/snippet.yml +++ /dev/null @@ -1,3 +0,0 @@ -name: wifi-credentials -append: - EXTRA_CONF_FILE: wifi-credentials.conf diff --git a/snippets/wifi-credentials/wifi-credentials.conf b/snippets/wifi-credentials/wifi-credentials.conf deleted file mode 100644 index 4ac281698255..000000000000 --- a/snippets/wifi-credentials/wifi-credentials.conf +++ /dev/null @@ -1,8 +0,0 @@ -# For use with Wi-Fi Credentials -CONFIG_WIFI_CREDENTIALS=y -CONFIG_FLASH=y -CONFIG_FLASH_PAGE_LAYOUT=y -CONFIG_FLASH_MAP=y -CONFIG_NVS=y -CONFIG_SETTINGS=y -CONFIG_SETTINGS_NVS=y From 2f00f97f8cdce404a127ef71d0208deb1160de9d Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:58 +0300 Subject: [PATCH 1359/2141] Revert "[nrf fromtree] manifest: nrf_wifi: Pull fix for raw TX memory leak" This reverts commit b6af6cb6ac232d31d5431693633010c36b256809. Signed-off-by: Jukka Rissanen --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 9e29918fb21b..9807058ac13b 100644 --- a/west.yml +++ b/west.yml @@ -328,7 +328,7 @@ manifest: revision: 968d55ff22579080466bf2f482596dd6e35361c6 path: modules/bsim_hw_models/nrf_hw_models - name: nrf_wifi - revision: 5f59c2336c69f28ae83f93812a1d726f9fceabfe + revision: 52286f111b4765e0dd40f43124e7bb5c14758dff path: modules/lib/nrf_wifi - name: open-amp revision: f7f4d083c7909a39d86e217376c69b416ec4faf3 From 2ba85fe470911c70a8636dc5c0eb003722b83d63 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:59 +0300 Subject: [PATCH 1360/2141] Revert "[nrf fromlist] drivers: nrf_wifi: Remove station mode from monitor mode" This reverts commit 193b571ff33dfe73941617c4b40b0144476edeed. Signed-off-by: Jukka Rissanen --- drivers/wifi/nrf_wifi/inc/fmac_main.h | 4 +- drivers/wifi/nrf_wifi/inc/wifi_mgmt.h | 2 - drivers/wifi/nrf_wifi/src/fmac_main.c | 10 ++-- drivers/wifi/nrf_wifi/src/net_if.c | 66 +++++++++++++-------------- drivers/wifi/nrf_wifi/src/wifi_mgmt.c | 2 - 5 files changed, 38 insertions(+), 46 deletions(-) diff --git a/drivers/wifi/nrf_wifi/inc/fmac_main.h b/drivers/wifi/nrf_wifi/inc/fmac_main.h index 2f49ed8b055f..8c1d8a1851b5 100644 --- a/drivers/wifi/nrf_wifi/inc/fmac_main.h +++ b/drivers/wifi/nrf_wifi/inc/fmac_main.h @@ -62,9 +62,6 @@ struct nrf_wifi_vif_ctx_zep { #ifdef CONFIG_NET_STATISTICS_ETHERNET struct net_stats_eth eth_stats; #endif /* CONFIG_NET_STATISTICS_ETHERNET */ -#if defined(CONFIG_NRF70_STA_MODE) || defined(CONFIG_NRF70_RAW_DATA_RX) - bool authorized; -#endif #ifdef CONFIG_NRF70_STA_MODE unsigned int assoc_freq; enum nrf_wifi_fmac_if_carr_state if_carr_state; @@ -75,6 +72,7 @@ struct nrf_wifi_vif_ctx_zep { unsigned char twt_flow_in_progress_map; struct wifi_ps_config *ps_info; bool ps_config_info_evnt; + bool authorized; bool cookie_resp_received; #ifdef CONFIG_NRF70_DATA_TX struct k_work nrf_wifi_net_iface_work; diff --git a/drivers/wifi/nrf_wifi/inc/wifi_mgmt.h b/drivers/wifi/nrf_wifi/inc/wifi_mgmt.h index a4ae20302100..e2aa91caa483 100644 --- a/drivers/wifi/nrf_wifi/inc/wifi_mgmt.h +++ b/drivers/wifi/nrf_wifi/inc/wifi_mgmt.h @@ -22,7 +22,6 @@ #define WIFI_MGMT_DATA_CTRL_FILTER_SETTING 0xE #define WIFI_ALL_FILTER_SETTING 0xF -#ifdef CONFIG_NRF70_STA_MODE struct twt_interval_float { unsigned short mantissa; unsigned char exponent; @@ -55,7 +54,6 @@ int nrf_wifi_get_power_save_config(const struct device *dev, void nrf_wifi_event_proc_get_power_save_info(void *vif_ctx, struct nrf_wifi_umac_event_power_save_info *ps_info, unsigned int event_len); -#endif /* CONFIG_NRF70_STA_MODE */ #ifdef CONFIG_NRF70_SYSTEM_WITH_RAW_MODES int nrf_wifi_mode(const struct device *dev, diff --git a/drivers/wifi/nrf_wifi/src/fmac_main.c b/drivers/wifi/nrf_wifi/src/fmac_main.c index 92a58be9a099..72055fb02993 100644 --- a/drivers/wifi/nrf_wifi/src/fmac_main.c +++ b/drivers/wifi/nrf_wifi/src/fmac_main.c @@ -350,7 +350,7 @@ int nrf_wifi_reg_domain(const struct device *dev, struct wifi_reg_domain *reg_do goto out; } -#if defined(CONFIG_NRF70_SCAN_ONLY) || defined(CONFIG_NRF70_RAW_DATA_RX) +#ifdef CONFIG_NRF70_SCAN_ONLY if (reg_domain->oper == WIFI_MGMT_SET) { memcpy(reg_domain_info.alpha2, reg_domain->country_code, WIFI_COUNTRY_CODE_LEN); @@ -739,10 +739,10 @@ static int nrf_wifi_drv_main_zep(const struct device *dev) data_config.rate_protection_type = rate_protection_type; callbk_fns.if_carr_state_chg_callbk_fn = nrf_wifi_if_carr_state_chg; callbk_fns.rx_frm_callbk_fn = nrf_wifi_if_rx_frm; -#endif #if defined(CONFIG_NRF70_RAW_DATA_RX) || defined(CONFIG_NRF70_PROMISC_DATA_RX) callbk_fns.sniffer_callbk_fn = nrf_wifi_if_sniffer_rx_frm; #endif /* CONFIG_NRF70_RAW_DATA_RX || CONFIG_NRF70_PROMISC_DATA_RX */ +#endif rx_buf_pools[0].num_bufs = rx1_num_bufs; rx_buf_pools[1].num_bufs = rx2_num_bufs; rx_buf_pools[2].num_bufs = rx3_num_bufs; @@ -756,7 +756,6 @@ static int nrf_wifi_drv_main_zep(const struct device *dev) callbk_fns.scan_start_callbk_fn = nrf_wifi_event_proc_scan_start_zep; callbk_fns.scan_done_callbk_fn = nrf_wifi_event_proc_scan_done_zep; callbk_fns.reg_change_callbk_fn = reg_change_callbk_fn; - callbk_fns.event_get_reg = nrf_wifi_event_get_reg_zep; #ifdef CONFIG_NET_L2_WIFI_MGMT callbk_fns.disp_scan_res_callbk_fn = nrf_wifi_event_proc_disp_scan_res_zep; #endif /* CONFIG_NET_L2_WIFI_MGMT */ @@ -770,6 +769,7 @@ static int nrf_wifi_drv_main_zep(const struct device *dev) callbk_fns.twt_config_callbk_fn = nrf_wifi_event_proc_twt_setup_zep; callbk_fns.twt_teardown_callbk_fn = nrf_wifi_event_proc_twt_teardown_zep; callbk_fns.twt_sleep_callbk_fn = nrf_wifi_event_proc_twt_sleep_zep; + callbk_fns.event_get_reg = nrf_wifi_event_get_reg_zep; callbk_fns.event_get_ps_info = nrf_wifi_event_proc_get_power_save_info; callbk_fns.cookie_rsp_callbk_fn = nrf_wifi_event_proc_cookie_rsp; callbk_fns.process_rssi_from_rx = nrf_wifi_process_rssi_from_rx; @@ -858,12 +858,10 @@ static const struct wifi_mgmt_ops nrf_wifi_mgmt_ops = { .get_stats = nrf_wifi_stats_get, .reset_stats = nrf_wifi_stats_reset, #endif /* CONFIG_NET_STATISTICS_WIFI */ -#if defined(CONFIG_NRF70_STA_MODE) || defined(CONFIG_NRF70_RAW_DATA_RX) - .reg_domain = nrf_wifi_reg_domain, -#endif #ifdef CONFIG_NRF70_STA_MODE .set_power_save = nrf_wifi_set_power_save, .set_twt = nrf_wifi_set_twt, + .reg_domain = nrf_wifi_reg_domain, .get_power_save_config = nrf_wifi_get_power_save_config, .set_rts_threshold = nrf_wifi_set_rts_threshold, .get_rts_threshold = nrf_wifi_get_rts_threshold, diff --git a/drivers/wifi/nrf_wifi/src/net_if.c b/drivers/wifi/nrf_wifi/src/net_if.c index 4830d63c9d15..a49fdc164983 100644 --- a/drivers/wifi/nrf_wifi/src/net_if.c +++ b/drivers/wifi/nrf_wifi/src/net_if.c @@ -256,6 +256,39 @@ static void nrf_wifi_net_iface_work_handler(struct k_work *work) } } +#if defined(CONFIG_NRF70_RAW_DATA_RX) || defined(CONFIG_NRF70_PROMISC_DATA_RX) +void nrf_wifi_if_sniffer_rx_frm(void *os_vif_ctx, void *frm, + struct raw_rx_pkt_header *raw_rx_hdr, + bool pkt_free) +{ + struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = os_vif_ctx; + struct net_if *iface = vif_ctx_zep->zep_net_if_ctx; + struct net_pkt *pkt; + struct nrf_wifi_ctx_zep *rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; + struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx = rpu_ctx_zep->rpu_ctx; + struct nrf_wifi_sys_fmac_dev_ctx *sys_dev_ctx = NULL; + int ret; + + sys_dev_ctx = wifi_dev_priv(fmac_dev_ctx); + + pkt = net_raw_pkt_from_nbuf(iface, frm, sizeof(struct raw_rx_pkt_header), + raw_rx_hdr, + pkt_free); + if (!pkt) { + LOG_DBG("Failed to allocate net_pkt"); + return; + } + + net_capture_pkt(iface, pkt); + + ret = net_recv_data(iface, pkt); + if (ret < 0) { + LOG_DBG("RCV Packet dropped by NET stack: %d", ret); + net_pkt_unref(pkt); + } +} +#endif /* CONFIG_NRF70_RAW_DATA_RX || CONFIG_NRF70_PROMISC_DATA_RX */ + void nrf_wifi_if_rx_frm(void *os_vif_ctx, void *frm) { struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = os_vif_ctx; @@ -325,39 +358,6 @@ static bool is_eapol(struct net_pkt *pkt) } #endif /* CONFIG_NRF70_DATA_TX */ -#if defined(CONFIG_NRF70_RAW_DATA_RX) || defined(CONFIG_NRF70_PROMISC_DATA_RX) -void nrf_wifi_if_sniffer_rx_frm(void *os_vif_ctx, void *frm, - struct raw_rx_pkt_header *raw_rx_hdr, - bool pkt_free) -{ - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = os_vif_ctx; - struct net_if *iface = vif_ctx_zep->zep_net_if_ctx; - struct net_pkt *pkt; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx = rpu_ctx_zep->rpu_ctx; - struct nrf_wifi_sys_fmac_dev_ctx *sys_dev_ctx = NULL; - int ret; - - sys_dev_ctx = wifi_dev_priv(fmac_dev_ctx); - - pkt = net_raw_pkt_from_nbuf(iface, frm, sizeof(struct raw_rx_pkt_header), - raw_rx_hdr, - pkt_free); - if (!pkt) { - LOG_DBG("Failed to allocate net_pkt"); - return; - } - - net_capture_pkt(iface, pkt); - - ret = net_recv_data(iface, pkt); - if (ret < 0) { - LOG_DBG("RCV Packet dropped by NET stack: %d", ret); - net_pkt_unref(pkt); - } -} -#endif /* CONFIG_NRF70_RAW_DATA_RX || CONFIG_NRF70_PROMISC_DATA_RX */ - enum ethernet_hw_caps nrf_wifi_if_caps_get(const struct device *dev) { enum ethernet_hw_caps caps = (ETHERNET_LINK_10BASE | diff --git a/drivers/wifi/nrf_wifi/src/wifi_mgmt.c b/drivers/wifi/nrf_wifi/src/wifi_mgmt.c index a323faf21dd6..64003b8ff253 100644 --- a/drivers/wifi/nrf_wifi/src/wifi_mgmt.c +++ b/drivers/wifi/nrf_wifi/src/wifi_mgmt.c @@ -25,7 +25,6 @@ LOG_MODULE_DECLARE(wifi_nrf, CONFIG_WIFI_NRF70_LOG_LEVEL); extern struct nrf_wifi_drv_priv_zep rpu_drv_priv_zep; -#ifdef CONFIG_NRF70_STA_MODE int nrf_wifi_set_power_save(const struct device *dev, struct wifi_ps_params *params) { @@ -744,7 +743,6 @@ void nrf_wifi_event_proc_twt_sleep_zep(void *vif_ctx, out: k_mutex_unlock(&vif_ctx_zep->vif_lock); } -#endif /* CONFIG_NRF70_STA_MODE */ #ifdef CONFIG_NRF70_SYSTEM_WITH_RAW_MODES int nrf_wifi_mode(const struct device *dev, From 27a8b3d529b85f9d34c366ef4982a4106bfe6f00 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:59 +0300 Subject: [PATCH 1361/2141] Revert "[nrf fromtree] wifi: nrf_wifi: ignore interface if TX disabled" This reverts commit 4369dc944b2c59a0eeee61b98d53611aaf66f951. Signed-off-by: Jukka Rissanen --- drivers/wifi/nrf_wifi/src/net_if.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/wifi/nrf_wifi/src/net_if.c b/drivers/wifi/nrf_wifi/src/net_if.c index a49fdc164983..82945ff55c27 100644 --- a/drivers/wifi/nrf_wifi/src/net_if.c +++ b/drivers/wifi/nrf_wifi/src/net_if.c @@ -18,7 +18,6 @@ #include LOG_MODULE_DECLARE(wifi_nrf, CONFIG_WIFI_NRF70_LOG_LEVEL); -#include #include #include "net_private.h" @@ -703,11 +702,6 @@ void nrf_wifi_if_init_zep(struct net_if *iface) nrf_wifi_net_iface_work_handler); #endif /* CONFIG_NRF70_DATA_TX */ -#ifdef CONFIG_NRF70_SCAN_ONLY - /* In scan only mode this interface should be ignored by the connectivity manager */ - conn_mgr_ignore_iface(iface); -#endif /* CONFIG_NRF70_SCAN_ONLY */ - #ifdef CONFIG_NRF_WIFI_RPU_RECOVERY k_work_init(&vif_ctx_zep->nrf_wifi_rpu_recovery_work, nrf_wifi_rpu_recovery_work_handler); From f83d4671905c3516d04bfbc3c691794223b13f95 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:59 +0300 Subject: [PATCH 1362/2141] Revert "[nrf fromtree] drivers: nrf_wifi: Fix rpu recovery debug info" This reverts commit 453bc099f598fcd2bdd0ffe65096a81883f7214d. Signed-off-by: Jukka Rissanen --- drivers/wifi/nrf_wifi/inc/fmac_main.h | 2 -- drivers/wifi/nrf_wifi/src/net_if.c | 16 ---------------- drivers/wifi/nrf_wifi/src/wifi_util.c | 23 ++++++++--------------- 3 files changed, 8 insertions(+), 33 deletions(-) diff --git a/drivers/wifi/nrf_wifi/inc/fmac_main.h b/drivers/wifi/nrf_wifi/inc/fmac_main.h index 8c1d8a1851b5..23f96089eb63 100644 --- a/drivers/wifi/nrf_wifi/inc/fmac_main.h +++ b/drivers/wifi/nrf_wifi/inc/fmac_main.h @@ -118,8 +118,6 @@ struct nrf_wifi_ctx_zep { unsigned int rpu_recovery_retries; int rpu_recovery_success; int rpu_recovery_failure; - int wdt_irq_received; - int wdt_irq_ignored; #endif /* CONFIG_NRF_WIFI_RPU_RECOVERY */ }; diff --git a/drivers/wifi/nrf_wifi/src/net_if.c b/drivers/wifi/nrf_wifi/src/net_if.c index 82945ff55c27..f94dc5a1e214 100644 --- a/drivers/wifi/nrf_wifi/src/net_if.c +++ b/drivers/wifi/nrf_wifi/src/net_if.c @@ -72,8 +72,6 @@ static void nrf_wifi_rpu_recovery_work_handler(struct k_work *work) struct nrf_wifi_vif_ctx_zep, nrf_wifi_rpu_recovery_work); struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx = NULL; - struct nrf_wifi_hal_dev_ctx *hal_dev_ctx = NULL; int ret; if (!vif_ctx_zep) { @@ -92,18 +90,6 @@ static void nrf_wifi_rpu_recovery_work_handler(struct k_work *work) return; } - fmac_dev_ctx = rpu_ctx_zep->rpu_ctx; - if (!fmac_dev_ctx) { - LOG_ERR("%s: fmac_dev_ctx is NULL", __func__); - return; - } - - hal_dev_ctx = fmac_dev_ctx->hal_dev_ctx; - if (!hal_dev_ctx) { - LOG_ERR("%s: hal_dev_ctx is NULL", __func__); - return; - } - if (rpu_ctx_zep->rpu_recovery_in_progress) { #ifdef CONFIG_NRF_WIFI_RPU_RECOVERY_DEBUG LOG_ERR("%s: RPU recovery already in progress", __func__); @@ -148,8 +134,6 @@ static void nrf_wifi_rpu_recovery_work_handler(struct k_work *work) } #endif rpu_ctx_zep->rpu_recovery_in_progress = true; - rpu_ctx_zep->wdt_irq_received += hal_dev_ctx->wdt_irq_received; - rpu_ctx_zep->wdt_irq_ignored += hal_dev_ctx->wdt_irq_ignored; #ifdef CONFIG_NRF_WIFI_RPU_RECOVERY_DEBUG LOG_ERR("%s: Bringing the interface down", __func__); #else diff --git a/drivers/wifi/nrf_wifi/src/wifi_util.c b/drivers/wifi/nrf_wifi/src/wifi_util.c index 57bda1f4ff4f..4a31cae8121a 100644 --- a/drivers/wifi/nrf_wifi/src/wifi_util.c +++ b/drivers/wifi/nrf_wifi/src/wifi_util.c @@ -938,20 +938,10 @@ static int nrf_wifi_util_rpu_recovery_info(const struct shell *sh, } fmac_dev_ctx = ctx->rpu_ctx; - if (!fmac_dev_ctx) { - shell_fprintf(sh, SHELL_ERROR, "FMAC context not initialized\n"); - ret = -ENOEXEC; - goto unlock; - } - hal_dev_ctx = fmac_dev_ctx->hal_dev_ctx; - if (!hal_dev_ctx) { - shell_fprintf(sh, SHELL_ERROR, "HAL context not initialized\n"); - ret = -ENOEXEC; - goto unlock; - } - shell_fprintf(sh, SHELL_INFO, + shell_fprintf(sh, + SHELL_INFO, "wdt_irq_received: %d\n" "wdt_irq_ignored: %d\n" "last_wakeup_now_asserted_time_ms: %lu milliseconds\n" @@ -960,11 +950,14 @@ static int nrf_wifi_util_rpu_recovery_info(const struct shell *sh, "current time: %lu milliseconds\n" "rpu_recovery_success: %d\n" "rpu_recovery_failure: %d\n\n", - ctx->wdt_irq_received, ctx->wdt_irq_ignored, + hal_dev_ctx->wdt_irq_received, + hal_dev_ctx->wdt_irq_ignored, hal_dev_ctx->last_wakeup_now_asserted_time_ms, hal_dev_ctx->last_wakeup_now_deasserted_time_ms, - hal_dev_ctx->last_rpu_sleep_opp_time_ms, current_time_ms, - ctx->rpu_recovery_success, ctx->rpu_recovery_failure); + hal_dev_ctx->last_rpu_sleep_opp_time_ms, + current_time_ms, + ctx->rpu_recovery_success, + ctx->rpu_recovery_failure); ret = 0; unlock: From 4cd45d0c996ba5220aae53c740dea26c9d528a54 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:59 +0300 Subject: [PATCH 1363/2141] Revert "[nrf fromtree] drivers: nrf_wifi: Fix return codes for xmit" This reverts commit 420a5b5c0eed0a9daf45459b0d89ebe5d15abf57. Signed-off-by: Jukka Rissanen --- drivers/wifi/nrf_wifi/src/net_if.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/wifi/nrf_wifi/src/net_if.c b/drivers/wifi/nrf_wifi/src/net_if.c index f94dc5a1e214..9108a0dab3b2 100644 --- a/drivers/wifi/nrf_wifi/src/net_if.c +++ b/drivers/wifi/nrf_wifi/src/net_if.c @@ -363,7 +363,7 @@ enum ethernet_hw_caps nrf_wifi_if_caps_get(const struct device *dev) int nrf_wifi_if_send(const struct device *dev, struct net_pkt *pkt) { - int ret = -EINVAL; + int ret = -1; #ifdef CONFIG_NRF70_DATA_TX struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; @@ -404,7 +404,6 @@ int nrf_wifi_if_send(const struct device *dev, if (nbuf == NULL) { LOG_ERR("%s: allocation failed", __func__); - ret = -ENOMEM; goto drop; } @@ -421,7 +420,6 @@ int nrf_wifi_if_send(const struct device *dev, #endif /* CONFIG_NRF70_RAW_DATA_TX */ if ((vif_ctx_zep->if_carr_state != NRF_WIFI_FMAC_IF_CARR_STATE_ON) || (!vif_ctx_zep->authorized && !is_eapol(pkt))) { - ret = -EPERM; goto drop; } @@ -434,8 +432,6 @@ int nrf_wifi_if_send(const struct device *dev, if (ret == NRF_WIFI_STATUS_FAIL) { /* FMAC API takes care of freeing the nbuf */ host_stats->total_tx_drop_pkts++; - /* Could be many reasons, but likely no space in the queue */ - ret = -ENOBUFS; } goto unlock; drop: From 649825430aa8c074208e0760568b94bb1d867681 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:59 +0300 Subject: [PATCH 1364/2141] Revert "[nrf fromtree] drivers: wifi: nrf_wifi: wifi_mgmt: remove redundant null check" This reverts commit 2e97bb1307104ce40f56aefac27eacd17a6105ce. Signed-off-by: Jukka Rissanen --- drivers/wifi/nrf_wifi/src/wifi_mgmt.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/wifi/nrf_wifi/src/wifi_mgmt.c b/drivers/wifi/nrf_wifi/src/wifi_mgmt.c index 64003b8ff253..875ce786b570 100644 --- a/drivers/wifi/nrf_wifi/src/wifi_mgmt.c +++ b/drivers/wifi/nrf_wifi/src/wifi_mgmt.c @@ -202,6 +202,11 @@ int nrf_wifi_get_power_save_config(const struct device *dev, fmac_dev_ctx = rpu_ctx_zep->rpu_ctx; + if (!rpu_ctx_zep) { + LOG_ERR("%s: rpu_ctx_zep is NULL", __func__); + goto out; + } + vif_ctx_zep->ps_info = ps_config; vif_ctx_zep->ps_config_info_evnt = false; From 3f72063258708d4bffbc640ca32cb89d072e84fb Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:59 +0300 Subject: [PATCH 1365/2141] Revert "[nrf fromtree] drivers: nrf_wifi: Fix TX drop statistics" This reverts commit 1aa5abe53df33898e935d99ce5b905a07144aacf. Signed-off-by: Jukka Rissanen --- drivers/wifi/nrf_wifi/src/net_if.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/wifi/nrf_wifi/src/net_if.c b/drivers/wifi/nrf_wifi/src/net_if.c index 9108a0dab3b2..19101fab442e 100644 --- a/drivers/wifi/nrf_wifi/src/net_if.c +++ b/drivers/wifi/nrf_wifi/src/net_if.c @@ -429,10 +429,6 @@ int nrf_wifi_if_send(const struct device *dev, #ifdef CONFIG_NRF70_RAW_DATA_TX } #endif /* CONFIG_NRF70_RAW_DATA_TX */ - if (ret == NRF_WIFI_STATUS_FAIL) { - /* FMAC API takes care of freeing the nbuf */ - host_stats->total_tx_drop_pkts++; - } goto unlock; drop: if (host_stats != NULL) { From a75cb8e6b4da98849cccad5a069a771c00a057bd Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:59 +0300 Subject: [PATCH 1366/2141] Revert "[nrf fromtree] wifi: nrf70: Fix system work queue stack size override" This reverts commit c237966b7fbacfaaa7e584492b0e720c5cb19ef0. Signed-off-by: Jukka Rissanen --- drivers/wifi/nrf_wifi/Kconfig.nrfwifi | 6 ++++-- kernel/Kconfig | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/wifi/nrf_wifi/Kconfig.nrfwifi b/drivers/wifi/nrf_wifi/Kconfig.nrfwifi index 8d414276038e..bfc1ce0c7f08 100644 --- a/drivers/wifi/nrf_wifi/Kconfig.nrfwifi +++ b/drivers/wifi/nrf_wifi/Kconfig.nrfwifi @@ -599,8 +599,10 @@ endif if NETWORKING # Finetune defaults for certain system components used by the driver -# Note: These will take effect only if the symbol is not defined already -# (i.e., the original symbol is processed after "drivers/Kconfig") + +config SYSTEM_WORKQUEUE_STACK_SIZE + default 4096 + config NET_TX_STACK_SIZE default 4096 diff --git a/kernel/Kconfig b/kernel/Kconfig index 838d44afbf9e..536a6624f522 100644 --- a/kernel/Kconfig +++ b/kernel/Kconfig @@ -577,7 +577,7 @@ rsource "Kconfig.obj_core" menu "System Work Queue Options" config SYSTEM_WORKQUEUE_STACK_SIZE int "System workqueue stack size" - default 4096 if COVERAGE_GCOV || WIFI_NRF70 + default 4096 if COVERAGE_GCOV default 2560 if WIFI_NM_WPA_SUPPLICANT default 1024 From 562f0528aff74c1768e333b713a18fed70972d6f Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:59 +0300 Subject: [PATCH 1367/2141] Revert "[nrf fromtree] modules: nrf_wifi: Fix accuracy of microseconds API" This reverts commit b14fd1f61249852f0d2c8e2b07dc2126bad24e76. Signed-off-by: Jukka Rissanen --- modules/nrf_wifi/os/shim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/nrf_wifi/os/shim.c b/modules/nrf_wifi/os/shim.c index df460d5ab53e..14107f139288 100644 --- a/modules/nrf_wifi/os/shim.c +++ b/modules/nrf_wifi/os/shim.c @@ -854,7 +854,7 @@ static void zep_shim_work_kill(void *item) static unsigned long zep_shim_time_get_curr_us(void) { - return k_ticks_to_us_floor64(k_uptime_ticks()); + return k_uptime_get() * USEC_PER_MSEC; } static unsigned int zep_shim_time_elapsed_us(unsigned long start_time_us) From 4feb59b783c4737c64639a19b5992b093d5b0401 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:59 +0300 Subject: [PATCH 1368/2141] Revert "[nrf fromtree] modules: nrf_wifi: Fix interface down hang" This reverts commit d6054d8c397d181d900c59373e0e261ad8eca41a. Signed-off-by: Jukka Rissanen --- modules/nrf_wifi/bus/qspi_if.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/modules/nrf_wifi/bus/qspi_if.c b/modules/nrf_wifi/bus/qspi_if.c index 949aa591274a..ad0534a95a37 100644 --- a/modules/nrf_wifi/bus/qspi_if.c +++ b/modules/nrf_wifi/bus/qspi_if.c @@ -1196,9 +1196,7 @@ struct device qspi_perip = { int qspi_deinit(void) { - if (nrfx_qspi_init_check()) { - _qspi_device_uninit(&qspi_perip); - } + _qspi_device_uninit(&qspi_perip); return 0; } From ee700abb8de1b5f2c277324801d20d1a8d36f495 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:59 +0300 Subject: [PATCH 1369/2141] Revert "[nrf fromtree] drivers: wifi: Introduce option to use K_HEAP" This reverts commit b0e4801ac20650a9c73b8ec11bf4ae097b4449b1. Signed-off-by: Jukka Rissanen --- drivers/wifi/nrf_wifi/Kconfig.nrfwifi | 16 ---------------- modules/nrf_wifi/os/shim.c | 24 ------------------------ 2 files changed, 40 deletions(-) diff --git a/drivers/wifi/nrf_wifi/Kconfig.nrfwifi b/drivers/wifi/nrf_wifi/Kconfig.nrfwifi index bfc1ce0c7f08..8980cce82052 100644 --- a/drivers/wifi/nrf_wifi/Kconfig.nrfwifi +++ b/drivers/wifi/nrf_wifi/Kconfig.nrfwifi @@ -570,21 +570,6 @@ config NRF70_RSSI_STALE_TIMEOUT_MS value as the driver does not store it and requires RPU to provide the information. -config NRF_WIFI_GLOBAL_HEAP - bool "Use Zephyr kernel heap for Wi-Fi driver" - depends on KERNEL_MEM_POOL && ((HEAP_MEM_POOL_SIZE > 0) || HEAP_MEM_POOL_IGNORE_MIN) - help - Enable this option to use K_HEAP for memory allocations in Wi-Fi driver. - -if NRF_WIFI_GLOBAL_HEAP -config HEAP_MEM_POOL_ADD_SIZE_NRF70 - # Use a maximum that works for typical use cases and boards, each sample/app can override - # this value if needed by using CONFIG_HEAP_MEM_POOL_IGNORE_MIN - def_int 25000 if NRF70_SCAN_ONLY - def_int 150000 -endif # NRF_WIFI_GLOBAL_HEAP - -if !NRF_WIFI_GLOBAL_HEAP config NRF_WIFI_CTRL_HEAP_SIZE int "Dedicated memory pool for control plane" default 20000 @@ -595,7 +580,6 @@ config NRF_WIFI_DATA_HEAP_SIZE default 8000 if NRF70_SCAN_ONLY default 110000 if !SOC_FAMILY_NORDIC_NRF default 130000 -endif if NETWORKING # Finetune defaults for certain system components used by the driver diff --git a/modules/nrf_wifi/os/shim.c b/modules/nrf_wifi/os/shim.c index 14107f139288..29b72203b552 100644 --- a/modules/nrf_wifi/os/shim.c +++ b/modules/nrf_wifi/os/shim.c @@ -33,8 +33,6 @@ #include "common/hal_structs_common.h" LOG_MODULE_REGISTER(wifi_nrf, CONFIG_WIFI_NRF70_LOG_LEVEL); - -#if !defined(CONFIG_NRF_WIFI_GLOBAL_HEAP) #if defined(CONFIG_NOCACHE_MEMORY) K_HEAP_DEFINE_NOCACHE(wifi_drv_ctrl_mem_pool, CONFIG_NRF_WIFI_CTRL_HEAP_SIZE); K_HEAP_DEFINE_NOCACHE(wifi_drv_data_mem_pool, CONFIG_NRF_WIFI_DATA_HEAP_SIZE); @@ -42,8 +40,6 @@ K_HEAP_DEFINE_NOCACHE(wifi_drv_data_mem_pool, CONFIG_NRF_WIFI_DATA_HEAP_SIZE); K_HEAP_DEFINE(wifi_drv_ctrl_mem_pool, CONFIG_NRF_WIFI_CTRL_HEAP_SIZE); K_HEAP_DEFINE(wifi_drv_data_mem_pool, CONFIG_NRF_WIFI_DATA_HEAP_SIZE); #endif /* CONFIG_NOCACHE_MEMORY */ -#endif /* CONFIG_NRF_WIFI_GLOBAL_HEAP */ - #define WORD_SIZE 4 struct zep_shim_intr_priv *intr_priv; @@ -52,22 +48,14 @@ static void *zep_shim_mem_alloc(size_t size) { size_t size_aligned = ROUND_UP(size, 4); -#if defined(CONFIG_NRF_WIFI_GLOBAL_HEAP) - return k_malloc(size_aligned); -#else /* CONFIG_NRF_WIFI_GLOBAL_HEAP */ return k_heap_aligned_alloc(&wifi_drv_ctrl_mem_pool, WORD_SIZE, size_aligned, K_FOREVER); -#endif /* CONFIG_NRF_WIFI_GLOBAL_HEAP */ } static void *zep_shim_data_mem_alloc(size_t size) { size_t size_aligned = ROUND_UP(size, 4); -#if defined(CONFIG_NRF_WIFI_GLOBAL_HEAP) - return k_malloc(size_aligned); -#else /* CONFIG_NRF_WIFI_GLOBAL_HEAP */ return k_heap_aligned_alloc(&wifi_drv_data_mem_pool, WORD_SIZE, size_aligned, K_FOREVER); -#endif /* CONFIG_NRF_WIFI_GLOBAL_HEAP */ } static void *zep_shim_mem_zalloc(size_t size) @@ -111,22 +99,14 @@ static void *zep_shim_data_mem_zalloc(size_t size) static void zep_shim_mem_free(void *buf) { if (buf) { -#if defined(CONFIG_NRF_WIFI_GLOBAL_HEAP) - k_free(buf); -#else /* CONFIG_NRF_WIFI_GLOBAL_HEAP */ k_heap_free(&wifi_drv_ctrl_mem_pool, buf); -#endif /* CONFIG_NRF_WIFI_GLOBAL_HEAP */ } } static void zep_shim_data_mem_free(void *buf) { if (buf) { -#if defined(CONFIG_NRF_WIFI_GLOBAL_HEAP) - k_free(buf); -#else /* CONFIG_NRF_WIFI_GLOBAL_HEAP */ k_heap_free(&wifi_drv_data_mem_pool, buf); -#endif /* CONFIG_NRF_WIFI_GLOBAL_HEAP */ } } @@ -217,11 +197,7 @@ static void *zep_shim_spinlock_alloc(void) static void zep_shim_spinlock_free(void *lock) { -#if defined(CONFIG_NRF_WIFI_GLOBAL_HEAP) - k_free(lock); -#else /* CONFIG_NRF_WIFI_GLOBAL_HEAP */ k_heap_free(&wifi_drv_ctrl_mem_pool, lock); -#endif /* CONFIG_NRF_WIFI_GLOBAL_HEAP */ } static void zep_shim_spinlock_init(void *lock) From 60e6d98751895a52faab027764ecd54e611ae532 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:59 +0300 Subject: [PATCH 1370/2141] Revert "[nrf fromtree] modules: nrf_wifi: Implement SPI deinit" This reverts commit c9c0f975aa75d7756b3b9d6ebffa8ac9107e0521. Signed-off-by: Jukka Rissanen --- modules/nrf_wifi/bus/spi_if.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/nrf_wifi/bus/spi_if.c b/modules/nrf_wifi/bus/spi_if.c index 641e1322899f..7ef1694da58b 100644 --- a/modules/nrf_wifi/bus/spi_if.c +++ b/modules/nrf_wifi/bus/spi_if.c @@ -263,7 +263,9 @@ int spim_init(struct qspi_config *config) int spim_deinit(void) { - return spi_release_dt(&spi_spec); + LOG_DBG("TODO : %s", __func__); + + return 0; } static void spim_addr_check(unsigned int addr, const void *data, unsigned int len) From 70826dfde8714f1b7805b821b0a166e4471be1df Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:59 +0300 Subject: [PATCH 1371/2141] Revert "[nrf fromtree] modules: nrf_wifi: Implement QSPI deinit" This reverts commit 80ca34db0140ea6a6d251ee5b84f043792c20851. Signed-off-by: Jukka Rissanen --- modules/nrf_wifi/bus/qspi_if.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/modules/nrf_wifi/bus/qspi_if.c b/modules/nrf_wifi/bus/qspi_if.c index ad0534a95a37..6107a5c4157f 100644 --- a/modules/nrf_wifi/bus/qspi_if.c +++ b/modules/nrf_wifi/bus/qspi_if.c @@ -528,10 +528,14 @@ static int qspi_device_init(const struct device *dev) return ret; } -static void _qspi_device_uninit(const struct device *dev) +static void qspi_device_uninit(const struct device *dev) { bool last = true; + if (!IS_ENABLED(CONFIG_NRF70_QSPI_LOW_POWER)) { + return; + } + qspi_lock(dev); #ifdef CONFIG_MULTITHREADING @@ -564,15 +568,6 @@ static void _qspi_device_uninit(const struct device *dev) qspi_unlock(dev); } -static void qspi_device_uninit(const struct device *dev) -{ - if (!IS_ENABLED(CONFIG_NRF70_QSPI_LOW_POWER)) { - return; - } - - _qspi_device_uninit(dev); -} - /* QSPI send custom command. * * If this is used for both send and receive the buffer sizes must be @@ -1196,7 +1191,7 @@ struct device qspi_perip = { int qspi_deinit(void) { - _qspi_device_uninit(&qspi_perip); + LOG_DBG("TODO : %s", __func__); return 0; } From edb09f9cf472364b6c67f6ef46d84377ac6feadd Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:59 +0300 Subject: [PATCH 1372/2141] Revert "[nrf fromtree] modules: nrf_wifi: Remove co-ex GPIOs first" This reverts commit 06422b585b9a49a79b012ed04a5c5f43b6ff6024. Signed-off-by: Jukka Rissanen --- modules/nrf_wifi/bus/rpu_hw_if.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/modules/nrf_wifi/bus/rpu_hw_if.c b/modules/nrf_wifi/bus/rpu_hw_if.c index 39525211486b..62291251fb78 100644 --- a/modules/nrf_wifi/bus/rpu_hw_if.c +++ b/modules/nrf_wifi/bus/rpu_hw_if.c @@ -503,13 +503,6 @@ int rpu_disable(void) { int ret; - #ifdef CONFIG_NRF70_SR_COEX_RF_SWITCH - ret = sr_gpio_remove(); - if (ret) { - goto out; - } -#endif - ret = rpu_pwroff(); if (ret) { goto out; @@ -519,7 +512,12 @@ int rpu_disable(void) goto out; } - +#ifdef CONFIG_NRF70_SR_COEX_RF_SWITCH + ret = sr_gpio_remove(); + if (ret) { + goto out; + } +#endif qdev = NULL; cfg = NULL; From f67ff6940bbdf763b8dba7e0f24d16215461d2c6 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:59 +0300 Subject: [PATCH 1373/2141] Revert "[nrf fromtree] modules: nrf_wifi: Improve power down sequence" This reverts commit fd5e07f6c0f095b358d6f07bf80c035eb91c8297. Signed-off-by: Jukka Rissanen --- modules/nrf_wifi/bus/rpu_hw_if.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/nrf_wifi/bus/rpu_hw_if.c b/modules/nrf_wifi/bus/rpu_hw_if.c index 62291251fb78..5dd71a86de2b 100644 --- a/modules/nrf_wifi/bus/rpu_hw_if.c +++ b/modules/nrf_wifi/bus/rpu_hw_if.c @@ -260,15 +260,15 @@ static int rpu_pwroff(void) { int ret; - ret = gpio_pin_set_dt(&iovdd_ctrl_spec, 0); /* IOVDD CNTRL = 0 */ + ret = gpio_pin_set_dt(&bucken_spec, 0); /* BUCKEN = 0 */ if (ret) { - LOG_ERR("IOVDD GPIO set failed..."); + LOG_ERR("BUCKEN GPIO set failed..."); return ret; } - ret = gpio_pin_set_dt(&bucken_spec, 0); /* BUCKEN = 0 */ + ret = gpio_pin_set_dt(&iovdd_ctrl_spec, 0); /* IOVDD CNTRL = 0 */ if (ret) { - LOG_ERR("BUCKEN GPIO set failed..."); + LOG_ERR("IOVDD GPIO set failed..."); return ret; } From 93b3443ea6cb6185ac90e81dbbbba85ade0933be Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:59 +0300 Subject: [PATCH 1374/2141] Revert "[nrf fromtree] drivers: nrf_wifi: put driver ops in flash" This reverts commit ebd81dcf098e1183990fe999e32135d932ef3886. Signed-off-by: Jukka Rissanen --- drivers/wifi/nrf_wifi/src/fmac_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/wifi/nrf_wifi/src/fmac_main.c b/drivers/wifi/nrf_wifi/src/fmac_main.c index 72055fb02993..b218bc13adde 100644 --- a/drivers/wifi/nrf_wifi/src/fmac_main.c +++ b/drivers/wifi/nrf_wifi/src/fmac_main.c @@ -852,7 +852,7 @@ static int nrf_wifi_drv_main_zep(const struct device *dev) #ifndef CONFIG_NRF70_RADIO_TEST #ifdef CONFIG_NET_L2_WIFI_MGMT -static const struct wifi_mgmt_ops nrf_wifi_mgmt_ops = { +static struct wifi_mgmt_ops nrf_wifi_mgmt_ops = { .scan = nrf_wifi_disp_scan_zep, #ifdef CONFIG_NET_STATISTICS_WIFI .get_stats = nrf_wifi_stats_get, @@ -881,7 +881,7 @@ static const struct wifi_mgmt_ops nrf_wifi_mgmt_ops = { #ifdef CONFIG_NRF70_STA_MODE -static const struct zep_wpa_supp_dev_ops wpa_supp_ops = { +static struct zep_wpa_supp_dev_ops wpa_supp_ops = { .init = nrf_wifi_wpa_supp_dev_init, .deinit = nrf_wifi_wpa_supp_dev_deinit, .scan2 = nrf_wifi_wpa_supp_scan2, From ff6e60750050bb048ad4953d3277406a4fb20db0 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:51:59 +0300 Subject: [PATCH 1375/2141] Revert "[nrf fromlist] snippets: wifi-enterprise: Store certificates in Protected storage" This reverts commit e505b90960f1a45ba0c5579b75f24ae7afadf7c3. Signed-off-by: Jukka Rissanen --- snippets/wifi-enterprise/snippet.yml | 3 --- snippets/wifi-enterprise/wifi-enterprise-nrf-ns.conf | 8 -------- 2 files changed, 11 deletions(-) delete mode 100644 snippets/wifi-enterprise/wifi-enterprise-nrf-ns.conf diff --git a/snippets/wifi-enterprise/snippet.yml b/snippets/wifi-enterprise/snippet.yml index ae2fbd2953b5..f88b23ec2a4d 100644 --- a/snippets/wifi-enterprise/snippet.yml +++ b/snippets/wifi-enterprise/snippet.yml @@ -6,6 +6,3 @@ boards: /.*/nrf.*/cpuapp/: append: EXTRA_CONF_FILE: wifi-enterprise-nrf.conf - /.*/nrf.*/cpuapp/ns/: - append: - EXTRA_CONF_FILE: wifi-enterprise-nrf-ns.conf diff --git a/snippets/wifi-enterprise/wifi-enterprise-nrf-ns.conf b/snippets/wifi-enterprise/wifi-enterprise-nrf-ns.conf deleted file mode 100644 index dd33192d180d..000000000000 --- a/snippets/wifi-enterprise/wifi-enterprise-nrf-ns.conf +++ /dev/null @@ -1,8 +0,0 @@ -# For TLS and X.509 processing MbedTLS needs large heap size and using separate heap -# for MbedTLS gives us more control over the heap size. -CONFIG_MBEDTLS_HEAP_SIZE=75000 -CONFIG_LTO=y -CONFIG_ISR_TABLES_LOCAL_DECLARATION=y -CONFIG_WIFI_CREDENTIALS_RUNTIME_CERTIFICATES=y -CONFIG_WIFI_SHELL_RUNTIME_CERTIFICATES=y -CONFIG_TLS_CREDENTIALS_BACKEND_PROTECTED_STORAGE=y From a32979eec18ba469315ae92d231a45cf01228a73 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:00 +0300 Subject: [PATCH 1376/2141] Revert "[nrf fromlist] samples: net: wifi: Add AES-only certificates" This reverts commit 3aaa9ad1615befbde020a5545c33e12788d4cf53. Signed-off-by: Jukka Rissanen --- .../net/wifi/test_certs/rsa2k_no_des/ca.pem | 24 --------------- .../net/wifi/test_certs/rsa2k_no_des/ca2.pem | 24 --------------- .../test_certs/rsa2k_no_des/client-key.pem | 30 ------------------- .../test_certs/rsa2k_no_des/client-key2.pem | 30 ------------------- .../wifi/test_certs/rsa2k_no_des/client.pem | 22 -------------- .../wifi/test_certs/rsa2k_no_des/client2.pem | 22 -------------- .../test_certs/rsa2k_no_des/server-key.pem | 30 ------------------- .../wifi/test_certs/rsa2k_no_des/server.pem | 22 -------------- 8 files changed, 204 deletions(-) delete mode 100644 samples/net/wifi/test_certs/rsa2k_no_des/ca.pem delete mode 100644 samples/net/wifi/test_certs/rsa2k_no_des/ca2.pem delete mode 100644 samples/net/wifi/test_certs/rsa2k_no_des/client-key.pem delete mode 100644 samples/net/wifi/test_certs/rsa2k_no_des/client-key2.pem delete mode 100644 samples/net/wifi/test_certs/rsa2k_no_des/client.pem delete mode 100644 samples/net/wifi/test_certs/rsa2k_no_des/client2.pem delete mode 100644 samples/net/wifi/test_certs/rsa2k_no_des/server-key.pem delete mode 100644 samples/net/wifi/test_certs/rsa2k_no_des/server.pem diff --git a/samples/net/wifi/test_certs/rsa2k_no_des/ca.pem b/samples/net/wifi/test_certs/rsa2k_no_des/ca.pem deleted file mode 100644 index 2b872d2e30da..000000000000 --- a/samples/net/wifi/test_certs/rsa2k_no_des/ca.pem +++ /dev/null @@ -1,24 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIEBzCCAu+gAwIBAgIUK8+d+8IOzeX+DP3VSvdF3lHiCdcwDQYJKoZIhvcNAQEL -BQAwgZIxCzAJBgNVBAYTAkZSMQ8wDQYDVQQIDAZSYWRpdXMxEjAQBgNVBAcMCVNv -bWV3aGVyZTEUMBIGA1UECgwLRXhhbXBsZSBJbmMxJjAkBgNVBAMMHUV4YW1wbGUg -Q2VydGlmaWNhdGUgQXV0aG9yaXR5MSAwHgYJKoZIhvcNAQkBFhFhZG1pbkBleGFt -cGxlLm9yZzAeFw0yNDEwMDgxMDI0MDZaFw0zNDEwMDYxMDI0MDZaMIGSMQswCQYD -VQQGEwJGUjEPMA0GA1UECAwGUmFkaXVzMRIwEAYDVQQHDAlTb21ld2hlcmUxFDAS -BgNVBAoMC0V4YW1wbGUgSW5jMSYwJAYDVQQDDB1FeGFtcGxlIENlcnRpZmljYXRl -IEF1dGhvcml0eTEgMB4GCSqGSIb3DQEJARYRYWRtaW5AZXhhbXBsZS5vcmcwggEi -MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCWKIwjdRIp9IrpZELN/ZsN13Xj -qQI6n086PNJ7BZfLi0+tD164rmxFk2eukNNksFCPhvMkqUxouGhc4mJjeivvrZxR -oT3cblOQIkkdEci6iTKC2E1a20W/Ur7cTXoIsnKwjiUjXk+cujkrZu4fcHX+O4vy -wTd5tEbhmifT/4u5nN8U2vBcEZqkGHOCp30VZSxtlGwqp4lc+tVziF3uFViW9MXk -3bVt+s1E7ztwG7+WBgVlLYe3CNSWkMxfyYBafH/l7iep6AFjoTn1z3AAjYi7IUNN -0JkW8MTgafRQIu4QsV5luq/Tiar2vwAm/GNgUJdSzUKARsfQzb/XTIgnLQqtAgMB -AAGjUzBRMB0GA1UdDgQWBBSijSC03/Thi6EOdM91V33zsbQpgzAfBgNVHSMEGDAW -gBSijSC03/Thi6EOdM91V33zsbQpgzAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3 -DQEBCwUAA4IBAQAvKEfmCDoMTKC6bfP6DSs+MSAGc5tCr6w6cz2AKNJ2fOMhkq55 -JF47oBBGm9SdTB6Jqo6c109Ps69/+LMtEEGwvzL0RL0WAuTYGo6sudm9hj/jDHZh -pAqi/2BQQeVgTa6oW0jtNPFe+/cobXo9TJ7wECGrhvVbmfl5ZPc0YVOIjjR0/LhL -q7lqPAlJ5vx0WvsX+QReN97we8vD0x1D3mCySJTi3Irh+grE0yJOSN2fa7cyqi9+ -vSiNUB1eUgQwrO+S8ZazYNvAZXC2Xf4WB4SOifJD73pYPAdwOejc0FA+zfEKa/6/ -vTUs8cIhlmDWO+BEoc9wygMKMmhT5s7/T5Bv ------END CERTIFICATE----- diff --git a/samples/net/wifi/test_certs/rsa2k_no_des/ca2.pem b/samples/net/wifi/test_certs/rsa2k_no_des/ca2.pem deleted file mode 100644 index 2b872d2e30da..000000000000 --- a/samples/net/wifi/test_certs/rsa2k_no_des/ca2.pem +++ /dev/null @@ -1,24 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIEBzCCAu+gAwIBAgIUK8+d+8IOzeX+DP3VSvdF3lHiCdcwDQYJKoZIhvcNAQEL -BQAwgZIxCzAJBgNVBAYTAkZSMQ8wDQYDVQQIDAZSYWRpdXMxEjAQBgNVBAcMCVNv -bWV3aGVyZTEUMBIGA1UECgwLRXhhbXBsZSBJbmMxJjAkBgNVBAMMHUV4YW1wbGUg -Q2VydGlmaWNhdGUgQXV0aG9yaXR5MSAwHgYJKoZIhvcNAQkBFhFhZG1pbkBleGFt -cGxlLm9yZzAeFw0yNDEwMDgxMDI0MDZaFw0zNDEwMDYxMDI0MDZaMIGSMQswCQYD -VQQGEwJGUjEPMA0GA1UECAwGUmFkaXVzMRIwEAYDVQQHDAlTb21ld2hlcmUxFDAS -BgNVBAoMC0V4YW1wbGUgSW5jMSYwJAYDVQQDDB1FeGFtcGxlIENlcnRpZmljYXRl -IEF1dGhvcml0eTEgMB4GCSqGSIb3DQEJARYRYWRtaW5AZXhhbXBsZS5vcmcwggEi -MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCWKIwjdRIp9IrpZELN/ZsN13Xj -qQI6n086PNJ7BZfLi0+tD164rmxFk2eukNNksFCPhvMkqUxouGhc4mJjeivvrZxR -oT3cblOQIkkdEci6iTKC2E1a20W/Ur7cTXoIsnKwjiUjXk+cujkrZu4fcHX+O4vy -wTd5tEbhmifT/4u5nN8U2vBcEZqkGHOCp30VZSxtlGwqp4lc+tVziF3uFViW9MXk -3bVt+s1E7ztwG7+WBgVlLYe3CNSWkMxfyYBafH/l7iep6AFjoTn1z3AAjYi7IUNN -0JkW8MTgafRQIu4QsV5luq/Tiar2vwAm/GNgUJdSzUKARsfQzb/XTIgnLQqtAgMB -AAGjUzBRMB0GA1UdDgQWBBSijSC03/Thi6EOdM91V33zsbQpgzAfBgNVHSMEGDAW -gBSijSC03/Thi6EOdM91V33zsbQpgzAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3 -DQEBCwUAA4IBAQAvKEfmCDoMTKC6bfP6DSs+MSAGc5tCr6w6cz2AKNJ2fOMhkq55 -JF47oBBGm9SdTB6Jqo6c109Ps69/+LMtEEGwvzL0RL0WAuTYGo6sudm9hj/jDHZh -pAqi/2BQQeVgTa6oW0jtNPFe+/cobXo9TJ7wECGrhvVbmfl5ZPc0YVOIjjR0/LhL -q7lqPAlJ5vx0WvsX+QReN97we8vD0x1D3mCySJTi3Irh+grE0yJOSN2fa7cyqi9+ -vSiNUB1eUgQwrO+S8ZazYNvAZXC2Xf4WB4SOifJD73pYPAdwOejc0FA+zfEKa/6/ -vTUs8cIhlmDWO+BEoc9wygMKMmhT5s7/T5Bv ------END CERTIFICATE----- diff --git a/samples/net/wifi/test_certs/rsa2k_no_des/client-key.pem b/samples/net/wifi/test_certs/rsa2k_no_des/client-key.pem deleted file mode 100644 index 6ab70da24524..000000000000 --- a/samples/net/wifi/test_certs/rsa2k_no_des/client-key.pem +++ /dev/null @@ -1,30 +0,0 @@ ------BEGIN ENCRYPTED PRIVATE KEY----- -MIIFLTBXBgkqhkiG9w0BBQ0wSjApBgkqhkiG9w0BBQwwHAQILVdWyEWhWU0CAggA -MAwGCCqGSIb3DQIJBQAwHQYJYIZIAWUDBAEqBBDMFReIusCg7gSkoUQZV2flBIIE -0BIFQH7+0dc7wHIQQ1y0ao90rrK3ExtCABH6xp4OAHUNPR1549zSEak/9Ba6WLBp -YE0m/lpLz4oUJE4Kd3rg4ekSZk4mapZoW7g5ax4qAEblmM6rqmyjiU0Q6tsAb8n1 -x+RyjUILlgTH1HDmeNA53QNMCw++xIMIJPN29SvFN6vkU2Fd2f74/TuZRSaCEPLO -LKtNMwWCMTrlv0UewEryOvZegPQuEF/Ewmmw/9l5VfkPp6zAtZKzWsfk4jUo5tv2 -5dPoHR+RKjNNVwetnCq59QYMS2My6KLqX4Vzqnbu8K1nlbm85ZHnvLGi8cDn8EB7 -QtRL+Ev5IwcwYJgV5AMojouJLQdR655jeITWI1Gsohz28YG8c1qYX4ZN6albSd1G -fd1tMOWkeu4uEzJ7ijLDfnCzrklnLuAZx8yLzyrOa7i9AwwJmdgUEdbWWsru3L6C -zDJ45rpA0FobdlTem4kpoE9yiyHkIhf3wmI3X+0aodC11pdbHP260KIC8E1K9FUh -s/IoEQCYrBp8UltNTlezwq/E5uOuIu4EpfjEgH1Z3+hSDbnmMAXNX4DbL234x7iy -3Y256DtOeHSElnRz3kDnZVNtM1Kd5fgEYJ1ptYRPYaWyJka7/hC/0UObuM9w+QeO -OlG0QgumQFloyhDa9anPBK4sYJp4g1fK8golUDW4AdpFPNOJvvgOvQUzhPpHjr+N -lpZ75Y6I3JSSKJ/UMlSCOqjak8oZtMtJNMfbx1lgwwDtgjDSJvSdl735gI9VmXXH -qnlGEtyiQ7k1Z1a4HxiY2/CiDHvkymClir/Ik8gt+wmyT9c/9BcehLRf6PxMsDVy -PCkty1LlzN+5tSZJtJnOiTlgsRn/w49Ohp74ITheSdb30/6PnFI+o8rcJHmrjN4d -t3z/bCyWAeC8mS7m0wtXlyBeG9xvdyT8dDHAFOnqxX30dEwEbjNj58kWGAgRf9i3 -HlOAP8yRy7LAV7A4HEPnEzXBxYpsROUw/8d3Jtmr2nAp2hfKP339DYZPHZpRLjJr -WQlJasHHLxHKKjSsuM06WsCO+Tt2FTSgGJuU6nFVK75fssmmJYzj9qMHVM6YSjfY -sT0ZIWRgO9NLFx5O3QxY1wgMLhhv1FREy9NVnMU0W3A1u0F7dwHywZGha2IqEXgu -+UyWIJnePMvluV/s66AN/OpIxKU48c0B4l7XzXkHHd43tDUG3ztfRuPbWCHipuRO -eo+vHGD01iBLSE1ZhrYLHKQhJvIKx/PIEaqJHP/Vy35AD/2/GH09TiIBHzX9aXie -TiKFs30FQv7SpLNHNE7jUxsYGNUbYa70S/Vgn3wkKATcXpCc749XQV4OUbFoqkDm -vuZOjkIOlm/OtZkUuDWmk96mgoVG/gWSEJPynJHUpmWdu/BCdYOgxBk/bmPa1leS -Z5NbO0fGMnNhDMXYA5rqmVzABcNSYhgYw5aciWpBlgYHEYrPxZvCxWftIyb24oEk -wdHEaFbIYbOoVZqo7Ym2hrvVrJb8Qdukf1BmUgfSSSc7BFoSrBUO4SNFtZI55NOB -OM4rnkqfoYR0IpnxzPIpxpsWljG9QsgnTaffStDgIGXiAtBWJFy+44f1IS4EoC6B -+we1Q6atPwYSyPtG8mn4Ce0BNxLDUoFDLMQ7Bt8QBMeX ------END ENCRYPTED PRIVATE KEY----- diff --git a/samples/net/wifi/test_certs/rsa2k_no_des/client-key2.pem b/samples/net/wifi/test_certs/rsa2k_no_des/client-key2.pem deleted file mode 100644 index 6ab70da24524..000000000000 --- a/samples/net/wifi/test_certs/rsa2k_no_des/client-key2.pem +++ /dev/null @@ -1,30 +0,0 @@ ------BEGIN ENCRYPTED PRIVATE KEY----- -MIIFLTBXBgkqhkiG9w0BBQ0wSjApBgkqhkiG9w0BBQwwHAQILVdWyEWhWU0CAggA -MAwGCCqGSIb3DQIJBQAwHQYJYIZIAWUDBAEqBBDMFReIusCg7gSkoUQZV2flBIIE -0BIFQH7+0dc7wHIQQ1y0ao90rrK3ExtCABH6xp4OAHUNPR1549zSEak/9Ba6WLBp -YE0m/lpLz4oUJE4Kd3rg4ekSZk4mapZoW7g5ax4qAEblmM6rqmyjiU0Q6tsAb8n1 -x+RyjUILlgTH1HDmeNA53QNMCw++xIMIJPN29SvFN6vkU2Fd2f74/TuZRSaCEPLO -LKtNMwWCMTrlv0UewEryOvZegPQuEF/Ewmmw/9l5VfkPp6zAtZKzWsfk4jUo5tv2 -5dPoHR+RKjNNVwetnCq59QYMS2My6KLqX4Vzqnbu8K1nlbm85ZHnvLGi8cDn8EB7 -QtRL+Ev5IwcwYJgV5AMojouJLQdR655jeITWI1Gsohz28YG8c1qYX4ZN6albSd1G -fd1tMOWkeu4uEzJ7ijLDfnCzrklnLuAZx8yLzyrOa7i9AwwJmdgUEdbWWsru3L6C -zDJ45rpA0FobdlTem4kpoE9yiyHkIhf3wmI3X+0aodC11pdbHP260KIC8E1K9FUh -s/IoEQCYrBp8UltNTlezwq/E5uOuIu4EpfjEgH1Z3+hSDbnmMAXNX4DbL234x7iy -3Y256DtOeHSElnRz3kDnZVNtM1Kd5fgEYJ1ptYRPYaWyJka7/hC/0UObuM9w+QeO -OlG0QgumQFloyhDa9anPBK4sYJp4g1fK8golUDW4AdpFPNOJvvgOvQUzhPpHjr+N -lpZ75Y6I3JSSKJ/UMlSCOqjak8oZtMtJNMfbx1lgwwDtgjDSJvSdl735gI9VmXXH -qnlGEtyiQ7k1Z1a4HxiY2/CiDHvkymClir/Ik8gt+wmyT9c/9BcehLRf6PxMsDVy -PCkty1LlzN+5tSZJtJnOiTlgsRn/w49Ohp74ITheSdb30/6PnFI+o8rcJHmrjN4d -t3z/bCyWAeC8mS7m0wtXlyBeG9xvdyT8dDHAFOnqxX30dEwEbjNj58kWGAgRf9i3 -HlOAP8yRy7LAV7A4HEPnEzXBxYpsROUw/8d3Jtmr2nAp2hfKP339DYZPHZpRLjJr -WQlJasHHLxHKKjSsuM06WsCO+Tt2FTSgGJuU6nFVK75fssmmJYzj9qMHVM6YSjfY -sT0ZIWRgO9NLFx5O3QxY1wgMLhhv1FREy9NVnMU0W3A1u0F7dwHywZGha2IqEXgu -+UyWIJnePMvluV/s66AN/OpIxKU48c0B4l7XzXkHHd43tDUG3ztfRuPbWCHipuRO -eo+vHGD01iBLSE1ZhrYLHKQhJvIKx/PIEaqJHP/Vy35AD/2/GH09TiIBHzX9aXie -TiKFs30FQv7SpLNHNE7jUxsYGNUbYa70S/Vgn3wkKATcXpCc749XQV4OUbFoqkDm -vuZOjkIOlm/OtZkUuDWmk96mgoVG/gWSEJPynJHUpmWdu/BCdYOgxBk/bmPa1leS -Z5NbO0fGMnNhDMXYA5rqmVzABcNSYhgYw5aciWpBlgYHEYrPxZvCxWftIyb24oEk -wdHEaFbIYbOoVZqo7Ym2hrvVrJb8Qdukf1BmUgfSSSc7BFoSrBUO4SNFtZI55NOB -OM4rnkqfoYR0IpnxzPIpxpsWljG9QsgnTaffStDgIGXiAtBWJFy+44f1IS4EoC6B -+we1Q6atPwYSyPtG8mn4Ce0BNxLDUoFDLMQ7Bt8QBMeX ------END ENCRYPTED PRIVATE KEY----- diff --git a/samples/net/wifi/test_certs/rsa2k_no_des/client.pem b/samples/net/wifi/test_certs/rsa2k_no_des/client.pem deleted file mode 100644 index 9e815474cd8d..000000000000 --- a/samples/net/wifi/test_certs/rsa2k_no_des/client.pem +++ /dev/null @@ -1,22 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDojCCAooCFGZ4UJXBKG70aewILFtsy4mbvaYZMA0GCSqGSIb3DQEBCwUAMIGS -MQswCQYDVQQGEwJGUjEPMA0GA1UECAwGUmFkaXVzMRIwEAYDVQQHDAlTb21ld2hl -cmUxFDASBgNVBAoMC0V4YW1wbGUgSW5jMSYwJAYDVQQDDB1FeGFtcGxlIENlcnRp -ZmljYXRlIEF1dGhvcml0eTEgMB4GCSqGSIb3DQEJARYRYWRtaW5AZXhhbXBsZS5v -cmcwHhcNMjQxMDA4MTAyNjI1WhcNMzQxMDA2MTAyNjI1WjCBhzELMAkGA1UEBhMC -RlIxDzANBgNVBAgMBlJhZGl1czESMBAGA1UEBwwJU29tZXdoZXJlMRQwEgYDVQQK -DAtFeGFtcGxlIEluYzEbMBkGA1UEAwwSY2xpZW50LmV4YW1wbGUub3JnMSAwHgYJ -KoZIhvcNAQkBFhFhZG1pbkBleGFtcGxlLm9yZzCCASIwDQYJKoZIhvcNAQEBBQAD -ggEPADCCAQoCggEBAMu3HXJvi2Q4hQnLL4v/sCyEr5x+ZtBcSi2yETMViaf2EStW -UOs1A1pmCQbO7nadLQcWaX4tzefQCRrs1X4hIQuDIqRPNi6h6G1g5HEtqBWZhvwu -hDbmFiX8/Vtw/P0/9sox2DzyLG0mjJUAYAbKtyC1kQalybVBtrSaazyyAyh6oOuU -chAb7SmmNDsRB959TWM/mp+6yCcFGzCDKNBwlwthB6Uw92d3SfOyXEnZm8rPf0hV -4ICL5iB+xEYBv1LKmznFK/4UAyKpxAygc5fxKVWwlSsq8MrES5ak0n6H71wViaXK -BrH5yh9jEkK9XSeaUwg8C9eOOexyx/5JDY3TTE8CAwEAATANBgkqhkiG9w0BAQsF -AAOCAQEAUNddNiRUlJH0acJJv8ztXNWjNewd17tAk1BBHp6yyGAD8b52p6QbDAdS -xO3WsSc2bqSy599jp4GshO27TMQsBRMfoggCG21Aj6sIs0Hd4shTE4T0GUBEBxC2 -/HReuD+cGIzzKMYlvK8RPSaGLPvPw5SryvmOnjD368V0KCHwT04Z14i4sMxlkd5q -wB7fxTkVla9MR4uWObX62mJykmqT86chScJpldtBpRh8wrEa3Gt9FZoi/eqP0De8 -oCxmCZDrozGTZ4IIaNzchx3Ensh1RQwvvxd6ATerYdUjq4V2TlTksDRdCXtj+uNJ -FnB32sUHiIouxudAsqDf8UL9/99RCw== ------END CERTIFICATE----- diff --git a/samples/net/wifi/test_certs/rsa2k_no_des/client2.pem b/samples/net/wifi/test_certs/rsa2k_no_des/client2.pem deleted file mode 100644 index 9e815474cd8d..000000000000 --- a/samples/net/wifi/test_certs/rsa2k_no_des/client2.pem +++ /dev/null @@ -1,22 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDojCCAooCFGZ4UJXBKG70aewILFtsy4mbvaYZMA0GCSqGSIb3DQEBCwUAMIGS -MQswCQYDVQQGEwJGUjEPMA0GA1UECAwGUmFkaXVzMRIwEAYDVQQHDAlTb21ld2hl -cmUxFDASBgNVBAoMC0V4YW1wbGUgSW5jMSYwJAYDVQQDDB1FeGFtcGxlIENlcnRp -ZmljYXRlIEF1dGhvcml0eTEgMB4GCSqGSIb3DQEJARYRYWRtaW5AZXhhbXBsZS5v -cmcwHhcNMjQxMDA4MTAyNjI1WhcNMzQxMDA2MTAyNjI1WjCBhzELMAkGA1UEBhMC -RlIxDzANBgNVBAgMBlJhZGl1czESMBAGA1UEBwwJU29tZXdoZXJlMRQwEgYDVQQK -DAtFeGFtcGxlIEluYzEbMBkGA1UEAwwSY2xpZW50LmV4YW1wbGUub3JnMSAwHgYJ -KoZIhvcNAQkBFhFhZG1pbkBleGFtcGxlLm9yZzCCASIwDQYJKoZIhvcNAQEBBQAD -ggEPADCCAQoCggEBAMu3HXJvi2Q4hQnLL4v/sCyEr5x+ZtBcSi2yETMViaf2EStW -UOs1A1pmCQbO7nadLQcWaX4tzefQCRrs1X4hIQuDIqRPNi6h6G1g5HEtqBWZhvwu -hDbmFiX8/Vtw/P0/9sox2DzyLG0mjJUAYAbKtyC1kQalybVBtrSaazyyAyh6oOuU -chAb7SmmNDsRB959TWM/mp+6yCcFGzCDKNBwlwthB6Uw92d3SfOyXEnZm8rPf0hV -4ICL5iB+xEYBv1LKmznFK/4UAyKpxAygc5fxKVWwlSsq8MrES5ak0n6H71wViaXK -BrH5yh9jEkK9XSeaUwg8C9eOOexyx/5JDY3TTE8CAwEAATANBgkqhkiG9w0BAQsF -AAOCAQEAUNddNiRUlJH0acJJv8ztXNWjNewd17tAk1BBHp6yyGAD8b52p6QbDAdS -xO3WsSc2bqSy599jp4GshO27TMQsBRMfoggCG21Aj6sIs0Hd4shTE4T0GUBEBxC2 -/HReuD+cGIzzKMYlvK8RPSaGLPvPw5SryvmOnjD368V0KCHwT04Z14i4sMxlkd5q -wB7fxTkVla9MR4uWObX62mJykmqT86chScJpldtBpRh8wrEa3Gt9FZoi/eqP0De8 -oCxmCZDrozGTZ4IIaNzchx3Ensh1RQwvvxd6ATerYdUjq4V2TlTksDRdCXtj+uNJ -FnB32sUHiIouxudAsqDf8UL9/99RCw== ------END CERTIFICATE----- diff --git a/samples/net/wifi/test_certs/rsa2k_no_des/server-key.pem b/samples/net/wifi/test_certs/rsa2k_no_des/server-key.pem deleted file mode 100644 index 5f032cad701d..000000000000 --- a/samples/net/wifi/test_certs/rsa2k_no_des/server-key.pem +++ /dev/null @@ -1,30 +0,0 @@ ------BEGIN ENCRYPTED PRIVATE KEY----- -MIIFLTBXBgkqhkiG9w0BBQ0wSjApBgkqhkiG9w0BBQwwHAQIjI78fcZSH7oCAggA -MAwGCCqGSIb3DQIJBQAwHQYJYIZIAWUDBAEqBBDfF676hRrL290F0MgMDZiuBIIE -0Hkz7skRV8Ox0SoX5N8GsOPfN4PS1cLyHgokY6dUhJPU5vUzOn9iSiGQSEzSguQ7 -11mssjRC2T45wB/95VK2EPtRw1f/6VOUR6RJnnGb0PV1Rydp/x5TZ6vzcXpakqly -eljJR/20fIJClsZzhw0iu5la9fkF6G8WYFEkqex5jALSiN4qVLvkiqcTnh5+amem -8+OCKgvgooKD2ids4/0GGfJRQSC6DFf3kuxNl+MMvmDXmz/vrD85ONnyXzKXDA3N -3vRgL/YT6GzwIXb+7/c/tIMpnacxPAdbNOs3DY5ss4xcK68L5PwpM2BljzBa5dGw -Smgf2VRaYRVzmrte5j280QjfrlHRU2cHaxm0GCu2AOTGwMXcSNYMXfDNuxc57oQJ -vHXMeZD4K5lACbhYdZ5lJNFvv29YI7dZ7QOGu6nXlAuhZfbdc/cgT0som7eG8xpT -pERllhQ5ych9sP9nAccN6VUsWgmlF73lbSptBek1ccYkp9LIYCteJUPl2qPcz6zl -A7zrZ54f3Lg0fOm2pCtg+qKBiw1nd3MR/YbRCgyvudyZE2cCN/ZspWqxsavbGYOz -JOfIFNnyAcOYtEv1n1BGLfMa1THW2bDV8XmHVHUtM0k4z250QAmLygWLY2166iUF -qotBkvctKKdulzGdT4nVer1UEKTqcxhDf0dRiHN5spZtFrOee0uGIoQWHt2oecaK -pJovW+i0qO/1DG5spfU2m1bz6jR2u6nxi340oRrMSoe1ELVg3l1/wmM8yzh07GuK -pshzxwqAG/FnaKCvcKGUG2EfnAvOcbMgSa2w3GvyRkcDPn00arvX9nuXj0gkRDBi -eoVMkKKTeeYSGQ4ik+ja3xkgHcxh5W8aoezLvBbmUq206cmhLwfnYMhnvFTs6EBK -E0ENpCHwF/qoVBIzRCijG/eeCuf3a1YkJsWlvEeVrPeOmDFeDft3SSGOzHxE2A/7 -HWmHbWTm7dPOfgsU4zf+HglnBjN3kYU7StyM0EGxmB4lfB2BiWiL/3R13ERHQZfa -oOqa4/hOFXOXfTQk6ufXtBx8L9BemBqh36zbs2xVvIizJKeRMruoRblWZkHhUKR8 -K5GA7FYkU9ZPPP0UPKsO94xzwfbevi+7nWeUZoqcqAUy8Jt5aD2QpvFVbPBBOz17 -PGaubeVn/Ry8swPvkpddtmJ4mgF+3SVctmzY+EE/oN1XS8wa+XeuaThzk89Lvrfa -606nRWrNw3PSKjYoEEtRLhPeJCi9uOVenbOjtclio9mV5Sugwurolczvq8DAGpMG -W4WgALgOWDjQAudiNH5dtcMGkBONbYywkJc7cT2OZFmzkCbchPPWlKGopuaFGAoU -SPj7C9SenHmOWAFRX5jJrOZAuVqkdKN3ShWZUL+cDkOCCQlZ0E31u0m9yozY1MeO -Sx42GtZaSGff37FGYeMZM2ztlutw2zmv2B1g52SBHTjCqQU/ud2Q6/U0kUzjbsdF -/0KQY9wgZRdOvbnA2lBirN1rXzLWPdduOZ5QImfHfvToN+oOlEqVvvWG12DdA4e5 -y4Dumx00lfKEsGutjF3oKgE6jsjwqAwCoYEAFHTtsvA0hKPisQwNHZmpjGARvR56 -yMEmXynKvgyVGvVP2a9VdqBXSpstL24HfDIu+nlyEWGQ ------END ENCRYPTED PRIVATE KEY----- diff --git a/samples/net/wifi/test_certs/rsa2k_no_des/server.pem b/samples/net/wifi/test_certs/rsa2k_no_des/server.pem deleted file mode 100644 index d8f82faf6dd3..000000000000 --- a/samples/net/wifi/test_certs/rsa2k_no_des/server.pem +++ /dev/null @@ -1,22 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDojCCAooCFCPQcj7ej5jhr6/mLlAoLYgfgsYcMA0GCSqGSIb3DQEBCwUAMIGS -MQswCQYDVQQGEwJGUjEPMA0GA1UECAwGUmFkaXVzMRIwEAYDVQQHDAlTb21ld2hl -cmUxFDASBgNVBAoMC0V4YW1wbGUgSW5jMSYwJAYDVQQDDB1FeGFtcGxlIENlcnRp -ZmljYXRlIEF1dGhvcml0eTEgMB4GCSqGSIb3DQEJARYRYWRtaW5AZXhhbXBsZS5v -cmcwHhcNMjQxMDA4MTAyNTI5WhcNMzQxMDA2MTAyNTI5WjCBhzELMAkGA1UEBhMC -RlIxDzANBgNVBAgMBlJhZGl1czESMBAGA1UEBwwJU29tZXdoZXJlMRQwEgYDVQQK -DAtFeGFtcGxlIEluYzEbMBkGA1UEAwwSc2VydmVyLmV4YW1wbGUub3JnMSAwHgYJ -KoZIhvcNAQkBFhFhZG1pbkBleGFtcGxlLm9yZzCCASIwDQYJKoZIhvcNAQEBBQAD -ggEPADCCAQoCggEBANcE/OPHQK/y1b6UsIktNK7WIZB528HECY7Bz18EGba0uHod -91RbzHSJ1qI3iQyldI1UW/kY5oYjBW3lhLH0BkD/EsqvNYCV+3YzAM3ITtdOdEU9 -CqjgXttehQHfXvc7jQlF8Q2gYPUz2dDLo/gcTkz1d+mCr6nQUjT8Kq/nG54T0NnD -k8udchjUlNaQsvx/WVs3TUYxMbWzQRtpJIbv99rAWq7YgQbkNZnSYC1VgrU/BiuQ -0KrP6rfkxvBCGwIh2JXIL3FV4N8AsgGZvjXQ3zXKXwuPhxWdSmjKWlioVM3mha2A -/1e1gX6nFY/uk46D60XWxcJ6tHGHoafU7EtN3zMCAwEAATANBgkqhkiG9w0BAQsF -AAOCAQEAWwdTMphD0jxLtYO0iq/+fMtq2R96ZUN9wprZ7qg1evUNQjqLR4jKX306 -ZJX5uw+6r5Ve/k368qvcSF/sSfvBm8yd3JcegTl5t8T2/Aks8o3sfyuS0uyJC1rS -zTrd7FmJG9YMosU1BqYobda64MXq7g+6MyrQoZ6fVdPvC6Sox3+a4fl9xjdm4CTY -MsWqBJMe26LptvRIJ01/B6PjVTvsn/fxxj7rHmnJ/j63AIiBntm0vV/85cwYy/4o -HlPH/Qjvn3hZjUlBcveiYat998F+s9gH2usvCkG3kly/n1/667LLCymmCHxtH8ka -7tF3siO1EANureFY8qj6ZvlKeTkZ6g== ------END CERTIFICATE----- From 75e410340d2671c2ccb39991aa9313ff57ec0d4e Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:00 +0300 Subject: [PATCH 1377/2141] Revert "[nrf fromlist] snippets: wifi-enterprise: Increase MBEDTLS heap size" This reverts commit e76c1955413736a44380ff0e304b053834d18456. Signed-off-by: Jukka Rissanen --- snippets/wifi-enterprise/snippet.yml | 5 ----- snippets/wifi-enterprise/wifi-enterprise-nrf.conf | 3 --- 2 files changed, 8 deletions(-) delete mode 100644 snippets/wifi-enterprise/wifi-enterprise-nrf.conf diff --git a/snippets/wifi-enterprise/snippet.yml b/snippets/wifi-enterprise/snippet.yml index f88b23ec2a4d..6a4f73d38b42 100644 --- a/snippets/wifi-enterprise/snippet.yml +++ b/snippets/wifi-enterprise/snippet.yml @@ -1,8 +1,3 @@ name: wifi-enterprise append: EXTRA_CONF_FILE: wifi-enterprise.conf - -boards: - /.*/nrf.*/cpuapp/: - append: - EXTRA_CONF_FILE: wifi-enterprise-nrf.conf diff --git a/snippets/wifi-enterprise/wifi-enterprise-nrf.conf b/snippets/wifi-enterprise/wifi-enterprise-nrf.conf deleted file mode 100644 index a52390c1687c..000000000000 --- a/snippets/wifi-enterprise/wifi-enterprise-nrf.conf +++ /dev/null @@ -1,3 +0,0 @@ -# For TLS and X.509 processing MbedTLS needs large heap size and using separate heap -# for MbedTLS gives us more control over the heap size. -CONFIG_MBEDTLS_HEAP_SIZE=75000 From 1b249358e35056c2b2559d7e680109c5684fab91 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:00 +0300 Subject: [PATCH 1378/2141] Revert "[nrf fromlist] secure_storage: increase stack sizes of tests" This reverts commit 31c3a0f03010aa84b972fa6711a409ff6c028b0d. Signed-off-by: Jukka Rissanen --- samples/psa/its/overlay-secure_storage.conf | 4 ++-- samples/psa/persistent_key/overlay-secure_storage.conf | 4 ++-- .../secure_storage/psa/crypto/overlay-secure_storage.conf | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/samples/psa/its/overlay-secure_storage.conf b/samples/psa/its/overlay-secure_storage.conf index b3fcab84205f..9265b38ccc7c 100644 --- a/samples/psa/its/overlay-secure_storage.conf +++ b/samples/psa/its/overlay-secure_storage.conf @@ -3,9 +3,9 @@ CONFIG_MBEDTLS=y CONFIG_MBEDTLS_PSA_CRYPTO_C=y -# The default stack size is not enough for the PSA Crypto core. +# The default stack size (1024) is not enough for the PSA Crypto core. # On top of that, the ITS implementation uses the stack for buffers. -CONFIG_MAIN_STACK_SIZE=4096 +CONFIG_MAIN_STACK_SIZE=3072 CONFIG_SECURE_STORAGE=y CONFIG_SECURE_STORAGE_ITS_STORE_IMPLEMENTATION_SETTINGS=y diff --git a/samples/psa/persistent_key/overlay-secure_storage.conf b/samples/psa/persistent_key/overlay-secure_storage.conf index 0b68451db29c..c5cff5f364ac 100644 --- a/samples/psa/persistent_key/overlay-secure_storage.conf +++ b/samples/psa/persistent_key/overlay-secure_storage.conf @@ -5,9 +5,9 @@ CONFIG_MBEDTLS_PSA_CRYPTO_C=y CONFIG_MBEDTLS_ENABLE_HEAP=y CONFIG_MBEDTLS_HEAP_SIZE=1024 -# The default stack size is not enough for the PSA Crypto core. +# The default stack size (1024) is not enough for the PSA Crypto core. # On top of that, the ITS implementation uses the stack for buffers. -CONFIG_MAIN_STACK_SIZE=4096 +CONFIG_MAIN_STACK_SIZE=3072 CONFIG_SECURE_STORAGE=y CONFIG_SECURE_STORAGE_ITS_STORE_IMPLEMENTATION_SETTINGS=y diff --git a/tests/subsys/secure_storage/psa/crypto/overlay-secure_storage.conf b/tests/subsys/secure_storage/psa/crypto/overlay-secure_storage.conf index 97594a4ac445..6df091015bed 100644 --- a/tests/subsys/secure_storage/psa/crypto/overlay-secure_storage.conf +++ b/tests/subsys/secure_storage/psa/crypto/overlay-secure_storage.conf @@ -1,5 +1,5 @@ -CONFIG_ZTEST_STACK_SIZE=4096 -CONFIG_MAIN_STACK_SIZE=3072 +CONFIG_ZTEST_STACK_SIZE=3072 +CONFIG_MAIN_STACK_SIZE=2048 CONFIG_MBEDTLS=y CONFIG_ENTROPY_GENERATOR=y From 31b5357aebc6851ea938c0859a99f0e8cacb6fd1 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:00 +0300 Subject: [PATCH 1379/2141] Revert "[nrf fromlist] boards: nordic: nrf54l15dk: Add button/LED aliases" This reverts commit 2241a25a0c4590dc1210be14e8f9c3553b1c09dd. Signed-off-by: Jukka Rissanen --- boards/nordic/nrf54l15dk/nrf54l_05_10_15_cpuapp_common.dtsi | 5 ----- 1 file changed, 5 deletions(-) diff --git a/boards/nordic/nrf54l15dk/nrf54l_05_10_15_cpuapp_common.dtsi b/boards/nordic/nrf54l15dk/nrf54l_05_10_15_cpuapp_common.dtsi index 46f9d797b61a..6962fc4b087f 100644 --- a/boards/nordic/nrf54l15dk/nrf54l_05_10_15_cpuapp_common.dtsi +++ b/boards/nordic/nrf54l15dk/nrf54l_05_10_15_cpuapp_common.dtsi @@ -20,11 +20,6 @@ zephyr,ieee802154 = &ieee802154; zephyr,boot-mode = &boot_mode0; }; - - aliases { - mcuboot-button0 = &button0; - mcuboot-led0 = &led0; - }; }; &cpuapp_sram { From 7e8c01eccfbe1efda5fd2015ce4569d862400c1a Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:00 +0300 Subject: [PATCH 1380/2141] Revert "[nrf fromlist] soc: nordic: nrf54h: s2ram: Add FPU retention" This reverts commit f53524cf05bca32d2ef8f243383309dfa3d5405b. Signed-off-by: Jukka Rissanen --- soc/nordic/nrf54h/pm_s2ram.c | 99 +++++------------------------------- 1 file changed, 13 insertions(+), 86 deletions(-) diff --git a/soc/nordic/nrf54h/pm_s2ram.c b/soc/nordic/nrf54h/pm_s2ram.c index c9be93ff5c9c..1ec5da4aa199 100644 --- a/soc/nordic/nrf54h/pm_s2ram.c +++ b/soc/nordic/nrf54h/pm_s2ram.c @@ -15,13 +15,6 @@ #define NVIC_MEMBER_SIZE(member) ARRAY_SIZE(((NVIC_Type *)0)->member) -/* Coprocessor Power Control Register Definitions */ -#define SCnSCB_CPPWR_SU11_Pos 22U /*!< CPPWR: SU11 Position */ -#define SCnSCB_CPPWR_SU11_Msk (1UL << SCnSCB_CPPWR_SU11_Pos) /*!< CPPWR: SU11 Mask */ - -#define SCnSCB_CPPWR_SU10_Pos 20U /*!< CPPWR: SU10 Position */ -#define SCnSCB_CPPWR_SU10_Msk (1UL << SCnSCB_CPPWR_SU10_Pos) /*!< CPPWR: SU10 Mask */ - /* Currently dynamic regions are only used in case of userspace or stack guard and * stack guard is not used by default on Cortex-M33 because there is a dedicated * mechanism for stack overflow detection. Unless those condition change we don't @@ -62,25 +55,12 @@ typedef struct { uint32_t MMFAR; uint32_t BFAR; uint32_t AFSR; - uint32_t CPACR; } _scb_context_t; -#if defined(CONFIG_FPU) && !defined(CONFIG_FPU_SHARING) -typedef struct { - uint32_t FPCCR; - uint32_t FPCAR; - uint32_t FPDSCR; - uint32_t S[32]; -} _fpu_context_t; -#endif - struct backup { _nvic_context_t nvic_context; _mpu_context_t mpu_context; _scb_context_t scb_context; -#if defined(CONFIG_FPU) && !defined(CONFIG_FPU_SHARING) - _fpu_context_t fpu_context; -#endif }; static __noinit struct backup backup_data; @@ -91,7 +71,7 @@ extern int z_arm_mpu_init(void); /* MPU registers cannot be simply copied because content of RBARx RLARx registers * depends on region which is selected by RNR register. */ -static void mpu_save(_mpu_context_t *backup) +static void mpu_suspend(_mpu_context_t *backup) { if (!MPU_USE_DYNAMIC_REGIONS) { return; @@ -109,7 +89,7 @@ static void mpu_save(_mpu_context_t *backup) backup->CTRL = MPU->CTRL; } -static void mpu_restore(_mpu_context_t *backup) +static void mpu_resume(_mpu_context_t *backup) { if (!MPU_USE_DYNAMIC_REGIONS) { z_arm_mpu_init(); @@ -131,21 +111,21 @@ static void mpu_restore(_mpu_context_t *backup) MPU->CTRL = backup->CTRL; } -static void nvic_save(_nvic_context_t *backup) +static void nvic_suspend(_nvic_context_t *backup) { memcpy(backup->ISER, (uint32_t *)NVIC->ISER, sizeof(NVIC->ISER)); memcpy(backup->ISPR, (uint32_t *)NVIC->ISPR, sizeof(NVIC->ISPR)); memcpy(backup->IPR, (uint32_t *)NVIC->IPR, sizeof(NVIC->IPR)); } -static void nvic_restore(_nvic_context_t *backup) +static void nvic_resume(_nvic_context_t *backup) { memcpy((uint32_t *)NVIC->ISER, backup->ISER, sizeof(NVIC->ISER)); memcpy((uint32_t *)NVIC->ISPR, backup->ISPR, sizeof(NVIC->ISPR)); memcpy((uint32_t *)NVIC->IPR, backup->IPR, sizeof(NVIC->IPR)); } -static void scb_save(_scb_context_t *backup) +static void scb_suspend(_scb_context_t *backup) { backup->ICSR = SCB->ICSR; backup->VTOR = SCB->VTOR; @@ -160,10 +140,9 @@ static void scb_save(_scb_context_t *backup) backup->MMFAR = SCB->MMFAR; backup->BFAR = SCB->BFAR; backup->AFSR = SCB->AFSR; - backup->CPACR = SCB->CPACR; } -static void scb_restore(_scb_context_t *backup) +static void scb_resume(_scb_context_t *backup) { SCB->ICSR = backup->ICSR; SCB->VTOR = backup->VTOR; @@ -178,77 +157,25 @@ static void scb_restore(_scb_context_t *backup) SCB->MMFAR = backup->MMFAR; SCB->BFAR = backup->BFAR; SCB->AFSR = backup->AFSR; - SCB->CPACR = backup->CPACR; -} - -#if defined(CONFIG_FPU) -static void fpu_power_down(void) -{ - SCB->CPACR &= (~(CPACR_CP10_Msk | CPACR_CP11_Msk)); - SCnSCB->CPPWR |= (SCnSCB_CPPWR_SU11_Msk | SCnSCB_CPPWR_SU10_Msk); - __DSB(); - __ISB(); -} - -static void fpu_power_up(void) -{ - SCnSCB->CPPWR &= (~(SCnSCB_CPPWR_SU11_Msk | SCnSCB_CPPWR_SU10_Msk)); - SCB->CPACR |= (CPACR_CP10_Msk | CPACR_CP11_Msk); - __DSB(); - __ISB(); -} - -#if !defined(CONFIG_FPU_SHARING) -static void fpu_save(_fpu_context_t *backup) -{ - backup->FPCCR = FPU->FPCCR; - backup->FPCAR = FPU->FPCAR; - backup->FPDSCR = FPU->FPDSCR; - - __asm__ volatile("vstmia %0, {s0-s31}\n" : : "r"(backup->S) : "memory"); -} - -static void fpu_restore(_fpu_context_t *backup) -{ - FPU->FPCCR = backup->FPCCR; - FPU->FPCAR = backup->FPCAR; - FPU->FPDSCR = backup->FPDSCR; - - __asm__ volatile("vldmia %0, {s0-s31}\n" : : "r"(backup->S) : "memory"); } -#endif /* !defined(CONFIG_FPU_SHARING) */ -#endif /* defined(CONFIG_FPU) */ int soc_s2ram_suspend(pm_s2ram_system_off_fn_t system_off) { int ret; - scb_save(&backup_data.scb_context); -#if defined(CONFIG_FPU) -#if !defined(CONFIG_FPU_SHARING) - fpu_save(&backup_data.fpu_context); -#endif - fpu_power_down(); -#endif - nvic_save(&backup_data.nvic_context); - mpu_save(&backup_data.mpu_context); + scb_suspend(&backup_data.scb_context); + nvic_suspend(&backup_data.nvic_context); + mpu_suspend(&backup_data.mpu_context); ret = arch_pm_s2ram_suspend(system_off); - /* Cache and FPU are powered down so power up is needed even if s2ram failed. */ + /* Cache is powered down so power up is needed even if s2ram failed. */ nrf_power_up_cache(); -#if defined(CONFIG_FPU) - fpu_power_up(); -#if !defined(CONFIG_FPU_SHARING) - /* Also the FPU content might be lost. */ - fpu_restore(&backup_data.fpu_context); -#endif -#endif if (ret < 0) { return ret; } - mpu_restore(&backup_data.mpu_context); - nvic_restore(&backup_data.nvic_context); - scb_restore(&backup_data.scb_context); + mpu_resume(&backup_data.mpu_context); + nvic_resume(&backup_data.nvic_context); + scb_resume(&backup_data.scb_context); return ret; } From 3a45c40d23bc33744e796d54bcf640f8b50ea3eb Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:00 +0300 Subject: [PATCH 1381/2141] Revert "[nrf fromtree] cmake: kconfig: Add APP_DIR to kconfig environment" This reverts commit aca65d1339cb0f97bc41772e612f6972bca082bb. Signed-off-by: Jukka Rissanen --- cmake/modules/kconfig.cmake | 4 ---- 1 file changed, 4 deletions(-) diff --git a/cmake/modules/kconfig.cmake b/cmake/modules/kconfig.cmake index def17f16ae63..65b3bbb0382c 100644 --- a/cmake/modules/kconfig.cmake +++ b/cmake/modules/kconfig.cmake @@ -135,9 +135,6 @@ else() set(_local_TOOLCHAIN_HAS_PICOLIBC n) endif() -# APP_DIR: Path to the main image (sysbuild) or synonym for APPLICATION_SOURCE_DIR (non-sysbuild) -zephyr_get(APP_DIR VAR APP_DIR APPLICATION_SOURCE_DIR) - set(COMMON_KCONFIG_ENV_SETTINGS PYTHON_EXECUTABLE=${PYTHON_EXECUTABLE} srctree=${ZEPHYR_BASE} @@ -145,7 +142,6 @@ set(COMMON_KCONFIG_ENV_SETTINGS APPVERSION=${APP_VERSION_STRING} APP_VERSION_EXTENDED_STRING=${APP_VERSION_EXTENDED_STRING} APP_VERSION_TWEAK_STRING=${APP_VERSION_TWEAK_STRING} - APP_DIR=${APP_DIR} CONFIG_=${KCONFIG_NAMESPACE}_ KCONFIG_CONFIG=${DOTCONFIG} KCONFIG_BOARD_DIR=${KCONFIG_BOARD_DIR} From 03d3dfc217728e09dee2fa6a5f3cbcdd5c84ce84 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:00 +0300 Subject: [PATCH 1382/2141] Revert "[nrf fromlist] tests: settings: Add retention test" This reverts commit a5a9f4aab7adcbcc5c763c39a3e526c08f02e6da. Signed-off-by: Jukka Rissanen --- .../subsys/settings/retention/CMakeLists.txt | 7 - .../boards/nrf52840dk_nrf52840.overlay | 39 ------ .../retention/boards/qemu_cortex_m3.overlay | 35 ----- tests/subsys/settings/retention/prj.conf | 7 - .../settings/retention/src/CMakeLists.txt | 12 -- tests/subsys/settings/retention/src/main.c | 130 ------------------ .../settings/retention/src/settings_test.h | 42 ------ tests/subsys/settings/retention/testcase.yaml | 9 -- 8 files changed, 281 deletions(-) delete mode 100644 tests/subsys/settings/retention/CMakeLists.txt delete mode 100644 tests/subsys/settings/retention/boards/nrf52840dk_nrf52840.overlay delete mode 100644 tests/subsys/settings/retention/boards/qemu_cortex_m3.overlay delete mode 100644 tests/subsys/settings/retention/prj.conf delete mode 100644 tests/subsys/settings/retention/src/CMakeLists.txt delete mode 100644 tests/subsys/settings/retention/src/main.c delete mode 100644 tests/subsys/settings/retention/src/settings_test.h delete mode 100644 tests/subsys/settings/retention/testcase.yaml diff --git a/tests/subsys/settings/retention/CMakeLists.txt b/tests/subsys/settings/retention/CMakeLists.txt deleted file mode 100644 index 315cbacf5947..000000000000 --- a/tests/subsys/settings/retention/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -cmake_minimum_required(VERSION 3.20.0) -find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -project(settings_retention) - -add_subdirectory(./src zms_test_bindir) diff --git a/tests/subsys/settings/retention/boards/nrf52840dk_nrf52840.overlay b/tests/subsys/settings/retention/boards/nrf52840dk_nrf52840.overlay deleted file mode 100644 index e7806a54b853..000000000000 --- a/tests/subsys/settings/retention/boards/nrf52840dk_nrf52840.overlay +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - chosen { - /delete-property/ zephyr,boot-mode; - }; - - sram@2003F000 { - compatible = "zephyr,memory-region", "mmio-sram"; - reg = <0x2003F000 DT_SIZE_K(4)>; - zephyr,memory-region = "RetainedMem"; - status = "okay"; - - retainedmem { - compatible = "zephyr,retained-ram"; - status = "okay"; - #address-cells = <1>; - #size-cells = <1>; - - settings_partition0: settings_partition@0 { - compatible = "zephyr,retention"; - status = "okay"; - reg = <0x0 0x1000>; - }; - }; - }; - - chosen { - zephyr,settings-partition = &settings_partition0; - }; -}; - -&sram0 { - reg = <0x20000000 DT_SIZE_K(252)>; -}; diff --git a/tests/subsys/settings/retention/boards/qemu_cortex_m3.overlay b/tests/subsys/settings/retention/boards/qemu_cortex_m3.overlay deleted file mode 100644 index fe9bab6b727c..000000000000 --- a/tests/subsys/settings/retention/boards/qemu_cortex_m3.overlay +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - sram@2000F000 { - compatible = "zephyr,memory-region", "mmio-sram"; - reg = <0x2000F000 0x1000>; - zephyr,memory-region = "RetainedMem"; - status = "okay"; - - retainedmem { - compatible = "zephyr,retained-ram"; - status = "okay"; - #address-cells = <1>; - #size-cells = <1>; - - settings_partition0: settings_partition@0 { - compatible = "zephyr,retention"; - status = "okay"; - reg = <0x0 0x1000>; - }; - }; - }; - - chosen { - zephyr,settings-partition = &settings_partition0; - }; -}; - -&sram0 { - reg = <0x20000000 0xf000>; -}; diff --git a/tests/subsys/settings/retention/prj.conf b/tests/subsys/settings/retention/prj.conf deleted file mode 100644 index ae8afe82d746..000000000000 --- a/tests/subsys/settings/retention/prj.conf +++ /dev/null @@ -1,7 +0,0 @@ -CONFIG_ZTEST=y -CONFIG_RETAINED_MEM=y -CONFIG_RETENTION=y - -CONFIG_SETTINGS=y -CONFIG_SETTINGS_RUNTIME=y -CONFIG_SETTINGS_RETENTION=y diff --git a/tests/subsys/settings/retention/src/CMakeLists.txt b/tests/subsys/settings/retention/src/CMakeLists.txt deleted file mode 100644 index b2897bddcf91..000000000000 --- a/tests/subsys/settings/retention/src/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 -# Copyright (c) 2024 BayLibre SAS - -zephyr_include_directories( - ${ZEPHYR_BASE}/subsys/settings/include - ${ZEPHYR_BASE}/subsys/settings/src - ${ZEPHYR_BASE}/tests/subsys/settings/zms/src - ) - -target_sources(app PRIVATE main.c) - -add_subdirectory(../../src settings_test_bindir) diff --git a/tests/subsys/settings/retention/src/main.c b/tests/subsys/settings/retention/src/main.c deleted file mode 100644 index 3673e0b9810a..000000000000 --- a/tests/subsys/settings/retention/src/main.c +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (c) 2024 BayLibre SAS - * - * SPDX-License-Identifier: Apache-2.0 - */ -#include -#include - -#include "settings_priv.h" -#include "settings_test.h" - -uint8_t val8; -uint8_t val8_un; -uint32_t val32; -uint64_t val64; - -int test_get_called; -int test_set_called; -int test_commit_called; -int test_export_block; - -int c1_handle_get(const char *name, char *val, int val_len_max); -int c1_handle_set(const char *name, size_t len, settings_read_cb read_cb, void *cb_arg); -int c1_handle_commit(void); -int c1_handle_export(int (*cb)(const char *name, const void *value, size_t val_len)); - -struct settings_handler c_test_handlers[] = { - {.name = "myfoo", - .h_get = c1_handle_get, - .h_set = c1_handle_set, - .h_commit = c1_handle_commit, - .h_export = c1_handle_export}, -}; - -int c1_handle_get(const char *name, char *val, int val_len_max) -{ - const char *next; - - if (val_len_max < 0) { - return -EINVAL; - } - - test_get_called = 1; - - if (settings_name_steq(name, "mybar", &next) && !next) { - val_len_max = MIN(val_len_max, sizeof(val8)); - memcpy(val, &val8, MIN(val_len_max, sizeof(val8))); - return val_len_max; - } - - if (settings_name_steq(name, "mybar64", &next) && !next) { - val_len_max = MIN(val_len_max, sizeof(val64)); - memcpy(val, &val64, MIN(val_len_max, sizeof(val64))); - return val_len_max; - } - - return -ENOENT; -} - -int c1_handle_set(const char *name, size_t len, settings_read_cb read_cb, void *cb_arg) -{ - size_t val_len; - int rc; - const char *next; - - test_set_called = 1; - if (settings_name_steq(name, "mybar", &next) && !next) { - rc = read_cb(cb_arg, &val8, sizeof(val8)); - zassert_true(rc >= 0, "SETTINGS_VALUE_SET callback"); - return 0; - } - - if (settings_name_steq(name, "mybar64", &next) && !next) { - rc = read_cb(cb_arg, &val64, sizeof(val64)); - zassert_true(rc >= 0, "SETTINGS_VALUE_SET callback"); - return 0; - } - - if (settings_name_steq(name, "unaligned", &next) && !next) { - val_len = len; - zassert_equal(val_len, sizeof(val8_un), "value length: %zd, ought equal 1", - val_len); - rc = read_cb(cb_arg, &val8_un, sizeof(val8_un)); - zassert_true(rc >= 0, "SETTINGS_VALUE_SET callback"); - return 0; - } - - return -ENOENT; -} - -int c1_handle_commit(void) -{ - test_commit_called = 1; - return 0; -} - -int c1_handle_export(int (*cb)(const char *name, const void *value, size_t val_len)) -{ - if (test_export_block) { - return 0; - } - - (void)cb("myfoo/mybar", &val8, sizeof(val8)); - - (void)cb("myfoo/mybar64", &val64, sizeof(val64)); - - (void)cb("myfoo/unaligned", &val8_un, sizeof(val8_un)); - - return 0; -} - -void ctest_clear_call_state(void) -{ - test_get_called = 0; - test_set_called = 0; - test_commit_called = 0; -} - -int ctest_get_call_state(void) -{ - return test_get_called + test_set_called + test_commit_called; -} - -void config_wipe_srcs(void) -{ - sys_slist_init(&settings_load_srcs); - settings_save_dst = NULL; -} - -ZTEST_SUITE(settings_config, NULL, settings_config_setup, NULL, NULL, settings_config_teardown); diff --git a/tests/subsys/settings/retention/src/settings_test.h b/tests/subsys/settings/retention/src/settings_test.h deleted file mode 100644 index 6a53260e1d44..000000000000 --- a/tests/subsys/settings/retention/src/settings_test.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2024 BayLibre SAS - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef _SETTINGS_TEST_H -#define _SETTINGS_TEST_H - -#include -#include -#include - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -extern uint8_t val8; -extern uint8_t val8_un; -extern uint32_t val32; -extern uint64_t val64; - -extern int test_get_called; -extern int test_set_called; -extern int test_commit_called; -extern int test_export_block; - -extern struct settings_handler c_test_handlers[]; - -void ctest_clear_call_state(void); -int ctest_get_call_state(void); - -void config_wipe_srcs(void); -void *settings_config_setup(void); -void settings_config_teardown(void *fixture); - -#ifdef __cplusplus -} -#endif -#endif /* _SETTINGS_TEST_H */ diff --git a/tests/subsys/settings/retention/testcase.yaml b/tests/subsys/settings/retention/testcase.yaml deleted file mode 100644 index adbd61e4701a..000000000000 --- a/tests/subsys/settings/retention/testcase.yaml +++ /dev/null @@ -1,9 +0,0 @@ -tests: - settings.retention: - platform_allow: - - nrf52840dk/nrf52840 - - qemu_cortex_m3 - min_ram: 8 - tags: - - settings - - retention From 9e757b982f4bf1b1869addb79e9bbdb1ff77b698 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:00 +0300 Subject: [PATCH 1383/2141] Revert "[nrf fromlist] settings: Add retention backend" This reverts commit 8f4bffb7a02cbaaa78588bc234f4d9bc3678920b. Signed-off-by: Jukka Rissanen --- subsys/settings/Kconfig | 14 -- subsys/settings/src/CMakeLists.txt | 1 - subsys/settings/src/settings_retention.c | 303 ----------------------- 3 files changed, 318 deletions(-) delete mode 100644 subsys/settings/src/settings_retention.c diff --git a/subsys/settings/Kconfig b/subsys/settings/Kconfig index 5b6a76052b20..fdb3c4bb3ce2 100644 --- a/subsys/settings/Kconfig +++ b/subsys/settings/Kconfig @@ -30,20 +30,12 @@ config SETTINGS_DYNAMIC_HANDLERS config SETTINGS_ENCODE_LEN bool -DT_CHOSEN_ZEPHYR_SETTINGS_PARTITION := zephyr,settings-partition -DT_ZEPHYR_RETENTION := zephyr,retention - -config SETTINGS_SUPPORTED_RETENTION - bool - default y if RETENTION && $(dt_chosen_has_compat,$(DT_CHOSEN_ZEPHYR_SETTINGS_PARTITION),$(DT_ZEPHYR_RETENTION)) - choice SETTINGS_BACKEND prompt "Storage back-end" default SETTINGS_ZMS if ZMS default SETTINGS_NVS if NVS default SETTINGS_FCB if FCB default SETTINGS_FILE if FILE_SYSTEM - default SETTINGS_RETENTION if SETTINGS_SUPPORTED_RETENTION default SETTINGS_NONE help Storage back-end to be used by the settings subsystem. @@ -112,12 +104,6 @@ config SETTINGS_NVS_NAME_CACHE_SIZE endif # SETTINGS_NVS -config SETTINGS_RETENTION - bool "Retention storage support" - depends on SETTINGS_SUPPORTED_RETENTION - help - Enables retention storage support (bulk load/save supported only). - config SETTINGS_CUSTOM bool "CUSTOM" help diff --git a/subsys/settings/src/CMakeLists.txt b/subsys/settings/src/CMakeLists.txt index 705fd3dc77d4..4aa797fbb350 100644 --- a/subsys/settings/src/CMakeLists.txt +++ b/subsys/settings/src/CMakeLists.txt @@ -14,4 +14,3 @@ zephyr_sources_ifdef(CONFIG_SETTINGS_NVS settings_nvs.c) zephyr_sources_ifdef(CONFIG_SETTINGS_NONE settings_none.c) zephyr_sources_ifdef(CONFIG_SETTINGS_SHELL settings_shell.c) zephyr_sources_ifdef(CONFIG_SETTINGS_ZMS settings_zms.c) -zephyr_sources_ifdef(CONFIG_SETTINGS_RETENTION settings_retention.c) diff --git a/subsys/settings/src/settings_retention.c b/subsys/settings/src/settings_retention.c deleted file mode 100644 index 931bf02cb9f1..000000000000 --- a/subsys/settings/src/settings_retention.c +++ /dev/null @@ -1,303 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include - -#include -#include -#include -#include "settings_priv.h" - -LOG_MODULE_DECLARE(settings, CONFIG_SETTINGS_LOG_LEVEL); - -#if !DT_HAS_CHOSEN(zephyr_settings_partition) -#error "Missing zephyr,settings-partition chosen node" -#elif !DT_NODE_HAS_COMPAT(DT_CHOSEN(zephyr_settings_partition), zephyr_retention) -#error "zephyr,settings-partition must be a zephyr,retention node" -#endif - -/* - * Retention storage stores each setting in the following format: - * uint16_t length_name - * uint16_t length_value - * uint8_t name[...] - * uint8_t value[...] - * - * Each setting is placed sequentially into the retention memory area, it is assumed that the - * checksum feature is used to ensure data validity upon loading settings from the retained - * memory though this is optional. - * - * Upon saving settings, the whole retention area is cleared first, then settings are written - * one-by-one, it is only supported to save/load all settings in one go. - */ - -/** Retention settings context object */ -struct settings_retention { - /** Settings storage */ - struct settings_store cf_store; - - /** Retention device */ - const struct device *cf_retention; - - /** Last write position when setting was saved */ - uint32_t last_write_pos; -}; - -/** Length of name and value object, used when reading/saving settings */ -struct settings_retention_lengths { - /** Length of name */ - uint16_t length_name; - - /** Length of value */ - uint16_t length_value; - - /* Name and value byte arrays follow past this point... */ -}; - -BUILD_ASSERT(sizeof(struct settings_retention_lengths) == sizeof(uint16_t) + sizeof(uint16_t)); - -/** Used with read callback */ -struct settings_retention_read_arg { - /** Retention device */ - const struct device *cf_retention; - - /** Offset to read from */ - uint32_t offset; -}; - -static int settings_retention_load(struct settings_store *cs, const struct settings_load_arg *arg); -static int settings_retention_save(struct settings_store *cs, const char *name, const char *value, - size_t val_len); -static void *settings_retention_storage_get(struct settings_store *cs); -static int settings_retention_save_start(struct settings_store *cs); - -static const struct device *storage_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_settings_partition)); - -static const struct settings_store_itf settings_retention_itf = { - .csi_load = settings_retention_load, - .csi_save = settings_retention_save, - .csi_storage_get = settings_retention_storage_get, - .csi_save_start = settings_retention_save_start, -}; - -static int settings_retention_src(struct settings_retention *cf) -{ - if (!retention_is_valid(cf->cf_retention)) { - return -EIO; - } - - cf->cf_store.cs_itf = &settings_retention_itf; - settings_src_register(&cf->cf_store); - - return 0; -} - -static int settings_retention_dst(struct settings_retention *cf) -{ - cf->cf_store.cs_itf = &settings_retention_itf; - settings_dst_register(&cf->cf_store); - - return 0; -} - -static int settings_retention_read_value(void *cb_arg, void *data, size_t len) -{ - int rc; - struct settings_retention_read_arg *ctx = cb_arg; - - rc = retention_read(ctx->cf_retention, ctx->offset, data, len); - - if (rc != 0) { - return rc; - } - - return len; -} - -static int settings_retention_load(struct settings_store *cs, const struct settings_load_arg *arg) -{ - int rc; - uint32_t pos = 0; - struct settings_retention *cf = CONTAINER_OF(cs, struct settings_retention, cf_store); - uint32_t max_pos = retention_size(cf->cf_retention); - struct settings_retention_read_arg read_arg = { - .cf_retention = cf->cf_retention, - }; - - while (pos < max_pos) { - struct settings_retention_lengths lengths; - char name[SETTINGS_MAX_NAME_LEN + SETTINGS_EXTRA_LEN + 1]; - - if ((pos + sizeof(lengths)) >= max_pos) { - return -EIO; - } - - /* Read lengths and check validity */ - rc = retention_read(cf->cf_retention, pos, (uint8_t *)&lengths, sizeof(lengths)); - - if (rc != 0) { - return rc; - } - - if ((lengths.length_name == 0 && lengths.length_value == 0) || - (lengths.length_name == USHRT_MAX && lengths.length_value == USHRT_MAX)) { - /* Empty data, finished loading */ - LOG_DBG("Finished loading retentions settings, size: 0x%x", pos); - break; - } else if (lengths.length_name > SETTINGS_MAX_NAME_LEN) { - LOG_ERR("Invalid name length: %d, max supported: %d", - lengths.length_name, SETTINGS_MAX_NAME_LEN); - return -EIO; - } else if (lengths.length_value > SETTINGS_MAX_VAL_LEN) { - LOG_ERR("Invalid value length: %d, max supported: %d", - lengths.length_name, SETTINGS_MAX_VAL_LEN); - return -EIO; - } else if ((lengths.length_name + lengths.length_value + pos) > max_pos) { - LOG_ERR("Data length goes beyond retention area: 0x%x, max size: 0x%x", - (lengths.length_name + lengths.length_value + pos), max_pos); - return -EIO; - } - - /* Read values */ - pos += sizeof(lengths); - rc = retention_read(cf->cf_retention, pos, name, lengths.length_name); - - if (rc != 0) { - return rc; - } - - name[lengths.length_name] = '\0'; - pos += lengths.length_name; - read_arg.offset = pos; - - rc = settings_call_set_handler(name, lengths.length_value, - &settings_retention_read_value, &read_arg, arg); - - if (rc != 0) { - return rc; - } - - pos += lengths.length_value; - } - - return 0; -} - -static int settings_retention_save(struct settings_store *cs, const char *name, const char *value, - size_t val_len) -{ - struct settings_retention *cf = CONTAINER_OF(cs, struct settings_retention, cf_store); - struct settings_retention_lengths lengths; - uint32_t off = cf->last_write_pos; - int rc = -EINVAL; - - if (name == NULL || (value == NULL && val_len > 0)) { - return -EINVAL; - } - - lengths.length_name = (uint16_t)strlen(name); - lengths.length_value = (uint16_t)val_len; - - if (lengths.length_name == 0) { - return -EINVAL; - } else if ((cf->last_write_pos + sizeof(lengths) + lengths.length_name + val_len) > - retention_size(cf->cf_retention)) { - return -E2BIG; - } - - /* Write data before writing length header to ensure that if something happens before one - * is written then the data is not wrongly seen as valid upon reading, as would be the - * case if it was partially written - */ - off += sizeof(lengths); - rc = retention_write(cf->cf_retention, off, name, lengths.length_name); - - if (rc != 0) { - return rc; - } - - off += lengths.length_name; - rc = retention_write(cf->cf_retention, off, value, val_len); - - if (rc != 0) { - goto tidy; - } - - rc = retention_write(cf->cf_retention, cf->last_write_pos, (uint8_t *)&lengths, - sizeof(lengths)); - - if (rc != 0) { - goto tidy; - } - - off += val_len; - cf->last_write_pos = off; - -tidy: - if (rc != 0) { - /* Attempt to clear data header that was partially written */ - uint8_t empty_data[sizeof(lengths)] = { 0x00 }; - uint8_t l = sizeof(lengths) + lengths.length_name + val_len; - uint8_t i = 0; - - while (i < l) { - uint8_t write_len = (i + sizeof(empty_data)) > l ? (l - i) : - sizeof(empty_data); - - rc = retention_write(cf->cf_retention, (cf->last_write_pos + i), - empty_data, write_len); - - if (rc != 0) { - break; - } - - i += write_len; - } - } - - return rc; -} - -static int settings_retention_save_start(struct settings_store *cs) -{ - struct settings_retention *cf = CONTAINER_OF(cs, struct settings_retention, cf_store); - - cf->last_write_pos = 0; - - return retention_clear(cf->cf_retention); -} - -int settings_backend_init(void) -{ - int rc; - static struct settings_retention config_init_settings_retention; - - if (!device_is_ready(storage_dev)) { - return -ENOENT; - } - - config_init_settings_retention.cf_retention = storage_dev; - config_init_settings_retention.last_write_pos = 0; - - rc = settings_retention_src(&config_init_settings_retention); - - if (rc != 0 && rc != -EIO) { - return rc; - } - - rc = settings_retention_dst(&config_init_settings_retention); - - return rc; -} - -static void *settings_retention_storage_get(struct settings_store *cs) -{ - struct settings_retention *cf = CONTAINER_OF(cs, struct settings_retention, cf_store); - - return &cf->cf_retention; -} From d3788f6ae3b4c48ddeef6f236a5b8da88357ff29 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:00 +0300 Subject: [PATCH 1384/2141] Revert "[nrf fromtree] drivers: timer: nrf_grtc_timer: add last_count initialization" This reverts commit dc5dda3496b940d36f61cd9099bf4a3034e16dbc. Signed-off-by: Jukka Rissanen --- drivers/timer/nrf_grtc_timer.c | 8 -------- include/zephyr/drivers/timer/nrf_grtc_timer.h | 11 ----------- 2 files changed, 19 deletions(-) diff --git a/drivers/timer/nrf_grtc_timer.c b/drivers/timer/nrf_grtc_timer.c index 2809d8b3d608..285e48a57fd2 100644 --- a/drivers/timer/nrf_grtc_timer.c +++ b/drivers/timer/nrf_grtc_timer.c @@ -66,7 +66,6 @@ static struct k_spinlock lock; static uint64_t last_count; /* Time (SYSCOUNTER value) @last sys_clock_announce() */ static atomic_t int_mask; static uint8_t ext_channels_allocated; -static uint64_t grtc_start_value; static nrfx_grtc_channel_t system_clock_channel_data = { .handler = sys_clock_timeout_handler, .p_context = NULL, @@ -359,11 +358,6 @@ int z_nrf_grtc_timer_capture_read(int32_t chan, uint64_t *captured_time) return 0; } -uint64_t z_nrf_grtc_timer_startup_value_get(void) -{ - return grtc_start_value; -} - #if defined(CONFIG_POWEROFF) && defined(CONFIG_NRF_GRTC_START_SYSCOUNTER) int z_nrf_grtc_wakeup_prepare(uint64_t wake_time_us) { @@ -491,8 +485,6 @@ static int sys_clock_driver_init(void) } #endif /* CONFIG_NRF_GRTC_START_SYSCOUNTER */ - last_count = (counter() / CYC_PER_TICK) * CYC_PER_TICK; - grtc_start_value = last_count; int_mask = NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK; if (!IS_ENABLED(CONFIG_TICKLESS_KERNEL)) { system_timeout_set_relative(CYC_PER_TICK); diff --git a/include/zephyr/drivers/timer/nrf_grtc_timer.h b/include/zephyr/drivers/timer/nrf_grtc_timer.h index 5a51df217442..f8b69d7ddf02 100644 --- a/include/zephyr/drivers/timer/nrf_grtc_timer.h +++ b/include/zephyr/drivers/timer/nrf_grtc_timer.h @@ -189,17 +189,6 @@ int z_nrf_grtc_timer_capture_read(int32_t chan, uint64_t *captured_time); */ int z_nrf_grtc_wakeup_prepare(uint64_t wake_time_us); -/** @brief Get the GRTC counter value latched at startup. - * - * @note The GRTC timer is not cleared by software at startup, - * while the system tick starts counting from zero. - * In some cases, it may be necessary to compare the system tick - * with the GRTC value — in such situations, this offset can be useful. - * - * @return GRTC value latched during system clock initialization. - */ -uint64_t z_nrf_grtc_timer_startup_value_get(void); - /** * @brief Initialize the GRTC clock timer driver from an application- * defined function. From a19591e2f2e3f2dc76e24e5df1f5cb313c75c5af Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:00 +0300 Subject: [PATCH 1385/2141] Revert "[nrf fromtree] net: lib: ptp: fix memory slab alignment issues" This reverts commit aacc6227ce25ae298045d791bd95b8c4f0a7ff76. Signed-off-by: Jukka Rissanen --- subsys/net/lib/ptp/msg.c | 2 +- subsys/net/lib/ptp/port.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/subsys/net/lib/ptp/msg.c b/subsys/net/lib/ptp/msg.c index 3fb78a40edb4..e0b7f14229d0 100644 --- a/subsys/net/lib/ptp/msg.c +++ b/subsys/net/lib/ptp/msg.c @@ -19,7 +19,7 @@ LOG_MODULE_REGISTER(ptp_msg, CONFIG_PTP_LOG_LEVEL); static struct k_mem_slab msg_slab; -K_MEM_SLAB_DEFINE_STATIC(msg_slab, sizeof(struct ptp_msg), CONFIG_PTP_MSG_POLL_SIZE, 4); +K_MEM_SLAB_DEFINE_STATIC(msg_slab, sizeof(struct ptp_msg), CONFIG_PTP_MSG_POLL_SIZE, 8); static const char *msg_type_str(struct ptp_msg *msg) { diff --git a/subsys/net/lib/ptp/port.c b/subsys/net/lib/ptp/port.c index 24abec002c8d..ef3e19c43e0b 100644 --- a/subsys/net/lib/ptp/port.c +++ b/subsys/net/lib/ptp/port.c @@ -38,7 +38,7 @@ BUILD_ASSERT(CONFIG_PTP_FOREIGN_TIME_TRANSMITTER_RECORD_SIZE >= 5 * CONFIG_PTP_N K_MEM_SLAB_DEFINE_STATIC(foreign_tts_slab, sizeof(struct ptp_foreign_tt_clock), CONFIG_PTP_FOREIGN_TIME_TRANSMITTER_RECORD_SIZE, - 4); + 8); #endif char str_port_id[] = "FF:FF:FF:FF:FF:FF:FF:FF-FFFF"; From 3a043ec1afdba8878e063f0e23e86298ee393f3b Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:00 +0300 Subject: [PATCH 1386/2141] Revert "[nrf fromlist] tests: drivers: nrf_clock_control: Test extended API" This reverts commit 2c7ce49379167eeb4a89d655f78cdf0cd7275262. Signed-off-by: Jukka Rissanen --- .../nrf_clock_control/src/main.c | 45 ++++--------------- 1 file changed, 8 insertions(+), 37 deletions(-) diff --git a/tests/drivers/clock_control/nrf_clock_control/src/main.c b/tests/drivers/clock_control/nrf_clock_control/src/main.c index 395e6a0fc000..8db19d382003 100644 --- a/tests/drivers/clock_control/nrf_clock_control/src/main.c +++ b/tests/drivers/clock_control/nrf_clock_control/src/main.c @@ -225,13 +225,10 @@ static void test_request_release_clock_spec(const struct device *clk_dev, static void test_clock_control_request(const struct test_clk_context *clk_contexts, size_t contexts_size) { - int ret; const struct test_clk_context *clk_context; size_t clk_specs_size; const struct device *clk_dev; - const struct nrf_clock_spec *req_spec; - struct nrf_clock_spec res_spec; - uint32_t startup_time_us; + const struct nrf_clock_spec *clk_spec; for (size_t i = 0; i < contexts_size; i++) { clk_context = &clk_contexts[i]; @@ -239,42 +236,16 @@ static void test_clock_control_request(const struct test_clk_context *clk_contex for (size_t u = 0; u < clk_specs_size; u++) { clk_dev = clk_context->clk_dev; - req_spec = &clk_context->clk_specs[u]; + clk_spec = &clk_context->clk_specs[u]; - zassert_true(device_is_ready(clk_dev), "%s is not ready", clk_dev->name); + zassert_true(device_is_ready(clk_dev), + "%s is not ready", clk_dev->name); - TC_PRINT("Requested clock (%s) spec: frequency %d, accuracy %d, precision " - "%d\n", - clk_dev->name, req_spec->frequency, req_spec->accuracy, - req_spec->precision); - - ret = nrf_clock_control_resolve(clk_dev, req_spec, &res_spec); - zassert(ret == 0 || ret == -ENOSYS, - "minimum clock specs could not be resolved"); - if (ret == 0) { - TC_PRINT("Resolved spec: frequency %d, accuracy %d, precision " - "%d\n", - res_spec.frequency, res_spec.accuracy, res_spec.precision); - } else if (ret == -ENOSYS) { - TC_PRINT("resolve not supported\n"); - res_spec.frequency = req_spec->frequency; - res_spec.accuracy = req_spec->accuracy; - res_spec.precision = req_spec->precision; - } - - ret = nrf_clock_control_get_startup_time(clk_dev, &res_spec, - &startup_time_us); - zassert(ret == 0 || ret == -ENOSYS, "failed to get startup time"); - if (ret == 0) { - TC_PRINT("startup time for resloved spec: %uus\n", startup_time_us); - } else if (ret == -ENOSYS) { - TC_PRINT("get startup time not supported\n"); - } - - TC_PRINT("Applying spec: frequency %d, accuracy %d, precision " + TC_PRINT("Applying clock (%s) spec: frequency %d, accuracy %d, precision " "%d\n", - res_spec.frequency, res_spec.accuracy, res_spec.precision); - test_request_release_clock_spec(clk_dev, &res_spec); + clk_dev->name, clk_spec->frequency, clk_spec->accuracy, + clk_spec->precision); + test_request_release_clock_spec(clk_dev, clk_spec); } } } From 1acdfd06207e532cbfca88f3f027035fccb9d341 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:00 +0300 Subject: [PATCH 1387/2141] Revert "[nrf fromtree] doc: migration-guide-4.2: Add note about bt_hci_cmd_create()" This reverts commit 4a63d05e821f80a547e4c3ae058dcc4545b23793. Signed-off-by: Jukka Rissanen --- doc/releases/migration-guide-4.2.rst | 4 ---- 1 file changed, 4 deletions(-) diff --git a/doc/releases/migration-guide-4.2.rst b/doc/releases/migration-guide-4.2.rst index 08a2a3d0e33d..faad669e379e 100644 --- a/doc/releases/migration-guide-4.2.rst +++ b/doc/releases/migration-guide-4.2.rst @@ -410,10 +410,6 @@ Bluetooth HCI have been deprecated, but are still usable, with the exception that they can only be called once per buffer. -* The :c:func:`bt_hci_cmd_create` function has been depracated and the new :c:func:`bt_hci_cmd_alloc` - function should be used instead. The new function takes no parameters because the command - sending functions have been updated to do the command header encoding. - Bluetooth Host ============== From 37c193d216cc47f20853b1c51b2a9cc1deba95b3 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:00 +0300 Subject: [PATCH 1388/2141] Revert "[nrf fromtree] Bluetooth: Host: Mark bt_hci_cmd_create() as deprecated" This reverts commit 08772c54d733713295930c4820ea0edf876b2160. Signed-off-by: Jukka Rissanen --- include/zephyr/bluetooth/hci.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/include/zephyr/bluetooth/hci.h b/include/zephyr/bluetooth/hci.h index cc0843fb7e39..dd9c60c8ae80 100644 --- a/include/zephyr/bluetooth/hci.h +++ b/include/zephyr/bluetooth/hci.h @@ -56,14 +56,12 @@ static inline const char *bt_hci_err_to_str(uint8_t hci_err) * of the parameters. Upon successful return the buffer is ready to have * the parameters encoded into it. * - * @deprecated Use bt_hci_cmd_alloc() instead. - * * @param opcode Command OpCode. * @param param_len Length of command parameters. * * @return Newly allocated buffer. */ -__deprecated struct net_buf *bt_hci_cmd_create(uint16_t opcode, uint8_t param_len); +struct net_buf *bt_hci_cmd_create(uint16_t opcode, uint8_t param_len); /** Allocate an HCI command buffer. * @@ -82,7 +80,7 @@ struct net_buf *bt_hci_cmd_alloc(k_timeout_t timeout); /** Send a HCI command asynchronously. * * This function is used for sending a HCI command asynchronously. It can - * either be called for a buffer created using bt_hci_cmd_alloc(), or + * either be called for a buffer created using bt_hci_cmd_create(), or * if the command has no parameters a NULL can be passed instead. The * sending of the command will happen asynchronously, i.e. upon successful * return from this function the caller only knows that it was queued @@ -101,7 +99,7 @@ int bt_hci_cmd_send(uint16_t opcode, struct net_buf *buf); /** Send a HCI command synchronously. * * This function is used for sending a HCI command synchronously. It can - * either be called for a buffer created using bt_hci_cmd_alloc(), or + * either be called for a buffer created using bt_hci_cmd_create(), or * if the command has no parameters a NULL can be passed instead. * * The function will block until a Command Status or a Command Complete From d7ba15e49e2e89313f0d51d902d0a83c05e7e70a Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:00 +0300 Subject: [PATCH 1389/2141] Revert "[nrf fromtree] Bluetooth: drivers: Use bt_hci_cmd_alloc()" This reverts commit 61b354b92c5a4f4d82e8190d89b4c0708df26f43. Signed-off-by: Jukka Rissanen --- drivers/bluetooth/hci/apollox_blue.c | 3 ++- drivers/bluetooth/hci/h4_ifx_cyw43xxx.c | 5 +++-- drivers/bluetooth/hci/hci_ifx_cyw208xx.c | 6 +++--- drivers/bluetooth/hci/hci_ifx_psoc6_bless.c | 2 +- drivers/bluetooth/hci/hci_nxp.c | 2 +- drivers/bluetooth/hci/hci_nxp_setup.c | 7 ++++--- drivers/bluetooth/hci/hci_spi_st.c | 2 +- drivers/bluetooth/hci/hci_stm32wba.c | 2 +- drivers/bluetooth/hci/ipm_stm32wb.c | 5 +++-- 9 files changed, 19 insertions(+), 15 deletions(-) diff --git a/drivers/bluetooth/hci/apollox_blue.c b/drivers/bluetooth/hci/apollox_blue.c index 9a4bf5440d87..1fb2ab33fb10 100644 --- a/drivers/bluetooth/hci/apollox_blue.c +++ b/drivers/bluetooth/hci/apollox_blue.c @@ -396,7 +396,8 @@ static int bt_apollo_set_nvds(void) #else uint8_t *p; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(HCI_VSC_UPDATE_NVDS_CFG_CMD_OPCODE, + HCI_VSC_UPDATE_NVDS_CFG_CMD_LENGTH); if (!buf) { return -ENOBUFS; } diff --git a/drivers/bluetooth/hci/h4_ifx_cyw43xxx.c b/drivers/bluetooth/hci/h4_ifx_cyw43xxx.c index e115ea92b47b..6bc563fb9f20 100644 --- a/drivers/bluetooth/hci/h4_ifx_cyw43xxx.c +++ b/drivers/bluetooth/hci/h4_ifx_cyw43xxx.c @@ -122,7 +122,8 @@ static int bt_update_controller_baudrate(const struct device *bt_uart_dev, uint3 /* Allocate buffer for update uart baudrate command. * It will be BT_HCI_OP_RESET with extra parameters. */ - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_VND_OP_UPDATE_BAUDRATE, + HCI_VSC_UPDATE_BAUD_RATE_LENGTH); if (buf == NULL) { LOG_ERR("Unable to allocate command buffer"); return -ENOMEM; @@ -171,7 +172,7 @@ static int bt_firmware_download(const uint8_t *firmware_image, uint32_t size) uint16_t op_code = *(uint16_t *)data; /* Allocate buffer for hci_write_ram/hci_launch_ram command. */ - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(op_code, data_length); if (buf == NULL) { LOG_ERR("Unable to allocate command buffer"); return err; diff --git a/drivers/bluetooth/hci/hci_ifx_cyw208xx.c b/drivers/bluetooth/hci/hci_ifx_cyw208xx.c index 913d19d514c1..1fee53436a6e 100644 --- a/drivers/bluetooth/hci/hci_ifx_cyw208xx.c +++ b/drivers/bluetooth/hci/hci_ifx_cyw208xx.c @@ -146,7 +146,7 @@ static int cyw208xx_bt_firmware_download(const uint8_t *firmware_image, uint32_t } /* Allocate buffer for hci_write_ram/hci_launch_ram command. */ - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(op_code, data_length); if (buf == NULL) { LOG_ERR("Unable to allocate command buffer"); return -ENOBUFS; @@ -211,7 +211,7 @@ static int cyw208xx_setup(const struct device *dev, const struct bt_hci_setup_pa cybt_platform_hci_wait_for_boot_fully_up(false); /* Set public address */ - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_VND_OP_SET_LOCAL_DEV_ADDR, BTM_SET_LOCAL_DEV_ADDR_LENGTH); if (buf == NULL) { LOG_ERR("Unable to allocate command buffer"); cyhal_syspm_unlock_deepsleep(); @@ -375,7 +375,7 @@ wiced_bt_dev_vendor_specific_command(uint16_t opcode, uint8_t param_len, uint8_t struct net_buf *buf = NULL; /* Allocate a HCI command buffer */ - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(opcode, param_len); if (!buf) { LOG_ERR("Unable to allocate buffer"); return WICED_NO_MEMORY; diff --git a/drivers/bluetooth/hci/hci_ifx_psoc6_bless.c b/drivers/bluetooth/hci/hci_ifx_psoc6_bless.c index 531a3439d911..db50091c8ae0 100644 --- a/drivers/bluetooth/hci/hci_ifx_psoc6_bless.c +++ b/drivers/bluetooth/hci/hci_ifx_psoc6_bless.c @@ -203,7 +203,7 @@ static int psoc6_bless_setup(const struct device *dev, const struct bt_hci_setup addr[5], addr[4], addr[3], addr[2], addr[1], addr[0], BT_ADDR_LE_PUBLIC, }; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(PSOC6_BLESS_OP_SET_PUBLIC_ADDR, sizeof(hci_data)); if (buf == NULL) { LOG_ERR("Unable to allocate command buffer"); return -ENOMEM; diff --git a/drivers/bluetooth/hci/hci_nxp.c b/drivers/bluetooth/hci/hci_nxp.c index a540e264ac0b..2cd5511e7c7d 100644 --- a/drivers/bluetooth/hci/hci_nxp.c +++ b/drivers/bluetooth/hci/hci_nxp.c @@ -94,7 +94,7 @@ static int nxp_bt_send_vs_command(uint16_t opcode, const uint8_t *params, uint8_ struct net_buf *buf; /* Allocate buffer for the hci command */ - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(opcode, params_len); if (buf == NULL) { LOG_ERR("Unable to allocate command buffer"); return -ENOMEM; diff --git a/drivers/bluetooth/hci/hci_nxp_setup.c b/drivers/bluetooth/hci/hci_nxp_setup.c index a89e1ede6778..a217ffc53bd4 100644 --- a/drivers/bluetooth/hci/hci_nxp_setup.c +++ b/drivers/bluetooth/hci/hci_nxp_setup.c @@ -1281,7 +1281,7 @@ static int bt_nxp_set_calibration_data_annex55(void) if (IS_ENABLED(CONFIG_BT_HCI_HOST)) { struct net_buf *buf; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(opcode, HCI_CMD_STORE_BT_CAL_DATA_PARAM_LENGTH); if (buf == NULL) { LOG_ERR("Unable to allocate command buffer"); return -ENOMEM; @@ -1346,7 +1346,7 @@ static int bt_nxp_set_calibration_data_annex100(void) if (IS_ENABLED(CONFIG_BT_HCI_HOST)) { struct net_buf *buf; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(opcode, HCI_CMD_STORE_BT_CAL_DATA_PARAM_ANNEX100_LENGTH); if (buf == NULL) { LOG_ERR("Unable to allocate command buffer"); return -ENOMEM; @@ -1387,7 +1387,8 @@ static int bt_hci_baudrate_update(const struct device *dev, uint32_t baudrate) int err; struct net_buf *buf; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_VSC_BAUDRATE_UPDATE_OPCODE, + BT_HCI_VSC_BAUDRATE_UPDATE_LENGTH); if (!buf) { LOG_ERR("Fail to allocate buffer"); return -ENOBUFS; diff --git a/drivers/bluetooth/hci/hci_spi_st.c b/drivers/bluetooth/hci/hci_spi_st.c index ebed8ae1ff49..e6201ec04758 100644 --- a/drivers/bluetooth/hci/hci_spi_st.c +++ b/drivers/bluetooth/hci/hci_spi_st.c @@ -335,7 +335,7 @@ static int bt_spi_send_aci_config(uint8_t offset, const uint8_t *value, size_t v hdr.param_len = data_len; buf = bt_buf_get_tx(BT_BUF_CMD, K_NO_WAIT, &hdr, sizeof(hdr)); #else - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BLUENRG_ACI_WRITE_CONFIG_DATA, data_len); #endif /* CONFIG_BT_HCI_RAW */ if (!buf) { diff --git a/drivers/bluetooth/hci/hci_stm32wba.c b/drivers/bluetooth/hci/hci_stm32wba.c index 57bc54c231ab..77654e16bea5 100644 --- a/drivers/bluetooth/hci/hci_stm32wba.c +++ b/drivers/bluetooth/hci/hci_stm32wba.c @@ -432,7 +432,7 @@ static int bt_hci_stm32wba_setup(const struct device *dev, return -ENOMSG; } - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(ACI_HAL_WRITE_CONFIG_DATA, sizeof(*param)); if (!buf) { return -ENOBUFS; } diff --git a/drivers/bluetooth/hci/ipm_stm32wb.c b/drivers/bluetooth/hci/ipm_stm32wb.c index 0f61f7c36f78..3e0dee023dcd 100644 --- a/drivers/bluetooth/hci/ipm_stm32wb.c +++ b/drivers/bluetooth/hci/ipm_stm32wb.c @@ -433,7 +433,8 @@ static int bt_ipm_set_addr(void) return -ENOMSG; } - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(ACI_HAL_WRITE_CONFIG_DATA, sizeof(*param)); + if (!buf) { return -ENOBUFS; } @@ -467,7 +468,7 @@ static int bt_ipm_ble_init(void) LOG_ERR("Can't set BLE UID addr"); } /* Send ACI_WRITE_SET_TX_POWER_LEVEL */ - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(ACI_WRITE_SET_TX_POWER_LEVEL, 3); if (!buf) { return -ENOBUFS; } From 47fe38e85c1f4f1a1ae7ed3449d46d8025642031 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:00 +0300 Subject: [PATCH 1390/2141] Revert "[nrf fromtree] drivers: bluetooth: add BT-CAL data load for NXP IW612/IW416 SoC" This reverts commit 5a3c2365ad0a6d399b26731b568cc2a1f898d87c. Signed-off-by: Jukka Rissanen --- drivers/bluetooth/hci/Kconfig.nxp | 8 +- drivers/bluetooth/hci/hci_nxp_setup.c | 216 +------------------------- 2 files changed, 7 insertions(+), 217 deletions(-) diff --git a/drivers/bluetooth/hci/Kconfig.nxp b/drivers/bluetooth/hci/Kconfig.nxp index 9fb0850fa8ed..1f6983ee9894 100644 --- a/drivers/bluetooth/hci/Kconfig.nxp +++ b/drivers/bluetooth/hci/Kconfig.nxp @@ -13,14 +13,14 @@ config HCI_NXP_ENABLE_AUTO_SLEEP message to the Controller as the Host will need to wake it up. config HCI_NXP_SET_CAL_DATA - bool "Bluetooth Controller calibration data" + bool "BLE Controller calibration data" help - If enabled, the Host will send calibration data to the Bluetooth Controller during HCI init. + If enabled, the Host will send calibration data to the BLE Controller during HCI init. config HCI_NXP_SET_CAL_DATA_ANNEX100 - bool "Bluetooth Controller calibration data annex 100" + bool "BLE Controller calibration data annex 100" help - If enabled, the Host will send calibration data annex 100 to the Bluetooth Controller during HCI + If enabled, the Host will send calibration data annex 100 to the BLE Controller during HCI init. config HCI_NXP_RX_THREAD diff --git a/drivers/bluetooth/hci/hci_nxp_setup.c b/drivers/bluetooth/hci/hci_nxp_setup.c index a217ffc53bd4..6fa34d0a24eb 100644 --- a/drivers/bluetooth/hci/hci_nxp_setup.c +++ b/drivers/bluetooth/hci/hci_nxp_setup.c @@ -29,25 +29,13 @@ LOG_MODULE_REGISTER(bt_nxp_ctlr); #define DT_DRV_COMPAT nxp_bt_hci_uart -#define FW_UPLOAD_CHANGE_TIMEOUT_RETRY_COUNT 6 -#define HCI_CMD_STORE_BT_CAL_DATA_ANNEX100_OCF 0xFF -#define HCI_CMD_STORE_BT_CAL_DATA_PARAM_ANNEX100_LENGTH 16 -#define HCI_CMD_STORE_BT_CAL_DATA_OCF 0x61 -#define HCI_CMD_STORE_BT_CAL_DATA_PARAM_LENGTH 32 +#define FW_UPLOAD_CHANGE_TIMEOUT_RETRY_COUNT 6 extern const unsigned char *bt_fw_bin; extern const unsigned int bt_fw_bin_len; static const struct device *uart_dev = DEVICE_DT_GET(DT_INST_GPARENT(0)); -#if !defined(CONFIG_HCI_NXP_SET_CAL_DATA) -#define bt_nxp_set_calibration_data_annex55() 0 -#endif - -#if !defined(CONFIG_HCI_NXP_SET_CAL_DATA_ANNEX100) -#define bt_nxp_set_calibration_data_annex100() 0 -#endif - #if DT_NODE_HAS_PROP(DT_DRV_INST(0), sdio_reset_gpios) struct gpio_dt_spec sdio_reset = GPIO_DT_SPEC_GET(DT_DRV_INST(0), sdio_reset_gpios); #endif /* DT_NODE_HAS_PROP(DT_DRV_INST(0), sdio_reset_gpios) */ @@ -1183,189 +1171,6 @@ static int bt_nxp_ctlr_init(void) return 0; } -#if defined(CONFIG_HCI_NXP_SET_CAL_DATA) - -static int bt_nxp_set_calibration_data_annex55(void) -{ - int ret = 0; - uint16_t opcode = BT_OP(BT_OGF_VS, HCI_CMD_STORE_BT_CAL_DATA_OCF); - - const uint8_t hci_cal_data_annex55[HCI_CMD_STORE_BT_CAL_DATA_PARAM_LENGTH] = { -#if defined(CONFIG_BT_NXP_NW612) - 0x00, /* Sequence Number : 0x00 */ - 0x01, /* Action : 0x01 */ - 0x01, /* Type : Not use CheckSum */ - 0x1C, /* File Length : 0x1C */ - 0x37, /* BT Annex Type : BT CFG */ - 0x33, /* Checksum : 0x71 */ - 0x1C, /* Annex Length LSB: 0x001C */ - 0x00, /* Annex Length MSB: 0x001C */ - 0x00, /* Pointer For Next Annex[0] : 0x00000000 */ - 0x00, /* Pointer For Next Annex[1] : 0x00000000 */ - 0x00, /* Pointer For Next Annex[2] : 0x00000000 */ - 0x00, /* Pointer For Next Annex[3] : 0x00000000 */ - 0x01, /* Annex Version : 0x01 */ - 0x81, /* External Xtal Calibration Value : 0x7d */ - 0x0D, /* Initial TX Power : 13 */ - 0x07, /* Front End Loss : 0x07 */ - 0x28, /* BT Options : */ - /* BIT[0] Force Class 2 operation = 0 */ - /* BIT[1] Disable Pwr-ctrl for class 2=0 */ - /* BIT[2] MiscFlg(to indicate ext.XTAL)=0 */ - /* BIT[3] Used Internal Sleep Clock = 1 */ - /* BIT[4] BT AOA location support = 0 */ - /* BIT[5] Force Class 1 mode = 1 */ - /* BIT[7:6] Reserved */ - 0x00, /* AOANumberOfAntennas: 0x00 */ - 0x00, /* RSSI Golden Low : 0 */ - 0x00, /* RSSI Golden High : 0 */ - 0xC0, /* UART Baud Rate[0] : 0x002DC6C0(3000000) */ - 0xC6, /* UART Baud Rate[1] : 0x002DC6C0(3000000) */ - 0x2D, /* UART Baud Rate[2] : 0x002DC6C0(3000000) */ - 0x00, /* UART Baud Rate[3] : 0x002DC6C0(3000000) */ - 0x00, /* BdAddress[0] : 0x000000000000 */ - 0x00, /* BdAddress[1] : 0x000000000000 */ - 0x00, /* BdAddress[2] : 0x000000000000 */ - 0x00, /* BdAddress[3] : 0x000000000000 */ - 0x00, /* BdAddress[4] : 0x000000000000 */ - 0x00, /* BdAddress[5] : 0x000000000000 */ - 0xF0, /* Encr_Key_Len[3:0]: MinEncrKeyLen = 0x0 */ - /* ExEncrKeyLen = 0xF */ - 0x00, /* RegionCode : 0x00 */ -#elif defined(CONFIG_BT_NXP_IW416) - 0x00, /* Sequence Number : 0x00 */ - 0x01, /* Action : 0x01 */ - 0x01, /* Type : Not use CheckSum */ - 0x1C, /* File Length : 0x1C */ - 0x37, /* BT Annex Type : BT CFG */ - 0x33, /* Checksum : 0x71 */ - 0x1C, /* Annex Length LSB: 0x001C */ - 0x00, /* Annex Length MSB: 0x001C */ - 0x00, /* Pointer For Next Annex[0] : 0x00000000 */ - 0x00, /* Pointer For Next Annex[1] : 0x00000000 */ - 0x00, /* Pointer For Next Annex[2] : 0x00000000 */ - 0x00, /* Pointer For Next Annex[3] : 0x00000000 */ - 0x01, /* Annex Version : 0x01 */ - 0x00, /* External Xtal Calibration Value */ - 0x03, /* Initial TX Power : 0x03 */ - 0x03, /* Front End Loss : 0x03 */ - 0x00, /* BT Options : */ - /* BIT[0] Force Class 2 operation = 0 */ - /* BIT[1] Disable Pwr Ctrl for class 2=0 */ - /* BIT[2] MiscFlg(to indicate ext.XTAL)=0 */ - /* BIT[3] Used Internal Sleep Clock = 0 */ - /* BIT[4] BT AOA localtion support = 0 */ - /* BIT[5] Force Class 1 mode = 0 */ - /* BIT[7:6] Reserved */ - 0x00, /* AOANumberOfAntennas: 0x00 */ - 0xBA, /* RSSI Golden Low : 0 */ - 0xCE, /* RSSI Golden High : 0 */ - 0xC0, /* UART Baud Rate[0] : 0x002DC6C0(3000000) */ - 0xC6, /* UART Baud Rate[1] : 0x002DC6C0(3000000) */ - 0x2D, /* UART Baud Rate[2] : 0x002DC6C0(3000000) */ - 0x00, /* UART Baud Rate[3] : 0x002DC6C0(3000000) */ - 0x00, /* BdAddress[0] : 0x000000000000 */ - 0x00, /* BdAddress[1] : 0x000000000000 */ - 0x00, /* BdAddress[2] : 0x000000000000 */ - 0x00, /* BdAddress[3] : 0x000000000000 */ - 0x00, /* BdAddress[4] : 0x000000000000 */ - 0x00, /* BdAddress[5] : 0x000000000000 */ - 0xF0, /* Encr_Key_Len[3:0]: MinEncrKeyLen = 0x0 */ - /* ExEncrKeyLen = 0xF */ - 0x00, /* RegionCode : 0x00 */ -#else -#error "BT Calibration data (annex-55) is not given for selected chipset" -#endif - }; - - if (IS_ENABLED(CONFIG_BT_HCI_HOST)) { - struct net_buf *buf; - - buf = bt_hci_cmd_create(opcode, HCI_CMD_STORE_BT_CAL_DATA_PARAM_LENGTH); - if (buf == NULL) { - LOG_ERR("Unable to allocate command buffer"); - return -ENOMEM; - } - - net_buf_add_mem(buf, hci_cal_data_annex55, HCI_CMD_STORE_BT_CAL_DATA_PARAM_LENGTH); - - ret = bt_hci_cmd_send_sync(opcode, buf, NULL); - if (ret) { - LOG_ERR("Failed to send set-calibration cmd (err %d)", ret); - return ret; - } - - (void)k_msleep(CONFIG_BT_H4_NXP_CTLR_WAIT_TIME_AFTER_BAUDRATE_UPDATE); - } - - return ret; -} -#endif /*CONFIG_HCI_NXP_SET_CAL_DATA*/ - -#if defined(CONFIG_HCI_NXP_SET_CAL_DATA_ANNEX100) - -static int bt_nxp_set_calibration_data_annex100(void) -{ - int ret = 0; - const uint8_t hci_cal_data_annex100[HCI_CMD_STORE_BT_CAL_DATA_PARAM_ANNEX100_LENGTH] = { -#if defined(CONFIG_BT_NXP_NW612) - 0x64, /* Annex Type : 0x64 */ - 0x83, /* Checksum */ - 0x10, 0x00, /* Length */ - 0x00, 0x00, 0x00, 0x00, /* Pointer for next Annex-Structure */ - 0x01, /* Ext PA Present (1 bit) + */ - /* Ext. PA Gain (7 bits) */ - 0x00, /* Ext Antenna Gain(1 bit) + */ - /* Ext. Antenna Gain Val(4 bits) */ - 0x04, 0x00, /* BT / LE Ext PA FEM CTRL Bitmask */ - 0x01, /* Ext LNA Present (1 bit) + */ - /* Ext LNA Gain (7 bits) */ - 0x00, /* Reserved */ - 0x04, 0x00 /* BT / LE Ext LNA FEM CTRL Bitmask */ -#elif defined(CONFIG_BT_NXP_IW416) - 0x64, /* Annex Type : 0x64 */ - 0x83, /* Checksum */ - 0x10, 0x00, /* Length */ - 0x00, 0x00, 0x00, 0x00, /* Pointer for next Annex-Structure */ - 0x01, /* Ext PA Present (1 bit) + */ - /* Ext. PA Gain (7 bits) */ - 0x00, /* Ext Antenna Gain(1 bit) + */ - /* Ext. Antenna Gain Val (4 bits) */ - 0x0C, 0x00, /* BT / LE Ext PA FEM CTRL Bitmask */ - 0x01, /* Ext LNA Present (1 bit) + */ - /* Ext LNA Gain (7 bits) */ - 0x00, /* Reserved */ - 0x0C, 0x00 /* BT/LE Ext LNA FEM CTRL Bitmask */ -#else -#error "BT Calibration data (annex-100) is not given for selected chipset" -#endif - }; - - uint16_t opcode = BT_OP(BT_OGF_VS, HCI_CMD_STORE_BT_CAL_DATA_ANNEX100_OCF); - - if (IS_ENABLED(CONFIG_BT_HCI_HOST)) { - struct net_buf *buf; - - buf = bt_hci_cmd_create(opcode, HCI_CMD_STORE_BT_CAL_DATA_PARAM_ANNEX100_LENGTH); - if (buf == NULL) { - LOG_ERR("Unable to allocate command buffer"); - return -ENOMEM; - } - - net_buf_add_mem(buf, hci_cal_data_annex100, - HCI_CMD_STORE_BT_CAL_DATA_PARAM_ANNEX100_LENGTH); - - ret = bt_hci_cmd_send_sync(opcode, buf, NULL); - if (ret) { - LOG_ERR("Failed to send set-calibration cmd (err %d)", ret); - return ret; - } - } - - return ret; -} -#endif /* defined(CONFIG_HCI_NXP_SET_CAL_DATA_ANNEX100) */ - int bt_hci_transport_setup(const struct device *dev) { int ret = 0; @@ -1426,7 +1231,6 @@ int bt_h4_vnd_setup(const struct device *dev) flowcontrol_of_hci = (bool)DT_PROP_OR(DT_DRV_INST(0), hw_flow_control, false); if (operation_speed == default_speed) { - fw_upload.is_setup_done = true; return 0; } @@ -1436,7 +1240,7 @@ int bt_h4_vnd_setup(const struct device *dev) return err; } - /* BT waiting time after controller bandrate updated */ + /* BT waiting time after controller bandrate updated */ (void)k_msleep(CONFIG_BT_H4_NXP_CTLR_WAIT_TIME_AFTER_BAUDRATE_UPDATE); } @@ -1446,21 +1250,7 @@ int bt_h4_vnd_setup(const struct device *dev) return err; } - if (!fw_upload.is_setup_done) { - err = bt_nxp_set_calibration_data_annex55(); - if (err) { - LOG_ERR("Fail to load annex-55 calibration data"); - return err; - } - - err = bt_nxp_set_calibration_data_annex100(); - if (err) { - LOG_ERR("Fail to load annex-100 calibration data"); - return err; - } - - fw_upload.is_setup_done = true; - } + fw_upload.is_setup_done = true; return 0; } From b51623a3c147f1527b21650ac44fcfe304b511cc Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:00 +0300 Subject: [PATCH 1391/2141] Revert "[nrf fromlist] settings: Only use mutexes when multithreading is enabled" This reverts commit 96414e4802cb3d4ae08dd497ced5956a1510a502. Signed-off-by: Jukka Rissanen --- subsys/settings/src/settings.c | 23 ++++------------------- subsys/settings/src/settings_init.c | 7 ++++--- subsys/settings/src/settings_priv.h | 6 ------ subsys/settings/src/settings_store.c | 21 +++++++++++---------- 4 files changed, 19 insertions(+), 38 deletions(-) diff --git a/subsys/settings/src/settings.c b/subsys/settings/src/settings.c index 74f97bc79e54..dde6135a4119 100644 --- a/subsys/settings/src/settings.c +++ b/subsys/settings/src/settings.c @@ -23,9 +23,8 @@ LOG_MODULE_REGISTER(settings, CONFIG_SETTINGS_LOG_LEVEL); sys_slist_t settings_handlers; #endif /* CONFIG_SETTINGS_DYNAMIC_HANDLERS */ -#ifdef CONFIG_MULTITHREADING -static K_MUTEX_DEFINE(settings_lock); -#endif +K_MUTEX_DEFINE(settings_lock); + void settings_store_init(void); @@ -48,7 +47,7 @@ int settings_register_with_cprio(struct settings_handler *handler, int cprio) } } - settings_lock_take(); + k_mutex_lock(&settings_lock, K_FOREVER); struct settings_handler *ch; SYS_SLIST_FOR_EACH_CONTAINER(&settings_handlers, ch, node) { @@ -62,7 +61,7 @@ int settings_register_with_cprio(struct settings_handler *handler, int cprio) sys_slist_append(&settings_handlers, &handler->node); end: - settings_lock_release(); + k_mutex_unlock(&settings_lock); return rc; } @@ -320,17 +319,3 @@ int settings_commit_subtree(const char *subtree) return rc; } - -void settings_lock_take(void) -{ -#ifdef CONFIG_MULTITHREADING - k_mutex_lock(&settings_lock, K_FOREVER); -#endif -} - -void settings_lock_release(void) -{ -#ifdef CONFIG_MULTITHREADING - k_mutex_unlock(&settings_lock); -#endif -} diff --git a/subsys/settings/src/settings_init.c b/subsys/settings/src/settings_init.c index a77152d712f6..7a478c8707b9 100644 --- a/subsys/settings/src/settings_init.c +++ b/subsys/settings/src/settings_init.c @@ -14,7 +14,8 @@ #include #include "settings/settings_file.h" #include -#include "settings_priv.h" + +extern struct k_mutex settings_lock; bool settings_subsys_initialized; @@ -27,7 +28,7 @@ int settings_subsys_init(void) int err = 0; - settings_lock_take(); + k_mutex_lock(&settings_lock, K_FOREVER); if (!settings_subsys_initialized) { settings_init(); @@ -39,7 +40,7 @@ int settings_subsys_init(void) } } - settings_lock_release(); + k_mutex_unlock(&settings_lock); return err; } diff --git a/subsys/settings/src/settings_priv.h b/subsys/settings/src/settings_priv.h index 93b47b9b789e..b732bcef2d8b 100644 --- a/subsys/settings/src/settings_priv.h +++ b/subsys/settings/src/settings_priv.h @@ -111,12 +111,6 @@ extern sys_slist_t settings_load_srcs; extern sys_slist_t settings_handlers; extern struct settings_store *settings_save_dst; -/** Takes the settings mutex lock (if multithreading is enabled) */ -void settings_lock_take(void); - -/** Releases the settings mutex lock (if multithreading is enabled) */ -void settings_lock_release(void); - #ifdef __cplusplus } #endif diff --git a/subsys/settings/src/settings_store.c b/subsys/settings/src/settings_store.c index cb5b8a0e5bd1..4dcdb80b78f2 100644 --- a/subsys/settings/src/settings_store.c +++ b/subsys/settings/src/settings_store.c @@ -22,6 +22,7 @@ LOG_MODULE_DECLARE(settings, CONFIG_SETTINGS_LOG_LEVEL); sys_slist_t settings_load_srcs; struct settings_store *settings_save_dst; +extern struct k_mutex settings_lock; void settings_src_register(struct settings_store *cs) { @@ -52,12 +53,12 @@ int settings_load_subtree(const char *subtree) * apply config * commit all */ - settings_lock_take(); + k_mutex_lock(&settings_lock, K_FOREVER); SYS_SLIST_FOR_EACH_CONTAINER(&settings_load_srcs, cs, cs_next) { cs->cs_itf->csi_load(cs, &arg); } rc = settings_commit_subtree(subtree); - settings_lock_release(); + k_mutex_unlock(&settings_lock); return rc; } @@ -79,11 +80,11 @@ int settings_load_subtree_direct( * apply config * commit all */ - settings_lock_take(); + k_mutex_lock(&settings_lock, K_FOREVER); SYS_SLIST_FOR_EACH_CONTAINER(&settings_load_srcs, cs, cs_next) { cs->cs_itf->csi_load(cs, &arg); } - settings_lock_release(); + k_mutex_unlock(&settings_lock); return 0; } @@ -143,7 +144,7 @@ ssize_t settings_get_val_len(const char *name) * for every config store that supports this function * get the value's length. */ - settings_lock_take(); + k_mutex_lock(&settings_lock, K_FOREVER); SYS_SLIST_FOR_EACH_CONTAINER(&settings_load_srcs, cs, cs_next) { if (cs->cs_itf->csi_get_val_len) { val_len = cs->cs_itf->csi_get_val_len(cs, name); @@ -156,7 +157,7 @@ ssize_t settings_get_val_len(const char *name) rc = cs->cs_itf->csi_load(cs, &arg); } } - settings_lock_release(); + k_mutex_unlock(&settings_lock); if (rc >= 0) { return val_len; @@ -176,7 +177,7 @@ ssize_t settings_load_one(const char *name, void *buf, size_t buf_len) * For every config store that defines csi_load_one() function use it. * Otherwise, use the csi_load() function to load the key/value pair */ - settings_lock_take(); + k_mutex_lock(&settings_lock, K_FOREVER); SYS_SLIST_FOR_EACH_CONTAINER(&settings_load_srcs, cs, cs_next) { if (cs->cs_itf->csi_load_one) { rc = cs->cs_itf->csi_load_one(cs, name, (char *)buf, buf_len); @@ -195,7 +196,7 @@ ssize_t settings_load_one(const char *name, void *buf, size_t buf_len) rc = cs->cs_itf->csi_load(cs, &arg); } } - settings_lock_release(); + k_mutex_unlock(&settings_lock); if (rc >= 0) { return val_len; @@ -216,11 +217,11 @@ int settings_save_one(const char *name, const void *value, size_t val_len) return -ENOENT; } - settings_lock_take(); + k_mutex_lock(&settings_lock, K_FOREVER); rc = cs->cs_itf->csi_save(cs, name, (char *)value, val_len); - settings_lock_release(); + k_mutex_unlock(&settings_lock); return rc; } From 9c6c04f6645d13f9a1d17aaa5dda3ab91cd05462 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:01 +0300 Subject: [PATCH 1392/2141] Revert "[nrf fromlist] tests: drivers: spi: Add test cases for non standard frequencies." This reverts commit db1ed59e7a9498328e6fdd8d4aea2c846cc3d544. Signed-off-by: Jukka Rissanen --- .../boards/1m333333hz.overlay | 9 --------- .../boards/2m666666hz.overlay | 9 --------- .../spi/spi_controller_peripheral/testcase.yaml | 16 ---------------- 3 files changed, 34 deletions(-) delete mode 100644 tests/drivers/spi/spi_controller_peripheral/boards/1m333333hz.overlay delete mode 100644 tests/drivers/spi/spi_controller_peripheral/boards/2m666666hz.overlay diff --git a/tests/drivers/spi/spi_controller_peripheral/boards/1m333333hz.overlay b/tests/drivers/spi/spi_controller_peripheral/boards/1m333333hz.overlay deleted file mode 100644 index 5a35648b7527..000000000000 --- a/tests/drivers/spi/spi_controller_peripheral/boards/1m333333hz.overlay +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&dut_spi_dt { - spi-max-frequency = <1333333>; -}; diff --git a/tests/drivers/spi/spi_controller_peripheral/boards/2m666666hz.overlay b/tests/drivers/spi/spi_controller_peripheral/boards/2m666666hz.overlay deleted file mode 100644 index 642a3e18e952..000000000000 --- a/tests/drivers/spi/spi_controller_peripheral/boards/2m666666hz.overlay +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&dut_spi_dt { - spi-max-frequency = <2666666>; -}; diff --git a/tests/drivers/spi/spi_controller_peripheral/testcase.yaml b/tests/drivers/spi/spi_controller_peripheral/testcase.yaml index cfcf7c149f00..56f3545235e7 100644 --- a/tests/drivers/spi/spi_controller_peripheral/testcase.yaml +++ b/tests/drivers/spi/spi_controller_peripheral/testcase.yaml @@ -45,22 +45,6 @@ tests: integration_platforms: - nrf52840dk/nrf52840 - drivers.spi.spi_1M333333Hz: - extra_configs: - - CONFIG_TESTED_SPI_MODE=0 - extra_args: EXTRA_DTC_OVERLAY_FILE="boards/1m333333hz.overlay" - integration_platforms: - - nrf54l15dk/nrf54l15/cpuapp - - nrf54h20dk/nrf54h20/cpuapp - - drivers.spi.spi_2M666666Hz: - extra_configs: - - CONFIG_TESTED_SPI_MODE=0 - extra_args: EXTRA_DTC_OVERLAY_FILE="boards/2m666666hz.overlay" - integration_platforms: - - nrf54l15dk/nrf54l15/cpuapp - - nrf54h20dk/nrf54h20/cpuapp - drivers.spi.spi_4MHz: extra_configs: - CONFIG_TESTED_SPI_MODE=2 From e8e67be15e77371a122e35157b8fe50220988b01 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:01 +0300 Subject: [PATCH 1393/2141] Revert "[nrf fromlist] drivers: spi: nrfx_spim: Add support for non standard frequencies" This reverts commit a75db6afe2b83976f8baa9a6eaa67fb810ac7403. Signed-off-by: Jukka Rissanen --- drivers/spi/spi_nrfx_spim.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/spi/spi_nrfx_spim.c b/drivers/spi/spi_nrfx_spim.c index 0646c67b4a33..a5c4e30f190e 100644 --- a/drivers/spi/spi_nrfx_spim.c +++ b/drivers/spi/spi_nrfx_spim.c @@ -170,14 +170,11 @@ static inline void finalize_spi_transaction(const struct device *dev, bool deact static inline uint32_t get_nrf_spim_frequency(uint32_t frequency) { - if (NRF_SPIM_HAS_PRESCALER) { - return frequency; - } /* Get the highest supported frequency not exceeding the requested one. */ - if (frequency >= MHZ(32) && NRF_SPIM_HAS_32_MHZ_FREQ) { + if (frequency >= MHZ(32) && (NRF_SPIM_HAS_32_MHZ_FREQ || NRF_SPIM_HAS_PRESCALER)) { return MHZ(32); - } else if (frequency >= MHZ(16) && NRF_SPIM_HAS_16_MHZ_FREQ) { + } else if (frequency >= MHZ(16) && (NRF_SPIM_HAS_16_MHZ_FREQ || NRF_SPIM_HAS_PRESCALER)) { return MHZ(16); } else if (frequency >= MHZ(8)) { return MHZ(8); From d10a5a12d75e9d179a7e0ab5d3d425869af01dad Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:01 +0300 Subject: [PATCH 1394/2141] Revert "[nrf fromlist] drivers: udc_dwc2: Arm control out endpoint in DMA mode" This reverts commit dc8356f2f7a1f2e7fcfd1018154a3dff9030e79d. Signed-off-by: Jukka Rissanen --- drivers/usb/udc/udc_dwc2.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/usb/udc/udc_dwc2.c b/drivers/usb/udc/udc_dwc2.c index fca8f607ec74..8995ce295e28 100644 --- a/drivers/usb/udc/udc_dwc2.c +++ b/drivers/usb/udc/udc_dwc2.c @@ -1753,10 +1753,7 @@ static int udc_dwc2_ep_set_halt(const struct device *dev, if (ep_idx != 0) { cfg->stat.halted = true; } else { - struct udc_dwc2_data *const priv = udc_get_private(dev); - /* Data/Status stage is STALLed, allow receiving next SETUP */ - priv->pending_dout_feed = 0; dwc2_ensure_setup_ready(dev); } @@ -3323,8 +3320,6 @@ static ALWAYS_INLINE void dwc2_thread_handler(void *const arg) if (evt & BIT(DWC2_DRV_EVT_ENUM_DONE)) { k_event_clear(&priv->drv_evt, BIT(DWC2_DRV_EVT_ENUM_DONE)); - /* Any potential transfer on control IN endpoint is cancelled */ - priv->pending_dout_feed = 0; dwc2_ensure_setup_ready(dev); } From cbde63bf20cacaacbdf98149956cabba9ba45b87 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:01 +0300 Subject: [PATCH 1395/2141] Revert "[nrf fromlist] drivers: udc_dwc2: Add nRF54LM20A vendor quirks" This reverts commit e2d2d6ff7435c4f76826c0d11faea6b028f5bf8b. Signed-off-by: Jukka Rissanen --- drivers/usb/udc/udc_dwc2_vendor_quirks.h | 198 ----------------------- 1 file changed, 198 deletions(-) diff --git a/drivers/usb/udc/udc_dwc2_vendor_quirks.h b/drivers/usb/udc/udc_dwc2_vendor_quirks.h index 330ff8d113f1..f5a70063c2e2 100644 --- a/drivers/usb/udc/udc_dwc2_vendor_quirks.h +++ b/drivers/usb/udc/udc_dwc2_vendor_quirks.h @@ -312,204 +312,6 @@ DT_INST_FOREACH_STATUS_OKAY(QUIRK_NRF_USBHS_DEFINE) #endif /*DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_usbhs) */ -#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_usbhs_nrf54l) - -#define USBHS_DT_WRAPPER_REG_ADDR(n) UINT_TO_POINTER(DT_INST_REG_ADDR_BY_NAME(n, wrapper)) - -#include -#include -#include -#include - -#define NRF_DEFAULT_IRQ_PRIORITY 1 - -/* - * On USBHS, we cannot access the DWC2 register until VBUS is detected and - * valid. If the user tries to force usbd_enable() and the corresponding - * udc_enable() without a "VBUS ready" notification, the event wait will block - * until a valid VBUS signal is detected or until the - * CONFIG_UDC_DWC2_USBHS_VBUS_READY_TIMEOUT timeout expires. - */ -static K_EVENT_DEFINE(usbhs_events); -#define USBHS_VBUS_READY BIT(0) - -static struct onoff_manager *pclk24m_mgr; -static struct onoff_client pclk24m_cli; - -static void vregusb_isr(const void *arg) -{ - const struct device *dev = arg; - - if (NRF_VREGUSB->EVENTS_VBUSDETECTED) { - NRF_VREGUSB->EVENTS_VBUSDETECTED = 0; - k_event_post(&usbhs_events, USBHS_VBUS_READY); - udc_submit_event(dev, UDC_EVT_VBUS_READY, 0); - } - - if (NRF_VREGUSB->EVENTS_VBUSREMOVED) { - NRF_VREGUSB->EVENTS_VBUSREMOVED = 0; - k_event_set_masked(&usbhs_events, 0, USBHS_VBUS_READY); - udc_submit_event(dev, UDC_EVT_VBUS_REMOVED, 0); - } -} - -static inline int usbhs_init_vreg_and_clock(const struct device *dev) -{ - IRQ_CONNECT(VREGUSB_IRQn, NRF_DEFAULT_IRQ_PRIORITY, - vregusb_isr, DEVICE_DT_INST_GET(0), 0); - - NRF_VREGUSB->INTEN = VREGUSB_INTEN_VBUSDETECTED_Msk | - VREGUSB_INTEN_VBUSREMOVED_Msk; - NRF_VREGUSB->TASKS_START = 1; - - /* TODO: Determine conditions when VBUSDETECTED is not generated */ - if (sys_read32((mem_addr_t)NRF_VREGUSB + 0x400) & BIT(2)) { - k_event_post(&usbhs_events, USBHS_VBUS_READY); - udc_submit_event(dev, UDC_EVT_VBUS_READY, 0); - } - - irq_enable(VREGUSB_IRQn); - pclk24m_mgr = z_nrf_clock_control_get_onoff(CLOCK_CONTROL_NRF_SUBSYS_HF24M); - - return 0; -} - -static inline int usbhs_enable_core(const struct device *dev) -{ - LOG_MODULE_DECLARE(udc_dwc2, CONFIG_UDC_DRIVER_LOG_LEVEL); - NRF_USBHS_Type *wrapper = USBHS_DT_WRAPPER_REG_ADDR(0); - k_timeout_t timeout = K_FOREVER; - int err; - - if (!k_event_wait(&usbhs_events, USBHS_VBUS_READY, false, K_NO_WAIT)) { - LOG_WRN("VBUS is not ready, block udc_enable()"); - if (!k_event_wait(&usbhs_events, USBHS_VBUS_READY, false, timeout)) { - return -ETIMEDOUT; - } - } - - /* Request PCLK24M using clock control driver */ - sys_notify_init_spinwait(&pclk24m_cli.notify); - err = onoff_request(pclk24m_mgr, &pclk24m_cli); - if (err < 0) { - LOG_ERR("Failed to start PCLK24M %d", err); - return err; - } - - /* Power up peripheral */ - wrapper->ENABLE = USBHS_ENABLE_CORE_Msk; - - /* Set ID to Device and force D+ pull-up off for now */ - wrapper->PHY.OVERRIDEVALUES = (1 << 31); - wrapper->PHY.INPUTOVERRIDE = (1 << 31) | USBHS_PHY_INPUTOVERRIDE_VBUSVALID_Msk; - - /* Release PHY power-on reset */ - wrapper->ENABLE = USBHS_ENABLE_PHY_Msk | USBHS_ENABLE_CORE_Msk; - - /* Wait for PHY clock to start */ - k_busy_wait(45); - - /* Release DWC2 reset */ - wrapper->TASKS_START = 1UL; - - /* Wait for clock to start to avoid hang on too early register read */ - k_busy_wait(1); - - /* DWC2 opmode is now guaranteed to be Non-Driving, allow D+ pull-up to - * become active once driver clears DCTL SftDiscon bit. - */ - wrapper->PHY.INPUTOVERRIDE = (1 << 31); - - return 0; -} - -static inline int usbhs_disable_core(const struct device *dev) -{ - LOG_MODULE_DECLARE(udc_dwc2, CONFIG_UDC_DRIVER_LOG_LEVEL); - NRF_USBHS_Type *wrapper = USBHS_DT_WRAPPER_REG_ADDR(0); - int err; - - /* Set ID to Device and forcefully disable D+ pull-up */ - wrapper->PHY.OVERRIDEVALUES = (1 << 31); - wrapper->PHY.INPUTOVERRIDE = (1 << 31) | USBHS_PHY_INPUTOVERRIDE_VBUSVALID_Msk; - - wrapper->ENABLE = 0UL; - - /* Release PCLK24M using clock control driver */ - err = onoff_cancel_or_release(pclk24m_mgr, &pclk24m_cli); - if (err < 0) { - LOG_ERR("Failed to stop PCLK24M %d", err); - return err; - } - - return 0; -} - -static inline int usbhs_disable_vreg(const struct device *dev) -{ - NRF_VREGUSB->INTEN = 0; - NRF_VREGUSB->TASKS_STOP = 1; - - return 0; -} - -static inline int usbhs_init_caps(const struct device *dev) -{ - struct udc_data *data = dev->data; - - data->caps.can_detect_vbus = true; - data->caps.hs = true; - - return 0; -} - -static inline int usbhs_is_phy_clk_off(const struct device *dev) -{ - return !k_event_test(&usbhs_events, USBHS_VBUS_READY); -} - -static inline int usbhs_post_hibernation_entry(const struct device *dev) -{ - const struct udc_dwc2_config *const config = dev->config; - struct usb_dwc2_reg *const base = config->base; - NRF_USBHS_Type *wrapper = USBHS_DT_WRAPPER_REG_ADDR(0); - - sys_set_bits((mem_addr_t)&base->pcgcctl, USB_DWC2_PCGCCTL_GATEHCLK); - - wrapper->TASKS_STOP = 1; - - return 0; -} - -static inline int usbhs_pre_hibernation_exit(const struct device *dev) -{ - const struct udc_dwc2_config *const config = dev->config; - struct usb_dwc2_reg *const base = config->base; - NRF_USBHS_Type *wrapper = USBHS_DT_WRAPPER_REG_ADDR(0); - - sys_clear_bits((mem_addr_t)&base->pcgcctl, USB_DWC2_PCGCCTL_GATEHCLK); - - wrapper->TASKS_START = 1; - - return 0; -} - -#define QUIRK_NRF_USBHS_DEFINE(n) \ - struct dwc2_vendor_quirks dwc2_vendor_quirks_##n = { \ - .init = usbhs_init_vreg_and_clock, \ - .pre_enable = usbhs_enable_core, \ - .disable = usbhs_disable_core, \ - .shutdown = usbhs_disable_vreg, \ - .caps = usbhs_init_caps, \ - .is_phy_clk_off = usbhs_is_phy_clk_off, \ - .post_hibernation_entry = usbhs_post_hibernation_entry, \ - .pre_hibernation_exit = usbhs_pre_hibernation_exit, \ - }; - -DT_INST_FOREACH_STATUS_OKAY(QUIRK_NRF_USBHS_DEFINE) - -#endif /*DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_usbhs_nrf54l) */ - /* Add next vendor quirks definition above this line */ #endif /* ZEPHYR_DRIVERS_USB_UDC_DWC2_VENDOR_QUIRKS_H */ From d4fda9af1b3935ea31e080f395c52b4e3a6c9a66 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:01 +0300 Subject: [PATCH 1396/2141] Revert "[nrf fromtree] drivers: udc_dwc2: Set EP0 IN CNAK only when necessary" This reverts commit a536263ad8e0b09ad1c11d9cdba10a17d4f31a71. Signed-off-by: Jukka Rissanen --- drivers/usb/udc/udc_dwc2.c | 72 ++++---------------------------------- 1 file changed, 6 insertions(+), 66 deletions(-) diff --git a/drivers/usb/udc/udc_dwc2.c b/drivers/usb/udc/udc_dwc2.c index 8995ce295e28..5a47a23294c8 100644 --- a/drivers/usb/udc/udc_dwc2.c +++ b/drivers/usb/udc/udc_dwc2.c @@ -139,7 +139,6 @@ struct udc_dwc2_data { unsigned int hibernated : 1; unsigned int enumdone : 1; unsigned int enumspd : 2; - unsigned int pending_dout_feed : 1; enum dwc2_suspend_type suspend_type; /* Number of endpoints including control endpoint */ uint8_t numdeveps; @@ -429,28 +428,10 @@ static void dwc2_ensure_setup_ready(const struct device *dev) if (dwc2_in_completer_mode(dev)) { /* In Completer mode EP0 can always receive SETUP data */ return; - } else { - struct udc_dwc2_data *const priv = udc_get_private(dev); - - /* Enable EP0 OUT only if there is no pending EP0 IN transfer - * after which the stack has to enable EP0 OUT. - */ - if (!priv->pending_dout_feed) { - dwc2_ctrl_feed_dout(dev, 8); - } } -} -static void dwc2_clear_control_in_nak(const struct device *dev) -{ - struct usb_dwc2_reg *const base = dwc2_get_base(dev); - mem_addr_t diepctl_reg = (mem_addr_t)&base->in_ep[0].diepctl; - uint32_t diepctl = sys_read32(diepctl_reg); - - if (diepctl & USB_DWC2_DEPCTL_NAKSTS) { - diepctl &= ~USB_DWC2_DEPCTL_EPENA; - diepctl |= USB_DWC2_DEPCTL_CNAK; - sys_write32(diepctl, diepctl_reg); + if (!udc_buf_peek(udc_get_ep_cfg(dev, USB_CONTROL_EP_IN))) { + dwc2_ctrl_feed_dout(dev, 8); } } @@ -609,11 +590,7 @@ static int dwc2_tx_fifo_write(const struct device *dev, } /* Clear NAK and set endpoint enable */ - diepctl |= USB_DWC2_DEPCTL_EPENA; - if (cfg->addr != USB_CONTROL_EP_IN) { - /* Non-control endpoint, set CNAK for all transfers */ - diepctl |= USB_DWC2_DEPCTL_CNAK; - } + diepctl |= USB_DWC2_DEPCTL_EPENA | USB_DWC2_DEPCTL_CNAK; sys_write32(diepctl, diepctl_reg); /* Clear IN Endpoint NAK Effective interrupt in case it was set */ @@ -799,7 +776,6 @@ static void dwc2_prep_rx(const struct device *dev, struct net_buf *buf, static void dwc2_handle_xfer_next(const struct device *dev, struct udc_ep_config *const cfg) { - struct udc_dwc2_data *const priv = udc_get_private(dev); struct net_buf *buf; buf = udc_buf_peek(cfg); @@ -827,8 +803,7 @@ static void dwc2_handle_xfer_next(const struct device *dev, * avoid race condition where the next Control Write * Transfer Data Stage is received into the buffer. */ - if (dwc2_in_buffer_dma_mode(dev) && priv->pending_dout_feed) { - priv->pending_dout_feed = 0; + if (dwc2_in_buffer_dma_mode(dev)) { dwc2_ctrl_feed_dout(dev, 8); } } @@ -897,19 +872,6 @@ static int dwc2_handle_evt_setup(const struct device *dev) /* Allocate and feed buffer for data OUT stage */ LOG_DBG("s:%p|feed for -out-", buf); - priv->pending_dout_feed = 0; - - if (dwc2_in_completer_mode(dev)) { - /* Programming Guide does not clearly describe to clear - * control IN endpoint NAK for Control Write Transfers - * when operating in Completer mode. Set CNAK here, - * because IN endpoint is not armed at this point and - * forced NAKs are not necessary. IN Status stage will - * only finish after IN endpoint is armed. - */ - dwc2_clear_control_in_nak(dev); - } - err = dwc2_ctrl_feed_dout(dev, udc_data_stage_length(buf)); if (err == -ENOMEM) { err = udc_submit_ep_event(dev, buf, err); @@ -917,19 +879,11 @@ static int dwc2_handle_evt_setup(const struct device *dev) } else if (udc_ctrl_stage_is_data_in(dev)) { LOG_DBG("s:%p|feed for -in-status", buf); - dwc2_clear_control_in_nak(dev); - err = udc_ctrl_submit_s_in_status(dev); - - priv->pending_dout_feed = 1; } else { LOG_DBG("s:%p|feed >setup", buf); - dwc2_clear_control_in_nak(dev); - err = udc_ctrl_submit_s_status(dev); - - priv->pending_dout_feed = 1; } return err; @@ -938,7 +892,6 @@ static int dwc2_handle_evt_setup(const struct device *dev) static inline int dwc2_handle_evt_dout(const struct device *dev, struct udc_ep_config *const cfg) { - struct udc_dwc2_data *const priv = udc_get_private(dev); struct udc_data *data = dev->data; struct net_buf *buf; int err = 0; @@ -971,8 +924,6 @@ static inline int dwc2_handle_evt_dout(const struct device *dev, if (udc_ctrl_stage_is_status_in(dev)) { err = udc_ctrl_submit_s_out_status(dev, buf); - - priv->pending_dout_feed = 1; } if (data->stage == CTRL_PIPE_STAGE_ERROR) { @@ -1672,15 +1623,6 @@ static void udc_dwc2_ep_disable(const struct device *dev, /* For IN endpoints STALL is set in addition to SNAK */ dxepctl |= USB_DWC2_DEPCTL_STALL; } - - /* EP0 status stage enabled, but CNAK not yet written. - * Set EPDIS to prevent timeout. - */ - if ((dxepctl & USB_DWC2_DEPCTL_NAKSTS) && - (dxepctl & USB_DWC2_DEPCTL_EPENA)) { - dxepctl |= USB_DWC2_DEPCTL_EPDIS; - } - sys_write32(dxepctl, dxepctl_reg); /* Endpoint gets disabled in INEPNAKEFF handler */ @@ -2809,15 +2751,13 @@ static inline void dwc2_handle_oepint(const struct device *dev) } if (status & USB_DWC2_DOEPINT_STSPHSERCVD) { - /* Allow IN Status stage after control transfer with - * data stage from device to host. Clear the CNAK and - * this interrupt bit is mandatory in Buffer DMA mode. + /* Driver doesn't need any special handling, but it is + * mandatory that the bit is cleared in Buffer DMA mode. * If the bit is not cleared (i.e. when this interrupt * bit is masked), then SETUP interrupts will cease * after first control transfer with data stage from * device to host. */ - dwc2_clear_control_in_nak(dev); } if (status & USB_DWC2_DOEPINT_XFERCOMPL) { From 830590f326512b330b29206cb11f07db790c3ec3 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:01 +0300 Subject: [PATCH 1397/2141] Revert "[nrf fromtree] drivers: clock_control: nrf: add support for HFCLK24M" This reverts commit 22814fb13bf17cd999ab26035bd150e842de1a83. Signed-off-by: Jukka Rissanen --- drivers/clock_control/clock_control_nrf.c | 25 +------------------ .../drivers/clock_control/nrf_clock_control.h | 5 ---- 2 files changed, 1 insertion(+), 29 deletions(-) diff --git a/drivers/clock_control/clock_control_nrf.c b/drivers/clock_control/clock_control_nrf.c index 3d5d0951d325..d148cd49e4e5 100644 --- a/drivers/clock_control/clock_control_nrf.c +++ b/drivers/clock_control/clock_control_nrf.c @@ -329,18 +329,6 @@ static void hfclk_stop(void) nrfx_clock_hfclk_stop(); } -#if NRF_CLOCK_HAS_HFCLK24M -static void hfclk24m_start(void) -{ - nrfx_clock_start(NRF_CLOCK_DOMAIN_HFCLK24M); -} - -static void hfclk24m_stop(void) -{ - nrfx_clock_stop(NRF_CLOCK_DOMAIN_HFCLK24M); -} -#endif - #if NRF_CLOCK_HAS_HFCLK192M static void hfclk192m_start(void) { @@ -726,11 +714,7 @@ static void clock_event_handler(nrfx_clock_evt_type_t event) break; } #endif -#if NRF_CLOCK_HAS_HFCLK24M - case NRFX_CLOCK_EVT_HFCLK24M_STARTED: - clkstarted_handle(dev, CLOCK_CONTROL_NRF_TYPE_HFCLK24M); - break; -#endif + #if NRF_CLOCK_HAS_HFCLK192M case NRFX_CLOCK_EVT_HFCLK192M_STARTED: clkstarted_handle(dev, CLOCK_CONTROL_NRF_TYPE_HFCLK192M); @@ -859,13 +843,6 @@ static const struct nrf_clock_control_config config = { .stop = lfclk_stop, IF_ENABLED(CONFIG_LOG, (.name = "lfclk",)) }, -#if NRF_CLOCK_HAS_HFCLK24M - [CLOCK_CONTROL_NRF_TYPE_HFCLK24M] = { - .start = hfclk24m_start, - .stop = hfclk24m_stop, - IF_ENABLED(CONFIG_LOG, (.name = "hfclk24m",)) - }, -#endif #if NRF_CLOCK_HAS_HFCLK192M [CLOCK_CONTROL_NRF_TYPE_HFCLK192M] = { .start = hfclk192m_start, diff --git a/include/zephyr/drivers/clock_control/nrf_clock_control.h b/include/zephyr/drivers/clock_control/nrf_clock_control.h index 31c1dea047b9..f407be61d4db 100644 --- a/include/zephyr/drivers/clock_control/nrf_clock_control.h +++ b/include/zephyr/drivers/clock_control/nrf_clock_control.h @@ -27,9 +27,6 @@ extern "C" { enum clock_control_nrf_type { CLOCK_CONTROL_NRF_TYPE_HFCLK, CLOCK_CONTROL_NRF_TYPE_LFCLK, -#if NRF_CLOCK_HAS_HFCLK24M - CLOCK_CONTROL_NRF_TYPE_HFCLK24M, -#endif #if NRF_CLOCK_HAS_HFCLK192M CLOCK_CONTROL_NRF_TYPE_HFCLK192M, #endif @@ -46,8 +43,6 @@ enum clock_control_nrf_type { ((clock_control_subsys_t)CLOCK_CONTROL_NRF_TYPE_HFCLK) #define CLOCK_CONTROL_NRF_SUBSYS_LF \ ((clock_control_subsys_t)CLOCK_CONTROL_NRF_TYPE_LFCLK) -#define CLOCK_CONTROL_NRF_SUBSYS_HF24M \ - ((clock_control_subsys_t)CLOCK_CONTROL_NRF_TYPE_HFCLK24M) #define CLOCK_CONTROL_NRF_SUBSYS_HF192M \ ((clock_control_subsys_t)CLOCK_CONTROL_NRF_TYPE_HFCLK192M) #define CLOCK_CONTROL_NRF_SUBSYS_HFAUDIO \ From 22610c72c4f66ef5b420171dccd0803118b4b728 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:01 +0300 Subject: [PATCH 1398/2141] Revert "[nrf fromtree] usb: hid: Define sensor page usages IDs" This reverts commit da8201be36b725769def0f7fa11267d05ac110b2. Signed-off-by: Jukka Rissanen --- include/zephyr/usb/class/hid.h | 49 +--------------------------------- 1 file changed, 1 insertion(+), 48 deletions(-) diff --git a/include/zephyr/usb/class/hid.h b/include/zephyr/usb/class/hid.h index c9561e750c7d..96bb8271ed75 100644 --- a/include/zephyr/usb/class/hid.h +++ b/include/zephyr/usb/class/hid.h @@ -141,8 +141,6 @@ extern "C" { #define HID_USAGE_GEN_LEDS 0x08 /** HID Button Usage page */ #define HID_USAGE_GEN_BUTTON 0x09 -/** HID Sensors Usage page */ -#define HID_USAGE_SENSORS 0x20 /** HID Generic Desktop Undefined Usage ID */ #define HID_USAGE_GEN_DESKTOP_UNDEFINED 0x00 @@ -165,33 +163,6 @@ extern "C" { /** HID Generic Desktop Wheel Usage ID */ #define HID_USAGE_GEN_DESKTOP_WHEEL 0x38 -/** HID Sensors Collection Usage ID */ -#define HID_USAGE_SENSOR_TYPE_COLLECTION 0x001 -/** HID Sensors Environmental Temperature Type Usage ID */ -#define HID_USAGE_SENSORS_TYPE_ENVIRONMENTAL_TEMPERATURE 0x033 -/** HID Sensors Event Sensor State Usage ID */ -#define HID_USAGE_SENSORS_EVENT_SENSOR_STATE 0x201 -/** HID Sensors Friendly Name Property Usage ID */ -#define HID_USAGE_SENSORS_PROPERTY_FRIENDLY_NAME 0x301 -/** HID Sensors Enviromental Temperature Data Usage ID */ -#define HID_USAGE_SENSORS_DATA_ENVIRONMENTAL_TEMPERATURE 0x434 -/** HID Sensors Timestamp Property Usage ID */ -#define HID_USAGE_SENSORS_PROPERTY_TIMESTAMP 0x529 -/** HID Sensors Sensor State Undefined Usage ID */ -#define HID_USAGE_SENSORS_SENSOR_STATE_UNDEFINED 0x800 -/** HID Sensors Sensor State Ready Usage ID */ -#define HID_USAGE_SENSORS_SENSOR_STATE_READY 0x801 -/** HID Sensors Sensor State Not Available Usage ID */ -#define HID_USAGE_SENSORS_SENSOR_STATE_NOT_AVAILABLE 0x802 -/** HID Sensors Sensor State No Data Usage ID */ -#define HID_USAGE_SENSORS_SENSOR_STATE_NO_DATA 0x803 -/** HID Sensors Sensor State Initializing Usage ID */ -#define HID_USAGE_SENSORS_SENSOR_STATE_INITIALIZING 0x804 -/** HID Sensors Sensor State Access Denied Usage ID */ -#define HID_USAGE_SENSORS_SENSOR_STATE_ACCESS_DENIED 0x805 -/** HID Sensors Sensor State Error Usage ID */ -#define HID_USAGE_SENSORS_SENSOR_STATE_ERROR 0x806 - /** * @} */ @@ -386,21 +357,12 @@ extern "C" { * For usage examples, see @ref HID_MOUSE_REPORT_DESC(), * @ref HID_KEYBOARD_REPORT_DESC() * - * @param idx HID Usage ID per the HID Usage Table + * @param idx Number of data fields included in the report * @return HID Usage Index item */ #define HID_USAGE(idx) \ HID_ITEM(HID_ITEM_TAG_USAGE, HID_ITEM_TYPE_LOCAL, 1), idx -/** - * @brief Define HID Usage Index item with the data length of two bytes. - * - * @param idx HID Usage ID per the HID Usage Table - * @return HID Usage Index item - */ -#define HID_USAGE16(idx) \ - HID_ITEM(HID_ITEM_TAG_USAGE, HID_ITEM_TYPE_LOCAL, 2), (uint8_t)idx, (idx >> 8) - /** * @brief Define HID Usage Minimum item with the data length of one byte. * @@ -451,15 +413,6 @@ extern "C" { #define HID_USAGE_MAX16(a, b) \ HID_ITEM(HID_ITEM_TAG_USAGE_MAX, HID_ITEM_TYPE_LOCAL, 2), a, b -/** - * @brief Define HID Unit Exponent item. - * - * @param exp Unit exponent, refer to the HID Unit Exponent table - * in the specification for usage - * @return HID Unit Exponent item - */ -#define HID_UNIT_EXPONENT(exp) HID_ITEM(HID_ITEM_TAG_UNIT_EXPONENT, HID_ITEM_TYPE_GLOBAL, 1), exp - /** * @} */ From ce666a96a7833f5ac69b56b9598d66fcc73a7d47 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:01 +0300 Subject: [PATCH 1399/2141] Revert "[nrf fromtree] usb: device_next: uac2: support higher bInterval values" This reverts commit 254f1019ad0bb6c9fe93fbd564fd644768f1e101. Signed-off-by: Jukka Rissanen --- .../usb/uac2/zephyr,uac2-audio-streaming.yaml | 8 -------- .../usb/device_next/class/usbd_uac2_macros.h | 20 ++++++------------- 2 files changed, 6 insertions(+), 22 deletions(-) diff --git a/dts/bindings/usb/uac2/zephyr,uac2-audio-streaming.yaml b/dts/bindings/usb/uac2/zephyr,uac2-audio-streaming.yaml index d17423448557..6e661d1c73d8 100644 --- a/dts/bindings/usb/uac2/zephyr,uac2-audio-streaming.yaml +++ b/dts/bindings/usb/uac2/zephyr,uac2-audio-streaming.yaml @@ -78,11 +78,3 @@ properties: type: int description: | Number of effectively used bits in audio subslot. - - polling-period-us: - type: int - description: | - Input or output endpoint polling period in microseconds. For USB full - speed this could be clamped to 1ms or 32768ms depending on the value. For - USB high speed this could be clamped to 125us or 4096ms depending on the - value. diff --git a/subsys/usb/device_next/class/usbd_uac2_macros.h b/subsys/usb/device_next/class/usbd_uac2_macros.h index bd83a3c42a27..a31278d9cf8a 100644 --- a/subsys/usb/device_next/class/usbd_uac2_macros.h +++ b/subsys/usb/device_next/class/usbd_uac2_macros.h @@ -707,22 +707,14 @@ #define AS_BYTES_PER_SAMPLE(node) \ DT_PROP(node, subslot_size) -#define AS_FS_DATA_EP_BINTERVAL(node) \ - USB_FS_ISO_EP_INTERVAL(DT_PROP_OR(node, polling_period_us, 1000)) - -#define AS_HS_DATA_EP_BINTERVAL(node) \ - USB_HS_ISO_EP_INTERVAL(DT_PROP_OR(node, polling_period_us, 125)) - /* Asynchronous endpoints needs space for 1 extra sample */ #define AS_SAMPLES_PER_FRAME(node) \ - (((ROUND_UP(AS_CLK_MAX_FREQUENCY(node), 1000) / 1000) \ - << (AS_FS_DATA_EP_BINTERVAL(node) - 1)) + \ - UTIL_NOT(AS_IS_SOF_SYNCHRONIZED(node))) + ((ROUND_UP(AS_CLK_MAX_FREQUENCY(node), 1000) / 1000) + \ + UTIL_NOT(AS_IS_SOF_SYNCHRONIZED(node))) #define AS_SAMPLES_PER_MICROFRAME(node) \ - (((ROUND_UP(AS_CLK_MAX_FREQUENCY(node), 8000) / 8000) \ - << (AS_HS_DATA_EP_BINTERVAL(node) - 1)) + \ - UTIL_NOT(AS_IS_SOF_SYNCHRONIZED(node))) + ((ROUND_UP(AS_CLK_MAX_FREQUENCY(node), 8000) / 8000) + \ + UTIL_NOT(AS_IS_SOF_SYNCHRONIZED(node))) #define AS_DATA_EP_SYNC_TYPE(node) \ COND_CODE_1(AS_IS_SOF_SYNCHRONIZED(node), (0x3 << 2), (0x1 << 2)) @@ -753,7 +745,7 @@ AS_DATA_EP_ADDR(node), /* bEndpointAddress */ \ AS_DATA_EP_ATTR(node), /* bmAttributes */ \ U16_LE(AS_FS_DATA_EP_MAX_PACKET_SIZE(node)), /* wMaxPacketSize */ \ - AS_FS_DATA_EP_BINTERVAL(node), /* bInterval */ + 0x01, /* bInterval */ #define AS_ISOCHRONOUS_DATA_ENDPOINT_FS_DESCRIPTORS_ARRAYS(node) \ static uint8_t DESCRIPTOR_NAME(fs_std_data_ep, node)[] = { \ @@ -766,7 +758,7 @@ AS_DATA_EP_ADDR(node), /* bEndpointAddress */ \ AS_DATA_EP_ATTR(node), /* bmAttributes */ \ U16_LE(AS_HS_DATA_EP_MAX_PACKET_SIZE(node)), /* wMaxPacketSize */ \ - AS_HS_DATA_EP_BINTERVAL(node), /* bInterval */ + 0x01, /* bInterval */ #define AS_ISOCHRONOUS_DATA_ENDPOINT_HS_DESCRIPTORS_ARRAYS(node) \ static uint8_t DESCRIPTOR_NAME(hs_std_data_ep, node)[] = { \ From 6bde6cd87cb0a46e233ecf5d592aa638d6ebf3be Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:01 +0300 Subject: [PATCH 1400/2141] Revert "[nrf fromtree] include: usb_ch9: fix USB_FS_ISO_EP_INTERVAL calculation" This reverts commit 45800f7e4d9ce35db917872b53dd6b794daced46. Signed-off-by: Jukka Rissanen --- include/zephyr/usb/usb_ch9.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/zephyr/usb/usb_ch9.h b/include/zephyr/usb/usb_ch9.h index 0c4a3ac06086..8ecadf64bd8c 100644 --- a/include/zephyr/usb/usb_ch9.h +++ b/include/zephyr/usb/usb_ch9.h @@ -354,8 +354,8 @@ struct usb_association_descriptor { /** Calculate high speed interrupt endpoint bInterval from a value in microseconds */ #define USB_HS_INT_EP_INTERVAL(us) CLAMP((ilog2((us) / 125U) + 1U), 1U, 16U) -/** Calculate full speed isochronous endpoint bInterval from a value in microseconds */ -#define USB_FS_ISO_EP_INTERVAL(us) CLAMP((ilog2((us) / 1000U) + 1U), 1U, 16U) +/** Calculate high speed isochronous endpoint bInterval from a value in microseconds */ +#define USB_FS_ISO_EP_INTERVAL(us) CLAMP(((us) / 1000U), 1U, 16U) /** Calculate high speed isochronous endpoint bInterval from a value in microseconds */ #define USB_HS_ISO_EP_INTERVAL(us) CLAMP((ilog2((us) / 125U) + 1U), 1U, 16U) From 02d7bd2c45035c5c62b3c0684e38be83d91a3f0e Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:01 +0300 Subject: [PATCH 1401/2141] Revert "[nrf fromtree] include: kernel: add macros to enable allocation from specific sections" This reverts commit a16e4ca655e5a04b30f58e0dc54aa1810d5c2db1. Signed-off-by: Jukka Rissanen --- include/zephyr/kernel.h | 84 ++++++++--------------------------------- 1 file changed, 15 insertions(+), 69 deletions(-) diff --git a/include/zephyr/kernel.h b/include/zephyr/kernel.h index e7968bd2f851..a407678bcaa4 100644 --- a/include/zephyr/kernel.h +++ b/include/zephyr/kernel.h @@ -5440,41 +5440,6 @@ struct k_mem_slab { * @{ */ -/** - * @brief Statically define and initialize a memory slab in a user-provided memory section with - * public (non-static) scope. - * - * The memory slab's buffer contains @a slab_num_blocks memory blocks - * that are @a slab_block_size bytes long. The buffer is aligned to a - * @a slab_align -byte boundary. To ensure that each memory block is similarly - * aligned to this boundary, @a slab_block_size must also be a multiple of - * @a slab_align. - * - * The memory slab can be accessed outside the module where it is defined - * using: - * - * @code extern struct k_mem_slab ; @endcode - * - * @note This macro cannot be used together with a static keyword. - * If such a use-case is desired, use @ref K_MEM_SLAB_DEFINE_IN_SECT_STATIC - * instead. - * - * @param name Name of the memory slab. - * @param in_section Section attribute specifier such as Z_GENERIC_SECTION. - * @param slab_block_size Size of each memory block (in bytes). - * @param slab_num_blocks Number memory blocks. - * @param slab_align Alignment of the memory slab's buffer (power of 2). - */ -#define K_MEM_SLAB_DEFINE_IN_SECT(name, in_section, slab_block_size, slab_num_blocks, slab_align) \ - BUILD_ASSERT(((slab_block_size) % (slab_align)) == 0, \ - "slab_block_size must be a multiple of slab_align"); \ - BUILD_ASSERT((((slab_align) & ((slab_align) - 1)) == 0), \ - "slab_align must be a power of 2"); \ - char in_section __aligned(WB_UP( \ - slab_align)) _k_mem_slab_buf_##name[(slab_num_blocks) * WB_UP(slab_block_size)]; \ - STRUCT_SECTION_ITERABLE(k_mem_slab, name) = Z_MEM_SLAB_INITIALIZER( \ - name, _k_mem_slab_buf_##name, WB_UP(slab_block_size), slab_num_blocks) - /** * @brief Statically define and initialize a memory slab in a public (non-static) scope. * @@ -5498,36 +5463,13 @@ struct k_mem_slab { * @param slab_num_blocks Number memory blocks. * @param slab_align Alignment of the memory slab's buffer (power of 2). */ -#define K_MEM_SLAB_DEFINE(name, slab_block_size, slab_num_blocks, slab_align) \ - K_MEM_SLAB_DEFINE_IN_SECT(name, __noinit_named(k_mem_slab_buf_##name), slab_block_size, \ - slab_num_blocks, slab_align) - -/** - * @brief Statically define and initialize a memory slab in a user-provided memory section with - * private (static) scope. - * - * The memory slab's buffer contains @a slab_num_blocks memory blocks - * that are @a slab_block_size bytes long. The buffer is aligned to a - * @a slab_align -byte boundary. To ensure that each memory block is similarly - * aligned to this boundary, @a slab_block_size must also be a multiple of - * @a slab_align. - * - * @param name Name of the memory slab. - * @param in_section Section attribute specifier such as Z_GENERIC_SECTION. - * @param slab_block_size Size of each memory block (in bytes). - * @param slab_num_blocks Number memory blocks. - * @param slab_align Alignment of the memory slab's buffer (power of 2). - */ -#define K_MEM_SLAB_DEFINE_IN_SECT_STATIC(name, in_section, slab_block_size, slab_num_blocks, \ - slab_align) \ - BUILD_ASSERT(((slab_block_size) % (slab_align)) == 0, \ - "slab_block_size must be a multiple of slab_align"); \ - BUILD_ASSERT((((slab_align) & ((slab_align) - 1)) == 0), \ - "slab_align must be a power of 2"); \ - static char in_section __aligned(WB_UP( \ - slab_align)) _k_mem_slab_buf_##name[(slab_num_blocks) * WB_UP(slab_block_size)]; \ - static STRUCT_SECTION_ITERABLE(k_mem_slab, name) = Z_MEM_SLAB_INITIALIZER( \ - name, _k_mem_slab_buf_##name, WB_UP(slab_block_size), slab_num_blocks) +#define K_MEM_SLAB_DEFINE(name, slab_block_size, slab_num_blocks, slab_align) \ + char __noinit_named(k_mem_slab_buf_##name) \ + __aligned(WB_UP(slab_align)) \ + _k_mem_slab_buf_##name[(slab_num_blocks) * WB_UP(slab_block_size)]; \ + STRUCT_SECTION_ITERABLE(k_mem_slab, name) = \ + Z_MEM_SLAB_INITIALIZER(name, _k_mem_slab_buf_##name, \ + WB_UP(slab_block_size), slab_num_blocks) /** * @brief Statically define and initialize a memory slab in a private (static) scope. @@ -5543,9 +5485,13 @@ struct k_mem_slab { * @param slab_num_blocks Number memory blocks. * @param slab_align Alignment of the memory slab's buffer (power of 2). */ -#define K_MEM_SLAB_DEFINE_STATIC(name, slab_block_size, slab_num_blocks, slab_align) \ - K_MEM_SLAB_DEFINE_IN_SECT_STATIC(name, __noinit_named(k_mem_slab_buf_##name), \ - slab_block_size, slab_num_blocks, slab_align) +#define K_MEM_SLAB_DEFINE_STATIC(name, slab_block_size, slab_num_blocks, slab_align) \ + static char __noinit_named(k_mem_slab_buf_##name) \ + __aligned(WB_UP(slab_align)) \ + _k_mem_slab_buf_##name[(slab_num_blocks) * WB_UP(slab_block_size)]; \ + static STRUCT_SECTION_ITERABLE(k_mem_slab, name) = \ + Z_MEM_SLAB_INITIALIZER(name, _k_mem_slab_buf_##name, \ + WB_UP(slab_block_size), slab_num_blocks) /** * @brief Initialize a memory slab. @@ -5844,7 +5790,7 @@ void k_heap_free(struct k_heap *h, void *mem) __attribute_nonnull(1); * * @param name Symbol name for the struct k_heap object * @param bytes Size of memory region, in bytes - * @param in_section Section attribute specifier such as Z_GENERIC_SECTION. + * @param in_section __attribute__((section(name)) */ #define Z_HEAP_DEFINE_IN_SECT(name, bytes, in_section) \ char in_section \ From bc72696a6821a4418348a49cc860405b7cd6a88d Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:01 +0300 Subject: [PATCH 1402/2141] Revert "[nrf fromtree] drivers: udc_dwc2: do not throw error when FIFO settings can be reused" This reverts commit a35a0bb0c2519a9921b4f6a396886a85b2c953f1. Signed-off-by: Jukka Rissanen --- drivers/usb/udc/udc_dwc2.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/drivers/usb/udc/udc_dwc2.c b/drivers/usb/udc/udc_dwc2.c index 5a47a23294c8..09ed5aaa0141 100644 --- a/drivers/usb/udc/udc_dwc2.c +++ b/drivers/usb/udc/udc_dwc2.c @@ -1328,6 +1328,12 @@ static int dwc2_set_dedicated_fifo(const struct device *dev, dwc2_unset_unused_fifo(dev); } + if (priv->txf_set & ~BIT_MASK(ep_idx)) { + LOG_WRN("Some of the FIFOs higher than %u are set, %lx", + ep_idx, priv->txf_set & ~BIT_MASK(ep_idx)); + return -EIO; + } + if ((ep_idx - 1) != 0U) { txfaddr = dwc2_get_txfdep(dev, ep_idx - 2) + dwc2_get_txfaddr(dev, ep_idx - 2); @@ -1336,21 +1342,8 @@ static int dwc2_set_dedicated_fifo(const struct device *dev, MIN(UDC_DWC2_FIFO0_DEPTH, priv->max_txfifo_depth[0]); } - if (priv->txf_set & BIT(ep_idx)) { - uint32_t curaddr; - - curaddr = dwc2_get_txfaddr(dev, ep_idx - 1); - txfdep = dwc2_get_txfdep(dev, ep_idx - 1); - if (txfaddr != curaddr || reqdep > txfdep) { - LOG_ERR("FIFO%u cannot be reused, new addr 0x%04x depth %u", - ep_idx, txfaddr, reqdep); - return -ENOMEM; - } - } else { - txfdep = reqdep; - } - /* Make sure to not set TxFIFO greater than hardware allows */ + txfdep = reqdep; if (txfdep > priv->max_txfifo_depth[ep_idx]) { return -ENOMEM; } From f0aadc20d0a1652b74a089d96f6cfc9bd6fa563e Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:01 +0300 Subject: [PATCH 1403/2141] Revert "[nrf fromtree] usb: device_next: uac2: Do not leak double buffered endpoint" This reverts commit ab18a04cfb8d294e15b3e075a04f9d2d10d9f66c. Signed-off-by: Jukka Rissanen --- subsys/usb/device_next/class/usbd_uac2.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/subsys/usb/device_next/class/usbd_uac2.c b/subsys/usb/device_next/class/usbd_uac2.c index efa3fd6cdf32..2e55a9a017af 100644 --- a/subsys/usb/device_next/class/usbd_uac2.c +++ b/subsys/usb/device_next/class/usbd_uac2.c @@ -816,9 +816,6 @@ static int uac2_request(struct usbd_class_data *const c_data, struct net_buf *bu ctx->user_data); } else if (!is_feedback) { ctx->ops->buf_release_cb(dev, terminal, buf->__buf, ctx->user_data); - if (buf->frags) { - ctx->ops->buf_release_cb(dev, terminal, buf->frags->__buf, ctx->user_data); - } } usbd_ep_buf_free(uds_ctx, buf); From a95a63b322eda9f11db07e272a9247c0d2c5d64f Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:01 +0300 Subject: [PATCH 1404/2141] Revert "[nrf fromtree] drivers: udc_dwc2: Disable endpoints asynchronously" This reverts commit fb42c976235d7724f895bd9ad2a310877ff203fc. Signed-off-by: Jukka Rissanen --- drivers/usb/udc/udc_dwc2.c | 230 ++++++++++++++----------------------- 1 file changed, 84 insertions(+), 146 deletions(-) diff --git a/drivers/usb/udc/udc_dwc2.c b/drivers/usb/udc/udc_dwc2.c index 09ed5aaa0141..779600321e16 100644 --- a/drivers/usb/udc/udc_dwc2.c +++ b/drivers/usb/udc/udc_dwc2.c @@ -106,8 +106,6 @@ struct udc_dwc2_data { struct k_thread thread_data; /* Main events the driver thread waits for */ struct k_event drv_evt; - /* Endpoint is considered disabled when there is no active transfer */ - struct k_event ep_disabled; /* Transfer triggers (IN on bits 0-15, OUT on bits 16-31) */ atomic_t xfer_new; /* Finished transactions (IN on bits 0-15, OUT on bits 16-31) */ @@ -120,9 +118,6 @@ struct udc_dwc2_data { uint32_t rx_siz[16]; /* Isochronous endpoint enabled (IN on bits 0-15, OUT on bits 16-31) */ uint32_t iso_enabled; - uint16_t iso_in_rearm; - uint16_t ep_out_disable; - uint16_t ep_out_stall; uint16_t txf_set; uint16_t pending_tx_flush; uint16_t dfifodepth; @@ -150,8 +145,7 @@ struct udc_dwc2_data { }; static void udc_dwc2_ep_disable(const struct device *dev, - struct udc_ep_config *const cfg, - bool stall, bool wait); + struct udc_ep_config *const cfg, bool stall); #if defined(CONFIG_PINCTRL) #include @@ -624,7 +618,6 @@ static int dwc2_tx_fifo_write(const struct device *dev, } } - k_event_clear(&priv->ep_disabled, BIT(ep_idx)); k_spin_unlock(&priv->lock, key); return 0; @@ -768,8 +761,6 @@ static void dwc2_prep_rx(const struct device *dev, struct net_buf *buf, sys_write32(doepctl, doepctl_reg); - k_event_clear(&priv->ep_disabled, BIT(16 + ep_idx)); - LOG_INF("Prepare RX 0x%02x doeptsiz 0x%x", cfg->addr, doeptsiz); } @@ -836,7 +827,7 @@ static int dwc2_handle_evt_setup(const struct device *dev) * transfer beforehand. In Buffer DMA the SETUP can be copied to any EP0 * OUT buffer. If there is any buffer queued, it is obsolete now. */ - udc_dwc2_ep_disable(dev, cfg_in, false, true); + udc_dwc2_ep_disable(dev, cfg_in, false); atomic_and(&priv->xfer_finished, ~(BIT(0) | BIT(16))); buf = udc_buf_get_all(cfg_out); @@ -1531,19 +1522,16 @@ static int dwc2_unset_dedicated_fifo(const struct device *dev, * incoming OUT data (or HS PING) even if there is space available in RxFIFO. * * Set stall parameter to true if caller wants to send STALL instead of NAK. - * Set wait parameter to true to caller wants the function to return only after - * the requested operation is effective (or after 100 ms timeout). */ static void udc_dwc2_ep_disable(const struct device *dev, - struct udc_ep_config *const cfg, - bool stall, bool wait) + struct udc_ep_config *const cfg, bool stall) { struct udc_dwc2_data *const priv = udc_get_private(dev); struct usb_dwc2_reg *const base = dwc2_get_base(dev); uint8_t ep_idx = USB_EP_GET_IDX(cfg->addr); - uint8_t ep_bit = ep_idx + (USB_EP_DIR_IS_OUT(cfg->addr) ? 16 : 0); mem_addr_t dxepctl_reg; uint32_t dxepctl; + const bool is_iso = dwc2_ep_is_iso(cfg); dxepctl_reg = dwc2_get_dxepctl_reg(dev, cfg->addr); dxepctl = sys_read32(dxepctl_reg); @@ -1579,55 +1567,104 @@ static void udc_dwc2_ep_disable(const struct device *dev, priv->pending_tx_flush |= BIT(usb_dwc2_get_depctl_txfnum(dxepctl)); } - k_event_post(&priv->ep_disabled, BIT(ep_bit)); udc_ep_set_busy(cfg, false); return; } - if (k_event_test(&priv->ep_disabled, BIT(ep_bit))) { - /* There is no active transfer, STALL if necessary */ + if (!is_iso && (dxepctl & USB_DWC2_DEPCTL_NAKSTS) && + !(dxepctl & USB_DWC2_DEPCTL_EPENA)) { + /* Endpoint already sends forced NAKs. STALL if necessary. */ if (stall) { dxepctl |= USB_DWC2_DEPCTL_STALL; sys_write32(dxepctl, dxepctl_reg); } - /* Do not start pending transfers (if any) */ - atomic_clear_bit(&priv->xfer_new, ep_bit); - return; } + /* FIXME: This function needs to be changed to not synchronously wait + * for the events to happen because the actions here are racing against + * the USB host packets. It is possible that the IN token or OUT DATA + * gets sent shortly before this function disables the endpoint. If this + * happens, the XferCompl would be set and driver will incorrectly think + * that either: + * * never queued transfer finished, OR + * * transfer queued in incompisoin handler finished (before it really + * does and then it'll "double"-finish when it actually finishes) + * + * For the time being XferCompl is cleared as a workaround. + */ + if (USB_EP_DIR_IS_OUT(cfg->addr)) { - k_spinlock_key_t key = k_spin_lock(&priv->lock); + mem_addr_t dctl_reg, gintsts_reg, doepint_reg; + uint32_t dctl; + + dctl_reg = (mem_addr_t)&base->dctl; + gintsts_reg = (mem_addr_t)&base->gintsts; + doepint_reg = (mem_addr_t)&base->out_ep[ep_idx].doepint; + + dctl = sys_read32(dctl_reg); + + if (sys_read32(gintsts_reg) & USB_DWC2_GINTSTS_GOUTNAKEFF) { + LOG_ERR("GOUTNAKEFF already active"); + } else { + dctl |= USB_DWC2_DCTL_SGOUTNAK; + sys_write32(dctl, dctl_reg); + dctl &= ~USB_DWC2_DCTL_SGOUTNAK; + } + + dwc2_wait_for_bit(dev, gintsts_reg, USB_DWC2_GINTSTS_GOUTNAKEFF); + + /* The application cannot disable control OUT endpoint 0. */ + if (ep_idx != 0) { + dxepctl |= USB_DWC2_DEPCTL_EPENA | USB_DWC2_DEPCTL_EPDIS; + } - priv->ep_out_disable |= BIT(ep_idx); if (stall) { - priv->ep_out_stall |= BIT(ep_idx); + /* For OUT endpoints STALL is set instead of SNAK */ + dxepctl |= USB_DWC2_DEPCTL_STALL; + } else { + dxepctl |= USB_DWC2_DEPCTL_SNAK; } + sys_write32(dxepctl, dxepctl_reg); - sys_set_bits((mem_addr_t)&base->dctl, USB_DWC2_DCTL_SGOUTNAK); + if (ep_idx != 0) { + dwc2_wait_for_bit(dev, doepint_reg, USB_DWC2_DOEPINT_EPDISBLD); + } - k_spin_unlock(&priv->lock, key); + /* Clear Endpoint Disabled interrupt */ + sys_write32(USB_DWC2_DOEPINT_EPDISBLD | USB_DWC2_DOEPINT_XFERCOMPL, doepint_reg); - /* Endpoint gets disabled in GOUTNAKEFF handler */ + dctl |= USB_DWC2_DCTL_CGOUTNAK; + sys_write32(dctl, dctl_reg); } else { - dxepctl |= USB_DWC2_DEPCTL_SNAK; + mem_addr_t diepint_reg; + + diepint_reg = (mem_addr_t)&base->in_ep[ep_idx].diepint; + + dxepctl |= USB_DWC2_DEPCTL_EPENA | USB_DWC2_DEPCTL_SNAK; if (stall) { /* For IN endpoints STALL is set in addition to SNAK */ dxepctl |= USB_DWC2_DEPCTL_STALL; } sys_write32(dxepctl, dxepctl_reg); - /* Endpoint gets disabled in INEPNAKEFF handler */ - } + dwc2_wait_for_bit(dev, diepint_reg, USB_DWC2_DIEPINT_INEPNAKEFF); - if (wait) { - uint32_t ret; + dxepctl |= USB_DWC2_DEPCTL_EPENA | USB_DWC2_DEPCTL_EPDIS; + sys_write32(dxepctl, dxepctl_reg); - ret = k_event_wait(&priv->ep_disabled, BIT(ep_bit), false, K_MSEC(100)); - if (ret == 0) { - LOG_ERR("Endpoint 0x%02x disable timeout", cfg->addr); - } + dwc2_wait_for_bit(dev, diepint_reg, USB_DWC2_DIEPINT_EPDISBLD); + + /* Clear Endpoint Disabled interrupt */ + sys_write32(USB_DWC2_DIEPINT_EPDISBLD | USB_DWC2_DIEPINT_XFERCOMPL, diepint_reg); + + /* TODO: Read DIEPTSIZn here? Programming Guide suggest it to + * let application know how many bytes of interrupted transfer + * were transferred to the host. + */ + + dwc2_flush_tx_fifo(dev, usb_dwc2_get_depctl_txfnum(dxepctl)); } udc_ep_set_busy(cfg, false); @@ -1651,7 +1688,7 @@ static int udc_dwc2_ep_deactivate(const struct device *dev, LOG_DBG("Disable ep 0x%02x DxEPCTL%u %x", cfg->addr, ep_idx, dxepctl); - udc_dwc2_ep_disable(dev, cfg, false, true); + udc_dwc2_ep_disable(dev, cfg, false); dxepctl = sys_read32(dxepctl_reg); dxepctl &= ~USB_DWC2_DEPCTL_USBACTEP; @@ -1682,7 +1719,7 @@ static int udc_dwc2_ep_set_halt(const struct device *dev, { uint8_t ep_idx = USB_EP_GET_IDX(cfg->addr); - udc_dwc2_ep_disable(dev, cfg, true, true); + udc_dwc2_ep_disable(dev, cfg, true); LOG_DBG("Set halt ep 0x%02x", cfg->addr); if (ep_idx != 0) { @@ -1757,7 +1794,7 @@ static int udc_dwc2_ep_dequeue(const struct device *dev, { struct net_buf *buf; - udc_dwc2_ep_disable(dev, cfg, false, true); + udc_dwc2_ep_disable(dev, cfg, false); buf = udc_buf_get_all(cfg); if (buf) { @@ -2147,8 +2184,7 @@ static int udc_dwc2_init_controller(const struct device *dev) USB_DWC2_GINTSTS_INCOMPISOIN |)) USB_DWC2_GINTSTS_OEPINT | USB_DWC2_GINTSTS_IEPINT | USB_DWC2_GINTSTS_ENUMDONE | USB_DWC2_GINTSTS_USBRST | - USB_DWC2_GINTSTS_WKUPINT | USB_DWC2_GINTSTS_USBSUSP | - USB_DWC2_GINTSTS_GOUTNAKEFF, + USB_DWC2_GINTSTS_WKUPINT | USB_DWC2_GINTSTS_USBSUSP, (mem_addr_t)&base->gintmsk); return 0; @@ -2285,10 +2321,6 @@ static int dwc2_driver_preinit(const struct device *dev) k_event_init(&priv->drv_evt); atomic_clear(&priv->xfer_new); atomic_clear(&priv->xfer_finished); - k_event_init(&priv->ep_disabled); - k_event_set(&priv->ep_disabled, UINT32_MAX); - priv->ep_out_disable = 0; - priv->ep_out_stall = 0; priv->iso_enabled = 0; data->caps.rwup = true; @@ -2407,7 +2439,6 @@ static void dwc2_on_bus_reset(const struct device *dev) struct usb_dwc2_reg *const base = dwc2_get_base(dev); struct udc_dwc2_data *const priv = udc_get_private(dev); uint32_t doepmsk; - uint32_t diepmsk; /* Set the NAK bit for all OUT endpoints */ for (uint8_t i = 0U; i < priv->numdeveps; i++) { @@ -2422,16 +2453,13 @@ static void dwc2_on_bus_reset(const struct device *dev) } } - doepmsk = USB_DWC2_DOEPINT_SETUP | USB_DWC2_DOEPINT_EPDISBLD | USB_DWC2_DOEPINT_XFERCOMPL; + doepmsk = USB_DWC2_DOEPINT_SETUP | USB_DWC2_DOEPINT_XFERCOMPL; if (dwc2_in_buffer_dma_mode(dev)) { doepmsk |= USB_DWC2_DOEPINT_STSPHSERCVD; } sys_write32(doepmsk, (mem_addr_t)&base->doepmsk); - - diepmsk = USB_DWC2_DIEPINT_INEPNAKEFF | USB_DWC2_DIEPINT_EPDISBLD | - USB_DWC2_DIEPINT_XFERCOMPL; - sys_write32(diepmsk, (mem_addr_t)&base->diepmsk); + sys_set_bits((mem_addr_t)&base->diepmsk, USB_DWC2_DIEPINT_XFERCOMPL); /* Software has to handle RxFLvl interrupt only in Completer mode */ if (dwc2_in_completer_mode(dev)) { @@ -2555,13 +2583,11 @@ static inline void dwc2_handle_in_xfercompl(const struct device *dev, } atomic_set_bit(&priv->xfer_finished, ep_idx); - k_event_post(&priv->ep_disabled, BIT(ep_idx)); k_event_post(&priv->drv_evt, BIT(DWC2_DRV_EVT_EP_FINISHED)); } static inline void dwc2_handle_iepint(const struct device *dev) { - struct udc_dwc2_data *const priv = udc_get_private(dev); struct usb_dwc2_reg *const base = dwc2_get_base(dev); uint32_t diepmsk; uint32_t epint; @@ -2572,7 +2598,6 @@ static inline void dwc2_handle_iepint(const struct device *dev) while (epint) { uint8_t n = find_lsb_set(epint) - 1; mem_addr_t diepint_reg = (mem_addr_t)&base->in_ep[n].diepint; - mem_addr_t diepctl_reg = (mem_addr_t)&base->in_ep[n].diepctl; uint32_t diepint; uint32_t status; @@ -2588,33 +2613,6 @@ static inline void dwc2_handle_iepint(const struct device *dev) dwc2_handle_in_xfercompl(dev, n); } - if (status & USB_DWC2_DIEPINT_INEPNAKEFF) { - sys_set_bits(diepctl_reg, USB_DWC2_DEPCTL_EPDIS); - } - - if (status & USB_DWC2_DIEPINT_EPDISBLD) { - uint32_t diepctl = sys_read32(diepctl_reg); - - k_event_post(&priv->ep_disabled, BIT(n)); - - /* TODO: Read DIEPTSIZn here? Programming Guide suggest it to - * let application know how many bytes of interrupted transfer - * were transferred to the host. - */ - - dwc2_flush_tx_fifo(dev, usb_dwc2_get_depctl_txfnum(diepctl)); - - if ((usb_dwc2_get_depctl_eptype(diepctl) == USB_DWC2_DEPCTL_EPTYPE_ISO) && - (priv->iso_in_rearm & BIT(n))) { - struct udc_ep_config *cfg = udc_get_ep_cfg(dev, n | USB_EP_DIR_IN); - - /* Try to queue next packet before SOF */ - dwc2_handle_xfer_next(dev, cfg); - - priv->iso_in_rearm &= ~BIT(n); - } - } - epint &= ~BIT(n); } @@ -2690,7 +2688,6 @@ static inline void dwc2_handle_out_xfercompl(const struct device *dev, dwc2_prep_rx(dev, buf, ep_cfg); } else { atomic_set_bit(&priv->xfer_finished, 16 + ep_idx); - k_event_post(&priv->ep_disabled, BIT(16 + ep_idx)); k_event_post(&priv->drv_evt, BIT(DWC2_DRV_EVT_EP_FINISHED)); } } @@ -2757,10 +2754,6 @@ static inline void dwc2_handle_oepint(const struct device *dev) dwc2_handle_out_xfercompl(dev, n); } - if (status & USB_DWC2_DOEPINT_EPDISBLD) { - k_event_post(&priv->ep_disabled, BIT(16 + n)); - } - epint &= ~BIT(n); } @@ -2786,7 +2779,6 @@ static void dwc2_handle_incompisoin(const struct device *dev) usb_dwc2_set_depctl_eptype(USB_DWC2_DEPCTL_EPTYPE_ISO) | USB_DWC2_DEPCTL_USBACTEP; uint32_t eps = priv->iso_enabled & 0x0000FFFFUL; - uint16_t rearm = 0; while (eps) { uint8_t i = find_lsb_set(eps) - 1; @@ -2804,23 +2796,21 @@ static void dwc2_handle_incompisoin(const struct device *dev) __ASSERT_NO_MSG(cfg && cfg->stat.enabled && dwc2_ep_is_iso(cfg)); - udc_dwc2_ep_disable(dev, cfg, false, false); + udc_dwc2_ep_disable(dev, cfg, false); buf = udc_buf_get(cfg); if (buf) { /* Data is no longer relevant */ udc_submit_ep_event(dev, buf, 0); - rearm |= BIT(i); + /* Try to queue next packet before SOF */ + dwc2_handle_xfer_next(dev, cfg); } } eps &= ~BIT(i); } - /* Mark endpoints to re-arm in EPDISBLD handler */ - priv->iso_in_rearm = rearm; - sys_write32(USB_DWC2_GINTSTS_INCOMPISOIN, gintsts_reg); } @@ -2860,7 +2850,7 @@ static void dwc2_handle_incompisoout(const struct device *dev) __ASSERT_NO_MSG(cfg && cfg->stat.enabled && dwc2_ep_is_iso(cfg)); - udc_dwc2_ep_disable(dev, cfg, false, false); + udc_dwc2_ep_disable(dev, cfg, false); buf = udc_buf_get(cfg); if (buf) { @@ -2874,51 +2864,6 @@ static void dwc2_handle_incompisoout(const struct device *dev) sys_write32(USB_DWC2_GINTSTS_INCOMPISOOUT, gintsts_reg); } -static void dwc2_handle_goutnakeff(const struct device *dev) -{ - const struct udc_dwc2_config *const config = dev->config; - struct usb_dwc2_reg *const base = config->base; - struct udc_dwc2_data *const priv = udc_get_private(dev); - k_spinlock_key_t key; - mem_addr_t doepctl_reg; - uint32_t doepctl; - - key = k_spin_lock(&priv->lock); - - while (priv->ep_out_disable) { - uint8_t ep_idx = find_lsb_set(priv->ep_out_disable) - 1; - - priv->ep_out_disable &= ~BIT(ep_idx); - - doepctl_reg = (mem_addr_t)&base->out_ep[ep_idx].doepctl; - doepctl = sys_read32(doepctl_reg); - - /* The application cannot disable control OUT endpoint 0. */ - if (ep_idx != 0) { - doepctl |= USB_DWC2_DEPCTL_EPDIS; - } - - if (priv->ep_out_stall & BIT(ep_idx)) { - /* For OUT endpoints STALL is set instead of SNAK */ - doepctl |= USB_DWC2_DEPCTL_STALL; - priv->ep_out_stall &= ~BIT(ep_idx); - } else { - doepctl |= USB_DWC2_DEPCTL_SNAK; - } - - sys_write32(doepctl, doepctl_reg); - - if (ep_idx == 0) { - /* Consider endpoint to be disabled */ - k_event_post(&priv->ep_disabled, BIT(16)); - } - } - - sys_set_bits((mem_addr_t)&base->dctl, USB_DWC2_DCTL_CGOUTNAK); - - k_spin_unlock(&priv->lock, key); -} - static void udc_dwc2_isr_handler(const struct device *dev) { const struct udc_dwc2_config *const config = dev->config; @@ -3024,13 +2969,6 @@ static void udc_dwc2_isr_handler(const struct device *dev) dwc2_handle_incompisoout(dev); } - if (int_status & USB_DWC2_GINTSTS_GOUTNAKEFF) { - /* Clear Global OUT NAK Effective interrupt. */ - sys_write32(USB_DWC2_GINTSTS_GOUTNAKEFF, gintsts_reg); - - dwc2_handle_goutnakeff(dev); - } - if (int_status & USB_DWC2_GINTSTS_USBSUSP) { /* Clear USB Suspend interrupt. */ sys_write32(USB_DWC2_GINTSTS_USBSUSP, gintsts_reg); From 8847f842fcdb11c732f3042870b5197f5356b59b Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:01 +0300 Subject: [PATCH 1405/2141] Revert "[nrf fromtree] drivers: udc_dwc2: Optimize incomplete iso handling" This reverts commit 77e2d806340cc9d6a33beed45f596572d30130fa. Signed-off-by: Jukka Rissanen --- drivers/usb/udc/udc_dwc2.c | 100 ++++++++++++++++--------------------- 1 file changed, 43 insertions(+), 57 deletions(-) diff --git a/drivers/usb/udc/udc_dwc2.c b/drivers/usb/udc/udc_dwc2.c index 779600321e16..bebe7973a487 100644 --- a/drivers/usb/udc/udc_dwc2.c +++ b/drivers/usb/udc/udc_dwc2.c @@ -116,8 +116,6 @@ struct udc_dwc2_data { uint32_t max_pktcnt; uint32_t tx_len[16]; uint32_t rx_siz[16]; - /* Isochronous endpoint enabled (IN on bits 0-15, OUT on bits 16-31) */ - uint32_t iso_enabled; uint16_t txf_set; uint16_t pending_tx_flush; uint16_t dfifodepth; @@ -1477,12 +1475,6 @@ static int udc_dwc2_ep_activate(const struct device *dev, dwc2_set_epint(dev, cfg, true); sys_write32(dxepctl, dxepctl_reg); - if (dwc2_ep_is_iso(cfg)) { - uint8_t ep_bit = ep_idx + (USB_EP_DIR_IS_OUT(cfg->addr) ? 16 : 0); - - priv->iso_enabled |= BIT(ep_bit); - } - for (uint8_t i = 1U; i < priv->ineps; i++) { LOG_DBG("DIEPTXF%u %08x DIEPCTL%u %08x", i, sys_read32((mem_addr_t)&base->dieptxf[i - 1U]), i, dxepctl); @@ -1676,7 +1668,6 @@ static void udc_dwc2_ep_disable(const struct device *dev, static int udc_dwc2_ep_deactivate(const struct device *dev, struct udc_ep_config *const cfg) { - struct udc_dwc2_data *const priv = udc_get_private(dev); uint8_t ep_idx = USB_EP_GET_IDX(cfg->addr); mem_addr_t dxepctl_reg; uint32_t dxepctl; @@ -1705,12 +1696,6 @@ static int udc_dwc2_ep_deactivate(const struct device *dev, sys_write32(dxepctl, dxepctl_reg); dwc2_set_epint(dev, cfg, false); - if (dwc2_ep_is_iso(cfg)) { - uint8_t ep_bit = ep_idx + (USB_EP_DIR_IS_OUT(cfg->addr) ? 16 : 0); - - priv->iso_enabled &= ~BIT(ep_bit); - } - return 0; } @@ -2321,7 +2306,6 @@ static int dwc2_driver_preinit(const struct device *dev) k_event_init(&priv->drv_evt); atomic_clear(&priv->xfer_new); atomic_clear(&priv->xfer_finished); - priv->iso_enabled = 0; data->caps.rwup = true; data->caps.addr_before_status = true; @@ -2778,37 +2762,38 @@ static void dwc2_handle_incompisoin(const struct device *dev) USB_DWC2_DEPCTL_EPENA | usb_dwc2_set_depctl_eptype(USB_DWC2_DEPCTL_EPTYPE_ISO) | USB_DWC2_DEPCTL_USBACTEP; - uint32_t eps = priv->iso_enabled & 0x0000FFFFUL; - while (eps) { - uint8_t i = find_lsb_set(eps) - 1; - mem_addr_t diepctl_reg = dwc2_get_dxepctl_reg(dev, i | USB_EP_DIR_IN); - uint32_t diepctl; + for (uint8_t i = 1U; i < priv->numdeveps; i++) { + uint32_t epdir = usb_dwc2_get_ghwcfg1_epdir(priv->ghwcfg1, i); - diepctl = sys_read32(diepctl_reg); + if (epdir == USB_DWC2_GHWCFG1_EPDIR_IN || + epdir == USB_DWC2_GHWCFG1_EPDIR_BDIR) { + mem_addr_t diepctl_reg = dwc2_get_dxepctl_reg(dev, i | USB_EP_DIR_IN); + uint32_t diepctl; - /* Check if endpoint didn't receive ISO IN data */ - if ((diepctl & mask) == val) { - struct udc_ep_config *cfg; - struct net_buf *buf; + diepctl = sys_read32(diepctl_reg); - cfg = udc_get_ep_cfg(dev, i | USB_EP_DIR_IN); - __ASSERT_NO_MSG(cfg && cfg->stat.enabled && - dwc2_ep_is_iso(cfg)); + /* Check if endpoint didn't receive ISO OUT data */ + if ((diepctl & mask) == val) { + struct udc_ep_config *cfg; + struct net_buf *buf; - udc_dwc2_ep_disable(dev, cfg, false); + cfg = udc_get_ep_cfg(dev, i | USB_EP_DIR_IN); + __ASSERT_NO_MSG(cfg && cfg->stat.enabled && + dwc2_ep_is_iso(cfg)); - buf = udc_buf_get(cfg); - if (buf) { - /* Data is no longer relevant */ - udc_submit_ep_event(dev, buf, 0); + udc_dwc2_ep_disable(dev, cfg, false); - /* Try to queue next packet before SOF */ - dwc2_handle_xfer_next(dev, cfg); + buf = udc_buf_get(cfg); + if (buf) { + /* Data is no longer relevant */ + udc_submit_ep_event(dev, buf, 0); + + /* Try to queue next packet before SOF */ + dwc2_handle_xfer_next(dev, cfg); + } } } - - eps &= ~BIT(i); } sys_write32(USB_DWC2_GINTSTS_INCOMPISOIN, gintsts_reg); @@ -2832,33 +2817,34 @@ static void dwc2_handle_incompisoout(const struct device *dev) usb_dwc2_set_depctl_eptype(USB_DWC2_DEPCTL_EPTYPE_ISO) | ((priv->sof_num & 1) ? USB_DWC2_DEPCTL_DPID : 0) | USB_DWC2_DEPCTL_USBACTEP; - uint32_t eps = (priv->iso_enabled & 0xFFFF0000UL) >> 16; - while (eps) { - uint8_t i = find_lsb_set(eps) - 1; - mem_addr_t doepctl_reg = dwc2_get_dxepctl_reg(dev, i); - uint32_t doepctl; + for (uint8_t i = 1U; i < priv->numdeveps; i++) { + uint32_t epdir = usb_dwc2_get_ghwcfg1_epdir(priv->ghwcfg1, i); - doepctl = sys_read32(doepctl_reg); + if (epdir == USB_DWC2_GHWCFG1_EPDIR_OUT || + epdir == USB_DWC2_GHWCFG1_EPDIR_BDIR) { + mem_addr_t doepctl_reg = dwc2_get_dxepctl_reg(dev, i); + uint32_t doepctl; - /* Check if endpoint didn't receive ISO OUT data */ - if ((doepctl & mask) == val) { - struct udc_ep_config *cfg; - struct net_buf *buf; + doepctl = sys_read32(doepctl_reg); - cfg = udc_get_ep_cfg(dev, i); - __ASSERT_NO_MSG(cfg && cfg->stat.enabled && - dwc2_ep_is_iso(cfg)); + /* Check if endpoint didn't receive ISO OUT data */ + if ((doepctl & mask) == val) { + struct udc_ep_config *cfg; + struct net_buf *buf; - udc_dwc2_ep_disable(dev, cfg, false); + cfg = udc_get_ep_cfg(dev, i); + __ASSERT_NO_MSG(cfg && cfg->stat.enabled && + dwc2_ep_is_iso(cfg)); - buf = udc_buf_get(cfg); - if (buf) { - udc_submit_ep_event(dev, buf, 0); + udc_dwc2_ep_disable(dev, cfg, false); + + buf = udc_buf_get(cfg); + if (buf) { + udc_submit_ep_event(dev, buf, 0); + } } } - - eps &= ~BIT(i); } sys_write32(USB_DWC2_GINTSTS_INCOMPISOOUT, gintsts_reg); From 9b60762d7beab41f4ceea825387108a000f9025a Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:01 +0300 Subject: [PATCH 1406/2141] Revert "[nrf fromtree] drivers: udc_dwc2: Use spin lock for synchronization" This reverts commit 089285f9ae55d10ace5a5e4c25f84e52ecf3c223. Signed-off-by: Jukka Rissanen --- drivers/usb/udc/udc_dwc2.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/usb/udc/udc_dwc2.c b/drivers/usb/udc/udc_dwc2.c index bebe7973a487..cb52f711fcbe 100644 --- a/drivers/usb/udc/udc_dwc2.c +++ b/drivers/usb/udc/udc_dwc2.c @@ -102,7 +102,6 @@ struct dwc2_reg_backup { /* Driver private data per instance */ struct udc_dwc2_data { - struct k_spinlock lock; struct k_thread thread_data; /* Main events the driver thread waits for */ struct k_event drv_evt; @@ -463,7 +462,7 @@ static int dwc2_tx_fifo_write(const struct device *dev, uint32_t max_xfersize, max_pktcnt, pktcnt; const uint32_t addnl = USB_MPS_ADDITIONAL_TRANSACTIONS(cfg->mps); const size_t d = sizeof(uint32_t); - k_spinlock_key_t key; + unsigned int key; uint32_t len; const bool is_periodic = dwc2_ep_is_periodic(cfg); const bool is_iso = dwc2_ep_is_iso(cfg); @@ -538,7 +537,7 @@ static int dwc2_tx_fifo_write(const struct device *dev, priv->tx_len[ep_idx] = len; /* Lock and write to endpoint FIFO */ - key = k_spin_lock(&priv->lock); + key = irq_lock(); /* Set number of packets and transfer size */ sys_write32((is_periodic ? usb_dwc2_set_dieptsizn_mc(1 + addnl) : 0) | @@ -550,7 +549,7 @@ static int dwc2_tx_fifo_write(const struct device *dev, /* Cannot continue unless buffer is bounced. Device will * cease to function. Is fatal error appropriate here? */ - k_spin_unlock(&priv->lock, key); + irq_unlock(key); return -ENOTSUP; } @@ -566,7 +565,7 @@ static int dwc2_tx_fifo_write(const struct device *dev, * no fifo is assigned to inactive endpoint and therefore it is * possible that the write will corrupt other endpoint fifo. */ - k_spin_unlock(&priv->lock, key); + irq_unlock(key); return -ENOENT; } @@ -616,7 +615,7 @@ static int dwc2_tx_fifo_write(const struct device *dev, } } - k_spin_unlock(&priv->lock, key); + irq_unlock(key); return 0; } From 4a72ba9ccc10991aa16f47195689cebeca7bafe7 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:01 +0300 Subject: [PATCH 1407/2141] Revert "[nrf fromtree] usb: device_next: rework CDC ACM serial for flash usage" This reverts commit 7f1894c15968cbd2ff32861243b12132210c6409. Signed-off-by: Jukka Rissanen --- .../device_next/app/Kconfig.cdc_acm_serial | 7 ------ subsys/usb/device_next/app/cdc_acm_serial.c | 25 ++++++++----------- 2 files changed, 11 insertions(+), 21 deletions(-) diff --git a/subsys/usb/device_next/app/Kconfig.cdc_acm_serial b/subsys/usb/device_next/app/Kconfig.cdc_acm_serial index 5192d5636d9e..dba212ba9baf 100644 --- a/subsys/usb/device_next/app/Kconfig.cdc_acm_serial +++ b/subsys/usb/device_next/app/Kconfig.cdc_acm_serial @@ -16,13 +16,6 @@ menuconfig CDC_ACM_SERIAL_INITIALIZE_AT_BOOT if CDC_ACM_SERIAL_INITIALIZE_AT_BOOT -config CDC_ACM_SERIAL_ENABLE_AT_BOOT - bool "USB device will be enabled at boot" - default y - help - When disabled, the application is responsible for enabling/disabling - the USB device. - config CDC_ACM_SERIAL_MANUFACTURER_STRING string "USB device manufacturer string descriptor" default "Zephyr Project" diff --git a/subsys/usb/device_next/app/cdc_acm_serial.c b/subsys/usb/device_next/app/cdc_acm_serial.c index af0814693030..6f8e64b3c8cf 100644 --- a/subsys/usb/device_next/app/cdc_acm_serial.c +++ b/subsys/usb/device_next/app/cdc_acm_serial.c @@ -12,7 +12,7 @@ #include #include -LOG_MODULE_REGISTER(cdc_acm_serial, CONFIG_USBD_LOG_LEVEL); +LOG_MODULE_REGISTER(cdc_acm_serial, LOG_LEVEL_DBG); /* * This is intended for use with cdc-acm-snippet or as a default serial backend @@ -79,19 +79,19 @@ static int cdc_acm_serial_init_device(void) err = usbd_add_descriptor(&cdc_acm_serial, &cdc_acm_serial_lang); if (err) { - LOG_ERR("Failed to initialize %s (%d)", "language descriptor", err); + LOG_ERR("Failed to initialize language descriptor (%d)", err); return err; } err = usbd_add_descriptor(&cdc_acm_serial, &cdc_acm_serial_mfr); if (err) { - LOG_ERR("Failed to initialize %s (%d)", "manufacturer descriptor", err); + LOG_ERR("Failed to initialize manufacturer descriptor (%d)", err); return err; } err = usbd_add_descriptor(&cdc_acm_serial, &cdc_acm_serial_product); if (err) { - LOG_ERR("Failed to initialize %s (%d)", "product descriptor", err); + LOG_ERR("Failed to initialize product descriptor (%d)", err); return err; } @@ -99,12 +99,11 @@ static int cdc_acm_serial_init_device(void) err = usbd_add_descriptor(&cdc_acm_serial, &cdc_acm_serial_sn); )) if (err) { - LOG_ERR("Failed to initialize %s (%d)", "SN descriptor", err); + LOG_ERR("Failed to initialize SN descriptor (%d)", err); return err; } - if (USBD_SUPPORTS_HIGH_SPEED && - usbd_caps_speed(&cdc_acm_serial) == USBD_SPEED_HS) { + if (usbd_caps_speed(&cdc_acm_serial) == USBD_SPEED_HS) { err = register_cdc_acm_0(&cdc_acm_serial, USBD_SPEED_HS); if (err) { return err; @@ -118,16 +117,14 @@ static int cdc_acm_serial_init_device(void) err = usbd_init(&cdc_acm_serial); if (err) { - LOG_ERR("Failed to initialize %s (%d)", "device support", err); + LOG_ERR("Failed to initialize device support"); return err; } - if (IS_ENABLED(CONFIG_CDC_ACM_SERIAL_ENABLE_AT_BOOT)) { - err = usbd_enable(&cdc_acm_serial); - if (err) { - LOG_ERR("Failed to enable %s (%d)", "device support", err); - return err; - } + err = usbd_enable(&cdc_acm_serial); + if (err) { + LOG_ERR("Failed to enable device support"); + return err; } return 0; From 89db49f0b3a255ef2f2b290e7dc178eb359a8cc6 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:02 +0300 Subject: [PATCH 1408/2141] Revert "[nrf fromtree] usb: update USBD_DESC_SERIAL_NUMBER_DEFINE macro description" This reverts commit e91055fb1e804a6914f6a04e54b0e5b0edb24a1a. Signed-off-by: Jukka Rissanen --- include/zephyr/usb/usbd.h | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/include/zephyr/usb/usbd.h b/include/zephyr/usb/usbd.h index 029741f076d0..27b684101b1e 100644 --- a/include/zephyr/usb/usbd.h +++ b/include/zephyr/usb/usbd.h @@ -629,11 +629,8 @@ static inline void *usbd_class_get_private(const struct usbd_class_data *const c * * This macro defines a descriptor node that, when added to the device context, * is automatically used as the serial number string descriptor. A valid serial - * number is obtained from @ref hwinfo_interface whenever this string - * descriptor is requested. - * - * @note The HWINFO driver must be available and the Kconfig option HWINFO - * enabled. + * number is generated from HWID (HWINFO= whenever this string descriptor is + * requested. * * @param d_name String descriptor node identifier. */ From 252ad24f90dc27647a3b5945f7391d89922c8e03 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:02 +0300 Subject: [PATCH 1409/2141] Revert "[nrf fromtree] usb: device_next: allow to limit number or digits in serial number" This reverts commit b622ad0225f08c7412f3a52b1bbce006375252ca. Signed-off-by: Jukka Rissanen --- subsys/usb/device_next/Kconfig | 10 ---------- subsys/usb/device_next/usbd_ch9.c | 25 ++++++++++++------------- 2 files changed, 12 insertions(+), 23 deletions(-) diff --git a/subsys/usb/device_next/Kconfig b/subsys/usb/device_next/Kconfig index 18b6860b0e6a..b72de53f0b34 100644 --- a/subsys/usb/device_next/Kconfig +++ b/subsys/usb/device_next/Kconfig @@ -96,16 +96,6 @@ config USBD_MSG_WORK_DELAY Message work may need to be delayed because the device stack is not yet ready to publish the message. The delay unit is milliseconds. -config USBD_HWINFO_DEVID_LENGTH - int "The length of the device ID requested from HWINFO in bytes" - depends on HWINFO - range 8 128 - default 16 - help - Each byte represents two digits in the serial number string - descriptor. This option can be used to limit the length requested - from HWINFO to a meaningful number of digits. - rsource "class/Kconfig" rsource "app/Kconfig.cdc_acm_serial" diff --git a/subsys/usb/device_next/usbd_ch9.c b/subsys/usb/device_next/usbd_ch9.c index 599eb1611788..3adb3574f0cb 100644 --- a/subsys/usb/device_next/usbd_ch9.c +++ b/subsys/usb/device_next/usbd_ch9.c @@ -533,13 +533,13 @@ static int sreq_get_desc_cfg(struct usbd_context *const uds_ctx, return 0; } -#define USBD_SN_ASCII7_LENGTH (CONFIG_USBD_HWINFO_DEVID_LENGTH * 2) +#define USBD_HWID_SN_MAX 32U /* Generate valid USB device serial number from hwid */ -static ssize_t get_sn_from_hwid(uint8_t sn[static USBD_SN_ASCII7_LENGTH]) +static ssize_t get_sn_from_hwid(uint8_t sn[static USBD_HWID_SN_MAX]) { static const char hex[] = "0123456789ABCDEF"; - uint8_t hwid[USBD_SN_ASCII7_LENGTH / 2U]; + uint8_t hwid[USBD_HWID_SN_MAX / 2U]; ssize_t hwid_len = -ENOSYS; if (IS_ENABLED(CONFIG_HWINFO)) { @@ -554,37 +554,36 @@ static ssize_t get_sn_from_hwid(uint8_t sn[static USBD_SN_ASCII7_LENGTH]) return hwid_len; } - for (ssize_t i = 0; i < MIN(hwid_len, sizeof(hwid)); i++) { + for (ssize_t i = 0; i < hwid_len; i++) { sn[i * 2] = hex[hwid[i] >> 4]; sn[i * 2 + 1] = hex[hwid[i] & 0xF]; } - return MIN(hwid_len, sizeof(hwid)) * 2; + return hwid_len * 2; } /* Copy and convert ASCII-7 string descriptor to UTF16-LE */ static void string_ascii7_to_utf16le(struct usbd_desc_node *const dn, struct net_buf *const buf, const uint16_t wLength) { - uint8_t sn_ascii7_str[USBD_SN_ASCII7_LENGTH]; + uint8_t hwid_sn[USBD_HWID_SN_MAX]; struct usb_desc_header head = { .bDescriptorType = dn->bDescriptorType, }; - const uint8_t *ascii7_str; + uint8_t *ascii7_str; size_t len; size_t i; - if (IS_ENABLED(CONFIG_HWINFO) && - dn->str.utype == USBD_DUT_STRING_SERIAL_NUMBER && dn->str.use_hwinfo) { - ssize_t sn_ascii7_str_len = get_sn_from_hwid(sn_ascii7_str); + if (dn->str.utype == USBD_DUT_STRING_SERIAL_NUMBER && dn->str.use_hwinfo) { + ssize_t hwid_len = get_sn_from_hwid(hwid_sn); - if (sn_ascii7_str_len < 0) { + if (hwid_len < 0) { errno = -ENOTSUP; return; } - head.bLength = sizeof(head) + sn_ascii7_str_len * 2; - ascii7_str = sn_ascii7_str; + head.bLength = sizeof(head) + hwid_len * 2; + ascii7_str = hwid_sn; } else { head.bLength = dn->bLength; ascii7_str = (uint8_t *)dn->ptr; From 3fe3d5c42c7c5b9beae59cc7d303e2e4165febd5 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:02 +0300 Subject: [PATCH 1410/2141] Revert "[nrf fromtree] usb: device_next: hide Kconfig option USBD_MSG_SLAB_COUNT if not used" This reverts commit 368aac815f1339735603ff4d5b7c862d2df43765. Signed-off-by: Jukka Rissanen --- subsys/usb/device_next/Kconfig | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/subsys/usb/device_next/Kconfig b/subsys/usb/device_next/Kconfig index b72de53f0b34..987ef5e546ee 100644 --- a/subsys/usb/device_next/Kconfig +++ b/subsys/usb/device_next/Kconfig @@ -74,6 +74,13 @@ config USBD_MAX_UDC_MSG help Maximum number of USB device controller events that can be queued. +config USBD_MSG_SLAB_COUNT + int "Maximum number of USB device notification messages" + range 4 64 + default 8 + help + Maximum number of USB device notification messages that can be queued. + config USBD_MSG_DEFERRED_MODE bool "Execute message callback from system workqueue" default y @@ -81,13 +88,6 @@ config USBD_MSG_DEFERRED_MODE Execute message callback from system workqueue. If disabled, message callback will be executed in the device stack context. -config USBD_MSG_SLAB_COUNT - int "Maximum number of USB device notification messages" if USBD_MSG_DEFERRED_MODE - range 4 64 - default 8 - help - Maximum number of USB device notification messages that can be queued. - config USBD_MSG_WORK_DELAY int "USB device notification messages work delay" if USBD_MSG_DEFERRED_MODE range 1 100 From d1a1996950929f77c5302fd58040ce5b719c5c97 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:02 +0300 Subject: [PATCH 1411/2141] Revert "[nrf fromtree] usb: device_next: add the missing const qualifier and save some RAM" This reverts commit b5d478d14b7ae33545de5e96ca9873366c458061. Signed-off-by: Jukka Rissanen --- include/zephyr/usb/usbd.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/include/zephyr/usb/usbd.h b/include/zephyr/usb/usbd.h index 27b684101b1e..1545af66c81c 100644 --- a/include/zephyr/usb/usbd.h +++ b/include/zephyr/usb/usbd.h @@ -43,6 +43,18 @@ extern "C" { /* Maximum bulk max packet size the stack supports */ #define USBD_MAX_BULK_MPS COND_CODE_1(USBD_SUPPORTS_HIGH_SPEED, (512), (64)) +/* + * The USB Unicode bString is encoded in UTF16LE, which means it takes up + * twice the amount of bytes than the same string encoded in ASCII7. + * Use this macro to determine the length of the bString array. + * + * bString length without null character: + * bString_length = (sizeof(initializer_string) - 1) * 2 + * or: + * bString_length = sizeof(initializer_string) * 2 - 2 + */ +#define USB_BSTRING_LENGTH(s) (sizeof(s) * 2 - 2) + /* * The length of the string descriptor (bLength) is calculated from the * size of the two octets bLength and bDescriptorType plus the @@ -562,7 +574,7 @@ static inline void *usbd_class_get_private(const struct usbd_class_data *const c * @param name Language string descriptor node identifier. */ #define USBD_DESC_LANG_DEFINE(name) \ - static const uint16_t langid_##name = sys_cpu_to_le16(0x0409); \ + static uint16_t langid_##name = sys_cpu_to_le16(0x0409); \ static struct usbd_desc_node name = { \ .str = { \ .idx = 0, \ @@ -585,7 +597,7 @@ static inline void *usbd_class_get_private(const struct usbd_class_data *const c * @param d_utype String descriptor usage type */ #define USBD_DESC_STRING_DEFINE(d_name, d_string, d_utype) \ - static const uint8_t ascii_##d_name[sizeof(d_string)] = d_string; \ + static uint8_t ascii_##d_name[USB_BSTRING_LENGTH(d_string)] = d_string; \ static struct usbd_desc_node d_name = { \ .str = { \ .utype = d_utype, \ From 3a340a1f38f1f63e63dfbd17ac450b1366d75ed5 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:02 +0300 Subject: [PATCH 1412/2141] Revert "[nrf fromtree] drivers: udc: disable SOF interrupt by default" This reverts commit ddd6b2e7af03aa6a520fa4cf65f22576c1018651. Signed-off-by: Jukka Rissanen --- drivers/usb/udc/udc_ambiq.c | 7 +++---- drivers/usb/udc/udc_dwc2.c | 20 ++++++++------------ drivers/usb/udc/udc_it82xx2.c | 9 ++++++--- drivers/usb/udc/udc_kinetis.c | 4 ++-- drivers/usb/udc/udc_max32.c | 2 +- drivers/usb/udc/udc_mcux_ehci.c | 2 +- drivers/usb/udc/udc_mcux_ip3511.c | 2 +- drivers/usb/udc/udc_nrf.c | 4 ++-- drivers/usb/udc/udc_numaker.c | 6 ++---- drivers/usb/udc/udc_renesas_ra.c | 2 +- drivers/usb/udc/udc_rpi_pico.c | 4 ++-- drivers/usb/udc/udc_sam0.c | 2 +- drivers/usb/udc/udc_skeleton.c | 4 ---- drivers/usb/udc/udc_stm32.c | 2 +- subsys/usb/device_next/class/Kconfig.uac2 | 1 - tests/drivers/udc/prj.conf | 1 - tests/subsys/usb/device_next/prj.conf | 1 - 17 files changed, 31 insertions(+), 42 deletions(-) diff --git a/drivers/usb/udc/udc_ambiq.c b/drivers/usb/udc/udc_ambiq.c index 9b2fdc0addbd..6e5f2603edd5 100644 --- a/drivers/usb/udc/udc_ambiq.c +++ b/drivers/usb/udc/udc_ambiq.c @@ -156,9 +156,8 @@ static void udc_ambiq_evt_callback(const struct device *dev, am_hal_usb_dev_even case AM_HAL_USB_DEV_EVT_BUS_RESET: /* enable usb bus interrupts */ am_hal_usb_intr_usb_enable(priv->usb_handle, - IF_ENABLED(CONFIG_UDC_ENABLE_SOF, (USB_CFG2_SOFE_Msk |)) - USB_CFG2_ResumeE_Msk | - USB_CFG2_SuspendE_Msk | USB_CFG2_ResetE_Msk); + USB_CFG2_SOFE_Msk | USB_CFG2_ResumeE_Msk | + USB_CFG2_SuspendE_Msk | USB_CFG2_ResetE_Msk); /* init the endpoint */ am_hal_usb_ep_init(priv->usb_handle, 0, 0, EP0_MPS); /* Set USB device speed to HAL */ @@ -175,7 +174,7 @@ static void udc_ambiq_evt_callback(const struct device *dev, am_hal_usb_dev_even udc_submit_event(dev, UDC_EVT_RESUME, 0); break; case AM_HAL_USB_DEV_EVT_SOF: - udc_submit_sof_event(dev); + udc_submit_event(dev, UDC_EVT_SOF, 0); break; case AM_HAL_USB_DEV_EVT_SUSPEND: /* Handle USB Suspend event, then set device state to suspended */ diff --git a/drivers/usb/udc/udc_dwc2.c b/drivers/usb/udc/udc_dwc2.c index cb52f711fcbe..856324942d03 100644 --- a/drivers/usb/udc/udc_dwc2.c +++ b/drivers/usb/udc/udc_dwc2.c @@ -2163,12 +2163,11 @@ static int udc_dwc2_init_controller(const struct device *dev) } /* Unmask interrupts */ - sys_write32(IF_ENABLED(CONFIG_UDC_ENABLE_SOF, (USB_DWC2_GINTSTS_SOF | - USB_DWC2_GINTSTS_INCOMPISOOUT | - USB_DWC2_GINTSTS_INCOMPISOIN |)) - USB_DWC2_GINTSTS_OEPINT | USB_DWC2_GINTSTS_IEPINT | + sys_write32(USB_DWC2_GINTSTS_OEPINT | USB_DWC2_GINTSTS_IEPINT | USB_DWC2_GINTSTS_ENUMDONE | USB_DWC2_GINTSTS_USBRST | - USB_DWC2_GINTSTS_WKUPINT | USB_DWC2_GINTSTS_USBSUSP, + USB_DWC2_GINTSTS_WKUPINT | USB_DWC2_GINTSTS_USBSUSP | + USB_DWC2_GINTSTS_INCOMPISOOUT | USB_DWC2_GINTSTS_INCOMPISOIN | + USB_DWC2_GINTSTS_SOF, (mem_addr_t)&base->gintmsk); return 0; @@ -2892,8 +2891,7 @@ static void udc_dwc2_isr_handler(const struct device *dev) LOG_DBG("GINTSTS 0x%x", int_status); - if (IS_ENABLED(CONFIG_UDC_ENABLE_SOF) && - int_status & USB_DWC2_GINTSTS_SOF) { + if (int_status & USB_DWC2_GINTSTS_SOF) { uint32_t dsts; /* Clear USB SOF interrupt. */ @@ -2901,7 +2899,7 @@ static void udc_dwc2_isr_handler(const struct device *dev) dsts = sys_read32((mem_addr_t)&base->dsts); priv->sof_num = usb_dwc2_get_dsts_soffn(dsts); - udc_submit_sof_event(dev); + udc_submit_event(dev, UDC_EVT_SOF, 0); } if (int_status & USB_DWC2_GINTSTS_USBRST) { @@ -2944,13 +2942,11 @@ static void udc_dwc2_isr_handler(const struct device *dev) dwc2_handle_oepint(dev); } - if (IS_ENABLED(CONFIG_UDC_ENABLE_SOF) && - int_status & USB_DWC2_GINTSTS_INCOMPISOIN) { + if (int_status & USB_DWC2_GINTSTS_INCOMPISOIN) { dwc2_handle_incompisoin(dev); } - if (IS_ENABLED(CONFIG_UDC_ENABLE_SOF) && - int_status & USB_DWC2_GINTSTS_INCOMPISOOUT) { + if (int_status & USB_DWC2_GINTSTS_INCOMPISOOUT) { dwc2_handle_incompisoout(dev); } diff --git a/drivers/usb/udc/udc_it82xx2.c b/drivers/usb/udc/udc_it82xx2.c index 6b41cb162d49..85ec9431c635 100644 --- a/drivers/usb/udc/udc_it82xx2.c +++ b/drivers/usb/udc/udc_it82xx2.c @@ -17,6 +17,9 @@ LOG_MODULE_REGISTER(udc_it82xx2, CONFIG_UDC_DRIVER_LOG_LEVEL); #define DT_DRV_COMPAT ite_it82xx2_usb +/* TODO: Replace this definition by Kconfig option */ +#define USB_DEVICE_CONFIG_SOF_NOTIFICATIONS (0U) + #define IT8XXX2_IS_EXTEND_ENDPOINT(n) (USB_EP_GET_IDX(n) >= 4) #define IT82xx2_STATE_OUT_SHARED_FIFO_BUSY 0 @@ -1354,11 +1357,11 @@ static void it82xx2_usb_dc_isr(const void *arg) /* sof received */ if (status & DC_SOF_RECEIVED) { - if (!IS_ENABLED(CONFIG_UDC_ENABLE_SOF)) { + if (!USB_DEVICE_CONFIG_SOF_NOTIFICATIONS) { it82xx2_enable_sof_int(dev, false); } else { usb_regs->dc_interrupt_status = DC_SOF_RECEIVED; - udc_submit_sof_event(dev); + udc_submit_event(dev, UDC_EVT_SOF, 0); } it82xx2_enable_resume_int(dev, false); emit_resume_event(dev); @@ -1408,7 +1411,7 @@ static void suspended_handler(struct k_work *item) it82xx2_enable_resume_int(dev, true); - if (!IS_ENABLED(CONFIG_UDC_ENABLE_SOF)) { + if (!USB_DEVICE_CONFIG_SOF_NOTIFICATIONS) { it82xx2_enable_sof_int(dev, true); } diff --git a/drivers/usb/udc/udc_kinetis.c b/drivers/usb/udc/udc_kinetis.c index 7d2273016039..8858ee129c4f 100644 --- a/drivers/usb/udc/udc_kinetis.c +++ b/drivers/usb/udc/udc_kinetis.c @@ -653,7 +653,7 @@ static void usbfsotg_isr_handler(const struct device *dev) } if (istatus == USB_ISTAT_SOFTOK_MASK) { - udc_submit_sof_event(dev); + udc_submit_event(dev, UDC_EVT_SOF, 0); } if (istatus == USB_ISTAT_ERROR_MASK) { @@ -1016,7 +1016,7 @@ static int usbfsotg_init(const struct device *dev) base->INTEN = (USB_INTEN_SLEEPEN_MASK | USB_INTEN_STALLEN_MASK | USB_INTEN_TOKDNEEN_MASK | - IF_ENABLED(CONFIG_UDC_ENABLE_SOF, (USB_INTEN_SOFTOKEN_MASK |)) + USB_INTEN_SOFTOKEN_MASK | USB_INTEN_ERROREN_MASK | USB_INTEN_USBRSTEN_MASK); diff --git a/drivers/usb/udc/udc_max32.c b/drivers/usb/udc/udc_max32.c index 526a49b8ba91..1e09f5ef7c6d 100644 --- a/drivers/usb/udc/udc_max32.c +++ b/drivers/usb/udc/udc_max32.c @@ -533,7 +533,7 @@ static int udc_max32_event_callback(maxusb_event_t event, void *cbdata) case MAXUSB_EVENT_DPACT: LOG_DBG("DPACT event occurred"); udc_set_suspended(dev, false); - udc_submit_sof_event(dev); + udc_submit_event(dev, UDC_EVT_SOF, 0); break; case MAXUSB_EVENT_BRST: LOG_DBG("BRST event occurred"); diff --git a/drivers/usb/udc/udc_mcux_ehci.c b/drivers/usb/udc/udc_mcux_ehci.c index 041f9b759b19..fc95f7a91d7e 100644 --- a/drivers/usb/udc/udc_mcux_ehci.c +++ b/drivers/usb/udc/udc_mcux_ehci.c @@ -531,7 +531,7 @@ usb_status_t USB_DeviceNotificationTrigger(void *handle, void *msg) udc_submit_event(dev, UDC_EVT_VBUS_READY, 0); break; case kUSB_DeviceNotifySOF: - udc_submit_sof_event(dev); + udc_submit_event(dev, UDC_EVT_SOF, 0); break; default: udc_mcux_event_submit(dev, mcux_msg); diff --git a/drivers/usb/udc/udc_mcux_ip3511.c b/drivers/usb/udc/udc_mcux_ip3511.c index c6aab0d0bb1b..312acae17845 100644 --- a/drivers/usb/udc/udc_mcux_ip3511.c +++ b/drivers/usb/udc/udc_mcux_ip3511.c @@ -531,7 +531,7 @@ usb_status_t USB_DeviceNotificationTrigger(void *handle, void *msg) udc_submit_event(dev, UDC_EVT_VBUS_READY, 0); break; case kUSB_DeviceNotifySOF: - udc_submit_sof_event(dev); + udc_submit_event(dev, UDC_EVT_SOF, 0); break; default: udc_mcux_event_submit(dev, mcux_msg); diff --git a/drivers/usb/udc/udc_nrf.c b/drivers/usb/udc/udc_nrf.c index 7b18862fa596..71eebbd70d3e 100644 --- a/drivers/usb/udc/udc_nrf.c +++ b/drivers/usb/udc/udc_nrf.c @@ -436,7 +436,7 @@ static void ev_sof_handler(void) m_ep_armed &= ~USBD_EPISO_BIT_MASK; - udc_submit_sof_event(udc_nrf_dev); + udc_submit_event(udc_nrf_dev, UDC_EVT_SOF, 0); } static void usbd_in_packet_sent(uint8_t ep) @@ -1547,7 +1547,7 @@ static void udc_nrf_power_handler(nrfx_power_usb_evt_t pwr_evt) break; case NRFX_POWER_USB_EVT_READY: LOG_DBG("POWER event ready"); - nrf_usbd_legacy_start(IS_ENABLED(CONFIG_UDC_ENABLE_SOF)); + nrf_usbd_legacy_start(true); break; case NRFX_POWER_USB_EVT_REMOVED: LOG_DBG("POWER event removed"); diff --git a/drivers/usb/udc/udc_numaker.c b/drivers/usb/udc/udc_numaker.c index 43630010caa2..bbc016ecf706 100644 --- a/drivers/usb/udc/udc_numaker.c +++ b/drivers/usb/udc/udc_numaker.c @@ -171,9 +171,7 @@ static inline void numaker_usbd_sw_connect(const struct device *dev) base->INTSTS = base->INTSTS; /* Enable relevant interrupts */ - base->INTEN = USBD_INT_BUS | USBD_INT_USB | USBD_INT_FLDET | - IF_ENABLED(CONFIG_UDC_ENABLE_SOF, (USBD_INT_SOF |)) - USBD_INT_WAKEUP; + base->INTEN = USBD_INT_BUS | USBD_INT_USB | USBD_INT_FLDET | USBD_INT_WAKEUP | USBD_INT_SOF; /* Clear SE0 for connect */ base->SE0 &= ~USBD_DRVSE0; @@ -1300,7 +1298,7 @@ static void numaker_udbd_isr(const struct device *dev) base->INTSTS = USBD_INTSTS_SOFIF_Msk; /* UDC stack would handle bottom-half processing */ - udc_submit_sof_event(dev); + udc_submit_event(dev, UDC_EVT_SOF, 0); } /* USB Setup/EP */ diff --git a/drivers/usb/udc/udc_renesas_ra.c b/drivers/usb/udc/udc_renesas_ra.c index 4a3123ec2b9c..fa98fda46ace 100644 --- a/drivers/usb/udc/udc_renesas_ra.c +++ b/drivers/usb/udc/udc_renesas_ra.c @@ -79,7 +79,7 @@ static void udc_renesas_ra_event_handler(usbd_callback_arg_t *p_args) break; case USBD_EVENT_SOF: - udc_submit_sof_event(dev); + udc_submit_event(dev, UDC_EVT_SOF, 0); break; default: diff --git a/drivers/usb/udc/udc_rpi_pico.c b/drivers/usb/udc/udc_rpi_pico.c index 70ebf047399d..31561f6fce6b 100644 --- a/drivers/usb/udc/udc_rpi_pico.c +++ b/drivers/usb/udc/udc_rpi_pico.c @@ -678,7 +678,7 @@ static void rpi_pico_isr_handler(const struct device *dev) if (status & USB_INTS_DEV_SOF_BITS) { handled |= USB_INTS_DEV_SOF_BITS; - udc_submit_sof_event(dev); + sys_read32((mm_reg_t)&base->sof_rd); } if (status & USB_INTS_DEV_CONN_DIS_BITS) { @@ -1048,7 +1048,7 @@ static int udc_rpi_pico_enable(const struct device *dev) sys_write32(USB_SIE_CTRL_EP0_INT_1BUF_BITS, (mm_reg_t)&base->sie_ctrl); /* Enable interrupts */ - sys_write32(IF_ENABLED(CONFIG_UDC_ENABLE_SOF, (USB_INTE_DEV_SOF_BITS |)) + sys_write32(USB_INTE_DEV_SOF_BITS | USB_INTE_SETUP_REQ_BITS | USB_INTE_DEV_RESUME_FROM_HOST_BITS | USB_INTE_DEV_SUSPEND_BITS | diff --git a/drivers/usb/udc/udc_sam0.c b/drivers/usb/udc/udc_sam0.c index e351c98e284b..dab462a03faf 100644 --- a/drivers/usb/udc/udc_sam0.c +++ b/drivers/usb/udc/udc_sam0.c @@ -693,7 +693,7 @@ static void sam0_isr_handler(const struct device *dev) base->INTFLAG.reg = intflag; if (intflag & USB_DEVICE_INTFLAG_SOF) { - udc_submit_sof_event(dev); + udc_submit_event(dev, UDC_EVT_SOF, 0); } if (intflag & USB_DEVICE_INTFLAG_EORST) { diff --git a/drivers/usb/udc/udc_skeleton.c b/drivers/usb/udc/udc_skeleton.c index 2c9be371dec2..c808cc98ad85 100644 --- a/drivers/usb/udc/udc_skeleton.c +++ b/drivers/usb/udc/udc_skeleton.c @@ -233,10 +233,6 @@ static int udc_skeleton_init(const struct device *dev) return -EIO; } - if (IS_ENABLED(CONFIG_UDC_ENABLE_SOF)) { - LOG_INF("Enable SOF interrupt"); - } - return 0; } diff --git a/drivers/usb/udc/udc_stm32.c b/drivers/usb/udc/udc_stm32.c index f773a1c641db..6cc8c4add1c7 100644 --- a/drivers/usb/udc/udc_stm32.c +++ b/drivers/usb/udc/udc_stm32.c @@ -182,7 +182,7 @@ void HAL_PCD_SOFCallback(PCD_HandleTypeDef *hpcd) { struct udc_stm32_data *priv = hpcd2data(hpcd); - udc_submit_sof_event(priv->dev); + udc_submit_event(priv->dev, UDC_EVT_SOF, 0); } static int usbd_ctrl_feed_dout(const struct device *dev, const size_t length) diff --git a/subsys/usb/device_next/class/Kconfig.uac2 b/subsys/usb/device_next/class/Kconfig.uac2 index 5c19e0542c3e..ad6fb54b38a8 100644 --- a/subsys/usb/device_next/class/Kconfig.uac2 +++ b/subsys/usb/device_next/class/Kconfig.uac2 @@ -4,7 +4,6 @@ config USBD_AUDIO2_CLASS bool "USB Audio 2 class support [EXPERIMENTAL]" - select UDC_ENABLE_SOF help USB Audio 2 device class support. diff --git a/tests/drivers/udc/prj.conf b/tests/drivers/udc/prj.conf index 975887e579c1..380d5e74b996 100644 --- a/tests/drivers/udc/prj.conf +++ b/tests/drivers/udc/prj.conf @@ -5,7 +5,6 @@ CONFIG_LOG=y CONFIG_ZTEST=y CONFIG_UDC_DRIVER=y -CONFIG_UDC_ENABLE_SOF=y CONFIG_UDC_BUF_COUNT=16 CONFIG_UDC_BUF_POOL_SIZE=16384 CONFIG_UDC_DRIVER_LOG_LEVEL_INF=y diff --git a/tests/subsys/usb/device_next/prj.conf b/tests/subsys/usb/device_next/prj.conf index 05fc7b0b0287..54321edc9523 100644 --- a/tests/subsys/usb/device_next/prj.conf +++ b/tests/subsys/usb/device_next/prj.conf @@ -6,7 +6,6 @@ CONFIG_ZTEST=y CONFIG_USB_DEVICE_STACK_NEXT=y CONFIG_USBD_LOOPBACK_CLASS=y -CONFIG_UDC_ENABLE_SOF=y CONFIG_UHC_DRIVER=y CONFIG_USB_HOST_STACK=y From e14856995d3d83b4a656273c048aa205faeb5ecd Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:02 +0300 Subject: [PATCH 1413/2141] Revert "[nrf fromtree] drivers: udc: add SOF Kconfig option and SOF event helper" This reverts commit ab54afcda7afe12408f1dbb636a231894e085606. Signed-off-by: Jukka Rissanen --- drivers/usb/udc/Kconfig | 6 ------ drivers/usb/udc/udc_common.h | 23 ----------------------- 2 files changed, 29 deletions(-) diff --git a/drivers/usb/udc/Kconfig b/drivers/usb/udc/Kconfig index b2c646343156..b6c49e6b3e7a 100644 --- a/drivers/usb/udc/Kconfig +++ b/drivers/usb/udc/Kconfig @@ -42,12 +42,6 @@ config UDC_BUF_FORCE_NOCACHE Place the buffer pools in the nocache memory region if the driver cannot handle buffers in cached memory. -config UDC_ENABLE_SOF - bool "SOF interrupt processing" - help - Enabled SoF interrupts can cause a very high CPU load on high-speed - controllers because the interrupt rate would be 125 µs. - config UDC_WORKQUEUE bool "Use a dedicate work queue for UDC drivers" help diff --git a/drivers/usb/udc/udc_common.h b/drivers/usb/udc/udc_common.h index ed6712e95ae8..8cad6b6dd1c5 100644 --- a/drivers/usb/udc/udc_common.h +++ b/drivers/usb/udc/udc_common.h @@ -156,29 +156,6 @@ int udc_submit_event(const struct device *dev, int udc_submit_ep_event(const struct device *dev, struct net_buf *const buf, const int err); - -/** - * @brief Helper function to send UDC SOF event to a higher level. - * - * Type of this event is hardcoded to UDC_EVT_SOF. - * - * @param[in] dev Pointer to device struct of the driver instance - */ -#if defined(CONFIG_UDC_ENABLE_SOF) -static inline void udc_submit_sof_event(const struct device *dev) -{ - struct udc_data *data = dev->data; - struct udc_event drv_evt = { - .type = UDC_EVT_SOF, - .dev = dev, - }; - - (void)data->event_cb(dev, &drv_evt); -} -#else -#define udc_submit_sof_event(dev) ARG_UNUSED(dev) -#endif - /** * @brief Helper function to enable endpoint. * From 2c240d7d31d048b8b65170710b4d6ecbbaf39146 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:02 +0300 Subject: [PATCH 1414/2141] Revert "[nrf fromtree] drivers: udc_dwc2: Disable control IN endpoint on SETUP" This reverts commit 105b0e521217db2470538c6c80ca38c46d33b96c. Signed-off-by: Jukka Rissanen --- drivers/usb/udc/udc_dwc2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/udc/udc_dwc2.c b/drivers/usb/udc/udc_dwc2.c index 856324942d03..02652e0bfc11 100644 --- a/drivers/usb/udc/udc_dwc2.c +++ b/drivers/usb/udc/udc_dwc2.c @@ -824,7 +824,6 @@ static int dwc2_handle_evt_setup(const struct device *dev) * transfer beforehand. In Buffer DMA the SETUP can be copied to any EP0 * OUT buffer. If there is any buffer queued, it is obsolete now. */ - udc_dwc2_ep_disable(dev, cfg_in, false); atomic_and(&priv->xfer_finished, ~(BIT(0) | BIT(16))); buf = udc_buf_get_all(cfg_out); @@ -834,6 +833,7 @@ static int dwc2_handle_evt_setup(const struct device *dev) buf = udc_buf_get_all(cfg_in); if (buf) { + udc_dwc2_ep_disable(dev, cfg_in, false); net_buf_unref(buf); } From 35c00002cd4610dc7704e4c739582f1b9f5cd438 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:02 +0300 Subject: [PATCH 1415/2141] Revert "[nrf fromtree] drivers: udc_dwc2: Inline vendor quirks if possible" This reverts commit 70ef15a212ab88bb942822923fdb101ce1fb83ef. Signed-off-by: Jukka Rissanen --- drivers/usb/udc/udc_dwc2.c | 10 ++++++++-- drivers/usb/udc/udc_dwc2.h | 16 +++------------- drivers/usb/udc/udc_dwc2_vendor_quirks.h | 17 ++++++++++------- 3 files changed, 21 insertions(+), 22 deletions(-) diff --git a/drivers/usb/udc/udc_dwc2.c b/drivers/usb/udc/udc_dwc2.c index 02652e0bfc11..269dfd56ee56 100644 --- a/drivers/usb/udc/udc_dwc2.c +++ b/drivers/usb/udc/udc_dwc2.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -#define DT_DRV_COMPAT snps_dwc2 - #include "udc_common.h" #include "udc_dwc2.h" @@ -24,6 +22,7 @@ #include LOG_MODULE_REGISTER(udc_dwc2, CONFIG_UDC_DRIVER_LOG_LEVEL); +#include "udc_dwc2_vendor_quirks.h" enum dwc2_drv_event_type { /* USB connection speed determined after bus reset */ @@ -3197,6 +3196,13 @@ static const struct udc_api udc_dwc2_api = { .ep_dequeue = udc_dwc2_ep_dequeue, }; +#define DT_DRV_COMPAT snps_dwc2 + +#define UDC_DWC2_VENDOR_QUIRK_GET(n) \ + COND_CODE_1(DT_NODE_VENDOR_HAS_IDX(DT_DRV_INST(n), 1), \ + (&dwc2_vendor_quirks_##n), \ + (NULL)) + #define UDC_DWC2_DT_INST_REG_ADDR(n) \ COND_CODE_1(DT_NUM_REGS(DT_DRV_INST(n)), (DT_INST_REG_ADDR(n)), \ (DT_INST_REG_ADDR_BY_NAME(n, core))) diff --git a/drivers/usb/udc/udc_dwc2.h b/drivers/usb/udc/udc_dwc2.h index 77be96adaa5f..87e71f818991 100644 --- a/drivers/usb/udc/udc_dwc2.h +++ b/drivers/usb/udc/udc_dwc2.h @@ -46,7 +46,7 @@ struct udc_dwc2_config { /* Pointer to pin control configuration or NULL */ struct pinctrl_dev_config *const pcfg; /* Pointer to vendor quirks or NULL */ - const struct dwc2_vendor_quirks *const quirks; + struct dwc2_vendor_quirks *const quirks; void (*make_thread)(const struct device *dev); void (*irq_enable_func)(const struct device *dev); void (*irq_disable_func)(const struct device *dev); @@ -55,23 +55,13 @@ struct udc_dwc2_config { uint32_t ghwcfg4; }; -#include "udc_dwc2_vendor_quirks.h" - -#define UDC_DWC2_VENDOR_QUIRK_GET(n) \ - COND_CODE_1(DT_NODE_VENDOR_HAS_IDX(DT_DRV_INST(n), 1), \ - (&dwc2_vendor_quirks_##n), \ - (NULL)) - #define DWC2_QUIRK_FUNC_DEFINE(fname) \ static inline int dwc2_quirk_##fname(const struct device *dev) \ { \ const struct udc_dwc2_config *const config = dev->config; \ - const struct dwc2_vendor_quirks *const quirks = \ - COND_CODE_1(IS_EQ(DT_NUM_INST_STATUS_OKAY(snps_dwc2), 1), \ - (UDC_DWC2_VENDOR_QUIRK_GET(0); ARG_UNUSED(config);), \ - (config->quirks;)) \ + struct dwc2_vendor_quirks *quirks = config->quirks; \ \ - if (quirks != NULL && quirks->fname != NULL) { \ + if (quirks != NULL && config->quirks->fname != NULL) { \ return quirks->fname(dev); \ } \ \ diff --git a/drivers/usb/udc/udc_dwc2_vendor_quirks.h b/drivers/usb/udc/udc_dwc2_vendor_quirks.h index f5a70063c2e2..0a1021881399 100644 --- a/drivers/usb/udc/udc_dwc2_vendor_quirks.h +++ b/drivers/usb/udc/udc_dwc2_vendor_quirks.h @@ -25,6 +25,8 @@ struct usb_dw_stm32_clk { size_t pclken_len; }; +#define DT_DRV_COMPAT snps_dwc2 + static inline int stm32f4_fsotg_enable_clk(const struct usb_dw_stm32_clk *const clk) { int ret; @@ -92,7 +94,7 @@ static inline int stm32f4_fsotg_disable_phy(const struct device *dev) return stm32f4_fsotg_enable_clk(&stm32f4_clk_##n); \ } \ \ - const struct dwc2_vendor_quirks dwc2_vendor_quirks_##n = { \ + struct dwc2_vendor_quirks dwc2_vendor_quirks_##n = { \ .pre_enable = stm32f4_fsotg_enable_clk_##n, \ .post_enable = stm32f4_fsotg_enable_phy, \ .disable = stm32f4_fsotg_disable_phy, \ @@ -102,11 +104,14 @@ static inline int stm32f4_fsotg_disable_phy(const struct device *dev) DT_INST_FOREACH_STATUS_OKAY(QUIRK_STM32F4_FSOTG_DEFINE) +#undef DT_DRV_COMPAT + #endif /*DT_HAS_COMPAT_STATUS_OKAY(st_stm32f4_fsotg) */ #if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_usbhs) -#include +#define DT_DRV_COMPAT snps_dwc2 + #include #include @@ -124,7 +129,6 @@ static K_EVENT_DEFINE(usbhs_events); static void usbhs_vbus_handler(nrfs_usb_evt_t const *p_evt, void *const context) { - LOG_MODULE_DECLARE(udc_dwc2, CONFIG_UDC_DRIVER_LOG_LEVEL); const struct device *dev = context; switch (p_evt->type) { @@ -152,7 +156,6 @@ static void usbhs_vbus_handler(nrfs_usb_evt_t const *p_evt, void *const context) static inline int usbhs_enable_nrfs_service(const struct device *dev) { - LOG_MODULE_DECLARE(udc_dwc2, CONFIG_UDC_DRIVER_LOG_LEVEL); nrfs_err_t nrfs_err; int err; @@ -179,7 +182,6 @@ static inline int usbhs_enable_nrfs_service(const struct device *dev) static inline int usbhs_enable_core(const struct device *dev) { - LOG_MODULE_DECLARE(udc_dwc2, CONFIG_UDC_DRIVER_LOG_LEVEL); NRF_USBHS_Type *wrapper = USBHS_DT_WRAPPER_REG_ADDR(0); k_timeout_t timeout = K_FOREVER; @@ -227,7 +229,6 @@ static inline int usbhs_disable_core(const struct device *dev) static inline int usbhs_disable_nrfs_service(const struct device *dev) { - LOG_MODULE_DECLARE(udc_dwc2, CONFIG_UDC_DRIVER_LOG_LEVEL); nrfs_err_t nrfs_err; nrfs_err = nrfs_usb_disable_request((void *)dev); @@ -296,7 +297,7 @@ static inline int usbhs_pre_hibernation_exit(const struct device *dev) } #define QUIRK_NRF_USBHS_DEFINE(n) \ - const struct dwc2_vendor_quirks dwc2_vendor_quirks_##n = { \ + struct dwc2_vendor_quirks dwc2_vendor_quirks_##n = { \ .init = usbhs_enable_nrfs_service, \ .pre_enable = usbhs_enable_core, \ .disable = usbhs_disable_core, \ @@ -310,6 +311,8 @@ static inline int usbhs_pre_hibernation_exit(const struct device *dev) DT_INST_FOREACH_STATUS_OKAY(QUIRK_NRF_USBHS_DEFINE) +#undef DT_DRV_COMPAT + #endif /*DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_usbhs) */ /* Add next vendor quirks definition above this line */ From e1c02dde73b6f7fbe19075e936a7b6a8d8dbe84f Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:02 +0300 Subject: [PATCH 1416/2141] Revert "[nrf fromtree] samples: usb: uac2: Implement feedback on nRF54H20" This reverts commit da47bd000e764bfee47ada326729877fbff2a805. Signed-off-by: Jukka Rissanen --- .../usb/uac2_explicit_feedback/CMakeLists.txt | 4 +- .../subsys/usb/uac2_explicit_feedback/Kconfig | 2 - .../boards/nrf54h20dk_nrf54h20_cpuapp.conf | 8 --- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 72 ------------------- .../usb/uac2_explicit_feedback/sample.yaml | 4 +- .../src/{feedback_nrf.c => feedback_nrf53.c} | 59 +++------------ .../usb/uac2_implicit_feedback/CMakeLists.txt | 4 +- .../boards/nrf54h20dk_nrf54h20_cpuapp.conf | 7 -- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 67 ----------------- .../usb/uac2_implicit_feedback/sample.yaml | 4 +- .../src/{feedback_nrf.c => feedback_nrf53.c} | 43 ++--------- 11 files changed, 21 insertions(+), 253 deletions(-) delete mode 100644 samples/subsys/usb/uac2_explicit_feedback/boards/nrf54h20dk_nrf54h20_cpuapp.conf delete mode 100644 samples/subsys/usb/uac2_explicit_feedback/boards/nrf54h20dk_nrf54h20_cpuapp.overlay rename samples/subsys/usb/uac2_explicit_feedback/src/{feedback_nrf.c => feedback_nrf53.c} (89%) delete mode 100644 samples/subsys/usb/uac2_implicit_feedback/boards/nrf54h20dk_nrf54h20_cpuapp.conf delete mode 100644 samples/subsys/usb/uac2_implicit_feedback/boards/nrf54h20dk_nrf54h20_cpuapp.overlay rename samples/subsys/usb/uac2_implicit_feedback/src/{feedback_nrf.c => feedback_nrf53.c} (85%) diff --git a/samples/subsys/usb/uac2_explicit_feedback/CMakeLists.txt b/samples/subsys/usb/uac2_explicit_feedback/CMakeLists.txt index 56bba10717c0..26ce264c4217 100644 --- a/samples/subsys/usb/uac2_explicit_feedback/CMakeLists.txt +++ b/samples/subsys/usb/uac2_explicit_feedback/CMakeLists.txt @@ -7,8 +7,8 @@ project(usb_audio_async_i2s) include(${ZEPHYR_BASE}/samples/subsys/usb/common/common.cmake) target_sources(app PRIVATE src/main.c) -if (CONFIG_SOC_COMPATIBLE_NRF5340_CPUAPP OR CONFIG_SOC_SERIES_NRF54HX) - target_sources(app PRIVATE src/feedback_nrf.c) +if (CONFIG_SOC_COMPATIBLE_NRF5340_CPUAPP) + target_sources(app PRIVATE src/feedback_nrf53.c) else() target_sources(app PRIVATE src/feedback_dummy.c) endif() diff --git a/samples/subsys/usb/uac2_explicit_feedback/Kconfig b/samples/subsys/usb/uac2_explicit_feedback/Kconfig index 76373b614695..bee6118a00d6 100644 --- a/samples/subsys/usb/uac2_explicit_feedback/Kconfig +++ b/samples/subsys/usb/uac2_explicit_feedback/Kconfig @@ -9,8 +9,6 @@ config APP_USE_I2S_LRCLK_EDGES_COUNTER Use this to use I2S LRCLK edge counting for calculating feedback. On nRF53 this option requires externally connecting I2S LRCLK back to separate GPIOTE input pin (P1.09). - On nRF54 this option requires externally connecting TDM FSYNC back to - separate GPIOTE input pin (P0.08). endmenu # Source common USB sample options used to initialize new experimental USB diff --git a/samples/subsys/usb/uac2_explicit_feedback/boards/nrf54h20dk_nrf54h20_cpuapp.conf b/samples/subsys/usb/uac2_explicit_feedback/boards/nrf54h20dk_nrf54h20_cpuapp.conf deleted file mode 100644 index 0e35fa1f491e..000000000000 --- a/samples/subsys/usb/uac2_explicit_feedback/boards/nrf54h20dk_nrf54h20_cpuapp.conf +++ /dev/null @@ -1,8 +0,0 @@ -# Enable timer for asynchronous feedback -CONFIG_NRFX_GPPI=y -CONFIG_NRFX_TIMER131=y -CONFIG_NRFX_GPIOTE130=y - -# Sample is Full-Speed only, prevent High-Speed enumeration -CONFIG_UDC_DRIVER_HIGH_SPEED_SUPPORT_ENABLED=n -CONFIG_USBD_MAX_SPEED_FULL=y diff --git a/samples/subsys/usb/uac2_explicit_feedback/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/samples/subsys/usb/uac2_explicit_feedback/boards/nrf54h20dk_nrf54h20_cpuapp.overlay deleted file mode 100644 index 0e6b18cbae91..000000000000 --- a/samples/subsys/usb/uac2_explicit_feedback/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include "../app.overlay" - -&pinctrl { - tdm130_default_alt: tdm130_default_alt { - group1 { - psels = , - , - ; - }; - }; -}; - -i2s_tx: &tdm130 { - status = "okay"; - pinctrl-0 = <&tdm130_default_alt>; - pinctrl-names = "default"; - memory-regions = <&cpuapp_dma_region>; - mck-clock-source = "ACLK"; - sck-clock-source = "ACLK"; -}; - -&audiopll { - frequency = ; - status = "okay"; -}; - -&cpuapp_dma_region { - status = "okay"; -}; - -/* PPI channel 0 for TDM130 MAXCNT */ -&dppic132 { - compatible = "nordic,nrf-dppic-global"; - owned-channels = <0>; - source-channels = <0>; - nonsecure-channels = <0>; - status = "okay"; -}; - -/* PPI channel 1 for GPIOTE used for feedback in edge counter mode */ -&gpiote130 { - status = "okay"; - owned-channels = <1>; -}; - -/* GPIOTE130 and TDM130 PPI needs routing to TIMER131 through main APB */ -&dppic130 { - compatible = "nordic,nrf-dppic-global"; - owned-channels = <0 1>; - sink-channels = <0 1>; - source-channels = <0 1>; - nonsecure-channels = <0 1>; - status = "okay"; -}; - -/* TIMER131 PPI channel 2 is used for SOF */ -&dppic133 { - compatible = "nordic,nrf-dppic-global"; - owned-channels = <0 1 2>; - sink-channels = <0 1 2>; - status = "okay"; -}; - -&timer131 { - status = "okay"; -}; diff --git a/samples/subsys/usb/uac2_explicit_feedback/sample.yaml b/samples/subsys/usb/uac2_explicit_feedback/sample.yaml index 9a58d1b64439..bc0797a9812a 100644 --- a/samples/subsys/usb/uac2_explicit_feedback/sample.yaml +++ b/samples/subsys/usb/uac2_explicit_feedback/sample.yaml @@ -8,7 +8,5 @@ tests: tags: - usb - i2s - platform_allow: - - nrf5340dk/nrf5340/cpuapp - - nrf54h20dk/nrf54h20/cpuapp + platform_allow: nrf5340dk/nrf5340/cpuapp harness: TBD diff --git a/samples/subsys/usb/uac2_explicit_feedback/src/feedback_nrf.c b/samples/subsys/usb/uac2_explicit_feedback/src/feedback_nrf53.c similarity index 89% rename from samples/subsys/usb/uac2_explicit_feedback/src/feedback_nrf.c rename to samples/subsys/usb/uac2_explicit_feedback/src/feedback_nrf53.c index 62a7ad05ef9c..7e949d612117 100644 --- a/samples/subsys/usb/uac2_explicit_feedback/src/feedback_nrf.c +++ b/samples/subsys/usb/uac2_explicit_feedback/src/feedback_nrf53.c @@ -12,56 +12,18 @@ #include #include #include +#include +#include #include LOG_MODULE_REGISTER(feedback, LOG_LEVEL_INF); -#define FEEDBACK_TIMER_USBD_SOF_CAPTURE 0 -#define FEEDBACK_TIMER_I2S_FRAMESTART_CAPTURE 1 - -#if IS_ENABLED(CONFIG_SOC_COMPATIBLE_NRF5340_CPUAPP) - -#include -#include +static const nrfx_gpiote_t gpiote = NRFX_GPIOTE_INSTANCE(0); #define FEEDBACK_PIN NRF_GPIO_PIN_MAP(1, 9) -#define FEEDBACK_GPIOTE_INSTANCE_NUMBER 0 #define FEEDBACK_TIMER_INSTANCE_NUMBER 2 -#define USB_SOF_EVENT_ADDRESS nrf_usbd_event_address_get(NRF_USBD, NRF_USBD_EVENT_SOF) -#define I2S_FRAMESTART_EVENT_ADDRESS nrf_i2s_event_address_get(NRF_I2S0, NRF_I2S_EVENT_FRAMESTART) - -static inline void feedback_target_init(void) -{ - if (IS_ENABLED(CONFIG_APP_USE_I2S_LRCLK_EDGES_COUNTER)) { - /* App core is using feedback pin */ - nrf_gpio_pin_control_select(FEEDBACK_PIN, NRF_GPIO_PIN_SEL_APP); - } -} - -#elif IS_ENABLED(CONFIG_SOC_SERIES_NRF54HX) - -#include - -#define FEEDBACK_PIN NRF_GPIO_PIN_MAP(0, 8) -#define FEEDBACK_GPIOTE_INSTANCE_NUMBER 130 -#define FEEDBACK_TIMER_INSTANCE_NUMBER 131 -#define USB_SOF_EVENT_ADDRESS nrf_timer_event_address_get(NRF_TIMER131, NRF_TIMER_EVENT_COMPARE5) -#define I2S_FRAMESTART_EVENT_ADDRESS nrf_tdm_event_address_get(NRF_TDM130, NRF_TDM_EVENT_MAXCNT) - -static inline void feedback_target_init(void) -{ - /* Enable Start-of-Frame workaround in TIMER131 */ - *(volatile uint32_t *)0x5F9A3C04 = 0x00000002; - *(volatile uint32_t *)0x5F9A3C04 = 0x00000003; - *(volatile uint32_t *)0x5F9A3C80 = 0x00000082; -} - -#else -#error "Unsupported target" -#endif - -static const nrfx_gpiote_t gpiote = - NRFX_GPIOTE_INSTANCE(FEEDBACK_GPIOTE_INSTANCE_NUMBER); +#define FEEDBACK_TIMER_USBD_SOF_CAPTURE 0 +#define FEEDBACK_TIMER_I2S_FRAMESTART_CAPTURE 1 static const nrfx_timer_t feedback_timer_instance = NRFX_TIMER_INSTANCE(FEEDBACK_TIMER_INSTANCE_NUMBER); @@ -118,12 +80,13 @@ static nrfx_err_t feedback_edge_counter_setup(void) .trigger = NRFX_GPIOTE_TRIGGER_TOGGLE, .p_in_channel = &feedback_gpiote_channel, }; - nrf_gpio_pin_pull_t pull = NRF_GPIO_PIN_PULLUP; nrfx_gpiote_input_pin_config_t input_pin_config = { - .p_pull_config = &pull, .p_trigger_config = &trigger_config, }; + /* App core is using feedback pin */ + nrf_gpio_pin_control_select(FEEDBACK_PIN, NRF_GPIO_PIN_SEL_APP); + err = nrfx_gpiote_channel_alloc(&gpiote, &feedback_gpiote_channel); if (err != NRFX_SUCCESS) { return err; @@ -188,8 +151,6 @@ struct feedback_ctx *feedback_init(void) uint8_t usbd_sof_gppi_channel; uint8_t i2s_framestart_gppi_channel; - feedback_target_init(); - feedback_reset_ctx(&fb_ctx); if (IS_ENABLED(CONFIG_APP_USE_I2S_LRCLK_EDGES_COUNTER)) { @@ -210,7 +171,7 @@ struct feedback_ctx *feedback_init(void) } nrfx_gppi_channel_endpoints_setup(usbd_sof_gppi_channel, - USB_SOF_EVENT_ADDRESS, + nrf_usbd_event_address_get(NRF_USBD, NRF_USBD_EVENT_SOF), nrfx_timer_capture_task_address_get(&feedback_timer_instance, FEEDBACK_TIMER_USBD_SOF_CAPTURE)); nrfx_gppi_fork_endpoint_setup(usbd_sof_gppi_channel, @@ -227,7 +188,7 @@ struct feedback_ctx *feedback_init(void) } nrfx_gppi_channel_endpoints_setup(i2s_framestart_gppi_channel, - I2S_FRAMESTART_EVENT_ADDRESS, + nrf_i2s_event_address_get(NRF_I2S0, NRF_I2S_EVENT_FRAMESTART), nrfx_timer_capture_task_address_get(&feedback_timer_instance, FEEDBACK_TIMER_I2S_FRAMESTART_CAPTURE)); diff --git a/samples/subsys/usb/uac2_implicit_feedback/CMakeLists.txt b/samples/subsys/usb/uac2_implicit_feedback/CMakeLists.txt index 56bba10717c0..26ce264c4217 100644 --- a/samples/subsys/usb/uac2_implicit_feedback/CMakeLists.txt +++ b/samples/subsys/usb/uac2_implicit_feedback/CMakeLists.txt @@ -7,8 +7,8 @@ project(usb_audio_async_i2s) include(${ZEPHYR_BASE}/samples/subsys/usb/common/common.cmake) target_sources(app PRIVATE src/main.c) -if (CONFIG_SOC_COMPATIBLE_NRF5340_CPUAPP OR CONFIG_SOC_SERIES_NRF54HX) - target_sources(app PRIVATE src/feedback_nrf.c) +if (CONFIG_SOC_COMPATIBLE_NRF5340_CPUAPP) + target_sources(app PRIVATE src/feedback_nrf53.c) else() target_sources(app PRIVATE src/feedback_dummy.c) endif() diff --git a/samples/subsys/usb/uac2_implicit_feedback/boards/nrf54h20dk_nrf54h20_cpuapp.conf b/samples/subsys/usb/uac2_implicit_feedback/boards/nrf54h20dk_nrf54h20_cpuapp.conf deleted file mode 100644 index 1b1edb40666c..000000000000 --- a/samples/subsys/usb/uac2_implicit_feedback/boards/nrf54h20dk_nrf54h20_cpuapp.conf +++ /dev/null @@ -1,7 +0,0 @@ -# Enable timer for asynchronous feedback -CONFIG_NRFX_GPPI=y -CONFIG_NRFX_TIMER131=y - -# Sample is Full-Speed only, prevent High-Speed enumeration -CONFIG_UDC_DRIVER_HIGH_SPEED_SUPPORT_ENABLED=n -CONFIG_USBD_MAX_SPEED_FULL=y diff --git a/samples/subsys/usb/uac2_implicit_feedback/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/samples/subsys/usb/uac2_implicit_feedback/boards/nrf54h20dk_nrf54h20_cpuapp.overlay deleted file mode 100644 index 7fec156ff7e5..000000000000 --- a/samples/subsys/usb/uac2_implicit_feedback/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include "../app.overlay" - -&pinctrl { - tdm130_default_alt: tdm130_default_alt { - group1 { - psels = , - , - , - ; - }; - }; -}; - -i2s_rxtx: &tdm130 { - status = "okay"; - pinctrl-0 = <&tdm130_default_alt>; - pinctrl-names = "default"; - memory-regions = <&cpuapp_dma_region>; - mck-clock-source = "ACLK"; - sck-clock-source = "ACLK"; -}; - -&audiopll { - frequency = ; - status = "okay"; -}; - -&cpuapp_dma_region { - status = "okay"; -}; - -/* PPI channel 0 for TDM130 MAXCNT */ -&dppic132 { - compatible = "nordic,nrf-dppic-global"; - owned-channels = <0>; - source-channels = <0>; - nonsecure-channels = <0>; - status = "okay"; -}; - -/* TDM130 PPI needs routing to TIMER131 through main APB */ -&dppic130 { - compatible = "nordic,nrf-dppic-global"; - owned-channels = <0>; - sink-channels = <0>; - source-channels = <0>; - nonsecure-channels = <0>; - status = "okay"; -}; - -/* TIMER131 PPI channel 1 is used for SOF */ -&dppic133 { - compatible = "nordic,nrf-dppic-global"; - owned-channels = <0 1>; - sink-channels = <0 1>; - status = "okay"; -}; - -&timer131 { - status = "okay"; -}; diff --git a/samples/subsys/usb/uac2_implicit_feedback/sample.yaml b/samples/subsys/usb/uac2_implicit_feedback/sample.yaml index 03cf7145e89a..6682ac0ed831 100644 --- a/samples/subsys/usb/uac2_implicit_feedback/sample.yaml +++ b/samples/subsys/usb/uac2_implicit_feedback/sample.yaml @@ -8,7 +8,5 @@ tests: tags: - usb - i2s - platform_allow: - - nrf5340dk/nrf5340/cpuapp - - nrf54h20dk/nrf54h20/cpuapp + platform_allow: nrf5340dk/nrf5340/cpuapp harness: TBD diff --git a/samples/subsys/usb/uac2_implicit_feedback/src/feedback_nrf.c b/samples/subsys/usb/uac2_implicit_feedback/src/feedback_nrf53.c similarity index 85% rename from samples/subsys/usb/uac2_implicit_feedback/src/feedback_nrf.c rename to samples/subsys/usb/uac2_implicit_feedback/src/feedback_nrf53.c index a7dfad370b87..ecc59f1a35a6 100644 --- a/samples/subsys/usb/uac2_implicit_feedback/src/feedback_nrf.c +++ b/samples/subsys/usb/uac2_implicit_feedback/src/feedback_nrf53.c @@ -10,47 +10,16 @@ #include #include +#include +#include #include LOG_MODULE_REGISTER(feedback, LOG_LEVEL_INF); +#define FEEDBACK_TIMER_INSTANCE_NUMBER 2 #define FEEDBACK_TIMER_USBD_SOF_CAPTURE 0 #define FEEDBACK_TIMER_I2S_FRAMESTART_CAPTURE 1 -#if IS_ENABLED(CONFIG_SOC_COMPATIBLE_NRF5340_CPUAPP) - -#include -#include - -#define FEEDBACK_TIMER_INSTANCE_NUMBER 2 -#define USB_SOF_EVENT_ADDRESS nrf_usbd_event_address_get(NRF_USBD, NRF_USBD_EVENT_SOF) -#define I2S_FRAMESTART_EVENT_ADDRESS nrf_i2s_event_address_get(NRF_I2S0, NRF_I2S_EVENT_FRAMESTART) - -static inline void feedback_target_init(void) -{ - /* No target specific init necessary */ -} - -#elif IS_ENABLED(CONFIG_SOC_SERIES_NRF54HX) - -#include - -#define FEEDBACK_TIMER_INSTANCE_NUMBER 131 -#define USB_SOF_EVENT_ADDRESS nrf_timer_event_address_get(NRF_TIMER131, NRF_TIMER_EVENT_COMPARE5) -#define I2S_FRAMESTART_EVENT_ADDRESS nrf_tdm_event_address_get(NRF_TDM130, NRF_TDM_EVENT_MAXCNT) - -static inline void feedback_target_init(void) -{ - /* Enable Start-of-Frame workaround in TIMER131 */ - *(volatile uint32_t *)0x5F9A3C04 = 0x00000002; - *(volatile uint32_t *)0x5F9A3C04 = 0x00000003; - *(volatile uint32_t *)0x5F9A3C80 = 0x00000082; -} - -#else -#error "Unsupported target" -#endif - static const nrfx_timer_t feedback_timer_instance = NRFX_TIMER_INSTANCE(FEEDBACK_TIMER_INSTANCE_NUMBER); @@ -88,8 +57,6 @@ struct feedback_ctx *feedback_init(void) .p_context = NULL, }; - feedback_target_init(); - feedback_reset_ctx(&fb_ctx); err = nrfx_timer_init(&feedback_timer_instance, &cfg, NULL); @@ -106,7 +73,7 @@ struct feedback_ctx *feedback_init(void) } nrfx_gppi_channel_endpoints_setup(usbd_sof_gppi_channel, - USB_SOF_EVENT_ADDRESS, + nrf_usbd_event_address_get(NRF_USBD, NRF_USBD_EVENT_SOF), nrfx_timer_capture_task_address_get(&feedback_timer_instance, FEEDBACK_TIMER_USBD_SOF_CAPTURE)); nrfx_gppi_fork_endpoint_setup(usbd_sof_gppi_channel, @@ -123,7 +90,7 @@ struct feedback_ctx *feedback_init(void) } nrfx_gppi_channel_endpoints_setup(i2s_framestart_gppi_channel, - I2S_FRAMESTART_EVENT_ADDRESS, + nrf_i2s_event_address_get(NRF_I2S0, NRF_I2S_EVENT_FRAMESTART), nrfx_timer_capture_task_address_get(&feedback_timer_instance, FEEDBACK_TIMER_I2S_FRAMESTART_CAPTURE)); From f7a53098a6d30e7b002a7cef6f918e050bb30e53 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:02 +0300 Subject: [PATCH 1417/2141] Revert "[nrf fromtree] samples: usb: uac2: Make I2S buffers UDC compliant" This reverts commit 50ba46ecf17f40ea9c1d324b3019ae89c27d0708. Signed-off-by: Jukka Rissanen --- samples/subsys/usb/uac2_implicit_feedback/src/main.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/samples/subsys/usb/uac2_implicit_feedback/src/main.c b/samples/subsys/usb/uac2_implicit_feedback/src/main.c index b7720fe03317..a41f4b3814dd 100644 --- a/samples/subsys/usb/uac2_implicit_feedback/src/main.c +++ b/samples/subsys/usb/uac2_implicit_feedback/src/main.c @@ -37,10 +37,8 @@ LOG_MODULE_REGISTER(uac2_sample, LOG_LEVEL_INF); * errors when USB host decides to perform rapid terminal enable/disable cycles. */ #define I2S_BLOCKS 7 -K_MEM_SLAB_DEFINE_STATIC(i2s_tx_slab, ROUND_UP(MAX_BLOCK_SIZE, UDC_BUF_GRANULARITY), - I2S_BLOCKS, UDC_BUF_ALIGN); -K_MEM_SLAB_DEFINE_STATIC(i2s_rx_slab, ROUND_UP(MAX_BLOCK_SIZE, UDC_BUF_GRANULARITY), - I2S_BLOCKS, UDC_BUF_ALIGN); +K_MEM_SLAB_DEFINE_STATIC(i2s_tx_slab, MAX_BLOCK_SIZE, I2S_BLOCKS, 4); +K_MEM_SLAB_DEFINE_STATIC(i2s_rx_slab, MAX_BLOCK_SIZE, I2S_BLOCKS, 4); struct usb_i2s_ctx { const struct device *i2s_dev; From 064214f8473e876221d296802bb23ec1b63cf418 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:02 +0300 Subject: [PATCH 1418/2141] Revert "[nrf fromtree] samples: usb: uac2: Leave cache management up to drivers" This reverts commit 602b2c4b75a0c934db61f9666a4f98f6dad9857e. Signed-off-by: Jukka Rissanen --- samples/subsys/usb/uac2_explicit_feedback/src/main.c | 2 ++ samples/subsys/usb/uac2_implicit_feedback/src/main.c | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/samples/subsys/usb/uac2_explicit_feedback/src/main.c b/samples/subsys/usb/uac2_explicit_feedback/src/main.c index 3f4f596f35c2..e448416c745d 100644 --- a/samples/subsys/usb/uac2_explicit_feedback/src/main.c +++ b/samples/subsys/usb/uac2_explicit_feedback/src/main.c @@ -10,6 +10,7 @@ #include #include "feedback.h" +#include #include #include #include @@ -116,6 +117,7 @@ static void uac2_data_recv_cb(const struct device *dev, uint8_t terminal, */ size = BLOCK_SIZE; memset(buf, 0, size); + sys_cache_data_flush_range(buf, size); } LOG_DBG("Received %d data to input terminal %d", size, terminal); diff --git a/samples/subsys/usb/uac2_implicit_feedback/src/main.c b/samples/subsys/usb/uac2_implicit_feedback/src/main.c index a41f4b3814dd..f52d12271025 100644 --- a/samples/subsys/usb/uac2_implicit_feedback/src/main.c +++ b/samples/subsys/usb/uac2_implicit_feedback/src/main.c @@ -10,6 +10,7 @@ #include #include "feedback.h" +#include #include #include #include @@ -163,6 +164,7 @@ static void uac2_data_recv_cb(const struct device *dev, uint8_t terminal, size = SAMPLES_PER_SOF * BYTES_PER_SLOT; } memset(buf, 0, size); + sys_cache_data_flush_range(buf, size); } LOG_DBG("Received %d data to input terminal %d", size, terminal); @@ -257,6 +259,7 @@ static void process_mic_data(const struct device *dev, struct usb_i2s_ctx *ctx) /* No data available, I2S will restart soon */ return; } + sys_cache_data_invd_range(rx_block, num_bytes); /* I2S operates on 2 channels (stereo) */ rx_samples = num_bytes / (BYTES_PER_SAMPLE * 2); @@ -311,6 +314,7 @@ static void process_mic_data(const struct device *dev, struct usb_i2s_ctx *ctx) ctx->pending_mic_samples = mic_samples; return; } + sys_cache_data_invd_range(rx_block, num_bytes); src = rx_block; rx_samples = num_bytes / (BYTES_PER_SAMPLE * 2); @@ -420,6 +424,7 @@ static void process_mic_data(const struct device *dev, struct usb_i2s_ctx *ctx) } /* Finally send the microphone samples to host */ + sys_cache_data_flush_range(mic_buf, mic_samples * BYTES_PER_SAMPLE); if (usbd_uac2_send(dev, MICROPHONE_IN_TERMINAL_ID, mic_buf, mic_samples * BYTES_PER_SAMPLE) < 0) { k_mem_slab_free(&i2s_rx_slab, mic_buf); From ca24170951ec7ee5c6e8c1be9b0ae086c58ba179 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:02 +0300 Subject: [PATCH 1419/2141] Revert "[nrf fromtree] dts: nordic: remove nordic,cryptocell compatible" This reverts commit 0ca49a1fe554cfb10a969aadefe84455069f20c5. Signed-off-by: Jukka Rissanen --- dts/arm/nordic/nrf52840.dtsi | 2 +- dts/arm/nordic/nrf5340_cpuapp.dtsi | 2 +- dts/arm/nordic/nrf91.dtsi | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dts/arm/nordic/nrf52840.dtsi b/dts/arm/nordic/nrf52840.dtsi index dab5f7620585..7c5337eed990 100644 --- a/dts/arm/nordic/nrf52840.dtsi +++ b/dts/arm/nordic/nrf52840.dtsi @@ -568,7 +568,7 @@ }; cryptocell: crypto@5002a000 { - compatible = "arm,cryptocell-310"; + compatible = "nordic,cryptocell", "arm,cryptocell-310"; reg = <0x5002a000 0x1000>, <0x5002b000 0x1000>; reg-names = "wrapper", "core"; interrupts = <42 NRF_DEFAULT_IRQ_PRIORITY>; diff --git a/dts/arm/nordic/nrf5340_cpuapp.dtsi b/dts/arm/nordic/nrf5340_cpuapp.dtsi index 30aaf9c99479..1b04be61248e 100644 --- a/dts/arm/nordic/nrf5340_cpuapp.dtsi +++ b/dts/arm/nordic/nrf5340_cpuapp.dtsi @@ -100,7 +100,7 @@ }; cryptocell: crypto@50844000 { - compatible = "arm,cryptocell-312"; + compatible = "nordic,cryptocell", "arm,cryptocell-312"; reg = <0x50844000 0x1000>, <0x50845000 0x1000>; reg-names = "wrapper", "core"; interrupts = <68 NRF_DEFAULT_IRQ_PRIORITY>; diff --git a/dts/arm/nordic/nrf91.dtsi b/dts/arm/nordic/nrf91.dtsi index 1747dcea74a9..9a64ed922294 100644 --- a/dts/arm/nordic/nrf91.dtsi +++ b/dts/arm/nordic/nrf91.dtsi @@ -47,7 +47,7 @@ /* Additional Secure peripherals */ cryptocell: crypto@50840000 { - compatible = "arm,cryptocell-310"; + compatible = "nordic,cryptocell", "arm,cryptocell-310"; reg = <0x50840000 0x1000>, <0x50841000 0x1000>; reg-names = "wrapper", "core"; interrupts = <64 NRF_DEFAULT_IRQ_PRIORITY>; From e79244206f9c9aafb2adceea7f9d62af4a0438e3 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:02 +0300 Subject: [PATCH 1420/2141] Revert "[nrf fromtree] drivers: pwm: nrfx: Add option to glitch free 100% duty cycle" This reverts commit c1d7194e05c3798e2acc6a461247eb20e5d27a0a. Signed-off-by: Jukka Rissanen --- drivers/pwm/Kconfig.nrfx | 10 ---------- drivers/pwm/pwm_nrfx.c | 19 ++++++++++++++----- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/drivers/pwm/Kconfig.nrfx b/drivers/pwm/Kconfig.nrfx index d99b5aaf3ab8..933fe7cb29c3 100644 --- a/drivers/pwm/Kconfig.nrfx +++ b/drivers/pwm/Kconfig.nrfx @@ -20,13 +20,3 @@ config PWM_NRFX select PINCTRL help Enable support for nrfx Hardware PWM driver for nRF52 MCU series. - -config PWM_NRFX_NO_GLITCH_DUTY_100 - bool "No glitches when using 100% duty" - depends on $(dt_compat_any_has_prop,$(DT_COMPAT_NORDIC_NRF_PWM),idleout-supported,True) - default y - help - Due to how IDLEOUT feature in PWM works it is possible to see a glitch on a channel - with 100% duty cycle when all other channels switches to 0% or 100%. Enabling this - option ensures that there are no glitches but it also means that 100% duty cycle - on any channels requires PWM peripheral to be active. diff --git a/drivers/pwm/pwm_nrfx.c b/drivers/pwm/pwm_nrfx.c index 6a106c128412..ec55bef69604 100644 --- a/drivers/pwm/pwm_nrfx.c +++ b/drivers/pwm/pwm_nrfx.c @@ -240,9 +240,6 @@ static int pwm_nrfx_set_cycles(const struct device *dev, uint32_t channel, /* Constantly active (duty 100%). */ /* This value is always greater than or equal to COUNTERTOP. */ compare_value = PWM_NRFX_CH_COMPARE_MASK; - needs_pwm = pwm_is_fast(config) || - (IS_ENABLED(NRF_PWM_HAS_IDLEOUT) && - IS_ENABLED(CONFIG_PWM_NRFX_NO_GLITCH_DUTY_100)); } else { /* PWM generation needed. Check if the requested period matches * the one that is currently set, or the PWM peripheral can be @@ -282,8 +279,20 @@ static int pwm_nrfx_set_cycles(const struct device *dev, uint32_t channel, if (inverted) { out_level ^= 1; } - - nrf_gpio_pin_write(psel, out_level); + /* Output of fast PWM instance is directly connected to GPIO pads, + * thus it cannot controlled by GPIO. Use regular 0%/100% duty cycle + * playback instead. + */ +#ifdef PWM_NRFX_FAST_PRESENT + if (pwm_is_fast(config)) { + nrfx_pwm_simple_playback(&config->pwm, &config->seq, 1, + NRFX_PWM_FLAG_NO_EVT_FINISHED); + } else { +#else + { +#endif + nrf_gpio_pin_write(psel, out_level); + } } data->pwm_needed &= ~BIT(channel); From 5096d983813b12f3399d40273b192c91770cd055 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:02 +0300 Subject: [PATCH 1421/2141] Revert "[nrf fromtree] dts: pwm: nordic: Add idleout-supported property" This reverts commit 7dfaa46a277101953232c2bfbe71f257ad3ca271. Signed-off-by: Jukka Rissanen --- dts/bindings/pwm/nordic,nrf-pwm.yaml | 5 ----- dts/vendor/nordic/nrf54h20.dtsi | 5 ----- dts/vendor/nordic/nrf54l20.dtsi | 3 --- dts/vendor/nordic/nrf54l_05_10_15.dtsi | 3 --- dts/vendor/nordic/nrf9280.dtsi | 5 ----- 5 files changed, 21 deletions(-) diff --git a/dts/bindings/pwm/nordic,nrf-pwm.yaml b/dts/bindings/pwm/nordic,nrf-pwm.yaml index e5adfc6ede9a..8f481d8971c5 100644 --- a/dts/bindings/pwm/nordic,nrf-pwm.yaml +++ b/dts/bindings/pwm/nordic,nrf-pwm.yaml @@ -18,11 +18,6 @@ properties: type: boolean description: Set this to use center-aligned (up and down) counter mode. - idleout-supported: - type: boolean - description: | - Indicates if the PWM instance has the IDLEOUT register. - "#pwm-cells": const: 3 diff --git a/dts/vendor/nordic/nrf54h20.dtsi b/dts/vendor/nordic/nrf54h20.dtsi index 042725a16171..f907dd7fa2e3 100644 --- a/dts/vendor/nordic/nrf54h20.dtsi +++ b/dts/vendor/nordic/nrf54h20.dtsi @@ -659,7 +659,6 @@ clocks = <&hsfll120>; power-domains = <&gpd NRF_GPD_FAST_ACTIVE1>; #pwm-cells = <3>; - idleout-supported; }; spis120: spi@8e5000 { @@ -1012,7 +1011,6 @@ clocks = <&fll16m>; power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; #pwm-cells = <3>; - idleout-supported; }; i2c130: i2c@9a5000 { @@ -1146,7 +1144,6 @@ clocks = <&fll16m>; power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; #pwm-cells = <3>; - idleout-supported; }; i2c132: i2c@9b5000 { @@ -1280,7 +1277,6 @@ clocks = <&fll16m>; #pwm-cells = <3>; power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; - idleout-supported; }; i2c134: i2c@9c5000 { @@ -1414,7 +1410,6 @@ clocks = <&fll16m>; #pwm-cells = <3>; power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; - idleout-supported; }; i2c136: i2c@9d5000 { diff --git a/dts/vendor/nordic/nrf54l20.dtsi b/dts/vendor/nordic/nrf54l20.dtsi index de63a005c1de..4a4e90e75b4e 100644 --- a/dts/vendor/nordic/nrf54l20.dtsi +++ b/dts/vendor/nordic/nrf54l20.dtsi @@ -488,7 +488,6 @@ reg = <0xd2000 0x1000>; interrupts = <210 NRF_DEFAULT_IRQ_PRIORITY>; #pwm-cells = <3>; - idleout-supported; }; pwm21: pwm@d3000 { @@ -497,7 +496,6 @@ reg = <0xd3000 0x1000>; interrupts = <211 NRF_DEFAULT_IRQ_PRIORITY>; #pwm-cells = <3>; - idleout-supported; }; pwm22: pwm@d4000 { @@ -506,7 +504,6 @@ reg = <0xd4000 0x1000>; interrupts = <212 NRF_DEFAULT_IRQ_PRIORITY>; #pwm-cells = <3>; - idleout-supported; }; adc: adc@d5000 { diff --git a/dts/vendor/nordic/nrf54l_05_10_15.dtsi b/dts/vendor/nordic/nrf54l_05_10_15.dtsi index 004454191f01..336d642afedf 100644 --- a/dts/vendor/nordic/nrf54l_05_10_15.dtsi +++ b/dts/vendor/nordic/nrf54l_05_10_15.dtsi @@ -477,7 +477,6 @@ reg = <0xd2000 0x1000>; interrupts = <210 NRF_DEFAULT_IRQ_PRIORITY>; #pwm-cells = <3>; - idleout-supported; }; pwm21: pwm@d3000 { @@ -486,7 +485,6 @@ reg = <0xd3000 0x1000>; interrupts = <211 NRF_DEFAULT_IRQ_PRIORITY>; #pwm-cells = <3>; - idleout-supported; }; pwm22: pwm@d4000 { @@ -495,7 +493,6 @@ reg = <0xd4000 0x1000>; interrupts = <212 NRF_DEFAULT_IRQ_PRIORITY>; #pwm-cells = <3>; - idleout-supported; }; adc: adc@d5000 { diff --git a/dts/vendor/nordic/nrf9280.dtsi b/dts/vendor/nordic/nrf9280.dtsi index fb27488e9dc4..06e0a3a15145 100644 --- a/dts/vendor/nordic/nrf9280.dtsi +++ b/dts/vendor/nordic/nrf9280.dtsi @@ -479,7 +479,6 @@ status = "disabled"; interrupts = <228 NRF_DEFAULT_IRQ_PRIORITY>; #pwm-cells = <3>; - idleout-supported; }; spi120: spi@8e6000 { @@ -768,7 +767,6 @@ status = "disabled"; interrupts = <420 NRF_DEFAULT_IRQ_PRIORITY>; #pwm-cells = <3>; - idleout-supported; }; i2c130: i2c@9a5000 { @@ -883,7 +881,6 @@ status = "disabled"; interrupts = <436 NRF_DEFAULT_IRQ_PRIORITY>; #pwm-cells = <3>; - idleout-supported; }; i2c132: i2c@9b5000 { @@ -998,7 +995,6 @@ status = "disabled"; interrupts = <452 NRF_DEFAULT_IRQ_PRIORITY>; #pwm-cells = <3>; - idleout-supported; }; i2c134: i2c@9c5000 { @@ -1113,7 +1109,6 @@ status = "disabled"; interrupts = <468 NRF_DEFAULT_IRQ_PRIORITY>; #pwm-cells = <3>; - idleout-supported; }; i2c136: i2c@9d5000 { From c9717ac037af127a045113e1dfa53ce45198cc0c Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:02 +0300 Subject: [PATCH 1422/2141] Revert "[nrf fromtree] bluetooth: host: Handle failure to disable scan when updating own_addr" This reverts commit 6453478e6c8af1d28036f0cb1bd94bf4a994d0c8. Signed-off-by: Jukka Rissanen --- subsys/bluetooth/host/id.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subsys/bluetooth/host/id.c b/subsys/bluetooth/host/id.c index e52294cf5386..12e8e823aaaa 100644 --- a/subsys/bluetooth/host/id.c +++ b/subsys/bluetooth/host/id.c @@ -1994,8 +1994,8 @@ int bt_id_set_adv_own_addr(struct bt_le_ext_adv *adv, uint32_t options, if (!IS_ENABLED(CONFIG_BT_PRIVACY) && !IS_ENABLED(CONFIG_BT_SCAN_WITH_IDENTITY) && dev_scanning) { - err = bt_le_scan_set_enable(BT_HCI_LE_SCAN_DISABLE); - scan_disabled = err == 0; + scan_disabled = true; + bt_le_scan_set_enable(BT_HCI_LE_SCAN_DISABLE); } /* If we are scanning with the identity address, it does From 184e323024d11b1ee9869be790ac44fcb50c94f4 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:03 +0300 Subject: [PATCH 1423/2141] Revert "[nrf fromtree] bluetooth: host: Do not try to set NRPA when scanning with identity" This reverts commit 3abc5c2cc2a78873ddc7f5971a82207b3ad6c619. Signed-off-by: Jukka Rissanen --- subsys/bluetooth/host/id.c | 26 +---- .../host/id/bt_id_set_adv_own_addr/src/main.c | 102 ------------------ .../id/bt_id_set_adv_own_addr/testcase.yaml | 4 - 3 files changed, 5 insertions(+), 127 deletions(-) diff --git a/subsys/bluetooth/host/id.c b/subsys/bluetooth/host/id.c index 12e8e823aaaa..e791516e74c8 100644 --- a/subsys/bluetooth/host/id.c +++ b/subsys/bluetooth/host/id.c @@ -1987,38 +1987,22 @@ int bt_id_set_adv_own_addr(struct bt_le_ext_adv *adv, uint32_t options, */ #if defined(CONFIG_BT_OBSERVER) bool scan_disabled = false; - bool dev_scanning = atomic_test_bit(bt_dev.flags, - BT_DEV_SCANNING); /* If active scan with NRPA is ongoing refresh NRPA */ if (!IS_ENABLED(CONFIG_BT_PRIVACY) && !IS_ENABLED(CONFIG_BT_SCAN_WITH_IDENTITY) && - dev_scanning) { + atomic_test_bit(bt_dev.flags, BT_DEV_SCANNING)) { scan_disabled = true; bt_le_scan_set_enable(BT_HCI_LE_SCAN_DISABLE); } +#endif /* defined(CONFIG_BT_OBSERVER) */ + err = bt_id_set_adv_private_addr(adv); + *own_addr_type = BT_HCI_OWN_ADDR_RANDOM; - /* If we are scanning with the identity address, it does - * not make sense to set an NRPA. - */ - if (!IS_ENABLED(CONFIG_BT_SCAN_WITH_IDENTITY) || - !dev_scanning) { - err = bt_id_set_adv_private_addr(adv); - *own_addr_type = BT_HCI_OWN_ADDR_RANDOM; - } else { - if (id_addr->type == BT_ADDR_LE_RANDOM) { - *own_addr_type = BT_HCI_OWN_ADDR_RANDOM; - } else if (id_addr->type == BT_ADDR_LE_PUBLIC) { - *own_addr_type = BT_HCI_OWN_ADDR_PUBLIC; - } - } - +#if defined(CONFIG_BT_OBSERVER) if (scan_disabled) { bt_le_scan_set_enable(BT_HCI_LE_SCAN_ENABLE); } -#else - err = bt_id_set_adv_private_addr(adv); - *own_addr_type = BT_HCI_OWN_ADDR_RANDOM; #endif /* defined(CONFIG_BT_OBSERVER) */ } else { err = bt_id_set_adv_private_addr(adv); diff --git a/tests/bluetooth/host/id/bt_id_set_adv_own_addr/src/main.c b/tests/bluetooth/host/id/bt_id_set_adv_own_addr/src/main.c index 8304906d37e3..29c500e9840c 100644 --- a/tests/bluetooth/host/id/bt_id_set_adv_own_addr/src/main.c +++ b/tests/bluetooth/host/id/bt_id_set_adv_own_addr/src/main.c @@ -7,10 +7,6 @@ #include "mocks/crypto.h" #include "mocks/scan.h" #include "mocks/scan_expects.h" -#include "mocks/hci_core.h" -#include "mocks/hci_core_expects.h" -#include "mocks/net_buf.h" -#include "mocks/net_buf_expects.h" #include "testing_common_defs.h" #include @@ -28,7 +24,6 @@ static void fff_reset_rule_before(const struct ztest_unit_test *test, void *fixt memset(&bt_dev, 0x00, sizeof(struct bt_dev)); CRYPTO_FFF_FAKES_LIST(RESET_FAKE); - HCI_CORE_FFF_FAKES_LIST(RESET_FAKE); } ZTEST_RULE(fff_reset_rule, fff_reset_rule_before, NULL); @@ -237,7 +232,6 @@ ZTEST(bt_id_set_adv_own_addr, test_observer_scanning_re_enabled_after_updating_a Z_TEST_SKIP_IFDEF(CONFIG_BT_PRIVACY); Z_TEST_SKIP_IFDEF(CONFIG_BT_EXT_ADV); - Z_TEST_SKIP_IFDEF(CONFIG_BT_SCAN_WITH_IDENTITY); Z_TEST_SKIP_IFNDEF(CONFIG_BT_OBSERVER); options &= ~BT_LE_ADV_OPT_CONN; @@ -247,102 +241,6 @@ ZTEST(bt_id_set_adv_own_addr, test_observer_scanning_re_enabled_after_updating_a atomic_set_bit(bt_dev.flags, BT_DEV_SCANNING); bt_id_set_adv_own_addr(&adv, options, true, &own_addr_type); - zassert_true(own_addr_type == BT_HCI_OWN_ADDR_RANDOM, - "Address type reference was incorrectly set"); expect_call_count_bt_le_scan_set_enable(2, expected_args_history); } - -/* - * Test setting the advertiser address while 'CONFIG_BT_SCAN_WITH_IDENTITY' is enabled - * and scanning is ongoing. The scanner is using a random identity address. - * - * Constraints: - * - Options 'BT_LE_ADV_OPT_CONN' bit isn't set - * - * Expected behaviour: - * - Scanning is not disabled. - * - The advertiser doesn't attempt to change the identity addr with bt_id_set_adv_private_addr() - * - The advertiser uses the same identity address as the scanner. - */ -ZTEST(bt_id_set_adv_own_addr, test_set_adv_own_addr_while_scanning_with_identity_random) -{ - uint32_t options = 0; - struct bt_le_ext_adv adv = {0}; - struct net_buf net_buff; - int err; - uint8_t scan_own_addr_type = BT_ADDR_LE_ANONYMOUS; - uint8_t adv_own_addr_type = BT_ADDR_LE_ANONYMOUS; - - Z_TEST_SKIP_IFDEF(CONFIG_BT_PRIVACY); - Z_TEST_SKIP_IFDEF(CONFIG_BT_EXT_ADV); - Z_TEST_SKIP_IFNDEF(CONFIG_BT_OBSERVER); - Z_TEST_SKIP_IFNDEF(CONFIG_BT_SCAN_WITH_IDENTITY); - - bt_hci_cmd_alloc_fake.return_val = &net_buff; - bt_hci_cmd_send_sync_fake.return_val = 0; - - options &= ~BT_LE_ADV_OPT_CONN; - bt_addr_le_copy(&bt_dev.id_addr[BT_ID_DEFAULT], BT_STATIC_RANDOM_LE_ADDR_1); - - err = bt_id_set_scan_own_addr(false, &scan_own_addr_type); - - expect_single_call_bt_hci_cmd_alloc(); - expect_single_call_bt_hci_cmd_send_sync(BT_HCI_OP_LE_SET_RANDOM_ADDRESS); - - zassert_ok(err, "Unexpected error code '%d' was returned", err); - zassert_true(scan_own_addr_type == BT_HCI_OWN_ADDR_RANDOM, - "Address type reference was incorrectly set"); - - atomic_set_bit(bt_dev.flags, BT_DEV_SCANNING); - - bt_id_set_adv_own_addr(&adv, options, true, &adv_own_addr_type); - zassert_true(adv_own_addr_type == BT_HCI_OWN_ADDR_RANDOM, - "Address type reference was incorrectly set"); - - expect_call_count_bt_le_scan_set_enable(0, NULL); -} - -/* - * Test setting the advertiser address while 'CONFIG_BT_SCAN_WITH_IDENTITY' is enabled - * and scanning is ongoing. The scanner is using a public identity address. - * - * Constraints: - * - Options 'BT_LE_ADV_OPT_CONN' bit isn't set - * - * Expected behaviour: - * - Scanning is not disabled. - * - The advertiser doesn't attempt to change the identity addr with bt_id_set_adv_private_addr() - * - The advertiser uses the same identity address as the scanner. - */ -ZTEST(bt_id_set_adv_own_addr, test_set_adv_own_addr_while_scanning_with_identity_public) -{ - uint32_t options = 0; - struct bt_le_ext_adv adv = {0}; - int err; - uint8_t scan_own_addr_type = BT_ADDR_LE_ANONYMOUS; - uint8_t adv_own_addr_type = BT_ADDR_LE_ANONYMOUS; - - Z_TEST_SKIP_IFDEF(CONFIG_BT_PRIVACY); - Z_TEST_SKIP_IFDEF(CONFIG_BT_EXT_ADV); - Z_TEST_SKIP_IFNDEF(CONFIG_BT_OBSERVER); - Z_TEST_SKIP_IFNDEF(CONFIG_BT_SCAN_WITH_IDENTITY); - - options &= ~BT_LE_ADV_OPT_CONN; - - bt_addr_le_copy(&bt_dev.id_addr[BT_ID_DEFAULT], BT_LE_ADDR); - - err = bt_id_set_scan_own_addr(false, &scan_own_addr_type); - - zassert_ok(err, "Unexpected error code '%d' was returned", err); - zassert_true(scan_own_addr_type == BT_HCI_OWN_ADDR_PUBLIC, - "Address type reference was incorrectly set"); - - atomic_set_bit(bt_dev.flags, BT_DEV_SCANNING); - - bt_id_set_adv_own_addr(&adv, options, true, &adv_own_addr_type); - zassert_true(adv_own_addr_type == BT_HCI_OWN_ADDR_PUBLIC, - "Address type reference was incorrectly set"); - - expect_call_count_bt_le_scan_set_enable(0, NULL); -} diff --git a/tests/bluetooth/host/id/bt_id_set_adv_own_addr/testcase.yaml b/tests/bluetooth/host/id/bt_id_set_adv_own_addr/testcase.yaml index d5ab3e4ef858..145096d0ce78 100644 --- a/tests/bluetooth/host/id/bt_id_set_adv_own_addr/testcase.yaml +++ b/tests/bluetooth/host/id/bt_id_set_adv_own_addr/testcase.yaml @@ -14,7 +14,3 @@ tests: extra_configs: - CONFIG_BT_SMP=y - CONFIG_BT_PRIVACY=y - bluetooth.host.bt_id_set_adv_own_addr.scan_with_identity: - type: unit - extra_configs: - - CONFIG_BT_SCAN_WITH_IDENTITY=y From 27211d63ef20263ea9f5d2047bc98931b1604ecb Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:03 +0300 Subject: [PATCH 1424/2141] Revert "[nrf fromtree] bluetooth: host: rename bool scan_enabled -> scan_disabled" This reverts commit 2d8cdbbd2959dc284e61966e3cbbaf6309374604. Signed-off-by: Jukka Rissanen --- subsys/bluetooth/host/id.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/subsys/bluetooth/host/id.c b/subsys/bluetooth/host/id.c index e791516e74c8..96c2f4e988ae 100644 --- a/subsys/bluetooth/host/id.c +++ b/subsys/bluetooth/host/id.c @@ -1986,13 +1986,13 @@ int bt_id_set_adv_own_addr(struct bt_le_ext_adv *adv, uint32_t options, * problem. */ #if defined(CONFIG_BT_OBSERVER) - bool scan_disabled = false; + bool scan_enabled = false; /* If active scan with NRPA is ongoing refresh NRPA */ if (!IS_ENABLED(CONFIG_BT_PRIVACY) && !IS_ENABLED(CONFIG_BT_SCAN_WITH_IDENTITY) && atomic_test_bit(bt_dev.flags, BT_DEV_SCANNING)) { - scan_disabled = true; + scan_enabled = true; bt_le_scan_set_enable(BT_HCI_LE_SCAN_DISABLE); } #endif /* defined(CONFIG_BT_OBSERVER) */ @@ -2000,7 +2000,7 @@ int bt_id_set_adv_own_addr(struct bt_le_ext_adv *adv, uint32_t options, *own_addr_type = BT_HCI_OWN_ADDR_RANDOM; #if defined(CONFIG_BT_OBSERVER) - if (scan_disabled) { + if (scan_enabled) { bt_le_scan_set_enable(BT_HCI_LE_SCAN_ENABLE); } #endif /* defined(CONFIG_BT_OBSERVER) */ From 76d9a0cf53e3aca067acee89e250ca8a25199e54 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:03 +0300 Subject: [PATCH 1425/2141] Revert "[nrf fromtree] bluetooth: host: Fix uninitialized own_addr_type for legacy scan+adv" This reverts commit d8c362172b5a281113bd285540f6eadd4ca40280. Signed-off-by: Jukka Rissanen --- subsys/bluetooth/host/id.c | 54 +++---------- .../id/bt_id_set_scan_own_addr/src/main.c | 77 ------------------- .../id/bt_id_set_scan_own_addr/testcase.yaml | 4 - 3 files changed, 12 insertions(+), 123 deletions(-) diff --git a/subsys/bluetooth/host/id.c b/subsys/bluetooth/host/id.c index 96c2f4e988ae..af5176574eb0 100644 --- a/subsys/bluetooth/host/id.c +++ b/subsys/bluetooth/host/id.c @@ -1778,7 +1778,7 @@ int bt_id_set_create_conn_own_addr(bool use_filter, uint8_t *own_addr_type) #endif /* defined(CONFIG_BT_CENTRAL) */ #if defined(CONFIG_BT_OBSERVER) -static bool is_legacy_adv_enabled(void) +static bool is_adv_using_rand_addr(void) { struct bt_le_ext_adv *adv; @@ -1794,27 +1794,7 @@ static bool is_legacy_adv_enabled(void) adv = bt_le_adv_lookup_legacy(); - return adv != NULL && atomic_test_bit(adv->flags, BT_ADV_ENABLED); -} - -static bool is_legacy_adv_using_id_addr(void) -{ - struct bt_le_ext_adv *adv; - - if (!IS_ENABLED(CONFIG_BT_BROADCASTER) || - (IS_ENABLED(CONFIG_BT_EXT_ADV) && - BT_DEV_FEAT_LE_EXT_ADV(bt_dev.le.features))) { - /* When advertising is not enabled or is using extended - * advertising HCI commands then only the scanner uses the set - * random address command. - */ - return false; - } - - adv = bt_le_adv_lookup_legacy(); - - return adv != NULL && atomic_test_bit(adv->flags, BT_ADV_ENABLED) - && atomic_test_bit(adv->flags, BT_ADV_USE_IDENTITY); + return adv && atomic_test_bit(adv->flags, BT_ADV_ENABLED); } int bt_id_set_scan_own_addr(bool active_scan, uint8_t *own_addr_type) @@ -1847,30 +1827,20 @@ int bt_id_set_scan_own_addr(bool active_scan, uint8_t *own_addr_type) * (through Kconfig). * Use same RPA as legacy advertiser if advertising. */ - if (!IS_ENABLED(CONFIG_BT_SCAN_WITH_IDENTITY)) { - /* When using legacy advertising commands, the scanner and advertiser - * share the same address, so we cannot change it. - * When using extended advertising commands, however, the advertising - * sets have their own addresses, so we can always change the scanner - * address here. - */ - if (is_legacy_adv_using_id_addr()) { - if (bt_dev.id_addr[BT_ID_DEFAULT].type == BT_ADDR_LE_RANDOM) { - *own_addr_type = BT_HCI_OWN_ADDR_RANDOM; - } else { - *own_addr_type = BT_HCI_OWN_ADDR_PUBLIC; - } - } else if (is_legacy_adv_enabled()) { - *own_addr_type = BT_HCI_OWN_ADDR_RANDOM; - } else { - err = bt_id_set_private_addr(BT_ID_DEFAULT); - if (err) { + if (!IS_ENABLED(CONFIG_BT_SCAN_WITH_IDENTITY) && + !is_adv_using_rand_addr()) { + err = bt_id_set_private_addr(BT_ID_DEFAULT); + if (err) { + if (active_scan || !is_adv_using_rand_addr()) { return err; } - *own_addr_type = BT_HCI_OWN_ADDR_RANDOM; + LOG_WRN("Ignoring failure to set address for passive scan (%d)", + err); } - } else { + + *own_addr_type = BT_HCI_OWN_ADDR_RANDOM; + } else if (IS_ENABLED(CONFIG_BT_SCAN_WITH_IDENTITY)) { if (bt_dev.id_addr[BT_ID_DEFAULT].type == BT_ADDR_LE_RANDOM) { /* If scanning with Identity Address we must set the * random identity address for both active and passive diff --git a/tests/bluetooth/host/id/bt_id_set_scan_own_addr/src/main.c b/tests/bluetooth/host/id/bt_id_set_scan_own_addr/src/main.c index 2c1fbc675d71..c39411897cd9 100644 --- a/tests/bluetooth/host/id/bt_id_set_scan_own_addr/src/main.c +++ b/tests/bluetooth/host/id/bt_id_set_scan_own_addr/src/main.c @@ -7,8 +7,6 @@ #include "mocks/crypto.h" #include "mocks/hci_core.h" #include "mocks/rpa.h" -#include "mocks/adv.h" -#include "mocks/adv_expects.h" #include "testing_common_defs.h" #include @@ -77,81 +75,6 @@ ZTEST(bt_id_set_scan_own_addr, test_set_nrpa_scan_address_no_privacy) "Address type reference was incorrectly set"); } -/* - * Test setting scan own address while 'CONFIG_BT_PRIVACY' isn't enabled. - * Advertising is ongoing and uses a random device address. - * - * Constraints: - * - bt_id_set_private_addr() succeeds and returns 0 - * - 'CONFIG_BT_SCAN_WITH_IDENTITY' isn't enabled - * - 'CONFIG_BT_PRIVACY' isn't enabled - * - * Expected behaviour: - * - bt_id_set_scan_own_addr() returns 0 - * - Address type reference is updated - */ -ZTEST(bt_id_set_scan_own_addr, test_set_nrpa_scan_address_no_privacy_adv_ongoing_random_identity) -{ - int err; - struct bt_le_ext_adv *adv = &bt_dev.adv; - uint8_t own_addr_type = BT_ADDR_LE_ANONYMOUS; - - Z_TEST_SKIP_IFDEF(CONFIG_BT_PRIVACY); - Z_TEST_SKIP_IFDEF(CONFIG_BT_SCAN_WITH_IDENTITY); - Z_TEST_SKIP_IFNDEF(CONFIG_BT_BROADCASTER); - - bt_rand_fake.custom_fake = bt_rand_custom_fake; - bt_le_adv_lookup_legacy_fake.return_val = adv; - - bt_addr_le_copy(&bt_dev.id_addr[BT_ID_DEFAULT], BT_STATIC_RANDOM_LE_ADDR_1); - - atomic_set_bit(adv->flags, BT_ADV_ENABLED); - - err = bt_id_set_scan_own_addr(false, &own_addr_type); - - zassert_ok(err, "Unexpected error code '%d' was returned", err); - zassert_true(own_addr_type == BT_HCI_OWN_ADDR_RANDOM, - "Address type reference was incorrectly set"); -} - -/* - * Test setting scan own address while 'CONFIG_BT_PRIVACY' isn't enabled. - * Advertising is ongoing and uses a public device address. - * - * Constraints: - * - bt_id_set_private_addr() succeeds and returns 0 - * - 'CONFIG_BT_SCAN_WITH_IDENTITY' isn't enabled - * - 'CONFIG_BT_PRIVACY' isn't enabled - * - * Expected behaviour: - * - bt_id_set_scan_own_addr() returns 0 - * - Address type reference is updated - */ -ZTEST(bt_id_set_scan_own_addr, test_set_nrpa_scan_address_no_privacy_adv_ongoing_public_identity) -{ - int err; - struct bt_le_ext_adv *adv = &bt_dev.adv; - uint8_t own_addr_type = BT_ADDR_LE_ANONYMOUS; - - Z_TEST_SKIP_IFDEF(CONFIG_BT_PRIVACY); - Z_TEST_SKIP_IFDEF(CONFIG_BT_SCAN_WITH_IDENTITY); - Z_TEST_SKIP_IFNDEF(CONFIG_BT_BROADCASTER); - - bt_rand_fake.custom_fake = bt_rand_custom_fake; - bt_le_adv_lookup_legacy_fake.return_val = adv; - - bt_addr_le_copy(&bt_dev.id_addr[BT_ID_DEFAULT], BT_LE_ADDR); - - atomic_set_bit(adv->flags, BT_ADV_ENABLED); - atomic_set_bit(adv->flags, BT_ADV_USE_IDENTITY); - - err = bt_id_set_scan_own_addr(false, &own_addr_type); - - zassert_ok(err, "Unexpected error code '%d' was returned", err); - zassert_true(own_addr_type == BT_HCI_OWN_ADDR_PUBLIC, - "Address type reference was incorrectly set"); -} - /* * Test setting scan own address while 'CONFIG_BT_PRIVACY' isn't enabled. * If 'CONFIG_BT_SCAN_WITH_IDENTITY' is enabled and the default identity has an RPA address of type diff --git a/tests/bluetooth/host/id/bt_id_set_scan_own_addr/testcase.yaml b/tests/bluetooth/host/id/bt_id_set_scan_own_addr/testcase.yaml index 7e3cab5ce37e..4198d2bf91b4 100644 --- a/tests/bluetooth/host/id/bt_id_set_scan_own_addr/testcase.yaml +++ b/tests/bluetooth/host/id/bt_id_set_scan_own_addr/testcase.yaml @@ -20,7 +20,3 @@ tests: - CONFIG_BT_SCAN_WITH_IDENTITY=y - CONFIG_BT_SMP=y - CONFIG_BT_PRIVACY=y - bluetooth.host.bt_id_set_scan_own_addr.scan_while_advertising: - type: unit - extra_configs: - - CONFIG_BT_BROADCASTER=y From 330392e9d8ac89d1d641c208cdf5c98a81f0fa71 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:03 +0300 Subject: [PATCH 1426/2141] Revert "[nrf fromtree] manifest: nrf_wifi: Pull new raw TX handling" This reverts commit 8e678b1e03730e0876608a8b6431ff6a8a1adcd4. Signed-off-by: Jukka Rissanen --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 9807058ac13b..d3a70e368671 100644 --- a/west.yml +++ b/west.yml @@ -328,7 +328,7 @@ manifest: revision: 968d55ff22579080466bf2f482596dd6e35361c6 path: modules/bsim_hw_models/nrf_hw_models - name: nrf_wifi - revision: 52286f111b4765e0dd40f43124e7bb5c14758dff + revision: 7cb2f44f46dfc86e4f97477ee90022944e138dd8 path: modules/lib/nrf_wifi - name: open-amp revision: f7f4d083c7909a39d86e217376c69b416ec4faf3 From 0992226a6976fcd2b83bd1be4e2096ea26113fa0 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:03 +0300 Subject: [PATCH 1427/2141] Revert "[nrf fromtree] modules: nrf_wifi: Implement new Raw TX APIs" This reverts commit c890bf3f332b38e6a53969c5ab1198fc394ff727. Signed-off-by: Jukka Rissanen --- modules/nrf_wifi/os/shim.c | 57 -------------------------------------- 1 file changed, 57 deletions(-) diff --git a/modules/nrf_wifi/os/shim.c b/modules/nrf_wifi/os/shim.c index 29b72203b552..b892d50df7f4 100644 --- a/modules/nrf_wifi/os/shim.c +++ b/modules/nrf_wifi/os/shim.c @@ -275,9 +275,6 @@ struct nwb { void (*cleanup_cb)(); unsigned char priority; bool chksum_done; -#ifdef CONFIG_NRF70_RAW_DATA_TX - void *raw_tx_hdr; -#endif /* CONFIG_NRF70_RAW_DATA_TX */ #ifdef CONFIG_NRF_WIFI_ZERO_COPY_TX struct net_pkt *pkt; #endif @@ -403,55 +400,6 @@ static void zep_shim_nbuf_set_chksum_done(void *nbuf, unsigned char chksum_done) nwb->chksum_done = (bool)chksum_done; } -#ifdef CONFIG_NRF70_RAW_DATA_TX -static void *zep_shim_nbuf_set_raw_tx_hdr(void *nbuf, unsigned short raw_hdr_len) -{ - struct nwb *nwb = (struct nwb *)nbuf; - - if (!nwb) { - LOG_ERR("%s: Received network buffer is NULL", __func__); - return NULL; - } - - nwb->raw_tx_hdr = zep_shim_nbuf_data_get(nwb); - if (!nwb->raw_tx_hdr) { - LOG_ERR("%s: Unable to set raw Tx header in network buffer", __func__); - return NULL; - } - - zep_shim_nbuf_data_pull(nwb, raw_hdr_len); - - return nwb->raw_tx_hdr; -} - -static void *zep_shim_nbuf_get_raw_tx_hdr(void *nbuf) -{ - struct nwb *nwb = (struct nwb *)nbuf; - - if (!nwb) { - LOG_ERR("%s: Received network buffer is NULL", __func__); - return NULL; - } - - return nwb->raw_tx_hdr; -} - -static bool zep_shim_nbuf_is_raw_tx(void *nbuf) -{ - struct nwb *nwb = (struct nwb *)nbuf; - - if (!nwb) { - LOG_ERR("%s: Received network buffer is NULL", __func__); - return false; - } - - return (nwb->raw_tx_hdr != NULL); -} -#endif /* CONFIG_NRF70_RAW_DATA_TX */ - - - - #include #include @@ -1244,11 +1192,6 @@ const struct nrf_wifi_osal_ops nrf_wifi_os_zep_ops = { .nbuf_get_priority = zep_shim_nbuf_get_priority, .nbuf_get_chksum_done = zep_shim_nbuf_get_chksum_done, .nbuf_set_chksum_done = zep_shim_nbuf_set_chksum_done, -#ifdef CONFIG_NRF70_RAW_DATA_TX - .nbuf_set_raw_tx_hdr = zep_shim_nbuf_set_raw_tx_hdr, - .nbuf_get_raw_tx_hdr = zep_shim_nbuf_get_raw_tx_hdr, - .nbuf_is_raw_tx = zep_shim_nbuf_is_raw_tx, -#endif /* CONFIG_NRF70_RAW_DATA_TX */ .tasklet_alloc = zep_shim_work_alloc, .tasklet_free = zep_shim_work_free, From b843a965a4df4d0a44a398c0aa59bf14a98f6b09 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:03 +0300 Subject: [PATCH 1428/2141] Revert "[nrf fromtree] tests: bsim: bluetooth: Remove bt_hci_cmd_create() usage" This reverts commit b704c93b2db67b37885c5f5724a9db5f756b68b2. Signed-off-by: Jukka Rissanen --- .../host/att/pipeline/tester/src/main.c | 14 +++++++------- .../host/att/sequential/tester/src/main.c | 14 +++++++------- .../host/l2cap/reassembly/peer/src/peer.c | 16 ++++++++-------- .../bluetooth/host/l2cap/split/tester/src/main.c | 14 +++++++------- .../host/misc/disconnect/tester/src/main.c | 14 +++++++------- .../host/misc/hfc_multilink/tester/src/tester.c | 16 ++++++++-------- 6 files changed, 44 insertions(+), 44 deletions(-) diff --git a/tests/bsim/bluetooth/host/att/pipeline/tester/src/main.c b/tests/bsim/bluetooth/host/att/pipeline/tester/src/main.c index 08320f4b6cec..5ad05dfdff1f 100644 --- a/tests/bsim/bluetooth/host/att/pipeline/tester/src/main.c +++ b/tests/bsim/bluetooth/host/att/pipeline/tester/src/main.c @@ -66,7 +66,7 @@ static uint16_t conn_handle; static volatile uint16_t active_opcode = 0xFFFF; static struct net_buf *cmd_rsp; -static struct net_buf *create_cmd(uint16_t opcode, uint8_t param_len) +struct net_buf *bt_hci_cmd_create(uint16_t opcode, uint8_t param_len) { struct bt_hci_cmd_hdr *hdr; struct net_buf *buf; @@ -349,7 +349,7 @@ static void send_cmd(uint16_t opcode, struct net_buf *cmd, struct net_buf **rsp) LOG_DBG("opcode %x", opcode); if (!cmd) { - cmd = create_cmd(opcode, 0); + cmd = bt_hci_cmd_create(opcode, 0); } k_sem_take(&cmd_sem, K_FOREVER); @@ -420,7 +420,7 @@ static void read_max_data_len(uint16_t *tx_octets, uint16_t *tx_time) static void write_default_data_len(uint16_t tx_octets, uint16_t tx_time) { struct bt_hci_cp_le_write_default_data_len *cp; - struct net_buf *buf = create_cmd(BT_HCI_OP_LE_WRITE_DEFAULT_DATA_LEN, sizeof(*cp)); + struct net_buf *buf = bt_hci_cmd_create(BT_HCI_OP_LE_WRITE_DEFAULT_DATA_LEN, sizeof(*cp)); TEST_ASSERT_NO_MSG(buf); @@ -446,7 +446,7 @@ static void set_event_mask(uint16_t opcode) uint64_t mask = 0U; /* The two commands have the same length/params */ - buf = create_cmd(opcode, sizeof(*cp_mask)); + buf = bt_hci_cmd_create(opcode, sizeof(*cp_mask)); TEST_ASSERT_NO_MSG(buf); /* Forward all events */ @@ -464,7 +464,7 @@ static void set_random_address(void) LOG_DBG("%s", bt_addr_str(&addr.a)); - buf = create_cmd(BT_HCI_OP_LE_SET_RANDOM_ADDRESS, sizeof(addr.a)); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_RANDOM_ADDRESS, sizeof(addr.a)); TEST_ASSERT_NO_MSG(buf); net_buf_add_mem(buf, &addr.a, sizeof(addr.a)); @@ -487,12 +487,12 @@ void start_adv(void) set_param.own_addr_type = BT_HCI_OWN_ADDR_RANDOM; /* configure */ - buf = create_cmd(BT_HCI_OP_LE_SET_ADV_PARAM, sizeof(set_param)); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_ADV_PARAM, sizeof(set_param)); net_buf_add_mem(buf, &set_param, sizeof(set_param)); send_cmd(BT_HCI_OP_LE_SET_ADV_PARAM, buf, NULL); /* start */ - buf = create_cmd(BT_HCI_OP_LE_SET_ADV_ENABLE, 1); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_ADV_ENABLE, 1); net_buf_add_u8(buf, BT_HCI_LE_ADV_ENABLE); send_cmd(BT_HCI_OP_LE_SET_ADV_ENABLE, buf, NULL); } diff --git a/tests/bsim/bluetooth/host/att/sequential/tester/src/main.c b/tests/bsim/bluetooth/host/att/sequential/tester/src/main.c index 6059b906bcaa..a3622c956c8b 100644 --- a/tests/bsim/bluetooth/host/att/sequential/tester/src/main.c +++ b/tests/bsim/bluetooth/host/att/sequential/tester/src/main.c @@ -61,7 +61,7 @@ static uint16_t conn_handle; static volatile uint16_t active_opcode = 0xFFFF; static struct net_buf *cmd_rsp; -static struct net_buf *create_cmd(uint16_t opcode, uint8_t param_len) +struct net_buf *bt_hci_cmd_create(uint16_t opcode, uint8_t param_len) { struct bt_hci_cmd_hdr *hdr; struct net_buf *buf; @@ -326,7 +326,7 @@ static void send_cmd(uint16_t opcode, struct net_buf *cmd, struct net_buf **rsp) LOG_DBG("opcode %x", opcode); if (!cmd) { - cmd = create_cmd(opcode, 0); + cmd = bt_hci_cmd_create(opcode, 0); } k_sem_take(&cmd_sem, K_FOREVER); @@ -397,7 +397,7 @@ static void read_max_data_len(uint16_t *tx_octets, uint16_t *tx_time) static void write_default_data_len(uint16_t tx_octets, uint16_t tx_time) { struct bt_hci_cp_le_write_default_data_len *cp; - struct net_buf *buf = create_cmd(BT_HCI_OP_LE_WRITE_DEFAULT_DATA_LEN, sizeof(*cp)); + struct net_buf *buf = bt_hci_cmd_create(BT_HCI_OP_LE_WRITE_DEFAULT_DATA_LEN, sizeof(*cp)); TEST_ASSERT_NO_MSG(buf); @@ -423,7 +423,7 @@ static void set_event_mask(uint16_t opcode) uint64_t mask = 0U; /* The two commands have the same length/params */ - buf = create_cmd(opcode, sizeof(*cp_mask)); + buf = bt_hci_cmd_create(opcode, sizeof(*cp_mask)); TEST_ASSERT_NO_MSG(buf); /* Forward all events */ @@ -441,7 +441,7 @@ static void set_random_address(void) LOG_DBG("%s", bt_addr_str(&addr.a)); - buf = create_cmd(BT_HCI_OP_LE_SET_RANDOM_ADDRESS, sizeof(addr.a)); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_RANDOM_ADDRESS, sizeof(addr.a)); TEST_ASSERT_NO_MSG(buf); net_buf_add_mem(buf, &addr.a, sizeof(addr.a)); @@ -464,12 +464,12 @@ void start_adv(void) set_param.own_addr_type = BT_HCI_OWN_ADDR_RANDOM; /* configure */ - buf = create_cmd(BT_HCI_OP_LE_SET_ADV_PARAM, sizeof(set_param)); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_ADV_PARAM, sizeof(set_param)); net_buf_add_mem(buf, &set_param, sizeof(set_param)); send_cmd(BT_HCI_OP_LE_SET_ADV_PARAM, buf, NULL); /* start */ - buf = create_cmd(BT_HCI_OP_LE_SET_ADV_ENABLE, 1); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_ADV_ENABLE, 1); net_buf_add_u8(buf, BT_HCI_LE_ADV_ENABLE); send_cmd(BT_HCI_OP_LE_SET_ADV_ENABLE, buf, NULL); } diff --git a/tests/bsim/bluetooth/host/l2cap/reassembly/peer/src/peer.c b/tests/bsim/bluetooth/host/l2cap/reassembly/peer/src/peer.c index a3e7c20d715a..8c9532718841 100644 --- a/tests/bsim/bluetooth/host/l2cap/reassembly/peer/src/peer.c +++ b/tests/bsim/bluetooth/host/l2cap/reassembly/peer/src/peer.c @@ -57,7 +57,7 @@ static uint16_t conn_handle; static volatile uint16_t active_opcode = 0xFFFF; static struct net_buf *cmd_rsp; -static struct net_buf *create_cmd(uint16_t opcode, uint8_t param_len) +struct net_buf *bt_hci_cmd_create(uint16_t opcode, uint8_t param_len) { struct bt_hci_cmd_hdr *hdr; struct net_buf *buf; @@ -279,7 +279,7 @@ static void send_cmd(uint16_t opcode, struct net_buf *cmd, struct net_buf **rsp) LOG_DBG("opcode %x", opcode); if (!cmd) { - cmd = create_cmd(opcode, 0); + cmd = bt_hci_cmd_create(opcode, 0); } k_sem_take(&cmd_sem, K_FOREVER); @@ -352,7 +352,7 @@ static void set_event_mask(uint16_t opcode) uint64_t mask = 0U; /* The two commands have the same length/params */ - buf = create_cmd(opcode, sizeof(*cp_mask)); + buf = bt_hci_cmd_create(opcode, sizeof(*cp_mask)); TEST_ASSERT_NO_MSG(buf); /* Forward all events */ @@ -370,7 +370,7 @@ static void set_random_address(void) LOG_DBG("%s", bt_addr_str(&addr.a)); - buf = create_cmd(BT_HCI_OP_LE_SET_RANDOM_ADDRESS, sizeof(addr.a)); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_RANDOM_ADDRESS, sizeof(addr.a)); TEST_ASSERT_NO_MSG(buf); net_buf_add_mem(buf, &addr.a, sizeof(addr.a)); @@ -392,7 +392,7 @@ static void start_adv(uint16_t interval, const char *name, size_t name_len) data.data[1] = BT_DATA_NAME_COMPLETE; memcpy(&data.data[2], name, name_len); - buf = create_cmd(BT_HCI_OP_LE_SET_ADV_DATA, sizeof(data)); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_ADV_DATA, sizeof(data)); __ASSERT_NO_MSG(buf); net_buf_add_mem(buf, &data, sizeof(data)); send_cmd(BT_HCI_OP_LE_SET_ADV_DATA, buf, NULL); @@ -405,13 +405,13 @@ static void start_adv(uint16_t interval, const char *name, size_t name_len) set_param.type = BT_HCI_ADV_IND; set_param.own_addr_type = BT_HCI_OWN_ADDR_RANDOM; - buf = create_cmd(BT_HCI_OP_LE_SET_ADV_PARAM, sizeof(set_param)); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_ADV_PARAM, sizeof(set_param)); __ASSERT_NO_MSG(buf); net_buf_add_mem(buf, &set_param, sizeof(set_param)); send_cmd(BT_HCI_OP_LE_SET_ADV_PARAM, buf, NULL); - buf = create_cmd(BT_HCI_OP_LE_SET_ADV_ENABLE, 1); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_ADV_ENABLE, 1); __ASSERT_NO_MSG(buf); net_buf_add_u8(buf, BT_HCI_LE_ADV_ENABLE); @@ -427,7 +427,7 @@ static void disconnect(void) LOG_INF("Disconnecting"); - buf = create_cmd(BT_HCI_OP_DISCONNECT, sizeof(*disconn)); + buf = bt_hci_cmd_create(BT_HCI_OP_DISCONNECT, sizeof(*disconn)); TEST_ASSERT(buf); disconn = net_buf_add(buf, sizeof(*disconn)); diff --git a/tests/bsim/bluetooth/host/l2cap/split/tester/src/main.c b/tests/bsim/bluetooth/host/l2cap/split/tester/src/main.c index e7c559b83a23..dc7e72d91d0e 100644 --- a/tests/bsim/bluetooth/host/l2cap/split/tester/src/main.c +++ b/tests/bsim/bluetooth/host/l2cap/split/tester/src/main.c @@ -49,7 +49,7 @@ static uint16_t conn_handle; static uint16_t active_opcode = 0xFFFF; static struct net_buf *cmd_rsp; -static struct net_buf *create_cmd(uint16_t opcode, uint8_t param_len) +struct net_buf *bt_hci_cmd_create(uint16_t opcode, uint8_t param_len) { struct bt_hci_cmd_hdr *hdr; struct net_buf *buf; @@ -306,7 +306,7 @@ static void send_cmd(uint16_t opcode, struct net_buf *cmd, struct net_buf **rsp) LOG_DBG("opcode %x", opcode); if (!cmd) { - cmd = create_cmd(opcode, 0); + cmd = bt_hci_cmd_create(opcode, 0); } k_sem_take(&cmd_sem, K_FOREVER); @@ -377,7 +377,7 @@ static void read_max_data_len(uint16_t *tx_octets, uint16_t *tx_time) static void write_default_data_len(uint16_t tx_octets, uint16_t tx_time) { struct bt_hci_cp_le_write_default_data_len *cp; - struct net_buf *buf = create_cmd(BT_HCI_OP_LE_WRITE_DEFAULT_DATA_LEN, sizeof(*cp)); + struct net_buf *buf = bt_hci_cmd_create(BT_HCI_OP_LE_WRITE_DEFAULT_DATA_LEN, sizeof(*cp)); __ASSERT_NO_MSG(buf); @@ -403,7 +403,7 @@ static void set_event_mask(uint16_t opcode) uint64_t mask = 0U; /* The two commands have the same length/params */ - buf = create_cmd(opcode, sizeof(*cp_mask)); + buf = bt_hci_cmd_create(opcode, sizeof(*cp_mask)); __ASSERT_NO_MSG(buf); /* Forward all events */ @@ -421,7 +421,7 @@ static void set_random_address(void) LOG_DBG("%s", bt_addr_str(&addr.a)); - buf = create_cmd(BT_HCI_OP_LE_SET_RANDOM_ADDRESS, sizeof(addr.a)); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_RANDOM_ADDRESS, sizeof(addr.a)); __ASSERT_NO_MSG(buf); net_buf_add_mem(buf, &addr.a, sizeof(addr.a)); @@ -442,13 +442,13 @@ void start_adv(uint16_t interval) set_param.type = BT_HCI_ADV_IND; set_param.own_addr_type = BT_HCI_OWN_ADDR_RANDOM; - buf = create_cmd(BT_HCI_OP_LE_SET_ADV_PARAM, sizeof(set_param)); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_ADV_PARAM, sizeof(set_param)); __ASSERT_NO_MSG(buf); net_buf_add_mem(buf, &set_param, sizeof(set_param)); send_cmd(BT_HCI_OP_LE_SET_ADV_PARAM, buf, NULL); - buf = create_cmd(BT_HCI_OP_LE_SET_ADV_ENABLE, 1); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_ADV_ENABLE, 1); __ASSERT_NO_MSG(buf); net_buf_add_u8(buf, BT_HCI_LE_ADV_ENABLE); diff --git a/tests/bsim/bluetooth/host/misc/disconnect/tester/src/main.c b/tests/bsim/bluetooth/host/misc/disconnect/tester/src/main.c index 32189870581d..a4fdb5ab1496 100644 --- a/tests/bsim/bluetooth/host/misc/disconnect/tester/src/main.c +++ b/tests/bsim/bluetooth/host/misc/disconnect/tester/src/main.c @@ -59,7 +59,7 @@ static uint16_t conn_handle; static volatile uint16_t active_opcode = 0xFFFF; static struct net_buf *cmd_rsp; -static struct net_buf *create_cmd(uint16_t opcode, uint8_t param_len) +struct net_buf *bt_hci_cmd_create(uint16_t opcode, uint8_t param_len) { struct bt_hci_cmd_hdr *hdr; struct net_buf *buf; @@ -303,7 +303,7 @@ static void send_cmd(uint16_t opcode, struct net_buf *cmd, struct net_buf **rsp) LOG_DBG("opcode %x", opcode); if (!cmd) { - cmd = create_cmd(opcode, 0); + cmd = bt_hci_cmd_create(opcode, 0); } k_sem_take(&cmd_sem, K_FOREVER); @@ -374,7 +374,7 @@ static void read_max_data_len(uint16_t *tx_octets, uint16_t *tx_time) static void write_default_data_len(uint16_t tx_octets, uint16_t tx_time) { struct bt_hci_cp_le_write_default_data_len *cp; - struct net_buf *buf = create_cmd(BT_HCI_OP_LE_WRITE_DEFAULT_DATA_LEN, sizeof(*cp)); + struct net_buf *buf = bt_hci_cmd_create(BT_HCI_OP_LE_WRITE_DEFAULT_DATA_LEN, sizeof(*cp)); TEST_ASSERT_NO_MSG(buf); @@ -400,7 +400,7 @@ static void set_event_mask(uint16_t opcode) uint64_t mask = 0U; /* The two commands have the same length/params */ - buf = create_cmd(opcode, sizeof(*cp_mask)); + buf = bt_hci_cmd_create(opcode, sizeof(*cp_mask)); TEST_ASSERT_NO_MSG(buf); /* Forward all events */ @@ -418,7 +418,7 @@ static void set_random_address(void) LOG_DBG("%s", bt_addr_str(&addr.a)); - buf = create_cmd(BT_HCI_OP_LE_SET_RANDOM_ADDRESS, sizeof(addr.a)); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_RANDOM_ADDRESS, sizeof(addr.a)); TEST_ASSERT_NO_MSG(buf); net_buf_add_mem(buf, &addr.a, sizeof(addr.a)); @@ -441,12 +441,12 @@ void start_adv(void) set_param.own_addr_type = BT_HCI_OWN_ADDR_RANDOM; /* configure */ - buf = create_cmd(BT_HCI_OP_LE_SET_ADV_PARAM, sizeof(set_param)); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_ADV_PARAM, sizeof(set_param)); net_buf_add_mem(buf, &set_param, sizeof(set_param)); send_cmd(BT_HCI_OP_LE_SET_ADV_PARAM, buf, NULL); /* start */ - buf = create_cmd(BT_HCI_OP_LE_SET_ADV_ENABLE, 1); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_ADV_ENABLE, 1); net_buf_add_u8(buf, BT_HCI_LE_ADV_ENABLE); send_cmd(BT_HCI_OP_LE_SET_ADV_ENABLE, buf, NULL); } diff --git a/tests/bsim/bluetooth/host/misc/hfc_multilink/tester/src/tester.c b/tests/bsim/bluetooth/host/misc/hfc_multilink/tester/src/tester.c index f4f38fedc15c..a06a5af9b92c 100644 --- a/tests/bsim/bluetooth/host/misc/hfc_multilink/tester/src/tester.c +++ b/tests/bsim/bluetooth/host/misc/hfc_multilink/tester/src/tester.c @@ -50,7 +50,7 @@ static uint16_t conn_handle; static uint16_t active_opcode = 0xFFFF; static struct net_buf *cmd_rsp; -static struct net_buf *create_cmd(uint16_t opcode, uint8_t param_len) +struct net_buf *bt_hci_cmd_create(uint16_t opcode, uint8_t param_len) { struct bt_hci_cmd_hdr *hdr; struct net_buf *buf; @@ -317,7 +317,7 @@ static void send_cmd(uint16_t opcode, struct net_buf *cmd, struct net_buf **rsp) LOG_DBG("opcode %x", opcode); if (!cmd) { - cmd = create_cmd(opcode, 0); + cmd = bt_hci_cmd_create(opcode, 0); } k_sem_take(&cmd_sem, K_FOREVER); @@ -388,7 +388,7 @@ static void read_max_data_len(uint16_t *tx_octets, uint16_t *tx_time) static void write_default_data_len(uint16_t tx_octets, uint16_t tx_time) { struct bt_hci_cp_le_write_default_data_len *cp; - struct net_buf *buf = create_cmd(BT_HCI_OP_LE_WRITE_DEFAULT_DATA_LEN, sizeof(*cp)); + struct net_buf *buf = bt_hci_cmd_create(BT_HCI_OP_LE_WRITE_DEFAULT_DATA_LEN, sizeof(*cp)); __ASSERT_NO_MSG(buf); @@ -414,7 +414,7 @@ static void set_event_mask(uint16_t opcode) uint64_t mask = 0U; /* The two commands have the same length/params */ - buf = create_cmd(opcode, sizeof(*cp_mask)); + buf = bt_hci_cmd_create(opcode, sizeof(*cp_mask)); __ASSERT_NO_MSG(buf); /* Forward all events */ @@ -435,7 +435,7 @@ static void set_random_address(void) LOG_DBG("%s", bt_addr_str(&addr.a)); - buf = create_cmd(BT_HCI_OP_LE_SET_RANDOM_ADDRESS, sizeof(addr.a)); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_RANDOM_ADDRESS, sizeof(addr.a)); __ASSERT_NO_MSG(buf); net_buf_add_mem(buf, &addr.a, sizeof(addr.a)); @@ -457,7 +457,7 @@ static void start_adv(uint16_t interval, const char *name, size_t name_len) data.data[1] = BT_DATA_NAME_COMPLETE; memcpy(&data.data[2], name, name_len); - buf = create_cmd(BT_HCI_OP_LE_SET_ADV_DATA, sizeof(data)); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_ADV_DATA, sizeof(data)); __ASSERT_NO_MSG(buf); net_buf_add_mem(buf, &data, sizeof(data)); send_cmd(BT_HCI_OP_LE_SET_ADV_DATA, buf, NULL); @@ -470,13 +470,13 @@ static void start_adv(uint16_t interval, const char *name, size_t name_len) set_param.type = BT_HCI_ADV_IND; set_param.own_addr_type = BT_HCI_OWN_ADDR_RANDOM; - buf = create_cmd(BT_HCI_OP_LE_SET_ADV_PARAM, sizeof(set_param)); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_ADV_PARAM, sizeof(set_param)); __ASSERT_NO_MSG(buf); net_buf_add_mem(buf, &set_param, sizeof(set_param)); send_cmd(BT_HCI_OP_LE_SET_ADV_PARAM, buf, NULL); - buf = create_cmd(BT_HCI_OP_LE_SET_ADV_ENABLE, 1); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_ADV_ENABLE, 1); __ASSERT_NO_MSG(buf); net_buf_add_u8(buf, BT_HCI_LE_ADV_ENABLE); From 8bf2f3aa8eefe8b65f95b72d5f8ebadd8c0aa212 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:03 +0300 Subject: [PATCH 1429/2141] Revert "[nrf fromtree] Bluetooth: tests: Use bt_hci_cmd_alloc()" This reverts commit e4961a8246a8b176941969962f8d2eb7afed179c. Signed-off-by: Jukka Rissanen --- .../src/test_cte_req_enable.c | 2 +- .../src/test_cte_set_rx_params.c | 2 +- .../src/test_set_conn_cte_tx_params.c | 3 ++- .../src/test_set_iq_sampling_enable.c | 3 ++- .../df/connectionless_cte_tx/src/common.c | 3 ++- .../src/test_set_cl_cte_tx_enable.c | 2 +- .../src/test_set_cl_cte_tx_param.c | 3 ++- tests/bluetooth/hci_codecs_info/src/main.c | 4 ++-- tests/bluetooth/host/conn/mocks/hci_core.c | 2 +- tests/bluetooth/host/conn/mocks/hci_core.h | 4 ++-- tests/bluetooth/host/cs/mocks/hci_core.c | 2 +- tests/bluetooth/host/cs/mocks/hci_core.h | 4 ++-- tests/bluetooth/host/id/bt_id_add/src/main.c | 6 +++--- tests/bluetooth/host/id/bt_id_del/src/main.c | 8 ++++---- .../test_suite_setup_static_random_identity.c | 2 +- .../src/test_suite_invalid_cases.c | 4 ++-- .../id/bt_id_set_adv_random_addr/src/main.c | 10 +++++----- .../src/test_suite_invalid_cases.c | 12 ++++++------ .../src/test_suite_invalid_inputs.c | 2 +- .../src/test_suite_invalid_cases.c | 2 +- .../src/test_suite_invalid_inputs.c | 2 +- tests/bluetooth/host/id/mocks/hci_core.c | 2 +- tests/bluetooth/host/id/mocks/hci_core.h | 4 ++-- .../bluetooth/host/id/mocks/hci_core_expects.c | 17 +++++++++++------ .../bluetooth/host/id/mocks/hci_core_expects.h | 12 ++++++------ tests/bsim/bluetooth/host/central/src/main.c | 2 +- 26 files changed, 64 insertions(+), 55 deletions(-) diff --git a/tests/bluetooth/df/connection_cte_req/src/test_cte_req_enable.c b/tests/bluetooth/df/connection_cte_req/src/test_cte_req_enable.c index e44db418cac6..f9f10d5ccabe 100644 --- a/tests/bluetooth/df/connection_cte_req/src/test_cte_req_enable.c +++ b/tests/bluetooth/df/connection_cte_req/src/test_cte_req_enable.c @@ -63,7 +63,7 @@ int send_conn_cte_req_enable(uint16_t conn_handle, struct bt_hci_cp_le_conn_cte_req_enable *cp; struct net_buf *buf; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_CONN_CTE_REQ_ENABLE, sizeof(*cp)); if (!buf) { return -ENOBUFS; } diff --git a/tests/bluetooth/df/connection_cte_req/src/test_cte_set_rx_params.c b/tests/bluetooth/df/connection_cte_req/src/test_cte_set_rx_params.c index e3d4eced1f73..72a0786193d3 100644 --- a/tests/bluetooth/df/connection_cte_req/src/test_cte_set_rx_params.c +++ b/tests/bluetooth/df/connection_cte_req/src/test_cte_set_rx_params.c @@ -48,7 +48,7 @@ int send_set_conn_cte_rx_params(uint16_t conn_handle, uint8_t ant_ids_num = (params != NULL ? params->switch_pattern_len : 0); - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_CONN_CTE_RX_PARAMS, sizeof(*cp) + ant_ids_num); if (!buf) { return -ENOBUFS; } diff --git a/tests/bluetooth/df/connection_cte_tx_params/src/test_set_conn_cte_tx_params.c b/tests/bluetooth/df/connection_cte_tx_params/src/test_set_conn_cte_tx_params.c index 89fef224ebcc..11cbf937a393 100644 --- a/tests/bluetooth/df/connection_cte_tx_params/src/test_set_conn_cte_tx_params.c +++ b/tests/bluetooth/df/connection_cte_tx_params/src/test_set_conn_cte_tx_params.c @@ -59,7 +59,8 @@ static int send_set_conn_cte_tx_params(uint16_t conn_handle, uint8_t *dest_ant_ids; struct net_buf *buf; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_CONN_CTE_TX_PARAMS, + sizeof(*cp) + params->switch_pattern_len); if (!buf) { return -ENOBUFS; } diff --git a/tests/bluetooth/df/connectionless_cte_rx/src/test_set_iq_sampling_enable.c b/tests/bluetooth/df/connectionless_cte_rx/src/test_set_iq_sampling_enable.c index 8a924c0a49cf..c29cc168ecbb 100644 --- a/tests/bluetooth/df/connectionless_cte_rx/src/test_set_iq_sampling_enable.c +++ b/tests/bluetooth/df/connectionless_cte_rx/src/test_set_iq_sampling_enable.c @@ -56,7 +56,8 @@ int send_set_scan_cte_rx_enable(uint16_t sync_handle, struct bt_hci_cp_le_set_cl_cte_sampling_enable *cp; struct net_buf *buf; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_CL_CTE_SAMPLING_ENABLE, + sizeof(*cp) + params->num_ant_ids); if (!buf) { return -ENOBUFS; } diff --git a/tests/bluetooth/df/connectionless_cte_tx/src/common.c b/tests/bluetooth/df/connectionless_cte_tx/src/common.c index 3e65132ccbc5..f00f96d55ad5 100644 --- a/tests/bluetooth/df/connectionless_cte_tx/src/common.c +++ b/tests/bluetooth/df/connectionless_cte_tx/src/common.c @@ -59,7 +59,8 @@ void common_set_cl_cte_tx_params(void) struct net_buf *buf; int err; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_CL_CTE_TX_PARAMS, + sizeof(*cp) + ARRAY_SIZE(ant_ids)); zassert_not_null(buf, "Failed to create HCI cmd object"); cp = net_buf_add(buf, sizeof(*cp)); diff --git a/tests/bluetooth/df/connectionless_cte_tx/src/test_set_cl_cte_tx_enable.c b/tests/bluetooth/df/connectionless_cte_tx/src/test_set_cl_cte_tx_enable.c index e5bec0a1d4c8..35267739edd1 100644 --- a/tests/bluetooth/df/connectionless_cte_tx/src/test_set_cl_cte_tx_enable.c +++ b/tests/bluetooth/df/connectionless_cte_tx/src/test_set_cl_cte_tx_enable.c @@ -35,7 +35,7 @@ int send_set_cl_cte_tx_enable(uint8_t adv_handle, atomic_t *adv_flags, struct bt_hci_cmd_state_set state; struct net_buf *buf; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_CL_CTE_TX_ENABLE, sizeof(*cp)); if (!buf) { return -ENOBUFS; } diff --git a/tests/bluetooth/df/connectionless_cte_tx/src/test_set_cl_cte_tx_param.c b/tests/bluetooth/df/connectionless_cte_tx/src/test_set_cl_cte_tx_param.c index 2c2d65ccabf7..e539730f9641 100644 --- a/tests/bluetooth/df/connectionless_cte_tx/src/test_set_cl_cte_tx_param.c +++ b/tests/bluetooth/df/connectionless_cte_tx/src/test_set_cl_cte_tx_param.c @@ -54,7 +54,8 @@ int send_set_cl_cte_tx_params(uint8_t adv_handle, uint8_t cte_len, struct bt_hci_cp_le_set_cl_cte_tx_params *cp; struct net_buf *buf; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_CL_CTE_TX_PARAMS, + sizeof(*cp) + switch_pattern_len); zassert_not_null(buf, "Failed to create HCI cmd object"); cp = net_buf_add(buf, sizeof(*cp)); diff --git a/tests/bluetooth/hci_codecs_info/src/main.c b/tests/bluetooth/hci_codecs_info/src/main.c index 5226f6dd3f46..1d2937a21e7d 100644 --- a/tests/bluetooth/hci_codecs_info/src/main.c +++ b/tests/bluetooth/hci_codecs_info/src/main.c @@ -185,7 +185,7 @@ ZTEST(test_hci_codecs_info, test_read_codec_capabilities) bt_enable(NULL); /* Read Local Supported Codec Capabilities */ - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_READ_CODEC_CAPABILITIES, sizeof(*cp)); cp = net_buf_add(buf, sizeof(*cp)); cp->codec_id.coding_format = READ_CAPABS_CODING_FMT; @@ -268,7 +268,7 @@ ZTEST(test_hci_codecs_info, test_read_ctlr_delay) bt_enable(NULL); /* Read Local Supported Controller Delay */ - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_READ_CTLR_DELAY, sizeof(*cp)); cp = net_buf_add(buf, sizeof(*cp) + sizeof(read_delay_codec_config)); cp->codec_id.coding_format = READ_DELAY_CODING_FMT; diff --git a/tests/bluetooth/host/conn/mocks/hci_core.c b/tests/bluetooth/host/conn/mocks/hci_core.c index 3ba21db49a61..363108dd3c0c 100644 --- a/tests/bluetooth/host/conn/mocks/hci_core.c +++ b/tests/bluetooth/host/conn/mocks/hci_core.c @@ -11,7 +11,7 @@ #include "hci_core.h" -DEFINE_FAKE_VALUE_FUNC(struct net_buf *, bt_hci_cmd_alloc, k_timeout_t); +DEFINE_FAKE_VALUE_FUNC(struct net_buf *, bt_hci_cmd_create, uint16_t, uint8_t); DEFINE_FAKE_VALUE_FUNC(int, bt_hci_cmd_send_sync, uint16_t, struct net_buf *, struct net_buf **); DEFINE_FAKE_VALUE_FUNC(int, bt_hci_le_read_remote_features, struct bt_conn *); DEFINE_FAKE_VALUE_FUNC(int, bt_hci_disconnect, uint16_t, uint8_t); diff --git a/tests/bluetooth/host/conn/mocks/hci_core.h b/tests/bluetooth/host/conn/mocks/hci_core.h index a12185a537ff..abc609c58ceb 100644 --- a/tests/bluetooth/host/conn/mocks/hci_core.h +++ b/tests/bluetooth/host/conn/mocks/hci_core.h @@ -9,7 +9,7 @@ /* List of fakes used by this unit tester */ #define HCI_CORE_MOCKS_FFF_FAKES_LIST(FAKE) \ - FAKE(bt_hci_cmd_alloc) \ + FAKE(bt_hci_cmd_create) \ FAKE(bt_hci_cmd_send_sync) \ FAKE(bt_hci_le_read_remote_features) \ FAKE(bt_hci_disconnect) \ @@ -24,7 +24,7 @@ FAKE(bt_lookup_id_addr) \ FAKE(bt_le_set_phy) -DECLARE_FAKE_VALUE_FUNC(struct net_buf *, bt_hci_cmd_alloc, k_timeout_t); +DECLARE_FAKE_VALUE_FUNC(struct net_buf *, bt_hci_cmd_create, uint16_t, uint8_t); DECLARE_FAKE_VALUE_FUNC(int, bt_hci_cmd_send_sync, uint16_t, struct net_buf *, struct net_buf **); DECLARE_FAKE_VALUE_FUNC(int, bt_hci_le_read_remote_features, struct bt_conn *); DECLARE_FAKE_VALUE_FUNC(int, bt_hci_disconnect, uint16_t, uint8_t); diff --git a/tests/bluetooth/host/cs/mocks/hci_core.c b/tests/bluetooth/host/cs/mocks/hci_core.c index cb5bbd4acbd7..5830c302a475 100644 --- a/tests/bluetooth/host/cs/mocks/hci_core.c +++ b/tests/bluetooth/host/cs/mocks/hci_core.c @@ -9,5 +9,5 @@ #include #include -DEFINE_FAKE_VALUE_FUNC(struct net_buf *, bt_hci_cmd_alloc, k_timeout_t); +DEFINE_FAKE_VALUE_FUNC(struct net_buf *, bt_hci_cmd_create, uint16_t, uint8_t); DEFINE_FAKE_VALUE_FUNC(int, bt_hci_cmd_send_sync, uint16_t, struct net_buf *, struct net_buf **); diff --git a/tests/bluetooth/host/cs/mocks/hci_core.h b/tests/bluetooth/host/cs/mocks/hci_core.h index f754a111d6cb..8dc28890755a 100644 --- a/tests/bluetooth/host/cs/mocks/hci_core.h +++ b/tests/bluetooth/host/cs/mocks/hci_core.h @@ -9,8 +9,8 @@ /* List of fakes used by this unit tester */ #define HCI_CORE_FFF_FAKES_LIST(FAKE) \ - FAKE(bt_hci_cmd_alloc) \ + FAKE(bt_hci_cmd_create) \ FAKE(bt_hci_cmd_send_sync) -DECLARE_FAKE_VALUE_FUNC(struct net_buf *, bt_hci_cmd_alloc, k_timeout_t); +DECLARE_FAKE_VALUE_FUNC(struct net_buf *, bt_hci_cmd_create, uint16_t, uint8_t); DECLARE_FAKE_VALUE_FUNC(int, bt_hci_cmd_send_sync, uint16_t, struct net_buf *, struct net_buf **); diff --git a/tests/bluetooth/host/id/bt_id_add/src/main.c b/tests/bluetooth/host/id/bt_id_add/src/main.c index 840dc2bd0343..2806414aeb16 100644 --- a/tests/bluetooth/host/id/bt_id_add/src/main.c +++ b/tests/bluetooth/host/id/bt_id_add/src/main.c @@ -218,7 +218,7 @@ ZTEST(bt_id_add, test_conn_lookup_returns_null_broadcaster_no_ext_adv) bt_conn_lookup_state_le_fake.return_val = NULL; /* This makes addr_res_enable() succeeds and returns 0 */ - bt_hci_cmd_alloc_fake.return_val = &net_buff; + bt_hci_cmd_create_fake.return_val = &net_buff; bt_hci_cmd_send_sync_fake.return_val = 0; bt_id_add(&keys); @@ -268,7 +268,7 @@ ZTEST(bt_id_add, test_conn_lookup_returns_null_no_ext_adv_no_resolving_entries) /* This makes hci_id_add() succeeds and returns 0 */ net_buf_simple_add_fake.return_val = &cp; - bt_hci_cmd_alloc_fake.return_val = &net_buff; + bt_hci_cmd_create_fake.return_val = &net_buff; bt_hci_cmd_send_sync_fake.return_val = 0; bt_id_add(&keys); @@ -326,7 +326,7 @@ ZTEST(bt_id_add, test_scan_re_enabled_observer_enabled_ext_adv) /* This makes hci_id_add() succeeds and returns 0 */ net_buf_simple_add_fake.return_val = &cp; - bt_hci_cmd_alloc_fake.return_val = &net_buff; + bt_hci_cmd_create_fake.return_val = &net_buff; bt_hci_cmd_send_sync_fake.return_val = 0; bt_id_add(&keys); diff --git a/tests/bluetooth/host/id/bt_id_del/src/main.c b/tests/bluetooth/host/id/bt_id_del/src/main.c index ac37caf3678c..55332b3c01c1 100644 --- a/tests/bluetooth/host/id/bt_id_del/src/main.c +++ b/tests/bluetooth/host/id/bt_id_del/src/main.c @@ -232,7 +232,7 @@ ZTEST(bt_id_del, test_conn_lookup_returns_null_broadcaster_no_ext_adv) keys.state |= BT_KEYS_ID_ADDED; /* This makes addr_res_enable() succeeds and returns 0 */ - bt_hci_cmd_alloc_fake.return_val = &net_buff; + bt_hci_cmd_create_fake.return_val = &net_buff; bt_hci_cmd_send_sync_fake.return_val = 0; bt_id_del(&keys); @@ -284,7 +284,7 @@ ZTEST(bt_id_del, test_conn_lookup_returns_null_broadcaster_no_ext_adv_privacy_en keys.state |= BT_KEYS_ID_ADDED; /* This makes addr_res_enable() succeeds and returns 0 */ - bt_hci_cmd_alloc_fake.return_val = &net_buff; + bt_hci_cmd_create_fake.return_val = &net_buff; bt_hci_cmd_send_sync_fake.return_val = 0; bt_id_del(&keys); @@ -333,7 +333,7 @@ ZTEST(bt_id_del, test_send_hci_id_del) /* This makes hci_id_del() succeeds and returns 0 */ net_buf_simple_add_fake.return_val = &cp; - bt_hci_cmd_alloc_fake.return_val = &net_buff; + bt_hci_cmd_create_fake.return_val = &net_buff; bt_hci_cmd_send_sync_fake.return_val = 0; bt_id_del(&keys); @@ -388,7 +388,7 @@ ZTEST(bt_id_del, test_scan_re_enabled_observer_enabled_ext_adv) /* This makes hci_id_del() succeeds and returns 0 */ net_buf_simple_add_fake.return_val = &cp; - bt_hci_cmd_alloc_fake.return_val = &net_buff; + bt_hci_cmd_create_fake.return_val = &net_buff; bt_hci_cmd_send_sync_fake.return_val = 0; bt_id_del(&keys); diff --git a/tests/bluetooth/host/id/bt_id_init/src/test_suite_setup_static_random_identity.c b/tests/bluetooth/host/id/bt_id_init/src/test_suite_setup_static_random_identity.c index 67c9e110c9bb..81934d79d7dc 100644 --- a/tests/bluetooth/host/id/bt_id_init/src/test_suite_setup_static_random_identity.c +++ b/tests/bluetooth/host/id/bt_id_init/src/test_suite_setup_static_random_identity.c @@ -202,7 +202,7 @@ ZTEST(bt_id_init_setup_static_random_identity, test_init_dev_identity_set_random rp->num_addrs * sizeof(struct bt_hci_vs_static_addr); /* This will make set_random_address() returns a negative number error code */ - bt_hci_cmd_alloc_fake.return_val = NULL; + bt_hci_cmd_create_fake.return_val = NULL; bt_hci_cmd_send_sync_fake.custom_fake = bt_hci_cmd_send_sync_custom_fake; err = bt_id_init(); diff --git a/tests/bluetooth/host/id/bt_id_set_adv_private_addr/src/test_suite_invalid_cases.c b/tests/bluetooth/host/id/bt_id_set_adv_private_addr/src/test_suite_invalid_cases.c index 1fd7fe2c1853..fbc13c41ebfa 100644 --- a/tests/bluetooth/host/id/bt_id_set_adv_private_addr/src/test_suite_invalid_cases.c +++ b/tests/bluetooth/host/id/bt_id_set_adv_private_addr/src/test_suite_invalid_cases.c @@ -86,7 +86,7 @@ ZTEST(bt_id_set_adv_private_addr_invalid_cases, test_set_adv_address_set_adv_ran bt_rand_fake.custom_fake = bt_rand_custom_fake; /* This will make set_random_address() returns a negative number error code */ - bt_hci_cmd_alloc_fake.return_val = NULL; + bt_hci_cmd_create_fake.return_val = NULL; err = bt_id_set_adv_private_addr(&adv_param); @@ -158,7 +158,7 @@ ZTEST(bt_id_set_adv_private_addr_invalid_cases, test_set_adv_address_if_set_adv_ /* This will make bt_id_set_adv_random_addr() returns a negative number error code */ atomic_set_bit(adv_param.flags, BT_ADV_PARAMS_SET); - bt_hci_cmd_alloc_fake.return_val = NULL; + bt_hci_cmd_create_fake.return_val = NULL; err = bt_id_set_adv_private_addr(&adv_param); diff --git a/tests/bluetooth/host/id/bt_id_set_adv_random_addr/src/main.c b/tests/bluetooth/host/id/bt_id_set_adv_random_addr/src/main.c index aeef2b1fc23d..8d8b7cf03e3f 100644 --- a/tests/bluetooth/host/id/bt_id_set_adv_random_addr/src/main.c +++ b/tests/bluetooth/host/id/bt_id_set_adv_random_addr/src/main.c @@ -52,7 +52,7 @@ ZTEST(bt_id_set_adv_random_addr, test_no_ext_adv) err = bt_id_set_adv_random_addr(&adv_param, &BT_RPA_LE_ADDR->a); - expect_not_called_bt_hci_cmd_alloc(); + expect_not_called_bt_hci_cmd_create(); expect_not_called_bt_hci_cmd_send_sync(); expect_not_called_net_buf_simple_add(); @@ -82,7 +82,7 @@ ZTEST(bt_id_set_adv_random_addr, test_ext_adv_enabled) err = bt_id_set_adv_random_addr(&adv_param, &BT_RPA_LE_ADDR->a); - expect_not_called_bt_hci_cmd_alloc(); + expect_not_called_bt_hci_cmd_create(); expect_not_called_bt_hci_cmd_send_sync(); expect_not_called_net_buf_simple_add(); @@ -102,7 +102,7 @@ ZTEST(bt_id_set_adv_random_addr, test_ext_adv_enabled) * Constraints: * - 'CONFIG_BT_EXT_ADV' is enabled * - 'BT_ADV_PARAMS_SET' flag in advertising parameters reference is set - * - bt_hci_cmd_alloc() returns a valid buffer pointer + * - bt_hci_cmd_create() returns a valid buffer pointer * - bt_hci_cmd_send_sync() returns 0 (success) * * Expected behaviour: @@ -120,13 +120,13 @@ ZTEST(bt_id_set_adv_random_addr, test_ext_adv_enabled_hci_set_adv_set_random_add atomic_set_bit(adv_param.flags, BT_ADV_PARAMS_SET); net_buf_simple_add_fake.return_val = &cp; - bt_hci_cmd_alloc_fake.return_val = &net_buff; + bt_hci_cmd_create_fake.return_val = &net_buff; bt_hci_cmd_send_sync_fake.return_val = 0; err = bt_id_set_adv_random_addr(&adv_param, &BT_RPA_LE_ADDR->a); expect_single_call_net_buf_simple_add(&net_buff.b, sizeof(cp)); - expect_single_call_bt_hci_cmd_alloc(); + expect_single_call_bt_hci_cmd_create(BT_HCI_OP_LE_SET_ADV_SET_RANDOM_ADDR, sizeof(cp)); expect_single_call_bt_hci_cmd_send_sync(BT_HCI_OP_LE_SET_ADV_SET_RANDOM_ADDR); zassert_ok(err, "Unexpected error code '%d' was returned", err); diff --git a/tests/bluetooth/host/id/bt_id_set_adv_random_addr/src/test_suite_invalid_cases.c b/tests/bluetooth/host/id/bt_id_set_adv_random_addr/src/test_suite_invalid_cases.c index b9df7be3f9b4..a23bf02039a8 100644 --- a/tests/bluetooth/host/id/bt_id_set_adv_random_addr/src/test_suite_invalid_cases.c +++ b/tests/bluetooth/host/id/bt_id_set_adv_random_addr/src/test_suite_invalid_cases.c @@ -73,17 +73,17 @@ ZTEST(bt_id_set_adv_random_addr_invalid_cases, test_null_arguments) /* * Test setting advertising random address while 'CONFIG_BT_EXT_ADV' is enabled * and 'BT_ADV_PARAMS_SET' flag in advertising parameters reference is set. - * bt_hci_cmd_alloc() fails to allocate buffers and returns NULL. + * bt_hci_cmd_create() fails to allocate buffers and returns NULL. * * Constraints: * - 'CONFIG_BT_EXT_ADV' is enabled * - 'BT_ADV_PARAMS_SET' flag in advertising parameters reference is set - * - bt_hci_cmd_alloc() returns null + * - bt_hci_cmd_create() returns null * * Expected behaviour: * - bt_id_set_adv_random_addr() returns a negative error code (failure) */ -ZTEST(bt_id_set_adv_random_addr_invalid_cases, test_bt_hci_cmd_alloc_returns_null) +ZTEST(bt_id_set_adv_random_addr_invalid_cases, test_bt_hci_cmd_create_returns_null) { int err; struct bt_le_ext_adv adv_param = {0}; @@ -92,7 +92,7 @@ ZTEST(bt_id_set_adv_random_addr_invalid_cases, test_bt_hci_cmd_alloc_returns_nul atomic_set_bit(adv_param.flags, BT_ADV_PARAMS_SET); - bt_hci_cmd_alloc_fake.return_val = NULL; + bt_hci_cmd_create_fake.return_val = NULL; err = bt_id_set_adv_random_addr(&adv_param, &BT_RPA_LE_ADDR->a); @@ -107,7 +107,7 @@ ZTEST(bt_id_set_adv_random_addr_invalid_cases, test_bt_hci_cmd_alloc_returns_nul * Constraints: * - 'CONFIG_BT_EXT_ADV' is enabled * - 'BT_ADV_PARAMS_SET' flag in advertising parameters reference is set - * - bt_hci_cmd_alloc() returns a valid buffer pointer + * - bt_hci_cmd_create() returns a valid buffer pointer * - bt_hci_cmd_send_sync() fails and returns a negative error code. * * Expected behaviour: @@ -125,7 +125,7 @@ ZTEST(bt_id_set_adv_random_addr_invalid_cases, test_bt_hci_cmd_send_sync_fails) atomic_set_bit(adv_param.flags, BT_ADV_PARAMS_SET); net_buf_simple_add_fake.return_val = &cp; - bt_hci_cmd_alloc_fake.return_val = &net_buff; + bt_hci_cmd_create_fake.return_val = &net_buff; bt_hci_cmd_send_sync_fake.return_val = -1; err = bt_id_set_adv_random_addr(&adv_param, &BT_RPA_LE_ADDR->a); diff --git a/tests/bluetooth/host/id/bt_id_set_create_conn_own_addr/src/test_suite_invalid_inputs.c b/tests/bluetooth/host/id/bt_id_set_create_conn_own_addr/src/test_suite_invalid_inputs.c index adc035eed4b4..2c9fe4abf120 100644 --- a/tests/bluetooth/host/id/bt_id_set_create_conn_own_addr/src/test_suite_invalid_inputs.c +++ b/tests/bluetooth/host/id/bt_id_set_create_conn_own_addr/src/test_suite_invalid_inputs.c @@ -59,7 +59,7 @@ ZTEST(bt_id_set_create_conn_own_addr_invalid_inputs, test_set_random_address_fai bt_addr_le_copy(&bt_dev.id_addr[BT_ID_DEFAULT], BT_RPA_LE_ADDR); /* This will cause set_random_address() to return (-ENOBUFS) */ - bt_hci_cmd_alloc_fake.return_val = NULL; + bt_hci_cmd_create_fake.return_val = NULL; err = bt_id_set_create_conn_own_addr(false, &own_addr_type); diff --git a/tests/bluetooth/host/id/bt_id_set_private_addr/src/test_suite_invalid_cases.c b/tests/bluetooth/host/id/bt_id_set_private_addr/src/test_suite_invalid_cases.c index fba9f9af9f71..c6968f3cecb4 100644 --- a/tests/bluetooth/host/id/bt_id_set_private_addr/src/test_suite_invalid_cases.c +++ b/tests/bluetooth/host/id/bt_id_set_private_addr/src/test_suite_invalid_cases.c @@ -110,7 +110,7 @@ ZTEST(bt_id_set_private_addr_invalid_cases, test_setting_address_set_random_addr } /* This will make set_random_address() returns a negative number error code */ - bt_hci_cmd_alloc_fake.return_val = NULL; + bt_hci_cmd_create_fake.return_val = NULL; err = bt_id_set_private_addr(BT_ID_DEFAULT); diff --git a/tests/bluetooth/host/id/bt_id_set_scan_own_addr/src/test_suite_invalid_inputs.c b/tests/bluetooth/host/id/bt_id_set_scan_own_addr/src/test_suite_invalid_inputs.c index 0942ae9ca17d..367cf3296a33 100644 --- a/tests/bluetooth/host/id/bt_id_set_scan_own_addr/src/test_suite_invalid_inputs.c +++ b/tests/bluetooth/host/id/bt_id_set_scan_own_addr/src/test_suite_invalid_inputs.c @@ -91,7 +91,7 @@ ZTEST(bt_id_set_scan_own_addr_invalid_inputs, test_set_random_address_fails) bt_addr_le_copy(&bt_dev.id_addr[BT_ID_DEFAULT], BT_RPA_LE_ADDR); /* This will cause set_random_address() to return (-ENOBUFS) */ - bt_hci_cmd_alloc_fake.return_val = NULL; + bt_hci_cmd_create_fake.return_val = NULL; err = bt_id_set_scan_own_addr(false, &own_addr_type); diff --git a/tests/bluetooth/host/id/mocks/hci_core.c b/tests/bluetooth/host/id/mocks/hci_core.c index dedaf5f9dc19..bb274e4f75df 100644 --- a/tests/bluetooth/host/id/mocks/hci_core.c +++ b/tests/bluetooth/host/id/mocks/hci_core.c @@ -16,5 +16,5 @@ struct bt_dev bt_dev = { }; DEFINE_FAKE_VALUE_FUNC(int, bt_unpair, uint8_t, const bt_addr_le_t *); -DEFINE_FAKE_VALUE_FUNC(struct net_buf *, bt_hci_cmd_alloc, k_timeout_t); +DEFINE_FAKE_VALUE_FUNC(struct net_buf *, bt_hci_cmd_create, uint16_t, uint8_t); DEFINE_FAKE_VALUE_FUNC(int, bt_hci_cmd_send_sync, uint16_t, struct net_buf *, struct net_buf **); diff --git a/tests/bluetooth/host/id/mocks/hci_core.h b/tests/bluetooth/host/id/mocks/hci_core.h index 94de9ca882e6..1e30830dcc20 100644 --- a/tests/bluetooth/host/id/mocks/hci_core.h +++ b/tests/bluetooth/host/id/mocks/hci_core.h @@ -11,9 +11,9 @@ /* List of fakes used by this unit tester */ #define HCI_CORE_FFF_FAKES_LIST(FAKE) \ FAKE(bt_unpair) \ - FAKE(bt_hci_cmd_alloc) \ + FAKE(bt_hci_cmd_create) \ FAKE(bt_hci_cmd_send_sync) DECLARE_FAKE_VALUE_FUNC(int, bt_unpair, uint8_t, const bt_addr_le_t *); -DECLARE_FAKE_VALUE_FUNC(struct net_buf *, bt_hci_cmd_alloc, k_timeout_t); +DECLARE_FAKE_VALUE_FUNC(struct net_buf *, bt_hci_cmd_create, uint16_t, uint8_t); DECLARE_FAKE_VALUE_FUNC(int, bt_hci_cmd_send_sync, uint16_t, struct net_buf *, struct net_buf **); diff --git a/tests/bluetooth/host/id/mocks/hci_core_expects.c b/tests/bluetooth/host/id/mocks/hci_core_expects.c index af8a1ea13cd3..8e4deea9c0c1 100644 --- a/tests/bluetooth/host/id/mocks/hci_core_expects.c +++ b/tests/bluetooth/host/id/mocks/hci_core_expects.c @@ -35,19 +35,24 @@ void expect_not_called_bt_unpair(void) zassert_equal(bt_unpair_fake.call_count, 0, "'%s()' was called unexpectedly", func_name); } -void expect_single_call_bt_hci_cmd_alloc(void) +void expect_single_call_bt_hci_cmd_create(uint16_t opcode, uint8_t param_len) { - const char *func_name = "bt_hci_cmd_alloc"; + const char *func_name = "bt_hci_cmd_create"; - zassert_equal(bt_hci_cmd_alloc_fake.call_count, 1, "'%s()' was called more than once", + zassert_equal(bt_hci_cmd_create_fake.call_count, 1, "'%s()' was called more than once", func_name); + + zassert_equal(bt_hci_cmd_create_fake.arg0_val, opcode, + "'%s()' was called with incorrect '%s' value", func_name, "opcode"); + zassert_equal(bt_hci_cmd_create_fake.arg1_val, param_len, + "'%s()' was called with incorrect '%s' value", func_name, "param_len"); } -void expect_not_called_bt_hci_cmd_alloc(void) +void expect_not_called_bt_hci_cmd_create(void) { - const char *func_name = "bt_hci_cmd_alloc"; + const char *func_name = "bt_hci_cmd_create"; - zassert_equal(bt_hci_cmd_alloc_fake.call_count, 0, "'%s()' was called unexpectedly", + zassert_equal(bt_hci_cmd_create_fake.call_count, 0, "'%s()' was called unexpectedly", func_name); } diff --git a/tests/bluetooth/host/id/mocks/hci_core_expects.h b/tests/bluetooth/host/id/mocks/hci_core_expects.h index 018747837c00..f87342f1f795 100644 --- a/tests/bluetooth/host/id/mocks/hci_core_expects.h +++ b/tests/bluetooth/host/id/mocks/hci_core_expects.h @@ -23,20 +23,20 @@ void expect_single_call_bt_unpair(uint8_t id, const bt_addr_le_t *addr); void expect_not_called_bt_unpair(void); /* - * Validate expected behaviour when bt_hci_cmd_alloc() is called + * Validate expected behaviour when bt_hci_cmd_create() is called * * Expected behaviour: - * - bt_hci_cmd_alloc() to be called once with correct parameters + * - bt_hci_cmd_create() to be called once with correct parameters */ -void expect_single_call_bt_hci_cmd_alloc(void); +void expect_single_call_bt_hci_cmd_create(uint16_t opcode, uint8_t param_len); /* - * Validate expected behaviour when bt_hci_cmd_alloc() isn't called + * Validate expected behaviour when bt_hci_cmd_create() isn't called * * Expected behaviour: - * - bt_hci_cmd_alloc() isn't called at all + * - bt_hci_cmd_create() isn't called at all */ -void expect_not_called_bt_hci_cmd_alloc(void); +void expect_not_called_bt_hci_cmd_create(void); /* * Validate expected behaviour when bt_hci_cmd_send_sync() is called diff --git a/tests/bsim/bluetooth/host/central/src/main.c b/tests/bsim/bluetooth/host/central/src/main.c index 03bd40397edc..dd12fd91a5bd 100644 --- a/tests/bsim/bluetooth/host/central/src/main.c +++ b/tests/bsim/bluetooth/host/central/src/main.c @@ -78,7 +78,7 @@ static void test_central_connect_timeout_with_timeout(uint32_t timeout_ms, bool if (stack_load) { /* Claim all the buffers so that the stack cannot handle the timeout */ for (int i = 0; i < BT_BUF_CMD_TX_COUNT; i++) { - bufs[i] = bt_hci_cmd_alloc(K_FOREVER); + bufs[i] = bt_hci_cmd_create(BT_HCI_LE_ADV_ENABLE, 0); TEST_ASSERT(bufs[i] != NULL, "Failed to claim all command buffers"); } /* Hold all the buffers until after we expect the connection to timeout */ From cf65c2c943d7475df3af9db7230e6dd4e7bdfc72 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:03 +0300 Subject: [PATCH 1430/2141] Revert "[nrf fromtree] Bluetooth: samples: Use bt_hci_cmd_alloc()" This reverts commit 11d4a59f344c0b2d6dd026d231dbfd33bdb08b0d. Signed-off-by: Jukka Rissanen --- samples/bluetooth/hci_pwr_ctrl/src/main.c | 8 +++++--- samples/bluetooth/hci_vs_scan_req/src/main.c | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/samples/bluetooth/hci_pwr_ctrl/src/main.c b/samples/bluetooth/hci_pwr_ctrl/src/main.c index ef6ca0bbbb27..137943284892 100644 --- a/samples/bluetooth/hci_pwr_ctrl/src/main.c +++ b/samples/bluetooth/hci_pwr_ctrl/src/main.c @@ -57,7 +57,7 @@ static void read_conn_rssi(uint16_t handle, int8_t *rssi) int err; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_READ_RSSI, sizeof(*cp)); if (!buf) { printk("Unable to allocate command buffer\n"); return; @@ -86,7 +86,8 @@ static void set_tx_power(uint8_t handle_type, uint16_t handle, int8_t tx_pwr_lvl struct net_buf *buf, *rsp = NULL; int err; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_VS_WRITE_TX_POWER_LEVEL, + sizeof(*cp)); if (!buf) { printk("Unable to allocate command buffer\n"); return; @@ -118,7 +119,8 @@ static void get_tx_power(uint8_t handle_type, uint16_t handle, int8_t *tx_pwr_lv int err; *tx_pwr_lvl = 0xFF; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_VS_READ_TX_POWER_LEVEL, + sizeof(*cp)); if (!buf) { printk("Unable to allocate command buffer\n"); return; diff --git a/samples/bluetooth/hci_vs_scan_req/src/main.c b/samples/bluetooth/hci_vs_scan_req/src/main.c index 7682c469edfe..6e1c4cb6b770 100644 --- a/samples/bluetooth/hci_vs_scan_req/src/main.c +++ b/samples/bluetooth/hci_vs_scan_req/src/main.c @@ -65,7 +65,7 @@ static void enable_legacy_adv_scan_request_event(bool enable) struct net_buf *buf; int err; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_VS_SET_SCAN_REQ_REPORTS, sizeof(*cp)); if (!buf) { printk("%s: Unable to allocate HCI command buffer\n", __func__); return; From 70564e71b9a4414f4c40b618bc5fc1c05917b0bd Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:03 +0300 Subject: [PATCH 1431/2141] Revert "[nrf fromtree] Bluetooth: Mesh: shell: Use bt_hci_cmd_alloc()" This reverts commit 74d6f3751bd1a4211bee990b83e249e4018120b6. Signed-off-by: Jukka Rissanen --- subsys/bluetooth/mesh/shell/hci.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/subsys/bluetooth/mesh/shell/hci.c b/subsys/bluetooth/mesh/shell/hci.c index 191a47c24115..6192f3b07b74 100644 --- a/subsys/bluetooth/mesh/shell/hci.c +++ b/subsys/bluetooth/mesh/shell/hci.c @@ -30,7 +30,9 @@ int cmd_mesh_adv(const struct shell *sh, size_t argc, char *argv[]) if (!strcmp(argv[1], "on")) { struct bt_hci_cp_mesh_advertise *cp; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_VS_MESH, + sizeof(struct bt_hci_cp_mesh) + + sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -56,7 +58,9 @@ int cmd_mesh_adv(const struct shell *sh, size_t argc, char *argv[]) } else if (!strcmp(argv[1], "off")) { struct bt_hci_cp_mesh_advertise_cancel *cp; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_VS_MESH, + sizeof(struct bt_hci_cp_mesh) + + sizeof(*cp)); if (!buf) { return -ENOBUFS; } From e574cf9b786f7f677ae7cba55058fe9f3c98ae9b Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:03 +0300 Subject: [PATCH 1432/2141] Revert "[nrf fromtree] Bluetooth: Host: shell: Use bt_hci_cmd_alloc()" This reverts commit 897c84fbb48364300b9815282c150691b23a4f80. Signed-off-by: Jukka Rissanen --- subsys/bluetooth/host/shell/bt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/bluetooth/host/shell/bt.c b/subsys/bluetooth/host/shell/bt.c index 1550644018ef..206cae5c0c6e 100644 --- a/subsys/bluetooth/host/shell/bt.c +++ b/subsys/bluetooth/host/shell/bt.c @@ -1432,7 +1432,7 @@ static int cmd_hci_cmd(const struct shell *sh, size_t argc, char *argv[]) return -ENOEXEC; } - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_OP(ogf, ocf), len); if (buf == NULL) { shell_error(sh, "Unable to allocate HCI buffer"); return -ENOMEM; From 364e7947b36ee0f00867d142eacf31900bf81214 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:03 +0300 Subject: [PATCH 1433/2141] Revert "[nrf fromtree] Bluetooth: Host: scan: Use bt_hci_cmd_alloc()" This reverts commit d635e8cb47e837af0bc2eefd9da5eb0902b601f0. Signed-off-by: Jukka Rissanen --- subsys/bluetooth/host/scan.c | 42 +++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/subsys/bluetooth/host/scan.c b/subsys/bluetooth/host/scan.c index b154729438a0..7094ebd664de 100644 --- a/subsys/bluetooth/host/scan.c +++ b/subsys/bluetooth/host/scan.c @@ -133,7 +133,7 @@ static int cmd_le_set_ext_scan_enable(bool enable, bool filter_duplicates, uint1 struct net_buf *buf; int err; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_EXT_SCAN_ENABLE, sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -163,7 +163,7 @@ static int cmd_le_set_scan_enable_legacy(bool enable, bool filter_duplicates) struct net_buf *buf; int err; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_SCAN_ENABLE, sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -252,7 +252,10 @@ static int start_le_scan_ext(struct bt_le_scan_param *scan_param) return err; } - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_EXT_SCAN_PARAM, + sizeof(*set_param) + + (phy_1m ? sizeof(*phy_1m) : 0) + + (phy_coded ? sizeof(*phy_coded) : 0)); if (!buf) { return -ENOBUFS; } @@ -319,7 +322,7 @@ static int start_le_scan_legacy(struct bt_le_scan_param *param) return err; } - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_SCAN_PARAM, sizeof(set_param)); if (!buf) { return -ENOBUFS; } @@ -1163,7 +1166,8 @@ static int per_adv_sync_terminate(uint16_t handle) struct bt_hci_cp_le_per_adv_terminate_sync *cp; struct net_buf *buf; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_PER_ADV_TERMINATE_SYNC, + sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -1355,7 +1359,9 @@ int bt_le_per_adv_sync_subevent(struct bt_le_per_adv_sync *per_adv_sync, return -EINVAL; } - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_PER_ADV_SYNC_SUBEVENT, + sizeof(*cp) + params->num_subevents); + if (!buf) { return -ENOBUFS; } @@ -1393,7 +1399,9 @@ int bt_le_per_adv_set_response_data(struct bt_le_per_adv_sync *per_adv_sync, return -EINVAL; } - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_PER_ADV_RESPONSE_DATA, + sizeof(*cp) + data->len); + if (!buf) { return -ENOBUFS; } @@ -1919,7 +1927,7 @@ int bt_le_per_adv_sync_create(const struct bt_le_per_adv_sync_param *param, return -ENOMEM; } - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_PER_ADV_CREATE_SYNC, sizeof(*cp)); if (!buf) { per_adv_sync_delete(per_adv_sync); return -ENOBUFS; @@ -2026,7 +2034,7 @@ static int bt_le_per_adv_sync_create_cancel( return err; } - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_PER_ADV_CREATE_SYNC_CANCEL, 0); if (!buf) { return -ENOBUFS; } @@ -2122,7 +2130,8 @@ static int bt_le_set_per_adv_recv_enable( return -EALREADY; } - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_PER_ADV_RECV_ENABLE, + sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -2180,7 +2189,8 @@ int bt_le_per_adv_sync_transfer(const struct bt_le_per_adv_sync *per_adv_sync, return -ENOTSUP; } - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_PER_ADV_SYNC_TRANSFER, + sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -2220,7 +2230,7 @@ static int past_param_set(const struct bt_conn *conn, uint8_t mode, struct bt_hci_cp_le_past_param *cp; struct net_buf *buf; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_PAST_PARAM, sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -2243,7 +2253,7 @@ static int default_past_param_set(uint8_t mode, uint16_t skip, uint16_t timeout, struct bt_hci_cp_le_default_past_param *cp; struct net_buf *buf; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_DEFAULT_PAST_PARAM, sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -2371,7 +2381,8 @@ int bt_le_per_adv_list_add(const bt_addr_le_t *addr, uint8_t sid) return -EAGAIN; } - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_ADD_DEV_TO_PER_ADV_LIST, + sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -2401,7 +2412,8 @@ int bt_le_per_adv_list_remove(const bt_addr_le_t *addr, uint8_t sid) return -EAGAIN; } - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_REM_DEV_FROM_PER_ADV_LIST, + sizeof(*cp)); if (!buf) { return -ENOBUFS; } From 16c2ba822ee694abc2d0b6af2390cd2c63fb3a7c Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:03 +0300 Subject: [PATCH 1434/2141] Revert "[nrf fromtree] Bluetooth: Host: iso: Use bt_hci_cmd_alloc()" This reverts commit 54cabb79364154bcff27f93c7bef20e6dc8a4e0c. Signed-off-by: Jukka Rissanen --- subsys/bluetooth/host/iso.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/subsys/bluetooth/host/iso.c b/subsys/bluetooth/host/iso.c index eb6eaa783504..ffdf3ec07364 100644 --- a/subsys/bluetooth/host/iso.c +++ b/subsys/bluetooth/host/iso.c @@ -196,7 +196,7 @@ static int hci_le_setup_iso_data_path(const struct bt_conn *iso, uint8_t dir, uint8_t *cc; int err; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SETUP_ISO_PATH, sizeof(*cp) + path->cc_len); if (!buf) { return -ENOBUFS; } @@ -345,7 +345,7 @@ static int hci_le_remove_iso_data_path(struct bt_conn *iso, uint8_t dir) struct net_buf *buf, *rsp; int err; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_REMOVE_ISO_PATH, sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -1061,7 +1061,7 @@ int bt_iso_chan_get_tx_sync(const struct bt_iso_chan *chan, struct bt_iso_tx_inf return -ENOTCONN; } - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_READ_ISO_TX_SYNC, sizeof(*cp)); if (!buf) { return -ENOMEM; } @@ -1491,7 +1491,7 @@ static int hci_le_reject_cis(uint16_t handle, uint8_t reason) struct net_buf *buf; int err; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_REJECT_CIS, sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -1514,7 +1514,7 @@ static int hci_le_accept_cis(uint16_t handle) struct net_buf *buf; int err; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_ACCEPT_CIS, sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -1683,7 +1683,7 @@ static int hci_le_remove_cig(uint8_t cig_id) struct bt_hci_cp_le_remove_cig *req; struct net_buf *buf; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_REMOVE_CIG, sizeof(*req)); if (!buf) { return -ENOBUFS; } @@ -1706,7 +1706,8 @@ static struct net_buf *hci_le_set_cig_params(const struct bt_iso_cig *cig, struct net_buf *rsp; int i, err; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_CIG_PARAMS, + sizeof(*req) + sizeof(*cis_param) * param->num_cis); if (!buf) { return NULL; } @@ -1794,7 +1795,8 @@ static struct net_buf *hci_le_set_cig_test_params(const struct bt_iso_cig *cig, struct net_buf *rsp; int err; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_CIG_PARAMS_TEST, + sizeof(*req) + sizeof(*cis_param) * param->num_cis); if (!buf) { return NULL; } @@ -2442,7 +2444,7 @@ static int hci_le_create_cis(const struct bt_iso_connect_param *param, size_t co struct bt_hci_cp_le_create_cis *req; struct net_buf *buf; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_CREATE_CIS, sizeof(*req) + sizeof(*cis) * count); if (!buf) { return -ENOBUFS; } @@ -2782,7 +2784,7 @@ static int hci_le_create_big(struct bt_le_ext_adv *padv, struct bt_iso_big *big, int err; struct bt_iso_chan *bis; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_CREATE_BIG, sizeof(*req)); if (!buf) { return -ENOBUFS; @@ -2842,7 +2844,7 @@ static int hci_le_create_big_test(const struct bt_le_ext_adv *padv, struct bt_is struct net_buf *buf; int err; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_CREATE_BIG_TEST, sizeof(*req)); if (!buf) { return -ENOBUFS; @@ -3196,7 +3198,7 @@ static int hci_le_terminate_big(struct bt_iso_big *big) struct bt_hci_cp_le_terminate_big *req; struct net_buf *buf; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_TERMINATE_BIG, sizeof(*req)); if (!buf) { return -ENOBUFS; } @@ -3216,7 +3218,7 @@ static int hci_le_big_sync_term(struct bt_iso_big *big) struct net_buf *rsp; int err; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_BIG_TERMINATE_SYNC, sizeof(*req)); if (!buf) { return -ENOBUFS; } @@ -3389,7 +3391,7 @@ static int hci_le_big_create_sync(const struct bt_le_per_adv_sync *sync, struct int err; uint8_t bit_idx = 0; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_BIG_CREATE_SYNC, sizeof(*req) + big->num_bis); if (!buf) { return -ENOBUFS; } From a135baa404ff44de2e1aa637c21a1472f1748253 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:03 +0300 Subject: [PATCH 1435/2141] Revert "[nrf fromtree] Bluetooth: Host: id: Use bt_hci_cmd_alloc()" This reverts commit b4964932862ac9744cce05e6ed3b11642d177db4. Signed-off-by: Jukka Rissanen --- subsys/bluetooth/host/id.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/subsys/bluetooth/host/id.c b/subsys/bluetooth/host/id.c index af5176574eb0..926175f8b33b 100644 --- a/subsys/bluetooth/host/id.c +++ b/subsys/bluetooth/host/id.c @@ -142,7 +142,7 @@ static int set_random_address(const bt_addr_t *addr) return 0; } - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_RANDOM_ADDRESS, sizeof(*addr)); if (!buf) { return -ENOBUFS; } @@ -193,7 +193,8 @@ int bt_id_set_adv_random_addr(struct bt_le_ext_adv *adv, return 0; } - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_ADV_SET_RANDOM_ADDR, + sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -313,7 +314,8 @@ static void le_rpa_timeout_update(void) struct net_buf *buf; struct bt_hci_cp_le_set_rpa_timeout *cp; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_RPA_TIMEOUT, + sizeof(*cp)); if (!buf) { LOG_ERR("Failed to create HCI RPA timeout command"); err = -ENOBUFS; @@ -848,7 +850,7 @@ static int le_set_privacy_mode(const bt_addr_le_t *addr, uint8_t mode) bt_addr_le_copy(&cp.id_addr, addr); cp.mode = mode; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_PRIVACY_MODE, sizeof(cp)); if (!buf) { return -ENOBUFS; } @@ -869,7 +871,7 @@ static int addr_res_enable(uint8_t enable) LOG_DBG("%s", enable ? "enabled" : "disabled"); - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_ADDR_RES_ENABLE, 1); if (!buf) { return -ENOBUFS; } @@ -891,7 +893,7 @@ static int hci_id_add(uint8_t id, const bt_addr_le_t *addr, uint8_t peer_irk[16] LOG_DBG("addr %s", bt_addr_le_str(addr)); - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_ADD_DEV_TO_RL, sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -1139,7 +1141,7 @@ static int hci_id_del(const bt_addr_le_t *addr) LOG_DBG("addr %s", bt_addr_le_str(addr)); - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_REM_DEV_FROM_RL, sizeof(*cp)); if (!buf) { return -ENOBUFS; } From 1986a4955ed8e513e7911be5b903eea8925e38a7 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:03 +0300 Subject: [PATCH 1436/2141] Revert "[nrf fromtree] Bluetooth: Host: direction: Use bt_hci_cmd_alloc()" This reverts commit 511df0acc1befe800bf0677b6270e7466b10f803. Signed-off-by: Jukka Rissanen --- subsys/bluetooth/host/direction.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/subsys/bluetooth/host/direction.c b/subsys/bluetooth/host/direction.c index 73a196a8e20b..a59cbdada37a 100644 --- a/subsys/bluetooth/host/direction.c +++ b/subsys/bluetooth/host/direction.c @@ -129,7 +129,8 @@ static int hci_df_set_cl_cte_tx_params(const struct bt_le_ext_adv *adv, return -EINVAL; } - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_CL_CTE_TX_PARAMS, + sizeof(*cp) + params->num_ant_ids); if (!buf) { return -ENOBUFS; } @@ -215,7 +216,7 @@ static int hci_df_set_adv_cte_tx_enable(struct bt_le_ext_adv *adv, struct bt_hci_cmd_state_set state; struct net_buf *buf; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_CL_CTE_TX_ENABLE, sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -295,7 +296,9 @@ prepare_cl_cte_rx_enable_cmd_params(struct net_buf **buf, struct bt_le_per_adv_s /* If CTE Rx is enabled, command parameters total length must include * antenna ids, so command size if extended by num_and_ids. */ - *buf = bt_hci_cmd_alloc(K_FOREVER); + *buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_CL_CTE_SAMPLING_ENABLE, + (sizeof(struct bt_hci_cp_le_set_cl_cte_sampling_enable) + + (enable ? switch_pattern_len : 0))); if (!(*buf)) { return -ENOBUFS; } @@ -525,6 +528,7 @@ static int hci_df_set_conn_cte_tx_param(struct bt_conn *conn, struct bt_hci_rp_le_set_conn_cte_tx_params *rp; struct bt_hci_cmd_state_set state; struct net_buf *buf, *rsp; + uint8_t num_ant_ids; int err; /* If AoD is not enabled, ant_ids are ignored by controller: @@ -534,7 +538,11 @@ static int hci_df_set_conn_cte_tx_param(struct bt_conn *conn, return -EINVAL; } - buf = bt_hci_cmd_alloc(K_FOREVER); + num_ant_ids = ((params->cte_types & (BT_DF_CTE_TYPE_AOD_1US | BT_DF_CTE_TYPE_AOD_2US)) ? + params->num_ant_ids : 0); + + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_CONN_CTE_TX_PARAMS, + sizeof(struct bt_hci_cp_le_set_conn_cte_tx_params) + num_ant_ids); if (!buf) { return -ENOBUFS; } @@ -579,7 +587,9 @@ static int prepare_conn_cte_rx_enable_cmd_params(struct net_buf **buf, struct bt /* If CTE Rx is enabled, command parameters total length must include * antenna ids, so command size if extended by num_and_ids. */ - *buf = bt_hci_cmd_alloc(K_FOREVER); + *buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_CONN_CTE_RX_PARAMS, + (sizeof(struct bt_hci_cp_le_set_conn_cte_rx_params) + + (enable ? switch_pattern_len : 0))); if (!(*buf)) { return -ENOBUFS; } @@ -813,7 +823,8 @@ static int hci_df_set_conn_cte_req_enable(struct bt_conn *conn, bool enable, return -EINVAL; } - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_CONN_CTE_REQ_ENABLE, + sizeof(struct bt_hci_cp_le_conn_cte_req_enable)); if (!buf) { return -ENOBUFS; } @@ -898,7 +909,8 @@ static int hci_df_set_conn_cte_rsp_enable(struct bt_conn *conn, bool enable) struct net_buf *buf, *rsp; int err; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_CONN_CTE_RSP_ENABLE, + sizeof(struct bt_hci_cp_le_conn_cte_rsp_enable)); if (!buf) { return -ENOBUFS; } From e458c1a69b8459c0945c583fdd87ec775e32739f Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:03 +0300 Subject: [PATCH 1437/2141] Revert "[nrf fromtree] Bluetooth: Host: cs: Use bt_hci_cmd_alloc()" This reverts commit ce112c5db40f97a8db4328f12f949a00cd978b9b. Signed-off-by: Jukka Rissanen --- subsys/bluetooth/host/cs.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/subsys/bluetooth/host/cs.c b/subsys/bluetooth/host/cs.c index baad4204bc64..a7bdefa77a12 100644 --- a/subsys/bluetooth/host/cs.c +++ b/subsys/bluetooth/host/cs.c @@ -296,7 +296,7 @@ int bt_le_cs_read_remote_supported_capabilities(struct bt_conn *conn) struct bt_hci_cp_le_read_remote_supported_capabilities *cp; struct net_buf *buf; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_CS_READ_REMOTE_SUPPORTED_CAPABILITIES, sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -439,7 +439,7 @@ int bt_le_cs_set_default_settings(struct bt_conn *conn, struct bt_hci_cp_le_cs_set_default_settings *cp; struct net_buf *buf; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_CS_SET_DEFAULT_SETTINGS, sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -466,7 +466,7 @@ int bt_le_cs_read_remote_fae_table(struct bt_conn *conn) struct bt_hci_cp_le_read_remote_fae_table *cp; struct net_buf *buf; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_CS_READ_REMOTE_FAE_TABLE, sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -884,7 +884,7 @@ int bt_le_cs_create_config(struct bt_conn *conn, struct bt_le_cs_create_config_p struct bt_hci_cp_le_cs_create_config *cp; struct net_buf *buf; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_CS_CREATE_CONFIG, sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -917,7 +917,7 @@ int bt_le_cs_remove_config(struct bt_conn *conn, uint8_t config_id) struct bt_hci_cp_le_cs_remove_config *cp; struct net_buf *buf; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_CS_REMOVE_CONFIG, sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -934,7 +934,7 @@ int bt_le_cs_security_enable(struct bt_conn *conn) struct bt_hci_cp_le_security_enable *cp; struct net_buf *buf; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_CS_SECURITY_ENABLE, sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -951,7 +951,7 @@ int bt_le_cs_procedure_enable(struct bt_conn *conn, struct bt_hci_cp_le_procedure_enable *cp; struct net_buf *buf; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_CS_PROCEDURE_ENABLE, sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -970,7 +970,7 @@ int bt_le_cs_set_procedure_parameters(struct bt_conn *conn, struct bt_hci_cp_le_set_procedure_parameters *cp; struct net_buf *buf; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_CS_SET_PROCEDURE_PARAMETERS, sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -999,7 +999,7 @@ int bt_le_cs_set_channel_classification(uint8_t channel_classification[10]) uint8_t *cp; struct net_buf *buf; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_CS_SET_CHANNEL_CLASSIFICATION, 10); if (!buf) { return -ENOBUFS; } @@ -1111,7 +1111,9 @@ int bt_le_cs_write_cached_remote_supported_capabilities( struct bt_hci_cp_le_write_cached_remote_supported_capabilities *cp; struct net_buf *buf; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_CS_WRITE_CACHED_REMOTE_SUPPORTED_CAPABILITIES, + sizeof(*cp)); + if (!buf) { return -ENOBUFS; } @@ -1208,7 +1210,7 @@ int bt_le_cs_write_cached_remote_fae_table(struct bt_conn *conn, int8_t remote_f struct bt_hci_cp_le_write_cached_remote_fae_table *cp; struct net_buf *buf; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_CS_WRITE_CACHED_REMOTE_FAE_TABLE, sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -1306,7 +1308,7 @@ int bt_le_cs_stop_test(void) { struct net_buf *buf; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_CS_TEST_END, 0); if (!buf) { return -ENOBUFS; } From d5d22e11c57af80cad890b9d2e0b86990acfb04c Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:03 +0300 Subject: [PATCH 1438/2141] Revert "[nrf fromtree] Bluetooth: Host: conn: Use bt_hci_cmd_alloc()" This reverts commit c2cdce7a7c21fe85d8303aa609ee8f4f78c1cdb9. Signed-off-by: Jukka Rissanen --- subsys/bluetooth/host/conn.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/subsys/bluetooth/host/conn.c b/subsys/bluetooth/host/conn.c index 0c34dc0b6160..a7aca69fa9d9 100644 --- a/subsys/bluetooth/host/conn.c +++ b/subsys/bluetooth/host/conn.c @@ -2472,7 +2472,7 @@ int bt_conn_le_start_encryption(struct bt_conn *conn, uint8_t rand[8], return -EINVAL; } - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_START_ENCRYPTION, sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -2511,7 +2511,8 @@ uint8_t bt_conn_enc_key_size(const struct bt_conn *conn) struct net_buf *rsp; uint8_t key_size; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_READ_ENCRYPTION_KEY_SIZE, + sizeof(*cp)); if (!buf) { return 0; } @@ -2977,7 +2978,7 @@ static int bt_conn_get_tx_power_level(struct bt_conn *conn, uint8_t type, struct bt_hci_cp_read_tx_power_level *cp; struct net_buf *buf; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_READ_TX_POWER_LEVEL, sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -3036,7 +3037,7 @@ int bt_conn_le_enhanced_get_tx_power_level(struct bt_conn *conn, return -EINVAL; } - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_ENH_READ_TX_POWER_LEVEL, sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -3074,7 +3075,7 @@ int bt_conn_le_get_remote_tx_power_level(struct bt_conn *conn, return -EINVAL; } - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_READ_REMOTE_TX_POWER_LEVEL, sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -3098,7 +3099,7 @@ int bt_conn_le_set_tx_power_report_enable(struct bt_conn *conn, return -EINVAL; } - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_TX_POWER_REPORT_ENABLE, sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -3174,7 +3175,7 @@ int bt_conn_le_set_path_loss_mon_param(struct bt_conn *conn, return -EINVAL; } - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_PATH_LOSS_REPORTING_PARAMETERS, sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -3200,7 +3201,7 @@ int bt_conn_le_set_path_loss_mon_enable(struct bt_conn *conn, bool reporting_ena return -EINVAL; } - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_PATH_LOSS_REPORTING_ENABLE, sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -3275,7 +3276,7 @@ int bt_conn_le_subrate_set_defaults(const struct bt_conn_le_subrate_param *param return -EINVAL; } - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_DEFAULT_SUBRATE, sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -3305,7 +3306,7 @@ int bt_conn_le_subrate_request(struct bt_conn *conn, return -EINVAL; } - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SUBRATE_REQUEST, sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -3935,7 +3936,8 @@ int bt_conn_le_conn_update(struct bt_conn *conn, struct hci_cp_le_conn_update *conn_update; struct net_buf *buf; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_CONN_UPDATE, + sizeof(*conn_update)); if (!buf) { return -ENOBUFS; } From 95b10fdf394b770fe155487cf57ed87b1f522764 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:04 +0300 Subject: [PATCH 1439/2141] Revert "[nrf fromtree] Bluetooth: Host: Classic: Use bt_hci_cmd_alloc()" This reverts commit 1d58fa2bbf3e31d061035479d72a8138e429f88e. Signed-off-by: Jukka Rissanen --- subsys/bluetooth/host/classic/br.c | 38 +++++++++++++------------ subsys/bluetooth/host/classic/conn_br.c | 4 +-- subsys/bluetooth/host/classic/sco.c | 4 +-- subsys/bluetooth/host/classic/ssp.c | 25 ++++++++-------- 4 files changed, 37 insertions(+), 34 deletions(-) diff --git a/subsys/bluetooth/host/classic/br.c b/subsys/bluetooth/host/classic/br.c index 994fcfbd22c7..abbd345b44b1 100644 --- a/subsys/bluetooth/host/classic/br.c +++ b/subsys/bluetooth/host/classic/br.c @@ -41,7 +41,7 @@ static int reject_conn(const bt_addr_t *bdaddr, uint8_t reason) struct net_buf *buf; int err; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_REJECT_CONN_REQ, sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -64,7 +64,7 @@ static int accept_conn(const bt_addr_t *bdaddr) struct net_buf *buf; int err; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_ACCEPT_CONN_REQ, sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -118,7 +118,7 @@ static bool br_sufficient_key_size(struct bt_conn *conn) uint8_t key_size; int err; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_READ_ENCRYPTION_KEY_SIZE, sizeof(*cp)); if (!buf) { LOG_ERR("Failed to allocate command buffer"); return false; @@ -254,7 +254,7 @@ void bt_hci_conn_complete(struct net_buf *buf) bt_conn_unref(conn); - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_READ_REMOTE_FEATURES, sizeof(*cp)); if (!buf) { return; } @@ -270,7 +270,7 @@ static int request_name(const bt_addr_t *addr, uint8_t pscan, uint16_t offset) struct bt_hci_cp_remote_name_request *cp; struct net_buf *buf; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_REMOTE_NAME_REQUEST, sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -637,7 +637,7 @@ void bt_hci_read_remote_features_complete(struct net_buf *buf) goto done; } - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_READ_REMOTE_EXT_FEATURES, sizeof(*cp)); if (!buf) { goto done; } @@ -711,7 +711,7 @@ static int read_ext_features(void) struct net_buf *buf, *rsp; int err; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_READ_LOCAL_EXT_FEATURES, sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -800,6 +800,7 @@ int bt_br_init(void) struct bt_hci_cp_write_ssp_mode *ssp_cp; struct bt_hci_cp_write_inquiry_mode *inq_cp; struct bt_hci_write_local_name *name_cp; + struct bt_hci_cp_write_class_of_device *cod; int err; /* Read extended local features */ @@ -823,7 +824,7 @@ int bt_br_init(void) net_buf_unref(buf); /* Set SSP mode */ - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_WRITE_SSP_MODE, sizeof(*ssp_cp)); if (!buf) { return -ENOBUFS; } @@ -836,7 +837,7 @@ int bt_br_init(void) } /* Enable Inquiry results with RSSI or extended Inquiry */ - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_WRITE_INQUIRY_MODE, sizeof(*inq_cp)); if (!buf) { return -ENOBUFS; } @@ -849,7 +850,7 @@ int bt_br_init(void) } /* Set local name */ - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_WRITE_LOCAL_NAME, sizeof(*name_cp)); if (!buf) { return -ENOBUFS; } @@ -863,7 +864,7 @@ int bt_br_init(void) } /* Set Class of device */ - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_WRITE_CLASS_OF_DEVICE, sizeof(*cod)); if (!buf) { return -ENOBUFS; } @@ -876,7 +877,7 @@ int bt_br_init(void) } /* Set page timeout*/ - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_WRITE_PAGE_TIMEOUT, sizeof(uint16_t)); if (!buf) { return -ENOBUFS; } @@ -892,7 +893,7 @@ int bt_br_init(void) if (BT_FEAT_SC(bt_dev.features)) { struct bt_hci_cp_write_sc_host_supp *sc_cp; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_WRITE_SC_HOST_SUPP, sizeof(*sc_cp)); if (!buf) { return -ENOBUFS; } @@ -915,7 +916,7 @@ static int br_start_inquiry(const struct bt_br_discovery_param *param) struct bt_hci_op_inquiry *cp; struct net_buf *buf; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_INQUIRY, sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -1004,7 +1005,7 @@ int bt_br_discovery_stop(void) continue; } - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_REMOTE_NAME_CANCEL, sizeof(*cp)); if (!buf) { continue; } @@ -1041,7 +1042,7 @@ static int write_scan_enable(uint8_t scan) LOG_DBG("type %u", scan); - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_WRITE_SCAN_ENABLE, 1); if (!buf) { return -ENOBUFS; } @@ -1089,7 +1090,7 @@ static int bt_br_write_current_iac_lap(bool limited) param_len = sizeof(*iac_lap) + (num_current_iac * sizeof(struct bt_hci_iac_lap)); - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_WRITE_CURRENT_IAC_LAP, param_len); if (!buf) { return -ENOBUFS; } @@ -1141,7 +1142,8 @@ static int bt_br_write_cod(uint32_t cod) struct net_buf *buf; /* Set Class of device */ - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_WRITE_CLASS_OF_DEVICE, + sizeof(struct bt_hci_cp_write_class_of_device)); if (!buf) { return -ENOBUFS; } diff --git a/subsys/bluetooth/host/classic/conn_br.c b/subsys/bluetooth/host/classic/conn_br.c index 582d560c4df3..27f6dbb7d8b8 100644 --- a/subsys/bluetooth/host/classic/conn_br.c +++ b/subsys/bluetooth/host/classic/conn_br.c @@ -73,7 +73,7 @@ struct bt_conn *bt_conn_create_br(const bt_addr_t *peer, return NULL; } - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_CONNECT, sizeof(*cp)); if (!buf) { bt_conn_unref(conn); return NULL; @@ -107,7 +107,7 @@ int bt_hci_connect_br_cancel(struct bt_conn *conn) struct net_buf *buf, *rsp; int err; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_CONNECT_CANCEL, sizeof(*cp)); if (!buf) { return -ENOBUFS; } diff --git a/subsys/bluetooth/host/classic/sco.c b/subsys/bluetooth/host/classic/sco.c index baee819b42be..9157caaf941b 100644 --- a/subsys/bluetooth/host/classic/sco.c +++ b/subsys/bluetooth/host/classic/sco.c @@ -258,7 +258,7 @@ static int accept_sco_conn(const bt_addr_t *bdaddr, struct bt_conn *sco_conn) return err; } - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_ACCEPT_SYNC_CONN_REQ, sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -334,7 +334,7 @@ static int sco_setup_sync_conn(struct bt_conn *sco_conn) struct bt_hci_cp_setup_sync_conn *cp; int err; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_SETUP_SYNC_CONN, sizeof(*cp)); if (!buf) { return -ENOBUFS; } diff --git a/subsys/bluetooth/host/classic/ssp.c b/subsys/bluetooth/host/classic/ssp.c index 722ac09cbb84..1064165a5a18 100644 --- a/subsys/bluetooth/host/classic/ssp.c +++ b/subsys/bluetooth/host/classic/ssp.c @@ -50,7 +50,7 @@ static int pin_code_neg_reply(const bt_addr_t *bdaddr) LOG_DBG(""); - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_PIN_CODE_NEG_REPLY, sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -68,7 +68,7 @@ static int pin_code_reply(struct bt_conn *conn, const char *pin, uint8_t len) LOG_DBG(""); - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_PIN_CODE_REPLY, sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -186,7 +186,7 @@ static int ssp_confirm_reply(struct bt_conn *conn) LOG_DBG(""); - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_USER_CONFIRM_REPLY, sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -204,7 +204,7 @@ static int ssp_confirm_neg_reply(struct bt_conn *conn) LOG_DBG(""); - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_USER_CONFIRM_NEG_REPLY, sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -313,7 +313,7 @@ static int ssp_passkey_reply(struct bt_conn *conn, unsigned int passkey) LOG_DBG(""); - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_USER_PASSKEY_REPLY, sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -332,7 +332,7 @@ static int ssp_passkey_neg_reply(struct bt_conn *conn) LOG_DBG(""); - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_USER_PASSKEY_NEG_REPLY, sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -351,7 +351,7 @@ static int conn_auth(struct bt_conn *conn) LOG_DBG(""); - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_AUTH_REQUESTED, sizeof(*auth)); if (!buf) { return -ENOBUFS; } @@ -539,7 +539,7 @@ void link_key_neg_reply(const bt_addr_t *bdaddr) LOG_DBG(""); - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LINK_KEY_NEG_REPLY, sizeof(*cp)); if (!buf) { LOG_ERR("Out of command buffers"); return; @@ -557,7 +557,7 @@ void link_key_reply(const bt_addr_t *bdaddr, const uint8_t *lk) LOG_DBG(""); - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LINK_KEY_REPLY, sizeof(*cp)); if (!buf) { LOG_ERR("Out of command buffers"); return; @@ -613,7 +613,8 @@ void io_capa_neg_reply(const bt_addr_t *bdaddr, const uint8_t reason) struct bt_hci_cp_io_capability_neg_reply *cp; struct net_buf *resp_buf; - resp_buf = bt_hci_cmd_alloc(K_FOREVER); + resp_buf = bt_hci_cmd_create(BT_HCI_OP_IO_CAPABILITY_NEG_REPLY, + sizeof(*cp)); if (!resp_buf) { LOG_ERR("Out of command buffers"); return; @@ -768,7 +769,7 @@ void bt_hci_io_capa_req(struct net_buf *buf) conn->br.local_auth = auth; - resp_buf = bt_hci_cmd_alloc(K_FOREVER); + resp_buf = bt_hci_cmd_create(BT_HCI_OP_IO_CAPABILITY_REPLY, sizeof(*cp)); if (!resp_buf) { LOG_ERR("Out of command buffers"); bt_conn_unref(conn); @@ -864,7 +865,7 @@ static void link_encr(const uint16_t handle) LOG_DBG(""); - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_SET_CONN_ENCRYPT, sizeof(*encr)); if (!buf) { LOG_ERR("Out of command buffers"); return; From 276b31d8018b43b0182d70909ceb020737677182 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:04 +0300 Subject: [PATCH 1440/2141] Revert "[nrf fromtree] Bluetooth: Host: adv: Use bt_hci_cmd_alloc()" This reverts commit a813bd28a864a6d3ace2087b2340d3bd36c99f0c. Signed-off-by: Jukka Rissanen --- subsys/bluetooth/host/adv.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/subsys/bluetooth/host/adv.c b/subsys/bluetooth/host/adv.c index 25a538614e3a..0694c2ce54b3 100644 --- a/subsys/bluetooth/host/adv.c +++ b/subsys/bluetooth/host/adv.c @@ -335,7 +335,7 @@ int bt_le_adv_set_enable_legacy(struct bt_le_ext_adv *adv, bool enable) struct bt_hci_cmd_state_set state; int err; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_ADV_ENABLE, 1); if (!buf) { return -ENOBUFS; } @@ -364,7 +364,7 @@ int bt_le_adv_set_enable_ext(struct bt_le_ext_adv *adv, struct bt_hci_cmd_state_set state; int err; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_EXT_ADV_ENABLE, 6); if (!buf) { return -ENOBUFS; } @@ -551,7 +551,7 @@ static int hci_set_ad(uint16_t hci_op, const struct bt_ad *ad, size_t ad_len) struct net_buf *buf; int err; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(hci_op, sizeof(*set_data)); if (!buf) { return -ENOBUFS; } @@ -585,7 +585,7 @@ static int hci_set_adv_ext_complete(struct bt_le_ext_adv *adv, uint16_t hci_op, cmd_size = sizeof(*set_data) + total_data_len; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(hci_op, cmd_size); if (!buf) { return -ENOBUFS; } @@ -625,7 +625,7 @@ static int hci_set_adv_ext_fragmented(struct bt_le_ext_adv *adv, uint16_t hci_op const size_t data_len = MIN(BT_HCI_LE_EXT_ADV_FRAG_MAX_LEN, stream.remaining_size); const size_t cmd_size = sizeof(*set_data) + data_len; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(hci_op, cmd_size); if (!buf) { return -ENOBUFS; } @@ -738,7 +738,7 @@ static int hci_set_per_adv_data(const struct bt_le_ext_adv *adv, const size_t data_len = MIN(BT_HCI_LE_PER_ADV_FRAG_MAX_LEN, stream.remaining_size); const size_t cmd_size = sizeof(*set_data) + data_len; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_PER_ADV_DATA, cmd_size); if (!buf) { return -ENOBUFS; } @@ -1056,7 +1056,7 @@ int bt_le_adv_start_legacy(struct bt_le_ext_adv *adv, set_param.type = BT_HCI_ADV_NONCONN_IND; } - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_ADV_PARAM, sizeof(set_param)); if (!buf) { return -ENOBUFS; } @@ -1168,7 +1168,7 @@ static int le_ext_adv_param_set(struct bt_le_ext_adv *adv, size = sizeof(struct bt_hci_cp_le_set_ext_adv_param); } - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(opcode, size); if (!buf) { return -ENOBUFS; } @@ -1821,7 +1821,7 @@ int bt_le_ext_adv_delete(struct bt_le_ext_adv *adv) return -EINVAL; } - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_REMOVE_ADV_SET, sizeof(*cp)); if (!buf) { LOG_WRN("No HCI buffers"); return -ENOBUFS; @@ -1920,7 +1920,7 @@ int bt_le_per_adv_set_param(struct bt_le_ext_adv *adv, return -ENOTSUP; } - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(opcode, size); if (!buf) { return -ENOBUFS; } @@ -2029,7 +2029,7 @@ int bt_le_per_adv_set_subevent_data(const struct bt_le_ext_adv *adv, uint8_t num return -EINVAL; } - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_PER_ADV_SUBEVENT_DATA, (uint8_t)cmd_length); if (!buf) { return -ENOBUFS; } @@ -2076,7 +2076,7 @@ static int bt_le_per_adv_enable(struct bt_le_ext_adv *adv, bool enable) return -EALREADY; } - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_PER_ADV_ENABLE, sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -2230,7 +2230,8 @@ int bt_le_per_adv_set_info_transfer(const struct bt_le_ext_adv *adv, return -ENOTSUP; } - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_PER_ADV_SET_INFO_TRANSFER, + sizeof(*cp)); if (!buf) { return -ENOBUFS; } From fe1ea51cfbeeb05c191a96438dc70a0e4d128154 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:04 +0300 Subject: [PATCH 1441/2141] Revert "[nrf fromtree] Bluetooth: Host: core: Use bt_hci_cmd_alloc()" This reverts commit 4276146948cd29be8bca54b5489c276ecfad871e. Signed-off-by: Jukka Rissanen --- subsys/bluetooth/host/hci_core.c | 69 +++++++++++++++++++------------- 1 file changed, 41 insertions(+), 28 deletions(-) diff --git a/subsys/bluetooth/host/hci_core.c b/subsys/bluetooth/host/hci_core.c index 3a866c6346d6..6742a2fc7abc 100644 --- a/subsys/bluetooth/host/hci_core.c +++ b/subsys/bluetooth/host/hci_core.c @@ -268,7 +268,8 @@ void bt_send_one_host_num_completed_packets(uint16_t handle) LOG_DBG("Reporting completed packet for handle %u", handle); - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_HOST_NUM_COMPLETED_PACKETS, + sizeof(*cp) + sizeof(*hc)); BT_ASSERT_MSG(buf, "Unable to alloc for Host NCP"); cp = net_buf_add(buf, sizeof(*cp)); @@ -325,7 +326,8 @@ void bt_hci_host_num_completed_packets(struct net_buf *buf) LOG_DBG("Reporting completed packet for handle %u", handle); - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_HOST_NUM_COMPLETED_PACKETS, + sizeof(*cp) + sizeof(*hc)); if (!buf) { LOG_ERR("Unable to allocate new HCI command"); return; @@ -776,7 +778,8 @@ int bt_le_create_conn_ext(const struct bt_conn *conn) ((bt_dev.create_param.options & BT_CONN_LE_OPT_CODED) ? 1 : 0); - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_EXT_CREATE_CONN, sizeof(*cp) + + num_phys * sizeof(*phy)); if (!buf) { return -ENOBUFS; } @@ -846,7 +849,7 @@ int bt_le_create_conn_synced(const struct bt_conn *conn, const struct bt_le_ext_ } /* There shall only be one Initiating_PHYs */ - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_EXT_CREATE_CONN_V2, sizeof(*cp) + sizeof(*phy)); if (!buf) { return -ENOBUFS; } @@ -896,7 +899,7 @@ static int bt_le_create_conn_legacy(const struct bt_conn *conn) return err; } - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_CREATE_CONN, sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -951,7 +954,7 @@ int bt_le_create_conn_cancel(void) struct net_buf *buf; struct bt_hci_cmd_state_set state; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_CREATE_CONN_CANCEL, 0); if (!buf) { return -ENOBUFS; } @@ -968,7 +971,7 @@ int bt_hci_disconnect(uint16_t handle, uint8_t reason) struct net_buf *buf; struct bt_hci_cp_disconnect *disconn; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_DISCONNECT, sizeof(*disconn)); if (!buf) { return -ENOBUFS; } @@ -1106,7 +1109,8 @@ int bt_hci_le_read_remote_features(struct bt_conn *conn) struct bt_hci_cp_le_read_remote_features *cp; struct net_buf *buf; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_READ_REMOTE_FEATURES, + sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -1131,7 +1135,8 @@ int bt_hci_read_remote_version(struct bt_conn *conn) return 0; } - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_READ_REMOTE_VERSION_INFO, + sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -1151,7 +1156,7 @@ int bt_le_set_data_len(struct bt_conn *conn, uint16_t tx_octets, uint16_t tx_tim struct bt_hci_cp_le_set_data_len *cp; struct net_buf *buf; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_DATA_LEN, sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -1172,7 +1177,7 @@ static int hci_le_read_phy(struct bt_conn *conn) struct net_buf *buf, *rsp; int err; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_READ_PHY, sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -1200,7 +1205,7 @@ int bt_le_set_phy(struct bt_conn *conn, uint8_t all_phys, struct bt_hci_cp_le_set_phy *cp; struct net_buf *buf; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_PHY, sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -1903,7 +1908,8 @@ static void le_conn_param_neg_reply(uint16_t handle, uint8_t reason) struct bt_hci_cp_le_conn_param_req_neg_reply *cp; struct net_buf *buf; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_CONN_PARAM_REQ_NEG_REPLY, + sizeof(*cp)); if (!buf) { LOG_ERR("Unable to allocate buffer"); return; @@ -1922,7 +1928,7 @@ static int le_conn_param_req_reply(uint16_t handle, struct bt_hci_cp_le_conn_param_req_reply *cp; struct net_buf *buf; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_CONN_PARAM_REQ_REPLY, sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -2057,7 +2063,8 @@ static int set_flow_control(void) return 0; } - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_HOST_BUFFER_SIZE, + sizeof(*hbs)); if (!buf) { return -ENOBUFS; } @@ -2072,7 +2079,7 @@ static int set_flow_control(void) return err; } - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_SET_CTL_TO_HOST_FLOW, 1); if (!buf) { return -ENOBUFS; } @@ -2396,7 +2403,7 @@ static void le_ltk_neg_reply(uint16_t handle) struct bt_hci_cp_le_ltk_req_neg_reply *cp; struct net_buf *buf; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_LTK_REQ_NEG_REPLY, sizeof(*cp)); if (!buf) { LOG_ERR("Out of command buffers"); @@ -2414,7 +2421,8 @@ static void le_ltk_reply(uint16_t handle, uint8_t *ltk) struct bt_hci_cp_le_ltk_req_reply *cp; struct net_buf *buf; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_LTK_REQ_REPLY, + sizeof(*cp)); if (!buf) { LOG_ERR("Out of command buffers"); return; @@ -3249,7 +3257,7 @@ static int le_set_host_feature(uint8_t bit_number, uint8_t bit_value) struct bt_hci_cp_le_set_host_feature *cp; struct net_buf *buf; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_HOST_FEATURE, sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -3376,7 +3384,7 @@ static int le_set_event_mask(void) uint64_t mask = 0U; /* Set LE event mask */ - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_EVENT_MASK, sizeof(*cp_mask)); if (!buf) { return -ENOBUFS; } @@ -3630,7 +3638,8 @@ static int le_init(void) #endif /* CONFIG_BT_BROADCASTER */ if (BT_FEAT_BREDR(bt_dev.features)) { - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_WRITE_LE_HOST_SUPP, + sizeof(*cp_le)); if (!buf) { return -ENOBUFS; } @@ -3671,7 +3680,8 @@ static int le_init(void) return err; } - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_WRITE_DEFAULT_DATA_LEN, + sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -3692,7 +3702,8 @@ static int le_init(void) #if defined(CONFIG_BT_PRIVACY) struct bt_hci_cp_le_set_rpa_timeout *cp; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_RPA_TIMEOUT, + sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -3787,7 +3798,7 @@ static int set_event_mask(void) struct net_buf *buf; uint64_t mask = 0U; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_SET_EVENT_MASK, sizeof(*ev)); if (!buf) { return -ENOBUFS; } @@ -4641,7 +4652,7 @@ int bt_le_filter_accept_list_add(const bt_addr_le_t *addr) return -EAGAIN; } - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_ADD_DEV_TO_FAL, sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -4669,7 +4680,7 @@ int bt_le_filter_accept_list_remove(const bt_addr_le_t *addr) return -EAGAIN; } - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_REM_DEV_FROM_FAL, sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -4719,7 +4730,8 @@ int bt_le_set_chan_map(uint8_t chan_map[5]) return -ENOTSUP; } - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_HOST_CHAN_CLASSIF, + sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -4760,7 +4772,8 @@ int bt_configure_data_path(uint8_t dir, uint8_t id, uint8_t vs_config_len, struct net_buf *buf; int err; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_CONFIGURE_DATA_PATH, sizeof(*cp) + + vs_config_len); if (!buf) { return -ENOBUFS; } From 9ac7b0c944e6722d6de7674244e8b8d327c41c8c Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:04 +0300 Subject: [PATCH 1442/2141] Revert "[nrf fromtree] Bluetooth: Host: CS: Fix test HCI command encoding" This reverts commit bd698bf422b26ee8db9782a06d68334686e81c8c. Signed-off-by: Jukka Rissanen --- subsys/bluetooth/host/cs.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/subsys/bluetooth/host/cs.c b/subsys/bluetooth/host/cs.c index a7bdefa77a12..ec274f7ab9f9 100644 --- a/subsys/bluetooth/host/cs.c +++ b/subsys/bluetooth/host/cs.c @@ -522,7 +522,7 @@ int bt_le_cs_start_test(const struct bt_le_cs_test_param *params) struct bt_hci_op_le_cs_test *cp; struct net_buf *buf; - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(BT_HCI_OP_LE_CS_TEST, sizeof(*cp)); if (!buf) { return -ENOBUFS; } @@ -617,6 +617,10 @@ int bt_le_cs_start_test(const struct bt_le_cs_test_param *params) cp->override_parameters_length = override_parameters_length; + struct bt_hci_cmd_hdr *hdr = (struct bt_hci_cmd_hdr *)buf->data; + + hdr->param_len += override_parameters_length; + return bt_hci_cmd_send_sync(BT_HCI_OP_LE_CS_TEST, buf, NULL); } #endif /* CONFIG_BT_CHANNEL_SOUNDING_TEST */ From 259156ab0eb2a68dbf086c02b73e9a1c9cd0ce89 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:04 +0300 Subject: [PATCH 1443/2141] Revert "[nrf fromtree] Bluetooth: Host: Introduce bt_hci_cmd_alloc()" This reverts commit a0036ce12512bfb3edb095a41bb39ddebb3c1c92. Signed-off-by: Jukka Rissanen --- include/zephyr/bluetooth/hci.h | 14 -------- subsys/bluetooth/host/hci_core.c | 60 +++++++------------------------- 2 files changed, 13 insertions(+), 61 deletions(-) diff --git a/include/zephyr/bluetooth/hci.h b/include/zephyr/bluetooth/hci.h index dd9c60c8ae80..590ea55a84ac 100644 --- a/include/zephyr/bluetooth/hci.h +++ b/include/zephyr/bluetooth/hci.h @@ -63,20 +63,6 @@ static inline const char *bt_hci_err_to_str(uint8_t hci_err) */ struct net_buf *bt_hci_cmd_create(uint16_t opcode, uint8_t param_len); -/** Allocate an HCI command buffer. - * - * This function allocates a new buffer for an HCI command. Upon successful - * return the buffer is ready to have the command parameters encoded into it. - * Sufficient headroom gets automatically reserved in the buffer, allowing - * the actual command and H:4 headers to be encoded later, as part of - * calling bt_hci_cmd_send() or bt_hci_cmd_send_sync(). - * - * @param timeout Timeout for the allocation. - * - * @return Newly allocated buffer or NULL if allocation failed. - */ -struct net_buf *bt_hci_cmd_alloc(k_timeout_t timeout); - /** Send a HCI command asynchronously. * * This function is used for sending a HCI command asynchronously. It can diff --git a/subsys/bluetooth/host/hci_core.c b/subsys/bluetooth/host/hci_core.c index 6742a2fc7abc..335fdc642a34 100644 --- a/subsys/bluetooth/host/hci_core.c +++ b/subsys/bluetooth/host/hci_core.c @@ -351,27 +351,8 @@ struct net_buf *bt_hci_cmd_create(uint16_t opcode, uint8_t param_len) LOG_DBG("opcode 0x%04x param_len %u", opcode, param_len); - buf = bt_hci_cmd_alloc(K_FOREVER); - if (!buf) { - return NULL; - } - - LOG_DBG("buf %p", buf); - - hdr = net_buf_push(buf, sizeof(*hdr)); - hdr->opcode = sys_cpu_to_le16(opcode); - hdr->param_len = param_len; - - net_buf_push_u8(buf, BT_HCI_H4_CMD); - - return buf; -} - -struct net_buf *bt_hci_cmd_alloc(k_timeout_t timeout) -{ - struct net_buf *buf; - - buf = net_buf_alloc(&hci_cmd_pool, timeout); + /* net_buf_alloc(K_FOREVER) can fail when run from the syswq */ + buf = net_buf_alloc(&hci_cmd_pool, K_FOREVER); if (!buf) { LOG_DBG("Unable to allocate a command buffer"); return NULL; @@ -379,41 +360,29 @@ struct net_buf *bt_hci_cmd_alloc(k_timeout_t timeout) LOG_DBG("buf %p", buf); - /* Reserve H:4 header and HCI command header */ - net_buf_reserve(buf, sizeof(uint8_t) + sizeof(struct bt_hci_cmd_hdr)); + net_buf_add_u8(buf, BT_HCI_H4_CMD); - cmd(buf)->opcode = 0; + cmd(buf)->opcode = opcode; cmd(buf)->sync = NULL; cmd(buf)->state = NULL; + hdr = net_buf_add(buf, sizeof(*hdr)); + hdr->opcode = sys_cpu_to_le16(opcode); + hdr->param_len = param_len; + return buf; } int bt_hci_cmd_send(uint16_t opcode, struct net_buf *buf) { - struct bt_hci_cmd_hdr *hdr; - if (!buf) { - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(opcode, 0); if (!buf) { return -ENOBUFS; } } - LOG_DBG("opcode 0x%04x param_len %u", opcode, buf->len); - - cmd(buf)->opcode = opcode; - - /* TODO: Remove this condition when bt_hci_cmd_create() has been removed (after its - * deprecation period) - */ - if (net_buf_headroom(buf) >= sizeof(uint8_t) + sizeof(*hdr)) { - hdr = net_buf_push(buf, sizeof(*hdr)); - hdr->opcode = sys_cpu_to_le16(opcode); - hdr->param_len = buf->len - sizeof(*hdr); - - net_buf_push_u8(buf, BT_HCI_H4_CMD); - } + LOG_DBG("opcode 0x%04x len %u", opcode, buf->len); /* Host Number of Completed Packets can ignore the ncmd value * and does not generate any cmd complete/status events. @@ -445,7 +414,7 @@ int bt_hci_cmd_send_sync(uint16_t opcode, struct net_buf *buf, int err; if (!buf) { - buf = bt_hci_cmd_alloc(K_FOREVER); + buf = bt_hci_cmd_create(opcode, 0); if (!buf) { return -ENOBUFS; } @@ -466,11 +435,8 @@ int bt_hci_cmd_send_sync(uint16_t opcode, struct net_buf *buf, k_sem_init(&sync_sem, 0, 1); cmd(buf)->sync = &sync_sem; - err = bt_hci_cmd_send(opcode, net_buf_ref(buf)); - if (err) { - net_buf_unref(buf); - return err; - } + k_fifo_put(&bt_dev.cmd_tx_queue, net_buf_ref(buf)); + bt_tx_irq_raise(); /* TODO: disallow sending sync commands from syswq altogether */ From bd5ecb9c2248d5a41dd2d73182e73f2bd1744d34 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:04 +0300 Subject: [PATCH 1444/2141] Revert "[nrf fromlist] soc: Enable radio core if BT is selected" This reverts commit acf6e051ccfb830a8bfc5fff4a5109e730d171e0. Signed-off-by: Jukka Rissanen --- soc/nordic/nrf54h/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soc/nordic/nrf54h/Kconfig b/soc/nordic/nrf54h/Kconfig index ed9fc86f2fc9..c0e619cd1e2d 100644 --- a/soc/nordic/nrf54h/Kconfig +++ b/soc/nordic/nrf54h/Kconfig @@ -69,7 +69,7 @@ config SOC_NRF54H20_CPURAD_COMMON config SOC_NRF54H20_CPURAD_ENABLE bool "Boot the nRF54H20 Radio core" - default y if NRF_802154_SER_HOST || BT_HCI_HOST + default y if NRF_802154_SER_HOST depends on SOC_NRF54H20_CPUAPP select NRF_IRONSIDE_CPUCONF_SERVICE help From c64843ada62cec30094bb05027feef6a26388543 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:04 +0300 Subject: [PATCH 1445/2141] Revert "[nrf fromtree] mgmt: mcumgr: grp: os_mgmt: Add optional boot mode for reset" This reverts commit c8fe297f3863a6b4f865cb45c12ebc3fea3838cf. Signed-off-by: Jukka Rissanen --- .../mcumgr/grp/os_mgmt/os_mgmt_callbacks.h | 5 -- subsys/mgmt/mcumgr/grp/os_mgmt/Kconfig | 8 --- subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c | 54 +------------------ 3 files changed, 2 insertions(+), 65 deletions(-) diff --git a/include/zephyr/mgmt/mcumgr/grp/os_mgmt/os_mgmt_callbacks.h b/include/zephyr/mgmt/mcumgr/grp/os_mgmt/os_mgmt_callbacks.h index 458b70626c35..c9f7259fa40e 100644 --- a/include/zephyr/mgmt/mcumgr/grp/os_mgmt/os_mgmt_callbacks.h +++ b/include/zephyr/mgmt/mcumgr/grp/os_mgmt/os_mgmt_callbacks.h @@ -26,11 +26,6 @@ extern "C" { struct os_mgmt_reset_data { /** Contains the value of the force parameter. */ bool force; - -#if defined(CONFIG_MCUMGR_GRP_OS_RESET_BOOT_MODE) || defined(__DOXYGEN__) - /** Contains the value of the boot_mode parameter. */ - uint8_t boot_mode; -#endif }; /** diff --git a/subsys/mgmt/mcumgr/grp/os_mgmt/Kconfig b/subsys/mgmt/mcumgr/grp/os_mgmt/Kconfig index 36b727c76201..afd2e0d37403 100644 --- a/subsys/mgmt/mcumgr/grp/os_mgmt/Kconfig +++ b/subsys/mgmt/mcumgr/grp/os_mgmt/Kconfig @@ -43,14 +43,6 @@ config MCUMGR_GRP_OS_RESET_HOOK and will allow the application to perform any required operations before accepting or declining the reset request. -config MCUMGR_GRP_OS_RESET_BOOT_MODE - bool "Boot mode" - depends on RETENTION_BOOT_MODE - help - Allows applications to set the boot mode using the retention boot mode module which - allows for booting other images e.g. as part of a bootloader. This is done with an - optional field in the reset command which specifies the value of the boot mode. - endif config MCUMGR_GRP_OS_TASKSTAT diff --git a/subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c b/subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c index 360385a1b95c..54ee7e70ed21 100644 --- a/subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c +++ b/subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c @@ -55,17 +55,12 @@ #endif #endif -#ifdef CONFIG_MCUMGR_GRP_OS_RESET_BOOT_MODE -#include -#include -#endif - LOG_MODULE_REGISTER(mcumgr_os_grp, CONFIG_MCUMGR_GRP_OS_LOG_LEVEL); #if defined(CONFIG_REBOOT) && defined(CONFIG_MULTITHREADING) static void os_mgmt_reset_work_handler(struct k_work *work); -static K_WORK_DELAYABLE_DEFINE(os_mgmt_reset_work, os_mgmt_reset_work_handler); +K_WORK_DELAYABLE_DEFINE(os_mgmt_reset_work, os_mgmt_reset_work_handler); #endif /* This is passed to zcbor_map_start/end_endcode as a number of @@ -378,38 +373,18 @@ static int os_mgmt_reset(struct smp_streamer *ctxt) int32_t err_rc; uint16_t err_group; -#ifdef CONFIG_MCUMGR_GRP_OS_RESET_BOOT_MODE - uint32_t boot_mode = BOOT_MODE_TYPE_NORMAL; -#endif - struct os_mgmt_reset_data reboot_data = { .force = false }; struct zcbor_map_decode_key_val reset_decode[] = { ZCBOR_MAP_DECODE_KEY_DECODER("force", zcbor_bool_decode, &reboot_data.force), -#ifdef CONFIG_MCUMGR_GRP_OS_RESET_BOOT_MODE - ZCBOR_MAP_DECODE_KEY_DECODER("boot_mode", zcbor_uint32_decode, &boot_mode), -#endif }; /* Since this is a core command, if we fail to decode the data, ignore the error and - * continue with the default parameters. + * continue with the default parameter of force being false. */ (void)zcbor_map_decode_bulk(zsd, reset_decode, ARRAY_SIZE(reset_decode), &decoded); - -#ifdef CONFIG_MCUMGR_GRP_OS_RESET_BOOT_MODE - if (zcbor_map_decode_bulk_key_found(reset_decode, ARRAY_SIZE(reset_decode), "boot_mode")) { - if (boot_mode > UCHAR_MAX) { - return MGMT_ERR_EINVAL; - } - - reboot_data.boot_mode = (uint8_t)boot_mode; - } else { - reboot_data.boot_mode = BOOT_MODE_TYPE_NORMAL; - } -#endif - status = mgmt_callback_notify(MGMT_EVT_OP_OS_MGMT_RESET, &reboot_data, sizeof(reboot_data), &err_rc, &err_group); @@ -423,31 +398,6 @@ static int os_mgmt_reset(struct smp_streamer *ctxt) ok = smp_add_cmd_err(zse, err_group, (uint16_t)err_rc); return ok ? MGMT_ERR_EOK : MGMT_ERR_EMSGSIZE; } -#elif defined(CONFIG_MCUMGR_GRP_OS_RESET_BOOT_MODE) - zcbor_state_t *zsd = ctxt->reader->zs; - size_t decoded; - uint32_t boot_mode; - - struct zcbor_map_decode_key_val reset_decode[] = { - ZCBOR_MAP_DECODE_KEY_DECODER("boot_mode", zcbor_uint32_decode, &boot_mode), - }; - - /* Since this is a core command, if we fail to decode the data, ignore the error and - * continue with the default parameters. - */ - (void)zcbor_map_decode_bulk(zsd, reset_decode, ARRAY_SIZE(reset_decode), &decoded); - - if (zcbor_map_decode_bulk_key_found(reset_decode, ARRAY_SIZE(reset_decode), "boot_mode")) { - if (boot_mode > UCHAR_MAX) { - return MGMT_ERR_EINVAL; - } - } -#endif - -#if defined(CONFIG_MCUMGR_GRP_OS_RESET_BOOT_MODE) - if (zcbor_map_decode_bulk_key_found(reset_decode, ARRAY_SIZE(reset_decode), "boot_mode")) { - (void)bootmode_set((uint8_t)boot_mode); - } #endif #ifdef CONFIG_MULTITHREADING From f9ae8cad35f98e1cac867e358ac5f44c216932e1 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:04 +0300 Subject: [PATCH 1446/2141] Revert "[nrf fromlist] tests: drivers: mspi: api: make test generic" This reverts commit f9ace89cf705f1dadf8ddcdb4a9cfc267e3d8078. Signed-off-by: Jukka Rissanen --- tests/drivers/mspi/api/src/main.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/drivers/mspi/api/src/main.c b/tests/drivers/mspi/api/src/main.c index 148439df6d66..883993f9b3e2 100644 --- a/tests/drivers/mspi/api/src/main.c +++ b/tests/drivers/mspi/api/src/main.c @@ -23,8 +23,6 @@ typedef enum mspi_timing_param mspi_timing_param; typedef struct mspi_ambiq_timing_cfg mspi_timing_cfg; typedef enum mspi_ambiq_timing_param mspi_timing_param; #define MSPI_PORT ((DT_REG_ADDR(MSPI_BUS_NODE) - MSPI0_BASE) / (MSPI1_BASE - MSPI0_BASE)) -#else -#define MSPI_PORT 0 #endif static const struct device *mspi_devices[] = { From 9a4a6c4fc285560764eccc5b776b6f7733c27c25 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:04 +0300 Subject: [PATCH 1447/2141] Revert "[nrf fromlist] bluetooth: mesh: remove persisted psa key if mesh does not own it" This reverts commit 76772c89184fdb0b51b49a540fff5dc236754d9b. Signed-off-by: Jukka Rissanen --- subsys/bluetooth/mesh/crypto_psa.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/subsys/bluetooth/mesh/crypto_psa.c b/subsys/bluetooth/mesh/crypto_psa.c index dcefb18565cd..8d95ed912ec1 100644 --- a/subsys/bluetooth/mesh/crypto_psa.c +++ b/subsys/bluetooth/mesh/crypto_psa.c @@ -452,14 +452,9 @@ int bt_mesh_key_import(enum bt_mesh_key_type type, const uint8_t in[16], struct psa_set_key_bits(&key_attributes, 128); status = psa_import_key(&key_attributes, in, 16, &out->key); - if (status == PSA_ERROR_ALREADY_EXISTS) { - LOG_WRN("Key with ID 0x%4x already exists (desync between mesh and PSA ITS)", - key_id); - (void)psa_destroy_key(key_id); - status = psa_import_key(&key_attributes, in, 16, &out->key); - } + err = status == PSA_SUCCESS ? 0 : + status == PSA_ERROR_ALREADY_EXISTS ? -EALREADY : -EIO; - err = status == PSA_SUCCESS ? 0 : -EIO; if (err && key_id != PSA_KEY_ID_NULL) { keyid_free(key_id); } From b5f4d032b695de34190b53acfeb4c8bf45b92fe5 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:04 +0300 Subject: [PATCH 1448/2141] Revert "[nrf fromtree] doc: networking: Modify the wifi documents" This reverts commit 43f25b65d518ff59eaa4e27115db6b395dd93913. Signed-off-by: Jukka Rissanen --- doc/connectivity/networking/api/wifi.rst | 35 +++++++++---------- .../networking/api/wifi_credentials.rst | 3 +- 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/doc/connectivity/networking/api/wifi.rst b/doc/connectivity/networking/api/wifi.rst index ebf58bb6722e..473bcf8afcae 100644 --- a/doc/connectivity/networking/api/wifi.rst +++ b/doc/connectivity/networking/api/wifi.rst @@ -97,25 +97,25 @@ To facilitate installation of the certificates, a helper script is provided, see The script will install the certificates in the ``rsa2k`` directory to the TLS credentials store in the device over UART and using TLS credentials shell commands. -To initiate a Wi-Fi connection using enterprise security, use one of the following commands depending on the EAP method: +To initiate Wi-Fi connection using enterprise security, use one of the following commands depending on the EAP method: -* EAP-TLS +**EAP-TLS** - .. code-block:: console +.. code-block:: console - uart:~$ wifi connect -s -c -k 7 -w 2 -a --key1-pwd --key2-pwd + uart:~$ wifi connect -s -c -k 7 -w 2 -a --key1-pwd --key2-pwd -* EAP-TTLS-MSCHAPV2 +**EAP-TTLS-MSCHAPV2** - .. code-block:: console +.. code-block:: console - uart:~$ wifi connect -s -c -k 14 -K --eap-id1 --eap-pwd1 -a + uart:~$ wifi connect -s -c -k 14 -K --eap-id1 --eap-pwd1 -a -* EAP-PEAP-MSCHAPV2 +**EAP-PEAP-MSCHAPV2** - .. code-block:: console +.. code-block:: console - uart:~$ wifi connect -s -c -k 12 -K --eap-id1 --eap-pwd1 -a + uart:~$ wifi connect -s -c -k 12 -K --eap-id1 --eap-pwd1 -a Server certificate is also provided in the same directory for testing purposes. Any AAA server can be used for testing purposes, for example, ``FreeRADIUS`` or ``hostapd``. @@ -123,17 +123,16 @@ Any AAA server can be used for testing purposes, for example, ``FreeRADIUS`` or Certificate requirements for EAP methods ---------------------------------------- -Different EAP methods have varying client-side certificate requirements, as outlined below: +Different EAP methods require different certificates on the client side: -* EAP-TLS - Requires both a client certificate (and its private key) and a CA certificate on the client. - The client authenticates itself to the server using its certificate. +* **EAP-TLS**: + Requires both a client certificate (and private key) and the CA certificate on the client. The client authenticates itself to the server using its certificate. -* EAP-TTLS-MSCHAPV2 - Requires only the CA certificate on the client. - The client authenticates to the server using a username and password inside the TLS tunnel. - No client certificate is needed. +* **EAP-TTLS-MSCHAPV2**: + Requires only the CA certificate on the client. The client authenticates to the server using a username and password (MSCHAPV2) inside the TLS tunnel. No client certificate is needed. -* EAP-PEAP-MSCHAPV2 - Requires only the CA certificate on the client. - Like TTLS, the client uses a username and password inside the TLS tunnel and does not require a client certificate. +* **EAP-PEAP-MSCHAPV2**: + Requires only the CA certificate on the client. Like TTLS, the client uses a username and password (MSCHAPV2) inside the TLS tunnel and does not need a client certificate. .. note:: diff --git a/doc/connectivity/networking/api/wifi_credentials.rst b/doc/connectivity/networking/api/wifi_credentials.rst index d13a7d6608bf..6713f29729bb 100644 --- a/doc/connectivity/networking/api/wifi_credentials.rst +++ b/doc/connectivity/networking/api/wifi_credentials.rst @@ -53,8 +53,7 @@ You can remove credentials using the :c:func:`wifi_credentials_delete_by_ssid` f Shell commands ************** -``wifi cred`` is an extension to the Wi-Fi command line. -It adds the following subcommands to interact with the Wi-Fi credentials library: +``wifi cred`` is an extension to the Wi-Fi command line. It adds the following subcommands to interact with the Wi-Fi credentials library: .. list-table:: Wi-Fi credentials shell subcommands :header-rows: 1 From 7ad8118927b711c3ace87e74db67e496f890c190 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:04 +0300 Subject: [PATCH 1449/2141] Revert "[nrf fromtree] doc: networking: Add doc for EAP methods" This reverts commit 941422278681e8db7cbccf28e25f047392aebbfe. Signed-off-by: Jukka Rissanen --- doc/connectivity/networking/api/wifi.rst | 32 ++---------------------- 1 file changed, 2 insertions(+), 30 deletions(-) diff --git a/doc/connectivity/networking/api/wifi.rst b/doc/connectivity/networking/api/wifi.rst index 473bcf8afcae..ad7825b5ace4 100644 --- a/doc/connectivity/networking/api/wifi.rst +++ b/doc/connectivity/networking/api/wifi.rst @@ -97,43 +97,15 @@ To facilitate installation of the certificates, a helper script is provided, see The script will install the certificates in the ``rsa2k`` directory to the TLS credentials store in the device over UART and using TLS credentials shell commands. -To initiate Wi-Fi connection using enterprise security, use one of the following commands depending on the EAP method: - -**EAP-TLS** - -.. code-block:: console - - uart:~$ wifi connect -s -c -k 7 -w 2 -a --key1-pwd --key2-pwd - -**EAP-TTLS-MSCHAPV2** - -.. code-block:: console - - uart:~$ wifi connect -s -c -k 14 -K --eap-id1 --eap-pwd1 -a - -**EAP-PEAP-MSCHAPV2** +To initiate Wi-Fi connection, the following command can be used: .. code-block:: console - uart:~$ wifi connect -s -c -k 12 -K --eap-id1 --eap-pwd1 -a + uart:~$ wifi connect -s -c 149 -k 7 -w 2 -a client1 --key1-pwd whatever --key2-pwd whatever Server certificate is also provided in the same directory for testing purposes. Any AAA server can be used for testing purposes, for example, ``FreeRADIUS`` or ``hostapd``. -Certificate requirements for EAP methods ----------------------------------------- - -Different EAP methods require different certificates on the client side: - -* **EAP-TLS**: - Requires both a client certificate (and private key) and the CA certificate on the client. The client authenticates itself to the server using its certificate. - -* **EAP-TTLS-MSCHAPV2**: - Requires only the CA certificate on the client. The client authenticates to the server using a username and password (MSCHAPV2) inside the TLS tunnel. No client certificate is needed. - -* **EAP-PEAP-MSCHAPV2**: - Requires only the CA certificate on the client. Like TTLS, the client uses a username and password (MSCHAPV2) inside the TLS tunnel and does not need a client certificate. - .. note:: The certificates are for testing purposes only and should not be used in production. From 16b9bb2ab24bbf2b6f43598766489c020962e9d7 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:04 +0300 Subject: [PATCH 1450/2141] Revert "[nrf fromtree] doc: networking: Add wifi credentials library document" This reverts commit 117ae970f79bf156af9175ecc6c98f2a495cbfab. Signed-off-by: Jukka Rissanen --- doc/connectivity/networking/api/net_tech.rst | 1 - .../networking/api/wifi_credentials.rst | 100 ------------------ 2 files changed, 101 deletions(-) delete mode 100644 doc/connectivity/networking/api/wifi_credentials.rst diff --git a/doc/connectivity/networking/api/net_tech.rst b/doc/connectivity/networking/api/net_tech.rst index 616a69921767..910ec4e0cce5 100644 --- a/doc/connectivity/networking/api/net_tech.rst +++ b/doc/connectivity/networking/api/net_tech.rst @@ -11,4 +11,3 @@ Networking Technologies thread.rst ppp.rst wifi.rst - wifi_credentials.rst diff --git a/doc/connectivity/networking/api/wifi_credentials.rst b/doc/connectivity/networking/api/wifi_credentials.rst deleted file mode 100644 index 6713f29729bb..000000000000 --- a/doc/connectivity/networking/api/wifi_credentials.rst +++ /dev/null @@ -1,100 +0,0 @@ -.. _lib_wifi_credentials: - -Wi-Fi credentials Library -######################### - -.. contents:: - :local: - :depth: 2 - -The Wi-Fi credentials library provides means to load and store Wi-Fi® network credentials. - -Overview -******** - -This library uses either Zephyr's settings subsystem or Platform Security Architecture (PSA) Internal Trusted Storage (ITS) to store credentials. -It also holds a list of SSIDs in RAM to provide dictionary-like access using SSIDs as keys. - -Configuration -************* - -To use the Wi-Fi credentials library, enable the :kconfig:option:`CONFIG_WIFI_CREDENTIALS` Kconfig option. - -You can pick the backend using the following options: - -* :kconfig:option:`CONFIG_WIFI_CREDENTIALS_BACKEND_PSA` - Default option for non-secure targets, which includes a TF-M partition (non-minimal TF-M profile type). -* :kconfig:option:`CONFIG_WIFI_CREDENTIALS_BACKEND_SETTINGS` - Default option for secure targets. - -To configure the maximum number of networks, use the :kconfig:option:`CONFIG_WIFI_CREDENTIALS_MAX_ENTRIES` Kconfig option. - -The IEEE 802.11 standard does not specify the maximum length of SAE passwords. -To change the default, use the :kconfig:option:`CONFIG_WIFI_CREDENTIALS_SAE_PASSWORD_LENGTH` Kconfig option. - -Adding credentials -****************** - -You can add credentials using the :c:func:`wifi_credentials_set_personal` and :c:func:`wifi_credentials_set_personal_struct` functions. -The former will build the internally used struct from given fields, while the latter takes the struct directly. -If you add credentials with the same SSID twice, the older entry will be overwritten. - -Querying credentials -******************** - -With an SSID, you can query credentials using the :c:func:`wifi_credentials_get_by_ssid_personal` and :c:func:`wifi_credentials_get_by_ssid_personal_struct` functions. - -You can iterate over all stored credentials with the :c:func:`wifi_credentials_for_each_ssid` function. -Deleting or overwriting credentials while iterating is allowed, since these operations do not change internal indices. - -Removing credentials -******************** - -You can remove credentials using the :c:func:`wifi_credentials_delete_by_ssid` function. - -Shell commands -************** - -``wifi cred`` is an extension to the Wi-Fi command line. It adds the following subcommands to interact with the Wi-Fi credentials library: - -.. list-table:: Wi-Fi credentials shell subcommands - :header-rows: 1 - - * - Subcommands - - Description - * - add - - | Add a network to the credentials storage with following parameters: - | <-s --ssid \"\">: SSID. - | [-c --channel]: Channel that needs to be scanned for connection. 0:any channel - | [-b, --band] 0: any band (2:2.4GHz, 5:5GHz, 6:6GHz) - | [-p, --passphrase]: Passphrase (valid only for secure SSIDs) - | [-k, --key-mgmt]: Key management type. - | 0:None, 1:WPA2-PSK, 2:WPA2-PSK-256, 3:SAE-HNP, 4:SAE-H2E, 5:SAE-AUTO, 6:WAPI," - | " 7:EAP-TLS, 8:WEP, 9: WPA-PSK, 10: WPA-Auto-Personal, 11: DPP - | [-w, --ieee-80211w]: MFP (optional: needs security type to be specified) - | : 0:Disable, 1:Optional, 2:Required. - | [-m, --bssid]: MAC address of the AP (BSSID). - | [-t, --timeout]: Duration after which connection attempt needs to fail. - | [-a, --identity]: Identity for enterprise mode. - | [-K, --key-passwd]: Private key passwd for enterprise mode. - | [-h, --help]: Print out the help for the connect command. - * - delete - - Removes network from credentials storage. - * - list - - Lists networks in credential storage. - * - auto_connect - - Automatically connects to any stored network. - -Limitations -*********** - -The library has the following limitations: - -* Although permitted by the IEEE 802.11 standard, this library does not support zero-length SSIDs. -* Wi-Fi Protected Access (WPA) Enterprise credentials are only partially supported. -* The number of networks stored is fixed compile time. - -API documentation -***************** - -The following section provides an overview and reference for the Wi-Fi credentials API available in Zephyr: - -.. doxygengroup:: wifi_credentials From 31d2860f2c6122a8290880e0c35bcfe869440aec Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:04 +0300 Subject: [PATCH 1451/2141] Revert "[nrf fromlist] snippets: nordic-flpr: Fix nRF54LM20A memory layout" This reverts commit 05d5faf2d55560f396567c321f89b46acb026b6f. Signed-off-by: Jukka Rissanen --- .../nordic-flpr/soc/nrf54lm20a_cpuapp.overlay | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/snippets/nordic-flpr/soc/nrf54lm20a_cpuapp.overlay b/snippets/nordic-flpr/soc/nrf54lm20a_cpuapp.overlay index 071241cf03d7..1d36ba5ac488 100644 --- a/snippets/nordic-flpr/soc/nrf54lm20a_cpuapp.overlay +++ b/snippets/nordic-flpr/soc/nrf54lm20a_cpuapp.overlay @@ -9,27 +9,22 @@ #address-cells = <1>; #size-cells = <1>; - cpuflpr_code_partition: image@1e5000 { + cpuflpr_code_partition: image@1ed000 { /* FLPR core code partition */ - reg = <0x1e5000 DT_SIZE_K(96)>; + reg = <0x1ed000 DT_SIZE_K(64)>; }; }; - cpuflpr_sram_code_data: memory@20067c00 { + cpuflpr_sram_code_data: memory@2006fc00 { compatible = "mmio-sram"; - reg = <0x20067c00 DT_SIZE_K(96)>; + reg = <0x2006fc00 DT_SIZE_K(64)>; #address-cells = <1>; #size-cells = <1>; - ranges = <0x0 0x20067c00 DT_SIZE_K(96)>; + ranges = <0x0 0x2006fc00 0x10000>; }; }; }; -&cpuapp_sram { - reg = <0x20000000 DT_SIZE_K(415)>; - ranges = <0x0 0x20000000 DT_SIZE_K(415)>; -}; - &uart30 { status = "reserved"; }; From 72662ff60d8d0172902ae7cdbaadafb63977ae4c Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:04 +0300 Subject: [PATCH 1452/2141] Revert "[nrf fromtree] soc nrf54lm20a: Fix entropy source" This reverts commit 4de017d6d816812dcefb8f540e4cee5c41d739e4. Signed-off-by: Jukka Rissanen --- dts/arm/nordic/nrf54lm20a_enga_cpuapp.dtsi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dts/arm/nordic/nrf54lm20a_enga_cpuapp.dtsi b/dts/arm/nordic/nrf54lm20a_enga_cpuapp.dtsi index dc13fb40d6aa..fa5ee3252bf7 100644 --- a/dts/arm/nordic/nrf54lm20a_enga_cpuapp.dtsi +++ b/dts/arm/nordic/nrf54lm20a_enga_cpuapp.dtsi @@ -17,7 +17,7 @@ nvic: &cpuapp_nvic {}; / { chosen { - zephyr,entropy = &rng; + zephyr,entropy = &prng; }; soc { @@ -31,9 +31,9 @@ nvic: &cpuapp_nvic {}; status = "disabled"; }; - rng: rng { + prng: prng { + compatible = "nordic,entropy-prng"; status = "okay"; - compatible = "nordic,nrf-cracen-ctrdrbg"; }; }; From 1b9a05783dfeaa263e2fc8f24e933a107498f8a0 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:04 +0300 Subject: [PATCH 1453/2141] Revert "[nrf fromtree] tests: samples: Extend support for nRF54LM20A" This reverts commit bc3b447553c016664e41b65972daa4a28344acdf. Signed-off-by: Jukka Rissanen --- .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 25 ------ samples/boards/nordic/system_off/sample.yaml | 4 - .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 21 ----- .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 9 --- samples/drivers/mbox/CMakeLists.txt | 1 - samples/drivers/mbox/Kconfig.sysbuild | 1 - .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 20 ----- samples/drivers/mbox/remote/CMakeLists.txt | 1 - .../nrf54lm20dk_nrf54lm20a_cpuflpr.overlay | 24 ------ samples/drivers/mbox/sample.yaml | 4 - .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 8 -- .../nrf54lm20dk_nrf54lm20a_cpuflpr.overlay | 8 -- .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 9 --- .../nrf/hwinfo/reset_cause/testcase.yaml | 1 - .../boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf | 1 - .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 67 --------------- tests/boards/nrf/i2c/i2c_slave/testcase.yaml | 2 - .../boards/nrf54lm20dk_nrf54lm20_common.dtsi | 60 -------------- .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 6 -- .../nrf54lm20dk_nrf54lm20a_cpuflpr.overlay | 6 -- tests/boards/nrf/qdec/testcase.yaml | 2 - .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 44 ---------- .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 15 ---- .../drivers/adc/adc_error_cases/testcase.yaml | 1 - .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 31 ------- .../boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf | 1 - .../clock_control_api/testcase.yaml | 2 - .../nrf_clock_calibration/testcase.yaml | 1 - .../nrf_lf_clock_start/testcase.yaml | 8 -- .../drivers/clock_control/onoff/testcase.yaml | 1 - .../boards/nrf54lm20dk_nrf54lm20_common.dtsi | 36 --------- .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 3 - .../nrf54lm20dk_nrf54lm20a_cpuflpr.overlay | 3 - .../boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf | 4 - tests/drivers/flash/common/testcase.yaml | 1 - .../flash/negative_tests/testcase.yaml | 1 - .../nrf54lm20dk_nrf54lm20_common.overlay | 21 ----- .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 7 -- .../nrf54lm20dk_nrf54lm20a_cpuflpr.overlay | 7 -- .../boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf | 1 - .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 68 ---------------- .../drivers/i2c/i2c_target_api/testcase.yaml | 1 - .../nrf54lm20pdk_nrf54lm20a_cpuapp.overlay | 30 ------- .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 30 ------- .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 30 ------- .../boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf | 1 - .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 25 ------ tests/drivers/retained_mem/api/testcase.yaml | 1 - .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 9 --- .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 81 ------------------- .../spi_controller_peripheral/testcase.yaml | 3 - .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 81 ------------------- .../drivers/spi/spi_error_cases/testcase.yaml | 1 - .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 51 ------------ tests/drivers/spi/spi_loopback/testcase.yaml | 4 - .../timer/nrf_grtc_timer/testcase.yaml | 3 - .../boards/nrf54lm20dk_nrf54lm20_common.dtsi | 28 ------- .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 1 - .../nrf54lm20dk_nrf54lm20a_cpuflpr.overlay | 1 - .../boards/nrf54lm20dk_nrf54lm20_common.dtsi | 29 ------- .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 1 - .../nrf54lm20dk_nrf54lm20a_cpuflpr.overlay | 1 - .../nrf54lm20dk_nrf54lm20a_dual_uart.overlay | 49 ----------- .../uart/uart_elementary/testcase.yaml | 6 -- .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 54 ------------- tests/drivers/uart/uart_errors/testcase.yaml | 2 - .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 43 ---------- .../uart/uart_mix_fifo_poll/testcase.yaml | 1 - .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 36 --------- tests/drivers/uart/uart_pm/testcase.yaml | 5 -- .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 9 --- .../nrf54lm20dk_nrf54lm20a_cpuflpr.overlay | 9 --- .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 9 --- .../watchdog/wdt_error_cases/testcase.yaml | 1 - .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 9 --- .../watchdog/wdt_variables/testcase.yaml | 1 - .../boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf | 1 - tests/subsys/fs/fcb/testcase.yaml | 1 - 78 files changed, 1184 deletions(-) delete mode 100644 samples/boards/nordic/system_off/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay delete mode 100644 samples/drivers/audio/dmic/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay delete mode 100644 samples/drivers/counter/alarm/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay delete mode 100644 samples/drivers/mbox/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay delete mode 100644 samples/drivers/mbox/remote/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay delete mode 100644 samples/drivers/watchdog/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay delete mode 100644 samples/drivers/watchdog/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay delete mode 100644 tests/boards/nrf/hwinfo/reset_cause/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay delete mode 100644 tests/boards/nrf/i2c/i2c_slave/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf delete mode 100644 tests/boards/nrf/i2c/i2c_slave/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay delete mode 100644 tests/boards/nrf/qdec/boards/nrf54lm20dk_nrf54lm20_common.dtsi delete mode 100644 tests/boards/nrf/qdec/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay delete mode 100644 tests/boards/nrf/qdec/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay delete mode 100644 tests/drivers/adc/adc_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay delete mode 100644 tests/drivers/adc/adc_error_cases/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay delete mode 100644 tests/drivers/audio/dmic_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay delete mode 100644 tests/drivers/clock_control/clock_control_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf delete mode 100644 tests/drivers/counter/counter_basic_api/boards/nrf54lm20dk_nrf54lm20_common.dtsi delete mode 100644 tests/drivers/counter/counter_basic_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay delete mode 100644 tests/drivers/counter/counter_basic_api/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay delete mode 100644 tests/drivers/flash/common/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf delete mode 100644 tests/drivers/gpio/gpio_basic_api/boards/nrf54lm20dk_nrf54lm20_common.overlay delete mode 100644 tests/drivers/gpio/gpio_basic_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay delete mode 100644 tests/drivers/gpio/gpio_basic_api/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay delete mode 100644 tests/drivers/i2c/i2c_target_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf delete mode 100644 tests/drivers/i2c/i2c_target_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay delete mode 100644 tests/drivers/i2s/i2s_additional/boards/nrf54lm20pdk_nrf54lm20a_cpuapp.overlay delete mode 100644 tests/drivers/i2s/i2s_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay delete mode 100644 tests/drivers/i2s/i2s_speed/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay delete mode 100644 tests/drivers/retained_mem/api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf delete mode 100644 tests/drivers/retained_mem/api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay delete mode 100644 tests/drivers/sensor/temp_sensor/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay delete mode 100644 tests/drivers/spi/spi_controller_peripheral/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay delete mode 100644 tests/drivers/spi/spi_error_cases/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay delete mode 100644 tests/drivers/spi/spi_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay delete mode 100644 tests/drivers/uart/uart_async_api/boards/nrf54lm20dk_nrf54lm20_common.dtsi delete mode 100644 tests/drivers/uart/uart_async_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay delete mode 100644 tests/drivers/uart/uart_async_api/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay delete mode 100644 tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20_common.dtsi delete mode 100644 tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay delete mode 100644 tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay delete mode 100644 tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20a_dual_uart.overlay delete mode 100644 tests/drivers/uart/uart_errors/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay delete mode 100644 tests/drivers/uart/uart_mix_fifo_poll/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay delete mode 100644 tests/drivers/uart/uart_pm/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay delete mode 100644 tests/drivers/watchdog/wdt_basic_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay delete mode 100644 tests/drivers/watchdog/wdt_basic_api/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay delete mode 100644 tests/drivers/watchdog/wdt_error_cases/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay delete mode 100644 tests/drivers/watchdog/wdt_variables/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay delete mode 100644 tests/kernel/timer/timer_behavior/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf diff --git a/samples/boards/nordic/system_off/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/samples/boards/nordic/system_off/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay deleted file mode 100644 index 3a79636a4833..000000000000 --- a/samples/boards/nordic/system_off/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ /dev/null @@ -1,25 +0,0 @@ -/ { - cpuapp_sram@2007ec00 { - compatible = "zephyr,memory-region", "mmio-sram"; - reg = <0x2007ec00 DT_SIZE_K(4)>; - zephyr,memory-region = "RetainedMem"; - status = "okay"; - - retainedmem0: retainedmem { - compatible = "zephyr,retained-ram"; - status = "okay"; - }; - }; - - aliases { - retainedmemdevice = &retainedmem0; - }; -}; - -&cpuapp_sram { - /* Shrink SRAM size to avoid overlap with retained memory region: - * 511 - 4 = 507KB = 0x7ec00 - */ - reg = <0x20000000 DT_SIZE_K(507)>; - ranges = <0x0 0x20000000 0x7ec00>; -}; diff --git a/samples/boards/nordic/system_off/sample.yaml b/samples/boards/nordic/system_off/sample.yaml index 9b0e39a6cea1..6e17223e12b4 100644 --- a/samples/boards/nordic/system_off/sample.yaml +++ b/samples/boards/nordic/system_off/sample.yaml @@ -15,7 +15,6 @@ tests: - nrf54l15dk/nrf54l10/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp harness: console harness_config: type: multi_line @@ -35,7 +34,6 @@ tests: - nrf54l15dk/nrf54l10/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp extra_configs: - CONFIG_APP_USE_RETAINED_MEM=y harness: console @@ -55,7 +53,6 @@ tests: - nrf54l15dk/nrf54l10/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp extra_configs: - CONFIG_GRTC_WAKEUP_ENABLE=y - CONFIG_GPIO_WAKEUP_ENABLE=n @@ -80,7 +77,6 @@ tests: - nrf54l15dk/nrf54l10/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp extra_configs: - CONFIG_APP_USE_RETAINED_MEM=y - CONFIG_GRTC_WAKEUP_ENABLE=y diff --git a/samples/drivers/audio/dmic/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/samples/drivers/audio/dmic/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay deleted file mode 100644 index c850cede53d0..000000000000 --- a/samples/drivers/audio/dmic/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&pinctrl { - pdm20_default_alt: pdm20_default_alt { - group1 { - psels = , - ; - }; - }; -}; - -dmic_dev: &pdm20 { - status = "okay"; - pinctrl-0 = <&pdm20_default_alt>; - pinctrl-names = "default"; - clock-source = "PCLK32M"; -}; diff --git a/samples/drivers/counter/alarm/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/samples/drivers/counter/alarm/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay deleted file mode 100644 index 0847233437ba..000000000000 --- a/samples/drivers/counter/alarm/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ /dev/null @@ -1,9 +0,0 @@ -/ { - chosen { - counter = &timer24; - }; -}; - -&timer24 { - status = "okay"; -}; diff --git a/samples/drivers/mbox/CMakeLists.txt b/samples/drivers/mbox/CMakeLists.txt index 696b2317aa7c..3b154d9afcae 100644 --- a/samples/drivers/mbox/CMakeLists.txt +++ b/samples/drivers/mbox/CMakeLists.txt @@ -28,7 +28,6 @@ if(CONFIG_BOARD_NRF5340DK_NRF5340_CPUAPP OR CONFIG_BOARD_NRF54L09PDK_NRF54L09_CPUAPP OR CONFIG_BOARD_NRF54L15DK_NRF54L15_CPUAPP OR CONFIG_BOARD_NRF54L20PDK_NRF54L20_CPUAPP OR - CONFIG_BOARD_NRF54LM20DK_NRF54LM20A_CPUAPP OR CONFIG_BOARD_STM32H747I_DISCO_STM32H747XX_M7 OR CONFIG_BOARD_BL54L15_DVK_NRF54L15_CPUAPP OR CONFIG_BOARD_BL54L15U_DVK_NRF54L15_CPUAPP) diff --git a/samples/drivers/mbox/Kconfig.sysbuild b/samples/drivers/mbox/Kconfig.sysbuild index 97402056c14e..1c0d77b7ded3 100644 --- a/samples/drivers/mbox/Kconfig.sysbuild +++ b/samples/drivers/mbox/Kconfig.sysbuild @@ -22,7 +22,6 @@ config REMOTE_BOARD default "nrf54l09pdk/nrf54l09/cpuflpr" if $(BOARD) = "nrf54l09pdk" default "nrf54l15dk/nrf54l15/cpuflpr" if $(BOARD) = "nrf54l15dk" default "nrf54l20pdk/nrf54l20/cpuflpr" if $(BOARD) = "nrf54l20pdk" - default "nrf54lm20dk/nrf54lm20a/cpuflpr" if $(BOARD) = "nrf54lm20dk" default "ophelia4ev/cpuflpr" if $(BOARD) = "ophelia4ev" default "stm32h747i_disco/stm32h747xx/m4" if $(BOARD) = "stm32h747i_disco" default "esp32_devkitc/esp32/appcpu" if "$(BOARD)${BOARD_QUALIFIERS}" = "esp32_devkitc/esp32/procpu" diff --git a/samples/drivers/mbox/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/samples/drivers/mbox/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay deleted file mode 100644 index fd2f23402f5e..000000000000 --- a/samples/drivers/mbox/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2025 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - mbox-consumer { - compatible = "vnd,mbox-consumer"; - mboxes = <&cpuapp_vevif_rx 20>, <&cpuapp_vevif_tx 21>; - mbox-names = "rx", "tx"; - }; -}; - -&cpuapp_vevif_rx { - status = "okay"; -}; - -&cpuapp_vevif_tx { - status = "okay"; -}; diff --git a/samples/drivers/mbox/remote/CMakeLists.txt b/samples/drivers/mbox/remote/CMakeLists.txt index 48df8f0cb5b2..baa0e22ff359 100644 --- a/samples/drivers/mbox/remote/CMakeLists.txt +++ b/samples/drivers/mbox/remote/CMakeLists.txt @@ -27,7 +27,6 @@ if(CONFIG_BOARD_NRF5340DK_NRF5340_CPUNET OR CONFIG_BOARD_NRF54L09PDK_NRF54L09_CPUFLPR OR CONFIG_BOARD_NRF54L15DK_NRF54L15_CPUFLPR OR CONFIG_BOARD_NRF54L20PDK_NRF54L20_CPUFLPR OR - CONFIG_BOARD_NRF54LM20DK_NRF54LM20A_CPUFLPR OR CONFIG_BOARD_STM32H747I_DISCO_STM32H747XX_M4 OR CONFIG_BOARD_BL54L15_DVK_NRF54L15_CPUFLPR OR CONFIG_BOARD_BL54L15U_DVK_NRF54L15_CPUFLPR) diff --git a/samples/drivers/mbox/remote/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay b/samples/drivers/mbox/remote/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay deleted file mode 100644 index ea88120ad065..000000000000 --- a/samples/drivers/mbox/remote/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2025 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - mbox-consumer { - compatible = "vnd,mbox-consumer"; - mboxes = <&cpuflpr_vevif_rx 21>, <&cpuflpr_vevif_tx 20>; - mbox-names = "rx", "tx"; - }; -}; - -&cpuflpr_vevif_rx { - status = "okay"; -}; - -&cpuflpr_vevif_tx { - status = "okay"; -}; - -&uart30 { - /delete-property/ hw-flow-control; -}; diff --git a/samples/drivers/mbox/sample.yaml b/samples/drivers/mbox/sample.yaml index 1aee77b1c677..f1a1e56e771f 100644 --- a/samples/drivers/mbox/sample.yaml +++ b/samples/drivers/mbox/sample.yaml @@ -13,7 +13,6 @@ tests: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp integration_platforms: - nrf5340bsim/nrf5340/cpuapp harness: console @@ -79,7 +78,6 @@ tests: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp integration_platforms: - nrf54l15dk/nrf54l15/cpuapp extra_args: mbox_SNIPPET=nordic-flpr @@ -97,7 +95,6 @@ tests: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp integration_platforms: - nrf54l15dk/nrf54l15/cpuapp extra_args: @@ -118,7 +115,6 @@ tests: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp integration_platforms: - nrf54l15dk/nrf54l15/cpuapp extra_args: diff --git a/samples/drivers/watchdog/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/samples/drivers/watchdog/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay deleted file mode 100644 index cfb41e09b99e..000000000000 --- a/samples/drivers/watchdog/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright 2025 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -&wdt31 { - status = "okay"; -}; diff --git a/samples/drivers/watchdog/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay b/samples/drivers/watchdog/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay deleted file mode 100644 index cfb41e09b99e..000000000000 --- a/samples/drivers/watchdog/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright 2025 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -&wdt31 { - status = "okay"; -}; diff --git a/tests/boards/nrf/hwinfo/reset_cause/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/boards/nrf/hwinfo/reset_cause/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay deleted file mode 100644 index dc1ea1a9ddc9..000000000000 --- a/tests/boards/nrf/hwinfo/reset_cause/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&wdt31 { - status = "okay"; -}; diff --git a/tests/boards/nrf/hwinfo/reset_cause/testcase.yaml b/tests/boards/nrf/hwinfo/reset_cause/testcase.yaml index 9fd5911c2846..8837f999bdb1 100644 --- a/tests/boards/nrf/hwinfo/reset_cause/testcase.yaml +++ b/tests/boards/nrf/hwinfo/reset_cause/testcase.yaml @@ -39,6 +39,5 @@ tests: - nrf54h20dk/nrf54h20/cpurad - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp integration_platforms: - nrf54h20dk/nrf54h20/cpuapp diff --git a/tests/boards/nrf/i2c/i2c_slave/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf b/tests/boards/nrf/i2c/i2c_slave/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf deleted file mode 100644 index b01af3b36a7b..000000000000 --- a/tests/boards/nrf/i2c/i2c_slave/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_NRFX_TWIS22=y diff --git a/tests/boards/nrf/i2c/i2c_slave/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/boards/nrf/i2c/i2c_slave/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay deleted file mode 100644 index 029c9830186b..000000000000 --- a/tests/boards/nrf/i2c/i2c_slave/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Two loopbacks are required: - * P1.13 - P1.14 - * P1.23 - P1.24 - */ - - -/ { - aliases { - i2c-slave = &i2c22; - }; -}; - -&pinctrl { - i2c21_default_alt: i2c21_default_alt { - group1 { - psels = , - ; - }; - }; - - i2c21_sleep_alt: i2c21_sleep_alt { - group1 { - psels = , - ; - low-power-enable; - }; - }; - - i2c22_default_alt: i2c22_default_alt { - group1 { -/* Temporary workaround as it is currently not possible - * to configure pins for TWIS with pinctrl. - */ - psels = , - ; - bias-pull-up; - }; - }; - - i2c22_sleep_alt: i2c22_sleep_alt { - group1 { - psels = , - ; - low-power-enable; - }; - }; -}; - -dut_twim: &i2c21 { - compatible = "nordic,nrf-twim"; - status = "okay"; - pinctrl-0 = <&i2c21_default_alt>; - pinctrl-1 = <&i2c21_sleep_alt>; - pinctrl-names = "default", "sleep"; - sensor: sensor@54 { - reg = <0x54>; - }; -}; - -&i2c22 { - compatible = "nordic,nrf-twis"; - status = "okay"; - pinctrl-0 = <&i2c22_default_alt>; - pinctrl-1 = <&i2c22_sleep_alt>; - pinctrl-names = "default", "sleep"; -}; diff --git a/tests/boards/nrf/i2c/i2c_slave/testcase.yaml b/tests/boards/nrf/i2c/i2c_slave/testcase.yaml index e125548a49ac..c264c2f30c80 100644 --- a/tests/boards/nrf/i2c/i2c_slave/testcase.yaml +++ b/tests/boards/nrf/i2c/i2c_slave/testcase.yaml @@ -14,7 +14,6 @@ tests: - nrf5340dk/nrf5340/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - nrf54h20dk/nrf54h20/cpuapp - nrf54h20dk/nrf54h20/cpuppr integration_platforms: @@ -29,7 +28,6 @@ tests: - nrf5340dk/nrf5340/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - nrf54h20dk/nrf54h20/cpuapp - nrf54h20dk/nrf54h20/cpuppr integration_platforms: diff --git a/tests/boards/nrf/qdec/boards/nrf54lm20dk_nrf54lm20_common.dtsi b/tests/boards/nrf/qdec/boards/nrf54lm20dk_nrf54lm20_common.dtsi deleted file mode 100644 index 84e7b1dbc30f..000000000000 --- a/tests/boards/nrf/qdec/boards/nrf54lm20dk_nrf54lm20_common.dtsi +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/* - * Two loopbacks are required: - * P1.13 - P1.14 - * P1.23 - P1.24 - */ - -/ { - aliases { - qdec0 = &qdec20; - qenca = &phase_a; - qencb = &phase_b; - }; - - encoder-emulate { - compatible = "gpio-leds"; - phase_a: phase_a { - gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>; - }; - phase_b: phase_b { - gpios = <&gpio1 23 GPIO_ACTIVE_HIGH>; - }; - }; -}; - -&pinctrl { - qdec_pinctrl: qdec_pinctrl { - group1 { - psels = , - ; - }; - }; - - qdec_sleep_pinctrl: qdec_sleep_pinctrl { - group1 { - psels = , - ; - low-power-enable; - }; - }; -}; - -&gpio1 { - status = "okay"; -}; - -&qdec20 { - status = "okay"; - pinctrl-0 = <&qdec_pinctrl>; - pinctrl-1 = <&qdec_sleep_pinctrl>; - pinctrl-names = "default", "sleep"; - steps = <127>; - led-pre = <500>; - zephyr,pm-device-runtime-auto; -}; diff --git a/tests/boards/nrf/qdec/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/boards/nrf/qdec/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay deleted file mode 100644 index 646d6b633111..000000000000 --- a/tests/boards/nrf/qdec/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright 2025 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -#include "nrf54lm20dk_nrf54lm20_common.dtsi" diff --git a/tests/boards/nrf/qdec/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay b/tests/boards/nrf/qdec/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay deleted file mode 100644 index 646d6b633111..000000000000 --- a/tests/boards/nrf/qdec/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright 2025 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -#include "nrf54lm20dk_nrf54lm20_common.dtsi" diff --git a/tests/boards/nrf/qdec/testcase.yaml b/tests/boards/nrf/qdec/testcase.yaml index 312761b44596..1518a86660fc 100644 --- a/tests/boards/nrf/qdec/testcase.yaml +++ b/tests/boards/nrf/qdec/testcase.yaml @@ -6,9 +6,7 @@ common: - nrf54l15dk/nrf54l15/cpuapp - nrf54l15dk/nrf54l15/cpuflpr - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - nrf54l20pdk/nrf54l20/cpuflpr - - nrf54lm20dk/nrf54lm20a/cpuflpr integration_platforms: - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp diff --git a/tests/drivers/adc/adc_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/adc/adc_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay deleted file mode 100644 index f11e7ea0317c..000000000000 --- a/tests/drivers/adc/adc_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ /dev/null @@ -1,44 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * Copyright (c) 2025 Nordic Semiconductor ASA - */ - -/ { - zephyr,user { - io-channels = <&adc 0>, <&adc 1> , <&adc 2>; - }; -}; - -&adc { - #address-cells = <1>; - #size-cells = <0>; - status = "okay"; - - channel@0 { - reg = <0>; - zephyr,gain = "ADC_GAIN_1"; - zephyr,reference = "ADC_REF_INTERNAL"; - zephyr,acquisition-time = ; - zephyr,input-positive = ; /* P1.31 */ - zephyr,resolution = <10>; - }; - - channel@1 { - reg = <1>; - zephyr,gain = "ADC_GAIN_1_4"; - zephyr,reference = "ADC_REF_EXTERNAL0"; - zephyr,acquisition-time = ; - zephyr,input-positive = ; /* P1.30 */ - zephyr,resolution = <12>; - }; - - channel@2 { - reg = <2>; - zephyr,gain = "ADC_GAIN_2_3"; - zephyr,reference = "ADC_REF_INTERNAL"; - zephyr,acquisition-time = ; - zephyr,input-positive = ; /* P1.06 */ - zephyr,resolution = <10>; - }; -}; diff --git a/tests/drivers/adc/adc_error_cases/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/adc/adc_error_cases/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay deleted file mode 100644 index c50279ce8f64..000000000000 --- a/tests/drivers/adc/adc_error_cases/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ /dev/null @@ -1,15 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * Copyright (c) 2025 Nordic Semiconductor ASA - */ - -/ { - aliases { - adc = &adc; - }; -}; - -&adc { - status = "okay"; -}; diff --git a/tests/drivers/adc/adc_error_cases/testcase.yaml b/tests/drivers/adc/adc_error_cases/testcase.yaml index f902aa21af02..e5c0225b28c0 100644 --- a/tests/drivers/adc/adc_error_cases/testcase.yaml +++ b/tests/drivers/adc/adc_error_cases/testcase.yaml @@ -10,6 +10,5 @@ tests: - nrf52840dk/nrf52840 - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - nrf54h20dk/nrf54h20/cpuapp - ophelia4ev/nrf54l15/cpuapp diff --git a/tests/drivers/audio/dmic_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/audio/dmic_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay deleted file mode 100644 index ebe43a7c825e..000000000000 --- a/tests/drivers/audio/dmic_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/* Test requires loopback between P1.23 and P1.24. - * For best performance, PDM_CLK shall be on 'Clock pin'. - */ - -/ { - aliases { - dmic-dev = &pdm20; - }; -}; - -&pinctrl { - pdm20_default_alt: pdm20_default_alt { - group1 { - psels = , - ; - }; - }; -}; - -dmic_dev: &pdm20 { - status = "okay"; - pinctrl-0 = <&pdm20_default_alt>; - pinctrl-names = "default"; - clock-source = "PCLK32M"; -}; diff --git a/tests/drivers/clock_control/clock_control_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf b/tests/drivers/clock_control/clock_control_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf deleted file mode 100644 index 11d42321cbc3..000000000000 --- a/tests/drivers/clock_control/clock_control_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_TEST_NRF_HF_STARTUP_TIME_US=1000 diff --git a/tests/drivers/clock_control/clock_control_api/testcase.yaml b/tests/drivers/clock_control/clock_control_api/testcase.yaml index 98f8920e162a..d624b61fe7c3 100644 --- a/tests/drivers/clock_control/clock_control_api/testcase.yaml +++ b/tests/drivers/clock_control/clock_control_api/testcase.yaml @@ -24,7 +24,6 @@ tests: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: - nrf51dk/nrf51822 @@ -36,7 +35,6 @@ tests: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: - nrf51dk/nrf51822 diff --git a/tests/drivers/clock_control/nrf_clock_calibration/testcase.yaml b/tests/drivers/clock_control/nrf_clock_calibration/testcase.yaml index 3cdc785cbc74..756a92a98e3e 100644 --- a/tests/drivers/clock_control/nrf_clock_calibration/testcase.yaml +++ b/tests/drivers/clock_control/nrf_clock_calibration/testcase.yaml @@ -10,7 +10,6 @@ tests: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: - nrf51dk/nrf51822 diff --git a/tests/drivers/clock_control/nrf_lf_clock_start/testcase.yaml b/tests/drivers/clock_control/nrf_lf_clock_start/testcase.yaml index 94cc046d6963..eeb034a8ec0c 100644 --- a/tests/drivers/clock_control/nrf_lf_clock_start/testcase.yaml +++ b/tests/drivers/clock_control/nrf_lf_clock_start/testcase.yaml @@ -16,7 +16,6 @@ tests: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp extra_configs: - CONFIG_SYSTEM_CLOCK_WAIT_FOR_STABILITY=y @@ -35,7 +34,6 @@ tests: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp extra_configs: - CONFIG_SYSTEM_CLOCK_WAIT_FOR_AVAILABILITY=y @@ -69,7 +67,6 @@ tests: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: - nrf51dk/nrf51822 @@ -87,7 +84,6 @@ tests: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: - nrf51dk/nrf51822 @@ -105,7 +101,6 @@ tests: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: - nrf51dk/nrf51822 @@ -123,7 +118,6 @@ tests: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: - nrf51dk/nrf51822 @@ -141,7 +135,6 @@ tests: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: - nrf51dk/nrf51822 @@ -159,7 +152,6 @@ tests: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: - nrf51dk/nrf51822 diff --git a/tests/drivers/clock_control/onoff/testcase.yaml b/tests/drivers/clock_control/onoff/testcase.yaml index 51c263dad29a..f24dce72a7a2 100644 --- a/tests/drivers/clock_control/onoff/testcase.yaml +++ b/tests/drivers/clock_control/onoff/testcase.yaml @@ -10,7 +10,6 @@ tests: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - nrf9160dk/nrf9160 - ophelia4ev/nrf54l15/cpuapp integration_platforms: diff --git a/tests/drivers/counter/counter_basic_api/boards/nrf54lm20dk_nrf54lm20_common.dtsi b/tests/drivers/counter/counter_basic_api/boards/nrf54lm20dk_nrf54lm20_common.dtsi deleted file mode 100644 index 729416752870..000000000000 --- a/tests/drivers/counter/counter_basic_api/boards/nrf54lm20dk_nrf54lm20_common.dtsi +++ /dev/null @@ -1,36 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - -&timer00 { - prescaler = <6>; - status = "okay"; -}; - -&timer10 { - prescaler = <4>; - status = "okay"; -}; - -&timer20 { - prescaler = <4>; - status = "okay"; -}; - -&timer21 { - prescaler = <4>; - status = "okay"; -}; - -&timer22 { - prescaler = <4>; - status = "okay"; -}; - -&timer23 { - prescaler = <4>; - status = "okay"; -}; - -&timer24 { - prescaler = <4>; - status = "okay"; -}; diff --git a/tests/drivers/counter/counter_basic_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/counter/counter_basic_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay deleted file mode 100644 index 03676317e382..000000000000 --- a/tests/drivers/counter/counter_basic_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ /dev/null @@ -1,3 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - -#include "nrf54lm20dk_nrf54lm20_common.dtsi" diff --git a/tests/drivers/counter/counter_basic_api/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay b/tests/drivers/counter/counter_basic_api/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay deleted file mode 100644 index 03676317e382..000000000000 --- a/tests/drivers/counter/counter_basic_api/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay +++ /dev/null @@ -1,3 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - -#include "nrf54lm20dk_nrf54lm20_common.dtsi" diff --git a/tests/drivers/flash/common/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf b/tests/drivers/flash/common/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf deleted file mode 100644 index 821a5e77e5b5..000000000000 --- a/tests/drivers/flash/common/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf +++ /dev/null @@ -1,4 +0,0 @@ -CONFIG_FCB=y -CONFIG_FLASH_MAP=y -CONFIG_SETTINGS=y -CONFIG_SETTINGS_FCB=y diff --git a/tests/drivers/flash/common/testcase.yaml b/tests/drivers/flash/common/testcase.yaml index a46ecb50e11d..c1adeeeaabad 100644 --- a/tests/drivers/flash/common/testcase.yaml +++ b/tests/drivers/flash/common/testcase.yaml @@ -47,7 +47,6 @@ tests: - nrf54l15dk/nrf54l10/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - nrf54h20dk/nrf54h20/cpuapp - ophelia4ev/nrf54l15/cpuapp drivers.flash.common.tfm_ns: diff --git a/tests/drivers/flash/negative_tests/testcase.yaml b/tests/drivers/flash/negative_tests/testcase.yaml index 3321a0273ba4..5d2441f002ee 100644 --- a/tests/drivers/flash/negative_tests/testcase.yaml +++ b/tests/drivers/flash/negative_tests/testcase.yaml @@ -8,6 +8,5 @@ tests: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - nrf54h20dk/nrf54h20/cpuapp - ophelia4ev/nrf54l15/cpuapp diff --git a/tests/drivers/gpio/gpio_basic_api/boards/nrf54lm20dk_nrf54lm20_common.overlay b/tests/drivers/gpio/gpio_basic_api/boards/nrf54lm20dk_nrf54lm20_common.overlay deleted file mode 100644 index bb1ce76c876c..000000000000 --- a/tests/drivers/gpio/gpio_basic_api/boards/nrf54lm20dk_nrf54lm20_common.overlay +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - resources { - compatible = "test-gpio-basic-api"; - out-gpios = <&gpio1 30 0>; - in-gpios = <&gpio1 31 0>; - }; -}; - -&gpiote20 { - status = "okay"; -}; - -&gpio1 { - status = "okay"; -}; diff --git a/tests/drivers/gpio/gpio_basic_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/gpio/gpio_basic_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay deleted file mode 100644 index 093894d675a9..000000000000 --- a/tests/drivers/gpio/gpio_basic_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ /dev/null @@ -1,7 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include "nrf54lm20dk_nrf54lm20_common.overlay" diff --git a/tests/drivers/gpio/gpio_basic_api/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay b/tests/drivers/gpio/gpio_basic_api/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay deleted file mode 100644 index 093894d675a9..000000000000 --- a/tests/drivers/gpio/gpio_basic_api/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay +++ /dev/null @@ -1,7 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include "nrf54lm20dk_nrf54lm20_common.overlay" diff --git a/tests/drivers/i2c/i2c_target_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf b/tests/drivers/i2c/i2c_target_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf deleted file mode 100644 index 2510d6673c1b..000000000000 --- a/tests/drivers/i2c/i2c_target_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_I2C_NRFX_TWIS_BUF_SIZE=256 diff --git a/tests/drivers/i2c/i2c_target_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/i2c/i2c_target_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay deleted file mode 100644 index 3459599351ba..000000000000 --- a/tests/drivers/i2c/i2c_target_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ /dev/null @@ -1,68 +0,0 @@ -/* - * SDA = P1.13 and P1.14 - * SCL = P1.23 and P1.24 - */ - -&pinctrl { - i2c21_default: i2c21_default { - group1 { - psels = , - ; - bias-pull-up; - }; - }; - - i2c21_sleep: i2c21_sleep { - group1 { - psels = , - ; - low-power-enable; - }; - }; - - i2c22_default: i2c22_default { - group1 { - psels = , - ; - bias-pull-up; - }; - }; - - i2c22_sleep: i2c22_sleep { - group1 { - psels = , - ; - low-power-enable; - }; - }; -}; - -&i2c21 { - pinctrl-0 = <&i2c21_default>; - pinctrl-1 = <&i2c21_sleep>; - pinctrl-names = "default", "sleep"; - zephyr,concat-buf-size = <256>; - status = "okay"; - - eeprom1: eeprom@56 { - compatible = "zephyr,i2c-target-eeprom"; - reg = <0x56>; - address-width = <8>; - size = <256>; - }; -}; - -&i2c22 { - compatible = "nordic,nrf-twis"; - pinctrl-0 = <&i2c22_default>; - pinctrl-1 = <&i2c22_sleep>; - pinctrl-names = "default", "sleep"; - status = "okay"; - - eeprom0: eeprom@54 { - compatible = "zephyr,i2c-target-eeprom"; - reg = <0x54>; - address-width = <8>; - size = <256>; - }; -}; diff --git a/tests/drivers/i2c/i2c_target_api/testcase.yaml b/tests/drivers/i2c/i2c_target_api/testcase.yaml index 7f888f95e123..e36ab87d4ef1 100644 --- a/tests/drivers/i2c/i2c_target_api/testcase.yaml +++ b/tests/drivers/i2c/i2c_target_api/testcase.yaml @@ -65,7 +65,6 @@ tests: - nrf54h20dk/nrf54h20/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: - max32690evkit/max32690/m4 diff --git a/tests/drivers/i2s/i2s_additional/boards/nrf54lm20pdk_nrf54lm20a_cpuapp.overlay b/tests/drivers/i2s/i2s_additional/boards/nrf54lm20pdk_nrf54lm20a_cpuapp.overlay deleted file mode 100644 index e93f6df8fd8c..000000000000 --- a/tests/drivers/i2s/i2s_additional/boards/nrf54lm20pdk_nrf54lm20a_cpuapp.overlay +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/* i2s-node0 is the transmitter/receiver */ - -/ { - aliases { - i2s-node0 = &tdm; - }; -}; - -&pinctrl { - tdm_default_alt: tdm_default_alt { - group1 { - psels = , - , - , - ; - }; - }; -}; - -&tdm { - status = "okay"; - pinctrl-0 = <&tdm_default_alt>; - pinctrl-names = "default"; -}; diff --git a/tests/drivers/i2s/i2s_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/i2s/i2s_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay deleted file mode 100644 index ef680d4b4105..000000000000 --- a/tests/drivers/i2s/i2s_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/* i2s-node0 is the transmitter/receiver */ - -/ { - aliases { - i2s-node0 = &tdm; - }; -}; - -&pinctrl { - tdm_default_alt: tdm_default_alt { - group1 { - psels = , - , - , /* TDM_SDOUT shorted to TDM_SDIN */ - ; - }; - }; -}; - -&tdm { - status = "okay"; - pinctrl-0 = <&tdm_default_alt>; - pinctrl-names = "default"; -}; diff --git a/tests/drivers/i2s/i2s_speed/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/i2s/i2s_speed/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay deleted file mode 100644 index ef680d4b4105..000000000000 --- a/tests/drivers/i2s/i2s_speed/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/* i2s-node0 is the transmitter/receiver */ - -/ { - aliases { - i2s-node0 = &tdm; - }; -}; - -&pinctrl { - tdm_default_alt: tdm_default_alt { - group1 { - psels = , - , - , /* TDM_SDOUT shorted to TDM_SDIN */ - ; - }; - }; -}; - -&tdm { - status = "okay"; - pinctrl-0 = <&tdm_default_alt>; - pinctrl-names = "default"; -}; diff --git a/tests/drivers/retained_mem/api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf b/tests/drivers/retained_mem/api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf deleted file mode 100644 index c15ba3ed96da..000000000000 --- a/tests/drivers/retained_mem/api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_POWEROFF=y diff --git a/tests/drivers/retained_mem/api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/retained_mem/api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay deleted file mode 100644 index dc81069eca5f..000000000000 --- a/tests/drivers/retained_mem/api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ /dev/null @@ -1,25 +0,0 @@ -/ { - cpuapp_sram@2007ec00 { - compatible = "zephyr,memory-region", "mmio-sram"; - reg = <0x2007ec00 DT_SIZE_K(4)>; - zephyr,memory-region = "RetainedMem"; - status = "okay"; - - retainedmem0: retainedmem { - compatible = "zephyr,retained-ram"; - status = "okay"; - }; - }; - - aliases { - retainedmemtestdevice = &retainedmem0; - }; -}; - -&cpuapp_sram { - /* Shrink SRAM size to avoid overlap with retained memory region: - * 511 - 4 = 507KB = 0x7ec00 - */ - reg = <0x20000000 DT_SIZE_K(507)>; - ranges = <0x0 0x20000000 0x7ec00>; -}; diff --git a/tests/drivers/retained_mem/api/testcase.yaml b/tests/drivers/retained_mem/api/testcase.yaml index ddcc005a16ac..7852742241b4 100644 --- a/tests/drivers/retained_mem/api/testcase.yaml +++ b/tests/drivers/retained_mem/api/testcase.yaml @@ -15,7 +15,6 @@ tests: - nrf54l15dk/nrf54l10/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: - qemu_cortex_m3 diff --git a/tests/drivers/sensor/temp_sensor/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/sensor/temp_sensor/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay deleted file mode 100644 index b1f2a2b9ec59..000000000000 --- a/tests/drivers/sensor/temp_sensor/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -temp_sensor: &temp { - status = "okay"; -}; diff --git a/tests/drivers/spi/spi_controller_peripheral/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/spi/spi_controller_peripheral/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay deleted file mode 100644 index 541fdbb96dee..000000000000 --- a/tests/drivers/spi/spi_controller_peripheral/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/* Test requires following loopbacks: - * SCK: P1.23 - P1.24 - * MISO: P1.30 - P1.31 - * MOSI: P1.13 - P1.14 - * CS: P1.03 - P1.04 - */ - -&pinctrl { - spi22_default_alt: spi22_default_alt { - group1 { - psels = , - , - ; - }; - }; - - spi22_sleep_alt: spi22_sleep_alt { - group1 { - psels = , - , - ; - low-power-enable; - }; - }; - - spi21_default_alt: spi21_default_alt { - group1 { - psels = , - , - , - ; - }; - }; - - spi21_sleep_alt: spi21_sleep_alt { - group1 { - psels = , - , - , - ; - low-power-enable; - }; - }; -}; - - -&gpio1 { - status = "okay"; -}; - -&spi22 { - status = "okay"; - pinctrl-0 = <&spi22_default_alt>; - pinctrl-1 = <&spi22_sleep_alt>; - pinctrl-names = "default", "sleep"; - overrun-character = <0x00>; - cs-gpios = <&gpio1 3 GPIO_ACTIVE_LOW>; - zephyr,pm-device-runtime-auto; - dut_spi_dt: test-spi-dev@0 { - compatible = "vnd,spi-device"; - reg = <0>; - spi-max-frequency = ; - }; -}; - -dut_spis: &spi21 { - compatible = "nordic,nrf-spis"; - status = "okay"; - def-char = <0x00>; - pinctrl-0 = <&spi21_default_alt>; - pinctrl-1 = <&spi21_sleep_alt>; - pinctrl-names = "default", "sleep"; - /delete-property/rx-delay-supported; - /delete-property/rx-delay; -}; diff --git a/tests/drivers/spi/spi_controller_peripheral/testcase.yaml b/tests/drivers/spi/spi_controller_peripheral/testcase.yaml index 56f3545235e7..c06c1c077fe9 100644 --- a/tests/drivers/spi/spi_controller_peripheral/testcase.yaml +++ b/tests/drivers/spi/spi_controller_peripheral/testcase.yaml @@ -10,7 +10,6 @@ common: - nrf52840dk/nrf52840 - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - nrf54h20dk/nrf54h20/cpuapp - nrf54h20dk/nrf54h20/cpurad - nrf54h20dk/nrf54h20/cpuppr @@ -67,7 +66,6 @@ tests: - nrf54h20dk/nrf54h20/cpurad - nrf54h20dk/nrf54h20/cpuppr - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp drivers.spi.spis_fast: @@ -81,7 +79,6 @@ tests: - nrf54h20dk/nrf54h20/cpurad - nrf54h20dk/nrf54h20/cpuppr - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp drivers.spi.pm_runtime: diff --git a/tests/drivers/spi/spi_error_cases/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/spi/spi_error_cases/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay deleted file mode 100644 index 541fdbb96dee..000000000000 --- a/tests/drivers/spi/spi_error_cases/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/* Test requires following loopbacks: - * SCK: P1.23 - P1.24 - * MISO: P1.30 - P1.31 - * MOSI: P1.13 - P1.14 - * CS: P1.03 - P1.04 - */ - -&pinctrl { - spi22_default_alt: spi22_default_alt { - group1 { - psels = , - , - ; - }; - }; - - spi22_sleep_alt: spi22_sleep_alt { - group1 { - psels = , - , - ; - low-power-enable; - }; - }; - - spi21_default_alt: spi21_default_alt { - group1 { - psels = , - , - , - ; - }; - }; - - spi21_sleep_alt: spi21_sleep_alt { - group1 { - psels = , - , - , - ; - low-power-enable; - }; - }; -}; - - -&gpio1 { - status = "okay"; -}; - -&spi22 { - status = "okay"; - pinctrl-0 = <&spi22_default_alt>; - pinctrl-1 = <&spi22_sleep_alt>; - pinctrl-names = "default", "sleep"; - overrun-character = <0x00>; - cs-gpios = <&gpio1 3 GPIO_ACTIVE_LOW>; - zephyr,pm-device-runtime-auto; - dut_spi_dt: test-spi-dev@0 { - compatible = "vnd,spi-device"; - reg = <0>; - spi-max-frequency = ; - }; -}; - -dut_spis: &spi21 { - compatible = "nordic,nrf-spis"; - status = "okay"; - def-char = <0x00>; - pinctrl-0 = <&spi21_default_alt>; - pinctrl-1 = <&spi21_sleep_alt>; - pinctrl-names = "default", "sleep"; - /delete-property/rx-delay-supported; - /delete-property/rx-delay; -}; diff --git a/tests/drivers/spi/spi_error_cases/testcase.yaml b/tests/drivers/spi/spi_error_cases/testcase.yaml index 8e5ae335edd3..2f097fb072c8 100644 --- a/tests/drivers/spi/spi_error_cases/testcase.yaml +++ b/tests/drivers/spi/spi_error_cases/testcase.yaml @@ -13,7 +13,6 @@ tests: - nrf54l15dk/nrf54l15/cpuapp - nrf54h20dk/nrf54h20/cpuapp - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: - nrf52840dk/nrf52840 diff --git a/tests/drivers/spi/spi_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/spi/spi_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay deleted file mode 100644 index d6e037cdbdfd..000000000000 --- a/tests/drivers/spi/spi_loopback/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/* Test requires following loopback: - * P1.13 - P1.14 - */ - -&pinctrl { - spi21_default: spi21_default { - group1 { - psels = , - , - ; - }; - }; - - spi21_sleep: spi21_sleep { - group1 { - psels = , - , - ; - low-power-enable; - }; - }; -}; - -&spi21 { - status = "okay"; - pinctrl-0 = <&spi21_default>; - pinctrl-1 = <&spi21_sleep>; - pinctrl-names = "default", "sleep"; - overrun-character = <0x00>; - zephyr,pm-device-runtime-auto; - slow@0 { - compatible = "test-spi-loopback-slow"; - reg = <0>; - spi-max-frequency = ; - }; - dut_fast: fast@0 { - compatible = "test-spi-loopback-fast"; - reg = <0>; - spi-max-frequency = ; - }; -}; - -&gpio1 { - status = "okay"; -}; diff --git a/tests/drivers/spi/spi_loopback/testcase.yaml b/tests/drivers/spi/spi_loopback/testcase.yaml index ab3322a8d1fa..6eb098c3dcf6 100644 --- a/tests/drivers/spi/spi_loopback/testcase.yaml +++ b/tests/drivers/spi/spi_loopback/testcase.yaml @@ -273,7 +273,6 @@ tests: platform_allow: - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp harness: console harness_config: fixture: spi_loopback @@ -285,21 +284,18 @@ tests: platform_allow: - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp drivers.spi.nrf54l_16mhz: extra_args: EXTRA_DTC_OVERLAY_FILE="boards/nrf_at_16mhz.overlay" platform_allow: - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp drivers.spi.nrf54l_32mhz: extra_args: EXTRA_DTC_OVERLAY_FILE="boards/nrf_at_32mhz.overlay" platform_allow: - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp drivers.spi.ke1xz_flexio_spi.loopback: extra_args: DTC_OVERLAY_FILE="boards/frdm_ke1xz_flexio_spi.overlay" diff --git a/tests/drivers/timer/nrf_grtc_timer/testcase.yaml b/tests/drivers/timer/nrf_grtc_timer/testcase.yaml index cd4f99daede0..ece1358741ab 100644 --- a/tests/drivers/timer/nrf_grtc_timer/testcase.yaml +++ b/tests/drivers/timer/nrf_grtc_timer/testcase.yaml @@ -11,11 +11,8 @@ tests: - nrf54h20dk/nrf54h20/cpurad - nrf54h20dk/nrf54h20/cpuppr - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - nrf54l20pdk/nrf54l20/cpuflpr - - nrf54lm20dk/nrf54lm20a/cpuflpr - ophelia4ev/nrf54l15/cpuapp - ophelia4ev/nrf54l15/cpuflpr integration_platforms: - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp diff --git a/tests/drivers/uart/uart_async_api/boards/nrf54lm20dk_nrf54lm20_common.dtsi b/tests/drivers/uart/uart_async_api/boards/nrf54lm20dk_nrf54lm20_common.dtsi deleted file mode 100644 index ec39ed93ecf4..000000000000 --- a/tests/drivers/uart/uart_async_api/boards/nrf54lm20dk_nrf54lm20_common.dtsi +++ /dev/null @@ -1,28 +0,0 @@ -/* Test requires following loopback: - * P1.13 - P1.14 - */ - -&pinctrl { - uart21_default_alt: uart21_default_alt { - group1 { - psels = , - ; - }; - }; - - uart21_sleep_alt: uart21_sleep_alt { - group1 { - psels = , - ; - low-power-enable; - }; - }; -}; - -dut: &uart21 { - status = "okay"; - pinctrl-0 = <&uart21_default_alt>; - pinctrl-1 = <&uart21_sleep_alt>; - pinctrl-names = "default", "sleep"; - current-speed = <115200>; -}; diff --git a/tests/drivers/uart/uart_async_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/uart/uart_async_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay deleted file mode 100644 index 5210e41ef553..000000000000 --- a/tests/drivers/uart/uart_async_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ /dev/null @@ -1 +0,0 @@ -#include "nrf54lm20dk_nrf54lm20_common.dtsi" diff --git a/tests/drivers/uart/uart_async_api/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay b/tests/drivers/uart/uart_async_api/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay deleted file mode 100644 index 5210e41ef553..000000000000 --- a/tests/drivers/uart/uart_async_api/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay +++ /dev/null @@ -1 +0,0 @@ -#include "nrf54lm20dk_nrf54lm20_common.dtsi" diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20_common.dtsi b/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20_common.dtsi deleted file mode 100644 index dd9f0b93be04..000000000000 --- a/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20_common.dtsi +++ /dev/null @@ -1,29 +0,0 @@ -&pinctrl { - uart21_default: uart21_default { - group1 { - psels = , - , - , - ; - }; - }; - - uart21_sleep: uart21_sleep { - group1 { - psels = , - , - , - ; - low-power-enable; - }; - }; -}; - -dut: &uart21 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart21_default>; - pinctrl-1 = <&uart21_sleep>; - pinctrl-names = "default", "sleep"; - hw-flow-control; -}; diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay deleted file mode 100644 index 5210e41ef553..000000000000 --- a/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ /dev/null @@ -1 +0,0 @@ -#include "nrf54lm20dk_nrf54lm20_common.dtsi" diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay b/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay deleted file mode 100644 index 5210e41ef553..000000000000 --- a/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay +++ /dev/null @@ -1 +0,0 @@ -#include "nrf54lm20dk_nrf54lm20_common.dtsi" diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20a_dual_uart.overlay b/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20a_dual_uart.overlay deleted file mode 100644 index 0dcede29d924..000000000000 --- a/tests/drivers/uart/uart_elementary/boards/nrf54lm20dk_nrf54lm20a_dual_uart.overlay +++ /dev/null @@ -1,49 +0,0 @@ -&pinctrl { - uart21_default: uart21_default { - group1 { - psels = , - ; - bias-pull-up; - }; - }; - - uart21_sleep: uart21_sleep { - group1 { - psels = , - ; - low-power-enable; - }; - }; - - uart22_default: uart22_default { - group1 { - psels = , - ; - bias-pull-up; - }; - }; - - uart22_sleep: uart22_sleep { - group1 { - psels = , - ; - low-power-enable; - }; - }; -}; - -dut: &uart21 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart21_default>; - pinctrl-1 = <&uart21_sleep>; - pinctrl-names = "default", "sleep"; -}; - -dut_aux: &uart22 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart22_default>; - pinctrl-1 = <&uart22_sleep>; - pinctrl-names = "default", "sleep"; -}; diff --git a/tests/drivers/uart/uart_elementary/testcase.yaml b/tests/drivers/uart/uart_elementary/testcase.yaml index 83aba78e8282..9c6fea77b627 100644 --- a/tests/drivers/uart/uart_elementary/testcase.yaml +++ b/tests/drivers/uart/uart_elementary/testcase.yaml @@ -16,9 +16,7 @@ tests: - nrf54l15dk/nrf54l15/cpuapp - nrf54l15dk/nrf54l15/cpuflpr - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - nrf54l20pdk/nrf54l20/cpuflpr - - nrf54lm20dk/nrf54lm20a/cpuflpr - nrf5340dk/nrf5340/cpuapp - ophelia4ev/nrf54l15/cpuapp - ophelia4ev/nrf54l15/cpuflpr @@ -59,7 +57,6 @@ tests: platform_allow: - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp extra_args: DTC_OVERLAY_FILE="boards/nrf54l15dk_nrf54l15_cpuapp_dual_uart.overlay" extra_configs: @@ -69,7 +66,6 @@ tests: platform_allow: - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp extra_args: DTC_OVERLAY_FILE="boards/nrf54l15dk_nrf54l15_cpuapp_dual_uart.overlay" extra_configs: @@ -80,7 +76,6 @@ tests: platform_allow: - nrf54l15dk/nrf54l15/cpuflpr - nrf54l20pdk/nrf54l20/cpuflpr - - nrf54lm20dk/nrf54lm20a/cpuflpr - ophelia4ev/nrf54l15/cpuflpr extra_args: DTC_OVERLAY_FILE="boards/nrf54l15dk_nrf54l15_cpuflpr_dual_uart.overlay" extra_configs: @@ -90,7 +85,6 @@ tests: platform_allow: - nrf54l15dk/nrf54l15/cpuflpr - nrf54l20pdk/nrf54l20/cpuflpr - - nrf54lm20dk/nrf54lm20a/cpuflpr - ophelia4ev/nrf54l15/cpuflpr extra_args: DTC_OVERLAY_FILE="boards/nrf54l15dk_nrf54l15_cpuflpr_dual_uart.overlay" extra_configs: diff --git a/tests/drivers/uart/uart_errors/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/uart/uart_errors/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay deleted file mode 100644 index 4cc6508c1d18..000000000000 --- a/tests/drivers/uart/uart_errors/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ /dev/null @@ -1,54 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - -&pinctrl { - uart21_default: uart21_default { - group1 { - psels = , - ; - }; - }; - - uart21_sleep: uart21_sleep { - group1 { - psels = , - ; - low-power-enable; - }; - }; - - uart22_default: uart22_default { - group1 { - psels = - ; - bias-pull-up; - }; - group2 { - psels = ; - }; - }; - - uart22_sleep: uart22_sleep { - group1 { - psels = , - ; - low-power-enable; - }; - }; -}; - -dut: &uart21 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart21_default>; - pinctrl-1 = <&uart21_sleep>; - pinctrl-names = "default", "sleep"; -}; - -dut_aux: &uart22 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart22_default>; - pinctrl-1 = <&uart22_sleep>; - pinctrl-names = "default", "sleep"; - disable-rx; -}; diff --git a/tests/drivers/uart/uart_errors/testcase.yaml b/tests/drivers/uart/uart_errors/testcase.yaml index 522935adccaf..d303c73b6004 100644 --- a/tests/drivers/uart/uart_errors/testcase.yaml +++ b/tests/drivers/uart/uart_errors/testcase.yaml @@ -13,7 +13,6 @@ tests: - nrf54h20dk/nrf54h20/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - nrf5340dk/nrf5340/cpuapp - ophelia4ev/nrf54l15/cpuapp drivers.uart.uart_errors.async: @@ -22,7 +21,6 @@ tests: - nrf54h20dk/nrf54h20/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - nrf5340dk/nrf5340/cpuapp - ophelia4ev/nrf54l15/cpuapp extra_configs: diff --git a/tests/drivers/uart/uart_mix_fifo_poll/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/uart/uart_mix_fifo_poll/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay deleted file mode 100644 index d335a12e8562..000000000000 --- a/tests/drivers/uart/uart_mix_fifo_poll/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&pinctrl { - uart21_default: uart21_default { - group1 { - psels = , - , - , - ; - }; - }; - - uart21_sleep: uart21_sleep { - group1 { - psels = , - , - , - ; - low-power-enable; - }; - }; -}; - -dut: &uart21 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart21_default>; - pinctrl-1 = <&uart21_sleep>; - pinctrl-names = "default", "sleep"; - hw-flow-control; -}; - -counter_dev: &timer00 { - status = "okay"; -}; - -&grtc { - interrupts = <228 2>; -}; diff --git a/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml b/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml index a901abda9e43..0ff023748d22 100644 --- a/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml +++ b/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml @@ -12,7 +12,6 @@ common: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - nrf54l15bsim/nrf54l15/cpuapp - nrf54h20dk/nrf54h20/cpuapp - nrf54h20dk/nrf54h20/cpurad diff --git a/tests/drivers/uart/uart_pm/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/uart/uart_pm/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay deleted file mode 100644 index 758cb69bd3c5..000000000000 --- a/tests/drivers/uart/uart_pm/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&pinctrl { - uart21_default: uart21_default { - group1 { - psels = , - ; - }; - }; - - uart21_sleep: uart21_sleep { - group1 { - psels = , - ; - low-power-enable; - }; - }; -}; - -/ { - chosen { - zephyr,console = &uart20; - }; -}; - -dut: &uart21 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart21_default>; - pinctrl-1 = <&uart21_sleep>; - pinctrl-names = "default", "sleep"; -}; diff --git a/tests/drivers/uart/uart_pm/testcase.yaml b/tests/drivers/uart/uart_pm/testcase.yaml index 9bb360677577..329b5546b8b7 100644 --- a/tests/drivers/uart/uart_pm/testcase.yaml +++ b/tests/drivers/uart/uart_pm/testcase.yaml @@ -8,7 +8,6 @@ common: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - nrf54l15bsim/nrf54l15/cpuapp - nrf54h20dk/nrf54h20/cpuapp - nrf52_bsim @@ -36,7 +35,6 @@ tests: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - nrf54l15bsim/nrf54l15/cpuapp - nrf54h20dk/nrf54h20/cpuapp - nrf52_bsim @@ -52,7 +50,6 @@ tests: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - nrf54h20dk/nrf54h20/cpuapp - ophelia4ev/nrf54l15/cpuapp @@ -73,7 +70,6 @@ tests: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - nrf54h20dk/nrf54h20/cpuapp - ophelia4ev/nrf54l15/cpuapp @@ -94,6 +90,5 @@ tests: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - nrf54h20dk/nrf54h20/cpuapp - ophelia4ev/nrf54l15/cpuapp diff --git a/tests/drivers/watchdog/wdt_basic_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/watchdog/wdt_basic_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay deleted file mode 100644 index dc1ea1a9ddc9..000000000000 --- a/tests/drivers/watchdog/wdt_basic_api/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&wdt31 { - status = "okay"; -}; diff --git a/tests/drivers/watchdog/wdt_basic_api/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay b/tests/drivers/watchdog/wdt_basic_api/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay deleted file mode 100644 index dc1ea1a9ddc9..000000000000 --- a/tests/drivers/watchdog/wdt_basic_api/boards/nrf54lm20dk_nrf54lm20a_cpuflpr.overlay +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&wdt31 { - status = "okay"; -}; diff --git a/tests/drivers/watchdog/wdt_error_cases/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/watchdog/wdt_error_cases/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay deleted file mode 100644 index dc1ea1a9ddc9..000000000000 --- a/tests/drivers/watchdog/wdt_error_cases/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&wdt31 { - status = "okay"; -}; diff --git a/tests/drivers/watchdog/wdt_error_cases/testcase.yaml b/tests/drivers/watchdog/wdt_error_cases/testcase.yaml index 951afe9034e0..c31e4e7b76dc 100644 --- a/tests/drivers/watchdog/wdt_error_cases/testcase.yaml +++ b/tests/drivers/watchdog/wdt_error_cases/testcase.yaml @@ -12,7 +12,6 @@ tests: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - nrf54h20dk/nrf54h20/cpuapp - nrf54h20dk/nrf54h20/cpurad - nrf9280pdk/nrf9280/cpuapp diff --git a/tests/drivers/watchdog/wdt_variables/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/watchdog/wdt_variables/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay deleted file mode 100644 index dc1ea1a9ddc9..000000000000 --- a/tests/drivers/watchdog/wdt_variables/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&wdt31 { - status = "okay"; -}; diff --git a/tests/drivers/watchdog/wdt_variables/testcase.yaml b/tests/drivers/watchdog/wdt_variables/testcase.yaml index d033e4f255e4..3ed2ad90b110 100644 --- a/tests/drivers/watchdog/wdt_variables/testcase.yaml +++ b/tests/drivers/watchdog/wdt_variables/testcase.yaml @@ -17,7 +17,6 @@ tests: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: - nrf54l15dk/nrf54l15/cpuapp diff --git a/tests/kernel/timer/timer_behavior/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf b/tests/kernel/timer/timer_behavior/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf deleted file mode 100644 index 4b13bc80c7f3..000000000000 --- a/tests/kernel/timer/timer_behavior/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_SYS_CLOCK_TICKS_PER_SEC=10000 diff --git a/tests/subsys/fs/fcb/testcase.yaml b/tests/subsys/fs/fcb/testcase.yaml index bd5067ecccec..c8351b8dcf21 100644 --- a/tests/subsys/fs/fcb/testcase.yaml +++ b/tests/subsys/fs/fcb/testcase.yaml @@ -15,7 +15,6 @@ tests: - nrf54l09pdk/nrf54l09/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp - native_sim integration_platforms: From 87ffcd56068ffff58854a78e9749b954455d6eb3 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:04 +0300 Subject: [PATCH 1454/2141] Revert "[nrf fromtree] board: nrf: Add nRF54LM20DK board" This reverts commit de8218a621c401af2849ab4ab32014f7435c43ac. Signed-off-by: Jukka Rissanen --- boards/nordic/nrf54lm20dk/Kconfig.defconfig | 9 - boards/nordic/nrf54lm20dk/Kconfig.nrf54lm20dk | 6 - boards/nordic/nrf54lm20dk/board.cmake | 11 -- boards/nordic/nrf54lm20dk/board.yml | 43 ----- boards/nordic/nrf54lm20dk/doc/index.rst | 102 ----------- .../nrf54lm20dk/nrf54lm20a_cpuapp_common.dtsi | 170 ------------------ .../nrf54lm20dk_nrf54lm20a-common.dtsi | 109 ----------- .../nrf54lm20dk_nrf54lm20a-pinctrl.dtsi | 97 ---------- .../nrf54lm20dk_nrf54lm20a_cpuapp.dts | 30 ---- .../nrf54lm20dk_nrf54lm20a_cpuapp.yaml | 23 --- .../nrf54lm20dk_nrf54lm20a_cpuapp_defconfig | 29 --- .../nrf54lm20dk_nrf54lm20a_cpuflpr.dts | 68 ------- .../nrf54lm20dk_nrf54lm20a_cpuflpr.yaml | 16 -- .../nrf54lm20dk_nrf54lm20a_cpuflpr_defconfig | 19 -- 14 files changed, 732 deletions(-) delete mode 100644 boards/nordic/nrf54lm20dk/Kconfig.defconfig delete mode 100644 boards/nordic/nrf54lm20dk/Kconfig.nrf54lm20dk delete mode 100644 boards/nordic/nrf54lm20dk/board.cmake delete mode 100644 boards/nordic/nrf54lm20dk/board.yml delete mode 100644 boards/nordic/nrf54lm20dk/doc/index.rst delete mode 100644 boards/nordic/nrf54lm20dk/nrf54lm20a_cpuapp_common.dtsi delete mode 100644 boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a-common.dtsi delete mode 100644 boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a-pinctrl.dtsi delete mode 100644 boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp.dts delete mode 100644 boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp.yaml delete mode 100644 boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp_defconfig delete mode 100644 boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuflpr.dts delete mode 100644 boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuflpr.yaml delete mode 100644 boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuflpr_defconfig diff --git a/boards/nordic/nrf54lm20dk/Kconfig.defconfig b/boards/nordic/nrf54lm20dk/Kconfig.defconfig deleted file mode 100644 index 266f0f7c13d4..000000000000 --- a/boards/nordic/nrf54lm20dk/Kconfig.defconfig +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2025 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -if BOARD_NRF54LM20DK_NRF54LM20A_CPUAPP - -config ROM_START_OFFSET - default 0x800 if BOOTLOADER_MCUBOOT - -endif # BOARD_NRF54LM20DK_NRF54LM20A_CPUAPP diff --git a/boards/nordic/nrf54lm20dk/Kconfig.nrf54lm20dk b/boards/nordic/nrf54lm20dk/Kconfig.nrf54lm20dk deleted file mode 100644 index 83b3842211f3..000000000000 --- a/boards/nordic/nrf54lm20dk/Kconfig.nrf54lm20dk +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright (c) 2025 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -config BOARD_NRF54LM20DK - select SOC_NRF54LM20A_ENGA_CPUAPP if BOARD_NRF54LM20DK_NRF54LM20A_CPUAPP - select SOC_NRF54LM20A_ENGA_CPUFLPR if BOARD_NRF54LM20DK_NRF54LM20A_CPUFLPR diff --git a/boards/nordic/nrf54lm20dk/board.cmake b/boards/nordic/nrf54lm20dk/board.cmake deleted file mode 100644 index e487ecfb476f..000000000000 --- a/boards/nordic/nrf54lm20dk/board.cmake +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright (c) 2025 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -if(CONFIG_SOC_NRF54LM20A_ENGA_CPUAPP) - board_runner_args(jlink "--device=cortex-m33" "--speed=4000") -elseif(CONFIG_SOC_NRF54LM20A_ENGA_CPUFLPR) - board_runner_args(jlink "--speed=4000") -endif() - -include(${ZEPHYR_BASE}/boards/common/nrfutil.board.cmake) -include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) diff --git a/boards/nordic/nrf54lm20dk/board.yml b/boards/nordic/nrf54lm20dk/board.yml deleted file mode 100644 index 2930f9d3dfbd..000000000000 --- a/boards/nordic/nrf54lm20dk/board.yml +++ /dev/null @@ -1,43 +0,0 @@ -board: - name: nrf54lm20dk - full_name: nRF54LM20 DK - vendor: nordic - socs: - - name: nrf54lm20a - variants: - - name: xip - cpucluster: cpuflpr -runners: - run_once: - '--recover': - - runners: - - nrfjprog - - nrfutil - run: first - groups: - - boards: - - nrf54lm20dk/nrf54lm20a/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuflpr - - nrf54lm20dk/nrf54lm20a/cpuflpr/xip - '--erase': - - runners: - - nrfjprog - - jlink - - nrfutil - run: first - groups: - - boards: - - nrf54lm20dk/nrf54lm20a/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuflpr - - nrf54lm20dk/nrf54lm20a/cpuflpr/xip - '--reset': - - runners: - - nrfjprog - - jlink - - nrfutil - run: last - groups: - - boards: - - nrf54lm20dk/nrf54lm20a/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuflpr - - nrf54lm20dk/nrf54lm20a/cpuflpr/xip diff --git a/boards/nordic/nrf54lm20dk/doc/index.rst b/boards/nordic/nrf54lm20dk/doc/index.rst deleted file mode 100644 index 007074c5cc53..000000000000 --- a/boards/nordic/nrf54lm20dk/doc/index.rst +++ /dev/null @@ -1,102 +0,0 @@ -.. zephyr:board:: nrf54lm20dk - -Overview -******** - -The nRF54LM20 Development Kit hardware provides support for the Nordic Semiconductor -nRF54LM20A Arm Cortex-M33 CPU and the following devices: - -* :abbr:`SAADC (Successive Approximation Analog to Digital Converter)` -* CLOCK -* RRAM -* :abbr:`GPIO (General Purpose Input Output)` -* :abbr:`TWIM (I2C-compatible two-wire interface master with EasyDMA)` -* MEMCONF -* :abbr:`MPU (Memory Protection Unit)` -* :abbr:`NVIC (Nested Vectored Interrupt Controller)` -* :abbr:`PWM (Pulse Width Modulation)` -* :abbr:`GRTC (Global real-time counter)` -* Segger RTT (RTT Console) -* :abbr:`SPI (Serial Peripheral Interface)` -* :abbr:`UARTE (Universal asynchronous receiver-transmitter)` -* :abbr:`WDT (Watchdog Timer)` - -Hardware -******** - -nRF54LM20 DK has two crystal oscillators: - -* High-frequency 32 MHz crystal oscillator (HFXO) -* Low-frequency 32.768 kHz crystal oscillator (LFXO) - -The crystal oscillators can be configured to use either -internal or external capacitors. - -Supported Features -================== - -.. zephyr:board-supported-hw:: - -Programming and Debugging -************************* - -.. zephyr:board-supported-runners:: - -Applications for the ``nrf54lm20dk/nrf54lm20a/cpuapp`` board target can be -built, flashed, and debugged in the usual way. See -:ref:`build_an_application` and :ref:`application_run` for more details on -building and running. - -Applications for the ``nrf54lm20dk/nrf54lm20a/cpuflpr`` board target need -to be built using sysbuild to include the ``vpr_launcher`` image for the application core. - -Enter the following command to compile ``hello_world`` for the FLPR core: - -.. code-block:: console - - west build -p -b nrf54lm20dk/nrf54lm20a/cpuflpr --sysbuild - - -Flashing -======== - -As an example, this section shows how to build and flash the :zephyr:code-sample:`hello_world` -application. - -.. warning:: - - When programming the device, you might get an error similar to the following message:: - - ERROR: The operation attempted is unavailable due to readback protection in - ERROR: your device. Please use --recover to unlock the device. - - This error occurs when readback protection is enabled. - To disable the readback protection, you must *recover* your device. - - Enter the following command to recover the core:: - - west flash --recover - - The ``--recover`` command erases the flash memory and then writes a small binary into - the recovered flash memory. - This binary prevents the readback protection from enabling itself again after a pin - reset or power cycle. - -Follow the instructions in the :ref:`nordic_segger` page to install -and configure all the necessary software. Further information can be -found in :ref:`nordic_segger_flashing`. - -To build and program the sample to the nRF54LM20 DK, complete the following steps: - -First, connect the nRF54LM20 DK to you computer using the IMCU USB port on the DK. -Next, build the sample by running the following command: - -.. zephyr-app-commands:: - :zephyr-app: samples/hello_world - :board: nrf54lm20dk/nrf54lm20a/cpuapp - :goals: build flash - -Testing the LEDs and buttons in the nRF54LM20 DK -************************************************ - -Test the nRF54LM20 DK with a :zephyr:code-sample:`blinky` sample. diff --git a/boards/nordic/nrf54lm20dk/nrf54lm20a_cpuapp_common.dtsi b/boards/nordic/nrf54lm20dk/nrf54lm20a_cpuapp_common.dtsi deleted file mode 100644 index 3591a8009486..000000000000 --- a/boards/nordic/nrf54lm20dk/nrf54lm20a_cpuapp_common.dtsi +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/* This file is common to the secure and non-secure domain */ - -#include -#include "nrf54lm20dk_nrf54lm20a-common.dtsi" - -/ { - chosen { - zephyr,console = &uart20; - zephyr,shell-uart = &uart20; - zephyr,uart-mcumgr = &uart20; - zephyr,bt-mon-uart = &uart20; - zephyr,bt-c2h-uart = &uart20; - zephyr,flash-controller = &rram_controller; - zephyr,flash = &cpuapp_rram; - zephyr,bt-hci = &bt_hci_sdc; - zephyr,ieee802154 = &ieee802154; - }; -}; - -&cpuapp_sram { - status = "okay"; -}; - -&hfpll { - clock-frequency = ; -}; - -&lfxo { - load-capacitors = "internal"; - load-capacitance-femtofarad = <17000>; -}; - -&hfxo { - load-capacitors = "internal"; - load-capacitance-femtofarad = <15000>; -}; - -&vregmain { - status = "okay"; - regulator-initial-mode = ; -}; - -&grtc { - owned-channels = <0 1 2 3 4 5 6 7 8 9 10 11>; - /* Channels 7-11 reserved for Zero Latency IRQs, 3-4 for FLPR */ - child-owned-channels = <3 4 7 8 9 10 11>; - status = "okay"; -}; - -&cpuapp_rram { - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - boot_partition: partition@0 { - label = "mcuboot"; - reg = <0x0 DT_SIZE_K(64)>; - }; - - slot0_partition: partition@10000 { - label = "image-0"; - reg = <0x10000 DT_SIZE_K(449)>; - }; - - slot0_ns_partition: partition@80400 { - label = "image-0-nonsecure"; - reg = <0x80400 DT_SIZE_K(449)>; - }; - - slot1_partition: partition@f0800 { - label = "image-1"; - reg = <0xf0800 DT_SIZE_K(449)>; - }; - - slot1_ns_partition: partition@160c00 { - label = "image-1-nonsecure"; - reg = <0x160c00 DT_SIZE_K(449)>; - }; - - storage_partition: partition@1d1000 { - label = "storage"; - reg = <0x1d1000 DT_SIZE_K(36)>; - }; - }; -}; - -&uart20 { - status = "okay"; -}; - -&nfct { - status = "okay"; -}; - -&gpio0 { - status = "okay"; -}; - -&gpio1 { - status = "okay"; -}; - -&gpio2 { - status = "okay"; -}; - -&gpiote20 { - status = "okay"; -}; - -&gpiote30 { - status = "okay"; -}; - -&radio { - status = "okay"; -}; - -&temp { - status = "okay"; -}; - -&clock { - status = "okay"; -}; - -&bt_hci_controller { - status = "okay"; -}; - -&ieee802154 { - status = "okay"; -}; - -zephyr_udc0: &usbhs { - status = "okay"; -}; - -&spi00 { - status = "okay"; - cs-gpios = <&gpio2 5 GPIO_ACTIVE_LOW>; - pinctrl-0 = <&spi00_default>; - pinctrl-1 = <&spi00_sleep>; - pinctrl-names = "default", "sleep"; - - mx25r64: mx25r6435f@0 { - compatible = "jedec,spi-nor"; - status = "disabled"; - reg = <0>; - spi-max-frequency = <8000000>; - jedec-id = [c2 28 17]; - sfdp-bfp = [ - e5 20 f1 ff ff ff ff 03 44 eb 08 6b 08 3b 04 bb - ee ff ff ff ff ff 00 ff ff ff 00 ff 0c 20 0f 52 - 10 d8 00 ff 23 72 f5 00 82 ed 04 cc 44 83 48 44 - 30 b0 30 b0 f7 c4 d5 5c 00 be 29 ff f0 d0 ff ff - ]; - size = <67108864>; - has-dpd; - t-enter-dpd = <10000>; - t-exit-dpd = <35000>; - }; -}; diff --git a/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a-common.dtsi b/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a-common.dtsi deleted file mode 100644 index 525a3a5fdc0e..000000000000 --- a/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a-common.dtsi +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include "nrf54lm20dk_nrf54lm20a-pinctrl.dtsi" - -/ { - leds { - compatible = "gpio-leds"; - - led0: led_0 { - gpios = <&gpio1 22 GPIO_ACTIVE_HIGH>; - label = "Green LED 0"; - }; - - led1: led_1 { - gpios = <&gpio1 25 GPIO_ACTIVE_HIGH>; - label = "Green LED 1"; - }; - - led2: led_2 { - gpios = <&gpio1 27 GPIO_ACTIVE_HIGH>; - label = "Green LED 2"; - }; - - led3: led_3 { - gpios = <&gpio1 28 GPIO_ACTIVE_HIGH>; - label = "Green LED 3"; - }; - }; - - pwmleds { - compatible = "pwm-leds"; - - /* - * PWM signal can be exposed on GPIO pin only within same domain. - * There is only one domain which contains both PWM and GPIO: - * PWM20/21/22 and GPIO Port P1/P3. - * Only LEDs connected to P1/P3 can work with PWM, for example LED1. - */ - pwm_led1: pwm_led_1 { - pwms = <&pwm20 0 PWM_MSEC(20) PWM_POLARITY_NORMAL>; - }; - }; - - buttons { - compatible = "gpio-keys"; - - button0: button_0 { - gpios = <&gpio1 26 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; - label = "Push button 0"; - zephyr,code = ; - }; - - button1: button_1 { - gpios = <&gpio1 9 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; - label = "Push button 1"; - zephyr,code = ; - }; - - button2: button_2 { - gpios = <&gpio1 8 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; - label = "Push button 2"; - zephyr,code = ; - }; - - button3: button_3 { - gpios = <&gpio0 5 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; - label = "Push button 3"; - zephyr,code = ; - }; - }; - - aliases { - led0 = &led0; - led1 = &led1; - led2 = &led2; - led3 = &led3; - pwm-led0 = &pwm_led1; - sw0 = &button0; - sw1 = &button1; - sw2 = &button2; - sw3 = &button3; - watchdog0 = &wdt31; - }; -}; - -&uart20 { - current-speed = <115200>; - pinctrl-0 = <&uart20_default>; - pinctrl-1 = <&uart20_sleep>; - pinctrl-names = "default", "sleep"; -}; - -&uart30 { - current-speed = <115200>; - pinctrl-0 = <&uart30_default>; - pinctrl-1 = <&uart30_sleep>; - pinctrl-names = "default", "sleep"; -}; - -&pwm20 { - status = "okay"; - pinctrl-0 = <&pwm20_default>; - pinctrl-1 = <&pwm20_sleep>; - pinctrl-names = "default", "sleep"; -}; diff --git a/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a-pinctrl.dtsi b/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a-pinctrl.dtsi deleted file mode 100644 index ec1c81e4f8d4..000000000000 --- a/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a-pinctrl.dtsi +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor - * SPDX-License-Identifier: Apache-2.0 - */ - -&pinctrl { - /omit-if-no-ref/ uart20_default: uart20_default { - group1 { - psels = , - ; - }; - - group2 { - psels = , - ; - bias-pull-up; - }; - }; - - /omit-if-no-ref/ uart20_sleep: uart20_sleep { - group1 { - psels = , - , - , - ; - low-power-enable; - }; - }; - - /omit-if-no-ref/ pwm20_default: pwm20_default { - group1 { - psels = ; - }; - }; - - /omit-if-no-ref/ pwm20_sleep: pwm20_sleep { - group1 { - psels = ; - low-power-enable; - }; - }; - - /omit-if-no-ref/ uart30_default: uart30_default { - group1 { - psels = , - ; - }; - - group2 { - psels = , - ; - bias-pull-up; - }; - }; - - /omit-if-no-ref/ uart30_sleep: uart30_sleep { - group1 { - psels = , - , - , - ; - low-power-enable; - }; - }; - - /omit-if-no-ref/ spi00_default: spi00_default { - group1 { - psels = , - , - ; - }; - }; - - /omit-if-no-ref/ spi00_sleep: spi00_sleep { - group1 { - psels = , - , - ; - low-power-enable; - }; - }; - - /omit-if-no-ref/ grtc_default: grtc_default { - group1 { - psels = , - ; - }; - }; - - /omit-if-no-ref/ grtc_sleep: grtc_sleep { - group1 { - psels = , - ; - low-power-enable; - }; - }; -}; diff --git a/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp.dts b/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp.dts deleted file mode 100644 index 29d616b5ece5..000000000000 --- a/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp.dts +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/dts-v1/; - -#include "nrf54lm20a_cpuapp_common.dtsi" - -/ { - compatible = "nordic,nrf54lm20dk_nrf54lm20a-cpuapp"; - model = "Nordic nRF54LM20 DK nRF54LM20A Application MCU"; - - chosen { - zephyr,code-partition = &slot0_partition; - zephyr,sram = &cpuapp_sram; - }; -}; - -&bt_hci_sdc { - status = "okay"; -}; - -&bt_hci_controller { - status = "disabled"; -}; - -/* Get a node label for wi-fi spi to use in shield files */ -wifi_spi: &spi22 {}; diff --git a/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp.yaml b/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp.yaml deleted file mode 100644 index 765845fa27f0..000000000000 --- a/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp.yaml +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright (c) 2025 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -identifier: nrf54lm20dk/nrf54lm20a/cpuapp -name: nRF54LM20-DK-nRF54LM20A-Application -type: mcu -arch: arm -toolchain: - - gnuarmemb - - zephyr -sysbuild: true -ram: 512 -flash: 449 -supported: - - adc - - counter - - dmic - - gpio - - i2c - - i2s - - pwm - - spi - - watchdog diff --git a/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp_defconfig b/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp_defconfig deleted file mode 100644 index 8424e66c571d..000000000000 --- a/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp_defconfig +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright (c) 2025 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -# Enable UART driver -CONFIG_SERIAL=y - -# Enable console -CONFIG_CONSOLE=y -CONFIG_UART_CONSOLE=y - -# Enable GPIO -CONFIG_GPIO=y - -# Enable MPU -CONFIG_ARM_MPU=y - -# Enable hardware stack protection -CONFIG_HW_STACK_PROTECTION=y - -# MPU-based null-pointer dereferencing detection cannot -# be applied as the (0x0 - 0x400) is unmapped for this target. -CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y - -# Enable Cache -CONFIG_CACHE_MANAGEMENT=y -CONFIG_EXTERNAL_CACHE=y - -# Start SYSCOUNTER on driver init -CONFIG_NRF_GRTC_START_SYSCOUNTER=y diff --git a/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuflpr.dts b/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuflpr.dts deleted file mode 100644 index 3097d3f2775e..000000000000 --- a/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuflpr.dts +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/dts-v1/; -#include -#include "nrf54lm20dk_nrf54lm20a-common.dtsi" - -/ { - model = "Nordic nRF54LM20 DK nRF54LM20A FLPR MCU"; - compatible = "nordic,nrf54lm20dk_nrf54lm20a-cpuflpr"; - - chosen { - zephyr,console = &uart30; - zephyr,shell-uart = &uart30; - zephyr,code-partition = &cpuflpr_code_partition; - zephyr,flash = &cpuflpr_rram; - zephyr,sram = &cpuflpr_sram; - }; -}; - -&cpuflpr_sram { - status = "okay"; -}; - -&cpuflpr_rram { - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cpuflpr_code_partition: partition@0 { - label = "image-0"; - reg = <0x0 DT_SIZE_K(96)>; - }; - }; -}; - -&grtc { - owned-channels = <3 4>; - status = "okay"; -}; - -&uart30 { - status = "okay"; -}; - -&gpio0 { - status = "okay"; -}; - -&gpio1 { - status = "okay"; -}; - -&gpio2 { - status = "okay"; -}; - -&gpiote20 { - status = "okay"; -}; - -&gpiote30 { - status = "okay"; -}; diff --git a/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuflpr.yaml b/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuflpr.yaml deleted file mode 100644 index b99d167bcdfe..000000000000 --- a/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuflpr.yaml +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright (c) 2025 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -identifier: nrf54lm20dk/nrf54lm20a/cpuflpr -name: nRF54LM20-DK-nRF54LM20A-Fast-Lightweight-Peripheral-Processor -type: mcu -arch: riscv -toolchain: - - zephyr -sysbuild: true -ram: 96 -flash: 96 -supported: - - counter - - gpio - - watchdog diff --git a/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuflpr_defconfig b/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuflpr_defconfig deleted file mode 100644 index 75f7c4386e3f..000000000000 --- a/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuflpr_defconfig +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright (c) 2025 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -# Enable UART driver -CONFIG_SERIAL=y - -# Enable console -CONFIG_CONSOLE=y -CONFIG_UART_CONSOLE=y - -# Enable GPIO -CONFIG_GPIO=y - -CONFIG_USE_DT_CODE_PARTITION=y - -# Execute from SRAM -CONFIG_XIP=n - -CONFIG_RISCV_ALWAYS_SWITCH_THROUGH_ECALL=y From b65237bf0afe0ba30673b7273e2f091437725809 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:05 +0300 Subject: [PATCH 1455/2141] Revert "[nrf fromtree] soc: nrf: Add nRF54LM20A device" This reverts commit 01ea3eec543b3fe31fbdb86b30ee4cf9d4f8b91d. Signed-off-by: Jukka Rissanen --- dts/arm/nordic/nrf54lm20a_enga_cpuapp.dtsi | 125 --- dts/riscv/nordic/nrf54lm20a_enga_cpuflpr.dtsi | 67 -- dts/vendor/nordic/nrf54lm20a.dtsi | 879 ------------------ modules/hal_nordic/nrfx/CMakeLists.txt | 7 +- snippets/nordic-flpr/snippet.yml | 3 - .../nordic-flpr/soc/nrf54lm20a_cpuapp.overlay | 39 - soc/nordic/nrf54l/Kconfig | 6 - .../Kconfig.defconfig.nrf54lm20a_enga_cpuapp | 15 - .../Kconfig.defconfig.nrf54lm20a_enga_cpuflpr | 11 - soc/nordic/nrf54l/Kconfig.soc | 25 - soc/nordic/nrf54l/Kconfig.sysbuild | 2 +- soc/nordic/soc.yml | 13 - 12 files changed, 2 insertions(+), 1190 deletions(-) delete mode 100644 dts/arm/nordic/nrf54lm20a_enga_cpuapp.dtsi delete mode 100644 dts/riscv/nordic/nrf54lm20a_enga_cpuflpr.dtsi delete mode 100644 dts/vendor/nordic/nrf54lm20a.dtsi delete mode 100644 snippets/nordic-flpr/soc/nrf54lm20a_cpuapp.overlay delete mode 100644 soc/nordic/nrf54l/Kconfig.defconfig.nrf54lm20a_enga_cpuapp delete mode 100644 soc/nordic/nrf54l/Kconfig.defconfig.nrf54lm20a_enga_cpuflpr diff --git a/dts/arm/nordic/nrf54lm20a_enga_cpuapp.dtsi b/dts/arm/nordic/nrf54lm20a_enga_cpuapp.dtsi deleted file mode 100644 index fa5ee3252bf7..000000000000 --- a/dts/arm/nordic/nrf54lm20a_enga_cpuapp.dtsi +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include - -cpu: &cpuapp {}; -systick: &cpuapp_systick {}; -nvic: &cpuapp_nvic {}; - -/delete-node/ &cpuflpr; -/delete-node/ &cpuflpr_rram; -/delete-node/ &cpuflpr_sram; -/delete-node/ &cpuflpr_clic; - -/ { - chosen { - zephyr,entropy = &prng; - }; - - soc { - compatible = "simple-bus"; - interrupt-parent = <&cpuapp_nvic>; - ranges; - }; - - psa_rng: psa-rng { - compatible = "zephyr,psa-crypto-rng"; - status = "disabled"; - }; - - prng: prng { - compatible = "nordic,entropy-prng"; - status = "okay"; - }; -}; - -&cpuflpr_vpr { - cpuapp_vevif_rx: mailbox@1 { - compatible = "nordic,nrf-vevif-event-rx"; - reg = <0x0 0x1000>; - status = "disabled"; - interrupts = <76 NRF_DEFAULT_IRQ_PRIORITY>; - #mbox-cells = <1>; - nordic,events = <1>; - nordic,events-mask = <0x00100000>; - }; - - cpuapp_vevif_tx: mailbox@0 { - compatible = "nordic,nrf-vevif-task-tx"; - reg = <0x0 0x1000>; - #mbox-cells = <1>; - nordic,tasks = <7>; - nordic,tasks-mask = <0x007f0000>; - status = "disabled"; - }; -}; - -&cpuapp_ppb { - compatible = "simple-bus"; - ranges; -}; - -&grtc { - interrupts = <228 NRF_DEFAULT_IRQ_PRIORITY>, - <229 NRF_DEFAULT_IRQ_PRIORITY>; /* reserved for Zero Latency IRQs */ -}; - -&gpiote20 { - interrupts = <219 NRF_DEFAULT_IRQ_PRIORITY>; -}; - -&gpiote30 { - interrupts = <269 NRF_DEFAULT_IRQ_PRIORITY>; -}; - -&dppic00 { - status = "okay"; -}; - -&dppic10 { - status = "okay"; -}; - -&dppic20 { - status = "okay"; -}; - -&dppic30 { - status = "okay"; -}; - -&ppib00 { - status = "okay"; -}; - -&ppib01 { - status = "okay"; -}; - -&ppib10 { - status = "okay"; -}; - -&ppib11 { - status = "okay"; -}; - -&ppib20 { - status = "okay"; -}; - -&ppib21 { - status = "okay"; -}; - -&ppib22 { - status = "okay"; -}; - -&ppib30 { - status = "okay"; -}; diff --git a/dts/riscv/nordic/nrf54lm20a_enga_cpuflpr.dtsi b/dts/riscv/nordic/nrf54lm20a_enga_cpuflpr.dtsi deleted file mode 100644 index 82f1b17b2b17..000000000000 --- a/dts/riscv/nordic/nrf54lm20a_enga_cpuflpr.dtsi +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include - -cpu: &cpuflpr {}; -clic: &cpuflpr_clic {}; - -/delete-node/ &cpuapp; -/delete-node/ &cpuapp_rram; -/delete-node/ &cpuapp_ppb; -/delete-node/ &cpuapp_sram; - -/ { - soc { - compatible = "simple-bus"; - interrupt-parent = <&cpuflpr_clic>; - ranges; - }; -}; - -&cpuflpr { - cpuflpr_vevif_rx: mailbox { - compatible = "nordic,nrf-vevif-task-rx"; - status = "disabled"; - interrupt-parent = <&cpuflpr_clic>; - interrupts = <16 NRF_DEFAULT_IRQ_PRIORITY>, - <17 NRF_DEFAULT_IRQ_PRIORITY>, - <18 NRF_DEFAULT_IRQ_PRIORITY>, - <19 NRF_DEFAULT_IRQ_PRIORITY>, - <20 NRF_DEFAULT_IRQ_PRIORITY>, - <21 NRF_DEFAULT_IRQ_PRIORITY>, - <22 NRF_DEFAULT_IRQ_PRIORITY>; - #mbox-cells = <1>; - nordic,tasks = <7>; - nordic,tasks-mask = <0x007f0000>; - }; -}; - -&cpuflpr_vpr { - cpuflpr_vevif_tx: mailbox { - compatible = "nordic,nrf-vevif-event-tx"; - #mbox-cells = <1>; - nordic,events = <1>; - nordic,events-mask = <0x00100000>; - status = "disabled"; - }; -}; - -&cpuflpr_clic { - status = "okay"; -}; - -&grtc { - interrupts = <226 NRF_DEFAULT_IRQ_PRIORITY>; -}; - -&gpiote20 { - interrupts = <218 NRF_DEFAULT_IRQ_PRIORITY>; -}; - -&gpiote30 { - interrupts = <268 NRF_DEFAULT_IRQ_PRIORITY>; -}; diff --git a/dts/vendor/nordic/nrf54lm20a.dtsi b/dts/vendor/nordic/nrf54lm20a.dtsi deleted file mode 100644 index d673ae94e509..000000000000 --- a/dts/vendor/nordic/nrf54lm20a.dtsi +++ /dev/null @@ -1,879 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include -#include - -/delete-node/ &sw_pwm; - -/* Domain IDs. Can be used to specify channel links in IPCT nodes. */ -#define NRF_DOMAIN_ID_APPLICATION 0 -#define NRF_DOMAIN_ID_FLPR 1 - -/ { - #address-cells = <1>; - #size-cells = <1>; - - cpus { - #address-cells = <1>; - #size-cells = <0>; - - cpuapp: cpu@0 { - compatible = "arm,cortex-m33f"; - reg = <0>; - device_type = "cpu"; - clocks = <&hfpll>; - #address-cells = <1>; - #size-cells = <1>; - - itm: itm@e0000000 { - compatible = "arm,armv8m-itm"; - reg = <0xe0000000 0x1000>; - swo-ref-frequency = ; - }; - }; - - cpuflpr: cpu@1 { - compatible = "nordic,vpr"; - reg = <1>; - device_type = "cpu"; - riscv,isa = "rv32emc"; - nordic,bus-width = <32>; - }; - }; - - clocks { - pclk: pclk { - compatible = "fixed-clock"; - #clock-cells = <0>; - clock-frequency = ; - }; - - pclk32m: pclk32m { - compatible = "fixed-clock"; - #clock-cells = <0>; - clock-frequency = ; - }; - - lfxo: lfxo { - compatible = "nordic,nrf54l-lfxo"; - #clock-cells = <0>; - clock-frequency = <32768>; - }; - - hfxo: hfxo { - compatible = "nordic,nrf54l-hfxo"; - #clock-cells = <0>; - clock-frequency = ; - startup-time-us = <1650>; - }; - - hfpll: hfpll { - compatible = "fixed-clock"; - #clock-cells = <0>; - clock-frequency = ; - }; - - aclk: aclk { - compatible = "fixed-clock"; - #clock-cells = <0>; - clock-frequency = ; - }; - }; - - soc { - #address-cells = <1>; - #size-cells = <1>; - - ficr: ficr@ffc000 { - compatible = "nordic,nrf-ficr"; - reg = <0xffc000 0x1000>; - #nordic,ficr-cells = <1>; - }; - - uicr: uicr@ffd000 { - compatible = "nordic,nrf-uicr"; - reg = <0xffd000 0x1000>; - }; - - cpuapp_sram: memory@20000000 { - compatible = "mmio-sram"; - reg = <0x20000000 DT_SIZE_K(511)>; - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x20000000 DT_SIZE_K(511)>; - }; - - cpuflpr_sram: memory@20067c00 { - compatible = "mmio-sram"; - reg = <0x20067c00 DT_SIZE_K(96)>; - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x20067c00 DT_SIZE_K(96)>; - }; - - global_peripherals: peripheral@50000000 { - ranges = <0x0 0x50000000 0x10000000>; - #address-cells = <1>; - #size-cells = <1>; - - dppic00: dppic@42000 { - compatible = "nordic,nrf-dppic"; - reg = <0x42000 0x808>; - status = "disabled"; - }; - - ppib00: ppib@44000 { - compatible = "nordic,nrf-ppib"; - reg = <0x44000 0x1000>; - status = "disabled"; - }; - - ppib01: ppib@45000 { - compatible = "nordic,nrf-ppib"; - reg = <0x45000 0x1000>; - status = "disabled"; - }; - - cpuflpr_vpr: vpr@4c000 { - compatible = "nordic,nrf-vpr-coprocessor"; - reg = <0x4c000 0x1000>; - ranges = <0x0 0x4c000 0x1000>; - #address-cells = <1>; - #size-cells = <1>; - status = "disabled"; - enable-secure; - - cpuflpr_clic: interrupt-controller@f0000000 { - compatible = "nordic,nrf-clic"; - reg = <0xf0000000 0x143c>; - interrupt-controller; - #interrupt-cells = <2>; - #address-cells = <1>; - status = "disabled"; - }; - }; - - spi00: spi@4d000 { - /* - * This spi node can be either SPIM or SPIS, - * for the user to pick: - * compatible = "nordic,nrf-spim" or - * "nordic,nrf-spis". - */ - compatible = "nordic,nrf-spim"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0x4d000 0x1000>; - interrupts = <77 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - easydma-maxcnt-bits = <16>; - rx-delay-supported; - rx-delay = <1>; - status = "disabled"; - }; - - uart00: uart@4d000 { - compatible = "nordic,nrf-uarte"; - reg = <0x4d000 0x1000>; - interrupts = <77 NRF_DEFAULT_IRQ_PRIORITY>; - clocks = <&hfpll>; - status = "disabled"; - endtx-stoptx-supported; - frame-timeout-supported; - }; - - gpio2: gpio@50400 { - compatible = "nordic,nrf-gpio"; - gpio-controller; - reg = <0x50400 0x300>; - #gpio-cells = <2>; - ngpios = <11>; - status = "disabled"; - port = <2>; - }; - - timer00: timer@55000 { - compatible = "nordic,nrf-timer"; - status = "disabled"; - reg = <0x55000 0x1000>; - cc-num = <6>; - max-bit-width = <32>; - interrupts = <85 NRF_DEFAULT_IRQ_PRIORITY>; - clocks = <&hfpll>; - prescaler = <0>; - }; - - usbhs: usbhs@5a000 { - compatible = "nordic,nrf-usbhs-nrf54l", "snps,dwc2"; - reg = <0x5a000 0x1000>, <0x50020000 0x1a000>; - reg-names = "wrapper", "core"; - interrupts = <90 NRF_DEFAULT_IRQ_PRIORITY>; - num-in-eps = <16>; - num-out-eps = <16>; - ghwcfg1 = <0x0>; - ghwcfg2 = <0x22affc52>; - ghwcfg4 = <0x3e10aa60>; - status = "disabled"; - }; - - dppic10: dppic@82000 { - compatible = "nordic,nrf-dppic"; - reg = <0x82000 0x808>; - status = "disabled"; - }; - - ppib10: ppib@83000 { - compatible = "nordic,nrf-ppib"; - reg = <0x83000 0x1000>; - status = "disabled"; - }; - - ppib11: ppib@84000 { - compatible = "nordic,nrf-ppib"; - reg = <0x84000 0x1000>; - status = "disabled"; - }; - - timer10: timer@85000 { - compatible = "nordic,nrf-timer"; - status = "disabled"; - reg = <0x85000 0x1000>; - cc-num = <8>; - max-bit-width = <32>; - interrupts = <133 NRF_DEFAULT_IRQ_PRIORITY>; - clocks = <&hfxo>; - prescaler = <0>; - }; - - egu10: egu@87000 { - compatible = "nordic,nrf-egu"; - reg = <0x87000 0x1000>; - interrupts = <135 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - }; - - radio: radio@8a000 { - compatible = "nordic,nrf-radio"; - reg = <0x8a000 0x1000>; - interrupts = <138 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - dfe-supported; - ieee802154-supported; - ble-2mbps-supported; - ble-coded-phy-supported; - cs-supported; - - ieee802154: ieee802154 { - compatible = "nordic,nrf-ieee802154"; - status = "disabled"; - }; - - /* Note: In the nRF Connect SDK the SoftDevice Controller - * is added and set as the default Bluetooth Controller. - */ - bt_hci_sdc: bt_hci_sdc { - compatible = "nordic,bt-hci-sdc"; - status = "disabled"; - }; - - bt_hci_controller: bt_hci_controller { - compatible = "zephyr,bt-hci-ll-sw-split"; - status = "disabled"; - }; - }; - - dppic20: dppic@c2000 { - compatible = "nordic,nrf-dppic"; - reg = <0xc2000 0x808>; - status = "disabled"; - }; - - ppib20: ppib@c3000 { - compatible = "nordic,nrf-ppib"; - reg = <0xc3000 0x1000>; - status = "disabled"; - }; - - ppib21: ppib@c4000 { - compatible = "nordic,nrf-ppib"; - reg = <0xc4000 0x1000>; - status = "disabled"; - }; - - ppib22: ppib@c5000 { - compatible = "nordic,nrf-ppib"; - reg = <0xc5000 0x1000>; - status = "disabled"; - }; - - i2c20: i2c@c6000 { - compatible = "nordic,nrf-twim"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0xc6000 0x1000>; - interrupts = <198 NRF_DEFAULT_IRQ_PRIORITY>; - easydma-maxcnt-bits = <16>; - status = "disabled"; - zephyr,pm-device-runtime-auto; - }; - - spi20: spi@c6000 { - /* - * This spi node can be either SPIM or SPIS, - * for the user to pick: - * compatible = "nordic,nrf-spim" or - * "nordic,nrf-spis". - */ - compatible = "nordic,nrf-spim"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0xc6000 0x1000>; - interrupts = <198 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - easydma-maxcnt-bits = <16>; - rx-delay-supported; - rx-delay = <1>; - status = "disabled"; - }; - - uart20: uart@c6000 { - compatible = "nordic,nrf-uarte"; - reg = <0xc6000 0x1000>; - interrupts = <198 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - endtx-stoptx-supported; - frame-timeout-supported; - }; - - i2c21: i2c@c7000 { - compatible = "nordic,nrf-twim"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0xc7000 0x1000>; - interrupts = <199 NRF_DEFAULT_IRQ_PRIORITY>; - easydma-maxcnt-bits = <16>; - status = "disabled"; - zephyr,pm-device-runtime-auto; - }; - - spi21: spi@c7000 { - /* - * This spi node can be either SPIM or SPIS, - * for the user to pick: - * compatible = "nordic,nrf-spim" or - * "nordic,nrf-spis". - */ - compatible = "nordic,nrf-spim"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0xc7000 0x1000>; - interrupts = <199 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - easydma-maxcnt-bits = <16>; - rx-delay-supported; - rx-delay = <1>; - status = "disabled"; - }; - - uart21: uart@c7000 { - compatible = "nordic,nrf-uarte"; - reg = <0xc7000 0x1000>; - interrupts = <199 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - endtx-stoptx-supported; - frame-timeout-supported; - }; - - i2c22: i2c@c8000 { - compatible = "nordic,nrf-twim"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0xc8000 0x1000>; - interrupts = <200 NRF_DEFAULT_IRQ_PRIORITY>; - easydma-maxcnt-bits = <16>; - status = "disabled"; - zephyr,pm-device-runtime-auto; - }; - - spi22: spi@c8000 { - /* - * This spi node can be either SPIM or SPIS, - * for the user to pick: - * compatible = "nordic,nrf-spim" or - * "nordic,nrf-spis". - */ - compatible = "nordic,nrf-spim"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0xc8000 0x1000>; - interrupts = <200 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - easydma-maxcnt-bits = <16>; - rx-delay-supported; - rx-delay = <1>; - status = "disabled"; - }; - - uart22: uart@c8000 { - compatible = "nordic,nrf-uarte"; - reg = <0xc8000 0x1000>; - interrupts = <200 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - endtx-stoptx-supported; - frame-timeout-supported; - }; - - egu20: egu@c9000 { - compatible = "nordic,nrf-egu"; - reg = <0xc9000 0x1000>; - interrupts = <201 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - }; - - timer20: timer@ca000 { - compatible = "nordic,nrf-timer"; - status = "disabled"; - reg = <0xca000 0x1000>; - cc-num = <6>; - max-bit-width = <32>; - interrupts = <202 NRF_DEFAULT_IRQ_PRIORITY>; - prescaler = <0>; - }; - - timer21: timer@cb000 { - compatible = "nordic,nrf-timer"; - status = "disabled"; - reg = <0xcb000 0x1000>; - cc-num = <6>; - max-bit-width = <32>; - interrupts = <203 NRF_DEFAULT_IRQ_PRIORITY>; - prescaler = <0>; - }; - - timer22: timer@cc000 { - compatible = "nordic,nrf-timer"; - status = "disabled"; - reg = <0xcc000 0x1000>; - cc-num = <6>; - max-bit-width = <32>; - interrupts = <204 NRF_DEFAULT_IRQ_PRIORITY>; - prescaler = <0>; - }; - - timer23: timer@cd000 { - compatible = "nordic,nrf-timer"; - status = "disabled"; - reg = <0xcd000 0x1000>; - cc-num = <6>; - max-bit-width = <32>; - interrupts = <205 NRF_DEFAULT_IRQ_PRIORITY>; - prescaler = <0>; - }; - - timer24: timer@ce000 { - compatible = "nordic,nrf-timer"; - status = "disabled"; - reg = <0xce000 0x1000>; - cc-num = <6>; - max-bit-width = <32>; - interrupts = <206 NRF_DEFAULT_IRQ_PRIORITY>; - prescaler = <0>; - }; - - pdm20: pdm@d0000 { - compatible = "nordic,nrf-pdm"; - status = "disabled"; - reg = <0xd0000 0x1000>; - interrupts = <208 NRF_DEFAULT_IRQ_PRIORITY>; - }; - - pdm21: pdm@d1000 { - compatible = "nordic,nrf-pdm"; - status = "disabled"; - reg = <0xd1000 0x1000>; - interrupts = <209 NRF_DEFAULT_IRQ_PRIORITY>; - }; - - pwm20: pwm@d2000 { - compatible = "nordic,nrf-pwm"; - status = "disabled"; - reg = <0xd2000 0x1000>; - interrupts = <210 NRF_DEFAULT_IRQ_PRIORITY>; - #pwm-cells = <3>; - }; - - pwm21: pwm@d3000 { - compatible = "nordic,nrf-pwm"; - status = "disabled"; - reg = <0xd3000 0x1000>; - interrupts = <211 NRF_DEFAULT_IRQ_PRIORITY>; - #pwm-cells = <3>; - }; - - pwm22: pwm@d4000 { - compatible = "nordic,nrf-pwm"; - status = "disabled"; - reg = <0xd4000 0x1000>; - interrupts = <212 NRF_DEFAULT_IRQ_PRIORITY>; - #pwm-cells = <3>; - }; - - adc: adc@d5000 { - compatible = "nordic,nrf-saadc"; - reg = <0xd5000 0x1000>; - interrupts = <213 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - #io-channel-cells = <1>; - zephyr,pm-device-runtime-auto; - }; - - nfct: nfct@d6000 { - compatible = "nordic,nrf-nfct"; - reg = <0xd6000 0x1000>; - interrupts = <214 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - }; - - temp: temp@d7000 { - compatible = "nordic,nrf-temp"; - reg = <0xd7000 0x1000>; - interrupts = <215 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - }; - - gpio1: gpio@d8200 { - compatible = "nordic,nrf-gpio"; - gpio-controller; - reg = <0xd8200 0x300>; - #gpio-cells = <2>; - ngpios = <32>; - status = "disabled"; - port = <1>; - gpiote-instance = <&gpiote20>; - }; - - gpio3: gpio@d8600 { - compatible = "nordic,nrf-gpio"; - gpio-controller; - reg = <0xd8600 0x300>; - #gpio-cells = <2>; - ngpios = <13>; - status = "disabled"; - port = <3>; - gpiote-instance = <&gpiote20>; - }; - - gpiote20: gpiote@da000 { - compatible = "nordic,nrf-gpiote"; - reg = <0xda000 0x1000>; - status = "disabled"; - instance = <20>; - }; - - qdec20: qdec@e0000 { - compatible = "nordic,nrf-qdec"; - reg = <0xe0000 0x1000>; - interrupts = <224 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - }; - - qdec21: qdec@e1000 { - compatible = "nordic,nrf-qdec"; - reg = <0xe1000 0x1000>; - interrupts = <225 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - }; - - grtc: grtc@e2000 { - compatible = "nordic,nrf-grtc"; - reg = <0xe2000 0x1000>; - cc-num = <12>; - clocks = <&lfxo>, <&pclk>; - clock-names = "lfclock", "hfclock"; - status = "disabled"; - }; - - tdm: tdm@e8000 { - compatible = "nordic,nrf-tdm"; - easydma-maxcnt-bits = <15>; - #address-cells = <1>; - #size-cells = <0>; - reg = <0xe8000 0x1000>; - interrupts = <232 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - clocks = <&pclk32m>; - nordic,clockpin-enable = , - ; - }; - - i2c23: i2c@ed000 { - compatible = "nordic,nrf-twim"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0xed000 0x1000>; - interrupts = <237 NRF_DEFAULT_IRQ_PRIORITY>; - easydma-maxcnt-bits = <16>; - status = "disabled"; - zephyr,pm-device-runtime-auto; - }; - - spi23: spi@ed000 { - /* - * This spi node can be either SPIM or SPIS, - * for the user to pick: - * compatible = "nordic,nrf-spim" or - * "nordic,nrf-spis". - */ - compatible = "nordic,nrf-spim"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0xed000 0x1000>; - interrupts = <237 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - easydma-maxcnt-bits = <16>; - rx-delay-supported; - rx-delay = <1>; - status = "disabled"; - }; - - uart23: uart@ed000 { - compatible = "nordic,nrf-uarte"; - reg = <0xed000 0x1000>; - interrupts = <237 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - endtx-stoptx-supported; - frame-timeout-supported; - }; - - i2c24: i2c@ee000 { - compatible = "nordic,nrf-twim"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0xee000 0x1000>; - interrupts = <238 NRF_DEFAULT_IRQ_PRIORITY>; - easydma-maxcnt-bits = <16>; - status = "disabled"; - zephyr,pm-device-runtime-auto; - }; - - spi24: spi@ee000 { - /* - * This spi node can be either SPIM or SPIS, - * for the user to pick: - * compatible = "nordic,nrf-spim" or - * "nordic,nrf-spis". - */ - compatible = "nordic,nrf-spim"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0xee000 0x1000>; - interrupts = <238 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - easydma-maxcnt-bits = <16>; - rx-delay-supported; - rx-delay = <1>; - status = "disabled"; - }; - - uart24: uart@ee000 { - compatible = "nordic,nrf-uarte"; - reg = <0xee000 0x1000>; - interrupts = <238 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - endtx-stoptx-supported; - frame-timeout-supported; - }; - - dppic30: dppic@102000 { - compatible = "nordic,nrf-dppic"; - reg = <0x102000 0x808>; - status = "disabled"; - }; - - ppib30: ppib@103000 { - compatible = "nordic,nrf-ppib"; - reg = <0x103000 0x1000>; - status = "disabled"; - }; - - i2c30: i2c@104000 { - compatible = "nordic,nrf-twim"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0x104000 0x1000>; - interrupts = <260 NRF_DEFAULT_IRQ_PRIORITY>; - easydma-maxcnt-bits = <16>; - status = "disabled"; - zephyr,pm-device-runtime-auto; - }; - - spi30: spi@104000 { - /* - * This spi node can be either SPIM or SPIS, - * for the user to pick: - * compatible = "nordic,nrf-spim" or - * "nordic,nrf-spis". - */ - compatible = "nordic,nrf-spim"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0x104000 0x1000>; - interrupts = <260 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - easydma-maxcnt-bits = <16>; - rx-delay-supported; - rx-delay = <1>; - status = "disabled"; - }; - - uart30: uart@104000 { - compatible = "nordic,nrf-uarte"; - reg = <0x104000 0x1000>; - interrupts = <260 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - endtx-stoptx-supported; - frame-timeout-supported; - }; - - comp: comparator@106000 { - /* - * Use compatible "nordic,nrf-comp" to configure as COMP - * Use compatible "nordic,nrf-lpcomp" to configure as LPCOMP - */ - compatible = "nordic,nrf-comp"; - reg = <0x106000 0x1000>; - status = "disabled"; - interrupts = <262 NRF_DEFAULT_IRQ_PRIORITY>; - }; - - wdt30: watchdog@108000 { - compatible = "nordic,nrf-wdt"; - reg = <0x108000 0x620>; - interrupts = <264 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - }; - - wdt31: watchdog@109000 { - compatible = "nordic,nrf-wdt"; - reg = <0x109000 0x620>; - interrupts = <265 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - }; - - gpio0: gpio@10a000 { - compatible = "nordic,nrf-gpio"; - gpio-controller; - reg = <0x10a000 0x300>; - #gpio-cells = <2>; - ngpios = <10>; - status = "disabled"; - port = <0>; - gpiote-instance = <&gpiote30>; - }; - - gpiote30: gpiote@10c000 { - compatible = "nordic,nrf-gpiote"; - reg = <0x10c000 0x1000>; - status = "disabled"; - instance = <30>; - }; - - clock: clock@10e000 { - compatible = "nordic,nrf-clock"; - reg = <0x10e000 0x1000>; - interrupts = <270 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - }; - - power: power@10e000 { - compatible = "nordic,nrf-power"; - reg = <0x10e000 0x1000>; - ranges = <0x0 0x10e000 0x1000>; - interrupts = <270 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - #address-cells = <1>; - #size-cells = <1>; - - gpregret1: gpregret1@51c { - #address-cells = <1>; - #size-cells = <1>; - compatible = "nordic,nrf-gpregret"; - reg = <0x51c 0x1>; - status = "disabled"; - }; - - gpregret2: gpregret2@520 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "nordic,nrf-gpregret"; - reg = <0x520 0x1>; - status = "disabled"; - }; - }; - - regulators: regulator@120000 { - compatible = "nordic,nrf54l-regulators"; - reg = <0x120000 0x1000>; - status = "disabled"; - #address-cells = <1>; - #size-cells = <1>; - - vregmain: regulator@120600 { - compatible = "nordic,nrf5x-regulator"; - reg = <0x120600 0x1>; - status = "disabled"; - regulator-name = "VREGMAIN"; - regulator-initial-mode = ; - }; - }; - }; - - rram_controller: rram-controller@5004e000 { - compatible = "nordic,rram-controller"; - reg = <0x5004e000 0x1000>; - interrupts = <78 NRF_DEFAULT_IRQ_PRIORITY>; - #address-cells = <1>; - #size-cells = <1>; - - cpuapp_rram: rram@0 { - compatible = "soc-nv-flash"; - reg = <0x0 DT_SIZE_K(2036)>; - erase-block-size = <4096>; - write-block-size = <16>; - }; - - cpuflpr_rram: rram@1e5000 { - compatible = "soc-nv-flash"; - reg = <0x1e5000 DT_SIZE_K(96)>; - erase-block-size = <4096>; - write-block-size = <16>; - }; - }; - - cpuapp_ppb: cpuapp-ppb-bus { - #address-cells = <1>; - #size-cells = <1>; - - cpuapp_nvic: interrupt-controller@e000e100 { - #address-cells = <1>; - compatible = "arm,v8m-nvic"; - reg = <0xe000e100 0xc00>; - arm,num-irq-priority-bits = <3>; - interrupt-controller; - #interrupt-cells = <2>; - }; - - cpuapp_systick: timer@e000e010 { - compatible = "arm,armv8m-systick"; - reg = <0xe000e010 0x10>; - status = "disabled"; - }; - }; - }; -}; diff --git a/modules/hal_nordic/nrfx/CMakeLists.txt b/modules/hal_nordic/nrfx/CMakeLists.txt index 1d18d708d747..5d7b4d942b3b 100644 --- a/modules/hal_nordic/nrfx/CMakeLists.txt +++ b/modules/hal_nordic/nrfx/CMakeLists.txt @@ -63,9 +63,6 @@ zephyr_compile_definitions_ifdef(CONFIG_SOC_COMPATIBLE_NRF54L15_CPUAPP NRF_APPLI zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54L20_ENGA NRF54LM20A_ENGA_XXAA) zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54L20_ENGA_CPUAPP NRF_APPLICATION) zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54L20_ENGA_CPUFLPR NRF_FLPR) -zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54LM20A_ENGA NRF54LM20A_ENGA_XXAA) -zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54LM20A_ENGA_CPUAPP NRF_APPLICATION) -zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54LM20A_ENGA_CPUFLPR NRF_FLPR) zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF9120 NRF9120_XXAA) zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF9160 NRF9160_XXAA) @@ -204,7 +201,7 @@ zephyr_compile_definitions_ifndef(CONFIG_SOC_NRF54L_ANOMALY_56_WORKAROUND NRF54L # Inject code to skip TAMPC setup for nRF54L20 and nRF54L09. It is not supported for now. # It needs to be removed when support is provided. -if(CONFIG_SOC_NRF54L20_ENGA_CPUAPP OR CONFIG_SOC_NRF54LM20A_ENGA_CPUAPP OR CONFIG_SOC_NRF54L09_ENGA_CPUAPP) +if(CONFIG_SOC_NRF54L20_ENGA_CPUAPP OR CONFIG_SOC_NRF54L09_ENGA_CPUAPP) zephyr_compile_definitions(NRF_SKIP_TAMPC_SETUP) endif() @@ -250,8 +247,6 @@ mdk_svd_ifdef(CONFIG_SOC_NRF54L15_CPUAPP nrf54l15_application.svd) mdk_svd_ifdef(CONFIG_SOC_NRF54L15_CPUFLPR nrf54l15_flpr.svd) mdk_svd_ifdef(CONFIG_SOC_NRF54L20_ENGA_CPUAPP nrf54lm20a_enga_application.svd) mdk_svd_ifdef(CONFIG_SOC_NRF54L20_ENGA_CPUFLPR nrf54lm20a_enga_flpr.svd) -mdk_svd_ifdef(CONFIG_SOC_NRF54LM20A_ENGA_CPUAPP nrf54lm20a_enga_application.svd) -mdk_svd_ifdef(CONFIG_SOC_NRF54LM20A_ENGA_CPUFLPR nrf54lm20a_enga_flpr.svd) mdk_svd_ifdef(CONFIG_SOC_NRF9120 nrf9120.svd) mdk_svd_ifdef(CONFIG_SOC_NRF9160 nrf9160.svd) mdk_svd_ifdef(CONFIG_SOC_NRF9230_ENGB_CPUAPP nrf9230_engb_application.svd) diff --git a/snippets/nordic-flpr/snippet.yml b/snippets/nordic-flpr/snippet.yml index d35c45810846..e6f6a41e252d 100644 --- a/snippets/nordic-flpr/snippet.yml +++ b/snippets/nordic-flpr/snippet.yml @@ -15,6 +15,3 @@ boards: /.*/nrf54l20/cpuapp/: append: EXTRA_DTC_OVERLAY_FILE: soc/nrf54l20_cpuapp.overlay - /.*/nrf54lm20a/cpuapp/: - append: - EXTRA_DTC_OVERLAY_FILE: soc/nrf54lm20a_cpuapp.overlay diff --git a/snippets/nordic-flpr/soc/nrf54lm20a_cpuapp.overlay b/snippets/nordic-flpr/soc/nrf54lm20a_cpuapp.overlay deleted file mode 100644 index 1d36ba5ac488..000000000000 --- a/snippets/nordic-flpr/soc/nrf54lm20a_cpuapp.overlay +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - soc { - reserved-memory { - #address-cells = <1>; - #size-cells = <1>; - - cpuflpr_code_partition: image@1ed000 { - /* FLPR core code partition */ - reg = <0x1ed000 DT_SIZE_K(64)>; - }; - }; - - cpuflpr_sram_code_data: memory@2006fc00 { - compatible = "mmio-sram"; - reg = <0x2006fc00 DT_SIZE_K(64)>; - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x2006fc00 0x10000>; - }; - }; -}; - -&uart30 { - status = "reserved"; -}; - -&cpuflpr_vpr { - execution-memory = <&cpuflpr_sram_code_data>; - source-memory = <&cpuflpr_code_partition>; -}; - -&cpuapp_vevif_tx { - status = "okay"; -}; diff --git a/soc/nordic/nrf54l/Kconfig b/soc/nordic/nrf54l/Kconfig index 2d968a57bbe5..19131154b5bb 100644 --- a/soc/nordic/nrf54l/Kconfig +++ b/soc/nordic/nrf54l/Kconfig @@ -38,9 +38,6 @@ config SOC_NRF54L15_CPUAPP config SOC_NRF54L20_ENGA_CPUAPP select SOC_NRF54L_CPUAPP_COMMON -config SOC_NRF54LM20A_ENGA_CPUAPP - select SOC_NRF54L_CPUAPP_COMMON - config SOC_NRF54L05_CPUFLPR select RISCV_CORE_NORDIC_VPR @@ -56,9 +53,6 @@ config SOC_NRF54L15_CPUFLPR config SOC_NRF54L20_ENGA_CPUFLPR select RISCV_CORE_NORDIC_VPR -config SOC_NRF54LM20A_ENGA_CPUFLPR - select RISCV_CORE_NORDIC_VPR - if SOC_SERIES_NRF54LX config SOC_NRF54LX_SKIP_CLOCK_CONFIG diff --git a/soc/nordic/nrf54l/Kconfig.defconfig.nrf54lm20a_enga_cpuapp b/soc/nordic/nrf54l/Kconfig.defconfig.nrf54lm20a_enga_cpuapp deleted file mode 100644 index c6c083bd7e63..000000000000 --- a/soc/nordic/nrf54l/Kconfig.defconfig.nrf54lm20a_enga_cpuapp +++ /dev/null @@ -1,15 +0,0 @@ -# Nordic Semiconductor nRF54LM20A MCU - -# Copyright (c) 2025 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - - -if SOC_NRF54LM20A_ENGA_CPUAPP - -config NUM_IRQS - default 290 - -config UART_NRFX_UARTE_SPURIOUS_RXTO_WORKAROUND - default y - -endif # SOC_NRF54LM20A_ENGA_CPUAPP diff --git a/soc/nordic/nrf54l/Kconfig.defconfig.nrf54lm20a_enga_cpuflpr b/soc/nordic/nrf54l/Kconfig.defconfig.nrf54lm20a_enga_cpuflpr deleted file mode 100644 index b8065044a5f5..000000000000 --- a/soc/nordic/nrf54l/Kconfig.defconfig.nrf54lm20a_enga_cpuflpr +++ /dev/null @@ -1,11 +0,0 @@ -# Nordic Semiconductor nRF54LM20A MCU - -# Copyright (c) 2025 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -if SOC_NRF54LM20A_ENGA_CPUFLPR - -config NUM_IRQS - default 287 - -endif # SOC_NRF54LM20A_ENGA_CPUFLPR diff --git a/soc/nordic/nrf54l/Kconfig.soc b/soc/nordic/nrf54l/Kconfig.soc index c7ddfc8bb393..5fd8260b9bbb 100644 --- a/soc/nordic/nrf54l/Kconfig.soc +++ b/soc/nordic/nrf54l/Kconfig.soc @@ -105,34 +105,9 @@ config SOC_NRF54L20_ENGA_CPUFLPR help NRF54L20 ENGA CPUFLPR -config SOC_NRF54LM20A - bool - select SOC_SERIES_NRF54LX - help - NRF54LM20A - -config SOC_NRF54LM20A_ENGA - bool - select SOC_NRF54LM20A - help - NRF54LM20A ENGA - -config SOC_NRF54LM20A_ENGA_CPUAPP - bool - select SOC_NRF54LM20A_ENGA - help - NRF54LM20A ENGA CPUAPP - -config SOC_NRF54LM20A_ENGA_CPUFLPR - bool - select SOC_NRF54LM20A_ENGA - help - NRF54LM20A ENGA CPUFLPR - config SOC default "nrf54l05" if SOC_NRF54L05 default "nrf54l09" if SOC_NRF54L09 default "nrf54l10" if SOC_NRF54L10 default "nrf54l15" if SOC_NRF54L15 default "nrf54l20" if SOC_NRF54L20 - default "nrf54lm20a" if SOC_NRF54LM20A diff --git a/soc/nordic/nrf54l/Kconfig.sysbuild b/soc/nordic/nrf54l/Kconfig.sysbuild index 1517f62bb389..7ad3f9b4f9ee 100644 --- a/soc/nordic/nrf54l/Kconfig.sysbuild +++ b/soc/nordic/nrf54l/Kconfig.sysbuild @@ -1,7 +1,7 @@ # Copyright (c) 2025 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -if SOC_NRF54L09_ENGA_CPUFLPR || SOC_NRF54L15_CPUFLPR || SOC_NRF54L20_ENGA_CPUFLPR || SOC_NRF54LM20A_ENGA_CPUFLPR +if SOC_NRF54L09_ENGA_CPUFLPR || SOC_NRF54L15_CPUFLPR || SOC_NRF54L20_ENGA_CPUFLPR config HAS_NORDIC_VPR_LAUNCHER_IMAGE default y diff --git a/soc/nordic/soc.yml b/soc/nordic/soc.yml index 97e5a0d5a633..923403f05303 100644 --- a/soc/nordic/soc.yml +++ b/soc/nordic/soc.yml @@ -41,10 +41,6 @@ family: cpuclusters: - name: cpuapp - name: cpuflpr - - name: nrf54lm20a - cpuclusters: - - name: cpuapp - - name: cpuflpr - name: nrf54h socs: - name: nrf54h20 @@ -128,9 +124,6 @@ runners: - qualifiers: - nrf54l20/cpuapp - nrf54l20/cpuflpr - - qualifiers: - - nrf54lm20a/cpuapp - - nrf54lm20a/cpuflpr - qualifiers: - nrf54h20/cpuapp - nrf54h20/cpurad @@ -197,9 +190,6 @@ runners: - qualifiers: - nrf54l20/cpuapp - nrf54l20/cpuflpr - - qualifiers: - - nrf54lm20a/cpuapp - - nrf54lm20a/cpuflpr - qualifiers: - nrf54h20/cpuapp - nrf54h20/cpurad @@ -266,9 +256,6 @@ runners: - qualifiers: - nrf54l20/cpuapp - nrf54l20/cpuflpr - - qualifiers: - - nrf54lm20a/cpuapp - - nrf54lm20a/cpuflpr - qualifiers: - nrf54h20/cpuapp - nrf54h20/cpurad From 03f2b16b0be4cc51c52e6f1ce7f81482bd8c53e7 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:05 +0300 Subject: [PATCH 1456/2141] Revert "[nrf fromlist] sysbuild: cmake: kconfig: Fix missing sysbuild Kconfig paths" This reverts commit fc8b05e81ad1cd5ad4c62ead0d4ed96d034913f4. Signed-off-by: Jukka Rissanen --- share/sysbuild/cmake/modules/sysbuild_kconfig.cmake | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/share/sysbuild/cmake/modules/sysbuild_kconfig.cmake b/share/sysbuild/cmake/modules/sysbuild_kconfig.cmake index f0e4c29fcadc..f366c66dbde0 100644 --- a/share/sysbuild/cmake/modules/sysbuild_kconfig.cmake +++ b/share/sysbuild/cmake/modules/sysbuild_kconfig.cmake @@ -102,17 +102,6 @@ set(shield_conf_files) list(APPEND ZEPHYR_KCONFIG_MODULES_DIR BOARD=${BOARD}) set(KCONFIG_NAMESPACE SB_CONFIG) -foreach(module_name ${ZEPHYR_MODULE_NAMES}) - zephyr_string(SANITIZE TOUPPER MODULE_NAME_UPPER ${module_name}) - - if(SYSBUILD_${MODULE_NAME_UPPER}_KCONFIG) - list(APPEND - ZEPHYR_KCONFIG_MODULES_DIR - "SYSBUILD_${MODULE_NAME_UPPER}_KCONFIG=${SYSBUILD_${MODULE_NAME_UPPER}_KCONFIG}" - ) - endif() -endforeach() - if(EXISTS ${APP_DIR}/Kconfig.sysbuild) set(KCONFIG_ROOT ${APP_DIR}/Kconfig.sysbuild) endif() From ef1a8338bb7e639886773f41351bb3840e3d3ead Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:05 +0300 Subject: [PATCH 1457/2141] Revert "[nrf fromtree] twister: Enable gathering footprint if test plan exists" This reverts commit 4d4633050d9de0724b4a9c9b1136f2133d2777ed. Signed-off-by: Jukka Rissanen --- scripts/pylib/twister/twisterlib/runner.py | 1 + scripts/tests/twister/test_runner.py | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/pylib/twister/twisterlib/runner.py b/scripts/pylib/twister/twisterlib/runner.py index 9d050ca30a88..5b1a782eca9c 100644 --- a/scripts/pylib/twister/twisterlib/runner.py +++ b/scripts/pylib/twister/twisterlib/runner.py @@ -1895,6 +1895,7 @@ def run(self): except queue.Empty: break else: + inst.metrics.update(self.instances[inst.name].metrics) inst.metrics["handler_time"] = inst.execution_time self.instances[inst.name] = inst diff --git a/scripts/tests/twister/test_runner.py b/scripts/tests/twister/test_runner.py index e689095fc7c1..0e6227acefeb 100644 --- a/scripts/tests/twister/test_runner.py +++ b/scripts/tests/twister/test_runner.py @@ -2530,7 +2530,7 @@ def mock_client_from_environ(jobs): pipeline_q = queue.LifoQueue() done_q = queue.LifoQueue() done_instance = mock.Mock( - metrics={'k': 'v2'}, + metrics={'k2': 'v2'}, execution_time=30 ) done_instance.name='dummy instance' @@ -2568,7 +2568,8 @@ def iteration_increment(value=1, decrement=False): assert tr.jobserver.name == expected_jobserver assert tr.instances['dummy instance'].metrics == { - 'k': 'v2', + 'k': 'v', + 'k2': 'v2', 'handler_time': 30 } From f3f800366e9dabb691103f75a6ee53153c7ec3dc Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:05 +0300 Subject: [PATCH 1458/2141] Revert "[nrf fromtree] cmake: Add a new no_deprecation_warning compiler flag" This reverts commit 62f83d9365def0fd199599358889034765cce051. Signed-off-by: Jukka Rissanen --- CMakeLists.txt | 8 +------- Kconfig.zephyr | 1 + cmake/compiler/compiler_flags_template.cmake | 3 --- cmake/compiler/gcc/compiler_flags.cmake | 4 ---- include/zephyr/toolchain/gcc.h | 4 +--- include/zephyr/toolchain/iar/iccarm.h | 6 +----- tests/kernel/pipe/deprecated/pipe/CMakeLists.txt | 1 + tests/kernel/workq/work/src/main.c | 5 +++++ tests/kernel/workq/work_queue/src/main.c | 5 +++++ 9 files changed, 15 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3157813d65c9..0effc0c381cd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -159,19 +159,13 @@ zephyr_compile_options($<$:$:$>) # Extra warnings options for twister run -if(CONFIG_COMPILER_WARNINGS_AS_ERRORS) +if (CONFIG_COMPILER_WARNINGS_AS_ERRORS) zephyr_compile_options($<$:$>) zephyr_compile_options($<$:$>) zephyr_compile_options($<$:$>) zephyr_link_libraries($) endif() -if(CONFIG_DEPRECATION_TEST) - zephyr_compile_options($<$:$>) - zephyr_compile_options($<$:$>) - zephyr_compile_options($<$:$>) -endif() - # @Intent: Set compiler flags to enable buffer overflow checks in libc functions # @details: # Kconfig.zephyr "Detect buffer overflows in libc calls" is a kconfig choice, diff --git a/Kconfig.zephyr b/Kconfig.zephyr index 9baae3922090..070b4231eee8 100644 --- a/Kconfig.zephyr +++ b/Kconfig.zephyr @@ -542,6 +542,7 @@ config LTO config COMPILER_WARNINGS_AS_ERRORS bool "Treat warnings as errors" + depends on !DEPRECATION_TEST help Turn on "warning as error" toolchain flags diff --git a/cmake/compiler/compiler_flags_template.cmake b/cmake/compiler/compiler_flags_template.cmake index 6050c46d3854..34acddfa3624 100644 --- a/cmake/compiler/compiler_flags_template.cmake +++ b/cmake/compiler/compiler_flags_template.cmake @@ -76,9 +76,6 @@ set_compiler_property(PROPERTY no_strict_aliasing) set_property(TARGET compiler PROPERTY warnings_as_errors) set_property(TARGET asm PROPERTY warnings_as_errors) -set_property(TARGET compiler PROPERTY no_deprecation_warning) -set_property(TARGET asm PROPERTY no_deprecation_warning) - # Flag for disabling exceptions in C++ set_property(TARGET compiler-cpp PROPERTY no_exceptions) diff --git a/cmake/compiler/gcc/compiler_flags.cmake b/cmake/compiler/gcc/compiler_flags.cmake index c3b8c113d42d..9d4989fea47e 100644 --- a/cmake/compiler/gcc/compiler_flags.cmake +++ b/cmake/compiler/gcc/compiler_flags.cmake @@ -153,10 +153,6 @@ set_compiler_property(PROPERTY no_strict_aliasing -fno-strict-aliasing) set_property(TARGET compiler PROPERTY warnings_as_errors -Werror) set_property(TARGET asm PROPERTY warnings_as_errors -Werror -Wa,--fatal-warnings) -# Deprecation warning -set_property(TARGET compiler PROPERTY no_deprecation_warning -Wno-deprecated-declarations) -set_property(TARGET asm PROPERTY no_deprecation_warning -Wno-deprecated-declarations) - # Disable exceptions flag in C++ set_property(TARGET compiler-cpp PROPERTY no_exceptions "-fno-exceptions") diff --git a/include/zephyr/toolchain/gcc.h b/include/zephyr/toolchain/gcc.h index 4d3d85858d3d..58aa13e0a3ef 100644 --- a/include/zephyr/toolchain/gcc.h +++ b/include/zephyr/toolchain/gcc.h @@ -334,13 +334,11 @@ do { \ #define __WARN1(s) _Pragma(#s) /* Generic message */ -#ifndef CONFIG_DEPRECATION_TEST +#ifndef __DEPRECATED_MACRO #define __DEPRECATED_MACRO __WARN("Macro is deprecated") /* When adding this, remember to follow the instructions in * https://docs.zephyrproject.org/latest/develop/api/api_lifecycle.html#deprecated */ -#else -#define __DEPRECATED_MACRO #endif /* These macros allow having ARM asm functions callable from thumb */ diff --git a/include/zephyr/toolchain/iar/iccarm.h b/include/zephyr/toolchain/iar/iccarm.h index e6a3cb96d3b2..746554d2e129 100644 --- a/include/zephyr/toolchain/iar/iccarm.h +++ b/include/zephyr/toolchain/iar/iccarm.h @@ -243,14 +243,10 @@ do { \ #define __WARN1(s) __PRAGMA(message = #s) /* Generic message */ -#ifndef CONFIG_DEPRECATION_TEST +#ifndef __DEPRECATED_MACRO #define __DEPRECATED_MACRO __WARN("Macro is deprecated") -#else -#define __DEPRECATED_MACRO #endif - - /* These macros allow having ARM asm functions callable from thumb */ #if defined(_ASMLANGUAGE) diff --git a/tests/kernel/pipe/deprecated/pipe/CMakeLists.txt b/tests/kernel/pipe/deprecated/pipe/CMakeLists.txt index ac8bc4dee462..2624f4be400f 100644 --- a/tests/kernel/pipe/deprecated/pipe/CMakeLists.txt +++ b/tests/kernel/pipe/deprecated/pipe/CMakeLists.txt @@ -1,6 +1,7 @@ # SPDX-License-Identifier: Apache-2.0 cmake_minimum_required(VERSION 3.20.0) +set(CMAKE_C_FLAGS "-D__deprecated=\"/* deprecated */\" -D__DEPRECATED_MACRO=\"/* deprecated_macro*/\"") find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) project(pipe) diff --git a/tests/kernel/workq/work/src/main.c b/tests/kernel/workq/work/src/main.c index 11ae39db2a84..ce327cee4052 100644 --- a/tests/kernel/workq/work/src/main.c +++ b/tests/kernel/workq/work/src/main.c @@ -8,6 +8,11 @@ * about the use of that API. */ #include +#undef __deprecated +#define __deprecated +#undef __DEPRECATED_MACRO +#define __DEPRECATED_MACRO + #include #define STACK_SIZE (1024 + CONFIG_TEST_EXTRA_STACK_SIZE) diff --git a/tests/kernel/workq/work_queue/src/main.c b/tests/kernel/workq/work_queue/src/main.c index f97f202bcee9..b14d28787171 100644 --- a/tests/kernel/workq/work_queue/src/main.c +++ b/tests/kernel/workq/work_queue/src/main.c @@ -10,6 +10,11 @@ * about the use of that API. */ #include +#undef __deprecated +#define __deprecated +#undef __DEPRECATED_MACRO +#define __DEPRECATED_MACRO + #include #include #include From 1e0f0f92589650eef20c5d2976b8d2ef05000527 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:05 +0300 Subject: [PATCH 1459/2141] Revert "[nrf fromtree] drivers: clock_control: update nrf2 lfosc_get_accuracy" This reverts commit 010f7c7102ee2e8f6df2748533772e852768fefa. Signed-off-by: Jukka Rissanen --- .../clock_control/clock_control_nrf2_common.c | 37 +++++++++++++++++++ .../clock_control/clock_control_nrf2_common.h | 10 +++++ .../clock_control/clock_control_nrf_lfclk.c | 34 ----------------- 3 files changed, 47 insertions(+), 34 deletions(-) diff --git a/drivers/clock_control/clock_control_nrf2_common.c b/drivers/clock_control/clock_control_nrf2_common.c index c2657f454782..f070d5d7b698 100644 --- a/drivers/clock_control/clock_control_nrf2_common.c +++ b/drivers/clock_control/clock_control_nrf2_common.c @@ -5,6 +5,7 @@ #include "clock_control_nrf2_common.h" #include +#include #include LOG_MODULE_REGISTER(clock_control_nrf2, CONFIG_CLOCK_CONTROL_LOG_LEVEL); @@ -19,6 +20,8 @@ LOG_MODULE_REGISTER(clock_control_nrf2, CONFIG_CLOCK_CONTROL_LOG_LEVEL); (idx * sizeof(array[0])) - \ offsetof(type, array[0])) +#define BICR (NRF_BICR_Type *)DT_REG_ADDR(DT_NODELABEL(bicr)) + /* * Definition of `struct clock_config_generic`. * Used to access `clock_config_*` structures in a common way. @@ -89,6 +92,40 @@ static inline uint8_t get_index_of_highest_bit(uint32_t value) return value ? (uint8_t)(31 - __builtin_clz(value)) : 0; } +int lfosc_get_accuracy(uint16_t *accuracy) +{ + switch (nrf_bicr_lfosc_accuracy_get(BICR)) { + case NRF_BICR_LFOSC_ACCURACY_500PPM: + *accuracy = 500U; + break; + case NRF_BICR_LFOSC_ACCURACY_250PPM: + *accuracy = 250U; + break; + case NRF_BICR_LFOSC_ACCURACY_150PPM: + *accuracy = 150U; + break; + case NRF_BICR_LFOSC_ACCURACY_100PPM: + *accuracy = 100U; + break; + case NRF_BICR_LFOSC_ACCURACY_75PPM: + *accuracy = 75U; + break; + case NRF_BICR_LFOSC_ACCURACY_50PPM: + *accuracy = 50U; + break; + case NRF_BICR_LFOSC_ACCURACY_30PPM: + *accuracy = 30U; + break; + case NRF_BICR_LFOSC_ACCURACY_20PPM: + *accuracy = 20U; + break; + default: + return -EINVAL; + } + + return 0; +} + int clock_config_init(void *clk_cfg, uint8_t onoff_cnt, k_work_handler_t update_work_handler) { struct clock_config_generic *cfg = clk_cfg; diff --git a/drivers/clock_control/clock_control_nrf2_common.h b/drivers/clock_control/clock_control_nrf2_common.h index 4b1c7fe000e4..7f934fdac5b8 100644 --- a/drivers/clock_control/clock_control_nrf2_common.h +++ b/drivers/clock_control/clock_control_nrf2_common.h @@ -36,6 +36,16 @@ struct clock_onoff { struct clock_onoff onoff[_onoff_cnt]; \ } +/** + * @brief Obtain LFOSC accuracy in ppm. + * + * @param[out] accuracy Accuracy in ppm. + * + * @retval 0 On success + * @retval -EINVAL If accuracy is not configured. + */ +int lfosc_get_accuracy(uint16_t *accuracy); + /** * @brief Initializes a clock configuration structure. * diff --git a/drivers/clock_control/clock_control_nrf_lfclk.c b/drivers/clock_control/clock_control_nrf_lfclk.c index 829416f662cb..fcdb8bd573bc 100644 --- a/drivers/clock_control/clock_control_nrf_lfclk.c +++ b/drivers/clock_control/clock_control_nrf_lfclk.c @@ -69,40 +69,6 @@ struct lfclk_dev_config { uint32_t fixed_frequency; }; -static int lfosc_get_accuracy(uint16_t *accuracy) -{ - switch (nrf_bicr_lfosc_accuracy_get(BICR)) { - case NRF_BICR_LFOSC_ACCURACY_500PPM: - *accuracy = 500U; - break; - case NRF_BICR_LFOSC_ACCURACY_250PPM: - *accuracy = 250U; - break; - case NRF_BICR_LFOSC_ACCURACY_150PPM: - *accuracy = 150U; - break; - case NRF_BICR_LFOSC_ACCURACY_100PPM: - *accuracy = 100U; - break; - case NRF_BICR_LFOSC_ACCURACY_75PPM: - *accuracy = 75U; - break; - case NRF_BICR_LFOSC_ACCURACY_50PPM: - *accuracy = 50U; - break; - case NRF_BICR_LFOSC_ACCURACY_30PPM: - *accuracy = 30U; - break; - case NRF_BICR_LFOSC_ACCURACY_20PPM: - *accuracy = 20U; - break; - default: - return -EINVAL; - } - - return 0; -} - static void clock_evt_handler(nrfs_clock_evt_t const *p_evt, void *context) { struct lfclk_dev_data *dev_data = context; From 98d90aeb3cd5b1f59a9e0133544e2ecca19e7661 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:05 +0300 Subject: [PATCH 1460/2141] Revert "[nrf fromtree] tests: drivers: Update nrf2 clock control tests for nrf2_auxpll driver" This reverts commit b10d266342b77fc4a8e44afff305eaaa6bd3890b. Signed-off-by: Jukka Rissanen --- .../nrf_clock_control/src/main.c | 69 ++----------------- 1 file changed, 5 insertions(+), 64 deletions(-) diff --git a/tests/drivers/clock_control/nrf_clock_control/src/main.c b/tests/drivers/clock_control/nrf_clock_control/src/main.c index 8db19d382003..87778bbaae59 100644 --- a/tests/drivers/clock_control/nrf_clock_control/src/main.c +++ b/tests/drivers/clock_control/nrf_clock_control/src/main.c @@ -9,7 +9,6 @@ #include #include #include -#include struct test_clk_context { const struct device *clk_dev; @@ -17,7 +16,6 @@ struct test_clk_context { size_t clk_specs_size; }; -#if defined(CONFIG_CLOCK_CONTROL_NRF_HSFLL_LOCAL) const struct nrf_clock_spec test_clk_specs_hsfll[] = { { .frequency = MHZ(128), @@ -35,7 +33,6 @@ const struct nrf_clock_spec test_clk_specs_hsfll[] = { .precision = NRF_CLOCK_CONTROL_PRECISION_DEFAULT, }, }; -#endif #if CONFIG_BOARD_NRF54H20DK_NRF54H20_CPUAPP const struct nrf_clock_spec test_clk_specs_fll16m[] = { @@ -102,7 +99,6 @@ static const struct test_clk_context cpurad_hsfll_test_clk_contexts[] = { }; #endif -#if defined(CONFIG_CLOCK_CONTROL_NRF_HSFLL_GLOBAL) const struct nrf_clock_spec test_clk_specs_global_hsfll[] = { { .frequency = MHZ(320), @@ -125,9 +121,7 @@ static const struct test_clk_context global_hsfll_test_clk_contexts[] = { .clk_specs_size = ARRAY_SIZE(test_clk_specs_global_hsfll), }, }; -#endif -#if defined(CONFIG_CLOCK_CONTROL_NRF_LFCLK) const struct nrf_clock_spec test_clk_specs_lfclk[] = { { .frequency = 32768, @@ -153,44 +147,6 @@ static const struct test_clk_context lfclk_test_clk_contexts[] = { .clk_specs_size = ARRAY_SIZE(test_clk_specs_lfclk), }, }; -#endif - -#if defined(CONFIG_CLOCK_CONTROL_NRF_AUXPLL) - -#define AUXPLL_COMPAT nordic_nrf_auxpll -#define AUXPLL_NODE DT_INST(0, AUXPLL_COMPAT) -#define AUXPLL_FREQ DT_PROP(AUXPLL_NODE, nordic_frequency) - -/* Gets selected AUXPLL DIV and selects the expected frequency */ -#if AUXPLL_FREQ == NRF_AUXPLL_FREQUENCY_DIV_MIN -#define AUXPLL_FREQ_OUT 80000000 -#elif AUXPLL_FREQ == NRF_AUXPLL_FREQ_DIV_AUDIO_44K1 -#define AUXPLL_FREQ_OUT 11289591 -#elif AUXPLL_FREQ == NRF_AUXPLL_FREQ_DIV_USB_24M -#define AUXPLL_FREQ_OUT 24000000 -#elif AUXPLL_FREQ == NRF_AUXPLL_FREQ_DIV_AUDIO_48K -#define AUXPLL_FREQ_OUT 12287963 -#else -/*No use case for NRF_AUXPLL_FREQ_DIV_MAX or others yet*/ -#error "Unsupported AUXPLL frequency selection" -#endif - -const struct nrf_clock_spec test_clk_specs_auxpll[] = { - { - .frequency = AUXPLL_FREQ_OUT, - .accuracy = 0, - .precision = NRF_CLOCK_CONTROL_PRECISION_DEFAULT, - }, -}; - -static const struct test_clk_context auxpll_test_clk_contexts[] = { - { - .clk_dev = DEVICE_DT_GET(AUXPLL_NODE), - .clk_specs = test_clk_specs_auxpll, - .clk_specs_size = ARRAY_SIZE(test_clk_specs_auxpll), - }, -}; -#endif static void test_request_release_clock_spec(const struct device *clk_dev, const struct nrf_clock_spec *clk_spec) @@ -310,23 +266,18 @@ ZTEST(nrf2_clock_control, test_cpurad_hsfll_control) } #endif +ZTEST(nrf2_clock_control, test_lfclk_control) +{ + TC_PRINT("LFCLK test\n"); + test_clock_control_request(lfclk_test_clk_contexts, ARRAY_SIZE(lfclk_test_clk_contexts)); +} - -#if defined(CONFIG_CLOCK_CONTROL_NRF_HSFLL_GLOBAL) ZTEST(nrf2_clock_control, test_global_hsfll_control) { TC_PRINT("Global HSFLL test\n"); test_clock_control_request(global_hsfll_test_clk_contexts, ARRAY_SIZE(global_hsfll_test_clk_contexts)); } -#endif - -#if defined(CONFIG_CLOCK_CONTROL_NRF_LFCLK) -ZTEST(nrf2_clock_control, test_lfclk_control) -{ - TC_PRINT("LFCLK test\n"); - test_clock_control_request(lfclk_test_clk_contexts, ARRAY_SIZE(lfclk_test_clk_contexts)); -} ZTEST(nrf2_clock_control, test_safe_request_cancellation) { @@ -352,16 +303,6 @@ ZTEST(nrf2_clock_control, test_safe_request_cancellation) TC_PRINT("Clock control safe cancellation return value: %d\n", ret); zassert_between_inclusive(ret, ONOFF_STATE_ON, ONOFF_STATE_TO_ON); } -#endif - -#if defined(CONFIG_CLOCK_CONTROL_NRF_AUXPLL) -ZTEST(nrf2_clock_control, test_auxpll_control) -{ - TC_PRINT("AUXPLL control test\n"); - test_clock_control_request(auxpll_test_clk_contexts, - ARRAY_SIZE(auxpll_test_clk_contexts)); -} -#endif static void *setup(void) { From 3cdc6865a96f2216f7fe632afe95da92a4041834 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:05 +0300 Subject: [PATCH 1461/2141] Revert "[nrf fromtree] drivers: can: update clock control to use nrf2_auxpll" This reverts commit 23b235915a3bc20407e7a753680107720b636e8d. Signed-off-by: Jukka Rissanen --- drivers/can/can_nrf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/can/can_nrf.c b/drivers/can/can_nrf.c index f8c037835a83..c538291ecb40 100644 --- a/drivers/can/can_nrf.c +++ b/drivers/can/can_nrf.c @@ -171,7 +171,7 @@ static int can_nrf_init(const struct device *dev) return ret; } - ret = nrf_clock_control_request_sync(config->auxpll, NULL, K_FOREVER); + ret = clock_control_on(config->auxpll, NULL); if (ret < 0) { return ret; } From 60bbe2e355ce83f6587bf8aeb104f51cbeefa4a8 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:05 +0300 Subject: [PATCH 1462/2141] Revert "[nrf fromtree] drivers: clock_control: refactor nrf_auxpll driver to nrf2" This reverts commit c1d603e49d8b7cb2ff7927a0de20c59c86d68a43. Signed-off-by: Jukka Rissanen --- drivers/clock_control/CMakeLists.txt | 2 +- drivers/clock_control/Kconfig | 2 + drivers/clock_control/Kconfig.nrf | 6 - drivers/clock_control/Kconfig.nrf_auxpll | 9 + .../clock_control/clock_control_nrf_auxpll.c | 157 ++++-------------- 5 files changed, 45 insertions(+), 131 deletions(-) create mode 100644 drivers/clock_control/Kconfig.nrf_auxpll diff --git a/drivers/clock_control/CMakeLists.txt b/drivers/clock_control/CMakeLists.txt index 0bf5e0075ebf..9acbda0e5dd8 100644 --- a/drivers/clock_control/CMakeLists.txt +++ b/drivers/clock_control/CMakeLists.txt @@ -54,7 +54,6 @@ zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF_FLL16M clock_cont zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF54H_HFXO clock_control_nrf54h_hfxo.c) zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF_HSFLL_LOCAL clock_control_nrf_hsfll_local.c) zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF_LFCLK clock_control_nrf_lfclk.c) -zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF_AUXPLL clock_control_nrf_auxpll.c) zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_BOUFFALOLAB_BL60X clock_control_bl60x.c) if(CONFIG_CLOCK_CONTROL_RENESAS_RZA2M_CPG) @@ -117,4 +116,5 @@ endif() zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_AST10X0 clock_control_ast10x0.c) zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_MAX32 clock_control_max32.c) +zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF_AUXPLL clock_control_nrf_auxpll.c) zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_WCH_RCC clock_control_wch_rcc.c) diff --git a/drivers/clock_control/Kconfig b/drivers/clock_control/Kconfig index 05a2a7fb8fa6..82fa462ee717 100644 --- a/drivers/clock_control/Kconfig +++ b/drivers/clock_control/Kconfig @@ -104,6 +104,8 @@ source "drivers/clock_control/Kconfig.pwm" source "drivers/clock_control/Kconfig.rpi_pico" +source "drivers/clock_control/Kconfig.nrf_auxpll" + source "drivers/clock_control/Kconfig.arm_scmi" source "drivers/clock_control/Kconfig.silabs" diff --git a/drivers/clock_control/Kconfig.nrf b/drivers/clock_control/Kconfig.nrf index a7c1be10a126..bbd4a86f5a9b 100644 --- a/drivers/clock_control/Kconfig.nrf +++ b/drivers/clock_control/Kconfig.nrf @@ -297,9 +297,3 @@ config CLOCK_CONTROL_NRF_LFCLK_CLOCK_TIMEOUT_MS default 1000 endif # CLOCK_CONTROL_NRF_LFCLK - -config CLOCK_CONTROL_NRF_AUXPLL - bool "nRF Auxiliary PLL driver" - default y - depends on DT_HAS_NORDIC_NRF_AUXPLL_ENABLED - select CLOCK_CONTROL_NRF2_COMMON diff --git a/drivers/clock_control/Kconfig.nrf_auxpll b/drivers/clock_control/Kconfig.nrf_auxpll new file mode 100644 index 000000000000..413452c1ac49 --- /dev/null +++ b/drivers/clock_control/Kconfig.nrf_auxpll @@ -0,0 +1,9 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config CLOCK_CONTROL_NRF_AUXPLL + bool "nRF Auxiliary PLL driver" + default y + depends on DT_HAS_NORDIC_NRF_AUXPLL_ENABLED + help + Driver for nRF Auxiliary PLL. diff --git a/drivers/clock_control/clock_control_nrf_auxpll.c b/drivers/clock_control/clock_control_nrf_auxpll.c index d048f4ed1c7e..19dee8c44938 100644 --- a/drivers/clock_control/clock_control_nrf_auxpll.c +++ b/drivers/clock_control/clock_control_nrf_auxpll.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025 Nordic Semiconductor ASA + * Copyright (c) 2024 Nordic Semiconductor ASA * SPDX-License-Identifier: Apache-2.0 */ @@ -9,65 +9,55 @@ #include #include +#include #include -#include +#include +#include #include #include -#include -#include "clock_control_nrf2_common.h" #include - -/* Check dt-bindings match MDK frequency division definitions*/ -BUILD_ASSERT(NRF_AUXPLL_FREQ_DIV_MIN == NRF_AUXPLL_FREQUENCY_DIV_MIN, - "Different AUXPLL_FREQ_DIV_MIN definition in MDK and devicetree binding"); -BUILD_ASSERT(NRF_AUXPLL_FREQ_DIV_AUDIO_44K1 == NRF_AUXPLL_FREQUENCY_AUDIO_44K1, - "Different AUXPLL_FREQ_DIV_AUDIO_44K1 definition in MDK and devicetree binding"); -BUILD_ASSERT(NRF_AUXPLL_FREQ_DIV_USB24M == NRF_AUXPLL_FREQUENCY_USB_24M, - "Different AUXPLL_FREQ_DIV_USB24M definition in MDK and devicetree binding"); -BUILD_ASSERT(NRF_AUXPLL_FREQ_DIV_AUDIO_48K == NRF_AUXPLL_FREQUENCY_AUDIO_48K, - "Different AUXPLL_FREQ_DIV_AUDIO_48K definition in MDK and devicetree binding"); -BUILD_ASSERT(NRF_AUXPLL_FREQ_DIV_MAX == NRF_AUXPLL_FREQUENCY_DIV_MAX, - "Different AUXPLL_FREQ_DIV_MAX definition in MDK and devicetree binding"); - -/* maximum lock time in us, >10x time observed experimentally */ -#define AUXPLL_LOCK_TIME_MAX_US 20000 -/* lock wait step in us*/ -#define AUXPLL_LOCK_WAIT_STEP_US 1000 - -struct dev_data_auxpll { - struct onoff_manager mgr; - onoff_notify_fn notify; - const struct device *dev; -}; +/* maximum lock time in ms, >10x time observed experimentally */ +#define AUXPLL_LOCK_TIME_MAX_MS 20 +/* lock wait step in ms*/ +#define AUXPLL_LOCK_WAIT_STEP_MS 1 struct clock_control_nrf_auxpll_config { NRF_AUXPLL_Type *auxpll; uint32_t ref_clk_hz; uint32_t ficr_ctune; nrf_auxpll_config_t cfg; - nrf_auxpll_freq_div_ratio_t frequency; + uint16_t frequency; nrf_auxpll_ctrl_outsel_t out_div; }; -static int clock_control_nrf_auxpll_on(struct dev_data_auxpll *dev_data) +static int clock_control_nrf_auxpll_on(const struct device *dev, clock_control_subsys_t sys) { - const struct clock_control_nrf_auxpll_config *config = dev_data->dev->config; + const struct clock_control_nrf_auxpll_config *config = dev->config; bool locked; + unsigned int wait = 0U; + + ARG_UNUSED(sys); nrf_auxpll_task_trigger(config->auxpll, NRF_AUXPLL_TASK_START); - NRFX_WAIT_FOR(nrf_auxpll_mode_locked_check(config->auxpll), - AUXPLL_LOCK_TIME_MAX_US / AUXPLL_LOCK_WAIT_STEP_US, - AUXPLL_LOCK_WAIT_STEP_US, locked); + do { + locked = nrf_auxpll_mode_locked_check(config->auxpll); + if (!locked) { + k_msleep(AUXPLL_LOCK_WAIT_STEP_MS); + wait += AUXPLL_LOCK_WAIT_STEP_MS; + } + } while (wait < AUXPLL_LOCK_TIME_MAX_MS && !locked); return locked ? 0 : -ETIMEDOUT; } -static int clock_control_nrf_auxpll_off(struct dev_data_auxpll *dev_data) +static int clock_control_nrf_auxpll_off(const struct device *dev, clock_control_subsys_t sys) { - const struct clock_control_nrf_auxpll_config *config = dev_data->dev->config; + const struct clock_control_nrf_auxpll_config *config = dev->config; + + ARG_UNUSED(sys); nrf_auxpll_task_trigger(config->auxpll, NRF_AUXPLL_TASK_STOP); @@ -77,58 +67,6 @@ static int clock_control_nrf_auxpll_off(struct dev_data_auxpll *dev_data) return 0; } -static void onoff_start_auxpll(struct onoff_manager *mgr, onoff_notify_fn notify) -{ - struct dev_data_auxpll *dev_data = - CONTAINER_OF(mgr, struct dev_data_auxpll, mgr); - - int ret = clock_control_nrf_auxpll_on(dev_data); - - notify(&dev_data->mgr, ret); - -} - -static void onoff_stop_auxpll(struct onoff_manager *mgr, onoff_notify_fn notify) -{ - struct dev_data_auxpll *dev_data = - CONTAINER_OF(mgr, struct dev_data_auxpll, mgr); - - clock_control_nrf_auxpll_off(dev_data); - notify(mgr, 0); -} - -static int api_request_auxpll(const struct device *dev, - const struct nrf_clock_spec *spec, - struct onoff_client *cli) -{ - struct dev_data_auxpll *dev_data = dev->data; - - ARG_UNUSED(spec); - - return onoff_request(&dev_data->mgr, cli); -} - -static int api_release_auxpll(const struct device *dev, - const struct nrf_clock_spec *spec) -{ - struct dev_data_auxpll *dev_data = dev->data; - - ARG_UNUSED(spec); - - return onoff_release(&dev_data->mgr); -} - -static int api_cancel_or_release_auxpll(const struct device *dev, - const struct nrf_clock_spec *spec, - struct onoff_client *cli) -{ - struct dev_data_auxpll *dev_data = dev->data; - - ARG_UNUSED(spec); - - return onoff_cancel_or_release(&dev_data->mgr, cli); -} - static int clock_control_nrf_auxpll_get_rate(const struct device *dev, clock_control_subsys_t sys, uint32_t *rate) { @@ -161,21 +99,16 @@ static enum clock_control_status clock_control_nrf_auxpll_get_status(const struc return CLOCK_CONTROL_STATUS_OFF; } -static const struct onoff_transitions transitions = { - .start = onoff_start_auxpll, - .stop = onoff_stop_auxpll +static DEVICE_API(clock_control, clock_control_nrf_auxpll_api) = { + .on = clock_control_nrf_auxpll_on, + .off = clock_control_nrf_auxpll_off, + .get_rate = clock_control_nrf_auxpll_get_rate, + .get_status = clock_control_nrf_auxpll_get_status, }; static int clock_control_nrf_auxpll_init(const struct device *dev) { - struct dev_data_auxpll *dev_data = dev->data; const struct clock_control_nrf_auxpll_config *config = dev->config; - int rc; - - rc = onoff_manager_init(&dev_data->mgr, &transitions); - if (rc < 0) { - return rc; - } nrf_auxpll_ctrl_frequency_set(config->auxpll, config->frequency); @@ -190,31 +123,7 @@ static int clock_control_nrf_auxpll_init(const struct device *dev) return 0; } -static DEVICE_API(nrf_clock_control, drv_api_auxpll) = { - .std_api = { - .on = api_nosys_on_off, - .off = api_nosys_on_off, - .get_rate = clock_control_nrf_auxpll_get_rate, - .get_status = clock_control_nrf_auxpll_get_status, - }, - .request = api_request_auxpll, - .release = api_release_auxpll, - .cancel_or_release = api_cancel_or_release_auxpll, -}; - #define CLOCK_CONTROL_NRF_AUXPLL_DEFINE(n) \ - BUILD_ASSERT( \ - DT_INST_PROP(n, nordic_frequency) == NRF_AUXPLL_FREQUENCY_DIV_MIN || \ - DT_INST_PROP(n, nordic_frequency) == NRF_AUXPLL_FREQUENCY_AUDIO_44K1 || \ - DT_INST_PROP(n, nordic_frequency) == NRF_AUXPLL_FREQUENCY_USB_24M || \ - DT_INST_PROP(n, nordic_frequency) == NRF_AUXPLL_FREQUENCY_AUDIO_48K || \ - DT_INST_PROP(n, nordic_frequency) == NRF_AUXPLL_FREQUENCY_DIV_MAX, \ - "Invalid nordic,frequency value in DeviceTree for AUXPLL instance " #n); \ - BUILD_ASSERT(DT_INST_PROP(n, nordic_out_div) > 0, \ - "nordic,out_div must be greater than 0 for AUXPLL instance " #n); \ - static struct dev_data_auxpll data_auxpll##n = { \ - .dev = DEVICE_DT_INST_GET(n), \ - }; \ static const struct clock_control_nrf_auxpll_config config##n = { \ .auxpll = (NRF_AUXPLL_Type *)DT_INST_REG_ADDR(n), \ .ref_clk_hz = DT_PROP(DT_INST_CLOCKS_CTLR(n), clock_frequency), \ @@ -231,9 +140,9 @@ static DEVICE_API(nrf_clock_control, drv_api_auxpll) = { .frequency = DT_INST_PROP(n, nordic_frequency), \ .out_div = DT_INST_PROP(n, nordic_out_div), \ }; \ - \ - DEVICE_DT_INST_DEFINE(n, clock_control_nrf_auxpll_init, NULL, &data_auxpll##n, &config##n, \ + \ + DEVICE_DT_INST_DEFINE(n, clock_control_nrf_auxpll_init, NULL, NULL, &config##n, \ PRE_KERNEL_1, CONFIG_CLOCK_CONTROL_INIT_PRIORITY, \ - &drv_api_auxpll); + &clock_control_nrf_auxpll_api); DT_INST_FOREACH_STATUS_OKAY(CLOCK_CONTROL_NRF_AUXPLL_DEFINE) From c2b205fca6dce568ee912ffa36a8c61e36b5c90b Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:05 +0300 Subject: [PATCH 1463/2141] Revert "[nrf fromtree] dts: vendor: nordic: nrf54h20 update canpll to use auxpll binding" This reverts commit d4e4d6377f22b1bd4d89ab971fa9b2ba30b5f05b. Signed-off-by: Jukka Rissanen --- dts/vendor/nordic/nrf54h20.dtsi | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dts/vendor/nordic/nrf54h20.dtsi b/dts/vendor/nordic/nrf54h20.dtsi index f907dd7fa2e3..c12ea5f1ead5 100644 --- a/dts/vendor/nordic/nrf54h20.dtsi +++ b/dts/vendor/nordic/nrf54h20.dtsi @@ -9,7 +9,6 @@ #include #include -#include #include #include #include @@ -563,7 +562,7 @@ clocks = <&hfxo>; #clock-cells = <0>; nordic,ficrs = <&ficr NRF_FICR_TRIM_GLOBAL_CANPLL_TRIM_CTUNE>; - nordic,frequency = ; + nordic,frequency = <0>; nordic,out-div = <2>; nordic,out-drive = <0>; nordic,current-tune = <6>; From 7c71b1108c2e5b85fc71b29481ab5a0326127bb0 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:05 +0300 Subject: [PATCH 1464/2141] Revert "[nrf fromtree] dts: bindings: clock: add nordic,nrf-auxpll" This reverts commit 5b55f2e0efc9766463845ea0c14512eea23b39ea. Signed-off-by: Jukka Rissanen --- dts/bindings/clock/nordic,nrf-auxpll.yaml | 2 +- include/zephyr/dt-bindings/clock/nrf-auxpll.h | 16 ---------------- 2 files changed, 1 insertion(+), 17 deletions(-) delete mode 100644 include/zephyr/dt-bindings/clock/nrf-auxpll.h diff --git a/dts/bindings/clock/nordic,nrf-auxpll.yaml b/dts/bindings/clock/nordic,nrf-auxpll.yaml index 9555995f0b4d..6eec285f39eb 100644 --- a/dts/bindings/clock/nordic,nrf-auxpll.yaml +++ b/dts/bindings/clock/nordic,nrf-auxpll.yaml @@ -43,7 +43,7 @@ properties: required: true description: | Value used to set the fractional PLL divider ratio (can be set between - divider ratios 4 to 5). Valid values shown in dt-bindings/clock/nrf-auxpll.h. + divider ratios 4 to 5). Valid values range from 0 to 65535. nordic,out-div: type: int diff --git a/include/zephyr/dt-bindings/clock/nrf-auxpll.h b/include/zephyr/dt-bindings/clock/nrf-auxpll.h deleted file mode 100644 index a07c96997597..000000000000 --- a/include/zephyr/dt-bindings/clock/nrf-auxpll.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - - -#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_NRF_AUXPLL_H_ -#define ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_NRF_AUXPLL_H_ - -#define NRF_AUXPLL_FREQ_DIV_MIN 0 -#define NRF_AUXPLL_FREQ_DIV_AUDIO_44K1 15309 -#define NRF_AUXPLL_FREQ_DIV_USB24M 32768 -#define NRF_AUXPLL_FREQ_DIV_AUDIO_48K 39845 -#define NRF_AUXPLL_FREQ_DIV_MAX 65535 - -#endif /* #define ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_NRF_AUXPLL_H_ */ From 0010ca670356504344453f070c8b6d86317f3d04 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:05 +0300 Subject: [PATCH 1465/2141] Revert "[nrf fromtree] drivers: clock_control: Introduce bl60x clock driver" This reverts commit f06d47ec54bffb50b5e47ac5f33256926f88c01d. Signed-off-by: Jukka Rissanen --- drivers/clock_control/CMakeLists.txt | 1 - drivers/clock_control/Kconfig | 2 - drivers/clock_control/Kconfig.bflb | 7 - drivers/clock_control/clock_control_bl60x.c | 913 ------------------ dts/bindings/clock/bflb,bclk.yaml | 19 - .../clock/bflb,bl60x-clock-controller.yaml | 15 - dts/bindings/clock/bflb,bl60x-pll.yaml | 20 - dts/bindings/clock/bflb,bl60x-root-clk.yaml | 23 - dts/bindings/clock/bflb,clock-controller.yaml | 8 - .../dt-bindings/clock/bflb_bl60x_clock.h | 23 - .../dt-bindings/clock/bflb_clock_common.h | 20 - 11 files changed, 1051 deletions(-) delete mode 100644 drivers/clock_control/Kconfig.bflb delete mode 100644 drivers/clock_control/clock_control_bl60x.c delete mode 100644 dts/bindings/clock/bflb,bclk.yaml delete mode 100644 dts/bindings/clock/bflb,bl60x-clock-controller.yaml delete mode 100644 dts/bindings/clock/bflb,bl60x-pll.yaml delete mode 100644 dts/bindings/clock/bflb,bl60x-root-clk.yaml delete mode 100644 dts/bindings/clock/bflb,clock-controller.yaml delete mode 100644 include/zephyr/dt-bindings/clock/bflb_bl60x_clock.h delete mode 100644 include/zephyr/dt-bindings/clock/bflb_clock_common.h diff --git a/drivers/clock_control/CMakeLists.txt b/drivers/clock_control/CMakeLists.txt index 9acbda0e5dd8..b1dbe1911975 100644 --- a/drivers/clock_control/CMakeLists.txt +++ b/drivers/clock_control/CMakeLists.txt @@ -54,7 +54,6 @@ zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF_FLL16M clock_cont zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF54H_HFXO clock_control_nrf54h_hfxo.c) zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF_HSFLL_LOCAL clock_control_nrf_hsfll_local.c) zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF_LFCLK clock_control_nrf_lfclk.c) -zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_BOUFFALOLAB_BL60X clock_control_bl60x.c) if(CONFIG_CLOCK_CONTROL_RENESAS_RZA2M_CPG) zephyr_library_sources(clock_control_renesas_rza2m_cpg.c) diff --git a/drivers/clock_control/Kconfig b/drivers/clock_control/Kconfig index 82fa462ee717..f528aa2dad32 100644 --- a/drivers/clock_control/Kconfig +++ b/drivers/clock_control/Kconfig @@ -32,8 +32,6 @@ source "drivers/clock_control/Kconfig.stm32" source "drivers/clock_control/Kconfig.beetle" -source "drivers/clock_control/Kconfig.bflb" - source "drivers/clock_control/Kconfig.fixed" source "drivers/clock_control/Kconfig.lpc11u6x" diff --git a/drivers/clock_control/Kconfig.bflb b/drivers/clock_control/Kconfig.bflb deleted file mode 100644 index dd89dbdf4f80..000000000000 --- a/drivers/clock_control/Kconfig.bflb +++ /dev/null @@ -1,7 +0,0 @@ -# Copyright (c) 2025 MASSDRIVER EI (massdriver.space) -# SPDX-License-Identifier: Apache-2.0 - -config CLOCK_CONTROL_BOUFFALOLAB_BL60X - bool "Bouffalolab BL60x Clock Control" - default y - depends on DT_HAS_BFLB_BL60X_CLOCK_CONTROLLER_ENABLED diff --git a/drivers/clock_control/clock_control_bl60x.c b/drivers/clock_control/clock_control_bl60x.c deleted file mode 100644 index eb81b04eec88..000000000000 --- a/drivers/clock_control/clock_control_bl60x.c +++ /dev/null @@ -1,913 +0,0 @@ -/* - * Copyright (c) 2025 MASSDRIVER EI (massdriver.space) - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#define DT_DRV_COMPAT bflb_bl60x_clock_controller - -#include -#include -#include -#include -#include -#include -LOG_MODULE_REGISTER(clock_control_bl60x, CONFIG_CLOCK_CONTROL_LOG_LEVEL); - -#include -#include -#include -#include -#include -#include -#include - -#define CLK_SRC_IS(clk, src) \ - DT_SAME_NODE(DT_CLOCKS_CTLR_BY_IDX(DT_INST_CLOCKS_CTLR_BY_NAME(0, clk), 0), \ - DT_INST_CLOCKS_CTLR_BY_NAME(0, src)) - -#define CLOCK_TIMEOUT 1024 -#define EFUSE_RC32M_TRIM_OFFSET 0x0C -#define EFUSE_RC32M_TRIM_EN_POS 19 -#define EFUSE_RC32M_TRIM_PARITY_POS 18 -#define EFUSE_RC32M_TRIM_POS 10 -#define EFUSE_RC32M_TRIM_MSK 0x3FC00 - -#define CRYSTAL_ID_FREQ_32000000 0 -#define CRYSTAL_ID_FREQ_24000000 1 -#define CRYSTAL_ID_FREQ_38400000 2 -#define CRYSTAL_ID_FREQ_40000000 3 -#define CRYSTAL_ID_FREQ_26000000 4 - -#define CRYSTAL_FREQ_TO_ID(freq) CONCAT(CRYSTAL_ID_FREQ_, freq) - -enum bl60x_clkid { - bl60x_clkid_clk_root = BL60X_CLKID_CLK_ROOT, - bl60x_clkid_clk_rc32m = BL60X_CLKID_CLK_RC32M, - bl60x_clkid_clk_crystal = BL60X_CLKID_CLK_CRYSTAL, - bl60x_clkid_clk_pll = BL60X_CLKID_CLK_PLL, - bl60x_clkid_clk_bclk = BL60X_CLKID_CLK_BCLK, -}; - -struct clock_control_bl60x_pll_config { - enum bl60x_clkid source; - bool overclock; -}; - -struct clock_control_bl60x_root_config { - enum bl60x_clkid source; - uint8_t pll_select; - uint8_t divider; -}; - -struct clock_control_bl60x_bclk_config { - uint8_t divider; -}; - -struct clock_control_bl60x_config { - uint32_t crystal_id; -}; - -struct clock_control_bl60x_data { - bool crystal_enabled; - bool pll_enabled; - struct clock_control_bl60x_pll_config pll; - struct clock_control_bl60x_root_config root; - struct clock_control_bl60x_bclk_config bclk; -}; - -const static uint32_t clock_control_bl60x_crystal_SDMIN_table[5] = { - /* 32M */ - 0x3C0000, - /* 24M */ - 0x500000, - /* 38.4M */ - 0x320000, - /* 40M */ - 0x300000, - /* 26M */ - 0x49D39D, -}; - -static inline void clock_control_bl60x_clock_settle(void) -{ - __asm__ volatile(".rept 15 ; nop ; .endr"); -} - -/* 32 Mhz Oscillator: 0 - * crystal: 1 - * PLL and 32M: 2 - * PLL and crystal: 3 - */ -static void clock_control_bl60x_set_root_clock(uint32_t clock) -{ - uint32_t tmp; - - /* invalid value, fallback to internal 32M */ - if (clock > 3) { - clock = 0; - } - tmp = sys_read32(HBN_BASE + HBN_GLB_OFFSET); - tmp = (tmp & HBN_ROOT_CLK_SEL_UMSK) | (clock << HBN_ROOT_CLK_SEL_POS); - sys_write32(tmp, HBN_BASE + HBN_GLB_OFFSET); - - clock_control_bl60x_clock_settle(); -} - -static uint32_t clock_control_bl60x_get_root_clock(void) -{ - uint32_t tmp; - - tmp = sys_read32(HBN_BASE + HBN_GLB_OFFSET); - return (((tmp & HBN_ROOT_CLK_SEL_MSK) >> HBN_ROOT_CLK_SEL_POS) & 0x3); -} - -static int clock_control_bl60x_deinit_crystal(void) -{ - uint32_t tmp; - - /* unpower crystal */ - tmp = sys_read32(AON_BASE + AON_RF_TOP_AON_OFFSET); - tmp = tmp & AON_PU_XTAL_AON_UMSK; - tmp = tmp & AON_PU_XTAL_BUF_AON_UMSK; - sys_write32(tmp, AON_BASE + AON_RF_TOP_AON_OFFSET); - - clock_control_bl60x_clock_settle(); - return 0; -} - -static int clock_control_bl60x_init_crystal(void) -{ - uint32_t tmp; - int count = CLOCK_TIMEOUT; - - /* power crystal */ - tmp = sys_read32(AON_BASE + AON_RF_TOP_AON_OFFSET); - tmp = (tmp & AON_PU_XTAL_AON_UMSK) | (1U << AON_PU_XTAL_AON_POS); - tmp = (tmp & AON_PU_XTAL_BUF_AON_UMSK) | (1U << AON_PU_XTAL_BUF_AON_POS); - sys_write32(tmp, AON_BASE + AON_RF_TOP_AON_OFFSET); - - /* wait for crystal to be powered on */ - do { - clock_control_bl60x_clock_settle(); - tmp = sys_read32(AON_BASE + AON_TSEN_OFFSET); - count--; - } while (!(tmp & AON_XTAL_RDY_MSK) && count > 0); - - clock_control_bl60x_clock_settle(); - if (count < 1) { - return -1; - } - return 0; -} - -/* HCLK is the core clock */ -static int clock_control_bl60x_set_root_clock_dividers(uint32_t hclk_div, uint32_t bclk_div) -{ - uint32_t tmp; - uint32_t old_rootclk; - - old_rootclk = clock_control_bl60x_get_root_clock(); - - /* security RC32M */ - if (old_rootclk > 1) { - clock_control_bl60x_set_root_clock(0); - } - - /* set dividers */ - tmp = sys_read32(GLB_BASE + GLB_CLK_CFG0_OFFSET); - tmp = (tmp & GLB_REG_HCLK_DIV_UMSK) | (hclk_div << GLB_REG_HCLK_DIV_POS); - tmp = (tmp & GLB_REG_BCLK_DIV_UMSK) | (bclk_div << GLB_REG_BCLK_DIV_POS); - sys_write32(tmp, GLB_BASE + GLB_CLK_CFG0_OFFSET); - - /* do something undocumented, probably acknowledging clock change by disabling then - * reenabling bclk - */ - sys_write32(0x00000001, 0x40000FFC); - sys_write32(0x00000000, 0x40000FFC); - - clock_control_bl60x_clock_settle(); - - /* enable clocks */ - tmp = sys_read32(GLB_BASE + GLB_CLK_CFG0_OFFSET); - tmp = (tmp & GLB_REG_BCLK_EN_UMSK) | (1U << GLB_REG_BCLK_EN_POS); - tmp = (tmp & GLB_REG_HCLK_EN_UMSK) | (1U << GLB_REG_HCLK_EN_POS); - sys_write32(tmp, GLB_BASE + GLB_CLK_CFG0_OFFSET); - - clock_control_bl60x_set_root_clock(old_rootclk); - clock_control_bl60x_clock_settle(); - - return 0; -} - -static void clock_control_bl60x_set_machine_timer_clock_enable(bool enable) -{ - uint32_t tmp; - - tmp = sys_read32(GLB_BASE + GLB_CPU_CLK_CFG_OFFSET); - if (enable) { - tmp = (tmp & GLB_CPU_RTC_EN_UMSK) | (1U << GLB_CPU_RTC_EN_POS); - } else { - tmp = (tmp & GLB_CPU_RTC_EN_UMSK) | (0U << GLB_CPU_RTC_EN_POS); - } - sys_write32(tmp, GLB_BASE + GLB_CPU_CLK_CFG_OFFSET); -} - -/* clock: - * 0: BCLK - * 1: 32Khz Oscillator (RC32*K*) - */ -static void clock_control_bl60x_set_machine_timer_clock(bool enable, uint32_t clock, - uint32_t divider) -{ - uint32_t tmp; - - if (divider > 0x1FFFF) { - divider = 0x1FFFF; - } - if (clock > 1) { - clock = 1; - } - - /* disable first, then set div */ - clock_control_bl60x_set_machine_timer_clock_enable(false); - - tmp = sys_read32(GLB_BASE + GLB_CPU_CLK_CFG_OFFSET); - tmp = (tmp & GLB_CPU_RTC_SEL_UMSK) | (clock << GLB_CPU_RTC_SEL_POS); - tmp = (tmp & GLB_CPU_RTC_DIV_UMSK) | (divider << GLB_CPU_RTC_DIV_POS); - sys_write32(tmp, GLB_BASE + GLB_CPU_CLK_CFG_OFFSET); - - clock_control_bl60x_set_machine_timer_clock_enable(enable); -} - -static void clock_control_bl60x_deinit_pll(void) -{ - uint32_t tmp; - - /* PLL Off */ - tmp = sys_read32(PDS_BASE + PDS_PU_RST_CLKPLL_OFFSET); - tmp = (tmp & PDS_PU_CLKPLL_SFREG_UMSK) | (0U << PDS_PU_CLKPLL_SFREG_POS); - tmp = (tmp & PDS_PU_CLKPLL_UMSK) | (0U << PDS_PU_CLKPLL_POS); - sys_write32(tmp, PDS_BASE + PDS_PU_RST_CLKPLL_OFFSET); - - /* needs 2 steps ? */ - tmp = sys_read32(PDS_BASE + PDS_PU_RST_CLKPLL_OFFSET); - tmp = (tmp & PDS_CLKPLL_PU_CP_UMSK) | (0U << PDS_CLKPLL_PU_CP_POS); - tmp = (tmp & PDS_CLKPLL_PU_PFD_UMSK) | (0U << PDS_CLKPLL_PU_PFD_POS); - tmp = (tmp & PDS_CLKPLL_PU_FBDV_UMSK) | (0U << PDS_CLKPLL_PU_FBDV_POS); - tmp = (tmp & PDS_CLKPLL_PU_POSTDIV_UMSK) | (0U << PDS_CLKPLL_PU_POSTDIV_POS); - sys_write32(tmp, PDS_BASE + PDS_PU_RST_CLKPLL_OFFSET); -} - -/* RC32M : 0 - * XTAL : 1 - */ -static void clock_control_bl60x_set_pll_source(uint32_t source) -{ - uint32_t tmp; - - tmp = sys_read32(PDS_BASE + PDS_CLKPLL_TOP_CTRL_OFFSET); - if (source > 0) { - tmp = (tmp & PDS_CLKPLL_REFCLK_SEL_UMSK) | (1U << PDS_CLKPLL_REFCLK_SEL_POS); - tmp = (tmp & PDS_CLKPLL_XTAL_RC32M_SEL_UMSK) | - (0U << PDS_CLKPLL_XTAL_RC32M_SEL_POS); - } else { - tmp = (tmp & PDS_CLKPLL_REFCLK_SEL_UMSK) | (0U << PDS_CLKPLL_REFCLK_SEL_POS); - tmp = (tmp & PDS_CLKPLL_XTAL_RC32M_SEL_UMSK) | - (1U << PDS_CLKPLL_XTAL_RC32M_SEL_POS); - } - sys_write32(tmp, PDS_BASE + PDS_CLKPLL_TOP_CTRL_OFFSET); -} - -static void clock_control_bl60x_init_pll(enum bl60x_clkid source, uint32_t crystal_id) -{ - uint32_t tmp; - uint32_t old_rootclk; - - old_rootclk = clock_control_bl60x_get_root_clock(); - - /* security RC32M */ - if (old_rootclk > 1) { - clock_control_bl60x_set_root_clock(0); - } - - clock_control_bl60x_deinit_pll(); - - if (source == BL60X_CLKID_CLK_CRYSTAL) { - clock_control_bl60x_set_pll_source(1); - } else { - clock_control_bl60x_set_pll_source(0); - } - - /* 26M special treatment */ - tmp = sys_read32(PDS_BASE + PDS_CLKPLL_CP_OFFSET); - if (crystal_id == CRYSTAL_ID_FREQ_26000000) { - tmp = (tmp & PDS_CLKPLL_ICP_1U_UMSK) | (1U << PDS_CLKPLL_ICP_1U_POS); - tmp = (tmp & PDS_CLKPLL_ICP_5U_UMSK) | (0U << PDS_CLKPLL_ICP_5U_POS); - tmp = (tmp & PDS_CLKPLL_INT_FRAC_SW_UMSK) | (1U << PDS_CLKPLL_INT_FRAC_SW_POS); - } else { - tmp = (tmp & PDS_CLKPLL_ICP_1U_UMSK) | (0U << PDS_CLKPLL_ICP_1U_POS); - tmp = (tmp & PDS_CLKPLL_ICP_5U_UMSK) | (2U << PDS_CLKPLL_ICP_5U_POS); - tmp = (tmp & PDS_CLKPLL_INT_FRAC_SW_UMSK) | (0U << PDS_CLKPLL_INT_FRAC_SW_POS); - } - sys_write32(tmp, PDS_BASE + PDS_CLKPLL_CP_OFFSET); - - /* More 26M special treatment */ - tmp = sys_read32(PDS_BASE + PDS_CLKPLL_RZ_OFFSET); - if (crystal_id == CRYSTAL_ID_FREQ_26000000) { - tmp = (tmp & PDS_CLKPLL_C3_UMSK) | (2U << PDS_CLKPLL_C3_POS); - tmp = (tmp & PDS_CLKPLL_CZ_UMSK) | (2U << PDS_CLKPLL_CZ_POS); - tmp = (tmp & PDS_CLKPLL_RZ_UMSK) | (5U << PDS_CLKPLL_RZ_POS); - tmp = (tmp & PDS_CLKPLL_R4_SHORT_UMSK) | (0U << PDS_CLKPLL_R4_SHORT_POS); - } else { - tmp = (tmp & PDS_CLKPLL_C3_UMSK) | (3U << PDS_CLKPLL_C3_POS); - tmp = (tmp & PDS_CLKPLL_CZ_UMSK) | (1U << PDS_CLKPLL_CZ_POS); - tmp = (tmp & PDS_CLKPLL_RZ_UMSK) | (1U << PDS_CLKPLL_RZ_POS); - tmp = (tmp & PDS_CLKPLL_R4_SHORT_UMSK) | (1U << PDS_CLKPLL_R4_SHORT_POS); - } - tmp = (tmp & PDS_CLKPLL_R4_UMSK) | (2U << PDS_CLKPLL_R4_POS); - sys_write32(tmp, PDS_BASE + PDS_CLKPLL_RZ_OFFSET); - - /* set pll dividers */ - tmp = sys_read32(PDS_BASE + PDS_CLKPLL_TOP_CTRL_OFFSET); - tmp = (tmp & PDS_CLKPLL_POSTDIV_UMSK) | ((uint32_t)(0x14) << PDS_CLKPLL_POSTDIV_POS); - tmp = (tmp & PDS_CLKPLL_REFDIV_RATIO_UMSK) | (2U << PDS_CLKPLL_REFDIV_RATIO_POS); - sys_write32(tmp, PDS_BASE + PDS_CLKPLL_TOP_CTRL_OFFSET); - - /* set SDMIN */ - tmp = sys_read32(PDS_BASE + PDS_CLKPLL_SDM_OFFSET); - if (source == BL60X_CLKID_CLK_CRYSTAL) { - tmp = (tmp & PDS_CLKPLL_SDMIN_UMSK) | - (clock_control_bl60x_crystal_SDMIN_table[crystal_id] - << PDS_CLKPLL_SDMIN_POS); - } else { - tmp = (tmp & PDS_CLKPLL_SDMIN_UMSK) | - (clock_control_bl60x_crystal_SDMIN_table[CRYSTAL_ID_FREQ_32000000] - << PDS_CLKPLL_SDMIN_POS); - } - sys_write32(tmp, PDS_BASE + PDS_CLKPLL_SDM_OFFSET); - - /* phase comparator settings? */ - tmp = sys_read32(PDS_BASE + PDS_CLKPLL_FBDV_OFFSET); - tmp = (tmp & PDS_CLKPLL_SEL_FB_CLK_UMSK) | (1U << PDS_CLKPLL_SEL_FB_CLK_POS); - tmp = (tmp & PDS_CLKPLL_SEL_SAMPLE_CLK_UMSK) | (1U << PDS_CLKPLL_SEL_SAMPLE_CLK_POS); - sys_write32(tmp, PDS_BASE + PDS_CLKPLL_FBDV_OFFSET); - - tmp = sys_read32(PDS_BASE + PDS_PU_RST_CLKPLL_OFFSET); - tmp = (tmp & PDS_PU_CLKPLL_SFREG_UMSK) | (1U << PDS_PU_CLKPLL_SFREG_POS); - sys_write32(tmp, PDS_BASE + PDS_PU_RST_CLKPLL_OFFSET); - clock_control_bl60x_clock_settle(); - - /* enable PPL clock actual? */ - tmp = sys_read32(PDS_BASE + PDS_PU_RST_CLKPLL_OFFSET); - tmp = (tmp & PDS_PU_CLKPLL_UMSK) | (1U << PDS_PU_CLKPLL_POS); - sys_write32(tmp, PDS_BASE + PDS_PU_RST_CLKPLL_OFFSET); - - /* More power up sequencing*/ - tmp = sys_read32(PDS_BASE + PDS_PU_RST_CLKPLL_OFFSET); - tmp = (tmp & PDS_CLKPLL_PU_CP_UMSK) | (1U << PDS_CLKPLL_PU_CP_POS); - tmp = (tmp & PDS_CLKPLL_PU_PFD_UMSK) | (1U << PDS_CLKPLL_PU_PFD_POS); - tmp = (tmp & PDS_CLKPLL_PU_FBDV_UMSK) | (1U << PDS_CLKPLL_PU_FBDV_POS); - tmp = (tmp & PDS_CLKPLL_PU_POSTDIV_UMSK) | (1U << PDS_CLKPLL_PU_POSTDIV_POS); - sys_write32(tmp, PDS_BASE + PDS_PU_RST_CLKPLL_OFFSET); - - clock_control_bl60x_clock_settle(); - - /* reset couple things one by one? */ - tmp = sys_read32(PDS_BASE + PDS_PU_RST_CLKPLL_OFFSET); - tmp = (tmp & PDS_CLKPLL_SDM_RESET_UMSK) | (1U << PDS_CLKPLL_SDM_RESET_POS); - sys_write32(tmp, PDS_BASE + PDS_PU_RST_CLKPLL_OFFSET); - - tmp = sys_read32(PDS_BASE + PDS_PU_RST_CLKPLL_OFFSET); - tmp = (tmp & PDS_CLKPLL_RESET_FBDV_UMSK) | (1U << PDS_CLKPLL_RESET_FBDV_POS); - sys_write32(tmp, PDS_BASE + PDS_PU_RST_CLKPLL_OFFSET); - - tmp = sys_read32(PDS_BASE + PDS_PU_RST_CLKPLL_OFFSET); - tmp = (tmp & PDS_CLKPLL_RESET_FBDV_UMSK) | (0U << PDS_CLKPLL_RESET_FBDV_POS); - sys_write32(tmp, PDS_BASE + PDS_PU_RST_CLKPLL_OFFSET); - - tmp = sys_read32(PDS_BASE + PDS_PU_RST_CLKPLL_OFFSET); - tmp = (tmp & PDS_CLKPLL_SDM_RESET_UMSK) | (0U << PDS_CLKPLL_SDM_RESET_POS); - sys_write32(tmp, PDS_BASE + PDS_PU_RST_CLKPLL_OFFSET); - - clock_control_bl60x_set_root_clock(old_rootclk); - clock_control_bl60x_clock_settle(); -} - -/* - * 0: 48M - * 1: 120M - * 2: 160M - * 3: 192M - */ -static void clock_control_bl60x_select_PLL(uint8_t pll) -{ - uint32_t tmp; - - tmp = sys_read32(GLB_BASE + GLB_CLK_CFG0_OFFSET); - tmp = (tmp & GLB_REG_PLL_SEL_UMSK) | (pll << GLB_REG_PLL_SEL_POS); - sys_write32(tmp, GLB_BASE + GLB_CLK_CFG0_OFFSET); -} - -static int clock_control_bl60x_clock_trim_32M(void) -{ - uint32_t tmp; - int err; - uint32_t trim, trim_parity; - const struct device *efuse = DEVICE_DT_GET_ONE(bflb_efuse); - - err = syscon_read_reg(efuse, EFUSE_RC32M_TRIM_OFFSET, &trim); - if (err < 0) { - LOG_ERR("Error: Couldn't read efuses: err: %d.\n", err); - return err; - } - if (!((trim >> EFUSE_RC32M_TRIM_EN_POS) & 1)) { - LOG_ERR("RC32M trim disabled!"); - return -EINVAL; - } - - trim_parity = (trim >> EFUSE_RC32M_TRIM_PARITY_POS) & 1; - trim = (trim & EFUSE_RC32M_TRIM_MSK) >> EFUSE_RC32M_TRIM_POS; - - if (trim_parity != (POPCOUNT(trim) & 1)) { - LOG_ERR("Bad trim parity"); - return -EINVAL; - } - - tmp = sys_read32(PDS_BASE + PDS_RC32M_CTRL0_OFFSET); - tmp = (tmp & PDS_RC32M_EXT_CODE_EN_UMSK) | 1 << PDS_RC32M_EXT_CODE_EN_POS; - tmp = (tmp & PDS_RC32M_CODE_FR_EXT_UMSK) | trim << PDS_RC32M_CODE_FR_EXT_POS; - sys_write32(tmp, PDS_BASE + PDS_RC32M_CTRL0_OFFSET); - - clock_control_bl60x_clock_settle(); - - return 0; -} - -/* source for most clocks, either XTAL or RC32M */ -static uint32_t clock_control_bl60x_get_xclk(const struct device *dev) -{ - uint32_t tmp; - - tmp = sys_read32(HBN_BASE + HBN_GLB_OFFSET); - tmp &= HBN_ROOT_CLK_SEL_MSK; - tmp = tmp >> HBN_ROOT_CLK_SEL_POS; - tmp &= 1; - if (tmp == 0) { - return BFLB_RC32M_FREQUENCY; - } else if (tmp == 1) { - return DT_PROP(DT_INST_CLOCKS_CTLR_BY_NAME(0, crystal), clock_frequency); - } else { - return 0; - } -} - -static uint32_t clock_control_bl60x_get_clk(const struct device *dev) -{ - uint32_t tmp; - uint32_t hclk_div; - - hclk_div = sys_read32(GLB_BASE + GLB_CLK_CFG0_OFFSET); - hclk_div = (hclk_div & GLB_REG_HCLK_DIV_MSK) >> GLB_REG_HCLK_DIV_POS; - - tmp = sys_read32(HBN_BASE + HBN_GLB_OFFSET); - tmp &= HBN_ROOT_CLK_SEL_MSK; - tmp = (tmp >> HBN_ROOT_CLK_SEL_POS) >> 1; - tmp &= 1; - - if (tmp == 0) { - return clock_control_bl60x_get_xclk(dev) / (hclk_div + 1); - } - tmp = sys_read32(GLB_BASE + GLB_CLK_CFG0_OFFSET); - tmp = (tmp & GLB_REG_PLL_SEL_MSK) >> GLB_REG_PLL_SEL_POS; - if (tmp == 3) { - return MHZ(192) / (hclk_div + 1); - } else if (tmp == 2) { - return MHZ(160) / (hclk_div + 1); - } else if (tmp == 1) { - return MHZ(120) / (hclk_div + 1); - } else if (tmp == 0) { - return MHZ(48) / (hclk_div + 1); - } - return 0; -} - -/* most peripherals clock */ -static uint32_t clock_control_bl60x_get_bclk(const struct device *dev) -{ - uint32_t tmp; - uint32_t clock_id; - - tmp = sys_read32(GLB_BASE + GLB_CLK_CFG0_OFFSET); - tmp = (tmp & GLB_REG_BCLK_DIV_MSK) >> GLB_REG_BCLK_DIV_POS; - clock_id = clock_control_bl60x_get_clk(dev); - return clock_id / (tmp + 1); -} - -static uint32_t clock_control_bl60x_mtimer_get_clk_src_div(const struct device *dev) -{ - return clock_control_bl60x_get_bclk(dev) / 1000 / 1000 - 1; -} - -static void clock_control_bl60x_cache_2T(bool yes) -{ - uint32_t tmp; - - tmp = sys_read32(L1C_BASE + L1C_CONFIG_OFFSET); - - if (yes) { - tmp |= L1C_IROM_2T_ACCESS_MSK; - } else { - tmp &= ~L1C_IROM_2T_ACCESS_MSK; - } - - sys_write32(tmp, L1C_BASE + L1C_CONFIG_OFFSET); -} - -/* HCLK: 0 - * PLL120M: 1 - */ -static void clock_control_bl60x_set_PKA_clock(uint32_t pka_clock) -{ - uint32_t tmp; - - tmp = sys_read32(GLB_BASE + GLB_SWRST_CFG2_OFFSET); - tmp = (tmp & GLB_PKA_CLK_SEL_UMSK) | (pka_clock << GLB_PKA_CLK_SEL_POS); - sys_write32(tmp, GLB_BASE + GLB_SWRST_CFG2_OFFSET); -} - -static void clock_control_bl60x_init_root_as_pll(const struct device *dev) -{ - struct clock_control_bl60x_data *data = dev->data; - const struct clock_control_bl60x_config *config = dev->config; - uint32_t tmp; - - clock_control_bl60x_init_pll(data->pll.source, config->crystal_id); - - /* enable all 'PDS' clocks */ - tmp = sys_read32(PDS_BASE + PDS_CLKPLL_OUTPUT_EN_OFFSET); - tmp |= 0x1FF; - sys_write32(tmp, PDS_BASE + PDS_CLKPLL_OUTPUT_EN_OFFSET); - - /* glb enable pll actual? */ - tmp = sys_read32(GLB_BASE + GLB_CLK_CFG0_OFFSET); - tmp = (tmp & GLB_REG_PLL_EN_UMSK) | (1U << GLB_REG_PLL_EN_POS); - sys_write32(tmp, GLB_BASE + GLB_CLK_CFG0_OFFSET); - - clock_control_bl60x_select_PLL(data->root.pll_select); - - if (data->pll.source == bl60x_clkid_clk_crystal) { - clock_control_bl60x_set_root_clock(3); - } else { - clock_control_bl60x_set_root_clock(2); - } - - if (clock_control_bl60x_get_clk(dev) > MHZ(120)) { - clock_control_bl60x_cache_2T(true); - } - - sys_write32(clock_control_bl60x_get_clk(dev), CORECLOCKREGISTER); - clock_control_bl60x_set_PKA_clock(1); -} - -static void clock_control_bl60x_init_root_as_crystal(const struct device *dev) -{ - clock_control_bl60x_set_root_clock(1); - sys_write32(clock_control_bl60x_get_clk(dev), CORECLOCKREGISTER); -} - -static int clock_control_bl60x_update_root(const struct device *dev) -{ - struct clock_control_bl60x_data *data = dev->data; - uint32_t tmp; - int ret; - - /* make sure all clocks are enabled */ - tmp = sys_read32(GLB_BASE + GLB_CLK_CFG0_OFFSET); - tmp = (tmp & GLB_REG_BCLK_EN_UMSK) | (1U << GLB_REG_BCLK_EN_POS); - tmp = (tmp & GLB_REG_HCLK_EN_UMSK) | (1U << GLB_REG_HCLK_EN_POS); - tmp = (tmp & GLB_REG_FCLK_EN_UMSK) | (1U << GLB_REG_FCLK_EN_POS); - sys_write32(tmp, GLB_BASE + GLB_CLK_CFG0_OFFSET); - - /* set root clock to internal 32MHz Oscillator as failsafe */ - clock_control_bl60x_set_root_clock(0); - if (clock_control_bl60x_set_root_clock_dividers(0, 0) != 0) { - return -EIO; - } - sys_write32(BFLB_RC32M_FREQUENCY, CORECLOCKREGISTER); - - clock_control_bl60x_set_PKA_clock(0); - - if (data->crystal_enabled) { - if (clock_control_bl60x_init_crystal() < 0) { - return -EIO; - } - } else { - clock_control_bl60x_deinit_crystal(); - } - - ret = clock_control_bl60x_set_root_clock_dividers(data->root.divider - 1, - data->bclk.divider - 1); - if (ret < 0) { - return ret; - } - - if (data->root.source == bl60x_clkid_clk_pll) { - clock_control_bl60x_init_root_as_pll(dev); - } else if (data->root.source == bl60x_clkid_clk_crystal) { - clock_control_bl60x_init_root_as_crystal(dev); - } else { - /* Root clock already setup as RC32M */ - } - - ret = clock_control_bl60x_clock_trim_32M(); - if (ret < 0) { - return ret; - } - clock_control_bl60x_set_machine_timer_clock( - 1, 0, clock_control_bl60x_mtimer_get_clk_src_div(dev)); - - clock_control_bl60x_clock_settle(); - - return ret; -} - -static void clock_control_bl60x_uart_set_clock_enable(bool enable) -{ - uint32_t tmp; - - tmp = sys_read32(GLB_BASE + GLB_CLK_CFG2_OFFSET); - if (enable) { - tmp = (tmp & GLB_UART_CLK_EN_UMSK) | (1U << GLB_UART_CLK_EN_POS); - } else { - tmp = (tmp & GLB_UART_CLK_EN_UMSK) | (0U << GLB_UART_CLK_EN_POS); - } - sys_write32(tmp, GLB_BASE + GLB_CLK_CFG2_OFFSET); -} - -/* Clock: - * FCLK: 0 - * 160 Mhz PLL: 1 - * When using PLL root clock, we can use either setting, when using the 32Mhz Oscillator with a - * uninitialized PLL, only FCLK will be available. - */ -static void clock_control_bl60x_uart_set_clock(bool enable, uint32_t clock, uint32_t divider) -{ - uint32_t tmp; - - if (divider > 0x7) { - divider = 0x7; - } - if (clock > 1) { - clock = 1; - } - /* disable uart clock */ - clock_control_bl60x_uart_set_clock_enable(false); - - tmp = sys_read32(GLB_BASE + GLB_CLK_CFG2_OFFSET); - tmp = (tmp & GLB_UART_CLK_DIV_UMSK) | (divider << GLB_UART_CLK_DIV_POS); - sys_write32(tmp, GLB_BASE + GLB_CLK_CFG2_OFFSET); - - tmp = sys_read32(HBN_BASE + HBN_GLB_OFFSET); - tmp = (tmp & HBN_UART_CLK_SEL_UMSK) | (clock << HBN_UART_CLK_SEL_POS); - sys_write32(tmp, HBN_BASE + HBN_GLB_OFFSET); - - clock_control_bl60x_uart_set_clock_enable(enable); -} - -/* Simple function to enable all peripherals for now */ -static void clock_control_bl60x_peripheral_clock_init(void) -{ - uint32_t regval = sys_read32(GLB_BASE + GLB_CGEN_CFG1_OFFSET); - - /* enable ADC clock routing */ - regval |= (1 << 2); - /* enable UART0 clock routing */ - regval |= (1 << 16); - /* enable I2C0 clock routing */ - regval |= (1 << 19); - - sys_write32(regval, GLB_BASE + GLB_CGEN_CFG1_OFFSET); - - clock_control_bl60x_uart_set_clock(1, 0, 0); -} - -static int clock_control_bl60x_on(const struct device *dev, clock_control_subsys_t sys) -{ - struct clock_control_bl60x_data *data = dev->data; - int ret = -EINVAL; - uint32_t key; - enum bl60x_clkid oldroot; - - key = irq_lock(); - - if ((enum bl60x_clkid)sys == bl60x_clkid_clk_crystal) { - if (data->crystal_enabled) { - ret = 0; - } else { - data->crystal_enabled = true; - ret = clock_control_bl60x_update_root(dev); - if (ret < 0) { - data->crystal_enabled = false; - } - } - } else if ((enum bl60x_clkid)sys == bl60x_clkid_clk_pll) { - if (data->pll_enabled) { - ret = 0; - } else { - data->pll_enabled = true; - ret = clock_control_bl60x_update_root(dev); - if (ret < 0) { - data->pll_enabled = false; - } - } - } else if ((int)sys == BFLB_FORCE_ROOT_RC32M) { - if (data->root.source == bl60x_clkid_clk_rc32m) { - ret = 0; - } else { - /* Cannot fail to set root to rc32m */ - data->root.source = bl60x_clkid_clk_rc32m; - ret = clock_control_bl60x_update_root(dev); - } - } else if ((int)sys == BFLB_FORCE_ROOT_CRYSTAL) { - if (data->root.source == bl60x_clkid_clk_crystal) { - ret = 0; - } else { - oldroot = data->root.source; - data->root.source = bl60x_clkid_clk_crystal; - ret = clock_control_bl60x_update_root(dev); - if (ret < 0) { - data->root.source = oldroot; - } - } - } else if ((int)sys == BFLB_FORCE_ROOT_PLL) { - if (data->root.source == bl60x_clkid_clk_pll) { - ret = 0; - } else { - oldroot = data->root.source; - data->root.source = bl60x_clkid_clk_pll; - ret = clock_control_bl60x_update_root(dev); - if (ret < 0) { - data->root.source = oldroot; - } - } - } - - irq_unlock(key); - return ret; -} - -static int clock_control_bl60x_off(const struct device *dev, clock_control_subsys_t sys) -{ - struct clock_control_bl60x_data *data = dev->data; - int ret = -EINVAL; - uint32_t key; - - key = irq_lock(); - - if ((enum bl60x_clkid)sys == bl60x_clkid_clk_crystal) { - if (!data->crystal_enabled) { - ret = 0; - } else { - data->crystal_enabled = false; - ret = clock_control_bl60x_update_root(dev); - if (ret < 0) { - data->crystal_enabled = true; - } - } - } else if ((enum bl60x_clkid)sys == bl60x_clkid_clk_pll) { - if (!data->pll_enabled) { - ret = 0; - } else { - data->pll_enabled = false; - ret = clock_control_bl60x_update_root(dev); - if (ret < 0) { - data->pll_enabled = true; - } - } - } - - irq_unlock(key); - return ret; -} - -static enum clock_control_status clock_control_bl60x_get_status(const struct device *dev, - clock_control_subsys_t sys) -{ - struct clock_control_bl60x_data *data = dev->data; - - switch ((enum bl60x_clkid)sys) { - case bl60x_clkid_clk_root: - case bl60x_clkid_clk_bclk: - case bl60x_clkid_clk_rc32m: - return CLOCK_CONTROL_STATUS_ON; - case bl60x_clkid_clk_crystal: - if (data->crystal_enabled) { - return CLOCK_CONTROL_STATUS_ON; - } - return CLOCK_CONTROL_STATUS_OFF; - case bl60x_clkid_clk_pll: - if (data->pll_enabled) { - return CLOCK_CONTROL_STATUS_ON; - } - return CLOCK_CONTROL_STATUS_OFF; - default: - return CLOCK_CONTROL_STATUS_UNKNOWN; - } -} - -static int clock_control_bl60x_get_rate(const struct device *dev, clock_control_subsys_t sys, - uint32_t *rate) -{ - if ((enum bl60x_clkid)sys == bl60x_clkid_clk_root) { - *rate = clock_control_bl60x_get_clk(dev); - } else if ((enum bl60x_clkid)sys == bl60x_clkid_clk_bclk) { - *rate = clock_control_bl60x_get_bclk(dev); - } else if ((enum bl60x_clkid)sys == bl60x_clkid_clk_crystal) { - *rate = DT_PROP(DT_INST_CLOCKS_CTLR_BY_NAME(0, crystal), clock_frequency); - } else if ((enum bl60x_clkid)sys == bl60x_clkid_clk_rc32m) { - *rate = BFLB_RC32M_FREQUENCY; - } else { - return -EINVAL; - } - return 0; -} - -static int clock_control_bl60x_init(const struct device *dev) -{ - int ret; - uint32_t key; - - key = irq_lock(); - - ret = clock_control_bl60x_update_root(dev); - if (ret < 0) { - irq_unlock(key); - return ret; - } - - clock_control_bl60x_peripheral_clock_init(); - - irq_unlock(key); - - return 0; -} - -static DEVICE_API(clock_control, clock_control_bl60x_api) = { - .on = clock_control_bl60x_on, - .off = clock_control_bl60x_off, - .get_rate = clock_control_bl60x_get_rate, - .get_status = clock_control_bl60x_get_status, -}; - -static const struct clock_control_bl60x_config clock_control_bl60x_config = { - .crystal_id = CRYSTAL_FREQ_TO_ID(DT_PROP(DT_INST_CLOCKS_CTLR_BY_NAME(0, crystal), - clock_frequency)), -}; - -static struct clock_control_bl60x_data clock_control_bl60x_data = { - .crystal_enabled = DT_NODE_HAS_STATUS_OKAY(DT_INST_CLOCKS_CTLR_BY_NAME(0, crystal)), - .pll_enabled = DT_NODE_HAS_STATUS_OKAY(DT_INST_CLOCKS_CTLR_BY_NAME(0, pll_192)), - - .root = { -#if CLK_SRC_IS(root, pll_192) - .source = bl60x_clkid_clk_pll, - .pll_select = DT_CLOCKS_CELL(DT_INST_CLOCKS_CTLR_BY_NAME(0, root), select), -#elif CLK_SRC_IS(root, crystal) - .source = bl60x_clkid_clk_crystal, -#else - .source = bl60x_clkid_clk_rc32m, -#endif - .divider = DT_PROP(DT_INST_CLOCKS_CTLR_BY_NAME(0, root), divider), - }, - - .pll = { -#if CLK_SRC_IS(pll_192, crystal) - .source = bl60x_clkid_clk_crystal, -#else - .source = bl60x_clkid_clk_rc32m, -#endif - }, - - .bclk = { - .divider = DT_PROP(DT_INST_CLOCKS_CTLR_BY_NAME(0, bclk), divider), - }, -}; - -BUILD_ASSERT(CLK_SRC_IS(pll_192, crystal) || CLK_SRC_IS(root, crystal) - ? DT_NODE_HAS_STATUS_OKAY(DT_INST_CLOCKS_CTLR_BY_NAME(0, crystal)) - : 1, - "Crystal must be enabled to use it"); - -BUILD_ASSERT(CLK_SRC_IS(root, pll_192) ? - DT_NODE_HAS_STATUS_OKAY(DT_INST_CLOCKS_CTLR_BY_NAME(0, pll_192)) : 1, - "PLL must be enabled to use it"); - -BUILD_ASSERT(DT_NODE_HAS_STATUS_OKAY(DT_INST_CLOCKS_CTLR_BY_NAME(0, rc32m)), "RC32M is always on"); - -BUILD_ASSERT(DT_PROP(DT_INST_CLOCKS_CTLR_BY_NAME(0, rc32m), clock_frequency) - == BFLB_RC32M_FREQUENCY, "RC32M must be 32M"); - -DEVICE_DT_INST_DEFINE(0, clock_control_bl60x_init, NULL, &clock_control_bl60x_data, - &clock_control_bl60x_config, PRE_KERNEL_1, CONFIG_CLOCK_CONTROL_INIT_PRIORITY, - &clock_control_bl60x_api); diff --git a/dts/bindings/clock/bflb,bclk.yaml b/dts/bindings/clock/bflb,bclk.yaml deleted file mode 100644 index 343c5831ed05..000000000000 --- a/dts/bindings/clock/bflb,bclk.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright (c) 2025 MASSDRIVER EI (massdriver.space) -# SPDX-License-Identifier: Apache-2.0 - -description: | - The BCLK clock, or peripheral clock - Source Clock -> Root Clock -> / divider -> BCLK - -compatible: "bflb,bclk" - -include: [base.yaml, clock-controller.yaml] - -properties: - divider: - type: int - required: true - description: Divide root clock by this 8-bits value - - "#clock-cells": - const: 0 diff --git a/dts/bindings/clock/bflb,bl60x-clock-controller.yaml b/dts/bindings/clock/bflb,bl60x-clock-controller.yaml deleted file mode 100644 index a9c02425a9ff..000000000000 --- a/dts/bindings/clock/bflb,bl60x-clock-controller.yaml +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) 2025 MASSDRIVER EI (massdriver.space) -# SPDX-License-Identifier: Apache-2.0 - -description: Bouffalolab BL60x Clock Controller - -compatible: "bflb,bl60x-clock-controller" - -include: [base.yaml, clock-controller.yaml] - -properties: - "#clock-cells": - const: 1 - -clock-cells: - - id diff --git a/dts/bindings/clock/bflb,bl60x-pll.yaml b/dts/bindings/clock/bflb,bl60x-pll.yaml deleted file mode 100644 index a1c9719ea3f0..000000000000 --- a/dts/bindings/clock/bflb,bl60x-pll.yaml +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright (c) 2025 MASSDRIVER EI (massdriver.space) -# SPDX-License-Identifier: Apache-2.0 - -description: The BL60x PLL - -compatible: "bflb,bl60x-pll" - -include: [base.yaml, clock-controller.yaml] - -properties: - clocks: - type: phandle-array - required: true - description: source - - "#clock-cells": - const: 1 - -clock-cells: - - select diff --git a/dts/bindings/clock/bflb,bl60x-root-clk.yaml b/dts/bindings/clock/bflb,bl60x-root-clk.yaml deleted file mode 100644 index 9e1bb7948f6a..000000000000 --- a/dts/bindings/clock/bflb,bl60x-root-clk.yaml +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright (c) 2025 MASSDRIVER EI (massdriver.space) -# SPDX-License-Identifier: Apache-2.0 - -description: | - The BL60x Root Clock - -compatible: "bflb,bl60x-root-clk" - -include: [base.yaml, clock-controller.yaml] - -properties: - clocks: - type: phandle-array - required: true - description: source - - divider: - type: int - required: true - description: Divide source clock by this 8-bits value. Typically 1. - - "#clock-cells": - const: 0 diff --git a/dts/bindings/clock/bflb,clock-controller.yaml b/dts/bindings/clock/bflb,clock-controller.yaml deleted file mode 100644 index c0a63a066566..000000000000 --- a/dts/bindings/clock/bflb,clock-controller.yaml +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (c) 2025 MASSDRIVER EI (massdriver.space) -# SPDX-License-Identifier: Apache-2.0 - -description: Bouffalolab Clock Controller for Drivers - -compatible: "bflb,clock-controller" - -include: [base.yaml, clock-controller.yaml] diff --git a/include/zephyr/dt-bindings/clock/bflb_bl60x_clock.h b/include/zephyr/dt-bindings/clock/bflb_bl60x_clock.h deleted file mode 100644 index a08db84b082d..000000000000 --- a/include/zephyr/dt-bindings/clock/bflb_bl60x_clock.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2025 MASSDRIVER EI (massdriver.space) - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_BFLB_BL60X_CLOCK_H_ -#define ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_BFLB_BL60X_CLOCK_H_ - -#include "bflb_clock_common.h" - -#define BL60X_CLKID_CLK_ROOT BFLB_CLKID_CLK_ROOT -#define BL60X_CLKID_CLK_RC32M BFLB_CLKID_CLK_RC32M -#define BL60X_CLKID_CLK_CRYSTAL BFLB_CLKID_CLK_CRYSTAL -#define BL60X_CLKID_CLK_BCLK BFLB_CLKID_CLK_BCLK -#define BL60X_CLKID_CLK_PLL 4 - -#define BL60X_PLL_48MHz 0 -#define BL60X_PLL_120MHz 1 -#define BL60X_PLL_160MHz 2 -#define BL60X_PLL_192MHz 3 - -#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_BFLB_BL60X_CLOCK_H_ */ diff --git a/include/zephyr/dt-bindings/clock/bflb_clock_common.h b/include/zephyr/dt-bindings/clock/bflb_clock_common.h deleted file mode 100644 index 203bac3d434a..000000000000 --- a/include/zephyr/dt-bindings/clock/bflb_clock_common.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2025 MASSDRIVER EI (massdriver.space) - * - * SPDX-License-Identifier: Apache-2.0 - */ -#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_BFLB_CLOCK_COMMON_H_ -#define ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_BFLB_CLOCK_COMMON_H_ - -#define BFLB_CLKID_CLK_ROOT 0 -#define BFLB_CLKID_CLK_RC32M 1 -#define BFLB_CLKID_CLK_CRYSTAL 2 -#define BFLB_CLKID_CLK_BCLK 3 - -#define BFLB_FORCE_ROOT_RC32M 10 -#define BFLB_FORCE_ROOT_CRYSTAL 11 -#define BFLB_FORCE_ROOT_PLL 12 - -#define BFLB_RC32M_FREQUENCY 32000000 - -#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_BFLB_CLOCK_COMMON_H_ */ From d1d344c68acb58d811565fc2415992bf5f41d0b8 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:05 +0300 Subject: [PATCH 1466/2141] Revert "[nrf fromtree] tests: drivers: i2c: target_api: extend nrf overlays with bus gpios" This reverts commit 9c2f8a63dfe3768ab9ce230d1ccf1a89ae902b58. Signed-off-by: Jukka Rissanen --- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/tests/drivers/i2c/i2c_target_api/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/i2c/i2c_target_api/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index 9390af2b5cd1..2fc033d534a6 100644 --- a/tests/drivers/i2c/i2c_target_api/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/tests/drivers/i2c/i2c_target_api/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -9,23 +9,6 @@ * SCL = P1.2 and P1.3 */ -/ { - zephyr,user { - sda0-gpios = <&gpio2 8 0>; - scl0-gpios = <&gpio1 2 0>; - sda1-gpios = <&gpio2 9 0>; - scl1-gpios = <&gpio1 3 0>; - }; -}; - -&gpio1 { - status = "okay"; -}; - -&gpio2 { - status = "okay"; -}; - &pinctrl { i2c130_default: i2c130_default { group1 { From 340455978bd45041dad2d236b7cfb84711894ffe Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:05 +0300 Subject: [PATCH 1467/2141] Revert "[nrf fromtree] tests: drivers: i2c: target_api: add device_deinit test case" This reverts commit a6a50c344e61ba4ae47af2be7e8ae882b9ad93d0. Signed-off-by: Jukka Rissanen --- tests/drivers/i2c/i2c_target_api/src/main.c | 57 --------------------- 1 file changed, 57 deletions(-) diff --git a/tests/drivers/i2c/i2c_target_api/src/main.c b/tests/drivers/i2c/i2c_target_api/src/main.c index b249daae90bd..5c1540e3e79a 100644 --- a/tests/drivers/i2c/i2c_target_api/src/main.c +++ b/tests/drivers/i2c/i2c_target_api/src/main.c @@ -16,7 +16,6 @@ #include #include -#include #include @@ -167,62 +166,6 @@ static int run_program_read(const struct device *i2c, uint8_t addr, return 0; } -ZTEST(i2c_eeprom_target, test_deinit) -{ - const struct device *const i2c_0 = DEVICE_DT_GET(DT_BUS(NODE_EP0)); - const struct device *const i2c_1 = DEVICE_DT_GET(DT_BUS(NODE_EP1)); - const struct gpio_dt_spec sda_pin_0 = - GPIO_DT_SPEC_GET_OR(DT_PATH(zephyr_user), sda0_gpios, {}); - const struct gpio_dt_spec scl_pin_0 = - GPIO_DT_SPEC_GET_OR(DT_PATH(zephyr_user), scl0_gpios, {}); - const struct gpio_dt_spec sda_pin_1 = - GPIO_DT_SPEC_GET_OR(DT_PATH(zephyr_user), sda1_gpios, {}); - const struct gpio_dt_spec scl_pin_1 = - GPIO_DT_SPEC_GET_OR(DT_PATH(zephyr_user), scl1_gpios, {}); - int ret; - - if (i2c_0 == i2c_1) { - TC_PRINT(" gpio loopback required for test\n"); - ztest_test_skip(); - } - - if (scl_pin_0.port == NULL || sda_pin_0.port == NULL || - scl_pin_1.port == NULL || sda_pin_1.port == NULL) { - TC_PRINT(" bus gpios not specified in zephyr,path\n"); - ztest_test_skip(); - } - - ret = device_deinit(i2c_0); - if (ret == -ENOTSUP) { - TC_PRINT(" device deinit not supported\n"); - ztest_test_skip(); - } - - zassert_ok(ret); - - ret = device_deinit(i2c_1); - if (ret == -ENOTSUP) { - TC_PRINT(" device deinit not supported\n"); - zassert_ok(device_init(i2c_0)); - ztest_test_skip(); - } - - zassert_ok(gpio_pin_configure_dt(&sda_pin_0, GPIO_INPUT)); - zassert_ok(gpio_pin_configure_dt(&sda_pin_1, GPIO_OUTPUT_INACTIVE)); - zassert_ok(gpio_pin_configure_dt(&scl_pin_0, GPIO_INPUT)); - zassert_ok(gpio_pin_configure_dt(&scl_pin_1, GPIO_OUTPUT_INACTIVE)); - zassert_equal(gpio_pin_get_dt(&sda_pin_0), 0); - zassert_equal(gpio_pin_get_dt(&scl_pin_0), 0); - zassert_ok(gpio_pin_set_dt(&sda_pin_1, 1)); - zassert_ok(gpio_pin_set_dt(&scl_pin_1, 1)); - zassert_equal(gpio_pin_get_dt(&sda_pin_0), 1); - zassert_equal(gpio_pin_get_dt(&scl_pin_0), 1); - zassert_ok(gpio_pin_configure_dt(&sda_pin_1, GPIO_INPUT)); - zassert_ok(gpio_pin_configure_dt(&scl_pin_1, GPIO_INPUT)); - zassert_ok(device_init(i2c_0)); - zassert_ok(device_init(i2c_1)); -} - ZTEST(i2c_eeprom_target, test_eeprom_target) { const struct device *const eeprom_0 = DEVICE_DT_GET(NODE_EP0); From a0e6032c5c8ea7627502eb303443105985d33ccb Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:05 +0300 Subject: [PATCH 1468/2141] Revert "[nrf fromtree] drivers: i2c: nrfx_twis: impl device deinit" This reverts commit ab2858aaedf70d82c4ac33c605591eb562bc8235. Signed-off-by: Jukka Rissanen --- drivers/i2c/i2c_nrfx_twis.c | 43 ++----------------------------------- 1 file changed, 2 insertions(+), 41 deletions(-) diff --git a/drivers/i2c/i2c_nrfx_twis.c b/drivers/i2c/i2c_nrfx_twis.c index dca3a457cf22..c37c51ddd745 100644 --- a/drivers/i2c/i2c_nrfx_twis.c +++ b/drivers/i2c/i2c_nrfx_twis.c @@ -73,15 +73,6 @@ static bool shim_nrf_twis_is_resumed(const struct device *dev) (void)pm_device_state_get(dev, &state); return state == PM_DEVICE_STATE_ACTIVE; } - -static bool shim_nrf_twis_is_suspended(const struct device *dev) -{ - enum pm_device_state state; - - (void)pm_device_state_get(dev, &state); - return state == PM_DEVICE_STATE_SUSPENDED || - state == PM_DEVICE_STATE_OFF; -} #else static bool shim_nrf_twis_is_resumed(const struct device *dev) { @@ -208,7 +199,7 @@ static int shim_nrf_twis_pm_action_cb(const struct device *dev, #if CONFIG_PM_DEVICE case PM_DEVICE_ACTION_SUSPEND: - shim_nrf_twis_disable(dev); + shim_nrf_twis_disable(); break; #endif @@ -292,35 +283,6 @@ static int shim_nrf_twis_init(const struct device *dev) return pm_device_driver_init(dev, shim_nrf_twis_pm_action_cb); } -static int shim_nrf_twis_deinit(const struct device *dev) -{ - const struct shim_nrf_twis_config *dev_config = dev->config; - struct shim_nrf_twis_data *dev_data = dev->data; - - if (dev_data->target_config != NULL) { - LOG_ERR("target registered"); - return -EPERM; - } - -#if CONFIG_PM_DEVICE - /* - * PM must have suspended the device before driver can - * be deinitialized - */ - if (!shim_nrf_twis_is_suspended(dev)) { - LOG_ERR("device active"); - return -EBUSY; - } -#else - /* Suspend device */ - shim_nrf_twis_disable(dev); -#endif - - /* Uninit device hardware */ - nrfx_twis_uninit(&dev_config->twis); - return 0; -} - #define SHIM_NRF_TWIS_NAME(id, name) \ _CONCAT_4(shim_nrf_twis_, name, _, id) @@ -361,10 +323,9 @@ static int shim_nrf_twis_deinit(const struct device *dev) shim_nrf_twis_pm_action_cb, \ ); \ \ - DEVICE_DT_DEINIT_DEFINE( \ + DEVICE_DT_DEFINE( \ SHIM_NRF_TWIS_NODE(id), \ shim_nrf_twis_init, \ - shim_nrf_twis_deinit, \ PM_DEVICE_DT_GET(SHIM_NRF_TWIS_NODE(id)), \ &SHIM_NRF_TWIS_NAME(id, data), \ &SHIM_NRF_TWIS_NAME(id, config), \ From 7c60d228434b5cae4746d4d1ad265c36b2021f4d Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:05 +0300 Subject: [PATCH 1469/2141] Revert "[nrf fromtree] drivers: i2c: nrfx_twim: impl device deinit" This reverts commit 68e71ff2c42d6d0254fb981a21954d4a491e00c1. Signed-off-by: Jukka Rissanen --- drivers/i2c/i2c_nrfx_twim.c | 8 +---- drivers/i2c/i2c_nrfx_twim_common.c | 50 +++--------------------------- drivers/i2c/i2c_nrfx_twim_common.h | 1 - drivers/i2c/i2c_nrfx_twim_rtio.c | 14 +++------ 4 files changed, 10 insertions(+), 63 deletions(-) diff --git a/drivers/i2c/i2c_nrfx_twim.c b/drivers/i2c/i2c_nrfx_twim.c index b6c37f455dc1..d5b619bfc5ac 100644 --- a/drivers/i2c/i2c_nrfx_twim.c +++ b/drivers/i2c/i2c_nrfx_twim.c @@ -224,11 +224,6 @@ static int i2c_nrfx_twim_init(const struct device *dev) return i2c_nrfx_twim_common_init(dev); } -static int i2c_nrfx_twim_deinit(const struct device *dev) -{ - return i2c_nrfx_twim_common_deinit(dev); -} - static DEVICE_API(i2c, i2c_nrfx_twim_driver_api) = { .configure = i2c_nrfx_twim_configure, .transfer = i2c_nrfx_twim_transfer, @@ -285,9 +280,8 @@ static DEVICE_API(i2c, i2c_nrfx_twim_driver_api) = { }; \ PM_DEVICE_DT_DEFINE(I2C(idx), twim_nrfx_pm_action, \ PM_DEVICE_ISR_SAFE); \ - I2C_DEVICE_DT_DEINIT_DEFINE(I2C(idx), \ + I2C_DEVICE_DT_DEFINE(I2C(idx), \ i2c_nrfx_twim_init, \ - i2c_nrfx_twim_deinit, \ PM_DEVICE_DT_GET(I2C(idx)), \ &twim_##idx##_data, \ &twim_##idx##z_config, \ diff --git a/drivers/i2c/i2c_nrfx_twim_common.c b/drivers/i2c/i2c_nrfx_twim_common.c index f7fd0d097b0a..1539d7c90ddd 100644 --- a/drivers/i2c/i2c_nrfx_twim_common.c +++ b/drivers/i2c/i2c_nrfx_twim_common.c @@ -102,30 +102,18 @@ int i2c_nrfx_twim_msg_transfer(const struct device *dev, uint8_t flags, uint8_t return ret; } -void twim_nrfx_pm_resume(const struct device *dev) -{ - const struct i2c_nrfx_twim_common_config *config = dev->config; - - (void)pinctrl_apply_state(config->pcfg, PINCTRL_STATE_DEFAULT); - nrfx_twim_enable(&config->twim); -} - -void twim_nrfx_pm_suspend(const struct device *dev) +int twim_nrfx_pm_action(const struct device *dev, enum pm_device_action action) { const struct i2c_nrfx_twim_common_config *config = dev->config; - nrfx_twim_disable(&config->twim); - (void)pinctrl_apply_state(config->pcfg, PINCTRL_STATE_SLEEP); -} - -int twim_nrfx_pm_action(const struct device *dev, enum pm_device_action action) -{ switch (action) { case PM_DEVICE_ACTION_RESUME: - twim_nrfx_pm_resume(dev); + (void)pinctrl_apply_state(config->pcfg, PINCTRL_STATE_DEFAULT); + nrfx_twim_enable(&config->twim); break; case PM_DEVICE_ACTION_SUSPEND: - twim_nrfx_pm_suspend(dev); + nrfx_twim_disable(&config->twim); + (void)pinctrl_apply_state(config->pcfg, PINCTRL_STATE_SLEEP); break; default: return -ENOTSUP; @@ -150,31 +138,3 @@ int i2c_nrfx_twim_common_init(const struct device *dev) return pm_device_driver_init(dev, twim_nrfx_pm_action); } - -int i2c_nrfx_twim_common_deinit(const struct device *dev) -{ - const struct i2c_nrfx_twim_common_config *config = dev->config; -#if CONFIG_PM_DEVICE - enum pm_device_state state; -#endif - -#if CONFIG_PM_DEVICE - /* - * PM must have suspended the device before driver can - * be deinitialized - */ - (void)pm_device_state_get(dev, &state); - if (state != PM_DEVICE_STATE_SUSPENDED && - state != PM_DEVICE_STATE_OFF) { - LOG_ERR("device active"); - return -EBUSY; - } -#else - /* Suspend device */ - twim_nrfx_pm_suspend(dev); -#endif - - /* Uninit device hardware */ - nrfx_twim_uninit(&config->twim); - return 0; -} diff --git a/drivers/i2c/i2c_nrfx_twim_common.h b/drivers/i2c/i2c_nrfx_twim_common.h index 3c5c82311bae..ba7fa72f0198 100644 --- a/drivers/i2c/i2c_nrfx_twim_common.h +++ b/drivers/i2c/i2c_nrfx_twim_common.h @@ -43,7 +43,6 @@ struct i2c_nrfx_twim_common_config { }; int i2c_nrfx_twim_common_init(const struct device *dev); -int i2c_nrfx_twim_common_deinit(const struct device *dev); int i2c_nrfx_twim_configure(const struct device *dev, uint32_t i2c_config); int i2c_nrfx_twim_recover_bus(const struct device *dev); int i2c_nrfx_twim_msg_transfer(const struct device *dev, uint8_t flags, uint8_t *buf, diff --git a/drivers/i2c/i2c_nrfx_twim_rtio.c b/drivers/i2c/i2c_nrfx_twim_rtio.c index 5eef549ba2e7..6a7504dbd628 100644 --- a/drivers/i2c/i2c_nrfx_twim_rtio.c +++ b/drivers/i2c/i2c_nrfx_twim_rtio.c @@ -203,7 +203,7 @@ static DEVICE_API(i2c, i2c_nrfx_twim_driver_api) = { .iodev_submit = i2c_nrfx_twim_rtio_submit, }; -static int i2c_nrfx_twim_rtio_init(const struct device *dev) +int i2c_nrfx_twim_rtio_init(const struct device *dev) { const struct i2c_nrfx_twim_rtio_config *config = dev->config; @@ -211,11 +211,6 @@ static int i2c_nrfx_twim_rtio_init(const struct device *dev) return i2c_nrfx_twim_common_init(dev); } -static int i2c_nrfx_twim_rtio_deinit(const struct device *dev) -{ - return i2c_nrfx_twim_common_deinit(dev); -} - #define CONCAT_BUF_SIZE(idx) \ COND_CODE_1(DT_NODE_HAS_PROP(I2C(idx), zephyr_concat_buf_size), \ (DT_PROP(I2C(idx), zephyr_concat_buf_size)), (0)) @@ -287,10 +282,9 @@ static int i2c_nrfx_twim_rtio_deinit(const struct device *dev) .ctx = &_i2c##idx##_twim_rtio, \ }; \ PM_DEVICE_DT_DEFINE(I2C(idx), twim_nrfx_pm_action, PM_DEVICE_ISR_SAFE); \ - I2C_DEVICE_DT_DEINIT_DEFINE(I2C(idx), i2c_nrfx_twim_rtio_init, i2c_nrfx_twim_rtio_deinit, \ - PM_DEVICE_DT_GET(I2C(idx)), &twim_##idx##z_data, \ - &twim_##idx##z_config, POST_KERNEL, CONFIG_I2C_INIT_PRIORITY, \ - &i2c_nrfx_twim_driver_api); + I2C_DEVICE_DT_DEFINE(I2C(idx), i2c_nrfx_twim_rtio_init, PM_DEVICE_DT_GET(I2C(idx)), \ + &twim_##idx##z_data, &twim_##idx##z_config, POST_KERNEL, \ + CONFIG_I2C_INIT_PRIORITY, &i2c_nrfx_twim_driver_api); #ifdef CONFIG_HAS_HW_NRF_TWIM0 I2C_NRFX_TWIM_RTIO_DEVICE(0); From 07ce1faf2b91bd0a576142ad0af2e114c10b00f9 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:06 +0300 Subject: [PATCH 1470/2141] Revert "[nrf fromtree] drivers: i2c: add I2C_DEVICE_DT_DEINIT macros" This reverts commit 8881b5d8c2c10de06737d27947cd247975814850. Signed-off-by: Jukka Rissanen --- include/zephyr/drivers/i2c.h | 37 ++++++++---------------------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/include/zephyr/drivers/i2c.h b/include/zephyr/drivers/i2c.h index c1972782660c..09640e3275d3 100644 --- a/include/zephyr/drivers/i2c.h +++ b/include/zephyr/drivers/i2c.h @@ -635,7 +635,7 @@ static inline void i2c_xfer_stats(const struct device *dev, struct i2c_msg *msgs /** @endcond */ /** - * @brief Like DEVICE_DT_DEINIT_DEFINE() with I2C specifics. + * @brief Like DEVICE_DT_DEFINE() with I2C specifics. * * @details Defines a device which implements the I2C API. May * generate a custom device_state container struct and init_fn @@ -645,8 +645,6 @@ static inline void i2c_xfer_stats(const struct device *dev, struct i2c_msg *msgs * * @param init_fn Name of the init function of the driver. Can be `NULL`. * - * @param deinit_fn Name of the deinit function of the driver. Can be `NULL`. - * * @param pm PM device resources reference (NULL if device does not use PM). * * @param data Pointer to the device's private data. @@ -663,14 +661,14 @@ static inline void i2c_xfer_stats(const struct device *dev, struct i2c_msg *msgs * @param api Provides an initial pointer to the API function struct * used by the driver. Can be NULL. */ -#define I2C_DEVICE_DT_DEINIT_DEFINE(node_id, init_fn, deinit_fn, pm, \ - data, config, level, prio, api, ...)\ +#define I2C_DEVICE_DT_DEFINE(node_id, init_fn, pm, data, config, level, \ + prio, api, ...) \ Z_I2C_DEVICE_STATE_DEFINE(Z_DEVICE_DT_DEV_ID(node_id)); \ Z_I2C_INIT_FN(Z_DEVICE_DT_DEV_ID(node_id), init_fn) \ Z_DEVICE_DEFINE(node_id, Z_DEVICE_DT_DEV_ID(node_id), \ DEVICE_DT_NAME(node_id), \ &UTIL_CAT(Z_DEVICE_DT_DEV_ID(node_id), _init), \ - deinit_fn, Z_DEVICE_DT_FLAGS(node_id), pm, data,\ + NULL, Z_DEVICE_DT_FLAGS(node_id), pm, data, \ config, level, prio, api, \ &(Z_DEVICE_STATE_NAME(Z_DEVICE_DT_DEV_ID(node_id)).devstate), \ __VA_ARGS__) @@ -685,32 +683,12 @@ static inline void i2c_xfer_stats(const struct device *dev, struct i2c_msg *msgs ARG_UNUSED(num_msgs); } -#define I2C_DEVICE_DT_DEINIT_DEFINE(node_id, init_fn, deinit_fn, pm, \ - data, config, level, prio, api, ...)\ - DEVICE_DT_DEINIT_DEFINE(node_id, init_fn, deinit_fn, pm, data, \ - config, level, prio, api, __VA_ARGS__) - -#endif /* CONFIG_I2C_STATS */ - -/** - * @brief Like I2C_DEVICE_DT_DEINIT_DEFINE() but without deinit_fn - */ #define I2C_DEVICE_DT_DEFINE(node_id, init_fn, pm, data, config, level, \ prio, api, ...) \ - I2C_DEVICE_DT_DEINIT_DEFINE(node_id, init_fn, NULL, pm, data, \ - config, level, prio, api, \ - __VA_ARGS__) + DEVICE_DT_DEFINE(node_id, init_fn, pm, data, config, level, \ + prio, api, __VA_ARGS__) -/** - * @brief Like I2C_DEVICE_DT_DEINIT_DEFINE() for an instance of a DT_DRV_COMPAT compatible - * - * @param inst instance number. This is replaced by - * DT_DRV_COMPAT(inst) in the call to I2C_DEVICE_DT_DEINIT_DEFINE(). - * - * @param ... other parameters as expected by I2C_DEVICE_DT_DEINIT_DEFINE(). - */ -#define I2C_DEVICE_DT_INST_DEINIT_DEFINE(inst, ...) \ - I2C_DEVICE_DT_DEINIT_DEFINE(DT_DRV_INST(inst), __VA_ARGS__) +#endif /* CONFIG_I2C_STATS */ /** * @brief Like I2C_DEVICE_DT_DEFINE() for an instance of a DT_DRV_COMPAT compatible @@ -723,6 +701,7 @@ static inline void i2c_xfer_stats(const struct device *dev, struct i2c_msg *msgs #define I2C_DEVICE_DT_INST_DEFINE(inst, ...) \ I2C_DEVICE_DT_DEFINE(DT_DRV_INST(inst), __VA_ARGS__) + /** * @brief Configure operation of a host controller. * From 778d39a3ec0d7a6f21ac230bac2c8fe685f08764 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:06 +0300 Subject: [PATCH 1471/2141] Revert "[nrf fromtree] tests: drivers: spi: loopback: extend nrf overlays with miso/mosi" This reverts commit 722d5bce6a113aa94319e2c15d32d82a34950221. Signed-off-by: Jukka Rissanen --- .../spi_loopback/boards/nrf54h20dk_nrf54h20_common.dtsi | 9 --------- 1 file changed, 9 deletions(-) diff --git a/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_common.dtsi b/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_common.dtsi index 5111257a557d..33170beda44e 100644 --- a/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_common.dtsi +++ b/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_common.dtsi @@ -4,15 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include - -/ { - zephyr,user { - miso-gpios = <&gpio0 6 GPIO_ACTIVE_HIGH>; - mosi-gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>; - }; -}; - &pinctrl { spi130_default: spi130_default { group1 { From 6a0389338d5e3b6ecf72bce829448665a6b4f4d2 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:06 +0300 Subject: [PATCH 1472/2141] Revert "[nrf fromtree] tests: drivers: spi: loopback: test device_deinit" This reverts commit 188ea59e2d785838c365a31910d0b74d4cc696e6. Signed-off-by: Jukka Rissanen --- tests/drivers/spi/spi_loopback/src/spi.c | 33 +----------------------- 1 file changed, 1 insertion(+), 32 deletions(-) diff --git a/tests/drivers/spi/spi_loopback/src/spi.c b/tests/drivers/spi/spi_loopback/src/spi.c index fd2302a4ec0b..5419a7493518 100644 --- a/tests/drivers/spi/spi_loopback/src/spi.c +++ b/tests/drivers/spi/spi_loopback/src/spi.c @@ -16,7 +16,6 @@ #include #include #include -#include #include #include #include @@ -57,8 +56,7 @@ static int spec_idx; */ struct spi_dt_spec spec_copies[5]; -const struct gpio_dt_spec miso_pin = GPIO_DT_SPEC_GET_OR(DT_PATH(zephyr_user), miso_gpios, {}); -const struct gpio_dt_spec mosi_pin = GPIO_DT_SPEC_GET_OR(DT_PATH(zephyr_user), mosi_gpios, {}); + /* ******************** @@ -809,35 +807,6 @@ ZTEST(spi_loopback, test_spi_concurrent_transfer_different_spec) test_spi_concurrent_transfer_helper(specs); } -ZTEST(spi_loopback, test_spi_deinit) -{ - struct spi_dt_spec *spec = loopback_specs[0]; - const struct device *dev = spec->bus; - int ret; - - if (miso_pin.port == NULL || mosi_pin.port == NULL) { - TC_PRINT(" zephyr,user miso-gpios or mosi-gpios are not defined\n"); - ztest_test_skip(); - } - - ret = device_deinit(dev); - if (ret == -ENOTSUP) { - TC_PRINT(" device deinit not supported\n"); - ztest_test_skip(); - } - - zassert_ok(ret); - zassert_ok(gpio_pin_configure_dt(&miso_pin, GPIO_INPUT)); - zassert_ok(gpio_pin_configure_dt(&mosi_pin, GPIO_OUTPUT_INACTIVE)); - zassert_equal(gpio_pin_get_dt(&miso_pin), 0); - zassert_ok(gpio_pin_set_dt(&mosi_pin, 1)); - zassert_equal(gpio_pin_get_dt(&miso_pin), 1); - zassert_ok(gpio_pin_set_dt(&mosi_pin, 0)); - zassert_equal(gpio_pin_get_dt(&miso_pin), 0); - zassert_ok(gpio_pin_configure_dt(&mosi_pin, GPIO_INPUT)); - zassert_ok(device_init(dev)); -} - #if (CONFIG_SPI_ASYNC) static struct k_poll_signal async_sig = K_POLL_SIGNAL_INITIALIZER(async_sig); static struct k_poll_event async_evt = From b653a6e3eea62001e6ea2d391103103874fad6e7 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:06 +0300 Subject: [PATCH 1473/2141] Revert "[nrf fromtree] drivers: spi: nrfx spim: impl device deinit" This reverts commit 6bf1032959a3f081be41895ee7612bf8507c11d6. Signed-off-by: Jukka Rissanen --- drivers/spi/spi_nrfx_spim.c | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/drivers/spi/spi_nrfx_spim.c b/drivers/spi/spi_nrfx_spim.c index a5c4e30f190e..c77e256a7fed 100644 --- a/drivers/spi/spi_nrfx_spim.c +++ b/drivers/spi/spi_nrfx_spim.c @@ -765,28 +765,6 @@ static int spi_nrfx_init(const struct device *dev) #endif return pm_device_driver_init(dev, spim_nrfx_pm_action); } - -static int spi_nrfx_deinit(const struct device *dev) -{ -#if defined(CONFIG_PM_DEVICE) - enum pm_device_state state; - - /* - * PM must have suspended the device before driver can - * be deinitialized - */ - (void)pm_device_state_get(dev, &state); - return state == PM_DEVICE_STATE_SUSPENDED || - state == PM_DEVICE_STATE_OFF ? - 0 : -EBUSY; -#else - /* PM suspend implementation does everything we need */ - spim_suspend(dev); -#endif - - return 0; -} - /* * We use NODELABEL here because the nrfx API requires us to call * functions which are named according to SoC peripheral instance @@ -892,9 +870,8 @@ static int spi_nrfx_deinit(const struct device *dev) !(DT_GPIO_FLAGS(SPIM(idx), wake_gpios) & GPIO_ACTIVE_LOW),\ "WAKE line must be configured as active high"); \ PM_DEVICE_DT_DEFINE(SPIM(idx), spim_nrfx_pm_action); \ - SPI_DEVICE_DT_DEINIT_DEFINE(SPIM(idx), \ + SPI_DEVICE_DT_DEFINE(SPIM(idx), \ spi_nrfx_init, \ - spi_nrfx_deinit, \ PM_DEVICE_DT_GET(SPIM(idx)), \ &spi_##idx##_data, \ &spi_##idx##z_config, \ From 074b482bfb929954e1ab3d1e13327def9d46f2d5 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:06 +0300 Subject: [PATCH 1474/2141] Revert "[nrf fromtree] drivers: spi: add DEINIT_ variants of SPI_DEVICE_ macros" This reverts commit 7d657f646c8ae7d4a4404b4bc1635d94329eff7b. Signed-off-by: Jukka Rissanen --- include/zephyr/drivers/spi.h | 56 +++++++----------------------------- 1 file changed, 10 insertions(+), 46 deletions(-) diff --git a/include/zephyr/drivers/spi.h b/include/zephyr/drivers/spi.h index 08a3f03137bc..8e8cdb5a9941 100644 --- a/include/zephyr/drivers/spi.h +++ b/include/zephyr/drivers/spi.h @@ -657,16 +657,16 @@ struct spi_device_state { } /** @endcond */ -#define SPI_DEVICE_DT_DEINIT_DEFINE(node_id, init_fn, deinit_fn, \ - pm_device, data_ptr, cfg_ptr, \ - level, prio, api_ptr, ...) \ +#define SPI_DEVICE_DT_DEFINE(node_id, init_fn, pm_device, \ + data_ptr, cfg_ptr, level, prio, \ + api_ptr, ...) \ Z_SPI_DEVICE_STATE_DEFINE(Z_DEVICE_DT_DEV_ID(node_id)); \ Z_SPI_INIT_FN(Z_DEVICE_DT_DEV_ID(node_id), init_fn) \ Z_DEVICE_DEFINE(node_id, Z_DEVICE_DT_DEV_ID(node_id), \ DEVICE_DT_NAME(node_id), \ &UTIL_CAT(Z_DEVICE_DT_DEV_ID(node_id), _init), \ - deinit_fn, Z_DEVICE_DT_FLAGS(node_id), \ - pm_device, data_ptr, cfg_ptr, level, prio, \ + NULL, Z_DEVICE_DT_FLAGS(node_id), pm_device, \ + data_ptr, cfg_ptr, level, prio, \ api_ptr, \ &(Z_DEVICE_STATE_NAME(Z_DEVICE_DT_DEV_ID(node_id)).devstate), \ __VA_ARGS__) @@ -700,9 +700,8 @@ static inline void spi_transceive_stats(const struct device *dev, int error, * @name SPI DT Device Macros * @{ */ - /** - * @brief Like DEVICE_DT_DEINIT_DEFINE() with SPI specifics. + * @brief Like DEVICE_DT_DEFINE() with SPI specifics. * * @details Defines a device which implements the SPI API. May * generate a custom device_state container struct and init_fn @@ -710,7 +709,6 @@ static inline void spi_transceive_stats(const struct device *dev, int error, * * @param node_id The devicetree node identifier. * @param init_fn Name of the init function of the driver. - * @param deinit_fn Name of the deinit function of the driver. * @param pm PM device resources reference (NULL if device does not use PM). * @param data Pointer to the device's private data. * @param config The address to the structure containing the configuration @@ -721,16 +719,16 @@ static inline void spi_transceive_stats(const struct device *dev, int error, * @param api Provides an initial pointer to the API function struct used by * the driver. Can be NULL. */ -#define SPI_DEVICE_DT_DEINIT_DEFINE(node_id, init_fn, deinit_fn, pm, data, \ - config, level, prio, api, ...) \ +#define SPI_DEVICE_DT_DEFINE(node_id, init_fn, pm, \ + data, config, level, prio, \ + api, ...) \ Z_DEVICE_STATE_DEFINE(Z_DEVICE_DT_DEV_ID(node_id)); \ Z_DEVICE_DEFINE(node_id, Z_DEVICE_DT_DEV_ID(node_id), \ - DEVICE_DT_NAME(node_id), init_fn, deinit_fn, \ + DEVICE_DT_NAME(node_id), init_fn, NULL, \ Z_DEVICE_DT_FLAGS(node_id), pm, data, config, \ level, prio, api, \ &Z_DEVICE_STATE_NAME(Z_DEVICE_DT_DEV_ID(node_id)), \ __VA_ARGS__) - /** @} */ #define SPI_STATS_RX_BYTES_INC(dev_) @@ -741,40 +739,6 @@ static inline void spi_transceive_stats(const struct device *dev, int error, #endif /*CONFIG_SPI_STATS*/ -/** - * @brief Like DEVICE_DT_DEINIT_DEFINE() without deinit function. - * - * @details Defines a device which implements the SPI API. May - * generate a custom device_state container struct and init_fn - * wrapper when needed depending on SPI @kconfig{CONFIG_SPI_STATS}. - * - * @param node_id The devicetree node identifier. - * @param init_fn Name of the init function of the driver. - * @param pm PM device resources reference (NULL if device does not use PM). - * @param data Pointer to the device's private data. - * @param config The address to the structure containing the configuration - * information for this instance of the driver. - * @param level The initialization level. See SYS_INIT() for details. - * @param prio Priority within the selected initialization level. See SYS_INIT() - * for details. - * @param api Provides an initial pointer to the API function struct used by - * the driver. Can be NULL. - */ -#define SPI_DEVICE_DT_DEFINE(node_id, init_fn, pm, data, config, level, prio, \ - api, ...) \ - SPI_DEVICE_DT_DEINIT_DEFINE(node_id, init_fn, NULL, pm, data, config, \ - level, prio, api, __VA_ARGS__) - -/** - * @brief Like SPI_DEVICE_DT_DEINIT_DEFINE(), but uses an instance of a `DT_DRV_COMPAT` - * compatible instead of a node identifier. - * - * @param inst Instance number. The `node_id` argument to SPI_DEVICE_DT_DEINIT_DEFINE() is - * set to `DT_DRV_INST(inst)`. - * @param ... Other parameters as expected by SPI_DEVICE_DT_DEFINE(). - */ -#define SPI_DEVICE_DT_INST_DEINIT_DEFINE(inst, ...) \ - SPI_DEVICE_DT_DEINIT_DEFINE(DT_DRV_INST(inst), __VA_ARGS__) /** * @brief Like SPI_DEVICE_DT_DEFINE(), but uses an instance of a `DT_DRV_COMPAT` From bfde206f36d5ac44238fb8613660afd17845ee8a Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:06 +0300 Subject: [PATCH 1475/2141] Revert "[nrf fromtree] drivers: pinctrl: nrf: patch pin retain to follow lp mode" This reverts commit 971e2e3c7d69adb685d35d3050767064927f7ebf. Signed-off-by: Jukka Rissanen --- drivers/pinctrl/pinctrl_nrf.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/drivers/pinctrl/pinctrl_nrf.c b/drivers/pinctrl/pinctrl_nrf.c index 07941fcb5ad5..3744abf80313 100644 --- a/drivers/pinctrl/pinctrl_nrf.c +++ b/drivers/pinctrl/pinctrl_nrf.c @@ -483,13 +483,9 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, } gpd_requested = true; } - } - /* - * Pad power domain now on, retain no longer needed - * as pad config will be persists as pad is powered. - */ - nrf_gpio_pin_retain_disable(pin); + nrf_gpio_pin_retain_disable(pin); + } #endif /* CONFIG_SOC_NRF54H20_GPD */ if (write != NO_WRITE) { @@ -508,13 +504,7 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, nrf_gpio_pin_clock_set(pin, NRF_GET_CLOCKPIN_ENABLE(pins[i])); #endif #ifdef CONFIG_SOC_NRF54H20_GPD - if (NRF_GET_LP(pins[i]) == NRF_LP_ENABLE) { - /* - * Pad power domain may be turned off, and pad is not - * actively used as pincnf is low-power. Enable retain - * to ensure pad output and config persists if pad - * power domain is suspended. - */ + if (NRF_GET_GPD_FAST_ACTIVE1(pins[i]) == 1U) { nrf_gpio_pin_retain_enable(pin); } #endif /* CONFIG_SOC_NRF54H20_GPD */ From 0a32a8d4b4255bfb9dc0947e9c4bfd9d5643b6de Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:06 +0300 Subject: [PATCH 1476/2141] Revert "[nrf fromtree] drivers: gpio: nrfx: extend pin retain to every pin" This reverts commit 723be97ffae963033c55d6edc2e7e439d5c15e8a. Signed-off-by: Jukka Rissanen --- drivers/gpio/gpio_nrfx.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/drivers/gpio/gpio_nrfx.c b/drivers/gpio/gpio_nrfx.c index 0a94b84c67fd..b6548ed22d53 100644 --- a/drivers/gpio/gpio_nrfx.c +++ b/drivers/gpio/gpio_nrfx.c @@ -64,15 +64,20 @@ static nrf_gpio_pin_pull_t get_pull(gpio_flags_t flags) return NRF_GPIO_PIN_NOPULL; } -static void gpio_nrfx_gpd_retain_set(const struct device *port, uint32_t mask) +static void gpio_nrfx_gpd_retain_set(const struct device *port, uint32_t mask, gpio_flags_t flags) { #ifdef CONFIG_SOC_NRF54H20_GPD const struct gpio_nrfx_cfg *cfg = get_port_cfg(port); + if (cfg->pad_pd != NRF_GPD_FAST_ACTIVE1 || !(flags & GPIO_OUTPUT)) { + return; + } + nrf_gpio_port_retain_enable(cfg->port, mask); #else ARG_UNUSED(port); ARG_UNUSED(mask); + ARG_UNUSED(flags); #endif } @@ -81,6 +86,10 @@ static void gpio_nrfx_gpd_retain_clear(const struct device *port, uint32_t mask) #ifdef CONFIG_SOC_NRF54H20_GPD const struct gpio_nrfx_cfg *cfg = get_port_cfg(port); + if (cfg->pad_pd != NRF_GPD_FAST_ACTIVE1) { + return; + } + nrf_gpio_port_retain_disable(cfg->port, mask); #else ARG_UNUSED(port); @@ -216,7 +225,7 @@ static int gpio_nrfx_pin_configure(const struct device *port, gpio_pin_t pin, } end: - gpio_nrfx_gpd_retain_set(port, BIT(pin)); + gpio_nrfx_gpd_retain_set(port, BIT(pin), flags); return pm_device_runtime_put(port); } @@ -320,7 +329,7 @@ static int gpio_nrfx_port_set_masked_raw(const struct device *port, gpio_nrfx_gpd_retain_clear(port, mask); nrf_gpio_port_out_set(reg, set_mask); nrf_gpio_port_out_clear(reg, clear_mask); - gpio_nrfx_gpd_retain_set(port, mask); + gpio_nrfx_gpd_retain_set(port, mask, GPIO_OUTPUT); return pm_device_runtime_put(port); } @@ -337,7 +346,7 @@ static int gpio_nrfx_port_set_bits_raw(const struct device *port, gpio_nrfx_gpd_retain_clear(port, mask); nrf_gpio_port_out_set(reg, mask); - gpio_nrfx_gpd_retain_set(port, mask); + gpio_nrfx_gpd_retain_set(port, mask, GPIO_OUTPUT); return pm_device_runtime_put(port); } @@ -354,7 +363,7 @@ static int gpio_nrfx_port_clear_bits_raw(const struct device *port, gpio_nrfx_gpd_retain_clear(port, mask); nrf_gpio_port_out_clear(reg, mask); - gpio_nrfx_gpd_retain_set(port, mask); + gpio_nrfx_gpd_retain_set(port, mask, GPIO_OUTPUT); return pm_device_runtime_put(port); } @@ -375,7 +384,7 @@ static int gpio_nrfx_port_toggle_bits(const struct device *port, gpio_nrfx_gpd_retain_clear(port, mask); nrf_gpio_port_out_set(reg, set_mask); nrf_gpio_port_out_clear(reg, clear_mask); - gpio_nrfx_gpd_retain_set(port, mask); + gpio_nrfx_gpd_retain_set(port, mask, GPIO_OUTPUT); return pm_device_runtime_put(port); } From 91740aa9e3b4021d8dccb52e5344f19d7eda418a Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:06 +0300 Subject: [PATCH 1477/2141] Revert "[nrf fromtree] samples: Bluetooth: BAP: BA: Reset states and modify error checking" This reverts commit 27f9e51b1794e4d491e22d77b472e4ed4b845b22. Signed-off-by: Jukka Rissanen --- .../bap_broadcast_assistant/src/main.c | 151 +++++++----------- 1 file changed, 62 insertions(+), 89 deletions(-) diff --git a/samples/bluetooth/bap_broadcast_assistant/src/main.c b/samples/bluetooth/bap_broadcast_assistant/src/main.c index 6458bfe60fe3..a0471f2ee6f0 100644 --- a/samples/bluetooth/bap_broadcast_assistant/src/main.c +++ b/samples/bluetooth/bap_broadcast_assistant/src/main.c @@ -1,12 +1,11 @@ /* * Copyright (c) 2024 Demant A/S - * Copyright (c) 2024-2025 Nordic Semiconductor ASA + * Copyright (c) 2024 Nordic Semiconductor ASA * * SPDX-License-Identifier: Apache-2.0 */ #include -#include #include #include #include @@ -25,7 +24,6 @@ #include #include #include -#include #include #include #include @@ -35,8 +33,6 @@ #define PA_SYNC_SKIP 5 #define PA_SYNC_INTERVAL_TO_TIMEOUT_RATIO 20 /* Set the timeout relative to interval */ /* Broadcast IDs are 24bit, so this is out of valid range */ -/* Default semaphore timeout when waiting for an action */ -#define SEM_TIMEOUT K_SECONDS(10) static void scan_for_broadcast_sink(void); @@ -72,7 +68,6 @@ static K_SEM_DEFINE(sem_sink_disconnected, 0, 1); static K_SEM_DEFINE(sem_security_updated, 0, 1); static K_SEM_DEFINE(sem_bass_discovered, 0, 1); static K_SEM_DEFINE(sem_pa_synced, 0, 1); -static K_SEM_DEFINE(sem_pa_sync_terminted, 0, 1); static K_SEM_DEFINE(sem_received_base_subgroups, 0, 1); static bool device_found(struct bt_data *data, void *user_data) @@ -152,7 +147,6 @@ static bool base_store(struct bt_data *data, void *user_data) const struct bt_bap_base *base = bt_bap_base_get_base_from_ad(data); int base_size; int base_subgroup_count; - int err; /* Base is NULL if the data does not contain a valid BASE */ if (base == NULL) { @@ -174,19 +168,13 @@ static bool base_store(struct bt_data *data, void *user_data) } /* Compare BASE and copy if different */ - err = k_mutex_lock(&base_store_mutex, K_MSEC(100)); - if (err != 0) { - /* Could not get BASE mutex, wait for new to avoid blocking */ - return false; - } - + k_mutex_lock(&base_store_mutex, K_FOREVER); if ((size_t)base_size != received_base_size || memcmp(base, received_base, (size_t)base_size) != 0) { (void)memcpy(received_base, base, base_size); received_base_size = (size_t)base_size; } - err = k_mutex_unlock(&base_store_mutex); - __ASSERT_NO_MSG(err == 0); + k_mutex_unlock(&base_store_mutex); /* Stop parsing */ k_sem_give(&sem_received_base_subgroups); @@ -431,7 +419,9 @@ static void scan_for_broadcast_source(void) printk("Scanning for Broadcast Source successfully started\n"); err = k_sem_take(&sem_source_discovered, K_FOREVER); - __ASSERT_NO_MSG(err == 0); + if (err != 0) { + printk("Failed to take sem_source_discovered (err %d)\n", err); + } } static void scan_for_broadcast_sink(void) @@ -449,7 +439,9 @@ static void scan_for_broadcast_sink(void) printk("Scanning for Broadcast Sink successfully started\n"); err = k_sem_take(&sem_sink_discovered, K_FOREVER); - __ASSERT_NO_MSG(err == 0); + if (err != 0) { + printk("Failed to take sem_sink_discovered (err %d)\n", err); + } } static void connected(struct bt_conn *conn, uint8_t err) @@ -536,16 +528,6 @@ static void pa_sync_synced_cb(struct bt_le_per_adv_sync *sync, k_sem_give(&sem_pa_synced); } } -static void pa_sync_term_cb(struct bt_le_per_adv_sync *sync, - const struct bt_le_per_adv_sync_term_info *info) -{ - if (sync == pa_sync) { - printk("PA sync %p terminated with reason %u\n", sync, info->reason); - - k_sem_give(&sem_pa_sync_terminted); - pa_sync = NULL; - } -} static struct bt_bap_broadcast_assistant_cb ba_cbs = { .discover = bap_broadcast_assistant_discover_cb, @@ -554,49 +536,14 @@ static struct bt_bap_broadcast_assistant_cb ba_cbs = { static struct bt_le_per_adv_sync_cb pa_synced_cb = { .synced = pa_sync_synced_cb, - .term = pa_sync_term_cb, .recv = pa_recv, }; static void reset(void) { - int err; - - printk("\n\nResetting...\n\n"); - - if (broadcast_sink_conn != NULL) { - err = bt_conn_disconnect(broadcast_sink_conn, BT_HCI_ERR_LOCALHOST_TERM_CONN); - - if (err != 0) { - printk("bt_conn_disconnect failed with %d\n", err); - } else { - if (k_sem_take(&sem_sink_disconnected, SEM_TIMEOUT) != 0) { - /* This should not happen */ - - __ASSERT_NO_MSG(false); - } - } - __ASSERT_NO_MSG(err == 0); - } - - /* Ignore return value as scanning may already be stopped */ - (void)bt_le_scan_stop(); - - if (pa_sync != NULL) { - err = bt_le_per_adv_sync_delete(pa_sync); - - if (err != 0) { - printk("bt_le_per_adv_sync_delete failed with %d\n", err); - } else { - if (k_sem_take(&sem_pa_sync_terminted, SEM_TIMEOUT) != 0) { - /* This should not happen */ - - __ASSERT_NO_MSG(false); - } - } - __ASSERT_NO_MSG(err == 0); - } + printk("\n\nReset...\n\n"); + broadcast_sink_conn = NULL; selected_broadcast_id = BT_BAP_INVALID_BROADCAST_ID; selected_sid = 0; selected_pa_interval = 0; @@ -621,6 +568,7 @@ BT_CONN_CB_DEFINE(conn_callbacks) = { int main(void) { int err; + struct bt_bap_broadcast_assistant_add_src_param param = { 0 }; err = bt_enable(NULL); if (err) { @@ -637,33 +585,45 @@ int main(void) k_mutex_init(&base_store_mutex); while (true) { - struct bt_bap_broadcast_assistant_add_src_param param = {0}; - - reset(); - scan_for_broadcast_sink(); - err = k_sem_take(&sem_sink_connected, SEM_TIMEOUT); + err = k_sem_take(&sem_sink_connected, K_FOREVER); if (err != 0) { printk("Failed to take sem_sink_connected (err %d)\n", err); - continue; } err = bt_bap_broadcast_assistant_discover(broadcast_sink_conn); if (err != 0) { printk("Failed to discover BASS on the sink (err %d)\n", err); - continue; } - err = k_sem_take(&sem_security_updated, SEM_TIMEOUT); + err = k_sem_take(&sem_security_updated, K_SECONDS(10)); if (err != 0) { - printk("Failed to take sem_security_updated (err %d)\n", err); + printk("Failed to take sem_security_updated (err %d), resetting\n", err); + bt_conn_disconnect(broadcast_sink_conn, BT_HCI_ERR_AUTH_FAIL); + + if (k_sem_take(&sem_sink_disconnected, K_SECONDS(10)) != 0) { + /* This should not happen */ + return -ETIMEDOUT; + } + + reset(); continue; } - err = k_sem_take(&sem_bass_discovered, SEM_TIMEOUT); + err = k_sem_take(&sem_bass_discovered, K_SECONDS(10)); if (err != 0) { - printk("Failed to take sem_bass_discovered (err %d)\n", err); + if (err == -EAGAIN) { + printk("Failed to take sem_bass_discovered (err %d)\n", err); + } + bt_conn_disconnect(broadcast_sink_conn, BT_HCI_ERR_UNSUPP_REMOTE_FEATURE); + + if (k_sem_take(&sem_sink_disconnected, K_SECONDS(10)) != 0) { + /* This should not happen */ + return -ETIMEDOUT; + } + + reset(); continue; } @@ -676,19 +636,19 @@ int main(void) scan_for_broadcast_source(); - printk("Attempting to PA sync to the broadcaster with id 0x%06X\n", + printk("Scan stopped, attempting to PA sync to the broadcaster with id 0x%06X\n", selected_broadcast_id); err = pa_sync_create(); if (err != 0) { - printk("Could not create Broadcast PA sync: %d\n", err); - continue; + printk("Could not create Broadcast PA sync: %d, resetting\n", err); + return -ETIMEDOUT; } printk("Waiting for PA synced\n"); - err = k_sem_take(&sem_pa_synced, SEM_TIMEOUT); + err = k_sem_take(&sem_pa_synced, K_FOREVER); if (err != 0) { - printk("Failed to take sem_pa_synced (err %d)\n", err); - continue; + printk("sem_pa_synced timed out, resetting\n"); + return err; } memset(bass_subgroups, 0, sizeof(bass_subgroups)); @@ -701,29 +661,42 @@ int main(void) /* Wait to receive subgroups */ err = k_sem_take(&sem_received_base_subgroups, K_FOREVER); - __ASSERT_NO_MSG(err == 0); + if (err != 0) { + printk("Failed to take sem_received_base_subgroups (err %d)\n", err); + return err; + } - err = k_mutex_lock(&base_store_mutex, K_FOREVER); - __ASSERT_NO_MSG(err == 0); + k_mutex_lock(&base_store_mutex, K_FOREVER); err = bt_bap_base_foreach_subgroup((const struct bt_bap_base *)received_base, add_pa_sync_base_subgroup_cb, ¶m); - err = k_mutex_unlock(&base_store_mutex); - __ASSERT_NO_MSG(err == 0); + k_mutex_unlock(&base_store_mutex); - if (err != 0) { + if (err < 0) { printk("Could not add BASE to params %d\n", err); continue; } err = bt_bap_broadcast_assistant_add_src(broadcast_sink_conn, ¶m); - if (err != 0) { + if (err) { printk("Failed to add source: %d\n", err); + bt_conn_disconnect(broadcast_sink_conn, BT_HCI_ERR_UNSUPP_REMOTE_FEATURE); + + if (k_sem_take(&sem_sink_disconnected, K_SECONDS(10)) != 0) { + /* This should not happen */ + return -ETIMEDOUT; + } + + reset(); continue; } /* Reset if the sink disconnects */ err = k_sem_take(&sem_sink_disconnected, K_FOREVER); - __ASSERT_NO_MSG(err == 0); + if (err != 0) { + printk("Failed to take sem_sink_disconnected (err %d)\n", err); + } + + reset(); } return 0; From 9224c42ca1dde4da982204e5491f7290ab3291e4 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:06 +0300 Subject: [PATCH 1478/2141] Revert "[nrf fromtree] net: http_client: Fix handling of POLLHUP" This reverts commit bcb3484d592a8a1537652467e56361bb23080fd9. Signed-off-by: Jukka Rissanen --- subsys/net/lib/http/http_client.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/subsys/net/lib/http/http_client.c b/subsys/net/lib/http/http_client.c index 01cf8fb134e4..fe00609322ed 100644 --- a/subsys/net/lib/http/http_client.c +++ b/subsys/net/lib/http/http_client.c @@ -517,6 +517,9 @@ static int http_wait_data(int sock, struct http_request *req, const k_timepoint_ } else if (fds[0].revents & ZSOCK_POLLNVAL) { ret = -EBADF; goto error; + } else if (fds[0].revents & ZSOCK_POLLHUP) { + /* Connection closed */ + goto closed; } else if (fds[0].revents & ZSOCK_POLLIN) { received = zsock_recv(sock, req->internal.response.recv_buf + offset, req->internal.response.recv_buf_len - offset, 0); @@ -590,9 +593,6 @@ static int http_wait_data(int sock, struct http_request *req, const k_timepoint_ req->internal.response.recv_buf + processed, offset); } - } else if (fds[0].revents & ZSOCK_POLLHUP) { - /* Connection closed */ - goto closed; } } while (!req->internal.response.message_complete); From b8f4095461d92ade7e6ebe2f4f8f1306349498dd Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:06 +0300 Subject: [PATCH 1479/2141] Revert "[nrf fromtree] tests: drivers: build_all: add npm1300 and npm1304 devices" This reverts commit 99296da29b10237f76ac26359f50475b31cfffcb. Signed-off-by: Jukka Rissanen --- tests/drivers/build_all/gpio/app.overlay | 24 --------------- tests/drivers/build_all/led/app.overlay | 24 --------------- tests/drivers/build_all/regulator/i2c.dtsi | 14 --------- tests/drivers/build_all/sensor/i2c.dtsi | 29 ------------------- .../build_all/watchdog/i2c_devices.overlay | 18 ------------ 5 files changed, 109 deletions(-) diff --git a/tests/drivers/build_all/gpio/app.overlay b/tests/drivers/build_all/gpio/app.overlay index 367455b5f0db..ccb794dd8477 100644 --- a/tests/drivers/build_all/gpio/app.overlay +++ b/tests/drivers/build_all/gpio/app.overlay @@ -413,30 +413,6 @@ ngpios = <16>; int-gpios = <&test_gpio 0 0>; }; - - test_i2c_npm1300: pmic@1d { - compatible = "nordic,npm1300"; - reg = <0x1d>; - - npm1300_gpio: gpio-controller { - compatible = "nordic,npm1300-gpio"; - gpio-controller; - #gpio-cells = <2>; - ngpios = <5>; - }; - }; - - test_i2c_npm1304: pmic@1e { - compatible = "nordic,npm1304"; - reg = <0x1e>; - - npm1304_gpio: gpio-controller { - compatible = "nordic,npm1304-gpio"; - gpio-controller; - #gpio-cells = <2>; - ngpios = <5>; - }; - }; }; nct3807_alert_1 { diff --git a/tests/drivers/build_all/led/app.overlay b/tests/drivers/build_all/led/app.overlay index 6a48cc3d9054..e25825064a8a 100644 --- a/tests/drivers/build_all/led/app.overlay +++ b/tests/drivers/build_all/led/app.overlay @@ -168,30 +168,6 @@ x-powers,mode = "by-reg"; }; }; - - pmic@13 { - compatible = "nordic,npm1300"; - reg = <0x13>; - - leds { - compatible = "nordic,npm1300-led"; - nordic,led0-mode = "error"; - nordic,led1-mode = "charging"; - nordic,led2-mode = "host"; - }; - }; - - pmic@14 { - compatible = "nordic,npm1304"; - reg = <0x14>; - - leds { - compatible = "nordic,npm1304-led"; - nordic,led0-mode = "error"; - nordic,led1-mode = "charging"; - nordic,led2-mode = "host"; - }; - }; }; }; }; diff --git a/tests/drivers/build_all/regulator/i2c.dtsi b/tests/drivers/build_all/regulator/i2c.dtsi index 4c8cb31958a5..ea81c2c3886f 100644 --- a/tests/drivers/build_all/regulator/i2c.dtsi +++ b/tests/drivers/build_all/regulator/i2c.dtsi @@ -143,17 +143,3 @@ npm2100@8 { LDOSW {}; }; }; - -npm1304@9 { - compatible = "nordic,npm1304"; - reg = <0x9>; - - regulators { - compatible = "nordic,npm1304-regulator"; - - BUCK1 {}; - BUCK2 {}; - LDO1 {}; - LDO2 {}; - }; -}; diff --git a/tests/drivers/build_all/sensor/i2c.dtsi b/tests/drivers/build_all/sensor/i2c.dtsi index 64edbec396a2..6ebced542043 100644 --- a/tests/drivers/build_all/sensor/i2c.dtsi +++ b/tests/drivers/build_all/sensor/i2c.dtsi @@ -1331,32 +1331,3 @@ test_i2c_bh1730: bh1730@b4 { compatible = "rohm,bh1730"; reg = <0xb4>; }; - -test_i2c_npm1300: npm1300@b5 { - compatible = "nordic,npm1300"; - reg = <0xb5>; - - charger { - compatible = "nordic,npm1300-charger"; - vbus-limit-microamp = <1000000>; - thermistor-ohms = <10000>; - thermistor-beta = <3380>; - term-microvolt = <4150000>; - current-microamp = <150000>; - dischg-limit-microamp = <1000000>; - }; -}; - -test_i2c_npm1304: npm1304@b6 { - compatible = "nordic,npm1304"; - reg = <0xb6>; - - charger { - compatible = "nordic,npm1304-charger"; - vbus-limit-microamp = <1000000>; - thermistor-ohms = <10000>; - thermistor-beta = <3380>; - term-microvolt = <4150000>; - current-microamp = <10000>; - }; -}; diff --git a/tests/drivers/build_all/watchdog/i2c_devices.overlay b/tests/drivers/build_all/watchdog/i2c_devices.overlay index 0c709d30b06c..fcecf91a1228 100644 --- a/tests/drivers/build_all/watchdog/i2c_devices.overlay +++ b/tests/drivers/build_all/watchdog/i2c_devices.overlay @@ -41,24 +41,6 @@ compatible = "nordic,npm2100-wdt"; }; }; - - npm1300_pmic: pmic@2 { - compatible = "nordic,npm1300"; - reg = <0x2>; - - npm1300_wdt: watchdog { - compatible = "nordic,npm1300-wdt"; - }; - }; - - npm1304_pmic: pmic@3 { - compatible = "nordic,npm1304"; - reg = <0x3>; - - npm1304_wdt: watchdog { - compatible = "nordic,npm1304-wdt"; - }; - }; }; }; }; From 6fa02ef034385fb246a7b3cfe83b8840a73515cc Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:06 +0300 Subject: [PATCH 1480/2141] Revert "[nrf fromtree] doc: release: migration-guide-4.2: add npm13xx changes" This reverts commit 393d9d8dec4a106532cf156c51e4500ca8303eb3. Signed-off-by: Jukka Rissanen --- doc/releases/migration-guide-4.2.rst | 40 ---------------------------- 1 file changed, 40 deletions(-) diff --git a/doc/releases/migration-guide-4.2.rst b/doc/releases/migration-guide-4.2.rst index faad669e379e..e643142e0ba0 100644 --- a/doc/releases/migration-guide-4.2.rst +++ b/doc/releases/migration-guide-4.2.rst @@ -212,11 +212,6 @@ GPIO * ``arduino-nano-header-r3`` is renamed to :dtcompatible:`arduino-nano-header`. Because the R3 comes from the Arduino UNO R3, which has changed the connector from the former version, and is unrelated to the Arduino Nano. -* Moved file ``include/zephyr/dt-bindings/gpio/nordic-npm1300-gpio.h`` to - :zephyr_file:`include/zephyr/dt-bindings/gpio/nordic-npm13xx-gpio.h` and renamed all instances of - ``NPM1300`` to ``NPM13XX`` in the defines -* Renamed ``CONFIG_GPIO_NPM1300`` to :kconfig:option:`CONFIG_GPIO_NPM13XX`, - ``CONFIG_GPIO_NPM1300_INIT_PRIORITY`` to :kconfig:option:`CONFIG_GPIO_NPM13XX_INIT_PRIORITY` I2S === @@ -224,30 +219,6 @@ I2S * configure the MCLK signal as an output. Older driver versions used the macro * ``I2S_OPT_BIT_CLK_SLAVE`` to configure the MCLK signal direction. (:github:`88554`) -LED -=== - -* Renamed ``CONFIG_LED_NPM1300`` to :kconfig:option:`CONFIG_LED_NPM13XX` - -MFD -=== - -* Moved file ``include/zephyr/drivers/mfd/npm1300.h`` to :zephyr_file:`include/zephyr/drivers/mfd/npm13xx.h` - and renamed all instances of ``npm1300``/``NPM1300`` to ``npm13xx``/``NPM13XX`` in the enums and - function names -* Renamed ``CONFIG_MFD_NPM1300`` to :kconfig:option:`CONFIG_MFD_NPM13XX`, - ``CONFIG_MFD_NPM1300_INIT_PRIORITY`` to :kconfig:option:`CONFIG_MFD_NPM13XX_INIT_PRIORITY` - -Regulator -========= - -* Moved file ``include/zephyr/dt-bindings/regulator/npm1300.h`` to - :zephyr_file:`include/zephyr/dt-bindings/regulator/npm13xx.h` and renamed all instances of - ``NPM1300`` to ``NPM13XX`` in the defines -* Renamed ``CONFIG_REGULATOR_NPM1300`` to :kconfig:option:`CONFIG_REGULATOR_NPM13XX`, - ``CONFIG_REGULATOR_NPM1300_COMMON_INIT_PRIORITY`` to :kconfig:option:`REGULATOR_NPM13XX_COMMON_INIT_PRIORITY`, - ``CONFIG_REGULATOR_NPM1300_INIT_PRIORITY`` to :kconfig:option:`CONFIG_REGULATOR_NPM13XX_INIT_PRIORITY` - Sensors ======= @@ -284,12 +255,6 @@ Sensors * The binding file for :dtcompatible:`raspberrypi,pico-temp.yaml` has been renamed to have a name matching the compatible string. -* Moved file ``include/zephyr/drivers/sensor/npm1300_charger.h`` to - :zephyr_file:`include/zephyr/drivers/sensor/npm13xx_charger.h` and renamed all instances of - ``NPM1300`` to ``NPM13XX`` in the enums - -* Renamed ``CONFIG_NPM1300_CHARGER`` to :kconfig:option:`CONFIG_NPM13XX_CHARGER` - Serial ======= @@ -339,11 +304,6 @@ Timer reg-names = "mtime", "mtimecmp"; }; -Watchdog -======== -* Renamed ``CONFIG_WDT_NPM1300`` to :kconfig:option:`CONFIG_WDT_NPM13XX`, - ``CONFIG_WDT_NPM1300_INIT_PRIORITY`` to :kconfig:option:`CONFIG_WDT_NPM13XX_INIT_PRIORITY` - Modem ===== From 54244af4bf10fde1f817219138251f1793a62b7d Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:06 +0300 Subject: [PATCH 1481/2141] Revert "[nrf fromtree] drivers: npm13xx: add support for nPM1304" This reverts commit 37b7c9f56998b1b8d9def06a9d7421803edb3c71. Signed-off-by: Jukka Rissanen --- drivers/gpio/Kconfig.npm13xx | 2 +- drivers/gpio/gpio_npm13xx.c | 21 ++- drivers/led/Kconfig.npm13xx | 2 +- drivers/led/led_npm13xx.c | 17 +-- drivers/mfd/Kconfig.npm13xx | 2 +- drivers/mfd/mfd_npm13xx.c | 32 ++--- drivers/regulator/Kconfig.npm13xx | 2 +- drivers/regulator/regulator_npm13xx.c | 60 ++++---- drivers/sensor/nordic/npm13xx_charger/Kconfig | 2 +- .../nordic/npm13xx_charger/npm13xx_charger.c | 133 +++++++----------- drivers/watchdog/Kconfig.npm13xx | 2 +- drivers/watchdog/wdt_npm13xx.c | 20 +-- 12 files changed, 118 insertions(+), 177 deletions(-) diff --git a/drivers/gpio/Kconfig.npm13xx b/drivers/gpio/Kconfig.npm13xx index 1d3bade047db..828b4e1382f3 100644 --- a/drivers/gpio/Kconfig.npm13xx +++ b/drivers/gpio/Kconfig.npm13xx @@ -4,7 +4,7 @@ config GPIO_NPM13XX bool "nPM13xx GPIO driver" default y - depends on DT_HAS_NORDIC_NPM1300_GPIO_ENABLED || DT_HAS_NORDIC_NPM1304_GPIO_ENABLED + depends on DT_HAS_NORDIC_NPM1300_GPIO_ENABLED select I2C select MFD help diff --git a/drivers/gpio/gpio_npm13xx.c b/drivers/gpio/gpio_npm13xx.c index d6eeb4b73b01..c74fc244d937 100644 --- a/drivers/gpio/gpio_npm13xx.c +++ b/drivers/gpio/gpio_npm13xx.c @@ -3,6 +3,8 @@ * SPDX-License-Identifier: Apache-2.0 */ +#define DT_DRV_COMPAT nordic_npm1300_gpio + #include #include @@ -210,25 +212,18 @@ static int gpio_npm13xx_init(const struct device *dev) return 0; } -#define GPIO_NPM13XX_DEFINE(partno, n) \ - static const struct gpio_npm13xx_config gpio_##partno##_config##n = { \ +#define GPIO_NPM13XX_DEFINE(n) \ + static const struct gpio_npm13xx_config gpio_npm13xx_config##n = { \ .common = \ { \ .port_pin_mask = GPIO_PORT_PIN_MASK_FROM_DT_INST(n), \ }, \ .mfd = DEVICE_DT_GET(DT_INST_PARENT(n))}; \ \ - static struct gpio_npm13xx_data gpio_##partno##_data##n; \ + static struct gpio_npm13xx_data gpio_npm13xx_data##n; \ \ - DEVICE_DT_INST_DEFINE(n, gpio_npm13xx_init, NULL, &gpio_##partno##_data##n, \ - &gpio_##partno##_config##n, POST_KERNEL, \ + DEVICE_DT_INST_DEFINE(n, gpio_npm13xx_init, NULL, &gpio_npm13xx_data##n, \ + &gpio_npm13xx_config##n, POST_KERNEL, \ CONFIG_GPIO_NPM13XX_INIT_PRIORITY, &gpio_npm13xx_api); -#define DT_DRV_COMPAT nordic_npm1300_gpio -#define GPIO_NPM1300_DEFINE(n) GPIO_NPM13XX_DEFINE(npm1300, n) -DT_INST_FOREACH_STATUS_OKAY(GPIO_NPM1300_DEFINE) - -#undef DT_DRV_COMPAT -#define DT_DRV_COMPAT nordic_npm1304_gpio -#define GPIO_NPM1304_DEFINE(n) GPIO_NPM13XX_DEFINE(npm1304, n) -DT_INST_FOREACH_STATUS_OKAY(GPIO_NPM1304_DEFINE) +DT_INST_FOREACH_STATUS_OKAY(GPIO_NPM13XX_DEFINE) diff --git a/drivers/led/Kconfig.npm13xx b/drivers/led/Kconfig.npm13xx index 5431c7c8326f..e3f40f42a193 100644 --- a/drivers/led/Kconfig.npm13xx +++ b/drivers/led/Kconfig.npm13xx @@ -4,7 +4,7 @@ config LED_NPM13XX bool "nPM13xx LED driver" default y - depends on DT_HAS_NORDIC_NPM1300_LED_ENABLED || DT_HAS_NORDIC_NPM1304_LED_ENABLED + depends on DT_HAS_NORDIC_NPM1300_LED_ENABLED select I2C select MFD help diff --git a/drivers/led/led_npm13xx.c b/drivers/led/led_npm13xx.c index f00864fc74a6..eed9b1256bec 100644 --- a/drivers/led/led_npm13xx.c +++ b/drivers/led/led_npm13xx.c @@ -3,6 +3,8 @@ * SPDX-License-Identifier: Apache-2.0 */ +#define DT_DRV_COMPAT nordic_npm1300_led + #include #include @@ -85,21 +87,14 @@ static int led_npm13xx_init(const struct device *dev) return 0; } -#define LED_NPM13XX_DEFINE(partno, n) \ - static const struct led_npm13xx_config led_##partno##_config##n = { \ +#define LED_NPM13XX_DEFINE(n) \ + static const struct led_npm13xx_config led_npm13xx_config##n = { \ .mfd = DEVICE_DT_GET(DT_INST_PARENT(n)), \ .mode = {DT_INST_ENUM_IDX(n, nordic_led0_mode), \ DT_INST_ENUM_IDX(n, nordic_led1_mode), \ DT_INST_ENUM_IDX(n, nordic_led2_mode)}}; \ \ - DEVICE_DT_INST_DEFINE(n, &led_npm13xx_init, NULL, NULL, &led_##partno##_config##n, \ + DEVICE_DT_INST_DEFINE(n, &led_npm13xx_init, NULL, NULL, &led_npm13xx_config##n, \ POST_KERNEL, CONFIG_LED_INIT_PRIORITY, &led_npm13xx_api); -#define DT_DRV_COMPAT nordic_npm1300_led -#define LED_NPM1300_DEFINE(n) LED_NPM13XX_DEFINE(npm1300, n) -DT_INST_FOREACH_STATUS_OKAY(LED_NPM1300_DEFINE) - -#undef DT_DRV_COMPAT -#define DT_DRV_COMPAT nordic_npm1304_led -#define LED_NPM1304_DEFINE(n) LED_NPM13XX_DEFINE(npm1304, n) -DT_INST_FOREACH_STATUS_OKAY(LED_NPM1304_DEFINE) +DT_INST_FOREACH_STATUS_OKAY(LED_NPM13XX_DEFINE) diff --git a/drivers/mfd/Kconfig.npm13xx b/drivers/mfd/Kconfig.npm13xx index 6170c074aa8a..63f18ac9a3b3 100644 --- a/drivers/mfd/Kconfig.npm13xx +++ b/drivers/mfd/Kconfig.npm13xx @@ -4,7 +4,7 @@ config MFD_NPM13XX bool "nPM13xx PMIC multi-function device driver" default y - depends on DT_HAS_NORDIC_NPM1300_ENABLED || DT_HAS_NORDIC_NPM1304_ENABLED + depends on DT_HAS_NORDIC_NPM1300_ENABLED select I2C help Enable the Nordic nPM13xx PMIC multi-function device driver diff --git a/drivers/mfd/mfd_npm13xx.c b/drivers/mfd/mfd_npm13xx.c index 0d0b8e89f5f9..9847e4a9e495 100644 --- a/drivers/mfd/mfd_npm13xx.c +++ b/drivers/mfd/mfd_npm13xx.c @@ -3,6 +3,8 @@ * SPDX-License-Identifier: Apache-2.0 */ +#define DT_DRV_COMPAT nordic_npm1300 + #include #include @@ -306,26 +308,18 @@ int mfd_npm13xx_remove_callback(const struct device *dev, struct gpio_callback * return gpio_manage_callback(&data->callbacks, callback, false); } -#define MFD_NPM13XX_DEFINE(partno, n) \ - static struct mfd_npm13xx_data mfd_##partno##_data##n; \ +#define MFD_NPM13XX_DEFINE(inst) \ + static struct mfd_npm13xx_data data_##inst; \ \ - static const struct mfd_npm13xx_config mfd_##partno##_config##n = { \ - .i2c = I2C_DT_SPEC_INST_GET(n), \ - .host_int_gpios = GPIO_DT_SPEC_INST_GET_OR(n, host_int_gpios, {0}), \ - .pmic_int_pin = DT_INST_PROP_OR(n, pmic_int_pin, 0), \ - .active_time = DT_INST_ENUM_IDX(n, ship_to_active_time_ms), \ - .lp_reset = DT_INST_ENUM_IDX_OR(n, long_press_reset, 0), \ + static const struct mfd_npm13xx_config config##inst = { \ + .i2c = I2C_DT_SPEC_INST_GET(inst), \ + .host_int_gpios = GPIO_DT_SPEC_INST_GET_OR(inst, host_int_gpios, {0}), \ + .pmic_int_pin = DT_INST_PROP_OR(inst, pmic_int_pin, 0), \ + .active_time = DT_INST_ENUM_IDX(inst, ship_to_active_time_ms), \ + .lp_reset = DT_INST_ENUM_IDX_OR(inst, long_press_reset, 0), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, mfd_npm13xx_init, NULL, &mfd_##partno##_data##n, \ - &mfd_##partno##_config##n, POST_KERNEL, \ - CONFIG_MFD_NPM13XX_INIT_PRIORITY, NULL); - -#define DT_DRV_COMPAT nordic_npm1300 -#define MFD_NPM1300_DEFINE(n) MFD_NPM13XX_DEFINE(npm1300, n) -DT_INST_FOREACH_STATUS_OKAY(MFD_NPM1300_DEFINE) + DEVICE_DT_INST_DEFINE(inst, mfd_npm13xx_init, NULL, &data_##inst, &config##inst, \ + POST_KERNEL, CONFIG_MFD_NPM13XX_INIT_PRIORITY, NULL); -#undef DT_DRV_COMPAT -#define DT_DRV_COMPAT nordic_npm1304 -#define MFD_NPM1304_DEFINE(n) MFD_NPM13XX_DEFINE(npm1304, n) -DT_INST_FOREACH_STATUS_OKAY(MFD_NPM1304_DEFINE) +DT_INST_FOREACH_STATUS_OKAY(MFD_NPM13XX_DEFINE) diff --git a/drivers/regulator/Kconfig.npm13xx b/drivers/regulator/Kconfig.npm13xx index a075ca72dc7c..4d243b8cdf84 100644 --- a/drivers/regulator/Kconfig.npm13xx +++ b/drivers/regulator/Kconfig.npm13xx @@ -4,7 +4,7 @@ config REGULATOR_NPM13XX bool "nPM13xx PMIC regulator driver" default y - depends on DT_HAS_NORDIC_NPM1300_REGULATOR_ENABLED || DT_HAS_NORDIC_NPM1304_REGULATOR_ENABLED + depends on DT_HAS_NORDIC_NPM1300_REGULATOR_ENABLED select I2C select MFD help diff --git a/drivers/regulator/regulator_npm13xx.c b/drivers/regulator/regulator_npm13xx.c index c07970bb5c64..89ee1993ed39 100644 --- a/drivers/regulator/regulator_npm13xx.c +++ b/drivers/regulator/regulator_npm13xx.c @@ -3,6 +3,8 @@ * SPDX-License-Identifier: Apache-2.0 */ +#define DT_DRV_COMPAT nordic_npm1300_regulator + #include #include @@ -687,6 +689,9 @@ int regulator_npm13xx_init(const struct device *dev) } ret = regulator_npm13xx_set_pin_ctrl(dev, &config->pwm_gpios, NPM13XX_GPIO_TYPE_PWM); + if (ret != 0) { + return ret; + } return ret; } @@ -707,13 +712,13 @@ static DEVICE_API(regulator, api) = { !!(DT_PROP_BY_IDX(node_id, prop, 1) & GPIO_ACTIVE_LOW)}), \ ({NPM13XX_GPIO_UNUSED, false})) -#define REGULATOR_NPM13XX_DEFINE(partno, node_id, id, _source) \ +#define REGULATOR_NPM13XX_DEFINE(node_id, id, _source) \ BUILD_ASSERT(DT_PROP_LEN_OR(node_id, enable_gpio_config, 2) == 2); \ BUILD_ASSERT(DT_PROP_LEN_OR(node_id, retention_gpio_config, 2) == 2); \ BUILD_ASSERT(DT_PROP_LEN_OR(node_id, pwm_gpio_config, 2) == 2); \ - static struct regulator_npm13xx_data regulator_##partno##_data_##id; \ + static struct regulator_npm13xx_data data_##id; \ \ - static const struct regulator_npm13xx_config regulator_##partno##_config_##id = { \ + static const struct regulator_npm13xx_config config_##id = { \ .common = REGULATOR_DT_COMMON_CONFIG_INIT(node_id), \ .mfd = DEVICE_DT_GET(DT_GPARENT(node_id)), \ .source = _source, \ @@ -725,39 +730,30 @@ static DEVICE_API(regulator, api) = { .active_discharge = DT_PROP(node_id, active_discharge), \ .ldo_disable_workaround = DT_PROP(node_id, nordic_anomaly38_disable_workaround)}; \ \ - DEVICE_DT_DEFINE(node_id, regulator_npm13xx_init, NULL, ®ulator_##partno##_data_##id, \ - ®ulator_##partno##_config_##id, POST_KERNEL, \ - CONFIG_REGULATOR_NPM13XX_INIT_PRIORITY, &api); + DEVICE_DT_DEFINE(node_id, regulator_npm13xx_init, NULL, &data_##id, &config_##id, \ + POST_KERNEL, CONFIG_REGULATOR_NPM13XX_INIT_PRIORITY, &api); -#define REGULATOR_NPM13XX_DEFINE_COND(partno, n, child, source) \ - COND_CODE_1(DT_NODE_EXISTS(DT_INST_CHILD(n, child)), \ - (REGULATOR_NPM13XX_DEFINE(partno, DT_INST_CHILD(n, child), child##n, source)), \ +#define REGULATOR_NPM13XX_DEFINE_COND(inst, child, source) \ + COND_CODE_1(DT_NODE_EXISTS(DT_INST_CHILD(inst, child)), \ + (REGULATOR_NPM13XX_DEFINE(DT_INST_CHILD(inst, child), child##inst, source)), \ ()) -#define REGULATOR_NPM13XX_DEFINE_ALL(partno, n) \ - static const struct regulator_npm13xx_pconfig regulator_##partno##_config##n = { \ - .mfd = DEVICE_DT_GET(DT_INST_PARENT(n)), \ - .dvs_state_pins = {GPIO_DT_SPEC_INST_GET_BY_IDX_OR(n, dvs_gpios, 0, {0}), \ - GPIO_DT_SPEC_INST_GET_BY_IDX_OR(n, dvs_gpios, 1, {0}), \ - GPIO_DT_SPEC_INST_GET_BY_IDX_OR(n, dvs_gpios, 2, {0}), \ - GPIO_DT_SPEC_INST_GET_BY_IDX_OR(n, dvs_gpios, 3, {0}), \ - GPIO_DT_SPEC_INST_GET_BY_IDX_OR(n, dvs_gpios, 4, {0})}}; \ +#define REGULATOR_NPM13XX_DEFINE_ALL(inst) \ + static const struct regulator_npm13xx_pconfig config_##inst = { \ + .mfd = DEVICE_DT_GET(DT_INST_PARENT(inst)), \ + .dvs_state_pins = {GPIO_DT_SPEC_INST_GET_BY_IDX_OR(inst, dvs_gpios, 0, {0}), \ + GPIO_DT_SPEC_INST_GET_BY_IDX_OR(inst, dvs_gpios, 1, {0}), \ + GPIO_DT_SPEC_INST_GET_BY_IDX_OR(inst, dvs_gpios, 2, {0}), \ + GPIO_DT_SPEC_INST_GET_BY_IDX_OR(inst, dvs_gpios, 3, {0}), \ + GPIO_DT_SPEC_INST_GET_BY_IDX_OR(inst, dvs_gpios, 4, {0})}}; \ \ - DEVICE_DT_INST_DEFINE(n, regulator_npm13xx_common_init, NULL, NULL, \ - ®ulator_##partno##_config##n, POST_KERNEL, \ - CONFIG_REGULATOR_NPM13XX_COMMON_INIT_PRIORITY, \ + DEVICE_DT_INST_DEFINE(inst, regulator_npm13xx_common_init, NULL, NULL, &config_##inst, \ + POST_KERNEL, CONFIG_REGULATOR_NPM13XX_COMMON_INIT_PRIORITY, \ &parent_api); \ \ - REGULATOR_NPM13XX_DEFINE_COND(partno, n, buck1, NPM13XX_SOURCE_BUCK1) \ - REGULATOR_NPM13XX_DEFINE_COND(partno, n, buck2, NPM13XX_SOURCE_BUCK2) \ - REGULATOR_NPM13XX_DEFINE_COND(partno, n, ldo1, NPM13XX_SOURCE_LDO1) \ - REGULATOR_NPM13XX_DEFINE_COND(partno, n, ldo2, NPM13XX_SOURCE_LDO2) - -#define DT_DRV_COMPAT nordic_npm1300_regulator -#define REGULATOR_NPM1300_DEFINE_ALL(n) REGULATOR_NPM13XX_DEFINE_ALL(npm1300, n) -DT_INST_FOREACH_STATUS_OKAY(REGULATOR_NPM1300_DEFINE_ALL) + REGULATOR_NPM13XX_DEFINE_COND(inst, buck1, NPM13XX_SOURCE_BUCK1) \ + REGULATOR_NPM13XX_DEFINE_COND(inst, buck2, NPM13XX_SOURCE_BUCK2) \ + REGULATOR_NPM13XX_DEFINE_COND(inst, ldo1, NPM13XX_SOURCE_LDO1) \ + REGULATOR_NPM13XX_DEFINE_COND(inst, ldo2, NPM13XX_SOURCE_LDO2) -#undef DT_DRV_COMPAT -#define DT_DRV_COMPAT nordic_npm1304_regulator -#define REGULATOR_NPM1304_DEFINE_ALL(n) REGULATOR_NPM13XX_DEFINE_ALL(npm1304, n) -DT_INST_FOREACH_STATUS_OKAY(REGULATOR_NPM1304_DEFINE_ALL) +DT_INST_FOREACH_STATUS_OKAY(REGULATOR_NPM13XX_DEFINE_ALL) diff --git a/drivers/sensor/nordic/npm13xx_charger/Kconfig b/drivers/sensor/nordic/npm13xx_charger/Kconfig index a113a4ede474..e511e393fa24 100644 --- a/drivers/sensor/nordic/npm13xx_charger/Kconfig +++ b/drivers/sensor/nordic/npm13xx_charger/Kconfig @@ -5,7 +5,7 @@ config NPM13XX_CHARGER bool "nPM13xx Charger" default y - depends on DT_HAS_NORDIC_NPM1300_CHARGER_ENABLED || DT_HAS_NORDIC_NPM1304_CHARGER_ENABLED + depends on DT_HAS_NORDIC_NPM1300_CHARGER_ENABLED select I2C select MFD select REQUIRES_FULL_LIBC diff --git a/drivers/sensor/nordic/npm13xx_charger/npm13xx_charger.c b/drivers/sensor/nordic/npm13xx_charger/npm13xx_charger.c index 08e2763e6558..bf5afe2d3f4e 100644 --- a/drivers/sensor/nordic/npm13xx_charger/npm13xx_charger.c +++ b/drivers/sensor/nordic/npm13xx_charger/npm13xx_charger.c @@ -3,6 +3,8 @@ * SPDX-License-Identifier: Apache-2.0 */ +#define DT_DRV_COMPAT nordic_npm1300_charger + #include #include #include @@ -14,10 +16,7 @@ struct npm13xx_charger_config { const struct device *mfd; int32_t term_microvolt; int32_t term_warm_microvolt; - const struct linear_range term_volt_ranges[2U]; int32_t current_microamp; - const struct linear_range current_range; - const int32_t full_scale_discharge_factors[2U]; int32_t dischg_limit_microamp; uint8_t dischg_limit_idx; int32_t vbus_limit_microamp; @@ -138,22 +137,14 @@ struct adc_results_t { #define DIETEMP_FACTOR_DIV 5000 /* Linear range for charger terminal voltage */ -#define NPM1300_CHARGER_VOLT_RANGES \ - {LINEAR_RANGE_INIT(3500000, 50000, 0U, 3U), LINEAR_RANGE_INIT(4000000, 50000, 4U, 13U)} -#define NPM1304_CHARGER_VOLT_RANGES \ - {LINEAR_RANGE_INIT(3600000, 50000, 0U, 1U), LINEAR_RANGE_INIT(4000000, 50000, 2U, 15U)} +static const struct linear_range charger_volt_ranges[] = { + LINEAR_RANGE_INIT(3500000, 50000, 0U, 3U), LINEAR_RANGE_INIT(4000000, 50000, 4U, 13U)}; /* Linear range for charger current */ -#define NPM1300_CHARGER_CURRENT_RANGE LINEAR_RANGE_INIT(32000, 2000, 16U, 400U) -#define NPM1304_CHARGER_CURRENT_RANGE LINEAR_RANGE_INIT(4000, 500, 8U, 200U) - -/* Full-scale factors for calculating current */ -#define NPM1300_FULL_SCALE_DISCHARGE_FACTORS {112, 100} -#define NPM1304_FULL_SCALE_DISCHARGE_FACTORS {415, 400} -static const int32_t full_scale_charge_factors[] = {125, 100}; +static const struct linear_range charger_current_range = LINEAR_RANGE_INIT(32000, 2000, 16U, 400U); /* Allowed values for discharge limit */ -static const uint16_t npm1300_discharge_limits[] = {84U, 415U}; +static const uint16_t discharge_limits[] = {84U, 415U}; /* Linear range for vbusin current limit */ static const struct linear_range vbus_current_range = LINEAR_RANGE_INIT(100000, 100000, 1U, 15U); @@ -202,49 +193,41 @@ static void calc_current(const struct npm13xx_charger_config *const config, int32_t full_scale_ua; int32_t current_ua; + /* Largest value of discharge limit and charge limit is 1A. + * We can therefore guarantee that multiplying the uA by 1000 does not overflow. + * 1000 * 1'000'000 uA < 2**31 + * 1000000000 < 2147483648 + */ switch (data->ibat_stat) { case IBAT_STAT_DISCHARGE: - /* nPM1300: Largest discharge limit is 1A. Multiplying it by 112 will not overflow. - * 112 * -1_000_000 > INT32_MIN - * -112_000_000 > -2_147_483_648 - * nPM1304: Discharge limit is 125mA. Multiplying it by 415 will not overflow. - * 415 * -125_000 > INT32_MIN - * -51_875_000 > -2_147_483_648 - */ - full_scale_ua = -config->dischg_limit_microamp * - config->full_scale_discharge_factors[0] / - config->full_scale_discharge_factors[1]; + /* Ref: PS v1.2 Section 7.1.7: Full scale multiplied by 1.12 */ + full_scale_ua = -(1000 * config->dischg_limit_microamp) / 893; break; case IBAT_STAT_CHARGE_TRICKLE: /* Fallthrough */ case IBAT_STAT_CHARGE_COOL: /* Fallthrough */ case IBAT_STAT_CHARGE_NORMAL: - /* nPM1300: Largest charge limit is 800mA. Multiplying it by 125 will not overflow. - * 125 * 800_000 < INT32_MAX - * 100_000_000 < 2_147_483_647 - * nPM1304: Largest charge limit is even lower - no overflow. - */ - full_scale_ua = config->current_microamp * full_scale_charge_factors[0] / - full_scale_charge_factors[1]; + /* Ref: PS v1.2 Section 7.1.7: Full scale multiplied by 1.25 */ + full_scale_ua = (1000 * config->current_microamp) / 800; break; default: full_scale_ua = 0; break; } - /* Largest possible value for data->current is 1023 (10-bit ADC) - * Limits for full_scale_ua are -1_120_000 and 1_000_000 - * 1023 * -1_120_000 > INT32_MIN - * -1_145_760_000 > -2_147_483_648 - * 1023 * 1_000_000 < INT32_MAX - * 1_023_000_000 < 2_147_483_647 + /* Largest possible value for data->current is 1023 + * Limits for full_scale_ua are -1'119'820 and 1'000'000 + * 1023 * -1119820 > -2**31 + * -1145575860 > -2147483648 + * 1023 * 1000000 < 2**31 + * 1023000000 < 2147483648 */ __ASSERT_NO_MSG(data->current <= 1023); __ASSERT_NO_MSG(full_scale_ua <= 1000000); - __ASSERT_NO_MSG(full_scale_ua >= -1120000); + __ASSERT_NO_MSG(full_scale_ua >= -1119820); - current_ua = (data->current * full_scale_ua) / 1023; + current_ua = (data->current * full_scale_ua) / 1024; (void)sensor_value_from_micro(valp, current_ua); } @@ -341,6 +324,9 @@ int npm13xx_charger_sample_fetch(const struct device *dev, enum sensor_channel c /* Read vbus status */ ret = mfd_npm13xx_reg_read(config->mfd, VBUS_BASE, VBUS_OFFSET_STATUS, &data->vbus_stat); + if (ret != 0) { + return ret; + } return ret; } @@ -546,9 +532,9 @@ int npm13xx_charger_init(const struct device *dev) } /* Configure termination voltages */ - ret = linear_range_group_get_win_index( - config->term_volt_ranges, ARRAY_SIZE(config->term_volt_ranges), - config->term_microvolt, config->term_microvolt, &idx); + ret = linear_range_group_get_win_index(charger_volt_ranges, ARRAY_SIZE(charger_volt_ranges), + config->term_microvolt, config->term_microvolt, + &idx); if (ret == -EINVAL) { return ret; } @@ -557,9 +543,9 @@ int npm13xx_charger_init(const struct device *dev) return ret; } - ret = linear_range_group_get_win_index( - config->term_volt_ranges, ARRAY_SIZE(config->term_volt_ranges), - config->term_warm_microvolt, config->term_warm_microvolt, &idx); + ret = linear_range_group_get_win_index(charger_volt_ranges, ARRAY_SIZE(charger_volt_ranges), + config->term_warm_microvolt, + config->term_warm_microvolt, &idx); if (ret == -EINVAL) { return ret; } @@ -570,29 +556,22 @@ int npm13xx_charger_init(const struct device *dev) } /* Set current, allow rounding down to closest value */ - ret = linear_range_get_win_index(&config->current_range, - config->current_microamp - config->current_range.step + 1, + ret = linear_range_get_win_index(&charger_current_range, + config->current_microamp - charger_current_range.step, config->current_microamp, &idx); if (ret == -EINVAL) { return ret; } - if (config->dischg_limit_idx == UINT8_MAX) { - /* Set only charge current MSB for nPM1304 */ - ret = mfd_npm13xx_reg_write(config->mfd, CHGR_BASE, CHGR_OFFSET_ISET, idx); - } else { - /* Set charge current MSB and LSB and discharge limit for nPM1300 */ - ret = mfd_npm13xx_reg_write2(config->mfd, CHGR_BASE, CHGR_OFFSET_ISET, idx / 2U, - idx & 1U); - if (ret != 0) { - return ret; - } - - ret = mfd_npm13xx_reg_write2( - config->mfd, CHGR_BASE, CHGR_OFFSET_ISET_DISCHG, - npm1300_discharge_limits[config->dischg_limit_idx] / 2U, - npm1300_discharge_limits[config->dischg_limit_idx] & 1U); + ret = mfd_npm13xx_reg_write2(config->mfd, CHGR_BASE, CHGR_OFFSET_ISET, idx / 2U, idx & 1U); + if (ret != 0) { + return ret; } + + /* Set discharge limit */ + ret = mfd_npm13xx_reg_write2(config->mfd, CHGR_BASE, CHGR_OFFSET_ISET_DISCHG, + discharge_limits[config->dischg_limit_idx] / 2U, + discharge_limits[config->dischg_limit_idx] & 1U); if (ret != 0) { return ret; } @@ -687,23 +666,19 @@ static DEVICE_API(sensor, npm13xx_charger_battery_driver_api) = { .attr_get = npm13xx_charger_attr_get, }; -#define NPM13XX_CHARGER_INIT(partno, n) \ - BUILD_ASSERT(DT_INST_ENUM_IDX_OR(n, dischg_limit_microamp, 0) < \ - ARRAY_SIZE(npm1300_discharge_limits)); \ +#define NPM13XX_CHARGER_INIT(n) \ + BUILD_ASSERT(DT_INST_ENUM_IDX(n, dischg_limit_microamp) < ARRAY_SIZE(discharge_limits)); \ \ - static struct npm13xx_charger_data charger_##partno##_data##n; \ + static struct npm13xx_charger_data npm13xx_charger_data_##n; \ \ - static const struct npm13xx_charger_config charger_##partno##_config##n = { \ + static const struct npm13xx_charger_config npm13xx_charger_config_##n = { \ .mfd = DEVICE_DT_GET(DT_INST_PARENT(n)), \ .term_microvolt = DT_INST_PROP(n, term_microvolt), \ .term_warm_microvolt = \ DT_INST_PROP_OR(n, term_warm_microvolt, DT_INST_PROP(n, term_microvolt)), \ - .term_volt_ranges = partno##_CHARGER_VOLT_RANGES, \ .current_microamp = DT_INST_PROP(n, current_microamp), \ - .current_range = partno##_CHARGER_CURRENT_RANGE, \ - .full_scale_discharge_factors = partno##_FULL_SCALE_DISCHARGE_FACTORS, \ .dischg_limit_microamp = DT_INST_PROP(n, dischg_limit_microamp), \ - .dischg_limit_idx = DT_INST_ENUM_IDX_OR(n, dischg_limit_microamp, UINT8_MAX), \ + .dischg_limit_idx = DT_INST_ENUM_IDX(n, dischg_limit_microamp), \ .vbus_limit_microamp = DT_INST_PROP(n, vbus_limit_microamp), \ .thermistor_ohms = DT_INST_PROP(n, thermistor_ohms), \ .thermistor_idx = DT_INST_ENUM_IDX(n, thermistor_ohms), \ @@ -721,17 +696,9 @@ static DEVICE_API(sensor, npm13xx_charger_battery_driver_api) = { DT_INST_PROP_OR(n, thermistor_warm_millidegrees, INT32_MAX), \ DT_INST_PROP_OR(n, thermistor_hot_millidegrees, INT32_MAX)}}; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(n, &npm13xx_charger_init, NULL, &charger_##partno##_data##n, \ - &charger_##partno##_config##n, POST_KERNEL, \ + SENSOR_DEVICE_DT_INST_DEFINE(n, &npm13xx_charger_init, NULL, &npm13xx_charger_data_##n, \ + &npm13xx_charger_config_##n, POST_KERNEL, \ CONFIG_SENSOR_INIT_PRIORITY, \ &npm13xx_charger_battery_driver_api); -#undef DT_DRV_COMPAT -#define DT_DRV_COMPAT nordic_npm1300_charger -#define NPM1300_CHARGER_INIT(n) NPM13XX_CHARGER_INIT(NPM1300, n) -DT_INST_FOREACH_STATUS_OKAY(NPM1300_CHARGER_INIT) - -#undef DT_DRV_COMPAT -#define DT_DRV_COMPAT nordic_npm1304_charger -#define NPM1304_CHARGER_INIT(n) NPM13XX_CHARGER_INIT(NPM1304, n) -DT_INST_FOREACH_STATUS_OKAY(NPM1304_CHARGER_INIT) +DT_INST_FOREACH_STATUS_OKAY(NPM13XX_CHARGER_INIT) diff --git a/drivers/watchdog/Kconfig.npm13xx b/drivers/watchdog/Kconfig.npm13xx index 910da6574a93..2318349c85e3 100644 --- a/drivers/watchdog/Kconfig.npm13xx +++ b/drivers/watchdog/Kconfig.npm13xx @@ -4,7 +4,7 @@ config WDT_NPM13XX bool "nPM13xx Watchdog driver" default y - depends on DT_HAS_NORDIC_NPM1300_WDT_ENABLED || DT_HAS_NORDIC_NPM1304_WDT_ENABLED + depends on DT_HAS_NORDIC_NPM1300_WDT_ENABLED select I2C select MFD help diff --git a/drivers/watchdog/wdt_npm13xx.c b/drivers/watchdog/wdt_npm13xx.c index 351da6b7d5a8..cfbee7f33982 100644 --- a/drivers/watchdog/wdt_npm13xx.c +++ b/drivers/watchdog/wdt_npm13xx.c @@ -3,6 +3,8 @@ * SPDX-License-Identifier: Apache-2.0 */ +#define DT_DRV_COMPAT nordic_npm13xx_wdt + #include #include @@ -152,23 +154,15 @@ static int wdt_npm13xx_init(const struct device *dev) return 0; } -#define WDT_NPM13XX_DEFINE(partno, n) \ - static struct wdt_npm13xx_data wdt_##partno##_data##n; \ +#define WDT_NPM13XX_DEFINE(n) \ + static struct wdt_npm13xx_data data##n; \ \ - static const struct wdt_npm13xx_config wdt_##partno##_config##n = { \ + static const struct wdt_npm13xx_config config##n = { \ .mfd = DEVICE_DT_GET(DT_INST_PARENT(n)), \ .reset_gpios = GPIO_DT_SPEC_INST_GET_OR(n, reset_gpios, {0}), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, &wdt_npm13xx_init, NULL, &wdt_##partno##_data##n, \ - &wdt_##partno##_config##n, POST_KERNEL, \ + DEVICE_DT_INST_DEFINE(n, &wdt_npm13xx_init, NULL, &data##n, &config##n, POST_KERNEL, \ CONFIG_WDT_NPM13XX_INIT_PRIORITY, &wdt_npm13xx_api); -#define DT_DRV_COMPAT nordic_npm1300_wdt -#define WDT_NPM1300_DEFINE(n) WDT_NPM13XX_DEFINE(npm1300, n) -DT_INST_FOREACH_STATUS_OKAY(WDT_NPM1300_DEFINE) - -#undef DT_DRV_COMPAT -#define DT_DRV_COMPAT nordic_npm1304_wdt -#define WDT_NPM1304_DEFINE(n) WDT_NPM13XX_DEFINE(npm1304, n) -DT_INST_FOREACH_STATUS_OKAY(WDT_NPM1304_DEFINE) +DT_INST_FOREACH_STATUS_OKAY(WDT_NPM13XX_DEFINE) From 8114df08cb363d1bb31026a40a0fc4e620de0624 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:06 +0300 Subject: [PATCH 1482/2141] Revert "[nrf fromtree] dts: bindings: add npm1304 extracting common from npm1300" This reverts commit 0ebf53410c2f811c93db101ee17a1e2914261ee8. Signed-off-by: Jukka Rissanen --- dts/bindings/gpio/nordic,npm1304-gpio.yaml | 12 --- dts/bindings/led/nordic,npm1300-led.yaml | 28 ++++++- dts/bindings/led/nordic,npm1304-led.yaml | 13 --- .../led/nordic,npm13xx-led-common.yaml | 32 ------- dts/bindings/mfd/nordic,npm1300.yaml | 38 ++++++++- dts/bindings/mfd/nordic,npm1304.yaml | 8 -- dts/bindings/mfd/nordic,npm13xx-common.yaml | 42 ---------- .../regulator/nordic,npm1300-regulator.yaml | 80 +++++++++++++++++- .../regulator/nordic,npm1304-regulator.yaml | 35 -------- .../nordic,npm13xx-regulator-common.yaml | 84 ------------------- .../sensor/nordic,npm1300-charger.yaml | 79 ++++++++++++++++- .../sensor/nordic,npm1304-charger.yaml | 48 ----------- .../sensor/nordic,npm13xx-charger-common.yaml | 83 ------------------ dts/bindings/watchdog/nordic,npm1304-wdt.yaml | 13 --- 14 files changed, 221 insertions(+), 374 deletions(-) delete mode 100644 dts/bindings/gpio/nordic,npm1304-gpio.yaml delete mode 100644 dts/bindings/led/nordic,npm1304-led.yaml delete mode 100644 dts/bindings/led/nordic,npm13xx-led-common.yaml delete mode 100644 dts/bindings/mfd/nordic,npm1304.yaml delete mode 100644 dts/bindings/mfd/nordic,npm13xx-common.yaml delete mode 100644 dts/bindings/regulator/nordic,npm1304-regulator.yaml delete mode 100644 dts/bindings/regulator/nordic,npm13xx-regulator-common.yaml delete mode 100644 dts/bindings/sensor/nordic,npm1304-charger.yaml delete mode 100644 dts/bindings/sensor/nordic,npm13xx-charger-common.yaml delete mode 100644 dts/bindings/watchdog/nordic,npm1304-wdt.yaml diff --git a/dts/bindings/gpio/nordic,npm1304-gpio.yaml b/dts/bindings/gpio/nordic,npm1304-gpio.yaml deleted file mode 100644 index a6ff1a4656c3..000000000000 --- a/dts/bindings/gpio/nordic,npm1304-gpio.yaml +++ /dev/null @@ -1,12 +0,0 @@ -# Copyright (c) 2025 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -description: nPM1304 GPIO Controller - -compatible: "nordic,npm1304-gpio" - -include: gpio-controller.yaml - -gpio-cells: - - pin - - flags diff --git a/dts/bindings/led/nordic,npm1300-led.yaml b/dts/bindings/led/nordic,npm1300-led.yaml index 3c240a94e35f..90c420832f9d 100644 --- a/dts/bindings/led/nordic,npm1300-led.yaml +++ b/dts/bindings/led/nordic,npm1300-led.yaml @@ -10,4 +10,30 @@ description: | compatible: "nordic,npm1300-led" -include: "nordic,npm13xx-led-common.yaml" +properties: + nordic,led0-mode: + type: string + required: true + enum: + - error + - charging + - host + description: LED 0 mode + + nordic,led1-mode: + type: string + required: true + enum: + - error + - charging + - host + description: LED 1 mode + + nordic,led2-mode: + type: string + required: true + enum: + - error + - charging + - host + description: LED 2 mode diff --git a/dts/bindings/led/nordic,npm1304-led.yaml b/dts/bindings/led/nordic,npm1304-led.yaml deleted file mode 100644 index d0e66857465e..000000000000 --- a/dts/bindings/led/nordic,npm1304-led.yaml +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright (c) 2025 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -description: | - Nordic nPM1304 LED controller - - The nPM1304 has three LED outputs. - Each LED can automatically display error or charging status, - or be controlled by software. - -compatible: "nordic,npm1304-led" - -include: "nordic,npm13xx-led-common.yaml" diff --git a/dts/bindings/led/nordic,npm13xx-led-common.yaml b/dts/bindings/led/nordic,npm13xx-led-common.yaml deleted file mode 100644 index 6171258d7853..000000000000 --- a/dts/bindings/led/nordic,npm13xx-led-common.yaml +++ /dev/null @@ -1,32 +0,0 @@ -# Copyright (c) 2025 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -description: Nordic nPM13xx LED controller common properties - -properties: - nordic,led0-mode: - type: string - required: true - enum: - - error - - charging - - host - description: LED 0 mode - - nordic,led1-mode: - type: string - required: true - enum: - - error - - charging - - host - description: LED 1 mode - - nordic,led2-mode: - type: string - required: true - enum: - - error - - charging - - host - description: LED 2 mode diff --git a/dts/bindings/mfd/nordic,npm1300.yaml b/dts/bindings/mfd/nordic,npm1300.yaml index accd7887c95c..1fdfb42ef93b 100644 --- a/dts/bindings/mfd/nordic,npm1300.yaml +++ b/dts/bindings/mfd/nordic,npm1300.yaml @@ -5,4 +5,40 @@ description: Nordic nPM1300 compatible: "nordic,npm1300" -include: "nordic,npm13xx-common.yaml" +include: i2c-device.yaml + +properties: + reg: + required: true + + host-int-gpios: + type: phandle-array + description: Host pin for interrupt input + + pmic-int-pin: + type: int + description: Pmic pin number for interrupt output + + ship-to-active-time-ms: + type: int + description: | + Press duration required to wake from ship / hibernate in ms. + The default is the device powerup value. + enum: + - 16 + - 32 + - 64 + - 96 + - 304 + - 608 + - 1008 + - 3008 + default: 96 + + long-press-reset: + type: string + description: Long press reset configuration + enum: + - "one-button" + - "disabled" + - "two-button" diff --git a/dts/bindings/mfd/nordic,npm1304.yaml b/dts/bindings/mfd/nordic,npm1304.yaml deleted file mode 100644 index a861cd79e486..000000000000 --- a/dts/bindings/mfd/nordic,npm1304.yaml +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (c) 2025 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -description: Nordic nPM1304 - -compatible: "nordic,npm1304" - -include: nordic,npm13xx-common.yaml diff --git a/dts/bindings/mfd/nordic,npm13xx-common.yaml b/dts/bindings/mfd/nordic,npm13xx-common.yaml deleted file mode 100644 index ed2bf7cbf684..000000000000 --- a/dts/bindings/mfd/nordic,npm13xx-common.yaml +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright (c) 2025 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -description: Nordic nPM13xx common properties - -include: i2c-device.yaml - -properties: - reg: - required: true - - host-int-gpios: - type: phandle-array - description: Host pin for interrupt input - - pmic-int-pin: - type: int - description: Pmic pin number for interrupt output - - ship-to-active-time-ms: - type: int - description: | - Press duration required to wake from ship / hibernate in ms. - The default is the device powerup value. - enum: - - 16 - - 32 - - 64 - - 96 - - 304 - - 608 - - 1008 - - 3008 - default: 96 - - long-press-reset: - type: string - description: Long press reset configuration - enum: - - "one-button" - - "disabled" - - "two-button" diff --git a/dts/bindings/regulator/nordic,npm1300-regulator.yaml b/dts/bindings/regulator/nordic,npm1300-regulator.yaml index e42199b68ddf..1b77f6c1ab43 100644 --- a/dts/bindings/regulator/nordic,npm1300-regulator.yaml +++ b/dts/bindings/regulator/nordic,npm1300-regulator.yaml @@ -32,4 +32,82 @@ description: | compatible: "nordic,npm1300-regulator" -include: "nordic,npm13xx-regulator-common.yaml" +include: base.yaml + +properties: + dvs-gpios: + type: phandle-array + description: | + List of SOC GPIOs connected to PMIC GPIOs. + Set_dvs_mode will drive these pins as follows: + DVS mode 1 will enable the first pin + DVS mode 2 will enable the second pin + DVS mode 3 will drive the first and second pins + etc. + The effect of the mode change is defined by the enable-gpios + and pwm_gpios fields for each of the regulator blocks. + +child-binding: + include: + - name: regulator.yaml + property-allowlist: + - regulator-always-on + - regulator-boot-on + - regulator-boot-off + - regulator-min-microvolt + - regulator-max-microvolt + - regulator-init-microvolt + - regulator-allowed-modes + - regulator-initial-mode + - regulator-min-microamp + - regulator-max-microamp + - startup-delay-us + - off-on-delay-us + + properties: + retention-microvolt: + type: int + description: | + Retention mode voltage in microvolts. + + enable-gpio-config: + type: array + description: | + Regulator enable controlled by specified GPIO pin . + When set regulator must be enabled/disabled using set_dvs_mode. + + pwm-gpio-config: + type: array + description: | + Regulator enable controlled by specified GPIO pin . + When set regulator must be enabled/disabled using set_dvs_mode. + + retention-gpio-config: + type: array + description: | + Retention mode controlled by specified GPIO pin . + + soft-start-microamp: + type: int + enum: + - 10000 + - 20000 + - 35000 + - 50000 + description: | + Soft start current limit in microamps. + + active-discharge: + type: boolean + description: | + Enable active-discharge on the BUCK/LDO/LDSW output when disabled. + + nordic,anomaly38-disable-workaround: + type: boolean + description: | + Disable the SW workaround for nPM1300 anomaly #38. + When nPM1300 is in ULP mode, LDO is supplied from VSYS and + then LDO is enabled, it can take long time until the LDO + output has reached its target voltage. To avoid this, an i2c + read is performed shortly after an LDO is enabled. + See nPM1300 Errata manual for more details. diff --git a/dts/bindings/regulator/nordic,npm1304-regulator.yaml b/dts/bindings/regulator/nordic,npm1304-regulator.yaml deleted file mode 100644 index 51ae13e675b5..000000000000 --- a/dts/bindings/regulator/nordic,npm1304-regulator.yaml +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright (c) 2025 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -description: | - Nordic nPM1304 PMIC - - The PMIC has two buck converters and two LDOs. - The regulators need to be defined as child nodes, strictly following the - BUCK1,2 LDO1..2, node names. For - example: - - pmic@6b { - reg = <0x6b>; - ... - regulators { - compatible = "nordic,npm1304-regulator"; - - BUCK1 { - /* all properties for BUCK1 */ - }; - BUCK2 { - /* all properties for BUCK2 */ - }; - LDO1 { - /* all properties for LDO1 */ - }; - LDO2 { - /* all properties for LDO2 */ - }; - }; - }; - -compatible: "nordic,npm1304-regulator" - -include: "nordic,npm13xx-regulator-common.yaml" diff --git a/dts/bindings/regulator/nordic,npm13xx-regulator-common.yaml b/dts/bindings/regulator/nordic,npm13xx-regulator-common.yaml deleted file mode 100644 index 35900c7ba373..000000000000 --- a/dts/bindings/regulator/nordic,npm13xx-regulator-common.yaml +++ /dev/null @@ -1,84 +0,0 @@ -# Copyright (c) 2025 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -description: Nordic nPM13xx PMIC regulators common properties - -include: base.yaml - -properties: - dvs-gpios: - type: phandle-array - description: | - List of SOC GPIOs connected to PMIC GPIOs. - Set_dvs_mode will drive these pins as follows: - DVS mode 1 will enable the first pin - DVS mode 2 will enable the second pin - DVS mode 3 will drive the first and second pins - etc. - The effect of the mode change is defined by the enable-gpios - and pwm_gpios fields for each of the regulator blocks. - -child-binding: - include: - - name: regulator.yaml - property-allowlist: - - regulator-always-on - - regulator-boot-on - - regulator-boot-off - - regulator-min-microvolt - - regulator-max-microvolt - - regulator-init-microvolt - - regulator-allowed-modes - - regulator-initial-mode - - regulator-min-microamp - - regulator-max-microamp - - startup-delay-us - - off-on-delay-us - - properties: - retention-microvolt: - type: int - description: | - Retention mode voltage in microvolts. - - enable-gpio-config: - type: array - description: | - Regulator enable controlled by specified GPIO pin . - When set regulator must be enabled/disabled using set_dvs_mode. - - pwm-gpio-config: - type: array - description: | - Regulator enable controlled by specified GPIO pin . - When set regulator must be enabled/disabled using set_dvs_mode. - - retention-gpio-config: - type: array - description: | - Retention mode controlled by specified GPIO pin . - - soft-start-microamp: - type: int - enum: - - 10000 - - 20000 - - 35000 - - 50000 - description: | - Soft start current limit in microamps. - - active-discharge: - type: boolean - description: | - Enable active-discharge on the BUCK/LDO/LDSW output when disabled. - - nordic,anomaly38-disable-workaround: - type: boolean - description: | - Disable the SW workaround for nPM13xx anomaly #38. - When nPM13xx is in ULP mode, LDO is supplied from VSYS and - then LDO is enabled, it can take long time until the LDO - output has reached its target voltage. To avoid this, an i2c - read is performed shortly after an LDO is enabled. - See nPM13xx Errata manual for more details. diff --git a/dts/bindings/sensor/nordic,npm1300-charger.yaml b/dts/bindings/sensor/nordic,npm1300-charger.yaml index af825cc59705..3fb83a85174a 100644 --- a/dts/bindings/sensor/nordic,npm1300-charger.yaml +++ b/dts/bindings/sensor/nordic,npm1300-charger.yaml @@ -8,7 +8,7 @@ description: NPM1300 PMIC Charger compatible: "nordic,npm1300-charger" -include: "nordic,npm13xx-charger-common.yaml" +include: [sensor-device.yaml] properties: term-microvolt: @@ -31,6 +31,7 @@ properties: description: | Charge current in uA. Available range is 32 mA to 800 mA in 2mA steps. + The value specified will be rounded down to the closest implemented value. dischg-limit-microamp: type: int @@ -42,6 +43,60 @@ properties: Discharge current limit in uA. Available values are 200 mA and 1000 mA. + vbus-limit-microamp: + type: int + required: true + description: | + Vbus current limit in uA. + Available range is 100 mA to 1500 mA in 100 mA steps. + + thermistor-ohms: + type: int + required: true + enum: + - 0 + - 10000 + - 47000 + - 100000 + description: Thermistor nominal resistance type in ohms. + + thermistor-beta: + type: int + required: true + description: Beta value of selected thermistor. + + thermistor-cold-millidegrees: + type: int + description: Thermistor cold threshold in milli-degrees + + thermistor-cool-millidegrees: + type: int + description: Thermistor cool threshold in milli-degrees + + thermistor-warm-millidegrees: + type: int + description: Thermistor warm threshold in milli-degrees + + thermistor-hot-millidegrees: + type: int + description: Thermistor hot threshold in milli-degrees + + charging-enable: + type: boolean + description: | + Enable charging. + + trickle-microvolt: + type: int + enum: + - 2900000 + - 2500000 + default: 2900000 + description: | + Trickle voltage threshold in uV. + Trickle charging is enabled below this value. + If omitted the device default of 2.9V is used. + term-current-percent: type: int enum: @@ -52,3 +107,25 @@ properties: Termination current, as a percentage of current-microamp. Charge completes when the charge current falls below this value. If omitted the device default of 10% is used. + + vbatlow-charge-enable: + type: boolean + description: | + Allow charging when below the vbatlow threshold. + + disable-recharge: + type: boolean + description: | + Disable automatic recharge. + + dietemp-stop-millidegrees: + type: int + description: | + Die temperature halt threshold in milli-degrees. + When die temperature exceeds this threshold, charging will be inhibited. + + dietemp-resume-millidegrees: + type: int + description: | + Die temperature resume threshold in milli-degrees. + When die temperature falls below this threshold, charging will be permitted. diff --git a/dts/bindings/sensor/nordic,npm1304-charger.yaml b/dts/bindings/sensor/nordic,npm1304-charger.yaml deleted file mode 100644 index 70a1a754b814..000000000000 --- a/dts/bindings/sensor/nordic,npm1304-charger.yaml +++ /dev/null @@ -1,48 +0,0 @@ -# Copyright (c) 2025 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -description: nPM1304 PMIC Charger - -compatible: "nordic,npm1304-charger" - -include: "nordic,npm13xx-charger-common.yaml" - -properties: - term-microvolt: - type: int - required: true - description: | - Charge termination voltage in uV. - Available range is 3.6 V to 3.65 V and 4.0 V to 4.65 V in 50 mV steps. - - term-warm-microvolt: - type: int - description: | - Charge termination voltage when warm in uV. - Available range is 3.6 V to 3.65 V and 4.0 V to 4.65 V in 50 mV steps. - If omitted, the term-microvolt value will be used. - - current-microamp: - type: int - required: true - description: | - Charge current in uA. - Available range is 4 mA to 100 mA in 0.5 mA steps. - - dischg-limit-microamp: - type: int - const: 125000 - default: 125000 - description: | - Discharge current limit in uA. Fixed to 125 mA on nPM1304. - - term-current-percent: - type: int - enum: - - 10 - - 5 - default: 10 - description: | - Termination current, as a percentage of current-microamp. - Charge completes when the charge current falls below this value. - If omitted the device default of 10% is used. diff --git a/dts/bindings/sensor/nordic,npm13xx-charger-common.yaml b/dts/bindings/sensor/nordic,npm13xx-charger-common.yaml deleted file mode 100644 index c24f279c7b22..000000000000 --- a/dts/bindings/sensor/nordic,npm13xx-charger-common.yaml +++ /dev/null @@ -1,83 +0,0 @@ -# Copyright (c) 2025 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -description: nPM13xx PMIC Charger common properties - -include: sensor-device.yaml - -properties: - vbus-limit-microamp: - type: int - required: true - description: | - Vbus current limit in uA. - Available range is 100 mA to 1500 mA in 100 mA steps. - - thermistor-ohms: - type: int - required: true - enum: - - 0 - - 10000 - - 47000 - - 100000 - description: Thermistor nominal resistance type in ohms. - - thermistor-beta: - type: int - required: true - description: Beta value of selected thermistor. - - thermistor-cold-millidegrees: - type: int - description: Thermistor cold threshold in milli-degrees - - thermistor-cool-millidegrees: - type: int - description: Thermistor cool threshold in milli-degrees - - thermistor-warm-millidegrees: - type: int - description: Thermistor warm threshold in milli-degrees - - thermistor-hot-millidegrees: - type: int - description: Thermistor hot threshold in milli-degrees - - charging-enable: - type: boolean - description: | - Enable charging. - - trickle-microvolt: - type: int - enum: - - 2900000 - - 2500000 - default: 2900000 - description: | - Trickle voltage threshold in uV. - Trickle charging is enabled below this value. - If omitted the device default of 2.9V is used. - - vbatlow-charge-enable: - type: boolean - description: | - Allow charging when below the vbatlow threshold. - - disable-recharge: - type: boolean - description: | - Disable automatic recharge. - - dietemp-stop-millidegrees: - type: int - description: | - Die temperature halt threshold in milli-degrees. - When die temperature exceeds this threshold, charging will be inhibited. - - dietemp-resume-millidegrees: - type: int - description: | - Die temperature resume threshold in milli-degrees. - When die temperature falls below this threshold, charging will be permitted. diff --git a/dts/bindings/watchdog/nordic,npm1304-wdt.yaml b/dts/bindings/watchdog/nordic,npm1304-wdt.yaml deleted file mode 100644 index 0fc81437199c..000000000000 --- a/dts/bindings/watchdog/nordic,npm1304-wdt.yaml +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright (c) 2025 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -description: nPM1304 Watchdog - -compatible: "nordic,npm1304-wdt" - -include: base.yaml - -properties: - reset-gpios: - type: phandle-array - description: nPM1304 pin used as NRESETOUT From 1224ddd0bc9c74d59e8ee30c342534239a0bcb01 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:06 +0300 Subject: [PATCH 1483/2141] Revert "[nrf fromtree] drivers: npm13xx: rename npm1300 to npm13xx" This reverts commit b74ed06cdb8e394718bdf2220b6bb2ed80cc0265. Signed-off-by: Jukka Rissanen --- .../nrf9131ek/nrf9131ek_nrf9131_ns_defconfig | 1 + drivers/gpio/CMakeLists.txt | 2 +- drivers/gpio/Kconfig.npm13xx | 14 +- drivers/gpio/gpio_npm13xx.c | 150 +++---- drivers/led/CMakeLists.txt | 2 +- drivers/led/Kconfig.npm13xx | 6 +- drivers/led/led_npm13xx.c | 54 +-- drivers/mfd/CMakeLists.txt | 2 +- drivers/mfd/Kconfig.npm13xx | 14 +- drivers/mfd/mfd_npm13xx.c | 126 +++--- drivers/regulator/CMakeLists.txt | 2 +- drivers/regulator/Kconfig.npm13xx | 22 +- drivers/regulator/regulator_npm13xx.c | 376 +++++++++--------- drivers/sensor/nordic/CMakeLists.txt | 2 +- drivers/sensor/nordic/npm13xx_charger/Kconfig | 6 +- .../nordic/npm13xx_charger/npm13xx_charger.c | 158 ++++---- drivers/watchdog/CMakeLists.txt | 2 +- drivers/watchdog/Kconfig.npm13xx | 16 +- drivers/watchdog/wdt_npm13xx.c | 72 ++-- include/zephyr/drivers/mfd/npm13xx.h | 94 ++--- .../zephyr/drivers/sensor/npm13xx_charger.h | 26 +- .../dt-bindings/gpio/nordic-npm13xx-gpio.h | 44 +- .../zephyr/dt-bindings/regulator/npm13xx.h | 26 +- .../npm1300_ek/nrf52dk_nrf52832.overlay | 4 +- samples/shields/npm1300_ek/src/main.c | 12 +- 25 files changed, 617 insertions(+), 616 deletions(-) diff --git a/boards/nordic/nrf9131ek/nrf9131ek_nrf9131_ns_defconfig b/boards/nordic/nrf9131ek/nrf9131ek_nrf9131_ns_defconfig index d15d371416bc..5690c239b7ba 100644 --- a/boards/nordic/nrf9131ek/nrf9131ek_nrf9131_ns_defconfig +++ b/boards/nordic/nrf9131ek/nrf9131ek_nrf9131_ns_defconfig @@ -26,3 +26,4 @@ CONFIG_UART_CONSOLE=y CONFIG_I2C=y CONFIG_REGULATOR=y CONFIG_SENSOR=y +CONFIG_NPM1300_CHARGER=y diff --git a/drivers/gpio/CMakeLists.txt b/drivers/gpio/CMakeLists.txt index 08adaf2d640f..8a5ea48cb65b 100644 --- a/drivers/gpio/CMakeLists.txt +++ b/drivers/gpio/CMakeLists.txt @@ -67,7 +67,7 @@ zephyr_library_sources_ifdef(CONFIG_GPIO_NCT38XX gpio_nct38xx_port.c) zephyr_library_sources_ifdef(CONFIG_GPIO_NCT38XX_ALERT gpio_nct38xx_alert.c) zephyr_library_sources_ifdef(CONFIG_GPIO_NEORV32 gpio_neorv32.c) zephyr_library_sources_ifdef(CONFIG_GPIO_NPCX gpio_npcx.c) -zephyr_library_sources_ifdef(CONFIG_GPIO_NPM13XX gpio_npm13xx.c) +zephyr_library_sources_ifdef(CONFIG_GPIO_NPM1300 gpio_npm13xx.c) zephyr_library_sources_ifdef(CONFIG_GPIO_NPM2100 gpio_npm2100.c) zephyr_library_sources_ifdef(CONFIG_GPIO_NPM6001 gpio_npm6001.c) zephyr_library_sources_ifdef(CONFIG_GPIO_NRFX gpio_nrfx.c) diff --git a/drivers/gpio/Kconfig.npm13xx b/drivers/gpio/Kconfig.npm13xx index 828b4e1382f3..65cb81a36868 100644 --- a/drivers/gpio/Kconfig.npm13xx +++ b/drivers/gpio/Kconfig.npm13xx @@ -1,19 +1,19 @@ # Copyright (c) 2023 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -config GPIO_NPM13XX - bool "nPM13xx GPIO driver" +config GPIO_NPM1300 + bool "nPM1300 GPIO driver" default y depends on DT_HAS_NORDIC_NPM1300_GPIO_ENABLED select I2C select MFD help - Enable the nPM13xx GPIO driver. + Enable the nPM1300 GPIO driver. -config GPIO_NPM13XX_INIT_PRIORITY - int "nPM13xx GPIO driver initialization priority" - depends on GPIO_NPM13XX +config GPIO_NPM1300_INIT_PRIORITY + int "nPM1300 GPIO driver initialization priority" + depends on GPIO_NPM1300 default 85 help - Initialization priority for the nPM13xx GPIO driver. It must be + Initialization priority for the nPM1300 GPIO driver. It must be greater than the I2C controller init priority. diff --git a/drivers/gpio/gpio_npm13xx.c b/drivers/gpio/gpio_npm13xx.c index c74fc244d937..40c5aaf10985 100644 --- a/drivers/gpio/gpio_npm13xx.c +++ b/drivers/gpio/gpio_npm13xx.c @@ -14,10 +14,10 @@ #include #include -/* nPM13xx GPIO base address */ +/* nPM1300 GPIO base address */ #define NPM_GPIO_BASE 0x06U -/* nPM13xx GPIO registers offsets */ +/* nPM1300 GPIO registers offsets */ #define NPM_GPIO_OFFSET_MODE 0x00U #define NPM_GPIO_OFFSET_DRIVE 0x05U #define NPM_GPIO_OFFSET_PULLUP 0x0AU @@ -26,36 +26,36 @@ #define NPM_GPIO_OFFSET_DEBOUNCE 0x19U #define NPM_GPIO_OFFSET_STATUS 0x1EU -/* nPM13xx Channel counts */ -#define NPM13XX_GPIO_PINS 5U - -#define NPM13XX_GPIO_GPIINPUT 0 -#define NPM13XX_GPIO_GPILOGIC1 1 -#define NPM13XX_GPIO_GPILOGIC0 2 -#define NPM13XX_GPIO_GPIEVENTRISE 3 -#define NPM13XX_GPIO_GPIEVENTFALL 4 -#define NPM13XX_GPIO_GPOIRQ 5 -#define NPM13XX_GPIO_GPORESET 6 -#define NPM13XX_GPIO_GPOPWRLOSSWARN 7 -#define NPM13XX_GPIO_GPOLOGIC1 8 -#define NPM13XX_GPIO_GPOLOGIC0 9 - -struct gpio_npm13xx_config { +/* nPM1300 Channel counts */ +#define NPM1300_GPIO_PINS 5U + +#define NPM1300_GPIO_GPIINPUT 0 +#define NPM1300_GPIO_GPILOGIC1 1 +#define NPM1300_GPIO_GPILOGIC0 2 +#define NPM1300_GPIO_GPIEVENTRISE 3 +#define NPM1300_GPIO_GPIEVENTFALL 4 +#define NPM1300_GPIO_GPOIRQ 5 +#define NPM1300_GPIO_GPORESET 6 +#define NPM1300_GPIO_GPOPWRLOSSWARN 7 +#define NPM1300_GPIO_GPOLOGIC1 8 +#define NPM1300_GPIO_GPOLOGIC0 9 + +struct gpio_npm1300_config { struct gpio_driver_config common; const struct device *mfd; }; -struct gpio_npm13xx_data { +struct gpio_npm1300_data { struct gpio_driver_data common; }; -static int gpio_npm13xx_port_get_raw(const struct device *dev, uint32_t *value) +static int gpio_npm1300_port_get_raw(const struct device *dev, uint32_t *value) { - const struct gpio_npm13xx_config *config = dev->config; + const struct gpio_npm1300_config *config = dev->config; int ret; uint8_t data; - ret = mfd_npm13xx_reg_read(config->mfd, NPM_GPIO_BASE, NPM_GPIO_OFFSET_STATUS, &data); + ret = mfd_npm1300_reg_read(config->mfd, NPM_GPIO_BASE, NPM_GPIO_OFFSET_STATUS, &data); if (ret < 0) { return ret; @@ -66,22 +66,22 @@ static int gpio_npm13xx_port_get_raw(const struct device *dev, uint32_t *value) return 0; } -static int gpio_npm13xx_port_set_masked_raw(const struct device *dev, gpio_port_pins_t mask, +static int gpio_npm1300_port_set_masked_raw(const struct device *dev, gpio_port_pins_t mask, gpio_port_value_t value) { - const struct gpio_npm13xx_config *config = dev->config; + const struct gpio_npm1300_config *config = dev->config; int ret = 0; - for (size_t idx = 0; idx < NPM13XX_GPIO_PINS; idx++) { + for (size_t idx = 0; idx < NPM1300_GPIO_PINS; idx++) { if ((mask & BIT(idx)) != 0U) { if ((value & BIT(idx)) != 0U) { - ret = mfd_npm13xx_reg_write(config->mfd, NPM_GPIO_BASE, + ret = mfd_npm1300_reg_write(config->mfd, NPM_GPIO_BASE, NPM_GPIO_OFFSET_MODE + idx, - NPM13XX_GPIO_GPOLOGIC1); + NPM1300_GPIO_GPOLOGIC1); } else { - ret = mfd_npm13xx_reg_write(config->mfd, NPM_GPIO_BASE, + ret = mfd_npm1300_reg_write(config->mfd, NPM_GPIO_BASE, NPM_GPIO_OFFSET_MODE + idx, - NPM13XX_GPIO_GPOLOGIC0); + NPM1300_GPIO_GPOLOGIC0); } if (ret != 0U) { return ret; @@ -92,53 +92,53 @@ static int gpio_npm13xx_port_set_masked_raw(const struct device *dev, gpio_port_ return ret; } -static int gpio_npm13xx_port_set_bits_raw(const struct device *dev, gpio_port_pins_t pins) +static int gpio_npm1300_port_set_bits_raw(const struct device *dev, gpio_port_pins_t pins) { - return gpio_npm13xx_port_set_masked_raw(dev, pins, pins); + return gpio_npm1300_port_set_masked_raw(dev, pins, pins); } -static int gpio_npm13xx_port_clear_bits_raw(const struct device *dev, gpio_port_pins_t pins) +static int gpio_npm1300_port_clear_bits_raw(const struct device *dev, gpio_port_pins_t pins) { - return gpio_npm13xx_port_set_masked_raw(dev, pins, 0U); + return gpio_npm1300_port_set_masked_raw(dev, pins, 0U); } -static inline int gpio_npm13xx_configure(const struct device *dev, gpio_pin_t pin, +static inline int gpio_npm1300_configure(const struct device *dev, gpio_pin_t pin, gpio_flags_t flags) { - const struct gpio_npm13xx_config *config = dev->config; + const struct gpio_npm1300_config *config = dev->config; int ret = 0; if (k_is_in_isr()) { return -EWOULDBLOCK; } - if (pin >= NPM13XX_GPIO_PINS) { + if (pin >= NPM1300_GPIO_PINS) { return -EINVAL; } /* Configure mode */ if ((flags & GPIO_INPUT) != 0U) { if (flags & GPIO_ACTIVE_LOW) { - ret = mfd_npm13xx_reg_write(config->mfd, NPM_GPIO_BASE, + ret = mfd_npm1300_reg_write(config->mfd, NPM_GPIO_BASE, NPM_GPIO_OFFSET_MODE + pin, - NPM13XX_GPIO_GPIEVENTFALL); + NPM1300_GPIO_GPIEVENTFALL); } else { - ret = mfd_npm13xx_reg_write(config->mfd, NPM_GPIO_BASE, + ret = mfd_npm1300_reg_write(config->mfd, NPM_GPIO_BASE, NPM_GPIO_OFFSET_MODE + pin, - NPM13XX_GPIO_GPIEVENTRISE); + NPM1300_GPIO_GPIEVENTRISE); } - } else if ((flags & NPM13XX_GPIO_WDT_RESET_ON) != 0U) { - ret = mfd_npm13xx_reg_write(config->mfd, NPM_GPIO_BASE, NPM_GPIO_OFFSET_MODE + pin, - NPM13XX_GPIO_GPORESET); - } else if ((flags & NPM13XX_GPIO_PWRLOSSWARN_ON) != 0U) { - ret = mfd_npm13xx_reg_write(config->mfd, NPM_GPIO_BASE, NPM_GPIO_OFFSET_MODE + pin, - NPM13XX_GPIO_GPOPWRLOSSWARN); + } else if ((flags & NPM1300_GPIO_WDT_RESET_ON) != 0U) { + ret = mfd_npm1300_reg_write(config->mfd, NPM_GPIO_BASE, NPM_GPIO_OFFSET_MODE + pin, + NPM1300_GPIO_GPORESET); + } else if ((flags & NPM1300_GPIO_PWRLOSSWARN_ON) != 0U) { + ret = mfd_npm1300_reg_write(config->mfd, NPM_GPIO_BASE, NPM_GPIO_OFFSET_MODE + pin, + NPM1300_GPIO_GPOPWRLOSSWARN); } else if ((flags & GPIO_OUTPUT_INIT_HIGH) != 0U) { - ret = mfd_npm13xx_reg_write(config->mfd, NPM_GPIO_BASE, NPM_GPIO_OFFSET_MODE + pin, - NPM13XX_GPIO_GPOLOGIC1); + ret = mfd_npm1300_reg_write(config->mfd, NPM_GPIO_BASE, NPM_GPIO_OFFSET_MODE + pin, + NPM1300_GPIO_GPOLOGIC1); } else if ((flags & GPIO_OUTPUT) != 0U) { - ret = mfd_npm13xx_reg_write(config->mfd, NPM_GPIO_BASE, NPM_GPIO_OFFSET_MODE + pin, - NPM13XX_GPIO_GPOLOGIC0); + ret = mfd_npm1300_reg_write(config->mfd, NPM_GPIO_BASE, NPM_GPIO_OFFSET_MODE + pin, + NPM1300_GPIO_GPOLOGIC0); } if (ret < 0) { @@ -146,64 +146,64 @@ static inline int gpio_npm13xx_configure(const struct device *dev, gpio_pin_t pi } /* Configure open drain */ - ret = mfd_npm13xx_reg_write(config->mfd, NPM_GPIO_BASE, NPM_GPIO_OFFSET_OPENDRAIN + pin, + ret = mfd_npm1300_reg_write(config->mfd, NPM_GPIO_BASE, NPM_GPIO_OFFSET_OPENDRAIN + pin, !!(flags & GPIO_SINGLE_ENDED)); if (ret < 0) { return ret; } /* Configure pulls */ - ret = mfd_npm13xx_reg_write(config->mfd, NPM_GPIO_BASE, NPM_GPIO_OFFSET_PULLUP + pin, + ret = mfd_npm1300_reg_write(config->mfd, NPM_GPIO_BASE, NPM_GPIO_OFFSET_PULLUP + pin, !!(flags & GPIO_PULL_UP)); if (ret < 0) { return ret; } - ret = mfd_npm13xx_reg_write(config->mfd, NPM_GPIO_BASE, NPM_GPIO_OFFSET_PULLDOWN + pin, + ret = mfd_npm1300_reg_write(config->mfd, NPM_GPIO_BASE, NPM_GPIO_OFFSET_PULLDOWN + pin, !!(flags & GPIO_PULL_DOWN)); if (ret < 0) { return ret; } /* Configure drive strength and debounce */ - ret = mfd_npm13xx_reg_write(config->mfd, NPM_GPIO_BASE, NPM_GPIO_OFFSET_DRIVE + pin, - !!(flags & NPM13XX_GPIO_DRIVE_6MA)); + ret = mfd_npm1300_reg_write(config->mfd, NPM_GPIO_BASE, NPM_GPIO_OFFSET_DRIVE + pin, + !!(flags & NPM1300_GPIO_DRIVE_6MA)); if (ret < 0) { return ret; } - ret = mfd_npm13xx_reg_write(config->mfd, NPM_GPIO_BASE, NPM_GPIO_OFFSET_DEBOUNCE + pin, - !!(flags & NPM13XX_GPIO_DEBOUNCE_ON)); + ret = mfd_npm1300_reg_write(config->mfd, NPM_GPIO_BASE, NPM_GPIO_OFFSET_DEBOUNCE + pin, + !!(flags & NPM1300_GPIO_DEBOUNCE_ON)); return ret; } -static int gpio_npm13xx_port_toggle_bits(const struct device *dev, gpio_port_pins_t pins) +static int gpio_npm1300_port_toggle_bits(const struct device *dev, gpio_port_pins_t pins) { int ret; uint32_t value; - ret = gpio_npm13xx_port_get_raw(dev, &value); + ret = gpio_npm1300_port_get_raw(dev, &value); if (ret < 0) { return ret; } - return gpio_npm13xx_port_set_masked_raw(dev, pins, ~value); + return gpio_npm1300_port_set_masked_raw(dev, pins, ~value); } -static DEVICE_API(gpio, gpio_npm13xx_api) = { - .pin_configure = gpio_npm13xx_configure, - .port_get_raw = gpio_npm13xx_port_get_raw, - .port_set_masked_raw = gpio_npm13xx_port_set_masked_raw, - .port_set_bits_raw = gpio_npm13xx_port_set_bits_raw, - .port_clear_bits_raw = gpio_npm13xx_port_clear_bits_raw, - .port_toggle_bits = gpio_npm13xx_port_toggle_bits, +static DEVICE_API(gpio, gpio_npm1300_api) = { + .pin_configure = gpio_npm1300_configure, + .port_get_raw = gpio_npm1300_port_get_raw, + .port_set_masked_raw = gpio_npm1300_port_set_masked_raw, + .port_set_bits_raw = gpio_npm1300_port_set_bits_raw, + .port_clear_bits_raw = gpio_npm1300_port_clear_bits_raw, + .port_toggle_bits = gpio_npm1300_port_toggle_bits, }; -static int gpio_npm13xx_init(const struct device *dev) +static int gpio_npm1300_init(const struct device *dev) { - const struct gpio_npm13xx_config *config = dev->config; + const struct gpio_npm1300_config *config = dev->config; if (!device_is_ready(config->mfd)) { return -ENODEV; @@ -212,18 +212,18 @@ static int gpio_npm13xx_init(const struct device *dev) return 0; } -#define GPIO_NPM13XX_DEFINE(n) \ - static const struct gpio_npm13xx_config gpio_npm13xx_config##n = { \ +#define GPIO_NPM1300_DEFINE(n) \ + static const struct gpio_npm1300_config gpio_npm1300_config##n = { \ .common = \ { \ .port_pin_mask = GPIO_PORT_PIN_MASK_FROM_DT_INST(n), \ }, \ .mfd = DEVICE_DT_GET(DT_INST_PARENT(n))}; \ \ - static struct gpio_npm13xx_data gpio_npm13xx_data##n; \ + static struct gpio_npm1300_data gpio_npm1300_data##n; \ \ - DEVICE_DT_INST_DEFINE(n, gpio_npm13xx_init, NULL, &gpio_npm13xx_data##n, \ - &gpio_npm13xx_config##n, POST_KERNEL, \ - CONFIG_GPIO_NPM13XX_INIT_PRIORITY, &gpio_npm13xx_api); + DEVICE_DT_INST_DEFINE(n, gpio_npm1300_init, NULL, &gpio_npm1300_data##n, \ + &gpio_npm1300_config##n, POST_KERNEL, \ + CONFIG_GPIO_NPM1300_INIT_PRIORITY, &gpio_npm1300_api); -DT_INST_FOREACH_STATUS_OKAY(GPIO_NPM13XX_DEFINE) +DT_INST_FOREACH_STATUS_OKAY(GPIO_NPM1300_DEFINE) diff --git a/drivers/led/CMakeLists.txt b/drivers/led/CMakeLists.txt index 1d8b9d2aa960..c4c0752b2550 100644 --- a/drivers/led/CMakeLists.txt +++ b/drivers/led/CMakeLists.txt @@ -12,7 +12,7 @@ zephyr_library_sources_ifdef(CONFIG_IS31FL3733 is31fl3733.c) zephyr_library_sources_ifdef(CONFIG_LED_AXP192_AXP2101 led_axp192.c) zephyr_library_sources_ifdef(CONFIG_LED_DAC led_dac.c) zephyr_library_sources_ifdef(CONFIG_LED_GPIO led_gpio.c) -zephyr_library_sources_ifdef(CONFIG_LED_NPM13XX led_npm13xx.c) +zephyr_library_sources_ifdef(CONFIG_LED_NPM1300 led_npm13xx.c) zephyr_library_sources_ifdef(CONFIG_LED_PWM led_pwm.c) zephyr_library_sources_ifdef(CONFIG_LED_XEC led_mchp_xec.c) zephyr_library_sources_ifdef(CONFIG_LP3943 lp3943.c) diff --git a/drivers/led/Kconfig.npm13xx b/drivers/led/Kconfig.npm13xx index e3f40f42a193..e5180aa1dd1d 100644 --- a/drivers/led/Kconfig.npm13xx +++ b/drivers/led/Kconfig.npm13xx @@ -1,11 +1,11 @@ # Copyright (c) 2023 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -config LED_NPM13XX - bool "nPM13xx LED driver" +config LED_NPM1300 + bool "nPM1300 LED driver" default y depends on DT_HAS_NORDIC_NPM1300_LED_ENABLED select I2C select MFD help - Enable the nPM13xx LED driver. + Enable the nPM1300 LED driver. diff --git a/drivers/led/led_npm13xx.c b/drivers/led/led_npm13xx.c index eed9b1256bec..9052159e7392 100644 --- a/drivers/led/led_npm13xx.c +++ b/drivers/led/led_npm13xx.c @@ -11,30 +11,30 @@ #include #include -/* nPM13xx LED base address */ +/* nPM1300 LED base address */ #define NPM_LED_BASE 0x0AU -/* nPM13xx LED register offsets */ +/* nPM1300 LED register offsets */ #define NPM_LED_OFFSET_MODE 0x00U #define NPM_LED_OFFSET_SET 0x03U #define NPM_LED_OFFSET_CLR 0x04U -/* nPM13xx Channel counts */ -#define NPM13XX_LED_PINS 3U +/* nPM1300 Channel counts */ +#define NPM1300_LED_PINS 3U -/* nPM13xx LED modes */ +/* nPM1300 LED modes */ #define NPM_LED_HOST 2U -struct led_npm13xx_config { +struct led_npm1300_config { const struct device *mfd; - uint8_t mode[NPM13XX_LED_PINS]; + uint8_t mode[NPM1300_LED_PINS]; }; -static int led_npm13xx_on(const struct device *dev, uint32_t led) +static int led_npm1300_on(const struct device *dev, uint32_t led) { - const struct led_npm13xx_config *config = dev->config; + const struct led_npm1300_config *config = dev->config; - if (led >= NPM13XX_LED_PINS) { + if (led >= NPM1300_LED_PINS) { return -EINVAL; } @@ -42,15 +42,15 @@ static int led_npm13xx_on(const struct device *dev, uint32_t led) return -EPERM; } - return mfd_npm13xx_reg_write(config->mfd, NPM_LED_BASE, NPM_LED_OFFSET_SET + (led * 2U), + return mfd_npm1300_reg_write(config->mfd, NPM_LED_BASE, NPM_LED_OFFSET_SET + (led * 2U), 1U); } -static int led_npm13xx_off(const struct device *dev, uint32_t led) +static int led_npm1300_off(const struct device *dev, uint32_t led) { - const struct led_npm13xx_config *config = dev->config; + const struct led_npm1300_config *config = dev->config; - if (led >= NPM13XX_LED_PINS) { + if (led >= NPM1300_LED_PINS) { return -EINVAL; } @@ -58,25 +58,25 @@ static int led_npm13xx_off(const struct device *dev, uint32_t led) return -EPERM; } - return mfd_npm13xx_reg_write(config->mfd, NPM_LED_BASE, NPM_LED_OFFSET_CLR + (led * 2U), + return mfd_npm1300_reg_write(config->mfd, NPM_LED_BASE, NPM_LED_OFFSET_CLR + (led * 2U), 1U); } -static DEVICE_API(led, led_npm13xx_api) = { - .on = led_npm13xx_on, - .off = led_npm13xx_off, +static DEVICE_API(led, led_npm1300_api) = { + .on = led_npm1300_on, + .off = led_npm1300_off, }; -static int led_npm13xx_init(const struct device *dev) +static int led_npm1300_init(const struct device *dev) { - const struct led_npm13xx_config *config = dev->config; + const struct led_npm1300_config *config = dev->config; if (!device_is_ready(config->mfd)) { return -ENODEV; } - for (uint8_t led = 0U; led < NPM13XX_LED_PINS; led++) { - int ret = mfd_npm13xx_reg_write(config->mfd, NPM_LED_BASE, + for (uint8_t led = 0U; led < NPM1300_LED_PINS; led++) { + int ret = mfd_npm1300_reg_write(config->mfd, NPM_LED_BASE, NPM_LED_OFFSET_MODE + led, config->mode[led]); if (ret < 0) { @@ -87,14 +87,14 @@ static int led_npm13xx_init(const struct device *dev) return 0; } -#define LED_NPM13XX_DEFINE(n) \ - static const struct led_npm13xx_config led_npm13xx_config##n = { \ +#define LED_NPM1300_DEFINE(n) \ + static const struct led_npm1300_config led_npm1300_config##n = { \ .mfd = DEVICE_DT_GET(DT_INST_PARENT(n)), \ .mode = {DT_INST_ENUM_IDX(n, nordic_led0_mode), \ DT_INST_ENUM_IDX(n, nordic_led1_mode), \ DT_INST_ENUM_IDX(n, nordic_led2_mode)}}; \ \ - DEVICE_DT_INST_DEFINE(n, &led_npm13xx_init, NULL, NULL, &led_npm13xx_config##n, \ - POST_KERNEL, CONFIG_LED_INIT_PRIORITY, &led_npm13xx_api); + DEVICE_DT_INST_DEFINE(n, &led_npm1300_init, NULL, NULL, &led_npm1300_config##n, \ + POST_KERNEL, CONFIG_LED_INIT_PRIORITY, &led_npm1300_api); -DT_INST_FOREACH_STATUS_OKAY(LED_NPM13XX_DEFINE) +DT_INST_FOREACH_STATUS_OKAY(LED_NPM1300_DEFINE) diff --git a/drivers/mfd/CMakeLists.txt b/drivers/mfd/CMakeLists.txt index 3c477fc7da86..24a1c698e768 100644 --- a/drivers/mfd/CMakeLists.txt +++ b/drivers/mfd/CMakeLists.txt @@ -6,7 +6,7 @@ zephyr_library() zephyr_library_sources_ifdef(CONFIG_MFD_ADP5585 mfd_adp5585.c) zephyr_library_sources_ifdef(CONFIG_MFD_MAX20335 mfd_max20335.c) zephyr_library_sources_ifdef(CONFIG_MFD_NCT38XX mfd_nct38xx.c) -zephyr_library_sources_ifdef(CONFIG_MFD_NPM13XX mfd_npm13xx.c) +zephyr_library_sources_ifdef(CONFIG_MFD_NPM1300 mfd_npm13xx.c) zephyr_library_sources_ifdef(CONFIG_MFD_NPM2100 mfd_npm2100.c) zephyr_library_sources_ifdef(CONFIG_MFD_NPM6001 mfd_npm6001.c) zephyr_library_sources_ifdef(CONFIG_MFD_AXP192_AXP2101 mfd_axp192.c) diff --git a/drivers/mfd/Kconfig.npm13xx b/drivers/mfd/Kconfig.npm13xx index 63f18ac9a3b3..56a54f3005ab 100644 --- a/drivers/mfd/Kconfig.npm13xx +++ b/drivers/mfd/Kconfig.npm13xx @@ -1,17 +1,17 @@ # Copyright (c) 2023 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -config MFD_NPM13XX - bool "nPM13xx PMIC multi-function device driver" +config MFD_NPM1300 + bool "nPM1300 PMIC multi-function device driver" default y depends on DT_HAS_NORDIC_NPM1300_ENABLED select I2C help - Enable the Nordic nPM13xx PMIC multi-function device driver + Enable the Nordic nPM1300 PMIC multi-function device driver -config MFD_NPM13XX_INIT_PRIORITY - int "nPM13xx MFD initialization priority" +config MFD_NPM1300_INIT_PRIORITY + int "nPM1300 MFD initialization priority" default MFD_INIT_PRIORITY - depends on MFD_NPM13XX + depends on MFD_NPM1300 help - Multi-function device initialization priority for nPM13xx. + Multi-function device initialization priority for nPM1300. diff --git a/drivers/mfd/mfd_npm13xx.c b/drivers/mfd/mfd_npm13xx.c index 9847e4a9e495..21961b1696a6 100644 --- a/drivers/mfd/mfd_npm13xx.c +++ b/drivers/mfd/mfd_npm13xx.c @@ -42,7 +42,7 @@ #define GPIO_MODE_GPOIRQ 5 -struct mfd_npm13xx_config { +struct mfd_npm1300_config { struct i2c_dt_spec i2c; struct gpio_dt_spec host_int_gpios; uint8_t pmic_int_pin; @@ -50,7 +50,7 @@ struct mfd_npm13xx_config { uint8_t lp_reset; }; -struct mfd_npm13xx_data { +struct mfd_npm1300_data { struct k_mutex mutex; const struct device *dev; struct gpio_callback gpio_cb; @@ -63,51 +63,51 @@ struct event_reg_t { uint8_t mask; }; -static const struct event_reg_t event_reg[NPM13XX_EVENT_MAX] = { - [NPM13XX_EVENT_CHG_COMPLETED] = {0x0AU, 0x10U}, - [NPM13XX_EVENT_CHG_ERROR] = {0x0AU, 0x20U}, - [NPM13XX_EVENT_BATTERY_DETECTED] = {0x0EU, 0x01U}, - [NPM13XX_EVENT_BATTERY_REMOVED] = {0x0EU, 0x02U}, - [NPM13XX_EVENT_SHIPHOLD_PRESS] = {0x12U, 0x01U}, - [NPM13XX_EVENT_SHIPHOLD_RELEASE] = {0x12U, 0x02U}, - [NPM13XX_EVENT_WATCHDOG_WARN] = {0x12U, 0x08U}, - [NPM13XX_EVENT_VBUS_DETECTED] = {0x16U, 0x01U}, - [NPM13XX_EVENT_VBUS_REMOVED] = {0x16U, 0x02U}, - [NPM13XX_EVENT_GPIO0_EDGE] = {0x22U, 0x01U}, - [NPM13XX_EVENT_GPIO1_EDGE] = {0x22U, 0x02U}, - [NPM13XX_EVENT_GPIO2_EDGE] = {0x22U, 0x04U}, - [NPM13XX_EVENT_GPIO3_EDGE] = {0x22U, 0x08U}, - [NPM13XX_EVENT_GPIO4_EDGE] = {0x22U, 0x10U}, +static const struct event_reg_t event_reg[NPM1300_EVENT_MAX] = { + [NPM1300_EVENT_CHG_COMPLETED] = {0x0AU, 0x10U}, + [NPM1300_EVENT_CHG_ERROR] = {0x0AU, 0x20U}, + [NPM1300_EVENT_BATTERY_DETECTED] = {0x0EU, 0x01U}, + [NPM1300_EVENT_BATTERY_REMOVED] = {0x0EU, 0x02U}, + [NPM1300_EVENT_SHIPHOLD_PRESS] = {0x12U, 0x01U}, + [NPM1300_EVENT_SHIPHOLD_RELEASE] = {0x12U, 0x02U}, + [NPM1300_EVENT_WATCHDOG_WARN] = {0x12U, 0x08U}, + [NPM1300_EVENT_VBUS_DETECTED] = {0x16U, 0x01U}, + [NPM1300_EVENT_VBUS_REMOVED] = {0x16U, 0x02U}, + [NPM1300_EVENT_GPIO0_EDGE] = {0x22U, 0x01U}, + [NPM1300_EVENT_GPIO1_EDGE] = {0x22U, 0x02U}, + [NPM1300_EVENT_GPIO2_EDGE] = {0x22U, 0x04U}, + [NPM1300_EVENT_GPIO3_EDGE] = {0x22U, 0x08U}, + [NPM1300_EVENT_GPIO4_EDGE] = {0x22U, 0x10U}, }; static void gpio_callback(const struct device *dev, struct gpio_callback *cb, uint32_t pins) { - struct mfd_npm13xx_data *data = CONTAINER_OF(cb, struct mfd_npm13xx_data, gpio_cb); + struct mfd_npm1300_data *data = CONTAINER_OF(cb, struct mfd_npm1300_data, gpio_cb); k_work_submit(&data->work); } static void work_callback(struct k_work *work) { - struct mfd_npm13xx_data *data = CONTAINER_OF(work, struct mfd_npm13xx_data, work); - const struct mfd_npm13xx_config *config = data->dev->config; + struct mfd_npm1300_data *data = CONTAINER_OF(work, struct mfd_npm1300_data, work); + const struct mfd_npm1300_config *config = data->dev->config; uint8_t buf[MAIN_SIZE]; int ret; /* Read all MAIN registers into temporary buffer */ - ret = mfd_npm13xx_reg_read_burst(data->dev, MAIN_BASE, 0U, buf, sizeof(buf)); + ret = mfd_npm1300_reg_read_burst(data->dev, MAIN_BASE, 0U, buf, sizeof(buf)); if (ret < 0) { k_work_submit(&data->work); return; } - for (int i = 0; i < NPM13XX_EVENT_MAX; i++) { + for (int i = 0; i < NPM1300_EVENT_MAX; i++) { int offset = event_reg[i].offset + MAIN_OFFSET_CLR; if ((buf[offset] & event_reg[i].mask) != 0U) { gpio_fire_callbacks(&data->callbacks, data->dev, BIT(i)); - ret = mfd_npm13xx_reg_write(data->dev, MAIN_BASE, offset, + ret = mfd_npm1300_reg_write(data->dev, MAIN_BASE, offset, event_reg[i].mask); if (ret < 0) { k_work_submit(&data->work); @@ -122,10 +122,10 @@ static void work_callback(struct k_work *work) } } -static int mfd_npm13xx_init(const struct device *dev) +static int mfd_npm1300_init(const struct device *dev) { - const struct mfd_npm13xx_config *config = dev->config; - struct mfd_npm13xx_data *mfd_data = dev->data; + const struct mfd_npm1300_config *config = dev->config; + struct mfd_npm1300_data *mfd_data = dev->data; int ret; if (!i2c_is_ready_dt(&config->i2c)) { @@ -138,7 +138,7 @@ static int mfd_npm13xx_init(const struct device *dev) if (config->host_int_gpios.port != NULL) { /* Set specified PMIC pin to be interrupt output */ - ret = mfd_npm13xx_reg_write(dev, GPIO_BASE, GPIO_OFFSET_MODE + config->pmic_int_pin, + ret = mfd_npm1300_reg_write(dev, GPIO_BASE, GPIO_OFFSET_MODE + config->pmic_int_pin, GPIO_MODE_GPOIRQ); if (ret < 0) { return ret; @@ -171,64 +171,64 @@ static int mfd_npm13xx_init(const struct device *dev) } } - ret = mfd_npm13xx_reg_write(dev, SHIP_BASE, SHIP_OFFSET_CONFIG, config->active_time); + ret = mfd_npm1300_reg_write(dev, SHIP_BASE, SHIP_OFFSET_CONFIG, config->active_time); if (ret < 0) { return ret; } - ret = mfd_npm13xx_reg_write(dev, SHIP_BASE, SHIP_OFFSET_LPCONFIG, config->lp_reset); + ret = mfd_npm1300_reg_write(dev, SHIP_BASE, SHIP_OFFSET_LPCONFIG, config->lp_reset); if (ret < 0) { return ret; } - return mfd_npm13xx_reg_write(dev, SHIP_BASE, SHIP_OFFSET_CFGSTROBE, 1U); + return mfd_npm1300_reg_write(dev, SHIP_BASE, SHIP_OFFSET_CFGSTROBE, 1U); } -int mfd_npm13xx_reg_read_burst(const struct device *dev, uint8_t base, uint8_t offset, void *data, +int mfd_npm1300_reg_read_burst(const struct device *dev, uint8_t base, uint8_t offset, void *data, size_t len) { - const struct mfd_npm13xx_config *config = dev->config; + const struct mfd_npm1300_config *config = dev->config; uint8_t buff[] = {base, offset}; return i2c_write_read_dt(&config->i2c, buff, sizeof(buff), data, len); } -int mfd_npm13xx_reg_read(const struct device *dev, uint8_t base, uint8_t offset, uint8_t *data) +int mfd_npm1300_reg_read(const struct device *dev, uint8_t base, uint8_t offset, uint8_t *data) { - return mfd_npm13xx_reg_read_burst(dev, base, offset, data, 1U); + return mfd_npm1300_reg_read_burst(dev, base, offset, data, 1U); } -int mfd_npm13xx_reg_write(const struct device *dev, uint8_t base, uint8_t offset, uint8_t data) +int mfd_npm1300_reg_write(const struct device *dev, uint8_t base, uint8_t offset, uint8_t data) { - const struct mfd_npm13xx_config *config = dev->config; + const struct mfd_npm1300_config *config = dev->config; uint8_t buff[] = {base, offset, data}; return i2c_write_dt(&config->i2c, buff, sizeof(buff)); } -int mfd_npm13xx_reg_write2(const struct device *dev, uint8_t base, uint8_t offset, uint8_t data1, +int mfd_npm1300_reg_write2(const struct device *dev, uint8_t base, uint8_t offset, uint8_t data1, uint8_t data2) { - const struct mfd_npm13xx_config *config = dev->config; + const struct mfd_npm1300_config *config = dev->config; uint8_t buff[] = {base, offset, data1, data2}; return i2c_write_dt(&config->i2c, buff, sizeof(buff)); } -int mfd_npm13xx_reg_update(const struct device *dev, uint8_t base, uint8_t offset, uint8_t data, +int mfd_npm1300_reg_update(const struct device *dev, uint8_t base, uint8_t offset, uint8_t data, uint8_t mask) { - struct mfd_npm13xx_data *mfd_data = dev->data; + struct mfd_npm1300_data *mfd_data = dev->data; uint8_t reg; int ret; k_mutex_lock(&mfd_data->mutex, K_FOREVER); - ret = mfd_npm13xx_reg_read(dev, base, offset, ®); + ret = mfd_npm1300_reg_read(dev, base, offset, ®); if (ret == 0) { reg = (reg & ~mask) | (data & mask); - ret = mfd_npm13xx_reg_write(dev, base, offset, reg); + ret = mfd_npm1300_reg_write(dev, base, offset, reg); } k_mutex_unlock(&mfd_data->mutex); @@ -236,9 +236,9 @@ int mfd_npm13xx_reg_update(const struct device *dev, uint8_t base, uint8_t offse return ret; } -int mfd_npm13xx_set_timer(const struct device *dev, uint32_t time_ms) +int mfd_npm1300_set_timer(const struct device *dev, uint32_t time_ms) { - const struct mfd_npm13xx_config *config = dev->config; + const struct mfd_npm1300_config *config = dev->config; uint8_t buff[5] = {TIME_BASE, TIME_OFFSET_TIMER}; uint32_t ticks = time_ms / TIMER_PRESCALER_MS; @@ -254,34 +254,34 @@ int mfd_npm13xx_set_timer(const struct device *dev, uint32_t time_ms) return ret; } - return mfd_npm13xx_reg_write(dev, TIME_BASE, TIME_OFFSET_LOAD, 1U); + return mfd_npm1300_reg_write(dev, TIME_BASE, TIME_OFFSET_LOAD, 1U); } -int mfd_npm13xx_reset(const struct device *dev) +int mfd_npm1300_reset(const struct device *dev) { - return mfd_npm13xx_reg_write(dev, MAIN_BASE, MAIN_OFFSET_RESET, 1U); + return mfd_npm1300_reg_write(dev, MAIN_BASE, MAIN_OFFSET_RESET, 1U); } -int mfd_npm13xx_hibernate(const struct device *dev, uint32_t time_ms) +int mfd_npm1300_hibernate(const struct device *dev, uint32_t time_ms) { - int ret = mfd_npm13xx_set_timer(dev, time_ms); + int ret = mfd_npm1300_set_timer(dev, time_ms); if (ret != 0) { return ret; } - return mfd_npm13xx_reg_write(dev, SHIP_BASE, SHIP_OFFSET_HIBERNATE, 1U); + return mfd_npm1300_reg_write(dev, SHIP_BASE, SHIP_OFFSET_HIBERNATE, 1U); } -int mfd_npm13xx_add_callback(const struct device *dev, struct gpio_callback *callback) +int mfd_npm1300_add_callback(const struct device *dev, struct gpio_callback *callback) { - struct mfd_npm13xx_data *data = dev->data; + struct mfd_npm1300_data *data = dev->data; /* Enable interrupts for specified events */ - for (int i = 0; i < NPM13XX_EVENT_MAX; i++) { + for (int i = 0; i < NPM1300_EVENT_MAX; i++) { if ((callback->pin_mask & BIT(i)) != 0U) { /* Clear pending interrupt */ - int ret = mfd_npm13xx_reg_write(data->dev, MAIN_BASE, + int ret = mfd_npm1300_reg_write(data->dev, MAIN_BASE, event_reg[i].offset + MAIN_OFFSET_CLR, event_reg[i].mask); @@ -289,7 +289,7 @@ int mfd_npm13xx_add_callback(const struct device *dev, struct gpio_callback *cal return ret; } - ret = mfd_npm13xx_reg_write(data->dev, MAIN_BASE, + ret = mfd_npm1300_reg_write(data->dev, MAIN_BASE, event_reg[i].offset + MAIN_OFFSET_INTENSET, event_reg[i].mask); if (ret < 0) { @@ -301,17 +301,17 @@ int mfd_npm13xx_add_callback(const struct device *dev, struct gpio_callback *cal return gpio_manage_callback(&data->callbacks, callback, true); } -int mfd_npm13xx_remove_callback(const struct device *dev, struct gpio_callback *callback) +int mfd_npm1300_remove_callback(const struct device *dev, struct gpio_callback *callback) { - struct mfd_npm13xx_data *data = dev->data; + struct mfd_npm1300_data *data = dev->data; return gpio_manage_callback(&data->callbacks, callback, false); } -#define MFD_NPM13XX_DEFINE(inst) \ - static struct mfd_npm13xx_data data_##inst; \ +#define MFD_NPM1300_DEFINE(inst) \ + static struct mfd_npm1300_data data_##inst; \ \ - static const struct mfd_npm13xx_config config##inst = { \ + static const struct mfd_npm1300_config config##inst = { \ .i2c = I2C_DT_SPEC_INST_GET(inst), \ .host_int_gpios = GPIO_DT_SPEC_INST_GET_OR(inst, host_int_gpios, {0}), \ .pmic_int_pin = DT_INST_PROP_OR(inst, pmic_int_pin, 0), \ @@ -319,7 +319,7 @@ int mfd_npm13xx_remove_callback(const struct device *dev, struct gpio_callback * .lp_reset = DT_INST_ENUM_IDX_OR(inst, long_press_reset, 0), \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, mfd_npm13xx_init, NULL, &data_##inst, &config##inst, \ - POST_KERNEL, CONFIG_MFD_NPM13XX_INIT_PRIORITY, NULL); + DEVICE_DT_INST_DEFINE(inst, mfd_npm1300_init, NULL, &data_##inst, &config##inst, \ + POST_KERNEL, CONFIG_MFD_NPM1300_INIT_PRIORITY, NULL); -DT_INST_FOREACH_STATUS_OKAY(MFD_NPM13XX_DEFINE) +DT_INST_FOREACH_STATUS_OKAY(MFD_NPM1300_DEFINE) diff --git a/drivers/regulator/CMakeLists.txt b/drivers/regulator/CMakeLists.txt index 283fd976de73..817518d9b2f9 100644 --- a/drivers/regulator/CMakeLists.txt +++ b/drivers/regulator/CMakeLists.txt @@ -13,7 +13,7 @@ zephyr_library_sources_ifdef(CONFIG_REGULATOR_FIXED regulator_fixed.c) zephyr_library_sources_ifdef(CONFIG_REGULATOR_GPIO regulator_gpio.c) zephyr_library_sources_ifdef(CONFIG_REGULATOR_MAX20335 regulator_max20335.c) zephyr_library_sources_ifdef(CONFIG_REGULATOR_NPM1100 regulator_npm1100.c) -zephyr_library_sources_ifdef(CONFIG_REGULATOR_NPM13XX regulator_npm13xx.c) +zephyr_library_sources_ifdef(CONFIG_REGULATOR_NPM1300 regulator_npm13xx.c) zephyr_library_sources_ifdef(CONFIG_REGULATOR_NPM2100 regulator_npm2100.c) zephyr_library_sources_ifdef(CONFIG_REGULATOR_NPM6001 regulator_npm6001.c) zephyr_library_sources_ifdef(CONFIG_REGULATOR_PCA9420 regulator_pca9420.c) diff --git a/drivers/regulator/Kconfig.npm13xx b/drivers/regulator/Kconfig.npm13xx index 4d243b8cdf84..19adee0ebab2 100644 --- a/drivers/regulator/Kconfig.npm13xx +++ b/drivers/regulator/Kconfig.npm13xx @@ -1,29 +1,29 @@ # Copyright (c) 2023 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -config REGULATOR_NPM13XX - bool "nPM13xx PMIC regulator driver" +config REGULATOR_NPM1300 + bool "nPM1300 PMIC regulator driver" default y depends on DT_HAS_NORDIC_NPM1300_REGULATOR_ENABLED select I2C select MFD help - Enable the Nordic nPM13xx PMIC regulator driver + Enable the Nordic nPM1300 PMIC regulator driver -if REGULATOR_NPM13XX +if REGULATOR_NPM1300 -config REGULATOR_NPM13XX_COMMON_INIT_PRIORITY - int "nPM13xx regulator driver init priority (common part)" +config REGULATOR_NPM1300_COMMON_INIT_PRIORITY + int "nPM1300 regulator driver init priority (common part)" default 85 help - Init priority for the Nordic nPM13xx regulator driver (common part). + Init priority for the Nordic nPM1300 regulator driver (common part). It must be greater than I2C init priority. -config REGULATOR_NPM13XX_INIT_PRIORITY - int "nPM13xx regulator driver init priority" +config REGULATOR_NPM1300_INIT_PRIORITY + int "nPM1300 regulator driver init priority" default 86 help - Init priority for the Nordic nPM13xx regulator driver. It must be - greater than REGULATOR_NPM13XX_COMMON_INIT_PRIORITY. + Init priority for the Nordic nPM1300 regulator driver. It must be + greater than REGULATOR_NPM1300_COMMON_INIT_PRIORITY. endif diff --git a/drivers/regulator/regulator_npm13xx.c b/drivers/regulator/regulator_npm13xx.c index 89ee1993ed39..913f51456af4 100644 --- a/drivers/regulator/regulator_npm13xx.c +++ b/drivers/regulator/regulator_npm13xx.c @@ -15,27 +15,27 @@ #include #include -/* nPM13xx voltage sources */ -enum npm13xx_sources { - NPM13XX_SOURCE_BUCK1, - NPM13XX_SOURCE_BUCK2, - NPM13XX_SOURCE_LDO1, - NPM13XX_SOURCE_LDO2, +/* nPM1300 voltage sources */ +enum npm1300_sources { + NPM1300_SOURCE_BUCK1, + NPM1300_SOURCE_BUCK2, + NPM1300_SOURCE_LDO1, + NPM1300_SOURCE_LDO2, }; -/* nPM13xx gpio control channels */ -enum npm13xx_gpio_type { - NPM13XX_GPIO_TYPE_ENABLE, - NPM13XX_GPIO_TYPE_RETENTION, - NPM13XX_GPIO_TYPE_PWM +/* nPM1300 gpio control channels */ +enum npm1300_gpio_type { + NPM1300_GPIO_TYPE_ENABLE, + NPM1300_GPIO_TYPE_RETENTION, + NPM1300_GPIO_TYPE_PWM }; -/* nPM13xx regulator base addresses */ +/* nPM1300 regulator base addresses */ #define BUCK_BASE 0x04U #define LDSW_BASE 0x08U #define SHIP_BASE 0x0BU -/* nPM13xx regulator register offsets */ +/* nPM1300 regulator register offsets */ #define BUCK_OFFSET_EN_SET 0x00U #define BUCK_OFFSET_EN_CLR 0x01U #define BUCK_OFFSET_PWM_SET 0x04U @@ -50,7 +50,7 @@ enum npm13xx_gpio_type { #define BUCK_OFFSET_CTRL0 0x15U #define BUCK_OFFSET_STATUS 0x34U -/* nPM13xx ldsw register offsets */ +/* nPM1300 ldsw register offsets */ #define LDSW_OFFSET_EN_SET 0x00U #define LDSW_OFFSET_EN_CLR 0x01U #define LDSW_OFFSET_STATUS 0x04U @@ -59,7 +59,7 @@ enum npm13xx_gpio_type { #define LDSW_OFFSET_LDOSEL 0x08U #define LDSW_OFFSET_VOUTSEL 0x0CU -/* nPM13xx ship register offsets */ +/* nPM1300 ship register offsets */ #define SHIP_OFFSET_SHIP 0x02U #define BUCK1_ON_MASK 0x04U @@ -77,62 +77,62 @@ enum npm13xx_gpio_type { #define LDSW2_SOFTSTART_SHIFT 4U #define LDSW2_ACTIVE_DISCHARGE_MASK BIT(7) -#define NPM13XX_GPIO_UNUSED UINT8_MAX +#define NPM1300_GPIO_UNUSED UINT8_MAX -struct npm13xx_gpio_info { +struct npm1300_gpio_info { uint8_t pin; bool invert; }; -struct regulator_npm13xx_pconfig { +struct regulator_npm1300_pconfig { const struct device *mfd; struct gpio_dt_spec dvs_state_pins[5]; }; -struct regulator_npm13xx_config { +struct regulator_npm1300_config { struct regulator_common_config common; const struct device *mfd; uint8_t source; int32_t retention_uv; - struct npm13xx_gpio_info enable_gpios; - struct npm13xx_gpio_info retention_gpios; - struct npm13xx_gpio_info pwm_gpios; + struct npm1300_gpio_info enable_gpios; + struct npm1300_gpio_info retention_gpios; + struct npm1300_gpio_info pwm_gpios; uint8_t soft_start; bool active_discharge; bool ldo_disable_workaround; }; -struct regulator_npm13xx_data { +struct regulator_npm1300_data { struct regulator_common_data data; }; /* Linear range for output voltage, common for all bucks and LDOs on this device */ static const struct linear_range buckldo_range = LINEAR_RANGE_INIT(1000000, 100000, 0U, 23U); -unsigned int regulator_npm13xx_count_voltages(const struct device *dev) +unsigned int regulator_npm1300_count_voltages(const struct device *dev) { - const struct regulator_npm13xx_config *config = dev->config; + const struct regulator_npm1300_config *config = dev->config; switch (config->source) { - case NPM13XX_SOURCE_BUCK1: - case NPM13XX_SOURCE_BUCK2: - case NPM13XX_SOURCE_LDO1: - case NPM13XX_SOURCE_LDO2: + case NPM1300_SOURCE_BUCK1: + case NPM1300_SOURCE_BUCK2: + case NPM1300_SOURCE_LDO1: + case NPM1300_SOURCE_LDO2: return linear_range_values_count(&buckldo_range); default: return 0; } } -int regulator_npm13xx_list_voltage(const struct device *dev, unsigned int idx, int32_t *volt_uv) +int regulator_npm1300_list_voltage(const struct device *dev, unsigned int idx, int32_t *volt_uv) { - const struct regulator_npm13xx_config *config = dev->config; + const struct regulator_npm1300_config *config = dev->config; switch (config->source) { - case NPM13XX_SOURCE_BUCK1: - case NPM13XX_SOURCE_BUCK2: - case NPM13XX_SOURCE_LDO1: - case NPM13XX_SOURCE_LDO2: + case NPM1300_SOURCE_BUCK1: + case NPM1300_SOURCE_BUCK2: + case NPM1300_SOURCE_LDO1: + case NPM1300_SOURCE_LDO2: return linear_range_get_value(&buckldo_range, idx, volt_uv); default: return -EINVAL; @@ -141,16 +141,16 @@ int regulator_npm13xx_list_voltage(const struct device *dev, unsigned int idx, i static int retention_set_voltage(const struct device *dev, int32_t retention_uv) { - const struct regulator_npm13xx_config *config = dev->config; + const struct regulator_npm1300_config *config = dev->config; uint16_t idx; uint8_t chan; int ret; switch (config->source) { - case NPM13XX_SOURCE_BUCK1: + case NPM1300_SOURCE_BUCK1: chan = 0U; break; - case NPM13XX_SOURCE_BUCK2: + case NPM1300_SOURCE_BUCK2: chan = 1U; break; default: @@ -163,17 +163,17 @@ static int retention_set_voltage(const struct device *dev, int32_t retention_uv) return ret; } - return mfd_npm13xx_reg_write(config->mfd, BUCK_BASE, BUCK_OFFSET_VOUT_RET + (chan * 2U), + return mfd_npm1300_reg_write(config->mfd, BUCK_BASE, BUCK_OFFSET_VOUT_RET + (chan * 2U), idx); } static int buck_get_voltage_index(const struct device *dev, uint8_t chan, uint8_t *idx) { - const struct regulator_npm13xx_config *config = dev->config; + const struct regulator_npm1300_config *config = dev->config; uint8_t sel; int ret; - ret = mfd_npm13xx_reg_read(config->mfd, BUCK_BASE, BUCK_OFFSET_SW_CTRL, &sel); + ret = mfd_npm1300_reg_read(config->mfd, BUCK_BASE, BUCK_OFFSET_SW_CTRL, &sel); if (ret < 0) { return ret; @@ -181,17 +181,17 @@ static int buck_get_voltage_index(const struct device *dev, uint8_t chan, uint8_ if ((sel >> chan) & 1U) { /* SW control */ - return mfd_npm13xx_reg_read(config->mfd, BUCK_BASE, + return mfd_npm1300_reg_read(config->mfd, BUCK_BASE, BUCK_OFFSET_VOUT_NORM + (chan * 2U), idx); } /* VSET pin control */ - return mfd_npm13xx_reg_read(config->mfd, BUCK_BASE, BUCK_OFFSET_VOUT_STAT + chan, idx); + return mfd_npm1300_reg_read(config->mfd, BUCK_BASE, BUCK_OFFSET_VOUT_STAT + chan, idx); } static int buck_set_voltage(const struct device *dev, uint8_t chan, int32_t min_uv, int32_t max_uv) { - const struct regulator_npm13xx_config *config = dev->config; + const struct regulator_npm1300_config *config = dev->config; uint8_t mask; uint8_t curr_idx; uint16_t idx; @@ -210,7 +210,7 @@ static int buck_set_voltage(const struct device *dev, uint8_t chan, int32_t min_ return ret; } - ret = mfd_npm13xx_reg_write(config->mfd, BUCK_BASE, BUCK_OFFSET_VOUT_NORM + (chan * 2U), + ret = mfd_npm1300_reg_write(config->mfd, BUCK_BASE, BUCK_OFFSET_VOUT_NORM + (chan * 2U), idx); if (ret < 0) { @@ -219,12 +219,12 @@ static int buck_set_voltage(const struct device *dev, uint8_t chan, int32_t min_ /* Enable SW control of buck output */ mask = BIT(chan); - return mfd_npm13xx_reg_update(config->mfd, BUCK_BASE, BUCK_OFFSET_SW_CTRL, mask, mask); + return mfd_npm1300_reg_update(config->mfd, BUCK_BASE, BUCK_OFFSET_SW_CTRL, mask, mask); } static int ldo_set_voltage(const struct device *dev, uint8_t chan, int32_t min_uv, int32_t max_uv) { - const struct regulator_npm13xx_config *config = dev->config; + const struct regulator_npm1300_config *config = dev->config; uint16_t idx; int ret; @@ -234,21 +234,21 @@ static int ldo_set_voltage(const struct device *dev, uint8_t chan, int32_t min_u return ret; } - return mfd_npm13xx_reg_write(config->mfd, LDSW_BASE, LDSW_OFFSET_VOUTSEL + chan, idx); + return mfd_npm1300_reg_write(config->mfd, LDSW_BASE, LDSW_OFFSET_VOUTSEL + chan, idx); } -int regulator_npm13xx_set_voltage(const struct device *dev, int32_t min_uv, int32_t max_uv) +int regulator_npm1300_set_voltage(const struct device *dev, int32_t min_uv, int32_t max_uv) { - const struct regulator_npm13xx_config *config = dev->config; + const struct regulator_npm1300_config *config = dev->config; switch (config->source) { - case NPM13XX_SOURCE_BUCK1: + case NPM1300_SOURCE_BUCK1: return buck_set_voltage(dev, 0, min_uv, max_uv); - case NPM13XX_SOURCE_BUCK2: + case NPM1300_SOURCE_BUCK2: return buck_set_voltage(dev, 1, min_uv, max_uv); - case NPM13XX_SOURCE_LDO1: + case NPM1300_SOURCE_LDO1: return ldo_set_voltage(dev, 0, min_uv, max_uv); - case NPM13XX_SOURCE_LDO2: + case NPM1300_SOURCE_LDO2: return ldo_set_voltage(dev, 1, min_uv, max_uv); default: return -ENODEV; @@ -271,11 +271,11 @@ static int buck_get_voltage(const struct device *dev, uint8_t chan, int32_t *vol static int ldo_get_voltage(const struct device *dev, uint8_t chan, int32_t *volt_uv) { - const struct regulator_npm13xx_config *config = dev->config; + const struct regulator_npm1300_config *config = dev->config; uint8_t idx; int ret; - ret = mfd_npm13xx_reg_read(config->mfd, LDSW_BASE, LDSW_OFFSET_VOUTSEL + chan, &idx); + ret = mfd_npm1300_reg_read(config->mfd, LDSW_BASE, LDSW_OFFSET_VOUTSEL + chan, &idx); if (ret < 0) { return ret; @@ -284,18 +284,18 @@ static int ldo_get_voltage(const struct device *dev, uint8_t chan, int32_t *volt return linear_range_get_value(&buckldo_range, idx, volt_uv); } -int regulator_npm13xx_get_voltage(const struct device *dev, int32_t *volt_uv) +int regulator_npm1300_get_voltage(const struct device *dev, int32_t *volt_uv) { - const struct regulator_npm13xx_config *config = dev->config; + const struct regulator_npm1300_config *config = dev->config; switch (config->source) { - case NPM13XX_SOURCE_BUCK1: + case NPM1300_SOURCE_BUCK1: return buck_get_voltage(dev, 0, volt_uv); - case NPM13XX_SOURCE_BUCK2: + case NPM1300_SOURCE_BUCK2: return buck_get_voltage(dev, 1, volt_uv); - case NPM13XX_SOURCE_LDO1: + case NPM1300_SOURCE_LDO1: return ldo_get_voltage(dev, 0, volt_uv); - case NPM13XX_SOURCE_LDO2: + case NPM1300_SOURCE_LDO2: return ldo_get_voltage(dev, 1, volt_uv); default: return -ENODEV; @@ -304,22 +304,22 @@ int regulator_npm13xx_get_voltage(const struct device *dev, int32_t *volt_uv) static int set_buck_mode(const struct device *dev, uint8_t chan, regulator_mode_t mode) { - const struct regulator_npm13xx_config *config = dev->config; + const struct regulator_npm1300_config *config = dev->config; uint8_t pfm_mask = BIT(chan); uint8_t pfm_data; uint8_t pwm_reg; int ret; switch (mode) { - case NPM13XX_BUCK_MODE_PWM: + case NPM1300_BUCK_MODE_PWM: pfm_data = 0U; pwm_reg = BUCK_OFFSET_PWM_SET; break; - case NPM13XX_BUCK_MODE_AUTO: + case NPM1300_BUCK_MODE_AUTO: pfm_data = 0U; pwm_reg = BUCK_OFFSET_PWM_CLR; break; - case NPM13XX_BUCK_MODE_PFM: + case NPM1300_BUCK_MODE_PFM: pfm_data = pfm_mask; pwm_reg = BUCK_OFFSET_PWM_CLR; break; @@ -327,61 +327,61 @@ static int set_buck_mode(const struct device *dev, uint8_t chan, regulator_mode_ return -ENOTSUP; } - ret = mfd_npm13xx_reg_update(config->mfd, BUCK_BASE, BUCK_OFFSET_CTRL0, pfm_data, pfm_mask); + ret = mfd_npm1300_reg_update(config->mfd, BUCK_BASE, BUCK_OFFSET_CTRL0, pfm_data, pfm_mask); if (ret < 0) { return ret; } - return mfd_npm13xx_reg_write(config->mfd, BUCK_BASE, pwm_reg + (chan * 2U), 1U); + return mfd_npm1300_reg_write(config->mfd, BUCK_BASE, pwm_reg + (chan * 2U), 1U); } static int set_ldsw_mode(const struct device *dev, uint8_t chan, regulator_mode_t mode) { - const struct regulator_npm13xx_config *config = dev->config; + const struct regulator_npm1300_config *config = dev->config; switch (mode) { - case NPM13XX_LDSW_MODE_LDO: - return mfd_npm13xx_reg_write(config->mfd, LDSW_BASE, LDSW_OFFSET_LDOSEL + chan, 1U); - case NPM13XX_LDSW_MODE_LDSW: - return mfd_npm13xx_reg_write(config->mfd, LDSW_BASE, LDSW_OFFSET_LDOSEL + chan, 0U); + case NPM1300_LDSW_MODE_LDO: + return mfd_npm1300_reg_write(config->mfd, LDSW_BASE, LDSW_OFFSET_LDOSEL + chan, 1U); + case NPM1300_LDSW_MODE_LDSW: + return mfd_npm1300_reg_write(config->mfd, LDSW_BASE, LDSW_OFFSET_LDOSEL + chan, 0U); default: return -ENOTSUP; } } -int regulator_npm13xx_set_mode(const struct device *dev, regulator_mode_t mode) +int regulator_npm1300_set_mode(const struct device *dev, regulator_mode_t mode) { - const struct regulator_npm13xx_config *config = dev->config; + const struct regulator_npm1300_config *config = dev->config; switch (config->source) { - case NPM13XX_SOURCE_BUCK1: + case NPM1300_SOURCE_BUCK1: return set_buck_mode(dev, 0, mode); - case NPM13XX_SOURCE_BUCK2: + case NPM1300_SOURCE_BUCK2: return set_buck_mode(dev, 1, mode); - case NPM13XX_SOURCE_LDO1: + case NPM1300_SOURCE_LDO1: return set_ldsw_mode(dev, 0, mode); - case NPM13XX_SOURCE_LDO2: + case NPM1300_SOURCE_LDO2: return set_ldsw_mode(dev, 1, mode); default: return -ENOTSUP; } } -int regulator_npm13xx_enable(const struct device *dev) +int regulator_npm1300_enable(const struct device *dev) { - const struct regulator_npm13xx_config *config = dev->config; + const struct regulator_npm1300_config *config = dev->config; int ret; switch (config->source) { - case NPM13XX_SOURCE_BUCK1: - return mfd_npm13xx_reg_write(config->mfd, BUCK_BASE, BUCK_OFFSET_EN_SET, 1U); - case NPM13XX_SOURCE_BUCK2: - return mfd_npm13xx_reg_write(config->mfd, BUCK_BASE, BUCK_OFFSET_EN_SET + 2U, 1U); - case NPM13XX_SOURCE_LDO1: - ret = mfd_npm13xx_reg_write(config->mfd, LDSW_BASE, LDSW_OFFSET_EN_SET, 1U); + case NPM1300_SOURCE_BUCK1: + return mfd_npm1300_reg_write(config->mfd, BUCK_BASE, BUCK_OFFSET_EN_SET, 1U); + case NPM1300_SOURCE_BUCK2: + return mfd_npm1300_reg_write(config->mfd, BUCK_BASE, BUCK_OFFSET_EN_SET + 2U, 1U); + case NPM1300_SOURCE_LDO1: + ret = mfd_npm1300_reg_write(config->mfd, LDSW_BASE, LDSW_OFFSET_EN_SET, 1U); break; - case NPM13XX_SOURCE_LDO2: - ret = mfd_npm13xx_reg_write(config->mfd, LDSW_BASE, LDSW_OFFSET_EN_SET + 2U, 1U); + case NPM1300_SOURCE_LDO2: + ret = mfd_npm1300_reg_write(config->mfd, LDSW_BASE, LDSW_OFFSET_EN_SET + 2U, 1U); break; default: return 0; @@ -395,35 +395,35 @@ int regulator_npm13xx_enable(const struct device *dev) uint8_t unused; k_msleep(2); - return mfd_npm13xx_reg_read(config->mfd, LDSW_BASE, LDSW_OFFSET_STATUS, &unused); + return mfd_npm1300_reg_read(config->mfd, LDSW_BASE, LDSW_OFFSET_STATUS, &unused); } return ret; } -int regulator_npm13xx_disable(const struct device *dev) +int regulator_npm1300_disable(const struct device *dev) { - const struct regulator_npm13xx_config *config = dev->config; + const struct regulator_npm1300_config *config = dev->config; switch (config->source) { - case NPM13XX_SOURCE_BUCK1: - return mfd_npm13xx_reg_write(config->mfd, BUCK_BASE, BUCK_OFFSET_EN_CLR, 1U); - case NPM13XX_SOURCE_BUCK2: - return mfd_npm13xx_reg_write(config->mfd, BUCK_BASE, BUCK_OFFSET_EN_CLR + 2U, 1U); - case NPM13XX_SOURCE_LDO1: - return mfd_npm13xx_reg_write(config->mfd, LDSW_BASE, LDSW_OFFSET_EN_CLR, 1U); - case NPM13XX_SOURCE_LDO2: - return mfd_npm13xx_reg_write(config->mfd, LDSW_BASE, LDSW_OFFSET_EN_CLR + 2U, 1U); + case NPM1300_SOURCE_BUCK1: + return mfd_npm1300_reg_write(config->mfd, BUCK_BASE, BUCK_OFFSET_EN_CLR, 1U); + case NPM1300_SOURCE_BUCK2: + return mfd_npm1300_reg_write(config->mfd, BUCK_BASE, BUCK_OFFSET_EN_CLR + 2U, 1U); + case NPM1300_SOURCE_LDO1: + return mfd_npm1300_reg_write(config->mfd, LDSW_BASE, LDSW_OFFSET_EN_CLR, 1U); + case NPM1300_SOURCE_LDO2: + return mfd_npm1300_reg_write(config->mfd, LDSW_BASE, LDSW_OFFSET_EN_CLR + 2U, 1U); default: return 0; } } -static int regulator_npm13xx_set_buck_pin_ctrl(const struct device *dev, uint8_t chan, - const struct npm13xx_gpio_info *pin_info, - enum npm13xx_gpio_type type) +static int regulator_npm1300_set_buck_pin_ctrl(const struct device *dev, uint8_t chan, + const struct npm1300_gpio_info *pin_info, + enum npm1300_gpio_type type) { - const struct regulator_npm13xx_config *config = dev->config; + const struct regulator_npm1300_config *config = dev->config; uint8_t inv = pin_info->invert ? 1 : 0; uint8_t ctrl; uint8_t mask; @@ -444,63 +444,63 @@ static int regulator_npm13xx_set_buck_pin_ctrl(const struct device *dev, uint8_t } switch (type) { - case NPM13XX_GPIO_TYPE_ENABLE: - return mfd_npm13xx_reg_update(config->mfd, BUCK_BASE, BUCK_OFFSET_EN_CTRL, ctrl, + case NPM1300_GPIO_TYPE_ENABLE: + return mfd_npm1300_reg_update(config->mfd, BUCK_BASE, BUCK_OFFSET_EN_CTRL, ctrl, mask); - case NPM13XX_GPIO_TYPE_PWM: - return mfd_npm13xx_reg_update(config->mfd, BUCK_BASE, BUCK_OFFSET_PWM_CTRL, ctrl, + case NPM1300_GPIO_TYPE_PWM: + return mfd_npm1300_reg_update(config->mfd, BUCK_BASE, BUCK_OFFSET_PWM_CTRL, ctrl, mask); - case NPM13XX_GPIO_TYPE_RETENTION: - return mfd_npm13xx_reg_update(config->mfd, BUCK_BASE, BUCK_OFFSET_VRET_CTRL, ctrl, + case NPM1300_GPIO_TYPE_RETENTION: + return mfd_npm1300_reg_update(config->mfd, BUCK_BASE, BUCK_OFFSET_VRET_CTRL, ctrl, mask); default: return -ENOTSUP; } } -static int regulator_npm13xx_set_ldsw_pin_ctrl(const struct device *dev, uint8_t chan, - const struct npm13xx_gpio_info *pin_info, - enum npm13xx_gpio_type type) +static int regulator_npm1300_set_ldsw_pin_ctrl(const struct device *dev, uint8_t chan, + const struct npm1300_gpio_info *pin_info, + enum npm1300_gpio_type type) { - const struct regulator_npm13xx_config *config = dev->config; + const struct regulator_npm1300_config *config = dev->config; uint8_t inv = pin_info->invert ? 1 : 0; uint8_t ctrl; - if (type != NPM13XX_GPIO_TYPE_ENABLE) { + if (type != NPM1300_GPIO_TYPE_ENABLE) { return -ENOTSUP; } ctrl = (pin_info->pin + 1U) | (inv << 3U); - return mfd_npm13xx_reg_write(config->mfd, LDSW_BASE, LDSW_OFFSET_GPISEL + chan, ctrl); + return mfd_npm1300_reg_write(config->mfd, LDSW_BASE, LDSW_OFFSET_GPISEL + chan, ctrl); } -int regulator_npm13xx_set_pin_ctrl(const struct device *dev, const struct npm13xx_gpio_info *info, - enum npm13xx_gpio_type type) +int regulator_npm1300_set_pin_ctrl(const struct device *dev, const struct npm1300_gpio_info *info, + enum npm1300_gpio_type type) { - const struct regulator_npm13xx_config *config = dev->config; + const struct regulator_npm1300_config *config = dev->config; - if (info->pin == NPM13XX_GPIO_UNUSED) { + if (info->pin == NPM1300_GPIO_UNUSED) { return 0; } switch (config->source) { - case NPM13XX_SOURCE_BUCK1: - return regulator_npm13xx_set_buck_pin_ctrl(dev, 0, info, type); - case NPM13XX_SOURCE_BUCK2: - return regulator_npm13xx_set_buck_pin_ctrl(dev, 1, info, type); - case NPM13XX_SOURCE_LDO1: - return regulator_npm13xx_set_ldsw_pin_ctrl(dev, 0, info, type); - case NPM13XX_SOURCE_LDO2: - return regulator_npm13xx_set_ldsw_pin_ctrl(dev, 1, info, type); + case NPM1300_SOURCE_BUCK1: + return regulator_npm1300_set_buck_pin_ctrl(dev, 0, info, type); + case NPM1300_SOURCE_BUCK2: + return regulator_npm1300_set_buck_pin_ctrl(dev, 1, info, type); + case NPM1300_SOURCE_LDO1: + return regulator_npm1300_set_ldsw_pin_ctrl(dev, 0, info, type); + case NPM1300_SOURCE_LDO2: + return regulator_npm1300_set_ldsw_pin_ctrl(dev, 1, info, type); default: return -ENODEV; } } -int regulator_npm13xx_dvs_state_set(const struct device *dev, regulator_dvs_state_t state) +int regulator_npm1300_dvs_state_set(const struct device *dev, regulator_dvs_state_t state) { - const struct regulator_npm13xx_pconfig *pconfig = dev->config; + const struct regulator_npm1300_pconfig *pconfig = dev->config; const struct gpio_dt_spec *spec; int ret; @@ -519,21 +519,21 @@ int regulator_npm13xx_dvs_state_set(const struct device *dev, regulator_dvs_stat return 0; } -int regulator_npm13xx_ship_mode(const struct device *dev) +int regulator_npm1300_ship_mode(const struct device *dev) { - const struct regulator_npm13xx_pconfig *pconfig = dev->config; + const struct regulator_npm1300_pconfig *pconfig = dev->config; - return mfd_npm13xx_reg_write(pconfig->mfd, SHIP_BASE, SHIP_OFFSET_SHIP, 1U); + return mfd_npm1300_reg_write(pconfig->mfd, SHIP_BASE, SHIP_OFFSET_SHIP, 1U); } static DEVICE_API(regulator_parent, parent_api) = { - .dvs_state_set = regulator_npm13xx_dvs_state_set, - .ship_mode = regulator_npm13xx_ship_mode, + .dvs_state_set = regulator_npm1300_dvs_state_set, + .ship_mode = regulator_npm1300_ship_mode, }; -int regulator_npm13xx_common_init(const struct device *dev) +int regulator_npm1300_common_init(const struct device *dev) { - const struct regulator_npm13xx_pconfig *pconfig = dev->config; + const struct regulator_npm1300_pconfig *pconfig = dev->config; const struct gpio_dt_spec *spec; int ret; @@ -558,10 +558,10 @@ int regulator_npm13xx_common_init(const struct device *dev) static int get_enabled_reg(const struct device *dev, uint8_t base, uint8_t offset, uint8_t mask, bool *enabled) { - const struct regulator_npm13xx_config *config = dev->config; + const struct regulator_npm1300_config *config = dev->config; uint8_t data; - int ret = mfd_npm13xx_reg_read(config->mfd, base, offset, &data); + int ret = mfd_npm1300_reg_read(config->mfd, base, offset, &data); if (ret < 0) { return ret; @@ -574,16 +574,16 @@ static int get_enabled_reg(const struct device *dev, uint8_t base, uint8_t offse static int get_enabled(const struct device *dev, bool *enabled) { - const struct regulator_npm13xx_config *config = dev->config; + const struct regulator_npm1300_config *config = dev->config; switch (config->source) { - case NPM13XX_SOURCE_BUCK1: + case NPM1300_SOURCE_BUCK1: return get_enabled_reg(dev, BUCK_BASE, BUCK_OFFSET_STATUS, BUCK1_ON_MASK, enabled); - case NPM13XX_SOURCE_BUCK2: + case NPM1300_SOURCE_BUCK2: return get_enabled_reg(dev, BUCK_BASE, BUCK_OFFSET_STATUS, BUCK2_ON_MASK, enabled); - case NPM13XX_SOURCE_LDO1: + case NPM1300_SOURCE_LDO1: return get_enabled_reg(dev, LDSW_BASE, LDSW_OFFSET_STATUS, LDSW1_ON_MASK, enabled); - case NPM13XX_SOURCE_LDO2: + case NPM1300_SOURCE_LDO2: return get_enabled_reg(dev, LDSW_BASE, LDSW_OFFSET_STATUS, LDSW2_ON_MASK, enabled); default: return -ENODEV; @@ -592,15 +592,15 @@ static int get_enabled(const struct device *dev, bool *enabled) static int soft_start_set(const struct device *dev, uint8_t soft_start) { - const struct regulator_npm13xx_config *config = dev->config; + const struct regulator_npm1300_config *config = dev->config; switch (config->source) { - case NPM13XX_SOURCE_LDO1: - return mfd_npm13xx_reg_update(config->mfd, LDSW_BASE, LDSW_OFFSET_CONFIG, + case NPM1300_SOURCE_LDO1: + return mfd_npm1300_reg_update(config->mfd, LDSW_BASE, LDSW_OFFSET_CONFIG, soft_start << LDSW1_SOFTSTART_SHIFT, LDSW1_SOFTSTART_MASK); - case NPM13XX_SOURCE_LDO2: - return mfd_npm13xx_reg_update(config->mfd, LDSW_BASE, LDSW_OFFSET_CONFIG, + case NPM1300_SOURCE_LDO2: + return mfd_npm1300_reg_update(config->mfd, LDSW_BASE, LDSW_OFFSET_CONFIG, soft_start << LDSW2_SOFTSTART_SHIFT, LDSW2_SOFTSTART_MASK); default: @@ -610,23 +610,23 @@ static int soft_start_set(const struct device *dev, uint8_t soft_start) static int active_discharge_set(const struct device *dev, bool enabled) { - const struct regulator_npm13xx_config *config = dev->config; + const struct regulator_npm1300_config *config = dev->config; switch (config->source) { - case NPM13XX_SOURCE_BUCK1: - return mfd_npm13xx_reg_update(config->mfd, BUCK_BASE, BUCK_OFFSET_CTRL0, + case NPM1300_SOURCE_BUCK1: + return mfd_npm1300_reg_update(config->mfd, BUCK_BASE, BUCK_OFFSET_CTRL0, enabled ? BUCK1_EN_PULLDOWN_MASK : 0, BUCK1_EN_PULLDOWN_MASK); - case NPM13XX_SOURCE_BUCK2: - return mfd_npm13xx_reg_update(config->mfd, BUCK_BASE, BUCK_OFFSET_CTRL0, + case NPM1300_SOURCE_BUCK2: + return mfd_npm1300_reg_update(config->mfd, BUCK_BASE, BUCK_OFFSET_CTRL0, enabled ? BUCK2_EN_PULLDOWN_MASK : 0, BUCK2_EN_PULLDOWN_MASK); - case NPM13XX_SOURCE_LDO1: - return mfd_npm13xx_reg_update(config->mfd, LDSW_BASE, LDSW_OFFSET_CONFIG, + case NPM1300_SOURCE_LDO1: + return mfd_npm1300_reg_update(config->mfd, LDSW_BASE, LDSW_OFFSET_CONFIG, enabled ? LDSW1_ACTIVE_DISCHARGE_MASK : 0, LDSW1_ACTIVE_DISCHARGE_MASK); - case NPM13XX_SOURCE_LDO2: - return mfd_npm13xx_reg_update(config->mfd, LDSW_BASE, LDSW_OFFSET_CONFIG, + case NPM1300_SOURCE_LDO2: + return mfd_npm1300_reg_update(config->mfd, LDSW_BASE, LDSW_OFFSET_CONFIG, enabled ? LDSW2_ACTIVE_DISCHARGE_MASK : 0, LDSW2_ACTIVE_DISCHARGE_MASK); default: @@ -634,9 +634,9 @@ static int active_discharge_set(const struct device *dev, bool enabled) } } -int regulator_npm13xx_init(const struct device *dev) +int regulator_npm1300_init(const struct device *dev) { - const struct regulator_npm13xx_config *config = dev->config; + const struct regulator_npm1300_config *config = dev->config; bool enabled; int ret = 0; @@ -677,18 +677,18 @@ int regulator_npm13xx_init(const struct device *dev) } /* Configure GPIO pin control */ - ret = regulator_npm13xx_set_pin_ctrl(dev, &config->enable_gpios, NPM13XX_GPIO_TYPE_ENABLE); + ret = regulator_npm1300_set_pin_ctrl(dev, &config->enable_gpios, NPM1300_GPIO_TYPE_ENABLE); if (ret != 0) { return ret; } - ret = regulator_npm13xx_set_pin_ctrl(dev, &config->retention_gpios, - NPM13XX_GPIO_TYPE_RETENTION); + ret = regulator_npm1300_set_pin_ctrl(dev, &config->retention_gpios, + NPM1300_GPIO_TYPE_RETENTION); if (ret != 0) { return ret; } - ret = regulator_npm13xx_set_pin_ctrl(dev, &config->pwm_gpios, NPM13XX_GPIO_TYPE_PWM); + ret = regulator_npm1300_set_pin_ctrl(dev, &config->pwm_gpios, NPM1300_GPIO_TYPE_PWM); if (ret != 0) { return ret; } @@ -697,28 +697,28 @@ int regulator_npm13xx_init(const struct device *dev) } static DEVICE_API(regulator, api) = { - .enable = regulator_npm13xx_enable, - .disable = regulator_npm13xx_disable, - .count_voltages = regulator_npm13xx_count_voltages, - .list_voltage = regulator_npm13xx_list_voltage, - .set_voltage = regulator_npm13xx_set_voltage, - .get_voltage = regulator_npm13xx_get_voltage, - .set_mode = regulator_npm13xx_set_mode, + .enable = regulator_npm1300_enable, + .disable = regulator_npm1300_disable, + .count_voltages = regulator_npm1300_count_voltages, + .list_voltage = regulator_npm1300_list_voltage, + .set_voltage = regulator_npm1300_set_voltage, + .get_voltage = regulator_npm1300_get_voltage, + .set_mode = regulator_npm1300_set_mode, }; #define GPIO_CONFIG_DEFINE(node_id, prop) \ COND_CODE_1(DT_NODE_HAS_PROP(node_id, prop), \ ({DT_PROP_BY_IDX(node_id, prop, 0), \ !!(DT_PROP_BY_IDX(node_id, prop, 1) & GPIO_ACTIVE_LOW)}), \ - ({NPM13XX_GPIO_UNUSED, false})) + ({NPM1300_GPIO_UNUSED, false})) -#define REGULATOR_NPM13XX_DEFINE(node_id, id, _source) \ +#define REGULATOR_NPM1300_DEFINE(node_id, id, _source) \ BUILD_ASSERT(DT_PROP_LEN_OR(node_id, enable_gpio_config, 2) == 2); \ BUILD_ASSERT(DT_PROP_LEN_OR(node_id, retention_gpio_config, 2) == 2); \ BUILD_ASSERT(DT_PROP_LEN_OR(node_id, pwm_gpio_config, 2) == 2); \ - static struct regulator_npm13xx_data data_##id; \ + static struct regulator_npm1300_data data_##id; \ \ - static const struct regulator_npm13xx_config config_##id = { \ + static const struct regulator_npm1300_config config_##id = { \ .common = REGULATOR_DT_COMMON_CONFIG_INIT(node_id), \ .mfd = DEVICE_DT_GET(DT_GPARENT(node_id)), \ .source = _source, \ @@ -730,16 +730,16 @@ static DEVICE_API(regulator, api) = { .active_discharge = DT_PROP(node_id, active_discharge), \ .ldo_disable_workaround = DT_PROP(node_id, nordic_anomaly38_disable_workaround)}; \ \ - DEVICE_DT_DEFINE(node_id, regulator_npm13xx_init, NULL, &data_##id, &config_##id, \ - POST_KERNEL, CONFIG_REGULATOR_NPM13XX_INIT_PRIORITY, &api); + DEVICE_DT_DEFINE(node_id, regulator_npm1300_init, NULL, &data_##id, &config_##id, \ + POST_KERNEL, CONFIG_REGULATOR_NPM1300_INIT_PRIORITY, &api); -#define REGULATOR_NPM13XX_DEFINE_COND(inst, child, source) \ +#define REGULATOR_NPM1300_DEFINE_COND(inst, child, source) \ COND_CODE_1(DT_NODE_EXISTS(DT_INST_CHILD(inst, child)), \ - (REGULATOR_NPM13XX_DEFINE(DT_INST_CHILD(inst, child), child##inst, source)), \ + (REGULATOR_NPM1300_DEFINE(DT_INST_CHILD(inst, child), child##inst, source)), \ ()) -#define REGULATOR_NPM13XX_DEFINE_ALL(inst) \ - static const struct regulator_npm13xx_pconfig config_##inst = { \ +#define REGULATOR_NPM1300_DEFINE_ALL(inst) \ + static const struct regulator_npm1300_pconfig config_##inst = { \ .mfd = DEVICE_DT_GET(DT_INST_PARENT(inst)), \ .dvs_state_pins = {GPIO_DT_SPEC_INST_GET_BY_IDX_OR(inst, dvs_gpios, 0, {0}), \ GPIO_DT_SPEC_INST_GET_BY_IDX_OR(inst, dvs_gpios, 1, {0}), \ @@ -747,13 +747,13 @@ static DEVICE_API(regulator, api) = { GPIO_DT_SPEC_INST_GET_BY_IDX_OR(inst, dvs_gpios, 3, {0}), \ GPIO_DT_SPEC_INST_GET_BY_IDX_OR(inst, dvs_gpios, 4, {0})}}; \ \ - DEVICE_DT_INST_DEFINE(inst, regulator_npm13xx_common_init, NULL, NULL, &config_##inst, \ - POST_KERNEL, CONFIG_REGULATOR_NPM13XX_COMMON_INIT_PRIORITY, \ + DEVICE_DT_INST_DEFINE(inst, regulator_npm1300_common_init, NULL, NULL, &config_##inst, \ + POST_KERNEL, CONFIG_REGULATOR_NPM1300_COMMON_INIT_PRIORITY, \ &parent_api); \ \ - REGULATOR_NPM13XX_DEFINE_COND(inst, buck1, NPM13XX_SOURCE_BUCK1) \ - REGULATOR_NPM13XX_DEFINE_COND(inst, buck2, NPM13XX_SOURCE_BUCK2) \ - REGULATOR_NPM13XX_DEFINE_COND(inst, ldo1, NPM13XX_SOURCE_LDO1) \ - REGULATOR_NPM13XX_DEFINE_COND(inst, ldo2, NPM13XX_SOURCE_LDO2) + REGULATOR_NPM1300_DEFINE_COND(inst, buck1, NPM1300_SOURCE_BUCK1) \ + REGULATOR_NPM1300_DEFINE_COND(inst, buck2, NPM1300_SOURCE_BUCK2) \ + REGULATOR_NPM1300_DEFINE_COND(inst, ldo1, NPM1300_SOURCE_LDO1) \ + REGULATOR_NPM1300_DEFINE_COND(inst, ldo2, NPM1300_SOURCE_LDO2) -DT_INST_FOREACH_STATUS_OKAY(REGULATOR_NPM13XX_DEFINE_ALL) +DT_INST_FOREACH_STATUS_OKAY(REGULATOR_NPM1300_DEFINE_ALL) diff --git a/drivers/sensor/nordic/CMakeLists.txt b/drivers/sensor/nordic/CMakeLists.txt index bd72ded9ccc2..cfda4b85b474 100644 --- a/drivers/sensor/nordic/CMakeLists.txt +++ b/drivers/sensor/nordic/CMakeLists.txt @@ -3,7 +3,7 @@ # zephyr-keep-sorted-start add_subdirectory(temp) -add_subdirectory_ifdef(CONFIG_NPM13XX_CHARGER npm13xx_charger) +add_subdirectory_ifdef(CONFIG_NPM1300_CHARGER npm13xx_charger) add_subdirectory_ifdef(CONFIG_NPM2100_VBAT npm2100_vbat) add_subdirectory_ifdef(CONFIG_QDEC_NRFX qdec_nrfx) # zephyr-keep-sorted-stop diff --git a/drivers/sensor/nordic/npm13xx_charger/Kconfig b/drivers/sensor/nordic/npm13xx_charger/Kconfig index e511e393fa24..abafa5309504 100644 --- a/drivers/sensor/nordic/npm13xx_charger/Kconfig +++ b/drivers/sensor/nordic/npm13xx_charger/Kconfig @@ -2,12 +2,12 @@ # # SPDX-License-Identifier: Apache-2.0 -config NPM13XX_CHARGER - bool "nPM13xx Charger" +config NPM1300_CHARGER + bool "NPM1300 Charger" default y depends on DT_HAS_NORDIC_NPM1300_CHARGER_ENABLED select I2C select MFD select REQUIRES_FULL_LIBC help - Enable nPM13xx charger driver. + Enable NPM1300 charger driver. diff --git a/drivers/sensor/nordic/npm13xx_charger/npm13xx_charger.c b/drivers/sensor/nordic/npm13xx_charger/npm13xx_charger.c index bf5afe2d3f4e..829ce6a2265b 100644 --- a/drivers/sensor/nordic/npm13xx_charger/npm13xx_charger.c +++ b/drivers/sensor/nordic/npm13xx_charger/npm13xx_charger.c @@ -12,7 +12,7 @@ #include #include -struct npm13xx_charger_config { +struct npm1300_charger_config { const struct device *mfd; int32_t term_microvolt; int32_t term_warm_microvolt; @@ -32,7 +32,7 @@ struct npm13xx_charger_config { bool disable_recharge; }; -struct npm13xx_charger_data { +struct npm1300_charger_data { uint16_t voltage; uint16_t current; uint16_t temp; @@ -43,12 +43,12 @@ struct npm13xx_charger_data { uint8_t vbus_stat; }; -/* nPM13xx base addresses */ +/* nPM1300 base addresses */ #define CHGR_BASE 0x03U #define ADC_BASE 0x05U #define VBUS_BASE 0x02U -/* nPM13xx charger register offsets */ +/* nPM1300 charger register offsets */ #define CHGR_OFFSET_ERR_CLR 0x00U #define CHGR_OFFSET_EN_SET 0x04U #define CHGR_OFFSET_EN_CLR 0x05U @@ -65,7 +65,7 @@ struct npm13xx_charger_data { #define CHGR_OFFSET_ERR_REASON 0x36U #define CHGR_OFFSET_VBATLOW_EN 0x50U -/* nPM13xx ADC register offsets */ +/* nPM1300 ADC register offsets */ #define ADC_OFFSET_TASK_VBAT 0x00U #define ADC_OFFSET_TASK_TEMP 0x01U #define ADC_OFFSET_TASK_DIE 0x02U @@ -75,7 +75,7 @@ struct npm13xx_charger_data { #define ADC_OFFSET_RESULTS 0x10U #define ADC_OFFSET_IBAT_EN 0x24U -/* nPM13xx VBUS register offsets */ +/* nPM1300 VBUS register offsets */ #define VBUS_OFFSET_ILIMUPDATE 0x00U #define VBUS_OFFSET_ILIM 0x01U #define VBUS_OFFSET_ILIMSTARTUP 0x02U @@ -149,7 +149,7 @@ static const uint16_t discharge_limits[] = {84U, 415U}; /* Linear range for vbusin current limit */ static const struct linear_range vbus_current_range = LINEAR_RANGE_INIT(100000, 100000, 1U, 15U); -static void calc_temp(const struct npm13xx_charger_config *const config, uint16_t code, +static void calc_temp(const struct npm1300_charger_config *const config, uint16_t code, struct sensor_value *valp) { /* Ref: PS v1.2 Section 7.1.4: Battery temperature (Kelvin) */ @@ -161,7 +161,7 @@ static void calc_temp(const struct npm13xx_charger_config *const config, uint16_ (void)sensor_value_from_float(valp, temp); } -static void calc_dietemp(const struct npm13xx_charger_config *const config, uint16_t code, +static void calc_dietemp(const struct npm1300_charger_config *const config, uint16_t code, struct sensor_value *valp) { /* Ref: PS v1.2 Section 7.1.4: Die temperature (Celsius) */ @@ -171,7 +171,7 @@ static void calc_dietemp(const struct npm13xx_charger_config *const config, uint (void)sensor_value_from_milli(valp, temp); } -static uint32_t calc_ntc_res(const struct npm13xx_charger_config *const config, int32_t temp_mdegc) +static uint32_t calc_ntc_res(const struct npm1300_charger_config *const config, int32_t temp_mdegc) { float inv_t0 = 1.f / 298.15f; float temp = (float)temp_mdegc / 1000.f; @@ -187,8 +187,8 @@ static uint16_t adc_get_res(uint8_t msb, uint8_t lsb, uint16_t lsb_shift) return ((uint16_t)msb << ADC_MSB_SHIFT) | ((lsb >> lsb_shift) & ADC_LSB_MASK); } -static void calc_current(const struct npm13xx_charger_config *const config, - struct npm13xx_charger_data *const data, struct sensor_value *valp) +static void calc_current(const struct npm1300_charger_config *const config, + struct npm1300_charger_data *const data, struct sensor_value *valp) { int32_t full_scale_ua; int32_t current_ua; @@ -232,11 +232,11 @@ static void calc_current(const struct npm13xx_charger_config *const config, (void)sensor_value_from_micro(valp, current_ua); } -int npm13xx_charger_channel_get(const struct device *dev, enum sensor_channel chan, +int npm1300_charger_channel_get(const struct device *dev, enum sensor_channel chan, struct sensor_value *valp) { - const struct npm13xx_charger_config *const config = dev->config; - struct npm13xx_charger_data *const data = dev->data; + const struct npm1300_charger_config *const config = dev->config; + struct npm1300_charger_data *const data = dev->data; switch ((uint32_t)chan) { case SENSOR_CHAN_GAUGE_VOLTAGE: @@ -251,11 +251,11 @@ int npm13xx_charger_channel_get(const struct device *dev, enum sensor_channel ch case SENSOR_CHAN_GAUGE_AVG_CURRENT: calc_current(config, data, valp); break; - case SENSOR_CHAN_NPM13XX_CHARGER_STATUS: + case SENSOR_CHAN_NPM1300_CHARGER_STATUS: valp->val1 = data->status; valp->val2 = 0; break; - case SENSOR_CHAN_NPM13XX_CHARGER_ERROR: + case SENSOR_CHAN_NPM1300_CHARGER_ERROR: valp->val1 = data->error; valp->val2 = 0; break; @@ -268,7 +268,7 @@ int npm13xx_charger_channel_get(const struct device *dev, enum sensor_channel ch case SENSOR_CHAN_DIE_TEMP: calc_dietemp(config, data->dietemp, valp); break; - case SENSOR_CHAN_NPM13XX_CHARGER_VBUS_STATUS: + case SENSOR_CHAN_NPM1300_CHARGER_VBUS_STATUS: valp->val1 = data->vbus_stat; valp->val2 = 0; break; @@ -279,26 +279,26 @@ int npm13xx_charger_channel_get(const struct device *dev, enum sensor_channel ch return 0; } -int npm13xx_charger_sample_fetch(const struct device *dev, enum sensor_channel chan) +int npm1300_charger_sample_fetch(const struct device *dev, enum sensor_channel chan) { - const struct npm13xx_charger_config *const config = dev->config; - struct npm13xx_charger_data *data = dev->data; + const struct npm1300_charger_config *const config = dev->config; + struct npm1300_charger_data *data = dev->data; struct adc_results_t results; int ret; /* Read charge status and error reason */ - ret = mfd_npm13xx_reg_read(config->mfd, CHGR_BASE, CHGR_OFFSET_CHG_STAT, &data->status); + ret = mfd_npm1300_reg_read(config->mfd, CHGR_BASE, CHGR_OFFSET_CHG_STAT, &data->status); if (ret != 0) { return ret; } - ret = mfd_npm13xx_reg_read(config->mfd, CHGR_BASE, CHGR_OFFSET_ERR_REASON, &data->error); + ret = mfd_npm1300_reg_read(config->mfd, CHGR_BASE, CHGR_OFFSET_ERR_REASON, &data->error); if (ret != 0) { return ret; } /* Read adc results */ - ret = mfd_npm13xx_reg_read_burst(config->mfd, ADC_BASE, ADC_OFFSET_RESULTS, &results, + ret = mfd_npm1300_reg_read_burst(config->mfd, ADC_BASE, ADC_OFFSET_RESULTS, &results, sizeof(results)); if (ret != 0) { return ret; @@ -311,19 +311,19 @@ int npm13xx_charger_sample_fetch(const struct device *dev, enum sensor_channel c data->ibat_stat = results.ibat_stat; /* Trigger ntc and die temperature measurements */ - ret = mfd_npm13xx_reg_write2(config->mfd, ADC_BASE, ADC_OFFSET_TASK_TEMP, 1U, 1U); + ret = mfd_npm1300_reg_write2(config->mfd, ADC_BASE, ADC_OFFSET_TASK_TEMP, 1U, 1U); if (ret != 0) { return ret; } /* Trigger current and voltage measurement */ - ret = mfd_npm13xx_reg_write(config->mfd, ADC_BASE, ADC_OFFSET_TASK_VBAT, 1U); + ret = mfd_npm1300_reg_write(config->mfd, ADC_BASE, ADC_OFFSET_TASK_VBAT, 1U); if (ret != 0) { return ret; } /* Read vbus status */ - ret = mfd_npm13xx_reg_read(config->mfd, VBUS_BASE, VBUS_OFFSET_STATUS, &data->vbus_stat); + ret = mfd_npm1300_reg_read(config->mfd, VBUS_BASE, VBUS_OFFSET_STATUS, &data->vbus_stat); if (ret != 0) { return ret; } @@ -331,7 +331,7 @@ int npm13xx_charger_sample_fetch(const struct device *dev, enum sensor_channel c return ret; } -static int set_ntc_thresholds(const struct npm13xx_charger_config *const config) +static int set_ntc_thresholds(const struct npm1300_charger_config *const config) { for (uint8_t idx = 0U; idx < 4U; idx++) { if (config->temp_thresholds[idx] < INT32_MAX) { @@ -340,7 +340,7 @@ static int set_ntc_thresholds(const struct npm13xx_charger_config *const config) /* Ref: Datasheet Figure 14: Equation for battery temperature */ uint16_t code = (1024 * res) / (res + config->thermistor_ohms); - int ret = mfd_npm13xx_reg_write2( + int ret = mfd_npm1300_reg_write2( config->mfd, CHGR_BASE, CHGR_OFFSET_NTC_TEMPS + (idx * 2U), code >> NTCTEMP_MSB_SHIFT, code & NTCTEMP_LSB_MASK); @@ -353,7 +353,7 @@ static int set_ntc_thresholds(const struct npm13xx_charger_config *const config) return 0; } -static int set_dietemp_thresholds(const struct npm13xx_charger_config *const config) +static int set_dietemp_thresholds(const struct npm1300_charger_config *const config) { for (uint8_t idx = 0U; idx < 2U; idx++) { if (config->dietemp_thresholds[idx] < INT32_MAX) { @@ -363,7 +363,7 @@ static int set_dietemp_thresholds(const struct npm13xx_charger_config *const con DIETEMP_FACTOR_DIV; uint16_t code = DIV_ROUND_CLOSEST(numerator, DIETEMP_FACTOR_MUL); - int ret = mfd_npm13xx_reg_write2( + int ret = mfd_npm1300_reg_write2( config->mfd, CHGR_BASE, CHGR_OFFSET_DIE_TEMPS + (idx * 2U), code >> DIETEMP_MSB_SHIFT, code & DIETEMP_LSB_MASK); @@ -376,10 +376,10 @@ static int set_dietemp_thresholds(const struct npm13xx_charger_config *const con return 0; } -static int npm13xx_charger_attr_get(const struct device *dev, enum sensor_channel chan, +static int npm1300_charger_attr_get(const struct device *dev, enum sensor_channel chan, enum sensor_attribute attr, struct sensor_value *val) { - const struct npm13xx_charger_config *const config = dev->config; + const struct npm1300_charger_config *const config = dev->config; uint8_t data; int ret; @@ -389,7 +389,7 @@ static int npm13xx_charger_attr_get(const struct device *dev, enum sensor_channe return -ENOTSUP; } - ret = mfd_npm13xx_reg_read(config->mfd, CHGR_BASE, CHGR_OFFSET_EN_SET, &data); + ret = mfd_npm1300_reg_read(config->mfd, CHGR_BASE, CHGR_OFFSET_EN_SET, &data); if (ret == 0) { val->val1 = data; val->val2 = 0U; @@ -401,7 +401,7 @@ static int npm13xx_charger_attr_get(const struct device *dev, enum sensor_channe return -ENOTSUP; } - ret = mfd_npm13xx_reg_read(config->mfd, VBUS_BASE, VBUS_OFFSET_DETECT, &data); + ret = mfd_npm1300_reg_read(config->mfd, VBUS_BASE, VBUS_OFFSET_DETECT, &data); if (ret < 0) { return ret; } @@ -418,29 +418,29 @@ static int npm13xx_charger_attr_get(const struct device *dev, enum sensor_channe return 0; - case SENSOR_CHAN_NPM13XX_CHARGER_VBUS_STATUS: - ret = mfd_npm13xx_reg_read(config->mfd, VBUS_BASE, VBUS_OFFSET_STATUS, &data); + case SENSOR_CHAN_NPM1300_CHARGER_VBUS_STATUS: + ret = mfd_npm1300_reg_read(config->mfd, VBUS_BASE, VBUS_OFFSET_STATUS, &data); if (ret < 0) { return ret; } - switch ((enum sensor_attribute_npm13xx_charger)attr) { - case SENSOR_ATTR_NPM13XX_CHARGER_VBUS_PRESENT: + switch ((enum sensor_attribute_npm1300_charger)attr) { + case SENSOR_ATTR_NPM1300_CHARGER_VBUS_PRESENT: val->val1 = (data & STATUS_PRESENT_MASK) != 0; break; - case SENSOR_ATTR_NPM13XX_CHARGER_VBUS_CUR_LIMIT: + case SENSOR_ATTR_NPM1300_CHARGER_VBUS_CUR_LIMIT: val->val1 = (data & STATUS_CUR_LIMIT_MASK) != 0; break; - case SENSOR_ATTR_NPM13XX_CHARGER_VBUS_OVERVLT_PROT: + case SENSOR_ATTR_NPM1300_CHARGER_VBUS_OVERVLT_PROT: val->val1 = (data & STATUS_OVERVLT_PROT_MASK) != 0; break; - case SENSOR_ATTR_NPM13XX_CHARGER_VBUS_UNDERVLT: + case SENSOR_ATTR_NPM1300_CHARGER_VBUS_UNDERVLT: val->val1 = (data & STATUS_UNDERVLT_MASK) != 0; break; - case SENSOR_ATTR_NPM13XX_CHARGER_VBUS_SUSPENDED: + case SENSOR_ATTR_NPM1300_CHARGER_VBUS_SUSPENDED: val->val1 = (data & STATUS_SUSPENDED_MASK) != 0; break; - case SENSOR_ATTR_NPM13XX_CHARGER_VBUS_BUSOUT: + case SENSOR_ATTR_NPM1300_CHARGER_VBUS_BUSOUT: val->val1 = (data & STATUS_BUSOUT_MASK) != 0; break; default: @@ -454,10 +454,10 @@ static int npm13xx_charger_attr_get(const struct device *dev, enum sensor_channe } } -static int npm13xx_charger_attr_set(const struct device *dev, enum sensor_channel chan, +static int npm1300_charger_attr_set(const struct device *dev, enum sensor_channel chan, enum sensor_attribute attr, const struct sensor_value *val) { - const struct npm13xx_charger_config *const config = dev->config; + const struct npm1300_charger_config *const config = dev->config; int ret; if (attr != SENSOR_ATTR_CONFIGURATION) { @@ -468,16 +468,16 @@ static int npm13xx_charger_attr_set(const struct device *dev, enum sensor_channe case SENSOR_CHAN_GAUGE_DESIRED_CHARGING_CURRENT: if (val->val1 == 0) { /* Disable charging */ - return mfd_npm13xx_reg_write(config->mfd, CHGR_BASE, CHGR_OFFSET_EN_CLR, + return mfd_npm1300_reg_write(config->mfd, CHGR_BASE, CHGR_OFFSET_EN_CLR, 1U); } /* Clear any errors and enable charging */ - ret = mfd_npm13xx_reg_write(config->mfd, CHGR_BASE, CHGR_OFFSET_ERR_CLR, 1U); + ret = mfd_npm1300_reg_write(config->mfd, CHGR_BASE, CHGR_OFFSET_ERR_CLR, 1U); if (ret != 0) { return ret; } - return mfd_npm13xx_reg_write(config->mfd, CHGR_BASE, CHGR_OFFSET_EN_SET, 1U); + return mfd_npm1300_reg_write(config->mfd, CHGR_BASE, CHGR_OFFSET_EN_SET, 1U); case SENSOR_CHAN_CURRENT: /* Set vbus current limit */ @@ -490,22 +490,22 @@ static int npm13xx_charger_attr_set(const struct device *dev, enum sensor_channe return ret; } - ret = mfd_npm13xx_reg_write(config->mfd, VBUS_BASE, VBUS_OFFSET_ILIM, idx); + ret = mfd_npm1300_reg_write(config->mfd, VBUS_BASE, VBUS_OFFSET_ILIM, idx); if (ret != 0) { return ret; } /* Switch to new current limit, this will be reset automatically on USB removal */ - return mfd_npm13xx_reg_write(config->mfd, VBUS_BASE, VBUS_OFFSET_ILIMUPDATE, 1U); + return mfd_npm1300_reg_write(config->mfd, VBUS_BASE, VBUS_OFFSET_ILIMUPDATE, 1U); default: return -ENOTSUP; } } -int npm13xx_charger_init(const struct device *dev) +int npm1300_charger_init(const struct device *dev) { - const struct npm13xx_charger_config *const config = dev->config; + const struct npm1300_charger_config *const config = dev->config; uint16_t idx; uint8_t byte = 0U; int ret; @@ -515,7 +515,7 @@ int npm13xx_charger_init(const struct device *dev) } /* Configure temperature thresholds */ - ret = mfd_npm13xx_reg_write(config->mfd, ADC_BASE, ADC_OFFSET_NTCR_SEL, + ret = mfd_npm1300_reg_write(config->mfd, ADC_BASE, ADC_OFFSET_NTCR_SEL, config->thermistor_idx); if (ret != 0) { return ret; @@ -538,7 +538,7 @@ int npm13xx_charger_init(const struct device *dev) if (ret == -EINVAL) { return ret; } - ret = mfd_npm13xx_reg_write(config->mfd, CHGR_BASE, CHGR_OFFSET_VTERM, idx); + ret = mfd_npm1300_reg_write(config->mfd, CHGR_BASE, CHGR_OFFSET_VTERM, idx); if (ret != 0) { return ret; } @@ -550,7 +550,7 @@ int npm13xx_charger_init(const struct device *dev) return ret; } - ret = mfd_npm13xx_reg_write(config->mfd, CHGR_BASE, CHGR_OFFSET_VTERM_R, idx); + ret = mfd_npm1300_reg_write(config->mfd, CHGR_BASE, CHGR_OFFSET_VTERM_R, idx); if (ret != 0) { return ret; } @@ -563,13 +563,13 @@ int npm13xx_charger_init(const struct device *dev) return ret; } - ret = mfd_npm13xx_reg_write2(config->mfd, CHGR_BASE, CHGR_OFFSET_ISET, idx / 2U, idx & 1U); + ret = mfd_npm1300_reg_write2(config->mfd, CHGR_BASE, CHGR_OFFSET_ISET, idx / 2U, idx & 1U); if (ret != 0) { return ret; } /* Set discharge limit */ - ret = mfd_npm13xx_reg_write2(config->mfd, CHGR_BASE, CHGR_OFFSET_ISET_DISCHG, + ret = mfd_npm1300_reg_write2(config->mfd, CHGR_BASE, CHGR_OFFSET_ISET_DISCHG, discharge_limits[config->dischg_limit_idx] / 2U, discharge_limits[config->dischg_limit_idx] & 1U); if (ret != 0) { @@ -582,52 +582,52 @@ int npm13xx_charger_init(const struct device *dev) if (ret == -EINVAL) { return ret; } - ret = mfd_npm13xx_reg_write(config->mfd, VBUS_BASE, VBUS_OFFSET_ILIMSTARTUP, idx); + ret = mfd_npm1300_reg_write(config->mfd, VBUS_BASE, VBUS_OFFSET_ILIMSTARTUP, idx); if (ret != 0) { return ret; } /* Configure trickle voltage threshold */ - ret = mfd_npm13xx_reg_write(config->mfd, CHGR_BASE, CHGR_OFFSET_TRICKLE_SEL, + ret = mfd_npm1300_reg_write(config->mfd, CHGR_BASE, CHGR_OFFSET_TRICKLE_SEL, config->trickle_sel); if (ret != 0) { return ret; } /* Configure termination current */ - ret = mfd_npm13xx_reg_write(config->mfd, CHGR_BASE, CHGR_OFFSET_ITERM_SEL, + ret = mfd_npm1300_reg_write(config->mfd, CHGR_BASE, CHGR_OFFSET_ITERM_SEL, config->iterm_sel); if (ret != 0) { return ret; } /* Enable current measurement */ - ret = mfd_npm13xx_reg_write(config->mfd, ADC_BASE, ADC_OFFSET_IBAT_EN, 1U); + ret = mfd_npm1300_reg_write(config->mfd, ADC_BASE, ADC_OFFSET_IBAT_EN, 1U); if (ret != 0) { return ret; } /* Trigger current and voltage measurement */ - ret = mfd_npm13xx_reg_write(config->mfd, ADC_BASE, ADC_OFFSET_TASK_VBAT, 1U); + ret = mfd_npm1300_reg_write(config->mfd, ADC_BASE, ADC_OFFSET_TASK_VBAT, 1U); if (ret != 0) { return ret; } /* Trigger ntc and die temperature measurements */ - ret = mfd_npm13xx_reg_write2(config->mfd, ADC_BASE, ADC_OFFSET_TASK_TEMP, 1U, 1U); + ret = mfd_npm1300_reg_write2(config->mfd, ADC_BASE, ADC_OFFSET_TASK_TEMP, 1U, 1U); if (ret != 0) { return ret; } /* Enable automatic temperature measurements during charging */ - ret = mfd_npm13xx_reg_write(config->mfd, ADC_BASE, ADC_OFFSET_TASK_AUTO, 1U); + ret = mfd_npm1300_reg_write(config->mfd, ADC_BASE, ADC_OFFSET_TASK_AUTO, 1U); if (ret != 0) { return ret; } /* Enable charging at low battery if configured */ if (config->vbatlow_charge_enable) { - ret = mfd_npm13xx_reg_write(config->mfd, CHGR_BASE, CHGR_OFFSET_VBATLOW_EN, 1U); + ret = mfd_npm1300_reg_write(config->mfd, CHGR_BASE, CHGR_OFFSET_VBATLOW_EN, 1U); if (ret != 0) { return ret; } @@ -643,14 +643,14 @@ int npm13xx_charger_init(const struct device *dev) WRITE_BIT(byte, 1U, true); } - ret = mfd_npm13xx_reg_write(config->mfd, CHGR_BASE, CHGR_OFFSET_DIS_SET, byte); + ret = mfd_npm1300_reg_write(config->mfd, CHGR_BASE, CHGR_OFFSET_DIS_SET, byte); if (ret != 0) { return ret; } /* Enable charging if configured */ if (config->charging_enable) { - ret = mfd_npm13xx_reg_write(config->mfd, CHGR_BASE, CHGR_OFFSET_EN_SET, 1U); + ret = mfd_npm1300_reg_write(config->mfd, CHGR_BASE, CHGR_OFFSET_EN_SET, 1U); if (ret != 0) { return ret; } @@ -659,19 +659,19 @@ int npm13xx_charger_init(const struct device *dev) return 0; } -static DEVICE_API(sensor, npm13xx_charger_battery_driver_api) = { - .sample_fetch = npm13xx_charger_sample_fetch, - .channel_get = npm13xx_charger_channel_get, - .attr_set = npm13xx_charger_attr_set, - .attr_get = npm13xx_charger_attr_get, +static DEVICE_API(sensor, npm1300_charger_battery_driver_api) = { + .sample_fetch = npm1300_charger_sample_fetch, + .channel_get = npm1300_charger_channel_get, + .attr_set = npm1300_charger_attr_set, + .attr_get = npm1300_charger_attr_get, }; -#define NPM13XX_CHARGER_INIT(n) \ +#define NPM1300_CHARGER_INIT(n) \ BUILD_ASSERT(DT_INST_ENUM_IDX(n, dischg_limit_microamp) < ARRAY_SIZE(discharge_limits)); \ \ - static struct npm13xx_charger_data npm13xx_charger_data_##n; \ + static struct npm1300_charger_data npm1300_charger_data_##n; \ \ - static const struct npm13xx_charger_config npm13xx_charger_config_##n = { \ + static const struct npm1300_charger_config npm1300_charger_config_##n = { \ .mfd = DEVICE_DT_GET(DT_INST_PARENT(n)), \ .term_microvolt = DT_INST_PROP(n, term_microvolt), \ .term_warm_microvolt = \ @@ -696,9 +696,9 @@ static DEVICE_API(sensor, npm13xx_charger_battery_driver_api) = { DT_INST_PROP_OR(n, thermistor_warm_millidegrees, INT32_MAX), \ DT_INST_PROP_OR(n, thermistor_hot_millidegrees, INT32_MAX)}}; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(n, &npm13xx_charger_init, NULL, &npm13xx_charger_data_##n, \ - &npm13xx_charger_config_##n, POST_KERNEL, \ + SENSOR_DEVICE_DT_INST_DEFINE(n, &npm1300_charger_init, NULL, &npm1300_charger_data_##n, \ + &npm1300_charger_config_##n, POST_KERNEL, \ CONFIG_SENSOR_INIT_PRIORITY, \ - &npm13xx_charger_battery_driver_api); + &npm1300_charger_battery_driver_api); -DT_INST_FOREACH_STATUS_OKAY(NPM13XX_CHARGER_INIT) +DT_INST_FOREACH_STATUS_OKAY(NPM1300_CHARGER_INIT) diff --git a/drivers/watchdog/CMakeLists.txt b/drivers/watchdog/CMakeLists.txt index e247de4e9fe0..4d6f75e4d9e5 100644 --- a/drivers/watchdog/CMakeLists.txt +++ b/drivers/watchdog/CMakeLists.txt @@ -28,7 +28,7 @@ zephyr_library_sources_ifdef(CONFIG_WDT_MCUX_WDOG wdt_mcux_wdog.c) zephyr_library_sources_ifdef(CONFIG_WDT_MCUX_WDOG32 wdt_mcux_wdog32.c) zephyr_library_sources_ifdef(CONFIG_WDT_MCUX_WWDT wdt_mcux_wwdt.c) zephyr_library_sources_ifdef(CONFIG_WDT_NPCX wdt_npcx.c) -zephyr_library_sources_ifdef(CONFIG_WDT_NPM13XX wdt_npm13xx.c) +zephyr_library_sources_ifdef(CONFIG_WDT_NPM1300 wdt_npm13xx.c) zephyr_library_sources_ifdef(CONFIG_WDT_NPM2100 wdt_npm2100.c) zephyr_library_sources_ifdef(CONFIG_WDT_NPM6001 wdt_npm6001.c) zephyr_library_sources_ifdef(CONFIG_WDT_NRFX wdt_nrfx.c) diff --git a/drivers/watchdog/Kconfig.npm13xx b/drivers/watchdog/Kconfig.npm13xx index 2318349c85e3..b18e4b69b13a 100644 --- a/drivers/watchdog/Kconfig.npm13xx +++ b/drivers/watchdog/Kconfig.npm13xx @@ -1,19 +1,19 @@ # Copyright (c) 2023 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -config WDT_NPM13XX - bool "nPM13xx Watchdog driver" +config WDT_NPM1300 + bool "nPM1300 Watchdog driver" default y depends on DT_HAS_NORDIC_NPM1300_WDT_ENABLED select I2C select MFD help - Enable nPM13xx Watchdog driver + Enable nPM1300 Watchdog driver -config WDT_NPM13XX_INIT_PRIORITY - int "nPM13xx Watchdog driver initialization priority" - depends on WDT_NPM13XX +config WDT_NPM1300_INIT_PRIORITY + int "nPM1300 Watchdog driver initialization priority" + depends on WDT_NPM1300 default 85 help - Initialization priority for the nPM13xx Watchdog driver. - It must be greater than GPIO_NPM13XX_INIT_PRIORITY. + Initialization priority for the nPM1300 Watchdog driver. + It must be greater than GPIO_NPM1300_INIT_PRIORITY. diff --git a/drivers/watchdog/wdt_npm13xx.c b/drivers/watchdog/wdt_npm13xx.c index cfbee7f33982..6dc9f2d49ea4 100644 --- a/drivers/watchdog/wdt_npm13xx.c +++ b/drivers/watchdog/wdt_npm13xx.c @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -#define DT_DRV_COMPAT nordic_npm13xx_wdt +#define DT_DRV_COMPAT nordic_npm1300_wdt #include @@ -13,49 +13,49 @@ #include #include -/* nPM13xx TIMER base address */ +/* nPM1300 TIMER base address */ #define TIME_BASE 0x07U -/* nPM13xx timer register offsets */ +/* nPM1300 timer register offsets */ #define TIME_OFFSET_START 0x00U #define TIME_OFFSET_STOP 0x01U #define TIME_OFFSET_WDOG_KICK 0x04U #define TIME_OFFSET_MODE 0x05U -/* nPM13xx timer modes */ +/* nPM1300 timer modes */ #define TIME_MODE_BOOT 0x00U #define TIME_MODE_WARN 0x01U #define TIME_MODE_RESET 0x02U #define TIME_MODE_GEN 0x03U -struct wdt_npm13xx_config { +struct wdt_npm1300_config { const struct device *mfd; struct gpio_dt_spec reset_gpios; }; -struct wdt_npm13xx_data { +struct wdt_npm1300_data { bool timeout_valid; }; -static int wdt_npm13xx_setup(const struct device *dev, uint8_t options) +static int wdt_npm1300_setup(const struct device *dev, uint8_t options) { - const struct wdt_npm13xx_config *config = dev->config; - struct wdt_npm13xx_data *data = dev->data; + const struct wdt_npm1300_config *config = dev->config; + struct wdt_npm1300_data *data = dev->data; if (!data->timeout_valid) { return -EINVAL; } - return mfd_npm13xx_reg_write(config->mfd, TIME_BASE, TIME_OFFSET_START, 1U); + return mfd_npm1300_reg_write(config->mfd, TIME_BASE, TIME_OFFSET_START, 1U); } -static int wdt_npm13xx_disable(const struct device *dev) +static int wdt_npm1300_disable(const struct device *dev) { - const struct wdt_npm13xx_config *config = dev->config; - struct wdt_npm13xx_data *data = dev->data; + const struct wdt_npm1300_config *config = dev->config; + struct wdt_npm1300_data *data = dev->data; int ret; - ret = mfd_npm13xx_reg_write(config->mfd, TIME_BASE, TIME_OFFSET_STOP, 1U); + ret = mfd_npm1300_reg_write(config->mfd, TIME_BASE, TIME_OFFSET_STOP, 1U); if (ret < 0) { return ret; } @@ -65,11 +65,11 @@ static int wdt_npm13xx_disable(const struct device *dev) return 0; } -static int wdt_npm13xx_install_timeout(const struct device *dev, +static int wdt_npm1300_install_timeout(const struct device *dev, const struct wdt_timeout_cfg *timeout) { - const struct wdt_npm13xx_config *config = dev->config; - struct wdt_npm13xx_data *data = dev->data; + const struct wdt_npm1300_config *config = dev->config; + struct wdt_npm1300_data *data = dev->data; uint8_t mode; int ret; @@ -81,7 +81,7 @@ static int wdt_npm13xx_install_timeout(const struct device *dev, return -EINVAL; } - ret = mfd_npm13xx_set_timer(config->mfd, timeout->window.max); + ret = mfd_npm1300_set_timer(config->mfd, timeout->window.max); if (ret < 0) { return ret; } @@ -103,7 +103,7 @@ static int wdt_npm13xx_install_timeout(const struct device *dev, return -EINVAL; } - ret = mfd_npm13xx_reg_write(config->mfd, TIME_BASE, TIME_OFFSET_MODE, mode); + ret = mfd_npm1300_reg_write(config->mfd, TIME_BASE, TIME_OFFSET_MODE, mode); if (ret < 0) { return ret; } @@ -113,27 +113,27 @@ static int wdt_npm13xx_install_timeout(const struct device *dev, return 0; } -static int wdt_npm13xx_feed(const struct device *dev, int channel_id) +static int wdt_npm1300_feed(const struct device *dev, int channel_id) { - const struct wdt_npm13xx_config *config = dev->config; + const struct wdt_npm1300_config *config = dev->config; if (channel_id != 0) { return -EINVAL; } - return mfd_npm13xx_reg_write(config->mfd, TIME_BASE, TIME_OFFSET_WDOG_KICK, 1U); + return mfd_npm1300_reg_write(config->mfd, TIME_BASE, TIME_OFFSET_WDOG_KICK, 1U); } -static DEVICE_API(wdt, wdt_npm13xx_api) = { - .setup = wdt_npm13xx_setup, - .disable = wdt_npm13xx_disable, - .install_timeout = wdt_npm13xx_install_timeout, - .feed = wdt_npm13xx_feed, +static DEVICE_API(wdt, wdt_npm1300_api) = { + .setup = wdt_npm1300_setup, + .disable = wdt_npm1300_disable, + .install_timeout = wdt_npm1300_install_timeout, + .feed = wdt_npm1300_feed, }; -static int wdt_npm13xx_init(const struct device *dev) +static int wdt_npm1300_init(const struct device *dev) { - const struct wdt_npm13xx_config *config = dev->config; + const struct wdt_npm1300_config *config = dev->config; int ret; if (!device_is_ready(config->mfd)) { @@ -145,7 +145,7 @@ static int wdt_npm13xx_init(const struct device *dev) return -ENODEV; } - ret = gpio_pin_configure_dt(&config->reset_gpios, NPM13XX_GPIO_WDT_RESET_ON); + ret = gpio_pin_configure_dt(&config->reset_gpios, NPM1300_GPIO_WDT_RESET_ON); if (ret != 0) { return ret; } @@ -154,15 +154,15 @@ static int wdt_npm13xx_init(const struct device *dev) return 0; } -#define WDT_NPM13XX_DEFINE(n) \ - static struct wdt_npm13xx_data data##n; \ +#define WDT_NPM1300_DEFINE(n) \ + static struct wdt_npm1300_data data##n; \ \ - static const struct wdt_npm13xx_config config##n = { \ + static const struct wdt_npm1300_config config##n = { \ .mfd = DEVICE_DT_GET(DT_INST_PARENT(n)), \ .reset_gpios = GPIO_DT_SPEC_INST_GET_OR(n, reset_gpios, {0}), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, &wdt_npm13xx_init, NULL, &data##n, &config##n, POST_KERNEL, \ - CONFIG_WDT_NPM13XX_INIT_PRIORITY, &wdt_npm13xx_api); + DEVICE_DT_INST_DEFINE(n, &wdt_npm1300_init, NULL, &data##n, &config##n, POST_KERNEL, \ + CONFIG_WDT_NPM1300_INIT_PRIORITY, &wdt_npm1300_api); -DT_INST_FOREACH_STATUS_OKAY(WDT_NPM13XX_DEFINE) +DT_INST_FOREACH_STATUS_OKAY(WDT_NPM1300_DEFINE) diff --git a/include/zephyr/drivers/mfd/npm13xx.h b/include/zephyr/drivers/mfd/npm13xx.h index b9e6d5120f67..a1b941a4fb73 100644 --- a/include/zephyr/drivers/mfd/npm13xx.h +++ b/include/zephyr/drivers/mfd/npm13xx.h @@ -11,7 +11,7 @@ extern "C" { #endif /** - * @defgroup mfd_interface_npm13xx MFD NPM13XX Interface + * @defgroup mdf_interface_npm1300 MFD NPM1300 Interface * @ingroup mfd_interfaces * @{ */ @@ -22,28 +22,28 @@ extern "C" { #include #include -enum mfd_npm13xx_event_t { - NPM13XX_EVENT_CHG_COMPLETED, - NPM13XX_EVENT_CHG_ERROR, - NPM13XX_EVENT_BATTERY_DETECTED, - NPM13XX_EVENT_BATTERY_REMOVED, - NPM13XX_EVENT_SHIPHOLD_PRESS, - NPM13XX_EVENT_SHIPHOLD_RELEASE, - NPM13XX_EVENT_WATCHDOG_WARN, - NPM13XX_EVENT_VBUS_DETECTED, - NPM13XX_EVENT_VBUS_REMOVED, - NPM13XX_EVENT_GPIO0_EDGE, - NPM13XX_EVENT_GPIO1_EDGE, - NPM13XX_EVENT_GPIO2_EDGE, - NPM13XX_EVENT_GPIO3_EDGE, - NPM13XX_EVENT_GPIO4_EDGE, - NPM13XX_EVENT_MAX +enum mfd_npm1300_event_t { + NPM1300_EVENT_CHG_COMPLETED, + NPM1300_EVENT_CHG_ERROR, + NPM1300_EVENT_BATTERY_DETECTED, + NPM1300_EVENT_BATTERY_REMOVED, + NPM1300_EVENT_SHIPHOLD_PRESS, + NPM1300_EVENT_SHIPHOLD_RELEASE, + NPM1300_EVENT_WATCHDOG_WARN, + NPM1300_EVENT_VBUS_DETECTED, + NPM1300_EVENT_VBUS_REMOVED, + NPM1300_EVENT_GPIO0_EDGE, + NPM1300_EVENT_GPIO1_EDGE, + NPM1300_EVENT_GPIO2_EDGE, + NPM1300_EVENT_GPIO3_EDGE, + NPM1300_EVENT_GPIO4_EDGE, + NPM1300_EVENT_MAX }; /** - * @brief Read multiple registers from npm13xx + * @brief Read multiple registers from npm1300 * - * @param dev npm13xx mfd device + * @param dev npm1300 mfd device * @param base Register base address (bits 15..8 of 16-bit address) * @param offset Register offset address (bits 7..0 of 16-bit address) * @param data Pointer to buffer for received data @@ -51,37 +51,37 @@ enum mfd_npm13xx_event_t { * @retval 0 If successful * @retval -errno In case of any bus error (see i2c_write_read_dt()) */ -int mfd_npm13xx_reg_read_burst(const struct device *dev, uint8_t base, uint8_t offset, void *data, +int mfd_npm1300_reg_read_burst(const struct device *dev, uint8_t base, uint8_t offset, void *data, size_t len); /** - * @brief Read single register from npm13xx + * @brief Read single register from npm1300 * - * @param dev npm13xx mfd device + * @param dev npm1300 mfd device * @param base Register base address (bits 15..8 of 16-bit address) * @param offset Register offset address (bits 7..0 of 16-bit address) * @param data Pointer to buffer for received data * @retval 0 If successful * @retval -errno In case of any bus error (see i2c_write_read_dt()) */ -int mfd_npm13xx_reg_read(const struct device *dev, uint8_t base, uint8_t offset, uint8_t *data); +int mfd_npm1300_reg_read(const struct device *dev, uint8_t base, uint8_t offset, uint8_t *data); /** - * @brief Write single register to npm13xx + * @brief Write single register to npm1300 * - * @param dev npm13xx mfd device + * @param dev npm1300 mfd device * @param base Register base address (bits 15..8 of 16-bit address) * @param offset Register offset address (bits 7..0 of 16-bit address) * @param data data to write * @retval 0 If successful * @retval -errno In case of any bus error (see i2c_write_dt()) */ -int mfd_npm13xx_reg_write(const struct device *dev, uint8_t base, uint8_t offset, uint8_t data); +int mfd_npm1300_reg_write(const struct device *dev, uint8_t base, uint8_t offset, uint8_t data); /** - * @brief Write two registers to npm13xx + * @brief Write two registers to npm1300 * - * @param dev npm13xx mfd device + * @param dev npm1300 mfd device * @param base Register base address (bits 15..8 of 16-bit address) * @param offset Register offset address (bits 7..0 of 16-bit address) * @param data1 first byte of data to write @@ -89,13 +89,13 @@ int mfd_npm13xx_reg_write(const struct device *dev, uint8_t base, uint8_t offset * @retval 0 If successful * @retval -errno In case of any bus error (see i2c_write_dt()) */ -int mfd_npm13xx_reg_write2(const struct device *dev, uint8_t base, uint8_t offset, uint8_t data1, +int mfd_npm1300_reg_write2(const struct device *dev, uint8_t base, uint8_t offset, uint8_t data1, uint8_t data2); /** - * @brief Update selected bits in npm13xx register + * @brief Update selected bits in npm1300 register * - * @param dev npm13xx mfd device + * @param dev npm1300 mfd device * @param base Register base address (bits 15..8 of 16-bit address) * @param offset Register offset address (bits 7..0 of 16-bit address) * @param data data to write @@ -103,59 +103,59 @@ int mfd_npm13xx_reg_write2(const struct device *dev, uint8_t base, uint8_t offse * @retval 0 If successful * @retval -errno In case of any bus error (see i2c_write_read_dt(), i2c_write_dt()) */ -int mfd_npm13xx_reg_update(const struct device *dev, uint8_t base, uint8_t offset, uint8_t data, +int mfd_npm1300_reg_update(const struct device *dev, uint8_t base, uint8_t offset, uint8_t data, uint8_t mask); /** - * @brief Write npm13xx timer register + * @brief Write npm1300 timer register * - * @param dev npm13xx mfd device + * @param dev npm1300 mfd device * @param time_ms timer value in ms * @retval 0 If successful * @retval -EINVAL if time value is too large * @retval -errno In case of any bus error (see i2c_write_dt()) */ -int mfd_npm13xx_set_timer(const struct device *dev, uint32_t time_ms); +int mfd_npm1300_set_timer(const struct device *dev, uint32_t time_ms); /** - * @brief npm13xx full power reset + * @brief npm1300 full power reset * - * @param dev npm13xx mfd device + * @param dev npm1300 mfd device * @retval 0 If successful * @retval -errno In case of any bus error (see i2c_write_dt()) */ -int mfd_npm13xx_reset(const struct device *dev); +int mfd_npm1300_reset(const struct device *dev); /** - * @brief npm13xx hibernate + * @brief npm1300 hibernate * * Enters low power state, and wakes after specified time * - * @param dev npm13xx mfd device + * @param dev npm1300 mfd device * @param time_ms timer value in ms * @retval 0 If successful * @retval -EINVAL if time value is too large * @retval -errno In case of any bus error (see i2c_write_dt()) */ -int mfd_npm13xx_hibernate(const struct device *dev, uint32_t time_ms); +int mfd_npm1300_hibernate(const struct device *dev, uint32_t time_ms); /** - * @brief Add npm13xx event callback + * @brief Add npm1300 event callback * - * @param dev npm13xx mfd device + * @param dev npm1300 mfd device * @param callback callback * @return 0 on success, -errno on failure */ -int mfd_npm13xx_add_callback(const struct device *dev, struct gpio_callback *callback); +int mfd_npm1300_add_callback(const struct device *dev, struct gpio_callback *callback); /** - * @brief Remove npm13xx event callback + * @brief Remove npm1300 event callback * - * @param dev npm13xx mfd device + * @param dev npm1300 mfd device * @param callback callback * @return 0 on success, -errno on failure */ -int mfd_npm13xx_remove_callback(const struct device *dev, struct gpio_callback *callback); +int mfd_npm1300_remove_callback(const struct device *dev, struct gpio_callback *callback); /** @} */ diff --git a/include/zephyr/drivers/sensor/npm13xx_charger.h b/include/zephyr/drivers/sensor/npm13xx_charger.h index b3319096dd19..05176b361226 100644 --- a/include/zephyr/drivers/sensor/npm13xx_charger.h +++ b/include/zephyr/drivers/sensor/npm13xx_charger.h @@ -8,21 +8,21 @@ #include -/* NPM13XX charger specific channels */ -enum sensor_channel_npm13xx_charger { - SENSOR_CHAN_NPM13XX_CHARGER_STATUS = SENSOR_CHAN_PRIV_START, - SENSOR_CHAN_NPM13XX_CHARGER_ERROR, - SENSOR_CHAN_NPM13XX_CHARGER_VBUS_STATUS, +/* NPM1300 charger specific channels */ +enum sensor_channel_npm1300_charger { + SENSOR_CHAN_NPM1300_CHARGER_STATUS = SENSOR_CHAN_PRIV_START, + SENSOR_CHAN_NPM1300_CHARGER_ERROR, + SENSOR_CHAN_NPM1300_CHARGER_VBUS_STATUS, }; -/* NPM13XX charger specific attributes */ -enum sensor_attribute_npm13xx_charger { - SENSOR_ATTR_NPM13XX_CHARGER_VBUS_PRESENT = SENSOR_ATTR_PRIV_START, - SENSOR_ATTR_NPM13XX_CHARGER_VBUS_CUR_LIMIT, - SENSOR_ATTR_NPM13XX_CHARGER_VBUS_OVERVLT_PROT, - SENSOR_ATTR_NPM13XX_CHARGER_VBUS_UNDERVLT, - SENSOR_ATTR_NPM13XX_CHARGER_VBUS_SUSPENDED, - SENSOR_ATTR_NPM13XX_CHARGER_VBUS_BUSOUT, +/* NPM1300 charger specific attributes */ +enum sensor_attribute_npm1300_charger { + SENSOR_ATTR_NPM1300_CHARGER_VBUS_PRESENT = SENSOR_ATTR_PRIV_START, + SENSOR_ATTR_NPM1300_CHARGER_VBUS_CUR_LIMIT, + SENSOR_ATTR_NPM1300_CHARGER_VBUS_OVERVLT_PROT, + SENSOR_ATTR_NPM1300_CHARGER_VBUS_UNDERVLT, + SENSOR_ATTR_NPM1300_CHARGER_VBUS_SUSPENDED, + SENSOR_ATTR_NPM1300_CHARGER_VBUS_BUSOUT, }; #endif diff --git a/include/zephyr/dt-bindings/gpio/nordic-npm13xx-gpio.h b/include/zephyr/dt-bindings/gpio/nordic-npm13xx-gpio.h index 41097b741b26..8e99213702b7 100644 --- a/include/zephyr/dt-bindings/gpio/nordic-npm13xx-gpio.h +++ b/include/zephyr/dt-bindings/gpio/nordic-npm13xx-gpio.h @@ -7,8 +7,8 @@ #define ZEPHYR_INCLUDE_DT_BINDINGS_GPIO_NORDIC_NPM13XX_GPIO_H_ /** - * @brief nPM13xx-specific GPIO Flags - * @defgroup gpio_interface_npm13xx nPM13xx-specific GPIO Flags + * @brief nPM1300-specific GPIO Flags + * @defgroup gpio_interface_npm1300 nPM1300-specific GPIO Flags * * The drive flags are encoded in the 8 upper bits of @ref gpio_dt_flags_t as * follows: @@ -23,74 +23,74 @@ */ /** - * @name nPM13xx GPIO drive strength flags - * @brief nPM13xx GPIO drive strength flags + * @name nPM1300 GPIO drive strength flags + * @brief nPM1300 GPIO drive strength flags * @{ */ /** @cond INTERNAL_HIDDEN */ /** Drive mode field mask */ -#define NPM13XX_GPIO_DRIVE_MSK 0x0100U +#define NPM1300_GPIO_DRIVE_MSK 0x0100U /** @endcond */ /** 1mA drive */ -#define NPM13XX_GPIO_DRIVE_1MA (0U << 8U) +#define NPM1300_GPIO_DRIVE_1MA (0U << 8U) /** 6mA drive */ -#define NPM13XX_GPIO_DRIVE_6MA (1U << 8U) +#define NPM1300_GPIO_DRIVE_6MA (1U << 8U) /** @} */ /** - * @name nPM13xx GPIO debounce flags - * @brief nPM13xx GPIO debounce flags + * @name nPM1300 GPIO debounce flags + * @brief nPM1300 GPIO debounce flags * @{ */ /** @cond INTERNAL_HIDDEN */ /** Debounce field mask */ -#define NPM13XX_GPIO_DEBOUNCE_MSK 0x0200U +#define NPM1300_GPIO_DEBOUNCE_MSK 0x0200U /** @endcond */ /** Normal drive */ -#define NPM13XX_GPIO_DEBOUNCE_OFF (0U << 9U) +#define NPM1300_GPIO_DEBOUNCE_OFF (0U << 9U) /** High drive */ -#define NPM13XX_GPIO_DEBOUNCE_ON (1U << 9U) +#define NPM1300_GPIO_DEBOUNCE_ON (1U << 9U) /** @} */ /** - * @name nPM13xx GPIO watchdog reset flags - * @brief nPM13xx GPIO watchdog reset flags + * @name nPM1300 GPIO watchdog reset flags + * @brief nPM1300 GPIO watchdog reset flags * @{ */ /** @cond INTERNAL_HIDDEN */ /** watchdog reset field mask */ -#define NPM13XX_GPIO_WDT_RESET_MSK 0x0400U +#define NPM1300_GPIO_WDT_RESET_MSK 0x0400U /** @endcond */ /** Off */ -#define NPM13XX_GPIO_WDT_RESET_OFF (0U << 10U) +#define NPM1300_GPIO_WDT_RESET_OFF (0U << 10U) /** On */ -#define NPM13XX_GPIO_WDT_RESET_ON (1U << 10U) +#define NPM1300_GPIO_WDT_RESET_ON (1U << 10U) /** @} */ /** - * @name nPM13xx GPIO power loss warning flags - * @brief nPM13xx GPIO power loss warning flags + * @name nPM1300 GPIO power loss warning flags + * @brief nPM1300 GPIO power loss warning flags * @{ */ /** @cond INTERNAL_HIDDEN */ /** power loss warning field mask */ -#define NPM13XX_GPIO_PWRLOSSWARN_MSK 0x0800U +#define NPM1300_GPIO_PWRLOSSWARN_MSK 0x0800U /** @endcond */ /** Off */ -#define NPM13XX_GPIO_PWRLOSSWARN_OFF (0U << 11U) +#define NPM1300_GPIO_PWRLOSSWARN_OFF (0U << 11U) /** On */ -#define NPM13XX_GPIO_PWRLOSSWARN_ON (1U << 11U) +#define NPM1300_GPIO_PWRLOSSWARN_ON (1U << 11U) /** @} */ diff --git a/include/zephyr/dt-bindings/regulator/npm13xx.h b/include/zephyr/dt-bindings/regulator/npm13xx.h index 19890261b8a8..e24283dceaba 100644 --- a/include/zephyr/dt-bindings/regulator/npm13xx.h +++ b/include/zephyr/dt-bindings/regulator/npm13xx.h @@ -8,31 +8,31 @@ #define ZEPHYR_INCLUDE_DT_BINDINGS_REGULATOR_NPM13XX_H_ /** - * @defgroup regulator_npm13xx nPM13xx Devicetree helpers. + * @defgroup regulator_npm1300 NPM1300 Devicetree helpers. * @ingroup regulator_interface * @{ */ /** - * @name nPM13xx Regulator modes + * @name NPM1300 Regulator modes * @{ */ /* Buck modes */ -#define NPM13XX_BUCK_MODE_AUTO 0x00U -#define NPM13XX_BUCK_MODE_PWM 0x01U -#define NPM13XX_BUCK_MODE_PFM 0x04U +#define NPM1300_BUCK_MODE_AUTO 0x00U +#define NPM1300_BUCK_MODE_PWM 0x01U +#define NPM1300_BUCK_MODE_PFM 0x04U /* LDSW / LDO modes */ -#define NPM13XX_LDSW_MODE_LDO 0x02U -#define NPM13XX_LDSW_MODE_LDSW 0x03U +#define NPM1300_LDSW_MODE_LDO 0x02U +#define NPM1300_LDSW_MODE_LDSW 0x03U /* GPIO control configuration */ -#define NPM13XX_GPIO_CHAN_NONE 0x00U -#define NPM13XX_GPIO_CHAN_0 0x01U -#define NPM13XX_GPIO_CHAN_1 0x02U -#define NPM13XX_GPIO_CHAN_2 0x03U -#define NPM13XX_GPIO_CHAN_3 0x04U -#define NPM13XX_GPIO_CHAN_4 0x05U +#define NPM1300_GPIO_CHAN_NONE 0x00U +#define NPM1300_GPIO_CHAN_0 0x01U +#define NPM1300_GPIO_CHAN_1 0x02U +#define NPM1300_GPIO_CHAN_2 0x03U +#define NPM1300_GPIO_CHAN_3 0x04U +#define NPM1300_GPIO_CHAN_4 0x05U /** @} */ diff --git a/samples/shields/npm1300_ek/nrf52dk_nrf52832.overlay b/samples/shields/npm1300_ek/nrf52dk_nrf52832.overlay index e4f2cca20ce5..7bcc1bef5a46 100644 --- a/samples/shields/npm1300_ek/nrf52dk_nrf52832.overlay +++ b/samples/shields/npm1300_ek/nrf52dk_nrf52832.overlay @@ -26,12 +26,12 @@ }; &npm1300_ek_ldo1 { - regulator-initial-mode = ; + regulator-initial-mode = ; enable-gpio-config = <2 GPIO_ACTIVE_LOW>; }; &npm1300_ek_ldo2 { - regulator-initial-mode = ; + regulator-initial-mode = ; enable-gpio-config = <2 GPIO_ACTIVE_LOW>; }; diff --git a/samples/shields/npm1300_ek/src/main.c b/samples/shields/npm1300_ek/src/main.c index 9ecffb69e219..ac2a6ca245b1 100644 --- a/samples/shields/npm1300_ek/src/main.c +++ b/samples/shields/npm1300_ek/src/main.c @@ -68,9 +68,9 @@ void configure_events(void) /* Setup callback for shiphold button press */ static struct gpio_callback event_cb; - gpio_init_callback(&event_cb, event_callback, BIT(NPM13XX_EVENT_SHIPHOLD_PRESS)); + gpio_init_callback(&event_cb, event_callback, BIT(NPM1300_EVENT_SHIPHOLD_PRESS)); - mfd_npm13xx_add_callback(pmic, &event_cb); + mfd_npm1300_add_callback(pmic, &event_cb); } void read_sensors(void) @@ -86,11 +86,11 @@ void read_sensors(void) sensor_channel_get(charger, SENSOR_CHAN_GAUGE_VOLTAGE, &volt); sensor_channel_get(charger, SENSOR_CHAN_GAUGE_AVG_CURRENT, ¤t); sensor_channel_get(charger, SENSOR_CHAN_GAUGE_TEMP, &temp); - sensor_channel_get(charger, (enum sensor_channel)SENSOR_CHAN_NPM13XX_CHARGER_STATUS, + sensor_channel_get(charger, (enum sensor_channel)SENSOR_CHAN_NPM1300_CHARGER_STATUS, &status); - sensor_channel_get(charger, (enum sensor_channel)SENSOR_CHAN_NPM13XX_CHARGER_ERROR, &error); - sensor_attr_get(charger, (enum sensor_channel)SENSOR_CHAN_NPM13XX_CHARGER_VBUS_STATUS, - (enum sensor_attribute)SENSOR_ATTR_NPM13XX_CHARGER_VBUS_PRESENT, + sensor_channel_get(charger, (enum sensor_channel)SENSOR_CHAN_NPM1300_CHARGER_ERROR, &error); + sensor_attr_get(charger, (enum sensor_channel)SENSOR_CHAN_NPM1300_CHARGER_VBUS_STATUS, + (enum sensor_attribute)SENSOR_ATTR_NPM1300_CHARGER_VBUS_PRESENT, &vbus_present); printk("V: %d.%03d ", volt.val1, volt.val2 / 1000); From 3724d2a718ded3a7711f336170148c1df7012291 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:06 +0300 Subject: [PATCH 1484/2141] Revert "[nrf fromtree] drivers: npm1300: rename to npm13xx" This reverts commit df84dcade739b4f0b2e7b158921820dfc052d3e6. Signed-off-by: Jukka Rissanen --- boards/shields/npm1300_ek/npm1300_ek.overlay | 2 +- drivers/gpio/CMakeLists.txt | 2 +- drivers/gpio/Kconfig | 2 +- drivers/gpio/{Kconfig.npm13xx => Kconfig.npm1300} | 0 drivers/gpio/{gpio_npm13xx.c => gpio_npm1300.c} | 4 ++-- drivers/led/CMakeLists.txt | 2 +- drivers/led/Kconfig | 2 +- drivers/led/{Kconfig.npm13xx => Kconfig.npm1300} | 0 drivers/led/{led_npm13xx.c => led_npm1300.c} | 2 +- drivers/mfd/CMakeLists.txt | 2 +- drivers/mfd/Kconfig | 2 +- drivers/mfd/{Kconfig.npm13xx => Kconfig.npm1300} | 0 drivers/mfd/{mfd_npm13xx.c => mfd_npm1300.c} | 2 +- drivers/regulator/CMakeLists.txt | 2 +- drivers/regulator/Kconfig | 2 +- drivers/regulator/{Kconfig.npm13xx => Kconfig.npm1300} | 0 .../regulator/{regulator_npm13xx.c => regulator_npm1300.c} | 4 ++-- drivers/sensor/nordic/CMakeLists.txt | 2 +- drivers/sensor/nordic/Kconfig | 2 +- .../{npm13xx_charger => npm1300_charger}/CMakeLists.txt | 2 +- .../nordic/{npm13xx_charger => npm1300_charger}/Kconfig | 0 .../npm13xx_charger.c => npm1300_charger/npm1300_charger.c} | 4 ++-- drivers/watchdog/CMakeLists.txt | 2 +- drivers/watchdog/Kconfig | 2 +- drivers/watchdog/{Kconfig.npm13xx => Kconfig.npm1300} | 0 drivers/watchdog/{wdt_npm13xx.c => wdt_npm1300.c} | 4 ++-- include/zephyr/drivers/mfd/{npm13xx.h => npm1300.h} | 6 +++--- .../drivers/sensor/{npm13xx_charger.h => npm1300_charger.h} | 4 ++-- .../gpio/{nordic-npm13xx-gpio.h => nordic-npm1300-gpio.h} | 6 +++--- .../zephyr/dt-bindings/regulator/{npm13xx.h => npm1300.h} | 6 +++--- samples/shields/npm1300_ek/src/main.c | 6 +++--- 31 files changed, 38 insertions(+), 38 deletions(-) rename drivers/gpio/{Kconfig.npm13xx => Kconfig.npm1300} (100%) rename drivers/gpio/{gpio_npm13xx.c => gpio_npm1300.c} (98%) rename drivers/led/{Kconfig.npm13xx => Kconfig.npm1300} (100%) rename drivers/led/{led_npm13xx.c => led_npm1300.c} (98%) rename drivers/mfd/{Kconfig.npm13xx => Kconfig.npm1300} (100%) rename drivers/mfd/{mfd_npm13xx.c => mfd_npm1300.c} (99%) rename drivers/regulator/{Kconfig.npm13xx => Kconfig.npm1300} (100%) rename drivers/regulator/{regulator_npm13xx.c => regulator_npm1300.c} (99%) rename drivers/sensor/nordic/{npm13xx_charger => npm1300_charger}/CMakeLists.txt (71%) rename drivers/sensor/nordic/{npm13xx_charger => npm1300_charger}/Kconfig (100%) rename drivers/sensor/nordic/{npm13xx_charger/npm13xx_charger.c => npm1300_charger/npm1300_charger.c} (99%) rename drivers/watchdog/{Kconfig.npm13xx => Kconfig.npm1300} (100%) rename drivers/watchdog/{wdt_npm13xx.c => wdt_npm1300.c} (97%) rename include/zephyr/drivers/mfd/{npm13xx.h => npm1300.h} (97%) rename include/zephyr/drivers/sensor/{npm13xx_charger.h => npm1300_charger.h} (86%) rename include/zephyr/dt-bindings/gpio/{nordic-npm13xx-gpio.h => nordic-npm1300-gpio.h} (91%) rename include/zephyr/dt-bindings/regulator/{npm13xx.h => npm1300.h} (81%) diff --git a/boards/shields/npm1300_ek/npm1300_ek.overlay b/boards/shields/npm1300_ek/npm1300_ek.overlay index d0a9b0eda228..592aa55f1243 100644 --- a/boards/shields/npm1300_ek/npm1300_ek.overlay +++ b/boards/shields/npm1300_ek/npm1300_ek.overlay @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include +#include #include &arduino_i2c { diff --git a/drivers/gpio/CMakeLists.txt b/drivers/gpio/CMakeLists.txt index 8a5ea48cb65b..728a883e1093 100644 --- a/drivers/gpio/CMakeLists.txt +++ b/drivers/gpio/CMakeLists.txt @@ -67,7 +67,7 @@ zephyr_library_sources_ifdef(CONFIG_GPIO_NCT38XX gpio_nct38xx_port.c) zephyr_library_sources_ifdef(CONFIG_GPIO_NCT38XX_ALERT gpio_nct38xx_alert.c) zephyr_library_sources_ifdef(CONFIG_GPIO_NEORV32 gpio_neorv32.c) zephyr_library_sources_ifdef(CONFIG_GPIO_NPCX gpio_npcx.c) -zephyr_library_sources_ifdef(CONFIG_GPIO_NPM1300 gpio_npm13xx.c) +zephyr_library_sources_ifdef(CONFIG_GPIO_NPM1300 gpio_npm1300.c) zephyr_library_sources_ifdef(CONFIG_GPIO_NPM2100 gpio_npm2100.c) zephyr_library_sources_ifdef(CONFIG_GPIO_NPM6001 gpio_npm6001.c) zephyr_library_sources_ifdef(CONFIG_GPIO_NRFX gpio_nrfx.c) diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index dcf5a8c043c6..e95aded5613a 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig @@ -153,7 +153,7 @@ source "drivers/gpio/Kconfig.mspm0" source "drivers/gpio/Kconfig.nct38xx" source "drivers/gpio/Kconfig.neorv32" source "drivers/gpio/Kconfig.npcx" -source "drivers/gpio/Kconfig.npm13xx" +source "drivers/gpio/Kconfig.npm1300" source "drivers/gpio/Kconfig.npm2100" source "drivers/gpio/Kconfig.npm6001" source "drivers/gpio/Kconfig.nrfx" diff --git a/drivers/gpio/Kconfig.npm13xx b/drivers/gpio/Kconfig.npm1300 similarity index 100% rename from drivers/gpio/Kconfig.npm13xx rename to drivers/gpio/Kconfig.npm1300 diff --git a/drivers/gpio/gpio_npm13xx.c b/drivers/gpio/gpio_npm1300.c similarity index 98% rename from drivers/gpio/gpio_npm13xx.c rename to drivers/gpio/gpio_npm1300.c index 40c5aaf10985..a941e1f3f6f9 100644 --- a/drivers/gpio/gpio_npm13xx.c +++ b/drivers/gpio/gpio_npm1300.c @@ -9,8 +9,8 @@ #include #include -#include -#include +#include +#include #include #include diff --git a/drivers/led/CMakeLists.txt b/drivers/led/CMakeLists.txt index c4c0752b2550..73a808d7d5a2 100644 --- a/drivers/led/CMakeLists.txt +++ b/drivers/led/CMakeLists.txt @@ -12,7 +12,7 @@ zephyr_library_sources_ifdef(CONFIG_IS31FL3733 is31fl3733.c) zephyr_library_sources_ifdef(CONFIG_LED_AXP192_AXP2101 led_axp192.c) zephyr_library_sources_ifdef(CONFIG_LED_DAC led_dac.c) zephyr_library_sources_ifdef(CONFIG_LED_GPIO led_gpio.c) -zephyr_library_sources_ifdef(CONFIG_LED_NPM1300 led_npm13xx.c) +zephyr_library_sources_ifdef(CONFIG_LED_NPM1300 led_npm1300.c) zephyr_library_sources_ifdef(CONFIG_LED_PWM led_pwm.c) zephyr_library_sources_ifdef(CONFIG_LED_XEC led_mchp_xec.c) zephyr_library_sources_ifdef(CONFIG_LP3943 lp3943.c) diff --git a/drivers/led/Kconfig b/drivers/led/Kconfig index 0e411ce21f04..bac815242c39 100644 --- a/drivers/led/Kconfig +++ b/drivers/led/Kconfig @@ -40,7 +40,7 @@ source "drivers/led/Kconfig.lp5562" source "drivers/led/Kconfig.lp5569" source "drivers/led/Kconfig.modulino" source "drivers/led/Kconfig.ncp5623" -source "drivers/led/Kconfig.npm13xx" +source "drivers/led/Kconfig.npm1300" source "drivers/led/Kconfig.pca9633" source "drivers/led/Kconfig.pwm" source "drivers/led/Kconfig.tlc59108" diff --git a/drivers/led/Kconfig.npm13xx b/drivers/led/Kconfig.npm1300 similarity index 100% rename from drivers/led/Kconfig.npm13xx rename to drivers/led/Kconfig.npm1300 diff --git a/drivers/led/led_npm13xx.c b/drivers/led/led_npm1300.c similarity index 98% rename from drivers/led/led_npm13xx.c rename to drivers/led/led_npm1300.c index 9052159e7392..f23fde1dfa28 100644 --- a/drivers/led/led_npm13xx.c +++ b/drivers/led/led_npm1300.c @@ -9,7 +9,7 @@ #include #include -#include +#include /* nPM1300 LED base address */ #define NPM_LED_BASE 0x0AU diff --git a/drivers/mfd/CMakeLists.txt b/drivers/mfd/CMakeLists.txt index 24a1c698e768..8560a10655f0 100644 --- a/drivers/mfd/CMakeLists.txt +++ b/drivers/mfd/CMakeLists.txt @@ -6,7 +6,7 @@ zephyr_library() zephyr_library_sources_ifdef(CONFIG_MFD_ADP5585 mfd_adp5585.c) zephyr_library_sources_ifdef(CONFIG_MFD_MAX20335 mfd_max20335.c) zephyr_library_sources_ifdef(CONFIG_MFD_NCT38XX mfd_nct38xx.c) -zephyr_library_sources_ifdef(CONFIG_MFD_NPM1300 mfd_npm13xx.c) +zephyr_library_sources_ifdef(CONFIG_MFD_NPM1300 mfd_npm1300.c) zephyr_library_sources_ifdef(CONFIG_MFD_NPM2100 mfd_npm2100.c) zephyr_library_sources_ifdef(CONFIG_MFD_NPM6001 mfd_npm6001.c) zephyr_library_sources_ifdef(CONFIG_MFD_AXP192_AXP2101 mfd_axp192.c) diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 86a11a72b410..325e29c864ae 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -30,7 +30,7 @@ source "drivers/mfd/Kconfig.max31790" source "drivers/mfd/Kconfig.maxq10xx" source "drivers/mfd/Kconfig.mchp_sam" source "drivers/mfd/Kconfig.nct38xx" -source "drivers/mfd/Kconfig.npm13xx" +source "drivers/mfd/Kconfig.npm1300" source "drivers/mfd/Kconfig.npm2100" source "drivers/mfd/Kconfig.npm6001" source "drivers/mfd/Kconfig.pf1550" diff --git a/drivers/mfd/Kconfig.npm13xx b/drivers/mfd/Kconfig.npm1300 similarity index 100% rename from drivers/mfd/Kconfig.npm13xx rename to drivers/mfd/Kconfig.npm1300 diff --git a/drivers/mfd/mfd_npm13xx.c b/drivers/mfd/mfd_npm1300.c similarity index 99% rename from drivers/mfd/mfd_npm13xx.c rename to drivers/mfd/mfd_npm1300.c index 21961b1696a6..2ea0818faeec 100644 --- a/drivers/mfd/mfd_npm13xx.c +++ b/drivers/mfd/mfd_npm1300.c @@ -12,7 +12,7 @@ #include #include #include -#include +#include #define TIME_BASE 0x07U #define MAIN_BASE 0x00U diff --git a/drivers/regulator/CMakeLists.txt b/drivers/regulator/CMakeLists.txt index 817518d9b2f9..ed5a1996da9b 100644 --- a/drivers/regulator/CMakeLists.txt +++ b/drivers/regulator/CMakeLists.txt @@ -13,7 +13,7 @@ zephyr_library_sources_ifdef(CONFIG_REGULATOR_FIXED regulator_fixed.c) zephyr_library_sources_ifdef(CONFIG_REGULATOR_GPIO regulator_gpio.c) zephyr_library_sources_ifdef(CONFIG_REGULATOR_MAX20335 regulator_max20335.c) zephyr_library_sources_ifdef(CONFIG_REGULATOR_NPM1100 regulator_npm1100.c) -zephyr_library_sources_ifdef(CONFIG_REGULATOR_NPM1300 regulator_npm13xx.c) +zephyr_library_sources_ifdef(CONFIG_REGULATOR_NPM1300 regulator_npm1300.c) zephyr_library_sources_ifdef(CONFIG_REGULATOR_NPM2100 regulator_npm2100.c) zephyr_library_sources_ifdef(CONFIG_REGULATOR_NPM6001 regulator_npm6001.c) zephyr_library_sources_ifdef(CONFIG_REGULATOR_PCA9420 regulator_pca9420.c) diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig index ca2bf41ae895..dc331b2139d3 100644 --- a/drivers/regulator/Kconfig +++ b/drivers/regulator/Kconfig @@ -35,7 +35,7 @@ source "drivers/regulator/Kconfig.fixed" source "drivers/regulator/Kconfig.gpio" source "drivers/regulator/Kconfig.max20335" source "drivers/regulator/Kconfig.npm1100" -source "drivers/regulator/Kconfig.npm13xx" +source "drivers/regulator/Kconfig.npm1300" source "drivers/regulator/Kconfig.npm2100" source "drivers/regulator/Kconfig.npm6001" source "drivers/regulator/Kconfig.pca9420" diff --git a/drivers/regulator/Kconfig.npm13xx b/drivers/regulator/Kconfig.npm1300 similarity index 100% rename from drivers/regulator/Kconfig.npm13xx rename to drivers/regulator/Kconfig.npm1300 diff --git a/drivers/regulator/regulator_npm13xx.c b/drivers/regulator/regulator_npm1300.c similarity index 99% rename from drivers/regulator/regulator_npm13xx.c rename to drivers/regulator/regulator_npm1300.c index 913f51456af4..19d8a2a179e3 100644 --- a/drivers/regulator/regulator_npm13xx.c +++ b/drivers/regulator/regulator_npm1300.c @@ -10,8 +10,8 @@ #include #include -#include -#include +#include +#include #include #include diff --git a/drivers/sensor/nordic/CMakeLists.txt b/drivers/sensor/nordic/CMakeLists.txt index cfda4b85b474..49a0a48d7fd9 100644 --- a/drivers/sensor/nordic/CMakeLists.txt +++ b/drivers/sensor/nordic/CMakeLists.txt @@ -3,7 +3,7 @@ # zephyr-keep-sorted-start add_subdirectory(temp) -add_subdirectory_ifdef(CONFIG_NPM1300_CHARGER npm13xx_charger) +add_subdirectory_ifdef(CONFIG_NPM1300_CHARGER npm1300_charger) add_subdirectory_ifdef(CONFIG_NPM2100_VBAT npm2100_vbat) add_subdirectory_ifdef(CONFIG_QDEC_NRFX qdec_nrfx) # zephyr-keep-sorted-stop diff --git a/drivers/sensor/nordic/Kconfig b/drivers/sensor/nordic/Kconfig index 717c941973f9..0cdbaaf41e71 100644 --- a/drivers/sensor/nordic/Kconfig +++ b/drivers/sensor/nordic/Kconfig @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 # zephyr-keep-sorted-start -source "drivers/sensor/nordic/npm13xx_charger/Kconfig" +source "drivers/sensor/nordic/npm1300_charger/Kconfig" source "drivers/sensor/nordic/npm2100_vbat/Kconfig" source "drivers/sensor/nordic/qdec_nrfx/Kconfig" source "drivers/sensor/nordic/temp/Kconfig" diff --git a/drivers/sensor/nordic/npm13xx_charger/CMakeLists.txt b/drivers/sensor/nordic/npm1300_charger/CMakeLists.txt similarity index 71% rename from drivers/sensor/nordic/npm13xx_charger/CMakeLists.txt rename to drivers/sensor/nordic/npm1300_charger/CMakeLists.txt index 512e0f9eecd4..51083775eff7 100644 --- a/drivers/sensor/nordic/npm13xx_charger/CMakeLists.txt +++ b/drivers/sensor/nordic/npm1300_charger/CMakeLists.txt @@ -4,4 +4,4 @@ zephyr_library() -zephyr_library_sources(npm13xx_charger.c) +zephyr_library_sources(npm1300_charger.c) diff --git a/drivers/sensor/nordic/npm13xx_charger/Kconfig b/drivers/sensor/nordic/npm1300_charger/Kconfig similarity index 100% rename from drivers/sensor/nordic/npm13xx_charger/Kconfig rename to drivers/sensor/nordic/npm1300_charger/Kconfig diff --git a/drivers/sensor/nordic/npm13xx_charger/npm13xx_charger.c b/drivers/sensor/nordic/npm1300_charger/npm1300_charger.c similarity index 99% rename from drivers/sensor/nordic/npm13xx_charger/npm13xx_charger.c rename to drivers/sensor/nordic/npm1300_charger/npm1300_charger.c index 829ce6a2265b..a5b2a0b1054b 100644 --- a/drivers/sensor/nordic/npm13xx_charger/npm13xx_charger.c +++ b/drivers/sensor/nordic/npm1300_charger/npm1300_charger.c @@ -7,10 +7,10 @@ #include #include -#include +#include #include #include -#include +#include struct npm1300_charger_config { const struct device *mfd; diff --git a/drivers/watchdog/CMakeLists.txt b/drivers/watchdog/CMakeLists.txt index 4d6f75e4d9e5..e7264362e3f4 100644 --- a/drivers/watchdog/CMakeLists.txt +++ b/drivers/watchdog/CMakeLists.txt @@ -28,7 +28,7 @@ zephyr_library_sources_ifdef(CONFIG_WDT_MCUX_WDOG wdt_mcux_wdog.c) zephyr_library_sources_ifdef(CONFIG_WDT_MCUX_WDOG32 wdt_mcux_wdog32.c) zephyr_library_sources_ifdef(CONFIG_WDT_MCUX_WWDT wdt_mcux_wwdt.c) zephyr_library_sources_ifdef(CONFIG_WDT_NPCX wdt_npcx.c) -zephyr_library_sources_ifdef(CONFIG_WDT_NPM1300 wdt_npm13xx.c) +zephyr_library_sources_ifdef(CONFIG_WDT_NPM1300 wdt_npm1300.c) zephyr_library_sources_ifdef(CONFIG_WDT_NPM2100 wdt_npm2100.c) zephyr_library_sources_ifdef(CONFIG_WDT_NPM6001 wdt_npm6001.c) zephyr_library_sources_ifdef(CONFIG_WDT_NRFX wdt_nrfx.c) diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index 4fed392fd223..bd445bda94f9 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig @@ -107,7 +107,7 @@ source "drivers/watchdog/Kconfig.rpi_pico" source "drivers/watchdog/Kconfig.gd32" -source "drivers/watchdog/Kconfig.npm13xx" +source "drivers/watchdog/Kconfig.npm1300" source "drivers/watchdog/Kconfig.npm2100" diff --git a/drivers/watchdog/Kconfig.npm13xx b/drivers/watchdog/Kconfig.npm1300 similarity index 100% rename from drivers/watchdog/Kconfig.npm13xx rename to drivers/watchdog/Kconfig.npm1300 diff --git a/drivers/watchdog/wdt_npm13xx.c b/drivers/watchdog/wdt_npm1300.c similarity index 97% rename from drivers/watchdog/wdt_npm13xx.c rename to drivers/watchdog/wdt_npm1300.c index 6dc9f2d49ea4..71002875af0c 100644 --- a/drivers/watchdog/wdt_npm13xx.c +++ b/drivers/watchdog/wdt_npm1300.c @@ -10,8 +10,8 @@ #include #include #include -#include -#include +#include +#include /* nPM1300 TIMER base address */ #define TIME_BASE 0x07U diff --git a/include/zephyr/drivers/mfd/npm13xx.h b/include/zephyr/drivers/mfd/npm1300.h similarity index 97% rename from include/zephyr/drivers/mfd/npm13xx.h rename to include/zephyr/drivers/mfd/npm1300.h index a1b941a4fb73..4dd03fa2ec31 100644 --- a/include/zephyr/drivers/mfd/npm13xx.h +++ b/include/zephyr/drivers/mfd/npm1300.h @@ -3,8 +3,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -#ifndef ZEPHYR_INCLUDE_DRIVERS_MFD_NPM13XX_H_ -#define ZEPHYR_INCLUDE_DRIVERS_MFD_NPM13XX_H_ +#ifndef ZEPHYR_INCLUDE_DRIVERS_MFD_NPM1300_H_ +#define ZEPHYR_INCLUDE_DRIVERS_MFD_NPM1300_H_ #ifdef __cplusplus extern "C" { @@ -163,4 +163,4 @@ int mfd_npm1300_remove_callback(const struct device *dev, struct gpio_callback * } #endif -#endif /* ZEPHYR_INCLUDE_DRIVERS_MFD_NPM13XX_H_ */ +#endif /* ZEPHYR_INCLUDE_DRIVERS_MFD_NPM1300_H_ */ diff --git a/include/zephyr/drivers/sensor/npm13xx_charger.h b/include/zephyr/drivers/sensor/npm1300_charger.h similarity index 86% rename from include/zephyr/drivers/sensor/npm13xx_charger.h rename to include/zephyr/drivers/sensor/npm1300_charger.h index 05176b361226..d2a166340d15 100644 --- a/include/zephyr/drivers/sensor/npm13xx_charger.h +++ b/include/zephyr/drivers/sensor/npm1300_charger.h @@ -3,8 +3,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -#ifndef ZEPHYR_INCLUDE_DRIVERS_SENSOR_NPM13XX_CHARGER_H_ -#define ZEPHYR_INCLUDE_DRIVERS_SENSOR_NPM13XX_CHARGER_H_ +#ifndef ZEPHYR_INCLUDE_DRIVERS_SENSOR_NPM1300_CHARGER_H_ +#define ZEPHYR_INCLUDE_DRIVERS_SENSOR_NPM1300_CHARGER_H_ #include diff --git a/include/zephyr/dt-bindings/gpio/nordic-npm13xx-gpio.h b/include/zephyr/dt-bindings/gpio/nordic-npm1300-gpio.h similarity index 91% rename from include/zephyr/dt-bindings/gpio/nordic-npm13xx-gpio.h rename to include/zephyr/dt-bindings/gpio/nordic-npm1300-gpio.h index 8e99213702b7..fed166e651a2 100644 --- a/include/zephyr/dt-bindings/gpio/nordic-npm13xx-gpio.h +++ b/include/zephyr/dt-bindings/gpio/nordic-npm1300-gpio.h @@ -3,8 +3,8 @@ * * SPDX-License-Identifier: Apache-2.0 */ -#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_GPIO_NORDIC_NPM13XX_GPIO_H_ -#define ZEPHYR_INCLUDE_DT_BINDINGS_GPIO_NORDIC_NPM13XX_GPIO_H_ +#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_GPIO_NORDIC_NPM1300_GPIO_H_ +#define ZEPHYR_INCLUDE_DT_BINDINGS_GPIO_NORDIC_NPM1300_GPIO_H_ /** * @brief nPM1300-specific GPIO Flags @@ -96,4 +96,4 @@ /** @} */ -#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_GPIO_NORDIC_NPM13XX_GPIO_H_ */ +#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_GPIO_NORDIC_NPM1300_GPIO_H_ */ diff --git a/include/zephyr/dt-bindings/regulator/npm13xx.h b/include/zephyr/dt-bindings/regulator/npm1300.h similarity index 81% rename from include/zephyr/dt-bindings/regulator/npm13xx.h rename to include/zephyr/dt-bindings/regulator/npm1300.h index e24283dceaba..bf3f8cfa3ee9 100644 --- a/include/zephyr/dt-bindings/regulator/npm13xx.h +++ b/include/zephyr/dt-bindings/regulator/npm1300.h @@ -4,8 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_REGULATOR_NPM13XX_H_ -#define ZEPHYR_INCLUDE_DT_BINDINGS_REGULATOR_NPM13XX_H_ +#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_REGULATOR_NPM1300_H_ +#define ZEPHYR_INCLUDE_DT_BINDINGS_REGULATOR_NPM1300_H_ /** * @defgroup regulator_npm1300 NPM1300 Devicetree helpers. @@ -38,4 +38,4 @@ /** @} */ -#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_REGULATOR_NPM13XX_H_*/ +#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_REGULATOR_NPM1300_H_*/ diff --git a/samples/shields/npm1300_ek/src/main.c b/samples/shields/npm1300_ek/src/main.c index ac2a6ca245b1..7ced01456628 100644 --- a/samples/shields/npm1300_ek/src/main.c +++ b/samples/shields/npm1300_ek/src/main.c @@ -9,10 +9,10 @@ #include #include #include -#include +#include #include -#include -#include +#include +#include #include #include From 699f4124eb93e74676f1ab14d0738398634f319e Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:06 +0300 Subject: [PATCH 1485/2141] Revert "[nrf fromtree] regulator: npm1300: configure active discharge" This reverts commit d2a01f5b5c5f399878b5ba0df407b4624ae2b0a1. Signed-off-by: Jukka Rissanen --- drivers/regulator/regulator_npm1300.c | 50 +++---------------- .../regulator/nordic,npm1300-regulator.yaml | 5 -- 2 files changed, 6 insertions(+), 49 deletions(-) diff --git a/drivers/regulator/regulator_npm1300.c b/drivers/regulator/regulator_npm1300.c index 19d8a2a179e3..8b5b64572c45 100644 --- a/drivers/regulator/regulator_npm1300.c +++ b/drivers/regulator/regulator_npm1300.c @@ -62,20 +62,16 @@ enum npm1300_gpio_type { /* nPM1300 ship register offsets */ #define SHIP_OFFSET_SHIP 0x02U -#define BUCK1_ON_MASK 0x04U -#define BUCK2_ON_MASK 0x40U -#define BUCK1_EN_PULLDOWN_MASK BIT(2) -#define BUCK2_EN_PULLDOWN_MASK BIT(3) +#define BUCK1_ON_MASK 0x04U +#define BUCK2_ON_MASK 0x40U #define LDSW1_ON_MASK 0x03U #define LDSW2_ON_MASK 0x0CU -#define LDSW1_SOFTSTART_MASK 0x0CU -#define LDSW1_SOFTSTART_SHIFT 2U -#define LDSW1_ACTIVE_DISCHARGE_MASK BIT(6) -#define LDSW2_SOFTSTART_MASK 0x30U -#define LDSW2_SOFTSTART_SHIFT 4U -#define LDSW2_ACTIVE_DISCHARGE_MASK BIT(7) +#define LDSW1_SOFTSTART_MASK 0x0CU +#define LDSW1_SOFTSTART_SHIFT 2U +#define LDSW2_SOFTSTART_MASK 0x30U +#define LDSW2_SOFTSTART_SHIFT 4U #define NPM1300_GPIO_UNUSED UINT8_MAX @@ -98,7 +94,6 @@ struct regulator_npm1300_config { struct npm1300_gpio_info retention_gpios; struct npm1300_gpio_info pwm_gpios; uint8_t soft_start; - bool active_discharge; bool ldo_disable_workaround; }; @@ -608,32 +603,6 @@ static int soft_start_set(const struct device *dev, uint8_t soft_start) } } -static int active_discharge_set(const struct device *dev, bool enabled) -{ - const struct regulator_npm1300_config *config = dev->config; - - switch (config->source) { - case NPM1300_SOURCE_BUCK1: - return mfd_npm1300_reg_update(config->mfd, BUCK_BASE, BUCK_OFFSET_CTRL0, - enabled ? BUCK1_EN_PULLDOWN_MASK : 0, - BUCK1_EN_PULLDOWN_MASK); - case NPM1300_SOURCE_BUCK2: - return mfd_npm1300_reg_update(config->mfd, BUCK_BASE, BUCK_OFFSET_CTRL0, - enabled ? BUCK2_EN_PULLDOWN_MASK : 0, - BUCK2_EN_PULLDOWN_MASK); - case NPM1300_SOURCE_LDO1: - return mfd_npm1300_reg_update(config->mfd, LDSW_BASE, LDSW_OFFSET_CONFIG, - enabled ? LDSW1_ACTIVE_DISCHARGE_MASK : 0, - LDSW1_ACTIVE_DISCHARGE_MASK); - case NPM1300_SOURCE_LDO2: - return mfd_npm1300_reg_update(config->mfd, LDSW_BASE, LDSW_OFFSET_CONFIG, - enabled ? LDSW2_ACTIVE_DISCHARGE_MASK : 0, - LDSW2_ACTIVE_DISCHARGE_MASK); - default: - return -ENODEV; - } -} - int regulator_npm1300_init(const struct device *dev) { const struct regulator_npm1300_config *config = dev->config; @@ -670,12 +639,6 @@ int regulator_npm1300_init(const struct device *dev) } } - /* Configure active discharge */ - ret = active_discharge_set(dev, config->active_discharge); - if (ret != 0) { - return ret; - } - /* Configure GPIO pin control */ ret = regulator_npm1300_set_pin_ctrl(dev, &config->enable_gpios, NPM1300_GPIO_TYPE_ENABLE); if (ret != 0) { @@ -727,7 +690,6 @@ static DEVICE_API(regulator, api) = { .enable_gpios = GPIO_CONFIG_DEFINE(node_id, enable_gpio_config), \ .retention_gpios = GPIO_CONFIG_DEFINE(node_id, retention_gpio_config), \ .pwm_gpios = GPIO_CONFIG_DEFINE(node_id, pwm_gpio_config), \ - .active_discharge = DT_PROP(node_id, active_discharge), \ .ldo_disable_workaround = DT_PROP(node_id, nordic_anomaly38_disable_workaround)}; \ \ DEVICE_DT_DEFINE(node_id, regulator_npm1300_init, NULL, &data_##id, &config_##id, \ diff --git a/dts/bindings/regulator/nordic,npm1300-regulator.yaml b/dts/bindings/regulator/nordic,npm1300-regulator.yaml index 1b77f6c1ab43..28b50dd34b79 100644 --- a/dts/bindings/regulator/nordic,npm1300-regulator.yaml +++ b/dts/bindings/regulator/nordic,npm1300-regulator.yaml @@ -97,11 +97,6 @@ child-binding: description: | Soft start current limit in microamps. - active-discharge: - type: boolean - description: | - Enable active-discharge on the BUCK/LDO/LDSW output when disabled. - nordic,anomaly38-disable-workaround: type: boolean description: | From d7574eda91ba14ce19018d629cd8a5735e9f1244 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:07 +0300 Subject: [PATCH 1486/2141] Revert "[nrf fromtree] libc: minimal: Add "prohibit_lto" flag to avoid problems with LTO" This reverts commit dec4c5b99a995f15afbb7551424a00a6ec8f0530. Signed-off-by: Jukka Rissanen --- lib/libc/minimal/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/libc/minimal/CMakeLists.txt b/lib/libc/minimal/CMakeLists.txt index 29f2db74367b..10610b855c84 100644 --- a/lib/libc/minimal/CMakeLists.txt +++ b/lib/libc/minimal/CMakeLists.txt @@ -12,7 +12,6 @@ set(GEN_DIR ${ZEPHYR_BINARY_DIR}/include/generated) set(STRERROR_TABLE_H ${GEN_DIR}/libc/minimal/strerror_table.h) zephyr_library_compile_options($) -zephyr_library_compile_options($) zephyr_library_sources( source/stdlib/atoi.c From b437d416f481c64fd999372d3c0bd72630212cc5 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:07 +0300 Subject: [PATCH 1487/2141] Revert "[nrf fromtree] tests: spi: loopback: use CONFIG_ZTEST_STACK_SIZE for thread stacks" This reverts commit 2d0c2aac414b48c5e8514d1b3b0c945038e599f0. Signed-off-by: Jukka Rissanen --- tests/drivers/spi/spi_loopback/src/spi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/drivers/spi/spi_loopback/src/spi.c b/tests/drivers/spi/spi_loopback/src/spi.c index 5419a7493518..64649ce7566b 100644 --- a/tests/drivers/spi/spi_loopback/src/spi.c +++ b/tests/drivers/spi/spi_loopback/src/spi.c @@ -693,8 +693,7 @@ ZTEST(spi_loopback, test_spi_word_size_32) sizeof(buffer_tx_32), &spec_copies[4], 32); } -static K_THREAD_STACK_DEFINE(thread_stack[3], CONFIG_ZTEST_STACK_SIZE + - CONFIG_TEST_EXTRA_STACK_SIZE); +static K_THREAD_STACK_DEFINE(thread_stack[3], 512); static struct k_thread thread[3]; static K_SEM_DEFINE(thread_sem, 0, 3); From d5d4560447580ecc42bc053be5294e554592cdca Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:07 +0300 Subject: [PATCH 1488/2141] Revert "[nrf fromlist] tests: kernel: interrupt: Fix for nRF54H20 FLPR" This reverts commit 68e055a660fc7907cb92da5870b4bbeafa8d0f31. Signed-off-by: Jukka Rissanen --- tests/kernel/interrupt/src/nested_irq.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/kernel/interrupt/src/nested_irq.c b/tests/kernel/interrupt/src/nested_irq.c index 6bfc81b8965c..e1edfc3442fe 100644 --- a/tests/kernel/interrupt/src/nested_irq.c +++ b/tests/kernel/interrupt/src/nested_irq.c @@ -56,8 +56,7 @@ */ #define IRQ0_PRIO IRQ_DEFAULT_PRIORITY #define IRQ1_PRIO 0x0 -#elif (defined(CONFIG_SOC_SERIES_NRF54LX) || defined(CONFIG_SOC_NRF54H20_CPUFLPR)) && \ - defined(CONFIG_RISCV_CORE_NORDIC_VPR) +#elif defined(CONFIG_SOC_SERIES_NRF54LX) && defined(CONFIG_RISCV_CORE_NORDIC_VPR) #define IRQ0_LINE 16 #define IRQ1_LINE 17 From 641aaffd2832b564bd7b1fcb1b7f8b8554099844 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:07 +0300 Subject: [PATCH 1489/2141] Revert "[nrf fromtree] scripts: kconfig: Add hex variants of arithmetic functions" This reverts commit a2838ea67c96a21cbf0e44a756699df586cbafc5. Signed-off-by: Jukka Rissanen --- doc/build/kconfig/preprocessor-functions.rst | 11 ----- scripts/kconfig/kconfigfunctions.py | 35 ++----------- tests/kconfig/functions/Kconfig | 52 ++++++++++---------- tests/kconfig/functions/src/main.c | 4 +- 4 files changed, 32 insertions(+), 70 deletions(-) diff --git a/doc/build/kconfig/preprocessor-functions.rst b/doc/build/kconfig/preprocessor-functions.rst index e3ed5f406366..9de5110bfdbc 100644 --- a/doc/build/kconfig/preprocessor-functions.rst +++ b/doc/build/kconfig/preprocessor-functions.rst @@ -81,29 +81,18 @@ Integer functions The functions listed below can be used to do arithmetic operations on integer variables, such as addition, subtraction and more. -Functions with and without the ``_hex`` suffix in their names -return hexadecimal and decimal values respectively. .. code-block:: none $(add,[,value]...) - $(add_hex,[,value]...) $(dec,[,value]...) - $(dec_hex,[,value]...) $(div,[,value]...) - $(div_hex,[,value]...) $(inc,[,value]...) - $(inc_hex,[,value]...) $(max,[,value]...) - $(max_hex,[,value]...) $(min,[,value]...) - $(min_hex,[,value]...) $(mod,[,value]...) - $(mod_hex,[,value]...) $(mul,[,value]...) - $(mul_hex,[,value]...) $(sub,[,value]...) - $(sub_hex,[,value]...) String functions diff --git a/scripts/kconfig/kconfigfunctions.py b/scripts/kconfig/kconfigfunctions.py index 4b42ce30cef4..ce4ce2aa6c28 100644 --- a/scripts/kconfig/kconfigfunctions.py +++ b/scripts/kconfig/kconfigfunctions.py @@ -983,8 +983,8 @@ def arith(kconf, name, *args): the operation on the first two arguments and operates the same operation as the result and the following argument. For interoperability with inc and dec, - each argument can be a single number or a comma-separated list of numbers, - but all numbers are processed as if they were individual arguments. + if there is only one argument, it will be split with a comma and processed + as a sequence of numbers. Examples in Kconfig: @@ -1008,36 +1008,22 @@ def arith(kconf, name, *args): $(div, $(dec, 1, 1)) # Error (0 div 0) """ - intarray = (int(val, base=0) for arg in args for val in arg.split(",")) + intarray = map(int, args if len(args) > 1 else args[0].split(",")) if name == "add": return str(int(functools.reduce(operator.add, intarray))) - elif name == "add_hex": - return hex(int(functools.reduce(operator.add, intarray))) elif name == "sub": return str(int(functools.reduce(operator.sub, intarray))) - elif name == "sub_hex": - return hex(int(functools.reduce(operator.sub, intarray))) elif name == "mul": return str(int(functools.reduce(operator.mul, intarray))) - elif name == "mul_hex": - return hex(int(functools.reduce(operator.mul, intarray))) elif name == "div": return str(int(functools.reduce(operator.truediv, intarray))) - elif name == "div_hex": - return hex(int(functools.reduce(operator.truediv, intarray))) elif name == "mod": return str(int(functools.reduce(operator.mod, intarray))) - elif name == "mod_hex": - return hex(int(functools.reduce(operator.mod, intarray))) elif name == "max": return str(int(functools.reduce(max, intarray))) - elif name == "max_hex": - return hex(int(functools.reduce(max, intarray))) elif name == "min": return str(int(functools.reduce(min, intarray))) - elif name == "min_hex": - return hex(int(functools.reduce(min, intarray))) else: assert False @@ -1048,16 +1034,12 @@ def inc_dec(kconf, name, *args): Returns a string that concatenates numbers with a comma as a separator. """ - intarray = (int(val, base=0) for arg in args for val in arg.split(",")) + intarray = map(int, args if len(args) > 1 else args[0].split(",")) if name == "inc": return ",".join(map(lambda a: str(a + 1), intarray)) - if name == "inc_hex": - return ",".join(map(lambda a: hex(a + 1), intarray)) elif name == "dec": return ",".join(map(lambda a: str(a - 1), intarray)) - elif name == "dec_hex": - return ",".join(map(lambda a: hex(a - 1), intarray)) else: assert False @@ -1124,21 +1106,12 @@ def inc_dec(kconf, name, *args): "shields_list_contains": (shields_list_contains, 1, 1), "substring": (substring, 2, 3), "add": (arith, 1, 255), - "add_hex": (arith, 1, 255), "sub": (arith, 1, 255), - "sub_hex": (arith, 1, 255), "mul": (arith, 1, 255), - "mul_hex": (arith, 1, 255), "div": (arith, 1, 255), - "div_hex": (arith, 1, 255), "mod": (arith, 1, 255), - "mod_hex": (arith, 1, 255), "max": (arith, 1, 255), - "max_hex": (arith, 1, 255), "min": (arith, 1, 255), - "min_hex": (arith, 1, 255), "inc": (inc_dec, 1, 255), - "inc_hex": (inc_dec, 1, 255), "dec": (inc_dec, 1, 255), - "dec_hex": (inc_dec, 1, 255), } diff --git a/tests/kconfig/functions/Kconfig b/tests/kconfig/functions/Kconfig index 1e46730c98a0..50868eb7b6ae 100644 --- a/tests/kconfig/functions/Kconfig +++ b/tests/kconfig/functions/Kconfig @@ -6,60 +6,60 @@ config KCONFIG_ARITHMETIC_ADD_10 default $(add, 10) config KCONFIG_ARITHMETIC_ADD_10_3 - hex - default $(add_hex, 10, 3) + int + default $(add, 10, 3) config KCONFIG_ARITHMETIC_ADD_10_3_2 int - default $(add, 0xa, 3, 0b10) + default $(add, 10, 3, 2) config KCONFIG_ARITHMETIC_SUB_10 int default $(sub, 10) config KCONFIG_ARITHMETIC_SUB_10_3 - hex - default $(sub_hex, 10, 3) + int + default $(sub, 10, 3) config KCONFIG_ARITHMETIC_SUB_10_3_2 int - default $(sub, 0xa, 3, 0b10) + default $(sub, 10, 3, 2) config KCONFIG_ARITHMETIC_MUL_10 int default $(mul, 10) config KCONFIG_ARITHMETIC_MUL_10_3 - hex - default $(mul_hex, 10, 3) + int + default $(mul, 10, 3) config KCONFIG_ARITHMETIC_MUL_10_3_2 int - default $(mul, 0xa, 3, 0b10) + default $(mul, 10, 3, 2) config KCONFIG_ARITHMETIC_DIV_10 int default $(div, 10) config KCONFIG_ARITHMETIC_DIV_10_3 - hex - default $(div_hex, 10, 3) + int + default $(div, 10, 3) config KCONFIG_ARITHMETIC_DIV_10_3_2 int - default $(div, 0xa, 3, 0b10) + default $(div, 10, 3, 2) config KCONFIG_ARITHMETIC_MOD_10 int default $(mod, 10) config KCONFIG_ARITHMETIC_MOD_10_3 - hex - default $(mod_hex, 10, 3) + int + default $(mod, 10, 3) config KCONFIG_ARITHMETIC_MOD_10_3_2 int - default $(mod, 0xa, 3, 0b10) + default $(mod, 10, 3, 2) config KCONFIG_ARITHMETIC_INC_1 int @@ -67,11 +67,11 @@ config KCONFIG_ARITHMETIC_INC_1 config KCONFIG_ARITHMETIC_INC_1_1 string - default "$(inc_hex, 1, 1)" + default "$(inc, 1, 1)" config KCONFIG_ARITHMETIC_INC_INC_1_1 string - default "$(inc, $(inc_hex, 0x1, 0b1))" + default "$(inc, $(inc, 1, 1))" config KCONFIG_ARITHMETIC_DEC_1 int @@ -79,38 +79,38 @@ config KCONFIG_ARITHMETIC_DEC_1 config KCONFIG_ARITHMETIC_DEC_1_1 string - default "$(dec_hex, 1, 1)" + default "$(dec, 1, 1)" config KCONFIG_ARITHMETIC_DEC_DEC_1_1 string - default "$(dec, $(dec_hex, 0x1, 0b1))" + default "$(dec, $(dec, 1, 1))" config KCONFIG_ARITHMETIC_ADD_INC_1_1 int - default $(add, $(inc_hex, 1, 1)) + default $(add, $(inc, 1, 1)) config KCONFIG_MIN_10 int default $(min, 10) config KCONFIG_MIN_10_3 - hex - default $(min_hex, 10, 3) + int + default $(min, 10, 3) config KCONFIG_MIN_10_3_2 int - default $(min, 0xa, 3, 0b10) + default $(min, 10, 3, 2) config KCONFIG_MAX_10 int default $(max, 10) config KCONFIG_MAX_10_3 - hex - default $(max_hex, 10, 3) + int + default $(max, 10, 3) config KCONFIG_MAX_10_3_2 int - default $(max, 0xa, 3, 0b10) + default $(max, 10, 3, 2) source "Kconfig.zephyr" diff --git a/tests/kconfig/functions/src/main.c b/tests/kconfig/functions/src/main.c index 7492e3b5b93a..39962c2a4f8c 100644 --- a/tests/kconfig/functions/src/main.c +++ b/tests/kconfig/functions/src/main.c @@ -27,10 +27,10 @@ ZTEST(test_kconfig_functions, test_arithmetic) zassert_equal(CONFIG_KCONFIG_ARITHMETIC_MOD_10_3, 10 % 3); zassert_equal(CONFIG_KCONFIG_ARITHMETIC_MOD_10_3_2, 10 % 3 % 2); zassert_equal(CONFIG_KCONFIG_ARITHMETIC_INC_1, 1 + 1); - zassert_str_equal(CONFIG_KCONFIG_ARITHMETIC_INC_1_1, "0x2,0x2"); + zassert_str_equal(CONFIG_KCONFIG_ARITHMETIC_INC_1_1, "2,2"); zassert_str_equal(CONFIG_KCONFIG_ARITHMETIC_INC_INC_1_1, "3,3"); zassert_equal(CONFIG_KCONFIG_ARITHMETIC_DEC_1, 1 - 1); - zassert_str_equal(CONFIG_KCONFIG_ARITHMETIC_DEC_1_1, "0x0,0x0"); + zassert_str_equal(CONFIG_KCONFIG_ARITHMETIC_DEC_1_1, "0,0"); zassert_str_equal(CONFIG_KCONFIG_ARITHMETIC_DEC_DEC_1_1, "-1,-1"); zassert_equal(CONFIG_KCONFIG_ARITHMETIC_ADD_INC_1_1, (1 + 1) + (1 + 1)); } From 8097e84203ca2b6f890dce10fae41bd99e077772 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:07 +0300 Subject: [PATCH 1490/2141] Revert "[nrf fromlist] soc: nordic: nrf54l: add Kconfig to control whether to apply Errata 56" This reverts commit f328a81a2b2200142aa352824a5eb9e009cfca8a. Signed-off-by: Jukka Rissanen --- modules/hal_nordic/nrfx/CMakeLists.txt | 1 - soc/nordic/nrf54l/Kconfig | 6 ------ 2 files changed, 7 deletions(-) diff --git a/modules/hal_nordic/nrfx/CMakeLists.txt b/modules/hal_nordic/nrfx/CMakeLists.txt index 5d7b4d942b3b..d1972356fccf 100644 --- a/modules/hal_nordic/nrfx/CMakeLists.txt +++ b/modules/hal_nordic/nrfx/CMakeLists.txt @@ -197,7 +197,6 @@ endif() zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54LX_SKIP_CLOCK_CONFIG NRF_SKIP_CLOCK_CONFIGURATION) zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54LX_DISABLE_FICR_TRIMCNF NRF_DISABLE_FICR_TRIMCNF) zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54LX_SKIP_GLITCHDETECTOR_DISABLE NRF_SKIP_GLITCHDETECTOR_DISABLE) -zephyr_compile_definitions_ifndef(CONFIG_SOC_NRF54L_ANOMALY_56_WORKAROUND NRF54L_CONFIGURATION_56_ENABLE=0) # Inject code to skip TAMPC setup for nRF54L20 and nRF54L09. It is not supported for now. # It needs to be removed when support is provided. diff --git a/soc/nordic/nrf54l/Kconfig b/soc/nordic/nrf54l/Kconfig index 19131154b5bb..6dc5e9f13cd3 100644 --- a/soc/nordic/nrf54l/Kconfig +++ b/soc/nordic/nrf54l/Kconfig @@ -84,10 +84,4 @@ config SOC_NRF_FORCE_CONSTLAT of base resources on while in sleep. The advantage of having a constant and predictable latency will be at the cost of having increased power consumption. -config SOC_NRF54L_ANOMALY_56_WORKAROUND - bool "Apply workaround 56 for nRF54L SoCs" - default y - help - This option enables configuration workaround 56 for nRF54L Series SoCs. - endif # SOC_SERIES_NRF54LX From f023e811fa6c8409cdab93e06c309798adf8adda Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:07 +0300 Subject: [PATCH 1491/2141] Revert "[nrf fromtree] drivers: nrfx: help select clock control when needed" This reverts commit fb23f7c4c115395816a466fdbad37663b62e1349. Signed-off-by: Jukka Rissanen --- drivers/counter/Kconfig.nrfx | 3 +-- drivers/serial/Kconfig.nrfx | 7 ------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/counter/Kconfig.nrfx b/drivers/counter/Kconfig.nrfx index ed02411de261..775406a5198c 100644 --- a/drivers/counter/Kconfig.nrfx +++ b/drivers/counter/Kconfig.nrfx @@ -12,8 +12,7 @@ config COUNTER_NRF_RTC config COUNTER_NRFX_TIMER_USE_CLOCK_CONTROL def_bool y depends on $(dt_nodelabel_enabled,timer120) || \ - $(dt_nodelabel_enabled,timer121) - depends on !SOC_NRF54H20_CPUFLPR && !SOC_NRF54H20_CPUPPR + $(dt_nodelabel_enabled,timer121) select CLOCK_CONTROL # Internal flag which detects if PPI wrap feature is enabled for any instance diff --git a/drivers/serial/Kconfig.nrfx b/drivers/serial/Kconfig.nrfx index f91980c058b5..0bac5150a24b 100644 --- a/drivers/serial/Kconfig.nrfx +++ b/drivers/serial/Kconfig.nrfx @@ -28,13 +28,6 @@ config UART_NRFX_UARTE imply NRFX_UARTE_CONFIG_SKIP_PSEL_CONFIG if !UART_NRFX_UARTE_LEGACY_SHIM imply NRFX_UARTE_CONFIG_SKIP_GPIO_CONFIG if !UART_NRFX_UARTE_LEGACY_SHIM -config UART_NRFX_UARTE_USE_CLOCK_CONTROL - def_bool y - depends on UART_NRFX_UARTE - depends on $(dt_nodelabel_enabled,uart120) - depends on !SOC_NRF54H20_CPUFLPR && !SOC_NRF54H20_CPUPPR - select CLOCK_CONTROL - config UART_NRFX_UARTE_NO_IRQ bool "Polling without interrupt" depends on UART_NRFX_UARTE From 45e3ccd1c6d2cc39cda09ed790257dde4e139eda Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:07 +0300 Subject: [PATCH 1492/2141] Revert "[nrf fromtree] dts: vendor: nordic: nrf54h20.dtsi: disable cpurad_hsfll" This reverts commit 2322f1f389d4ae9039438f41def0ea175ce017f3. Signed-off-by: Jukka Rissanen --- dts/vendor/nordic/nrf54h20.dtsi | 1 - 1 file changed, 1 deletion(-) diff --git a/dts/vendor/nordic/nrf54h20.dtsi b/dts/vendor/nordic/nrf54h20.dtsi index c12ea5f1ead5..37a6a3f394bb 100644 --- a/dts/vendor/nordic/nrf54h20.dtsi +++ b/dts/vendor/nordic/nrf54h20.dtsi @@ -336,7 +336,6 @@ compatible = "nordic,nrf-hsfll-local"; #clock-cells = <0>; reg = <0xd000 0x1000>; - status = "disabled"; clocks = <&fll16m>; clock-frequency = ; nordic,ficrs = From 6311442f39a4bcbe2b0580303f0560d8e9a90da8 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:07 +0300 Subject: [PATCH 1493/2141] Revert "[nrf fromtree] drivers: serial: nrfx_uarte: assert clock control enabled" This reverts commit 69ba6b5cc9cb0293ec29d401528c3ed7cbdc172f. Signed-off-by: Jukka Rissanen --- drivers/serial/uart_nrfx_uarte.c | 5 ++--- .../uart_async_dual/boards/nrf54h20dk_nrf54h20_cpuapp.conf | 1 - 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/serial/uart_nrfx_uarte.c b/drivers/serial/uart_nrfx_uarte.c index 46c5a8b83d2e..80e296cc51d2 100644 --- a/drivers/serial/uart_nrfx_uarte.c +++ b/drivers/serial/uart_nrfx_uarte.c @@ -129,11 +129,10 @@ LOG_MODULE_REGISTER(uart_nrfx_uarte, CONFIG_UART_LOG_LEVEL); (0))), (0)) #if UARTE_FOR_EACH_INSTANCE(INSTANCE_IS_FAST_PD, (||), (0)) -/* Instance in fast power domain (PD) requires special PM treatment and clock control, so - * device runtime PM and clock control must be enabled. +/* Instance in fast power domain (PD) requires special PM treatment so device runtime PM must + * be enabled. */ BUILD_ASSERT(IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)); -BUILD_ASSERT(IS_ENABLED(CONFIG_CLOCK_CONTROL)); #define UARTE_ANY_FAST_PD 1 #endif #endif diff --git a/tests/drivers/uart/uart_async_dual/boards/nrf54h20dk_nrf54h20_cpuapp.conf b/tests/drivers/uart/uart_async_dual/boards/nrf54h20dk_nrf54h20_cpuapp.conf index 6dffc1fe4e19..74cc8d7691e1 100644 --- a/tests/drivers/uart/uart_async_dual/boards/nrf54h20dk_nrf54h20_cpuapp.conf +++ b/tests/drivers/uart/uart_async_dual/boards/nrf54h20dk_nrf54h20_cpuapp.conf @@ -1,3 +1,2 @@ CONFIG_PM_DEVICE=y CONFIG_PM_DEVICE_RUNTIME=y -CONFIG_CLOCK_CONTROL=y From ebdfb0276dd559abf7052d6ba5ace6421953c196 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:07 +0300 Subject: [PATCH 1494/2141] Revert "[nrf fromtree] drivers: serial: nrfx: remove deprecated config" This reverts commit 6e376b0661c92c7b629d6a24ee4b805005a26cc9. Signed-off-by: Jukka Rissanen --- drivers/serial/Kconfig.nrfx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/serial/Kconfig.nrfx b/drivers/serial/Kconfig.nrfx index 0bac5150a24b..3fb1f0fd1203 100644 --- a/drivers/serial/Kconfig.nrfx +++ b/drivers/serial/Kconfig.nrfx @@ -135,6 +135,11 @@ rsource "Kconfig.nrfx_uart_instance" endif if HAS_HW_NRF_UARTE120 + +config UART_NRFX_UARTE_USE_CLOCK_CONTROL + def_bool y + select CLOCK_CONTROL + nrfx_uart_num = 120 rsource "Kconfig.nrfx_uart_instance" endif From 350a24df6bd875df88c24423d2f6cd1067ccbdcb Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:07 +0300 Subject: [PATCH 1495/2141] Revert "[nrf fromtree] drivers: clock_control: nrf2: split configs per driver" This reverts commit 1b2f57c6d8db7a638012805108681ae949cb3752. Signed-off-by: Jukka Rissanen --- drivers/clock_control/CMakeLists.txt | 13 +-- drivers/clock_control/Kconfig.nrf | 83 ++++++------------- .../clock_control_nrf_hsfll_local.c | 2 +- .../drivers/clock_control/nrf_clock_control.h | 5 ++ .../platform/nrf_802154_clock_zephyr.c | 3 +- 5 files changed, 41 insertions(+), 65 deletions(-) diff --git a/drivers/clock_control/CMakeLists.txt b/drivers/clock_control/CMakeLists.txt index b1dbe1911975..bc70784ebecd 100644 --- a/drivers/clock_control/CMakeLists.txt +++ b/drivers/clock_control/CMakeLists.txt @@ -49,11 +49,14 @@ zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF_HSFLL_GLOBAL clock_cont zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_RTS5912_SCCON clock_control_rts5912_sccon.c) zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRFS_AUDIOPLL clock_control_nrfs_audiopll.c) zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_IT51XXX clock_control_it51xxx.c) -zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF2_COMMON clock_control_nrf2_common.c) -zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF_FLL16M clock_control_nrf_fll16m.c) -zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF54H_HFXO clock_control_nrf54h_hfxo.c) -zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF_HSFLL_LOCAL clock_control_nrf_hsfll_local.c) -zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF_LFCLK clock_control_nrf_lfclk.c) + +if(CONFIG_CLOCK_CONTROL_NRF2) + zephyr_library_sources(clock_control_nrf2_common.c) + zephyr_library_sources(clock_control_nrf_fll16m.c) + zephyr_library_sources(clock_control_nrf54h_hfxo.c) + zephyr_library_sources(clock_control_nrf_hsfll_local.c) + zephyr_library_sources(clock_control_nrf_lfclk.c) +endif() if(CONFIG_CLOCK_CONTROL_RENESAS_RZA2M_CPG) zephyr_library_sources(clock_control_renesas_rza2m_cpg.c) diff --git a/drivers/clock_control/Kconfig.nrf b/drivers/clock_control/Kconfig.nrf index bbd4a86f5a9b..a1b61e941a46 100644 --- a/drivers/clock_control/Kconfig.nrf +++ b/drivers/clock_control/Kconfig.nrf @@ -201,16 +201,34 @@ config CLOCK_CONTROL_NRF_ACCURACY endif # CLOCK_CONTROL_NRF -config CLOCK_CONTROL_NRF2_COMMON - bool "NRF2 clock control common framework" +config CLOCK_CONTROL_NRF2 + bool "nRF clock control support" + default y + depends on SOC_SERIES_NRF54HX && !RISCV_CORE_NORDIC_VPR select ONOFF + select NRFS if HAS_NRFS + help + Support for nRF clock control devices. + +if CLOCK_CONTROL_NRF2 + +config CLOCK_CONTROL_NRF_HSFLL_LOCAL_REQ_LOW_FREQ + bool "Local domain scale down after init" + default y if NRFS_DVFS_LOCAL_DOMAIN + help + Request the lowest operating point after DVFS initialization. + +config CLOCK_CONTROL_NRF_HSFLL_LOCAL_NRFS_DVFS_TIMEOUT_MS + int "Timeout waiting for nrfs dvfs service callback in milliseconds" + default 2000 + +config CLOCK_CONTROL_NRF_LFCLK_CLOCK_TIMEOUT_MS + int "Timeout waiting for nrfs clock service callback in milliseconds" + default 1000 config CLOCK_CONTROL_NRF_HSFLL_GLOBAL bool "Clock control for global HSFLL" - depends on DT_HAS_NORDIC_NRF_HSFLL_GLOBAL_ENABLED - select NRFS - select NRFS_GDFS_SERVICE_ENABLED - select CLOCK_CONTROL_NRF2_COMMON + depends on NRFS_GDFS_SERVICE_ENABLED default y if CLOCK_CONTROL_NRF_HSFLL_GLOBAL @@ -244,56 +262,7 @@ endif # CLOCK_CONTROL_NRF_HSFLL_GLOBAL config CLOCK_CONTROL_NRFS_AUDIOPLL bool "NRFS AudioPLL driver support" depends on DT_HAS_NORDIC_NRFS_AUDIOPLL_ENABLED - select NRFS - select NRFS_AUDIOPLL_SERVICE_ENABLED - select CLOCK_CONTROL_NRF2_COMMON - default y - -config CLOCK_CONTROL_NRF_FLL16M - bool "NRF FLL16M driver support" - depends on DT_HAS_NORDIC_NRF_FLL16M_ENABLED - select CLOCK_CONTROL_NRF2_COMMON - default y - -config CLOCK_CONTROL_NRF54H_HFXO - bool "NRF54H HFXO driver support" - depends on DT_HAS_NORDIC_NRF54H_HFXO_ENABLED - select CLOCK_CONTROL_NRF2_COMMON + depends on NRFS_AUDIOPLL_SERVICE_ENABLED default y -config CLOCK_CONTROL_NRF_HSFLL_LOCAL - bool "NRF HSFLL LOCAL driver support" - depends on DT_HAS_NORDIC_NRF_HSFLL_LOCAL_ENABLED - select NRFS - select NRFS_DVFS_LOCAL_DOMAIN - select CLOCK_CONTROL_NRF2_COMMON - default y - -if CLOCK_CONTROL_NRF_HSFLL_LOCAL - -config CLOCK_CONTROL_NRF_HSFLL_LOCAL_REQ_LOW_FREQ - bool "Local domain scale down after init" - help - Request the lowest operating point after DVFS initialization. - -config CLOCK_CONTROL_NRF_HSFLL_LOCAL_NRFS_DVFS_TIMEOUT_MS - int "Timeout waiting for nrfs dvfs service callback in milliseconds" - default 2000 - -endif # CLOCK_CONTROL_NRF_HSFLL_LOCAL - -config CLOCK_CONTROL_NRF_LFCLK - bool "NRF LFCLK driver support" - depends on DT_HAS_NORDIC_NRF_LFCLK_ENABLED - select NRFS - select NRFS_CLOCK_SERVICE_ENABLED - select CLOCK_CONTROL_NRF2_COMMON - default y - -if CLOCK_CONTROL_NRF_LFCLK - -config CLOCK_CONTROL_NRF_LFCLK_CLOCK_TIMEOUT_MS - int "Timeout waiting for nrfs clock service callback in milliseconds" - default 1000 - -endif # CLOCK_CONTROL_NRF_LFCLK +endif # CLOCK_CONTROL_NRF2 diff --git a/drivers/clock_control/clock_control_nrf_hsfll_local.c b/drivers/clock_control/clock_control_nrf_hsfll_local.c index 942f16ed4447..ab2cab3b9203 100644 --- a/drivers/clock_control/clock_control_nrf_hsfll_local.c +++ b/drivers/clock_control/clock_control_nrf_hsfll_local.c @@ -259,7 +259,7 @@ static DEVICE_API(nrf_clock_control, hsfll_drv_api) = { static struct hsfll_dev_data hsfll_data; #endif -#ifdef CONFIG_CLOCK_CONTROL_NRF_HSFLL_LOCAL_REQ_LOW_FREQ +#ifdef CONFIG_CLOCK_CONTROL_NRF2_HSFLL_REQ_LOW_FREQ static int dvfs_low_init(void) { static const k_timeout_t timeout = NRFS_DVFS_TIMEOUT; diff --git a/include/zephyr/drivers/clock_control/nrf_clock_control.h b/include/zephyr/drivers/clock_control/nrf_clock_control.h index f407be61d4db..7ef524dd4dc9 100644 --- a/include/zephyr/drivers/clock_control/nrf_clock_control.h +++ b/include/zephyr/drivers/clock_control/nrf_clock_control.h @@ -171,6 +171,9 @@ uint32_t z_nrf_clock_bt_ctlr_hf_get_startup_time_us(void); #endif /* defined(CONFIG_CLOCK_CONTROL_NRF) */ + +#if defined(CONFIG_CLOCK_CONTROL_NRF2) + /* Specifies to use the maximum available frequency for a given clock. */ #define NRF_CLOCK_CONTROL_FREQUENCY_MAX UINT32_MAX @@ -399,6 +402,8 @@ void nrf_clock_control_hfxo_request(void); */ void nrf_clock_control_hfxo_release(void); +#endif /* defined(CONFIG_CLOCK_CONTROL_NRF2) */ + #ifdef __cplusplus } #endif diff --git a/modules/hal_nordic/nrf_802154/sl_opensource/platform/nrf_802154_clock_zephyr.c b/modules/hal_nordic/nrf_802154/sl_opensource/platform/nrf_802154_clock_zephyr.c index 1dcf724b0e52..1ade977118e1 100644 --- a/modules/hal_nordic/nrf_802154/sl_opensource/platform/nrf_802154_clock_zephyr.c +++ b/modules/hal_nordic/nrf_802154/sl_opensource/platform/nrf_802154_clock_zephyr.c @@ -88,8 +88,7 @@ void nrf_802154_clock_hfclk_stop(void) hfclk_is_running = false; } -#elif DT_NODE_HAS_STATUS(DT_NODELABEL(hfxo), okay) && \ - DT_NODE_HAS_COMPAT(DT_NODELABEL(hfxo), nordic_nrf54h_hfxo) +#elif defined(CONFIG_CLOCK_CONTROL_NRF2) void nrf_802154_clock_hfclk_start(void) { From 47b2c6f0e09c7ea269b1249d895732af27cb359f Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:07 +0300 Subject: [PATCH 1496/2141] Revert "[nrf fromtree] drivers: clock_control: nrf2: align with hw binding names" This reverts commit ac70df046a1e7004f4482dce95c3bf0ac4dc0b19. Signed-off-by: Jukka Rissanen --- drivers/audio/dmic_nrfx_pdm.c | 8 ++++---- drivers/clock_control/CMakeLists.txt | 12 +++++------ drivers/clock_control/Kconfig.nrf | 20 +++++++++---------- ...diopll.c => clock_control_nrf2_audiopll.c} | 0 ...f_fll16m.c => clock_control_nrf2_fll16m.c} | 0 ...al.c => clock_control_nrf2_global_hsfll.c} | 6 +++--- ...rf54h_hfxo.c => clock_control_nrf2_hfxo.c} | 0 ...fll_local.c => clock_control_nrf2_hsfll.c} | 4 ++-- ...nrf_lfclk.c => clock_control_nrf2_lfclk.c} | 2 +- drivers/counter/counter_nrfx_timer.c | 2 +- drivers/i2s/i2s_nrf_tdm.c | 4 ++-- drivers/pwm/pwm_nrfx.c | 8 ++++---- drivers/serial/uart_nrfx_uarte.c | 2 +- drivers/spi/spi_nrfx_spim.c | 8 ++++---- .../boards/nordic/clock_control/sample.yaml | 2 +- 15 files changed, 39 insertions(+), 39 deletions(-) rename drivers/clock_control/{clock_control_nrfs_audiopll.c => clock_control_nrf2_audiopll.c} (100%) rename drivers/clock_control/{clock_control_nrf_fll16m.c => clock_control_nrf2_fll16m.c} (100%) rename drivers/clock_control/{clock_control_nrf_hsfll_global.c => clock_control_nrf2_global_hsfll.c} (98%) rename drivers/clock_control/{clock_control_nrf54h_hfxo.c => clock_control_nrf2_hfxo.c} (100%) rename drivers/clock_control/{clock_control_nrf_hsfll_local.c => clock_control_nrf2_hsfll.c} (97%) rename drivers/clock_control/{clock_control_nrf_lfclk.c => clock_control_nrf2_lfclk.c} (99%) diff --git a/drivers/audio/dmic_nrfx_pdm.c b/drivers/audio/dmic_nrfx_pdm.c index b2fcb7abb868..2e8d71b0a93c 100644 --- a/drivers/audio/dmic_nrfx_pdm.c +++ b/drivers/audio/dmic_nrfx_pdm.c @@ -30,7 +30,7 @@ struct dmic_nrfx_pdm_drv_data { const nrfx_pdm_t *pdm; #if CONFIG_CLOCK_CONTROL_NRF struct onoff_manager *clk_mgr; -#elif CONFIG_CLOCK_CONTROL_NRFS_AUDIOPLL +#elif CONFIG_CLOCK_CONTROL_NRF2_AUDIOPLL const struct device *audiopll_dev; #endif struct onoff_client clk_cli; @@ -75,7 +75,7 @@ static int request_clock(struct dmic_nrfx_pdm_drv_data *drv_data) } #if CONFIG_CLOCK_CONTROL_NRF return onoff_request(drv_data->clk_mgr, &drv_data->clk_cli); -#elif CONFIG_CLOCK_CONTROL_NRFS_AUDIOPLL +#elif CONFIG_CLOCK_CONTROL_NRF2_AUDIOPLL return nrf_clock_control_request(drv_data->audiopll_dev, NULL, &drv_data->clk_cli); #else return -ENOTSUP; @@ -90,7 +90,7 @@ static int release_clock(struct dmic_nrfx_pdm_drv_data *drv_data) #if CONFIG_CLOCK_CONTROL_NRF return onoff_release(drv_data->clk_mgr); -#elif CONFIG_CLOCK_CONTROL_NRFS_AUDIOPLL +#elif CONFIG_CLOCK_CONTROL_NRF2_AUDIOPLL return nrf_clock_control_release(drv_data->audiopll_dev, NULL); #else return -ENOTSUP; @@ -673,7 +673,7 @@ static void init_clock_manager(const struct device *dev) drv_data->clk_mgr = z_nrf_clock_control_get_onoff(subsys); __ASSERT_NO_MSG(drv_data->clk_mgr != NULL); -#elif CONFIG_CLOCK_CONTROL_NRFS_AUDIOPLL +#elif CONFIG_CLOCK_CONTROL_NRF2_AUDIOPLL struct dmic_nrfx_pdm_drv_data *drv_data = dev->data; drv_data->audiopll_dev = DEVICE_DT_GET(DT_NODELABEL(audiopll)); diff --git a/drivers/clock_control/CMakeLists.txt b/drivers/clock_control/CMakeLists.txt index bc70784ebecd..886c92b63578 100644 --- a/drivers/clock_control/CMakeLists.txt +++ b/drivers/clock_control/CMakeLists.txt @@ -45,17 +45,17 @@ zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_RENESAS_RZ_CPG clock_cont zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_AMBIQ clock_control_ambiq.c) zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_PWM clock_control_pwm.c) zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_RPI_PICO clock_control_rpi_pico.c) -zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF_HSFLL_GLOBAL clock_control_nrf_hsfll_global.c) +zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF2_GLOBAL_HSFLL clock_control_nrf2_global_hsfll.c) zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_RTS5912_SCCON clock_control_rts5912_sccon.c) -zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRFS_AUDIOPLL clock_control_nrfs_audiopll.c) +zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF2_AUDIOPLL clock_control_nrf2_audiopll.c) zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_IT51XXX clock_control_it51xxx.c) if(CONFIG_CLOCK_CONTROL_NRF2) zephyr_library_sources(clock_control_nrf2_common.c) - zephyr_library_sources(clock_control_nrf_fll16m.c) - zephyr_library_sources(clock_control_nrf54h_hfxo.c) - zephyr_library_sources(clock_control_nrf_hsfll_local.c) - zephyr_library_sources(clock_control_nrf_lfclk.c) + zephyr_library_sources(clock_control_nrf2_fll16m.c) + zephyr_library_sources(clock_control_nrf2_hfxo.c) + zephyr_library_sources(clock_control_nrf2_hsfll.c) + zephyr_library_sources(clock_control_nrf2_lfclk.c) endif() if(CONFIG_CLOCK_CONTROL_RENESAS_RZA2M_CPG) diff --git a/drivers/clock_control/Kconfig.nrf b/drivers/clock_control/Kconfig.nrf index a1b61e941a46..07ee365603b6 100644 --- a/drivers/clock_control/Kconfig.nrf +++ b/drivers/clock_control/Kconfig.nrf @@ -212,32 +212,32 @@ config CLOCK_CONTROL_NRF2 if CLOCK_CONTROL_NRF2 -config CLOCK_CONTROL_NRF_HSFLL_LOCAL_REQ_LOW_FREQ +config CLOCK_CONTROL_NRF2_HSFLL_REQ_LOW_FREQ bool "Local domain scale down after init" default y if NRFS_DVFS_LOCAL_DOMAIN help Request the lowest operating point after DVFS initialization. -config CLOCK_CONTROL_NRF_HSFLL_LOCAL_NRFS_DVFS_TIMEOUT_MS +config CLOCK_CONTROL_NRF2_NRFS_DVFS_TIMEOUT_MS int "Timeout waiting for nrfs dvfs service callback in milliseconds" default 2000 -config CLOCK_CONTROL_NRF_LFCLK_CLOCK_TIMEOUT_MS +config CLOCK_CONTROL_NRF2_NRFS_CLOCK_TIMEOUT_MS int "Timeout waiting for nrfs clock service callback in milliseconds" default 1000 -config CLOCK_CONTROL_NRF_HSFLL_GLOBAL +config CLOCK_CONTROL_NRF2_GLOBAL_HSFLL bool "Clock control for global HSFLL" depends on NRFS_GDFS_SERVICE_ENABLED default y -if CLOCK_CONTROL_NRF_HSFLL_GLOBAL +if CLOCK_CONTROL_NRF2_GLOBAL_HSFLL -config CLOCK_CONTROL_NRF_HSFLL_GLOBAL_TIMEOUT_MS +config CLOCK_CONTROL_NRF2_GLOBAL_HSFLL_TIMEOUT_MS int "Frequency request timeout in milliseconds" default 10000 -config CLOCK_CONTROL_NRF_HSFLL_GLOBAL_REQ_LOW_FREQ +config CLOCK_CONTROL_NRF2_GLOBAL_HSFLL_REQ_LOW_FREQ bool "Request LOW frequency on init" default y help @@ -251,15 +251,15 @@ config CLOCK_CONTROL_NRF_HSFLL_GLOBAL_REQ_LOW_FREQ unnecessary HIGH -> LOW -> HIGH cycle given some module will request a HIGH frequency on init anyway. -config CLOCK_CONTROL_NRF_HSFLL_GLOBAL_INIT_PRIORITY +config CLOCK_CONTROL_NRF2_GLOBAL_HSFLL_INIT_PRIORITY int "Init priority of global HSFLL device driver" default 52 help Must be higher than NRFS backend -endif # CLOCK_CONTROL_NRF_HSFLL_GLOBAL +endif # CLOCK_CONTROL_NRF2_GLOBAL_HSFLL -config CLOCK_CONTROL_NRFS_AUDIOPLL +config CLOCK_CONTROL_NRF2_AUDIOPLL bool "NRFS AudioPLL driver support" depends on DT_HAS_NORDIC_NRFS_AUDIOPLL_ENABLED depends on NRFS_AUDIOPLL_SERVICE_ENABLED diff --git a/drivers/clock_control/clock_control_nrfs_audiopll.c b/drivers/clock_control/clock_control_nrf2_audiopll.c similarity index 100% rename from drivers/clock_control/clock_control_nrfs_audiopll.c rename to drivers/clock_control/clock_control_nrf2_audiopll.c diff --git a/drivers/clock_control/clock_control_nrf_fll16m.c b/drivers/clock_control/clock_control_nrf2_fll16m.c similarity index 100% rename from drivers/clock_control/clock_control_nrf_fll16m.c rename to drivers/clock_control/clock_control_nrf2_fll16m.c diff --git a/drivers/clock_control/clock_control_nrf_hsfll_global.c b/drivers/clock_control/clock_control_nrf2_global_hsfll.c similarity index 98% rename from drivers/clock_control/clock_control_nrf_hsfll_global.c rename to drivers/clock_control/clock_control_nrf2_global_hsfll.c index 605b788b5399..30a64ea9fdc2 100644 --- a/drivers/clock_control/clock_control_nrf_hsfll_global.c +++ b/drivers/clock_control/clock_control_nrf2_global_hsfll.c @@ -23,10 +23,10 @@ LOG_MODULE_DECLARE(clock_control_nrf2, CONFIG_CLOCK_CONTROL_LOG_LEVEL); DT_INST_PROP_LEN(0, supported_clock_frequencies) #define GLOBAL_HSFLL_FREQ_REQ_TIMEOUT \ - K_MSEC(CONFIG_CLOCK_CONTROL_NRF_HSFLL_GLOBAL_TIMEOUT_MS) + K_MSEC(CONFIG_CLOCK_CONTROL_NRF2_GLOBAL_HSFLL_TIMEOUT_MS) #define GLOBAL_HSFLL_INIT_LOW_REQ \ - CONFIG_CLOCK_CONTROL_NRF_HSFLL_GLOBAL_REQ_LOW_FREQ + CONFIG_CLOCK_CONTROL_NRF2_GLOBAL_HSFLL_REQ_LOW_FREQ BUILD_ASSERT(GLOBAL_HSFLL_CLOCK_FREQUENCIES_SIZE == 4); BUILD_ASSERT(GLOBAL_HSFLL_CLOCK_FREQUENCIES_IDX(0) == 64000000); @@ -339,6 +339,6 @@ DEVICE_DT_INST_DEFINE( &driver_data, &driver_config, POST_KERNEL, - CONFIG_CLOCK_CONTROL_NRF_HSFLL_GLOBAL_INIT_PRIORITY, + CONFIG_CLOCK_CONTROL_NRF2_GLOBAL_HSFLL_INIT_PRIORITY, &driver_api ); diff --git a/drivers/clock_control/clock_control_nrf54h_hfxo.c b/drivers/clock_control/clock_control_nrf2_hfxo.c similarity index 100% rename from drivers/clock_control/clock_control_nrf54h_hfxo.c rename to drivers/clock_control/clock_control_nrf2_hfxo.c diff --git a/drivers/clock_control/clock_control_nrf_hsfll_local.c b/drivers/clock_control/clock_control_nrf2_hsfll.c similarity index 97% rename from drivers/clock_control/clock_control_nrf_hsfll_local.c rename to drivers/clock_control/clock_control_nrf2_hsfll.c index ab2cab3b9203..e8f8449b24d0 100644 --- a/drivers/clock_control/clock_control_nrf_hsfll_local.c +++ b/drivers/clock_control/clock_control_nrf2_hsfll.c @@ -25,7 +25,7 @@ BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) == 1, #define HSFLL_FREQ_MEDLOW MHZ(128) #define HSFLL_FREQ_HIGH MHZ(320) -#define NRFS_DVFS_TIMEOUT K_MSEC(CONFIG_CLOCK_CONTROL_NRF_HSFLL_LOCAL_NRFS_DVFS_TIMEOUT_MS) +#define NRFS_DVFS_TIMEOUT K_MSEC(CONFIG_CLOCK_CONTROL_NRF2_NRFS_DVFS_TIMEOUT_MS) /* Clock options sorted from lowest to highest frequency */ static const struct clock_options { @@ -262,7 +262,7 @@ static struct hsfll_dev_data hsfll_data; #ifdef CONFIG_CLOCK_CONTROL_NRF2_HSFLL_REQ_LOW_FREQ static int dvfs_low_init(void) { - static const k_timeout_t timeout = NRFS_DVFS_TIMEOUT; + static const k_timeout_t timeout = K_MSEC(CONFIG_CLOCK_CONTROL_NRF2_NRFS_DVFS_TIMEOUT_MS); static const struct device *hsfll_dev = DEVICE_DT_GET(DT_CLOCKS_CTLR(DT_NODELABEL(cpu))); static const struct nrf_clock_spec clk_spec = { .frequency = HSFLL_FREQ_LOW diff --git a/drivers/clock_control/clock_control_nrf_lfclk.c b/drivers/clock_control/clock_control_nrf2_lfclk.c similarity index 99% rename from drivers/clock_control/clock_control_nrf_lfclk.c rename to drivers/clock_control/clock_control_nrf2_lfclk.c index fcdb8bd573bc..6be9deee6576 100644 --- a/drivers/clock_control/clock_control_nrf_lfclk.c +++ b/drivers/clock_control/clock_control_nrf2_lfclk.c @@ -28,7 +28,7 @@ BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) == 1, #define LFCLK_MAX_OPTS 5 #define LFCLK_DEF_OPTS 3 -#define NRFS_CLOCK_TIMEOUT K_MSEC(CONFIG_CLOCK_CONTROL_NRF_LFCLK_CLOCK_TIMEOUT_MS) +#define NRFS_CLOCK_TIMEOUT K_MSEC(CONFIG_CLOCK_CONTROL_NRF2_NRFS_CLOCK_TIMEOUT_MS) #define BICR (NRF_BICR_Type *)DT_REG_ADDR(DT_NODELABEL(bicr)) diff --git a/drivers/counter/counter_nrfx_timer.c b/drivers/counter/counter_nrfx_timer.c index 71f7f7edd331..52e525717a9b 100644 --- a/drivers/counter/counter_nrfx_timer.c +++ b/drivers/counter/counter_nrfx_timer.c @@ -481,7 +481,7 @@ static DEVICE_API(counter, counter_nrfx_driver_api) = { */ #define TIMER_INIT_PRIO(idx) \ COND_CODE_1(INSTANCE_IS_FAST(idx), \ - (UTIL_INC(CONFIG_CLOCK_CONTROL_NRF_HSFLL_GLOBAL_INIT_PRIORITY)), \ + (UTIL_INC(CONFIG_CLOCK_CONTROL_NRF2_GLOBAL_HSFLL_INIT_PRIORITY)), \ (CONFIG_COUNTER_INIT_PRIORITY)) /* diff --git a/drivers/i2s/i2s_nrf_tdm.c b/drivers/i2s/i2s_nrf_tdm.c index f8fa4773d37e..f61c5c8849b1 100644 --- a/drivers/i2s/i2s_nrf_tdm.c +++ b/drivers/i2s/i2s_nrf_tdm.c @@ -127,7 +127,7 @@ static int audio_clock_request(struct tdm_drv_data *drv_data) { #if DT_NODE_HAS_STATUS_OKAY(NODE_ACLK) && CONFIG_CLOCK_CONTROL_NRF return onoff_request(drv_data->clk_mgr, &drv_data->clk_cli); -#elif DT_NODE_HAS_STATUS_OKAY(NODE_ACLK) && CONFIG_CLOCK_CONTROL_NRFS_AUDIOPLL +#elif DT_NODE_HAS_STATUS_OKAY(NODE_ACLK) && CONFIG_CLOCK_CONTROL_NRF2_AUDIOPLL return nrf_clock_control_request(audiopll, &aclk_spec, &drv_data->clk_cli); #else (void)drv_data; @@ -140,7 +140,7 @@ static int audio_clock_release(struct tdm_drv_data *drv_data) { #if DT_NODE_HAS_STATUS_OKAY(NODE_ACLK) && CONFIG_CLOCK_CONTROL_NRF return onoff_release(drv_data->clk_mgr); -#elif DT_NODE_HAS_STATUS_OKAY(NODE_ACLK) && CONFIG_CLOCK_CONTROL_NRFS_AUDIOPLL +#elif DT_NODE_HAS_STATUS_OKAY(NODE_ACLK) && CONFIG_CLOCK_CONTROL_NRF2_AUDIOPLL (void)drv_data; return nrf_clock_control_release(audiopll, &aclk_spec); diff --git a/drivers/pwm/pwm_nrfx.c b/drivers/pwm/pwm_nrfx.c index ec55bef69604..bab8b0f003e7 100644 --- a/drivers/pwm/pwm_nrfx.c +++ b/drivers/pwm/pwm_nrfx.c @@ -55,7 +55,7 @@ LOG_MODULE_REGISTER(pwm_nrfx, CONFIG_PWM_LOG_LEVEL); BUILD_ASSERT(!IS_ENABLED(CONFIG_PM_DEVICE_SYSTEM_MANAGED)); #endif -#if defined(PWM_NRFX_FAST_PRESENT) && CONFIG_CLOCK_CONTROL_NRF_HSFLL_GLOBAL +#if defined(PWM_NRFX_FAST_PRESENT) && CONFIG_CLOCK_CONTROL_NRF2_GLOBAL_HSFLL #define PWM_NRFX_USE_CLOCK_CONTROL 1 #endif @@ -493,11 +493,11 @@ static int pwm_nrfx_init(const struct device *dev) * must be initialized after that controller driver, hence the default PWM * initialization priority may be too early for them. */ -#if defined(CONFIG_CLOCK_CONTROL_NRF_HSFLL_GLOBAL_INIT_PRIORITY) && \ - CONFIG_PWM_INIT_PRIORITY < CONFIG_CLOCK_CONTROL_NRF_HSFLL_GLOBAL_INIT_PRIORITY +#if defined(CONFIG_CLOCK_CONTROL_NRF2_GLOBAL_HSFLL_INIT_PRIORITY) && \ + CONFIG_PWM_INIT_PRIORITY < CONFIG_CLOCK_CONTROL_NRF2_GLOBAL_HSFLL_INIT_PRIORITY #define PWM_INIT_PRIORITY(idx) \ COND_CODE_1(PWM_NRFX_IS_FAST(_, /*empty*/, idx, _), \ - (UTIL_INC(CONFIG_CLOCK_CONTROL_NRF_HSFLL_GLOBAL_INIT_PRIORITY)), \ + (UTIL_INC(CONFIG_CLOCK_CONTROL_NRF2_GLOBAL_HSFLL_INIT_PRIORITY)), \ (CONFIG_PWM_INIT_PRIORITY)) #else #define PWM_INIT_PRIORITY(idx) CONFIG_PWM_INIT_PRIORITY diff --git a/drivers/serial/uart_nrfx_uarte.c b/drivers/serial/uart_nrfx_uarte.c index 80e296cc51d2..55aea85f3d39 100644 --- a/drivers/serial/uart_nrfx_uarte.c +++ b/drivers/serial/uart_nrfx_uarte.c @@ -2587,7 +2587,7 @@ static int uarte_instance_init(const struct device *dev, */ #define UARTE_INIT_PRIO(idx) \ COND_CODE_1(INSTANCE_IS_FAST_PD(_, /*empty*/, idx, _), \ - (UTIL_INC(CONFIG_CLOCK_CONTROL_NRF_HSFLL_GLOBAL_INIT_PRIORITY)), \ + (UTIL_INC(CONFIG_CLOCK_CONTROL_NRF2_GLOBAL_HSFLL_INIT_PRIORITY)), \ (CONFIG_SERIAL_INIT_PRIORITY)) /* Macro for setting nRF specific configuration structures. */ diff --git a/drivers/spi/spi_nrfx_spim.c b/drivers/spi/spi_nrfx_spim.c index c77e256a7fed..dcfee1c5ede2 100644 --- a/drivers/spi/spi_nrfx_spim.c +++ b/drivers/spi/spi_nrfx_spim.c @@ -43,7 +43,7 @@ LOG_MODULE_REGISTER(spi_nrfx_spim, CONFIG_SPI_LOG_LEVEL); #define SPI_BUFFER_IN_RAM 1 #endif -#if defined(CONFIG_CLOCK_CONTROL_NRF_HSFLL_GLOBAL) +#if defined(CONFIG_CLOCK_CONTROL_NRF2_GLOBAL_HSFLL) #define SPIM_REQUESTS_CLOCK(node) \ DT_NODE_HAS_COMPAT(DT_CLOCKS_CTLR(node), nordic_nrf_hsfll_global) #define SPIM_REQUESTS_CLOCK_OR(node) SPIM_REQUESTS_CLOCK(node) || @@ -796,11 +796,11 @@ static int spi_nrfx_init(const struct device *dev) * must be initialized after that controller driver, hence the default SPI * initialization priority may be too early for them. */ -#if defined(CONFIG_CLOCK_CONTROL_NRF_HSFLL_GLOBAL_INIT_PRIORITY) && \ - CONFIG_SPI_INIT_PRIORITY < CONFIG_CLOCK_CONTROL_NRF_HSFLL_GLOBAL_INIT_PRIORITY +#if defined(CONFIG_CLOCK_CONTROL_NRF2_GLOBAL_HSFLL_INIT_PRIORITY) && \ + CONFIG_SPI_INIT_PRIORITY < CONFIG_CLOCK_CONTROL_NRF2_GLOBAL_HSFLL_INIT_PRIORITY #define SPIM_INIT_PRIORITY(idx) \ COND_CODE_1(SPIM_REQUESTS_CLOCK(SPIM(idx)), \ - (UTIL_INC(CONFIG_CLOCK_CONTROL_NRF_HSFLL_GLOBAL_INIT_PRIORITY)), \ + (UTIL_INC(CONFIG_CLOCK_CONTROL_NRF2_GLOBAL_HSFLL_INIT_PRIORITY)), \ (CONFIG_SPI_INIT_PRIORITY)) #else #define SPIM_INIT_PRIORITY(idx) CONFIG_SPI_INIT_PRIORITY diff --git a/samples/boards/nordic/clock_control/sample.yaml b/samples/boards/nordic/clock_control/sample.yaml index 6e455d29ebc0..ee63e7c518ed 100644 --- a/samples/boards/nordic/clock_control/sample.yaml +++ b/samples/boards/nordic/clock_control/sample.yaml @@ -37,7 +37,7 @@ tests: sample.boards.nrf.clock_control.global_hsfll.req_low_freq_n: filter: dt_nodelabel_enabled("hsfll120") extra_configs: - - CONFIG_CLOCK_CONTROL_NRF_HSFLL_GLOBAL_REQ_LOW_FREQ=n + - CONFIG_CLOCK_CONTROL_NRF2_GLOBAL_HSFLL_REQ_LOW_FREQ=n extra_args: - CONF_FILE="configs/global_hsfll.conf" - DTC_OVERLAY_FILE="configs/global_hsfll.overlay" From f5b4480fe77e2f8dada37a3d2ff464be41513941 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:07 +0300 Subject: [PATCH 1497/2141] Revert "[nrf fromtree] clock_control: nrf: fix nrf_clock_control_get_startup_time desc" This reverts commit 82427548eac12f540c46f00404ed8fcbf622ef8f. Signed-off-by: Jukka Rissanen --- include/zephyr/drivers/clock_control/nrf_clock_control.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/zephyr/drivers/clock_control/nrf_clock_control.h b/include/zephyr/drivers/clock_control/nrf_clock_control.h index 7ef524dd4dc9..d12dca3c074f 100644 --- a/include/zephyr/drivers/clock_control/nrf_clock_control.h +++ b/include/zephyr/drivers/clock_control/nrf_clock_control.h @@ -355,10 +355,9 @@ static inline int nrf_clock_control_resolve(const struct device *dev, } /** - * @brief Get the startup time of a clock. + * @brief Get the startup timme of a clock. * * @param dev Device structure. - * @param spec Clock specification to get startup time for. * @param startup_time_us Destination for startup time in microseconds. * * @retval Successful if successful. From 22138fbeb73c23571df3e776ffeb0043b144333d Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:07 +0300 Subject: [PATCH 1498/2141] Revert "[nrf fromtree] drivers: mspi_dw: Add support for RX dummy cycles in single line mode" This reverts commit 0b6756bc2976b0e120e0dfee4b4f4a2910e07412. Signed-off-by: Jukka Rissanen --- drivers/mspi/mspi_dw.c | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/drivers/mspi/mspi_dw.c b/drivers/mspi/mspi_dw.c index adc59e765b11..019f613218ee 100644 --- a/drivers/mspi/mspi_dw.c +++ b/drivers/mspi/mspi_dw.c @@ -844,16 +844,13 @@ static int start_next_packet(const struct device *dev, k_timeout_t timeout) (dev_data->xfer.cmd_length != 0 || dev_data->xfer.addr_length != 0)) { uint32_t rx_total_bytes; - uint32_t dummy_cycles = dev_data->xfer.rx_dummy; dev_data->bytes_to_discard = dev_data->xfer.cmd_length - + dev_data->xfer.addr_length - + dummy_cycles / 8; + + dev_data->xfer.addr_length; rx_total_bytes = dev_data->bytes_to_discard + packet->num_bytes; - dev_data->dummy_bytes = dummy_cycles / 8 - + packet->num_bytes; + dev_data->dummy_bytes = packet->num_bytes; imr = IMR_TXEIM_BIT | IMR_RXFIM_BIT; tmod = CTRLR0_TMOD_TX_RX; @@ -865,13 +862,11 @@ static int start_next_packet(const struct device *dev, k_timeout_t timeout) tmod = CTRLR0_TMOD_RX; rx_fifo_threshold = MIN(packet_frames - 1, dev_config->rx_fifo_threshold); - - dev_data->spi_ctrlr0 |= - FIELD_PREP(SPI_CTRLR0_WAIT_CYCLES_MASK, - dev_data->xfer.rx_dummy); } dev_data->ctrlr0 |= FIELD_PREP(CTRLR0_TMOD_MASK, tmod); + dev_data->spi_ctrlr0 |= FIELD_PREP(SPI_CTRLR0_WAIT_CYCLES_MASK, + dev_data->xfer.rx_dummy); write_rxftlr(dev, FIELD_PREP(RXFTLR_RFT_MASK, rx_fifo_threshold)); @@ -1044,15 +1039,10 @@ static int _api_transceive(const struct device *dev, return -EINVAL; } - if (dev_data->standard_spi) { - if (req->tx_dummy) { - LOG_ERR("TX dummy cycles unsupported in single line mode"); - return -EINVAL; - } - if (req->rx_dummy % 8) { - LOG_ERR("Unsupported RX (%u) dummy cycles", req->rx_dummy); - return -EINVAL; - } + if (dev_data->standard_spi && + (req->rx_dummy != 0 || req->tx_dummy != 0)) { + LOG_ERR("Dummy cycles unsupported in single line mode"); + return -EINVAL; } else if (req->rx_dummy > SPI_CTRLR0_WAIT_CYCLES_MAX || req->tx_dummy > SPI_CTRLR0_WAIT_CYCLES_MAX) { LOG_ERR("Unsupported RX (%u) or TX (%u) dummy cycles", From 36b84fb5be5fef2a2e1b7e0ac94907b22dffb6e8 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:07 +0300 Subject: [PATCH 1499/2141] Revert "[nrf fromtree] drivers: mspi_dw: Add error reporting on RX FIFO overflow" This reverts commit c8e872bd549ef01bb9ba3d45e3f0e888365e606c. Signed-off-by: Jukka Rissanen --- drivers/mspi/mspi_dw.c | 12 +----------- drivers/mspi/mspi_dw.h | 13 ------------- 2 files changed, 1 insertion(+), 24 deletions(-) diff --git a/drivers/mspi/mspi_dw.c b/drivers/mspi/mspi_dw.c index 019f613218ee..7df0cdd8a094 100644 --- a/drivers/mspi/mspi_dw.c +++ b/drivers/mspi/mspi_dw.c @@ -101,7 +101,6 @@ DEFINE_MM_REG_RD(rxflr, 0x24) DEFINE_MM_REG_RD(sr, 0x28) DEFINE_MM_REG_WR(imr, 0x2c) DEFINE_MM_REG_RD(isr, 0x30) -DEFINE_MM_REG_RD(risr, 0x34) DEFINE_MM_REG_RD_WR(dr, 0x60) DEFINE_MM_REG_WR(spi_ctrlr0, 0xf4) @@ -280,11 +279,6 @@ static void mspi_dw_isr(const struct device *dev) break; } - if (read_risr(dev) & RISR_RXOIR_BIT) { - finished = true; - break; - } - int_status = read_isr(dev); } @@ -983,11 +977,7 @@ static int start_next_packet(const struct device *dev, k_timeout_t timeout) write_imr(dev, imr); rc = k_sem_take(&dev_data->finished, timeout); - if (read_risr(dev) & RISR_RXOIR_BIT) { - LOG_ERR("RX FIFO overflow occurred"); - rc = -EIO; - } else if (rc < 0) { - LOG_ERR("Transfer timed out"); + if (rc < 0) { rc = -ETIMEDOUT; } diff --git a/drivers/mspi/mspi_dw.h b/drivers/mspi/mspi_dw.h index c35778cb1c59..a3c6329bd87d 100644 --- a/drivers/mspi/mspi_dw.h +++ b/drivers/mspi/mspi_dw.h @@ -66,19 +66,6 @@ #define ISR_RXFIS_BIT BIT(4) #define ISR_MSTIS_BIT BIT(5) -/* RISR - Raw Interrupt Status Register */ -#define RISR_TXEIR_BIT BIT(0) -#define RISR_TXOIR_BIT BIT(1) -#define RISR_RXUIR_BIT BIT(2) -#define RISR_RXOIR_BIT BIT(3) -#define RISR_RXFIR_BIT BIT(4) -#define RISR_MSTIR_BIT BIT(5) -#define RISR_XRXOIR_BIT BIT(6) -#define RISR_TXUIR_BIT BIT(7) -#define RISR_AXIER_BIT BIT(8) -#define RISR_SPITER_BIT BIT(10) -#define RISR_DONER_BIT BIT(11) - /* SPI_CTRLR0 - SPI Control Register */ #define SPI_CTRLR0_CLK_STRETCH_EN_BIT BIT(30) #define SPI_CTRLR0_XIP_PREFETCH_EN_BIT BIT(29) From 5219313729016ef9a1b9e6a4808a98f0e357e89e Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:07 +0300 Subject: [PATCH 1500/2141] Revert "[nrf fromtree] drivers: mspi_dw: Improve transfer handling" This reverts commit 5b212c6e473fb7b2d89d59a7f4db9316111bce93. Signed-off-by: Jukka Rissanen --- drivers/mspi/mspi_dw.c | 172 ++++++++++++++++------------------------- 1 file changed, 66 insertions(+), 106 deletions(-) diff --git a/drivers/mspi/mspi_dw.c b/drivers/mspi/mspi_dw.c index 7df0cdd8a094..3254458d81d5 100644 --- a/drivers/mspi/mspi_dw.c +++ b/drivers/mspi/mspi_dw.c @@ -19,6 +19,8 @@ LOG_MODULE_REGISTER(mspi_dw, CONFIG_MSPI_LOG_LEVEL); +#define DUMMY_BYTE 0xAA + #if defined(CONFIG_MSPI_XIP) struct xip_params { uint32_t read_cmd; @@ -149,9 +151,6 @@ static void tx_data(const struct device *dev, write_dr(dev, data); if (buf_pos >= buf_end) { - /* Set the threshold to 0 to get the next interrupt - * when the FIFO is completely emptied. - */ write_txftlr(dev, 0); break; } @@ -165,38 +164,35 @@ static void tx_data(const struct device *dev, dev_data->buf_pos = (uint8_t *)buf_pos; } -static bool tx_dummy_bytes(const struct device *dev) +static bool make_rx_cycles(const struct device *dev) { struct mspi_dw_data *dev_data = dev->data; const struct mspi_dw_config *dev_config = dev->config; - uint8_t fifo_room = dev_config->tx_fifo_depth_minus_1 + 1 - - FIELD_GET(TXFLR_TXTFL_MASK, read_txflr(dev)); uint16_t dummy_bytes = dev_data->dummy_bytes; - const uint8_t dummy_val = 0; - - if (dummy_bytes > fifo_room) { - dev_data->dummy_bytes = dummy_bytes - fifo_room; - - do { - write_dr(dev, dummy_val); - } while (--fifo_room); - - return false; - } + /* See tx_data(). */ + uint32_t room = 1; + uint8_t tx_fifo_depth = dev_config->tx_fifo_depth_minus_1 + 1; do { - write_dr(dev, dummy_val); - } while (--dummy_bytes); + write_dr(dev, DUMMY_BYTE); - /* Set the threshold to 0 to get the next interrupt when the FIFO is - * completely emptied. - */ - write_txftlr(dev, 0); + --dummy_bytes; + if (!dummy_bytes) { + dev_data->dummy_bytes = 0; + return true; + } - return true; + if (--room == 0) { + room = tx_fifo_depth + - FIELD_GET(TXFLR_TXTFL_MASK, read_txflr(dev)); + } + } while (room); + + dev_data->dummy_bytes = dummy_bytes; + return false; } -static bool read_rx_fifo(const struct device *dev, +static void read_rx_fifo(const struct device *dev, const struct mspi_xfer_packet *packet) { struct mspi_dw_data *dev_data = dev->data; @@ -227,8 +223,9 @@ static bool read_rx_fifo(const struct device *dev, } if (buf_pos >= buf_end) { + dev_data->bytes_to_discard = bytes_to_discard; dev_data->buf_pos = buf_pos; - return true; + return; } } @@ -245,7 +242,6 @@ static bool read_rx_fifo(const struct device *dev, dev_data->bytes_to_discard = bytes_to_discard; dev_data->buf_pos = buf_pos; - return false; } static void mspi_dw_isr(const struct device *dev) @@ -253,49 +249,32 @@ static void mspi_dw_isr(const struct device *dev) struct mspi_dw_data *dev_data = dev->data; const struct mspi_xfer_packet *packet = &dev_data->xfer.packets[dev_data->packets_done]; - bool finished = false; + uint32_t int_status = read_isr(dev); - if (packet->dir == MSPI_TX) { - if (dev_data->buf_pos < dev_data->buf_end) { - tx_data(dev, packet); - } else { - /* It may happen that at this point the controller is - * still shifting out the last frame (the last interrupt - * occurs when the TX FIFO is empty). Wait if it signals - * that it is busy. - */ - while (read_sr(dev) & SR_BUSY_BIT) { - } + if (int_status & ISR_RXFIS_BIT) { + read_rx_fifo(dev, packet); + } - finished = true; + if (dev_data->buf_pos >= dev_data->buf_end) { + write_imr(dev, 0); + /* It may happen that at this point the controller is still + * shifting out the last frame (the last interrupt occurs when + * the TX FIFO is empty). Wait if it signals that it is busy. + */ + while (read_sr(dev) & SR_BUSY_BIT) { } - } else { - uint32_t int_status = read_isr(dev); - - do { - if (int_status & ISR_RXFIS_BIT) { - if (read_rx_fifo(dev, packet)) { - finished = true; - break; - } - int_status = read_isr(dev); - } - - if (int_status & ISR_TXEIS_BIT) { - if (tx_dummy_bytes(dev)) { + k_sem_give(&dev_data->finished); + } else { + if (int_status & ISR_TXEIS_BIT) { + if (dev_data->dummy_bytes) { + if (make_rx_cycles(dev)) { write_imr(dev, IMR_RXFIM_BIT); } - - int_status = read_isr(dev); + } else { + tx_data(dev, packet); } - } while (int_status); - } - - if (finished) { - write_imr(dev, 0); - - k_sem_give(&dev_data->finished); + } } vendor_specific_irq_clear(dev); @@ -770,6 +749,7 @@ static int start_next_packet(const struct device *dev, k_timeout_t timeout) (dev_data->xip_enabled != 0), (false)); unsigned int key; + uint8_t tx_fifo_threshold; uint32_t packet_frames; uint32_t imr; int rc = 0; @@ -781,7 +761,6 @@ static int start_next_packet(const struct device *dev, k_timeout_t timeout) } dev_data->dummy_bytes = 0; - dev_data->bytes_to_discard = 0; dev_data->ctrlr0 &= ~CTRLR0_TMOD_MASK & ~CTRLR0_DFS_MASK; @@ -822,6 +801,7 @@ static int start_next_packet(const struct device *dev, k_timeout_t timeout) dev_data->xfer.tx_dummy); write_rxftlr(dev, 0); + tx_fifo_threshold = dev_config->tx_fifo_threshold; } else { uint32_t tmod; uint8_t rx_fifo_threshold; @@ -848,12 +828,14 @@ static int start_next_packet(const struct device *dev, k_timeout_t timeout) imr = IMR_TXEIM_BIT | IMR_RXFIM_BIT; tmod = CTRLR0_TMOD_TX_RX; + tx_fifo_threshold = dev_config->tx_fifo_threshold; /* For standard SPI, only 1-byte frames are used. */ rx_fifo_threshold = MIN(rx_total_bytes - 1, dev_config->rx_fifo_threshold); } else { imr = IMR_RXFIM_BIT; tmod = CTRLR0_TMOD_RX; + tx_fifo_threshold = 0; rx_fifo_threshold = MIN(packet_frames - 1, dev_config->rx_fifo_threshold); } @@ -899,49 +881,23 @@ static int start_next_packet(const struct device *dev, k_timeout_t timeout) dev_data->buf_pos = packet->data_buf; dev_data->buf_end = &packet->data_buf[packet->num_bytes]; - /* Set the TX FIFO threshold and its transmit start level. */ - if (packet->num_bytes) { - /* If there is some data to send/receive, set the threshold to - * the value configured for the driver instance and the start - * level to the maximum possible value (it will be updated later - * in tx_fifo() or tx_dummy_bytes() when TX is to be finished). - * This helps avoid a situation when the TX FIFO becomes empty - * before the transfer is complete and the SSI core finishes the - * transaction and deactivates the CE line. This could occur - * right before the data phase in enhanced SPI modes, when the - * clock stretching feature does not work yet, or in Standard - * SPI mode, where the clock stretching is not available at all. - */ - write_txftlr(dev, FIELD_PREP(TXFTLR_TXFTHR_MASK, - dev_config->tx_fifo_depth_minus_1) | - FIELD_PREP(TXFTLR_TFT_MASK, - dev_config->tx_fifo_threshold)); - } else { - uint32_t total_tx_entries = 0; + if ((imr & IMR_TXEIM_BIT) && dev_data->buf_pos < dev_data->buf_end) { + uint32_t start_level = tx_fifo_threshold; - /* It the whole transfer is to contain only the command and/or - * address, set up the transfer to start right after entries - * for those appear in the TX FIFO, and the threshold to 0, - * so that the interrupt occurs when the TX FIFO gets emptied. - */ - if (dev_data->xfer.cmd_length) { - if (dev_data->standard_spi) { - total_tx_entries += dev_data->xfer.cmd_length; - } else { - total_tx_entries += 1; - } - } + if (dev_data->dummy_bytes) { + uint32_t tx_total = dev_data->bytes_to_discard + + dev_data->dummy_bytes; - if (dev_data->xfer.addr_length) { - if (dev_data->standard_spi) { - total_tx_entries += dev_data->xfer.addr_length; - } else { - total_tx_entries += 1; + if (start_level > tx_total - 1) { + start_level = tx_total - 1; } } - write_txftlr(dev, FIELD_PREP(TXFTLR_TXFTHR_MASK, - total_tx_entries - 1)); + write_txftlr(dev, + FIELD_PREP(TXFTLR_TXFTHR_MASK, start_level) | + FIELD_PREP(TXFTLR_TFT_MASK, tx_fifo_threshold)); + } else { + write_txftlr(dev, 0); } /* Ensure that there will be no interrupt from the controller yet. */ @@ -949,10 +905,6 @@ static int start_next_packet(const struct device *dev, k_timeout_t timeout) /* Enable the controller. This must be done before DR is written. */ write_ssienr(dev, SSIENR_SSIC_EN_BIT); - /* Since the FIFO depth in SSI is always at least 8, it can be safely - * assumed that the command and address fields (max. 2 and 4 bytes, - * respectively) can be written here before the TX FIFO gets filled up. - */ if (dev_data->standard_spi) { if (dev_data->xfer.cmd_length) { tx_control_field(dev, packet->cmd, @@ -973,6 +925,14 @@ static int start_next_packet(const struct device *dev, k_timeout_t timeout) } } + if (dev_data->dummy_bytes) { + if (make_rx_cycles(dev)) { + imr = IMR_RXFIM_BIT; + } + } else if (packet->dir == MSPI_TX && packet->num_bytes) { + tx_data(dev, packet); + } + /* Enable interrupts now and wait until the packet is done. */ write_imr(dev, imr); From 2aec20ce0b9787a0830d374f0cb25d00f9935808 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:07 +0300 Subject: [PATCH 1501/2141] Revert "[nrf fromtree] drivers: mspi_dw: Add waiting for clock in nRF EXMIF specific resume" This reverts commit 2c537a2b6664163e0894dcf14ae83c1e0bb245eb. Signed-off-by: Jukka Rissanen --- drivers/mspi/mspi_dw.c | 3 +-- drivers/mspi/mspi_dw_vendor_specific.h | 11 ----------- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/mspi/mspi_dw.c b/drivers/mspi/mspi_dw.c index 3254458d81d5..21088ad1bf6c 100644 --- a/drivers/mspi/mspi_dw.c +++ b/drivers/mspi/mspi_dw.c @@ -16,6 +16,7 @@ #include #include "mspi_dw.h" +#include "mspi_dw_vendor_specific.h" LOG_MODULE_REGISTER(mspi_dw, CONFIG_MSPI_LOG_LEVEL); @@ -115,8 +116,6 @@ DEFINE_MM_REG_WR(xip_write_wrap_inst, 0x144) DEFINE_MM_REG_WR(xip_write_ctrl, 0x148) #endif -#include "mspi_dw_vendor_specific.h" - static void tx_data(const struct device *dev, const struct mspi_xfer_packet *packet) { diff --git a/drivers/mspi/mspi_dw_vendor_specific.h b/drivers/mspi/mspi_dw_vendor_specific.h index e34d8a5db60b..4913e536c92d 100644 --- a/drivers/mspi/mspi_dw_vendor_specific.h +++ b/drivers/mspi/mspi_dw_vendor_specific.h @@ -33,17 +33,6 @@ static inline void vendor_specific_resume(const struct device *dev) ARG_UNUSED(dev); NRF_EXMIF->TASKS_START = 1; - - /* Try to write an SSI register and wait until the write is successful - * to ensure that the clock that drives the SSI core is ready. - */ - uint32_t rxftlr = read_rxftlr(dev); - uint32_t rxftlr_mod = rxftlr ^ 1; - - do { - write_rxftlr(dev, rxftlr_mod); - rxftlr = read_rxftlr(dev); - } while (rxftlr != rxftlr_mod); } static inline void vendor_specific_irq_clear(const struct device *dev) From 489884907da8c384a5b99bd03678c2ddde93b0b4 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:08 +0300 Subject: [PATCH 1502/2141] Revert "[nrf fromtree] drivers: mspi_dw: Apply a few minor corrections" This reverts commit 58efe6efd66b05a54b62406ed4ba759f06060938. Signed-off-by: Jukka Rissanen --- drivers/mspi/mspi_dw.c | 21 ++++++--------------- drivers/mspi/mspi_dw.h | 15 +++++++++++++++ 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/drivers/mspi/mspi_dw.c b/drivers/mspi/mspi_dw.c index 21088ad1bf6c..39cf463f4bee 100644 --- a/drivers/mspi/mspi_dw.c +++ b/drivers/mspi/mspi_dw.c @@ -372,7 +372,7 @@ static bool apply_cmd_length(struct mspi_dw_data *dev_data, uint32_t cmd_length) SPI_CTRLR0_INST_L16); break; default: - LOG_ERR("Command length %u not supported", cmd_length); + LOG_ERR("Command length %d not supported", cmd_length); return false; } @@ -382,11 +382,6 @@ static bool apply_cmd_length(struct mspi_dw_data *dev_data, uint32_t cmd_length) static bool apply_addr_length(struct mspi_dw_data *dev_data, uint32_t addr_length) { - if (addr_length > 4) { - LOG_ERR("Address length %u not supported", addr_length); - return false; - } - dev_data->spi_ctrlr0 |= FIELD_PREP(SPI_CTRLR0_ADDR_L_MASK, addr_length * 2); @@ -498,7 +493,7 @@ static bool apply_xip_cmd_length(const struct mspi_dw_data *dev_data, XIP_WRITE_CTRL_INST_L16); break; default: - LOG_ERR("Command length %u not supported", cmd_length); + LOG_ERR("Command length %d not supported", cmd_length); return false; } @@ -510,11 +505,6 @@ static bool apply_xip_addr_length(const struct mspi_dw_data *dev_data, { uint8_t addr_length = dev_data->xip_params_active.addr_length; - if (addr_length > 4) { - LOG_ERR("Address length %u not supported", addr_length); - return false; - } - ctrl->read |= FIELD_PREP(XIP_CTRL_ADDR_L_MASK, addr_length * 2); ctrl->write |= FIELD_PREP(XIP_WRITE_CTRL_ADDR_L_MASK, addr_length * 2); @@ -980,7 +970,8 @@ static int _api_transceive(const struct device *dev, struct mspi_dw_data *dev_data = dev->data; int rc; - dev_data->spi_ctrlr0 &= ~SPI_CTRLR0_INST_L_MASK + dev_data->spi_ctrlr0 &= ~SPI_CTRLR0_WAIT_CYCLES_MASK + & ~SPI_CTRLR0_INST_L_MASK & ~SPI_CTRLR0_ADDR_L_MASK; if (!apply_cmd_length(dev_data, req->cmd_length) || @@ -1100,8 +1091,8 @@ static int _api_xip_config(const struct device *dev, return -EINVAL; } - if (params->rx_dummy > XIP_CTRL_WAIT_CYCLES_MAX || - params->tx_dummy > XIP_WRITE_CTRL_WAIT_CYCLES_MAX) { + if (params->rx_dummy > SPI_CTRLR0_WAIT_CYCLES_MAX || + params->tx_dummy > SPI_CTRLR0_WAIT_CYCLES_MAX) { LOG_ERR("Unsupported RX (%u) or TX (%u) dummy cycles", params->rx_dummy, params->tx_dummy); return -EINVAL; diff --git a/drivers/mspi/mspi_dw.h b/drivers/mspi/mspi_dw.h index a3c6329bd87d..bd81d061e09a 100644 --- a/drivers/mspi/mspi_dw.h +++ b/drivers/mspi/mspi_dw.h @@ -127,6 +127,21 @@ #define XIP_CTRL_FRF_QUAD 2UL #define XIP_CTRL_FRF_OCTAL 3UL +/* XIP_CTRL - XIP Control Register */ +#define XIP_CTRL_XIP_PREFETCH_EN_BIT BIT(28) +#define XIP_CTRL_XIP_MBL_MASK GENMASK(27, 26) +#define XIP_CTRL_XIP_MBL_2 0UL +#define XIP_CTRL_XIP_MBL_4 1UL +#define XIP_CTRL_XIP_MBL_8 2UL +#define XIP_CTRL_XIP_MBL_16 3UL +#define XIP_CTRL_XIP_HYBERBUS_EN_BIT BIT(24) +#define XIP_CTRL_CONT_XFER_EN_BIT BIT(23) +#define XIP_CTRL_INST_EN_BIT BIT(22) +#define XIP_CTRL_RXDS_EN_BIT BIT(21) +#define XIP_CTRL_INST_DDR_EN_BIT BIT(20) +#define XIP_CTRL_DDR_EN_BIT BIT(19) +#define XIP_CTRL_DFS_HC_BIT BIT(18) + /* XIP_WRITE_CTRL - XIP Write Control Register */ #define XIP_WRITE_CTRL_WAIT_CYCLES_MASK GENMASK(20, 16) #define XIP_WRITE_CTRL_WAIT_CYCLES_MAX BIT_MASK(5) From a656e9ccd03288226ef0fef8e5f5982e45560c0c Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:08 +0300 Subject: [PATCH 1503/2141] Revert "[nrf fromtree] drivers: flash_mspi_nor: Omit quad_enable_set() when QER is set to NONE" This reverts commit f8b7ffa66d60f44a590d0f22da2f65b5117a2917. Signed-off-by: Jukka Rissanen --- drivers/flash/flash_mspi_nor.c | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/drivers/flash/flash_mspi_nor.c b/drivers/flash/flash_mspi_nor.c index b7ca6341d3ae..e297b01f5d98 100644 --- a/drivers/flash/flash_mspi_nor.c +++ b/drivers/flash/flash_mspi_nor.c @@ -567,20 +567,15 @@ static int default_io_mode(const struct device *dev) enum mspi_io_mode io_mode = dev_config->mspi_nor_cfg.io_mode; int rc = 0; - if (dev_config->dw15_qer != JESD216_DW15_QER_VAL_NONE) { - /* For Quad 1-1-4 and 1-4-4, entering or leaving mode is defined - * in JEDEC216 BFP DW15 QER - */ - if (io_mode == MSPI_IO_MODE_SINGLE) { - rc = quad_enable_set(dev, false); - } else if (io_mode == MSPI_IO_MODE_QUAD_1_1_4 || - io_mode == MSPI_IO_MODE_QUAD_1_4_4) { - rc = quad_enable_set(dev, true); - } + /* For Quad 1-1-4 and 1-4-4, entering or leaving mode is defined in JEDEC216 BFP DW15 QER */ + if (io_mode == MSPI_IO_MODE_SINGLE) { + rc = quad_enable_set(dev, false); + } else if ((io_mode == MSPI_IO_MODE_QUAD_1_1_4) || (io_mode == MSPI_IO_MODE_QUAD_1_4_4)) { + rc = quad_enable_set(dev, true); + } - if (rc < 0) { - LOG_ERR("Failed to modify Quad Enable bit: %d", rc); - } + if (rc < 0) { + LOG_ERR("Failed to modify Quad Enable bit: %d", rc); } if ((dev_config->quirks != NULL) && (dev_config->quirks->post_switch_mode != NULL)) { @@ -651,10 +646,8 @@ static int flash_chip_init(const struct device *dev) /* Some chips reuse RESET pin for data in Quad modes: * force single line mode before resetting. */ - if (dev_config->dw15_qer != JESD216_DW15_QER_VAL_NONE && - (io_mode == MSPI_IO_MODE_SINGLE || - io_mode == MSPI_IO_MODE_QUAD_1_1_4 || - io_mode == MSPI_IO_MODE_QUAD_1_4_4)) { + if ((io_mode == MSPI_IO_MODE_SINGLE) || (io_mode == MSPI_IO_MODE_QUAD_1_1_4) || + (io_mode == MSPI_IO_MODE_QUAD_1_4_4)) { rc = quad_enable_set(dev, false); if (rc < 0) { From 0c23fd10c4bb7c866af0e62efca47eac3089a0df Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:08 +0300 Subject: [PATCH 1504/2141] Revert "[nrf fromtree] drivers: flash: nrf_qspi_nor: Handle properly multiple XIP users" This reverts commit e9002cf6ad6d7a04662395d55e25b846baa5adbe. Signed-off-by: Jukka Rissanen --- drivers/flash/nrf_qspi_nor.c | 65 +++++++++++++----------------------- 1 file changed, 23 insertions(+), 42 deletions(-) diff --git a/drivers/flash/nrf_qspi_nor.c b/drivers/flash/nrf_qspi_nor.c index 34b36b4d7e31..12eeb3f4a3e2 100644 --- a/drivers/flash/nrf_qspi_nor.c +++ b/drivers/flash/nrf_qspi_nor.c @@ -41,7 +41,7 @@ struct qspi_nor_data { */ volatile bool ready; #endif /* CONFIG_MULTITHREADING */ - uint32_t xip_users; + bool xip_enabled; }; struct qspi_nor_config { @@ -313,7 +313,7 @@ static void qspi_acquire(const struct device *dev) qspi_lock(dev); - if (dev_data->xip_users == 0) { + if (!dev_data->xip_enabled) { qspi_clock_div_change(); pm_device_busy_set(dev); @@ -331,7 +331,7 @@ static void qspi_release(const struct device *dev) deactivate = atomic_dec(&dev_data->usage_count) == 1; #endif - if (dev_data->xip_users == 0) { + if (!dev_data->xip_enabled) { qspi_clock_div_restore(); if (deactivate) { @@ -1344,54 +1344,35 @@ static int qspi_nor_pm_action(const struct device *dev, } #endif /* CONFIG_PM_DEVICE */ -static void on_xip_enable(const struct device *dev) -{ -#if NRF_QSPI_HAS_XIPEN - nrf_qspi_xip_set(NRF_QSPI, true); -#endif - (void)nrfx_qspi_activate(false); -} - -static void on_xip_disable(const struct device *dev) -{ - /* It turns out that when the QSPI peripheral is deactivated - * after a XIP transaction, it cannot be later successfully - * reactivated and an attempt to perform another XIP transaction - * results in the CPU being hung; even a debug session cannot be - * started then and the SoC has to be recovered. - * As a workaround, at least until the cause of such behavior - * is fully clarified, perform a simple non-XIP transaction - * (a read of the status register) before deactivating the QSPI. - * This prevents the issue from occurring. - */ - (void)qspi_rdsr(dev, 1); - -#if NRF_QSPI_HAS_XIPEN - nrf_qspi_xip_set(NRF_QSPI, false); -#endif -} - void z_impl_nrf_qspi_nor_xip_enable(const struct device *dev, bool enable) { struct qspi_nor_data *dev_data = dev->data; + if (dev_data->xip_enabled == enable) { + return; + } + qspi_acquire(dev); +#if NRF_QSPI_HAS_XIPEN + nrf_qspi_xip_set(NRF_QSPI, enable); +#endif if (enable) { - if (dev_data->xip_users == 0) { - on_xip_enable(dev); - } - - ++dev_data->xip_users; - } else if (dev_data->xip_users == 0) { - LOG_ERR("Unbalanced XIP disabling"); + (void)nrfx_qspi_activate(false); } else { - --dev_data->xip_users; - - if (dev_data->xip_users == 0) { - on_xip_disable(dev); - } + /* It turns out that when the QSPI peripheral is deactivated + * after a XIP transaction, it cannot be later successfully + * reactivated and an attempt to perform another XIP transaction + * results in the CPU being hung; even a debug session cannot be + * started then and the SoC has to be recovered. + * As a workaround, at least until the cause of such behavior + * is fully clarified, perform a simple non-XIP transaction + * (a read of the status register) before deactivating the QSPI. + * This prevents the issue from occurring. + */ + (void)qspi_rdsr(dev, 1); } + dev_data->xip_enabled = enable; qspi_release(dev); } From 00763cda9a2f9548ffcdd0c186570ec8f0b7cf12 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:08 +0300 Subject: [PATCH 1505/2141] Revert "[nrf fromtree] drivers: gpio_nrfx: Free channel when changing mode" This reverts commit 542b84305fd05720a37f1d323eb75e33f07a2607. Signed-off-by: Jukka Rissanen --- drivers/gpio/gpio_nrfx.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/drivers/gpio/gpio_nrfx.c b/drivers/gpio/gpio_nrfx.c index b6548ed22d53..39377d7b7776 100644 --- a/drivers/gpio/gpio_nrfx.c +++ b/drivers/gpio/gpio_nrfx.c @@ -444,15 +444,6 @@ static int gpio_nrfx_pin_interrupt_configure(const struct device *port, } trigger_config.p_in_channel = &ch; - } else { - /* If edge mode with channel was previously used and we are changing to sense or - * level triggered, we must free the channel. - */ - err = nrfx_gpiote_channel_get(&cfg->gpiote, abs_pin, &ch); - if (err == NRFX_SUCCESS) { - err = nrfx_gpiote_channel_free(&cfg->gpiote, ch); - __ASSERT_NO_MSG(err == NRFX_SUCCESS); - } } err = nrfx_gpiote_input_configure(&cfg->gpiote, abs_pin, &input_pin_config); From 5be399a1a0d3f3e1479e4e24e2d765f821d0098f Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:08 +0300 Subject: [PATCH 1506/2141] Revert "[nrf fromtree] net: openthread: Add missing include for logging in diag.c" This reverts commit 2b67e55872094d6df44748974c5c0928bbe2b68d. Signed-off-by: Jukka Rissanen --- modules/openthread/platform/diag.c | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/openthread/platform/diag.c b/modules/openthread/platform/diag.c index afa09c7e68d5..74781cad4a1d 100644 --- a/modules/openthread/platform/diag.c +++ b/modules/openthread/platform/diag.c @@ -10,7 +10,6 @@ #include #include #include -#include #include #include "platform-zephyr.h" From 65d2becd8adc0ce682dadfc2eb0924eb553af13f Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:08 +0300 Subject: [PATCH 1507/2141] Revert "[nrf fromtree] tests: drivers: i2s: Run I2S tests on nRF54H20" This reverts commit 6aacec8e810878e82b5395254e0bbf4d4c5f3eb0. Signed-off-by: Jukka Rissanen --- tests/drivers/i2s/i2s_api/testcase.yaml | 13 ------------- tests/drivers/i2s/i2s_speed/testcase.yaml | 15 --------------- 2 files changed, 28 deletions(-) diff --git a/tests/drivers/i2s/i2s_api/testcase.yaml b/tests/drivers/i2s/i2s_api/testcase.yaml index 5b36b91c8fe7..1932607d6552 100644 --- a/tests/drivers/i2s/i2s_api/testcase.yaml +++ b/tests/drivers/i2s/i2s_api/testcase.yaml @@ -10,7 +10,6 @@ tests: - mcx_n9xx_evk/mcxn947/cpu0 - mimxrt595_evk/mimxrt595s/cm33 - mimxrt685_evk/mimxrt685s/cm33 - - nrf54h20dk/nrf54h20/cpuapp drivers.i2s.gpio_loopback: depends_on: - i2s @@ -25,17 +24,5 @@ tests: - mcx_n9xx_evk/mcxn947/cpu0 - mimxrt595_evk/mimxrt595s/cm33 - mimxrt685_evk/mimxrt685s/cm33 - - nrf54h20dk/nrf54h20/cpuapp harness_config: fixture: gpio_loopback - drivers.i2s.gpio_loopback.nrf54h: - depends_on: i2s - tags: - - drivers - - userspace - harness_config: - fixture: i2s_loopback - platform_allow: - - nrf54h20dk/nrf54h20/cpuapp - integration_platforms: - - nrf54h20dk/nrf54h20/cpuapp diff --git a/tests/drivers/i2s/i2s_speed/testcase.yaml b/tests/drivers/i2s/i2s_speed/testcase.yaml index 56065f5ef628..6bc15a413645 100644 --- a/tests/drivers/i2s/i2s_speed/testcase.yaml +++ b/tests/drivers/i2s/i2s_speed/testcase.yaml @@ -5,8 +5,6 @@ tests: - drivers - i2s filter: not CONFIG_I2S_TEST_USE_GPIO_LOOPBACK - platform_exclude: - - nrf54h20dk/nrf54h20/cpuapp drivers.i2s.speed.gpio_loopback: depends_on: - i2s @@ -15,8 +13,6 @@ tests: - drivers - i2s filter: CONFIG_I2S_TEST_USE_GPIO_LOOPBACK - platform_exclude: - - nrf54h20dk/nrf54h20/cpuapp harness: ztest harness_config: fixture: gpio_loopback @@ -33,14 +29,3 @@ tests: fixture: gpio_loopback extra_args: EXTRA_DTC_OVERLAY_FILE="boards/nrf5340dk_nrf5340_cpuapp_aclk.overlay" platform_allow: nrf5340dk/nrf5340/cpuapp - drivers.i2s.speed.gpio_loopback.nrf54h: - depends_on: i2s - tags: - - drivers - - i2s - harness_config: - fixture: i2s_loopback - platform_allow: - - nrf54h20dk/nrf54h20/cpuapp - integration_platforms: - - nrf54h20dk/nrf54h20/cpuapp From d7e975b93f2d8272bb74437c3551ac7a20f44b79 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:08 +0300 Subject: [PATCH 1508/2141] Revert "[nrf fromtree] drivers: i2c: Support i2c23 and i2c24 instances" This reverts commit 5e6a0881d299c6417eadb7198caf000248961550. Signed-off-by: Jukka Rissanen --- drivers/i2c/Kconfig.nrfx | 4 ---- drivers/i2c/i2c_nrfx_twim.c | 8 -------- drivers/i2c/i2c_nrfx_twim_rtio.c | 8 -------- drivers/i2c/i2c_nrfx_twis.c | 8 -------- modules/hal_nordic/nrfx/Kconfig | 20 -------------------- modules/hal_nordic/nrfx/nrfx_kconfig.h | 12 ------------ soc/nordic/common/Kconfig.peripherals | 12 ------------ soc/nordic/validate_base_addresses.c | 2 -- 8 files changed, 74 deletions(-) diff --git a/drivers/i2c/Kconfig.nrfx b/drivers/i2c/Kconfig.nrfx index 54d533636747..2213175d5d60 100644 --- a/drivers/i2c/Kconfig.nrfx +++ b/drivers/i2c/Kconfig.nrfx @@ -30,8 +30,6 @@ config I2C_NRFX_TWIM select NRFX_TWIM20 if HAS_HW_NRF_TWIM20 select NRFX_TWIM21 if HAS_HW_NRF_TWIM21 select NRFX_TWIM22 if HAS_HW_NRF_TWIM22 - select NRFX_TWIM23 if HAS_HW_NRF_TWIM23 - select NRFX_TWIM24 if HAS_HW_NRF_TWIM24 select NRFX_TWIM30 if HAS_HW_NRF_TWIM30 select NRFX_TWIM120 if HAS_HW_NRF_TWIM120 select NRFX_TWIM130 if HAS_HW_NRF_TWIM130 @@ -63,8 +61,6 @@ config I2C_NRFX_TWIS select NRFX_TWIS20 if HAS_HW_NRF_TWIS20 select NRFX_TWIS21 if HAS_HW_NRF_TWIS21 select NRFX_TWIS22 if HAS_HW_NRF_TWIS22 - select NRFX_TWIS23 if HAS_HW_NRF_TWIS23 - select NRFX_TWIS24 if HAS_HW_NRF_TWIS24 select NRFX_TWIS30 if HAS_HW_NRF_TWIS30 select NRFX_TWIS130 if HAS_HW_NRF_TWIS130 select NRFX_TWIS131 if HAS_HW_NRF_TWIS131 diff --git a/drivers/i2c/i2c_nrfx_twim.c b/drivers/i2c/i2c_nrfx_twim.c index d5b619bfc5ac..953a03a7b73d 100644 --- a/drivers/i2c/i2c_nrfx_twim.c +++ b/drivers/i2c/i2c_nrfx_twim.c @@ -323,14 +323,6 @@ I2C_NRFX_TWIM_DEVICE(21); I2C_NRFX_TWIM_DEVICE(22); #endif -#ifdef CONFIG_HAS_HW_NRF_TWIM23 -I2C_NRFX_TWIM_DEVICE(23); -#endif - -#ifdef CONFIG_HAS_HW_NRF_TWIM24 -I2C_NRFX_TWIM_DEVICE(24); -#endif - #ifdef CONFIG_HAS_HW_NRF_TWIM30 I2C_NRFX_TWIM_DEVICE(30); #endif diff --git a/drivers/i2c/i2c_nrfx_twim_rtio.c b/drivers/i2c/i2c_nrfx_twim_rtio.c index 6a7504dbd628..68d93a3a06e5 100644 --- a/drivers/i2c/i2c_nrfx_twim_rtio.c +++ b/drivers/i2c/i2c_nrfx_twim_rtio.c @@ -314,14 +314,6 @@ I2C_NRFX_TWIM_RTIO_DEVICE(21); I2C_NRFX_TWIM_RTIO_DEVICE(22); #endif -#ifdef CONFIG_HAS_HW_NRF_TWIM23 -I2C_NRFX_TWIM_RTIO_DEVICE(23); -#endif - -#ifdef CONFIG_HAS_HW_NRF_TWIM24 -I2C_NRFX_TWIM_RTIO_DEVICE(24); -#endif - #ifdef CONFIG_HAS_HW_NRF_TWIM30 I2C_NRFX_TWIM_RTIO_DEVICE(30); #endif diff --git a/drivers/i2c/i2c_nrfx_twis.c b/drivers/i2c/i2c_nrfx_twis.c index c37c51ddd745..9e2b0759f2a3 100644 --- a/drivers/i2c/i2c_nrfx_twis.c +++ b/drivers/i2c/i2c_nrfx_twis.c @@ -362,14 +362,6 @@ SHIM_NRF_TWIS_DEVICE_DEFINE(21); SHIM_NRF_TWIS_DEVICE_DEFINE(22); #endif -#ifdef CONFIG_HAS_HW_NRF_TWIS23 -SHIM_NRF_TWIS_DEVICE_DEFINE(23); -#endif - -#ifdef CONFIG_HAS_HW_NRF_TWIS24 -SHIM_NRF_TWIS_DEVICE_DEFINE(24); -#endif - #ifdef CONFIG_HAS_HW_NRF_TWIS30 SHIM_NRF_TWIS_DEVICE_DEFINE(30); #endif diff --git a/modules/hal_nordic/nrfx/Kconfig b/modules/hal_nordic/nrfx/Kconfig index 80610599e60b..08c5df625990 100644 --- a/modules/hal_nordic/nrfx/Kconfig +++ b/modules/hal_nordic/nrfx/Kconfig @@ -921,16 +921,6 @@ config NRFX_TWIM22 depends on $(dt_nodelabel_exists,i2c22) select NRFX_TWIM -config NRFX_TWIM23 - bool "TWIM23 driver instance" - depends on $(dt_nodelabel_exists,i2c23) - select NRFX_TWIM - -config NRFX_TWIM24 - bool "TWIM24 driver instance" - depends on $(dt_nodelabel_exists,i2c24) - select NRFX_TWIM - config NRFX_TWIM30 bool "TWIM30 driver instance" depends on $(dt_nodelabel_exists,i2c30) @@ -1019,16 +1009,6 @@ config NRFX_TWIS22 depends on $(dt_nodelabel_exists,i2c22) select NRFX_TWIS -config NRFX_TWIS23 - bool "TWIS23 driver instance" - depends on $(dt_nodelabel_exists,i2c23) - select NRFX_TWIS - -config NRFX_TWIS24 - bool "TWIS24 driver instance" - depends on $(dt_nodelabel_exists,i2c24) - select NRFX_TWIS - config NRFX_TWIS30 bool "TWIS30 driver instance" depends on $(dt_nodelabel_exists,i2c30) diff --git a/modules/hal_nordic/nrfx/nrfx_kconfig.h b/modules/hal_nordic/nrfx/nrfx_kconfig.h index 191855b3ff0e..ed1948a3931d 100644 --- a/modules/hal_nordic/nrfx/nrfx_kconfig.h +++ b/modules/hal_nordic/nrfx/nrfx_kconfig.h @@ -759,12 +759,6 @@ #ifdef CONFIG_NRFX_TWIM22 #define NRFX_TWIM22_ENABLED 1 #endif -#ifdef CONFIG_NRFX_TWIM23 -#define NRFX_TWIM23_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_TWIM24 -#define NRFX_TWIM24_ENABLED 1 -#endif #ifdef CONFIG_NRFX_TWIM30 #define NRFX_TWIM30_ENABLED 1 #endif @@ -829,12 +823,6 @@ #ifdef CONFIG_NRFX_TWIS22 #define NRFX_TWIS22_ENABLED 1 #endif -#ifdef CONFIG_NRFX_TWIS23 -#define NRFX_TWIS23_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_TWIS24 -#define NRFX_TWIS24_ENABLED 1 -#endif #ifdef CONFIG_NRFX_TWIS30 #define NRFX_TWIS30_ENABLED 1 #endif diff --git a/soc/nordic/common/Kconfig.peripherals b/soc/nordic/common/Kconfig.peripherals index 083fcc4e0891..900effed1416 100644 --- a/soc/nordic/common/Kconfig.peripherals +++ b/soc/nordic/common/Kconfig.peripherals @@ -514,12 +514,6 @@ config HAS_HW_NRF_TWIM21 config HAS_HW_NRF_TWIM22 def_bool $(dt_nodelabel_enabled_with_compat,i2c22,$(DT_COMPAT_NORDIC_NRF_TWIM)) -config HAS_HW_NRF_TWIM23 - def_bool $(dt_nodelabel_enabled_with_compat,i2c23,$(DT_COMPAT_NORDIC_NRF_TWIM)) - -config HAS_HW_NRF_TWIM24 - def_bool $(dt_nodelabel_enabled_with_compat,i2c24,$(DT_COMPAT_NORDIC_NRF_TWIM)) - config HAS_HW_NRF_TWIM30 def_bool $(dt_nodelabel_enabled_with_compat,i2c30,$(DT_COMPAT_NORDIC_NRF_TWIM)) @@ -571,12 +565,6 @@ config HAS_HW_NRF_TWIS21 config HAS_HW_NRF_TWIS22 def_bool $(dt_nodelabel_enabled_with_compat,i2c22,$(DT_COMPAT_NORDIC_NRF_TWIS)) -config HAS_HW_NRF_TWIS23 - def_bool $(dt_nodelabel_enabled_with_compat,i2c23,$(DT_COMPAT_NORDIC_NRF_TWIS)) - -config HAS_HW_NRF_TWIS24 - def_bool $(dt_nodelabel_enabled_with_compat,i2c24,$(DT_COMPAT_NORDIC_NRF_TWIS)) - config HAS_HW_NRF_TWIS30 def_bool $(dt_nodelabel_enabled_with_compat,i2c30,$(DT_COMPAT_NORDIC_NRF_TWIS)) diff --git a/soc/nordic/validate_base_addresses.c b/soc/nordic/validate_base_addresses.c index 1c5c39f74ec1..02413e3f174a 100644 --- a/soc/nordic/validate_base_addresses.c +++ b/soc/nordic/validate_base_addresses.c @@ -199,8 +199,6 @@ CHECK_DT_REG(i2c3, NRF_TWIM3); CHECK_DT_REG(i2c20, NRF_TWIM20); CHECK_DT_REG(i2c21, NRF_TWIM21); CHECK_DT_REG(i2c22, NRF_TWIM22); -CHECK_DT_REG(i2c23, NRF_TWIM23); -CHECK_DT_REG(i2c24, NRF_TWIM24); CHECK_DT_REG(i2c30, NRF_TWIM30); CHECK_DT_REG(i2c130, NRF_TWIM130); CHECK_DT_REG(i2c131, NRF_TWIM131); From bd768c45e3571b128183283a4718c865c5c6c749 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:08 +0300 Subject: [PATCH 1509/2141] Revert "[nrf fromtree] manifest: Update bsim to version v2.7" This reverts commit ea07de464e8e94723feab6389c418037660b6eba. Signed-off-by: Jukka Rissanen --- west.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/west.yml b/west.yml index d3a70e368671..594f7db44b4e 100644 --- a/west.yml +++ b/west.yml @@ -37,7 +37,7 @@ manifest: remote: babblesim repo-path: base path: tools/bsim/components - revision: 2cfac3dca2071452ae481d115d8541880568753d + revision: d562cd57317d33531ee3655d84660c57b8dc64c9 groups: - babblesim - name: babblesim_ext_2G4_channel_NtNcable @@ -79,7 +79,7 @@ manifest: remote: babblesim repo-path: ext_2G4_libPhyComv1 path: tools/bsim/components/ext_2G4_libPhyComv1 - revision: e18e41e8e3fa9f996559ed98b9238a5702dcdd36 + revision: 15ae0f87fa049e04cbec48a866f3bc37d903f950 groups: - babblesim - name: babblesim_ext_2G4_modem_BLE_simple @@ -100,7 +100,7 @@ manifest: remote: babblesim repo-path: ext_2G4_phy_v1 path: tools/bsim/components/ext_2G4_phy_v1 - revision: 8964ed1eb94606c2ea555340907bdc5171793e65 + revision: dbfd6b068f3bde8e56dcea58b4e686a8efc01cbe groups: - babblesim - name: babblesim_ext_libCryptov1 @@ -112,7 +112,7 @@ manifest: - babblesim - name: bsim repo-path: babblesim-manifest - revision: 2ba22a0608ad9f46da1b96ee5121af357053c791 + revision: 193b8ba94cdc6ecbc3bb7fe80b87dee456e5eab0 path: tools/bsim groups: - babblesim From f382388a4b9cf40e9e6e14a23b7d29d585f17b6e Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:08 +0300 Subject: [PATCH 1510/2141] Revert "[nrf fromtree] manifest: Update nRF hw models to latest" This reverts commit e5563ce2e0c022280b3feaa450e64afb935764e0. Signed-off-by: Jukka Rissanen --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 594f7db44b4e..c394b576621f 100644 --- a/west.yml +++ b/west.yml @@ -325,7 +325,7 @@ manifest: groups: - tools - name: nrf_hw_models - revision: 968d55ff22579080466bf2f482596dd6e35361c6 + revision: 9eb489fdcde23d4f69ded78bca872bfc31b5ee79 path: modules/bsim_hw_models/nrf_hw_models - name: nrf_wifi revision: 7cb2f44f46dfc86e4f97477ee90022944e138dd8 From 8205c7d30295cb4a92bdc2264c33bdd64e4edbc1 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:08 +0300 Subject: [PATCH 1511/2141] Revert "[nrf fromtree] manifest: Update nRF hw models to latest" This reverts commit 3a87edf0416b7d0bcff8beb90dc1b576f3d36092. Signed-off-by: Jukka Rissanen --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index c394b576621f..76ca9284ec89 100644 --- a/west.yml +++ b/west.yml @@ -325,7 +325,7 @@ manifest: groups: - tools - name: nrf_hw_models - revision: 9eb489fdcde23d4f69ded78bca872bfc31b5ee79 + revision: c6296f600a6851bd652f207ab4908d339e1ce705 path: modules/bsim_hw_models/nrf_hw_models - name: nrf_wifi revision: 7cb2f44f46dfc86e4f97477ee90022944e138dd8 From 82ee7e50b5cb5e5cffbe27d5d5ce235b388ac0f0 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:08 +0300 Subject: [PATCH 1512/2141] Revert "[nrf fromtree] tests: kernel: interrupt: Add ISR offset definitions for nrf9280" This reverts commit 23857cc300e7708a267e08a08be75ae9318cd5ee. Signed-off-by: Jukka Rissanen --- tests/kernel/interrupt/src/nested_irq.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tests/kernel/interrupt/src/nested_irq.c b/tests/kernel/interrupt/src/nested_irq.c index e1edfc3442fe..3e6a798e6042 100644 --- a/tests/kernel/interrupt/src/nested_irq.c +++ b/tests/kernel/interrupt/src/nested_irq.c @@ -66,12 +66,6 @@ #define IRQ0_LINE 14 #define IRQ1_LINE 15 -#define IRQ0_PRIO 1 -#define IRQ1_PRIO 2 -#elif defined(CONFIG_SOC_NRF9280_CPUPPR) -#define IRQ0_LINE 14 -#define IRQ1_LINE 15 - #define IRQ0_PRIO 1 #define IRQ1_PRIO 2 #else From 64dadf853e59d955316c55a2279ce0cd4c67e78c Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:08 +0300 Subject: [PATCH 1513/2141] Revert "[nrf fromtree] tests: kernel: gen_isr_table: Add ISR offset definitions for nrf9280" This reverts commit 49a70a2233f3d16691aaf928264bda4736d8e328. Signed-off-by: Jukka Rissanen --- tests/kernel/gen_isr_table/src/main.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tests/kernel/gen_isr_table/src/main.c b/tests/kernel/gen_isr_table/src/main.c index d3e3291573a7..d6b92731fc53 100644 --- a/tests/kernel/gen_isr_table/src/main.c +++ b/tests/kernel/gen_isr_table/src/main.c @@ -31,11 +31,6 @@ extern uintptr_t _irq_vector_table[]; #define ISR3_OFFSET 15 #define ISR5_OFFSET 16 #define TRIG_CHECK_SIZE 17 -#elif defined(CONFIG_SOC_NRF9280_CPUPPR) -#define ISR1_OFFSET 14 -#define ISR3_OFFSET 15 -#define ISR5_OFFSET 16 -#define TRIG_CHECK_SIZE 17 #else #error "Target not supported" #endif From 21ffae988fa399076abb6c30883796cfff4bdb8b Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:08 +0300 Subject: [PATCH 1514/2141] Revert "[nrf fromtree] tests: drivers: adc: Enable adc test for nrf9280 iron" This reverts commit b45da2ee2795c53540503bd7850193237dc30183. Signed-off-by: Jukka Rissanen --- .../boards/nrf9280pdk_nrf9280_common.dtsi | 43 ------------------- .../boards/nrf9280pdk_nrf9280_cpuapp.overlay | 40 ++++++++++++++++- .../nrf9280pdk_nrf9280_cpuapp_iron.overlay | 7 --- 3 files changed, 38 insertions(+), 52 deletions(-) delete mode 100644 tests/drivers/adc/adc_api/boards/nrf9280pdk_nrf9280_common.dtsi delete mode 100644 tests/drivers/adc/adc_api/boards/nrf9280pdk_nrf9280_cpuapp_iron.overlay diff --git a/tests/drivers/adc/adc_api/boards/nrf9280pdk_nrf9280_common.dtsi b/tests/drivers/adc/adc_api/boards/nrf9280pdk_nrf9280_common.dtsi deleted file mode 100644 index d90e7fc93c17..000000000000 --- a/tests/drivers/adc/adc_api/boards/nrf9280pdk_nrf9280_common.dtsi +++ /dev/null @@ -1,43 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * Copyright (c) 2025 Nordic Semiconductor ASA - */ - -/ { - zephyr,user { - io-channels = <&adc 0>, <&adc 1>, <&adc 2>; - }; -}; - -&adc { - #address-cells = <1>; - #size-cells = <0>; - - channel@0 { - reg = <0>; - zephyr,gain = "ADC_GAIN_1_2"; - zephyr,reference = "ADC_REF_INTERNAL"; - zephyr,acquisition-time = ; - zephyr,input-positive = ; - zephyr,resolution = <10>; - }; - - channel@1 { - reg = <1>; - zephyr,gain = "ADC_GAIN_2"; - zephyr,reference = "ADC_REF_EXTERNAL0"; - zephyr,acquisition-time = ; - zephyr,input-positive = ; - zephyr,resolution = <10>; - }; - - channel@2 { - reg = <2>; - zephyr,gain = "ADC_GAIN_2_3"; - zephyr,reference = "ADC_REF_INTERNAL"; - zephyr,acquisition-time = ; - zephyr,input-positive = ; - zephyr,resolution = <10>; - }; -}; diff --git a/tests/drivers/adc/adc_api/boards/nrf9280pdk_nrf9280_cpuapp.overlay b/tests/drivers/adc/adc_api/boards/nrf9280pdk_nrf9280_cpuapp.overlay index cd9ca89b82a3..d9c1f965addb 100644 --- a/tests/drivers/adc/adc_api/boards/nrf9280pdk_nrf9280_cpuapp.overlay +++ b/tests/drivers/adc/adc_api/boards/nrf9280pdk_nrf9280_cpuapp.overlay @@ -1,7 +1,43 @@ /* * SPDX-License-Identifier: Apache-2.0 * - * Copyright (c) 2025 Nordic Semiconductor ASA + * Copyright (c) 2024 Nordic Semiconductor ASA */ -#include "nrf9280pdk_nrf9280_common.dtsi" +/ { + zephyr,user { + io-channels = <&adc 0>, <&adc 1>, <&adc 2>; + }; +}; + +&adc { + #address-cells = <1>; + #size-cells = <0>; + + channel@0 { + reg = <0>; + zephyr,gain = "ADC_GAIN_1_2"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,input-positive = ; + zephyr,resolution = <10>; + }; + + channel@1 { + reg = <1>; + zephyr,gain = "ADC_GAIN_2"; + zephyr,reference = "ADC_REF_EXTERNAL0"; + zephyr,acquisition-time = ; + zephyr,input-positive = ; + zephyr,resolution = <10>; + }; + + channel@2 { + reg = <2>; + zephyr,gain = "ADC_GAIN_1_2"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,input-positive = ; + zephyr,resolution = <10>; + }; +}; diff --git a/tests/drivers/adc/adc_api/boards/nrf9280pdk_nrf9280_cpuapp_iron.overlay b/tests/drivers/adc/adc_api/boards/nrf9280pdk_nrf9280_cpuapp_iron.overlay deleted file mode 100644 index cd9ca89b82a3..000000000000 --- a/tests/drivers/adc/adc_api/boards/nrf9280pdk_nrf9280_cpuapp_iron.overlay +++ /dev/null @@ -1,7 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * Copyright (c) 2025 Nordic Semiconductor ASA - */ - -#include "nrf9280pdk_nrf9280_common.dtsi" From 058a71a675dc7723772910b9f842e61f2e1c6edd Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:08 +0300 Subject: [PATCH 1515/2141] Revert "[nrf fromtree] tests: drivers: watchdog: Enable watchdog test for nrf9280 iron" This reverts commit 485f9d333cadafa94088b7119e43685edd41937c. Signed-off-by: Jukka Rissanen --- .../boards/nrf9280pdk_nrf9280_cpuapp_iron.overlay | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 tests/drivers/watchdog/wdt_basic_api/boards/nrf9280pdk_nrf9280_cpuapp_iron.overlay diff --git a/tests/drivers/watchdog/wdt_basic_api/boards/nrf9280pdk_nrf9280_cpuapp_iron.overlay b/tests/drivers/watchdog/wdt_basic_api/boards/nrf9280pdk_nrf9280_cpuapp_iron.overlay deleted file mode 100644 index 102abfc8ef27..000000000000 --- a/tests/drivers/watchdog/wdt_basic_api/boards/nrf9280pdk_nrf9280_cpuapp_iron.overlay +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright 2025 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -&wdt010 { - status = "okay"; -}; From 6f125a5b85621d460a47503e325c8e091d6d54a4 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:08 +0300 Subject: [PATCH 1516/2141] Revert "[nrf fromtree] samples: watchdog: Add nrf9280 iron to sample" This reverts commit 822c4d9ab28a5dccf531c406cea9c0848b73db1e. Signed-off-by: Jukka Rissanen --- .../boards/nrf9280pdk_nrf9280_cpuapp_iron.overlay | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 samples/drivers/watchdog/boards/nrf9280pdk_nrf9280_cpuapp_iron.overlay diff --git a/samples/drivers/watchdog/boards/nrf9280pdk_nrf9280_cpuapp_iron.overlay b/samples/drivers/watchdog/boards/nrf9280pdk_nrf9280_cpuapp_iron.overlay deleted file mode 100644 index 102abfc8ef27..000000000000 --- a/samples/drivers/watchdog/boards/nrf9280pdk_nrf9280_cpuapp_iron.overlay +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright 2025 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -&wdt010 { - status = "okay"; -}; From cba94a37f4aba3dc207f7023158c86e730073419 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:08 +0300 Subject: [PATCH 1517/2141] Revert "[nrf fromtree] drivers: firmware: nrf_ironside: Update doxygen header for API." This reverts commit dd8cf228f04843ffc655974343ef877466858e19. Signed-off-by: Jukka Rissanen --- include/zephyr/drivers/firmware/nrf_ironside/cpuconf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/zephyr/drivers/firmware/nrf_ironside/cpuconf.h b/include/zephyr/drivers/firmware/nrf_ironside/cpuconf.h index d769a319def7..e6f2150b6e22 100644 --- a/include/zephyr/drivers/firmware/nrf_ironside/cpuconf.h +++ b/include/zephyr/drivers/firmware/nrf_ironside/cpuconf.h @@ -53,7 +53,7 @@ BUILD_ASSERT(IRONSIDE_CPUCONF_NUM_ARGS <= NRF_IRONSIDE_CALL_NUM_ARGS); * @param cpu The CPU to be booted * @param vector_table Pointer to the vector table used to boot the CPU. * @param cpu_wait When this is true, the CPU will WAIT even if the CPU has clock. - * @param msg A message that can be placed in cpu's boot report. + * @param msg A message that can be placed in radiocore's boot report. * @param msg_size Size of the message in bytes. * * @note cpu_wait is only intended to be enabled for debug purposes From c249516b21e9378817f7cc12e2b7c4b5c221bcb1 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:08 +0300 Subject: [PATCH 1518/2141] Revert "[nrf fromtree] boards: nordic: add 'iron' board variant to application" This reverts commit 00e6cd3c040bf4379627057ea3fe413508e3f5ff. Signed-off-by: Jukka Rissanen --- boards/nordic/nrf9280pdk/Kconfig.defconfig | 10 --- boards/nordic/nrf9280pdk/Kconfig.nrf9280pdk | 8 +- boards/nordic/nrf9280pdk/board.yml | 2 - .../nrf9280pdk_nrf9280-ipc_conf_iron.dtsi | 30 ------- .../nrf9280pdk_nrf9280-memory_map_iron.dtsi | 79 ------------------- .../nrf9280pdk_nrf9280_cpuapp_iron.dts | 41 ---------- .../nrf9280pdk_nrf9280_cpuapp_iron.yaml | 23 ------ .../nrf9280pdk_nrf9280_cpuapp_iron_defconfig | 29 ------- 8 files changed, 3 insertions(+), 219 deletions(-) delete mode 100644 boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280-ipc_conf_iron.dtsi delete mode 100644 boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280-memory_map_iron.dtsi delete mode 100644 boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp_iron.dts delete mode 100644 boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp_iron.yaml delete mode 100644 boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp_iron_defconfig diff --git a/boards/nordic/nrf9280pdk/Kconfig.defconfig b/boards/nordic/nrf9280pdk/Kconfig.defconfig index ae7cb48cbc3b..d1252a0a3a2e 100644 --- a/boards/nordic/nrf9280pdk/Kconfig.defconfig +++ b/boards/nordic/nrf9280pdk/Kconfig.defconfig @@ -19,13 +19,3 @@ config ASSERT default n if ZTEST endif # BOARD_NRF9280PDK_NRF9280_CPUPPR - -if BOARD_NRF9280PDK_NRF9280_CPUAPP_IRON - -config ROM_START_OFFSET - default 0x800 if BOOTLOADER_MCUBOOT - -config FLASH_LOAD_OFFSET - default $(dt_nodelabel_reg_addr_hex,cpuapp_boot_partition) if !USE_DT_CODE_PARTITION - -endif # BOARD_NRF9280PDK_NRF9280_CPUAPP_IRON diff --git a/boards/nordic/nrf9280pdk/Kconfig.nrf9280pdk b/boards/nordic/nrf9280pdk/Kconfig.nrf9280pdk index d66fe31da884..54865a1b235e 100644 --- a/boards/nordic/nrf9280pdk/Kconfig.nrf9280pdk +++ b/boards/nordic/nrf9280pdk/Kconfig.nrf9280pdk @@ -2,9 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 config BOARD_NRF9280PDK - select SOC_NRF9280_CPUAPP if (BOARD_NRF9280PDK_NRF9280_CPUAPP || \ - BOARD_NRF9280PDK_NRF9280_CPUAPP_IRON) + select SOC_NRF9280_CPUAPP if BOARD_NRF9280PDK_NRF9280_CPUAPP select SOC_NRF9280_CPURAD if BOARD_NRF9280PDK_NRF9280_CPURAD - select SOC_NRF9280_CPUPPR if (BOARD_NRF9280PDK_NRF9280_CPUPPR || \ - BOARD_NRF9280PDK_NRF9280_CPUPPR_XIP) - select SOC_NRF9280_IRON if BOARD_NRF9280PDK_NRF9280_CPUAPP_IRON + select SOC_NRF9280_CPUPPR if BOARD_NRF9280PDK_NRF9280_CPUPPR || \ + BOARD_NRF9280PDK_NRF9280_CPUPPR_XIP diff --git a/boards/nordic/nrf9280pdk/board.yml b/boards/nordic/nrf9280pdk/board.yml index 2cce133d95c3..963eae59ba0f 100644 --- a/boards/nordic/nrf9280pdk/board.yml +++ b/boards/nordic/nrf9280pdk/board.yml @@ -7,5 +7,3 @@ board: variants: - name: xip cpucluster: cpuppr - - name: iron - cpucluster: cpuapp diff --git a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280-ipc_conf_iron.dtsi b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280-ipc_conf_iron.dtsi deleted file mode 100644 index a44db40538d2..000000000000 --- a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280-ipc_conf_iron.dtsi +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/* This file is to be merged with the original ipc_conf.dtsi in the future. */ - -/ { - ipc { - /delete-node/ ipc-1-2; - /delete-node/ ipc-1-3; - - cpusec_cpuapp_ipc: ipc-1-2 { - compatible = "nordic,ironside-call"; - memory-region = <&cpusec_cpuapp_ipc_shm>; - mboxes = <&cpusec_bellboard 12>, - <&cpuapp_bellboard 0>; - status = "disabled"; - }; - - cpusec_cpurad_ipc: ipc-1-3 { - compatible = "nordic,ironside-call"; - memory-region = <&cpusec_cpurad_ipc_shm>; - mboxes = <&cpusec_bellboard 18>, - <&cpurad_bellboard 0>; - status = "disabled"; - }; - }; -}; diff --git a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280-memory_map_iron.dtsi b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280-memory_map_iron.dtsi deleted file mode 100644 index aa95021d887c..000000000000 --- a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280-memory_map_iron.dtsi +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/* This file is to be merged with the original memory_map.dtsi in the future. - * The following nodes will be replaced: - */ -/delete-node/ &cpuapp_cpusys_ipc_shm; -/delete-node/ &cpusec_cpuapp_ipc_shm; -/delete-node/ &cpusys_cpuapp_ipc_shm; -/delete-node/ &cpuapp_rw_partitions; -/delete-node/ &cpuapp_rx_partitions; -/delete-node/ &cpurad_rx_partitions; - -/ { - reserved-memory { - cpuapp_cpusys_ipc_shm: memory@2f88f600 { - reg = <0x2f88f600 0x80>; - }; - - cpusys_cpuapp_ipc_shm: memory@2f88f680 { - reg = <0x2f88f680 0x80>; - }; - - cpusec_cpuapp_ipc_shm: memory@2f88fb80 { - reg = <0x2f88fb80 0x80>; - }; - - cpuapp_ironside_se_event_report: memory@2f88fc00 { - reg = <0x2f88fc00 0x100>; - }; - - cpuapp_ironside_se_boot_report: memory@2f88fd00 { - reg = <0x2f88fd00 0x200>; - }; - }; -}; - -&mram1x { - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cpuapp_boot_partition: partition@312000 { - reg = <0x312000 DT_SIZE_K(64)>; - }; - - cpuapp_slot0_partition: partition@322000 { - reg = <0x322000 DT_SIZE_K(336)>; - }; - - cpuapp_slot1_partition: partition@376000 { - reg = <0x376000 DT_SIZE_K(440)>; - }; - - cpuppr_code_partition: partition@3E4000 { - reg = <0x3E4000 DT_SIZE_K(64)>; - }; - - cpuflpr_code_partition: partition@3F4000 { - reg = <0x3F4000 DT_SIZE_K(48)>; - }; - - cpurad_slot0_partition: partition@400000 { - reg = <0x400000 DT_SIZE_K(336)>; - }; - - cpurad_slot1_partition: partition@454000 { - reg = <0x454000 DT_SIZE_K(336)>; - }; - - storage_partition: partition@600000 { - reg = <0x600000 DT_SIZE_K(40)>; - }; - }; -}; diff --git a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp_iron.dts b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp_iron.dts deleted file mode 100644 index a3ca908f59de..000000000000 --- a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp_iron.dts +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include "nrf9280pdk_nrf9280_cpuapp.dts" -#include "nrf9280pdk_nrf9280-ipc_conf_iron.dtsi" -#include "nrf9280pdk_nrf9280-memory_map_iron.dtsi" - -/delete-node/ &cpusec_cpurad_ipc; - -/ { - chosen { - zephyr,code-partition = &slot0_partition; - zephyr,uart-mcumgr = &uart136; - }; -}; - -&cpusec_bellboard { - status = "okay"; -}; - -&cpusec_cpuapp_ipc { - mbox-names = "tx", "rx"; - status = "okay"; -}; - -ironside_se_boot_report: &cpuapp_ironside_se_boot_report {}; - -boot_partition: &cpuapp_boot_partition { - label = "mcuboot"; -}; - -slot0_partition: &cpuapp_slot0_partition { - label = "image-0"; -}; - -slot1_partition: &cpuapp_slot1_partition { - label = "image-1"; -}; diff --git a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp_iron.yaml b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp_iron.yaml deleted file mode 100644 index 029f133993bf..000000000000 --- a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp_iron.yaml +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright (c) 2025 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -identifier: nrf9280pdk/nrf9280/cpuapp/iron -name: nRF9280-DK-nRF9280-Application -type: mcu -arch: arm -toolchain: - - gnuarmemb - - xtools - - zephyr -sysbuild: true -ram: 512 -flash: 1024 -supported: - - adc - - counter - - gpio - - i2c - - pwm - - spi - - watchdog - - usbd diff --git a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp_iron_defconfig b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp_iron_defconfig deleted file mode 100644 index 01f3bec39321..000000000000 --- a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp_iron_defconfig +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright (c) 2025 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -# Enable UART driver -CONFIG_SERIAL=y - -# Enable console -CONFIG_CONSOLE=y -CONFIG_UART_CONSOLE=y - -# Enable MPU -CONFIG_ARM_MPU=y - -# Enable hardware stack protection -CONFIG_HW_STACK_PROTECTION=y - -# MPU-based null-pointer dereferencing detection cannot be applied -# as the (0x0 - 0x400) region is unmapped for this target. -CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y - -# Enable cache -CONFIG_CACHE_MANAGEMENT=y -CONFIG_EXTERNAL_CACHE=y - -# Enable GPIO -CONFIG_GPIO=y - -# UICR generation is not supported, and when reintroduced will not use nrf-regtool. -CONFIG_NRF_REGTOOL_GENERATE_UICR=n From e9a4d18f106566be95c793578fef4e94cdafffb8 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:09 +0300 Subject: [PATCH 1519/2141] Revert "[nrf fromtree] soc: nordic: add support of 'iron' variant to application" This reverts commit 1535701627fddf03bcb01f90e9c003d2156db25f. Signed-off-by: Jukka Rissanen --- soc/nordic/nrf92/Kconfig | 4 ---- soc/nordic/nrf92/Kconfig.soc | 5 ----- soc/nordic/nrf92/soc.c | 6 +++++- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/soc/nordic/nrf92/Kconfig b/soc/nordic/nrf92/Kconfig index a7769c00b6f2..7fdf57d61c39 100644 --- a/soc/nordic/nrf92/Kconfig +++ b/soc/nordic/nrf92/Kconfig @@ -7,7 +7,6 @@ config SOC_SERIES_NRF92X select HAS_NRFS select HAS_NRFX select HAS_NORDIC_DRIVERS - select SOC_EARLY_INIT_HOOK if ARM select NRF_PLATFORM_HALTIUM config SOC_NRF9230_ENGB_CPUAPP @@ -49,6 +48,3 @@ config SOC_NRF9230_ENGB_CPURAD config SOC_NRF9230_ENGB_CPUPPR select RISCV_CORE_NORDIC_VPR - -config SOC_NRF9280_IRON - select EXPERIMENTAL if MCUBOOT diff --git a/soc/nordic/nrf92/Kconfig.soc b/soc/nordic/nrf92/Kconfig.soc index 49891687a297..99fc28643b74 100644 --- a/soc/nordic/nrf92/Kconfig.soc +++ b/soc/nordic/nrf92/Kconfig.soc @@ -62,10 +62,5 @@ config SOC_NRF9280_CPUPPR help nRF9280 CPUPPR -config SOC_NRF9280_IRON - bool - help - Indicates that local domain firmware is compatible with Nordic IRONside SE. - config SOC default "nrf9280" if SOC_NRF9280 diff --git a/soc/nordic/nrf92/soc.c b/soc/nordic/nrf92/soc.c index 3652b554711a..d9a54e4f1aa6 100644 --- a/soc/nordic/nrf92/soc.c +++ b/soc/nordic/nrf92/soc.c @@ -84,7 +84,7 @@ static int trim_hsfll(void) return 0; } -void soc_early_init_hook(void) +static int nordicsemi_nrf92_init(void) { sys_cache_instr_enable(); sys_cache_data_enable(); @@ -102,9 +102,13 @@ void soc_early_init_hook(void) nrf_spu_periph_perm_dmasec_set(spu, nrf_address_slave_get(ccm030_addr), true); #endif + + return 0; } void arch_busy_wait(uint32_t time_us) { nrfx_coredep_delay_us(time_us); } + +SYS_INIT(nordicsemi_nrf92_init, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); From 57bc194ca04da395e59fb6a72cad7360f28a41d2 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:09 +0300 Subject: [PATCH 1520/2141] Revert "[nrf fromtree] usb: device_next: allow to use label as interface string descriptor" This reverts commit 89d7a6fbd5a773a985fee7315de82922c3ceaf2a. Signed-off-by: Jukka Rissanen --- dts/bindings/usb/zephyr,hid-device.yaml | 7 +++--- samples/subsys/usb/hid-keyboard/app.overlay | 2 +- .../usb/hid-keyboard/large_in_report.overlay | 2 +- .../subsys/usb/hid-mouse/usbd_next.overlay | 2 +- subsys/usb/device_next/class/usbd_hid.c | 23 ------------------- 5 files changed, 7 insertions(+), 29 deletions(-) diff --git a/dts/bindings/usb/zephyr,hid-device.yaml b/dts/bindings/usb/zephyr,hid-device.yaml index 1b055cf18d2a..2d20b450986b 100644 --- a/dts/bindings/usb/zephyr,hid-device.yaml +++ b/dts/bindings/usb/zephyr,hid-device.yaml @@ -8,10 +8,11 @@ compatible: "zephyr,hid-device" include: base.yaml properties: - label: + interface-name: + type: string description: | - The string defined by the label property is also used for the USB device - interface string descriptor. + HID device name. When this property is present, a USB device will use it + as the string descriptor of the interface. protocol-code: type: string diff --git a/samples/subsys/usb/hid-keyboard/app.overlay b/samples/subsys/usb/hid-keyboard/app.overlay index 0905e8850bfd..0d3d2ee7bd85 100644 --- a/samples/subsys/usb/hid-keyboard/app.overlay +++ b/samples/subsys/usb/hid-keyboard/app.overlay @@ -7,7 +7,7 @@ / { hid_dev_0: hid_dev_0 { compatible = "zephyr,hid-device"; - label = "HID0"; + interface-name = "HID0"; protocol-code = "keyboard"; in-report-size = <64>; in-polling-period-us = <1000>; diff --git a/samples/subsys/usb/hid-keyboard/large_in_report.overlay b/samples/subsys/usb/hid-keyboard/large_in_report.overlay index 548342f4b3ea..93b47691a77f 100644 --- a/samples/subsys/usb/hid-keyboard/large_in_report.overlay +++ b/samples/subsys/usb/hid-keyboard/large_in_report.overlay @@ -7,7 +7,7 @@ / { hid_dev_0: hid_dev_0 { compatible = "zephyr,hid-device"; - label = "HID0"; + interface-name = "HID0"; in-report-size = <256>; in-polling-period-us = <1000>; }; diff --git a/samples/subsys/usb/hid-mouse/usbd_next.overlay b/samples/subsys/usb/hid-mouse/usbd_next.overlay index 86365a94ae54..ce74aa518796 100644 --- a/samples/subsys/usb/hid-mouse/usbd_next.overlay +++ b/samples/subsys/usb/hid-mouse/usbd_next.overlay @@ -7,7 +7,7 @@ / { hid_dev_0: hid_dev_0 { compatible = "zephyr,hid-device"; - label = "HID0"; + interface-name = "HID0"; protocol-code = "none"; in-polling-period-us = <1000>; in-report-size = <64>; diff --git a/subsys/usb/device_next/class/usbd_hid.c b/subsys/usb/device_next/class/usbd_hid.c index d5476a88ed69..fd10eba3c850 100644 --- a/subsys/usb/device_next/class/usbd_hid.c +++ b/subsys/usb/device_next/class/usbd_hid.c @@ -65,7 +65,6 @@ struct hid_device_config { struct usbd_class_data *c_data; struct net_buf_pool *pool_out; struct net_buf_pool *pool_in; - struct usbd_desc_node *const if_desc_data; const struct usb_desc_header **fs_desc; const struct usb_desc_header **hs_desc; }; @@ -489,21 +488,8 @@ static void *usbd_hid_get_desc(struct usbd_class_data *const c_data, static int usbd_hid_init(struct usbd_class_data *const c_data) { - struct usbd_context *uds_ctx = usbd_class_get_ctx(c_data); - const struct device *dev = usbd_class_get_private(c_data); - const struct hid_device_config *dcfg = dev->config; - struct usbd_hid_descriptor *const desc = dcfg->desc; - LOG_DBG("HID class %s init", c_data->name); - if (dcfg->if_desc_data != NULL && desc->if0.iInterface == 0) { - if (usbd_add_descriptor(uds_ctx, dcfg->if_desc_data)) { - LOG_ERR("Failed to add interface string descriptor"); - } else { - desc->if0.iInterface = usbd_str_desc_get_idx(dcfg->if_desc_data); - } - } - return 0; } @@ -764,12 +750,6 @@ static const struct hid_device_driver_api hid_device_api = { HID_OUT_POOL_DEFINE(n); \ USBD_HID_INTERFACE_DEFINE(n); \ \ - IF_ENABLED(DT_INST_NODE_HAS_PROP(n, label), ( \ - USBD_DESC_STRING_DEFINE(hid_if_desc_data_##n, \ - DT_INST_PROP(n, label), \ - USBD_DUT_STRING_INTERFACE); \ - )) \ - \ USBD_DEFINE_CLASS(hid_##n, \ &usbd_hid_api, \ (void *)DEVICE_DT_GET(DT_DRV_INST(n)), NULL); \ @@ -781,9 +761,6 @@ static const struct hid_device_driver_api hid_device_api = { .pool_out = HID_OUT_POOL_ADDR(n), \ .fs_desc = hid_fs_desc_##n, \ .hs_desc = hid_hs_desc_##n, \ - IF_ENABLED(DT_INST_NODE_HAS_PROP(n, label), ( \ - .if_desc_data = &hid_if_desc_data_##n, \ - )) \ }; \ \ static struct hid_device_data hid_data_##n; \ From 613027fb4bde0d494b23b46214875413fa204ecd Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:09 +0300 Subject: [PATCH 1521/2141] Revert "[nrf fromtree] usb: device_next: bt_hci: do not take semaphore if transfer enqueue fail" This reverts commit ed400c8eb9edfa1a894d9526c7d1105e1b4bd7e5. Signed-off-by: Jukka Rissanen --- subsys/usb/device_next/class/bt_hci.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/subsys/usb/device_next/class/bt_hci.c b/subsys/usb/device_next/class/bt_hci.c index 7a2dc6da5985..c78e64bbfe1f 100644 --- a/subsys/usb/device_next/class/bt_hci.c +++ b/subsys/usb/device_next/class/bt_hci.c @@ -189,12 +189,8 @@ static void bt_hci_tx_sync_in(struct usbd_class_data *const c_data, } net_buf_add_mem(buf, bt_buf->data, bt_buf->len); - if (usbd_ep_enqueue(c_data, buf)) { - LOG_ERR("Failed to enqueue transfer"); - } else { - k_sem_take(&hci_data->sync_sem, K_FOREVER); - } - + usbd_ep_enqueue(c_data, buf); + k_sem_take(&hci_data->sync_sem, K_FOREVER); net_buf_unref(buf); } From 14d7782ec62e4566ce8dc566b3f86fe2dbb4fd8a Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:09 +0300 Subject: [PATCH 1522/2141] Revert "[nrf fromtree] usb: device: fix Bluetooth buffer handling" This reverts commit eef332c0fd5bcd7e5902f7802b7d9a1fe467de64. Signed-off-by: Jukka Rissanen --- subsys/usb/device/class/bluetooth.c | 12 +++--- subsys/usb/device_next/class/bt_hci.c | 56 +++++++-------------------- 2 files changed, 19 insertions(+), 49 deletions(-) diff --git a/subsys/usb/device/class/bluetooth.c b/subsys/usb/device/class/bluetooth.c index 7edd4792749b..33774eef90d7 100644 --- a/subsys/usb/device/class/bluetooth.c +++ b/subsys/usb/device/class/bluetooth.c @@ -154,20 +154,20 @@ static void hci_tx_thread(void *p1, void *p2, void *p3) type = net_buf_pull_u8(buf); switch (type) { - case BT_HCI_H4_EVT: + case BT_BUF_EVT: usb_transfer_sync( bluetooth_ep_data[HCI_INT_EP_IDX].ep_addr, buf->data, buf->len, USB_TRANS_WRITE | USB_TRANS_NO_ZLP); break; - case BT_HCI_H4_ACL: + case BT_BUF_ACL_IN: usb_transfer_sync( bluetooth_ep_data[HCI_IN_EP_IDX].ep_addr, buf->data, buf->len, USB_TRANS_WRITE); break; default: - LOG_ERR("Unsupported type %u", type); + LOG_ERR("Unknown type %u", type); break; } @@ -200,11 +200,11 @@ static uint16_t hci_acl_pkt_len(const uint8_t *data, size_t data_len) struct bt_hci_acl_hdr *acl_hdr; size_t hdr_len = sizeof(*acl_hdr); - if (data_len < hdr_len) { + if (data_len - 1 < hdr_len) { return 0; } - acl_hdr = (struct bt_hci_acl_hdr *)data; + acl_hdr = (struct bt_hci_acl_hdr *)(data + 1); return sys_le16_to_cpu(acl_hdr->len) + hdr_len; } @@ -250,7 +250,7 @@ static void acl_read_cb(uint8_t ep, int size, void *priv) LOG_DBG("len %u, chunk %u", buf->len, size); } - if (buf != NULL && pkt_len == buf->len - 1) { + if (buf != NULL && pkt_len == buf->len) { k_fifo_put(&rx_queue, buf); LOG_DBG("put"); buf = NULL; diff --git a/subsys/usb/device_next/class/bt_hci.c b/subsys/usb/device_next/class/bt_hci.c index c78e64bbfe1f..13665c78a1df 100644 --- a/subsys/usb/device_next/class/bt_hci.c +++ b/subsys/usb/device_next/class/bt_hci.c @@ -210,14 +210,14 @@ static void bt_hci_tx_thread(void *p1, void *p2, void *p3) type = net_buf_pull_u8(bt_buf); switch (type) { - case BT_HCI_H4_EVT: + case BT_BUF_EVT: ep = bt_hci_get_int_in(c_data); break; - case BT_HCI_H4_ACL: + case BT_BUF_ACL_IN: ep = bt_hci_get_bulk_in(c_data); break; default: - LOG_ERR("Unsupported type %u", type); + LOG_ERR("Unknown type %u", type); continue; } @@ -273,43 +273,19 @@ static int bt_hci_acl_out_start(struct usbd_class_data *const c_data) return ret; } -static uint16_t hci_pkt_get_len(const uint8_t h4_type, - const uint8_t *data, const size_t size) +static uint16_t hci_acl_pkt_len(struct net_buf *const buf) { - size_t hdr_len = 0; - uint16_t len = 0; + struct bt_hci_acl_hdr *acl_hdr; + size_t hdr_len; - switch (h4_type) { - case BT_HCI_H4_CMD: { - struct bt_hci_cmd_hdr *cmd_hdr; - - hdr_len = sizeof(*cmd_hdr); - cmd_hdr = (struct bt_hci_cmd_hdr *)data; - len = cmd_hdr->param_len + hdr_len; - break; - } - case BT_HCI_H4_ACL: { - struct bt_hci_acl_hdr *acl_hdr; - - hdr_len = sizeof(*acl_hdr); - acl_hdr = (struct bt_hci_acl_hdr *)data; - len = sys_le16_to_cpu(acl_hdr->len) + hdr_len; - break; - } - case BT_HCI_H4_ISO: { - struct bt_hci_iso_hdr *iso_hdr; - - hdr_len = sizeof(*iso_hdr); - iso_hdr = (struct bt_hci_iso_hdr *)data; - len = bt_iso_hdr_len(sys_le16_to_cpu(iso_hdr->len)) + hdr_len; - break; - } - default: - LOG_ERR("Unknown H4 buffer type"); + hdr_len = sizeof(*acl_hdr); + if (buf->len - 1 < hdr_len) { return 0; } - return (size < hdr_len) ? 0 : len; + acl_hdr = (struct bt_hci_acl_hdr *)(buf->data + 1); + + return sys_le16_to_cpu(acl_hdr->len) + hdr_len; } static int bt_hci_acl_out_cb(struct usbd_class_data *const c_data, @@ -329,9 +305,7 @@ static int bt_hci_acl_out_cb(struct usbd_class_data *const c_data, goto restart_out_transfer; } - hci_data->acl_len = hci_pkt_get_len(BT_HCI_H4_ACL, - buf->data, - buf->len); + hci_data->acl_len = hci_acl_pkt_len(hci_data->acl_buf); LOG_DBG("acl_len %u, chunk %u", hci_data->acl_len, buf->len); @@ -356,11 +330,7 @@ static int bt_hci_acl_out_cb(struct usbd_class_data *const c_data, LOG_INF("len %u, chunk %u", hci_data->acl_buf->len, buf->len); } - /* - * The buffer obtained from bt_buf_get_tx() stores the type at the top. - * Take this into account when comparing received data length. - */ - if (hci_data->acl_buf != NULL && hci_data->acl_len == hci_data->acl_buf->len - 1) { + if (hci_data->acl_buf != NULL && hci_data->acl_len == hci_data->acl_buf->len) { k_fifo_put(&bt_hci_rx_queue, hci_data->acl_buf); hci_data->acl_buf = NULL; hci_data->acl_len = 0; From 9aad05d03e4e428b81d82cb478a2e6b4311185a2 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:09 +0300 Subject: [PATCH 1523/2141] Revert "[nrf fromtree] usb: device_next: fix the null pointer dereference on FS devices" This reverts commit bd5002b5d9c8b224f6a730aa6a69ec264017cf71. Signed-off-by: Jukka Rissanen --- subsys/usb/device_next/usbd_ch9.c | 17 ++++++----------- subsys/usb/device_next/usbd_device.c | 10 ---------- 2 files changed, 6 insertions(+), 21 deletions(-) diff --git a/subsys/usb/device_next/usbd_ch9.c b/subsys/usb/device_next/usbd_ch9.c index 3adb3574f0cb..c9f806960d75 100644 --- a/subsys/usb/device_next/usbd_ch9.c +++ b/subsys/usb/device_next/usbd_ch9.c @@ -683,6 +683,12 @@ static int sreq_get_dev_qualifier(struct usbd_context *const uds_ctx, struct usb_device_qualifier_descriptor q_desc = { .bLength = sizeof(struct usb_device_qualifier_descriptor), .bDescriptorType = USB_DESC_DEVICE_QUALIFIER, + .bcdUSB = d_desc->bcdUSB, + .bDeviceClass = d_desc->bDeviceClass, + .bDeviceSubClass = d_desc->bDeviceSubClass, + .bDeviceProtocol = d_desc->bDeviceProtocol, + .bMaxPacketSize0 = d_desc->bMaxPacketSize0, + .bNumConfigurations = d_desc->bNumConfigurations, .bReserved = 0U, }; size_t len; @@ -697,17 +703,6 @@ static int sreq_get_dev_qualifier(struct usbd_context *const uds_ctx, return 0; } - if (d_desc == NULL) { - return -EINVAL; - } - - q_desc.bcdUSB = d_desc->bcdUSB; - q_desc.bDeviceClass = d_desc->bDeviceClass; - q_desc.bDeviceSubClass = d_desc->bDeviceSubClass; - q_desc.bDeviceProtocol = d_desc->bDeviceProtocol; - q_desc.bMaxPacketSize0 = d_desc->bMaxPacketSize0; - q_desc.bNumConfigurations = d_desc->bNumConfigurations; - LOG_DBG("Get Device Qualifier"); len = MIN(setup->wLength, net_buf_tailroom(buf)); net_buf_add_mem(buf, &q_desc, MIN(len, q_desc.bLength)); diff --git a/subsys/usb/device_next/usbd_device.c b/subsys/usb/device_next/usbd_device.c index fcb689a5c567..bb011e0731c7 100644 --- a/subsys/usb/device_next/usbd_device.c +++ b/subsys/usb/device_next/usbd_device.c @@ -66,11 +66,6 @@ int usbd_device_set_bcd_usb(struct usbd_context *const uds_ctx, } desc = get_device_descriptor(uds_ctx, speed); - if (desc == NULL) { - ret = -EINVAL; - goto set_bcd_exit; - } - desc->bcdUSB = sys_cpu_to_le16(bcd); set_bcd_exit: @@ -172,11 +167,6 @@ int usbd_device_set_code_triple(struct usbd_context *const uds_ctx, } desc = get_device_descriptor(uds_ctx, speed); - if (desc == NULL) { - ret = -EINVAL; - goto set_code_triple_exit; - } - desc->bDeviceClass = base_class; desc->bDeviceSubClass = subclass; desc->bDeviceProtocol = protocol; From 4f2f51fa1ef26d78b4909a8cc69258baafc3ad8a Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:09 +0300 Subject: [PATCH 1524/2141] Revert "[nrf fromtree] samples: boards: nordic: clock_control: add resolve and startup time" This reverts commit d052f3e3f9f168b02efc9621430d0546598023cb. Signed-off-by: Jukka Rissanen --- .../boards/nordic/clock_control/src/main.c | 39 ++++--------------- 1 file changed, 7 insertions(+), 32 deletions(-) diff --git a/samples/boards/nordic/clock_control/src/main.c b/samples/boards/nordic/clock_control/src/main.c index d2823db92ac4..ebaaa0cecbd6 100644 --- a/samples/boards/nordic/clock_control/src/main.c +++ b/samples/boards/nordic/clock_control/src/main.c @@ -45,13 +45,6 @@ int main(void) int res; int64_t req_start_uptime; int64_t req_stop_uptime; - struct nrf_clock_spec res_spec; - const struct nrf_clock_spec req_spec = { - .frequency = CONFIG_SAMPLE_CLOCK_FREQUENCY_HZ, - .accuracy = CONFIG_SAMPLE_CLOCK_ACCURACY_PPM, - .precision = CONFIG_SAMPLE_CLOCK_PRECISION, - }; - uint32_t startup_time_us; printk("\n"); printk("clock name: %s\n", SAMPLE_CLOCK_NAME); @@ -59,29 +52,11 @@ int main(void) printk("minimum accuracy request: %uPPM\n", CONFIG_SAMPLE_CLOCK_ACCURACY_PPM); printk("minimum precision request: %u\n", CONFIG_SAMPLE_CLOCK_PRECISION); - printk("\n"); - ret = nrf_clock_control_resolve(sample_clock_dev, &req_spec, &res_spec); - if (ret == 0) { - printk("resolved frequency request: %uHz\n", res_spec.frequency); - printk("resolved accuracy request: %uPPM\n", res_spec.accuracy); - printk("resolved precision request: %u\n", res_spec.precision); - } else if (ret == -ENOSYS) { - printk("resolve not supported\n"); - } else { - printk("minimum clock specs could not be resolved\n"); - return 0; - } - - printk("\n"); - ret = nrf_clock_control_get_startup_time(sample_clock_dev, &req_spec, &startup_time_us); - if (ret == 0) { - printk("startup time for requested spec: %uus\n", startup_time_us); - } else if (ret == -ENOSYS) { - printk("get startup time not supported\n"); - } else { - printk("failed to get startup time\n"); - return 0; - } + const struct nrf_clock_spec spec = { + .frequency = CONFIG_SAMPLE_CLOCK_FREQUENCY_HZ, + .accuracy = CONFIG_SAMPLE_CLOCK_ACCURACY_PPM, + .precision = CONFIG_SAMPLE_CLOCK_PRECISION, + }; sys_notify_init_callback(&cli.notify, sample_notify_cb); @@ -90,7 +65,7 @@ int main(void) printk("\n"); printk("requesting minimum clock specs\n"); req_start_uptime = k_uptime_get(); - ret = nrf_clock_control_request(sample_clock_dev, &req_spec, &cli); + ret = nrf_clock_control_request(sample_clock_dev, &spec, &cli); if (ret < 0) { printk("minimum clock specs could not be met\n"); return 0; @@ -120,7 +95,7 @@ int main(void) printk("\n"); printk("releasing requested clock specs\n"); - ret = nrf_clock_control_release(sample_clock_dev, &req_spec); + ret = nrf_clock_control_release(sample_clock_dev, &spec); if (ret < 0) { printk("failed to release requested clock specs\n"); return 0; From 9696f18b2aa66f8121821bc437f7449894ae7577 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:09 +0300 Subject: [PATCH 1525/2141] Revert "[nrf fromtree] drivers: clock_control: nrf2_global_hsfll: impl resolve" This reverts commit 542922847fcbded7337b25062b75607fe5330d92. Signed-off-by: Jukka Rissanen --- .../clock_control_nrf2_global_hsfll.c | 80 +++++-------------- 1 file changed, 19 insertions(+), 61 deletions(-) diff --git a/drivers/clock_control/clock_control_nrf2_global_hsfll.c b/drivers/clock_control/clock_control_nrf2_global_hsfll.c index 30a64ea9fdc2..50f3396429c1 100644 --- a/drivers/clock_control/clock_control_nrf2_global_hsfll.c +++ b/drivers/clock_control/clock_control_nrf2_global_hsfll.c @@ -62,69 +62,43 @@ static uint32_t global_hsfll_get_max_clock_frequency(const struct device *dev) return dev_config->clock_frequencies[ARRAY_SIZE(dev_config->clock_frequencies) - 1]; } -static int global_hsfll_resolve_spec_to_idx(const struct device *dev, - const struct nrf_clock_spec *req_spec) +static struct onoff_manager *global_hsfll_find_mgr(const struct device *dev, + const struct nrf_clock_spec *spec) { + struct global_hsfll_dev_data *dev_data = dev->data; const struct global_hsfll_dev_config *dev_config = dev->config; - uint32_t req_frequency; + uint32_t frequency; + + if (!spec) { + return &dev_data->clk_cfg.onoff[0].mgr; + } - if (req_spec->accuracy || req_spec->precision) { + if (spec->accuracy || spec->precision) { LOG_ERR("invalid specification of accuracy or precision"); - return -EINVAL; + return NULL; } - req_frequency = req_spec->frequency == NRF_CLOCK_CONTROL_FREQUENCY_MAX - ? global_hsfll_get_max_clock_frequency(dev) - : req_spec->frequency; + frequency = spec->frequency == NRF_CLOCK_CONTROL_FREQUENCY_MAX + ? global_hsfll_get_max_clock_frequency(dev) + : spec->frequency; for (uint8_t i = 0; i < ARRAY_SIZE(dev_config->clock_frequencies); i++) { - if (dev_config->clock_frequencies[i] < req_frequency) { + if (dev_config->clock_frequencies[i] < frequency) { continue; } - return i; + return &dev_data->clk_cfg.onoff[i].mgr; } LOG_ERR("invalid frequency"); - return -EINVAL; -} - -static void global_hsfll_get_spec_by_idx(const struct device *dev, - uint8_t idx, - struct nrf_clock_spec *spec) -{ - const struct global_hsfll_dev_config *dev_config = dev->config; - - spec->frequency = dev_config->clock_frequencies[idx]; - spec->accuracy = 0; - spec->precision = 0; -} - -static struct onoff_manager *global_hsfll_get_mgr_by_idx(const struct device *dev, uint8_t idx) -{ - struct global_hsfll_dev_data *dev_data = dev->data; - - return &dev_data->clk_cfg.onoff[idx].mgr; -} - -static struct onoff_manager *global_hsfll_find_mgr_by_spec(const struct device *dev, - const struct nrf_clock_spec *spec) -{ - int idx; - - if (!spec) { - return global_hsfll_get_mgr_by_idx(dev, 0); - } - - idx = global_hsfll_resolve_spec_to_idx(dev, spec); - return idx < 0 ? NULL : global_hsfll_get_mgr_by_idx(dev, idx); + return NULL; } static int api_request_global_hsfll(const struct device *dev, const struct nrf_clock_spec *spec, struct onoff_client *cli) { - struct onoff_manager *mgr = global_hsfll_find_mgr_by_spec(dev, spec); + struct onoff_manager *mgr = global_hsfll_find_mgr(dev, spec); if (mgr) { return clock_config_request(mgr, cli); @@ -136,7 +110,7 @@ static int api_request_global_hsfll(const struct device *dev, static int api_release_global_hsfll(const struct device *dev, const struct nrf_clock_spec *spec) { - struct onoff_manager *mgr = global_hsfll_find_mgr_by_spec(dev, spec); + struct onoff_manager *mgr = global_hsfll_find_mgr(dev, spec); if (mgr) { return onoff_release(mgr); @@ -149,7 +123,7 @@ static int api_cancel_or_release_global_hsfll(const struct device *dev, const struct nrf_clock_spec *spec, struct onoff_client *cli) { - struct onoff_manager *mgr = global_hsfll_find_mgr_by_spec(dev, spec); + struct onoff_manager *mgr = global_hsfll_find_mgr(dev, spec); if (mgr) { return onoff_cancel_or_release(mgr, cli); @@ -158,21 +132,6 @@ static int api_cancel_or_release_global_hsfll(const struct device *dev, return -EINVAL; } -static int api_resolve_global_hsfll(const struct device *dev, - const struct nrf_clock_spec *req_spec, - struct nrf_clock_spec *res_spec) -{ - int idx; - - idx = global_hsfll_resolve_spec_to_idx(dev, req_spec); - if (idx < 0) { - return -EINVAL; - } - - global_hsfll_get_spec_by_idx(dev, idx, res_spec); - return 0; -} - static DEVICE_API(nrf_clock_control, driver_api) = { .std_api = { .on = api_nosys_on_off, @@ -181,7 +140,6 @@ static DEVICE_API(nrf_clock_control, driver_api) = { .request = api_request_global_hsfll, .release = api_release_global_hsfll, .cancel_or_release = api_cancel_or_release_global_hsfll, - .resolve = api_resolve_global_hsfll, }; static enum gdfs_frequency_setting global_hsfll_freq_idx_to_nrfs_freq(const struct device *dev, From 741ac79afe6b4040d8dad4cc6fe93bac26899e6f Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:09 +0300 Subject: [PATCH 1526/2141] Revert "[nrf fromtree] drivers: clock_control: nrf2_hsfll: impl resolve" This reverts commit 6398757ca7aa7350a2591c28ca9e2ecc9cd29528. Signed-off-by: Jukka Rissanen --- .../clock_control/clock_control_nrf2_hsfll.c | 79 +++++-------------- 1 file changed, 19 insertions(+), 60 deletions(-) diff --git a/drivers/clock_control/clock_control_nrf2_hsfll.c b/drivers/clock_control/clock_control_nrf2_hsfll.c index e8f8449b24d0..eb2dfde989c7 100644 --- a/drivers/clock_control/clock_control_nrf2_hsfll.c +++ b/drivers/clock_control/clock_control_nrf2_hsfll.c @@ -100,56 +100,35 @@ static void hsfll_work_handler(struct k_work *work) k_timer_start(&dev_data->timer, NRFS_DVFS_TIMEOUT, K_NO_WAIT); } -static int hsfll_resolve_spec_to_idx(const struct nrf_clock_spec *req_spec) +static struct onoff_manager *hsfll_find_mgr(const struct device *dev, + const struct nrf_clock_spec *spec) { - uint32_t req_frequency; + struct hsfll_dev_data *dev_data = dev->data; + uint32_t frequency; + + if (!spec) { + return &dev_data->clk_cfg.onoff[0].mgr; + } - if (req_spec->accuracy || req_spec->precision) { + if (spec->accuracy || spec->precision) { LOG_ERR("invalid specification of accuracy or precision"); - return -EINVAL; + return NULL; } - req_frequency = req_spec->frequency == NRF_CLOCK_CONTROL_FREQUENCY_MAX - ? HSFLL_FREQ_HIGH - : req_spec->frequency; + frequency = spec->frequency == NRF_CLOCK_CONTROL_FREQUENCY_MAX + ? HSFLL_FREQ_HIGH + : spec->frequency; for (int i = 0; i < ARRAY_SIZE(clock_options); ++i) { - if (req_frequency > clock_options[i].frequency) { + if (frequency > clock_options[i].frequency) { continue; } - return i; + return &dev_data->clk_cfg.onoff[i].mgr; } LOG_ERR("invalid frequency"); - return -EINVAL; -} - -static void hsfll_get_spec_by_idx(uint8_t idx, struct nrf_clock_spec *spec) -{ - spec->frequency = clock_options[idx].frequency; - spec->accuracy = 0; - spec->precision = 0; -} - -static struct onoff_manager *hsfll_get_mgr_by_idx(const struct device *dev, uint8_t idx) -{ - struct hsfll_dev_data *dev_data = dev->data; - - return &dev_data->clk_cfg.onoff[idx].mgr; -} - -static struct onoff_manager *hsfll_find_mgr_by_spec(const struct device *dev, - const struct nrf_clock_spec *spec) -{ - int idx; - - if (!spec) { - return hsfll_get_mgr_by_idx(dev, 0); - } - - idx = hsfll_resolve_spec_to_idx(spec); - return idx < 0 ? NULL : hsfll_get_mgr_by_idx(dev, idx); + return NULL; } #endif /* CONFIG_NRFS_DVFS_LOCAL_DOMAIN */ @@ -158,7 +137,7 @@ static int api_request_hsfll(const struct device *dev, struct onoff_client *cli) { #ifdef CONFIG_NRFS_DVFS_LOCAL_DOMAIN - struct onoff_manager *mgr = hsfll_find_mgr_by_spec(dev, spec); + struct onoff_manager *mgr = hsfll_find_mgr(dev, spec); if (mgr) { return clock_config_request(mgr, cli); @@ -174,7 +153,7 @@ static int api_release_hsfll(const struct device *dev, const struct nrf_clock_spec *spec) { #ifdef CONFIG_NRFS_DVFS_LOCAL_DOMAIN - struct onoff_manager *mgr = hsfll_find_mgr_by_spec(dev, spec); + struct onoff_manager *mgr = hsfll_find_mgr(dev, spec); if (mgr) { return onoff_release(mgr); @@ -191,7 +170,7 @@ static int api_cancel_or_release_hsfll(const struct device *dev, struct onoff_client *cli) { #ifdef CONFIG_NRFS_DVFS_LOCAL_DOMAIN - struct onoff_manager *mgr = hsfll_find_mgr_by_spec(dev, spec); + struct onoff_manager *mgr = hsfll_find_mgr(dev, spec); if (mgr) { return onoff_cancel_or_release(mgr, cli); @@ -203,25 +182,6 @@ static int api_cancel_or_release_hsfll(const struct device *dev, #endif } -static int api_resolve_hsfll(const struct device *dev, - const struct nrf_clock_spec *req_spec, - struct nrf_clock_spec *res_spec) -{ -#ifdef CONFIG_NRFS_DVFS_LOCAL_DOMAIN - int idx; - - idx = hsfll_resolve_spec_to_idx(req_spec); - if (idx < 0) { - return -EINVAL; - } - - hsfll_get_spec_by_idx(idx, res_spec); - return 0; -#else - return -ENOTSUP; -#endif -} - static int hsfll_init(const struct device *dev) { #ifdef CONFIG_NRFS_DVFS_LOCAL_DOMAIN @@ -252,7 +212,6 @@ static DEVICE_API(nrf_clock_control, hsfll_drv_api) = { .request = api_request_hsfll, .release = api_release_hsfll, .cancel_or_release = api_cancel_or_release_hsfll, - .resolve = api_resolve_hsfll, }; #ifdef CONFIG_NRFS_DVFS_LOCAL_DOMAIN From afba747e59a914499e1d95317fb24f80a2b0eb76 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:09 +0300 Subject: [PATCH 1527/2141] Revert "[nrf fromtree] drivers: clock_control: nrf2_fll16m: impl resolve and startup_time" This reverts commit 4346d85612360baac5de171aa1131bf4e65aa823. Signed-off-by: Jukka Rissanen --- .../clock_control/clock_control_nrf2_fll16m.c | 132 +++--------------- dts/bindings/clock/nordic,nrf-fll16m.yaml | 6 - dts/vendor/nordic/nrf54h20.dtsi | 1 - 3 files changed, 22 insertions(+), 117 deletions(-) diff --git a/drivers/clock_control/clock_control_nrf2_fll16m.c b/drivers/clock_control/clock_control_nrf2_fll16m.c index 92b09804b8a7..7bb10263d5b6 100644 --- a/drivers/clock_control/clock_control_nrf2_fll16m.c +++ b/drivers/clock_control/clock_control_nrf2_fll16m.c @@ -34,7 +34,6 @@ BUILD_ASSERT(FLL16M_MODE_CLOSED_LOOP == NRF_LRCCONF_CLK_SRC_CLOSED_LOOP); #define FLL16M_HFXO_ACCURACY DT_PROP(FLL16M_HFXO_NODE, accuracy_ppm) #define FLL16M_OPEN_LOOP_ACCURACY DT_INST_PROP(0, open_loop_accuracy_ppm) #define FLL16M_MAX_ACCURACY FLL16M_HFXO_ACCURACY -#define FLL16M_OPEN_LOOP_STARTUP_TIME_US DT_INST_PROP(0, open_loop_startup_time_us) #define BICR (NRF_BICR_Type *)DT_REG_ADDR(DT_NODELABEL(bicr)) @@ -58,7 +57,6 @@ struct fll16m_dev_data { STRUCT_CLOCK_CONFIG(fll16m, ARRAY_SIZE(clock_options)) clk_cfg; struct onoff_client hfxo_cli; sys_snode_t fll16m_node; - uint32_t bypass_startup_time_us; }; struct fll16m_dev_config { @@ -135,98 +133,49 @@ static void fll16m_work_handler(struct k_work *work) } } -static int fll16m_resolve_spec_to_idx(const struct device *dev, - const struct nrf_clock_spec *req_spec) +static struct onoff_manager *fll16m_find_mgr(const struct device *dev, + const struct nrf_clock_spec *spec) { + struct fll16m_dev_data *dev_data = dev->data; const struct fll16m_dev_config *dev_config = dev->config; - uint16_t req_accuracy; + uint16_t accuracy; + + if (!spec) { + return &dev_data->clk_cfg.onoff[0].mgr; + } - if (req_spec->frequency > dev_config->fixed_frequency) { + if (spec->frequency > dev_config->fixed_frequency) { LOG_ERR("invalid frequency"); - return -EINVAL; + return NULL; } - if (req_spec->precision) { + if (spec->precision) { LOG_ERR("invalid precision"); - return -EINVAL; + return NULL; } - req_accuracy = req_spec->accuracy == NRF_CLOCK_CONTROL_ACCURACY_MAX - ? FLL16M_MAX_ACCURACY - : req_spec->accuracy; + accuracy = spec->accuracy == NRF_CLOCK_CONTROL_ACCURACY_MAX + ? FLL16M_MAX_ACCURACY + : spec->accuracy; for (int i = 0; i < ARRAY_SIZE(clock_options); ++i) { - if (req_accuracy && - req_accuracy < clock_options[i].accuracy) { + if (accuracy && + accuracy < clock_options[i].accuracy) { continue; } - return i; + return &dev_data->clk_cfg.onoff[i].mgr; } LOG_ERR("invalid accuracy"); - return -EINVAL; -} - -static void fll16m_get_spec_by_idx(const struct device *dev, - uint8_t idx, - struct nrf_clock_spec *spec) -{ - const struct fll16m_dev_config *dev_config = dev->config; - - spec->frequency = dev_config->fixed_frequency; - spec->accuracy = clock_options[idx].accuracy; - spec->precision = NRF_CLOCK_CONTROL_PRECISION_DEFAULT; -} - -static int fll16m_get_startup_time_by_idx(const struct device *dev, - uint8_t idx, - uint32_t *startup_time_us) -{ - const struct fll16m_dev_data *dev_data = dev->data; - uint8_t mode = clock_options[idx].mode; - - switch (mode) { - case FLL16M_MODE_OPEN_LOOP: - *startup_time_us = FLL16M_OPEN_LOOP_STARTUP_TIME_US; - return 0; - - case FLL16M_MODE_BYPASS: - *startup_time_us = dev_data->bypass_startup_time_us; - return 0; - - default: - break; - } - - return -EINVAL; -} - -static struct onoff_manager *fll16m_get_mgr_by_idx(const struct device *dev, uint8_t idx) -{ - struct fll16m_dev_data *dev_data = dev->data; - - return &dev_data->clk_cfg.onoff[idx].mgr; -} - -static struct onoff_manager *fll16m_find_mgr_by_spec(const struct device *dev, - const struct nrf_clock_spec *spec) -{ - int idx; - - if (!spec) { - return fll16m_get_mgr_by_idx(dev, 0); - } - - idx = fll16m_resolve_spec_to_idx(dev, spec); - return idx < 0 ? NULL : fll16m_get_mgr_by_idx(dev, idx); + return NULL; } static int api_request_fll16m(const struct device *dev, const struct nrf_clock_spec *spec, struct onoff_client *cli) { - struct onoff_manager *mgr = fll16m_find_mgr_by_spec(dev, spec); + struct onoff_manager *mgr = fll16m_find_mgr(dev, spec); if (mgr) { return clock_config_request(mgr, cli); @@ -238,7 +187,7 @@ static int api_request_fll16m(const struct device *dev, static int api_release_fll16m(const struct device *dev, const struct nrf_clock_spec *spec) { - struct onoff_manager *mgr = fll16m_find_mgr_by_spec(dev, spec); + struct onoff_manager *mgr = fll16m_find_mgr(dev, spec); if (mgr) { return onoff_release(mgr); @@ -251,7 +200,7 @@ static int api_cancel_or_release_fll16m(const struct device *dev, const struct nrf_clock_spec *spec, struct onoff_client *cli) { - struct onoff_manager *mgr = fll16m_find_mgr_by_spec(dev, spec); + struct onoff_manager *mgr = fll16m_find_mgr(dev, spec); if (mgr) { return onoff_cancel_or_release(mgr, cli); @@ -273,45 +222,10 @@ static int api_get_rate_fll16m(const struct device *dev, return 0; } -static int api_resolve(const struct device *dev, - const struct nrf_clock_spec *req_spec, - struct nrf_clock_spec *res_spec) -{ - int idx; - - idx = fll16m_resolve_spec_to_idx(dev, req_spec); - if (idx < 0) { - return -EINVAL; - } - - fll16m_get_spec_by_idx(dev, idx, res_spec); - return 0; -} - -static int api_get_startup_time(const struct device *dev, - const struct nrf_clock_spec *spec, - uint32_t *startup_time_us) -{ - int idx; - - idx = fll16m_resolve_spec_to_idx(dev, spec); - if (idx < 0) { - return -EINVAL; - } - - return fll16m_get_startup_time_by_idx(dev, idx, startup_time_us); -} - static int fll16m_init(const struct device *dev) { struct fll16m_dev_data *dev_data = dev->data; - dev_data->bypass_startup_time_us = nrf_bicr_hfxo_startup_time_us_get(BICR); - if (dev_data->bypass_startup_time_us == NRF_BICR_HFXO_STARTUP_TIME_UNCONFIGURED) { - LOG_ERR("BICR HFXO startup time invalid"); - return -ENODEV; - } - return clock_config_init(&dev_data->clk_cfg, ARRAY_SIZE(dev_data->clk_cfg.onoff), fll16m_work_handler); @@ -326,8 +240,6 @@ static DEVICE_API(nrf_clock_control, fll16m_drv_api) = { .request = api_request_fll16m, .release = api_release_fll16m, .cancel_or_release = api_cancel_or_release_fll16m, - .resolve = api_resolve, - .get_startup_time = api_get_startup_time, }; static struct fll16m_dev_data fll16m_data; diff --git a/dts/bindings/clock/nordic,nrf-fll16m.yaml b/dts/bindings/clock/nordic,nrf-fll16m.yaml index cfbbb0c40932..4f23a7a1de1b 100644 --- a/dts/bindings/clock/nordic,nrf-fll16m.yaml +++ b/dts/bindings/clock/nordic,nrf-fll16m.yaml @@ -18,7 +18,6 @@ description: | fll16m { open-loop-accuracy-ppm = <20000>; - open-loop-startup-time-us = <400>; clocks = <&hfxo>, <&lfxo>; clock-names = "hfxo", "lfxo"; }; @@ -35,8 +34,3 @@ properties: type: int description: Clock accuracy in parts per million required: true - - open-loop-startup-time-us: - type: int - description: Clock startup time if open-loop clock source is used. - required: true diff --git a/dts/vendor/nordic/nrf54h20.dtsi b/dts/vendor/nordic/nrf54h20.dtsi index 37a6a3f394bb..3db33dd3c5a9 100644 --- a/dts/vendor/nordic/nrf54h20.dtsi +++ b/dts/vendor/nordic/nrf54h20.dtsi @@ -177,7 +177,6 @@ #clock-cells = <0>; clock-frequency = ; open-loop-accuracy-ppm = <20000>; - open-loop-startup-time-us = <200>; /* To be measured */ clocks = <&hfxo>, <&lfxo>; clock-names = "hfxo", "lfxo"; }; From 4ed69d680ec6148559d1aecb81864545e6bb5e24 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:09 +0300 Subject: [PATCH 1528/2141] Revert "[nrf fromtree] drivers: clock_control: nrf2_lfclk: impl resolve and startup_time" This reverts commit 3bc9d24a1b307971397199da2b7ffcb3769a115b. Signed-off-by: Jukka Rissanen --- .../clock_control/clock_control_nrf2_lfclk.c | 152 +++--------------- dts/bindings/clock/nordic,nrf-fll16m.yaml | 3 +- dts/bindings/clock/nordic,nrf-lfclk.yaml | 10 -- dts/vendor/nordic/nrf54h20.dtsi | 2 - 4 files changed, 21 insertions(+), 146 deletions(-) diff --git a/drivers/clock_control/clock_control_nrf2_lfclk.c b/drivers/clock_control/clock_control_nrf2_lfclk.c index 6be9deee6576..c5f70c1497ba 100644 --- a/drivers/clock_control/clock_control_nrf2_lfclk.c +++ b/drivers/clock_control/clock_control_nrf2_lfclk.c @@ -22,8 +22,6 @@ BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) == 1, #define LFCLK_LFLPRC_ACCURACY DT_INST_PROP(0, lflprc_accuracy_ppm) #define LFCLK_LFRC_ACCURACY DT_INST_PROP(0, lfrc_accuracy_ppm) #define LFCLK_HFXO_ACCURACY DT_PROP(LFCLK_HFXO_NODE, accuracy_ppm) -#define LFCLK_LFLPRC_STARTUP_TIME_US DT_INST_PROP(0, lflprc_startup_time_us) -#define LFCLK_LFRC_STARTUP_TIME_US DT_INST_PROP(0, lfrc_startup_time_us) #define LFCLK_MAX_OPTS 5 #define LFCLK_DEF_OPTS 3 @@ -61,8 +59,6 @@ struct lfclk_dev_data { struct k_timer timer; uint16_t max_accuracy; uint8_t clock_options_cnt; - uint32_t hfxo_startup_time_us; - uint32_t lfxo_startup_time_us; }; struct lfclk_dev_config { @@ -109,108 +105,45 @@ static void lfclk_work_handler(struct k_work *work) } } -static int lfclk_resolve_spec_to_idx(const struct device *dev, - const struct nrf_clock_spec *req_spec) +static struct onoff_manager *lfclk_find_mgr(const struct device *dev, + const struct nrf_clock_spec *spec) { struct lfclk_dev_data *dev_data = dev->data; const struct lfclk_dev_config *dev_config = dev->config; - uint16_t req_accuracy; + uint16_t accuracy; - if (req_spec->frequency > dev_config->fixed_frequency) { + if (!spec) { + return &dev_data->clk_cfg.onoff[0].mgr; + } + + if (spec->frequency > dev_config->fixed_frequency) { LOG_ERR("invalid frequency"); - return -EINVAL; + return NULL; } - req_accuracy = req_spec->accuracy == NRF_CLOCK_CONTROL_ACCURACY_MAX - ? dev_data->max_accuracy - : req_spec->accuracy; + accuracy = spec->accuracy == NRF_CLOCK_CONTROL_ACCURACY_MAX + ? dev_data->max_accuracy + : spec->accuracy; for (int i = 0; i < dev_data->clock_options_cnt; ++i) { - if ((req_accuracy && - req_accuracy < clock_options[i].accuracy) || - req_spec->precision > clock_options[i].precision) { + if ((accuracy && + accuracy < clock_options[i].accuracy) || + spec->precision > clock_options[i].precision) { continue; } - return i; + return &dev_data->clk_cfg.onoff[i].mgr; } LOG_ERR("invalid accuracy or precision"); - return -EINVAL; -} - -static void lfclk_get_spec_by_idx(const struct device *dev, - uint8_t idx, - struct nrf_clock_spec *spec) -{ - const struct lfclk_dev_config *dev_config = dev->config; - - spec->frequency = dev_config->fixed_frequency; - spec->accuracy = clock_options[idx].accuracy; - spec->precision = clock_options[idx].precision; -} - -static struct onoff_manager *lfclk_get_mgr_by_idx(const struct device *dev, uint8_t idx) -{ - struct lfclk_dev_data *dev_data = dev->data; - - return &dev_data->clk_cfg.onoff[idx].mgr; -} - -static int lfclk_get_startup_time_by_idx(const struct device *dev, - uint8_t idx, - uint32_t *startup_time_us) -{ - struct lfclk_dev_data *dev_data = dev->data; - nrfs_clock_src_t src = clock_options[idx].src; - - switch (src) { - case NRFS_CLOCK_SRC_LFCLK_LFLPRC: - *startup_time_us = LFCLK_LFLPRC_STARTUP_TIME_US; - return 0; - - case NRFS_CLOCK_SRC_LFCLK_LFRC: - *startup_time_us = LFCLK_LFRC_STARTUP_TIME_US; - return 0; - - case NRFS_CLOCK_SRC_LFCLK_XO_PIXO: - case NRFS_CLOCK_SRC_LFCLK_XO_PIERCE: - case NRFS_CLOCK_SRC_LFCLK_XO_EXT_SINE: - case NRFS_CLOCK_SRC_LFCLK_XO_EXT_SQUARE: - case NRFS_CLOCK_SRC_LFCLK_XO_PIERCE_HP: - case NRFS_CLOCK_SRC_LFCLK_XO_EXT_SINE_HP: - *startup_time_us = dev_data->lfxo_startup_time_us; - return 0; - - case NRFS_CLOCK_SRC_LFCLK_SYNTH: - *startup_time_us = dev_data->hfxo_startup_time_us; - return 0; - - default: - break; - } - - return -EINVAL; -} - -static struct onoff_manager *lfclk_find_mgr_by_spec(const struct device *dev, - const struct nrf_clock_spec *spec) -{ - int idx; - - if (!spec) { - return lfclk_get_mgr_by_idx(dev, 0); - } - - idx = lfclk_resolve_spec_to_idx(dev, spec); - return idx < 0 ? NULL : lfclk_get_mgr_by_idx(dev, idx); + return NULL; } static int api_request_lfclk(const struct device *dev, const struct nrf_clock_spec *spec, struct onoff_client *cli) { - struct onoff_manager *mgr = lfclk_find_mgr_by_spec(dev, spec); + struct onoff_manager *mgr = lfclk_find_mgr(dev, spec); if (mgr) { return clock_config_request(mgr, cli); @@ -222,7 +155,7 @@ static int api_request_lfclk(const struct device *dev, static int api_release_lfclk(const struct device *dev, const struct nrf_clock_spec *spec) { - struct onoff_manager *mgr = lfclk_find_mgr_by_spec(dev, spec); + struct onoff_manager *mgr = lfclk_find_mgr(dev, spec); if (mgr) { return onoff_release(mgr); @@ -235,7 +168,7 @@ static int api_cancel_or_release_lfclk(const struct device *dev, const struct nrf_clock_spec *spec, struct onoff_client *cli) { - struct onoff_manager *mgr = lfclk_find_mgr_by_spec(dev, spec); + struct onoff_manager *mgr = lfclk_find_mgr(dev, spec); if (mgr) { return onoff_cancel_or_release(mgr, cli); @@ -244,36 +177,6 @@ static int api_cancel_or_release_lfclk(const struct device *dev, return -EINVAL; } - -static int api_resolve(const struct device *dev, - const struct nrf_clock_spec *req_spec, - struct nrf_clock_spec *res_spec) -{ - int idx; - - idx = lfclk_resolve_spec_to_idx(dev, req_spec); - if (idx < 0) { - return -EINVAL; - } - - lfclk_get_spec_by_idx(dev, idx, res_spec); - return 0; -} - -static int api_get_startup_time(const struct device *dev, - const struct nrf_clock_spec *spec, - uint32_t *startup_time_us) -{ - int idx; - - idx = lfclk_resolve_spec_to_idx(dev, spec); - if (idx < 0) { - return -EINVAL; - } - - return lfclk_get_startup_time_by_idx(dev, idx, startup_time_us); -} - static int api_get_rate_lfclk(const struct device *dev, clock_control_subsys_t sys, uint32_t *rate) @@ -348,19 +251,6 @@ static int lfclk_init(const struct device *dev) LOG_ERR("Unexpected LFOSC mode"); return -EINVAL; } - - dev_data->lfxo_startup_time_us = nrf_bicr_lfosc_startup_time_ms_get(BICR) - * USEC_PER_MSEC; - if (dev_data->lfxo_startup_time_us == NRF_BICR_LFOSC_STARTUP_TIME_UNCONFIGURED) { - LOG_ERR("BICR LFXO startup time invalid"); - return -ENODEV; - } - } - - dev_data->hfxo_startup_time_us = nrf_bicr_hfxo_startup_time_us_get(BICR); - if (dev_data->hfxo_startup_time_us == NRF_BICR_HFXO_STARTUP_TIME_UNCONFIGURED) { - LOG_ERR("BICR HFXO startup time invalid"); - return -ENODEV; } k_timer_init(&dev_data->timer, lfclk_update_timeout_handler, NULL); @@ -379,8 +269,6 @@ static DEVICE_API(nrf_clock_control, lfclk_drv_api) = { .request = api_request_lfclk, .release = api_release_lfclk, .cancel_or_release = api_cancel_or_release_lfclk, - .resolve = api_resolve, - .get_startup_time = api_get_startup_time, }; static struct lfclk_dev_data lfclk_data; diff --git a/dts/bindings/clock/nordic,nrf-fll16m.yaml b/dts/bindings/clock/nordic,nrf-fll16m.yaml index 4f23a7a1de1b..8c7187965ae5 100644 --- a/dts/bindings/clock/nordic,nrf-fll16m.yaml +++ b/dts/bindings/clock/nordic,nrf-fll16m.yaml @@ -32,5 +32,4 @@ properties: open-loop-accuracy-ppm: type: int - description: Clock accuracy in parts per million - required: true + description: Clock accuracy in parts per million if open-loop clock source is used. diff --git a/dts/bindings/clock/nordic,nrf-lfclk.yaml b/dts/bindings/clock/nordic,nrf-lfclk.yaml index a0f95d6c9277..f7df4d8a435e 100644 --- a/dts/bindings/clock/nordic,nrf-lfclk.yaml +++ b/dts/bindings/clock/nordic,nrf-lfclk.yaml @@ -21,8 +21,6 @@ description: | lfclk { lfrc-accuracy-ppm = <500>; lflprc-accuracy-ppm = <1000>; - lfrc-startup-time-us = <400>; - lflprc-startup-time-us = <400>; clocks = <&hfxo>, <&lfxo>; clock-names = "hfxo", "lfxo"; }; @@ -42,11 +40,3 @@ properties: lflprc-accuracy-ppm: type: int description: Clock accuracy in parts per million if LFLPRC clock source is used. - - lfrc-startup-time-us: - type: int - description: Clock startup time in microseconds if LFRC clock source is used. - - lflprc-startup-time-us: - type: int - description: Clock startup time in microseconds if LFLPRC clock source is used. diff --git a/dts/vendor/nordic/nrf54h20.dtsi b/dts/vendor/nordic/nrf54h20.dtsi index 3db33dd3c5a9..5fcb941aaae2 100644 --- a/dts/vendor/nordic/nrf54h20.dtsi +++ b/dts/vendor/nordic/nrf54h20.dtsi @@ -199,8 +199,6 @@ status = "okay"; lfrc-accuracy-ppm = <500>; lflprc-accuracy-ppm = <1000>; - lfrc-startup-time-us = <200>; /* To be measured */ - lflprc-startup-time-us = <200>; /* To be measured */ clocks = <&hfxo>, <&lfxo>; clock-names = "hfxo", "lfxo"; }; From dc7a395e78df0bf76d18cd0422e3d8ab5ec738b5 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:09 +0300 Subject: [PATCH 1529/2141] Revert "[nrf fromtree] drivers: clock_control: nrf2_hfxo: impl resolve and startup_time" This reverts commit 4c363f3cf6f0294fb2ace3eafccb610dd3c1a444. Signed-off-by: Jukka Rissanen --- .../clock_control/clock_control_nrf2_hfxo.c | 35 ------------------- 1 file changed, 35 deletions(-) diff --git a/drivers/clock_control/clock_control_nrf2_hfxo.c b/drivers/clock_control/clock_control_nrf2_hfxo.c index 1c8d6f8ed181..21d3d33f7e8d 100644 --- a/drivers/clock_control/clock_control_nrf2_hfxo.c +++ b/drivers/clock_control/clock_control_nrf2_hfxo.c @@ -271,39 +271,6 @@ static int init_hfxo(const struct device *dev) return 0; } -static int api_resolve(const struct device *dev, - const struct nrf_clock_spec *req_spec, - struct nrf_clock_spec *res_spec) -{ - const struct dev_config_hfxo *dev_config = dev->config; - - if (!is_clock_spec_valid(dev, req_spec)) { - return -EINVAL; - } - - res_spec->frequency = dev_config->fixed_frequency; - res_spec->accuracy = dev_config->fixed_accuracy; - res_spec->precision = NRF_CLOCK_CONTROL_PRECISION_HIGH; - return 0; -} - -static int api_get_startup_time(const struct device *dev, - const struct nrf_clock_spec *spec, - uint32_t *startup_time_us) -{ - if (!is_clock_spec_valid(dev, spec)) { - return -EINVAL; - } - - *startup_time_us = nrf_bicr_hfxo_startup_time_us_get(BICR); - - if (*startup_time_us == NRF_BICR_HFXO_STARTUP_TIME_UNCONFIGURED) { - return -EINVAL; - } - - return 0; -} - static DEVICE_API(nrf_clock_control, drv_api_hfxo) = { .std_api = { .on = api_nosys_on_off, @@ -313,8 +280,6 @@ static DEVICE_API(nrf_clock_control, drv_api_hfxo) = { .request = api_request_hfxo, .release = api_release_hfxo, .cancel_or_release = api_cancel_or_release_hfxo, - .resolve = api_resolve, - .get_startup_time = api_get_startup_time, }; static struct dev_data_hfxo data_hfxo; From 3cbc2f257eff6d9893e8db02b0372868a06ea6a3 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:09 +0300 Subject: [PATCH 1530/2141] Revert "[nrf fromtree] drivers: clock_control: nrf_clock_control: introduce startup time" This reverts commit a73cec112a62c1e7bd66b7bb0e2d9a5d0b910824. Signed-off-by: Jukka Rissanen --- .../drivers/clock_control/nrf_clock_control.h | 26 ------------------- 1 file changed, 26 deletions(-) diff --git a/include/zephyr/drivers/clock_control/nrf_clock_control.h b/include/zephyr/drivers/clock_control/nrf_clock_control.h index d12dca3c074f..a50128cad43c 100644 --- a/include/zephyr/drivers/clock_control/nrf_clock_control.h +++ b/include/zephyr/drivers/clock_control/nrf_clock_control.h @@ -207,9 +207,6 @@ __subsystem struct nrf_clock_control_driver_api { int (*resolve)(const struct device *dev, const struct nrf_clock_spec *req_spec, struct nrf_clock_spec *res_spec); - int (*get_startup_time)(const struct device *dev, - const struct nrf_clock_spec *spec, - uint32_t *startup_time_us); }; /** @@ -354,29 +351,6 @@ static inline int nrf_clock_control_resolve(const struct device *dev, return api->resolve(dev, req_spec, res_spec); } -/** - * @brief Get the startup timme of a clock. - * - * @param dev Device structure. - * @param startup_time_us Destination for startup time in microseconds. - * - * @retval Successful if successful. - * @retval -errno code if failure. - */ -static inline int nrf_clock_control_get_startup_time(const struct device *dev, - const struct nrf_clock_spec *spec, - uint32_t *startup_time_us) -{ - const struct nrf_clock_control_driver_api *api = - (const struct nrf_clock_control_driver_api *)dev->api; - - if (api->get_startup_time == NULL) { - return -ENOSYS; - } - - return api->get_startup_time(dev, spec, startup_time_us); -} - /** @brief Request the HFXO from Zero Latency Interrupt context. * * Function is optimized for use in Zero Latency Interrupt context. From 5aaa56cda1783b3dff331b8cda16259ba845fc8b Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:09 +0300 Subject: [PATCH 1531/2141] Revert "[nrf fromtree] drivers: clock_control: nrf_clock_control: introduce resolve API" This reverts commit 7c93a60e3b88af43e5af9b92b432067623a55768. Signed-off-by: Jukka Rissanen --- .../drivers/clock_control/nrf_clock_control.h | 27 ------------------- 1 file changed, 27 deletions(-) diff --git a/include/zephyr/drivers/clock_control/nrf_clock_control.h b/include/zephyr/drivers/clock_control/nrf_clock_control.h index a50128cad43c..bbc581f96c49 100644 --- a/include/zephyr/drivers/clock_control/nrf_clock_control.h +++ b/include/zephyr/drivers/clock_control/nrf_clock_control.h @@ -204,9 +204,6 @@ __subsystem struct nrf_clock_control_driver_api { int (*cancel_or_release)(const struct device *dev, const struct nrf_clock_spec *spec, struct onoff_client *cli); - int (*resolve)(const struct device *dev, - const struct nrf_clock_spec *req_spec, - struct nrf_clock_spec *res_spec); }; /** @@ -327,30 +324,6 @@ int nrf_clock_control_cancel_or_release(const struct device *dev, return api->cancel_or_release(dev, spec, cli); } -/** - * @brief Resolve a requested clock spec to resulting spec. - * - * @param dev Device structure. - * @param req_spec The requested clock specification. - * @param res_spec Destination for the resulting clock specification. - * - * @retval Successful if successful. - * @retval -errno code if failure - */ -static inline int nrf_clock_control_resolve(const struct device *dev, - const struct nrf_clock_spec *req_spec, - struct nrf_clock_spec *res_spec) -{ - const struct nrf_clock_control_driver_api *api = - (const struct nrf_clock_control_driver_api *)dev->api; - - if (api->resolve == NULL) { - return -ENOSYS; - } - - return api->resolve(dev, req_spec, res_spec); -} - /** @brief Request the HFXO from Zero Latency Interrupt context. * * Function is optimized for use in Zero Latency Interrupt context. From b3013cd46832f430e21daadd49b6d8c48c284ee7 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:09 +0300 Subject: [PATCH 1532/2141] Revert "[nrf fromtree] drivers: serial: nrfx_uarte: Add workaround for FRAMETIMEOUT corner case" This reverts commit 68df545336a99b9a7db9bc193d537c636ea989ec. Signed-off-by: Jukka Rissanen --- drivers/serial/uart_nrfx_uarte.c | 47 ++------------------------------ 1 file changed, 2 insertions(+), 45 deletions(-) diff --git a/drivers/serial/uart_nrfx_uarte.c b/drivers/serial/uart_nrfx_uarte.c index 55aea85f3d39..05ffa4535706 100644 --- a/drivers/serial/uart_nrfx_uarte.c +++ b/drivers/serial/uart_nrfx_uarte.c @@ -95,17 +95,6 @@ LOG_MODULE_REGISTER(uart_nrfx_uarte, CONFIG_UART_LOG_LEVEL); #define UARTE_HAS_FRAME_TIMEOUT 1 #endif -/* Frame timeout has a bug that countdown counter may not be triggered in some - * specific condition. It may happen if RX is manually started after ENDRX (STOPRX - * task was not triggered) and there is ongoing reception of a byte. RXDRDY event - * triggered by the reception of that byte may not trigger frame timeout counter. - * If this is the last byte of a transfer then without the workaround there will - * be no expected RX timeout. - */ -#ifdef UARTE_HAS_FRAME_TIMEOUT -#define RX_FRAMETIMEOUT_WORKAROUND 1 -#endif - #define INSTANCE_NEEDS_CACHE_MGMT(unused, prefix, i, prop) UARTE_IS_CACHEABLE(prefix##i) #if UARTE_FOR_EACH_INSTANCE(INSTANCE_NEEDS_CACHE_MGMT, (+), (0), _) @@ -262,8 +251,6 @@ struct uarte_nrfx_data { #define UARTE_FLAG_LOW_POWER (UARTE_FLAG_LOW_POWER_TX | UARTE_FLAG_LOW_POWER_RX) #define UARTE_FLAG_TRIG_RXTO BIT(2) #define UARTE_FLAG_POLL_OUT BIT(3) -/* Flag indicating that a workaround for not working frame timeout is active. */ -#define UARTE_FLAG_FTIMEOUT_WATCH BIT(4) /* If enabled then ENDTX is PPI'ed to TXSTOP */ #define UARTE_CFG_FLAG_PPI_ENDTX BIT(0) @@ -1330,22 +1317,9 @@ static void rx_timeout(struct k_timer *timer) NRF_UARTE_Type *uarte = get_uarte_instance(dev); #ifdef UARTE_HAS_FRAME_TIMEOUT - struct uarte_nrfx_data *data = dev->data; - struct uarte_async_rx *async_rx = &data->async->rx; - bool rxdrdy = nrf_uarte_event_check(uarte, NRF_UARTE_EVENT_RXDRDY); - - if (IS_ENABLED(RX_FRAMETIMEOUT_WORKAROUND) && - (atomic_and(&data->flags, ~UARTE_FLAG_FTIMEOUT_WATCH) & UARTE_FLAG_FTIMEOUT_WATCH)) { - if (rxdrdy) { - nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_RXDRDY); - k_timer_start(&async_rx->timer, async_rx->timeout, K_NO_WAIT); - } - } else { - if (!rxdrdy) { - nrf_uarte_task_trigger(uarte, NRF_UARTE_TASK_STOPRX); - } + if (!nrf_uarte_event_check(uarte, NRF_UARTE_EVENT_RXDRDY)) { + nrf_uarte_task_trigger(uarte, NRF_UARTE_TASK_STOPRX); } - return; #else /* UARTE_HAS_FRAME_TIMEOUT */ struct uarte_nrfx_data *data = dev->data; @@ -1571,7 +1545,6 @@ static void endrx_isr(const struct device *dev) async_rx->offset = 0; if (async_rx->enabled) { - bool start_timeout = false; /* If there is a next buffer, then STARTRX will have already been * invoked by the short (the next buffer will be filling up already) * and here we just do the swap of which buffer the driver is following, @@ -1597,11 +1570,6 @@ static void endrx_isr(const struct device *dev) */ if (!nrf_uarte_event_check(uarte, NRF_UARTE_EVENT_RXSTARTED)) { nrf_uarte_task_trigger(uarte, NRF_UARTE_TASK_STARTRX); - nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_RXTO); - if (IS_ENABLED(RX_FRAMETIMEOUT_WORKAROUND)) { - data->flags |= UARTE_FLAG_FTIMEOUT_WATCH; - start_timeout = true; - } } /* Remove the short until the subsequent next buffer is setup */ nrf_uarte_shorts_disable(uarte, NRF_UARTE_SHORT_ENDRX_STARTRX); @@ -1610,11 +1578,6 @@ static void endrx_isr(const struct device *dev) } irq_unlock(key); - if (IS_ENABLED(UARTE_HAS_FRAME_TIMEOUT)) { - if (start_timeout && !K_TIMEOUT_EQ(async_rx->timeout, K_NO_WAIT)) { - k_timer_start(&async_rx->timer, async_rx->timeout, K_NO_WAIT); - } - } } #if !defined(CONFIG_UART_NRFX_UARTE_ENHANCED_RX) @@ -1672,12 +1635,6 @@ static void rxto_isr(const struct device *dev) struct uarte_nrfx_data *data = dev->data; struct uarte_async_rx *async_rx = &data->async->rx; - if (IS_ENABLED(RX_FRAMETIMEOUT_WORKAROUND)) { - if (atomic_test_and_clear_bit(&data->flags, UARTE_FLAG_FTIMEOUT_WATCH)) { - k_timer_stop(&async_rx->timer); - } - } - if (async_rx->buf) { #ifdef CONFIG_HAS_NORDIC_DMM (void)dmm_buffer_in_release(config->mem_reg, async_rx->usr_buf, 0, async_rx->buf); From 9e91cb4856ef44e42f45345b4da6bb249a58160d Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:09 +0300 Subject: [PATCH 1533/2141] Revert "[nrf fromtree] net: sockets_offload: Fix build error with NO_OPTIMIZATIONS" This reverts commit 08ad1f291223f24d71a6345574f1d858f101e32c. Signed-off-by: Jukka Rissanen --- include/zephyr/net/socket_offload.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/zephyr/net/socket_offload.h b/include/zephyr/net/socket_offload.h index ad86de887f3d..4dcf27250b44 100644 --- a/include/zephyr/net/socket_offload.h +++ b/include/zephyr/net/socket_offload.h @@ -67,7 +67,10 @@ void socket_offload_dns_enable(bool enable); #if defined(CONFIG_NET_SOCKETS_OFFLOAD) bool socket_offload_dns_is_enabled(void); #else -#define socket_offload_dns_is_enabled() false +static inline bool socket_offload_dns_is_enabled(void) +{ + return false; +} #endif /* defined(CONFIG_NET_SOCKETS_OFFLOAD) */ From 4b392e99ff943a9aaed77fec2c4152b6f73c0626 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:09 +0300 Subject: [PATCH 1534/2141] Revert "[nrf fromtree] drivers: cache: nrf: Resolve NRF_CACHE_HAS_LINEADDR issue" This reverts commit bd14c2e7fe86abcccaf178f70005607cb98508cf. Signed-off-by: Jukka Rissanen --- drivers/cache/cache_nrf.c | 33 +++------------------------------ 1 file changed, 3 insertions(+), 30 deletions(-) diff --git a/drivers/cache/cache_nrf.c b/drivers/cache/cache_nrf.c index 6a9a4b6b49e4..3cf798978749 100644 --- a/drivers/cache/cache_nrf.c +++ b/drivers/cache/cache_nrf.c @@ -94,7 +94,6 @@ static inline int _cache_all(NRF_CACHE_Type *cache, enum k_nrf_cache_op op) return 0; } -#if NRF_CACHE_HAS_LINEADDR static inline void _cache_line(NRF_CACHE_Type *cache, enum k_nrf_cache_op op, uintptr_t line_addr) { do { @@ -161,7 +160,7 @@ static inline int _cache_checks(NRF_CACHE_Type *cache, enum k_nrf_cache_op op, v size_t size, bool is_range) { /* Check if the cache is enabled */ - if (!nrf_cache_enable_check(cache)) { + if (!(cache->ENABLE & CACHE_ENABLE_ENABLE_Enabled)) { return -EAGAIN; } @@ -176,16 +175,6 @@ static inline int _cache_checks(NRF_CACHE_Type *cache, enum k_nrf_cache_op op, v return _cache_range(cache, op, addr, size); } -#else -static inline int _cache_all_checks(NRF_CACHE_Type *cache, enum k_nrf_cache_op op) -{ - /* Check if the cache is enabled */ - if (!nrf_cache_enable_check(cache)) { - return -EAGAIN; - } - return _cache_all(cache, op); -} -#endif /* NRF_CACHE_HAS_LINEADDR */ #if defined(NRF_DCACHE) && NRF_CACHE_HAS_TASKS @@ -307,11 +296,7 @@ void cache_instr_disable(void) int cache_instr_flush_all(void) { #if NRF_CACHE_HAS_TASK_CLEAN -#if NRF_CACHE_HAS_LINEADDR return _cache_checks(NRF_ICACHE, K_NRF_CACHE_CLEAN, NULL, 0, false); -#else - return _cache_all_checks(NRF_ICACHE, K_NRF_CACHE_CLEAN); -#endif #else return -ENOTSUP; #endif @@ -319,21 +304,13 @@ int cache_instr_flush_all(void) int cache_instr_invd_all(void) { -#if NRF_CACHE_HAS_LINEADDR return _cache_checks(NRF_ICACHE, K_NRF_CACHE_INVD, NULL, 0, false); -#else - return _cache_all_checks(NRF_ICACHE, K_NRF_CACHE_INVD); -#endif } int cache_instr_flush_and_invd_all(void) { #if NRF_CACHE_HAS_TASK_FLUSH -#if NRF_CACHE_HAS_LINEADDR return _cache_checks(NRF_ICACHE, K_NRF_CACHE_FLUSH, NULL, 0, false); -#else - return _cache_all_checks(NRF_ICACHE, K_NRF_CACHE_FLUSH); -#endif #else return -ENOTSUP; #endif @@ -341,7 +318,7 @@ int cache_instr_flush_and_invd_all(void) int cache_instr_flush_range(void *addr, size_t size) { -#if NRF_CACHE_HAS_TASK_CLEAN && NRF_CACHE_HAS_LINEADDR +#if NRF_CACHE_HAS_TASK_CLEAN return _cache_checks(NRF_ICACHE, K_NRF_CACHE_CLEAN, addr, size, true); #else return -ENOTSUP; @@ -350,16 +327,12 @@ int cache_instr_flush_range(void *addr, size_t size) int cache_instr_invd_range(void *addr, size_t size) { -#if NRF_CACHE_HAS_LINEADDR return _cache_checks(NRF_ICACHE, K_NRF_CACHE_INVD, addr, size, true); -#else - return -ENOTSUP; -#endif } int cache_instr_flush_and_invd_range(void *addr, size_t size) { -#if NRF_CACHE_HAS_TASK_FLUSH && NRF_CACHE_HAS_LINEADDR +#if NRF_CACHE_HAS_TASK_FLUSH return _cache_checks(NRF_ICACHE, K_NRF_CACHE_FLUSH, addr, size, true); #else return -ENOTSUP; From 8fb9a23e136f10194226c17c3fe8e56724aabde9 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:10 +0300 Subject: [PATCH 1535/2141] Revert "[nrf fromlist] drivers: nrf_wifi: Add Kconfig for Dynamic ED" This reverts commit e69c07a1c917de8a5827f0cb77704226e9b015a4. Signed-off-by: Jukka Rissanen --- drivers/wifi/nrf_wifi/Kconfig.nrfwifi | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/wifi/nrf_wifi/Kconfig.nrfwifi b/drivers/wifi/nrf_wifi/Kconfig.nrfwifi index 8980cce82052..e0a39f2123e1 100644 --- a/drivers/wifi/nrf_wifi/Kconfig.nrfwifi +++ b/drivers/wifi/nrf_wifi/Kconfig.nrfwifi @@ -913,10 +913,4 @@ config NRF_WIFI_DYNAMIC_BANDWIDTH_SIGNALLING bool "Dynamic bandwidth signalling for Wi-Fi" help This option enables support for dynamic bandwidth signalling. - -config NRF_WIFI_DYNAMIC_ED - bool "Dynamic ED" - help - This option enables support for proprietary algorithm to - enhance performance in high-traffic channels. endif # WIFI_NRF70 From efb007b983d429ca00924610712d689f77eaa97b Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:10 +0300 Subject: [PATCH 1536/2141] Revert "[nrf fromlist] manifest: Update nrf_wifi for dynamic ED control" This reverts commit b3c8104b597559980411045606fb8faf2243673f. Signed-off-by: Jukka Rissanen --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 76ca9284ec89..5105d7c83f67 100644 --- a/west.yml +++ b/west.yml @@ -328,7 +328,7 @@ manifest: revision: c6296f600a6851bd652f207ab4908d339e1ce705 path: modules/bsim_hw_models/nrf_hw_models - name: nrf_wifi - revision: 7cb2f44f46dfc86e4f97477ee90022944e138dd8 + revision: 294314b8622bfa582f43b229504d42201e1a3443 path: modules/lib/nrf_wifi - name: open-amp revision: f7f4d083c7909a39d86e217376c69b416ec4faf3 From 550cc5ec166af04e403db9f8dc2b33c2e6cdc4ef Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:10 +0300 Subject: [PATCH 1537/2141] Revert "[nrf fromtree] drivers: nrf_wifi: Add Kconfig for Dynamic Bandwidth Signalling" This reverts commit 5924412ad01bbc394672058d1eb3952164158c3e. Signed-off-by: Jukka Rissanen --- drivers/wifi/nrf_wifi/Kconfig.nrfwifi | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/wifi/nrf_wifi/Kconfig.nrfwifi b/drivers/wifi/nrf_wifi/Kconfig.nrfwifi index e0a39f2123e1..ade3b5de5cf4 100644 --- a/drivers/wifi/nrf_wifi/Kconfig.nrfwifi +++ b/drivers/wifi/nrf_wifi/Kconfig.nrfwifi @@ -908,9 +908,4 @@ config NRF_WIFI_RX_STBC_HT help Receive packets encoded with STBC (Space-Time Block Coding) in HT (Wi-Fi4) mode. - -config NRF_WIFI_DYNAMIC_BANDWIDTH_SIGNALLING - bool "Dynamic bandwidth signalling for Wi-Fi" - help - This option enables support for dynamic bandwidth signalling. endif # WIFI_NRF70 From 4ff8a6dc506bb2ea7e1fa4131d0f6a35569c96e7 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:10 +0300 Subject: [PATCH 1538/2141] Revert "[nrf fromtree] manifest: Update nrf_wifi for dynamic bandwidth signal controlling" This reverts commit bce4d0f565ee8af9b43219a62c3d25c1069b3ad5. Signed-off-by: Jukka Rissanen --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 5105d7c83f67..1509f37e62b2 100644 --- a/west.yml +++ b/west.yml @@ -328,7 +328,7 @@ manifest: revision: c6296f600a6851bd652f207ab4908d339e1ce705 path: modules/bsim_hw_models/nrf_hw_models - name: nrf_wifi - revision: 294314b8622bfa582f43b229504d42201e1a3443 + revision: 1c1a7003ce90e492590c4a8a604eb9881bc8c5c1 path: modules/lib/nrf_wifi - name: open-amp revision: f7f4d083c7909a39d86e217376c69b416ec4faf3 From 39262586bdcd7275cd75bbd11ffd65323335f6f2 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:10 +0300 Subject: [PATCH 1539/2141] Revert "[nrf fromtree] manifest: nrf_wifi: Pull TX optimization" This reverts commit 513fef7af575b82f46db08646f453368c8bb5785. Signed-off-by: Jukka Rissanen --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 1509f37e62b2..609c9f20a4f9 100644 --- a/west.yml +++ b/west.yml @@ -328,7 +328,7 @@ manifest: revision: c6296f600a6851bd652f207ab4908d339e1ce705 path: modules/bsim_hw_models/nrf_hw_models - name: nrf_wifi - revision: 1c1a7003ce90e492590c4a8a604eb9881bc8c5c1 + revision: 0cd7f28d34a5279cd839940c199658a294165722 path: modules/lib/nrf_wifi - name: open-amp revision: f7f4d083c7909a39d86e217376c69b416ec4faf3 From 938bca53afcb2dee7e11f952002981fed3fc2275 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:10 +0300 Subject: [PATCH 1540/2141] Revert "[nrf fromtree] west: runners: Add ncs-provision to west flash command" This reverts commit 19af3cf53098543f5a88cce7d89a924b49fa7944. Signed-off-by: Jukka Rissanen --- scripts/west_commands/runners/nrf_common.py | 8 -------- scripts/west_commands/runners/nrfutil.py | 2 -- 2 files changed, 10 deletions(-) diff --git a/scripts/west_commands/runners/nrf_common.py b/scripts/west_commands/runners/nrf_common.py index a6af477c61a9..af4f8286722b 100644 --- a/scripts/west_commands/runners/nrf_common.py +++ b/scripts/west_commands/runners/nrf_common.py @@ -469,14 +469,6 @@ def program_hex(self): core = "Application" self.op_program(self.hex_, erase_arg, ext_mem_erase_opt, defer=True, core=core) - - if self.erase or self.recover: - # provision keys if keyfile.json exists in the build directory - keyfile = Path(self.cfg.build_dir).parent / 'keyfile.json' - if keyfile.exists(): - self.logger.info(f'Provisioning key file: {keyfile}') - self.exec_op('x-provision-keys', keyfile=str(keyfile), defer=True) - self.flush(force=False) diff --git a/scripts/west_commands/runners/nrfutil.py b/scripts/west_commands/runners/nrfutil.py index f11d2a7ad133..1fb44949507f 100644 --- a/scripts/west_commands/runners/nrfutil.py +++ b/scripts/west_commands/runners/nrfutil.py @@ -147,8 +147,6 @@ def _append_batch(self, op, json_file): cmd += ['--reset-kind', _op['kind']] elif op_type == 'erase': cmd.append(f'--{_op["kind"]}') - elif op_type == 'x-provision-keys': - cmd += ['--key-file', _op['keyfile']] cmd += ['--core', op['core']] if op.get('core') else [] cmd += ['--x-family', f'{self.family}'] From 7d84d495a53c3ddfefb34543797bdb603311664f Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:10 +0300 Subject: [PATCH 1541/2141] Revert "[nrf fromlist] manifest: update hal_nordic for errata 55 on nRF54LV10A Eng A" This reverts commit c4d342e3dd69d38adf8795022ddcbff4796cddfd. Signed-off-by: Jukka Rissanen --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 609c9f20a4f9..53b29c849ca5 100644 --- a/west.yml +++ b/west.yml @@ -200,7 +200,7 @@ manifest: groups: - hal - name: hal_nordic - revision: 71308dc6d8c021887ce5d98a36cafe9517375a91 + revision: 6e39d4f2b078afaebdb84875089486152fcacb9c path: modules/hal/nordic groups: - hal From 213c21dc98690ad49e16a5cf733b11e7d9fdd373 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:10 +0300 Subject: [PATCH 1542/2141] Revert "[nrf fromtree] tests: drivers: i2s: Add i2s_additional tests" This reverts commit 47939c23763333f501a79764f2aff9eaf56fe962. Signed-off-by: Jukka Rissanen --- .../drivers/i2s/i2s_additional/CMakeLists.txt | 9 - tests/drivers/i2s/i2s_additional/Kconfig | 168 ---- .../boards/nrf52840dk_nrf52840.conf | 1 - .../boards/nrf52840dk_nrf52840.overlay | 28 - .../boards/nrf5340dk_nrf5340_cpuapp.overlay | 32 - .../nrf5340dk_nrf5340_cpuapp_aclk.overlay | 9 - .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 31 - .../boards/nrf54l15dk_nrf54l15_cpuapp.overlay | 30 - tests/drivers/i2s/i2s_additional/prj.conf | 2 - tests/drivers/i2s/i2s_additional/src/main.c | 850 ------------------ .../drivers/i2s/i2s_additional/testcase.yaml | 39 - 11 files changed, 1199 deletions(-) delete mode 100644 tests/drivers/i2s/i2s_additional/CMakeLists.txt delete mode 100644 tests/drivers/i2s/i2s_additional/Kconfig delete mode 100644 tests/drivers/i2s/i2s_additional/boards/nrf52840dk_nrf52840.conf delete mode 100644 tests/drivers/i2s/i2s_additional/boards/nrf52840dk_nrf52840.overlay delete mode 100644 tests/drivers/i2s/i2s_additional/boards/nrf5340dk_nrf5340_cpuapp.overlay delete mode 100644 tests/drivers/i2s/i2s_additional/boards/nrf5340dk_nrf5340_cpuapp_aclk.overlay delete mode 100644 tests/drivers/i2s/i2s_additional/boards/nrf54h20dk_nrf54h20_cpuapp.overlay delete mode 100644 tests/drivers/i2s/i2s_additional/boards/nrf54l15dk_nrf54l15_cpuapp.overlay delete mode 100644 tests/drivers/i2s/i2s_additional/prj.conf delete mode 100644 tests/drivers/i2s/i2s_additional/src/main.c delete mode 100644 tests/drivers/i2s/i2s_additional/testcase.yaml diff --git a/tests/drivers/i2s/i2s_additional/CMakeLists.txt b/tests/drivers/i2s/i2s_additional/CMakeLists.txt deleted file mode 100644 index 490a0ddb7d68..000000000000 --- a/tests/drivers/i2s/i2s_additional/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -cmake_minimum_required(VERSION 3.20.0) - -find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -project(i2s_additional) - -FILE(GLOB app_sources src/*.c) -target_sources(app PRIVATE ${app_sources}) diff --git a/tests/drivers/i2s/i2s_additional/Kconfig b/tests/drivers/i2s/i2s_additional/Kconfig deleted file mode 100644 index 3c80dba48532..000000000000 --- a/tests/drivers/i2s/i2s_additional/Kconfig +++ /dev/null @@ -1,168 +0,0 @@ -# -# Copyright (c) 2025 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: Apache-2.0 -# - -mainmenu "I2S Additional Test" - -source "Kconfig.zephyr" - -config I2S_TEST_USE_GPIO_LOOPBACK - bool "Use GPIO loopback" - default y if DT_HAS_NORDIC_NRF_I2S_ENABLED || DT_HAS_NORDIC_NRF_TDM_ENABLED - help - Use wiring between the data-out and data-in pins for looping back - data. This option is intended to be used for devices that do not - provide the internal loopback functionality. - -config I2S_TEST_ALLOWED_DATA_OFFSET - int "Allowed offset in received data" - default 2 if DT_HAS_NORDIC_NRF_I2S_ENABLED || DT_HAS_NORDIC_NRF_TDM_ENABLED - default 0 - help - Maximum allowed offset between sent and received samples. Non-zero - value of this option may be needed when GPIO loopback is used. - -config I2S_TEST_WORD_SIZE_8_BIT_UNSUPPORTED - bool "8 bit word size is not supported by the driver" - help - When set to 'y', test will check that i2s_configure() returns -EINVAL. - When set to 'n', test will do the transmission. - -config I2S_TEST_WORD_SIZE_16_BIT_UNSUPPORTED - bool "16 bit word size is not supported by the driver" - help - When set to 'y', test will check that i2s_configure() returns -EINVAL. - When set to 'n', test will do the transmission. - -config I2S_TEST_WORD_SIZE_24_BIT_UNSUPPORTED - bool "24 bit word size is not supported by the driver" - help - When set to 'y', test will check that i2s_configure() returns -EINVAL. - When set to 'n', test will do the transmission. - -config I2S_TEST_WORD_SIZE_32_BIT_UNSUPPORTED - bool "32 bit word size is not supported by the driver" - help - When set to 'y', test will check that i2s_configure() returns -EINVAL. - When set to 'n', test will do the transmission. - -config I2S_TEST_WORD_SIZE_48_BIT_UNSUPPORTED - bool "48 bit word size is not supported by the driver" - default y if DT_HAS_NORDIC_NRF_I2S_ENABLED || DT_HAS_NORDIC_NRF_TDM_ENABLED - help - When set to 'y', test will check that i2s_configure() returns -EINVAL. - When set to 'n', test will do the transmission. - -config I2S_TEST_ONE_CHANNEL_UNSUPPORTED - bool "Single audio channel is not supported by the driver" - help - When set to 'y', test will check that i2s_configure() returns -EINVAL. - When set to 'n', test will do the transmission. - -config I2S_TEST_FOUR_CHANNELS_UNSUPPORTED - bool "Four audio channels are not supported by the driver" - default y if DT_HAS_NORDIC_NRF_I2S_ENABLED - help - When set to 'y', test will check that i2s_configure() returns -EINVAL. - When set to 'n', test will do the transmission. - -config I2S_TEST_EIGHT_CHANNELS_UNSUPPORTED - bool "Eight audio channels are not supported by the driver" - default y if DT_HAS_NORDIC_NRF_I2S_ENABLED - help - When set to 'y', test will check that i2s_configure() returns -EINVAL. - When set to 'n', test will do the transmission. - -config I2S_TEST_DATA_FORMAT_I2S_UNSUPPORTED - bool "I2S_FMT_DATA_FORMAT_I2S is not supported by the driver" - help - When set to 'y', test will check that i2s_configure() returns -EINVAL. - When set to 'n', test will do the transmission. - -config I2S_TEST_DATA_FORMAT_LEFT_JUSTIFIED_UNSUPPORTED - bool "I2S_FMT_DATA_FORMAT_LEFT_JUSTIFIED is not supported by the driver" - help - When set to 'y', test will check that i2s_configure() returns -EINVAL. - When set to 'n', test will do the transmission. - -config I2S_TEST_DATA_FORMAT_RIGHT_JUSTIFIED_UNSUPPORTED - bool "I2S_FMT_DATA_FORMAT_RIGHT_JUSTIFIED is not supported by the driver" - help - When set to 'y', test will check that i2s_configure() returns -EINVAL. - When set to 'n', test will do the transmission. - -config I2S_TEST_DATA_FORMAT_PCM_LONG_UNSUPPORTED - bool "I2S_FMT_DATA_FORMAT_PCM_LONG is not supported by the driver" - default y if DT_HAS_NORDIC_NRF_I2S_ENABLED - help - When set to 'y', test will check that i2s_configure() returns -EINVAL. - When set to 'n', test will do the transmission. - -config I2S_TEST_DATA_FORMAT_PCM_SHORT_UNSUPPORTED - bool "I2S_FMT_DATA_FORMAT_PCM_SHORT is not supported by the driver" - default y if DT_HAS_NORDIC_NRF_I2S_ENABLED - help - When set to 'y', test will check that i2s_configure() returns -EINVAL. - When set to 'n', test will do the transmission. - -config I2S_TEST_DATA_ORDER_MSB_UNSUPPORTED - bool "I2S_FMT_DATA_ORDER_MSB is not supported by the driver" - help - When set to 'y', test will check that i2s_configure() returns -EINVAL. - When set to 'n', test will do the transmission. - -config I2S_TEST_DATA_ORDER_LSB_UNSUPPORTED - bool "I2S_FMT_DATA_ORDER_LSB is not supported by the driver" - default y if DT_HAS_NORDIC_NRF_I2S_ENABLED || DT_HAS_NORDIC_NRF_TDM_ENABLED - help - When set to 'y', test will check that i2s_configure() returns -EINVAL. - When set to 'n', test will do the transmission. - -config I2S_TEST_BIT_CLK_INV_UNSUPPORTED - bool "I2S_FMT_BIT_CLK_INV is not supported by the driver" - default y if DT_HAS_NORDIC_NRF_I2S_ENABLED || DT_HAS_NORDIC_NRF_TDM_ENABLED - help - When set to 'y', test will check that i2s_configure() returns -EINVAL. - When set to 'n', test will do the transmission. - -config I2S_TEST_FRAME_CLK_INV_UNSUPPORTED - bool "I2S_FMT_FRAME_CLK_INV is not supported by the driver" - default y if DT_HAS_NORDIC_NRF_I2S_ENABLED || DT_HAS_NORDIC_NRF_TDM_ENABLED - help - When set to 'y', test will check that i2s_configure() returns -EINVAL. - When set to 'n', test will do the transmission. - -config I2S_TEST_BLOCK_SIZE_6_UNSUPPORTED - bool "Block_size of 6 is not supported by the driver" - default y if DT_HAS_NORDIC_NRF_I2S_ENABLED || DT_HAS_NORDIC_NRF_TDM_ENABLED - help - When set to 'y', test will check that i2s_configure() returns -EINVAL. - When set to 'n', test will do the transmission. - -config I2S_TEST_OPTIONS_BIT_CLK_CONT_UNSUPPORTED - bool "I2S_OPT_BIT_CLK_CONT is not supported by the driver" - help - When set to 'y', test will check that i2s_configure() returns -EINVAL. - When set to 'n', test will do the transmission. - -config I2S_TEST_OPTIONS_BIT_CLK_GATED_UNSUPPORTED - bool "I2S_OPT_BIT_CLK_GATED is not supported by the driver" - help - When set to 'y', test will check that i2s_configure() returns -EINVAL. - When set to 'n', test will do the transmission. - -config I2S_TEST_OPTIONS_LOOPBACK_UNSUPPORTED - bool "I2S_OPT_LOOPBACK is not supported by the driver" - default y if DT_HAS_NORDIC_NRF_I2S_ENABLED || DT_HAS_NORDIC_NRF_TDM_ENABLED - help - When set to 'y', test will check that i2s_configure() returns -EINVAL. - When set to 'n', test will do the transmission. - -config I2S_TEST_OPTIONS_PINGPONG_UNSUPPORTED - bool "I2S_OPT_PINGPONG is not supported by the driver" - default y if DT_HAS_NORDIC_NRF_I2S_ENABLED || DT_HAS_NORDIC_NRF_TDM_ENABLED - help - When set to 'y', test will check that i2s_configure() returns -EINVAL. - When set to 'n', test will do the transmission. diff --git a/tests/drivers/i2s/i2s_additional/boards/nrf52840dk_nrf52840.conf b/tests/drivers/i2s/i2s_additional/boards/nrf52840dk_nrf52840.conf deleted file mode 100644 index 8ed6ee234db2..000000000000 --- a/tests/drivers/i2s/i2s_additional/boards/nrf52840dk_nrf52840.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_I2S_TEST_WORD_SIZE_32_BIT_UNSUPPORTED=y diff --git a/tests/drivers/i2s/i2s_additional/boards/nrf52840dk_nrf52840.overlay b/tests/drivers/i2s/i2s_additional/boards/nrf52840dk_nrf52840.overlay deleted file mode 100644 index ca21135bca4f..000000000000 --- a/tests/drivers/i2s/i2s_additional/boards/nrf52840dk_nrf52840.overlay +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - aliases { - i2s-node0 = &i2s0; - }; -}; - -&pinctrl { - i2s0_default_alt: i2s0_default_alt { - group1 { - psels = , - , - , - ; - }; - }; -}; - -&i2s0 { - status = "okay"; - pinctrl-0 = <&i2s0_default_alt>; - pinctrl-names = "default"; -}; diff --git a/tests/drivers/i2s/i2s_additional/boards/nrf5340dk_nrf5340_cpuapp.overlay b/tests/drivers/i2s/i2s_additional/boards/nrf5340dk_nrf5340_cpuapp.overlay deleted file mode 100644 index a4c595b1bcdb..000000000000 --- a/tests/drivers/i2s/i2s_additional/boards/nrf5340dk_nrf5340_cpuapp.overlay +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - aliases { - i2s-node0 = &i2s0; - }; -}; - -&pinctrl { - i2s0_default_alt: i2s0_default_alt { - group1 { - psels = , - , - , - ; - }; - }; -}; - -&uart1 { - status = "disabled"; -}; - -&i2s0 { - status = "okay"; - pinctrl-0 = <&i2s0_default_alt>; - pinctrl-names = "default"; -}; diff --git a/tests/drivers/i2s/i2s_additional/boards/nrf5340dk_nrf5340_cpuapp_aclk.overlay b/tests/drivers/i2s/i2s_additional/boards/nrf5340dk_nrf5340_cpuapp_aclk.overlay deleted file mode 100644 index e262ca8d8a87..000000000000 --- a/tests/drivers/i2s/i2s_additional/boards/nrf5340dk_nrf5340_cpuapp_aclk.overlay +++ /dev/null @@ -1,9 +0,0 @@ -/* Drive i2s peripheral from ACLK. */ - -&clock { - hfclkaudio-frequency = <11289600>; -}; - -&i2s0 { - clock-source = "ACLK"; -}; diff --git a/tests/drivers/i2s/i2s_additional/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/i2s/i2s_additional/boards/nrf54h20dk_nrf54h20_cpuapp.overlay deleted file mode 100644 index 7734b5cf284f..000000000000 --- a/tests/drivers/i2s/i2s_additional/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/* i2s-node0 is the transmitter/receiver */ - -/ { - aliases { - i2s-node0 = &tdm130; - }; -}; - -&pinctrl { - tdm130_default_alt: tdm130_default_alt { - group1 { - psels = , - , - , - ; - }; - }; -}; - -&tdm130 { - status = "okay"; - pinctrl-0 = <&tdm130_default_alt>; - pinctrl-names = "default"; - memory-regions = <&cpuapp_dma_region>; -}; diff --git a/tests/drivers/i2s/i2s_additional/boards/nrf54l15dk_nrf54l15_cpuapp.overlay b/tests/drivers/i2s/i2s_additional/boards/nrf54l15dk_nrf54l15_cpuapp.overlay deleted file mode 100644 index c8ede4b8c2b1..000000000000 --- a/tests/drivers/i2s/i2s_additional/boards/nrf54l15dk_nrf54l15_cpuapp.overlay +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/* i2s-node0 is the transmitter/receiver */ - -/ { - aliases { - i2s-node0 = &i2s20; - }; -}; - -&pinctrl { - i2s20_default_alt: i2s20_default_alt { - group1 { - psels = , - , - , - ; - }; - }; -}; - -&i2s20 { - status = "okay"; - pinctrl-0 = <&i2s20_default_alt>; - pinctrl-names = "default"; -}; diff --git a/tests/drivers/i2s/i2s_additional/prj.conf b/tests/drivers/i2s/i2s_additional/prj.conf deleted file mode 100644 index 99ff252406a1..000000000000 --- a/tests/drivers/i2s/i2s_additional/prj.conf +++ /dev/null @@ -1,2 +0,0 @@ -CONFIG_I2S=y -CONFIG_ZTEST=y diff --git a/tests/drivers/i2s/i2s_additional/src/main.c b/tests/drivers/i2s/i2s_additional/src/main.c deleted file mode 100644 index e8852850cee5..000000000000 --- a/tests/drivers/i2s/i2s_additional/src/main.c +++ /dev/null @@ -1,850 +0,0 @@ -/* - * Copyright (c) 2017 comsuisse AG - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include -#include - -#include -LOG_MODULE_REGISTER(i2s_add, LOG_LEVEL_INF); - -#define I2S_DEV_NODE DT_ALIAS(i2s_node0) - -#define WORD_SIZE 16U -#define NUMBER_OF_CHANNELS 2 -#define FRAME_CLK_FREQ 44100 - -#define NUM_BLOCKS 20 -#define TIMEOUT 1000 - -#define SAMPLES_COUNT 64 - -/* The data_l represent a sine wave */ -static int16_t data_l[SAMPLES_COUNT] = { - 3211, 6392, 9511, 12539, 15446, 18204, 20787, 23169, - 25329, 27244, 28897, 30272, 31356, 32137, 32609, 32767, - 32609, 32137, 31356, 30272, 28897, 27244, 25329, 23169, - 20787, 18204, 15446, 12539, 9511, 6392, 3211, 0, - -3212, -6393, -9512, -12540, -15447, -18205, -20788, -23170, - -25330, -27245, -28898, -30273, -31357, -32138, -32610, -32767, - -32610, -32138, -31357, -30273, -28898, -27245, -25330, -23170, - -20788, -18205, -15447, -12540, -9512, -6393, -3212, -1, -}; - -/* The data_r represent a sine wave shifted by 90 deg to data_l sine wave */ -static int16_t data_r[SAMPLES_COUNT] = { - 32609, 32137, 31356, 30272, 28897, 27244, 25329, 23169, - 20787, 18204, 15446, 12539, 9511, 6392, 3211, 0, - -3212, -6393, -9512, -12540, -15447, -18205, -20788, -23170, - -25330, -27245, -28898, -30273, -31357, -32138, -32610, -32767, - -32610, -32138, -31357, -30273, -28898, -27245, -25330, -23170, - -20788, -18205, -15447, -12540, -9512, -6393, -3212, -1, - 3211, 6392, 9511, 12539, 15446, 18204, 20787, 23169, - 25329, 27244, 28897, 30272, 31356, 32137, 32609, 32767, -}; - -#define BLOCK_SIZE (2 * sizeof(data_l)) - -#ifdef CONFIG_NOCACHE_MEMORY - #define MEM_SLAB_CACHE_ATTR __nocache -#else - #define MEM_SLAB_CACHE_ATTR -#endif /* CONFIG_NOCACHE_MEMORY */ - -/* - * NUM_BLOCKS is the number of blocks used by the test. Some of the drivers, - * permanently keep ownership of a few RX buffers. Add a two more - * RX blocks to satisfy this requirement - */ -static char MEM_SLAB_CACHE_ATTR __aligned(WB_UP(32)) - _k_mem_slab_buf_rx_0_mem_slab[(NUM_BLOCKS + 2) * WB_UP(BLOCK_SIZE)]; -STRUCT_SECTION_ITERABLE(k_mem_slab, rx_0_mem_slab) = - Z_MEM_SLAB_INITIALIZER(rx_0_mem_slab, _k_mem_slab_buf_rx_0_mem_slab, - WB_UP(BLOCK_SIZE), NUM_BLOCKS + 2); - -static char MEM_SLAB_CACHE_ATTR __aligned(WB_UP(32)) - _k_mem_slab_buf_tx_0_mem_slab[(NUM_BLOCKS) * WB_UP(BLOCK_SIZE)]; -STRUCT_SECTION_ITERABLE(k_mem_slab, tx_0_mem_slab) = - Z_MEM_SLAB_INITIALIZER(tx_0_mem_slab, _k_mem_slab_buf_tx_0_mem_slab, - WB_UP(BLOCK_SIZE), NUM_BLOCKS); - -static const struct device *dev_i2s; - -static const struct i2s_config default_i2s_cfg = { - .word_size = WORD_SIZE, - .channels = NUMBER_OF_CHANNELS, - .format = I2S_FMT_DATA_FORMAT_I2S, - .frame_clk_freq = FRAME_CLK_FREQ, - .block_size = BLOCK_SIZE, - .timeout = TIMEOUT, -#if defined(CONFIG_I2S_TEST_USE_GPIO_LOOPBACK) - .options = I2S_OPT_FRAME_CLK_MASTER | I2S_OPT_BIT_CLK_MASTER, -#else - .options = I2S_OPT_FRAME_CLK_MASTER | I2S_OPT_BIT_CLK_MASTER | I2S_OPT_LOOPBACK, -#endif - .mem_slab = &tx_0_mem_slab, -}; - -#if (CONFIG_I2S_TEST_ALLOWED_DATA_OFFSET > 0) -/* Data offset may differ when test uses I2S with different configuration. */ -static int offset; -static int16_t word_size_bytes; -static int16_t sample_in_bytes; -#endif - -/* Fill in TX buffer with test samples. */ -static void fill_buf(int16_t *tx_block, uint8_t word_size) -{ - - /* Technically, this is correct for word_size of 16 bits only - * (incorrect for word_size of 8, 24 and 32 bit). - * However, tests checks if received bytes are identical to - * the transmitted ones. Meaning of transmitted data is irrelevant. - */ - if (word_size == 24) { - int8_t *tx_block_8bit = (int8_t *) tx_block; - int8_t *data_l_8bit = (int8_t *) &data_l; - int8_t *data_r_8bit = (int8_t *) &data_r; - int16_t tx_cnt = 0; - int16_t l_cnt = 0; - int16_t r_cnt = 0; - - while (tx_cnt < BLOCK_SIZE) { - tx_block_8bit[tx_cnt++] = data_l_8bit[l_cnt++]; - tx_block_8bit[tx_cnt++] = data_l_8bit[l_cnt++]; - tx_block_8bit[tx_cnt++] = data_l_8bit[l_cnt++]; - tx_block_8bit[tx_cnt++] = 0; - tx_block_8bit[tx_cnt++] = data_r_8bit[r_cnt++]; - tx_block_8bit[tx_cnt++] = data_r_8bit[r_cnt++]; - tx_block_8bit[tx_cnt++] = data_r_8bit[r_cnt++]; - tx_block_8bit[tx_cnt++] = 0; - } - } else { - for (int i = 0; i < SAMPLES_COUNT; i++) { - tx_block[2 * i] = data_l[i]; - tx_block[2 * i + 1] = data_r[i]; - } - } -} - -static int verify_buf(int16_t *rx_block, uint8_t word_size, uint8_t channels) -{ - int sample_no = SAMPLES_COUNT; - bool same = true; - -/* Find offset. - * This doesn't handle correctly situation when - * word_size is 8 bit and offset is odd. - */ -#if (CONFIG_I2S_TEST_ALLOWED_DATA_OFFSET > 0) - /* Offset -1 means that offset has to be detected. */ - if (offset < 0) { - LOG_HEXDUMP_DBG(rx_block, BLOCK_SIZE, "Received"); - - /* When word_size is: - * 8 bit, it occupies 8/8 = 1 byte, - * 16 bit, it occupies 16/8 = 2 bytes, - * 24 bit, it occupies 4 bytes, - * 32 bit, it occupies 32/8 = 4 bytes, - * in TX/RX buffers. - */ - word_size_bytes = (word_size == 24) ? 4 : word_size / 8; - LOG_DBG("word_size_bytes = %u", word_size_bytes); - - /* Offset is in 'samples'. - * - * One 'sample' is data for all channels: - * two channels, 8 bit word -> sample is 2 bytes - * two channels, 16 bit word -> sample is 4 bytes - * two channels, 24 bit word -> sample is 8 bytes (24 bit extended to 32 bit) - * two channels, 32 bit word -> sample is 8 bytes - */ - sample_in_bytes = channels * word_size_bytes; - LOG_DBG("sample_in_bytes = %u", sample_in_bytes); - - do { - ++offset; - if (offset > CONFIG_I2S_TEST_ALLOWED_DATA_OFFSET) { - TC_PRINT("Allowed data offset (%d) exceeded\n", - CONFIG_I2S_TEST_ALLOWED_DATA_OFFSET); - return -TC_FAIL; - } - } while (rx_block[offset * sample_in_bytes / 2] != data_l[0]); - TC_PRINT("Using data offset: %d (%u bytes)\n", offset, - offset * sample_in_bytes); - } - - /* Divided by 2 because rx_block is uint16 */ - rx_block += (offset * sample_in_bytes / 2); - sample_no -= (offset * word_size_bytes / 2); - LOG_DBG("sample_no = %u", sample_no); -#endif - - /* Compare received data with sent values. */ - if (word_size == 24) { - int8_t *rx_block_8bit = (int8_t *) rx_block; - int8_t *data_l_8bit = (int8_t *) &data_l; - int8_t *data_r_8bit = (int8_t *) &data_r; - int16_t rx_cnt = 0; - int16_t temp = 0; - int8_t expected = 0; - - while (rx_cnt < (BLOCK_SIZE - offset * sample_in_bytes)) { -/* Map byte number from RX array to channel array - * - * rx_cnt | l_index | r_index || rx_cnt/8 | rx_cnt%4 | (rx_cnt/8)*3+(rx_cnt%4) - * 0 | 0 | || 0 | 0 | 0*3+0 = 0 data_l - * 1 | 1 | || 0 | 1 | 0*3+1 = 1 data_l - * 2 | 2 | || 0 | 2 | 0*3+2 = 2 data_l - * 3 | - | || 0 | 3 | 0*3+3 = 3 ignore - * 4 | | 0 || 0 | 0 | 0*3+0 = 0 data_r - * 5 | | 1 || 0 | 1 | 0*3+1 = 1 data_r - * 6 | | 2 || 0 | 2 | 0*3+2 = 2 data_r - * 7 | | - || 0 | 3 | 0*3+3 = 3 ignore - * - * 8 | 3 | || 1 | 0 | 1*3+0 = 3 data_l - * 9 | 4 | || 1 | 1 | 1*3+1 = 4 data_l - * 10 | 5 | || 1 | 2 | 1*3+2 = 5 data_l - * 11 | - | || 1 | 3 | 1*3+3 = 6 ignore - * 12 | | 3 || 1 | 0 | 1*3+0 = 3 data_r - * 13 | | 4 || 1 | 1 | 1*3+1 = 4 data_r - * 14 | | 5 || 1 | 2 | 1*3+2 = 5 data_r - * 15 | | - || 1 | 3 | 1*3+3 = 6 ignore - * - * 16 | 6 | || 2 | 0 | 2*3+0 = 6 data_l - * ... - */ - temp = ((rx_cnt / 8) * 3) + (rx_cnt % 4); - - if ((rx_cnt % 8) < 4) { - /* Compare with left channel. */ - expected = data_l_8bit[temp]; - } else { - /* Compare with right channel. */ - expected = data_r_8bit[temp]; - } - - if ((rx_cnt % 4) == 3) { - /* Ignore every fourth byte */ - } else { - /* Compare received data with expected value. */ - if (rx_block_8bit[rx_cnt] != expected) { - TC_PRINT("Index %d, expected 0x%x, actual 0x%x\n", - rx_cnt, expected, rx_block_8bit[rx_cnt]); - same = false; - } - } - /* Move to next received byte. */ - rx_cnt++; - } - - } else { - for (int i = 0; i < sample_no; i++) { - if (rx_block[2 * i] != data_l[i]) { - TC_PRINT("data_l, index %d, expected 0x%x, actual 0x%x\n", - i, data_l[i], rx_block[2 * i]); - same = false; - } - if (rx_block[2 * i + 1] != data_r[i]) { - TC_PRINT("data_r, index %d, expected 0x%x, actual 0x%x\n", - i, data_r[i], rx_block[2 * i + 1]); - same = false; - } - } - } - - if (!same) { - return -TC_FAIL; - } else { - return TC_PASS; - } -} - -static int configure_stream(const struct device *dev, enum i2s_dir dir, - struct i2s_config *i2s_cfg) -{ - int ret; - - if (dir == I2S_DIR_TX) { - /* Configure the Transmit port as Master */ - i2s_cfg->options = I2S_OPT_FRAME_CLK_MASTER - | I2S_OPT_BIT_CLK_MASTER; - } else if (dir == I2S_DIR_RX) { - /* Configure the Receive port as Slave */ - i2s_cfg->options = I2S_OPT_FRAME_CLK_SLAVE - | I2S_OPT_BIT_CLK_SLAVE; - } else { /* dir == I2S_DIR_BOTH */ - i2s_cfg->options = I2S_OPT_FRAME_CLK_MASTER - | I2S_OPT_BIT_CLK_MASTER; - } - - if (dir == I2S_DIR_TX || dir == I2S_DIR_BOTH) { - i2s_cfg->mem_slab = &tx_0_mem_slab; - ret = i2s_configure(dev, I2S_DIR_TX, i2s_cfg); - if (ret < 0) { - TC_PRINT("Failed to configure I2S TX stream (%d)\n", - ret); - return -TC_FAIL; - } - } - - if (dir == I2S_DIR_RX || dir == I2S_DIR_BOTH) { - i2s_cfg->mem_slab = &rx_0_mem_slab; - ret = i2s_configure(dev, I2S_DIR_RX, i2s_cfg); - if (ret < 0) { - TC_PRINT("Failed to configure I2S RX stream (%d)\n", - ret); - return -TC_FAIL; - } - } - - return TC_PASS; -} - -static void i2s_dir_both_transfer_long(struct i2s_config *i2s_cfg) -{ - void *rx_block[NUM_BLOCKS]; - void *tx_block[NUM_BLOCKS]; - size_t rx_size; - int tx_idx; - int rx_idx = 0; - int num_verified; - int ret; - - /* Configure I2S Dir Both transfer. */ - ret = configure_stream(dev_i2s, I2S_DIR_BOTH, i2s_cfg); - zassert_equal(ret, TC_PASS); - - /* Prepare TX data blocks */ - for (tx_idx = 0; tx_idx < NUM_BLOCKS; tx_idx++) { - ret = k_mem_slab_alloc(&tx_0_mem_slab, &tx_block[tx_idx], - K_FOREVER); - zassert_equal(ret, 0); - fill_buf((uint16_t *)tx_block[tx_idx], i2s_cfg->word_size); - } - - LOG_HEXDUMP_DBG(tx_block[0], BLOCK_SIZE, "transmitted"); - - tx_idx = 0; - - /* Prefill TX queue */ - ret = i2s_write(dev_i2s, tx_block[tx_idx++], BLOCK_SIZE); - zassert_equal(ret, 0); - - ret = i2s_write(dev_i2s, tx_block[tx_idx++], BLOCK_SIZE); - zassert_equal(ret, 0); - - ret = i2s_trigger(dev_i2s, I2S_DIR_BOTH, I2S_TRIGGER_START); - zassert_equal(ret, 0, "RX/TX START trigger failed\n"); - - while (tx_idx < NUM_BLOCKS) { - ret = i2s_write(dev_i2s, tx_block[tx_idx++], BLOCK_SIZE); - zassert_equal(ret, 0); - - ret = i2s_read(dev_i2s, &rx_block[rx_idx++], &rx_size); - zassert_equal(ret, 0, "Got unexpected %d", ret); - zassert_equal(rx_size, BLOCK_SIZE); - } - - /* All data written, drain TX queue and stop both streams. */ - ret = i2s_trigger(dev_i2s, I2S_DIR_BOTH, I2S_TRIGGER_DRAIN); - zassert_equal(ret, 0, "RX/TX DRAIN trigger failed"); - - ret = i2s_read(dev_i2s, &rx_block[rx_idx++], &rx_size); - zassert_equal(ret, 0); - zassert_equal(rx_size, BLOCK_SIZE); - - ret = i2s_read(dev_i2s, &rx_block[rx_idx++], &rx_size); - zassert_equal(ret, 0); - zassert_equal(rx_size, BLOCK_SIZE); - - TC_PRINT("%d TX blocks sent\n", tx_idx); - TC_PRINT("%d RX blocks received\n", rx_idx); - - /* Verify received data */ - num_verified = 0; - for (rx_idx = 0; rx_idx < NUM_BLOCKS; rx_idx++) { - ret = verify_buf((uint16_t *)rx_block[rx_idx], - i2s_cfg->word_size, i2s_cfg->channels); - if (ret != 0) { - TC_PRINT("%d RX block invalid\n", rx_idx); - } else { - num_verified++; - } - k_mem_slab_free(&rx_0_mem_slab, rx_block[rx_idx]); - } - zassert_equal(num_verified, NUM_BLOCKS, "Invalid RX blocks received"); -} - -/** @brief Test I2S transfer with word_size_8bit - */ -ZTEST(i2s_additional, test_01a_word_size_08bit) -{ - struct i2s_config i2s_cfg = default_i2s_cfg; - - i2s_cfg.word_size = 8; - -#if defined(CONFIG_I2S_TEST_WORD_SIZE_8_BIT_UNSUPPORTED) - int ret; - - ret = i2s_configure(dev_i2s, I2S_DIR_TX, &i2s_cfg); - zassert_equal(ret, -EINVAL, "Unexpected result %d", ret); -#else - i2s_dir_both_transfer_long(&i2s_cfg); -#endif -} - -/** @brief Test I2S transfer with word_size_16bit - */ -ZTEST(i2s_additional, test_01b_word_size_16bit) -{ - struct i2s_config i2s_cfg = default_i2s_cfg; - - i2s_cfg.word_size = 16; - -#if defined(CONFIG_I2S_TEST_WORD_SIZE_16_BIT_UNSUPPORTED) - int ret; - - ret = i2s_configure(dev_i2s, I2S_DIR_TX, &i2s_cfg); - zassert_equal(ret, -EINVAL, "Unexpected result %d", ret); -#else - i2s_dir_both_transfer_long(&i2s_cfg); -#endif -} - -/** @brief Test I2S transfer with word_size_24bit - */ -ZTEST(i2s_additional, test_01c_word_size_24bit) -{ - struct i2s_config i2s_cfg = default_i2s_cfg; - - i2s_cfg.word_size = 24; - -#if defined(CONFIG_I2S_TEST_WORD_SIZE_24_BIT_UNSUPPORTED) - int ret; - - ret = i2s_configure(dev_i2s, I2S_DIR_TX, &i2s_cfg); - zassert_equal(ret, -EINVAL, "Unexpected result %d", ret); -#else - i2s_dir_both_transfer_long(&i2s_cfg); -#endif -} - -/** @brief Test I2S transfer with word_size_32bit - */ -ZTEST(i2s_additional, test_01d_word_size_32bit) -{ - struct i2s_config i2s_cfg = default_i2s_cfg; - - i2s_cfg.word_size = 32; - -#if defined(CONFIG_I2S_TEST_WORD_SIZE_32_BIT_UNSUPPORTED) - int ret; - - ret = i2s_configure(dev_i2s, I2S_DIR_TX, &i2s_cfg); - zassert_equal(ret, -EINVAL, "Unexpected result %d", ret); -#else - i2s_dir_both_transfer_long(&i2s_cfg); -#endif -} - -/** @brief Test I2S transfer with word_size_48bit - */ -ZTEST(i2s_additional, test_01e_word_size_48bit) -{ - struct i2s_config i2s_cfg = default_i2s_cfg; - - i2s_cfg.word_size = 48; - -#if defined(CONFIG_I2S_TEST_WORD_SIZE_48_BIT_UNSUPPORTED) - int ret; - - ret = i2s_configure(dev_i2s, I2S_DIR_TX, &i2s_cfg); - zassert_equal(ret, -EINVAL, "Unexpected result %d", ret); -#else - i2s_dir_both_transfer_long(&i2s_cfg); -#endif -} - -/** @brief Test I2S transfer with one channel. - */ -ZTEST(i2s_additional, test_02a_one_channel) -{ - struct i2s_config i2s_cfg = default_i2s_cfg; - - i2s_cfg.channels = 1; - -#if defined(CONFIG_I2S_TEST_ONE_CHANNEL_UNSUPPORTED) - int ret; - - ret = i2s_configure(dev_i2s, I2S_DIR_TX, &i2s_cfg); - zassert_equal(ret, -EINVAL, "Unexpected result %d", ret); -#else - i2s_dir_both_transfer_long(&i2s_cfg); -#endif -} - -/** @brief Test I2S transfer with four channels. - */ -ZTEST(i2s_additional, test_02b_four_channels) -{ - struct i2s_config i2s_cfg = default_i2s_cfg; - - i2s_cfg.channels = 4; - -#if defined(CONFIG_I2S_TEST_FOUR_CHANNELS_UNSUPPORTED) - int ret; - - ret = i2s_configure(dev_i2s, I2S_DIR_TX, &i2s_cfg); - zassert_equal(ret, -EINVAL, "Unexpected result %d", ret); -#else /* CONFIG_I2S_TEST_FOUR_CHANNELS_UNSUPPORTED */ - - /* Select format that supports four channels. */ -#if !defined(CONFIG_I2S_TEST_DATA_FORMAT_PCM_LONG_UNSUPPORTED) - i2s_cfg.format = I2S_FMT_DATA_FORMAT_PCM_LONG; - TC_PRINT("Selected format is I2S_FMT_DATA_FORMAT_PCM_LONG\n"); -#elif !defined(CONFIG_I2S_TEST_DATA_FORMAT_PCM_SHORT_UNSUPPORTED) - i2s_cfg.format = I2S_FMT_DATA_FORMAT_PCM_SHORT; - TC_PRINT("Selected format is I2S_FMT_DATA_FORMAT_PCM_SHORT\n"); -#else -#error "Don't know what format supports four channels." -#endif - - i2s_dir_both_transfer_long(&i2s_cfg); -#endif /* CONFIG_I2S_TEST_FOUR_CHANNELS_UNSUPPORTED */ -} - -/** @brief Test I2S transfer with eight channels. - */ -ZTEST(i2s_additional, test_02c_eight_channels) -{ - struct i2s_config i2s_cfg = default_i2s_cfg; - - i2s_cfg.channels = 8; - -#if defined(CONFIG_I2S_TEST_EIGHT_CHANNELS_UNSUPPORTED) - int ret; - - ret = i2s_configure(dev_i2s, I2S_DIR_TX, &i2s_cfg); - zassert_equal(ret, -EINVAL, "Unexpected result %d", ret); -#else /* CONFIG_I2S_TEST_EIGHT_CHANNELS_UNSUPPORTED */ - - /* Select format that supports eight channels. */ -#if !defined(CONFIG_I2S_TEST_DATA_FORMAT_PCM_LONG_UNSUPPORTED) - i2s_cfg.format = I2S_FMT_DATA_FORMAT_PCM_LONG; - TC_PRINT("Selected format is I2S_FMT_DATA_FORMAT_PCM_LONG\n"); -#elif !defined(CONFIG_I2S_TEST_DATA_FORMAT_PCM_SHORT_UNSUPPORTED) - i2s_cfg.format = I2S_FMT_DATA_FORMAT_PCM_SHORT; - TC_PRINT("Selected format is I2S_FMT_DATA_FORMAT_PCM_SHORT\n"); -#else -#error "Don't know what format supports eight channels." -#endif - - i2s_dir_both_transfer_long(&i2s_cfg); -#endif /* CONFIG_I2S_TEST_EIGHT_CHANNELS_UNSUPPORTED */ -} - -/** @brief Test I2S transfer with format I2S_FMT_DATA_FORMAT_I2S - */ -ZTEST(i2s_additional, test_03a_format_i2s) -{ - struct i2s_config i2s_cfg = default_i2s_cfg; - - i2s_cfg.format = I2S_FMT_DATA_FORMAT_I2S; - -#if defined(CONFIG_I2S_TEST_DATA_FORMAT_I2S_UNSUPPORTED) - int ret; - - ret = i2s_configure(dev_i2s, I2S_DIR_TX, &i2s_cfg); - zassert_equal(ret, -EINVAL, "Unexpected result %d", ret); -#else - i2s_dir_both_transfer_long(&i2s_cfg); -#endif -} - -/** @brief Test I2S transfer with format I2S_FMT_DATA_FORMAT_LEFT_JUSTIFIED - */ -ZTEST(i2s_additional, test_03b_format_left_justified) -{ - struct i2s_config i2s_cfg = default_i2s_cfg; - - i2s_cfg.format = I2S_FMT_DATA_FORMAT_LEFT_JUSTIFIED; - -#if defined(CONFIG_I2S_TEST_DATA_FORMAT_LEFT_JUSTIFIED_UNSUPPORTED) - int ret; - - ret = i2s_configure(dev_i2s, I2S_DIR_TX, &i2s_cfg); - zassert_equal(ret, -EINVAL, "Unexpected result %d", ret); -#else - i2s_dir_both_transfer_long(&i2s_cfg); -#endif -} - -/** @brief Test I2S transfer with format I2S_FMT_DATA_FORMAT_RIGHT_JUSTIFIED - */ -ZTEST(i2s_additional, test_03c_format_right_justified) -{ - struct i2s_config i2s_cfg = default_i2s_cfg; - - i2s_cfg.format = I2S_FMT_DATA_FORMAT_RIGHT_JUSTIFIED; - -#if defined(CONFIG_I2S_TEST_DATA_FORMAT_RIGHT_JUSTIFIED_UNSUPPORTED) - int ret; - - ret = i2s_configure(dev_i2s, I2S_DIR_TX, &i2s_cfg); - zassert_equal(ret, -EINVAL, "Unexpected result %d", ret); -#else - i2s_dir_both_transfer_long(&i2s_cfg); -#endif -} - -/** @brief Test I2S transfer with format I2S_FMT_DATA_FORMAT_PCM_LONG - */ -ZTEST(i2s_additional, test_03d_format_pcm_long) -{ - struct i2s_config i2s_cfg = default_i2s_cfg; - - i2s_cfg.format = I2S_FMT_DATA_FORMAT_PCM_LONG; - -#if defined(CONFIG_I2S_TEST_DATA_FORMAT_PCM_LONG_UNSUPPORTED) - int ret; - - ret = i2s_configure(dev_i2s, I2S_DIR_TX, &i2s_cfg); - zassert_equal(ret, -EINVAL, "Unexpected result %d", ret); -#else - i2s_dir_both_transfer_long(&i2s_cfg); -#endif -} - -/** @brief Test I2S transfer with format I2S_FMT_DATA_FORMAT_PCM_SHORT - */ -ZTEST(i2s_additional, test_03e_format_pcm_short) -{ - struct i2s_config i2s_cfg = default_i2s_cfg; - - i2s_cfg.format = I2S_FMT_DATA_FORMAT_PCM_SHORT; - -#if defined(CONFIG_I2S_TEST_DATA_FORMAT_PCM_SHORT_UNSUPPORTED) - int ret; - - ret = i2s_configure(dev_i2s, I2S_DIR_TX, &i2s_cfg); - zassert_equal(ret, -EINVAL, "Unexpected result %d", ret); -#else - i2s_dir_both_transfer_long(&i2s_cfg); -#endif -} - -/** @brief Test I2S transfer with format I2S_FMT_DATA_ORDER_MSB - */ -ZTEST(i2s_additional, test_04a_format_data_order_MSB) -{ - struct i2s_config i2s_cfg = default_i2s_cfg; - - i2s_cfg.format |= I2S_FMT_DATA_ORDER_MSB; - -#if defined(CONFIG_I2S_TEST_DATA_ORDER_MSB_UNSUPPORTED) - int ret; - - ret = i2s_configure(dev_i2s, I2S_DIR_TX, &i2s_cfg); - zassert_equal(ret, -EINVAL, "Unexpected result %d", ret); -#else - i2s_dir_both_transfer_long(&i2s_cfg); -#endif -} - -/** @brief Test I2S transfer with format I2S_FMT_DATA_ORDER_LSB - */ -ZTEST(i2s_additional, test_04b_format_data_order_LSB) -{ - struct i2s_config i2s_cfg = default_i2s_cfg; - - i2s_cfg.format |= I2S_FMT_DATA_ORDER_LSB; - -#if defined(CONFIG_I2S_TEST_DATA_ORDER_LSB_UNSUPPORTED) - int ret; - - ret = i2s_configure(dev_i2s, I2S_DIR_TX, &i2s_cfg); - zassert_equal(ret, -EINVAL, "Unexpected result %d", ret); -#else - i2s_dir_both_transfer_long(&i2s_cfg); -#endif -} - -/** @brief Test I2S transfer with format I2S_FMT_BIT_CLK_INV - */ -ZTEST(i2s_additional, test_05a_format_bit_clk_inv) -{ - struct i2s_config i2s_cfg = default_i2s_cfg; - - i2s_cfg.format |= I2S_FMT_BIT_CLK_INV; - -#if defined(CONFIG_I2S_TEST_BIT_CLK_INV_UNSUPPORTED) - int ret; - - ret = i2s_configure(dev_i2s, I2S_DIR_TX, &i2s_cfg); - zassert_equal(ret, -EINVAL, "Unexpected result %d", ret); -#else - i2s_dir_both_transfer_long(&i2s_cfg); -#endif -} - -/** @brief Test I2S transfer with format I2S_FMT_FRAME_CLK_INV - */ -ZTEST(i2s_additional, test_05b_format_frame_clk_inv) -{ - struct i2s_config i2s_cfg = default_i2s_cfg; - - i2s_cfg.format |= I2S_FMT_FRAME_CLK_INV; - -#if defined(CONFIG_I2S_TEST_FRAME_CLK_INV_UNSUPPORTED) - int ret; - - ret = i2s_configure(dev_i2s, I2S_DIR_TX, &i2s_cfg); - zassert_equal(ret, -EINVAL, "Unexpected result %d", ret); -#else - i2s_dir_both_transfer_long(&i2s_cfg); -#endif -} - -/** @brief Test I2S transfer with block_size set to 6. - */ -ZTEST(i2s_additional, test_06_block_size_6) -{ - struct i2s_config i2s_cfg = default_i2s_cfg; - - i2s_cfg.block_size = 6; - -#if defined(CONFIG_I2S_TEST_BLOCK_SIZE_6_UNSUPPORTED) - int ret; - - ret = i2s_configure(dev_i2s, I2S_DIR_TX, &i2s_cfg); - zassert_equal(ret, -EINVAL, "Unexpected result %d", ret); -#else - i2s_dir_both_transfer_long(&i2s_cfg); -#endif -} - -/** @brief Test I2S transfer with I2S_OPT_BIT_CLK_CONT. - */ -ZTEST(i2s_additional, test_07a_options_bit_clk_cont) -{ - struct i2s_config i2s_cfg = default_i2s_cfg; - - i2s_cfg.options |= I2S_OPT_BIT_CLK_CONT; - -#if defined(CONFIG_I2S_TEST_OPTIONS_BIT_CLK_CONT_UNSUPPORTED) - int ret; - - ret = i2s_configure(dev_i2s, I2S_DIR_TX, &i2s_cfg); - zassert_equal(ret, -EINVAL, "Unexpected result %d", ret); -#else - i2s_dir_both_transfer_long(&i2s_cfg); -#endif -} - -/** @brief Test I2S transfer with I2S_OPT_BIT_CLK_GATED. - */ -ZTEST(i2s_additional, test_07b_options_bit_clk_gated) -{ - struct i2s_config i2s_cfg = default_i2s_cfg; - - i2s_cfg.options |= I2S_OPT_BIT_CLK_GATED; - -#if defined(CONFIG_I2S_TEST_OPTIONS_BIT_CLK_GATED_UNSUPPORTED) - int ret; - - ret = i2s_configure(dev_i2s, I2S_DIR_TX, &i2s_cfg); - zassert_equal(ret, -EINVAL, "Unexpected result %d", ret); -#else - i2s_dir_both_transfer_long(&i2s_cfg); -#endif -} - -/** @brief Check error when I2S is configured with unsupported - * combination of bit CLK and frame CLK options. - */ -ZTEST(i2s_additional, test_08_options_bit_frame_clk_mixed) -{ - struct i2s_config i2s_cfg = default_i2s_cfg; - int ret; - - i2s_cfg.options = I2S_OPT_FRAME_CLK_MASTER | I2S_OPT_BIT_CLK_SLAVE; - - ret = i2s_configure(dev_i2s, I2S_DIR_TX, &i2s_cfg); - zassert_equal(ret, -EINVAL, "Unexpected result %d", ret); - - i2s_cfg.options = I2S_OPT_FRAME_CLK_SLAVE | I2S_OPT_BIT_CLK_MASTER; - - ret = i2s_configure(dev_i2s, I2S_DIR_TX, &i2s_cfg); - zassert_equal(ret, -EINVAL, "Unexpected result %d", ret); -} - -/** @brief Test I2S transfer with I2S_OPT_LOOPBACK. - */ -ZTEST(i2s_additional, test_09a_options_loopback) -{ - struct i2s_config i2s_cfg = default_i2s_cfg; - - i2s_cfg.options |= I2S_OPT_LOOPBACK; - -#if defined(CONFIG_I2S_TEST_OPTIONS_LOOPBACK_UNSUPPORTED) - int ret; - - ret = i2s_configure(dev_i2s, I2S_DIR_TX, &i2s_cfg); - zassert_equal(ret, -EINVAL, "Unexpected result %d", ret); -#else - i2s_dir_both_transfer_long(&i2s_cfg); -#endif -} - -/** @brief Test I2S transfer with I2S_OPT_PINGPONG. - */ -ZTEST(i2s_additional, test_09b_options_pingpong) -{ - struct i2s_config i2s_cfg = default_i2s_cfg; - - i2s_cfg.options |= I2S_OPT_PINGPONG; - -#if defined(CONFIG_I2S_TEST_OPTIONS_LOOPBACK_UNSUPPORTED) - int ret; - - ret = i2s_configure(dev_i2s, I2S_DIR_TX, &i2s_cfg); - zassert_equal(ret, -EINVAL, "Unexpected result %d", ret); -#else - i2s_dir_both_transfer_long(&i2s_cfg); -#endif -} - -static void *suite_setup(void) -{ - /* Check I2S Device. */ - dev_i2s = DEVICE_DT_GET_OR_NULL(I2S_DEV_NODE); - zassert_not_null(dev_i2s, "I2S device not found"); - zassert(device_is_ready(dev_i2s), "I2S device not ready"); - - LOG_HEXDUMP_DBG(&data_l, 2 * SAMPLES_COUNT, "data_l"); - LOG_HEXDUMP_DBG(&data_r, 2 * SAMPLES_COUNT, "data_r"); - TC_PRINT("===================================================================\n"); - - return 0; -} - -static void before(void *not_used) -{ - ARG_UNUSED(not_used); - -#if (CONFIG_I2S_TEST_ALLOWED_DATA_OFFSET > 0) - /* Data offset may differ when test uses I2S - * with different configuration. - * Force offset callculation for every test. - */ - offset = -1; -#endif -} - -ZTEST_SUITE(i2s_additional, NULL, suite_setup, before, NULL, NULL); diff --git a/tests/drivers/i2s/i2s_additional/testcase.yaml b/tests/drivers/i2s/i2s_additional/testcase.yaml deleted file mode 100644 index c45a5482b7f4..000000000000 --- a/tests/drivers/i2s/i2s_additional/testcase.yaml +++ /dev/null @@ -1,39 +0,0 @@ -common: - tags: - - drivers - - i2s - depends_on: - - i2s - - gpio - filter: CONFIG_I2S_TEST_USE_GPIO_LOOPBACK - harness: ztest - -tests: - drivers.i2s.additional.gpio_loopback: - harness_config: - fixture: gpio_loopback - platform_allow: - - nrf52840dk/nrf52840 - - nrf5340dk/nrf5340/cpuapp - - nrf54l15dk/nrf54l15/cpuapp - integration_platforms: - - nrf52840dk/nrf52840 - - nrf5340dk/nrf5340/cpuapp - - nrf54l15dk/nrf54l15/cpuapp - - drivers.i2s.additional.gpio_loopback.54h: - harness_config: - fixture: i2s_loopback - platform_allow: - - nrf54h20dk/nrf54h20/cpuapp - integration_platforms: - - nrf54h20dk/nrf54h20/cpuapp - - drivers.i2s.additional.gpio_loopback.aclk: - harness_config: - fixture: gpio_loopback - extra_args: EXTRA_DTC_OVERLAY_FILE="boards/nrf5340dk_nrf5340_cpuapp_aclk.overlay" - platform_allow: - - nrf5340dk/nrf5340/cpuapp - integration_platforms: - - nrf5340dk/nrf5340/cpuapp From d83858b8c18bfbc8f1a42ce5217cef3b7173919c Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:10 +0300 Subject: [PATCH 1543/2141] Revert "[nrf fromlist] tests: drivers: timer: nrf_grtc_timer: Align tests with uptime changes" This reverts commit 6b5f7ae654a14942896d7165b0efe69ed2af0e0a. Signed-off-by: Jukka Rissanen --- tests/drivers/timer/nrf_grtc_timer/src/main.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/drivers/timer/nrf_grtc_timer/src/main.c b/tests/drivers/timer/nrf_grtc_timer/src/main.c index cede54f026f1..f53188841bdb 100644 --- a/tests/drivers/timer/nrf_grtc_timer/src/main.c +++ b/tests/drivers/timer/nrf_grtc_timer/src/main.c @@ -28,7 +28,6 @@ ZTEST(nrf_grtc_timer, test_get_ticks) { k_timeout_t t = K_MSEC(1); - uint64_t grtc_start_value = z_nrf_grtc_timer_startup_value_get(); uint64_t exp_ticks = z_nrf_grtc_timer_read() + t.ticks * CYC_PER_TICK; int64_t ticks; @@ -52,7 +51,6 @@ ZTEST(nrf_grtc_timer, test_get_ticks) curr_tick2 = sys_clock_tick_get(); } while (curr_tick != curr_tick2); - curr_tick += (grtc_start_value / CYC_PER_TICK); t = Z_TIMEOUT_TICKS(Z_TICK_ABS(curr_tick - K_MSEC(1).ticks)); exp_ticks = curr_grtc_tick - K_MSEC(1).ticks * CYC_PER_TICK; @@ -71,7 +69,6 @@ ZTEST(nrf_grtc_timer, test_get_ticks) curr_tick2 = sys_clock_tick_get(); } while (curr_tick != curr_tick2); - curr_tick += (grtc_start_value / CYC_PER_TICK); t = Z_TIMEOUT_TICKS(Z_TICK_ABS(curr_tick + K_MSEC(10).ticks)); exp_ticks = curr_grtc_tick + K_MSEC(10).ticks * CYC_PER_TICK; ticks = z_nrf_grtc_timer_get_ticks(t); From 34c7df067417ff6ea4ff7bc9cfc26cf6932c0621 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:10 +0300 Subject: [PATCH 1544/2141] Revert "[nrf fromtree] drivers: adc: adc_nrfx_saadc: Extend internal reference values" This reverts commit 3613ade88e9b997a565c3adf1a26357c31d88d22. Signed-off-by: Jukka Rissanen --- drivers/adc/adc_nrfx_saadc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/adc/adc_nrfx_saadc.c b/drivers/adc/adc_nrfx_saadc.c index 986cca49af8f..a9cc1c4f36b9 100644 --- a/drivers/adc/adc_nrfx_saadc.c +++ b/drivers/adc/adc_nrfx_saadc.c @@ -754,9 +754,7 @@ static DEVICE_API(adc, adc_nrfx_driver_api) = { #ifdef CONFIG_ADC_ASYNC .read_async = adc_nrfx_read_async, #endif -#if defined(NRF54LV10A_ENGA_XXAA) - .ref_internal = 1300, -#elif defined(CONFIG_SOC_COMPATIBLE_NRF54LX) +#if defined(CONFIG_SOC_COMPATIBLE_NRF54LX) .ref_internal = 900, #elif defined(CONFIG_NRF_PLATFORM_HALTIUM) .ref_internal = 1024, From 5e562f98b295ad91b54fc32fc43736e7e06a84fb Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:10 +0300 Subject: [PATCH 1545/2141] Revert "[nrf fromtree] tests: boards: nrf: i2c: Fix nrf52 and nrf53 pin assignment" This reverts commit 524d8073b4caa3d49beda3020fbc7b69459392d9. Signed-off-by: Jukka Rissanen --- .../boards/nrf52840dk_nrf52840.overlay | 18 ++++++++++-------- .../boards/nrf5340dk_nrf5340_cpuapp.overlay | 14 ++++++++------ 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/tests/boards/nrf/i2c/i2c_slave/boards/nrf52840dk_nrf52840.overlay b/tests/boards/nrf/i2c/i2c_slave/boards/nrf52840dk_nrf52840.overlay index 121ac01b7a7d..40c74354e30e 100644 --- a/tests/boards/nrf/i2c/i2c_slave/boards/nrf52840dk_nrf52840.overlay +++ b/tests/boards/nrf/i2c/i2c_slave/boards/nrf52840dk_nrf52840.overlay @@ -7,31 +7,33 @@ &pinctrl { i2c0_default_alt: i2c0_default_alt { group1 { - psels = , - ; + psels = , + ; }; }; i2c0_sleep_alt: i2c0_sleep_alt { group1 { - psels = , - ; + psels = , + ; low-power-enable; }; }; i2c1_default_alt: i2c1_default_alt { group1 { - psels = , - ; +/* Temporary workaround as it is currently not possible + * to configure pins for TWIS with pinctrl. */ + psels = , + ; bias-pull-up; }; }; i2c1_sleep_alt: i2c1_sleep_alt { group1 { - psels = , - ; + psels = , + ; low-power-enable; }; }; diff --git a/tests/boards/nrf/i2c/i2c_slave/boards/nrf5340dk_nrf5340_cpuapp.overlay b/tests/boards/nrf/i2c/i2c_slave/boards/nrf5340dk_nrf5340_cpuapp.overlay index 2ccac66dc723..48577a5a8edf 100644 --- a/tests/boards/nrf/i2c/i2c_slave/boards/nrf5340dk_nrf5340_cpuapp.overlay +++ b/tests/boards/nrf/i2c/i2c_slave/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -8,30 +8,32 @@ i2c1_default_alt: i2c1_default_alt { group1 { psels = , - ; + ; }; }; i2c1_sleep_alt: i2c1_sleep_alt { group1 { psels = , - ; + ; low-power-enable; }; }; i2c2_default_alt: i2c2_default_alt { group1 { - psels = , - ; +/* Temporary workaround as it is currently not possible + * to configure pins for TWIS with pinctrl. */ + psels = , + ; bias-pull-up; }; }; i2c2_sleep_alt: i2c2_sleep_alt { group1 { - psels = , - ; + psels = , + ; low-power-enable; }; }; From 669d6ae22841a19bbd9eac6f54904f31eb910040 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:10 +0300 Subject: [PATCH 1546/2141] Revert "[nrf fromtree] tests: drivers: spi: spi_loopback: configure spi latency expectation" This reverts commit 8c6c814d571bc9df6092d44a040d0ae308238a49. Signed-off-by: Jukka Rissanen --- tests/drivers/spi/spi_loopback/Kconfig | 4 ---- .../spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuapp.conf | 1 - .../spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpurad.conf | 1 - tests/drivers/spi/spi_loopback/src/spi.c | 6 ++---- 4 files changed, 2 insertions(+), 10 deletions(-) delete mode 100644 tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuapp.conf delete mode 100644 tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpurad.conf diff --git a/tests/drivers/spi/spi_loopback/Kconfig b/tests/drivers/spi/spi_loopback/Kconfig index b1d81eb13aa1..f3d89bf7317e 100644 --- a/tests/drivers/spi/spi_loopback/Kconfig +++ b/tests/drivers/spi/spi_loopback/Kconfig @@ -11,10 +11,6 @@ config SPI_LARGE_BUFFER_SIZE int "Large buffer size" default 8192 -config SPI_IDEAL_TRANSFER_DURATION_SCALING - int "Scaling factor to compare ideal and measured SPI transfer duration" - default 8 - if SOC_SERIES_STM32H7X config SPI_LOOPBACK_16BITS_FRAMES diff --git a/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuapp.conf b/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuapp.conf deleted file mode 100644 index ad922ab8d26f..000000000000 --- a/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuapp.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_SPI_IDEAL_TRANSFER_DURATION_SCALING=12 diff --git a/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpurad.conf b/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpurad.conf deleted file mode 100644 index ad922ab8d26f..000000000000 --- a/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpurad.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_SPI_IDEAL_TRANSFER_DURATION_SCALING=12 diff --git a/tests/drivers/spi/spi_loopback/src/spi.c b/tests/drivers/spi/spi_loopback/src/spi.c index 64649ce7566b..f00a720677a3 100644 --- a/tests/drivers/spi/spi_loopback/src/spi.c +++ b/tests/drivers/spi/spi_loopback/src/spi.c @@ -327,7 +327,7 @@ ZTEST(spi_loopback, test_spi_complete_multiple_timed) /* Fail if transfer is faster than theoretically possible */ zassert_true(time_spent_us >= minimum_transfer_time_us, - "Transfer faster than theoretically possible"); + "Transfer faster than theoretically possible"); /* handle overflow for print statement */ latency_measurement = time_spent_us - expected_transfer_time_us; @@ -337,9 +337,7 @@ ZTEST(spi_loopback, test_spi_complete_multiple_timed) TC_PRINT("Latency measurement: %llu us\n", latency_measurement); /* Allow some overhead, but not too much */ - zassert_true(time_spent_us <= - expected_transfer_time_us * CONFIG_SPI_IDEAL_TRANSFER_DURATION_SCALING, - "Very high latency"); + zassert_true(time_spent_us <= expected_transfer_time_us * 8, "Very high latency"); spi_loopback_compare_bufs(buffer_tx, buffer_rx, BUF_SIZE, buffer_print_tx, buffer_print_rx); From ec2e460b8bf3c63a5cd068a7b8b38d7a411730b0 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:10 +0300 Subject: [PATCH 1547/2141] Revert "[nrf fromtree] modules: hal_nordic: nrfx: Add mising UARTE23/24 Kconfigs" This reverts commit d03f1689ee5cbfe7abfffee9a65771495055a22e. Signed-off-by: Jukka Rissanen --- modules/hal_nordic/nrfx/Kconfig | 10 ---------- modules/hal_nordic/nrfx/nrfx_kconfig.h | 6 ------ soc/nordic/validate_base_addresses.c | 2 -- 3 files changed, 18 deletions(-) diff --git a/modules/hal_nordic/nrfx/Kconfig b/modules/hal_nordic/nrfx/Kconfig index 08c5df625990..3ce57f1e4de7 100644 --- a/modules/hal_nordic/nrfx/Kconfig +++ b/modules/hal_nordic/nrfx/Kconfig @@ -1105,16 +1105,6 @@ config NRFX_UARTE22 depends on $(dt_nodelabel_exists,uart22) select NRFX_UARTE -config NRFX_UARTE23 - bool "UARTE23 driver instance" - depends on $(dt_nodelabel_exists,uart23) - select NRFX_UARTE - -config NRFX_UARTE24 - bool "UARTE24 driver instance" - depends on $(dt_nodelabel_exists,uart24) - select NRFX_UARTE - config NRFX_UARTE30 bool "UARTE30 driver instance" depends on $(dt_nodelabel_exists,uart30) diff --git a/modules/hal_nordic/nrfx/nrfx_kconfig.h b/modules/hal_nordic/nrfx/nrfx_kconfig.h index ed1948a3931d..3ba891f60ec1 100644 --- a/modules/hal_nordic/nrfx/nrfx_kconfig.h +++ b/modules/hal_nordic/nrfx/nrfx_kconfig.h @@ -891,12 +891,6 @@ #ifdef CONFIG_NRFX_UARTE22 #define NRFX_UARTE22_ENABLED 1 #endif -#ifdef CONFIG_NRFX_UARTE23 -#define NRFX_UARTE23_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_UARTE24 -#define NRFX_UARTE24_ENABLED 1 -#endif #ifdef CONFIG_NRFX_UARTE30 #define NRFX_UARTE30_ENABLED 1 #endif diff --git a/soc/nordic/validate_base_addresses.c b/soc/nordic/validate_base_addresses.c index 02413e3f174a..6acefccdfec1 100644 --- a/soc/nordic/validate_base_addresses.c +++ b/soc/nordic/validate_base_addresses.c @@ -321,8 +321,6 @@ CHECK_DT_REG(uart00, NRF_UARTE00); CHECK_DT_REG(uart20, NRF_UARTE20); CHECK_DT_REG(uart21, NRF_UARTE21); CHECK_DT_REG(uart22, NRF_UARTE22); -CHECK_DT_REG(uart23, NRF_UARTE23); -CHECK_DT_REG(uart24, NRF_UARTE24); CHECK_DT_REG(uart30, NRF_UARTE30); CHECK_DT_REG(uart120, NRF_UARTE120); CHECK_DT_REG(uart130, NRF_UARTE130); From 913d9b474cca224da76eb54ae9f09c45ea050b98 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:10 +0300 Subject: [PATCH 1548/2141] Revert "[nrf fromtree] drivers: spi: Support spim23 and spim24 instances" This reverts commit 287ea0179242ae064dd013a1d7bbfd9258c9f0be. Signed-off-by: Jukka Rissanen --- drivers/spi/Kconfig.nrfx | 4 ---- modules/hal_nordic/nrfx/Kconfig | 20 -------------------- modules/hal_nordic/nrfx/nrfx_kconfig.h | 12 ------------ soc/nordic/common/Kconfig.peripherals | 12 ------------ soc/nordic/validate_base_addresses.c | 2 -- 5 files changed, 50 deletions(-) diff --git a/drivers/spi/Kconfig.nrfx b/drivers/spi/Kconfig.nrfx index f3afa79c4c37..d3debe5a5de6 100644 --- a/drivers/spi/Kconfig.nrfx +++ b/drivers/spi/Kconfig.nrfx @@ -31,8 +31,6 @@ config SPI_NRFX_SPIM select NRFX_SPIM20 if HAS_HW_NRF_SPIM20 select NRFX_SPIM21 if HAS_HW_NRF_SPIM21 select NRFX_SPIM22 if HAS_HW_NRF_SPIM22 - select NRFX_SPIM23 if HAS_HW_NRF_SPIM23 - select NRFX_SPIM24 if HAS_HW_NRF_SPIM24 select NRFX_SPIM30 if HAS_HW_NRF_SPIM30 select NRFX_SPIM120 if HAS_HW_NRF_SPIM120 select NRFX_SPIM121 if HAS_HW_NRF_SPIM121 @@ -57,8 +55,6 @@ config SPI_NRFX_SPIS select NRFX_SPIS20 if HAS_HW_NRF_SPIS20 select NRFX_SPIS21 if HAS_HW_NRF_SPIS21 select NRFX_SPIS22 if HAS_HW_NRF_SPIS22 - select NRFX_SPIS23 if HAS_HW_NRF_SPIS23 - select NRFX_SPIS24 if HAS_HW_NRF_SPIS24 select NRFX_SPIS30 if HAS_HW_NRF_SPIS30 select NRFX_SPIS120 if HAS_HW_NRF_SPIS120 select NRFX_SPIS130 if HAS_HW_NRF_SPIS130 diff --git a/modules/hal_nordic/nrfx/Kconfig b/modules/hal_nordic/nrfx/Kconfig index 3ce57f1e4de7..ceccf25997ca 100644 --- a/modules/hal_nordic/nrfx/Kconfig +++ b/modules/hal_nordic/nrfx/Kconfig @@ -562,16 +562,6 @@ config NRFX_SPIM22 depends on $(dt_nodelabel_exists,spi22) select NRFX_SPIM -config NRFX_SPIM23 - bool "SPIM23 driver instance" - depends on $(dt_nodelabel_exists,spi23) - select NRFX_SPIM - -config NRFX_SPIM24 - bool "SPIM24 driver instance" - depends on $(dt_nodelabel_exists,spi24) - select NRFX_SPIM - config NRFX_SPIM30 bool "SPIM30 driver instance" depends on $(dt_nodelabel_exists,spi30) @@ -670,16 +660,6 @@ config NRFX_SPIS22 depends on $(dt_nodelabel_exists,spi22) select NRFX_SPIS -config NRFX_SPIS23 - bool "SPIS23 driver instance" - depends on $(dt_nodelabel_exists,spi23) - select NRFX_SPIS - -config NRFX_SPIS24 - bool "SPIS24 driver instance" - depends on $(dt_nodelabel_exists,spi24) - select NRFX_SPIS - config NRFX_SPIS30 bool "SPIS30 driver instance" depends on $(dt_nodelabel_exists,spi30) diff --git a/modules/hal_nordic/nrfx/nrfx_kconfig.h b/modules/hal_nordic/nrfx/nrfx_kconfig.h index 3ba891f60ec1..73a26272d4da 100644 --- a/modules/hal_nordic/nrfx/nrfx_kconfig.h +++ b/modules/hal_nordic/nrfx/nrfx_kconfig.h @@ -512,12 +512,6 @@ #ifdef CONFIG_NRFX_SPIM22 #define NRFX_SPIM22_ENABLED 1 #endif -#ifdef CONFIG_NRFX_SPIM23 -#define NRFX_SPIM23_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_SPIM24 -#define NRFX_SPIM24_ENABLED 1 -#endif #ifdef CONFIG_NRFX_SPIM30 #define NRFX_SPIM30_ENABLED 1 #endif @@ -582,12 +576,6 @@ #ifdef CONFIG_NRFX_SPIS22 #define NRFX_SPIS22_ENABLED 1 #endif -#ifdef CONFIG_NRFX_SPIS23 -#define NRFX_SPIS23_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_SPIS24 -#define NRFX_SPIS24_ENABLED 1 -#endif #ifdef CONFIG_NRFX_SPIS30 #define NRFX_SPIS30_ENABLED 1 #endif diff --git a/soc/nordic/common/Kconfig.peripherals b/soc/nordic/common/Kconfig.peripherals index 900effed1416..ce91800a6150 100644 --- a/soc/nordic/common/Kconfig.peripherals +++ b/soc/nordic/common/Kconfig.peripherals @@ -280,12 +280,6 @@ config HAS_HW_NRF_SPIM21 config HAS_HW_NRF_SPIM22 def_bool $(dt_nodelabel_enabled_with_compat,spi22,$(DT_COMPAT_NORDIC_NRF_SPIM)) -config HAS_HW_NRF_SPIM23 - def_bool $(dt_nodelabel_enabled_with_compat,spi23,$(DT_COMPAT_NORDIC_NRF_SPIM)) - -config HAS_HW_NRF_SPIM24 - def_bool $(dt_nodelabel_enabled_with_compat,spi24,$(DT_COMPAT_NORDIC_NRF_SPIM)) - config HAS_HW_NRF_SPIM30 def_bool $(dt_nodelabel_enabled_with_compat,spi30,$(DT_COMPAT_NORDIC_NRF_SPIM)) @@ -343,12 +337,6 @@ config HAS_HW_NRF_SPIS21 config HAS_HW_NRF_SPIS22 def_bool $(dt_nodelabel_enabled_with_compat,spi22,$(DT_COMPAT_NORDIC_NRF_SPIS)) -config HAS_HW_NRF_SPIS23 - def_bool $(dt_nodelabel_enabled_with_compat,spi23,$(DT_COMPAT_NORDIC_NRF_SPIS)) - -config HAS_HW_NRF_SPIS24 - def_bool $(dt_nodelabel_enabled_with_compat,spi24,$(DT_COMPAT_NORDIC_NRF_SPIS)) - config HAS_HW_NRF_SPIS30 def_bool $(dt_nodelabel_enabled_with_compat,spi30,$(DT_COMPAT_NORDIC_NRF_SPIS)) diff --git a/soc/nordic/validate_base_addresses.c b/soc/nordic/validate_base_addresses.c index 6acefccdfec1..9de947a5c7f6 100644 --- a/soc/nordic/validate_base_addresses.c +++ b/soc/nordic/validate_base_addresses.c @@ -266,8 +266,6 @@ CHECK_DT_REG(spi00, NRF_SPIM00); CHECK_DT_REG(spi20, NRF_SPIM20); CHECK_DT_REG(spi21, NRF_SPIM21); CHECK_DT_REG(spi22, NRF_SPIM22); -CHECK_DT_REG(spi23, NRF_SPIM23); -CHECK_DT_REG(spi24, NRF_SPIM24); CHECK_DT_REG(spi30, NRF_SPIM30); CHECK_DT_REG(spi120, NRF_SPIM120); CHECK_DT_REG(spi121, NRF_SPIM121); From 8c244d19e2ebd95e243981f9e4c8879370a0d4b2 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:10 +0300 Subject: [PATCH 1549/2141] Revert "[nrf fromtree] boards: nrf54h20_iron: Allow radio updates" This reverts commit 5307c307d683219c13cb49d739bd314f1a9dee7b. Signed-off-by: Jukka Rissanen --- boards/nordic/nrf54h20dk/Kconfig.defconfig | 7 ------- .../nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_iron.dts | 8 -------- .../nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_iron.dts | 8 -------- modules/Kconfig.mcuboot | 1 - soc/nordic/nrf54h/soc.c | 3 +-- 5 files changed, 1 insertion(+), 26 deletions(-) diff --git a/boards/nordic/nrf54h20dk/Kconfig.defconfig b/boards/nordic/nrf54h20dk/Kconfig.defconfig index 4023f3b02320..60c9345eb045 100644 --- a/boards/nordic/nrf54h20dk/Kconfig.defconfig +++ b/boards/nordic/nrf54h20dk/Kconfig.defconfig @@ -27,10 +27,3 @@ config FLASH_LOAD_OFFSET default 0x2c000 if !USE_DT_CODE_PARTITION endif # BOARD_NRF54H20DK_NRF54H20_CPUAPP_IRON - -if BOARD_NRF54H20DK_NRF54H20_CPURAD_IRON - -config ROM_START_OFFSET - default 0x800 if BOOTLOADER_MCUBOOT - -endif # BOARD_NRF54H20DK_NRF54H20_CPURAD_IRON diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_iron.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_iron.dts index e822cf2c9119..d455e200b0b9 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_iron.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_iron.dts @@ -35,11 +35,3 @@ slot0_partition: &cpuapp_slot0_partition { slot1_partition: &cpuapp_slot1_partition { label = "image-1"; }; - -slot2_partition: &cpurad_slot0_partition { - label = "image-2"; -}; - -slot3_partition: &cpurad_slot1_partition { - label = "image-3"; -}; diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_iron.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_iron.dts index 16b599f554e4..669143a79dac 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_iron.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_iron.dts @@ -19,11 +19,3 @@ mbox-names = "tx", "rx"; status = "okay"; }; - -slot0_partition: &cpurad_slot0_partition { - label = "image-0"; -}; - -slot1_partition: &cpurad_slot1_partition { - label = "image-1"; -}; diff --git a/modules/Kconfig.mcuboot b/modules/Kconfig.mcuboot index c02ee43f5eb8..2c4dbfa930de 100644 --- a/modules/Kconfig.mcuboot +++ b/modules/Kconfig.mcuboot @@ -227,7 +227,6 @@ config MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP config MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP_WITH_REVERT bool "MCUboot has been configured for DirectXIP with revert" - select MCUBOOT_BOOTUTIL_LIB select MCUBOOT_BOOTUTIL_LIB_FOR_DIRECT_XIP select MCUBOOT_BOOTLOADER_MODE_HAS_NO_DOWNGRADE select MCUBOOT_BOOTLOADER_NO_DOWNGRADE diff --git a/soc/nordic/nrf54h/soc.c b/soc/nordic/nrf54h/soc.c index e55f56242b90..e053953b821e 100644 --- a/soc/nordic/nrf54h/soc.c +++ b/soc/nordic/nrf54h/soc.c @@ -175,8 +175,7 @@ void soc_late_init_hook(void) void *radiocore_address = (void *)(DT_REG_ADDR(DT_GPARENT(DT_NODELABEL_CPURAD_SLOT0_PARTITION)) + - DT_REG_ADDR(DT_NODELABEL_CPURAD_SLOT0_PARTITION) + - CONFIG_ROM_START_OFFSET); + DT_REG_ADDR(DT_NODELABEL_CPURAD_SLOT0_PARTITION)); /* Don't wait as this is not yet supported. */ bool cpu_wait = false; From c01a98a5c35bcced601388228dbc61c9046c60a5 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:10 +0300 Subject: [PATCH 1550/2141] Revert "[nrf fromtree] net: stats: Make byte counters 64-bit" This reverts commit 44066038087d8ccdffb677f8c693c37069741c7b. Signed-off-by: Jukka Rissanen --- include/zephyr/net/net_stats.h | 18 +++++++++--------- samples/net/stats/src/main.c | 10 +++++----- subsys/net/ip/net_stats.c | 10 +++++----- subsys/net/l2/wifi/wifi_shell.c | 4 ++-- subsys/net/lib/shell/stats.c | 22 +++++++++++----------- 5 files changed, 32 insertions(+), 32 deletions(-) diff --git a/include/zephyr/net/net_stats.h b/include/zephyr/net/net_stats.h index de95b35fbb72..1a5531a1a271 100644 --- a/include/zephyr/net/net_stats.h +++ b/include/zephyr/net/net_stats.h @@ -49,9 +49,9 @@ typedef uint32_t net_stats_t; */ struct net_stats_bytes { /** Number of bytes sent */ - uint64_t sent; + net_stats_t sent; /** Number of bytes received */ - uint64_t received; + net_stats_t received; }; /** @@ -319,8 +319,6 @@ struct net_stats_rx_time { struct net_stats_tc { /** TX statistics for each traffic class */ struct { - /** Number of bytes sent for this traffic class */ - uint64_t bytes; /** Helper for calculating average TX time statistics */ struct net_stats_tx_time tx_time; #if defined(CONFIG_NET_PKT_TXTIME_STATS_DETAIL) @@ -332,14 +330,14 @@ struct net_stats_tc { net_stats_t pkts; /** Number of packets dropped for this traffic class */ net_stats_t dropped; + /** Number of bytes sent for this traffic class */ + net_stats_t bytes; /** Priority of this traffic class */ uint8_t priority; } sent[NET_TC_TX_STATS_COUNT]; /** RX statistics for each traffic class */ struct { - /** Number of bytes received for this traffic class */ - uint64_t bytes; /** Helper for calculating average RX time statistics */ struct net_stats_rx_time rx_time; #if defined(CONFIG_NET_PKT_RXTIME_STATS_DETAIL) @@ -351,6 +349,8 @@ struct net_stats_tc { net_stats_t pkts; /** Number of packets dropped for this traffic class */ net_stats_t dropped; + /** Number of bytes received for this traffic class */ + net_stats_t bytes; /** Priority of this traffic class */ uint8_t priority; } recv[NET_TC_RX_STATS_COUNT]; @@ -404,15 +404,15 @@ struct net_stats_pkt_filter { * @brief All network statistics in one struct. */ struct net_stats { + /** Count of malformed packets or packets we do not have handler for */ + net_stats_t processing_error; + /** * This calculates amount of data transferred through all the * network interfaces. */ struct net_stats_bytes bytes; - /** Count of malformed packets or packets we do not have handler for */ - net_stats_t processing_error; - /** IP layer errors */ struct net_stats_ip_errors ip_errors; diff --git a/samples/net/stats/src/main.c b/samples/net/stats/src/main.c index 7b3d1a844aa0..c91ad4e15f27 100644 --- a/samples/net/stats/src/main.c +++ b/samples/net/stats/src/main.c @@ -99,7 +99,7 @@ static void print_stats(struct net_if *iface, struct net_stats *data) #endif #if defined(CONFIG_NET_STATISTICS_TCP) - printk("TCP bytes recv %llu\tsent\t%llu\n", + printk("TCP bytes recv %u\tsent\t%u\n", GET_STAT(iface, tcp.bytes.received), GET_STAT(iface, tcp.bytes.sent)); printk("TCP seg recv %u\tsent\t%u\tdrop\t%u\n", @@ -119,8 +119,8 @@ static void print_stats(struct net_if *iface, struct net_stats *data) GET_STAT(iface, tcp.connrst)); #endif - printk("Bytes received %llu\n", GET_STAT(iface, bytes.received)); - printk("Bytes sent %llu\n", GET_STAT(iface, bytes.sent)); + printk("Bytes received %u\n", GET_STAT(iface, bytes.received)); + printk("Bytes sent %u\n", GET_STAT(iface, bytes.sent)); printk("Processing err %u\n", GET_STAT(iface, processing_error)); } @@ -141,8 +141,8 @@ static void print_eth_stats(struct net_if *iface, struct net_stats_eth *data) printk("Statistics for Ethernet interface %p [%d]\n", iface, net_if_get_by_iface(iface)); - printk("Bytes received : %llu\n", data->bytes.received); - printk("Bytes sent : %llu\n", data->bytes.sent); + printk("Bytes received : %u\n", data->bytes.received); + printk("Bytes sent : %u\n", data->bytes.sent); printk("Packets received : %u\n", data->pkts.rx); printk("Packets sent : %u\n", data->pkts.tx); printk("Bcast received : %u\n", data->broadcast.rx); diff --git a/subsys/net/ip/net_stats.c b/subsys/net/ip/net_stats.c index 5da625faeb6d..3f9352922a00 100644 --- a/subsys/net/ip/net_stats.c +++ b/subsys/net/ip/net_stats.c @@ -152,7 +152,7 @@ static inline void stats(struct net_if *iface) #endif #if defined(CONFIG_NET_STATISTICS_TCP) - NET_INFO("TCP bytes recv %llu\tsent\t%llu", + NET_INFO("TCP bytes recv %u\tsent\t%u", GET_STAT(iface, tcp.bytes.received), GET_STAT(iface, tcp.bytes.sent)); NET_INFO("TCP seg recv %u\tsent\t%u\tdrop\t%u", @@ -172,8 +172,8 @@ static inline void stats(struct net_if *iface) GET_STAT(iface, tcp.connrst)); #endif - NET_INFO("Bytes received %llu", GET_STAT(iface, bytes.received)); - NET_INFO("Bytes sent %llu", GET_STAT(iface, bytes.sent)); + NET_INFO("Bytes received %u", GET_STAT(iface, bytes.received)); + NET_INFO("Bytes sent %u", GET_STAT(iface, bytes.sent)); NET_INFO("Processing err %u", GET_STAT(iface, processing_error)); @@ -183,7 +183,7 @@ static inline void stats(struct net_if *iface) NET_INFO("TC Priority\tSent pkts\tbytes"); for (i = 0; i < NET_TC_TX_COUNT; i++) { - NET_INFO("[%d] %s (%u)\t%u\t\t%llu", i, + NET_INFO("[%d] %s (%u)\t%u\t\t%u", i, priority2str(GET_STAT(iface, tc.sent[i].priority)), GET_STAT(iface, tc.sent[i].priority), @@ -197,7 +197,7 @@ static inline void stats(struct net_if *iface) NET_INFO("TC Priority\tRecv pkts\tbytes"); for (i = 0; i < NET_TC_RX_COUNT; i++) { - NET_INFO("[%d] %s (%u)\t%u\t\t%llu", i, + NET_INFO("[%d] %s (%u)\t%u\t\t%u", i, priority2str(GET_STAT(iface, tc.recv[i].priority)), GET_STAT(iface, tc.recv[i].priority), diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index af0db05855fa..c5dc9d889770 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1562,8 +1562,8 @@ static void print_wifi_stats(struct net_if *iface, struct net_stats_wifi *data, PR("Statistics for Wi-Fi interface %p [%d]\n", iface, net_if_get_by_iface(iface)); - PR("Bytes received : %llu\n", data->bytes.received); - PR("Bytes sent : %llu\n", data->bytes.sent); + PR("Bytes received : %u\n", data->bytes.received); + PR("Bytes sent : %u\n", data->bytes.sent); PR("Packets received : %u\n", data->pkts.rx); PR("Packets sent : %u\n", data->pkts.tx); PR("Receive errors : %u\n", data->errors.rx); diff --git a/subsys/net/lib/shell/stats.c b/subsys/net/lib/shell/stats.c index 1c31f56ec8f1..e73cbf614104 100644 --- a/subsys/net/lib/shell/stats.c +++ b/subsys/net/lib/shell/stats.c @@ -50,8 +50,8 @@ static void print_eth_stats(struct net_if *iface, struct net_stats_eth *data, PR("Statistics for Ethernet interface %p [%d]\n", iface, net_if_get_by_iface(iface)); - PR("Bytes received : %llu\n", data->bytes.received); - PR("Bytes sent : %llu\n", data->bytes.sent); + PR("Bytes received : %u\n", data->bytes.received); + PR("Bytes sent : %u\n", data->bytes.sent); PR("Packets received : %u\n", data->pkts.rx); PR("Packets sent : %u\n", data->pkts.tx); PR("Bcast received : %u\n", data->broadcast.rx); @@ -315,13 +315,13 @@ static void print_tc_tx_stats(const struct shell *sh, struct net_if *iface) net_stats_t count = GET_STAT(iface, tc.sent[i].tx_time.count); if (count == 0) { - PR("[%d] %s (%u)\t%u\t\t%llu\t-\n", i, + PR("[%d] %s (%u)\t%u\t\t%u\t-\n", i, priority2str(GET_STAT(iface, tc.sent[i].priority)), GET_STAT(iface, tc.sent[i].priority), GET_STAT(iface, tc.sent[i].pkts), GET_STAT(iface, tc.sent[i].bytes)); } else { - PR("[%d] %s (%u)\t%u\t\t%llu\t%u us%s\n", i, + PR("[%d] %s (%u)\t%u\t\t%u\t%u us%s\n", i, priority2str(GET_STAT(iface, tc.sent[i].priority)), GET_STAT(iface, tc.sent[i].priority), GET_STAT(iface, tc.sent[i].pkts), @@ -336,7 +336,7 @@ static void print_tc_tx_stats(const struct shell *sh, struct net_if *iface) PR("TC Priority\tSent pkts\tbytes\n"); for (i = 0; i < NET_TC_TX_COUNT; i++) { - PR("[%d] %s (%u)\t%u\t\t%llu\n", i, + PR("[%d] %s (%u)\t%u\t\t%u\n", i, priority2str(GET_STAT(iface, tc.sent[i].priority)), GET_STAT(iface, tc.sent[i].priority), GET_STAT(iface, tc.sent[i].pkts), @@ -374,14 +374,14 @@ static void print_tc_rx_stats(const struct shell *sh, struct net_if *iface) net_stats_t count = GET_STAT(iface, tc.recv[i].rx_time.count); if (count == 0) { - PR("[%d] %s (%u)\t%u\t%u\t\t%llu\t-\n", i, + PR("[%d] %s (%u)\t%u\t%u\t\t%u\t-\n", i, priority2str(GET_STAT(iface, tc.recv[i].priority)), GET_STAT(iface, tc.recv[i].priority), GET_STAT(iface, tc.recv[i].pkts), GET_STAT(iface, tc.recv[i].dropped), GET_STAT(iface, tc.recv[i].bytes)); } else { - PR("[%d] %s (%u)\t%u\t%u\t\t%llu\t%u us%s\n", i, + PR("[%d] %s (%u)\t%u\t%u\t\t%u\t%u us%s\n", i, priority2str(GET_STAT(iface, tc.recv[i].priority)), GET_STAT(iface, tc.recv[i].priority), GET_STAT(iface, tc.recv[i].pkts), @@ -397,7 +397,7 @@ static void print_tc_rx_stats(const struct shell *sh, struct net_if *iface) PR("TC Priority\tRecv pkts\tDrop pkts\tbytes\n"); for (i = 0; i < NET_TC_RX_COUNT; i++) { - PR("[%d] %s (%u)\t%u\t%u\t\t%llu\n", i, + PR("[%d] %s (%u)\t%u\t%u\t\t%u\n", i, priority2str(GET_STAT(iface, tc.recv[i].priority)), GET_STAT(iface, tc.recv[i].priority), GET_STAT(iface, tc.recv[i].pkts), @@ -533,7 +533,7 @@ static void net_shell_print_statistics(struct net_if *iface, void *user_data) #endif #if defined(CONFIG_NET_STATISTICS_TCP) && defined(CONFIG_NET_NATIVE_TCP) - PR("TCP bytes recv %llu\tsent\t%llu\tresent\t%u\n", + PR("TCP bytes recv %u\tsent\t%u\tresent\t%u\n", GET_STAT(iface, tcp.bytes.received), GET_STAT(iface, tcp.bytes.sent), GET_STAT(iface, tcp.resent)); @@ -575,8 +575,8 @@ static void net_shell_print_statistics(struct net_if *iface, void *user_data) GET_STAT(iface, pkt_filter.tx.drop)); #endif /* CONFIG_NET_STATISTICS_DNS */ - PR("Bytes received %llu\n", GET_STAT(iface, bytes.received)); - PR("Bytes sent %llu\n", GET_STAT(iface, bytes.sent)); + PR("Bytes received %u\n", GET_STAT(iface, bytes.received)); + PR("Bytes sent %u\n", GET_STAT(iface, bytes.sent)); PR("Processing err %u\n", GET_STAT(iface, processing_error)); print_tc_tx_stats(sh, iface); From 2de7fdefe29d8cd67fa05619768082f0a0d057b1 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:11 +0300 Subject: [PATCH 1551/2141] Revert "[nrf fromtree] net: stats: Use correct format specifiers when printing stats" This reverts commit 263a1a8fcdcbecdce7bb3a1129f75b4b988b1ec7. Signed-off-by: Jukka Rissanen --- samples/net/stats/src/main.c | 36 ++++++++++---------- subsys/net/ip/net_stats.c | 42 +++++++++++------------ subsys/net/lib/shell/stats.c | 64 ++++++++++++++++++------------------ 3 files changed, 71 insertions(+), 71 deletions(-) diff --git a/samples/net/stats/src/main.c b/samples/net/stats/src/main.c index c91ad4e15f27..fdfb7e4339c1 100644 --- a/samples/net/stats/src/main.c +++ b/samples/net/stats/src/main.c @@ -32,25 +32,25 @@ static void print_stats(struct net_if *iface, struct net_stats *data) } #if defined(CONFIG_NET_IPV6) - printk("IPv6 recv %u\tsent\t%u\tdrop\t%u\tforwarded\t%u\n", + printk("IPv6 recv %d\tsent\t%d\tdrop\t%d\tforwarded\t%d\n", GET_STAT(iface, ipv6.recv), GET_STAT(iface, ipv6.sent), GET_STAT(iface, ipv6.drop), GET_STAT(iface, ipv6.forwarded)); #if defined(CONFIG_NET_IPV6_ND) - printk("IPv6 ND recv %u\tsent\t%u\tdrop\t%u\n", + printk("IPv6 ND recv %d\tsent\t%d\tdrop\t%d\n", GET_STAT(iface, ipv6_nd.recv), GET_STAT(iface, ipv6_nd.sent), GET_STAT(iface, ipv6_nd.drop)); #endif /* CONFIG_NET_IPV6_ND */ #if defined(CONFIG_NET_IPV6_PMTU) - printk("IPv6 PMTU recv %u\tsent\t%u\tdrop\t%u\n", + printk("IPv6 PMTU recv %d\tsent\t%d\tdrop\t%d\n", GET_STAT(iface, ipv6_pmtu.recv), GET_STAT(iface, ipv6_pmtu.sent), GET_STAT(iface, ipv6_pmtu.drop)); #endif /* CONFIG_NET_IPV6_PMTU */ #if defined(CONFIG_NET_STATISTICS_MLD) - printk("IPv6 MLD recv %u\tsent\t%u\tdrop\t%u\n", + printk("IPv6 MLD recv %d\tsent\t%d\tdrop\t%d\n", GET_STAT(iface, ipv6_mld.recv), GET_STAT(iface, ipv6_mld.sent), GET_STAT(iface, ipv6_mld.drop)); @@ -58,70 +58,70 @@ static void print_stats(struct net_if *iface, struct net_stats *data) #endif /* CONFIG_NET_IPV6 */ #if defined(CONFIG_NET_IPV4) - printk("IPv4 recv %u\tsent\t%u\tdrop\t%u\tforwarded\t%u\n", + printk("IPv4 recv %d\tsent\t%d\tdrop\t%d\tforwarded\t%d\n", GET_STAT(iface, ipv4.recv), GET_STAT(iface, ipv4.sent), GET_STAT(iface, ipv4.drop), GET_STAT(iface, ipv4.forwarded)); #endif /* CONFIG_NET_IPV4 */ - printk("IP vhlerr %u\thblener\t%u\tlblener\t%u\n", + printk("IP vhlerr %d\thblener\t%d\tlblener\t%d\n", GET_STAT(iface, ip_errors.vhlerr), GET_STAT(iface, ip_errors.hblenerr), GET_STAT(iface, ip_errors.lblenerr)); - printk("IP fragerr %u\tchkerr\t%u\tprotoer\t%u\n", + printk("IP fragerr %d\tchkerr\t%d\tprotoer\t%d\n", GET_STAT(iface, ip_errors.fragerr), GET_STAT(iface, ip_errors.chkerr), GET_STAT(iface, ip_errors.protoerr)); #if defined(CONFIG_NET_IPV4_PMTU) - printk("IPv4 PMTU recv %u\tsent\t%u\tdrop\t%u\n", + printk("IPv4 PMTU recv %d\tsent\t%d\tdrop\t%d\n", GET_STAT(iface, ipv4_pmtu.recv), GET_STAT(iface, ipv4_pmtu.sent), GET_STAT(iface, ipv4_pmtu.drop)); #endif /* CONFIG_NET_IPV4_PMTU */ - printk("ICMP recv %u\tsent\t%u\tdrop\t%u\n", + printk("ICMP recv %d\tsent\t%d\tdrop\t%d\n", GET_STAT(iface, icmp.recv), GET_STAT(iface, icmp.sent), GET_STAT(iface, icmp.drop)); - printk("ICMP typeer %u\tchkerr\t%u\n", + printk("ICMP typeer %d\tchkerr\t%d\n", GET_STAT(iface, icmp.typeerr), GET_STAT(iface, icmp.chkerr)); #if defined(CONFIG_NET_UDP) - printk("UDP recv %u\tsent\t%u\tdrop\t%u\n", + printk("UDP recv %d\tsent\t%d\tdrop\t%d\n", GET_STAT(iface, udp.recv), GET_STAT(iface, udp.sent), GET_STAT(iface, udp.drop)); - printk("UDP chkerr %u\n", + printk("UDP chkerr %d\n", GET_STAT(iface, udp.chkerr)); #endif #if defined(CONFIG_NET_STATISTICS_TCP) - printk("TCP bytes recv %u\tsent\t%u\n", + printk("TCP bytes recv %u\tsent\t%d\n", GET_STAT(iface, tcp.bytes.received), GET_STAT(iface, tcp.bytes.sent)); - printk("TCP seg recv %u\tsent\t%u\tdrop\t%u\n", + printk("TCP seg recv %d\tsent\t%d\tdrop\t%d\n", GET_STAT(iface, tcp.recv), GET_STAT(iface, tcp.sent), GET_STAT(iface, tcp.drop)); - printk("TCP seg resent %u\tchkerr\t%u\tackerr\t%u\n", + printk("TCP seg resent %d\tchkerr\t%d\tackerr\t%d\n", GET_STAT(iface, tcp.resent), GET_STAT(iface, tcp.chkerr), GET_STAT(iface, tcp.ackerr)); - printk("TCP seg rsterr %u\trst\t%u\tre-xmit\t%u\n", + printk("TCP seg rsterr %d\trst\t%d\tre-xmit\t%d\n", GET_STAT(iface, tcp.rsterr), GET_STAT(iface, tcp.rst), GET_STAT(iface, tcp.rexmit)); - printk("TCP conn drop %u\tconnrst\t%u\n", + printk("TCP conn drop %d\tconnrst\t%d\n", GET_STAT(iface, tcp.conndrop), GET_STAT(iface, tcp.connrst)); #endif printk("Bytes received %u\n", GET_STAT(iface, bytes.received)); printk("Bytes sent %u\n", GET_STAT(iface, bytes.sent)); - printk("Processing err %u\n", GET_STAT(iface, processing_error)); + printk("Processing err %d\n", GET_STAT(iface, processing_error)); } #if defined(CONFIG_NET_STATISTICS_PER_INTERFACE) diff --git a/subsys/net/ip/net_stats.c b/subsys/net/ip/net_stats.c index 3f9352922a00..3f9df8c8cf1c 100644 --- a/subsys/net/ip/net_stats.c +++ b/subsys/net/ip/net_stats.c @@ -85,25 +85,25 @@ static inline void stats(struct net_if *iface) } #if defined(CONFIG_NET_STATISTICS_IPV6) - NET_INFO("IPv6 recv %u\tsent\t%u\tdrop\t%u\tforwarded\t%u", + NET_INFO("IPv6 recv %d\tsent\t%d\tdrop\t%d\tforwarded\t%d", GET_STAT(iface, ipv6.recv), GET_STAT(iface, ipv6.sent), GET_STAT(iface, ipv6.drop), GET_STAT(iface, ipv6.forwarded)); #if defined(CONFIG_NET_STATISTICS_IPV6_ND) - NET_INFO("IPv6 ND recv %u\tsent\t%u\tdrop\t%u", + NET_INFO("IPv6 ND recv %d\tsent\t%d\tdrop\t%d", GET_STAT(iface, ipv6_nd.recv), GET_STAT(iface, ipv6_nd.sent), GET_STAT(iface, ipv6_nd.drop)); #endif /* CONFIG_NET_STATISTICS_IPV6_ND */ #if defined(CONFIG_NET_STATISTICS_IPV6_PMTU) - NET_INFO("IPv6 PMTU recv %u\tsent\t%u\tdrop\t%u", + NET_INFO("IPv6 PMTU recv %d\tsent\t%d\tdrop\t%d", GET_STAT(iface, ipv6_pmtu.recv), GET_STAT(iface, ipv6_pmtu.sent), GET_STAT(iface, ipv6_pmtu.drop)); #endif /* CONFIG_NET_STATISTICS_IPV6_PMTU */ #if defined(CONFIG_NET_STATISTICS_MLD) - NET_INFO("IPv6 MLD recv %u\tsent\t%u\tdrop\t%u", + NET_INFO("IPv6 MLD recv %d\tsent\t%d\tdrop\t%d", GET_STAT(iface, ipv6_mld.recv), GET_STAT(iface, ipv6_mld.sent), GET_STAT(iface, ipv6_mld.drop)); @@ -111,70 +111,70 @@ static inline void stats(struct net_if *iface) #endif /* CONFIG_NET_STATISTICS_IPV6 */ #if defined(CONFIG_NET_STATISTICS_IPV4) - NET_INFO("IPv4 recv %u\tsent\t%u\tdrop\t%u\tforwarded\t%u", + NET_INFO("IPv4 recv %d\tsent\t%d\tdrop\t%d\tforwarded\t%d", GET_STAT(iface, ipv4.recv), GET_STAT(iface, ipv4.sent), GET_STAT(iface, ipv4.drop), GET_STAT(iface, ipv4.forwarded)); #endif /* CONFIG_NET_STATISTICS_IPV4 */ - NET_INFO("IP vhlerr %u\thblener\t%u\tlblener\t%u", + NET_INFO("IP vhlerr %d\thblener\t%d\tlblener\t%d", GET_STAT(iface, ip_errors.vhlerr), GET_STAT(iface, ip_errors.hblenerr), GET_STAT(iface, ip_errors.lblenerr)); - NET_INFO("IP fragerr %u\tchkerr\t%u\tprotoer\t%u", + NET_INFO("IP fragerr %d\tchkerr\t%d\tprotoer\t%d", GET_STAT(iface, ip_errors.fragerr), GET_STAT(iface, ip_errors.chkerr), GET_STAT(iface, ip_errors.protoerr)); #if defined(CONFIG_NET_STATISTICS_IPV4_PMTU) - NET_INFO("IPv4 PMTU recv %u\tsent\t%u\tdrop\t%u", + NET_INFO("IPv4 PMTU recv %d\tsent\t%d\tdrop\t%d", GET_STAT(iface, ipv4_pmtu.recv), GET_STAT(iface, ipv4_pmtu.sent), GET_STAT(iface, ipv4_pmtu.drop)); #endif /* CONFIG_NET_STATISTICS_IPV4_PMTU */ - NET_INFO("ICMP recv %u\tsent\t%u\tdrop\t%u", + NET_INFO("ICMP recv %d\tsent\t%d\tdrop\t%d", GET_STAT(iface, icmp.recv), GET_STAT(iface, icmp.sent), GET_STAT(iface, icmp.drop)); - NET_INFO("ICMP typeer %u\tchkerr\t%u", + NET_INFO("ICMP typeer %d\tchkerr\t%d", GET_STAT(iface, icmp.typeerr), GET_STAT(iface, icmp.chkerr)); #if defined(CONFIG_NET_STATISTICS_UDP) - NET_INFO("UDP recv %u\tsent\t%u\tdrop\t%u", + NET_INFO("UDP recv %d\tsent\t%d\tdrop\t%d", GET_STAT(iface, udp.recv), GET_STAT(iface, udp.sent), GET_STAT(iface, udp.drop)); - NET_INFO("UDP chkerr %u", + NET_INFO("UDP chkerr %d", GET_STAT(iface, udp.chkerr)); #endif #if defined(CONFIG_NET_STATISTICS_TCP) - NET_INFO("TCP bytes recv %u\tsent\t%u", + NET_INFO("TCP bytes recv %u\tsent\t%d", GET_STAT(iface, tcp.bytes.received), GET_STAT(iface, tcp.bytes.sent)); - NET_INFO("TCP seg recv %u\tsent\t%u\tdrop\t%u", + NET_INFO("TCP seg recv %d\tsent\t%d\tdrop\t%d", GET_STAT(iface, tcp.recv), GET_STAT(iface, tcp.sent), GET_STAT(iface, tcp.drop)); - NET_INFO("TCP seg resent %u\tchkerr\t%u\tackerr\t%u", + NET_INFO("TCP seg resent %d\tchkerr\t%d\tackerr\t%d", GET_STAT(iface, tcp.resent), GET_STAT(iface, tcp.chkerr), GET_STAT(iface, tcp.ackerr)); - NET_INFO("TCP seg rsterr %u\trst\t%u\tre-xmit\t%u", + NET_INFO("TCP seg rsterr %d\trst\t%d\tre-xmit\t%d", GET_STAT(iface, tcp.rsterr), GET_STAT(iface, tcp.rst), GET_STAT(iface, tcp.rexmit)); - NET_INFO("TCP conn drop %u\tconnrst\t%u", + NET_INFO("TCP conn drop %d\tconnrst\t%d", GET_STAT(iface, tcp.conndrop), GET_STAT(iface, tcp.connrst)); #endif NET_INFO("Bytes received %u", GET_STAT(iface, bytes.received)); NET_INFO("Bytes sent %u", GET_STAT(iface, bytes.sent)); - NET_INFO("Processing err %u", + NET_INFO("Processing err %d", GET_STAT(iface, processing_error)); #if NET_TC_COUNT > 1 @@ -183,7 +183,7 @@ static inline void stats(struct net_if *iface) NET_INFO("TC Priority\tSent pkts\tbytes"); for (i = 0; i < NET_TC_TX_COUNT; i++) { - NET_INFO("[%d] %s (%u)\t%u\t\t%u", i, + NET_INFO("[%d] %s (%d)\t%d\t\t%d", i, priority2str(GET_STAT(iface, tc.sent[i].priority)), GET_STAT(iface, tc.sent[i].priority), @@ -197,7 +197,7 @@ static inline void stats(struct net_if *iface) NET_INFO("TC Priority\tRecv pkts\tbytes"); for (i = 0; i < NET_TC_RX_COUNT; i++) { - NET_INFO("[%d] %s (%u)\t%u\t\t%u", i, + NET_INFO("[%d] %s (%d)\t%d\t\t%d", i, priority2str(GET_STAT(iface, tc.recv[i].priority)), GET_STAT(iface, tc.recv[i].priority), @@ -213,7 +213,7 @@ static inline void stats(struct net_if *iface) NET_INFO("Power management statistics:"); NET_INFO("Last suspend time: %u ms", GET_STAT(iface, pm.last_suspend_time)); - NET_INFO("Got suspended %u times", + NET_INFO("Got suspended %d times", GET_STAT(iface, pm.suspend_count)); NET_INFO("Average suspend time: %u ms", (uint32_t)(GET_STAT(iface, pm.overall_suspend_time) / diff --git a/subsys/net/lib/shell/stats.c b/subsys/net/lib/shell/stats.c index e73cbf614104..64256bc7473a 100644 --- a/subsys/net/lib/shell/stats.c +++ b/subsys/net/lib/shell/stats.c @@ -315,13 +315,13 @@ static void print_tc_tx_stats(const struct shell *sh, struct net_if *iface) net_stats_t count = GET_STAT(iface, tc.sent[i].tx_time.count); if (count == 0) { - PR("[%d] %s (%u)\t%u\t\t%u\t-\n", i, + PR("[%d] %s (%d)\t%d\t\t%d\t-\n", i, priority2str(GET_STAT(iface, tc.sent[i].priority)), GET_STAT(iface, tc.sent[i].priority), GET_STAT(iface, tc.sent[i].pkts), GET_STAT(iface, tc.sent[i].bytes)); } else { - PR("[%d] %s (%u)\t%u\t\t%u\t%u us%s\n", i, + PR("[%d] %s (%d)\t%d\t\t%d\t%u us%s\n", i, priority2str(GET_STAT(iface, tc.sent[i].priority)), GET_STAT(iface, tc.sent[i].priority), GET_STAT(iface, tc.sent[i].pkts), @@ -336,7 +336,7 @@ static void print_tc_tx_stats(const struct shell *sh, struct net_if *iface) PR("TC Priority\tSent pkts\tbytes\n"); for (i = 0; i < NET_TC_TX_COUNT; i++) { - PR("[%d] %s (%u)\t%u\t\t%u\n", i, + PR("[%d] %s (%d)\t%d\t\t%d\n", i, priority2str(GET_STAT(iface, tc.sent[i].priority)), GET_STAT(iface, tc.sent[i].priority), GET_STAT(iface, tc.sent[i].pkts), @@ -374,14 +374,14 @@ static void print_tc_rx_stats(const struct shell *sh, struct net_if *iface) net_stats_t count = GET_STAT(iface, tc.recv[i].rx_time.count); if (count == 0) { - PR("[%d] %s (%u)\t%u\t%u\t\t%u\t-\n", i, + PR("[%d] %s (%d)\t%d\t%d\t\t%d\t-\n", i, priority2str(GET_STAT(iface, tc.recv[i].priority)), GET_STAT(iface, tc.recv[i].priority), GET_STAT(iface, tc.recv[i].pkts), GET_STAT(iface, tc.recv[i].dropped), GET_STAT(iface, tc.recv[i].bytes)); } else { - PR("[%d] %s (%u)\t%u\t%u\t\t%u\t%u us%s\n", i, + PR("[%d] %s (%d)\t%d\t%d\t\t%d\t%u us%s\n", i, priority2str(GET_STAT(iface, tc.recv[i].priority)), GET_STAT(iface, tc.recv[i].priority), GET_STAT(iface, tc.recv[i].pkts), @@ -397,7 +397,7 @@ static void print_tc_rx_stats(const struct shell *sh, struct net_if *iface) PR("TC Priority\tRecv pkts\tDrop pkts\tbytes\n"); for (i = 0; i < NET_TC_RX_COUNT; i++) { - PR("[%d] %s (%u)\t%u\t%u\t\t%u\n", i, + PR("[%d] %s (%d)\t%d\t%d\t\t%d\n", i, priority2str(GET_STAT(iface, tc.recv[i].priority)), GET_STAT(iface, tc.recv[i].priority), GET_STAT(iface, tc.recv[i].pkts), @@ -459,25 +459,25 @@ static void net_shell_print_statistics(struct net_if *iface, void *user_data) } #if defined(CONFIG_NET_STATISTICS_IPV6) && defined(CONFIG_NET_NATIVE_IPV6) - PR("IPv6 recv %u\tsent\t%u\tdrop\t%u\tforwarded\t%u\n", + PR("IPv6 recv %d\tsent\t%d\tdrop\t%d\tforwarded\t%d\n", GET_STAT(iface, ipv6.recv), GET_STAT(iface, ipv6.sent), GET_STAT(iface, ipv6.drop), GET_STAT(iface, ipv6.forwarded)); #if defined(CONFIG_NET_STATISTICS_IPV6_ND) - PR("IPv6 ND recv %u\tsent\t%u\tdrop\t%u\n", + PR("IPv6 ND recv %d\tsent\t%d\tdrop\t%d\n", GET_STAT(iface, ipv6_nd.recv), GET_STAT(iface, ipv6_nd.sent), GET_STAT(iface, ipv6_nd.drop)); #endif /* CONFIG_NET_STATISTICS_IPV6_ND */ #if defined(CONFIG_NET_STATISTICS_IPV6_PMTU) - PR("IPv6 PMTU recv %u\tsent\t%u\tdrop\t%u\n", + PR("IPv6 PMTU recv %d\tsent\t%d\tdrop\t%d\n", GET_STAT(iface, ipv6_pmtu.recv), GET_STAT(iface, ipv6_pmtu.sent), GET_STAT(iface, ipv6_pmtu.drop)); #endif /* CONFIG_NET_STATISTICS_IPV6_PMTU */ #if defined(CONFIG_NET_STATISTICS_MLD) - PR("IPv6 MLD recv %u\tsent\t%u\tdrop\t%u\n", + PR("IPv6 MLD recv %d\tsent\t%d\tdrop\t%d\n", GET_STAT(iface, ipv6_mld.recv), GET_STAT(iface, ipv6_mld.sent), GET_STAT(iface, ipv6_mld.drop)); @@ -485,86 +485,86 @@ static void net_shell_print_statistics(struct net_if *iface, void *user_data) #endif /* CONFIG_NET_STATISTICS_IPV6 */ #if defined(CONFIG_NET_STATISTICS_IPV4) && defined(CONFIG_NET_NATIVE_IPV4) - PR("IPv4 recv %u\tsent\t%u\tdrop\t%u\tforwarded\t%u\n", + PR("IPv4 recv %d\tsent\t%d\tdrop\t%d\tforwarded\t%d\n", GET_STAT(iface, ipv4.recv), GET_STAT(iface, ipv4.sent), GET_STAT(iface, ipv4.drop), GET_STAT(iface, ipv4.forwarded)); #endif /* CONFIG_NET_STATISTICS_IPV4 */ - PR("IP vhlerr %u\thblener\t%u\tlblener\t%u\n", + PR("IP vhlerr %d\thblener\t%d\tlblener\t%d\n", GET_STAT(iface, ip_errors.vhlerr), GET_STAT(iface, ip_errors.hblenerr), GET_STAT(iface, ip_errors.lblenerr)); - PR("IP fragerr %u\tchkerr\t%u\tprotoer\t%u\n", + PR("IP fragerr %d\tchkerr\t%d\tprotoer\t%d\n", GET_STAT(iface, ip_errors.fragerr), GET_STAT(iface, ip_errors.chkerr), GET_STAT(iface, ip_errors.protoerr)); #if defined(CONFIG_NET_STATISTICS_IPV4_PMTU) - PR("IPv4 PMTU recv %u\tsent\t%u\tdrop\t%u\n", + PR("IPv4 PMTU recv %d\tsent\t%d\tdrop\t%d\n", GET_STAT(iface, ipv4_pmtu.recv), GET_STAT(iface, ipv4_pmtu.sent), GET_STAT(iface, ipv4_pmtu.drop)); #endif /* CONFIG_NET_STATISTICS_IPV4_PMTU */ #if defined(CONFIG_NET_STATISTICS_ICMP) && defined(CONFIG_NET_NATIVE_IPV4) - PR("ICMP recv %u\tsent\t%u\tdrop\t%u\n", + PR("ICMP recv %d\tsent\t%d\tdrop\t%d\n", GET_STAT(iface, icmp.recv), GET_STAT(iface, icmp.sent), GET_STAT(iface, icmp.drop)); - PR("ICMP typeer %u\tchkerr\t%u\n", + PR("ICMP typeer %d\tchkerr\t%d\n", GET_STAT(iface, icmp.typeerr), GET_STAT(iface, icmp.chkerr)); #endif #if defined(CONFIG_NET_STATISTICS_IGMP) - PR("IGMP recv %u\tsent\t%u\tdrop\t%u\n", + PR("IGMP recv %d\tsent\t%d\tdrop\t%d\n", GET_STAT(iface, ipv4_igmp.recv), GET_STAT(iface, ipv4_igmp.sent), GET_STAT(iface, ipv4_igmp.drop)); #endif /* CONFIG_NET_STATISTICS_IGMP */ #if defined(CONFIG_NET_STATISTICS_UDP) && defined(CONFIG_NET_NATIVE_UDP) - PR("UDP recv %u\tsent\t%u\tdrop\t%u\n", + PR("UDP recv %d\tsent\t%d\tdrop\t%d\n", GET_STAT(iface, udp.recv), GET_STAT(iface, udp.sent), GET_STAT(iface, udp.drop)); - PR("UDP chkerr %u\n", + PR("UDP chkerr %d\n", GET_STAT(iface, udp.chkerr)); #endif #if defined(CONFIG_NET_STATISTICS_TCP) && defined(CONFIG_NET_NATIVE_TCP) - PR("TCP bytes recv %u\tsent\t%u\tresent\t%u\n", + PR("TCP bytes recv %u\tsent\t%d\tresent\t%d\n", GET_STAT(iface, tcp.bytes.received), GET_STAT(iface, tcp.bytes.sent), GET_STAT(iface, tcp.resent)); - PR("TCP seg recv %u\tsent\t%u\tdrop\t%u\n", + PR("TCP seg recv %d\tsent\t%d\tdrop\t%d\n", GET_STAT(iface, tcp.recv), GET_STAT(iface, tcp.sent), GET_STAT(iface, tcp.seg_drop)); - PR("TCP seg resent %u\tchkerr\t%u\tackerr\t%u\n", + PR("TCP seg resent %d\tchkerr\t%d\tackerr\t%d\n", GET_STAT(iface, tcp.rexmit), GET_STAT(iface, tcp.chkerr), GET_STAT(iface, tcp.ackerr)); - PR("TCP seg rsterr %u\trst\t%u\n", + PR("TCP seg rsterr %d\trst\t%d\n", GET_STAT(iface, tcp.rsterr), GET_STAT(iface, tcp.rst)); - PR("TCP conn drop %u\tconnrst\t%u\n", + PR("TCP conn drop %d\tconnrst\t%d\n", GET_STAT(iface, tcp.conndrop), GET_STAT(iface, tcp.connrst)); - PR("TCP pkt drop %u\n", GET_STAT(iface, tcp.drop)); + PR("TCP pkt drop %d\n", GET_STAT(iface, tcp.drop)); #endif #if defined(CONFIG_NET_STATISTICS_DNS) - PR("DNS recv %u\tsent\t%u\tdrop\t%u\n", + PR("DNS recv %d\tsent\t%d\tdrop\t%d\n", GET_STAT(iface, dns.recv), GET_STAT(iface, dns.sent), GET_STAT(iface, dns.drop)); #endif /* CONFIG_NET_STATISTICS_DNS */ #if defined(CONFIG_NET_STATISTICS_PKT_FILTER) - PR("Filter drop rx %u" - IF_ENABLED(CONFIG_NET_PKT_FILTER_IPV4_HOOK, ("\tIPv4\t%u")) - IF_ENABLED(CONFIG_NET_PKT_FILTER_IPV6_HOOK, ("\tIPv6\t%u")) - IF_ENABLED(CONFIG_NET_PKT_FILTER_LOCAL_IN_HOOK, ("\tlocal\t%u")) - "\ttx\t%u\n", + PR("Filter drop rx %d" + IF_ENABLED(CONFIG_NET_PKT_FILTER_IPV4_HOOK, ("\tIPv4\t%d")) + IF_ENABLED(CONFIG_NET_PKT_FILTER_IPV6_HOOK, ("\tIPv6\t%d")) + IF_ENABLED(CONFIG_NET_PKT_FILTER_LOCAL_IN_HOOK, ("\tlocal\t%d")) + "\ttx\t%d\n", GET_STAT(iface, pkt_filter.rx.drop), IF_ENABLED(CONFIG_NET_PKT_FILTER_IPV4_HOOK, (GET_STAT(iface, pkt_filter.rx.ipv4_drop),)) @@ -577,7 +577,7 @@ static void net_shell_print_statistics(struct net_if *iface, void *user_data) PR("Bytes received %u\n", GET_STAT(iface, bytes.received)); PR("Bytes sent %u\n", GET_STAT(iface, bytes.sent)); - PR("Processing err %u\n", GET_STAT(iface, processing_error)); + PR("Processing err %d\n", GET_STAT(iface, processing_error)); print_tc_tx_stats(sh, iface); print_tc_rx_stats(sh, iface); From 4c37dc73a0732616d9961cb3a3aeb6bac828dd5f Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:11 +0300 Subject: [PATCH 1552/2141] Revert "[nrf fromtree] net: sockets_offload: Allow to enable/disable DNS offload at runtime" This reverts commit cc1ccd035ce8e4836d26ec1d65c1c322b5e12d94. Signed-off-by: Jukka Rissanen --- include/zephyr/net/socket_offload.h | 33 ------------------------- subsys/net/lib/sockets/getaddrinfo.c | 4 +-- subsys/net/lib/sockets/socket_offload.c | 30 +--------------------- 3 files changed, 3 insertions(+), 64 deletions(-) diff --git a/include/zephyr/net/socket_offload.h b/include/zephyr/net/socket_offload.h index 4dcf27250b44..988d0fb686b3 100644 --- a/include/zephyr/net/socket_offload.h +++ b/include/zephyr/net/socket_offload.h @@ -41,39 +41,6 @@ struct socket_dns_offload { */ void socket_offload_dns_register(const struct socket_dns_offload *ops); -/** - * @brief Deregister an offloaded socket DNS API interface. - * - * @param ops A pointer to the offloaded socket DNS API interface. - * - * @retval 0 On success - * @retval -EINVAL Offloaded DNS API was not regsitered. - */ -int socket_offload_dns_deregister(const struct socket_dns_offload *ops); - -/** - * @brief Enable/disable DNS offloading at runtime. - * - * @param enable Whether to enable or disable the DNS offloading. - */ -void socket_offload_dns_enable(bool enable); - -/** - * @brief Check if DNS offloading is enabled. - * - * @retval true DNS offloaded API is registered and enabled. - * @retval false DNS offloading is disabled. - */ -#if defined(CONFIG_NET_SOCKETS_OFFLOAD) -bool socket_offload_dns_is_enabled(void); -#else -static inline bool socket_offload_dns_is_enabled(void) -{ - return false; -} -#endif /* defined(CONFIG_NET_SOCKETS_OFFLOAD) */ - - /** @cond INTERNAL_HIDDEN */ int socket_offload_getaddrinfo(const char *node, const char *service, diff --git a/subsys/net/lib/sockets/getaddrinfo.c b/subsys/net/lib/sockets/getaddrinfo.c index a53f3a005a47..86ee417d929e 100644 --- a/subsys/net/lib/sockets/getaddrinfo.c +++ b/subsys/net/lib/sockets/getaddrinfo.c @@ -433,7 +433,7 @@ int zsock_getaddrinfo(const char *host, const char *service, const struct zsock_addrinfo *hints, struct zsock_addrinfo **res) { - if (socket_offload_dns_is_enabled()) { + if (IS_ENABLED(CONFIG_NET_SOCKETS_OFFLOAD)) { return socket_offload_getaddrinfo(host, service, hints, res); } @@ -471,7 +471,7 @@ int zsock_getaddrinfo(const char *host, const char *service, void zsock_freeaddrinfo(struct zsock_addrinfo *ai) { - if (socket_offload_dns_is_enabled()) { + if (IS_ENABLED(CONFIG_NET_SOCKETS_OFFLOAD)) { socket_offload_freeaddrinfo(ai); return; } diff --git a/subsys/net/lib/sockets/socket_offload.c b/subsys/net/lib/sockets/socket_offload.c index 3e4ea3b8bbec..b6c2ef4fd64a 100644 --- a/subsys/net/lib/sockets/socket_offload.c +++ b/subsys/net/lib/sockets/socket_offload.c @@ -12,8 +12,7 @@ LOG_MODULE_REGISTER(net_socket_offload, CONFIG_NET_SOCKETS_LOG_LEVEL); #include "sockets_internal.h" -static const struct socket_dns_offload *dns_offload; -static bool dns_offload_enabled; +const struct socket_dns_offload *dns_offload; void socket_offload_dns_register(const struct socket_dns_offload *ops) { @@ -21,33 +20,6 @@ void socket_offload_dns_register(const struct socket_dns_offload *ops) __ASSERT_NO_MSG(dns_offload == NULL); dns_offload = ops; - - socket_offload_dns_enable(true); -} - -int socket_offload_dns_deregister(const struct socket_dns_offload *ops) -{ - __ASSERT_NO_MSG(ops != NULL); - - if (dns_offload != ops) { - return -EINVAL; - } - - dns_offload = NULL; - - socket_offload_dns_enable(false); - - return 0; -} - -void socket_offload_dns_enable(bool enable) -{ - dns_offload_enabled = enable; -} - -bool socket_offload_dns_is_enabled(void) -{ - return (dns_offload != NULL) && dns_offload_enabled; } int socket_offload_getaddrinfo(const char *node, const char *service, From 88f5d3b4e39f05866e9ff3c66f7ea4383cc67f5a Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:11 +0300 Subject: [PATCH 1553/2141] Revert "[nrf fromtree] net: mqtt: Allow to bind client to a specific interface" This reverts commit e3a33ba9b8c3147958c82d3e0298f45edee73062. Signed-off-by: Jukka Rissanen --- include/zephyr/net/mqtt.h | 5 ----- .../net/lib/mqtt/mqtt_transport_socket_tcp.c | 22 ++----------------- .../net/lib/mqtt/mqtt_transport_socket_tls.c | 18 --------------- 3 files changed, 2 insertions(+), 43 deletions(-) diff --git a/include/zephyr/net/mqtt.h b/include/zephyr/net/mqtt.h index b992714afd32..d5dce240230a 100644 --- a/include/zephyr/net/mqtt.h +++ b/include/zephyr/net/mqtt.h @@ -809,11 +809,6 @@ struct mqtt_transport { */ enum mqtt_transport_type type; - /** Name of the interface that the MQTT client instance should be bound to. - * Leave as NULL if not specified. - */ - const char *if_name; - /** Use either unsecured TCP or secured TLS transport */ union { /** TCP socket transport for MQTT */ diff --git a/subsys/net/lib/mqtt/mqtt_transport_socket_tcp.c b/subsys/net/lib/mqtt/mqtt_transport_socket_tcp.c index 58f37857bb22..ffb8bcdb6830 100644 --- a/subsys/net/lib/mqtt/mqtt_transport_socket_tcp.c +++ b/subsys/net/lib/mqtt/mqtt_transport_socket_tcp.c @@ -29,26 +29,6 @@ int mqtt_client_tcp_connect(struct mqtt_client *client) return -errno; } - NET_DBG("Created socket %d", client->transport.tcp.sock); - - if (client->transport.if_name != NULL) { - struct ifreq ifname = { 0 }; - - strncpy(ifname.ifr_name, client->transport.if_name, - sizeof(ifname.ifr_name) - 1); - - ret = zsock_setsockopt(client->transport.tcp.sock, SOL_SOCKET, - SO_BINDTODEVICE, &ifname, - sizeof(struct ifreq)); - if (ret < 0) { - NET_ERR("Failed to bind ot interface %s error (%d)", - ifname.ifr_name, -errno); - goto error; - } - - NET_DBG("Bound to interface %s", ifname.ifr_name); - } - #if defined(CONFIG_SOCKS) if (client->transport.proxy.addrlen != 0) { ret = setsockopt(client->transport.tcp.sock, @@ -61,6 +41,8 @@ int mqtt_client_tcp_connect(struct mqtt_client *client) } #endif + NET_DBG("Created socket %d", client->transport.tcp.sock); + size_t peer_addr_size = sizeof(struct sockaddr_in6); if (broker->sa_family == AF_INET) { diff --git a/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c b/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c index 2ff337eef343..a33cee5aecfd 100644 --- a/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c +++ b/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c @@ -32,24 +32,6 @@ int mqtt_client_tls_connect(struct mqtt_client *client) NET_DBG("Created socket %d", client->transport.tls.sock); - if (client->transport.if_name != NULL) { - struct ifreq ifname = { 0 }; - - strncpy(ifname.ifr_name, client->transport.if_name, - sizeof(ifname.ifr_name) - 1); - - ret = zsock_setsockopt(client->transport.tls.sock, SOL_SOCKET, - SO_BINDTODEVICE, &ifname, - sizeof(struct ifreq)); - if (ret < 0) { - NET_ERR("Failed to bind ot interface %s error (%d)", - ifname.ifr_name, -errno); - goto error; - } - - NET_DBG("Bound to interface %s", ifname.ifr_name); - } - #if defined(CONFIG_SOCKS) if (client->transport.proxy.addrlen != 0) { ret = setsockopt(client->transport.tls.sock, From 6f3618238ba96be50ee1c31b77e16a8e660a73fa Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:11 +0300 Subject: [PATCH 1554/2141] Revert "[nrf fromtree] dts: bindings: nordic-nrf-nfct-v2: Extend description" This reverts commit 1f9b5b32f8b2d9db4273e30e7e82c82c4de77262. Signed-off-by: Jukka Rissanen --- dts/bindings/net/wireless/nordic,nrf-nfct-v2.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/dts/bindings/net/wireless/nordic,nrf-nfct-v2.yaml b/dts/bindings/net/wireless/nordic,nrf-nfct-v2.yaml index f7602739114c..e6b34aff3ecc 100644 --- a/dts/bindings/net/wireless/nordic,nrf-nfct-v2.yaml +++ b/dts/bindings/net/wireless/nordic,nrf-nfct-v2.yaml @@ -12,8 +12,7 @@ properties: type: boolean description: | When enabled this property will configure pins dedicated to NFCT - peripheral as regular GPIOs. If this property is applied in cpuapp then node - can be disabled or reserved (because NFCT is by default assigned to cpuapp). - If property is applied in cpurad CPU then node must be reserved. + peripheral as regular GPIOs. This property must be applied in cpuapp + if NFCT pins are intended to be used as regular GPIOs by any core. NFC pins in nRF54H series: P2.10 and P2.11 From 263ab9bc63274371da99e7dd57026acfc46479bd Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:11 +0300 Subject: [PATCH 1555/2141] Revert "[nrf fromtree] soc: nordic: nrf54h: Allow using NFCT pins as gpios on cpurad" This reverts commit b0f414596b7e6ebfa0d86537e5b1e63bb76bf36c. Signed-off-by: Jukka Rissanen --- soc/nordic/nrf54h/soc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/soc/nordic/nrf54h/soc.c b/soc/nordic/nrf54h/soc.c index e053953b821e..c1849ab3a239 100644 --- a/soc/nordic/nrf54h/soc.c +++ b/soc/nordic/nrf54h/soc.c @@ -153,9 +153,7 @@ void soc_early_init_hook(void) nrf_spu_periph_perm_dmasec_set(spu, nrf_address_slave_get(ccm030_addr), true); #endif - if (((IS_ENABLED(CONFIG_SOC_NRF54H20_CPUAPP) && - DT_NODE_HAS_STATUS(DT_NODELABEL(nfct), disabled)) || - DT_NODE_HAS_STATUS(DT_NODELABEL(nfct), reserved)) && + if (DT_NODE_HAS_STATUS(DT_NODELABEL(nfct), disabled) && DT_PROP_OR(DT_NODELABEL(nfct), nfct_pins_as_gpios, 0)) { nrf_nfct_pad_config_enable_set(NRF_NFCT, false); } From 90e4ce6c43fa1ea02ba4ad4ec69414e9a2e9c602 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:11 +0300 Subject: [PATCH 1556/2141] Revert "[nrf fromtree] dts: vendor: nordic: Fix nfct compatible" This reverts commit 9ae44c864700b51d8dc4e3bdabf994420b5c4d66. Signed-off-by: Jukka Rissanen --- dts/arm/nordic/nrf54h20_cpuapp.dtsi | 4 ++++ dts/vendor/nordic/nrf54h20.dtsi | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/dts/arm/nordic/nrf54h20_cpuapp.dtsi b/dts/arm/nordic/nrf54h20_cpuapp.dtsi index c56df42ddd5b..15eac9c5d197 100644 --- a/dts/arm/nordic/nrf54h20_cpuapp.dtsi +++ b/dts/arm/nordic/nrf54h20_cpuapp.dtsi @@ -59,3 +59,7 @@ wdt011: &cpuapp_wdt011 {}; &grtc { interrupts = <109 NRF_DEFAULT_IRQ_PRIORITY>; }; + +&nfct { + compatible = "nordic,nrf-nfct-v2"; +}; diff --git a/dts/vendor/nordic/nrf54h20.dtsi b/dts/vendor/nordic/nrf54h20.dtsi index 5fcb941aaae2..96d4ff53af1c 100644 --- a/dts/vendor/nordic/nrf54h20.dtsi +++ b/dts/vendor/nordic/nrf54h20.dtsi @@ -918,7 +918,7 @@ }; nfct: nfct@985000 { - compatible = "nordic,nrf-nfct-v2"; + compatible = "nordic,nrf-nfct"; reg = <0x985000 0x1000>; status = "disabled"; interrupts = <389 NRF_DEFAULT_IRQ_PRIORITY>; From 973496599089ad79e933a4df5b5b4c664de25c1a Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:11 +0300 Subject: [PATCH 1557/2141] Revert "[nrf fromtree] soc: nordic: common: Fix HAS_HW_NRF_NFCT condition" This reverts commit 2335e7f94853e6850bf9254b82d43a8a8243dc59. Signed-off-by: Jukka Rissanen --- soc/nordic/common/Kconfig.peripherals | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/soc/nordic/common/Kconfig.peripherals b/soc/nordic/common/Kconfig.peripherals index ce91800a6150..5a6e820efcb9 100644 --- a/soc/nordic/common/Kconfig.peripherals +++ b/soc/nordic/common/Kconfig.peripherals @@ -118,8 +118,7 @@ config HAS_HW_NRF_MWU def_bool $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF_MWU)) config HAS_HW_NRF_NFCT - def_bool $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF_NFCT)) || \ - $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF_NFCT_V2)) + def_bool $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF_NFCT)) config HAS_HW_NRF_NVMC_PE def_bool $(dt_nodelabel_bool_prop,flash_controller,partial-erase) From 14aa0f5fd47fafd1a1eedf4be756a10070b6e0a6 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:11 +0300 Subject: [PATCH 1558/2141] Revert "[nrf fromtree] net: l2: wifi: Fix mode change issue in Wi-Fi shell" This reverts commit d58d68a1c7b22fbb7d79313bb749b9a1fc4d85ee. Signed-off-by: Jukka Rissanen --- subsys/net/l2/wifi/wifi_shell.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index c5dc9d889770..0b8257695dd9 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -2865,11 +2865,11 @@ void parse_mode_args_to_params(const struct shell *sh, int argc, {"monitor", no_argument, 0, 'm'}, {"ap", no_argument, 0, 'a'}, {"softap", no_argument, 0, 'k'}, + {"get", no_argument, 0, 'g'}, {"help", no_argument, 0, 'h'}, {0, 0, 0, 0}}; - mode->oper = WIFI_MGMT_GET; - while ((opt = getopt_long(argc, argv, "i:smtpakh", + while ((opt = getopt_long(argc, argv, "i:smtpakgh", long_options, &opt_index)) != -1) { state = getopt_state_get(); switch (opt) { @@ -2889,6 +2889,10 @@ void parse_mode_args_to_params(const struct shell *sh, int argc, mode->mode |= WIFI_SOFTAP_MODE; opt_num++; break; + case 'g': + mode->oper = WIFI_MGMT_GET; + opt_num++; + break; case 'i': mode->if_index = (uint8_t)atoi(state->optarg); /* Don't count iface as it's common for both get and set */ @@ -2904,7 +2908,7 @@ void parse_mode_args_to_params(const struct shell *sh, int argc, } } - if (opt_num != 0) { + if (opt_num == 0) { mode->oper = WIFI_MGMT_SET; } } @@ -4060,8 +4064,9 @@ SHELL_SUBCMD_ADD((wifi), mode, NULL, "[-a, --ap] : AP mode\n" "[-k, --softap] : Softap mode\n" "[-h, --help] : Help\n" + "[-g, --get] : Get current mode for a specific interface index\n" "Usage: Get operation example for interface index 1\n" - "wifi mode -i1\n" + "wifi mode -g -i1\n" "Set operation example for interface index 1 - set station+promiscuous\n" "wifi mode -i1 -sp.\n", cmd_wifi_mode, From 73543c0c1b381dd60efafbba7205d09a8650e8f9 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:11 +0300 Subject: [PATCH 1559/2141] Revert "[nrf fromtree] kernel: Guard SYS_CLOCK_HW_CYCLES_PER_SEC to avoid spurious empty macro" This reverts commit abcf8fc2c12403f5912344a41f5af259615f110a. Signed-off-by: Jukka Rissanen --- kernel/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/kernel/Kconfig b/kernel/Kconfig index 536a6624f522..6e7058ffc431 100644 --- a/kernel/Kconfig +++ b/kernel/Kconfig @@ -828,7 +828,6 @@ config SYS_CLOCK_TICKS_PER_SEC config SYS_CLOCK_HW_CYCLES_PER_SEC int "System clock's h/w timer frequency" default 0 if TIMER_READS_ITS_FREQUENCY_AT_RUNTIME - depends on SYS_CLOCK_EXISTS help This option specifies the frequency of the hardware timer used for the system clock (in Hz). This option is set by the SOC's or board's Kconfig file From 5120350ecf32a268fa691b8abb76324f28cc10c1 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:11 +0300 Subject: [PATCH 1560/2141] Revert "[nrf fromtree] bluetooth: mesh: clarify mesh dfu fwid max length" This reverts commit 576de35b2fe8ec34351cf0b2bc05d1332ade2b80. Signed-off-by: Jukka Rissanen --- subsys/bluetooth/mesh/Kconfig | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index e51ad2ccac0e..b876e88dae69 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -1085,15 +1085,10 @@ menu "Firmware Update model configuration" config BT_MESH_DFU_FWID_MAXLEN int "DFU FWID max length" - default 106 + default 16 range 0 106 help - This value defines the maximum length of the vendor-specific version information - that the mesh stack can manage, describing the image. Please note that - only 106 octets size allows the device to be compliant with - the Bluetooth Mesh DFU specification. If smaller than 106 octets are set, - then the device will fail with managing firmware images that have - a longer vendor-specific version information. + This value defines the maximum length of an image's firmware ID. config BT_MESH_DFU_METADATA_MAXLEN int "DFU metadata max length" From 198d30cd770c525dfca07d2ed2ea4fd6c96e7763 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:11 +0300 Subject: [PATCH 1561/2141] Revert "[nrf fromtree] tests: bluetooth: tester: fix configuration to use max fwid length" This reverts commit 7038ae2f234221e3cda6c35becc3eb09bc36f19b. Signed-off-by: Jukka Rissanen --- tests/bluetooth/tester/overlay-mesh.conf | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/bluetooth/tester/overlay-mesh.conf b/tests/bluetooth/tester/overlay-mesh.conf index 9def34c62acf..04e6c074e214 100644 --- a/tests/bluetooth/tester/overlay-mesh.conf +++ b/tests/bluetooth/tester/overlay-mesh.conf @@ -19,9 +19,9 @@ CONFIG_BT_MESH_CFG_CLI=y CONFIG_BT_MESH_HEALTH_CLI=y CONFIG_BT_MESH_FRIEND=y CONFIG_BT_MESH_FRIEND_QUEUE_SIZE=32 -CONFIG_BT_MESH_RX_SEG_MAX=32 -CONFIG_BT_MESH_TX_SEG_MAX=32 -CONFIG_BT_MESH_TX_SEG_MSG_COUNT=10 +CONFIG_BT_MESH_RX_SEG_MAX=13 +CONFIG_BT_MESH_TX_SEG_MAX=8 +CONFIG_BT_MESH_TX_SEG_MSG_COUNT=3 CONFIG_BT_MESH_LPN_POLL_TIMEOUT=100 CONFIG_BT_MESH_PROVISIONER=y CONFIG_BT_MESH_CDB=y @@ -38,6 +38,7 @@ CONFIG_BT_MESH_LARGE_COMP_DATA_CLI=y CONFIG_BT_MESH_LARGE_COMP_DATA_SRV=y CONFIG_BT_MESH_SAR_CFG_SRV=y CONFIG_BT_MESH_SAR_CFG_CLI=y +CONFIG_BT_MESH_TX_SEG_MSG_COUNT=10 CONFIG_BT_MESH_RPR_SRV=y CONFIG_BT_MESH_RPR_CLI=y CONFIG_BT_MESH_RPR_AD_TYPES_MAX=2 From 30cf511b862ecdd80f8fc93655f86342411a6472 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:11 +0300 Subject: [PATCH 1562/2141] Revert "[nrf fromtree] include: sys_clock: Fix compilation when SYS_CLOCK_EXISTS is disabled" This reverts commit 364eba60a02157520c5a2c1155ecc221528a6fcf. Signed-off-by: Jukka Rissanen --- include/zephyr/sys_clock.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/include/zephyr/sys_clock.h b/include/zephyr/sys_clock.h index 5f31d585ff13..6c3589a51028 100644 --- a/include/zephyr/sys_clock.h +++ b/include/zephyr/sys_clock.h @@ -162,11 +162,10 @@ typedef struct { /** @endcond */ #ifndef CONFIG_TIMER_READS_ITS_FREQUENCY_AT_RUNTIME -#if defined(CONFIG_SYS_CLOCK_EXISTS) -#if CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC == 0 +#if defined(CONFIG_SYS_CLOCK_EXISTS) && \ + (CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC == 0) #error "SYS_CLOCK_HW_CYCLES_PER_SEC must be non-zero!" -#endif /* CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC == 0 */ -#endif /* CONFIG_SYS_CLOCK_EXISTS */ +#endif #endif /* CONFIG_TIMER_READS_ITS_FREQUENCY_AT_RUNTIME */ /* kernel clocks */ From 8e33252f21f9e632de30e81cf7c8de841be2e77a Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:11 +0300 Subject: [PATCH 1563/2141] Revert "[nrf fromtree] drivers: spi_nrfx_spim: Fix SPIM_REQUESTS_CLOCK() and calls to it" This reverts commit 11286f42e1bf5693860408640524645675027666. Signed-off-by: Jukka Rissanen --- drivers/spi/spi_nrfx_spim.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/spi/spi_nrfx_spim.c b/drivers/spi/spi_nrfx_spim.c index dcfee1c5ede2..21a454c5ff8f 100644 --- a/drivers/spi/spi_nrfx_spim.c +++ b/drivers/spi/spi_nrfx_spim.c @@ -45,7 +45,7 @@ LOG_MODULE_REGISTER(spi_nrfx_spim, CONFIG_SPI_LOG_LEVEL); #if defined(CONFIG_CLOCK_CONTROL_NRF2_GLOBAL_HSFLL) #define SPIM_REQUESTS_CLOCK(node) \ - DT_NODE_HAS_COMPAT(DT_CLOCKS_CTLR(node), nordic_nrf_hsfll_global) + DT_NODE_HAS_COMPAT(DT_NODELABEL(DT_CLOCKS_CTLR(node)), nordic_nrf_hsfll_global) #define SPIM_REQUESTS_CLOCK_OR(node) SPIM_REQUESTS_CLOCK(node) || #if (DT_FOREACH_STATUS_OKAY(nordic_nrf_spim, SPIM_REQUESTS_CLOCK_OR) 0) #define USE_CLOCK_REQUESTS 1 @@ -56,7 +56,7 @@ LOG_MODULE_REGISTER(spi_nrfx_spim, CONFIG_SPI_LOG_LEVEL); BUILD_ASSERT(!IS_ENABLED(CONFIG_PM_DEVICE_SYSTEM_MANAGED)); #endif #else -#define SPIM_REQUESTS_CLOCK(node) 0 +#define SPIM_REQUESTS_CLOCK(idx) 0 #endif struct spi_nrfx_data { @@ -799,7 +799,7 @@ static int spi_nrfx_init(const struct device *dev) #if defined(CONFIG_CLOCK_CONTROL_NRF2_GLOBAL_HSFLL_INIT_PRIORITY) && \ CONFIG_SPI_INIT_PRIORITY < CONFIG_CLOCK_CONTROL_NRF2_GLOBAL_HSFLL_INIT_PRIORITY #define SPIM_INIT_PRIORITY(idx) \ - COND_CODE_1(SPIM_REQUESTS_CLOCK(SPIM(idx)), \ + COND_CODE_1(SPIM_REQUESTS_CLOCK(idx), \ (UTIL_INC(CONFIG_CLOCK_CONTROL_NRF2_GLOBAL_HSFLL_INIT_PRIORITY)), \ (CONFIG_SPI_INIT_PRIORITY)) #else @@ -858,8 +858,8 @@ static int spi_nrfx_init(const struct device *dev) .wake_gpiote = WAKE_GPIOTE_INSTANCE(SPIM(idx)), \ IF_ENABLED(CONFIG_DCACHE, \ (.mem_attr = SPIM_GET_MEM_ATTR(idx),)) \ - IF_ENABLED(USE_CLOCK_REQUESTS, \ - (.clk_dev = SPIM_REQUESTS_CLOCK(SPIM(idx)) \ + IF_ENABLED(USE_CLOCK_REQUESTS, \ + (.clk_dev = SPIM_REQUESTS_CLOCK(idx) \ ? DEVICE_DT_GET(DT_CLOCKS_CTLR(SPIM(idx))) \ : NULL, \ .clk_spec = { \ From 0465dc9a9eec14977b3b8c0b12312f044fb389d3 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:11 +0300 Subject: [PATCH 1564/2141] Revert "[nrf fromlist] drivers: Extend analog pins mapping for nRF54L." This reverts commit ecabf6ad9cc204ae103798776d8e49f0f25dea72. Signed-off-by: Jukka Rissanen --- drivers/adc/adc_nrfx_saadc.c | 17 +++-------------- drivers/comparator/comparator_nrf_common.h | 11 +---------- 2 files changed, 4 insertions(+), 24 deletions(-) diff --git a/drivers/adc/adc_nrfx_saadc.c b/drivers/adc/adc_nrfx_saadc.c index a9cc1c4f36b9..8072e0c7eafd 100644 --- a/drivers/adc/adc_nrfx_saadc.c +++ b/drivers/adc/adc_nrfx_saadc.c @@ -54,7 +54,7 @@ static const uint32_t saadc_psels[NRF_SAADC_DVDD + 1] = { [NRF_SAADC_AVDD] = NRF_SAADC_INPUT_AVDD, [NRF_SAADC_DVDD] = NRF_SAADC_INPUT_DVDD, }; -#elif defined(NRF54LM20A_ENGA_XXAA) +#elif defined(CONFIG_SOC_COMPATIBLE_NRF54LX) static const uint32_t saadc_psels[NRF_SAADC_DVDD + 1] = { [NRF_SAADC_AIN0] = NRF_PIN_PORT_TO_PIN_NUMBER(0U, 1), [NRF_SAADC_AIN1] = NRF_PIN_PORT_TO_PIN_NUMBER(31U, 1), @@ -65,20 +65,9 @@ static const uint32_t saadc_psels[NRF_SAADC_DVDD + 1] = { [NRF_SAADC_AIN6] = NRF_PIN_PORT_TO_PIN_NUMBER(4U, 1), [NRF_SAADC_AIN7] = NRF_PIN_PORT_TO_PIN_NUMBER(3U, 1), [NRF_SAADC_VDD] = NRF_SAADC_INPUT_VDD, +#if defined(NRF_SAADC_INPUT_AVDD) [NRF_SAADC_AVDD] = NRF_SAADC_INPUT_AVDD, - [NRF_SAADC_DVDD] = NRF_SAADC_INPUT_DVDD, -}; -#elif defined(NRF54LV10A_ENGA_XXAA) -static const uint32_t saadc_psels[NRF_SAADC_DVDD + 1] = { - [NRF_SAADC_AIN0] = NRF_PIN_PORT_TO_PIN_NUMBER(0U, 1), - [NRF_SAADC_AIN1] = NRF_PIN_PORT_TO_PIN_NUMBER(1U, 1), - [NRF_SAADC_AIN2] = NRF_PIN_PORT_TO_PIN_NUMBER(2U, 1), - [NRF_SAADC_AIN3] = NRF_PIN_PORT_TO_PIN_NUMBER(3U, 1), - [NRF_SAADC_AIN4] = NRF_PIN_PORT_TO_PIN_NUMBER(7U, 1), - [NRF_SAADC_AIN5] = NRF_PIN_PORT_TO_PIN_NUMBER(10U, 1), - [NRF_SAADC_AIN6] = NRF_PIN_PORT_TO_PIN_NUMBER(11U, 1), - [NRF_SAADC_AIN7] = NRF_PIN_PORT_TO_PIN_NUMBER(12U, 1), - [NRF_SAADC_VDD] = NRF_SAADC_INPUT_VDD, +#endif [NRF_SAADC_DVDD] = NRF_SAADC_INPUT_DVDD, }; #endif diff --git a/drivers/comparator/comparator_nrf_common.h b/drivers/comparator/comparator_nrf_common.h index e86fc9f63692..c45e6676e2d8 100644 --- a/drivers/comparator/comparator_nrf_common.h +++ b/drivers/comparator/comparator_nrf_common.h @@ -28,7 +28,7 @@ static const uint32_t shim_nrf_comp_ain_map[] = { NRF_PIN_PORT_TO_PIN_NUMBER(12U, 1), NRF_PIN_PORT_TO_PIN_NUMBER(13U, 1), NRF_PIN_PORT_TO_PIN_NUMBER(14U, 1), -#elif defined(NRF54LM20A_ENGA_XXAA) +#elif defined(CONFIG_SOC_COMPATIBLE_NRF54LX) NRF_PIN_PORT_TO_PIN_NUMBER(0U, 1), NRF_PIN_PORT_TO_PIN_NUMBER(31U, 1), NRF_PIN_PORT_TO_PIN_NUMBER(30U, 1), @@ -37,15 +37,6 @@ static const uint32_t shim_nrf_comp_ain_map[] = { NRF_PIN_PORT_TO_PIN_NUMBER(5U, 1), NRF_PIN_PORT_TO_PIN_NUMBER(4U, 1), NRF_PIN_PORT_TO_PIN_NUMBER(3U, 1), -#elif defined(NRF54LV10A_ENGA_XXAA) - NRF_PIN_PORT_TO_PIN_NUMBER(0U, 1), - NRF_PIN_PORT_TO_PIN_NUMBER(1U, 1), - NRF_PIN_PORT_TO_PIN_NUMBER(2U, 1), - NRF_PIN_PORT_TO_PIN_NUMBER(3U, 1), - NRF_PIN_PORT_TO_PIN_NUMBER(7U, 1), - NRF_PIN_PORT_TO_PIN_NUMBER(10U, 1), - NRF_PIN_PORT_TO_PIN_NUMBER(11U, 1), - NRF_PIN_PORT_TO_PIN_NUMBER(12U, 1), #endif }; #endif From 4dda1851482a6baf18a54935e9c819fdea3a9c24 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:11 +0300 Subject: [PATCH 1565/2141] Revert "[nrf fromlist] modules: hal_nordic: nrf_802154: set clock startup latency" This reverts commit f75eb49bc4b2c7af71e81af488dcc3e268f36d79. Signed-off-by: Jukka Rissanen --- .../sl_opensource/platform/nrf_802154_clock_zephyr.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/modules/hal_nordic/nrf_802154/sl_opensource/platform/nrf_802154_clock_zephyr.c b/modules/hal_nordic/nrf_802154/sl_opensource/platform/nrf_802154_clock_zephyr.c index 1ade977118e1..87aa85261e98 100644 --- a/modules/hal_nordic/nrf_802154/sl_opensource/platform/nrf_802154_clock_zephyr.c +++ b/modules/hal_nordic/nrf_802154/sl_opensource/platform/nrf_802154_clock_zephyr.c @@ -18,11 +18,7 @@ static bool hfclk_is_running; void nrf_802154_clock_init(void) { -#ifdef NRF54L_SERIES - uint32_t clock_latency_us = z_nrf_clock_bt_ctlr_hf_get_startup_time_us(); - - nrf_802154_clock_hfclk_latency_set(clock_latency_us); -#endif + /* Intentionally empty. */ } void nrf_802154_clock_deinit(void) From 9fcd1fa0ee1e3312f5d44f25aeb79269efc91d7a Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:11 +0300 Subject: [PATCH 1566/2141] Revert "[nrf fromlist] boards: nordic: nRF54L15DK: set HFXO clock latency to 854" This reverts commit 4d99f0a7a308498ddd97c4828f5ed2bcf21191dc. Signed-off-by: Jukka Rissanen --- boards/nordic/nrf54l15dk/nrf54l15dk_common.dtsi | 4 ---- 1 file changed, 4 deletions(-) diff --git a/boards/nordic/nrf54l15dk/nrf54l15dk_common.dtsi b/boards/nordic/nrf54l15dk/nrf54l15dk_common.dtsi index 6740544b524a..c030c2c55189 100644 --- a/boards/nordic/nrf54l15dk/nrf54l15dk_common.dtsi +++ b/boards/nordic/nrf54l15dk/nrf54l15dk_common.dtsi @@ -108,9 +108,5 @@ pinctrl-names = "default", "sleep"; }; -&hfxo { - startup-time-us = <854>; -}; - /* Get a node label for wi-fi spi to use in shield files */ wifi_spi: &spi22 {}; From 4d56689993f25a100c2ef52b29cd5d414b66c6f5 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:12 +0300 Subject: [PATCH 1567/2141] Revert "[nrf fromtree] tests: kernel: timer: cycle64: Add support for GRTC" This reverts commit 0ef6cddb84188c85bdd22d50f18fe75cfbf65872. Signed-off-by: Jukka Rissanen --- tests/kernel/timer/cycle64/testcase.yaml | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/tests/kernel/timer/cycle64/testcase.yaml b/tests/kernel/timer/cycle64/testcase.yaml index 1598c07337be..f1a65dbb00a0 100644 --- a/tests/kernel/timer/cycle64/testcase.yaml +++ b/tests/kernel/timer/cycle64/testcase.yaml @@ -14,7 +14,7 @@ tests: tags: - kernel - timer - filter: CONFIG_TIMER_HAS_64BIT_CYCLE_COUNTER and not CONFIG_NRF_GRTC_TIMER + filter: CONFIG_TIMER_HAS_64BIT_CYCLE_COUNTER arch_exclude: posix timeout: 140 slow: true @@ -22,13 +22,5 @@ tests: tags: - kernel - timer - filter: CONFIG_TIMER_HAS_64BIT_CYCLE_COUNTER and not CONFIG_NRF_GRTC_TIMER + filter: CONFIG_TIMER_HAS_64BIT_CYCLE_COUNTER arch_allow: posix - kernel.timer.cycle64.grtc: - tags: - - kernel - - timer - filter: CONFIG_TIMER_HAS_64BIT_CYCLE_COUNTER and CONFIG_NRF_GRTC_TIMER - arch_exclude: posix - timeout: 8600 - slow: true From 88cf2110940884a81ddd6cb78362a2a99bb31894 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:12 +0300 Subject: [PATCH 1568/2141] Revert "[nrf fromtree] tests: boards: nrf: i2c_slave: allow more instances" This reverts commit 9d98e46b5b4c49c9f86f2b2db4dc01bacdf571f7. Signed-off-by: Jukka Rissanen --- tests/boards/nrf/i2c/i2c_slave/src/main.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tests/boards/nrf/i2c/i2c_slave/src/main.c b/tests/boards/nrf/i2c/i2c_slave/src/main.c index 403c85682908..1de4b16bc2c6 100644 --- a/tests/boards/nrf/i2c/i2c_slave/src/main.c +++ b/tests/boards/nrf/i2c/i2c_slave/src/main.c @@ -21,14 +21,8 @@ #define I2C_S_INSTANCE 1 #elif CONFIG_NRFX_TWIS2 #define I2C_S_INSTANCE 2 -#elif CONFIG_NRFX_TWIS20 -#define I2C_S_INSTANCE 20 -#elif CONFIG_NRFX_TWIS21 -#define I2C_S_INSTANCE 21 #elif CONFIG_NRFX_TWIS22 #define I2C_S_INSTANCE 22 -#elif CONFIG_NRFX_TWIS30 -#define I2C_S_INSTANCE 30 #elif CONFIG_NRFX_TWIS131 #define I2C_S_INSTANCE 131 #else From 0080c6775a453278ab910c250abd67fef2462008 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:12 +0300 Subject: [PATCH 1569/2141] Revert "[nrf fromtree] sysbuild: Allow to use file suffix DTS overlays" This reverts commit d324d762445ac06a7d59fbec0407685419ed5ab3. Signed-off-by: Jukka Rissanen --- .../cmake/modules/sysbuild_extensions.cmake | 27 ++++++------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/share/sysbuild/cmake/modules/sysbuild_extensions.cmake b/share/sysbuild/cmake/modules/sysbuild_extensions.cmake index 75778f655a86..db6e60f9ab7c 100644 --- a/share/sysbuild/cmake/modules/sysbuild_extensions.cmake +++ b/share/sysbuild/cmake/modules/sysbuild_extensions.cmake @@ -261,7 +261,7 @@ function(ExternalZephyrProject_Add) set(sysbuild_image_conf_dir ${APP_DIR}/sysbuild) set(sysbuild_image_name_conf_dir ${APP_DIR}/sysbuild/${ZBUILD_APPLICATION}) # User defined `-D_CONF_FILE=` takes precedence over anything else. - if(NOT ${ZBUILD_APPLICATION}_CONF_FILE) + if (NOT ${ZBUILD_APPLICATION}_CONF_FILE) if(EXISTS ${sysbuild_image_name_conf_dir}) set(${ZBUILD_APPLICATION}_APPLICATION_CONFIG_DIR ${sysbuild_image_name_conf_dir} CACHE INTERNAL "Application configuration dir controlled by sysbuild" @@ -275,7 +275,7 @@ function(ExternalZephyrProject_Add) NAMES ${ZBUILD_APPLICATION}.conf SUFFIX ${FILE_SUFFIX} ) - if(NOT (${ZBUILD_APPLICATION}_OVERLAY_CONFIG OR ${ZBUILD_APPLICATION}_EXTRA_CONF_FILE) + if (NOT (${ZBUILD_APPLICATION}_OVERLAY_CONFIG OR ${ZBUILD_APPLICATION}_EXTRA_CONF_FILE) AND EXISTS ${sysbuild_image_conf_fragment} ) set(${ZBUILD_APPLICATION}_EXTRA_CONF_FILE ${sysbuild_image_conf_fragment} @@ -283,23 +283,12 @@ function(ExternalZephyrProject_Add) ) endif() - if(NOT ${ZBUILD_APPLICATION}_DTC_OVERLAY_FILE) - # Check for overlay named .overlay. - set(sysbuild_image_dts_overlay_files ${sysbuild_image_conf_dir}/${ZBUILD_APPLICATION}.overlay) - - # Check for overlay named _.overlay. - if(FILE_SUFFIX) - list(PREPEND sysbuild_image_dts_overlay_files ${sysbuild_image_conf_dir}/${ZBUILD_APPLICATION}_${FILE_SUFFIX}.overlay) - endif() - - foreach(overlay_file ${sysbuild_image_dts_overlay_files}) - if(EXISTS ${overlay_file}) - set(${ZBUILD_APPLICATION}_DTC_OVERLAY_FILE ${overlay_file} - CACHE INTERNAL "devicetree overlay file defined by main application" - ) - break() - endif() - endforeach() + # Check for overlay named .overlay. + set(sysbuild_image_dts_overlay ${sysbuild_image_conf_dir}/${ZBUILD_APPLICATION}.overlay) + if (NOT ${ZBUILD_APPLICATION}_DTC_OVERLAY_FILE AND EXISTS ${sysbuild_image_dts_overlay}) + set(${ZBUILD_APPLICATION}_DTC_OVERLAY_FILE ${sysbuild_image_dts_overlay} + CACHE INTERNAL "devicetree overlay file defined by main application" + ) endif() endif() From 246ec2d92117eb0618b832e08d462c339726e2d8 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:12 +0300 Subject: [PATCH 1570/2141] Revert "[nrf fromtree] manifest: update hal_nordic revision to integrate nrfx 3.12.1" This reverts commit 29c0626e5120f3795f31ee7cae3f57f1dba47d9b. Signed-off-by: Jukka Rissanen --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 53b29c849ca5..b8b35cb5ef8b 100644 --- a/west.yml +++ b/west.yml @@ -200,7 +200,7 @@ manifest: groups: - hal - name: hal_nordic - revision: 6e39d4f2b078afaebdb84875089486152fcacb9c + revision: 1f169d927e367eb1e161972e9504da5aa1f10c42 path: modules/hal/nordic groups: - hal From e99c1204ec7555548e32beb9195f45c3aa75eecc Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:12 +0300 Subject: [PATCH 1571/2141] Revert "[nrf fromtree] drivers: adc: nrf: align to non-gain configuration" This reverts commit e6cec3ed74f1e5c9f5ced466d3a97a6aeefb671e. Signed-off-by: Jukka Rissanen --- drivers/adc/adc_nrfx_saadc.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/adc/adc_nrfx_saadc.c b/drivers/adc/adc_nrfx_saadc.c index 8072e0c7eafd..d627dd250e35 100644 --- a/drivers/adc/adc_nrfx_saadc.c +++ b/drivers/adc/adc_nrfx_saadc.c @@ -65,9 +65,7 @@ static const uint32_t saadc_psels[NRF_SAADC_DVDD + 1] = { [NRF_SAADC_AIN6] = NRF_PIN_PORT_TO_PIN_NUMBER(4U, 1), [NRF_SAADC_AIN7] = NRF_PIN_PORT_TO_PIN_NUMBER(3U, 1), [NRF_SAADC_VDD] = NRF_SAADC_INPUT_VDD, -#if defined(NRF_SAADC_INPUT_AVDD) [NRF_SAADC_AVDD] = NRF_SAADC_INPUT_AVDD, -#endif [NRF_SAADC_DVDD] = NRF_SAADC_INPUT_DVDD, }; #endif @@ -233,7 +231,6 @@ static int adc_nrfx_channel_setup(const struct device *dev, return -EINVAL; } -#if NRF_SAADC_HAS_CH_GAIN switch (channel_cfg->gain) { #if defined(SAADC_CH_CONFIG_GAIN_Gain1_6) case ADC_GAIN_1_6: @@ -287,9 +284,6 @@ static int adc_nrfx_channel_setup(const struct device *dev, break; #endif default: -#else - if (channel_cfg->gain != ADC_GAIN_1) { -#endif /* defined(NRF_SAADC_HAS_CH_GAIN) */ LOG_ERR("Selected ADC gain is not valid"); return -EINVAL; } From ff67db6a82c8892e94508c7c03d45bcdec336e20 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:12 +0300 Subject: [PATCH 1572/2141] Revert "[nrf fromtree] drivers: adc: nrf: align to channel-wide burst configuration" This reverts commit 27c091a6ab28bf77e5a3e2e1ac5c7e1d1c044256. Signed-off-by: Jukka Rissanen --- drivers/adc/adc_nrfx_saadc.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/drivers/adc/adc_nrfx_saadc.c b/drivers/adc/adc_nrfx_saadc.c index d627dd250e35..8d8c6a01ad30 100644 --- a/drivers/adc/adc_nrfx_saadc.c +++ b/drivers/adc/adc_nrfx_saadc.c @@ -220,9 +220,7 @@ static int adc_nrfx_channel_setup(const struct device *dev, .resistor_p = NRF_SAADC_RESISTOR_DISABLED, .resistor_n = NRF_SAADC_RESISTOR_DISABLED, #endif -#if NRF_SAADC_HAS_CH_BURST .burst = NRF_SAADC_BURST_DISABLED, -#endif }; uint8_t channel_id = channel_cfg->channel_id; uint32_t input_negative = channel_cfg->input_negative; @@ -532,7 +530,6 @@ static int start_read(const struct device *dev, uint8_t resolution = sequence->resolution; uint8_t active_channels; uint8_t channel_id; - nrf_saadc_burst_t burst; /* Signal an error if channel selection is invalid (no channels or * a non-existing one is selected). @@ -584,13 +581,10 @@ static int start_read(const struct device *dev, * is not used (hence, the multiple channel sampling is * possible), the burst mode have to be deactivated. */ - burst = (sequence->oversampling != 0U ? - NRF_SAADC_BURST_ENABLED : NRF_SAADC_BURST_DISABLED); -#if NRF_SAADC_HAS_CH_BURST - nrf_saadc_channel_burst_set(NRF_SAADC, channel_id, burst); -#else - nrf_saadc_burst_set(NRF_SAADC, burst); -#endif + nrf_saadc_burst_set(NRF_SAADC, channel_id, + (sequence->oversampling != 0U ? + NRF_SAADC_BURST_ENABLED : + NRF_SAADC_BURST_DISABLED)); nrf_saadc_channel_pos_input_set( NRF_SAADC, channel_id, @@ -602,12 +596,10 @@ static int start_read(const struct device *dev, ); ++active_channels; } else { - burst = NRF_SAADC_BURST_DISABLED; -#if NRF_SAADC_HAS_CH_BURST - nrf_saadc_channel_burst_set(NRF_SAADC, channel_id, burst); -#else - nrf_saadc_burst_set(NRF_SAADC, burst); -#endif + nrf_saadc_burst_set( + NRF_SAADC, + channel_id, + NRF_SAADC_BURST_DISABLED); nrf_saadc_channel_pos_input_set( NRF_SAADC, channel_id, From 9937139393ac1d88b8f61a59f4101c520c4c86aa Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:12 +0300 Subject: [PATCH 1573/2141] Revert "[nrf fromtree] manifest: update hal_nordic revision to integrate nrfx 3.12.0" This reverts commit 6648c9d3821ea9f7b8e1e5cad31e83d129daef7b. Signed-off-by: Jukka Rissanen --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index b8b35cb5ef8b..72255ca8b119 100644 --- a/west.yml +++ b/west.yml @@ -200,7 +200,7 @@ manifest: groups: - hal - name: hal_nordic - revision: 1f169d927e367eb1e161972e9504da5aa1f10c42 + revision: 4eafaa44a55a557595e529f8cbdfc8dc1248da36 path: modules/hal/nordic groups: - hal From 0dd90d6f974e043a76fa18a0a5930f2f12f2d17c Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:12 +0300 Subject: [PATCH 1574/2141] Revert "[nrf fromtree] test: drivers: clock_control_api: Fix conf file application" This reverts commit fced75e9087afccf7964ff8fe4bc2c9000aab2d2. Signed-off-by: Jukka Rissanen --- tests/drivers/clock_control/clock_control_api/testcase.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/drivers/clock_control/clock_control_api/testcase.yaml b/tests/drivers/clock_control/clock_control_api/testcase.yaml index d624b61fe7c3..847e4d41ddf7 100644 --- a/tests/drivers/clock_control/clock_control_api/testcase.yaml +++ b/tests/drivers/clock_control/clock_control_api/testcase.yaml @@ -38,4 +38,4 @@ tests: - ophelia4ev/nrf54l15/cpuapp integration_platforms: - nrf51dk/nrf51822 - extra_args: EXTRA_CONF_FILE="nrf_lfclk_rc.conf" + extra_args: CONF_FILE="nrf_lfclk_rc.conf" From ad5b1ba9508333dc7caee2dfa481290ba8fe3d7f Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:12 +0300 Subject: [PATCH 1575/2141] Revert "[nrf fromlist] modules: hal_nordic: nrf_802154: CCA threshold config in dBm" This reverts commit 8d09c7c8284bba85a80683baac288357a7c36f9d. Signed-off-by: Jukka Rissanen --- modules/hal_nordic/Kconfig | 8 ++++---- modules/hal_nordic/nrf_802154/CMakeLists.txt | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/hal_nordic/Kconfig b/modules/hal_nordic/Kconfig index 665fe2cc95b0..8053017170e6 100644 --- a/modules/hal_nordic/Kconfig +++ b/modules/hal_nordic/Kconfig @@ -163,12 +163,12 @@ config NRF_802154_CCA_MODE_CARRIER_OR_ED endchoice -config NRF_802154_CCA_ED_THRESHOLD_DBM - int "nRF IEEE 802.15.4 CCA Energy Detection threshold in dBm" - default -75 +config NRF_802154_CCA_ED_THRESHOLD + int "nRF IEEE 802.15.4 CCA Energy Detection threshold" + default 45 help If energy detected in a given channel is above the value then the - channel is deemed busy. The unit is dBm. + channel is deemed busy. The unit is defined as per 802.15.4-2006 spec. config NRF_802154_CCA_CORR_THRESHOLD int "nRF IEEE 802.15.4 CCA Correlator threshold" diff --git a/modules/hal_nordic/nrf_802154/CMakeLists.txt b/modules/hal_nordic/nrf_802154/CMakeLists.txt index 957019ff1e67..1fc5c85ec0b1 100644 --- a/modules/hal_nordic/nrf_802154/CMakeLists.txt +++ b/modules/hal_nordic/nrf_802154/CMakeLists.txt @@ -52,7 +52,7 @@ target_compile_definitions(zephyr-802154-interface # CCA mode options NRF_802154_CCA_CORR_LIMIT_DEFAULT=${CONFIG_NRF_802154_CCA_CORR_LIMIT} NRF_802154_CCA_CORR_THRESHOLD_DEFAULT=${CONFIG_NRF_802154_CCA_CORR_THRESHOLD} - NRF_802154_CCA_ED_THRESHOLD_DBM_DEFAULT=${CONFIG_NRF_802154_CCA_ED_THRESHOLD_DBM} + NRF_802154_CCA_ED_THRESHOLD_DEFAULT=${CONFIG_NRF_802154_CCA_ED_THRESHOLD} # Key storage size NRF_802154_SECURITY_KEY_STORAGE_SIZE=${CONFIG_NRF_802154_SECURITY_KEY_STORAGE_SIZE} From 4b22bb557d2ac3851f692eef68f620d199441478 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:12 +0300 Subject: [PATCH 1576/2141] Revert "[nrf fromtree] samples: boards: nordic: system_off fixes" This reverts commit 737ba8dd6f199a785641c3c19b5244b922c615c7. Signed-off-by: Jukka Rissanen --- samples/boards/nordic/system_off/sample.yaml | 6 +++--- samples/boards/nordic/system_off/src/main.c | 20 +++++--------------- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/samples/boards/nordic/system_off/sample.yaml b/samples/boards/nordic/system_off/sample.yaml index 6e17223e12b4..81c2f0f262b6 100644 --- a/samples/boards/nordic/system_off/sample.yaml +++ b/samples/boards/nordic/system_off/sample.yaml @@ -42,7 +42,7 @@ tests: ordered: true regex: - "system off demo" - - "Retained data: valid" + - "Retained data: INVALID" - "Boot count: 1" - "Off count: 0" - "Active Ticks:" @@ -87,7 +87,7 @@ tests: ordered: true regex: - "system off demo" - - "Retained data: valid" + - "Retained data: INVALID" - "Boot count: 1" - "Off count: 0" - "Active Ticks:" @@ -134,7 +134,7 @@ tests: ordered: true regex: - "system off demo" - - "Retained data: valid" + - "Retained data: INVALID" - "Boot count: 1" - "Off count: 0" - "Active Ticks:" diff --git a/samples/boards/nordic/system_off/src/main.c b/samples/boards/nordic/system_off/src/main.c index d119eff87dac..0b0cbf3cb0bb 100644 --- a/samples/boards/nordic/system_off/src/main.c +++ b/samples/boards/nordic/system_off/src/main.c @@ -18,8 +18,6 @@ #include #include -#define NON_WAKEUP_RESET_REASON (RESET_PIN | RESET_SOFTWARE | RESET_POR | RESET_DEBUG) - #if defined(CONFIG_GRTC_WAKEUP_ENABLE) #include #define DEEP_SLEEP_TIME_S 2 @@ -31,14 +29,15 @@ static const struct gpio_dt_spec sw0 = GPIO_DT_SPEC_GET(DT_ALIAS(sw0), gpios); static const struct device *comp_dev = DEVICE_DT_GET(DT_NODELABEL(comp)); #endif -void print_reset_cause(uint32_t reset_cause) +void print_reset_cause(void) { + uint32_t reset_cause; + + hwinfo_get_reset_cause(&reset_cause); if (reset_cause & RESET_DEBUG) { printf("Reset by debugger.\n"); } else if (reset_cause & RESET_CLOCK) { printf("Wakeup from System OFF by GRTC.\n"); - } else if (reset_cause & RESET_LOW_POWER_WAKE) { - printf("Wakeup from System OFF by GPIO.\n"); } else { printf("Other wake up cause 0x%08X.\n", reset_cause); } @@ -47,7 +46,6 @@ void print_reset_cause(uint32_t reset_cause) int main(void) { int rc; - uint32_t reset_cause; const struct device *const cons = DEVICE_DT_GET(DT_CHOSEN(zephyr_console)); if (!device_is_ready(cons)) { @@ -56,19 +54,11 @@ int main(void) } printf("\n%s system off demo\n", CONFIG_BOARD); - hwinfo_get_reset_cause(&reset_cause); - print_reset_cause(reset_cause); + print_reset_cause(); if (IS_ENABLED(CONFIG_APP_USE_RETAINED_MEM)) { bool retained_ok = retained_validate(); - if (reset_cause & NON_WAKEUP_RESET_REASON) { - retained.boots = 0; - retained.off_count = 0; - retained.uptime_sum = 0; - retained.uptime_latest = 0; - retained_ok = true; - } /* Increment for this boot attempt and update. */ retained.boots += 1; retained_update(); From 7e3ff6bf8d3ac4732c1db0d902fd7d3207e06019 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:12 +0300 Subject: [PATCH 1577/2141] Revert "[nrf fromlist] net: lib: wifi_credentials: Add support for Enterprise security" This reverts commit 7cad1bb6b8455a7fde871e1302b4ffe03a868d27. Signed-off-by: Jukka Rissanen --- subsys/net/lib/wifi_credentials/Kconfig | 26 -- .../wifi_credentials/wifi_credentials_shell.c | 224 ++---------------- 2 files changed, 16 insertions(+), 234 deletions(-) diff --git a/subsys/net/lib/wifi_credentials/Kconfig b/subsys/net/lib/wifi_credentials/Kconfig index d0843d689a28..f50e210b080a 100644 --- a/subsys/net/lib/wifi_credentials/Kconfig +++ b/subsys/net/lib/wifi_credentials/Kconfig @@ -73,32 +73,6 @@ config WIFI_CREDENTIALS_CONNECT_STORED_CONNECTION_TIMEOUT help Wait period before falling back to the next entry in the list of stored SSIDs. - -if WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE - -config WIFI_CREDENTIALS_RUNTIME_CERTIFICATES - bool "Provide Wi-Fi enterprise security certificates at run-time" - select TLS_CREDENTIALS - select TLS_CREDENTIALS_SHELL - select BASE64 - default y if WIFI_SHELL_RUNTIME_CERTIFICATES - help - This option enables providing Wi-Fi enterprise security certificates at run-time. - Uses the TLS credentials subsystem to store and manage the certificates. - -if WIFI_CREDENTIALS_RUNTIME_CERTIFICATES - -config HEAP_MEM_POOL_ADD_SIZE_WIFI_CERT - int "Wi-Fi enterprise security certificates memory pool size" - # STA - 6 certs and each assume 1500 bytes - default 12000 - help - The size of the memory pool used by the Wi-Fi enterprise security certificates. - -endif # WIFI_CREDENTIALS_RUNTIME_CERTIFICATES - -endif # WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE - endif # WIFI_CREDENTIALS_CONNECT_STORED endif # WIFI_CREDENTIALS diff --git a/subsys/net/lib/wifi_credentials/wifi_credentials_shell.c b/subsys/net/lib/wifi_credentials/wifi_credentials_shell.c index c5b8c2a88a39..4a51de48e121 100644 --- a/subsys/net/lib/wifi_credentials/wifi_credentials_shell.c +++ b/subsys/net/lib/wifi_credentials/wifi_credentials_shell.c @@ -22,33 +22,10 @@ #include -LOG_MODULE_REGISTER(wifi_credentials_shell, CONFIG_WIFI_CREDENTIALS_LOG_LEVEL); - #define MAX_BANDS_STR_LEN 64 #define MACSTR "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx" #ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE -#ifdef CONFIG_WIFI_CREDENTIALS_RUNTIME_CERTIFICATES -#include -enum wifi_enterprise_cert_sec_tags { - WIFI_CERT_CA_SEC_TAG = 0x1020001, - WIFI_CERT_CLIENT_KEY_SEC_TAG, - WIFI_CERT_SERVER_KEY_SEC_TAG, - WIFI_CERT_CLIENT_SEC_TAG, - WIFI_CERT_SERVER_SEC_TAG, - /* Phase 2 */ - WIFI_CERT_CA_P2_SEC_TAG, - WIFI_CERT_CLIENT_KEY_P2_SEC_TAG, - WIFI_CERT_CLIENT_P2_SEC_TAG, -}; - -struct wifi_cert_data { - enum tls_credential_type type; - uint32_t sec_tag; - uint8_t **data; - size_t *len; -}; -#else static const char ca_cert_test[] = { #include '\0' @@ -75,184 +52,25 @@ static const char client_cert2_test[] = { static const char client_key2_test[] = { #include '\0'}; -#endif /* CONFIG_WIFI_CREDENTIALS_RUNTIME_CERTIFICATES */ #endif /* CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE */ #if defined CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE -#ifdef CONFIG_WIFI_CREDENTIALS_RUNTIME_CERTIFICATES - -struct wifi_enterprise_creds_params enterprise_creds_params; - -static int process_certificates(struct wifi_cert_data *certs, size_t cert_count) -{ - for (size_t i = 0; i < cert_count; i++) { - int err; - size_t len = 0; - uint8_t *cert_tmp; - - err = tls_credential_get(certs[i].sec_tag, certs[i].type, NULL, &len); - if (err != -EFBIG) { - LOG_ERR("Failed to get credential tag: %d length, err: %d", - certs[i].sec_tag, err); - return err; - } - - cert_tmp = k_malloc(len); - if (!cert_tmp) { - LOG_ERR("Failed to allocate memory for credential tag: %d", - certs[i].sec_tag); - return -ENOMEM; - } - - err = tls_credential_get(certs[i].sec_tag, certs[i].type, cert_tmp, &len); - if (err) { - LOG_ERR("Failed to get credential tag: %d", certs[i].sec_tag); - k_free(cert_tmp); - return err; - } - - *certs[i].data = cert_tmp; - *certs[i].len = len; - } - - return 0; -} - -static void set_enterprise_creds_params(struct wifi_enterprise_creds_params *params, - bool is_ap) -{ - struct wifi_cert_data certs_common[] = { - { - .type = TLS_CREDENTIAL_CA_CERTIFICATE, - .sec_tag = WIFI_CERT_CA_SEC_TAG, - .data = ¶ms->ca_cert, - .len = ¶ms->ca_cert_len, - }, - }; - - struct wifi_cert_data certs_sta[] = { - { - .type = TLS_CREDENTIAL_PRIVATE_KEY, - .sec_tag = WIFI_CERT_CLIENT_KEY_SEC_TAG, - .data = ¶ms->client_key, - .len = ¶ms->client_key_len, - }, - { - .type = TLS_CREDENTIAL_PUBLIC_CERTIFICATE, - .sec_tag = WIFI_CERT_CLIENT_SEC_TAG, - .data = ¶ms->client_cert, - .len = ¶ms->client_cert_len, - }, - { - .type = TLS_CREDENTIAL_CA_CERTIFICATE, - .sec_tag = WIFI_CERT_CA_P2_SEC_TAG, - .data = ¶ms->ca_cert2, - .len = ¶ms->ca_cert2_len, - }, - { - .type = TLS_CREDENTIAL_PRIVATE_KEY, - .sec_tag = WIFI_CERT_CLIENT_KEY_P2_SEC_TAG, - .data = ¶ms->client_key2, - .len = ¶ms->client_key2_len, - }, - { - .type = TLS_CREDENTIAL_PUBLIC_CERTIFICATE, - .sec_tag = WIFI_CERT_CLIENT_P2_SEC_TAG, - .data = ¶ms->client_cert2, - .len = ¶ms->client_cert2_len, - }, - }; - - memset(params, 0, sizeof(*params)); - - /* Process common certificates */ - if (process_certificates(certs_common, ARRAY_SIZE(certs_common)) != 0) { - goto cleanup; - } - - /* Process STA-specific certificates */ - if (!is_ap) { - if (process_certificates(certs_sta, ARRAY_SIZE(certs_sta)) != 0) { - goto cleanup; - } - } - - memcpy(&enterprise_creds_params, params, sizeof(*params)); - return; - -cleanup: - for (size_t i = 0; i < ARRAY_SIZE(certs_common); i++) { - if (certs_common[i].data) { - k_free(*certs_common[i].data); - *certs_common[i].data = NULL; - } - } - - if (!is_ap) { - for (size_t i = 0; i < ARRAY_SIZE(certs_sta); i++) { - if (certs_sta[i].data) { - k_free(*certs_sta[i].data); - *certs_sta[i].data = NULL; - } - } - } - -} - -static void clear_enterprise_creds_params(struct wifi_enterprise_creds_params *params) -{ - if (params == NULL) { - return; - } - - const uint8_t *certs[] = { - params->ca_cert, - params->client_cert, - params->client_key, - params->ca_cert2, - params->client_cert2, - params->client_key2, - }; - - for (size_t i = 0; i < ARRAY_SIZE(certs); i++) { - k_free((void *)certs[i]); - } - memset(params, 0, sizeof(*params)); -} -#else -static void set_enterprise_creds_params(struct wifi_enterprise_creds_params *params, - bool is_ap) -{ - params->ca_cert = (uint8_t *)ca_cert_test; - params->ca_cert_len = ARRAY_SIZE(ca_cert_test); - - if (!is_ap) { - params->client_cert = (uint8_t *)client_cert_test; - params->client_cert_len = ARRAY_SIZE(client_cert_test); - params->client_key = (uint8_t *)client_key_test; - params->client_key_len = ARRAY_SIZE(client_key_test); - params->ca_cert2 = (uint8_t *)ca_cert2_test; - params->ca_cert2_len = ARRAY_SIZE(ca_cert2_test); - params->client_cert2 = (uint8_t *)client_cert2_test; - params->client_cert2_len = ARRAY_SIZE(client_cert2_test); - params->client_key2 = (uint8_t *)client_key2_test; - params->client_key2_len = ARRAY_SIZE(client_key2_test); - - return; - } -} -#endif /* CONFIG_WIFI_CREDENTIALS_RUNTIME_CERTIFICATES */ - -static int wifi_set_enterprise_creds(const struct shell *sh, struct net_if *iface, - bool is_ap) +static int cmd_wifi_set_enterprise_creds(const struct shell *sh, struct net_if *iface) { struct wifi_enterprise_creds_params params = {0}; -#ifdef CONFIG_WIFI_SHELL_RUNTIME_CERTIFICATES - clear_enterprise_creds_params(&enterprise_creds_params); -#endif /* CONFIG_WIFI_SHELL_RUNTIME_CERTIFICATES */ - - set_enterprise_creds_params(¶ms, is_ap); + params.ca_cert = (uint8_t *)ca_cert_test; + params.ca_cert_len = ARRAY_SIZE(ca_cert_test); + params.client_cert = (uint8_t *)client_cert_test; + params.client_cert_len = ARRAY_SIZE(client_cert_test); + params.client_key = (uint8_t *)client_key_test; + params.client_key_len = ARRAY_SIZE(client_key_test); + params.ca_cert2 = (uint8_t *)ca_cert2_test; + params.ca_cert2_len = ARRAY_SIZE(ca_cert2_test); + params.client_cert2 = (uint8_t *)client_cert2_test; + params.client_cert2_len = ARRAY_SIZE(client_cert2_test); + params.client_key2 = (uint8_t *)client_key2_test; + params.client_key2_len = ARRAY_SIZE(client_key2_test); if (net_mgmt(NET_REQUEST_WIFI_ENTERPRISE_CREDS, iface, ¶ms, sizeof(params))) { shell_warn(sh, "Set enterprise credentials failed\n"); @@ -522,7 +340,7 @@ static int cmd_add_network(const struct shell *sh, size_t argc, char *argv[]) } #ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE - struct net_if *iface = net_if_get_wifi_sta(); + struct net_if *iface = net_if_get_first_by_type(&NET_L2_GET_NAME(ETHERNET)); /* Load the enterprise credentials if needed */ if (creds.header.type == WIFI_SECURITY_TYPE_EAP_TLS || @@ -530,7 +348,7 @@ static int cmd_add_network(const struct shell *sh, size_t argc, char *argv[]) creds.header.type == WIFI_SECURITY_TYPE_EAP_PEAP_GTC || creds.header.type == WIFI_SECURITY_TYPE_EAP_TTLS_MSCHAPV2 || creds.header.type == WIFI_SECURITY_TYPE_EAP_PEAP_TLS) { - wifi_set_enterprise_creds(sh, iface, 0); + cmd_wifi_set_enterprise_creds(sh, iface); } #endif /* CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE */ @@ -550,12 +368,6 @@ static int cmd_delete_network(const struct shell *sh, size_t argc, char *argv[]) } shell_print(sh, "\tDeleting network ssid: \"%s\", ssid_len: %d", argv[1], strlen(argv[1])); - -#ifdef CONFIG_WIFI_SHELL_RUNTIME_CERTIFICATES - /* Clear the certificates */ - clear_enterprise_creds_params(&enterprise_creds_params); -#endif /* CONFIG_WIFI_SHELL_RUNTIME_CERTIFICATES */ - return wifi_credentials_delete_by_ssid(argv[1], strlen(argv[1])); } @@ -569,11 +381,7 @@ static int cmd_list_networks(const struct shell *sh, size_t argc, char *argv[]) static int cmd_auto_connect(const struct shell *sh, size_t argc, char *argv[]) { - struct net_if *iface = net_if_get_wifi_sta(); - -#ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE - wifi_set_enterprise_creds(sh, iface, 0); -#endif /* CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE */ + struct net_if *iface = net_if_get_first_by_type(&NET_L2_GET_NAME(ETHERNET)); int rc = net_mgmt(NET_REQUEST_WIFI_CONNECT_STORED, iface, NULL, 0); if (rc) { From 4ae42c230ca99d37194224cb15c3d61f8d84ed6c Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:12 +0300 Subject: [PATCH 1578/2141] Revert "[nrf fromlist] soc: nordic: s2ram: Optimize s2am marking functions" This reverts commit 80b7b93c475b80e11d2cfd90ed33c2b99c5f24f6. Signed-off-by: Jukka Rissanen --- soc/nordic/nrf54h/pm_s2ram.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/soc/nordic/nrf54h/pm_s2ram.c b/soc/nordic/nrf54h/pm_s2ram.c index 1ec5da4aa199..3ebd0a2f6bb2 100644 --- a/soc/nordic/nrf54h/pm_s2ram.c +++ b/soc/nordic/nrf54h/pm_s2ram.c @@ -187,16 +187,18 @@ void pm_s2ram_mark_set(void) bool pm_s2ram_mark_check_and_clear(void) { + bool unretained_wake; bool restore_valid; uint32_t reset_reason = nrf_resetinfo_resetreas_local_get(NRF_RESETINFO); if (reset_reason != NRF_RESETINFO_RESETREAS_LOCAL_UNRETAINED_MASK) { return false; } + unretained_wake = reset_reason & NRF_RESETINFO_RESETREAS_LOCAL_UNRETAINED_MASK; nrf_resetinfo_resetreas_local_set(NRF_RESETINFO, 0); restore_valid = nrf_resetinfo_restore_valid_check(NRF_RESETINFO); nrf_resetinfo_restore_valid_set(NRF_RESETINFO, false); - return restore_valid ? true : false; + return (unretained_wake & restore_valid) ? true : false; } From fd94d2a108b7bdcd8c7b88c0ea23a416dbab346a Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:12 +0300 Subject: [PATCH 1579/2141] Revert "[nrf fromlist] Revert "soc: nordic: s2ram: Align s2ram marking procedures"" This reverts commit eb17e7d76ef3971680fdd62e8717fb026132f792. Signed-off-by: Jukka Rissanen --- soc/nordic/nrf54h/pm_s2ram.c | 49 ++++++++++++++++++++++++++---------- 1 file changed, 36 insertions(+), 13 deletions(-) diff --git a/soc/nordic/nrf54h/pm_s2ram.c b/soc/nordic/nrf54h/pm_s2ram.c index 3ebd0a2f6bb2..c18c9650cdce 100644 --- a/soc/nordic/nrf54h/pm_s2ram.c +++ b/soc/nordic/nrf54h/pm_s2ram.c @@ -180,25 +180,48 @@ int soc_s2ram_suspend(pm_s2ram_system_off_fn_t system_off) return ret; } -void pm_s2ram_mark_set(void) +void __attribute__((naked)) pm_s2ram_mark_set(void) { /* empty */ + __asm__ volatile("bx lr\n"); } -bool pm_s2ram_mark_check_and_clear(void) +bool __attribute__((naked)) pm_s2ram_mark_check_and_clear(void) { - bool unretained_wake; - bool restore_valid; - uint32_t reset_reason = nrf_resetinfo_resetreas_local_get(NRF_RESETINFO); + __asm__ volatile( + /* Set return value to 0 */ + "mov r0, #0\n" - if (reset_reason != NRF_RESETINFO_RESETREAS_LOCAL_UNRETAINED_MASK) { - return false; - } - unretained_wake = reset_reason & NRF_RESETINFO_RESETREAS_LOCAL_UNRETAINED_MASK; - nrf_resetinfo_resetreas_local_set(NRF_RESETINFO, 0); + /* Load and check RESETREAS register */ + "ldr r3, [%[resetinfo_addr], %[resetreas_offs]]\n" + "cmp r3, %[resetreas_unretained_mask]\n" + + "bne exit\n" + + /* Clear RESETREAS register */ + "str r0, [%[resetinfo_addr], %[resetreas_offs]]\n" + + /* Load RESTOREVALID register */ + "ldr r3, [%[resetinfo_addr], %[restorevalid_offs]]\n" + + /* Clear RESTOREVALID */ + "str r0, [%[resetinfo_addr], %[restorevalid_offs]]\n" + + /* Check RESTOREVALID register */ + "cmp r3, %[restorevalid_present_mask]\n" + "bne exit\n" + + /* Set return value to 1 */ + "mov r0, #1\n" - restore_valid = nrf_resetinfo_restore_valid_check(NRF_RESETINFO); - nrf_resetinfo_restore_valid_set(NRF_RESETINFO, false); + "exit:\n" + "bx lr\n" + : + : [resetinfo_addr] "r"(NRF_RESETINFO), + [resetreas_offs] "r"(offsetof(NRF_RESETINFO_Type, RESETREAS.LOCAL)), + [resetreas_unretained_mask] "r"(NRF_RESETINFO_RESETREAS_LOCAL_UNRETAINED_MASK), + [restorevalid_offs] "r"(offsetof(NRF_RESETINFO_Type, RESTOREVALID)), + [restorevalid_present_mask] "r"(RESETINFO_RESTOREVALID_RESTOREVALID_Msk) - return (unretained_wake & restore_valid) ? true : false; + : "r0", "r1", "r3", "r4", "memory"); } From 7bd3d3789dd611f96250922d51a47f77416146e1 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:12 +0300 Subject: [PATCH 1580/2141] Revert "[nrf fromtree] modules: hal_nordic: nrfx: Use owned-channels property for DPPIC" This reverts commit 73bd5efabec5b88e745b12b2387154c2510ffe6b. Signed-off-by: Jukka Rissanen --- modules/hal_nordic/nrfx/nrfx_zephyr_utils.h | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/modules/hal_nordic/nrfx/nrfx_zephyr_utils.h b/modules/hal_nordic/nrfx/nrfx_zephyr_utils.h index a7f05ca372d8..e1fa4d4c321a 100644 --- a/modules/hal_nordic/nrfx/nrfx_zephyr_utils.h +++ b/modules/hal_nordic/nrfx/nrfx_zephyr_utils.h @@ -34,7 +34,7 @@ * definitions required by the interconnect/apb layer: * - NRFX_DPPI_PUB_CONFIG_ALLOWED_CHANNELS_MASK_BY_INST_NUM(inst_num) * - NRFX_DPPI_SUB_CONFIG_ALLOWED_CHANNELS_MASK_BY_INST_NUM(inst_num) - * - NRFX_DPPI_OWNED_MASK(inst_num) + * - NRFX_DPPI_PUB_OR_SUB_MASK(inst_num) * - NRFX_DPPI_CHANNELS_SINGLE_VAR_NAME_BY_INST_NUM(inst_num) * - NRFX_INTERCONNECT_APB_GLOBAL_DPPI_DEFINE * - NRFX_INTERCONNECT_APB_LOCAL_DPPI_DEFINE @@ -42,14 +42,6 @@ */ #if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_dppic_global) || \ DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_dppic_local) - -/* Channels masks generation. */ -#define NRFX_CONFIG_DPPI_MASK_DT(node_id) \ - COND_CODE_1(DT_NODE_HAS_PROP(node_id, owned_channels), \ - (NRFX_CONFIG_MASK_DT(node_id, owned_channels)), \ - (COND_CODE_1(DT_NODE_HAS_COMPAT(node_id, nordic_nrf_dppic_local), \ - (BIT64_MASK(DT_PROP(node_id, channels))), (0)))) - /* Source (publish) channels masks generation. */ #define NRFX_DPPI_PUB_CONFIG_ALLOWED_CHANNELS_MASK_BY_INST_NUM(inst_num) \ NRFX_CONFIG_MASK_DT(DT_NODELABEL(_CONCAT(dppic, inst_num)), source_channels) @@ -58,9 +50,9 @@ #define NRFX_DPPI_SUB_CONFIG_ALLOWED_CHANNELS_MASK_BY_INST_NUM(inst_num) \ NRFX_CONFIG_MASK_DT(DT_NODELABEL(_CONCAT(dppic, inst_num)), sink_channels) -#define NRFX_DPPI_OWNED_MASK(inst_num) \ - UTIL_OR(DT_NODE_HAS_PROP(DT_NODELABEL(_CONCAT(dppic, inst_num)), owned_channels), \ - DT_NODE_HAS_PROP(DT_NODELABEL(_CONCAT(dppic, inst_num)), channels)) +#define NRFX_DPPI_PUB_OR_SUB_MASK(inst_num) \ + UTIL_OR(DT_NODE_HAS_PROP(DT_NODELABEL(_CONCAT(dppic, inst_num)), source_channels), \ + DT_NODE_HAS_PROP(DT_NODELABEL(_CONCAT(dppic, inst_num)), sink_channels)) /* Variables names generation. */ #define NRFX_CONFIG_DPPI_CHANNELS_ENTRY_NAME(node_id) _CONCAT(_CONCAT(m_, node_id), _channels) @@ -70,7 +62,9 @@ /* Variables entries generation. */ #define NRFX_CONFIG_DPPI_CHANNELS_ENTRY(node_id) \ static nrfx_atomic_t NRFX_CONFIG_DPPI_CHANNELS_ENTRY_NAME(node_id) \ - __attribute__((used)) = (uint32_t)NRFX_CONFIG_DPPI_MASK_DT(node_id); + __attribute__((used)) = \ + NRFX_CONFIG_MASK_DT(node_id, source_channels) | \ + NRFX_CONFIG_MASK_DT(node_id, sink_channels); #define NRFX_INTERCONNECT_APB_GLOBAL_DPPI_DEFINE \ DT_FOREACH_STATUS_OKAY(nordic_nrf_dppic_global, NRFX_CONFIG_DPPI_CHANNELS_ENTRY) #define NRFX_INTERCONNECT_APB_LOCAL_DPPI_DEFINE \ From dd884385484fb1ad5c0a01d47da87dce29c7f9e1 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:12 +0300 Subject: [PATCH 1581/2141] Revert "[nrf fromtree] dts: nordic: Add channels property for local DPPI" This reverts commit a83d5969b2e2f3dbff5df6870177fe1f2468497f. Signed-off-by: Jukka Rissanen --- dts/bindings/misc/nordic,nrf-dppic-local.yaml | 6 ------ dts/vendor/nordic/nrf54h20.dtsi | 1 - dts/vendor/nordic/nrf9280.dtsi | 1 - 3 files changed, 8 deletions(-) diff --git a/dts/bindings/misc/nordic,nrf-dppic-local.yaml b/dts/bindings/misc/nordic,nrf-dppic-local.yaml index a96b5a994c9e..41029bb30621 100644 --- a/dts/bindings/misc/nordic,nrf-dppic-local.yaml +++ b/dts/bindings/misc/nordic,nrf-dppic-local.yaml @@ -11,9 +11,3 @@ description: | compatible: "nordic,nrf-dppic-local" include: ["nordic,nrf-dppic.yaml", "nordic,nrf-dppic-links.yaml"] - -properties: - channels: - type: int - required: true - description: Number of channels implemented by the DPPIC instance. diff --git a/dts/vendor/nordic/nrf54h20.dtsi b/dts/vendor/nordic/nrf54h20.dtsi index 96d4ff53af1c..32f126dddfdd 100644 --- a/dts/vendor/nordic/nrf54h20.dtsi +++ b/dts/vendor/nordic/nrf54h20.dtsi @@ -366,7 +366,6 @@ dppic020: dppic@22000 { compatible = "nordic,nrf-dppic-local"; reg = <0x22000 0x1000>; - channels = <32>; status = "disabled"; }; diff --git a/dts/vendor/nordic/nrf9280.dtsi b/dts/vendor/nordic/nrf9280.dtsi index 06e0a3a15145..d7c20e855c16 100644 --- a/dts/vendor/nordic/nrf9280.dtsi +++ b/dts/vendor/nordic/nrf9280.dtsi @@ -250,7 +250,6 @@ dppic020: dppic@22000 { compatible = "nordic,nrf-dppic-local"; reg = <0x22000 0x1000>; - channels = <32>; status = "disabled"; }; From b1296945bb62897b113bd629ec9a0d5ef9380d91 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:12 +0300 Subject: [PATCH 1582/2141] Revert "[nrf fromtree] cmake: add tfm / tfa image information to build info" This reverts commit e40777b62489c1a5ce62df81c22d7eb95845af8b. Signed-off-by: Jukka Rissanen --- modules/trusted-firmware-a/CMakeLists.txt | 3 --- modules/trusted-firmware-m/CMakeLists.txt | 3 --- 2 files changed, 6 deletions(-) diff --git a/modules/trusted-firmware-a/CMakeLists.txt b/modules/trusted-firmware-a/CMakeLists.txt index 0c0230174f09..72c1ea5c75af 100644 --- a/modules/trusted-firmware-a/CMakeLists.txt +++ b/modules/trusted-firmware-a/CMakeLists.txt @@ -8,9 +8,6 @@ if (CONFIG_BUILD_WITH_TFA) include(ExternalProject) - set(tfa_image_info MAP "name: tfa, source-dir: ${ZEPHYR_TRUSTED_FIRMWARE_A_MODULE_DIR}") - build_info(images VALUE ${tfa_image_info}) - ExternalProject_Add( tfa SOURCE_DIR ${ZEPHYR_TRUSTED_FIRMWARE_A_MODULE_DIR} diff --git a/modules/trusted-firmware-m/CMakeLists.txt b/modules/trusted-firmware-m/CMakeLists.txt index c76812198a32..9130f9629789 100644 --- a/modules/trusted-firmware-m/CMakeLists.txt +++ b/modules/trusted-firmware-m/CMakeLists.txt @@ -315,9 +315,6 @@ if (CONFIG_BUILD_WITH_TFM) # threads. Which is num_cores+2 on Ninja and MAKEFLAGS with Make. endif() - set(tfm_image_info MAP "name: tfm, source-dir: ${ZEPHYR_TRUSTED_FIRMWARE_M_MODULE_DIR}") - build_info(images VALUE ${tfm_image_info}) - ExternalProject_Add( tfm SOURCE_DIR ${ZEPHYR_TRUSTED_FIRMWARE_M_MODULE_DIR} From 719ea75199cee23845a67eb60bfe5e1f965dfa1f Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:13 +0300 Subject: [PATCH 1583/2141] Revert "[nrf fromtree] Revert "tests: arm_thread_swap: Add overlay for nRF54H20"" This reverts commit ec41d056fa9183df05c3d8b2c6047f75b00c2fde. Signed-off-by: Jukka Rissanen --- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 tests/arch/arm/arm_thread_swap/boards/nrf54h20dk_nrf54h20_cpuapp.overlay diff --git a/tests/arch/arm/arm_thread_swap/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/arch/arm/arm_thread_swap/boards/nrf54h20dk_nrf54h20_cpuapp.overlay new file mode 100644 index 000000000000..f9615d1b35ec --- /dev/null +++ b/tests/arch/arm/arm_thread_swap/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +&cpusec_cpuapp_ipc { + status = "disabled"; +}; + +&cpusec_bellboard { + status = "disabled"; +}; From 5c0451132d87b3379adf7a1e81a130a7861997a8 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Sep 2025 18:52:13 +0300 Subject: [PATCH 1584/2141] Revert "[nrf fromtree] ipc: ipc_service: Parametrize workqueue stack size" This reverts commit 6e85928cd49667ec14e254126c1e8a28f27feeba. Signed-off-by: Jukka Rissanen --- subsys/ipc/ipc_service/backends/Kconfig.icbmsg | 8 -------- subsys/ipc/ipc_service/backends/ipc_icbmsg.c | 3 +-- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/subsys/ipc/ipc_service/backends/Kconfig.icbmsg b/subsys/ipc/ipc_service/backends/Kconfig.icbmsg index 3a34c63c06c7..e31b5cadd77a 100644 --- a/subsys/ipc/ipc_service/backends/Kconfig.icbmsg +++ b/subsys/ipc/ipc_service/backends/Kconfig.icbmsg @@ -23,14 +23,6 @@ config IPC_SERVICE_BACKEND_ICBMSG_NUM_EP backend. The number of endpoints are applied to all the instances, so this value should be maximum number among all the instances. -config IPC_SERVICE_BACKEND_ICBMSG_EP_BOUND_WORK_Q_STACK_SIZE - int "Workqueue stack size" - default 1024 if NO_OPTIMIZATIONS - default 512 - help - Workqueue stack size for bounding processing - (this configuration is not optimized). - module = IPC_SERVICE_BACKEND_ICBMSG module-str = ICMSG backend with separate buffers module-help = Sets log level for ICMsg backend with buffers diff --git a/subsys/ipc/ipc_service/backends/ipc_icbmsg.c b/subsys/ipc/ipc_service/backends/ipc_icbmsg.c index 312642aafeb9..46ecfe1233ff 100644 --- a/subsys/ipc/ipc_service/backends/ipc_icbmsg.c +++ b/subsys/ipc/ipc_service/backends/ipc_icbmsg.c @@ -118,8 +118,7 @@ LOG_MODULE_REGISTER(ipc_icbmsg, #define FLAG_EPT_COUNT_MASK 0xFFFF /** Workqueue stack size for bounding processing (this configuration is not optimized). */ -#define EP_BOUND_WORK_Q_STACK_SIZE \ - (CONFIG_IPC_SERVICE_BACKEND_ICBMSG_EP_BOUND_WORK_Q_STACK_SIZE) +#define EP_BOUND_WORK_Q_STACK_SIZE (512U) /** Workqueue priority for bounding processing. */ #define EP_BOUND_WORK_Q_PRIORITY (CONFIG_SYSTEM_WORKQUEUE_PRIORITY) From af65674dee7e0a3948ac4399ddd3f2e0375da425 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Tue, 23 Sep 2025 09:19:38 +0200 Subject: [PATCH 1585/2141] Revert "Revert "[nrf noup] mcuboot: Add CONFIG_MCUBOOT_BOOTLOADER_USES_SHA512"" This reverts commit 2e2beca20d6bd81740b32d2f2da8d741fec941dd. Signed-off-by: Robert Lubos --- modules/Kconfig.mcuboot | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/Kconfig.mcuboot b/modules/Kconfig.mcuboot index 2c4dbfa930de..c7afb9a01231 100644 --- a/modules/Kconfig.mcuboot +++ b/modules/Kconfig.mcuboot @@ -287,6 +287,11 @@ config MCUBOOT_BOOTLOADER_NO_DOWNGRADE MCUBOOT_DOWNGRADE_PREVENTION option enabled. endif +config MCUBOOT_BOOTLOADER_USES_SHA512 + bool "MCUboot uses SHA512 for image hash" + help + MCUboot has been compiled to verify images using SHA512. + config MCUBOOT_APPLICATION_FIRMWARE_UPDATER bool "Application is firmware updater image" depends on MCUBOOT_BOOTLOADER_MODE_FIRMWARE_UPDATER From 0da800a47f7e5341d94e74fab2e56d9fdcd06665 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Tue, 23 Sep 2025 09:20:13 +0200 Subject: [PATCH 1586/2141] Revert "[nrf noup] mcuboot: Add CONFIG_MCUBOOT_BOOTLOADER_USES_SHA512" This reverts commit 6f1c879193c47eac41cc525dc02320bce8664472. Signed-off-by: Robert Lubos --- modules/Kconfig.mcuboot | 5 ----- 1 file changed, 5 deletions(-) diff --git a/modules/Kconfig.mcuboot b/modules/Kconfig.mcuboot index c7afb9a01231..2c4dbfa930de 100644 --- a/modules/Kconfig.mcuboot +++ b/modules/Kconfig.mcuboot @@ -287,11 +287,6 @@ config MCUBOOT_BOOTLOADER_NO_DOWNGRADE MCUBOOT_DOWNGRADE_PREVENTION option enabled. endif -config MCUBOOT_BOOTLOADER_USES_SHA512 - bool "MCUboot uses SHA512 for image hash" - help - MCUboot has been compiled to verify images using SHA512. - config MCUBOOT_APPLICATION_FIRMWARE_UPDATER bool "Application is firmware updater image" depends on MCUBOOT_BOOTLOADER_MODE_FIRMWARE_UPDATER From 0e33069243eecddf89fa6dbce39d7a2f8adf9bdf Mon Sep 17 00:00:00 2001 From: Aymen LAOUINI Date: Wed, 18 Jun 2025 17:26:00 +0300 Subject: [PATCH 1587/2141] [nrf fromtree] tests: kernel: gen_isr_table: Add ISR offset definitions for nrf9280 - Correct test by adding ISR offset definitions for nrf9280 ppr and flrp. Signed-off-by: Aymen LAOUINI (cherry picked from commit 07d9f151e71f3960ab1ea0dd81afd86775d522dc) --- tests/arch/common/gen_isr_table/src/main.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/arch/common/gen_isr_table/src/main.c b/tests/arch/common/gen_isr_table/src/main.c index e716f0ddf4b6..ed764e05b4bf 100644 --- a/tests/arch/common/gen_isr_table/src/main.c +++ b/tests/arch/common/gen_isr_table/src/main.c @@ -42,6 +42,11 @@ extern const uintptr_t _irq_vector_table[]; #define ISR3_OFFSET 15 #define ISR5_OFFSET 16 #define TRIG_CHECK_SIZE 17 +#elif defined(CONFIG_SOC_NRF9280_CPUPPR) +#define ISR1_OFFSET 14 +#define ISR3_OFFSET 15 +#define ISR5_OFFSET 16 +#define TRIG_CHECK_SIZE 17 #else #error "Target not supported" #endif From f976924e71021620a08475c5f2002d88209d9ace Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Mon, 30 Jun 2025 08:03:06 +0200 Subject: [PATCH 1588/2141] [nrf fromlist] dts: bindings: serial: nrf-uarte: Add timer property MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Timer property indicates which TIMER instance should be used for byte counting. If timer property is present then given instance is using TIMER to count received bytes. Upstream PR #: 92767 Signed-off-by: Krzysztof Chruściński (cherry picked from commit b83628773c322abb2347726371b6a63441188e33) --- dts/bindings/serial/nordic,nrf-uarte.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dts/bindings/serial/nordic,nrf-uarte.yaml b/dts/bindings/serial/nordic,nrf-uarte.yaml index 4e9ccb0dd400..c8eb2bbc758d 100644 --- a/dts/bindings/serial/nordic,nrf-uarte.yaml +++ b/dts/bindings/serial/nordic,nrf-uarte.yaml @@ -24,3 +24,11 @@ properties: type: boolean description: | UARTE allows usage of cross domain pins with constant latency mode required. + + timer: + type: phandle + description: | + Timer instance used to count received bytes. Due to issues with frame timeout + feature it is required to reliably receive data in cases where flow control + is not used and new byte can appear on the line when frame timeout expires + but before it is handled. From ed0b0724be11a81a88f1c5b9c0b02774563f3115 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Mon, 7 Jul 2025 12:02:24 +0200 Subject: [PATCH 1589/2141] [nrf fromlist] tests: drivers: uart: async_dual: Add progress report MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add reporting about the test progress. Test lasts few seconds and progress report helps to see if test stuck or how it is progressing. Upstream PR #: 92767 Signed-off-by: Krzysztof Chruściński (cherry picked from commit 249e3bf5abbe03e3a493915ca89b3ad585207022) --- tests/drivers/uart/uart_async_dual/src/main.c | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/drivers/uart/uart_async_dual/src/main.c b/tests/drivers/uart/uart_async_dual/src/main.c index 37ce73120acb..d14e0f88a11e 100644 --- a/tests/drivers/uart/uart_async_dual/src/main.c +++ b/tests/drivers/uart/uart_async_dual/src/main.c @@ -365,6 +365,26 @@ static void config_baudrate(uint32_t rate) } } +static void report_progress(uint32_t start) +{ + static const uint32_t inc = CONFIG_UART_ASYNC_DUAL_TEST_TIMEOUT / 20; + static uint32_t next; + static uint32_t progress; + + if ((k_uptime_get_32() - start < inc) && progress) { + /* Reset state. */ + next = inc; + progress = 0; + } + + if (k_uptime_get_32() > (start + next)) { + progress += 5; + TC_PRINT("\r%d%%", progress); + next += inc; + } +} + + /* Test is running following scenario. Transmitter is sending packets which * has 1 byte header with length followed by the payload. Transmitter can send * packets in two modes: bulk where data is send in chunks without gaps between @@ -380,6 +400,7 @@ static void var_packet_hwfc(uint32_t baudrate, bool tx_packets, bool cont) { int err; uint32_t load = 0; + uint32_t start = k_uptime_get_32(); config_baudrate(baudrate); @@ -420,8 +441,10 @@ static void var_packet_hwfc(uint32_t baudrate, bool tx_packets, bool cont) while (tx_data.cont || rx_data.cont) { fill_tx(&tx_data); k_msleep(1); + report_progress(start); try_tx(tx_dev, false); } + TC_PRINT("\n"); if (IS_ENABLED(CONFIG_CPU_LOAD)) { load = cpu_load_get(true); @@ -653,6 +676,7 @@ static void hci_like_rx(void) uint8_t len; bool cont; bool explicit_pm = IS_ENABLED(CONFIG_PM_RUNTIME_IN_TEST); + uint32_t start = k_uptime_get_32(); while (1) { if (explicit_pm) { @@ -704,7 +728,9 @@ static void hci_like_rx(void) PM_CHECK(rx_dev, tx_dev, false); check_payload(rx_data.buf, len); + report_progress(start); } + TC_PRINT("\n"); } #define HCI_LIKE_TX_STACK_SIZE 2048 From 4b000e7b087e435d28f45a3736e9036c51b13138 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Mon, 7 Jul 2025 12:02:46 +0200 Subject: [PATCH 1590/2141] [nrf fromlist] tests: drivers: uart: async_dual: Extend testing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Extend test with a mode where HWFC is off and receiver is providing buffers on time. In that case receiver should be able to continuously receive data without losing any byte (even without HWFC). Additionally, TX data is chopped to verify that receiver does not loose bytes when new TX data collides with detected RX timeout. Upstream PR #: 92767 Signed-off-by: Krzysztof Chruściński (cherry picked from commit bac4ea5d135b521c269cbceb231467468e0b49a6) --- tests/drivers/uart/uart_async_dual/Kconfig | 8 + tests/drivers/uart/uart_async_dual/src/main.c | 218 ++++++++++++++---- .../uart/uart_async_dual/testcase.yaml | 15 ++ 3 files changed, 191 insertions(+), 50 deletions(-) diff --git a/tests/drivers/uart/uart_async_dual/Kconfig b/tests/drivers/uart/uart_async_dual/Kconfig index 6e80ec3a7957..f0087aa48e3b 100644 --- a/tests/drivers/uart/uart_async_dual/Kconfig +++ b/tests/drivers/uart/uart_async_dual/Kconfig @@ -16,5 +16,13 @@ config PM_RUNTIME_IN_TEST select PM_DEVICE select PM_DEVICE_RUNTIME +config TEST_CHOPPED_TX + bool "Test chopped TX data" + default y + help + When enabled then test cases that transmits TX packets in random chunks are + performed. Some driver implementation do not support case when new TX data + collides with handling of the RX timeout. + # Include Zephyr's Kconfig source "Kconfig" diff --git a/tests/drivers/uart/uart_async_dual/src/main.c b/tests/drivers/uart/uart_async_dual/src/main.c index d14e0f88a11e..c2ad5d8a0a0c 100644 --- a/tests/drivers/uart/uart_async_dual/src/main.c +++ b/tests/drivers/uart/uart_async_dual/src/main.c @@ -28,9 +28,10 @@ LOG_MODULE_REGISTER(test); #endif #define TX_TIMEOUT 100000 -#define RX_TIMEOUT 2000 +#define RX_TIMEOUT_BYTES 50 #define MAX_PACKET_LEN 128 +#define MIN_PACKET_LEN 10 struct dut_data { const struct device *dev; @@ -100,6 +101,7 @@ static const struct device *tx_dev; enum test_tx_mode { TX_BULK, TX_PACKETS, + TX_CHOPPED, }; struct test_tx_data { @@ -111,6 +113,8 @@ struct test_tx_data { volatile bool cont; volatile enum test_tx_mode mode; struct k_sem sem; + uint32_t idx; + uint32_t rx_timeout; }; enum test_rx_state { @@ -121,17 +125,21 @@ enum test_rx_state { enum test_rx_mode { RX_CONT, RX_DIS, + RX_ALL, }; struct test_rx_data { uint8_t hdr[1]; uint8_t buf[256]; uint32_t rx_cnt; + uint32_t payload_idx; enum test_rx_state state; enum test_rx_mode mode; volatile bool cont; bool buf_req; struct k_sem sem; + uint32_t timeout; + uint32_t buf_idx; }; static struct test_tx_data tx_data; @@ -143,8 +151,8 @@ static void fill_tx(struct test_tx_data *data) uint32_t len; int err; - if (data->mode == TX_PACKETS) { - err = k_sem_take(&data->sem, K_MSEC(100)); + if (data->mode != TX_BULK) { + err = k_sem_take(&data->sem, K_MSEC(200)); if (err < 0 && !data->cont) { return; } @@ -153,9 +161,10 @@ static void fill_tx(struct test_tx_data *data) uint8_t len = sys_rand8_get(); len = len % MAX_PACKET_LEN; - len = MAX(2, len); + len = MAX(MIN_PACKET_LEN, len); data->packet_len = len; + data->idx = 0; for (int i = 0; i < len; i++) { data->buf[i] = len - i; } @@ -163,12 +172,11 @@ static void fill_tx(struct test_tx_data *data) return; } - while ((len = ring_buf_put_claim(&data->rbuf, &buf, 255)) > 1) { + while ((len = ring_buf_put_claim(&data->rbuf, &buf, 255)) > 0) { uint8_t r = (sys_rand8_get() % MAX_PACKET_LEN) % len; - uint8_t packet_len = MAX(r, 2); - uint8_t rem = len - packet_len; + uint8_t packet_len = MAX(r, MIN_PACKET_LEN); - packet_len = (rem < 3) ? len : packet_len; + packet_len = (len <= MIN_PACKET_LEN) ? len : packet_len; buf[0] = packet_len; for (int i = 1; i < packet_len; i++) { buf[i] = packet_len - i; @@ -189,7 +197,7 @@ static void try_tx(const struct device *dev, bool irq) return; } - if ((tx_data.mode == TX_PACKETS) && (tx_data.packet_len > 0)) { + if (tx_data.mode == TX_PACKETS) { uint8_t len = tx_data.packet_len; tx_data.packet_len = 0; @@ -199,19 +207,50 @@ static void try_tx(const struct device *dev, bool irq) err, irq, tx_data.cont); return; } - zassert_true(tx_data.mode == TX_BULK); - if (!atomic_cas(&tx_data.busy, 0, 1)) { + if (tx_data.mode == TX_BULK) { + if (!atomic_cas(&tx_data.busy, 0, 1)) { + return; + } + + len = ring_buf_get_claim(&tx_data.rbuf, &buf, 255); + if (len > 0) { + err = uart_tx(dev, buf, len, TX_TIMEOUT); + zassert_equal(err, 0, + "Unexpected err:%d irq:%d cont:%d\n", + err, irq, tx_data.cont); + } else { + tx_data.busy = 0; + } return; } - len = ring_buf_get_claim(&tx_data.rbuf, &buf, 255); - if (len > 0) { - err = uart_tx(dev, buf, len, TX_TIMEOUT); - zassert_equal(err, 0, - "Unexpected err:%d irq:%d cont:%d\n", - err, irq, tx_data.cont); + zassert_true(tx_data.mode == TX_CHOPPED); + + uint32_t rem = tx_data.packet_len - tx_data.idx; + + if (tx_data.packet_len > 12) { + len = sys_rand8_get() % (tx_data.packet_len / 4); + } else { + len = 0; } + len = MAX(3, len); + len = MIN(rem, len); + + buf = &tx_data.buf[tx_data.idx]; + tx_data.idx += len; + + err = uart_tx(dev, buf, len, TX_TIMEOUT); + zassert_equal(err, 0, + "Unexpected err:%d irq:%d cont:%d\n", + err, irq, tx_data.cont); +} + +static void tx_backoff(uint32_t rx_timeout) +{ + uint32_t delay = (rx_timeout / 2) + (sys_rand32_get() % rx_timeout); + + k_busy_wait(delay); } static void on_tx_done(const struct device *dev, struct uart_event *evt) @@ -221,6 +260,17 @@ static void on_tx_done(const struct device *dev, struct uart_event *evt) return; } + if (tx_data.mode == TX_CHOPPED) { + if (tx_data.idx == tx_data.packet_len) { + k_sem_give(&tx_data.sem); + } else { + + tx_backoff(tx_data.rx_timeout); + try_tx(dev, true); + } + return; + } + /* Finish previous data chunk and start new if any pending. */ ring_buf_get_finish(&tx_data.rbuf, evt->data.tx.len); atomic_set(&tx_data.busy, 0); @@ -239,7 +289,16 @@ static void on_rx_rdy(const struct device *dev, struct uart_event *evt) rx_data.rx_cnt += evt->data.rx.len; if (evt->data.rx.buf == rx_data.hdr) { + if (rx_data.hdr[0] == 1) { + /* single byte packet. */ + err = uart_rx_buf_rsp(dev, rx_data.hdr, 1); + zassert_equal(err, 0); + return; + } + + zassert_equal(rx_data.payload_idx, 0); rx_data.state = RX_PAYLOAD; + rx_data.payload_idx = rx_data.hdr[0] - 1; if ((rx_data.mode == RX_CONT) && rx_data.buf_req) { size_t l = rx_data.hdr[0] - 1; @@ -248,16 +307,19 @@ static void on_rx_rdy(const struct device *dev, struct uart_event *evt) err = uart_rx_buf_rsp(dev, rx_data.buf, rx_data.hdr[0] - 1); } } else { - /* Payload received */ - rx_data.state = RX_HDR; - zassert_equal(len, rx_data.hdr[0] - 1); - for (int i = 0; i < len; i++) { - bool ok = evt->data.rx.buf[off + i] == (uint8_t)(len - i); + bool ok; + + if ((rx_data.mode == RX_ALL) && (rx_data.payload_idx == 0)) { + rx_data.payload_idx = evt->data.rx.buf[off + i]; + ok = true; + } else { + ok = evt->data.rx.buf[off + i] == (uint8_t)rx_data.payload_idx; + } if (!ok) { LOG_ERR("Unexpected data at %d, exp:%02x got:%02x", - i, len - i, evt->data.rx.buf[off + i]); + i, rx_data.payload_idx, evt->data.rx.buf[off + i]); } zassert_true(ok, "Unexpected data at %d, exp:%02x got:%02x", @@ -270,21 +332,52 @@ static void on_rx_rdy(const struct device *dev, struct uart_event *evt) */ return; } - } - if ((rx_data.mode == RX_CONT) && rx_data.buf_req) { - rx_data.buf_req = false; - err = uart_rx_buf_rsp(dev, rx_data.hdr, 1); + rx_data.payload_idx--; + if (rx_data.payload_idx == 0) { + if (rx_data.mode != RX_ALL) { + zassert_equal(i + 1, len, "len:%d i:%d", len, i); + } + rx_data.state = RX_HDR; + if ((rx_data.mode == RX_CONT) && rx_data.buf_req) { + rx_data.buf_req = false; + err = uart_rx_buf_rsp(dev, rx_data.hdr, 1); + zassert_equal(err, 0); + } + } } } } +static void on_rx_buf_req(const struct device *dev) +{ + if (rx_data.mode != RX_ALL) { + rx_data.buf_req = true; + return; + } + + size_t len = sizeof(rx_data.buf) / 2; + uint8_t *buf = &rx_data.buf[len * rx_data.buf_idx]; + + rx_data.buf_idx = (rx_data.buf_idx + 1) & 0x1; + uart_rx_buf_rsp(dev, buf, len); +} + static void on_rx_dis(const struct device *dev, struct uart_event *evt, void *user_data) { ARG_UNUSED(evt); struct test_rx_data *data = user_data; int err; - uint8_t *buf = (data->state == RX_HDR) ? data->hdr : data->buf; - uint32_t len = (data->state == RX_HDR) ? 1 : (data->hdr[0] - 1); + uint8_t *buf; + uint32_t len; + + if (data->mode == RX_ALL) { + buf = data->buf; + len = sizeof(data->buf) / 2; + } else { + buf = (data->state == RX_HDR) ? data->hdr : data->buf; + len = (data->state == RX_HDR) ? 1 : (data->hdr[0] - 1); + data->buf_idx = 1; + } data->buf_req = false; @@ -294,7 +387,7 @@ static void on_rx_dis(const struct device *dev, struct uart_event *evt, void *us zassert_true(len > 0); - err = uart_rx_enable(dev, buf, len, RX_TIMEOUT); + err = uart_rx_enable(dev, buf, len, data->timeout); zassert_equal(err, 0, "Unexpected err:%d", err); } @@ -330,8 +423,8 @@ static void uart_callback(const struct device *dev, struct uart_event *evt, void zassert_true(dev == rx_dev); break; case UART_RX_BUF_REQUEST: - rx_data.buf_req = true; zassert_true(dev == rx_dev); + on_rx_buf_req(dev); break; case UART_RX_DISABLED: zassert_true(dev == rx_dev); @@ -346,7 +439,7 @@ static void uart_callback(const struct device *dev, struct uart_event *evt, void } } -static void config_baudrate(uint32_t rate) +static void config_baudrate(uint32_t rate, bool hwfc) { struct uart_config config; int err; @@ -354,6 +447,7 @@ static void config_baudrate(uint32_t rate) err = uart_config_get(rx_dev, &config); zassert_equal(err, 0, "Unexpected err:%d", err); + config.flow_ctrl = hwfc ? UART_CFG_FLOW_CTRL_RTS_CTS : UART_CFG_FLOW_CTRL_NONE; config.baudrate = rate; err = uart_configure(rx_dev, &config); @@ -396,13 +490,14 @@ static void report_progress(uint32_t start) * * Test has busy simulator running if it is enabled in the configuration. */ -static void var_packet_hwfc(uint32_t baudrate, bool tx_packets, bool cont) +static void var_packet(uint32_t baudrate, enum test_tx_mode tx_mode, + enum test_rx_mode rx_mode, bool hwfc) { int err; uint32_t load = 0; uint32_t start = k_uptime_get_32(); - config_baudrate(baudrate); + config_baudrate(baudrate, hwfc); if (IS_ENABLED(CONFIG_TEST_BUSY_SIM)) { uint32_t active_avg = (baudrate == 1000000) ? 5 : 30; @@ -414,13 +509,15 @@ static void var_packet_hwfc(uint32_t baudrate, bool tx_packets, bool cont) memset(&tx_data, 0, sizeof(tx_data)); memset(&rx_data, 0, sizeof(rx_data)); tx_data.cont = true; - tx_data.mode = tx_packets ? TX_PACKETS : TX_BULK; - k_sem_init(&tx_data.sem, tx_packets ? 1 : 0, 1); + tx_data.mode = tx_mode; + k_sem_init(&tx_data.sem, (tx_mode != TX_BULK) ? 1 : 0, 1); + rx_data.timeout = (RX_TIMEOUT_BYTES * 1000000 * 10) / baudrate; + tx_data.rx_timeout = rx_data.timeout; rx_data.cont = true; rx_data.rx_cnt = 0; rx_data.state = RX_HDR; - rx_data.mode = cont ? RX_CONT : RX_DIS; + rx_data.mode = rx_mode; ring_buf_init(&tx_data.rbuf, sizeof(tx_data.buf), tx_data.buf); @@ -459,62 +556,82 @@ static void var_packet_hwfc(uint32_t baudrate, bool tx_packets, bool cont) /* Flush all TX data that may be already started. */ k_msleep(10); - (void)uart_rx_enable(rx_dev, rx_data.buf, sizeof(rx_data.buf), RX_TIMEOUT); + (void)uart_rx_enable(rx_dev, rx_data.buf, sizeof(rx_data.buf), rx_data.timeout); k_msleep(10); (void)uart_rx_disable(rx_dev); k_msleep(10); TC_PRINT("Received %d bytes for %d ms, CPU load:%d.%d\n", rx_data.rx_cnt, CONFIG_UART_ASYNC_DUAL_TEST_TIMEOUT, load / 10, load % 10); - zassert_true(rx_data.rx_cnt > 1000, "Unexected RX cnt: %d", rx_data.rx_cnt); + zassert_true(rx_data.rx_cnt > 1000, "Unexpected RX cnt: %d", rx_data.rx_cnt); } ZTEST(uart_async_dual, test_var_packets_tx_bulk_dis_hwfc) { /* TX in bulk mode, RX in DIS mode, 115k2 */ - var_packet_hwfc(115200, false, false); + var_packet(115200, TX_BULK, RX_DIS, true); } ZTEST(uart_async_dual, test_var_packets_tx_bulk_cont_hwfc) { /* TX in bulk mode, RX in CONT mode, 115k2 */ - var_packet_hwfc(115200, false, true); + var_packet(115200, TX_BULK, RX_CONT, true); } ZTEST(uart_async_dual, test_var_packets_tx_bulk_dis_hwfc_1m) { /* TX in bulk mode, RX in DIS mode, 1M */ - var_packet_hwfc(1000000, false, false); + var_packet(1000000, TX_BULK, RX_DIS, true); } ZTEST(uart_async_dual, test_var_packets_tx_bulk_cont_hwfc_1m) { /* TX in bulk mode, RX in CONT mode, 1M */ - var_packet_hwfc(1000000, false, true); + var_packet(1000000, TX_BULK, RX_CONT, true); } ZTEST(uart_async_dual, test_var_packets_dis_hwfc) { /* TX in packet mode, RX in DIS mode, 115k2 */ - var_packet_hwfc(115200, true, false); + var_packet(115200, TX_PACKETS, RX_DIS, true); } ZTEST(uart_async_dual, test_var_packets_cont_hwfc) { /* TX in packet mode, RX in CONT mode, 115k2 */ - var_packet_hwfc(115200, true, true); + var_packet(115200, TX_PACKETS, RX_CONT, true); } ZTEST(uart_async_dual, test_var_packets_dis_hwfc_1m) { /* TX in packet mode, RX in DIS mode, 1M */ - var_packet_hwfc(1000000, true, false); + var_packet(1000000, TX_PACKETS, RX_DIS, true); } ZTEST(uart_async_dual, test_var_packets_cont_hwfc_1m) { /* TX in packet mode, RX in CONT mode, 1M */ - var_packet_hwfc(1000000, true, true); + var_packet(1000000, TX_PACKETS, RX_CONT, true); +} + +ZTEST(uart_async_dual, test_var_packets_chopped_all) +{ + if (!IS_ENABLED(CONFIG_TEST_CHOPPED_TX)) { + ztest_test_skip(); + } + + /* TX in chopped mode, RX in receive ALL mode, 115k2 */ + var_packet(115200, TX_CHOPPED, RX_ALL, false); +} + +ZTEST(uart_async_dual, test_var_packets_chopped_all_1m) +{ + if (!IS_ENABLED(CONFIG_TEST_CHOPPED_TX)) { + ztest_test_skip(); + } + + /* TX in chopped mode, RX in receive ALL mode, 1M */ + var_packet(1000000, TX_CHOPPED, RX_ALL, false); } static void hci_like_callback(const struct device *dev, struct uart_event *evt, void *user_data) @@ -563,7 +680,7 @@ static bool rx(uint8_t *buf, size_t len) { int err; - err = uart_rx_enable(rx_dev, buf, len, RX_TIMEOUT); + err = uart_rx_enable(rx_dev, buf, len, rx_data.timeout); zassert_equal(err, 0, "Unexpected err:%d", err); err = k_sem_take(&rx_data.sem, K_MSEC(100)); @@ -751,7 +868,7 @@ static void hci_like_test(uint32_t baudrate) int err; uint32_t load = 0; - config_baudrate(baudrate); + config_baudrate(baudrate, true); if (IS_ENABLED(CONFIG_TEST_BUSY_SIM)) { uint32_t active_avg = (baudrate == 1000000) ? 10 : 50; @@ -765,6 +882,7 @@ static void hci_like_test(uint32_t baudrate) tx_data.cnt = 0; tx_data.cont = true; rx_data.cont = true; + rx_data.timeout = (RX_TIMEOUT_BYTES * 1000000 * 10) / baudrate; k_sem_init(&tx_data.sem, 1, 1); k_sem_init(&rx_data.sem, 0, 1); @@ -802,7 +920,7 @@ static void hci_like_test(uint32_t baudrate) k_msleep(10); PM_CHECK(tx_dev, rx_dev, false); - (void)uart_rx_enable(rx_dev, rx_data.buf, sizeof(rx_data.buf), RX_TIMEOUT); + (void)uart_rx_enable(rx_dev, rx_data.buf, sizeof(rx_data.buf), rx_data.timeout); k_msleep(1); (void)uart_rx_disable(rx_dev); diff --git a/tests/drivers/uart/uart_async_dual/testcase.yaml b/tests/drivers/uart/uart_async_dual/testcase.yaml index 1a2d811bbfe9..1722d5e5e7d1 100644 --- a/tests/drivers/uart/uart_async_dual/testcase.yaml +++ b/tests/drivers/uart/uart_async_dual/testcase.yaml @@ -73,3 +73,18 @@ tests: - nrf52_bsim extra_configs: - CONFIG_PM_RUNTIME_IN_TEST=y + drivers.uart.async_dual.no_tx_chopped: + harness: ztest + harness_config: + fixture: uart_loopback + depends_on: gpio + platform_allow: + - nrf54l15dk/nrf54l15/cpuapp + - nrf54h20dk/nrf54h20/cpuapp + - nrf54h20dk/nrf54h20/cpurad + - nrf54h20dk/nrf54h20/cpuppr + - nrf9160dk/nrf9160 + - nrf52_bsim + extra_configs: + - CONFIG_TEST_CHOPPED_TX=n + - CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER=n From f2bbea0dbcdb86943eaba15bfc62cefc83933e6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Mon, 30 Jun 2025 08:08:26 +0200 Subject: [PATCH 1591/2141] [nrf fromlist] tests: drivers: uart: async_dual: Update configuration for nrf54l MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add timer property to the uart device under test. Add zephyr,pm-device-runtime-auto to the uart device under test. Upstream PR #: 92767 Signed-off-by: Krzysztof Chruściński (cherry picked from commit 9880309e77a33c49f91906f9355d845f11984432) --- .../boards/nrf54l15dk_nrf54l15_cpuapp.overlay | 1 + .../boards/nrf54l15dk_nrf54l15_cpuapp.overlay | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/tests/drivers/uart/uart_async_api/boards/nrf54l15dk_nrf54l15_cpuapp.overlay b/tests/drivers/uart/uart_async_api/boards/nrf54l15dk_nrf54l15_cpuapp.overlay index a1e29cbf0ffc..d8995e369711 100644 --- a/tests/drivers/uart/uart_async_api/boards/nrf54l15dk_nrf54l15_cpuapp.overlay +++ b/tests/drivers/uart/uart_async_api/boards/nrf54l15dk_nrf54l15_cpuapp.overlay @@ -42,6 +42,7 @@ dut: &uart21 { pinctrl-1 = <&uart21_sleep_alt>; pinctrl-names = "default", "sleep"; current-speed = <115200>; + timer = <&timer21>; }; dut2: &uart00 { diff --git a/tests/drivers/uart/uart_async_dual/boards/nrf54l15dk_nrf54l15_cpuapp.overlay b/tests/drivers/uart/uart_async_dual/boards/nrf54l15dk_nrf54l15_cpuapp.overlay index 93ad73f3b373..224399ccaa95 100644 --- a/tests/drivers/uart/uart_async_dual/boards/nrf54l15dk_nrf54l15_cpuapp.overlay +++ b/tests/drivers/uart/uart_async_dual/boards/nrf54l15dk_nrf54l15_cpuapp.overlay @@ -38,6 +38,10 @@ }; }; +&timer21 { + status = "reserved"; +}; + dut: &uart21 { status = "okay"; current-speed = <115200>; @@ -45,6 +49,8 @@ dut: &uart21 { pinctrl-1 = <&uart21_sleep>; pinctrl-names = "default", "sleep"; hw-flow-control; + timer = <&timer21>; + zephyr,pm-device-runtime-auto; }; dut_aux: &uart22 { @@ -54,6 +60,7 @@ dut_aux: &uart22 { pinctrl-1 = <&uart22_sleep>; pinctrl-names = "default", "sleep"; hw-flow-control; + zephyr,pm-device-runtime-auto; }; &timer20 { From 0ddadd3b8b5eae24dd88423ea4d64a776a83bc54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Fri, 4 Jul 2025 13:02:21 +0200 Subject: [PATCH 1592/2141] [nrf fromlist] tests: drivers: uart: async_dual: Extend nrf54h20dk configuration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add workaround timer to instances that are used for reception in the test. Upstream PR #: 92767 Signed-off-by: Krzysztof Chruściński (cherry picked from commit 95ceeea1d07954d763c357cbe667def4ea1fd17f) --- .../boards/nrf54h20dk_nrf54h20_common.dtsi | 22 +++++++++++++++++++ .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 12 ++++++++++ 2 files changed, 34 insertions(+) diff --git a/tests/drivers/uart/uart_async_dual/boards/nrf54h20dk_nrf54h20_common.dtsi b/tests/drivers/uart/uart_async_dual/boards/nrf54h20dk_nrf54h20_common.dtsi index e651cf5399ed..1ca0775f629e 100644 --- a/tests/drivers/uart/uart_async_dual/boards/nrf54h20dk_nrf54h20_common.dtsi +++ b/tests/drivers/uart/uart_async_dual/boards/nrf54h20dk_nrf54h20_common.dtsi @@ -60,6 +60,16 @@ }; }; +&timer134 { + status = "reserved"; +}; + +&dppic135 { + owned-channels = <0>; + source-channels = <0>; + status = "okay"; +}; + dut: &uart134 { status = "okay"; current-speed = <115200>; @@ -67,6 +77,7 @@ dut: &uart134 { pinctrl-1 = <&uart134_alt_sleep>; pinctrl-names = "default", "sleep"; hw-flow-control; + timer = <&timer134>; zephyr,pm-device-runtime-auto; }; @@ -80,12 +91,23 @@ dut_aux: &uart137 { zephyr,pm-device-runtime-auto; }; +&dppic120 { + owned-channels = <0>; + source-channels = <0>; + status = "okay"; +}; + +&timer120 { + status = "reserved"; +}; + dut2: &uart120 { pinctrl-0 = <&uart120_default_alt>; pinctrl-1 = <&uart120_sleep_alt>; pinctrl-names = "default", "sleep"; current-speed = <115200>; hw-flow-control; + timer = <&timer120>; zephyr,pm-device-runtime-auto; }; diff --git a/tests/drivers/uart/uart_async_dual/sysbuild/vpr_launcher/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/uart/uart_async_dual/sysbuild/vpr_launcher/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index fcdc838a54e4..65a2c52016e6 100644 --- a/tests/drivers/uart/uart_async_dual/sysbuild/vpr_launcher/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/tests/drivers/uart/uart_async_dual/sysbuild/vpr_launcher/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -9,3 +9,15 @@ status = "reserved"; interrupt-parent = <&cpuppr_clic>; }; + +&timer134 { + interrupt-parent = <&cpuppr_clic>; +}; + +&dppic135 { + child-owned-channels = <0>; +}; + +&uart136 { + current-speed = <1000000>; +}; From b208c44a913b9a012b75ecfa67e958c40c3ffd66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Fri, 11 Jul 2025 12:46:55 +0200 Subject: [PATCH 1593/2141] [nrf fromlist] tests: drivers: uart: async_dual: Optimize test data handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Stress test is executed on CPUs with slow clock (16MHz). Handling of test data in UART_RX_RDY event is optimized to reduce time spent in the interrupt context. Since payload is always a decrementing sequence, fixed array is used to compare memory which allows to use standard memcmp instead of byte by byte comparison. Upstream PR #: 92767 Signed-off-by: Krzysztof Chruściński (cherry picked from commit 29526b1e69a2ac46c13da6ca44251bdaa73f14e1) --- tests/drivers/uart/uart_async_dual/src/main.c | 152 +++++++++++------- 1 file changed, 94 insertions(+), 58 deletions(-) diff --git a/tests/drivers/uart/uart_async_dual/src/main.c b/tests/drivers/uart/uart_async_dual/src/main.c index c2ad5d8a0a0c..160d8c761040 100644 --- a/tests/drivers/uart/uart_async_dual/src/main.c +++ b/tests/drivers/uart/uart_async_dual/src/main.c @@ -61,6 +61,25 @@ ZTEST_DMEM struct dut_data duts[] = { #endif }; +/* Array that contains potential payload. It is used to memcmp against incoming packets. */ +static const uint8_t test_buf[256] = { + 255, 254, 253, 252, 251, 250, 249, 248, 247, 246, 245, 244, 243, 242, 241, + 240, 239, 238, 237, 236, 235, 234, 233, 232, 231, 230, 229, 228, 227, 226, + 225, 224, 223, 222, 221, 220, 219, 218, 217, 216, 215, 214, 213, 212, 211, + 210, 209, 208, 207, 206, 205, 204, 203, 202, 201, 200, 199, 198, 197, 196, + 195, 194, 193, 192, 191, 190, 189, 188, 187, 186, 185, 184, 183, 182, 181, + 180, 179, 178, 177, 176, 175, 174, 173, 172, 171, 170, 169, 168, 167, 166, + 165, 164, 163, 162, 161, 160, 159, 158, 157, 156, 155, 154, 153, 152, 151, + 150, 149, 148, 147, 146, 145, 144, 143, 142, 141, 140, 139, 138, 137, 136, + 135, 134, 133, 132, 131, 130, 129, 128, 127, 126, 125, 124, 123, 122, 121, + 120, 119, 118, 117, 116, 115, 114, 113, 112, 111, 110, 109, 108, 107, 106, + 105, 104, 103, 102, 101, 100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, + 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, + 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, + 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, + 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, + 9, 8, 7, 6, 5, 4, 3, 2, 1, 0}; + static void pm_check(const struct device *dev, const struct device *second_dev, bool exp_on, int line) { @@ -128,6 +147,8 @@ enum test_rx_mode { RX_ALL, }; +typedef bool (*test_on_rx_rdy_t)(const struct device *dev, uint8_t *buf, size_t len); + struct test_rx_data { uint8_t hdr[1]; uint8_t buf[256]; @@ -140,6 +161,7 @@ struct test_rx_data { struct k_sem sem; uint32_t timeout; uint32_t buf_idx; + test_on_rx_rdy_t on_rx_rdy; }; static struct test_tx_data tx_data; @@ -277,75 +299,86 @@ static void on_tx_done(const struct device *dev, struct uart_event *evt) try_tx(dev, true); } -static void on_rx_rdy(const struct device *dev, struct uart_event *evt) +static bool on_rx_rdy_rx_all(const struct device *dev, uint8_t *buf, size_t len) { - uint32_t len = evt->data.rx.len; - uint32_t off = evt->data.rx.offset; - int err; + bool ok; - if (!rx_data.cont) { - return; + if (rx_data.payload_idx == 0) { + rx_data.payload_idx = buf[0] - 1; + buf++; + len--; } - rx_data.rx_cnt += evt->data.rx.len; - if (evt->data.rx.buf == rx_data.hdr) { - if (rx_data.hdr[0] == 1) { - /* single byte packet. */ - err = uart_rx_buf_rsp(dev, rx_data.hdr, 1); - zassert_equal(err, 0); - return; + ok = memcmp(buf, &test_buf[256 - rx_data.payload_idx], len) == 0; + rx_data.payload_idx -= len; + + return ok; +} + +static bool on_rx_rdy_hdr(const struct device *dev, uint8_t *buf, size_t len); + +static bool on_rx_rdy_payload(const struct device *dev, uint8_t *buf, size_t len) +{ + bool ok; + int err; + + ok = memcmp(buf, &test_buf[255 - rx_data.payload_idx], len) == 0; + if (!ok) { + for (int i = 0; i < len; i++) { + if (buf[i] != test_buf[255 - rx_data.payload_idx + i]) { + zassert_true(false, "Byte %d expected: %02x got: %02x", + i, buf[i], test_buf[255 - rx_data.payload_idx + i]); + } } + rx_data.cont = false; + tx_data.cont = false; + zassert_true(ok); + return false; + } - zassert_equal(rx_data.payload_idx, 0); - rx_data.state = RX_PAYLOAD; - rx_data.payload_idx = rx_data.hdr[0] - 1; - if ((rx_data.mode == RX_CONT) && rx_data.buf_req) { - size_t l = rx_data.hdr[0] - 1; + rx_data.payload_idx -= len; - zassert_true(l > 0); + if (rx_data.payload_idx == 0) { + rx_data.state = RX_HDR; + rx_data.on_rx_rdy = on_rx_rdy_hdr; + if ((rx_data.mode == RX_CONT) && rx_data.buf_req) { rx_data.buf_req = false; - err = uart_rx_buf_rsp(dev, rx_data.buf, rx_data.hdr[0] - 1); + err = uart_rx_buf_rsp(dev, rx_data.hdr, 1); + zassert_equal(err, 0); } - } else { - for (int i = 0; i < len; i++) { - bool ok; + } - if ((rx_data.mode == RX_ALL) && (rx_data.payload_idx == 0)) { - rx_data.payload_idx = evt->data.rx.buf[off + i]; - ok = true; - } else { - ok = evt->data.rx.buf[off + i] == (uint8_t)rx_data.payload_idx; - } + return true; +} - if (!ok) { - LOG_ERR("Unexpected data at %d, exp:%02x got:%02x", - i, rx_data.payload_idx, evt->data.rx.buf[off + i]); - } +static bool on_rx_rdy_hdr(const struct device *dev, uint8_t *buf, size_t len) +{ + int err; - zassert_true(ok, "Unexpected data at %d, exp:%02x got:%02x", - i, len - i, evt->data.rx.buf[off + i]); - if (!ok) { - rx_data.cont = false; - tx_data.cont = false; - /* Avoid flood of errors as we are in the interrupt and ztest - * cannot abort from here. - */ - return; - } - rx_data.payload_idx--; - if (rx_data.payload_idx == 0) { - if (rx_data.mode != RX_ALL) { - zassert_equal(i + 1, len, "len:%d i:%d", len, i); - } - rx_data.state = RX_HDR; - if ((rx_data.mode == RX_CONT) && rx_data.buf_req) { - rx_data.buf_req = false; - err = uart_rx_buf_rsp(dev, rx_data.hdr, 1); - zassert_equal(err, 0); - } - } + zassert_equal(buf, rx_data.hdr); + zassert_equal(len, 1); + if (rx_data.hdr[0] == 1) { + /* single byte packet. */ + if ((rx_data.mode == RX_CONT) && rx_data.buf_req) { + err = uart_rx_buf_rsp(dev, rx_data.hdr, 1); + zassert_equal(err, 0); } + return true; } + + zassert_equal(rx_data.payload_idx, 0); + rx_data.on_rx_rdy = on_rx_rdy_payload; + rx_data.payload_idx = rx_data.hdr[0] - 1; + rx_data.state = RX_PAYLOAD; + if ((rx_data.mode == RX_CONT) && rx_data.buf_req) { + size_t l = rx_data.hdr[0] - 1; + + zassert_true(l > 0); + rx_data.buf_req = false; + err = uart_rx_buf_rsp(dev, rx_data.buf, buf[0] - 1); + } + + return true; } static void on_rx_buf_req(const struct device *dev) @@ -385,7 +418,6 @@ static void on_rx_dis(const struct device *dev, struct uart_event *evt, void *us return; } - zassert_true(len > 0); err = uart_rx_enable(dev, buf, len, data->timeout); zassert_equal(err, 0, "Unexpected err:%d", err); @@ -417,7 +449,11 @@ static void uart_callback(const struct device *dev, struct uart_event *evt, void break; case UART_RX_RDY: zassert_true(dev == rx_dev); - on_rx_rdy(dev, evt); + if (rx_data.cont) { + rx_data.on_rx_rdy(dev, &evt->data.rx.buf[evt->data.rx.offset], + evt->data.rx.len); + rx_data.rx_cnt += evt->data.rx.len; + } break; case UART_RX_BUF_RELEASED: zassert_true(dev == rx_dev); @@ -516,7 +552,7 @@ static void var_packet(uint32_t baudrate, enum test_tx_mode tx_mode, tx_data.rx_timeout = rx_data.timeout; rx_data.cont = true; rx_data.rx_cnt = 0; - rx_data.state = RX_HDR; + rx_data.on_rx_rdy = rx_mode == RX_ALL ? on_rx_rdy_rx_all : on_rx_rdy_hdr; rx_data.mode = rx_mode; ring_buf_init(&tx_data.rbuf, sizeof(tx_data.buf), tx_data.buf); From f06affcb6428e2ad68131531f42be2a786235d20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Tue, 15 Jul 2025 10:13:10 +0200 Subject: [PATCH 1594/2141] [nrf fromlist] drivers: serial: nrfx_uarte: Prepare code for extension MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rearrange code to prepare for upcoming extension that adds special receive mode. Upstream PR #: 92767 Signed-off-by: Krzysztof Chruściński (cherry picked from commit d3fb28f406efd0b218b85a5e749be9a95992260b) --- drivers/serial/uart_nrfx_uarte.c | 133 +++++++++++++++++-------------- 1 file changed, 72 insertions(+), 61 deletions(-) diff --git a/drivers/serial/uart_nrfx_uarte.c b/drivers/serial/uart_nrfx_uarte.c index a5436eb0ec62..5196b21a082b 100644 --- a/drivers/serial/uart_nrfx_uarte.c +++ b/drivers/serial/uart_nrfx_uarte.c @@ -870,6 +870,78 @@ static void tx_start(const struct device *dev, const uint8_t *buf, size_t len) static void rx_timeout(struct k_timer *timer); static void tx_timeout(struct k_timer *timer); +static void user_callback(const struct device *dev, struct uart_event *evt) +{ + struct uarte_nrfx_data *data = dev->data; + + if (data->async->user_callback) { + data->async->user_callback(dev, evt, data->async->user_data); + } +} + +static void rx_buf_release(const struct device *dev, uint8_t *buf) +{ + struct uart_event evt = { + .type = UART_RX_BUF_RELEASED, + .data.rx_buf.buf = buf, + }; + + user_callback(dev, &evt); +} + +static void notify_rx_disable(const struct device *dev) +{ + const struct uarte_nrfx_config *cfg = dev->config; + struct uart_event evt = { + .type = UART_RX_DISABLED, + }; + + if (LOW_POWER_ENABLED(cfg)) { + uint32_t key = irq_lock(); + + uarte_disable_locked(dev, UARTE_FLAG_LOW_POWER_RX); + irq_unlock(key); + } + + user_callback(dev, (struct uart_event *)&evt); + + /* runtime PM is put after the callback. In case uart is re-enabled from that + * callback we avoid suspending/resuming the device. + */ + if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { + pm_device_runtime_put_async(dev, K_NO_WAIT); + } +} + +static int uarte_nrfx_rx_disable(const struct device *dev) +{ + struct uarte_nrfx_data *data = dev->data; + struct uarte_async_rx *async_rx = &data->async->rx; + NRF_UARTE_Type *uarte = get_uarte_instance(dev); + int key; + + if (async_rx->buf == NULL) { + return -EFAULT; + } + + k_timer_stop(&async_rx->timer); + + key = irq_lock(); + + if (async_rx->next_buf != NULL) { + nrf_uarte_shorts_disable(uarte, NRF_UARTE_SHORT_ENDRX_STARTRX); + nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_RXSTARTED); + } + + async_rx->enabled = false; + async_rx->discard_fifo = true; + + nrf_uarte_task_trigger(uarte, NRF_UARTE_TASK_STOPRX); + irq_unlock(key); + + return 0; +} + #if !defined(CONFIG_UART_NRFX_UARTE_ENHANCED_RX) static void timer_handler(nrf_timer_event_t event_type, void *p_context) { } @@ -1068,15 +1140,6 @@ static int uarte_nrfx_tx_abort(const struct device *dev) return 0; } -static void user_callback(const struct device *dev, struct uart_event *evt) -{ - struct uarte_nrfx_data *data = dev->data; - - if (data->async->user_callback) { - data->async->user_callback(dev, evt, data->async->user_data); - } -} - static void notify_uart_rx_rdy(const struct device *dev, size_t len) { struct uarte_nrfx_data *data = dev->data; @@ -1090,29 +1153,6 @@ static void notify_uart_rx_rdy(const struct device *dev, size_t len) user_callback(dev, &evt); } -static void rx_buf_release(const struct device *dev, uint8_t *buf) -{ - struct uart_event evt = { - .type = UART_RX_BUF_RELEASED, - .data.rx_buf.buf = buf, - }; - - user_callback(dev, &evt); -} - -static void notify_rx_disable(const struct device *dev) -{ - struct uart_event evt = { - .type = UART_RX_DISABLED, - }; - - user_callback(dev, (struct uart_event *)&evt); - - if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_put_async(dev, K_NO_WAIT); - } -} - #ifdef UARTE_HAS_FRAME_TIMEOUT static uint32_t us_to_bauds(uint32_t baudrate, int32_t timeout) { @@ -1339,35 +1379,6 @@ static int uarte_nrfx_callback_set(const struct device *dev, return 0; } -static int uarte_nrfx_rx_disable(const struct device *dev) -{ - struct uarte_nrfx_data *data = dev->data; - struct uarte_async_rx *async_rx = &data->async->rx; - NRF_UARTE_Type *uarte = get_uarte_instance(dev); - int key; - - if (async_rx->buf == NULL) { - return -EFAULT; - } - - k_timer_stop(&async_rx->timer); - - key = irq_lock(); - - if (async_rx->next_buf != NULL) { - nrf_uarte_shorts_disable(uarte, NRF_UARTE_SHORT_ENDRX_STARTRX); - nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_RXSTARTED); - } - - async_rx->enabled = false; - async_rx->discard_fifo = true; - - nrf_uarte_task_trigger(uarte, NRF_UARTE_TASK_STOPRX); - irq_unlock(key); - - return 0; -} - static void tx_timeout(struct k_timer *timer) { const struct device *dev = k_timer_user_data_get(timer); From 0ac3e720c4ba47d198b329997e4930dcd33e47e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Mon, 30 Jun 2025 07:48:03 +0200 Subject: [PATCH 1595/2141] [nrf fromlist] drivers: serial: nrfx_uarte: Add mode with TIMER byte counting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add mode to be used on UARTE with frame timeout which is using a bounce buffers and TIMER to count bytes. This mode shall be used to reliably receive data without HWFC as frame timeout approach is not 100% reliable because it can loose or corrupt a byte when new byte arrives after frame timeout is detected but before it is fully handled. This mode is similar to the one enabled with CONFIG_UART_x_NRF_HW_ASYNC but additional bounce buffers are used and UARTE is receiving data to internal buffers and copies data to the user buffer. Legacy apporach cannot be used because in new SoC DMA attempts to copy data in words so when byte is received it stays in the DMA internal buffer until 4 bytes are received or end of transfer happens then internal DMA buffer is flushed. Upstream PR #: 92767 Signed-off-by: Krzysztof Chruściński (cherry picked from commit a07f73b6ff7eb85041a2f643b54840fa22c6a193) (cherry picked from commit 2b7fae8f92faf11993a2fbaee758c56f48bbd060) --- drivers/serial/Kconfig.nrfx | 26 + drivers/serial/Kconfig.nrfx_uart_instance | 7 + drivers/serial/uart_nrfx_uarte.c | 1026 +++++++++++++++++++-- 3 files changed, 971 insertions(+), 88 deletions(-) diff --git a/drivers/serial/Kconfig.nrfx b/drivers/serial/Kconfig.nrfx index 647e8cbb2e6f..a39f882f644a 100644 --- a/drivers/serial/Kconfig.nrfx +++ b/drivers/serial/Kconfig.nrfx @@ -79,6 +79,32 @@ config UART_ASYNC_TX_CACHE_SIZE in RAM, because EasyDMA in UARTE peripherals can only transfer data from RAM. +config UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER + bool "Use TIMER to count RX bytes" + depends on UART_ASYNC_API + depends on UART_NRFX_UARTE_LEGACY_SHIM + depends on !ARCH_POSIX # Mode not supported on BSIM target + select NRFX_GPPI + +config UART_NRFX_UARTE_BOUNCE_BUF_LEN + int "RX bounce buffer size" + depends on UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER + default 256 + range 64 1024 + help + Buffer is used when workaround with bounce buffers is applied + +config UART_NRFX_UARTE_BOUNCE_BUF_SWAP_LATENCY + int "RX bounce buffer swap latency (in microseconds)" + depends on UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER + default 300 + help + Option decides how long before current bounce buffer is filled driver + attempts to swap the buffer. It must be long enough to ensure that + space following the buffer is not overwritten. Too high value results + in more frequent buffer swaps so it impacts performance. Setting should + take into account potential interrupt handling latency. + config UART_NRFX_UARTE_DIRECT_ISR bool "Use direct ISR" diff --git a/drivers/serial/Kconfig.nrfx_uart_instance b/drivers/serial/Kconfig.nrfx_uart_instance index b1a68d691c45..82ffaa10fcb9 100644 --- a/drivers/serial/Kconfig.nrfx_uart_instance +++ b/drivers/serial/Kconfig.nrfx_uart_instance @@ -18,6 +18,13 @@ config UART_$(nrfx_uart_num)_ASYNC help This option enables UART Asynchronous API support on port $(nrfx_uart_num). +config UART_$(nrfx_uart_num)_COUNT_BYTES_WITH_TIMER + bool + depends on $(dt_nodelabel_has_prop,uart$(nrfx_uart_num),timer) + depends on HAS_HW_NRF_UARTE$(nrfx_uart_num) + default y + imply UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER + config UART_$(nrfx_uart_num)_ENHANCED_POLL_OUT bool "Efficient poll out on port $(nrfx_uart_num)" depends on !$(dt_nodelabel_bool_prop,uart$(nrfx_uart_num),endtx-stoptx-supported) diff --git a/drivers/serial/uart_nrfx_uarte.c b/drivers/serial/uart_nrfx_uarte.c index 5196b21a082b..00489e7d8856 100644 --- a/drivers/serial/uart_nrfx_uarte.c +++ b/drivers/serial/uart_nrfx_uarte.c @@ -188,6 +188,16 @@ LOG_MODULE_REGISTER(uart_nrfx_uarte, CONFIG_UART_LOG_LEVEL); /* Size of hardware fifo in RX path. */ #define UARTE_HW_RX_FIFO_SIZE 5 +/* TIMER CC channels for counting bytes with TIMER. */ +/* Channel used for capturing current counter value. */ +#define UARTE_TIMER_CAPTURE_CH 0 +/* Channel used to get compare event when number of received bytes reaches user buffer size. */ +#define UARTE_TIMER_USR_CNT_CH 1 +/* Channel used to get compare event when bounce buffer need to be switched. */ +#define UARTE_TIMER_BUF_SWITCH_CH 2 +/* Magic byte that is used to fill the buffer. */ +#define UARTE_MAGIC_BYTE 0xAA + #ifdef UARTE_ANY_ASYNC struct uarte_async_tx { @@ -201,6 +211,30 @@ struct uarte_async_tx { bool pending; }; +/* Structure with data for Count Bytes With Timer receiver mode (cbwt). */ +struct uarte_async_rx_cbwt { + uint8_t *curr_bounce_buf; + uint8_t *anomaly_byte_addr; + uint32_t usr_rd_off; + uint32_t usr_wr_off; + uint32_t bounce_off; + uint32_t bounce_limit; + uint32_t last_cnt; + uint32_t cc_usr; + uint32_t cc_swap; +#ifdef CONFIG_UART_USE_RUNTIME_CONFIGURE + size_t bounce_buf_swap_len; +#endif +#ifdef UARTE_ANY_CACHE + uint8_t *anomaly_byte_dst; + uint8_t anomaly_byte; +#endif + uint8_t bounce_idx; + uint8_t ppi_ch; + bool in_irq; + bool discard_fifo; +}; + struct uarte_async_rx { struct k_timer timer; #ifdef CONFIG_HAS_NORDIC_DMM @@ -212,8 +246,9 @@ struct uarte_async_rx { size_t offset; uint8_t *next_buf; size_t next_buf_len; -#ifdef CONFIG_UART_NRFX_UARTE_ENHANCED_RX -#if !defined(UARTE_HAS_FRAME_TIMEOUT) +#if defined(CONFIG_UART_NRFX_UARTE_ENHANCED_RX) || \ + defined(CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER) +#if !defined(UARTE_HAS_FRAME_TIMEOUT) || defined(CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER) uint32_t idle_cnt; #endif k_timeout_t timeout; @@ -286,6 +321,10 @@ struct uarte_nrfx_data { #define UARTE_FLAG_POLL_OUT BIT(3) /* Flag indicating that a workaround for not working frame timeout is active. */ #define UARTE_FLAG_FTIMEOUT_WATCH BIT(4) +/* Flag indicating that UART_RX_BUF_REQUEST event need to be called from the interrupt context. */ +#define UARTE_FLAG_RX_BUF_REQ BIT(5) +/* Flag indicating that CC value in TIMER was set too late. */ +#define UARTE_FLAG_LATE_CC BIT(6) /* If enabled then ENDTX is PPI'ed to TXSTOP */ #define UARTE_CFG_FLAG_PPI_ENDTX BIT(0) @@ -304,6 +343,12 @@ struct uarte_nrfx_data { /* Indicates that workaround for spurious RXTO during restart shall be applied. */ #define UARTE_CFG_FLAG_SPURIOUS_RXTO BIT(3) +/* Indicates that UARTE/TIMER interrupt priority differs from system clock (GRTC/RTC). */ +#define UARTE_CFG_FLAG_VAR_IRQ BIT(4) + +/* Indicates that instance needs special handling of BAUDRATE register. */ +#define UARTE_CFG_FLAG_VOLATILE_BAUDRATE BIT(5) + /* Formula for getting the baudrate settings is following: * 2^12 * (2^20 / (f_PCLK / desired_baudrate)) where f_PCLK is a frequency that * drives the UARTE. @@ -340,6 +385,14 @@ struct uarte_nrfx_data { (baudrate) == 921600 ? NRF_UARTE_BAUDRATE_921600 : \ (baudrate) == 1000000 ? NRF_UARTE_BAUDRATE_1000000 : 0) +#define UARTE_MIN_BUF_SWAP_LEN 10 + +#define UARTE_US_TO_BYTES(baudrate) \ + DIV_ROUND_UP((CONFIG_UART_NRFX_UARTE_BOUNCE_BUF_SWAP_LATENCY * baudrate), 10000000) + +#define UARTE_BUF_SWAP_LEN(bounce_buf_len, baudrate) \ + ((bounce_buf_len) - MAX(UARTE_MIN_BUF_SWAP_LEN, UARTE_US_TO_BYTES(baudrate))) + #define LOW_POWER_ENABLED(_config) \ (IS_ENABLED(UARTE_ANY_LOW_POWER) && \ !IS_ENABLED(CONFIG_PM_DEVICE) && \ @@ -386,6 +439,15 @@ struct uarte_nrfx_config { #endif /* CONFIG_UART_USE_RUNTIME_CONFIGURE */ #ifdef UARTE_ANY_ASYNC +#ifdef CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER + NRF_TIMER_Type * timer_regs; + IRQn_Type timer_irqn; + IRQn_Type uarte_irqn; + uint8_t *bounce_buf[2]; + size_t bounce_buf_len; + size_t bounce_buf_swap_len; + struct uarte_async_rx_cbwt *cbwt_data; +#endif nrfx_timer_t timer; uint8_t *tx_cache; uint8_t *rx_flush_buf; @@ -405,6 +467,12 @@ struct uarte_nrfx_config { (IS_ENABLED(UARTE_ANY_HW_ASYNC) ? \ (config->flags & UARTE_CFG_FLAG_HW_BYTE_COUNTING) : false) +/* Determine if instance is using an approach with counting bytes with TIMER (cbwt). */ +#define IS_CBWT(dev) \ + COND_CODE_1(CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER, \ + ((((const struct uarte_nrfx_config *)dev->config)->cbwt_data != NULL)), \ + (false)) + static inline NRF_UARTE_Type *get_uarte_instance(const struct device *dev) { const struct uarte_nrfx_config *config = dev->config; @@ -596,10 +664,23 @@ static int baudrate_set(const struct device *dev, uint32_t baudrate) return -EINVAL; } +#ifdef CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER + if (IS_CBWT(dev)) { + struct uarte_async_rx_cbwt *cbwt_data = config->cbwt_data; + + cbwt_data->bounce_buf_swap_len = UARTE_BUF_SWAP_LEN(config->bounce_buf_len, + baudrate); + } +#endif + #ifdef UARTE_BAUDRATE_RETENTION_WORKAROUND - struct uarte_nrfx_data *data = dev->data; + if (config->flags & UARTE_CFG_FLAG_VOLATILE_BAUDRATE) { + struct uarte_nrfx_data *data = dev->data; - data->nrf_baudrate = nrf_baudrate; + data->nrf_baudrate = nrf_baudrate; + } else { + nrf_uarte_baudrate_set(get_uarte_instance(dev), nrf_baudrate); + } #else nrf_uarte_baudrate_set(get_uarte_instance(dev), nrf_baudrate); #endif @@ -787,9 +868,11 @@ static void uarte_periph_enable(const struct device *dev) #endif #if UARTE_BAUDRATE_RETENTION_WORKAROUND - nrf_uarte_baudrate_set(uarte, - COND_CODE_1(CONFIG_UART_USE_RUNTIME_CONFIGURE, - (data->nrf_baudrate), (config->nrf_baudrate))); + if (config->flags & UARTE_CFG_FLAG_VOLATILE_BAUDRATE) { + nrf_uarte_baudrate_set(uarte, + COND_CODE_1(CONFIG_UART_USE_RUNTIME_CONFIGURE, + (data->nrf_baudrate), (config->nrf_baudrate))); + } #endif #ifdef UARTE_ANY_ASYNC @@ -889,13 +972,17 @@ static void rx_buf_release(const struct device *dev, uint8_t *buf) user_callback(dev, &evt); } -static void notify_rx_disable(const struct device *dev) +static void rx_disable_finalize(const struct device *dev) { const struct uarte_nrfx_config *cfg = dev->config; + struct uarte_nrfx_data *data = dev->data; + struct uarte_async_rx *async_rx = &data->async->rx; struct uart_event evt = { .type = UART_RX_DISABLED, }; + async_rx->enabled = false; + if (LOW_POWER_ENABLED(cfg)) { uint32_t key = irq_lock(); @@ -913,28 +1000,42 @@ static void notify_rx_disable(const struct device *dev) } } -static int uarte_nrfx_rx_disable(const struct device *dev) +static int rx_disable(const struct device *dev, bool api) { struct uarte_nrfx_data *data = dev->data; struct uarte_async_rx *async_rx = &data->async->rx; NRF_UARTE_Type *uarte = get_uarte_instance(dev); int key; - if (async_rx->buf == NULL) { - return -EFAULT; - } - k_timer_stop(&async_rx->timer); key = irq_lock(); +#ifdef CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER + const struct uarte_nrfx_config *cfg = dev->config; + struct uarte_async_rx_cbwt *cbwt_data = cfg->cbwt_data; + + if (cbwt_data) { + nrf_timer_event_clear(cfg->timer_regs, + nrf_timer_compare_event_get(UARTE_TIMER_BUF_SWITCH_CH)); + nrf_timer_event_clear(cfg->timer_regs, + nrf_timer_compare_event_get(UARTE_TIMER_USR_CNT_CH)); + nrf_timer_int_disable(cfg->timer_regs, + nrf_timer_compare_int_get(UARTE_TIMER_BUF_SWITCH_CH) | + nrf_timer_compare_int_get(UARTE_TIMER_USR_CNT_CH)); + nrf_uarte_shorts_disable(cfg->uarte_regs, NRF_UARTE_SHORT_ENDRX_STARTRX); + } +#endif + if (async_rx->next_buf != NULL) { nrf_uarte_shorts_disable(uarte, NRF_UARTE_SHORT_ENDRX_STARTRX); nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_RXSTARTED); } async_rx->enabled = false; - async_rx->discard_fifo = true; + if (api) { + async_rx->discard_fifo = true; + } nrf_uarte_task_trigger(uarte, NRF_UARTE_TASK_STOPRX); irq_unlock(key); @@ -942,6 +1043,18 @@ static int uarte_nrfx_rx_disable(const struct device *dev) return 0; } +static int uarte_nrfx_rx_disable(const struct device *dev) +{ + struct uarte_nrfx_data *data = dev->data; + struct uarte_async_rx *async_rx = &data->async->rx; + + if (async_rx->buf == NULL) { + return -EFAULT; + } + + return rx_disable(dev, true); +} + #if !defined(CONFIG_UART_NRFX_UARTE_ENHANCED_RX) static void timer_handler(nrf_timer_event_t event_type, void *p_context) { } @@ -966,10 +1079,10 @@ static int uarte_nrfx_rx_counting_init(const struct device *dev) if (ret != NRFX_SUCCESS) { LOG_ERR("Timer already initialized"); return -EINVAL; - } else { - nrfx_timer_clear(&cfg->timer); } + nrfx_timer_clear(&cfg->timer); + ret = nrfx_gppi_channel_alloc(&data->async->rx.cnt.ppi); if (ret != NRFX_SUCCESS) { LOG_ERR("Failed to allocate PPI Channel"); @@ -987,6 +1100,653 @@ static int uarte_nrfx_rx_counting_init(const struct device *dev) } #endif /* !defined(CONFIG_UART_NRFX_UARTE_ENHANCED_RX) */ +#ifdef CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER + +static uint32_t get_byte_cnt(NRF_TIMER_Type *timer) +{ + nrf_timer_task_trigger(timer, nrf_timer_capture_task_get(UARTE_TIMER_CAPTURE_CH)); + + nrf_barrier_w(); + + return nrf_timer_cc_get(timer, UARTE_TIMER_CAPTURE_CH); +} + +static void rx_buf_req(const struct device *dev) +{ + struct uart_event evt = { + .type = UART_RX_BUF_REQUEST, + }; + + user_callback(dev, &evt); +} + +static bool notify_rx_rdy(const struct device *dev) +{ + const struct uarte_nrfx_config *cfg = dev->config; + struct uarte_nrfx_data *data = dev->data; + struct uarte_async_rx *async_rx = &data->async->rx; + struct uarte_async_rx_cbwt *cbwt_data = cfg->cbwt_data; + size_t len = cbwt_data->usr_wr_off - cbwt_data->usr_rd_off; + + if (len == 0) { + return async_rx->buf != NULL; + } + + struct uart_event evt = { + .type = UART_RX_RDY, + .data.rx.buf = async_rx->buf, + .data.rx.len = len, + .data.rx.offset = cbwt_data->usr_rd_off + }; + user_callback(dev, &evt); + cbwt_data->usr_rd_off += len; + + if (cbwt_data->usr_rd_off == async_rx->buf_len) { + rx_buf_release(dev, async_rx->buf); + async_rx->buf = async_rx->next_buf; + async_rx->buf_len = async_rx->next_buf_len; + async_rx->next_buf_len = 0; + async_rx->next_buf = 0; + cbwt_data->usr_rd_off = 0; + cbwt_data->usr_wr_off = 0; + + if (async_rx->buf_len == 0) { + return false; + } + + /* Set past value to ensure that event will not expire after clearing but + * before setting the new value. + */ + nrf_timer_cc_set(cfg->timer_regs, UARTE_TIMER_USR_CNT_CH, cbwt_data->cc_usr - 1); + nrf_timer_event_clear(cfg->timer_regs, + nrf_timer_compare_event_get(UARTE_TIMER_USR_CNT_CH)); + cbwt_data->cc_usr += async_rx->buf_len; + nrf_timer_cc_set(cfg->timer_regs, UARTE_TIMER_USR_CNT_CH, cbwt_data->cc_usr); + + /* Check if CC is already in the past. In that case trigger CC handling.*/ + if (cbwt_data->cc_usr <= get_byte_cnt(cfg->timer_regs)) { + atomic_or(&data->flags, UARTE_FLAG_LATE_CC); + NRFX_IRQ_PENDING_SET(cfg->timer_irqn); + } else { + atomic_and(&data->flags, ~UARTE_FLAG_LATE_CC); + } + } + + return true; +} + +static void anomaly_byte_handle(const struct device *dev) +{ + const struct uarte_nrfx_config *cfg = dev->config; + struct uarte_async_rx_cbwt *cbwt_data = cfg->cbwt_data; + uint8_t curr_byte, anomaly_byte; + uint32_t diff; + + if (cbwt_data->anomaly_byte_addr == NULL) { + return; + } + + diff = cfg->uarte_regs->DMA.RX.PTR - (uint32_t)cbwt_data->curr_bounce_buf; + /* Anomaly can be checked only if more than 1 byte is received to the current buffer. */ + if (diff < 2) { + return; + } + + if (IS_ENABLED(UARTE_ANY_CACHE) && (cfg->flags & UARTE_CFG_FLAG_CACHEABLE)) { + sys_cache_data_invd_range(cbwt_data->curr_bounce_buf, 1); + sys_cache_data_invd_range(cbwt_data->anomaly_byte_addr, 1); + } + + curr_byte = cbwt_data->curr_bounce_buf[0]; + anomaly_byte = *cbwt_data->anomaly_byte_addr; + if ((curr_byte == UARTE_MAGIC_BYTE) && (anomaly_byte != UARTE_MAGIC_BYTE)) { +#ifdef UARTE_ANY_CACHE + if (cfg->flags & UARTE_CFG_FLAG_CACHEABLE) { + /* We cannot write directly to curr_bounce_buf as it is written by + * DMA and with cache operations data may be overwritten. Copying + * need to be postponed to the moment when user buffer is filled. + */ + cbwt_data->anomaly_byte = anomaly_byte; + cbwt_data->anomaly_byte_dst = &cbwt_data->curr_bounce_buf[0]; + } else { + cbwt_data->curr_bounce_buf[0] = anomaly_byte; + } +#else + cbwt_data->curr_bounce_buf[0] = anomaly_byte; +#endif + } + + cbwt_data->anomaly_byte_addr = NULL; +} + +static uint32_t fill_usr_buf(const struct device *dev, uint32_t len) +{ + const struct uarte_nrfx_config *cfg = dev->config; + struct uarte_nrfx_data *data = dev->data; + struct uarte_async_rx *async_rx = &data->async->rx; + struct uarte_async_rx_cbwt *cbwt_data = cfg->cbwt_data; + + uint8_t *buf = cfg->bounce_buf[cbwt_data->bounce_idx]; + uint32_t usr_rem = async_rx->buf_len - cbwt_data->usr_wr_off; + uint32_t bounce_rem = cbwt_data->bounce_limit - cbwt_data->bounce_off; + uint32_t cpy_len = MIN(bounce_rem, MIN(usr_rem, len)); + + __ASSERT(cpy_len + cbwt_data->bounce_off <= cfg->bounce_buf_len, + "Exceeding the buffer cpy_len:%d off:%d limit:%d", + cpy_len, cbwt_data->bounce_off, cbwt_data->bounce_limit); + + if (IS_ENABLED(UARTE_ANY_CACHE) && (cfg->flags & UARTE_CFG_FLAG_CACHEABLE)) { + sys_cache_data_invd_range(&buf[cbwt_data->bounce_off], cpy_len); + } + + memcpy(&async_rx->buf[cbwt_data->usr_wr_off], &buf[cbwt_data->bounce_off], cpy_len); +#ifdef UARTE_ANY_CACHE + if ((buf == cbwt_data->anomaly_byte_dst) && (cbwt_data->bounce_off == 0)) { + async_rx->buf[cbwt_data->usr_wr_off] = cbwt_data->anomaly_byte; + cbwt_data->anomaly_byte_dst = NULL; + } +#endif + cbwt_data->bounce_off += cpy_len; + cbwt_data->usr_wr_off += cpy_len; + cbwt_data->last_cnt += cpy_len; + if (cbwt_data->bounce_off == cbwt_data->bounce_limit) { + /* Bounce buffer drained */ + cbwt_data->bounce_idx = cbwt_data->bounce_idx == 0 ? 1 : 0; + cbwt_data->bounce_off = 0; + cbwt_data->bounce_limit = cfg->bounce_buf_len; + } + + return cpy_len; +} + +static bool update_usr_buf(const struct device *dev, uint32_t len, bool notify_any, bool buf_req) +{ + const struct uarte_nrfx_config *cfg = dev->config; + struct uarte_nrfx_data *data = dev->data; + struct uarte_async_rx *async_rx = &data->async->rx; + struct uarte_async_rx_cbwt *cbwt_data = cfg->cbwt_data; + + anomaly_byte_handle(dev); + + do { + uint32_t cpy_len = len ? fill_usr_buf(dev, len) : 0; + bool usr_buf_full = cbwt_data->usr_wr_off == async_rx->buf_len; + + len -= cpy_len; + if (((len == 0) && notify_any) || usr_buf_full) { + if (!notify_rx_rdy(dev)) { + return false; + } + + if (usr_buf_full && buf_req) { + rx_buf_req(dev); + } + } + } while (len > 0); + + return true; +} + +static void prepare_bounce_buf(const struct device *dev, uint8_t *buf, + size_t swap_len, size_t len) +{ + const struct uarte_nrfx_config *cfg = dev->config; + + buf[0] = UARTE_MAGIC_BYTE; + for (size_t i = swap_len; i < len; i++) { + buf[i] = UARTE_MAGIC_BYTE; + } + + if (IS_ENABLED(UARTE_ANY_CACHE) && (cfg->flags & UARTE_CFG_FLAG_CACHEABLE)) { + sys_cache_data_flush_range(buf, 1); + sys_cache_data_flush_range(&buf[swap_len], len); + } +} + +/* This function is responsible for swapping the bounce buffer and it is the most + * tricky part of the solution. Receiver is continuously working and we want to + * change DMA pointer on the fly. DMA is also incrementing that pointer so there are + * moments in the reception when updating the pointer will result in different behavior. + * + * There are two main cases that need to be handled: + * 1. PTR is updated and there was no byte boundary (in the middle of a byte or there is + * no byte on the line). It is a safe spot. + * + * The most common and simplest case. PTR is update but since + * DMA already started the reception of the previous byte it means that next byte will + * be stored in the previous PTR and bytes following that byte will be stored to the + * new bounce buffer + * + * 2. Updating the pointer collided with byte boundary. + * + * RXDRDY and RXSTARTED events are used to detect if collision occurred. + * There are few scenarios that may happen and the driver must detect which one occurred. + * Detection is done by reading back the PTR register. Following cases are considered: + * + * - PTR did not change. It means that it was written after byte boundary. It is the same + * case as if PTR was updated in the safe spot. + * + * - PTR is updated by 1. There is an anomaly and it is unclear where next byte will be + * copied. PTR state indicates that it should be copied to the beginning of the new + * bounce buffer but it might be copied to the previous bounce buffer. Both locations + * are written with a magic byte (0xAA) and later on it is checked which location has + * changed and if byte was written to the previous bounce buffer it is copied to the + * start of the new bounce buffer. + * + * - PTR is not updated with the new bounce buffer location. DMA is incrementing PTR content + * and it is possible that SW writes new value between read and modify and DMA may + * overwrite value written by the driver. In that case reception continuous to the + * previous bounce buffer and swap procedure need to be repeated. + */ +static int bounce_buf_swap(const struct device *dev, uint8_t *prev_bounce_buf) +{ + const struct uarte_nrfx_config *cfg = dev->config; + struct uarte_async_rx_cbwt *cbwt_data = cfg->cbwt_data; + uint32_t prev_buf_cnt, new_cnt, cnt, ptr; + uint32_t prev_buf_inc = 1; + int key; + + key = irq_lock(); + /* Clear events that indicates byte boundary and set PTR. If events are set + * after PTR is set then we know that setting PTR collided with byte boundary. + */ + nrf_uarte_event_clear(cfg->uarte_regs, NRF_UARTE_EVENT_RXSTARTED); + nrf_uarte_event_clear(cfg->uarte_regs, NRF_UARTE_EVENT_RXDRDY); + cfg->uarte_regs->DMA.RX.PTR = (uint32_t)cbwt_data->curr_bounce_buf; + cnt = get_byte_cnt(cfg->timer_regs); + + if (!nrf_uarte_event_check(cfg->uarte_regs, NRF_UARTE_EVENT_RXDRDY) && + !nrf_uarte_event_check(cfg->uarte_regs, NRF_UARTE_EVENT_RXSTARTED)) { + /* RXDRDY did not happen when PTR was set. Safest case. PTR was updated + * correctly. Last byte will be received to the previous buffer. + */ + new_cnt = 0; + prev_buf_cnt = cnt - cbwt_data->last_cnt; + goto no_collision; + } + + /* Setting PTR collided with byte boundary we need to detect what happened. */ + while (!nrf_uarte_event_check(cfg->uarte_regs, NRF_UARTE_EVENT_RXSTARTED)) { + } + + /* Read pointer when there is no new byte coming. */ + do { + cnt = get_byte_cnt(cfg->timer_regs); + ptr = cfg->uarte_regs->DMA.RX.PTR; + } while (cnt != get_byte_cnt(cfg->timer_regs)); + + new_cnt = ptr - (uint32_t)cbwt_data->curr_bounce_buf; + prev_buf_cnt = cnt - cbwt_data->last_cnt; + + if (new_cnt == 0) { + /* New PTR is not incremented. It was written after LIST post ENDRX + * incrementation. + */ + } else if (new_cnt == 1) { + /* new_cnt == 1. New PTR incremented. It's possible that data is already + * copied to that new location or it is written to the tail of the previous + * bounce buffer. We try to detect what happens. + */ + prev_buf_inc = 0; + cbwt_data->anomaly_byte_addr = + &prev_bounce_buf[cbwt_data->bounce_off + prev_buf_cnt]; + } else if (new_cnt <= cfg->bounce_buf_len) { + prev_buf_inc = 0; + prev_buf_cnt = cnt - cbwt_data->last_cnt - (new_cnt - 1); + } else { + /* New PTR value is not set. Re-set PTR is needed. Transfer continues to + * previous buffer whole buffer swapping need to be repeat. + */ + irq_unlock(key); + return -EAGAIN; + } + +no_collision: + cbwt_data->bounce_limit = cbwt_data->bounce_off + prev_buf_cnt + prev_buf_inc; + __ASSERT(cbwt_data->bounce_limit < cfg->bounce_buf_len, + "Too high limit (%d, max:%d), increase latency", + cbwt_data->bounce_limit, cfg->bounce_buf_len); + irq_unlock(key); + + return prev_buf_cnt; +} + +static size_t get_swap_len(const struct device *dev) +{ + const struct uarte_nrfx_config *cfg = dev->config; +#ifdef CONFIG_UART_USE_RUNTIME_CONFIGURE + struct uarte_async_rx_cbwt *cbwt_data = cfg->cbwt_data; + + return cbwt_data->bounce_buf_swap_len; +#else + return cfg->bounce_buf_swap_len; +#endif +} + +static void bounce_buf_switch(const struct device *dev) +{ + const struct uarte_nrfx_config *cfg = dev->config; + struct uarte_async_rx_cbwt *cbwt_data = cfg->cbwt_data; + int new_data = cbwt_data->cc_swap - cbwt_data->last_cnt; + uint8_t *prev_bounce_buf = cbwt_data->curr_bounce_buf; + int prev_cnt; + + /* Fill user buffer with all pending data. */ + if (!update_usr_buf(dev, new_data < 0 ? 0 : new_data, false, true)) { + rx_disable(dev, false); + return; + } + + cbwt_data->curr_bounce_buf = (cbwt_data->curr_bounce_buf == cfg->bounce_buf[0]) ? + cfg->bounce_buf[1] : cfg->bounce_buf[0]; + prepare_bounce_buf(dev, cbwt_data->curr_bounce_buf, get_swap_len(dev), + cfg->bounce_buf_len); + + /* Swapping may need retry. */ + while ((prev_cnt = bounce_buf_swap(dev, prev_bounce_buf)) < 0) { + } + + /* Update user buffer with data that was received during swapping. */ + if (update_usr_buf(dev, prev_cnt, false, true)) { + /* Set compare event for next moment when bounce buffers need to be swapped. */ + cbwt_data->cc_swap += get_swap_len(dev); + __ASSERT(cbwt_data->cc_swap > get_byte_cnt(cfg->timer_regs), + "Setting CC too late next:%d cnt:%d", + cbwt_data->cc_swap, get_byte_cnt(cfg->timer_regs)); + nrf_timer_cc_set(cfg->timer_regs, UARTE_TIMER_BUF_SWITCH_CH, cbwt_data->cc_swap); + } else { + /* Stop RX. */ + rx_disable(dev, false); + } +} + +static void usr_buf_complete(const struct device *dev) +{ + const struct uarte_nrfx_config *cfg = dev->config; + struct uarte_nrfx_data *data = dev->data; + struct uarte_async_rx *async_rx = &data->async->rx; + struct uarte_async_rx_cbwt *cbwt_data = cfg->cbwt_data; + uint32_t rem = async_rx->buf_len - cbwt_data->usr_wr_off; + + __ASSERT_NO_MSG(rem <= (get_byte_cnt(cfg->timer_regs) - cbwt_data->last_cnt)); + + if (!update_usr_buf(dev, rem, true, true)) { + /* Stop RX if there is no next buffer. */ + rx_disable(dev, false); + } +} + +static void notify_new_data(const struct device *dev, bool buf_req) +{ + const struct uarte_nrfx_config *cfg = dev->config; + struct uarte_async_rx_cbwt *cbwt_data = cfg->cbwt_data; + uint32_t cnt = get_byte_cnt(cfg->timer_regs); + uint32_t new_data = cnt - cbwt_data->last_cnt; + + (void)update_usr_buf(dev, new_data, true, buf_req); +} + +static void cbwt_rx_timeout(struct k_timer *timer) +{ + const struct device *dev = k_timer_user_data_get(timer); + const struct uarte_nrfx_config *cfg = dev->config; + struct uarte_nrfx_data *data = dev->data; + struct uarte_async_rx_cbwt *cbwt_data = cfg->cbwt_data; + struct uarte_async_rx *async_rx = &data->async->rx; + + if (nrf_uarte_event_check(cfg->uarte_regs, NRF_UARTE_EVENT_RXDRDY)) { + nrf_uarte_event_clear(cfg->uarte_regs, NRF_UARTE_EVENT_RXDRDY); + async_rx->idle_cnt = 0; + } else { + async_rx->idle_cnt++; + if (async_rx->idle_cnt == (RX_TIMEOUT_DIV - 1)) { + if (cfg->flags & UARTE_CFG_FLAG_VAR_IRQ) { + if (cbwt_data->in_irq) { + /* TIMER or UARTE interrupt preempted. Lets try again + * later. + */ + k_timer_start(timer, async_rx->timeout, K_NO_WAIT); + return; + } + irq_disable(cfg->uarte_irqn); + irq_disable(cfg->timer_irqn); + } + + nrf_uarte_int_enable(cfg->uarte_regs, NRF_UARTE_INT_RXDRDY_MASK); + notify_new_data(dev, true); + + if (cfg->flags & UARTE_CFG_FLAG_VAR_IRQ) { + irq_enable(cfg->uarte_irqn); + irq_enable(cfg->timer_irqn); + } + return; + } + } + + k_timer_start(timer, async_rx->timeout, K_NO_WAIT); +} + +static void cbwt_rx_flush_handle(const struct device *dev) +{ + const struct uarte_nrfx_config *cfg = dev->config; + NRF_UARTE_Type *uarte = get_uarte_instance(dev); + struct uarte_async_rx_cbwt *cbwt_data = cfg->cbwt_data; + uint32_t rem_data = get_byte_cnt(cfg->timer_regs) - cbwt_data->last_cnt; + uint32_t bbuf_rem_data = cbwt_data->bounce_limit - cbwt_data->bounce_off; + uint32_t amount; + uint8_t *dst; + + nrf_uarte_rx_buffer_set(uarte, cfg->rx_flush_buf, UARTE_HW_RX_FIFO_SIZE); + nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_RXSTARTED); + nrf_uarte_task_trigger(uarte, NRF_UARTE_TASK_FLUSHRX); + while (!nrf_uarte_event_check(uarte, NRF_UARTE_EVENT_ENDRX)) { + /* empty */ + } + + nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_ENDRX); + if (!nrf_uarte_event_check(uarte, NRF_UARTE_EVENT_RXSTARTED)) { + /* FIFO is empty. */ + return; + } + + nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_RXSTARTED); + amount = nrf_uarte_rx_amount_get(uarte); + + if (rem_data <= bbuf_rem_data) { + /* instead of -1 it should be -amount but RXDRDY event is not generated + * for bytes following first that goes to FIFO they are generated during flushing. + */ + dst = &cfg->bounce_buf[cbwt_data->bounce_idx][cbwt_data->bounce_off + rem_data - 1]; + } else { + /* See comment in if clause. */ + dst = &cbwt_data->curr_bounce_buf[rem_data - bbuf_rem_data - 1]; + } + + if (IS_ENABLED(UARTE_ANY_CACHE) && (cfg->flags & UARTE_CFG_FLAG_CACHEABLE)) { + sys_cache_data_invd_range(cfg->rx_flush_buf, amount); + sys_cache_data_invd_range(dst, amount); + } + + memcpy(dst, cfg->rx_flush_buf, amount); +} + +static void cbwt_rxto_isr(const struct device *dev, bool do_flush) +{ + const struct uarte_nrfx_config *cfg = dev->config; + struct uarte_nrfx_data *data = dev->data; + struct uarte_async_rx *async_rx = &data->async->rx; + struct uarte_async_rx_cbwt *cbwt_data = cfg->cbwt_data; + + if (async_rx->buf) { + notify_new_data(dev, false); + } + + if (async_rx->buf) { + rx_buf_release(dev, async_rx->buf); + async_rx->buf = NULL; + } + + if (async_rx->next_buf) { + rx_buf_release(dev, async_rx->next_buf); + async_rx->next_buf = NULL; + } + + if (do_flush) { + cbwt_rx_flush_handle(dev); + } + + if (async_rx->discard_fifo) { + cbwt_data->discard_fifo = async_rx->discard_fifo; + async_rx->discard_fifo = false; + } + nrf_timer_task_trigger(cfg->timer_regs, NRF_TIMER_TASK_STOP); + rx_disable_finalize(dev); +} + +static bool timer_ch_evt_check_clear(NRF_TIMER_Type *timer, uint32_t ch) +{ + nrf_timer_event_t evt = nrf_timer_compare_event_get(ch); + + if (nrf_timer_event_check(timer, evt)) { + nrf_timer_event_clear(timer, evt); + return true; + } + + return false; +} + +static void timer_isr(const void *arg) +{ + const struct device *dev = arg; + const struct uarte_nrfx_config *cfg = dev->config; + struct uarte_nrfx_data *data = dev->data; + struct uarte_async_rx_cbwt *cbwt_data = cfg->cbwt_data; + static const uint32_t flags_to_check = UARTE_FLAG_RX_BUF_REQ | + UARTE_FLAG_TRIG_RXTO | + UARTE_FLAG_LATE_CC; + uint32_t flags = atomic_and(&data->flags, ~flags_to_check); + + cbwt_data->in_irq = true; + + if (timer_ch_evt_check_clear(cfg->timer_regs, UARTE_TIMER_USR_CNT_CH) || + (flags & UARTE_FLAG_LATE_CC)) { + usr_buf_complete(dev); + } + + /* Must be after user buf complet CC handling. */ + if (timer_ch_evt_check_clear(cfg->timer_regs, UARTE_TIMER_BUF_SWITCH_CH)) { + bounce_buf_switch(dev); + } + + if (flags & UARTE_FLAG_RX_BUF_REQ) { + rx_buf_req(dev); + } + + if (flags & UARTE_FLAG_TRIG_RXTO) { + cbwt_rxto_isr(dev, false); + } + + cbwt_data->in_irq = false; +} + +static void cbwt_rx_enable(const struct device *dev, bool with_timeout) +{ + const struct uarte_nrfx_config *cfg = dev->config; + struct uarte_nrfx_data *data = dev->data; + struct uarte_async_rx *async_rx = &data->async->rx; + struct uarte_async_rx_cbwt *cbwt_data = cfg->cbwt_data; + uint32_t rem_data; + uint32_t len = async_rx->buf_len; + uint32_t rx_int_mask = NRF_UARTE_INT_RXTO_MASK | + (with_timeout ? NRF_UARTE_INT_RXDRDY_MASK : 0); + + if (cbwt_data->discard_fifo) { + rem_data = 0; + cbwt_data->discard_fifo = false; + } else { + rem_data = get_byte_cnt(cfg->timer_regs) - cbwt_data->last_cnt; + } + + cbwt_data->usr_rd_off = 0; + cbwt_data->usr_wr_off = 0; + + if (rem_data >= len) { + atomic_or(&data->flags, UARTE_FLAG_TRIG_RXTO); + NRFX_IRQ_PENDING_SET(cfg->timer_irqn); + return; + } else if (rem_data) { + (void)update_usr_buf(dev, rem_data, false, true); + len -= rem_data; + } + + prepare_bounce_buf(dev, cfg->bounce_buf[0], get_swap_len(dev), cfg->bounce_buf_len); + + cbwt_data->last_cnt = 0; + cbwt_data->bounce_off = 0; + cbwt_data->bounce_idx = 0; + cbwt_data->curr_bounce_buf = cfg->bounce_buf[0]; + cbwt_data->bounce_limit = cfg->bounce_buf_len; + /* Enable ArrayList. */ + nrf_uarte_shorts_enable(cfg->uarte_regs, NRF_UARTE_SHORT_ENDRX_STARTRX); + nrf_uarte_event_clear(cfg->uarte_regs, NRF_UARTE_EVENT_RXDRDY); + nrf_uarte_int_enable(cfg->uarte_regs, rx_int_mask); + nrf_uarte_rx_buffer_set(cfg->uarte_regs, cbwt_data->curr_bounce_buf, 1); + + nrf_timer_event_clear(cfg->timer_regs, + nrf_timer_compare_event_get(UARTE_TIMER_BUF_SWITCH_CH)); + nrf_timer_event_clear(cfg->timer_regs, + nrf_timer_compare_event_get(UARTE_TIMER_USR_CNT_CH)); + nrf_timer_int_enable(cfg->timer_regs, + nrf_timer_compare_int_get(UARTE_TIMER_BUF_SWITCH_CH) | + nrf_timer_compare_int_get(UARTE_TIMER_USR_CNT_CH)); + nrf_timer_task_trigger(cfg->timer_regs, NRF_TIMER_TASK_CLEAR); + nrf_timer_task_trigger(cfg->timer_regs, NRF_TIMER_TASK_START); + cbwt_data->cc_usr = len; + cbwt_data->cc_swap = get_swap_len(dev); + nrf_timer_cc_set(cfg->timer_regs, UARTE_TIMER_BUF_SWITCH_CH, get_swap_len(dev)); + nrf_timer_cc_set(cfg->timer_regs, UARTE_TIMER_USR_CNT_CH, len); + + atomic_or(&data->flags, UARTE_FLAG_RX_BUF_REQ); + nrf_uarte_task_trigger(cfg->uarte_regs, NRF_UARTE_TASK_STARTRX); + NRFX_IRQ_PENDING_SET(cfg->timer_irqn); +} + +static int cbwt_uarte_async_init(const struct device *dev) +{ + /* As this approach does not use nrfx_timer driver but only HAL special setup + * function is used. + */ + const struct uarte_nrfx_config *cfg = dev->config; + struct uarte_async_rx_cbwt *cbwt_data = cfg->cbwt_data; + static const uint32_t rx_int_mask = NRF_UARTE_INT_ERROR_MASK | + NRF_UARTE_INT_RXTO_MASK; + uint32_t evt = nrf_uarte_event_address_get(cfg->uarte_regs, NRF_UARTE_EVENT_RXDRDY); + uint32_t tsk = nrf_timer_task_address_get(cfg->timer_regs, NRF_TIMER_TASK_COUNT); + nrfx_err_t ret; + + nrf_timer_mode_set(cfg->timer_regs, NRF_TIMER_MODE_COUNTER); + nrf_timer_bit_width_set(cfg->timer_regs, NRF_TIMER_BIT_WIDTH_32); + + ret = nrfx_gppi_channel_alloc(&cbwt_data->ppi_ch); + if (ret != NRFX_SUCCESS) { + return -ENOMEM; + } + + nrfx_gppi_channel_endpoints_setup(cbwt_data->ppi_ch, evt, tsk); + nrfx_gppi_channels_enable(BIT(cbwt_data->ppi_ch)); + +#ifdef CONFIG_UART_USE_RUNTIME_CONFIGURE + cbwt_data->bounce_buf_swap_len = cfg->bounce_buf_swap_len; +#endif + + /* Enable EasyDMA LIST feature (it is exposed in SPIM but not in UARTE). */ + *(volatile uint32_t *)((uint32_t)cfg->uarte_regs + 0x714) = 1; + nrf_uarte_int_enable(cfg->uarte_regs, rx_int_mask); + + return 0; +} +#endif /* CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER */ + static int uarte_async_init(const struct device *dev) { struct uarte_nrfx_data *data = dev->data; @@ -999,6 +1759,17 @@ static int uarte_async_init(const struct device *dev) ((IS_ENABLED(CONFIG_UART_NRFX_UARTE_ENHANCED_RX) && !IS_ENABLED(UARTE_HAS_FRAME_TIMEOUT)) ? NRF_UARTE_INT_RXDRDY_MASK : 0); + k_timer_init(&data->async->rx.timer, rx_timeout, NULL); + k_timer_user_data_set(&data->async->rx.timer, (void *)dev); + k_timer_init(&data->async->tx.timer, tx_timeout, NULL); + k_timer_user_data_set(&data->async->tx.timer, (void *)dev); + +#ifdef CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER + if (IS_CBWT(dev)) { + return cbwt_uarte_async_init(dev); + } +#endif + #if !defined(CONFIG_UART_NRFX_UARTE_ENHANCED_RX) int ret = uarte_nrfx_rx_counting_init(dev); @@ -1009,11 +1780,6 @@ static int uarte_async_init(const struct device *dev) nrf_uarte_int_enable(uarte, rx_int_mask); - k_timer_init(&data->async->rx.timer, rx_timeout, NULL); - k_timer_user_data_set(&data->async->rx.timer, (void *)dev); - k_timer_init(&data->async->tx.timer, tx_timeout, NULL); - k_timer_user_data_set(&data->async->tx.timer, (void *)dev); - return 0; } @@ -1162,6 +1928,7 @@ static uint32_t us_to_bauds(uint32_t baudrate, int32_t timeout) } #endif + static int uarte_nrfx_rx_enable(const struct device *dev, uint8_t *buf, size_t len, int32_t timeout) @@ -1171,6 +1938,11 @@ static int uarte_nrfx_rx_enable(const struct device *dev, uint8_t *buf, const struct uarte_nrfx_config *cfg = dev->config; NRF_UARTE_Type *uarte = get_uarte_instance(dev); +#if defined(CONFIG_UART_NRFX_UARTE_ENHANCED_RX) || \ + defined(CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER) + bool with_timeout = timeout != SYS_FOREVER_US; +#endif + if (cfg->disable_rx) { __ASSERT(false, "TX only UARTE instance"); return -ENOTSUP; @@ -1185,35 +1957,45 @@ static int uarte_nrfx_rx_enable(const struct device *dev, uint8_t *buf, } #ifdef CONFIG_HAS_NORDIC_DMM - uint8_t *dma_buf; - int ret = 0; + if (!IS_CBWT(dev)) { + void *dma_buf; + int ret = 0; - ret = dmm_buffer_in_prepare(cfg->mem_reg, buf, len, (void **)&dma_buf); - if (ret < 0) { - return ret; - } + ret = dmm_buffer_in_prepare(cfg->mem_reg, buf, len, &dma_buf); + if (ret < 0) { + return ret; + } - async_rx->usr_buf = buf; - buf = dma_buf; + async_rx->usr_buf = buf; + buf = dma_buf; + } #endif -#ifdef CONFIG_UART_NRFX_UARTE_ENHANCED_RX +#if defined(CONFIG_UART_NRFX_UARTE_ENHANCED_RX) || \ + defined(CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER) + #ifdef UARTE_HAS_FRAME_TIMEOUT - if (timeout != SYS_FOREVER_US) { + if (!IS_CBWT(dev) && with_timeout) { uint32_t baudrate = COND_CODE_1(CONFIG_UART_USE_RUNTIME_CONFIGURE, - (data->uart_config.baudrate), (cfg->baudrate)); - - async_rx->timeout = K_USEC(timeout); + (data->uart_config.baudrate), (cfg->baudrate)); nrf_uarte_frame_timeout_set(uarte, us_to_bauds(baudrate, timeout)); nrf_uarte_shorts_enable(uarte, NRF_UARTE_SHORT_FRAME_TIMEOUT_STOPRX); + } +#endif +#if !defined(UARTE_HAS_FRAME_TIMEOUT) || defined(CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER) + async_rx->idle_cnt = 0; +#endif + + if (with_timeout) { + if (!IS_CBWT(dev) && IS_ENABLED(UARTE_HAS_FRAME_TIMEOUT)) { + async_rx->timeout = K_USEC(timeout); + } else { + async_rx->timeout = with_timeout ? + K_USEC(timeout / RX_TIMEOUT_DIV) : K_NO_WAIT; + } } else { async_rx->timeout = K_NO_WAIT; } -#else - async_rx->timeout = (timeout == SYS_FOREVER_US) ? - K_NO_WAIT : K_USEC(timeout / RX_TIMEOUT_DIV); - async_rx->idle_cnt = 0; -#endif /* UARTE_HAS_FRAME_TIMEOUT */ #else async_rx->timeout_us = timeout; async_rx->timeout_slab = timeout / RX_TIMEOUT_DIV; @@ -1241,8 +2023,20 @@ static int uarte_nrfx_rx_enable(const struct device *dev, uint8_t *buf, } } pm_device_runtime_get(dev); + } else if (LOW_POWER_ENABLED(cfg)) { + unsigned int key = irq_lock(); + + uarte_enable_locked(dev, UARTE_FLAG_LOW_POWER_RX); + irq_unlock(key); } +#ifdef CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER + if (IS_CBWT(dev)) { + cbwt_rx_enable(dev, with_timeout); + return 0; + } +#endif + if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME) || LOW_POWER_ENABLED(cfg)) { if (async_rx->flush_cnt) { int cpy_len = MIN(len, async_rx->flush_cnt); @@ -1279,7 +2073,7 @@ static int uarte_nrfx_rx_enable(const struct device *dev, uint8_t *buf, return 0; } else { #ifdef CONFIG_UART_NRFX_UARTE_ENHANCED_RX - if (!K_TIMEOUT_EQ(async_rx->timeout, K_NO_WAIT)) { + if (with_timeout) { nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_RXDRDY); k_timer_start(&async_rx->timer, async_rx->timeout, K_NO_WAIT); @@ -1304,13 +2098,6 @@ static int uarte_nrfx_rx_enable(const struct device *dev, uint8_t *buf, async_rx->enabled = true; - if (LOW_POWER_ENABLED(cfg)) { - unsigned int key = irq_lock(); - - uarte_enable_locked(dev, UARTE_FLAG_LOW_POWER_RX); - irq_unlock(key); - } - nrf_uarte_task_trigger(uarte, NRF_UARTE_TASK_STARTRX); return 0; @@ -1329,29 +2116,33 @@ static int uarte_nrfx_rx_buf_rsp(const struct device *dev, uint8_t *buf, err = -EACCES; } else if (async_rx->next_buf == NULL) { #ifdef CONFIG_HAS_NORDIC_DMM - uint8_t *dma_buf; - const struct uarte_nrfx_config *config = dev->config; + if (!IS_CBWT(dev)) { + uint8_t *dma_buf; + const struct uarte_nrfx_config *config = dev->config; - err = dmm_buffer_in_prepare(config->mem_reg, buf, len, (void **)&dma_buf); - if (err < 0) { - return err; + err = dmm_buffer_in_prepare(config->mem_reg, buf, len, (void **)&dma_buf); + if (err < 0) { + return err; + } + async_rx->next_usr_buf = buf; + buf = dma_buf; } - async_rx->next_usr_buf = buf; - buf = dma_buf; #endif async_rx->next_buf = buf; async_rx->next_buf_len = len; - nrf_uarte_rx_buffer_set(uarte, buf, len); - /* If buffer is shorter than RX FIFO then there is a risk that due - * to interrupt handling latency ENDRX event is not handled on time - * and due to ENDRX_STARTRX short data will start to be overwritten. - * In that case short is not enabled and ENDRX event handler will - * manually start RX for that buffer. Thanks to RX FIFO there is - * 5 byte time for doing that. If interrupt latency is higher and - * there is no HWFC in both cases data will be lost or corrupted. - */ - if (len >= UARTE_HW_RX_FIFO_SIZE) { - nrf_uarte_shorts_enable(uarte, NRF_UARTE_SHORT_ENDRX_STARTRX); + if (!IS_CBWT(dev)) { + nrf_uarte_rx_buffer_set(uarte, buf, len); + /* If buffer is shorter than RX FIFO then there is a risk that due + * to interrupt handling latency ENDRX event is not handled on time + * and due to ENDRX_STARTRX short data will start to be overwritten. + * In that case short is not enabled and ENDRX event handler will + * manually start RX for that buffer. Thanks to RX FIFO there is + * 5 byte time for doing that. If interrupt latency is higher and + * there is no HWFC in both cases data will be lost or corrupted. + */ + if (len >= UARTE_HW_RX_FIFO_SIZE) { + nrf_uarte_shorts_enable(uarte, NRF_UARTE_SHORT_ENDRX_STARTRX); + } } err = 0; } else { @@ -1401,6 +2192,13 @@ static void rx_timeout(struct k_timer *timer) NRF_UARTE_Type *uarte = get_uarte_instance(dev); #ifdef UARTE_HAS_FRAME_TIMEOUT +#ifdef CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER + if (IS_CBWT(dev)) { + cbwt_rx_timeout(timer); + return; + } +#endif + struct uarte_nrfx_data *data = dev->data; struct uarte_async_rx *async_rx = &data->async->rx; bool rxdrdy = nrf_uarte_event_check(uarte, NRF_UARTE_EVENT_RXDRDY); @@ -1547,7 +2345,7 @@ static void error_isr(const struct device *dev) nrf_uarte_errorsrc_clear(uarte, err); user_callback(dev, &evt); - (void) uarte_nrfx_rx_disable(dev); + (void)rx_disable(dev, false); } static void rxstarted_isr(const struct device *dev) @@ -1766,7 +2564,6 @@ static void rxto_isr(const struct device *dev) * In the second case, additionally, data from the UARTE internal RX * FIFO need to be discarded. */ - async_rx->enabled = false; if (async_rx->discard_fifo) { async_rx->discard_fifo = false; #if !defined(CONFIG_UART_NRFX_UARTE_ENHANCED_RX) @@ -1794,15 +2591,7 @@ static void rxto_isr(const struct device *dev) #endif nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_RXDRDY); #endif - - if (LOW_POWER_ENABLED(config)) { - uint32_t key = irq_lock(); - - uarte_disable_locked(dev, UARTE_FLAG_LOW_POWER_RX); - irq_unlock(key); - } - - notify_rx_disable(dev); + rx_disable_finalize(dev); } static void txstopped_isr(const struct device *dev) @@ -1892,10 +2681,12 @@ static void txstopped_isr(const struct device *dev) static void rxdrdy_isr(const struct device *dev) { -#if !defined(UARTE_HAS_FRAME_TIMEOUT) +#if !defined(UARTE_HAS_FRAME_TIMEOUT) || defined(CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER) struct uarte_nrfx_data *data = dev->data; -#if defined(CONFIG_UART_NRFX_UARTE_ENHANCED_RX) +#if defined(CONFIG_UART_NRFX_UARTE_ENHANCED_RX) || \ + defined(CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER) + NRF_UARTE_Type *uarte = get_uarte_instance(dev); data->async->rx.idle_cnt = 0; @@ -1927,8 +2718,9 @@ static void uarte_nrfx_isr_async(const void *arg) struct uarte_async_rx *async_rx = &data->async->rx; uint32_t imask = nrf_uarte_int_enable_check(uarte, UINT32_MAX); - if (!(HW_RX_COUNTING_ENABLED(config) || IS_ENABLED(UARTE_HAS_FRAME_TIMEOUT)) - && event_check_clear(uarte, NRF_UARTE_EVENT_RXDRDY, NRF_UARTE_INT_RXDRDY_MASK, imask)) { + if ((IS_CBWT(dev) || + !(HW_RX_COUNTING_ENABLED(config) || IS_ENABLED(UARTE_HAS_FRAME_TIMEOUT))) && + event_check_clear(uarte, NRF_UARTE_EVENT_RXDRDY, NRF_UARTE_INT_RXDRDY_MASK, imask)) { rxdrdy_isr(dev); } @@ -1956,6 +2748,12 @@ static void uarte_nrfx_isr_async(const void *arg) rxstarted_isr(dev); } +#ifdef CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER + if (IS_CBWT(dev) && + event_check_clear(uarte, NRF_UARTE_EVENT_RXTO, NRF_UARTE_INT_RXTO_MASK, imask)) { + cbwt_rxto_isr(dev, true); + } else +#endif /* RXTO must be handled after ENDRX which should notify the buffer. * Skip if ENDRX is set when RXTO is set. It means that * ENDRX occurred after check for ENDRX in isr which may happen when @@ -1980,7 +2778,8 @@ static void uarte_nrfx_isr_async(const void *arg) txstopped_isr(dev); } - if (atomic_and(&data->flags, ~UARTE_FLAG_TRIG_RXTO) & UARTE_FLAG_TRIG_RXTO) { + if (!IS_CBWT(dev) && + (atomic_and(&data->flags, ~UARTE_FLAG_TRIG_RXTO) & UARTE_FLAG_TRIG_RXTO)) { #ifdef CONFIG_HAS_NORDIC_DMM int ret; @@ -1995,7 +2794,7 @@ static void uarte_nrfx_isr_async(const void *arg) rx_buf_release(dev, async_rx->buf); async_rx->buf_len = 0; async_rx->buf = NULL; - notify_rx_disable(dev); + rx_disable_finalize(dev); } } @@ -2609,6 +3408,44 @@ static int uarte_instance_deinit(const struct device *dev) return pm_device_driver_deinit(dev, uarte_nrfx_pm_action); } +#define UARTE_TIMER_REG(idx) (NRF_TIMER_Type *)DT_REG_ADDR(DT_PHANDLE(UARTE(idx), timer)) + +#define UARTE_TIMER_IRQN(idx) DT_IRQN(DT_PHANDLE(UARTE(idx), timer)) + +#define UARTE_TIMER_IRQ_PRIO(idx) DT_IRQ(DT_PHANDLE(UARTE(idx), timer), priority) + +#define UARTE_COUNT_BYTES_WITH_TIMER_CONFIG(idx) \ + IF_ENABLED(UARTE_HAS_PROP(idx, timer), \ + (.timer_regs = UARTE_TIMER_REG(idx), \ + .timer_irqn = UARTE_TIMER_IRQN(idx), \ + .uarte_irqn = DT_IRQN(UARTE(idx)), \ + .bounce_buf = { \ + uart##idx##_bounce_buf, \ + &uart##idx##_bounce_buf[sizeof(uart##idx##_bounce_buf) / 2] \ + }, \ + .bounce_buf_len = sizeof(uart##idx##_bounce_buf) / 2, \ + .bounce_buf_swap_len = UARTE_BUF_SWAP_LEN(sizeof(uart##idx##_bounce_buf) / 2,\ + UARTE_US_TO_BYTES(UARTE_PROP(idx, current_speed))), \ + .cbwt_data = &uart##idx##_bounce_data,)) + +#define UARTE_COUNT_BYTES_WITH_TIMER_VALIDATE_CONFIG(idx) \ + __ASSERT_NO_MSG(UARTE_TIMER_IRQ_PRIO(idx) == DT_IRQ(UARTE(idx), priority)) + +#define UARTE_TIMER_IRQ_CONNECT(idx, func) \ + IF_ENABLED(UTIL_AND(IS_ENABLED(CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER), \ + UARTE_HAS_PROP(idx, timer)), \ + (UARTE_COUNT_BYTES_WITH_TIMER_VALIDATE_CONFIG(idx); \ + IRQ_CONNECT(UARTE_TIMER_IRQN(idx), UARTE_TIMER_IRQ_PRIO(idx), func, \ + DEVICE_DT_GET(UARTE(idx)), 0); \ + irq_enable(UARTE_TIMER_IRQN(idx));)) + +/* Macro sets flag to indicate that uart use different interrupt priority than the system clock. */ +#define UARTE_HAS_VAR_PRIO(idx) \ + COND_CODE_1(UTIL_AND(IS_ENABLED(CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER), \ + UARTE_HAS_PROP(idx, timer)), \ + ((DT_IRQ(UARTE(idx), priority) != DT_IRQ(DT_NODELABEL(grtc), priority)) ? \ + UARTE_CFG_FLAG_VAR_IRQ : 0), (0)) + #define UARTE_GET_ISR(idx) \ COND_CODE_1(CONFIG_UART_##idx##_ASYNC, (uarte_nrfx_isr_async), (uarte_nrfx_isr_int)) @@ -2624,16 +3461,18 @@ static int uarte_instance_deinit(const struct device *dev) )) /* Depending on configuration standard or direct IRQ is connected. */ -#define UARTE_IRQ_CONNECT(idx, irqn, prio) \ - COND_CODE_1(CONFIG_UART_NRFX_UARTE_NO_IRQ, (), \ - (COND_CODE_1(CONFIG_UART_NRFX_UARTE_DIRECT_ISR, \ - (IRQ_DIRECT_CONNECT(irqn, prio, uarte_##idx##_direct_isr, 0)), \ - (IRQ_CONNECT(irqn, prio, UARTE_GET_ISR(idx), DEVICE_DT_GET(UARTE(idx)), 0))))) +#define UARTE_IRQ_CONNECT(idx, irqn, prio) \ + COND_CODE_1(CONFIG_UART_NRFX_UARTE_NO_IRQ, (), \ + (COND_CODE_1(CONFIG_UART_NRFX_UARTE_DIRECT_ISR, \ + (IRQ_DIRECT_CONNECT(irqn, prio, uarte_##idx##_direct_isr, 0)), \ + (IRQ_CONNECT(irqn, prio, UARTE_GET_ISR(idx), \ + DEVICE_DT_GET(UARTE(idx)), 0))))) #define UARTE_IRQ_CONFIGURE(idx) \ do { \ UARTE_IRQ_CONNECT(idx, DT_IRQN(UARTE(idx)), DT_IRQ(UARTE(idx), priority)); \ irq_enable(DT_IRQN(UARTE(idx))); \ + UARTE_TIMER_IRQ_CONNECT(idx, timer_isr) \ } while (false) /* Low power mode is used when disable_rx is not defined or in async mode if @@ -2740,6 +3579,12 @@ static int uarte_instance_deinit(const struct device *dev) UARTE_INT_DRIVEN(idx); \ PINCTRL_DT_DEFINE(UARTE(idx)); \ IF_ENABLED(CONFIG_UART_##idx##_ASYNC, ( \ + IF_ENABLED(UTIL_AND(IS_ENABLED(CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER), \ + UARTE_HAS_PROP(idx, timer)), \ + (static uint8_t uart##idx##_bounce_buf[CONFIG_UART_NRFX_UARTE_BOUNCE_BUF_LEN] \ + DMM_MEMORY_SECTION(UARTE(idx)); \ + static struct uarte_async_rx_cbwt uart##idx##_bounce_data; \ + )) \ static uint8_t \ uarte##idx##_tx_cache[CONFIG_UART_ASYNC_TX_CACHE_SIZE] \ DMM_MEMORY_SECTION(UARTE(idx)); \ @@ -2781,6 +3626,10 @@ static int uarte_instance_deinit(const struct device *dev) (IS_ENABLED(CONFIG_UART_NRFX_UARTE_SPURIOUS_RXTO_WORKAROUND) && \ INSTANCE_IS_HIGH_SPEED(_, /*empty*/, idx, _) ? \ UARTE_CFG_FLAG_SPURIOUS_RXTO : 0) | \ + ((IS_ENABLED(UARTE_BAUDRATE_RETENTION_WORKAROUND) && \ + UARTE_IS_CACHEABLE(idx)) ? \ + UARTE_CFG_FLAG_VOLATILE_BAUDRATE : 0) | \ + UARTE_HAS_VAR_PRIO(idx) | \ USE_LOW_POWER(idx), \ UARTE_DISABLE_RX_INIT(UARTE(idx)), \ .poll_out_byte = &uarte##idx##_poll_out_byte, \ @@ -2788,6 +3637,8 @@ static int uarte_instance_deinit(const struct device *dev) IF_ENABLED(CONFIG_UART_##idx##_ASYNC, \ (.tx_cache = uarte##idx##_tx_cache, \ .rx_flush_buf = uarte##idx##_flush_buf,)) \ + IF_ENABLED(CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER, \ + (UARTE_COUNT_BYTES_WITH_TIMER_CONFIG(idx))) \ IF_ENABLED(CONFIG_UART_##idx##_NRF_HW_ASYNC, \ (.timer = NRFX_TIMER_INSTANCE( \ CONFIG_UART_##idx##_NRF_HW_ASYNC_TIMER),)) \ @@ -2840,5 +3691,4 @@ static int uarte_instance_deinit(const struct device *dev) #define COND_UART_NRF_UARTE_DEVICE(unused, prefix, i, _) \ IF_ENABLED(CONFIG_HAS_HW_NRF_UARTE##prefix##i, (UART_NRF_UARTE_DEVICE(prefix##i);)) - UARTE_FOR_EACH_INSTANCE(COND_UART_NRF_UARTE_DEVICE, (), ()) From 4fa43040a6e12fccfa0cfbfcd677ac3e263cea0a Mon Sep 17 00:00:00 2001 From: Triveni Danda Date: Tue, 29 Jul 2025 15:10:10 +0530 Subject: [PATCH 1596/2141] [nrf fromlist] soc: nordic: nrf54h: Add DT_NODE_EXISTS check Add `DT_NODE_EXISTS` check to ensure cpurad partition nodes exist before referencing their addresses. This prevents build errors when these partitions are not defined in the devicetree. Upstream PR #: 93815 Signed-off-by: Triveni Danda (cherry picked from commit 1b785f57b67170f8c163fa617783a91013ce9b1f) --- soc/nordic/nrf54h/soc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soc/nordic/nrf54h/soc.c b/soc/nordic/nrf54h/soc.c index 01cacf48f62f..fb1c3f426d33 100644 --- a/soc/nordic/nrf54h/soc.c +++ b/soc/nordic/nrf54h/soc.c @@ -216,7 +216,7 @@ void soc_late_init_hook(void) DT_REG_ADDR(DT_NODELABEL(cpurad_slot0_partition)) + CONFIG_ROM_START_OFFSET); } -#else +#elif DT_NODE_EXISTS(DT_NODELABEL(cpurad_slot0_partition)) radiocore_address = (void *)(DT_REG_ADDR(DT_GPARENT(DT_NODELABEL(cpurad_slot0_partition))) + DT_REG_ADDR(DT_NODELABEL(cpurad_slot0_partition)) + From 514c3b8a5a8287554c46f1f70da993cab537f5f3 Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Tue, 26 Jan 2021 15:43:08 +0100 Subject: [PATCH 1597/2141] [nrf noup] ci: set `ZEPHYR__KCONFIG` for NCS modules MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit sets `ZEPHYR__KCONFIG` variable for each Kconfig file discovered in `nrf/modules//Kconfig`. This is not meant as a permanent solution; we should do more careful consideration on the optimal approach forward that will allow compliance_check.py to be used downstream with custom module_ext_roots, and at the same time keep current flexibility for module glue code handling intact. Adds a static path for the NRF Kconfig variable in the check compliance script, this is a temporary workaround due to supporting an external root for NCS that should be reworked to use package helper in future Signed-off-by: Torsten Rasmussen Signed-off-by: Martí Bolívar Signed-off-by: Carles Cufi Signed-off-by: Jamie McCrae (cherry picked from commit 26572f95c09d9c063ad9dda85b6e6368f015ce94) --- scripts/ci/check_compliance.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index a600004aae7a..4ef7c81cfd0c 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -540,6 +540,13 @@ def get_modules(self, _module_dirs_file, modules_file, sysbuild_modules_file, se modules = [name for name in os.listdir(modules_dir) if modules_dir / name / 'Kconfig'] + nrf_modules_dir = ZEPHYR_BASE / Path('../nrf/modules') + nrf_modules = [] + if os.path.exists(nrf_modules_dir): + nrf_modules = [name for name in os.listdir(nrf_modules_dir) if + os.path.exists(os.path.join(nrf_modules_dir, name, + 'Kconfig'))] + with open(modules_file, 'r') as fp_module_file: content = fp_module_file.read() @@ -549,8 +556,31 @@ def get_modules(self, _module_dirs_file, modules_file, sysbuild_modules_file, se re.sub('[^a-zA-Z0-9]', '_', module).upper(), modules_dir / module / 'Kconfig' )) + for module in nrf_modules: + fp_module_file.write("ZEPHYR_{}_KCONFIG = {}\n".format( + re.sub('[^a-zA-Z0-9]', '_', module).upper(), + nrf_modules_dir / module / 'Kconfig' + )) + fp_module_file.write("NCS_{}_KCONFIG = {}\n".format( + re.sub('[^a-zA-Z0-9]', '_', module).upper(), + modules_dir / module / 'Kconfig' + )) + # Add NRF as static entry as workaround for ext Kconfig root support + fp_module_file.write("ZEPHYR_NRF_KCONFIG = {}\n".format( + nrf_modules_dir / '..' / 'Kconfig.nrf' + )) fp_module_file.write(content) + with open(sysbuild_modules_file, 'r') as fp_sysbuild_module_file: + content = fp_sysbuild_module_file.read() + + with open(sysbuild_modules_file, 'w') as fp_sysbuild_module_file: + # Add NRF as static entry as workaround for ext Kconfig root support + fp_sysbuild_module_file.write("SYSBUILD_NRF_KCONFIG = {}\n".format( + nrf_modules_dir / '..' / 'sysbuild' / 'Kconfig.sysbuild' + )) + fp_sysbuild_module_file.write(content) + def get_kconfig_dts(self, kconfig_dts_file, settings_file): """ Generate the Kconfig.dts using dts/bindings as the source. From b9f67325a5fe3794f1eadba95063b958496fc457 Mon Sep 17 00:00:00 2001 From: Piotr Golyzniak Date: Mon, 1 Aug 2022 13:06:01 +0200 Subject: [PATCH 1598/2141] [nrf noup] ci: scripts: add quarantine file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add scripts/quarantine.yaml file, which will be used in CI. Signed-off-by: Piotr Golyzniak Signed-off-by: Andrzej Głąbek Signed-off-by: Maciej Perkowski Signed-off-by: Robert Lubos (cherry picked from commit 88c7330e9305bcb19c46cb7f4d03db556753bab1) --- scripts/quarantine.yaml | 88 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 scripts/quarantine.yaml diff --git a/scripts/quarantine.yaml b/scripts/quarantine.yaml new file mode 100644 index 000000000000..20c4f9248ea9 --- /dev/null +++ b/scripts/quarantine.yaml @@ -0,0 +1,88 @@ +# The configurations resulting as a product of scenarios and platforms +# will be skipped if quarantine is used. More details here: +# https://docs.zephyrproject.org/latest/guides/test/twister.html#quarantine + +- scenarios: + - testing.ztest.busy_sim + - testing.ztest.busy_sim_nrf52840dk_pin + platforms: + - nrf52840dk_nrf52840 + +# Already reported, but will not be fixed (look at the discussion): +# https://github.com/zephyrproject-rtos/zephyr/issues/44947 +- scenarios: + - libraries.cmsis_dsp.matrix.unary_f64 + platforms: + - nrf5340dk_nrf5340_cpunet + - qemu_cortex_m3 + comment: "Flash overflows" + +# Already reported, but will not be fixed (look at the discussion): +# https://github.com/zephyrproject-rtos/zephyr/issues/44947 +- scenarios: + - libraries.cmsis_dsp.matrix.binary_f16 + - libraries.cmsis_dsp.matrix.binary_f16.fpu + platforms: + - nrf5340dk_nrf5340_cpuapp_ns + comment: "Flash overflows" + +# Already reported, but will not be fixed (look at the discussion): +# https://github.com/zephyrproject-rtos/zephyr/issues/44947 +- scenarios: + - libraries.cmsis_dsp.matrix.binary_q15 + - libraries.cmsis_dsp.matrix.binary_q15.fpu + - libraries.cmsis_dsp.matrix.unary_f32 + - libraries.cmsis_dsp.matrix.unary_f32.fpu + - libraries.cmsis_dsp.matrix.unary_f64 + - libraries.cmsis_dsp.matrix.unary_f64.fpu + platforms: + - nrf5340dk_nrf5340_cpuapp_ns + - nrf9160dk_nrf9160_ns + comment: "Flash overflows" + +# libsdl2-dev package should be added into docker image +- scenarios: + - sample.boards.nrf.nrf_led_matrix + - sample.display.lvgl.gui + platforms: + - native_posix + comment: "libsdl2-dev package not available" + +- scenarios: + - sample.net.sockets.echo_server.usbnet + - sample.net.sockets.echo_server.usbnet_composite + platforms: + - nrf5340dk_nrf5340_cpuapp_ns + comment: "Ram/flash overflows, also in the upstream" + +- scenarios: + - sample.net.zperf.netusb_ecm + - sample.net.zperf.netusb_eem + - sample.net.zperf.netusb_rndis + platforms: + - nrf52833dk_nrf52833 + - nrf5340dk_nrf5340_cpuapp_ns + comment: "Ram/flash overflows, also in the upstream" + +- scenarios: + - net.mqtt.tls + platforms: + - nrf5340dk_nrf5340_cpuapp_ns + - nrf9160dk_nrf9160_ns + comment: "Ram/flash overflows, also in the upstream" + +- scenarios: + - kernel.common.picolibc + - libraries.picolibc + - libraries.libc.picolibc.mem_alloc + - libraries.picolibc.sprintf_new + platforms: + - nrf52dk_nrf52832 + comment: "Ram overflows, also in the upstream" + +- scenarios: + - sample.psa_crypto + platforms: + - nrf5340dk_nrf5340_cpuapp_ns + - nrf9160dk_nrf9160_ns + comment: "Due to using sdk-zephyr manifest instead of nrf. Should be fixed after the change" From 2984211aa6c8eeeeb42fb72b71f2e68f698c83d3 Mon Sep 17 00:00:00 2001 From: Sebastian Wezel Date: Tue, 15 Mar 2022 13:12:25 +0100 Subject: [PATCH 1599/2141] [nrf noup] ci: add .github/test-spec.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This file is used for NCS-specific testing configuration based on modifications to files in this repository. Signed-off-by: Alperen Sener Signed-off-by: Elisabeth Solheim Klakken Signed-off-by: Mariusz Poslinski Signed-off-by: Markus Swarowsky Signed-off-by: Robert Lubos Signed-off-by: Sebastian Wezel Signed-off-by: Tomasz Tyzenhauz Signed-off-by: Fredrik Ås Signed-off-by: Michał Szablowski Signed-off-by: Tony Le Signed-off-by: Krishna T Signed-off-by: Dawid Przybylo Signed-off-by: Rubin Gerritsen Signed-off-by: Jørgen Kvalvaag Signed-off-by: Magne Værnes Signed-off-by: Lang Xie Signed-off-by: Alexander Svensen Signed-off-by: Jan Gałda Signed-off-by: Vladislav Litvinov Signed-off-by: Guojun Wang Signed-off-by: Piotr Kosycarz Signed-off-by: Thomas Stilwell Signed-off-by: Krzysztof Szromek Signed-off-by: Grzegorz Chwierut Signed-off-by: Eduardo Montoya Signed-off-by: Pavel Vasilyev (cherry picked from commit fc65d19b1f987439ab158c74e32f2085060baf09) --- .github/test-spec.yml | 392 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 392 insertions(+) create mode 100644 .github/test-spec.yml diff --git a/.github/test-spec.yml b/.github/test-spec.yml new file mode 100644 index 000000000000..6da6bdbaa87d --- /dev/null +++ b/.github/test-spec.yml @@ -0,0 +1,392 @@ +# This is the Jenkins ci variant of the .github/labler.yaml + +"CI-run-zephyr-twister": + - any: + - "!.github/**/*" + - "!doc/**/*" + - "!CODEOWNERS" + - "!LICENSE" + - "!**/*.rst" + - "!VERSION" + - "!submanifests/**/*" + - "!MAINTAINERS.yml" + - "!version.h.in" + - "!Jenkinsfile" + - "!**/*.md" + +"CI-iot-zephyr-lwm2m-test": + - "drivers/console/**/*" + - "drivers/flash/**/*" + - "subsys/dfu/boot/**/*" + - "subsys/net/ip/**/*" + - "subsys/net/lib/http/**/*" + - "subsys/net/lib/lwm2m//**/*" + - "subsys/net/**/*" + +"CI-iot-samples-test": + - "boards/nordic/nrf9160dk/**/*" + - "dts/arm/nordic/nrf9160*" + - "include/net/**/*" + - "subsys/net/lib/**/*" + +"CI-iot-libraries-test": + - "boards/nordic/nrf9160dk/**/*" + - "dts/arm/nordic/nrf9160*" + - "include/net/socket_ncs.h" + - "subsys/testsuite/ztest/**/*" + +"CI-lwm2m-test": null +# Not necessary to run tests on changes to this repo. + +"CI-boot-test": + - "subsys/mgmt/mcumgr/**/*" + - "subsys/dfu/**/*" + - "include/mgmt/mcumgr/**/*" + - "include/dfu/**/*" + - "samples/subsys/mgmt/mcumgr/smp_svr/**/*" + - "tests/boot/**/*" + - "tests/subsys/dfu/**/*" + - "tests/subsys/mgmt/mcumgr/**/*" + +"CI-tfm-test": + - "boards/nordic/nrf5340dk/**/*" + - "boards/nordic/nrf9160dk/**/*" + - "drivers/entropy/*" + - "dts/arm/nordic/nrf5340*" + - "dts/arm/nordic/nrf9160*" + - "modules/trusted-firmware-m/**/*" + - "samples/tfm_integration/**/*" + +"CI-ble-test": + - any: + - "drivers/bluetooth/**/*" + - any: + - "dts/arm/nordic/nrf5*" + - any: + - "subsys/bluetooth/**/*" + - "!subsys/bluetooth/mesh/**/*" + - "!subsys/bluetooth/audio/**/*" + - any: + - "include/zephyr/bluetooth/**/*" + - "!include/zephyr/bluetooth/mesh/**/*" + - "samples/bluetooth/hci_ipc/**/*" + +"CI-ble-samples-test": + - any: + - "drivers/bluetooth/**/*" + - any: + - "dts/arm/nordic/nrf5*" + - any: + - "subsys/bluetooth/**/*" + - "!subsys/bluetooth/mesh/**/*" + - "!subsys/bluetooth/audio/**/*" + - any: + - "include/zephyr/bluetooth/**/*" + - "!include/zephyr/bluetooth/mesh/**/*" + - "samples/bluetooth/**/*" + +"CI-mesh-test": + - "subsys/bluetooth/mesh/**/*" + - "include/zephyr/bluetooth/mesh/**/*" + - "samples/bluetooth/mesh/**/*" + - "samples/bluetooth/mesh_demo/**/*" + - "samples/bluetooth/mesh_provisioner/**/*" + - "tests/bluetooth/mesh/**/*" + - "tests/bluetooth/mesh_shell/**/*" + +"CI-thingy91-test": + - "boards/nordic/nrf9160dk/**/*" + - "arch/x86/core/**/*" + - "arch/x86/include/**/*" + - "drivers/console/**/*" + - "drivers/ethernet/**/*" + - "drivers/flash/**/*" + - "drivers/hwinfo/**/*" + - "drivers/interrupt_controller/**/*" + - "drivers/net/**/*" + - "drivers/serial/**/*" + - "drivers/timer/**/*" + - "include/**/*" + - "kernel/**/*" + - "lib/libc/common/source/stdlib/**/*" + - "lib/libc/newlib/**/*" + - "lib/libc/picolibc/**/*" + - "lib/os/**/*" + - "lib/posix/**/*" + - "misc/**/*" + - "modules/mbedtls/**/*" + - "soc/x86/ia32/**/*" + - "subsys/fs/fcb/**/*" + - "subsys/logging/**/*" + - "subsys/net/**/*" + - "subsys/random/**/*" + - "subsys/settings/include/**/*" + - "subsys/settings/src/**/*" + - "subsys/stats/**/*" + - "subsys/storage/flash_map/**/*" + - "subsys/storage/stream/**/*" + - "subsys/tracing/**/*" + +"CI-desktop-test": + - "drivers/bluetooth/*" + - "subsys/bluetooth/*" + - "include/zephyr/bluetooth/*" + +"CI-crypto-test": + - "boards/nordic/nrf52840dk/**/*" + - "boards/nordic/nrf5340dk/**/*" + - "boards/nordic/nrf9160dk/**/*" + - "drivers/entropy/*" + - "drivers/serial/**/*" + - "dts/arm/nordic/nrf52840*" + - "dts/arm/nordic/nrf5340*" + - "dts/arm/nordic/nrf9160*" + - "include/drivers/serial/**/*" + - "modules/mbedtls/**/*" + +"CI-fem-test": + - "boards/nordic/**/*" + - "drivers/bluetooth/hci/**/*" + - "drivers/entropy/**/*" + - "dts/bindings/**/*" + - "include/zephyr/net/**/*" + - "include/zephyr/arch/**/*" + - "lib/libc/**/*" + - "lib/open-amp/**/*" + - "modules/hal_nordic/**/*" + - "modules/mbedtls/**/*" + - "modules/openthread/**/*" + - "modules/trusted-firmware-m/**/*" + - "samples/net/sockets/echo_*/**/*" + - "share/**/*" + - "soc/nordic/**/*" + - "subsys/net/**/*" + - "subsys/settings/**/*" + - "subsys/bluetooth/shell/**/*" + - "subsys/ipc/**/*" + - "Kconfig" + - "CMakeLists.txt" + +"CI-rs-test": + - "boards/nordic/**/*" + - "drivers/bluetooth/hci/**/*" + - "drivers/entropy/**/*" + - "dts/bindings/**/*" + - "include/zephyr/net/**/*" + - "include/zephyr/arch/**/*" + - "lib/libc/**/*" + - "lib/open-amp/**/*" + - "modules/hal_nordic/**/*" + - "modules/mbedtls/**/*" + - "modules/openthread/**/*" + - "modules/trusted-firmware-m/**/*" + - "samples/net/sockets/echo_*/**/*" + - "share/**/*" + - "soc/nordic/**/*" + - "subsys/net/**/*" + - "subsys/settings/**/*" + - "subsys/bluetooth/shell/**/*" + - "subsys/ipc/**/*" + - "Kconfig" + - "CMakeLists.txt" + +"CI-thread-test": + - "include/zephyr/net/**/*" + - "modules/mbedtls/**/*" + - "modules/openthread/**/*" + - "samples/net/openthread/**/*" + - "soc/nordic/**/*" + - "subsys/net/**/*" + - "subsys/settings/**/*" + +"CI-nfc-test": + - "drivers/bluetooth/hci/**/*" + - "drivers/entropy/**/*" + - "drivers/flash/**/*" + - "drivers/mbox/**/*" + - "drivers/spi/**/*" + - "lib/crc/**/*" + - "modules/hal_nordic/**/*" + - "soc/nordic/**/*" + - "subsys/ipc/ipc_service/**/*" + - "subsys/fs/**/*" + - "subsys/mem_mgmt/**/*" + - "subsys/net/**/*" + - "subsys/random/**/*" + - "subsys/settings/**/*" + - "subsys/shell/**/*" + - "subsys/storage/**/*" + - any: + - "subsys/bluetooth/**/*" + - "!subsys/bluetooth/mesh/**/*" + +"CI-matter-test": + - "include/dfu/**/*" + - "include/mgmt/mcumgr/**/*" + - "soc/nordic/**/*" + - "subsys/dfu/**/*" + - "subsys/settings/**/*" + - "subsys/net/**/*" + - "subsys/mgmt/mcumgr/**/*" + - "drivers/net/**/*" + - "samples/bluetooth/hci_ipc/**/*" + - any: + - "subsys/bluetooth/**/*" + - "!subsys/bluetooth/mesh/**/*" + - "!subsys/bluetooth/audio/**/*" + +"CI-find-my-test": + - "boards/nordic/**/*" + - "drivers/bluetooth/**/*" + - "drivers/entropy/**/*" + - "drivers/flash/**/*" + - "drivers/usb/**/*" + - "drivers/regulator/**/*" + - "soc/nordic/**/*" + - "subsys/dfu/**/*" + - "subsys/fs/**/*" + - "subsys/ipc/**/*" + - "subsys/net/**/*" + - "subsys/random/**/*" + - "subsys/settings/**/*" + - "subsys/storage/**/*" + - "subsys/tracing/**/*" + - "subsys/usb/device/**/*" + - any: + - "subsys/bluetooth/**/*" + - "!subsys/bluetooth/mesh/**/*" + +"CI-rpc-test": + - "subsys/ipc/ipc_service/**/*" + - "subsys/random/**/*" + - "soc/nordic/nrf53/**/*" + +"CI-modemshell-test": + - "include/net/**/*" + - "include/posix/**/*" + - "include/shell/**/*" + - "drivers/net/**/*" + - "drivers/serial/**/*" + - "drivers/wifi/**/*" + - "subsys/shell/**/*" + - "subsys/net/**/*" + - "subsys/settings/**/*" + +"CI-positioning-test": + - "include/net/**/*" + - "include/posix/**/*" + - "drivers/net/**/*" + - "drivers/wifi/**/*" + - "subsys/net/**/*" + - "subsys/settings/**/*" + +"CI-cloud-test": + - "include/zephyr/dfu/**/*" + - "include/zephyr/net/**/*" + - "include/zephyr/posix/**/*" + - "include/zephyr/settings/**/*" + - "drivers/led/**/*" + - "drivers/net/**/*" + - "drivers/sensor/**/*" + - "drivers/serial/**/*" + - "drivers/wifi/**/*" + - "lib/posix/**/*" + - "soc/nordic/**/*" + - "subsys/dfu/**/*" + - "subsys/net/**/*" + - "subsys/settings/**/*" + +"CI-wifi": + - "subsys/net/l2/wifi/**/*" + - "subsys/net/l2/ethernet/**/*" + +"CI-audio-test": + - "boards/nordic/nrf5340_audio_dk/**/*" + - "drivers/flash/**/*" + - "drivers/spi/**/*" + - "drivers/gpio/**/*" + - "drivers/i2c/**/*" + - "drivers/watchdog/**/*" + - "include/dfu/**/*" + - "include/mgmt/mcumgr/**/*" + - "samples/bluetooth/hci_ipc/**/*" + - "soc/nordic/**/*" + - "subsys/bluetooth/audio/**/*" + - "subsys/bluetooth/host/**/*" + - "subsys/dfu/**/*" + - "subsys/fs/**/*" + - "subsys/mgmt/mcumgr/**/*" + - "subsys/sd/**/*" + - "subsys/storage/**/*" + - "subsys/task_wdt/**/*" + - "subsys/usb/**/*" + - "subsys/zbus/**/*" + +"CI-pmic-samples-test": + - "samples/shields/npm1300_ek/**/*" + - "boards/shields/npm1300_ek/**/*" + - "**/**npm1300**/**" + - "drivers/regulator/regulator_common.c" + - "drivers/regulator/regulator_shell.c" + - "drivers/gpio/gpio_shell.c" + - "drivers/sensor/sensor_shell.c" + +"CI-test-low-level": + - "arch/**/*" + - "boards/nordic/nrf54*/**/*" + - "drivers/**/*" + - "dts/**/*" + - "include/zephyr/**/*" + - "kernel/**/*" + - "modules/hal_nordic/**/*" + - "samples/basic/blinky_pwm/**/*" + - "samples/basic/fade_led/**/*" + - "samples/boards/nrf/**/*" + - "samples/boards/nordic/**/*" + - "samples/drivers/adc/**/*" + - "samples/drivers/jesd216/**/*" + - "samples/drivers/mbox/**/*" + - "samples/drivers/soc_flash_nrf/**/*" + - "samples/drivers/spi_flash/**/*" + - "samples/drivers/watchdog/**/*" + - "samples/hello_world/**/*" + - "samples/sensor/**/*" + - "samples/subsys/ipc/**/*" + - "samples/subsys/logging/**/*" + - "samples/subsys/settings/**/*" + - "samples/subsys/usb/cdc_acm/**/*" + - "samples/subsys/usb/mass/**/*" + - "samples/synchronization/**/*" + - "subsys/logging/**/*" + - "subsys/settings/**/*" + - "tests/arch/**/*" + - "tests/boards/nrf/**/*" + - "tests/boards/nordic/**/*" + - "tests/drivers/**/*" + - "tests/kernel/**/*" + +"CI-suit-dfu-test": + - "subsys/mgmt/mcumgr/**/*" + - "include/mgmt/mcumgr/**/*" + - "samples/subsys/mgmt/mcumgr/smp_svr/**/*" + - "subsys/bluetooth/**/*" + - "drivers/bluetooth/**/*" + - "drivers/flash/**/*" + - "drivers/spi/**/*" + - "drivers/mbox/**/*" + - "drivers/serial/**/*" + - "drivers/console/**/*" + - "drivers/gpio/**/*" + - "dts/common/nordic/*" + - "dts/arm/nordic/nrf54h*/**/*" + - "dts/riscv/nordic/nrf54h*/**/*" + - "boards/nordic/nrf54h*/**/*" + - "soc/nordic/nrf54h/**/*" + - "include/zephyr/**/*" + - "subsys/logging/**/*" + - "subsys/tracing/**/*" + - "scripts/west_commands/build.py" + - "scripts/west_commands/flash.py" + - "scripts/west_commands/runners/nrfutil.py" + - "scripts/west_commands/runners/core.py" + - "scripts/west_commands/runners/nrf_common.py" From aca4aa4300d651bb107897467b8d8f57f63efb39 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Thu, 1 Jun 2023 15:58:56 +0200 Subject: [PATCH 1600/2141] [nrf noup] tests: drivers: build_all: regulator: use old schema New Twister schema is not supported yet in sdk-zephyr, drop this patch once Twister is updated. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit e6f28400604c1307aa5768438749b9686e891947) --- tests/drivers/build_all/regulator/testcase.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/drivers/build_all/regulator/testcase.yaml b/tests/drivers/build_all/regulator/testcase.yaml index 30d494aca231..b662f0ac2050 100644 --- a/tests/drivers/build_all/regulator/testcase.yaml +++ b/tests/drivers/build_all/regulator/testcase.yaml @@ -3,9 +3,7 @@ tests: drivers.regulator.build: - tags: - - drivers - - regulator + tags: drivers regulator build_only: true platform_allow: - native_sim From ff472df6b01f3112348863cc54dbb7c806605b31 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Mon, 19 Jun 2023 12:19:05 +0200 Subject: [PATCH 1601/2141] [nrf noup] Revert "twister: Use natural sort when generating hardware map" This reverts commit c37deeb0c4602dc3eeb700a7dc3ed317283fff17. This is only a temporary change, until we align our CI. To be removed once natsort is avaialble in the NCS CI. Signed-off-by: Robert Lubos (cherry picked from commit 0250cd1c9fb33c0d9b5da883b24bdfdb7df522c2) --- scripts/pylib/twister/twisterlib/hardwaremap.py | 2 +- scripts/requirements-run-test.txt | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/pylib/twister/twisterlib/hardwaremap.py b/scripts/pylib/twister/twisterlib/hardwaremap.py index 74c384ab5d6e..6deca0ac4adf 100644 --- a/scripts/pylib/twister/twisterlib/hardwaremap.py +++ b/scripts/pylib/twister/twisterlib/hardwaremap.py @@ -386,7 +386,7 @@ def save(self, hwm_file): boot_ids = [] # use existing map - self.detected = natsorted(self.detected, key=lambda x: x.serial or '') + self.detected.sort(key=lambda x: x.serial or '') if os.path.exists(hwm_file): with open(hwm_file) as yaml_file: hwm = yaml.load(yaml_file, Loader=SafeLoader) diff --git a/scripts/requirements-run-test.txt b/scripts/requirements-run-test.txt index 6c3f3d93cf8d..4faa17b7b659 100644 --- a/scripts/requirements-run-test.txt +++ b/scripts/requirements-run-test.txt @@ -7,7 +7,6 @@ pyocd>=0.35.0 # used by twister for board/hardware map tabulate -natsort # used by mcuboot cbor>=1.0.0 From 716c5e9b4a26bcd2b5fded110a94212188de75d0 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Thu, 3 Mar 2022 15:28:16 +0100 Subject: [PATCH 1602/2141] [nrf noup] doc: remove Kconfig search Kconfig search is handled in a separate docset in NCS, so remove the page. This is a long-term noup patch. Signed-off-by: Gerard Marull-Paretas Signed-off-by: Krishna T (cherry picked from commit 68cba0c8e64da160f49c2296ef956fe1512369d9) --- MAINTAINERS.yml | 1 - doc/build/kconfig/setting.rst | 6 ++---- doc/develop/application/index.rst | 5 ++--- doc/kconfig.rst | 8 -------- 4 files changed, 4 insertions(+), 16 deletions(-) delete mode 100644 doc/kconfig.rst diff --git a/MAINTAINERS.yml b/MAINTAINERS.yml index 0160330ac59f..aa0718740df8 100644 --- a/MAINTAINERS.yml +++ b/MAINTAINERS.yml @@ -1147,7 +1147,6 @@ Documentation: - doc/images/Zephyr-Kite-in-tree.png - doc/index-tex.rst - doc/index.rst - - doc/kconfig.rst - doc/templates/sample.tmpl - doc/templates/board.tmpl - boards/index.rst diff --git a/doc/build/kconfig/setting.rst b/doc/build/kconfig/setting.rst index ad62d86eb3d4..6fe1feaed7d3 100644 --- a/doc/build/kconfig/setting.rst +++ b/doc/build/kconfig/setting.rst @@ -7,8 +7,7 @@ The :ref:`menuconfig and guiconfig interfaces ` can be used to test out configurations during application development. This page explains how to make settings permanent. -All Kconfig options can be searched in the :ref:`Kconfig search page -`. +All Kconfig options can be searched in the Kconfig search page. .. note:: @@ -115,8 +114,7 @@ Assignments in configuration files are only respected if the dependencies for the symbol are satisfied. A warning is printed otherwise. To figure out what the dependencies of a symbol are, use one of the :ref:`interactive configuration interfaces ` (you can jump directly to a symbol with -:kbd:`/`), or look up the symbol in the :ref:`Kconfig search page -`. +:kbd:`/`), or look up the symbol in the Kconfig search page. .. _initial-conf: diff --git a/doc/develop/application/index.rst b/doc/develop/application/index.rst index c28fa011f3cc..4f8b5f868a56 100644 --- a/doc/develop/application/index.rst +++ b/doc/develop/application/index.rst @@ -649,9 +649,8 @@ started. See :ref:`setting_configuration_values` for detailed documentation on setting Kconfig configuration values. The :ref:`initial-conf` section on the same page -explains how the initial configuration is derived. See :ref:`kconfig-search` -for a complete list of configuration options. -See :ref:`hardening` for security information related with Kconfig options. +explains how the initial configuration is derived. See :ref:`hardening` for +security information related with Kconfig options. The other pages in the :ref:`Kconfig section of the manual ` are also worth going through, especially if you planning to add new configuration diff --git a/doc/kconfig.rst b/doc/kconfig.rst deleted file mode 100644 index 1123de2adbd9..000000000000 --- a/doc/kconfig.rst +++ /dev/null @@ -1,8 +0,0 @@ -:orphan: - -.. _kconfig-search: - -Kconfig Search -============== - -.. kconfig:search:: From a0ff1f3329a75b9cb867a8d5326f85428f2775de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Audun=20Kvamtr=C3=B8?= Date: Thu, 13 Jan 2022 11:37:18 +0100 Subject: [PATCH 1603/2141] [nrf noup] modules: tf-m: use of PSA_HAS_XXXX_SUPPORT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -This allows configurations enabled by PSA_WANTS_ALG_XXXX to be used to control which TF-M module is enabled -If the TF-M image doesn't support e.g. the MAC APIs, then the MAC interface is not enabled Note: This functionality requires that nrf_security is enabled ref: NCSDK-11689 Make TF-M crypto module depend on PSA_WANT_GENERATE_RANDOM, same as all other crypto modules, which have PSA_HAS to group all PSA features that require the module. This makes TF-M by default exclude the RNG module when not needed. Signed-off-by: Frank Audun Kvamtrø Signed-off-by: Joakim Andersson (cherry picked from commit 5620a796e91d9e65c6a02d7585ca8909eb674c77) --- modules/trusted-firmware-m/Kconfig.tfm.crypto_modules | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/modules/trusted-firmware-m/Kconfig.tfm.crypto_modules b/modules/trusted-firmware-m/Kconfig.tfm.crypto_modules index 1d70a2c44d29..02d3580c22f3 100644 --- a/modules/trusted-firmware-m/Kconfig.tfm.crypto_modules +++ b/modules/trusted-firmware-m/Kconfig.tfm.crypto_modules @@ -10,6 +10,7 @@ if TFM_PARTITION_CRYPTO config TFM_CRYPTO_RNG_MODULE_ENABLED bool "Random number generator crypto module" default y + depends on PSA_WANT_GENERATE_RANDOM && NRF_SECURITY help Enables the random number generator module within the crypto partition. Unset this option if 'psa_generate_random' is not used. @@ -17,6 +18,7 @@ config TFM_CRYPTO_RNG_MODULE_ENABLED config TFM_CRYPTO_KEY_MODULE_ENABLED bool "KEY crypto module" default y + depends on PSA_HAS_KEY_SUPPORT && NRF_SECURITY help Enables the KEY crypto module within the crypto partition. Unset this option if the functionality provided by 'crypto_key_management.c' @@ -25,6 +27,7 @@ config TFM_CRYPTO_KEY_MODULE_ENABLED config TFM_CRYPTO_AEAD_MODULE_ENABLED bool "AEAD crypto module" default y + depends on PSA_HAS_AEAD_SUPPORT && NRF_SECURITY help Enables the AEAD crypto module within the crypto partition. Unset this option if the functionality provided by 'crypto_aead.c' @@ -33,6 +36,7 @@ config TFM_CRYPTO_AEAD_MODULE_ENABLED config TFM_CRYPTO_MAC_MODULE_ENABLED bool "MAC crypto module" default y + depends on PSA_HAS_MAC_SUPPORT && NRF_SECURITY help Enables the MAC crypto module within the crypto partition. Unset this option if the functionality provided by 'crypto_mac.c' @@ -41,6 +45,7 @@ config TFM_CRYPTO_MAC_MODULE_ENABLED config TFM_CRYPTO_HASH_MODULE_ENABLED bool "HASH crypto module" default y + depends on PSA_HAS_HASH_SUPPORT && NRF_SECURITY help Enables the HASH crypto module within the crypto partition. Unset this option if the functionality provided by 'crypto_hash.c' @@ -49,6 +54,7 @@ config TFM_CRYPTO_HASH_MODULE_ENABLED config TFM_CRYPTO_CIPHER_MODULE_ENABLED bool "CIPHER crypto module" default y + depends on PSA_HAS_CIPHER_SUPPORT && NRF_SECURITY help Enables the CIPHER crypto module within the crypto partition. Unset this option if the functionality provided by 'crypto_cipher.c' @@ -57,6 +63,7 @@ config TFM_CRYPTO_CIPHER_MODULE_ENABLED config TFM_CRYPTO_ASYM_ENCRYPT_MODULE_ENABLED bool "ASYM ENCRYPT crypto module" default y + depends on PSA_HAS_ASYM_ENCRYPT_SUPPORT && NRF_SECURITY help Enables the ASYM ENCRYPT crypto module within the crypto partition. Unset this option if the encrypt functionality provided by 'crypto_asymmetric.c' @@ -65,6 +72,7 @@ config TFM_CRYPTO_ASYM_ENCRYPT_MODULE_ENABLED config TFM_CRYPTO_ASYM_SIGN_MODULE_ENABLED bool "ASYM SIGN crypto module" default y + depends on PSA_HAS_ASYM_SIGN_SUPPORT && NRF_SECURITY help Enables the ASYM SIGN crypto module within the crypto partition. Unset this option if the sign functionality provided by 'crypto_asymmetric.c' @@ -73,10 +81,12 @@ config TFM_CRYPTO_ASYM_SIGN_MODULE_ENABLED config TFM_CRYPTO_KEY_DERIVATION_MODULE_ENABLED bool "KEY DERIVATION crypto module" default y + depends on (PSA_HAS_KEY_DERIVATION || PSA_HAS_KEY_AGREEMENT) && NRF_SECURITY help Enables the KEY_DERIVATION crypto module within the crypto partition. Unset this option if the functionality provided by 'crypto_key_derivation.c' is not used. + Note that key agreement is under key derivation in the current implementation. endif # TFM_PARTITION_CRYPTO From dc050eeef949980dad25776d5daeb670a0a80636 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B8e?= Date: Sat, 29 Jan 2022 13:03:08 +0100 Subject: [PATCH 1604/2141] [nrf noup] modules: mbedtls: Allow MBEDTLS_BUILTIN to be deselected MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Out-of-tree crypto subsystems need to deselect MBEDTLS_BUILTIN, but deselection is not supported. It is however supported to select a dependency in a ! expression. Signed-off-by: Sebastian Bøe (cherry picked from commit 0556e7f7d3e2e046bb334ef2133c071179caf189) --- modules/mbedtls/Kconfig | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/mbedtls/Kconfig b/modules/mbedtls/Kconfig index bf165473f17f..f7bc6a609f1f 100644 --- a/modules/mbedtls/Kconfig +++ b/modules/mbedtls/Kconfig @@ -29,6 +29,7 @@ choice MBEDTLS_IMPLEMENTATION config MBEDTLS_BUILTIN bool "Use Zephyr in-tree mbedTLS version" + depends on ! DISABLE_MBEDTLS_BUILTIN help Link with mbedTLS sources included with Zephyr distribution. Included mbedTLS version is well integrated with and supported @@ -42,6 +43,11 @@ config MBEDTLS_LIBRARY endchoice +# subsystems cannot deselect MBEDTLS_BUILTIN, but they can select +# DISABLE_MBEDTLS_BUILTIN. +config DISABLE_MBEDTLS_BUILTIN + bool + config CUSTOM_MBEDTLS_CFG_FILE bool "Custom mbed TLS configuration file" help From 5be6dd73315cb8d04f7dd916c992ee3bfa73fd76 Mon Sep 17 00:00:00 2001 From: Georgios Vasilakis Date: Mon, 12 Feb 2024 14:30:23 +0100 Subject: [PATCH 1605/2141] [nrf noup] modules: mbedtls: Add include folders We moved the header files in sdk-mbedtls from the library folder to the include/library folder. This was done to avoid issues when building MbedTLS with the nrf_security module and the Oberon PSA core. The Oberon PSA core provides a subset of these header files and since they are included with quotes we cannot have them in the same directory. This change make the needed adaptions in CMake for the applications that don't use nrf_security. Signed-off-by: Georgios Vasilakis Signed-off-by: Markus Swarowsky (cherry picked from commit a3505ca86f9f4bb9a1d33116259bb2d7e08196db) --- modules/mbedtls/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/mbedtls/CMakeLists.txt b/modules/mbedtls/CMakeLists.txt index 83a8cb674a5e..7e16f0de2514 100644 --- a/modules/mbedtls/CMakeLists.txt +++ b/modules/mbedtls/CMakeLists.txt @@ -40,6 +40,8 @@ zephyr_interface_library_named(mbedTLS) # Add regular includes target_include_directories(mbedTLS INTERFACE ${ZEPHYR_CURRENT_MODULE_DIR}/include + ${ZEPHYR_CURRENT_MODULE_DIR}/include/library + ${ZEPHYR_CURRENT_MODULE_DIR}/library configs include ) From fb017044d258fc23441928f367b33beeb82565c3 Mon Sep 17 00:00:00 2001 From: Dominik Ermel Date: Thu, 13 Jul 2023 13:42:10 +0000 Subject: [PATCH 1606/2141] [nrf noup] drivers/flashdisk: Add support for Partition Manager The commits adds support for generating flash disks from Partition Manager defined partitions. Signed-off-by: Dominik Ermel (cherry picked from commit a01de066f17e286537b4979a04ca69c286806bc9) --- drivers/disk/flashdisk.c | 78 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/drivers/disk/flashdisk.c b/drivers/disk/flashdisk.c index 1ac3d15ba62f..4d8e3f1eee01 100644 --- a/drivers/disk/flashdisk.c +++ b/drivers/disk/flashdisk.c @@ -469,6 +469,8 @@ static const struct disk_operations flash_disk_ops = { .ioctl = disk_flash_access_ioctl, }; +#ifndef USE_PARTITION_MANAGER +/* The non-Partition manager, DTS based generators below */ #define DT_DRV_COMPAT zephyr_flash_disk #define PARTITION_PHANDLE(n) DT_PHANDLE_BY_IDX(DT_DRV_INST(n), partition, 0) @@ -510,6 +512,82 @@ DT_INST_FOREACH_STATUS_OKAY(VERIFY_CACHE_SIZE_IS_NOT_ZERO_IF_NOT_READ_ONLY) "Devicetree node " DT_NODE_PATH(DT_DRV_INST(n)) \ " has cache size which is not a multiple of its sector size"); DT_INST_FOREACH_STATUS_OKAY(VERIFY_CACHE_SIZE_IS_MULTIPLY_OF_SECTOR_SIZE) +#else /* ifndef USE_PARTITION_MANAGER */ +/* Partition Manager based generators below */ + +/* Gets the PM_..._EXTRA_PARAM_##param value */ +#define PM_FLASH_DISK_ENTRY_EXTRA_PARAM(name, param) PM_##name##_EXTRA_PARAM_disk_##param + +/* Gets the PM_..._NAME value which is originally cased, as in yaml, partition name */ +#define PM_FLASH_DISK_ENTRY_PARTITION_NAME(name) PM_##name##_NAME + +/* Generates flashdiskN_cache variable name, where N is partition ID */ +#define PM_FLASH_DISK_CACHE_VARIABLE(n) UTIL_CAT(flashdisk, UTIL_CAT(FIXED_PARTITION_ID(n), _cache)) + +/* Generate cache buffers */ +#define CACHE_SIZE(n) (COND_CODE_1(PM_FLASH_DISK_ENTRY_EXTRA_PARAM(n, read_only), (0), (1)) * \ + PM_FLASH_DISK_ENTRY_EXTRA_PARAM(n, cache_size)) +#define DEFINE_FLASHDISKS_CACHE(n) \ + static uint8_t __aligned(4) PM_FLASH_DISK_CACHE_VARIABLE(n)[CACHE_SIZE(n)]; + +PM_FOREACH_AFFILIATED_TO_disk(DEFINE_FLASHDISKS_CACHE) + +/* Generated single Flash Disk device data from Partition Manager partition. + * Partition is required to have type set to disk in partition definitions: + * type: disk + * and following extra params can be provided: + * extra_params: { + * name = "", + * cache_size = , + * sector_size = , + * read_only = + * } + * where: + * is mandatory device name that will be used by Disk Access and FAT FS to mount device; + * is cache r/w cache size, which is mandatory if read_only = 0 or not present, + * and should be multiple of ; + * is mandatory device sector size information, usually should be erase page size, + * for flash devices, for example 4096 bytes; + * read_only is optional, if not present then assumed false; can be 0(false) or 1(true). + */ +#define DEFINE_FLASHDISKS_DEVICE(n) \ +{ \ + .info = { \ + .ops = &flash_disk_ops, \ + .name = STRINGIFY(PM_FLASH_DISK_ENTRY_EXTRA_PARAM(n, name)), \ + }, \ + .area_id = FIXED_PARTITION_ID(n), \ + .offset = FIXED_PARTITION_OFFSET(n), \ + .cache = PM_FLASH_DISK_CACHE_VARIABLE(n), \ + .cache_size = sizeof(PM_FLASH_DISK_CACHE_VARIABLE(n)), \ + .size = FIXED_PARTITION_SIZE(n), \ + .sector_size = PM_FLASH_DISK_ENTRY_EXTRA_PARAM(n, sector_size), \ +}, + +/* The bellow used PM_FOREACH_TYPE_disk is generated by Partition Manager foreach + * loop macro. The lower case _disk is type name for which the macro has been generated; + * partition entry can have multiple types set and foreach macro will be generated + * for every type found across partition definitions. + */ +static struct flashdisk_data flash_disks[] = { + PM_FOREACH_AFFILIATED_TO_disk(DEFINE_FLASHDISKS_DEVICE) +}; + +#define VERIFY_CACHE_SIZE_IS_NOT_ZERO_IF_NOT_READ_ONLY(n) \ + COND_CODE_1(PM_FLASH_DISK_ENTRY_EXTRA_PARAM(n, read_only), \ + (/* cache-size is not used for read-only disks */), \ + (BUILD_ASSERT(PM_FLASH_DISK_ENTRY_EXTRA_PARAM(n, cache_size) != 0, \ + "Flash disk partition " STRINGIFY(PM_FLASH_DISK_ENTRY_PARTITION_NAME(n))\ + " must have non-zero cache-size");)) +PM_FOREACH_AFFILIATED_TO_disk(VERIFY_CACHE_SIZE_IS_NOT_ZERO_IF_NOT_READ_ONLY) + +#define VERIFY_CACHE_SIZE_IS_MULTIPLY_OF_SECTOR_SIZE(n) \ + BUILD_ASSERT(PM_FLASH_DISK_ENTRY_EXTRA_PARAM(n, cache_size) % \ + PM_FLASH_DISK_ENTRY_EXTRA_PARAM(n, sector_size) == 0, \ + "Devicetree node " STRINGIFY(PM_FLASH_DISK_ENTRY_PARTITION_NAME(n)) \ + " has cache size which is not a multiple of its sector size"); +PM_FOREACH_AFFILIATED_TO_disk(VERIFY_CACHE_SIZE_IS_MULTIPLY_OF_SECTOR_SIZE) +#endif /* USE_PARTITION_MANAGER */ static int disk_flash_init(void) { From 28efd426f71845642be5347c09d5418ac5dcf50a Mon Sep 17 00:00:00 2001 From: Marek Pieta Date: Fri, 5 May 2023 11:12:26 +0200 Subject: [PATCH 1607/2141] [nrf noup] mcumgr: img_mgmt: Fix check for chosen code partition The "zephyr-code-partition" chosen DTS node cannot be used when build uses Partition Manager. In that case, mcumgr must rely on the definitions provided by the Partition Manager. Jira: NCSDK-21381 Signed-off-by: Marek Pieta Signed-off-by: Dominik Ermel (cherry picked from commit 6b04ceee078c40901b3ddd15e821fde8333d5f5c) --- subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c index 7abcac8afad5..4c3975f3aad4 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c @@ -43,6 +43,23 @@ #if !defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_RAM_LOAD) +#if USE_PARTITION_MANAGER +#include + +#ifdef PM_MCUBOOT_SECONDARY_PAD_SIZE +BUILD_ASSERT(PM_MCUBOOT_PAD_SIZE == PM_MCUBOOT_SECONDARY_PAD_SIZE); +#endif + +#if CONFIG_BUILD_WITH_TFM + #define PM_ADDRESS_OFFSET (PM_MCUBOOT_PAD_SIZE + PM_TFM_SIZE) +#else + #define PM_ADDRESS_OFFSET (PM_MCUBOOT_PAD_SIZE) +#endif + +#define FIXED_PARTITION_IS_RUNNING_APP_PARTITION(label) \ + (FIXED_PARTITION_OFFSET(label) == (PM_ADDRESS - PM_ADDRESS_OFFSET)) + +#else /* ! USE_PARTITION_MANAGER */ #ifndef CONFIG_FLASH_LOAD_OFFSET #error MCUmgr requires application to be built with CONFIG_FLASH_LOAD_OFFSET set \ to be able to figure out application running slot. @@ -50,6 +67,7 @@ #define FIXED_PARTITION_IS_RUNNING_APP_PARTITION(label) \ (FIXED_PARTITION_OFFSET(label) == CONFIG_FLASH_LOAD_OFFSET) +#endif /* USE_PARTITION_MANAGER */ BUILD_ASSERT(sizeof(struct image_header) == IMAGE_HEADER_SIZE, "struct image_header not required size"); From 3903e0143b0ea8876ac0e4c40691a0f41de79865 Mon Sep 17 00:00:00 2001 From: Dominik Ermel Date: Thu, 23 Jun 2022 14:10:01 +0000 Subject: [PATCH 1608/2141] [nrf noup] mgmt/mcumgr: Bootutil hooks to handle image-1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The commit adds bootutil hook, for nrf5340, to allow it handling the non-accessible image-1/primary slot. Signed-off-by: Andrzej Głąbek Signed-off-by: Vinayak Kariappa Chettimada Signed-off-by: Johann Fischer Signed-off-by: Dominik Ermel Signed-off-by: Jamie McCrae (cherry picked from commit c82b5f3d3859c3aa32c1157bd4225a2186a47856) --- subsys/mgmt/mcumgr/CMakeLists.txt | 8 +++++ subsys/mgmt/mcumgr/Kconfig | 1 + .../mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c | 35 +++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c diff --git a/subsys/mgmt/mcumgr/CMakeLists.txt b/subsys/mgmt/mcumgr/CMakeLists.txt index 39d4a4ca8ce0..ad088eca0677 100644 --- a/subsys/mgmt/mcumgr/CMakeLists.txt +++ b/subsys/mgmt/mcumgr/CMakeLists.txt @@ -16,3 +16,11 @@ add_subdirectory(transport) add_subdirectory_ifdef(CONFIG_SMP_CLIENT smp_client) zephyr_library_link_libraries(mgmt_mcumgr) + +if (CONFIG_BOOT_IMAGE_ACCESS_HOOKS) + zephyr_include_directories( + ${ZEPHYR_MCUBOOT_MODULE_DIR}/boot/bootutil/include + ${ZEPHYR_MCUBOOT_MODULE_DIR}/boot/zephyr/include + ) + zephyr_library_sources(bootutil_hooks/nrf53_hooks.c) +endif() diff --git a/subsys/mgmt/mcumgr/Kconfig b/subsys/mgmt/mcumgr/Kconfig index 49bd17f46691..1c6a3a2a5162 100644 --- a/subsys/mgmt/mcumgr/Kconfig +++ b/subsys/mgmt/mcumgr/Kconfig @@ -6,6 +6,7 @@ menuconfig MCUMGR bool "mcumgr Support" depends on NET_BUF depends on ZCBOR + imply BOOT_IMAGE_ACCESS_HOOKS if (SOC_NRF5340_CPUAPP_QKAA && MCUMGR_GRP_IMG) help This option enables the mcumgr management library. diff --git a/subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c b/subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c new file mode 100644 index 000000000000..f1ac8a168e65 --- /dev/null +++ b/subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2022 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include "bootutil/bootutil_public.h" + +#if CONFIG_MCUBOOT_NETWORK_CORE_IMAGE_NUMBER != -1 +/* Sysbuild */ +#define NET_CORE_IMAGE CONFIG_MCUBOOT_NETWORK_CORE_IMAGE_NUMBER +#else +/* Legacy child/parent */ +#define NET_CORE_IMAGE 1 +#endif + +int boot_read_swap_state_primary_slot_hook(int image_index, + struct boot_swap_state *state) +{ + if (image_index == NET_CORE_IMAGE) { + /* Pretend that primary slot of image 1 unpopulated */ + state->magic = BOOT_MAGIC_UNSET; + state->swap_type = BOOT_SWAP_TYPE_NONE; + state->image_num = image_index; + state->copy_done = BOOT_FLAG_UNSET; + state->image_ok = BOOT_FLAG_UNSET; + + /* Prevent bootutil from trying to obtain true info */ + return 0; + } + + return BOOT_HOOK_REGULAR; +} From 5abb42e03682e4a02346b5f1b7eec151322fd5fe Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Mon, 16 Oct 2023 08:40:38 +0100 Subject: [PATCH 1609/2141] [nrf noup] samples: bluetooth: hci_pow_ctrl: Migrate child image config Migrates child image configuration for this sample over to sysbuild Signed-off-by: Jamie McCrae (cherry picked from commit 757558096a07cc71ee4afc0f6aebe766bbb61d01) --- samples/bluetooth/hci_pwr_ctrl/sysbuild/hci_rpmsg.conf | 1 + 1 file changed, 1 insertion(+) create mode 100644 samples/bluetooth/hci_pwr_ctrl/sysbuild/hci_rpmsg.conf diff --git a/samples/bluetooth/hci_pwr_ctrl/sysbuild/hci_rpmsg.conf b/samples/bluetooth/hci_pwr_ctrl/sysbuild/hci_rpmsg.conf new file mode 100644 index 000000000000..e6749ae63990 --- /dev/null +++ b/samples/bluetooth/hci_pwr_ctrl/sysbuild/hci_rpmsg.conf @@ -0,0 +1 @@ +CONFIG_BT_CTLR_TX_PWR_DYNAMIC_CONTROL=y From 55fe863e025f291e96a8f64a6ff4c8fd9b0be47b Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Mon, 16 Oct 2023 08:41:27 +0100 Subject: [PATCH 1610/2141] [nrf noup] samples: mgmt: mcumgr smp_svr: Migrate child image config Migrates child image configuration for this sample over to sysbuild Signed-off-by: Jamie McCrae (cherry picked from commit cda7620299116bde3df5639d50b9c1b9169ee1e3) --- .../subsys/mgmt/mcumgr/smp_svr/sysbuild/hci_rpmsg.conf | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 samples/subsys/mgmt/mcumgr/smp_svr/sysbuild/hci_rpmsg.conf diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/sysbuild/hci_rpmsg.conf b/samples/subsys/mgmt/mcumgr/smp_svr/sysbuild/hci_rpmsg.conf new file mode 100644 index 000000000000..98260877332f --- /dev/null +++ b/samples/subsys/mgmt/mcumgr/smp_svr/sysbuild/hci_rpmsg.conf @@ -0,0 +1,10 @@ +# +# Copyright (c) 2022 Nordic Semiconductor +# +# SPDX-License-Identifier: Apache-2.0 +# + +CONFIG_BT_MAX_CONN=2 +CONFIG_BT_BUF_ACL_RX_SIZE=502 +CONFIG_BT_BUF_ACL_TX_SIZE=502 +CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 From ae27bb6be606af5743363c62d69c54a05b3a7b68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Thu, 1 Dec 2022 14:41:13 +0100 Subject: [PATCH 1611/2141] [nrf noup] samples&tests: Restore a few CONFIG_NEWLIB_LIBC_NANO=n MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a follow-up to commit 9dd570f8a2207a02c886480b0065cd5a0e3a2e94. Since in NCS, unlike in vanilla Zephyr, the nano variant of newlib is the default one, restore entries that disable the nano variant in one sample and one test that require the full newlib variant. This patch is supposed to be removed when picolibc becomes the default. Signed-off-by: Andrzej Głąbek Signed-off-by: Dominik Ermel (cherry picked from commit a6e6112a4c064a3d280153bc8644236153105c0e) --- tests/lib/newlib/heap_listener/prj.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/lib/newlib/heap_listener/prj.conf b/tests/lib/newlib/heap_listener/prj.conf index e5a5dc6df4c1..7282777ff1ca 100644 --- a/tests/lib/newlib/heap_listener/prj.conf +++ b/tests/lib/newlib/heap_listener/prj.conf @@ -1,3 +1,4 @@ CONFIG_ZTEST=y CONFIG_NEWLIB_LIBC=y +CONFIG_NEWLIB_LIBC_NANO=n CONFIG_NEWLIB_LIBC_HEAP_LISTENER=y From d51d9114eb3248b1f7ada55410e17f2430fa549e Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Fri, 15 Dec 2023 07:57:14 +0000 Subject: [PATCH 1612/2141] [nrf noup] samples/tests: Disable PM for some sysbuild builds Disables partition manager when building some samples and tests which use sysbuild to prevent build issues Signed-off-by: Jamie McCrae (cherry picked from commit d1cb7a90e291f4b336ff4729bc5fa7923f228df5) --- samples/boards/nordic/nrf53_sync_rtc/sysbuild.conf | 1 + samples/drivers/mbox/sysbuild.conf | 1 + samples/subsys/ipc/ipc_service/icmsg/sysbuild.conf | 1 + samples/subsys/ipc/ipc_service/multi_endpoint/sysbuild.conf | 1 + samples/subsys/ipc/ipc_service/static_vrings/sysbuild.conf | 1 + samples/subsys/logging/multidomain/sysbuild.conf | 1 + tests/boot/mcuboot_recovery_retention/sysbuild.conf | 1 + tests/boot/test_mcuboot/sysbuild.conf | 1 + tests/drivers/flash/common/sysbuild.conf | 1 + tests/drivers/flash/negative_tests/sysbuild.conf | 1 + tests/subsys/fs/fcb/sysbuild.conf | 1 + tests/subsys/fs/littlefs/sysbuild.conf | 1 + 12 files changed, 12 insertions(+) create mode 100644 samples/boards/nordic/nrf53_sync_rtc/sysbuild.conf create mode 100644 samples/drivers/mbox/sysbuild.conf create mode 100644 samples/subsys/ipc/ipc_service/icmsg/sysbuild.conf create mode 100644 samples/subsys/ipc/ipc_service/multi_endpoint/sysbuild.conf create mode 100644 samples/subsys/ipc/ipc_service/static_vrings/sysbuild.conf create mode 100644 samples/subsys/logging/multidomain/sysbuild.conf create mode 100644 tests/drivers/flash/common/sysbuild.conf create mode 100644 tests/drivers/flash/negative_tests/sysbuild.conf create mode 100644 tests/subsys/fs/fcb/sysbuild.conf create mode 100644 tests/subsys/fs/littlefs/sysbuild.conf diff --git a/samples/boards/nordic/nrf53_sync_rtc/sysbuild.conf b/samples/boards/nordic/nrf53_sync_rtc/sysbuild.conf new file mode 100644 index 000000000000..6408669a8474 --- /dev/null +++ b/samples/boards/nordic/nrf53_sync_rtc/sysbuild.conf @@ -0,0 +1 @@ +SB_CONFIG_PARTITION_MANAGER=n diff --git a/samples/drivers/mbox/sysbuild.conf b/samples/drivers/mbox/sysbuild.conf new file mode 100644 index 000000000000..6408669a8474 --- /dev/null +++ b/samples/drivers/mbox/sysbuild.conf @@ -0,0 +1 @@ +SB_CONFIG_PARTITION_MANAGER=n diff --git a/samples/subsys/ipc/ipc_service/icmsg/sysbuild.conf b/samples/subsys/ipc/ipc_service/icmsg/sysbuild.conf new file mode 100644 index 000000000000..6408669a8474 --- /dev/null +++ b/samples/subsys/ipc/ipc_service/icmsg/sysbuild.conf @@ -0,0 +1 @@ +SB_CONFIG_PARTITION_MANAGER=n diff --git a/samples/subsys/ipc/ipc_service/multi_endpoint/sysbuild.conf b/samples/subsys/ipc/ipc_service/multi_endpoint/sysbuild.conf new file mode 100644 index 000000000000..6408669a8474 --- /dev/null +++ b/samples/subsys/ipc/ipc_service/multi_endpoint/sysbuild.conf @@ -0,0 +1 @@ +SB_CONFIG_PARTITION_MANAGER=n diff --git a/samples/subsys/ipc/ipc_service/static_vrings/sysbuild.conf b/samples/subsys/ipc/ipc_service/static_vrings/sysbuild.conf new file mode 100644 index 000000000000..6408669a8474 --- /dev/null +++ b/samples/subsys/ipc/ipc_service/static_vrings/sysbuild.conf @@ -0,0 +1 @@ +SB_CONFIG_PARTITION_MANAGER=n diff --git a/samples/subsys/logging/multidomain/sysbuild.conf b/samples/subsys/logging/multidomain/sysbuild.conf new file mode 100644 index 000000000000..6408669a8474 --- /dev/null +++ b/samples/subsys/logging/multidomain/sysbuild.conf @@ -0,0 +1 @@ +SB_CONFIG_PARTITION_MANAGER=n diff --git a/tests/boot/mcuboot_recovery_retention/sysbuild.conf b/tests/boot/mcuboot_recovery_retention/sysbuild.conf index 47f00ff3cff8..3b5b3c963800 100644 --- a/tests/boot/mcuboot_recovery_retention/sysbuild.conf +++ b/tests/boot/mcuboot_recovery_retention/sysbuild.conf @@ -1 +1,2 @@ SB_CONFIG_BOOTLOADER_MCUBOOT=y +SB_CONFIG_PARTITION_MANAGER=n diff --git a/tests/boot/test_mcuboot/sysbuild.conf b/tests/boot/test_mcuboot/sysbuild.conf index 47f00ff3cff8..3b5b3c963800 100644 --- a/tests/boot/test_mcuboot/sysbuild.conf +++ b/tests/boot/test_mcuboot/sysbuild.conf @@ -1 +1,2 @@ SB_CONFIG_BOOTLOADER_MCUBOOT=y +SB_CONFIG_PARTITION_MANAGER=n diff --git a/tests/drivers/flash/common/sysbuild.conf b/tests/drivers/flash/common/sysbuild.conf new file mode 100644 index 000000000000..6408669a8474 --- /dev/null +++ b/tests/drivers/flash/common/sysbuild.conf @@ -0,0 +1 @@ +SB_CONFIG_PARTITION_MANAGER=n diff --git a/tests/drivers/flash/negative_tests/sysbuild.conf b/tests/drivers/flash/negative_tests/sysbuild.conf new file mode 100644 index 000000000000..6408669a8474 --- /dev/null +++ b/tests/drivers/flash/negative_tests/sysbuild.conf @@ -0,0 +1 @@ +SB_CONFIG_PARTITION_MANAGER=n diff --git a/tests/subsys/fs/fcb/sysbuild.conf b/tests/subsys/fs/fcb/sysbuild.conf new file mode 100644 index 000000000000..6408669a8474 --- /dev/null +++ b/tests/subsys/fs/fcb/sysbuild.conf @@ -0,0 +1 @@ +SB_CONFIG_PARTITION_MANAGER=n diff --git a/tests/subsys/fs/littlefs/sysbuild.conf b/tests/subsys/fs/littlefs/sysbuild.conf new file mode 100644 index 000000000000..6408669a8474 --- /dev/null +++ b/tests/subsys/fs/littlefs/sysbuild.conf @@ -0,0 +1 @@ +SB_CONFIG_PARTITION_MANAGER=n From 9a699364bdd016c8c785da5ebbe341c81e7472c3 Mon Sep 17 00:00:00 2001 From: Markus Swarowsky Date: Thu, 29 Feb 2024 13:38:48 +0100 Subject: [PATCH 1613/2141] [nrf noup] modules: tfm: Add Kconfig for CRYPTO_PAKE_MODULE_ENABLED Add a Kconfig for th TFM_CRYPTO_PAKE_MODULE_ENABLED to support the PAKE APIs. noup as the PAKE support including the PAKE module doesn't exist yet in upstream TF-M as they depend on mbed TLS support for it Ref: NCSDK-22416 Signed-off-by: Markus Swarowsky (cherry picked from commit 821fa521c423a67c7ac013a36345241f7841e4a8) --- modules/trusted-firmware-m/Kconfig.tfm.crypto_modules | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/modules/trusted-firmware-m/Kconfig.tfm.crypto_modules b/modules/trusted-firmware-m/Kconfig.tfm.crypto_modules index 02d3580c22f3..9604319ca012 100644 --- a/modules/trusted-firmware-m/Kconfig.tfm.crypto_modules +++ b/modules/trusted-firmware-m/Kconfig.tfm.crypto_modules @@ -88,6 +88,17 @@ config TFM_CRYPTO_KEY_DERIVATION_MODULE_ENABLED is not used. Note that key agreement is under key derivation in the current implementation. +config TFM_CRYPTO_PAKE_MODULE_ENABLED + bool "PAKE crypto module" + default y + depends on PSA_HAS_PAKE_SUPPORT + depends on NRF_SECURITY + depends on PSA_CRYPTO_DRIVER_OBERON || PSA_CRYPTO_DRIVER_CRACEN + help + Enables the PAKE crypto module within the crypto partition. + Unset this option if the functionality provided by 'crypto_pake.c' + is not used. + endif # TFM_PARTITION_CRYPTO endif # BUILD_WITH_TFM From 4a86215a7cdb119e8ee18f616af8fb6a7c58107a Mon Sep 17 00:00:00 2001 From: Aleksandr Khromykh Date: Tue, 7 Feb 2023 12:39:12 +0100 Subject: [PATCH 1614/2141] [nrf noup] Bluetooth: Mesh: zero randomization for friend's adv Friend's replies on LPN's polls do not assume randomization in advertiser. Zero randomization will help to optimize time when LPN keeps receiving window open and save power. Signed-off-by: Aleksandr Khromykh Signed-off-by: Olivier Lesage (cherry picked from commit 71c24b8a084e7ae6290b678ce2e4418d75720a39) --- subsys/bluetooth/mesh/Kconfig | 2 +- subsys/bluetooth/mesh/adv_ext.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index 2c03c4e9ea3f..d39ea25616aa 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -1692,7 +1692,7 @@ config BT_MESH_LPN_INIT_POLL_TIMEOUT config BT_MESH_LPN_SCAN_LATENCY int "Latency for enabling scanning" range 0 50 - default 15 + default 2 help Latency in milliseconds that it takes to enable scanning. This is in practice how much time in advance before the Receive Window diff --git a/subsys/bluetooth/mesh/adv_ext.c b/subsys/bluetooth/mesh/adv_ext.c index b056f74a5876..7caff2f91d2b 100644 --- a/subsys/bluetooth/mesh/adv_ext.c +++ b/subsys/bluetooth/mesh/adv_ext.c @@ -13,6 +13,9 @@ #include #include #include +#if defined(CONFIG_BT_LL_SOFTDEVICE) +#include +#endif #include "common/bt_str.h" @@ -149,6 +152,28 @@ static inline struct bt_mesh_ext_adv *gatt_adv_get(void) } } +static int set_adv_randomness(uint8_t handle, int rand_us) +{ +#if defined(CONFIG_BT_LL_SOFTDEVICE) + struct net_buf *buf; + sdc_hci_cmd_vs_set_adv_randomness_t *cmd_params; + + buf = bt_hci_cmd_alloc(K_FOREVER); + if (!buf) { + LOG_ERR("Could not allocate command buffer"); + return -ENOMEM; + } + + cmd_params = net_buf_add(buf, sizeof(*cmd_params)); + cmd_params->adv_handle = handle; + cmd_params->rand_us = rand_us; + + return bt_hci_cmd_send_sync(SDC_HCI_OPCODE_CMD_VS_SET_ADV_RANDOMNESS, buf, NULL); +#else + return 0; +#endif /* defined(CONFIG_BT_LL_SOFTDEVICE) */ +} + static int adv_start(struct bt_mesh_ext_adv *ext_adv, const struct bt_le_adv_param *param, struct bt_le_ext_adv_start_param *start, @@ -542,6 +567,13 @@ int bt_mesh_adv_enable(void) if (err) { return err; } + + if (IS_ENABLED(CONFIG_BT_LL_SOFTDEVICE) && adv->tag & BT_MESH_FRIEND_ADV) { + err = set_adv_randomness(adv->instance->handle, 0); + if (err) { + LOG_ERR("Failed to set zero randomness: %d", err); + } + } } return 0; From 5012b87851726ecb8b23771122e69a52e45c273c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20Storr=C3=B8?= Date: Wed, 8 Mar 2023 12:17:09 +0100 Subject: [PATCH 1615/2141] [nrf noup] Bluetooth: Mesh: Fix adv randomness bug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes issue where randomness can be removed for advertising sets that have to handle other adv types than the BT_MESH_FRIEND_ADV tag type. Signed-off-by: Anders Storrø Signed-off-by: Aleksandr Khromykh Signed-off-by: Dominik Ermel (cherry picked from commit 43189afa7eec1ea93bd83e7c7fb2284779723402) --- subsys/bluetooth/mesh/adv_ext.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/subsys/bluetooth/mesh/adv_ext.c b/subsys/bluetooth/mesh/adv_ext.c index 7caff2f91d2b..0e6f6120f73f 100644 --- a/subsys/bluetooth/mesh/adv_ext.c +++ b/subsys/bluetooth/mesh/adv_ext.c @@ -568,8 +568,10 @@ int bt_mesh_adv_enable(void) return err; } - if (IS_ENABLED(CONFIG_BT_LL_SOFTDEVICE) && adv->tag & BT_MESH_FRIEND_ADV) { - err = set_adv_randomness(adv->instance->handle, 0); + if (IS_ENABLED(CONFIG_BT_LL_SOFTDEVICE) && + IS_ENABLED(CONFIG_BT_MESH_ADV_EXT_FRIEND_SEPARATE) && + advs[i].tags == BT_MESH_ADV_TAG_BIT_FRIEND) { + err = set_adv_randomness(advs[i].instance->handle, 0); if (err) { LOG_ERR("Failed to set zero randomness: %d", err); } From 75d9248327f898f7b60ce309c42097d545fbf21a Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Thu, 28 Mar 2024 15:04:41 +0100 Subject: [PATCH 1616/2141] [nrf noup] dfu/boot/mcuboot: fix confirmation in case of USE_PARTITION_MANAGER Active partition ID need to be extracted basing on PARTITION_MANAGER products. ref.:NCSDK-26693 Signed-off-by: Andrzej Puzdrowski Signed-off-by: Jamie McCrae (cherry picked from commit a6e4092bd9d38f7416f4387c446ac77da3a8a9d8) (cherry picked from commit b24d5100b9a635d4bb2bc2e041b5fdbc0ad452a0) --- subsys/dfu/boot/mcuboot.c | 47 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/subsys/dfu/boot/mcuboot.c b/subsys/dfu/boot/mcuboot.c index ad8ade044d41..70c746cf7ce1 100644 --- a/subsys/dfu/boot/mcuboot.c +++ b/subsys/dfu/boot/mcuboot.c @@ -58,8 +58,49 @@ enum IMAGE_INDEXES { IMAGE_INDEX_2 }; -#if defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_RAM_LOAD) || \ - defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_RAM_LOAD_WITH_REVERT) +#if USE_PARTITION_MANAGER +#include + +#if CONFIG_MCUBOOT_APPLICATION_IMAGE_NUMBER != -1 +/* Sysbuild */ +#ifdef CONFIG_MCUBOOT +/* lib is part of MCUboot -> operate on the primary application slot */ +#define ACTIVE_SLOT_FLASH_AREA_ID PM_MCUBOOT_PRIMARY_ID +#else +/* TODO: Add firmware loader support */ +/* lib is part of the app -> operate on active slot */ +#if defined(CONFIG_NCS_IS_VARIANT_IMAGE) +#define ACTIVE_SLOT_FLASH_AREA_ID PM_MCUBOOT_SECONDARY_ID +#else +#define ACTIVE_SLOT_FLASH_AREA_ID PM_MCUBOOT_PRIMARY_ID +#endif +#endif /* CONFIG_MCUBOOT */ +#else +/* Legacy child/parent */ +#if CONFIG_BUILD_WITH_TFM + #define PM_ADDRESS_OFFSET (PM_MCUBOOT_PAD_SIZE + PM_TFM_SIZE) +#else + #define PM_ADDRESS_OFFSET (PM_MCUBOOT_PAD_SIZE) +#endif + +#ifdef CONFIG_MCUBOOT + /* lib is part of MCUboot -> operate on the primary application slot */ + #define ACTIVE_SLOT_FLASH_AREA_ID PM_MCUBOOT_PRIMARY_ID +#else + /* lib is part of the App -> operate on active slot */ +#if (PM_ADDRESS - PM_ADDRESS_OFFSET) == PM_MCUBOOT_PRIMARY_ADDRESS + #define ACTIVE_SLOT_FLASH_AREA_ID PM_MCUBOOT_PRIMARY_ID +#elif (PM_ADDRESS - PM_ADDRESS_OFFSET) == PM_MCUBOOT_SECONDARY_ADDRESS + #define ACTIVE_SLOT_FLASH_AREA_ID PM_MCUBOOT_SECONDARY_ID +#else + #error Missing partition definitions. +#endif +#endif /* CONFIG_MCUBOOT */ +#endif /* CONFIG_MCUBOOT_APPLICATION_IMAGE_NUMBER != -1 */ + +#else + +#if defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_RAM_LOAD) /* For RAM LOAD mode, the active image must be fetched from the bootloader */ #define ACTIVE_SLOT_FLASH_AREA_ID boot_fetch_active_slot() #define INVALID_SLOT_ID 255 @@ -68,6 +109,8 @@ enum IMAGE_INDEXES { #define ACTIVE_SLOT_FLASH_AREA_ID DT_FIXED_PARTITION_ID(DT_CHOSEN(zephyr_code_partition)) #endif +#endif /* USE_PARTITION_MANAGER */ + /* * Raw (on-flash) representation of the v1 image header. */ From 8dd6a9c5f0b5ded320b9c8adb67f6adb36cf70e0 Mon Sep 17 00:00:00 2001 From: Sigurd Hellesvik Date: Tue, 26 Mar 2024 16:35:05 +0100 Subject: [PATCH 1617/2141] [nrf noup] modules: mbedtls: Use help for DISABLE_MBEDTLS_BUILTIN info Using a comment to explain Kconfig options make them invisible to Kconfig search. Use help instead. Signed-off-by: Sigurd Hellesvik (cherry picked from commit c289b579cd65da72777519d2305d1c7cf46ad609) --- modules/mbedtls/Kconfig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/mbedtls/Kconfig b/modules/mbedtls/Kconfig index f7bc6a609f1f..aa8c479e89f7 100644 --- a/modules/mbedtls/Kconfig +++ b/modules/mbedtls/Kconfig @@ -43,10 +43,11 @@ config MBEDTLS_LIBRARY endchoice -# subsystems cannot deselect MBEDTLS_BUILTIN, but they can select -# DISABLE_MBEDTLS_BUILTIN. config DISABLE_MBEDTLS_BUILTIN bool + help + Subsystems cannot deselect MBEDTLS_BUILTIN, but they can select + DISABLE_MBEDTLS_BUILTIN. config CUSTOM_MBEDTLS_CFG_FILE bool "Custom mbed TLS configuration file" From 3d15176b97cacaac6023894df77eeb716fde2525 Mon Sep 17 00:00:00 2001 From: Dominik Ermel Date: Wed, 27 Sep 2023 09:41:10 +0000 Subject: [PATCH 1618/2141] [nrf noup] test: schedule_api: Use Minimal C library There is no point to use PICOLIB here as it bloats the tests. Signed-off-by: Dominik Ermel (cherry picked from commit cbdf3c203fd490636e1e34ef134da580d5a42c9b) (cherry picked from commit 8cb54eb26cbce8c31af83154d863dd72bca036a4) --- tests/kernel/pipe/deprecated/pipe_api/prj.conf | 9 +++++++++ tests/kernel/sched/schedule_api/prj.conf | 1 + tests/kernel/sched/schedule_api/prj_multiq.conf | 1 + 3 files changed, 11 insertions(+) create mode 100644 tests/kernel/pipe/deprecated/pipe_api/prj.conf diff --git a/tests/kernel/pipe/deprecated/pipe_api/prj.conf b/tests/kernel/pipe/deprecated/pipe_api/prj.conf new file mode 100644 index 000000000000..df3270adfdf8 --- /dev/null +++ b/tests/kernel/pipe/deprecated/pipe_api/prj.conf @@ -0,0 +1,9 @@ +CONFIG_ZTEST=y +CONFIG_IRQ_OFFLOAD=y +CONFIG_TEST_USERSPACE=y +CONFIG_DYNAMIC_OBJECTS=y +CONFIG_MP_MAX_NUM_CPUS=1 +CONFIG_ZTEST_FATAL_HOOK=y +CONFIG_PIPES=y +CONFIG_DEPRECATION_TEST=y +CONFIG_MINIMAL_LIBC=y diff --git a/tests/kernel/sched/schedule_api/prj.conf b/tests/kernel/sched/schedule_api/prj.conf index a5ceef694331..8b649a3b7fca 100644 --- a/tests/kernel/sched/schedule_api/prj.conf +++ b/tests/kernel/sched/schedule_api/prj.conf @@ -7,3 +7,4 @@ CONFIG_MAX_THREAD_BYTES=6 CONFIG_TEST_USERSPACE=y CONFIG_MP_MAX_NUM_CPUS=1 CONFIG_ZTEST_FATAL_HOOK=y +CONFIG_MINIMAL_LIBC=y diff --git a/tests/kernel/sched/schedule_api/prj_multiq.conf b/tests/kernel/sched/schedule_api/prj_multiq.conf index c8dd4bf786bc..84c9d80ac619 100644 --- a/tests/kernel/sched/schedule_api/prj_multiq.conf +++ b/tests/kernel/sched/schedule_api/prj_multiq.conf @@ -7,3 +7,4 @@ CONFIG_MP_MAX_NUM_CPUS=1 CONFIG_ZTEST_FATAL_HOOK=y CONFIG_NUM_COOP_PRIORITIES=30 CONFIG_NUM_PREEMPT_PRIORITIES=40 +CONFIG_MINIMAL_LIBC=y From 968380d2ad7ae3e0aab22c3f58cd0e206daa9761 Mon Sep 17 00:00:00 2001 From: Jan Tore Guggedal Date: Mon, 18 May 2020 20:50:13 +0200 Subject: [PATCH 1619/2141] [nrf noup] net: mqtt: Provide option to enable TLS session caching Provides an option to enable TLS session caching for an MQTT client's secure socket. Signed-off-by: Jan Tore Guggedal Signed-off-by: Robert Lubos Signed-off-by: Dominik Ermel Signed-off-by: Johann Fischer (cherry picked from commit e15a1164f1ce13a1b67291fdc880e31d8cf63abd) --- include/zephyr/net/mqtt.h | 3 +++ subsys/net/lib/mqtt/mqtt_transport_socket_tls.c | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/include/zephyr/net/mqtt.h b/include/zephyr/net/mqtt.h index b992714afd32..d63cc1316249 100644 --- a/include/zephyr/net/mqtt.h +++ b/include/zephyr/net/mqtt.h @@ -763,6 +763,9 @@ struct mqtt_sec_config { uint32_t alpn_protocol_name_count; #endif + /** Indicates the preference for enabling TLS session caching. */ + int session_cache; + /** Peer hostname for ceritificate verification. * May be NULL to skip hostname verification. */ diff --git a/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c b/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c index 2ff337eef343..68a101e6c846 100644 --- a/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c +++ b/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c @@ -109,6 +109,16 @@ int mqtt_client_tls_connect(struct mqtt_client *client) } } + if (tls_config->session_cache == TLS_SESSION_CACHE_ENABLED) { + ret = zsock_setsockopt(client->transport.tls.sock, SOL_TLS, + TLS_SESSION_CACHE, + &tls_config->session_cache, + sizeof(tls_config->session_cache)); + if (ret < 0) { + goto error; + } + } + if (tls_config->cert_nocopy != TLS_CERT_NOCOPY_NONE) { ret = zsock_setsockopt(client->transport.tls.sock, SOL_TLS, TLS_CERT_NOCOPY, &tls_config->cert_nocopy, From 086e7014f834da9b7bc8f34999c68a1c4a0756bb Mon Sep 17 00:00:00 2001 From: Mirko Covizzi Date: Thu, 10 Mar 2022 00:25:50 -0800 Subject: [PATCH 1620/2141] [nrf noup] net: mqtt: add native TLS support This commit adds an extra parameter in the configuration structure to configure native TLS support at runtime. Signed-off-by: Mirko Covizzi (cherry picked from commit 3fbd1c5c3c5217423087ea1075acc4b5b79ac330) --- doc/connectivity/networking/api/mqtt.rst | 3 +++ include/zephyr/net/mqtt.h | 3 +++ subsys/net/lib/mqtt/mqtt_transport_socket_tls.c | 7 ++++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/doc/connectivity/networking/api/mqtt.rst b/doc/connectivity/networking/api/mqtt.rst index 2775d77315b8..c2fb612e1cc2 100644 --- a/doc/connectivity/networking/api/mqtt.rst +++ b/doc/connectivity/networking/api/mqtt.rst @@ -150,6 +150,7 @@ additional configuration information: tls_config->sec_tag_list = m_sec_tags; tls_config->sec_tag_count = ARRAY_SIZE(m_sec_tags); tls_config->hostname = MQTT_BROKER_HOSTNAME; + tls_config->set_native_tls = true; In this sample code, the ``m_sec_tags`` array holds a list of tags, referencing TLS credentials that the MQTT library should use for authentication. We do not specify @@ -162,6 +163,8 @@ Note, that TLS credentials referenced by the ``m_sec_tags`` array must be registered in the system first. For more information on how to do that, refer to :ref:`secure sockets documentation `. +Finally, ``set_native_tls`` can be optionally set to enable native TLS support instead of offloading TLS operations to the modem. + An example of how to use TLS with MQTT is also present in :zephyr:code-sample:`mqtt-publisher` sample application. diff --git a/include/zephyr/net/mqtt.h b/include/zephyr/net/mqtt.h index d63cc1316249..797f8f339d7f 100644 --- a/include/zephyr/net/mqtt.h +++ b/include/zephyr/net/mqtt.h @@ -773,6 +773,9 @@ struct mqtt_sec_config { /** Indicates the preference for copying certificates to the heap. */ int cert_nocopy; + + /** Set socket to native TLS */ + bool set_native_tls; }; /** @brief MQTT transport type. */ diff --git a/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c b/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c index 68a101e6c846..617dec4b4d26 100644 --- a/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c +++ b/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c @@ -22,10 +22,15 @@ int mqtt_client_tls_connect(struct mqtt_client *client) { const struct sockaddr *broker = client->broker; struct mqtt_sec_config *tls_config = &client->transport.tls.config; + int type = SOCK_STREAM; int ret; + if (tls_config->set_native_tls) { + type |= SOCK_NATIVE_TLS; + } + client->transport.tls.sock = zsock_socket(broker->sa_family, - SOCK_STREAM, IPPROTO_TLS_1_2); + type, IPPROTO_TLS_1_2); if (client->transport.tls.sock < 0) { return -errno; } From 3215723c1db807ff79ab3daad09c81e64e57eafb Mon Sep 17 00:00:00 2001 From: Markus Swarowsky Date: Mon, 4 Dec 2023 15:27:08 +0100 Subject: [PATCH 1621/2141] [nrf noup] soc: arm: nRF53: Add SPU Flash/RAM alignment TF-M will uses SPU alignment during build time to make sure all partitions can be locked down with the SPU. So adding them for nRF53 Signed-off-by: Markus Swarowsky (cherry picked from commit bc60d5ca3563061a00c35873e3e5c225e6de3750) --- soc/nordic/nrf53/Kconfig | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/soc/nordic/nrf53/Kconfig b/soc/nordic/nrf53/Kconfig index 7260d5c7d66d..e326322044ad 100644 --- a/soc/nordic/nrf53/Kconfig +++ b/soc/nordic/nrf53/Kconfig @@ -167,12 +167,26 @@ config NRF_SPU_FLASH_REGION_SIZE help FLASH region size for the NRF_SPU peripheral +config NRF_SPU_FLASH_REGION_ALIGNMENT + hex + default 0x4000 + help + FLASH regions must be aligned to this value due to SPU HW + limitations. + config NRF_SPU_RAM_REGION_SIZE hex default 0x2000 help RAM region size for the NRF_SPU peripheral +config NRF_SPU_RAM_REGION_ALIGNMENT + hex + default 0x2000 + help + RAM regions must be aligned to this value due to SPU HW + limitations. + config SOC_NRF_GPIO_FORWARDER_FOR_NRF5340 bool "Forward GPIO pins to network core" depends on NRF_SOC_SECURE_SUPPORTED From ae5c8b84c976df506f0f21c4abd5379a9496fee6 Mon Sep 17 00:00:00 2001 From: Markus Swarowsky Date: Mon, 4 Dec 2023 15:27:14 +0100 Subject: [PATCH 1622/2141] [nrf noup] soc: arm: nRF91: Add SPU Flash/RAM alignment TF-M will uses SPU alignment during build time to make sure all partitions can be locked down with the SPU. So adding them for nRF91 The nRF54L15 doesn't use the SPU for setting the security attributes for flash/RAM regions. In order to avoid having multiple Kconfigs with similar meaning renamed the alignment Kconfig option to something more generic in order to use the same symbol for all the TrustZone enabled devices. Ref: NCSDK-25023 Signed-off-by: Markus Swarowsky Signed-off-by: Georgios Vasilakis (cherry picked from commit a562d9663033995572b1e3269c687cbb343773e0) --- soc/nordic/nrf53/Kconfig | 22 ++++++++++++++-------- soc/nordic/nrf91/Kconfig | 20 ++++++++++++++++++++ 2 files changed, 34 insertions(+), 8 deletions(-) diff --git a/soc/nordic/nrf53/Kconfig b/soc/nordic/nrf53/Kconfig index e326322044ad..6e53dc277c65 100644 --- a/soc/nordic/nrf53/Kconfig +++ b/soc/nordic/nrf53/Kconfig @@ -167,12 +167,15 @@ config NRF_SPU_FLASH_REGION_SIZE help FLASH region size for the NRF_SPU peripheral -config NRF_SPU_FLASH_REGION_ALIGNMENT +config NRF_TRUSTZONE_FLASH_REGION_SIZE hex - default 0x4000 + default NRF_SPU_FLASH_REGION_SIZE help - FLASH regions must be aligned to this value due to SPU HW - limitations. + Define the flash region size from a TrustZone perspective. + This is used when we set the security attributes(S/NSC/NS) of a region + in TrustZone enabled devices. + In practice this option defines the granularity of the security attributes, + i.e. the smallest region that can be set to secure or non-secure. config NRF_SPU_RAM_REGION_SIZE hex @@ -180,12 +183,15 @@ config NRF_SPU_RAM_REGION_SIZE help RAM region size for the NRF_SPU peripheral -config NRF_SPU_RAM_REGION_ALIGNMENT +config NRF_TRUSTZONE_RAM_REGION_SIZE hex - default 0x2000 + default NRF_SPU_RAM_REGION_SIZE help - RAM regions must be aligned to this value due to SPU HW - limitations. + Define the RAM region size from a TrustZone perspective. + This is used when we set the security attributes(S/NSC/NS) of a region + in TrustZone enabled devices. + In practice this option defines the granularity of the security attributes, + i.e. the smallest region that can be set to secure or non-secure. config SOC_NRF_GPIO_FORWARDER_FOR_NRF5340 bool "Forward GPIO pins to network core" diff --git a/soc/nordic/nrf91/Kconfig b/soc/nordic/nrf91/Kconfig index ed38eff73a2d..9f55cdd77ed9 100644 --- a/soc/nordic/nrf91/Kconfig +++ b/soc/nordic/nrf91/Kconfig @@ -24,6 +24,16 @@ config NRF_SPU_FLASH_REGION_SIZE help FLASH region size for the NRF_SPU peripheral +config NRF_TRUSTZONE_FLASH_REGION_SIZE + hex + default NRF_SPU_FLASH_REGION_SIZE + help + Define the flash region size from a TrustZone perspective. + This is used when we set the security attributes(S/NSC/NS) of a region + in TrustZone enabled devices. + In practice this option defines the granularity of the security attributes, + i.e. the smallest region that can be set to secure or non-secure. + config NRF_SPU_RAM_REGION_SIZE hex default 0x2000 @@ -34,4 +44,14 @@ config NRF_ENABLE_ICACHE bool "Instruction cache (I-Cache)" default y +config NRF_TRUSTZONE_RAM_REGION_SIZE + hex + default NRF_SPU_RAM_REGION_SIZE + help + Define the RAM region size from a TrustZone perspective. + This is used when we set the security attributes(S/NSC/NS) of a region + in TrustZone enabled devices. + In practice this option defines the granularity of the security attributes, + i.e. the smallest region that can be set to secure or non-secure. + endif # SOC_SERIES_NRF91X From 2c0983924caa07a59769730edb15177387c2b4a8 Mon Sep 17 00:00:00 2001 From: Marek Pieta Date: Mon, 14 Nov 2022 11:22:06 +0100 Subject: [PATCH 1623/2141] [nrf noup] boards: thingy53_nrf5340: Add common partition map Change introduces common static Partition Manager configuration. The tfm_nonsecure partition must be SPU region aligned. Ref: NCSDK-18033 Ref: NCSDK-19515 Signed-off-by: Marek Pieta Signed-off-by: Markus Swarowsky (cherry picked from commit afef9ef461a574f57a785bf220060468ad3ebbde) --- .../pm_static_thingy53_nrf5340_cpuapp.yml | 55 ++++++++++++++ .../pm_static_thingy53_nrf5340_cpuapp_ns.yml | 73 +++++++++++++++++++ 2 files changed, 128 insertions(+) create mode 100644 boards/nordic/thingy53/pm_static_thingy53_nrf5340_cpuapp.yml create mode 100644 boards/nordic/thingy53/pm_static_thingy53_nrf5340_cpuapp_ns.yml diff --git a/boards/nordic/thingy53/pm_static_thingy53_nrf5340_cpuapp.yml b/boards/nordic/thingy53/pm_static_thingy53_nrf5340_cpuapp.yml new file mode 100644 index 000000000000..7a48d51ec334 --- /dev/null +++ b/boards/nordic/thingy53/pm_static_thingy53_nrf5340_cpuapp.yml @@ -0,0 +1,55 @@ +app: + address: 0x10200 + region: flash_primary + size: 0xdfe00 +mcuboot: + address: 0x0 + region: flash_primary + size: 0x10000 +mcuboot_pad: + address: 0x10000 + region: flash_primary + size: 0x200 +mcuboot_primary: + address: 0x10000 + orig_span: &id001 + - mcuboot_pad + - app + region: flash_primary + size: 0xe0000 + span: *id001 +mcuboot_primary_app: + address: 0x10200 + orig_span: &id002 + - app + region: flash_primary + size: 0xdfe00 + span: *id002 +settings_storage: + address: 0xf0000 + region: flash_primary + size: 0x10000 +mcuboot_primary_1: + address: 0x0 + size: 0x40000 + device: flash_ctrl + region: ram_flash +mcuboot_secondary: + address: 0x00000 + size: 0xe0000 + device: MX25R64 + region: external_flash +mcuboot_secondary_1: + address: 0xe0000 + size: 0x40000 + device: MX25R64 + region: external_flash +external_flash: + address: 0x120000 + size: 0x6e0000 + device: MX25R64 + region: external_flash +pcd_sram: + address: 0x20000000 + size: 0x2000 + region: sram_primary diff --git a/boards/nordic/thingy53/pm_static_thingy53_nrf5340_cpuapp_ns.yml b/boards/nordic/thingy53/pm_static_thingy53_nrf5340_cpuapp_ns.yml new file mode 100644 index 000000000000..70ffe6d9c124 --- /dev/null +++ b/boards/nordic/thingy53/pm_static_thingy53_nrf5340_cpuapp_ns.yml @@ -0,0 +1,73 @@ +mcuboot: + address: 0x0 + region: flash_primary + size: 0x10000 +mcuboot_pad: + address: 0x10000 + region: flash_primary + size: 0x200 +tfm_secure: + address: 0x10000 + size: 0xc000 + span: [mcuboot_pad, tfm] +tfm_nonsecure: + address: 0x1c000 + size: 0xd4000 + span: [app] +tfm: + address: 0x10200 + region: flash_primary + size: 0xbe00 +app: + address: 0x1c000 + region: flash_primary + size: 0xd4000 +mcuboot_primary: + address: 0x10000 + orig_span: &id001 + - mcuboot_pad + - tfm + - app + region: flash_primary + size: 0xe0000 + span: *id001 +mcuboot_primary_app: + address: 0x10200 + orig_span: &id002 + - tfm + - app + region: flash_primary + size: 0xdfe00 + span: *id002 +nonsecure_storage: + address: 0xf0000 + size: 0x10000 + span: [settings_storage] +settings_storage: + address: 0xf0000 + region: flash_primary + size: 0x10000 +mcuboot_primary_1: + address: 0x0 + size: 0x40000 + device: flash_ctrl + region: ram_flash +mcuboot_secondary: + address: 0x00000 + size: 0xe0000 + device: MX25R64 + region: external_flash +mcuboot_secondary_1: + address: 0xe0000 + size: 0x40000 + device: MX25R64 + region: external_flash +external_flash: + address: 0x120000 + size: 0x6e0000 + device: MX25R64 + region: external_flash +pcd_sram: + address: 0x20000000 + size: 0x2000 + region: sram_primary From 2174182010daaba7e4b00f9972cf5b4d3abc1d0a Mon Sep 17 00:00:00 2001 From: Mateusz Kapala Date: Thu, 2 Feb 2023 11:04:23 +0100 Subject: [PATCH 1624/2141] [nrf noup] boards: arm: thingy53: Disable USB CDC added by MCUBoot Enabling USB CDC by default in Thingy:53 board configuration caused that there were two instances of USB CDC in MCUBoot. Change disables one instance which was added automatically by NCS if MCUBoot bootloader was built as a child image. Jira: NCSDK-18596 Signed-off-by: Mateusz Kapala Signed-off-by: Johann Fischer (cherry picked from commit 6d1e3772d63562e2e30fa3176805538d2f0c4117) --- boards/nordic/thingy53/Kconfig.defconfig | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/boards/nordic/thingy53/Kconfig.defconfig b/boards/nordic/thingy53/Kconfig.defconfig index c1139f0dca10..1aa0d7d082ec 100644 --- a/boards/nordic/thingy53/Kconfig.defconfig +++ b/boards/nordic/thingy53/Kconfig.defconfig @@ -84,6 +84,13 @@ endif # !TRUSTED_EXECUTION_SECURE source "boards/common/usb/Kconfig.cdc_acm_serial.defconfig" +# By default, a USB CDC ACM instance is already enabled in the board's DTS. +# It is not necessary for nRF Connect SDK to add another instance if MCUBoot +# bootloader is built as a child image. +config MCUBOOT_USB_SUPPORT + bool + default n + endif # BOARD_THINGY53_NRF5340_CPUAPP || BOARD_THINGY53_NRF5340_CPUAPP_NS if BOARD_THINGY53_NRF5340_CPUNET From 6fdb620a5cc5609dfc40cc8657f95162e7c42b91 Mon Sep 17 00:00:00 2001 From: Marek Pieta Date: Mon, 28 Nov 2022 15:31:33 +0100 Subject: [PATCH 1625/2141] [nrf noup] boards: thingy53_nrf5340: Enable MCUboot by default Change enables MCUboot bootloader by default to allow programming samples and applications without external programmer (using MCUboot serial recovery). Change also enables network core to prevent build failures when building MCUboot with nRF53 multi image DFU. Jira: NCSDK-18263 Signed-off-by: Marek Pieta Signed-off-by: Vinayak Kariappa Chettimada Signed-off-by: Johann Fischer Signed-off-by: Joakim Andersson (cherry picked from commit ce70796db5dd9a8d99c55732c0292bbeffc38f77) --- boards/nordic/thingy53/Kconfig.defconfig | 6 ++++++ boards/nordic/thingy53/thingy53_nrf5340_common.dtsi | 1 + 2 files changed, 7 insertions(+) diff --git a/boards/nordic/thingy53/Kconfig.defconfig b/boards/nordic/thingy53/Kconfig.defconfig index 1aa0d7d082ec..badcb5c20e5d 100644 --- a/boards/nordic/thingy53/Kconfig.defconfig +++ b/boards/nordic/thingy53/Kconfig.defconfig @@ -8,6 +8,12 @@ config HW_STACK_PROTECTION if BOARD_THINGY53_NRF5340_CPUAPP || BOARD_THINGY53_NRF5340_CPUAPP_NS +config BOOTLOADER_MCUBOOT + default y if !MCUBOOT + +config BOARD_ENABLE_CPUNET + default y if !MCUBOOT + # Code Partition: # # For the secure version of the board the firmware is linked at the beginning diff --git a/boards/nordic/thingy53/thingy53_nrf5340_common.dtsi b/boards/nordic/thingy53/thingy53_nrf5340_common.dtsi index fabd5d177a99..c8042b284755 100644 --- a/boards/nordic/thingy53/thingy53_nrf5340_common.dtsi +++ b/boards/nordic/thingy53/thingy53_nrf5340_common.dtsi @@ -13,6 +13,7 @@ zephyr,bt-hci = &bt_hci_ipc0; nordic,802154-spinel-ipc = &ipc0; zephyr,ieee802154 = &ieee802154; + nordic,pm-ext-flash = &mx25r64; }; buttons { From c16c503ce1e37bd26446b4fd11d0cfe701707c14 Mon Sep 17 00:00:00 2001 From: Markus Swarowsky Date: Fri, 19 Apr 2024 12:58:47 +0200 Subject: [PATCH 1626/2141] [nrf noup] samples: psa_crypto: Remove support for Nordic boards We have our own psa crypto samples to show how to used PSA crypto with NCS. This sample still uses CONFIG_MBEDTLS_BUILTIN which is not supported anymore, therefore removing the support for it in NCS. Ref: NCSDK-17944 Signed-off-by: Markus Swarowsky (cherry picked from commit 27f225d5ae6e3f73b609970b81881d504f1b956d) --- samples/tfm_integration/psa_crypto/sample.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/samples/tfm_integration/psa_crypto/sample.yaml b/samples/tfm_integration/psa_crypto/sample.yaml index ea9844730fc1..7d287985bf3c 100644 --- a/samples/tfm_integration/psa_crypto/sample.yaml +++ b/samples/tfm_integration/psa_crypto/sample.yaml @@ -16,8 +16,6 @@ tests: platform_allow: - mps2/an521/cpu0/ns - v2m_musca_s1/musca_s1/ns - - nrf5340dk/nrf5340/cpuapp/ns - - nrf9160dk/nrf9160/ns - stm32l562e_dk/stm32l562xx/ns - bl5340_dvk/nrf5340/cpuapp/ns - max32657evkit/max32657/ns From 5b6d9b4294ab0a282042220d84a349d8c646c37b Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Thu, 9 May 2024 09:34:06 +0100 Subject: [PATCH 1627/2141] [nrf noup] boards: nordic: thingy53: Add sysbuild Kconfig file Adds a sysbuild Kconfig file which enables external flash when partition manager is enabled Signed-off-by: Jamie McCrae (cherry picked from commit fa07e94d6a760f8a4e025b408f3ddd5db47acaf5) --- boards/nordic/thingy53/Kconfig.sysbuild | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 boards/nordic/thingy53/Kconfig.sysbuild diff --git a/boards/nordic/thingy53/Kconfig.sysbuild b/boards/nordic/thingy53/Kconfig.sysbuild new file mode 100644 index 000000000000..2110f226e6b1 --- /dev/null +++ b/boards/nordic/thingy53/Kconfig.sysbuild @@ -0,0 +1,5 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY + default y if BOOTLOADER_MCUBOOT From 6ccde75d66357c29fbef2f2c1fda3f5224fa96c9 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Tue, 14 May 2024 12:22:51 +0100 Subject: [PATCH 1628/2141] [nrf noup] scripts: west: build: Use sysbuild by default if in NCS dir Uses sysbuild by default when building an application which resides in an allowed NCS-based directory when the sysbuild config key is not set. Do not use sysbuild if the mps2 board is being used to avoid problems with CI testing. Signed-off-by: Jamie McCrae (cherry picked from commit 5bbb2c8dd32e564667eb7b6bc3bd27f9f58e1bfb) --- scripts/west_commands/build.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/west_commands/build.py b/scripts/west_commands/build.py index fb3894944cd8..a271e4075a5b 100644 --- a/scripts/west_commands/build.py +++ b/scripts/west_commands/build.py @@ -642,7 +642,12 @@ def _run_cmake(self, board, origin, cmake_opts): if user_args: cmake_opts.extend(shlex.split(user_args)) - config_sysbuild = config_getboolean('sysbuild', False) + config_sysbuild = config_getboolean('sysbuild', None) + + if config_sysbuild is None: + # If no option is set, then enable sysbuild globally + config_sysbuild = True + if self.args.sysbuild or (config_sysbuild and not self.args.no_sysbuild): cmake_opts.extend([f'-S{SYSBUILD_PROJ_DIR}', f'-DAPP_DIR:PATH={self.source_dir}']) From 304bf1eb36faa642f422f3366555a5c9f4cbc084 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Fri, 17 May 2024 10:15:33 +0100 Subject: [PATCH 1629/2141] [nrf noup] board: nordic: thingy53: Enable default images for sysbuild Enables MCUboot, empty network core and network core updates by default when building for the thingy53 Signed-off-by: Jamie McCrae (cherry picked from commit f730f82960010af1f6fd988d15842de0920dc9af) --- boards/nordic/thingy53/Kconfig.sysbuild | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/boards/nordic/thingy53/Kconfig.sysbuild b/boards/nordic/thingy53/Kconfig.sysbuild index 2110f226e6b1..c03d191b3708 100644 --- a/boards/nordic/thingy53/Kconfig.sysbuild +++ b/boards/nordic/thingy53/Kconfig.sysbuild @@ -1,5 +1,22 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 +if BOARD_THINGY53_NRF5340_CPUAPP || BOARD_THINGY53_NRF5340_CPUAPP_NS + +choice BOOTLOADER + default BOOTLOADER_MCUBOOT +endchoice + +config SECURE_BOOT_NETCORE + default y + +config NETCORE_APP_UPDATE + default y if SECURE_BOOT_NETCORE + +config NRF_DEFAULT_EMPTY + default y if SECURE_BOOT_NETCORE + +endif # BOARD_THINGY53_NRF5340_CPUAPP || BOARD_THINGY53_NRF5340_CPUAPP_NS + config PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY default y if BOOTLOADER_MCUBOOT From 82e313ea28bc6196729b58d65f5e0f2473d01531 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Mon, 1 Oct 2018 10:27:32 +0200 Subject: [PATCH 1630/2141] [nrf noup] include: net: add NCS extensions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add some socket options and address family extensions to Zephyr headers, which will be useful for nRF Connect SDK. Add secure socket options: * Add CID socket options to NCS specific options. * Add TLS/DTLS tls ciphersuite chosen socket option to NCS specific options. * Add TLS/DTLS connection save/load socket options to NCS specific options. * Add TLS/DTLS handshake status socket option to NCS specific options. * Add SO_KEEPOPEN socket option. * Add SO_RAI socket options. * Add SO_IPV6_DELAYED_ADDR_REFRESH socket option. The "author" of this commit is a contact person; various people with s-o-b lines following here have contributed to the maintenance of this patch. Signed-off-by: Andreas Moltumyr Signed-off-by: Andrzej Głąbek Signed-off-by: Christopher Métrailler Signed-off-by: Emanuele Di Santo Signed-off-by: Glenn Ruben Bakke Signed-off-by: Håkon Alseth Signed-off-by: Ioannis Glaropoulos Signed-off-by: Jan Tore Guggedal Signed-off-by: Joakim Andersson Signed-off-by: Martí Bolívar Signed-off-by: Mirko Covizzi Signed-off-by: Petri Honkala Signed-off-by: Robert Lubos Signed-off-by: Tommi Mammela Signed-off-by: Trond Einar Snekvik Signed-off-by: Torsten Rasmussen Signed-off-by: Eivind Jølsgard Signed-off-by: Dominik Ermel (cherry picked from commit d7a627775d65077527e6272d627e2b88bfecc9cd) --- include/zephyr/net/socket.h | 1 + include/zephyr/net/socket_ncs.h | 170 ++++++++++++++++++++++++++++++++ 2 files changed, 171 insertions(+) create mode 100644 include/zephyr/net/socket_ncs.h diff --git a/include/zephyr/net/socket.h b/include/zephyr/net/socket.h index 2eab2d964628..d5447b097e57 100644 --- a/include/zephyr/net/socket.h +++ b/include/zephyr/net/socket.h @@ -36,6 +36,7 @@ #include #include #include +#include #include #ifdef __cplusplus diff --git a/include/zephyr/net/socket_ncs.h b/include/zephyr/net/socket_ncs.h new file mode 100644 index 000000000000..92a8447c47fb --- /dev/null +++ b/include/zephyr/net/socket_ncs.h @@ -0,0 +1,170 @@ +/* + * Copyright (c) 2021 Nordic Semiconductor + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_INCLUDE_NET_SOCKET_NCS_H_ +#define ZEPHYR_INCLUDE_NET_SOCKET_NCS_H_ + +/** + * @file + * @brief NCS specific additions to the BSD sockets API definitions + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* When CONFIG_NET_SOCKETS_OFFLOAD is enabled, offloaded sockets take precedence + * when creating a new socket. Combine this flag with a socket type when + * creating a socket, to enforce native socket creation (e. g. SOCK_STREAM | SOCK_NATIVE). + * If it's desired to create a native TLS socket, but still offload the + * underlying TCP/UDP socket, use e. g. SOCK_STREAM | SOCK_NATIVE_TLS. + */ +#define SOCK_NATIVE 0x80000000 +#define SOCK_NATIVE_TLS 0x40000000 + +/** Define a base for NCS specific socket options to prevent overlaps with Zephyr's socket options. + */ +#define NET_SOCKET_NCS_BASE 1000 + +/* NCS specific TLS level socket options */ + +/** Socket option to set DTLS handshake timeout, specifically for nRF sockets. + * The option accepts an integer, indicating the total handshake timeout, + * including retransmissions, in seconds. + * Accepted values for the option are: 1, 3, 7, 15, 31, 63, 123. + */ +#define TLS_DTLS_HANDSHAKE_TIMEO (NET_SOCKET_NCS_BASE + 18) + +/** Socket option to save DTLS connection, specifically for nRF sockets. + */ +#define TLS_DTLS_CONN_SAVE (NET_SOCKET_NCS_BASE + 19) + +/** Socket option to load DTLS connection, specifically for nRF sockets. + */ +#define TLS_DTLS_CONN_LOAD (NET_SOCKET_NCS_BASE + 20) + +/** Socket option to get result of latest TLS/DTLS completed handshakes end status, + * specifically for nRF sockets. + * The option accepts an integer, indicating the setting. + * Accepted vaules for the option are: 0 and 1. + */ +#define TLS_DTLS_HANDSHAKE_STATUS (NET_SOCKET_NCS_BASE + 21) + +/* Valid values for TLS_DTLS_HANDSHAKE_TIMEO option */ +#define TLS_DTLS_HANDSHAKE_TIMEO_NONE 0 /**< No timeout */ +#define TLS_DTLS_HANDSHAKE_TIMEO_1S 1 /**< 1 second */ +#define TLS_DTLS_HANDSHAKE_TIMEO_3S 3 /**< 1s + 2s */ +#define TLS_DTLS_HANDSHAKE_TIMEO_7S 7 /**< 1s + 2s + 4s */ +#define TLS_DTLS_HANDSHAKE_TIMEO_15S 15 /**< 1s + 2s + 4s + 8s */ +#define TLS_DTLS_HANDSHAKE_TIMEO_31S 31 /**< 1s + 2s + 4s + 8s + 16s */ +#define TLS_DTLS_HANDSHAKE_TIMEO_63S 63 /**< 1s + 2s + 4s + 8s + 16s + 32s */ +#define TLS_DTLS_HANDSHAKE_TIMEO_123S 123 /**< 1s + 2s + 4s + 8s + 16s + 32s + 60s */ + +/* Valid values for TLS_DTLS_HANDSHAKE_STATUS option */ +#define TLS_DTLS_HANDSHAKE_STATUS_FULL 0 +#define TLS_DTLS_HANDSHAKE_STATUS_CACHED 1 + +/* NCS specific socket options */ + +/** sockopt: enable sending data as part of exceptional events */ +#define SO_EXCEPTIONAL_DATA (NET_SOCKET_NCS_BASE + 33) +/** sockopt: Keep socket open when its PDN connection is lost + * or the device is put into flight mode. + */ +#define SO_KEEPOPEN (NET_SOCKET_NCS_BASE + 34) +/** sockopt: bind to PDN */ +#define SO_BINDTOPDN (NET_SOCKET_NCS_BASE + 40) + +/** sockopt: Release assistance indication (RAI). + * The option accepts an integer, indicating the type of RAI. + * Accepted values for the option are: @ref RAI_NO_DATA, @ref RAI_LAST, @ref RAI_ONE_RESP, + * @ref RAI_ONGOING, @ref RAI_WAIT_MORE. + */ +#define SO_RAI (NET_SOCKET_NCS_BASE + 61) + +/** Release assistance indication (RAI). + * Indicate that the application does not intend to send more data. + * This applies immediately and lets the modem exit connected mode more + * quickly. + * + * @note This requires the socket to be connected. + */ +#define RAI_NO_DATA 1 +/** Release assistance indication (RAI). + * Indicate that the application does not intend to send more data + * after the next call to send() or sendto(). + * This lets the modem exit connected mode more quickly after sending the data. + */ +#define RAI_LAST 2 +/** Release assistance indication (RAI). + * Indicate that the application is expecting to receive just one data packet + * after the next call to send() or sendto(). + * This lets the modem exit connected mode more quickly after having received the data. + */ +#define RAI_ONE_RESP 3 +/** Release assistance indication (RAI). + * Indicate that the socket is in active use by a client application. + * This lets the modem stay in connected mode longer. + */ +#define RAI_ONGOING 4 +/** Release assistance indication (RAI). + * Indicate that the socket is in active use by a server application. + * This lets the modem stay in connected mode longer. + */ +#define RAI_WAIT_MORE 5 + +/* NCS specific IPPROTO_ALL level socket options */ + +/** IPv4 and IPv6 protocol level (pseudo-val) for nRF sockets. */ +#define IPPROTO_ALL 512 +/** sockopt: disable all replies to unexpected traffics */ +#define SO_SILENCE_ALL (NET_SOCKET_NCS_BASE + 30) + +/* NCS specific IPPROTO_IP level socket options */ + +/** sockopt: enable IPv4 ICMP replies */ +#define SO_IP_ECHO_REPLY (NET_SOCKET_NCS_BASE + 31) + +/* NCS specific IPPROTO_IPV6 level socket options */ + +/** sockopt: enable IPv6 ICMP replies */ +#define SO_IPV6_ECHO_REPLY (NET_SOCKET_NCS_BASE + 32) + +/** sockopt: Delay IPv6 address refresh during power saving mode */ +#define SO_IPV6_DELAYED_ADDR_REFRESH (NET_SOCKET_NCS_BASE + 62) + +/* NCS specific TCP level socket options */ + +/** sockopt: Configurable TCP server session timeout in minutes. + * Range is 0 to 135. 0 is no timeout and 135 is 2 h 15 min. Default is 0 (no timeout). + */ +#define SO_TCP_SRV_SESSTIMEO (NET_SOCKET_NCS_BASE + 55) + +/* NCS specific gettaddrinfo() flags */ + +/** Assume `service` contains a Packet Data Network (PDN) ID. + * When specified together with the AI_NUMERICSERV flag, + * `service` shall be formatted as follows: "port:pdn_id" + * where "port" is the port number and "pdn_id" is the PDN ID. + * Example: "8080:1", port 8080 PDN ID 1. + * Example: "42:0", port 42 PDN ID 0. + */ +#define AI_PDNSERV 0x1000 + +/* NCS specific send() and sendto() flags */ + +/** Request a blocking send operation until the request is acknowledged. + * When used in send() or sendto(), the request will not return until the + * send operation is completed by lower layers, or until the timeout, given by the SO_SNDTIMEO + * socket option, is reached. Valid timeout values are 1 to 600 seconds. + */ +#define MSG_WAITACK 0x200 + +#ifdef __cplusplus +} +#endif + +#endif /* ZEPHYR_INCLUDE_NET_SOCKET_NCS_H_ */ From 647d49255139d093398afa05da01e7d8f82dfa32 Mon Sep 17 00:00:00 2001 From: Sigvart Hovland Date: Fri, 3 May 2019 14:21:52 +0200 Subject: [PATCH 1631/2141] [nrf noup] tree-wide: support NCS Partition Manager (PM) definitions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Partition Manager (PM) is a component of the nRF Connect SDK (NCS) which uses yaml files to resolve flash partition placement with a holistic view of the entire device, including each firmware image present on the flash device, and various subsystems, such as settings and NFFS. When this NCS extension is used, various source files which would use partition information from devicetree in "vanilla" zephyr instead use defines generated by PM instead. This commit removes support for HEX_FILES_TO_MERGE, as it conflicts with PM. The settings subsystem pm.yml defines a partition 'settings_storage'. The nffs subsystem pm.yml defines 'nffs_storage'. Leverage label translation to avoid patching partition names. Refer to the NCS documentation page for this feature for more details. This is a long-running out of tree patch which has been worked on by several people. The following sign-offs are in alphabetical order by first name. Signed-off-by: Andrzej Głąbek Signed-off-by: Andrzej Puzdrowski Signed-off-by: Håkon Øye Amundsen Signed-off-by: Ioannis Glaropoulos Signed-off-by: Joakim Andersson Signed-off-by: Johann Fischer Signed-off-by: Martí Bolívar Signed-off-by: Ole Sæther Signed-off-by: Robert Lubos Signed-off-by: Sebastian Bøe Signed-off-by: Sigvart Hovland Signed-off-by: Thomas Stenersen Signed-off-by: Torsten Rasmussen Signed-off-by: Øyvind Rønningstad Signed-off-by: Trond Einar Snekvik Signed-off-by: Gerard Marull-Paretas Signed-off-by: Tomasz Moń Signed-off-by: Dominik Ermel Signed-off-by: Jamie McCrae (cherry picked from commit 5c2eecf1ef8bc3bc714dff8adf8f023bd921227a) --- arch/arm/core/mpu/arm_mpu_regions.c | 13 +++++ cmake/linker/ld/target.cmake | 1 + cmake/linker/lld/target.cmake | 1 + cmake/modules/kernel.cmake | 4 ++ drivers/flash/soc_flash_nrf.c | 11 ++++ drivers/flash/soc_flash_nrf_rram.c | 11 ++++ .../arch/arm/cortex_m/scripts/linker.ld | 50 +++++++++++++++++++ include/zephyr/storage/flash_map.h | 6 +++ lib/heap/Kconfig | 2 +- lib/libc/common/source/stdlib/malloc.c | 18 ++++++- subsys/dfu/boot/mcuboot_shell.c | 40 +++++++++++++++ subsys/fs/littlefs_fs.c | 7 ++- subsys/ipc/rpmsg_service/rpmsg_backend.h | 27 ++++++++++ 13 files changed, 187 insertions(+), 4 deletions(-) diff --git a/arch/arm/core/mpu/arm_mpu_regions.c b/arch/arm/core/mpu/arm_mpu_regions.c index 0bf7a219c27d..383fd573513c 100644 --- a/arch/arm/core/mpu/arm_mpu_regions.c +++ b/arch/arm/core/mpu/arm_mpu_regions.c @@ -8,6 +8,9 @@ #include #include +#if USE_PARTITION_MANAGER +#include +#endif static const struct arm_mpu_region mpu_regions[] = { #ifdef CONFIG_XIP @@ -24,6 +27,14 @@ static const struct arm_mpu_region mpu_regions[] = { /* Region 1 */ MPU_REGION_ENTRY("SRAM_0", +#if USE_PARTITION_MANAGER + PM_SRAM_ADDRESS, +#if defined(CONFIG_ARMV8_M_BASELINE) || defined(CONFIG_ARMV8_M_MAINLINE) + REGION_RAM_ATTR(PM_SRAM_ADDRESS, PM_SRAM_SIZE)), +#else + REGION_RAM_ATTR(REGION_SRAM_SIZE)), +#endif +#else CONFIG_SRAM_BASE_ADDRESS, #if defined(CONFIG_ARMV8_M_BASELINE) || defined(CONFIG_ARMV8_M_MAINLINE) REGION_RAM_ATTR(CONFIG_SRAM_BASE_ADDRESS, \ @@ -31,6 +42,8 @@ static const struct arm_mpu_region mpu_regions[] = { #else REGION_RAM_ATTR(REGION_SRAM_SIZE)), #endif + +#endif /* USE_PARTITION_MANAGER */ }; const struct arm_mpu_config mpu_config = { diff --git a/cmake/linker/ld/target.cmake b/cmake/linker/ld/target.cmake index 592596576d11..ccf6a1903162 100644 --- a/cmake/linker/ld/target.cmake +++ b/cmake/linker/ld/target.cmake @@ -80,6 +80,7 @@ macro(configure_linker_script linker_script_gen linker_pass_define) ${current_includes} ${soc_linker_script_includes} ${template_script_defines} + -DUSE_PARTITION_MANAGER=$ -E ${LINKER_SCRIPT} -P # Prevent generation of debug `#line' directives. -o ${linker_script_gen} diff --git a/cmake/linker/lld/target.cmake b/cmake/linker/lld/target.cmake index 96df1c123796..fe8aad62c73d 100644 --- a/cmake/linker/lld/target.cmake +++ b/cmake/linker/lld/target.cmake @@ -52,6 +52,7 @@ macro(configure_linker_script linker_script_gen linker_pass_define) -imacros ${AUTOCONF_H} ${current_includes} ${template_script_defines} + -DUSE_PARTITION_MANAGER=$ -E ${LINKER_SCRIPT} -P # Prevent generation of debug `#line' directives. -o ${linker_script_gen} diff --git a/cmake/modules/kernel.cmake b/cmake/modules/kernel.cmake index c6319611c8c3..5c8fa184b208 100644 --- a/cmake/modules/kernel.cmake +++ b/cmake/modules/kernel.cmake @@ -256,3 +256,7 @@ if("${CMAKE_EXTRA_GENERATOR}" STREQUAL "Eclipse CDT4") include(${ZEPHYR_BASE}/cmake/ide/eclipse_cdt4_generator_amendment.cmake) eclipse_cdt4_generator_amendment(1) endif() + +if(ZEPHYR_NRF_MODULE_DIR) + include(${ZEPHYR_NRF_MODULE_DIR}/cmake/partition_manager.cmake) +endif() diff --git a/drivers/flash/soc_flash_nrf.c b/drivers/flash/soc_flash_nrf.c index 9e1ba68319ff..574739082dc4 100644 --- a/drivers/flash/soc_flash_nrf.c +++ b/drivers/flash/soc_flash_nrf.c @@ -37,6 +37,11 @@ LOG_MODULE_REGISTER(flash_nrf); #define SOC_NV_FLASH_NODE DT_INST(0, soc_nv_flash) +#if CONFIG_TRUSTED_EXECUTION_NONSECURE && USE_PARTITION_MANAGER +#include +#include +#endif /* CONFIG_TRUSTED_EXECUTION_NONSECURE && USE_PARTITION_MANAGER */ + #ifndef CONFIG_SOC_FLASH_NRF_RADIO_SYNC_NONE #define FLASH_SLOT_WRITE 7500 #if defined(CONFIG_SOC_FLASH_NRF_PARTIAL_ERASE) @@ -166,6 +171,12 @@ static int flash_nrf_read(const struct device *dev, off_t addr, } #endif +#if CONFIG_TRUSTED_EXECUTION_NONSECURE && USE_PARTITION_MANAGER && PM_APP_ADDRESS + if (addr < PM_APP_ADDRESS) { + return soc_secure_mem_read(data, (void *)addr, len); + } +#endif + nrf_nvmc_buffer_read(data, (uint32_t)addr, len); return 0; diff --git a/drivers/flash/soc_flash_nrf_rram.c b/drivers/flash/soc_flash_nrf_rram.c index d26a15cf7236..d46e3524ea8d 100644 --- a/drivers/flash/soc_flash_nrf_rram.c +++ b/drivers/flash/soc_flash_nrf_rram.c @@ -54,6 +54,11 @@ LOG_MODULE_REGISTER(flash_nrf_rram, CONFIG_FLASH_LOG_LEVEL); #define WRITE_BLOCK_SIZE_FROM_DT DT_PROP(RRAM, write_block_size) #define ERASE_VALUE 0xFF +#if CONFIG_TRUSTED_EXECUTION_NONSECURE && USE_PARTITION_MANAGER +#include +#include +#endif /* CONFIG_TRUSTED_EXECUTION_NONSECURE && USE_PARTITION_MANAGER */ + #ifdef CONFIG_MULTITHREADING static struct k_sem sem_lock; #define SYNC_INIT() k_sem_init(&sem_lock, 1, 1) @@ -279,6 +284,12 @@ static int nrf_rram_read(const struct device *dev, off_t addr, void *data, size_ } addr += RRAM_START; +#if CONFIG_TRUSTED_EXECUTION_NONSECURE && USE_PARTITION_MANAGER && PM_APP_ADDRESS + if (addr < PM_APP_ADDRESS) { + return soc_secure_mem_read(data, (void *)addr, len); + } +#endif + memcpy(data, (void *)addr, len); return 0; diff --git a/include/zephyr/arch/arm/cortex_m/scripts/linker.ld b/include/zephyr/arch/arm/cortex_m/scripts/linker.ld index 688165d0698b..c8579f2a8023 100644 --- a/include/zephyr/arch/arm/cortex_m/scripts/linker.ld +++ b/include/zephyr/arch/arm/cortex_m/scripts/linker.ld @@ -34,6 +34,39 @@ #define ROMSTART_REGION ROMABLE_REGION #endif +#if USE_PARTITION_MANAGER + +#include + +#if CONFIG_NCS_IS_VARIANT_IMAGE && defined(PM_S0_ID) +/* We are linking against S1, create symbol containing the flash ID of S0. + * This is used when writing code operating on the "other" slot. + */ +_image_1_primary_slot_id = PM_S0_ID; + +#else /* ! CONFIG_NCS_IS_VARIANT_IMAGE */ + +#ifdef PM_S1_ID +/* We are linking against S0, create symbol containing the flash ID of S1. + * This is used when writing code operating on the "other" slot. + */ +_image_1_primary_slot_id = PM_S1_ID; +#endif /* PM_S1_ID */ + +#endif /* CONFIG_NCS_IS_VARIANT_IMAGE */ + +#define ROM_ADDR PM_ADDRESS +#define ROM_SIZE PM_SIZE + +#if defined(CONFIG_PM_USE_CONFIG_SRAM_SIZE) +#define RAM_SIZE CONFIG_PM_SRAM_SIZE +#else +#define RAM_SIZE PM_SRAM_SIZE +#endif +#define RAM_ADDR PM_SRAM_ADDRESS + +#else /* ! USE_PARTITION_MANAGER */ + #if !defined(CONFIG_XIP) && (CONFIG_FLASH_SIZE == 0) #define ROM_ADDR RAM_ADDR #else @@ -55,6 +88,23 @@ #define RAM_SIZE (CONFIG_SRAM_SIZE * 1K) #define RAM_ADDR CONFIG_SRAM_BASE_ADDRESS +#endif /* USE_PARTITION_MANAGER */ + +#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_ccm), okay) +#define CCM_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_ccm)) +#define CCM_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_ccm)) +#endif + +#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_itcm), okay) +#define ITCM_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_itcm)) +#define ITCM_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_itcm)) +#endif + +#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_dtcm), okay) +#define DTCM_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_dtcm)) +#define DTCM_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_dtcm)) +#endif + #if defined(CONFIG_CUSTOM_SECTION_ALIGN) _region_min_align = CONFIG_CUSTOM_SECTION_MIN_ALIGN_SIZE; #else diff --git a/include/zephyr/storage/flash_map.h b/include/zephyr/storage/flash_map.h index d8ba414abd3d..f62f1c217185 100644 --- a/include/zephyr/storage/flash_map.h +++ b/include/zephyr/storage/flash_map.h @@ -348,6 +348,10 @@ const char *flash_area_label(const struct flash_area *fa); */ uint8_t flash_area_erased_val(const struct flash_area *fa); +#if USE_PARTITION_MANAGER +#include +#else + /** * Returns non-0 value if fixed-partition of given DTS node label exists. * @@ -469,6 +473,8 @@ DT_FOREACH_STATUS_OKAY(fixed_partitions, FOR_EACH_PARTITION_TABLE) #undef FOR_EACH_PARTITION_TABLE /** @endcond */ +#endif /* USE_PARTITION_MANAGER */ + #ifdef __cplusplus } #endif diff --git a/lib/heap/Kconfig b/lib/heap/Kconfig index 0d97da3e340b..9a39ab8ad73b 100644 --- a/lib/heap/Kconfig +++ b/lib/heap/Kconfig @@ -81,7 +81,7 @@ config HEAP_LISTENER choice prompt "Supported heap sizes" depends on !64BIT - default SYS_HEAP_SMALL_ONLY if (SRAM_SIZE <= 256) + default SYS_HEAP_SMALL_ONLY if (SRAM_SIZE <= 256) && !PARTITION_MANAGER_ENABLED default SYS_HEAP_AUTO help Heaps using reduced-size chunk headers can accommodate so called diff --git a/lib/libc/common/source/stdlib/malloc.c b/lib/libc/common/source/stdlib/malloc.c index 2b01e152f009..2821ae8173ac 100644 --- a/lib/libc/common/source/stdlib/malloc.c +++ b/lib/libc/common/source/stdlib/malloc.c @@ -25,6 +25,20 @@ #include LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); +#if USE_PARTITION_MANAGER + +#include + +#define RAM_SIZE PM_SRAM_SIZE +#define RAM_ADDR PM_SRAM_ADDRESS + +#else /* ! USE_PARTITION_MANAGER */ + +#define RAM_SIZE (KB((size_t) CONFIG_SRAM_SIZE)) +#define RAM_ADDR CONFIG_SRAM_BASE_ADDRESS + +#endif /* USE_PARTITION_MANAGER */ + #ifdef CONFIG_COMMON_LIBC_MALLOC #if (CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE != 0) @@ -106,8 +120,8 @@ static POOL_SECTION unsigned char __aligned(HEAP_ALIGN) malloc_arena[HEAP_SIZE]; extern char _heap_sentry[]; # define HEAP_SIZE ROUND_DOWN((POINTER_TO_UINT(_heap_sentry) - HEAP_BASE), HEAP_ALIGN) # else -# define HEAP_SIZE ROUND_DOWN((KB((size_t) CONFIG_SRAM_SIZE) - \ - ((size_t) HEAP_BASE - (size_t) CONFIG_SRAM_BASE_ADDRESS)), HEAP_ALIGN) +# define HEAP_SIZE ROUND_DOWN((RAM_SIZE - \ + ((size_t) HEAP_BASE - (size_t) RAM_ADDR)), HEAP_ALIGN) # endif /* else CONFIG_XTENSA */ # endif /* else CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE > 0 */ diff --git a/subsys/dfu/boot/mcuboot_shell.c b/subsys/dfu/boot/mcuboot_shell.c index be4e558713f1..e167bc1e39b8 100644 --- a/subsys/dfu/boot/mcuboot_shell.c +++ b/subsys/dfu/boot/mcuboot_shell.c @@ -20,6 +20,16 @@ #endif #endif +#if USE_PARTITION_MANAGER +#include + +#ifdef CONFIG_NCS_IS_VARIANT_IMAGE +#define ACTIVE_IMAGE_ID PM_MCUBOOT_SECONDARY_ID +#else +#define ACTIVE_IMAGE_ID PM_MCUBOOT_PRIMARY_ID +#endif +#endif + struct area_desc { const char *name; unsigned int id; @@ -93,6 +103,35 @@ static int cmd_mcuboot_erase(const struct shell *sh, size_t argc, id = strtoul(argv[1], NULL, 0); /* Check if this is the parent (MCUboot) or own slot and if so, deny the request */ +#if USE_PARTITION_MANAGER +#ifdef PM_MCUBOOT_ID + if (id == PM_MCUBOOT_ID || id == PM_MCUBOOT_PAD_ID) { + shell_error(sh, "Cannot erase boot partition"); + return -EACCES; + } +#endif + +#ifdef PM_APP_ID + if (id == PM_APP_ID) { + shell_error(sh, "Cannot erase this area"); + return -EACCES; + } +#endif + +#ifdef PM_MCUBOOT_PRIMARY_APP_ID + if (id == PM_MCUBOOT_PRIMARY_APP_ID) { + shell_error(sh, "Cannot erase this area"); + return -EACCES; + } +#endif + +#ifdef ACTIVE_IMAGE_ID + if (id == ACTIVE_IMAGE_ID) { + shell_error(sh, "Cannot erase active partitions"); + return -EACCES; + } +#endif +#else #if FIXED_PARTITION_EXISTS(boot_partition) if (id == FIXED_PARTITION_ID(boot_partition)) { shell_error(sh, "Cannot erase boot partition"); @@ -105,6 +144,7 @@ static int cmd_mcuboot_erase(const struct shell *sh, size_t argc, shell_error(sh, "Cannot erase active partitions"); return -EACCES; } +#endif #endif err = boot_erase_img_bank(id); diff --git a/subsys/fs/littlefs_fs.c b/subsys/fs/littlefs_fs.c index 7cf8aaa44c7b..5abbf95f949e 100644 --- a/subsys/fs/littlefs_fs.c +++ b/subsys/fs/littlefs_fs.c @@ -1103,7 +1103,12 @@ struct fs_mount_t FS_FSTAB_ENTRY(DT_DRV_INST(inst)) = { \ .type = FS_LITTLEFS, \ .mnt_point = DT_INST_PROP(inst, mount_point), \ .fs_data = &fs_data_##inst, \ - .storage_dev = (void *)DT_FIXED_PARTITION_ID(FS_PARTITION(inst)), \ + .storage_dev = (void *) \ + COND_CODE_1(USE_PARTITION_MANAGER, \ + (COND_CODE_1(FIXED_PARTITION_EXISTS(littlefs_storage), \ + (FIXED_PARTITION_ID(littlefs_storage)), \ + (FIXED_PARTITION_ID(storage)))), \ + (DT_FIXED_PARTITION_ID(FS_PARTITION(inst)))), \ .flags = FSTAB_ENTRY_DT_MOUNT_FLAGS(DT_DRV_INST(inst)), \ }; diff --git a/subsys/ipc/rpmsg_service/rpmsg_backend.h b/subsys/ipc/rpmsg_service/rpmsg_backend.h index a74e46b85207..9996e1d74d9b 100644 --- a/subsys/ipc/rpmsg_service/rpmsg_backend.h +++ b/subsys/ipc/rpmsg_service/rpmsg_backend.h @@ -13,8 +13,35 @@ extern "C" { #endif +#if CONFIG_PARTITION_MANAGER_ENABLED + +#include "pm_config.h" + +#if defined(PM_RPMSG_NRF53_SRAM_ADDRESS) || defined(PM__RPMSG_NRF53_SRAM_ADDRESS) + +#if defined(PM_RPMSG_NRF53_SRAM_ADDRESS) +#define VDEV_START_ADDR PM_RPMSG_NRF53_SRAM_ADDRESS +#define VDEV_SIZE PM_RPMSG_NRF53_SRAM_SIZE +#else +/* The current image is a child image in a different domain than the image + * which defined the required values. To reach the values of the parent domain + * we use the 'PM__' variant of the define. + */ +#define VDEV_START_ADDR PM__RPMSG_NRF53_SRAM_ADDRESS +#define VDEV_SIZE PM__RPMSG_NRF53_SRAM_SIZE +#endif /* defined(PM_RPMSG_NRF53_SRAM_ADDRESS) */ + +#else #define VDEV_START_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_ipc_shm)) #define VDEV_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_ipc_shm)) +#endif /* defined(PM_RPMSG_NRF53_SRAM_ADDRESS) || defined(PM__RPMSG_NRF53_SRAM_ADDRESS) */ + +#else + +#define VDEV_START_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_ipc_shm)) +#define VDEV_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_ipc_shm)) + +#endif /* CONFIG_PARTITION_MANAGER_ENABLED */ #define VDEV_STATUS_ADDR VDEV_START_ADDR #define VDEV_STATUS_SIZE 0x400 From 2327549dddcadd9fbc67e1a1556f8cd3abbdcd93 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Fri, 17 May 2024 14:10:51 +0200 Subject: [PATCH 1632/2141] [nrf noup] kernel: Disable boot banner if NCS_BOOT_BANNER is enabled Zephyr's boot banner should not be used if NCS boot banner is enabled. Signed-off-by: Robert Lubos (cherry picked from commit 4b7a867eabe9e6e3724e8b3c210b9506c9c2cfef) --- kernel/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/Kconfig b/kernel/Kconfig index bb2c5bade905..bac45c64d33e 100644 --- a/kernel/Kconfig +++ b/kernel/Kconfig @@ -457,6 +457,7 @@ config SKIP_BSS_CLEAR config BOOT_BANNER bool "Boot banner" default y + depends on !NCS_BOOT_BANNER select PRINTK select EARLY_CONSOLE help From c5e400e6f08975864436765573339f85770132f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20Reierstad?= Date: Fri, 31 May 2024 08:21:51 +0200 Subject: [PATCH 1633/2141] =?UTF-8?q?[nrf=20noup]=C2=A0Bluetooth:=20Mesh:?= =?UTF-8?q?=20remove=20legacy=20adv=20support?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removes explicit support for the legacy advertiser due to incompatibility with SDC. The legacy advertiser can be used (experimentally) with the Zephyr Link Layer enabled, but is not recommended. Signed-off-by: Håvard Reierstad (cherry picked from commit 10b13619fcdedaa5ae25f62eb7acd86f5f768635) --- subsys/bluetooth/mesh/Kconfig | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index d39ea25616aa..bb0e8be8eb88 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -59,12 +59,16 @@ choice BT_MESH_ADV menuconfig BT_MESH_ADV_LEGACY bool "Legacy advertising" + depends on BT_LL_SW_SPLIT help Use legacy advertising commands for mesh sending. Legacy - advertising is significantly slower than the extended advertising, but - is supported by all controllers. + advertising is significantly slower than the extended advertising. - WARNING: The legacy advertiser can occasionally do more message + WARNING: This feature is not supported in NCS. The legacy advertiser will not work + with SDC, as attempting to start an advertisement during the scanner duty cycle + will result in an error. The Zephyr Link Layer can be used experimentally as an + alternative. + The legacy advertiser can occasionally do more message retransmissions than requested because of limitations of HCI interface API. From ae6b1946db253cbe27ade7cc6c05183f17774adf Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Wed, 5 Jun 2024 13:37:34 +0100 Subject: [PATCH 1634/2141] [nrf noup] board: nordic: thingy53: Default to update only MCUboot type Changes the default MCUboot mode to update only for the thingy53, to align with previous bootloader builds Changes the thingy53 default configuration for sysbuild to enable using all RAM in the MCUboot image Signed-off-by: Jamie McCrae (cherry picked from commit a06f9582999650d0f950952b4799510871e23948) --- boards/nordic/thingy53/Kconfig.sysbuild | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/boards/nordic/thingy53/Kconfig.sysbuild b/boards/nordic/thingy53/Kconfig.sysbuild index c03d191b3708..df489c1dd546 100644 --- a/boards/nordic/thingy53/Kconfig.sysbuild +++ b/boards/nordic/thingy53/Kconfig.sysbuild @@ -7,6 +7,10 @@ choice BOOTLOADER default BOOTLOADER_MCUBOOT endchoice +choice MCUBOOT_MODE + default MCUBOOT_MODE_OVERWRITE_ONLY +endchoice + config SECURE_BOOT_NETCORE default y @@ -16,6 +20,9 @@ config NETCORE_APP_UPDATE config NRF_DEFAULT_EMPTY default y if SECURE_BOOT_NETCORE +config MCUBOOT_USE_ALL_AVAILABLE_RAM + default y if BOARD_THINGY53_NRF5340_CPUAPP_NS && BOOTLOADER_MCUBOOT + endif # BOARD_THINGY53_NRF5340_CPUAPP || BOARD_THINGY53_NRF5340_CPUAPP_NS config PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY From d35eee4b7b5cf3bb320af52b1c1bc2a0e0c766fb Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 12 Jun 2024 16:15:29 +0200 Subject: [PATCH 1635/2141] [nrf noup] samples: sysbuild: hello_world: support PM on nRF53 PM support is still required for nRF53/nRF54l15 in the context of NCS. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 470fcc9ac884ec9698e1d838160c7c3aadf706e0) --- samples/sysbuild/hello_world/sysbuild.cmake | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/samples/sysbuild/hello_world/sysbuild.cmake b/samples/sysbuild/hello_world/sysbuild.cmake index c7c2615c665a..8f8fc49dbff3 100644 --- a/samples/sysbuild/hello_world/sysbuild.cmake +++ b/samples/sysbuild/hello_world/sysbuild.cmake @@ -11,5 +11,17 @@ ExternalZephyrProject_Add( BOARD ${SB_CONFIG_REMOTE_BOARD} ) +if(SB_CONFIG_SOC_SERIES_NRF53X) + set_property(GLOBAL APPEND PROPERTY PM_DOMAINS CPUNET) + set_property(GLOBAL APPEND PROPERTY PM_CPUNET_IMAGES remote) + set_property(GLOBAL PROPERTY DOMAIN_APP_CPUNET remote) + set(CPUNET_PM_DOMAIN_DYNAMIC_PARTITION remote CACHE INTERNAL "") +else(SB_CONFIG_SOC_SERIES_NRF54LX) + set_property(GLOBAL APPEND PROPERTY PM_DOMAINS CPUFLPR) + set_property(GLOBAL APPEND PROPERTY PM_CPUFLPR_IMAGES remote) + set_property(GLOBAL PROPERTY DOMAIN_APP_CPUFLPR remote) + set(CPUFLPR_PM_DOMAIN_DYNAMIC_PARTITION remote CACHE INTERNAL "") +endif() + add_dependencies(${DEFAULT_IMAGE} remote) sysbuild_add_dependencies(FLASH ${DEFAULT_IMAGE} remote) From 68a9eccac6042a3ef299d671ac16105a7b80c2b9 Mon Sep 17 00:00:00 2001 From: Damian Krolik Date: Mon, 25 Sep 2023 16:41:15 +0200 Subject: [PATCH 1636/2141] [nrf noup] settings: nvs: use dedicated lookup cache hash function Introduce NVS_LOOKUP_CACHE_FOR_SETTINGS Kconfig option that enables a dedicated hash function for the NVS lookup cache that takes advantage of the NVS ID allocation scheme used by the NVS settings backend. As such, this option should only be used if an application uses NVS via the settings layer. Signed-off-by: Damian Krolik (cherry picked from commit 1deb982783fff1ca9368fbe649123fbdeedfd304) --- subsys/fs/nvs/Kconfig | 9 +++++++++ subsys/fs/nvs/nvs.c | 46 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/subsys/fs/nvs/Kconfig b/subsys/fs/nvs/Kconfig index 48915c2f048e..21798932f521 100644 --- a/subsys/fs/nvs/Kconfig +++ b/subsys/fs/nvs/Kconfig @@ -29,6 +29,15 @@ config NVS_LOOKUP_CACHE_SIZE Number of entries in Non-volatile Storage lookup cache. It is recommended that it be a power of 2. +config NVS_LOOKUP_CACHE_FOR_SETTINGS + bool "Non-volatile Storage lookup cache optimized for settings" + depends on NVS_LOOKUP_CACHE + help + Use the lookup cache hash function that results in the least number of + collissions and, in turn, the best NVS performance provided that the NVS + is used as the settings backend only. This option should NOT be enabled + if the NVS is also written to directly, outside the settings layer. + config NVS_DATA_CRC bool "Non-volatile Storage CRC protection on the data" help diff --git a/subsys/fs/nvs/nvs.c b/subsys/fs/nvs/nvs.c index 8a710d570fb1..f36d5b76dd56 100644 --- a/subsys/fs/nvs/nvs.c +++ b/subsys/fs/nvs/nvs.c @@ -13,6 +13,11 @@ #include #include "nvs_priv.h" +#ifdef CONFIG_NVS_LOOKUP_CACHE_FOR_SETTINGS +#include +#include +#endif + #include LOG_MODULE_REGISTER(fs_nvs, CONFIG_NVS_LOG_LEVEL); @@ -21,6 +26,45 @@ static int nvs_ate_valid(struct nvs_fs *fs, const struct nvs_ate *entry); #ifdef CONFIG_NVS_LOOKUP_CACHE +#ifdef CONFIG_NVS_LOOKUP_CACHE_FOR_SETTINGS + +static inline size_t nvs_lookup_cache_pos(uint16_t id) +{ + /* + * 1. The NVS settings backend uses up to (NVS_NAME_ID_OFFSET - 1) NVS IDs to + store keys and equal number of NVS IDs to store values. + * 2. For each key-value pair, the value is stored at NVS ID greater by exactly + * NVS_NAME_ID_OFFSET than NVS ID that holds the key. + * 3. The backend tries to minimize the range of NVS IDs used to store keys. + * That is, NVS IDs are allocated sequentially, and freed NVS IDs are reused + * before allocating new ones. + * + * Therefore, to assure the least number of collisions in the lookup cache, + * the least significant bit of the hash indicates whether the given NVS ID + * represents a key or a value, and remaining bits of the hash are set to + * the ordinal number of the key-value pair. Consequently, the hash function + * provides the following mapping: + * + * 1st settings key => hash 0 + * 1st settings value => hash 1 + * 2nd settings key => hash 2 + * 2nd settings value => hash 3 + * ... + */ + BUILD_ASSERT(IS_POWER_OF_TWO(NVS_NAMECNT_ID), "NVS_NAMECNT_ID is not power of 2"); + BUILD_ASSERT(IS_POWER_OF_TWO(NVS_NAME_ID_OFFSET), "NVS_NAME_ID_OFFSET is not power of 2"); + + uint16_t key_value_bit; + uint16_t key_value_ord; + + key_value_bit = (id >> LOG2(NVS_NAME_ID_OFFSET)) & 1; + key_value_ord = id & (NVS_NAME_ID_OFFSET - 1); + + return ((key_value_ord << 1) | key_value_bit) % CONFIG_NVS_LOOKUP_CACHE_SIZE; +} + +#else /* CONFIG_NVS_LOOKUP_CACHE_FOR_SETTINGS */ + static inline size_t nvs_lookup_cache_pos(uint16_t id) { uint16_t hash; @@ -36,6 +80,8 @@ static inline size_t nvs_lookup_cache_pos(uint16_t id) return hash % CONFIG_NVS_LOOKUP_CACHE_SIZE; } +#endif /* CONFIG_NVS_LOOKUP_CACHE_FOR_SETTINGS */ + static int nvs_lookup_cache_rebuild(struct nvs_fs *fs) { int rc; From 5f7678fd0f430fda8a8c6bdce86e0653bc172258 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B8e?= Date: Fri, 24 May 2024 15:32:07 +0200 Subject: [PATCH 1637/2141] [nrf noup] soc: nordic: nrf54l: Skip clock configuration from ns MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Do not permit configuring clocks from non-secure as NRF_OSCILLATORS is a not supported as a non-secure peripheral Signed-off-by: Sebastian Bøe (cherry picked from commit 4a163d030c88bc9d9a8c3f2069d4140d1f990d1c) --- soc/nordic/nrf54l/Kconfig | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/soc/nordic/nrf54l/Kconfig b/soc/nordic/nrf54l/Kconfig index 114c1dc6b5a6..a3473c967452 100644 --- a/soc/nordic/nrf54l/Kconfig +++ b/soc/nordic/nrf54l/Kconfig @@ -56,10 +56,18 @@ config SOC_NRF54LM20A_ENGA_CPUFLPR if SOC_SERIES_NRF54LX config SOC_NRF54LX_SKIP_CLOCK_CONFIG - bool "Skip clock frequency configuration in system initialization" + bool + prompt "Skip clock frequency configuration in system initialization" if TRUSTED_EXECUTION_SECURE + default y if TRUSTED_EXECUTION_NONSECURE help - With this option, the CPU clock frequency is not set during system initialization. - The CPU runs with the default, hardware-selected frequency. + With this option, the CPU clock frequency is not set during this + Zephyr image's system initialization. The CPU runs with either + the HW reset values, or with the configuration set by an image + earlier in the boot chain. + + Note that for security reasons it is not supported to configure + the clock peripheral (NRF_OSCILLATORS) from the non-secure + domain. config SOC_NRF54LX_DISABLE_FICR_TRIMCNF bool "Disable trimming of the device" From c8be59d0c1ac954d0318d67ac0c2559b33b2fa7c Mon Sep 17 00:00:00 2001 From: Rubin Gerritsen Date: Mon, 8 Jul 2024 10:08:10 +0200 Subject: [PATCH 1638/2141] [nrf noup] ci: Enable action-manifest-pr This action will automatically manage a PR to sdk-nrf once a PR to sdk-zephyr is created. This includes: - Creating an initial PR - Updating and (optionally) rebase it once the PR to sdk-nrf is merged. The action can be disabled by adding the string "manifest-pr-skip" to the title or body of the PR. This will simplify cherry-picking changes from upstream zephyr. Signed-off-by: Rubin Gerritsen (cherry picked from commit 7cf6f4fa8083e27ae79ba2c3160a870a1054380e) --- .github/workflows/manifest-PR.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/workflows/manifest-PR.yml diff --git a/.github/workflows/manifest-PR.yml b/.github/workflows/manifest-PR.yml new file mode 100644 index 000000000000..a871aa381ded --- /dev/null +++ b/.github/workflows/manifest-PR.yml @@ -0,0 +1,17 @@ +name: handle manifest PR +on: + pull_request_target: + types: [opened, synchronize, closed] + branches: + - main + + +jobs: + call-manifest-pr-action: + runs-on: ubuntu-latest + steps: + - name: handle manifest PR + uses: nrfconnect/action-manifest-pr@main + with: + token: ${{ secrets.NCS_GITHUB_TOKEN }} + manifest-pr-title-details: ${{ github.event.pull_request.title }} From d8c4ba187461529b84a1a5a26984a2b372edd7ce Mon Sep 17 00:00:00 2001 From: Mateusz Michalek Date: Mon, 17 Jun 2024 14:57:09 +0200 Subject: [PATCH 1639/2141] [nrf noup] drivers: flash: kconfig: nrf_rram region resolution adjusting region resolution to match erase-block-size Signed-off-by: Mateusz Michalek (cherry picked from commit 73823d3b105fd8547e1363ec07d91d0da1665ba1) --- drivers/flash/Kconfig.nrf_rram | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/flash/Kconfig.nrf_rram b/drivers/flash/Kconfig.nrf_rram index 3dea687a0f80..a59560e86a46 100644 --- a/drivers/flash/Kconfig.nrf_rram +++ b/drivers/flash/Kconfig.nrf_rram @@ -70,14 +70,14 @@ config SOC_FLASH_NRF_TIMEOUT_MULTIPLIER config NRF_RRAM_REGION_ADDRESS_RESOLUTION hex - default 0x400 + default 0x1000 help RRAMC's region protection address resolution. Applies to region with configurable start address. config NRF_RRAM_REGION_SIZE_UNIT hex - default 0x400 + default 0x1000 help Base unit for the size of RRAMC's region protection. From 275f20ec6e6d39c4b3e6411a6a5dffc5b084af04 Mon Sep 17 00:00:00 2001 From: Rubin Gerritsen Date: Tue, 16 Jul 2024 14:43:30 +0200 Subject: [PATCH 1640/2141] [nrf noup] dts: Add Bluetooth Controller to nRF54H20 The nRF54H20 supports a Bluetooth controller. The HCI driver interface has changed upstream in https://github.com/zephyrproject-rtos/zephyr/pull/72323 so now we need to add it to device tree. Signed-off-by: Rubin Gerritsen (cherry picked from commit e9a13c3d91f2ce76abcdb72c62455578fbf2257a) (cherry picked from commit 6f17dc3e1d057a260efb291a63f4d2d94cb94d6d) --- dts/arm/nordic/nrf54h20_cpurad.dtsi | 8 ++++++++ dts/vendor/nordic/nrf54h20.dtsi | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/dts/arm/nordic/nrf54h20_cpurad.dtsi b/dts/arm/nordic/nrf54h20_cpurad.dtsi index 279bc7581112..bf194df4478f 100644 --- a/dts/arm/nordic/nrf54h20_cpurad.dtsi +++ b/dts/arm/nordic/nrf54h20_cpurad.dtsi @@ -23,6 +23,10 @@ wdt011: &cpurad_wdt011 {}; /delete-node/ &cpuflpr; / { + chosen { + zephyr,bt-hci = &bt_hci_controller; + }; + soc { compatible = "simple-bus"; interrupt-parent = <&cpurad_nvic>; @@ -159,3 +163,7 @@ wdt011: &cpurad_wdt011 {}; &gpio_pad_group9 { status = "okay"; }; + +&bt_hci_controller { + status = "okay"; +}; diff --git a/dts/vendor/nordic/nrf54h20.dtsi b/dts/vendor/nordic/nrf54h20.dtsi index b6bf93238b49..1f4160ac8978 100644 --- a/dts/vendor/nordic/nrf54h20.dtsi +++ b/dts/vendor/nordic/nrf54h20.dtsi @@ -482,6 +482,14 @@ compatible = "nordic,nrf-ieee802154"; status = "disabled"; }; + + /* Note: In the nRF Connect SDK the SoftDevice Controller + * is added and set as the default Bluetooth Controller. + */ + bt_hci_controller: bt_hci_controller { + compatible = "zephyr,bt-hci-ll-sw-split"; + status = "disabled"; + }; }; ccm030: ccm@3a000 { From d1d9b2d1e653ca70f8aa34bc74cf13c4d09a4a4a Mon Sep 17 00:00:00 2001 From: Marek Pieta Date: Fri, 14 Jun 2024 09:13:48 +0200 Subject: [PATCH 1641/2141] [nrf noup] bluetooth: att: Allow ATT sent callback after data TX is done By default, the BLE stack calls sent callback for ATT data when the data is passed to BLE controller for transmission. Enabling this Kconfig option delays calling the sent callback until data transmission is finished by BLE controller (the callback is delayed until receiving the num complete packets event). Jira: NCSDK-27422 Signed-off-by: Marek Pieta (cherry picked from commit 5b9ea8c24b78a4be7e83f5cdbe1fead42b659f44) --- subsys/bluetooth/host/Kconfig.gatt | 17 +++++++++++++++++ subsys/bluetooth/host/att.c | 17 ++++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/subsys/bluetooth/host/Kconfig.gatt b/subsys/bluetooth/host/Kconfig.gatt index a04241a3e94f..221bc413c4bc 100644 --- a/subsys/bluetooth/host/Kconfig.gatt +++ b/subsys/bluetooth/host/Kconfig.gatt @@ -38,6 +38,23 @@ config BT_ATT_RETRY_ON_SEC_ERR If an ATT request fails due to insufficient security, the host will try to elevate the security level and retry the ATT request. +config BT_ATT_SENT_CB_AFTER_TX + bool "Delay ATT sent callback until data transmission is done by controller [EXPERIMENTAL]" + select EXPERIMENTAL + help + By default, the BLE stack calls sent callback for ATT data when the + data is passed to BLE controller for transmission. Enabling this + Kconfig option delays calling the sent callback until data + transmission is finished by BLE controller (the callback is called + upon receiving the Number of Completed Packets HCI Event). + + The feature is not available in Zephyr RTOS (it's specific to NCS + Zephyr fork). It is a temporary solution allowing to control flow of + GATT notifications with HID reports for HID use-case. + + Enabling this option may require increasing CONFIG_BT_CONN_TX_MAX in + configuration, because ATT would use additional TX contexts. + config BT_EATT bool "Enhanced ATT Bearers support [EXPERIMENTAL]" depends on BT_L2CAP_ECRED diff --git a/subsys/bluetooth/host/att.c b/subsys/bluetooth/host/att.c index 82d82526b5b0..37d8856bad24 100644 --- a/subsys/bluetooth/host/att.c +++ b/subsys/bluetooth/host/att.c @@ -328,6 +328,13 @@ static void att_disconnect(struct bt_att_chan *chan) } } +static void chan_sent_cb(struct bt_conn *conn, void *user_data, int err) +{ + struct net_buf *nb = user_data; + + net_buf_unref(nb); +} + /* In case of success the ownership of the buffer is transferred to the stack * which takes care of releasing it when it completes transmitting to the * controller. @@ -421,7 +428,15 @@ static int chan_send(struct bt_att_chan *chan, struct net_buf *buf) data->att_chan = chan; - err = bt_l2cap_send_pdu(&chan->chan, buf, NULL, NULL); + if (IS_ENABLED(CONFIG_BT_ATT_SENT_CB_AFTER_TX)) { + err = bt_l2cap_send_pdu(&chan->chan, buf, chan_sent_cb, net_buf_ref(buf)); + if (err) { + net_buf_unref(buf); + } + } else { + err = bt_l2cap_send_pdu(&chan->chan, buf, NULL, NULL); + } + if (err) { if (err == -ENOBUFS) { LOG_ERR("Ran out of TX buffers or contexts."); From bdef61c8307093d8ef590bb6533c8d8dbd2d412c Mon Sep 17 00:00:00 2001 From: Sigurd Hellesvik Date: Fri, 23 Aug 2024 11:24:06 +0200 Subject: [PATCH 1642/2141] [nrf noup] board: nordic_ thingy53: Enable QSPI by default The Thingy:53 enabled MCUboot and external flash by default. Therefore, it should also enable drivers for its external flash by default. Signed-off-by: Sigurd Hellesvik (cherry picked from commit 20671bcf45981a4491aea49326e530978e79d792) --- boards/nordic/thingy53/Kconfig.defconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/boards/nordic/thingy53/Kconfig.defconfig b/boards/nordic/thingy53/Kconfig.defconfig index badcb5c20e5d..b7f33e89bf1b 100644 --- a/boards/nordic/thingy53/Kconfig.defconfig +++ b/boards/nordic/thingy53/Kconfig.defconfig @@ -97,6 +97,9 @@ config MCUBOOT_USB_SUPPORT bool default n +config NORDIC_QSPI_NOR + default y + endif # BOARD_THINGY53_NRF5340_CPUAPP || BOARD_THINGY53_NRF5340_CPUAPP_NS if BOARD_THINGY53_NRF5340_CPUNET From 0fb761832466933b322fb8030c9ec934b62aa128 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Mon, 9 Sep 2024 08:31:03 +0100 Subject: [PATCH 1643/2141] [nrf noup] mgmt: mcumgr: grp: img_mgmt: Add handling for QSPI XIP Adds handling code to allow selecting the correct image slot when using QSPI XIP in DirectXIP mode In case of Direct XIP and multiple images, the radio active slot changes accordingly (i.e. application slot 1 boots radio slot 1). Signed-off-by: Jamie McCrae Signed-off-by: Tomasz Chyrowicz (cherry picked from commit a5b67c16269292d3f1f921238591cb8cb848c004) --- subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig | 8 ++++++++ subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig b/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig index 0915d70e8706..5f122fcf71fc 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig @@ -219,6 +219,14 @@ config MCUMGR_GRP_IMG_SLOT_INFO_HOOKS This will enable the slot info function hooks which can be used to add additional information to responses. +config MCUMGR_GRP_IMG_QSPI_XIP_SPLIT_IMAGE + bool "QSPI XIP Split image mode" + depends on MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP + help + This option should not be selected by users and should automatically be selected by + sysbuild if needed. This enables selecting the correct slot when running a QSPI XIP + split image application in DirectXIP mode. + module = MCUMGR_GRP_IMG module-str = mcumgr_grp_img source "subsys/logging/Kconfig.template.log_config" diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c index 4c3975f3aad4..05e3a9c64889 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c @@ -235,6 +235,14 @@ int img_mgmt_active_slot(int image) /* Multi image does not support DirectXIP or RAM load currently */ #if CONFIG_MCUMGR_GRP_IMG_UPDATABLE_IMAGE_NUMBER > 1 slot = (image << 1); + +#if defined(CONFIG_MCUMGR_GRP_IMG_QSPI_XIP_SPLIT_IMAGE) || \ + defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP) || \ + defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP_WITH_REVERT) + if (FIXED_PARTITION_IS_RUNNING_APP_PARTITION(slot1_partition)) { + slot += 1; + } +#endif #elif defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_RAM_LOAD) /* RAM load requires querying bootloader */ int rc; From 2b3a0c68b162fdada21dabbef3027b5bd40675ee Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Mon, 16 Sep 2024 15:09:50 +0200 Subject: [PATCH 1644/2141] [nrf noup] boards/nordic/nrf54l15dk: Set ROM offset by PM While Partition Manager is enabled, it manages the offset by itself. Signed-off-by: Andrzej Puzdrowski (cherry picked from commit cea66ec75f604cbdc74f67165cb50ea478c716cd) --- boards/nordic/nrf54l15dk/Kconfig.defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/boards/nordic/nrf54l15dk/Kconfig.defconfig b/boards/nordic/nrf54l15dk/Kconfig.defconfig index 49e38070a01a..c9155426d02d 100644 --- a/boards/nordic/nrf54l15dk/Kconfig.defconfig +++ b/boards/nordic/nrf54l15dk/Kconfig.defconfig @@ -8,6 +8,7 @@ if BOARD_NRF54L15DK_NRF54L05_CPUAPP || BOARD_NRF54L15DK_NRF54L10_CPUAPP || \ BOARD_NRF54L15DK_NRF54L15_CPUAPP config ROM_START_OFFSET + default 0 if PARTITION_MANAGER_ENABLED default 0x800 if BOOTLOADER_MCUBOOT endif # BOARD_NRF54L15DK_NRF54L05_CPUAPP || BOARD_NRF54L15DK_NRF54L10_CPUAPP || \ From f817be34d8ca3c390a7388da456a50e287b22b15 Mon Sep 17 00:00:00 2001 From: Jakub Zymelka Date: Thu, 26 Sep 2024 12:40:33 +0200 Subject: [PATCH 1645/2141] [nrf noup] samples: basic: blinky: add eGPIO tests configuration Add overlay for nrf54l15dk to enable eGPIO tests. Signed-off-by: Jakub Zymelka Signed-off-by: Marcin Szymczyk (cherry picked from commit 40b222de413d542f187f039da8eb1e9e3d9a359d) --- .../boards/nrf54l15dk_nrf54l15_cpuapp_hpf_gpio.overlay | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 samples/basic/blinky/boards/nrf54l15dk_nrf54l15_cpuapp_hpf_gpio.overlay diff --git a/samples/basic/blinky/boards/nrf54l15dk_nrf54l15_cpuapp_hpf_gpio.overlay b/samples/basic/blinky/boards/nrf54l15dk_nrf54l15_cpuapp_hpf_gpio.overlay new file mode 100644 index 000000000000..bd1ceb2f8945 --- /dev/null +++ b/samples/basic/blinky/boards/nrf54l15dk_nrf54l15_cpuapp_hpf_gpio.overlay @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +&led0 { + gpios = <&hpf_gpio 9 GPIO_ACTIVE_HIGH>; +}; From 0a47507eb080ab772f851dea47e44893e4335b28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Audun=20Kvamtr=C3=B8?= Date: Wed, 11 Sep 2024 10:17:28 +0200 Subject: [PATCH 1646/2141] [nrf noup] modules: mbedtls: Disable configurations in Kconfig.tls-generic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -This commit prevents legacy mbed TLS configurations from being in conflict with PSA Configurations while using nrf_security. -This [nrf noup] is reworked from an earlier cherry-pick of commit d8c96cfab37d3738dac933075780f6ca24593447, but has the following changes: - Endif's relevant that is using our pattern for masking configs duplicated or in conflict in nrf_security (by using if !(NRF_SECURITY || NORDIC_SECURITY_BACKEND)) is made clearer by adding a comment at their corresponding endif (# !(NRF_SECURITY || NORDIC_SECURITY_BACKEND)) - Changes to zephyr_init.c for entropy_dev checking for CONFIG_NRF_CC3XX_PLATFORM is removed as the symbol entropy_dev doesn't exist in this file anymore ref: NCSDK-13503 Signed-off-by: Frank Audun Kvamtrø (cherry picked from commit c62b6ebb411e687814e89652273b333a4b47bbae) --- modules/mbedtls/Kconfig.mbedtls | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/modules/mbedtls/Kconfig.mbedtls b/modules/mbedtls/Kconfig.mbedtls index 4a71ec496142..df2422d4c1e5 100644 --- a/modules/mbedtls/Kconfig.mbedtls +++ b/modules/mbedtls/Kconfig.mbedtls @@ -7,6 +7,8 @@ menu "Mbed TLS configuration" depends on MBEDTLS_BUILTIN && MBEDTLS_CFG_FILE = "config-mbedtls.h" +if !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) + menu "TLS" config MBEDTLS_TLS_VERSION_1_2 @@ -40,6 +42,8 @@ endif # MBEDTLS_TLS_VERSION_1_2 || MBEDTLS_TLS_VERSION_1_3 endmenu # TLS +endif # !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) + menu "Ciphersuite configuration" comment "Supported key exchange modes" @@ -60,6 +64,8 @@ config MBEDTLS_GENPRIME_ENABLED endif # MBEDTLS_RSA_C +if !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) + config MBEDTLS_KEY_EXCHANGE_ALL_ENABLED bool "All available ciphersuite modes" select MBEDTLS_MD @@ -92,6 +98,8 @@ config MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED bool "RSA-PSK based ciphersuite modes" depends on MBEDTLS_PKCS1_V15 || MBEDTLS_PKCS1_V21 +endif # !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) + config MBEDTLS_PSK_MAX_LEN int "Max size of TLS pre-shared keys" default 32 @@ -99,6 +107,8 @@ config MBEDTLS_PSK_MAX_LEN Max size of TLS pre-shared keys, in bytes. It has no effect if no PSK key exchange is used. +if !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) + config MBEDTLS_KEY_EXCHANGE_RSA_ENABLED bool "RSA-only based ciphersuite modes" depends on MBEDTLS_MD @@ -236,8 +246,12 @@ config MBEDTLS_ECP_NIST_OPTIM endif +endif # !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) + comment "Supported ciphers and cipher modes" +if !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) + config MBEDTLS_CIPHER_ALL_ENABLED bool "All available ciphers and modes" select MBEDTLS_CIPHER_AES_ENABLED @@ -328,8 +342,12 @@ config MBEDTLS_CMAC bool "CMAC (Cipher-based Message Authentication Code) mode for block ciphers." depends on MBEDTLS_CIPHER_AES_ENABLED || MBEDTLS_CIPHER_DES_ENABLED +endif # !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) + comment "Supported hash algorithms" +if !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) + config MBEDTLS_HASH_ALL_ENABLED bool "All available MAC methods" select MBEDTLS_MD5 @@ -370,10 +388,14 @@ config MBEDTLS_SHA512 config MBEDTLS_POLY1305 bool "Poly1305 hash family" +endif # !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) + endmenu comment "Random number generators" +if !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) + config MBEDTLS_CTR_DRBG_ENABLED bool "CTR_DRBG AES-256-based random generator" depends on MBEDTLS_CIPHER_AES_ENABLED @@ -383,15 +405,21 @@ config MBEDTLS_HMAC_DRBG_ENABLED bool "HMAC_DRBG random generator" select MBEDTLS_MD +endif # !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) + comment "Other configurations" config MBEDTLS_CIPHER bool "generic cipher layer." default y if PSA_WANT_ALG_CMAC +if !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) + config MBEDTLS_MD bool "generic message digest layer." +endif # !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) + config MBEDTLS_ASN1_PARSE_C bool "Support for ASN1 parser functions" @@ -431,6 +459,8 @@ config MBEDTLS_HAVE_ASM of asymmetric cryptography, however this might have an impact on the code size. +if !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) + config MBEDTLS_ENTROPY_C bool "Mbed TLS entropy accumulator" depends on MBEDTLS_SHA256 || MBEDTLS_SHA384 || MBEDTLS_SHA512 @@ -439,6 +469,8 @@ config MBEDTLS_ENTROPY_C mostly used in conjunction with CTR_DRBG or HMAC_DRBG to create a deterministic random number generator. +endif # !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) + config MBEDTLS_ENTROPY_POLL_ZEPHYR bool "Provide entropy data to Mbed TLS through entropy driver or random generator" default y From d76ed2156a33ac9555abb9c2ba353c5b982ad17a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Audun=20Kvamtr=C3=B8?= Date: Mon, 9 Sep 2024 14:55:05 +0200 Subject: [PATCH 1647/2141] [nrf noup] mbedtls: Enable PSA_WANT_GENERATE_RANDOM for PSA RNG MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -This is a [nrf noup] because PSA_WANT_GENERATE_RANDOM is a Nordic configuration that is not found upstream. This was previously in commit 5cfe5750b622efff77427425bf61854a95ade9fb but has been split out Signed-off-by: Frank Audun Kvamtrø (cherry picked from commit 3c07722fbc78e7432f561696e82bf77982f4550a) --- drivers/entropy/Kconfig.psa_crypto | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/entropy/Kconfig.psa_crypto b/drivers/entropy/Kconfig.psa_crypto index d06001225b05..18514a071d1c 100644 --- a/drivers/entropy/Kconfig.psa_crypto +++ b/drivers/entropy/Kconfig.psa_crypto @@ -7,6 +7,7 @@ config ENTROPY_PSA_CRYPTO_RNG bool "PSA Crypto Random source Entropy driver" depends on DT_HAS_ZEPHYR_PSA_CRYPTO_RNG_ENABLED select ENTROPY_HAS_DRIVER + select PSA_WANT_GENERATE_RANDOM default y help Enable the PSA Crypto source Entropy driver. From 7f3d02e9eac7962bb4f77040c507afd4325c9e15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Audun=20Kvamtr=C3=B8?= Date: Wed, 21 Aug 2024 12:35:25 +0200 Subject: [PATCH 1648/2141] [nrf noup] mbedtls: Remove unsupported algorithms in PSA crypto MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -This commit is a [nrf noup] because it removes configuration options for cryptographic algortihms available in Mbed TLS but which is not actively supported in nRF Connect SDK. The list of algorithms removed: - AES CFB - Cipher Feedback block cipher - AES OFB - Output Feedback block cipher - FFDH - RIPEMD160 - Aria - Camellia - DES The removal of these algorithms is based both on a wish to remove weaker cryptography and unsupported features in the products we have today. Signed-off-by: Frank Audun Kvamtrø (cherry picked from commit 32fa048131dc1eb8dd223c99c3e40649efb720bf) --- modules/mbedtls/Kconfig.psa.auto | 61 ------------------------------- modules/mbedtls/Kconfig.psa.logic | 7 ---- 2 files changed, 68 deletions(-) diff --git a/modules/mbedtls/Kconfig.psa.auto b/modules/mbedtls/Kconfig.psa.auto index 08b1bbc02410..56a81dd6efda 100644 --- a/modules/mbedtls/Kconfig.psa.auto +++ b/modules/mbedtls/Kconfig.psa.auto @@ -36,10 +36,6 @@ config PSA_WANT_ALG_CMAC bool "PSA_WANT_ALG_CMAC" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL -config PSA_WANT_ALG_CFB - bool "PSA_WANT_ALG_CFB" if !MBEDTLS_PROMPTLESS - default y if PSA_CRYPTO_ENABLE_ALL - config PSA_WANT_ALG_CHACHA20_POLY1305 bool "PSA_WANT_ALG_CHACHA20_POLY1305" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL @@ -60,10 +56,6 @@ config PSA_WANT_ALG_ECDH bool "PSA_WANT_ALG_ECDH" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL -config PSA_WANT_ALG_FFDH - bool "PSA_WANT_ALG_FFDH" if !MBEDTLS_PROMPTLESS - default y if PSA_CRYPTO_ENABLE_ALL - config PSA_WANT_ALG_ECDSA bool "PSA_WANT_ALG_ECDSA" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL @@ -96,9 +88,6 @@ config PSA_WANT_ALG_MD5 bool "PSA_WANT_ALG_MD5" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL -config PSA_WANT_ALG_OFB - bool "PSA_WANT_ALG_OFB" if !MBEDTLS_PROMPTLESS - default y if PSA_CRYPTO_ENABLE_ALL config PSA_WANT_ALG_PBKDF2_HMAC bool "PSA_WANT_ALG_PBKDF2_HMAC" if !MBEDTLS_PROMPTLESS @@ -108,9 +97,6 @@ config PSA_WANT_ALG_PBKDF2_AES_CMAC_PRF_128 bool "PSA_WANT_ALG_PBKDF2_AES_CMAC_PRF_128" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL -config PSA_WANT_ALG_RIPEMD160 - bool "PSA_WANT_ALG_RIPEMD160" if !MBEDTLS_PROMPTLESS - default y if PSA_CRYPTO_ENABLE_ALL config PSA_WANT_ALG_RSA_OAEP bool "PSA_WANT_ALG_RSA_OAEP" if !MBEDTLS_PROMPTLESS @@ -228,26 +214,6 @@ config PSA_WANT_ECC_SECP_R1_521 bool "PSA_WANT_ECC_SECP_R1_521" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL -config PSA_WANT_DH_RFC7919_2048 - bool "PSA_WANT_DH_RFC7919_2048" if !MBEDTLS_PROMPTLESS - default y if PSA_CRYPTO_ENABLE_ALL - -config PSA_WANT_DH_RFC7919_3072 - bool "PSA_WANT_DH_RFC7919_3072" if !MBEDTLS_PROMPTLESS - default y if PSA_CRYPTO_ENABLE_ALL - -config PSA_WANT_DH_RFC7919_4096 - bool "PSA_WANT_DH_RFC7919_4096" if !MBEDTLS_PROMPTLESS - default y if PSA_CRYPTO_ENABLE_ALL - -config PSA_WANT_DH_RFC7919_6144 - bool "PSA_WANT_DH_RFC7919_6144" if !MBEDTLS_PROMPTLESS - default y if PSA_CRYPTO_ENABLE_ALL - -config PSA_WANT_DH_RFC7919_8192 - bool "PSA_WANT_DH_RFC7919_8192" if !MBEDTLS_PROMPTLESS - default y if PSA_CRYPTO_ENABLE_ALL - config PSA_WANT_KEY_TYPE_DERIVE bool "PSA_WANT_KEY_TYPE_DERIVE" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL @@ -268,30 +234,15 @@ config PSA_WANT_KEY_TYPE_AES bool "PSA_WANT_KEY_TYPE_AES" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL -config PSA_WANT_KEY_TYPE_ARIA - bool "PSA_WANT_KEY_TYPE_ARIA" if !MBEDTLS_PROMPTLESS - default y if PSA_CRYPTO_ENABLE_ALL - -config PSA_WANT_KEY_TYPE_CAMELLIA - bool "PSA_WANT_KEY_TYPE_CAMELLIA" if !MBEDTLS_PROMPTLESS - default y if PSA_CRYPTO_ENABLE_ALL - config PSA_WANT_KEY_TYPE_CHACHA20 bool "PSA_WANT_KEY_TYPE_CHACHA20" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL -config PSA_WANT_KEY_TYPE_DES - bool "PSA_WANT_KEY_TYPE_DES" if !MBEDTLS_PROMPTLESS - default y if PSA_CRYPTO_ENABLE_ALL config PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY bool "PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL -config PSA_WANT_KEY_TYPE_DH_PUBLIC_KEY - bool "PSA_WANT_KEY_TYPE_DH_PUBLIC_KEY" if !MBEDTLS_PROMPTLESS - default y if PSA_CRYPTO_ENABLE_ALL - config PSA_WANT_KEY_TYPE_RAW_DATA bool "PSA_WANT_KEY_TYPE_RAW_DATA" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL @@ -328,16 +279,4 @@ config PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_GENERATE bool "PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_GENERATE" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL -config PSA_WANT_KEY_TYPE_DH_KEY_PAIR_IMPORT - bool "PSA_WANT_KEY_TYPE_DH_KEY_PAIR_IMPORT" if !MBEDTLS_PROMPTLESS - default y if PSA_CRYPTO_ENABLE_ALL - -config PSA_WANT_KEY_TYPE_DH_KEY_PAIR_EXPORT - bool "PSA_WANT_KEY_TYPE_DH_KEY_PAIR_EXPORT" if !MBEDTLS_PROMPTLESS - default y if PSA_CRYPTO_ENABLE_ALL - -config PSA_WANT_KEY_TYPE_DH_KEY_PAIR_GENERATE - bool "PSA_WANT_KEY_TYPE_DH_KEY_PAIR_GENERATE" if !MBEDTLS_PROMPTLESS - default y if PSA_CRYPTO_ENABLE_ALL - endif # PSA_CRYPTO_CLIENT diff --git a/modules/mbedtls/Kconfig.psa.logic b/modules/mbedtls/Kconfig.psa.logic index dcea9e354052..2de81163dc1f 100644 --- a/modules/mbedtls/Kconfig.psa.logic +++ b/modules/mbedtls/Kconfig.psa.logic @@ -18,10 +18,3 @@ config PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_BASIC depends on PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_IMPORT || \ PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_EXPORT || \ PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_GENERATE - -config PSA_WANT_KEY_TYPE_DH_KEY_PAIR_BASIC - bool - default y - depends on PSA_WANT_KEY_TYPE_DH_KEY_PAIR_IMPORT || \ - PSA_WANT_KEY_TYPE_DH_KEY_PAIR_EXPORT || \ - PSA_WANT_KEY_TYPE_DH_KEY_PAIR_GENERATE From 986ba03091e540b5d64f7f5465a48d88c8a529e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Audun=20Kvamtr=C3=B8?= Date: Wed, 21 Aug 2024 12:49:58 +0200 Subject: [PATCH 1649/2141] [nrf noup] mbedtls: Add dependency logic for PSA crypto configurations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -This is a [nrf noup] as this the upstream version of PSA crypto configs is generated by tooling, and there is no mechanisms to qualify that dependent configurations are enabled (by depends or select). -This adds dependency-mapping between configurations in the Kconfigs added for PSA crypto in upstream. -Selecting CHACHA20 key type if PSA_WANT_ALG_STREAM_CIPHER is enabled Signed-off-by: Frank Audun Kvamtrø (cherry picked from commit 2abfddff4d8f12849a31dd0842e0a7a07825847e) --- modules/mbedtls/Kconfig.psa.auto | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/modules/mbedtls/Kconfig.psa.auto b/modules/mbedtls/Kconfig.psa.auto index 56a81dd6efda..fa8cdbc7b536 100644 --- a/modules/mbedtls/Kconfig.psa.auto +++ b/modules/mbedtls/Kconfig.psa.auto @@ -71,6 +71,7 @@ config PSA_WANT_ALG_GCM config PSA_WANT_ALG_HKDF bool "PSA_WANT_ALG_HKDF" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL + depends on PSA_WANT_ALG_HMAC config PSA_WANT_ALG_HKDF_EXTRACT bool "PSA_WANT_ALG_HKDF_EXTRACT" if !MBEDTLS_PROMPTLESS @@ -92,11 +93,12 @@ config PSA_WANT_ALG_MD5 config PSA_WANT_ALG_PBKDF2_HMAC bool "PSA_WANT_ALG_PBKDF2_HMAC" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL + depends on PSA_WANT_ALG_HMAC config PSA_WANT_ALG_PBKDF2_AES_CMAC_PRF_128 bool "PSA_WANT_ALG_PBKDF2_AES_CMAC_PRF_128" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL - + depends on PSA_WANT_ALG_CMAC config PSA_WANT_ALG_RSA_OAEP bool "PSA_WANT_ALG_RSA_OAEP" if !MBEDTLS_PROMPTLESS @@ -153,18 +155,22 @@ config PSA_WANT_ALG_SHA3_512 config PSA_WANT_ALG_STREAM_CIPHER bool "PSA_WANT_ALG_STREAM_CIPHER" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL + select PSA_WANT_KEY_TYPE_CHACHA20 config PSA_WANT_ALG_TLS12_PRF bool "PSA_WANT_ALG_TLS12_PRF" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL + depends on PSA_WANT_ALG_HMAC config PSA_WANT_ALG_TLS12_PSK_TO_MS bool "PSA_WANT_ALG_TLS12_PSK_TO_MS" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL + depends on PSA_WANT_ALG_HMAC config PSA_WANT_ALG_TLS12_ECJPAKE_TO_PMS bool "PSA_WANT_ALG_TLS12_ECJPAKE_TO_PMS" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL + depends on PSA_WANT_ALG_SHA_256 config PSA_WANT_ECC_BRAINPOOL_P_R1_256 bool "PSA_WANT_ECC_BRAINPOOL_P_R1_256" if !MBEDTLS_PROMPTLESS @@ -237,7 +243,8 @@ config PSA_WANT_KEY_TYPE_AES config PSA_WANT_KEY_TYPE_CHACHA20 bool "PSA_WANT_KEY_TYPE_CHACHA20" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL - + depends on PSA_WANT_ALG_CHACHA20_POLY1305 || \ + PSA_WANT_ALG_STREAM_CIPHER config PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY bool "PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY" if !MBEDTLS_PROMPTLESS @@ -253,30 +260,37 @@ config PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY config PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT bool "PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT" if !MBEDTLS_PROMPTLESS + select PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY default y if PSA_CRYPTO_ENABLE_ALL config PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_EXPORT bool "PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_EXPORT" if !MBEDTLS_PROMPTLESS + select PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY default y if PSA_CRYPTO_ENABLE_ALL config PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_GENERATE bool "PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_GENERATE" if !MBEDTLS_PROMPTLESS + select PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY default y if PSA_CRYPTO_ENABLE_ALL config PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_DERIVE bool "PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_DERIVE" if !MBEDTLS_PROMPTLESS + select PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY default y if PSA_CRYPTO_ENABLE_ALL config PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_IMPORT bool "PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_IMPORT" if !MBEDTLS_PROMPTLESS + select PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY default y if PSA_CRYPTO_ENABLE_ALL config PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_EXPORT bool "PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_EXPORT" if !MBEDTLS_PROMPTLESS + select PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY default y if PSA_CRYPTO_ENABLE_ALL config PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_GENERATE bool "PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_GENERATE" if !MBEDTLS_PROMPTLESS + select PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY default y if PSA_CRYPTO_ENABLE_ALL endif # PSA_CRYPTO_CLIENT From 6a1fabd1938bfce76b859fba7040a6cbcf24041b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Audun=20Kvamtr=C3=B8?= Date: Wed, 21 Aug 2024 12:53:27 +0200 Subject: [PATCH 1650/2141] [nrf noup] mbedtls: Adding helptext warnings for weak crypto MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -This commit is a [nrf noup] because PSA crypto configs in upstream Zephyr doesn't have help-text in their configurations and we don't want to duplicate configurations to control the value -This adds warning for SHA-1 and MD5 usage Signed-off-by: Frank Audun Kvamtrø (cherry picked from commit 76dee8cd798e036c3d034df18006e06c1b9431f6) --- modules/mbedtls/Kconfig.psa.auto | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/mbedtls/Kconfig.psa.auto b/modules/mbedtls/Kconfig.psa.auto index fa8cdbc7b536..834252432b52 100644 --- a/modules/mbedtls/Kconfig.psa.auto +++ b/modules/mbedtls/Kconfig.psa.auto @@ -88,7 +88,9 @@ config PSA_WANT_ALG_HMAC config PSA_WANT_ALG_MD5 bool "PSA_WANT_ALG_MD5" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL - + help + Warning: The MD5 hash is weak and deprecated and is only recommended + for use in legacy protocols. config PSA_WANT_ALG_PBKDF2_HMAC bool "PSA_WANT_ALG_PBKDF2_HMAC" if !MBEDTLS_PROMPTLESS @@ -119,6 +121,9 @@ config PSA_WANT_ALG_RSA_PSS config PSA_WANT_ALG_SHA_1 bool "PSA_WANT_ALG_SHA_1" if !MBEDTLS_PROMPTLESS default y if PSA_CRYPTO_ENABLE_ALL + help + Warning: The SHA-1 hash is weak and deprecated and is only recommended + for use in legacy protocols. config PSA_WANT_ALG_SHA_224 bool "PSA_WANT_ALG_SHA_224" if !MBEDTLS_PROMPTLESS From ea825d0870dde7f98ced0798a99827ccc011be03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Audun=20Kvamtr=C3=B8?= Date: Wed, 21 Aug 2024 12:56:48 +0200 Subject: [PATCH 1651/2141] [nrf noup] mbedtls: Adding missing configuration for RSA key type derive MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -This is a [nrf noup] because the upstream Zephyr is generated using a script and is not committed as-is as source-code. The relevant responsible person for this feature has received information about the missing configuration and this will be resolved upstream in Mbed TLS and will propagate down to zephyr. Once this has happened, this [nrf noup] can be dropped. -Add missing PSA_WANT_KEY_TYPE_RSA_KEY_DERIVE Signed-off-by: Frank Audun Kvamtrø (cherry picked from commit 414a6c3008ad17b54a22682962c6eddfa47d6368) --- modules/mbedtls/Kconfig.psa.auto | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/mbedtls/Kconfig.psa.auto b/modules/mbedtls/Kconfig.psa.auto index 834252432b52..b235c30380fb 100644 --- a/modules/mbedtls/Kconfig.psa.auto +++ b/modules/mbedtls/Kconfig.psa.auto @@ -298,4 +298,9 @@ config PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_GENERATE select PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY default y if PSA_CRYPTO_ENABLE_ALL +config PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_DERIVE + bool "PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_DERIVE" if !MBEDTLS_PROMPTLESS + select PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY + default y if PSA_CRYPTO_ENABLE_ALL + endif # PSA_CRYPTO_CLIENT From 006009543398a8acf347ae56feb7b4b4e32fb415 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Audun=20Kvamtr=C3=B8?= Date: Thu, 5 Sep 2024 15:05:43 +0200 Subject: [PATCH 1652/2141] [nrf noup] mbedtls: Don't select PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_BASIC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_BASIC is internally resolved by Mbed TLS. It has been made promptless in a previous commit. Keeping this change separated since the Kconfig.psa is auto-generated and it would likely be a bit more complex to handle this in a single commit. Upstream maintainers have been notified about this mismatch in configurations. Signed-off-by: Frank Audun Kvamtrø (cherry picked from commit 34341c43b31bb2c60c84b98e4322b465edd0e433) --- modules/mbedtls/Kconfig.mbedtls | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/mbedtls/Kconfig.mbedtls b/modules/mbedtls/Kconfig.mbedtls index df2422d4c1e5..b0077361908c 100644 --- a/modules/mbedtls/Kconfig.mbedtls +++ b/modules/mbedtls/Kconfig.mbedtls @@ -117,6 +117,7 @@ config MBEDTLS_KEY_EXCHANGE_RSA_ENABLED select PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_IMPORT if PSA_CRYPTO_CLIENT select PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_EXPORT if PSA_CRYPTO_CLIENT select PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_GENERATE if PSA_CRYPTO_CLIENT + select PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_DERIVE if PSA_CRYPTO_CLIENT config MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED bool "DHE-RSA based ciphersuite modes" From ce51dfa849174003ee646f97b3977f0fbbad54ed Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Tue, 7 May 2024 08:27:09 +0100 Subject: [PATCH 1653/2141] [nrf noup] kernel: banner: Make function weak Makes the boot banner function weak, this resolves an issue when building with llext enabled which uses different build options than a normal zephyr build Signed-off-by: Jamie McCrae (cherry picked from commit 717e659b48410693135e5e630579ab4671633cb7) --- kernel/banner.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/banner.c b/kernel/banner.c index 5cadda0a5e98..a16784cb975c 100644 --- a/kernel/banner.c +++ b/kernel/banner.c @@ -24,7 +24,7 @@ #endif /* BUILD_VERSION */ #endif /* !BANNER_VERSION */ -void boot_banner(void) +__weak void boot_banner(void) { #if defined(CONFIG_BOOT_DELAY) && (CONFIG_BOOT_DELAY > 0) #ifdef CONFIG_BOOT_BANNER From d1d91126f5d593c7d3ce443e94be81fc3c200252 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Fri, 20 Sep 2024 14:48:37 +0200 Subject: [PATCH 1654/2141] [nrf noup] lib: os: zvfs: Remove EXPERIMENTAL from ZVFS Although ZVFS is experimental, the warning is annoying the matter team. Therefore, remove the experimental selection. This may be reverted once upstream unselects experimental. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit f52f65458f060758f18daf2b572383b6938eceae) --- lib/os/zvfs/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/os/zvfs/Kconfig b/lib/os/zvfs/Kconfig index a9c9518a1d5d..495d5c849685 100644 --- a/lib/os/zvfs/Kconfig +++ b/lib/os/zvfs/Kconfig @@ -6,7 +6,6 @@ menuconfig ZVFS bool "Zephyr virtual filesystem (ZVFS) support [EXPERIMENTAL]" select FDTABLE - select EXPERIMENTAL help ZVFS is a central, Zephyr-native library that provides a common interoperable API for all types of file descriptors such as those from the non-virtual FS, sockets, eventfds, FILE *'s From 256095442e0d410b1829e3266cb94e4e12802f3e Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Mon, 7 Oct 2024 15:36:43 +0200 Subject: [PATCH 1655/2141] [nrf noup] samples: net: Enable Wi-Fi driver in sysbuild builds Make sure Wi-Fi driver is enabled in networking samples supporting Wi-Fi when sysbuild is used. For shields we cannot automate this, as sysbuild doesn't recognize shields, so, Wi-Fi has to be explicitly enabled, this is done for twister in Wi-Fi sample. Signed-off-by: Robert Lubos Signed-off-by: Chaitanya Tata (cherry picked from commit ccf6152219b7547248f52b752f19f770ad444c66) --- samples/net/dns_resolve/Kconfig.sysbuild | 13 +++++++++++++ samples/net/ipv4_autoconf/Kconfig.sysbuild | 13 +++++++++++++ samples/net/lwm2m_client/Kconfig.sysbuild | 13 +++++++++++++ samples/net/mdns_responder/Kconfig.sysbuild | 13 +++++++++++++ samples/net/mqtt_publisher/Kconfig.sysbuild | 13 +++++++++++++ samples/net/mqtt_sn_publisher/Kconfig.sysbuild | 13 +++++++++++++ samples/net/sockets/coap_server/Kconfig.sysbuild | 13 +++++++++++++ samples/net/sockets/echo_async/Kconfig.sysbuild | 13 +++++++++++++ samples/net/sockets/echo_client/Kconfig.sysbuild | 13 +++++++++++++ samples/net/sockets/echo_server/Kconfig.sysbuild | 13 +++++++++++++ samples/net/sockets/http_get/Kconfig.sysbuild | 13 +++++++++++++ samples/net/sockets/sntp_client/Kconfig.sysbuild | 13 +++++++++++++ samples/net/syslog_net/Kconfig.sysbuild | 13 +++++++++++++ samples/net/telnet/Kconfig.sysbuild | 13 +++++++++++++ samples/net/wifi/Kconfig.sysbuild | 13 +++++++++++++ samples/net/wifi/shell/sample.yaml | 2 ++ 16 files changed, 197 insertions(+) create mode 100644 samples/net/dns_resolve/Kconfig.sysbuild create mode 100644 samples/net/ipv4_autoconf/Kconfig.sysbuild create mode 100644 samples/net/lwm2m_client/Kconfig.sysbuild create mode 100644 samples/net/mdns_responder/Kconfig.sysbuild create mode 100644 samples/net/mqtt_publisher/Kconfig.sysbuild create mode 100644 samples/net/mqtt_sn_publisher/Kconfig.sysbuild create mode 100644 samples/net/sockets/coap_server/Kconfig.sysbuild create mode 100644 samples/net/sockets/echo_async/Kconfig.sysbuild create mode 100644 samples/net/sockets/echo_client/Kconfig.sysbuild create mode 100644 samples/net/sockets/echo_server/Kconfig.sysbuild create mode 100644 samples/net/sockets/http_get/Kconfig.sysbuild create mode 100644 samples/net/sockets/sntp_client/Kconfig.sysbuild create mode 100644 samples/net/syslog_net/Kconfig.sysbuild create mode 100644 samples/net/telnet/Kconfig.sysbuild create mode 100644 samples/net/wifi/Kconfig.sysbuild diff --git a/samples/net/dns_resolve/Kconfig.sysbuild b/samples/net/dns_resolve/Kconfig.sysbuild new file mode 100644 index 000000000000..158551060c56 --- /dev/null +++ b/samples/net/dns_resolve/Kconfig.sysbuild @@ -0,0 +1,13 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 +# + +config WIFI_NRF70 + default y if BOARD_NRF7002DK_NRF5340_CPUAPP || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS + +source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/samples/net/ipv4_autoconf/Kconfig.sysbuild b/samples/net/ipv4_autoconf/Kconfig.sysbuild new file mode 100644 index 000000000000..158551060c56 --- /dev/null +++ b/samples/net/ipv4_autoconf/Kconfig.sysbuild @@ -0,0 +1,13 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 +# + +config WIFI_NRF70 + default y if BOARD_NRF7002DK_NRF5340_CPUAPP || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS + +source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/samples/net/lwm2m_client/Kconfig.sysbuild b/samples/net/lwm2m_client/Kconfig.sysbuild new file mode 100644 index 000000000000..158551060c56 --- /dev/null +++ b/samples/net/lwm2m_client/Kconfig.sysbuild @@ -0,0 +1,13 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 +# + +config WIFI_NRF70 + default y if BOARD_NRF7002DK_NRF5340_CPUAPP || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS + +source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/samples/net/mdns_responder/Kconfig.sysbuild b/samples/net/mdns_responder/Kconfig.sysbuild new file mode 100644 index 000000000000..158551060c56 --- /dev/null +++ b/samples/net/mdns_responder/Kconfig.sysbuild @@ -0,0 +1,13 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 +# + +config WIFI_NRF70 + default y if BOARD_NRF7002DK_NRF5340_CPUAPP || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS + +source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/samples/net/mqtt_publisher/Kconfig.sysbuild b/samples/net/mqtt_publisher/Kconfig.sysbuild new file mode 100644 index 000000000000..158551060c56 --- /dev/null +++ b/samples/net/mqtt_publisher/Kconfig.sysbuild @@ -0,0 +1,13 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 +# + +config WIFI_NRF70 + default y if BOARD_NRF7002DK_NRF5340_CPUAPP || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS + +source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/samples/net/mqtt_sn_publisher/Kconfig.sysbuild b/samples/net/mqtt_sn_publisher/Kconfig.sysbuild new file mode 100644 index 000000000000..158551060c56 --- /dev/null +++ b/samples/net/mqtt_sn_publisher/Kconfig.sysbuild @@ -0,0 +1,13 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 +# + +config WIFI_NRF70 + default y if BOARD_NRF7002DK_NRF5340_CPUAPP || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS + +source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/samples/net/sockets/coap_server/Kconfig.sysbuild b/samples/net/sockets/coap_server/Kconfig.sysbuild new file mode 100644 index 000000000000..158551060c56 --- /dev/null +++ b/samples/net/sockets/coap_server/Kconfig.sysbuild @@ -0,0 +1,13 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 +# + +config WIFI_NRF70 + default y if BOARD_NRF7002DK_NRF5340_CPUAPP || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS + +source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/samples/net/sockets/echo_async/Kconfig.sysbuild b/samples/net/sockets/echo_async/Kconfig.sysbuild new file mode 100644 index 000000000000..158551060c56 --- /dev/null +++ b/samples/net/sockets/echo_async/Kconfig.sysbuild @@ -0,0 +1,13 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 +# + +config WIFI_NRF70 + default y if BOARD_NRF7002DK_NRF5340_CPUAPP || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS + +source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/samples/net/sockets/echo_client/Kconfig.sysbuild b/samples/net/sockets/echo_client/Kconfig.sysbuild new file mode 100644 index 000000000000..158551060c56 --- /dev/null +++ b/samples/net/sockets/echo_client/Kconfig.sysbuild @@ -0,0 +1,13 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 +# + +config WIFI_NRF70 + default y if BOARD_NRF7002DK_NRF5340_CPUAPP || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS + +source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/samples/net/sockets/echo_server/Kconfig.sysbuild b/samples/net/sockets/echo_server/Kconfig.sysbuild new file mode 100644 index 000000000000..158551060c56 --- /dev/null +++ b/samples/net/sockets/echo_server/Kconfig.sysbuild @@ -0,0 +1,13 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 +# + +config WIFI_NRF70 + default y if BOARD_NRF7002DK_NRF5340_CPUAPP || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS + +source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/samples/net/sockets/http_get/Kconfig.sysbuild b/samples/net/sockets/http_get/Kconfig.sysbuild new file mode 100644 index 000000000000..158551060c56 --- /dev/null +++ b/samples/net/sockets/http_get/Kconfig.sysbuild @@ -0,0 +1,13 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 +# + +config WIFI_NRF70 + default y if BOARD_NRF7002DK_NRF5340_CPUAPP || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS + +source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/samples/net/sockets/sntp_client/Kconfig.sysbuild b/samples/net/sockets/sntp_client/Kconfig.sysbuild new file mode 100644 index 000000000000..158551060c56 --- /dev/null +++ b/samples/net/sockets/sntp_client/Kconfig.sysbuild @@ -0,0 +1,13 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 +# + +config WIFI_NRF70 + default y if BOARD_NRF7002DK_NRF5340_CPUAPP || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS + +source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/samples/net/syslog_net/Kconfig.sysbuild b/samples/net/syslog_net/Kconfig.sysbuild new file mode 100644 index 000000000000..158551060c56 --- /dev/null +++ b/samples/net/syslog_net/Kconfig.sysbuild @@ -0,0 +1,13 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 +# + +config WIFI_NRF70 + default y if BOARD_NRF7002DK_NRF5340_CPUAPP || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS + +source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/samples/net/telnet/Kconfig.sysbuild b/samples/net/telnet/Kconfig.sysbuild new file mode 100644 index 000000000000..158551060c56 --- /dev/null +++ b/samples/net/telnet/Kconfig.sysbuild @@ -0,0 +1,13 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 +# + +config WIFI_NRF70 + default y if BOARD_NRF7002DK_NRF5340_CPUAPP || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS + +source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/samples/net/wifi/Kconfig.sysbuild b/samples/net/wifi/Kconfig.sysbuild new file mode 100644 index 000000000000..158551060c56 --- /dev/null +++ b/samples/net/wifi/Kconfig.sysbuild @@ -0,0 +1,13 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 +# + +config WIFI_NRF70 + default y if BOARD_NRF7002DK_NRF5340_CPUAPP || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS + +source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/samples/net/wifi/shell/sample.yaml b/samples/net/wifi/shell/sample.yaml index 5f72e0686116..8543e6bfb38b 100644 --- a/samples/net/wifi/shell/sample.yaml +++ b/samples/net/wifi/shell/sample.yaml @@ -58,6 +58,7 @@ tests: - nrf7002dk/nrf5340/cpuapp/nrf7001 sample.net.wifi.nrf7002ek: extra_args: + - SB_CONFIG_WIFI_NRF70=y - CONFIG_BUILD_ONLY_NO_BLOBS=y - SHIELD=nrf7002ek platform_allow: @@ -69,6 +70,7 @@ tests: sample.net.wifi.nrf7002eb: extra_args: - CONFIG_NRF70_UTIL=y + - SB_CONFIG_WIFI_NRF70=y - CONFIG_BUILD_ONLY_NO_BLOBS=y - SHIELD=nrf7002eb platform_allow: From 19d7a298e884afc9284ef55b60361f2fe1478784 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Audun=20Kvamtr=C3=B8?= Date: Wed, 25 Sep 2024 13:49:59 +0200 Subject: [PATCH 1656/2141] [nrf noup] mbedtls: Don't enable auto-generation of Mbed TLS files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - We don't use this mechanism in nRF Connect SDK Signed-off-by: Frank Audun Kvamtrø (cherry picked from commit d268008fb254d5fcb01e92931864fca8165a1246) --- tests/crypto/mbedtls/CMakeLists.txt | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/tests/crypto/mbedtls/CMakeLists.txt b/tests/crypto/mbedtls/CMakeLists.txt index 7ebdc9d76a9a..47670bead010 100644 --- a/tests/crypto/mbedtls/CMakeLists.txt +++ b/tests/crypto/mbedtls/CMakeLists.txt @@ -6,15 +6,5 @@ project(mbedtls) set(output_file ${PROJECT_BINARY_DIR}/mbedtls-check.timestamp) -add_custom_command( - COMMENT "Check Mbed TLS auto-generated files" - COMMAND - ${PYTHON_EXECUTABLE} ${ZEPHYR_BASE}/modules/mbedtls/create_psa_files.py --check - OUTPUT - ${output_file} -) - -add_custom_target(check_mbedtls_auto_generated_files ALL DEPENDS ${output_file}) - FILE(GLOB app_sources src/*.c) target_sources(app PRIVATE ${app_sources}) From 0ebf737a1471a9955e8408882709f83eb12df80d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Audun=20Kvamtr=C3=B8?= Date: Wed, 25 Sep 2024 14:05:41 +0200 Subject: [PATCH 1657/2141] [nrf noup] net: tests: Add legacy crypto API support for big_http_download MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -We handle legacy Crypto API support specially (favoring PSA crypto) the tests here require MD interface to build, which needs the config MBEDTLS_LEGACY_CRYPTO_C to be enable to get access to Signed-off-by: Frank Audun Kvamtrø (cherry picked from commit d9e0b36c715d2afa68d885ae3a0435efd4cac4a9) --- samples/net/sockets/big_http_download/prj.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/samples/net/sockets/big_http_download/prj.conf b/samples/net/sockets/big_http_download/prj.conf index a406f314dfb2..8677e7113e4b 100644 --- a/samples/net/sockets/big_http_download/prj.conf +++ b/samples/net/sockets/big_http_download/prj.conf @@ -3,6 +3,7 @@ CONFIG_REQUIRES_FULL_LIBC=y CONFIG_MBEDTLS=y CONFIG_MBEDTLS_ENABLE_HEAP=y CONFIG_MBEDTLS_MD=y +CONFIG_MBEDTLS_LEGACY_CRYPTO_C=y CONFIG_MAIN_STACK_SIZE=2536 # Networking config From fb992dc4a1b1ed9c2b5cf37e0e3773190fa3d9a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Audun=20Kvamtr=C3=B8?= Date: Wed, 25 Sep 2024 14:31:02 +0200 Subject: [PATCH 1658/2141] [nrf noup] net: tests: crypto: Adding legacy Crypto support ipv6 tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -This adds crypto support for ipv6 tests by enabling CONFIG_MBEDTLS_LEGACY_CRYPTO_C Signed-off-by: Frank Audun Kvamtrø (cherry picked from commit 462b528e3f91ce8139309d0d07c8bc64edc65042) --- tests/net/ipv6/prj.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/net/ipv6/prj.conf b/tests/net/ipv6/prj.conf index 9f9f21d59050..6a6be5dba36a 100644 --- a/tests/net/ipv6/prj.conf +++ b/tests/net/ipv6/prj.conf @@ -33,6 +33,7 @@ CONFIG_NET_IF_MAX_IPV6_COUNT=2 CONFIG_NET_IPV6_PE=y CONFIG_NET_IPV6_PE_FILTER_PREFIX_COUNT=2 CONFIG_NET_IPV6_PE_PREFER_PUBLIC_ADDRESSES=n +CONFIG_MBEDTLS_LEGACY_CRYPTO_C=y # Increase the stack a bit for mps2/an385 CONFIG_NET_RX_STACK_SIZE=1700 From 8e1224f6248e5bcd82626d0f9a3aaf70e00a510b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ayt=C3=BCrk=20D=C3=BCzen?= Date: Wed, 20 Nov 2024 13:06:23 +0100 Subject: [PATCH 1659/2141] [nrf noup] tests: bluetooth: tester: sysbuild configurable 53/54H MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add support for sysbuild 54h20 building added nrf54h20 cpurad configuration to hci_ipc sample. Signed-off-by: Aytürk Düzen Signed-off-by: Vinayak Kariappa Chettimada (cherry picked from commit 63f0faef7bd0ccffd1970b1677efa04b696b8d70) --- .../nrf54h20_cpurad-bt_ll_softdevice.conf | 33 +++++++++++++++++++ tests/bluetooth/tester/Kconfig.sysbuild | 1 + tests/bluetooth/tester/sysbuild.cmake | 16 +++++++-- 3 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 samples/bluetooth/hci_ipc/nrf54h20_cpurad-bt_ll_softdevice.conf diff --git a/samples/bluetooth/hci_ipc/nrf54h20_cpurad-bt_ll_softdevice.conf b/samples/bluetooth/hci_ipc/nrf54h20_cpurad-bt_ll_softdevice.conf new file mode 100644 index 000000000000..1f7748e5cd7d --- /dev/null +++ b/samples/bluetooth/hci_ipc/nrf54h20_cpurad-bt_ll_softdevice.conf @@ -0,0 +1,33 @@ +CONFIG_IPC_SERVICE=y +CONFIG_MBOX=y + +CONFIG_ISR_STACK_SIZE=1024 +CONFIG_IDLE_STACK_SIZE=256 +CONFIG_MAIN_STACK_SIZE=512 +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=512 +CONFIG_IPC_SERVICE_BACKEND_RPMSG_WQ_STACK_SIZE=512 +CONFIG_HEAP_MEM_POOL_SIZE=8192 + +CONFIG_BT=y +CONFIG_BT_HCI_RAW=y + +CONFIG_BT_BUF_EVT_RX_COUNT=16 +CONFIG_BT_BUF_EVT_RX_SIZE=255 +CONFIG_BT_BUF_ACL_RX_SIZE=255 +CONFIG_BT_BUF_ACL_TX_SIZE=251 +CONFIG_BT_BUF_CMD_TX_SIZE=255 + +# Host +CONFIG_BT_BROADCASTER=y +CONFIG_BT_PERIPHERAL=y +CONFIG_BT_OBSERVER=y +CONFIG_BT_CENTRAL=y +CONFIG_BT_EXT_ADV=y +CONFIG_BT_PER_ADV=y +CONFIG_BT_PER_ADV_SYNC=y + +# Controller +CONFIG_BT_LL_SW_SPLIT=n +CONFIG_BT_LL_SOFTDEVICE=y +CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 +CONFIG_BT_CTLR_SCAN_DATA_LEN_MAX=191 diff --git a/tests/bluetooth/tester/Kconfig.sysbuild b/tests/bluetooth/tester/Kconfig.sysbuild index 69e4d5a97fbe..e14a6e1aa8e0 100644 --- a/tests/bluetooth/tester/Kconfig.sysbuild +++ b/tests/bluetooth/tester/Kconfig.sysbuild @@ -5,6 +5,7 @@ source "share/sysbuild/Kconfig" config NET_CORE_BOARD string + default "nrf54h20dk/nrf54h20/cpurad" if "$(BOARD)" = "nrf54h20dk" default "nrf5340dk/nrf5340/cpunet" if "$(BOARD)" = "nrf5340dk" default "nrf5340_audio_dk/nrf5340/cpunet" if "$(BOARD)" = "nrf5340_audio_dk" default "nrf5340bsim/nrf5340/cpunet" if $(BOARD_TARGET_STRING) = "NRF5340BSIM_NRF5340_CPUAPP" diff --git a/tests/bluetooth/tester/sysbuild.cmake b/tests/bluetooth/tester/sysbuild.cmake index a9ddf1279471..bcd564733c53 100644 --- a/tests/bluetooth/tester/sysbuild.cmake +++ b/tests/bluetooth/tester/sysbuild.cmake @@ -2,8 +2,6 @@ # SPDX-License-Identifier: Apache-2.0 if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) - # For builds in the nrf5340, we build the netcore image with the controller - set(NET_APP hci_ipc) set(NET_APP_SRC_DIR ${ZEPHYR_BASE}/samples/bluetooth/${NET_APP}) @@ -13,6 +11,20 @@ if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) BOARD ${SB_CONFIG_NET_CORE_BOARD} ) + if(SB_CONFIG_SOC_NRF5340_CPUAPP) + set(${NET_APP}_SNIPPET + "bt-ll-sw-split" + CACHE INTERNAL "" + ) + endif() + + if(SB_CONFIG_SOC_NRF54H20_CPUAPP) + set(${NET_APP}_CONF_FILE + ${NET_APP_SRC_DIR}/nrf54h20_cpurad-bt_ll_softdevice.conf + CACHE INTERNAL "" + ) + endif() + set(${NET_APP}_EXTRA_CONF_FILE ${APP_DIR}/overlay-bt_ll_sw_split.conf CACHE INTERNAL "" From 70c54b3250adfa1a55c65371d611e67ec444103e Mon Sep 17 00:00:00 2001 From: Ingar Kulbrandstad Date: Tue, 21 May 2024 13:59:58 +0200 Subject: [PATCH 1660/2141] [nrf noup] Bluetooth: Mesh: Disable processing of ext ADV packets Disable processing of extended ADV packets by mesh scanner. This is done to prevent loss of scan time due to reception of pointer packets while scanning for mesh packets. Signed-off-by: Ingar Kulbrandstad (cherry picked from commit bc11d5db02692ffaa2a6e75ec939f2b9fa404d03) --- subsys/bluetooth/mesh/Kconfig | 11 +++++++++++ subsys/bluetooth/mesh/adv_ext.c | 12 ++++++++++++ 2 files changed, 23 insertions(+) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index bb0e8be8eb88..80846310c632 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -214,6 +214,17 @@ config BT_MESH_ADV_EXT_FRIEND_SEPARATE messages as close to the start of the ReceiveWindow as possible, thus reducing the scanning time on the Low Power node. +config BT_MESH_ADV_EXT_ACCEPT_EXT_ADV_PACKETS + bool "Reject or accept extended advertising packets" + depends on BT_LL_SOFTDEVICE + help + Configure the scanner and initiator to either reject or accept extended + advertising packets by the SoftDevice Controller. This is set to false + by default, to prevent loss of scan time when receiving a pointer packet + while scanning for Bluetooth Mesh packets. Set to true if extended + advertising packets are to be received by the SoftDevice Controller for + purposes other than Bluetooth Mesh. + endif # BT_MESH_ADV_EXT endchoice diff --git a/subsys/bluetooth/mesh/adv_ext.c b/subsys/bluetooth/mesh/adv_ext.c index 0e6f6120f73f..c74f0a40d99a 100644 --- a/subsys/bluetooth/mesh/adv_ext.c +++ b/subsys/bluetooth/mesh/adv_ext.c @@ -519,6 +519,18 @@ void bt_mesh_adv_init(void) K_PRIO_COOP(MESH_WORKQ_PRIORITY), NULL); k_thread_name_set(&bt_mesh_workq.thread, "BT MESH WQ"); } + +#if defined(CONFIG_BT_LL_SOFTDEVICE) + const sdc_hci_cmd_vs_scan_accept_ext_adv_packets_set_t cmd_params = { + .accept_ext_adv_packets = IS_ENABLED(CONFIG_BT_MESH_ADV_EXT_ACCEPT_EXT_ADV_PACKETS), + }; + + int err = sdc_hci_cmd_vs_scan_accept_ext_adv_packets_set(&cmd_params); + + if (err) { + LOG_ERR("Failed to set accept_ext_adv_packets: %d", err); + } +#endif } static struct bt_mesh_ext_adv *adv_instance_find(struct bt_le_ext_adv *instance) From a958627ee65d0536b78bbc4d9fe8473bc6daaecb Mon Sep 17 00:00:00 2001 From: Joakim Andersson Date: Mon, 16 Jan 2023 14:15:22 +0100 Subject: [PATCH 1661/2141] [nrf noup] dts: choose a crypto accelerator for entropy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a long-term noup patch because crypto driver support is NCS-only for both cryptocell and CRACEN. Set HAS_HW_NRF_CC3XX to be defined in NS build when cryptocell is accessed through the PSA API. We need to know which CC3XX features are available. Set PSA as the entropy source for 54L. PSA is the only NCS-supported interface to CRACEN. Signed-off-by: Georgios Vasilakis Signed-off-by: Joakim Andersson Signed-off-by: Dominik Ermel Signed-off-by: Sebastian Bøe Signed-off-by: Robert Lubos Signed-off-by: Rubin Gerritsen (cherry picked from commit 53fae56efca3c201e8faa1433b7c3ee98b4e6dd6) --- dts/arm/nordic/nrf52840.dtsi | 4 ++-- dts/arm/nordic/nrf5340_cpuapp.dtsi | 4 ++-- dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi | 4 ++-- dts/arm/nordic/nrf91.dtsi | 3 ++- soc/nordic/common/Kconfig.peripherals | 6 ++++-- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/dts/arm/nordic/nrf52840.dtsi b/dts/arm/nordic/nrf52840.dtsi index dab5f7620585..bcbfd926c9bb 100644 --- a/dts/arm/nordic/nrf52840.dtsi +++ b/dts/arm/nordic/nrf52840.dtsi @@ -8,7 +8,7 @@ / { chosen { zephyr,bt-hci = &bt_hci_controller; - zephyr,entropy = &rng; + zephyr,entropy = &cryptocell; zephyr,flash-controller = &flash_controller; }; @@ -572,7 +572,7 @@ reg = <0x5002a000 0x1000>, <0x5002b000 0x1000>; reg-names = "wrapper", "core"; interrupts = <42 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; + status = "okay"; }; }; }; diff --git a/dts/arm/nordic/nrf5340_cpuapp.dtsi b/dts/arm/nordic/nrf5340_cpuapp.dtsi index b9762248a5df..b4c077ea2bf4 100644 --- a/dts/arm/nordic/nrf5340_cpuapp.dtsi +++ b/dts/arm/nordic/nrf5340_cpuapp.dtsi @@ -34,7 +34,7 @@ }; chosen { - zephyr,entropy = &rng_hci; + zephyr,entropy = &cryptocell; zephyr,flash-controller = &flash_controller; }; @@ -104,7 +104,7 @@ reg = <0x50844000 0x1000>, <0x50845000 0x1000>; reg-names = "wrapper", "core"; interrupts = <68 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; + status = "okay"; }; }; diff --git a/dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi b/dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi index 3f1fe655b6e5..8b0339eda399 100644 --- a/dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi +++ b/dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi @@ -16,7 +16,7 @@ nvic: &cpuapp_nvic {}; / { chosen { zephyr,bt-hci = &bt_hci_controller; - zephyr,entropy = &rng; + zephyr,entropy = &psa_rng; }; soc { @@ -32,7 +32,7 @@ nvic: &cpuapp_nvic {}; psa_rng: psa-rng { compatible = "zephyr,psa-crypto-rng"; - status = "disabled"; + status = "okay"; }; }; diff --git a/dts/arm/nordic/nrf91.dtsi b/dts/arm/nordic/nrf91.dtsi index 1747dcea74a9..7b7d48916519 100644 --- a/dts/arm/nordic/nrf91.dtsi +++ b/dts/arm/nordic/nrf91.dtsi @@ -28,6 +28,7 @@ }; chosen { + zephyr,entropy = &cryptocell; zephyr,flash-controller = &flash_controller; }; @@ -51,7 +52,7 @@ reg = <0x50840000 0x1000>, <0x50841000 0x1000>; reg-names = "wrapper", "core"; interrupts = <64 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; + status = "okay"; }; ctrlap: ctrlap@50006000 { diff --git a/soc/nordic/common/Kconfig.peripherals b/soc/nordic/common/Kconfig.peripherals index d7e489b446a5..fa7fd2a411aa 100644 --- a/soc/nordic/common/Kconfig.peripherals +++ b/soc/nordic/common/Kconfig.peripherals @@ -13,10 +13,12 @@ config HAS_HW_NRF_BPROT def_bool $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF_BPROT)) config HAS_HW_NRF_CC310 - def_bool $(dt_compat_enabled,$(DT_COMPAT_ARM_CRYPTOCELL_310)) + def_bool $(dt_compat_enabled,$(DT_COMPAT_ARM_CRYPTOCELL_310)) || \ + ($(dt_nodelabel_enabled,psa_rng) && SOC_SERIES_NRF91X) config HAS_HW_NRF_CC312 - def_bool $(dt_compat_enabled,$(DT_COMPAT_ARM_CRYPTOCELL_312)) + def_bool $(dt_compat_enabled,$(DT_COMPAT_ARM_CRYPTOCELL_312)) || \ + ($(dt_nodelabel_enabled,psa_rng) && SOC_NRF5340_CPUAPP) config HAS_HW_NRF_CCM def_bool $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF_CCM)) From e9c0ac14274c524b125a8251b1e319408e256516 Mon Sep 17 00:00:00 2001 From: Rubin Gerritsen Date: Thu, 5 Sep 2024 08:04:15 +0200 Subject: [PATCH 1662/2141] [nrf noup] dts: Select SoftDevice Controller DTS binding as default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The SoftDevice Controller is a different controller than the open source link layer with a different set of quirks. It should therefore have its own device tree binding. This commit converts the SoftDevice Controller driver to use this new DTS binding instead of reusing the existing one. This commit updates or adds additional overlays for existing samples, applications and tests that were using the open source link layer. Signed-off-by: Rubin Gerritsen Signed-off-by: Kristoffer Rist Skøien Signed-off-by: Rafał Kuźnia (cherry picked from commit 946fcec6c632424ca0a7e2ee7cc9a5df7eb1180e) (cherry picked from commit 6d216e1a427579ef6fba03c6cb0fa90d4d9e1504) --- .../nrf54l20pdk/nrf54l20_cpuapp_common.dtsi | 131 +++ dts/arm/nordic/nrf52805.dtsi | 11 +- dts/arm/nordic/nrf52810.dtsi | 11 +- dts/arm/nordic/nrf52811.dtsi | 11 +- dts/arm/nordic/nrf52820.dtsi | 11 +- dts/arm/nordic/nrf52832.dtsi | 11 +- dts/arm/nordic/nrf52833.dtsi | 11 +- dts/arm/nordic/nrf52840.dtsi | 11 +- dts/arm/nordic/nrf5340_cpunet.dtsi | 11 +- dts/arm/nordic/nrf54h20_cpurad.dtsi | 4 +- dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi | 4 +- dts/vendor/nordic/nrf54h20.dtsi | 7 +- dts/vendor/nordic/nrf54l20.dtsi | 852 ++++++++++++++++++ dts/vendor/nordic/nrf54l_05_10_15.dtsi | 8 +- .../bluetooth/bap_broadcast_sink/sample.yaml | 4 +- .../bap_broadcast_sink/sysbuild.cmake | 4 + .../bap_broadcast_source/sample.yaml | 4 +- .../bap_broadcast_source/sysbuild.cmake | 4 + .../bluetooth/bap_unicast_client/sample.yaml | 4 +- .../bap_unicast_client/sysbuild.cmake | 4 + .../bluetooth/bap_unicast_server/sample.yaml | 4 +- .../bap_unicast_server/sysbuild.cmake | 4 + samples/bluetooth/beacon/sample.yaml | 4 +- samples/bluetooth/cap_acceptor/sample.yaml | 4 +- samples/bluetooth/cap_acceptor/sysbuild.cmake | 4 + samples/bluetooth/cap_initiator/sample.yaml | 4 +- .../bluetooth/cap_initiator/sysbuild.cmake | 4 + .../direction_finding_central/sample.yaml | 15 +- .../sample.yaml | 14 +- .../sample.yaml | 14 +- .../direction_finding_peripheral/sample.yaml | 15 +- samples/bluetooth/hci_ipc/sample.yaml | 34 +- samples/bluetooth/hci_uart/sample.yaml | 18 +- samples/bluetooth/hci_vs_scan_req/sample.yaml | 2 + samples/bluetooth/iso_central/sample.yaml | 6 +- .../pbp_public_broadcast_sink/sample.yaml | 4 +- .../pbp_public_broadcast_sink/sysbuild.cmake | 4 + .../pbp_public_broadcast_source/sample.yaml | 4 +- .../sysbuild.cmake | 4 + .../bt-ll-sw-split/bt-ll-sw-split.overlay | 4 + .../controller/ll_sw/nordic/lll/lll.c | 2 +- .../controller/ctrl_api/testcase.yaml | 2 + .../controller/ctrl_chmu/testcase.yaml | 2 + .../controller/ctrl_cis_create/testcase.yaml | 2 + .../ctrl_cis_terminate/testcase.yaml | 2 + .../controller/ctrl_collision/testcase.yaml | 2 + .../controller/ctrl_conn_update/testcase.yaml | 11 +- .../controller/ctrl_cte_req/testcase.yaml | 2 + .../ctrl_data_length_update/testcase.yaml | 10 +- .../controller/ctrl_encrypt/testcase.yaml | 2 + .../ctrl_feature_exchange/testcase.yaml | 2 + .../controller/ctrl_hci/testcase.yaml | 2 + .../controller/ctrl_invalid/testcase.yaml | 2 + .../controller/ctrl_le_ping/testcase.yaml | 2 + .../ctrl_min_used_chans/testcase.yaml | 2 + .../controller/ctrl_phy_update/testcase.yaml | 6 +- .../controller/ctrl_sca_update/testcase.yaml | 2 + .../controller/ctrl_sw_privacy/testcase.yaml | 2 + .../controller/ctrl_terminate/testcase.yaml | 2 + .../ctrl_tx_buffer_alloc/testcase.yaml | 22 +- .../controller/ctrl_tx_queue/testcase.yaml | 2 + .../controller/ctrl_unsupported/testcase.yaml | 6 +- .../controller/ctrl_user_ext/testcase.yaml | 2 + .../controller/ctrl_version/testcase.yaml | 2 + .../df/connection_cte_req/testcase.yaml | 2 + .../df/connection_cte_tx_params/testcase.yaml | 2 + .../connectionless_cte_chains/testcase.yaml | 2 + .../df/connectionless_cte_rx/testcase.yaml | 2 + .../df/connectionless_cte_tx/testcase.yaml | 2 + tests/bluetooth/init/testcase.yaml | 101 ++- 70 files changed, 1366 insertions(+), 122 deletions(-) create mode 100644 boards/nordic/nrf54l20pdk/nrf54l20_cpuapp_common.dtsi create mode 100644 dts/vendor/nordic/nrf54l20.dtsi diff --git a/boards/nordic/nrf54l20pdk/nrf54l20_cpuapp_common.dtsi b/boards/nordic/nrf54l20pdk/nrf54l20_cpuapp_common.dtsi new file mode 100644 index 000000000000..f719b2d93920 --- /dev/null +++ b/boards/nordic/nrf54l20pdk/nrf54l20_cpuapp_common.dtsi @@ -0,0 +1,131 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* This file is common to the secure and non-secure domain */ + +#include +#include "nrf54l20pdk_nrf54l20-common.dtsi" + +/ { + chosen { + zephyr,console = &uart20; + zephyr,shell-uart = &uart20; + zephyr,uart-mcumgr = &uart20; + zephyr,bt-mon-uart = &uart20; + zephyr,bt-c2h-uart = &uart20; + zephyr,flash-controller = &rram_controller; + zephyr,flash = &cpuapp_rram; + zephyr,bt-hci = &bt_hci_sdc; + zephyr,ieee802154 = &ieee802154; + }; +}; + +&cpuapp_sram { + status = "okay"; +}; + +&lfxo { + load-capacitors = "internal"; + load-capacitance-femtofarad = <15500>; +}; + +&hfxo { + load-capacitors = "internal"; + load-capacitance-femtofarad = <15000>; +}; + +&grtc { + owned-channels = <0 1 2 3 4 5 6 7 8 9 10 11>; + /* Channels 7-11 reserved for Zero Latency IRQs, 3-4 for FLPR */ + child-owned-channels = <3 4 7 8 9 10 11>; + status = "okay"; +}; + +&cpuapp_rram { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x0 DT_SIZE_K(64)>; + }; + + slot0_partition: partition@10000 { + label = "image-0"; + reg = <0x10000 DT_SIZE_K(449)>; + }; + + slot0_ns_partition: partition@80400 { + label = "image-0-nonsecure"; + reg = <0x80400 DT_SIZE_K(449)>; + }; + + slot1_partition: partition@f0800 { + label = "image-1"; + reg = <0xf0800 DT_SIZE_K(449)>; + }; + + slot1_ns_partition: partition@160c00 { + label = "image-1-nonsecure"; + reg = <0x160c00 DT_SIZE_K(449)>; + }; + + storage_partition: partition@1d1000 { + label = "storage"; + reg = <0x1d1000 DT_SIZE_K(36)>; + }; + }; +}; + +&uart20 { + status = "okay"; +}; + +&nfct { + status = "okay"; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + +&gpio2 { + status = "okay"; +}; + +&gpiote20 { + status = "okay"; +}; + +&gpiote30 { + status = "okay"; +}; + +&radio { + status = "okay"; +}; + +&temp { + status = "okay"; +}; + +&clock { + status = "okay"; +}; + +&bt_hci_sdc { + status = "okay"; +}; + +&ieee802154 { + status = "okay"; +}; diff --git a/dts/arm/nordic/nrf52805.dtsi b/dts/arm/nordic/nrf52805.dtsi index 45a54f97b061..2134605c9f86 100644 --- a/dts/arm/nordic/nrf52805.dtsi +++ b/dts/arm/nordic/nrf52805.dtsi @@ -11,7 +11,7 @@ / { chosen { - zephyr,bt-hci = &bt_hci_controller; + zephyr,bt-hci = &bt_hci_sdc; zephyr,entropy = &rng; zephyr,flash-controller = &flash_controller; }; @@ -106,12 +106,13 @@ status = "okay"; ble-2mbps-supported; - /* Note: In the nRF Connect SDK the SoftDevice Controller - * is added and set as the default Bluetooth Controller. - */ + bt_hci_sdc: bt_hci_sdc { + compatible = "nordic,bt-hci-sdc"; + status = "okay"; + }; bt_hci_controller: bt_hci_controller { compatible = "zephyr,bt-hci-ll-sw-split"; - status = "okay"; + status = "disabled"; }; }; diff --git a/dts/arm/nordic/nrf52810.dtsi b/dts/arm/nordic/nrf52810.dtsi index 217758dd1614..6e09220e78bb 100644 --- a/dts/arm/nordic/nrf52810.dtsi +++ b/dts/arm/nordic/nrf52810.dtsi @@ -7,7 +7,7 @@ / { chosen { - zephyr,bt-hci = &bt_hci_controller; + zephyr,bt-hci = &bt_hci_sdc; zephyr,entropy = &rng; zephyr,flash-controller = &flash_controller; }; @@ -110,12 +110,13 @@ status = "okay"; ble-2mbps-supported; - /* Note: In the nRF Connect SDK the SoftDevice Controller - * is added and set as the default Bluetooth Controller. - */ + bt_hci_sdc: bt_hci_sdc { + compatible = "nordic,bt-hci-sdc"; + status = "okay"; + }; bt_hci_controller: bt_hci_controller { compatible = "zephyr,bt-hci-ll-sw-split"; - status = "okay"; + status = "disabled"; }; }; diff --git a/dts/arm/nordic/nrf52811.dtsi b/dts/arm/nordic/nrf52811.dtsi index 670f569c0ace..12d0a0ea4d6f 100644 --- a/dts/arm/nordic/nrf52811.dtsi +++ b/dts/arm/nordic/nrf52811.dtsi @@ -11,7 +11,7 @@ / { chosen { - zephyr,bt-hci = &bt_hci_controller; + zephyr,bt-hci = &bt_hci_sdc; zephyr,entropy = &rng; zephyr,flash-controller = &flash_controller; }; @@ -122,12 +122,13 @@ status = "disabled"; }; - /* Note: In the nRF Connect SDK the SoftDevice Controller - * is added and set as the default Bluetooth Controller. - */ + bt_hci_sdc: bt_hci_sdc { + compatible = "nordic,bt-hci-sdc"; + status = "okay"; + }; bt_hci_controller: bt_hci_controller { compatible = "zephyr,bt-hci-ll-sw-split"; - status = "okay"; + status = "disabled"; }; }; diff --git a/dts/arm/nordic/nrf52820.dtsi b/dts/arm/nordic/nrf52820.dtsi index 50c8d2ba07f0..d15fbb2ae4e3 100644 --- a/dts/arm/nordic/nrf52820.dtsi +++ b/dts/arm/nordic/nrf52820.dtsi @@ -11,7 +11,7 @@ / { chosen { - zephyr,bt-hci = &bt_hci_controller; + zephyr,bt-hci = &bt_hci_sdc; zephyr,entropy = &rng; zephyr,flash-controller = &flash_controller; }; @@ -124,12 +124,13 @@ status = "disabled"; }; - /* Note: In the nRF Connect SDK another Bluetooth controller - * is added and set as the default. - */ + bt_hci_sdc: bt_hci_sdc { + compatible = "nordic,bt-hci-sdc"; + status = "okay"; + }; bt_hci_controller: bt_hci_controller { compatible = "zephyr,bt-hci-ll-sw-split"; - status = "okay"; + status = "disabled"; }; }; diff --git a/dts/arm/nordic/nrf52832.dtsi b/dts/arm/nordic/nrf52832.dtsi index 7bd62c707545..eef2297c43b1 100644 --- a/dts/arm/nordic/nrf52832.dtsi +++ b/dts/arm/nordic/nrf52832.dtsi @@ -7,7 +7,7 @@ / { chosen { - zephyr,bt-hci = &bt_hci_controller; + zephyr,bt-hci = &bt_hci_sdc; zephyr,entropy = &rng; zephyr,flash-controller = &flash_controller; }; @@ -110,12 +110,13 @@ status = "okay"; ble-2mbps-supported; - /* Note: In the nRF Connect SDK the SoftDevice Controller - * is added and set as the default Bluetooth Controller. - */ + bt_hci_sdc: bt_hci_sdc { + compatible = "nordic,bt-hci-sdc"; + status = "okay"; + }; bt_hci_controller: bt_hci_controller { compatible = "zephyr,bt-hci-ll-sw-split"; - status = "okay"; + status = "disabled"; }; }; diff --git a/dts/arm/nordic/nrf52833.dtsi b/dts/arm/nordic/nrf52833.dtsi index 8202ddc45431..1b3620aa01cb 100644 --- a/dts/arm/nordic/nrf52833.dtsi +++ b/dts/arm/nordic/nrf52833.dtsi @@ -11,7 +11,7 @@ / { chosen { - zephyr,bt-hci = &bt_hci_controller; + zephyr,bt-hci = &bt_hci_sdc; zephyr,entropy = &rng; zephyr,flash-controller = &flash_controller; }; @@ -124,12 +124,13 @@ status = "disabled"; }; - /* Note: In the nRF Connect SDK the SoftDevice Controller - * is added and set as the default Bluetooth Controller. - */ + bt_hci_sdc: bt_hci_sdc { + compatible = "nordic,bt-hci-sdc"; + status = "okay"; + }; bt_hci_controller: bt_hci_controller { compatible = "zephyr,bt-hci-ll-sw-split"; - status = "okay"; + status = "disabled"; }; }; diff --git a/dts/arm/nordic/nrf52840.dtsi b/dts/arm/nordic/nrf52840.dtsi index bcbfd926c9bb..f19383ba7e75 100644 --- a/dts/arm/nordic/nrf52840.dtsi +++ b/dts/arm/nordic/nrf52840.dtsi @@ -7,7 +7,7 @@ / { chosen { - zephyr,bt-hci = &bt_hci_controller; + zephyr,bt-hci = &bt_hci_sdc; zephyr,entropy = &cryptocell; zephyr,flash-controller = &flash_controller; }; @@ -112,12 +112,13 @@ status = "disabled"; }; - /* Note: In the nRF Connect SDK the SoftDevice Controller - * is added and set as the default Bluetooth Controller. - */ + bt_hci_sdc: bt_hci_sdc { + compatible = "nordic,bt-hci-sdc"; + status = "okay"; + }; bt_hci_controller: bt_hci_controller { compatible = "zephyr,bt-hci-ll-sw-split"; - status = "okay"; + status = "disabled"; }; }; diff --git a/dts/arm/nordic/nrf5340_cpunet.dtsi b/dts/arm/nordic/nrf5340_cpunet.dtsi index 4f9164767f1a..be0fad16d66b 100644 --- a/dts/arm/nordic/nrf5340_cpunet.dtsi +++ b/dts/arm/nordic/nrf5340_cpunet.dtsi @@ -9,7 +9,7 @@ / { chosen { - zephyr,bt-hci = &bt_hci_controller; + zephyr,bt-hci = &bt_hci_sdc; zephyr,entropy = &rng; zephyr,flash-controller = &flash_controller; }; @@ -102,12 +102,13 @@ status = "disabled"; }; - /* Note: In the nRF Connect SDK the SoftDevice Controller - * is added and set as the default Bluetooth Controller. - */ + bt_hci_sdc: bt_hci_sdc { + compatible = "nordic,bt-hci-sdc"; + status = "okay"; + }; bt_hci_controller: bt_hci_controller { compatible = "zephyr,bt-hci-ll-sw-split"; - status = "okay"; + status = "disabled"; }; }; diff --git a/dts/arm/nordic/nrf54h20_cpurad.dtsi b/dts/arm/nordic/nrf54h20_cpurad.dtsi index bf194df4478f..8bd3c045906c 100644 --- a/dts/arm/nordic/nrf54h20_cpurad.dtsi +++ b/dts/arm/nordic/nrf54h20_cpurad.dtsi @@ -24,7 +24,7 @@ wdt011: &cpurad_wdt011 {}; / { chosen { - zephyr,bt-hci = &bt_hci_controller; + zephyr,bt-hci = &bt_hci_sdc; }; soc { @@ -164,6 +164,6 @@ wdt011: &cpurad_wdt011 {}; status = "okay"; }; -&bt_hci_controller { +&bt_hci_sdc { status = "okay"; }; diff --git a/dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi b/dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi index 8b0339eda399..80875058f5fd 100644 --- a/dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi +++ b/dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi @@ -15,7 +15,7 @@ nvic: &cpuapp_nvic {}; / { chosen { - zephyr,bt-hci = &bt_hci_controller; + zephyr,bt-hci = &bt_hci_sdc; zephyr,entropy = &psa_rng; }; @@ -36,7 +36,7 @@ nvic: &cpuapp_nvic {}; }; }; -&bt_hci_controller { +&bt_hci_sdc { status = "okay"; }; diff --git a/dts/vendor/nordic/nrf54h20.dtsi b/dts/vendor/nordic/nrf54h20.dtsi index 1f4160ac8978..d9703493a493 100644 --- a/dts/vendor/nordic/nrf54h20.dtsi +++ b/dts/vendor/nordic/nrf54h20.dtsi @@ -483,9 +483,10 @@ status = "disabled"; }; - /* Note: In the nRF Connect SDK the SoftDevice Controller - * is added and set as the default Bluetooth Controller. - */ + bt_hci_sdc: bt_hci_sdc { + compatible = "nordic,bt-hci-sdc"; + status = "disabled"; + }; bt_hci_controller: bt_hci_controller { compatible = "zephyr,bt-hci-ll-sw-split"; status = "disabled"; diff --git a/dts/vendor/nordic/nrf54l20.dtsi b/dts/vendor/nordic/nrf54l20.dtsi new file mode 100644 index 000000000000..bee70effa0e8 --- /dev/null +++ b/dts/vendor/nordic/nrf54l20.dtsi @@ -0,0 +1,852 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include + +/delete-node/ &sw_pwm; + +/* Domain IDs. Can be used to specify channel links in IPCT nodes. */ +#define NRF_DOMAIN_ID_APPLICATION 0 +#define NRF_DOMAIN_ID_FLPR 1 + +/ { + #address-cells = <1>; + #size-cells = <1>; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpuapp: cpu@0 { + compatible = "arm,cortex-m33f"; + reg = <0>; + device_type = "cpu"; + clocks = <&hfpll>; + #address-cells = <1>; + #size-cells = <1>; + + itm: itm@e0000000 { + compatible = "arm,armv8m-itm"; + reg = <0xe0000000 0x1000>; + swo-ref-frequency = ; + }; + }; + + cpuflpr: cpu@1 { + compatible = "nordic,vpr"; + reg = <1>; + device_type = "cpu"; + riscv,isa = "rv32emc"; + nordic,bus-width = <64>; + }; + }; + + clocks { + pclk: pclk { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = ; + }; + + pclk32m: pclk32m { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = ; + }; + + lfxo: lfxo { + compatible = "nordic,nrf54l-lfxo"; + #clock-cells = <0>; + clock-frequency = <32768>; + }; + + hfxo: hfxo { + compatible = "nordic,nrf54l-hfxo"; + #clock-cells = <0>; + clock-frequency = ; + startup-time-us = <1650>; + }; + + hfpll: hfpll { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = ; + }; + + aclk: aclk { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = ; + }; + }; + + soc { + #address-cells = <1>; + #size-cells = <1>; + + ficr: ficr@ffc000 { + compatible = "nordic,nrf-ficr"; + reg = <0xffc000 0x1000>; + #nordic,ficr-cells = <1>; + }; + + uicr: uicr@ffd000 { + compatible = "nordic,nrf-uicr"; + reg = <0xffd000 0x1000>; + }; + + cpuapp_sram: memory@20000000 { + compatible = "mmio-sram"; + reg = <0x20000000 DT_SIZE_K(447)>; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x20000000 0x6fc00>; + }; + + cpuflpr_sram: memory@2006fc00 { + compatible = "mmio-sram"; + reg = <0x2006fc00 DT_SIZE_K(64)>; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x2006fc00 0x10000>; + }; + + global_peripherals: peripheral@50000000 { + ranges = <0x0 0x50000000 0x10000000>; + #address-cells = <1>; + #size-cells = <1>; + + dppic00: dppic@42000 { + compatible = "nordic,nrf-dppic"; + reg = <0x42000 0x808>; + status = "disabled"; + }; + + ppib00: ppib@44000 { + compatible = "nordic,nrf-ppib"; + reg = <0x44000 0x1000>; + status = "disabled"; + }; + + ppib01: ppib@45000 { + compatible = "nordic,nrf-ppib"; + reg = <0x45000 0x1000>; + status = "disabled"; + }; + + cpuflpr_vpr: vpr@4c000 { + compatible = "nordic,nrf-vpr-coprocessor"; + reg = <0x4c000 0x1000>; + ranges = <0x0 0x4c000 0x1000>; + #address-cells = <1>; + #size-cells = <1>; + status = "disabled"; + enable-secure; + + cpuflpr_clic: interrupt-controller@f0000000 { + compatible = "nordic,nrf-clic"; + reg = <0xf0000000 0x143c>; + interrupt-controller; + #interrupt-cells = <2>; + #address-cells = <1>; + status = "disabled"; + }; + }; + + spi00: spi@4d000 { + /* + * This spi node can be either SPIM or SPIS, + * for the user to pick: + * compatible = "nordic,nrf-spim" or + * "nordic,nrf-spis". + */ + compatible = "nordic,nrf-spim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x4d000 0x1000>; + interrupts = <77 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + easydma-maxcnt-bits = <16>; + rx-delay-supported; + rx-delay = <1>; + status = "disabled"; + }; + + uart00: uart@4d000 { + compatible = "nordic,nrf-uarte"; + reg = <0x4d000 0x1000>; + interrupts = <77 NRF_DEFAULT_IRQ_PRIORITY>; + clocks = <&hfpll>; + status = "disabled"; + endtx-stoptx-supported; + frame-timeout-supported; + }; + + gpio2: gpio@50400 { + compatible = "nordic,nrf-gpio"; + gpio-controller; + reg = <0x50400 0x300>; + #gpio-cells = <2>; + ngpios = <11>; + status = "disabled"; + port = <2>; + }; + + timer00: timer@55000 { + compatible = "nordic,nrf-timer"; + status = "disabled"; + reg = <0x55000 0x1000>; + cc-num = <6>; + max-bit-width = <32>; + interrupts = <85 NRF_DEFAULT_IRQ_PRIORITY>; + clocks = <&hfpll>; + prescaler = <0>; + }; + + dppic10: dppic@82000 { + compatible = "nordic,nrf-dppic"; + reg = <0x82000 0x808>; + status = "disabled"; + }; + + ppib10: ppib@83000 { + compatible = "nordic,nrf-ppib"; + reg = <0x83000 0x1000>; + status = "disabled"; + }; + + ppib11: ppib@84000 { + compatible = "nordic,nrf-ppib"; + reg = <0x84000 0x1000>; + status = "disabled"; + }; + + timer10: timer@85000 { + compatible = "nordic,nrf-timer"; + status = "disabled"; + reg = <0x85000 0x1000>; + cc-num = <8>; + max-bit-width = <32>; + interrupts = <133 NRF_DEFAULT_IRQ_PRIORITY>; + clocks = <&hfxo>; + prescaler = <0>; + }; + + egu10: egu@87000 { + compatible = "nordic,nrf-egu"; + reg = <0x87000 0x1000>; + interrupts = <135 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + + radio: radio@8a000 { + compatible = "nordic,nrf-radio"; + reg = <0x8a000 0x1000>; + interrupts = <138 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + dfe-supported; + ieee802154-supported; + ble-2mbps-supported; + ble-coded-phy-supported; + cs-supported; + + ieee802154: ieee802154 { + compatible = "nordic,nrf-ieee802154"; + status = "disabled"; + }; + + bt_hci_sdc: bt_hci_sdc { + compatible = "nordic,bt-hci-sdc"; + status = "disabled"; + }; + bt_hci_controller: bt_hci_controller { + compatible = "zephyr,bt-hci-ll-sw-split"; + status = "disabled"; + }; + }; + + dppic20: dppic@c2000 { + compatible = "nordic,nrf-dppic"; + reg = <0xc2000 0x808>; + status = "disabled"; + }; + + ppib20: ppib@c3000 { + compatible = "nordic,nrf-ppib"; + reg = <0xc3000 0x1000>; + status = "disabled"; + }; + + ppib21: ppib@c4000 { + compatible = "nordic,nrf-ppib"; + reg = <0xc4000 0x1000>; + status = "disabled"; + }; + + ppib22: ppib@c5000 { + compatible = "nordic,nrf-ppib"; + reg = <0xc5000 0x1000>; + status = "disabled"; + }; + + i2c20: i2c@c6000 { + compatible = "nordic,nrf-twim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xc6000 0x1000>; + interrupts = <198 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <16>; + status = "disabled"; + zephyr,pm-device-runtime-auto; + }; + + spi20: spi@c6000 { + /* + * This spi node can be either SPIM or SPIS, + * for the user to pick: + * compatible = "nordic,nrf-spim" or + * "nordic,nrf-spis". + */ + compatible = "nordic,nrf-spim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xc6000 0x1000>; + interrupts = <198 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + easydma-maxcnt-bits = <16>; + rx-delay-supported; + rx-delay = <1>; + status = "disabled"; + }; + + uart20: uart@c6000 { + compatible = "nordic,nrf-uarte"; + reg = <0xc6000 0x1000>; + interrupts = <198 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + endtx-stoptx-supported; + frame-timeout-supported; + }; + + i2c21: i2c@c7000 { + compatible = "nordic,nrf-twim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xc7000 0x1000>; + interrupts = <199 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <16>; + status = "disabled"; + zephyr,pm-device-runtime-auto; + }; + + spi21: spi@c7000 { + /* + * This spi node can be either SPIM or SPIS, + * for the user to pick: + * compatible = "nordic,nrf-spim" or + * "nordic,nrf-spis". + */ + compatible = "nordic,nrf-spim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xc7000 0x1000>; + interrupts = <199 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + easydma-maxcnt-bits = <16>; + rx-delay-supported; + rx-delay = <1>; + status = "disabled"; + }; + + uart21: uart@c7000 { + compatible = "nordic,nrf-uarte"; + reg = <0xc7000 0x1000>; + interrupts = <199 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + endtx-stoptx-supported; + frame-timeout-supported; + }; + + i2c22: i2c@c8000 { + compatible = "nordic,nrf-twim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xc8000 0x1000>; + interrupts = <200 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <16>; + status = "disabled"; + zephyr,pm-device-runtime-auto; + }; + + spi22: spi@c8000 { + /* + * This spi node can be either SPIM or SPIS, + * for the user to pick: + * compatible = "nordic,nrf-spim" or + * "nordic,nrf-spis". + */ + compatible = "nordic,nrf-spim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xc8000 0x1000>; + interrupts = <200 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + easydma-maxcnt-bits = <16>; + rx-delay-supported; + rx-delay = <1>; + status = "disabled"; + }; + + uart22: uart@c8000 { + compatible = "nordic,nrf-uarte"; + reg = <0xc8000 0x1000>; + interrupts = <200 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + endtx-stoptx-supported; + frame-timeout-supported; + }; + + egu20: egu@c9000 { + compatible = "nordic,nrf-egu"; + reg = <0xc9000 0x1000>; + interrupts = <201 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + + timer20: timer@ca000 { + compatible = "nordic,nrf-timer"; + status = "disabled"; + reg = <0xca000 0x1000>; + cc-num = <6>; + max-bit-width = <32>; + interrupts = <202 NRF_DEFAULT_IRQ_PRIORITY>; + prescaler = <0>; + }; + + timer21: timer@cb000 { + compatible = "nordic,nrf-timer"; + status = "disabled"; + reg = <0xcb000 0x1000>; + cc-num = <6>; + max-bit-width = <32>; + interrupts = <203 NRF_DEFAULT_IRQ_PRIORITY>; + prescaler = <0>; + }; + + timer22: timer@cc000 { + compatible = "nordic,nrf-timer"; + status = "disabled"; + reg = <0xcc000 0x1000>; + cc-num = <6>; + max-bit-width = <32>; + interrupts = <204 NRF_DEFAULT_IRQ_PRIORITY>; + prescaler = <0>; + }; + + timer23: timer@cd000 { + compatible = "nordic,nrf-timer"; + status = "disabled"; + reg = <0xcd000 0x1000>; + cc-num = <6>; + max-bit-width = <32>; + interrupts = <205 NRF_DEFAULT_IRQ_PRIORITY>; + prescaler = <0>; + }; + + timer24: timer@ce000 { + compatible = "nordic,nrf-timer"; + status = "disabled"; + reg = <0xce000 0x1000>; + cc-num = <6>; + max-bit-width = <32>; + interrupts = <206 NRF_DEFAULT_IRQ_PRIORITY>; + prescaler = <0>; + }; + + pdm20: pdm@d0000 { + compatible = "nordic,nrf-pdm"; + status = "disabled"; + reg = <0xd0000 0x1000>; + interrupts = <208 NRF_DEFAULT_IRQ_PRIORITY>; + }; + + pdm21: pdm@d1000 { + compatible = "nordic,nrf-pdm"; + status = "disabled"; + reg = <0xd1000 0x1000>; + interrupts = <209 NRF_DEFAULT_IRQ_PRIORITY>; + }; + + pwm20: pwm@d2000 { + compatible = "nordic,nrf-pwm"; + status = "disabled"; + reg = <0xd2000 0x1000>; + interrupts = <210 NRF_DEFAULT_IRQ_PRIORITY>; + #pwm-cells = <3>; + idleout-supported; + }; + + pwm21: pwm@d3000 { + compatible = "nordic,nrf-pwm"; + status = "disabled"; + reg = <0xd3000 0x1000>; + interrupts = <211 NRF_DEFAULT_IRQ_PRIORITY>; + #pwm-cells = <3>; + idleout-supported; + }; + + pwm22: pwm@d4000 { + compatible = "nordic,nrf-pwm"; + status = "disabled"; + reg = <0xd4000 0x1000>; + interrupts = <212 NRF_DEFAULT_IRQ_PRIORITY>; + #pwm-cells = <3>; + idleout-supported; + }; + + adc: adc@d5000 { + compatible = "nordic,nrf-saadc"; + reg = <0xd5000 0x1000>; + interrupts = <213 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + #io-channel-cells = <1>; + zephyr,pm-device-runtime-auto; + }; + + nfct: nfct@d6000 { + compatible = "nordic,nrf-nfct"; + reg = <0xd6000 0x1000>; + interrupts = <214 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + + temp: temp@d7000 { + compatible = "nordic,nrf-temp"; + reg = <0xd7000 0x1000>; + interrupts = <215 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + + gpio1: gpio@d8200 { + compatible = "nordic,nrf-gpio"; + gpio-controller; + reg = <0xd8200 0x300>; + #gpio-cells = <2>; + ngpios = <16>; + status = "disabled"; + port = <1>; + gpiote-instance = <&gpiote20>; + }; + + gpiote20: gpiote@da000 { + compatible = "nordic,nrf-gpiote"; + reg = <0xda000 0x1000>; + status = "disabled"; + instance = <20>; + }; + + qdec20: qdec@e0000 { + compatible = "nordic,nrf-qdec"; + reg = <0xe0000 0x1000>; + interrupts = <224 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + + qdec21: qdec@e1000 { + compatible = "nordic,nrf-qdec"; + reg = <0xe1000 0x1000>; + interrupts = <225 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + + grtc: grtc@e2000 { + compatible = "nordic,nrf-grtc"; + reg = <0xe2000 0x1000>; + cc-num = <12>; + clocks = <&lfxo>, <&pclk>; + clock-names = "lfclock", "hfclock"; + status = "disabled"; + }; + + tdm: tdm@e8000 { + compatible = "nordic,nrf-tdm"; + easydma-maxcnt-bits = <15>; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xe8000 0x1000>; + interrupts = <232 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + clocks = <&pclk32m>; + }; + + i2c23: i2c@ed000 { + compatible = "nordic,nrf-twim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xed000 0x1000>; + interrupts = <237 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <16>; + status = "disabled"; + zephyr,pm-device-runtime-auto; + }; + + spi23: spi@ed000 { + /* + * This spi node can be either SPIM or SPIS, + * for the user to pick: + * compatible = "nordic,nrf-spim" or + * "nordic,nrf-spis". + */ + compatible = "nordic,nrf-spim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xed000 0x1000>; + interrupts = <237 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + easydma-maxcnt-bits = <16>; + rx-delay-supported; + rx-delay = <1>; + status = "disabled"; + }; + + uart23: uart@ed000 { + compatible = "nordic,nrf-uarte"; + reg = <0xed000 0x1000>; + interrupts = <237 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + endtx-stoptx-supported; + frame-timeout-supported; + }; + + i2c24: i2c@ee000 { + compatible = "nordic,nrf-twim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xee000 0x1000>; + interrupts = <238 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <16>; + status = "disabled"; + zephyr,pm-device-runtime-auto; + }; + + spi24: spi@ee000 { + /* + * This spi node can be either SPIM or SPIS, + * for the user to pick: + * compatible = "nordic,nrf-spim" or + * "nordic,nrf-spis". + */ + compatible = "nordic,nrf-spim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xee000 0x1000>; + interrupts = <238 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + easydma-maxcnt-bits = <16>; + rx-delay-supported; + rx-delay = <1>; + status = "disabled"; + }; + + uart24: uart@ee000 { + compatible = "nordic,nrf-uarte"; + reg = <0xee000 0x1000>; + interrupts = <238 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + endtx-stoptx-supported; + frame-timeout-supported; + }; + + dppic30: dppic@102000 { + compatible = "nordic,nrf-dppic"; + reg = <0x102000 0x808>; + status = "disabled"; + }; + + ppib30: ppib@103000 { + compatible = "nordic,nrf-ppib"; + reg = <0x103000 0x1000>; + status = "disabled"; + }; + + i2c30: i2c@104000 { + compatible = "nordic,nrf-twim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x104000 0x1000>; + interrupts = <260 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <16>; + status = "disabled"; + zephyr,pm-device-runtime-auto; + }; + + spi30: spi@104000 { + /* + * This spi node can be either SPIM or SPIS, + * for the user to pick: + * compatible = "nordic,nrf-spim" or + * "nordic,nrf-spis". + */ + compatible = "nordic,nrf-spim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x104000 0x1000>; + interrupts = <260 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + easydma-maxcnt-bits = <16>; + rx-delay-supported; + rx-delay = <1>; + status = "disabled"; + }; + + uart30: uart@104000 { + compatible = "nordic,nrf-uarte"; + reg = <0x104000 0x1000>; + interrupts = <260 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + endtx-stoptx-supported; + frame-timeout-supported; + }; + + comp: comparator@106000 { + /* + * Use compatible "nordic,nrf-comp" to configure as COMP + * Use compatible "nordic,nrf-lpcomp" to configure as LPCOMP + */ + compatible = "nordic,nrf-comp"; + reg = <0x106000 0x1000>; + status = "disabled"; + interrupts = <262 NRF_DEFAULT_IRQ_PRIORITY>; + }; + + wdt30: watchdog@108000 { + compatible = "nordic,nrf-wdt"; + reg = <0x108000 0x620>; + interrupts = <264 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + + wdt31: watchdog@109000 { + compatible = "nordic,nrf-wdt"; + reg = <0x109000 0x620>; + interrupts = <265 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + + gpio0: gpio@10a000 { + compatible = "nordic,nrf-gpio"; + gpio-controller; + reg = <0x10a000 0x300>; + #gpio-cells = <2>; + ngpios = <5>; + status = "disabled"; + port = <0>; + gpiote-instance = <&gpiote30>; + }; + + gpiote30: gpiote@10c000 { + compatible = "nordic,nrf-gpiote"; + reg = <0x10c000 0x1000>; + status = "disabled"; + instance = <30>; + }; + + clock: clock@10e000 { + compatible = "nordic,nrf-clock"; + reg = <0x10e000 0x1000>; + interrupts = <270 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + + power: power@10e000 { + compatible = "nordic,nrf-power"; + reg = <0x10e000 0x1000>; + ranges = <0x0 0x10e000 0x1000>; + interrupts = <270 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + #address-cells = <1>; + #size-cells = <1>; + + gpregret1: gpregret1@51c { + #address-cells = <1>; + #size-cells = <1>; + compatible = "nordic,nrf-gpregret"; + reg = <0x51c 0x1>; + status = "disabled"; + }; + + gpregret2: gpregret2@520 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "nordic,nrf-gpregret"; + reg = <0x520 0x1>; + status = "disabled"; + }; + }; + + regulators: regulator@120000 { + compatible = "nordic,nrf54l-regulators"; + reg = <0x120000 0x1000>; + status = "disabled"; + #address-cells = <1>; + #size-cells = <1>; + + vregmain: regulator@120600 { + compatible = "nordic,nrf5x-regulator"; + reg = <0x120600 0x1>; + status = "disabled"; + regulator-name = "VREGMAIN"; + regulator-initial-mode = ; + }; + }; + }; + + rram_controller: rram-controller@5004e000 { + compatible = "nordic,rram-controller"; + reg = <0x5004e000 0x1000>; + interrupts = <78 NRF_DEFAULT_IRQ_PRIORITY>; + #address-cells = <1>; + #size-cells = <1>; + + cpuapp_rram: rram@0 { + compatible = "soc-nv-flash"; + reg = <0x0 DT_SIZE_K(1972)>; + erase-block-size = <4096>; + write-block-size = <16>; + }; + + cpuflpr_rram: rram@1ed000 { + compatible = "soc-nv-flash"; + reg = <0x1ed000 DT_SIZE_K(64)>; + erase-block-size = <4096>; + write-block-size = <16>; + }; + }; + + cpuapp_ppb: cpuapp-ppb-bus { + #address-cells = <1>; + #size-cells = <1>; + + cpuapp_nvic: interrupt-controller@e000e100 { + #address-cells = <1>; + compatible = "arm,v8m-nvic"; + reg = <0xe000e100 0xc00>; + arm,num-irq-priority-bits = <3>; + interrupt-controller; + #interrupt-cells = <2>; + }; + + cpuapp_systick: timer@e000e010 { + compatible = "arm,armv8m-systick"; + reg = <0xe000e010 0x10>; + status = "disabled"; + }; + }; + }; +}; diff --git a/dts/vendor/nordic/nrf54l_05_10_15.dtsi b/dts/vendor/nordic/nrf54l_05_10_15.dtsi index aa259713d2fd..95c273750387 100644 --- a/dts/vendor/nordic/nrf54l_05_10_15.dtsi +++ b/dts/vendor/nordic/nrf54l_05_10_15.dtsi @@ -250,9 +250,11 @@ status = "disabled"; }; - /* Note: In the nRF Connect SDK the SoftDevice Controller - * is added and set as the default Bluetooth Controller. - */ + bt_hci_sdc: bt_hci_sdc { + compatible = "nordic,bt-hci-sdc"; + status = "disabled"; + }; + bt_hci_controller: bt_hci_controller { compatible = "zephyr,bt-hci-ll-sw-split"; status = "disabled"; diff --git a/samples/bluetooth/bap_broadcast_sink/sample.yaml b/samples/bluetooth/bap_broadcast_sink/sample.yaml index 5d06dee0bf89..148b8b641697 100644 --- a/samples/bluetooth/bap_broadcast_sink/sample.yaml +++ b/samples/bluetooth/bap_broadcast_sink/sample.yaml @@ -24,5 +24,7 @@ tests: - nrf52_bsim - nrf52833dk/nrf52833 - nrf52840dongle/nrf52840 - extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf + extra_args: + - EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf + - SNIPPET="bt-ll-sw-split" tags: bluetooth diff --git a/samples/bluetooth/bap_broadcast_sink/sysbuild.cmake b/samples/bluetooth/bap_broadcast_sink/sysbuild.cmake index 2523aac8ea76..d5d260789ff7 100644 --- a/samples/bluetooth/bap_broadcast_sink/sysbuild.cmake +++ b/samples/bluetooth/bap_broadcast_sink/sysbuild.cmake @@ -18,6 +18,10 @@ if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) CACHE INTERNAL "" ) + list(APPEND ${NET_APP}_SNIPPET ${SNIPPET}) + list(APPEND ${NET_APP}_SNIPPET bt-ll-sw-split) + set(${NET_APP}_SNIPPET ${${NET_APP}_SNIPPET} CACHE STRING "" FORCE) + native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) endif() diff --git a/samples/bluetooth/bap_broadcast_source/sample.yaml b/samples/bluetooth/bap_broadcast_source/sample.yaml index 5e5b01d942d0..5f745cd08950 100644 --- a/samples/bluetooth/bap_broadcast_source/sample.yaml +++ b/samples/bluetooth/bap_broadcast_source/sample.yaml @@ -36,5 +36,7 @@ tests: - nrf52_bsim - nrf52833dk/nrf52833 - nrf52840dongle/nrf52840 - extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf + extra_args: + - EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf + - SNIPPET="bt-ll-sw-split" tags: bluetooth diff --git a/samples/bluetooth/bap_broadcast_source/sysbuild.cmake b/samples/bluetooth/bap_broadcast_source/sysbuild.cmake index 2523aac8ea76..d5d260789ff7 100644 --- a/samples/bluetooth/bap_broadcast_source/sysbuild.cmake +++ b/samples/bluetooth/bap_broadcast_source/sysbuild.cmake @@ -18,6 +18,10 @@ if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) CACHE INTERNAL "" ) + list(APPEND ${NET_APP}_SNIPPET ${SNIPPET}) + list(APPEND ${NET_APP}_SNIPPET bt-ll-sw-split) + set(${NET_APP}_SNIPPET ${${NET_APP}_SNIPPET} CACHE STRING "" FORCE) + native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) endif() diff --git a/samples/bluetooth/bap_unicast_client/sample.yaml b/samples/bluetooth/bap_unicast_client/sample.yaml index 7283090b8781..44f32934ce99 100644 --- a/samples/bluetooth/bap_unicast_client/sample.yaml +++ b/samples/bluetooth/bap_unicast_client/sample.yaml @@ -22,5 +22,7 @@ tests: - nrf52840dk/nrf52840 integration_platforms: - nrf52dk/nrf52832 - extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf + extra_args: + - EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf + - SNIPPET="bt-ll-sw-split" tags: bluetooth diff --git a/samples/bluetooth/bap_unicast_client/sysbuild.cmake b/samples/bluetooth/bap_unicast_client/sysbuild.cmake index 2523aac8ea76..d5d260789ff7 100644 --- a/samples/bluetooth/bap_unicast_client/sysbuild.cmake +++ b/samples/bluetooth/bap_unicast_client/sysbuild.cmake @@ -18,6 +18,10 @@ if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) CACHE INTERNAL "" ) + list(APPEND ${NET_APP}_SNIPPET ${SNIPPET}) + list(APPEND ${NET_APP}_SNIPPET bt-ll-sw-split) + set(${NET_APP}_SNIPPET ${${NET_APP}_SNIPPET} CACHE STRING "" FORCE) + native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) endif() diff --git a/samples/bluetooth/bap_unicast_server/sample.yaml b/samples/bluetooth/bap_unicast_server/sample.yaml index 068f752b626b..266ced73f66d 100644 --- a/samples/bluetooth/bap_unicast_server/sample.yaml +++ b/samples/bluetooth/bap_unicast_server/sample.yaml @@ -22,5 +22,7 @@ tests: - nrf52840dk/nrf52840 integration_platforms: - nrf52dk/nrf52832 - extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf + extra_args: + - EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf + - SNIPPET="bt-ll-sw-split" tags: bluetooth diff --git a/samples/bluetooth/bap_unicast_server/sysbuild.cmake b/samples/bluetooth/bap_unicast_server/sysbuild.cmake index 2523aac8ea76..d5d260789ff7 100644 --- a/samples/bluetooth/bap_unicast_server/sysbuild.cmake +++ b/samples/bluetooth/bap_unicast_server/sysbuild.cmake @@ -18,6 +18,10 @@ if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) CACHE INTERNAL "" ) + list(APPEND ${NET_APP}_SNIPPET ${SNIPPET}) + list(APPEND ${NET_APP}_SNIPPET bt-ll-sw-split) + set(${NET_APP}_SNIPPET ${${NET_APP}_SNIPPET} CACHE STRING "" FORCE) + native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) endif() diff --git a/samples/bluetooth/beacon/sample.yaml b/samples/bluetooth/beacon/sample.yaml index 23ffad73c796..00215341924f 100644 --- a/samples/bluetooth/beacon/sample.yaml +++ b/samples/bluetooth/beacon/sample.yaml @@ -20,7 +20,9 @@ tests: - ophelia4ev/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp sample.bluetooth.beacon-coex: - extra_args: CONF_FILE="prj-coex.conf" + extra_args: + - CONF_FILE="prj-coex.conf" + - SNIPPET="bt-ll-sw-split" harness: bluetooth platform_allow: - nrf52840dk/nrf52840 diff --git a/samples/bluetooth/cap_acceptor/sample.yaml b/samples/bluetooth/cap_acceptor/sample.yaml index 824e744eecaf..9061f44679fb 100644 --- a/samples/bluetooth/cap_acceptor/sample.yaml +++ b/samples/bluetooth/cap_acceptor/sample.yaml @@ -26,5 +26,7 @@ tests: - nrf52833dk/nrf52833 - nrf52840dk/nrf52840 - nrf52840dongle/nrf52840 - extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf + extra_args: + - EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf + - SNIPPET="bt-ll-sw-split" tags: bluetooth diff --git a/samples/bluetooth/cap_acceptor/sysbuild.cmake b/samples/bluetooth/cap_acceptor/sysbuild.cmake index 2523aac8ea76..d5d260789ff7 100644 --- a/samples/bluetooth/cap_acceptor/sysbuild.cmake +++ b/samples/bluetooth/cap_acceptor/sysbuild.cmake @@ -18,6 +18,10 @@ if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) CACHE INTERNAL "" ) + list(APPEND ${NET_APP}_SNIPPET ${SNIPPET}) + list(APPEND ${NET_APP}_SNIPPET bt-ll-sw-split) + set(${NET_APP}_SNIPPET ${${NET_APP}_SNIPPET} CACHE STRING "" FORCE) + native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) endif() diff --git a/samples/bluetooth/cap_initiator/sample.yaml b/samples/bluetooth/cap_initiator/sample.yaml index b4f593c99129..e3e557f48301 100644 --- a/samples/bluetooth/cap_initiator/sample.yaml +++ b/samples/bluetooth/cap_initiator/sample.yaml @@ -26,5 +26,7 @@ tests: - nrf52833dk/nrf52833 - nrf52840dk/nrf52840 - nrf52840dongle/nrf52840 - extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf + extra_args: + - EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf + - SNIPPET="bt-ll-sw-split" tags: bluetooth diff --git a/samples/bluetooth/cap_initiator/sysbuild.cmake b/samples/bluetooth/cap_initiator/sysbuild.cmake index 2523aac8ea76..d5d260789ff7 100644 --- a/samples/bluetooth/cap_initiator/sysbuild.cmake +++ b/samples/bluetooth/cap_initiator/sysbuild.cmake @@ -18,6 +18,10 @@ if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) CACHE INTERNAL "" ) + list(APPEND ${NET_APP}_SNIPPET ${SNIPPET}) + list(APPEND ${NET_APP}_SNIPPET bt-ll-sw-split) + set(${NET_APP}_SNIPPET ${${NET_APP}_SNIPPET} CACHE STRING "" FORCE) + native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) endif() diff --git a/samples/bluetooth/direction_finding_central/sample.yaml b/samples/bluetooth/direction_finding_central/sample.yaml index b7a118e6cdc8..ffdf634c6e3e 100644 --- a/samples/bluetooth/direction_finding_central/sample.yaml +++ b/samples/bluetooth/direction_finding_central/sample.yaml @@ -14,15 +14,24 @@ tests: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 - nrf5340dk/nrf5340/cpuapp - sample.bluetooth.direction_finding.central.aod: + sample.bluetooth.direction_finding.central.aod_with_controller: harness: bluetooth - extra_args: EXTRA_CONF_FILE="overlay-aod.conf" + extra_args: + - EXTRA_CONF_FILE="overlay-aod.conf" + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 - - nrf5340dk/nrf5340/cpuapp tags: bluetooth integration_platforms: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 + sample.bluetooth.direction_finding.central.aod_host_only: + harness: bluetooth + extra_args: + - OVERLAY_CONFIG="overlay-aod.conf" + platform_allow: + - nrf5340dk/nrf5340/cpuapp + tags: bluetooth + integration_platforms: - nrf5340dk/nrf5340/cpuapp diff --git a/samples/bluetooth/direction_finding_connectionless_rx/sample.yaml b/samples/bluetooth/direction_finding_connectionless_rx/sample.yaml index 8e6097de58ae..c500cc80dcec 100644 --- a/samples/bluetooth/direction_finding_connectionless_rx/sample.yaml +++ b/samples/bluetooth/direction_finding_connectionless_rx/sample.yaml @@ -12,14 +12,22 @@ tests: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 - nrf5340dk/nrf5340/cpuapp - sample.bluetooth.direction_finding_connectionless_rx.aod: + sample.bluetooth.direction_finding_connectionless_rx.aod_with_controller: harness: bluetooth - extra_args: EXTRA_CONF_FILE="overlay-aod.conf" + extra_args: + - EXTRA_CONF_FILE="overlay-aod.conf" + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 - - nrf5340dk/nrf5340/cpuapp integration_platforms: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 + sample.bluetooth.direction_finding_connectionless_rx.aod_host_only: + harness: bluetooth + extra_args: + - OVERLAY_CONFIG="overlay-aod.conf" + platform_allow: + - nrf5340dk/nrf5340/cpuapp + integration_platforms: - nrf5340dk/nrf5340/cpuapp diff --git a/samples/bluetooth/direction_finding_connectionless_tx/sample.yaml b/samples/bluetooth/direction_finding_connectionless_tx/sample.yaml index 78d21b2c95f5..2a4fa93d19d5 100644 --- a/samples/bluetooth/direction_finding_connectionless_tx/sample.yaml +++ b/samples/bluetooth/direction_finding_connectionless_tx/sample.yaml @@ -12,14 +12,22 @@ tests: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 - nrf5340dk/nrf5340/cpuapp - sample.bluetooth.direction_finding_connectionless.aoa: + sample.bluetooth.direction_finding_connectionless.aoa_with_controller: harness: bluetooth - extra_args: EXTRA_CONF_FILE="overlay-aoa.conf" + extra_args: + - EXTRA_CONF_FILE="overlay-aoa.conf" + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 - - nrf5340dk/nrf5340/cpuapp integration_platforms: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 + sample.bluetooth.direction_finding_connectionless.aoa_host_only: + harness: bluetooth + extra_args: + - OVERLAY_CONFIG="overlay-aoa.conf" + platform_allow: + - nrf5340dk/nrf5340/cpuapp + integration_platforms: - nrf5340dk/nrf5340/cpuapp diff --git a/samples/bluetooth/direction_finding_peripheral/sample.yaml b/samples/bluetooth/direction_finding_peripheral/sample.yaml index f300cb415cc5..01f612ad08a0 100644 --- a/samples/bluetooth/direction_finding_peripheral/sample.yaml +++ b/samples/bluetooth/direction_finding_peripheral/sample.yaml @@ -14,15 +14,24 @@ tests: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 - nrf5340dk/nrf5340/cpuapp - sample.bluetooth.direction_finding.peripheral.aod: + sample.bluetooth.direction_finding.peripheral.aod_with_controller: harness: bluetooth - extra_args: EXTRA_CONF_FILE="overlay-aoa.conf" + extra_args: + - EXTRA_CONF_FILE="overlay-aoa.conf" + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 - - nrf5340dk/nrf5340/cpuapp tags: bluetooth integration_platforms: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 + sample.bluetooth.direction_finding.peripheral.aod_host_only: + harness: bluetooth + extra_args: + - OVERLAY_CONFIG="overlay-aoa.conf" + platform_allow: + - nrf5340dk/nrf5340/cpuapp + tags: bluetooth + integration_platforms: - nrf5340dk/nrf5340/cpuapp diff --git a/samples/bluetooth/hci_ipc/sample.yaml b/samples/bluetooth/hci_ipc/sample.yaml index b758b2547688..3763478b6b33 100644 --- a/samples/bluetooth/hci_ipc/sample.yaml +++ b/samples/bluetooth/hci_ipc/sample.yaml @@ -15,7 +15,9 @@ tests: sample.bluetooth.hci_ipc.iso_broadcast.bt_ll_sw_split: harness: bluetooth tags: bluetooth - extra_args: CONF_FILE="nrf5340_cpunet_iso_broadcast-bt_ll_sw_split.conf" + extra_args: + - CONF_FILE="nrf5340_cpunet_iso_broadcast-bt_ll_sw_split.conf" + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf5340dk/nrf5340/cpunet - nrf5340_audio_dk/nrf5340/cpunet @@ -25,7 +27,9 @@ tests: sample.bluetooth.hci_ipc.iso_receive.bt_ll_sw_split: harness: bluetooth tags: bluetooth - extra_args: CONF_FILE="nrf5340_cpunet_iso_receive-bt_ll_sw_split.conf" + extra_args: + - CONF_FILE="nrf5340_cpunet_iso_receive-bt_ll_sw_split.conf" + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf5340dk/nrf5340/cpunet - nrf5340_audio_dk/nrf5340/cpunet @@ -35,7 +39,9 @@ tests: sample.bluetooth.hci_ipc.bis.bt_ll_sw_split: harness: bluetooth tags: bluetooth - extra_args: CONF_FILE="nrf5340_cpunet_bis-bt_ll_sw_split.conf" + extra_args: + - CONF_FILE="nrf5340_cpunet_bis-bt_ll_sw_split.conf" + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf5340dk/nrf5340/cpunet - nrf5340_audio_dk/nrf5340/cpunet @@ -45,7 +51,9 @@ tests: sample.bluetooth.hci_ipc.iso_central.bt_ll_sw_split: harness: bluetooth tags: bluetooth - extra_args: CONF_FILE="nrf5340_cpunet_iso_central-bt_ll_sw_split.conf" + extra_args: + - CONF_FILE="nrf5340_cpunet_iso_central-bt_ll_sw_split.conf" + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf5340dk/nrf5340/cpunet - nrf5340_audio_dk/nrf5340/cpunet @@ -55,7 +63,9 @@ tests: sample.bluetooth.hci_ipc.iso_peripheral.bt_ll_sw_split: harness: bluetooth tags: bluetooth - extra_args: CONF_FILE="nrf5340_cpunet_iso_peripheral-bt_ll_sw_split.conf" + extra_args: + - CONF_FILE="nrf5340_cpunet_iso_peripheral-bt_ll_sw_split.conf" + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf5340dk/nrf5340/cpunet - nrf5340_audio_dk/nrf5340/cpunet @@ -65,7 +75,9 @@ tests: sample.bluetooth.hci_ipc.cis.bt_ll_sw_split: harness: bluetooth tags: bluetooth - extra_args: CONF_FILE="nrf5340_cpunet_cis-bt_ll_sw_split.conf" + extra_args: + - CONF_FILE="nrf5340_cpunet_cis-bt_ll_sw_split.conf" + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf5340dk/nrf5340/cpunet - nrf5340_audio_dk/nrf5340/cpunet @@ -75,7 +87,9 @@ tests: sample.bluetooth.hci_ipc.iso.bt_ll_sw_split: harness: bluetooth tags: bluetooth - extra_args: CONF_FILE="nrf5340_cpunet_iso-bt_ll_sw_split.conf" + extra_args: + - CONF_FILE="nrf5340_cpunet_iso-bt_ll_sw_split.conf" + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf5340dk/nrf5340/cpunet - nrf5340_audio_dk/nrf5340/cpunet @@ -99,6 +113,7 @@ tests: extra_args: - CONF_FILE="nrf5340_cpunet_df-bt_ll_sw_split.conf" - DTC_OVERLAY_FILE="nrf5340_cpunet_df-bt_ll_sw_split.overlay" + - SNIPPET="bt-ll-sw-split" platform_allow: nrf5340dk/nrf5340/cpunet integration_platforms: - nrf5340dk/nrf5340/cpunet @@ -109,13 +124,16 @@ tests: - CONF_FILE="nrf5340_cpunet_df-bt_ll_sw_split.conf" - DTC_OVERLAY_FILE="nrf5340_cpunet_df-bt_ll_sw_split.overlay" - CONFIG_BT_CTLR_PHY_CODED=n + - SNIPPET="bt-ll-sw-split" platform_allow: nrf5340dk/nrf5340/cpunet integration_platforms: - nrf5340dk/nrf5340/cpunet sample.bluetooth.hci_ipc.mesh.bt_ll_sw_split: harness: bluetooth tags: bluetooth - extra_args: CONF_FILE="nrf5340_cpunet_bt_mesh-bt_ll_sw_split.conf" + extra_args: + - CONF_FILE="nrf5340_cpunet_bt_mesh-bt_ll_sw_split.conf" + - SNIPPET="bt-ll-sw-split" platform_allow: nrf5340dk/nrf5340/cpunet integration_platforms: - nrf5340dk/nrf5340/cpunet diff --git a/samples/bluetooth/hci_uart/sample.yaml b/samples/bluetooth/hci_uart/sample.yaml index df2b40135c67..8555c65cf0df 100644 --- a/samples/bluetooth/hci_uart/sample.yaml +++ b/samples/bluetooth/hci_uart/sample.yaml @@ -24,7 +24,9 @@ tests: platform_allow: nrf52833dk/nrf52833 integration_platforms: - nrf52833dk/nrf52833 - extra_args: DTC_OVERLAY_FILE=./boards/nrf52833dk_nrf52833_df.overlay + extra_args: + - DTC_OVERLAY_FILE=./boards/nrf52833dk_nrf52833_df.overlay + - SNIPPET="bt-ll-sw-split" extra_configs: - CONFIG_BT_CTLR_DF=y tags: @@ -33,7 +35,9 @@ tests: sample.bluetooth.hci_uart.nrf5340_netcore.df: harness: bluetooth platform_allow: nrf5340dk/nrf5340/cpunet - extra_args: DTC_OVERLAY_FILE=./boards/nrf5340dk_nrf5340_cpunet_df.overlay + extra_args: + - DTC_OVERLAY_FILE=./boards/nrf5340dk_nrf5340_cpunet_df.overlay + - SNIPPET="bt-ll-sw-split" extra_configs: - CONFIG_BT_CTLR_DF=y tags: @@ -44,7 +48,9 @@ tests: platform_allow: nrf52833dk/nrf52833 integration_platforms: - nrf52833dk/nrf52833 - extra_args: DTC_OVERLAY_FILE=./boards/nrf52833dk_nrf52833_df.overlay + extra_args: + - DTC_OVERLAY_FILE=./boards/nrf52833dk_nrf52833_df.overlay + - SNIPPET="bt-ll-sw-split" extra_configs: - CONFIG_BT_CTLR_DF=y - CONFIG_BT_CTLR_DTM_HCI_DF_IQ_REPORT=y @@ -54,7 +60,9 @@ tests: sample.bluetooth.hci_uart.nrf5340_netcore.df.iq_report: harness: bluetooth platform_allow: nrf5340dk/nrf5340/cpunet - extra_args: DTC_OVERLAY_FILE=./boards/nrf5340dk_nrf5340_cpunet_df.overlay + extra_args: + - DTC_OVERLAY_FILE=./boards/nrf5340dk_nrf5340_cpunet_df.overlay + - SNIPPET="bt-ll-sw-split" extra_configs: - CONFIG_BT_CTLR_DF=y - CONFIG_BT_CTLR_DTM_HCI_DF_IQ_REPORT=y @@ -88,6 +96,7 @@ tests: extra_args: - EXTRA_CONF_FILE=overlay-all-bt_ll_sw_split.conf - DTC_OVERLAY_FILE=./boards/nrf52833dk_nrf52833_df.overlay + - SNIPPET="bt-ll-sw-split" tags: - uart - bluetooth @@ -99,6 +108,7 @@ tests: extra_args: - EXTRA_CONF_FILE=overlay-all-bt_ll_sw_split.conf - DTC_OVERLAY_FILE=./boards/nrf54l15dk_nrf54l15_cpuapp_df.overlay + - SNIPPET="bt-ll-sw-split" tags: - uart - bluetooth diff --git a/samples/bluetooth/hci_vs_scan_req/sample.yaml b/samples/bluetooth/hci_vs_scan_req/sample.yaml index 245a83aa0d96..49526522d16e 100644 --- a/samples/bluetooth/hci_vs_scan_req/sample.yaml +++ b/samples/bluetooth/hci_vs_scan_req/sample.yaml @@ -9,4 +9,6 @@ tests: - nrf52dk/nrf52832 extra_configs: - CONFIG_BT_LL_SW_SPLIT=y + extra_args: + - SNIPPET="bt-ll-sw-split" tags: bluetooth diff --git a/samples/bluetooth/iso_central/sample.yaml b/samples/bluetooth/iso_central/sample.yaml index 3a7dedd404ae..57254ee809ab 100644 --- a/samples/bluetooth/iso_central/sample.yaml +++ b/samples/bluetooth/iso_central/sample.yaml @@ -11,11 +11,11 @@ tests: sample.bluetooth.iso_central.bt_ll_sw_split: harness: bluetooth platform_allow: - - qemu_cortex_m3 - - qemu_x86 - nrf52_bsim - nrf52833dk/nrf52833 integration_platforms: - nrf52833dk/nrf52833 - extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf + extra_args: + - EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf + - SNIPPET="bt-ll-sw-split" tags: bluetooth diff --git a/samples/bluetooth/pbp_public_broadcast_sink/sample.yaml b/samples/bluetooth/pbp_public_broadcast_sink/sample.yaml index d7c816ee5b76..901d40b00d4f 100644 --- a/samples/bluetooth/pbp_public_broadcast_sink/sample.yaml +++ b/samples/bluetooth/pbp_public_broadcast_sink/sample.yaml @@ -23,5 +23,7 @@ tests: integration_platforms: - nrf52_bsim - nrf52833dk/nrf52833 - extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf + extra_args: + - EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf + - SNIPPET="bt-ll-sw-split" tags: bluetooth diff --git a/samples/bluetooth/pbp_public_broadcast_sink/sysbuild.cmake b/samples/bluetooth/pbp_public_broadcast_sink/sysbuild.cmake index 2523aac8ea76..d5d260789ff7 100644 --- a/samples/bluetooth/pbp_public_broadcast_sink/sysbuild.cmake +++ b/samples/bluetooth/pbp_public_broadcast_sink/sysbuild.cmake @@ -18,6 +18,10 @@ if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) CACHE INTERNAL "" ) + list(APPEND ${NET_APP}_SNIPPET ${SNIPPET}) + list(APPEND ${NET_APP}_SNIPPET bt-ll-sw-split) + set(${NET_APP}_SNIPPET ${${NET_APP}_SNIPPET} CACHE STRING "" FORCE) + native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) endif() diff --git a/samples/bluetooth/pbp_public_broadcast_source/sample.yaml b/samples/bluetooth/pbp_public_broadcast_source/sample.yaml index 80c907042119..1d2e31306e29 100644 --- a/samples/bluetooth/pbp_public_broadcast_source/sample.yaml +++ b/samples/bluetooth/pbp_public_broadcast_source/sample.yaml @@ -23,5 +23,7 @@ tests: integration_platforms: - nrf52_bsim - nrf52833dk/nrf52833 - extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf + extra_args: + - EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf + - SNIPPET="bt-ll-sw-split" tags: bluetooth diff --git a/samples/bluetooth/pbp_public_broadcast_source/sysbuild.cmake b/samples/bluetooth/pbp_public_broadcast_source/sysbuild.cmake index d3bf7be5b6c3..e0a7fd9d175d 100644 --- a/samples/bluetooth/pbp_public_broadcast_source/sysbuild.cmake +++ b/samples/bluetooth/pbp_public_broadcast_source/sysbuild.cmake @@ -18,6 +18,10 @@ if(NOT("${SB_CONFIG_NET_CORE_BOARD}" STREQUAL "")) CACHE INTERNAL "" ) + list(APPEND ${NET_APP}_SNIPPET ${SNIPPET}) + list(APPEND ${NET_APP}_SNIPPET bt-ll-sw-split) + set(${NET_APP}_SNIPPET ${${NET_APP}_SNIPPET} CACHE STRING "" FORCE) + native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) endif() diff --git a/snippets/bt-ll-sw-split/bt-ll-sw-split.overlay b/snippets/bt-ll-sw-split/bt-ll-sw-split.overlay index 04bf83ef44d4..a57a0e82ba6e 100644 --- a/snippets/bt-ll-sw-split/bt-ll-sw-split.overlay +++ b/snippets/bt-ll-sw-split/bt-ll-sw-split.overlay @@ -2,6 +2,10 @@ status = "okay"; }; +&bt_hci_sdc { + status = "disabled"; +}; + / { chosen { zephyr,bt-hci = &bt_hci_controller; diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c index b44847c05850..cada046f049b 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c @@ -62,7 +62,7 @@ static struct { /* FIXME: This could probably use a chosen entropy device instead on relying on * the nodelabel being the same as for the old nrf rng. */ -static const struct device *const dev_entropy = DEVICE_DT_GET(DT_NODELABEL(rng)); +static const struct device *const dev_entropy = DEVICE_DT_GET(DT_CHOSEN(zephyr_entropy)); #endif /* CONFIG_ENTROPY_HAS_DRIVER */ static int init_reset(void); diff --git a/tests/bluetooth/controller/ctrl_api/testcase.yaml b/tests/bluetooth/controller/ctrl_api/testcase.yaml index 19bf6c9ab490..21f178bf9b2b 100644 --- a/tests/bluetooth/controller/ctrl_api/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_api/testcase.yaml @@ -6,3 +6,5 @@ common: tests: bluetooth.controller.ctrl_api.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_chmu/testcase.yaml b/tests/bluetooth/controller/ctrl_chmu/testcase.yaml index f7e8068d60ec..9c3ee6264335 100644 --- a/tests/bluetooth/controller/ctrl_chmu/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_chmu/testcase.yaml @@ -6,3 +6,5 @@ common: tests: bluetooth.controller.ctrl_chmu.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_cis_create/testcase.yaml b/tests/bluetooth/controller/ctrl_cis_create/testcase.yaml index 99612a89bc31..2371d7063eb7 100644 --- a/tests/bluetooth/controller/ctrl_cis_create/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_cis_create/testcase.yaml @@ -6,3 +6,5 @@ common: tests: bluetooth.controller.ctrl_cis_create.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_cis_terminate/testcase.yaml b/tests/bluetooth/controller/ctrl_cis_terminate/testcase.yaml index 956172a89b20..a98229ba45f3 100644 --- a/tests/bluetooth/controller/ctrl_cis_terminate/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_cis_terminate/testcase.yaml @@ -6,3 +6,5 @@ common: tests: bluetooth.controller.ctrl_cis_terminate.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_collision/testcase.yaml b/tests/bluetooth/controller/ctrl_collision/testcase.yaml index 6086a9a4ebc8..daa8f3bc6c3d 100644 --- a/tests/bluetooth/controller/ctrl_collision/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_collision/testcase.yaml @@ -6,3 +6,5 @@ common: tests: bluetooth.controller.ctrl_collision.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_conn_update/testcase.yaml b/tests/bluetooth/controller/ctrl_conn_update/testcase.yaml index 5b0bda4b9088..fc4ecb0b647d 100644 --- a/tests/bluetooth/controller/ctrl_conn_update/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_conn_update/testcase.yaml @@ -7,11 +7,18 @@ common: tests: bluetooth.controller.ctrl_conn_update.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" bluetooth.controller.ctrl_conn_update.apm_test: type: unit - extra_args: CONF_FILE=prj_apm.conf + extra_args: + - CONF_FILE=prj_apm.conf + - SNIPPET="bt-ll-sw-split" + bluetooth.controller.ctrl_conn_update.no_param_req_test: type: unit - extra_args: CONF_FILE=prj_no_param_req.conf + extra_args: + - CONF_FILE=prj_no_param_req.conf + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_cte_req/testcase.yaml b/tests/bluetooth/controller/ctrl_cte_req/testcase.yaml index fd6ff51118d9..c6288aecc433 100644 --- a/tests/bluetooth/controller/ctrl_cte_req/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_cte_req/testcase.yaml @@ -6,3 +6,5 @@ common: tests: bluetooth.controller.ctrl_cte_req.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_data_length_update/testcase.yaml b/tests/bluetooth/controller/ctrl_data_length_update/testcase.yaml index 9778af435b4a..c7d1174e12bf 100644 --- a/tests/bluetooth/controller/ctrl_data_length_update/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_data_length_update/testcase.yaml @@ -6,11 +6,17 @@ common: tests: bluetooth.controller.ctrl_data_length_update.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" bluetooth.controller.ctrl_data_length_update.test_nocodedphy: type: unit - extra_args: CONF_FILE=prj_nocoded.conf + extra_args: + - CONF_FILE=prj_nocoded.conf + - SNIPPET="bt-ll-sw-split" bluetooth.controller.ctrl_data_length_update.test_nophy: type: unit - extra_args: CONF_FILE=prj_nophy.conf + extra_args: + - CONF_FILE=prj_nophy.conf + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_encrypt/testcase.yaml b/tests/bluetooth/controller/ctrl_encrypt/testcase.yaml index d5bb2cb8b110..86dd5bfe4d30 100644 --- a/tests/bluetooth/controller/ctrl_encrypt/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_encrypt/testcase.yaml @@ -6,3 +6,5 @@ common: tests: bluetooth.controller.ctrl_encrypt.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_feature_exchange/testcase.yaml b/tests/bluetooth/controller/ctrl_feature_exchange/testcase.yaml index 257542f36120..087e49575ff7 100644 --- a/tests/bluetooth/controller/ctrl_feature_exchange/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_feature_exchange/testcase.yaml @@ -6,3 +6,5 @@ common: tests: bluetooth.controller.ctrl_feature_exchange.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_hci/testcase.yaml b/tests/bluetooth/controller/ctrl_hci/testcase.yaml index d7f7ce7168d1..e0735bae6962 100644 --- a/tests/bluetooth/controller/ctrl_hci/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_hci/testcase.yaml @@ -6,3 +6,5 @@ common: tests: bluetooth.controller.ctrl_hci.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_invalid/testcase.yaml b/tests/bluetooth/controller/ctrl_invalid/testcase.yaml index 2d1741931e37..cee54e6b09ed 100644 --- a/tests/bluetooth/controller/ctrl_invalid/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_invalid/testcase.yaml @@ -6,3 +6,5 @@ common: tests: bluetooth.controller.ctrl_invalid.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_le_ping/testcase.yaml b/tests/bluetooth/controller/ctrl_le_ping/testcase.yaml index b6a77528f32d..54178905da17 100644 --- a/tests/bluetooth/controller/ctrl_le_ping/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_le_ping/testcase.yaml @@ -6,3 +6,5 @@ common: tests: bluetooth.controller.ctrl_le_ping.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_min_used_chans/testcase.yaml b/tests/bluetooth/controller/ctrl_min_used_chans/testcase.yaml index 0991b0cdd43c..a9445cbf8c4d 100644 --- a/tests/bluetooth/controller/ctrl_min_used_chans/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_min_used_chans/testcase.yaml @@ -6,3 +6,5 @@ common: tests: bluetooth.controller.ctrl_min_used_chans.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_phy_update/testcase.yaml b/tests/bluetooth/controller/ctrl_phy_update/testcase.yaml index 1d7da169f1d8..d5c49d587a8f 100644 --- a/tests/bluetooth/controller/ctrl_phy_update/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_phy_update/testcase.yaml @@ -6,6 +6,10 @@ common: tests: bluetooth.controller.ctrl_phy_update.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" bluetooth.controller.ctrl_phy_update.test_reduced_buf: type: unit - extra_args: CONF_FILE=prj_rx_cnt.conf + extra_args: + - CONF_FILE=prj_rx_cnt.conf + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_sca_update/testcase.yaml b/tests/bluetooth/controller/ctrl_sca_update/testcase.yaml index cbf63aa1b575..cbc3c3faf720 100644 --- a/tests/bluetooth/controller/ctrl_sca_update/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_sca_update/testcase.yaml @@ -6,3 +6,5 @@ common: tests: bluetooth.controller.ctrl_sca_update.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_sw_privacy/testcase.yaml b/tests/bluetooth/controller/ctrl_sw_privacy/testcase.yaml index 778606d69549..ac5dd6e957eb 100644 --- a/tests/bluetooth/controller/ctrl_sw_privacy/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_sw_privacy/testcase.yaml @@ -4,3 +4,5 @@ common: tests: bluetooth.ctrl_sw_privacy.test: platform_allow: nrf52_bsim + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_terminate/testcase.yaml b/tests/bluetooth/controller/ctrl_terminate/testcase.yaml index cbe639401ea3..6b1409e9653e 100644 --- a/tests/bluetooth/controller/ctrl_terminate/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_terminate/testcase.yaml @@ -6,3 +6,5 @@ common: tests: bluetooth.controller.ctrl_terminate.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_tx_buffer_alloc/testcase.yaml b/tests/bluetooth/controller/ctrl_tx_buffer_alloc/testcase.yaml index 614eb7fe94c0..363986bd3d35 100644 --- a/tests/bluetooth/controller/ctrl_tx_buffer_alloc/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_tx_buffer_alloc/testcase.yaml @@ -6,23 +6,35 @@ common: tests: bluetooth.controller.ctrl_tx_buffer_alloc.test_0_per_conn: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" bluetooth.controller.ctrl_tx_buffer_alloc.test_1_per_conn: type: unit - extra_args: CONF_FILE=prj_1.conf + extra_args: + - CONF_FILE=prj_1.conf + - SNIPPET="bt-ll-sw-split" bluetooth.controller.ctrl_tx_buffer_alloc.test_2_per_conn: type: unit - extra_args: CONF_FILE=prj_2.conf + extra_args: + - CONF_FILE=prj_2.conf + - SNIPPET="bt-ll-sw-split" bluetooth.controller.ctrl_tx_buffer_alloc.test_3_per_conn: type: unit - extra_args: CONF_FILE=prj_3.conf + extra_args: + - CONF_FILE=prj_3.conf + - SNIPPET="bt-ll-sw-split" bluetooth.controller.ctrl_tx_buffer_alloc.test_max_per_conn_alloc: type: unit - extra_args: CONF_FILE=prj_max.conf + extra_args: + - CONF_FILE=prj_max.conf + - SNIPPET="bt-ll-sw-split" bluetooth.controller.ctrl_tx_buffer_alloc.test_max_common_alloc: type: unit - extra_args: CONF_FILE=prj_max_common.conf + extra_args: + - CONF_FILE=prj_max_common.conf + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_tx_queue/testcase.yaml b/tests/bluetooth/controller/ctrl_tx_queue/testcase.yaml index 295ad891a630..282b620b317a 100644 --- a/tests/bluetooth/controller/ctrl_tx_queue/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_tx_queue/testcase.yaml @@ -5,3 +5,5 @@ common: tests: bluetooth.ctrl_tx_queue.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_unsupported/testcase.yaml b/tests/bluetooth/controller/ctrl_unsupported/testcase.yaml index 28aba1a752a8..48b18af93536 100644 --- a/tests/bluetooth/controller/ctrl_unsupported/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_unsupported/testcase.yaml @@ -6,7 +6,11 @@ common: tests: bluetooth.controller.ctrl_unsupported.default.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" bluetooth.controller.ctrl_unsupported.test: type: unit - extra_args: CONF_FILE=prj_unsupported.conf + extra_args: + - CONF_FILE=prj_unsupported.conf + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_user_ext/testcase.yaml b/tests/bluetooth/controller/ctrl_user_ext/testcase.yaml index af319a7a7191..be963df24a8a 100644 --- a/tests/bluetooth/controller/ctrl_user_ext/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_user_ext/testcase.yaml @@ -4,3 +4,5 @@ common: tests: bluetooth.ctrl_user_ext.test: platform_allow: nrf52_bsim + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_version/testcase.yaml b/tests/bluetooth/controller/ctrl_version/testcase.yaml index 6badcbc72547..5df86b9bca9f 100644 --- a/tests/bluetooth/controller/ctrl_version/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_version/testcase.yaml @@ -6,3 +6,5 @@ common: tests: bluetooth.controller.ctrl_version.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/df/connection_cte_req/testcase.yaml b/tests/bluetooth/df/connection_cte_req/testcase.yaml index 768aba4a51f5..fbfe4b0d9a1a 100644 --- a/tests/bluetooth/df/connection_cte_req/testcase.yaml +++ b/tests/bluetooth/df/connection_cte_req/testcase.yaml @@ -2,3 +2,5 @@ tests: bluetooth.df.conection_cte_req: platform_allow: nrf52_bsim tags: bluetooth + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/df/connection_cte_tx_params/testcase.yaml b/tests/bluetooth/df/connection_cte_tx_params/testcase.yaml index 38a23b0950e3..a9986c5b0e53 100644 --- a/tests/bluetooth/df/connection_cte_tx_params/testcase.yaml +++ b/tests/bluetooth/df/connection_cte_tx_params/testcase.yaml @@ -2,3 +2,5 @@ tests: bluetooth.df.conection_cte_tx_params: platform_allow: nrf52_bsim tags: bluetooth + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/df/connectionless_cte_chains/testcase.yaml b/tests/bluetooth/df/connectionless_cte_chains/testcase.yaml index 6aa5bb0f0c1c..844a7bbb524e 100644 --- a/tests/bluetooth/df/connectionless_cte_chains/testcase.yaml +++ b/tests/bluetooth/df/connectionless_cte_chains/testcase.yaml @@ -2,3 +2,5 @@ tests: bluetooth.df.connectionless_cte_chains: platform_allow: nrf52_bsim tags: bluetooth + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/df/connectionless_cte_rx/testcase.yaml b/tests/bluetooth/df/connectionless_cte_rx/testcase.yaml index f839b1910eb2..c8f08a908436 100644 --- a/tests/bluetooth/df/connectionless_cte_rx/testcase.yaml +++ b/tests/bluetooth/df/connectionless_cte_rx/testcase.yaml @@ -2,3 +2,5 @@ tests: bluetooth.df.connectionless_cte_rx: platform_allow: nrf52_bsim tags: bluetooth + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/df/connectionless_cte_tx/testcase.yaml b/tests/bluetooth/df/connectionless_cte_tx/testcase.yaml index 77d651d0cbc2..491cc0e7e599 100644 --- a/tests/bluetooth/df/connectionless_cte_tx/testcase.yaml +++ b/tests/bluetooth/df/connectionless_cte_tx/testcase.yaml @@ -2,3 +2,5 @@ tests: bluetooth.df.connectionless_cte_tx: platform_allow: nrf52_bsim tags: bluetooth + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/init/testcase.yaml b/tests/bluetooth/init/testcase.yaml index dd44257e0128..a5cc40cd39e7 100644 --- a/tests/bluetooth/init/testcase.yaml +++ b/tests/bluetooth/init/testcase.yaml @@ -74,7 +74,9 @@ tests: extra_args: CONF_FILE=prj_9.conf platform_allow: qemu_cortex_m3 bluetooth.init.test_ctlr: - extra_args: CONF_FILE=prj_ctlr.conf + extra_args: + - CONF_FILE=prj_ctlr.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -86,7 +88,9 @@ tests: - nrf51dk/nrf51822 - rv32m1_vega/openisa_rv32m1/ri5cy bluetooth.init.test_ctlr_4_0: - extra_args: CONF_FILE=prj_ctlr_4_0.conf + extra_args: + - CONF_FILE=prj_ctlr_4_0.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -95,7 +99,9 @@ tests: - nrf52dk/nrf52832 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_4_0_dbg: - extra_args: CONF_FILE=prj_ctlr_4_0_dbg.conf + extra_args: + - CONF_FILE=prj_ctlr_4_0_dbg.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -104,7 +110,9 @@ tests: - nrf52dk/nrf52832 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_tiny: - extra_args: CONF_FILE=prj_ctlr_tiny.conf + extra_args: + - CONF_FILE=prj_ctlr_tiny.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -116,6 +124,7 @@ tests: extra_args: - CONF_FILE=prj_ctlr_dbg.conf - DTC_OVERLAY_FILE=pa_lna.overlay + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -126,6 +135,7 @@ tests: extra_args: - CONF_FILE=prj_ctlr_5_x_dbg.conf - DTC_OVERLAY_FILE=pa_lna.overlay + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -137,6 +147,7 @@ tests: - CONF_FILE=prj_ctlr.conf - CONFIG_BT_CTLR_ADVANCED_FEATURES=y - CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER=y + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf5340dk/nrf5340/cpunet - nrf52840dk/nrf52840 @@ -146,13 +157,16 @@ tests: bluetooth.init.test_ctlr_ticker: extra_args: - CONF_FILE=prj_ctlr_ticker.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 integration_platforms: - nrf52dk/nrf52832 bluetooth.init.test_ctlr_broadcaster: - extra_args: CONF_FILE=prj_ctlr_broadcaster.conf + extra_args: + - CONF_FILE=prj_ctlr_broadcaster.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -161,7 +175,9 @@ tests: integration_platforms: - nrf52dk/nrf52832 bluetooth.init.test_ctlr_peripheral: - extra_args: CONF_FILE=prj_ctlr_peripheral.conf + extra_args: + - CONF_FILE=prj_ctlr_peripheral.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -170,7 +186,9 @@ tests: integration_platforms: - nrf52dk/nrf52832 bluetooth.init.test_ctlr_peripheral_priv: - extra_args: CONF_FILE=prj_ctlr_peripheral_priv.conf + extra_args: + - CONF_FILE=prj_ctlr_peripheral_priv.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -179,7 +197,9 @@ tests: integration_platforms: - nrf52840dk/nrf52840 bluetooth.init.test_ctlr_observer: - extra_args: CONF_FILE=prj_ctlr_observer.conf + extra_args: + - CONF_FILE=prj_ctlr_observer.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -188,7 +208,9 @@ tests: integration_platforms: - nrf52dk/nrf52832 bluetooth.init.test_ctlr_central: - extra_args: CONF_FILE=prj_ctlr_central.conf + extra_args: + - CONF_FILE=prj_ctlr_central.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -198,7 +220,9 @@ tests: - nrf52dk/nrf52832 - rv32m1_vega/openisa_rv32m1/ri5cy bluetooth.init.test_ctlr_central_priv: - extra_args: CONF_FILE=prj_ctlr_central_priv.conf + extra_args: + - CONF_FILE=prj_ctlr_central_priv.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -208,7 +232,9 @@ tests: - nrf52dk/nrf52832 - rv32m1_vega/openisa_rv32m1/ri5cy bluetooth.init.test_ctlr_broadcaster_ext: - extra_args: CONF_FILE=prj_ctlr_broadcaster_ext.conf + extra_args: + - CONF_FILE=prj_ctlr_broadcaster_ext.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -217,7 +243,9 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_peripheral_ext: - extra_args: CONF_FILE=prj_ctlr_peripheral_ext.conf + extra_args: + - CONF_FILE=prj_ctlr_peripheral_ext.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -226,7 +254,9 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_peripheral_ext_priv: - extra_args: CONF_FILE=prj_ctlr_peripheral_ext_priv.conf + extra_args: + - CONF_FILE=prj_ctlr_peripheral_ext_priv.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -235,7 +265,9 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_oberver_ext: - extra_args: CONF_FILE=prj_ctlr_observer_ext.conf + extra_args: + - CONF_FILE=prj_ctlr_observer_ext.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -244,7 +276,9 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_central_ext: - extra_args: CONF_FILE=prj_ctlr_central_ext.conf + extra_args: + - CONF_FILE=prj_ctlr_central_ext.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -253,7 +287,9 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_central_ext_priv: - extra_args: CONF_FILE=prj_ctlr_central_ext_priv.conf + extra_args: + - CONF_FILE=prj_ctlr_central_ext_priv.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -262,7 +298,9 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_per_adv: - extra_args: CONF_FILE=prj_ctlr_per_adv.conf + extra_args: + - CONF_FILE=prj_ctlr_per_adv.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -271,7 +309,9 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_per_adv_no_adi: - extra_args: CONF_FILE=prj_ctlr_per_adv_no_adi.conf + extra_args: + - CONF_FILE=prj_ctlr_per_adv_no_adi.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -280,7 +320,9 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_per_sync: - extra_args: CONF_FILE=prj_ctlr_per_sync.conf + extra_args: + - CONF_FILE=prj_ctlr_per_sync.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -289,7 +331,9 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_per_sync_no_adi: - extra_args: CONF_FILE=prj_ctlr_per_sync_no_adi.conf + extra_args: + - CONF_FILE=prj_ctlr_per_sync_no_adi.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -298,7 +342,9 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_per_sync_no_filter: - extra_args: CONF_FILE=prj_ctlr_per_sync_no_filter.conf + extra_args: + - CONF_FILE=prj_ctlr_per_sync_no_filter.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -307,7 +353,9 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_peripheral_iso: - extra_args: CONF_FILE=prj_ctlr_peripheral_iso.conf + extra_args: + - CONF_FILE=prj_ctlr_peripheral_iso.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -316,7 +364,9 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_central_iso: - extra_args: CONF_FILE=prj_ctlr_central_iso.conf + extra_args: + - CONF_FILE=prj_ctlr_central_iso.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -335,7 +385,9 @@ tests: - DTC_OVERLAY_FILE=h5.overlay platform_allow: qemu_cortex_m3 bluetooth.init.test_llcp: - extra_args: CONF_FILE=prj_llcp.conf + extra_args: + - CONF_FILE=prj_llcp.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -347,6 +399,7 @@ tests: extra_args: - CONF_FILE=prj_ctlr.conf - CONFIG_BT_RECV_WORKQ_BT=y + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 bluetooth.init.test_host_6_x: From 44394717ff162b2fe2f65ef763b3ba0b1b09f736 Mon Sep 17 00:00:00 2001 From: Georgios Vasilakis Date: Fri, 21 Jun 2024 13:25:22 +0200 Subject: [PATCH 1663/2141] [nrf noup] soc: nrf54l: Add custom section for KMU Add a custom section in the linker which should always be placed in the top of RAM. This will be used by the KMU to push keys into it. Since when you provision a key into the KMU you need to set specific a memory location for the PUSH operation we need to keep this memory location static across images/dfus. The linker script inclusion which places the KMU reserved buffer on the top of RAM doesn't work for non-XIP builds. The Zephyr linker script will firstly load the code for an non-XIP build in RAM and then include this KMU related linker script which results in an unpredictable placement of the KMU reserved area and a failed build. In order to support non-XIP builds the linker file is not included and the a DTS reserved-memory entry should be used. To limit the scope, the DTS reserved memory region is currently only supported for non-XIP builds. This is a noup since the KMU is not supported upstream. Ref: NCSDK-25121 Signed-off-by: Georgios Vasilakis (cherry picked from commit e9da911d1d201b953c920a536f1c1c6b0cda5327) --- soc/nordic/nrf54l/CMakeLists.txt | 9 +++++++++ soc/nordic/nrf54l/kmu_push_area_section.ld | 19 +++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 soc/nordic/nrf54l/kmu_push_area_section.ld diff --git a/soc/nordic/nrf54l/CMakeLists.txt b/soc/nordic/nrf54l/CMakeLists.txt index cebbda571b68..d986fe9c20d5 100644 --- a/soc/nordic/nrf54l/CMakeLists.txt +++ b/soc/nordic/nrf54l/CMakeLists.txt @@ -6,3 +6,12 @@ zephyr_library_sources( ../validate_rram_partitions.c ) zephyr_include_directories(.) + +# We need a buffer in memory in a static location which can be used by +# the KMU peripheral. The KMU has a static destination address, we chose +# this address to be 0x20000000, which is the first address in the SRAM. +if(NOT CONFIG_BUILD_WITH_TFM AND CONFIG_PSA_NEED_CRACEN_KMU_DRIVER AND CONFIG_XIP) +# Exclamation mark is printable character with the lowest number in ASCII table. +# We are sure that this file will be included first. +zephyr_linker_sources(RAM_SECTIONS SORT_KEY ! kmu_push_area_section.ld) +endif() diff --git a/soc/nordic/nrf54l/kmu_push_area_section.ld b/soc/nordic/nrf54l/kmu_push_area_section.ld new file mode 100644 index 000000000000..e8c8cd9f09ad --- /dev/null +++ b/soc/nordic/nrf54l/kmu_push_area_section.ld @@ -0,0 +1,19 @@ +# This section must be loaded first of all the +# custom sections because we want it to be placed +# at the top address of RAM. +SECTION_PROLOGUE(NRF_KMU_RESERVED_PUSH_SECTION,(NOLOAD) ,) +{ + __nrf_kmu_reserved_push_area = .; + *(.nrf_kmu_reserved_push_area) + __nrf_kmu_reserved_push_area_end = .; +} GROUP_NOLOAD_LINK_IN(RAMABLE_REGION, RAMABLE_REGION) + +# It doesn't seem to be possible to enforce placing a section +# at a specific address in memory using the Zephyr SECTION macros. +# So this assert is necessary to avoid accidentatly moving this +# section to a different address. +ASSERT(__nrf_kmu_reserved_push_area == RAM_ADDR, "Error: \ + The section NRF_KMU_RESERVED_PUSH_SECTION needs to be \ + placed on the top RAM address but it is not, please edit \ + your linker scripts to make sure that it is placed on \ + the to RAM address.") From 9fec410b2e42217813da8a4f79870ad6e20e57a3 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Thu, 12 Dec 2024 07:58:06 +0000 Subject: [PATCH 1664/2141] [nrf noup] samples/tests: Add TF-M sysbuild config files Fixes some issues with samples/tests by adding configuration files to satisfy TF-M requirements Signed-off-by: Jamie McCrae (cherry picked from commit 0d882bd5dfc71bf18fd548404dc30d6674308f09) --- samples/subsys/usb/dfu/sysbuild.conf | 1 + tests/drivers/flash/common/sysbuild.conf | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 samples/subsys/usb/dfu/sysbuild.conf delete mode 100644 tests/drivers/flash/common/sysbuild.conf diff --git a/samples/subsys/usb/dfu/sysbuild.conf b/samples/subsys/usb/dfu/sysbuild.conf new file mode 100644 index 000000000000..47f00ff3cff8 --- /dev/null +++ b/samples/subsys/usb/dfu/sysbuild.conf @@ -0,0 +1 @@ +SB_CONFIG_BOOTLOADER_MCUBOOT=y diff --git a/tests/drivers/flash/common/sysbuild.conf b/tests/drivers/flash/common/sysbuild.conf deleted file mode 100644 index 6408669a8474..000000000000 --- a/tests/drivers/flash/common/sysbuild.conf +++ /dev/null @@ -1 +0,0 @@ -SB_CONFIG_PARTITION_MANAGER=n From 9195b19d9233885bbaa9fb542d4de27517c62306 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Wed, 8 Jan 2025 10:48:30 +0100 Subject: [PATCH 1665/2141] [nrf noup] Revert "mbedtls: auto-select MBEDTLS_CIPHER_AES_ENABLED when built-in in PSA" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit ac6d8342728c8a63f9fea965ce41610618aeed5a. Temporarily revert an upstream change that leads to a Kconfig dependency loop with MBEDTLS_CIPHER_AES_ENABLED. This is supposed to be replaced with a better fix later. Signed-off-by: Andrzej Głąbek (cherry picked from commit a83567fd12f3f2f0e5dc1a4c6ed6d667e7154bb0) --- modules/mbedtls/Kconfig.mbedtls | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/mbedtls/Kconfig.mbedtls b/modules/mbedtls/Kconfig.mbedtls index b0077361908c..b4932b31635f 100644 --- a/modules/mbedtls/Kconfig.mbedtls +++ b/modules/mbedtls/Kconfig.mbedtls @@ -283,7 +283,6 @@ config MBEDTLS_SOME_CIPHER_ENABLED config MBEDTLS_CIPHER_AES_ENABLED bool "AES block cipher" - default y if PSA_WANT_KEY_TYPE_AES && MBEDTLS_PSA_CRYPTO_C if MBEDTLS_CIPHER_AES_ENABLED From 8c97493e725979a39138d9a13956ac2c8a5c04bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Fri, 24 Jan 2025 17:57:54 +0100 Subject: [PATCH 1666/2141] [nrf noup] tests: arm_irq_vector_table: Disable starting of SSF client MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This test cannot be executed with the SDFW Service Framework client started, so disable its initialization. Signed-off-by: Andrzej Głąbek (cherry picked from commit dbd39369412159c1a9655f17f3d8636ec3722abe) (cherry picked from commit 1449016262127173218fd276fab23c4b97800c7d) --- .../arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpuapp.conf | 1 + .../arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpurad.conf | 1 + 2 files changed, 2 insertions(+) create mode 100644 tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpuapp.conf create mode 100644 tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpurad.conf diff --git a/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpuapp.conf b/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpuapp.conf new file mode 100644 index 000000000000..a18a3b576e39 --- /dev/null +++ b/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpuapp.conf @@ -0,0 +1 @@ +CONFIG_SSF_CLIENT_SYS_INIT=n diff --git a/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpurad.conf b/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpurad.conf new file mode 100644 index 000000000000..a18a3b576e39 --- /dev/null +++ b/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpurad.conf @@ -0,0 +1 @@ +CONFIG_SSF_CLIENT_SYS_INIT=n From 3b4dafb8804dee63a4b668beade865d6003a2bf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Grochala?= Date: Fri, 31 Jan 2025 16:09:26 +0000 Subject: [PATCH 1667/2141] [nrf noup] bluetooth: Temporary Kconfig fix for BT RPC configuration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The BT_DRIVERS symbol default value 'y' used to depend on !BT_CTLR but now it is always on when BT is set. For BT_RPC the BT_DRIVERS symbol must not be enabled on the client side as no driver is used. The temporary solution is to set BT_DRIVERS to 'y' by default only when BT_HCI stack selection is enabled. It will be 'n' when BT_RPC_STACK is enabled. The fix should be fine as NCS uses either HCI or RPC stack. Signed-off-by: Michał Grochala (cherry picked from commit 8797d168475faaa8c96cab970881b8ee35dfa2c1) --- drivers/bluetooth/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/bluetooth/Kconfig b/drivers/bluetooth/Kconfig index a1680af6583d..e64a33f663ce 100644 --- a/drivers/bluetooth/Kconfig +++ b/drivers/bluetooth/Kconfig @@ -12,7 +12,7 @@ menuconfig BT_DRIVERS bool "Bluetooth drivers" default y - depends on BT + depends on BT && BT_HCI if BT_DRIVERS From 754de059b64b9d52628b8669e86c7acc17a96aa0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Audun=20Kvamtr=C3=B8?= Date: Tue, 4 Feb 2025 14:55:58 +0100 Subject: [PATCH 1668/2141] [nrf noup] ble: Adding missing AES config for BT_CRYPTO MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Adding imply MBEDTLS_CIPHER_AES_ENABLED if not TF-M build in BT_CRYPTO -Needed to set a specific symbol for MBEDTLS + MBEDTLS_BUILTIN to work on network core build. -This [nrf noup] can be removed once PSA crypto is fully supported in network core, or PSA crypto is not compiled in at all and is provided as a RPC-mechanism via the app-core Signed-off-by: Frank Audun Kvamtrø (cherry picked from commit b3b520b40258b238a58133f568353a852ca8eb87) --- subsys/bluetooth/crypto/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/subsys/bluetooth/crypto/Kconfig b/subsys/bluetooth/crypto/Kconfig index 0856daf9d9a5..0f46a0f59a0f 100644 --- a/subsys/bluetooth/crypto/Kconfig +++ b/subsys/bluetooth/crypto/Kconfig @@ -8,6 +8,7 @@ config BT_CRYPTO select PSA_WANT_KEY_TYPE_AES select PSA_WANT_ALG_CMAC select PSA_WANT_ALG_ECB_NO_PADDING + imply MBEDTLS_CIPHER_AES_ENABLED if !BUILD_WITH_TFM imply MBEDTLS_AES_ROM_TABLES if MBEDTLS_PSA_CRYPTO_C help This option enables the Bluetooth Cryptographic Toolbox. From 6e1d27409e8f5e84021bf339da95672f12000099 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Ku=C5=BAnia?= Date: Tue, 18 Feb 2025 12:17:47 +0100 Subject: [PATCH 1669/2141] [nrf noup] entropy: Add fake entropy nRF PRNG driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This adds temporary entropy driver simulation for nRF54l09 device since final entropy source is not available yet. TODO: Remove this commit when proper solution will be available. Signed-off-by: Rafał Kuźnia (cherry picked from commit 3d02dc6fb7c7a29dde82faf53d17dd1ec25e35de) (cherry picked from commit a0d10324b63734e313e07415908fcca08936e5fb) --- dts/arm/nordic/nrf54l09_enga_cpuapp.dtsi | 142 +++++++++++++++++++++++ 1 file changed, 142 insertions(+) create mode 100644 dts/arm/nordic/nrf54l09_enga_cpuapp.dtsi diff --git a/dts/arm/nordic/nrf54l09_enga_cpuapp.dtsi b/dts/arm/nordic/nrf54l09_enga_cpuapp.dtsi new file mode 100644 index 000000000000..1dfc5ce133c0 --- /dev/null +++ b/dts/arm/nordic/nrf54l09_enga_cpuapp.dtsi @@ -0,0 +1,142 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +cpu: &cpuapp {}; +systick: &cpuapp_systick {}; +nvic: &cpuapp_nvic {}; + +/delete-node/ &cpuflpr; +/delete-node/ &cpuflpr_rram; +/delete-node/ &cpuflpr_sram; +/delete-node/ &cpuflpr_clic; + +/ { + chosen { + zephyr,bt-hci = &bt_hci_controller; + zephyr,entropy = &prng; + }; + + soc { + compatible = "simple-bus"; + interrupt-parent = <&cpuapp_nvic>; + ranges; + }; + + psa_rng: psa-rng { + compatible = "zephyr,psa-crypto-rng"; + status = "disabled"; + }; + + prng: prng { + compatible = "nordic,entropy-prng"; + status = "okay"; + }; +}; + +&bt_hci_controller { + status = "okay"; +}; + +&cpuflpr_vpr { + cpuapp_vevif_rx: mailbox@1 { + compatible = "nordic,nrf-vevif-event-rx"; + reg = <0x1 0x1000>; + status = "disabled"; + interrupts = <76 NRF_DEFAULT_IRQ_PRIORITY>; + #mbox-cells = <1>; + nordic,events = <1>; + nordic,events-mask = <0x00100000>; + }; + + cpuapp_vevif_tx: mailbox@0 { + compatible = "nordic,nrf-vevif-task-tx"; + reg = <0x0 0x1000>; + #mbox-cells = <1>; + nordic,tasks = <7>; + nordic,tasks-mask = <0x007f0000>; + status = "disabled"; + }; +}; + +&cpuapp_ppb { + compatible = "simple-bus"; + ranges; +}; + +&grtc { +#ifdef USE_NON_SECURE_ADDRESS_MAP + interrupts = <227 NRF_DEFAULT_IRQ_PRIORITY>, +#else + interrupts = <228 NRF_DEFAULT_IRQ_PRIORITY>, +#endif + <229 NRF_DEFAULT_IRQ_PRIORITY>; /* reserved for Zero Latency IRQs */ +}; + +&gpiote20 { +#ifdef USE_NON_SECURE_ADDRESS_MAP + interrupts = <218 NRF_DEFAULT_IRQ_PRIORITY>; +#else + interrupts = <219 NRF_DEFAULT_IRQ_PRIORITY>; +#endif +}; + +&gpiote30 { +#ifdef USE_NON_SECURE_ADDRESS_MAP + interrupts = <268 NRF_DEFAULT_IRQ_PRIORITY>; +#else + interrupts = <269 NRF_DEFAULT_IRQ_PRIORITY>; +#endif +}; + +&dppic00 { + status = "okay"; +}; + +&dppic10 { + status = "okay"; +}; + +&dppic20 { + status = "okay"; +}; + +&dppic30 { + status = "okay"; +}; + +&ppib00 { + status = "okay"; +}; + +&ppib01 { + status = "okay"; +}; + +&ppib10 { + status = "okay"; +}; + +&ppib11 { + status = "okay"; +}; + +&ppib20 { + status = "okay"; +}; + +&ppib21 { + status = "okay"; +}; + +&ppib22 { + status = "okay"; +}; + +&ppib30 { + status = "okay"; +}; From 6c0719cb617317e293bd9521d963d61a2718136b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Ku=C5=BAnia?= Date: Wed, 19 Feb 2025 15:47:07 +0100 Subject: [PATCH 1670/2141] [nrf noup] dts: Select SoftDevice Controller on nRF54L09 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The SDC HCI controller is defined as a device tree node. A node representing the SDC controller is added and selected as the default over the open source link layer. This is consistent with other SoCs. Signed-off-by: Rafał Kuźnia (cherry picked from commit da86248f40248d863adfed61bb35019e61a5dadf) (cherry picked from commit e40f5313c37dc245a8812643924cdba02afe1252) --- .../nrf54l09pdk/nrf54l09_cpuapp_common.dtsi | 128 ++++ dts/arm/nordic/nrf54l09_enga_cpuapp.dtsi | 4 +- dts/vendor/nordic/nrf54l09.dtsi | 628 ++++++++++++++++++ 3 files changed, 758 insertions(+), 2 deletions(-) create mode 100644 boards/nordic/nrf54l09pdk/nrf54l09_cpuapp_common.dtsi create mode 100644 dts/vendor/nordic/nrf54l09.dtsi diff --git a/boards/nordic/nrf54l09pdk/nrf54l09_cpuapp_common.dtsi b/boards/nordic/nrf54l09pdk/nrf54l09_cpuapp_common.dtsi new file mode 100644 index 000000000000..e1347c35948c --- /dev/null +++ b/boards/nordic/nrf54l09pdk/nrf54l09_cpuapp_common.dtsi @@ -0,0 +1,128 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* This file is common to the secure and non-secure domain */ + +#include +#include "nrf54l09pdk_nrf54l09-common.dtsi" + +/ { + chosen { + zephyr,console = &uart20; + zephyr,shell-uart = &uart20; + zephyr,uart-mcumgr = &uart20; + zephyr,bt-mon-uart = &uart20; + zephyr,bt-c2h-uart = &uart20; + zephyr,flash-controller = &rram_controller; + zephyr,flash = &cpuapp_rram; + zephyr,bt-hci = &bt_hci_sdc; + zephyr,ieee802154 = &ieee802154; + }; +}; + +&cpuapp_sram { + status = "okay"; +}; + +&hfpll { + /* For now use 64 MHz clock for CPU and fast peripherals. */ + clock-frequency = ; +}; + +&lfxo { + load-capacitors = "internal"; + load-capacitance-femtofarad = <15500>; +}; + +&hfxo { + load-capacitors = "internal"; + load-capacitance-femtofarad = <15000>; +}; + +&grtc { + owned-channels = <0 1 2 3 4 5 6 7 8 9 10 11>; + /* Channels 7-11 reserved for Zero Latency IRQs, 3-4 for FLPR */ + child-owned-channels = <3 4 7 8 9 10 11>; + status = "okay"; +}; + +&cpuapp_rram { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x0 DT_SIZE_K(64)>; + }; + + slot0_partition: partition@10000 { + label = "image-0"; + reg = <0x10000 DT_SIZE_K(212)>; + }; + + slot0_ns_partition: partition@45000 { + label = "image-0-nonsecure"; + reg = <0x45000 DT_SIZE_K(212)>; + }; + + slot1_partition: partition@7a000 { + label = "image-1"; + reg = <0x7a000 DT_SIZE_K(212)>; + }; + + slot1_ns_partition: partition@af000 { + label = "image-1-nonsecure"; + reg = <0xaf000 DT_SIZE_K(212)>; + }; + + storage_partition: partition@e4000 { + label = "storage"; + reg = <0xe4000 DT_SIZE_K(36)>; + }; + }; +}; + +&uart20 { + status = "okay"; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + +&gpiote20 { + status = "okay"; +}; + +&gpiote30 { + status = "okay"; +}; + +&radio { + status = "okay"; +}; + +&temp { + status = "okay"; +}; + +&clock { + status = "okay"; +}; + +&bt_hci_sdc { + status = "okay"; +}; + +&ieee802154 { + status = "okay"; +}; diff --git a/dts/arm/nordic/nrf54l09_enga_cpuapp.dtsi b/dts/arm/nordic/nrf54l09_enga_cpuapp.dtsi index 1dfc5ce133c0..6c7f34d3b21e 100644 --- a/dts/arm/nordic/nrf54l09_enga_cpuapp.dtsi +++ b/dts/arm/nordic/nrf54l09_enga_cpuapp.dtsi @@ -17,7 +17,7 @@ nvic: &cpuapp_nvic {}; / { chosen { - zephyr,bt-hci = &bt_hci_controller; + zephyr,bt-hci = &bt_hci_sdc; zephyr,entropy = &prng; }; @@ -38,7 +38,7 @@ nvic: &cpuapp_nvic {}; }; }; -&bt_hci_controller { +&bt_hci_sdc { status = "okay"; }; diff --git a/dts/vendor/nordic/nrf54l09.dtsi b/dts/vendor/nordic/nrf54l09.dtsi new file mode 100644 index 000000000000..90ecc49b877c --- /dev/null +++ b/dts/vendor/nordic/nrf54l09.dtsi @@ -0,0 +1,628 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include + +/delete-node/ &sw_pwm; + +/* Domain IDs. Can be used to specify channel links in IPCT nodes. */ +#define NRF_DOMAIN_ID_APPLICATION 0 +#define NRF_DOMAIN_ID_FLPR 1 + +/ { + #address-cells = <1>; + #size-cells = <1>; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpuapp: cpu@0 { + compatible = "arm,cortex-m33f"; + reg = <0>; + device_type = "cpu"; + clocks = <&hfpll>; + #address-cells = <1>; + #size-cells = <1>; + + itm: itm@e0000000 { + compatible = "arm,armv8m-itm"; + reg = <0xe0000000 0x1000>; + swo-ref-frequency = ; + }; + }; + + cpuflpr: cpu@1 { + compatible = "nordic,vpr"; + reg = <1>; + device_type = "cpu"; + clock-frequency = ; + riscv,isa = "rv32emc"; + nordic,bus-width = <32>; + }; + }; + + clocks { + pclk: pclk { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = ; + }; + + lfxo: lfxo { + compatible = "nordic,nrf54l-lfxo"; + #clock-cells = <0>; + clock-frequency = <32768>; + }; + + hfxo: hfxo { + compatible = "nordic,nrf54l-hfxo"; + #clock-cells = <0>; + clock-frequency = ; + startup-time-us = <1650>; + }; + + hfpll: hfpll { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = ; + }; + }; + + soc { + #address-cells = <1>; + #size-cells = <1>; + + #ifdef USE_NON_SECURE_ADDRESS_MAP + /* intentionally empty because UICR is hardware fixed to Secure */ + #else + uicr: uicr@ffd000 { + compatible = "nordic,nrf-uicr"; + reg = <0xffd000 0x1000>; + }; + #endif + ficr: ficr@ffc000 { + compatible = "nordic,nrf-ficr"; + reg = <0xffc000 0x1000>; + #nordic,ficr-cells = <1>; + }; + + cpuapp_sram: memory@20000000 { + reg = <0x20000000 DT_SIZE_K(143)>; + ranges = <0x0 0x20000000 DT_SIZE_K(143)>; + compatible = "mmio-sram"; + #address-cells = <1>; + #size-cells = <1>; + }; + + cpuflpr_sram: memory@20023c00 { + compatible = "mmio-sram"; + reg = <0x20023c00 DT_SIZE_K(48)>; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x20023c00 DT_SIZE_K(48)>; + }; + + #ifdef USE_NON_SECURE_ADDRESS_MAP + global_peripherals: peripheral@40000000 { + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x40000000 0x10000000>; + #else + global_peripherals: peripheral@50000000 { + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x50000000 0x10000000>; + #endif + + dppic00: dppic@42000 { + compatible = "nordic,nrf-dppic"; + reg = <0x42000 0x808>; + status = "disabled"; + }; + + ppib00: ppib@44000 { + compatible = "nordic,nrf-ppib"; + reg = <0x44000 0x1000>; + status = "disabled"; + }; + + ppib01: ppib@45000 { + compatible = "nordic,nrf-ppib"; + reg = <0x45000 0x1000>; + status = "disabled"; + }; + + cpuflpr_vpr: vpr@4c000 { + compatible = "nordic,nrf-vpr-coprocessor"; + reg = <0x4c000 0x1000>; + ranges = <0x0 0x4c000 0x1000>; + #address-cells = <1>; + #size-cells = <1>; + status = "disabled"; + enable-secure; + + cpuflpr_clic: interrupt-controller@f0000000 { + compatible = "nordic,nrf-clic"; + reg = <0xf0000000 0x1780>; + interrupt-controller; + #interrupt-cells = <2>; + #address-cells = <1>; + status = "disabled"; + }; + }; + + timer00: timer@55000 { + compatible = "nordic,nrf-timer"; + status = "disabled"; + reg = <0x55000 0x1000>; + cc-num = <6>; + max-bit-width = <32>; + interrupts = <85 NRF_DEFAULT_IRQ_PRIORITY>; + clocks = <&hfpll>; + prescaler = <0>; + }; + + dppic10: dppic@82000 { + compatible = "nordic,nrf-dppic"; + reg = <0x82000 0x808>; + status = "disabled"; + }; + + ppib10: ppib@83000 { + compatible = "nordic,nrf-ppib"; + reg = <0x83000 0x1000>; + status = "disabled"; + }; + + ppib11: ppib@84000 { + compatible = "nordic,nrf-ppib"; + reg = <0x84000 0x1000>; + status = "disabled"; + }; + + timer10: timer@85000 { + compatible = "nordic,nrf-timer"; + status = "disabled"; + reg = <0x85000 0x1000>; + cc-num = <8>; + max-bit-width = <32>; + interrupts = <133 NRF_DEFAULT_IRQ_PRIORITY>; + clocks = <&hfxo>; + prescaler = <0>; + }; + + egu10: egu@87000 { + compatible = "nordic,nrf-egu"; + reg = <0x87000 0x1000>; + interrupts = <135 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + + radio: radio@8a000 { + compatible = "nordic,nrf-radio"; + reg = <0x8a000 0x1000>; + interrupts = <138 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + dfe-supported; + ieee802154-supported; + ble-2mbps-supported; + ble-coded-phy-supported; + cs-supported; + + ieee802154: ieee802154 { + compatible = "nordic,nrf-ieee802154"; + status = "disabled"; + }; + + bt_hci_sdc: bt_hci_sdc { + compatible = "nordic,bt-hci-sdc"; + status = "disabled"; + }; + + bt_hci_controller: bt_hci_controller { + compatible = "zephyr,bt-hci-ll-sw-split"; + status = "disabled"; + }; + }; + + dppic20: dppic@c2000 { + compatible = "nordic,nrf-dppic"; + reg = <0xc2000 0x808>; + status = "disabled"; + }; + + ppib20: ppib@c3000 { + compatible = "nordic,nrf-ppib"; + reg = <0xc3000 0x1000>; + status = "disabled"; + }; + + ppib21: ppib@c4000 { + compatible = "nordic,nrf-ppib"; + reg = <0xc4000 0x1000>; + status = "disabled"; + }; + + ppib22: ppib@c5000 { + compatible = "nordic,nrf-ppib"; + reg = <0xc5000 0x1000>; + status = "disabled"; + }; + + i2c20: i2c@c6000 { + compatible = "nordic,nrf-twim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xc6000 0x1000>; + interrupts = <198 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <16>; + status = "disabled"; + zephyr,pm-device-runtime-auto; + }; + + spi20: spi@c6000 { + /* + * This spi node can be either SPIM or SPIS, + * for the user to pick: + * compatible = "nordic,nrf-spim" or + * "nordic,nrf-spis". + */ + compatible = "nordic,nrf-spim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xc6000 0x1000>; + interrupts = <198 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + easydma-maxcnt-bits = <16>; + rx-delay-supported; + rx-delay = <1>; + status = "disabled"; + }; + + uart20: uart@c6000 { + compatible = "nordic,nrf-uarte"; + reg = <0xc6000 0x1000>; + interrupts = <198 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + endtx-stoptx-supported; + frame-timeout-supported; + }; + + i2c21: i2c@c7000 { + compatible = "nordic,nrf-twim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xc7000 0x1000>; + interrupts = <199 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <16>; + status = "disabled"; + zephyr,pm-device-runtime-auto; + }; + + spi21: spi@c7000 { + /* + * This spi node can be either SPIM or SPIS, + * for the user to pick: + * compatible = "nordic,nrf-spim" or + * "nordic,nrf-spis". + */ + compatible = "nordic,nrf-spim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xc7000 0x1000>; + interrupts = <199 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + easydma-maxcnt-bits = <16>; + rx-delay-supported; + rx-delay = <1>; + status = "disabled"; + }; + + uart21: uart@c7000 { + compatible = "nordic,nrf-uarte"; + reg = <0xc7000 0x1000>; + interrupts = <199 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + endtx-stoptx-supported; + frame-timeout-supported; + }; + + egu20: egu@c9000 { + compatible = "nordic,nrf-egu"; + reg = <0xc9000 0x1000>; + interrupts = <201 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + + timer20: timer@ca000 { + compatible = "nordic,nrf-timer"; + status = "disabled"; + reg = <0xca000 0x1000>; + cc-num = <6>; + max-bit-width = <32>; + interrupts = <202 NRF_DEFAULT_IRQ_PRIORITY>; + prescaler = <0>; + }; + + timer21: timer@cb000 { + compatible = "nordic,nrf-timer"; + status = "disabled"; + reg = <0xcb000 0x1000>; + cc-num = <6>; + max-bit-width = <32>; + interrupts = <203 NRF_DEFAULT_IRQ_PRIORITY>; + prescaler = <0>; + }; + + timer22: timer@cc000 { + compatible = "nordic,nrf-timer"; + status = "disabled"; + reg = <0xcc000 0x1000>; + cc-num = <6>; + max-bit-width = <32>; + interrupts = <204 NRF_DEFAULT_IRQ_PRIORITY>; + prescaler = <0>; + }; + + timer23: timer@cd000 { + compatible = "nordic,nrf-timer"; + status = "disabled"; + reg = <0xcd000 0x1000>; + cc-num = <6>; + max-bit-width = <32>; + interrupts = <205 NRF_DEFAULT_IRQ_PRIORITY>; + prescaler = <0>; + }; + + timer24: timer@ce000 { + compatible = "nordic,nrf-timer"; + status = "disabled"; + reg = <0xce000 0x1000>; + cc-num = <6>; + max-bit-width = <32>; + interrupts = <206 NRF_DEFAULT_IRQ_PRIORITY>; + prescaler = <0>; + }; + + adc: adc@d5000 { + compatible = "nordic,nrf-saadc"; + reg = <0xd5000 0x1000>; + interrupts = <213 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + #io-channel-cells = <1>; + zephyr,pm-device-runtime-auto; + }; + + temp: temp@d7000 { + compatible = "nordic,nrf-temp"; + reg = <0xd7000 0x1000>; + interrupts = <215 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + + gpio1: gpio@d8200 { + compatible = "nordic,nrf-gpio"; + gpio-controller; + reg = <0xd8200 0x300>; + #gpio-cells = <2>; + ngpios = <16>; + status = "disabled"; + port = <1>; + gpiote-instance = <&gpiote20>; + }; + + gpiote20: gpiote@da000 { + compatible = "nordic,nrf-gpiote"; + reg = <0xda000 0x1000>; + status = "disabled"; + instance = <20>; + }; + + grtc: grtc@e2000 { + compatible = "nordic,nrf-grtc"; + reg = <0xe2000 0x1000>; + cc-num = <12>; + clocks = <&lfxo>, <&pclk>; + clock-names = "lfclock", "hfclock"; + status = "disabled"; + }; + + dppic30: dppic@102000 { + compatible = "nordic,nrf-dppic"; + reg = <0x102000 0x808>; + status = "disabled"; + }; + + ppib30: ppib@103000 { + compatible = "nordic,nrf-ppib"; + reg = <0x103000 0x1000>; + status = "disabled"; + }; + + i2c30: i2c@104000 { + compatible = "nordic,nrf-twim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x104000 0x1000>; + interrupts = <260 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <16>; + status = "disabled"; + zephyr,pm-device-runtime-auto; + }; + + spi30: spi@104000 { + /* + * This spi node can be either SPIM or SPIS, + * for the user to pick: + * compatible = "nordic,nrf-spim" or + * "nordic,nrf-spis". + */ + compatible = "nordic,nrf-spim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x104000 0x1000>; + interrupts = <260 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + easydma-maxcnt-bits = <16>; + rx-delay-supported; + rx-delay = <1>; + status = "disabled"; + }; + + uart30: uart@104000 { + compatible = "nordic,nrf-uarte"; + reg = <0x104000 0x1000>; + interrupts = <260 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + endtx-stoptx-supported; + frame-timeout-supported; + }; + + clock: clock@10e000 { + compatible = "nordic,nrf-clock"; + reg = <0x10e000 0x1000>; + interrupts = <270 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + + power: power@10e000 { + compatible = "nordic,nrf-power"; + reg = <0x10e000 0x1000>; + ranges = <0x0 0x10e000 0x1000>; + interrupts = <270 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + #address-cells = <1>; + #size-cells = <1>; + + gpregret1: gpregret1@51c { + #address-cells = <1>; + #size-cells = <1>; + compatible = "nordic,nrf-gpregret"; + reg = <0x51c 0x1>; + status = "disabled"; + }; + + gpregret2: gpregret2@520 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "nordic,nrf-gpregret"; + reg = <0x520 0x1>; + status = "disabled"; + }; + }; + + comp: comparator@106000 { + /* + * Use compatible "nordic,nrf-comp" to configure as COMP + * Use compatible "nordic,nrf-lpcomp" to configure as LPCOMP + */ + compatible = "nordic,nrf-comp"; + reg = <0x106000 0x1000>; + status = "disabled"; + interrupts = <262 NRF_DEFAULT_IRQ_PRIORITY>; + }; + + #ifdef USE_NON_SECURE_ADDRESS_MAP + /* intentionally empty because WDT30 is hardware fixed to Secure */ + #else + wdt30: watchdog@108000 { + compatible = "nordic,nrf-wdt"; + reg = <0x108000 0x620>; + interrupts = <264 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + #endif + + wdt31: watchdog@109000 { + compatible = "nordic,nrf-wdt"; + reg = <0x109000 0x620>; + interrupts = <265 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + + gpio0: gpio@10a000 { + compatible = "nordic,nrf-gpio"; + gpio-controller; + reg = <0x10a000 0x300>; + #gpio-cells = <2>; + ngpios = <5>; + status = "disabled"; + port = <0>; + gpiote-instance = <&gpiote30>; + }; + + gpiote30: gpiote@10c000 { + compatible = "nordic,nrf-gpiote"; + reg = <0x10c000 0x1000>; + status = "disabled"; + instance = <30>; + }; + + regulators: regulator@120000 { + compatible = "nordic,nrf54l-regulators"; + reg = <0x120000 0x1000>; + status = "disabled"; + #address-cells = <1>; + #size-cells = <1>; + + vregmain: regulator@120600 { + compatible = "nordic,nrf5x-regulator"; + reg = <0x120600 0x1>; + status = "disabled"; + regulator-name = "VREGMAIN"; + regulator-initial-mode = ; + }; + }; + }; + + rram_controller: rram-controller@5004e000 { + compatible = "nordic,rram-controller"; + reg = <0x5004e000 0x1000>; + #address-cells = <1>; + #size-cells = <1>; + interrupts = <75 NRF_DEFAULT_IRQ_PRIORITY>; + + /* 952 + 60 = 1012KB */ + cpuapp_rram: rram@0 { + compatible = "soc-nv-flash"; + erase-block-size = <4096>; + write-block-size = <16>; + reg = <0x0 DT_SIZE_K(952)>; + }; + + cpuflpr_rram: rram@ee000 { + compatible = "soc-nv-flash"; + reg = <0xee000 DT_SIZE_K(60)>; + erase-block-size = <4096>; + write-block-size = <16>; + }; + }; + + cpuapp_ppb: cpuapp-ppb-bus { + #address-cells = <1>; + #size-cells = <1>; + + cpuapp_nvic: interrupt-controller@e000e100 { + #address-cells = <1>; + compatible = "arm,v8m-nvic"; + reg = <0xe000e100 0xc00>; + arm,num-irq-priority-bits = <3>; + interrupt-controller; + #interrupt-cells = <2>; + }; + + cpuapp_systick: timer@e000e010 { + compatible = "arm,armv8m-systick"; + reg = <0xe000e010 0x10>; + status = "disabled"; + }; + }; + }; +}; From ab1ca10757dfb90a6511123b7cc6b9f82b42505b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Ku=C5=BAnia?= Date: Tue, 22 Oct 2024 08:55:47 +0200 Subject: [PATCH 1671/2141] [nrf noup] modules: hal_nordic: adjust nrfx reservations to NCS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added ncs-specific modules to nrfx_config_reserved_resources. The modules are: - mpsl - nrfe Signed-off-by: Rafał Kuźnia Signed-off-by: Nikodem Kastelik Co-authored-by: Krzysztof Chruściński Signed-off-by: Eivind Jølsgard Signed-off-by: Aleksandar Stanoev Signed-off-by: Piotr Pryga (cherry picked from commit 609c11851694ecaee87cda239066273e2410b8e3) --- modules/hal_nordic/nrfx/Kconfig | 2 +- .../nrfx/nrfx_config_reserved_resources_ncs.h | 948 ++++++++++++++++++ 2 files changed, 949 insertions(+), 1 deletion(-) create mode 100644 modules/hal_nordic/nrfx/nrfx_config_reserved_resources_ncs.h diff --git a/modules/hal_nordic/nrfx/Kconfig b/modules/hal_nordic/nrfx/Kconfig index 0b1882ba7a65..523931be649d 100644 --- a/modules/hal_nordic/nrfx/Kconfig +++ b/modules/hal_nordic/nrfx/Kconfig @@ -1307,6 +1307,6 @@ endmenu config NRFX_RESERVED_RESOURCES_HEADER string - default "nrfx_reserved_resources.h" + default "nrfx_config_reserved_resources_ncs.h" endmenu # "nrfx drivers" diff --git a/modules/hal_nordic/nrfx/nrfx_config_reserved_resources_ncs.h b/modules/hal_nordic/nrfx/nrfx_config_reserved_resources_ncs.h new file mode 100644 index 000000000000..ec8a9acaf7b5 --- /dev/null +++ b/modules/hal_nordic/nrfx/nrfx_config_reserved_resources_ncs.h @@ -0,0 +1,948 @@ +/* + * Copyright (c) 2024, Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef NRFX_CONFIG_RESERVED_RESOURCES_H__ +#define NRFX_CONFIG_RESERVED_RESOURCES_H__ + +/** @brief Bitmask that defines GPIOTE130 channels reserved for use outside + * of the nrfx library. + */ +#define NRFX_GPIOTE130_CHANNELS_USED \ + (~NRFX_CONFIG_MASK_DT(DT_NODELABEL(gpiote130), owned_channels) | \ + NRFX_CONFIG_MASK_DT(DT_NODELABEL(gpiote130), child_owned_channels)) + +/** @brief Bitmask that defines GPIOTE131 channels reserved for use outside + * of the nrfx library. + */ +#define NRFX_GPIOTE131_CHANNELS_USED \ + (~NRFX_CONFIG_MASK_DT(DT_NODELABEL(gpiote131), owned_channels) | \ + NRFX_CONFIG_MASK_DT(DT_NODELABEL(gpiote131), child_owned_channels)) + +/** @brief Bitmask that defines EGU instances that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_EGUS_USED 0 + +/** @brief Bitmask that defines TIMER instances that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_TIMERS_USED 0 + +/* If the GRTC system timer driver is to be used, prepare definitions required + * by the nrfx_grtc driver (NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK and + * NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS) based on information from devicetree. + */ +#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_grtc) +#define NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK \ + (NRFX_CONFIG_MASK_DT(DT_INST(0, nordic_nrf_grtc), owned_channels) & \ + ~NRFX_CONFIG_MASK_DT(DT_INST(0, nordic_nrf_grtc), child_owned_channels)) +#define NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS \ + (DT_PROP_LEN_OR(DT_INST(0, nordic_nrf_grtc), owned_channels, 0) - \ + DT_PROP_LEN_OR(DT_INST(0, nordic_nrf_grtc), child_owned_channels, 0)) +#endif /* DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_grtc) */ + +/* + * The enabled Bluetooth controller subsystem is responsible for providing + * definitions of the BT_CTLR_USED_* symbols used below in a file named + * bt_ctlr_used_resources.h and for adding its location to global include + * paths so that the file can be included here for all Zephyr libraries that + * are to be built. + */ +#if defined(CONFIG_BT_LL_SW_SPLIT) +#include +#if defined(CONFIG_SOC_SERIES_NRF51X) || defined(CONFIG_SOC_COMPATIBLE_NRF52X) +#define NRFX_PPI_CHANNELS_USED_BY_BT_CTLR BT_CTLR_USED_PPI_CHANNELS +#define NRFX_PPI_GROUPS_USED_BY_BT_CTLR BT_CTLR_USED_PPI_GROUPS +#elif defined(CONFIG_SOC_COMPATIBLE_NRF53X) +#define NRFX_DPPI0_CHANNELS_USED_BY_BT_CTLR BT_CTLR_USED_PPI_CHANNELS +#define NRFX_DPPI0_GROUPS_USED_BY_BT_CTLR BT_CTLR_USED_PPI_GROUPS +#elif defined(CONFIG_SOC_COMPATIBLE_NRF54LX) +#define NRFX_DPPI10_CHANNELS_USED_BY_BT_CTLR BT_CTLR_USED_PPI_CHANNELS +#define NRFX_DPPI10_GROUPS_USED_BY_BT_CTLR BT_CTLR_USED_PPI_GROUPS +#endif +#endif /* defined(CONFIG_BT_LL_SW_SPLIT) */ + +#if defined(CONFIG_BT_LL_SOFTDEVICE) +/* Define auxiliary symbols needed for SDC device dispatch. */ +#if defined(CONFIG_SOC_COMPATIBLE_NRF52X) +#define NRF52_SERIES +#elif defined(CONFIG_SOC_COMPATIBLE_NRF53X) +#define NRF53_SERIES +#elif defined(CONFIG_SOC_COMPATIBLE_NRF54LX) +#define NRF54L_SERIES +#elif defined(CONFIG_SOC_SERIES_NRF71X) +#define NRF71_SERIES +#elif defined(CONFIG_SOC_SERIES_NRF54HX) +#define NRF54H_SERIES +#endif +#include +#if defined(CONFIG_SOC_COMPATIBLE_NRF52X) +#define NRFX_PPI_CHANNELS_USED_BY_BT_CTLR SDC_PPI_CHANNELS_USED_MASK +#elif defined(CONFIG_SOC_COMPATIBLE_NRF53X) +#define NRFX_DPPI0_CHANNELS_USED_BY_BT_CTLR SDC_DPPI_CHANNELS_USED_MASK +#elif defined(CONFIG_SOC_COMPATIBLE_NRF54LX) || defined(CONFIG_SOC_SERIES_NRF71X) +#define NRFX_DPPI10_CHANNELS_USED_BY_BT_CTLR SDC_DPPIC10_CHANNELS_USED_MASK +#define NRFX_DPPI00_CHANNELS_USED_BY_BT_CTLR SDC_DPPIC00_CHANNELS_USED_MASK +#define NRFX_PPIB_00_10_CHANNELS_USED_BY_BT_CTLR \ + (SDC_PPIB00_CHANNELS_USED_MASK | SDC_PPIB10_CHANNELS_USED_MASK) +#elif defined(CONFIG_SOC_SERIES_NRF54HX) +#define NRFX_DPPI020_CHANNELS_USED_BY_BT_CTLR SDC_DPPIC020_CHANNELS_USED_MASK +#define NRFX_DPPI030_CHANNELS_USED_BY_BT_CTLR SDC_DPPIC030_CHANNELS_USED_MASK +#define NRFX_PPIB_020_030_CHANNELS_USED_BY_BT_CTLR \ + (SDC_PPIB020_CHANNELS_USED_MASK | SDC_PPIB030_CHANNELS_USED_MASK) +#else +#error Unsupported chip family +#endif +#endif /* defined(CONFIG_BT_LL_SOFTDEVICE) */ + +#if defined(CONFIG_NRF_802154_RADIO_DRIVER) +#if defined(CONFIG_SOC_COMPATIBLE_NRF52X) +#include <../src/nrf_802154_peripherals_nrf52.h> +#define NRFX_PPI_CHANNELS_USED_BY_802154_DRV NRF_802154_PPI_CHANNELS_USED_MASK +#define NRFX_PPI_GROUPS_USED_BY_802154_DRV NRF_802154_PPI_GROUPS_USED_MASK +#elif defined(CONFIG_SOC_COMPATIBLE_NRF53X) +#include <../src/nrf_802154_peripherals_nrf53.h> +#define NRFX_DPPI0_CHANNELS_USED_BY_802154_DRV NRF_802154_DPPI_CHANNELS_USED_MASK +#define NRFX_DPPI0_GROUPS_USED_BY_802154_DRV NRF_802154_DPPI_GROUPS_USED_MASK +#elif defined(CONFIG_SOC_COMPATIBLE_NRF54LX) +#include <../src/nrf_802154_peripherals_nrf54l.h> +#define NRFX_DPPI10_CHANNELS_USED_BY_802154_DRV NRF_802154_DPPI_CHANNELS_USED_MASK +#define NRFX_DPPI10_GROUPS_USED_BY_802154_DRV NRF_802154_DPPI_GROUPS_USED_MASK +#elif defined(CONFIG_SOC_SERIES_NRF54HX) +#include <../src/nrf_802154_peripherals_nrf54h.h> +#define NRFX_DPPI020_CHANNELS_USED_BY_802154_DRV NRF_802154_DPPI_CHANNELS_USED_MASK +#define NRFX_DPPI020_GROUPS_USED_BY_802154_DRV NRF_802154_DPPI_GROUPS_USED_MASK +#else +#error Unsupported chip family +#endif +#endif /* CONFIG_NRF_802154_RADIO_DRIVER */ + +#if defined(CONFIG_MPSL) +#include +#if defined(CONFIG_SOC_COMPATIBLE_NRF52X) +#define NRFX_PPI_CHANNELS_USED_BY_MPSL MPSL_PPI_CHANNELS_USED_MASK +#elif defined(CONFIG_SOC_COMPATIBLE_NRF53X) +#define NRFX_DPPI0_CHANNELS_USED_BY_MPSL MPSL_DPPIC_CHANNELS_USED_MASK +#elif defined(CONFIG_SOC_COMPATIBLE_NRF54LX) || defined(CONFIG_SOC_SERIES_NRF71X) +#define NRFX_DPPI10_CHANNELS_USED_BY_MPSL MPSL_DPPIC10_CHANNELS_USED_MASK +#define NRFX_DPPI20_CHANNELS_USED_BY_MPSL MPSL_DPPIC20_CHANNELS_USED_MASK +#define NRFX_PPIB_11_21_CHANNELS_USED_BY_MPSL \ + (MPSL_PPIB11_CHANNELS_USED_MASK | MPSL_PPIB21_CHANNELS_USED_MASK) +#elif defined(CONFIG_SOC_SERIES_NRF54HX) +#define NRFX_DPPI020_CHANNELS_USED_BY_MPSL MPSL_DPPIC020_CHANNELS_USED_MASK +#else +#error Unsupported chip family +#endif +#endif + +#ifndef NRFX_DPPI0_CHANNELS_USED_BY_BT_CTLR +#define NRFX_DPPI0_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI0_GROUPS_USED_BY_BT_CTLR +#define NRFX_DPPI0_GROUPS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI0_CHANNELS_USED_BY_802154_DRV +#define NRFX_DPPI0_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI0_GROUPS_USED_BY_802154_DRV +#define NRFX_DPPI0_GROUPS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI0_CHANNELS_USED_BY_MPSL +#define NRFX_DPPI0_CHANNELS_USED_BY_MPSL 0 +#endif +#ifndef NRFX_DPPI0_GROUPS_USED_BY_MPSL +#define NRFX_DPPI0_GROUPS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_DPPI00_CHANNELS_USED_BY_BT_CTLR +#define NRFX_DPPI00_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI00_GROUPS_USED_BY_BT_CTLR +#define NRFX_DPPI00_GROUPS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI00_CHANNELS_USED_BY_802154_DRV +#define NRFX_DPPI00_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI00_GROUPS_USED_BY_802154_DRV +#define NRFX_DPPI00_GROUPS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI00_CHANNELS_USED_BY_MPSL +#define NRFX_DPPI00_CHANNELS_USED_BY_MPSL 0 +#endif +#ifndef NRFX_DPPI00_GROUPS_USED_BY_MPSL +#define NRFX_DPPI00_GROUPS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_DPPI10_CHANNELS_USED_BY_BT_CTLR +#define NRFX_DPPI10_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI10_GROUPS_USED_BY_BT_CTLR +#define NRFX_DPPI10_GROUPS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI10_CHANNELS_USED_BY_802154_DRV +#define NRFX_DPPI10_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI10_GROUPS_USED_BY_802154_DRV +#define NRFX_DPPI10_GROUPS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI10_CHANNELS_USED_BY_MPSL +#define NRFX_DPPI10_CHANNELS_USED_BY_MPSL 0 +#endif +#ifndef NRFX_DPPI10_GROUPS_USED_BY_MPSL +#define NRFX_DPPI10_GROUPS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_DPPI20_CHANNELS_USED_BY_BT_CTLR +#define NRFX_DPPI20_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI20_GROUPS_USED_BY_BT_CTLR +#define NRFX_DPPI20_GROUPS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI20_CHANNELS_USED_BY_802154_DRV +#define NRFX_DPPI20_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI20_GROUPS_USED_BY_802154_DRV +#define NRFX_DPPI20_GROUPS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI20_CHANNELS_USED_BY_MPSL +#define NRFX_DPPI20_CHANNELS_USED_BY_MPSL 0 +#endif +#ifndef NRFX_DPPI20_GROUPS_USED_BY_MPSL +#define NRFX_DPPI20_GROUPS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_DPPI30_CHANNELS_USED_BY_BT_CTLR +#define NRFX_DPPI30_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI30_GROUPS_USED_BY_BT_CTLR +#define NRFX_DPPI30_GROUPS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI30_CHANNELS_USED_BY_802154_DRV +#define NRFX_DPPI30_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI30_GROUPS_USED_BY_802154_DRV +#define NRFX_DPPI30_GROUPS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI30_CHANNELS_USED_BY_MPSL +#define NRFX_DPPI30_CHANNELS_USED_BY_MPSL 0 +#endif +#ifndef NRFX_DPPI30_GROUPS_USED_BY_MPSL +#define NRFX_DPPI30_GROUPS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_DPPI020_CHANNELS_USED_BY_BT_CTLR +#define NRFX_DPPI020_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI020_GROUPS_USED_BY_BT_CTLR +#define NRFX_DPPI020_GROUPS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI020_CHANNELS_USED_BY_802154_DRV +#define NRFX_DPPI020_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI020_GROUPS_USED_BY_802154_DRV +#define NRFX_DPPI020_GROUPS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI020_CHANNELS_USED_BY_MPSL +#define NRFX_DPPI020_CHANNELS_USED_BY_MPSL 0 +#endif +#ifndef NRFX_DPPI020_GROUPS_USED_BY_MPSL +#define NRFX_DPPI020_GROUPS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_DPPI030_CHANNELS_USED_BY_BT_CTLR +#define NRFX_DPPI030_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI030_GROUPS_USED_BY_BT_CTLR +#define NRFX_DPPI030_GROUPS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI030_CHANNELS_USED_BY_802154_DRV +#define NRFX_DPPI030_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI030_GROUPS_USED_BY_802154_DRV +#define NRFX_DPPI030_GROUPS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI030_CHANNELS_USED_BY_MPSL +#define NRFX_DPPI030_CHANNELS_USED_BY_MPSL 0 +#endif +#ifndef NRFX_DPPI030_GROUPS_USED_BY_MPSL +#define NRFX_DPPI030_GROUPS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_DPPI120_CHANNELS_USED_BY_BT_CTLR +#define NRFX_DPPI120_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI120_GROUPS_USED_BY_BT_CTLR +#define NRFX_DPPI120_GROUPS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI120_CHANNELS_USED_BY_802154_DRV +#define NRFX_DPPI120_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI120_GROUPS_USED_BY_802154_DRV +#define NRFX_DPPI120_GROUPS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI120_CHANNELS_USED_BY_MPSL +#define NRFX_DPPI120_CHANNELS_USED_BY_MPSL 0 +#endif +#ifndef NRFX_DPPI120_GROUPS_USED_BY_MPSL +#define NRFX_DPPI120_GROUPS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_DPPI130_CHANNELS_USED_BY_BT_CTLR +#define NRFX_DPPI130_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI130_GROUPS_USED_BY_BT_CTLR +#define NRFX_DPPI130_GROUPS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI130_CHANNELS_USED_BY_802154_DRV +#define NRFX_DPPI130_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI130_GROUPS_USED_BY_802154_DRV +#define NRFX_DPPI130_GROUPS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI130_CHANNELS_USED_BY_MPSL +#define NRFX_DPPI130_CHANNELS_USED_BY_MPSL 0 +#endif +#ifndef NRFX_DPPI130_GROUPS_USED_BY_MPSL +#define NRFX_DPPI130_GROUPS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_DPPI131_CHANNELS_USED_BY_BT_CTLR +#define NRFX_DPPI131_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI131_GROUPS_USED_BY_BT_CTLR +#define NRFX_DPPI131_GROUPS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI131_CHANNELS_USED_BY_802154_DRV +#define NRFX_DPPI131_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI131_GROUPS_USED_BY_802154_DRV +#define NRFX_DPPI131_GROUPS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI131_CHANNELS_USED_BY_MPSL +#define NRFX_DPPI131_CHANNELS_USED_BY_MPSL 0 +#endif +#ifndef NRFX_DPPI131_GROUPS_USED_BY_MPSL +#define NRFX_DPPI131_GROUPS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_DPPI132_CHANNELS_USED_BY_BT_CTLR +#define NRFX_DPPI132_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI132_GROUPS_USED_BY_BT_CTLR +#define NRFX_DPPI132_GROUPS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI132_CHANNELS_USED_BY_802154_DRV +#define NRFX_DPPI132_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI132_GROUPS_USED_BY_802154_DRV +#define NRFX_DPPI132_GROUPS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI132_CHANNELS_USED_BY_MPSL +#define NRFX_DPPI132_CHANNELS_USED_BY_MPSL 0 +#endif +#ifndef NRFX_DPPI132_GROUPS_USED_BY_MPSL +#define NRFX_DPPI132_GROUPS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_DPPI133_CHANNELS_USED_BY_BT_CTLR +#define NRFX_DPPI133_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI133_GROUPS_USED_BY_BT_CTLR +#define NRFX_DPPI133_GROUPS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI133_CHANNELS_USED_BY_802154_DRV +#define NRFX_DPPI133_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI133_GROUPS_USED_BY_802154_DRV +#define NRFX_DPPI133_GROUPS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI133_CHANNELS_USED_BY_MPSL +#define NRFX_DPPI133_CHANNELS_USED_BY_MPSL 0 +#endif +#ifndef NRFX_DPPI133_GROUPS_USED_BY_MPSL +#define NRFX_DPPI133_GROUPS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_DPPI134_CHANNELS_USED_BY_BT_CTLR +#define NRFX_DPPI134_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI134_GROUPS_USED_BY_BT_CTLR +#define NRFX_DPPI134_GROUPS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI134_CHANNELS_USED_BY_802154_DRV +#define NRFX_DPPI134_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI134_GROUPS_USED_BY_802154_DRV +#define NRFX_DPPI134_GROUPS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI134_CHANNELS_USED_BY_MPSL +#define NRFX_DPPI134_CHANNELS_USED_BY_MPSL 0 +#endif +#ifndef NRFX_DPPI134_GROUPS_USED_BY_MPSL +#define NRFX_DPPI134_GROUPS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_DPPI135_CHANNELS_USED_BY_BT_CTLR +#define NRFX_DPPI135_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI135_GROUPS_USED_BY_BT_CTLR +#define NRFX_DPPI135_GROUPS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI135_CHANNELS_USED_BY_802154_DRV +#define NRFX_DPPI135_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI135_GROUPS_USED_BY_802154_DRV +#define NRFX_DPPI135_GROUPS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI135_CHANNELS_USED_BY_MPSL +#define NRFX_DPPI135_CHANNELS_USED_BY_MPSL 0 +#endif +#ifndef NRFX_DPPI135_GROUPS_USED_BY_MPSL +#define NRFX_DPPI135_GROUPS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_DPPI136_CHANNELS_USED_BY_BT_CTLR +#define NRFX_DPPI136_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI136_GROUPS_USED_BY_BT_CTLR +#define NRFX_DPPI136_GROUPS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI136_CHANNELS_USED_BY_802154_DRV +#define NRFX_DPPI136_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI136_GROUPS_USED_BY_802154_DRV +#define NRFX_DPPI136_GROUPS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI136_CHANNELS_USED_BY_MPSL +#define NRFX_DPPI136_CHANNELS_USED_BY_MPSL 0 +#endif +#ifndef NRFX_DPPI136_GROUPS_USED_BY_MPSL +#define NRFX_DPPI136_GROUPS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_PPI_CHANNELS_USED_BY_BT_CTLR +#define NRFX_PPI_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_PPI_GROUPS_USED_BY_BT_CTLR +#define NRFX_PPI_GROUPS_USED_BY_BT_CTLR 0 +#endif + +#ifndef NRFX_PPI_CHANNELS_USED_BY_802154_DRV +#define NRFX_PPI_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_PPI_GROUPS_USED_BY_802154_DRV +#define NRFX_PPI_GROUPS_USED_BY_802154_DRV 0 +#endif + +#ifndef NRFX_PPI_CHANNELS_USED_BY_MPSL +#define NRFX_PPI_CHANNELS_USED_BY_MPSL 0 +#endif +#ifndef NRFX_PPI_GROUPS_USED_BY_MPSL +#define NRFX_PPI_GROUPS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_PPIB_00_10_CHANNELS_USED_BY_BT_CTLR +#define NRFX_PPIB_00_10_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_PPIB_00_10_CHANNELS_USED_BY_802154_DRV +#define NRFX_PPIB_00_10_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_PPIB_00_10_CHANNELS_USED_BY_MPSL +#define NRFX_PPIB_00_10_CHANNELS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_PPIB_01_20_CHANNELS_USED_BY_BT_CTLR +#define NRFX_PPIB_01_20_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_PPIB_01_20_CHANNELS_USED_BY_802154_DRV +#define NRFX_PPIB_01_20_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_PPIB_01_20_CHANNELS_USED_BY_MPSL +#define NRFX_PPIB_01_20_CHANNELS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_PPIB_11_21_CHANNELS_USED_BY_BT_CTLR +#define NRFX_PPIB_11_21_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_PPIB_11_21_CHANNELS_USED_BY_802154_DRV +#define NRFX_PPIB_11_21_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_PPIB_11_21_CHANNELS_USED_BY_MPSL +#define NRFX_PPIB_11_21_CHANNELS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_PPIB_22_30_CHANNELS_USED_BY_BT_CTLR +#define NRFX_PPIB_22_30_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_PPIB_22_30_CHANNELS_USED_BY_802154_DRV +#define NRFX_PPIB_22_30_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_PPIB_22_30_CHANNELS_USED_BY_MPSL +#define NRFX_PPIB_22_30_CHANNELS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_PPIB_02_03_CHANNELS_USED_BY_BT_CTLR +#define NRFX_PPIB_02_03_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_PPIB_02_03_CHANNELS_USED_BY_802154_DRV +#define NRFX_PPIB_02_03_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_PPIB_02_03_CHANNELS_USED_BY_MPSL +#define NRFX_PPIB_02_03_CHANNELS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_PPIB_04_12_CHANNELS_USED_BY_BT_CTLR +#define NRFX_PPIB_04_12_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_PPIB_04_12_CHANNELS_USED_BY_802154_DRV +#define NRFX_PPIB_04_12_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_PPIB_04_12_CHANNELS_USED_BY_MPSL +#define NRFX_PPIB_04_12_CHANNELS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_PPIB_020_030_CHANNELS_USED_BY_BT_CTLR +#define NRFX_PPIB_020_030_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_PPIB_020_030_CHANNELS_USED_BY_802154_DRV +#define NRFX_PPIB_020_030_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_PPIB_020_030_CHANNELS_USED_BY_MPSL +#define NRFX_PPIB_020_030_CHANNELS_USED_BY_MPSL 0 +#endif + +#if defined(NRF_802154_VERIFY_PERIPHS_ALLOC_AGAINST_MPSL) + +BUILD_ASSERT((NRFX_DPPI0_CHANNELS_USED_BY_802154_DRV & NRFX_DPPI0_CHANNELS_USED_BY_MPSL) == 0, + "PPI channels used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI0_GROUPS_USED_BY_802154_DRV & NRFX_DPPI0_GROUPS_USED_BY_MPSL) == 0, + "PPI groups used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI00_CHANNELS_USED_BY_802154_DRV & NRFX_DPPI00_CHANNELS_USED_BY_MPSL) == 0, + "PPI channels used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI00_GROUPS_USED_BY_802154_DRV & NRFX_DPPI00_GROUPS_USED_BY_MPSL) == 0, + "PPI groups used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI10_CHANNELS_USED_BY_802154_DRV & NRFX_DPPI10_CHANNELS_USED_BY_MPSL) == 0, + "PPI channels used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI10_GROUPS_USED_BY_802154_DRV & NRFX_DPPI10_GROUPS_USED_BY_MPSL) == 0, + "PPI groups used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI20_CHANNELS_USED_BY_802154_DRV & NRFX_DPPI20_CHANNELS_USED_BY_MPSL) == 0, + "PPI channels used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI20_GROUPS_USED_BY_802154_DRV & NRFX_DPPI20_GROUPS_USED_BY_MPSL) == 0, + "PPI groups used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI30_CHANNELS_USED_BY_802154_DRV & NRFX_DPPI30_CHANNELS_USED_BY_MPSL) == 0, + "PPI channels used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI30_GROUPS_USED_BY_802154_DRV & NRFX_DPPI30_GROUPS_USED_BY_MPSL) == 0, + "PPI groups used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI020_CHANNELS_USED_BY_802154_DRV & NRFX_DPPI020_CHANNELS_USED_BY_MPSL) == 0, + "PPI channels used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI020_GROUPS_USED_BY_802154_DRV & NRFX_DPPI020_GROUPS_USED_BY_MPSL) == 0, + "PPI groups used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI030_CHANNELS_USED_BY_802154_DRV & NRFX_DPPI030_CHANNELS_USED_BY_MPSL) == 0, + "PPI channels used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI030_GROUPS_USED_BY_802154_DRV & NRFX_DPPI030_GROUPS_USED_BY_MPSL) == 0, + "PPI groups used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI120_CHANNELS_USED_BY_802154_DRV & NRFX_DPPI120_CHANNELS_USED_BY_MPSL) == 0, + "PPI channels used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI120_GROUPS_USED_BY_802154_DRV & NRFX_DPPI120_GROUPS_USED_BY_MPSL) == 0, + "PPI groups used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI130_CHANNELS_USED_BY_802154_DRV & NRFX_DPPI130_CHANNELS_USED_BY_MPSL) == 0, + "PPI channels used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI130_GROUPS_USED_BY_802154_DRV & NRFX_DPPI130_GROUPS_USED_BY_MPSL) == 0, + "PPI groups used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI131_CHANNELS_USED_BY_802154_DRV & NRFX_DPPI131_CHANNELS_USED_BY_MPSL) == 0, + "PPI channels used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI131_GROUPS_USED_BY_802154_DRV & NRFX_DPPI131_GROUPS_USED_BY_MPSL) == 0, + "PPI groups used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI132_CHANNELS_USED_BY_802154_DRV & NRFX_DPPI132_CHANNELS_USED_BY_MPSL) == 0, + "PPI channels used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI132_GROUPS_USED_BY_802154_DRV & NRFX_DPPI132_GROUPS_USED_BY_MPSL) == 0, + "PPI groups used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI133_CHANNELS_USED_BY_802154_DRV & NRFX_DPPI133_CHANNELS_USED_BY_MPSL) == 0, + "PPI channels used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI133_GROUPS_USED_BY_802154_DRV & NRFX_DPPI133_GROUPS_USED_BY_MPSL) == 0, + "PPI groups used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI134_CHANNELS_USED_BY_802154_DRV & NRFX_DPPI134_CHANNELS_USED_BY_MPSL) == 0, + "PPI channels used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI134_GROUPS_USED_BY_802154_DRV & NRFX_DPPI134_GROUPS_USED_BY_MPSL) == 0, + "PPI groups used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI135_CHANNELS_USED_BY_802154_DRV & NRFX_DPPI135_CHANNELS_USED_BY_MPSL) == 0, + "PPI channels used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI135_GROUPS_USED_BY_802154_DRV & NRFX_DPPI135_GROUPS_USED_BY_MPSL) == 0, + "PPI groups used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI136_CHANNELS_USED_BY_802154_DRV & NRFX_DPPI136_CHANNELS_USED_BY_MPSL) == 0, + "PPI channels used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_DPPI136_GROUPS_USED_BY_802154_DRV & NRFX_DPPI136_GROUPS_USED_BY_MPSL) == 0, + "PPI groups used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_PPI_CHANNELS_USED_BY_802154_DRV & NRFX_PPI_CHANNELS_USED_BY_MPSL) == 0, + "PPI channels used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_PPI_GROUPS_USED_BY_802154_DRV & NRFX_PPI_GROUPS_USED_BY_MPSL) == 0, + "PPI groups used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_PPIB_00_10_CHANNELS_USED_BY_802154_DRV & + NRFX_PPIB_00_10_CHANNELS_USED_BY_MPSL) == 0, + "PPI channels used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_PPIB_01_20_CHANNELS_USED_BY_802154_DRV & + NRFX_PPIB_01_20_CHANNELS_USED_BY_MPSL) == 0, + "PPI channels used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_PPIB_11_21_CHANNELS_USED_BY_802154_DRV & + NRFX_PPIB_11_21_CHANNELS_USED_BY_MPSL) == 0, + "PPI channels used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_PPIB_22_30_CHANNELS_USED_BY_802154_DRV & + NRFX_PPIB_22_30_CHANNELS_USED_BY_MPSL) == 0, + "PPI channels used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_PPIB_02_03_CHANNELS_USED_BY_802154_DRV & + NRFX_PPIB_02_03_CHANNELS_USED_BY_MPSL) == 0, + "PPI channels used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_PPIB_04_12_CHANNELS_USED_BY_802154_DRV & + NRFX_PPIB_04_12_CHANNELS_USED_BY_MPSL) == 0, + "PPI channels used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +BUILD_ASSERT((NRFX_PPIB_020_030_CHANNELS_USED_BY_802154_DRV & + NRFX_PPIB_020_030_CHANNELS_USED_BY_MPSL) == 0, + "PPI channels used by the IEEE802.15.4 radio driver overlap with those " + "assigned to the MPSL."); + +#endif /* NRF_802154_VERIFY_PERIPHS_ALLOC_AGAINST_MPSL */ + +/** @brief Bitmask that defines DPPI channels that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI0_CHANNELS_USED \ + (NRFX_DPPI0_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI0_CHANNELS_USED_BY_802154_DRV | \ + NRFX_DPPI0_CHANNELS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI groups that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI0_GROUPS_USED \ + (NRFX_DPPI0_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI0_GROUPS_USED_BY_802154_DRV | \ + NRFX_DPPI0_GROUPS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI channels that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI00_CHANNELS_USED \ + (NRFX_DPPI00_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI00_CHANNELS_USED_BY_802154_DRV | \ + NRFX_DPPI00_CHANNELS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI groups that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI00_GROUPS_USED \ + (NRFX_DPPI00_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI00_GROUPS_USED_BY_802154_DRV | \ + NRFX_DPPI00_GROUPS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI channels that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI10_CHANNELS_USED \ + (NRFX_DPPI10_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI10_CHANNELS_USED_BY_802154_DRV | \ + NRFX_DPPI10_CHANNELS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI groups that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI10_GROUPS_USED \ + (NRFX_DPPI10_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI10_GROUPS_USED_BY_802154_DRV | \ + NRFX_DPPI10_GROUPS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI channels that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI20_CHANNELS_USED \ + (NRFX_DPPI20_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI20_CHANNELS_USED_BY_802154_DRV | \ + NRFX_DPPI20_CHANNELS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI groups that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI20_GROUPS_USED \ + (NRFX_DPPI20_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI20_GROUPS_USED_BY_802154_DRV | \ + NRFX_DPPI20_GROUPS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI channels that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI30_CHANNELS_USED \ + (NRFX_DPPI30_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI30_CHANNELS_USED_BY_802154_DRV | \ + NRFX_DPPI30_CHANNELS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI groups that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI30_GROUPS_USED \ + (NRFX_DPPI30_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI30_GROUPS_USED_BY_802154_DRV | \ + NRFX_DPPI30_GROUPS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI channels that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI020_CHANNELS_USED \ + (NRFX_DPPI020_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI020_CHANNELS_USED_BY_802154_DRV | \ + NRFX_DPPI020_CHANNELS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI groups that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI020_GROUPS_USED \ + (NRFX_DPPI020_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI020_GROUPS_USED_BY_802154_DRV | \ + NRFX_DPPI020_GROUPS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI channels that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI030_CHANNELS_USED \ + (NRFX_DPPI030_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI030_CHANNELS_USED_BY_802154_DRV | \ + NRFX_DPPI030_CHANNELS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI groups that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI030_GROUPS_USED \ + (NRFX_DPPI030_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI030_GROUPS_USED_BY_802154_DRV | \ + NRFX_DPPI030_GROUPS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI channels that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI120_CHANNELS_USED \ + (NRFX_DPPI120_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI120_CHANNELS_USED_BY_802154_DRV | \ + NRFX_DPPI120_CHANNELS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI groups that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI120_GROUPS_USED \ + (NRFX_DPPI120_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI120_GROUPS_USED_BY_802154_DRV | \ + NRFX_DPPI120_GROUPS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI channels that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI130_CHANNELS_USED \ + (NRFX_DPPI130_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI130_CHANNELS_USED_BY_802154_DRV | \ + NRFX_DPPI130_CHANNELS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI groups that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI130_GROUPS_USED \ + (NRFX_DPPI130_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI130_GROUPS_USED_BY_802154_DRV | \ + NRFX_DPPI130_GROUPS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI channels that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI131_CHANNELS_USED \ + (NRFX_DPPI131_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI131_CHANNELS_USED_BY_802154_DRV | \ + NRFX_DPPI131_CHANNELS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI groups that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI131_GROUPS_USED \ + (NRFX_DPPI131_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI131_GROUPS_USED_BY_802154_DRV | \ + NRFX_DPPI131_GROUPS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI channels that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI132_CHANNELS_USED \ + (NRFX_DPPI132_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI132_CHANNELS_USED_BY_802154_DRV | \ + NRFX_DPPI132_CHANNELS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI groups that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI132_GROUPS_USED \ + (NRFX_DPPI132_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI132_GROUPS_USED_BY_802154_DRV | \ + NRFX_DPPI132_GROUPS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI channels that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI133_CHANNELS_USED \ + (NRFX_DPPI133_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI133_CHANNELS_USED_BY_802154_DRV | \ + NRFX_DPPI133_CHANNELS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI groups that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI133_GROUPS_USED \ + (NRFX_DPPI133_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI133_GROUPS_USED_BY_802154_DRV | \ + NRFX_DPPI133_GROUPS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI channels that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI134_CHANNELS_USED \ + (NRFX_DPPI134_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI134_CHANNELS_USED_BY_802154_DRV | \ + NRFX_DPPI134_CHANNELS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI groups that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI134_GROUPS_USED \ + (NRFX_DPPI134_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI134_GROUPS_USED_BY_802154_DRV | \ + NRFX_DPPI134_GROUPS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI channels that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI135_CHANNELS_USED \ + (NRFX_DPPI135_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI135_CHANNELS_USED_BY_802154_DRV | \ + NRFX_DPPI135_CHANNELS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI groups that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI135_GROUPS_USED \ + (NRFX_DPPI135_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI135_GROUPS_USED_BY_802154_DRV | \ + NRFX_DPPI135_GROUPS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI channels that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI136_CHANNELS_USED \ + (NRFX_DPPI136_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI136_CHANNELS_USED_BY_802154_DRV | \ + NRFX_DPPI136_CHANNELS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI groups that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI136_GROUPS_USED \ + (NRFX_DPPI136_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI136_GROUPS_USED_BY_802154_DRV | \ + NRFX_DPPI136_GROUPS_USED_BY_MPSL) + +/** @brief Bitmask that defines PPI channels that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_PPI_CHANNELS_USED \ + (NRFX_PPI_CHANNELS_USED_BY_BT_CTLR | NRFX_PPI_CHANNELS_USED_BY_802154_DRV | \ + NRFX_PPI_CHANNELS_USED_BY_MPSL | NRFX_PPI_CHANNELS_USED_BY_SD) + +#define NRFX_DPPI_CHANNELS_USED NRFX_DPPI0_CHANNELS_USED +#define NRFX_DPPI_GROUPS_USED NRFX_DPPI0_GROUPS_USED + +/** @brief Bitmask that defines PPI groups that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_PPI_GROUPS_USED \ + (NRFX_PPI_GROUPS_USED_BY_BT_CTLR | NRFX_PPI_GROUPS_USED_BY_802154_DRV | \ + NRFX_PPI_GROUPS_USED_BY_MPSL | NRFX_PPI_GROUPS_USED_BY_SD) + +#define NRFX_PPIB_INTERCONNECT_00_10_CHANNELS_USED \ + (NRFX_PPIB_00_10_CHANNELS_USED_BY_BT_CTLR | NRFX_PPIB_00_10_CHANNELS_USED_BY_802154_DRV | \ + NRFX_PPIB_00_10_CHANNELS_USED_BY_MPSL) + +#define NRFX_PPIB_INTERCONNECT_01_20_CHANNELS_USED \ + (NRFX_PPIB_01_20_CHANNELS_USED_BY_BT_CTLR | NRFX_PPIB_01_20_CHANNELS_USED_BY_802154_DRV | \ + NRFX_PPIB_01_20_CHANNELS_USED_BY_MPSL) + +#define NRFX_PPIB_INTERCONNECT_11_21_CHANNELS_USED \ + (NRFX_PPIB_11_21_CHANNELS_USED_BY_BT_CTLR | NRFX_PPIB_11_21_CHANNELS_USED_BY_802154_DRV | \ + NRFX_PPIB_11_21_CHANNELS_USED_BY_MPSL) + +#define NRFX_PPIB_INTERCONNECT_22_30_CHANNELS_USED \ + (NRFX_PPIB_22_30_CHANNELS_USED_BY_BT_CTLR | NRFX_PPIB_22_30_CHANNELS_USED_BY_802154_DRV | \ + NRFX_PPIB_22_30_CHANNELS_USED_BY_MPSL) + +#define NRFX_PPIB_INTERCONNECT_02_03_CHANNELS_USED \ + (NRFX_PPIB_02_03_CHANNELS_USED_BY_BT_CTLR | NRFX_PPIB_02_03_CHANNELS_USED_BY_802154_DRV | \ + NRFX_PPIB_02_03_CHANNELS_USED_BY_MPSL) + +#define NRFX_PPIB_INTERCONNECT_04_12_CHANNELS_USED \ + (NRFX_PPIB_04_12_CHANNELS_USED_BY_BT_CTLR | NRFX_PPIB_04_12_CHANNELS_USED_BY_802154_DRV | \ + NRFX_PPIB_04_12_CHANNELS_USED_BY_MPSL) + +#define NRFX_PPIB_INTERCONNECT_020_030_CHANNELS_USED \ + (NRFX_PPIB_020_030_CHANNELS_USED_BY_BT_CTLR | \ + NRFX_PPIB_020_030_CHANNELS_USED_BY_802154_DRV | NRFX_PPIB_020_030_CHANNELS_USED_BY_MPSL) + +#if defined(CONFIG_SOFTDEVICE) +#include +#define NRFX_PPI_CHANNELS_USED_BY_SD SD_PPI_CHANNELS_USED +#define NRFX_PPI_GROUPS_USED_BY_SD SD_PPI_GROUPS_USED +#else +#define NRFX_PPI_CHANNELS_USED_BY_SD 0 +#define NRFX_PPI_GROUPS_USED_BY_SD 0 +#endif + +#endif /* NRFX_CONFIG_RESERVED_RESOURCES_H__ */ From 779b99cd58249864a25dffed6f8397c2970d2fff Mon Sep 17 00:00:00 2001 From: Aleksandr Khromykh Date: Tue, 25 Feb 2025 10:35:24 +0100 Subject: [PATCH 1672/2141] [nrf noup] samples: bluetooth: mesh: Disable secure storage for real targets. Mesh currently works with trusted storage on real targets. Until secure storage is supported by default disable it. Signed-off-by: Aleksandr Khromykh (cherry picked from commit f331133c270974e2a33087c12dab21419fc0b0ba) --- samples/bluetooth/mesh/boards/qemu_x86.conf | 6 ++++++ samples/bluetooth/mesh/prj.conf | 2 +- samples/bluetooth/mesh_demo/boards/qemu_x86.conf | 6 ++++++ samples/bluetooth/mesh_demo/prj.conf | 2 +- samples/bluetooth/mesh_provisioner/boards/qemu_x86.conf | 6 ++++++ samples/bluetooth/mesh_provisioner/prj.conf | 2 +- samples/boards/nordic/mesh/onoff-app/prj.conf | 2 +- .../nordic/mesh/onoff_level_lighting_vnd_app/prj.conf | 2 +- tests/bluetooth/mesh_shell/boards/qemu_x86.conf | 6 ++++++ tests/bluetooth/mesh_shell/prj.conf | 2 +- 10 files changed, 30 insertions(+), 6 deletions(-) create mode 100644 samples/bluetooth/mesh/boards/qemu_x86.conf create mode 100644 samples/bluetooth/mesh_demo/boards/qemu_x86.conf create mode 100644 samples/bluetooth/mesh_provisioner/boards/qemu_x86.conf create mode 100644 tests/bluetooth/mesh_shell/boards/qemu_x86.conf diff --git a/samples/bluetooth/mesh/boards/qemu_x86.conf b/samples/bluetooth/mesh/boards/qemu_x86.conf new file mode 100644 index 000000000000..bfb57193b782 --- /dev/null +++ b/samples/bluetooth/mesh/boards/qemu_x86.conf @@ -0,0 +1,6 @@ +# nrf_security only supports Cortex-M via PSA crypto libraries. +# Enforcing usage of built-in Mbed TLS for native simulator. +CONFIG_NRF_SECURITY=n +CONFIG_MBEDTLS_ENABLE_HEAP=n +CONFIG_TRUSTED_STORAGE=n +CONFIG_SECURE_STORAGE=y diff --git a/samples/bluetooth/mesh/prj.conf b/samples/bluetooth/mesh/prj.conf index 14b19316a866..cd7d6532b614 100644 --- a/samples/bluetooth/mesh/prj.conf +++ b/samples/bluetooth/mesh/prj.conf @@ -5,7 +5,7 @@ CONFIG_FLASH=y CONFIG_FLASH_MAP=y CONFIG_NVS=y CONFIG_SETTINGS=y -CONFIG_SECURE_STORAGE=y +# CONFIG_SECURE_STORAGE=y CONFIG_HWINFO=y CONFIG_BT=y diff --git a/samples/bluetooth/mesh_demo/boards/qemu_x86.conf b/samples/bluetooth/mesh_demo/boards/qemu_x86.conf new file mode 100644 index 000000000000..bfb57193b782 --- /dev/null +++ b/samples/bluetooth/mesh_demo/boards/qemu_x86.conf @@ -0,0 +1,6 @@ +# nrf_security only supports Cortex-M via PSA crypto libraries. +# Enforcing usage of built-in Mbed TLS for native simulator. +CONFIG_NRF_SECURITY=n +CONFIG_MBEDTLS_ENABLE_HEAP=n +CONFIG_TRUSTED_STORAGE=n +CONFIG_SECURE_STORAGE=y diff --git a/samples/bluetooth/mesh_demo/prj.conf b/samples/bluetooth/mesh_demo/prj.conf index bcb738ae5bd1..b7016b02c65b 100644 --- a/samples/bluetooth/mesh_demo/prj.conf +++ b/samples/bluetooth/mesh_demo/prj.conf @@ -31,7 +31,7 @@ CONFIG_FLASH_MAP=y CONFIG_NVS=y CONFIG_SETTINGS=y CONFIG_BT_MESH_RPL_STORE_TIMEOUT=600 -CONFIG_SECURE_STORAGE=y +# CONFIG_SECURE_STORAGE=y # Limit the number of key slots in PSA Crypto core to reduce # RAM footprint diff --git a/samples/bluetooth/mesh_provisioner/boards/qemu_x86.conf b/samples/bluetooth/mesh_provisioner/boards/qemu_x86.conf new file mode 100644 index 000000000000..bfb57193b782 --- /dev/null +++ b/samples/bluetooth/mesh_provisioner/boards/qemu_x86.conf @@ -0,0 +1,6 @@ +# nrf_security only supports Cortex-M via PSA crypto libraries. +# Enforcing usage of built-in Mbed TLS for native simulator. +CONFIG_NRF_SECURITY=n +CONFIG_MBEDTLS_ENABLE_HEAP=n +CONFIG_TRUSTED_STORAGE=n +CONFIG_SECURE_STORAGE=y diff --git a/samples/bluetooth/mesh_provisioner/prj.conf b/samples/bluetooth/mesh_provisioner/prj.conf index 10949c5480db..241767805164 100644 --- a/samples/bluetooth/mesh_provisioner/prj.conf +++ b/samples/bluetooth/mesh_provisioner/prj.conf @@ -45,7 +45,7 @@ CONFIG_FLASH_MAP=y CONFIG_NVS=y CONFIG_SETTINGS=y CONFIG_BT_MESH_RPL_STORE_TIMEOUT=600 -CONFIG_SECURE_STORAGE=y +# CONFIG_SECURE_STORAGE=y #CONFIG_BT_MESH_LOG_LEVEL_DBG=y #CONFIG_BT_MESH_SETTINGS_LOG_LEVEL_DBG=y diff --git a/samples/boards/nordic/mesh/onoff-app/prj.conf b/samples/boards/nordic/mesh/onoff-app/prj.conf index 0e67042b2653..0783579e795e 100644 --- a/samples/boards/nordic/mesh/onoff-app/prj.conf +++ b/samples/boards/nordic/mesh/onoff-app/prj.conf @@ -9,7 +9,7 @@ CONFIG_FLASH=y CONFIG_FLASH_MAP=y CONFIG_NVS=y CONFIG_SETTINGS=y -CONFIG_SECURE_STORAGE=y +# CONFIG_SECURE_STORAGE=y CONFIG_BT_MESH_RPL_STORE_TIMEOUT=600 diff --git a/samples/boards/nordic/mesh/onoff_level_lighting_vnd_app/prj.conf b/samples/boards/nordic/mesh/onoff_level_lighting_vnd_app/prj.conf index 3bb984208c70..96b5466b4a16 100644 --- a/samples/boards/nordic/mesh/onoff_level_lighting_vnd_app/prj.conf +++ b/samples/boards/nordic/mesh/onoff_level_lighting_vnd_app/prj.conf @@ -7,7 +7,7 @@ CONFIG_FLASH=y CONFIG_FLASH_MAP=y CONFIG_NVS=y CONFIG_SETTINGS=y -CONFIG_SECURE_STORAGE=y +# CONFIG_SECURE_STORAGE=y CONFIG_BT_OBSERVER=y CONFIG_BT_BROADCASTER=y diff --git a/tests/bluetooth/mesh_shell/boards/qemu_x86.conf b/tests/bluetooth/mesh_shell/boards/qemu_x86.conf new file mode 100644 index 000000000000..bfb57193b782 --- /dev/null +++ b/tests/bluetooth/mesh_shell/boards/qemu_x86.conf @@ -0,0 +1,6 @@ +# nrf_security only supports Cortex-M via PSA crypto libraries. +# Enforcing usage of built-in Mbed TLS for native simulator. +CONFIG_NRF_SECURITY=n +CONFIG_MBEDTLS_ENABLE_HEAP=n +CONFIG_TRUSTED_STORAGE=n +CONFIG_SECURE_STORAGE=y diff --git a/tests/bluetooth/mesh_shell/prj.conf b/tests/bluetooth/mesh_shell/prj.conf index 2af600295680..aab2745d359f 100644 --- a/tests/bluetooth/mesh_shell/prj.conf +++ b/tests/bluetooth/mesh_shell/prj.conf @@ -14,7 +14,7 @@ CONFIG_FLASH=y CONFIG_FLASH_MAP=y CONFIG_NVS=y CONFIG_SETTINGS=y -CONFIG_SECURE_STORAGE=y +# CONFIG_SECURE_STORAGE=y CONFIG_BT=y CONFIG_BT_OBSERVER=y From 6ae37337c9ddbcf12a64d0ba8c6f8309acc17b38 Mon Sep 17 00:00:00 2001 From: Gordon Klaus Date: Fri, 28 Feb 2025 12:27:22 +0100 Subject: [PATCH 1673/2141] [nrf noup] samples: bluetooth: hci_ipc: increase main stack size for Cracen driver on nRF54H20 A larger stack is needed to accomodate the Cracen driver. Signed-off-by: Gordon Klaus (cherry picked from commit 316cce07af745093d8056a50ff27c88e15f7d9b6) --- .../bluetooth/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.conf | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 samples/bluetooth/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.conf diff --git a/samples/bluetooth/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.conf b/samples/bluetooth/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.conf new file mode 100644 index 000000000000..296e68366389 --- /dev/null +++ b/samples/bluetooth/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.conf @@ -0,0 +1,2 @@ +# Increase stack size for Cracen driver. +CONFIG_MAIN_STACK_SIZE=1024 From dbd3934e5f2e83e4ae84fb549c72852eadca6b16 Mon Sep 17 00:00:00 2001 From: Kamil Gawor Date: Tue, 9 Apr 2024 14:24:34 +0200 Subject: [PATCH 1674/2141] [nrf noup] entropy: Add fake entropy nRF PRNG driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This adds temporary entropy driver simulation for nRF54h20 device since final entropy source is not available yet. TODO: Remove this commit when proper solution will be available. Jira: NCSDK-25947 Signed-off-by: Kamil Gawor Signed-off-by: Robert Lubos Signed-off-by: Andreas Moltumyr Signed-off-by: Karol Lasończyk (cherry picked from commit 27b137c9ee18b4b2ced382e5af255769a096727e) (cherry picked from commit e2aa08c6d7cbba17349065d497885731a21715df) --- .../nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 6 + .../nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts | 5 + .../nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts | 6 + .../nrf9280pdk/nrf9280pdk_nrf9280_cpurad.dts | 5 + drivers/entropy/CMakeLists.txt | 7 + drivers/entropy/Kconfig | 1 + drivers/entropy/Kconfig.nrf_prng | 19 +++ drivers/entropy/fake_entropy_nrf_prng.c | 101 ++++++++++++++ dts/arm/nordic/nrf54l20_enga_cpuapp.dtsi | 125 ++++++++++++++++++ dts/bindings/rng/nordic,nrf-prng.yaml | 8 ++ 10 files changed, 283 insertions(+) create mode 100644 drivers/entropy/Kconfig.nrf_prng create mode 100644 drivers/entropy/fake_entropy_nrf_prng.c create mode 100644 dts/arm/nordic/nrf54l20_enga_cpuapp.dtsi create mode 100644 dts/bindings/rng/nordic,nrf-prng.yaml diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index ba22403a9acd..e086601abae9 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -27,6 +27,7 @@ zephyr,bt-hci = &bt_hci_ipc0; nordic,802154-spinel-ipc = &ipc0; zephyr,canbus = &can120; + zephyr,entropy = &prng; }; aliases { @@ -107,6 +108,11 @@ pwms = <&pwm130 0 PWM_MSEC(20) PWM_POLARITY_NORMAL>; }; }; + + prng: prng { + compatible = "nordic,entropy-prng"; + status = "okay"; + }; }; &cpuapp_bellboard { diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts index 5473d9a7405a..7e1a1c8e9e04 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts @@ -28,6 +28,11 @@ zephyr,ieee802154 = &cpurad_ieee802154; zephyr,bt-hci-ipc = &ipc0; nordic,802154-spinel-ipc = &ipc0; + zephyr,entropy = &prng; + }; + prng: prng { + compatible = "nordic,entropy-prng"; + status = "okay"; }; aliases { diff --git a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts index 622fc04e96af..8920d7966bbf 100644 --- a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts +++ b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts @@ -26,6 +26,7 @@ zephyr,shell-uart = &uart136; zephyr,bt-hci = &bt_hci_ipc0; nordic,802154-spinel-ipc = &ipc0; + zephyr,entropy = &prng; }; aliases { @@ -107,6 +108,11 @@ pwms = <&pwm130 0 PWM_MSEC(20) PWM_POLARITY_NORMAL>; }; }; + + prng: prng { + compatible = "nordic,entropy-prng"; + status = "okay"; + }; }; &cpuapp_ram0x_region { diff --git a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpurad.dts b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpurad.dts index 5efa7dbd471c..d6c03bc4a514 100644 --- a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpurad.dts +++ b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpurad.dts @@ -28,6 +28,11 @@ zephyr,ieee802154 = &cpurad_ieee802154; zephyr,bt-hci-ipc = &ipc0; nordic,802154-spinel-ipc = &ipc0; + zephyr,entropy = &prng; + }; + prng: prng { + compatible = "nordic,entropy-prng"; + status = "okay"; }; aliases { diff --git a/drivers/entropy/CMakeLists.txt b/drivers/entropy/CMakeLists.txt index 541be8478b16..6f6c20b7a60f 100644 --- a/drivers/entropy/CMakeLists.txt +++ b/drivers/entropy/CMakeLists.txt @@ -43,4 +43,11 @@ zephyr_library_sources_ifdef(CONFIG_ENTROPY_TELINK_B91_TRNG entropy_b91_trng zephyr_library_sources_ifdef(CONFIG_ENTROPY_VIRTIO entropy_virtio.c) # zephyr-keep-sorted-stop +if (CONFIG_FAKE_ENTROPY_NRF_PRNG) + zephyr_library_sources(fake_entropy_nrf_prng.c) + + message(WARNING "\nA nRF PRNG is used, which does not produce real random bits." + "This is not secure and should therefore never be used in a product.") +endif() + zephyr_library_link_libraries_ifdef(CONFIG_BUILD_WITH_TFM tfm_api) diff --git a/drivers/entropy/Kconfig b/drivers/entropy/Kconfig index 59b93ccf022b..bab82a83f2ca 100644 --- a/drivers/entropy/Kconfig +++ b/drivers/entropy/Kconfig @@ -37,6 +37,7 @@ source "drivers/entropy/Kconfig.neorv32" source "drivers/entropy/Kconfig.npcx" source "drivers/entropy/Kconfig.nrf5" source "drivers/entropy/Kconfig.nrf_cracen" +source "drivers/entropy/Kconfig.nrf_prng" source "drivers/entropy/Kconfig.nxp" source "drivers/entropy/Kconfig.psa_crypto" source "drivers/entropy/Kconfig.renesas_ra" diff --git a/drivers/entropy/Kconfig.nrf_prng b/drivers/entropy/Kconfig.nrf_prng new file mode 100644 index 000000000000..e81db4de4b15 --- /dev/null +++ b/drivers/entropy/Kconfig.nrf_prng @@ -0,0 +1,19 @@ +# nRF fake entropy prng generator driver configuration + +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +if ENTROPY_GENERATOR + +config FAKE_ENTROPY_NRF_PRNG + bool "A fake nRF entropy driver" + default y + depends on DT_HAS_NORDIC_ENTROPY_PRNG_ENABLED + depends on (SOC_SERIES_NRF54HX || SOC_SERIES_NRF92X || SOC_SERIES_NRF54LX) + select ENTROPY_HAS_DRIVER + help + This is a super simple PRNG driver that can be used on nRF platforms that + do not have an entropy source. + This is NOT SAFE to use for cryptographic operations! + +endif diff --git a/drivers/entropy/fake_entropy_nrf_prng.c b/drivers/entropy/fake_entropy_nrf_prng.c new file mode 100644 index 000000000000..8624c8444057 --- /dev/null +++ b/drivers/entropy/fake_entropy_nrf_prng.c @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include +#include + +#define DT_DRV_COMPAT nordic_entropy_prng + +/* This file implements a pseudo-RNG + * https://vigna.di.unimi.it/xorshift/xoshiro128plus.c + */ + +static uint32_t s[4]; + +static inline uint32_t rotl(const uint32_t x, int k) +{ + return (x << k) | (x >> (32 - k)); +} + +static uint32_t rng_next(void) +{ + const uint32_t result = rotl(s[0] + s[3], 7) + s[0]; + + const uint32_t t = s[1] << 9; + + s[2] ^= s[0]; + s[3] ^= s[1]; + s[1] ^= s[2]; + s[0] ^= s[3]; + + s[2] ^= t; + + s[3] = rotl(s[3], 11); + + return result; +} + +static int entropy_prng_get_entropy(const struct device *dev, uint8_t *buffer, uint16_t length) +{ + ARG_UNUSED(dev); + + while (length) { + /* + * Note that only 1 thread (Zephyr thread or HW models), runs at + * a time, therefore there is no need to use random_r() + */ + uint32_t value = rng_next(); + + size_t to_copy = MIN(length, sizeof(long)); + + memcpy(buffer, &value, to_copy); + buffer += to_copy; + length -= to_copy; + } + + return 0; +} + +static int entropy_prng_get_entropy_isr(const struct device *dev, uint8_t *buf, uint16_t len, + uint32_t flags) +{ + ARG_UNUSED(flags); + + int err; + + /* + * entropy_prng_get_entropy() is also safe for ISRs + * and always produces data. + */ + err = entropy_prng_get_entropy(dev, buf, len); + if (err < 0) { + return err; + } else { + return len; + } +} + +static int entropy_prng_init(const struct device *dev) +{ + ARG_UNUSED(dev); + + /* Picked some arbitrary initial seed. */ + s[0] = 0xAF568BC0; + s[1] = 0xAC34307E; + s[2] = 0x9B7F6DD1; + s[3] = 0xD84319FC; + return 0; +} + +static const struct entropy_driver_api entropy_prng_api_funcs = { + .get_entropy = entropy_prng_get_entropy, .get_entropy_isr = entropy_prng_get_entropy_isr}; + +DEVICE_DT_INST_DEFINE(0, entropy_prng_init, NULL, NULL, NULL, PRE_KERNEL_1, + CONFIG_ENTROPY_INIT_PRIORITY, &entropy_prng_api_funcs); diff --git a/dts/arm/nordic/nrf54l20_enga_cpuapp.dtsi b/dts/arm/nordic/nrf54l20_enga_cpuapp.dtsi new file mode 100644 index 000000000000..5c7e5db30014 --- /dev/null +++ b/dts/arm/nordic/nrf54l20_enga_cpuapp.dtsi @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +cpu: &cpuapp {}; +systick: &cpuapp_systick {}; +nvic: &cpuapp_nvic {}; + +/delete-node/ &cpuflpr; +/delete-node/ &cpuflpr_rram; +/delete-node/ &cpuflpr_sram; +/delete-node/ &cpuflpr_clic; + +/ { + chosen { + zephyr,entropy = &prng; + }; + + soc { + compatible = "simple-bus"; + interrupt-parent = <&cpuapp_nvic>; + ranges; + }; + + psa_rng: psa-rng { + compatible = "zephyr,psa-crypto-rng"; + status = "disabled"; + }; + + prng: prng { + compatible = "nordic,entropy-prng"; + status = "okay"; + }; +}; + +&cpuflpr_vpr { + cpuapp_vevif_rx: mailbox@1 { + compatible = "nordic,nrf-vevif-event-rx"; + reg = <0x0 0x1000>; + status = "disabled"; + interrupts = <76 NRF_DEFAULT_IRQ_PRIORITY>; + #mbox-cells = <1>; + nordic,events = <1>; + nordic,events-mask = <0x00100000>; + }; + + cpuapp_vevif_tx: mailbox@0 { + compatible = "nordic,nrf-vevif-task-tx"; + reg = <0x0 0x1000>; + #mbox-cells = <1>; + nordic,tasks = <7>; + nordic,tasks-mask = <0x007f0000>; + status = "disabled"; + }; +}; + +&cpuapp_ppb { + compatible = "simple-bus"; + ranges; +}; + +&grtc { + interrupts = <228 NRF_DEFAULT_IRQ_PRIORITY>, + <229 NRF_DEFAULT_IRQ_PRIORITY>; /* reserved for Zero Latency IRQs */ +}; + +&gpiote20 { + interrupts = <219 NRF_DEFAULT_IRQ_PRIORITY>; +}; + +&gpiote30 { + interrupts = <269 NRF_DEFAULT_IRQ_PRIORITY>; +}; + +&dppic00 { + status = "okay"; +}; + +&dppic10 { + status = "okay"; +}; + +&dppic20 { + status = "okay"; +}; + +&dppic30 { + status = "okay"; +}; + +&ppib00 { + status = "okay"; +}; + +&ppib01 { + status = "okay"; +}; + +&ppib10 { + status = "okay"; +}; + +&ppib11 { + status = "okay"; +}; + +&ppib20 { + status = "okay"; +}; + +&ppib21 { + status = "okay"; +}; + +&ppib22 { + status = "okay"; +}; + +&ppib30 { + status = "okay"; +}; diff --git a/dts/bindings/rng/nordic,nrf-prng.yaml b/dts/bindings/rng/nordic,nrf-prng.yaml new file mode 100644 index 000000000000..8936393a0b65 --- /dev/null +++ b/dts/bindings/rng/nordic,nrf-prng.yaml @@ -0,0 +1,8 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + +description: This is a super simple PRNG + +compatible: "nordic,entropy-prng" + +include: base.yaml From f333d984ae6869b309d241ffc252ae20d5e2f319 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Tue, 17 Dec 2024 21:45:47 +0100 Subject: [PATCH 1675/2141] [nrf noup] drivers: spi_dw: Bring back custom EXMIF peripheral handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit brings back modifications from these reverted commits: - f68b2edaa2233cde29d955bc3d3b3dd75ff50334 - e606246f0fc3e9299cb5bdd3c1e34a091e5d85a1 slightly adjusted so that the EXMIF peripheral is still by default handled by the mspi_dw driver, and in cases where this driver cannot be used because something still does not work correctly, one can switch to the old solution based on the tweaked spi_dw driver. Signed-off-by: Andrzej Głąbek (cherry picked from commit e2ee4c0ffea72be2e9385b81594cbad94ac00ae9) --- drivers/pinctrl/pinctrl_nrf.c | 3 +- drivers/spi/spi_dw.c | 32 +++++++++++++++++++++- dts/bindings/spi/nordic,nrf-exmif-spi.yaml | 8 ++++++ 3 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 dts/bindings/spi/nordic,nrf-exmif-spi.yaml diff --git a/drivers/pinctrl/pinctrl_nrf.c b/drivers/pinctrl/pinctrl_nrf.c index bbcaea06435f..6026bc8f24d8 100644 --- a/drivers/pinctrl/pinctrl_nrf.c +++ b/drivers/pinctrl/pinctrl_nrf.c @@ -513,7 +513,8 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, input = NRF_GPIO_PIN_INPUT_CONNECT; break; #endif /* DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_can) */ -#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_exmif) +#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_exmif) || \ + DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_exmif_spi) /* Pin routing is controlled by secure domain, via UICR */ case NRF_FUN_EXMIF_CK: case NRF_FUN_EXMIF_DQ0: diff --git a/drivers/spi/spi_dw.c b/drivers/spi/spi_dw.c index bd10447e4429..6941bfdaaa77 100644 --- a/drivers/spi/spi_dw.c +++ b/drivers/spi/spi_dw.c @@ -41,6 +41,14 @@ LOG_MODULE_REGISTER(spi_dw); #include #endif +#ifdef CONFIG_HAS_NRFX +#include +#endif + +#ifdef CONFIG_SOC_NRF54H20_GPD +#include +#endif + static inline bool spi_dw_is_slave(struct spi_dw_data *spi) { return (IS_ENABLED(CONFIG_SPI_SLAVE) && @@ -258,6 +266,7 @@ static int spi_dw_configure(const struct device *dev, /* Baud rate and Slave select, for master only */ write_baudr(dev, SPI_DW_CLK_DIVIDER(info->clock_frequency, config->frequency)); + write_ser(dev, BIT(config->slave)); } if (spi_dw_is_slave(spi)) { @@ -512,6 +521,10 @@ void spi_dw_isr(const struct device *dev) uint32_t int_status; int error; +#ifdef CONFIG_HAS_NRFX + NRF_EXMIF->EVENTS_CORE = 0; +#endif + int_status = read_isr(dev); LOG_DBG("SPI %p int_status 0x%x - (tx: %d, rx: %d)", dev, int_status, @@ -560,6 +573,18 @@ int spi_dw_init(const struct device *dev) DEVICE_MMIO_MAP(dev, K_MEM_CACHE_NONE); +#ifdef CONFIG_HAS_NRFX + NRF_EXMIF->INTENSET = BIT(0); + NRF_EXMIF->TASKS_START = 1; + +#ifdef CONFIG_SOC_NRF54H20_GPD + err = nrf_gpd_request(NRF_GPD_FAST_ACTIVE1); + if (err < 0) { + return err; + } +#endif +#endif + info->config_func(); /* Masking interrupt and making sure controller is disabled */ @@ -584,6 +609,11 @@ int spi_dw_init(const struct device *dev) return 0; } +#define REG_ADDR(inst) \ + COND_CODE_1(DT_NODE_HAS_COMPAT(DT_DRV_INST(inst), nordic_nrf_exmif_spi), \ + (Z_DEVICE_MMIO_NAMED_ROM_INITIALIZER(core, DT_DRV_INST(inst))), \ + (DEVICE_MMIO_ROM_INIT(DT_DRV_INST(inst)))) + #define SPI_CFG_IRQS_SINGLE_ERR_LINE(inst) \ IRQ_CONNECT(DT_INST_IRQ_BY_NAME(inst, rx_avail, irq), \ DT_INST_IRQ_BY_NAME(inst, rx_avail, priority), \ @@ -656,7 +686,7 @@ COND_CODE_1(IS_EQ(DT_NUM_IRQS(DT_DRV_INST(inst)), 1), \ SPI_CONTEXT_CS_GPIOS_INITIALIZE(DT_DRV_INST(inst), ctx) \ }; \ static const struct spi_dw_config spi_dw_config_##inst = { \ - DEVICE_MMIO_ROM_INIT(DT_DRV_INST(inst)), \ + REG_ADDR(inst), \ .clock_frequency = COND_CODE_1( \ DT_NODE_HAS_PROP(DT_INST_PHANDLE(inst, clocks), clock_frequency), \ (DT_INST_PROP_BY_PHANDLE(inst, clocks, clock_frequency)), \ diff --git a/dts/bindings/spi/nordic,nrf-exmif-spi.yaml b/dts/bindings/spi/nordic,nrf-exmif-spi.yaml new file mode 100644 index 000000000000..d988b4146878 --- /dev/null +++ b/dts/bindings/spi/nordic,nrf-exmif-spi.yaml @@ -0,0 +1,8 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: Nordic External Memory Interface (EXMIF) used in SPI mode only + +compatible: "nordic,nrf-exmif-spi" + +include: snps,designware-spi.yaml From 915e81a911b3d03834ad11d124449c0f4fa4ccc1 Mon Sep 17 00:00:00 2001 From: Jakub Zymelka Date: Mon, 25 Nov 2024 14:14:40 +0100 Subject: [PATCH 1676/2141] [nrf noup] drivers: pinctrl: Add SDP MSPI pin configuration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Configure SDP MSPI pins to switch their control to VPR core Signed-off-by: Jakub Zymelka Signed-off-by: Andrzej Głąbek Signed-off-by: Magdalena Pastula (cherry picked from commit a9bcc44f74eed83f28506e8fcd44f0f70c65ea9c) (cherry picked from commit 2e74ea72fa61061c4caf1beb6dda304473838774) --- drivers/pinctrl/pinctrl_nrf.c | 32 +++++++++++ .../zephyr/dt-bindings/pinctrl/nrf-pinctrl.h | 56 +++++++++++++++++++ 2 files changed, 88 insertions(+) diff --git a/drivers/pinctrl/pinctrl_nrf.c b/drivers/pinctrl/pinctrl_nrf.c index 6026bc8f24d8..09c4d19f570e 100644 --- a/drivers/pinctrl/pinctrl_nrf.c +++ b/drivers/pinctrl/pinctrl_nrf.c @@ -201,6 +201,18 @@ static void port_pin_clock_set(uint16_t pin_number, bool enable) #endif +#if DT_HAS_COMPAT_STATUS_OKAY(nordic_hpf_mspi_controller) || \ + defined(CONFIG_MSPI_HPF) || \ + DT_ANY_COMPAT_HAS_PROP_STATUS_OKAY(nordic_nrf_vpr_coprocessor, pinctrl_0) +#if defined(CONFIG_SOC_SERIES_NRF54LX) +#define NRF_PSEL_SDP_MSPI(psel) \ + nrf_gpio_pin_control_select(psel, NRF_GPIO_PIN_SEL_VPR); +#elif defined(CONFIG_SOC_SERIES_NRF54HX) +/* On nRF54H, pin routing is controlled by secure domain, via UICR. */ +#define NRF_PSEL_SDP_MSPI(psel) +#endif +#endif /* DT_HAS_COMPAT_STATUS_OKAY(nordic_hpf_mspi_controller) || ... */ + int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, uintptr_t reg) { @@ -550,6 +562,26 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, input = NRF_GPIO_PIN_INPUT_CONNECT; break; #endif /* defined(NRF_PSEL_TWIS) */ +#if defined(NRF_PSEL_SDP_MSPI) + case NRF_FUN_SDP_MSPI_CS0: + case NRF_FUN_SDP_MSPI_CS1: + case NRF_FUN_SDP_MSPI_CS2: + case NRF_FUN_SDP_MSPI_CS3: + case NRF_FUN_SDP_MSPI_CS4: + case NRF_FUN_SDP_MSPI_SCK: + case NRF_FUN_SDP_MSPI_DQ0: + case NRF_FUN_SDP_MSPI_DQ1: + case NRF_FUN_SDP_MSPI_DQ2: + case NRF_FUN_SDP_MSPI_DQ3: + case NRF_FUN_SDP_MSPI_DQ4: + case NRF_FUN_SDP_MSPI_DQ5: + case NRF_FUN_SDP_MSPI_DQ6: + case NRF_FUN_SDP_MSPI_DQ7: + NRF_PSEL_SDP_MSPI(psel); + dir = NRF_GPIO_PIN_DIR_OUTPUT; + input = NRF_GPIO_PIN_INPUT_CONNECT; + break; +#endif /* defined(NRF_PSEL_SDP_MSPI) */ default: return -ENOTSUP; } diff --git a/include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h b/include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h index 9de74061e8da..088cfce648bb 100644 --- a/include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h +++ b/include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h @@ -172,6 +172,62 @@ #define NRF_FUN_GRTC_CLKOUT_FAST 55U /** GRTC slow clock output */ #define NRF_FUN_GRTC_CLKOUT_32K 56U +/** SDP_MSPI clock pin */ +#define NRF_FUN_SDP_MSPI_SCK 57U +/** SDP_MSPI data pin 0 */ +#define NRF_FUN_SDP_MSPI_DQ0 58U +/** SDP_MSPI data pin 1 */ +#define NRF_FUN_SDP_MSPI_DQ1 59U +/** SDP_MSPI data pin 2 */ +#define NRF_FUN_SDP_MSPI_DQ2 60U +/** SDP_MSPI data pin 3 */ +#define NRF_FUN_SDP_MSPI_DQ3 61U +/** SDP_MSPI data pin 4 */ +#define NRF_FUN_SDP_MSPI_DQ4 62U +/** SDP_MSPI data pin 5 */ +#define NRF_FUN_SDP_MSPI_DQ5 63U +/** SDP_MSPI data pin 6 */ +#define NRF_FUN_SDP_MSPI_DQ6 64U +/** SDP_MSPI data pin 7 */ +#define NRF_FUN_SDP_MSPI_DQ7 65U +/** SDP_MSPI chip select 0 */ +#define NRF_FUN_SDP_MSPI_CS0 66U +/** SDP_MSPI chip select 1 */ +#define NRF_FUN_SDP_MSPI_CS1 67U +/** SDP_MSPI chip select 2 */ +#define NRF_FUN_SDP_MSPI_CS2 68U +/** SDP_MSPI chip select 3 */ +#define NRF_FUN_SDP_MSPI_CS3 69U +/** SDP_MSPI chip select 4 */ +#define NRF_FUN_SDP_MSPI_CS4 70U +/** High-Performance Framework MSPI clock pin */ +#define NRF_FUN_HPF_MSPI_SCK NRF_FUN_SDP_MSPI_SCK +/** High-Performance Framework MSPI data pin 0 */ +#define NRF_FUN_HPF_MSPI_DQ0 NRF_FUN_SDP_MSPI_DQ0 +/** High-Performance Framework MSPI data pin 1 */ +#define NRF_FUN_HPF_MSPI_DQ1 NRF_FUN_SDP_MSPI_DQ1 +/** High-Performance Framework MSPI data pin 2 */ +#define NRF_FUN_HPF_MSPI_DQ2 NRF_FUN_SDP_MSPI_DQ2 +/** High-Performance Framework MSPI data pin 3 */ +#define NRF_FUN_HPF_MSPI_DQ3 NRF_FUN_SDP_MSPI_DQ3 +/** High-Performance Framework MSPI data pin 4 */ +#define NRF_FUN_HPF_MSPI_DQ4 NRF_FUN_SDP_MSPI_DQ4 +/** High-Performance Framework MSPI data pin 5 */ +#define NRF_FUN_HPF_MSPI_DQ5 NRF_FUN_SDP_MSPI_DQ5 +/** High-Performance Framework MSPI data pin 6 */ +#define NRF_FUN_HPF_MSPI_DQ6 NRF_FUN_SDP_MSPI_DQ6 +/** High-Performance Framework MSPI data pin 7 */ +#define NRF_FUN_HPF_MSPI_DQ7 NRF_FUN_SDP_MSPI_DQ7 +/** High-Performance Framework MSPI chip select pin 0 */ +#define NRF_FUN_HPF_MSPI_CS0 NRF_FUN_SDP_MSPI_CS0 +/** High-Performance Framework MSPI chip select pin 1 */ +#define NRF_FUN_HPF_MSPI_CS1 NRF_FUN_SDP_MSPI_CS1 +/** High-Performance Framework MSPI chip select pin 2 */ +#define NRF_FUN_HPF_MSPI_CS2 NRF_FUN_SDP_MSPI_CS2 +/** High-Performance Framework MSPI chip select pin 3 */ +#define NRF_FUN_HPF_MSPI_CS3 NRF_FUN_SDP_MSPI_CS3 +/** High-Performance Framework MSPI chip select pin 4 */ +#define NRF_FUN_HPF_MSPI_CS4 NRF_FUN_SDP_MSPI_CS4 /** TDM SCK in master mode */ #define NRF_FUN_TDM_SCK_M 71U /** TDM SCK in slave mode */ From 27ab3e250737cad1175ef40fd9bcddcc434dd309 Mon Sep 17 00:00:00 2001 From: Joakim Andersson Date: Fri, 20 Nov 2020 14:44:03 +0100 Subject: [PATCH 1677/2141] [nrf noup] Bluetooth: update experimental for qualification MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update Kconfig options for qualification: - Remove experimental on qualified feature. - Add experimental on unqualified feature. - BT_L2CAP_ECRED is not marked as experimental upstream and we qualify it downstream. Signed-off-by: Joakim Andersson Signed-off-by: Trond Einar Snekvik Signed-off-by: Martí Bolívar Signed-off-by: Robert Lubos Signed-off-by: Dominik Ermel Signed-off-by: Ingar Kulbrandstad Signed-off-by: Torsten Rasmussen Signed-off-by: Herman Berget Signed-off-by: Tomasz Moń Signed-off-by: Théo Battrel (cherry picked from commit a29db90830b199845cccdcf81544fc0129a228f9) --- subsys/bluetooth/controller/Kconfig | 4 +++- subsys/bluetooth/host/Kconfig.l2cap | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/subsys/bluetooth/controller/Kconfig b/subsys/bluetooth/controller/Kconfig index 926fc060a89c..ca1a5bbede4d 100644 --- a/subsys/bluetooth/controller/Kconfig +++ b/subsys/bluetooth/controller/Kconfig @@ -138,10 +138,12 @@ config HAS_BT_CTLR bool config BT_LL_SW_SPLIT - bool "Software-based Bluetooth LE Link Layer" + bool "Software-based Bluetooth LE Link Layer [EXPERIMENTAL]" default y depends on DT_HAS_ZEPHYR_BT_HCI_LL_SW_SPLIT_ENABLED select HAS_BT_CTLR + select EXPERIMENTAL + select ENTROPY_GENERATOR help Use Zephyr software Bluetooth LE Link Layer ULL LLL split implementation. diff --git a/subsys/bluetooth/host/Kconfig.l2cap b/subsys/bluetooth/host/Kconfig.l2cap index 2841e7d8a129..34e862378c5e 100644 --- a/subsys/bluetooth/host/Kconfig.l2cap +++ b/subsys/bluetooth/host/Kconfig.l2cap @@ -52,7 +52,7 @@ config BT_L2CAP_DYNAMIC_CHANNEL allowing the creation of dynamic L2CAP Channels. config BT_L2CAP_ECRED - bool "L2CAP Enhanced Credit Based Flow Control support" + bool "L2CAP Enhanced Credit Based Flow Control support [EXPERIMENTAL]" depends on BT_L2CAP_DYNAMIC_CHANNEL help This option enables support for LE Connection oriented Channels with From d537f6daddf9c4e699ff433ee748ee6d020e312a Mon Sep 17 00:00:00 2001 From: Georgios Vasilakis Date: Fri, 21 Mar 2025 14:43:43 +0100 Subject: [PATCH 1678/2141] [nrf noup] tests: crypto: Set size for PSA slot noup since this option does not exist upstream. The Oberon PSA core has an option to manually set the buffer size of the PSA key slots in bytes. This option here: MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE This option has a default value of 16 since it directly affects the memory usage. The crypto tests use a secp256r1 key and thus since the public key for this key is 65 bytes long we need to set the option in the sample. Signed-off-by: Georgios Vasilakis (cherry picked from commit 39b7cf4e0af13a0a08afd68b0b94976dc0ce8bac) --- tests/crypto/secp256r1/mbedtls.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/crypto/secp256r1/mbedtls.conf b/tests/crypto/secp256r1/mbedtls.conf index bbc2eb0e6563..c4ea620de55f 100644 --- a/tests/crypto/secp256r1/mbedtls.conf +++ b/tests/crypto/secp256r1/mbedtls.conf @@ -1,6 +1,7 @@ CONFIG_MBEDTLS=y CONFIG_MBEDTLS_PSA_CRYPTO_C=y CONFIG_MBEDTLS_PSA_P256M_DRIVER_ENABLED=y +CONFIG_MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE=65 CONFIG_MBEDTLS_PSA_STATIC_KEY_SLOTS=y CONFIG_MBEDTLS_PSA_KEY_SLOT_COUNT=2 From b856d4e37c8b229f4be6975e58f01f3cfc5f8d20 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Tue, 8 Apr 2025 10:16:33 +0100 Subject: [PATCH 1679/2141] [nrf noup] mgmt: mcumgr: Fix nRF5340 network core hook Fixes an issue whereby just enabling hooks would enable the nrf5340 network core hook despite lacking other requirements Signed-off-by: Jamie McCrae (cherry picked from commit 730c36b0bbb62f31816baeb0f3efaa84dc522c90) --- subsys/mgmt/mcumgr/CMakeLists.txt | 13 +++++++------ subsys/mgmt/mcumgr/Kconfig | 2 +- subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c | 15 +++------------ subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig | 8 ++++++++ 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/subsys/mgmt/mcumgr/CMakeLists.txt b/subsys/mgmt/mcumgr/CMakeLists.txt index ad088eca0677..3bb21e16f798 100644 --- a/subsys/mgmt/mcumgr/CMakeLists.txt +++ b/subsys/mgmt/mcumgr/CMakeLists.txt @@ -17,10 +17,11 @@ add_subdirectory_ifdef(CONFIG_SMP_CLIENT smp_client) zephyr_library_link_libraries(mgmt_mcumgr) -if (CONFIG_BOOT_IMAGE_ACCESS_HOOKS) - zephyr_include_directories( - ${ZEPHYR_MCUBOOT_MODULE_DIR}/boot/bootutil/include - ${ZEPHYR_MCUBOOT_MODULE_DIR}/boot/zephyr/include - ) - zephyr_library_sources(bootutil_hooks/nrf53_hooks.c) +if(CONFIG_MCUMGR_GRP_IMG_NRF5340_BOOTUTIL_HOOK) + zephyr_include_directories( + ${ZEPHYR_MCUBOOT_MODULE_DIR}/boot/bootutil/include + ${ZEPHYR_MCUBOOT_MODULE_DIR}/boot/zephyr/include + ) + + zephyr_library_sources(bootutil_hooks/nrf53_hooks.c) endif() diff --git a/subsys/mgmt/mcumgr/Kconfig b/subsys/mgmt/mcumgr/Kconfig index 1c6a3a2a5162..c45cb7f81d6b 100644 --- a/subsys/mgmt/mcumgr/Kconfig +++ b/subsys/mgmt/mcumgr/Kconfig @@ -6,7 +6,7 @@ menuconfig MCUMGR bool "mcumgr Support" depends on NET_BUF depends on ZCBOR - imply BOOT_IMAGE_ACCESS_HOOKS if (SOC_NRF5340_CPUAPP_QKAA && MCUMGR_GRP_IMG) + imply BOOT_IMAGE_ACCESS_HOOKS if SOC_NRF5340_CPUAPP && MCUMGR_GRP_IMG && MCUBOOT_NETWORK_CORE_IMAGE_NUMBER > -1 help This option enables the mcumgr management library. diff --git a/subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c b/subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c index f1ac8a168e65..b372ce4e4945 100644 --- a/subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c +++ b/subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c @@ -8,19 +8,10 @@ #include #include "bootutil/bootutil_public.h" -#if CONFIG_MCUBOOT_NETWORK_CORE_IMAGE_NUMBER != -1 -/* Sysbuild */ -#define NET_CORE_IMAGE CONFIG_MCUBOOT_NETWORK_CORE_IMAGE_NUMBER -#else -/* Legacy child/parent */ -#define NET_CORE_IMAGE 1 -#endif - -int boot_read_swap_state_primary_slot_hook(int image_index, - struct boot_swap_state *state) +int boot_read_swap_state_primary_slot_hook(int image_index, struct boot_swap_state *state) { - if (image_index == NET_CORE_IMAGE) { - /* Pretend that primary slot of image 1 unpopulated */ + if (image_index == CONFIG_MCUBOOT_NETWORK_CORE_IMAGE_NUMBER) { + /* Pretend that primary slot of the network core update image is unpopulated */ state->magic = BOOT_MAGIC_UNSET; state->swap_type = BOOT_SWAP_TYPE_NONE; state->image_num = image_index; diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig b/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig index 5f122fcf71fc..d95f9b5849a5 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig @@ -227,6 +227,14 @@ config MCUMGR_GRP_IMG_QSPI_XIP_SPLIT_IMAGE sysbuild if needed. This enables selecting the correct slot when running a QSPI XIP split image application in DirectXIP mode. +config MCUMGR_GRP_IMG_NRF5340_BOOTUTIL_HOOK + bool "nRF5340 network core bootutil hook" + depends on SOC_NRF5340_CPUAPP && BOOT_IMAGE_ACCESS_HOOKS && MCUBOOT_NETWORK_CORE_IMAGE_NUMBER > -1 + default y + help + This option will enable a bootutil hook that populates the network core update image + slot with dummy data to allow for uploading a firmware update to the network core. + module = MCUMGR_GRP_IMG module-str = mcumgr_grp_img source "subsys/logging/Kconfig.template.log_config" From ac5ae77bd6307a11c0b68201a1f7fdddfa435441 Mon Sep 17 00:00:00 2001 From: Gordon Klaus Date: Tue, 8 Apr 2025 17:56:00 +0200 Subject: [PATCH 1680/2141] [nrf noup] tests: bluetooth: tester: Enable PSA RNG on nRF54H20 The PSA is a cryptographically secure random number generator. It will be enabled by default, eventually, For now, enable it manually. Signed-off-by: Gordon Klaus (cherry picked from commit 892f60bbd28790a22fbaa5631fd32aaa6a6f755f) --- .../boards/nrf54h20dk_nrf54h20_cpuapp.conf | 7 ++++ .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 14 +++++++ tests/bluetooth/tester/sysbuild.cmake | 7 ---- .../boards/nrf54h20dk_nrf54h20_cpurad.conf | 40 +++++++++++++++++++ .../boards/nrf54h20dk_nrf54h20_cpurad.overlay | 13 ++++++ .../tester/sysbuild/hci_ipc/prj.conf | 23 +++++++++++ 6 files changed, 97 insertions(+), 7 deletions(-) create mode 100644 tests/bluetooth/tester/sysbuild/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.conf create mode 100644 tests/bluetooth/tester/sysbuild/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.overlay create mode 100644 tests/bluetooth/tester/sysbuild/hci_ipc/prj.conf diff --git a/tests/bluetooth/tester/boards/nrf54h20dk_nrf54h20_cpuapp.conf b/tests/bluetooth/tester/boards/nrf54h20dk_nrf54h20_cpuapp.conf index 5bb1c4d82846..51b0ef5fa8d4 100644 --- a/tests/bluetooth/tester/boards/nrf54h20dk_nrf54h20_cpuapp.conf +++ b/tests/bluetooth/tester/boards/nrf54h20dk_nrf54h20_cpuapp.conf @@ -22,3 +22,10 @@ CONFIG_LOG_DEFAULT_LEVEL=3 CONFIG_BTTESTER_LOG_LEVEL_DBG=y CONFIG_UART_INTERRUPT_DRIVEN=y + +# Enable PSA RNG +CONFIG_PSA_CRYPTO_DRIVER_OBERON=n +CONFIG_PSA_SSF_CRYPTO_CLIENT=y +CONFIG_SSF_PSA_CRYPTO_SERVICE_ENABLED=y +CONFIG_MBEDTLS_PSA_CRYPTO_C=y +CONFIG_NRF_SECURITY=y diff --git a/tests/bluetooth/tester/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/bluetooth/tester/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index e6d4f675f57a..4f9de686b7e5 100644 --- a/tests/bluetooth/tester/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/tests/bluetooth/tester/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -12,3 +12,17 @@ status = "okay"; hw-flow-control; }; + +// Enable PSA RNG +/ { + chosen { + zephyr,entropy = &psa_rng; + }; + + psa_rng: psa-rng { + compatible = "zephyr,psa-crypto-rng"; + status = "okay"; + }; + + /delete-node/ prng; +}; diff --git a/tests/bluetooth/tester/sysbuild.cmake b/tests/bluetooth/tester/sysbuild.cmake index bcd564733c53..b640a7d04936 100644 --- a/tests/bluetooth/tester/sysbuild.cmake +++ b/tests/bluetooth/tester/sysbuild.cmake @@ -18,13 +18,6 @@ if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) ) endif() - if(SB_CONFIG_SOC_NRF54H20_CPUAPP) - set(${NET_APP}_CONF_FILE - ${NET_APP_SRC_DIR}/nrf54h20_cpurad-bt_ll_softdevice.conf - CACHE INTERNAL "" - ) - endif() - set(${NET_APP}_EXTRA_CONF_FILE ${APP_DIR}/overlay-bt_ll_sw_split.conf CACHE INTERNAL "" diff --git a/tests/bluetooth/tester/sysbuild/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.conf b/tests/bluetooth/tester/sysbuild/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.conf new file mode 100644 index 000000000000..b7d64a9e6a08 --- /dev/null +++ b/tests/bluetooth/tester/sysbuild/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.conf @@ -0,0 +1,40 @@ +CONFIG_IPC_SERVICE=y +CONFIG_MBOX=y + +CONFIG_ISR_STACK_SIZE=1024 +CONFIG_IDLE_STACK_SIZE=256 +CONFIG_MAIN_STACK_SIZE=1024 +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=512 +CONFIG_IPC_SERVICE_BACKEND_RPMSG_WQ_STACK_SIZE=512 +CONFIG_HEAP_MEM_POOL_SIZE=8192 + +CONFIG_BT=y +CONFIG_BT_HCI_RAW=y + +CONFIG_BT_BUF_EVT_RX_COUNT=16 +CONFIG_BT_BUF_EVT_RX_SIZE=255 +CONFIG_BT_BUF_ACL_RX_SIZE=255 +CONFIG_BT_BUF_ACL_TX_SIZE=251 +CONFIG_BT_BUF_CMD_TX_SIZE=255 + +# Host +CONFIG_BT_BROADCASTER=y +CONFIG_BT_PERIPHERAL=y +CONFIG_BT_OBSERVER=y +CONFIG_BT_CENTRAL=y +CONFIG_BT_EXT_ADV=y +CONFIG_BT_PER_ADV=y +CONFIG_BT_PER_ADV_SYNC=y + +# Controller +CONFIG_BT_LL_SW_SPLIT=n +CONFIG_BT_LL_SOFTDEVICE=y +CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 +CONFIG_BT_CTLR_SCAN_DATA_LEN_MAX=191 + +# Enable PSA RNG +CONFIG_PSA_CRYPTO_DRIVER_OBERON=n +CONFIG_PSA_SSF_CRYPTO_CLIENT=y +CONFIG_SSF_PSA_CRYPTO_SERVICE_ENABLED=y +CONFIG_MBEDTLS_PSA_CRYPTO_C=y +CONFIG_NRF_SECURITY=y diff --git a/tests/bluetooth/tester/sysbuild/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.overlay b/tests/bluetooth/tester/sysbuild/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.overlay new file mode 100644 index 000000000000..e34567fe834a --- /dev/null +++ b/tests/bluetooth/tester/sysbuild/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.overlay @@ -0,0 +1,13 @@ +// Enable PSA RNG +/ { + chosen { + zephyr,entropy = &psa_rng; + }; + + psa_rng: psa-rng { + compatible = "zephyr,psa-crypto-rng"; + status = "okay"; + }; + + /delete-node/ prng; +}; diff --git a/tests/bluetooth/tester/sysbuild/hci_ipc/prj.conf b/tests/bluetooth/tester/sysbuild/hci_ipc/prj.conf new file mode 100644 index 000000000000..08b1aed9e7f6 --- /dev/null +++ b/tests/bluetooth/tester/sysbuild/hci_ipc/prj.conf @@ -0,0 +1,23 @@ +CONFIG_IPC_SERVICE=y +CONFIG_MBOX=y + +CONFIG_HEAP_MEM_POOL_SIZE=4096 + +CONFIG_MAIN_STACK_SIZE=512 +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=512 + +CONFIG_BT=y +CONFIG_BT_HCI_RAW=y +CONFIG_BT_MAX_CONN=16 + + +# Workaround: Unable to allocate command buffer when using K_NO_WAIT since +# Host number of completed commands does not follow normal flow control. +CONFIG_BT_BUF_CMD_TX_COUNT=10 + +# Enable and adjust the below value as necessary +# CONFIG_BT_BUF_EVT_RX_COUNT=16 +# CONFIG_BT_BUF_EVT_RX_SIZE=255 +# CONFIG_BT_BUF_ACL_RX_SIZE=255 +# CONFIG_BT_BUF_ACL_TX_SIZE=251 +# CONFIG_BT_BUF_CMD_TX_SIZE=255 From 8e2a74920f8915c700153a10fd592c0ca96420ec Mon Sep 17 00:00:00 2001 From: Carles Cufi Date: Fri, 30 Nov 2018 14:07:56 +0100 Subject: [PATCH 1681/2141] [nrf noup] ci: NCS-specific CI tweaks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Necessary changes for NCS CI. - Add a Jenkinsfile - Add a commit-tags workflow: This enables sauce tag checking in sdk-zephyr - compliance.yml: Disable check for merge commits, since we have upmerges downstream. Also, since in the code we refer to Kconfig symbols that are defined in the sdk-nrf repository, the Kconfig checks ((SysBuild)Kconfig, (SysBuild)KconfigBasic and (SysBuild)KconfigBasicNoModules) will not pass so exclude them. Also, disable any maintainers-related checks - scripts/gitlint: Extend the max commit line lengths for Gitlint to account for sauce tags - Adapt to the changes in: https://github.com/nrfconnect/action-commit-tags/pull/4 Signed-off-by: Carles Cufi Signed-off-by: Dominik Ermel Signed-off-by: Martí Bolívar Signed-off-by: Vinayak Kariappa Chettimada Signed-off-by: Krishna T Signed-off-by: Dominik Ermel (cherry picked from commit ad003a38b2a4230828df44ea025f179a64256947) --- .github/workflows/commit-tags.yml | 28 ++++++++++++++++++++++++++ .github/workflows/compliance.yml | 13 +++++------- Jenkinsfile | 5 +++++ scripts/gitlint/zephyr_commit_rules.py | 4 ++-- 4 files changed, 40 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/commit-tags.yml create mode 100644 Jenkinsfile diff --git a/.github/workflows/commit-tags.yml b/.github/workflows/commit-tags.yml new file mode 100644 index 000000000000..828f02971678 --- /dev/null +++ b/.github/workflows/commit-tags.yml @@ -0,0 +1,28 @@ +name: Commit tags + +on: + pull_request: + types: [synchronize, opened, reopened, edited, labeled, unlabeled, + milestoned, demilestoned, assigned, unassigned, ready_for_review, + review_requested] + +jobs: + commit_tags: + runs-on: ubuntu-22.04 + name: Run commit tags checks on patch series (PR) + steps: + - name: Update PATH for west + run: | + echo "$HOME/.local/bin" >> $GITHUB_PATH + + - name: Checkout the code + uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.head.sha }} + fetch-depth: 0 + + - name: Run the commit tags + uses: nrfconnect/action-commit-tags@main + with: + target: . + upstream: zephyrproject-rtos/zephyr/main diff --git a/.github/workflows/compliance.yml b/.github/workflows/compliance.yml index 9d19b5a69e65..0e39baa4732d 100644 --- a/.github/workflows/compliance.yml +++ b/.github/workflows/compliance.yml @@ -34,8 +34,8 @@ jobs: git config --global user.name "Your Name" git remote -v # Ensure there's no merge commits in the PR - [[ "$(git rev-list --merges --count origin/${BASE_REF}..)" == "0" ]] || \ - (echo "::error ::Merge commits not allowed, rebase instead";false) + #[[ "$(git rev-list --merges --count origin/${BASE_REF}..)" == "0" ]] || \ + #(echo "::error ::Merge commits not allowed, rebase instead";false) rm -fr ".git/rebase-apply" rm -fr ".git/rebase-merge" git rebase origin/${BASE_REF} @@ -72,12 +72,9 @@ jobs: git log --pretty=oneline | head -n 10 # Increase rename limit to allow for large PRs git config diff.renameLimit 10000 - excludes="-e KconfigBasic -e SysbuildKconfigBasic -e ClangFormat" - # The signed-off-by check for dependabot should be skipped - if [ "${{ github.actor }}" == "dependabot[bot]" ]; then - excludes="$excludes -e Identity" - fi - ./scripts/ci/check_compliance.py --annotate $excludes -c origin/${BASE_REF}.. + ./scripts/ci/check_compliance.py --annotate -e KconfigBasic -e SysbuildKconfigBasic \ + -e Kconfig -e SysbuildKconfig -e KconfigBasicNoModules -e SysbuildKconfigBasicNoModules \ + -e ModulesMaintainers -c origin/${BASE_REF}.. - name: upload-results uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 000000000000..3b9cf0022399 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,5 @@ +@Library("CI_LIB") _ + +def pipeline = new ncs.sdk_zephyr.Main() + +pipeline.run(JOB_NAME) diff --git a/scripts/gitlint/zephyr_commit_rules.py b/scripts/gitlint/zephyr_commit_rules.py index a2c9cd3cb7fe..ef317e22684c 100644 --- a/scripts/gitlint/zephyr_commit_rules.py +++ b/scripts/gitlint/zephyr_commit_rules.py @@ -78,7 +78,7 @@ class TitleMaxLengthRevert(LineRule): name = "title-max-length-no-revert" id = "UC5" target = CommitMessageTitle - options_spec = [IntOption('line-length', 75, "Max line length")] + options_spec = [IntOption('line-length', 120, "Max line length")] violation_message = "Commit title exceeds max length ({0}>{1})" def validate(self, line, _commit): @@ -103,7 +103,7 @@ class MaxLineLengthExceptions(LineRule): name = "max-line-length-with-exceptions" id = "UC4" target = CommitMessageBody - options_spec = [IntOption('line-length', 75, "Max line length")] + options_spec = [IntOption('line-length', 120, "Max line length")] violation_message = "Commit message body line exceeds max length ({0}>{1})" def validate(self, line, _commit): From 3bfec9b6bca0c63e530becabc1142032524fe194 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Mon, 12 May 2025 08:47:55 +0100 Subject: [PATCH 1682/2141] [nrf noup] scripts: ci: check_compliance: Add NCS sysbuild Kconfigs Adds symbols used in NCS to the sysbuild Kconfig allow list Signed-off-by: Jamie McCrae (cherry picked from commit 77ba279d1f02d409714133c72ca70852193d5e3c) --- scripts/ci/check_compliance.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index 4ef7c81cfd0c..d52f9c158783 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -1445,6 +1445,30 @@ class SysbuildKconfigCheck(KconfigCheck): "OTHER_APP_IMAGE_PATH", # Used in sysbuild documentation as example "SECOND_SAMPLE", # Used in sysbuild documentation # zephyr-keep-sorted-stop + + # NCS-specific allowlist + # zephyr-keep-sorted-start re(^\s+") + "APP_CPUNET_RUN", # Used by sample + "APP_DFU", # Used by sample + "BT_FAST_PAIR", # Legacy/removed, used in migration documentation + "COMP_DATA_LAYOUT_ARRAY", # Used by test + "COMP_DATA_LAYOUT_MULTIPLE", # Used by test + "COMP_DATA_LAYOUT_SINGLE", # Used by test + "DTM_NO_DFE", # Used by DTM application + "DTM_TRANSPORT_HCI", # Used by DTM application + "INCLUDE_REMOTE_IMAGE", # Used by machine learning application + "MCUBOOT_FPROTECT_ALLOW_COMBINED_REGIONS", # Used in migration documentation + "ML_APP_INCLUDE_REMOTE_IMAGE", # Used by machine learning application + "ML_APP_REMOTE_BOARD", # Used by machine learning application + "MY_APP_IMAGE_ABC", # Used in documentation + "REMOTE_GLOBAL_DOMAIN_CLOCK_FREQUENCY_SWITCHING", # Used in tests + "SOC_FLASH_NRF_RADIO_SYNC_RPC", # Used in documentation + "SUIT_ENVELOPE_", # Used by jinja + "SUIT_ENVELOPE_SEQUENCE_NUM", # Legacy/removed, used in migration documentation + "SUIT_MPI_", # Used by jinja + "SUIT_RECOVERY_APPLICATION_CUSTOM", # Used in documentation + "SUPPORT_NETCORE_PERIPHERAL_RADIO_TEST", # Used by wifi radio test sample + # zephyr-keep-sorted-stop } From aa22106bd1ca6c8be630a91683ab1c0524d7d4ef Mon Sep 17 00:00:00 2001 From: Robert Stypa Date: Wed, 18 Jun 2025 07:45:47 +0200 Subject: [PATCH 1683/2141] [nrf noup] ci: Update CI-boot-test patterns and remove SUIT labels Add boards/nordic/**/* to the CI-boot-test scope and remove SUIT labels. Signed-off-by: Robert Stypa (cherry picked from commit b68aa7bd7be4df7d7d6cb924c1f963cb590b9ce9) --- .github/test-spec.yml | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/.github/test-spec.yml b/.github/test-spec.yml index 6da6bdbaa87d..5337249f7dab 100644 --- a/.github/test-spec.yml +++ b/.github/test-spec.yml @@ -39,6 +39,7 @@ # Not necessary to run tests on changes to this repo. "CI-boot-test": + - "boards/nordic/**/*" - "subsys/mgmt/mcumgr/**/*" - "subsys/dfu/**/*" - "include/mgmt/mcumgr/**/*" @@ -364,29 +365,3 @@ - "tests/boards/nordic/**/*" - "tests/drivers/**/*" - "tests/kernel/**/*" - -"CI-suit-dfu-test": - - "subsys/mgmt/mcumgr/**/*" - - "include/mgmt/mcumgr/**/*" - - "samples/subsys/mgmt/mcumgr/smp_svr/**/*" - - "subsys/bluetooth/**/*" - - "drivers/bluetooth/**/*" - - "drivers/flash/**/*" - - "drivers/spi/**/*" - - "drivers/mbox/**/*" - - "drivers/serial/**/*" - - "drivers/console/**/*" - - "drivers/gpio/**/*" - - "dts/common/nordic/*" - - "dts/arm/nordic/nrf54h*/**/*" - - "dts/riscv/nordic/nrf54h*/**/*" - - "boards/nordic/nrf54h*/**/*" - - "soc/nordic/nrf54h/**/*" - - "include/zephyr/**/*" - - "subsys/logging/**/*" - - "subsys/tracing/**/*" - - "scripts/west_commands/build.py" - - "scripts/west_commands/flash.py" - - "scripts/west_commands/runners/nrfutil.py" - - "scripts/west_commands/runners/core.py" - - "scripts/west_commands/runners/nrf_common.py" From b93147c7494304f3f332f01934c3fec47e3f87d2 Mon Sep 17 00:00:00 2001 From: Richa Pandey Date: Thu, 19 Jun 2025 11:07:37 +0200 Subject: [PATCH 1684/2141] [nrf noup] zephyr: doc: fix board page Fixed board page in zephyr. Signed-off-by: Richa Pandey (cherry picked from commit 45023b2d4f10fbbcb6f0be9da7d666a1cc5dee46) --- boards/index.rst | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/boards/index.rst b/boards/index.rst index 3cc92770cfeb..2ffe426fc24b 100644 --- a/boards/index.rst +++ b/boards/index.rst @@ -12,33 +12,8 @@ template available under :zephyr_file:`doc/templates/board.tmpl`. Shields are hardware add-ons that can be stacked on top of a board to add extra functionality. Refer to the :ref:`shield_porting_guide` for more information on how to port a shield. -.. admonition:: Search Tips - :class: dropdown - - * Use the form below to filter the list of supported boards and shields. If a field is left - empty, it will not be used in the filtering process. - - * Filtering by name and vendor is available for both boards and shields. The rest of the fields - apply only to boards. - - * A board/shield must meet **all** criteria selected across different fields. For example, if you - select both a vendor and an architecture, only boards that match both will be displayed. Within - a single field, selecting multiple options (such as two architectures) will show boards - matching **either** option. - - * The list of supported hardware features for each board is automatically generated using - information from the Devicetree. It may not be reflecting the full list of supported features - since some of them may not be enabled by default. - - * Can't find your exact board? Don't worry! If a similar board with the same or a closely related - MCU exists, you can use it as a :ref:`starting point ` for adding - support for your own board. - .. toctree:: :maxdepth: 2 :glob: - :hidden: */index - -.. zephyr:board-catalog:: From 8e030eadc7edc6b92ea0812b4ba85943b361765c Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Tue, 10 Jun 2025 23:20:32 +0200 Subject: [PATCH 1685/2141] [nrf noup] bluetooth: host: Add support for bonding with same peer This commit adds a new Kconfig option by enabling which Host will keep bonding with the same Central instead of rejecting pairing. Brief implementation details: This implementation adds a new flag to bt_keys struct: BT_KEYS_ID_CONFLICT. The flag is set, when: - bonding with the same peer and conflict identified - when loading conflicting keys from persistent storage. When bonding and conflict is identified, the new keys aren't added to the Resolving List immediately. Instead, the old keys stay in the Resolving List. When start advertising, Host finds conflicting keys that are already added to the Resolving List and substitues them. If, however, there is another advertiser already started for the added keys, the new request is reject and advertising start function returns -EPERM. This is supported by Peripheral role only for now. Signed-off-by: Pavel Vasilyev (cherry picked from commit 93b8dd96508ddc5b86ea2f34ea57501fce5311b2) (cherry picked from commit 1890dbafd139c48deecd082099fb036fb4ca1649) --- include/zephyr/bluetooth/bluetooth.h | 10 ++ subsys/bluetooth/host/Kconfig | 18 +++ subsys/bluetooth/host/adv.c | 52 +++++++ subsys/bluetooth/host/adv.h | 1 + subsys/bluetooth/host/hci_core.h | 23 ++- subsys/bluetooth/host/id.c | 219 ++++++++++++++++++++++++--- subsys/bluetooth/host/id.h | 23 +++ subsys/bluetooth/host/keys.c | 79 +++++++++- subsys/bluetooth/host/keys.h | 6 + subsys/bluetooth/host/smp.c | 18 ++- tests/bluetooth/host/id/mocks/adv.c | 1 + tests/bluetooth/host/id/mocks/adv.h | 4 +- tests/bluetooth/host/id/mocks/keys.c | 1 + tests/bluetooth/host/id/mocks/keys.h | 4 +- 14 files changed, 427 insertions(+), 32 deletions(-) diff --git a/include/zephyr/bluetooth/bluetooth.h b/include/zephyr/bluetooth/bluetooth.h index 1656f1f56844..a769b49967fb 100644 --- a/include/zephyr/bluetooth/bluetooth.h +++ b/include/zephyr/bluetooth/bluetooth.h @@ -1370,6 +1370,10 @@ struct bt_le_per_adv_param { * This error code is only guaranteed when using Zephyr * controller, for other controllers code returned in * this case may be -EIO. + * @return -EPERM When @kconfig{CONFIG_BT_PRIVACY} and + * @kconfig{CONFIG_BT_ID_AUTO_SWAP_MATCHING_BONDS} are enabled and connectable + * advertising is requested, and the given local identity has a conflicting + * key with another local identity for which advertising is already started. */ int bt_le_adv_start(const struct bt_le_adv_param *param, const struct bt_data *ad, size_t ad_len, @@ -1497,6 +1501,12 @@ struct bt_le_ext_adv_start_param { * * @param adv Advertising set object. * @param param Advertise start parameters. + * + * @return Zero on success or (negative) error code otherwise. + * @return -EPERM When @kconfig{CONFIG_BT_PRIVACY} and + * @kconfig{CONFIG_BT_ID_AUTO_SWAP_MATCHING_BONDS} are enabled and connectable + * advertising is requested, and the given local identity has a conflicting + * key with another local identity for which advertising is already started. */ int bt_le_ext_adv_start(struct bt_le_ext_adv *adv, const struct bt_le_ext_adv_start_param *param); diff --git a/subsys/bluetooth/host/Kconfig b/subsys/bluetooth/host/Kconfig index 72deb4343dc4..4e275e6cc285 100644 --- a/subsys/bluetooth/host/Kconfig +++ b/subsys/bluetooth/host/Kconfig @@ -658,6 +658,24 @@ config BT_ID_UNPAIR_MATCHING_BONDS link-layer. The Host does not have control over this acknowledgment, and the order of distribution is fixed by the specification. +config BT_ID_AUTO_SWAP_MATCHING_BONDS + bool "Automatically swap conflicting entries in the Resolving List" + depends on !BT_ID_UNPAIR_MATCHING_BONDS + depends on BT_PRIVACY && BT_PERIPHERAL && !BT_CENTRAL + help + If this option is enabled, the Host will not add a new bond with + the same peer address (or IRK) to the Resolving List if there is + already a bond with the same peer address (or IRK) on another local + identity. + + In case of Peripheral, the Host will swap the existing entry in the + Resolving List with the new one, so that the new bond will be used for + address resolution for the new local identity if the device starts + advertising with the new local identity. + + Important: this option is supported exclusively in the Peripheral + role. Excluding the Central role. + config BT_ID_ALLOW_UNAUTH_OVERWRITE bool "Allow unauthenticated pairing with same peer with other local identity" depends on !BT_SMP_ALLOW_UNAUTH_OVERWRITE diff --git a/subsys/bluetooth/host/adv.c b/subsys/bluetooth/host/adv.c index 749495bcb563..ab86e8b8858f 100644 --- a/subsys/bluetooth/host/adv.c +++ b/subsys/bluetooth/host/adv.c @@ -235,6 +235,25 @@ struct bt_le_ext_adv *bt_hci_adv_lookup_handle(uint8_t handle) #endif /* CONFIG_BT_BROADCASTER */ #endif /* defined(CONFIG_BT_EXT_ADV) */ +struct bt_le_ext_adv *bt_adv_lookup_by_id(uint8_t id) +{ +#if defined(CONFIG_BT_EXT_ADV) + for (size_t i = 0; i < ARRAY_SIZE(adv_pool); i++) { + if (atomic_test_bit(adv_pool[i].flags, BT_ADV_CREATED) && + adv_pool[i].id == id) { + return &adv_pool[i]; + } + } +#else + if (atomic_test_bit(bt_dev.adv.flags, BT_ADV_CREATED) && bt_dev.adv.id == id) { + return &bt_dev.adv; + } +#endif + + return NULL; +} + + void bt_le_ext_adv_foreach(void (*func)(struct bt_le_ext_adv *adv, void *data), void *data) { @@ -928,6 +947,14 @@ static int adv_start_legacy(struct bt_le_ext_adv *adv, adv->id = param->id; bt_dev.adv_conn_id = adv->id; + if (IS_ENABLED(CONFIG_BT_ID_AUTO_SWAP_MATCHING_BONDS)) { + err = bt_id_resolving_list_check_and_update(adv->id, param->peer); + if (err) { + LOG_ERR("Failed to check and update resolving list: %d", err); + return err; + } + } + err = bt_id_set_adv_own_addr(adv, param->options, dir_adv, &set_param.own_addr_type); if (err) { @@ -1223,6 +1250,15 @@ int bt_le_adv_start_ext(struct bt_le_ext_adv *adv, } adv->id = param->id; + + if (IS_ENABLED(CONFIG_BT_ID_AUTO_SWAP_MATCHING_BONDS)) { + err = bt_id_resolving_list_check_and_update(adv->id, param->peer); + if (err) { + LOG_ERR("Failed to check and update resolving list: %d", err); + return err; + } + } + err = le_ext_adv_param_set(adv, param, sd != NULL); if (err) { return err; @@ -1613,6 +1649,22 @@ int bt_le_ext_adv_start(struct bt_le_ext_adv *adv, return -EALREADY; } + if (IS_ENABLED(CONFIG_BT_ID_AUTO_SWAP_MATCHING_BONDS)) { + const bt_addr_le_t *peer; + + if (bt_addr_le_eq(&adv->target_addr, BT_ADDR_LE_ANY)) { + peer = NULL; + } else { + peer = &adv->target_addr; + } + + err = bt_id_resolving_list_check_and_update(adv->id, peer); + if (err) { + LOG_ERR("Failed to check and update resolving list: %d", err); + return err; + } + } + if (IS_ENABLED(CONFIG_BT_PERIPHERAL) && atomic_test_bit(adv->flags, BT_ADV_CONNECTABLE)) { err = le_adv_start_add_conn(adv, &conn); diff --git a/subsys/bluetooth/host/adv.h b/subsys/bluetooth/host/adv.h index 65ad51135ce0..1bd15854db28 100644 --- a/subsys/bluetooth/host/adv.h +++ b/subsys/bluetooth/host/adv.h @@ -25,3 +25,4 @@ int bt_le_adv_set_enable_ext(struct bt_le_ext_adv *adv, int bt_le_adv_set_enable_legacy(struct bt_le_ext_adv *adv, bool enable); int bt_le_lim_adv_cancel_timeout(struct bt_le_ext_adv *adv); void bt_adv_reset_adv_pool(void); +struct bt_le_ext_adv *bt_adv_lookup_by_id(uint8_t id); diff --git a/subsys/bluetooth/host/hci_core.h b/subsys/bluetooth/host/hci_core.h index 315db2d38884..bb91c3732dd5 100644 --- a/subsys/bluetooth/host/hci_core.h +++ b/subsys/bluetooth/host/hci_core.h @@ -497,7 +497,28 @@ struct bt_keys; void bt_id_add(struct bt_keys *keys); void bt_id_del(struct bt_keys *keys); -struct bt_keys *bt_id_find_conflict(struct bt_keys *candidate); +/** @brief Find a conflict in the resolving list for a candidate IRK. + * + * @param candidate The candidate keys to check for conflicts. + * @param all If true, check all IRKs, otherwise check only added keys. + * + * @return The conflicting key if there is one, or NULL if no conflict was found. + */ +struct bt_keys *bt_id_find_conflict(struct bt_keys *candidate, bool all); + +/** * @brief Find multiple conflicts in the resolving list for a candidate IRK. + * + * This function iterates over all keys (added and not added to the Resolving List). If there are + * multiple conflicts, this function will return true. Otherwise, it will return false. + * + * If @c firt_conflict is not NULL, it will be set to the first found conflict. + * + * @param candidate The candidate key to check for conflicts. + * @param first_conflict Pointer to store the first found conflict, if any. Can be NULL. + * + * @return True if there are multiple conflicts, otherwise it returns false. + */ +bool bt_id_find_conflict_multiple(struct bt_keys *candidate, struct bt_keys **first_conflict); int bt_setup_random_id_addr(void); int bt_setup_public_id_addr(void); diff --git a/subsys/bluetooth/host/id.c b/subsys/bluetooth/host/id.c index a43aaef78f44..775f08182b74 100644 --- a/subsys/bluetooth/host/id.c +++ b/subsys/bluetooth/host/id.c @@ -942,9 +942,33 @@ void bt_id_pending_keys_update(void) } } +static bool keys_conflict_check(const struct bt_keys *candidate, const struct bt_keys *resident) +{ + bool addr_conflict; + bool irk_conflict; + + addr_conflict = bt_addr_le_eq(&candidate->addr, &resident->addr); + + /* All-zero IRK is "no IRK", and does not conflict with other Zero-IRKs. */ + irk_conflict = (!bt_irk_eq(&candidate->irk, &(struct bt_irk){}) && + bt_irk_eq(&candidate->irk, &resident->irk)); + + if (addr_conflict || irk_conflict) { + LOG_DBG("Resident : addr %s and IRK %s", bt_addr_le_str(&resident->addr), + bt_hex(resident->irk.val, sizeof(resident->irk.val))); + LOG_DBG("Candidate: addr %s and IRK %s", bt_addr_le_str(&candidate->addr), + bt_hex(candidate->irk.val, sizeof(candidate->irk.val))); + + return true; + } + + return false; +} + struct bt_id_conflict { struct bt_keys *candidate; struct bt_keys *found; + bool check_all_irk; }; /* The Controller Resolve List is constrained by 7.8.38 "LE Add Device To @@ -956,8 +980,6 @@ struct bt_id_conflict { static void find_rl_conflict(struct bt_keys *resident, void *user_data) { struct bt_id_conflict *conflict = user_data; - bool addr_conflict; - bool irk_conflict; __ASSERT_NO_MSG(conflict != NULL); __ASSERT_NO_MSG(conflict->candidate != NULL); @@ -970,32 +992,26 @@ static void find_rl_conflict(struct bt_keys *resident, void *user_data) } /* Test against committed bonds only. */ - if ((resident->state & BT_KEYS_ID_ADDED) == 0) { + if (!conflict->check_all_irk && (resident->state & BT_KEYS_ID_ADDED) == 0) { + /* If the resident bond is not committed, we cannot have a conflict. */ return; } - addr_conflict = bt_addr_le_eq(&conflict->candidate->addr, &resident->addr); - - /* All-zero IRK is "no IRK", and does not conflict with other Zero-IRKs. */ - irk_conflict = (!bt_irk_eq(&conflict->candidate->irk, &(struct bt_irk){}) && - bt_irk_eq(&conflict->candidate->irk, &resident->irk)); - - if (addr_conflict || irk_conflict) { - LOG_DBG("Resident : addr %s and IRK %s, id: %d", bt_addr_le_str(&resident->addr), - bt_hex(resident->irk.val, sizeof(resident->irk.val)), resident->id); - LOG_DBG("Candidate: addr %s and IRK %s, id: %d", - bt_addr_le_str(&conflict->candidate->addr), - bt_hex(conflict->candidate->irk.val, sizeof(conflict->candidate->irk.val)), - conflict->candidate->id); + if (resident->id == conflict->candidate->id) { + /* If the IDs are the same, we cannot have a conflict. */ + return; + } + if (keys_conflict_check(conflict->candidate, resident)) { conflict->found = resident; } } -struct bt_keys *bt_id_find_conflict(struct bt_keys *candidate) +struct bt_keys *bt_id_find_conflict(struct bt_keys *candidate, bool check_all_irk) { struct bt_id_conflict conflict = { .candidate = candidate, + .check_all_irk = check_all_irk, }; bt_keys_foreach_type(BT_KEYS_IRK, find_rl_conflict, &conflict); @@ -1003,6 +1019,59 @@ struct bt_keys *bt_id_find_conflict(struct bt_keys *candidate) return conflict.found; } +struct bt_id_conflict_multiple { + struct bt_keys *candidate; + struct bt_keys *found; + bool found_multiple; +}; + +void find_rl_conflict_multiple(struct bt_keys *resident, void *user_data) +{ + struct bt_id_conflict_multiple *conflict = user_data; + + __ASSERT_NO_MSG(conflict != NULL); + __ASSERT_NO_MSG(conflict->candidate != NULL); + __ASSERT_NO_MSG(resident != NULL); + + if (conflict->found_multiple) { + /* If we already found enough conflicts, we can stop searching. */ + return; + } + + if (resident->id == conflict->candidate->id) { + /* If the IDs are the same, we cannot have a conflict. */ + return; + } + + if (keys_conflict_check(conflict->candidate, resident)) { + if (conflict->found) { + conflict->found_multiple = true; + + LOG_WRN("Found multiple conflicts for %s: addr %s and IRK %s", + bt_addr_le_str(&conflict->candidate->addr), + bt_addr_le_str(&resident->addr), + bt_hex(resident->irk.val, sizeof(resident->irk.val))); + } else { + conflict->found = resident; + } + } +} + +bool bt_id_find_conflict_multiple(struct bt_keys *candidate, struct bt_keys **first_conflict) +{ + struct bt_id_conflict_multiple conflict = { + .candidate = candidate, + }; + + bt_keys_foreach_type(BT_KEYS_IRK, find_rl_conflict_multiple, &conflict); + + if (first_conflict != NULL) { + *first_conflict = conflict.found; + } + + return conflict.found_multiple; +} + void bt_id_add(struct bt_keys *keys) { CHECKIF(keys == NULL) { @@ -1265,6 +1334,122 @@ void bt_id_del(struct bt_keys *keys) bt_le_ext_adv_foreach(adv_unpause_enabled, NULL); } } + +static int conflict_check_and_replace(uint8_t id, struct bt_keys *keys) +{ + /* For the given key check if it has conflicts with other keys in the Resolving List + * (such keys have BT_KEYS_ID_ADDED state and BT_KEYS_ID_CONFLICT flag set). If it does, we + * need to remove the conflicting key from the Resolving List and add the new key. + * + * If the key is not in the Resolving List, we can add the new key right away. + * + * If advertiser for the conflicting key is enabled, we cannot remove the key from the + * Resolving List, so we return an error. + */ + + struct bt_keys *conflict; + const struct bt_le_ext_adv *adv; + + if (!(keys->flags & BT_KEYS_ID_CONFLICT)) { + LOG_DBG("Key has no conflicts for id %u addr %s", id, bt_addr_le_str(&keys->addr)); + return 0; + } + + if (keys->state & BT_KEYS_ID_ADDED) { + LOG_DBG("Key is already added to resolving list for id %u addr %s", id, + bt_addr_le_str(&keys->addr)); + return 0; + } + + /* bt_id_find_conflict returns only keys added to the Resolving List (state is + * BT_KEYS_ID_ADDED). If the key has conflict, but no keys were added (for example, if the + * last added key was removed after bt_unpair()), then this function will return NULL. Then, + * we don't need to remove a conflicting key from the Resolving List. Otherwise, we need to + * remove the conflicting key from the Resolving List before adding the new key. + */ + conflict = bt_id_find_conflict(keys, false); + if (conflict != NULL) { + __ASSERT_NO_MSG((conflict->flags & BT_KEYS_ID_CONFLICT) != 0); + + LOG_DBG("Found conflicting key with id %u addr %s", conflict->id, + bt_addr_le_str(&conflict->addr)); + + adv = bt_adv_lookup_by_id(conflict->id); + if (adv && atomic_test_bit(adv->flags, BT_ADV_ENABLED)) { + LOG_WRN("Cannot remove the conflicting key from the Resolving List while" + " advertising"); + return -EPERM; + } + + /* Drop BT_KEYS_ID_PENDING_DEL flag if we were about to delete the keys since we + * delete it here. + */ + conflict->state &= ~BT_KEYS_ID_PENDING_DEL; + bt_id_del(conflict); + } + + bt_id_add(keys); + + return 0; +} + +struct bt_id_resolve { + uint8_t id; + int err; +}; + +static void check_and_add_keys_for_id(struct bt_keys *keys, void *data) +{ + struct bt_id_resolve *resolve = data; + + if (resolve->err) { + /* Skipping other keys because we got error. */ + return; + } + + if (resolve->id != keys->id) { + /* We are only interested in keys for the given id */ + return; + } + + resolve->err = conflict_check_and_replace(resolve->id, keys); +} + +int bt_id_resolving_list_check_and_update(uint8_t id, const bt_addr_le_t *peer) +{ + int err; + + if (peer == NULL) { + struct bt_id_resolve resolve = { + .id = id, + }; + + LOG_DBG("Updating resolving list for id %u without peer address", id); + + bt_keys_foreach_type(BT_KEYS_IRK, check_and_add_keys_for_id, &resolve); + err = resolve.err; + } else { + struct bt_keys *keys; + + LOG_DBG("Updating resolving list for id %u addr %s", id, bt_addr_le_str(peer)); + + keys = bt_keys_get_addr(id, peer); + if (!keys) { + LOG_DBG("No keys found for id %u addr %s", id, bt_addr_le_str(peer)); + return -ENOENT; + } + + err = conflict_check_and_replace(id, keys); + } + + if (err) { + LOG_ERR("Failed to update resolving list for id %u addr %s (err %d)", id, + peer ? bt_addr_le_str(peer) : "NULL", err); + return err; + } + + return err; +} #endif /* defined(CONFIG_BT_SMP) */ void bt_id_get(bt_addr_le_t *addrs, size_t *count) diff --git a/subsys/bluetooth/host/id.h b/subsys/bluetooth/host/id.h index 8824d3bb496b..cd66784a5037 100644 --- a/subsys/bluetooth/host/id.h +++ b/subsys/bluetooth/host/id.h @@ -60,3 +60,26 @@ void bt_id_pending_keys_update(void); void bt_id_pending_keys_update_set(struct bt_keys *keys, uint8_t flag); void bt_id_adv_limited_stopped(struct bt_le_ext_adv *adv); + +/** + * @brief Check and update the resolving list for a given identity. + * + * This function checks if the resolving list contains the keys for the given + * identity and peer address. If the keys are not present, it adds them to the + * resolving list. If the keys are present, it checks for conflicts with + * existing keys in the resolving list. If a conflict is found, it replaces + * the conflicting key with the new key. + * + * If the peer address is NULL, it updates the resolving list for all keys that belong to the given + * identity. + * + * If for any of the keys belonging to the given identity a conflict is found and the advertiser for + * that key is enabled, the function returns an error. + * + * @param id The identity ID to check and update. + * @param peer The peer address to check against the resolving list. + * + * @return 0 on success, or a negative error code on failure. + * @return -EPERM if a conflict is found and the advertiser for the conflicting key is enabled. + */ +int bt_id_resolving_list_check_and_update(uint8_t id, const bt_addr_le_t *peer); diff --git a/subsys/bluetooth/host/keys.c b/subsys/bluetooth/host/keys.c index 1205494e856f..e2116f3bedeb 100644 --- a/subsys/bluetooth/host/keys.c +++ b/subsys/bluetooth/host/keys.c @@ -310,16 +310,57 @@ void bt_keys_add_type(struct bt_keys *keys, enum bt_keys_type type) keys->keys |= type; } +static void add_id_cb(struct k_work *work) +{ + bt_id_pending_keys_update(); +} + +static K_WORK_DEFINE(add_id_work, add_id_cb); + void bt_keys_clear(struct bt_keys *keys) { + struct bt_keys *conflict = NULL; + __ASSERT_NO_MSG(keys != NULL); LOG_DBG("%s (keys 0x%04x)", bt_addr_le_str(&keys->addr), keys->keys); + if (IS_ENABLED(CONFIG_BT_ID_AUTO_SWAP_MATCHING_BONDS) && + (keys->flags & BT_KEYS_ID_CONFLICT) != 0) { + /* We need to check how many conflicting keys left. If there is only one conflicting + * key left, we can remove the BT_KEYS_ID_CONFLICT flag from it so that Host don't + * need to check and update the Resolving List whenever this is needed. The key + * should be re-added to the Resolving List. + */ + bool found_multiple; + + found_multiple = bt_id_find_conflict_multiple(keys, &conflict); + if (conflict) { + if (found_multiple || (conflict->state & BT_KEYS_ID_ADDED) != 0) { + /* If we found multiple conflicting keys or the conflicting key + * is already added to the ID list, we don't need to clear the + * conflict flag for it and re-add it to the Resolving List. + */ + conflict = NULL; + } else { + /* Clear the conflict flag for the conflicting key */ + conflict->flags &= ~BT_KEYS_ID_CONFLICT; + } + } + } + if (keys->state & BT_KEYS_ID_ADDED) { bt_id_del(keys); } + if (conflict) { + /* Re-add the conflicting key to the Resolving List if it was the last conflicting + * key. + */ + bt_id_pending_keys_update_set(conflict, BT_KEYS_ID_PENDING_ADD); + k_work_submit(&add_id_work); + } + if (IS_ENABLED(CONFIG_BT_SETTINGS)) { /* Delete stored keys from flash */ bt_settings_delete_keys(keys->id, &keys->addr); @@ -347,6 +388,28 @@ int bt_keys_store(struct bt_keys *keys) return 0; } +static void check_and_set_id_conflict_flag(struct bt_keys *keys) +{ + struct bt_keys *conflict; + + if (!IS_ENABLED(CONFIG_BT_ID_AUTO_SWAP_MATCHING_BONDS)) { + /* If auto-swap is not enabled, we don't need to check for conflicts */ + return; + } + + /* Use bt_id_find_conflict() to check if there are any conflicting keys for the given keys. + * If there is at least one, set the BT_KEYS_ID_CONFLICT flag for both the keys and the + * conflicting key. + */ + conflict = bt_id_find_conflict(keys, true); + if (conflict != NULL) { + LOG_DBG("Found conflicting key %p.", conflict); + + keys->flags |= BT_KEYS_ID_CONFLICT; + conflict->flags |= BT_KEYS_ID_CONFLICT; + } +} + static int keys_set(const char *name, size_t len_rd, settings_read_cb read_cb, void *cb_arg) { @@ -427,6 +490,8 @@ static int keys_set(const char *name, size_t len_rd, settings_read_cb read_cb, memcpy(keys->storage_start, val, len); } + check_and_set_id_conflict_flag(keys); + LOG_DBG("Successfully restored keys for %s", bt_addr_le_str(&addr)); #if defined(CONFIG_BT_KEYS_OVERWRITE_OLDEST) if (aging_counter_val < keys->aging_counter) { @@ -436,17 +501,17 @@ static int keys_set(const char *name, size_t len_rd, settings_read_cb read_cb, return 0; } -static void add_id_cb(struct k_work *work) -{ - bt_id_pending_keys_update(); -} - -static K_WORK_DEFINE(add_id_work, add_id_cb); - static void id_add(struct bt_keys *keys, void *user_data) { __ASSERT_NO_MSG(keys != NULL); + if (keys->flags & BT_KEYS_ID_CONFLICT) { + /* If the keys have the conflict flag set, we don't want to add them to the ID list, + * as this will cause issues with resolving list. + */ + return; + } + bt_id_pending_keys_update_set(keys, BT_KEYS_ID_PENDING_ADD); k_work_submit(&add_id_work); } diff --git a/subsys/bluetooth/host/keys.h b/subsys/bluetooth/host/keys.h index b53635ce2c56..185fd610e779 100644 --- a/subsys/bluetooth/host/keys.h +++ b/subsys/bluetooth/host/keys.h @@ -45,6 +45,12 @@ enum { /* Bit 2 and 3 might accidentally exist in old stored keys */ BT_KEYS_SC = BIT(4), BT_KEYS_OOB = BIT(5), + /** Indicates that the keys are in conflict with existing keys. + * + * This is used to indicate that the keys being added conflict with + * existing keys from different identity. + */ + BT_KEYS_ID_CONFLICT = BIT(6), }; struct bt_ltk { diff --git a/subsys/bluetooth/host/smp.c b/subsys/bluetooth/host/smp.c index 4590f5d411a1..5854612a2aff 100644 --- a/subsys/bluetooth/host/smp.c +++ b/subsys/bluetooth/host/smp.c @@ -910,7 +910,7 @@ static void smp_br_id_add_replace(struct bt_keys *keys) bt_id_del(keys); } - conflict = bt_id_find_conflict(keys); + conflict = bt_id_find_conflict(keys, false); if (conflict != NULL) { int err; @@ -920,7 +920,7 @@ static void smp_br_id_add_replace(struct bt_keys *keys) __ASSERT_NO_MSG(!err); } - __ASSERT_NO_MSG(!bt_id_find_conflict(keys)); + __ASSERT_NO_MSG(!bt_id_find_conflict(keys, false)); bt_id_add(keys); } @@ -4096,16 +4096,24 @@ static uint8_t smp_id_add_replace(struct bt_smp *smp, struct bt_keys *new_bond) */ __ASSERT_NO_MSG(!(smp->remote_dist & BT_SMP_DIST_ID_KEY)); - conflict = bt_id_find_conflict(new_bond); + conflict = bt_id_find_conflict(new_bond, IS_ENABLED(CONFIG_BT_ID_AUTO_SWAP_MATCHING_BONDS)); if (conflict) { LOG_DBG("New bond conflicts with a bond on id %d.", conflict->id); } - if (conflict && !IS_ENABLED(CONFIG_BT_ID_UNPAIR_MATCHING_BONDS)) { + if (conflict && !IS_ENABLED(CONFIG_BT_ID_AUTO_SWAP_MATCHING_BONDS) && + !IS_ENABLED(CONFIG_BT_ID_UNPAIR_MATCHING_BONDS)) { LOG_WRN("Refusing new pairing. The old bond must be unpaired first."); return BT_SMP_ERR_AUTH_REQUIREMENTS; } + if (conflict && IS_ENABLED(CONFIG_BT_ID_AUTO_SWAP_MATCHING_BONDS)) { + LOG_WRN("Conflict detected with %p. Don't add key to Resolve List.", conflict); + new_bond->flags |= BT_KEYS_ID_CONFLICT; + conflict->flags |= BT_KEYS_ID_CONFLICT; + return 0; + } + if (conflict && IS_ENABLED(CONFIG_BT_ID_UNPAIR_MATCHING_BONDS)) { bool trust_ok; int unpair_err; @@ -4122,7 +4130,7 @@ static uint8_t smp_id_add_replace(struct bt_smp *smp, struct bt_keys *new_bond) __ASSERT_NO_MSG(!unpair_err); } - __ASSERT_NO_MSG(!bt_id_find_conflict(new_bond)); + __ASSERT_NO_MSG(!bt_id_find_conflict(new_bond, false)); bt_id_add(new_bond); return 0; } diff --git a/tests/bluetooth/host/id/mocks/adv.c b/tests/bluetooth/host/id/mocks/adv.c index 2c2d4f3f3c7a..a22123dea3da 100644 --- a/tests/bluetooth/host/id/mocks/adv.c +++ b/tests/bluetooth/host/id/mocks/adv.c @@ -15,3 +15,4 @@ DEFINE_FAKE_VALUE_FUNC(int, bt_le_adv_set_enable_legacy, struct bt_le_ext_adv *, DEFINE_FAKE_VALUE_FUNC(int, bt_le_adv_set_enable_ext, struct bt_le_ext_adv *, bool, const struct bt_le_ext_adv_start_param *); DEFINE_FAKE_VOID_FUNC(bt_le_ext_adv_foreach, bt_le_ext_adv_foreach_cb, void *); +DEFINE_FAKE_VALUE_FUNC(struct bt_le_ext_adv *, bt_adv_lookup_by_id, uint8_t); diff --git a/tests/bluetooth/host/id/mocks/adv.h b/tests/bluetooth/host/id/mocks/adv.h index bfb744001596..1602ddf47185 100644 --- a/tests/bluetooth/host/id/mocks/adv.h +++ b/tests/bluetooth/host/id/mocks/adv.h @@ -18,7 +18,8 @@ typedef void (*bt_le_ext_adv_foreach_cb)(struct bt_le_ext_adv *adv, void *data); FAKE(bt_le_adv_lookup_legacy) \ FAKE(bt_le_ext_adv_get_index) \ FAKE(bt_le_adv_set_enable_ext) \ - FAKE(bt_le_ext_adv_foreach) + FAKE(bt_le_ext_adv_foreach) \ + FAKE(bt_adv_lookup_by_id) DECLARE_FAKE_VALUE_FUNC(int, bt_le_adv_set_enable, struct bt_le_ext_adv *, bool); DECLARE_FAKE_VALUE_FUNC(struct bt_le_ext_adv *, bt_le_adv_lookup_legacy); @@ -27,3 +28,4 @@ DECLARE_FAKE_VALUE_FUNC(int, bt_le_adv_set_enable_legacy, struct bt_le_ext_adv * DECLARE_FAKE_VALUE_FUNC(int, bt_le_adv_set_enable_ext, struct bt_le_ext_adv *, bool, const struct bt_le_ext_adv_start_param *); DECLARE_FAKE_VOID_FUNC(bt_le_ext_adv_foreach, bt_le_ext_adv_foreach_cb, void *); +DECLARE_FAKE_VALUE_FUNC(struct bt_le_ext_adv *, bt_adv_lookup_by_id, uint8_t); diff --git a/tests/bluetooth/host/id/mocks/keys.c b/tests/bluetooth/host/id/mocks/keys.c index f885ab875c0f..61f73569c469 100644 --- a/tests/bluetooth/host/id/mocks/keys.c +++ b/tests/bluetooth/host/id/mocks/keys.c @@ -10,3 +10,4 @@ DEFINE_FAKE_VALUE_FUNC(struct bt_keys *, bt_keys_find_irk, uint8_t, const bt_addr_le_t *); DEFINE_FAKE_VOID_FUNC(bt_keys_foreach_type, enum bt_keys_type, bt_keys_foreach_type_cb, void *); +DEFINE_FAKE_VALUE_FUNC(struct bt_keys *, bt_keys_get_addr, uint8_t, const bt_addr_le_t *); diff --git a/tests/bluetooth/host/id/mocks/keys.h b/tests/bluetooth/host/id/mocks/keys.h index b6901e315ab9..1912472b78de 100644 --- a/tests/bluetooth/host/id/mocks/keys.h +++ b/tests/bluetooth/host/id/mocks/keys.h @@ -15,7 +15,9 @@ typedef void (*bt_keys_foreach_type_cb)(struct bt_keys *keys, void *data); /* List of fakes used by this unit tester */ #define KEYS_FFF_FAKES_LIST(FAKE) \ FAKE(bt_keys_find_irk) \ - FAKE(bt_keys_foreach_type) + FAKE(bt_keys_foreach_type) \ + FAKE(bt_keys_get_addr) DECLARE_FAKE_VALUE_FUNC(struct bt_keys *, bt_keys_find_irk, uint8_t, const bt_addr_le_t *); DECLARE_FAKE_VOID_FUNC(bt_keys_foreach_type, enum bt_keys_type, bt_keys_foreach_type_cb, void *); +DECLARE_FAKE_VALUE_FUNC(struct bt_keys *, bt_keys_get_addr, uint8_t, const bt_addr_le_t *); From 998af3327bfd98f11a852c91eae632279c0b1001 Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Thu, 12 Jun 2025 13:09:23 +0200 Subject: [PATCH 1686/2141] [nrf noup] boards: nrf54h20dk: Enable default images for sysbuild Enable the `empty_app_core` image when building for `cpurad`. Signed-off-by: Grzegorz Swiderski (cherry picked from commit 91e50002e9f067dff6727639670c1719308e9a6a) --- boards/nordic/nrf54h20dk/Kconfig.sysbuild | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 boards/nordic/nrf54h20dk/Kconfig.sysbuild diff --git a/boards/nordic/nrf54h20dk/Kconfig.sysbuild b/boards/nordic/nrf54h20dk/Kconfig.sysbuild new file mode 100644 index 000000000000..29bd62b49927 --- /dev/null +++ b/boards/nordic/nrf54h20dk/Kconfig.sysbuild @@ -0,0 +1,9 @@ +# Copyright (c) 2025 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +if BOARD_NRF54H20DK_NRF54H20_CPURAD + +config NRF_DEFAULT_EMPTY + default y + +endif # BOARD_NRF54H20DK_NRF54H20_CPURAD From 1aff9e5a7abe47398728b6119d4c0d3f2775eb5e Mon Sep 17 00:00:00 2001 From: Aleksandar Stanoev Date: Thu, 3 Jul 2025 15:37:01 +0100 Subject: [PATCH 1687/2141] [nrf noup] boards: xiao_ble: Add static partition manager configuration The xiao_ble boards ship with a bootloader requiring an app offset of 0x27000. The upstream board defines this via DT partitions, which will not be used if partition manager is enabled. Add a static partition configuration to allow binaries built for this board to work out-of-the-box in NCS, and match the behavior with sysbuild disabled. Signed-off-by: Aleksandar Stanoev (cherry picked from commit f8d62960ff1247572cc783278a6fd42900e8621a) --- boards/seeed/xiao_ble/pm_static.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 boards/seeed/xiao_ble/pm_static.yml diff --git a/boards/seeed/xiao_ble/pm_static.yml b/boards/seeed/xiao_ble/pm_static.yml new file mode 100644 index 000000000000..02915293177c --- /dev/null +++ b/boards/seeed/xiao_ble/pm_static.yml @@ -0,0 +1,18 @@ +# Mirror of partitions defined in nrf52840_partition_uf2_sdv7.dtsi +# Default flash layout for nrf52840 using UF2 and SoftDevice s140 v7 + +softdevice_reserved: + address: 0x00 + size: 0x27000 + +app: + address: 0x27000 + size: 0xC5000 + +settings_storage: + address: 0xEC000 + size: 0x8000 + +uf2_partition: + address: 0xF4000 + size: 0xC000 From 736a34fffc3d55712d36b2af2bbc54b42935087c Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Fri, 4 Jul 2025 14:38:28 +0200 Subject: [PATCH 1688/2141] [nrf noup] modem: backend: uart: SLM optimized modem UART backend This noup does the following: - Adds the modem_backend_uart_slm modem backend which is optimized for UART communication to SLM. The noup is intended to live until upstream zephyr has proper consistent RTS/CTS flow control support across multiple drivers, and DTR, RTS and CTS support has been added to the upstream modem UART backends, and lastly, SLM has been updated to use DTR, so everything is in sync. Ask Bjarki Arge Andreasen, Markus Lassila or Seppo Takalo when this noup is to be altered as part of an upmerge for example. Signed-off-by: Bjarki Arge Andreasen Signed-off-by: Markus Lassila (cherry picked from commit 3290b8b98587cafc91c483cdd217a40f9c51bad0) --- include/zephyr/modem/backend/uart_slm.h | 61 +++ subsys/modem/backends/CMakeLists.txt | 1 + subsys/modem/backends/Kconfig | 23 + .../modem/backends/modem_backend_uart_slm.c | 514 ++++++++++++++++++ 4 files changed, 599 insertions(+) create mode 100644 include/zephyr/modem/backend/uart_slm.h create mode 100644 subsys/modem/backends/modem_backend_uart_slm.c diff --git a/include/zephyr/modem/backend/uart_slm.h b/include/zephyr/modem/backend/uart_slm.h new file mode 100644 index 000000000000..e522c6cf791e --- /dev/null +++ b/include/zephyr/modem/backend/uart_slm.h @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include + +#ifndef ZEPHYR_MODEM_BACKEND_UART_SLM_ +#define ZEPHYR_MODEM_BACKEND_UART_SLM_ + +#ifdef __cplusplus +extern "C" { +#endif + +struct slm_rx_queue_event { + uint8_t *buf; + size_t len; +}; + +struct modem_backend_uart_slm { + const struct device *uart; + struct modem_pipe pipe; + struct k_work_delayable receive_ready_work; + struct k_work transmit_idle_work; + +#ifdef CONFIG_MODEM_STATS + struct modem_stats_buffer receive_buf_stats; + struct modem_stats_buffer transmit_buf_stats; +#endif + struct ring_buf transmit_rb; + struct k_work rx_disabled_work; + atomic_t state; + + struct k_mem_slab rx_slab; + struct k_msgq rx_queue; + struct slm_rx_queue_event rx_event; + struct slm_rx_queue_event rx_queue_buf[CONFIG_MODEM_BACKEND_UART_SLM_BUFFER_COUNT]; + uint32_t rx_buf_size; + uint8_t rx_buf_count; +}; + +struct modem_backend_uart_slm_config { + const struct device *uart; + uint8_t *receive_buf; /* Address must be word-aligned. */ + uint32_t receive_buf_size; + uint8_t *transmit_buf; + uint32_t transmit_buf_size; +}; + +struct modem_pipe *modem_backend_uart_slm_init(struct modem_backend_uart_slm *backend, + const struct modem_backend_uart_slm_config *config); + +#ifdef __cplusplus +} +#endif + +#endif /* ZEPHYR_MODEM_BACKEND_UART_SLM_ */ diff --git a/subsys/modem/backends/CMakeLists.txt b/subsys/modem/backends/CMakeLists.txt index e2247a8a09dd..787697a84e18 100644 --- a/subsys/modem/backends/CMakeLists.txt +++ b/subsys/modem/backends/CMakeLists.txt @@ -10,3 +10,4 @@ if(CONFIG_MODEM_BACKEND_UART_ASYNC) zephyr_library_sources_ifdef(CONFIG_MODEM_BACKEND_UART_ASYNC_HWFC modem_backend_uart_async_hwfc.c) zephyr_library_sources_ifndef(CONFIG_MODEM_BACKEND_UART_ASYNC_HWFC modem_backend_uart_async.c) endif() +zephyr_library_sources_ifdef(CONFIG_MODEM_BACKEND_UART_SLM modem_backend_uart_slm.c) diff --git a/subsys/modem/backends/Kconfig b/subsys/modem/backends/Kconfig index 2ce81c6dce11..5f8d804ed35c 100644 --- a/subsys/modem/backends/Kconfig +++ b/subsys/modem/backends/Kconfig @@ -64,3 +64,26 @@ endif # MODEM_BACKEND_UART_ASYNC_HWFC endif # MODEM_BACKEND_UART_ASYNC endif # MODEM_BACKEND_UART + +config MODEM_BACKEND_UART_SLM + bool "SLM-optimized modem UART backend" + select MODEM_PIPE + select RING_BUFFER + depends on UART_ASYNC_API + +if MODEM_BACKEND_UART_SLM + +config MODEM_BACKEND_UART_SLM_BUFFER_COUNT + int "SLM modem UART backend buffer count" + range 2 4 + default 3 + +config MODEM_BACKEND_UART_SLM_TRANSMIT_TIMEOUT_MS + int "SLM modem UART transmit timeout in milliseconds" + default 1000 + +config MODEM_BACKEND_UART_SLM_RECEIVE_IDLE_TIMEOUT_MS + int "SLM modem UART receive idle timeout in milliseconds" + default 30 + +endif # MODEM_BACKEND_UART_SLM diff --git a/subsys/modem/backends/modem_backend_uart_slm.c b/subsys/modem/backends/modem_backend_uart_slm.c new file mode 100644 index 000000000000..f1aa1b0bb402 --- /dev/null +++ b/subsys/modem/backends/modem_backend_uart_slm.c @@ -0,0 +1,514 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +#include +LOG_MODULE_REGISTER(modem_backend_uart_slm, CONFIG_MODEM_MODULES_LOG_LEVEL); + +#include +#include +#include + +struct rx_buf_t { + atomic_t ref_counter; + uint8_t buf[]; +}; + +static inline struct rx_buf_t *block_start_get(struct modem_backend_uart_slm *backend, uint8_t *buf) +{ + size_t block_num; + + /* Find the correct block. */ + block_num = (((size_t)buf - sizeof(struct rx_buf_t) - (size_t)backend->rx_slab.buffer) / + backend->rx_buf_size); + + return (struct rx_buf_t *)&backend->rx_slab.buffer[block_num * backend->rx_buf_size]; +} + +static struct rx_buf_t *rx_buf_alloc(struct modem_backend_uart_slm *backend) +{ + struct rx_buf_t *buf; + + if (k_mem_slab_alloc(&backend->rx_slab, (void **)&buf, K_NO_WAIT)) { + return NULL; + } + atomic_set(&buf->ref_counter, 1); + + return buf; +} + +static void rx_buf_ref(struct modem_backend_uart_slm *backend, void *buf) +{ + atomic_inc(&(block_start_get(backend, buf)->ref_counter)); +} + +static void rx_buf_unref(struct modem_backend_uart_slm *backend, void *buf) +{ + struct rx_buf_t *uart_buf = block_start_get(backend, buf); + atomic_t ref_counter = atomic_dec(&uart_buf->ref_counter); + + if (ref_counter == 1) { + k_mem_slab_free(&backend->rx_slab, (void *)uart_buf); + } +} + +enum { + MODEM_BACKEND_UART_SLM_STATE_OPEN_BIT, + MODEM_BACKEND_UART_SLM_STATE_TRANSMIT_BIT, + MODEM_BACKEND_UART_SLM_STATE_RECOVERY_BIT, +}; + +static int modem_backend_uart_slm_rx_enable(struct modem_backend_uart_slm *backend) +{ + int ret; + struct rx_buf_t *buf = rx_buf_alloc(backend); + + if (!buf) { + return -ENOMEM; + } + + ret = uart_rx_enable(backend->uart, buf->buf, + backend->rx_buf_size - sizeof(struct rx_buf_t), + CONFIG_MODEM_BACKEND_UART_SLM_RECEIVE_IDLE_TIMEOUT_MS * 1000); + if (ret) { + rx_buf_unref(backend, buf->buf); + return ret; + } + + return 0; +} + +static void modem_backend_uart_slm_rx_recovery(struct modem_backend_uart_slm *backend) +{ + int err; + + if (!atomic_test_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_RECOVERY_BIT)) { + return; + } + + err = modem_backend_uart_slm_rx_enable(backend); + if (err) { + LOG_DBG("RX recovery failed: %d", err); + return; + } + + if (!atomic_test_and_clear_bit(&backend->state, + MODEM_BACKEND_UART_SLM_STATE_RECOVERY_BIT)) { + /* Closed during recovery. */ + uart_rx_disable(backend->uart); + } else { + LOG_DBG("RX recovery success"); + } +} + +static bool modem_backend_uart_slm_is_uart_stopped(const struct modem_backend_uart_slm *backend) +{ + if (!atomic_test_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_OPEN_BIT) && + !atomic_test_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_RECOVERY_BIT) && + !atomic_test_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_TRANSMIT_BIT)) { + return true; + } + + return false; +} + +static bool modem_backend_uart_slm_is_open(const struct modem_backend_uart_slm *backend) +{ + return atomic_test_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_OPEN_BIT); +} + +static void modem_backend_uart_slm_event_handler(const struct device *dev, struct uart_event *evt, + void *user_data) +{ + struct modem_backend_uart_slm *backend = (struct modem_backend_uart_slm *)user_data; + struct slm_rx_queue_event rx_event; + int err; + + switch (evt->type) { + case UART_TX_DONE: + ring_buf_get_finish(&backend->transmit_rb, evt->data.tx.len); + atomic_clear_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_TRANSMIT_BIT); + k_work_submit(&backend->transmit_idle_work); + break; + + case UART_TX_ABORTED: + ring_buf_get_finish(&backend->transmit_rb, evt->data.tx.len); + if (!modem_backend_uart_slm_is_open(backend)) { + /* When we are closing, send the remaining data after re-open. */ + atomic_clear_bit(&backend->state, + MODEM_BACKEND_UART_SLM_STATE_TRANSMIT_BIT); + break; + } + if (evt->data.tx.len != 0) { + /* If we were able to send some data, attempt to send the remaining + * data before releasing the transmit bit. + */ + uint8_t *buf; + size_t bytes_to_transmit = + ring_buf_get_claim(&backend->transmit_rb, &buf, + ring_buf_capacity_get(&backend->transmit_rb)); + + err = uart_tx(backend->uart, buf, bytes_to_transmit, + CONFIG_MODEM_BACKEND_UART_SLM_TRANSMIT_TIMEOUT_MS * 1000L); + if (err) { + LOG_ERR("Failed to %s %u bytes. (%d)", "start async transmit for", + bytes_to_transmit, err); + atomic_clear_bit(&backend->state, + MODEM_BACKEND_UART_SLM_STATE_TRANSMIT_BIT); + } + break; + } + + /* We were not able to send anything. Start dropping data. */ + LOG_ERR("Transmit aborted (%u bytes dropped)", + ring_buf_size_get(&backend->transmit_rb)); + atomic_clear_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_TRANSMIT_BIT); + k_work_submit(&backend->transmit_idle_work); + break; + + case UART_RX_BUF_REQUEST: + struct rx_buf_t *buf = rx_buf_alloc(backend); + + if (!buf) { + LOG_DBG("No receive buffer, disabling RX"); + break; + } + err = uart_rx_buf_rsp(backend->uart, buf->buf, + backend->rx_buf_size - sizeof(struct rx_buf_t)); + if (err) { + LOG_ERR("uart_rx_buf_rsp: %d", err); + rx_buf_unref(backend, buf->buf); + } + break; + + case UART_RX_BUF_RELEASED: + if (evt->data.rx_buf.buf) { + rx_buf_unref(backend, evt->data.rx_buf.buf); + } + break; + + case UART_RX_RDY: + if (evt->data.rx.buf) { + rx_buf_ref(backend, evt->data.rx.buf); + rx_event.buf = &evt->data.rx.buf[evt->data.rx.offset]; + rx_event.len = evt->data.rx.len; + err = k_msgq_put(&backend->rx_queue, &rx_event, K_NO_WAIT); + if (err) { + LOG_WRN("RX queue overflow: %d (dropped %u)", err, + evt->data.rx.len); + rx_buf_unref(backend, evt->data.rx.buf); + break; + } + k_work_schedule(&backend->receive_ready_work, K_NO_WAIT); + } + break; + + case UART_RX_DISABLED: + if (atomic_test_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_OPEN_BIT)) { + if (!atomic_test_and_set_bit(&backend->state, + MODEM_BACKEND_UART_SLM_STATE_RECOVERY_BIT)) { + k_work_schedule(&backend->receive_ready_work, K_NO_WAIT); + LOG_DBG("RX recovery started"); + } + } + break; + + case UART_RX_STOPPED: + LOG_WRN("Receive stopped for reasons: %u", (uint8_t)evt->data.rx_stop.reason); + break; + + default: + break; + } + + if (modem_backend_uart_slm_is_uart_stopped(backend)) { + k_work_submit(&backend->rx_disabled_work); + } +} + +static int modem_backend_uart_slm_open(void *data) +{ + struct modem_backend_uart_slm *backend = (struct modem_backend_uart_slm *)data; + struct rx_buf_t *rx_buf = rx_buf_alloc(backend); + int ret; + + if (!rx_buf) { + return -ENOMEM; + } + + atomic_clear(&backend->state); + atomic_set_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_TRANSMIT_BIT); + atomic_set_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_OPEN_BIT); + + if (!ring_buf_is_empty(&backend->transmit_rb)) { + /* Transmit was aborted due to modem_backend_uart_slm_close. + * Send the remaining data before allowing further transmits. + */ + uint8_t *tx_buf; + const uint32_t tx_buf_size = ring_buf_get_claim( + &backend->transmit_rb, &tx_buf, ring_buf_size_get(&backend->transmit_rb)); + + ret = uart_tx(backend->uart, tx_buf, tx_buf_size, + CONFIG_MODEM_BACKEND_UART_SLM_TRANSMIT_TIMEOUT_MS * 1000L); + if (ret) { + LOG_ERR("Failed to %s %u bytes. (%d)", "start async transmit for", + tx_buf_size, ret); + atomic_clear_bit(&backend->state, + MODEM_BACKEND_UART_SLM_STATE_TRANSMIT_BIT); + } + } else { + /* Previous transmit was not aborted. */ + atomic_clear_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_TRANSMIT_BIT); + } + + ret = uart_rx_enable(backend->uart, rx_buf->buf, + backend->rx_buf_size - sizeof(struct rx_buf_t), + CONFIG_MODEM_BACKEND_UART_SLM_RECEIVE_IDLE_TIMEOUT_MS * 1000L); + if (ret < 0) { + rx_buf_unref(backend, rx_buf->buf); + atomic_clear_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_OPEN_BIT); + return ret; + } + + modem_pipe_notify_opened(&backend->pipe); + return 0; +} + +#ifdef CONFIG_MODEM_STATS +static uint32_t get_transmit_buf_size(const struct modem_backend_uart_slm *backend) +{ + return ring_buf_capacity_get(&backend->transmit_rb); +} + +static uint32_t get_receive_buf_size(struct modem_backend_uart_slm *backend) +{ + return (backend->rx_buf_size - sizeof(struct rx_buf_t)) * backend->rx_buf_count; +} + +static void advertise_transmit_buf_stats(struct modem_backend_uart_slm *backend, uint32_t length) +{ + modem_stats_buffer_advertise_length(&backend->transmit_buf_stats, length); +} + +static void advertise_receive_buf_stats(struct modem_backend_uart_slm *backend, uint32_t reserved) +{ + modem_stats_buffer_advertise_length(&backend->receive_buf_stats, reserved); +} +#endif + +static int modem_backend_uart_slm_transmit(void *data, const uint8_t *buf, size_t size) +{ + struct modem_backend_uart_slm *backend = (struct modem_backend_uart_slm *)data; + bool transmitting; + uint32_t bytes_to_transmit; + int ret; + uint8_t *tx_buf; + + if (!modem_backend_uart_slm_is_open(backend)) { + return -EPERM; + } + + transmitting = + atomic_test_and_set_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_TRANSMIT_BIT); + if (transmitting) { + return 0; + } + + /* Copy buf to transmit ring buffer which is passed to UART. */ + ring_buf_reset(&backend->transmit_rb); + ring_buf_put(&backend->transmit_rb, buf, size); + bytes_to_transmit = ring_buf_get_claim(&backend->transmit_rb, &tx_buf, size); + + ret = uart_tx(backend->uart, tx_buf, bytes_to_transmit, + CONFIG_MODEM_BACKEND_UART_SLM_TRANSMIT_TIMEOUT_MS * 1000L); + +#ifdef CONFIG_MODEM_STATS + advertise_transmit_buf_stats(backend, bytes_to_transmit); +#endif + + if (ret != 0) { + LOG_ERR("Failed to %s %u bytes. (%d)", "start async transmit for", + bytes_to_transmit, ret); + atomic_clear_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_TRANSMIT_BIT); + + return ret; + } + + return (int)bytes_to_transmit; +} + +static int modem_backend_uart_slm_receive(void *data, uint8_t *buf, size_t size) +{ + struct modem_backend_uart_slm *backend = (struct modem_backend_uart_slm *)data; + size_t received = 0; + size_t copy_size = 0; + +#ifdef CONFIG_MODEM_STATS + struct slm_rx_queue_event rx_event; + size_t reserved = backend->rx_event.len; + + for (int i = 0; i < k_msgq_num_used_get(&backend->rx_queue); i++) { + if (k_msgq_peek_at(&backend->rx_queue, &rx_event, i)) { + break; + } + reserved += rx_event.len; + } + advertise_receive_buf_stats(backend, reserved); +#endif + while (size > received) { + /* Keeping track of the rx_event allows us to receive less than what the event + * indicates. + */ + if (backend->rx_event.len == 0) { + if (k_msgq_get(&backend->rx_queue, &backend->rx_event, K_NO_WAIT)) { + break; + } + } + copy_size = MIN(size - received, backend->rx_event.len); + memcpy(buf, backend->rx_event.buf, copy_size); + buf += copy_size; + received += copy_size; + backend->rx_event.buf += copy_size; + backend->rx_event.len -= copy_size; + + if (backend->rx_event.len == 0) { + rx_buf_unref(backend, backend->rx_event.buf); + } + } + + if (backend->rx_event.len != 0 || k_msgq_num_used_get(&backend->rx_queue) != 0) { + k_work_schedule(&backend->receive_ready_work, K_NO_WAIT); + } + + modem_backend_uart_slm_rx_recovery(backend); + + return (int)received; +} + +static int modem_backend_uart_slm_close(void *data) +{ + struct modem_backend_uart_slm *backend = (struct modem_backend_uart_slm *)data; + + atomic_clear_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_OPEN_BIT); + uart_tx_abort(backend->uart); + + if (!atomic_test_and_clear_bit(&backend->state, + MODEM_BACKEND_UART_SLM_STATE_RECOVERY_BIT)) { + /* Disable the RX, if recovery is not ongoing. */ + uart_rx_disable(backend->uart); + } + + return 0; +} + +static void modem_backend_uart_slm_receive_ready_handler(struct k_work *item) +{ + struct modem_backend_uart_slm *backend = + CONTAINER_OF(k_work_delayable_from_work(item), struct modem_backend_uart_slm, + receive_ready_work); + + modem_pipe_notify_receive_ready(&backend->pipe); +} + +static void modem_backend_uart_slm_transmit_idle_handler(struct k_work *item) +{ + struct modem_backend_uart_slm *backend = + CONTAINER_OF(item, struct modem_backend_uart_slm, transmit_idle_work); + + modem_pipe_notify_transmit_idle(&backend->pipe); +} + +static void modem_backend_uart_slm_notify_closed(struct k_work *item) +{ + + struct modem_backend_uart_slm *backend = + CONTAINER_OF(item, struct modem_backend_uart_slm, rx_disabled_work); + + modem_pipe_notify_closed(&backend->pipe); +} + +#ifdef CONFIG_MODEM_STATS +static void init_stats(struct modem_backend_uart_slm *backend) +{ + char name[CONFIG_MODEM_STATS_BUFFER_NAME_SIZE]; + uint32_t receive_buf_size; + uint32_t transmit_buf_size; + + receive_buf_size = get_receive_buf_size(backend); + transmit_buf_size = get_transmit_buf_size(backend); + + snprintk(name, sizeof(name), "%s_%s", backend->uart->name, "rx"); + modem_stats_buffer_init(&backend->receive_buf_stats, name, receive_buf_size); + snprintk(name, sizeof(name), "%s_%s", backend->uart->name, "tx"); + modem_stats_buffer_init(&backend->transmit_buf_stats, name, transmit_buf_size); +} +#endif + +static const struct modem_pipe_api modem_backend_uart_slm_api = { + .open = modem_backend_uart_slm_open, + .transmit = modem_backend_uart_slm_transmit, + .receive = modem_backend_uart_slm_receive, + .close = modem_backend_uart_slm_close, +}; + +struct modem_pipe *modem_backend_uart_slm_init(struct modem_backend_uart_slm *backend, + const struct modem_backend_uart_slm_config *config) +{ + int err; + + __ASSERT_NO_MSG(config->uart != NULL); + __ASSERT_NO_MSG(config->receive_buf != NULL); + __ASSERT_NO_MSG(config->receive_buf_size > 1); + __ASSERT_NO_MSG((config->receive_buf_size % 2) == 0); + __ASSERT_NO_MSG(config->transmit_buf != NULL); + __ASSERT_NO_MSG(config->transmit_buf_size > 0); + + memset(backend, 0x00, sizeof(*backend)); + backend->uart = config->uart; + k_work_init_delayable(&backend->receive_ready_work, + modem_backend_uart_slm_receive_ready_handler); + k_work_init(&backend->transmit_idle_work, modem_backend_uart_slm_transmit_idle_handler); + k_work_init(&backend->rx_disabled_work, modem_backend_uart_slm_notify_closed); + + err = uart_callback_set(backend->uart, modem_backend_uart_slm_event_handler, backend); + if (err) { + LOG_ERR("uart_callback_set failed. (%d)", err); + return NULL; + } + + int32_t buf_size = (int32_t)config->receive_buf_size; + + backend->rx_buf_count = CONFIG_MODEM_BACKEND_UART_SLM_BUFFER_COUNT; + + /* k_mem_slab_init requires a word-aligned buffer. */ + __ASSERT((uintptr_t)config->receive_buf % sizeof(void *) == 0, + "Receive buffer is not word-aligned"); + + /* Make sure all the buffers will be aligned. */ + buf_size -= (config->receive_buf_size % (sizeof(uint32_t) * backend->rx_buf_count)); + backend->rx_buf_size = buf_size / backend->rx_buf_count; + __ASSERT_NO_MSG(backend->rx_buf_size > sizeof(struct rx_buf_t)); + + /* Initialize the RX buffers and event queue. */ + err = k_mem_slab_init(&backend->rx_slab, config->receive_buf, backend->rx_buf_size, + backend->rx_buf_count); + if (err) { + LOG_ERR("k_mem_slab_init failed. (%d)", err); + return NULL; + } + k_msgq_init(&backend->rx_queue, (char *)backend->rx_queue_buf, + sizeof(struct slm_rx_queue_event), CONFIG_MODEM_BACKEND_UART_SLM_BUFFER_COUNT); + + ring_buf_init(&backend->transmit_rb, config->transmit_buf_size, config->transmit_buf); + + modem_pipe_init(&backend->pipe, backend, &modem_backend_uart_slm_api); + +#ifdef CONFIG_MODEM_STATS + init_stats(backend); +#endif + return &backend->pipe; +} From b4076486de7d0cad4a5f838e3b81bf330fc71fd3 Mon Sep 17 00:00:00 2001 From: Mateusz Michalek Date: Mon, 14 Jul 2025 10:13:32 +0200 Subject: [PATCH 1689/2141] [nrf noup] boards: nordic: nrf54lm20 adjust ROM_START_OFFSET adds kconfig that was probably skipped during migration. Signed-off-by: Mateusz Michalek (cherry picked from commit cd135b25e4e48e649c8fdfa97abee3989c5300f6) --- boards/nordic/nrf54lm20dk/Kconfig.defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/boards/nordic/nrf54lm20dk/Kconfig.defconfig b/boards/nordic/nrf54lm20dk/Kconfig.defconfig index 1f0a706ae6ca..3424e7a9e780 100644 --- a/boards/nordic/nrf54lm20dk/Kconfig.defconfig +++ b/boards/nordic/nrf54lm20dk/Kconfig.defconfig @@ -7,6 +7,7 @@ config HW_STACK_PROTECTION default ARCH_HAS_STACK_PROTECTION config ROM_START_OFFSET + default 0 if PARTITION_MANAGER_ENABLED default 0x800 if BOOTLOADER_MCUBOOT endif # BOARD_NRF54LM20DK_NRF54LM20A_CPUAPP From c3f0f4698111647ac39e59ebcd5a8294db09460b Mon Sep 17 00:00:00 2001 From: Krzysztof Szromek Date: Fri, 18 Jul 2025 08:05:27 +0200 Subject: [PATCH 1690/2141] [nrf noup] ci: update test_spec label for E2E DFU tests Ref: NCSDK-34052 Signed-off-by: Krzysztof Szromek (cherry picked from commit 1b7ccc6e935529a3a464097925b31d69a3a9f9f2) --- .github/test-spec.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/.github/test-spec.yml b/.github/test-spec.yml index 5337249f7dab..76def875e0be 100644 --- a/.github/test-spec.yml +++ b/.github/test-spec.yml @@ -49,6 +49,33 @@ - "tests/subsys/dfu/**/*" - "tests/subsys/mgmt/mcumgr/**/*" +"CI-dfu-test": + - "boards/nordic/**/*" + - "drivers/bluetooth/**/*" + - "drivers/console/**/*" + - "drivers/flash/**/*" + - "drivers/mbox/**/*" + - "drivers/serial/**/*" + - "drivers/spi/**/*" + - "dts/arm/nordic/nrf54h*" + - "dts/common/nordic/*" + - "dts/riscv/nordic/nrf54h*" + - "include/dfu/**/*" + - "include/mgmt/mcumgr/**/*" + - "include/zephyr/**/*" + - "samples/subsys/mgmt/mcumgr/smp_svr/**/*" + - "scripts/west_commands/build.py" + - "scripts/west_commands/flash.py" + - "scripts/west_commands/runners/core.py" + - "scripts/west_commands/runners/nrf_common.py" + - "scripts/west_commands/runners/nrfutil.py" + - "soc/nordic/nrf54h/**/*" + - "subsys/bluetooth/**/*" + - "subsys/dfu/**/*" + - "subsys/logging/**/*" + - "subsys/mgmt/mcumgr/**/*" + - "subsys/tracing/**/*" + "CI-tfm-test": - "boards/nordic/nrf5340dk/**/*" - "boards/nordic/nrf9160dk/**/*" From 510e36ccf52ba402fe52199287c0a01ffb27ccef Mon Sep 17 00:00:00 2001 From: Marek Pieta Date: Fri, 14 Jun 2024 12:08:55 +0200 Subject: [PATCH 1691/2141] [nrf noup] bluetooth: conn: Allow for an extra ref in bt_l2cap_send_pdu Allow for an additional buffer reference if callback is provided. This can be used to extend lifetime of the net buffer until the data transmission is confirmed by ACK of the remote. Signed-off-by: Marek Pieta (cherry picked from commit 90daf74e59ef2ef4d6d385d39632fa9cd736c80a) --- subsys/bluetooth/host/conn.c | 17 ++++++++++++----- subsys/bluetooth/host/l2cap.c | 8 ++++++-- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/subsys/bluetooth/host/conn.c b/subsys/bluetooth/host/conn.c index f3abf67d4fb6..7248f7c54952 100644 --- a/subsys/bluetooth/host/conn.c +++ b/subsys/bluetooth/host/conn.c @@ -711,12 +711,19 @@ static int send_buf(struct bt_conn *conn, struct net_buf *buf, uint16_t frag_len = MIN(conn_mtu(conn), len); - /* Check that buf->ref is 1 or 2. It would be 1 if this - * was the only reference (e.g. buf was removed - * from the conn tx_queue). It would be 2 if the - * tx_data_pull kept it on the tx_queue for segmentation. + /* Check that buf->ref is 1 or 2. It would be 1 if this was + * the only reference (e.g. buf was removed from the conn + * tx_queue). It would be 2 if the tx_data_pull kept it on + * the tx_queue for segmentation. + * + * Allow for an additional buffer reference if callback is + * provided. This can be used to extend lifetime of the net + * buffer until the data transmission is confirmed by ACK of + * the remote. */ - __ASSERT_NO_MSG((buf->ref == 1) || (buf->ref == 2)); + if (buf->ref > 2 + (cb ? 1 : 0)) { + __ASSERT_NO_MSG(false); + } /* The reference is always transferred to the frag, so when * the frag is destroyed, the parent reference is decremented. diff --git a/subsys/bluetooth/host/l2cap.c b/subsys/bluetooth/host/l2cap.c index f65827fac1be..0879163a8a18 100644 --- a/subsys/bluetooth/host/l2cap.c +++ b/subsys/bluetooth/host/l2cap.c @@ -761,13 +761,17 @@ int bt_l2cap_send_pdu(struct bt_l2cap_le_chan *le_chan, struct net_buf *pdu, return -ENOTCONN; } - if (pdu->ref != 1) { + /* Allow for an additional buffer reference if callback is provided. This can be used to + * extend lifetime of the net buffer until the data transmission is confirmed by ACK of the + * remote. + */ + if (pdu->ref > 1 + (cb ? 1 : 0)) { /* The host may alter the buf contents when fragmenting. Higher * layers cannot expect the buf contents to stay intact. Extra * refs suggests a silent data corruption would occur if not for * this error. */ - LOG_ERR("Expecting 1 ref, got %d", pdu->ref); + LOG_ERR("Expecting up to %d refs, got %d", cb ? 2 : 1, pdu->ref); return -EINVAL; } From adb8f4e2ec19c3f4146b595daf4d579320a7506b Mon Sep 17 00:00:00 2001 From: Marek Pieta Date: Wed, 7 Aug 2024 10:29:21 +0200 Subject: [PATCH 1692/2141] [nrf noup] bluetooth: conn: Skip buffer ref count check in send_buf If ATT sent callback is delayed until data transmission is done by BLE controller, the transmitted buffer may have an additional reference. The reference is used to extend lifetime of the net buffer until the data transmission is confirmed by ACK of the remote. send_buf function can be called multiple times, if buffer has to be fragmented over HCI. In that case, the callback is provided as an argument only for the last transmitted fragment. The `buf->ref == 1` check is skipped because it's impossible to properly validate number of references for the sent fragments if buffers may have the additional reference. Jira: NCSDK-28624 Signed-off-by: Marek Pieta (cherry picked from commit cc098c6faa2fbcac2be22af3586102d17e81e5ea) --- subsys/bluetooth/host/conn.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/subsys/bluetooth/host/conn.c b/subsys/bluetooth/host/conn.c index 7248f7c54952..d0b6264aaede 100644 --- a/subsys/bluetooth/host/conn.c +++ b/subsys/bluetooth/host/conn.c @@ -711,19 +711,27 @@ static int send_buf(struct bt_conn *conn, struct net_buf *buf, uint16_t frag_len = MIN(conn_mtu(conn), len); - /* Check that buf->ref is 1 or 2. It would be 1 if this was - * the only reference (e.g. buf was removed from the conn - * tx_queue). It would be 2 if the tx_data_pull kept it on - * the tx_queue for segmentation. + /* If ATT sent callback is delayed until data transmission + * is done by BLE controller, the transmitted buffer may + * have an additional reference. The reference is used to + * extend lifetime of the net buffer until the data + * transmission is confirmed by ACK of the remote. * - * Allow for an additional buffer reference if callback is - * provided. This can be used to extend lifetime of the net - * buffer until the data transmission is confirmed by ACK of - * the remote. + * send_buf function can be called multiple times, if buffer + * has to be fragmented over HCI. In that case, the callback + * is provided as an argument only for the last transmitted + * fragment. The `buf->ref == 1` (or 2) check is skipped + * because it's impossible to properly validate number of + * references for the sent fragments if buffers may have the + * additional reference. + * + * Otherwise, check that buf->ref is 1 or 2. It would be 1 + * if this was the only reference (e.g. buf was removed from + * the conn tx_queue). It would be 2 if the tx_data_pull + * kept it on the tx_queue for segmentation. */ - if (buf->ref > 2 + (cb ? 1 : 0)) { - __ASSERT_NO_MSG(false); - } + __ASSERT_NO_MSG(IS_ENABLED(CONFIG_BT_ATT_SENT_CB_AFTER_TX) || (buf->ref == 1) || + (buf->ref == 2)); /* The reference is always transferred to the frag, so when * the frag is destroyed, the parent reference is decremented. From 80070f512f8d961d419453cd063939c9a529b9b9 Mon Sep 17 00:00:00 2001 From: Juha Ylinen Date: Fri, 19 Jan 2024 15:26:33 +0200 Subject: [PATCH 1693/2141] [nrf noup] samples: lwm2m_client: Add support for nRF91x Add support for nRF91x by providing overlay configuration file. Signed-off-by: Juha Ylinen Signed-off-by: Robert Lubos (cherry picked from commit 1b4e2efade1fa707bf264d4da17fa6b78e9d67fa) --- samples/net/lwm2m_client/overlay-nrf91x.conf | 53 ++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 samples/net/lwm2m_client/overlay-nrf91x.conf diff --git a/samples/net/lwm2m_client/overlay-nrf91x.conf b/samples/net/lwm2m_client/overlay-nrf91x.conf new file mode 100644 index 000000000000..7b902178e078 --- /dev/null +++ b/samples/net/lwm2m_client/overlay-nrf91x.conf @@ -0,0 +1,53 @@ +# Configuration file for nRF91x +# This file is merged with prj.conf in the application folder, and options +# set here will take precedence if they are present in both files. + +# General +CONFIG_MAIN_STACK_SIZE=4096 + +CONFIG_NET_SOCKETS=y +CONFIG_NET_NATIVE=y +CONFIG_NET_SOCKETS_OFFLOAD=y + +CONFIG_NET_CONFIG_MY_IPV6_ADDR="" +CONFIG_NET_CONFIG_PEER_IPV6_ADDR="" +CONFIG_NET_CONFIG_MY_IPV4_ADDR="" +CONFIG_NET_CONFIG_MY_IPV4_GW="" + +CONFIG_NET_CONFIG_NEED_IPV6=n +CONFIG_NET_CONFIG_NEED_IPV4=n +CONFIG_NET_CONFIG_AUTO_INIT=n + +# Modem related configurations +CONFIG_NRF_MODEM_LIB_NET_IF=y +CONFIG_NRF_MODEM_LIB_NET_IF_AUTO_DOWN=n +CONFIG_NRF_MODEM_LIB_NET_IF_AUTO_CONNECT=n +CONFIG_NRF_MODEM_LIB_NET_IF_AUTO_START=n +CONFIG_NRF_MODEM_LIB_ON_FAULT_APPLICATION_SPECIFIC=y + +CONFIG_LTE_LINK_CONTROL_LOG_LEVEL_DBG=n +CONFIG_NRF_MODEM_LIB_NET_IF_LOG_LEVEL_DBG=n + +# Disable Duplicate Address Detection (DAD) +# due to not being properly implemented for offloaded interfaces. +CONFIG_NET_IPV6_NBR_CACHE=n +CONFIG_NET_IPV6_MLD=n + +# Zephyr NET Connection Manager and Connectivity layer. +CONFIG_NET_CONNECTION_MANAGER=y +CONFIG_NET_CONNECTION_MANAGER_MONITOR_STACK_SIZE=1024 + +CONFIG_NET_SAMPLE_LWM2M_ID="nrf91x" +CONFIG_NET_SAMPLE_LWM2M_SERVER="coaps://leshan.eclipseprojects.io:5684" +CONFIG_LWM2M_DNS_SUPPORT=y + +## Enable DTLS support +CONFIG_LWM2M_DTLS_SUPPORT=y +CONFIG_LWM2M_TLS_SESSION_CACHING=y +CONFIG_LWM2M_DTLS_CID=y +CONFIG_TLS_CREDENTIALS=y + +## Crypto +CONFIG_OBERON_BACKEND=y +CONFIG_NORDIC_SECURITY_BACKEND=y +CONFIG_MBEDTLS_SHA256_C=y From 15d61b18b613dbad78cb3c1b643a9327c43b7af9 Mon Sep 17 00:00:00 2001 From: Jonathan Nilsen Date: Tue, 22 Apr 2025 14:34:11 +0200 Subject: [PATCH 1694/2141] [nrf noup] modules: hal_nordic: require nrf-regtool Same as commit 6ec9d10 but with the REQUIRED keyword on its own line to attempt to avoid a merge conflict when reverting/reapplying this patch. Signed-off-by: Jonathan Nilsen (cherry picked from commit e606b2aaf5ebd69b03c5fd92c99d9ef1d9c7e96a) --- modules/hal_nordic/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/hal_nordic/CMakeLists.txt b/modules/hal_nordic/CMakeLists.txt index b6f352864123..e5b1ab60dfca 100644 --- a/modules/hal_nordic/CMakeLists.txt +++ b/modules/hal_nordic/CMakeLists.txt @@ -13,6 +13,7 @@ if(CONFIG_NRF_REGTOOL_GENERATE_UICR) endif() if(DEFINED nrf_regtool_components) find_package(nrf-regtool 9.2.0 + REQUIRED COMPONENTS ${nrf_regtool_components} PATHS ${CMAKE_CURRENT_LIST_DIR}/nrf-regtool NO_CMAKE_PATH From e7a14b39f27842948a7b084abdb068e5f922dc97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Wed, 8 Jan 2025 11:15:56 +0100 Subject: [PATCH 1695/2141] [nrf noup] boards: nordic: nrf7002dk: Bring back NS variants MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Non-secure variants for nRF7002 DK were removed from upstream in commit 10d49736cffa14d3798e615e70d58b3be8ee2cfc. Revert these changes downstream, so that the NS variants are still available. Signed-off-by: Andrzej Głąbek Signed-off-by: Johann Fischer (cherry picked from commit c1643faea535faad9caf5852960c2d9cb09db101) --- boards/nordic/nrf7002dk/CMakeLists.txt | 11 +++ boards/nordic/nrf7002dk/Kconfig | 4 +- boards/nordic/nrf7002dk/Kconfig.defconfig | 72 +++++++++++++++++++ boards/nordic/nrf7002dk/Kconfig.nrf7002dk | 4 +- boards/nordic/nrf7002dk/board.cmake | 18 ++++- boards/nordic/nrf7002dk/board.yml | 4 ++ .../nrf7002dk_nrf5340_cpuapp_nrf7001_ns.dts | 39 ++++++++++ .../nrf7002dk_nrf5340_cpuapp_nrf7001_ns.yaml | 19 +++++ ...7002dk_nrf5340_cpuapp_nrf7001_ns_defconfig | 24 +++++++ .../nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.dts | 40 +++++++++++ .../nrf7002dk_nrf5340_cpuapp_ns.yaml | 19 +++++ .../nrf7002dk_nrf5340_cpuapp_ns_defconfig | 23 ++++++ 12 files changed, 273 insertions(+), 4 deletions(-) create mode 100644 boards/nordic/nrf7002dk/CMakeLists.txt create mode 100644 boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns.dts create mode 100644 boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns.yaml create mode 100644 boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns_defconfig create mode 100644 boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.dts create mode 100644 boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.yaml create mode 100644 boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns_defconfig diff --git a/boards/nordic/nrf7002dk/CMakeLists.txt b/boards/nordic/nrf7002dk/CMakeLists.txt new file mode 100644 index 000000000000..db20255712bc --- /dev/null +++ b/boards/nordic/nrf7002dk/CMakeLists.txt @@ -0,0 +1,11 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +if((CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP OR + CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NS OR + CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 OR + CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS) AND + CONFIG_BOARD_ENABLE_CPUNET) + zephyr_library() + zephyr_library_sources(nrf5340_cpunet_reset.c) +endif() diff --git a/boards/nordic/nrf7002dk/Kconfig b/boards/nordic/nrf7002dk/Kconfig index fa6c8097ae32..d4b7030a65ab 100644 --- a/boards/nordic/nrf7002dk/Kconfig +++ b/boards/nordic/nrf7002dk/Kconfig @@ -10,7 +10,9 @@ config MBOX_NRFX_IPC default MBOX if BOARD_NRF7002DK_NRF5340_CPUAPP || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 + BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS config BT_HCI_IPC default y if BT diff --git a/boards/nordic/nrf7002dk/Kconfig.defconfig b/boards/nordic/nrf7002dk/Kconfig.defconfig index 48510d6e24f8..0d89a0089968 100644 --- a/boards/nordic/nrf7002dk/Kconfig.defconfig +++ b/boards/nordic/nrf7002dk/Kconfig.defconfig @@ -9,3 +9,75 @@ config HW_STACK_PROTECTION default ARCH_HAS_STACK_PROTECTION endif # BOARD_NRF7002DK + +if BOARD_NRF7002DK_NRF5340_CPUAPP || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS + +# By default, if we build for a Non-Secure version of the board, +# force building with TF-M as the Secure Execution Environment. +config BUILD_WITH_TFM + default y if BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS + +if BUILD_WITH_TFM + +# By default, if we build with TF-M, instruct build system to +# flash the combined TF-M (Secure) & Zephyr (Non Secure) image +config TFM_FLASH_MERGED_BINARY + bool + default y + +endif # BUILD_WITH_TFM + +# Code Partition: +# +# 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- +# secure image (TRUSTED_EXECUTION_SECURE=y), the secure FW image shall always +# be restricted to the size of its code partition. +# +# For the non-secure version of the board, the firmware +# must be linked into the code-partition (non-secure) defined in DT, regardless. +# Apply this configuration below by setting the Kconfig symbols used by +# the linker according to the information extracted from DT partitions. + +# SRAM Partition: +# +# If the secure firmware is to be combined with a non-secure image +# (TRUSTED_EXECUTION_SECURE=y), the secure FW image SRAM shall always +# be restricted to the secure image SRAM partition (sram-secure-partition). +# Otherwise (if TRUSTED_EXECUTION_SECURE is not set) the whole zephyr,sram +# may be used by the image. +# +# For the non-secure version of the board, the firmware image SRAM is +# always restricted to the allocated non-secure SRAM partition. +# +# Workaround for not being able to have commas in macro arguments +DT_CHOSEN_Z_CODE_PARTITION := zephyr,code-partition +DT_CHOSEN_Z_SRAM_PARTITION := zephyr,sram-secure-partition + +if (BOARD_NRF7002DK_NRF5340_CPUAPP || BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001) && \ + TRUSTED_EXECUTION_SECURE + +config FLASH_LOAD_SIZE + default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) + +config SRAM_SIZE + default $(dt_chosen_reg_size_int,$(DT_CHOSEN_Z_SRAM_PARTITION),0,K) + +endif + +if BOARD_NRF7002DK_NRF5340_CPUAPP_NS || BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS + +config FLASH_LOAD_OFFSET + default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) + +config FLASH_LOAD_SIZE + default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) + +endif + +endif diff --git a/boards/nordic/nrf7002dk/Kconfig.nrf7002dk b/boards/nordic/nrf7002dk/Kconfig.nrf7002dk index 61b9e818f367..91f52ee6f08c 100644 --- a/boards/nordic/nrf7002dk/Kconfig.nrf7002dk +++ b/boards/nordic/nrf7002dk/Kconfig.nrf7002dk @@ -4,4 +4,6 @@ config BOARD_NRF7002DK select SOC_NRF5340_CPUNET_QKAA if BOARD_NRF7002DK_NRF5340_CPUNET select SOC_NRF5340_CPUAPP_QKAA if BOARD_NRF7002DK_NRF5340_CPUAPP || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 + BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS diff --git a/boards/nordic/nrf7002dk/board.cmake b/boards/nordic/nrf7002dk/board.cmake index f85bbc86f485..11a27910eebc 100644 --- a/boards/nordic/nrf7002dk/board.cmake +++ b/boards/nordic/nrf7002dk/board.cmake @@ -1,10 +1,24 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -if(CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP OR CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001) +if(CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NS OR + CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS) + set(TFM_PUBLIC_KEY_FORMAT "full") +endif() + +if(CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP OR + CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NS OR + CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 OR + CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS) board_runner_args(nrfutil "--ext-mem-config-file=${BOARD_DIR}/support/nrf7002dk_spi_nrfutil_config.json") board_runner_args(jlink "--device=nrf5340_xxaa_app" "--speed=4000") -elseif(CONFIG_BOARD_NRF7002DK_NRF5340_CPUNET) +endif() + +if(CONFIG_TFM_FLASH_MERGED_BINARY) + set_property(TARGET runners_yaml_props_target PROPERTY hex_file "${CMAKE_BINARY_DIR}/zephyr/tfm_merged.hex") +endif() + +if(CONFIG_BOARD_NRF7002DK_NRF5340_CPUNET) board_runner_args(jlink "--device=nrf5340_xxaa_net" "--speed=4000") endif() diff --git a/boards/nordic/nrf7002dk/board.yml b/boards/nordic/nrf7002dk/board.yml index 4f41341e4423..39db5dcfa3a7 100644 --- a/boards/nordic/nrf7002dk/board.yml +++ b/boards/nordic/nrf7002dk/board.yml @@ -5,5 +5,9 @@ board: socs: - name: nrf5340 variants: + - name: ns + cpucluster: cpuapp - name: nrf7001 cpucluster: cpuapp + variants: + - name: ns diff --git a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns.dts b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns.dts new file mode 100644 index 000000000000..5ff28accf3fc --- /dev/null +++ b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns.dts @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; +#include +#include "nrf5340_cpuapp_common.dtsi" + +/ { + model = "Nordic NRF5340 DK NRF5340 Application"; + compatible = "nordic,nrf5340-dk-nrf5340-cpuapp"; + + chosen { + zephyr,sram = &sram0_ns; + zephyr,flash = &flash0; + zephyr,code-partition = &slot0_ns_partition; + zephyr,entropy = &psa_rng; + zephyr,wifi = &wlan0; + }; + + psa_rng: psa-rng { + compatible = "zephyr,psa-crypto-rng"; + status = "okay"; + }; +}; + +&qspi { + nrf70: nrf7001@1 { + compatible = "nordic,nrf7001-qspi"; + status = "okay"; + reg = <1>; + qspi-frequency = <24000000>; + qspi-quad-mode; + + #include "nrf70_common.dtsi" + }; +}; diff --git a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns.yaml b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns.yaml new file mode 100644 index 000000000000..165759691260 --- /dev/null +++ b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns.yaml @@ -0,0 +1,19 @@ +identifier: nrf7002dk/nrf5340/cpuapp/nrf7001/ns +name: NRF7002-DK-NRF7001-NRF5340-application-MCU-Non-Secure +type: mcu +arch: arm +toolchain: + - gnuarmemb + - xtools + - zephyr +ram: 192 +flash: 192 +supported: + - gpio + - i2c + - pwm + - watchdog + - usbd + - usb_device + - netif:openthread +vendor: nordic diff --git a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns_defconfig b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns_defconfig new file mode 100644 index 000000000000..2c435653140a --- /dev/null +++ b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns_defconfig @@ -0,0 +1,24 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +# Enable MPU +CONFIG_ARM_MPU=y + +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y + +# Enable TrustZone-M +CONFIG_ARM_TRUSTZONE_M=y + +# This Board implies building Non-Secure firmware +CONFIG_TRUSTED_EXECUTION_NONSECURE=y + +# enable GPIO +CONFIG_GPIO=y + +# Enable uart driver +CONFIG_SERIAL=y + +# enable console +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y diff --git a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.dts b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.dts new file mode 100644 index 000000000000..0deb8ccc1bf5 --- /dev/null +++ b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.dts @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; +#include +#include "nrf5340_cpuapp_common.dtsi" + +/ { + model = "Nordic NRF5340 DK NRF5340 Application"; + compatible = "nordic,nrf5340-dk-nrf5340-cpuapp"; + + chosen { + zephyr,sram = &sram0_ns_app; + zephyr,flash = &flash0; + zephyr,code-partition = &slot0_ns_partition; + zephyr,entropy = &psa_rng; + zephyr,wifi = &wlan0; + }; + + psa_rng: psa-rng { + compatible = "zephyr,psa-crypto-rng"; + status = "okay"; + }; +}; + +&qspi { + nrf70: nrf7002@1 { + compatible = "nordic,nrf7002-qspi"; + status = "okay"; + reg = <1>; + qspi-frequency = <24000000>; + qspi-quad-mode; + + #include "nrf70_common.dtsi" + #include "nrf70_common_5g.dtsi" + }; +}; diff --git a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.yaml b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.yaml new file mode 100644 index 000000000000..ea43785b4559 --- /dev/null +++ b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.yaml @@ -0,0 +1,19 @@ +identifier: nrf7002dk/nrf5340/cpuapp/ns +name: NRF7002-DK-NRF5340-application-MCU-Non-Secure +type: mcu +arch: arm +toolchain: + - gnuarmemb + - xtools + - zephyr +ram: 192 +flash: 192 +supported: + - gpio + - i2c + - pwm + - watchdog + - usbd + - usb_device + - netif:openthread +vendor: nordic diff --git a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns_defconfig b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns_defconfig new file mode 100644 index 000000000000..1886b926bfd5 --- /dev/null +++ b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns_defconfig @@ -0,0 +1,23 @@ +# SPDX-License-Identifier: Apache-2.0 + +# Enable MPU +CONFIG_ARM_MPU=y + +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y + +# Enable TrustZone-M +CONFIG_ARM_TRUSTZONE_M=y + +# This Board implies building Non-Secure firmware +CONFIG_TRUSTED_EXECUTION_NONSECURE=y + +# enable GPIO +CONFIG_GPIO=y + +# Enable uart driver +CONFIG_SERIAL=y + +# enable console +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y From 84798b794386df86e82153fedeecb2e1b3105ef6 Mon Sep 17 00:00:00 2001 From: Maximilian Deubel Date: Wed, 15 Nov 2023 12:55:40 +0100 Subject: [PATCH 1696/2141] [nrf noup] boards: arm: nrf9131ek: enable tfm This patch backports the nrf9131ek to a time before tfm was refactored. To be reverted when TF-M is updated. Signed-off-by: Maximilian Deubel (cherry picked from commit 797a60e8542a450d615b7fd1007f3c407fae87b8) --- boards/nordic/nrf9131ek/Kconfig.defconfig | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/boards/nordic/nrf9131ek/Kconfig.defconfig b/boards/nordic/nrf9131ek/Kconfig.defconfig index e1d8de241c0a..1a30d006b4c6 100644 --- a/boards/nordic/nrf9131ek/Kconfig.defconfig +++ b/boards/nordic/nrf9131ek/Kconfig.defconfig @@ -8,3 +8,22 @@ config HW_STACK_PROTECTION config BOARD_NRF9131EK select USE_DT_CODE_PARTITION if BOARD_NRF9131EK_NRF9131_NS + +if BOARD_NRF9131EK_NRF9131 || BOARD_NRF9131EK_NRF9131_NS + +# By default, if we build for a Non-Secure version of the board, +# enable building with TF-M as the Secure Execution Environment. +config BUILD_WITH_TFM + default y if BOARD_NRF9131EK_NRF9131_NS + +if BUILD_WITH_TFM + +# By default, if we build with TF-M, instruct build system to +# flash the combined TF-M (Secure) & Zephyr (Non Secure) image +config TFM_FLASH_MERGED_BINARY + bool + default y + +endif # BUILD_WITH_TFM + +endif # BOARD_NRF9131EK_NRF9131 || BOARD_NRF9131EK_NRF9131_NS From 72becd444df29326d03f7374c21f0e73e3641ac1 Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Thu, 31 Jul 2025 14:26:40 +0200 Subject: [PATCH 1697/2141] [nrf noup] bluetooth: host: Allow auto swap feature without privacy Allow to use CONFIG_BT_ID_AUTO_SWAP_MATCHING_BONDS Kconfig option even if CONFIG_BT_PRIVACY is disabled. This is because CONFIG_BT_PRIVACY configures privacy of local device will still allows to resolve peer address. During pairing, peer device may send its Identity Address and IRK which then can be used for address resolution. This doesn't require CONFIG_BT_PRIVACY be enabled. nrf-squash! [nrf noup] bluetooth: host: Add support for bonding with same peer Signed-off-by: Pavel Vasilyev (cherry picked from commit c1ddd14ed35f577e22cdd0021781a70bda2a0926) --- subsys/bluetooth/host/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/bluetooth/host/Kconfig b/subsys/bluetooth/host/Kconfig index 4e275e6cc285..126649f15029 100644 --- a/subsys/bluetooth/host/Kconfig +++ b/subsys/bluetooth/host/Kconfig @@ -661,7 +661,7 @@ config BT_ID_UNPAIR_MATCHING_BONDS config BT_ID_AUTO_SWAP_MATCHING_BONDS bool "Automatically swap conflicting entries in the Resolving List" depends on !BT_ID_UNPAIR_MATCHING_BONDS - depends on BT_PRIVACY && BT_PERIPHERAL && !BT_CENTRAL + depends on BT_SMP && BT_PERIPHERAL && !BT_CENTRAL help If this option is enabled, the Host will not add a new bond with the same peer address (or IRK) to the Resolving List if there is From 21eab19151e895ac1cf376f2e1e3bd6ee143ef0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Bainczyk?= Date: Thu, 31 Jul 2025 13:09:12 +0200 Subject: [PATCH 1698/2141] [nrf fromlist] tests: boards: nrf: qdec: Fix test for multiple instances MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fixed pin configuration for nRF54L15 (QDECs can use only port 1) - Changed the way the test handles testing multiple instances to make it possible to output quadrature signal to one QDEC instance at a time. Upstream PR #: 93927 Signed-off-by: Michał Bainczyk (cherry picked from commit e6948df926e1027caeb3914a2dc37430aca3d09c) --- .../boards/bl54l15_dvk_nrf54l15_common.dtsi | 14 +- .../boards/bl54l15u_dvk_nrf54l15_common.dtsi | 14 +- .../qdec/boards/nrf52840dk_nrf52840.overlay | 8 + .../boards/nrf5340dk_nrf5340_cpuapp.overlay | 14 +- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 25 +- .../boards/nrf54l15dk_nrf54l15_common.dtsi | 45 +-- .../boards/nrf54lm20dk_nrf54lm20_common.dtsi | 14 +- .../qdec/dts/bindings/test-qdec-loopback.yaml | 20 ++ tests/boards/nrf/qdec/src/main.c | 313 ++++++++---------- 9 files changed, 238 insertions(+), 229 deletions(-) create mode 100644 tests/boards/nrf/qdec/dts/bindings/test-qdec-loopback.yaml diff --git a/tests/boards/nrf/qdec/boards/bl54l15_dvk_nrf54l15_common.dtsi b/tests/boards/nrf/qdec/boards/bl54l15_dvk_nrf54l15_common.dtsi index 4db67a49a5e0..19ca5e83647f 100644 --- a/tests/boards/nrf/qdec/boards/bl54l15_dvk_nrf54l15_common.dtsi +++ b/tests/boards/nrf/qdec/boards/bl54l15_dvk_nrf54l15_common.dtsi @@ -5,12 +5,6 @@ */ / { - aliases { - qdec0 = &qdec20; - qenca = &phase_a; - qencb = &phase_b; - }; - encoder-emulate { compatible = "gpio-leds"; @@ -22,6 +16,14 @@ gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>; }; }; + + qdec_loopbacks: loopbacks { + compatible = "test-qdec-loopbacks"; + loopback0 { + qdec = <&qdec20>; + qenc-emul-gpios = <&phase_a &phase_b>; + }; + }; }; &pinctrl { diff --git a/tests/boards/nrf/qdec/boards/bl54l15u_dvk_nrf54l15_common.dtsi b/tests/boards/nrf/qdec/boards/bl54l15u_dvk_nrf54l15_common.dtsi index 4db67a49a5e0..19ca5e83647f 100644 --- a/tests/boards/nrf/qdec/boards/bl54l15u_dvk_nrf54l15_common.dtsi +++ b/tests/boards/nrf/qdec/boards/bl54l15u_dvk_nrf54l15_common.dtsi @@ -5,12 +5,6 @@ */ / { - aliases { - qdec0 = &qdec20; - qenca = &phase_a; - qencb = &phase_b; - }; - encoder-emulate { compatible = "gpio-leds"; @@ -22,6 +16,14 @@ gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>; }; }; + + qdec_loopbacks: loopbacks { + compatible = "test-qdec-loopbacks"; + loopback0 { + qdec = <&qdec20>; + qenc-emul-gpios = <&phase_a &phase_b>; + }; + }; }; &pinctrl { diff --git a/tests/boards/nrf/qdec/boards/nrf52840dk_nrf52840.overlay b/tests/boards/nrf/qdec/boards/nrf52840dk_nrf52840.overlay index 9ee3749b4ff8..0c098f238bd0 100644 --- a/tests/boards/nrf/qdec/boards/nrf52840dk_nrf52840.overlay +++ b/tests/boards/nrf/qdec/boards/nrf52840dk_nrf52840.overlay @@ -21,6 +21,14 @@ gpios = <&gpio1 4 GPIO_ACTIVE_HIGH>; }; }; + + qdec_loopbacks: loopbacks { + compatible = "test-qdec-loopbacks"; + loopback0 { + qdec = <&qdec0>; + qenc-emul-gpios = <&phase_a &phase_b>; + }; + }; }; &pinctrl { diff --git a/tests/boards/nrf/qdec/boards/nrf5340dk_nrf5340_cpuapp.overlay b/tests/boards/nrf/qdec/boards/nrf5340dk_nrf5340_cpuapp.overlay index 22f5307a760a..04872e1de5c7 100644 --- a/tests/boards/nrf/qdec/boards/nrf5340dk_nrf5340_cpuapp.overlay +++ b/tests/boards/nrf/qdec/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -4,12 +4,6 @@ */ / { - aliases { - qdec0 = &qdec1; - qenca = &phase_a; - qencb = &phase_b; - }; - encoder-emulate { compatible = "gpio-leds"; phase_a: phase_a { @@ -21,6 +15,14 @@ gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>; }; }; + + qdec_loopbacks: loopbacks { + compatible = "test-qdec-loopbacks"; + loopback0 { + qdec = <&qdec1>; + qenc-emul-gpios = <&phase_a &phase_b>; + }; + }; }; &pinctrl { diff --git a/tests/boards/nrf/qdec/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/boards/nrf/qdec/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index 78f3aa09ace4..7e43c70dac0f 100644 --- a/tests/boards/nrf/qdec/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/tests/boards/nrf/qdec/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -11,21 +11,12 @@ */ / { - aliases { - qdec0 = &qdec130; - qdec1 = &qdec131; - qenca = &phase_a; - qencb = &phase_b; - qenca1 = &phase_a1; - qencb1 = &phase_b1; - }; - encoder-emulate { compatible = "gpio-leds"; - phase_a: phase_a { + phase_a0: phase_a0 { gpios = <&gpio2 9 GPIO_ACTIVE_HIGH>; }; - phase_b: phase_b { + phase_b0: phase_b0 { gpios = <&gpio2 11 GPIO_ACTIVE_HIGH>; }; phase_a1: phase_a1 { @@ -35,6 +26,18 @@ gpios = <&gpio7 1 GPIO_ACTIVE_HIGH>; }; }; + + qdec_loopbacks: loopbacks { + compatible = "test-qdec-loopbacks"; + loopback0 { + qdec = <&qdec130>; + qenc-emul-gpios = <&phase_a0 &phase_b0>; + }; + loopback1 { + qdec = <&qdec131>; + qenc-emul-gpios = <&phase_a1 &phase_b1>; + }; + }; }; &pinctrl { diff --git a/tests/boards/nrf/qdec/boards/nrf54l15dk_nrf54l15_common.dtsi b/tests/boards/nrf/qdec/boards/nrf54l15dk_nrf54l15_common.dtsi index 06a490d1da08..f27294146527 100644 --- a/tests/boards/nrf/qdec/boards/nrf54l15dk_nrf54l15_common.dtsi +++ b/tests/boards/nrf/qdec/boards/nrf54l15dk_nrf54l15_common.dtsi @@ -4,35 +4,38 @@ */ /* Required loopbacks - * P1.8 <-> P1.9 - * P1.10 >-> P1.11 - * P2.8 <-> P2.9 - * P2.10 <-> P1.14 + * P1.8 <-> P1.9 + * P1.10 <-> P1.11 + * P1.12 <-> P1.13 + * P1.14 <-> P2.10 */ / { - aliases { - qdec0 = &qdec20; - qdec1 = &qdec21; - qenca = &phase_a; - qencb = &phase_b; - qenca1 = &phase_a1; - qencb1 = &phase_b1; - }; - encoder-emulate { compatible = "gpio-leds"; - phase_a: phase_a { + phase_a0: phase_a0 { gpios = <&gpio1 9 GPIO_ACTIVE_HIGH>; }; - phase_b: phase_b { + phase_b0: phase_b0 { gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>; }; phase_a1: phase_a1 { - gpios = <&gpio2 9 GPIO_ACTIVE_HIGH>; + gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>; }; phase_b1: phase_b1 { - gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>; + gpios = <&gpio2 10 GPIO_ACTIVE_HIGH>; + }; + }; + + qdec_loopbacks: loopbacks { + compatible = "test-qdec-loopbacks"; + loopback0 { + qdec = <&qdec20>; + qenc-emul-gpios = <&phase_a0 &phase_b0>; + }; + loopback1 { + qdec = <&qdec21>; + qenc-emul-gpios = <&phase_a1 &phase_b1>; }; }; }; @@ -55,15 +58,15 @@ qdec_21_pinctrl: qdec_21_pinctrl { group1 { - psels = , - ; + psels = , + ; }; }; qdec_21_sleep_pinctrl: qdec_21_sleep_pinctrl { group1 { - psels = , - ; + psels = , + ; low-power-enable; }; }; diff --git a/tests/boards/nrf/qdec/boards/nrf54lm20dk_nrf54lm20_common.dtsi b/tests/boards/nrf/qdec/boards/nrf54lm20dk_nrf54lm20_common.dtsi index 84e7b1dbc30f..6f8f3a184312 100644 --- a/tests/boards/nrf/qdec/boards/nrf54lm20dk_nrf54lm20_common.dtsi +++ b/tests/boards/nrf/qdec/boards/nrf54lm20dk_nrf54lm20_common.dtsi @@ -11,12 +11,6 @@ */ / { - aliases { - qdec0 = &qdec20; - qenca = &phase_a; - qencb = &phase_b; - }; - encoder-emulate { compatible = "gpio-leds"; phase_a: phase_a { @@ -26,6 +20,14 @@ gpios = <&gpio1 23 GPIO_ACTIVE_HIGH>; }; }; + + qdec_loopbacks: loopbacks { + compatible = "test-qdec-loopbacks"; + loopback0 { + qdec = <&qdec20>; + qenc-emul-gpios = <&phase_a &phase_b>; + }; + }; }; &pinctrl { diff --git a/tests/boards/nrf/qdec/dts/bindings/test-qdec-loopback.yaml b/tests/boards/nrf/qdec/dts/bindings/test-qdec-loopback.yaml new file mode 100644 index 000000000000..e03b2ff3bc32 --- /dev/null +++ b/tests/boards/nrf/qdec/dts/bindings/test-qdec-loopback.yaml @@ -0,0 +1,20 @@ +description: | + Binding describing loopbacks required to run tests/boards/nrf/qdec test in Zephyr. + +compatible: "test-qdec-loopbacks" + +child-binding: + description: | + Binding describing a single loopback pair consisting of a QDEC device and two "gpio-leds" pins + working as a quadrature encoder for the test. + properties: + qdec: + type: phandle + required: true + description: Node of the QDEC device used to capture quadrature signal in the loopback. + qenc-emul-gpios: + type: phandles + required: true + description: | + Children nodes of "gpio-leds" compatible used to generate quadrature signal. The first + phandles outputs phase A signal, the second one outputs phase B signal. diff --git a/tests/boards/nrf/qdec/src/main.c b/tests/boards/nrf/qdec/src/main.c index 7df97be2a432..9d138d325fb5 100644 --- a/tests/boards/nrf/qdec/src/main.c +++ b/tests/boards/nrf/qdec/src/main.c @@ -11,27 +11,40 @@ #include #include -static K_SEM_DEFINE(sem, 0, 1); -static const struct gpio_dt_spec phase_a = GPIO_DT_SPEC_GET(DT_ALIAS(qenca), gpios); -static const struct gpio_dt_spec phase_b = GPIO_DT_SPEC_GET(DT_ALIAS(qencb), gpios); -static const struct device *const qdec_dev = DEVICE_DT_GET(DT_ALIAS(qdec0)); -static const uint32_t qdec_config_step = DT_PROP(DT_ALIAS(qdec0), steps); - -/* Disable testing second QDEC instance - * until the issue with multiple - * QDEC instances support is resolved +/** + * Structure grouping gpio pins used for QENC emulation connected with a QDEC device + * with a loopback. */ -#if DT_NODE_EXISTS(DT_ALIAS(qdecX)) -#define SECOND_QDEC_INSTANCE - -static const struct gpio_dt_spec phase_a1 = GPIO_DT_SPEC_GET(DT_ALIAS(qenca1), gpios); -static const struct gpio_dt_spec phase_b1 = GPIO_DT_SPEC_GET(DT_ALIAS(qencb1), gpios); -static const struct device *const qdec_1_dev = DEVICE_DT_GET(DT_ALIAS(qdec1)); -static const uint32_t qdec_1_config_step = DT_PROP(DT_ALIAS(qdec1), steps); -#endif +struct qdec_qenc_loopback { + struct gpio_dt_spec qenc_phase_a; + struct gpio_dt_spec qenc_phase_b; + + const struct device *qdec; + uint32_t qdec_config_step; +}; + +static K_SEM_DEFINE(sem, 0, 1); + +#define GET_QDEC_QENC_LOOPBACK(x) \ + { \ + .qenc_phase_a = GPIO_DT_SPEC_GET(DT_PHANDLE_BY_IDX(x, qenc_emul_gpios, 0), gpios), \ + .qenc_phase_b = GPIO_DT_SPEC_GET(DT_PHANDLE_BY_IDX(x, qenc_emul_gpios, 1), gpios), \ + .qdec = DEVICE_DT_GET(DT_PHANDLE(x, qdec)), \ + .qdec_config_step = DT_PROP_BY_PHANDLE(x, qdec, steps) \ + } + + +struct qdec_qenc_loopback loopbacks[] = { + DT_FOREACH_CHILD_SEP(DT_NODELABEL(qdec_loopbacks), GET_QDEC_QENC_LOOPBACK, (,)) +}; + +#define TESTED_QDEC_COUNT ARRAY_SIZE(loopbacks) + static struct sensor_trigger qdec_trigger = {.type = SENSOR_TRIG_DATA_READY, .chan = SENSOR_CHAN_ROTATION}; + static bool toggle_a = true; +static struct qdec_qenc_loopback *loopback_currently_under_test; static void qdec_trigger_handler(const struct device *dev, const struct sensor_trigger *trigger) { @@ -48,15 +61,9 @@ static void qdec_trigger_handler(const struct device *dev, const struct sensor_t static void qenc_emulate_work_handler(struct k_work *work) { if (toggle_a) { - gpio_pin_toggle_dt(&phase_a); -#if defined(SECOND_QDEC_INSTANCE) - gpio_pin_toggle_dt(&phase_a1); -#endif + gpio_pin_toggle_dt(&loopback_currently_under_test->qenc_phase_a); } else { - gpio_pin_toggle_dt(&phase_b); -#if defined(SECOND_QDEC_INSTANCE) - gpio_pin_toggle_dt(&phase_b1); -#endif + gpio_pin_toggle_dt(&loopback_currently_under_test->qenc_phase_b); } toggle_a = !toggle_a; } @@ -89,52 +96,46 @@ static void qenc_emulate_setup_pin(const struct gpio_dt_spec *gpio_dt) zassert_true(rc == 0, "%s: pin configure failed: %d", gpio_dt->port->name, rc); } -static void qenc_emulate_start(k_timeout_t period, bool forward) +static void qenc_emulate_start(struct qdec_qenc_loopback *loopback, k_timeout_t period, + bool forward) { - qenc_emulate_reset_pin(&phase_a); - qenc_emulate_reset_pin(&phase_b); -#if defined(SECOND_QDEC_INSTANCE) - qenc_emulate_reset_pin(&phase_a1); - qenc_emulate_reset_pin(&phase_b1); -#endif + qenc_emulate_reset_pin(&loopback->qenc_phase_a); + qenc_emulate_reset_pin(&loopback->qenc_phase_b); toggle_a = !forward; - + loopback_currently_under_test = loopback; k_timer_start(&qenc_emulate_timer, period, period); } static void qenc_emulate_stop(void) { - k_timer_stop(&qenc_emulate_timer); - - qenc_emulate_reset_pin(&phase_a); - qenc_emulate_reset_pin(&phase_b); -#if defined(SECOND_QDEC_INSTANCE) - qenc_emulate_reset_pin(&phase_a1); - qenc_emulate_reset_pin(&phase_b1); -#endif + if (loopback_currently_under_test) { + k_timer_stop(&qenc_emulate_timer); + qenc_emulate_reset_pin(&loopback_currently_under_test->qenc_phase_a); + qenc_emulate_reset_pin(&loopback_currently_under_test->qenc_phase_b); + } } -static void qenc_emulate_verify_reading(const struct device *const dev, int emulator_period_ms, - int emulation_duration_ms, bool forward, bool overflow_expected, - const uint32_t config_step) +static void qenc_emulate_verify_reading(struct qdec_qenc_loopback *loopback, + int emulator_period_ms, int emulation_duration_ms, bool forward, + bool overflow_expected) { int rc; struct sensor_value val = {0}; int32_t expected_steps = emulation_duration_ms / emulator_period_ms; - int32_t expected_reading = 360 * expected_steps / config_step; - int32_t delta = expected_reading / 5; + int32_t expected_reading = 360 * expected_steps / loopback->qdec_config_step; + int32_t delta = expected_reading / 4; if (!forward) { expected_reading *= -1; } - qenc_emulate_start(K_MSEC(emulator_period_ms), forward); + qenc_emulate_start(loopback, K_MSEC(emulator_period_ms), forward); /* wait for some readings */ k_msleep(emulation_duration_ms); - rc = sensor_sample_fetch(dev); + rc = sensor_sample_fetch(loopback->qdec); if (!overflow_expected) { zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); @@ -142,7 +143,7 @@ static void qenc_emulate_verify_reading(const struct device *const dev, int emul zassert_true(rc == -EOVERFLOW, "Failed to detect overflow"); } - rc = sensor_channel_get(dev, SENSOR_CHAN_ROTATION, &val); + rc = sensor_channel_get(loopback->qdec, SENSOR_CHAN_ROTATION, &val); zassert_true(rc == 0, "Failed to get sample (%d)", rc); TC_PRINT("Expected reading: %d, actual value: %d, delta: %d\n", @@ -157,31 +158,31 @@ static void qenc_emulate_verify_reading(const struct device *const dev, int emul /* wait and get readings to clear state */ k_msleep(100); - rc = sensor_sample_fetch(dev); + rc = sensor_sample_fetch(loopback->qdec); zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); - rc = sensor_channel_get(dev, SENSOR_CHAN_ROTATION, &val); + rc = sensor_channel_get(loopback->qdec, SENSOR_CHAN_ROTATION, &val); zassert_true(rc == 0, "Failed to get sample (%d)", rc); } -static void sensor_trigger_set_and_disable(const struct device *const dev) +static void sensor_trigger_set_and_disable(struct qdec_qenc_loopback *loopback) { int rc; if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_get(dev); + pm_device_runtime_get(loopback->qdec); } k_sem_give(&sem); qdec_trigger.type = SENSOR_TRIG_DATA_READY; qdec_trigger.chan = SENSOR_CHAN_ALL; - rc = sensor_trigger_set(dev, &qdec_trigger, qdec_trigger_handler); + rc = sensor_trigger_set(loopback->qdec, &qdec_trigger, qdec_trigger_handler); zassume_true(rc != -ENOSYS, "sensor_trigger_set not supported"); zassert_true(rc == 0, "sensor_trigger_set failed: %d", rc); - qenc_emulate_start(K_MSEC(10), true); + qenc_emulate_start(loopback, K_MSEC(10), true); /* emulation working, handler should be called */ rc = k_sem_take(&sem, K_MSEC(200)); @@ -193,7 +194,7 @@ static void sensor_trigger_set_and_disable(const struct device *const dev) rc = k_sem_take(&sem, K_MSEC(200)); if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_put(dev); + pm_device_runtime_put(loopback->qdec); } /* there should be no triggers now*/ @@ -201,21 +202,21 @@ static void sensor_trigger_set_and_disable(const struct device *const dev) zassert_true(rc == -EAGAIN, "qdec handler should not be triggered (%d)", rc); if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_get(dev); + pm_device_runtime_get(loopback->qdec); } /* register empty trigger - disable trigger */ - rc = sensor_trigger_set(dev, &qdec_trigger, NULL); + rc = sensor_trigger_set(loopback->qdec, &qdec_trigger, NULL); zassert_true(rc == 0, "sensor_trigger_set failed: %d", rc); - qenc_emulate_start(K_MSEC(10), true); + qenc_emulate_start(loopback, K_MSEC(10), true); /* emulation working, but handler not set, thus should not be called */ rc = k_sem_take(&sem, K_MSEC(200)); zassert_true(rc == -EAGAIN, "qdec handler should not be triggered (%d)", rc); if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_put(dev); + pm_device_runtime_put(loopback->qdec); } } @@ -227,49 +228,50 @@ static void sensor_trigger_set_and_disable(const struct device *const dev) */ ZTEST(qdec_sensor, test_sensor_trigger_set_and_disable) { - TC_PRINT("Testing QDEC-0, address: %p\n", qdec_dev); - sensor_trigger_set_and_disable(qdec_dev); -#if defined(SECOND_QDEC_INSTANCE) - TC_PRINT("Testing QDEC-1, address: %p\n", qdec_1_dev); - sensor_trigger_set_and_disable(qdec_1_dev); -#endif - + for (size_t i = 0; i < TESTED_QDEC_COUNT; i++) { + TC_PRINT("Testing QDEC index %d, address: %p\n", i, loopbacks[i].qdec); + sensor_trigger_set_and_disable(&loopbacks[i]); + } } -static void sensor_trigger_set_test(const struct device *const dev) +static void sensor_trigger_set_test(struct qdec_qenc_loopback *loopback) { int rc; struct sensor_value val = {0}; if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_get(dev); + pm_device_runtime_get(loopback->qdec); } qdec_trigger.type = SENSOR_TRIG_DATA_READY; qdec_trigger.chan = SENSOR_CHAN_ROTATION; - rc = sensor_trigger_set(dev, &qdec_trigger, qdec_trigger_handler); + rc = sensor_trigger_set(loopback->qdec, &qdec_trigger, qdec_trigger_handler); zassume_true(rc != -ENOSYS, "sensor_trigger_set not supported"); zassert_true(rc == 0, "sensor_trigger_set failed: %d", rc); - qenc_emulate_start(K_MSEC(10), true); + qenc_emulate_start(loopback, K_MSEC(10), true); /* emulation working now */ rc = k_sem_take(&sem, K_MSEC(200)); zassert_true(rc == 0, "qdec handler should be triggered (%d)", rc); - rc = sensor_sample_fetch(dev); + rc = sensor_sample_fetch(loopback->qdec); zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); - rc = sensor_channel_get(dev, SENSOR_CHAN_ROTATION, &val); + rc = sensor_channel_get(loopback->qdec, SENSOR_CHAN_ROTATION, &val); zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); TC_PRINT("QDEC reading: %d\n", val.val1); zassert_true(val.val1 != 0, "No readings from QDEC"); if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_put(dev); + pm_device_runtime_put(loopback->qdec); } + + qenc_emulate_stop(); + /* emulation not working, but there may be old trigger which needs to be cleaned up */ + rc = k_sem_take(&sem, K_MSEC(200)); } /** @@ -280,39 +282,37 @@ static void sensor_trigger_set_test(const struct device *const dev) */ ZTEST(qdec_sensor, test_sensor_trigger_set) { - TC_PRINT("Testing QDEC-0, address: %p\n", qdec_dev); - sensor_trigger_set_test(qdec_dev); -#if defined(SECOND_QDEC_INSTANCE) - TC_PRINT("Testing QDEC-1, address: %p\n", qdec_1_dev); - sensor_trigger_set_test(qdec_1_dev); -#endif + for (size_t i = 0; i < TESTED_QDEC_COUNT; i++) { + TC_PRINT("Testing QDEC index %d, address: %p\n", i, loopbacks[i].qdec); + sensor_trigger_set_test(&loopbacks[i]); + } } -static void sensor_trigger_set_negative(const struct device *const dev) +static void sensor_trigger_set_negative(struct qdec_qenc_loopback *loopback) { int rc; if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_get(dev); + pm_device_runtime_get(loopback->qdec); } - rc = sensor_trigger_set(dev, &qdec_trigger, qdec_trigger_handler); + rc = sensor_trigger_set(loopback->qdec, &qdec_trigger, qdec_trigger_handler); zassume_true(rc != -ENOSYS, "sensor_trigger_set not supported"); qdec_trigger.type = SENSOR_TRIG_MAX; qdec_trigger.chan = SENSOR_CHAN_ROTATION; - rc = sensor_trigger_set(dev, &qdec_trigger, qdec_trigger_handler); + rc = sensor_trigger_set(loopback->qdec, &qdec_trigger, qdec_trigger_handler); zassume_true(rc < 0, "sensor_trigger_set should fail due to invalid trigger type"); qdec_trigger.type = SENSOR_TRIG_DATA_READY; qdec_trigger.chan = SENSOR_CHAN_MAX; - rc = sensor_trigger_set(dev, &qdec_trigger, qdec_trigger_handler); + rc = sensor_trigger_set(loopback->qdec, &qdec_trigger, qdec_trigger_handler); zassume_true(rc < 0, "sensor_trigger_set should fail due to invalid channel"); if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_put(dev); + pm_device_runtime_put(loopback->qdec); } } @@ -324,12 +324,10 @@ static void sensor_trigger_set_negative(const struct device *const dev) */ ZTEST(qdec_sensor, test_sensor_trigger_set_negative) { - TC_PRINT("Testing QDEC-0, address: %p\n", qdec_dev); - sensor_trigger_set_negative(qdec_dev); -#if defined(SECOND_QDEC_INSTANCE) - TC_PRINT("Testing QDEC-1, address: %p\n", qdec_1_dev); - sensor_trigger_set_negative(qdec_1_dev); -#endif + for (size_t i = 0; i < TESTED_QDEC_COUNT; i++) { + TC_PRINT("Testing QDEC index %d, address: %p\n", i, loopbacks[i].qdec); + sensor_trigger_set_negative(&loopbacks[i]); + } } /** @@ -340,37 +338,22 @@ ZTEST(qdec_sensor, test_sensor_trigger_set_negative) */ ZTEST(qdec_sensor, test_qdec_readings) { - if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_get(qdec_dev); + for (size_t i = 0; i < TESTED_QDEC_COUNT; i++) { + if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { + pm_device_runtime_get(loopbacks[i].qdec); + } + + TC_PRINT("Testing QDEC index %d, address: %p\n", i, loopbacks[i].qdec); + qenc_emulate_verify_reading(&loopbacks[i], 10, 100, true, false); + qenc_emulate_verify_reading(&loopbacks[i], 2, 500, true, false); + qenc_emulate_verify_reading(&loopbacks[i], 10, 200, false, false); + qenc_emulate_verify_reading(&loopbacks[i], 1, 1000, false, true); + qenc_emulate_verify_reading(&loopbacks[i], 1, 1000, true, true); + + if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { + pm_device_runtime_put(loopbacks[i].qdec); + } } - - TC_PRINT("Testing QDEC-0, address: %p\n", qdec_dev); - qenc_emulate_verify_reading(qdec_dev, 10, 100, true, false, qdec_config_step); - qenc_emulate_verify_reading(qdec_dev, 2, 500, true, false, qdec_config_step); - qenc_emulate_verify_reading(qdec_dev, 10, 200, false, false, qdec_config_step); - qenc_emulate_verify_reading(qdec_dev, 1, 1000, false, true, qdec_config_step); - qenc_emulate_verify_reading(qdec_dev, 1, 1000, true, true, qdec_config_step); - - if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_put(qdec_dev); - } - -#if defined(SECOND_QDEC_INSTANCE) - if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_get(qdec_1_dev); - } - - TC_PRINT("Testing QDEC-1, address: %p\n", qdec_1_dev); - qenc_emulate_verify_reading(qdec_1_dev, 10, 100, true, false, qdec_1_config_step); - qenc_emulate_verify_reading(qdec_1_dev, 2, 500, true, false, qdec_1_config_step); - qenc_emulate_verify_reading(qdec_1_dev, 10, 200, false, false, qdec_1_config_step); - qenc_emulate_verify_reading(qdec_1_dev, 1, 1000, false, true, qdec_1_config_step); - qenc_emulate_verify_reading(qdec_1_dev, 1, 1000, true, true, qdec_1_config_step); - - if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_put(qdec_1_dev); - } -#endif } static void sensor_channel_get_empty(const struct device *const dev) @@ -419,40 +402,38 @@ static void sensor_channel_get_empty(const struct device *const dev) */ ZTEST(qdec_sensor, test_sensor_channel_get_empty) { - TC_PRINT("Testing QDEC-0, address: %p\n", qdec_dev); - sensor_channel_get_empty(qdec_dev); -#if defined(SECOND_QDEC_INSTANCE) - TC_PRINT("Testing QDEC-1, address: %p\n", qdec_1_dev); - sensor_channel_get_empty(qdec_1_dev); -#endif + for (size_t i = 0; i < TESTED_QDEC_COUNT; i++) { + TC_PRINT("Testing QDEC index %d, address: %p\n", i, loopbacks[i].qdec); + sensor_channel_get_empty(loopbacks[i].qdec); + } } -static void sensor_channel_get_test(const struct device *const dev) +static void sensor_channel_get_test(struct qdec_qenc_loopback *loopback) { int rc; struct sensor_value val_first = {0}; struct sensor_value val_second = {0}; if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_get(qdec_dev); + pm_device_runtime_get(loopback->qdec); } - qenc_emulate_start(K_MSEC(10), true); + qenc_emulate_start(loopback, K_MSEC(10), true); /* wait for some readings*/ k_msleep(100); - rc = sensor_sample_fetch(qdec_dev); + rc = sensor_sample_fetch(loopback->qdec); zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); - rc = sensor_channel_get(qdec_dev, SENSOR_CHAN_ROTATION, &val_first); + rc = sensor_channel_get(loopback->qdec, SENSOR_CHAN_ROTATION, &val_first); zassert_true(rc == 0, "Failed to get sample (%d)", rc); zassert_true(val_first.val1 != 0, "No readings from QDEC"); /* wait for more readings*/ k_msleep(200); - rc = sensor_channel_get(qdec_dev, SENSOR_CHAN_ROTATION, &val_second); + rc = sensor_channel_get(loopback->qdec, SENSOR_CHAN_ROTATION, &val_second); zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); zassert_true(val_second.val1 != 0, "No readings from QDEC"); @@ -470,7 +451,7 @@ static void sensor_channel_get_test(const struct device *const dev) val_second.val2); if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_put(qdec_dev); + pm_device_runtime_put(loopback->qdec); } } @@ -482,38 +463,36 @@ static void sensor_channel_get_test(const struct device *const dev) */ ZTEST(qdec_sensor, test_sensor_channel_get) { - TC_PRINT("Testing QDEC-0, address: %p\n", qdec_dev); - sensor_channel_get_test(qdec_dev); -#if defined(SECOND_QDEC_INSTANCE) - TC_PRINT("Testing QDEC-1, address: %p\n", qdec_1_dev); - sensor_channel_get_test(qdec_1_dev); -#endif + for (size_t i = 0; i < TESTED_QDEC_COUNT; i++) { + TC_PRINT("Testing QDEC index %d, address: %p\n", i, loopbacks[i].qdec); + sensor_channel_get_test(&loopbacks[i]); + } } -static void sensor_channel_get_negative(const struct device *const dev) +static void sensor_channel_get_negative(struct qdec_qenc_loopback *loopback) { int rc; struct sensor_value val = {0}; if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_get(dev); + pm_device_runtime_get(loopback->qdec); } - qenc_emulate_start(K_MSEC(10), true); + qenc_emulate_start(loopback, K_MSEC(10), true); /* wait for some readings*/ k_msleep(100); - rc = sensor_sample_fetch(dev); + rc = sensor_sample_fetch(loopback->qdec); zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); - rc = sensor_channel_get(dev, SENSOR_CHAN_MAX, &val); + rc = sensor_channel_get(loopback->qdec, SENSOR_CHAN_MAX, &val); zassert_true(rc < 0, "Should failed to get sample (%d)", rc); zassert_true(val.val1 == 0, "Some readings from QDEC: %d", val.val1); zassert_true(val.val2 == 0, "Some readings from QDEC: %d", val.val2); if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - pm_device_runtime_put(dev); + pm_device_runtime_put(loopback->qdec); } } @@ -525,12 +504,10 @@ static void sensor_channel_get_negative(const struct device *const dev) */ ZTEST(qdec_sensor, test_sensor_channel_get_negative) { - TC_PRINT("Testing QDEC-0, address: %p\n", qdec_dev); - sensor_channel_get_negative(qdec_dev); -#if defined(SECOND_QDEC_INSTANCE) - TC_PRINT("Testing QDEC-1, address: %p\n", qdec_1_dev); - sensor_channel_get_negative(qdec_1_dev); -#endif + for (size_t i = 0; i < TESTED_QDEC_COUNT; i++) { + TC_PRINT("Testing QDEC index %d, address: %p\n", i, loopbacks[i].qdec); + sensor_channel_get_negative(&loopbacks[i]); + } } static void sensor_sample_fetch_test(const struct device *const dev) @@ -563,32 +540,22 @@ static void sensor_sample_fetch_test(const struct device *const dev) */ ZTEST(qdec_sensor, test_sensor_sample_fetch) { - TC_PRINT("Testing QDEC-0, address: %p\n", qdec_dev); - sensor_sample_fetch_test(qdec_dev); -#if defined(SECOND_QDEC_INSTANCE) - TC_PRINT("Testing QDEC-1, address: %p\n", qdec_1_dev); - sensor_sample_fetch_test(qdec_1_dev); -#endif + for (size_t i = 0; i < TESTED_QDEC_COUNT; i++) { + TC_PRINT("Testing QDEC index %d, address: %p\n", i, loopbacks[i].qdec); + sensor_sample_fetch_test(loopbacks[i].qdec); + } } static void *setup(void) { - int rc; - - rc = device_is_ready(qdec_dev); - zassert_true(rc, "QDEC device not ready: %d", rc); + for (size_t i = 0; i < TESTED_QDEC_COUNT; i++) { + int rc = device_is_ready(loopbacks[i].qdec); - qenc_emulate_setup_pin(&phase_a); - qenc_emulate_setup_pin(&phase_b); - -#if defined(SECOND_QDEC_INSTANCE) - rc = device_is_ready(qdec_1_dev); - zassert_true(rc, "QDEC 1 device not ready: %d", rc); - - qenc_emulate_setup_pin(&phase_a1); - qenc_emulate_setup_pin(&phase_b1); -#endif + zassert_true(rc, "QDEC index %d not ready: %d", i, rc); + qenc_emulate_setup_pin(&loopbacks[i].qenc_phase_a); + qenc_emulate_setup_pin(&loopbacks[i].qenc_phase_b); + } return NULL; } From 7283923e0bf0027ea42515ba90d61c1941d17987 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stine=20=C3=85kredalen?= Date: Mon, 4 Aug 2025 01:26:12 +0200 Subject: [PATCH 1699/2141] [nrf noup] samples: bluetooth: mesh: update stack sizes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Increased stack sizes for mesh provisoner sample. Values are based of thread analysis, plus added margin. Signed-off-by: Stine Åkredalen (cherry picked from commit 8876f35b0208e315d554ca1fec6f66643340fd0d) --- samples/bluetooth/mesh_provisioner/prj.conf | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/samples/bluetooth/mesh_provisioner/prj.conf b/samples/bluetooth/mesh_provisioner/prj.conf index 241767805164..0e5f6490edee 100644 --- a/samples/bluetooth/mesh_provisioner/prj.conf +++ b/samples/bluetooth/mesh_provisioner/prj.conf @@ -1,6 +1,10 @@ #CONFIG_INIT_STACKS=y -CONFIG_MAIN_STACK_SIZE=2048 -CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048 +# Stack sizes from thread analysis + 50% margin, rounded to nearest 100 +CONFIG_MAIN_STACK_SIZE=4400 +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4800 +CONFIG_BT_MESH_SETTINGS_WORKQ_STACK_SIZE=1700 +CONFIG_BT_MESH_ADV_STACK_SIZE=4000 +CONFIG_BT_RX_STACK_SIZE=3300 # The Bluetooth API should not be used from a preemptive thread: CONFIG_MAIN_THREAD_PRIORITY=-2 From 308c990a00be0287ba8476e3b28b2a1141092090 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20St=C4=99pnicki?= Date: Wed, 6 Aug 2025 09:22:26 +0200 Subject: [PATCH 1700/2141] [nrf noup] soc: nordic: ironside: fix typo in Kconfig MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This typo was fixed in upstream but not ported to NCS This creates conflicts when cherry picking. Signed-off-by: Łukasz Stępnicki (cherry picked from commit ec8bfd85d4ec9a7e883345312633c8dfae54e9d2) --- soc/nordic/ironside/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soc/nordic/ironside/Kconfig b/soc/nordic/ironside/Kconfig index ce4878b7b182..32c6ef38165f 100644 --- a/soc/nordic/ironside/Kconfig +++ b/soc/nordic/ironside/Kconfig @@ -76,7 +76,7 @@ config NRF_IRONSIDE_ABB_STATUSANA_CHECK_MAX_ATTEMPTS range 0 255 default 50 help - Maximum attempts with 10us intervals before busy status will be reported. + Maximum timeout when waiting for DVFS oppoint change mutex lock. endif # NRF_IRONSIDE_DVFS_SERVICE From 326b4113dcb6fcf715bc5bb2f90563ea3b86ef0c Mon Sep 17 00:00:00 2001 From: Tomi Fontanilles Date: Fri, 31 Jan 2025 14:47:05 +0200 Subject: [PATCH 1701/2141] [nrf noup] tests: secure_storage: fix test w/ ZMS backend on 54L15 noup because it's about partition manager. Fix the build of secure_storage.psa.its.secure_storage.store.zms on nrf54l15dk/nrf54l15/cpuapp by disabling partition manager, which is incompatible with the ZMS implementation of the ITS store module. Disabling it only for that test as it's not needed for the others and even makes the NS board targets fail if disabling PM. Signed-off-by: Tomi Fontanilles (cherry picked from commit eb02a0210ff85ff00c9bacdf14c692f97d2e4d35) --- tests/subsys/secure_storage/psa/its/testcase.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/subsys/secure_storage/psa/its/testcase.yaml b/tests/subsys/secure_storage/psa/its/testcase.yaml index 75950a798143..0125b9d1e210 100644 --- a/tests/subsys/secure_storage/psa/its/testcase.yaml +++ b/tests/subsys/secure_storage/psa/its/testcase.yaml @@ -27,6 +27,7 @@ tests: - EXTRA_DTC_OVERLAY_FILE=zms.overlay - EXTRA_CONF_FILE=\ overlay-secure_storage.conf;overlay-store_zms.conf;overlay-transform_default.conf + - SB_CONFIG_PARTITION_MANAGER=n secure_storage.psa.its.secure_storage.store.zms.64-bit_uids: platform_allow: *zms_platform_allow From 6d1a259f74109a9767e458dbe548d6b576d60c98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Bainczyk?= Date: Wed, 13 Aug 2025 10:33:25 +0200 Subject: [PATCH 1702/2141] [nrf fromlist] tests: boards: nrf: qdec: Fix test for nRF54L15 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added additional cleanups between tests, which fixed the issue of a failing testcase on nRF54L15. Upstream PR #: 93927 Signed-off-by: Michał Bainczyk (cherry picked from commit d24c26f9852942beb447cd6a352aa95873fb6b7a) --- tests/boards/nrf/qdec/src/main.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/boards/nrf/qdec/src/main.c b/tests/boards/nrf/qdec/src/main.c index 9d138d325fb5..6bc867f8aa9c 100644 --- a/tests/boards/nrf/qdec/src/main.c +++ b/tests/boards/nrf/qdec/src/main.c @@ -60,6 +60,11 @@ static void qdec_trigger_handler(const struct device *dev, const struct sensor_t static void qenc_emulate_work_handler(struct k_work *work) { + /* Check if emulation has been stopped after submitting this work item. */ + if (loopback_currently_under_test == NULL) { + return; + } + if (toggle_a) { gpio_pin_toggle_dt(&loopback_currently_under_test->qenc_phase_a); } else { @@ -113,6 +118,8 @@ static void qenc_emulate_stop(void) k_timer_stop(&qenc_emulate_timer); qenc_emulate_reset_pin(&loopback_currently_under_test->qenc_phase_a); qenc_emulate_reset_pin(&loopback_currently_under_test->qenc_phase_b); + + loopback_currently_under_test = NULL; } } @@ -218,6 +225,9 @@ static void sensor_trigger_set_and_disable(struct qdec_qenc_loopback *loopback) if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { pm_device_runtime_put(loopback->qdec); } + + qenc_emulate_stop(); + k_sem_reset(&sem); } /** @@ -270,8 +280,7 @@ static void sensor_trigger_set_test(struct qdec_qenc_loopback *loopback) } qenc_emulate_stop(); - /* emulation not working, but there may be old trigger which needs to be cleaned up */ - rc = k_sem_take(&sem, K_MSEC(200)); + k_sem_reset(&sem); } /** @@ -571,6 +580,7 @@ static void after(void *fixture) ARG_UNUSED(fixture); qenc_emulate_stop(); + k_sem_reset(&sem); } ZTEST_SUITE(qdec_sensor, NULL, setup, before, after, NULL); From 8feaa71acf41265c163c09a871833bd1bc3bc439 Mon Sep 17 00:00:00 2001 From: Georgios Vasilakis Date: Fri, 8 Aug 2025 12:26:35 +0200 Subject: [PATCH 1703/2141] [nrf noup] soc: nrf54l: Change logic for KMU reserved area nrf-squash! [nrf noup] soc: nrf54l: Add custom section for KMU Change how the KMU reserved area is included in the linker file. Now there is a separate Kconfig which shows it the there is a dts entry for the KMU reserved area. Signed-off-by: Georgios Vasilakis (cherry picked from commit 793e93e14667c87968d75c1666a9a99b44a054c9) --- soc/nordic/nrf54l/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/soc/nordic/nrf54l/CMakeLists.txt b/soc/nordic/nrf54l/CMakeLists.txt index d986fe9c20d5..d84330bffa6a 100644 --- a/soc/nordic/nrf54l/CMakeLists.txt +++ b/soc/nordic/nrf54l/CMakeLists.txt @@ -7,10 +7,12 @@ zephyr_library_sources( ) zephyr_include_directories(.) +dt_nodelabel(kmu_push_area_node NODELABEL nrf_kmu_reserved_push_area) + # We need a buffer in memory in a static location which can be used by # the KMU peripheral. The KMU has a static destination address, we chose # this address to be 0x20000000, which is the first address in the SRAM. -if(NOT CONFIG_BUILD_WITH_TFM AND CONFIG_PSA_NEED_CRACEN_KMU_DRIVER AND CONFIG_XIP) +if(NOT CONFIG_BUILD_WITH_TFM AND CONFIG_PSA_NEED_CRACEN_KMU_DRIVER AND NOT kmu_push_area_node) # Exclamation mark is printable character with the lowest number in ASCII table. # We are sure that this file will be included first. zephyr_linker_sources(RAM_SECTIONS SORT_KEY ! kmu_push_area_section.ld) From 30a0877c0cb03a0d9e6ade7cb6823ab37341f96c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dag=20Erik=20Gj=C3=B8rvad?= Date: Mon, 18 Aug 2025 14:25:53 +0200 Subject: [PATCH 1704/2141] [nrf noup] tests: crypto: Add ENTROPY_GENERATOR in overlays MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add ENTROPY_GENERATOR=y in overlays for l series devices. This fixes an error where a trng source is not included in ncs. Signed-off-by: Dag Erik Gjørvad (cherry picked from commit 6997770e93b3fc57c5325b430fb806f13d345f40) --- .../mbedtls_psa/boards/nrf54l05dk_nrf54l05_cpuapp.conf | 6 ++++++ .../mbedtls_psa/boards/nrf54l15dk_nrf54l10_cpuapp.conf | 6 ++++++ .../mbedtls_psa/boards/nrf54l15dk_nrf54l15_cpuapp.conf | 6 ++++++ .../mbedtls_psa/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf | 6 ++++++ .../mbedtls_psa/boards/nrf54lv10dk_nrf54lv10a_cpuapp.conf | 6 ++++++ 5 files changed, 30 insertions(+) create mode 100644 tests/crypto/mbedtls_psa/boards/nrf54l05dk_nrf54l05_cpuapp.conf create mode 100644 tests/crypto/mbedtls_psa/boards/nrf54l15dk_nrf54l10_cpuapp.conf create mode 100644 tests/crypto/mbedtls_psa/boards/nrf54l15dk_nrf54l15_cpuapp.conf create mode 100644 tests/crypto/mbedtls_psa/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf create mode 100644 tests/crypto/mbedtls_psa/boards/nrf54lv10dk_nrf54lv10a_cpuapp.conf diff --git a/tests/crypto/mbedtls_psa/boards/nrf54l05dk_nrf54l05_cpuapp.conf b/tests/crypto/mbedtls_psa/boards/nrf54l05dk_nrf54l05_cpuapp.conf new file mode 100644 index 000000000000..70c601183ddf --- /dev/null +++ b/tests/crypto/mbedtls_psa/boards/nrf54l05dk_nrf54l05_cpuapp.conf @@ -0,0 +1,6 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# +CONFIG_ENTROPY_GENERATOR=y diff --git a/tests/crypto/mbedtls_psa/boards/nrf54l15dk_nrf54l10_cpuapp.conf b/tests/crypto/mbedtls_psa/boards/nrf54l15dk_nrf54l10_cpuapp.conf new file mode 100644 index 000000000000..70c601183ddf --- /dev/null +++ b/tests/crypto/mbedtls_psa/boards/nrf54l15dk_nrf54l10_cpuapp.conf @@ -0,0 +1,6 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# +CONFIG_ENTROPY_GENERATOR=y diff --git a/tests/crypto/mbedtls_psa/boards/nrf54l15dk_nrf54l15_cpuapp.conf b/tests/crypto/mbedtls_psa/boards/nrf54l15dk_nrf54l15_cpuapp.conf new file mode 100644 index 000000000000..70c601183ddf --- /dev/null +++ b/tests/crypto/mbedtls_psa/boards/nrf54l15dk_nrf54l15_cpuapp.conf @@ -0,0 +1,6 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# +CONFIG_ENTROPY_GENERATOR=y diff --git a/tests/crypto/mbedtls_psa/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf b/tests/crypto/mbedtls_psa/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf new file mode 100644 index 000000000000..70c601183ddf --- /dev/null +++ b/tests/crypto/mbedtls_psa/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf @@ -0,0 +1,6 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# +CONFIG_ENTROPY_GENERATOR=y diff --git a/tests/crypto/mbedtls_psa/boards/nrf54lv10dk_nrf54lv10a_cpuapp.conf b/tests/crypto/mbedtls_psa/boards/nrf54lv10dk_nrf54lv10a_cpuapp.conf new file mode 100644 index 000000000000..70c601183ddf --- /dev/null +++ b/tests/crypto/mbedtls_psa/boards/nrf54lv10dk_nrf54lv10a_cpuapp.conf @@ -0,0 +1,6 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# +CONFIG_ENTROPY_GENERATOR=y From ca5f823297dd68c52df8478383b98dbe5ca84570 Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Mon, 11 Aug 2025 12:08:09 +0200 Subject: [PATCH 1705/2141] [nrf fromlist] tests: zms: Minor improvements Upstream PR #: 94330 * Explicitly skip tests that depend on CONFIG_ZMS_LOOKUP_CACHE. * In `testcase.yaml`, use `extra_configs` instead of `extra_args` for setting Kconfigs. Signed-off-by: Grzegorz Swiderski (cherry picked from commit 664645d0256abc6f5ab40a7b617775ce83d7ccb4) --- tests/subsys/fs/zms/src/main.c | 9 ++++++++- tests/subsys/fs/zms/testcase.yaml | 9 +++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/tests/subsys/fs/zms/src/main.c b/tests/subsys/fs/zms/src/main.c index a69a2b009537..15cdf217c04e 100644 --- a/tests/subsys/fs/zms/src/main.c +++ b/tests/subsys/fs/zms/src/main.c @@ -752,6 +752,8 @@ ZTEST_F(zms, test_zms_cache_init) num = num_matching_cache_entries(ate_addr, false, &fixture->fs); zassert_equal(num, 1, "invalid cache entry after restart"); +#else + ztest_test_skip(); #endif } @@ -780,6 +782,8 @@ ZTEST_F(zms, test_zms_cache_collission) zassert_equal(err, sizeof(data), "zms_read call failure: %d", err); zassert_equal(data, id, "incorrect data read"); } +#else + ztest_test_skip(); #endif } @@ -829,6 +833,8 @@ ZTEST_F(zms, test_zms_cache_gc) num = num_matching_cache_entries(2ULL << ADDR_SECT_SHIFT, true, &fixture->fs); zassert_equal(num, 2, "invalid cache content after gc"); +#else + ztest_test_skip(); #endif } @@ -886,7 +892,8 @@ ZTEST_F(zms, test_zms_cache_hash_quality) TC_PRINT("Cache occupancy: %u\n", (unsigned int)num); zassert_between_inclusive(num, MIN_CACHE_OCCUPANCY, CONFIG_ZMS_LOOKUP_CACHE_SIZE, "too low cache occupancy - poor hash quality"); - +#else + ztest_test_skip(); #endif } diff --git a/tests/subsys/fs/zms/testcase.yaml b/tests/subsys/fs/zms/testcase.yaml index bdee4529f2af..4949e1be0c6b 100644 --- a/tests/subsys/fs/zms/testcase.yaml +++ b/tests/subsys/fs/zms/testcase.yaml @@ -8,20 +8,21 @@ tests: extra_args: DTC_OVERLAY_FILE=boards/qemu_x86_ev_0x00.overlay platform_allow: qemu_x86 filesystem.zms.sim.no_erase: - extra_args: CONFIG_FLASH_SIMULATOR_EXPLICIT_ERASE=n + extra_configs: + - CONFIG_FLASH_SIMULATOR_EXPLICIT_ERASE=n platform_allow: qemu_x86 filesystem.zms.sim.corrupt_close: - extra_args: + extra_configs: - CONFIG_FLASH_SIMULATOR_EXPLICIT_ERASE=y - CONFIG_FLASH_SIMULATOR_DOUBLE_WRITES=y platform_allow: qemu_x86 filesystem.zms.cache: - extra_args: + extra_configs: - CONFIG_ZMS_LOOKUP_CACHE=y - CONFIG_ZMS_LOOKUP_CACHE_SIZE=64 platform_allow: native_sim filesystem.zms.data_crc: - extra_args: + extra_configs: - CONFIG_ZMS_DATA_CRC=y platform_allow: - native_sim From 6ca5a61cd45f95467f4283c2bd379c5acfc143ea Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Mon, 11 Aug 2025 12:08:09 +0200 Subject: [PATCH 1706/2141] [nrf fromlist] zms: Initial support for 64 bit IDs Upstream PR #: 94330 Allow the ZMS API to optionally accept 64 bit IDs. A typedef `zms_id_t` is added, so that the maximum ID width can be controlled using Kconfig. The current ATE structure is already large enough that it is possible to reserve 64 bits for IDs without increasing its total size (128 bits). This makes the feature a natural, low footprint alternative to Settings, for cases where the supported key namespace must be larger than 32 bit but not arbitrarily large. The ATE format does have to be altered to accommodate larger IDs, but the default "32 bit" format is left as is. Now, the `struct zms_ate` describes one of two supported formats, selected by an `#if` condition. In the future, it may be possible to support multiple ATE formats at runtime, in which case the structure can be turned into a union. In the new, "64 bit" ATEs, the `offset` and `metadata` fields are moved into a union, because they are found to be mutually exclusive. With the old format, the same fields are in different locations, but one of them always gets filled with a dummy value, depending on the given ATE type. To cover both cases, a `memset` is used, which should be optimized away by the compiler when appropriate. The only limitation is that the new ATE format has no room for data CRC, but an alternative integrity check can be implemented by the caller. Signed-off-by: Grzegorz Swiderski (cherry picked from commit 019a9ebb2b08eacf2876dd2a10e9b0c6db97f7a1) --- include/zephyr/fs/zms.h | 21 ++++++-- subsys/fs/zms/Kconfig | 11 ++++ subsys/fs/zms/zms.c | 108 +++++++++++++++++++++++++++------------ subsys/fs/zms/zms_priv.h | 35 ++++++++++++- 4 files changed, 135 insertions(+), 40 deletions(-) diff --git a/include/zephyr/fs/zms.h b/include/zephyr/fs/zms.h index 41ba053c93c0..cdaa323e3da9 100644 --- a/include/zephyr/fs/zms.h +++ b/include/zephyr/fs/zms.h @@ -77,6 +77,17 @@ struct zms_fs { * @{ */ +/** + * @brief ID type used in the ZMS API. + * + * @note The width of this type depends on @kconfig{CONFIG_ZMS_ID_64BIT}. + */ +#if CONFIG_ZMS_ID_64BIT +typedef uint64_t zms_id_t; +#else +typedef uint32_t zms_id_t; +#endif + /** * @brief Mount a ZMS file system onto the device specified in `fs`. * @@ -128,7 +139,7 @@ int zms_clear(struct zms_fs *fs); * @retval -EINVAL if `fs` is NULL or `len` is invalid. * @retval -ENOSPC if no space is left on the device. */ -ssize_t zms_write(struct zms_fs *fs, uint32_t id, const void *data, size_t len); +ssize_t zms_write(struct zms_fs *fs, zms_id_t id, const void *data, size_t len); /** * @brief Delete an entry from the file system @@ -142,7 +153,7 @@ ssize_t zms_write(struct zms_fs *fs, uint32_t id, const void *data, size_t len); * @retval -EIO if there is a memory read/write error. * @retval -EINVAL if `fs` is NULL. */ -int zms_delete(struct zms_fs *fs, uint32_t id); +int zms_delete(struct zms_fs *fs, zms_id_t id); /** * @brief Read an entry from the file system. @@ -161,7 +172,7 @@ int zms_delete(struct zms_fs *fs, uint32_t id); * @retval -ENOENT if there is no entry with the given `id`. * @retval -EINVAL if `fs` is NULL. */ -ssize_t zms_read(struct zms_fs *fs, uint32_t id, void *data, size_t len); +ssize_t zms_read(struct zms_fs *fs, zms_id_t id, void *data, size_t len); /** * @brief Read a history entry from the file system. @@ -182,7 +193,7 @@ ssize_t zms_read(struct zms_fs *fs, uint32_t id, void *data, size_t len); * @retval -ENOENT if there is no entry with the given `id` and history counter. * @retval -EINVAL if `fs` is NULL. */ -ssize_t zms_read_hist(struct zms_fs *fs, uint32_t id, void *data, size_t len, uint32_t cnt); +ssize_t zms_read_hist(struct zms_fs *fs, zms_id_t id, void *data, size_t len, uint32_t cnt); /** * @brief Gets the length of the data that is stored in an entry with a given `id` @@ -198,7 +209,7 @@ ssize_t zms_read_hist(struct zms_fs *fs, uint32_t id, void *data, size_t len, ui * @retval -ENOENT if there is no entry with the given id. * @retval -EINVAL if `fs` is NULL. */ -ssize_t zms_get_data_length(struct zms_fs *fs, uint32_t id); +ssize_t zms_get_data_length(struct zms_fs *fs, zms_id_t id); /** * @brief Calculate the available free space in the file system. diff --git a/subsys/fs/zms/Kconfig b/subsys/fs/zms/Kconfig index 9266fada236a..f20310a87620 100644 --- a/subsys/fs/zms/Kconfig +++ b/subsys/fs/zms/Kconfig @@ -16,6 +16,15 @@ config ZMS if ZMS +config ZMS_ID_64BIT + bool "64 bit ZMS IDs" + help + When this option is true, the `zms_id_t` values passed to ZMS APIs will be 64 bit, + as opposed to the default 32 bit. + This option will also change the format of allocation table entries (ATEs) in memory + to accommodate larger IDs. Currently, this will make ZMS unable to mount an existing + file system if it has been initialized with a different ATE format. + config ZMS_LOOKUP_CACHE bool "ZMS lookup cache" help @@ -34,6 +43,7 @@ config ZMS_LOOKUP_CACHE_SIZE config ZMS_DATA_CRC bool "ZMS data CRC" + depends on !ZMS_ID_64BIT config ZMS_CUSTOMIZE_BLOCK_SIZE bool "Customize the size of the buffer used internally for reads and writes" @@ -54,6 +64,7 @@ config ZMS_CUSTOM_BLOCK_SIZE config ZMS_LOOKUP_CACHE_FOR_SETTINGS bool "ZMS Storage lookup cache optimized for settings" depends on ZMS_LOOKUP_CACHE && SETTINGS_ZMS + depends on !ZMS_ID_64BIT help Enable usage of lookup cache based on hashes to get, the best ZMS performance, provided that the ZMS is used only for the purpose of providing the settings diff --git a/subsys/fs/zms/zms.c b/subsys/fs/zms/zms.c index b4b11aa6923e..d3bc9275479d 100644 --- a/subsys/fs/zms/zms.c +++ b/subsys/fs/zms/zms.c @@ -29,10 +29,8 @@ static int zms_ate_valid_different_sector(struct zms_fs *fs, const struct zms_at #ifdef CONFIG_ZMS_LOOKUP_CACHE -static inline size_t zms_lookup_cache_pos(uint32_t id) +static inline size_t zms_lookup_cache_pos(zms_id_t id) { - uint32_t hash = id; - #ifdef CONFIG_ZMS_LOOKUP_CACHE_FOR_SETTINGS /* * 1. Settings subsystem is storing the name ID and the linked list node ID @@ -52,14 +50,27 @@ static inline size_t zms_lookup_cache_pos(uint32_t id) uint32_t key_value_bit; uint32_t key_value_hash; uint32_t key_value_ll; + uint32_t hash; key_value_bit = (id >> LOG2(ZMS_DATA_ID_OFFSET)) & 1; key_value_hash = (id & ZMS_HASH_MASK) >> (CONFIG_SETTINGS_ZMS_MAX_COLLISIONS_BITS + 1); key_value_ll = id & BIT(0); hash = (key_value_hash << 2) | (key_value_bit << 1) | key_value_ll; + +#elif defined(CONFIG_ZMS_ID_64BIT) + /* 64-bit integer hash function found by https://github.com/skeeto/hash-prospector. */ + uint64_t hash = id; + + hash ^= hash >> 32; + hash *= 0x42ab4abe4c475039ULL; + hash ^= hash >> 31; + hash *= 0xfa90c4424c537791ULL; + hash ^= hash >> 32; #else /* 32-bit integer hash function found by https://github.com/skeeto/hash-prospector. */ + uint32_t hash = id; + hash ^= hash >> 16; hash *= 0x7feb352dU; hash ^= hash >> 15; @@ -239,7 +250,7 @@ static int zms_flash_ate_wrt(struct zms_fs *fs, const struct zms_ate *entry) goto end; } #ifdef CONFIG_ZMS_LOOKUP_CACHE - /* 0xFFFFFFFF is a special-purpose identifier. Exclude it from the cache */ + /* ZMS_HEAD_ID is a special-purpose identifier. Exclude it from the cache */ if (entry->id != ZMS_HEAD_ID) { fs->lookup_cache[zms_lookup_cache_pos(entry->id)] = fs->ate_wra; } @@ -487,7 +498,7 @@ static bool zms_close_ate_valid(struct zms_fs *fs, const struct zms_ate *entry) /* zms_empty_ate_valid validates an sector empty ate. * A valid sector empty ate should be: * - a valid ate - * - with len = 0xffff and id = 0xffffffff + * - with len = 0xffff and id = ZMS_HEAD_ID * return true if valid, false otherwise */ static bool zms_empty_ate_valid(struct zms_fs *fs, const struct zms_ate *entry) @@ -500,7 +511,7 @@ static bool zms_empty_ate_valid(struct zms_fs *fs, const struct zms_ate *entry) * Valid gc_done_ate: * - valid ate * - len = 0 - * - id = 0xffffffff + * - id = ZMS_HEAD_ID * return true if valid, false otherwise */ static bool zms_gc_done_ate_valid(struct zms_fs *fs, const struct zms_ate *entry) @@ -509,6 +520,18 @@ static bool zms_gc_done_ate_valid(struct zms_fs *fs, const struct zms_ate *entry (entry->id == ZMS_HEAD_ID)); } +/* zms_sector_closed checks whether the current sector is closed, which would imply + * that the empty ATE and close ATE are both valid and have matching cycle counters + * + * return true if closed, false otherwise + */ +static bool zms_sector_closed(struct zms_fs *fs, struct zms_ate *empty_ate, + struct zms_ate *close_ate) +{ + return (zms_empty_ate_valid(fs, empty_ate) && zms_close_ate_valid(fs, close_ate) && + (empty_ate->cycle_cnt == close_ate->cycle_cnt)); +} + /* Read empty and close ATE of the sector where belongs address "addr" and * validates that the sector is closed. * retval: 0 if sector is not close @@ -526,8 +549,7 @@ static int zms_validate_closed_sector(struct zms_fs *fs, uint64_t addr, struct z return rc; } - if (zms_empty_ate_valid(fs, empty_ate) && zms_close_ate_valid(fs, close_ate) && - (empty_ate->cycle_cnt == close_ate->cycle_cnt)) { + if (zms_sector_closed(fs, empty_ate, close_ate)) { /* Closed sector validated */ return 1; } @@ -536,7 +558,7 @@ static int zms_validate_closed_sector(struct zms_fs *fs, uint64_t addr, struct z } /* store an entry in flash */ -static int zms_flash_write_entry(struct zms_fs *fs, uint32_t id, const void *data, size_t len) +static int zms_flash_write_entry(struct zms_fs *fs, zms_id_t id, const void *data, size_t len) { int rc; struct zms_ate entry; @@ -549,13 +571,13 @@ static int zms_flash_write_entry(struct zms_fs *fs, uint32_t id, const void *dat entry.cycle_cnt = fs->sector_cycle; if (len > ZMS_DATA_IN_ATE_SIZE) { - /* only compute CRC if len is greater than 8 bytes */ - if (IS_ENABLED(CONFIG_ZMS_DATA_CRC)) { - entry.data_crc = crc32_ieee(data, len); - } +#ifdef CONFIG_ZMS_DATA_CRC + /* only compute CRC if data is to be stored outside of entry */ + entry.data_crc = crc32_ieee(data, len); +#endif entry.offset = (uint32_t)SECTOR_OFFSET(fs->data_wra); } else if ((len > 0) && (len <= ZMS_DATA_IN_ATE_SIZE)) { - /* Copy data into entry for small data ( < 8B) */ + /* Copy data into entry for small data (at most ZMS_DATA_IN_ATE_SIZE bytes) */ memcpy(&entry.data, data, len); } @@ -688,10 +710,12 @@ static int zms_sector_close(struct zms_fs *fs) struct zms_ate close_ate; struct zms_ate garbage_ate; + /* Initialize all members to 0xff */ + memset(&close_ate, 0xff, sizeof(struct zms_ate)); + close_ate.id = ZMS_HEAD_ID; close_ate.len = 0U; close_ate.offset = (uint32_t)SECTOR_OFFSET(fs->ate_wra + fs->ate_size); - close_ate.metadata = 0xffffffff; close_ate.cycle_cnt = fs->sector_cycle; /* When we close the sector, we must write all non used ATE with @@ -740,11 +764,13 @@ static int zms_add_gc_done_ate(struct zms_fs *fs) { struct zms_ate gc_done_ate; + /* Initialize all members to 0xff */ + memset(&gc_done_ate, 0xff, sizeof(struct zms_ate)); + LOG_DBG("Adding gc done ate at %llx", fs->ate_wra); gc_done_ate.id = ZMS_HEAD_ID; gc_done_ate.len = 0U; gc_done_ate.offset = (uint32_t)SECTOR_OFFSET(fs->data_wra); - gc_done_ate.metadata = 0xffffffff; gc_done_ate.cycle_cnt = fs->sector_cycle; zms_ate_crc8_update(&gc_done_ate); @@ -793,14 +819,17 @@ static int zms_add_empty_ate(struct zms_fs *fs, uint64_t addr) int rc = 0; uint64_t previous_ate_wra; + /* Initialize all members to 0 */ + memset(&empty_ate, 0, sizeof(struct zms_ate)); + addr &= ADDR_SECT_MASK; LOG_DBG("Adding empty ate at %llx", (uint64_t)(addr + fs->sector_size - fs->ate_size)); empty_ate.id = ZMS_HEAD_ID; empty_ate.len = 0xffff; - empty_ate.offset = 0U; - empty_ate.metadata = - FIELD_PREP(ZMS_MAGIC_NUMBER_MASK, ZMS_MAGIC_NUMBER) | ZMS_DEFAULT_VERSION; + empty_ate.metadata = FIELD_PREP(ZMS_VERSION_MASK, ZMS_DEFAULT_VERSION) | + FIELD_PREP(ZMS_MAGIC_NUMBER_MASK, ZMS_MAGIC_NUMBER) | + FIELD_PREP(ZMS_ATE_FORMAT_MASK, ZMS_DEFAULT_ATE_FORMAT); rc = zms_get_sector_cycle(fs, addr, &cycle_cnt); if (rc == -ENOENT) { @@ -893,7 +922,7 @@ static int zms_get_sector_header(struct zms_fs *fs, uint64_t addr, struct zms_at * @retval 1 valid ATE with same ID found * @retval < 0 An error happened */ -static int zms_find_ate_with_id(struct zms_fs *fs, uint32_t id, uint64_t start_addr, +static int zms_find_ate_with_id(struct zms_fs *fs, zms_id_t id, uint64_t start_addr, uint64_t end_addr, struct zms_ate *ate, uint64_t *ate_addr) { int rc; @@ -1044,10 +1073,10 @@ static int zms_gc(struct zms_fs *fs) */ if (wlk_prev_addr == gc_prev_addr) { /* copy needed */ - LOG_DBG("Moving %d, len %d", gc_ate.id, gc_ate.len); + LOG_DBG("Moving %lld, len %d", (long long)gc_ate.id, gc_ate.len); if (gc_ate.len > ZMS_DATA_IN_ATE_SIZE) { - /* Copy Data only when len > 8 + /* Copy Data only when len > ZMS_DATA_IN_ATE_SIZE * Otherwise, Data is already inside ATE */ data_addr = (gc_prev_addr & ADDR_SECT_MASK); @@ -1156,16 +1185,28 @@ static int zms_init(struct zms_fs *fs) for (i = 0; i < fs->sector_count; i++) { addr = zms_close_ate_addr(fs, ((uint64_t)i << ADDR_SECT_SHIFT)); - /* verify if the sector is closed */ - sec_closed = zms_validate_closed_sector(fs, addr, &empty_ate, &close_ate); - if (sec_closed < 0) { - rc = sec_closed; + /* read the header ATEs */ + rc = zms_get_sector_header(fs, addr, &empty_ate, &close_ate); + if (rc) { goto end; } /* update cycle count */ fs->sector_cycle = empty_ate.cycle_cnt; - if (sec_closed == 1) { + /* Check the ATE format indicator so that we know how to validate ATEs. + * The metadata field has the same offset and size in all ATE formats + * (the same is guaranteed for crc8 and cycle_cnt). + * Currently, ZMS can only recognize one of its supported ATE formats + * (the one chosen at build time), so their indicators are defined for + * the possibility of a future extension. + * If this indicator is unknown, then consider the header ATEs invalid, + * because we might not be dealing with ZMS contents at all. + */ + if (ZMS_GET_ATE_FORMAT(empty_ate.metadata) != ZMS_DEFAULT_ATE_FORMAT) { + continue; + } + + if (zms_sector_closed(fs, &empty_ate, &close_ate)) { /* closed sector */ closed_sectors++; /* Let's verify that this is a ZMS storage system */ @@ -1223,7 +1264,8 @@ static int zms_init(struct zms_fs *fs) goto end; } - if (zms_empty_ate_valid(fs, &empty_ate)) { + if ((ZMS_GET_ATE_FORMAT(empty_ate.metadata) == ZMS_DEFAULT_ATE_FORMAT) && + zms_empty_ate_valid(fs, &empty_ate)) { /* Empty ATE is valid, let's verify that this is a ZMS storage system */ if (ZMS_GET_MAGIC_NUMBER(empty_ate.metadata) == ZMS_MAGIC_NUMBER) { zms_magic_exist = true; @@ -1468,7 +1510,7 @@ int zms_mount(struct zms_fs *fs) return 0; } -ssize_t zms_write(struct zms_fs *fs, uint32_t id, const void *data, size_t len) +ssize_t zms_write(struct zms_fs *fs, zms_id_t id, const void *data, size_t len) { int rc; size_t data_size; @@ -1613,12 +1655,12 @@ ssize_t zms_write(struct zms_fs *fs, uint32_t id, const void *data, size_t len) return rc; } -int zms_delete(struct zms_fs *fs, uint32_t id) +int zms_delete(struct zms_fs *fs, zms_id_t id) { return zms_write(fs, id, NULL, 0); } -ssize_t zms_read_hist(struct zms_fs *fs, uint32_t id, void *data, size_t len, uint32_t cnt) +ssize_t zms_read_hist(struct zms_fs *fs, zms_id_t id, void *data, size_t len, uint32_t cnt) { int rc; int prev_found = 0; @@ -1719,7 +1761,7 @@ ssize_t zms_read_hist(struct zms_fs *fs, uint32_t id, void *data, size_t len, ui return rc; } -ssize_t zms_read(struct zms_fs *fs, uint32_t id, void *data, size_t len) +ssize_t zms_read(struct zms_fs *fs, zms_id_t id, void *data, size_t len) { int rc; @@ -1732,7 +1774,7 @@ ssize_t zms_read(struct zms_fs *fs, uint32_t id, void *data, size_t len) return MIN(rc, len); } -ssize_t zms_get_data_length(struct zms_fs *fs, uint32_t id) +ssize_t zms_get_data_length(struct zms_fs *fs, zms_id_t id) { int rc; diff --git a/subsys/fs/zms/zms_priv.h b/subsys/fs/zms/zms_priv.h index 84f77296f4f3..44cfb2f3d280 100644 --- a/subsys/fs/zms/zms_priv.h +++ b/subsys/fs/zms/zms_priv.h @@ -28,7 +28,6 @@ #endif #define ZMS_LOOKUP_CACHE_NO_ADDR GENMASK64(63, 0) -#define ZMS_HEAD_ID GENMASK(31, 0) #define ZMS_VERSION_MASK GENMASK(7, 0) #define ZMS_GET_VERSION(x) FIELD_GET(ZMS_VERSION_MASK, x) @@ -36,14 +35,28 @@ #define ZMS_MAGIC_NUMBER 0x42 /* murmur3a hash of "ZMS" (MSB) */ #define ZMS_MAGIC_NUMBER_MASK GENMASK(15, 8) #define ZMS_GET_MAGIC_NUMBER(x) FIELD_GET(ZMS_MAGIC_NUMBER_MASK, x) +#define ZMS_ATE_FORMAT_MASK GENMASK(19, 16) +#define ZMS_GET_ATE_FORMAT(x) FIELD_GET(ZMS_ATE_FORMAT_MASK, x) #define ZMS_MIN_ATE_NUM 5 #define ZMS_INVALID_SECTOR_NUM -1 -#define ZMS_DATA_IN_ATE_SIZE 8 + +#define ZMS_ATE_FORMAT_ID_32BIT 0 +#define ZMS_ATE_FORMAT_ID_64BIT 1 + +#if !defined(CONFIG_ZMS_ID_64BIT) +#define ZMS_DEFAULT_ATE_FORMAT ZMS_ATE_FORMAT_ID_32BIT +#define ZMS_HEAD_ID GENMASK(31, 0) +#else +#define ZMS_DEFAULT_ATE_FORMAT ZMS_ATE_FORMAT_ID_64BIT +#define ZMS_HEAD_ID GENMASK64(63, 0) +#endif /* CONFIG_ZMS_ID_64BIT */ /** * @ingroup zms_data_structures * ZMS Allocation Table Entry (ATE) structure + * + * @note This structure depends on @kconfig{CONFIG_ZMS_ID_64BIT}. */ struct zms_ate { /** crc8 check of the entry */ @@ -52,6 +65,8 @@ struct zms_ate { uint8_t cycle_cnt; /** data len within sector */ uint16_t len; + +#if ZMS_DEFAULT_ATE_FORMAT == ZMS_ATE_FORMAT_ID_32BIT /** data id */ uint32_t id; union { @@ -75,6 +90,22 @@ struct zms_ate { }; }; }; + +#elif ZMS_DEFAULT_ATE_FORMAT == ZMS_ATE_FORMAT_ID_64BIT + /** data id */ + uint64_t id; + union { + /** data field used to store small sized data */ + uint8_t data[4]; + /** data offset within sector */ + uint32_t offset; + /** Used to store metadata information such as storage version. */ + uint32_t metadata; + }; +#endif /* ZMS_DEFAULT_ATE_FORMAT */ + } __packed; +#define ZMS_DATA_IN_ATE_SIZE SIZEOF_FIELD(struct zms_ate, data) + #endif /* __ZMS_PRIV_H_ */ From aa0a2af2f549182d9f845185663ef9af32cc0b80 Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Mon, 11 Aug 2025 12:08:09 +0200 Subject: [PATCH 1707/2141] [nrf fromlist] tests: zms: Add test coverage for ZMS_ID_64BIT Upstream PR #: 94330 * Update the "corrupt ATE" tests to work with the new ATE format. * Add a basic test to verify support to 64 bit ZMS IDs. * Add a `testcase.yaml` entry to cover the above points and also run lookup cache tests to evaluate the 64 bit hash function. Signed-off-by: Grzegorz Swiderski (cherry picked from commit d9e38a9c4521e9b4423526e2c8e91b64f15928c7) (cherry picked from commit 9311d969c2e501e2f01249d92304193acc20cedb) --- tests/subsys/fs/zms/src/main.c | 56 +++++++++++++++++++++++++++---- tests/subsys/fs/zms/testcase.yaml | 6 ++++ 2 files changed, 56 insertions(+), 6 deletions(-) diff --git a/tests/subsys/fs/zms/src/main.c b/tests/subsys/fs/zms/src/main.c index 15cdf217c04e..80e2d9f9c072 100644 --- a/tests/subsys/fs/zms/src/main.c +++ b/tests/subsys/fs/zms/src/main.c @@ -578,17 +578,19 @@ ZTEST_F(zms, test_zms_gc_corrupt_close_ate) int err; Z_TEST_SKIP_IFNDEF(CONFIG_FLASH_SIMULATOR_DOUBLE_WRITES); - close_ate.id = 0xffffffff; + memset(&close_ate, 0xff, sizeof(struct zms_ate)); + close_ate.id = ZMS_HEAD_ID; close_ate.offset = fixture->fs.sector_size - sizeof(struct zms_ate) * 5; close_ate.len = 0; - close_ate.metadata = 0xffffffff; close_ate.cycle_cnt = 1; close_ate.crc8 = 0xff; /* Incorrect crc8 */ - empty_ate.id = 0xffffffff; - empty_ate.offset = 0; + memset(&empty_ate, 0, sizeof(struct zms_ate)); + empty_ate.id = ZMS_HEAD_ID; empty_ate.len = 0xffff; - empty_ate.metadata = 0x4201; + empty_ate.metadata = FIELD_PREP(ZMS_VERSION_MASK, ZMS_DEFAULT_VERSION) | + FIELD_PREP(ZMS_MAGIC_NUMBER_MASK, ZMS_MAGIC_NUMBER) | + FIELD_PREP(ZMS_ATE_FORMAT_MASK, ZMS_DEFAULT_ATE_FORMAT); empty_ate.cycle_cnt = 1; empty_ate.crc8 = crc8_ccitt(0xff, (uint8_t *)&empty_ate + SIZEOF_FIELD(struct zms_ate, crc8), @@ -649,7 +651,7 @@ ZTEST_F(zms, test_zms_gc_corrupt_ate) struct zms_ate close_ate; int err; - close_ate.id = 0xffffffff; + close_ate.id = ZMS_HEAD_ID; close_ate.offset = fixture->fs.sector_size / 2; close_ate.len = 0; close_ate.crc8 = @@ -955,3 +957,45 @@ ZTEST_F(zms, test_zms_input_validation) err = zms_delete(&fixture->fs, 0); zassert_true(err == -EACCES, "zms_delete call before mount fs failure: %d", err); } + +/* + * Test 64 bit ZMS ID support. + */ +ZTEST_F(zms, test_zms_id_64bit) +{ + int err; + ssize_t len; + uint64_t data; + uint64_t filling_id = 0xdeadbeefULL; + + Z_TEST_SKIP_IFNDEF(CONFIG_ZMS_ID_64BIT); + + err = zms_mount(&fixture->fs); + zassert_true(err == 0, "zms_mount call failure: %d", err); + + /* Fill the first sector with writes of different IDs */ + + while (fixture->fs.data_wra + sizeof(data) + sizeof(struct zms_ate) <= + fixture->fs.ate_wra) { + data = filling_id; + len = zms_write(&fixture->fs, (zms_id_t)filling_id, &data, sizeof(data)); + zassert_true(len == sizeof(data), "zms_write failed: %d", len); + + /* Choose the next ID so that its lower 32 bits stay invariant. + * The purpose is to test that ZMS doesn't mistakenly cast the + * 64 bit ID to a 32 bit one somewhere. + */ + filling_id += BIT64(32); + } + + /* Read back the written entries and check that they're all unique */ + + for (uint64_t id = 0xdeadbeefULL; id < filling_id; id += BIT64(32)) { + len = zms_read_hist(&fixture->fs, (zms_id_t)id, &data, sizeof(data), 0); + zassert_true(len == sizeof(data), "zms_read_hist unexpected failure: %d", len); + zassert_equal(data, id, "read unexpected data: %llx instead of %llx", data, id); + + len = zms_read_hist(&fixture->fs, (zms_id_t)id, &data, sizeof(data), 1); + zassert_true(len == -ENOENT, "zms_read_hist unexpected failure: %d", len); + } +} diff --git a/tests/subsys/fs/zms/testcase.yaml b/tests/subsys/fs/zms/testcase.yaml index 4949e1be0c6b..14cb7e9c36a2 100644 --- a/tests/subsys/fs/zms/testcase.yaml +++ b/tests/subsys/fs/zms/testcase.yaml @@ -27,3 +27,9 @@ tests: platform_allow: - native_sim - qemu_x86 + filesystem.zms.id_64bit: + extra_configs: + - CONFIG_ZMS_ID_64BIT=y + - CONFIG_ZMS_LOOKUP_CACHE=y + - CONFIG_ZMS_LOOKUP_CACHE_SIZE=64 + platform_allow: qemu_x86 From a64eff64ffb8b14336790585e9e92fccd042ac75 Mon Sep 17 00:00:00 2001 From: Riadh Ghaddab Date: Tue, 3 Jun 2025 16:07:48 +0200 Subject: [PATCH 1708/2141] [nrf noup] zms: add lookup cache hash function for legacy ZMS ZMS legacy enabled by CONFIG_SETTINGS_ZMS_LEGACY uses a different lookup cache function that is optimized for Settings subsystem. Signed-off-by: Riadh Ghaddab (cherry picked from commit 476ad665287a8b92e90ba1ec9a1ebd3241018b7a) --- subsys/fs/zms/zms.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/subsys/fs/zms/zms.c b/subsys/fs/zms/zms.c index d3bc9275479d..babf6d09b60f 100644 --- a/subsys/fs/zms/zms.c +++ b/subsys/fs/zms/zms.c @@ -13,8 +13,12 @@ #include #include "zms_priv.h" #ifdef CONFIG_ZMS_LOOKUP_CACHE_FOR_SETTINGS +#ifdef CONFIG_SETTINGS_ZMS_LEGACY +#include +#else #include #endif +#endif #include LOG_MODULE_REGISTER(fs_zms, CONFIG_ZMS_LOG_LEVEL); @@ -32,6 +36,40 @@ static int zms_ate_valid_different_sector(struct zms_fs *fs, const struct zms_at static inline size_t zms_lookup_cache_pos(zms_id_t id) { #ifdef CONFIG_ZMS_LOOKUP_CACHE_FOR_SETTINGS +#ifdef CONFIG_SETTINGS_ZMS_LEGACY + /* + * 1. The ZMS settings backend uses up to (ZMS_NAME_ID_OFFSET - 1) ZMS IDs to + store keys and equal number of ZMS IDs to store values. + * 2. For each key-value pair, the value is stored at ZMS ID greater by exactly + * ZMS_NAME_ID_OFFSET than ZMS ID that holds the key. + * 3. The backend tries to minimize the range of ZMS IDs used to store keys. + * That is, ZMS IDs are allocated sequentially, and freed ZMS IDs are reused + * before allocating new ones. + * + * Therefore, to assure the least number of collisions in the lookup cache, + * the least significant bit of the hash indicates whether the given ZMS ID + * represents a key or a value, and remaining bits of the hash are set to + * the ordinal number of the key-value pair. Consequently, the hash function + * provides the following mapping: + * + * 1st settings key => hash 0 + * 1st settings value => hash 1 + * 2nd settings key => hash 2 + * 2nd settings value => hash 3 + * ... + */ + BUILD_ASSERT(IS_POWER_OF_TWO(ZMS_NAMECNT_ID), "ZMS_NAMECNT_ID is not power of 2"); + BUILD_ASSERT(IS_POWER_OF_TWO(ZMS_NAME_ID_OFFSET), "ZMS_NAME_ID_OFFSET is not power of 2"); + + uint32_t key_value_bit; + uint32_t key_value_ord; + uint32_t hash; + + key_value_bit = (id >> LOG2(ZMS_NAME_ID_OFFSET)) & 1; + key_value_ord = id & (ZMS_NAME_ID_OFFSET - 1); + + hash = ((key_value_ord << 1) | key_value_bit); +#else /* * 1. Settings subsystem is storing the name ID and the linked list node ID * with only one bit difference at BIT(0). @@ -57,6 +95,7 @@ static inline size_t zms_lookup_cache_pos(zms_id_t id) key_value_ll = id & BIT(0); hash = (key_value_hash << 2) | (key_value_bit << 1) | key_value_ll; +#endif /* CONFIG_SETTINGS_ZMS_LEGACY */ #elif defined(CONFIG_ZMS_ID_64BIT) /* 64-bit integer hash function found by https://github.com/skeeto/hash-prospector. */ From 0d492618c3b5c138bce53d5f3773433ea0d57f86 Mon Sep 17 00:00:00 2001 From: Jonathan Nilsen Date: Thu, 28 Aug 2025 08:26:23 +0200 Subject: [PATCH 1709/2141] [nrf noup] soc: nrf54h: work around missing power domain handling This patch should be dropped as part of the next upmerge. The upcoming release of IronSide SE no longer disables RETAIN in all GPIO instances on boot, so the application must be able to handle the hardware default state of RETAIN being enabled. The GPIO retention is properly handled by changes that are currently only upstream and will be pulled in by the next upmerge. This patch exists a workaround to be able to integrate IronSide SE before the proper solution is pulled in. Signed-off-by: Jonathan Nilsen (cherry picked from commit 20d89eb11a79ec9ca6ee80372af2a725028765ac) --- soc/nordic/nrf54h/Kconfig | 5 +++++ soc/nordic/nrf54h/soc.c | 12 ++++++++++++ 2 files changed, 17 insertions(+) diff --git a/soc/nordic/nrf54h/Kconfig b/soc/nordic/nrf54h/Kconfig index de88045d32fb..eefd11ac82fd 100644 --- a/soc/nordic/nrf54h/Kconfig +++ b/soc/nordic/nrf54h/Kconfig @@ -105,6 +105,11 @@ config SOC_NRF54H20_CPURAD_ENABLE_DEBUG_WAIT endif # SOC_NRF54H20_CPURAD_ENABLE +config SOC_NRF54H20_DISABLE_ALL_GPIO_RETENTION_WORKAROUND + bool "Disable all GPIO pin retention on boot" + default y + depends on SOC_NRF54H20_CPUAPP || SOC_NRF54H20_CPURAD + config SOC_NRF54H20_CPURAD select SOC_NRF54H20_CPURAD_COMMON diff --git a/soc/nordic/nrf54h/soc.c b/soc/nordic/nrf54h/soc.c index fb1c3f426d33..c996bc93e1ba 100644 --- a/soc/nordic/nrf54h/soc.c +++ b/soc/nordic/nrf54h/soc.c @@ -14,6 +14,7 @@ #include #endif +#include #include #include #include @@ -173,6 +174,17 @@ void soc_early_init_hook(void) DT_PROP_OR(DT_NODELABEL(nfct), nfct_pins_as_gpios, 0)) { nrf_nfct_pad_config_enable_set(NRF_NFCT, false); } + + /* This is a workaround for not yet having upstream patches for properly handling + * pin retention. It should be removed as part of the next upmerge. + */ + if (IS_ENABLED(CONFIG_SOC_NRF54H20_DISABLE_ALL_GPIO_RETENTION_WORKAROUND)) { + NRF_GPIO_Type *gpio_regs[GPIO_COUNT] = GPIO_REG_LIST; + + for (int i = 0; i < NRFX_ARRAY_SIZE(gpio_regs); i++) { + nrf_gpio_port_retain_set(gpio_regs[i], 0); + } + } } #if defined(CONFIG_SOC_LATE_INIT_HOOK) From 9c5067aaf4db5716bf67addaac4fc78cb2396fdb Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Tue, 2 Sep 2025 10:48:14 +0100 Subject: [PATCH 1710/2141] [nrf noup] doc: extensions: kconfig: Add SoC sysbuild Kconfigs Allows listing sysbuild Kconfigs for SoCs Signed-off-by: Jamie McCrae (cherry picked from commit 1d73d0e3cb5ff37fd53c103bb49c1e9b92be75c5) --- doc/_extensions/zephyr/kconfig/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/_extensions/zephyr/kconfig/__init__.py b/doc/_extensions/zephyr/kconfig/__init__.py index cda7430d7ab8..a76ac87f887b 100644 --- a/doc/_extensions/zephyr/kconfig/__init__.py +++ b/doc/_extensions/zephyr/kconfig/__init__.py @@ -112,6 +112,9 @@ def kconfig_load(app: Sphinx) -> tuple[kconfiglib.Kconfig, kconfiglib.Kconfig, d for folder in soc_folders: f.write('source "' + (Path(folder) / 'Kconfig.soc').as_posix() + '"\n') + if "nordic" in folder: + f.write('osource "' + (Path(folder) / 'Kconfig.sysbuild').as_posix() + '"\n') + with open(Path(td) / "soc" / "Kconfig", "w") as f: for folder in soc_folders: f.write('osource "' + (Path(folder) / 'Kconfig').as_posix() + '"\n') From 9293b230c28d41b072990e2962448ee4de105675 Mon Sep 17 00:00:00 2001 From: Tomi Fontanilles Date: Thu, 28 Aug 2025 15:12:39 +0300 Subject: [PATCH 1711/2141] [nrf fromlist] manifest: tf-m-tests: bring in fix for TF-M 2.2.0 Fixup to the TF-M 2.2.0 update. Signed-off-by: Tomi Fontanilles Upstream PR #: 94729 Signed-off-by: Tomi Fontanilles (cherry picked from commit b48a1f26ef887cee5f3c20ee04c1b1db7f43f226) --- submanifests/optional.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submanifests/optional.yaml b/submanifests/optional.yaml index 04bdd669a921..57ad7affdd1c 100644 --- a/submanifests/optional.yaml +++ b/submanifests/optional.yaml @@ -35,7 +35,7 @@ manifest: groups: - optional - name: tf-m-tests - revision: a286347e6a5dd37a9a5e960450ffc0260d63fb27 + revision: a90702bcb8fadb6f70daf0ffbb13888dfe63fc99 path: modules/tee/tf-m/tf-m-tests remote: upstream groups: From daf7f1fbdcf4494025eef353a7675069c7dd54e6 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Wed, 10 Sep 2025 09:14:29 +0100 Subject: [PATCH 1712/2141] [nrf fromlist] scripts: requirements: Add python-dotenv This is needed for any Kconfig processing Upstream PR #: 95771 Signed-off-by: Jamie McCrae (cherry picked from commit 2fc387e0dd4d8292bdf4f0683a7044639a810f65) --- scripts/requirements-actions.in | 1 + scripts/requirements-actions.txt | 4 ++++ scripts/requirements-build-test.txt | 2 ++ scripts/requirements-compliance.txt | 1 + 4 files changed, 8 insertions(+) diff --git a/scripts/requirements-actions.in b/scripts/requirements-actions.in index 997afed38712..6baf9dc9e3f4 100644 --- a/scripts/requirements-actions.in +++ b/scripts/requirements-actions.in @@ -22,6 +22,7 @@ pykwalify pylint>=3 pyserial pytest +python-dotenv python-magic-bin; sys_platform == "win32" python-magic; sys_platform != "win32" pyyaml diff --git a/scripts/requirements-actions.txt b/scripts/requirements-actions.txt index 8c28b2d22f77..21505203bfa6 100644 --- a/scripts/requirements-actions.txt +++ b/scripts/requirements-actions.txt @@ -880,6 +880,10 @@ python-debian==1.0.1 \ --hash=sha256:3ada9b83a3d671b58081782c0969cffa0102f6ce433fbbc7cf21275b8b5cc771 \ --hash=sha256:8f137c230c1d9279c2ac892b35915068b2aca090c9fd3da5671ff87af32af12c # via reuse +python-dotenv==1.1.1 \ + --hash=sha256:31f23644fe2602f88ff55e1f5c79ba497e01224ee7737937930c448e4d0e24dc \ + --hash=sha256:a8a6399716257f45be6a007360200409fce5cda2661e3dec71d23dc15f6189ab + # via -r requirements-actions.in python-magic==0.4.27 ; sys_platform != 'win32' \ --hash=sha256:c1ba14b08e4a5f5c31a302b7721239695b2f0f058d125bd5ce1ee36b9d9d3c3b \ --hash=sha256:c212960ad306f700aa0d01e5d7a325d20548ff97eb9920dcd29513174f0294d3 diff --git a/scripts/requirements-build-test.txt b/scripts/requirements-build-test.txt index 2ce1227e3e70..e6264b11ea5e 100644 --- a/scripts/requirements-build-test.txt +++ b/scripts/requirements-build-test.txt @@ -19,3 +19,5 @@ mypy # used for JUnit XML parsing in CTest harness junitparser>=3.0.0 + +python-dotenv diff --git a/scripts/requirements-compliance.txt b/scripts/requirements-compliance.txt index 3c3841cf33ed..6d90ac4b2587 100644 --- a/scripts/requirements-compliance.txt +++ b/scripts/requirements-compliance.txt @@ -8,6 +8,7 @@ junitparser>=4.0.1 lxml>=5.3.0 pykwalify pylint>=3 +python-dotenv python-magic-bin; sys_platform == "win32" python-magic; sys_platform != "win32" ruff==0.11.11 From 007d0da22f526d0387f1d39152909b036285e69d Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Wed, 10 Sep 2025 09:08:10 +0100 Subject: [PATCH 1713/2141] [nrf fromlist] kconfig: Load Kconfig env file better Loads this file in a better way that means samples and modules should not have to source the file before referencing Kconfig module path variables Upstream PR #: 95771 Signed-off-by: Jamie McCrae (cherry picked from commit 25ced410af6caf6fea810b49ef4cf9b3bcb40b2b) --- Kconfig.zephyr | 1 - cmake/modules/kconfig.cmake | 5 ++++- doc/_extensions/zephyr/kconfig/__init__.py | 6 ++++-- scripts/ci/check_compliance.py | 8 ++++++-- scripts/zephyr_module.py | 18 +++++++++++++++--- share/sysbuild/Kconfig | 2 -- 6 files changed, 29 insertions(+), 11 deletions(-) diff --git a/Kconfig.zephyr b/Kconfig.zephyr index d8df86add4d3..d758a03baff4 100644 --- a/Kconfig.zephyr +++ b/Kconfig.zephyr @@ -6,7 +6,6 @@ # SPDX-License-Identifier: Apache-2.0 source "Kconfig.constants" -source "$(KCONFIG_ENV_FILE)" osource "$(APPLICATION_SOURCE_DIR)/VERSION" diff --git a/cmake/modules/kconfig.cmake b/cmake/modules/kconfig.cmake index de87abfdc1d3..60667eb6444b 100644 --- a/cmake/modules/kconfig.cmake +++ b/cmake/modules/kconfig.cmake @@ -132,10 +132,13 @@ endif() # APP_DIR: Path to the main image (sysbuild) or synonym for APPLICATION_SOURCE_DIR (non-sysbuild) zephyr_get(APP_DIR VAR APP_DIR APPLICATION_SOURCE_DIR) +# Load the module Kconfig file into CMake +include("${KCONFIG_BINARY_DIR}/kconfig_module_dirs.cmake") + set(COMMON_KCONFIG_ENV_SETTINGS PYTHON_EXECUTABLE=${PYTHON_EXECUTABLE} - KCONFIG_ENV_FILE=${KCONFIG_BINARY_DIR}/kconfig_module_dirs.env srctree=${ZEPHYR_BASE} + ${kconfig_env_dirs} KERNELVERSION=${KERNELVERSION} APPVERSION=${APP_VERSION_STRING} APP_VERSION_EXTENDED_STRING=${APP_VERSION_EXTENDED_STRING} diff --git a/doc/_extensions/zephyr/kconfig/__init__.py b/doc/_extensions/zephyr/kconfig/__init__.py index a76ac87f887b..63459a61ade6 100644 --- a/doc/_extensions/zephyr/kconfig/__init__.py +++ b/doc/_extensions/zephyr/kconfig/__init__.py @@ -44,6 +44,7 @@ from typing import Any from docutils import nodes +from dotenv import load_dotenv from sphinx.addnodes import pending_xref from sphinx.application import Sphinx from sphinx.builders import Builder @@ -81,7 +82,8 @@ def kconfig_load(app: Sphinx) -> tuple[kconfiglib.Kconfig, kconfiglib.Kconfig, d sysbuild_kconfig = "" for module in modules: kconfig_module_dirs += zephyr_module.process_kconfig_module_dir(module.project, - module.meta) + module.meta, + False) kconfig += zephyr_module.process_kconfig(module.project, module.meta) sysbuild_kconfig += zephyr_module.process_sysbuildkconfig(module.project, module.meta) @@ -158,7 +160,7 @@ def kconfig_load(app: Sphinx) -> tuple[kconfiglib.Kconfig, kconfiglib.Kconfig, d os.environ["BOARD"] = "boards" os.environ["KCONFIG_BOARD_DIR"] = str(Path(td) / "boards") - os.environ["KCONFIG_ENV_FILE"] = str(Path(td) / "kconfig_module_dirs.env") + load_dotenv(str(Path(td) / "kconfig_module_dirs.env")) # Sysbuild runs first os.environ["CONFIG_"] = "SB_CONFIG_" diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index d52f9c158783..c9b9b9671366 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -23,6 +23,8 @@ import unidiff import yaml +from dotenv import load_dotenv + from yamllint import config, linter from junitparser import TestCase, TestSuite, JUnitXml, Skipped, Error, Failure @@ -730,14 +732,14 @@ def parse_kconfig(self): os.environ["KCONFIG_BINARY_DIR"] = kconfiglib_dir os.environ['DEVICETREE_CONF'] = "dummy" os.environ['TOOLCHAIN_HAS_NEWLIB'] = "y" - os.environ['KCONFIG_ENV_FILE'] = os.path.join(kconfiglib_dir, "kconfig_module_dirs.env") + kconfig_env_file = os.path.join(kconfiglib_dir, "kconfig_module_dirs.env") # Older name for DEVICETREE_CONF, for compatibility with older Zephyr # versions that don't have the renaming os.environ["GENERATED_DTS_BOARD_CONF"] = "dummy" # For multi repo support - self.get_modules(os.environ['KCONFIG_ENV_FILE'], + self.get_modules(kconfig_env_file, os.path.join(kconfiglib_dir, "Kconfig.modules"), os.path.join(kconfiglib_dir, "Kconfig.sysbuild.modules"), os.path.join(kconfiglib_dir, "settings_file.txt")) @@ -751,6 +753,8 @@ def parse_kconfig(self): # symbols within Kconfig files os.environ["KCONFIG_WARN_UNDEF"] = "y" + load_dotenv(kconfig_env_file) + try: # Note this will both print warnings to stderr _and_ return # them: so some warnings might get printed diff --git a/scripts/zephyr_module.py b/scripts/zephyr_module.py index c214f51704c8..6606af52ba0f 100755 --- a/scripts/zephyr_module.py +++ b/scripts/zephyr_module.py @@ -386,10 +386,13 @@ def kconfig_snippet(meta, path, kconfig_file=None, blobs=False, taint_blobs=Fals return '\n'.join(snippet) -def process_kconfig_module_dir(module, meta): +def process_kconfig_module_dir(module, meta, cmake_output): module_path = PurePath(module) name_sanitized = meta['name-sanitized'] - return f'ZEPHYR_{name_sanitized.upper()}_MODULE_DIR={module_path.as_posix()}\n' + + if cmake_output is False: + return f'ZEPHYR_{name_sanitized.upper()}_MODULE_DIR={module_path.as_posix()}\n' + return f'list(APPEND kconfig_env_dirs ZEPHYR_{name_sanitized.upper()}_MODULE_DIR={module_path.as_posix()})\n' def process_kconfig(module, meta): @@ -870,6 +873,7 @@ def main(): args = parser.parse_args() kconfig_module_dirs = "" + kconfig_module_dirs_cmake = "set(kconfig_env_dirs)\n" kconfig = "" cmake = "" sysbuild_kconfig = "" @@ -882,7 +886,8 @@ def main(): args.modules, args.extra_modules) for module in modules: - kconfig_module_dirs += process_kconfig_module_dir(module.project, module.meta) + kconfig_module_dirs += process_kconfig_module_dir(module.project, module.meta, False) + kconfig_module_dirs_cmake += process_kconfig_module_dir(module.project, module.meta, True) kconfig += process_kconfig(module.project, module.meta) cmake += process_cmake(module.project, module.meta) sysbuild_kconfig += process_sysbuildkconfig( @@ -894,13 +899,20 @@ def main(): if args.kconfig_out or args.sysbuild_kconfig_out: if args.kconfig_out: kconfig_module_dirs_out = PurePath(args.kconfig_out).parent / 'kconfig_module_dirs.env' + kconfig_module_dirs_cmake_out = PurePath(args.kconfig_out).parent / \ + 'kconfig_module_dirs.cmake' elif args.sysbuild_kconfig_out: kconfig_module_dirs_out = PurePath(args.sysbuild_kconfig_out).parent / \ 'kconfig_module_dirs.env' + kconfig_module_dirs_cmake_out = PurePath(args.sysbuild_kconfig_out).parent / \ + 'kconfig_module_dirs.cmake' with open(kconfig_module_dirs_out, 'w', encoding="utf-8") as fp: fp.write(kconfig_module_dirs) + with open(kconfig_module_dirs_cmake_out, 'w', encoding="utf-8") as fp: + fp.write(kconfig_module_dirs_cmake) + if args.kconfig_out: with open(args.kconfig_out, 'w', encoding="utf-8") as fp: fp.write(kconfig) diff --git a/share/sysbuild/Kconfig b/share/sysbuild/Kconfig index 1a9f36ac7779..b9cec010dd9d 100644 --- a/share/sysbuild/Kconfig +++ b/share/sysbuild/Kconfig @@ -2,8 +2,6 @@ # # SPDX-License-Identifier: Apache-2.0 -source "$(KCONFIG_ENV_FILE)" - config BOARD string default "$(BOARD)" From b166b49de16188d53e44194d93dfa41deed59152 Mon Sep 17 00:00:00 2001 From: Kari Hamalainen Date: Fri, 12 Sep 2025 10:46:10 +0300 Subject: [PATCH 1714/2141] [nrf noup] ci: add reopen for manifest-pr action Previously reopening of PR did not reopen manifest PR. This commit will enable reopening of manifest PR in such case. Signed-off-by: Kari Hamalainen (cherry picked from commit 96ef102fadde5fc5fb96e0019903c1f085780640) --- .github/workflows/manifest-PR.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/manifest-PR.yml b/.github/workflows/manifest-PR.yml index a871aa381ded..473301146527 100644 --- a/.github/workflows/manifest-PR.yml +++ b/.github/workflows/manifest-PR.yml @@ -1,7 +1,7 @@ name: handle manifest PR on: pull_request_target: - types: [opened, synchronize, closed] + types: [opened, synchronize, closed, reopened] branches: - main From aa291d0a247e525c54c9d36cfbd1574b7d8e2789 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Mon, 19 May 2025 15:42:20 +0200 Subject: [PATCH 1715/2141] [nrf fromlist] tests: drivers: timer: nrf_grtc_timer: Add stress test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add stress test that randomly starts and aborts multiple timers from various contexts. Test checks if timers do not expire prematurely. Upstream PR #: 87944 Signed-off-by: Krzysztof Chruściński (cherry picked from commit 0af05cc663896310c0c891322debf4c5519ef17d) --- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 17 ++ .../boards/nrf54l15dk_nrf54l15_cpuapp.overlay | 32 +++ .../nrf54l15dk_nrf54l15_cpuflpr.overlay | 32 +++ tests/drivers/timer/nrf_grtc_timer/prj.conf | 6 + tests/drivers/timer/nrf_grtc_timer/src/main.c | 247 ++++++++++++++++++ .../timer/nrf_grtc_timer/testcase.yaml | 37 +-- 6 files changed, 355 insertions(+), 16 deletions(-) create mode 100644 tests/drivers/timer/nrf_grtc_timer/boards/nrf54l15dk_nrf54l15_cpuapp.overlay create mode 100644 tests/drivers/timer/nrf_grtc_timer/boards/nrf54l15dk_nrf54l15_cpuflpr.overlay diff --git a/tests/drivers/timer/nrf_grtc_timer/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/timer/nrf_grtc_timer/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index 04580b71480b..7ae959267039 100644 --- a/tests/drivers/timer/nrf_grtc_timer/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/tests/drivers/timer/nrf_grtc_timer/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -2,4 +2,21 @@ &grtc { /delete-property/ child-owned-channels; + interrupts = <109 2>; +}; + +test_timer: &timer131 { + status = "okay"; + interrupts = <419 1>; +}; + +&timer130 { + status = "okay"; + prescaler = <0>; +}; + +/ { + chosen { + zephyr,cpu-load-counter = &timer130; + }; }; diff --git a/tests/drivers/timer/nrf_grtc_timer/boards/nrf54l15dk_nrf54l15_cpuapp.overlay b/tests/drivers/timer/nrf_grtc_timer/boards/nrf54l15dk_nrf54l15_cpuapp.overlay new file mode 100644 index 000000000000..7bcede529b0e --- /dev/null +++ b/tests/drivers/timer/nrf_grtc_timer/boards/nrf54l15dk_nrf54l15_cpuapp.overlay @@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +&grtc { + interrupts = <228 2>; +}; + +test_timer: &timer21 { + status = "okay"; + interrupts = <203 1>; +}; + +&timer20 { + status = "okay"; + interrupts = <202 0>; +}; + +&timer00 { + status = "okay"; + prescaler = <0>; +}; + +/ { + chosen { + zephyr,cpu-load-counter = &timer00; + }; + + busy-sim { + compatible = "vnd,busy-sim"; + status = "okay"; + counter = <&timer20>; + }; +}; diff --git a/tests/drivers/timer/nrf_grtc_timer/boards/nrf54l15dk_nrf54l15_cpuflpr.overlay b/tests/drivers/timer/nrf_grtc_timer/boards/nrf54l15dk_nrf54l15_cpuflpr.overlay new file mode 100644 index 000000000000..cfa72ed02736 --- /dev/null +++ b/tests/drivers/timer/nrf_grtc_timer/boards/nrf54l15dk_nrf54l15_cpuflpr.overlay @@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +&grtc { + /*interrupts = <226 2>;*/ +}; + +test_timer: &timer21 { + status = "okay"; + /*interrupts = <203 2>;*/ +}; + +&timer20 { + status = "okay"; + interrupts = <202 0>; +}; + +&timer00 { + status = "okay"; + prescaler = <0>; +}; + +/ { + chosen { + zephyr,cpu-load-counter = &timer00; + }; + + busy-sim { + compatible = "vnd,busy-sim"; + status = "okay"; + counter = <&timer20>; + }; +}; diff --git a/tests/drivers/timer/nrf_grtc_timer/prj.conf b/tests/drivers/timer/nrf_grtc_timer/prj.conf index dea03477519d..93926f090b7e 100644 --- a/tests/drivers/timer/nrf_grtc_timer/prj.conf +++ b/tests/drivers/timer/nrf_grtc_timer/prj.conf @@ -1,2 +1,8 @@ CONFIG_ZTEST=y CONFIG_NRF_GRTC_TIMER=y +CONFIG_COUNTER=y +CONFIG_TEST_RANDOM_GENERATOR=y +CONFIG_XOSHIRO_RANDOM_GENERATOR=y +CONFIG_LOG_PRINTK=y +CONFIG_CPU_LOAD=y +CONFIG_CPU_LOAD_USE_COUNTER=y diff --git a/tests/drivers/timer/nrf_grtc_timer/src/main.c b/tests/drivers/timer/nrf_grtc_timer/src/main.c index cede54f026f1..e411eba83a0b 100644 --- a/tests/drivers/timer/nrf_grtc_timer/src/main.c +++ b/tests/drivers/timer/nrf_grtc_timer/src/main.c @@ -5,7 +5,15 @@ */ #include #include +#include +#include +#include +#include +#include +#include +#include #include +LOG_MODULE_REGISTER(test, 1); #define GRTC_SLEW_TICKS 10 #define NUMBER_OF_TRIES 2000 @@ -153,4 +161,243 @@ ZTEST(nrf_grtc_timer, test_timer_abort_in_compare_mode) z_nrf_grtc_timer_chan_free(channel); } +enum test_timer_state { + TIMER_IDLE, + TIMER_PREPARE, + TIMER_ACTIVE +}; + +enum test_ctx { + TEST_HIGH_PRI, + TEST_TIMER_CB, + TEST_THREAD +}; + +struct test_grtc_timer { + struct k_timer timer; + uint32_t ticks; + uint32_t expire; + uint32_t start_cnt; + uint32_t expire_cnt; + uint32_t abort_cnt; + uint32_t exp_expire; + int max_late; + int min_late; + int avg_late; + uint32_t early_cnt; + enum test_timer_state state; +}; + +static atomic_t test_active_cnt; +static struct test_grtc_timer timers[8]; +static uint32_t test_end; +static k_tid_t test_tid; +static volatile bool test_run; +static uint32_t ctx_cnt[3]; +static const char *const ctx_name[] = { "HIGH PRIO ISR", "TIMER CALLBACK", "THREAD" }; + +static bool stress_test_action(int ctx, int id) +{ + struct test_grtc_timer *timer = &timers[id]; + + ctx_cnt[ctx]++; + if (timer->state == TIMER_ACTIVE) { + /* Aborting soon to expire timers from higher interrupt priority may lead + * to test failures. + */ + if (ctx == 0 && (k_timer_remaining_get(&timer->timer) < 5)) { + return true; + } + + if (timer->abort_cnt < timer->expire_cnt / 2) { + bool any_active; + + timer->state = TIMER_PREPARE; + k_timer_stop(&timer->timer); + timer->abort_cnt++; + any_active = atomic_dec(&test_active_cnt) > 1; + timer->state = TIMER_IDLE; + + return any_active; + } + } else if (timer->state == TIMER_IDLE) { + int ticks = 10 + (sys_rand32_get() & 0x3F); + k_timeout_t t = K_TICKS(ticks); + + timer->state = TIMER_PREPARE; + timer->exp_expire = k_ticks_to_cyc_floor32(sys_clock_tick_get_32() + ticks); + timer->ticks = ticks; + k_timer_start(&timer->timer, t, K_NO_WAIT); + atomic_inc(&test_active_cnt); + timer->start_cnt++; + timer->state = TIMER_ACTIVE; + } + + return true; +} + +static void stress_test_actions(int ctx) +{ + uint32_t r = sys_rand32_get(); + int action_cnt = Z_MAX(r & 0x3, 1); + int tmr_id = (r >> 8) % ARRAY_SIZE(timers); + + /* Occasionally wake thread context from which timer actions are also executed. */ + if ((((r >> 2) & 0x3) == 0) || test_active_cnt < 2) { + LOG_DBG("ctx:%d thread wakeup", ctx); + k_wakeup(test_tid); + } + + for (int i = 0; i < action_cnt; i++) { + if (stress_test_action(ctx, tmr_id) == false) { + stress_test_action(ctx, tmr_id); + } + } +} + +static void timer_cb(struct k_timer *timer) +{ + struct test_grtc_timer *test_timer = CONTAINER_OF(timer, struct test_grtc_timer, timer); + uint32_t now = k_cycle_get_32(); + int diff = now - test_timer->exp_expire; + + atomic_dec(&test_active_cnt); + zassert_true(diff >= 0); + test_timer->max_late = MAX(diff, test_timer->max_late); + test_timer->min_late = MIN(diff, test_timer->min_late); + + if (test_timer->expire_cnt == 0) { + test_timer->avg_late = diff; + } else { + test_timer->avg_late = (test_timer->avg_late * test_timer->expire_cnt + diff) / + (test_timer->expire_cnt + 1); + } + + test_timer->expire_cnt++; + test_timer->state = TIMER_IDLE; + + if (test_run) { + stress_test_actions(TEST_TIMER_CB); + } +} + +static void counter_set(const struct device *dev, struct counter_alarm_cfg *cfg) +{ + int err; + uint32_t us = 150 + (sys_rand32_get() & 0x3F); + + cfg->ticks = counter_us_to_ticks(dev, us); + err = counter_set_channel_alarm(dev, 0, cfg); + zassert_equal(err, 0); +} + +static void counter_cb(const struct device *dev, uint8_t chan_id, uint32_t ticks, void *user_data) +{ + struct counter_alarm_cfg *config = user_data; + + if (test_run) { + stress_test_actions(TEST_HIGH_PRI); + counter_set(dev, config); + } +} + +static void report_progress(uint32_t start, uint32_t end) +{ + static uint32_t next_report; + static uint32_t step; + static uint32_t progress; + + if (next_report == 0) { + step = (end - start) / 10; + next_report = start + step; + } + + if (k_uptime_get_32() > next_report) { + next_report += step; + progress += 10; + printk("%d%%\r", progress); + } +} + +static void grtc_stress_test(bool busy_sim_en) +{ + static struct counter_alarm_cfg alarm_cfg; +#if DT_NODE_EXISTS(DT_NODELABEL(test_timer)) && DT_NODE_HAS_STATUS(DT_NODELABEL(test_timer), okay) + const struct device *const counter_dev = DEVICE_DT_GET(DT_NODELABEL(test_timer)); +#else + const struct device *const counter_dev = NULL; +#endif + uint32_t test_ms = 5000; + uint32_t test_start = k_uptime_get_32(); + uint32_t load; + + test_end = k_cycle_get_32() + k_ms_to_cyc_floor32(test_ms); + test_tid = k_current_get(); + + for (size_t i = 0; i < ARRAY_SIZE(timers); i++) { + k_timer_init(&timers[i].timer, timer_cb, NULL); + } + + if (IS_ENABLED(CONFIG_CPU_LOAD)) { + (void)cpu_load_get(true); + } + + if (counter_dev) { + counter_start(counter_dev); + } + + alarm_cfg.callback = counter_cb; + alarm_cfg.user_data = &alarm_cfg; + test_run = true; + + if (counter_dev) { + counter_set(counter_dev, &alarm_cfg); + } + + if (busy_sim_en) { + busy_sim_start(500, 200, 1000, 400, NULL); + } + + LOG_DBG("Starting test, will end at %d", test_end); + while (k_cycle_get_32() < test_end) { + report_progress(test_start, test_start + test_ms); + stress_test_actions(TEST_THREAD); + k_sleep(K_MSEC(test_ms)); + } + + load = IS_ENABLED(CONFIG_CPU_LOAD) ? cpu_load_get(true) : 0; + + test_run = false; + k_msleep(50); + + for (size_t i = 0; i < ARRAY_SIZE(timers); i++) { + zassert_equal(timers[i].state, TIMER_IDLE, "Unexpected timer %d state:%d", + i, timers[i].state); + TC_PRINT("Timer%d (%p)\r\n\tstart_cnt:%d abort_cnt:%d expire_cnt:%d\n", + i, &timers[i], timers[i].start_cnt, timers[i].abort_cnt, + timers[i].expire_cnt); + TC_PRINT("\tavarage late:%d ticks, max late:%d, min late:%d early:%d\n", + timers[i].avg_late, timers[i].max_late, timers[i].min_late, + timers[i].early_cnt); + } + + for (size_t i = 0; i < ARRAY_SIZE(ctx_cnt); i++) { + TC_PRINT("Context: %s executed %d times\n", ctx_name[i], ctx_cnt[i]); + } + TC_PRINT("CPU load during test:%d.%d\n", load / 10, load % 10); + + if (busy_sim_en) { + busy_sim_stop(); + } + + if (counter_dev) { + counter_stop(counter_dev); + } +} + +ZTEST(nrf_grtc_timer, test_stress) +{ + grtc_stress_test(false); +} + ZTEST_SUITE(nrf_grtc_timer, NULL, NULL, NULL, NULL, NULL); diff --git a/tests/drivers/timer/nrf_grtc_timer/testcase.yaml b/tests/drivers/timer/nrf_grtc_timer/testcase.yaml index 6f4486de913c..140d9b222599 100644 --- a/tests/drivers/timer/nrf_grtc_timer/testcase.yaml +++ b/tests/drivers/timer/nrf_grtc_timer/testcase.yaml @@ -1,17 +1,22 @@ +common: + tags: + - drivers + platform_allow: + - nrf54h20dk/nrf54h20/cpuapp + - nrf54h20dk/nrf54h20/cpurad + - nrf54h20dk/nrf54h20/cpuppr + - nrf54l15dk/nrf54l15/cpuapp + - nrf54l15dk/nrf54l15/cpuflpr + - nrf54l15bsim/nrf54l15/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuflpr + - ophelia4ev/nrf54l15/cpuapp + - ophelia4ev/nrf54l15/cpuflpr + integration_platforms: + - nrf54lm20dk/nrf54lm20a/cpuapp + timeout: 30 tests: - drivers.timer.nrf_grtc_timer: - tags: drivers - platform_allow: - - nrf54h20dk/nrf54h20/cpuapp - - nrf54h20dk/nrf54h20/cpurad - - nrf54h20dk/nrf54h20/cpuppr - - nrf54l15dk/nrf54l15/cpuapp - - nrf54l15dk/nrf54l15/cpuflpr - - nrf54l15bsim/nrf54l15/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuflpr - - ophelia4ev/nrf54l15/cpuapp - - ophelia4ev/nrf54l15/cpuflpr - integration_platforms: - - nrf54lm20dk/nrf54lm20a/cpuapp - timeout: 30 + drivers.timer.nrf_grtc_timer: {} + drivers.timer.nrf_grtc_timer.no_assert: + extra_configs: + - CONFIG_ASSERT=n From 3a4da33a15ab7cf58136ed1b89b6668f5a8f2ee1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Stasiak?= Date: Fri, 29 Aug 2025 15:15:34 +0200 Subject: [PATCH 1716/2141] [nrf fromlist] tests: drivers: timer: nrf_grtc_timer: wait for coverage dump MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If test is to be run in coverage mode, wait for output to dump at the end of a failing testcase. Upstream PR #: 95162 Signed-off-by: Michał Stasiak (cherry picked from commit 5408ed3f43481b3e6c031a16c7ea128e8fb1c0ae) --- tests/drivers/timer/nrf_grtc_timer/src/main.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/drivers/timer/nrf_grtc_timer/src/main.c b/tests/drivers/timer/nrf_grtc_timer/src/main.c index e411eba83a0b..bcb57519f3b4 100644 --- a/tests/drivers/timer/nrf_grtc_timer/src/main.c +++ b/tests/drivers/timer/nrf_grtc_timer/src/main.c @@ -393,6 +393,13 @@ static void grtc_stress_test(bool busy_sim_en) if (counter_dev) { counter_stop(counter_dev); } + +#ifdef CONFIG_COVERAGE + /* Wait a few seconds before exit, giving the test the + * opportunity to dump some output before coverage data gets emitted + */ + k_sleep(K_MSEC(5000)); +#endif } ZTEST(nrf_grtc_timer, test_stress) From d2642ade7f1f57333d0d1727ad921596feb943cd Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Fri, 5 Sep 2025 18:09:52 +0200 Subject: [PATCH 1717/2141] [nrf noup] soc/nordic/nrf54h: Add extension to define custom s2ram implementation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add Kconfig entries to allow compile own s2ram implementation. Signed-off-by: Karol Lasończyk Signed-off-by: Andrzej Puzdrowski (cherry picked from commit e6e402fe59adfee2c4fe988a93f971caae689ee8) --- soc/nordic/nrf54h/CMakeLists.txt | 4 +++- soc/nordic/nrf54h/Kconfig | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/soc/nordic/nrf54h/CMakeLists.txt b/soc/nordic/nrf54h/CMakeLists.txt index 94e38e62f2b1..fed4307214d5 100644 --- a/soc/nordic/nrf54h/CMakeLists.txt +++ b/soc/nordic/nrf54h/CMakeLists.txt @@ -8,7 +8,9 @@ if(CONFIG_ARM) endif() endif() -zephyr_library_sources_ifdef(CONFIG_PM_S2RAM pm_s2ram.c) +if(NOT CONFIG_SOC_NRF54H20_PM_S2RAM_OVERRIDE) + zephyr_library_sources_ifdef(CONFIG_PM_S2RAM pm_s2ram.c) +endif() zephyr_include_directories(.) diff --git a/soc/nordic/nrf54h/Kconfig b/soc/nordic/nrf54h/Kconfig index eefd11ac82fd..a2ef5f1eb183 100644 --- a/soc/nordic/nrf54h/Kconfig +++ b/soc/nordic/nrf54h/Kconfig @@ -110,6 +110,11 @@ config SOC_NRF54H20_DISABLE_ALL_GPIO_RETENTION_WORKAROUND default y depends on SOC_NRF54H20_CPUAPP || SOC_NRF54H20_CPURAD +config SOC_NRF54H20_PM_S2RAM_OVERRIDE + bool "Override `pm_s2ram` implementation" + help + Override Nordic s2ram implementation. + config SOC_NRF54H20_CPURAD select SOC_NRF54H20_CPURAD_COMMON From 51777189df20ae929cb4cb9537fc419b6cb64d91 Mon Sep 17 00:00:00 2001 From: Piotr Pryga Date: Thu, 11 Sep 2025 09:16:02 +0200 Subject: [PATCH 1718/2141] [nrf fromtree] dts: nrf54h20: Add zephyr,pm-device-runtime-auto; to uart instances The uart driver for nRF54h20 doesn't call pm_device_runtime_enable(). During an uart driver init `pm_device_driver_init()` return early, because the `pm_device_is_powered()` returns `false`. Power domains, where uarts are instantiated, are disabled: `pm->domain->pm_base->state` is not equal to `PM_DEVICE_STATE_ACTIVE`. At the end of the day, an uart instance is left disabled. This is a workaround to make the uart usable when CONFIG_PM, CONFIG_PM_DEVICE and CONFIG_PM_DEVICE_RUNTIME are enabled. Signed-off-by: Piotr Pryga (cherry picked from commit eaede77351a75cca14acafc470eae6beb03d5852) --- dts/vendor/nordic/nrf54h20.dtsi | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dts/vendor/nordic/nrf54h20.dtsi b/dts/vendor/nordic/nrf54h20.dtsi index d9703493a493..4644cb383ec5 100644 --- a/dts/vendor/nordic/nrf54h20.dtsi +++ b/dts/vendor/nordic/nrf54h20.dtsi @@ -742,6 +742,7 @@ power-domains = <&gdpwr_fast_active_1>; endtx-stoptx-supported; frame-timeout-supported; + zephyr,pm-device-runtime-auto; }; spi121: spi@8e7000 { @@ -1150,6 +1151,7 @@ nordic,clockpin-enable = ; endtx-stoptx-supported; frame-timeout-supported; + zephyr,pm-device-runtime-auto; }; i2c131: i2c@9a6000 { @@ -1285,6 +1287,7 @@ nordic,clockpin-enable = ; endtx-stoptx-supported; frame-timeout-supported; + zephyr,pm-device-runtime-auto; }; i2c133: i2c@9b6000 { @@ -1331,6 +1334,7 @@ nordic,clockpin-enable = ; endtx-stoptx-supported; frame-timeout-supported; + zephyr,pm-device-runtime-auto; }; dppic135: dppic@9c1000 { @@ -1419,6 +1423,7 @@ nordic,clockpin-enable = ; endtx-stoptx-supported; frame-timeout-supported; + zephyr,pm-device-runtime-auto; }; i2c135: i2c@9c6000 { @@ -1465,6 +1470,7 @@ nordic,clockpin-enable = ; endtx-stoptx-supported; frame-timeout-supported; + zephyr,pm-device-runtime-auto; }; dppic136: dppic@9d1000 { @@ -1600,6 +1606,7 @@ nordic,clockpin-enable = ; endtx-stoptx-supported; frame-timeout-supported; + zephyr,pm-device-runtime-auto; }; tdm130: tdm@992000 { From 9c4fe51898651888373c2fdf7d3abc461de6b733 Mon Sep 17 00:00:00 2001 From: Piotr Pryga Date: Fri, 12 Sep 2025 12:17:00 +0200 Subject: [PATCH 1719/2141] [nrf noup] dts: choose a psa-rng for entropy for 54lm20a Set PSA as the entropy source for nRF54lm20a target. PSA is the only NCS-supported interface to CRACEN. There is no other entropy source in 54lm20a than CRACEN. The commit also disables `rng` compatible with `nrf-cracen-ctrdrbg`, the nrfx based interface to CRACEN that is used in upstream Zephyr. Only one CRACEN interface may be enabled. Signed-off-by: Piotr Pryga (cherry picked from commit ffdab1b6b90658e0a9fc9a3ae64e45e37c3e9386) --- dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi | 2 +- dts/arm/nordic/nrf54lm20a_enga_cpuapp.dtsi | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi b/dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi index 80875058f5fd..88c1f43a9b8b 100644 --- a/dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi +++ b/dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi @@ -26,7 +26,7 @@ nvic: &cpuapp_nvic {}; }; rng: rng { - status = "okay"; + status = "disabled"; compatible = "nordic,nrf-cracen-ctrdrbg"; }; diff --git a/dts/arm/nordic/nrf54lm20a_enga_cpuapp.dtsi b/dts/arm/nordic/nrf54lm20a_enga_cpuapp.dtsi index dc13fb40d6aa..c92c27f5ceb4 100644 --- a/dts/arm/nordic/nrf54lm20a_enga_cpuapp.dtsi +++ b/dts/arm/nordic/nrf54lm20a_enga_cpuapp.dtsi @@ -17,7 +17,7 @@ nvic: &cpuapp_nvic {}; / { chosen { - zephyr,entropy = &rng; + zephyr,entropy = &psa_rng; }; soc { @@ -28,11 +28,11 @@ nvic: &cpuapp_nvic {}; psa_rng: psa-rng { compatible = "zephyr,psa-crypto-rng"; - status = "disabled"; + status = "okay"; }; rng: rng { - status = "okay"; + status = "disabled"; compatible = "nordic,nrf-cracen-ctrdrbg"; }; }; From f52792e546abd93e3f55d86a8895dd1c71ae7a95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Stasiak?= Date: Fri, 12 Sep 2025 14:31:11 +0200 Subject: [PATCH 1720/2141] [nrf fromlist] manifest: update hal_nordic revision to integrate MDK 8.72.3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit New hal_nordic revision contains MDK 8.72.3 with changes for nRF54LV10A EngA SoC. Upstream PR #: 95907 Signed-off-by: Michał Stasiak (cherry picked from commit 7d3bd3993600d433ab0653391aee2fa2b4ce3fda) --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index bcef02412e50..d0e76dbc5760 100644 --- a/west.yml +++ b/west.yml @@ -200,7 +200,7 @@ manifest: groups: - hal - name: hal_nordic - revision: 54f33f10a0b826174fb145f155afa61ce5a44b93 + revision: d0cef2363e572679deba0e796ef6c77f1188bb04 path: modules/hal/nordic groups: - hal From efb385c0bb2017698aafa73392a97a8cb68b964b Mon Sep 17 00:00:00 2001 From: Tomasz Chyrowicz Date: Mon, 15 Sep 2025 11:22:28 +0200 Subject: [PATCH 1721/2141] [nrf noup] boards: Align board DTS with upstream. This alignment cannot be done through nrf fromlist commit, since it was introduced in the tree-wide commit: 2d22884f52a01236d404fb2e6910d3683f680af6 Once tried to pull all changes to merge it cleanly, the chain ended up in the doc/releases/migration-guide-4.3.rst file, which would bring nearly all of the changes from the Zephyr 4.3 release, making a small PR with just 4 white characters a Zephyr upmerge PR. Feel free to drop this commit during the next Zephyr upmerge. Signed-off-by: Tomasz Chyrowicz (cherry picked from commit 998ed1b8b1b07bf801be74bbe9e69403a29fdab5) --- boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index e086601abae9..07c6b4155ca3 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -343,8 +343,8 @@ zephyr_udc0: &usbhs { /* Trim this RAM block for making room on all run-time common S2RAM cpu context. */ &cpuapp_ram0 { - reg = <0x22000000 (DT_SIZE_K(32)-32)>; - ranges = <0x0 0x22000000 (0x8000-0x20)>; + reg = <0x22000000 (DT_SIZE_K(32) - 32)>; + ranges = <0x0 0x22000000 (0x8000 - 0x20)>; }; / { From cc5a1b44c218570cce3760c4a35a67b2e9cc7dc5 Mon Sep 17 00:00:00 2001 From: Tomasz Chyrowicz Date: Tue, 16 Sep 2025 11:31:12 +0200 Subject: [PATCH 1722/2141] [nrf fromlist] arch: Allow to specify memory for S2RAM resume If the area, dedicated for the interrupt stack is not available, allow to specify a memory region that will be used as the stack for the S2RAM resume logic. Upstream PR #: 95914 Signed-off-by: Tomasz Chyrowicz (cherry picked from commit c9cfa6253d49d569d7129ef4a48daebef94127b2) --- arch/arm/core/cortex_m/reset.S | 12 ++++++++++++ subsys/pm/Kconfig | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/arch/arm/core/cortex_m/reset.S b/arch/arm/core/cortex_m/reset.S index b09391aaf0b5..6bdf8d4a8e94 100644 --- a/arch/arm/core/cortex_m/reset.S +++ b/arch/arm/core/cortex_m/reset.S @@ -101,6 +101,17 @@ SECTION_SUBSEC_FUNC(TEXT,_reset_section,__start) #endif /* CONFIG_INIT_ARCH_HW_AT_BOOT */ #if defined(CONFIG_PM_S2RAM) +#if DT_NODE_EXISTS(DT_NODELABEL(pm_s2ram_stack)) &&\ + DT_NODE_HAS_COMPAT(DT_NODELABEL(pm_s2ram_stack), zephyr_memory_region) + /* In certain scenarios, the interrupt stack is actually not safe to overwrite. + * For example, when MCUboot is used, the bootloader's "z_interrupt_stack" and the + * loaded image's "z_interrupt_stacks" are NOT at the same address, and writing to + * the former would corrupt unrelated data from the loaded image. To support such + * scenarios, if the Device Tree provides a specially named "zephyr,memory-region", + * use it as the stack to run arch_pm_s2ram_resume instead of the interrupt stack. + */ + ldr r0, =DT_REG_ADDR(DT_NODELABEL(pm_s2ram_stack)) + DT_REG_SIZE(DT_NODELABEL(pm_s2ram_stack)) +#else /* * Temporarily set MSP to interrupt stack so that arch_pm_s2ram_resume can * use stack for calling pm_s2ram_mark_check_and_clear. @@ -113,6 +124,7 @@ SECTION_SUBSEC_FUNC(TEXT,_reset_section,__start) * a short while, there is no change in behavior in either of the paths. */ ldr r0, =z_interrupt_stacks + CONFIG_ISR_STACK_SIZE + MPU_GUARD_ALIGN_AND_SIZE +#endif msr msp, r0 bl arch_pm_s2ram_resume diff --git a/subsys/pm/Kconfig b/subsys/pm/Kconfig index af0409de559a..53c649799cc4 100644 --- a/subsys/pm/Kconfig +++ b/subsys/pm/Kconfig @@ -41,6 +41,11 @@ config PM_S2RAM When enabled on Cortex-M, and a 'zephyr,memory-region' compatible node with nodelabel 'pm_s2ram' is defined in DT, _cpu_context symbol (located in arch/arm/core/cortex_m/pm_s2ram.c) is placed in linker section given by 'zephyr,memory-region' property of aforementioned node. + Additionally on Cortex-M, if a 'zephyr,memory-region' compatible node with nodelabel + 'pm_s2ram_stack' is defined in DT, this region will be used as a temporary program stack + for the S2RAM resume logic. The assembly reset handling code itself makes a single push of + the return address, but the SoC-specific function (pm_s2ram_mark_check_and_clear) must be + analyzed to determine the required stack size. config PM_S2RAM_CUSTOM_MARKING bool "Use custom marking functions" From cdc11bd5ef41488c5904d3ca147cd0907ce483e0 Mon Sep 17 00:00:00 2001 From: Tomasz Chyrowicz Date: Tue, 16 Sep 2025 11:31:37 +0200 Subject: [PATCH 1723/2141] [nrf fromlist] boards: Define pm_s2ram_stack for nRF54H20 Add the definition of pm_s2ram_stack memory region for nRF54H20. Upstream PR #: 95914 Signed-off-by: Tomasz Chyrowicz (cherry picked from commit c2748343ba324b7b5b1acd5598494eb8ee5b4e9a) --- .../nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index 07c6b4155ca3..34e914721958 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -343,12 +343,19 @@ zephyr_udc0: &usbhs { /* Trim this RAM block for making room on all run-time common S2RAM cpu context. */ &cpuapp_ram0 { - reg = <0x22000000 (DT_SIZE_K(32) - 32)>; - ranges = <0x0 0x22000000 (0x8000 - 0x20)>; + reg = <0x22000000 (DT_SIZE_K(32) - 48)>; + ranges = <0x0 0x22000000 (0x8000 - 0x30)>; }; / { soc { + /* temporary stack for S2RAM resume logic */ + pm_s2ram_stack: cpuapp_s2ram_stack@22007fd0 { + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0x22007fd0 16>; + zephyr,memory-region = "pm_s2ram_stack"; + }; + /* run-time common S2RAM cpu context RAM */ pm_s2ram: cpuapp_s2ram@22007fe0 { compatible = "zephyr,memory-region", "mmio-sram"; From a41a6314e19952459f7185217ee26c556fd334bd Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Fri, 5 Sep 2025 18:11:52 +0200 Subject: [PATCH 1724/2141] [nrf noup] soc/nordic/nrf54h/pm_s2ram: S2RAM resume hardening Added support for hardening decision on resume from S2RAM by MCUboot bootloader. Application sets additional variable to MCUBOOT_S2RAM_RESUME_MAGIC which allows the bootloader to doublecheck. Signed-off-by: Andrzej Puzdrowski (cherry picked from commit d4bb1c6b9f1c941480a457b18ae36c9bdf49faa7) --- .../nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 15 +++++++++++---- soc/nordic/nrf54h/pm_s2ram.c | 14 ++++++++++++++ soc/nordic/nrf54h/pm_s2ram.h | 6 ++++++ 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index 34e914721958..ae330e209aad 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -343,19 +343,26 @@ zephyr_udc0: &usbhs { /* Trim this RAM block for making room on all run-time common S2RAM cpu context. */ &cpuapp_ram0 { - reg = <0x22000000 (DT_SIZE_K(32) - 48)>; - ranges = <0x0 0x22000000 (0x8000 - 0x30)>; + reg = <0x22000000 (DT_SIZE_K(32) - 52)>; + ranges = <0x0 0x22000000 (0x8000 - 0x34)>; }; / { soc { /* temporary stack for S2RAM resume logic */ - pm_s2ram_stack: cpuapp_s2ram_stack@22007fd0 { + pm_s2ram_stack: cpuapp_s2ram_stack@22007fcc { compatible = "zephyr,memory-region", "mmio-sram"; - reg = <0x22007fd0 16>; + reg = <0x22007fcc 16>; zephyr,memory-region = "pm_s2ram_stack"; }; + /* run-time common mcuboot S2RAM support section */ + mcuboot_s2ram: cpuapp_s2ram@22007fdc { + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0x22007fdc 4>; + zephyr,memory-region = "mcuboot_s2ram_context"; + }; + /* run-time common S2RAM cpu context RAM */ pm_s2ram: cpuapp_s2ram@22007fe0 { compatible = "zephyr,memory-region", "mmio-sram"; diff --git a/soc/nordic/nrf54h/pm_s2ram.c b/soc/nordic/nrf54h/pm_s2ram.c index 221293c5b82e..6916e4884727 100644 --- a/soc/nordic/nrf54h/pm_s2ram.c +++ b/soc/nordic/nrf54h/pm_s2ram.c @@ -219,10 +219,24 @@ static void fpu_restore(_fpu_context_t *backup) #endif /* !defined(CONFIG_FPU_SHARING) */ #endif /* defined(CONFIG_FPU) */ +#if DT_NODE_EXISTS(DT_NODELABEL(mcuboot_s2ram)) &&\ + DT_NODE_HAS_COMPAT(DT_NODELABEL(mcuboot_s2ram), zephyr_memory_region) +/* Linker section name is given by `zephyr,memory-region` property of + * `zephyr,memory-region` compatible DT node with nodelabel `mcuboot_s2ram`. + */ +__attribute__((section(DT_PROP(DT_NODELABEL(mcuboot_s2ram), zephyr_memory_region)))) +volatile struct mcuboot_resume_s _mcuboot_resume; + +#define SET_MCUBOOT_RESUME_MAGIC() _mcuboot_resume.magic = MCUBOOT_S2RAM_RESUME_MAGIC +#else +#define SET_MCUBOOT_RESUME_MAGIC() +#endif + int soc_s2ram_suspend(pm_s2ram_system_off_fn_t system_off) { int ret; + SET_MCUBOOT_RESUME_MAGIC(); scb_save(&backup_data.scb_context); #if defined(CONFIG_FPU) #if !defined(CONFIG_FPU_SHARING) diff --git a/soc/nordic/nrf54h/pm_s2ram.h b/soc/nordic/nrf54h/pm_s2ram.h index 565afad6ca10..0906010cbe08 100644 --- a/soc/nordic/nrf54h/pm_s2ram.h +++ b/soc/nordic/nrf54h/pm_s2ram.h @@ -10,6 +10,12 @@ #ifndef _ZEPHYR_SOC_ARM_NORDIC_NRF_PM_S2RAM_H_ #define _ZEPHYR_SOC_ARM_NORDIC_NRF_PM_S2RAM_H_ +#define MCUBOOT_S2RAM_RESUME_MAGIC 0x75832419 + +struct mcuboot_resume_s { + uint32_t magic; /* magic value to identify valid structure */ +}; + /** * @brief Save CPU state on suspend * From 32796574e947b80a8316390c9816ebaef724712f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Pelikan?= Date: Mon, 8 Sep 2025 12:45:10 +0200 Subject: [PATCH 1725/2141] [nrf fromtree] tests: kernel: sleep: Adjustments for NRF54H20 PPR MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adjusting the max shortest ticks value for slow PPR core. Signed-off-by: Paweł Pelikan (cherry picked from commit 1192dbf24ad410e39652698e32f86d94c369d8de) --- tests/kernel/sleep/src/usleep.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/kernel/sleep/src/usleep.c b/tests/kernel/sleep/src/usleep.c index 8a234a27a199..a7c212e59b96 100644 --- a/tests/kernel/sleep/src/usleep.c +++ b/tests/kernel/sleep/src/usleep.c @@ -42,6 +42,11 @@ * loaded to its comparator. */ #define MAXIMUM_SHORTEST_TICKS 2 +#elif defined(CONFIG_SOC_NRF54H20_CPUPPR) && (CONFIG_SYS_CLOCK_TICKS_PER_SEC > 16384) +/* Similar for nRF54H20 cpuppr (RISC-V core), it has a slow CPU clock + * compared to other cores, causing the increased overhead. + */ +#define MAXIMUM_SHORTEST_TICKS 4 #else #define MAXIMUM_SHORTEST_TICKS 1 #endif From e66b6ccda98154350d336f93a67bdae096c7ce33 Mon Sep 17 00:00:00 2001 From: Piotr Pryga Date: Fri, 12 Sep 2025 07:48:52 +0200 Subject: [PATCH 1726/2141] [nrf noup] dts: Select SoftDevice Controller DTS binding as default The SoftDevice Controller is a different controller than the open source link layer with a different set of quirks. The SoftDevice Controller is a default BT controller in nRF Connect SDK context, therefore it should be enabled by default instead of open source link layer. The commit changes the default BT controller for nRF54lm20a SoC. Signed-off-by: Piotr Pryga --- boards/nordic/nrf54lm20dk/nrf54lm20a_cpuapp_common.dtsi | 5 ----- boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp.dts | 4 ---- dts/arm/nordic/nrf54lm20a_enga_cpuapp.dtsi | 5 +++++ dts/vendor/nordic/nrf54lm20a.dtsi | 5 +++++ 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/boards/nordic/nrf54lm20dk/nrf54lm20a_cpuapp_common.dtsi b/boards/nordic/nrf54lm20dk/nrf54lm20a_cpuapp_common.dtsi index d6184705899d..0ee33f1fd45b 100644 --- a/boards/nordic/nrf54lm20dk/nrf54lm20a_cpuapp_common.dtsi +++ b/boards/nordic/nrf54lm20dk/nrf54lm20a_cpuapp_common.dtsi @@ -18,7 +18,6 @@ zephyr,bt-c2h-uart = &uart20; zephyr,flash-controller = &rram_controller; zephyr,flash = &cpuapp_rram; - zephyr,bt-hci = &bt_hci_controller; zephyr,ieee802154 = &ieee802154; }; }; @@ -131,10 +130,6 @@ status = "okay"; }; -&bt_hci_controller { - status = "okay"; -}; - &ieee802154 { status = "okay"; }; diff --git a/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp.dts b/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp.dts index 6dd2c5b2e850..727729600c2c 100644 --- a/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp.dts +++ b/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp.dts @@ -18,9 +18,5 @@ }; }; -&bt_hci_controller { - status = "okay"; -}; - /* Get a node label for wi-fi spi to use in shield files */ wifi_spi: &spi22 {}; diff --git a/dts/arm/nordic/nrf54lm20a_enga_cpuapp.dtsi b/dts/arm/nordic/nrf54lm20a_enga_cpuapp.dtsi index c92c27f5ceb4..1fb0386650b4 100644 --- a/dts/arm/nordic/nrf54lm20a_enga_cpuapp.dtsi +++ b/dts/arm/nordic/nrf54lm20a_enga_cpuapp.dtsi @@ -17,6 +17,7 @@ nvic: &cpuapp_nvic {}; / { chosen { + zephyr,bt-hci = &bt_hci_sdc; zephyr,entropy = &psa_rng; }; @@ -37,6 +38,10 @@ nvic: &cpuapp_nvic {}; }; }; +&bt_hci_sdc { + status = "okay"; +}; + &cpuflpr_vpr { cpuapp_vevif_rx: mailbox@1 { compatible = "nordic,nrf-vevif-event-rx"; diff --git a/dts/vendor/nordic/nrf54lm20a.dtsi b/dts/vendor/nordic/nrf54lm20a.dtsi index 0601771d496a..d1e6d1b0d28a 100644 --- a/dts/vendor/nordic/nrf54lm20a.dtsi +++ b/dts/vendor/nordic/nrf54lm20a.dtsi @@ -277,6 +277,11 @@ /* Note: In the nRF Connect SDK the SoftDevice Controller * is added and set as the default Bluetooth Controller. */ + bt_hci_sdc: bt_hci_sdc { + compatible = "nordic,bt-hci-sdc"; + status = "disabled"; + }; + bt_hci_controller: bt_hci_controller { compatible = "zephyr,bt-hci-ll-sw-split"; status = "disabled"; From 6782b3a2058632f4774fcbbe110664c7aae53cbc Mon Sep 17 00:00:00 2001 From: Georgios Vasilakis Date: Fri, 12 Sep 2025 12:38:25 +0200 Subject: [PATCH 1727/2141] [nrf noup] tests: ram_context_for_isr: Disable KMU by default Disable the KMU by default for all the NRF54L devices for this test. With the current configuration this test is incompatible with the KMU because it changes the placement of the RAM in the linker files and this collides with the KMU logic. But it also does not need the KMU so there is no need to be there. This is a noup because the configuration (and KMU support) is only placed in ncs. The KMU dependency to reserve the top RAM address is planned to be done in dts (NCSDK-31980). Hopefuly when this is done this noup can be removed. Signed-off-by: Georgios Vasilakis --- .../boards/nrf54l05dk_nrf54l05_cpuapp.conf | 6 ++++++ .../boards/nrf54l15dk_nrf54l10_cpuapp.conf | 6 ++++++ .../boards/nrf54l15dk_nrf54l15_cpuapp.conf | 6 ++++++ .../boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf | 6 ++++++ .../boards/nrf54lv10dk_nrf54lv10a_cpuapp.conf | 6 ++++++ 5 files changed, 30 insertions(+) create mode 100644 tests/application_development/ram_context_for_isr/boards/nrf54l05dk_nrf54l05_cpuapp.conf create mode 100644 tests/application_development/ram_context_for_isr/boards/nrf54l15dk_nrf54l10_cpuapp.conf create mode 100644 tests/application_development/ram_context_for_isr/boards/nrf54l15dk_nrf54l15_cpuapp.conf create mode 100644 tests/application_development/ram_context_for_isr/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf create mode 100644 tests/application_development/ram_context_for_isr/boards/nrf54lv10dk_nrf54lv10a_cpuapp.conf diff --git a/tests/application_development/ram_context_for_isr/boards/nrf54l05dk_nrf54l05_cpuapp.conf b/tests/application_development/ram_context_for_isr/boards/nrf54l05dk_nrf54l05_cpuapp.conf new file mode 100644 index 000000000000..963ba83325a4 --- /dev/null +++ b/tests/application_development/ram_context_for_isr/boards/nrf54l05dk_nrf54l05_cpuapp.conf @@ -0,0 +1,6 @@ +# +# Copyright (c) 2025 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# +CONFIG_CRACEN_LIB_KMU=n diff --git a/tests/application_development/ram_context_for_isr/boards/nrf54l15dk_nrf54l10_cpuapp.conf b/tests/application_development/ram_context_for_isr/boards/nrf54l15dk_nrf54l10_cpuapp.conf new file mode 100644 index 000000000000..963ba83325a4 --- /dev/null +++ b/tests/application_development/ram_context_for_isr/boards/nrf54l15dk_nrf54l10_cpuapp.conf @@ -0,0 +1,6 @@ +# +# Copyright (c) 2025 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# +CONFIG_CRACEN_LIB_KMU=n diff --git a/tests/application_development/ram_context_for_isr/boards/nrf54l15dk_nrf54l15_cpuapp.conf b/tests/application_development/ram_context_for_isr/boards/nrf54l15dk_nrf54l15_cpuapp.conf new file mode 100644 index 000000000000..963ba83325a4 --- /dev/null +++ b/tests/application_development/ram_context_for_isr/boards/nrf54l15dk_nrf54l15_cpuapp.conf @@ -0,0 +1,6 @@ +# +# Copyright (c) 2025 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# +CONFIG_CRACEN_LIB_KMU=n diff --git a/tests/application_development/ram_context_for_isr/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf b/tests/application_development/ram_context_for_isr/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf new file mode 100644 index 000000000000..963ba83325a4 --- /dev/null +++ b/tests/application_development/ram_context_for_isr/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf @@ -0,0 +1,6 @@ +# +# Copyright (c) 2025 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# +CONFIG_CRACEN_LIB_KMU=n diff --git a/tests/application_development/ram_context_for_isr/boards/nrf54lv10dk_nrf54lv10a_cpuapp.conf b/tests/application_development/ram_context_for_isr/boards/nrf54lv10dk_nrf54lv10a_cpuapp.conf new file mode 100644 index 000000000000..963ba83325a4 --- /dev/null +++ b/tests/application_development/ram_context_for_isr/boards/nrf54lv10dk_nrf54lv10a_cpuapp.conf @@ -0,0 +1,6 @@ +# +# Copyright (c) 2025 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# +CONFIG_CRACEN_LIB_KMU=n From f77679a04180056ddd8c9c9366b0ddb84087f18a Mon Sep 17 00:00:00 2001 From: Ravi Dondaputi Date: Thu, 11 Sep 2025 16:07:03 +0530 Subject: [PATCH 1728/2141] [nrf noup] boards: nordic: nrf7002: Include required headers The definitions of slot partitions and sram partition has been moved. Include corresponding headers. Signed-off-by: Ravi Dondaputi --- boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.dts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.dts b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.dts index 0deb8ccc1bf5..9c06a17ad7bf 100644 --- a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.dts +++ b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.dts @@ -7,6 +7,8 @@ /dts-v1/; #include #include "nrf5340_cpuapp_common.dtsi" +#include "nordic/nrf5340_sram_partition.dtsi" +#include "nordic/nrf5340_cpuapp_ns_partition.dtsi" / { model = "Nordic NRF5340 DK NRF5340 Application"; From 20e985d80e3f738db978ee2c008e170fa07ddc08 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Tue, 12 Aug 2025 12:18:11 +0200 Subject: [PATCH 1729/2141] [nrf fromlist] tests: arch: arm: irq vt: disable power domains (NRFS) Upstream PR #: 94392 The power domains on the nrf54h20dk require NRFS, which uses some of the irq vectors reserved for the test. Disable power domains and its drivers to free the irq vectors. Signed-off-by: Bjarki Arge Andreasen --- .../boards/nrf54h20dk_nrf54h20_cpuapp.conf | 4 ++ .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 49 +++++++++++++++++++ .../boards/nrf54h20dk_nrf54h20_cpurad.conf | 4 ++ .../boards/nrf54h20dk_nrf54h20_cpurad.overlay | 48 ++++++++++++++++++ 4 files changed, 105 insertions(+) diff --git a/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpuapp.conf b/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpuapp.conf index a18a3b576e39..6457f0efce73 100644 --- a/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpuapp.conf +++ b/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpuapp.conf @@ -1 +1,5 @@ +# Copyright (c) 2025 Nordic Semiconductor +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_POWER_DOMAIN=n CONFIG_SSF_CLIENT_SYS_INIT=n diff --git a/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index 57d4a8a5babe..4fd0ecca13ea 100644 --- a/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -11,3 +11,52 @@ &cpusec_bellboard { status = "disabled"; }; + + +&gdpwr { + status = "disabled"; +}; + +&gdpwr_fast_active_0 { + status = "disabled"; +}; + +&gdpwr_fast_active_1 { + status = "disabled"; +}; + +&gdpwr_fast_main { + status = "disabled"; +}; + +&gdpwr_slow_active { + status = "disabled"; +}; + +&gdpwr_slow_main { + status = "disabled"; +}; + +&gpio_pad_group0 { + status = "disabled"; +}; + +&gpio_pad_group1 { + status = "disabled"; +}; + +&gpio_pad_group2 { + status = "disabled"; +}; + +&gpio_pad_group6 { + status = "disabled"; +}; + +&gpio_pad_group7 { + status = "disabled"; +}; + +&gpio_pad_group9 { + status = "disabled"; +}; diff --git a/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpurad.conf b/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpurad.conf index a18a3b576e39..6457f0efce73 100644 --- a/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpurad.conf +++ b/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpurad.conf @@ -1 +1,5 @@ +# Copyright (c) 2025 Nordic Semiconductor +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_POWER_DOMAIN=n CONFIG_SSF_CLIENT_SYS_INIT=n diff --git a/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpurad.overlay b/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpurad.overlay index be4b7c565d6d..b6d0ab807e99 100644 --- a/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpurad.overlay +++ b/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpurad.overlay @@ -11,3 +11,51 @@ &cpusec_bellboard { status = "disabled"; }; + +&gdpwr { + status = "disabled"; +}; + +&gdpwr_fast_active_0 { + status = "disabled"; +}; + +&gdpwr_fast_active_1 { + status = "disabled"; +}; + +&gdpwr_fast_main { + status = "disabled"; +}; + +&gdpwr_slow_active { + status = "disabled"; +}; + +&gdpwr_slow_main { + status = "disabled"; +}; + +&gpio_pad_group0 { + status = "disabled"; +}; + +&gpio_pad_group1 { + status = "disabled"; +}; + +&gpio_pad_group2 { + status = "disabled"; +}; + +&gpio_pad_group6 { + status = "disabled"; +}; + +&gpio_pad_group7 { + status = "disabled"; +}; + +&gpio_pad_group9 { + status = "disabled"; +}; From c5d7fd8fbea46598d19dbf34bda97b23fcdea193 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Fri, 12 Sep 2025 12:18:52 +0200 Subject: [PATCH 1730/2141] [nrf fromtree] lib: os: clock: Fix possibly unitialized variable warning When building with high optimization level, the compiler thinks duration may be used initialized and warns as much. Let's initialize this variable always to ensure it does not happen and with it pacify the compiler. Signed-off-by: Alberto Escolar Piedras (cherry picked from commit 1d6da40624af7d53e4510b00adbbb48318b79465) --- lib/os/clock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/os/clock.c b/lib/os/clock.c index 0d5813f49fef..2b9968b2eeb4 100644 --- a/lib/os/clock.c +++ b/lib/os/clock.c @@ -158,7 +158,7 @@ int z_impl_sys_clock_nanosleep(int clock_id, int flags, const struct timespec *r { k_timepoint_t end; k_timeout_t timeout; - struct timespec duration; + struct timespec duration = {0, 0}; const bool update_rmtp = rmtp != NULL; const bool abstime = (flags & SYS_TIMER_ABSTIME) != 0; From d2b9e5feee019f08a20387d2752a8c61a71cfe46 Mon Sep 17 00:00:00 2001 From: Georgios Vasilakis Date: Wed, 10 Sep 2025 13:05:10 +0200 Subject: [PATCH 1731/2141] [nrf fromtree] net: websocket: Allow using PSA APIs to calculate SHA1 The websocket used mbedtls functions to calculate the SHA1 needed. Update the code to use PSA crypto calls instead when the configuration CONFIG_MBEDTLS_PSA_CRYPTO_CLIENT is enabled. This can be useful for applications which use TF-M since it only provides PSA crypto APIs. Also check the error code from the mbedtls_sha1 call since it can fail and it was not checked before. Signed-off-by: Georgios Vasilakis (cherry picked from commit 53b2802fff679a9666e006ffcf1b8ac034f228f5) --- subsys/net/lib/websocket/websocket.c | 45 ++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/subsys/net/lib/websocket/websocket.c b/subsys/net/lib/websocket/websocket.c index 2efb16bfac89..d682fd4b5dc2 100644 --- a/subsys/net/lib/websocket/websocket.c +++ b/subsys/net/lib/websocket/websocket.c @@ -34,7 +34,12 @@ LOG_MODULE_REGISTER(net_websocket, CONFIG_NET_WEBSOCKET_LOG_LEVEL); #include #include #include + +#ifdef CONFIG_MBEDTLS_PSA_CRYPTO_CLIENT +#include +#else #include +#endif /* CONFIG_MBEDTLS_PSA_CRYPTO_CLIENT */ #include "net_private.h" #include "sockets_internal.h" @@ -253,6 +258,10 @@ int websocket_connect(int sock, struct websocket_request *wreq, "Sec-WebSocket-Version: 13\r\n", NULL }; +#ifdef CONFIG_MBEDTLS_PSA_CRYPTO_CLIENT + psa_status_t psa_status; + size_t hash_length; +#endif /* CONFIG_MBEDTLS_PSA_CRYPTO_CLIENT */ fd = -1; @@ -280,8 +289,23 @@ int websocket_connect(int sock, struct websocket_request *wreq, ctx->http_cb = wreq->http_cb; ctx->is_client = 1; - mbedtls_sha1((const unsigned char *)&rnd_value, sizeof(rnd_value), - sec_accept_key); +#ifdef CONFIG_MBEDTLS_PSA_CRYPTO_CLIENT + psa_status = psa_hash_compute(PSA_ALG_SHA_1, (const uint8_t *)&rnd_value, sizeof(rnd_value), + sec_accept_key, sizeof(sec_accept_key), &hash_length); + if (psa_status != PSA_SUCCESS) { + NET_DBG("[%p] Cannot calculate sha1 (%d)", ctx, psa_status); + ret = -EPROTO; + goto out; + } +#else + ret = mbedtls_sha1((const unsigned char *)&rnd_value, sizeof(rnd_value), sec_accept_key); + if (ret != 0) { + NET_DBG("[%p] Cannot calculate sha1 (%d)", ctx, ret); + ret = -EPROTO; + goto out; + } +#endif /* CONFIG_MBEDTLS_PSA_CRYPTO_CLIENT */ + ret = base64_encode(sec_ws_key + sizeof("Sec-Websocket-Key: ") - 1, sizeof(sec_ws_key) - @@ -344,7 +368,22 @@ int websocket_connect(int sock, struct websocket_request *wreq, strncpy(key_accept + key_len, WS_MAGIC, olen); /* This SHA-1 value is then checked when we receive the response */ - mbedtls_sha1(key_accept, olen + key_len, sec_accept_key); +#ifdef CONFIG_MBEDTLS_PSA_CRYPTO_CLIENT + psa_status = psa_hash_compute(PSA_ALG_SHA_1, (const uint8_t *)key_accept, olen + key_len, + sec_accept_key, sizeof(sec_accept_key), &hash_length); + if (psa_status != PSA_SUCCESS) { + NET_DBG("[%p] Cannot calculate sha1 (%d)", ctx, psa_status); + ret = -EPROTO; + goto out; + } +#else + ret = mbedtls_sha1(key_accept, olen + key_len, sec_accept_key); + if (ret != 0) { + NET_DBG("[%p] Cannot calculate sha1 (%d)", ctx, ret); + ret = -EPROTO; + goto out; + } +#endif /* CONFIG_MBEDTLS_PSA_CRYPTO_CLIENT */ ret = http_client_req(sock, &req, timeout, ctx); if (ret < 0) { From 9f0c0173304c49e41f4219e85ba678df7da328d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B8e?= Date: Wed, 10 Sep 2025 13:41:12 +0200 Subject: [PATCH 1732/2141] [nrf fromtree] soc: nordic: uicr: Fix dependency issue MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Although not reproducible locally, it has been observed in CI that the uicr image will not always be the last image to be run. To ensure it is the last image to be run we have it depend on the 'image' image when defined. The uicr image is generated based on all other images in the build and must therefore run last. Signed-off-by: Sebastian Bøe (cherry picked from commit 32c67762568c1aeb4484c2abf621f3f11f0ccf78) --- soc/nordic/common/uicr/sysbuild.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/soc/nordic/common/uicr/sysbuild.cmake b/soc/nordic/common/uicr/sysbuild.cmake index 167ac7c64a2d..9cafd261036d 100644 --- a/soc/nordic/common/uicr/sysbuild.cmake +++ b/soc/nordic/common/uicr/sysbuild.cmake @@ -8,4 +8,8 @@ ExternalZephyrProject_Add( # Ensure UICR is configured and built after the default image so EDT/ELFs exist. sysbuild_add_dependencies(CONFIGURE uicr ${DEFAULT_IMAGE}) + add_dependencies(uicr ${DEFAULT_IMAGE}) +if(DEFINED image) + add_dependencies(uicr ${image}) +endif() From 3653174a6b3fbe629a2f2e097dfbfe00bf6a3874 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karol=20Laso=C5=84czyk?= Date: Tue, 16 Sep 2025 11:37:56 +0200 Subject: [PATCH 1733/2141] [nrf fromtree] drivers: audio: Fix nrfx_pdm compilation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes drv_data structure handling in various configuration. Signed-off-by: Karol Lasończyk (cherry picked from commit afff286f74f0de99246b1797af846db21e6678ce) --- drivers/audio/dmic_nrfx_pdm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/audio/dmic_nrfx_pdm.c b/drivers/audio/dmic_nrfx_pdm.c index f0162fc5ef8b..c2c80a7414c1 100644 --- a/drivers/audio/dmic_nrfx_pdm.c +++ b/drivers/audio/dmic_nrfx_pdm.c @@ -668,11 +668,12 @@ static int dmic_nrfx_pdm_read(const struct device *dev, static void init_clock_manager(const struct device *dev) { - struct dmic_nrfx_pdm_drv_data *drv_data = dev->data; #if DT_NODE_HAS_STATUS_OKAY(NODE_AUDIO_AUXPLL) + struct dmic_nrfx_pdm_drv_data *drv_data = dev->data; drv_data->audiopll_dev = DEVICE_DT_GET(NODE_AUDIO_AUXPLL); #elif CONFIG_CLOCK_CONTROL_NRF clock_control_subsys_t subsys; + struct dmic_nrfx_pdm_drv_data *drv_data = dev->data; #if NRF_CLOCK_HAS_HFCLKAUDIO const struct dmic_nrfx_pdm_drv_cfg *drv_cfg = dev->config; From e3ae9fabfca2ea01718ef852ae45410026d4f646 Mon Sep 17 00:00:00 2001 From: Jonathan Nilsen Date: Tue, 9 Sep 2025 15:29:25 +0200 Subject: [PATCH 1734/2141] [nrf fromlist] soc: nordic: nrf54h: generate PERIPHCONF entries based on devicetree Upstream PR #: 95915 Add build system support for populating the PERIPHCONF (global domain peripheral configuration), based on nodes and properties found in the devicetree. This should make it so all samples and tests that were broken by the move to IronSide SE now function correctly without workarounds or manual steps. When enabled, a new python script called gen_periphconf_entries.py is run when building. The script iterates over nodes and properties in the devicetree and generates a C file called periphconf_entries_generated.c in the build directory, which is added as a source file. The C file uses the macros from uicr.h to configure the global domain according to the devicetree. The PERIPHCONF entry generation is enabled by default when building for nrf54h20dk/nrf54h20/cpuapp and nrf54h20dk/nrf54h20/cpurad. It will also be used on nrf9280 soon, therefore it is placed in the common uicr directory. This new feature does the same job as nrf-regtool did when building for nrf54h20 before, and is compatible by the bindings that were used by nrf-regtool. Signed-off-by: Jonathan Nilsen --- soc/nordic/common/uicr/CMakeLists.txt | 16 + soc/nordic/common/uicr/Kconfig | 9 + .../common/uicr/gen_periphconf_entries.py | 658 ++++++++ soc/nordic/common/uicr/gen_uicr.py | 33 + soc/nordic/common/uicr/periphconf/__init__.py | 6 + soc/nordic/common/uicr/periphconf/builder.py | 1460 +++++++++++++++++ 6 files changed, 2182 insertions(+) create mode 100644 soc/nordic/common/uicr/gen_periphconf_entries.py create mode 100644 soc/nordic/common/uicr/periphconf/__init__.py create mode 100644 soc/nordic/common/uicr/periphconf/builder.py diff --git a/soc/nordic/common/uicr/CMakeLists.txt b/soc/nordic/common/uicr/CMakeLists.txt index 1ec3a35c5665..9d5deec52d57 100644 --- a/soc/nordic/common/uicr/CMakeLists.txt +++ b/soc/nordic/common/uicr/CMakeLists.txt @@ -4,3 +4,19 @@ if(CONFIG_NRF_PERIPHCONF_SECTION) zephyr_linker_sources(SECTIONS uicr.ld) endif() + +if(CONFIG_NRF_PERIPHCONF_GENERATE_ENTRIES) + set(periphconf_entries_c_file ${PROJECT_BINARY_DIR}/periphconf_entries_generated.c) + execute_process( + COMMAND + ${CMAKE_COMMAND} -E env ZEPHYR_BASE=${ZEPHYR_BASE} + ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_LIST_DIR}/gen_periphconf_entries.py + --soc ${CONFIG_SOC} + --in-edt-pickle ${EDT_PICKLE} + --out-periphconf-source ${periphconf_entries_c_file} + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + COMMAND_ERROR_IS_FATAL ANY + ) + zephyr_sources(${periphconf_entries_c_file}) + message(STATUS "Generated ${periphconf_entries_c_file} from ${EDT_PICKLE}") +endif() diff --git a/soc/nordic/common/uicr/Kconfig b/soc/nordic/common/uicr/Kconfig index 3c4c6c8219b6..73b5e5cf2d1c 100644 --- a/soc/nordic/common/uicr/Kconfig +++ b/soc/nordic/common/uicr/Kconfig @@ -9,3 +9,12 @@ config NRF_PERIPHCONF_SECTION help Include static global domain peripheral initialization values from the build in a dedicated section in the devnull region. + +config NRF_PERIPHCONF_GENERATE_ENTRIES + bool "Generate PERIPHCONF entries source file" + default y if SOC_NRF54H20_CPUAPP || SOC_NRF54H20_CPURAD + depends on NRF_PERIPHCONF_SECTION + depends on NRF_PLATFORM_HALTIUM + help + Generate a C file containing PERIPHCONF entries based on the + device configuration in the devicetree. diff --git a/soc/nordic/common/uicr/gen_periphconf_entries.py b/soc/nordic/common/uicr/gen_periphconf_entries.py new file mode 100644 index 000000000000..e70e56acc1f3 --- /dev/null +++ b/soc/nordic/common/uicr/gen_periphconf_entries.py @@ -0,0 +1,658 @@ +""" +Copyright (c) 2025 Nordic Semiconductor ASA +SPDX-License-Identifier: Apache-2.0 +""" + +from __future__ import annotations + +import argparse +import enum +import os +import pickle +import sys +from pathlib import Path +from typing import Any + +try: + ZEPHYR_BASE = Path(os.environ["ZEPHYR_BASE"]).resolve() +except KeyError: + sys.exit("Set the environment variable 'ZEPHYR_BASE' to point to the zephyr root directory") + +# Add packages that are located in zephyr itself to the python path so we can import them below +sys.path.insert(0, str(ZEPHYR_BASE / "scripts/dts/python-devicetree/src")) +sys.path.insert(0, str(ZEPHYR_BASE / "soc/nordic/common/uicr")) + +from periphconf.builder import ( + Ctrlsel, + FixedPPIMap, + GpiosProp, + Node, + NrfCompChannel, + NrfFun, + NrfPsel, + NrfSaadcChannel, + PeriphconfBuilder, + ProcessorId, + SocLookupTables, + dt_processor_id, +) + +# These peripherals are special cases that don't fit the general rules we use to generate +# PERIPHCONF entries based on the devicetree. +NODELABEL_TO_KWARGS = { + # Channel links on this node do not result in PPIB connections, because the *-links properties + # are ambiguous. Instead, the PPIB connections are configured by the DPPICs connected to this. + "dppic130": {"add_ppib_channel_links": False}, + # The interrupts for this node are not managed in IRQMAP. + "canpll": {"has_irq_mapping": False}, +} + + +def get_additional_node_kwargs(node: Node) -> dict[str, Any]: + additional_kwargs = {} + for label in node.labels: + additional_kwargs.update(NODELABEL_TO_KWARGS.get(label, {})) + return additional_kwargs + + +class Soc(enum.Enum): + """Names of SoCs supported by this script""" + + NRF54H20 = "nrf54h20" + NRF9280 = "nrf9280" + + +def parse_args() -> argparse.Namespace: + parser = argparse.ArgumentParser( + allow_abbrev=False, + description=( + "Generate a C source file containing entries for the PERIPHCONF blob based on the " + "device configuration in devicetree." + ), + ) + parser.add_argument( + "-v", + "--verbose", + default=0, + action="count", + help="Print verbose output such as debug information.", + ) + parser.add_argument( + "--soc", + required=True, + choices=[soc.value for soc in Soc], + help=( + "SoC to generate PERIPHCONF macros for. " + "Used to look up soc specific hardware information" + ), + ) + parser.add_argument( + "--in-edt-pickle", + type=argparse.FileType("rb"), + required=True, + help="Path to the pickled edtlib.EDT object with devicetree contents.", + ) + parser.add_argument( + "--out-periphconf-source", + type=argparse.FileType("w", encoding="utf-8"), + required=True, + help="Path to write the generated PERIPHCONF C source file to.", + ) + return parser.parse_args() + + +def main() -> None: + args = parse_args() + dt = pickle.load(args.in_edt_pickle) + processor = dt_processor_id(dt) + lookup_tables = lookup_tables_get(Soc(args.soc)) + builder = PeriphconfBuilder(dt, lookup_tables) + + # Application local peripherals + if processor == ProcessorId.APPLICATION: + for node in dt.label2node["cpuapp_peripherals"].children.values(): + builder.add_local_peripheral_cfg(node, **get_additional_node_kwargs(node)) + + # Radio local peripherals + if processor == ProcessorId.RADIOCORE: + for node in dt.label2node["cpurad_peripherals"].children.values(): + builder.add_local_peripheral_cfg(node, **get_additional_node_kwargs(node)) + + # Global domain peripherals + for node in dt.label2node["global_peripherals"].children.values(): + builder.add_global_peripheral_cfg(node, **get_additional_node_kwargs(node)) + + # Add pins referenced by 'gpios' properties on non-peripheral nodes, for example + # buttons and leds. We only add SPU configurations for these and not CTRLSEL, + # to avoid false CTRLSEL conflicts for things like PWM leds. + for node in dt.nodes: + builder.add_gpio_spu_permissions(node) + + script_name = Path(__file__).resolve().relative_to(ZEPHYR_BASE) + generated_by = f"Generated by {script_name}" + + generated_source = builder.build_generated_source(generated_by) + args.out_periphconf_source.write(generated_source) + + +def lookup_tables_get(soc: Soc) -> SocLookupTables: + if soc == Soc.NRF54H20: + ctrlsel_lookup = { + # CAN120 + 0x5F8D_8000: { + # P2 + NrfPsel(fun=NrfFun.CAN_TX, port=2, pin=9): Ctrlsel.CAN_PWM_I3C, + NrfPsel(fun=NrfFun.CAN_RX, port=2, pin=8): Ctrlsel.CAN_PWM_I3C, + # P9 + NrfPsel(fun=NrfFun.CAN_TX, port=9, pin=5): Ctrlsel.CAN, + NrfPsel(fun=NrfFun.CAN_RX, port=9, pin=4): Ctrlsel.CAN, + }, + # PWM120 + 0x5F8E_4000: { + # P2 + NrfPsel(fun=NrfFun.PWM_OUT0, port=2, pin=4): Ctrlsel.CAN_PWM_I3C, + NrfPsel(fun=NrfFun.PWM_OUT1, port=2, pin=5): Ctrlsel.CAN_PWM_I3C, + NrfPsel(fun=NrfFun.PWM_OUT2, port=2, pin=6): Ctrlsel.CAN_PWM_I3C, + NrfPsel(fun=NrfFun.PWM_OUT3, port=2, pin=7): Ctrlsel.CAN_PWM_I3C, + # P6 + NrfPsel(fun=NrfFun.PWM_OUT0, port=6, pin=6): Ctrlsel.CAN_PWM_I3C, + NrfPsel(fun=NrfFun.PWM_OUT1, port=6, pin=7): Ctrlsel.CAN_PWM_I3C, + NrfPsel(fun=NrfFun.PWM_OUT2, port=6, pin=8): Ctrlsel.CAN_PWM_I3C, + NrfPsel(fun=NrfFun.PWM_OUT3, port=6, pin=9): Ctrlsel.CAN_PWM_I3C, + # P7 + NrfPsel(fun=NrfFun.PWM_OUT0, port=7, pin=0): Ctrlsel.CAN_PWM_I3C, + NrfPsel(fun=NrfFun.PWM_OUT1, port=7, pin=1): Ctrlsel.CAN_PWM_I3C, + NrfPsel(fun=NrfFun.PWM_OUT2, port=7, pin=6): Ctrlsel.CAN_PWM_I3C, + NrfPsel(fun=NrfFun.PWM_OUT3, port=7, pin=7): Ctrlsel.CAN_PWM_I3C, + }, + # PWM130 + 0x5F9A_4000: { + # P9 + NrfPsel(fun=NrfFun.PWM_OUT0, port=9, pin=2): Ctrlsel.CAN_PWM_I3C, + NrfPsel(fun=NrfFun.PWM_OUT1, port=9, pin=3): Ctrlsel.CAN_PWM_I3C, + NrfPsel(fun=NrfFun.PWM_OUT2, port=9, pin=4): Ctrlsel.CAN_PWM_I3C, + NrfPsel(fun=NrfFun.PWM_OUT3, port=9, pin=5): Ctrlsel.CAN_PWM_I3C, + }, + # SPIM130/SPIS130/TWIM130/TWIS130/UARTE130 + 0x5F9A_5000: { + # SPIM mappings + NrfPsel(fun=NrfFun.SPIM_MOSI, port=9, pin=5): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.SPIM_MISO, port=9, pin=2): Ctrlsel.SERIAL0, + GpiosProp(name="cs-gpios", port=9, pin=3): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.SPIM_SCK, port=9, pin=4): Ctrlsel.SERIAL0, + # SPIS mappings + NrfPsel(fun=NrfFun.SPIS_MISO, port=9, pin=5): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.SPIS_MOSI, port=9, pin=2): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.SPIS_CSN, port=9, pin=3): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.SPIS_SCK, port=9, pin=4): Ctrlsel.SERIAL0, + # TWIM mappings + NrfPsel(fun=NrfFun.TWIM_SDA, port=9, pin=5): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.TWIM_SCL, port=9, pin=4): Ctrlsel.SERIAL0, + # TWIS mappings + NrfPsel(fun=NrfFun.TWIS_SDA, port=9, pin=5): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.TWIS_SCL, port=9, pin=4): Ctrlsel.SERIAL0, + # UARTÈ mappings + NrfPsel(fun=NrfFun.UART_TX, port=9, pin=5): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.UART_RX, port=9, pin=4): Ctrlsel.CAN_TDM_SERIAL2, + NrfPsel(fun=NrfFun.UART_CTS, port=9, pin=2): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.UART_RTS, port=9, pin=3): Ctrlsel.SERIAL0, + }, + # SPIM131/SPIS131/TWIM131/TWIS131/UARTE131 + 0x5F9A_6000: { + # SPIM mappings + NrfPsel(fun=NrfFun.SPIM_MOSI, port=9, pin=0): Ctrlsel.CAN_TDM_SERIAL2, + NrfPsel(fun=NrfFun.SPIM_MISO, port=9, pin=2): Ctrlsel.CAN_TDM_SERIAL2, + GpiosProp(name="cs-gpios", port=9, pin=3): Ctrlsel.CAN_TDM_SERIAL2, + NrfPsel(fun=NrfFun.SPIM_SCK, port=9, pin=1): Ctrlsel.CAN_TDM_SERIAL2, + # SPIS mappings + NrfPsel(fun=NrfFun.SPIS_MISO, port=9, pin=0): Ctrlsel.CAN_TDM_SERIAL2, + NrfPsel(fun=NrfFun.SPIS_MOSI, port=9, pin=2): Ctrlsel.CAN_TDM_SERIAL2, + NrfPsel(fun=NrfFun.SPIS_CSN, port=9, pin=3): Ctrlsel.CAN_TDM_SERIAL2, + NrfPsel(fun=NrfFun.SPIS_SCK, port=9, pin=1): Ctrlsel.CAN_TDM_SERIAL2, + # TWIM mappings + NrfPsel(fun=NrfFun.TWIM_SDA, port=9, pin=0): Ctrlsel.CAN_TDM_SERIAL2, + NrfPsel(fun=NrfFun.TWIM_SCL, port=9, pin=1): Ctrlsel.CAN_TDM_SERIAL2, + # TWIS mappings + NrfPsel(fun=NrfFun.TWIS_SDA, port=9, pin=0): Ctrlsel.CAN_TDM_SERIAL2, + NrfPsel(fun=NrfFun.TWIS_SCL, port=9, pin=1): Ctrlsel.CAN_TDM_SERIAL2, + # UARTÈ mappings + NrfPsel(fun=NrfFun.UART_TX, port=9, pin=0): Ctrlsel.CAN_TDM_SERIAL2, + NrfPsel(fun=NrfFun.UART_RX, port=9, pin=1): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.UART_CTS, port=9, pin=2): Ctrlsel.CAN_TDM_SERIAL2, + NrfPsel(fun=NrfFun.UART_RTS, port=9, pin=3): Ctrlsel.CAN_TDM_SERIAL2, + }, + # VPR121 (FLPR) + 0x5F8D_4000: { + # P1 + NrfPsel(fun=NrfFun.IGNORE, port=1, pin=8): Ctrlsel.VPR_GRC, + NrfPsel(fun=NrfFun.IGNORE, port=1, pin=9): Ctrlsel.VPR_GRC, + NrfPsel(fun=NrfFun.IGNORE, port=1, pin=10): Ctrlsel.VPR_GRC, + NrfPsel(fun=NrfFun.IGNORE, port=1, pin=11): Ctrlsel.VPR_GRC, + # P2 + NrfPsel(fun=NrfFun.IGNORE, port=2, pin=0): Ctrlsel.VPR_GRC, + NrfPsel(fun=NrfFun.IGNORE, port=2, pin=1): Ctrlsel.VPR_GRC, + NrfPsel(fun=NrfFun.IGNORE, port=2, pin=2): Ctrlsel.VPR_GRC, + NrfPsel(fun=NrfFun.IGNORE, port=2, pin=3): Ctrlsel.VPR_GRC, + NrfPsel(fun=NrfFun.IGNORE, port=2, pin=4): Ctrlsel.VPR_GRC, + NrfPsel(fun=NrfFun.IGNORE, port=2, pin=5): Ctrlsel.VPR_GRC, + NrfPsel(fun=NrfFun.IGNORE, port=2, pin=6): Ctrlsel.VPR_GRC, + NrfPsel(fun=NrfFun.IGNORE, port=2, pin=7): Ctrlsel.VPR_GRC, + NrfPsel(fun=NrfFun.IGNORE, port=2, pin=8): Ctrlsel.VPR_GRC, + NrfPsel(fun=NrfFun.IGNORE, port=2, pin=9): Ctrlsel.VPR_GRC, + NrfPsel(fun=NrfFun.IGNORE, port=2, pin=10): Ctrlsel.VPR_GRC, + NrfPsel(fun=NrfFun.IGNORE, port=2, pin=11): Ctrlsel.VPR_GRC, + # P6 + NrfPsel(fun=NrfFun.IGNORE, port=6, pin=0): Ctrlsel.VPR_GRC, + # (pin 1-2 are not connected with VIO) + NrfPsel(fun=NrfFun.IGNORE, port=6, pin=3): Ctrlsel.VPR_GRC, + NrfPsel(fun=NrfFun.IGNORE, port=6, pin=4): Ctrlsel.VPR_GRC, + NrfPsel(fun=NrfFun.IGNORE, port=6, pin=5): Ctrlsel.VPR_GRC, + NrfPsel(fun=NrfFun.IGNORE, port=6, pin=6): Ctrlsel.VPR_GRC, + NrfPsel(fun=NrfFun.IGNORE, port=6, pin=7): Ctrlsel.VPR_GRC, + NrfPsel(fun=NrfFun.IGNORE, port=6, pin=8): Ctrlsel.VPR_GRC, + NrfPsel(fun=NrfFun.IGNORE, port=6, pin=9): Ctrlsel.VPR_GRC, + NrfPsel(fun=NrfFun.IGNORE, port=6, pin=10): Ctrlsel.VPR_GRC, + NrfPsel(fun=NrfFun.IGNORE, port=6, pin=11): Ctrlsel.VPR_GRC, + NrfPsel(fun=NrfFun.IGNORE, port=6, pin=12): Ctrlsel.VPR_GRC, + NrfPsel(fun=NrfFun.IGNORE, port=6, pin=13): Ctrlsel.VPR_GRC, + # P7 + NrfPsel(fun=NrfFun.IGNORE, port=7, pin=0): Ctrlsel.VPR_GRC, + NrfPsel(fun=NrfFun.IGNORE, port=7, pin=1): Ctrlsel.VPR_GRC, + NrfPsel(fun=NrfFun.IGNORE, port=7, pin=2): Ctrlsel.VPR_GRC, + NrfPsel(fun=NrfFun.IGNORE, port=7, pin=3): Ctrlsel.VPR_GRC, + NrfPsel(fun=NrfFun.IGNORE, port=7, pin=4): Ctrlsel.VPR_GRC, + NrfPsel(fun=NrfFun.IGNORE, port=7, pin=5): Ctrlsel.VPR_GRC, + NrfPsel(fun=NrfFun.IGNORE, port=7, pin=6): Ctrlsel.VPR_GRC, + NrfPsel(fun=NrfFun.IGNORE, port=7, pin=7): Ctrlsel.VPR_GRC, + # P9 + NrfPsel(fun=NrfFun.IGNORE, port=9, pin=0): Ctrlsel.VPR_GRC, + NrfPsel(fun=NrfFun.IGNORE, port=9, pin=1): Ctrlsel.VPR_GRC, + NrfPsel(fun=NrfFun.IGNORE, port=9, pin=2): Ctrlsel.VPR_GRC, + NrfPsel(fun=NrfFun.IGNORE, port=9, pin=3): Ctrlsel.VPR_GRC, + NrfPsel(fun=NrfFun.IGNORE, port=9, pin=4): Ctrlsel.VPR_GRC, + NrfPsel(fun=NrfFun.IGNORE, port=9, pin=5): Ctrlsel.VPR_GRC, + }, + # SPIS120 + 0x5F8E_5000: { + NrfPsel(fun=NrfFun.SPIS_MISO, port=6, pin=3): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.SPIS_MOSI, port=6, pin=4): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.SPIS_CSN, port=6, pin=9): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.SPIS_SCK, port=6, pin=0): Ctrlsel.SERIAL0, + }, + # SPIM120/UARTE120 + 0x5F8E_6000: { + # SPIM P6 mappings + NrfPsel(fun=NrfFun.SPIM_MOSI, port=6, pin=8): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.SPIM_MISO, port=6, pin=7): Ctrlsel.SERIAL0, + GpiosProp(name="cs-gpios", port=6, pin=5): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.SPIM_SCK, port=6, pin=1): Ctrlsel.SERIAL0, + # SPIM P7 mappings + NrfPsel(fun=NrfFun.SPIM_MOSI, port=7, pin=7): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.SPIM_MISO, port=7, pin=6): Ctrlsel.SERIAL0, + GpiosProp(name="cs-gpios", port=7, pin=5): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.SPIM_SCK, port=7, pin=3): Ctrlsel.SERIAL0, + # SPIM P2 mappings + NrfPsel(fun=NrfFun.SPIM_MOSI, port=2, pin=6): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.SPIM_MISO, port=2, pin=5): Ctrlsel.SERIAL0, + GpiosProp(name="cs-gpios", port=2, pin=7): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.SPIM_SCK, port=2, pin=3): Ctrlsel.SERIAL0, + # UARTÈ P6 mappings + NrfPsel(fun=NrfFun.UART_TX, port=6, pin=8): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.UART_CTS, port=6, pin=7): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.UART_RX, port=6, pin=6): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.UART_RTS, port=6, pin=5): Ctrlsel.SERIAL0, + # UARTÈ P7 mappings + NrfPsel(fun=NrfFun.UART_TX, port=7, pin=7): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.UART_CTS, port=7, pin=6): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.UART_RX, port=7, pin=4): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.UART_RTS, port=7, pin=5): Ctrlsel.SERIAL0, + # UARTÈ P2 mappings + NrfPsel(fun=NrfFun.UART_TX, port=2, pin=6): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.UART_CTS, port=2, pin=5): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.UART_RX, port=2, pin=4): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.UART_RTS, port=2, pin=7): Ctrlsel.SERIAL0, + }, + # SPIM121 + 0x5F8E_7000: { + # SPIM P6 mappings + NrfPsel(fun=NrfFun.SPIM_MOSI, port=6, pin=13): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.SPIM_MISO, port=6, pin=12): Ctrlsel.SERIAL0, + GpiosProp(name="cs-gpios", port=6, pin=10): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.SPIM_SCK, port=6, pin=2): Ctrlsel.SERIAL0, + # SPIM P7 mappings + NrfPsel(fun=NrfFun.SPIM_MOSI, port=7, pin=1): Ctrlsel.EXMIF_RADIO_SERIAL1, + NrfPsel(fun=NrfFun.SPIS_MISO, port=7, pin=1): Ctrlsel.EXMIF_RADIO_SERIAL1, + NrfPsel(fun=NrfFun.SPIM_MISO, port=7, pin=0): Ctrlsel.EXMIF_RADIO_SERIAL1, + NrfPsel(fun=NrfFun.SPIS_MOSI, port=7, pin=0): Ctrlsel.EXMIF_RADIO_SERIAL1, + GpiosProp(name="cs-gpios", port=7, pin=4): Ctrlsel.EXMIF_RADIO_SERIAL1, + NrfPsel(fun=NrfFun.SPIS_CSN, port=7, pin=4): Ctrlsel.EXMIF_RADIO_SERIAL1, + NrfPsel(fun=NrfFun.SPIM_SCK, port=7, pin=2): Ctrlsel.EXMIF_RADIO_SERIAL1, + NrfPsel(fun=NrfFun.SPIS_SCK, port=7, pin=2): Ctrlsel.EXMIF_RADIO_SERIAL1, + # SPIM P2 mappings + NrfPsel(fun=NrfFun.SPIM_MOSI, port=2, pin=11): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.SPIM_MISO, port=2, pin=10): Ctrlsel.SERIAL0, + GpiosProp(name="cs-gpios", port=2, pin=8): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.SPIM_SCK, port=2, pin=2): Ctrlsel.SERIAL0, + }, + # EXMIF + 0x5F09_5000: { + NrfPsel(fun=NrfFun.EXMIF_CK, port=6, pin=0): Ctrlsel.EXMIF_RADIO_SERIAL1, + NrfPsel(fun=NrfFun.EXMIF_RWDS, port=6, pin=2): Ctrlsel.EXMIF_RADIO_SERIAL1, + NrfPsel(fun=NrfFun.EXMIF_CS0, port=6, pin=3): Ctrlsel.EXMIF_RADIO_SERIAL1, + NrfPsel(fun=NrfFun.EXMIF_DQ7, port=6, pin=4): Ctrlsel.EXMIF_RADIO_SERIAL1, + NrfPsel(fun=NrfFun.EXMIF_DQ1, port=6, pin=5): Ctrlsel.EXMIF_RADIO_SERIAL1, + NrfPsel(fun=NrfFun.EXMIF_DQ6, port=6, pin=6): Ctrlsel.EXMIF_RADIO_SERIAL1, + NrfPsel(fun=NrfFun.EXMIF_DQ0, port=6, pin=7): Ctrlsel.EXMIF_RADIO_SERIAL1, + NrfPsel(fun=NrfFun.EXMIF_DQ5, port=6, pin=8): Ctrlsel.EXMIF_RADIO_SERIAL1, + NrfPsel(fun=NrfFun.EXMIF_DQ3, port=6, pin=9): Ctrlsel.EXMIF_RADIO_SERIAL1, + NrfPsel(fun=NrfFun.EXMIF_DQ2, port=6, pin=10): Ctrlsel.EXMIF_RADIO_SERIAL1, + NrfPsel(fun=NrfFun.EXMIF_DQ4, port=6, pin=11): Ctrlsel.EXMIF_RADIO_SERIAL1, + NrfPsel(fun=NrfFun.EXMIF_CS1, port=6, pin=13): Ctrlsel.EXMIF_RADIO_SERIAL1, + }, + # VPR130 (PPR) + 0x5F90_8000: { + # P0 + NrfPsel(fun=NrfFun.IGNORE, port=0, pin=4): Ctrlsel.VPR_GRC, + NrfPsel(fun=NrfFun.IGNORE, port=0, pin=5): Ctrlsel.VPR_GRC, + NrfPsel(fun=NrfFun.IGNORE, port=0, pin=6): Ctrlsel.VPR_GRC, + NrfPsel(fun=NrfFun.IGNORE, port=0, pin=7): Ctrlsel.VPR_GRC, + }, + # TDM130 + 0x5F99_2000: { + # TDM P1 mappings + NrfPsel(fun=NrfFun.TDM_MCK, port=1, pin=2): Ctrlsel.CAN_TDM_SERIAL2, + NrfPsel(fun=NrfFun.TDM_SCK_M, port=1, pin=3): Ctrlsel.CAN_TDM_SERIAL2, + NrfPsel(fun=NrfFun.TDM_SCK_S, port=1, pin=3): Ctrlsel.CAN_TDM_SERIAL2, + NrfPsel(fun=NrfFun.TDM_SDOUT, port=1, pin=4): Ctrlsel.CAN_TDM_SERIAL2, + NrfPsel(fun=NrfFun.TDM_SDIN, port=1, pin=5): Ctrlsel.CAN_TDM_SERIAL2, + NrfPsel(fun=NrfFun.TDM_FSYNC_M, port=1, pin=6): Ctrlsel.CAN_TDM_SERIAL2, + NrfPsel(fun=NrfFun.TDM_FSYNC_S, port=1, pin=6): Ctrlsel.CAN_TDM_SERIAL2, + # TDM P2 mappings + NrfPsel(fun=NrfFun.TDM_MCK, port=2, pin=0): Ctrlsel.CAN_TDM_SERIAL2, + NrfPsel(fun=NrfFun.TDM_SCK_M, port=2, pin=1): Ctrlsel.CAN_TDM_SERIAL2, + NrfPsel(fun=NrfFun.TDM_SCK_S, port=2, pin=1): Ctrlsel.CAN_TDM_SERIAL2, + NrfPsel(fun=NrfFun.TDM_SDOUT, port=2, pin=9): Ctrlsel.CAN_TDM_SERIAL2, + NrfPsel(fun=NrfFun.TDM_SDIN, port=2, pin=10): Ctrlsel.CAN_TDM_SERIAL2, + NrfPsel(fun=NrfFun.TDM_FSYNC_M, port=2, pin=11): Ctrlsel.CAN_TDM_SERIAL2, + NrfPsel(fun=NrfFun.TDM_FSYNC_S, port=2, pin=11): Ctrlsel.CAN_TDM_SERIAL2, + }, + # TDM131 + 0x5F99_7000: { + # TDM P1 mappings + NrfPsel(fun=NrfFun.TDM_MCK, port=1, pin=0): Ctrlsel.CAN_TDM_SERIAL2, + NrfPsel(fun=NrfFun.TDM_SCK_M, port=1, pin=1): Ctrlsel.CAN_TDM_SERIAL2, + NrfPsel(fun=NrfFun.TDM_SCK_S, port=1, pin=1): Ctrlsel.CAN_TDM_SERIAL2, + NrfPsel(fun=NrfFun.TDM_SDOUT, port=1, pin=9): Ctrlsel.CAN_TDM_SERIAL2, + NrfPsel(fun=NrfFun.TDM_SDIN, port=1, pin=10): Ctrlsel.CAN_TDM_SERIAL2, + NrfPsel(fun=NrfFun.TDM_FSYNC_M, port=1, pin=11): Ctrlsel.CAN_TDM_SERIAL2, + NrfPsel(fun=NrfFun.TDM_FSYNC_S, port=1, pin=11): Ctrlsel.CAN_TDM_SERIAL2, + # TDM P2 mappings + NrfPsel(fun=NrfFun.TDM_MCK, port=2, pin=2): Ctrlsel.CAN_TDM_SERIAL2, + NrfPsel(fun=NrfFun.TDM_SCK_M, port=2, pin=3): Ctrlsel.CAN_TDM_SERIAL2, + NrfPsel(fun=NrfFun.TDM_SCK_S, port=2, pin=3): Ctrlsel.CAN_TDM_SERIAL2, + NrfPsel(fun=NrfFun.TDM_SDOUT, port=2, pin=4): Ctrlsel.CAN_TDM_SERIAL2, + NrfPsel(fun=NrfFun.TDM_SDIN, port=2, pin=6): Ctrlsel.CAN_TDM_SERIAL2, + NrfPsel(fun=NrfFun.TDM_FSYNC_M, port=2, pin=7): Ctrlsel.CAN_TDM_SERIAL2, + NrfPsel(fun=NrfFun.TDM_FSYNC_S, port=2, pin=7): Ctrlsel.CAN_TDM_SERIAL2, + }, + # GPIOTE0 (RAD) + 0x5302_7000: { + # P1 + NrfPsel(fun=NrfFun.IGNORE, port=1, pin=4): Ctrlsel.CAN, + NrfPsel(fun=NrfFun.IGNORE, port=1, pin=5): Ctrlsel.CAN, + NrfPsel(fun=NrfFun.IGNORE, port=1, pin=6): Ctrlsel.CAN, + NrfPsel(fun=NrfFun.IGNORE, port=1, pin=7): Ctrlsel.CAN, + NrfPsel(fun=NrfFun.IGNORE, port=1, pin=8): Ctrlsel.CAN, + NrfPsel(fun=NrfFun.IGNORE, port=1, pin=9): Ctrlsel.CAN, + NrfPsel(fun=NrfFun.IGNORE, port=1, pin=10): Ctrlsel.CAN, + NrfPsel(fun=NrfFun.IGNORE, port=1, pin=11): Ctrlsel.CAN, + # P2 + NrfPsel(fun=NrfFun.IGNORE, port=2, pin=0): Ctrlsel.CAN, + NrfPsel(fun=NrfFun.IGNORE, port=2, pin=1): Ctrlsel.CAN, + NrfPsel(fun=NrfFun.IGNORE, port=2, pin=2): Ctrlsel.CAN, + NrfPsel(fun=NrfFun.IGNORE, port=2, pin=3): Ctrlsel.CAN, + NrfPsel(fun=NrfFun.IGNORE, port=2, pin=4): Ctrlsel.CAN, + NrfPsel(fun=NrfFun.IGNORE, port=2, pin=5): Ctrlsel.CAN, + NrfPsel(fun=NrfFun.IGNORE, port=2, pin=6): Ctrlsel.CAN, + NrfPsel(fun=NrfFun.IGNORE, port=2, pin=7): Ctrlsel.CAN, + NrfPsel(fun=NrfFun.IGNORE, port=2, pin=8): Ctrlsel.CAN, + NrfPsel(fun=NrfFun.IGNORE, port=2, pin=9): Ctrlsel.CAN, + NrfPsel(fun=NrfFun.IGNORE, port=2, pin=10): Ctrlsel.CAN, + NrfPsel(fun=NrfFun.IGNORE, port=2, pin=11): Ctrlsel.CAN, + }, + } + elif soc == Soc.NRF9280: + ctrlsel_lookup = { + # PWM120 + 0x5F8E_4000: { + # P2 + NrfPsel(fun=NrfFun.PWM_OUT0, port=2, pin=0): Ctrlsel.CAN_PWM_I3C, + NrfPsel(fun=NrfFun.PWM_OUT1, port=2, pin=1): Ctrlsel.CAN_PWM_I3C, + NrfPsel(fun=NrfFun.PWM_OUT2, port=2, pin=2): Ctrlsel.CAN_PWM_I3C, + NrfPsel(fun=NrfFun.PWM_OUT3, port=2, pin=3): Ctrlsel.CAN_PWM_I3C, + # P6 + NrfPsel(fun=NrfFun.PWM_OUT0, port=6, pin=0): Ctrlsel.CAN_PWM_I3C, + NrfPsel(fun=NrfFun.PWM_OUT0, port=6, pin=6): Ctrlsel.CAN_PWM_I3C, + NrfPsel(fun=NrfFun.PWM_OUT1, port=6, pin=1): Ctrlsel.CAN_PWM_I3C, + NrfPsel(fun=NrfFun.PWM_OUT1, port=6, pin=7): Ctrlsel.CAN_PWM_I3C, + NrfPsel(fun=NrfFun.PWM_OUT2, port=6, pin=2): Ctrlsel.CAN_PWM_I3C, + NrfPsel(fun=NrfFun.PWM_OUT2, port=6, pin=8): Ctrlsel.CAN_PWM_I3C, + NrfPsel(fun=NrfFun.PWM_OUT3, port=6, pin=3): Ctrlsel.CAN_PWM_I3C, + NrfPsel(fun=NrfFun.PWM_OUT3, port=6, pin=9): Ctrlsel.CAN_PWM_I3C, + }, + # SPIM120/UARTE120 + 0x5F8E_6000: { + # SPIM P2 mappings + GpiosProp(name="cs-gpios", port=2, pin=5): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.SPIM_MISO, port=2, pin=3): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.SPIM_MOSI, port=2, pin=4): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.SPIM_SCK, port=2, pin=0): Ctrlsel.SERIAL0, + # SPIM P6 mappings + GpiosProp(name="cs-gpios", port=6, pin=5): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.SPIM_MISO, port=6, pin=7): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.SPIM_MOSI, port=6, pin=8): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.SPIM_SCK, port=6, pin=1): Ctrlsel.SERIAL0, + # UARTE P2 mappings + NrfPsel(fun=NrfFun.UART_CTS, port=2, pin=3): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.UART_RTS, port=2, pin=5): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.UART_RX, port=2, pin=2): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.UART_TX, port=2, pin=4): Ctrlsel.SERIAL0, + # UARTE P6 mappings + NrfPsel(fun=NrfFun.UART_CTS, port=6, pin=7): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.UART_RTS, port=6, pin=5): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.UART_RX, port=6, pin=6): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.UART_TX, port=6, pin=8): Ctrlsel.SERIAL0, + }, + # SPIM121 + 0x5F8E_7000: { + # P2 + GpiosProp(name="cs-gpios", port=2, pin=6): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.SPIM_MISO, port=2, pin=8): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.SPIM_MOSI, port=2, pin=9): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.SPIM_SCK, port=2, pin=1): Ctrlsel.SERIAL0, + # P6 + GpiosProp(name="cs-gpios", port=6, pin=10): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.SPIM_MISO, port=6, pin=12): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.SPIM_MOSI, port=6, pin=13): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.SPIM_SCK, port=6, pin=2): Ctrlsel.SERIAL0, + }, + # PWM130 + 0x5F9A_4000: { + NrfPsel(fun=NrfFun.PWM_OUT0, port=9, pin=2): Ctrlsel.CAN_PWM_I3C, + NrfPsel(fun=NrfFun.PWM_OUT1, port=9, pin=3): Ctrlsel.CAN_PWM_I3C, + NrfPsel(fun=NrfFun.PWM_OUT2, port=9, pin=4): Ctrlsel.CAN_PWM_I3C, + NrfPsel(fun=NrfFun.PWM_OUT3, port=9, pin=5): Ctrlsel.CAN_PWM_I3C, + }, + # SPIM130/SPIS130/TWIM130/TWIS130/UARTE130 + 0x5F9A_5000: { + # SPIM mappings + GpiosProp(name="cs-gpios", port=9, pin=1): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.SPIM_MISO, port=9, pin=2): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.SPIM_MOSI, port=9, pin=3): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.SPIM_SCK, port=9, pin=0): Ctrlsel.SERIAL0, + # SPIS mappings + NrfPsel(fun=NrfFun.SPIS_CSN, port=9, pin=1): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.SPIS_MISO, port=9, pin=3): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.SPIS_MOSI, port=9, pin=2): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.SPIS_SCK, port=9, pin=0): Ctrlsel.SERIAL0, + # TWIM mappings + NrfPsel(fun=NrfFun.TWIM_SCL, port=9, pin=0): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.TWIM_SDA, port=9, pin=3): Ctrlsel.SERIAL0, + # UARTE mappings + NrfPsel(fun=NrfFun.UART_CTS, port=9, pin=2): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.UART_RTS, port=9, pin=1): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.UART_RX, port=9, pin=4): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.UART_TX, port=9, pin=3): Ctrlsel.SERIAL0, + }, + } + else: + raise NotImplementedError(f"No CTRLSEL table exists for soc {soc}") + + # Entries below this are common to all supported socs at the time of writing. + + adc_channel_pin_lookup = { + # SAADC + 0x5F98_2000: { + NrfSaadcChannel.AIN0: (1, 0), + NrfSaadcChannel.AIN1: (1, 1), + NrfSaadcChannel.AIN2: (1, 2), + NrfSaadcChannel.AIN3: (1, 3), + NrfSaadcChannel.AIN4: (1, 4), + NrfSaadcChannel.AIN5: (1, 5), + NrfSaadcChannel.AIN6: (1, 6), + NrfSaadcChannel.AIN7: (1, 7), + NrfSaadcChannel.AIN8: (9, 0), + NrfSaadcChannel.AIN9: (9, 1), + NrfSaadcChannel.AIN10: (9, 2), + NrfSaadcChannel.AIN11: (9, 3), + NrfSaadcChannel.AIN12: (9, 4), + NrfSaadcChannel.AIN13: (9, 5), + } + } + comp_channel_pin_lookup = { + # COMP/LPCOMP + 0x5F98_3000: { + NrfCompChannel.AIN0: (1, 0), + NrfCompChannel.AIN1: (1, 1), + NrfCompChannel.AIN2: (1, 2), + NrfCompChannel.AIN3: (1, 3), + NrfCompChannel.AIN4: (1, 4), + NrfCompChannel.AIN5: (1, 5), + NrfCompChannel.AIN6: (1, 6), + NrfCompChannel.AIN7: (1, 7), + NrfCompChannel.AIN8: (9, 0), + NrfCompChannel.AIN9: (9, 1), + } + } + spu_instances = [ + ("SPU110", 0x5F08_0000), + ("SPU111", 0x5F09_0000), + ("SPU120", 0x5F8C_0000), + ("SPU121", 0x5F8D_0000), + ("SPU122", 0x5F8E_0000), + ("SPU130", 0x5F90_0000), + ("SPU131", 0x5F92_0000), + ("SPU132", 0x5F98_0000), + ("SPU133", 0x5F99_0000), + ("SPU134", 0x5F9A_0000), + ("SPU135", 0x5F9B_0000), + ("SPU136", 0x5F9C_0000), + ("SPU137", 0x5F9D_0000), + ] + dppics = { + "DPPIC120": 0x5F8E_1000, + "DPPIC130": 0x5F92_2000, + "DPPIC131": 0x5F98_1000, + "DPPIC132": 0x5F99_1000, + "DPPIC133": 0x5F9A_1000, + "DPPIC134": 0x5F9B_1000, + "DPPIC135": 0x5F9C_1000, + "DPPIC136": 0x5F9D_1000, + } + ppib_instances = [ + ("PPIB110", 0x5F09_8000), + ("PPIB120", 0x5F8E_E000), + ("PPIB121", 0x5F8E_F000), + ("PPIB130", 0x5F92_5000), + ("PPIB131", 0x5F92_6000), + ("PPIB132", 0x5F98_D000), + ("PPIB133", 0x5F99_D000), + ("PPIB134", 0x5F9A_D000), + ("PPIB135", 0x5F9B_D000), + ("PPIB136", 0x5F9C_D000), + ("PPIB137", 0x5F9D_D000), + ] + ppib_name_to_addr = dict(ppib_instances) + dppic_to_ppib_connections = { + dppics["DPPIC120"]: FixedPPIMap( + connected_to=ppib_name_to_addr["PPIB121"], + channel_map=range(0, 8), + ), + dppics["DPPIC131"]: FixedPPIMap( + connected_to=ppib_name_to_addr["PPIB132"], + channel_map=range(0, 8), + ), + dppics["DPPIC132"]: FixedPPIMap( + connected_to=ppib_name_to_addr["PPIB133"], + channel_map=range(0, 8), + ), + dppics["DPPIC133"]: FixedPPIMap( + connected_to=ppib_name_to_addr["PPIB134"], + channel_map=range(0, 8), + ), + dppics["DPPIC134"]: FixedPPIMap( + connected_to=ppib_name_to_addr["PPIB135"], + channel_map=range(0, 8), + ), + dppics["DPPIC135"]: FixedPPIMap( + connected_to=ppib_name_to_addr["PPIB136"], + channel_map=range(0, 8), + ), + dppics["DPPIC136"]: FixedPPIMap( + connected_to=ppib_name_to_addr["PPIB137"], + channel_map=range(0, 8), + ), + } + ppib_to_ppib_connections = { + ppib_name_to_addr["PPIB132"]: FixedPPIMap( + connected_to=ppib_name_to_addr["PPIB130"], + channel_map=range(0, 8), + ), + ppib_name_to_addr["PPIB133"]: FixedPPIMap( + connected_to=ppib_name_to_addr["PPIB130"], + channel_map=range(8, 16), + ), + ppib_name_to_addr["PPIB134"]: FixedPPIMap( + connected_to=ppib_name_to_addr["PPIB130"], + channel_map=range(16, 24), + ), + ppib_name_to_addr["PPIB135"]: FixedPPIMap( + connected_to=ppib_name_to_addr["PPIB130"], + channel_map=range(24, 32), + ), + ppib_name_to_addr["PPIB136"]: FixedPPIMap( + connected_to=ppib_name_to_addr["PPIB131"], + channel_map=range(0, 8), + ), + ppib_name_to_addr["PPIB137"]: FixedPPIMap( + connected_to=ppib_name_to_addr["PPIB131"], + channel_map=range(8, 16), + ), + ppib_name_to_addr["PPIB121"]: FixedPPIMap( + connected_to=ppib_name_to_addr["PPIB131"], + channel_map=range(16, 24), + ), + } + return SocLookupTables( + ctrlsel_lookup=ctrlsel_lookup, + adc_channel_pin_lookup=adc_channel_pin_lookup, + comp_channel_pin_lookup=comp_channel_pin_lookup, + dppic_to_ppib_connections=dppic_to_ppib_connections, + ppib_to_ppib_connections=ppib_to_ppib_connections, + spu_instances=spu_instances, + ppib_instances=ppib_instances, + ) + + +if __name__ == "__main__": + main() diff --git a/soc/nordic/common/uicr/gen_uicr.py b/soc/nordic/common/uicr/gen_uicr.py index 78422e4312cd..ce69cd7e80a3 100644 --- a/soc/nordic/common/uicr/gen_uicr.py +++ b/soc/nordic/common/uicr/gen_uicr.py @@ -426,6 +426,7 @@ def main() -> None: def extract_and_combine_periphconfs(elf_files: list[argparse.FileType]) -> bytes: combined_periphconf = [] + ipcmap_index = 0 for in_file in elf_files: elf = ELFFile(in_file) @@ -436,6 +437,7 @@ def extract_and_combine_periphconfs(elf_files: list[argparse.FileType]) -> bytes conf_section_data = conf_section.data() num_entries = len(conf_section_data) // PERIPHCONF_ENTRY_SIZE periphconf = (PeriphconfEntry * num_entries).from_buffer_copy(conf_section_data) + ipcmap_index = adjust_ipcmap_entries(periphconf, offset_index=ipcmap_index) combined_periphconf.extend(periphconf) combined_periphconf.sort(key=lambda e: e.regptr) @@ -459,5 +461,36 @@ def extract_and_combine_periphconfs(elf_files: list[argparse.FileType]) -> bytes return bytes(final_periphconf) +# This workaround is currently needed to avoid conflicts in IPCMAP whenever more than +# one image uses IPCMAP, because at the moment each image has no way of knowing which +# IPCMAP channel indices it should use for the configuration it generates locally. +# +# What the workaround does is adjust all IPCMAP entries found in the periphconf by the +# given index offset. +# +# The workaround assumes that IPCMAP entries are allocated sequentially starting from 0 +# in each image, it will probably not work for arbitrary IPCMAP entries. +def adjust_ipcmap_entries(periphconf: c.Array[PeriphconfEntry], offset_index: int) -> int: + max_ipcmap_index = offset_index + + for entry in sorted(periphconf, key=lambda e: e.regptr): + if IPCMAP_CHANNEL_START_ADDR <= entry.regptr < IPCMAP_CHANNEL_END_ADDR: + entry.regptr += offset_index * IPCMAP_CHANNEL_SIZE + entry_ipcmap_index = (entry.regptr - IPCMAP_CHANNEL_START_ADDR) // IPCMAP_CHANNEL_SIZE + max_ipcmap_index = max(max_ipcmap_index, entry_ipcmap_index) + + return max_ipcmap_index + 1 + + +# Size of each IPCMAP.CHANNEL[i] +IPCMAP_CHANNEL_SIZE = 8 +# Number of entries in IPCMAP.CHANNEL +IPCMAP_CHANNEL_COUNT = 16 +# Address of IPCMAP.CHANNEL[0] +IPCMAP_CHANNEL_START_ADDR = 0x5F92_3000 + 256 * 4 +# Address of IPCMAP.CHANNEL[channel count] + 1 +IPCMAP_CHANNEL_END_ADDR = IPCMAP_CHANNEL_START_ADDR + IPCMAP_CHANNEL_SIZE * IPCMAP_CHANNEL_COUNT + + if __name__ == "__main__": main() diff --git a/soc/nordic/common/uicr/periphconf/__init__.py b/soc/nordic/common/uicr/periphconf/__init__.py new file mode 100644 index 000000000000..fe8f6fbacece --- /dev/null +++ b/soc/nordic/common/uicr/periphconf/__init__.py @@ -0,0 +1,6 @@ +""" +Copyright (c) 2025 Nordic Semiconductor ASA +SPDX-License-Identifier: Apache-2.0 +""" + +# empty diff --git a/soc/nordic/common/uicr/periphconf/builder.py b/soc/nordic/common/uicr/periphconf/builder.py new file mode 100644 index 000000000000..98c2bdfb0a0a --- /dev/null +++ b/soc/nordic/common/uicr/periphconf/builder.py @@ -0,0 +1,1460 @@ +""" +Copyright (c) 2025 Nordic Semiconductor ASA +SPDX-License-Identifier: Apache-2.0 +""" + +from __future__ import annotations + +import enum +import logging +import re +from collections.abc import Iterable, Iterator, Mapping +from dataclasses import dataclass +from functools import cached_property +from itertools import islice +from typing import ( + Any, + Literal, + NamedTuple, +) + +# edtlib classes used in this module. +# Defined this way as placeholders so type checking for these could be added later. +EDT = Any +Node = Any +PinCtrl = Any +Property = Any + +# Status values that indicate ownership either by the processor or a child processor +STATUS_OWNED = ("okay", "reserved") + +# Compatibles of global peripherals that should not be assigned to current core. +SKIP_SPU_PERIPH_PERM_COMPATS = { + "nordic,nrf-bellboard-tx", + "nordic,nrf-bellboard-rx", + "nordic,nrf-clic", + "nordic,nrf-dppic-global", + "nordic,nrf-gpio", + "nordic,nrf-gpiote", + "nordic,nrf-grtc", + "nordic,nrf-ipct-global", + "nordic,nrf-temp", + "nordic,nrf-vevif-task-tx", + "nordic,nrf-vevif-task-rx", +} + +# Compatibles of global peripherals that should be assigned to the current core but do not have DMA +NO_DMA_COMPATS = { + "nordic,nrf-auxpll", + "nordic,nrf-comp", + "nordic,nrf-egu", + "nordic,nrf-exmif", + "nordic,nrf-lpcomp", + "nordic,nrf-qdec", + "nordic,nrf-timer", + "nordic,nrf-rtc", + "nordic,nrf-wdt", + # VPRs have a PERM DMASEC setting, but PPR applications currently do not work as intended when + # setting it to secure. + "nordic,nrf-vpr-coprocessor", +} + + +class BuilderError(RuntimeError): + """Generic runtime error raised by the PeriphconfBuilder""" + + ... + + +class BadDevicetreeError(BuilderError): + """Error raised when the devicetree is misconfigured + or if assumptions about the devicetree are not met. + """ + + ... + + +def _init_logger() -> logging.Logger: + formatter = logging.Formatter("{message}", style="{") + handler = logging.StreamHandler() + handler.setFormatter(formatter) + + logger = logging.getLogger("periphconf") + logger.setLevel(logging.ERROR) + logger.addHandler(handler) + + return logger + + +# Logger for the script +log = _init_logger() + + +class PeriphconfBuilder: + def __init__( + self, + dt: EDT, + lookup_tables: SocLookupTables, + ) -> None: + """Builder class used to generate a PERIPHCONF C source file based on the devicetree. + + :param dt: Devicetree object. + :param lookup_tables: Lookup table object containing soc-specific information. + """ + + self._dt = dt + self._hw_tables = lookup_tables + self._processor_id = dt_processor_id(dt) + self._owner_id = self._processor_id.default_owner_id + + self._macros = [] + self._ipcmap_idx = 0 + self._generated_ipcmaps = set() + + self._nodelabel_lookup = { + dt_reg_addr(node): node.labels[0] for node in dt.nodes if node.regs and node.labels + } + + def build_generated_source(self, header_line: str | None = None) -> str: + """Generate a C source file containing all the macros generated through + calls to the API. + """ + source_lines = [] + + if header_line: + source_lines.extend([f"/* {header_line} */", ""]) + + source_lines.extend( + [ + "#include ", + "#include ", + "", + ] + ) + + for macro in sorted(self._macros): + source_lines.append(macro.c_render(self._nodelabel_lookup)) + + return "\n".join(source_lines) + + def add_local_peripheral_cfg( + self, + node_or_nodelabel: Node | str, + /, + ) -> None: + """Generate macros for populating PERIPHCONF based on the properties of a local domain + devicetree node. + + :param node_or_nodelabel: node or label of the node to process. + """ + self._add_peripheral_cfg(node_or_nodelabel, is_global=False, add_gpios=False) + + def add_global_peripheral_cfg( + self, + node_or_nodelabel: Node | str, + /, + *, + has_irq_mapping: bool = True, + add_ppib_channel_links: bool = True, + ) -> None: + """Generate macros for populating PERIPHCONF based on the properties of the given + devicetree node located in a global domain. + + :param node_or_nodelabel: node or label of the node to process. + :param has_irq_mapping: configure IRQMAP to map the peripheral IRQs to the processor the + devicetree belongs to, if interrupts are specified on the node. + :param add_ppib_channel_links: add PPIB connections based on the channel link properties of + the node. + """ + self._add_peripheral_cfg( + node_or_nodelabel, + is_global=True, + has_irq_mapping=has_irq_mapping, + add_ppib_channel_links=add_ppib_channel_links, + ) + + def _add_peripheral_cfg( + self, + node_or_nodelabel: Node | str, + is_global: bool = True, + has_irq_mapping: bool = True, + add_ppib_channel_links: bool = True, + add_gpios: bool = True, + ) -> None: + if isinstance(node_or_nodelabel, str): + node = self._dt.label2node[node_or_nodelabel] + else: + node = node_or_nodelabel + + if node.status not in STATUS_OWNED: + return + + if is_global: + has_skip_spu_periph_perm_compat = any( + compat in SKIP_SPU_PERIPH_PERM_COMPATS for compat in node.compats + ) + if not has_skip_spu_periph_perm_compat: + has_no_dma_compat = any(compat in NO_DMA_COMPATS for compat in node.compats) + self._add_global_peripheral_spu_permissions(node, has_dma=not has_no_dma_compat) + if has_irq_mapping: + self._add_global_peripheral_irq_mapping(node) + + if "nordic,nrf-gpiote" in node.compats: + self._add_nrf_gpiote_spu_permissions(node) + + if "nordic,nrf-dppic-global" in node.compats: + self._add_nrf_dppic_spu_permissions(node) + if add_ppib_channel_links: + self._add_nrf_dppic_ppib_links(node) + + if "nordic,nrf-ipct-global" in node.compats: + self._add_nrf_ipct_global_spu_permissions(node) + self._add_nrf_ipct_ipcmap_channel_links(node) + + if "nordic,nrf-grtc" in node.compats: + self._add_nrf_grtc_spu_permissions(node) + + if "nordic,nrf-saadc" in node.compats: + self._add_nrf_saadc_channel_pin_spu_permissions(node) + + if "nordic,nrf-comp" in node.compats or "nordic,nrf-lpcomp" in node.compats: + self._add_nrf_comp_lpcomp_channel_pin_spu_permissions(node) + + self._add_peripheral_pinctrls_spu_permissions_and_ctrlsel(node) + + if "nordic,nrf-ipct-local" in node.compats: + self._add_nrf_ipct_ipcmap_channel_links(node) + + if add_gpios: + self._add_peripheral_gpios_spu_permissions_and_ctrlsel(node) + + def add_gpio_spu_permissions(self, node_or_nodelabel: Node | str, /) -> None: + """Generate macros for populating SPU FEATURE.GPIO[n].PIN[m] registers based on + gpios properties on the given devicetree node. + + CTRLSEL is not set for these properties; it is assumed that the default CTRLSEL + value (GPIO) is the correct CTRLSEL for these pins. + + :param node_or_nodelabel: node or label of the node to process. + """ + if isinstance(node_or_nodelabel, str): + node = self._dt.label2node[node_or_nodelabel] + else: + node = node_or_nodelabel + + if node.status not in STATUS_OWNED: + return + + self._add_peripheral_gpios_spu_permissions_and_ctrlsel(node, skip_ctrlsel=True) + + def _add_global_peripheral_spu_permissions( + self, + node: Node, + has_dma: bool = True, + ) -> None: + """Adds an SPU PERIPH[n].PERM entry for the peripheral described by the node.""" + addr = dt_reg_addr(node) + secure = dt_node_is_secure(node) + if has_dma: + dma_secure = secure + else: + # If there is no DMA then the DMASEC field is not writable and reads as zero. + # Set to zero to avoid readback errors. + dma_secure = False + periph_label = node.labels[0] + + spu_address = get_spu_addr_for_periph(addr) + spu_name = self._hw_tables.spu_addr_to_name[spu_address] + parsed_addr = Address(addr) + periph_slave_index = parsed_addr.slave_index + + self._macros.append( + MacroCall( + "UICR_SPU_PERIPH_PERM_SET", + [ + Address(spu_address), + periph_slave_index, + secure, + dma_secure, + self._owner_id.c_enum, + ], + comment=f"{spu_name}: {periph_label} permissions", + ) + ) + + def _add_global_peripheral_irq_mapping(self, node: Node) -> None: + """Adds an IRQMAP[n].SINK entry for each interrupt on the + peripheral described by the node. + """ + periph_identifier = dt_node_identifier(node) + get_irqn_from_dt = bool(node.labels) + + for i, interrupt in enumerate(node.interrupts): + interrupt_processors = set() + interrupt_ctrl = interrupt.controller + + interrupt_processors.update(dt_node_processors_from_labels(interrupt_ctrl)) + + if not interrupt_processors: + interrupt_processors.update(dt_node_processors_from_labels(node)) + + if not interrupt_processors: + raise BuilderError( + f"No unique processor ID could be found based on interrupt controllers " + f"or nodelabels for peripheral node {node.path}" + ) + if len(interrupt_processors) > 1: + raise BuilderError( + f"Peripheral node {node.path} corresponds to multiple processors " + f"({interrupt_processors}), which is not supported." + ) + + irq_processor = next(iter(interrupt_processors)) + + if get_irqn_from_dt: + macro_irqn = f"DT_IRQN_BY_IDX(DT_NODELABEL({node.labels[0]}), {i})" + else: + macro_irqn = str(interrupt.data["irq"]) + + self._macros.append( + MacroCall( + "UICR_IRQMAP_IRQ_SINK_SET", + [ + macro_irqn, + irq_processor.c_enum, + ], + comment=f"{periph_identifier} IRQ => {irq_processor.name}", + ) + ) + + def _add_nrf_gpiote_spu_permissions(self, node: Node) -> None: + """Adds SPU FEATURE.GPIOTE[n].CH[m] entries for configured channels on the + GPIOTE peripheral described by the node. + """ + addr = dt_reg_addr(node) + instance_name = dt_node_identifier(node) + spu_address = get_spu_addr_for_periph(addr) + spu_name = self._hw_tables.spu_addr_to_name[spu_address] + + for num, secure in dt_split_channels_get(node): + self._macros.append( + MacroCall( + "UICR_SPU_FEATURE_GPIOTE_CH_SET", + [ + Address(spu_address), + 0, + num, + secure, + self._owner_id.c_enum, + ], + comment=f"{spu_name}: {instance_name} ch. {num} permissions", + ) + ) + + def _add_nrf_dppic_spu_permissions(self, node: Node) -> None: + """Adds SPU FEATURE.DPPIC[n].CH[m] and SPU FEATURE.DPPIC[n].CHG[m] entries for + configured channels and channel groups on the DPPIC peripheral described by the node. + """ + addr = dt_reg_addr(node) + channels = dt_split_channels_get(node) + channel_groups = dt_split_channels_get( + node, + owned_name="owned-channel-groups", + nonsecure_name="nonsecure-channel-groups", + ) + + instance_name = dt_node_identifier(node) + spu_address = get_spu_addr_for_periph(addr) + spu_name = self._hw_tables.spu_addr_to_name[spu_address] + + for num, secure in channels: + self._macros.append( + MacroCall( + "UICR_SPU_FEATURE_DPPIC_CH_SET", + [ + Address(spu_address), + num, + secure, + self._owner_id.c_enum, + ], + comment=f"{spu_name}: {instance_name} ch. {num} permissions", + ) + ) + + for num, secure in channel_groups: + self._macros.append( + MacroCall( + "UICR_SPU_FEATURE_DPPIC_CHG_SET", + [ + Address(spu_address), + num, + secure, + self._owner_id.c_enum, + ], + comment=f"{spu_name}: {instance_name} ch. group {num} permissions", + ) + ) + + def _add_nrf_dppic_ppib_links(self, node: Node) -> None: + """Adds PPIB SUBSCRIBE_SEND[n] and PPIB PUBLISH_RECEIVE[n] entries for + configured "source" and "sink" channels on the DPPIC peripheral described by the node. + """ + addr = dt_reg_addr(node, secure=True) + source_channels = dt_array_prop(node, "source-channels", []) + sink_channels = dt_array_prop(node, "sink-channels", []) + + for num in source_channels: + self._link_dppi_channels(addr, num, direction="source") + + for num in sink_channels: + self._link_dppi_channels(addr, num, direction="sink") + + def _link_dppi_channels( + self, + dppic_addr: int, + channel_num: int, + direction: Literal["source"] | Literal["sink"], + ) -> None: + local_ppib_addr, local_ppib_ch_map = self._hw_tables.dppic_to_ppib_connections[dppic_addr] + local_ppib_ch = local_ppib_ch_map[channel_num] + + remote_ppib_addr, remote_ppib_ch_map = self._hw_tables.ppib_to_ppib_connections[ + local_ppib_addr + ] + remote_ppib_ch = remote_ppib_ch_map[local_ppib_ch] + + if direction == "source": + sub_ppib_addr, sub_ppib_ch = local_ppib_addr, local_ppib_ch + pub_ppib_addr, pub_ppib_ch = remote_ppib_addr, remote_ppib_ch + else: + sub_ppib_addr, sub_ppib_ch = remote_ppib_addr, remote_ppib_ch + pub_ppib_addr, pub_ppib_ch = local_ppib_addr, local_ppib_ch + + sub_ppib_name = self._hw_tables.ppib_addr_to_name[sub_ppib_addr] + pub_ppib_name = self._hw_tables.ppib_addr_to_name[pub_ppib_addr] + + self._macros.append( + MacroCall( + "UICR_PPIB_SUBSCRIBE_SEND_ENABLE", + [ + Address(sub_ppib_addr), + sub_ppib_ch, + ], + comment=( + f"SUB: {sub_ppib_name} ch. {sub_ppib_ch} => {pub_ppib_name} ch. {pub_ppib_ch}" + ), + ) + ) + self._macros.append( + MacroCall( + "UICR_PPIB_PUBLISH_RECEIVE_ENABLE", + [ + Address(pub_ppib_addr), + pub_ppib_ch, + ], + comment=( + f"PUB: {sub_ppib_name} ch. {sub_ppib_ch} => {pub_ppib_name} ch. {pub_ppib_ch}" + ), + ) + ) + + def _add_nrf_ipct_global_spu_permissions(self, node: Node) -> None: + """Adds SPU FEATURE.IPCT[n].CH[m] entries for configured channels + on the IPCT peripheral described by the node. + """ + addr = dt_reg_addr(node) + instance_name = dt_node_identifier(node) + spu_address = get_spu_addr_for_periph(addr) + spu_name = self._hw_tables.spu_addr_to_name[spu_address] + + for num, secure in dt_split_channels_get(node): + self._macros.append( + MacroCall( + "UICR_SPU_FEATURE_IPCT_CH_SET", + [ + Address(spu_address), + num, + secure, + self._owner_id.c_enum, + ], + comment=f"{spu_name}: {instance_name} ch. {num} permissions", + ) + ) + + def _add_nrf_ipct_ipcmap_channel_links(self, node: Node) -> None: + """Adds IPCMAP CHANNEL[n].SOURCE and CHANNEL[n].SINK entries for "sink" and "source" + channels on the IPCT peripheral described by the node. + """ + source_channel_links = dt_array_prop(node, "source-channel-links", []) + if len(source_channel_links) % 3 != 0: + raise BadDevicetreeError() + + sink_channel_links = dt_array_prop(node, "sink-channel-links", []) + if len(sink_channel_links) % 3 != 0: + raise BadDevicetreeError() + + node_domain_raw = dt_prop(node, "global-domain-id", None) + if node_domain_raw is None: + addr = dt_reg_addr(node) + try: + node_domain = Address(addr).domain + except ValueError as e: + raise BadDevicetreeError( + f"Failed to determine domain ID for address 0x{addr:08x} " + f"specified on node {node.path}" + ) from e + else: + node_domain = DomainId(node_domain_raw) + + for source_ch, sink_domain_raw, sink_ch in batched(source_channel_links, 3): + sink_domain = DomainId(sink_domain_raw) + self._link_ipct_channel(node_domain, source_ch, sink_domain, sink_ch) + + for sink_ch, source_domain_raw, source_ch in batched(sink_channel_links, 3): + source_domain = DomainId(source_domain_raw) + self._link_ipct_channel(source_domain, source_ch, node_domain, sink_ch) + + def _link_ipct_channel( + self, + source_domain: DomainId, + source_ch: int, + sink_domain: DomainId, + sink_ch: int, + ) -> None: + # Setting "source-channel-links" on one end and "sink-channel-links" on the other + # leads to duplicated entries without this check. + link_args = ( + source_domain.c_enum, + source_ch, + sink_domain.c_enum, + sink_ch, + ) + if link_args in self._generated_ipcmaps: + log.debug(f"Skip duplicate IPCMAP entry: {link_args}") + return + self._generated_ipcmaps.add(link_args) + + self._macros.append( + MacroCall( + "UICR_IPCMAP_CHANNEL_CFG", + [self._ipcmap_idx, *link_args], + comment=( + f"{source_domain.name} IPCT ch. {source_ch} => " + f"{sink_domain.name} IPCT ch. {sink_ch}" + ), + ) + ) + self._ipcmap_idx += 1 + + def _add_nrf_grtc_spu_permissions(self, node: Node) -> None: + """Adds SPU FEATURE.GRTC[n].CC[m] entries for configured channels + on the GRTC peripheral described by the node. + """ + grtc_addr = dt_reg_addr(node) + spu_address = get_spu_addr_for_periph(grtc_addr) + spu_name = self._hw_tables.spu_addr_to_name[spu_address] + + for num, secure in dt_split_channels_get(node): + self._macros.append( + MacroCall( + "UICR_SPU_FEATURE_GRTC_CC_SET", + [ + Address(spu_address), + num, + secure, + self._owner_id.c_enum, + ], + comment=f"{spu_name}: GRTC CC{num} permissions", + ) + ) + + def _add_peripheral_gpios_spu_permissions_and_ctrlsel( + self, + node: Node, + skip_ctrlsel: bool = False, + ) -> None: + """Adds SPU FEATURE.GPIO[n].PIN[m] and GPIO PIN_CNF[n] entries for + pins used in phandle-array properties called 'gpios' or ending in '-gpios' + found on the peripheral node. + """ + for name in node.props: + if not re.fullmatch(r"^(.+-)?gpios$", name): + continue + + if node.props[name].type != "phandle-array": + log.debug(f"skipping *-gpios prop {name} in {node.path} (not a phandle-array)") + continue + + for entry in dt_array_prop(node, name): + gpio_node = entry.controller + if "nordic,nrf-gpio" not in gpio_node.compats: + continue + + port = gpio_node.props["port"].val + num = entry.data["pin"] + secure = dt_node_is_secure(gpio_node) + if not skip_ctrlsel: + ctrlsel = self._hw_tables.lookup_ctrlsel_for_property( + node.props[name], (port, num) + ) + else: + ctrlsel = None + self._configure_gpio_pin(entry.controller, num, secure, ctrlsel) + + def _add_peripheral_pinctrls_spu_permissions_and_ctrlsel(self, node: Node) -> None: + """Adds SPU FEATURE.GPIO[n].PIN[m] and GPIO PIN_CNF[n] entries for + pins used in pinctrl properties referenced by the peripheral node. + """ + secure = dt_node_is_secure(node) + for pinctrl in node.pinctrls: + for config_node in pinctrl.conf_nodes: + for group_node in config_node.children.values(): + for i, psel_val in enumerate(dt_array_prop(group_node, "psels")): + psel = NrfPsel.from_raw(psel_val) + + if psel.is_disconnected(): + # Pin is unused and should be ignored + continue + + gpio_node = find_gpio_node_by_port( + node.edt, + psel.port, + err_suffix=f" (referenced by {group_node.path}:psels[{i}])", + ) + num = psel.pin + ctrlsel = self._hw_tables.lookup_ctrlsel_for_pinctrl(pinctrl, psel) + self._configure_gpio_pin(gpio_node, num, secure, ctrlsel) + + def _add_nrf_saadc_channel_pin_spu_permissions(self, node: Node) -> None: + """Adds SPU FEATURE.GPIO[n].PIN[m] and GPIO PIN_CNF[n] entries for + pins corresponding to the channel properties on the ADC peripheral node. + """ + saadc_addr = dt_reg_addr(node, secure=True) + if saadc_addr not in self._hw_tables.adc_channel_pin_lookup: + return + + channel_pins = self._hw_tables.adc_channel_pin_lookup[saadc_addr] + secure = dt_node_is_secure(node) + + for name, child in node.children.items(): + if not name.startswith("channel"): + continue + + for prop_name in ["zephyr,input-positive", "zephyr,input-negative"]: + prop_val = dt_prop(child, prop_name, None) + if prop_val in channel_pins: + port, num = channel_pins[prop_val] + gpio_node = find_gpio_node_by_port(node.edt, port) + self._configure_gpio_pin(gpio_node, num, secure, CTRLSEL_DEFAULT) + + def _add_nrf_comp_lpcomp_channel_pin_spu_permissions(self, node: Node) -> None: + """Adds SPU FEATURE.GPIO[n].PIN[m] and GPIO PIN_CNF[n] entries for + pins corresponding to the channel properties on the COMP/LPCOMP peripheral node. + """ + comp_addr = dt_reg_addr(node, secure=True) + if comp_addr not in self._hw_tables.comp_channel_pin_lookup: + return + + channel_pins = self._hw_tables.comp_channel_pin_lookup[comp_addr] + secure = dt_node_is_secure(node) + + for prop_name in ["psel", "extrefsel"]: + prop_val = dt_prop(node, prop_name, None) + if prop_val in channel_pins: + port, num = channel_pins[prop_val] + gpio_node = find_gpio_node_by_port(node.edt, port) + self._configure_gpio_pin(gpio_node, num, secure, CTRLSEL_DEFAULT) + + def _configure_gpio_pin( + self, + gpio_node: Node, + num: int, + secure: bool, + ctrlsel: int | None, + ) -> None: + gpio_addr = dt_reg_addr(gpio_node) + gpio_port = dt_prop(gpio_node, "port") + spu_address = get_spu_addr_for_periph(gpio_addr) + spu_name = self._hw_tables.spu_addr_to_name[spu_address] + + self._macros.append( + MacroCall( + "UICR_SPU_FEATURE_GPIO_PIN_SET", + [ + Address(spu_address), + gpio_port, + num, + secure, + self._owner_id.c_enum, + ], + comment=f"{spu_name}: P{gpio_port}.{num} permissions", + ) + ) + + if ctrlsel is not None: + ctrlsel_int = int(ctrlsel) + self._macros.append( + MacroCall( + "UICR_GPIO_PIN_CNF_CTRLSEL_SET", + [ + Address(gpio_addr), + num, + ctrlsel_int, + ], + comment=f"P{gpio_port}.{num} CTRLSEL = {ctrlsel_int}", + ) + ) + + +def find_gpio_node_by_port(dt: EDT, port: int, err_suffix: str = "") -> Node: + """Find the GPIO node in the devicetree with the given port.""" + for gpio_node in dt.compat2nodes["nordic,nrf-gpio"]: + if gpio_node.props["port"].val == port: + return gpio_node + raise BadDevicetreeError(f"Failed to find Nordic GPIO node with port {port}{err_suffix}") + + +@dataclass(order=True) +class MacroCall: + name: str + args: list + comment: str | None = None + + def c_render(self, nodelabel_lookup: dict[int, str]) -> str: + """Render the macro as C code""" + str_args = [] + for arg in self.args: + if isinstance(arg, Address): + if int(arg) in nodelabel_lookup: + str_args.append(c_dt_reg_addr_by_label(nodelabel_lookup[int(arg)])) + else: + str_args.append(c_hex_addr(int(arg))) + elif isinstance(arg, bool): + str_args.append(c_bool(arg)) + elif hasattr(arg, "c_enum"): + str_args.append(arg.c_enum) + else: + str_args.append(str(arg)) + + comment = f"/* {self.comment} */\n" if self.comment else "" + return f"{comment}{self.name}({', '.join(str_args)});" + + +def c_hex_addr(address: int) -> str: + """Format address as a C 32-bit hex literal.""" + return f"0x{address:08x}UL" + + +def c_bool(value: bool) -> str: + """Format value as a C bool literal.""" + return "true" if value else "false" + + +def c_dt_reg_addr_by_label(nodelabel: str) -> str: + """Format a peripheral address using devicetree macros to get the address based on node label""" + return f"DT_REG_ADDR(DT_NODELABEL({nodelabel}))" + + +# Equivalent to itertools.batched(), using the recipe provided in the docs. +def batched(iterable: Iterable, n: int, *, strict: bool = False) -> Iterator: + if n < 1: + raise ValueError("n must be at least one") + iterator = iter(iterable) + while batch := tuple(islice(iterator, n)): + if strict and len(batch) != n: + raise ValueError("batched(): incomplete batch") + yield batch + + +# Sentinel used to represent no provided default value in the functions below +class NoDefault: ... + + +NO_DEFAULT = NoDefault + + +def dt_reg_addr( + node: Node, + index: int = 0, + secure: bool = False, + default: int | type[NoDefault] = NO_DEFAULT, +) -> int: + """Get a register address and property identifier for a node.""" + try: + addr = node.regs[index].addr + except IndexError: + if isinstance(default, int): + addr = default + else: + raise + if secure: + return int(Address(addr).as_secure()) + return addr + + +def dt_reg_size(node: Node, index: int = 0) -> int: + """Get a register size and property identifier for a node.""" + return node.regs[index].size + + +def dt_prop(node: Node, name: str, default: Any = NO_DEFAULT) -> Any: + """Get the property value and identfier of a property. + Optionally returns a default value. + """ + try: + prop = node.props[name] + except KeyError: + if default != NO_DEFAULT: + return default + raise + + return prop.val + + +def dt_node_identifier(node: Node, default_to_path: bool = True) -> str: + """Get a string that identifies the node. + Returns the first nodelabel if it exists, otherwise defaults to the node path. + If default_to_path is False, exits with an error instead of defaulting. + """ + if node.labels: + return node.labels[0] + elif default_to_path: + return node.path + raise BuilderError(f"Expected a nodelabel on {node}, but the node has no label") + + +def dt_array_prop( + node: Node, + name: str, + default: list[Any] | type[NO_DEFAULT] = NO_DEFAULT, +) -> list[Any]: + """Get the member values and identifiers of an array property. + Optionally returns a default value. + """ + try: + prop = node.props[name] + except KeyError: + if not isinstance(default, type): + return list(default) + raise + + return list(prop.val) + + +def dt_node_processors_from_labels(node: Node) -> list[ProcessorId]: + """Deduce a processor ID from a list of devicetree nodelabels.""" + substring_processor = {cpu.zephyr_name: cpu for cpu in ProcessorId.__members__.values()} + processors = set() + for substring, processor_id in substring_processor.items(): + if any(substring in label for label in node.labels): + processors.add(processor_id) + return list(processors) + + +def dt_split_channels_get( + node: Node, + owned_name: str = "owned-channels", + nonsecure_name: str = "nonsecure-channels", +) -> list[tuple[int, bool]]: + """Parse 'split channels' properties.""" + owned = [] + owned.extend(dt_array_prop(node, owned_name, default=[])) + owned.extend(dt_array_prop(node, f"child-{owned_name}", default=[])) + + sec_lookup = {} + if nonsecure_name in node.props: + nonsecure = dt_array_prop(node, nonsecure_name) + sec_lookup.update(dict.fromkeys(nonsecure, False)) + + default_sec = dt_node_is_secure(node) + channels = [] + for ch in owned: + sec = sec_lookup.setdefault(ch, default_sec) + channels.append((ch, sec)) + + return channels + + +def dt_node_is_secure(node: Node) -> bool: + if node.bus_node is not None and node.bus_node.regs: + addr = dt_reg_addr(node.bus_node) + elif node.regs: + addr = dt_reg_addr(node) + else: + raise ValueError( + f"Failed to determine security of {node.path} " + "from the address of its bus node or itself" + ) + return Address(addr).security + + +def dt_processor_id(devicetree: EDT) -> ProcessorId: + """Get processor information from a domain's devicetree.""" + cpus = [ + node + for node in devicetree.get_node("/cpus").children.values() + if node.name.startswith("cpu@") + ] + if len(cpus) != 1: + raise RuntimeError( + f"Expected exactly 1 'cpu' node, but devicetree contained {len(cpus)} nodes" + ) + + try: + return ProcessorId(cpus[0].regs[0].addr) + except Exception as e: + raise RuntimeError( + f"Devicetree 'cpu' node has invalid Processor ID {cpus[0].regs[0].addr}" + ) from e + + +@dataclass(frozen=True) +class NrfPsel: + """Decoded NRF_PSEL values.""" + + fun: NrfFun + port: int + pin: int + + @classmethod + def from_raw(cls, psel_value: int) -> NrfPsel: + """Decode a raw NRF_PSEL encoded int value to its individual parts.""" + port, pin = divmod(psel_value & (~NRF_PSEL_FUN_MASK), NRF_PSEL_GPIO_PIN_COUNT) + fun = (psel_value & NRF_PSEL_FUN_MASK) >> NRF_PSEL_FUN_POS + return NrfPsel(fun=NrfFun(fun), port=port, pin=pin) + + def is_disconnected(self) -> bool: + """True if the value represents a disconnected pin""" + return (self.port * NRF_PSEL_GPIO_PIN_COUNT + self.pin) == NRF_PSEL_PIN_MASK + + +# # Bit position of the function bits in the pinctrl pin value encoded from NRF_PSEL() +NRF_PSEL_FUN_POS = 24 +# # Mask for the function bits in the pinctrl pin value encoded from NRF_PSEL() +NRF_PSEL_FUN_MASK = 0xFF << NRF_PSEL_FUN_POS +# Number of pins per port used in NRF_PSEL() +NRF_PSEL_GPIO_PIN_COUNT = 32 +# Mask for the port, pin bits in the pinctrl pin value encoded from NRF_PSEL() +NRF_PSEL_PIN_MASK = 0x1FF + + +@dataclass(frozen=True) +class GpiosProp: + """CTRLSEL lookup table entry for special *-gpios properties used in some peripheral + bindings, which are in some cases used instead of pinctrl. + """ + + name: str + port: int + pin: int + + +@enum.unique +class Ctrlsel(int, enum.Enum): + """ + Enumeration of GPIO.PIN_CNF[n].CTRLSEL values. + The list here may not be exhaustive. + """ + + GPIO = 0 + VPR_GRC = 1 + CAN_PWM_I3C = 2 + SERIAL0 = 3 + EXMIF_RADIO_SERIAL1 = 4 + CAN_TDM_SERIAL2 = 5 + CAN = 6 + TND = 7 + + +# Default CTRLSEL value indicating that CTRLSEL should not be used +CTRLSEL_DEFAULT = Ctrlsel.GPIO + + +class NrfFun(int, enum.Enum): + """Pin functions used with pinctrl, see include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h + Only the functions relevant for CTRLSEL deduction have been included. + """ + + UART_TX = 0 + UART_RX = 1 + UART_RTS = 2 + UART_CTS = 3 + SPIM_SCK = 4 + SPIM_MOSI = 5 + SPIM_MISO = 6 + SPIS_SCK = 7 + SPIS_MOSI = 8 + SPIS_MISO = 9 + SPIS_CSN = 10 + TWIM_SCL = 11 + TWIM_SDA = 12 + PWM_OUT0 = 22 + PWM_OUT1 = 23 + PWM_OUT2 = 24 + PWM_OUT3 = 25 + EXMIF_CK = 35 + EXMIF_DQ0 = 36 + EXMIF_DQ1 = 37 + EXMIF_DQ2 = 38 + EXMIF_DQ3 = 39 + EXMIF_DQ4 = 40 + EXMIF_DQ5 = 41 + EXMIF_DQ6 = 42 + EXMIF_DQ7 = 43 + EXMIF_CS0 = 44 + EXMIF_CS1 = 45 + CAN_TX = 46 + CAN_RX = 47 + TWIS_SCL = 48 + TWIS_SDA = 49 + EXMIF_RWDS = 50 + GRTC_CLKOUT_FAST = 55 + GRTC_CLKOUT_32K = 56 + TDM_SCK_M = 71 + TDM_SCK_S = 72 + TDM_FSYNC_M = 73 + TDM_FSYNC_S = 74 + TDM_SDIN = 75 + TDM_SDOUT = 76 + TDM_MCK = 77 + + # Value used to ignore the function field and only check (port, pin) + IGNORE = -1 + # Fallback for unknown NrfFun values, assumes that pin CTRLSEL should be set to GPIO + ASSUMED_GPIO = -2 + + @classmethod + def _missing_(cls, value: Any) -> NrfFun: + return cls.ASSUMED_GPIO + + +class NrfSaadcChannel(int, enum.Enum): + """Identifiers representing SAADC channels. + See include/zephyr/dt-bindings/adc/nrf-saadc-haltium.h. + """ + + AIN0 = 1 + AIN1 = 2 + AIN2 = 3 + AIN3 = 4 + AIN4 = 5 + AIN5 = 6 + AIN6 = 7 + AIN7 = 8 + AIN8 = 9 + AIN9 = 10 + AIN10 = 11 + AIN11 = 12 + AIN12 = 13 + AIN13 = 14 + + +class NrfCompChannel(str, enum.Enum): + """Identifiers representing COMP/LPCOMP channels. + See dts/bindings/comparator/nordic,nrf-comp.yaml. + """ + + AIN0 = "AIN0" + AIN1 = "AIN1" + AIN2 = "AIN2" + AIN3 = "AIN3" + AIN4 = "AIN4" + AIN5 = "AIN5" + AIN6 = "AIN6" + AIN7 = "AIN7" + AIN8 = "AIN8" + AIN9 = "AIN9" + + +class FixedPPIMap(NamedTuple): + """A DPPIC-PPIB or PPIB-PPIB channel mapping. + These connections are fixed in the hardware. + """ + + connected_to: int + channel_map: range + + +@dataclass +class SocLookupTables: + """Container for various hardware info needed to generate PERIPHCONF.""" + + ctrlsel_lookup: dict[int, dict[NrfPsel | GpiosProp, Ctrlsel]] + adc_channel_pin_lookup: dict[int, dict[NrfSaadcChannel, tuple[int, int]]] + comp_channel_pin_lookup: dict[int, dict[NrfCompChannel, tuple[int, int]]] + dppic_to_ppib_connections: dict[int, FixedPPIMap] + ppib_to_ppib_connections: dict[int, FixedPPIMap] + spu_instances: list[tuple[str, int]] + ppib_instances: list[tuple[str, int]] + + @cached_property + def spu_addr_to_name(self) -> Mapping[int, str]: + return {addr: name for name, addr in self.spu_instances} + + @cached_property + def ppib_addr_to_name(self) -> Mapping[int, str]: + return {addr: name for name, addr in self.ppib_instances} + + def lookup_ctrlsel_for_property(self, prop: Property, psel: tuple[int, int]) -> Ctrlsel | None: + """Find the appopriate CTRLSEL value for a given gpios property.""" + if not prop.node.regs: + # Only nodes with registers can be looked up + return None + + periph_addr = dt_reg_addr(prop.node, secure=True) + gpios_prop = GpiosProp(name=prop.name, port=psel[0], pin=psel[1]) + return self._lookup_ctrlsel(periph_addr, gpios_prop) + + def lookup_ctrlsel_for_pinctrl(self, prop: PinCtrl, psel: NrfPsel) -> Ctrlsel | None: + """Find the appopriate CTRLSEL value for a given pinctrl.""" + if psel.fun == NrfFun.ASSUMED_GPIO: + # We map unsupported values to GPIO CTRLSEL + return CTRLSEL_DEFAULT + + periph_addr = dt_reg_addr(prop.node, secure=True) + return self._lookup_ctrlsel(periph_addr, psel) + + def _lookup_ctrlsel( + self, + periph_addr: int, + prop_or_psel: NrfPsel | GpiosProp, + ) -> Ctrlsel | None: + ctrlsel = None + + if periph_addr in self.ctrlsel_lookup: + ident_lut = self.ctrlsel_lookup[periph_addr] + if prop_or_psel in ident_lut: + ctrlsel = ident_lut[prop_or_psel] + elif isinstance(prop_or_psel, NrfPsel): + # Check if this entry is enumerated with "ignored" function + sub_entry_no_fun = NrfPsel( + fun=NrfFun.IGNORE, port=prop_or_psel.port, pin=prop_or_psel.pin + ) + ctrlsel = ident_lut.get(sub_entry_no_fun, None) + + log.debug(f"periph_addr=0x{periph_addr:09_x}, {prop_or_psel=} -> {ctrlsel=}") + + return ctrlsel + + +def get_spu_addr_for_periph(periph_addr: int) -> int: + """Get the address of the SPU instance governing the permissions for the peripheral + at the given address. + """ + address = Address(periph_addr) + + # The common rule is that the SPU instance sits at the start of the address space for + # the bus of the peripheral. + address.security = True + address.slave_index = 0 + address.address_space = 0 + + # However, some buses are special due to having > 16 slaves and need special handling. + address.bus = SPU_ADDRESS_BUS_REMAPPING.get(address.bus, address.bus) + + return int(address) + + +SPU_ADDRESS_BUS_REMAPPING = { + # Both of these bus IDs represent APB32 and should use the same SPU instance with bus ID 146. + 147: 146, +} + + +@enum.unique +class DomainId(enum.IntEnum): + """Domain IDs.""" + + RESERVED = 0 + SECURE = 1 + APPLICATION = 2 + RADIOCORE = 3 + CELLCORE = 4 + GLOBALFAST = 12 + GLOBALSLOW = 13 + GLOBAL_ = 14 + GLOBAL = 15 + + @property + def c_enum(self) -> str: + return f"NRF_DOMAIN_{self.name.upper()}" + + +@enum.unique +class OwnerId(enum.IntEnum): + """Owner IDs.""" + + NONE = 0 + SECURE = 1 + APPLICATION = 2 + RADIOCORE = 3 + CELL = 4 + SYSCTRL = 8 + + @property + def c_enum(self) -> str: + return f"NRF_OWNER_{self.name.upper()}" + + +@enum.unique +class ProcessorId(enum.IntEnum): + """Processor IDs.""" + + SECURE = 1 + APPLICATION = 2 + RADIOCORE = 3 + CELLCORE = 4 + SYSCTRL = 12 + PPR = 13 + FLPR = 14 + + @property + def zephyr_name(self) -> str: + """Name used in zephyr to denote the processor with this ID.""" + match self: + case ProcessorId.SECURE: + return "cpusec" + case ProcessorId.APPLICATION: + return "cpuapp" + case ProcessorId.RADIOCORE: + return "cpurad" + case ProcessorId.CELLCORE: + return "cpucell" + case ProcessorId.SYSCTRL: + return "cpusys" + case ProcessorId.PPR: + return "cpuppr" + case ProcessorId.FLPR: + return "cpuflpr" + + @property + def default_owner_id(self) -> OwnerId: + """Default owner ID associated with this ID (the ID used by accesses from the processor).""" + match self: + case ProcessorId.SECURE: + return OwnerId.SECURE + case ProcessorId.APPLICATION: + return OwnerId.APPLICATION + case ProcessorId.RADIOCORE: + return OwnerId.RADIOCORE + case ProcessorId.CELLCORE: + return OwnerId.CELL + case ProcessorId.SYSCTRL: + return OwnerId.SYSCTRL + case ProcessorId.PPR: + return OwnerId.APPLICATION + case ProcessorId.FLPR: + return OwnerId.APPLICATION + + @property + def c_enum(self) -> str: + return f"NRF_PROCESSOR_{self.name.upper()}" + + +@enum.unique +class AddressRegion(enum.IntEnum): + """Address regions, defined by Address Format of the data sheet.""" + + PROGRAM = 0 + DATA = 1 + PERIPHERAL = 2 + EXT_XIP = 3 + EXT_XIP_ENCRYPTED = 4 + STM = 5 + CPU = 7 + + @classmethod + def from_address(cls, address: int) -> AddressRegion: + """Get the address region of an address.""" + return Address(address).region + + +# Regions that have domain ID and security fields +HAS_DOMAIN_SECURITY = [ + AddressRegion.PROGRAM, + AddressRegion.DATA, + AddressRegion.PERIPHERAL, + AddressRegion.STM, +] + +# Regions that have the peripheral address format +HAS_PERIPH_BITS = [ + AddressRegion.PERIPHERAL, + AddressRegion.STM, +] + + +class Address: + """Helper for working with addresses.""" + + def __init__(self, value: int | Address = 0) -> None: + self._val = int(value) + + def __repr__(self) -> str: + if self.region in HAS_DOMAIN_SECURITY: + domain_sec_str = ( + f", domain={self.domain.name} ({int(self.domain)}), security={self.security}" + ) + else: + domain_sec_str = "" + + if self.region in HAS_PERIPH_BITS: + periph_bits_str = ( + f", bus={self.bus} (0b{self.bus:09_b}), " + f"slave_index={self.slave_index} (0b{self.slave_index:09_b})" + ) + else: + periph_bits_str = "" + + field_str = ( + f"region={self.region.name} ({int(self.region)}){domain_sec_str}{periph_bits_str}, " + f"address_space=0x{self.address_space:_x}" + ) + + return f"{type(self).__name__}({field_str})" + + def __str__(self) -> str: + return repr(self) + + def as_secure(self) -> Address: + addr = Address(self) + addr.security = True + return addr + + @property + def region(self) -> AddressRegion: + """Address region.""" + return AddressRegion(get_field(self._val, ADDRESS_REGION_POS, ADDRESS_REGION_MASK)) + + @region.setter + def region(self, new: int) -> None: + self._val = update_field(self._val, new, ADDRESS_REGION_POS, ADDRESS_REGION_MASK) + + @property + def security(self) -> bool: + """Address security (only present in some regions).""" + self._check_has_security() + return bool(get_field(self._val, ADDRESS_SECURITY_POS, ADDRESS_SECURITY_MASK)) + + @security.setter + def security(self, new: bool) -> None: + self._check_has_security() + self._val = update_field(self._val, int(new), ADDRESS_SECURITY_POS, ADDRESS_SECURITY_MASK) + + def _check_has_security(self) -> None: + self._check_region_has_field(HAS_DOMAIN_SECURITY, "security bit") + + @property + def domain(self) -> DomainId: + """Address domain ID (only present in some regions).""" + self._check_has_domain_id() + return DomainId(get_field(self._val, ADDRESS_DOMAIN_POS, ADDRESS_DOMAIN_MASK)) + + @domain.setter + def domain(self, new: DomainId | int) -> None: + self._check_has_domain_id() + self._val = update_field(self._val, new, ADDRESS_DOMAIN_POS, ADDRESS_DOMAIN_MASK) + + def _check_has_domain_id(self) -> None: + self._check_region_has_field(HAS_DOMAIN_SECURITY, "domain ID") + + @property + def bus(self) -> int: + """Bus ID (only present in some regions).""" + self._check_has_bus() + return get_field(self._val, ADDRESS_BUS_POS, ADDRESS_BUS_MASK) + + @bus.setter + def bus(self, new: int) -> None: + self._check_has_bus() + self._val = update_field(self._val, new, ADDRESS_BUS_POS, ADDRESS_BUS_MASK) + + def _check_has_bus(self) -> None: + self._check_region_has_field(HAS_PERIPH_BITS, "Peripheral/APB bus number") + + @property + def slave_index(self) -> int: + """Slave index (only present in some regions).""" + self._check_has_slave_index() + return get_field(self._val, ADDRESS_SLAVE_POS, ADDRESS_SLAVE_MASK) + + @slave_index.setter + def slave_index(self, new: int) -> None: + self._check_has_slave_index() + self._val = update_field(self._val, new, ADDRESS_SLAVE_POS, ADDRESS_SLAVE_MASK) + + def _check_has_slave_index(self) -> None: + self._check_region_has_field(HAS_PERIPH_BITS, "Peripheral/APB slave index") + + @property + def address_space(self) -> int: + """Internal address space address (semantics depend on the region).""" + match self.region: + case AddressRegion.PROGRAM | AddressRegion.DATA: + return get_field(self._val, ADDRESS_SPACE_POS, ADDRESS_PROGRAM_DATA_SPACE_MASK) + case AddressRegion.PERIPHERAL | AddressRegion.STM: + return get_field(self._val, ADDRESS_SPACE_POS, ADDRESS_PERIPHERAL_SPACE_MASK) + case _: + return get_field(self._val, ADDRESS_SPACE_POS, ADDRESS_DEFAULT_SPACE_MASK) + + @address_space.setter + def address_space(self, new: int) -> None: + match self.region: + case AddressRegion.PROGRAM | AddressRegion.DATA: + self._val = update_field( + self._val, new, ADDRESS_SPACE_POS, ADDRESS_PROGRAM_DATA_SPACE_MASK + ) + case AddressRegion.PERIPHERAL | AddressRegion.STM: + self._val = update_field( + self._val, new, ADDRESS_SPACE_POS, ADDRESS_PERIPHERAL_SPACE_MASK + ) + case _: + self._val = update_field( + self._val, new, ADDRESS_SPACE_POS, ADDRESS_DEFAULT_SPACE_MASK + ) + + def _check_region_has_field(self, valid_regions: list[AddressRegion], field_name: str) -> None: + if self.region not in valid_regions: + raise ValueError(f"{field_name} is not defined for address region {self.region.name}") + + def __eq__(self, other) -> bool: + return int(self) == int(other) + + def __lt__(self, other: Address | int) -> bool: + return int(self) < int(other) + + def __int__(self) -> int: + return self._val + + +ADDRESS_REGION_POS = 29 +ADDRESS_REGION_MASK = 0x7 << ADDRESS_REGION_POS +ADDRESS_SECURITY_POS = 28 +ADDRESS_SECURITY_MASK = 0x1 << ADDRESS_SECURITY_POS +ADDRESS_DOMAIN_POS = 24 +ADDRESS_DOMAIN_MASK = 0xF << ADDRESS_DOMAIN_POS +ADDRESS_BUS_POS = 16 +ADDRESS_BUS_MASK = 0xFF << ADDRESS_BUS_POS +ADDRESS_SLAVE_POS = 12 +ADDRESS_SLAVE_MASK = 0xF << ADDRESS_SLAVE_POS +ADDRESS_PERIPHID_POS = 12 +ADDRESS_PERIPHID_MASK = 0x7FF << ADDRESS_PERIPHID_POS +ADDRESS_SPACE_POS = 0 +ADDRESS_PROGRAM_DATA_SPACE_MASK = 0xFF_FFFF +ADDRESS_PERIPHERAL_SPACE_MASK = 0xFFF +ADDRESS_DEFAULT_SPACE_MASK = 0x1FFF_FFFF + + +def peripheral_id_get(periph_address: int) -> int: + """Get the peripheral ID of a peripheral address.""" + return get_field(periph_address, ADDRESS_PERIPHID_POS, ADDRESS_PERIPHID_MASK) + + +def get_field(value: int, field_pos: int, field_mask: int) -> int: + """Get the value of a field in a bitfield.""" + return (value & field_mask) >> field_pos + + +def update_field(value: int, field_new: int, field_pos: int, field_mask: int) -> int: + """Update a field in a bitfield.""" + return (value & ~field_mask) | ((field_new << field_pos) & field_mask) From d792280a1c8639ac103ce0dd094f8d5dd4e5377d Mon Sep 17 00:00:00 2001 From: Jonathan Nilsen Date: Tue, 16 Sep 2025 16:25:22 +0200 Subject: [PATCH 1735/2141] [nrf fromlist] soc: nordic: uicr: print cmake warning when used without sysbuild Upstream PR #: 95915 Because generation and programming of UICR + PERIPHCONF artifacts depend on the 'uicr' image which in turn must be included by Sysbuild, many if not most nrf54h20 applications will need to be built using Sysbuild to function as intended. To make this known to the user, print a CMake warning whenever CONFIG_NRF_PERIPHCONF_SECTION=y but Sysbuild is not being used. Signed-off-by: Jonathan Nilsen --- soc/nordic/common/uicr/CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/soc/nordic/common/uicr/CMakeLists.txt b/soc/nordic/common/uicr/CMakeLists.txt index 9d5deec52d57..d350d8d3f586 100644 --- a/soc/nordic/common/uicr/CMakeLists.txt +++ b/soc/nordic/common/uicr/CMakeLists.txt @@ -20,3 +20,11 @@ if(CONFIG_NRF_PERIPHCONF_GENERATE_ENTRIES) zephyr_sources(${periphconf_entries_c_file}) message(STATUS "Generated ${periphconf_entries_c_file} from ${EDT_PICKLE}") endif() + +if(CONFIG_NRF_PERIPHCONF_SECTION AND NOT SYSBUILD) + message(WARNING "CONFIG_NRF_PERIPHCONF_SECTION is enabled, but Sysbuild is not being used. " + "The global peripheral configuration will not be applied unless artifacts " + "are generated manually/externally. To enable automatic generation, build with " + "Sysbuild and ensure that SB_CONFIG_NRF_HALTIUM_GENERATE_UICR=y." + ) +endif() From b8905458990e76a5f72cfc6f21d4ae9d5576150d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Ku=C5=BAnia?= Date: Thu, 18 Sep 2025 15:46:09 +0200 Subject: [PATCH 1736/2141] [nrf fromlist] drivers: ieee802154: nrf5: Add temporary API migration code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The transmit functions will return an error code, instead of a boolean value. To prepare for this, the API calls are temporarily implemented in two variants, for old and new API declarations. The presence of new API will be detected by the use of NRF_802154_TX_FUNCTIONS_RETURN_ERROR_CODE macro, which will be unconditionally defined by a newer nrf-802154 driver. Upstream PR #: 96219 Signed-off-by: Rafał Kuźnia --- drivers/ieee802154/ieee802154_nrf5.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/ieee802154/ieee802154_nrf5.c b/drivers/ieee802154/ieee802154_nrf5.c index aa67a1f99e15..e099b2f33a97 100644 --- a/drivers/ieee802154/ieee802154_nrf5.c +++ b/drivers/ieee802154/ieee802154_nrf5.c @@ -499,7 +499,13 @@ static bool nrf5_tx_immediate(struct net_pkt *pkt, uint8_t *payload, bool cca) }, }; +#ifdef NRF_802154_TX_FUNCTIONS_RETURN_ERROR_CODE + nrf_802154_tx_error_t result = nrf_802154_transmit_raw(payload, &metadata); + + return result == NRF_802154_TX_ERROR_NONE; +#else return nrf_802154_transmit_raw(payload, &metadata); +#endif } #if NRF_802154_CSMA_CA_ENABLED @@ -516,7 +522,13 @@ static bool nrf5_tx_csma_ca(struct net_pkt *pkt, uint8_t *payload) }, }; +#ifdef NRF_802154_TX_FUNCTIONS_RETURN_ERROR_CODE + nrf_802154_tx_error_t result = nrf_802154_transmit_csma_ca_raw(payload, &metadata); + + return result == NRF_802154_TX_ERROR_NONE; +#else return nrf_802154_transmit_csma_ca_raw(payload, &metadata); +#endif } #endif @@ -573,7 +585,13 @@ static bool nrf5_tx_at(struct nrf5_802154_data *nrf5_radio, struct net_pkt *pkt, uint64_t tx_at = nrf_802154_timestamp_phr_to_shr_convert( net_pkt_timestamp_ns(pkt) / NSEC_PER_USEC); +#ifdef NRF_802154_TX_FUNCTIONS_RETURN_ERROR_CODE + nrf_802154_tx_error_t result = nrf_802154_transmit_raw_at(payload, tx_at, &metadata); + + return result == NRF_802154_TX_ERROR_NONE; +#else return nrf_802154_transmit_raw_at(payload, tx_at, &metadata); +#endif } #endif /* CONFIG_NET_PKT_TXTIME */ From 9d15425c577ccc4e261fe68e29b8273ce5d468bf Mon Sep 17 00:00:00 2001 From: Nikodem Kastelik Date: Tue, 23 Sep 2025 11:51:01 +0200 Subject: [PATCH 1737/2141] [nrf fromlist] drivers: i2c: nrfx_twis: fix missing SoC header include In case of nRF TWIS i2c shim, SoC header include is needed for memory region property presence checker macro. Upstream PR #: 96413 Signed-off-by: Nikodem Kastelik --- drivers/i2c/i2c_nrfx_twis.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/i2c_nrfx_twis.c b/drivers/i2c/i2c_nrfx_twis.c index be55c851f3a7..0fd9b667d23c 100644 --- a/drivers/i2c/i2c_nrfx_twis.c +++ b/drivers/i2c/i2c_nrfx_twis.c @@ -10,7 +10,7 @@ #include #include #include - +#include #include #include From b33e0dce8d4999f0ffa099d5041ec0ece1709796 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Wed, 17 Sep 2025 14:53:07 +0200 Subject: [PATCH 1738/2141] [nrf fromtree] tests: net: tcp: Add test for FIN,ACK received after final data Add a test case for a scenario where the final data sent by one peer is acknowledged in the FIN,ACK response from the other peer. Verify that the acknowledgment is handled correctly, and a consecutive sequence number sent by the TCP stack in such case is set correctly. This complements the other existing test for FIN packet handling, which verified that data received in a FIN packet is handled correctly. With those tests in place it should be safer to update any logic related to FIN packet handling. Signed-off-by: Robert Lubos (cherry picked from commit 99b435788e66bdb520964468505ef1f881d06e5b) --- tests/net/tcp/src/main.c | 205 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 205 insertions(+) diff --git a/tests/net/tcp/src/main.c b/tests/net/tcp/src/main.c index 2c0cfcd9ef2c..db57b70a40ef 100644 --- a/tests/net/tcp/src/main.c +++ b/tests/net/tcp/src/main.c @@ -116,6 +116,7 @@ static enum test_case_no { TEST_CLIENT_FIN_ACK_WITH_DATA = 18, TEST_CLIENT_SEQ_VALIDATION = 19, TEST_SERVER_ACK_VALIDATION = 20, + TEST_SERVER_FIN_ACK_AFTER_DATA = 21, } test_case_no; static enum test_state t_state; @@ -142,6 +143,7 @@ static void handle_syn_invalid_ack(sa_family_t af, struct tcphdr *th); static void handle_client_fin_ack_with_data_test(sa_family_t af, struct tcphdr *th); static void handle_client_seq_validation_test(sa_family_t af, struct tcphdr *th); static void handle_server_ack_validation_test(struct net_pkt *pkt); +static void handle_server_fin_ack_after_data_test(sa_family_t af, struct tcphdr *th); static void verify_flags(struct tcphdr *th, uint8_t flags, const char *fun, int line) @@ -494,6 +496,9 @@ static int tester_send(const struct device *dev, struct net_pkt *pkt) case TEST_SERVER_ACK_VALIDATION: handle_server_ack_validation_test(pkt); break; + case TEST_SERVER_FIN_ACK_AFTER_DATA: + handle_server_fin_ack_after_data_test(net_pkt_family(pkt), &th); + break; default: zassert_true(false, "Undefined test case"); } @@ -3002,4 +3007,204 @@ ZTEST(net_tcp, test_server_ack_validation) net_context_put(accepted_ctx); } +#define TEST_FIN_ACK_AFTER_DATA_REQ "request" +#define TEST_FIN_ACK_AFTER_DATA_RSP "test data response" + +/* In this test we check that FIN,ACK packet acknowledging latest data is + * handled correctly by the TCP stack. + */ +static void handle_server_fin_ack_after_data_test(sa_family_t af, struct tcphdr *th) +{ + struct net_pkt *reply = NULL; + + zassert_false(th == NULL && t_state != T_SYN, + "NULL pkt only expected in T_SYN state"); + + switch (t_state) { + case T_SYN: + reply = prepare_syn_packet(af, htons(MY_PORT), htons(PEER_PORT)); + seq++; + t_state = T_SYN_ACK; + break; + case T_SYN_ACK: + test_verify_flags(th, SYN | ACK); + zassert_equal(ntohl(th->th_ack), seq, + "Unexpected ACK in T_SYN_ACK, got %d, expected %d", + ntohl(th->th_ack), seq); + device_initial_seq = ntohl(th->th_seq); + ack = ntohl(th->th_seq) + 1U; + t_state = T_DATA_ACK; + + /* Dummy "request" packet */ + reply = prepare_data_packet(af, htons(MY_PORT), htons(PEER_PORT), + TEST_FIN_ACK_AFTER_DATA_REQ, + sizeof(TEST_FIN_ACK_AFTER_DATA_REQ) - 1); + seq += sizeof(TEST_FIN_ACK_AFTER_DATA_REQ) - 1; + break; + case T_DATA_ACK: + test_verify_flags(th, ACK); + t_state = T_DATA; + zassert_equal(ntohl(th->th_seq), ack, + "Unexpected SEQ in T_DATA_ACK, got %d, expected %d", + get_rel_seq(th), ack); + zassert_equal(ntohl(th->th_ack), seq, + "Unexpected ACK in T_DATA_ACK, got %d, expected %d", + ntohl(th->th_ack), seq); + break; + case T_DATA: + test_verify_flags(th, PSH | ACK); + zassert_equal(ntohl(th->th_seq), ack, + "Unexpected SEQ in T_DATA, got %d, expected %d", + get_rel_seq(th), ack); + zassert_equal(ntohl(th->th_ack), seq, + "Unexpected ACK in T_DATA, got %d, expected %d", + ntohl(th->th_ack), seq); + ack += sizeof(TEST_FIN_ACK_AFTER_DATA_RSP) - 1; + t_state = T_FIN_ACK; + + reply = prepare_fin_ack_packet(af, htons(MY_PORT), htons(PEER_PORT)); + seq++; + break; + case T_FIN_ACK: + test_verify_flags(th, FIN | ACK); + zassert_equal(ntohl(th->th_seq), ack, + "Unexpected SEQ in T_FIN_ACK, got %d, expected %d", + get_rel_seq(th), ack); + zassert_equal(ntohl(th->th_ack), seq, + "Unexpected ACK in T_FIN_ACK, got %d, expected %d", + ntohl(th->th_ack), seq); + + ack++; + t_state = T_CLOSING; + + reply = prepare_ack_packet(af, htons(MY_PORT), htons(PEER_PORT)); + seq++; + break; + case T_CLOSING: + zassert_true(false, "Should not receive anything after final ACK"); + break; + default: + zassert_true(false, "%s unexpected state", __func__); + return; + } + + if (reply != NULL) { + zassert_ok(net_recv_data(net_iface, reply), "%s failed", __func__); + } +} + +/* Receive callback to be installed in the accept handler */ +static void test_fin_ack_after_data_recv_cb(struct net_context *context, + struct net_pkt *pkt, + union net_ip_header *ip_hdr, + union net_proto_header *proto_hdr, + int status, + void *user_data) +{ + zassert_ok(status, "failed to recv the data"); + + if (pkt != NULL) { + uint8_t buf[sizeof(TEST_FIN_ACK_AFTER_DATA_REQ)] = { 0 }; + int data_len = net_pkt_remaining_data(pkt); + + zassert_equal(data_len, sizeof(TEST_FIN_ACK_AFTER_DATA_REQ) - 1, + "Invalid packet length, %d", data_len); + zassert_ok(net_pkt_read(pkt, buf, data_len)); + zassert_mem_equal(buf, TEST_FIN_ACK_AFTER_DATA_REQ, data_len); + + net_pkt_unref(pkt); + } + + test_sem_give(); +} + +static void test_fin_ack_after_data_accept_cb(struct net_context *ctx, + struct sockaddr *addr, + socklen_t addrlen, + int status, + void *user_data) +{ + int ret; + + zassert_ok(status, "failed to accept the conn"); + + /* set callback on newly created context */ + accepted_ctx = ctx; + ret = net_context_recv(ctx, test_fin_ack_after_data_recv_cb, + K_NO_WAIT, NULL); + zassert_ok(ret, "Failed to recv data from peer"); + + /* Ref the context on the app behalf. */ + net_context_ref(ctx); +} + +/* Verify that the TCP stack replies with a valid FIN,ACK after the peer + * acknowledges the latest data in the FIN packet. + * Test case scenario IPv4 + * send SYN, + * expect SYN ACK, + * send ACK with Data, + * expect ACK, + * expect Data, + * send FIN,ACK + * expect FIN,ACK + * send ACK + * any failures cause test case to fail. + */ +ZTEST(net_tcp, test_server_fin_ack_after_data) +{ + struct net_context *ctx; + int ret; + + test_case_no = TEST_SERVER_FIN_ACK_AFTER_DATA; + + t_state = T_SYN; + seq = ack = 0; + + ret = net_context_get(AF_INET, SOCK_STREAM, IPPROTO_TCP, &ctx); + zassert_ok(ret, "Failed to get net_context"); + + net_context_ref(ctx); + + ret = net_context_bind(ctx, (struct sockaddr *)&my_addr_s, + sizeof(struct sockaddr_in)); + zassert_ok(ret, "Failed to bind net_context"); + + /* Put context into listening mode and install accept cb */ + ret = net_context_listen(ctx, 1); + zassert_ok(ret, "Failed to listen on net_context"); + + ret = net_context_accept(ctx, test_fin_ack_after_data_accept_cb, + K_NO_WAIT, NULL); + zassert_ok(ret, "Failed to set accept on net_context"); + + /* Trigger the peer to send SYN */ + handle_server_fin_ack_after_data_test(AF_INET, NULL); + + /* test_fin_ack_after_data_recv_cb will release the semaphore after + * dummy request is read. + */ + test_sem_take(K_MSEC(100), __LINE__); + + /* Send dummy "response" */ + ret = net_context_send(accepted_ctx, TEST_FIN_ACK_AFTER_DATA_RSP, + sizeof(TEST_FIN_ACK_AFTER_DATA_RSP) - 1, NULL, + K_NO_WAIT, NULL); + zassert_equal(ret, sizeof(TEST_FIN_ACK_AFTER_DATA_RSP) - 1, + "Failed to send data to peer %d", ret); + + /* test_fin_ack_after_data_recv_cb will release the semaphore after + * the connection is marked closed. + */ + test_sem_take(K_MSEC(100), __LINE__); + + net_context_put(ctx); + net_context_put(accepted_ctx); + + /* Connection is in TIME_WAIT state, context will be released + * after K_MSEC(CONFIG_NET_TCP_TIME_WAIT_DELAY), so wait for it. + */ + k_sleep(K_MSEC(CONFIG_NET_TCP_TIME_WAIT_DELAY)); +} + ZTEST_SUITE(net_tcp, NULL, presetup, NULL, NULL, NULL); From 1ec9e9c060ad54bc18828d2d65e286ae6101beb9 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Wed, 17 Sep 2025 16:10:28 +0200 Subject: [PATCH 1739/2141] [nrf fromtree] net: tcp: Fix ACK processing when FIN packet is received In case FIN packed also acknowledged most recently sent data, not all ack-related TCP context variables were updated, resulting in invalid SEQ number values sent in consecutive packets. Fix this by refactoring the FIN handling in TCP_ESTABLISHED state. Instead of having a separate block strictly for FIN packet processing, let the packet be processed by common code responsible for regular data/ack processing. This should be less error-prone for any future modifications or not-yet-discovered issues. Only after the common processing of data/ack is done, we check whether FIN flag was present in the packet, and mark the connection for closing. Signed-off-by: Robert Lubos (cherry picked from commit 178150590cfada9eab9336c1119558759d614ac6) --- subsys/net/ip/tcp.c | 76 ++++++++++++++++++++++----------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/subsys/net/ip/tcp.c b/subsys/net/ip/tcp.c index 270675fe27fd..f86e782ac9f5 100644 --- a/subsys/net/ip/tcp.c +++ b/subsys/net/ip/tcp.c @@ -2719,7 +2719,7 @@ static void tcp_queue_recv_data(struct tcp *conn, struct net_pkt *pkt, } static enum net_verdict tcp_data_received(struct tcp *conn, struct net_pkt *pkt, - size_t *len, bool psh) + size_t *len, bool psh, bool fin) { enum net_verdict ret; @@ -2732,6 +2732,13 @@ static enum net_verdict tcp_data_received(struct tcp *conn, struct net_pkt *pkt, net_stats_update_tcp_seg_recv(conn->iface); conn_ack(conn, *len); + /* In case FIN was received, don't send ACK just yet, FIN,ACK will be + * sent instead. + */ + if (fin) { + return ret; + } + /* Delay ACK response in case of small window or missing PSH, * as described in RFC 813. */ @@ -3143,37 +3150,8 @@ static enum net_verdict tcp_in(struct tcp *conn, struct net_pkt *pkt) } break; - case TCP_ESTABLISHED: - /* full-close */ - if (FL(&fl, &, FIN, th_seq(th) == conn->ack)) { - if (len) { - verdict = tcp_data_get(conn, pkt, &len); - if (verdict == NET_OK) { - /* net_pkt owned by the recv fifo now */ - pkt = NULL; - } - } else { - verdict = NET_OK; - } - - conn_ack(conn, + len + 1); - keep_alive_timer_stop(conn); - - if (net_tcp_seq_cmp(th_ack(th), conn->seq) > 0) { - uint32_t len_acked = th_ack(th) - conn->seq; - - conn_seq(conn, + len_acked); - } - - tcp_out(conn, FIN | ACK); - conn_seq(conn, + 1); - tcp_setup_retransmission(conn); - - tcp_setup_last_ack_timer(conn); - next = TCP_LAST_ACK; - - break; - } + case TCP_ESTABLISHED: { + bool fin = FL(&fl, &, FIN, th_seq(th) == conn->ack); /* Whatever we've received, we know that peer is alive, so reset * the keepalive timer. @@ -3279,11 +3257,21 @@ static enum net_verdict tcp_in(struct tcp *conn, struct net_pkt *pkt) /* We are closing the connection, send a FIN to peer */ if (conn->in_close && conn->send_data_total == 0) { - next = TCP_FIN_WAIT_1; - - k_work_reschedule_for_queue(&tcp_work_q, - &conn->fin_timer, - FIN_TIMEOUT); + if (fin) { + /* If FIN was also present in the processed + * packet, acknowledge that and jump directly + * to TCP_LAST_ACK. + */ + conn_ack(conn, + 1); + next = TCP_LAST_ACK; + tcp_setup_last_ack_timer(conn); + } else { + /* Otherwise, wait for FIN in TCP_FIN_WAIT_1 */ + next = TCP_FIN_WAIT_1; + k_work_reschedule_for_queue(&tcp_work_q, + &conn->fin_timer, + FIN_TIMEOUT); + } tcp_out(conn, FIN | ACK); conn_seq(conn, + 1); @@ -3314,7 +3302,7 @@ static enum net_verdict tcp_in(struct tcp *conn, struct net_pkt *pkt) data_recv: psh = FL(&fl, &, PSH); - verdict = tcp_data_received(conn, pkt, &len, psh); + verdict = tcp_data_received(conn, pkt, &len, psh, fin); if (verdict == NET_OK) { /* net_pkt owned by the recv fifo now */ pkt = NULL; @@ -3358,7 +3346,19 @@ static enum net_verdict tcp_in(struct tcp *conn, struct net_pkt *pkt) k_sem_give(&conn->tx_sem); } + /* Finally, after all Data/ACK processing, check for FIN flag. */ + if (fin) { + keep_alive_timer_stop(conn); + conn_ack(conn, + 1); + tcp_out(conn, FIN | ACK); + conn_seq(conn, + 1); + tcp_setup_retransmission(conn); + tcp_setup_last_ack_timer(conn); + next = TCP_LAST_ACK; + } + break; + } case TCP_CLOSE_WAIT: /* Half-close is not supported, so do nothing here */ break; From a785c3163bfb34c5afe1d08f45d33d370b7cafec Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 18 Sep 2025 14:04:29 +0200 Subject: [PATCH 1740/2141] [nrf fromtree] net: mdns_responder: Align with dns_unpack_query() change dns_unpack_query() no longer prepends the unpacked query with extra dot, therefore mDNS responder needs to be aligned with this change when parsing result and preparing response. Signed-off-by: Robert Lubos (cherry picked from commit 9e5922952aef97f5575b126005b319021689314f) --- subsys/net/lib/dns/mdns_responder.c | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/subsys/net/lib/dns/mdns_responder.c b/subsys/net/lib/dns/mdns_responder.c index a867cd079a13..e60ab9b70029 100644 --- a/subsys/net/lib/dns/mdns_responder.c +++ b/subsys/net/lib/dns/mdns_responder.c @@ -274,23 +274,19 @@ static void setup_dns_hdr(uint8_t *buf, uint16_t answers) static void add_answer(struct net_buf *query, enum dns_rr_type qtype, uint32_t ttl, uint16_t addr_len, uint8_t *addr) { - char *dot = query->data + DNS_MSG_HEADER_SIZE; - char *prev = NULL; + char *dot = query->data + DNS_MSG_HEADER_SIZE + 1; + char *prev = query->data + DNS_MSG_HEADER_SIZE; uint16_t offset; - while ((dot = strchr(dot, '.'))) { - if (!prev) { - prev = dot++; - continue; - } + /* For the length of the first label. */ + query->len += 1; + while ((dot = strchr(dot, '.')) != NULL) { *prev = dot - prev - 1; prev = dot++; } - if (prev) { - *prev = strlen(prev) - 1; - } + *prev = strlen(prev + 1); /* terminator byte (0x00) */ query->len += 1; @@ -322,14 +318,15 @@ static int create_answer(int sock, /* Prepare the response into the query buffer: move the name * query buffer has to get enough free space: dns_hdr + answer */ - if ((net_buf_max_len(query) - query->len) < (DNS_MSG_HEADER_SIZE + + if ((net_buf_max_len(query) - query->len) < (DNS_MSG_HEADER_SIZE + 1 + DNS_QTYPE_LEN + DNS_QCLASS_LEN + DNS_TTL_LEN + DNS_RDLENGTH_LEN + addr_len)) { return -ENOBUFS; } - memmove(query->data + DNS_MSG_HEADER_SIZE, query->data, query->len); + /* +1 for the initial label length */ + memmove(query->data + DNS_MSG_HEADER_SIZE + 1, query->data, query->len); setup_dns_hdr(query->data, 1); @@ -641,7 +638,7 @@ static int dns_read(int sock, } /* Handle only .local queries */ - lquery = strrchr(result->data + 1, '.'); + lquery = strrchr(result->data, '.'); if (!lquery || memcmp(lquery, (const void *){ ".local" }, 7)) { continue; } @@ -654,9 +651,9 @@ static int dns_read(int sock, * We skip the first dot, and make sure there is dot after * matching hostname. */ - if (!strncasecmp(hostname, result->data + 1, hostname_len) && - (result->len - 1) >= hostname_len && - &(result->data + 1)[hostname_len] == lquery) { + if (!strncasecmp(hostname, result->data, hostname_len) && + (result->len) >= hostname_len && + &result->data[hostname_len] == lquery) { NET_DBG("%s %s %s to our hostname %s%s", "mDNS", family == AF_INET ? "IPv4" : "IPv6", "query", hostname, ".local"); From dda3db2937384c19d7b3eb8f9006b2099e05fbf2 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 18 Sep 2025 15:26:06 +0200 Subject: [PATCH 1741/2141] [nrf fromtree] net: llmnr_responder: Align with dns_unpack_query() change dns_unpack_query() no longer prepends the unpacked query with extra dot, therefore LLMNR responder needs to be aligned with this change when parsing result and preparing response. Signed-off-by: Robert Lubos (cherry picked from commit fda82471dbf1281c857c17672bf9bbe53242d23d) --- subsys/net/lib/dns/llmnr_responder.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/subsys/net/lib/dns/llmnr_responder.c b/subsys/net/lib/dns/llmnr_responder.c index c8b1500b1b01..7dfa682f53d6 100644 --- a/subsys/net/lib/dns/llmnr_responder.c +++ b/subsys/net/lib/dns/llmnr_responder.c @@ -192,23 +192,19 @@ static void setup_dns_hdr(uint8_t *buf, uint16_t answers, uint16_t dns_id) static void add_question(struct net_buf *query, enum dns_rr_type qtype) { - char *dot = query->data + DNS_MSG_HEADER_SIZE; - char *prev = NULL; + char *dot = query->data + DNS_MSG_HEADER_SIZE + 1; + char *prev = query->data + DNS_MSG_HEADER_SIZE; uint16_t offset; - while ((dot = strchr(dot, '.'))) { - if (!prev) { - prev = dot++; - continue; - } + /* For the length of the first label. */ + query->len += 1; + while ((dot = strchr(dot, '.')) != NULL) { *prev = dot - prev - 1; prev = dot++; } - if (prev) { - *prev = strlen(prev) - 1; - } + *prev = strlen(prev + 1); offset = DNS_MSG_HEADER_SIZE + query->len + 1; UNALIGNED_PUT(htons(qtype), (uint16_t *)(query->data+offset)); @@ -245,14 +241,15 @@ static int create_answer(enum dns_rr_type qtype, /* Prepare the response into the query buffer: move the name * query buffer has to get enough free space: dns_hdr + query + answer */ - if ((net_buf_max_len(query) - query->len) < (DNS_MSG_HEADER_SIZE + + if ((net_buf_max_len(query) - query->len) < (DNS_MSG_HEADER_SIZE + 1 + (DNS_QTYPE_LEN + DNS_QCLASS_LEN) * 2 + DNS_TTL_LEN + DNS_RDLENGTH_LEN + addr_len + query->len)) { return -ENOBUFS; } - memmove(query->data + DNS_MSG_HEADER_SIZE, query->data, query->len); + /* +1 for the initial label length */ + memmove(query->data + DNS_MSG_HEADER_SIZE + 1, query->data, query->len); setup_dns_hdr(query->data, 1, dns_id); @@ -488,8 +485,8 @@ static int dns_read(int sock, result->data, ret); /* If the query matches to our hostname, then send reply */ - if (!strncasecmp(hostname, result->data + 1, hostname_len) && - (result->len - 1) >= hostname_len) { + if (!strncasecmp(hostname, result->data, hostname_len) && + (result->len) >= hostname_len) { NET_DBG("%s query to our hostname %s", "LLMNR", hostname); ret = send_response(sock, src_addr, addrlen, result, qtype, From 71628fb9e2e1e85de1d3147b9fa7a8d7d00f3fbf Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 18 Sep 2025 15:32:15 +0200 Subject: [PATCH 1742/2141] [nrf fromtree] tests: net: socket: getaddrinfo: Align with dns_unpack_query() change Not sure why didn't this cause the test to fail, but just for completeness, align this test suite with dns_unpack_query() change as well. Signed-off-by: Robert Lubos (cherry picked from commit c8858445372512b2e8861875448ce43640f76beb) --- tests/net/socket/getaddrinfo/src/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/net/socket/getaddrinfo/src/main.c b/tests/net/socket/getaddrinfo/src/main.c index c412cce87f41..25be0205ea87 100644 --- a/tests/net/socket/getaddrinfo/src/main.c +++ b/tests/net/socket/getaddrinfo/src/main.c @@ -96,7 +96,7 @@ static bool check_dns_query(uint8_t *buf, int buf_len) /* In this test we are just checking if the query came to us in correct * form, we are not creating a DNS server implementation here. */ - if (strncmp(result->data + 1, QUERY_HOST, + if (strncmp(result->data, QUERY_HOST, sizeof(QUERY_HOST) - 1)) { net_buf_unref(result); return false; From a2b688488679d6962d34024a9eccdebfe60a70f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Wed, 24 Sep 2025 08:54:24 +0200 Subject: [PATCH 1743/2141] [nrf noup] boards: nordic: Remove nrf54l20pdk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit nrf-squash! [nrf noup] dts: Select SoftDevice Controller DTS binding as default nrf54l20_cpuapp_common.dtsi file was added unnecessarily in this [nrf noup] commit https://github.com/nrfconnect/sdk-zephyr/commit/e9c0ac14274c524b125a8251b1e319408e256516 Target nrf54l20pdk has been replaced with target nrf54lm20dk. Signed-off-by: Sebastian Głąb --- .../nrf54l20pdk/nrf54l20_cpuapp_common.dtsi | 131 ------------------ 1 file changed, 131 deletions(-) delete mode 100644 boards/nordic/nrf54l20pdk/nrf54l20_cpuapp_common.dtsi diff --git a/boards/nordic/nrf54l20pdk/nrf54l20_cpuapp_common.dtsi b/boards/nordic/nrf54l20pdk/nrf54l20_cpuapp_common.dtsi deleted file mode 100644 index f719b2d93920..000000000000 --- a/boards/nordic/nrf54l20pdk/nrf54l20_cpuapp_common.dtsi +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/* This file is common to the secure and non-secure domain */ - -#include -#include "nrf54l20pdk_nrf54l20-common.dtsi" - -/ { - chosen { - zephyr,console = &uart20; - zephyr,shell-uart = &uart20; - zephyr,uart-mcumgr = &uart20; - zephyr,bt-mon-uart = &uart20; - zephyr,bt-c2h-uart = &uart20; - zephyr,flash-controller = &rram_controller; - zephyr,flash = &cpuapp_rram; - zephyr,bt-hci = &bt_hci_sdc; - zephyr,ieee802154 = &ieee802154; - }; -}; - -&cpuapp_sram { - status = "okay"; -}; - -&lfxo { - load-capacitors = "internal"; - load-capacitance-femtofarad = <15500>; -}; - -&hfxo { - load-capacitors = "internal"; - load-capacitance-femtofarad = <15000>; -}; - -&grtc { - owned-channels = <0 1 2 3 4 5 6 7 8 9 10 11>; - /* Channels 7-11 reserved for Zero Latency IRQs, 3-4 for FLPR */ - child-owned-channels = <3 4 7 8 9 10 11>; - status = "okay"; -}; - -&cpuapp_rram { - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - boot_partition: partition@0 { - label = "mcuboot"; - reg = <0x0 DT_SIZE_K(64)>; - }; - - slot0_partition: partition@10000 { - label = "image-0"; - reg = <0x10000 DT_SIZE_K(449)>; - }; - - slot0_ns_partition: partition@80400 { - label = "image-0-nonsecure"; - reg = <0x80400 DT_SIZE_K(449)>; - }; - - slot1_partition: partition@f0800 { - label = "image-1"; - reg = <0xf0800 DT_SIZE_K(449)>; - }; - - slot1_ns_partition: partition@160c00 { - label = "image-1-nonsecure"; - reg = <0x160c00 DT_SIZE_K(449)>; - }; - - storage_partition: partition@1d1000 { - label = "storage"; - reg = <0x1d1000 DT_SIZE_K(36)>; - }; - }; -}; - -&uart20 { - status = "okay"; -}; - -&nfct { - status = "okay"; -}; - -&gpio0 { - status = "okay"; -}; - -&gpio1 { - status = "okay"; -}; - -&gpio2 { - status = "okay"; -}; - -&gpiote20 { - status = "okay"; -}; - -&gpiote30 { - status = "okay"; -}; - -&radio { - status = "okay"; -}; - -&temp { - status = "okay"; -}; - -&clock { - status = "okay"; -}; - -&bt_hci_sdc { - status = "okay"; -}; - -&ieee802154 { - status = "okay"; -}; From e282b635858d19b43e8fd55ff723e1a78d512df3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Stasiak?= Date: Mon, 22 Sep 2025 16:05:13 +0200 Subject: [PATCH 1744/2141] [nrf fromlist] drivers: sensor: qdec_nrfx: add conditional PM ISR safety MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Requesting/releasing QDEC device may be ISR safe, but it cannot be reliably known whether managing its power domain is. Is is then assumed that if power domains are used, device is no longer ISR safe. This macro let's us check if we will be requesting/releasing power domains and determines PM device ISR safety value. Upstream PR #: 96402 Signed-off-by: Michał Stasiak --- drivers/sensor/nordic/qdec_nrfx/qdec_nrfx.c | 22 ++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/drivers/sensor/nordic/qdec_nrfx/qdec_nrfx.c b/drivers/sensor/nordic/qdec_nrfx/qdec_nrfx.c index 9ecfb5c122da..0d5eb5ab8cc2 100644 --- a/drivers/sensor/nordic/qdec_nrfx/qdec_nrfx.c +++ b/drivers/sensor/nordic/qdec_nrfx/qdec_nrfx.c @@ -272,6 +272,26 @@ static int qdec_nrfx_init(const struct device *dev) #define QDEC(idx) DT_NODELABEL(qdec##idx) #define QDEC_PROP(idx, prop) DT_PROP(QDEC(idx), prop) +/* Macro determines PM actions interrupt safety level. + * + * Requesting/releasing QDEC device may be ISR safe, but it cannot be reliably known whether + * managing its power domain is. It is then assumed that if power domains are used, device is + * no longer ISR safe. This macro let's us check if we will be requesting/releasing + * power domains and determines PM device ISR safety value. + */ +#define QDEC_PM_ISR_SAFE(idx) \ + COND_CODE_1( \ + UTIL_AND( \ + IS_ENABLED(CONFIG_PM_DEVICE_POWER_DOMAIN), \ + UTIL_AND( \ + DT_NODE_HAS_PROP(QDEC(idx), power_domains), \ + DT_NODE_HAS_STATUS_OKAY(DT_PHANDLE(QDEC(idx), power_domains)) \ + ) \ + ), \ + (0), \ + (PM_DEVICE_ISR_SAFE) \ + ) + #define SENSOR_NRFX_QDEC_DEVICE(idx) \ NRF_DT_CHECK_NODE_HAS_PINCTRL_SLEEP(QDEC(idx)); \ BUILD_ASSERT(QDEC_PROP(idx, steps) > 0, \ @@ -301,7 +321,7 @@ static int qdec_nrfx_init(const struct device *dev) .enable_pin = DT_PROP_OR(QDEC(idx), enable_pin, NRF_QDEC_PIN_NOT_CONNECTED), \ .steps = QDEC_PROP(idx, steps), \ }; \ - PM_DEVICE_DT_DEFINE(QDEC(idx), qdec_nrfx_pm_action, PM_DEVICE_ISR_SAFE); \ + PM_DEVICE_DT_DEFINE(QDEC(idx), qdec_nrfx_pm_action, QDEC_PM_ISR_SAFE(idx)); \ SENSOR_DEVICE_DT_DEFINE(QDEC(idx), \ qdec_nrfx_init, \ PM_DEVICE_DT_GET(QDEC(idx)), \ From c6ef6c013f9a04ba90bc7790dad9dbe92e925515 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Stasiak?= Date: Mon, 22 Sep 2025 16:23:57 +0200 Subject: [PATCH 1745/2141] [nrf fromlist] drivers: spi: spi_nrfx_spis: add conditional PM ISR safety MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Requesting/releasing SPIM device may be ISR safe, but it cannot be reliably known whether managing its power domain is. Is is then assumed that if power domains are used, device is no longer ISR safe. This macro let's us check if we will be requesting/releasing power domains and determines PM device ISR safety value. Upstream PR #: 96402 Signed-off-by: Michał Stasiak --- drivers/spi/spi_nrfx_spis.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi_nrfx_spis.c b/drivers/spi/spi_nrfx_spis.c index 64c9a6f14c45..aa59d9abc9b2 100644 --- a/drivers/spi/spi_nrfx_spis.c +++ b/drivers/spi/spi_nrfx_spis.c @@ -551,6 +551,32 @@ static int spi_nrfx_init(const struct device *dev) return pm_device_driver_init(dev, spi_nrfx_pm_action); } +/* Macro determines PM actions interrupt safety level. + * + * Requesting/releasing SPIS device may be ISR safe, but it cannot be reliably known whether + * managing its power domain is. It is then assumed that if power domains are used, device is + * no longer ISR safe. This macro let's us check if we will be requesting/releasing + * power domains and determines PM device ISR safety value. + * + * Additionally, fast SPIS devices are not ISR safe. + */ +#define SPIS_PM_ISR_SAFE(idx) \ + COND_CODE_1( \ + UTIL_AND( \ + IS_ENABLED(CONFIG_PM_DEVICE_POWER_DOMAIN), \ + UTIL_AND( \ + DT_NODE_HAS_PROP(SPIS(idx), power_domains), \ + DT_NODE_HAS_STATUS_OKAY(DT_PHANDLE(SPIS(idx), power_domains)) \ + ) \ + ), \ + (0), \ + (COND_CODE_1( \ + SPIS_IS_FAST(idx), \ + (0), \ + (PM_DEVICE_ISR_SAFE) \ + )) \ + ) + #define SPI_NRFX_SPIS_DEFINE(idx) \ NRF_DT_CHECK_NODE_HAS_REQUIRED_MEMORY_REGIONS(SPIS(idx)); \ static void irq_connect##idx(void) \ @@ -597,8 +623,7 @@ static int spi_nrfx_init(const struct device *dev) !(DT_GPIO_FLAGS(SPIS(idx), wake_gpios) & GPIO_ACTIVE_LOW),\ "WAKE line must be configured as active high"); \ PM_DEVICE_DT_DEFINE(SPIS(idx), spi_nrfx_pm_action, \ - COND_CODE_1(SPIS_IS_FAST(idx), (0), \ - (PM_DEVICE_ISR_SAFE))); \ + SPIS_PM_ISR_SAFE(idx)); \ SPI_DEVICE_DT_DEFINE(SPIS(idx), \ spi_nrfx_init, \ PM_DEVICE_DT_GET(SPIS(idx)), \ From 5b0d71f3017e8a8f73cb2e4048ad2eb52e15bdf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Stasiak?= Date: Mon, 22 Sep 2025 16:28:49 +0200 Subject: [PATCH 1746/2141] [nrf fromlist] drivers: i2c: i2c_nrfx_twim: add conditional PM ISR safety MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Requesting/releasing TWIM device may be ISR safe, but it cannot be reliably known whether managing its power domain is. Is is then assumed that if power domains are used, device is no longer ISR safe. This macro let's us check if we will be requesting/releasing power domains and determines PM device ISR safety value. Upstream PR #: 96402 Signed-off-by: Michał Stasiak --- drivers/i2c/i2c_nrfx_twim.c | 2 +- drivers/i2c/i2c_nrfx_twim_common.h | 20 ++++++++++++++++++++ drivers/i2c/i2c_nrfx_twim_rtio.c | 2 +- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/i2c_nrfx_twim.c b/drivers/i2c/i2c_nrfx_twim.c index e3c307231ab1..bc26bf841124 100644 --- a/drivers/i2c/i2c_nrfx_twim.c +++ b/drivers/i2c/i2c_nrfx_twim.c @@ -285,7 +285,7 @@ static DEVICE_API(i2c, i2c_nrfx_twim_driver_api) = { DT_PROP(I2C(idx), easydma_maxcnt_bits)), \ }; \ PM_DEVICE_DT_DEFINE(I2C(idx), twim_nrfx_pm_action, \ - PM_DEVICE_ISR_SAFE); \ + I2C_PM_ISR_SAFE(idx)); \ I2C_DEVICE_DT_DEINIT_DEFINE(I2C(idx), \ i2c_nrfx_twim_init, \ i2c_nrfx_twim_deinit, \ diff --git a/drivers/i2c/i2c_nrfx_twim_common.h b/drivers/i2c/i2c_nrfx_twim_common.h index 3c5c82311bae..d476ba3f05ff 100644 --- a/drivers/i2c/i2c_nrfx_twim_common.h +++ b/drivers/i2c/i2c_nrfx_twim_common.h @@ -31,6 +31,26 @@ extern "C" { #define I2C_FREQUENCY(idx) I2C_NRFX_TWIM_FREQUENCY(DT_PROP_OR(I2C(idx), clock_frequency, \ I2C_BITRATE_STANDARD)) +/* Macro determines PM actions interrupt safety level. + * + * Requesting/releasing TWIM device may be ISR safe, but it cannot be reliably known whether + * managing its power domain is. It is then assumed that if power domains are used, device is + * no longer ISR safe. This macro let's us check if we will be requesting/releasing + * power domains and determines PM device ISR safety value. + */ +#define I2C_PM_ISR_SAFE(idx) \ + COND_CODE_1( \ + UTIL_AND( \ + IS_ENABLED(CONFIG_PM_DEVICE_POWER_DOMAIN), \ + UTIL_AND( \ + DT_NODE_HAS_PROP(I2C(idx), power_domains), \ + DT_NODE_HAS_STATUS_OKAY(DT_PHANDLE(I2C(idx), power_domains)) \ + ) \ + ), \ + (0), \ + (PM_DEVICE_ISR_SAFE) \ + ) + struct i2c_nrfx_twim_common_config { nrfx_twim_t twim; nrfx_twim_config_t twim_config; diff --git a/drivers/i2c/i2c_nrfx_twim_rtio.c b/drivers/i2c/i2c_nrfx_twim_rtio.c index 0ddf5ffdd777..7326deaafb03 100644 --- a/drivers/i2c/i2c_nrfx_twim_rtio.c +++ b/drivers/i2c/i2c_nrfx_twim_rtio.c @@ -287,7 +287,7 @@ static int i2c_nrfx_twim_rtio_deinit(const struct device *dev) }, \ .ctx = &_i2c##idx##_twim_rtio, \ }; \ - PM_DEVICE_DT_DEFINE(I2C(idx), twim_nrfx_pm_action, PM_DEVICE_ISR_SAFE); \ + PM_DEVICE_DT_DEFINE(I2C(idx), twim_nrfx_pm_action, I2C_PM_ISR_SAFE(idx)); \ I2C_DEVICE_DT_DEINIT_DEFINE(I2C(idx), i2c_nrfx_twim_rtio_init, i2c_nrfx_twim_rtio_deinit, \ PM_DEVICE_DT_GET(I2C(idx)), &twim_##idx##z_data, \ &twim_##idx##z_config, POST_KERNEL, CONFIG_I2C_INIT_PRIORITY, \ From 8728d138bb2b400bdec6554ea7e82e75d24c8e5c Mon Sep 17 00:00:00 2001 From: Tommi Kangas Date: Mon, 22 Sep 2025 12:50:00 +0300 Subject: [PATCH 1747/2141] [nrf fromtree] boards: nrf9280pdk: Add missing overlays for rev. 0.2.0 Added missing cpuapp/iron and cpuppr/xip overlays for rev. 0.2.0. Signed-off-by: Tommi Kangas (cherry picked from commit 9d10d67bcb15a70e3db91893aec2585399ca2dc0) --- .../nrf9280pdk_nrf9280_cpuapp_iron_0_2_0.overlay | 7 +++++++ .../nrf9280pdk/nrf9280pdk_nrf9280_cpuppr_xip_0_2_0.overlay | 7 +++++++ 2 files changed, 14 insertions(+) create mode 100644 boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp_iron_0_2_0.overlay create mode 100644 boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuppr_xip_0_2_0.overlay diff --git a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp_iron_0_2_0.overlay b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp_iron_0_2_0.overlay new file mode 100644 index 000000000000..f2d986e6cb06 --- /dev/null +++ b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp_iron_0_2_0.overlay @@ -0,0 +1,7 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "nrf9280pdk_nrf9280-pinctrl_0_2_0.dtsi" diff --git a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuppr_xip_0_2_0.overlay b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuppr_xip_0_2_0.overlay new file mode 100644 index 000000000000..f2d986e6cb06 --- /dev/null +++ b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuppr_xip_0_2_0.overlay @@ -0,0 +1,7 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "nrf9280pdk_nrf9280-pinctrl_0_2_0.dtsi" From 524b50c394d05ad2ac759ee588ded4371f037867 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Fri, 19 Sep 2025 08:32:00 +0100 Subject: [PATCH 1748/2141] [nrf fromlist] cmake: Use temp. for edt pickle CMake output This potentially fixes an issues whereby when sysbuild projects import dts configuration from images and images are reconfigured, that sysbuild will needlessly rerun even if the output has not changed by using a temporary output file and then only updating the actual file if the contents have changed Upstream PR #: 96259 Signed-off-by: Jamie McCrae --- cmake/modules/extensions.cmake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmake/modules/extensions.cmake b/cmake/modules/extensions.cmake index 55ce61fffc6a..5aacb8690da0 100644 --- a/cmake/modules/extensions.cmake +++ b/cmake/modules/extensions.cmake @@ -4705,6 +4705,7 @@ function(zephyr_dt_import) zephyr_check_arguments_required_all(${CMAKE_CURRENT_FUNCTION} arg ${req_single_args}) set(gen_dts_cmake_script ${ZEPHYR_BASE}/scripts/dts/gen_dts_cmake.py) + set(gen_dts_cmake_temp ${arg_EDT_PICKLE_FILE}.cmake.new) set(gen_dts_cmake_output ${arg_EDT_PICKLE_FILE}.cmake) if((${arg_EDT_PICKLE_FILE} IS_NEWER_THAN ${gen_dts_cmake_output}) OR @@ -4713,11 +4714,13 @@ function(zephyr_dt_import) execute_process( COMMAND ${PYTHON_EXECUTABLE} ${gen_dts_cmake_script} --edt-pickle ${arg_EDT_PICKLE_FILE} - --cmake-out ${gen_dts_cmake_output} + --cmake-out ${gen_dts_cmake_temp} WORKING_DIRECTORY ${PROJECT_BINARY_DIR} RESULT_VARIABLE ret COMMAND_ERROR_IS_FATAL ANY ) + + file(COPY_FILE ${gen_dts_cmake_temp} ${gen_dts_cmake_output} ONLY_IF_DIFFERENT) endif() set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${gen_dts_cmake_script}) From a2c3a8e95a76d4d35b1b8d9116381b731b4e6529 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Thu, 4 Sep 2025 10:39:25 +0100 Subject: [PATCH 1749/2141] [nrf fromtree] boards: nordic: nrf54lm20dk: Add aliases for MCUboot button/LED Adds aliases so that these can be used by MCUboot Signed-off-by: Jamie McCrae (cherry picked from commit b6e09135cb6675e876992f117257b46d20e3e4a5) --- boards/nordic/nrf54lm20dk/nrf54lm20a_cpuapp_common.dtsi | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/boards/nordic/nrf54lm20dk/nrf54lm20a_cpuapp_common.dtsi b/boards/nordic/nrf54lm20dk/nrf54lm20a_cpuapp_common.dtsi index 0ee33f1fd45b..18a3e79a2936 100644 --- a/boards/nordic/nrf54lm20dk/nrf54lm20a_cpuapp_common.dtsi +++ b/boards/nordic/nrf54lm20dk/nrf54lm20a_cpuapp_common.dtsi @@ -20,6 +20,11 @@ zephyr,flash = &cpuapp_rram; zephyr,ieee802154 = &ieee802154; }; + + aliases { + mcuboot-button0 = &button0; + mcuboot-led0 = &led0; + }; }; &cpuapp_sram { From ba1d924ef6e0b99d47590fabcb3938b3dd83723b Mon Sep 17 00:00:00 2001 From: Riadh Ghaddab Date: Wed, 10 Sep 2025 11:09:58 +0200 Subject: [PATCH 1750/2141] [nrf fromtree] drivers: flash: nrf_rram: add support for RRAM throttling Some applications need to throttle RRAM writes to handle peak current management. Add CONFIG_NRF_RRAM_THROTTLING_DATA_BLOCK which defines the maximum chunk length that can be written at once. Add CONFIG_NRF_RRAM_THROTTLING_DELAY which configures the sleep delay in microseconds after each write. Signed-off-by: Riadh Ghaddab (cherry picked from commit a4f5d9fb31e68a3361d44665a551bce863dc5840) --- drivers/flash/Kconfig.nrf_rram | 23 +++++++++++++++++++++++ drivers/flash/soc_flash_nrf_rram.c | 21 +++++++++++++++++---- 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/drivers/flash/Kconfig.nrf_rram b/drivers/flash/Kconfig.nrf_rram index a59560e86a46..d8a5abf64b2e 100644 --- a/drivers/flash/Kconfig.nrf_rram +++ b/drivers/flash/Kconfig.nrf_rram @@ -56,8 +56,15 @@ config SOC_FLASH_NRF_RADIO_SYNC_NONE bool "none" help disable synchronization between flash memory driver and radio. + endchoice +config SOC_FLASH_NRF_THROTTLING + bool "Nordic nRFx throttling for flash write operations" + help + Enable throttling for flash write operations to avoid overloading the + flash memory controller. + config SOC_FLASH_NRF_TIMEOUT_MULTIPLIER int "Multiplier for flash operation timeouts [x0.1]" depends on !SOC_FLASH_NRF_RADIO_SYNC_NONE @@ -81,4 +88,20 @@ config NRF_RRAM_REGION_SIZE_UNIT help Base unit for the size of RRAMC's region protection. +config NRF_RRAM_THROTTLING_DELAY + int "Delay between flash write operations" + depends on SOC_FLASH_NRF_THROTTLING + default 2000 + help + This is the delay (in microseconds) between consecutive flash write + operations when throttling is enabled. + +config NRF_RRAM_THROTTLING_DATA_BLOCK + int "Number of Data blocks for each flash write operations" + depends on SOC_FLASH_NRF_THROTTLING + default 16 + help + This is the number of data blocks (in number of 128-bit words) for flash write + operations when throttling is enabled. + endif # SOC_FLASH_NRF_RRAM diff --git a/drivers/flash/soc_flash_nrf_rram.c b/drivers/flash/soc_flash_nrf_rram.c index d46e3524ea8d..84c7e958f3cd 100644 --- a/drivers/flash/soc_flash_nrf_rram.c +++ b/drivers/flash/soc_flash_nrf_rram.c @@ -164,11 +164,24 @@ static void rram_write(off_t addr, const void *data, size_t len) nrf_rramc_config_set(NRF_RRAMC, &config); #endif - if (data) { - memcpy((void *)addr, data, len); - } else { - memset((void *)addr, ERASE_VALUE, len); + size_t chunk_len = len; + +#ifdef CONFIG_SOC_FLASH_NRF_THROTTLING + while (len > 0) { + chunk_len = MIN(len, CONFIG_NRF_RRAM_THROTTLING_DATA_BLOCK * WRITE_LINE_SIZE); +#endif /* CONFIG_SOC_FLASH_NRF_THROTTLING */ + if (data) { + memcpy((void *)addr, data, chunk_len); + } else { + memset((void *)addr, ERASE_VALUE, chunk_len); + } +#ifdef CONFIG_SOC_FLASH_NRF_THROTTLING + addr += chunk_len; + data = (const uint8_t *)data + chunk_len; + len -= chunk_len; + k_usleep(CONFIG_NRF_RRAM_THROTTLING_DELAY); } +#endif /* CONFIG_SOC_FLASH_NRF_THROTTLING */ barrier_dmem_fence_full(); /* Barrier following our last write. */ From 1b17534ce729b9565d82e276a3dd80b981e74730 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Thu, 18 Sep 2025 12:45:59 +0200 Subject: [PATCH 1751/2141] [nrf fromtree] drivers: mspi_dw: Add option to offload handling of FIFOs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Provide a Kconfig option that allows offloading handling of the SSI FIFOs, which the driver normally executes in the interrupt handler, to the system workqueue. Signed-off-by: Andrzej Głąbek (cherry picked from commit 30c4130b2437993c9f644f6616d0eacb37e96d08) --- drivers/mspi/Kconfig.dw | 9 ++++ drivers/mspi/mspi_dw.c | 100 ++++++++++++++++++++++++++++++++-------- 2 files changed, 91 insertions(+), 18 deletions(-) diff --git a/drivers/mspi/Kconfig.dw b/drivers/mspi/Kconfig.dw index 06d2e09c8af1..cff148c138c6 100644 --- a/drivers/mspi/Kconfig.dw +++ b/drivers/mspi/Kconfig.dw @@ -12,6 +12,15 @@ config MSPI_DW if MSPI_DW +config MSPI_DW_HANDLE_FIFOS_IN_SYSTEM_WORKQUEUE + bool "Handle FIFO in system workqueue" + help + When the driver does not use DMA for transferring data to/from the + SSI FIFOs, handling of those may take a significant amount of time. + It may be destructive for some applications if that time is spent + in the interrupt context. This option allows offloading the job to + the system workqueue. + config MSPI_DW_TXD_DIV int "Designware SSI TX Drive edge divisor" default 4 diff --git a/drivers/mspi/mspi_dw.c b/drivers/mspi/mspi_dw.c index 66f257839aa4..f1195314c6c2 100644 --- a/drivers/mspi/mspi_dw.c +++ b/drivers/mspi/mspi_dw.c @@ -71,6 +71,12 @@ struct mspi_dw_data { /* For locking of controller configuration. */ struct k_sem cfg_lock; struct mspi_xfer xfer; + +#if defined(CONFIG_MSPI_DW_HANDLE_FIFOS_IN_SYSTEM_WORKQUEUE) + struct k_work fifo_work; + const struct device *dev; + uint32_t imr; +#endif }; struct mspi_dw_config { @@ -111,7 +117,7 @@ DEFINE_MM_REG_RD_WR(rxftlr, 0x1c) DEFINE_MM_REG_RD(txflr, 0x20) DEFINE_MM_REG_RD(rxflr, 0x24) DEFINE_MM_REG_RD(sr, 0x28) -DEFINE_MM_REG_WR(imr, 0x2c) +DEFINE_MM_REG_RD_WR(imr, 0x2c) DEFINE_MM_REG_RD(isr, 0x30) DEFINE_MM_REG_RD(risr, 0x34) DEFINE_MM_REG_RD_WR(dr, 0x60) @@ -218,6 +224,8 @@ static bool tx_dummy_bytes(const struct device *dev) write_dr(dev, dummy_val); } while (--dummy_bytes); + dev_data->dummy_bytes = 0; + /* Set the TX start level to 0, so that the transmission will be * started now if it hasn't been yet. The threshold value is also * set to 0 here, but it doesn't really matter, as the interrupt @@ -280,7 +288,18 @@ static bool read_rx_fifo(const struct device *dev, return false; } -static void mspi_dw_isr(const struct device *dev) +static inline void set_imr(const struct device *dev, uint32_t imr) +{ +#if defined(CONFIG_MSPI_DW_HANDLE_FIFOS_IN_SYSTEM_WORKQUEUE) + struct mspi_dw_data *dev_data = dev->data; + + dev_data->imr = imr; +#else + write_imr(dev, imr); +#endif +} + +static void handle_fifos(const struct device *dev) { struct mspi_dw_data *dev_data = dev->data; const struct mspi_xfer_packet *packet = @@ -302,42 +321,82 @@ static void mspi_dw_isr(const struct device *dev) finished = true; } } else { - uint32_t int_status = read_isr(dev); + for (;;) { + /* Use RISR, not ISR, because when this function is + * executed through the system workqueue, all interrupts + * are masked (IMR is 0). + */ + uint32_t int_status = read_risr(dev); - do { - if (int_status & ISR_RXFIS_BIT) { + if (int_status & RISR_RXFIR_BIT) { if (read_rx_fifo(dev, packet)) { finished = true; break; } - if (read_risr(dev) & RISR_RXOIR_BIT) { + if (int_status & RISR_RXOIR_BIT) { finished = true; break; } - int_status = read_isr(dev); + /* Refresh interrupt status, as during reading + * from the RX FIFO, the TX FIFO status might + * have changed. + */ + int_status = read_risr(dev); } - if (int_status & ISR_TXEIS_BIT) { - if (tx_dummy_bytes(dev)) { - /* All the required dummy bytes were - * written to the FIFO; disable the TXE - * interrupt, as it's no longer needed. - */ - write_imr(dev, IMR_RXFIM_BIT); - } + if (dev_data->dummy_bytes == 0 || + !(int_status & RISR_TXEIR_BIT)) { + break; + } - int_status = read_isr(dev); + if (tx_dummy_bytes(dev)) { + /* All the required dummy bytes were written + * to the FIFO; disable the TXE interrupt, + * as it's no longer needed. + */ + set_imr(dev, IMR_RXFIM_BIT); } - } while (int_status != 0); + } } if (finished) { - write_imr(dev, 0); + set_imr(dev, 0); k_sem_give(&dev_data->finished); } +} + +#if defined(CONFIG_MSPI_DW_HANDLE_FIFOS_IN_SYSTEM_WORKQUEUE) +static void fifo_work_handler(struct k_work *work) +{ + struct mspi_dw_data *dev_data = + CONTAINER_OF(work, struct mspi_dw_data, fifo_work); + const struct device *dev = dev_data->dev; + + handle_fifos(dev); + + write_imr(dev, dev_data->imr); +} +#endif + +static void mspi_dw_isr(const struct device *dev) +{ +#if defined(CONFIG_MSPI_DW_HANDLE_FIFOS_IN_SYSTEM_WORKQUEUE) + struct mspi_dw_data *dev_data = dev->data; + int rc; + + dev_data->imr = read_imr(dev); + write_imr(dev, 0); + + rc = k_work_submit(&dev_data->fifo_work); + if (rc < 0) { + LOG_ERR("k_work_submit failed: %d\n", rc); + } +#else + handle_fifos(dev); +#endif vendor_specific_irq_clear(dev); } @@ -1426,6 +1485,11 @@ static int dev_init(const struct device *dev) k_sem_init(&dev_data->cfg_lock, 1, 1); k_sem_init(&dev_data->ctx_lock, 1, 1); +#if defined(CONFIG_MSPI_DW_HANDLE_FIFOS_IN_SYSTEM_WORKQUEUE) + dev_data->dev = dev; + k_work_init(&dev_data->fifo_work, fifo_work_handler); +#endif + for (ce_gpio = dev_config->ce_gpios; ce_gpio < &dev_config->ce_gpios[dev_config->ce_gpios_len]; ce_gpio++) { From f6f6640eb9b6c0fd646a496142333a484d5230d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Wed, 24 Sep 2025 09:36:30 +0200 Subject: [PATCH 1752/2141] [nrf fromtree] tests: mspi: flash: Add scenario for new mspi_dw option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add test scenario for a Kconfig option that was recently added to the mspi_dw driver. Testing it requires performing some transfers on the MSPI bus with some device, hence flash chip test used. Signed-off-by: Andrzej Głąbek (cherry picked from commit b624a0757de441f3d687c6c8ed988e77703a80c1) --- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 23 ++++++++++++++++++ tests/drivers/mspi/flash/testcase.yaml | 24 +++++++++++-------- 2 files changed, 37 insertions(+), 10 deletions(-) create mode 100644 tests/drivers/mspi/flash/boards/nrf54h20dk_nrf54h20_cpuapp.overlay diff --git a/tests/drivers/mspi/flash/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/mspi/flash/boards/nrf54h20dk_nrf54h20_cpuapp.overlay new file mode 100644 index 000000000000..6e0d84e07cdb --- /dev/null +++ b/tests/drivers/mspi/flash/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + aliases { + mspi0 = &exmif; + }; +}; + +&gpio6 { + status = "okay"; +}; + +&exmif { + status = "okay"; +}; + +&mx25uw63 { + status = "okay"; +}; diff --git a/tests/drivers/mspi/flash/testcase.yaml b/tests/drivers/mspi/flash/testcase.yaml index 72755fd2aa43..dba610a40235 100644 --- a/tests/drivers/mspi/flash/testcase.yaml +++ b/tests/drivers/mspi/flash/testcase.yaml @@ -1,16 +1,18 @@ # Copyright (c) 2024 Ambiq Micro Inc. # SPDX-License-Identifier: Apache-2.0 +common: + tags: + - drivers + - mspi + - flash + harness: ztest + tests: drivers.mspi.flash: - tags: - - drivers - - mspi - - flash filter: dt_compat_enabled("zephyr,mspi-emul-flash") or dt_compat_enabled("jedec,spi-nor") or dt_compat_enabled("jedec,mspi-nor") or dt_compat_enabled("mspi-atxp032") or dt_compat_enabled("mspi-is25xX0xx") - harness: ztest platform_allow: - native_sim - apollo3p_evb @@ -20,15 +22,17 @@ tests: - apollo3p_evb - apollo510_evb drivers.mspi.flash.xip_read: - tags: - - drivers - - mspi - - flash filter: dt_compat_enabled("mspi-is25xX0xx") - harness: ztest platform_allow: - apollo510_evb integration_platforms: - apollo510_evb extra_configs: - CONFIG_FLASH_MSPI_XIP_READ=y + drivers.mspi.flash.mspi_dw_system_workqueue: + filter: dt_alias_exists("mspi0") and dt_compat_enabled("jedec,mspi-nor") + and CONFIG_MSPI_DW + integration_platforms: + - nrf54h20dk/nrf54h20/cpuapp + extra_configs: + - CONFIG_MSPI_DW_HANDLE_FIFOS_IN_SYSTEM_WORKQUEUE=y From 9eeaf2dc523b83ff821a31bdc9035793376e2fde Mon Sep 17 00:00:00 2001 From: Nicolae Dicu Date: Wed, 17 Sep 2025 14:44:03 +0300 Subject: [PATCH 1753/2141] [nrf fromtree] scripts: requirements: Use gitlint-core for loose requirements Gitlint-core has loose requirements and not conflicting with scancode-toolkit v32.4.1 (click==8.1.3 vs click>=8.2.0). Signed-off-by: Nicolae Dicu (cherry picked from commit 67b4063a207ab87c28851513246b28433ef101ed) --- scripts/requirements-actions.in | 2 +- scripts/requirements-actions.txt | 6 +----- scripts/requirements-compliance.txt | 2 +- scripts/requirements-extras.txt | 2 +- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/scripts/requirements-actions.in b/scripts/requirements-actions.in index 6baf9dc9e3f4..cc170f59d779 100644 --- a/scripts/requirements-actions.in +++ b/scripts/requirements-actions.in @@ -6,7 +6,7 @@ clang-format>=15.0.0 elasticsearch<9 exceptiongroup>=1.0.0rc8 gcovr==6.0 -gitlint>=0.19.1 +gitlint-core>=0.19.1 gitpython>=3.1.41 ijson intelhex diff --git a/scripts/requirements-actions.txt b/scripts/requirements-actions.txt index 21505203bfa6..32173378473d 100644 --- a/scripts/requirements-actions.txt +++ b/scripts/requirements-actions.txt @@ -345,14 +345,10 @@ gitdb==4.0.12 \ --hash=sha256:5ef71f855d191a3326fcfbc0d5da835f26b13fbcba60c32c21091c349ffdb571 \ --hash=sha256:67073e15955400952c6565cc3e707c554a4eea2e428946f7a4c162fab9bd9bcf # via gitpython -gitlint==0.19.1 \ - --hash=sha256:26bb085959148d99fbbc178b4e56fda6c3edd7646b7c2a24d8ee1f8e036ed85d \ - --hash=sha256:b5b70fb894e80849b69abbb65ee7dbb3520fc3511f202a6e6b6ddf1a71ee8f61 - # via -r requirements-actions.in gitlint-core==0.19.1 \ --hash=sha256:7bf977b03ff581624a9e03f65ebb8502cc12dfaa3e92d23e8b2b54bbdaa29992 \ --hash=sha256:f41effd1dcbc06ffbfc56b6888cce72241796f517b46bd9fd4ab1b145056988c - # via gitlint + # via -r requirements-actions.in gitpython==3.1.44 \ --hash=sha256:9e0e10cda9bed1ee64bc9a6de50e7e38a9c9943241cd7f585f6df3ed28011110 \ --hash=sha256:c87e30b26253bf5418b01b0660f818967f3c503193838337fe5e573331249269 diff --git a/scripts/requirements-compliance.txt b/scripts/requirements-compliance.txt index 6d90ac4b2587..dcb8baae0f97 100644 --- a/scripts/requirements-compliance.txt +++ b/scripts/requirements-compliance.txt @@ -3,7 +3,7 @@ # used by ci/check_compliance # zephyr-keep-sorted-start clang-format>=15.0.0 -gitlint +gitlint-core junitparser>=4.0.1 lxml>=5.3.0 pykwalify diff --git a/scripts/requirements-extras.txt b/scripts/requirements-extras.txt index 59f2eb3ff986..b7a93427d725 100644 --- a/scripts/requirements-extras.txt +++ b/scripts/requirements-extras.txt @@ -10,7 +10,7 @@ gitpython>=3.1.41 plotly # helper for developers - check git commit messages -gitlint +gitlint-core # helper for developers junit2html From 2c928b8d90400f760e4f4e224555ae57ead8bf7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Tue, 16 Sep 2025 21:31:41 +0200 Subject: [PATCH 1754/2141] [nrf fromtree] tests: ram_context_for_isr: pick an available IRQ for Nuvoton platforms MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit NPCX7, NPCX9, and NPCK3 platforms have their (NUM_IRQS-1) IRQ taken, so set CONFIG_TEST_IRQ_NUM to a different available IRQ. Signed-off-by: Benjamin Cabé (cherry picked from commit f8e183c3db91fdff831fea0e2a6d7df650806100) --- tests/application_development/ram_context_for_isr/Kconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/application_development/ram_context_for_isr/Kconfig b/tests/application_development/ram_context_for_isr/Kconfig index 30f2e20a3d12..7bd3688470f6 100644 --- a/tests/application_development/ram_context_for_isr/Kconfig +++ b/tests/application_development/ram_context_for_isr/Kconfig @@ -10,6 +10,7 @@ config TEST_IRQ_NUM default 14 if GIC default 22 if SOC_SERIES_DA1469X default 18 if SOC_SERIES_STM32C0X + default 1 if (SOC_SERIES_NPCX9 || SOC_SERIES_NPCX7 || SOC_SERIES_NPCK3) default 0 help IRQ number to use for testing purposes. This should be an @@ -20,6 +21,7 @@ config TEST_IRQ_NUM - GIC platforms: 14 (available test SGI - Software Generated Interrupt) - DA1469X series: 22 (available test IRQ) - STM32C0X series: 18 (available test IRQ) + - NPCX9, NPCX7, NPCK3 series: 1 (unused IRQ not mapped to MIWU groups) - Other platforms: 0 (magic config value to select the last IRQ: NUM_IRQS - 1) config TEST_IRQ_PRIO From adb2e3088b950dd42dcf9aa958f327fd0fa4526f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Tue, 16 Sep 2025 23:22:12 +0200 Subject: [PATCH 1755/2141] [nrf fromtree] tests: ram_context_for_isr: pick an available IRQ for nxp_k32l2b3 soc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (NUM_IRQS-1) IRQ is taken on this soc, so set CONFIG_TEST_IRQ_NUM to a different available IRQ to avoid test failure. Signed-off-by: Benjamin Cabé (cherry picked from commit 6610b8c8b2c10701ee87da28d3ffbe1b2e4d132c) --- tests/application_development/ram_context_for_isr/Kconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/application_development/ram_context_for_isr/Kconfig b/tests/application_development/ram_context_for_isr/Kconfig index 7bd3688470f6..61b3a4224949 100644 --- a/tests/application_development/ram_context_for_isr/Kconfig +++ b/tests/application_development/ram_context_for_isr/Kconfig @@ -11,6 +11,7 @@ config TEST_IRQ_NUM default 22 if SOC_SERIES_DA1469X default 18 if SOC_SERIES_STM32C0X default 1 if (SOC_SERIES_NPCX9 || SOC_SERIES_NPCX7 || SOC_SERIES_NPCK3) + default 29 if SOC_K32L2B31A default 0 help IRQ number to use for testing purposes. This should be an @@ -22,6 +23,7 @@ config TEST_IRQ_NUM - DA1469X series: 22 (available test IRQ) - STM32C0X series: 18 (available test IRQ) - NPCX9, NPCX7, NPCK3 series: 1 (unused IRQ not mapped to MIWU groups) + - K32L2B31A: 29 (available test IRQ) - Other platforms: 0 (magic config value to select the last IRQ: NUM_IRQS - 1) config TEST_IRQ_PRIO From 28a66c4596248370f2e47b7ac8ec097ca6a0170f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Stasiak?= Date: Thu, 25 Sep 2025 08:01:11 +0200 Subject: [PATCH 1756/2141] [nrf fromlist] tests: ram_context_for_isr: pick IRQ number for nRF54L MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Picked IRQ number available on all platforms. Upstream PR #: 96531 Signed-off-by: Michał Stasiak --- tests/application_development/ram_context_for_isr/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/application_development/ram_context_for_isr/Kconfig b/tests/application_development/ram_context_for_isr/Kconfig index 61b3a4224949..b4031538b4b9 100644 --- a/tests/application_development/ram_context_for_isr/Kconfig +++ b/tests/application_development/ram_context_for_isr/Kconfig @@ -12,6 +12,7 @@ config TEST_IRQ_NUM default 18 if SOC_SERIES_STM32C0X default 1 if (SOC_SERIES_NPCX9 || SOC_SERIES_NPCX7 || SOC_SERIES_NPCK3) default 29 if SOC_K32L2B31A + default 28 if SOC_SERIES_NRF54LX default 0 help IRQ number to use for testing purposes. This should be an From 36d18bbab2375b7e5c95ba49a303f3214b8e1030 Mon Sep 17 00:00:00 2001 From: Karsten Koenig Date: Tue, 23 Sep 2025 14:51:49 +0200 Subject: [PATCH 1757/2141] [nrf fromtree] soc: nordic: common: uicr: Add GRTC fast clkout Add the mapping for the GRTC_CLKOUT_FAST pinctrl mapping to the periphconf generation. This allows clocking out the 16MHz clock with a user selectable divider. Signed-off-by: Karsten Koenig (cherry picked from commit 19f709910fe53fcff64fb36fd02c0a56f6042365) --- soc/nordic/common/uicr/gen_periphconf_entries.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/soc/nordic/common/uicr/gen_periphconf_entries.py b/soc/nordic/common/uicr/gen_periphconf_entries.py index e70e56acc1f3..92f5f1d24559 100644 --- a/soc/nordic/common/uicr/gen_periphconf_entries.py +++ b/soc/nordic/common/uicr/gen_periphconf_entries.py @@ -395,6 +395,12 @@ def lookup_tables_get(soc: Soc) -> SocLookupTables: NrfPsel(fun=NrfFun.TDM_FSYNC_M, port=2, pin=7): Ctrlsel.CAN_TDM_SERIAL2, NrfPsel(fun=NrfFun.TDM_FSYNC_S, port=2, pin=7): Ctrlsel.CAN_TDM_SERIAL2, }, + # GRTC + 0x5F99_C000: { + NrfPsel(fun=NrfFun.GRTC_CLKOUT_FAST, port=1, pin=8): Ctrlsel.CAN_TDM_SERIAL2, + NrfPsel(fun=NrfFun.GRTC_CLKOUT_FAST, port=2, pin=5): Ctrlsel.CAN_TDM_SERIAL2, + NrfPsel(fun=NrfFun.GRTC_CLKOUT_FAST, port=9, pin=0): Ctrlsel.SERIAL0, + }, # GPIOTE0 (RAD) 0x5302_7000: { # P1 From 9c01b7e0c418c4ca468f5ba71c775b11cf77d8a7 Mon Sep 17 00:00:00 2001 From: Rafal Dyla Date: Thu, 24 Apr 2025 10:50:14 +0200 Subject: [PATCH 1758/2141] [nrf fromtree] arch: riscv: Support for Direct ISRs for RISCV targets Added missing features and configuration to support Direct ISRs Signed-off-by: Rafal Dyla (cherry picked from commit 3cf2627d850b78a3970e0ec7a1ba3b3769b71047) --- arch/riscv/core/irq_manage.c | 17 +++++++++++++++++ drivers/timer/nrf_grtc_timer.c | 15 +++++++++++++++ include/zephyr/arch/riscv/irq.h | 9 +++++++++ 3 files changed, 41 insertions(+) diff --git a/arch/riscv/core/irq_manage.c b/arch/riscv/core/irq_manage.c index 8ba7b615b422..3d18ec59dba3 100644 --- a/arch/riscv/core/irq_manage.c +++ b/arch/riscv/core/irq_manage.c @@ -10,6 +10,7 @@ #include #include #include +#include #ifdef CONFIG_RISCV_HAS_PLIC #include @@ -75,3 +76,19 @@ int arch_irq_disconnect_dynamic(unsigned int irq, unsigned int priority, } #endif /* CONFIG_SHARED_INTERRUPTS */ #endif /* CONFIG_DYNAMIC_INTERRUPTS */ + +#ifdef CONFIG_PM +void arch_isr_direct_pm(void) +{ + unsigned int key; + + key = irq_lock(); + + if (_kernel.idle) { + _kernel.idle = 0; + pm_system_resume(); + } + + irq_unlock(key); +} +#endif diff --git a/drivers/timer/nrf_grtc_timer.c b/drivers/timer/nrf_grtc_timer.c index 4e1223635085..df59b9f6d4b6 100644 --- a/drivers/timer/nrf_grtc_timer.c +++ b/drivers/timer/nrf_grtc_timer.c @@ -459,12 +459,27 @@ uint32_t sys_clock_elapsed(void) return (uint32_t)(counter_sub(counter(), last_count) / CYC_PER_TICK); } +#if !defined(CONFIG_GEN_SW_ISR_TABLE) +ISR_DIRECT_DECLARE(nrfx_grtc_direct_irq_handler) +{ + nrfx_grtc_irq_handler(); + ISR_DIRECT_PM(); + return 1; +} +#endif + static int sys_clock_driver_init(void) { nrfx_err_t err_code; +#if defined(CONFIG_GEN_SW_ISR_TABLE) IRQ_CONNECT(DT_IRQN(GRTC_NODE), DT_IRQ(GRTC_NODE, priority), nrfx_isr, nrfx_grtc_irq_handler, 0); +#else + IRQ_DIRECT_CONNECT(DT_IRQN(GRTC_NODE), DT_IRQ(GRTC_NODE, priority), + nrfx_grtc_direct_irq_handler, 0); + irq_enable(DT_IRQN(GRTC_NODE)); +#endif #if defined(CONFIG_NRF_GRTC_TIMER_CLOCK_MANAGEMENT) && NRF_GRTC_HAS_CLKSEL #if defined(CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC) diff --git a/include/zephyr/arch/riscv/irq.h b/include/zephyr/arch/riscv/irq.h index 8408912716a7..c3c4baff3518 100644 --- a/include/zephyr/arch/riscv/irq.h +++ b/include/zephyr/arch/riscv/irq.h @@ -83,6 +83,15 @@ extern void z_riscv_irq_vector_set(unsigned int irq); z_riscv_irq_vector_set(irq_p); \ } +#ifdef CONFIG_PM +extern void arch_isr_direct_pm(void); +#define ARCH_ISR_DIRECT_PM() arch_isr_direct_pm() +#else +#define ARCH_ISR_DIRECT_PM() \ + do { \ + } while (false) +#endif + #define ARCH_ISR_DIRECT_HEADER() arch_isr_direct_header() #define ARCH_ISR_DIRECT_FOOTER(swap) arch_isr_direct_footer(swap) From c539d475b659949cf96c1638cf7fbafbf64d33f3 Mon Sep 17 00:00:00 2001 From: Bartosz Miller Date: Wed, 24 Sep 2025 08:39:30 +0200 Subject: [PATCH 1759/2141] [nrf fromtree] drivers: i2c: Extend i2c testing on nrf54h20 PPR Enable all possible i2c tests on CPUPPR Signed-off-by: Bartosz Miller (cherry picked from commit b60633b3a6189a83902209f679ff666f95fded0b) --- .../boards/nrf54h20dk_nrf54h20_cpuppr.conf | 4 + .../boards/nrf54h20dk_nrf54h20_cpuppr.overlay | 69 +++++++++++++ samples/drivers/i2c/rtio_loopback/sample.yaml | 1 + .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 15 +++ .../sysbuild/vpr_launcher/prj.conf | 3 + .../boards/nrf54h20dk_nrf54h20_cpuppr.overlay | 70 +++++++++++++ .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 15 +++ .../sysbuild/vpr_launcher/prj.conf | 3 + tests/drivers/i2c/i2c_nrfx_twim/testcase.yaml | 1 + .../boards/nrf54h20dk_nrf54h20_cpuppr.conf | 5 + .../boards/nrf54h20dk_nrf54h20_cpuppr.overlay | 97 +++++++++++++++++++ .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 15 +++ .../sysbuild/vpr_launcher/prj.conf | 3 + .../drivers/i2c/i2c_target_api/testcase.yaml | 1 + 14 files changed, 302 insertions(+) create mode 100644 samples/drivers/i2c/rtio_loopback/boards/nrf54h20dk_nrf54h20_cpuppr.conf create mode 100644 samples/drivers/i2c/rtio_loopback/boards/nrf54h20dk_nrf54h20_cpuppr.overlay create mode 100644 samples/drivers/i2c/rtio_loopback/sysbuild/vpr_launcher/boards/nrf54h20dk_nrf54h20_cpuapp.overlay create mode 100644 samples/drivers/i2c/rtio_loopback/sysbuild/vpr_launcher/prj.conf create mode 100644 tests/drivers/i2c/i2c_nrfx_twim/boards/nrf54h20dk_nrf54h20_cpuppr.overlay create mode 100644 tests/drivers/i2c/i2c_nrfx_twim/sysbuild/vpr_launcher/boards/nrf54h20dk_nrf54h20_cpuapp.overlay create mode 100644 tests/drivers/i2c/i2c_nrfx_twim/sysbuild/vpr_launcher/prj.conf create mode 100644 tests/drivers/i2c/i2c_target_api/boards/nrf54h20dk_nrf54h20_cpuppr.conf create mode 100644 tests/drivers/i2c/i2c_target_api/boards/nrf54h20dk_nrf54h20_cpuppr.overlay create mode 100644 tests/drivers/i2c/i2c_target_api/sysbuild/vpr_launcher/boards/nrf54h20dk_nrf54h20_cpuapp.overlay create mode 100644 tests/drivers/i2c/i2c_target_api/sysbuild/vpr_launcher/prj.conf diff --git a/samples/drivers/i2c/rtio_loopback/boards/nrf54h20dk_nrf54h20_cpuppr.conf b/samples/drivers/i2c/rtio_loopback/boards/nrf54h20dk_nrf54h20_cpuppr.conf new file mode 100644 index 000000000000..7dfef7da2839 --- /dev/null +++ b/samples/drivers/i2c/rtio_loopback/boards/nrf54h20dk_nrf54h20_cpuppr.conf @@ -0,0 +1,4 @@ +# Copyright (c) 2025 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_I2C_NRFX_TWIS_BUF_SIZE=256 diff --git a/samples/drivers/i2c/rtio_loopback/boards/nrf54h20dk_nrf54h20_cpuppr.overlay b/samples/drivers/i2c/rtio_loopback/boards/nrf54h20dk_nrf54h20_cpuppr.overlay new file mode 100644 index 000000000000..f31ea5090df8 --- /dev/null +++ b/samples/drivers/i2c/rtio_loopback/boards/nrf54h20dk_nrf54h20_cpuppr.overlay @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * SDA = P2.8 and P2.9 + * SCL = P1.2 and P1.3 + */ + +/ { + aliases { + i2c-controller = &i2c130; + i2c-controller-target = &i2c131; + }; +}; + +&pinctrl { + i2c130_default: i2c130_default { + group1 { + psels = , + ; + bias-pull-up; + }; + }; + + i2c130_sleep: i2c130_sleep { + group1 { + psels = , + ; + low-power-enable; + }; + }; + + i2c131_default: i2c131_default { + group1 { + psels = , + ; + bias-pull-up; + }; + }; + + i2c131_sleep: i2c131_sleep { + group1 { + psels = , + ; + low-power-enable; + }; + }; +}; + +&i2c130 { + clock-frequency = ; + pinctrl-0 = <&i2c130_default>; + pinctrl-1 = <&i2c130_sleep>; + pinctrl-names = "default", "sleep"; + zephyr,concat-buf-size = <256>; + status = "okay"; +}; + +&i2c131 { + compatible = "nordic,nrf-twis"; + clock-frequency = ; + pinctrl-0 = <&i2c131_default>; + pinctrl-1 = <&i2c131_sleep>; + pinctrl-names = "default", "sleep"; + status = "okay"; +}; diff --git a/samples/drivers/i2c/rtio_loopback/sample.yaml b/samples/drivers/i2c/rtio_loopback/sample.yaml index a356a2697fdd..dadfe1fff98e 100644 --- a/samples/drivers/i2c/rtio_loopback/sample.yaml +++ b/samples/drivers/i2c/rtio_loopback/sample.yaml @@ -15,6 +15,7 @@ tests: - b_u585i_iot02a - nrf5340dk/nrf5340/cpuapp - nrf54h20dk/nrf54h20/cpuapp + - nrf54h20dk/nrf54h20/cpuppr - nrf54l15dk/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - nucleo_f401re diff --git a/samples/drivers/i2c/rtio_loopback/sysbuild/vpr_launcher/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/samples/drivers/i2c/rtio_loopback/sysbuild/vpr_launcher/boards/nrf54h20dk_nrf54h20_cpuapp.overlay new file mode 100644 index 000000000000..69aedabd69dc --- /dev/null +++ b/samples/drivers/i2c/rtio_loopback/sysbuild/vpr_launcher/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&i2c130 { + status = "reserved"; + interrupt-parent = <&cpuppr_clic>; +}; + +&i2c131 { + status = "reserved"; + interrupt-parent = <&cpuppr_clic>; +}; diff --git a/samples/drivers/i2c/rtio_loopback/sysbuild/vpr_launcher/prj.conf b/samples/drivers/i2c/rtio_loopback/sysbuild/vpr_launcher/prj.conf new file mode 100644 index 000000000000..d6c8f934808e --- /dev/null +++ b/samples/drivers/i2c/rtio_loopback/sysbuild/vpr_launcher/prj.conf @@ -0,0 +1,3 @@ +# Copyright (c) 2025 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 +# nothing here diff --git a/tests/drivers/i2c/i2c_nrfx_twim/boards/nrf54h20dk_nrf54h20_cpuppr.overlay b/tests/drivers/i2c/i2c_nrfx_twim/boards/nrf54h20dk_nrf54h20_cpuppr.overlay new file mode 100644 index 000000000000..1d4259cacc11 --- /dev/null +++ b/tests/drivers/i2c/i2c_nrfx_twim/boards/nrf54h20dk_nrf54h20_cpuppr.overlay @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * SDA = P2.8 and P2.9 + * SCL = P1.2 and P1.3 + */ + +/ { + aliases { + i2c-controller = &i2c130; + i2c-controller-target = &i2c131; + }; +}; + +&pinctrl { + i2c130_default: i2c130_default { + group1 { + psels = , + ; + bias-pull-up; + }; + }; + + i2c130_sleep: i2c130_sleep { + group1 { + psels = , + ; + low-power-enable; + }; + }; + + i2c131_default: i2c131_default { + group1 { + psels = , + ; + bias-pull-up; + }; + }; + + i2c131_sleep: i2c131_sleep { + group1 { + psels = , + ; + low-power-enable; + }; + }; +}; + +&i2c130 { + compatible = "nordic,nrf-twim"; + clock-frequency = ; + pinctrl-0 = <&i2c130_default>; + pinctrl-1 = <&i2c130_sleep>; + pinctrl-names = "default", "sleep"; + zephyr,concat-buf-size = <256>; + status = "okay"; +}; + +&i2c131 { + compatible = "nordic,nrf-twis"; + clock-frequency = ; + pinctrl-0 = <&i2c131_default>; + pinctrl-1 = <&i2c131_sleep>; + pinctrl-names = "default", "sleep"; + status = "okay"; +}; diff --git a/tests/drivers/i2c/i2c_nrfx_twim/sysbuild/vpr_launcher/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/i2c/i2c_nrfx_twim/sysbuild/vpr_launcher/boards/nrf54h20dk_nrf54h20_cpuapp.overlay new file mode 100644 index 000000000000..69aedabd69dc --- /dev/null +++ b/tests/drivers/i2c/i2c_nrfx_twim/sysbuild/vpr_launcher/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&i2c130 { + status = "reserved"; + interrupt-parent = <&cpuppr_clic>; +}; + +&i2c131 { + status = "reserved"; + interrupt-parent = <&cpuppr_clic>; +}; diff --git a/tests/drivers/i2c/i2c_nrfx_twim/sysbuild/vpr_launcher/prj.conf b/tests/drivers/i2c/i2c_nrfx_twim/sysbuild/vpr_launcher/prj.conf new file mode 100644 index 000000000000..d6c8f934808e --- /dev/null +++ b/tests/drivers/i2c/i2c_nrfx_twim/sysbuild/vpr_launcher/prj.conf @@ -0,0 +1,3 @@ +# Copyright (c) 2025 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 +# nothing here diff --git a/tests/drivers/i2c/i2c_nrfx_twim/testcase.yaml b/tests/drivers/i2c/i2c_nrfx_twim/testcase.yaml index e35dd49dbb76..4fa30bae7e84 100644 --- a/tests/drivers/i2c/i2c_nrfx_twim/testcase.yaml +++ b/tests/drivers/i2c/i2c_nrfx_twim/testcase.yaml @@ -12,6 +12,7 @@ tests: platform_allow: - nrf5340dk/nrf5340/cpuapp - nrf54h20dk/nrf54h20/cpuapp + - nrf54h20dk/nrf54h20/cpuppr - nrf54l15dk/nrf54l15/cpuapp integration_platforms: - nrf5340dk/nrf5340/cpuapp diff --git a/tests/drivers/i2c/i2c_target_api/boards/nrf54h20dk_nrf54h20_cpuppr.conf b/tests/drivers/i2c/i2c_target_api/boards/nrf54h20dk_nrf54h20_cpuppr.conf new file mode 100644 index 000000000000..baa00bdf40f7 --- /dev/null +++ b/tests/drivers/i2c/i2c_target_api/boards/nrf54h20dk_nrf54h20_cpuppr.conf @@ -0,0 +1,5 @@ +# Copyright (c) 2025 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_I2C_NRFX_TWIS_BUF_SIZE=256 +CONFIG_GPIO=y diff --git a/tests/drivers/i2c/i2c_target_api/boards/nrf54h20dk_nrf54h20_cpuppr.overlay b/tests/drivers/i2c/i2c_target_api/boards/nrf54h20dk_nrf54h20_cpuppr.overlay new file mode 100644 index 000000000000..0138f287de8e --- /dev/null +++ b/tests/drivers/i2c/i2c_target_api/boards/nrf54h20dk_nrf54h20_cpuppr.overlay @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * SDA = P2.8 and P2.9 + * SCL = P1.2 and P1.3 + */ + +/ { + zephyr,user { + sda0-gpios = <&gpio2 8 0>; + scl0-gpios = <&gpio1 2 0>; + sda1-gpios = <&gpio2 9 0>; + scl1-gpios = <&gpio1 3 0>; + }; +}; + +&gpio1 { + status = "okay"; +}; + +&gpio2 { + status = "okay"; +}; + +&pinctrl { + i2c130_default: i2c130_default { + group1 { + psels = , + ; + bias-pull-up; + }; + }; + + i2c130_sleep: i2c130_sleep { + group1 { + psels = , + ; + low-power-enable; + }; + }; + + i2c131_default: i2c131_default { + group1 { + psels = , + ; + bias-pull-up; + }; + }; + + i2c131_sleep: i2c131_sleep { + group1 { + psels = , + ; + low-power-enable; + }; + }; +}; + +&i2c130 { + clock-frequency = ; + pinctrl-0 = <&i2c130_default>; + pinctrl-1 = <&i2c130_sleep>; + pinctrl-names = "default", "sleep"; + zephyr,concat-buf-size = <256>; + status = "okay"; + + eeprom1: eeprom@56 { + compatible = "zephyr,i2c-target-eeprom"; + reg = <0x56>; + address-width = <8>; + size = <256>; + }; +}; + +&i2c131 { + compatible = "nordic,nrf-twis"; + clock-frequency = ; + pinctrl-0 = <&i2c131_default>; + pinctrl-1 = <&i2c131_sleep>; + pinctrl-names = "default", "sleep"; + status = "okay"; + + eeprom0: eeprom@54 { + compatible = "zephyr,i2c-target-eeprom"; + reg = <0x54>; + address-width = <8>; + size = <256>; + }; +}; + +&gpiote130 { + status = "okay"; +}; diff --git a/tests/drivers/i2c/i2c_target_api/sysbuild/vpr_launcher/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/i2c/i2c_target_api/sysbuild/vpr_launcher/boards/nrf54h20dk_nrf54h20_cpuapp.overlay new file mode 100644 index 000000000000..69aedabd69dc --- /dev/null +++ b/tests/drivers/i2c/i2c_target_api/sysbuild/vpr_launcher/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&i2c130 { + status = "reserved"; + interrupt-parent = <&cpuppr_clic>; +}; + +&i2c131 { + status = "reserved"; + interrupt-parent = <&cpuppr_clic>; +}; diff --git a/tests/drivers/i2c/i2c_target_api/sysbuild/vpr_launcher/prj.conf b/tests/drivers/i2c/i2c_target_api/sysbuild/vpr_launcher/prj.conf new file mode 100644 index 000000000000..d6c8f934808e --- /dev/null +++ b/tests/drivers/i2c/i2c_target_api/sysbuild/vpr_launcher/prj.conf @@ -0,0 +1,3 @@ +# Copyright (c) 2025 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 +# nothing here diff --git a/tests/drivers/i2c/i2c_target_api/testcase.yaml b/tests/drivers/i2c/i2c_target_api/testcase.yaml index 13ef2bb16c4c..35207c6ab91b 100644 --- a/tests/drivers/i2c/i2c_target_api/testcase.yaml +++ b/tests/drivers/i2c/i2c_target_api/testcase.yaml @@ -65,6 +65,7 @@ tests: - max32690evkit/max32690/m4 - nrf5340dk/nrf5340/cpuapp - nrf54h20dk/nrf54h20/cpuapp + - nrf54h20dk/nrf54h20/cpuppr - nrf54l15dk/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp From 3e5563d6ed656706b61b93458c0f96fbf55e23ea Mon Sep 17 00:00:00 2001 From: Matthias Hauser Date: Fri, 12 Sep 2025 09:51:06 +0200 Subject: [PATCH 1760/2141] [nrf fromtree] boards: we: update WE ophelia4 board definition add support for gpregret1, nfct Signed-off-by: Matthias Hauser Signed-off-by: Matthias Hauser (cherry picked from commit 17e1429589b259b6d4e0e09b0f136022959dfa9a) --- boards/we/ophelia4ev/Kconfig.defconfig | 3 ++ .../ophelia4ev/ophelia4ev_nrf54l15_cpuapp.dts | 29 ++++++++++++++++--- .../ophelia4ev_nrf54l15_cpuapp_defconfig | 3 -- .../ophelia4ev_nrf54l15_cpuflpr.yaml | 1 - 4 files changed, 28 insertions(+), 8 deletions(-) diff --git a/boards/we/ophelia4ev/Kconfig.defconfig b/boards/we/ophelia4ev/Kconfig.defconfig index ae367b374d7e..94e5d7e9e0c5 100644 --- a/boards/we/ophelia4ev/Kconfig.defconfig +++ b/boards/we/ophelia4ev/Kconfig.defconfig @@ -1,6 +1,9 @@ # Copyright (c) 2025 Würth Elektronik eiSos GmbH & Co. KG # SPDX-License-Identifier: Apache-2.0 +config HW_STACK_PROTECTION + default ARCH_HAS_STACK_PROTECTION + if BOARD_OPHELIA4EV_NRF54L15_CPUAPP config ROM_START_OFFSET diff --git a/boards/we/ophelia4ev/ophelia4ev_nrf54l15_cpuapp.dts b/boards/we/ophelia4ev/ophelia4ev_nrf54l15_cpuapp.dts index 2380fcd5b8d3..9acc3e1fff90 100644 --- a/boards/we/ophelia4ev/ophelia4ev_nrf54l15_cpuapp.dts +++ b/boards/we/ophelia4ev/ophelia4ev_nrf54l15_cpuapp.dts @@ -15,14 +15,20 @@ chosen { zephyr,console = &uart20; zephyr,shell-uart = &uart20; - zephyr,code-partition = &slot0_partition; - zephyr,flash = &cpuapp_rram; - zephyr,sram = &cpuapp_sram; zephyr,uart-mcumgr = &uart20; zephyr,bt-mon-uart = &uart20; zephyr,bt-c2h-uart = &uart20; zephyr,flash-controller = &rram_controller; + zephyr,flash = &cpuapp_rram; zephyr,ieee802154 = &ieee802154; + zephyr,boot-mode = &boot_mode0; + zephyr,code-partition = &slot0_partition; + zephyr,sram = &cpuapp_sram; + }; + + aliases { + mcuboot-button0 = &button0; + mcuboot-led0 = &led0; }; }; @@ -32,7 +38,7 @@ &lfxo { load-capacitors = "internal"; - load-capacitance-femtofarad = <15500>; + load-capacitance-femtofarad = <17000>; }; &hfxo { @@ -63,6 +69,10 @@ status = "okay"; }; +&nfct { + status = "okay"; +}; + &gpio0 { status = "okay"; }; @@ -99,6 +109,16 @@ status = "okay"; }; +&gpregret1 { + status = "okay"; + + boot_mode0: boot_mode@0 { + compatible = "zephyr,retention"; + status = "okay"; + reg = <0x0 0x1>; + }; +}; + &spi00 { status = "okay"; @@ -126,6 +146,7 @@ has-dpd; t-enter-dpd = <10000>; t-exit-dpd = <35000>; + reset-gpios = <&gpio2 6 GPIO_ACTIVE_LOW>; }; }; diff --git a/boards/we/ophelia4ev/ophelia4ev_nrf54l15_cpuapp_defconfig b/boards/we/ophelia4ev/ophelia4ev_nrf54l15_cpuapp_defconfig index 80a40b5a79d9..f880aa57105c 100644 --- a/boards/we/ophelia4ev/ophelia4ev_nrf54l15_cpuapp_defconfig +++ b/boards/we/ophelia4ev/ophelia4ev_nrf54l15_cpuapp_defconfig @@ -14,8 +14,5 @@ CONFIG_GPIO=y # Enable MPU CONFIG_ARM_MPU=y -# Enable hardware stack protection -CONFIG_HW_STACK_PROTECTION=y - # Use internal LFCLK CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y diff --git a/boards/we/ophelia4ev/ophelia4ev_nrf54l15_cpuflpr.yaml b/boards/we/ophelia4ev/ophelia4ev_nrf54l15_cpuflpr.yaml index a302cf4a192d..6e1264242d64 100644 --- a/boards/we/ophelia4ev/ophelia4ev_nrf54l15_cpuflpr.yaml +++ b/boards/we/ophelia4ev/ophelia4ev_nrf54l15_cpuflpr.yaml @@ -15,4 +15,3 @@ supported: - gpio - i2c - spi - - watchdog From 0c70436292c76bd67e4dc43954e28a00ee9df0a0 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Thu, 25 Sep 2025 08:28:31 +0100 Subject: [PATCH 1761/2141] Revert "[nrf noup] boards: nordic: nrf54lm20 adjust ROM_START_OFFSET" This reverts commit b4076486de7d0cad4a5f838e3b81bf330fc71fd3. Signed-off-by: Jamie McCrae --- boards/nordic/nrf54lm20dk/Kconfig.defconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/boards/nordic/nrf54lm20dk/Kconfig.defconfig b/boards/nordic/nrf54lm20dk/Kconfig.defconfig index 3424e7a9e780..1f0a706ae6ca 100644 --- a/boards/nordic/nrf54lm20dk/Kconfig.defconfig +++ b/boards/nordic/nrf54lm20dk/Kconfig.defconfig @@ -7,7 +7,6 @@ config HW_STACK_PROTECTION default ARCH_HAS_STACK_PROTECTION config ROM_START_OFFSET - default 0 if PARTITION_MANAGER_ENABLED default 0x800 if BOOTLOADER_MCUBOOT endif # BOARD_NRF54LM20DK_NRF54LM20A_CPUAPP From 847d6b8de9526cac2dee20f926a11ddb31b61ee8 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Thu, 25 Sep 2025 08:28:43 +0100 Subject: [PATCH 1762/2141] Revert "[nrf noup] boards/nordic/nrf54l15dk: Set ROM offset by PM" This reverts commit 2b3a0c68b162fdada21dabbef3027b5bd40675ee. Signed-off-by: Jamie McCrae --- boards/nordic/nrf54l15dk/Kconfig.defconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/boards/nordic/nrf54l15dk/Kconfig.defconfig b/boards/nordic/nrf54l15dk/Kconfig.defconfig index c9155426d02d..49e38070a01a 100644 --- a/boards/nordic/nrf54l15dk/Kconfig.defconfig +++ b/boards/nordic/nrf54l15dk/Kconfig.defconfig @@ -8,7 +8,6 @@ if BOARD_NRF54L15DK_NRF54L05_CPUAPP || BOARD_NRF54L15DK_NRF54L10_CPUAPP || \ BOARD_NRF54L15DK_NRF54L15_CPUAPP config ROM_START_OFFSET - default 0 if PARTITION_MANAGER_ENABLED default 0x800 if BOOTLOADER_MCUBOOT endif # BOARD_NRF54L15DK_NRF54L05_CPUAPP || BOARD_NRF54L15DK_NRF54L10_CPUAPP || \ From c8a921e501a9970afa29bf3b12bd15610a2242cc Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Mon, 22 Sep 2025 11:43:16 +0100 Subject: [PATCH 1763/2141] [nrf fromtree] soc: nordic: nrf54l: Set ROM_START_OFFSET instead of by each board Sets the default of this Kconfig for the SoC itself as a default, rather than each board setting it, which minimises the change Signed-off-by: Jamie McCrae (cherry picked from commit 69ce66d4913397f185cc2b1b713cde6e5bb2dcff) --- boards/ezurio/bl54l15_dvk/Kconfig.defconfig | 7 ------- boards/ezurio/bl54l15u_dvk/Kconfig.defconfig | 7 ------- boards/nordic/nrf54l15dk/Kconfig.defconfig | 9 --------- boards/nordic/nrf54lm20dk/Kconfig.defconfig | 3 --- boards/panasonic/panb611evb/Kconfig.defconfig | 7 ------- boards/raytac/an54l15q_db/Kconfig.defconfig | 7 ------- boards/seeed/xiao_nrf54l15/Kconfig.defconfig | 3 --- boards/we/ophelia4ev/Kconfig.defconfig | 7 ------- soc/nordic/nrf54l/Kconfig.defconfig | 3 +++ 9 files changed, 3 insertions(+), 50 deletions(-) diff --git a/boards/ezurio/bl54l15_dvk/Kconfig.defconfig b/boards/ezurio/bl54l15_dvk/Kconfig.defconfig index 78ec8fa7116a..2ff8fe6e3027 100644 --- a/boards/ezurio/bl54l15_dvk/Kconfig.defconfig +++ b/boards/ezurio/bl54l15_dvk/Kconfig.defconfig @@ -6,13 +6,6 @@ DT_CHOSEN_Z_CODE_PARTITION := zephyr,code-partition DT_CHOSEN_Z_SRAM_PARTITION := zephyr,sram-secure-partition -if BOARD_BL54L15_DVK_NRF54L10_CPUAPP || BOARD_BL54L15_DVK_NRF54L15_CPUAPP - -config ROM_START_OFFSET - default 0x800 if BOOTLOADER_MCUBOOT - -endif # BOARD_BL54L15_DVK_NRF54L10_CPUAPP || BOARD_BL54L15_DVK_NRF54L15_CPUAPP - if BOARD_BL54L15_DVK_NRF54L10_CPUAPP_NS || BOARD_BL54L15_DVK_NRF54L15_CPUAPP_NS config HAS_BT_CTLR diff --git a/boards/ezurio/bl54l15u_dvk/Kconfig.defconfig b/boards/ezurio/bl54l15u_dvk/Kconfig.defconfig index bb4934e7fd36..1e706cb66dd2 100644 --- a/boards/ezurio/bl54l15u_dvk/Kconfig.defconfig +++ b/boards/ezurio/bl54l15u_dvk/Kconfig.defconfig @@ -6,13 +6,6 @@ DT_CHOSEN_Z_CODE_PARTITION := zephyr,code-partition DT_CHOSEN_Z_SRAM_PARTITION := zephyr,sram-secure-partition -if BOARD_BL54L15U_DVK_NRF54L15_CPUAPP - -config ROM_START_OFFSET - default 0x800 if BOOTLOADER_MCUBOOT - -endif # BOARD_BL54L15U_DVK_NRF54L15_CPUAPP - if BOARD_BL54L15U_DVK_NRF54L15_CPUAPP_NS config HAS_BT_CTLR diff --git a/boards/nordic/nrf54l15dk/Kconfig.defconfig b/boards/nordic/nrf54l15dk/Kconfig.defconfig index 49e38070a01a..f57b30c2c42d 100644 --- a/boards/nordic/nrf54l15dk/Kconfig.defconfig +++ b/boards/nordic/nrf54l15dk/Kconfig.defconfig @@ -4,15 +4,6 @@ config HW_STACK_PROTECTION default ARCH_HAS_STACK_PROTECTION -if BOARD_NRF54L15DK_NRF54L05_CPUAPP || BOARD_NRF54L15DK_NRF54L10_CPUAPP || \ - BOARD_NRF54L15DK_NRF54L15_CPUAPP - -config ROM_START_OFFSET - default 0x800 if BOOTLOADER_MCUBOOT - -endif # BOARD_NRF54L15DK_NRF54L05_CPUAPP || BOARD_NRF54L15DK_NRF54L10_CPUAPP || \ - # BOARD_NRF54L15DK_NRF54L15_CPUAPP - if BOARD_NRF54L15DK_NRF54L15_CPUAPP_NS || BOARD_NRF54L15DK_NRF54L10_CPUAPP_NS config BOARD_NRF54L15DK diff --git a/boards/nordic/nrf54lm20dk/Kconfig.defconfig b/boards/nordic/nrf54lm20dk/Kconfig.defconfig index 1f0a706ae6ca..67410cd4d653 100644 --- a/boards/nordic/nrf54lm20dk/Kconfig.defconfig +++ b/boards/nordic/nrf54lm20dk/Kconfig.defconfig @@ -6,7 +6,4 @@ if BOARD_NRF54LM20DK_NRF54LM20A_CPUAPP config HW_STACK_PROTECTION default ARCH_HAS_STACK_PROTECTION -config ROM_START_OFFSET - default 0x800 if BOOTLOADER_MCUBOOT - endif # BOARD_NRF54LM20DK_NRF54LM20A_CPUAPP diff --git a/boards/panasonic/panb611evb/Kconfig.defconfig b/boards/panasonic/panb611evb/Kconfig.defconfig index 6ad6d9426dbf..1b469232537f 100644 --- a/boards/panasonic/panb611evb/Kconfig.defconfig +++ b/boards/panasonic/panb611evb/Kconfig.defconfig @@ -5,13 +5,6 @@ DT_CHOSEN_Z_CODE_PARTITION := zephyr,code-partition DT_CHOSEN_Z_SRAM_PARTITION := zephyr,sram-secure-partition -if BOARD_PANB611EVB_NRF54L15_CPUAPP - -config ROM_START_OFFSET - default 0x800 if BOOTLOADER_MCUBOOT - -endif # BOARD_PANB611EVB_NRF54L15_CPUAPP - if BOARD_PANB611EVB_NRF54L15_CPUAPP_NS config HAS_BT_CTLR diff --git a/boards/raytac/an54l15q_db/Kconfig.defconfig b/boards/raytac/an54l15q_db/Kconfig.defconfig index 72616407eb7b..0d903ea091d0 100644 --- a/boards/raytac/an54l15q_db/Kconfig.defconfig +++ b/boards/raytac/an54l15q_db/Kconfig.defconfig @@ -6,13 +6,6 @@ DT_CHOSEN_Z_CODE_PARTITION := zephyr,code-partition DT_CHOSEN_Z_SRAM_PARTITION := zephyr,sram-secure-partition -if BOARD_RAYTAC_AN54L15Q_DB_NRF54L15_CPUAPP - -config ROM_START_OFFSET - default 0x800 if BOOTLOADER_MCUBOOT - -endif # BOARD_RAYTAC_AN54L15Q_DB_NRF54L15_CPUAPP - if BOARD_RAYTAC_AN54L15Q_DB_NRF54L15_CPUAPP_NS config HAS_BT_CTLR diff --git a/boards/seeed/xiao_nrf54l15/Kconfig.defconfig b/boards/seeed/xiao_nrf54l15/Kconfig.defconfig index dd9a6feb90e6..9dae62ca0403 100644 --- a/boards/seeed/xiao_nrf54l15/Kconfig.defconfig +++ b/boards/seeed/xiao_nrf54l15/Kconfig.defconfig @@ -5,7 +5,4 @@ if BOARD_XIAO_NRF54L15_NRF54L15_CPUAPP config HAS_BT_CTLR default BT -config ROM_START_OFFSET - default 0x800 if BOOTLOADER_MCUBOOT - endif # BOARD_XIAO_NRF54L15_NRF54L15_CPUAPP diff --git a/boards/we/ophelia4ev/Kconfig.defconfig b/boards/we/ophelia4ev/Kconfig.defconfig index 94e5d7e9e0c5..2c11dd05e163 100644 --- a/boards/we/ophelia4ev/Kconfig.defconfig +++ b/boards/we/ophelia4ev/Kconfig.defconfig @@ -3,10 +3,3 @@ config HW_STACK_PROTECTION default ARCH_HAS_STACK_PROTECTION - -if BOARD_OPHELIA4EV_NRF54L15_CPUAPP - -config ROM_START_OFFSET - default 0x800 if BOOTLOADER_MCUBOOT - -endif # BOARD_OPHELIA4EV_NRF54L15_CPUAPP diff --git a/soc/nordic/nrf54l/Kconfig.defconfig b/soc/nordic/nrf54l/Kconfig.defconfig index 9e84d3bc09f7..929d13655c54 100644 --- a/soc/nordic/nrf54l/Kconfig.defconfig +++ b/soc/nordic/nrf54l/Kconfig.defconfig @@ -32,6 +32,9 @@ choice NULL_POINTER_EXCEPTION_DETECTION default NULL_POINTER_EXCEPTION_DETECTION_NONE endchoice +config ROM_START_OFFSET + default 0x800 if BOOTLOADER_MCUBOOT + endif # ARM if RISCV From 318b87179093864727c181d80c06565138a4d071 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Thu, 25 Sep 2025 09:44:35 +0100 Subject: [PATCH 1764/2141] [nrf noup] soc: nordic: nrf54l: Add ROM start offset PM override Adds an override to force this Kconfig to 0 when partition manager is enabled Signed-off-by: Jamie McCrae --- soc/nordic/nrf54l/Kconfig.defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/soc/nordic/nrf54l/Kconfig.defconfig b/soc/nordic/nrf54l/Kconfig.defconfig index 929d13655c54..3274abc88b8a 100644 --- a/soc/nordic/nrf54l/Kconfig.defconfig +++ b/soc/nordic/nrf54l/Kconfig.defconfig @@ -33,6 +33,7 @@ choice NULL_POINTER_EXCEPTION_DETECTION endchoice config ROM_START_OFFSET + default 0 if PARTITION_MANAGER_ENABLED default 0x800 if BOOTLOADER_MCUBOOT endif # ARM From a10dc8d5e769ea39961e1c1157e13c14930b2cdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Ku=C5=BAnia?= Date: Tue, 16 Sep 2025 11:48:03 +0200 Subject: [PATCH 1765/2141] [nrf fromtree] manifest: update hal_nordic to pull nrf-802154 changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updated the hal_nordic to bring the latest changes of the nrf-802154 component. Signed-off-by: Rafał Kuźnia (cherry picked from commit 9bc99401b41a379f11b8296dcc0e15fbdfa50ecd) --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index d0e76dbc5760..0011534d31da 100644 --- a/west.yml +++ b/west.yml @@ -200,7 +200,7 @@ manifest: groups: - hal - name: hal_nordic - revision: d0cef2363e572679deba0e796ef6c77f1188bb04 + revision: 57d9fc59c9ea86465b5cd26f0fe2b9dcc520768b path: modules/hal/nordic groups: - hal From 85ed44a7da80273a13b9c63a224fa1170ec0775c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Ku=C5=BAnia?= Date: Tue, 16 Sep 2025 12:03:22 +0200 Subject: [PATCH 1766/2141] [nrf fromtree] modules: hal_nordic: nrf_802154: Add new Kconfig options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The NRF_802154_ENCRYPTION was split into two additional Kconfigs that control separate functionalities: * NRF_802154_IE_WRITER - to enable Information Element writer * NRF_802154_SECURITY_WRITER - to enable frame counter writer Signed-off-by: Rafał Kuźnia (cherry picked from commit 65fae0a050f35c705ffd8b1f393287df87ec155a) --- modules/hal_nordic/Kconfig | 14 ++++++++++++++ modules/hal_nordic/nrf_802154/CMakeLists.txt | 14 +++++++++++--- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/modules/hal_nordic/Kconfig b/modules/hal_nordic/Kconfig index b8b659374752..7be30750627d 100644 --- a/modules/hal_nordic/Kconfig +++ b/modules/hal_nordic/Kconfig @@ -203,6 +203,20 @@ config NRF_802154_PENDING_EXTENDED_ADDRESSES config NRF_802154_ENCRYPTION bool "nRF 802.15.4 AES-CCM* authentication & encryption" depends on !CRYPTO_NRF_ECB + select NRF_802154_IE_WRITER + select NRF_802154_SECURITY_WRITER + help + Enable module for encryption and authentication of outgoing frames and Acks. + +config NRF_802154_IE_WRITER + bool "Information element writer" + help + Enable data injection for some Information Element types. + +config NRF_802154_SECURITY_WRITER + bool "Security frame counter writer" + help + Enable injection of security frame counter. config NRF_802154_SECURITY_KEY_STORAGE_SIZE int "nRF 802.15.4 security key storage size" diff --git a/modules/hal_nordic/nrf_802154/CMakeLists.txt b/modules/hal_nordic/nrf_802154/CMakeLists.txt index 957019ff1e67..1f504242cb22 100644 --- a/modules/hal_nordic/nrf_802154/CMakeLists.txt +++ b/modules/hal_nordic/nrf_802154/CMakeLists.txt @@ -70,12 +70,20 @@ endif() if (CONFIG_NRF_802154_ENCRYPTION) target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_ENCRYPTION_ENABLED=1) - target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_SECURITY_WRITER_ENABLED=1) - target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_IE_WRITER_ENABLED=1) else () target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_ENCRYPTION_ENABLED=0) - target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_SECURITY_WRITER_ENABLED=0) +endif () + +if (CONFIG_NRF_802154_IE_WRITER) + target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_IE_WRITER_ENABLED=1) +else () target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_IE_WRITER_ENABLED=0) +endif () + +if (CONFIG_NRF_802154_SECURITY_WRITER) + target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_SECURITY_WRITER_ENABLED=1) +else () + target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_SECURITY_WRITER_ENABLED=0) endif() if (NOT CONFIG_IEEE802154_NRF5 AND NOT CONFIG_IEEE802154_NRF5_EXT_IRQ_MGMT AND CONFIG_NRF_802154_SL_OPENSOURCE) From 917223f82fd300cce8cd9700f477edd7aab68175 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Ku=C5=BAnia?= Date: Thu, 25 Sep 2025 12:48:07 +0200 Subject: [PATCH 1767/2141] [nrf fromtree] manifest: update hal_nordic to pull nrf-802154 changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updated the hal_nordic to bring the latest changes of the nrf-802154 component. Signed-off-by: Rafał Kuźnia (cherry picked from commit a25abc3358d69cb2c4f825996aaa0729ea5c97f9) --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 0011534d31da..f411f6fbd642 100644 --- a/west.yml +++ b/west.yml @@ -200,7 +200,7 @@ manifest: groups: - hal - name: hal_nordic - revision: 57d9fc59c9ea86465b5cd26f0fe2b9dcc520768b + revision: e3bf121f1ba72fb1090ef67d19a702b0d77b9f93 path: modules/hal/nordic groups: - hal From adde1f9c4bfa93d919302176a0f98c0c903a13de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Ku=C5=BAnia?= Date: Thu, 25 Sep 2025 12:49:16 +0200 Subject: [PATCH 1768/2141] [nrf fromtree] drivers: ieee802154: nrf5: Remove temporary API migration code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The new nrf-802154 now has the updated API signatures. The migration code is no longer needed. Signed-off-by: Rafał Kuźnia (cherry picked from commit 3d631650508aa41e2b47e2341be7a7d30f67bbfb) --- drivers/ieee802154/ieee802154_nrf5.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/drivers/ieee802154/ieee802154_nrf5.c b/drivers/ieee802154/ieee802154_nrf5.c index e099b2f33a97..60f45edb9c79 100644 --- a/drivers/ieee802154/ieee802154_nrf5.c +++ b/drivers/ieee802154/ieee802154_nrf5.c @@ -499,13 +499,9 @@ static bool nrf5_tx_immediate(struct net_pkt *pkt, uint8_t *payload, bool cca) }, }; -#ifdef NRF_802154_TX_FUNCTIONS_RETURN_ERROR_CODE nrf_802154_tx_error_t result = nrf_802154_transmit_raw(payload, &metadata); return result == NRF_802154_TX_ERROR_NONE; -#else - return nrf_802154_transmit_raw(payload, &metadata); -#endif } #if NRF_802154_CSMA_CA_ENABLED @@ -522,13 +518,9 @@ static bool nrf5_tx_csma_ca(struct net_pkt *pkt, uint8_t *payload) }, }; -#ifdef NRF_802154_TX_FUNCTIONS_RETURN_ERROR_CODE nrf_802154_tx_error_t result = nrf_802154_transmit_csma_ca_raw(payload, &metadata); return result == NRF_802154_TX_ERROR_NONE; -#else - return nrf_802154_transmit_csma_ca_raw(payload, &metadata); -#endif } #endif @@ -585,13 +577,9 @@ static bool nrf5_tx_at(struct nrf5_802154_data *nrf5_radio, struct net_pkt *pkt, uint64_t tx_at = nrf_802154_timestamp_phr_to_shr_convert( net_pkt_timestamp_ns(pkt) / NSEC_PER_USEC); -#ifdef NRF_802154_TX_FUNCTIONS_RETURN_ERROR_CODE nrf_802154_tx_error_t result = nrf_802154_transmit_raw_at(payload, tx_at, &metadata); return result == NRF_802154_TX_ERROR_NONE; -#else - return nrf_802154_transmit_raw_at(payload, tx_at, &metadata); -#endif } #endif /* CONFIG_NET_PKT_TXTIME */ From 6aa26eed633353a8d18d85440e73db7e330bf41d Mon Sep 17 00:00:00 2001 From: Robert Robinson Date: Fri, 26 Sep 2025 13:02:19 +0100 Subject: [PATCH 1769/2141] [nrf fromtree] manifest: Update hal_nordic to pull latest mdk 8.72.4 Update hal_nordic to pull mdk 8.72.4 with mdk changes for nRF7120. Signed-off-by: Robert Robinson (cherry picked from commit 617da7a744c2f5407a608c2dc368b38a75a53dd5) --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index f411f6fbd642..4df2b937a46d 100644 --- a/west.yml +++ b/west.yml @@ -200,7 +200,7 @@ manifest: groups: - hal - name: hal_nordic - revision: e3bf121f1ba72fb1090ef67d19a702b0d77b9f93 + revision: 979a58d0829108b57f10e90b6c3fc35ab6206e4b path: modules/hal/nordic groups: - hal From 93546b44b70e719b026ad7ba9decba63b222b011 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Mon, 14 Jul 2025 13:20:35 +0100 Subject: [PATCH 1770/2141] [nrf fromlist] dts: vendor: nordic: Add missing reg parameters Adds missing reg parameters to DTS nodes Upstream PR #: 96698 Signed-off-by: Jamie McCrae --- dts/vendor/nordic/nrf54l_05_10_15.dtsi | 2 ++ dts/vendor/nordic/nrf54lm20a.dtsi | 1 + 2 files changed, 3 insertions(+) diff --git a/dts/vendor/nordic/nrf54l_05_10_15.dtsi b/dts/vendor/nordic/nrf54l_05_10_15.dtsi index 95c273750387..1cc8314aecca 100644 --- a/dts/vendor/nordic/nrf54l_05_10_15.dtsi +++ b/dts/vendor/nordic/nrf54l_05_10_15.dtsi @@ -101,11 +101,13 @@ #ifdef USE_NON_SECURE_ADDRESS_MAP global_peripherals: peripheral@40000000 { + reg = <0x40000000 0x10000000>; #address-cells = <1>; #size-cells = <1>; ranges = <0x0 0x40000000 0x10000000>; #else global_peripherals: peripheral@50000000 { + reg = <0x50000000 0x10000000>; #address-cells = <1>; #size-cells = <1>; ranges = <0x0 0x50000000 0x10000000>; diff --git a/dts/vendor/nordic/nrf54lm20a.dtsi b/dts/vendor/nordic/nrf54lm20a.dtsi index d1e6d1b0d28a..d9b39d4fb8eb 100644 --- a/dts/vendor/nordic/nrf54lm20a.dtsi +++ b/dts/vendor/nordic/nrf54lm20a.dtsi @@ -118,6 +118,7 @@ }; global_peripherals: peripheral@50000000 { + reg = <0x50000000 0x10000000>; ranges = <0x0 0x50000000 0x10000000>; #address-cells = <1>; #size-cells = <1>; From 79683bf14a627e5201922c4f9d9cb28df6fba49a Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Mon, 14 Jul 2025 13:21:55 +0100 Subject: [PATCH 1771/2141] [nrf fromlist] boards: nordic: nrf54l15dk: Fix cpuflpr SRAM address Fixes the address of this peripheral Upstream PR #: 96698 Signed-off-by: Jamie McCrae --- .../nrf54l15dk/nrf54l15dk_nrf54l15_cpuflpr.dts | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuflpr.dts b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuflpr.dts index 2bc4ba292bed..eae0b605eb4b 100644 --- a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuflpr.dts +++ b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuflpr.dts @@ -8,6 +8,8 @@ #include #include "nrf54l15dk_common.dtsi" +/delete-node/ &cpuflpr_sram; + / { model = "Nordic nRF54L15 DK nRF54L15 FLPR MCU"; compatible = "nordic,nrf54l15dk_nrf54l15-cpuflpr"; @@ -19,13 +21,16 @@ zephyr,flash = &cpuflpr_rram; zephyr,sram = &cpuflpr_sram; }; -}; -&cpuflpr_sram { - status = "okay"; - /* size must be increased due to booting from SRAM */ - reg = <0x20028000 DT_SIZE_K(96)>; - ranges = <0x0 0x20028000 0x18000>; + cpuflpr_sram: memory@20028000 { + compatible = "mmio-sram"; + /* Size must be increased due to booting from SRAM */ + reg = <0x20028000 DT_SIZE_K(96)>; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x20028000 0x18000>; + status = "okay"; + }; }; &cpuflpr_rram { From ac2972168a7f65abf5e8c0861d026e1e22e2cf12 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Mon, 14 Jul 2025 14:10:28 +0100 Subject: [PATCH 1772/2141] [nrf fromlist] dts: arm: nordic: Remove superfluous compatible strings Removes compatible strings that were not defined and are not needed Upstream PR #: 96698 Signed-off-by: Jamie McCrae --- dts/arm/nordic/nrf51822_qfaa.dtsi | 3 +-- dts/arm/nordic/nrf51822_qfab.dtsi | 3 +-- dts/arm/nordic/nrf51822_qfac.dtsi | 3 +-- dts/arm/nordic/nrf52805_caaa.dtsi | 3 +-- dts/arm/nordic/nrf52810_qfaa.dtsi | 3 +-- dts/arm/nordic/nrf52811_qfaa.dtsi | 3 +-- dts/arm/nordic/nrf52820_qdaa.dtsi | 3 +-- dts/arm/nordic/nrf52832_ciaa.dtsi | 3 +-- dts/arm/nordic/nrf52832_qfaa.dtsi | 3 +-- dts/arm/nordic/nrf52832_qfab.dtsi | 3 +-- dts/arm/nordic/nrf52833_qdaa.dtsi | 3 +-- dts/arm/nordic/nrf52833_qiaa.dtsi | 3 +-- dts/arm/nordic/nrf52840_qfaa.dtsi | 3 +-- dts/arm/nordic/nrf52840_qiaa.dtsi | 3 +-- dts/arm/nordic/nrf5340_cpuapp_qkaa.dtsi | 3 +-- dts/arm/nordic/nrf5340_cpuappns_qkaa.dtsi | 3 +-- dts/arm/nordic/nrf5340_cpunet_qkaa.dtsi | 3 +-- dts/arm/nordic/nrf9131_laca.dtsi | 3 +-- dts/arm/nordic/nrf9131ns_laca.dtsi | 3 +-- dts/arm/nordic/nrf9151_laca.dtsi | 3 +-- dts/arm/nordic/nrf9151ns_laca.dtsi | 3 +-- dts/arm/nordic/nrf9160_sica.dtsi | 3 +-- dts/arm/nordic/nrf9160ns_sica.dtsi | 3 +-- dts/arm/nordic/nrf9161_laca.dtsi | 3 +-- dts/arm/nordic/nrf9161ns_laca.dtsi | 3 +-- 25 files changed, 25 insertions(+), 50 deletions(-) diff --git a/dts/arm/nordic/nrf51822_qfaa.dtsi b/dts/arm/nordic/nrf51822_qfaa.dtsi index 07fc5dd1cce9..2aeec68fd852 100644 --- a/dts/arm/nordic/nrf51822_qfaa.dtsi +++ b/dts/arm/nordic/nrf51822_qfaa.dtsi @@ -17,7 +17,6 @@ / { soc { - compatible = "nordic,nrf51822-qfaa", "nordic,nrf51822", - "nordic,nrf51", "simple-bus"; + compatible = "simple-bus"; }; }; diff --git a/dts/arm/nordic/nrf51822_qfab.dtsi b/dts/arm/nordic/nrf51822_qfab.dtsi index 7fb4364d0379..6f6818ac4607 100644 --- a/dts/arm/nordic/nrf51822_qfab.dtsi +++ b/dts/arm/nordic/nrf51822_qfab.dtsi @@ -17,7 +17,6 @@ / { soc { - compatible = "nordic,nrf51822-qfab", "nordic,nrf51822", - "nordic,nrf51", "simple-bus"; + compatible = "simple-bus"; }; }; diff --git a/dts/arm/nordic/nrf51822_qfac.dtsi b/dts/arm/nordic/nrf51822_qfac.dtsi index 59a2ed265e67..eae879189c0c 100644 --- a/dts/arm/nordic/nrf51822_qfac.dtsi +++ b/dts/arm/nordic/nrf51822_qfac.dtsi @@ -17,7 +17,6 @@ / { soc { - compatible = "nordic,nrf51822-qfac", "nordic,nrf51822", - "nordic,nrf51", "simple-bus"; + compatible = "simple-bus"; }; }; diff --git a/dts/arm/nordic/nrf52805_caaa.dtsi b/dts/arm/nordic/nrf52805_caaa.dtsi index b7d24861893a..285d21440599 100644 --- a/dts/arm/nordic/nrf52805_caaa.dtsi +++ b/dts/arm/nordic/nrf52805_caaa.dtsi @@ -17,7 +17,6 @@ / { soc { - compatible = "nordic,nrf52805-caaa", "nordic,nrf52805", - "nordic,nrf52", "simple-bus"; + compatible = "simple-bus"; }; }; diff --git a/dts/arm/nordic/nrf52810_qfaa.dtsi b/dts/arm/nordic/nrf52810_qfaa.dtsi index 98fbd9a09369..bbc76ab75971 100644 --- a/dts/arm/nordic/nrf52810_qfaa.dtsi +++ b/dts/arm/nordic/nrf52810_qfaa.dtsi @@ -17,7 +17,6 @@ / { soc { - compatible = "nordic,nrf52810-qfaa", "nordic,nrf52810", - "nordic,nrf52", "simple-bus"; + compatible = "simple-bus"; }; }; diff --git a/dts/arm/nordic/nrf52811_qfaa.dtsi b/dts/arm/nordic/nrf52811_qfaa.dtsi index 3bb1556eadb7..17b387919dc8 100644 --- a/dts/arm/nordic/nrf52811_qfaa.dtsi +++ b/dts/arm/nordic/nrf52811_qfaa.dtsi @@ -17,7 +17,6 @@ / { soc { - compatible = "nordic,nrf52811-qfaa", "nordic,nrf52811", - "nordic,nrf52", "simple-bus"; + compatible = "simple-bus"; }; }; diff --git a/dts/arm/nordic/nrf52820_qdaa.dtsi b/dts/arm/nordic/nrf52820_qdaa.dtsi index c1d4a5a95f5a..a683ddcd2e61 100644 --- a/dts/arm/nordic/nrf52820_qdaa.dtsi +++ b/dts/arm/nordic/nrf52820_qdaa.dtsi @@ -17,7 +17,6 @@ / { soc { - compatible = "nordic,nrf52820-qdaa", "nordic,nrf52820", - "nordic,nrf52", "simple-bus"; + compatible = "simple-bus"; }; }; diff --git a/dts/arm/nordic/nrf52832_ciaa.dtsi b/dts/arm/nordic/nrf52832_ciaa.dtsi index 88f16574bbb9..81bed18daf27 100644 --- a/dts/arm/nordic/nrf52832_ciaa.dtsi +++ b/dts/arm/nordic/nrf52832_ciaa.dtsi @@ -17,7 +17,6 @@ / { soc { - compatible = "nordic,nrf52832-ciaa", "nordic,nrf52832", - "nordic,nrf52", "simple-bus"; + compatible = "simple-bus"; }; }; diff --git a/dts/arm/nordic/nrf52832_qfaa.dtsi b/dts/arm/nordic/nrf52832_qfaa.dtsi index 2943de6d1155..81bed18daf27 100644 --- a/dts/arm/nordic/nrf52832_qfaa.dtsi +++ b/dts/arm/nordic/nrf52832_qfaa.dtsi @@ -17,7 +17,6 @@ / { soc { - compatible = "nordic,nrf52832-qfaa", "nordic,nrf52832", - "nordic,nrf52", "simple-bus"; + compatible = "simple-bus"; }; }; diff --git a/dts/arm/nordic/nrf52832_qfab.dtsi b/dts/arm/nordic/nrf52832_qfab.dtsi index fe1605394e72..faecc765efdf 100644 --- a/dts/arm/nordic/nrf52832_qfab.dtsi +++ b/dts/arm/nordic/nrf52832_qfab.dtsi @@ -17,7 +17,6 @@ / { soc { - compatible = "nordic,nrf52832-qfab", "nordic,nrf52832", - "nordic,nrf52", "simple-bus"; + compatible = "simple-bus"; }; }; diff --git a/dts/arm/nordic/nrf52833_qdaa.dtsi b/dts/arm/nordic/nrf52833_qdaa.dtsi index 7f9be6f22550..64462d29269b 100644 --- a/dts/arm/nordic/nrf52833_qdaa.dtsi +++ b/dts/arm/nordic/nrf52833_qdaa.dtsi @@ -17,7 +17,6 @@ / { soc { - compatible = "nordic,nrf52833-qdaa", "nordic,nrf52833", - "nordic,nrf52", "simple-bus"; + compatible = "simple-bus"; }; }; diff --git a/dts/arm/nordic/nrf52833_qiaa.dtsi b/dts/arm/nordic/nrf52833_qiaa.dtsi index 68eabb08bcf7..6ab9a4f1e6eb 100644 --- a/dts/arm/nordic/nrf52833_qiaa.dtsi +++ b/dts/arm/nordic/nrf52833_qiaa.dtsi @@ -17,7 +17,6 @@ / { soc { - compatible = "nordic,nrf52833-qiaa", "nordic,nrf52833", - "nordic,nrf52", "simple-bus"; + compatible = "simple-bus"; }; }; diff --git a/dts/arm/nordic/nrf52840_qfaa.dtsi b/dts/arm/nordic/nrf52840_qfaa.dtsi index 8c927eb5c0a6..85acf5ab4685 100644 --- a/dts/arm/nordic/nrf52840_qfaa.dtsi +++ b/dts/arm/nordic/nrf52840_qfaa.dtsi @@ -17,8 +17,7 @@ / { soc { - compatible = "nordic,nrf52840-qfaa", "nordic,nrf52840", - "nordic,nrf52", "simple-bus"; + compatible = "simple-bus"; }; }; diff --git a/dts/arm/nordic/nrf52840_qiaa.dtsi b/dts/arm/nordic/nrf52840_qiaa.dtsi index 657222447193..7986ab41fd6a 100644 --- a/dts/arm/nordic/nrf52840_qiaa.dtsi +++ b/dts/arm/nordic/nrf52840_qiaa.dtsi @@ -26,7 +26,6 @@ / { soc { - compatible = "nordic,nrf52840-qiaa", "nordic,nrf52840", - "nordic,nrf52", "simple-bus"; + compatible = "simple-bus"; }; }; diff --git a/dts/arm/nordic/nrf5340_cpuapp_qkaa.dtsi b/dts/arm/nordic/nrf5340_cpuapp_qkaa.dtsi index a543ffe906b1..76a2af386623 100644 --- a/dts/arm/nordic/nrf5340_cpuapp_qkaa.dtsi +++ b/dts/arm/nordic/nrf5340_cpuapp_qkaa.dtsi @@ -17,7 +17,6 @@ / { soc { - compatible = "nordic,nrf5340-cpuapp-qkaa", "nordic,nrf5340-cpuapp", - "nordic,nrf53", "simple-bus"; + compatible = "simple-bus"; }; }; diff --git a/dts/arm/nordic/nrf5340_cpuappns_qkaa.dtsi b/dts/arm/nordic/nrf5340_cpuappns_qkaa.dtsi index 80d5706232f6..37d6a605556e 100644 --- a/dts/arm/nordic/nrf5340_cpuappns_qkaa.dtsi +++ b/dts/arm/nordic/nrf5340_cpuappns_qkaa.dtsi @@ -17,7 +17,6 @@ / { soc { - compatible = "nordic,nrf5340-cpuapp-qkaa", "nordic,nrf5340-cpuapp", - "nordic,nrf53", "simple-bus"; + compatible = "simple-bus"; }; }; diff --git a/dts/arm/nordic/nrf5340_cpunet_qkaa.dtsi b/dts/arm/nordic/nrf5340_cpunet_qkaa.dtsi index 19eb682ddfc6..e9948125ba89 100644 --- a/dts/arm/nordic/nrf5340_cpunet_qkaa.dtsi +++ b/dts/arm/nordic/nrf5340_cpunet_qkaa.dtsi @@ -21,7 +21,6 @@ / { soc { - compatible = "nordic,nrf5340-cpunet-qkaa", "nordic,nrf5340-cpunet", - "nordic,nrf53", "simple-bus"; + compatible = "simple-bus"; }; }; diff --git a/dts/arm/nordic/nrf9131_laca.dtsi b/dts/arm/nordic/nrf9131_laca.dtsi index f32f0c825ad1..77fe73c22af6 100644 --- a/dts/arm/nordic/nrf9131_laca.dtsi +++ b/dts/arm/nordic/nrf9131_laca.dtsi @@ -17,7 +17,6 @@ / { soc { - compatible = "nordic,nrf9131-laca", "nordic,nrf9120", - "nordic,nrf91", "simple-bus"; + compatible = "simple-bus"; }; }; diff --git a/dts/arm/nordic/nrf9131ns_laca.dtsi b/dts/arm/nordic/nrf9131ns_laca.dtsi index 3b6208f45e91..6ab80a842a33 100644 --- a/dts/arm/nordic/nrf9131ns_laca.dtsi +++ b/dts/arm/nordic/nrf9131ns_laca.dtsi @@ -17,7 +17,6 @@ / { soc { - compatible = "nordic,nrf9131-laca", "nordic,nrf9120", - "nordic,nrf91", "simple-bus"; + compatible = "simple-bus"; }; }; diff --git a/dts/arm/nordic/nrf9151_laca.dtsi b/dts/arm/nordic/nrf9151_laca.dtsi index 9ed202740170..77fe73c22af6 100644 --- a/dts/arm/nordic/nrf9151_laca.dtsi +++ b/dts/arm/nordic/nrf9151_laca.dtsi @@ -17,7 +17,6 @@ / { soc { - compatible = "nordic,nrf9151-laca", "nordic,nrf9120", - "nordic,nrf91", "simple-bus"; + compatible = "simple-bus"; }; }; diff --git a/dts/arm/nordic/nrf9151ns_laca.dtsi b/dts/arm/nordic/nrf9151ns_laca.dtsi index ac31c6e19c60..6ab80a842a33 100644 --- a/dts/arm/nordic/nrf9151ns_laca.dtsi +++ b/dts/arm/nordic/nrf9151ns_laca.dtsi @@ -17,7 +17,6 @@ / { soc { - compatible = "nordic,nrf9151-laca", "nordic,nrf9120", - "nordic,nrf91", "simple-bus"; + compatible = "simple-bus"; }; }; diff --git a/dts/arm/nordic/nrf9160_sica.dtsi b/dts/arm/nordic/nrf9160_sica.dtsi index 15096534016d..6bbe048277c1 100644 --- a/dts/arm/nordic/nrf9160_sica.dtsi +++ b/dts/arm/nordic/nrf9160_sica.dtsi @@ -17,7 +17,6 @@ / { soc { - compatible = "nordic,nrf9160-sica", "nordic,nrf9160", - "nordic,nrf91", "simple-bus"; + compatible = "simple-bus"; }; }; diff --git a/dts/arm/nordic/nrf9160ns_sica.dtsi b/dts/arm/nordic/nrf9160ns_sica.dtsi index c6adbaa7ca2f..12ec1fcbc8e0 100644 --- a/dts/arm/nordic/nrf9160ns_sica.dtsi +++ b/dts/arm/nordic/nrf9160ns_sica.dtsi @@ -17,7 +17,6 @@ / { soc { - compatible = "nordic,nrf9160-sica", "nordic,nrf9160", - "nordic,nrf91", "simple-bus"; + compatible = "simple-bus"; }; }; diff --git a/dts/arm/nordic/nrf9161_laca.dtsi b/dts/arm/nordic/nrf9161_laca.dtsi index e94ab99166a0..77fe73c22af6 100644 --- a/dts/arm/nordic/nrf9161_laca.dtsi +++ b/dts/arm/nordic/nrf9161_laca.dtsi @@ -17,7 +17,6 @@ / { soc { - compatible = "nordic,nrf9161-laca", "nordic,nrf9120", - "nordic,nrf91", "simple-bus"; + compatible = "simple-bus"; }; }; diff --git a/dts/arm/nordic/nrf9161ns_laca.dtsi b/dts/arm/nordic/nrf9161ns_laca.dtsi index 4449c3565b32..6ab80a842a33 100644 --- a/dts/arm/nordic/nrf9161ns_laca.dtsi +++ b/dts/arm/nordic/nrf9161ns_laca.dtsi @@ -17,7 +17,6 @@ / { soc { - compatible = "nordic,nrf9161-laca", "nordic,nrf9120", - "nordic,nrf91", "simple-bus"; + compatible = "simple-bus"; }; }; From 68a48ecee06c1331b97a35b62885495d08697e7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Fri, 26 Sep 2025 15:09:59 +0200 Subject: [PATCH 1773/2141] [nrf fromtree] samples: drivers: spi_bitbang: Enable sample on nrf54h20 PPR core MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add overlay required to run the sample on nrf54h20dk/nrf54h20/cpuppr. Signed-off-by: Sebastian Głąb (cherry picked from commit 745fd00517fb6a34dfc595bb7636111a1694e4c0) --- .../boards/nrf54h20dk_nrf54h20_cpuppr.overlay | 32 +++++++++++++++++++ samples/drivers/spi_bitbang/sample.yaml | 1 + 2 files changed, 33 insertions(+) create mode 100644 samples/drivers/spi_bitbang/boards/nrf54h20dk_nrf54h20_cpuppr.overlay diff --git a/samples/drivers/spi_bitbang/boards/nrf54h20dk_nrf54h20_cpuppr.overlay b/samples/drivers/spi_bitbang/boards/nrf54h20dk_nrf54h20_cpuppr.overlay new file mode 100644 index 000000000000..d3083d6cbd94 --- /dev/null +++ b/samples/drivers/spi_bitbang/boards/nrf54h20dk_nrf54h20_cpuppr.overlay @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * Test requires loopback between P0.06 and P0.07. + * No other driver on SPI_CLK and SPI_CS. + */ + +/ { + spibb0: spibb0 { + compatible = "zephyr,spi-bitbang"; + status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + clk-gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>; + mosi-gpios = <&gpio0 6 GPIO_ACTIVE_HIGH>; + miso-gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>; + cs-gpios = <&gpio0 8 GPIO_ACTIVE_LOW>; + }; +}; + +&gpio0 { + status = "okay"; +}; + +&gpiote130 { + status = "okay"; + owned-channels = <7>; +}; diff --git a/samples/drivers/spi_bitbang/sample.yaml b/samples/drivers/spi_bitbang/sample.yaml index c90f02313f2b..e3265ce2fdb6 100644 --- a/samples/drivers/spi_bitbang/sample.yaml +++ b/samples/drivers/spi_bitbang/sample.yaml @@ -9,6 +9,7 @@ tests: platform_allow: - nrf52840dk/nrf52840 - nrf54h20dk/nrf54h20/cpuapp + - nrf54h20dk/nrf54h20/cpuppr - nrf54l15dk/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp integration_platforms: From db6ec697895ede88ee497645ba71f9a595df1f73 Mon Sep 17 00:00:00 2001 From: Tomasz Chyrowicz Date: Thu, 4 Sep 2025 13:37:02 +0200 Subject: [PATCH 1774/2141] [nrf fromtree] mgmt: Allow to block confirming non-acive slots In Direct XIP with revert, it should be possible to block confirmation of the non-active slot, so only a bootable binaries are marked as valid. Signed-off-by: Tomasz Chyrowicz (cherry picked from commit c1baf2f7636918fa26fe234fa042e576ba4aafcc) --- subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig | 14 +++++++++++++ .../mcumgr/grp/img_mgmt/src/img_mgmt_state.c | 20 ++++++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig b/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig index d95f9b5849a5..b8328ec650db 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig @@ -117,6 +117,20 @@ config MCUMGR_GRP_IMG_REJECT_DIRECT_XIP_MISMATCHED_SLOT The base address can be set, to an image binary header, with imgtool, using the --rom-fixed command line option. +config MCUMGR_GRP_IMG_ALLOW_CONFIRM_NON_ACTIVE_SLOT + bool "Allow to confirm non-active slots of any image" + depends on MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP_WITH_REVERT || \ + MCUBOOT_BOOTLOADER_MODE_RAM_LOAD_WITH_REVERT || \ + MCUBOOT_BOOTLOADER_MODE_SWAP_SCRATCH || \ + MCUBOOT_BOOTLOADER_MODE_SWAP_USING_MOVE || \ + MCUBOOT_BOOTLOADER_MODE_SWAP_USING_OFFSET + default y + help + Allows to confirm non-active slot of any image. + Normally it should not be allowed to confirm any slots via MCUmgr + commands, to prevent confirming something that is broken and was not + verified to boot correctly. + config MCUMGR_GRP_IMG_FRUGAL_LIST bool "Omit zero, empty or false values from status list" help diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt_state.c b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt_state.c index fb15c15b6e9e..cc465fbea740 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt_state.c +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt_state.c @@ -680,6 +680,17 @@ int img_mgmt_set_next_boot_slot(int slot, bool confirm) } #endif + /* The rules above apply only to the inactive image. + * To effectively prevent confirming something that might not have been + * verified to actually be bootable, a new policy was introduced, + * that applies to both active and inactive images. + */ +#ifndef MCUMGR_GRP_IMG_ALLOW_CONFIRM_NON_ACTIVE_SLOT + if (confirm && slot != active_slot) { + return IMG_MGMT_ERR_IMAGE_CONFIRMATION_DENIED; + } +#endif + /* Setting test to active slot is not allowed. */ if (!confirm && slot == active_slot) { return IMG_MGMT_ERR_IMAGE_SETTING_TEST_TO_ACTIVE_DENIED; @@ -728,8 +739,9 @@ int img_mgmt_set_next_boot_slot(int slot, bool confirm) #else int img_mgmt_set_next_boot_slot(int slot, bool confirm) { + int image = img_mgmt_slot_to_image(slot); + int active_slot = img_mgmt_active_slot(image); int active_image = img_mgmt_active_image(); - int active_slot = img_mgmt_active_slot(active_image); LOG_DBG("(%d, %s)", slot, confirm ? "confirm" : "test"); LOG_DBG("aimg = %d, aslot = %d, slot = %d", @@ -739,6 +751,12 @@ int img_mgmt_set_next_boot_slot(int slot, bool confirm) return IMG_MGMT_ERR_IMAGE_SETTING_TEST_TO_ACTIVE_DENIED; } +#ifndef MCUMGR_GRP_IMG_ALLOW_CONFIRM_NON_ACTIVE_SLOT + if (slot != active_slot && confirm) { + return IMG_MGMT_ERR_IMAGE_CONFIRMATION_DENIED; + } +#endif + return img_mgmt_set_next_boot_slot_common(slot, active_slot, confirm); } #endif From ffdedbd738c4c11f9d82b489e656c76e98c6e742 Mon Sep 17 00:00:00 2001 From: Tomasz Chyrowicz Date: Fri, 26 Sep 2025 12:34:31 +0200 Subject: [PATCH 1775/2141] [nrf fromtree] mgmt: Add missing CONFIG_ prefixes Fix the incorrect usage of Kconfig symbols and revert back the default behavior to allow for non-active slot confirmation. Signed-off-by: Tomasz Chyrowicz (cherry picked from commit 2e0d9ed2cf79be86bd0ffe522932b0062436eda4) --- subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt_state.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt_state.c b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt_state.c index cc465fbea740..dbb496fb3b33 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt_state.c +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt_state.c @@ -685,7 +685,7 @@ int img_mgmt_set_next_boot_slot(int slot, bool confirm) * verified to actually be bootable, a new policy was introduced, * that applies to both active and inactive images. */ -#ifndef MCUMGR_GRP_IMG_ALLOW_CONFIRM_NON_ACTIVE_SLOT +#ifndef CONFIG_MCUMGR_GRP_IMG_ALLOW_CONFIRM_NON_ACTIVE_SLOT if (confirm && slot != active_slot) { return IMG_MGMT_ERR_IMAGE_CONFIRMATION_DENIED; } @@ -751,7 +751,7 @@ int img_mgmt_set_next_boot_slot(int slot, bool confirm) return IMG_MGMT_ERR_IMAGE_SETTING_TEST_TO_ACTIVE_DENIED; } -#ifndef MCUMGR_GRP_IMG_ALLOW_CONFIRM_NON_ACTIVE_SLOT +#ifndef CONFIG_MCUMGR_GRP_IMG_ALLOW_CONFIRM_NON_ACTIVE_SLOT if (slot != active_slot && confirm) { return IMG_MGMT_ERR_IMAGE_CONFIRMATION_DENIED; } From bb32e70ac2301e7d4905b063a04f1a68be3e3965 Mon Sep 17 00:00:00 2001 From: Tomasz Chyrowicz Date: Mon, 29 Sep 2025 14:22:14 +0200 Subject: [PATCH 1776/2141] [nrf fromtree] mcumgr: Enable permanent updates in overwrite mode It is essential for the overwrite mode to allow confirming the secondary slot to provide the permanent update. This types of updates is the only mode in which the application may be upgraded. Signed-off-by: Tomasz Chyrowicz (cherry picked from commit cbcf81e3a49547f9102fffddd0c4d0f63816c265) --- subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig b/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig index b8328ec650db..1e975e672556 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig @@ -118,18 +118,22 @@ config MCUMGR_GRP_IMG_REJECT_DIRECT_XIP_MISMATCHED_SLOT using the --rom-fixed command line option. config MCUMGR_GRP_IMG_ALLOW_CONFIRM_NON_ACTIVE_SLOT - bool "Allow to confirm non-active slots of any image" + bool "Allow to confirm non-active slots of any image" if !MCUBOOT_BOOTLOADER_MODE_OVERWRITE_ONLY depends on MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP_WITH_REVERT || \ MCUBOOT_BOOTLOADER_MODE_RAM_LOAD_WITH_REVERT || \ MCUBOOT_BOOTLOADER_MODE_SWAP_SCRATCH || \ MCUBOOT_BOOTLOADER_MODE_SWAP_USING_MOVE || \ - MCUBOOT_BOOTLOADER_MODE_SWAP_USING_OFFSET + MCUBOOT_BOOTLOADER_MODE_SWAP_USING_OFFSET || \ + MCUBOOT_BOOTLOADER_MODE_OVERWRITE_ONLY default y help Allows to confirm non-active slot of any image. Normally it should not be allowed to confirm any slots via MCUmgr commands, to prevent confirming something that is broken and was not verified to boot correctly. + Option always enabled in the overwrite mode, because the permanent + update, that uses the confirm flag, is the intended way to provide + updates. config MCUMGR_GRP_IMG_FRUGAL_LIST bool "Omit zero, empty or false values from status list" From 648bf8dd54c53734ba05a3eda2e6557ba8218cac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Stasiak?= Date: Wed, 1 Oct 2025 14:08:39 +0200 Subject: [PATCH 1777/2141] [nrf fromlist] drivers: pinctrl: nrf: use HAL defines MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replaced MDK symbols with defines from HAL. Upstream PR #: 96855 Signed-off-by: Michał Stasiak --- drivers/pinctrl/pinctrl_nrf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/pinctrl/pinctrl_nrf.c b/drivers/pinctrl/pinctrl_nrf.c index 09c4d19f570e..9ea48ee34c44 100644 --- a/drivers/pinctrl/pinctrl_nrf.c +++ b/drivers/pinctrl/pinctrl_nrf.c @@ -15,7 +15,7 @@ BUILD_ASSERT(((NRF_PULL_NONE == NRF_GPIO_PIN_NOPULL) && (NRF_PULL_UP == NRF_GPIO_PIN_PULLUP)), "nRF pinctrl pull settings do not match HAL values"); -#if defined(GPIO_PIN_CNF_DRIVE_E0E1) || defined(GPIO_PIN_CNF_DRIVE0_E0) +#if NRF_GPIO_HAS_DRIVE_EXTRA #define NRF_DRIVE_COUNT (NRF_DRIVE_E0E1 + 1) #else #define NRF_DRIVE_COUNT (NRF_DRIVE_H0D1 + 1) @@ -29,7 +29,7 @@ static const nrf_gpio_pin_drive_t drive_modes[NRF_DRIVE_COUNT] = { [NRF_DRIVE_D0H1] = NRF_GPIO_PIN_D0H1, [NRF_DRIVE_S0D1] = NRF_GPIO_PIN_S0D1, [NRF_DRIVE_H0D1] = NRF_GPIO_PIN_H0D1, -#if defined(GPIO_PIN_CNF_DRIVE_E0E1) || defined(GPIO_PIN_CNF_DRIVE0_E0) +#if NRF_GPIO_HAS_DRIVE_EXTRA [NRF_DRIVE_E0E1] = NRF_GPIO_PIN_E0E1, #endif }; @@ -498,7 +498,7 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, #endif /* defined(NRF_PSEL_TDM) */ #if defined(NRF_GRTC_CLKOUT_FAST) case NRF_FUN_GRTC_CLKOUT_FAST: -#if NRF_GPIO_HAS_SEL && defined(GPIO_PIN_CNF_CTRLSEL_GRTC) +#if NRF_GPIO_HAS_SEL && NRF_GPIO_HAS_CTRLSEL_GRTC nrf_gpio_pin_control_select(psel, NRF_GPIO_PIN_SEL_GRTC); #endif dir = NRF_GPIO_PIN_DIR_OUTPUT; @@ -507,7 +507,7 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, #endif /* defined(NRF_GRTC_CLKOUT_FAST) */ #if defined(NRF_GRTC_CLKOUT_SLOW) case NRF_FUN_GRTC_CLKOUT_32K: -#if NRF_GPIO_HAS_SEL && defined(GPIO_PIN_CNF_CTRLSEL_GRTC) +#if NRF_GPIO_HAS_SEL && NRF_GPIO_HAS_CTRLSEL_GRTC nrf_gpio_pin_control_select(psel, NRF_GPIO_PIN_SEL_GRTC); #endif dir = NRF_GPIO_PIN_DIR_OUTPUT; From 047df0c5a1ba5a20a2f72ed8bf81dfdb99fcaaa2 Mon Sep 17 00:00:00 2001 From: Bartosz Miller Date: Fri, 1 Aug 2025 09:33:58 +0200 Subject: [PATCH 1778/2141] [nrf fromtree] tests: drivers: flash: Test newly introduced MSPI driver features These features are: - soft reset - 4B addressing (SPI mode) - supply gpios Signed-off-by: Bartosz Miller (cherry picked from commit bee81df035cc61c208c0dc4ea09f5979e8166c55) --- .../common/boards/mx25uw63_low_freq.overlay | 10 +++ .../mx25uw63_single_io_4B_addr_sreset.overlay | 64 +++++++++++++++++++ .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 11 ++++ tests/drivers/flash/common/src/main.c | 17 +++++ tests/drivers/flash/common/testcase.yaml | 10 +++ 5 files changed, 112 insertions(+) create mode 100644 tests/drivers/flash/common/boards/mx25uw63_low_freq.overlay create mode 100644 tests/drivers/flash/common/boards/mx25uw63_single_io_4B_addr_sreset.overlay diff --git a/tests/drivers/flash/common/boards/mx25uw63_low_freq.overlay b/tests/drivers/flash/common/boards/mx25uw63_low_freq.overlay new file mode 100644 index 000000000000..950005eaf5c2 --- /dev/null +++ b/tests/drivers/flash/common/boards/mx25uw63_low_freq.overlay @@ -0,0 +1,10 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&mx25uw63 { + status = "okay"; + mspi-max-frequency = ; +}; diff --git a/tests/drivers/flash/common/boards/mx25uw63_single_io_4B_addr_sreset.overlay b/tests/drivers/flash/common/boards/mx25uw63_single_io_4B_addr_sreset.overlay new file mode 100644 index 000000000000..587d68546561 --- /dev/null +++ b/tests/drivers/flash/common/boards/mx25uw63_single_io_4B_addr_sreset.overlay @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + + /delete-node/ exmif_default; + /delete-node/ exmif_sleep; + + exmif_default: exmif_default { + group1 { + psels = , + , + , + , + , + , + , + , + , + ; + nordic,drive-mode = ; + }; + }; + + exmif_sleep: exmif_sleep { + group1 { + low-power-enable; + psels = , + , + , + , + , + , + , + , + , + ; + }; + }; + +}; + +&gpio6 { + status = "okay"; +}; + +&exmif { + status = "okay"; + pinctrl-0 = <&exmif_default>; + pinctrl-1 = <&exmif_sleep>; + pinctrl-names = "default", "sleep"; + ce-gpios = <&gpio6 3 GPIO_ACTIVE_LOW>; +}; + +&mx25uw63 { + status = "okay"; + mspi-max-frequency = ; + mspi-io-mode = "MSPI_IO_MODE_SINGLE"; + use-4byte-addressing; + initial-soft-reset; +}; diff --git a/tests/drivers/flash/common/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/flash/common/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index 22c24c32f6d8..5272bb8fdde3 100644 --- a/tests/drivers/flash/common/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/tests/drivers/flash/common/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -4,6 +4,16 @@ * SPDX-License-Identifier: Apache-2.0 */ +/ { + zephyr,user { + test-gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>; + }; +}; + +&gpio0 { + status = "okay"; +}; + &gpio6 { status = "okay"; zephyr,pm-device-runtime-auto; @@ -16,4 +26,5 @@ &mx25uw63 { status = "okay"; + supply-gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>; }; diff --git a/tests/drivers/flash/common/src/main.c b/tests/drivers/flash/common/src/main.c index 337876a9e8d7..b629c39ebc51 100644 --- a/tests/drivers/flash/common/src/main.c +++ b/tests/drivers/flash/common/src/main.c @@ -9,6 +9,7 @@ #include #include #include +#include #if defined(CONFIG_NORDIC_QSPI_NOR) #define TEST_AREA_DEV_NODE DT_INST(0, nordic_qspi_nor) @@ -327,6 +328,22 @@ ZTEST(flash_driver, test_flash_erase) zassert_not_equal(expected[0], erase_value, "These values shall be different"); } +ZTEST(flash_driver, test_supply_gpios_control) +{ + if (!DT_NODE_HAS_PROP(TEST_AREA_DEV_NODE, supply_gpios)) { + ztest_test_skip(); + } + +#if DT_NODE_HAS_PROP(DT_PATH(zephyr_user), test_gpios) + const struct gpio_dt_spec test_gpio = + GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), test_gpios); + zassert_true(gpio_is_ready_dt(&test_gpio), "Test GPIO is not ready\n"); + zassert_ok(gpio_pin_configure_dt(&test_gpio, GPIO_INPUT | GPIO_PULL_DOWN), + "Failed to configure test pin\n"); + zassert_equal(gpio_pin_get(test_gpio.port, test_gpio.pin), 1, "Supply GPIO is not set\n"); +#endif +} + struct test_cb_data_type { uint32_t page_counter; /* used to count how many pages was iterated */ uint32_t exit_page; /* terminate iteration when this page is reached */ diff --git a/tests/drivers/flash/common/testcase.yaml b/tests/drivers/flash/common/testcase.yaml index 34123ffde77f..6f59f3799c5a 100644 --- a/tests/drivers/flash/common/testcase.yaml +++ b/tests/drivers/flash/common/testcase.yaml @@ -182,3 +182,13 @@ tests: extra_args: - DTC_OVERLAY_FILE="./boards/${BOARD}_qspi_nor.overlay" - CONF_FILE="./prj.conf ./boards/${BOARD}_qspi_nor.conf" + drivers.flash.common.mspi_single_io.4B_addr_soft_reset: + platform_allow: + - nrf54h20dk/nrf54h20/cpuapp + extra_args: + - EXTRA_DTC_OVERLAY_FILE=boards/mx25uw63_single_io_4B_addr_sreset.overlay + drivers.flash.common.mspi_low_frequency: + platform_allow: + - nrf54h20dk/nrf54h20/cpuapp + extra_args: + - EXTRA_DTC_OVERLAY_FILE=boards/mx25uw63_low_freq.overlay From 40af3c982b9a743cea2feabe07d3db66337fb68e Mon Sep 17 00:00:00 2001 From: Tomasz Chyrowicz Date: Thu, 25 Sep 2025 15:54:42 +0200 Subject: [PATCH 1779/2141] [nrf fromtree] boards: Add secondary_app_partition alias Add secondary_app_partition aliases. Those aliases can be used to configure the code partition for the second copy of the FW in the Direct XIP update scenarios. Signed-off-by: Tomasz Chyrowicz (cherry picked from commit e3c5bdfa02fcc36e4832c79275d5c0ecf4330058) --- boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 4 +++- boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index ae330e209aad..914b434d40e4 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -18,7 +18,7 @@ chosen { zephyr,console = &uart136; - zephyr,code-partition = &slot0_partition; + zephyr,code-partition = &cpuapp_slot0_partition; zephyr,flash = &mram1x; zephyr,sram = &cpuapp_data; zephyr,shell-uart = &uart136; @@ -193,6 +193,8 @@ slot0_partition: &cpuapp_slot0_partition { label = "image-0"; }; +secondary_app_partition: &cpuapp_slot1_partition {}; + slot1_partition: &cpuapp_slot1_partition { label = "image-1"; }; diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts index 7e1a1c8e9e04..7f0da1291e84 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts @@ -90,6 +90,8 @@ slot0_partition: &cpurad_slot0_partition { label = "image-0"; }; +secondary_app_partition: &cpurad_slot1_partition {}; + slot1_partition: &cpurad_slot1_partition { label = "image-1"; }; From 69ad0523f95f13d1de356c19575301ce3de4959e Mon Sep 17 00:00:00 2001 From: Piotr Kosycarz Date: Thu, 2 Oct 2025 06:56:02 +0200 Subject: [PATCH 1780/2141] [nrf noup] tests: arm_irq_vector_table: remove SSF_CLIENT_SYS_INIT nrf-squash! [nrf noup] tests: arm_irq_vector_table: Disable starting of SSF client SSF was removed. This is basically a revert of 8c97493e725979a39138d9a13956ac2c8a5c04bf but it does not apply cleanly. Both can be dropped at next upmerge. Signed-off-by: Piotr Kosycarz --- .../arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpuapp.conf | 1 - .../arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpurad.conf | 1 - 2 files changed, 2 deletions(-) diff --git a/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpuapp.conf b/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpuapp.conf index 6457f0efce73..e12e413d9e5a 100644 --- a/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpuapp.conf +++ b/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpuapp.conf @@ -2,4 +2,3 @@ # SPDX-License-Identifier: Apache-2.0 CONFIG_POWER_DOMAIN=n -CONFIG_SSF_CLIENT_SYS_INIT=n diff --git a/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpurad.conf b/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpurad.conf index 6457f0efce73..e12e413d9e5a 100644 --- a/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpurad.conf +++ b/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpurad.conf @@ -2,4 +2,3 @@ # SPDX-License-Identifier: Apache-2.0 CONFIG_POWER_DOMAIN=n -CONFIG_SSF_CLIENT_SYS_INIT=n From 74cb5127fb2c2b7e356b6c83c51fee7a5e2b53cc Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Mon, 7 Jul 2025 08:10:58 +0100 Subject: [PATCH 1781/2141] [nrf noup] scripts: ci: check_compliance: Add NCS sysbuild Kconfig nrf-squash! [nrf noup] scripts: ci: check_compliance: Add NCS sysbuild Kconfigs Adds Kconfigs to the allow list as they are used in documentation but are not defined Signed-off-by: Jamie McCrae --- scripts/ci/check_compliance.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index c9b9b9671366..3ab73f75872f 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -1460,11 +1460,13 @@ class SysbuildKconfigCheck(KconfigCheck): "COMP_DATA_LAYOUT_SINGLE", # Used by test "DTM_NO_DFE", # Used by DTM application "DTM_TRANSPORT_HCI", # Used by DTM application + "FIRMWARE_LOADER_IMAGE_ABC", # Used in documentation "INCLUDE_REMOTE_IMAGE", # Used by machine learning application "MCUBOOT_FPROTECT_ALLOW_COMBINED_REGIONS", # Used in migration documentation "ML_APP_INCLUDE_REMOTE_IMAGE", # Used by machine learning application "ML_APP_REMOTE_BOARD", # Used by machine learning application "MY_APP_IMAGE_ABC", # Used in documentation + "NETCORE_ABC", # Used in documentation "REMOTE_GLOBAL_DOMAIN_CLOCK_FREQUENCY_SWITCHING", # Used in tests "SOC_FLASH_NRF_RADIO_SYNC_RPC", # Used in documentation "SUIT_ENVELOPE_", # Used by jinja From e8f5a03719caaa0fd625cdd53bac1a5b007aec3c Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Tue, 8 Jul 2025 13:59:15 +0100 Subject: [PATCH 1782/2141] [nrf noup] scripts: ci: check_compliance: Add undefined Kconfigs Adds undefined Kconfigs used in NCS to the allow list for Kconfig compliance checks Signed-off-by: Jamie McCrae --- scripts/ci/check_compliance.py | 75 ++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index 3ab73f75872f..49cea126a677 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -1379,6 +1379,81 @@ def check_no_undef_outside_kconfig(self, kconf): # documentation "ZTEST_FAIL_TEST_", # regex in tests/ztest/fail/CMakeLists.txt # zephyr-keep-sorted-stop + + # NCS-specific allow list + # zephyr-keep-sorted-start re(^\s+") + "APPLICATION", # Example documentation + "BAR", # Example documentation + "BOOT_IMAGE_ACCESS_HOOK", # MCUboot setting used in documentation + "BT_ADV_PROV_", # Documentation + "BT_CTLR_TX_PWR_MINUS", # CHIP documentation + "BT_CTLR_TX_PWR_MINUS_", # CHIP documentation + "BT_CTLR_TX_PWR_PLUS", # CHIP documentation + "BT_CTLR_TX_PWR_PLUS_", # CHIP documentation + "BT_SDC_ADDITIONAL_MEMORY", # From dragoon repo + "CHANNEL", # NRF desktop + "CHANNEL_FETCHED_DATA_MAX_SIZE", # NRF desktop + "CHANNEL_TRANSPORT_DISABLED", # NRF desktop + "CHANNEL_TRANSPORT_IDLE", # NRF desktop + "CHANNEL_TRANSPORT_RSP_READY", # NRF desktop + "CHANNEL_TRANSPORT_WAIT_RSP", # NRF desktop + "CHIP_DFU_OVER_BT_SMP", # CHIP module + "CHIP_LAST_FABRIC_REMOVED_ACTION_DELAY", # CHIP module + "CHIP_LAST_FABRIC_REMOVED_ERASE_AND_PAIRING_START", # CHIP module + "CHIP_LAST_FABRIC_REMOVED_ERASE_AND_REBOOT", # CHIP module + "CHIP_LAST_FABRIC_REMOVED_ERASE_ONLY", # CHIP module + "CHIP_LAST_FABRIC_REMOVED_NONE", # CHIP module + "CHIP_MEMORY_PROFILING", # CHIP module + "CHIP_NUS", # CHIP module + "CHIP_NUS_FIXED_PASSKEY", # CHIP module + "CHIP_NUS_MAX_COMMANDS", # CHIP module + "CHIP_NUS_MAX_COMMAND_LEN", # CHIP module + "CHIP_QSPI_NOR", # CHIP module + "CHIP_SPI_NOR", # CHIP module + "CHIP_WIFI", # CHIP module + "DESKTOP_DVFS_STATE_", # NRF desktop + "DESKTOP_DVFS_STATE_CONFIG_CHANNEL_ENABLE", # NRF desktop + "DESKTOP_DVFS_STATE_INITIALIZING_ENABLE", # NRF desktop + "DESKTOP_DVFS_STATE_LLPM_CONNECTED_ENABLE", # NRF desktop + "DESKTOP_DVFS_STATE_SMP_TRANSFER_ENABLE", # NRF desktop + "DESKTOP_DVFS_STATE_USB_CONNECTED_ENABLE", # NRF desktop + "FACTORY_DATA_CUSTOM_BACKEND", # CHIP module + "MEMFAULT_", # Documentation + "MEMFAULT_NCS", # Documentation + "MEMFAULT_NCS_", # Documentation + "MY_CUSTOM_CONFIG", # Example documentation + "MY_EXT_API_ENABLED", # Example documentation + "MY_EXT_API_REQUIRED", # Example documentation + "NCS_IS_VARIANT_IMAGE", # Build system defined symbol + "NCS_MCUBOOT_UUID_CID_IMAGE_0_VALUE", # MCUboot + "NCS_MCUBOOT_UUID_CID_IMAGE_1_VALUE", # MCUboot + "NCS_VARIANT_MERGE_KCONFIG", # Build system defined symbol + "NRF_MODEM_LIB_TRACE_BACKEND_MY_TRACE_BACKEND", # Documentation + "PM_PARTITION_SIZE", # Used in search link + "PM_PARTITION_SIZE_", # Used in documentation + "PM_PARTITION_SIZE_MEMFAULT_STORAGE", # Created by Kconfig template + "PM_PARTITION_SIZE_SETTINGS", # Created by Kconfig template + "SOC_NRF54H20_CPUSEC", # Internal + "SSF_SERVER_PSA_CRYPTO_SERVICE_ENABLED", # Internal + "STATUS_", # NRF desktop + "STATUS_COUNT", # NRF desktop + "STATUS_DISCONNECTED", # NRF desktop + "STATUS_FETCH", # NRF desktop + "STATUS_GET_BOARD_NAME", # NRF desktop + "STATUS_GET_HWID", # NRF desktop + "STATUS_GET_MAX_MOD_ID", # NRF desktop + "STATUS_GET_PEER", # NRF desktop + "STATUS_GET_PEERS_CACHE", # NRF desktop + "STATUS_INDEX_PEERS", # NRF desktop + "STATUS_LIST", # NRF desktop + "STATUS_PENDING", # NRF desktop + "STATUS_POS", # NRF desktop + "STATUS_REJECT", # NRF desktop + "STATUS_SET", # NRF desktop + "STATUS_SUCCESS", # NRF desktop + "STATUS_TIMEOUT", # NRF desktop + "STATUS_WRITE_FAIL", # NRF desktop + # zephyr-keep-sorted-stop } From 1fe09df625206d83c43debb8651098dbac1641b0 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Mon, 7 Jul 2025 09:02:08 +0100 Subject: [PATCH 1783/2141] [nrf noup] scripts: ci: check_compliance: Exclude some docs Adds the NCS release notes folder to the exclusion list for undefined Kconfigs so that old Kconfigs can be used e.g. for old release notes, and lwm2m carrier library changelog. Also adds a nrf7x page which details setup instructions for software on Linux Signed-off-by: Jamie McCrae --- scripts/ci/check_compliance.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index 49cea126a677..f9d44ab7bc8b 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -1180,6 +1180,9 @@ def check_no_undef_outside_kconfig(self, kconf): grep_stdout = git("grep", "--line-number", "-I", "--null", "--perl-regexp", regex, "--", ":!/doc/releases", ":!/doc/security/vulnerabilities.rst", + ":!/doc/nrf/releases_and_maturity", + ":!/doc/nrf/libraries/bin/lwm2m_carrier/CHANGELOG.rst", + ":!/doc/nrf/app_dev/device_guides/nrf70/wifi_advanced_security_modes.rst", cwd=GIT_TOP) # splitlines() supports various line terminators From 9b6ac3c1dbc7d9984c88a42ede0f04f1f4600c63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Thu, 25 Sep 2025 14:31:31 +0200 Subject: [PATCH 1784/2141] [nrf fromtree] tests: drivers: spi: spi_loopback: Run test on nrf54h20 PPR XIP MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The spi_loopback test requires more RAM than is avilable on nrf54h20dk/nrf54h20/cpuppr target. Meanwhile, test fits in Execute In Place (XIP) variant of the PPR target. Switch spi_loopback test to nrf54h20 PPR XIP target. Signed-off-by: Sebastian Głąb (cherry picked from commit 6d76a71fa2590259dfbc68f9ec0e21438e2fb92e) --- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 11 ----------- .../boards/nrf54h20dk_nrf54h20_cpuppr.conf | 1 - .../boards/nrf54h20dk_nrf54h20_cpuppr_xip.conf | 2 ++ ...overlay => nrf54h20dk_nrf54h20_cpuppr_xip.overlay} | 2 +- 4 files changed, 3 insertions(+), 13 deletions(-) delete mode 100644 tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuppr.conf create mode 100644 tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuppr_xip.conf rename tests/drivers/spi/spi_loopback/boards/{nrf54h20dk_nrf54h20_cpuppr.overlay => nrf54h20dk_nrf54h20_cpuppr_xip.overlay} (66%) diff --git a/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index 17c2909717f2..aa5dc30239ce 100644 --- a/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -7,15 +7,4 @@ &spi130 { memory-regions = <&cpuapp_dma_region>; - zephyr,pm-device-runtime-auto; - slow@0 { - compatible = "test-spi-loopback-slow"; - reg = <0>; - spi-max-frequency = ; - }; - fast@0 { - compatible = "test-spi-loopback-fast"; - reg = <0>; - spi-max-frequency = ; - }; }; diff --git a/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuppr.conf b/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuppr.conf deleted file mode 100644 index af7d7e938e0f..000000000000 --- a/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuppr.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_SPI_LARGE_BUFFER_SIZE=1024 diff --git a/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuppr_xip.conf b/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuppr_xip.conf new file mode 100644 index 000000000000..250de8d4487a --- /dev/null +++ b/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuppr_xip.conf @@ -0,0 +1,2 @@ +CONFIG_SPI_LARGE_BUFFER_SIZE=1024 +CONFIG_SPI_IDEAL_TRANSFER_DURATION_SCALING=15 diff --git a/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuppr.overlay b/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuppr_xip.overlay similarity index 66% rename from tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuppr.overlay rename to tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuppr_xip.overlay index cea31612851b..76ebe3410375 100644 --- a/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuppr.overlay +++ b/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuppr_xip.overlay @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Nordic Semiconductor ASA + * Copyright (c) 2025 Nordic Semiconductor ASA * * SPDX-License-Identifier: Apache-2.0 */ From da5ea24707a09235cf6757869d2358b077dc8d41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Fri, 26 Sep 2025 12:00:21 +0200 Subject: [PATCH 1785/2141] [nrf fromtree] tests: drivers: spi: spi_error_cases: Extend platform_allow list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add Radio core and PPR core on nrf54h20 DK to platform_allow list. Required overlays are already present. Signed-off-by: Sebastian Głąb (cherry picked from commit bc2c95c8f0d2bd9381316e9fc40c9ad430043842) --- tests/drivers/spi/spi_error_cases/testcase.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/drivers/spi/spi_error_cases/testcase.yaml b/tests/drivers/spi/spi_error_cases/testcase.yaml index 9ad509baddb0..eb3f4c78c580 100644 --- a/tests/drivers/spi/spi_error_cases/testcase.yaml +++ b/tests/drivers/spi/spi_error_cases/testcase.yaml @@ -11,8 +11,10 @@ tests: drivers.spi.spi_error_cases: platform_allow: - nrf52840dk/nrf52840 - - nrf54l15dk/nrf54l15/cpuapp - nrf54h20dk/nrf54h20/cpuapp + - nrf54h20dk/nrf54h20/cpuppr + - nrf54h20dk/nrf54h20/cpurad + - nrf54l15dk/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: From 95d4657707b483da801b41ed26cf3f71770bc15a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Fri, 26 Sep 2025 13:33:14 +0200 Subject: [PATCH 1786/2141] [nrf fromtree] boards: nordic: nrf54h20dk: Add SPI to supported features on PPR XIP MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Enable Twister tests that depend on SPI feature on nrf54h20dk/nrf54h20/cpuppr/xip target. Signed-off-by: Sebastian Głąb (cherry picked from commit ba8b36c8a1c22e60c38287ae855e9fb15ed088a9) --- .../nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr_xip_0_9_0.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr_xip_0_9_0.yaml b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr_xip_0_9_0.yaml index 7198a379a9c9..58c6473538d9 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr_xip_0_9_0.yaml +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr_xip_0_9_0.yaml @@ -12,3 +12,4 @@ ram: 62 flash: 64 supported: - gpio + - spi From 05b8b21aa9779fb1cb19ad59e7443ebec460aeee Mon Sep 17 00:00:00 2001 From: Piotr Kosycarz Date: Tue, 30 Sep 2025 12:51:06 +0200 Subject: [PATCH 1787/2141] [nrf fromtree] boards: nordic: nrf54h20dk: fix flashing for xip variants Make sure operations are groupped when using ppr/xip and flpr/xip. Signed-off-by: Piotr Kosycarz (cherry picked from commit e3a3fca7facfbfa1adddfc779ccc46481150c689) --- boards/nordic/nrf54h20dk/board.yml | 40 ++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/boards/nordic/nrf54h20dk/board.yml b/boards/nordic/nrf54h20dk/board.yml index 2d3d40c20e0b..1a505729f99c 100644 --- a/boards/nordic/nrf54h20dk/board.yml +++ b/boards/nordic/nrf54h20dk/board.yml @@ -14,3 +14,43 @@ board: default: "0.9.0" revisions: - name: "0.9.0" +runners: + run_once: + '--recover': + - runners: + - nrfutil + run: first + groups: + - boards: + - nrf54h20dk@0.9.0/nrf54h20/cpuapp + - nrf54h20dk@0.9.0/nrf54h20/cpurad + - nrf54h20dk@0.9.0/nrf54h20/cpuppr + - nrf54h20dk@0.9.0/nrf54h20/cpuppr/xip + - nrf54h20dk@0.9.0/nrf54h20/cpuflpr + - nrf54h20dk@0.9.0/nrf54h20/cpuflpr/xip + '--erase': + - runners: + - jlink + - nrfutil + run: first + groups: + - boards: + - nrf54h20dk@0.9.0/nrf54h20/cpuapp + - nrf54h20dk@0.9.0/nrf54h20/cpurad + - nrf54h20dk@0.9.0/nrf54h20/cpuppr + - nrf54h20dk@0.9.0/nrf54h20/cpuppr/xip + - nrf54h20dk@0.9.0/nrf54h20/cpuflpr + - nrf54h20dk@0.9.0/nrf54h20/cpuflpr/xip + '--reset': + - runners: + - jlink + - nrfutil + run: last + groups: + - boards: + - nrf54h20dk@0.9.0/nrf54h20/cpuapp + - nrf54h20dk@0.9.0/nrf54h20/cpurad + - nrf54h20dk@0.9.0/nrf54h20/cpuppr + - nrf54h20dk@0.9.0/nrf54h20/cpuppr/xip + - nrf54h20dk@0.9.0/nrf54h20/cpuflpr + - nrf54h20dk@0.9.0/nrf54h20/cpuflpr/xip From 757def121e5ac7c9ff655a530a286bc24b8b53ce Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Mon, 8 Sep 2025 14:41:23 +0200 Subject: [PATCH 1788/2141] [nrf fromtree] drivers: power_domain: nrfs_gdpwr: depend on multithreading The NRFS GDPWR device driver requires NRFS which requires multithreading. Add dependency to Kconfig for the device driver to exclude it when building for single threaded apps like mcuboot. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit 9a6dba9bd633e0e7a7e0c6f02e84650d89ac73c3) --- drivers/power_domain/Kconfig.nrfs_gdpwr | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/power_domain/Kconfig.nrfs_gdpwr b/drivers/power_domain/Kconfig.nrfs_gdpwr index bf9abd59aedb..c5f05d88a7ee 100644 --- a/drivers/power_domain/Kconfig.nrfs_gdpwr +++ b/drivers/power_domain/Kconfig.nrfs_gdpwr @@ -4,6 +4,7 @@ config POWER_DOMAIN_NRFS_GDPWR bool "NRFS Global Domain Power Request driver" depends on DT_HAS_NORDIC_NRFS_GDPWR_ENABLED + depends on MULTITHREADING select NRFS select NRFS_GDPWR_SERVICE_ENABLED default y From a699574237d924dbc1a13b5b9630705a54902e7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Wed, 24 Sep 2025 10:33:34 +0200 Subject: [PATCH 1789/2141] [nrf fromtree] drivers: mspi_dw: Add support for CONFIG_MULTITHREADING=n MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add possibility to use the driver in configurations with disabled multithreading. It may be useful in bootloaders, for example. Signed-off-by: Andrzej Głąbek (cherry picked from commit c8e3bfac1c47ea193731e51b458365f77dc321f3) --- drivers/mspi/mspi_dw.c | 62 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 60 insertions(+), 2 deletions(-) diff --git a/drivers/mspi/mspi_dw.c b/drivers/mspi/mspi_dw.c index f1195314c6c2..f2ad49759e07 100644 --- a/drivers/mspi/mspi_dw.c +++ b/drivers/mspi/mspi_dw.c @@ -65,11 +65,16 @@ struct mspi_dw_data { bool standard_spi; bool suspended; +#if defined(CONFIG_MULTITHREADING) struct k_sem finished; /* For synchronization of API calls made from different contexts. */ struct k_sem ctx_lock; /* For locking of controller configuration. */ struct k_sem cfg_lock; +#else + volatile bool finished; + bool cfg_lock; +#endif struct mspi_xfer xfer; #if defined(CONFIG_MSPI_DW_HANDLE_FIFOS_IN_SYSTEM_WORKQUEUE) @@ -364,7 +369,11 @@ static void handle_fifos(const struct device *dev) if (finished) { set_imr(dev, 0); +#if defined(CONFIG_MULTITHREADING) k_sem_give(&dev_data->finished); +#else + dev_data->finished = true; +#endif } } @@ -816,8 +825,17 @@ static int api_dev_config(const struct device *dev, int rc; if (dev_id != dev_data->dev_id) { +#if defined(CONFIG_MULTITHREADING) rc = k_sem_take(&dev_data->cfg_lock, K_MSEC(CONFIG_MSPI_COMPLETION_TIMEOUT_TOLERANCE)); +#else + if (dev_data->cfg_lock) { + rc = -1; + } else { + dev_data->cfg_lock = true; + rc = 0; + } +#endif if (rc < 0) { LOG_ERR("Failed to switch controller to device"); return -EBUSY; @@ -831,15 +849,23 @@ static int api_dev_config(const struct device *dev, return 0; } +#if defined(CONFIG_MULTITHREADING) (void)k_sem_take(&dev_data->ctx_lock, K_FOREVER); +#endif rc = _api_dev_config(dev, param_mask, cfg); +#if defined(CONFIG_MULTITHREADING) k_sem_give(&dev_data->ctx_lock); +#endif if (rc < 0) { dev_data->dev_id = NULL; +#if defined(CONFIG_MULTITHREADING) k_sem_give(&dev_data->cfg_lock); +#else + dev_data->cfg_lock = false; +#endif } return rc; @@ -851,12 +877,17 @@ static int api_get_channel_status(const struct device *dev, uint8_t ch) struct mspi_dw_data *dev_data = dev->data; +#if defined(CONFIG_MULTITHREADING) (void)k_sem_take(&dev_data->ctx_lock, K_FOREVER); +#endif dev_data->dev_id = NULL; +#if defined(CONFIG_MULTITHREADING) k_sem_give(&dev_data->cfg_lock); - k_sem_give(&dev_data->ctx_lock); +#else + dev_data->cfg_lock = false; +#endif return 0; } @@ -1119,7 +1150,17 @@ static int start_next_packet(const struct device *dev, k_timeout_t timeout) /* Write SER to start transfer */ write_ser(dev, BIT(dev_data->dev_id->dev_idx)); +#if defined(CONFIG_MULTITHREADING) rc = k_sem_take(&dev_data->finished, timeout); +#else + if (!WAIT_FOR(dev_data->finished, + dev_data->xfer.timeout * USEC_PER_MSEC, + NULL)) { + rc = -ETIMEDOUT; + } + + dev_data->finished = false; +#endif if (read_risr(dev) & RISR_RXOIR_BIT) { LOG_ERR("RX FIFO overflow occurred"); rc = -EIO; @@ -1232,7 +1273,9 @@ static int api_transceive(const struct device *dev, return rc; } +#if defined(CONFIG_MULTITHREADING) (void)k_sem_take(&dev_data->ctx_lock, K_FOREVER); +#endif if (dev_data->suspended) { rc = -EFAULT; @@ -1240,7 +1283,9 @@ static int api_transceive(const struct device *dev, rc = _api_transceive(dev, req); } +#if defined(CONFIG_MULTITHREADING) k_sem_give(&dev_data->ctx_lock); +#endif rc2 = pm_device_runtime_put(dev); if (rc2 < 0) { @@ -1391,7 +1436,9 @@ static int api_xip_config(const struct device *dev, return rc; } +#if defined(CONFIG_MULTITHREADING) (void)k_sem_take(&dev_data->ctx_lock, K_FOREVER); +#endif if (dev_data->suspended) { rc = -EFAULT; @@ -1399,7 +1446,9 @@ static int api_xip_config(const struct device *dev, rc = _api_xip_config(dev, dev_id, cfg); } +#if defined(CONFIG_MULTITHREADING) k_sem_give(&dev_data->ctx_lock); +#endif rc2 = pm_device_runtime_put(dev); if (rc2 < 0) { @@ -1450,8 +1499,12 @@ static int dev_pm_action_cb(const struct device *dev, return rc; } #endif +#if defined(CONFIG_MULTITHREADING) if (xip_enabled || k_sem_take(&dev_data->ctx_lock, K_NO_WAIT) != 0) { +#else + if (xip_enabled) { +#endif LOG_ERR("Controller in use, cannot be suspended"); return -EBUSY; } @@ -1460,7 +1513,9 @@ static int dev_pm_action_cb(const struct device *dev, vendor_specific_suspend(dev); +#if defined(CONFIG_MULTITHREADING) k_sem_give(&dev_data->ctx_lock); +#endif return 0; } @@ -1470,7 +1525,6 @@ static int dev_pm_action_cb(const struct device *dev, static int dev_init(const struct device *dev) { - struct mspi_dw_data *dev_data = dev->data; const struct mspi_dw_config *dev_config = dev->config; const struct gpio_dt_spec *ce_gpio; int rc; @@ -1481,9 +1535,13 @@ static int dev_init(const struct device *dev) dev_config->irq_config(); +#if defined(CONFIG_MULTITHREADING) + struct mspi_dw_data *dev_data = dev->data; + k_sem_init(&dev_data->finished, 0, 1); k_sem_init(&dev_data->cfg_lock, 1, 1); k_sem_init(&dev_data->ctx_lock, 1, 1); +#endif #if defined(CONFIG_MSPI_DW_HANDLE_FIFOS_IN_SYSTEM_WORKQUEUE) dev_data->dev = dev; From 281b931a4c2df772ee007b092165358e3e21f5f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Wed, 24 Sep 2025 10:37:10 +0200 Subject: [PATCH 1790/2141] [nrf fromtree] drivers: flash_mspi_nor: Add support for CONFIG_MULTITHREADING=n MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add possibility to use the driver in configurations with disabled multithreading. It may be useful in bootloaders, for example. Signed-off-by: Andrzej Głąbek (cherry picked from commit 828bde8213edef44bb1304044a52dad7240c7397) --- drivers/flash/flash_mspi_nor.c | 12 +++++++++++- drivers/flash/flash_mspi_nor.h | 2 ++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/flash/flash_mspi_nor.c b/drivers/flash/flash_mspi_nor.c index a634b3d9118b..03430401de0c 100644 --- a/drivers/flash/flash_mspi_nor.c +++ b/drivers/flash/flash_mspi_nor.c @@ -237,7 +237,9 @@ static int acquire(const struct device *dev) struct flash_mspi_nor_data *dev_data = dev->data; int rc; +#if defined(CONFIG_MULTITHREADING) k_sem_take(&dev_data->acquired, K_FOREVER); +#endif rc = pm_device_runtime_get(dev_config->bus); if (rc < 0) { @@ -269,21 +271,27 @@ static int acquire(const struct device *dev) (void)pm_device_runtime_put(dev_config->bus); } +#if defined(CONFIG_MULTITHREADING) k_sem_give(&dev_data->acquired); +#endif + return rc; } static void release(const struct device *dev) { const struct flash_mspi_nor_config *dev_config = dev->config; - struct flash_mspi_nor_data *dev_data = dev->data; /* This releases the MSPI controller. */ (void)mspi_get_channel_status(dev_config->bus, 0); (void)pm_device_runtime_put(dev_config->bus); +#if defined(CONFIG_MULTITHREADING) + struct flash_mspi_nor_data *dev_data = dev->data; + k_sem_give(&dev_data->acquired); +#endif } static inline uint32_t dev_flash_size(const struct device *dev) @@ -1215,7 +1223,9 @@ static int drv_init(const struct device *dev) } } +#if defined(CONFIG_MULTITHREADING) k_sem_init(&dev_data->acquired, 1, K_SEM_MAX_LIMIT); +#endif return pm_device_driver_init(dev, dev_pm_action_cb); } diff --git a/drivers/flash/flash_mspi_nor.h b/drivers/flash/flash_mspi_nor.h index 480bccce4729..86c824cf4856 100644 --- a/drivers/flash/flash_mspi_nor.h +++ b/drivers/flash/flash_mspi_nor.h @@ -104,7 +104,9 @@ struct flash_mspi_nor_config { }; struct flash_mspi_nor_data { +#if defined(CONFIG_MULTITHREADING) struct k_sem acquired; +#endif struct mspi_xfer_packet packet; struct mspi_xfer xfer; struct jesd216_erase_type erase_types[JESD216_NUM_ERASE_TYPES]; From b804bab5603109ffa643be8c5b2a0a914edaec22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Wed, 24 Sep 2025 09:36:30 +0200 Subject: [PATCH 1791/2141] [nrf fromtree] tests: mspi: flash: Add scenario for non-multithreading flash_mspi_nor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add test scenario for the flash_mspi_nor driver used in a configuration with disable multithreading. Signed-off-by: Andrzej Głąbek (cherry picked from commit 804508f775bd35603e5a5ac4c5243d24535fe7a0) --- tests/drivers/mspi/flash/testcase.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/drivers/mspi/flash/testcase.yaml b/tests/drivers/mspi/flash/testcase.yaml index dba610a40235..ae1db5d4d6d2 100644 --- a/tests/drivers/mspi/flash/testcase.yaml +++ b/tests/drivers/mspi/flash/testcase.yaml @@ -36,3 +36,9 @@ tests: - nrf54h20dk/nrf54h20/cpuapp extra_configs: - CONFIG_MSPI_DW_HANDLE_FIFOS_IN_SYSTEM_WORKQUEUE=y + drivers.mspi.flash.mspi_nor_no_multithreading: + filter: dt_alias_exists("mspi0") and CONFIG_FLASH_MSPI_NOR + integration_platforms: + - nrf54h20dk/nrf54h20/cpuapp + extra_configs: + - CONFIG_MULTITHREADING=n From a52c2f755b645f4bc4d4af5762ed4a7d582d46d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Fri, 26 Sep 2025 14:17:46 +0200 Subject: [PATCH 1792/2141] [nrf fromtree] drivers: mspi_dw: Fix race condition in RX interrupt handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refactor a bit the RX FIFO handling to prevent RX transfers performed in Single IO mode from getting stuck when they are suspended due to the empty TX FIFO and cannot be resumed because there is no further interrupt in which the TX FIFO could be filled properly with dummy bytes above its transfer start level. Signed-off-by: Andrzej Głąbek (cherry picked from commit f0f5f8cdef74c79e2f28048dd842a05a1241e5af) --- drivers/mspi/mspi_dw.c | 48 ++++++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/drivers/mspi/mspi_dw.c b/drivers/mspi/mspi_dw.c index f2ad49759e07..f7be2e33c9e5 100644 --- a/drivers/mspi/mspi_dw.c +++ b/drivers/mspi/mspi_dw.c @@ -250,9 +250,12 @@ static bool read_rx_fifo(const struct device *dev, uint8_t *buf_pos = dev_data->buf_pos; const uint8_t *buf_end = &packet->data_buf[packet->num_bytes]; uint8_t bytes_per_frame_exp = dev_data->bytes_per_frame_exp; - /* See `room` in tx_data(). */ - uint32_t in_fifo = 1; uint32_t remaining_frames; + uint32_t in_fifo = FIELD_GET(RXFLR_RXTFL_MASK, read_rxflr(dev)); + + if (in_fifo == 0) { + return false; + } do { uint32_t data = read_dr(dev); @@ -327,28 +330,37 @@ static void handle_fifos(const struct device *dev) } } else { for (;;) { + /* Always read everything from the RX FIFO, regardless + * of the interrupt status. + * tx_dummy_bytes() subtracts the number of items that + * are present in the RX FIFO from the number of dummy + * bytes it is allowed to send, so it can potentially + * not fill the TX FIFO above its transfer start level + * in some iteration of this loop. If in such case the + * interrupt handler exited without emptying the RX FIFO + * (seeing the RXFIS flag not set due to not enough + * items in the RX FIFO), this could lead to a situation + * in which a transfer stopped temporarily (after the TX + * FIFO got empty) is not resumed (since the TX FIFO is + * not filled above its transfer start level), so no + * further dummy bytes are transmitted and the RX FIFO + * has no chance to get new entries, hence no further + * interrupts are generated and the transfer gets stuck. + */ + if (read_rx_fifo(dev, packet)) { + finished = true; + break; + } + /* Use RISR, not ISR, because when this function is * executed through the system workqueue, all interrupts * are masked (IMR is 0). */ uint32_t int_status = read_risr(dev); - if (int_status & RISR_RXFIR_BIT) { - if (read_rx_fifo(dev, packet)) { - finished = true; - break; - } - - if (int_status & RISR_RXOIR_BIT) { - finished = true; - break; - } - - /* Refresh interrupt status, as during reading - * from the RX FIFO, the TX FIFO status might - * have changed. - */ - int_status = read_risr(dev); + if (int_status & RISR_RXOIR_BIT) { + finished = true; + break; } if (dev_data->dummy_bytes == 0 || From e2ea7ff53ff6701c74be3da713c33d473c311aad Mon Sep 17 00:00:00 2001 From: Rubin Gerritsen Date: Wed, 1 Oct 2025 11:05:43 +0200 Subject: [PATCH 1793/2141] [nrf fromtree] scripts: compliance: Add basic cmake style checks It is very common to see a comment stating that the "No Space Before Opening Brackets" style guide is not followed. To avoid putting this burdon on reviewers, let the compliance check catch this instead. Checking for tab indentation was also very simple, so also added this. Running this check on all files finds many violations: - Space before opening brackets: 141 violations - Tab indentation: 420 violations Fixing these will not be done as part of this PR. Adding the check will prevent us from adding new violations. Signed-off-by: Rubin Gerritsen (cherry picked from commit e9abaf435ba93c31112bba32861ec8c0a22b9574) --- scripts/ci/check_compliance.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index f9d44ab7bc8b..0c4ae7baecc2 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -1793,6 +1793,34 @@ def filter_py(root, fnames): mime=True) == "text/x-python")] +class CMakeStyle(ComplianceTest): + """ + Checks cmake style added/modified files + """ + name = "CMakeStyle" + doc = "See https://docs.zephyrproject.org/latest/contribute/style/cmake.html for more details." + + def run(self): + # Loop through added/modified files + for fname in get_files(filter="d"): + if fname.endswith(".cmake") or fname == "CMakeLists.txt": + self.check_style(fname) + + def check_style(self, fname): + SPACE_BEFORE_OPEN_BRACKETS_CHECK = re.compile(r"^\s*if\s+\(") + TAB_INDENTATION_CHECK = re.compile(r"^\t+") + + with open(fname, encoding="utf-8") as f: + for line_num, line in enumerate(f.readlines(), start=1): + if TAB_INDENTATION_CHECK.match(line): + self.fmtd_failure("error", "CMakeStyle", fname, line_num, + "Use spaces instead of tabs for indentation") + + if SPACE_BEFORE_OPEN_BRACKETS_CHECK.match(line): + self.fmtd_failure("error", "CMakeStyle", fname, line_num, + "Remove space before '(' in if() statements") + + class Identity(ComplianceTest): """ Checks if Emails of author and signed-off messages are consistent. From d47f109210e74e2e9df3ab5485a32b8a34254caf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=AD=20Bol=C3=ADvar?= Date: Wed, 1 Oct 2025 11:56:36 -0500 Subject: [PATCH 1794/2141] [nrf fromtree] scripts: dts: fix CMake DT API helper for compatible properties MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Our build system DT API has a dt_comp_path() function used to look up paths of nodes with a given compatible. This relies on the generated edt.pickle.cmake file in the build directory to look inside the concrete devicetree for the current application build. The script gen_dts_cmake.py is responsible for generating edt.pickle.cmake. It currently generates the data needed by dt_comp_path() by looking inside each edtlib.Node object's "props" attribute. This attribute in turn is fed by the "properties:" key in the node's YAML binding. This leads to an edge case which is breaking the dt_comp_path() API. In most cases, we don't notice this edge case because base.yaml, which is included by nearly all bindings, has a definition for "compatible" in its "properties:" map. However, bindings are not required to include base.yaml, and bindings do not have to explicitliy define a "compatible" entry in their "properties:". An example of a binding that does neither is fixed-partitions.yaml: it only has #address-cells and #size-cells in its "properties:". Nonetheless, "compatible:" is always a valid property name because it's defined in the DT spec, and we should make the CMake API robustly detect all nodes with a given compatible, regardless of whether that node's binding explicitly defines it or not. To make this happen, rely on the edtlib.Node.compats attribute instead of edtlib.Node.props. The compats attribute is always defined even if the node's YAML binding doesn't have an explicit entry for "compatible". Signed-off-by: Martí Bolívar Signed-off-by: Tomasz Chyrowicz (cherry picked from commit 0907a05baf062e0029f37e4601ad6715d1a2cf1a) --- scripts/dts/gen_dts_cmake.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/scripts/dts/gen_dts_cmake.py b/scripts/dts/gen_dts_cmake.py index 5dd4a8779d32..a8a2c3df611f 100755 --- a/scripts/dts/gen_dts_cmake.py +++ b/scripts/dts/gen_dts_cmake.py @@ -134,10 +134,8 @@ def main(): cmake_prop = f'DT_PROP|{node.path}|{item}' cmake_props.append(f'"{cmake_prop}" "{escape(cmake_value)}"') - if item == 'compatible': - # compatibles is always an array - for comp in node.props[item].val: - compatible2paths[comp].append(node.path) + for comp in node.compats: + compatible2paths[comp].append(node.path) if node.regs is not None: cmake_props.append(f'"DT_REG|{node.path}|NUM" "{len(node.regs)}"') From 8e0ccac83656cc33a7236d3352f8c5eecf1f3909 Mon Sep 17 00:00:00 2001 From: Jiafei Pan Date: Tue, 16 Sep 2025 19:03:32 +0800 Subject: [PATCH 1795/2141] [nrf fromtree] requirements: update spsdk version Update spsdk version to fix dependency confliction with other software. Signed-off-by: Jiafei Pan (cherry picked from commit 77b000faaa2cf1bf7a92acbe7dde66ee2eae5dae) --- scripts/requirements-extras.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/requirements-extras.txt b/scripts/requirements-extras.txt index b7a93427d725..2d7a51cf29ab 100644 --- a/scripts/requirements-extras.txt +++ b/scripts/requirements-extras.txt @@ -19,7 +19,7 @@ junit2html lpc_checksum # used by NXP platform to generate/flash firmware images -spsdk == 2.6.0 +spsdk >= 3.0.0 # used by scripts/build/gen_cfb_font_header.py - helper script for user Pillow>=10.3.0 From 95c38eb6342e1b63bda7f1052f56c37a6a4de6d5 Mon Sep 17 00:00:00 2001 From: Adam Kondraciuk Date: Tue, 30 Sep 2025 18:44:09 +0200 Subject: [PATCH 1796/2141] [nrf fromlist] drivers: timer: nrf_grtc: Move GRTC initialization to early init GRTC is used by the logger, so it must be initialized as early as possible. On the other hand, clock requests are allowed once the clock control API has been initialized. This PR introduces a two-stage GRTC initialization to meet these requirements. Upstream PR #: 96837 Signed-off-by: Adam Kondraciuk --- drivers/timer/nrf_grtc_timer.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/timer/nrf_grtc_timer.c b/drivers/timer/nrf_grtc_timer.c index df59b9f6d4b6..75278e104bd2 100644 --- a/drivers/timer/nrf_grtc_timer.c +++ b/drivers/timer/nrf_grtc_timer.c @@ -517,6 +517,11 @@ static int sys_clock_driver_init(void) system_timeout_set_relative(CYC_PER_TICK); } + return 0; +} + +static int grtc_post_init(void) +{ #if defined(CONFIG_CLOCK_CONTROL_NRF) static const enum nrf_lfclk_start_mode mode = IS_ENABLED(CONFIG_SYSTEM_CLOCK_NO_WAIT) @@ -590,5 +595,6 @@ int nrf_grtc_timer_clock_driver_init(void) return sys_clock_driver_init(); } #else -SYS_INIT(sys_clock_driver_init, PRE_KERNEL_2, CONFIG_SYSTEM_CLOCK_INIT_PRIORITY); +SYS_INIT(sys_clock_driver_init, EARLY, CONFIG_SYSTEM_CLOCK_INIT_PRIORITY); +SYS_INIT(grtc_post_init, PRE_KERNEL_2, CONFIG_SYSTEM_CLOCK_INIT_PRIORITY); #endif From e4fed30aa551c61e1f2890811198b6ac9064b59a Mon Sep 17 00:00:00 2001 From: Robin Kastberg Date: Tue, 3 Jun 2025 08:10:53 +0000 Subject: [PATCH 1797/2141] [nrf noup] cmake: nrf54l: iar: fix cmake linker generator for kmu nrf-squash! [nrf noup] soc: nrf54l: Add custom section for KMU This adds the required parts for nrf54l kmu in cmake linker generator. Signed-off-by: Robin Kastberg --- soc/nordic/nrf54l/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/soc/nordic/nrf54l/CMakeLists.txt b/soc/nordic/nrf54l/CMakeLists.txt index d84330bffa6a..b220b9d2a7a2 100644 --- a/soc/nordic/nrf54l/CMakeLists.txt +++ b/soc/nordic/nrf54l/CMakeLists.txt @@ -16,4 +16,6 @@ if(NOT CONFIG_BUILD_WITH_TFM AND CONFIG_PSA_NEED_CRACEN_KMU_DRIVER AND NOT kmu_p # Exclamation mark is printable character with the lowest number in ASCII table. # We are sure that this file will be included first. zephyr_linker_sources(RAM_SECTIONS SORT_KEY ! kmu_push_area_section.ld) + +zephyr_linker_section(NAME ".nrf_kmu_reserved_push_area" ADDRESS "${RAM_ADDR}" GROUP RAM_REGION NOINIT) endif() From 59779a4996edf9e1a814e9bb3e07dad43738eb52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Mon, 1 Sep 2025 15:57:55 +0200 Subject: [PATCH 1798/2141] [nrf fromtree] tests: boards: nrf: dmm: Add timing measurements MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add timing measurement to the test to allow DMM profiling. Signed-off-by: Krzysztof Chruściński (cherry picked from commit f06e05097f1b2b0f92a20630b93fc504c6ec7e6f) --- .../boards/nrf5340dk_nrf5340_cpuapp.overlay | 10 ++ .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 10 ++ tests/boards/nrf/dmm/prj.conf | 4 + tests/boards/nrf/dmm/src/main.c | 153 ++++++++++++++++-- 4 files changed, 162 insertions(+), 15 deletions(-) diff --git a/tests/boards/nrf/dmm/boards/nrf5340dk_nrf5340_cpuapp.overlay b/tests/boards/nrf/dmm/boards/nrf5340dk_nrf5340_cpuapp.overlay index 3e0b1b4d5356..48a4e8adc264 100644 --- a/tests/boards/nrf/dmm/boards/nrf5340dk_nrf5340_cpuapp.overlay +++ b/tests/boards/nrf/dmm/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -1,3 +1,9 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + / { aliases { dut-cache = &spi1; @@ -52,3 +58,7 @@ pinctrl-1 = <&spi3_sleep_alt>; pinctrl-names = "default", "sleep"; }; + +cycle_timer: &timer1 { + status = "okay"; +}; diff --git a/tests/boards/nrf/dmm/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/boards/nrf/dmm/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index e3924657b86e..2507dd83dfe3 100644 --- a/tests/boards/nrf/dmm/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/tests/boards/nrf/dmm/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -1,3 +1,9 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + / { aliases { dut-cache = &spi120; @@ -58,3 +64,7 @@ pinctrl-names = "default", "sleep"; memory-regions = <&dma_fast_region>; }; + +cycle_timer: &timer120 { + status = "okay"; +}; diff --git a/tests/boards/nrf/dmm/prj.conf b/tests/boards/nrf/dmm/prj.conf index 9467c2926896..0b99d72b0c32 100644 --- a/tests/boards/nrf/dmm/prj.conf +++ b/tests/boards/nrf/dmm/prj.conf @@ -1 +1,5 @@ CONFIG_ZTEST=y +CONFIG_ASSERT=n +CONFIG_SPIN_VALIDATE=n +CONFIG_TEST_EXTRA_STACK_SIZE=512 +CONFIG_COUNTER=y diff --git a/tests/boards/nrf/dmm/src/main.c b/tests/boards/nrf/dmm/src/main.c index 214a90697525..06f4ace0e608 100644 --- a/tests/boards/nrf/dmm/src/main.c +++ b/tests/boards/nrf/dmm/src/main.c @@ -9,9 +9,12 @@ #include #include #include +#include #include +#define IS_ALIGNED64(x) IS_ALIGNED(x, sizeof(uint64_t)) + #define DUT_CACHE DT_ALIAS(dut_cache) #define DUT_NOCACHE DT_ALIAS(dut_nocache) @@ -57,13 +60,49 @@ static const struct dmm_test_region dmm_test_regions[DMM_TEST_REGION_COUNT] = { .size = DMM_TEST_GET_REG_SIZE(DUT_NOCACHE) }, }; +static const struct device *counter = DEVICE_DT_GET(DT_NODELABEL(cycle_timer)); +static uint32_t t_delta; + +static uint32_t ts_get(void) +{ + uint32_t t; + + (void)counter_get_value(counter, &t); + return t; +} + +static uint32_t ts_from_get(uint32_t from) +{ + return ts_get() - from; +} + +static uint32_t cyc_to_us(uint32_t cyc) +{ + return counter_ticks_to_us(counter, cyc); +} + +static uint32_t cyc_to_rem_ns(uint32_t cyc) +{ + uint32_t us = counter_ticks_to_us(counter, cyc); + uint32_t ns; + + cyc = cyc - counter_us_to_ticks(counter, (uint64_t)us); + ns = counter_ticks_to_us(counter, 1000 * cyc); + + return ns; +} static void *test_setup(void) { static struct dmm_fixture fixture; + uint32_t t; + counter_start(counter); + t = ts_get(); + t_delta = ts_get() - t; memcpy(fixture.regions, dmm_test_regions, sizeof(dmm_test_regions)); fixture.fill_value = 0x1; + return &fixture; } @@ -79,13 +118,25 @@ static bool dmm_buffer_in_region_check(struct dmm_test_region *dtr, void *buf, s } static void dmm_check_output_buffer(struct dmm_test_region *dtr, uint32_t *fill_value, - void *data, size_t size, bool was_prealloc, bool is_cached) + void *data, size_t size, bool was_prealloc, + bool is_cached, bool print_report) { void *buf; int retval; + uint32_t t; + bool aligned; memset(data, (*fill_value)++, size); + t = ts_get(); retval = dmm_buffer_out_prepare(dtr->mem_reg, data, size, &buf); + t = ts_from_get(t); + aligned = IS_ALIGNED64(data) && IS_ALIGNED64(buf) && IS_ALIGNED64(size); + + if (print_report) { + TC_PRINT("%saligned buffer out prepare size:%d buf:%p took %d.%dus (%d cycles)\n", + aligned ? "" : "not ", size, buf, cyc_to_us(t), cyc_to_rem_ns(t), t); + } + zassert_ok(retval); if (IS_ENABLED(CONFIG_DCACHE) && is_cached) { zassert_true(IS_ALIGNED(buf, CONFIG_DCACHE_LINE_SIZE)); @@ -104,21 +155,37 @@ static void dmm_check_output_buffer(struct dmm_test_region *dtr, uint32_t *fill_ sys_cache_data_invd_range(buf, size); zassert_mem_equal(buf, data, size); + t = ts_get(); retval = dmm_buffer_out_release(dtr->mem_reg, buf); + t = ts_from_get(t); + if (print_report) { + TC_PRINT("buffer out release buf:%p size:%d took %d.%dus (%d cycles)\n", + buf, size, cyc_to_us(t), cyc_to_rem_ns(t), t); + } zassert_ok(retval); } static void dmm_check_input_buffer(struct dmm_test_region *dtr, uint32_t *fill_value, - void *data, size_t size, bool was_prealloc, bool is_cached) + void *data, size_t size, bool was_prealloc, + bool is_cached, bool print_report) { void *buf; int retval; + uint32_t t; uint8_t intermediate_buf[128]; + bool aligned; - zassert_true(size < sizeof(intermediate_buf)); + zassert_true(size <= sizeof(intermediate_buf)); + t = ts_get(); retval = dmm_buffer_in_prepare(dtr->mem_reg, data, size, &buf); + t = ts_from_get(t); + aligned = IS_ALIGNED64(data) && IS_ALIGNED64(buf) && IS_ALIGNED64(size); zassert_ok(retval); + if (print_report) { + TC_PRINT("%saligned buffer in prepare buf:%p size:%d took %d.%dus (%d cycles)\n", + aligned ? "" : "not ", buf, size, cyc_to_us(t), cyc_to_rem_ns(t), t); + } if (IS_ENABLED(CONFIG_DCACHE) && is_cached) { zassert_true(IS_ALIGNED(buf, CONFIG_DCACHE_LINE_SIZE)); } @@ -144,7 +211,13 @@ static void dmm_check_input_buffer(struct dmm_test_region *dtr, uint32_t *fill_v memset(buf, (*fill_value)++, size); } + t = ts_get(); retval = dmm_buffer_in_release(dtr->mem_reg, data, size, buf); + t = ts_from_get(t); + if (print_report) { + TC_PRINT("buffer in release buf:%p size:%d took %d.%dus (%d cycles)\n", + buf, size, cyc_to_us(t), cyc_to_rem_ns(t), t); + } zassert_ok(retval); zassert_mem_equal(data, intermediate_buf, size); @@ -152,10 +225,14 @@ static void dmm_check_input_buffer(struct dmm_test_region *dtr, uint32_t *fill_v ZTEST_USER_F(dmm, test_check_dev_cache_in_allocate) { - uint8_t user_data[16]; + uint8_t user_data[128] __aligned(sizeof(uint64_t)); dmm_check_input_buffer(&fixture->regions[DMM_TEST_REGION_CACHE], &fixture->fill_value, - user_data, sizeof(user_data), false, true); + user_data, 16, false, true, false); + dmm_check_input_buffer(&fixture->regions[DMM_TEST_REGION_CACHE], &fixture->fill_value, + user_data, 16, false, true, true); + dmm_check_input_buffer(&fixture->regions[DMM_TEST_REGION_CACHE], &fixture->fill_value, + user_data, sizeof(user_data), false, true, true); } ZTEST_USER_F(dmm, test_check_dev_cache_in_preallocate) @@ -163,15 +240,30 @@ ZTEST_USER_F(dmm, test_check_dev_cache_in_preallocate) static uint8_t user_data[16] DMM_MEMORY_SECTION(DUT_CACHE); dmm_check_input_buffer(&fixture->regions[DMM_TEST_REGION_CACHE], &fixture->fill_value, - user_data, sizeof(user_data), true, true); + user_data, sizeof(user_data), true, true, true); } ZTEST_USER_F(dmm, test_check_dev_cache_out_allocate) { - uint8_t user_data[16]; + uint8_t user_data[129] __aligned(sizeof(uint64_t)); + + /* First run to get code into ICACHE so that following runs has consistent timing. */ + dmm_check_output_buffer(&fixture->regions[DMM_TEST_REGION_CACHE], &fixture->fill_value, + user_data, 16, false, true, false); + /* Aligned user buffer. */ + dmm_check_output_buffer(&fixture->regions[DMM_TEST_REGION_CACHE], &fixture->fill_value, + user_data, 16, false, true, true); + /* Unaligned user buffer. */ dmm_check_output_buffer(&fixture->regions[DMM_TEST_REGION_CACHE], &fixture->fill_value, - user_data, sizeof(user_data), false, true); + &user_data[1], 16, false, true, true); + + /* Aligned user buffer. */ + dmm_check_output_buffer(&fixture->regions[DMM_TEST_REGION_CACHE], &fixture->fill_value, + user_data, sizeof(user_data) - 1, false, true, true); + /* Unaligned user buffer. */ + dmm_check_output_buffer(&fixture->regions[DMM_TEST_REGION_CACHE], &fixture->fill_value, + &user_data[1], sizeof(user_data) - 1, false, true, true); } ZTEST_USER_F(dmm, test_check_dev_cache_out_preallocate) @@ -179,15 +271,31 @@ ZTEST_USER_F(dmm, test_check_dev_cache_out_preallocate) static uint8_t user_data[16] DMM_MEMORY_SECTION(DUT_CACHE); dmm_check_output_buffer(&fixture->regions[DMM_TEST_REGION_CACHE], &fixture->fill_value, - user_data, sizeof(user_data), true, true); + user_data, sizeof(user_data), true, true, true); } ZTEST_USER_F(dmm, test_check_dev_nocache_in_allocate) { - uint8_t user_data[16]; + uint8_t user_data[129] __aligned(sizeof(uint64_t)); + + dmm_check_input_buffer(&fixture->regions[DMM_TEST_REGION_NOCACHE], &fixture->fill_value, + user_data, 16, false, false, false); + + /* Aligned user buffer. */ + dmm_check_input_buffer(&fixture->regions[DMM_TEST_REGION_NOCACHE], &fixture->fill_value, + user_data, 16, false, false, true); + + /* Unaligned user buffer. */ + dmm_check_input_buffer(&fixture->regions[DMM_TEST_REGION_NOCACHE], &fixture->fill_value, + &user_data[1], 16, false, false, true); + /* Aligned user buffer. */ dmm_check_input_buffer(&fixture->regions[DMM_TEST_REGION_NOCACHE], &fixture->fill_value, - user_data, sizeof(user_data), false, false); + user_data, sizeof(user_data) - 1, false, false, true); + + /* Unaligned user buffer. */ + dmm_check_input_buffer(&fixture->regions[DMM_TEST_REGION_NOCACHE], &fixture->fill_value, + &user_data[1], sizeof(user_data) - 1, false, false, true); } ZTEST_USER_F(dmm, test_check_dev_nocache_in_preallocate) @@ -195,15 +303,30 @@ ZTEST_USER_F(dmm, test_check_dev_nocache_in_preallocate) static uint8_t user_data[16] DMM_MEMORY_SECTION(DUT_NOCACHE); dmm_check_input_buffer(&fixture->regions[DMM_TEST_REGION_NOCACHE], &fixture->fill_value, - user_data, sizeof(user_data), true, false); + user_data, sizeof(user_data), true, false, true); } ZTEST_USER_F(dmm, test_check_dev_nocache_out_allocate) { - uint8_t user_data[16]; + uint8_t user_data[129] __aligned(sizeof(uint64_t)); + /* First run to get code into ICACHE so that following results are consistent. */ + dmm_check_output_buffer(&fixture->regions[DMM_TEST_REGION_NOCACHE], &fixture->fill_value, + user_data, 16, false, false, false); + + /* Aligned user buffer. */ + dmm_check_output_buffer(&fixture->regions[DMM_TEST_REGION_NOCACHE], &fixture->fill_value, + user_data, 16, false, false, true); + /* Unaligned user buffer. */ + dmm_check_output_buffer(&fixture->regions[DMM_TEST_REGION_NOCACHE], &fixture->fill_value, + &user_data[1], 16, false, false, true); + + /* Aligned user buffer. */ + dmm_check_output_buffer(&fixture->regions[DMM_TEST_REGION_NOCACHE], &fixture->fill_value, + user_data, sizeof(user_data) - 1, false, false, true); + /* Unaligned user buffer. */ dmm_check_output_buffer(&fixture->regions[DMM_TEST_REGION_NOCACHE], &fixture->fill_value, - user_data, sizeof(user_data), false, false); + &user_data[1], sizeof(user_data) - 1, false, false, true); } ZTEST_USER_F(dmm, test_check_dev_nocache_out_preallocate) @@ -211,7 +334,7 @@ ZTEST_USER_F(dmm, test_check_dev_nocache_out_preallocate) static uint8_t user_data[16] DMM_MEMORY_SECTION(DUT_NOCACHE); dmm_check_output_buffer(&fixture->regions[DMM_TEST_REGION_NOCACHE], &fixture->fill_value, - user_data, sizeof(user_data), true, false); + user_data, sizeof(user_data), true, false, true); } ZTEST_SUITE(dmm, NULL, test_setup, NULL, test_cleanup, NULL); From ecb6fbc6bcea47d788251ee5fb6d976f9a16c5a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Tue, 2 Sep 2025 07:57:29 +0200 Subject: [PATCH 1799/2141] [nrf fromtree] soc: nordic: common: dmm: Optimize memcpy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Default memcpy used in zephyr is not optimized and performs simple byte by byte copying. Using double word or word access can significantly reduce copying time especially for RAM3 (slow peripheral RAM). Signed-off-by: Krzysztof Chruściński (cherry picked from commit ff3e0180adcf65ce62d365167c8cf7c5144fe692) --- soc/nordic/common/dmm.c | 25 +++++++++++++++++++++++-- soc/nordic/common/dmm.h | 4 ++-- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/soc/nordic/common/dmm.c b/soc/nordic/common/dmm.c index 0b4e42f8c6de..78b43e7a4b98 100644 --- a/soc/nordic/common/dmm.c +++ b/soc/nordic/common/dmm.c @@ -136,6 +136,27 @@ static void dmm_buffer_free(struct dmm_heap *dh, void *buffer) k_spin_unlock(&dh->lock, key); } +static void dmm_memcpy(void *dst, const void *src, size_t len) +{ +#define IS_ALIGNED32(x) IS_ALIGNED(x, sizeof(uint32_t)) +#define IS_ALIGNED64(x) IS_ALIGNED(x, sizeof(uint64_t)) + if (IS_ALIGNED64(len) && IS_ALIGNED64(dst) && IS_ALIGNED64(src)) { + for (uint32_t i = 0; i < len / sizeof(uint64_t); i++) { + ((uint64_t *)dst)[i] = ((uint64_t *)src)[i]; + } + return; + } + + if (IS_ALIGNED32(len) && IS_ALIGNED32(dst) && IS_ALIGNED32(src)) { + for (uint32_t i = 0; i < len / sizeof(uint32_t); i++) { + ((uint32_t *)dst)[i] = ((uint32_t *)src)[i]; + } + return; + } + + memcpy(dst, src, len); +} + int dmm_buffer_out_prepare(void *region, void const *user_buffer, size_t user_length, void **buffer_out) { @@ -172,7 +193,7 @@ int dmm_buffer_out_prepare(void *region, void const *user_buffer, size_t user_le return -ENOMEM; } /* - copy user buffer contents into allocated buffer */ - memcpy(*buffer_out, user_buffer, user_length); + dmm_memcpy(*buffer_out, user_buffer, user_length); } /* Check if device memory region is cacheable @@ -281,7 +302,7 @@ int dmm_buffer_in_release(void *region, void *user_buffer, size_t user_length, v * If no, copy allocated buffer to the user buffer */ if (buffer_in != user_buffer) { - memcpy(user_buffer, buffer_in, user_length); + dmm_memcpy(user_buffer, buffer_in, user_length); } /* If yes, no action is needed */ diff --git a/soc/nordic/common/dmm.h b/soc/nordic/common/dmm.h index 34b517c92dfc..ca627fbd55f4 100644 --- a/soc/nordic/common/dmm.h +++ b/soc/nordic/common/dmm.h @@ -35,12 +35,12 @@ extern "C" { * Cache line alignment is required if region is cacheable and data cache is enabled. */ #define DMM_REG_ALIGN_SIZE(node_id) \ - (DMM_IS_REG_CACHEABLE(node_id) ? CONFIG_DCACHE_LINE_SIZE : sizeof(uint8_t)) + (DMM_IS_REG_CACHEABLE(node_id) ? CONFIG_DCACHE_LINE_SIZE : sizeof(uint32_t)) #else #define DMM_IS_REG_CACHEABLE(node_id) 0 -#define DMM_REG_ALIGN_SIZE(node_id) (sizeof(uint8_t)) +#define DMM_REG_ALIGN_SIZE(node_id) (sizeof(uint32_t)) #endif /* CONFIG_DCACHE */ From b2666ec99f5c66553a2075a3f5a10260f0a80733 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Tue, 2 Sep 2025 07:57:53 +0200 Subject: [PATCH 1800/2141] [nrf fromtree] soc: nordic: common: dmm: Optimize by using a micro heap MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add micro heap implementation which is using one or more 32 bit masks to allocate quickly blocks. It is significantly better than using sys_heap. Difference is especially big on RAM3 heap because heap control data is in RAM3 space so operations there were extremely slowly (15 us to allocate a buffer). Simplified implementation of the heap requires DMM API change as release functions need to know the length of the allocated buffer as simple heap requires that (buffer address is enough for the standard heap). Signed-off-by: Krzysztof Chruściński (cherry picked from commit decdb30b05fdfcae677f5f98872b84afbb80fdb9) --- soc/nordic/common/Kconfig | 14 ++++ soc/nordic/common/dmm.c | 164 +++++++++++++++++++++++++++++++++----- 2 files changed, 157 insertions(+), 21 deletions(-) diff --git a/soc/nordic/common/Kconfig b/soc/nordic/common/Kconfig index 782d9452b677..b3a8f13089db 100644 --- a/soc/nordic/common/Kconfig +++ b/soc/nordic/common/Kconfig @@ -48,5 +48,19 @@ source "subsys/logging/Kconfig.template.log_config" endif # MRAM_LATENCY +if HAS_NORDIC_DMM + +config DMM_HEAP_CHUNKS + int "Number of chunks in the DMM heap" + default 32 + help + DMM is using a simplified heap which is using 32 bit mask to allocate + required buffer which consists of contiguous chunks. If there are many + small buffers used with DMM it is possible that allocation will fail. + Number of chunks is a trade-off between performance and granularity. + Must be multiply of 32. + +endif # HAS_NORDIC_DMM + rsource "vpr/Kconfig" rsource "uicr/Kconfig" diff --git a/soc/nordic/common/dmm.c b/soc/nordic/common/dmm.c index 78b43e7a4b98..411b8be14a75 100644 --- a/soc/nordic/common/dmm.c +++ b/soc/nordic/common/dmm.c @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include #include "dmm.h" @@ -26,6 +26,9 @@ .dt_align = DMM_REG_ALIGN_SIZE(node_id), \ .dt_allc = &_BUILD_LINKER_END_VAR(node_id)}, +#define HEAP_NUM_WORDS (CONFIG_DMM_HEAP_CHUNKS / 32) +BUILD_ASSERT(IS_ALIGNED(CONFIG_DMM_HEAP_CHUNKS, 32)); + /* Generate declarations of linker variables used to determine size of preallocated variables * stored in memory sections spanning over memory regions. * These are used to determine memory left for dynamic bounce buffer allocator to work with. @@ -42,9 +45,13 @@ struct dmm_region { }; struct dmm_heap { - struct sys_heap heap; + uint32_t mask[HEAP_NUM_WORDS]; + atomic_t tail_mask[HEAP_NUM_WORDS]; + uintptr_t ptr; + uintptr_t ptr_end; + size_t blk_size; const struct dmm_region *region; - struct k_spinlock lock; + sys_bitarray_t bitarray; }; static const struct dmm_region dmm_regions[] = { @@ -55,7 +62,6 @@ struct { struct dmm_heap dmm_heaps[ARRAY_SIZE(dmm_regions)]; } dmm_heaps_data; - static struct dmm_heap *dmm_heap_find(void *region) { struct dmm_heap *dh; @@ -103,37 +109,144 @@ static bool is_user_buffer_correctly_preallocated(void const *user_buffer, size_ return false; } -static size_t dmm_heap_start_get(struct dmm_heap *dh) +/* Function updates the tail bits mask after the allocation. Tail bits are all bits + * except the head. Tail bits mask together with a known index of the start of + * chunk (because freeing has a buffer address) allows to determine the size of the + * buffer (how many chunks were included. Because tail_mask is updated after allocation + * we can safely modify bits that represents allocated buffer, we only need to use + * atomic operation on the mask since mask may be modified (but different bits). + */ +static void tail_mask_set(atomic_t *tail_mask, size_t num_bits, size_t off) { - return ROUND_UP(dh->region->dt_allc, dh->region->dt_align); + size_t tail_bits = num_bits - 1; + size_t tail_off = off + 1; + + if (tail_bits == 0) { + return; + } + + if (HEAP_NUM_WORDS == 1) { + atomic_or(tail_mask, BIT_MASK(tail_bits) << tail_off); + return; + } + + /* If bit mask exceeds a single word then tail may spill to the adjacent word. */ + size_t idx = tail_off / 32; + + tail_off = tail_off - 32 * idx; + if ((tail_off + tail_bits) <= 32) { + /* Tail mask fits in a single word. */ + atomic_or(&tail_mask[idx], BIT_MASK(tail_bits) << tail_off); + return; + } + + /* Tail spilled. Remainder is set in the next word. Since number of tail_masks + * match number of words in bitarray we don't need to check if we are exceeding + * the array boundary. + */ + atomic_or(&tail_mask[idx], BIT_MASK(32 - tail_off) << tail_off); + + + size_t rem_tail = tail_bits - (32 - tail_off); + atomic_t *mask = &tail_mask[idx + 1]; + + while (rem_tail >= 32) { + atomic_or(mask, UINT32_MAX); + mask++; + rem_tail -= 32; + } + atomic_or(mask, BIT_MASK(rem_tail)); } -static size_t dmm_heap_size_get(struct dmm_heap *dh) +/* Function determines how many chunks were used for the allocated buffer. It is + * determined from tail bits mask and index of the starting chunk (%p off). + * Function is called before bits are freed in the bitarray so we can safely modify + * bits that belong to that buffer. + * + * @param tail_mask Pointer to tail_mask array. + * @param off Index of the start of the buffer. + * + * @return Number of chunks that forms the buffer that will be freed. + */ +static uint32_t num_bits_get(atomic_t *tail_mask, size_t off) { - return (dh->region->dt_size - (dmm_heap_start_get(dh) - dh->region->dt_addr)); + uint32_t mask; + uint32_t num_bits; + + if (HEAP_NUM_WORDS == 1) { + mask = (*tail_mask | BIT(off)) >> off; + num_bits = (~mask == 0) ? 32 : __builtin_ctz(~mask); + if (num_bits > 1) { + mask = BIT_MASK(num_bits - 1) << (off + 1); + atomic_and(tail_mask, ~mask); + } + + return num_bits; + } + + /* In multiword bit array we need to check if tail is spilling over to the next word. */ + size_t idx = off / 32; + size_t w_off = off - 32 * idx; + atomic_t *t_mask = &tail_mask[idx]; + + mask = (*t_mask | BIT(w_off)) >> w_off; + num_bits = (~mask == 0) ? 32 : __builtin_ctz(~mask); + if (num_bits == 1) { + return num_bits; + } + + mask = BIT_MASK(num_bits - 1) << (w_off + 1); + atomic_and(t_mask, ~mask); + if (((w_off + num_bits) == 32) && (idx < (HEAP_NUM_WORDS - 1))) { + size_t tmp_bits; + + /* If we are at the end of the one mask we need to check the beginning of the + * next one as there might be remaining part of the tail. + */ + do { + t_mask++; + tmp_bits = (*t_mask == UINT32_MAX) ? 32 : __builtin_ctz(~(*t_mask)); + mask = (tmp_bits == 32) ? UINT32_MAX : BIT_MASK(tmp_bits); + atomic_and(t_mask, ~mask); + num_bits += tmp_bits; + } while ((tmp_bits == 32) && (t_mask != &tail_mask[HEAP_NUM_WORDS - 1])); + } + + return num_bits; } static void *dmm_buffer_alloc(struct dmm_heap *dh, size_t length) { - void *ret; - k_spinlock_key_t key; + size_t num_bits, off; + int rv; + + if (dh->ptr == 0) { + /* Not initialized. */ + return NULL; + } length = ROUND_UP(length, dh->region->dt_align); + num_bits = DIV_ROUND_UP(length, dh->blk_size); + + rv = sys_bitarray_alloc(&dh->bitarray, num_bits, &off); + if (rv < 0) { + return NULL; + } - key = k_spin_lock(&dh->lock); - ret = sys_heap_aligned_alloc(&dh->heap, dh->region->dt_align, length); - k_spin_unlock(&dh->lock, key); + tail_mask_set(dh->tail_mask, num_bits, off); - return ret; + return (void *)(dh->ptr + dh->blk_size * off); } static void dmm_buffer_free(struct dmm_heap *dh, void *buffer) { - k_spinlock_key_t key; + size_t offset = ((uintptr_t)buffer - dh->ptr) / dh->blk_size; + size_t num_bits = num_bits_get(dh->tail_mask, offset); + int rv; - key = k_spin_lock(&dh->lock); - sys_heap_free(&dh->heap, buffer); - k_spin_unlock(&dh->lock, key); + rv = sys_bitarray_free(&dh->bitarray, num_bits, offset); + (void)rv; + __ASSERT_NO_MSG(rv == 0); } static void dmm_memcpy(void *dst, const void *src, size_t len) @@ -222,7 +335,7 @@ int dmm_buffer_out_release(void *region, void *buffer_out) /* Check if output buffer is contained within memory area * managed by dynamic memory allocator */ - if (is_buffer_within_region(addr, 0, dmm_heap_start_get(dh), dmm_heap_size_get(dh))) { + if (is_buffer_within_region(addr, 0, dh->ptr, dh->ptr_end)) { /* If yes, free the buffer */ dmm_buffer_free(dh, buffer_out); } @@ -309,7 +422,7 @@ int dmm_buffer_in_release(void *region, void *user_buffer, size_t user_length, v /* Check if input buffer is contained within memory area * managed by dynamic memory allocator */ - if (is_buffer_within_region(addr, 0, dmm_heap_start_get(dh), dmm_heap_size_get(dh))) { + if (is_buffer_within_region(addr, user_length, dh->ptr, dh->ptr_end)) { /* If yes, free the buffer */ dmm_buffer_free(dh, buffer_in); } @@ -321,11 +434,20 @@ int dmm_buffer_in_release(void *region, void *user_buffer, size_t user_length, v int dmm_init(void) { struct dmm_heap *dh; + int blk_cnt; + int heap_space; for (size_t idx = 0; idx < ARRAY_SIZE(dmm_regions); idx++) { dh = &dmm_heaps_data.dmm_heaps[idx]; dh->region = &dmm_regions[idx]; - sys_heap_init(&dh->heap, (void *)dmm_heap_start_get(dh), dmm_heap_size_get(dh)); + dh->ptr = ROUND_UP(dh->region->dt_allc, dh->region->dt_align); + heap_space = dh->region->dt_size - (dh->ptr - dh->region->dt_addr); + dh->blk_size = ROUND_UP(heap_space / (32 * HEAP_NUM_WORDS), dh->region->dt_align); + blk_cnt = heap_space / dh->blk_size; + dh->ptr_end = dh->ptr + blk_cnt * dh->blk_size; + dh->bitarray.num_bits = blk_cnt; + dh->bitarray.num_bundles = HEAP_NUM_WORDS; + dh->bitarray.bundles = dh->mask; } return 0; From 5fe850a48333bf372d08dbeb97e7713fb9449ad5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Mon, 1 Sep 2025 15:58:37 +0200 Subject: [PATCH 1801/2141] [nrf fromtree] tests: boards: nrf: dmm: Align test to changes in DMM MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Align to API changes. Signed-off-by: Krzysztof Chruściński (cherry picked from commit 8cc4da31ca72507ccada7414f58ed6f5af4c6f8f) --- tests/boards/nrf/dmm/src/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/boards/nrf/dmm/src/main.c b/tests/boards/nrf/dmm/src/main.c index 06f4ace0e608..6cfeb1372ec2 100644 --- a/tests/boards/nrf/dmm/src/main.c +++ b/tests/boards/nrf/dmm/src/main.c @@ -28,7 +28,7 @@ #if CONFIG_DCACHE BUILD_ASSERT(DMM_ALIGN_SIZE(DUT_CACHE) == CONFIG_DCACHE_LINE_SIZE); -BUILD_ASSERT(DMM_ALIGN_SIZE(DUT_NOCACHE) == 1); +BUILD_ASSERT(DMM_ALIGN_SIZE(DUT_NOCACHE) == sizeof(uint32_t)); #endif struct dmm_test_region { From 49b49b376e93d70cd3d84040e2c0ac9aa6cac4e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Tue, 9 Sep 2025 21:45:42 +0200 Subject: [PATCH 1802/2141] [nrf fromtree] soc: nordic: common: dmm: Add optional usage stats MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add support for getting usage statistics for DMM. Signed-off-by: Krzysztof Chruściński (cherry picked from commit d10ee98ee8294b72128fdef781fd98922c2e8250) --- soc/nordic/common/Kconfig | 3 +++ soc/nordic/common/dmm.c | 45 +++++++++++++++++++++++++++++++++++++++ soc/nordic/common/dmm.h | 27 +++++++++++++++++++++++ 3 files changed, 75 insertions(+) diff --git a/soc/nordic/common/Kconfig b/soc/nordic/common/Kconfig index b3a8f13089db..e1fcd713c77c 100644 --- a/soc/nordic/common/Kconfig +++ b/soc/nordic/common/Kconfig @@ -60,6 +60,9 @@ config DMM_HEAP_CHUNKS Number of chunks is a trade-off between performance and granularity. Must be multiply of 32. +config DMM_STATS + bool "Usage statistics" + endif # HAS_NORDIC_DMM rsource "vpr/Kconfig" diff --git a/soc/nordic/common/dmm.c b/soc/nordic/common/dmm.c index 411b8be14a75..e832a1f27b80 100644 --- a/soc/nordic/common/dmm.c +++ b/soc/nordic/common/dmm.c @@ -52,6 +52,11 @@ struct dmm_heap { size_t blk_size; const struct dmm_region *region; sys_bitarray_t bitarray; +#ifdef CONFIG_DMM_STATS + atomic_t curr_use; + uint32_t max_use; + struct k_spinlock lock; +#endif }; static const struct dmm_region dmm_regions[] = { @@ -235,6 +240,15 @@ static void *dmm_buffer_alloc(struct dmm_heap *dh, size_t length) tail_mask_set(dh->tail_mask, num_bits, off); +#ifdef CONFIG_DMM_STATS + k_spinlock_key_t key; + + key = k_spin_lock(&dh->lock); + dh->curr_use += num_bits; + dh->max_use = MAX(dh->max_use, dh->curr_use); + k_spin_unlock(&dh->lock, key); +#endif + return (void *)(dh->ptr + dh->blk_size * off); } @@ -244,6 +258,9 @@ static void dmm_buffer_free(struct dmm_heap *dh, void *buffer) size_t num_bits = num_bits_get(dh->tail_mask, offset); int rv; +#ifdef CONFIG_DMM_STATS + atomic_sub(&dh->curr_use, num_bits); +#endif rv = sys_bitarray_free(&dh->bitarray, num_bits, offset); (void)rv; __ASSERT_NO_MSG(rv == 0); @@ -431,6 +448,34 @@ int dmm_buffer_in_release(void *region, void *user_buffer, size_t user_length, v return 0; } +int dmm_stats_get(void *region, uintptr_t *start_addr, uint32_t *curr_use, uint32_t *max_use) +{ +#ifdef CONFIG_DMM_STATS + struct dmm_heap *dh; + + dh = dmm_heap_find(region); + if (dh == NULL) { + return -EINVAL; + } + + if (start_addr) { + *start_addr = dh->ptr; + } + + if (curr_use) { + *curr_use = (100 * dh->curr_use) / dh->bitarray.num_bits; + } + + if (max_use) { + *max_use = (100 * dh->max_use) / dh->bitarray.num_bits; + } + + return 0; +#else + return -ENOTSUP; +#endif +} + int dmm_init(void) { struct dmm_heap *dh; diff --git a/soc/nordic/common/dmm.h b/soc/nordic/common/dmm.h index ca627fbd55f4..09486289aa60 100644 --- a/soc/nordic/common/dmm.h +++ b/soc/nordic/common/dmm.h @@ -163,6 +163,22 @@ int dmm_buffer_in_prepare(void *region, void *user_buffer, size_t user_length, v */ int dmm_buffer_in_release(void *region, void *user_buffer, size_t user_length, void *buffer_in); +/** + * @brief Get statistics. + * + * Must be enabled with CONFIG_DMM_STATS. + * + * @param[in] region DMM memory region. + * @param[out] start_addr Location where starting address of the memory region is set. Can be null. + * @param[out] curr_use Location where current use in percent is written. Can be null. + * @param[out] max_use Location where maximum use in percent is written. Can be null. + * + * @retval 0 on success. + * @retval -EINVAL Invalid region. + * @retval -ENOTSUP Feature is disabled. + */ +int dmm_stats_get(void *region, uintptr_t *start_addr, uint32_t *curr_use, uint32_t *max_use); + /** * @brief Initialize DMM. * @@ -210,6 +226,17 @@ static ALWAYS_INLINE int dmm_buffer_in_release(void *region, void *user_buffer, return 0; } +static ALWAYS_INLINE int dmm_stats_get(void *region, uintptr_t *start_addr, + uint32_t *curr_use, uint32_t *max_use) +{ + ARG_UNUSED(region); + ARG_UNUSED(start_addr); + ARG_UNUSED(curr_use); + ARG_UNUSED(max_use); + + return 0; +} + static ALWAYS_INLINE int dmm_init(void) { return 0; From f536ba4c9a27126de57be0171694aee952956766 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Tue, 9 Sep 2025 21:47:07 +0200 Subject: [PATCH 1803/2141] [nrf fromtree] tests: boards: nrf: dmm: Extend test coverage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Extended test to check usage stats and longer buffer alloc. Signed-off-by: Krzysztof Chruściński (cherry picked from commit 3d3104207ca7219c2489182c9b5617b7ebe341c1) --- tests/boards/nrf/dmm/src/main.c | 46 ++++++++++++++++++++++++++++++ tests/boards/nrf/dmm/testcase.yaml | 5 ++++ 2 files changed, 51 insertions(+) diff --git a/tests/boards/nrf/dmm/src/main.c b/tests/boards/nrf/dmm/src/main.c index 6cfeb1372ec2..f4073d82e9b2 100644 --- a/tests/boards/nrf/dmm/src/main.c +++ b/tests/boards/nrf/dmm/src/main.c @@ -337,6 +337,52 @@ ZTEST_USER_F(dmm, test_check_dev_nocache_out_preallocate) user_data, sizeof(user_data), true, false, true); } +ZTEST_USER_F(dmm, test_check_multiple_alloc_and_free) +{ + int retval; + uint8_t buf[256]; + uint8_t buf2[32]; + void *dmm_buf; + void *dmm_buf2; + void *mem_reg = fixture->regions[DMM_TEST_REGION_NOCACHE].mem_reg; + uintptr_t start_address; + uint32_t curr_use, max_use; + + if (IS_ENABLED(CONFIG_DMM_STATS)) { + retval = dmm_stats_get(mem_reg, &start_address, &curr_use, &max_use); + zassert_ok(retval); + } + + memset(buf, 0, sizeof(buf)); + memset(buf2, 0, sizeof(buf2)); + + retval = dmm_buffer_out_prepare(mem_reg, (void *)buf, sizeof(buf), &dmm_buf); + zassert_ok(retval); + zassert_true(dmm_buf != NULL); + + retval = dmm_buffer_out_prepare(mem_reg, (void *)buf2, sizeof(buf2), &dmm_buf2); + zassert_ok(retval); + zassert_true(dmm_buf2 != NULL); + + retval = dmm_buffer_out_release(mem_reg, dmm_buf2); + zassert_ok(retval); + zassert_true(dmm_buf != NULL); + + retval = dmm_buffer_out_release(mem_reg, dmm_buf); + zassert_ok(retval); + zassert_true(dmm_buf != NULL); + + if (IS_ENABLED(CONFIG_DMM_STATS)) { + uint32_t curr_use2; + + retval = dmm_stats_get(mem_reg, &start_address, &curr_use2, &max_use); + zassert_ok(retval); + zassert_equal(curr_use, curr_use2); + TC_PRINT("Stats start_address:%p current use:%d%% max use:%d%%\n", + (void *)start_address, curr_use2, max_use); + } +} + ZTEST_SUITE(dmm, NULL, test_setup, NULL, test_cleanup, NULL); int dmm_test_prepare(void) diff --git a/tests/boards/nrf/dmm/testcase.yaml b/tests/boards/nrf/dmm/testcase.yaml index b5f41f281a5b..140454add34e 100644 --- a/tests/boards/nrf/dmm/testcase.yaml +++ b/tests/boards/nrf/dmm/testcase.yaml @@ -16,3 +16,8 @@ tests: - CONFIG_DCACHE=n platform_allow: - nrf54h20dk/nrf54h20/cpuapp + boards.nrf.dmm.stats: + extra_configs: + - CONFIG_DMM_STATS=y + platform_allow: + - nrf54h20dk/nrf54h20/cpuapp From 41c758a8d67810bc8b9894a5f087733ae83f5287 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Mon, 22 Sep 2025 15:25:07 +0200 Subject: [PATCH 1804/2141] [nrf fromtree] tests: boards: nrf: dmm: Add stress test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add stress test which validates that allocator is thread safe and has no memory leaks. Signed-off-by: Krzysztof Chruściński (cherry picked from commit c02f904a574ac3f2c988d20d138c4627f48f3d24) --- tests/boards/nrf/dmm/prj.conf | 1 + tests/boards/nrf/dmm/src/main.c | 178 +++++++++++++++++++++++++++++ tests/boards/nrf/dmm/testcase.yaml | 6 + 3 files changed, 185 insertions(+) diff --git a/tests/boards/nrf/dmm/prj.conf b/tests/boards/nrf/dmm/prj.conf index 0b99d72b0c32..c05afbb6ad35 100644 --- a/tests/boards/nrf/dmm/prj.conf +++ b/tests/boards/nrf/dmm/prj.conf @@ -1,4 +1,5 @@ CONFIG_ZTEST=y +CONFIG_ZTRESS=y CONFIG_ASSERT=n CONFIG_SPIN_VALIDATE=n CONFIG_TEST_EXTRA_STACK_SIZE=512 diff --git a/tests/boards/nrf/dmm/src/main.c b/tests/boards/nrf/dmm/src/main.c index f4073d82e9b2..27d239d5cf20 100644 --- a/tests/boards/nrf/dmm/src/main.c +++ b/tests/boards/nrf/dmm/src/main.c @@ -10,6 +10,8 @@ #include #include #include +#include +#include #include @@ -383,6 +385,182 @@ ZTEST_USER_F(dmm, test_check_multiple_alloc_and_free) } } +struct dmm_stress_data { + void *mem_reg; + void *alloc_ptr[32]; + uint8_t alloc_token[32]; + size_t alloc_len[32]; + atomic_t alloc_mask; + atomic_t busy_mask; + atomic_t fails; + atomic_t cnt; + bool cached; +}; + +static void stress_free_op(struct dmm_stress_data *data, int prio, int id) +{ + /* buffer is allocated. */ + uint8_t token = data->alloc_token[id]; + size_t len = data->alloc_len[id]; + uint8_t *ptr = data->alloc_ptr[id]; + int rv; + + for (int j = 0; j < len; j++) { + uint8_t exp_val = (uint8_t)(token + j); + + if (ptr[j] != exp_val) { + for (int k = 0; k < len; k++) { + printk("%02x ", ptr[k]); + } + } + zassert_equal(ptr[j], exp_val, "At %d got:%d exp:%d, len:%d id:%d, alloc_cnt:%d", + j, ptr[j], exp_val, len, id, (uint32_t)data->cnt); + } + + rv = dmm_buffer_in_release(data->mem_reg, ptr, len, ptr); + zassert_ok(rv); + /* Indicate that buffer is released. */ + atomic_and(&data->alloc_mask, ~BIT(id)); +} + +static bool stress_alloc_op(struct dmm_stress_data *data, int prio, int id) +{ + uint32_t r32 = sys_rand32_get(); + size_t len = r32 % 512; + uint8_t *ptr = data->alloc_ptr[id]; + int rv; + + /* Rarely allocate bigger buffer. */ + if ((r32 & 0x7) == 0) { + len += 512; + } + + rv = dmm_buffer_in_prepare(data->mem_reg, &r32/*dummy*/, len, (void **)&ptr); + if (rv < 0) { + atomic_inc(&data->fails); + return true; + } + + uint8_t token = r32 >> 24; + + data->alloc_ptr[id] = ptr; + data->alloc_len[id] = len; + data->alloc_token[id] = token; + for (int j = 0; j < len; j++) { + ptr[j] = (uint8_t)(j + token); + } + if (data->cached) { + sys_cache_data_flush_range(ptr, len); + } + atomic_inc(&data->cnt); + return false; +} + +bool stress_func(void *user_data, uint32_t cnt, bool last, int prio) +{ + struct dmm_stress_data *data = user_data; + uint32_t r = sys_rand32_get(); + int rpt = r & 0x3; + + r >>= 2; + + for (int i = 0; i < rpt + 1; i++) { + int id = r % 32; + int key; + bool free_op; + bool clear_bit; + + key = irq_lock(); + if ((data->busy_mask & BIT(id)) == 0) { + data->busy_mask |= BIT(id); + if (data->alloc_mask & BIT(id)) { + free_op = true; + } else { + data->alloc_mask |= BIT(id); + free_op = false; + } + } else { + irq_unlock(key); + continue; + } + + irq_unlock(key); + r >>= 5; + + if (free_op) { + stress_free_op(data, prio, id); + clear_bit = true; + } else { + clear_bit = stress_alloc_op(data, prio, id); + } + + key = irq_lock(); + data->busy_mask &= ~BIT(id); + if (clear_bit) { + data->alloc_mask &= ~BIT(id); + } + irq_unlock(key); + } + + return true; +} + +static void free_all(struct dmm_stress_data *data) +{ + while (data->alloc_mask) { + int id = 31 - __builtin_clz(data->alloc_mask); + + stress_free_op(data, 0, id); + data->alloc_mask &= ~BIT(id); + } +} + +static void stress_allocator(void *mem_reg, bool cached) +{ + uint32_t timeout = 3000; + struct dmm_stress_data ctx; + int rv; + uint32_t curr_use; + + memset(&ctx, 0, sizeof(ctx)); + ctx.mem_reg = mem_reg; + ctx.cached = cached; + + if (IS_ENABLED(CONFIG_DMM_STATS)) { + rv = dmm_stats_get(ctx.mem_reg, NULL, &curr_use, NULL); + zassert_ok(rv); + } + + ztress_set_timeout(K_MSEC(timeout)); + + ZTRESS_EXECUTE(ZTRESS_THREAD(stress_func, &ctx, INT32_MAX, INT32_MAX, Z_TIMEOUT_TICKS(4)), + ZTRESS_THREAD(stress_func, &ctx, INT32_MAX, INT32_MAX, Z_TIMEOUT_TICKS(4)), + ZTRESS_THREAD(stress_func, &ctx, INT32_MAX, INT32_MAX, Z_TIMEOUT_TICKS(4))); + + free_all(&ctx); + TC_PRINT("Executed %d allocation operation. Failed to allocate %d times.\n", + (uint32_t)ctx.cnt, (uint32_t)ctx.fails); + + if (IS_ENABLED(CONFIG_DMM_STATS)) { + uint32_t curr_use2; + + rv = dmm_stats_get(ctx.mem_reg, NULL, &curr_use2, NULL); + zassert_ok(rv); + zassert_equal(curr_use, curr_use2, "Unexpected usage got:%d exp:%d", + curr_use2, curr_use); + } +} + +ZTEST_F(dmm, test_stress_allocator_nocache) +{ + stress_allocator(fixture->regions[DMM_TEST_REGION_NOCACHE].mem_reg, false); +} + +ZTEST_F(dmm, test_stress_allocator_cache) +{ + stress_allocator(fixture->regions[DMM_TEST_REGION_CACHE].mem_reg, true); +} + ZTEST_SUITE(dmm, NULL, test_setup, NULL, test_cleanup, NULL); int dmm_test_prepare(void) diff --git a/tests/boards/nrf/dmm/testcase.yaml b/tests/boards/nrf/dmm/testcase.yaml index 140454add34e..7fc991d4824c 100644 --- a/tests/boards/nrf/dmm/testcase.yaml +++ b/tests/boards/nrf/dmm/testcase.yaml @@ -21,3 +21,9 @@ tests: - CONFIG_DMM_STATS=y platform_allow: - nrf54h20dk/nrf54h20/cpuapp + boards.nrf.dmm.more_chunks: + extra_configs: + - CONFIG_DMM_STATS=y + - CONFIG_DMM_HEAP_CHUNKS=96 + platform_allow: + - nrf54h20dk/nrf54h20/cpuapp From 8bbc75283f647428fe8c5ac9f762bf98e8748559 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Wed, 1 Oct 2025 09:56:55 +0200 Subject: [PATCH 1805/2141] [nrf fromlist] tests: boards: nrf: dmm: Skip stress test for empty memory region MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Skip stress test if null memory region. That's the case if DMM is disabled. Upstream PR #: 96831 Signed-off-by: Krzysztof Chruściński --- tests/boards/nrf/dmm/src/main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/boards/nrf/dmm/src/main.c b/tests/boards/nrf/dmm/src/main.c index 27d239d5cf20..58b7e891c795 100644 --- a/tests/boards/nrf/dmm/src/main.c +++ b/tests/boards/nrf/dmm/src/main.c @@ -522,6 +522,10 @@ static void stress_allocator(void *mem_reg, bool cached) int rv; uint32_t curr_use; + if (mem_reg == NULL) { + ztest_test_skip(); + } + memset(&ctx, 0, sizeof(ctx)); ctx.mem_reg = mem_reg; ctx.cached = cached; From 452da84594bee4d72b7c9aa51ae4814e79819de9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Wed, 1 Oct 2025 07:47:44 +0200 Subject: [PATCH 1806/2141] [nrf fromlist] soc: nordic: common: dmm: Fix allocation algorithm MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There were some corner cases and stress test could fail. Reworking tail bits handling to make the stress test pass. Upstream PR #: 96831 Signed-off-by: Krzysztof Chruściński --- soc/nordic/common/dmm.c | 91 +++++++++++++++-------------------------- 1 file changed, 34 insertions(+), 57 deletions(-) diff --git a/soc/nordic/common/dmm.c b/soc/nordic/common/dmm.c index e832a1f27b80..ac22f8ee430a 100644 --- a/soc/nordic/common/dmm.c +++ b/soc/nordic/common/dmm.c @@ -135,32 +135,19 @@ static void tail_mask_set(atomic_t *tail_mask, size_t num_bits, size_t off) return; } - /* If bit mask exceeds a single word then tail may spill to the adjacent word. */ size_t idx = tail_off / 32; + atomic_t *t_mask = &tail_mask[idx]; - tail_off = tail_off - 32 * idx; - if ((tail_off + tail_bits) <= 32) { - /* Tail mask fits in a single word. */ - atomic_or(&tail_mask[idx], BIT_MASK(tail_bits) << tail_off); - return; - } - - /* Tail spilled. Remainder is set in the next word. Since number of tail_masks - * match number of words in bitarray we don't need to check if we are exceeding - * the array boundary. - */ - atomic_or(&tail_mask[idx], BIT_MASK(32 - tail_off) << tail_off); - - - size_t rem_tail = tail_bits - (32 - tail_off); - atomic_t *mask = &tail_mask[idx + 1]; + tail_off = tail_off % 32; + while (tail_bits > 0) { + uint32_t bits = MIN(32 - tail_off, tail_bits); + uint32_t mask = (bits == 32) ? UINT32_MAX : (BIT_MASK(bits) << tail_off); - while (rem_tail >= 32) { - atomic_or(mask, UINT32_MAX); - mask++; - rem_tail -= 32; + atomic_or(t_mask, mask); + t_mask++; + tail_off = 0; + tail_bits -= bits; } - atomic_or(mask, BIT_MASK(rem_tail)); } /* Function determines how many chunks were used for the allocated buffer. It is @@ -175,47 +162,37 @@ static void tail_mask_set(atomic_t *tail_mask, size_t num_bits, size_t off) */ static uint32_t num_bits_get(atomic_t *tail_mask, size_t off) { - uint32_t mask; - uint32_t num_bits; + uint32_t num_bits = 1; + size_t tail_off = off + 1; + size_t idx = tail_off / 32; + atomic_t *t_mask = &tail_mask[idx]; - if (HEAP_NUM_WORDS == 1) { - mask = (*tail_mask | BIT(off)) >> off; - num_bits = (~mask == 0) ? 32 : __builtin_ctz(~mask); - if (num_bits > 1) { - mask = BIT_MASK(num_bits - 1) << (off + 1); - atomic_and(tail_mask, ~mask); - } + tail_off = tail_off % 32; + do { + uint32_t mask = (uint32_t)*t_mask >> tail_off; - return num_bits; - } + if (mask == UINT32_MAX) { + num_bits += 32; + atomic_set(t_mask, 0); + } else { + uint32_t bits = __builtin_ctz(~mask); - /* In multiword bit array we need to check if tail is spilling over to the next word. */ - size_t idx = off / 32; - size_t w_off = off - 32 * idx; - atomic_t *t_mask = &tail_mask[idx]; + if (bits == 0) { + break; + } - mask = (*t_mask | BIT(w_off)) >> w_off; - num_bits = (~mask == 0) ? 32 : __builtin_ctz(~mask); - if (num_bits == 1) { - return num_bits; - } + num_bits += bits; + atomic_and(t_mask, ~(BIT_MASK(bits) << tail_off)); - mask = BIT_MASK(num_bits - 1) << (w_off + 1); - atomic_and(t_mask, ~mask); - if (((w_off + num_bits) == 32) && (idx < (HEAP_NUM_WORDS - 1))) { - size_t tmp_bits; + if (bits + tail_off < 32) { + break; + } - /* If we are at the end of the one mask we need to check the beginning of the - * next one as there might be remaining part of the tail. - */ - do { - t_mask++; - tmp_bits = (*t_mask == UINT32_MAX) ? 32 : __builtin_ctz(~(*t_mask)); - mask = (tmp_bits == 32) ? UINT32_MAX : BIT_MASK(tmp_bits); - atomic_and(t_mask, ~mask); - num_bits += tmp_bits; - } while ((tmp_bits == 32) && (t_mask != &tail_mask[HEAP_NUM_WORDS - 1])); - } + tail_off = 0; + } + + t_mask++; + } while ((HEAP_NUM_WORDS > 1) && (t_mask != &tail_mask[HEAP_NUM_WORDS])); return num_bits; } From b99a7efc0067a62aa2e4b472592b43950a9fb358 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Fri, 26 Sep 2025 15:08:36 +0200 Subject: [PATCH 1807/2141] [nrf fromtree] dts: arm: nrf54h20_cpurad: disable unsuppported s2ram state The s2ram power state is a "suspend-to-ram" state which is not supported by the radio core, so delete it from the overlay. Signed-off-by: Bjarki Arge Andreasen Signed-off-by: Adam Kondraciuk (cherry picked from commit 91c8c07179d386bbb6ed6af2531f61de77ac773d) --- dts/arm/nordic/nrf54h20_cpurad.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/dts/arm/nordic/nrf54h20_cpurad.dtsi b/dts/arm/nordic/nrf54h20_cpurad.dtsi index 8bd3c045906c..cdb13f0d8586 100644 --- a/dts/arm/nordic/nrf54h20_cpurad.dtsi +++ b/dts/arm/nordic/nrf54h20_cpurad.dtsi @@ -21,6 +21,7 @@ wdt011: &cpurad_wdt011 {}; /delete-node/ &cpuapp_ram0; /delete-node/ &cpuppr; /delete-node/ &cpuflpr; +/delete-node/ &s2ram; / { chosen { From bbfecc3539562c83c6116e7adaa7501c6d1d8d51 Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Tue, 30 Sep 2025 14:48:14 +0200 Subject: [PATCH 1808/2141] [nrf noup] soc/nordic/nrf54h20/pm_s2ram: extend mcuboot_resume_s nrf_squash! [nrf noup] soc/nordic/nf54h/pm_s2ram: S2RAM resume hardening Extended mcuboot_resume_s suture by slot_info field intended to be used by MCUboot for recognize proper boot slot in direct-xp mode. Signed-off-by: Andrzej Puzdrowski --- .../nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 12 ++++++------ soc/nordic/nrf54h/pm_s2ram.h | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index 914b434d40e4..ac69d47a0c5c 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -345,23 +345,23 @@ zephyr_udc0: &usbhs { /* Trim this RAM block for making room on all run-time common S2RAM cpu context. */ &cpuapp_ram0 { - reg = <0x22000000 (DT_SIZE_K(32) - 52)>; - ranges = <0x0 0x22000000 (0x8000 - 0x34)>; + reg = <0x22000000 (DT_SIZE_K(32) - 56)>; + ranges = <0x0 0x22000000 (0x8000 - 0x38)>; }; / { soc { /* temporary stack for S2RAM resume logic */ - pm_s2ram_stack: cpuapp_s2ram_stack@22007fcc { + pm_s2ram_stack: cpuapp_s2ram_stack@22007fc8 { compatible = "zephyr,memory-region", "mmio-sram"; - reg = <0x22007fcc 16>; + reg = <0x22007fc8 16>; zephyr,memory-region = "pm_s2ram_stack"; }; /* run-time common mcuboot S2RAM support section */ - mcuboot_s2ram: cpuapp_s2ram@22007fdc { + mcuboot_s2ram: cpuapp_s2ram@22007fd8 { compatible = "zephyr,memory-region", "mmio-sram"; - reg = <0x22007fdc 4>; + reg = <0x22007fd8 8>; zephyr,memory-region = "mcuboot_s2ram_context"; }; diff --git a/soc/nordic/nrf54h/pm_s2ram.h b/soc/nordic/nrf54h/pm_s2ram.h index 0906010cbe08..01c098ea4310 100644 --- a/soc/nordic/nrf54h/pm_s2ram.h +++ b/soc/nordic/nrf54h/pm_s2ram.h @@ -14,6 +14,7 @@ struct mcuboot_resume_s { uint32_t magic; /* magic value to identify valid structure */ + uint32_t slot_info; }; /** From 40247072784e1b6e3bdea3e7d1e08284bed56419 Mon Sep 17 00:00:00 2001 From: Ludvig Jordet Date: Fri, 19 Sep 2025 12:53:18 +0200 Subject: [PATCH 1809/2141] [nrf fromtree] Bluetooth: Mesh: Decouple blob_io_flash erase from flash config This adds a Kconfig dependency on FLASH_PAGE_LAYOUT when using flash with explicit erase, removing all code dependencies on flash configuration from the erasure logic. This module already requires FLASH_PAGE_LAYOUT to be set when using it with flash with explicit erase, as a silent requirement. The current code does not work without this option enabled except for the case where a BLOB has a size which is a multiple of the page size (since, without it, trying to erase flash space for the final block, which is of variable size, will fail). Also cleans up the code a bit. Signed-off-by: Ludvig Jordet (cherry picked from commit 294a2cd9dbc06b4cc8f0d61bbae0b217914c7d72) --- subsys/bluetooth/mesh/Kconfig | 1 + subsys/bluetooth/mesh/blob_io_flash.c | 65 ++++++++++++++------------- 2 files changed, 34 insertions(+), 32 deletions(-) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index 80846310c632..84639663cb74 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -1073,6 +1073,7 @@ config BT_MESH_BLOB_IO_FLASH_WITH_ERASE bool "BLOB flash support for devices with erase" default y if FLASH_HAS_EXPLICIT_ERASE depends on FLASH_HAS_EXPLICIT_ERASE + depends on FLASH_PAGE_LAYOUT help Enable path supporting devices with erase. This option appears only if there are devices requiring erase, before write, in the system diff --git a/subsys/bluetooth/mesh/blob_io_flash.c b/subsys/bluetooth/mesh/blob_io_flash.c index 8d989a6feca5..293f08feecdc 100644 --- a/subsys/bluetooth/mesh/blob_io_flash.c +++ b/subsys/bluetooth/mesh/blob_io_flash.c @@ -56,42 +56,38 @@ static void io_close(const struct bt_mesh_blob_io *io, flash_area_close(flash->area); } +/* Erasure code not needed if no flash in the system requires explicit erase */ +#ifdef CONFIG_BT_MESH_BLOB_IO_FLASH_WITH_ERASE static inline int erase_device_block(const struct flash_area *fa, off_t start, size_t size) { - /* If there are no devices requiring erase, then there is nothing to do */ - if (IS_ENABLED(CONFIG_BT_MESH_BLOB_IO_FLASH_WITH_ERASE)) { - const struct device *fdev = flash_area_get_device(fa); - - if (!fdev) { - return -ENODEV; - } - - /* We have a mix of devices in system */ - if (IS_ENABLED(CONFIG_BT_MESH_BLOB_IO_FLASH_WITHOUT_ERASE)) { - const struct flash_parameters *fparam = flash_get_parameters(fdev); - - /* If device has no erase requirement then do nothing */ - if (!(flash_params_get_erase_cap(fparam) & FLASH_ERASE_C_EXPLICIT)) { - return 0; - } - } - - if (IS_ENABLED(CONFIG_FLASH_PAGE_LAYOUT)) { - struct flash_pages_info page; - int err; - - err = flash_get_page_info_by_offs(fdev, start, &page); - if (err) { - return err; - } - - size = page.size * DIV_ROUND_UP(size, page.size); - start = page.start_offset; - } - return flash_area_erase(fa, start, size); + const struct device *fdev = flash_area_get_device(fa); + struct flash_pages_info page; + int err; + + if (!fdev) { + return -ENODEV; } - return 0; +#ifdef CONFIG_BT_MESH_BLOB_IO_FLASH_WITHOUT_ERASE + /* We have a mix of devices in system */ + const struct flash_parameters *fparam = flash_get_parameters(fdev); + + /* If device has no erase requirement then do nothing */ + if (!(flash_params_get_erase_cap(fparam) & FLASH_ERASE_C_EXPLICIT)) { + return 0; + } +#endif /* CONFIG_BT_MESH_BLOB_IO_FLASH_WITHOUT_ERASE */ + + err = flash_get_page_info_by_offs(fdev, start, &page); + if (err) { + return err; + } + + /* Align to page boundary. */ + size = page.size * DIV_ROUND_UP(size, page.size); + start = page.start_offset; + + return flash_area_erase(fa, start, size); } static int block_start(const struct bt_mesh_blob_io *io, @@ -106,6 +102,7 @@ static int block_start(const struct bt_mesh_blob_io *io, return erase_device_block(flash->area, flash->offset + block->offset, block->size); } +#endif /* CONFIG_BT_MESH_BLOB_IO_FLASH_WITH_ERASE */ static int rd_chunk(const struct bt_mesh_blob_io *io, const struct bt_mesh_blob_xfer *xfer, @@ -165,7 +162,11 @@ int bt_mesh_blob_io_flash_init(struct bt_mesh_blob_io_flash *flash, flash->offset = offset; flash->io.open = io_open; flash->io.close = io_close; +#ifdef CONFIG_BT_MESH_BLOB_IO_FLASH_WITH_ERASE flash->io.block_start = block_start; +#else + flash->io.block_start = NULL; +#endif flash->io.block_end = NULL; flash->io.rd = rd_chunk; flash->io.wr = wr_chunk; From 47e35ae60657fdd6f384a6a9877013a0fa038092 Mon Sep 17 00:00:00 2001 From: Ludvig Jordet Date: Fri, 19 Sep 2025 13:10:02 +0200 Subject: [PATCH 1810/2141] [nrf fromtree] Bluetooth: Mesh: make blob_io_flash support smaller blocks Only erase a page when starting the first block on that page. This fixes a bug where, if the block size is smaller than the page size, the entire page would be erased upon start of each block when writing, meaning only the final block on each page would be retained. This works because blocks are always received in order. Signed-off-by: Ludvig Jordet (cherry picked from commit 99190cb08fdbe5222409d4f4f81b294a7725f8dd) --- subsys/bluetooth/mesh/blob_io_flash.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/subsys/bluetooth/mesh/blob_io_flash.c b/subsys/bluetooth/mesh/blob_io_flash.c index 293f08feecdc..f4856723d7a1 100644 --- a/subsys/bluetooth/mesh/blob_io_flash.c +++ b/subsys/bluetooth/mesh/blob_io_flash.c @@ -83,9 +83,13 @@ static inline int erase_device_block(const struct flash_area *fa, off_t start, s return err; } + if (start != page.start_offset) { + /* Only need to erase when starting the first block on the page. */ + return 0; + } + /* Align to page boundary. */ size = page.size * DIV_ROUND_UP(size, page.size); - start = page.start_offset; return flash_area_erase(fa, start, size); } From ee186d943c8fb46b8f2152a3261b17524b01c701 Mon Sep 17 00:00:00 2001 From: Ludvig Jordet Date: Fri, 19 Sep 2025 13:13:02 +0200 Subject: [PATCH 1811/2141] [nrf fromtree] Bluetooth: Mesh: decouple blob_io_flash from internal flash This fully decouples blob_io_flash from specific flash device details, by not reading the write block size from a hard-coded device tree node, instead pulling this from the actual flash device used. The block write routine has been updated to be more generic and fix a few bugs: * The write buffer is now sized based on a KConfig option instead of basing it off the device tree - this makes the module usable with any flash device, not just the internal memory. The configured value is checked during initialization, to ensure that the configured size will fit the write block size required by the device passed to the init function. * The erase value used to fill the buffer when using a device with explicit erase is now pulled from the flash parameters instead of being hard-coded to `0xff`. * An additional write block sized piece of buffer is allocated - the previous buffer sizing with rounding up only worked if `BLOB_RX_CHUNK_SIZE % WRITE_BLOCK_SIZE` was 0 or 1 (which coincidentally worked in all testing because the chunk size defaults to 161, and for internal flash w/write block size of 4, `161 % 4 == 1`). * The choice of whether to just write the chunk as-is or to write-block align it is now based on the erase cap pulled from the flash parameters, instead of checking the type of memory in the SOC. This means the module dos _not_ currently support the case where memory has to be written write-block aligned, but the memory does _not_ use explicit erase. It uses a trick of filling the write buffer with the erase value to avoid overwriting existing chunks, which will not work in this case. This trick is required to support random ordered chunks while still writing write-block aligned. * The code has been cleaned up a bit in general. Signed-off-by: Ludvig Jordet (cherry picked from commit db207b04a8f13cf9f93d34cf26b18b0a9ec2dac5) --- subsys/bluetooth/mesh/Kconfig | 11 +++++ subsys/bluetooth/mesh/blob_io_flash.c | 63 ++++++++++++++++++++------- 2 files changed, 59 insertions(+), 15 deletions(-) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index 84639663cb74..c2c919d172df 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -1080,6 +1080,17 @@ config BT_MESH_BLOB_IO_FLASH_WITH_ERASE and may be disabled to reduce code size in case when no operations are intended on such type of devices. +if BT_MESH_BLOB_IO_FLASH_WITH_ERASE + +config BT_MESH_BLOB_IO_FLASH_WRITE_BLOCK_SIZE_MAX + int "Maximum supported write block size" + default 4 + help + The BLOB IO Flash module will support flash devices with explicit erase + using a write block size of at most this value. + +endif # BT_MESH_BLOB_IO_FLASH_WITH_ERASE + endif # BT_MESH_BLOB_IO_FLASH config BT_MESH_DFU_SRV diff --git a/subsys/bluetooth/mesh/blob_io_flash.c b/subsys/bluetooth/mesh/blob_io_flash.c index f4856723d7a1..95554dd2f55b 100644 --- a/subsys/bluetooth/mesh/blob_io_flash.c +++ b/subsys/bluetooth/mesh/blob_io_flash.c @@ -12,13 +12,17 @@ #include "net.h" #include "transport.h" -#define WRITE_BLOCK_SIZE DT_PROP(DT_INST(0, soc_nv_flash), write_block_size) +#define LOG_LEVEL CONFIG_BT_MESH_MODEL_LOG_LEVEL +#include +LOG_MODULE_REGISTER(bt_mesh_blob_io_flash); #define FLASH_IO(_io) CONTAINER_OF(_io, struct bt_mesh_blob_io_flash, io) static int test_flash_area(uint8_t area_id) { + const struct flash_parameters *fparam; const struct flash_area *area; + const struct device *fdev; uint8_t align; int err; @@ -28,9 +32,19 @@ static int test_flash_area(uint8_t area_id) } align = flash_area_align(area); + fdev = flash_area_get_device(area); + fparam = flash_get_parameters(fdev); + flash_area_close(area); - if (align > WRITE_BLOCK_SIZE) { + if (!fdev) { + return -ENODEV; + } + + if ((flash_params_get_erase_cap(fparam) & FLASH_ERASE_C_EXPLICIT) && + CONFIG_BT_MESH_BLOB_IO_FLASH_WRITE_BLOCK_SIZE_MAX % align) { + LOG_ERR("CONFIG_BT_MESH_BLOB_IO_FLASH_WRITE_BLOCK_SIZE_MAX must be set to a\n" + "multiple of the write block size for the flash deviced used."); return -EINVAL; } @@ -126,30 +140,49 @@ static int wr_chunk(const struct bt_mesh_blob_io *io, const struct bt_mesh_blob_chunk *chunk) { struct bt_mesh_blob_io_flash *flash = FLASH_IO(io); + const struct device *fdev = flash_area_get_device(flash->area); - if (IS_ENABLED(CONFIG_SOC_FLASH_NRF_RRAM)) { + if (!fdev) { + return -ENODEV; + } + + const struct flash_parameters *fparam = flash_get_parameters(fdev); + + /* + * If device has no erase requirement then write directly. + * This is required since trick with padding using the erase value will + * not work in this case. + */ + if (!(flash_params_get_erase_cap(fparam) & FLASH_ERASE_C_EXPLICIT)) { return flash_area_write(flash->area, flash->offset + block->offset + chunk->offset, chunk->data, chunk->size); } - uint8_t buf[ROUND_UP(BLOB_RX_CHUNK_SIZE, WRITE_BLOCK_SIZE)]; + /* + * Allocate one additional write block for the case where a chunk will need + * an extra write block on both sides to fit. + */ + uint8_t buf[ROUND_UP(BLOB_RX_CHUNK_SIZE, CONFIG_BT_MESH_BLOB_IO_FLASH_WRITE_BLOCK_SIZE_MAX) + + CONFIG_BT_MESH_BLOB_IO_FLASH_WRITE_BLOCK_SIZE_MAX]; + uint32_t write_block_size = flash_area_align(flash->area); off_t area_offset = flash->offset + block->offset + chunk->offset; - int i = 0; - - /* Write block align the chunk data */ - memset(&buf[i], 0xff, area_offset % WRITE_BLOCK_SIZE); - i += area_offset % WRITE_BLOCK_SIZE; + int start_pad = area_offset % write_block_size; - memcpy(&buf[i], chunk->data, chunk->size); - i += chunk->size; + /* + * Fill buffer with erase value, to make sure only the part of the + * buffer with chunk data will overwrite flash. + * (Because chunks can arrive in random order, this is required unless + * the entire block is cached in RAM). + */ + memset(buf, fparam->erase_value, sizeof(buf)); - memset(&buf[i], 0xff, ROUND_UP(i, WRITE_BLOCK_SIZE) - i); - i = ROUND_UP(i, WRITE_BLOCK_SIZE); + memcpy(&buf[start_pad], chunk->data, chunk->size); return flash_area_write(flash->area, - ROUND_DOWN(area_offset, WRITE_BLOCK_SIZE), - buf, i); + ROUND_DOWN(area_offset, write_block_size), + buf, + ROUND_UP(start_pad + chunk->size, write_block_size)); } int bt_mesh_blob_io_flash_init(struct bt_mesh_blob_io_flash *flash, From f7859899ec7dbb21e0580eef25b229bda727f04a Mon Sep 17 00:00:00 2001 From: Ludvig Jordet Date: Fri, 19 Sep 2025 13:22:59 +0200 Subject: [PATCH 1812/2141] [nrf fromtree] Bluetooth: Mesh: Deprecate blob_io_flash erase cap options The only reason to keep these would be to enable conditional compilation of some parts of the code. However, we can't see enough benefit in doing this, particularly since the flash driver itself will conditionally handle certain paths depending on erase caps, so the options are deprecated to reduce complexity. Signed-off-by: Ludvig Jordet (cherry picked from commit 8720ab73905da9e99c392b85ac0dfcc9babdda42) --- subsys/bluetooth/mesh/Kconfig | 27 ++++++++++----------------- subsys/bluetooth/mesh/blob_io_flash.c | 10 ---------- 2 files changed, 10 insertions(+), 27 deletions(-) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index c2c919d172df..297da4e80200 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -1053,6 +1053,7 @@ config BT_MESH_BLOB_IO_FLASH default y depends on BT_MESH_BLOB_SRV || BT_MESH_BLOB_CLI depends on FLASH_MAP + depends on FLASH_PAGE_LAYOUT help Enable the BLOB flash stream for reading and writing BLOBs directly to and from flash. @@ -1060,36 +1061,28 @@ config BT_MESH_BLOB_IO_FLASH if BT_MESH_BLOB_IO_FLASH config BT_MESH_BLOB_IO_FLASH_WITHOUT_ERASE - bool "BLOB flash support for devices without erase" - default y if FLASH_HAS_NO_EXPLICIT_ERASE + bool "BLOB flash support for devices without erase [DEPRECATED]" + default n depends on FLASH_HAS_NO_EXPLICIT_ERASE + select DEPRECATED help - Enable path supporting devices without erase. This option appears only - if there are devices without explicit erase requirements in the system - and may be disabled to reduce code size in case when no operations - are intended on such type of devices. + This option is deprecated and is no longer used by the BLOB IO Flash module. config BT_MESH_BLOB_IO_FLASH_WITH_ERASE - bool "BLOB flash support for devices with erase" - default y if FLASH_HAS_EXPLICIT_ERASE + bool "BLOB flash support for devices with erase [DEPRECATED]" + default n depends on FLASH_HAS_EXPLICIT_ERASE depends on FLASH_PAGE_LAYOUT + select DEPRECATED help - Enable path supporting devices with erase. This option appears only - if there are devices requiring erase, before write, in the system - and may be disabled to reduce code size in case when no operations - are intended on such type of devices. - -if BT_MESH_BLOB_IO_FLASH_WITH_ERASE + This option is deprecated and is no longer used by the BLOB IO Flash module. config BT_MESH_BLOB_IO_FLASH_WRITE_BLOCK_SIZE_MAX int "Maximum supported write block size" default 4 help The BLOB IO Flash module will support flash devices with explicit erase - using a write block size of at most this value. - -endif # BT_MESH_BLOB_IO_FLASH_WITH_ERASE + when this value is set to a multiple of the device write block size. endif # BT_MESH_BLOB_IO_FLASH diff --git a/subsys/bluetooth/mesh/blob_io_flash.c b/subsys/bluetooth/mesh/blob_io_flash.c index 95554dd2f55b..792c53d4a0a6 100644 --- a/subsys/bluetooth/mesh/blob_io_flash.c +++ b/subsys/bluetooth/mesh/blob_io_flash.c @@ -70,8 +70,6 @@ static void io_close(const struct bt_mesh_blob_io *io, flash_area_close(flash->area); } -/* Erasure code not needed if no flash in the system requires explicit erase */ -#ifdef CONFIG_BT_MESH_BLOB_IO_FLASH_WITH_ERASE static inline int erase_device_block(const struct flash_area *fa, off_t start, size_t size) { const struct device *fdev = flash_area_get_device(fa); @@ -82,15 +80,12 @@ static inline int erase_device_block(const struct flash_area *fa, off_t start, s return -ENODEV; } -#ifdef CONFIG_BT_MESH_BLOB_IO_FLASH_WITHOUT_ERASE - /* We have a mix of devices in system */ const struct flash_parameters *fparam = flash_get_parameters(fdev); /* If device has no erase requirement then do nothing */ if (!(flash_params_get_erase_cap(fparam) & FLASH_ERASE_C_EXPLICIT)) { return 0; } -#endif /* CONFIG_BT_MESH_BLOB_IO_FLASH_WITHOUT_ERASE */ err = flash_get_page_info_by_offs(fdev, start, &page); if (err) { @@ -120,7 +115,6 @@ static int block_start(const struct bt_mesh_blob_io *io, return erase_device_block(flash->area, flash->offset + block->offset, block->size); } -#endif /* CONFIG_BT_MESH_BLOB_IO_FLASH_WITH_ERASE */ static int rd_chunk(const struct bt_mesh_blob_io *io, const struct bt_mesh_blob_xfer *xfer, @@ -199,11 +193,7 @@ int bt_mesh_blob_io_flash_init(struct bt_mesh_blob_io_flash *flash, flash->offset = offset; flash->io.open = io_open; flash->io.close = io_close; -#ifdef CONFIG_BT_MESH_BLOB_IO_FLASH_WITH_ERASE flash->io.block_start = block_start; -#else - flash->io.block_start = NULL; -#endif flash->io.block_end = NULL; flash->io.rd = rd_chunk; flash->io.wr = wr_chunk; From 1365e9d83071aad735d7ef42385430fb462fe611 Mon Sep 17 00:00:00 2001 From: Artur Hadasz Date: Thu, 2 Oct 2025 15:57:56 +0200 Subject: [PATCH 1813/2141] [nrf fromtree] tests: boot: Fix bootloader.mcuboot boot loop for nrf platforms The swapped_app image, added via ExternalZephyrProject_Add, wasn't receiving the swap method configuration from sysbuild. If trying to build the test with a different configuration that SWAP_USING_OFFSET (for example SWAP_USING_MOVE) this resulted in a boot loop due to configuration mismatch between swapped_image and mcuboot. This fix ensures proper configuration propagation and prevents similar mismatches in future scenarios. Signed-off-by: Artur Hadasz (cherry picked from commit 7c1721de03bfbfe102817de415076d998a3516aa) --- tests/boot/test_mcuboot/sysbuild.cmake | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/boot/test_mcuboot/sysbuild.cmake b/tests/boot/test_mcuboot/sysbuild.cmake index dc5165114b58..920d07933917 100644 --- a/tests/boot/test_mcuboot/sysbuild.cmake +++ b/tests/boot/test_mcuboot/sysbuild.cmake @@ -14,6 +14,12 @@ ExternalZephyrProject_Add( SOURCE_DIR ${APP_DIR}/swapped_app ) +# This section ensures that sysbuild-related configurations, such as the MCUBOOT swap type, +# are passed down to the swapped_app image. +set_target_properties(swapped_app PROPERTIES + IMAGE_CONF_SCRIPT ${ZEPHYR_BASE}/share/sysbuild/image_configurations/MAIN_image_default.cmake +) + # Add the swapped app to the list of images to flash # Ensure the flashing order of images is as follows: # - mcuboot From 411f68050f71567ab53696137bca800b7b6ceb0e Mon Sep 17 00:00:00 2001 From: Adam Kondraciuk Date: Tue, 7 Oct 2025 11:16:18 +0200 Subject: [PATCH 1814/2141] Revert "[nrf noup] soc/nordic/nrf54h20/pm_s2ram: extend mcuboot_resume_s" This reverts commit bbfecc3539562c83c6116e7adaa7501c6d1d8d51. Signed-off-by: Adam Kondraciuk --- .../nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 12 ++++++------ soc/nordic/nrf54h/pm_s2ram.h | 1 - 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index ac69d47a0c5c..914b434d40e4 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -345,23 +345,23 @@ zephyr_udc0: &usbhs { /* Trim this RAM block for making room on all run-time common S2RAM cpu context. */ &cpuapp_ram0 { - reg = <0x22000000 (DT_SIZE_K(32) - 56)>; - ranges = <0x0 0x22000000 (0x8000 - 0x38)>; + reg = <0x22000000 (DT_SIZE_K(32) - 52)>; + ranges = <0x0 0x22000000 (0x8000 - 0x34)>; }; / { soc { /* temporary stack for S2RAM resume logic */ - pm_s2ram_stack: cpuapp_s2ram_stack@22007fc8 { + pm_s2ram_stack: cpuapp_s2ram_stack@22007fcc { compatible = "zephyr,memory-region", "mmio-sram"; - reg = <0x22007fc8 16>; + reg = <0x22007fcc 16>; zephyr,memory-region = "pm_s2ram_stack"; }; /* run-time common mcuboot S2RAM support section */ - mcuboot_s2ram: cpuapp_s2ram@22007fd8 { + mcuboot_s2ram: cpuapp_s2ram@22007fdc { compatible = "zephyr,memory-region", "mmio-sram"; - reg = <0x22007fd8 8>; + reg = <0x22007fdc 4>; zephyr,memory-region = "mcuboot_s2ram_context"; }; diff --git a/soc/nordic/nrf54h/pm_s2ram.h b/soc/nordic/nrf54h/pm_s2ram.h index 01c098ea4310..0906010cbe08 100644 --- a/soc/nordic/nrf54h/pm_s2ram.h +++ b/soc/nordic/nrf54h/pm_s2ram.h @@ -14,7 +14,6 @@ struct mcuboot_resume_s { uint32_t magic; /* magic value to identify valid structure */ - uint32_t slot_info; }; /** From 3a242c921ab963eba39db96ef85ca92c3a3689d8 Mon Sep 17 00:00:00 2001 From: Adam Kondraciuk Date: Tue, 30 Sep 2025 16:09:18 +0200 Subject: [PATCH 1815/2141] Revert "[nrf noup] soc/nordic/nrf54h/pm_s2ram: S2RAM resume hardening" This reverts commit a41a6314e19952459f7185217ee26c556fd334bd. Signed-off-by: Adam Kondraciuk --- .../nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 15 ++++----------- soc/nordic/nrf54h/pm_s2ram.c | 14 -------------- soc/nordic/nrf54h/pm_s2ram.h | 6 ------ 3 files changed, 4 insertions(+), 31 deletions(-) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index 914b434d40e4..8bcde5c55de8 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -345,26 +345,19 @@ zephyr_udc0: &usbhs { /* Trim this RAM block for making room on all run-time common S2RAM cpu context. */ &cpuapp_ram0 { - reg = <0x22000000 (DT_SIZE_K(32) - 52)>; - ranges = <0x0 0x22000000 (0x8000 - 0x34)>; + reg = <0x22000000 (DT_SIZE_K(32) - 48)>; + ranges = <0x0 0x22000000 (0x8000 - 0x30)>; }; / { soc { /* temporary stack for S2RAM resume logic */ - pm_s2ram_stack: cpuapp_s2ram_stack@22007fcc { + pm_s2ram_stack: cpuapp_s2ram_stack@22007fd0 { compatible = "zephyr,memory-region", "mmio-sram"; - reg = <0x22007fcc 16>; + reg = <0x22007fd0 16>; zephyr,memory-region = "pm_s2ram_stack"; }; - /* run-time common mcuboot S2RAM support section */ - mcuboot_s2ram: cpuapp_s2ram@22007fdc { - compatible = "zephyr,memory-region", "mmio-sram"; - reg = <0x22007fdc 4>; - zephyr,memory-region = "mcuboot_s2ram_context"; - }; - /* run-time common S2RAM cpu context RAM */ pm_s2ram: cpuapp_s2ram@22007fe0 { compatible = "zephyr,memory-region", "mmio-sram"; diff --git a/soc/nordic/nrf54h/pm_s2ram.c b/soc/nordic/nrf54h/pm_s2ram.c index 6916e4884727..221293c5b82e 100644 --- a/soc/nordic/nrf54h/pm_s2ram.c +++ b/soc/nordic/nrf54h/pm_s2ram.c @@ -219,24 +219,10 @@ static void fpu_restore(_fpu_context_t *backup) #endif /* !defined(CONFIG_FPU_SHARING) */ #endif /* defined(CONFIG_FPU) */ -#if DT_NODE_EXISTS(DT_NODELABEL(mcuboot_s2ram)) &&\ - DT_NODE_HAS_COMPAT(DT_NODELABEL(mcuboot_s2ram), zephyr_memory_region) -/* Linker section name is given by `zephyr,memory-region` property of - * `zephyr,memory-region` compatible DT node with nodelabel `mcuboot_s2ram`. - */ -__attribute__((section(DT_PROP(DT_NODELABEL(mcuboot_s2ram), zephyr_memory_region)))) -volatile struct mcuboot_resume_s _mcuboot_resume; - -#define SET_MCUBOOT_RESUME_MAGIC() _mcuboot_resume.magic = MCUBOOT_S2RAM_RESUME_MAGIC -#else -#define SET_MCUBOOT_RESUME_MAGIC() -#endif - int soc_s2ram_suspend(pm_s2ram_system_off_fn_t system_off) { int ret; - SET_MCUBOOT_RESUME_MAGIC(); scb_save(&backup_data.scb_context); #if defined(CONFIG_FPU) #if !defined(CONFIG_FPU_SHARING) diff --git a/soc/nordic/nrf54h/pm_s2ram.h b/soc/nordic/nrf54h/pm_s2ram.h index 0906010cbe08..565afad6ca10 100644 --- a/soc/nordic/nrf54h/pm_s2ram.h +++ b/soc/nordic/nrf54h/pm_s2ram.h @@ -10,12 +10,6 @@ #ifndef _ZEPHYR_SOC_ARM_NORDIC_NRF_PM_S2RAM_H_ #define _ZEPHYR_SOC_ARM_NORDIC_NRF_PM_S2RAM_H_ -#define MCUBOOT_S2RAM_RESUME_MAGIC 0x75832419 - -struct mcuboot_resume_s { - uint32_t magic; /* magic value to identify valid structure */ -}; - /** * @brief Save CPU state on suspend * From ff130e7740853d0920d899bb23eaddcb9eb1e885 Mon Sep 17 00:00:00 2001 From: Adam Kondraciuk Date: Tue, 30 Sep 2025 16:09:33 +0200 Subject: [PATCH 1816/2141] Revert "[nrf fromlist] boards: Define pm_s2ram_stack for nRF54H20" This reverts commit cdc11bd5ef41488c5904d3ca147cd0907ce483e0. Signed-off-by: Adam Kondraciuk --- .../nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index 8bcde5c55de8..1c6d46a60ad8 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -345,19 +345,12 @@ zephyr_udc0: &usbhs { /* Trim this RAM block for making room on all run-time common S2RAM cpu context. */ &cpuapp_ram0 { - reg = <0x22000000 (DT_SIZE_K(32) - 48)>; - ranges = <0x0 0x22000000 (0x8000 - 0x30)>; + reg = <0x22000000 (DT_SIZE_K(32) - 32)>; + ranges = <0x0 0x22000000 (0x8000 - 0x20)>; }; / { soc { - /* temporary stack for S2RAM resume logic */ - pm_s2ram_stack: cpuapp_s2ram_stack@22007fd0 { - compatible = "zephyr,memory-region", "mmio-sram"; - reg = <0x22007fd0 16>; - zephyr,memory-region = "pm_s2ram_stack"; - }; - /* run-time common S2RAM cpu context RAM */ pm_s2ram: cpuapp_s2ram@22007fe0 { compatible = "zephyr,memory-region", "mmio-sram"; From 7c054e4b00fee688079eb1177bfe3a004b8626b8 Mon Sep 17 00:00:00 2001 From: Adam Kondraciuk Date: Wed, 16 Jul 2025 09:37:23 +0200 Subject: [PATCH 1817/2141] [nrf fromtree] soc: nordic: nrf54h: Implement idle with cache retained state Add new idle state with cache retention enabled. Signed-off-by: Adam Kondraciuk (cherry picked from commit 6f7a1834d52bc6a860d92a2777692ea5de582f50) --- .../nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 13 +++-- .../nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts | 17 +++++++ dts/vendor/nordic/nrf54h20.dtsi | 12 +++-- soc/nordic/nrf54h/CMakeLists.txt | 5 ++ .../nrf54h/Kconfig.defconfig.nrf54h20_cpuapp | 3 ++ .../nrf54h/Kconfig.defconfig.nrf54h20_cpurad | 3 ++ soc/nordic/nrf54h/power.c | 50 +++++++++++++++---- soc/nordic/nrf54h/soc.c | 42 +++++++++------- soc/nordic/nrf54h/soc.h | 7 +++ 9 files changed, 116 insertions(+), 36 deletions(-) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index 1c6d46a60ad8..83c539778ba1 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -343,14 +343,21 @@ zephyr_udc0: &usbhs { status = "okay"; }; -/* Trim this RAM block for making room on all run-time common S2RAM cpu context. */ +/* Trim this RAM block for power management related features. */ &cpuapp_ram0 { - reg = <0x22000000 (DT_SIZE_K(32) - 32)>; - ranges = <0x0 0x22000000 (0x8000 - 0x20)>; + reg = <0x22000000 (DT_SIZE_K(32) - 256)>; + ranges = <0x0 0x22000000 (0x8000 - 0x100)>; }; / { soc { + /* cache control functions - must be executed from local SRAM */ + pm_ramfunc: cpuapp_s2ram@22007f00 { + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0x22007f00 192>; + zephyr,memory-region = "PMLocalRamfunc"; + }; + /* run-time common S2RAM cpu context RAM */ pm_s2ram: cpuapp_s2ram@22007fe0 { compatible = "zephyr,memory-region", "mmio-sram"; diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts index 7f0da1291e84..a8c588268b3f 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts @@ -123,3 +123,20 @@ slot1_partition: &cpurad_slot1_partition { zephyr_udc0: &usbhs { status = "disabled"; }; + +/* Trim this RAM block for power management related features. */ +&cpurad_ram0 { + reg = <0x23000000 (DT_SIZE_K(192) - 192)>; + ranges = <0x0 0x23000000 (0x30000 - 0xC0)>; +}; + +/ { + soc { + /* cache control functions - must be executed from RAM */ + pm_ramfunc: cpurad_s2ram@2302ff40 { + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0x2302ff80 192>; + zephyr,memory-region = "PMLocalRamfunc"; + }; + }; +}; diff --git a/dts/vendor/nordic/nrf54h20.dtsi b/dts/vendor/nordic/nrf54h20.dtsi index 4644cb383ec5..56b807fafd48 100644 --- a/dts/vendor/nordic/nrf54h20.dtsi +++ b/dts/vendor/nordic/nrf54h20.dtsi @@ -31,7 +31,7 @@ device_type = "cpu"; clocks = <&cpuapp_hsfll>; clock-frequency = ; - cpu-power-states = <&idle_cache_disabled &s2ram>; + cpu-power-states = <&idle_cache_retained &idle_cache_disabled &s2ram>; }; cpurad: cpu@3 { @@ -40,7 +40,7 @@ device_type = "cpu"; clocks = <&cpurad_hsfll>; clock-frequency = ; - cpu-power-states = <&idle_cache_disabled>; + cpu-power-states = <&idle_cache_retained &idle_cache_disabled>; }; cpuppr: cpu@d { @@ -130,7 +130,13 @@ power-states { // substate-id = <0>; is reserved for "idle", cache powered on - // substate-id = <1>; is reserved for "idle-cache-retained" + idle_cache_retained: idle_cache_retained { + compatible = "zephyr,power-state"; + power-state-name = "suspend-to-idle"; + substate-id = <1>; + min-residency-us = <700>; + exit-latency-us = <5>; + }; idle_cache_disabled: idle_cache_disabled { compatible = "zephyr,power-state"; power-state-name = "suspend-to-idle"; diff --git a/soc/nordic/nrf54h/CMakeLists.txt b/soc/nordic/nrf54h/CMakeLists.txt index fed4307214d5..25e4796a4169 100644 --- a/soc/nordic/nrf54h/CMakeLists.txt +++ b/soc/nordic/nrf54h/CMakeLists.txt @@ -5,6 +5,11 @@ if(CONFIG_ARM) zephyr_library_sources(soc.c) if(CONFIG_PM OR CONFIG_POWEROFF) zephyr_library_sources(power.c) + zephyr_code_relocate( + FILES power.c + FILTER ".*\\.cache_retain_and_sleep" + LOCATION PMLocalRamfunc_TEXT + ) endif() endif() diff --git a/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuapp b/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuapp index 0cdc22760405..f2e0343d6350 100644 --- a/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuapp +++ b/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuapp @@ -14,4 +14,7 @@ config SHELL_BACKEND_SERIAL config POWER_DOMAIN default y +config CODE_DATA_RELOCATION + default y if PM || POWEROFF + endif # SOC_NRF54H20_CPUAPP diff --git a/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpurad b/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpurad index b3f5216c8f9f..31687c2a5443 100644 --- a/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpurad +++ b/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpurad @@ -14,4 +14,7 @@ config PM config POWER_DOMAIN default y +config CODE_DATA_RELOCATION + default y if PM || POWEROFF + endif # SOC_NRF54H20_CPURAD diff --git a/soc/nordic/nrf54h/power.c b/soc/nordic/nrf54h/power.c index e1263be0d0e5..3a23a6050605 100644 --- a/soc/nordic/nrf54h/power.c +++ b/soc/nordic/nrf54h/power.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -87,18 +88,43 @@ void nrf_poweroff(void) CODE_UNREACHABLE; } -static void s2idle_enter(uint8_t substate_id) +static __attribute__((__used__, noinline)) void cache_retain_and_sleep(void) { + nrf_cache_task_trigger(NRF_DCACHE, NRF_CACHE_TASK_SAVE); + nrf_cache_task_trigger(NRF_ICACHE, NRF_CACHE_TASK_SAVE); + while (nrf_cache_busy_check(NRF_DCACHE) || + nrf_cache_busy_check(NRF_ICACHE)) { + + } + + __set_BASEPRI(0); + __ISB(); + __DSB(); + __WFI(); + + nrf_cache_task_trigger(NRF_ICACHE, NRF_CACHE_TASK_RESTORE); + nrf_cache_task_trigger(NRF_DCACHE, NRF_CACHE_TASK_RESTORE); + while (nrf_cache_busy_check(NRF_DCACHE) || + nrf_cache_busy_check(NRF_ICACHE)) { + + } +} + +void s2idle_enter(uint8_t substate_id) +{ +#if !defined(CONFIG_SOC_NRF54H20_CPURAD) + soc_lrcconf_poweron_request(&soc_node, NRF_LRCCONF_POWER_MAIN); +#endif switch (substate_id) { case 0: /* Substate for idle with cache powered on - not implemented yet. */ break; - case 1: /* Substate for idle with cache retained - not implemented yet. */ - break; + case 1: /* Substate for idle with cache retained. */ + soc_lrcconf_poweron_release(&soc_node, NRF_LRCCONF_POWER_DOMAIN_0); + nrf_soc_memconf_retain_set(true); + cache_retain_and_sleep(); + return; case 2: /* Substate for idle with cache disabled. */ -#if !defined(CONFIG_SOC_NRF54H20_CPURAD) - soc_lrcconf_poweron_request(&soc_node, NRF_LRCCONF_POWER_MAIN); -#endif common_suspend(); break; default: /* Unknown substate. */ @@ -117,17 +143,19 @@ static void s2idle_exit(uint8_t substate_id) case 0: /* Substate for idle with cache powered on - not implemented yet. */ break; - case 1: /* Substate for idle with cache retained - not implemented yet. */ + case 1: /* Substate for idle with cache retained. */ + nrf_soc_memconf_retain_set(false); break; case 2: /* Substate for idle with cache disabled. */ nrf_power_up_cache(); - common_resume(); -#if !defined(CONFIG_SOC_NRF54H20_CPURAD) - soc_lrcconf_poweron_release(&soc_node, NRF_LRCCONF_POWER_MAIN); -#endif + break; default: /* Unknown substate. */ return; } + common_resume(); +#if !defined(CONFIG_SOC_NRF54H20_CPURAD) + soc_lrcconf_poweron_release(&soc_node, NRF_LRCCONF_POWER_MAIN); +#endif } #if defined(CONFIG_PM_S2RAM) diff --git a/soc/nordic/nrf54h/soc.c b/soc/nordic/nrf54h/soc.c index c996bc93e1ba..6692425f6748 100644 --- a/soc/nordic/nrf54h/soc.c +++ b/soc/nordic/nrf54h/soc.c @@ -61,6 +61,26 @@ sys_snode_t soc_node; ADDRESS_DOMAIN_Msk | \ ADDRESS_BUS_Msk))) +void nrf_soc_memconf_retain_set(bool enable) +{ + uint32_t ret_mask = BIT(RAMBLOCK_RET_BIT_ICACHE) | BIT(RAMBLOCK_RET_BIT_DCACHE); + + nrf_memconf_ramblock_ret_mask_enable_set(NRF_MEMCONF, 0, ret_mask, enable); + nrf_memconf_ramblock_ret_mask_enable_set(NRF_MEMCONF, 1, ret_mask, enable); + +#if defined(RAMBLOCK_RET2_MASK) + ret_mask = 0; +#if defined(RAMBLOCK_RET2_BIT_ICACHE) + ret_mask |= BIT(RAMBLOCK_RET2_BIT_ICACHE); +#endif +#if defined(RAMBLOCK_RET2_BIT_DCACHE) + ret_mask |= BIT(RAMBLOCK_RET2_BIT_DCACHE); +#endif + nrf_memconf_ramblock_ret2_mask_enable_set(NRF_MEMCONF, 0, ret_mask, enable); + nrf_memconf_ramblock_ret2_mask_enable_set(NRF_MEMCONF, 1, ret_mask, enable); +#endif /* defined(RAMBLOCK_RET2_MASK) */ +} + static void power_domain_init(void) { /* @@ -76,28 +96,12 @@ static void power_domain_init(void) soc_lrcconf_poweron_request(&soc_node, NRF_LRCCONF_POWER_DOMAIN_0); nrf_lrcconf_poweron_force_set(NRF_LRCCONF010, NRF_LRCCONF_POWER_MAIN, false); - - nrf_memconf_ramblock_ret_enable_set(NRF_MEMCONF, 0, RAMBLOCK_RET_BIT_ICACHE, false); - nrf_memconf_ramblock_ret_enable_set(NRF_MEMCONF, 0, RAMBLOCK_RET_BIT_DCACHE, false); - nrf_memconf_ramblock_ret_enable_set(NRF_MEMCONF, 1, RAMBLOCK_RET_BIT_ICACHE, false); - nrf_memconf_ramblock_ret_enable_set(NRF_MEMCONF, 1, RAMBLOCK_RET_BIT_DCACHE, false); -#if defined(RAMBLOCK_RET2_BIT_ICACHE) - nrf_memconf_ramblock_ret2_enable_set(NRF_MEMCONF, 0, RAMBLOCK_RET2_BIT_ICACHE, false); - nrf_memconf_ramblock_ret2_enable_set(NRF_MEMCONF, 1, RAMBLOCK_RET2_BIT_ICACHE, false); -#endif -#if defined(RAMBLOCK_RET2_BIT_DCACHE) - nrf_memconf_ramblock_ret2_enable_set(NRF_MEMCONF, 0, RAMBLOCK_RET2_BIT_DCACHE, false); - nrf_memconf_ramblock_ret2_enable_set(NRF_MEMCONF, 1, RAMBLOCK_RET2_BIT_DCACHE, false); -#endif + nrf_soc_memconf_retain_set(false); nrf_memconf_ramblock_ret_mask_enable_set(NRF_MEMCONF, 0, RAMBLOCK_RET_MASK, true); nrf_memconf_ramblock_ret_mask_enable_set(NRF_MEMCONF, 1, RAMBLOCK_RET_MASK, true); #if defined(RAMBLOCK_RET2_MASK) - /* - * TODO: Use nrf_memconf_ramblock_ret2_mask_enable_set() function - * when will be provided by HAL. - */ - NRF_MEMCONF->POWER[0].RET2 = RAMBLOCK_RET2_MASK; - NRF_MEMCONF->POWER[1].RET2 = RAMBLOCK_RET2_MASK; + nrf_memconf_ramblock_ret2_mask_enable_set(NRF_MEMCONF, 0, RAMBLOCK_RET2_MASK, true); + nrf_memconf_ramblock_ret2_mask_enable_set(NRF_MEMCONF, 1, RAMBLOCK_RET2_MASK, true); #endif } diff --git a/soc/nordic/nrf54h/soc.h b/soc/nordic/nrf54h/soc.h index 566c07a8c2cb..69c22e52bd16 100644 --- a/soc/nordic/nrf54h/soc.h +++ b/soc/nordic/nrf54h/soc.h @@ -36,4 +36,11 @@ #define RAMBLOCK_RET2_BIT_DCACHE MEMCONF_POWER_RET2_MEM7_Pos #endif +/** + * @brief Enable or disable the retention for cache RAM blocks. + * + * @param enable True if the retention is to be enabled, false otherwise. + */ +void nrf_soc_memconf_retain_set(bool enable); + #endif /* SOC_ARM_NORDIC_NRF_NRF54H_SOC_H_ */ From 605041b22bf07cb3aee99a9e08efe9a464716b95 Mon Sep 17 00:00:00 2001 From: Tomasz Chyrowicz Date: Tue, 16 Sep 2025 11:31:37 +0200 Subject: [PATCH 1818/2141] [nrf fromlist] boards: Define pm_s2ram_stack for nRF54H20 Add the definition of pm_s2ram_stack memory region for nRF54H20. Upstream PR #: 95914 Signed-off-by: Tomasz Chyrowicz (cherry picked from commit c2748343ba324b7b5b1acd5598494eb8ee5b4e9a) --- boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index 83c539778ba1..731e0ae78fa5 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -358,6 +358,13 @@ zephyr_udc0: &usbhs { zephyr,memory-region = "PMLocalRamfunc"; }; + /* temporary stack for S2RAM resume logic */ + pm_s2ram_stack: cpuapp_s2ram_stack@22007fd0 { + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0x22007fd0 16>; + zephyr,memory-region = "pm_s2ram_stack"; + }; + /* run-time common S2RAM cpu context RAM */ pm_s2ram: cpuapp_s2ram@22007fe0 { compatible = "zephyr,memory-region", "mmio-sram"; From 98bd8d2e46cb11c07bcaecc07729598537400b59 Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Fri, 5 Sep 2025 18:11:52 +0200 Subject: [PATCH 1819/2141] [nrf noup] soc/nordic/nrf54h/pm_s2ram: S2RAM resume hardening Added support for hardening decision on resume from S2RAM by MCUboot bootloader. Application sets additional variable to MCUBOOT_S2RAM_RESUME_MAGIC which allows the bootloader to doublecheck. Signed-off-by: Andrzej Puzdrowski (cherry picked from commit d4bb1c6b9f1c941480a457b18ae36c9bdf49faa7) --- .../nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 13 ++++++++++--- soc/nordic/nrf54h/pm_s2ram.c | 14 ++++++++++++++ soc/nordic/nrf54h/pm_s2ram.h | 6 ++++++ 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index 731e0ae78fa5..b6f14c53a617 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -359,14 +359,21 @@ zephyr_udc0: &usbhs { }; /* temporary stack for S2RAM resume logic */ - pm_s2ram_stack: cpuapp_s2ram_stack@22007fd0 { + pm_s2ram_stack: cpuapp_s2ram_stack@22007fcc { compatible = "zephyr,memory-region", "mmio-sram"; - reg = <0x22007fd0 16>; + reg = <0x22007fcc 16>; zephyr,memory-region = "pm_s2ram_stack"; }; + /* run-time common mcuboot S2RAM support section */ + mcuboot_s2ram: cpuapp_s2ram@22007fdc { + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0x22007fdc 4>; + zephyr,memory-region = "mcuboot_s2ram_context"; + }; + /* run-time common S2RAM cpu context RAM */ - pm_s2ram: cpuapp_s2ram@22007fe0 { + pm_s2ram: cpuapp_s2ram@22007fe0 { compatible = "zephyr,memory-region", "mmio-sram"; reg = <0x22007fe0 32>; zephyr,memory-region = "pm_s2ram_context"; diff --git a/soc/nordic/nrf54h/pm_s2ram.c b/soc/nordic/nrf54h/pm_s2ram.c index 221293c5b82e..6916e4884727 100644 --- a/soc/nordic/nrf54h/pm_s2ram.c +++ b/soc/nordic/nrf54h/pm_s2ram.c @@ -219,10 +219,24 @@ static void fpu_restore(_fpu_context_t *backup) #endif /* !defined(CONFIG_FPU_SHARING) */ #endif /* defined(CONFIG_FPU) */ +#if DT_NODE_EXISTS(DT_NODELABEL(mcuboot_s2ram)) &&\ + DT_NODE_HAS_COMPAT(DT_NODELABEL(mcuboot_s2ram), zephyr_memory_region) +/* Linker section name is given by `zephyr,memory-region` property of + * `zephyr,memory-region` compatible DT node with nodelabel `mcuboot_s2ram`. + */ +__attribute__((section(DT_PROP(DT_NODELABEL(mcuboot_s2ram), zephyr_memory_region)))) +volatile struct mcuboot_resume_s _mcuboot_resume; + +#define SET_MCUBOOT_RESUME_MAGIC() _mcuboot_resume.magic = MCUBOOT_S2RAM_RESUME_MAGIC +#else +#define SET_MCUBOOT_RESUME_MAGIC() +#endif + int soc_s2ram_suspend(pm_s2ram_system_off_fn_t system_off) { int ret; + SET_MCUBOOT_RESUME_MAGIC(); scb_save(&backup_data.scb_context); #if defined(CONFIG_FPU) #if !defined(CONFIG_FPU_SHARING) diff --git a/soc/nordic/nrf54h/pm_s2ram.h b/soc/nordic/nrf54h/pm_s2ram.h index 565afad6ca10..0906010cbe08 100644 --- a/soc/nordic/nrf54h/pm_s2ram.h +++ b/soc/nordic/nrf54h/pm_s2ram.h @@ -10,6 +10,12 @@ #ifndef _ZEPHYR_SOC_ARM_NORDIC_NRF_PM_S2RAM_H_ #define _ZEPHYR_SOC_ARM_NORDIC_NRF_PM_S2RAM_H_ +#define MCUBOOT_S2RAM_RESUME_MAGIC 0x75832419 + +struct mcuboot_resume_s { + uint32_t magic; /* magic value to identify valid structure */ +}; + /** * @brief Save CPU state on suspend * From 079a5d605b34b995bd002561943547ad9cf5f17d Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Tue, 30 Sep 2025 14:48:14 +0200 Subject: [PATCH 1820/2141] [nrf noup] soc/nordic/nrf54h20/pm_s2ram: extend mcuboot_resume_s nrf_squash! [nrf noup] soc/nordic/nf54h/pm_s2ram: S2RAM resume hardening Extended mcuboot_resume_s suture by slot_info field intended to be used by MCUboot for recognize proper boot slot in direct-xp mode. Signed-off-by: Andrzej Puzdrowski --- boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 8 ++++---- soc/nordic/nrf54h/pm_s2ram.h | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index b6f14c53a617..9bf42dab7d5d 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -359,16 +359,16 @@ zephyr_udc0: &usbhs { }; /* temporary stack for S2RAM resume logic */ - pm_s2ram_stack: cpuapp_s2ram_stack@22007fcc { + pm_s2ram_stack: cpuapp_s2ram_stack@22007fc8 { compatible = "zephyr,memory-region", "mmio-sram"; - reg = <0x22007fcc 16>; + reg = <0x22007fc8 16>; zephyr,memory-region = "pm_s2ram_stack"; }; /* run-time common mcuboot S2RAM support section */ - mcuboot_s2ram: cpuapp_s2ram@22007fdc { + mcuboot_s2ram: cpuapp_s2ram@22007fd8 { compatible = "zephyr,memory-region", "mmio-sram"; - reg = <0x22007fdc 4>; + reg = <0x22007fd8 8>; zephyr,memory-region = "mcuboot_s2ram_context"; }; diff --git a/soc/nordic/nrf54h/pm_s2ram.h b/soc/nordic/nrf54h/pm_s2ram.h index 0906010cbe08..01c098ea4310 100644 --- a/soc/nordic/nrf54h/pm_s2ram.h +++ b/soc/nordic/nrf54h/pm_s2ram.h @@ -14,6 +14,7 @@ struct mcuboot_resume_s { uint32_t magic; /* magic value to identify valid structure */ + uint32_t slot_info; }; /** From 23f56e05b481d0a7e674d299735388f574272bfa Mon Sep 17 00:00:00 2001 From: Adam Kondraciuk Date: Wed, 1 Oct 2025 16:27:50 +0200 Subject: [PATCH 1821/2141] [nrf fromlist] soc: nordic: nrf54h: Disable code relocation for MCUBOOT MCUBOOT requires LTO to be enabled, while using code relocation forces switching it off. When `__ramfunc` is used, LTO can also be used. Then the `cache_retain_and_sleep` function will work correctly, but slightly slower. Upstream PR #: 97094 Signed-off-by: Adam Kondraciuk --- soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuapp | 2 +- soc/nordic/nrf54h/power.c | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuapp b/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuapp index f2e0343d6350..674b5433c147 100644 --- a/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuapp +++ b/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuapp @@ -15,6 +15,6 @@ config POWER_DOMAIN default y config CODE_DATA_RELOCATION - default y if PM || POWEROFF + default y if (PM || POWEROFF) && !MCUBOOT endif # SOC_NRF54H20_CPUAPP diff --git a/soc/nordic/nrf54h/power.c b/soc/nordic/nrf54h/power.c index 3a23a6050605..c72cb6e834e5 100644 --- a/soc/nordic/nrf54h/power.c +++ b/soc/nordic/nrf54h/power.c @@ -88,7 +88,12 @@ void nrf_poweroff(void) CODE_UNREACHABLE; } -static __attribute__((__used__, noinline)) void cache_retain_and_sleep(void) +#if CONFIG_MCUBOOT +static __ramfunc +#else +static __attribute__((__used__, noinline)) +#endif +void cache_retain_and_sleep(void) { nrf_cache_task_trigger(NRF_DCACHE, NRF_CACHE_TASK_SAVE); nrf_cache_task_trigger(NRF_ICACHE, NRF_CACHE_TASK_SAVE); From 6ce781c9e668a42fb768fbb2b6f5ce573ca81ddc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Mon, 6 Oct 2025 09:08:59 +0200 Subject: [PATCH 1822/2141] [nrf fromtree] tests: drivers: uart: uart_async_api: Enable test on nrf54h20 PPR XIP MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add overlay and config file required to run the uart_async_api test on nrf54h20dk/nrf54h20/cpuppr/xip platform. Signed-off-by: Sebastian Głąb (cherry picked from commit e0a9a16a259c27e7cb7b25ae941d37f03ab5d807) --- .../uart_async_api/boards/nrf54h20dk_nrf54h20_cpuppr_xip.conf | 3 +++ .../boards/nrf54h20dk_nrf54h20_cpuppr_xip.overlay | 3 +++ 2 files changed, 6 insertions(+) create mode 100644 tests/drivers/uart/uart_async_api/boards/nrf54h20dk_nrf54h20_cpuppr_xip.conf create mode 100644 tests/drivers/uart/uart_async_api/boards/nrf54h20dk_nrf54h20_cpuppr_xip.overlay diff --git a/tests/drivers/uart/uart_async_api/boards/nrf54h20dk_nrf54h20_cpuppr_xip.conf b/tests/drivers/uart/uart_async_api/boards/nrf54h20dk_nrf54h20_cpuppr_xip.conf new file mode 100644 index 000000000000..47f481017118 --- /dev/null +++ b/tests/drivers/uart/uart_async_api/boards/nrf54h20dk_nrf54h20_cpuppr_xip.conf @@ -0,0 +1,3 @@ +CONFIG_PM_DEVICE=y +CONFIG_PM_DEVICE_RUNTIME=y +CONFIG_VAR_LENGTH_BUFFER_TEST_BUADRATE_LIMIT=57600 diff --git a/tests/drivers/uart/uart_async_api/boards/nrf54h20dk_nrf54h20_cpuppr_xip.overlay b/tests/drivers/uart/uart_async_api/boards/nrf54h20dk_nrf54h20_cpuppr_xip.overlay new file mode 100644 index 000000000000..f65b4dd3b0ba --- /dev/null +++ b/tests/drivers/uart/uart_async_api/boards/nrf54h20dk_nrf54h20_cpuppr_xip.overlay @@ -0,0 +1,3 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +#include "nrf54h20dk_nrf54h20_common.dtsi" From afb7e743a05fb3147a253e3bbd44ee6e10663369 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karol=20Laso=C5=84czyk?= Date: Tue, 5 Aug 2025 09:23:22 +0200 Subject: [PATCH 1823/2141] [nrf fromlist] tests: mbox: Add support for nRF54LM20A MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Extend test coverage with new test. Upstream PR #: 94110 Signed-off-by: Karol Lasończyk --- .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 23 +++++++++++++++++++ .../drivers/mbox/mbox_error_cases/sample.yaml | 2 ++ .../drivers/mbox/mbox_error_cases/src/main.c | 3 ++- 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 tests/drivers/mbox/mbox_error_cases/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay diff --git a/tests/drivers/mbox/mbox_error_cases/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/mbox/mbox_error_cases/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay new file mode 100644 index 000000000000..334ba0fa5b42 --- /dev/null +++ b/tests/drivers/mbox/mbox_error_cases/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -0,0 +1,23 @@ +/* + * Copyright 2025 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + mbox-consumer { + compatible = "vnd,mbox-consumer"; + mboxes = <&cpuapp_vevif_tx 21>, <&cpuapp_vevif_tx 32>, + <&cpuapp_vevif_rx 20>, <&cpuapp_vevif_rx 32>; + mbox-names = "remote_valid", "remote_incorrect", + "local_valid", "local_incorrect"; + + }; +}; + +&cpuapp_vevif_rx { + status = "okay"; +}; + +&cpuapp_vevif_tx { + status = "okay"; +}; diff --git a/tests/drivers/mbox/mbox_error_cases/sample.yaml b/tests/drivers/mbox/mbox_error_cases/sample.yaml index 2746a1c29044..a285478b4235 100644 --- a/tests/drivers/mbox/mbox_error_cases/sample.yaml +++ b/tests/drivers/mbox/mbox_error_cases/sample.yaml @@ -17,8 +17,10 @@ tests: tests.drivers.mbox_error_cases.nrf54l: platform_allow: - nrf54l15dk/nrf54l15/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp integration_platforms: - nrf54l15dk/nrf54l15/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp extra_args: SNIPPET=nordic-flpr diff --git a/tests/drivers/mbox/mbox_error_cases/src/main.c b/tests/drivers/mbox/mbox_error_cases/src/main.c index 54a4a628ec23..377ab6b8be43 100644 --- a/tests/drivers/mbox/mbox_error_cases/src/main.c +++ b/tests/drivers/mbox/mbox_error_cases/src/main.c @@ -11,7 +11,8 @@ int dummy_value; #if defined(CONFIG_SOC_NRF54L05) || defined(CONFIG_SOC_NRF54L10) || \ - defined(CONFIG_SOC_NRF54L15) || defined(CONFIG_SOC_NRF54H20) + defined(CONFIG_SOC_NRF54L15) || defined(CONFIG_SOC_NRF54H20) || \ + defined(CONFIG_SOC_NRF54LM20A) #define EXPECTED_MTU_VALUE (0) #define DATA_TRANSFER_MODE_SUPPORTED (0) #define REMOTE_BUSY_SUPPORTED (0) From bf8c0bceac0245cce37fd3b7ce7505a18d0df572 Mon Sep 17 00:00:00 2001 From: Marek Pieta Date: Thu, 2 Oct 2025 15:14:30 +0200 Subject: [PATCH 1824/2141] Revert "[nrf noup] bluetooth: conn: Skip buffer ref count check in send_buf" This reverts commit adb8f4e2ec19c3f4146b595daf4d579320a7506b. Signed-off-by: Marek Pieta --- subsys/bluetooth/host/conn.c | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/subsys/bluetooth/host/conn.c b/subsys/bluetooth/host/conn.c index d0b6264aaede..7248f7c54952 100644 --- a/subsys/bluetooth/host/conn.c +++ b/subsys/bluetooth/host/conn.c @@ -711,27 +711,19 @@ static int send_buf(struct bt_conn *conn, struct net_buf *buf, uint16_t frag_len = MIN(conn_mtu(conn), len); - /* If ATT sent callback is delayed until data transmission - * is done by BLE controller, the transmitted buffer may - * have an additional reference. The reference is used to - * extend lifetime of the net buffer until the data - * transmission is confirmed by ACK of the remote. + /* Check that buf->ref is 1 or 2. It would be 1 if this was + * the only reference (e.g. buf was removed from the conn + * tx_queue). It would be 2 if the tx_data_pull kept it on + * the tx_queue for segmentation. * - * send_buf function can be called multiple times, if buffer - * has to be fragmented over HCI. In that case, the callback - * is provided as an argument only for the last transmitted - * fragment. The `buf->ref == 1` (or 2) check is skipped - * because it's impossible to properly validate number of - * references for the sent fragments if buffers may have the - * additional reference. - * - * Otherwise, check that buf->ref is 1 or 2. It would be 1 - * if this was the only reference (e.g. buf was removed from - * the conn tx_queue). It would be 2 if the tx_data_pull - * kept it on the tx_queue for segmentation. + * Allow for an additional buffer reference if callback is + * provided. This can be used to extend lifetime of the net + * buffer until the data transmission is confirmed by ACK of + * the remote. */ - __ASSERT_NO_MSG(IS_ENABLED(CONFIG_BT_ATT_SENT_CB_AFTER_TX) || (buf->ref == 1) || - (buf->ref == 2)); + if (buf->ref > 2 + (cb ? 1 : 0)) { + __ASSERT_NO_MSG(false); + } /* The reference is always transferred to the frag, so when * the frag is destroyed, the parent reference is decremented. From 917082cb03075533a460e0867ab1c41b2148ab04 Mon Sep 17 00:00:00 2001 From: Marek Pieta Date: Thu, 2 Oct 2025 15:14:41 +0200 Subject: [PATCH 1825/2141] Revert "[nrf noup] bluetooth: conn: Allow for an extra ref in bt_l2cap_send_pdu" This reverts commit 510e36ccf52ba402fe52199287c0a01ffb27ccef. Signed-off-by: Marek Pieta --- subsys/bluetooth/host/conn.c | 17 +++++------------ subsys/bluetooth/host/l2cap.c | 8 ++------ 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/subsys/bluetooth/host/conn.c b/subsys/bluetooth/host/conn.c index 7248f7c54952..f3abf67d4fb6 100644 --- a/subsys/bluetooth/host/conn.c +++ b/subsys/bluetooth/host/conn.c @@ -711,19 +711,12 @@ static int send_buf(struct bt_conn *conn, struct net_buf *buf, uint16_t frag_len = MIN(conn_mtu(conn), len); - /* Check that buf->ref is 1 or 2. It would be 1 if this was - * the only reference (e.g. buf was removed from the conn - * tx_queue). It would be 2 if the tx_data_pull kept it on - * the tx_queue for segmentation. - * - * Allow for an additional buffer reference if callback is - * provided. This can be used to extend lifetime of the net - * buffer until the data transmission is confirmed by ACK of - * the remote. + /* Check that buf->ref is 1 or 2. It would be 1 if this + * was the only reference (e.g. buf was removed + * from the conn tx_queue). It would be 2 if the + * tx_data_pull kept it on the tx_queue for segmentation. */ - if (buf->ref > 2 + (cb ? 1 : 0)) { - __ASSERT_NO_MSG(false); - } + __ASSERT_NO_MSG((buf->ref == 1) || (buf->ref == 2)); /* The reference is always transferred to the frag, so when * the frag is destroyed, the parent reference is decremented. diff --git a/subsys/bluetooth/host/l2cap.c b/subsys/bluetooth/host/l2cap.c index 0879163a8a18..f65827fac1be 100644 --- a/subsys/bluetooth/host/l2cap.c +++ b/subsys/bluetooth/host/l2cap.c @@ -761,17 +761,13 @@ int bt_l2cap_send_pdu(struct bt_l2cap_le_chan *le_chan, struct net_buf *pdu, return -ENOTCONN; } - /* Allow for an additional buffer reference if callback is provided. This can be used to - * extend lifetime of the net buffer until the data transmission is confirmed by ACK of the - * remote. - */ - if (pdu->ref > 1 + (cb ? 1 : 0)) { + if (pdu->ref != 1) { /* The host may alter the buf contents when fragmenting. Higher * layers cannot expect the buf contents to stay intact. Extra * refs suggests a silent data corruption would occur if not for * this error. */ - LOG_ERR("Expecting up to %d refs, got %d", cb ? 2 : 1, pdu->ref); + LOG_ERR("Expecting 1 ref, got %d", pdu->ref); return -EINVAL; } From 45ace19b01018e57a87edc0be9b21a19ff09dc54 Mon Sep 17 00:00:00 2001 From: Marek Pieta Date: Thu, 2 Oct 2025 15:14:55 +0200 Subject: [PATCH 1826/2141] Revert "[nrf noup] bluetooth: att: Allow ATT sent callback after data TX is done" This reverts commit d1d9b2d1e653ca70f8aa34bc74cf13c4d09a4a4a. Signed-off-by: Marek Pieta --- subsys/bluetooth/host/Kconfig.gatt | 17 ----------------- subsys/bluetooth/host/att.c | 17 +---------------- 2 files changed, 1 insertion(+), 33 deletions(-) diff --git a/subsys/bluetooth/host/Kconfig.gatt b/subsys/bluetooth/host/Kconfig.gatt index 221bc413c4bc..a04241a3e94f 100644 --- a/subsys/bluetooth/host/Kconfig.gatt +++ b/subsys/bluetooth/host/Kconfig.gatt @@ -38,23 +38,6 @@ config BT_ATT_RETRY_ON_SEC_ERR If an ATT request fails due to insufficient security, the host will try to elevate the security level and retry the ATT request. -config BT_ATT_SENT_CB_AFTER_TX - bool "Delay ATT sent callback until data transmission is done by controller [EXPERIMENTAL]" - select EXPERIMENTAL - help - By default, the BLE stack calls sent callback for ATT data when the - data is passed to BLE controller for transmission. Enabling this - Kconfig option delays calling the sent callback until data - transmission is finished by BLE controller (the callback is called - upon receiving the Number of Completed Packets HCI Event). - - The feature is not available in Zephyr RTOS (it's specific to NCS - Zephyr fork). It is a temporary solution allowing to control flow of - GATT notifications with HID reports for HID use-case. - - Enabling this option may require increasing CONFIG_BT_CONN_TX_MAX in - configuration, because ATT would use additional TX contexts. - config BT_EATT bool "Enhanced ATT Bearers support [EXPERIMENTAL]" depends on BT_L2CAP_ECRED diff --git a/subsys/bluetooth/host/att.c b/subsys/bluetooth/host/att.c index 37d8856bad24..82d82526b5b0 100644 --- a/subsys/bluetooth/host/att.c +++ b/subsys/bluetooth/host/att.c @@ -328,13 +328,6 @@ static void att_disconnect(struct bt_att_chan *chan) } } -static void chan_sent_cb(struct bt_conn *conn, void *user_data, int err) -{ - struct net_buf *nb = user_data; - - net_buf_unref(nb); -} - /* In case of success the ownership of the buffer is transferred to the stack * which takes care of releasing it when it completes transmitting to the * controller. @@ -428,15 +421,7 @@ static int chan_send(struct bt_att_chan *chan, struct net_buf *buf) data->att_chan = chan; - if (IS_ENABLED(CONFIG_BT_ATT_SENT_CB_AFTER_TX)) { - err = bt_l2cap_send_pdu(&chan->chan, buf, chan_sent_cb, net_buf_ref(buf)); - if (err) { - net_buf_unref(buf); - } - } else { - err = bt_l2cap_send_pdu(&chan->chan, buf, NULL, NULL); - } - + err = bt_l2cap_send_pdu(&chan->chan, buf, NULL, NULL); if (err) { if (err == -ENOBUFS) { LOG_ERR("Ran out of TX buffers or contexts."); From b99465266420e7b118b65bdce0e618555b861759 Mon Sep 17 00:00:00 2001 From: Marek Pieta Date: Fri, 14 Jun 2024 09:13:48 +0200 Subject: [PATCH 1827/2141] [nrf noup] bluetooth: att: Allow ATT sent callback after data TX is done By default, the BLE stack calls sent callback for ATT data when the data is passed to BLE controller for transmission. Enabling this Kconfig option delays calling the sent callback until data transmission is finished by BLE controller (the callback is delayed until receiving the Number of Completed Packets HCI Event). If the ATT sent callback is delayed until data transmission is done by BLE controller, the transmitted buffer may have an additional reference. The reference is used to extend lifetime of the net buffer until the data transmission is confirmed by ACK of the remote. Jira: NCSDK-27422 Jira: NCSDK-28624 Jira: NCSDK-35650 Signed-off-by: Marek Pieta --- subsys/bluetooth/host/Kconfig.gatt | 14 ++++++++++++++ subsys/bluetooth/host/att.c | 17 ++++++++++++++++- subsys/bluetooth/host/conn.c | 27 ++++++++++++++++++++++----- subsys/bluetooth/host/l2cap.c | 10 ++++++++-- 4 files changed, 60 insertions(+), 8 deletions(-) diff --git a/subsys/bluetooth/host/Kconfig.gatt b/subsys/bluetooth/host/Kconfig.gatt index a04241a3e94f..3403e8d308b8 100644 --- a/subsys/bluetooth/host/Kconfig.gatt +++ b/subsys/bluetooth/host/Kconfig.gatt @@ -38,6 +38,20 @@ config BT_ATT_RETRY_ON_SEC_ERR If an ATT request fails due to insufficient security, the host will try to elevate the security level and retry the ATT request. +config BT_ATT_SENT_CB_AFTER_TX + bool "Delay ATT sent callback until data transmission is done by controller [EXPERIMENTAL]" + select EXPERIMENTAL + help + By default, the BLE stack calls sent callback for ATT data when the + data is passed to BLE controller for transmission. Enabling this + Kconfig option delays calling the sent callback until data + transmission is finished by BLE controller (the callback is called + upon receiving the Number of Completed Packets HCI Event). + + The feature is not available in Zephyr RTOS (it's specific to NCS + Zephyr fork). It is a temporary solution allowing to control flow of + GATT notifications with HID reports for HID use-case. + config BT_EATT bool "Enhanced ATT Bearers support [EXPERIMENTAL]" depends on BT_L2CAP_ECRED diff --git a/subsys/bluetooth/host/att.c b/subsys/bluetooth/host/att.c index 82d82526b5b0..37d8856bad24 100644 --- a/subsys/bluetooth/host/att.c +++ b/subsys/bluetooth/host/att.c @@ -328,6 +328,13 @@ static void att_disconnect(struct bt_att_chan *chan) } } +static void chan_sent_cb(struct bt_conn *conn, void *user_data, int err) +{ + struct net_buf *nb = user_data; + + net_buf_unref(nb); +} + /* In case of success the ownership of the buffer is transferred to the stack * which takes care of releasing it when it completes transmitting to the * controller. @@ -421,7 +428,15 @@ static int chan_send(struct bt_att_chan *chan, struct net_buf *buf) data->att_chan = chan; - err = bt_l2cap_send_pdu(&chan->chan, buf, NULL, NULL); + if (IS_ENABLED(CONFIG_BT_ATT_SENT_CB_AFTER_TX)) { + err = bt_l2cap_send_pdu(&chan->chan, buf, chan_sent_cb, net_buf_ref(buf)); + if (err) { + net_buf_unref(buf); + } + } else { + err = bt_l2cap_send_pdu(&chan->chan, buf, NULL, NULL); + } + if (err) { if (err == -ENOBUFS) { LOG_ERR("Ran out of TX buffers or contexts."); diff --git a/subsys/bluetooth/host/conn.c b/subsys/bluetooth/host/conn.c index f3abf67d4fb6..f4d1f84c8cd7 100644 --- a/subsys/bluetooth/host/conn.c +++ b/subsys/bluetooth/host/conn.c @@ -711,12 +711,29 @@ static int send_buf(struct bt_conn *conn, struct net_buf *buf, uint16_t frag_len = MIN(conn_mtu(conn), len); - /* Check that buf->ref is 1 or 2. It would be 1 if this - * was the only reference (e.g. buf was removed - * from the conn tx_queue). It would be 2 if the - * tx_data_pull kept it on the tx_queue for segmentation. + /* If ATT sent callback is delayed until data transmission + * is done by BLE controller (CONFIG_BT_ATT_SENT_CB_AFTER_TX), + * the `chan_send` function from `att.c` introduces an additional + * reference. The reference is used to extend lifetime of the net + * buffer until the data transmission is confirmed by ACK of the + * remote (the reference is removed when the TX callback passed + * to `bt_l2cap_send_pdu` is called). + * + * send_buf function can be called multiple times, if buffer + * has to be fragmented over HCI. In that case, the callback + * is provided as an argument only for the last transmitted + * fragment. The `buf->ref == 1` (or 2) check is skipped + * because it's impossible to properly validate number of + * references for the sent fragments if buffers may have the + * additional reference. + * + * Otherwise, check that buf->ref is 1 or 2. It would be 1 + * if this was the only reference (e.g. buf was removed from + * the conn tx_queue). It would be 2 if the tx_data_pull + * kept it on the tx_queue for segmentation. */ - __ASSERT_NO_MSG((buf->ref == 1) || (buf->ref == 2)); + __ASSERT_NO_MSG(IS_ENABLED(CONFIG_BT_ATT_SENT_CB_AFTER_TX) || (buf->ref == 1) || + (buf->ref == 2)); /* The reference is always transferred to the frag, so when * the frag is destroyed, the parent reference is decremented. diff --git a/subsys/bluetooth/host/l2cap.c b/subsys/bluetooth/host/l2cap.c index f65827fac1be..f974335c9d8a 100644 --- a/subsys/bluetooth/host/l2cap.c +++ b/subsys/bluetooth/host/l2cap.c @@ -761,13 +761,19 @@ int bt_l2cap_send_pdu(struct bt_l2cap_le_chan *le_chan, struct net_buf *pdu, return -ENOTCONN; } - if (pdu->ref != 1) { + /* If ATT sent callback is delayed until data transmission is done by BLE controller + * (CONFIG_BT_ATT_SENT_CB_AFTER_TX), the `chan_send` function from `att.c` introduces an + * additional reference. The reference is used to extend lifetime of the net buffer until + * the data transmission is confirmed by ACK of the remote (the reference is removed when + * the TX callback passed to `bt_l2cap_send_pdu` is called). + */ + if (pdu->ref > 1 + (cb ? 1 : 0)) { /* The host may alter the buf contents when fragmenting. Higher * layers cannot expect the buf contents to stay intact. Extra * refs suggests a silent data corruption would occur if not for * this error. */ - LOG_ERR("Expecting 1 ref, got %d", pdu->ref); + LOG_ERR("Expecting up to %d refs, got %d", cb ? 2 : 1, pdu->ref); return -EINVAL; } From 5d3ab35b88fe0d1136ee384745b24661a18cb3b2 Mon Sep 17 00:00:00 2001 From: Aleksander Wasaznik Date: Mon, 6 Oct 2025 16:02:41 +0200 Subject: [PATCH 1828/2141] [nrf fromlist] Bluetooth: Host: Invoke tx callbacks when channel is deleted When bt_l2cap_send_pdu() succeeds, it transfers buffer ownership to the stack, which must eventually invoke the provided callback. This contract is honored in all paths where transmission becomes impossible: - Normal transmission: callback invoked with err=0 after HCI Number of Completed Packets event (tx_notify_process) - Send errors (after tx allocated): callback invoked with err=-ESHUTDOWN via conn_tx_destroy - Send errors (before tx allocated): callback invoked with the specific error code in send_buf error_return path - Connection disconnect: callbacks invoked with err=-ESHUTDOWN via process_unack_tx -> conn_tx_destroy for all PDUs in tx_pending However, when a channel is deleted (l2cap_chan_del), PDUs remaining in the tx_queue are dropped without invoking their callbacks, violating the ownership contract. Fix this by extracting and invoking any non-NULL callbacks from the closure stored in buf->user_data before releasing the buffers. The callback is invoked with err=-ESHUTDOWN, making this path analogous to process_unack_tx: both drain queues of unsent PDUs when transmission becomes impossible due to external events (channel deletion vs connection disconnect). The only difference is the buffer lifecycle stage - in l2cap_chan_del, PDUs are still in tx_queue (closure in buf->user_data), while in process_unack_tx, they've progressed to tx_pending (callback in bt_conn_tx struct). Note: conn_tx_destroy() cannot be used here because no bt_conn_tx struct has been allocated yet - the closure is still in buf->user_data. Upstream PR #: 97056 Signed-off-by: Aleksander Wasaznik --- subsys/bluetooth/host/l2cap.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/subsys/bluetooth/host/l2cap.c b/subsys/bluetooth/host/l2cap.c index f974335c9d8a..df5c4a8f4bc7 100644 --- a/subsys/bluetooth/host/l2cap.c +++ b/subsys/bluetooth/host/l2cap.c @@ -273,6 +273,21 @@ static void l2cap_chan_del(struct bt_l2cap_chan *chan) * `l2cap_chan_destroy()` as it is not called for fixed channels. */ while ((buf = k_fifo_get(&le_chan->tx_queue, K_NO_WAIT))) { + bt_conn_tx_cb_t cb = closure_cb(buf->user_data); + + if (cb) { + void *user_data = closure_data(buf->user_data); + + /* When bt_l2cap_send_pdu() succeeds, the stack takes ownership + * and must invoke the callback eventually. Since these PDUs will + * never be transmitted, invoke the callback now with an error. + * Note: We cannot use conn_tx_destroy() here because no bt_conn_tx + * struct has been allocated yet - the closure is still in the + * buf->user_data. + */ + cb(chan->conn, user_data, -ESHUTDOWN); + } + net_buf_unref(buf); } From 17417aa75e663b4c91ffe00b60c9339a629c5e9e Mon Sep 17 00:00:00 2001 From: Bartlomiej Buczek Date: Wed, 8 Oct 2025 09:02:06 +0200 Subject: [PATCH 1829/2141] [nrf fromlist] boards: nordic: nrf54h20: Add adc to supported features Enable twister tests execution on nrf54h20dk/nrf54h20/cpuppr target. Upstream PR #: 97165 Signed-off-by: Bartlomiej Buczek --- boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr_0_9_0.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr_0_9_0.yaml b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr_0_9_0.yaml index 60f22350504d..87fe8c68ba91 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr_0_9_0.yaml +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr_0_9_0.yaml @@ -11,6 +11,7 @@ sysbuild: true ram: 62 flash: 62 supported: + - adc - counter - gpio - i2c From a9b806184a31b3dfdd79d36701d78f5eb34902da Mon Sep 17 00:00:00 2001 From: Bartlomiej Buczek Date: Tue, 7 Oct 2025 13:45:54 +0200 Subject: [PATCH 1830/2141] [nrf fromlist] tests: drivers: adc: Enable tests for nrf54h20 PPR. Fill in necessary config files with test data. Upstream PR #: 97109 Signed-off-by: Bartlomiej Buczek --- tests/drivers/adc/adc_accuracy_test/testcase.yaml | 1 + .../boards/nrf54h20dk_nrf54h20_common.dtsi | 11 +++++++++++ .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 8 ++------ .../boards/nrf54h20dk_nrf54h20_cpuppr.overlay | 11 +++++++++++ tests/drivers/adc/adc_error_cases/testcase.yaml | 1 + 5 files changed, 26 insertions(+), 6 deletions(-) create mode 100644 tests/drivers/adc/adc_error_cases/boards/nrf54h20dk_nrf54h20_common.dtsi create mode 100644 tests/drivers/adc/adc_error_cases/boards/nrf54h20dk_nrf54h20_cpuppr.overlay diff --git a/tests/drivers/adc/adc_accuracy_test/testcase.yaml b/tests/drivers/adc/adc_accuracy_test/testcase.yaml index 03f122f9cdaa..1f2f7c0fcfeb 100644 --- a/tests/drivers/adc/adc_accuracy_test/testcase.yaml +++ b/tests/drivers/adc/adc_accuracy_test/testcase.yaml @@ -22,6 +22,7 @@ tests: - frdm_mcxc444 - nrf52840dk/nrf52840 - nrf54h20dk/nrf54h20/cpuapp + - nrf54h20dk/nrf54h20/cpuppr - nrf54l15dk/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp diff --git a/tests/drivers/adc/adc_error_cases/boards/nrf54h20dk_nrf54h20_common.dtsi b/tests/drivers/adc/adc_error_cases/boards/nrf54h20dk_nrf54h20_common.dtsi new file mode 100644 index 000000000000..bb3597397b96 --- /dev/null +++ b/tests/drivers/adc/adc_error_cases/boards/nrf54h20dk_nrf54h20_common.dtsi @@ -0,0 +1,11 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2025 Nordic Semiconductor ASA + */ + +/ { + aliases { + adc = &adc; + }; +}; diff --git a/tests/drivers/adc/adc_error_cases/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/adc/adc_error_cases/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index 18e74f72ee26..efc3d8f64b45 100644 --- a/tests/drivers/adc/adc_error_cases/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/tests/drivers/adc/adc_error_cases/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -1,11 +1,7 @@ /* * SPDX-License-Identifier: Apache-2.0 * - * Copyright (c) 2024 Nordic Semiconductor ASA + * Copyright (c) 2025 Nordic Semiconductor ASA */ -/ { - aliases { - adc = &adc; - }; -}; +#include "nrf54h20dk_nrf54h20_common.dtsi" diff --git a/tests/drivers/adc/adc_error_cases/boards/nrf54h20dk_nrf54h20_cpuppr.overlay b/tests/drivers/adc/adc_error_cases/boards/nrf54h20dk_nrf54h20_cpuppr.overlay new file mode 100644 index 000000000000..bcd359c3aa23 --- /dev/null +++ b/tests/drivers/adc/adc_error_cases/boards/nrf54h20dk_nrf54h20_cpuppr.overlay @@ -0,0 +1,11 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2025 Nordic Semiconductor ASA + */ + +#include "nrf54h20dk_nrf54h20_common.dtsi" + +&adc { + status = "okay"; +}; diff --git a/tests/drivers/adc/adc_error_cases/testcase.yaml b/tests/drivers/adc/adc_error_cases/testcase.yaml index 57513c78e156..739efb735632 100644 --- a/tests/drivers/adc/adc_error_cases/testcase.yaml +++ b/tests/drivers/adc/adc_error_cases/testcase.yaml @@ -11,6 +11,7 @@ tests: - nrf54l15dk/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - nrf54h20dk/nrf54h20/cpuapp + - nrf54h20dk/nrf54h20/cpuppr - ophelia4ev/nrf54l15/cpuapp - xg24_rb4187c - xg27_dk2602a From 2c39832fa1d1a876367a1cc3976252b2452a599e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Bainczyk?= Date: Tue, 7 Oct 2025 13:29:54 +0200 Subject: [PATCH 1831/2141] [nrf fromlist] drivers: nrf: Add missing SoC header includes to adc and i2s MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add missing SoC header include required by memory region assertion to adc_nrfx_saadc and i2s_nrf_tdm shims. Upstream PR #: 97104 Signed-off-by: Michał Bainczyk --- drivers/adc/adc_nrfx_saadc.c | 1 + drivers/i2s/i2s_nrf_tdm.c | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/adc/adc_nrfx_saadc.c b/drivers/adc/adc_nrfx_saadc.c index 06035e2c3c5d..b92b5ccfe6b3 100644 --- a/drivers/adc/adc_nrfx_saadc.c +++ b/drivers/adc/adc_nrfx_saadc.c @@ -13,6 +13,7 @@ #include #include #include +#include LOG_MODULE_REGISTER(adc_nrfx_saadc, CONFIG_ADC_LOG_LEVEL); diff --git a/drivers/i2s/i2s_nrf_tdm.c b/drivers/i2s/i2s_nrf_tdm.c index 45e5b3d18049..fc823ce5055a 100644 --- a/drivers/i2s/i2s_nrf_tdm.c +++ b/drivers/i2s/i2s_nrf_tdm.c @@ -16,6 +16,7 @@ #include #include #include +#include #include LOG_MODULE_REGISTER(tdm_nrf, CONFIG_I2S_LOG_LEVEL); From f75ebf1d5b2a8ce3e3e1bfc02b16c492fe7b1417 Mon Sep 17 00:00:00 2001 From: Bartlomiej Buczek Date: Tue, 7 Oct 2025 14:19:48 +0200 Subject: [PATCH 1832/2141] [nrf fromlist] samples: drivers: adc: Enable samples for nrf54h20 PPR. Fill in necessary config files with platforms data. Upstream PR #: 97110 Signed-off-by: Bartlomiej Buczek --- samples/drivers/adc/adc_dt/sample.yaml | 1 + .../boards/nrf54h20dk_nrf54h20_common.dtsi | 50 +++++++++++++++++++ .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 45 +---------------- .../boards/nrf54h20dk_nrf54h20_cpuppr.overlay | 11 ++++ samples/drivers/adc/adc_sequence/sample.yaml | 2 + .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 11 ++++ .../sysbuild/vpr_launcher/prj.conf | 1 + 7 files changed, 77 insertions(+), 44 deletions(-) create mode 100644 samples/drivers/adc/adc_sequence/boards/nrf54h20dk_nrf54h20_common.dtsi create mode 100644 samples/drivers/adc/adc_sequence/boards/nrf54h20dk_nrf54h20_cpuppr.overlay create mode 100644 samples/drivers/adc/adc_sequence/sysbuild/vpr_launcher/boards/nrf54h20dk_nrf54h20_cpuapp.overlay create mode 100644 samples/drivers/adc/adc_sequence/sysbuild/vpr_launcher/prj.conf diff --git a/samples/drivers/adc/adc_dt/sample.yaml b/samples/drivers/adc/adc_dt/sample.yaml index b6eaa02cf14a..d6842d47f988 100644 --- a/samples/drivers/adc/adc_dt/sample.yaml +++ b/samples/drivers/adc/adc_dt/sample.yaml @@ -16,6 +16,7 @@ tests: - nrf51dk/nrf51822 - nrf52840dk/nrf52840 - nrf54h20dk/nrf54h20/cpuapp + - nrf54h20dk/nrf54h20/cpuppr - nrf54l15dk/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp diff --git a/samples/drivers/adc/adc_sequence/boards/nrf54h20dk_nrf54h20_common.dtsi b/samples/drivers/adc/adc_sequence/boards/nrf54h20dk_nrf54h20_common.dtsi new file mode 100644 index 000000000000..291faa0440de --- /dev/null +++ b/samples/drivers/adc/adc_sequence/boards/nrf54h20dk_nrf54h20_common.dtsi @@ -0,0 +1,50 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2025 Nordic Semiconductor ASA + */ + +/ { + aliases { + adc0 = &adc; + }; +}; + +&adc { + #address-cells = <1>; + #size-cells = <0>; + + channel@0 { + reg = <0>; + zephyr,gain = "ADC_GAIN_1_2"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,input-positive = ; /* P1.01 */ + }; + + channel@1 { + reg = <1>; + zephyr,gain = "ADC_GAIN_1_2"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,input-positive = ; /* P1.02 */ + }; + + channel@2 { + reg = <2>; + zephyr,gain = "ADC_GAIN_1_2"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,input-positive = ; /* P9.01 */ + zephyr,vref-mv = <3686>; /* 3.6V * 1024 */ + }; + + channel@7 { + reg = <7>; + zephyr,gain = "ADC_GAIN_1_2"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,input-positive = ; /* P1.03 */ + zephyr,input-negative = ; /* P1.07 */ + }; +}; diff --git a/samples/drivers/adc/adc_sequence/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/samples/drivers/adc/adc_sequence/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index d4f9e8db7c2b..658b19b0ae5d 100644 --- a/samples/drivers/adc/adc_sequence/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/samples/drivers/adc/adc_sequence/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -4,47 +4,4 @@ * Copyright (c) 2024 Nordic Semiconductor ASA */ -/ { - aliases { - adc0 = &adc; - }; -}; - -&adc { - #address-cells = <1>; - #size-cells = <0>; - - channel@0 { - reg = <0>; - zephyr,gain = "ADC_GAIN_1_2"; - zephyr,reference = "ADC_REF_INTERNAL"; - zephyr,acquisition-time = ; - zephyr,input-positive = ; /* P1.01 */ - }; - - channel@1 { - reg = <1>; - zephyr,gain = "ADC_GAIN_1_2"; - zephyr,reference = "ADC_REF_INTERNAL"; - zephyr,acquisition-time = ; - zephyr,input-positive = ; /* P1.02 */ - }; - - channel@2 { - reg = <2>; - zephyr,gain = "ADC_GAIN_1_2"; - zephyr,reference = "ADC_REF_INTERNAL"; - zephyr,acquisition-time = ; - zephyr,input-positive = ; /* P9.01 */ - zephyr,vref-mv = <3686>; /* 3.6V * 1024 */ - }; - - channel@7 { - reg = <7>; - zephyr,gain = "ADC_GAIN_1_2"; - zephyr,reference = "ADC_REF_INTERNAL"; - zephyr,acquisition-time = ; - zephyr,input-positive = ; /* P1.03 */ - zephyr,input-negative = ; /* P1.07 */ - }; -}; +#include "nrf54h20dk_nrf54h20_common.dtsi" diff --git a/samples/drivers/adc/adc_sequence/boards/nrf54h20dk_nrf54h20_cpuppr.overlay b/samples/drivers/adc/adc_sequence/boards/nrf54h20dk_nrf54h20_cpuppr.overlay new file mode 100644 index 000000000000..bcd359c3aa23 --- /dev/null +++ b/samples/drivers/adc/adc_sequence/boards/nrf54h20dk_nrf54h20_cpuppr.overlay @@ -0,0 +1,11 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2025 Nordic Semiconductor ASA + */ + +#include "nrf54h20dk_nrf54h20_common.dtsi" + +&adc { + status = "okay"; +}; diff --git a/samples/drivers/adc/adc_sequence/sample.yaml b/samples/drivers/adc/adc_sequence/sample.yaml index d176e2593d4b..6927bcdf88d9 100644 --- a/samples/drivers/adc/adc_sequence/sample.yaml +++ b/samples/drivers/adc/adc_sequence/sample.yaml @@ -19,6 +19,7 @@ tests: - cy8cproto_062_4343w - nrf52840dk/nrf52840 - nrf54h20dk/nrf54h20/cpuapp + - nrf54h20dk/nrf54h20/cpuppr - nrf54l15dk/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - ophelia4ev/nrf54l15/cpuapp @@ -32,6 +33,7 @@ tests: sample.drivers.adc.adc_sequence.8bit: platform_allow: - nrf54h20dk/nrf54h20/cpuapp + - nrf54h20dk/nrf54h20/cpuppr - nrf54l15dk/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp integration_platforms: diff --git a/samples/drivers/adc/adc_sequence/sysbuild/vpr_launcher/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/samples/drivers/adc/adc_sequence/sysbuild/vpr_launcher/boards/nrf54h20dk_nrf54h20_cpuapp.overlay new file mode 100644 index 000000000000..2570d64e2eb3 --- /dev/null +++ b/samples/drivers/adc/adc_sequence/sysbuild/vpr_launcher/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -0,0 +1,11 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ +#include "../../../boards/nrf54h20dk_nrf54h20_common.dtsi" + +&adc { + status = "reserved"; + interrupt-parent = <&cpuppr_clic>; +}; diff --git a/samples/drivers/adc/adc_sequence/sysbuild/vpr_launcher/prj.conf b/samples/drivers/adc/adc_sequence/sysbuild/vpr_launcher/prj.conf new file mode 100644 index 000000000000..b2a4ba591044 --- /dev/null +++ b/samples/drivers/adc/adc_sequence/sysbuild/vpr_launcher/prj.conf @@ -0,0 +1 @@ +# nothing here From 6cf5c3a2875520f259bc772bdeeda5ca8a96589c Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Thu, 2 Oct 2025 16:06:39 +0200 Subject: [PATCH 1833/2141] Revert "[nrf fromlist] arch: Allow to specify memory for S2RAM resume" This reverts commit cc5a1b44c218570cce3760c4a35a67b2e9cc7dc5. Signed-off-by: Andrzej Puzdrowski --- arch/arm/core/cortex_m/reset.S | 12 ------------ subsys/pm/Kconfig | 5 ----- 2 files changed, 17 deletions(-) diff --git a/arch/arm/core/cortex_m/reset.S b/arch/arm/core/cortex_m/reset.S index 6bdf8d4a8e94..b09391aaf0b5 100644 --- a/arch/arm/core/cortex_m/reset.S +++ b/arch/arm/core/cortex_m/reset.S @@ -101,17 +101,6 @@ SECTION_SUBSEC_FUNC(TEXT,_reset_section,__start) #endif /* CONFIG_INIT_ARCH_HW_AT_BOOT */ #if defined(CONFIG_PM_S2RAM) -#if DT_NODE_EXISTS(DT_NODELABEL(pm_s2ram_stack)) &&\ - DT_NODE_HAS_COMPAT(DT_NODELABEL(pm_s2ram_stack), zephyr_memory_region) - /* In certain scenarios, the interrupt stack is actually not safe to overwrite. - * For example, when MCUboot is used, the bootloader's "z_interrupt_stack" and the - * loaded image's "z_interrupt_stacks" are NOT at the same address, and writing to - * the former would corrupt unrelated data from the loaded image. To support such - * scenarios, if the Device Tree provides a specially named "zephyr,memory-region", - * use it as the stack to run arch_pm_s2ram_resume instead of the interrupt stack. - */ - ldr r0, =DT_REG_ADDR(DT_NODELABEL(pm_s2ram_stack)) + DT_REG_SIZE(DT_NODELABEL(pm_s2ram_stack)) -#else /* * Temporarily set MSP to interrupt stack so that arch_pm_s2ram_resume can * use stack for calling pm_s2ram_mark_check_and_clear. @@ -124,7 +113,6 @@ SECTION_SUBSEC_FUNC(TEXT,_reset_section,__start) * a short while, there is no change in behavior in either of the paths. */ ldr r0, =z_interrupt_stacks + CONFIG_ISR_STACK_SIZE + MPU_GUARD_ALIGN_AND_SIZE -#endif msr msp, r0 bl arch_pm_s2ram_resume diff --git a/subsys/pm/Kconfig b/subsys/pm/Kconfig index 53c649799cc4..af0409de559a 100644 --- a/subsys/pm/Kconfig +++ b/subsys/pm/Kconfig @@ -41,11 +41,6 @@ config PM_S2RAM When enabled on Cortex-M, and a 'zephyr,memory-region' compatible node with nodelabel 'pm_s2ram' is defined in DT, _cpu_context symbol (located in arch/arm/core/cortex_m/pm_s2ram.c) is placed in linker section given by 'zephyr,memory-region' property of aforementioned node. - Additionally on Cortex-M, if a 'zephyr,memory-region' compatible node with nodelabel - 'pm_s2ram_stack' is defined in DT, this region will be used as a temporary program stack - for the S2RAM resume logic. The assembly reset handling code itself makes a single push of - the return address, but the SoC-specific function (pm_s2ram_mark_check_and_clear) must be - analyzed to determine the required stack size. config PM_S2RAM_CUSTOM_MARKING bool "Use custom marking functions" From 29feb191e381db3f73eb2443f0bec047837d5086 Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Thu, 2 Oct 2025 16:43:27 +0200 Subject: [PATCH 1834/2141] [nrf fromtree] arch/arm: introduce the pre-stack/RAM init hook Introduce hook for customize reset.S code even before stack is initialized or RAM is accessed. Hook can be enabled using CONFIG_SOC_EARLY_RESET_HOOK=y. Hook implementation is by soc_early_reset_hook() function which should be provided by custom code. Signed-off-by: Andrzej Puzdrowski (cherry picked from commit 418eed0f90781a0d6d70f4e79c0006ce3955823f) --- arch/arm/core/cortex_m/reset.S | 8 ++++++++ include/zephyr/platform/hooks.h | 13 +++++++++++++ kernel/Kconfig.init | 22 ++++++++++++++++++++++ 3 files changed, 43 insertions(+) diff --git a/arch/arm/core/cortex_m/reset.S b/arch/arm/core/cortex_m/reset.S index b09391aaf0b5..85002c275f7c 100644 --- a/arch/arm/core/cortex_m/reset.S +++ b/arch/arm/core/cortex_m/reset.S @@ -35,6 +35,10 @@ GTEXT(z_arm_init_arch_hw_at_boot) #if defined(CONFIG_PM_S2RAM) GTEXT(arch_pm_s2ram_resume) #endif +#if defined(CONFIG_SOC_EARLY_RESET_HOOK) +GTEXT(soc_early_reset_hook) +#endif + /* * PACBTI Mask for CONTROL register: @@ -100,6 +104,10 @@ SECTION_SUBSEC_FUNC(TEXT,_reset_section,__start) #endif /* CONFIG_INIT_ARCH_HW_AT_BOOT */ +#if defined(CONFIG_SOC_EARLY_RESET_HOOK) + /* Call custom code that executes before any stack is set up or RAM memory is accessed */ + bl soc_early_reset_hook +#endif #if defined(CONFIG_PM_S2RAM) /* * Temporarily set MSP to interrupt stack so that arch_pm_s2ram_resume can diff --git a/include/zephyr/platform/hooks.h b/include/zephyr/platform/hooks.h index 9989f640d65e..12defd10ab84 100644 --- a/include/zephyr/platform/hooks.h +++ b/include/zephyr/platform/hooks.h @@ -19,6 +19,19 @@ * directly from application code but may be freely used within the OS. */ +#ifdef CONFIG_SOC_EARLY_RESET_HOOK +/** + * @brief SoC hook executed before data RAM initialization, at the beginning + * of the reset vector. + * + * This hook is implemented by the SoC and can be used to perform any + * SoC-specific initialization. Refer to :kconfig:option:`SOC_EARLY_RESET_HOOK` + * and relevant architecture zephyr-rtos startup implementation for more details. + */ +void soc_early_reset_hook(void); +#else +#define soc_early_reset_hook() do { } while (0) +#endif /** * @brief SoC hook executed at the beginning of the reset vector. diff --git a/kernel/Kconfig.init b/kernel/Kconfig.init index 495381638fb0..c752fa5a0e43 100644 --- a/kernel/Kconfig.init +++ b/kernel/Kconfig.init @@ -6,6 +6,28 @@ menu "SoC and Board Hooks" +config SOC_EARLY_RESET_HOOK + bool "Run SoC-specific early reset hook" + help + Run a SoC-specific hook early in the reset/startup code (__start). + A custom hook soc_early_reset_hook() will be executed at the beginning + of the architecture-specific startup code, after hardware has been + configured (as required by CONFIG_INIT_ARCH_HW_AT_BOOT) but before + architecture's own resume logic. + + Returning from this hook is not mandatory: it can be used to implement + special logic to resume execution in some scenarios (for example, when + a bootloader is used). + + The stack pointer register should be considered as not initialized upon + call to this hook. In particular, this means that the hook is NOT allowed + to "push" any data using this stack pointer value. However, the hook may + use an implementation-specific area as stack if desired; in such case, + the original value of the stack pointer needs not to be "restored" before + returning control to the hook's caller. + + Additional constraints may be imposed on the hook by the architecture. + config SOC_RESET_HOOK bool "Run early SoC reset hook" help From d1bc07cfdb9c88077e401124792ba294a0dfec6d Mon Sep 17 00:00:00 2001 From: Piotr Kosycarz Date: Wed, 17 Sep 2025 12:30:33 +0200 Subject: [PATCH 1835/2141] [nrf fromtree] tests: drivers: flash: common: require external_flash fixture Add "external_flash" fixture to the no_explicit_erase testcase in order to run twister only on boards with such HW setup. Other runnable test cases has it already. Signed-off-by: Piotr Kosycarz (cherry picked from commit 23188321bce592dcbb6be5a513510ddc36d470d6) --- tests/drivers/flash/common/testcase.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/drivers/flash/common/testcase.yaml b/tests/drivers/flash/common/testcase.yaml index 6f59f3799c5a..d441d3c8f7bf 100644 --- a/tests/drivers/flash/common/testcase.yaml +++ b/tests/drivers/flash/common/testcase.yaml @@ -60,7 +60,8 @@ tests: - nrf54l15dk/nrf54l10/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54h20dk/nrf54h20/cpuapp - - ophelia4ev/nrf54l15/cpuapp + harness_config: + fixture: external_flash drivers.flash.common.nrf54lm20a: platform_allow: - nrf54lm20dk/nrf54lm20a/cpuapp From 2c6007378cbf84131179879ea677ac3441e02020 Mon Sep 17 00:00:00 2001 From: Bartosz Miller Date: Mon, 6 Oct 2025 10:13:04 +0200 Subject: [PATCH 1836/2141] [nrf fromtree] tests: drivers: flash: Fix fixture assignment for the supply-gpios test Supply-gpios feature test [nrf54h20] requires gpio_loopback fixture. Signed-off-by: Bartosz Miller (cherry picked from commit 424459d5d7cbba0f6c5e7160bd73be034ab18539) --- tests/drivers/flash/common/testcase.yaml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/drivers/flash/common/testcase.yaml b/tests/drivers/flash/common/testcase.yaml index d441d3c8f7bf..c2a4da0a705c 100644 --- a/tests/drivers/flash/common/testcase.yaml +++ b/tests/drivers/flash/common/testcase.yaml @@ -59,9 +59,13 @@ tests: - nrf54l15dk/nrf54l05/cpuapp - nrf54l15dk/nrf54l10/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf54h20dk/nrf54h20/cpuapp harness_config: fixture: external_flash + drivers.flash.common.no_explicit_erase.nrf54h: + platform_allow: + - nrf54h20dk/nrf54h20/cpuapp + harness_config: + fixture: gpio_loopback drivers.flash.common.nrf54lm20a: platform_allow: - nrf54lm20dk/nrf54lm20a/cpuapp @@ -193,3 +197,5 @@ tests: - nrf54h20dk/nrf54h20/cpuapp extra_args: - EXTRA_DTC_OVERLAY_FILE=boards/mx25uw63_low_freq.overlay + harness_config: + fixture: gpio_loopback From 60524d97884a137634038931c024b873800e08fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Bainczyk?= Date: Thu, 25 Sep 2025 08:32:14 +0200 Subject: [PATCH 1837/2141] [nrf fromlist] drivers: timer: nrf_grtc_timer: use a function for cc enable check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of checking register values directly, use a function from nrfx that does this. Upstream PR #: 96538 Signed-off-by: Michał Bainczyk --- drivers/timer/nrf_grtc_timer.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/timer/nrf_grtc_timer.c b/drivers/timer/nrf_grtc_timer.c index 75278e104bd2..b0593e3bd135 100644 --- a/drivers/timer/nrf_grtc_timer.c +++ b/drivers/timer/nrf_grtc_timer.c @@ -335,18 +335,13 @@ int z_nrf_grtc_timer_capture_prepare(int32_t chan) int z_nrf_grtc_timer_capture_read(int32_t chan, uint64_t *captured_time) { - /* TODO: The implementation should probably go to nrfx_grtc and this - * should be just a wrapper for some nrfx_grtc_syscounter_capture_read. - */ - uint64_t capt_time; nrfx_err_t result; IS_CHANNEL_ALLOWED_ASSERT(chan); - /* TODO: Use `nrfy_grtc_sys_counter_enable_check` when available (NRFX-2480) */ - if (NRF_GRTC->CC[chan].CCEN == GRTC_CC_CCEN_ACTIVE_Enable) { - /* If the channel is enabled (.CCEN), it means that there was no capture + if (nrfx_grtc_sys_counter_cc_enable_check(chan)) { + /* If the channel is enabled, it means that there was no capture * triggering event. */ return -EBUSY; From 67d649dbbb8f49dfcdbea40ea438e713afbda531 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Bainczyk?= Date: Thu, 4 Sep 2025 14:17:51 +0200 Subject: [PATCH 1838/2141] [nrf fromlist] drivers: flashdisk: fix value returned from disk_flash_access_write MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change the value returned from disk_flash_access_write to return the return code instead of a hardcoded zero. Upstream PR #: 95468 Signed-off-by: Michał Bainczyk --- drivers/disk/flashdisk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/disk/flashdisk.c b/drivers/disk/flashdisk.c index 4d8e3f1eee01..a2bb7d010365 100644 --- a/drivers/disk/flashdisk.c +++ b/drivers/disk/flashdisk.c @@ -424,7 +424,7 @@ static int disk_flash_access_write(struct disk_info *disk, const uint8_t *buff, end: k_mutex_unlock(&ctx->lock); - return 0; + return rc; } static int disk_flash_access_ioctl(struct disk_info *disk, uint8_t cmd, void *buff) From 29aa21b8ac8e738fa6854e2127833c0e1613e101 Mon Sep 17 00:00:00 2001 From: Piotr Kosycarz Date: Mon, 13 Oct 2025 10:59:03 +0200 Subject: [PATCH 1839/2141] [nrf noup] dts: arm: nordic: remove L20 dts nrf-squash! [nrf noup] entropy: Add fake entropy nRF PRNG driver LM20a is used, L20 was removed. Old L20 file is from other noup: dbd3934e5f2e83e4ae84fb549c72852eadca6b16 Signed-off-by: Piotr Kosycarz --- dts/arm/nordic/nrf54l20_enga_cpuapp.dtsi | 125 ----------------------- 1 file changed, 125 deletions(-) delete mode 100644 dts/arm/nordic/nrf54l20_enga_cpuapp.dtsi diff --git a/dts/arm/nordic/nrf54l20_enga_cpuapp.dtsi b/dts/arm/nordic/nrf54l20_enga_cpuapp.dtsi deleted file mode 100644 index 5c7e5db30014..000000000000 --- a/dts/arm/nordic/nrf54l20_enga_cpuapp.dtsi +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include - -cpu: &cpuapp {}; -systick: &cpuapp_systick {}; -nvic: &cpuapp_nvic {}; - -/delete-node/ &cpuflpr; -/delete-node/ &cpuflpr_rram; -/delete-node/ &cpuflpr_sram; -/delete-node/ &cpuflpr_clic; - -/ { - chosen { - zephyr,entropy = &prng; - }; - - soc { - compatible = "simple-bus"; - interrupt-parent = <&cpuapp_nvic>; - ranges; - }; - - psa_rng: psa-rng { - compatible = "zephyr,psa-crypto-rng"; - status = "disabled"; - }; - - prng: prng { - compatible = "nordic,entropy-prng"; - status = "okay"; - }; -}; - -&cpuflpr_vpr { - cpuapp_vevif_rx: mailbox@1 { - compatible = "nordic,nrf-vevif-event-rx"; - reg = <0x0 0x1000>; - status = "disabled"; - interrupts = <76 NRF_DEFAULT_IRQ_PRIORITY>; - #mbox-cells = <1>; - nordic,events = <1>; - nordic,events-mask = <0x00100000>; - }; - - cpuapp_vevif_tx: mailbox@0 { - compatible = "nordic,nrf-vevif-task-tx"; - reg = <0x0 0x1000>; - #mbox-cells = <1>; - nordic,tasks = <7>; - nordic,tasks-mask = <0x007f0000>; - status = "disabled"; - }; -}; - -&cpuapp_ppb { - compatible = "simple-bus"; - ranges; -}; - -&grtc { - interrupts = <228 NRF_DEFAULT_IRQ_PRIORITY>, - <229 NRF_DEFAULT_IRQ_PRIORITY>; /* reserved for Zero Latency IRQs */ -}; - -&gpiote20 { - interrupts = <219 NRF_DEFAULT_IRQ_PRIORITY>; -}; - -&gpiote30 { - interrupts = <269 NRF_DEFAULT_IRQ_PRIORITY>; -}; - -&dppic00 { - status = "okay"; -}; - -&dppic10 { - status = "okay"; -}; - -&dppic20 { - status = "okay"; -}; - -&dppic30 { - status = "okay"; -}; - -&ppib00 { - status = "okay"; -}; - -&ppib01 { - status = "okay"; -}; - -&ppib10 { - status = "okay"; -}; - -&ppib11 { - status = "okay"; -}; - -&ppib20 { - status = "okay"; -}; - -&ppib21 { - status = "okay"; -}; - -&ppib22 { - status = "okay"; -}; - -&ppib30 { - status = "okay"; -}; From 69e4a103226354d59ce6c3ed2ec43f623f792334 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B8e?= Date: Fri, 19 Sep 2025 11:44:19 +0200 Subject: [PATCH 1840/2141] [nrf fromtree] soc: nordic: uicr: Add support for SECURESTORAGE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add UICR.SECURESTORAGE configuration based on device tree partitions. Validates partition layout and populates size fields in 1KB units. Handles missing partitions gracefully. Signed-off-by: Sebastian Bøe (cherry picked from commit 38a0f713a683dc6fa9d9444511d7bde243c3ee05) --- scripts/ci/check_compliance.py | 1 + soc/nordic/common/uicr/gen_uicr.py | 198 +++++++++++++++++- .../common/uicr/gen_uicr/CMakeLists.txt | 46 ++++ soc/nordic/common/uicr/gen_uicr/Kconfig | 22 ++ 4 files changed, 266 insertions(+), 1 deletion(-) diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index 0c4ae7baecc2..99343d513e40 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -1303,6 +1303,7 @@ def check_no_undef_outside_kconfig(self, kconf): "GEN_UICR_GENERATE_PERIPHCONF", # Used in specialized build tool, not part of main Kconfig "GEN_UICR_SECONDARY", # Used in specialized build tool, not part of main Kconfig "GEN_UICR_SECONDARY_GENERATE_PERIPHCONF", # Used in specialized build tool, not part of main Kconfig + "GEN_UICR_SECURESTORAGE", # Used in specialized build tool, not part of main Kconfig "HEAP_MEM_POOL_ADD_SIZE_", # Used as an option matching prefix "HUGETLBFS", # Linux, in boards/xtensa/intel_adsp_cavs25/doc "IAR_BUFFERED_WRITE", diff --git a/soc/nordic/common/uicr/gen_uicr.py b/soc/nordic/common/uicr/gen_uicr.py index ce69cd7e80a3..b4594d2e2722 100644 --- a/soc/nordic/common/uicr/gen_uicr.py +++ b/soc/nordic/common/uicr/gen_uicr.py @@ -8,7 +8,8 @@ import argparse import ctypes as c import sys -from itertools import groupby +from itertools import groupby, pairwise +from typing import NamedTuple from elftools.elf.elffile import ELFFile from intelhex import IntelHex @@ -29,6 +30,14 @@ class ScriptError(RuntimeError): ... +class PartitionInfo(NamedTuple): + """Information about a partition for secure storage validation.""" + + address: int + size: int + name: str + + class PeriphconfEntry(c.LittleEndianStructure): _pack_ = 1 _fields_ = [ @@ -198,6 +207,105 @@ class Uicr(c.LittleEndianStructure): ] +def validate_secure_storage_partitions(args: argparse.Namespace) -> None: + """ + Validate that secure storage partitions are laid out correctly. + + Args: + args: Parsed command line arguments containing partition information + + Raises: + ScriptError: If validation fails + """ + # Expected order: cpuapp_crypto_partition, cpurad_crypto_partition, + # cpuapp_its_partition, cpurad_its_partition + partitions = [ + PartitionInfo( + args.cpuapp_crypto_address, args.cpuapp_crypto_size, "cpuapp_crypto_partition" + ), + PartitionInfo( + args.cpurad_crypto_address, args.cpurad_crypto_size, "cpurad_crypto_partition" + ), + PartitionInfo(args.cpuapp_its_address, args.cpuapp_its_size, "cpuapp_its_partition"), + PartitionInfo(args.cpurad_its_address, args.cpurad_its_size, "cpurad_its_partition"), + ] + + # Filter out zero-sized partitions (missing partitions) + present_partitions = [p for p in partitions if p.size > 0] + + # Require at least one subpartition to be present + if not present_partitions: + raise ScriptError( + "At least one secure storage subpartition must be defined. " + "Define one or more of: cpuapp_crypto_partition, cpurad_crypto_partition, " + "cpuapp_its_partition, cpurad_its_partition" + ) + + # Check 4KB alignment for secure storage start address + if args.securestorage_address % 4096 != 0: + raise ScriptError( + f"Secure storage address {args.securestorage_address:#x} must be aligned to 4KB " + f"(4096 bytes)" + ) + + # Check 4KB alignment for secure storage size + if args.securestorage_size % 4096 != 0: + raise ScriptError( + f"Secure storage size {args.securestorage_size} bytes must be aligned to 4KB " + f"(4096 bytes)" + ) + + # Check that the first present partition starts at the secure storage address + first_partition = present_partitions[0] + if first_partition.address != args.securestorage_address: + raise ScriptError( + f"First partition {first_partition.name} starts at {first_partition.address:#x}, " + f"but must start at secure storage address {args.securestorage_address:#x}" + ) + + # Check that all present partitions have sizes that are multiples of 1KB + for partition in present_partitions: + if partition.size % 1024 != 0: + raise ScriptError( + f"Partition {partition.name} has size {partition.size} bytes, but must be " + f"a multiple of 1024 bytes (1KB)" + ) + + # Check that partitions are in correct order and don't overlap + for curr_partition, next_partition in pairwise(present_partitions): + # Check order - partitions should be in ascending address order + if curr_partition.address >= next_partition.address: + raise ScriptError( + f"Partition {curr_partition.name} (starts at {curr_partition.address:#x}) " + f"must come before {next_partition.name} (starts at {next_partition.address:#x})" + ) + + # Check for overlap + curr_end = curr_partition.address + curr_partition.size + if curr_end > next_partition.address: + raise ScriptError( + f"Partition {curr_partition.name} (ends at {curr_end:#x}) overlaps with " + f"{next_partition.name} (starts at {next_partition.address:#x})" + ) + + # Check for gaps (should be no gaps between consecutive partitions) + if curr_end < next_partition.address: + gap = next_partition.address - curr_end + raise ScriptError( + f"Gap of {gap} bytes between {curr_partition.name} (ends at {curr_end:#x}) and " + f"{next_partition.name} (starts at {next_partition.address:#x})" + ) + + # Check that combined subpartition sizes equal secure_storage_partition size + total_subpartition_size = sum(p.size for p in present_partitions) + if total_subpartition_size != args.securestorage_size: + raise ScriptError( + f"Combined size of subpartitions ({total_subpartition_size} bytes) does not match " + f"secure_storage_partition size ({args.securestorage_size} bytes). " + f"The definition is not coherent." + ) + + def main() -> None: parser = argparse.ArgumentParser( allow_abbrev=False, @@ -255,6 +363,71 @@ def main() -> None: type=lambda s: int(s, 0), help="Absolute flash address of the UICR region (decimal or 0x-prefixed hex)", ) + parser.add_argument( + "--securestorage", + action="store_true", + help="Enable secure storage support in UICR", + ) + parser.add_argument( + "--securestorage-address", + default=None, + type=lambda s: int(s, 0), + help="Absolute flash address of the secure storage partition (decimal or 0x-prefixed hex)", + ) + parser.add_argument( + "--securestorage-size", + default=None, + type=lambda s: int(s, 0), + help="Size in bytes of the secure storage partition (decimal or 0x-prefixed hex)", + ) + parser.add_argument( + "--cpuapp-crypto-address", + default=0, + type=lambda s: int(s, 0), + help="Absolute flash address of cpuapp_crypto_partition (decimal or 0x-prefixed hex)", + ) + parser.add_argument( + "--cpuapp-crypto-size", + default=0, + type=lambda s: int(s, 0), + help="Size in bytes of cpuapp_crypto_partition (decimal or 0x-prefixed hex)", + ) + parser.add_argument( + "--cpurad-crypto-address", + default=0, + type=lambda s: int(s, 0), + help="Absolute flash address of cpurad_crypto_partition (decimal or 0x-prefixed hex)", + ) + parser.add_argument( + "--cpurad-crypto-size", + default=0, + type=lambda s: int(s, 0), + help="Size in bytes of cpurad_crypto_partition (decimal or 0x-prefixed hex)", + ) + parser.add_argument( + "--cpuapp-its-address", + default=0, + type=lambda s: int(s, 0), + help="Absolute flash address of cpuapp_its_partition (decimal or 0x-prefixed hex)", + ) + parser.add_argument( + "--cpuapp-its-size", + default=0, + type=lambda s: int(s, 0), + help="Size in bytes of cpuapp_its_partition (decimal or 0x-prefixed hex)", + ) + parser.add_argument( + "--cpurad-its-address", + default=0, + type=lambda s: int(s, 0), + help="Absolute flash address of cpurad_its_partition (decimal or 0x-prefixed hex)", + ) + parser.add_argument( + "--cpurad-its-size", + default=0, + type=lambda s: int(s, 0), + help="Size in bytes of cpurad_its_partition (decimal or 0x-prefixed hex)", + ) parser.add_argument( "--secondary", action="store_true", @@ -327,12 +500,35 @@ def main() -> None: "--out-secondary-periphconf-hex is used" ) + # Validate secure storage argument dependencies + if args.securestorage: + if args.securestorage_address is None: + raise ScriptError( + "--securestorage-address is required when --securestorage is used" + ) + if args.securestorage_size is None: + raise ScriptError("--securestorage-size is required when --securestorage is used") + + # Validate partition layout + validate_secure_storage_partitions(args) + init_values = DISABLED_VALUE.to_bytes(4, "little") * (c.sizeof(Uicr) // 4) uicr = Uicr.from_buffer_copy(init_values) uicr.VERSION.MAJOR = UICR_FORMAT_VERSION_MAJOR uicr.VERSION.MINOR = UICR_FORMAT_VERSION_MINOR + # Handle secure storage configuration + if args.securestorage: + uicr.SECURESTORAGE.ENABLE = ENABLED_VALUE + uicr.SECURESTORAGE.ADDRESS = args.securestorage_address + + # Set partition sizes in 1KB units + uicr.SECURESTORAGE.CRYPTO.APPLICATIONSIZE1KB = args.cpuapp_crypto_size // 1024 + uicr.SECURESTORAGE.CRYPTO.RADIOCORESIZE1KB = args.cpurad_crypto_size // 1024 + uicr.SECURESTORAGE.ITS.APPLICATIONSIZE1KB = args.cpuapp_its_size // 1024 + uicr.SECURESTORAGE.ITS.RADIOCORESIZE1KB = args.cpurad_its_size // 1024 + # Process periphconf data first and configure UICR completely before creating hex objects periphconf_hex = IntelHex() secondary_periphconf_hex = IntelHex() diff --git a/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt b/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt index 1163ff8e21f9..28c6e6749094 100644 --- a/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt +++ b/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt @@ -44,6 +44,25 @@ function(compute_partition_address_and_size partition_nodelabel output_address_v set(${output_size_var} ${partition_size} PARENT_SCOPE) endfunction() +# Function to compute optional partition address and size from devicetree +# If partition doesn't exist, sets both address and size to 0 +function(compute_optional_partition_address_and_size partition_nodelabel output_address_var output_size_var) + # Initialize with default values + set(${output_address_var} 0 PARENT_SCOPE) + set(${output_size_var} 0 PARENT_SCOPE) + + # Check if partition exists + dt_nodelabel(partition_path NODELABEL ${partition_nodelabel} QUIET) + if(partition_path) + # Call nested function with different variable names to avoid naming conflicts + compute_partition_address_and_size(${partition_nodelabel} temp_addr temp_size) + + # Copy the results to the output variables in parent scope + set(${output_address_var} ${temp_addr} PARENT_SCOPE) + set(${output_size_var} ${temp_size} PARENT_SCOPE) + endif() +endfunction() + # Use CMAKE_VERBOSE_MAKEFILE to silence an unused-variable warning. if(CMAKE_VERBOSE_MAKEFILE) endif() @@ -60,6 +79,32 @@ set(secondary_periphconf_hex_file ${APPLICATION_BINARY_DIR}/zephyr/secondary_per dt_nodelabel(uicr_path NODELABEL "uicr" REQUIRED) dt_reg_addr(UICR_ADDRESS PATH ${uicr_path} REQUIRED) +# Handle secure storage configuration +set(securestorage_args) +if(CONFIG_GEN_UICR_SECURESTORAGE) + list(APPEND securestorage_args --securestorage) + + # Extract secure storage partition information (required) + compute_partition_address_and_size("secure_storage_partition" SECURE_STORAGE_ADDRESS SECURE_STORAGE_SIZE) + list(APPEND securestorage_args --securestorage-address ${SECURE_STORAGE_ADDRESS}) + list(APPEND securestorage_args --securestorage-size ${SECURE_STORAGE_SIZE}) + + # Extract individual partition information for validation (optional partitions) + compute_optional_partition_address_and_size("cpuapp_crypto_partition" CPUAPP_CRYPTO_ADDRESS CPUAPP_CRYPTO_SIZE) + compute_optional_partition_address_and_size("cpurad_crypto_partition" CPURAD_CRYPTO_ADDRESS CPURAD_CRYPTO_SIZE) + compute_optional_partition_address_and_size("cpuapp_its_partition" CPUAPP_ITS_ADDRESS CPUAPP_ITS_SIZE) + compute_optional_partition_address_and_size("cpurad_its_partition" CPURAD_ITS_ADDRESS CPURAD_ITS_SIZE) + + list(APPEND securestorage_args --cpuapp-crypto-address ${CPUAPP_CRYPTO_ADDRESS}) + list(APPEND securestorage_args --cpuapp-crypto-size ${CPUAPP_CRYPTO_SIZE}) + list(APPEND securestorage_args --cpurad-crypto-address ${CPURAD_CRYPTO_ADDRESS}) + list(APPEND securestorage_args --cpurad-crypto-size ${CPURAD_CRYPTO_SIZE}) + list(APPEND securestorage_args --cpuapp-its-address ${CPUAPP_ITS_ADDRESS}) + list(APPEND securestorage_args --cpuapp-its-size ${CPUAPP_ITS_SIZE}) + list(APPEND securestorage_args --cpurad-its-address ${CPURAD_ITS_ADDRESS}) + list(APPEND securestorage_args --cpurad-its-size ${CPURAD_ITS_SIZE}) +endif(CONFIG_GEN_UICR_SECURESTORAGE) + if(CONFIG_GEN_UICR_GENERATE_PERIPHCONF) # gen_uicr.py parses all zephyr.elf files. To find these files (which # have not been built yet) we scan sibling build directories for @@ -134,6 +179,7 @@ add_custom_command( --out-merged-hex ${merged_hex_file} --out-uicr-hex ${uicr_hex_file} ${periphconf_args} + ${securestorage_args} ${secondary_args} DEPENDS ${periphconf_elfs} ${secondary_periphconf_elfs} WORKING_DIRECTORY ${APPLICATION_BINARY_DIR} diff --git a/soc/nordic/common/uicr/gen_uicr/Kconfig b/soc/nordic/common/uicr/gen_uicr/Kconfig index 41d31db64647..17758597bc34 100644 --- a/soc/nordic/common/uicr/gen_uicr/Kconfig +++ b/soc/nordic/common/uicr/gen_uicr/Kconfig @@ -21,6 +21,28 @@ config GEN_UICR_SECONDARY_GENERATE_PERIPHCONF When enabled, the UICR generator will populate the secondary_periphconf_partition partition. +config GEN_UICR_SECURESTORAGE + bool "Enable UICR.SECURESTORAGE" + default y + depends on $(dt_nodelabel_enabled,secure_storage_partition) + help + When enabled, the UICR generator will configure the + secure storage region based on device tree partitions. + + The following device tree partitions are used: + - secure_storage_partition: Main secure storage partition (required) + - cpuapp_crypto_partition: Application processor crypto storage (optional) + - cpurad_crypto_partition: Radio core crypto storage (optional) + - cpuapp_its_partition: Application processor internal trusted storage (optional) + - cpurad_its_partition: Radio core internal trusted storage (optional) + + Requirements: + - The secure_storage_partition address and size must be aligned to 4KB + - All subpartitions must be multiples of 1KB and laid out contiguously + without gaps + - At least one subpartition must be defined + - Combined subpartition sizes must equal secure_storage_partition size + endmenu source "Kconfig.zephyr" From 0baf9407abc7b842483e685a677a13ea7cc7888a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B8e?= Date: Tue, 9 Sep 2025 13:27:39 +0200 Subject: [PATCH 1841/2141] [nrf fromtree] soc: nordic: uicr: Add support for uicr.SECONDARY.PROCESSOR MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add support for uicr.SECONDARY.PROCESSOR. Signed-off-by: Sebastian Bøe (cherry picked from commit 9f45d2ccd787655efb62fd2a8afac4dd026d0a01) --- scripts/ci/check_compliance.py | 1 + soc/nordic/common/uicr/gen_uicr.py | 7 +++ .../common/uicr/gen_uicr/CMakeLists.txt | 1 + soc/nordic/common/uicr/gen_uicr/Kconfig | 48 ++++++++++++++----- 4 files changed, 46 insertions(+), 11 deletions(-) diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index 99343d513e40..7a27e6dca3df 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -1303,6 +1303,7 @@ def check_no_undef_outside_kconfig(self, kconf): "GEN_UICR_GENERATE_PERIPHCONF", # Used in specialized build tool, not part of main Kconfig "GEN_UICR_SECONDARY", # Used in specialized build tool, not part of main Kconfig "GEN_UICR_SECONDARY_GENERATE_PERIPHCONF", # Used in specialized build tool, not part of main Kconfig + "GEN_UICR_SECONDARY_PROCESSOR_VALUE", # Used in specialized build tool, not part of main Kconfig "GEN_UICR_SECURESTORAGE", # Used in specialized build tool, not part of main Kconfig "HEAP_MEM_POOL_ADD_SIZE_", # Used as an option matching prefix "HUGETLBFS", # Linux, in boards/xtensa/intel_adsp_cavs25/doc diff --git a/soc/nordic/common/uicr/gen_uicr.py b/soc/nordic/common/uicr/gen_uicr.py index b4594d2e2722..e074314a1abb 100644 --- a/soc/nordic/common/uicr/gen_uicr.py +++ b/soc/nordic/common/uicr/gen_uicr.py @@ -439,6 +439,12 @@ def main() -> None: type=lambda s: int(s, 0), help="Absolute flash address of the secondary firmware (decimal or 0x-prefixed hex)", ) + parser.add_argument( + "--secondary-processor", + default=0xBD2328A8, + type=lambda s: int(s, 0), + help="Processor to boot for the secondary firmware ", + ) parser.add_argument( "--secondary-periphconf-address", default=None, @@ -562,6 +568,7 @@ def main() -> None: if args.secondary: uicr.SECONDARY.ENABLE = ENABLED_VALUE uicr.SECONDARY.ADDRESS = args.secondary_address + uicr.SECONDARY.PROCESSOR = args.secondary_processor # Handle secondary periphconf if provided if args.out_secondary_periphconf_hex: diff --git a/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt b/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt index 28c6e6749094..fe1b0e378cf7 100644 --- a/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt +++ b/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt @@ -154,6 +154,7 @@ if(CONFIG_GEN_UICR_SECONDARY) list(APPEND secondary_args --secondary-address ${SECONDARY_ADDRESS} + --secondary-processor ${CONFIG_GEN_UICR_SECONDARY_PROCESSOR_VALUE} ) if(CONFIG_GEN_UICR_SECONDARY_GENERATE_PERIPHCONF) diff --git a/soc/nordic/common/uicr/gen_uicr/Kconfig b/soc/nordic/common/uicr/gen_uicr/Kconfig index 17758597bc34..1c49209592fe 100644 --- a/soc/nordic/common/uicr/gen_uicr/Kconfig +++ b/soc/nordic/common/uicr/gen_uicr/Kconfig @@ -10,17 +10,6 @@ config GEN_UICR_GENERATE_PERIPHCONF When enabled, the UICR generator will populate the periphconf_partition partition. -config GEN_UICR_SECONDARY - bool "Enable UICR.SECONDARY.ENABLE" - -config GEN_UICR_SECONDARY_GENERATE_PERIPHCONF - bool "Generate SECONDARY.PERIPHCONF hex alongside UICR" - default y - depends on GEN_UICR_SECONDARY - help - When enabled, the UICR generator will populate the - secondary_periphconf_partition partition. - config GEN_UICR_SECURESTORAGE bool "Enable UICR.SECURESTORAGE" default y @@ -43,6 +32,43 @@ config GEN_UICR_SECURESTORAGE - At least one subpartition must be defined - Combined subpartition sizes must equal secure_storage_partition size +config GEN_UICR_SECONDARY + bool "Enable UICR.SECONDARY.ENABLE" + +if GEN_UICR_SECONDARY + +config GEN_UICR_SECONDARY_GENERATE_PERIPHCONF + bool "Generate SECONDARY.PERIPHCONF hex alongside UICR" + default y + help + When enabled, the UICR generator will populate the + secondary_periphconf_partition partition. + +choice GEN_UICR_SECONDARY_PROCESSOR + prompt "Secondary processor selection" + default GEN_UICR_SECONDARY_PROCESSOR_APPLICATION + help + Processor to boot for the secondary firmware. + +config GEN_UICR_SECONDARY_PROCESSOR_APPLICATION + bool "APPLICATION processor" + help + Boot secondary firmware on the APPLICATION processor. + +config GEN_UICR_SECONDARY_PROCESSOR_RADIOCORE + bool "RADIOCORE processor" + help + Boot secondary firmware on the RADIOCORE processor. + +endchoice + +config GEN_UICR_SECONDARY_PROCESSOR_VALUE + hex + default 0xBD2328A8 if GEN_UICR_SECONDARY_PROCESSOR_APPLICATION + default 0x1730C77F if GEN_UICR_SECONDARY_PROCESSOR_RADIOCORE + +endif # GEN_UICR_SECONDARY + endmenu source "Kconfig.zephyr" From 1199dcf6a6567bbd82fe43dca23a91b872424ffd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B8e?= Date: Tue, 9 Sep 2025 13:46:07 +0200 Subject: [PATCH 1842/2141] [nrf fromtree] soc: nordic: uicr: Add support for uicr.PROTECTEDMEM MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add support for PROTECTEDMEM. Signed-off-by: Sebastian Bøe (cherry picked from commit 7c9275c8914ab105d8d96ea4096bef4c4ef7d10e) --- scripts/ci/check_compliance.py | 2 ++ soc/nordic/common/uicr/gen_uicr.py | 22 +++++++++++++++++++ .../common/uicr/gen_uicr/CMakeLists.txt | 8 +++++++ soc/nordic/common/uicr/gen_uicr/Kconfig | 14 ++++++++++++ 4 files changed, 46 insertions(+) diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index 7a27e6dca3df..7102a12049a8 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -1301,6 +1301,8 @@ def check_no_undef_outside_kconfig(self, kconf): "FOO_SETTING_1", "FOO_SETTING_2", "GEN_UICR_GENERATE_PERIPHCONF", # Used in specialized build tool, not part of main Kconfig + "GEN_UICR_PROTECTEDMEM", # Used in specialized build tool, not part of main Kconfig + "GEN_UICR_PROTECTEDMEM_SIZE_BYTES", # Used in specialized build tool, not part of main Kconfig "GEN_UICR_SECONDARY", # Used in specialized build tool, not part of main Kconfig "GEN_UICR_SECONDARY_GENERATE_PERIPHCONF", # Used in specialized build tool, not part of main Kconfig "GEN_UICR_SECONDARY_PROCESSOR_VALUE", # Used in specialized build tool, not part of main Kconfig diff --git a/soc/nordic/common/uicr/gen_uicr.py b/soc/nordic/common/uicr/gen_uicr.py index e074314a1abb..bea0ba2a2dfa 100644 --- a/soc/nordic/common/uicr/gen_uicr.py +++ b/soc/nordic/common/uicr/gen_uicr.py @@ -26,6 +26,8 @@ ENABLED_VALUE = 0xFFFF_FFFF DISABLED_VALUE = 0xBD23_28A8 +KB_4 = 4096 + class ScriptError(RuntimeError): ... @@ -428,6 +430,16 @@ def main() -> None: type=lambda s: int(s, 0), help="Size in bytes of cpurad_its_partition (decimal or 0x-prefixed hex)", ) + parser.add_argument( + "--protectedmem", + action="store_true", + help="Enable protected memory region in UICR", + ) + parser.add_argument( + "--protectedmem-size-bytes", + type=int, + help="Protected memory size in bytes (must be divisible by 4096)", + ) parser.add_argument( "--secondary", action="store_true", @@ -535,6 +547,16 @@ def main() -> None: uicr.SECURESTORAGE.ITS.APPLICATIONSIZE1KB = args.cpuapp_its_size // 1024 uicr.SECURESTORAGE.ITS.RADIOCORESIZE1KB = args.cpurad_its_size // 1024 + # Handle protected memory configuration + if args.protectedmem: + if args.protectedmem_size_bytes % KB_4 != 0: + raise ScriptError( + f"Protected memory size ({args.protectedmem_size_bytes} bytes) " + f"must be divisible by {KB_4}" + ) + uicr.PROTECTEDMEM.ENABLE = ENABLED_VALUE + uicr.PROTECTEDMEM.SIZE4KB = args.protectedmem_size_bytes // KB_4 + # Process periphconf data first and configure UICR completely before creating hex objects periphconf_hex = IntelHex() secondary_periphconf_hex = IntelHex() diff --git a/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt b/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt index fe1b0e378cf7..9e37639a82cb 100644 --- a/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt +++ b/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt @@ -67,6 +67,7 @@ endfunction() if(CMAKE_VERBOSE_MAKEFILE) endif() +set(protectedmem_args) set(periphconf_args) set(periphconf_elfs) set(merged_hex_file ${APPLICATION_BINARY_DIR}/zephyr/${CONFIG_KERNEL_BIN_NAME}.hex) @@ -105,6 +106,12 @@ if(CONFIG_GEN_UICR_SECURESTORAGE) list(APPEND securestorage_args --cpurad-its-size ${CPURAD_ITS_SIZE}) endif(CONFIG_GEN_UICR_SECURESTORAGE) +# Handle protected memory configuration +if(CONFIG_GEN_UICR_PROTECTEDMEM) + list(APPEND protectedmem_args --protectedmem) + list(APPEND protectedmem_args --protectedmem-size-bytes ${CONFIG_GEN_UICR_PROTECTEDMEM_SIZE_BYTES}) +endif() + if(CONFIG_GEN_UICR_GENERATE_PERIPHCONF) # gen_uicr.py parses all zephyr.elf files. To find these files (which # have not been built yet) we scan sibling build directories for @@ -181,6 +188,7 @@ add_custom_command( --out-uicr-hex ${uicr_hex_file} ${periphconf_args} ${securestorage_args} + ${protectedmem_args} ${secondary_args} DEPENDS ${periphconf_elfs} ${secondary_periphconf_elfs} WORKING_DIRECTORY ${APPLICATION_BINARY_DIR} diff --git a/soc/nordic/common/uicr/gen_uicr/Kconfig b/soc/nordic/common/uicr/gen_uicr/Kconfig index 1c49209592fe..fe7413a9d0da 100644 --- a/soc/nordic/common/uicr/gen_uicr/Kconfig +++ b/soc/nordic/common/uicr/gen_uicr/Kconfig @@ -32,6 +32,20 @@ config GEN_UICR_SECURESTORAGE - At least one subpartition must be defined - Combined subpartition sizes must equal secure_storage_partition size +config GEN_UICR_PROTECTEDMEM + bool "Enable UICR.PROTECTEDMEM" + help + When enabled, the UICR generator will configure the + protected memory region. + +config GEN_UICR_PROTECTEDMEM_SIZE_BYTES + int "Protected memory size in bytes" + default 4096 + depends on GEN_UICR_PROTECTEDMEM + help + Size of the protected memory region in bytes. + This value must be divisible by 4096 (4 kiB). + config GEN_UICR_SECONDARY bool "Enable UICR.SECONDARY.ENABLE" From c62a6c7f29ce32a986a6abea0300fdf5c960bf30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B8e?= Date: Fri, 10 Oct 2025 16:35:28 +0200 Subject: [PATCH 1843/2141] [nrf fromlist] soc: nordic: uicr: Change how secondary images are detected MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Detect secondary images by checking a Kconfig value instead of a marker file. Upstream PR #: 97356 Signed-off-by: Sebastian Bøe --- soc/nordic/common/uicr/Kconfig | 7 +++++++ soc/nordic/common/uicr/gen_uicr/CMakeLists.txt | 13 +++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/soc/nordic/common/uicr/Kconfig b/soc/nordic/common/uicr/Kconfig index 73b5e5cf2d1c..37bdd014b7d6 100644 --- a/soc/nordic/common/uicr/Kconfig +++ b/soc/nordic/common/uicr/Kconfig @@ -18,3 +18,10 @@ config NRF_PERIPHCONF_GENERATE_ENTRIES help Generate a C file containing PERIPHCONF entries based on the device configuration in the devicetree. + +config IS_IRONSIDE_SE_SECONDARY_IMAGE + bool "Ironside SE secondary image indicator (informative only, do not change)" + help + This Kconfig is set by sysbuild to indicate that this image is a + secondary firmware for Ironside SE. This is used by the UICR generation + system to determine which PERIPHCONF partition to use. diff --git a/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt b/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt index 9e37639a82cb..b64b7c0399ac 100644 --- a/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt +++ b/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt @@ -23,11 +23,19 @@ project(uicr) function(parse_kconfig_value config_file config_name output_var) file(STRINGS ${config_file} config_lines ENCODING "UTF-8") foreach(line ${config_lines}) + # Match quoted strings like CONFIG_FOO="value" if("${line}" MATCHES "^${config_name}=\"(.*)\"$") set(${output_var} "${CMAKE_MATCH_1}" PARENT_SCOPE) return() endif() + # Match unquoted values like CONFIG_FOO=y or CONFIG_FOO=n + if("${line}" MATCHES "^${config_name}=(.*)$") + set(${output_var} "${CMAKE_MATCH_1}" PARENT_SCOPE) + return() + endif() endforeach() + # If not found, return empty (including "# CONFIG_FOO is not set" case) + set(${output_var} "" PARENT_SCOPE) endfunction() # Function to compute partition absolute address and size from devicetree @@ -131,8 +139,9 @@ if(CONFIG_GEN_UICR_GENERATE_PERIPHCONF) parse_kconfig_value(${_dir}/zephyr/.config CONFIG_KERNEL_BIN_NAME kernel_bin_name) set(kernel_elf_path ${_dir}/zephyr/${kernel_bin_name}.elf) - # Check if this is secondary firmware by looking for the marker file - if(EXISTS ${_dir}/is_secondary_firmware.txt) + # Check if this is secondary firmware by reading the Kconfig from .config + parse_kconfig_value(${_dir}/zephyr/.config CONFIG_IS_IRONSIDE_SE_SECONDARY_IMAGE is_secondary) + if(is_secondary STREQUAL "y") list(APPEND secondary_periphconf_elfs ${kernel_elf_path}) else() list(APPEND periphconf_elfs ${kernel_elf_path}) From ccefb2a9e3a6bc5541d56eb34b822df184c8cb60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B8e?= Date: Mon, 13 Oct 2025 10:41:24 +0200 Subject: [PATCH 1844/2141] [nrf fromlist] soc: nordic: uicr: Add support for UICR.WDTSTART MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add support for UICR.WDTSTART. UICR.WDTSTART configures the automatic start of a local watchdog timer before the application core is booted. This provides early system protection ensuring that the system can recover from early boot failures. Upstream PR #: 97337 Signed-off-by: Sebastian Bøe --- scripts/ci/check_compliance.py | 18 ++-- soc/nordic/common/uicr/gen_uicr.py | 42 +++++++++ .../common/uicr/gen_uicr/CMakeLists.txt | 16 ++++ soc/nordic/common/uicr/gen_uicr/Kconfig | 85 +++++++++++++++++++ 4 files changed, 155 insertions(+), 6 deletions(-) diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index 7102a12049a8..f5ca11da1901 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -1301,12 +1301,18 @@ def check_no_undef_outside_kconfig(self, kconf): "FOO_SETTING_1", "FOO_SETTING_2", "GEN_UICR_GENERATE_PERIPHCONF", # Used in specialized build tool, not part of main Kconfig - "GEN_UICR_PROTECTEDMEM", # Used in specialized build tool, not part of main Kconfig - "GEN_UICR_PROTECTEDMEM_SIZE_BYTES", # Used in specialized build tool, not part of main Kconfig - "GEN_UICR_SECONDARY", # Used in specialized build tool, not part of main Kconfig - "GEN_UICR_SECONDARY_GENERATE_PERIPHCONF", # Used in specialized build tool, not part of main Kconfig - "GEN_UICR_SECONDARY_PROCESSOR_VALUE", # Used in specialized build tool, not part of main Kconfig - "GEN_UICR_SECURESTORAGE", # Used in specialized build tool, not part of main Kconfig + "GEN_UICR_PROTECTEDMEM", + "GEN_UICR_PROTECTEDMEM_SIZE_BYTES", + "GEN_UICR_SECONDARY", + "GEN_UICR_SECONDARY_GENERATE_PERIPHCONF", + "GEN_UICR_SECONDARY_PROCESSOR_VALUE", + "GEN_UICR_SECONDARY_WDTSTART", + "GEN_UICR_SECONDARY_WDTSTART_CRV", + "GEN_UICR_SECONDARY_WDTSTART_INSTANCE_CODE", + "GEN_UICR_SECURESTORAGE", + "GEN_UICR_WDTSTART", + "GEN_UICR_WDTSTART_CRV", + "GEN_UICR_WDTSTART_INSTANCE_CODE", # Used in specialized build tool, not part of main Kconfig "HEAP_MEM_POOL_ADD_SIZE_", # Used as an option matching prefix "HUGETLBFS", # Linux, in boards/xtensa/intel_adsp_cavs25/doc "IAR_BUFFERED_WRITE", diff --git a/soc/nordic/common/uicr/gen_uicr.py b/soc/nordic/common/uicr/gen_uicr.py index bea0ba2a2dfa..da2938bf05c9 100644 --- a/soc/nordic/common/uicr/gen_uicr.py +++ b/soc/nordic/common/uicr/gen_uicr.py @@ -440,6 +440,36 @@ def main() -> None: type=int, help="Protected memory size in bytes (must be divisible by 4096)", ) + parser.add_argument( + "--wdtstart", + action="store_true", + help="Enable watchdog timer start in UICR", + ) + parser.add_argument( + "--wdtstart-instance-code", + type=lambda s: int(s, 0), + help="Watchdog timer instance code (0xBD2328A8 for WDT0, 0x1730C77F for WDT1)", + ) + parser.add_argument( + "--wdtstart-crv", + type=int, + help="Initial Counter Reload Value (CRV) for watchdog timer (minimum: 0xF)", + ) + parser.add_argument( + "--secondary-wdtstart", + action="store_true", + help="Enable watchdog timer start in UICR.SECONDARY", + ) + parser.add_argument( + "--secondary-wdtstart-instance-code", + type=lambda s: int(s, 0), + help="Secondary watchdog timer instance code (0xBD2328A8 for WDT0, 0x1730C77F for WDT1)", + ) + parser.add_argument( + "--secondary-wdtstart-crv", + type=int, + help="Secondary initial Counter Reload Value (CRV) for watchdog timer (minimum: 0xF)", + ) parser.add_argument( "--secondary", action="store_true", @@ -557,6 +587,12 @@ def main() -> None: uicr.PROTECTEDMEM.ENABLE = ENABLED_VALUE uicr.PROTECTEDMEM.SIZE4KB = args.protectedmem_size_bytes // KB_4 + # Handle WDTSTART configuration + if args.wdtstart: + uicr.WDTSTART.ENABLE = ENABLED_VALUE + uicr.WDTSTART.CRV = args.wdtstart_crv + uicr.WDTSTART.INSTANCE = args.wdtstart_instance_code + # Process periphconf data first and configure UICR completely before creating hex objects periphconf_hex = IntelHex() secondary_periphconf_hex = IntelHex() @@ -625,6 +661,12 @@ def main() -> None: uicr.SECONDARY.PERIPHCONF.MAXCOUNT = args.secondary_periphconf_size // 8 + # Handle secondary WDTSTART configuration + if args.secondary_wdtstart: + uicr.SECONDARY.WDTSTART.ENABLE = ENABLED_VALUE + uicr.SECONDARY.WDTSTART.CRV = args.secondary_wdtstart_crv + uicr.SECONDARY.WDTSTART.INSTANCE = args.secondary_wdtstart_instance_code + # Create UICR hex object with final UICR data uicr_hex = IntelHex() uicr_hex.frombytes(bytes(uicr), offset=args.uicr_address) diff --git a/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt b/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt index b64b7c0399ac..39737888023a 100644 --- a/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt +++ b/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt @@ -77,6 +77,7 @@ endif() set(protectedmem_args) set(periphconf_args) +set(wdtstart_args) set(periphconf_elfs) set(merged_hex_file ${APPLICATION_BINARY_DIR}/zephyr/${CONFIG_KERNEL_BIN_NAME}.hex) set(secondary_periphconf_elfs) @@ -120,6 +121,13 @@ if(CONFIG_GEN_UICR_PROTECTEDMEM) list(APPEND protectedmem_args --protectedmem-size-bytes ${CONFIG_GEN_UICR_PROTECTEDMEM_SIZE_BYTES}) endif() +# Handle WDTSTART configuration +if(CONFIG_GEN_UICR_WDTSTART) + list(APPEND wdtstart_args --wdtstart) + list(APPEND wdtstart_args --wdtstart-instance-code ${CONFIG_GEN_UICR_WDTSTART_INSTANCE_CODE}) + list(APPEND wdtstart_args --wdtstart-crv ${CONFIG_GEN_UICR_WDTSTART_CRV}) +endif() + if(CONFIG_GEN_UICR_GENERATE_PERIPHCONF) # gen_uicr.py parses all zephyr.elf files. To find these files (which # have not been built yet) we scan sibling build directories for @@ -173,6 +181,13 @@ if(CONFIG_GEN_UICR_SECONDARY) --secondary-processor ${CONFIG_GEN_UICR_SECONDARY_PROCESSOR_VALUE} ) + # Handle secondary WDTSTART configuration + if(CONFIG_GEN_UICR_SECONDARY_WDTSTART) + list(APPEND secondary_args --secondary-wdtstart) + list(APPEND secondary_args --secondary-wdtstart-instance-code ${CONFIG_GEN_UICR_SECONDARY_WDTSTART_INSTANCE_CODE}) + list(APPEND secondary_args --secondary-wdtstart-crv ${CONFIG_GEN_UICR_SECONDARY_WDTSTART_CRV}) + endif() + if(CONFIG_GEN_UICR_SECONDARY_GENERATE_PERIPHCONF) # Compute SECONDARY_PERIPHCONF absolute address and size from this image's devicetree compute_partition_address_and_size("secondary_periphconf_partition" SECONDARY_PERIPHCONF_ADDRESS SECONDARY_PERIPHCONF_SIZE) @@ -195,6 +210,7 @@ add_custom_command( --uicr-address ${UICR_ADDRESS} --out-merged-hex ${merged_hex_file} --out-uicr-hex ${uicr_hex_file} + ${wdtstart_args} ${periphconf_args} ${securestorage_args} ${protectedmem_args} diff --git a/soc/nordic/common/uicr/gen_uicr/Kconfig b/soc/nordic/common/uicr/gen_uicr/Kconfig index fe7413a9d0da..9b630139e641 100644 --- a/soc/nordic/common/uicr/gen_uicr/Kconfig +++ b/soc/nordic/common/uicr/gen_uicr/Kconfig @@ -46,6 +46,91 @@ config GEN_UICR_PROTECTEDMEM_SIZE_BYTES Size of the protected memory region in bytes. This value must be divisible by 4096 (4 kiB). +config GEN_UICR_WDTSTART + bool "Enable UICR.WDTSTART" + help + When enabled, the UICR generator will configure the + watchdog timer to start automatically before the + application core is booted. + +choice GEN_UICR_WDTSTART_INSTANCE + prompt "Watchdog timer instance" + depends on GEN_UICR_WDTSTART + help + Select which watchdog timer instance to use. + +config GEN_UICR_WDTSTART_INSTANCE_WDT0 + bool "WDT0" + help + Use watchdog timer instance 0. + +config GEN_UICR_WDTSTART_INSTANCE_WDT1 + bool "WDT1" + help + Use watchdog timer instance 1. + +endchoice + +config GEN_UICR_WDTSTART_INSTANCE_CODE + hex + default 0xBD2328A8 if GEN_UICR_WDTSTART_INSTANCE_WDT0 + default 0x1730C77F if GEN_UICR_WDTSTART_INSTANCE_WDT1 + depends on GEN_UICR_WDTSTART + +config GEN_UICR_WDTSTART_CRV + int "Initial Counter Reload Value (CRV)" + default 65535 + range 15 4294967295 + depends on GEN_UICR_WDTSTART + help + Initial Counter Reload Value (CRV) for the watchdog timer. + This value determines the watchdog timeout period. + Must be at least 15 (0xF) to ensure proper watchdog operation. + Default value 65535 creates a 2-second timeout. + +config GEN_UICR_SECONDARY_WDTSTART + bool "Enable UICR.SECONDARY.WDTSTART" + depends on GEN_UICR_SECONDARY + help + When enabled, the UICR generator will configure the + watchdog timer to start automatically before the + secondary firmware is booted. + +choice GEN_UICR_SECONDARY_WDTSTART_INSTANCE + prompt "Secondary watchdog timer instance" + depends on GEN_UICR_SECONDARY_WDTSTART + help + Select which watchdog timer instance to use for secondary firmware. + +config GEN_UICR_SECONDARY_WDTSTART_INSTANCE_WDT0 + bool "WDT0" + help + Use watchdog timer instance 0 for secondary firmware. + +config GEN_UICR_SECONDARY_WDTSTART_INSTANCE_WDT1 + bool "WDT1" + help + Use watchdog timer instance 1 for secondary firmware. + +endchoice + +config GEN_UICR_SECONDARY_WDTSTART_INSTANCE_CODE + hex + default 0xBD2328A8 if GEN_UICR_SECONDARY_WDTSTART_INSTANCE_WDT0 + default 0x1730C77F if GEN_UICR_SECONDARY_WDTSTART_INSTANCE_WDT1 + depends on GEN_UICR_SECONDARY_WDTSTART + +config GEN_UICR_SECONDARY_WDTSTART_CRV + int "Secondary initial Counter Reload Value (CRV)" + default 65535 + range 15 4294967295 + depends on GEN_UICR_SECONDARY_WDTSTART + help + Initial Counter Reload Value (CRV) for the secondary watchdog timer. + This value determines the watchdog timeout period. + Must be at least 15 (0xF) to ensure proper watchdog operation. + Default value 65535 creates a 2-second timeout. + config GEN_UICR_SECONDARY bool "Enable UICR.SECONDARY.ENABLE" From 37b9a01aa8037dc373465760ee3c64cba2179318 Mon Sep 17 00:00:00 2001 From: Kari Hamalainen Date: Mon, 13 Oct 2025 14:30:13 +0300 Subject: [PATCH 1845/2141] [nrf noup] ci: add default permissions Scanners report these as missing so lets add them. Signed-off-by: Kari Hamalainen --- .github/workflows/commit-tags.yml | 5 ++++- .github/workflows/manifest-PR.yml | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/commit-tags.yml b/.github/workflows/commit-tags.yml index 828f02971678..61fc3a6c5bd3 100644 --- a/.github/workflows/commit-tags.yml +++ b/.github/workflows/commit-tags.yml @@ -6,6 +6,9 @@ on: milestoned, demilestoned, assigned, unassigned, ready_for_review, review_requested] +permissions: + contents: read + jobs: commit_tags: runs-on: ubuntu-22.04 @@ -16,7 +19,7 @@ jobs: echo "$HOME/.local/bin" >> $GITHUB_PATH - name: Checkout the code - uses: actions/checkout@v3 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: ref: ${{ github.event.pull_request.head.sha }} fetch-depth: 0 diff --git a/.github/workflows/manifest-PR.yml b/.github/workflows/manifest-PR.yml index 473301146527..0f3bd738a36c 100644 --- a/.github/workflows/manifest-PR.yml +++ b/.github/workflows/manifest-PR.yml @@ -5,6 +5,8 @@ on: branches: - main +permissions: + contents: read jobs: call-manifest-pr-action: From d2334ac6880c36154e99c1bcf35b00e5f8e17bca Mon Sep 17 00:00:00 2001 From: Piotr Krzyzanowski Date: Mon, 6 Oct 2025 17:28:04 +0200 Subject: [PATCH 1846/2141] [nrf fromlist] tests: drivers: gpio: add nrf54h20dk_nrf54h20_cpuppr Enable GPIO tests on nRF54H20 CPUPPR. Upstream PR #: 97073 Signed-off-by: Piotr Krzyzanowski --- .../boards/nrf54h20dk_nrf54h20_cpuppr.overlay | 23 +++++++++++++ .../boards/nrf54h20dk_nrf54h20_cpuppr.overlay | 23 +++++++++++++ .../boards/nrf54h20dk_nrf54h20_cpuppr.overlay | 34 +++++++++++++++++++ tests/drivers/gpio/gpio_hogs/testcase.yaml | 1 + .../boards/nrf54h20dk_nrf54h20_cpuppr.overlay | 23 +++++++++++++ 5 files changed, 104 insertions(+) create mode 100644 samples/basic/blinky/boards/nrf54h20dk_nrf54h20_cpuppr.overlay create mode 100644 tests/drivers/gpio/gpio_get_direction/boards/nrf54h20dk_nrf54h20_cpuppr.overlay create mode 100644 tests/drivers/gpio/gpio_hogs/boards/nrf54h20dk_nrf54h20_cpuppr.overlay create mode 100644 tests/drivers/gpio/gpio_nrf/boards/nrf54h20dk_nrf54h20_cpuppr.overlay diff --git a/samples/basic/blinky/boards/nrf54h20dk_nrf54h20_cpuppr.overlay b/samples/basic/blinky/boards/nrf54h20dk_nrf54h20_cpuppr.overlay new file mode 100644 index 000000000000..cbc7b679be00 --- /dev/null +++ b/samples/basic/blinky/boards/nrf54h20dk_nrf54h20_cpuppr.overlay @@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +/ { + aliases { + led0 = &led0; + }; + + leds { + compatible = "gpio-leds"; + led0: led_0 { + gpios = <&gpio9 0 GPIO_ACTIVE_HIGH>; + label = "Green LED 0"; + }; + }; +}; + +&gpiote130 { + status = "okay"; +}; + +&gpio9 { + status = "okay"; +}; diff --git a/tests/drivers/gpio/gpio_get_direction/boards/nrf54h20dk_nrf54h20_cpuppr.overlay b/tests/drivers/gpio/gpio_get_direction/boards/nrf54h20dk_nrf54h20_cpuppr.overlay new file mode 100644 index 000000000000..cbc7b679be00 --- /dev/null +++ b/tests/drivers/gpio/gpio_get_direction/boards/nrf54h20dk_nrf54h20_cpuppr.overlay @@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +/ { + aliases { + led0 = &led0; + }; + + leds { + compatible = "gpio-leds"; + led0: led_0 { + gpios = <&gpio9 0 GPIO_ACTIVE_HIGH>; + label = "Green LED 0"; + }; + }; +}; + +&gpiote130 { + status = "okay"; +}; + +&gpio9 { + status = "okay"; +}; diff --git a/tests/drivers/gpio/gpio_hogs/boards/nrf54h20dk_nrf54h20_cpuppr.overlay b/tests/drivers/gpio/gpio_hogs/boards/nrf54h20dk_nrf54h20_cpuppr.overlay new file mode 100644 index 000000000000..3d0a4ccf5a6d --- /dev/null +++ b/tests/drivers/gpio/gpio_hogs/boards/nrf54h20dk_nrf54h20_cpuppr.overlay @@ -0,0 +1,34 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +/ { + zephyr,user { + output-high-gpios = <&gpio0 3 GPIO_ACTIVE_LOW>; + output-low-gpios = <&gpio0 4 GPIO_ACTIVE_HIGH>; + input-gpios = <&gpio0 1 GPIO_ACTIVE_LOW>; + }; +}; + +&gpio0 { + status = "okay"; + hog1 { + gpio-hog; + gpios = <3 GPIO_ACTIVE_LOW>; + output-high; + }; + + hog2 { + gpio-hog; + gpios = <4 GPIO_ACTIVE_HIGH>; + output-low; + }; + + hog3 { + gpio-hog; + gpios = <1 GPIO_ACTIVE_LOW>; + input; + }; +}; + +&gpiote130 { + status = "okay"; +}; diff --git a/tests/drivers/gpio/gpio_hogs/testcase.yaml b/tests/drivers/gpio/gpio_hogs/testcase.yaml index 3de068163b85..43b01894f5fb 100644 --- a/tests/drivers/gpio/gpio_hogs/testcase.yaml +++ b/tests/drivers/gpio/gpio_hogs/testcase.yaml @@ -11,6 +11,7 @@ tests: - nrf52840dk/nrf52840 - nrf54l15dk/nrf54l15/cpuapp - nrf54h20dk/nrf54h20/cpuapp + - nrf54h20dk/nrf54h20/cpuppr - nucleo_g474re - nrf52_bsim - nrf5340bsim/nrf5340/cpuapp diff --git a/tests/drivers/gpio/gpio_nrf/boards/nrf54h20dk_nrf54h20_cpuppr.overlay b/tests/drivers/gpio/gpio_nrf/boards/nrf54h20dk_nrf54h20_cpuppr.overlay new file mode 100644 index 000000000000..cbc7b679be00 --- /dev/null +++ b/tests/drivers/gpio/gpio_nrf/boards/nrf54h20dk_nrf54h20_cpuppr.overlay @@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +/ { + aliases { + led0 = &led0; + }; + + leds { + compatible = "gpio-leds"; + led0: led_0 { + gpios = <&gpio9 0 GPIO_ACTIVE_HIGH>; + label = "Green LED 0"; + }; + }; +}; + +&gpiote130 { + status = "okay"; +}; + +&gpio9 { + status = "okay"; +}; From 7ffaebd820361399cdc2134a34e20c404a10cd09 Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Mon, 6 Oct 2025 17:14:14 +0200 Subject: [PATCH 1847/2141] [nrf fromtree] boards/nordic/nrf54h20dk: Add button/LED aliases Added aliases so that nrf54h20dk/nrf54h20/cpuapp can use MCUboot serial recovery. Signed-off-by: Andrzej Puzdrowski (cherry picked from commit 230b74dd9875be15260923184457e2f2103ae668) --- boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index 9bf42dab7d5d..d45f91c908bf 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -43,6 +43,8 @@ sw3 = &button3; ipc-to-cpusys = &cpuapp_cpusys_ipc; watchdog0 = &wdt010; + mcuboot-button0 = &button0; + mcuboot-led0 = &led0; }; buttons { From 1801e0bf52f9ba75868e09ef154c13047f606832 Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Tue, 7 Oct 2025 15:59:58 +0200 Subject: [PATCH 1848/2141] [nrf fromtree] samples/boards/nordic: align nrf54h20dk overlay /delete-property/ for newly added aliases which points to nodes already removed in that overlay. Upstream PR #: 97062 Signed-off-by: Andrzej Puzdrowski (cherry picked from commit 56843f8eb0e702b8274d1d89a50c68a33232487e) --- .../spis_wakeup/boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 2 ++ 1 file changed, 2 insertions(+) diff --git a/samples/boards/nordic/spis_wakeup/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/samples/boards/nordic/spis_wakeup/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index ae3c8b6c81fc..8023020f2caa 100644 --- a/samples/boards/nordic/spis_wakeup/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/samples/boards/nordic/spis_wakeup/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -12,6 +12,8 @@ /delete-property/ sw1; /delete-property/ sw2; /delete-property/ sw3; + /delete-property/ mcuboot-led0; + /delete-property/ mcuboot-button0; }; /delete-node/ buttons; }; From 051de590d62ac7125b08f15e666579b747a46fbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20Amundsen?= Date: Fri, 3 Oct 2025 13:08:43 +0200 Subject: [PATCH 1849/2141] [nrf fromtree] soc: ironside: add min and max values for update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The update will fail if the address is outside of this range. This failure might trigger a bad state where the device is non-trivial to recover. Signed-off-by: Håkon Amundsen (cherry picked from commit 9d5f94f90b05451986f7c37243ae0579e991d734) --- .../nordic/nrf_ironside/update/src/main.c | 3 +++ .../ironside/include/nrf_ironside/update.h | 18 ++++++++++++++++++ soc/nordic/ironside/update.c | 5 +++++ 3 files changed, 26 insertions(+) diff --git a/samples/boards/nordic/nrf_ironside/update/src/main.c b/samples/boards/nordic/nrf_ironside/update/src/main.c index 29d058ca139c..ee8823217de2 100644 --- a/samples/boards/nordic/nrf_ironside/update/src/main.c +++ b/samples/boards/nordic/nrf_ironside/update/src/main.c @@ -10,6 +10,9 @@ LOG_MODULE_REGISTER(app, LOG_LEVEL_INF); +BUILD_ASSERT(CONFIG_UPDATE_BLOB_ADDRESS >= IRONSIDE_UPDATE_MIN_ADDRESS); +BUILD_ASSERT(CONFIG_UPDATE_BLOB_ADDRESS <= IRONSIDE_UPDATE_MAX_ADDRESS); + int main(void) { int err; diff --git a/soc/nordic/ironside/include/nrf_ironside/update.h b/soc/nordic/ironside/include/nrf_ironside/update.h index b01b5df6dadb..6e520e4e680b 100644 --- a/soc/nordic/ironside/include/nrf_ironside/update.h +++ b/soc/nordic/ironside/include/nrf_ironside/update.h @@ -18,11 +18,27 @@ #define IRONSIDE_UPDATE_ERROR_NOT_PERMITTED (1) /** Failed to write the update metadata to SICR. */ #define IRONSIDE_UPDATE_ERROR_SICR_WRITE_FAILED (2) +/** Update candidate is placed outside of valid range */ +#define IRONSIDE_UPDATE_ERROR_INVALID_ADDRESS (3) /** * @} */ +/** Size of the update blob */ +#ifdef CONFIG_SOC_SERIES_NRF54HX +#define IRONSIDE_UPDATE_BLOB_SIZE (160 * 1024) +#elif CONFIG_SOC_SERIES_NRF92X +#define IRONSIDE_UPDATE_BLOB_SIZE (160 * 1024) +#else +#error "Missing update blob size" +#endif + +/** Min address used for storing the update candidate */ +#define IRONSIDE_UPDATE_MIN_ADDRESS (0x0e100000) +/** Max address used for storing the update candidate */ +#define IRONSIDE_UPDATE_MAX_ADDRESS (0x0e200000 - IRONSIDE_UPDATE_BLOB_SIZE) + /** Length of the update manifest in bytes */ #define IRONSIDE_UPDATE_MANIFEST_LENGTH (256) /** Length of the update public key in bytes. */ @@ -62,6 +78,8 @@ struct ironside_update_blob { * @param update Pointer to update blob * * @retval 0 on a successful request (although the update itself may still fail). + * @retval -IRONSIDE_UPDATE_ERROR_INVALID_ADDRESS if the address of the update is outside of the + * accepted range. * @retval -IRONSIDE_UPDATE_ERROR_NOT_PERMITTED if missing access to the update candidate. * @retval -IRONSIDE_UPDATE_ERROR_SICR_WRITE_FAILED if writing update parameters to SICR failed. * @retval Positive error status if reported by IronSide call (see error codes in @ref call.h). diff --git a/soc/nordic/ironside/update.c b/soc/nordic/ironside/update.c index a56407a3fa14..fabf6fb01049 100644 --- a/soc/nordic/ironside/update.c +++ b/soc/nordic/ironside/update.c @@ -11,6 +11,11 @@ int ironside_update(const struct ironside_update_blob *update) int err; struct ironside_call_buf *const buf = ironside_call_alloc(); + if ((uintptr_t)update < IRONSIDE_UPDATE_MIN_ADDRESS || + (uintptr_t)update > IRONSIDE_UPDATE_MAX_ADDRESS) { + return -IRONSIDE_UPDATE_ERROR_INVALID_ADDRESS; + } + buf->id = IRONSIDE_CALL_ID_UPDATE_SERVICE_V0; buf->args[IRONSIDE_UPDATE_SERVICE_UPDATE_PTR_IDX] = (uintptr_t)update; From 1001821646ecd2578522499d354b52a19877eace Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B8e?= Date: Wed, 10 Sep 2025 16:04:38 +0200 Subject: [PATCH 1850/2141] [nrf fromtree] boards: nrf54h20dk: Add secure storage partitions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update the default memory map to include a `secure_storage_partition`, which is divided into at most four subpartitions. These will be used to configure UICR.SECURESTORAGE, if enabled. Signed-off-by: Sebastian Bøe (cherry picked from commit d5003d996b266c988757a8a324551e297af5b776) --- .../nrf54h20dk_nrf54h20-memory_map.dtsi | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi index e14426c59fc8..eafaf69b3989 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi @@ -174,5 +174,34 @@ secondary_periphconf_partition: partition@1c0000 { reg = <0x1c0000 DT_SIZE_K(8)>; }; + + /* NB: A gap has been left here for future partitions */ + + /* 0x1fd000 was chosen for secure_storage_partition such that + * there is no more space after secure_storage_partition. + */ + secure_storage_partition: partition@1fd000 { + compatible = "fixed-subpartitions"; + reg = <0x1fd000 DT_SIZE_K(12)>; + ranges = <0x0 0x1fd000 0x3000>; + #address-cells = <1>; + #size-cells = <1>; + + cpuapp_crypto_partition: partition@0 { + reg = <0x0 DT_SIZE_K(4)>; + }; + + cpurad_crypto_partition: partition@1000 { + reg = <0x1000 DT_SIZE_K(4)>; + }; + + cpuapp_its_partition: partition@2000 { + reg = <0x2000 DT_SIZE_K(2)>; + }; + + cpurad_its_partition: partition@2800 { + reg = <0x2800 DT_SIZE_K(2)>; + }; + }; }; }; From db7849a4258e024f22d91b7978c455e9a0335894 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Mon, 15 Sep 2025 10:58:08 +0200 Subject: [PATCH 1851/2141] [nrf fromtree] drivers: pinctrl_nrf: Add support for SPIM CSN pin function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Certain SPIM instances in nRF52/53/54L/54H Series provide hardware control of the CSN (chip select) line. Although the standard SPI drivers do not use this feature, it should be possible to configure this line through pinctrl in case some special driver needs this. Signed-off-by: Andrzej Głąbek (cherry picked from commit ca79733388c87664f064e709b50d13afab907411) --- drivers/pinctrl/pinctrl_nrf.c | 14 +++++++++++--- include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h | 2 ++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/pinctrl/pinctrl_nrf.c b/drivers/pinctrl/pinctrl_nrf.c index 9ea48ee34c44..f32a38b79755 100644 --- a/drivers/pinctrl/pinctrl_nrf.c +++ b/drivers/pinctrl/pinctrl_nrf.c @@ -46,11 +46,11 @@ static const nrf_gpio_pin_drive_t drive_modes[NRF_DRIVE_COUNT] = { #define NRF_PSEL_UART(reg, line) ((NRF_UARTE_Type *)reg)->PSEL.line #endif -#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_spi) || defined(CONFIG_NRFX_SPI) -#define NRF_PSEL_SPIM(reg, line) ((NRF_SPI_Type *)reg)->PSEL##line -#elif DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_spim) || defined(CONFIG_NRFX_SPIM) +#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_spim) || defined(CONFIG_NRFX_SPIM) #include #define NRF_PSEL_SPIM(reg, line) ((NRF_SPIM_Type *)reg)->PSEL.line +#elif DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_spi) || defined(CONFIG_NRFX_SPI) +#define NRF_PSEL_SPIM(reg, line) ((NRF_SPI_Type *)reg)->PSEL##line #endif #if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_spis) || defined(CONFIG_NRFX_SPIS) @@ -277,6 +277,14 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, dir = NRF_GPIO_PIN_DIR_INPUT; input = NRF_GPIO_PIN_INPUT_CONNECT; break; +#if defined(NRF_SPIM_HAS_HW_CSN) && NRF_SPIM_HAS_HW_CSN + case NRF_FUN_SPIM_CSN: + NRF_PSEL_SPIM(reg, CSN) = psel; + write = 1U; + dir = NRF_GPIO_PIN_DIR_OUTPUT; + input = NRF_GPIO_PIN_INPUT_DISCONNECT; + break; +#endif #endif /* defined(NRF_PSEL_SPIM) */ #if defined(NRF_PSEL_SPIS) case NRF_FUN_SPIS_SCK: diff --git a/include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h b/include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h index 088cfce648bb..342620318f37 100644 --- a/include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h +++ b/include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h @@ -242,6 +242,8 @@ #define NRF_FUN_TDM_SDOUT 76U /** TDM MCK */ #define NRF_FUN_TDM_MCK 77U +/** SPI master CSN */ +#define NRF_FUN_SPIM_CSN 78U /** @} */ From e59ede43ce229c88a4a7a85c086652ba76112f2d Mon Sep 17 00:00:00 2001 From: Jonathan Nilsen Date: Thu, 2 Oct 2025 08:22:52 +0200 Subject: [PATCH 1852/2141] [nrf fromtree] soc: nordic: uicr: fix SPIM CSN CTRLSEL values Fix an incorrect interpretation of the chip select signal for the SPIM instances. If cs-gpios is used then the chip select pin is used as a GPIO, and should have CTRLSEL=0. Only when NRF_FUN_SPIM_CSN is used should CTRLSEL be configured to enable hardware control of the pin. Signed-off-by: Jonathan Nilsen (cherry picked from commit b28b570959c1c578f9079c5b0f10603554701992) --- .../common/uicr/gen_periphconf_entries.py | 27 +++++++++---------- soc/nordic/common/uicr/periphconf/builder.py | 1 + 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/soc/nordic/common/uicr/gen_periphconf_entries.py b/soc/nordic/common/uicr/gen_periphconf_entries.py index 92f5f1d24559..4308df31449f 100644 --- a/soc/nordic/common/uicr/gen_periphconf_entries.py +++ b/soc/nordic/common/uicr/gen_periphconf_entries.py @@ -25,7 +25,6 @@ from periphconf.builder import ( Ctrlsel, FixedPPIMap, - GpiosProp, Node, NrfCompChannel, NrfFun, @@ -178,7 +177,7 @@ def lookup_tables_get(soc: Soc) -> SocLookupTables: # SPIM mappings NrfPsel(fun=NrfFun.SPIM_MOSI, port=9, pin=5): Ctrlsel.SERIAL0, NrfPsel(fun=NrfFun.SPIM_MISO, port=9, pin=2): Ctrlsel.SERIAL0, - GpiosProp(name="cs-gpios", port=9, pin=3): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.SPIM_CSN, port=9, pin=3): Ctrlsel.SERIAL0, NrfPsel(fun=NrfFun.SPIM_SCK, port=9, pin=4): Ctrlsel.SERIAL0, # SPIS mappings NrfPsel(fun=NrfFun.SPIS_MISO, port=9, pin=5): Ctrlsel.SERIAL0, @@ -202,7 +201,7 @@ def lookup_tables_get(soc: Soc) -> SocLookupTables: # SPIM mappings NrfPsel(fun=NrfFun.SPIM_MOSI, port=9, pin=0): Ctrlsel.CAN_TDM_SERIAL2, NrfPsel(fun=NrfFun.SPIM_MISO, port=9, pin=2): Ctrlsel.CAN_TDM_SERIAL2, - GpiosProp(name="cs-gpios", port=9, pin=3): Ctrlsel.CAN_TDM_SERIAL2, + NrfPsel(fun=NrfFun.SPIM_CSN, port=9, pin=3): Ctrlsel.CAN_TDM_SERIAL2, NrfPsel(fun=NrfFun.SPIM_SCK, port=9, pin=1): Ctrlsel.CAN_TDM_SERIAL2, # SPIS mappings NrfPsel(fun=NrfFun.SPIS_MISO, port=9, pin=0): Ctrlsel.CAN_TDM_SERIAL2, @@ -284,17 +283,17 @@ def lookup_tables_get(soc: Soc) -> SocLookupTables: # SPIM P6 mappings NrfPsel(fun=NrfFun.SPIM_MOSI, port=6, pin=8): Ctrlsel.SERIAL0, NrfPsel(fun=NrfFun.SPIM_MISO, port=6, pin=7): Ctrlsel.SERIAL0, - GpiosProp(name="cs-gpios", port=6, pin=5): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.SPIM_CSN, port=6, pin=5): Ctrlsel.SERIAL0, NrfPsel(fun=NrfFun.SPIM_SCK, port=6, pin=1): Ctrlsel.SERIAL0, # SPIM P7 mappings NrfPsel(fun=NrfFun.SPIM_MOSI, port=7, pin=7): Ctrlsel.SERIAL0, NrfPsel(fun=NrfFun.SPIM_MISO, port=7, pin=6): Ctrlsel.SERIAL0, - GpiosProp(name="cs-gpios", port=7, pin=5): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.SPIM_CSN, port=7, pin=5): Ctrlsel.SERIAL0, NrfPsel(fun=NrfFun.SPIM_SCK, port=7, pin=3): Ctrlsel.SERIAL0, # SPIM P2 mappings NrfPsel(fun=NrfFun.SPIM_MOSI, port=2, pin=6): Ctrlsel.SERIAL0, NrfPsel(fun=NrfFun.SPIM_MISO, port=2, pin=5): Ctrlsel.SERIAL0, - GpiosProp(name="cs-gpios", port=2, pin=7): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.SPIM_CSN, port=2, pin=7): Ctrlsel.SERIAL0, NrfPsel(fun=NrfFun.SPIM_SCK, port=2, pin=3): Ctrlsel.SERIAL0, # UARTÈ P6 mappings NrfPsel(fun=NrfFun.UART_TX, port=6, pin=8): Ctrlsel.SERIAL0, @@ -317,21 +316,21 @@ def lookup_tables_get(soc: Soc) -> SocLookupTables: # SPIM P6 mappings NrfPsel(fun=NrfFun.SPIM_MOSI, port=6, pin=13): Ctrlsel.SERIAL0, NrfPsel(fun=NrfFun.SPIM_MISO, port=6, pin=12): Ctrlsel.SERIAL0, - GpiosProp(name="cs-gpios", port=6, pin=10): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.SPIM_CSN, port=6, pin=10): Ctrlsel.SERIAL0, NrfPsel(fun=NrfFun.SPIM_SCK, port=6, pin=2): Ctrlsel.SERIAL0, # SPIM P7 mappings NrfPsel(fun=NrfFun.SPIM_MOSI, port=7, pin=1): Ctrlsel.EXMIF_RADIO_SERIAL1, NrfPsel(fun=NrfFun.SPIS_MISO, port=7, pin=1): Ctrlsel.EXMIF_RADIO_SERIAL1, NrfPsel(fun=NrfFun.SPIM_MISO, port=7, pin=0): Ctrlsel.EXMIF_RADIO_SERIAL1, NrfPsel(fun=NrfFun.SPIS_MOSI, port=7, pin=0): Ctrlsel.EXMIF_RADIO_SERIAL1, - GpiosProp(name="cs-gpios", port=7, pin=4): Ctrlsel.EXMIF_RADIO_SERIAL1, + NrfPsel(fun=NrfFun.SPIM_CSN, port=7, pin=4): Ctrlsel.EXMIF_RADIO_SERIAL1, NrfPsel(fun=NrfFun.SPIS_CSN, port=7, pin=4): Ctrlsel.EXMIF_RADIO_SERIAL1, NrfPsel(fun=NrfFun.SPIM_SCK, port=7, pin=2): Ctrlsel.EXMIF_RADIO_SERIAL1, NrfPsel(fun=NrfFun.SPIS_SCK, port=7, pin=2): Ctrlsel.EXMIF_RADIO_SERIAL1, # SPIM P2 mappings NrfPsel(fun=NrfFun.SPIM_MOSI, port=2, pin=11): Ctrlsel.SERIAL0, NrfPsel(fun=NrfFun.SPIM_MISO, port=2, pin=10): Ctrlsel.SERIAL0, - GpiosProp(name="cs-gpios", port=2, pin=8): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.SPIM_CSN, port=2, pin=8): Ctrlsel.SERIAL0, NrfPsel(fun=NrfFun.SPIM_SCK, port=2, pin=2): Ctrlsel.SERIAL0, }, # EXMIF @@ -449,12 +448,12 @@ def lookup_tables_get(soc: Soc) -> SocLookupTables: # SPIM120/UARTE120 0x5F8E_6000: { # SPIM P2 mappings - GpiosProp(name="cs-gpios", port=2, pin=5): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.SPIM_CSN, port=2, pin=5): Ctrlsel.SERIAL0, NrfPsel(fun=NrfFun.SPIM_MISO, port=2, pin=3): Ctrlsel.SERIAL0, NrfPsel(fun=NrfFun.SPIM_MOSI, port=2, pin=4): Ctrlsel.SERIAL0, NrfPsel(fun=NrfFun.SPIM_SCK, port=2, pin=0): Ctrlsel.SERIAL0, # SPIM P6 mappings - GpiosProp(name="cs-gpios", port=6, pin=5): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.SPIM_CSN, port=6, pin=5): Ctrlsel.SERIAL0, NrfPsel(fun=NrfFun.SPIM_MISO, port=6, pin=7): Ctrlsel.SERIAL0, NrfPsel(fun=NrfFun.SPIM_MOSI, port=6, pin=8): Ctrlsel.SERIAL0, NrfPsel(fun=NrfFun.SPIM_SCK, port=6, pin=1): Ctrlsel.SERIAL0, @@ -472,12 +471,12 @@ def lookup_tables_get(soc: Soc) -> SocLookupTables: # SPIM121 0x5F8E_7000: { # P2 - GpiosProp(name="cs-gpios", port=2, pin=6): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.SPIM_CSN, port=2, pin=6): Ctrlsel.SERIAL0, NrfPsel(fun=NrfFun.SPIM_MISO, port=2, pin=8): Ctrlsel.SERIAL0, NrfPsel(fun=NrfFun.SPIM_MOSI, port=2, pin=9): Ctrlsel.SERIAL0, NrfPsel(fun=NrfFun.SPIM_SCK, port=2, pin=1): Ctrlsel.SERIAL0, # P6 - GpiosProp(name="cs-gpios", port=6, pin=10): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.SPIM_CSN, port=6, pin=10): Ctrlsel.SERIAL0, NrfPsel(fun=NrfFun.SPIM_MISO, port=6, pin=12): Ctrlsel.SERIAL0, NrfPsel(fun=NrfFun.SPIM_MOSI, port=6, pin=13): Ctrlsel.SERIAL0, NrfPsel(fun=NrfFun.SPIM_SCK, port=6, pin=2): Ctrlsel.SERIAL0, @@ -492,7 +491,7 @@ def lookup_tables_get(soc: Soc) -> SocLookupTables: # SPIM130/SPIS130/TWIM130/TWIS130/UARTE130 0x5F9A_5000: { # SPIM mappings - GpiosProp(name="cs-gpios", port=9, pin=1): Ctrlsel.SERIAL0, + NrfPsel(fun=NrfFun.SPIM_CSN, port=9, pin=1): Ctrlsel.SERIAL0, NrfPsel(fun=NrfFun.SPIM_MISO, port=9, pin=2): Ctrlsel.SERIAL0, NrfPsel(fun=NrfFun.SPIM_MOSI, port=9, pin=3): Ctrlsel.SERIAL0, NrfPsel(fun=NrfFun.SPIM_SCK, port=9, pin=0): Ctrlsel.SERIAL0, diff --git a/soc/nordic/common/uicr/periphconf/builder.py b/soc/nordic/common/uicr/periphconf/builder.py index 98c2bdfb0a0a..1a343dee44a0 100644 --- a/soc/nordic/common/uicr/periphconf/builder.py +++ b/soc/nordic/common/uicr/periphconf/builder.py @@ -1017,6 +1017,7 @@ class NrfFun(int, enum.Enum): TDM_SDIN = 75 TDM_SDOUT = 76 TDM_MCK = 77 + SPIM_CSN = 78 # Value used to ignore the function field and only check (port, pin) IGNORE = -1 From da901de1e8069791ee7d0535c2d16a0dfdb49690 Mon Sep 17 00:00:00 2001 From: Karsten Koenig Date: Wed, 8 Oct 2025 10:53:35 +0200 Subject: [PATCH 1853/2141] Revert "[nrf noup] drivers: pinctrl: Add SDP MSPI pin configuration" This reverts commit 915e81a911b3d03834ad11d124449c0f4fa4ccc1. Signed-off-by: Karsten Koenig --- drivers/pinctrl/pinctrl_nrf.c | 32 ----------- .../zephyr/dt-bindings/pinctrl/nrf-pinctrl.h | 56 ------------------- 2 files changed, 88 deletions(-) diff --git a/drivers/pinctrl/pinctrl_nrf.c b/drivers/pinctrl/pinctrl_nrf.c index f32a38b79755..4c916a263e7a 100644 --- a/drivers/pinctrl/pinctrl_nrf.c +++ b/drivers/pinctrl/pinctrl_nrf.c @@ -201,18 +201,6 @@ static void port_pin_clock_set(uint16_t pin_number, bool enable) #endif -#if DT_HAS_COMPAT_STATUS_OKAY(nordic_hpf_mspi_controller) || \ - defined(CONFIG_MSPI_HPF) || \ - DT_ANY_COMPAT_HAS_PROP_STATUS_OKAY(nordic_nrf_vpr_coprocessor, pinctrl_0) -#if defined(CONFIG_SOC_SERIES_NRF54LX) -#define NRF_PSEL_SDP_MSPI(psel) \ - nrf_gpio_pin_control_select(psel, NRF_GPIO_PIN_SEL_VPR); -#elif defined(CONFIG_SOC_SERIES_NRF54HX) -/* On nRF54H, pin routing is controlled by secure domain, via UICR. */ -#define NRF_PSEL_SDP_MSPI(psel) -#endif -#endif /* DT_HAS_COMPAT_STATUS_OKAY(nordic_hpf_mspi_controller) || ... */ - int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, uintptr_t reg) { @@ -570,26 +558,6 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, input = NRF_GPIO_PIN_INPUT_CONNECT; break; #endif /* defined(NRF_PSEL_TWIS) */ -#if defined(NRF_PSEL_SDP_MSPI) - case NRF_FUN_SDP_MSPI_CS0: - case NRF_FUN_SDP_MSPI_CS1: - case NRF_FUN_SDP_MSPI_CS2: - case NRF_FUN_SDP_MSPI_CS3: - case NRF_FUN_SDP_MSPI_CS4: - case NRF_FUN_SDP_MSPI_SCK: - case NRF_FUN_SDP_MSPI_DQ0: - case NRF_FUN_SDP_MSPI_DQ1: - case NRF_FUN_SDP_MSPI_DQ2: - case NRF_FUN_SDP_MSPI_DQ3: - case NRF_FUN_SDP_MSPI_DQ4: - case NRF_FUN_SDP_MSPI_DQ5: - case NRF_FUN_SDP_MSPI_DQ6: - case NRF_FUN_SDP_MSPI_DQ7: - NRF_PSEL_SDP_MSPI(psel); - dir = NRF_GPIO_PIN_DIR_OUTPUT; - input = NRF_GPIO_PIN_INPUT_CONNECT; - break; -#endif /* defined(NRF_PSEL_SDP_MSPI) */ default: return -ENOTSUP; } diff --git a/include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h b/include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h index 342620318f37..42b302193ed0 100644 --- a/include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h +++ b/include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h @@ -172,62 +172,6 @@ #define NRF_FUN_GRTC_CLKOUT_FAST 55U /** GRTC slow clock output */ #define NRF_FUN_GRTC_CLKOUT_32K 56U -/** SDP_MSPI clock pin */ -#define NRF_FUN_SDP_MSPI_SCK 57U -/** SDP_MSPI data pin 0 */ -#define NRF_FUN_SDP_MSPI_DQ0 58U -/** SDP_MSPI data pin 1 */ -#define NRF_FUN_SDP_MSPI_DQ1 59U -/** SDP_MSPI data pin 2 */ -#define NRF_FUN_SDP_MSPI_DQ2 60U -/** SDP_MSPI data pin 3 */ -#define NRF_FUN_SDP_MSPI_DQ3 61U -/** SDP_MSPI data pin 4 */ -#define NRF_FUN_SDP_MSPI_DQ4 62U -/** SDP_MSPI data pin 5 */ -#define NRF_FUN_SDP_MSPI_DQ5 63U -/** SDP_MSPI data pin 6 */ -#define NRF_FUN_SDP_MSPI_DQ6 64U -/** SDP_MSPI data pin 7 */ -#define NRF_FUN_SDP_MSPI_DQ7 65U -/** SDP_MSPI chip select 0 */ -#define NRF_FUN_SDP_MSPI_CS0 66U -/** SDP_MSPI chip select 1 */ -#define NRF_FUN_SDP_MSPI_CS1 67U -/** SDP_MSPI chip select 2 */ -#define NRF_FUN_SDP_MSPI_CS2 68U -/** SDP_MSPI chip select 3 */ -#define NRF_FUN_SDP_MSPI_CS3 69U -/** SDP_MSPI chip select 4 */ -#define NRF_FUN_SDP_MSPI_CS4 70U -/** High-Performance Framework MSPI clock pin */ -#define NRF_FUN_HPF_MSPI_SCK NRF_FUN_SDP_MSPI_SCK -/** High-Performance Framework MSPI data pin 0 */ -#define NRF_FUN_HPF_MSPI_DQ0 NRF_FUN_SDP_MSPI_DQ0 -/** High-Performance Framework MSPI data pin 1 */ -#define NRF_FUN_HPF_MSPI_DQ1 NRF_FUN_SDP_MSPI_DQ1 -/** High-Performance Framework MSPI data pin 2 */ -#define NRF_FUN_HPF_MSPI_DQ2 NRF_FUN_SDP_MSPI_DQ2 -/** High-Performance Framework MSPI data pin 3 */ -#define NRF_FUN_HPF_MSPI_DQ3 NRF_FUN_SDP_MSPI_DQ3 -/** High-Performance Framework MSPI data pin 4 */ -#define NRF_FUN_HPF_MSPI_DQ4 NRF_FUN_SDP_MSPI_DQ4 -/** High-Performance Framework MSPI data pin 5 */ -#define NRF_FUN_HPF_MSPI_DQ5 NRF_FUN_SDP_MSPI_DQ5 -/** High-Performance Framework MSPI data pin 6 */ -#define NRF_FUN_HPF_MSPI_DQ6 NRF_FUN_SDP_MSPI_DQ6 -/** High-Performance Framework MSPI data pin 7 */ -#define NRF_FUN_HPF_MSPI_DQ7 NRF_FUN_SDP_MSPI_DQ7 -/** High-Performance Framework MSPI chip select pin 0 */ -#define NRF_FUN_HPF_MSPI_CS0 NRF_FUN_SDP_MSPI_CS0 -/** High-Performance Framework MSPI chip select pin 1 */ -#define NRF_FUN_HPF_MSPI_CS1 NRF_FUN_SDP_MSPI_CS1 -/** High-Performance Framework MSPI chip select pin 2 */ -#define NRF_FUN_HPF_MSPI_CS2 NRF_FUN_SDP_MSPI_CS2 -/** High-Performance Framework MSPI chip select pin 3 */ -#define NRF_FUN_HPF_MSPI_CS3 NRF_FUN_SDP_MSPI_CS3 -/** High-Performance Framework MSPI chip select pin 4 */ -#define NRF_FUN_HPF_MSPI_CS4 NRF_FUN_SDP_MSPI_CS4 /** TDM SCK in master mode */ #define NRF_FUN_TDM_SCK_M 71U /** TDM SCK in slave mode */ From d63cce3d89cba6bc2bd812cc53a269eff59414b0 Mon Sep 17 00:00:00 2001 From: Karsten Koenig Date: Fri, 3 Oct 2025 13:51:17 +0200 Subject: [PATCH 1854/2141] [nrf fromtree] drivers: debug: Moved nrf_etr from misc Moved the nrf_etr driver from the drive/misc folder into the recently established driver/debug folder where it is a better fit. Moved the associated files such as bindings and headers accordingly as well. Signed-off-by: Karsten Koenig (cherry picked from commit d833556ee55b921a675dd239c3cc2330d3605669) --- doc/services/logging/cs_stm.rst | 4 +- drivers/debug/CMakeLists.txt | 1 + drivers/debug/Kconfig | 1 + .../coresight/Kconfig => debug/Kconfig.nrf} | 40 +++++----- .../nrf_etr.c => debug/debug_nrf_etr.c} | 74 ++++++++++--------- drivers/misc/CMakeLists.txt | 1 - drivers/misc/Kconfig | 1 - drivers/misc/coresight/CMakeLists.txt | 4 - .../{misc => debug}/nordic,nrf-tbm.yaml | 0 .../nrf_etr.h => debug/debug_nrf_etr.h} | 8 +- .../{misc/coresight => debug}/stmesp.h | 6 +- include/zephyr/logging/log_frontend_stmesp.h | 2 +- .../nordic/coresight_stm/pytest/test_stm.py | 2 +- .../nrf54h/Kconfig.defconfig.nrf54h20_cpuapp | 2 +- subsys/logging/frontends/Kconfig | 4 +- .../logging/frontends/log_frontend_stmesp.c | 13 ++-- 16 files changed, 81 insertions(+), 82 deletions(-) rename drivers/{misc/coresight/Kconfig => debug/Kconfig.nrf} (79%) rename drivers/{misc/coresight/nrf_etr.c => debug/debug_nrf_etr.c} (92%) delete mode 100644 drivers/misc/coresight/CMakeLists.txt rename dts/bindings/{misc => debug}/nordic,nrf-tbm.yaml (100%) rename include/zephyr/drivers/{misc/coresight/nrf_etr.h => debug/debug_nrf_etr.h} (52%) rename include/zephyr/drivers/{misc/coresight => debug}/stmesp.h (96%) diff --git a/doc/services/logging/cs_stm.rst b/doc/services/logging/cs_stm.rst index 75a371dfd24e..77b097d65161 100644 --- a/doc/services/logging/cs_stm.rst +++ b/doc/services/logging/cs_stm.rst @@ -119,7 +119,7 @@ When using logs, this method has the following advantages: Proxy core is using Nordic specific peripheral (TBM) to get ETR buffer busyness and send data over UART. Nordic specific driver for ETR buffer is located in -:zephyr_file:`drivers/misc/coresight/nrf_etr.c`. +:zephyr_file:`drivers/debug/debug_nrf_etr.c`. Configuration ------------- @@ -175,7 +175,7 @@ in :zephyr_file:`subsys/logging/frontends/log_frontend_stmesp_demux.c`. ``Proxy`` is using Nordic specific peripheral (TBM) to get ETR buffer busyness and read and decode data and send human-readable data over UART. Nordic specific driver for ETR buffer is -located in :zephyr_file:`drivers/misc/coresight/nrf_etr.c`. It is using :ref:`cs_trace_defmt` and +located in :zephyr_file:`drivers/debug/debug_nrf_etr.c`. It is using :ref:`cs_trace_defmt` and :ref:`mipi_stp_decoder` and above-mentioned demultiplexer to decode messages. Logging messages contains read-only format string used in the logging macros thus they cannot be diff --git a/drivers/debug/CMakeLists.txt b/drivers/debug/CMakeLists.txt index 54ca9f71694e..8314379f8fa8 100644 --- a/drivers/debug/CMakeLists.txt +++ b/drivers/debug/CMakeLists.txt @@ -5,4 +5,5 @@ zephyr_library() # zephyr-keep-sorted-start zephyr_library_sources_ifdef(CONFIG_DEBUG_SILABS_PTI debug_silabs_pti.c) +zephyr_library_sources_ifdef(CONFIG_DEBUG_NRF_ETR debug_nrf_etr.c) # zephyr-keep-sorted-stop diff --git a/drivers/debug/Kconfig b/drivers/debug/Kconfig index 68c23fdf1243..b38c5206f3cb 100644 --- a/drivers/debug/Kconfig +++ b/drivers/debug/Kconfig @@ -15,6 +15,7 @@ config DEBUG_DRIVER_INIT_PRIORITY Debug drivers initialization priority. # zephyr-keep-sorted-start +source "drivers/debug/Kconfig.nrf" source "drivers/debug/Kconfig.silabs" # zephyr-keep-sorted-stop diff --git a/drivers/misc/coresight/Kconfig b/drivers/debug/Kconfig.nrf similarity index 79% rename from drivers/misc/coresight/Kconfig rename to drivers/debug/Kconfig.nrf index 997d0c23c0a5..da2721947e13 100644 --- a/drivers/misc/coresight/Kconfig +++ b/drivers/debug/Kconfig.nrf @@ -3,7 +3,7 @@ DT_COMPAT_NORDIC_NRF_TBM := nordic,nrf-tbm -config NRF_ETR +config DEBUG_NRF_ETR bool "Coresight ETR handler (with Nordic TBM)" depends on $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF_TBM)) select NRFX_TBM @@ -14,9 +14,9 @@ config NRF_ETR data). Busyness is tracked using TBM (Trace Buffer Monitor) peripheral which is specific to Nordic Semiconductor SoCs. -if NRF_ETR +if DEBUG_NRF_ETR -config NRF_ETR_DECODE +config DEBUG_NRF_ETR_DECODE bool "Decode ETR content" default y if LOG_FRONTEND_STMESP_FSC select MIPI_STP_DECODER @@ -29,14 +29,14 @@ config NRF_ETR_DECODE In this mode, log messages stored by Coresight STM logging frontends are decoded and printed in the human readable form. -config NRF_ETR_DECODE_DROP_PERIOD +config DEBUG_NRF_ETR_DECODE_DROP_PERIOD int "Period of dropped messages notification" default 5000 help Period (in milliseconds) how often it is checked if any dropped messages have occurred. -config NRF_ETR_DEBUG +config DEBUG_NRF_ETR_DEBUG bool "Debug mode" depends on !LOG_PRINTK select MIPI_STP_DECODER @@ -44,18 +44,18 @@ config NRF_ETR_DEBUG help In debug mode STPv2 decoded data is printed. -config NRF_ETR_STACK_SIZE +config DEBUG_NRF_ETR_STACK_SIZE int "ETR thread stack size" - default 2048 if NRF_ETR_DECODE || NRF_ETR_DEBUG + default 2048 if DEBUG_NRF_ETR_DECODE || DEBUG_NRF_ETR_DEBUG default 1024 -config NRF_ETR_BACKOFF +config DEBUG_NRF_ETR_BACKOFF int "Thread backoff time (ms)" default 10 help Determines how often attempt to dump the data is performed. -config NRF_ETR_FLUSH_TIMEOUT +config DEBUG_NRF_ETR_FLUSH_TIMEOUT int "Backoff time during flushing (ms)" default 100 help @@ -63,10 +63,10 @@ config NRF_ETR_FLUSH_TIMEOUT there is still a pending ETR data. This option specifies how often thread is waking up to check. Given in milliseconds. -config NRF_ETR_SYNC_PERIOD +config DEBUG_NRF_ETR_SYNC_PERIOD int "Period of custom synchronization frame" - default 0 if NRF_ETR_DECODE - default 0 if NRF_ETR_DEBUG + default 0 if DEBUG_NRF_ETR_DECODE + default 0 if DEBUG_NRF_ETR_DEBUG default 16 help To help find the synchronization when decoding the ETR content @@ -74,25 +74,25 @@ config NRF_ETR_SYNC_PERIOD sent on regular intervals. This frame is sent between Coresight formatter frames. Use 0 to disable. -config NRF_ETR_SHELL +config DEBUG_NRF_ETR_SHELL bool "Use shell" select UART_ASYNC_API select UART_ASYNC_RX_HELPER select SHELL_LOG_BACKEND_CUSTOM - depends on NRF_ETR_DECODE + depends on DEBUG_NRF_ETR_DECODE default y if SHELL help Enable shell with Coresight STM logging support. -if NRF_ETR_SHELL +if DEBUG_NRF_ETR_SHELL -config NRF_ETR_SHELL_PROMPT +config DEBUG_NRF_ETR_SHELL_PROMPT string "Displayed prompt name" default "uart:~$ " help Displayed prompt name for UART shell with Coresight STM logging. -config NRF_ETR_SHELL_ASYNC_RX_BUFFER_SIZE +config DEBUG_NRF_ETR_SHELL_ASYNC_RX_BUFFER_SIZE int "Size of the RX buffer" default 16 help @@ -101,13 +101,13 @@ config NRF_ETR_SHELL_ASYNC_RX_BUFFER_SIZE slow and may need to be increased if long messages are pasted directly to the shell prompt. -config NRF_ETR_SHELL_ASYNC_RX_BUFFER_COUNT +config DEBUG_NRF_ETR_SHELL_ASYNC_RX_BUFFER_COUNT int "Number of RX buffers" default 4 range 2 64 help Number of RX buffers. -endif # NRF_ETR_SHELL +endif # DEBUG_NRF_ETR_SHELL -endif # NRF_ETR +endif # DEBUG_NRF_ETR diff --git a/drivers/misc/coresight/nrf_etr.c b/drivers/debug/debug_nrf_etr.c similarity index 92% rename from drivers/misc/coresight/nrf_etr.c rename to drivers/debug/debug_nrf_etr.c index bf1aecd6f5b4..da425716dbbe 100644 --- a/drivers/misc/coresight/nrf_etr.c +++ b/drivers/debug/debug_nrf_etr.c @@ -16,7 +16,7 @@ #include #include #include -#include +#include #include #include #include @@ -29,15 +29,15 @@ LOG_MODULE_REGISTER(cs_etr_tbm); #define ETR_BUFFER_NODE DT_NODELABEL(etr_buffer) #define DROP_CHECK_PERIOD \ - COND_CODE_1(CONFIG_NRF_ETR_DECODE, \ - (CONFIG_NRF_ETR_DECODE_DROP_PERIOD), (0)) + COND_CODE_1(CONFIG_DEBUG_NRF_ETR_DECODE, \ + (CONFIG_DEBUG_NRF_ETR_DECODE_DROP_PERIOD), (0)) #define MIN_DATA (2 * CORESIGHT_TRACE_FRAME_SIZE32) /* Since ETR debug is a part of logging infrastructure, logging cannot be used * for debugging. Printk is used (assuming CONFIG_LOG_PRINTK=n) */ -#define DBG(...) IF_ENABLED(CONFIG_NRF_ETR_DEBUG, (printk(__VA_ARGS__))) +#define DBG(...) IF_ENABLED(CONFIG_DEBUG_NRF_ETR_DEBUG, (printk(__VA_ARGS__))) /** @brief Macro for dumping debug data. * @@ -86,10 +86,10 @@ static const struct device *uart_dev = DEVICE_DT_GET(UART_NODE); static uint32_t frame_buf0[CORESIGHT_TRACE_FRAME_SIZE32] DMM_MEMORY_SECTION(UART_NODE); static uint32_t frame_buf1[CORESIGHT_TRACE_FRAME_SIZE32] DMM_MEMORY_SECTION(UART_NODE); static uint32_t frame_buf_decode[CORESIGHT_TRACE_FRAME_SIZE32]; -static uint32_t *frame_buf = IS_ENABLED(CONFIG_NRF_ETR_DECODE) ? +static uint32_t *frame_buf = IS_ENABLED(CONFIG_DEBUG_NRF_ETR_DECODE) ? frame_buf_decode : frame_buf0; -K_KERNEL_STACK_DEFINE(etr_stack, CONFIG_NRF_ETR_STACK_SIZE); +K_KERNEL_STACK_DEFINE(etr_stack, CONFIG_DEBUG_NRF_ETR_STACK_SIZE); static struct k_thread etr_thread; BUILD_ASSERT((DT_REG_SIZE(ETR_BUFFER_NODE) % CONFIG_DCACHE_LINE_SIZE) == 0); @@ -134,9 +134,10 @@ static const char *const hw_evts[] = { "GD0 HS down", /* 31 Global domain high speed 0 down */ }; -#ifdef CONFIG_NRF_ETR_SHELL +#ifdef CONFIG_DEBUG_NRF_ETR_SHELL #define RX_BUF_SIZE \ - (CONFIG_NRF_ETR_SHELL_ASYNC_RX_BUFFER_SIZE * CONFIG_NRF_ETR_SHELL_ASYNC_RX_BUFFER_COUNT) + (CONFIG_DEBUG_NRF_ETR_SHELL_ASYNC_RX_BUFFER_SIZE * \ + CONFIG_DEBUG_NRF_ETR_SHELL_ASYNC_RX_BUFFER_COUNT) static void etr_timer_handler(struct k_timer *timer); K_TIMER_DEFINE(etr_timer, etr_timer_handler, NULL); @@ -278,7 +279,7 @@ static void message_process(union log_frontend_stmesp_demux_packet packet) */ static void sync_loss(void) { - if (IS_ENABLED(CONFIG_NRF_ETR_DECODE)) { + if (IS_ENABLED(CONFIG_DEBUG_NRF_ETR_DECODE)) { mipi_stp_decoder_sync_loss(); log_frontend_stmesp_demux_reset(); oosync_cnt++; @@ -292,7 +293,7 @@ static void sync_loss(void) */ static void on_resync(void) { - if (IS_ENABLED(CONFIG_NRF_ETR_DECODE)) { + if (IS_ENABLED(CONFIG_DEBUG_NRF_ETR_DECODE)) { in_sync = true; } } @@ -365,7 +366,7 @@ static void decoder_cb(enum mipi_stp_decoder_ctrl_type type, decoder_cb_debug(type, data, ts, marked); - if (!IS_ENABLED(CONFIG_NRF_ETR_DECODE)) { + if (!IS_ENABLED(CONFIG_DEBUG_NRF_ETR_DECODE)) { return; } @@ -549,7 +550,7 @@ static void dump_frame(uint8_t *buf) static void process(void) { static const uint32_t *const etr_buf = (uint32_t *)(DT_REG_ADDR(ETR_BUFFER_NODE)); - static uint32_t sync_cnt; + static uint32_t sync_cnt = CONFIG_DEBUG_NRF_ETR_SYNC_PERIOD; uint32_t pending; /* If function is called in panic mode then it may interrupt ongoing @@ -562,7 +563,7 @@ static void process(void) */ while ((pending = pending_data()) >= MIN_DATA) { /* Do not read the data that has already been read but not yet processed. */ - if (sync_cnt || (CONFIG_NRF_ETR_SYNC_PERIOD == 0)) { + if (sync_cnt || (CONFIG_DEBUG_NRF_ETR_SYNC_PERIOD == 0)) { sync_cnt--; sys_cache_data_invd_range((void *)&etr_buf[etr_rd_idx & wsize_mask], CORESIGHT_TRACE_FRAME_SIZE); @@ -572,11 +573,12 @@ static void process(void) rd_idx_inc(); __sync_synchronize(); } else { - sync_cnt = CONFIG_NRF_ETR_SYNC_PERIOD; + sync_cnt = CONFIG_DEBUG_NRF_ETR_SYNC_PERIOD; memset(frame_buf, 0xff, CORESIGHT_TRACE_FRAME_SIZE); } - if (IS_ENABLED(CONFIG_NRF_ETR_DECODE) || IS_ENABLED(CONFIG_NRF_ETR_DEBUG)) { + if (IS_ENABLED(CONFIG_DEBUG_NRF_ETR_DECODE) || + IS_ENABLED(CONFIG_DEBUG_NRF_ETR_DEBUG)) { if ((pending >= (wsize_mask - MIN_DATA)) || (pending_data() >= (wsize_mask - MIN_DATA))) { /* If before or after reading the frame it is close to full @@ -586,7 +588,7 @@ static void process(void) } process_frame((uint8_t *)frame_buf, pending); - if (IS_ENABLED(CONFIG_NRF_ETR_DECODE)) { + if (IS_ENABLED(CONFIG_DEBUG_NRF_ETR_DECODE)) { process_messages(); } } else { @@ -612,7 +614,7 @@ static int decoder_init(void) } once = true; - if (IS_ENABLED(CONFIG_NRF_ETR_DECODE)) { + if (IS_ENABLED(CONFIG_DEBUG_NRF_ETR_DECODE)) { static const struct log_frontend_stmesp_demux_config config = { .m_ids = stm_m_id, .m_ids_cnt = ARRAY_SIZE(stm_m_id), @@ -635,12 +637,12 @@ static int decoder_init(void) return 0; } -void nrf_etr_flush(void) +void debug_nrf_etr_flush(void) { int cnt = 4; - if (IS_ENABLED(CONFIG_NRF_ETR_DECODE) || - IS_ENABLED(CONFIG_NRF_ETR_DEBUG)) { + if (IS_ENABLED(CONFIG_DEBUG_NRF_ETR_DECODE) || + IS_ENABLED(CONFIG_DEBUG_NRF_ETR_DEBUG)) { (void)decoder_init(); } @@ -658,13 +660,13 @@ void nrf_etr_flush(void) irq_unlock(k); } -#ifndef CONFIG_NRF_ETR_SHELL +#ifndef CONFIG_DEBUG_NRF_ETR_SHELL static void etr_thread_func(void *dummy1, void *dummy2, void *dummy3) { uint64_t checkpoint = 0; - if (IS_ENABLED(CONFIG_NRF_ETR_DECODE) || - IS_ENABLED(CONFIG_NRF_ETR_DEBUG)) { + if (IS_ENABLED(CONFIG_DEBUG_NRF_ETR_DECODE) || + IS_ENABLED(CONFIG_DEBUG_NRF_ETR_DEBUG)) { int err; err = decoder_init(); @@ -688,7 +690,7 @@ static void etr_thread_func(void *dummy1, void *dummy2, void *dummy3) } } - k_sleep(K_MSEC(CONFIG_NRF_ETR_BACKOFF)); + k_sleep(K_MSEC(CONFIG_DEBUG_NRF_ETR_BACKOFF)); } } #endif @@ -703,7 +705,7 @@ static void uart_event_handler(const struct device *dev, struct uart_event *evt, case UART_TX_DONE: k_sem_give(&uart_sem); break; -#ifdef CONFIG_NRF_ETR_SHELL +#ifdef CONFIG_DEBUG_NRF_ETR_SHELL case UART_RX_RDY: uart_async_rx_on_rdy(&async_rx, evt->data.rx.buf, evt->data.rx.len); shell_handler(SHELL_TRANSPORT_EVT_RX_RDY, shell_context); @@ -729,7 +731,7 @@ static void uart_event_handler(const struct device *dev, struct uart_event *evt, break; case UART_RX_DISABLED: break; -#endif /* CONFIG_NRF_ETR_SHELL */ +#endif /* CONFIG_DEBUG_NRF_ETR_SHELL */ default: __ASSERT_NO_MSG(0); } @@ -743,7 +745,7 @@ static void tbm_event_handler(nrf_tbm_event_t event) tbm_full = true; } -#ifdef CONFIG_NRF_ETR_SHELL +#ifdef CONFIG_DEBUG_NRF_ETR_SHELL k_poll_signal_raise(&etr_shell.ctx->signals[SHELL_SIGNAL_LOG_MSG], 0); #else k_wakeup(&etr_thread); @@ -767,14 +769,14 @@ int etr_process_init(void) nrfx_isr, nrfx_tbm_irq_handler, 0); irq_enable(DT_IRQN(DT_NODELABEL(tbm))); -#ifdef CONFIG_NRF_ETR_SHELL +#ifdef CONFIG_DEBUG_NRF_ETR_SHELL uint32_t level = CONFIG_LOG_MAX_LEVEL; static const struct shell_backend_config_flags cfg_flags = SHELL_DEFAULT_BACKEND_CONFIG_FLAGS; shell_init(&etr_shell, NULL, cfg_flags, true, level); - k_timer_start(&etr_timer, K_MSEC(CONFIG_NRF_ETR_BACKOFF), K_NO_WAIT); - if (IS_ENABLED(CONFIG_NRF_ETR_DECODE) || IS_ENABLED(CONFIG_NRF_ETR_DEBUG)) { + k_timer_start(&etr_timer, K_MSEC(CONFIG_DEBUG_NRF_ETR_BACKOFF), K_NO_WAIT); + if (IS_ENABLED(CONFIG_DEBUG_NRF_ETR_DECODE) || IS_ENABLED(CONFIG_DEBUG_NRF_ETR_DEBUG)) { err = decoder_init(); if (err < 0) { return err; @@ -791,14 +793,14 @@ int etr_process_init(void) SYS_INIT(etr_process_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); -#ifdef CONFIG_NRF_ETR_SHELL +#ifdef CONFIG_DEBUG_NRF_ETR_SHELL static void etr_timer_handler(struct k_timer *timer) { if (pending_data() >= MIN_DATA) { k_poll_signal_raise(&etr_shell.ctx->signals[SHELL_SIGNAL_LOG_MSG], 0); } else { - k_timer_start(timer, K_MSEC(CONFIG_NRF_ETR_BACKOFF), K_NO_WAIT); + k_timer_start(timer, K_MSEC(CONFIG_DEBUG_NRF_ETR_BACKOFF), K_NO_WAIT); } } @@ -807,7 +809,7 @@ bool z_shell_log_backend_process(const struct shell_log_backend *backend) ARG_UNUSED(backend); process(); - k_timer_start(&etr_timer, K_MSEC(CONFIG_NRF_ETR_BACKOFF), K_NO_WAIT); + k_timer_start(&etr_timer, K_MSEC(CONFIG_DEBUG_NRF_ETR_BACKOFF), K_NO_WAIT); return false; } @@ -901,7 +903,7 @@ static int etr_shell_init(const struct shell_transport *transport, const void *c static const struct uart_async_rx_config async_rx_config = { .buffer = rx_buf, .length = sizeof(rx_buf), - .buf_cnt = CONFIG_NRF_ETR_SHELL_ASYNC_RX_BUFFER_COUNT, + .buf_cnt = CONFIG_DEBUG_NRF_ETR_SHELL_ASYNC_RX_BUFFER_COUNT, }; shell_context = context; @@ -939,6 +941,6 @@ static struct shell_transport transport = { }; static uint8_t shell_out_buffer[CONFIG_SHELL_PRINTF_BUFF_SIZE]; -Z_SHELL_DEFINE(etr_shell, CONFIG_NRF_ETR_SHELL_PROMPT, &transport, shell_out_buffer, NULL, +Z_SHELL_DEFINE(etr_shell, CONFIG_DEBUG_NRF_ETR_SHELL_PROMPT, &transport, shell_out_buffer, NULL, SHELL_FLAG_OLF_CRLF); -#endif /* CONFIG_NRF_ETR_SHELL */ +#endif /* CONFIG_DEBUG_NRF_ETR_SHELL */ diff --git a/drivers/misc/CMakeLists.txt b/drivers/misc/CMakeLists.txt index 437bd124247a..8426090ab14e 100644 --- a/drivers/misc/CMakeLists.txt +++ b/drivers/misc/CMakeLists.txt @@ -15,5 +15,4 @@ add_subdirectory_ifdef(CONFIG_RENESAS_RX_EXTERNAL_INTERRUPT renesas_rx_external_ add_subdirectory_ifdef(CONFIG_NXP_RTXXX_DSP_CTRL nxp_rtxxx_dsp_ctrl) add_subdirectory_ifdef(CONFIG_STM32N6_AXISRAM stm32n6_axisram) -add_subdirectory(coresight) add_subdirectory(interconn) diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index 6d4d5cfc16fe..0a3af14dc2c0 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig @@ -15,7 +15,6 @@ source "drivers/misc/timeaware_gpio/Kconfig" source "drivers/misc/devmux/Kconfig" source "drivers/misc/nordic_vpr_launcher/Kconfig" source "drivers/misc/mcux_flexio/Kconfig" -source "drivers/misc/coresight/Kconfig" source "drivers/misc/interconn/Kconfig" source "drivers/misc/renesas_ra_external_interrupt/Kconfig" source "drivers/misc/renesas_rx_external_interrupt/Kconfig" diff --git a/drivers/misc/coresight/CMakeLists.txt b/drivers/misc/coresight/CMakeLists.txt deleted file mode 100644 index 1ec34ca2f75a..000000000000 --- a/drivers/misc/coresight/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -zephyr_library_sources_ifdef(CONFIG_NRF_ETR nrf_etr.c) diff --git a/dts/bindings/misc/nordic,nrf-tbm.yaml b/dts/bindings/debug/nordic,nrf-tbm.yaml similarity index 100% rename from dts/bindings/misc/nordic,nrf-tbm.yaml rename to dts/bindings/debug/nordic,nrf-tbm.yaml diff --git a/include/zephyr/drivers/misc/coresight/nrf_etr.h b/include/zephyr/drivers/debug/debug_nrf_etr.h similarity index 52% rename from include/zephyr/drivers/misc/coresight/nrf_etr.h rename to include/zephyr/drivers/debug/debug_nrf_etr.h index 062afa3b61aa..04805a7e2d1d 100644 --- a/include/zephyr/drivers/misc/coresight/nrf_etr.h +++ b/include/zephyr/drivers/debug/debug_nrf_etr.h @@ -3,18 +3,18 @@ * SPDX-License-Identifier: Apache-2.0 */ -#ifndef _ZEPHYR_DRIVERS_MISC_CORESIGHT_NRF_ETR_H_ -#define _ZEPHYR_DRIVERS_MISC_CORESIGHT_NRF_ETR_H_ +#ifndef _ZEPHYR_DRIVERS_DEBUG_CORESIGHT_NRF_ETR_H_ +#define _ZEPHYR_DRIVERS_DEBUG_CORESIGHT_NRF_ETR_H_ #ifdef __cplusplus extern "C" { #endif /** @brief Flush data from the ETR buffer. */ -void nrf_etr_flush(void); +void debug_nrf_etr_flush(void); #ifdef __cplusplus } #endif -#endif /* _ZEPHYR_DRIVERS_MISC_CORESIGHT_NRF_ETR_H_ */ +#endif /* _ZEPHYR_DRIVERS_DEBUG_CORESIGHT_NRF_ETR_H_ */ diff --git a/include/zephyr/drivers/misc/coresight/stmesp.h b/include/zephyr/drivers/debug/stmesp.h similarity index 96% rename from include/zephyr/drivers/misc/coresight/stmesp.h rename to include/zephyr/drivers/debug/stmesp.h index ce0f64b52dde..d4b245857eb3 100644 --- a/include/zephyr/drivers/misc/coresight/stmesp.h +++ b/include/zephyr/drivers/debug/stmesp.h @@ -4,8 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -#ifndef ZEPHYR_INCLUDE_DRIVERS_MISC_CORESIGHT_STMESP_H_ -#define ZEPHYR_INCLUDE_DRIVERS_MISC_CORESIGHT_STMESP_H_ +#ifndef ZEPHYR_INCLUDE_DRIVERS_DEBUG_CORESIGHT_STMESP_H_ +#define ZEPHYR_INCLUDE_DRIVERS_DEBUG_CORESIGHT_STMESP_H_ #include @@ -190,4 +190,4 @@ static inline int stmesp_get_port(uint32_t idx, STMESP_Type **port) * @} */ -#endif /* ZEPHYR_INCLUDE_DRIVERS_MISC_CORESIGHT_STMESP_H_ */ +#endif /* ZEPHYR_INCLUDE_DRIVERS_DEBUG_CORESIGHT_STMESP_H_ */ diff --git a/include/zephyr/logging/log_frontend_stmesp.h b/include/zephyr/logging/log_frontend_stmesp.h index 38f33bf62f10..c30972319fa7 100644 --- a/include/zephyr/logging/log_frontend_stmesp.h +++ b/include/zephyr/logging/log_frontend_stmesp.h @@ -9,7 +9,7 @@ #include #include #ifdef CONFIG_LOG_FRONTEND_STMESP -#include +#include #endif #ifdef __cplusplus diff --git a/samples/boards/nordic/coresight_stm/pytest/test_stm.py b/samples/boards/nordic/coresight_stm/pytest/test_stm.py index 4af24fbfa3c9..6db0b5685759 100644 --- a/samples/boards/nordic/coresight_stm/pytest/test_stm.py +++ b/samples/boards/nordic/coresight_stm/pytest/test_stm.py @@ -20,7 +20,7 @@ SB_CONFIG_APP_CPUFLPR_RUN = None # See definition of stm_m_id[] and stm_m_name[] in -# https://github.com/zephyrproject-rtos/zephyr/blob/main/drivers/misc/coresight/nrf_etr.c +# https://github.com/zephyrproject-rtos/zephyr/blob/main/drivers/debug/debug_nrf_etr.c STM_M_ID = { "sec": 33, "app": 34, diff --git a/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuapp b/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuapp index 674b5433c147..86149e5bd0e0 100644 --- a/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuapp +++ b/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuapp @@ -9,7 +9,7 @@ config NUM_IRQS default 471 config SHELL_BACKEND_SERIAL - default n if NRF_ETR_SHELL + default n if DEBUG_NRF_ETR_SHELL config POWER_DOMAIN default y diff --git a/subsys/logging/frontends/Kconfig b/subsys/logging/frontends/Kconfig index 6e5602763574..8bad85c69814 100644 --- a/subsys/logging/frontends/Kconfig +++ b/subsys/logging/frontends/Kconfig @@ -46,7 +46,7 @@ config LOG_FRONTEND_STMESP_DICT config LOG_FRONTEND_STMESP_FSC bool "Send fully self-contained messages" - select LOG_MSG_APPEND_RO_STRING_LOC if !(NRF_ETR || \ + select LOG_MSG_APPEND_RO_STRING_LOC if !(DEBUG_NRF_ETR || \ SOC_NRF54H20_CPUPPR || SOC_NRF54H20_CPUFLPR) config LOG_FRONTEND_STMESP_FLUSH_COUNT @@ -70,7 +70,7 @@ config LOG_FRONTEND_STMESP_DICT_VER config LOG_FRONTEND_STMESP_TURBO_LOG bool "Optimize short_logs" select LOG_CUSTOM_HEADER - default y if (NRF_ETR || SOC_NRF54H20_CPUPPR || SOC_NRF54H20_CPUFLPR) \ + default y if (DEBUG_NRF_ETR || SOC_NRF54H20_CPUPPR || SOC_NRF54H20_CPUFLPR) \ && LOG_FRONTEND_STMESP_FSC help When enabled, then logging messages with 0 and 1 numeric argument are diff --git a/subsys/logging/frontends/log_frontend_stmesp.c b/subsys/logging/frontends/log_frontend_stmesp.c index 0ede3cb48906..7cdd16ffdd34 100644 --- a/subsys/logging/frontends/log_frontend_stmesp.c +++ b/subsys/logging/frontends/log_frontend_stmesp.c @@ -11,8 +11,8 @@ #include #include #include -#ifdef CONFIG_NRF_ETR -#include +#ifdef CONFIG_DEBUG_NRF_ETR +#include #endif /* Only 32 bit platforms supported. */ @@ -574,15 +574,16 @@ void log_frontend_simple_2(const void *source, uint32_t level, const char *fmt, void log_frontend_panic(void) { in_panic = true; -#ifdef CONFIG_NRF_ETR - nrf_etr_flush(); +#ifdef CONFIG_DEBUG_NRF_ETR + debug_nrf_etr_flush(); #endif } void log_frontend_init(void) { -#if defined(CONFIG_LOG_FRONTEND_STPESP_TURBO_SOURCE_PORT_ID) && !defined(CONFIG_NRF_ETR) && \ - !defined(CONFIG_LOG_MSG_APPEND_RO_STRING_LOC) +#if defined(CONFIG_LOG_FRONTEND_STPESP_TURBO_SOURCE_PORT_ID) \ + && !defined(CONFIG_DEBUG_NRF_ETR) \ + && !defined(CONFIG_LOG_MSG_APPEND_RO_STRING_LOC) /* Send location of section with constant source data. It is used by the * application core to retrieve source names of log messages coming from * coprocessors (FLPR and PPR). From 24cefbf00dffe993a0e5310467f133c8ac69cac1 Mon Sep 17 00:00:00 2001 From: Karsten Koenig Date: Wed, 27 Aug 2025 21:38:40 +0200 Subject: [PATCH 1855/2141] [nrf fromtree] drivers: pinctrl_nrf: Add coresight tpiu pins Pinctrl needs to set the needed drive and direction of the pins. Also this later allows automatically setting the clock bit for the traceclk pin. Signed-off-by: Karsten Koenig (cherry picked from commit 85363f9e53e566e32fc10030f05fa28aa5d1bee4) --- .../nrf54h20dk/nrf54h20dk_nrf54h20-pinctrl.dtsi | 11 +++++++++++ drivers/pinctrl/pinctrl_nrf.c | 11 +++++++++++ include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h | 12 +++++++++++- soc/nordic/common/uicr/gen_periphconf_entries.py | 8 ++++++++ soc/nordic/common/uicr/periphconf/builder.py | 8 ++++++++ 5 files changed, 49 insertions(+), 1 deletion(-) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-pinctrl.dtsi b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-pinctrl.dtsi index f62df87dfe26..0e2ab313df9b 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-pinctrl.dtsi +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-pinctrl.dtsi @@ -138,4 +138,15 @@ low-power-enable; }; }; + + /omit-if-no-ref/ tpiu_default: tpiu_default { + group1 { + psels = , + , + , + , + ; + nordic,drive-mode = ; + }; + }; }; diff --git a/drivers/pinctrl/pinctrl_nrf.c b/drivers/pinctrl/pinctrl_nrf.c index 4c916a263e7a..e350e61f0afc 100644 --- a/drivers/pinctrl/pinctrl_nrf.c +++ b/drivers/pinctrl/pinctrl_nrf.c @@ -558,6 +558,17 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, input = NRF_GPIO_PIN_INPUT_CONNECT; break; #endif /* defined(NRF_PSEL_TWIS) */ +#if DT_HAS_COMPAT_STATUS_OKAY(nordic_coresight_nrf) + /* Pin routing is controlled by secure domain, via UICR */ + case NRF_FUN_TPIU_CLOCK: + case NRF_FUN_TPIU_DATA0: + case NRF_FUN_TPIU_DATA1: + case NRF_FUN_TPIU_DATA2: + case NRF_FUN_TPIU_DATA3: + dir = NRF_GPIO_PIN_DIR_OUTPUT; + input = NRF_GPIO_PIN_INPUT_DISCONNECT; + break; +#endif /* DT_HAS_COMPAT_STATUS_OKAY(nordic_coresight_nrf) */ default: return -ENOTSUP; } diff --git a/include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h b/include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h index 42b302193ed0..92e62a9a6bed 100644 --- a/include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h +++ b/include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h @@ -187,7 +187,17 @@ /** TDM MCK */ #define NRF_FUN_TDM_MCK 77U /** SPI master CSN */ -#define NRF_FUN_SPIM_CSN 78U +#define NRF_FUN_SPIM_CSN 78U +/** TPIU CLOCK */ +#define NRF_FUN_TPIU_CLOCK 79U +/** TPIU DATA0 */ +#define NRF_FUN_TPIU_DATA0 80U +/** TPIU DATA1 */ +#define NRF_FUN_TPIU_DATA1 81U +/** TPIU DATA2 */ +#define NRF_FUN_TPIU_DATA2 82U +/** TPIU DATA3 */ +#define NRF_FUN_TPIU_DATA3 83U /** @} */ diff --git a/soc/nordic/common/uicr/gen_periphconf_entries.py b/soc/nordic/common/uicr/gen_periphconf_entries.py index 4308df31449f..d3b79e43f149 100644 --- a/soc/nordic/common/uicr/gen_periphconf_entries.py +++ b/soc/nordic/common/uicr/gen_periphconf_entries.py @@ -425,6 +425,14 @@ def lookup_tables_get(soc: Soc) -> SocLookupTables: NrfPsel(fun=NrfFun.IGNORE, port=2, pin=10): Ctrlsel.CAN, NrfPsel(fun=NrfFun.IGNORE, port=2, pin=11): Ctrlsel.CAN, }, + # Coresight (TPIU) + 0xBF04_0000: { + NrfPsel(fun=NrfFun.TPIU_CLOCK, port=7, pin=3): Ctrlsel.TND, + NrfPsel(fun=NrfFun.TPIU_DATA0, port=7, pin=4): Ctrlsel.TND, + NrfPsel(fun=NrfFun.TPIU_DATA1, port=7, pin=5): Ctrlsel.TND, + NrfPsel(fun=NrfFun.TPIU_DATA2, port=7, pin=6): Ctrlsel.TND, + NrfPsel(fun=NrfFun.TPIU_DATA3, port=7, pin=7): Ctrlsel.TND, + }, } elif soc == Soc.NRF9280: ctrlsel_lookup = { diff --git a/soc/nordic/common/uicr/periphconf/builder.py b/soc/nordic/common/uicr/periphconf/builder.py index 1a343dee44a0..b8387fd9a756 100644 --- a/soc/nordic/common/uicr/periphconf/builder.py +++ b/soc/nordic/common/uicr/periphconf/builder.py @@ -41,6 +41,9 @@ "nordic,nrf-temp", "nordic,nrf-vevif-task-tx", "nordic,nrf-vevif-task-rx", + # No retention in TDD so permissions can't be set outside of the TDD service + "nordic,coresight-nrf", + "nordic,nrf-tbm", } # Compatibles of global peripherals that should be assigned to the current core but do not have DMA @@ -1018,6 +1021,11 @@ class NrfFun(int, enum.Enum): TDM_SDOUT = 76 TDM_MCK = 77 SPIM_CSN = 78 + TPIU_CLOCK = 79 + TPIU_DATA0 = 80 + TPIU_DATA1 = 81 + TPIU_DATA2 = 82 + TPIU_DATA3 = 83 # Value used to ignore the function field and only check (port, pin) IGNORE = -1 From dace62f1bba42a5bebf68429f7a0dac2f87a5da0 Mon Sep 17 00:00:00 2001 From: Karsten Koenig Date: Wed, 27 Aug 2025 21:41:39 +0200 Subject: [PATCH 1856/2141] [nrf fromtree] drivers: debub: coresight: Added coresight_nrf Added driver and bindings for the coresight nrf submodule. add integrated it for the nrf54h20. The coresight subsystem is a combination of ARM Coresight peripherals that get configured together to achieve a simplified configuration based on a desired operating mode. This also replaces the previous handling in the nrf54h20 soc.c which was powering the subsystem up but not configuring it. Signed-off-by: Karsten Koenig (cherry picked from commit 6066a427486d847260a43ca0424cf9bc8ad5daec) --- drivers/debug/CMakeLists.txt | 3 +- drivers/debug/Kconfig.nrf | 65 ++++ drivers/debug/coresight_arm.h | 208 +++++++++++++ drivers/debug/debug_coresight_nrf.c | 281 ++++++++++++++++++ drivers/debug/debug_nrf_etr.c | 13 +- dts/bindings/arm/nordic,nrf-tddconf.yaml | 44 --- dts/bindings/debug/nordic,coresight-nrf.yaml | 22 ++ dts/vendor/nordic/nrf54h20.dtsi | 79 ++++- .../zephyr/dt-bindings/misc/nordic-tddconf.h | 15 - .../common/uicr/gen_periphconf_entries.py | 4 + soc/nordic/nrf54h/Kconfig | 11 - soc/nordic/nrf54h/soc.c | 18 -- 12 files changed, 669 insertions(+), 94 deletions(-) create mode 100644 drivers/debug/coresight_arm.h create mode 100644 drivers/debug/debug_coresight_nrf.c delete mode 100644 dts/bindings/arm/nordic,nrf-tddconf.yaml create mode 100644 dts/bindings/debug/nordic,coresight-nrf.yaml delete mode 100644 include/zephyr/dt-bindings/misc/nordic-tddconf.h diff --git a/drivers/debug/CMakeLists.txt b/drivers/debug/CMakeLists.txt index 8314379f8fa8..29763be07ec1 100644 --- a/drivers/debug/CMakeLists.txt +++ b/drivers/debug/CMakeLists.txt @@ -4,6 +4,7 @@ zephyr_library() # zephyr-keep-sorted-start -zephyr_library_sources_ifdef(CONFIG_DEBUG_SILABS_PTI debug_silabs_pti.c) +zephyr_library_sources_ifdef(CONFIG_DEBUG_CORESIGHT_NRF debug_coresight_nrf.c) zephyr_library_sources_ifdef(CONFIG_DEBUG_NRF_ETR debug_nrf_etr.c) +zephyr_library_sources_ifdef(CONFIG_DEBUG_SILABS_PTI debug_silabs_pti.c) # zephyr-keep-sorted-stop diff --git a/drivers/debug/Kconfig.nrf b/drivers/debug/Kconfig.nrf index da2721947e13..030e9885a06d 100644 --- a/drivers/debug/Kconfig.nrf +++ b/drivers/debug/Kconfig.nrf @@ -111,3 +111,68 @@ config DEBUG_NRF_ETR_SHELL_ASYNC_RX_BUFFER_COUNT endif # DEBUG_NRF_ETR_SHELL endif # DEBUG_NRF_ETR + +menuconfig DEBUG_CORESIGHT_NRF + bool "Coresight Trace support" + default y + depends on DT_HAS_NORDIC_CORESIGHT_NRF_ENABLED + select PINCTRL + select NRF_IRONSIDE_TDD_SERVICE + help + Support CoreSight peripherals in Test and Debug Domain for ARM + CoreSight System Trace Macrocell (STM) trace support. + +if DEBUG_CORESIGHT_NRF + +config DEBUG_CORESIGHT_NRF_ATB_TRACE_ID_STM_GLOBAL + def_hex 0x40 + help + Global trace ID used by STM. + +config DEBUG_CORESIGHT_NRF_STM_SYNC_BYTE_COUNT + int "STM: Emit synhronization packet every N bytes" + range 0 4095 + default 512 + +config DEBUG_CORESIGHT_NRF_STM_HWEVENTS + bool "STM: Enable hardware events" + help + Enable the output of hardware events in STM. + +config DEBUG_CORESIGHT_NRF_TPIU_FFCR_TRIG + bool "TPIU: Use flush request trigger" + default y + help + Use CTI channel 1 for triggering flush request in TPIU. + +config DEBUG_CORESIGHT_NRF_TPIU_SYNC_FRAME_COUNT + int "TPIU: Emit synchronisation packet every N frames" + default 8 + +config DEBUG_CORESIGHT_NRF_TPIU_PORTSIZE + int "TPIU: Size of the current TPIU port in bits" + range 1 32 + default 4 + +config DEBUG_CORESIGHT_NRF_ATBFUNNEL_HOLD_TIME + int "ATBFUNNEL: Hold time for the transaction" + range 1 15 + default 4 + help + Number of transactions that are output on the funnel master port from the + same slave. + +config DEBUG_CORESIGHT_NRF_TSGEN_CLK_DIV + int + default 8 + help + Clock division factor for generating trace timestamps. The timestamp + counter should not be slower than 10% of the fastest processor clock + frequency in the system, therefore its clock speed is divided by + eight. + +module = DEBUG_CORESIGHT_NRF +module-str = CoreSight Trace +source "subsys/logging/Kconfig.template.log_config" + +endif # DEBUG_CORESIGHT_NRF diff --git a/drivers/debug/coresight_arm.h b/drivers/debug/coresight_arm.h new file mode 100644 index 000000000000..b0c5da3e92d0 --- /dev/null +++ b/drivers/debug/coresight_arm.h @@ -0,0 +1,208 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef CORESIGHT_ARM_H_ +#define CORESIGHT_ARM_H_ + +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @file + * @brief Generic ARM CoreSight Hardware Abstraction Layer + * + * This HAL provides generic register definitions and utility functions for ARM CoreSight + * peripherals. Platform-specific drivers should provide base addresses and use these + * generic definitions for register access. + */ + +/* Common CoreSight unlock key as defined by ARM architecture */ +#define CORESIGHT_UNLOCK_KEY (0xC5ACCE55UL) + +/* CoreSight register offsets */ + +/* Common CoreSight peripheral register offsets (found at the end of all CoreSight peripherals) */ +#define CORESIGHT_CLAIMSET_OFFSET (0xFA0UL) /* Claim Tag Set Register */ +#define CORESIGHT_CLAIMCLR_OFFSET (0xFA4UL) /* Claim Tag Clear Register */ +#define CORESIGHT_LAR_OFFSET (0xFB0UL) /* Lock Access Register */ +#define CORESIGHT_LSR_OFFSET (0xFB4UL) /* Lock Status Register */ + +/* ATB Funnel register offsets */ +#define ATBFUNNEL_CTRLREG_OFFSET (0x000UL) /* Control Register */ + +/* ATB Replicator register offsets */ +#define ATBREPLICATOR_IDFILTER0_OFFSET (0x000UL) /* ID Filter Register 0 */ +#define ATBREPLICATOR_IDFILTER1_OFFSET (0x004UL) /* ID Filter Register 1 */ + +/* ETR (Embedded Trace Router/TMC-ETR) register offsets */ +#define ETR_RSZ_OFFSET (0x004UL) /* RAM Size Register */ +#define ETR_RWP_OFFSET (0x018UL) /* RAM Write Pointer Register */ +#define ETR_CTL_OFFSET (0x020UL) /* Control Register */ +#define ETR_MODE_OFFSET (0x028UL) /* Mode Register */ +#define ETR_DBALO_OFFSET (0x118UL) /* Data Buffer Address Low Register */ +#define ETR_DBAHI_OFFSET (0x11CUL) /* Data Buffer Address High Register */ +#define ETR_FFCR_OFFSET (0x304UL) /* Formatter and Flush Control Register */ + +/* STM (System Trace Macrocell) register offsets */ +#define STM_STMHEER_OFFSET (0xD00UL) /* Hardware Event Enable Register */ +#define STM_STMHEMCR_OFFSET (0xD64UL) /* Hardware Event Master Control Register */ +#define STM_STMSPER_OFFSET (0xE00UL) /* Stimulus Port Enable Register */ +#define STM_STMTCSR_OFFSET (0xE80UL) /* Trace Control and Status Register */ +#define STM_STMTSFREQR_OFFSET (0xE8CUL) /* Timestamp Frequency Register */ +#define STM_STMSYNCR_OFFSET (0xE90UL) /* Synchronization Control Register */ +#define STM_STMAUXCR_OFFSET (0xE94UL) /* Auxiliary Control Register */ + +/* TPIU (Trace Port Interface Unit) register offsets */ +#define TPIU_CSPSR_OFFSET (0x004UL) /* Current Parallel Port Size Register */ +#define TPIU_FFCR_OFFSET (0x304UL) /* Formatter and Flush Control Register */ +#define TPIU_FSCR_OFFSET (0x308UL) /* Formatter Synchronization Counter Register */ + +/* CTI (Cross Trigger Interface) register offsets */ +#define CTI_CTICONTROL_OFFSET (0x000UL) /* CTI Control Register */ +#define CTI_CTIOUTEN0_OFFSET (0x0A0UL) /* CTI Trigger Output Enable Register 0 */ +#define CTI_CTIGATE_OFFSET (0x140UL) /* CTI Channel Gate Enable Register */ + +/* TSGEN (Timestamp Generator) register offsets */ +#define TSGEN_CNTCR_OFFSET (0x000UL) /* Counter Control Register */ +#define TSGEN_CNTFID0_OFFSET (0x020UL) /* Counter Frequency ID Register 0 */ + +/* Lock Status Register (LSR) bit fields */ +#define CORESIGHT_LSR_LOCKED_Pos (1UL) +#define CORESIGHT_LSR_LOCKED_Msk (0x1UL << CORESIGHT_LSR_LOCKED_Pos) +#define CORESIGHT_LSR_PRESENT_Pos (0UL) +#define CORESIGHT_LSR_PRESENT_Msk (0x1UL << CORESIGHT_LSR_PRESENT_Pos) + +/* STM Trace Control and Status Register (STMTCSR) bit fields */ +#define STM_STMTCSR_EN_Pos (0UL) +#define STM_STMTCSR_EN_Msk (0x1UL << STM_STMTCSR_EN_Pos) +#define STM_STMTCSR_TSEN_Pos (1UL) +#define STM_STMTCSR_TSEN_Msk (0x1UL << STM_STMTCSR_TSEN_Pos) +#define STM_STMTCSR_TRACEID_Pos (16UL) +#define STM_STMTCSR_TRACEID_Msk (0x7FUL << STM_STMTCSR_TRACEID_Pos) + +/* STM Hardware Event Master Control Register (STMHEMCR) bit fields */ +#define STM_STMHEMCR_EN_Pos (0UL) +#define STM_STMHEMCR_EN_Msk (0x1UL << STM_STMHEMCR_EN_Pos) + +/* STM Auxiliary Control Register (STMAUXCR) bit fields */ +#define STM_STMAUXCR_FIFOAF_Pos (0UL) +#define STM_STMAUXCR_FIFOAF_Msk (0x1UL << STM_STMAUXCR_FIFOAF_Pos) + +/* CTI Control Register (CTICONTROL) bit fields */ +#define CTI_CTICONTROL_GLBEN_Pos (0UL) +#define CTI_CTICONTROL_GLBEN_Msk (0x1UL << CTI_CTICONTROL_GLBEN_Pos) + +/* TPIU Formatter and Flush Control Register (FFCR) bit fields */ +#define TPIU_FFCR_ENFCONT_Pos (1UL) +#define TPIU_FFCR_ENFCONT_Msk (0x1UL << TPIU_FFCR_ENFCONT_Pos) +#define TPIU_FFCR_FONFLIN_Pos (4UL) +#define TPIU_FFCR_FONFLIN_Msk (0x1UL << TPIU_FFCR_FONFLIN_Pos) +#define TPIU_FFCR_ENFTC_Pos (0UL) +#define TPIU_FFCR_ENFTC_Msk (0x1UL << TPIU_FFCR_ENFTC_Pos) + +/* ETR Mode Register bit fields */ +#define ETR_MODE_MODE_Pos (0UL) +#define ETR_MODE_MODE_Msk (0x3UL << ETR_MODE_MODE_Pos) +#define ETR_MODE_MODE_CIRCULARBUF (0UL) /* Circular Buffer mode */ +#define ETR_MODE_MODE_SWFIFO1 (1UL) /* Software FIFO mode */ +#define ETR_MODE_MODE_HWFIFO (2UL) /* Hardware FIFO mode */ +#define ETR_MODE_MODE_SWFIFO2 (3UL) /* Software FIFO mode */ + +/* ETR Control Register bit fields */ +#define ETR_CTL_TRACECAPTEN_Pos (0UL) +#define ETR_CTL_TRACECAPTEN_Msk (0x1UL << ETR_CTL_TRACECAPTEN_Pos) + +/* ETR Formatter and Flush Control Register (FFCR) bit fields */ +#define ETR_FFCR_ENFT_Pos (0UL) +#define ETR_FFCR_ENFT_Msk (0x1UL << ETR_FFCR_ENFT_Pos) +#define ETR_FFCR_ENTI_Pos (1UL) +#define ETR_FFCR_ENTI_Msk (0x1UL << ETR_FFCR_ENTI_Pos) + +/* ATB Funnel Control Register bit fields */ +#define ATBFUNNEL_CTRLREG_ENS0_Pos (0UL) +#define ATBFUNNEL_CTRLREG_ENS0_Msk (0x1UL << ATBFUNNEL_CTRLREG_ENS0_Pos) +#define ATBFUNNEL_CTRLREG_ENS1_Pos (1UL) +#define ATBFUNNEL_CTRLREG_ENS1_Msk (0x1UL << ATBFUNNEL_CTRLREG_ENS1_Pos) +#define ATBFUNNEL_CTRLREG_ENS2_Pos (2UL) +#define ATBFUNNEL_CTRLREG_ENS2_Msk (0x1UL << ATBFUNNEL_CTRLREG_ENS2_Pos) +#define ATBFUNNEL_CTRLREG_ENS3_Pos (3UL) +#define ATBFUNNEL_CTRLREG_ENS3_Msk (0x1UL << ATBFUNNEL_CTRLREG_ENS3_Pos) +#define ATBFUNNEL_CTRLREG_ENS4_Pos (4UL) +#define ATBFUNNEL_CTRLREG_ENS4_Msk (0x1UL << ATBFUNNEL_CTRLREG_ENS4_Pos) +#define ATBFUNNEL_CTRLREG_ENS5_Pos (5UL) +#define ATBFUNNEL_CTRLREG_ENS5_Msk (0x1UL << ATBFUNNEL_CTRLREG_ENS5_Pos) +#define ATBFUNNEL_CTRLREG_ENS6_Pos (6UL) +#define ATBFUNNEL_CTRLREG_ENS6_Msk (0x1UL << ATBFUNNEL_CTRLREG_ENS6_Pos) +#define ATBFUNNEL_CTRLREG_ENS7_Pos (7UL) +#define ATBFUNNEL_CTRLREG_ENS7_Msk (0x1UL << ATBFUNNEL_CTRLREG_ENS7_Pos) +#define ATBFUNNEL_CTRLREG_HT_Pos (8UL) +#define ATBFUNNEL_CTRLREG_HT_Msk (0xFUL << ATBFUNNEL_CTRLREG_HT_Pos) + +/* TSGEN Counter Control Register bit fields */ +#define TSGEN_CNTCR_EN_Pos (0UL) +#define TSGEN_CNTCR_EN_Msk (0x1UL << TSGEN_CNTCR_EN_Pos) + +/** + * @brief Check if a CoreSight peripheral is locked + * + * @param base_addr Base address of CoreSight peripheral + * @return true if peripheral is locked, false otherwise + */ +static inline bool coresight_is_locked(mem_addr_t base_addr) +{ + uint32_t lsr = *(volatile uint32_t *)(base_addr + CORESIGHT_LSR_OFFSET); + + return (lsr & CORESIGHT_LSR_LOCKED_Msk) != 0; +} + +/** + * @brief Unlock a CoreSight peripheral + * + * @param base_addr Base address of CoreSight peripheral + * @retval 0 on success + * @retval -EIO if unlock operation failed + */ +static inline int coresight_unlock(mem_addr_t base_addr) +{ + *(volatile uint32_t *)(base_addr + CORESIGHT_LAR_OFFSET) = CORESIGHT_UNLOCK_KEY; + + if (coresight_is_locked(base_addr)) { + return -EIO; + } + + return 0; +} + +/** + * @brief Lock a CoreSight peripheral + * + * @param base_addr Base address of CoreSight peripheral + * @retval 0 on success + * @retval -EIO if lock operation failed + */ +static inline int coresight_lock(mem_addr_t base_addr) +{ + /* Write any value other than unlock key to Lock Access Register to lock */ + *(volatile uint32_t *)(base_addr + CORESIGHT_LAR_OFFSET) = 0x00000000; + + if (!coresight_is_locked(base_addr)) { + return -EIO; + } + + return 0; +} + +#ifdef __cplusplus +} +#endif + +#endif /* CORESIGHT_ARM_H_ */ diff --git a/drivers/debug/debug_coresight_nrf.c b/drivers/debug/debug_coresight_nrf.c new file mode 100644 index 000000000000..7bc9bab68ee0 --- /dev/null +++ b/drivers/debug/debug_coresight_nrf.c @@ -0,0 +1,281 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include +#include +#include + +#undef ETR_MODE_MODE_CIRCULARBUF + +#include "coresight_arm.h" + +#define DT_DRV_COMPAT nordic_coresight_nrf + +#include +LOG_MODULE_REGISTER(cs_trace, CONFIG_DEBUG_CORESIGHT_NRF_LOG_LEVEL); + +#define CTI_CH_TPIU_FLUSH_REQ_OFFSET (1) + +#define TS_CLOCKRATE \ + (DT_PROP(DT_NODELABEL(hsfll200), clock_frequency) / \ + CONFIG_DEBUG_CORESIGHT_NRF_TSGEN_CLK_DIV) + +#define ATBREPLICATOR_IDFILTER_FORWARD_STM \ + BIT(CONFIG_DEBUG_CORESIGHT_NRF_ATB_TRACE_ID_STM_GLOBAL >> 4) +#define ATBFUNNEL211_STM_ENS_MASK BIT(2) + +enum coresight_nrf_mode { + CORESIGHT_NRF_MODE_UNCONFIGURED, + CORESIGHT_NRF_MODE_STM_TPIU, + CORESIGHT_NRF_MODE_STM_ETR, +}; + +struct coresight_nrf_config { + enum coresight_nrf_mode mode; + const struct pinctrl_dev_config *pcfg; +}; + +static void nrf_tsgen_init(void) +{ + mem_addr_t tsgen = DT_REG_ADDR(DT_NODELABEL(tsgen)); + + coresight_unlock(tsgen); + + sys_write32(TS_CLOCKRATE, tsgen + TSGEN_CNTFID0_OFFSET); + sys_write32(TSGEN_CNTCR_EN_Msk, tsgen + TSGEN_CNTCR_OFFSET); + + coresight_lock(tsgen); + + LOG_INF("CoreSight Host TSGEN initialized with clockrate %u", TS_CLOCKRATE); +} + +static void nrf_cti_for_tpiu_init(void) +{ + mem_addr_t cti210 = DT_REG_ADDR(DT_NODELABEL(cti210)); + + coresight_unlock(cti210); + + /* Connect CTI channel to TPIU formatter flushin */ + sys_write32(BIT(CTI_CH_TPIU_FLUSH_REQ_OFFSET), cti210 + CTI_CTIOUTEN0_OFFSET); + sys_write32(BIT(CTI_CH_TPIU_FLUSH_REQ_OFFSET), cti210 + CTI_CTIGATE_OFFSET); + sys_write32(CTI_CTICONTROL_GLBEN_Msk, cti210 + CTI_CTICONTROL_OFFSET); + + coresight_lock(cti210); + + LOG_INF("CoreSight Host CTI initialized"); +} + +static void nrf_tpiu_init(void) +{ + mem_addr_t tpiu = DT_REG_ADDR(DT_NODELABEL(tpiu)); + + coresight_unlock(tpiu); + + sys_write32(BIT((CONFIG_DEBUG_CORESIGHT_NRF_TPIU_PORTSIZE - 1)), tpiu + TPIU_CSPSR_OFFSET); + + /* Continuous formatting */ + if (IS_ENABLED(CONFIG_DEBUG_CORESIGHT_NRF_TPIU_FFCR_TRIG)) { + sys_write32((TPIU_FFCR_ENFCONT_Msk | TPIU_FFCR_FONFLIN_Msk | TPIU_FFCR_ENFTC_Msk), + tpiu + TPIU_FFCR_OFFSET); + } else { + sys_write32((TPIU_FFCR_ENFCONT_Msk | TPIU_FFCR_ENFTC_Msk), tpiu + TPIU_FFCR_OFFSET); + } + + sys_write32(CONFIG_DEBUG_CORESIGHT_NRF_TPIU_SYNC_FRAME_COUNT, tpiu + TPIU_FSCR_OFFSET); + + coresight_lock(tpiu); + + LOG_INF("CoreSight Host TPIU initialized"); +} + +static void nrf_etr_init(uintptr_t buf, size_t buf_word_len) +{ + mem_addr_t etr = DT_REG_ADDR(DT_NODELABEL(etr)); + + coresight_unlock(etr); + + sys_write32(buf_word_len, etr + ETR_RSZ_OFFSET); + sys_write32(buf, etr + ETR_RWP_OFFSET); + sys_write32(buf, etr + ETR_DBALO_OFFSET); + sys_write32(0UL, etr + ETR_DBAHI_OFFSET); + sys_write32(ETR_FFCR_ENFT_Msk, etr + ETR_FFCR_OFFSET); + sys_write32(ETR_MODE_MODE_CIRCULARBUF, etr + ETR_MODE_OFFSET); + sys_write32(ETR_CTL_TRACECAPTEN_Msk, etr + ETR_CTL_OFFSET); + + coresight_lock(etr); + + LOG_INF("Coresight Host ETR initialized"); +} + +static void nrf_stm_init(void) +{ + mem_addr_t stm = DT_REG_ADDR(DT_NODELABEL(stm)); + + coresight_unlock(stm); + + sys_write32(1, stm + STM_STMAUXCR_OFFSET); + + sys_write32(TS_CLOCKRATE, stm + STM_STMTSFREQR_OFFSET); + + sys_write32((CONFIG_DEBUG_CORESIGHT_NRF_STM_SYNC_BYTE_COUNT & 0xFFF), + stm + STM_STMSYNCR_OFFSET); + + sys_write32(0xFFFFFFFF, stm + STM_STMSPER_OFFSET); + + if (IS_ENABLED(CONFIG_DEBUG_CORESIGHT_NRF_STM_HWEVENTS)) { + sys_write32(0xFFFFFFFF, stm + STM_STMHEER_OFFSET); + sys_write32((1 << STM_STMHEMCR_EN_Pos), stm + STM_STMHEMCR_OFFSET); + } + + sys_write32(((CONFIG_DEBUG_CORESIGHT_NRF_ATB_TRACE_ID_STM_GLOBAL & STM_STMTCSR_TRACEID_Msk) + << STM_STMTCSR_TRACEID_Pos) | + (1 << STM_STMTCSR_EN_Pos) | (1 << STM_STMTCSR_TSEN_Pos), + stm + STM_STMTCSR_OFFSET); + + coresight_lock(stm); + + LOG_INF("CoreSight STM initialized with clockrate %u", TS_CLOCKRATE); +} + +static void nrf_atbfunnel_init(mem_addr_t funnel_addr, uint32_t enable_set_mask) +{ + coresight_unlock(funnel_addr); + + uint32_t ctrlreg_old = sys_read32(funnel_addr + ATBFUNNEL_CTRLREG_OFFSET); + + const uint32_t funnel_hold_time = (((CONFIG_DEBUG_CORESIGHT_NRF_ATBFUNNEL_HOLD_TIME - 1) + << ATBFUNNEL_CTRLREG_HT_Pos) & + ATBFUNNEL_CTRLREG_HT_Msk); + + uint32_t ctrlreg_new = (ctrlreg_old & ~ATBFUNNEL_CTRLREG_HT_Msk) | funnel_hold_time | + (enable_set_mask & 0xFF); + + sys_write32(ctrlreg_new, funnel_addr + ATBFUNNEL_CTRLREG_OFFSET); + + coresight_lock(funnel_addr); +} + +static void nrf_atbreplicator_init(mem_addr_t replicator_addr, uint32_t filter, bool ch0_allow, + bool ch1_allow) +{ + coresight_unlock(replicator_addr); + + uint32_t ch0_current = sys_read32(replicator_addr + ATBREPLICATOR_IDFILTER0_OFFSET); + uint32_t ch1_current = sys_read32(replicator_addr + ATBREPLICATOR_IDFILTER1_OFFSET); + + if (ch0_allow) { + sys_write32(ch0_current & ~filter, + replicator_addr + ATBREPLICATOR_IDFILTER0_OFFSET); + } else { + sys_write32(ch0_current | filter, replicator_addr + ATBREPLICATOR_IDFILTER0_OFFSET); + } + + if (ch1_allow) { + sys_write32(ch1_current & ~filter, + replicator_addr + ATBREPLICATOR_IDFILTER1_OFFSET); + } else { + sys_write32(ch1_current | filter, replicator_addr + ATBREPLICATOR_IDFILTER1_OFFSET); + } + + coresight_lock(replicator_addr); +} + +static int coresight_nrf_init_stm_etr(uintptr_t buf, size_t buf_word_len) +{ + mem_addr_t atbfunnel211 = DT_REG_ADDR(DT_NODELABEL(atbfunnel211)); + mem_addr_t atbreplicator210 = DT_REG_ADDR(DT_NODELABEL(atbreplicator210)); + mem_addr_t atbreplicator213 = DT_REG_ADDR(DT_NODELABEL(atbreplicator213)); + + nrf_atbfunnel_init(atbfunnel211, ATBFUNNEL211_STM_ENS_MASK); + nrf_atbreplicator_init(atbreplicator210, ATBREPLICATOR_IDFILTER_FORWARD_STM, false, true); + nrf_atbreplicator_init(atbreplicator213, ATBREPLICATOR_IDFILTER_FORWARD_STM, false, true); + + nrf_tsgen_init(); + nrf_etr_init(buf, buf_word_len); + nrf_stm_init(); + + return 0; +} + +static int coresight_nrf_init_stm_tpiu(void) +{ + mem_addr_t atbfunnel211 = DT_REG_ADDR(DT_NODELABEL(atbfunnel211)); + mem_addr_t atbreplicator210 = DT_REG_ADDR(DT_NODELABEL(atbreplicator210)); + mem_addr_t atbreplicator213 = DT_REG_ADDR(DT_NODELABEL(atbreplicator213)); + + nrf_atbfunnel_init(atbfunnel211, ATBFUNNEL211_STM_ENS_MASK); + nrf_atbreplicator_init(atbreplicator210, ATBREPLICATOR_IDFILTER_FORWARD_STM, false, true); + nrf_atbreplicator_init(atbreplicator213, ATBREPLICATOR_IDFILTER_FORWARD_STM, true, false); + + nrf_tsgen_init(); + nrf_cti_for_tpiu_init(); + nrf_tpiu_init(); + nrf_stm_init(); + + return 0; +} + +static int coresight_nrf_init(const struct device *dev) +{ + int err; + struct coresight_nrf_config *cfg = (struct coresight_nrf_config *)dev->config; + + if (cfg->pcfg) { + err = pinctrl_apply_state(cfg->pcfg, PINCTRL_STATE_DEFAULT); + if (err) { + LOG_ERR("Failed to configure pins (%d)", err); + return err; + } + } + + err = ironside_se_tdd_configure(IRONSIDE_SE_TDD_CONFIG_ON_DEFAULT); + if (err) { + LOG_ERR("Failed to configure TDD (%d)", err); + return err; + } + + switch (cfg->mode) { + case CORESIGHT_NRF_MODE_UNCONFIGURED: { + return 0; + } + case CORESIGHT_NRF_MODE_STM_TPIU: { + return coresight_nrf_init_stm_tpiu(); + } + case CORESIGHT_NRF_MODE_STM_ETR: { + uintptr_t etr_buffer = DT_REG_ADDR(DT_NODELABEL(etr_buffer)); + size_t buf_word_len = DT_REG_SIZE(DT_NODELABEL(etr_buffer)) / sizeof(uint32_t); + + return coresight_nrf_init_stm_etr(etr_buffer, buf_word_len); + } + default: { + LOG_ERR("Unsupported Coresight mode"); + return -ENOTSUP; + } + } + return 0; +} + +#define DEBUG_CORESIGHT_NRF_INIT_PRIORITY UTIL_INC(CONFIG_NRF_IRONSIDE_CALL_INIT_PRIORITY) + +#define CORESIGHT_NRF_INST(inst) \ + COND_CODE_1(DT_INST_PINCTRL_HAS_IDX(inst, 0), \ + (PINCTRL_DT_INST_DEFINE(inst);), ()) \ + \ + static struct coresight_nrf_config coresight_nrf_cfg_##inst = { \ + .mode = _CONCAT(CORESIGHT_NRF_MODE_, \ + DT_STRING_UPPER_TOKEN(DT_DRV_INST(inst), mode)), \ + .pcfg = COND_CODE_1(DT_INST_PINCTRL_HAS_IDX(inst, 0), \ + (PINCTRL_DT_INST_DEV_CONFIG_GET(inst)), \ + (NULL)) }; \ + \ + DEVICE_DT_INST_DEFINE(inst, coresight_nrf_init, NULL, NULL, &coresight_nrf_cfg_##inst, \ + POST_KERNEL, DEBUG_CORESIGHT_NRF_INIT_PRIORITY, NULL); + +DT_INST_FOREACH_STATUS_OKAY(CORESIGHT_NRF_INST) diff --git a/drivers/debug/debug_nrf_etr.c b/drivers/debug/debug_nrf_etr.c index da425716dbbe..d536cd4a9f40 100644 --- a/drivers/debug/debug_nrf_etr.c +++ b/drivers/debug/debug_nrf_etr.c @@ -768,6 +768,7 @@ int etr_process_init(void) IRQ_CONNECT(DT_IRQN(DT_NODELABEL(tbm)), DT_IRQ(DT_NODELABEL(tbm), priority), nrfx_isr, nrfx_tbm_irq_handler, 0); irq_enable(DT_IRQN(DT_NODELABEL(tbm))); + nrfx_tbm_start(); #ifdef CONFIG_DEBUG_NRF_ETR_SHELL uint32_t level = CONFIG_LOG_MAX_LEVEL; @@ -791,7 +792,17 @@ int etr_process_init(void) return 0; } -SYS_INIT(etr_process_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); +#define NRF_ETR_INIT_PRIORITY UTIL_INC(UTIL_INC(CONFIG_NRF_IRONSIDE_CALL_INIT_PRIORITY)) + +SYS_INIT(etr_process_init, POST_KERNEL, NRF_ETR_INIT_PRIORITY); + +#if defined(CONFIG_NORDIC_VPR_LAUNCHER) && defined(CONFIG_LOG_FRONTEND_STMESP_FSC) +/* TDD/ETR must be up and running before VPR cores are started as they write to + * ETR some vital initial data that cannot be lost. + */ +BUILD_ASSERT(CONFIG_NORDIC_VPR_LAUNCHER_INIT_PRIORITY > NRF_ETR_INIT_PRIORITY); +#endif + #ifdef CONFIG_DEBUG_NRF_ETR_SHELL diff --git a/dts/bindings/arm/nordic,nrf-tddconf.yaml b/dts/bindings/arm/nordic,nrf-tddconf.yaml deleted file mode 100644 index 2273082c12f9..000000000000 --- a/dts/bindings/arm/nordic,nrf-tddconf.yaml +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -description: | - Nordic TRACE and Debug Domain - - Configuration for the Trace and Debug subsystem - -compatible: "nordic,nrf-tddconf" - -include: base.yaml - -properties: - etbsources: - type: int - description: | - Bitmask of enabled sources for the ETB sink. Valid values can be found in - dt-bindings/misc/nordic-tddconf.h - - tpiusources: - type: int - description: | - Bitmask of enabled sources for the TPIU sink. Valid values can be found in - dt-bindings/misc/nordic-tddconf.h - - etrsources: - type: int - description: | - Bitmask of enabled sources for the ETR sink. Valid values can be found in - dt-bindings/misc/nordic-tddconf.h - - portconfig: - type: int - default: 3 - description: TPIU clock divider - TDD HSFLL / 2^(2 + portconfig) - enum: - - 0 - - 1 - - 2 - - 3 - - etrbuffer: - description: phandle to the memory region used for the ETR buffer - type: phandle diff --git a/dts/bindings/debug/nordic,coresight-nrf.yaml b/dts/bindings/debug/nordic,coresight-nrf.yaml new file mode 100644 index 000000000000..fec4f37ce5a9 --- /dev/null +++ b/dts/bindings/debug/nordic,coresight-nrf.yaml @@ -0,0 +1,22 @@ +# Copyright (c) 2025 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: Nordic Coresight Subsystem (Trace Port Interface Unit) + +compatible: "nordic,coresight-nrf" + +include: [base.yaml, pinctrl-device.yaml, nordic-clockpin.yaml] + +properties: + reg: + required: true + + mode: + required: true + type: string + enum: + - "unconfigured" + - "stm-tpiu" + - "stm-etr" + description: > + Specifies which mode to configure the Coresight subsystem in. diff --git a/dts/vendor/nordic/nrf54h20.dtsi b/dts/vendor/nordic/nrf54h20.dtsi index 56b807fafd48..62b9c39e3c6e 100644 --- a/dts/vendor/nordic/nrf54h20.dtsi +++ b/dts/vendor/nordic/nrf54h20.dtsi @@ -13,7 +13,6 @@ #include #include #include -#include /delete-node/ &sw_pwm; @@ -541,10 +540,82 @@ interrupts = <127 NRF_DEFAULT_IRQ_PRIORITY>; }; - tddconf: tddconf@1000 { - compatible = "nordic,nrf-tddconf"; - reg = <0x1000 0x10>; + hsfll200: clock@4000 { + compatible = "fixed-clock"; + reg = <0x4000 0x1000>; + #clock-cells = <0>; + status = "disabled"; + clock-frequency = ; + }; + + coresight: coresight@40000 { + compatible = "nordic,coresight-nrf"; + reg = <0x40000 0x11000>; status = "disabled"; + nordic,clockpin-enable = ; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x40000 0x11000>; + + tsgen: tsgen@1000 { + reg = <0x1000 0x1000>; + }; + + stm: stm@2000 { + reg = <0x2000 0x1000>; + }; + + tpiu: tpiu@3000 { + reg = <0x3000 0x1000>; + }; + + etb: etb@4000 { + reg = <0x4000 0x1000>; + }; + + etr: etr@5000 { + reg = <0x5000 0x1000>; + }; + + cti210: cti@6000 { + reg = <0x6000 0x1000>; + }; + + cti211: cti@7000 { + reg = <0x7000 0x1000>; + }; + + atbreplicator210: atbreplicator@8000 { + reg = <0x8000 0x1000>; + }; + + atbreplicator211: atbreplicator@9000 { + reg = <0x9000 0x1000>; + }; + + atbreplicator212: atbreplicator@A000 { + reg = <0xA000 0x1000>; + }; + + atbreplicator213: atbreplicator@B000 { + reg = <0xB000 0x1000>; + }; + + atbfunnel210: atbfunnel@C000 { + reg = <0xC000 0x1000>; + }; + + atbfunnel211: atbfunnel@D000 { + reg = <0xD000 0x1000>; + }; + + atbfunnel212: atbfunnel@E000 { + reg = <0xE000 0x1000>; + }; + + atbfunnel213: atbfunnel@F000 { + reg = <0xF000 0x1000>; + }; }; }; diff --git a/include/zephyr/dt-bindings/misc/nordic-tddconf.h b/include/zephyr/dt-bindings/misc/nordic-tddconf.h deleted file mode 100644 index 44bc74e491c0..000000000000 --- a/include/zephyr/dt-bindings/misc/nordic-tddconf.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_MISC_NORDIC_TDDCONF_H_ -#define ZEPHYR_INCLUDE_DT_BINDINGS_MISC_NORDIC_TDDCONF_H_ - -#define NRF_TDDCONF_SOURCE_STMMAINCORE BIT(0) -#define NRF_TDDCONF_SOURCE_ETMMAINCORE BIT(1) -#define NRF_TDDCONF_SOURCE_STMHWEVENTS BIT(2) -#define NRF_TDDCONF_SOURCE_STMPPR BIT(3) -#define NRF_TDDCONF_SOURCE_STMFLPR BIT(4) - -#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_MISC_NORDIC_TDDCONF_H_ */ diff --git a/soc/nordic/common/uicr/gen_periphconf_entries.py b/soc/nordic/common/uicr/gen_periphconf_entries.py index d3b79e43f149..9a273dab7a59 100644 --- a/soc/nordic/common/uicr/gen_periphconf_entries.py +++ b/soc/nordic/common/uicr/gen_periphconf_entries.py @@ -121,6 +121,10 @@ def main() -> None: for node in dt.label2node["global_peripherals"].children.values(): builder.add_global_peripheral_cfg(node, **get_additional_node_kwargs(node)) + # TDD (Trace and Debug Domain) peripherals - contains coresight/TPIU + for node in dt.label2node["tdd_peripherals"].children.values(): + builder.add_global_peripheral_cfg(node, **get_additional_node_kwargs(node)) + # Add pins referenced by 'gpios' properties on non-peripheral nodes, for example # buttons and leds. We only add SPU configurations for these and not CTRLSEL, # to avoid false CTRLSEL conflicts for things like PWM leds. diff --git a/soc/nordic/nrf54h/Kconfig b/soc/nordic/nrf54h/Kconfig index a2ef5f1eb183..d4c86932a2c4 100644 --- a/soc/nordic/nrf54h/Kconfig +++ b/soc/nordic/nrf54h/Kconfig @@ -66,17 +66,6 @@ config SOC_NRF54H20_CPURAD_COMMON select HAS_PM select HAS_POWEROFF -config SOC_NRF54H20_TDD_ENABLE - bool "Power and configure the trace and debug domain (TDD)" - depends on SOC_NRF54H20_CPUAPP - select NRF_IRONSIDE_TDD_SERVICE - select SOC_LATE_INIT_HOOK - help - This will at application boot time request that the trace and - debug domain (TDD) is powered up and configured. - This allows configuring the coresight peripherals from - the application domain. - config SOC_NRF54H20_CPURAD_ENABLE bool "Boot the nRF54H20 Radio core" default y if NRF_802154_SER_HOST || BT_HCI_HOST diff --git a/soc/nordic/nrf54h/soc.c b/soc/nordic/nrf54h/soc.c index 6692425f6748..3d1fdfe5c05b 100644 --- a/soc/nordic/nrf54h/soc.c +++ b/soc/nordic/nrf54h/soc.c @@ -23,14 +23,10 @@ #include #include #include -#include #if defined(CONFIG_SOC_NRF54H20_CPURAD_ENABLE) #include #endif -#if defined(CONFIG_SOC_NRF54H20_TDD_ENABLE) -#include -#endif LOG_MODULE_REGISTER(soc, CONFIG_SOC_LOG_LEVEL); @@ -195,20 +191,6 @@ void soc_early_init_hook(void) void soc_late_init_hook(void) { -#if defined(CONFIG_SOC_NRF54H20_TDD_ENABLE) - int err_tdd; - - err_tdd = ironside_se_tdd_configure(IRONSIDE_SE_TDD_CONFIG_ON_DEFAULT); - __ASSERT(err_tdd == 0, "err_tdd was %d", err_tdd); - - UICR_GPIO_PIN_CNF_CTRLSEL_SET(NRF_P7, 3, GPIO_PIN_CNF_CTRLSEL_TND); - UICR_GPIO_PIN_CNF_CTRLSEL_SET(NRF_P7, 4, GPIO_PIN_CNF_CTRLSEL_TND); - UICR_GPIO_PIN_CNF_CTRLSEL_SET(NRF_P7, 5, GPIO_PIN_CNF_CTRLSEL_TND); - UICR_GPIO_PIN_CNF_CTRLSEL_SET(NRF_P7, 6, GPIO_PIN_CNF_CTRLSEL_TND); - UICR_GPIO_PIN_CNF_CTRLSEL_SET(NRF_P7, 7, GPIO_PIN_CNF_CTRLSEL_TND); - -#endif - #if defined(CONFIG_SOC_NRF54H20_CPURAD_ENABLE) int err_cpuconf; From f080f4af904c55c967ebd4f3caf70f07af825ad0 Mon Sep 17 00:00:00 2001 From: Karsten Koenig Date: Wed, 27 Aug 2025 21:42:37 +0200 Subject: [PATCH 1857/2141] [nrf fromtree] snippets: nordic-log-stm: Updated for coresight Replaced the old tddconf with the full coresight driver that configures the coresight peripherals locally on the running core. Also fixed minor bug in the corresponding sample where messages were not shown for the radio core. Signed-off-by: Karsten Koenig (cherry picked from commit 02fb6fa1c8df4e1401430f1012f2e3eb37f991bb) --- samples/boards/nordic/coresight_stm/prj.conf | 1 + .../nordic-log-stm-dict/boards/nrf54h20_cpuapp.overlay | 7 ++----- .../nordic-log-stm-dict/boards/nrf54h20_cpurad.overlay | 9 --------- snippets/nordic/nordic-log-stm-dict/log_stm_dict.conf | 1 + snippets/nordic/nordic-log-stm-dict/snippet.yml | 3 --- .../nordic/nordic-log-stm/boards/nrf54h20_cpuapp.overlay | 7 ++----- .../nordic/nordic-log-stm/boards/nrf54h20_cpurad.overlay | 9 --------- snippets/nordic/nordic-log-stm/log_stm.conf | 1 + snippets/nordic/nordic-log-stm/snippet.yml | 3 --- 9 files changed, 7 insertions(+), 34 deletions(-) delete mode 100644 snippets/nordic/nordic-log-stm-dict/boards/nrf54h20_cpurad.overlay delete mode 100644 snippets/nordic/nordic-log-stm/boards/nrf54h20_cpurad.overlay diff --git a/samples/boards/nordic/coresight_stm/prj.conf b/samples/boards/nordic/coresight_stm/prj.conf index 1e935e973c76..9ee7cf8cc03a 100644 --- a/samples/boards/nordic/coresight_stm/prj.conf +++ b/samples/boards/nordic/coresight_stm/prj.conf @@ -1 +1,2 @@ CONFIG_LOG=y +CONFIG_SOC_NRF54H20_CPURAD_ENABLE=y diff --git a/snippets/nordic/nordic-log-stm-dict/boards/nrf54h20_cpuapp.overlay b/snippets/nordic/nordic-log-stm-dict/boards/nrf54h20_cpuapp.overlay index fec548173648..962aa231b7a9 100644 --- a/snippets/nordic/nordic-log-stm-dict/boards/nrf54h20_cpuapp.overlay +++ b/snippets/nordic/nordic-log-stm-dict/boards/nrf54h20_cpuapp.overlay @@ -7,10 +7,7 @@ status = "okay"; }; -&tddconf { +&coresight { status = "okay"; - etrsources = <(NRF_TDDCONF_SOURCE_STMMAINCORE | NRF_TDDCONF_SOURCE_STMPPR | - NRF_TDDCONF_SOURCE_STMFLPR)>; - portconfig = <0>; - etrbuffer = <&etr_buffer>; + mode = "stm-etr"; }; diff --git a/snippets/nordic/nordic-log-stm-dict/boards/nrf54h20_cpurad.overlay b/snippets/nordic/nordic-log-stm-dict/boards/nrf54h20_cpurad.overlay deleted file mode 100644 index 5bdeddd3c07f..000000000000 --- a/snippets/nordic/nordic-log-stm-dict/boards/nrf54h20_cpurad.overlay +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor - * SPDX-License-Identifier: Apache-2.0 - */ - -&tddconf { - status = "okay"; - etrsources = <(NRF_TDDCONF_SOURCE_STMMAINCORE)>; -}; diff --git a/snippets/nordic/nordic-log-stm-dict/log_stm_dict.conf b/snippets/nordic/nordic-log-stm-dict/log_stm_dict.conf index 7384e36b92a2..0bd8b46d387e 100644 --- a/snippets/nordic/nordic-log-stm-dict/log_stm_dict.conf +++ b/snippets/nordic/nordic-log-stm-dict/log_stm_dict.conf @@ -3,3 +3,4 @@ CONFIG_TEST_LOGGING_DEFAULTS=n CONFIG_LOG_FRONTEND=y CONFIG_LOG_FRONTEND_ONLY=y CONFIG_LOG_FRONTEND_STMESP=y +CONFIG_DEBUG_DRIVER=y diff --git a/snippets/nordic/nordic-log-stm-dict/snippet.yml b/snippets/nordic/nordic-log-stm-dict/snippet.yml index 6e4f1c6d23e1..a717d39399b5 100644 --- a/snippets/nordic/nordic-log-stm-dict/snippet.yml +++ b/snippets/nordic/nordic-log-stm-dict/snippet.yml @@ -5,6 +5,3 @@ boards: /.*/nrf54h20/cpuapp/: append: EXTRA_DTC_OVERLAY_FILE: boards/nrf54h20_cpuapp.overlay - /.*/nrf54h20/cpurad/: - append: - EXTRA_DTC_OVERLAY_FILE: boards/nrf54h20_cpurad.overlay diff --git a/snippets/nordic/nordic-log-stm/boards/nrf54h20_cpuapp.overlay b/snippets/nordic/nordic-log-stm/boards/nrf54h20_cpuapp.overlay index fec548173648..962aa231b7a9 100644 --- a/snippets/nordic/nordic-log-stm/boards/nrf54h20_cpuapp.overlay +++ b/snippets/nordic/nordic-log-stm/boards/nrf54h20_cpuapp.overlay @@ -7,10 +7,7 @@ status = "okay"; }; -&tddconf { +&coresight { status = "okay"; - etrsources = <(NRF_TDDCONF_SOURCE_STMMAINCORE | NRF_TDDCONF_SOURCE_STMPPR | - NRF_TDDCONF_SOURCE_STMFLPR)>; - portconfig = <0>; - etrbuffer = <&etr_buffer>; + mode = "stm-etr"; }; diff --git a/snippets/nordic/nordic-log-stm/boards/nrf54h20_cpurad.overlay b/snippets/nordic/nordic-log-stm/boards/nrf54h20_cpurad.overlay deleted file mode 100644 index 5bdeddd3c07f..000000000000 --- a/snippets/nordic/nordic-log-stm/boards/nrf54h20_cpurad.overlay +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor - * SPDX-License-Identifier: Apache-2.0 - */ - -&tddconf { - status = "okay"; - etrsources = <(NRF_TDDCONF_SOURCE_STMMAINCORE)>; -}; diff --git a/snippets/nordic/nordic-log-stm/log_stm.conf b/snippets/nordic/nordic-log-stm/log_stm.conf index 1325c25b505f..46550a258cd1 100644 --- a/snippets/nordic/nordic-log-stm/log_stm.conf +++ b/snippets/nordic/nordic-log-stm/log_stm.conf @@ -4,3 +4,4 @@ CONFIG_LOG_FRONTEND=y CONFIG_LOG_FRONTEND_ONLY=y CONFIG_LOG_FRONTEND_STMESP=y CONFIG_LOG_FRONTEND_STMESP_FSC=y +CONFIG_DEBUG_DRIVER=y diff --git a/snippets/nordic/nordic-log-stm/snippet.yml b/snippets/nordic/nordic-log-stm/snippet.yml index 0a984a8312cc..918379360afc 100644 --- a/snippets/nordic/nordic-log-stm/snippet.yml +++ b/snippets/nordic/nordic-log-stm/snippet.yml @@ -5,6 +5,3 @@ boards: /.*/nrf54h20/cpuapp/: append: EXTRA_DTC_OVERLAY_FILE: boards/nrf54h20_cpuapp.overlay - /.*/nrf54h20/cpurad/: - append: - EXTRA_DTC_OVERLAY_FILE: boards/nrf54h20_cpurad.overlay From 4a70a65f56e80b3440b0250a82842923e30d48b7 Mon Sep 17 00:00:00 2001 From: Karsten Koenig Date: Wed, 27 Aug 2025 21:50:36 +0200 Subject: [PATCH 1858/2141] [nrf fromtree] drivers: misc: nordic_vpr_launcher: Init order Make sure the nordic_vpr_launcher gets started after the coresight driver if that is present. Signed-off-by: Karsten Koenig (cherry picked from commit 24353a89387d235d9b507a2a6949dca4cb38b82a) --- drivers/misc/nordic_vpr_launcher/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/misc/nordic_vpr_launcher/Kconfig b/drivers/misc/nordic_vpr_launcher/Kconfig index d00bcc583f96..edd2a9ead753 100644 --- a/drivers/misc/nordic_vpr_launcher/Kconfig +++ b/drivers/misc/nordic_vpr_launcher/Kconfig @@ -18,6 +18,7 @@ source "subsys/logging/Kconfig.template.log_config" config NORDIC_VPR_LAUNCHER_INIT_PRIORITY int "Nordic VPR coprocessor launcher init priority" + default 44 if DT_HAS_NORDIC_CORESIGHT_NRF_ENABLED default 0 help The init priority of the VPR coprocessor launcher. From 6cd22c72bc4f07016cce49e83f8ab26bd43d823f Mon Sep 17 00:00:00 2001 From: Karsten Koenig Date: Thu, 28 Aug 2025 18:07:25 +0200 Subject: [PATCH 1859/2141] [nrf fromtree] snippets: nordic-log-stm-tpiu-dict: Added Added a new convience snippet to redirect logs to STM and then sink them to TPIU where they can be captured by a trace probe. Signed-off-by: Karsten Koenig (cherry picked from commit 0b5bb3c8c48b8cc823edd1c68b54f550978d6f0c) --- samples/boards/nordic/coresight_stm/sample.yaml | 7 +++++++ snippets/nordic/nordic-log-stm-tpiu-dict/README.rst | 11 +++++++++++ .../boards/nrf54h20_cpuapp.overlay | 11 +++++++++++ .../nordic/nordic-log-stm-tpiu-dict/log_stm_dict.conf | 6 ++++++ snippets/nordic/nordic-log-stm-tpiu-dict/snippet.yml | 7 +++++++ 5 files changed, 42 insertions(+) create mode 100644 snippets/nordic/nordic-log-stm-tpiu-dict/README.rst create mode 100644 snippets/nordic/nordic-log-stm-tpiu-dict/boards/nrf54h20_cpuapp.overlay create mode 100644 snippets/nordic/nordic-log-stm-tpiu-dict/log_stm_dict.conf create mode 100644 snippets/nordic/nordic-log-stm-tpiu-dict/snippet.yml diff --git a/samples/boards/nordic/coresight_stm/sample.yaml b/samples/boards/nordic/coresight_stm/sample.yaml index 000241d4d979..9ff835d8ffad 100644 --- a/samples/boards/nordic/coresight_stm/sample.yaml +++ b/samples/boards/nordic/coresight_stm/sample.yaml @@ -22,6 +22,13 @@ tests: - SB_CONFIG_APP_CPUPPR_RUN=y - SB_CONFIG_APP_CPUFLPR_RUN=y + sample.boards.nrf.coresight_stm.tpiu.dict: + required_snippets: + - nordic-log-stm-tpiu-dict + extra_args: + - SB_CONFIG_APP_CPUPPR_RUN=y + - SB_CONFIG_APP_CPUFLPR_RUN=y + sample.boards.nrf.coresight_stm: harness: pytest harness_config: diff --git a/snippets/nordic/nordic-log-stm-tpiu-dict/README.rst b/snippets/nordic/nordic-log-stm-tpiu-dict/README.rst new file mode 100644 index 000000000000..9dbf067671bf --- /dev/null +++ b/snippets/nordic/nordic-log-stm-tpiu-dict/README.rst @@ -0,0 +1,11 @@ +.. _nordic-log-stm-tpiu-dict: + +Nordic Dictionary-based STM to TPIU logging snippet (nordic-log-stm-tpiu-dict) +############################################################################## + +Overview +******** + +This snippet allows users to build Zephyr with the dictionary-based logging to +the Coresight STM stimulus ports. Data is written to the TPIU interface and can +be captured with nrfutil trace to translate into a human-readable format. diff --git a/snippets/nordic/nordic-log-stm-tpiu-dict/boards/nrf54h20_cpuapp.overlay b/snippets/nordic/nordic-log-stm-tpiu-dict/boards/nrf54h20_cpuapp.overlay new file mode 100644 index 000000000000..e6f14f46a6a4 --- /dev/null +++ b/snippets/nordic/nordic-log-stm-tpiu-dict/boards/nrf54h20_cpuapp.overlay @@ -0,0 +1,11 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor + * SPDX-License-Identifier: Apache-2.0 + */ + +&coresight { + status = "okay"; + mode = "stm-tpiu"; + pinctrl-0 = <&tpiu_default>; + pinctrl-names = "default"; +}; diff --git a/snippets/nordic/nordic-log-stm-tpiu-dict/log_stm_dict.conf b/snippets/nordic/nordic-log-stm-tpiu-dict/log_stm_dict.conf new file mode 100644 index 000000000000..0bd8b46d387e --- /dev/null +++ b/snippets/nordic/nordic-log-stm-tpiu-dict/log_stm_dict.conf @@ -0,0 +1,6 @@ +CONFIG_LOG=y +CONFIG_TEST_LOGGING_DEFAULTS=n +CONFIG_LOG_FRONTEND=y +CONFIG_LOG_FRONTEND_ONLY=y +CONFIG_LOG_FRONTEND_STMESP=y +CONFIG_DEBUG_DRIVER=y diff --git a/snippets/nordic/nordic-log-stm-tpiu-dict/snippet.yml b/snippets/nordic/nordic-log-stm-tpiu-dict/snippet.yml new file mode 100644 index 000000000000..32cd36d377ea --- /dev/null +++ b/snippets/nordic/nordic-log-stm-tpiu-dict/snippet.yml @@ -0,0 +1,7 @@ +name: nordic-log-stm-tpiu-dict +append: + EXTRA_CONF_FILE: log_stm_dict.conf +boards: + /.*/nrf54h20/cpuapp/: + append: + EXTRA_DTC_OVERLAY_FILE: boards/nrf54h20_cpuapp.overlay From ffece2d65ac776f50a065d7213a76b40ed5caf94 Mon Sep 17 00:00:00 2001 From: Karsten Koenig Date: Mon, 22 Sep 2025 14:27:36 +0200 Subject: [PATCH 1860/2141] [nrf fromtree] boards: nordic: nrf54h20dk: ETM in JLinkScript The JLinkScript originally configured more than needed which reduces readability, so stripped it down to the minimum. At the same time improved behavior under reset and added ETM to the radiocore JLinkScript. Signed-off-by: Karsten Koenig (cherry picked from commit a50dc9fb8a894fca284e1f2db1c4d5186f479d5c) --- .../support/nrf54h20_cpuapp.JLinkScript | 139 ++++++++-------- .../support/nrf54h20_cpurad.JLinkScript | 149 +++++++++++++++++- 2 files changed, 210 insertions(+), 78 deletions(-) diff --git a/boards/nordic/nrf54h20dk/support/nrf54h20_cpuapp.JLinkScript b/boards/nordic/nrf54h20dk/support/nrf54h20_cpuapp.JLinkScript index 9738ec77f437..d79c93417455 100644 --- a/boards/nordic/nrf54h20dk/support/nrf54h20_cpuapp.JLinkScript +++ b/boards/nordic/nrf54h20dk/support/nrf54h20_cpuapp.JLinkScript @@ -1,3 +1,9 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + __constant U32 _CPUCONF_ADDR = 0x52011000; __constant U32 _CPUCONF_CPUWAIT_OFFSET = 0x50C; @@ -5,32 +11,17 @@ __constant U32 _CPUCONF_CPUWAIT_OFFSET = 0x50C; __constant U32 _ATBFUNNEL211_ADDR = 0xBF04D000; __constant U32 _ATBFUNNEL212_ADDR = 0xBF04E000; __constant U32 _ATBFUNNEL_CTRLREG_OFFSET = 0x0; +__constant U32 _ATBFUNNEL_HOLDTIME_MASK = 0x700; __constant U32 _HOLDTIME_4 = 0x300; -__constant U32 _ENS0 = 0x1; -__constant U32 _ENS1 = 0x2; -__constant U32 _ENS2 = 0x4; +__constant U32 _ENS0 = 0x1; // Application Core +__constant U32 _ENS1 = 0x2; // Radio Core // ATBREPLICATOR __constant U32 _ATBREPLICATOR212_ADDR = 0xBF04A000; __constant U32 _ATBREPLICATOR213_ADDR = 0xBF04B000; __constant U32 _ATBREPLICATOR_IDFILTER0_OFFSET = 0x0; __constant U32 _ATBREPLICATOR_IDFILTER1_OFFSET = 0x4; -__constant U32 _ID_NONE = 0xFFFFFFFF; -__constant U32 _ID1x = 0xFFFFFFFD; - -// TSGEN -__constant U32 _TSGEN_ADDR = 0xBF041000; -__constant U32 _TSGEN_CNTCR_OFFSET = 0x0; -__constant U32 _TSGEN_CNTFID0_OFFSET = 0x20; -// Clock rate = TDD Freq. / 8 -__constant U32 _TS_CLOCKRATE = 40000000; - -// CTI -__constant U32 _CTI210_ADDR = 0xBF046000; -__constant U32 _CTICONTROL_OFFSET = 0x0; -__constant U32 _CTIOUTEN_OFFSET = 0xA0; -__constant U32 _CTIGATE_OFFSET = 0x140; -__constant U32 _TPIU_FLUSH_TRIG = 0x2; +__constant U32 _ATBREPLICATOR_IDFILTER_ETM = 0x2; // ETM has 0x10 TRACEID // TPIU __constant U32 _TPIU_ADDR = 0xBF043000; @@ -43,30 +34,10 @@ __constant U32 _ENFTC = 0x1; __constant U32 _TPIU_SYNC_FRAME_COUNT = 0x8; __constant U32 _CURRENTPORTSIZE_4 = 0x8; -// TDDCONF -__constant U32 _TDDCONF_ADDR = 0xBF001000; -__constant U32 _TRACEPORTSPEED_OFFSET = 0x408; -__constant U32 _SPEED80MHZ = 0x0; - // CoreSight general -__constant U32 _CORESIGHT_CLAIMSET_OFFSET = 0xFA0; -__constant U32 _CORESIGHT_CLAIMCLR_OFFSET = 0xFA4; __constant U32 _CORESIGHT_LAR_OFFSET = 0xFB0; __constant U32 _CORESIGHT_UNLOCK_KEY = 0xC5ACCE55; -// GPIO P7 -__constant U32 _P7_ADDR = 0x5F938E00; -__constant U32 _PIN_CNF3_OFFSET = 0x8C; -__constant U32 _PIN_CNF4_OFFSET = 0x90; -__constant U32 _PIN_CNF5_OFFSET = 0x94; -__constant U32 _PIN_CNF6_OFFSET = 0x98; -__constant U32 _PIN_CNF7_OFFSET = 0x9C; -__constant U32 _PIN_CNF_TPIU_CLOCK_VALUE = 0x80000503; -__constant U32 _PIN_CNF_TPIU_DATA_VALUE = 0x00000503; - -// Settings -__constant U32 _DEBUGGER_CLAIM_MASK = 0x2; - // Used to check if we have already set up tracing int _needCoresightSetup = 1; @@ -82,68 +53,59 @@ void _CSLock(U32 addr) JLINK_MEM_WriteU32(addr + _CORESIGHT_LAR_OFFSET, 0); } -// Set claim bits in the CoreSight peripheral to indicate to the firmware that it -// has been configured by the host debugger -void _CSClaim(U32 addr) -{ - JLINK_MEM_WriteU32(addr + _CORESIGHT_CLAIMSET_OFFSET, _DEBUGGER_CLAIM_MASK); -} - // Set up CoreSight and other necessary configuration so to enable ETM -> TPIU tracing. int _SetupETMTPIUTrace(void) { + U32 ctrlreg_old; + U32 ctrlreg_new; + U32 idfilter0_old; + U32 idfilter1_old; + U32 idfilter0_new; + U32 idfilter1_new; + // Set up ATB funnels/replicators to route ApplicationDomain ETM to TPIU + _CSUnlock(_ATBFUNNEL212_ADDR); - JLINK_MEM_WriteU32(_ATBFUNNEL212_ADDR + _ATBFUNNEL_CTRLREG_OFFSET, _HOLDTIME_4 | _ENS0); - _CSClaim(_ATBFUNNEL212_ADDR); + ctrlreg_old = JLINK_MEM_ReadU32(_ATBFUNNEL212_ADDR + _ATBFUNNEL_CTRLREG_OFFSET); + ctrlreg_new = (ctrlreg_old & ~_ATBFUNNEL_HOLDTIME_MASK) | _HOLDTIME_4 | _ENS0; + JLINK_MEM_WriteU32(_ATBFUNNEL212_ADDR + _ATBFUNNEL_CTRLREG_OFFSET, ctrlreg_new); _CSLock(_ATBFUNNEL212_ADDR); _CSUnlock(_ATBREPLICATOR212_ADDR); - JLINK_MEM_WriteU32(_ATBREPLICATOR212_ADDR + _ATBREPLICATOR_IDFILTER0_OFFSET, _ID_NONE); - JLINK_MEM_WriteU32(_ATBREPLICATOR212_ADDR + _ATBREPLICATOR_IDFILTER1_OFFSET, _ID1x); - _CSLock(_ATBREPLICATOR212_ADDR); - _CSClaim(_ATBREPLICATOR212_ADDR); + idfilter0_old = JLINK_MEM_ReadU32(_ATBREPLICATOR212_ADDR + _ATBREPLICATOR_IDFILTER0_OFFSET); + idfilter1_old = JLINK_MEM_ReadU32(_ATBREPLICATOR212_ADDR + _ATBREPLICATOR_IDFILTER1_OFFSET); + + idfilter0_new = idfilter0_old | _ATBREPLICATOR_IDFILTER_ETM; // SET for output 0 + idfilter1_new = idfilter1_old & ~_ATBREPLICATOR_IDFILTER_ETM; // CLEAR for output 1 + + JLINK_MEM_WriteU32(_ATBREPLICATOR212_ADDR + _ATBREPLICATOR_IDFILTER0_OFFSET, idfilter0_new); + JLINK_MEM_WriteU32(_ATBREPLICATOR212_ADDR + _ATBREPLICATOR_IDFILTER1_OFFSET, idfilter1_new); _CSLock(_ATBREPLICATOR212_ADDR); _CSUnlock(_ATBFUNNEL211_ADDR); - JLINK_MEM_WriteU32(_ATBFUNNEL211_ADDR + _ATBFUNNEL_CTRLREG_OFFSET, _HOLDTIME_4 | _ENS0); - _CSClaim(_ATBFUNNEL211_ADDR); + ctrlreg_old = JLINK_MEM_ReadU32(_ATBFUNNEL211_ADDR + _ATBFUNNEL_CTRLREG_OFFSET); + ctrlreg_new = (ctrlreg_old & ~_ATBFUNNEL_HOLDTIME_MASK) | _HOLDTIME_4 | _ENS0; + JLINK_MEM_WriteU32(_ATBFUNNEL211_ADDR + _ATBFUNNEL_CTRLREG_OFFSET, ctrlreg_new); _CSLock(_ATBFUNNEL211_ADDR); _CSUnlock(_ATBREPLICATOR213_ADDR); - JLINK_MEM_WriteU32(_ATBREPLICATOR213_ADDR + _ATBREPLICATOR_IDFILTER0_OFFSET, _ID1x); - JLINK_MEM_WriteU32(_ATBREPLICATOR213_ADDR + _ATBREPLICATOR_IDFILTER1_OFFSET, _ID_NONE); - _CSClaim(_ATBREPLICATOR213_ADDR); - _CSLock(_ATBREPLICATOR213_ADDR); + idfilter0_old = JLINK_MEM_ReadU32(_ATBREPLICATOR213_ADDR + _ATBREPLICATOR_IDFILTER0_OFFSET); + idfilter1_old = JLINK_MEM_ReadU32(_ATBREPLICATOR213_ADDR + _ATBREPLICATOR_IDFILTER1_OFFSET); - // Configure timestamp generator for the correct clock rate - JLINK_MEM_WriteU32(_TSGEN_ADDR + _TSGEN_CNTFID0_OFFSET, _TS_CLOCKRATE); - JLINK_MEM_WriteU32(_TSGEN_ADDR + _TSGEN_CNTCR_OFFSET, 1); - _CSClaim(_TSGEN_ADDR); + idfilter0_new = idfilter0_old & ~_ATBREPLICATOR_IDFILTER_ETM; // CLEAR for output 0 + idfilter1_new = idfilter1_old | _ATBREPLICATOR_IDFILTER_ETM; // SET for output 1 - // Configure CTI1 for TPIU formatter flushing - _CSUnlock(_CTI210_ADDR); - JLINK_MEM_WriteU32(_CTI210_ADDR + _CTIOUTEN_OFFSET, _TPIU_FLUSH_TRIG); - JLINK_MEM_WriteU32(_CTI210_ADDR + _CTIGATE_OFFSET, _TPIU_FLUSH_TRIG); - JLINK_MEM_WriteU32(_CTI210_ADDR + _CTICONTROL_OFFSET, 1); - _CSClaim(_CTI210_ADDR); - _CSLock(_CTI210_ADDR); + JLINK_MEM_WriteU32(_ATBREPLICATOR213_ADDR + _ATBREPLICATOR_IDFILTER0_OFFSET, idfilter0_new); + JLINK_MEM_WriteU32(_ATBREPLICATOR213_ADDR + _ATBREPLICATOR_IDFILTER1_OFFSET, idfilter1_new); + _CSLock(_ATBREPLICATOR213_ADDR); // Configure TPIU for port size 4, continuous formatting _CSUnlock(_TPIU_ADDR); JLINK_MEM_WriteU32(_TPIU_ADDR + _CURRENTPORTSIZE_OFFSET, _CURRENTPORTSIZE_4); JLINK_MEM_WriteU32(_TPIU_ADDR + _FFCR_OFFSET, _ENFCONT | _FONFLIN | _ENFTC); JLINK_MEM_WriteU32(_TPIU_ADDR + _FSCR_OFFSET, _TPIU_SYNC_FRAME_COUNT); - _CSClaim(_TPIU_ADDR); _CSLock(_TPIU_ADDR); - // Configure the trace pins - JLINK_MEM_WriteU32(_P7_ADDR + _PIN_CNF3_OFFSET, _PIN_CNF_TPIU_CLOCK_VALUE); - JLINK_MEM_WriteU32(_P7_ADDR + _PIN_CNF4_OFFSET, _PIN_CNF_TPIU_DATA_VALUE); - JLINK_MEM_WriteU32(_P7_ADDR + _PIN_CNF5_OFFSET, _PIN_CNF_TPIU_DATA_VALUE); - JLINK_MEM_WriteU32(_P7_ADDR + _PIN_CNF6_OFFSET, _PIN_CNF_TPIU_DATA_VALUE); - JLINK_MEM_WriteU32(_P7_ADDR + _PIN_CNF7_OFFSET, _PIN_CNF_TPIU_DATA_VALUE); - return 0; } @@ -155,6 +117,19 @@ int ConfigTargetSettings(void) // Adjust trace sample delay to compensate for timing when using 320MHz JLINK_ExecCommand("TraceSampleAdjust TD = 1000"); + JLINK_ExecCommand("CORESIGHT_SetTPIUBaseAddr = 0xBF043000"); + + return 0; +} + +int StartTPIU(void) +{ + /* We sort this ourselves in _SetupETMTPIUTrace, don't let JLink touch it */ + return 0; +} + +int StopTPIU(void) +{ return 0; } @@ -169,6 +144,11 @@ int OnTraceStart(void) return 0; } +int AfterResetTarget(void) +{ + _needCoresightSetup = 1; + return 0; +} int SetupTarget(void) { @@ -179,3 +159,8 @@ int SetupTarget(void) return 0; } + +int InitEMU(void) { + JLINK_ExecCommand("EnableLowPowerHandlingMode"); + return 0; +} diff --git a/boards/nordic/nrf54h20dk/support/nrf54h20_cpurad.JLinkScript b/boards/nordic/nrf54h20dk/support/nrf54h20_cpurad.JLinkScript index e1861ae8c972..2ff7f6c160e3 100644 --- a/boards/nordic/nrf54h20dk/support/nrf54h20_cpurad.JLinkScript +++ b/boards/nordic/nrf54h20dk/support/nrf54h20_cpurad.JLinkScript @@ -1,11 +1,153 @@ -__constant U32 _CPUCONF_ADDR = 0x53011000; +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +__constant U32 _CPUCONF_ADDR = 0x52011000; __constant U32 _CPUCONF_CPUWAIT_OFFSET = 0x50C; +// ATBFUNNEL +__constant U32 _ATBFUNNEL211_ADDR = 0xBF04D000; +__constant U32 _ATBFUNNEL212_ADDR = 0xBF04E000; +__constant U32 _ATBFUNNEL_CTRLREG_OFFSET = 0x0; +__constant U32 _ATBFUNNEL_HOLDTIME_MASK = 0x700; +__constant U32 _HOLDTIME_4 = 0x300; +__constant U32 _ENS0 = 0x1; // Application Core +__constant U32 _ENS1 = 0x2; // Radio Core + +// ATBREPLICATOR +__constant U32 _ATBREPLICATOR212_ADDR = 0xBF04A000; +__constant U32 _ATBREPLICATOR213_ADDR = 0xBF04B000; +__constant U32 _ATBREPLICATOR_IDFILTER0_OFFSET = 0x0; +__constant U32 _ATBREPLICATOR_IDFILTER1_OFFSET = 0x4; +__constant U32 _ATBREPLICATOR_IDFILTER_ETM = 0x2; // ETM has 0x10 TRACEID + +// TPIU +__constant U32 _TPIU_ADDR = 0xBF043000; +__constant U32 _CURRENTPORTSIZE_OFFSET = 0x4; +__constant U32 _FFCR_OFFSET = 0x304; +__constant U32 _FSCR_OFFSET = 0x308; +__constant U32 _ENFCONT = 0x02; +__constant U32 _FONFLIN = 0x10; +__constant U32 _ENFTC = 0x1; +__constant U32 _TPIU_SYNC_FRAME_COUNT = 0x8; +__constant U32 _CURRENTPORTSIZE_4 = 0x8; + +// CoreSight general +__constant U32 _CORESIGHT_LAR_OFFSET = 0xFB0; +__constant U32 _CORESIGHT_UNLOCK_KEY = 0xC5ACCE55; + +// Used to check if we have already set up tracing +int _needCoresightSetup = 1; + +// Unlock a CoreSight peripheral +void _CSUnlock(U32 addr) +{ + JLINK_MEM_WriteU32(addr + _CORESIGHT_LAR_OFFSET, _CORESIGHT_UNLOCK_KEY); +} + +// Lock a CoreSight peripheral +void _CSLock(U32 addr) +{ + JLINK_MEM_WriteU32(addr + _CORESIGHT_LAR_OFFSET, 0); +} + +// Set up CoreSight and other necessary configuration so to enable ETM -> TPIU tracing. +int _SetupETMTPIUTrace(void) +{ + U32 ctrlreg_old; + U32 ctrlreg_new; + U32 idfilter0_old; + U32 idfilter1_old; + U32 idfilter0_new; + U32 idfilter1_new; + + // Set up ATB funnels/replicators to route ApplicationDomain ETM to TPIU + + _CSUnlock(_ATBFUNNEL212_ADDR); + ctrlreg_old = JLINK_MEM_ReadU32(_ATBFUNNEL212_ADDR + _ATBFUNNEL_CTRLREG_OFFSET); + ctrlreg_new = (ctrlreg_old & ~_ATBFUNNEL_HOLDTIME_MASK) | _HOLDTIME_4 | _ENS1; + JLINK_MEM_WriteU32(_ATBFUNNEL212_ADDR + _ATBFUNNEL_CTRLREG_OFFSET, ctrlreg_new); + _CSLock(_ATBFUNNEL212_ADDR); + + _CSUnlock(_ATBREPLICATOR212_ADDR); + idfilter0_old = JLINK_MEM_ReadU32(_ATBREPLICATOR212_ADDR + _ATBREPLICATOR_IDFILTER0_OFFSET); + idfilter1_old = JLINK_MEM_ReadU32(_ATBREPLICATOR212_ADDR + _ATBREPLICATOR_IDFILTER1_OFFSET); + + idfilter0_new = idfilter0_old | _ATBREPLICATOR_IDFILTER_ETM; // SET for output 0 + idfilter1_new = idfilter1_old & ~_ATBREPLICATOR_IDFILTER_ETM; // CLEAR for output 1 + + JLINK_MEM_WriteU32(_ATBREPLICATOR212_ADDR + _ATBREPLICATOR_IDFILTER0_OFFSET, idfilter0_new); + JLINK_MEM_WriteU32(_ATBREPLICATOR212_ADDR + _ATBREPLICATOR_IDFILTER1_OFFSET, idfilter1_new); + _CSLock(_ATBREPLICATOR212_ADDR); + + _CSUnlock(_ATBFUNNEL211_ADDR); + ctrlreg_old = JLINK_MEM_ReadU32(_ATBFUNNEL211_ADDR + _ATBFUNNEL_CTRLREG_OFFSET); + ctrlreg_new = (ctrlreg_old & ~_ATBFUNNEL_HOLDTIME_MASK) | _HOLDTIME_4 | _ENS1; + JLINK_MEM_WriteU32(_ATBFUNNEL211_ADDR + _ATBFUNNEL_CTRLREG_OFFSET, ctrlreg_new); + _CSLock(_ATBFUNNEL211_ADDR); + + _CSUnlock(_ATBREPLICATOR213_ADDR); + idfilter0_old = JLINK_MEM_ReadU32(_ATBREPLICATOR213_ADDR + _ATBREPLICATOR_IDFILTER0_OFFSET); + idfilter1_old = JLINK_MEM_ReadU32(_ATBREPLICATOR213_ADDR + _ATBREPLICATOR_IDFILTER1_OFFSET); + + idfilter0_new = idfilter0_old & ~_ATBREPLICATOR_IDFILTER_ETM; // CLEAR for output 0 + idfilter1_new = idfilter1_old | _ATBREPLICATOR_IDFILTER_ETM; // SET for output 1 + + JLINK_MEM_WriteU32(_ATBREPLICATOR213_ADDR + _ATBREPLICATOR_IDFILTER0_OFFSET, idfilter0_new); + JLINK_MEM_WriteU32(_ATBREPLICATOR213_ADDR + _ATBREPLICATOR_IDFILTER1_OFFSET, idfilter1_new); + _CSLock(_ATBREPLICATOR213_ADDR); + + // Configure TPIU for port size 4, continuous formatting + _CSUnlock(_TPIU_ADDR); + JLINK_MEM_WriteU32(_TPIU_ADDR + _CURRENTPORTSIZE_OFFSET, _CURRENTPORTSIZE_4); + JLINK_MEM_WriteU32(_TPIU_ADDR + _FFCR_OFFSET, _ENFCONT | _FONFLIN | _ENFTC); + JLINK_MEM_WriteU32(_TPIU_ADDR + _FSCR_OFFSET, _TPIU_SYNC_FRAME_COUNT); + _CSLock(_TPIU_ADDR); + + return 0; +} + int ConfigTargetSettings(void) { JLINK_ExecCommand("CORESIGHT_AddAP = Index=1 Type=AHB-AP"); CORESIGHT_IndexAHBAPToUse = 1; + // Adjust trace sample delay to compensate for timing when using 320MHz + JLINK_ExecCommand("TraceSampleAdjust TD = 1000"); + + JLINK_ExecCommand("CORESIGHT_SetTPIUBaseAddr = 0xBF043000"); + + return 0; +} + +int StartTPIU(void) +{ + /* We sort this ourselves in _SetupETMTPIUTrace, don't let JLink touch it */ + return 0; +} + +int StopTPIU(void) +{ + return 0; +} + + +int OnTraceStart(void) +{ + // Set up CoreSight if not already configured + if (_needCoresightSetup) { + _SetupETMTPIUTrace(); + _needCoresightSetup = 0; + } + + return 0; +} + +int AfterResetTarget(void) +{ + _needCoresightSetup = 1; return 0; } @@ -18,3 +160,8 @@ int SetupTarget(void) return 0; } + +int InitEMU(void) { + JLINK_ExecCommand("EnableLowPowerHandlingMode"); + return 0; +} From 0d3356ee5f46e4a9663c07564edabed4854732fc Mon Sep 17 00:00:00 2001 From: Jakub Zymelka Date: Mon, 25 Nov 2024 14:14:40 +0100 Subject: [PATCH 1861/2141] [nrf noup] drivers: pinctrl: Add SDP MSPI pin configuration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Configure SDP MSPI pins to switch their control to VPR core Signed-off-by: Jakub Zymelka Signed-off-by: Andrzej Głąbek Signed-off-by: Magdalena Pastula Signed-off-by: Karsten Koenig (cherry picked from commit a9bcc44f74eed83f28506e8fcd44f0f70c65ea9c) (cherry picked from commit 2e74ea72fa61061c4caf1beb6dda304473838774) (cherry picked from commit 915e81a911b3d03834ad11d124449c0f4fa4ccc1) --- drivers/pinctrl/pinctrl_nrf.c | 32 +++++++++++ .../zephyr/dt-bindings/pinctrl/nrf-pinctrl.h | 56 +++++++++++++++++++ 2 files changed, 88 insertions(+) diff --git a/drivers/pinctrl/pinctrl_nrf.c b/drivers/pinctrl/pinctrl_nrf.c index e350e61f0afc..3d59ba7998bb 100644 --- a/drivers/pinctrl/pinctrl_nrf.c +++ b/drivers/pinctrl/pinctrl_nrf.c @@ -201,6 +201,18 @@ static void port_pin_clock_set(uint16_t pin_number, bool enable) #endif +#if DT_HAS_COMPAT_STATUS_OKAY(nordic_hpf_mspi_controller) || \ + defined(CONFIG_MSPI_HPF) || \ + DT_ANY_COMPAT_HAS_PROP_STATUS_OKAY(nordic_nrf_vpr_coprocessor, pinctrl_0) +#if defined(CONFIG_SOC_SERIES_NRF54LX) +#define NRF_PSEL_SDP_MSPI(psel) \ + nrf_gpio_pin_control_select(psel, NRF_GPIO_PIN_SEL_VPR); +#elif defined(CONFIG_SOC_SERIES_NRF54HX) +/* On nRF54H, pin routing is controlled by secure domain, via UICR. */ +#define NRF_PSEL_SDP_MSPI(psel) +#endif +#endif /* DT_HAS_COMPAT_STATUS_OKAY(nordic_hpf_mspi_controller) || ... */ + int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, uintptr_t reg) { @@ -569,6 +581,26 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, input = NRF_GPIO_PIN_INPUT_DISCONNECT; break; #endif /* DT_HAS_COMPAT_STATUS_OKAY(nordic_coresight_nrf) */ +#if defined(NRF_PSEL_SDP_MSPI) + case NRF_FUN_SDP_MSPI_CS0: + case NRF_FUN_SDP_MSPI_CS1: + case NRF_FUN_SDP_MSPI_CS2: + case NRF_FUN_SDP_MSPI_CS3: + case NRF_FUN_SDP_MSPI_CS4: + case NRF_FUN_SDP_MSPI_SCK: + case NRF_FUN_SDP_MSPI_DQ0: + case NRF_FUN_SDP_MSPI_DQ1: + case NRF_FUN_SDP_MSPI_DQ2: + case NRF_FUN_SDP_MSPI_DQ3: + case NRF_FUN_SDP_MSPI_DQ4: + case NRF_FUN_SDP_MSPI_DQ5: + case NRF_FUN_SDP_MSPI_DQ6: + case NRF_FUN_SDP_MSPI_DQ7: + NRF_PSEL_SDP_MSPI(psel); + dir = NRF_GPIO_PIN_DIR_OUTPUT; + input = NRF_GPIO_PIN_INPUT_CONNECT; + break; +#endif /* defined(NRF_PSEL_SDP_MSPI) */ default: return -ENOTSUP; } diff --git a/include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h b/include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h index 92e62a9a6bed..4c7f1d3145dd 100644 --- a/include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h +++ b/include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h @@ -172,6 +172,62 @@ #define NRF_FUN_GRTC_CLKOUT_FAST 55U /** GRTC slow clock output */ #define NRF_FUN_GRTC_CLKOUT_32K 56U +/** SDP_MSPI clock pin */ +#define NRF_FUN_SDP_MSPI_SCK 57U +/** SDP_MSPI data pin 0 */ +#define NRF_FUN_SDP_MSPI_DQ0 58U +/** SDP_MSPI data pin 1 */ +#define NRF_FUN_SDP_MSPI_DQ1 59U +/** SDP_MSPI data pin 2 */ +#define NRF_FUN_SDP_MSPI_DQ2 60U +/** SDP_MSPI data pin 3 */ +#define NRF_FUN_SDP_MSPI_DQ3 61U +/** SDP_MSPI data pin 4 */ +#define NRF_FUN_SDP_MSPI_DQ4 62U +/** SDP_MSPI data pin 5 */ +#define NRF_FUN_SDP_MSPI_DQ5 63U +/** SDP_MSPI data pin 6 */ +#define NRF_FUN_SDP_MSPI_DQ6 64U +/** SDP_MSPI data pin 7 */ +#define NRF_FUN_SDP_MSPI_DQ7 65U +/** SDP_MSPI chip select 0 */ +#define NRF_FUN_SDP_MSPI_CS0 66U +/** SDP_MSPI chip select 1 */ +#define NRF_FUN_SDP_MSPI_CS1 67U +/** SDP_MSPI chip select 2 */ +#define NRF_FUN_SDP_MSPI_CS2 68U +/** SDP_MSPI chip select 3 */ +#define NRF_FUN_SDP_MSPI_CS3 69U +/** SDP_MSPI chip select 4 */ +#define NRF_FUN_SDP_MSPI_CS4 70U +/** High-Performance Framework MSPI clock pin */ +#define NRF_FUN_HPF_MSPI_SCK NRF_FUN_SDP_MSPI_SCK +/** High-Performance Framework MSPI data pin 0 */ +#define NRF_FUN_HPF_MSPI_DQ0 NRF_FUN_SDP_MSPI_DQ0 +/** High-Performance Framework MSPI data pin 1 */ +#define NRF_FUN_HPF_MSPI_DQ1 NRF_FUN_SDP_MSPI_DQ1 +/** High-Performance Framework MSPI data pin 2 */ +#define NRF_FUN_HPF_MSPI_DQ2 NRF_FUN_SDP_MSPI_DQ2 +/** High-Performance Framework MSPI data pin 3 */ +#define NRF_FUN_HPF_MSPI_DQ3 NRF_FUN_SDP_MSPI_DQ3 +/** High-Performance Framework MSPI data pin 4 */ +#define NRF_FUN_HPF_MSPI_DQ4 NRF_FUN_SDP_MSPI_DQ4 +/** High-Performance Framework MSPI data pin 5 */ +#define NRF_FUN_HPF_MSPI_DQ5 NRF_FUN_SDP_MSPI_DQ5 +/** High-Performance Framework MSPI data pin 6 */ +#define NRF_FUN_HPF_MSPI_DQ6 NRF_FUN_SDP_MSPI_DQ6 +/** High-Performance Framework MSPI data pin 7 */ +#define NRF_FUN_HPF_MSPI_DQ7 NRF_FUN_SDP_MSPI_DQ7 +/** High-Performance Framework MSPI chip select pin 0 */ +#define NRF_FUN_HPF_MSPI_CS0 NRF_FUN_SDP_MSPI_CS0 +/** High-Performance Framework MSPI chip select pin 1 */ +#define NRF_FUN_HPF_MSPI_CS1 NRF_FUN_SDP_MSPI_CS1 +/** High-Performance Framework MSPI chip select pin 2 */ +#define NRF_FUN_HPF_MSPI_CS2 NRF_FUN_SDP_MSPI_CS2 +/** High-Performance Framework MSPI chip select pin 3 */ +#define NRF_FUN_HPF_MSPI_CS3 NRF_FUN_SDP_MSPI_CS3 +/** High-Performance Framework MSPI chip select pin 4 */ +#define NRF_FUN_HPF_MSPI_CS4 NRF_FUN_SDP_MSPI_CS4 /** TDM SCK in master mode */ #define NRF_FUN_TDM_SCK_M 71U /** TDM SCK in slave mode */ From 34f1aa346560cdbb528caea4d52188ebdeb81c4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Wed, 8 Oct 2025 14:33:12 +0200 Subject: [PATCH 1862/2141] [nrf fromtree] tests: boards: nrf: coresight_stm: Align test to STM driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There were recent changes to nrf54h20dk and STM driver. Align test accordingly: - add Kconfig that boots Radio core, - update expected timing results. Signed-off-by: Sebastian Głąb (cherry picked from commit 3d56c2f8f83b9d2d0072684601bfb11775067198) --- .../nordic/coresight_stm/pytest/test_stm.py | 38 +++++++++---------- tests/boards/nrf/coresight_stm/prj.conf | 1 + 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/samples/boards/nordic/coresight_stm/pytest/test_stm.py b/samples/boards/nordic/coresight_stm/pytest/test_stm.py index 6db0b5685759..993df0b55fb8 100644 --- a/samples/boards/nordic/coresight_stm/pytest/test_stm.py +++ b/samples/boards/nordic/coresight_stm/pytest/test_stm.py @@ -275,9 +275,9 @@ def test_STM_decoded(dut: DeviceAdapter): app_constraints = STMLimits( # all values in us - log_0_arg=1.8, - log_1_arg=2.1, - log_2_arg=2.0, + log_0_arg=0.6, + log_1_arg=0.6, + log_2_arg=2.1, log_3_arg=2.1, log_str=4.5, tracepoint=0.5, @@ -286,35 +286,35 @@ def test_STM_decoded(dut: DeviceAdapter): ) rad_constraints = STMLimits( # all values in us - log_0_arg=4.6, - log_1_arg=5.0, - log_2_arg=5.2, - log_3_arg=5.6, - log_str=6.3, + log_0_arg=5.6, + log_1_arg=5.8, + log_2_arg=6.1, + log_3_arg=6.4, + log_str=7.1, tracepoint=0.5, tracepoint_d32=0.5, tolerance=0.5, ) ppr_constraints = STMLimits( # all values in us - log_0_arg=25.7, - log_1_arg=27.1, - log_2_arg=27.3, - log_3_arg=30.4, - log_str=65.7, + log_0_arg=2.3, + log_1_arg=2.0, + log_2_arg=26.9, + log_3_arg=27.5, + log_str=68.3, tracepoint=0.55, tracepoint_d32=0.25, tolerance=0.5, ) flpr_constraints = STMLimits( # all values in us - log_0_arg=1.3, - log_1_arg=1.6, - log_2_arg=1.6, - log_3_arg=1.7, + log_0_arg=0.2, + log_1_arg=0.2, + log_2_arg=1.2, + log_3_arg=1.2, log_str=3.0, - tracepoint=0.5, - tracepoint_d32=0.5, + tracepoint=0.25, + tracepoint_d32=0.25, tolerance=0.5, ) diff --git a/tests/boards/nrf/coresight_stm/prj.conf b/tests/boards/nrf/coresight_stm/prj.conf index 1e935e973c76..9ee7cf8cc03a 100644 --- a/tests/boards/nrf/coresight_stm/prj.conf +++ b/tests/boards/nrf/coresight_stm/prj.conf @@ -1 +1,2 @@ CONFIG_LOG=y +CONFIG_SOC_NRF54H20_CPURAD_ENABLE=y From 2648ce97c686fd19790a7643ff5027702b8972d2 Mon Sep 17 00:00:00 2001 From: Triveni Danda Date: Fri, 10 Oct 2025 15:34:49 +0530 Subject: [PATCH 1863/2141] Revert "[nrf fromlist] soc: nordic: nrf54h: Add DT_NODE_EXISTS check" This reverts commit 4fa43040a6e12fccfa0cfbfcd677ac3e263cea0a. Signed-off-by: Triveni Danda --- soc/nordic/nrf54h/soc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soc/nordic/nrf54h/soc.c b/soc/nordic/nrf54h/soc.c index 3d1fdfe5c05b..44c3a5314fa0 100644 --- a/soc/nordic/nrf54h/soc.c +++ b/soc/nordic/nrf54h/soc.c @@ -214,7 +214,7 @@ void soc_late_init_hook(void) DT_REG_ADDR(DT_NODELABEL(cpurad_slot0_partition)) + CONFIG_ROM_START_OFFSET); } -#elif DT_NODE_EXISTS(DT_NODELABEL(cpurad_slot0_partition)) +#else radiocore_address = (void *)(DT_REG_ADDR(DT_GPARENT(DT_NODELABEL(cpurad_slot0_partition))) + DT_REG_ADDR(DT_NODELABEL(cpurad_slot0_partition)) + From dc45b2a09c7872f52b2ddb00c20bd02eb547a8ae Mon Sep 17 00:00:00 2001 From: Triveni Danda Date: Thu, 9 Oct 2025 16:20:19 +0530 Subject: [PATCH 1864/2141] [nrf fromtree] net: l2: wifi: Fix override certs directory for sysbuild Fix overriding the test certificates directory for enterprise mode when using sysbuild. The override already works as expected without sysbuild. Signed-off-by: Triveni Danda (cherry picked from commit 57a35d9cb487b5149625a759b08a3d03029caf9a) --- subsys/net/l2/wifi/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/subsys/net/l2/wifi/CMakeLists.txt b/subsys/net/l2/wifi/CMakeLists.txt index f91964d9d83a..c3f12fe132cf 100644 --- a/subsys/net/l2/wifi/CMakeLists.txt +++ b/subsys/net/l2/wifi/CMakeLists.txt @@ -28,6 +28,8 @@ if(CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE AND CONFIG_NET_L2_WIFI_SHELL) # Wi-Fi Enterprise test certificates handling set(gen_inc_dir ${ZEPHYR_BINARY_DIR}/misc/generated) set(gen_dir ${gen_inc_dir}/wifi_enterprise_test_certs) + zephyr_get(WIFI_TEST_CERTS_DIR SYSBUILD GLOBAL) + message(DEBUG "WIFI_TEST_CERTS_DIR is set to ${WIFI_TEST_CERTS_DIR}") if(NOT DEFINED WIFI_TEST_CERTS_DIR) set(WIFI_TEST_CERTS_DIR ${ZEPHYR_BASE}/samples/net/wifi/test_certs/rsa3k) endif() From 6c9b26c481d48f34073bc3dfc5c60302d359a467 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B8e?= Date: Mon, 13 Oct 2025 15:32:29 +0200 Subject: [PATCH 1865/2141] [nrf fromtree] soc: nordic: uicr: Add support for UICR.SECONDARY.TRIGGER MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add support for UICR.SECONDARY.TRIGGER configuration, which enables automatic booting of secondary firmware based on specific reset reasons. This introduces Kconfig options for configuring: - UICR.SECONDARY.TRIGGER.ENABLE - Enable/disable automatic triggers - UICR.SECONDARY.TRIGGER.RESETREAS - Bitmask of reset reasons that trigger secondary firmware boot Individual Kconfig options are provided for each reset reason: - APPLICATIONWDT0/1 - Application core watchdog timeouts - APPLICATIONLOCKUP - Application core CPU lockup - RADIOCOREWDT0/1 - Radio core watchdog timeouts - RADIOCORELOCKUP - Radio core CPU lockup Signed-off-by: Sebastian Bøe (cherry picked from commit 9dc2b614d6bc21485ec90f812cf0d3512a16b23f) --- scripts/ci/check_compliance.py | 7 ++++ soc/nordic/common/uicr/gen_uicr.py | 19 +++++++++ .../common/uicr/gen_uicr/CMakeLists.txt | 28 +++++++++++++ soc/nordic/common/uicr/gen_uicr/Kconfig | 42 +++++++++++++++++++ 4 files changed, 96 insertions(+) diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index f5ca11da1901..30284e45ac4b 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -1306,6 +1306,13 @@ def check_no_undef_outside_kconfig(self, kconf): "GEN_UICR_SECONDARY", "GEN_UICR_SECONDARY_GENERATE_PERIPHCONF", "GEN_UICR_SECONDARY_PROCESSOR_VALUE", + "GEN_UICR_SECONDARY_TRIGGER", + "GEN_UICR_SECONDARY_TRIGGER_APPLICATIONLOCKUP", + "GEN_UICR_SECONDARY_TRIGGER_APPLICATIONWDT0", + "GEN_UICR_SECONDARY_TRIGGER_APPLICATIONWDT1", + "GEN_UICR_SECONDARY_TRIGGER_RADIOCORELOCKUP", + "GEN_UICR_SECONDARY_TRIGGER_RADIOCOREWDT0", + "GEN_UICR_SECONDARY_TRIGGER_RADIOCOREWDT1", "GEN_UICR_SECONDARY_WDTSTART", "GEN_UICR_SECONDARY_WDTSTART_CRV", "GEN_UICR_SECONDARY_WDTSTART_INSTANCE_CODE", diff --git a/soc/nordic/common/uicr/gen_uicr.py b/soc/nordic/common/uicr/gen_uicr.py index da2938bf05c9..36f4dc1d44c0 100644 --- a/soc/nordic/common/uicr/gen_uicr.py +++ b/soc/nordic/common/uicr/gen_uicr.py @@ -487,6 +487,20 @@ def main() -> None: type=lambda s: int(s, 0), help="Processor to boot for the secondary firmware ", ) + parser.add_argument( + "--secondary-trigger", + action="store_true", + help="Enable UICR.SECONDARY.TRIGGER for automatic secondary firmware boot on reset events", + ) + parser.add_argument( + "--secondary-trigger-resetreas", + default=0, + type=lambda s: int(s, 0), + help=( + "Bitmask of reset reasons that trigger secondary firmware boot " + "(decimal or 0x-prefixed hex)" + ), + ) parser.add_argument( "--secondary-periphconf-address", default=None, @@ -628,6 +642,11 @@ def main() -> None: uicr.SECONDARY.ADDRESS = args.secondary_address uicr.SECONDARY.PROCESSOR = args.secondary_processor + # Handle secondary TRIGGER configuration + if args.secondary_trigger: + uicr.SECONDARY.TRIGGER.ENABLE = ENABLED_VALUE + uicr.SECONDARY.TRIGGER.RESETREAS = args.secondary_trigger_resetreas + # Handle secondary periphconf if provided if args.out_secondary_periphconf_hex: secondary_periphconf_combined = extract_and_combine_periphconfs( diff --git a/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt b/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt index 39737888023a..d5a71e0562f4 100644 --- a/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt +++ b/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt @@ -188,6 +188,34 @@ if(CONFIG_GEN_UICR_SECONDARY) list(APPEND secondary_args --secondary-wdtstart-crv ${CONFIG_GEN_UICR_SECONDARY_WDTSTART_CRV}) endif() + # Handle secondary TRIGGER configuration + if(CONFIG_GEN_UICR_SECONDARY_TRIGGER) + list(APPEND secondary_args --secondary-trigger) + + # Compute RESETREAS bitmask from individual trigger configs + set(resetreas_value 0) + if(CONFIG_GEN_UICR_SECONDARY_TRIGGER_APPLICATIONWDT0) + math(EXPR resetreas_value "${resetreas_value} + 0x001") + endif() + if(CONFIG_GEN_UICR_SECONDARY_TRIGGER_APPLICATIONWDT1) + math(EXPR resetreas_value "${resetreas_value} + 0x002") + endif() + if(CONFIG_GEN_UICR_SECONDARY_TRIGGER_APPLICATIONLOCKUP) + math(EXPR resetreas_value "${resetreas_value} + 0x008") + endif() + if(CONFIG_GEN_UICR_SECONDARY_TRIGGER_RADIOCOREWDT0) + math(EXPR resetreas_value "${resetreas_value} + 0x020") + endif() + if(CONFIG_GEN_UICR_SECONDARY_TRIGGER_RADIOCOREWDT1) + math(EXPR resetreas_value "${resetreas_value} + 0x040") + endif() + if(CONFIG_GEN_UICR_SECONDARY_TRIGGER_RADIOCORELOCKUP) + math(EXPR resetreas_value "${resetreas_value} + 0x100") + endif() + + list(APPEND secondary_args --secondary-trigger-resetreas ${resetreas_value}) + endif() + if(CONFIG_GEN_UICR_SECONDARY_GENERATE_PERIPHCONF) # Compute SECONDARY_PERIPHCONF absolute address and size from this image's devicetree compute_partition_address_and_size("secondary_periphconf_partition" SECONDARY_PERIPHCONF_ADDRESS SECONDARY_PERIPHCONF_SIZE) diff --git a/soc/nordic/common/uicr/gen_uicr/Kconfig b/soc/nordic/common/uicr/gen_uicr/Kconfig index 9b630139e641..716e18a26275 100644 --- a/soc/nordic/common/uicr/gen_uicr/Kconfig +++ b/soc/nordic/common/uicr/gen_uicr/Kconfig @@ -166,6 +166,48 @@ config GEN_UICR_SECONDARY_PROCESSOR_VALUE default 0xBD2328A8 if GEN_UICR_SECONDARY_PROCESSOR_APPLICATION default 0x1730C77F if GEN_UICR_SECONDARY_PROCESSOR_RADIOCORE +config GEN_UICR_SECONDARY_TRIGGER + bool "Enable UICR.SECONDARY.TRIGGER" + help + When enabled, configures automatic triggers that cause IronSide SE + to boot the secondary firmware instead of the primary firmware based + on specific reset reasons. + +if GEN_UICR_SECONDARY_TRIGGER + +config GEN_UICR_SECONDARY_TRIGGER_APPLICATIONWDT0 + bool "Trigger on Application domain watchdog 0 reset" + help + Boot secondary firmware when Application domain watchdog 0 causes a reset. + +config GEN_UICR_SECONDARY_TRIGGER_APPLICATIONWDT1 + bool "Trigger on Application domain watchdog 1 reset" + help + Boot secondary firmware when Application domain watchdog 1 causes a reset. + +config GEN_UICR_SECONDARY_TRIGGER_APPLICATIONLOCKUP + bool "Trigger on Application domain CPU lockup reset" + help + Boot secondary firmware when Application domain CPU lockup causes a reset. + +config GEN_UICR_SECONDARY_TRIGGER_RADIOCOREWDT0 + bool "Trigger on Radio core watchdog 0 reset" + help + Boot secondary firmware when Radio core watchdog 0 causes a reset. + +config GEN_UICR_SECONDARY_TRIGGER_RADIOCOREWDT1 + bool "Trigger on Radio core watchdog 1 reset" + help + Boot secondary firmware when Radio core watchdog 1 causes a reset. + +config GEN_UICR_SECONDARY_TRIGGER_RADIOCORELOCKUP + bool "Trigger on Radio core CPU lockup reset" + help + Boot secondary firmware when Radio core CPU lockup causes a reset. + + +endif # GEN_UICR_SECONDARY_TRIGGER + endif # GEN_UICR_SECONDARY endmenu From 9f2450f4b736b2fdf143973fa026d5b403e11c3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B8e?= Date: Mon, 13 Oct 2025 15:34:03 +0200 Subject: [PATCH 1866/2141] [nrf fromtree] soc: nordic: uicr: Add support for UICR.SECONDARY.PROTECTEDMEM MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add support for UICR.SECONDARY.PROTECTEDMEM configuration, which enables configuration of the protected memory region for secondary firmware. This introduces Kconfig options for configuring: - GEN_UICR_SECONDARY_PROTECTEDMEM - Enable/disable protected memory for secondary firmware - GEN_UICR_SECONDARY_PROTECTEDMEM_SIZE_BYTES - Size of the protected memory region in bytes The implementation validates that the configured size is divisible by 4096 bytes (4 KiB) as required by the hardware, and converts it to 4 KiB units when writing to UICR.SECONDARY.PROTECTEDMEM.SIZE4KB. Signed-off-by: Sebastian Bøe (cherry picked from commit c3f6b8cb34b91ae336894006596107943974e0ae) --- scripts/ci/check_compliance.py | 2 ++ soc/nordic/common/uicr/gen_uicr.py | 15 +++++++++++++++ soc/nordic/common/uicr/gen_uicr/CMakeLists.txt | 5 +++++ soc/nordic/common/uicr/gen_uicr/Kconfig | 16 +++++++++++++++- 4 files changed, 37 insertions(+), 1 deletion(-) diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index 30284e45ac4b..c7c84d0994cd 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -1306,6 +1306,8 @@ def check_no_undef_outside_kconfig(self, kconf): "GEN_UICR_SECONDARY", "GEN_UICR_SECONDARY_GENERATE_PERIPHCONF", "GEN_UICR_SECONDARY_PROCESSOR_VALUE", + "GEN_UICR_SECONDARY_PROTECTEDMEM", + "GEN_UICR_SECONDARY_PROTECTEDMEM_SIZE_BYTES", "GEN_UICR_SECONDARY_TRIGGER", "GEN_UICR_SECONDARY_TRIGGER_APPLICATIONLOCKUP", "GEN_UICR_SECONDARY_TRIGGER_APPLICATIONWDT0", diff --git a/soc/nordic/common/uicr/gen_uicr.py b/soc/nordic/common/uicr/gen_uicr.py index 36f4dc1d44c0..0b47be4c5a4d 100644 --- a/soc/nordic/common/uicr/gen_uicr.py +++ b/soc/nordic/common/uicr/gen_uicr.py @@ -501,6 +501,12 @@ def main() -> None: "(decimal or 0x-prefixed hex)" ), ) + parser.add_argument( + "--secondary-protectedmem-size", + default=None, + type=lambda s: int(s, 0), + help="Size in bytes of the secondary protected memory region (decimal or 0x-prefixed hex)", + ) parser.add_argument( "--secondary-periphconf-address", default=None, @@ -647,6 +653,15 @@ def main() -> None: uicr.SECONDARY.TRIGGER.ENABLE = ENABLED_VALUE uicr.SECONDARY.TRIGGER.RESETREAS = args.secondary_trigger_resetreas + # Handle secondary PROTECTEDMEM configuration + if args.secondary_protectedmem_size: + uicr.SECONDARY.PROTECTEDMEM.ENABLE = ENABLED_VALUE + if args.secondary_protectedmem_size % 4096 != 0: + raise ScriptError( + f"args.secondary_protectedmem_size was {args.secondary_protectedmem_size}, " + f"but must be divisible by 4096" + ) + uicr.SECONDARY.PROTECTEDMEM.SIZE4KB = args.secondary_protectedmem_size // 4096 # Handle secondary periphconf if provided if args.out_secondary_periphconf_hex: secondary_periphconf_combined = extract_and_combine_periphconfs( diff --git a/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt b/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt index d5a71e0562f4..41ccdf454a33 100644 --- a/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt +++ b/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt @@ -216,6 +216,11 @@ if(CONFIG_GEN_UICR_SECONDARY) list(APPEND secondary_args --secondary-trigger-resetreas ${resetreas_value}) endif() + # Handle secondary PROTECTEDMEM configuration + if(CONFIG_GEN_UICR_SECONDARY_PROTECTEDMEM) + list(APPEND secondary_args --secondary-protectedmem-size ${CONFIG_GEN_UICR_SECONDARY_PROTECTEDMEM_SIZE_BYTES}) + endif() + if(CONFIG_GEN_UICR_SECONDARY_GENERATE_PERIPHCONF) # Compute SECONDARY_PERIPHCONF absolute address and size from this image's devicetree compute_partition_address_and_size("secondary_periphconf_partition" SECONDARY_PERIPHCONF_ADDRESS SECONDARY_PERIPHCONF_SIZE) diff --git a/soc/nordic/common/uicr/gen_uicr/Kconfig b/soc/nordic/common/uicr/gen_uicr/Kconfig index 716e18a26275..7ff7caf49f73 100644 --- a/soc/nordic/common/uicr/gen_uicr/Kconfig +++ b/soc/nordic/common/uicr/gen_uicr/Kconfig @@ -205,9 +205,23 @@ config GEN_UICR_SECONDARY_TRIGGER_RADIOCORELOCKUP help Boot secondary firmware when Radio core CPU lockup causes a reset. - endif # GEN_UICR_SECONDARY_TRIGGER +config GEN_UICR_SECONDARY_PROTECTEDMEM + bool "Enable UICR.SECONDARY.PROTECTEDMEM" + depends on GEN_UICR_SECONDARY + help + When enabled, the UICR generator will configure the + protected memory region for the secondary firmware. + +config GEN_UICR_SECONDARY_PROTECTEDMEM_SIZE_BYTES + int "Secondary protected memory size in bytes" + default 4096 + depends on GEN_UICR_SECONDARY_PROTECTEDMEM + help + Size of the secondary protected memory region in bytes. + This value must be divisible by 4096 (4 kiB). + endif # GEN_UICR_SECONDARY endmenu From 4d2bcf72788fe2f237ccbc485a267e63f8f0e3cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B8e?= Date: Mon, 13 Oct 2025 15:34:22 +0200 Subject: [PATCH 1867/2141] [nrf fromtree] soc: nordic: uicr: Add support for UICR.LOCK MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add support for UICR.LOCK configuration, which locks the entire UICR configuration in NVR0 to prevent unauthorized modifications. This introduces a Kconfig option GEN_UICR_LOCK that enables locking of the UICR. Once locked, the UICR can only be modified by performing an ERASEALL operation. This is a critical security feature for production devices, typically enabled alongside UICR.APPROTECT, UICR.PROTECTEDMEM, and UICR.ERASEPROTECT to establish a complete device protection scheme. When enabled, the gen_uicr.py script sets UICR.LOCK to 0xFFFFFFFF, which configures the NVR0 page as read-only and enforces integrity checks on the UICR content. Signed-off-by: Sebastian Bøe (cherry picked from commit 1ffdf09c25dfb0082bdaccab5232823b73a15494) --- scripts/ci/check_compliance.py | 1 + soc/nordic/common/uicr/gen_uicr.py | 8 ++++++++ soc/nordic/common/uicr/gen_uicr/CMakeLists.txt | 7 +++++++ soc/nordic/common/uicr/gen_uicr/Kconfig | 11 +++++++++++ 4 files changed, 27 insertions(+) diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index c7c84d0994cd..eb2006ef6074 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -1301,6 +1301,7 @@ def check_no_undef_outside_kconfig(self, kconf): "FOO_SETTING_1", "FOO_SETTING_2", "GEN_UICR_GENERATE_PERIPHCONF", # Used in specialized build tool, not part of main Kconfig + "GEN_UICR_LOCK", "GEN_UICR_PROTECTEDMEM", "GEN_UICR_PROTECTEDMEM_SIZE_BYTES", "GEN_UICR_SECONDARY", diff --git a/soc/nordic/common/uicr/gen_uicr.py b/soc/nordic/common/uicr/gen_uicr.py index 0b47be4c5a4d..103dec53e82b 100644 --- a/soc/nordic/common/uicr/gen_uicr.py +++ b/soc/nordic/common/uicr/gen_uicr.py @@ -430,6 +430,11 @@ def main() -> None: type=lambda s: int(s, 0), help="Size in bytes of cpurad_its_partition (decimal or 0x-prefixed hex)", ) + parser.add_argument( + "--lock", + action="store_true", + help="Enable UICR.LOCK to prevent modifications without ERASEALL", + ) parser.add_argument( "--protectedmem", action="store_true", @@ -597,6 +602,9 @@ def main() -> None: uicr.SECURESTORAGE.ITS.APPLICATIONSIZE1KB = args.cpuapp_its_size // 1024 uicr.SECURESTORAGE.ITS.RADIOCORESIZE1KB = args.cpurad_its_size // 1024 + # Handle LOCK configuration + if args.lock: + uicr.LOCK = ENABLED_VALUE # Handle protected memory configuration if args.protectedmem: if args.protectedmem_size_bytes % KB_4 != 0: diff --git a/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt b/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt index 41ccdf454a33..8df980b0743b 100644 --- a/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt +++ b/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt @@ -75,6 +75,7 @@ endfunction() if(CMAKE_VERBOSE_MAKEFILE) endif() +set(lock_args) set(protectedmem_args) set(periphconf_args) set(wdtstart_args) @@ -115,6 +116,11 @@ if(CONFIG_GEN_UICR_SECURESTORAGE) list(APPEND securestorage_args --cpurad-its-size ${CPURAD_ITS_SIZE}) endif(CONFIG_GEN_UICR_SECURESTORAGE) +# Handle LOCK configuration +if(CONFIG_GEN_UICR_LOCK) + list(APPEND lock_args --lock) +endif() + # Handle protected memory configuration if(CONFIG_GEN_UICR_PROTECTEDMEM) list(APPEND protectedmem_args --protectedmem) @@ -243,6 +249,7 @@ add_custom_command( --uicr-address ${UICR_ADDRESS} --out-merged-hex ${merged_hex_file} --out-uicr-hex ${uicr_hex_file} + ${lock_args} ${wdtstart_args} ${periphconf_args} ${securestorage_args} diff --git a/soc/nordic/common/uicr/gen_uicr/Kconfig b/soc/nordic/common/uicr/gen_uicr/Kconfig index 7ff7caf49f73..e64fa93bdcac 100644 --- a/soc/nordic/common/uicr/gen_uicr/Kconfig +++ b/soc/nordic/common/uicr/gen_uicr/Kconfig @@ -32,6 +32,17 @@ config GEN_UICR_SECURESTORAGE - At least one subpartition must be defined - Combined subpartition sizes must equal secure_storage_partition size +config GEN_UICR_LOCK + bool "Enable UICR.LOCK" + help + When enabled, locks the entire contents of the NVR0 page located in + MRAM10. This includes all values in both the UICR and the BICR (Board + Information Configuration Registers). Once locked, the UICR can only + be modified by performing an ERASEALL operation. + + This should be enabled only in production devices to prevent + unauthorized modification. + config GEN_UICR_PROTECTEDMEM bool "Enable UICR.PROTECTEDMEM" help From 5d60e5894897883b807921cfcc8dce1f71656bf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B8e?= Date: Mon, 13 Oct 2025 15:34:34 +0200 Subject: [PATCH 1868/2141] [nrf fromtree] soc: nordic: uicr: Add support for UICR.ERASEPROTECT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add support for UICR.ERASEPROTECT configuration, which blocks ERASEALL operations to prevent bulk erasure of protected memory. This introduces a Kconfig option GEN_UICR_ERASEPROTECT that enables blocking of ERASEALL operations on NVR0, preserving UICR settings even if an attacker attempts a full-chip erase. This is a critical security feature for production devices. When enabled together with UICR.LOCK, it becomes impossible to modify the UICR in any way, establishing a permanent device protection scheme. Due to this irreversibility, it should only be enabled during the final stages of production. When enabled, the gen_uicr.py script sets UICR.ERASEPROTECT to 0xFFFFFFFF, which prevents the ERASEALL command from affecting the NVR0 page. Signed-off-by: Sebastian Bøe (cherry picked from commit e20352d80a02cbf1053932bfcd34489ba4a0f369) --- scripts/ci/check_compliance.py | 1 + soc/nordic/common/uicr/gen_uicr.py | 8 ++++++++ soc/nordic/common/uicr/gen_uicr/CMakeLists.txt | 7 +++++++ soc/nordic/common/uicr/gen_uicr/Kconfig | 12 ++++++++++++ 4 files changed, 28 insertions(+) diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index eb2006ef6074..711f68904054 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -1300,6 +1300,7 @@ def check_no_undef_outside_kconfig(self, kconf): "FOO_LOG_LEVEL", "FOO_SETTING_1", "FOO_SETTING_2", + "GEN_UICR_ERASEPROTECT", "GEN_UICR_GENERATE_PERIPHCONF", # Used in specialized build tool, not part of main Kconfig "GEN_UICR_LOCK", "GEN_UICR_PROTECTEDMEM", diff --git a/soc/nordic/common/uicr/gen_uicr.py b/soc/nordic/common/uicr/gen_uicr.py index 103dec53e82b..390d96042528 100644 --- a/soc/nordic/common/uicr/gen_uicr.py +++ b/soc/nordic/common/uicr/gen_uicr.py @@ -435,6 +435,11 @@ def main() -> None: action="store_true", help="Enable UICR.LOCK to prevent modifications without ERASEALL", ) + parser.add_argument( + "--eraseprotect", + action="store_true", + help="Enable UICR.ERASEPROTECT to block ERASEALL operations", + ) parser.add_argument( "--protectedmem", action="store_true", @@ -605,6 +610,9 @@ def main() -> None: # Handle LOCK configuration if args.lock: uicr.LOCK = ENABLED_VALUE + # Handle ERASEPROTECT configuration + if args.eraseprotect: + uicr.ERASEPROTECT = ENABLED_VALUE # Handle protected memory configuration if args.protectedmem: if args.protectedmem_size_bytes % KB_4 != 0: diff --git a/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt b/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt index 8df980b0743b..0802d4f2f870 100644 --- a/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt +++ b/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt @@ -76,6 +76,7 @@ if(CMAKE_VERBOSE_MAKEFILE) endif() set(lock_args) +set(eraseprotect_args) set(protectedmem_args) set(periphconf_args) set(wdtstart_args) @@ -121,6 +122,11 @@ if(CONFIG_GEN_UICR_LOCK) list(APPEND lock_args --lock) endif() +# Handle ERASEPROTECT configuration +if(CONFIG_GEN_UICR_ERASEPROTECT) + list(APPEND eraseprotect_args --eraseprotect) +endif() + # Handle protected memory configuration if(CONFIG_GEN_UICR_PROTECTEDMEM) list(APPEND protectedmem_args --protectedmem) @@ -250,6 +256,7 @@ add_custom_command( --out-merged-hex ${merged_hex_file} --out-uicr-hex ${uicr_hex_file} ${lock_args} + ${eraseprotect_args} ${wdtstart_args} ${periphconf_args} ${securestorage_args} diff --git a/soc/nordic/common/uicr/gen_uicr/Kconfig b/soc/nordic/common/uicr/gen_uicr/Kconfig index e64fa93bdcac..f2692bb6b4ee 100644 --- a/soc/nordic/common/uicr/gen_uicr/Kconfig +++ b/soc/nordic/common/uicr/gen_uicr/Kconfig @@ -43,6 +43,18 @@ config GEN_UICR_LOCK This should be enabled only in production devices to prevent unauthorized modification. +config GEN_UICR_ERASEPROTECT + bool "Enable UICR.ERASEPROTECT" + depends on ! GEN_UICR_LOCK + help + When enabled, ERASEALL operations are blocked. + + This option is mutually exclusive with UICR.LOCK in Kconfig to prevent + accidental configuration where both are enabled simultaneously. If both + were enabled, the UICR would become impossible to modify in any way. + Note that gen_uicr.py can be used directly to create a configuration + with both enabled if needed. + config GEN_UICR_PROTECTEDMEM bool "Enable UICR.PROTECTEDMEM" help From 8fc703bea3bd64445fb6d2c357733357eed0f375 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B8e?= Date: Mon, 13 Oct 2025 15:34:46 +0200 Subject: [PATCH 1869/2141] [nrf fromtree] soc: nordic: uicr: Add support for UICR.APPROTECT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add support for UICR.APPROTECT configuration, which controls debugger and access-port permissions through the TAMPC peripheral. This introduces three Kconfig options that allow independent control over access port protection for different processor domains: - GEN_UICR_APPROTECT_APPLICATION_PROTECTED: Controls debug access to the application domain processor - GEN_UICR_APPROTECT_RADIOCORE_PROTECTED: Controls debug access to the radio core processor - GEN_UICR_APPROTECT_CORESIGHT_PROTECTED: Controls access to the CoreSight debug infrastructure When enabled, each option sets the corresponding UICR.APPROTECT register to PROTECTED (0xFFFFFFFF), which disables debug access for that domain. When disabled, the registers remain at their erased value (UNPROTECTED), allowing full debug access. This feature is critical for production devices where debug access must be restricted to prevent unauthorized access to sensitive code and data. Signed-off-by: Sebastian Bøe (cherry picked from commit 1438f8ae69f8869a7a99a241e50cb238b8174d11) --- scripts/ci/check_compliance.py | 3 +++ soc/nordic/common/uicr/gen_uicr.py | 26 +++++++++++++++++++ .../common/uicr/gen_uicr/CMakeLists.txt | 15 +++++++++++ soc/nordic/common/uicr/gen_uicr/Kconfig | 24 +++++++++++++++++ 4 files changed, 68 insertions(+) diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index 711f68904054..79bfbd774133 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -1300,6 +1300,9 @@ def check_no_undef_outside_kconfig(self, kconf): "FOO_LOG_LEVEL", "FOO_SETTING_1", "FOO_SETTING_2", + "GEN_UICR_APPROTECT_APPLICATION_PROTECTED", + "GEN_UICR_APPROTECT_CORESIGHT_PROTECTED", + "GEN_UICR_APPROTECT_RADIOCORE_PROTECTED", "GEN_UICR_ERASEPROTECT", "GEN_UICR_GENERATE_PERIPHCONF", # Used in specialized build tool, not part of main Kconfig "GEN_UICR_LOCK", diff --git a/soc/nordic/common/uicr/gen_uicr.py b/soc/nordic/common/uicr/gen_uicr.py index 390d96042528..036ee770e12c 100644 --- a/soc/nordic/common/uicr/gen_uicr.py +++ b/soc/nordic/common/uicr/gen_uicr.py @@ -25,6 +25,8 @@ # Common values for representing enabled/disabled in the UICR format. ENABLED_VALUE = 0xFFFF_FFFF DISABLED_VALUE = 0xBD23_28A8 +PROTECTED_VALUE = ENABLED_VALUE # UICR_PROTECTED = UICR_ENABLED per uicr_defs.h +UNPROTECTED_VALUE = DISABLED_VALUE # Unprotected uses the default erased value KB_4 = 4096 @@ -440,6 +442,21 @@ def main() -> None: action="store_true", help="Enable UICR.ERASEPROTECT to block ERASEALL operations", ) + parser.add_argument( + "--approtect-application-protected", + action="store_true", + help="Protect application domain access port (disable debug access)", + ) + parser.add_argument( + "--approtect-radiocore-protected", + action="store_true", + help="Protect radio core access port (disable debug access)", + ) + parser.add_argument( + "--approtect-coresight-protected", + action="store_true", + help="Protect CoreSight access port (disable debug access)", + ) parser.add_argument( "--protectedmem", action="store_true", @@ -613,6 +630,15 @@ def main() -> None: # Handle ERASEPROTECT configuration if args.eraseprotect: uicr.ERASEPROTECT = ENABLED_VALUE + # Handle APPROTECT configuration + if args.approtect_application_protected: + uicr.APPROTECT.APPLICATION = PROTECTED_VALUE + + if args.approtect_radiocore_protected: + uicr.APPROTECT.RADIOCORE = PROTECTED_VALUE + + if args.approtect_coresight_protected: + uicr.APPROTECT.CORESIGHT = PROTECTED_VALUE # Handle protected memory configuration if args.protectedmem: if args.protectedmem_size_bytes % KB_4 != 0: diff --git a/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt b/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt index 0802d4f2f870..290cf16a0a6f 100644 --- a/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt +++ b/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt @@ -77,6 +77,7 @@ endif() set(lock_args) set(eraseprotect_args) +set(approtect_args) set(protectedmem_args) set(periphconf_args) set(wdtstart_args) @@ -127,6 +128,19 @@ if(CONFIG_GEN_UICR_ERASEPROTECT) list(APPEND eraseprotect_args --eraseprotect) endif() +# Handle APPROTECT configuration +if(CONFIG_GEN_UICR_APPROTECT_APPLICATION_PROTECTED) + list(APPEND approtect_args --approtect-application-protected) +endif() + +if(CONFIG_GEN_UICR_APPROTECT_RADIOCORE_PROTECTED) + list(APPEND approtect_args --approtect-radiocore-protected) +endif() + +if(CONFIG_GEN_UICR_APPROTECT_CORESIGHT_PROTECTED) + list(APPEND approtect_args --approtect-coresight-protected) +endif() + # Handle protected memory configuration if(CONFIG_GEN_UICR_PROTECTEDMEM) list(APPEND protectedmem_args --protectedmem) @@ -257,6 +271,7 @@ add_custom_command( --out-uicr-hex ${uicr_hex_file} ${lock_args} ${eraseprotect_args} + ${approtect_args} ${wdtstart_args} ${periphconf_args} ${securestorage_args} diff --git a/soc/nordic/common/uicr/gen_uicr/Kconfig b/soc/nordic/common/uicr/gen_uicr/Kconfig index f2692bb6b4ee..3322d5cb9cbe 100644 --- a/soc/nordic/common/uicr/gen_uicr/Kconfig +++ b/soc/nordic/common/uicr/gen_uicr/Kconfig @@ -55,6 +55,30 @@ config GEN_UICR_ERASEPROTECT Note that gen_uicr.py can be used directly to create a configuration with both enabled if needed. +menu "UICR.APPROTECT - Access Port Protection" + +config GEN_UICR_APPROTECT_APPLICATION_PROTECTED + bool "Protect application domain access port" + help + When enabled, disables debug access to the application domain processor, + preventing debugger connection to application memory, registers, and debug + features. When disabled, full debug access is enabled. + +config GEN_UICR_APPROTECT_RADIOCORE_PROTECTED + bool "Protect radio core access port" + help + When enabled, disables debug access to the radio core processor, + preventing debugger connection to radio core memory, registers, and debug + features. When disabled, full debug access is enabled. + +config GEN_UICR_APPROTECT_CORESIGHT_PROTECTED + bool "Disable CoreSight subsystem" + help + When enabled will disable the coresight subsystem, preventing + system level trace features. + +endmenu + config GEN_UICR_PROTECTEDMEM bool "Enable UICR.PROTECTEDMEM" help From 5696f6b423a54390721955d6e0e63c363e02cfff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B8e?= Date: Wed, 15 Oct 2025 11:59:02 +0200 Subject: [PATCH 1870/2141] [nrf fromtree] soc: nordic: uicr: Add safety flag for permanent device transition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add --permit-permanently-transitioning-device-to-deployed safety flag to gen_uicr.py, required when enabling both UICR.LOCK and UICR.ERASEPROTECT together. This prevents accidental permanent locking of devices since this combination makes the configuration irreversible. Signed-off-by: Sebastian Bøe (cherry picked from commit 35b89abd6120036033a2591db67d1b7921a229e4) --- scripts/ci/check_compliance.py | 2 +- soc/nordic/common/uicr/gen_uicr.py | 24 ++++++++++++++++++++++-- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index 79bfbd774133..0169a837683f 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -1304,7 +1304,7 @@ def check_no_undef_outside_kconfig(self, kconf): "GEN_UICR_APPROTECT_CORESIGHT_PROTECTED", "GEN_UICR_APPROTECT_RADIOCORE_PROTECTED", "GEN_UICR_ERASEPROTECT", - "GEN_UICR_GENERATE_PERIPHCONF", # Used in specialized build tool, not part of main Kconfig + "GEN_UICR_GENERATE_PERIPHCONF", "GEN_UICR_LOCK", "GEN_UICR_PROTECTEDMEM", "GEN_UICR_PROTECTEDMEM_SIZE_BYTES", diff --git a/soc/nordic/common/uicr/gen_uicr.py b/soc/nordic/common/uicr/gen_uicr.py index 036ee770e12c..8dbbc7fe5ce9 100644 --- a/soc/nordic/common/uicr/gen_uicr.py +++ b/soc/nordic/common/uicr/gen_uicr.py @@ -432,6 +432,14 @@ def main() -> None: type=lambda s: int(s, 0), help="Size in bytes of cpurad_its_partition (decimal or 0x-prefixed hex)", ) + parser.add_argument( + "--permit-permanently-transitioning-device-to-deployed", + action="store_true", + help=( + "Safety flag required to enable both UICR.LOCK and UICR.ERASEPROTECT together. " + "Must be explicitly provided to acknowledge permanent device state changes." + ), + ) parser.add_argument( "--lock", action="store_true", @@ -624,10 +632,22 @@ def main() -> None: uicr.SECURESTORAGE.ITS.APPLICATIONSIZE1KB = args.cpuapp_its_size // 1024 uicr.SECURESTORAGE.ITS.RADIOCORESIZE1KB = args.cpurad_its_size // 1024 - # Handle LOCK configuration + # Handle LOCK and ERASEPROTECT configuration + # Check if both are enabled together - this requires explicit acknowledgment + if ( + args.lock + and args.eraseprotect + and not args.permit_permanently_transitioning_device_to_deployed + ): + raise ScriptError( + "Enabling both --lock and --eraseprotect requires " + "--permit-permanently-transitioning-device-to-deployed to be specified. " + "This combination permanently locks the device configuration and prevents " + "ERASEALL." + ) + if args.lock: uicr.LOCK = ENABLED_VALUE - # Handle ERASEPROTECT configuration if args.eraseprotect: uicr.ERASEPROTECT = ENABLED_VALUE # Handle APPROTECT configuration From f568ebf5c50cda90285a3c7b9b7056ecf7bf226a Mon Sep 17 00:00:00 2001 From: Aymen LAOUINI Date: Tue, 30 Sep 2025 15:43:46 +0300 Subject: [PATCH 1871/2141] [nrf fromtree] soc: ironside: Add UUID to boot report - The UUID is the device unique identifier read from the OTP and made available in boot report to avoid the repetitive slow reads from OTP. Signed-off-by: Aymen LAOUINI (cherry picked from commit 4312c881f3f5b1350ad7b3a605aa0cf16a916eb3) --- soc/nordic/ironside/include/nrf_ironside/boot_report.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/soc/nordic/ironside/include/nrf_ironside/boot_report.h b/soc/nordic/ironside/include/nrf_ironside/boot_report.h index c4d31c9dbc59..8c602c00134c 100644 --- a/soc/nordic/ironside/include/nrf_ironside/boot_report.h +++ b/soc/nordic/ironside/include/nrf_ironside/boot_report.h @@ -116,6 +116,8 @@ #define IRONSIDE_BOOT_REPORT_LOCAL_DOMAIN_CONTEXT_SIZE (16UL) /** Length of the random data buffer in bytes. */ #define IRONSIDE_BOOT_REPORT_RANDOM_DATA_SIZE (32UL) +/** Length of the uuid buffer in bytes. */ +#define IRONSIDE_BOOT_REPORT_UUID_SIZE (16UL) /** @brief Initialization/boot status description contained in the boot report. */ struct ironside_boot_report_init_status { @@ -207,8 +209,10 @@ struct ironside_boot_report { struct ironside_boot_report_init_context init_context; /** CSPRNG data */ uint8_t random_data[IRONSIDE_BOOT_REPORT_RANDOM_DATA_SIZE]; + /** Device Info data : 128-bit Universally Unique IDentifier (UUID) */ + uint8_t device_info_uuid[IRONSIDE_BOOT_REPORT_UUID_SIZE]; /** Reserved for Future Use */ - uint32_t rfu2[64]; + uint32_t rfu2[60]; }; /** From 53fe3820644a1a1198408dc327c2b44dbaf56541 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B8e?= Date: Thu, 16 Oct 2025 10:22:43 +0200 Subject: [PATCH 1872/2141] [nrf fromlist] soc: nordic: nrf54h: uicr: Improve deps for uicr/zephyr/zephyr.hex MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit uicr/zephyr/zephyr.hex needs to be built after all other zephyr images. Instead of adding a dependency on uicr, we check the sysbuild_images property to find images. Also, we check it as late possible by using the cmake_language(DEFER DIRECTORY feature. Which will ensure that running this code will be one of the last things that the CMake sysbuild program does at Configure time. Upstream PR #: 97685 Signed-off-by: Sebastian Bøe --- soc/nordic/common/uicr/sysbuild.cmake | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/soc/nordic/common/uicr/sysbuild.cmake b/soc/nordic/common/uicr/sysbuild.cmake index 9cafd261036d..fb797b6b76ee 100644 --- a/soc/nordic/common/uicr/sysbuild.cmake +++ b/soc/nordic/common/uicr/sysbuild.cmake @@ -9,7 +9,23 @@ ExternalZephyrProject_Add( # Ensure UICR is configured and built after the default image so EDT/ELFs exist. sysbuild_add_dependencies(CONFIGURE uicr ${DEFAULT_IMAGE}) -add_dependencies(uicr ${DEFAULT_IMAGE}) -if(DEFINED image) - add_dependencies(uicr ${image}) -endif() +# Add build dependencies for all images whose ELF files may be used by gen_uicr. +# The gen_uicr/CMakeLists.txt scans all sibling build directories and adds their +# ELF files as file dependencies. However, we also need target dependencies to +# ensure those images are built before uicr attempts to use their ELF files. +# +# Use cmake_language(DEFER DIRECTORY) to ensure this runs after ALL images have +# been added to the sysbuild_images global property, even if some module adds +# images after the soc subdirectory is processed. We defer to the source root +# directory to ensure we're at the top-level scope where all subdirectories have +# completed processing. +function(uicr_add_image_dependencies) + get_property(all_images GLOBAL PROPERTY sysbuild_images) + foreach(img ${all_images}) + if(NOT img STREQUAL "uicr") + add_dependencies(uicr ${img}) + endif() + endforeach() +endfunction() + +cmake_language(DEFER DIRECTORY ${CMAKE_SOURCE_DIR} CALL uicr_add_image_dependencies) From 40d6ebb67f706df333e94d04e3b615986daf6941 Mon Sep 17 00:00:00 2001 From: Tommi Kangas Date: Tue, 30 Sep 2025 15:14:58 +0300 Subject: [PATCH 1873/2141] [nrf fromtree] boards: nrf9280pdk: Fix LED pins for rev. 0.2.0 with IronSide LED pins need to be set in the cpuapp/iron rev. 0.2.0 overlay. Signed-off-by: Tommi Kangas (cherry picked from commit f8f87c07520485735e1241b275fd105c1c935ce5) --- ...f9280pdk_nrf9280_cpuapp_iron_0_2_0.overlay | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp_iron_0_2_0.overlay b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp_iron_0_2_0.overlay index f2d986e6cb06..4fa3f667eadd 100644 --- a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp_iron_0_2_0.overlay +++ b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp_iron_0_2_0.overlay @@ -5,3 +5,48 @@ */ #include "nrf9280pdk_nrf9280-pinctrl_0_2_0.dtsi" + +/ { + aliases { + pwm-led0 = &pwm_led2; /* Alias for compatibility with samples that use pwm-led0 */ + }; + + leds { + compatible = "gpio-leds"; + + led0: led_0 { + gpios = <&gpio9 0 GPIO_ACTIVE_HIGH>; + label = "Green LED 0"; + }; + + led1: led_1 { + gpios = <&gpio9 1 GPIO_ACTIVE_HIGH>; + label = "Green LED 1"; + }; + + led2: led_2 { + gpios = <&gpio9 2 GPIO_ACTIVE_HIGH>; + label = "Green LED 2"; + }; + + led3: led_3 { + gpios = <&gpio9 3 GPIO_ACTIVE_HIGH>; + label = "Green LED 3"; + }; + }; + + pwmleds { + compatible = "pwm-leds"; + + /delete-node/ pwm_led_0; + + /* + * There is no valid hardware configuration to pass PWM signal on pins 0 and 1. + * First valid config is P9.2. This corresponds to LED 2. + * Signal on PWM130's channel 0 can be passed directly on GPIO Port 9 pin 2. + */ + pwm_led2: pwm_led_2 { + pwms = <&pwm130 0 PWM_MSEC(20) PWM_POLARITY_NORMAL>; + }; + }; +}; From cb6ca018338cbe28f4ce531b435fd837b2988377 Mon Sep 17 00:00:00 2001 From: Tommi Kangas Date: Mon, 13 Oct 2025 14:40:34 +0300 Subject: [PATCH 1874/2141] [nrf fromtree] boards: nrf9280pdk: Add workaround for SoC1.1 data cache issue Added a workaround for nRF9280 SoC1.1 data cache related issue. Signed-off-by: Tommi Kangas (cherry picked from commit c01c4e9242df6cc43276c3bbc636e2775e45962d) --- .../nrf9280pdk_nrf9280-memory_map_iron.dtsi | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280-memory_map_iron.dtsi b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280-memory_map_iron.dtsi index aa95021d887c..d3aea1f979ae 100644 --- a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280-memory_map_iron.dtsi +++ b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280-memory_map_iron.dtsi @@ -16,16 +16,19 @@ / { reserved-memory { - cpuapp_cpusys_ipc_shm: memory@2f88f600 { - reg = <0x2f88f600 0x80>; + /* Workaround for a data cache related issue with SoC1.1, use secure addresses + * for cpuapp_cpusys_ipc_shm, cpusys_cpuapp_ipc_shm and cpusec_cpuapp_ipc_shm. + */ + cpuapp_cpusys_ipc_shm: memory@3f88f600 { + reg = <0x3f88f600 0x80>; }; - cpusys_cpuapp_ipc_shm: memory@2f88f680 { - reg = <0x2f88f680 0x80>; + cpusys_cpuapp_ipc_shm: memory@3f88f680 { + reg = <0x3f88f680 0x80>; }; - cpusec_cpuapp_ipc_shm: memory@2f88fb80 { - reg = <0x2f88fb80 0x80>; + cpusec_cpuapp_ipc_shm: memory@3f88fb80 { + reg = <0x3f88fb80 0x80>; }; cpuapp_ironside_se_event_report: memory@2f88fc00 { From 13716d515e3329f7f9a4378300ad45ded4ece057 Mon Sep 17 00:00:00 2001 From: Bartosz Miller Date: Tue, 14 Oct 2025 10:02:18 +0200 Subject: [PATCH 1875/2141] [nrf fromtree] tests: drivers: flash: Add missing fixtures for nrf54h All nrf54h flash tests require 'gpio_loopback' fixture Signed-off-by: Bartosz Miller (cherry picked from commit 4ad24ca8b9aea337594d6f43856a27df3909aa67) --- tests/drivers/flash/common/testcase.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/drivers/flash/common/testcase.yaml b/tests/drivers/flash/common/testcase.yaml index c2a4da0a705c..e5b0688deab3 100644 --- a/tests/drivers/flash/common/testcase.yaml +++ b/tests/drivers/flash/common/testcase.yaml @@ -177,6 +177,8 @@ tests: - nrf54h20dk/nrf54h20/cpuapp extra_args: - EXTRA_DTC_OVERLAY_FILE=boards/mx25uw63_single_io.overlay + harness_config: + fixture: gpio_loopback drivers.flash.common.ra_qspi_nor: filter: CONFIG_FLASH_RENESAS_RA_QSPI and dt_compat_enabled("renesas,ra-qspi-nor") platform_allow: @@ -192,6 +194,8 @@ tests: - nrf54h20dk/nrf54h20/cpuapp extra_args: - EXTRA_DTC_OVERLAY_FILE=boards/mx25uw63_single_io_4B_addr_sreset.overlay + harness_config: + fixture: gpio_loopback drivers.flash.common.mspi_low_frequency: platform_allow: - nrf54h20dk/nrf54h20/cpuapp From 8f74db8008cc0d34deeb13f34f427bbbaeef74d6 Mon Sep 17 00:00:00 2001 From: Bartlomiej Buczek Date: Mon, 13 Oct 2025 21:39:45 +0200 Subject: [PATCH 1876/2141] [nrf fromlist] test: drivers: flash: common: Add sfdp case for nrf54l15 tests. Add case for using flash with some parameters read with runtime sfdp instead of dt declarations. Upstream PR #: 97495 Signed-off-by: Bartlomiej Buczek --- .../common/boards/nrf54l15dk_remove_dt_sfdp.overlay | 13 +++++++++++++ tests/drivers/flash/common/testcase.yaml | 11 +++++++++++ 2 files changed, 24 insertions(+) create mode 100644 tests/drivers/flash/common/boards/nrf54l15dk_remove_dt_sfdp.overlay diff --git a/tests/drivers/flash/common/boards/nrf54l15dk_remove_dt_sfdp.overlay b/tests/drivers/flash/common/boards/nrf54l15dk_remove_dt_sfdp.overlay new file mode 100644 index 000000000000..b6ffcf23c785 --- /dev/null +++ b/tests/drivers/flash/common/boards/nrf54l15dk_remove_dt_sfdp.overlay @@ -0,0 +1,13 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&mx25r64 { +/delete-property/ jedec-id; +/delete-property/ sfdp-bfp; +/delete-property/ has-dpd; +/delete-property/ t-enter-dpd; +/delete-property/ t-exit-dpd; +}; diff --git a/tests/drivers/flash/common/testcase.yaml b/tests/drivers/flash/common/testcase.yaml index e5b0688deab3..550c73ffb1d5 100644 --- a/tests/drivers/flash/common/testcase.yaml +++ b/tests/drivers/flash/common/testcase.yaml @@ -61,6 +61,17 @@ tests: - nrf54l15dk/nrf54l15/cpuapp harness_config: fixture: external_flash + drivers.flash.common.no_explicit_erase.sfdp_runtime: + platform_allow: + - nrf54l15dk/nrf54l05/cpuapp + - nrf54l15dk/nrf54l10/cpuapp + - nrf54l15dk/nrf54l15/cpuapp + harness_config: + fixture: external_flash + extra_configs: + - CONFIG_SPI_NOR_SFDP_RUNTIME=y + extra_args: + - DTC_OVERLAY_FILE=boards/nrf54l15dk_remove_dt_sfdp.overlay drivers.flash.common.no_explicit_erase.nrf54h: platform_allow: - nrf54h20dk/nrf54h20/cpuapp From 97ffc89b51b561355602f11dd9c91de5fc02a4a2 Mon Sep 17 00:00:00 2001 From: Bartlomiej Buczek Date: Mon, 13 Oct 2025 21:52:33 +0200 Subject: [PATCH 1877/2141] [nrf fromlist] samples: drivers: jesd216: add nrf54l15dk cases. Extend jesd216 sample with nrf54l15dk cases. These platforms have jesd216 compatible flash memories on board. Upstream PR #: 97495 Signed-off-by: Bartlomiej Buczek --- samples/drivers/jesd216/sample.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/samples/drivers/jesd216/sample.yaml b/samples/drivers/jesd216/sample.yaml index a5b661c492ce..4fd0af6c9ca2 100644 --- a/samples/drivers/jesd216/sample.yaml +++ b/samples/drivers/jesd216/sample.yaml @@ -30,8 +30,11 @@ tests: platform_allow: nrf52840dk/nrf52840 integration_platforms: - nrf52840dk/nrf52840 - sample.drivers.jesd216.nrf54lm20: + sample.drivers.jesd216.nrf54l: platform_allow: + - nrf54l15dk/nrf54l15/cpuapp + - nrf54l15dk/nrf54l10/cpuapp + - nrf54l15dk/nrf54l05/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp integration_platforms: - nrf54lm20dk/nrf54lm20a/cpuapp From a2f5c0697be6add1324f343d8b0e1aa95d96a478 Mon Sep 17 00:00:00 2001 From: Tomasz Chyrowicz Date: Wed, 1 Oct 2025 15:46:16 +0200 Subject: [PATCH 1878/2141] [nrf fromtree] devicetree: Fix MTD macro for subpartitions The DT_MTD_FROM_FIXED_SUBPARTITION must go one level more than the DT_MTD_FROM_FIXED_PARTITION counterpart. Signed-off-by: Tomasz Chyrowicz (cherry picked from commit e4ecd4b290f98f5fde68f0ce6fea4a61a74ecf2d) --- include/zephyr/devicetree/fixed-partitions.h | 2 +- tests/lib/devicetree/api/src/main.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/include/zephyr/devicetree/fixed-partitions.h b/include/zephyr/devicetree/fixed-partitions.h index 14bb96bfc592..ad219ab7206f 100644 --- a/include/zephyr/devicetree/fixed-partitions.h +++ b/include/zephyr/devicetree/fixed-partitions.h @@ -160,7 +160,7 @@ extern "C" { */ #define DT_MTD_FROM_FIXED_SUBPARTITION(node_id) \ COND_CODE_1(DT_NODE_EXISTS(DT_MEM_FROM_FIXED_SUBPARTITION(node_id)), \ - (DT_PARENT(DT_MEM_FROM_FIXED_SUBPARTITION(node_id))), (DT_GPARENT(node_id))) + (DT_PARENT(DT_MEM_FROM_FIXED_SUBPARTITION(node_id))), (DT_GPARENT(DT_PARENT(node_id)))) /** * @brief Get the absolute address of a fixed subpartition diff --git a/tests/lib/devicetree/api/src/main.c b/tests/lib/devicetree/api/src/main.c index 98189ebe582c..ab2c72750764 100644 --- a/tests/lib/devicetree/api/src/main.c +++ b/tests/lib/devicetree/api/src/main.c @@ -3312,6 +3312,9 @@ ZTEST(devicetree_api, test_fixed_subpartitions) zassert_true(DT_NODE_EXISTS(DT_MTD_FROM_FIXED_PARTITION(TEST_SUBPARTITION_COMBINED))); zassert_true(DT_NODE_EXISTS(DT_MTD_FROM_FIXED_SUBPARTITION(TEST_SUBPARTITION_0))); zassert_true(DT_NODE_EXISTS(DT_MTD_FROM_FIXED_SUBPARTITION(TEST_SUBPARTITION_1))); + zassert_true(DT_SAME_NODE( + DT_MTD_FROM_FIXED_PARTITION(TEST_SUBPARTITION_COMBINED), + DT_MTD_FROM_FIXED_SUBPARTITION(TEST_SUBPARTITION_1))); /* Test DT_FIXED_SUBPARTITION_ADDR. */ zassert_equal(DT_FIXED_PARTITION_ADDR(TEST_SUBPARTITION_COMBINED), 0x20000100); From 546d0433e9ebb60c92062c12189dcab958f47c89 Mon Sep 17 00:00:00 2001 From: Tomasz Chyrowicz Date: Thu, 2 Oct 2025 11:17:50 +0200 Subject: [PATCH 1879/2141] [nrf fromtree] devicetree: Fix ADDRESS macro for non-nv-flash Currently the DT_FIXED_PARTITION_ADDR as well as DT_FIXED_SUBPARTITION_ADDR works only for partitions under the soc,nv-flash -compatible nodes. Signed-off-by: Tomasz Chyrowicz (cherry picked from commit 5c010ed9a31dc99ba5f955c989ee00136b89a921) --- include/zephyr/devicetree/fixed-partitions.h | 4 ++-- tests/lib/devicetree/api/src/main.c | 8 +------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/include/zephyr/devicetree/fixed-partitions.h b/include/zephyr/devicetree/fixed-partitions.h index ad219ab7206f..ff44e07ef644 100644 --- a/include/zephyr/devicetree/fixed-partitions.h +++ b/include/zephyr/devicetree/fixed-partitions.h @@ -131,7 +131,7 @@ extern "C" { * node containing it. */ #define DT_FIXED_PARTITION_ADDR(node_id) \ - (DT_REG_ADDR(DT_MEM_FROM_FIXED_PARTITION(node_id)) + DT_REG_ADDR(node_id)) + (DT_REG_ADDR(node_id) + DT_REG_ADDR(DT_GPARENT(node_id))) /** * @brief Test if fixed-subpartitions compatible node exists @@ -207,7 +207,7 @@ extern "C" { * node containing it. */ #define DT_FIXED_SUBPARTITION_ADDR(node_id) \ - (DT_REG_ADDR(DT_MEM_FROM_FIXED_SUBPARTITION(node_id)) + DT_REG_ADDR(node_id)) + (DT_REG_ADDR(node_id) + DT_REG_ADDR(DT_GPARENT(DT_PARENT(node_id)))) /** * @} diff --git a/tests/lib/devicetree/api/src/main.c b/tests/lib/devicetree/api/src/main.c index ab2c72750764..6c154d6dd5e1 100644 --- a/tests/lib/devicetree/api/src/main.c +++ b/tests/lib/devicetree/api/src/main.c @@ -3271,13 +3271,7 @@ ZTEST(devicetree_api, test_fixed_partitions) /* Test DT_FIXED_PARTITION_ADDR. */ zassert_equal(DT_FIXED_PARTITION_ADDR(TEST_PARTITION_0), 0x20000000); zassert_equal(DT_FIXED_PARTITION_ADDR(TEST_PARTITION_1), 0x200000c0); - - /* DT_FIXED_PARTITION_ADDR(TEST_PARTITION_2) expands to an invalid expression. - * Test this by way of string comparison. - */ - zassert_true(!strcmp(TO_STRING(DT_FIXED_PARTITION_ADDR(TEST_PARTITION_2)), - "(__REG_IDX_0_VAL_ADDRESSU + 458624U)")); - zassert_equal(DT_REG_ADDR(TEST_PARTITION_2), 458624); + zassert_equal(DT_FIXED_PARTITION_ADDR(TEST_PARTITION_2), 0x33291080); /* Test that all DT_FIXED_PARTITION_ID are defined and unique. */ #define FIXED_PARTITION_ID_COMMA(node_id) DT_FIXED_PARTITION_ID(node_id), From 769444d9d53b0d565785c464b59f50c2efc55366 Mon Sep 17 00:00:00 2001 From: Tomasz Chyrowicz Date: Tue, 30 Sep 2025 17:36:43 +0200 Subject: [PATCH 1880/2141] [nrf fromtree] storage: Allow to use subpartitions in flash_map Allow to use both partition and subpartition names when suing the flash_map API. That way it is possible to introduce a hierarchy within DTS in a backward compatible way. Signed-off-by: Tomasz Chyrowicz (cherry picked from commit 3ae8a4366785f8cedf794dbae1cb889ee4830ff3) --- include/zephyr/storage/flash_map.h | 60 ++++++++++++++++++-- subsys/storage/flash_map/flash_map_default.c | 13 +++-- 2 files changed, 61 insertions(+), 12 deletions(-) diff --git a/include/zephyr/storage/flash_map.h b/include/zephyr/storage/flash_map.h index f62f1c217185..9dc6bd91438f 100644 --- a/include/zephyr/storage/flash_map.h +++ b/include/zephyr/storage/flash_map.h @@ -353,14 +353,17 @@ uint8_t flash_area_erased_val(const struct flash_area *fa); #else /** - * Returns non-0 value if fixed-partition of given DTS node label exists. + * Returns non-0 value if fixed-partition or fixed-subpartition of given + * DTS node label exists. * * @param label DTS node label * * @return non-0 if fixed-partition node exists and is enabled; * 0 if node does not exist, is not enabled or is not fixed-partition. */ -#define FIXED_PARTITION_EXISTS(label) DT_FIXED_PARTITION_EXISTS(DT_NODELABEL(label)) +#define FIXED_PARTITION_EXISTS(label) \ + UTIL_OR(DT_FIXED_PARTITION_EXISTS(DT_NODELABEL(label)), \ + DT_FIXED_SUBPARTITION_EXISTS(DT_NODELABEL(label))) /** * Get flash area ID from fixed-partition DTS node label @@ -372,7 +375,7 @@ uint8_t flash_area_erased_val(const struct flash_area *fa); #define FIXED_PARTITION_ID(label) DT_FIXED_PARTITION_ID(DT_NODELABEL(label)) /** - * Get fixed-partition offset from DTS node label + * Get fixed-partition or fixed-subpartition offset from DTS node label * * @param label DTS node label of a partition * @@ -380,6 +383,30 @@ uint8_t flash_area_erased_val(const struct flash_area *fa); */ #define FIXED_PARTITION_OFFSET(label) DT_REG_ADDR(DT_NODELABEL(label)) +/** + * Get fixed-partition or fixed-subpartition address from DTS node label + * + * @param label DTS node label of a partition or subpartition + * + * @return fixed-partition address, as defined for the partition in DTS. + */ +#define FIXED_PARTITION_ADDRESS(label) \ + (COND_CODE_1(DT_FIXED_SUBPARTITION_EXISTS(DT_NODELABEL(label)), \ + (DT_FIXED_SUBPARTITION_ADDR(DT_NODELABEL(label))), \ + (DT_FIXED_PARTITION_ADDR(DT_NODELABEL(label))))) + +/** + * Get fixed-partition or fixed-subpartition address from DTS node + * + * @param node DTS node of a partition + * + * @return fixed-partition address, as defined for the partition in DTS. + */ +#define FIXED_PARTITION_NODE_ADDRESS(node) \ + (COND_CODE_1(DT_FIXED_SUBPARTITION_EXISTS(node), \ + (DT_FIXED_SUBPARTITION_ADDR(node)), \ + (DT_FIXED_PARTITION_ADDR(node)))) + /** * Get fixed-partition offset from DTS node * @@ -425,8 +452,10 @@ uint8_t flash_area_erased_val(const struct flash_area *fa); * @return Pointer to a device. */ #define FIXED_PARTITION_DEVICE(label) \ - DEVICE_DT_GET(DT_MTD_FROM_FIXED_PARTITION(DT_NODELABEL(label))) - + DEVICE_DT_GET(COND_CODE_1( \ + DT_FIXED_SUBPARTITION_EXISTS(DT_NODELABEL(label)), \ + (DT_MTD_FROM_FIXED_SUBPARTITION(DT_NODELABEL(label))), \ + (DT_MTD_FROM_FIXED_PARTITION(DT_NODELABEL(label))))) /** * Get device pointer for device the area/partition resides on * @@ -435,7 +464,10 @@ uint8_t flash_area_erased_val(const struct flash_area *fa); * @return Pointer to a device. */ #define FIXED_PARTITION_NODE_DEVICE(node) \ - DEVICE_DT_GET(DT_MTD_FROM_FIXED_PARTITION(node)) + DEVICE_DT_GET(COND_CODE_1( \ + DT_FIXED_SUBPARTITION_EXISTS(node), \ + (DT_MTD_FROM_FIXED_SUBPARTITION(node)), \ + (DT_MTD_FROM_FIXED_PARTITION(node)))) /** * Get pointer to flash_area object by partition label @@ -471,6 +503,22 @@ DT_FOREACH_STATUS_OKAY(fixed_partitions, FOR_EACH_PARTITION_TABLE) #undef DECLARE_PARTITION #undef DECLARE_PARTITION_0 #undef FOR_EACH_PARTITION_TABLE + +#define FIXED_SUBPARTITION_1(node) FIXED_SUBPARTITION_0(DT_DEP_ORD(node)) +#define FIXED_SUBPARTITION_0(ord) \ + ((const struct flash_area *)&DT_CAT(global_fixed_subpartition_ORD_, ord)) + +#define DECLARE_SUBPARTITION(node) DECLARE_SUBPARTITION_0(DT_DEP_ORD(node)) +#define DECLARE_SUBPARTITION_0(ord) \ + extern const struct flash_area DT_CAT(global_fixed_subpartition_ORD_, ord); +#define FOR_EACH_SUBPARTITION_TABLE(table) DT_FOREACH_CHILD(table, DECLARE_SUBPARTITION) + +/* Generate declarations */ +DT_FOREACH_STATUS_OKAY(fixed_subpartitions, FOR_EACH_SUBPARTITION_TABLE) + +#undef DECLARE_SUBPARTITION +#undef DECLARE_SUBPARTITION_0 +#undef FOR_EACH_SUBPARTITION_TABLE /** @endcond */ #endif /* USE_PARTITION_MANAGER */ diff --git a/subsys/storage/flash_map/flash_map_default.c b/subsys/storage/flash_map/flash_map_default.c index c0514d28a12c..6b1edfbbaef5 100644 --- a/subsys/storage/flash_map/flash_map_default.c +++ b/subsys/storage/flash_map/flash_map_default.c @@ -40,6 +40,7 @@ */ const struct flash_area default_flash_map[] = { DT_FOREACH_STATUS_OKAY(fixed_partitions, FOREACH_PARTITION) + DT_FOREACH_STATUS_OKAY(fixed_subpartitions, FOREACH_PARTITION) }; const int flash_map_entries = ARRAY_SIZE(default_flash_map); @@ -63,11 +64,11 @@ const struct flash_area *flash_map = default_flash_map; #define FOR_EACH_PARTITION_TABLE(table) DT_FOREACH_CHILD(table, DEFINE_PARTITION) DT_FOREACH_STATUS_OKAY(fixed_partitions, FOR_EACH_PARTITION_TABLE) -#define DEFINE_SUB_PARTITION(part) DEFINE_SUB_PARTITION_1(part, DT_DEP_ORD(part)) -#define DEFINE_SUB_PARTITION_1(part, ord) \ +#define DEFINE_SUBPARTITION(part) DEFINE_SUBPARTITION_1(part, DT_DEP_ORD(part)) +#define DEFINE_SUBPARTITION_1(part, ord) \ COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(DT_MTD_FROM_FIXED_SUBPARTITION(part)), \ - (DEFINE_SUB_PARTITION_0(part, ord)), ()) -#define DEFINE_SUB_PARTITION_0(part, ord) \ + (DEFINE_SUBPARTITION_0(part, ord)), ()) +#define DEFINE_SUBPARTITION_0(part, ord) \ const struct flash_area DT_CAT(global_fixed_subpartition_ORD_, ord) = { \ .fa_id = DT_FIXED_PARTITION_ID(part), \ .fa_off = DT_REG_ADDR(part), \ @@ -75,5 +76,5 @@ DT_FOREACH_STATUS_OKAY(fixed_partitions, FOR_EACH_PARTITION_TABLE) .fa_size = DT_REG_SIZE(part), \ }; -#define FOR_EACH_SUB_PARTITION_TABLE(table) DT_FOREACH_CHILD(table, DEFINE_SUB_PARTITION) -DT_FOREACH_STATUS_OKAY(fixed_subpartitions, FOR_EACH_SUB_PARTITION_TABLE) +#define FOR_EACH_SUBPARTITION_TABLE(table) DT_FOREACH_CHILD(table, DEFINE_SUBPARTITION) +DT_FOREACH_STATUS_OKAY(fixed_subpartitions, FOR_EACH_SUBPARTITION_TABLE) From f5610788e7be3f357b56700d2b797c83d026b025 Mon Sep 17 00:00:00 2001 From: Adam Kondraciuk Date: Fri, 17 Oct 2025 13:16:18 +0200 Subject: [PATCH 1881/2141] [nrf fromlist] boards: nordic: nrf54h: fix pm_ramfunc region Fix region for PM ram function on radiocore. Upstream PR #: 97792 Signed-off-by: Adam Kondraciuk --- boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts index a8c588268b3f..6aa0158afab1 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts @@ -135,7 +135,7 @@ zephyr_udc0: &usbhs { /* cache control functions - must be executed from RAM */ pm_ramfunc: cpurad_s2ram@2302ff40 { compatible = "zephyr,memory-region", "mmio-sram"; - reg = <0x2302ff80 192>; + reg = <0x2302ff40 192>; zephyr,memory-region = "PMLocalRamfunc"; }; }; From be1a9fd0eecaec02c882b52d2a9b411a1c6cb70c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Wed, 15 Oct 2025 08:15:02 +0200 Subject: [PATCH 1882/2141] [nrf fromtree] tests: boards: nrf: hwinfo: Add latest reset causes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reset cause API was expanded with two more reset causes. These are RESET_BOOTLOADER and RESET_FLASH. Add handling of RESET_BOOTLOADER and RESET_FLASH to reset_cause test. Signed-off-by: Sebastian Głąb (cherry picked from commit 9ff2c0ff9d48e1f91023fab3e1151955c7f85166) --- tests/boards/nrf/hwinfo/reset_cause/src/main.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/boards/nrf/hwinfo/reset_cause/src/main.c b/tests/boards/nrf/hwinfo/reset_cause/src/main.c index 7df98bce9bc1..4e4e3a1c5d44 100644 --- a/tests/boards/nrf/hwinfo/reset_cause/src/main.c +++ b/tests/boards/nrf/hwinfo/reset_cause/src/main.c @@ -134,6 +134,16 @@ static void print_supported_reset_cause(void) } else { LOG_INF("14: no support for RESET_TEMPERATURE"); } + if (supported & RESET_BOOTLOADER) { + LOG_INF("15: RESET_BOOTLOADER is supported"); + } else { + LOG_INF("15: no support for RESET_BOOTLOADER"); + } + if (supported & RESET_FLASH) { + LOG_INF("16: RESET_FLASH is supported"); + } else { + LOG_INF("16: no support for RESET_FLASH"); + } } else if (ret == -ENOSYS) { LOG_INF("hwinfo_get_supported_reset_cause() is NOT supported"); supported = 0; @@ -197,6 +207,12 @@ static void print_current_reset_cause(uint32_t *cause) if (*cause & RESET_TEMPERATURE) { LOG_INF("14: reset due to RESET_TEMPERATURE"); } + if (*cause & RESET_BOOTLOADER) { + LOG_INF("15: reset due to RESET_BOOTLOADER"); + } + if (*cause & RESET_FLASH) { + LOG_INF("16: reset due to RESET_FLASH"); + } } else if (ret == -ENOSYS) { LOG_INF("hwinfo_get_reset_cause() is NOT supported"); *cause = 0; From 72bbd1cddace672018b2366ae64597a97527476f Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Tue, 7 Oct 2025 11:15:32 +0200 Subject: [PATCH 1883/2141] [nrf fromtree] cmake: define linker argument for undefined symbol Specifying undefined symbol on linker invocation requests the linker to search and include the symbol. This ensures the symbol will be present in final output. Signed-off-by: Torsten Rasmussen (cherry picked from commit 428279ef412c095070b4c426661b33eb06eba7b2) --- arch/common/CMakeLists.txt | 3 +++ cmake/linker/arcmwdt/linker_flags.cmake | 2 ++ cmake/linker/armlink/linker_flags.cmake | 5 +++++ cmake/linker/iar/linker_flags.cmake | 1 + cmake/linker/ld/linker_flags.cmake | 2 ++ cmake/linker/xt-ld/linker_flags.cmake | 6 ++++-- 6 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 cmake/linker/armlink/linker_flags.cmake diff --git a/arch/common/CMakeLists.txt b/arch/common/CMakeLists.txt index d817afa3d7fe..a764235130ed 100644 --- a/arch/common/CMakeLists.txt +++ b/arch/common/CMakeLists.txt @@ -109,6 +109,9 @@ if (CONFIG_GEN_ISR_TABLES) add_dependencies(isr_tables zephyr_generated_headers) target_link_libraries(isr_tables zephyr_interface) zephyr_library_link_libraries(isr_tables) + + zephyr_link_libraries($_sw_isr_table) + zephyr_link_libraries($_irq_vector_table) endif() if(CONFIG_COVERAGE) diff --git a/cmake/linker/arcmwdt/linker_flags.cmake b/cmake/linker/arcmwdt/linker_flags.cmake index 32c6cb9dd660..e2984268d9db 100644 --- a/cmake/linker/arcmwdt/linker_flags.cmake +++ b/cmake/linker/arcmwdt/linker_flags.cmake @@ -41,6 +41,8 @@ check_set_linker_property(TARGET linker PROPERTY orphan_error ${LINKERFLAGPREFIX},--orphan-handling=error ) +check_set_linker_property(TARGET linker PROPERTY undefined ${LINKERFLAGPREFIX},-u) + set_property(TARGET linker PROPERTY partial_linking "-r") # Extra warnings options for twister run diff --git a/cmake/linker/armlink/linker_flags.cmake b/cmake/linker/armlink/linker_flags.cmake new file mode 100644 index 000000000000..207f83246a8f --- /dev/null +++ b/cmake/linker/armlink/linker_flags.cmake @@ -0,0 +1,5 @@ +# Copyright (c) 2025 Nordic Semiconductor +# +# SPDX-License-Identifier: Apache-2.0 + +set_property(TARGET linker PROPERTY undefined --undefined=) diff --git a/cmake/linker/iar/linker_flags.cmake b/cmake/linker/iar/linker_flags.cmake index 12d44ca24cd2..cdfc3a8e9a5a 100644 --- a/cmake/linker/iar/linker_flags.cmake +++ b/cmake/linker/iar/linker_flags.cmake @@ -23,6 +23,7 @@ set_property(TARGET linker PROPERTY optimization_speed --entry_list_in_address_o set_property(TARGET linker PROPERTY optimization_size --entry_list_in_address_order) set_property(TARGET linker PROPERTY optimization_size_aggressive --entry_list_in_address_order) +set_linker_property(TARGET linker PROPERTY undefined "--keep=") string(APPEND CMAKE_C_LINK_FLAGS --no-wrap-diagnostics) diff --git a/cmake/linker/ld/linker_flags.cmake b/cmake/linker/ld/linker_flags.cmake index 885a1844cc5d..33e5cd59322d 100644 --- a/cmake/linker/ld/linker_flags.cmake +++ b/cmake/linker/ld/linker_flags.cmake @@ -22,6 +22,8 @@ check_set_linker_property(TARGET linker PROPERTY orphan_error ${LINKERFLAGPREFIX},--orphan-handling=error ) +set_property(TARGET linker PROPERTY undefined ${LINKERFLAGPREFIX},--undefined=) + check_set_linker_property(TARGET linker PROPERTY memusage "${LINKERFLAGPREFIX},--print-memory-usage") check_set_linker_property(TARGET linker PROPERTY sanitizer_undefined -fsanitize=undefined) diff --git a/cmake/linker/xt-ld/linker_flags.cmake b/cmake/linker/xt-ld/linker_flags.cmake index ab66461e4522..535d76ecf650 100644 --- a/cmake/linker/xt-ld/linker_flags.cmake +++ b/cmake/linker/xt-ld/linker_flags.cmake @@ -19,11 +19,11 @@ check_set_linker_property(TARGET linker PROPERTY baremetal ) check_set_linker_property(TARGET linker PROPERTY orphan_warning - ${LINKERFLAGPREFIX},--orphan-handling=warn + ${LINKERFLAGPREFIX},--orphan-handling=warn ) check_set_linker_property(TARGET linker PROPERTY orphan_error - ${LINKERFLAGPREFIX},--orphan-handling=error + ${LINKERFLAGPREFIX},--orphan-handling=error ) set_property(TARGET linker PROPERTY partial_linking "-r") @@ -34,3 +34,5 @@ check_set_linker_property(TARGET linker PROPERTY sort_alignment ${LINKERFLAGPREFIX},--sort-common=descending ${LINKERFLAGPREFIX},--sort-section=alignment ) + +set_property(TARGET linker PROPERTY undefined ${LINKERFLAGPREFIX},--undefined=) From 20bb24b28db1f85a69fff361b74266e0c7043e30 Mon Sep 17 00:00:00 2001 From: Tomasz Chyrowicz Date: Thu, 2 Oct 2025 17:03:58 +0200 Subject: [PATCH 1884/2141] Revert "[nrf noup] mcumgr: img_mgmt: Fix check for chosen code partition" This reverts commit 28efd426f71845642be5347c09d5418ac5dcf50a. Signed-off-by: Tomasz Chyrowicz --- subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c index 05e3a9c64889..f5b997fabdf9 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c @@ -43,23 +43,6 @@ #if !defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_RAM_LOAD) -#if USE_PARTITION_MANAGER -#include - -#ifdef PM_MCUBOOT_SECONDARY_PAD_SIZE -BUILD_ASSERT(PM_MCUBOOT_PAD_SIZE == PM_MCUBOOT_SECONDARY_PAD_SIZE); -#endif - -#if CONFIG_BUILD_WITH_TFM - #define PM_ADDRESS_OFFSET (PM_MCUBOOT_PAD_SIZE + PM_TFM_SIZE) -#else - #define PM_ADDRESS_OFFSET (PM_MCUBOOT_PAD_SIZE) -#endif - -#define FIXED_PARTITION_IS_RUNNING_APP_PARTITION(label) \ - (FIXED_PARTITION_OFFSET(label) == (PM_ADDRESS - PM_ADDRESS_OFFSET)) - -#else /* ! USE_PARTITION_MANAGER */ #ifndef CONFIG_FLASH_LOAD_OFFSET #error MCUmgr requires application to be built with CONFIG_FLASH_LOAD_OFFSET set \ to be able to figure out application running slot. @@ -67,7 +50,6 @@ BUILD_ASSERT(PM_MCUBOOT_PAD_SIZE == PM_MCUBOOT_SECONDARY_PAD_SIZE); #define FIXED_PARTITION_IS_RUNNING_APP_PARTITION(label) \ (FIXED_PARTITION_OFFSET(label) == CONFIG_FLASH_LOAD_OFFSET) -#endif /* USE_PARTITION_MANAGER */ BUILD_ASSERT(sizeof(struct image_header) == IMAGE_HEADER_SIZE, "struct image_header not required size"); From 1d91e5fdc956f6469b69c1afe862db68f23a0a9a Mon Sep 17 00:00:00 2001 From: Tomasz Chyrowicz Date: Thu, 2 Oct 2025 16:55:47 +0200 Subject: [PATCH 1885/2141] [nrf fromtree] soc: Move to the app-specific partitions Use cpuapp_slot_partition instead of slot0_partition, so it is possible to add MCUboot header through --pad-header option. In such cases, the FLASH_LOAD_OFFSET does not point to the begining of the slot, but to the beginning of the executable area, thus the check for the active slot should use ranges instead of exact values. Signed-off-by: Tomasz Chyrowicz (cherry picked from commit 14af1654d1b4bbf537eabee4ae36789f7cc17c83) --- soc/nordic/nrf54h/soc.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/soc/nordic/nrf54h/soc.c b/soc/nordic/nrf54h/soc.c index 44c3a5314fa0..c291767d0906 100644 --- a/soc/nordic/nrf54h/soc.c +++ b/soc/nordic/nrf54h/soc.c @@ -36,6 +36,12 @@ LOG_MODULE_REGISTER(soc, CONFIG_SOC_LOG_LEVEL); #define HSFLL_NODE DT_NODELABEL(cpurad_hsfll) #endif +#define FIXED_PARTITION_ADDRESS(label) \ + (DT_REG_ADDR(DT_NODELABEL(label)) + \ + DT_REG_ADDR(COND_CODE_1(DT_FIXED_SUBPARTITION_EXISTS(DT_NODELABEL(label)), \ + (DT_GPARENT(DT_PARENT(DT_NODELABEL(label)))), \ + (DT_GPARENT(DT_NODELABEL(label)))))) + #ifdef CONFIG_USE_DT_CODE_PARTITION #define FLASH_LOAD_OFFSET DT_REG_ADDR(DT_CHOSEN(zephyr_code_partition)) #elif defined(CONFIG_FLASH_LOAD_OFFSET) @@ -43,7 +49,8 @@ LOG_MODULE_REGISTER(soc, CONFIG_SOC_LOG_LEVEL); #endif #define PARTITION_IS_RUNNING_APP_PARTITION(label) \ - (DT_REG_ADDR(DT_NODELABEL(label)) == FLASH_LOAD_OFFSET) + (DT_REG_ADDR(DT_NODELABEL(label)) <= FLASH_LOAD_OFFSET && \ + DT_REG_ADDR(DT_NODELABEL(label)) + DT_REG_SIZE(DT_NODELABEL(label)) > FLASH_LOAD_OFFSET) sys_snode_t soc_node; @@ -203,22 +210,16 @@ void soc_late_init_hook(void) void *radiocore_address = NULL; #if DT_NODE_EXISTS(DT_NODELABEL(cpurad_slot1_partition)) - if (PARTITION_IS_RUNNING_APP_PARTITION(slot1_partition)) { - radiocore_address = - (void *)(DT_REG_ADDR(DT_GPARENT(DT_NODELABEL(cpurad_slot1_partition))) + - DT_REG_ADDR(DT_NODELABEL(cpurad_slot1_partition)) + - CONFIG_ROM_START_OFFSET); + if (PARTITION_IS_RUNNING_APP_PARTITION(cpuapp_slot1_partition)) { + radiocore_address = (void *)(FIXED_PARTITION_ADDRESS(cpurad_slot1_partition) + + CONFIG_ROM_START_OFFSET); } else { - radiocore_address = - (void *)(DT_REG_ADDR(DT_GPARENT(DT_NODELABEL(cpurad_slot0_partition))) + - DT_REG_ADDR(DT_NODELABEL(cpurad_slot0_partition)) + - CONFIG_ROM_START_OFFSET); + radiocore_address = (void *)(FIXED_PARTITION_ADDRESS(cpurad_slot0_partition) + + CONFIG_ROM_START_OFFSET); } #else radiocore_address = - (void *)(DT_REG_ADDR(DT_GPARENT(DT_NODELABEL(cpurad_slot0_partition))) + - DT_REG_ADDR(DT_NODELABEL(cpurad_slot0_partition)) + - CONFIG_ROM_START_OFFSET); + (void *)(FIXED_PARTITION_ADDRESS(cpurad_slot0_partition) + CONFIG_ROM_START_OFFSET); #endif if (IS_ENABLED(CONFIG_SOC_NRF54H20_CPURAD_ENABLE_CHECK_VTOR) && From 5f34663de13d484338418171e0b9b3c6301845f8 Mon Sep 17 00:00:00 2001 From: Tomasz Chyrowicz Date: Thu, 2 Oct 2025 16:58:19 +0200 Subject: [PATCH 1886/2141] [nrf fromtree] dfu: Allow to use imgtool-based headers It is possible to add MCUboot header through --pad-header option. In such cases, the FLASH_LOAD_OFFSET does not point to the beginning of the slot, but to the beginning of the executable area, thus the check for the active slot should use ranges instead of exact values. Signed-off-by: Tomasz Chyrowicz (cherry picked from commit 32615695ad1b96670be8f2a38a8a9fd27e2d8ae5) --- subsys/dfu/img_util/flash_img.c | 5 +++-- subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c | 5 +++-- tests/subsys/dfu/img_util/src/main.c | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/subsys/dfu/img_util/flash_img.c b/subsys/dfu/img_util/flash_img.c index 83eb013c6612..24e95a8dc1a9 100644 --- a/subsys/dfu/img_util/flash_img.c +++ b/subsys/dfu/img_util/flash_img.c @@ -23,8 +23,9 @@ LOG_MODULE_REGISTER(flash_img, CONFIG_IMG_MANAGER_LOG_LEVEL); #include #endif -#define FIXED_PARTITION_IS_RUNNING_APP_PARTITION(label) \ - (FIXED_PARTITION_OFFSET(label) == CONFIG_FLASH_LOAD_OFFSET) +#define FIXED_PARTITION_IS_RUNNING_APP_PARTITION(label) \ + (FIXED_PARTITION_OFFSET(label) <= CONFIG_FLASH_LOAD_OFFSET && \ + FIXED_PARTITION_OFFSET(label) + FIXED_PARTITION_SIZE(label) > CONFIG_FLASH_LOAD_OFFSET) #include #if defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) && (CONFIG_TFM_MCUBOOT_IMAGE_NUMBER == 2) diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c index f5b997fabdf9..33f7ac408638 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c @@ -48,8 +48,9 @@ to be able to figure out application running slot. #endif -#define FIXED_PARTITION_IS_RUNNING_APP_PARTITION(label) \ - (FIXED_PARTITION_OFFSET(label) == CONFIG_FLASH_LOAD_OFFSET) +#define FIXED_PARTITION_IS_RUNNING_APP_PARTITION(label) \ + (FIXED_PARTITION_OFFSET(label) <= CONFIG_FLASH_LOAD_OFFSET && \ + FIXED_PARTITION_OFFSET(label) + FIXED_PARTITION_SIZE(label) > CONFIG_FLASH_LOAD_OFFSET) BUILD_ASSERT(sizeof(struct image_header) == IMAGE_HEADER_SIZE, "struct image_header not required size"); diff --git a/tests/subsys/dfu/img_util/src/main.c b/tests/subsys/dfu/img_util/src/main.c index dc7c46721267..33956be6251e 100644 --- a/tests/subsys/dfu/img_util/src/main.c +++ b/tests/subsys/dfu/img_util/src/main.c @@ -12,8 +12,9 @@ #define SLOT0_PARTITION slot0_partition #define SLOT1_PARTITION slot1_partition -#define FIXED_PARTITION_IS_RUNNING_APP_PARTITION(label) \ - (FIXED_PARTITION_OFFSET(label) == CONFIG_FLASH_LOAD_OFFSET) +#define FIXED_PARTITION_IS_RUNNING_APP_PARTITION(label) \ + (FIXED_PARTITION_OFFSET(label) <= CONFIG_FLASH_LOAD_OFFSET && \ + FIXED_PARTITION_OFFSET(label) + FIXED_PARTITION_SIZE(label) > CONFIG_FLASH_LOAD_OFFSET) #if FIXED_PARTITION_IS_RUNNING_APP_PARTITION(slot0_partition) #define UPLOAD_PARTITION_ID FIXED_PARTITION_ID(SLOT1_PARTITION) From e6d6cc0c6ada8c69a021c5bbc13f52831c7c53a3 Mon Sep 17 00:00:00 2001 From: Marek Pieta Date: Fri, 5 May 2023 11:12:26 +0200 Subject: [PATCH 1887/2141] [nrf noup] mcumgr: img_mgmt: Fix check for chosen code partition The "zephyr-code-partition" chosen DTS node cannot be used when build uses Partition Manager. In that case, mcumgr must rely on the definitions provided by the Partition Manager. Jira: NCSDK-21381 Signed-off-by: Marek Pieta Signed-off-by: Dominik Ermel Signed-off-by: Tomasz Chyrowicz (cherry picked from commit 6b04ceee078c40901b3ddd15e821fde8333d5f5c) --- subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c index 33f7ac408638..0bbb583cde94 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c @@ -43,6 +43,23 @@ #if !defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_RAM_LOAD) +#if USE_PARTITION_MANAGER +#include + +#ifdef PM_MCUBOOT_SECONDARY_PAD_SIZE +BUILD_ASSERT(PM_MCUBOOT_PAD_SIZE == PM_MCUBOOT_SECONDARY_PAD_SIZE); +#endif + +#if CONFIG_BUILD_WITH_TFM + #define PM_ADDRESS_OFFSET (PM_MCUBOOT_PAD_SIZE + PM_TFM_SIZE) +#else + #define PM_ADDRESS_OFFSET (PM_MCUBOOT_PAD_SIZE) +#endif + +#define FIXED_PARTITION_IS_RUNNING_APP_PARTITION(label) \ + (FIXED_PARTITION_OFFSET(label) == (PM_ADDRESS - PM_ADDRESS_OFFSET)) + +#else /* ! USE_PARTITION_MANAGER */ #ifndef CONFIG_FLASH_LOAD_OFFSET #error MCUmgr requires application to be built with CONFIG_FLASH_LOAD_OFFSET set \ to be able to figure out application running slot. @@ -51,6 +68,7 @@ #define FIXED_PARTITION_IS_RUNNING_APP_PARTITION(label) \ (FIXED_PARTITION_OFFSET(label) <= CONFIG_FLASH_LOAD_OFFSET && \ FIXED_PARTITION_OFFSET(label) + FIXED_PARTITION_SIZE(label) > CONFIG_FLASH_LOAD_OFFSET) +#endif /* USE_PARTITION_MANAGER */ BUILD_ASSERT(sizeof(struct image_header) == IMAGE_HEADER_SIZE, "struct image_header not required size"); From 077c91359e7b5b7d9ab18e8ad413d74432d4ffa9 Mon Sep 17 00:00:00 2001 From: Tomasz Chyrowicz Date: Thu, 25 Sep 2025 16:15:45 +0200 Subject: [PATCH 1888/2141] [nrf noup] boards: nordic: Skip offsets in merged slot In the merged slot approach, the memory reservation for the MCUboot header is done in CMake, as it is not obvious, which image includes the (merged) MCUboot header. This change will remove the unnecessary gap between images. Ref: NCSDK-35612 Signed-off-by: Tomasz Chyrowicz --- boards/nordic/nrf54h20dk/Kconfig.defconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/boards/nordic/nrf54h20dk/Kconfig.defconfig b/boards/nordic/nrf54h20dk/Kconfig.defconfig index 069ed7b6eba6..c11d3ef63e1f 100644 --- a/boards/nordic/nrf54h20dk/Kconfig.defconfig +++ b/boards/nordic/nrf54h20dk/Kconfig.defconfig @@ -13,6 +13,7 @@ config MAX_THREAD_BYTES default 3 if USERSPACE config ROM_START_OFFSET + default 0 if NCS_MCUBOOT_BOOTLOADER_SIGN_MERGED_BINARY default 0x800 if BOOTLOADER_MCUBOOT if !USE_DT_CODE_PARTITION @@ -39,6 +40,7 @@ config MAX_THREAD_BYTES default 3 if USERSPACE config ROM_START_OFFSET + default 0 if NCS_MCUBOOT_BOOTLOADER_SIGN_MERGED_BINARY default 0x800 if BOOTLOADER_MCUBOOT endif # BOARD_NRF54H20DK_NRF54H20_CPURAD From 9af87657e98288e0b56a0312790135faa87faff3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Mon, 13 Oct 2025 09:10:18 +0200 Subject: [PATCH 1889/2141] [nrf fromtree] dts: bindings: mspi-controller: Add "packet-data-limit" property MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a property with which MSPI controllers can indicate their limits on the maximum amount of data they can transfer in one packet. Use the property for the SSI controller, for which the clock stretching feature requires the use of the NDF field of the CTRLR1 register, which is 16-bit wide, hence the data length limit is 64 kB. Signed-off-by: Andrzej Głąbek (cherry picked from commit b42a33d49f3a009f1bd2f8797b6f107276f01b34) --- dts/bindings/mspi/mspi-controller.yaml | 8 ++++++++ dts/bindings/mspi/snps,designware-ssi.yaml | 4 ++++ dts/vendor/nordic/nrf54h20.dtsi | 1 + dts/vendor/nordic/nrf9280.dtsi | 1 + 4 files changed, 14 insertions(+) diff --git a/dts/bindings/mspi/mspi-controller.yaml b/dts/bindings/mspi/mspi-controller.yaml index 0f574c12153e..6f22d0dc0bf2 100644 --- a/dts/bindings/mspi/mspi-controller.yaml +++ b/dts/bindings/mspi/mspi-controller.yaml @@ -92,3 +92,11 @@ properties: Regardless of whether the CE pin may need software control or MSPI controller has dedicated CE pin, this field should be defined to help manage multiple devices on the same MSPI controller. + + packet-data-limit: + type: int + description: | + Specifies the maximum length of data that the controller can transfer + in a single packet. Transceive requests made to the controller must be + split into multiple packets if a single one would exceed this value. + If not specified, no limit is imposed. diff --git a/dts/bindings/mspi/snps,designware-ssi.yaml b/dts/bindings/mspi/snps,designware-ssi.yaml index fb516cb78358..69a2947f9efb 100644 --- a/dts/bindings/mspi/snps,designware-ssi.yaml +++ b/dts/bindings/mspi/snps,designware-ssi.yaml @@ -14,6 +14,10 @@ properties: interrupts: required: true + packet-data-limit: + required: true + const: 65536 + aux-reg-enable: type: boolean description: | diff --git a/dts/vendor/nordic/nrf54h20.dtsi b/dts/vendor/nordic/nrf54h20.dtsi index 62b9c39e3c6e..56806c5db171 100644 --- a/dts/vendor/nordic/nrf54h20.dtsi +++ b/dts/vendor/nordic/nrf54h20.dtsi @@ -649,6 +649,7 @@ interrupts = <149 NRF_DEFAULT_IRQ_PRIORITY>; power-domains = <&gdpwr_fast_active_0>; clock-frequency = ; + packet-data-limit = <65536>; fifo-depth = <32>; status = "disabled"; }; diff --git a/dts/vendor/nordic/nrf9280.dtsi b/dts/vendor/nordic/nrf9280.dtsi index fb27488e9dc4..791cd7d4c663 100644 --- a/dts/vendor/nordic/nrf9280.dtsi +++ b/dts/vendor/nordic/nrf9280.dtsi @@ -384,6 +384,7 @@ reg-names = "wrapper", "core"; interrupts = <149 NRF_DEFAULT_IRQ_PRIORITY>; clock-frequency = ; + packet-data-limit = <65536>; fifo-depth = <32>; status = "disabled"; }; From d3d01f7179159e9b5ea84799042b4ffebe5f2d49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Mon, 13 Oct 2025 09:21:48 +0200 Subject: [PATCH 1890/2141] [nrf fromtree] drivers: flash_mspi_nor: Take into account MSPI controller packet limit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use information provided in the dts node for the MSPI controller regarding maximum amount of data that can be transferred in one packet and split the requested transfers if necessary. Signed-off-by: Andrzej Głąbek (cherry picked from commit c3469a6764cbacc1705006581e67ce694ce09140) --- drivers/flash/flash_mspi_nor.c | 35 +++++++++++++++++++++++++++++----- drivers/flash/flash_mspi_nor.h | 1 + 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/drivers/flash/flash_mspi_nor.c b/drivers/flash/flash_mspi_nor.c index 03430401de0c..444509b695b5 100644 --- a/drivers/flash/flash_mspi_nor.c +++ b/drivers/flash/flash_mspi_nor.c @@ -336,6 +336,7 @@ static uint8_t get_rx_dummy(const struct device *dev) static int api_read(const struct device *dev, off_t addr, void *dest, size_t size) { + const struct flash_mspi_nor_config *dev_config = dev->config; struct flash_mspi_nor_data *dev_data = dev->data; const uint32_t flash_size = dev_flash_size(dev); int rc; @@ -353,11 +354,26 @@ static int api_read(const struct device *dev, off_t addr, void *dest, return rc; } - set_up_xfer_with_addr(dev, MSPI_RX, addr); - dev_data->xfer.rx_dummy = get_rx_dummy(dev); - dev_data->packet.data_buf = dest; - dev_data->packet.num_bytes = size; - rc = perform_xfer(dev, dev_data->cmd_info.read_cmd, true); + while (size > 0) { + uint32_t to_read; + + if (dev_config->packet_data_limit && + dev_config->packet_data_limit < size) { + to_read = dev_config->packet_data_limit; + } else { + to_read = size; + } + + set_up_xfer_with_addr(dev, MSPI_RX, addr); + dev_data->xfer.rx_dummy = get_rx_dummy(dev); + dev_data->packet.data_buf = dest; + dev_data->packet.num_bytes = to_read; + rc = perform_xfer(dev, dev_data->cmd_info.read_cmd, true); + + addr += to_read; + dest = (uint8_t *)dest + to_read; + size -= to_read; + } release(dev); @@ -1294,13 +1310,22 @@ BUILD_ASSERT((FLASH_SIZE(inst) % CONFIG_FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE) == 0, \ #define INIT_PRIORITY UTIL_INC(CONFIG_MSPI_INIT_PRIORITY) #endif +#define PACKET_DATA_LIMIT(inst) \ + DT_PROP_OR(DT_INST_BUS(inst), packet_data_limit, 0) + #define FLASH_MSPI_NOR_INST(inst) \ + BUILD_ASSERT(!PACKET_DATA_LIMIT(inst) || \ + FLASH_PAGE_SIZE(inst) <= PACKET_DATA_LIMIT(inst), \ + "Page size for " DT_NODE_FULL_NAME(DT_DRV_INST(inst)) \ + " exceeds controller packet data limit"); \ SFDP_BUILD_ASSERTS(inst); \ PM_DEVICE_DT_INST_DEFINE(inst, dev_pm_action_cb); \ DEFAULT_ERASE_TYPES_DEFINE(inst); \ static struct flash_mspi_nor_data dev##inst##_data; \ static const struct flash_mspi_nor_config dev##inst##_config = { \ .bus = DEVICE_DT_GET(DT_INST_BUS(inst)), \ + .packet_data_limit = DT_PROP_OR(DT_INST_BUS(inst), \ + packet_data_limit, 0), \ .flash_size = FLASH_SIZE(inst), \ .page_size = FLASH_PAGE_SIZE(inst), \ .mspi_id = MSPI_DEVICE_ID_DT_INST(inst), \ diff --git a/drivers/flash/flash_mspi_nor.h b/drivers/flash/flash_mspi_nor.h index 86c824cf4856..335af449b261 100644 --- a/drivers/flash/flash_mspi_nor.h +++ b/drivers/flash/flash_mspi_nor.h @@ -70,6 +70,7 @@ struct flash_mspi_nor_switch_info { struct flash_mspi_nor_config { const struct device *bus; + uint32_t packet_data_limit; uint32_t flash_size; uint16_t page_size; struct mspi_dev_id mspi_id; From 1fdb6926acfe2c0da67cdafce4072aa02d4098ce Mon Sep 17 00:00:00 2001 From: Georgios Vasilakis Date: Thu, 5 Sep 2024 10:41:36 +0200 Subject: [PATCH 1891/2141] [nrf noup] boards: nordic: Enable PSA RNG for nrf54h20 Noup since Ironside not available upstream and it is required for PSA RNG. This enables the PSA RNG as the default Zephyr entropy provider for the nrf54h20dk cpuapp and cpurad targets. Signed-off-by: Georgios Vasilakis --- .../nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 7 ++++++- .../nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts | 16 +++++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index d45f91c908bf..532e5d2eccc0 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -27,7 +27,7 @@ zephyr,bt-hci = &bt_hci_ipc0; nordic,802154-spinel-ipc = &ipc0; zephyr,canbus = &can120; - zephyr,entropy = &prng; + zephyr,entropy = &psa_rng; }; aliases { @@ -113,6 +113,11 @@ prng: prng { compatible = "nordic,entropy-prng"; + status = "disabled"; + }; + + psa_rng: psa-rng { + compatible = "zephyr,psa-crypto-rng"; status = "okay"; }; }; diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts index 6aa0158afab1..81241af8a64e 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts @@ -28,17 +28,23 @@ zephyr,ieee802154 = &cpurad_ieee802154; zephyr,bt-hci-ipc = &ipc0; nordic,802154-spinel-ipc = &ipc0; - zephyr,entropy = &prng; - }; - prng: prng { - compatible = "nordic,entropy-prng"; - status = "okay"; + zephyr,entropy = &psa_rng; }; aliases { ipc-to-cpusys = &cpurad_cpusys_ipc; resetinfo = &cpurad_resetinfo; }; + + prng: prng { + compatible = "nordic,entropy-prng"; + status = "disabled"; + }; + + psa_rng: psa-rng { + compatible = "zephyr,psa-crypto-rng"; + status = "okay"; + }; }; &cpurad_bellboard { From 856d9e081ac325a00bc076b61c5133d1d82ba20b Mon Sep 17 00:00:00 2001 From: Georgios Vasilakis Date: Thu, 9 Oct 2025 16:32:27 +0200 Subject: [PATCH 1892/2141] [nrf fromlist] tests: secure_storage: Exclude nRF54H20 targets Exclude the application and radio core targets for nRF54H20 since they use Ironside as their PSA storage provider. Upstream PR #: 96915 Signed-off-by: Georgios Vasilakis --- tests/subsys/secure_storage/psa/crypto/testcase.yaml | 3 +++ tests/subsys/secure_storage/psa/its/testcase.yaml | 2 ++ 2 files changed, 5 insertions(+) diff --git a/tests/subsys/secure_storage/psa/crypto/testcase.yaml b/tests/subsys/secure_storage/psa/crypto/testcase.yaml index 1482d23cb6c7..150177b8e3fc 100644 --- a/tests/subsys/secure_storage/psa/crypto/testcase.yaml +++ b/tests/subsys/secure_storage/psa/crypto/testcase.yaml @@ -1,6 +1,9 @@ common: tags: - psa.secure_storage + platform_exclude: + - nrf54h20dk/nrf54h20/cpuapp + - nrf54h20dk/nrf54h20/cpurad tests: secure_storage.psa.crypto.secure_storage: filter: CONFIG_SECURE_STORAGE and not CONFIG_SECURE_STORAGE_ITS_STORE_IMPLEMENTATION_NONE diff --git a/tests/subsys/secure_storage/psa/its/testcase.yaml b/tests/subsys/secure_storage/psa/its/testcase.yaml index 0125b9d1e210..c794ea1797e5 100644 --- a/tests/subsys/secure_storage/psa/its/testcase.yaml +++ b/tests/subsys/secure_storage/psa/its/testcase.yaml @@ -4,6 +4,8 @@ common: - nrf54l15dk/nrf54l15/cpuapp platform_exclude: - qemu_cortex_m0 # settings subsystem initialization fails + - nrf54h20dk/nrf54h20/cpuapp + - nrf54h20dk/nrf54h20/cpurad timeout: 600 tags: - psa.secure_storage From 0964fc55846ed51ed117b7b1feb568c45a51601b Mon Sep 17 00:00:00 2001 From: Valerio Setti Date: Tue, 23 Sep 2025 11:35:34 +0200 Subject: [PATCH 1893/2141] [nrf fromtree] modules: openthread: fix dependency for OPENTHREAD_CRYPTO_PSA The dependency should be PSA_CRYPTO_CLIENT and not MBEDTLS_PSA_CRYPTO_CLIENT because the former is more generic. TF-M can indeed provide PSA Crypto API, not only Mbed TLS. Signed-off-by: Valerio Setti (cherry picked from commit 46614ded36f099e0b5327c7df9967fdb75ada38b) --- modules/openthread/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/openthread/Kconfig b/modules/openthread/Kconfig index 99a90633f13a..afbc479b4fdd 100644 --- a/modules/openthread/Kconfig +++ b/modules/openthread/Kconfig @@ -320,7 +320,7 @@ config OPENTHREAD_MAC_SOFTWARE_CSMA_BACKOFF_ENABLE config OPENTHREAD_CRYPTO_PSA bool "ARM PSA crypto API" - depends on MBEDTLS_PSA_CRYPTO_CLIENT + depends on PSA_CRYPTO_CLIENT select OPENTHREAD_PLATFORM_KEY_REF if !OPENTHREAD_COPROCESSOR_RCP imply OPENTHREAD_PLATFORM_KEYS_EXPORTABLE_ENABLE help From bd899ed455edef9eb93c078c38bdb8bed1ec5b7a Mon Sep 17 00:00:00 2001 From: Valerio Setti Date: Wed, 1 Oct 2025 00:51:44 +0200 Subject: [PATCH 1894/2141] [nrf fromtree] drivers: bluetooth: esp32: remove selection of MBEDTLS_PSA_CRYPTO_C The driver code only relies on legacy Mbed TLS crypto, not on PSA API, so enabling MBEDTLS_PSA_CRYPTO_C is not needed here. Signed-off-by: Valerio Setti (cherry picked from commit 76037cec36554184a4ca82ffef4d4ba3bc61666e) --- drivers/bluetooth/hci/Kconfig.esp32 | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/bluetooth/hci/Kconfig.esp32 b/drivers/bluetooth/hci/Kconfig.esp32 index 9f363ebc700f..501c5238db79 100644 --- a/drivers/bluetooth/hci/Kconfig.esp32 +++ b/drivers/bluetooth/hci/Kconfig.esp32 @@ -492,7 +492,6 @@ config ESP32_BT_LE_CRYPTO_STACK_MBEDTLS select MBEDTLS_ECP_DP_SECP256R1_ENABLED select MBEDTLS_ECDH_C select MBEDTLS_ENTROPY_C - select MBEDTLS_PSA_CRYPTO_C help Use mbedTLS library for BLE cryptographic operations. From d16809413297a4cca0c7e0ba2ea8cbebafbde4cd Mon Sep 17 00:00:00 2001 From: Valerio Setti Date: Wed, 1 Oct 2025 00:58:16 +0200 Subject: [PATCH 1895/2141] [nrf fromtree] drivers: bluetooth: hci: do not select MBEDTLS_ENTROPY_C in BT_SILABS_EFR32 The driver only uses psa_generate_random() so ENTROPY_C is not required. Signed-off-by: Valerio Setti (cherry picked from commit 7b7b4fcde20c247279bcb51b64565ce4b37c2146) --- drivers/bluetooth/hci/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/bluetooth/hci/Kconfig b/drivers/bluetooth/hci/Kconfig index f1d1939259dc..ba218d731609 100644 --- a/drivers/bluetooth/hci/Kconfig +++ b/drivers/bluetooth/hci/Kconfig @@ -160,7 +160,6 @@ config BT_SILABS_EFR32 select SOC_GECKO_USE_RAIL select MBEDTLS select MBEDTLS_PSA_CRYPTO_C - select MBEDTLS_ENTROPY_C select HAS_BT_CTLR select BT_CTLR_PHY_UPDATE_SUPPORT select BT_CTLR_PER_INIT_FEAT_XCHG_SUPPORT From befc17735a873999c8bbf107d3d655c84de9d37c Mon Sep 17 00:00:00 2001 From: Valerio Setti Date: Tue, 23 Sep 2025 11:31:29 +0200 Subject: [PATCH 1896/2141] [nrf fromtree] modules: mbedtls: add new helper Kconfig symbol PSA_CRYPTO The goal of new Kconfig PSA_CRYPTO_PROVIDER is to automatically enable any of the PSA Crypto API provider available for the platform without having the user to manually pick the proper one. This provider can be either TF-M, if that's enabled in the build, or Mbed TLS otherwise. PSA_CRYPTO_PROVIDER simplifies also modules/subsystem Kconfigs removing blocks as: select MBEDTLS if !BUILD_WITH_TFM select MBEDTLS_PSA_CRYPTO_C if !BUILD_WITH_TFM Kconfig PSA_CRYPTO_PROVIDER_CUSTOM is also added to allow the end user to add a custom implementation of PSA Crypto API instead of TF-M or Mbed TLS ones. Signed-off-by: Valerio Setti (cherry picked from commit 1bc2db575f7eb88426f5c239877cbce9f6950ba7) --- drivers/bluetooth/hci/Kconfig | 3 +- modules/hostap/Kconfig | 2 +- modules/mbedtls/Kconfig.psa.logic | 33 +++++++++++++++++-- modules/uoscore-uedhoc/Kconfig | 4 +-- samples/net/sockets/http_server/Kconfig | 2 +- .../subsys/mgmt/updatehub/overlay-psa.conf | 3 +- subsys/bluetooth/crypto/Kconfig | 3 +- subsys/bluetooth/host/Kconfig | 6 ++-- subsys/jwt/Kconfig | 6 ++-- .../host/gatt/caching/psa_overlay.conf | 3 +- tests/bsim/bluetooth/ll/conn/psa_overlay.conf | 3 +- 11 files changed, 43 insertions(+), 25 deletions(-) diff --git a/drivers/bluetooth/hci/Kconfig b/drivers/bluetooth/hci/Kconfig index ba218d731609..92f4d4fa3d71 100644 --- a/drivers/bluetooth/hci/Kconfig +++ b/drivers/bluetooth/hci/Kconfig @@ -158,8 +158,7 @@ config BT_SILABS_EFR32 depends on ZEPHYR_HAL_SILABS_MODULE_BLOBS || BUILD_ONLY_NO_BLOBS depends on !PM || SOC_GECKO_PM_BACKEND_PMGR select SOC_GECKO_USE_RAIL - select MBEDTLS - select MBEDTLS_PSA_CRYPTO_C + select PSA_CRYPTO select HAS_BT_CTLR select BT_CTLR_PHY_UPDATE_SUPPORT select BT_CTLR_PER_INIT_FEAT_XCHG_SUPPORT diff --git a/modules/hostap/Kconfig b/modules/hostap/Kconfig index aa6d5d8689f6..1aa21670bb71 100644 --- a/modules/hostap/Kconfig +++ b/modules/hostap/Kconfig @@ -204,7 +204,7 @@ endchoice config WIFI_NM_WPA_SUPPLICANT_CRYPTO_MBEDTLS_PSA bool "Crypto Platform Secure Architecture support for WiFi" - imply MBEDTLS_PSA_CRYPTO_C + select PSA_CRYPTO select MBEDTLS_USE_PSA_CRYPTO select PSA_WANT_ALG_ECDH select PSA_WANT_ALG_HMAC diff --git a/modules/mbedtls/Kconfig.psa.logic b/modules/mbedtls/Kconfig.psa.logic index 2de81163dc1f..9c3a55ea3191 100644 --- a/modules/mbedtls/Kconfig.psa.logic +++ b/modules/mbedtls/Kconfig.psa.logic @@ -1,8 +1,37 @@ # Copyright (c) 2024 BayLibre SAS # SPDX-License-Identifier: Apache-2.0 -# This file extends Kconfig.psa (which is automatically generated) by adding -# some logic between PSA_WANT symbols. +config PSA_CRYPTO + bool "PSA Crypto API" + help + Enable a PSA Crypto API provider in the build. If TF-M is enabled then + it will be used for this scope, otherwise Mbed TLS will be used. + PSA_CRYPTO_PROVIDER_CUSTOM can be selected to use an out-of-tree + implementation. + +choice PSA_CRYPTO_PROVIDER + prompt "PSA Crypto API provider" + depends on PSA_CRYPTO + +config PSA_CRYPTO_PROVIDER_TFM + bool "Use TF-M" + depends on BUILD_WITH_TFM + select TFM_PARTITION_CRYPTO + +config PSA_CRYPTO_PROVIDER_MBEDTLS + bool "Use Mbed TLS" + depends on !BUILD_WITH_TFM + select MBEDTLS + select MBEDTLS_PSA_CRYPTO_C + +config PSA_CRYPTO_PROVIDER_CUSTOM + bool "Use an out-of-tree library" + depends on !BUILD_WITH_TFM + +endchoice # PSA_CRYPTO_PROVIDER + +# The following section extends Kconfig.psa.auto (which is automatically +# generated) by adding some logic between PSA_WANT symbols. config PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_BASIC bool diff --git a/modules/uoscore-uedhoc/Kconfig b/modules/uoscore-uedhoc/Kconfig index 06eaecd7b210..766249553188 100644 --- a/modules/uoscore-uedhoc/Kconfig +++ b/modules/uoscore-uedhoc/Kconfig @@ -5,7 +5,6 @@ menuconfig UOSCORE bool "UOSCORE library" depends on ZCBOR depends on ZCBOR_CANONICAL - depends on MBEDTLS select UOSCORE_UEDHOC_CRYPTO_COMMON help @@ -22,7 +21,6 @@ menuconfig UEDHOC bool "UEDHOC library" depends on ZCBOR depends on ZCBOR_CANONICAL - depends on MBEDTLS select UOSCORE_UEDHOC_CRYPTO_COMMON help This option enables the UEDHOC library. @@ -38,7 +36,7 @@ if UOSCORE || UEDHOC config UOSCORE_UEDHOC_CRYPTO_COMMON bool - imply MBEDTLS_PSA_CRYPTO_C if !BUILD_WITH_TFM + select PSA_CRYPTO select PSA_WANT_ALG_ECDH select PSA_WANT_ALG_ECDSA select PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT diff --git a/samples/net/sockets/http_server/Kconfig b/samples/net/sockets/http_server/Kconfig index 2f607259dfaa..07d5b26e52d5 100644 --- a/samples/net/sockets/http_server/Kconfig +++ b/samples/net/sockets/http_server/Kconfig @@ -17,7 +17,7 @@ config NET_SAMPLE_HTTP_SERVER_SERVICE_PORT config NET_SAMPLE_HTTPS_SERVICE bool "Enable https service" depends on NET_SOCKETS_SOCKOPT_TLS || TLS_CREDENTIALS - imply MBEDTLS_PSA_CRYPTO_C if !BUILD_WITH_TFM + select PSA_CRYPTO if NET_SAMPLE_HTTPS_SERVICE diff --git a/samples/subsys/mgmt/updatehub/overlay-psa.conf b/samples/subsys/mgmt/updatehub/overlay-psa.conf index 4b5dcfd9af67..8a70becc92d3 100644 --- a/samples/subsys/mgmt/updatehub/overlay-psa.conf +++ b/samples/subsys/mgmt/updatehub/overlay-psa.conf @@ -1,3 +1,2 @@ CONFIG_FLASH_AREA_CHECK_INTEGRITY_PSA=y -CONFIG_MBEDTLS=y -CONFIG_MBEDTLS_PSA_CRYPTO_C=y +CONFIG_PSA_CRYPTO=y diff --git a/subsys/bluetooth/crypto/Kconfig b/subsys/bluetooth/crypto/Kconfig index 0f46a0f59a0f..0e382060278a 100644 --- a/subsys/bluetooth/crypto/Kconfig +++ b/subsys/bluetooth/crypto/Kconfig @@ -3,8 +3,7 @@ config BT_CRYPTO bool - select MBEDTLS if !BUILD_WITH_TFM - select MBEDTLS_PSA_CRYPTO_C if !BUILD_WITH_TFM + select PSA_CRYPTO select PSA_WANT_KEY_TYPE_AES select PSA_WANT_ALG_CMAC select PSA_WANT_ALG_ECB_NO_PADDING diff --git a/subsys/bluetooth/host/Kconfig b/subsys/bluetooth/host/Kconfig index 126649f15029..2fb1b4198e39 100644 --- a/subsys/bluetooth/host/Kconfig +++ b/subsys/bluetooth/host/Kconfig @@ -200,8 +200,7 @@ config BT_BUF_EVT_DISCARDABLE_COUNT config BT_HOST_CRYPTO bool "Use crypto functionality implemented in the Bluetooth host" default y if !BT_CTLR_CRYPTO - select MBEDTLS if !BUILD_WITH_TFM - select MBEDTLS_PSA_CRYPTO_C if !BUILD_WITH_TFM + select PSA_CRYPTO select PSA_WANT_KEY_TYPE_AES select PSA_WANT_ALG_ECB_NO_PADDING help @@ -1041,8 +1040,7 @@ endif # BT_DF config BT_ECC bool - select MBEDTLS if !BUILD_WITH_TFM - select MBEDTLS_PSA_CRYPTO_C if !BUILD_WITH_TFM + select PSA_CRYPTO select PSA_WANT_ALG_ECDH select PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_GENERATE select PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT diff --git a/subsys/jwt/Kconfig b/subsys/jwt/Kconfig index 052908a77754..c1cafcc829cf 100644 --- a/subsys/jwt/Kconfig +++ b/subsys/jwt/Kconfig @@ -28,8 +28,7 @@ config JWT_SIGN_RSA_LEGACY config JWT_SIGN_RSA_PSA bool "Use RSA signature (RS-256). Use PSA Crypto API." - select MBEDTLS if !BUILD_WITH_TFM - select MBEDTLS_PSA_CRYPTO_C if !BUILD_WITH_TFM + select PSA_CRYPTO select PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY select PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_IMPORT select PSA_WANT_ALG_RSA_PKCS1V15_SIGN @@ -37,8 +36,7 @@ config JWT_SIGN_RSA_PSA config JWT_SIGN_ECDSA_PSA bool "Use ECDSA signature (ES-256). Use PSA Crypto API." - select MBEDTLS if !BUILD_WITH_TFM - select MBEDTLS_PSA_CRYPTO_C if !BUILD_WITH_TFM + select PSA_CRYPTO select PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT select PSA_WANT_ALG_ECDSA select PSA_WANT_ECC_SECP_R1_256 diff --git a/tests/bsim/bluetooth/host/gatt/caching/psa_overlay.conf b/tests/bsim/bluetooth/host/gatt/caching/psa_overlay.conf index b836ab2c23b2..bc7c220f62f6 100644 --- a/tests/bsim/bluetooth/host/gatt/caching/psa_overlay.conf +++ b/tests/bsim/bluetooth/host/gatt/caching/psa_overlay.conf @@ -1,3 +1,2 @@ -CONFIG_MBEDTLS=y -CONFIG_MBEDTLS_PSA_CRYPTO_C=y +CONFIG_PSA_CRYPTO=y CONFIG_PSA_CRYPTO_ENABLE_ALL=y diff --git a/tests/bsim/bluetooth/ll/conn/psa_overlay.conf b/tests/bsim/bluetooth/ll/conn/psa_overlay.conf index b836ab2c23b2..bc7c220f62f6 100644 --- a/tests/bsim/bluetooth/ll/conn/psa_overlay.conf +++ b/tests/bsim/bluetooth/ll/conn/psa_overlay.conf @@ -1,3 +1,2 @@ -CONFIG_MBEDTLS=y -CONFIG_MBEDTLS_PSA_CRYPTO_C=y +CONFIG_PSA_CRYPTO=y CONFIG_PSA_CRYPTO_ENABLE_ALL=y From 709df802af4ad3f19d3b9016ffc409dacd1c8e35 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Mon, 6 Oct 2025 08:43:55 +0100 Subject: [PATCH 1897/2141] [nrf noup] scripts: ci: check_compliance: Check Kconfigs for enable Allows checking sdk-nrf for Kconfig prompts that start with "Enable" as these should not be allowed Signed-off-by: Jamie McCrae --- scripts/ci/check_compliance.py | 57 ++++++++++++++++++++++++++++++++-- 1 file changed, 54 insertions(+), 3 deletions(-) diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index 0169a837683f..362102764704 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -505,6 +505,22 @@ class KconfigCheck(ComplianceTest): # Kconfig symbol prefix/namespace. CONFIG_ = "CONFIG_" + # If modules should be excluded from checks. + EXCLUDE_MODULES = False + + # This block list contains a list of upstream Zephyr modules that should not be checked + # DO NOT MERGE CHANGES TO THIS WITHOUT BUILD SYSTEM AND CODE OWNER APPROVAL! + external_module_name_block_list = ['canopennode', 'chre', 'cmsis', 'cmsis-dsp', 'cmsis-nn', + 'cmsis_6', 'edtt', 'fatfs', 'hal_st', 'hal_tdk', + 'hal_wurthelektronik', 'liblc3', 'libmetal', 'littlefs', + 'loramac-node', 'lvgl', 'lz4', 'mipi-sys-t', 'nanopb', + 'net-tools', 'nrf_hw_models', 'open-amp', 'percepio', + 'picolibc', 'segger', 'tf-m-tests', 'tinycrypt', + 'uoscore-uedhoc', 'zscilib'] + + # Holds a list or directories/files which should not be checked + blocked_module_dirs = [] + def run(self): kconf = self.parse_kconfig() @@ -542,13 +558,22 @@ def get_modules(self, _module_dirs_file, modules_file, sysbuild_modules_file, se modules = [name for name in os.listdir(modules_dir) if modules_dir / name / 'Kconfig'] - nrf_modules_dir = ZEPHYR_BASE / Path('../nrf/modules') + nrf_modules_dir = (Path(ZEPHYR_BASE) / '..' / 'nrf' / 'modules').resolve() nrf_modules = [] + + for module in modules: + if module in self.external_module_name_block_list: + self.blocked_module_dirs.append(modules_dir / module / 'Kconfig') + if os.path.exists(nrf_modules_dir): nrf_modules = [name for name in os.listdir(nrf_modules_dir) if os.path.exists(os.path.join(nrf_modules_dir, name, 'Kconfig'))] + for module in nrf_modules: + if module in self.external_module_name_block_list: + self.blocked_module_dirs.append(nrf_modules_dir / module / 'Kconfig') + with open(modules_file, 'r') as fp_module_file: content = fp_module_file.read() @@ -567,6 +592,7 @@ def get_modules(self, _module_dirs_file, modules_file, sysbuild_modules_file, se re.sub('[^a-zA-Z0-9]', '_', module).upper(), modules_dir / module / 'Kconfig' )) + # Add NRF as static entry as workaround for ext Kconfig root support fp_module_file.write("ZEPHYR_NRF_KCONFIG = {}\n".format( nrf_modules_dir / '..' / 'Kconfig.nrf' @@ -1052,9 +1078,32 @@ def check_no_enable_in_boolean_prompt(self, kconf): # Checks that boolean's prompt does not start with "Enable...". for node in kconf.node_iter(): - # skip Kconfig nodes not in-tree (will present an absolute path) + skip_node = False + + # skip Kconfig nodes not in-tree when set to (will present an absolute path) if os.path.isabs(node.filename): - continue + if self.EXCLUDE_MODULES is True: + continue + + normalised_file_name = Path(node.filename).resolve() + + for module_name in self.external_module_name_block_list: + # Workaround for being unable to use full_match() due to python version + if '/modules/' in str(normalised_file_name) and \ + ('/' + module_name + '/') in str(normalised_file_name): + skip_node = True + break + + if skip_node: + continue + + for blocked_dir in self.blocked_module_dirs: + if normalised_file_name.match(blocked_dir, case_sensitive=True): + skip_node = True + break + + if skip_node: + continue # 'kconfiglib' is global # pylint: disable=undefined-variable @@ -1506,6 +1555,7 @@ class KconfigBasicNoModulesCheck(KconfigBasicCheck): name = "KconfigBasicNoModules" path_hint = "" EMPTY_FILE_CONTENTS = "# Empty\n" + EXCLUDE_MODULES = True def get_modules(self, module_dirs_file, modules_file, sysbuild_modules_file, settings_file): with open(module_dirs_file, 'w') as fp_module_file: @@ -1598,6 +1648,7 @@ class SysbuildKconfigBasicNoModulesCheck(SysbuildKconfigCheck, KconfigBasicNoMod """ name = "SysbuildKconfigBasicNoModules" path_hint = "" + EXCLUDE_MODULES = True class Nits(ComplianceTest): From e9b0c496fb953bf5feb197330b73d13e8e909dfc Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Tue, 7 Oct 2025 15:08:36 +0100 Subject: [PATCH 1898/2141] [nrf noup] scripts: ci: check_compliance: Exclude BM docs nrf-squash! [nrf noup] scripts: ci: check_compliance: Exclude some docs Excludes bare metal release docs from the invalid Kconfig check as these will have old Kconfigs that have been removed Signed-off-by: Jamie McCrae --- scripts/ci/check_compliance.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index 362102764704..ce4cbca57e4c 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -1232,6 +1232,7 @@ def check_no_undef_outside_kconfig(self, kconf): ":!/doc/nrf/releases_and_maturity", ":!/doc/nrf/libraries/bin/lwm2m_carrier/CHANGELOG.rst", ":!/doc/nrf/app_dev/device_guides/nrf70/wifi_advanced_security_modes.rst", + ":!/doc/nrf-bm/release_notes", cwd=GIT_TOP) # splitlines() supports various line terminators From 5906f0d07e9c985b553591ff3b292ea9e49c0116 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Mon, 29 Sep 2025 09:06:40 +0200 Subject: [PATCH 1899/2141] [nrf fromtree] soc: nordic: nrf54h: increase default log stack size if CONFIG_PM=y The default log process thread stack size needs to be increased to account for the recursion into resuming power domains, which may happen within char_out for some backends like uart. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit 804134f28c61e0d5dfabd6155de3e6764aae419f) --- soc/nordic/nrf54h/Kconfig.defconfig | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/soc/nordic/nrf54h/Kconfig.defconfig b/soc/nordic/nrf54h/Kconfig.defconfig index a1b7961f3007..3e4c61810984 100644 --- a/soc/nordic/nrf54h/Kconfig.defconfig +++ b/soc/nordic/nrf54h/Kconfig.defconfig @@ -40,6 +40,13 @@ if PM config PM_DEVICE default y +if LOG + +config LOG_PROCESS_THREAD_STACK_SIZE + default 1536 + +endif # LOG + endif # PM if PM_DEVICE From b5a4e32fbbc8e5d88df44f03b1d11f43d9c2d2a3 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Mon, 29 Sep 2025 11:46:50 +0200 Subject: [PATCH 1900/2141] [nrf fromtree] drivers: adc: nrfx_saadc: implement PM device runtime The NRFX SAADC device driver needs to implement PM DEVICE for it to work with power domains, which is required for some SoCs. Inline PM device runtime "self get/put" pm has been implemented for the normal sync read API. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit 5fd26a6cb7412b3368a07aabbc675e85b2cb1f27) --- drivers/adc/adc_nrfx_saadc.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/drivers/adc/adc_nrfx_saadc.c b/drivers/adc/adc_nrfx_saadc.c index b92b5ccfe6b3..2c56e79f4897 100644 --- a/drivers/adc/adc_nrfx_saadc.c +++ b/drivers/adc/adc_nrfx_saadc.c @@ -12,6 +12,8 @@ #include #include #include +#include +#include #include #include @@ -725,10 +727,19 @@ static int adc_nrfx_read(const struct device *dev, { int error; + error = pm_device_runtime_get(dev); + if (error) { + return error; + } + adc_context_lock(&m_data.ctx, false, NULL); error = start_read(dev, sequence); adc_context_release(&m_data.ctx, error); + if (pm_device_runtime_put(dev)) { + LOG_ERR("PM put failed"); + } + return error; } @@ -778,6 +789,13 @@ static void event_handler(const nrfx_saadc_evt_t *event) } } +static int saadc_pm_handler(const struct device *dev, enum pm_device_action action) +{ + ARG_UNUSED(dev); + ARG_UNUSED(action); + return 0; +} + static int init_saadc(const struct device *dev) { nrfx_err_t err; @@ -795,7 +813,7 @@ static int init_saadc(const struct device *dev) adc_context_unlock_unconditionally(&m_data.ctx); - return 0; + return pm_device_driver_init(dev, saadc_pm_handler); } static DEVICE_API(adc, adc_nrfx_driver_api) = { @@ -838,5 +856,7 @@ DT_FOREACH_CHILD(DT_DRV_INST(0), VALIDATE_CHANNEL_CONFIG) NRF_DT_CHECK_NODE_HAS_REQUIRED_MEMORY_REGIONS(DT_DRV_INST(0)); -DEVICE_DT_INST_DEFINE(0, init_saadc, NULL, NULL, NULL, POST_KERNEL, - CONFIG_ADC_INIT_PRIORITY, &adc_nrfx_driver_api); +PM_DEVICE_DT_INST_DEFINE(0, saadc_pm_handler); +DEVICE_DT_INST_DEFINE(0, init_saadc, PM_DEVICE_DT_INST_GET(0), NULL, + NULL, POST_KERNEL, CONFIG_ADC_INIT_PRIORITY, + &adc_nrfx_driver_api); From 7868f4742bb767b53abd081dba247a22881bfec6 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Mon, 29 Sep 2025 11:51:05 +0200 Subject: [PATCH 1901/2141] [nrf fromtree] dts: vendor: nordic: nrf54h: move adc and comp to gdpwr_slow_main The ADC and COMP on the nrf54h20 both have all of their analog inputs routed to pads in different power domains than themselves, this means the device drivers for both of them need to request the pads to be resumed when active to allow any reading of the pads. To keep the drivers simple, we can rely on HW to keep the power domain the COMP and ADC are in powered, which happens automatically when the ADC or COMP is ENABLED. We can then place them on the power domain of their pads in the devicetree. This ensures the pads are powered and not retained while the devices are RESUMED. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit d6e940ef4a2e4465309fd187e2c88c3c02834054) --- dts/vendor/nordic/nrf54h20.dtsi | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/dts/vendor/nordic/nrf54h20.dtsi b/dts/vendor/nordic/nrf54h20.dtsi index 56806c5db171..9a9707c11354 100644 --- a/dts/vendor/nordic/nrf54h20.dtsi +++ b/dts/vendor/nordic/nrf54h20.dtsi @@ -1069,7 +1069,13 @@ interrupts = <386 NRF_DEFAULT_IRQ_PRIORITY>; status = "disabled"; #io-channel-cells = <1>; - power-domains = <&gdpwr_slow_active>; + /* + * This device is actually in the gdpwr_slow_active domain, but + * all of its analog inputs are routed to pads in the + * gdpwr_slow_main. Request gdpwr_slow_main and rely on the + * device HW to force its own power domain on while ENABLED. + */ + power-domains = <&gdpwr_slow_main>; zephyr,pm-device-runtime-auto; }; @@ -1082,7 +1088,13 @@ reg = <0x983000 0x1000>; status = "disabled"; interrupts = <387 NRF_DEFAULT_IRQ_PRIORITY>; - power-domains = <&gdpwr_slow_active>; + /* + * This device is actually in the gdpwr_slow_active domain, but + * all of its analog inputs are routed to pads in the + * gdpwr_slow_main. Request gdpwr_slow_main and rely on the + * device HW to force its own power domain on while ENABLED. + */ + power-domains = <&gdpwr_slow_main>; }; temp: temperature-sensor@984000 { From 5f379f3b8a8ab152d84fad0e9adcdbf98abc1734 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Fri, 25 Jul 2025 14:18:18 +0200 Subject: [PATCH 1902/2141] [nrf fromtree] pm: device: runtime: add PM_DEVICE_RUNTIME_DEFAULT_ENABLE Many SoCs which use PM_DEVICE_RUNTIME need every device in the system to have PM_DEVICE_RUNTIME enabled to function. Currently, this is only possible by adding zephyr,pm-device-runtime-auto; to every node in every devicetree which could potentially implement device power management. This is very error prone since its easy to miss a node, especially if users apply overlays, where users need to know and remember to apply or reapply this property. This commit adds a Kconfig, disabled by default, which automatically treats every device as if it had the zephyr,pm-device-runtime-auto property added to every node. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit 34c51c5ab47bec2202f3c81c4f87824a6c539c2e) --- subsys/pm/Kconfig | 9 +++++++++ subsys/pm/device.c | 3 ++- subsys/pm/device_runtime.c | 9 +++++++-- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/subsys/pm/Kconfig b/subsys/pm/Kconfig index af0409de559a..d1d99ac02e3a 100644 --- a/subsys/pm/Kconfig +++ b/subsys/pm/Kconfig @@ -177,6 +177,15 @@ endif #PM_DEVICE_RUNTIME_USE_DEDICATED_WQ endchoice endif # PM_DEVICE_RUNTIME_ASYNC + +config PM_DEVICE_RUNTIME_DEFAULT_ENABLE + bool "PM device runtime enable by default" + help + Enable PM device runtime by default for all devices when they are + initialized. This option is identical to adding the devicetree + property zephyr,pm-device-runtime-auto to all nodes in the + devicetree. + endif # PM_DEVICE_RUNTIME config PM_DEVICE_SHELL diff --git a/subsys/pm/device.c b/subsys/pm/device.c index 2d7bb3176c36..c74eea661f05 100644 --- a/subsys/pm/device.c +++ b/subsys/pm/device.c @@ -388,7 +388,8 @@ int pm_device_driver_init(const struct device *dev, /* If device will have PM device runtime enabled */ if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME) && - atomic_test_bit(&pm->flags, PM_DEVICE_FLAG_RUNTIME_AUTO)) { + (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME_DEFAULT_ENABLE) || + atomic_test_bit(&pm->flags, PM_DEVICE_FLAG_RUNTIME_AUTO))) { return 0; } diff --git a/subsys/pm/device_runtime.c b/subsys/pm/device_runtime.c index 490d7de49334..104d1fdb5955 100644 --- a/subsys/pm/device_runtime.c +++ b/subsys/pm/device_runtime.c @@ -401,10 +401,15 @@ int pm_device_runtime_auto_enable(const struct device *dev) { struct pm_device_base *pm = dev->pm_base; - /* No action needed if PM_DEVICE_FLAG_RUNTIME_AUTO is not enabled */ - if (!pm || !atomic_test_bit(&pm->flags, PM_DEVICE_FLAG_RUNTIME_AUTO)) { + if (!pm) { return 0; } + + if (!IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME_DEFAULT_ENABLE) && + !atomic_test_bit(&pm->flags, PM_DEVICE_FLAG_RUNTIME_AUTO)) { + return 0; + } + return pm_device_runtime_enable(dev); } From 8d5e4157d17844eec00e04c4c19bd85bb3b172de Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Fri, 25 Jul 2025 14:24:58 +0200 Subject: [PATCH 1903/2141] [nrf fromtree] soc: nordic: enable CONFIG_PM_DEVICE_RUNTIME_DEFAULT_ENABLE for all Enable CONFIG_PM_DEVICE_RUNTIME_DEFAULT_ENABLE by default for all nordic SoCs if CONFIG_PM_DEVICE_RUNTIME is used. This will ensure consistent behavior across all nordic SoCs and remove the need for pasting the devicetree propert zephyr,pm-device-runtime-auto everywhere. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit 61a9d6aa45868d65b4d24c257a2799a62fb9d32d) --- soc/nordic/common/Kconfig.defconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/soc/nordic/common/Kconfig.defconfig b/soc/nordic/common/Kconfig.defconfig index 077a73ad24d9..846151dd11a8 100644 --- a/soc/nordic/common/Kconfig.defconfig +++ b/soc/nordic/common/Kconfig.defconfig @@ -6,3 +6,6 @@ if RISCV_CORE_NORDIC_VPR rsource "vpr/Kconfig.defconfig" endif # RISCV_CORE_NORDIC_VPR + +config PM_DEVICE_RUNTIME_DEFAULT_ENABLE + default y if PM_DEVICE_RUNTIME From 776becbf86e2a15009b00afeb6dabdd0a154f81b Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Mon, 13 Oct 2025 10:39:49 +0200 Subject: [PATCH 1904/2141] [nrf fromlist] dts: vendor: nordic: nrf54h: remove power-domains from devices All devices used in their "normal"/intended configuration do not require management of the power domains, as the hardware itself will request them automatically. Thus by default, don't specify the power domains to avoid redundant resume/suspend cycles, which are slow and require threading (IPC) making devices not isr ok. Upstream PR #: 97452 Signed-off-by: Bjarki Arge Andreasen --- dts/vendor/nordic/nrf54h20.dtsi | 89 --------------------------------- 1 file changed, 89 deletions(-) diff --git a/dts/vendor/nordic/nrf54h20.dtsi b/dts/vendor/nordic/nrf54h20.dtsi index 9a9707c11354..ed18d023e356 100644 --- a/dts/vendor/nordic/nrf54h20.dtsi +++ b/dts/vendor/nordic/nrf54h20.dtsi @@ -259,7 +259,6 @@ mram1x: mram@e000000 { compatible = "nordic,mram"; reg = <0xe000000 DT_SIZE_K(2048)>; - power-domains = <&gdpwr_fast_active_0>; erase-block-size = <4096>; write-block-size = <16>; }; @@ -631,7 +630,6 @@ reg = <0x86000 0x1000>, <0x2f700000 0x40000>; reg-names = "wrapper", "core"; interrupts = <134 NRF_DEFAULT_IRQ_PRIORITY>; - power-domains = <&gdpwr_fast_active_0>; num-in-eps = <8>; num-out-eps = <10>; ghwcfg1 = <0xaa555000>; @@ -647,7 +645,6 @@ reg = <0x95000 0x500 0x95500 0xb00>; reg-names = "wrapper", "core"; interrupts = <149 NRF_DEFAULT_IRQ_PRIORITY>; - power-domains = <&gdpwr_fast_active_0>; clock-frequency = ; packet-data-limit = <65536>; fifo-depth = <32>; @@ -657,21 +654,18 @@ cpusec_bellboard: mailbox@99000 { reg = <0x99000 0x1000>; status = "disabled"; - power-domains = <&gdpwr_fast_active_0>; #mbox-cells = <1>; }; cpuapp_bellboard: mailbox@9a000 { reg = <0x9a000 0x1000>; status = "disabled"; - power-domains = <&gdpwr_fast_active_0>; #mbox-cells = <1>; }; cpurad_bellboard: mailbox@9b000 { reg = <0x9b000 0x1000>; status = "disabled"; - power-domains = <&gdpwr_fast_active_0>; #mbox-cells = <1>; }; @@ -712,7 +706,6 @@ compatible = "nordic,nrf-vpr-coprocessor"; reg = <0x8d4000 0x1000>; status = "disabled"; - power-domains = <&gdpwr_fast_active_1>; #address-cells = <1>; #size-cells = <1>; ranges = <0x0 0x8d4000 0x1000>; @@ -734,7 +727,6 @@ interrupts = <216 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&canpll>, <&hsfll120>; clock-names = "auxpll", "hsfll"; - power-domains = <&gdpwr_fast_active_1>; bosch,mram-cfg = <0x0 28 8 3 3 0 1 1>; status = "disabled"; }; @@ -743,7 +735,6 @@ compatible = "nordic,nrf-dppic-global"; reg = <0x8e1000 0x1000>; status = "disabled"; - power-domains = <&gdpwr_fast_active_1>; }; timer120: timer@8e2000 { @@ -752,7 +743,6 @@ status = "disabled"; cc-num = <6>; interrupts = <226 NRF_DEFAULT_IRQ_PRIORITY>; - power-domains = <&gdpwr_fast_active_1>; max-bit-width = <32>; clocks = <&hsfll120>; prescaler = <0>; @@ -764,7 +754,6 @@ status = "disabled"; cc-num = <6>; interrupts = <227 NRF_DEFAULT_IRQ_PRIORITY>; - power-domains = <&gdpwr_fast_active_1>; max-bit-width = <32>; clocks = <&hsfll120>; prescaler = <0>; @@ -776,7 +765,6 @@ status = "disabled"; interrupts = <228 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&hsfll120>; - power-domains = <&gdpwr_fast_active_1>; #pwm-cells = <3>; idleout-supported; }; @@ -785,7 +773,6 @@ compatible = "nordic,nrf-spis"; reg = <0x8e5000 0x1000>; status = "disabled"; - power-domains = <&gdpwr_fast_active_1>; easydma-maxcnt-bits = <15>; interrupts = <229 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&hsfll120>; @@ -799,7 +786,6 @@ compatible = "nordic,nrf-spim"; reg = <0x8e6000 0x1000>; status = "disabled"; - power-domains = <&gdpwr_fast_active_1>; easydma-maxcnt-bits = <15>; interrupts = <230 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&hsfll120>; @@ -817,7 +803,6 @@ status = "disabled"; interrupts = <230 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&hsfll120>; - power-domains = <&gdpwr_fast_active_1>; endtx-stoptx-supported; frame-timeout-supported; zephyr,pm-device-runtime-auto; @@ -830,7 +815,6 @@ easydma-maxcnt-bits = <15>; interrupts = <231 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&hsfll120>; - power-domains = <&gdpwr_fast_active_1>; max-frequency = ; #address-cells = <1>; #size-cells = <0>; @@ -846,7 +830,6 @@ #address-cells = <1>; #size-cells = <1>; ranges = <0x0 0x908000 0x1000>; - power-domains = <&gdpwr_slow_active>; cpuppr_vevif_tx: mailbox@0 { compatible = "nordic,nrf-vevif-task-tx"; @@ -862,7 +845,6 @@ compatible = "nordic,nrf-ipct-global"; reg = <0x921000 0x1000>; status = "disabled"; - power-domains = <&gdpwr_slow_main>; channels = <8>; global-domain-id = <13>; }; @@ -871,7 +853,6 @@ compatible = "nordic,nrf-dppic-global"; reg = <0x922000 0x1000>; status = "disabled"; - power-domains = <&gdpwr_slow_main>; }; rtc130: rtc@928000 { @@ -881,7 +862,6 @@ cc-num = <4>; clock-frequency = <32768>; interrupts = <296 NRF_DEFAULT_IRQ_PRIORITY>; - power-domains = <&gdpwr_slow_main>; clocks = <&lfclk>; prescaler = <1>; }; @@ -893,7 +873,6 @@ cc-num = <4>; clock-frequency = <32768>; interrupts = <297 NRF_DEFAULT_IRQ_PRIORITY>; - power-domains = <&gdpwr_slow_main>; clocks = <&lfclk>; prescaler = <1>; }; @@ -904,7 +883,6 @@ status = "disabled"; interrupts = <299 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&lfclk>; - power-domains = <&gdpwr_slow_main>; }; wdt132: watchdog@92c000 { @@ -913,7 +891,6 @@ status = "disabled"; interrupts = <300 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&lfclk>; - power-domains = <&gdpwr_slow_main>; }; egu130: egu@92d000 { @@ -921,14 +898,12 @@ reg = <0x92d000 0x1000>; status = "disabled"; interrupts = <301 NRF_DEFAULT_IRQ_PRIORITY>; - power-domains = <&gdpwr_slow_main>; }; gpiote130: gpiote@934000 { compatible = "nordic,nrf-gpiote"; reg = <0x934000 0x1000>; status = "disabled"; - power-domains = <&gdpwr_slow_main>; instance = <130>; }; @@ -938,7 +913,6 @@ status = "disabled"; #gpio-cells = <2>; gpio-controller; - power-domains = <&gdpwr_slow_main>; gpiote-instance = <&gpiote130>; ngpios = <12>; port = <0>; @@ -946,7 +920,6 @@ gpio_pad_group0: pad-group { compatible = "nordic,nrf-gpio-pad-group"; - power-domains = <&gdpwr_slow_main>; retain-mask = <0xFFF>; zephyr,pm-device-runtime-auto; status = "disabled"; @@ -959,7 +932,6 @@ status = "disabled"; #gpio-cells = <2>; gpio-controller; - power-domains = <&gdpwr_slow_main>; gpiote-instance = <&gpiote130>; ngpios = <12>; port = <1>; @@ -967,7 +939,6 @@ gpio_pad_group1: pad-group { compatible = "nordic,nrf-gpio-pad-group"; - power-domains = <&gdpwr_slow_main>; retain-mask = <0xFFF>; zephyr,pm-device-runtime-auto; status = "disabled"; @@ -980,7 +951,6 @@ status = "disabled"; #gpio-cells = <2>; gpio-controller; - power-domains = <&gdpwr_slow_main>; gpiote-instance = <&gpiote130>; ngpios = <12>; port = <2>; @@ -988,7 +958,6 @@ gpio_pad_group2: pad-group { compatible = "nordic,nrf-gpio-pad-group"; - power-domains = <&gdpwr_slow_main>; retain-mask = <0xFFF>; zephyr,pm-device-runtime-auto; status = "disabled"; @@ -1001,14 +970,12 @@ status = "disabled"; #gpio-cells = <2>; gpio-controller; - power-domains = <&gdpwr_slow_main>; ngpios = <14>; port = <6>; zephyr,pm-device-runtime-auto; gpio_pad_group6: pad-group { compatible = "nordic,nrf-gpio-pad-group"; - power-domains = <&gdpwr_fast_active_1>; retain-mask = <0x3FFF>; zephyr,pm-device-runtime-auto; status = "disabled"; @@ -1021,14 +988,12 @@ status = "disabled"; #gpio-cells = <2>; gpio-controller; - power-domains = <&gdpwr_slow_main>; ngpios = <8>; port = <7>; zephyr,pm-device-runtime-auto; gpio_pad_group7: pad-group { compatible = "nordic,nrf-gpio-pad-group"; - power-domains = <&gdpwr_fast_active_1>; retain-mask = <0xFF>; zephyr,pm-device-runtime-auto; status = "disabled"; @@ -1041,7 +1006,6 @@ status = "disabled"; #gpio-cells = <2>; gpio-controller; - power-domains = <&gdpwr_slow_main>; gpiote-instance = <&gpiote130>; ngpios = <6>; port = <9>; @@ -1049,7 +1013,6 @@ gpio_pad_group9: pad-group { compatible = "nordic,nrf-gpio-pad-group"; - power-domains = <&gdpwr_slow_main>; retain-mask = <0x3F>; zephyr,pm-device-runtime-auto; status = "disabled"; @@ -1060,7 +1023,6 @@ compatible = "nordic,nrf-dppic-global"; reg = <0x981000 0x1000>; status = "disabled"; - power-domains = <&gdpwr_slow_active>; }; adc: adc@982000 { @@ -1075,7 +1037,6 @@ * gdpwr_slow_main. Request gdpwr_slow_main and rely on the * device HW to force its own power domain on while ENABLED. */ - power-domains = <&gdpwr_slow_main>; zephyr,pm-device-runtime-auto; }; @@ -1094,7 +1055,6 @@ * gdpwr_slow_main. Request gdpwr_slow_main and rely on the * device HW to force its own power domain on while ENABLED. */ - power-domains = <&gdpwr_slow_main>; }; temp: temperature-sensor@984000 { @@ -1102,7 +1062,6 @@ reg = <0x984000 0x1000>; interrupts = <388 NRF_DEFAULT_IRQ_PRIORITY>; status = "disabled"; - power-domains = <&gdpwr_slow_active>; }; nfct: nfct@985000 { @@ -1110,14 +1069,12 @@ reg = <0x985000 0x1000>; status = "disabled"; interrupts = <389 NRF_DEFAULT_IRQ_PRIORITY>; - power-domains = <&gdpwr_slow_active>; }; dppic132: dppic@991000 { compatible = "nordic,nrf-dppic-global"; reg = <0x991000 0x1000>; status = "disabled"; - power-domains = <&gdpwr_slow_active>; }; pdm0: pdm@993000 { @@ -1126,7 +1083,6 @@ status = "disabled"; interrupts = <403 NRF_DEFAULT_IRQ_PRIORITY>; nordic,clockpin-enable = ; - power-domains = <&gdpwr_slow_active>; }; qdec130: qdec@994000 { @@ -1134,7 +1090,6 @@ reg = <0x994000 0x1000>; status = "disabled"; interrupts = <404 NRF_DEFAULT_IRQ_PRIORITY>; - power-domains = <&gdpwr_slow_active>; }; qdec131: qdec@995000 { @@ -1142,7 +1097,6 @@ reg = <0x995000 0x1000>; status = "disabled"; interrupts = <405 NRF_DEFAULT_IRQ_PRIORITY>; - power-domains = <&gdpwr_slow_active>; }; grtc: grtc@99c000 { @@ -1152,14 +1106,12 @@ cc-num = <16>; clocks = <&lfclk>, <&fll16m>; clock-names = "lfclock", "hfclock"; - power-domains = <&gdpwr_slow_active>; }; dppic133: dppic@9a1000 { compatible = "nordic,nrf-dppic-global"; reg = <0x9a1000 0x1000>; status = "disabled"; - power-domains = <&gdpwr_slow_active>; }; timer130: timer@9a2000 { @@ -1169,7 +1121,6 @@ cc-num = <6>; interrupts = <418 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; - power-domains = <&gdpwr_slow_active>; max-bit-width = <32>; prescaler = <0>; }; @@ -1181,7 +1132,6 @@ cc-num = <6>; interrupts = <419 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; - power-domains = <&gdpwr_slow_active>; max-bit-width = <32>; prescaler = <0>; }; @@ -1192,7 +1142,6 @@ status = "disabled"; interrupts = <420 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; - power-domains = <&gdpwr_slow_active>; #pwm-cells = <3>; idleout-supported; }; @@ -1203,7 +1152,6 @@ status = "disabled"; interrupts = <421 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; - power-domains = <&gdpwr_slow_active>; easydma-maxcnt-bits = <15>; #address-cells = <1>; #size-cells = <0>; @@ -1219,7 +1167,6 @@ easydma-maxcnt-bits = <15>; interrupts = <421 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; - power-domains = <&gdpwr_slow_active>; max-frequency = ; #address-cells = <1>; #size-cells = <0>; @@ -1237,7 +1184,6 @@ status = "disabled"; interrupts = <421 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; - power-domains = <&gdpwr_slow_active>; nordic,clockpin-enable = ; endtx-stoptx-supported; frame-timeout-supported; @@ -1250,7 +1196,6 @@ status = "disabled"; interrupts = <422 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; - power-domains = <&gdpwr_slow_active>; easydma-maxcnt-bits = <15>; #address-cells = <1>; #size-cells = <0>; @@ -1266,7 +1211,6 @@ easydma-maxcnt-bits = <15>; interrupts = <422 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; - power-domains = <&gdpwr_slow_active>; max-frequency = ; #address-cells = <1>; #size-cells = <0>; @@ -1284,7 +1228,6 @@ status = "disabled"; interrupts = <422 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; - power-domains = <&gdpwr_slow_active>; nordic,clockpin-enable = ; endtx-stoptx-supported; frame-timeout-supported; @@ -1295,7 +1238,6 @@ compatible = "nordic,nrf-dppic-global"; reg = <0x9b1000 0x1000>; status = "disabled"; - power-domains = <&gdpwr_slow_active>; }; timer132: timer@9b2000 { @@ -1305,7 +1247,6 @@ cc-num = <6>; interrupts = <434 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; - power-domains = <&gdpwr_slow_active>; max-bit-width = <32>; prescaler = <0>; }; @@ -1317,7 +1258,6 @@ cc-num = <6>; interrupts = <435 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; - power-domains = <&gdpwr_slow_active>; max-bit-width = <32>; prescaler = <0>; }; @@ -1328,7 +1268,6 @@ status = "disabled"; interrupts = <436 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; - power-domains = <&gdpwr_slow_active>; #pwm-cells = <3>; idleout-supported; }; @@ -1339,7 +1278,6 @@ status = "disabled"; interrupts = <437 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; - power-domains = <&gdpwr_slow_active>; easydma-maxcnt-bits = <15>; #address-cells = <1>; #size-cells = <0>; @@ -1355,7 +1293,6 @@ easydma-maxcnt-bits = <15>; interrupts = <437 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; - power-domains = <&gdpwr_slow_active>; max-frequency = ; #address-cells = <1>; #size-cells = <0>; @@ -1373,7 +1310,6 @@ status = "disabled"; interrupts = <437 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; - power-domains = <&gdpwr_slow_active>; nordic,clockpin-enable = ; endtx-stoptx-supported; frame-timeout-supported; @@ -1386,7 +1322,6 @@ status = "disabled"; interrupts = <438 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; - power-domains = <&gdpwr_slow_active>; easydma-maxcnt-bits = <15>; #address-cells = <1>; #size-cells = <0>; @@ -1402,7 +1337,6 @@ easydma-maxcnt-bits = <15>; interrupts = <438 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; - power-domains = <&gdpwr_slow_active>; max-frequency = ; #address-cells = <1>; #size-cells = <0>; @@ -1420,7 +1354,6 @@ status = "disabled"; interrupts = <438 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; - power-domains = <&gdpwr_slow_active>; nordic,clockpin-enable = ; endtx-stoptx-supported; frame-timeout-supported; @@ -1431,7 +1364,6 @@ compatible = "nordic,nrf-dppic-global"; reg = <0x9c1000 0x1000>; status = "disabled"; - power-domains = <&gdpwr_slow_active>; }; timer134: timer@9c2000 { @@ -1441,7 +1373,6 @@ cc-num = <6>; interrupts = <450 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; - power-domains = <&gdpwr_slow_active>; max-bit-width = <32>; prescaler = <0>; }; @@ -1453,7 +1384,6 @@ cc-num = <6>; interrupts = <451 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; - power-domains = <&gdpwr_slow_active>; max-bit-width = <32>; prescaler = <0>; }; @@ -1465,7 +1395,6 @@ interrupts = <452 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; #pwm-cells = <3>; - power-domains = <&gdpwr_slow_active>; idleout-supported; }; @@ -1475,7 +1404,6 @@ status = "disabled"; interrupts = <453 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; - power-domains = <&gdpwr_slow_active>; easydma-maxcnt-bits = <15>; #address-cells = <1>; #size-cells = <0>; @@ -1491,7 +1419,6 @@ easydma-maxcnt-bits = <15>; interrupts = <453 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; - power-domains = <&gdpwr_slow_active>; max-frequency = ; #address-cells = <1>; #size-cells = <0>; @@ -1509,7 +1436,6 @@ status = "disabled"; interrupts = <453 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; - power-domains = <&gdpwr_slow_active>; nordic,clockpin-enable = ; endtx-stoptx-supported; frame-timeout-supported; @@ -1522,7 +1448,6 @@ status = "disabled"; interrupts = <454 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; - power-domains = <&gdpwr_slow_active>; easydma-maxcnt-bits = <15>; #address-cells = <1>; #size-cells = <0>; @@ -1538,7 +1463,6 @@ easydma-maxcnt-bits = <15>; interrupts = <454 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; - power-domains = <&gdpwr_slow_active>; max-frequency = ; #address-cells = <1>; #size-cells = <0>; @@ -1556,7 +1480,6 @@ status = "disabled"; interrupts = <454 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; - power-domains = <&gdpwr_slow_active>; nordic,clockpin-enable = ; endtx-stoptx-supported; frame-timeout-supported; @@ -1567,7 +1490,6 @@ compatible = "nordic,nrf-dppic-global"; reg = <0x9d1000 0x1000>; status = "disabled"; - power-domains = <&gdpwr_slow_active>; }; timer136: timer@9d2000 { @@ -1577,7 +1499,6 @@ cc-num = <6>; interrupts = <466 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; - power-domains = <&gdpwr_slow_active>; max-bit-width = <32>; prescaler = <0>; }; @@ -1589,7 +1510,6 @@ cc-num = <6>; interrupts = <467 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; - power-domains = <&gdpwr_slow_active>; max-bit-width = <32>; prescaler = <0>; }; @@ -1601,7 +1521,6 @@ interrupts = <468 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; #pwm-cells = <3>; - power-domains = <&gdpwr_slow_active>; idleout-supported; }; @@ -1611,7 +1530,6 @@ status = "disabled"; interrupts = <469 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; - power-domains = <&gdpwr_slow_active>; easydma-maxcnt-bits = <15>; #address-cells = <1>; #size-cells = <0>; @@ -1627,7 +1545,6 @@ easydma-maxcnt-bits = <15>; interrupts = <469 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; - power-domains = <&gdpwr_slow_active>; max-frequency = ; #address-cells = <1>; #size-cells = <0>; @@ -1645,7 +1562,6 @@ status = "disabled"; interrupts = <469 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; - power-domains = <&gdpwr_slow_active>; nordic,clockpin-enable = ; endtx-stoptx-supported; frame-timeout-supported; @@ -1658,7 +1574,6 @@ status = "disabled"; interrupts = <470 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; - power-domains = <&gdpwr_slow_active>; easydma-maxcnt-bits = <15>; #address-cells = <1>; #size-cells = <0>; @@ -1674,7 +1589,6 @@ easydma-maxcnt-bits = <15>; interrupts = <470 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; - power-domains = <&gdpwr_slow_active>; max-frequency = ; #address-cells = <1>; #size-cells = <0>; @@ -1692,7 +1606,6 @@ status = "disabled"; interrupts = <470 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; - power-domains = <&gdpwr_slow_active>; nordic,clockpin-enable = ; endtx-stoptx-supported; frame-timeout-supported; @@ -1708,7 +1621,6 @@ interrupts = <402 NRF_DEFAULT_IRQ_PRIORITY>; status = "disabled"; clocks = <&fll16m>; - power-domains = <&gdpwr_slow_active>; nordic,clockpin-enable = , ; }; @@ -1722,7 +1634,6 @@ interrupts = <407 NRF_DEFAULT_IRQ_PRIORITY>; status = "disabled"; clocks = <&fll16m>; - power-domains = <&gdpwr_slow_active>; nordic,clockpin-enable = , ; }; From 7e81735eea272ecbdb399151237c3a13ef2317e7 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Mon, 13 Oct 2025 13:14:40 +0200 Subject: [PATCH 1905/2141] Revert "[nrf noup] dts: Select SoftDevice Controller on nRF54L09" This reverts commit 6c0719cb617317e293bd9521d963d61a2718136b. Signed-off-by: Bjarki Arge Andreasen --- .../nrf54l09pdk/nrf54l09_cpuapp_common.dtsi | 128 ---- dts/arm/nordic/nrf54l09_enga_cpuapp.dtsi | 4 +- dts/vendor/nordic/nrf54l09.dtsi | 628 ------------------ 3 files changed, 2 insertions(+), 758 deletions(-) delete mode 100644 boards/nordic/nrf54l09pdk/nrf54l09_cpuapp_common.dtsi delete mode 100644 dts/vendor/nordic/nrf54l09.dtsi diff --git a/boards/nordic/nrf54l09pdk/nrf54l09_cpuapp_common.dtsi b/boards/nordic/nrf54l09pdk/nrf54l09_cpuapp_common.dtsi deleted file mode 100644 index e1347c35948c..000000000000 --- a/boards/nordic/nrf54l09pdk/nrf54l09_cpuapp_common.dtsi +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/* This file is common to the secure and non-secure domain */ - -#include -#include "nrf54l09pdk_nrf54l09-common.dtsi" - -/ { - chosen { - zephyr,console = &uart20; - zephyr,shell-uart = &uart20; - zephyr,uart-mcumgr = &uart20; - zephyr,bt-mon-uart = &uart20; - zephyr,bt-c2h-uart = &uart20; - zephyr,flash-controller = &rram_controller; - zephyr,flash = &cpuapp_rram; - zephyr,bt-hci = &bt_hci_sdc; - zephyr,ieee802154 = &ieee802154; - }; -}; - -&cpuapp_sram { - status = "okay"; -}; - -&hfpll { - /* For now use 64 MHz clock for CPU and fast peripherals. */ - clock-frequency = ; -}; - -&lfxo { - load-capacitors = "internal"; - load-capacitance-femtofarad = <15500>; -}; - -&hfxo { - load-capacitors = "internal"; - load-capacitance-femtofarad = <15000>; -}; - -&grtc { - owned-channels = <0 1 2 3 4 5 6 7 8 9 10 11>; - /* Channels 7-11 reserved for Zero Latency IRQs, 3-4 for FLPR */ - child-owned-channels = <3 4 7 8 9 10 11>; - status = "okay"; -}; - -&cpuapp_rram { - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - boot_partition: partition@0 { - label = "mcuboot"; - reg = <0x0 DT_SIZE_K(64)>; - }; - - slot0_partition: partition@10000 { - label = "image-0"; - reg = <0x10000 DT_SIZE_K(212)>; - }; - - slot0_ns_partition: partition@45000 { - label = "image-0-nonsecure"; - reg = <0x45000 DT_SIZE_K(212)>; - }; - - slot1_partition: partition@7a000 { - label = "image-1"; - reg = <0x7a000 DT_SIZE_K(212)>; - }; - - slot1_ns_partition: partition@af000 { - label = "image-1-nonsecure"; - reg = <0xaf000 DT_SIZE_K(212)>; - }; - - storage_partition: partition@e4000 { - label = "storage"; - reg = <0xe4000 DT_SIZE_K(36)>; - }; - }; -}; - -&uart20 { - status = "okay"; -}; - -&gpio0 { - status = "okay"; -}; - -&gpio1 { - status = "okay"; -}; - -&gpiote20 { - status = "okay"; -}; - -&gpiote30 { - status = "okay"; -}; - -&radio { - status = "okay"; -}; - -&temp { - status = "okay"; -}; - -&clock { - status = "okay"; -}; - -&bt_hci_sdc { - status = "okay"; -}; - -&ieee802154 { - status = "okay"; -}; diff --git a/dts/arm/nordic/nrf54l09_enga_cpuapp.dtsi b/dts/arm/nordic/nrf54l09_enga_cpuapp.dtsi index 6c7f34d3b21e..1dfc5ce133c0 100644 --- a/dts/arm/nordic/nrf54l09_enga_cpuapp.dtsi +++ b/dts/arm/nordic/nrf54l09_enga_cpuapp.dtsi @@ -17,7 +17,7 @@ nvic: &cpuapp_nvic {}; / { chosen { - zephyr,bt-hci = &bt_hci_sdc; + zephyr,bt-hci = &bt_hci_controller; zephyr,entropy = &prng; }; @@ -38,7 +38,7 @@ nvic: &cpuapp_nvic {}; }; }; -&bt_hci_sdc { +&bt_hci_controller { status = "okay"; }; diff --git a/dts/vendor/nordic/nrf54l09.dtsi b/dts/vendor/nordic/nrf54l09.dtsi deleted file mode 100644 index 90ecc49b877c..000000000000 --- a/dts/vendor/nordic/nrf54l09.dtsi +++ /dev/null @@ -1,628 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include -#include - -/delete-node/ &sw_pwm; - -/* Domain IDs. Can be used to specify channel links in IPCT nodes. */ -#define NRF_DOMAIN_ID_APPLICATION 0 -#define NRF_DOMAIN_ID_FLPR 1 - -/ { - #address-cells = <1>; - #size-cells = <1>; - - cpus { - #address-cells = <1>; - #size-cells = <0>; - - cpuapp: cpu@0 { - compatible = "arm,cortex-m33f"; - reg = <0>; - device_type = "cpu"; - clocks = <&hfpll>; - #address-cells = <1>; - #size-cells = <1>; - - itm: itm@e0000000 { - compatible = "arm,armv8m-itm"; - reg = <0xe0000000 0x1000>; - swo-ref-frequency = ; - }; - }; - - cpuflpr: cpu@1 { - compatible = "nordic,vpr"; - reg = <1>; - device_type = "cpu"; - clock-frequency = ; - riscv,isa = "rv32emc"; - nordic,bus-width = <32>; - }; - }; - - clocks { - pclk: pclk { - compatible = "fixed-clock"; - #clock-cells = <0>; - clock-frequency = ; - }; - - lfxo: lfxo { - compatible = "nordic,nrf54l-lfxo"; - #clock-cells = <0>; - clock-frequency = <32768>; - }; - - hfxo: hfxo { - compatible = "nordic,nrf54l-hfxo"; - #clock-cells = <0>; - clock-frequency = ; - startup-time-us = <1650>; - }; - - hfpll: hfpll { - compatible = "fixed-clock"; - #clock-cells = <0>; - clock-frequency = ; - }; - }; - - soc { - #address-cells = <1>; - #size-cells = <1>; - - #ifdef USE_NON_SECURE_ADDRESS_MAP - /* intentionally empty because UICR is hardware fixed to Secure */ - #else - uicr: uicr@ffd000 { - compatible = "nordic,nrf-uicr"; - reg = <0xffd000 0x1000>; - }; - #endif - ficr: ficr@ffc000 { - compatible = "nordic,nrf-ficr"; - reg = <0xffc000 0x1000>; - #nordic,ficr-cells = <1>; - }; - - cpuapp_sram: memory@20000000 { - reg = <0x20000000 DT_SIZE_K(143)>; - ranges = <0x0 0x20000000 DT_SIZE_K(143)>; - compatible = "mmio-sram"; - #address-cells = <1>; - #size-cells = <1>; - }; - - cpuflpr_sram: memory@20023c00 { - compatible = "mmio-sram"; - reg = <0x20023c00 DT_SIZE_K(48)>; - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x20023c00 DT_SIZE_K(48)>; - }; - - #ifdef USE_NON_SECURE_ADDRESS_MAP - global_peripherals: peripheral@40000000 { - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x40000000 0x10000000>; - #else - global_peripherals: peripheral@50000000 { - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x50000000 0x10000000>; - #endif - - dppic00: dppic@42000 { - compatible = "nordic,nrf-dppic"; - reg = <0x42000 0x808>; - status = "disabled"; - }; - - ppib00: ppib@44000 { - compatible = "nordic,nrf-ppib"; - reg = <0x44000 0x1000>; - status = "disabled"; - }; - - ppib01: ppib@45000 { - compatible = "nordic,nrf-ppib"; - reg = <0x45000 0x1000>; - status = "disabled"; - }; - - cpuflpr_vpr: vpr@4c000 { - compatible = "nordic,nrf-vpr-coprocessor"; - reg = <0x4c000 0x1000>; - ranges = <0x0 0x4c000 0x1000>; - #address-cells = <1>; - #size-cells = <1>; - status = "disabled"; - enable-secure; - - cpuflpr_clic: interrupt-controller@f0000000 { - compatible = "nordic,nrf-clic"; - reg = <0xf0000000 0x1780>; - interrupt-controller; - #interrupt-cells = <2>; - #address-cells = <1>; - status = "disabled"; - }; - }; - - timer00: timer@55000 { - compatible = "nordic,nrf-timer"; - status = "disabled"; - reg = <0x55000 0x1000>; - cc-num = <6>; - max-bit-width = <32>; - interrupts = <85 NRF_DEFAULT_IRQ_PRIORITY>; - clocks = <&hfpll>; - prescaler = <0>; - }; - - dppic10: dppic@82000 { - compatible = "nordic,nrf-dppic"; - reg = <0x82000 0x808>; - status = "disabled"; - }; - - ppib10: ppib@83000 { - compatible = "nordic,nrf-ppib"; - reg = <0x83000 0x1000>; - status = "disabled"; - }; - - ppib11: ppib@84000 { - compatible = "nordic,nrf-ppib"; - reg = <0x84000 0x1000>; - status = "disabled"; - }; - - timer10: timer@85000 { - compatible = "nordic,nrf-timer"; - status = "disabled"; - reg = <0x85000 0x1000>; - cc-num = <8>; - max-bit-width = <32>; - interrupts = <133 NRF_DEFAULT_IRQ_PRIORITY>; - clocks = <&hfxo>; - prescaler = <0>; - }; - - egu10: egu@87000 { - compatible = "nordic,nrf-egu"; - reg = <0x87000 0x1000>; - interrupts = <135 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - }; - - radio: radio@8a000 { - compatible = "nordic,nrf-radio"; - reg = <0x8a000 0x1000>; - interrupts = <138 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - dfe-supported; - ieee802154-supported; - ble-2mbps-supported; - ble-coded-phy-supported; - cs-supported; - - ieee802154: ieee802154 { - compatible = "nordic,nrf-ieee802154"; - status = "disabled"; - }; - - bt_hci_sdc: bt_hci_sdc { - compatible = "nordic,bt-hci-sdc"; - status = "disabled"; - }; - - bt_hci_controller: bt_hci_controller { - compatible = "zephyr,bt-hci-ll-sw-split"; - status = "disabled"; - }; - }; - - dppic20: dppic@c2000 { - compatible = "nordic,nrf-dppic"; - reg = <0xc2000 0x808>; - status = "disabled"; - }; - - ppib20: ppib@c3000 { - compatible = "nordic,nrf-ppib"; - reg = <0xc3000 0x1000>; - status = "disabled"; - }; - - ppib21: ppib@c4000 { - compatible = "nordic,nrf-ppib"; - reg = <0xc4000 0x1000>; - status = "disabled"; - }; - - ppib22: ppib@c5000 { - compatible = "nordic,nrf-ppib"; - reg = <0xc5000 0x1000>; - status = "disabled"; - }; - - i2c20: i2c@c6000 { - compatible = "nordic,nrf-twim"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0xc6000 0x1000>; - interrupts = <198 NRF_DEFAULT_IRQ_PRIORITY>; - easydma-maxcnt-bits = <16>; - status = "disabled"; - zephyr,pm-device-runtime-auto; - }; - - spi20: spi@c6000 { - /* - * This spi node can be either SPIM or SPIS, - * for the user to pick: - * compatible = "nordic,nrf-spim" or - * "nordic,nrf-spis". - */ - compatible = "nordic,nrf-spim"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0xc6000 0x1000>; - interrupts = <198 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - easydma-maxcnt-bits = <16>; - rx-delay-supported; - rx-delay = <1>; - status = "disabled"; - }; - - uart20: uart@c6000 { - compatible = "nordic,nrf-uarte"; - reg = <0xc6000 0x1000>; - interrupts = <198 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - endtx-stoptx-supported; - frame-timeout-supported; - }; - - i2c21: i2c@c7000 { - compatible = "nordic,nrf-twim"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0xc7000 0x1000>; - interrupts = <199 NRF_DEFAULT_IRQ_PRIORITY>; - easydma-maxcnt-bits = <16>; - status = "disabled"; - zephyr,pm-device-runtime-auto; - }; - - spi21: spi@c7000 { - /* - * This spi node can be either SPIM or SPIS, - * for the user to pick: - * compatible = "nordic,nrf-spim" or - * "nordic,nrf-spis". - */ - compatible = "nordic,nrf-spim"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0xc7000 0x1000>; - interrupts = <199 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - easydma-maxcnt-bits = <16>; - rx-delay-supported; - rx-delay = <1>; - status = "disabled"; - }; - - uart21: uart@c7000 { - compatible = "nordic,nrf-uarte"; - reg = <0xc7000 0x1000>; - interrupts = <199 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - endtx-stoptx-supported; - frame-timeout-supported; - }; - - egu20: egu@c9000 { - compatible = "nordic,nrf-egu"; - reg = <0xc9000 0x1000>; - interrupts = <201 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - }; - - timer20: timer@ca000 { - compatible = "nordic,nrf-timer"; - status = "disabled"; - reg = <0xca000 0x1000>; - cc-num = <6>; - max-bit-width = <32>; - interrupts = <202 NRF_DEFAULT_IRQ_PRIORITY>; - prescaler = <0>; - }; - - timer21: timer@cb000 { - compatible = "nordic,nrf-timer"; - status = "disabled"; - reg = <0xcb000 0x1000>; - cc-num = <6>; - max-bit-width = <32>; - interrupts = <203 NRF_DEFAULT_IRQ_PRIORITY>; - prescaler = <0>; - }; - - timer22: timer@cc000 { - compatible = "nordic,nrf-timer"; - status = "disabled"; - reg = <0xcc000 0x1000>; - cc-num = <6>; - max-bit-width = <32>; - interrupts = <204 NRF_DEFAULT_IRQ_PRIORITY>; - prescaler = <0>; - }; - - timer23: timer@cd000 { - compatible = "nordic,nrf-timer"; - status = "disabled"; - reg = <0xcd000 0x1000>; - cc-num = <6>; - max-bit-width = <32>; - interrupts = <205 NRF_DEFAULT_IRQ_PRIORITY>; - prescaler = <0>; - }; - - timer24: timer@ce000 { - compatible = "nordic,nrf-timer"; - status = "disabled"; - reg = <0xce000 0x1000>; - cc-num = <6>; - max-bit-width = <32>; - interrupts = <206 NRF_DEFAULT_IRQ_PRIORITY>; - prescaler = <0>; - }; - - adc: adc@d5000 { - compatible = "nordic,nrf-saadc"; - reg = <0xd5000 0x1000>; - interrupts = <213 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - #io-channel-cells = <1>; - zephyr,pm-device-runtime-auto; - }; - - temp: temp@d7000 { - compatible = "nordic,nrf-temp"; - reg = <0xd7000 0x1000>; - interrupts = <215 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - }; - - gpio1: gpio@d8200 { - compatible = "nordic,nrf-gpio"; - gpio-controller; - reg = <0xd8200 0x300>; - #gpio-cells = <2>; - ngpios = <16>; - status = "disabled"; - port = <1>; - gpiote-instance = <&gpiote20>; - }; - - gpiote20: gpiote@da000 { - compatible = "nordic,nrf-gpiote"; - reg = <0xda000 0x1000>; - status = "disabled"; - instance = <20>; - }; - - grtc: grtc@e2000 { - compatible = "nordic,nrf-grtc"; - reg = <0xe2000 0x1000>; - cc-num = <12>; - clocks = <&lfxo>, <&pclk>; - clock-names = "lfclock", "hfclock"; - status = "disabled"; - }; - - dppic30: dppic@102000 { - compatible = "nordic,nrf-dppic"; - reg = <0x102000 0x808>; - status = "disabled"; - }; - - ppib30: ppib@103000 { - compatible = "nordic,nrf-ppib"; - reg = <0x103000 0x1000>; - status = "disabled"; - }; - - i2c30: i2c@104000 { - compatible = "nordic,nrf-twim"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0x104000 0x1000>; - interrupts = <260 NRF_DEFAULT_IRQ_PRIORITY>; - easydma-maxcnt-bits = <16>; - status = "disabled"; - zephyr,pm-device-runtime-auto; - }; - - spi30: spi@104000 { - /* - * This spi node can be either SPIM or SPIS, - * for the user to pick: - * compatible = "nordic,nrf-spim" or - * "nordic,nrf-spis". - */ - compatible = "nordic,nrf-spim"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0x104000 0x1000>; - interrupts = <260 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - easydma-maxcnt-bits = <16>; - rx-delay-supported; - rx-delay = <1>; - status = "disabled"; - }; - - uart30: uart@104000 { - compatible = "nordic,nrf-uarte"; - reg = <0x104000 0x1000>; - interrupts = <260 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - endtx-stoptx-supported; - frame-timeout-supported; - }; - - clock: clock@10e000 { - compatible = "nordic,nrf-clock"; - reg = <0x10e000 0x1000>; - interrupts = <270 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - }; - - power: power@10e000 { - compatible = "nordic,nrf-power"; - reg = <0x10e000 0x1000>; - ranges = <0x0 0x10e000 0x1000>; - interrupts = <270 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - #address-cells = <1>; - #size-cells = <1>; - - gpregret1: gpregret1@51c { - #address-cells = <1>; - #size-cells = <1>; - compatible = "nordic,nrf-gpregret"; - reg = <0x51c 0x1>; - status = "disabled"; - }; - - gpregret2: gpregret2@520 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "nordic,nrf-gpregret"; - reg = <0x520 0x1>; - status = "disabled"; - }; - }; - - comp: comparator@106000 { - /* - * Use compatible "nordic,nrf-comp" to configure as COMP - * Use compatible "nordic,nrf-lpcomp" to configure as LPCOMP - */ - compatible = "nordic,nrf-comp"; - reg = <0x106000 0x1000>; - status = "disabled"; - interrupts = <262 NRF_DEFAULT_IRQ_PRIORITY>; - }; - - #ifdef USE_NON_SECURE_ADDRESS_MAP - /* intentionally empty because WDT30 is hardware fixed to Secure */ - #else - wdt30: watchdog@108000 { - compatible = "nordic,nrf-wdt"; - reg = <0x108000 0x620>; - interrupts = <264 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - }; - #endif - - wdt31: watchdog@109000 { - compatible = "nordic,nrf-wdt"; - reg = <0x109000 0x620>; - interrupts = <265 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - }; - - gpio0: gpio@10a000 { - compatible = "nordic,nrf-gpio"; - gpio-controller; - reg = <0x10a000 0x300>; - #gpio-cells = <2>; - ngpios = <5>; - status = "disabled"; - port = <0>; - gpiote-instance = <&gpiote30>; - }; - - gpiote30: gpiote@10c000 { - compatible = "nordic,nrf-gpiote"; - reg = <0x10c000 0x1000>; - status = "disabled"; - instance = <30>; - }; - - regulators: regulator@120000 { - compatible = "nordic,nrf54l-regulators"; - reg = <0x120000 0x1000>; - status = "disabled"; - #address-cells = <1>; - #size-cells = <1>; - - vregmain: regulator@120600 { - compatible = "nordic,nrf5x-regulator"; - reg = <0x120600 0x1>; - status = "disabled"; - regulator-name = "VREGMAIN"; - regulator-initial-mode = ; - }; - }; - }; - - rram_controller: rram-controller@5004e000 { - compatible = "nordic,rram-controller"; - reg = <0x5004e000 0x1000>; - #address-cells = <1>; - #size-cells = <1>; - interrupts = <75 NRF_DEFAULT_IRQ_PRIORITY>; - - /* 952 + 60 = 1012KB */ - cpuapp_rram: rram@0 { - compatible = "soc-nv-flash"; - erase-block-size = <4096>; - write-block-size = <16>; - reg = <0x0 DT_SIZE_K(952)>; - }; - - cpuflpr_rram: rram@ee000 { - compatible = "soc-nv-flash"; - reg = <0xee000 DT_SIZE_K(60)>; - erase-block-size = <4096>; - write-block-size = <16>; - }; - }; - - cpuapp_ppb: cpuapp-ppb-bus { - #address-cells = <1>; - #size-cells = <1>; - - cpuapp_nvic: interrupt-controller@e000e100 { - #address-cells = <1>; - compatible = "arm,v8m-nvic"; - reg = <0xe000e100 0xc00>; - arm,num-irq-priority-bits = <3>; - interrupt-controller; - #interrupt-cells = <2>; - }; - - cpuapp_systick: timer@e000e010 { - compatible = "arm,armv8m-systick"; - reg = <0xe000e010 0x10>; - status = "disabled"; - }; - }; - }; -}; From 7f5c4351520b4153a33e1dcb1bc45ff15d7d67f2 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Thu, 23 Oct 2025 11:48:38 +0200 Subject: [PATCH 1906/2141] Revert "[nrf noup] boards: nordic: Remove nrf54l20pdk" This reverts commit a2b688488679d6962d34024a9eccdebfe60a70f2. Signed-off-by: Bjarki Arge Andreasen --- .../nrf54l20pdk/nrf54l20_cpuapp_common.dtsi | 131 ++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100644 boards/nordic/nrf54l20pdk/nrf54l20_cpuapp_common.dtsi diff --git a/boards/nordic/nrf54l20pdk/nrf54l20_cpuapp_common.dtsi b/boards/nordic/nrf54l20pdk/nrf54l20_cpuapp_common.dtsi new file mode 100644 index 000000000000..f719b2d93920 --- /dev/null +++ b/boards/nordic/nrf54l20pdk/nrf54l20_cpuapp_common.dtsi @@ -0,0 +1,131 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* This file is common to the secure and non-secure domain */ + +#include +#include "nrf54l20pdk_nrf54l20-common.dtsi" + +/ { + chosen { + zephyr,console = &uart20; + zephyr,shell-uart = &uart20; + zephyr,uart-mcumgr = &uart20; + zephyr,bt-mon-uart = &uart20; + zephyr,bt-c2h-uart = &uart20; + zephyr,flash-controller = &rram_controller; + zephyr,flash = &cpuapp_rram; + zephyr,bt-hci = &bt_hci_sdc; + zephyr,ieee802154 = &ieee802154; + }; +}; + +&cpuapp_sram { + status = "okay"; +}; + +&lfxo { + load-capacitors = "internal"; + load-capacitance-femtofarad = <15500>; +}; + +&hfxo { + load-capacitors = "internal"; + load-capacitance-femtofarad = <15000>; +}; + +&grtc { + owned-channels = <0 1 2 3 4 5 6 7 8 9 10 11>; + /* Channels 7-11 reserved for Zero Latency IRQs, 3-4 for FLPR */ + child-owned-channels = <3 4 7 8 9 10 11>; + status = "okay"; +}; + +&cpuapp_rram { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x0 DT_SIZE_K(64)>; + }; + + slot0_partition: partition@10000 { + label = "image-0"; + reg = <0x10000 DT_SIZE_K(449)>; + }; + + slot0_ns_partition: partition@80400 { + label = "image-0-nonsecure"; + reg = <0x80400 DT_SIZE_K(449)>; + }; + + slot1_partition: partition@f0800 { + label = "image-1"; + reg = <0xf0800 DT_SIZE_K(449)>; + }; + + slot1_ns_partition: partition@160c00 { + label = "image-1-nonsecure"; + reg = <0x160c00 DT_SIZE_K(449)>; + }; + + storage_partition: partition@1d1000 { + label = "storage"; + reg = <0x1d1000 DT_SIZE_K(36)>; + }; + }; +}; + +&uart20 { + status = "okay"; +}; + +&nfct { + status = "okay"; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + +&gpio2 { + status = "okay"; +}; + +&gpiote20 { + status = "okay"; +}; + +&gpiote30 { + status = "okay"; +}; + +&radio { + status = "okay"; +}; + +&temp { + status = "okay"; +}; + +&clock { + status = "okay"; +}; + +&bt_hci_sdc { + status = "okay"; +}; + +&ieee802154 { + status = "okay"; +}; From 70daf200c5a1e6266c18a63e2b49c3f1c8cc35c2 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Thu, 23 Oct 2025 11:48:47 +0200 Subject: [PATCH 1907/2141] Revert "[nrf noup] dts: Select SoftDevice Controller DTS binding as default" This reverts commit e9c0ac14274c524b125a8251b1e319408e256516. Signed-off-by: Bjarki Arge Andreasen --- .../nrf54l20pdk/nrf54l20_cpuapp_common.dtsi | 131 --- dts/arm/nordic/nrf52805.dtsi | 11 +- dts/arm/nordic/nrf52810.dtsi | 11 +- dts/arm/nordic/nrf52811.dtsi | 11 +- dts/arm/nordic/nrf52820.dtsi | 11 +- dts/arm/nordic/nrf52832.dtsi | 11 +- dts/arm/nordic/nrf52833.dtsi | 11 +- dts/arm/nordic/nrf52840.dtsi | 11 +- dts/arm/nordic/nrf5340_cpunet.dtsi | 11 +- dts/arm/nordic/nrf54h20_cpurad.dtsi | 4 +- dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi | 4 +- dts/vendor/nordic/nrf54h20.dtsi | 7 +- dts/vendor/nordic/nrf54l20.dtsi | 852 ------------------ dts/vendor/nordic/nrf54l_05_10_15.dtsi | 8 +- .../bluetooth/bap_broadcast_sink/sample.yaml | 4 +- .../bap_broadcast_sink/sysbuild.cmake | 4 - .../bap_broadcast_source/sample.yaml | 4 +- .../bap_broadcast_source/sysbuild.cmake | 4 - .../bluetooth/bap_unicast_client/sample.yaml | 4 +- .../bap_unicast_client/sysbuild.cmake | 4 - .../bluetooth/bap_unicast_server/sample.yaml | 4 +- .../bap_unicast_server/sysbuild.cmake | 4 - samples/bluetooth/beacon/sample.yaml | 4 +- samples/bluetooth/cap_acceptor/sample.yaml | 4 +- samples/bluetooth/cap_acceptor/sysbuild.cmake | 4 - samples/bluetooth/cap_initiator/sample.yaml | 4 +- .../bluetooth/cap_initiator/sysbuild.cmake | 4 - .../direction_finding_central/sample.yaml | 15 +- .../sample.yaml | 14 +- .../sample.yaml | 14 +- .../direction_finding_peripheral/sample.yaml | 15 +- samples/bluetooth/hci_ipc/sample.yaml | 34 +- samples/bluetooth/hci_uart/sample.yaml | 18 +- samples/bluetooth/hci_vs_scan_req/sample.yaml | 2 - samples/bluetooth/iso_central/sample.yaml | 6 +- .../pbp_public_broadcast_sink/sample.yaml | 4 +- .../pbp_public_broadcast_sink/sysbuild.cmake | 4 - .../pbp_public_broadcast_source/sample.yaml | 4 +- .../sysbuild.cmake | 4 - .../bt-ll-sw-split/bt-ll-sw-split.overlay | 4 - .../controller/ll_sw/nordic/lll/lll.c | 2 +- .../controller/ctrl_api/testcase.yaml | 2 - .../controller/ctrl_chmu/testcase.yaml | 2 - .../controller/ctrl_cis_create/testcase.yaml | 2 - .../ctrl_cis_terminate/testcase.yaml | 2 - .../controller/ctrl_collision/testcase.yaml | 2 - .../controller/ctrl_conn_update/testcase.yaml | 11 +- .../controller/ctrl_cte_req/testcase.yaml | 2 - .../ctrl_data_length_update/testcase.yaml | 10 +- .../controller/ctrl_encrypt/testcase.yaml | 2 - .../ctrl_feature_exchange/testcase.yaml | 2 - .../controller/ctrl_hci/testcase.yaml | 2 - .../controller/ctrl_invalid/testcase.yaml | 2 - .../controller/ctrl_le_ping/testcase.yaml | 2 - .../ctrl_min_used_chans/testcase.yaml | 2 - .../controller/ctrl_phy_update/testcase.yaml | 6 +- .../controller/ctrl_sca_update/testcase.yaml | 2 - .../controller/ctrl_sw_privacy/testcase.yaml | 2 - .../controller/ctrl_terminate/testcase.yaml | 2 - .../ctrl_tx_buffer_alloc/testcase.yaml | 22 +- .../controller/ctrl_tx_queue/testcase.yaml | 2 - .../controller/ctrl_unsupported/testcase.yaml | 6 +- .../controller/ctrl_user_ext/testcase.yaml | 2 - .../controller/ctrl_version/testcase.yaml | 2 - .../df/connection_cte_req/testcase.yaml | 2 - .../df/connection_cte_tx_params/testcase.yaml | 2 - .../connectionless_cte_chains/testcase.yaml | 2 - .../df/connectionless_cte_rx/testcase.yaml | 2 - .../df/connectionless_cte_tx/testcase.yaml | 2 - tests/bluetooth/init/testcase.yaml | 101 +-- 70 files changed, 122 insertions(+), 1366 deletions(-) delete mode 100644 boards/nordic/nrf54l20pdk/nrf54l20_cpuapp_common.dtsi delete mode 100644 dts/vendor/nordic/nrf54l20.dtsi diff --git a/boards/nordic/nrf54l20pdk/nrf54l20_cpuapp_common.dtsi b/boards/nordic/nrf54l20pdk/nrf54l20_cpuapp_common.dtsi deleted file mode 100644 index f719b2d93920..000000000000 --- a/boards/nordic/nrf54l20pdk/nrf54l20_cpuapp_common.dtsi +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/* This file is common to the secure and non-secure domain */ - -#include -#include "nrf54l20pdk_nrf54l20-common.dtsi" - -/ { - chosen { - zephyr,console = &uart20; - zephyr,shell-uart = &uart20; - zephyr,uart-mcumgr = &uart20; - zephyr,bt-mon-uart = &uart20; - zephyr,bt-c2h-uart = &uart20; - zephyr,flash-controller = &rram_controller; - zephyr,flash = &cpuapp_rram; - zephyr,bt-hci = &bt_hci_sdc; - zephyr,ieee802154 = &ieee802154; - }; -}; - -&cpuapp_sram { - status = "okay"; -}; - -&lfxo { - load-capacitors = "internal"; - load-capacitance-femtofarad = <15500>; -}; - -&hfxo { - load-capacitors = "internal"; - load-capacitance-femtofarad = <15000>; -}; - -&grtc { - owned-channels = <0 1 2 3 4 5 6 7 8 9 10 11>; - /* Channels 7-11 reserved for Zero Latency IRQs, 3-4 for FLPR */ - child-owned-channels = <3 4 7 8 9 10 11>; - status = "okay"; -}; - -&cpuapp_rram { - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - boot_partition: partition@0 { - label = "mcuboot"; - reg = <0x0 DT_SIZE_K(64)>; - }; - - slot0_partition: partition@10000 { - label = "image-0"; - reg = <0x10000 DT_SIZE_K(449)>; - }; - - slot0_ns_partition: partition@80400 { - label = "image-0-nonsecure"; - reg = <0x80400 DT_SIZE_K(449)>; - }; - - slot1_partition: partition@f0800 { - label = "image-1"; - reg = <0xf0800 DT_SIZE_K(449)>; - }; - - slot1_ns_partition: partition@160c00 { - label = "image-1-nonsecure"; - reg = <0x160c00 DT_SIZE_K(449)>; - }; - - storage_partition: partition@1d1000 { - label = "storage"; - reg = <0x1d1000 DT_SIZE_K(36)>; - }; - }; -}; - -&uart20 { - status = "okay"; -}; - -&nfct { - status = "okay"; -}; - -&gpio0 { - status = "okay"; -}; - -&gpio1 { - status = "okay"; -}; - -&gpio2 { - status = "okay"; -}; - -&gpiote20 { - status = "okay"; -}; - -&gpiote30 { - status = "okay"; -}; - -&radio { - status = "okay"; -}; - -&temp { - status = "okay"; -}; - -&clock { - status = "okay"; -}; - -&bt_hci_sdc { - status = "okay"; -}; - -&ieee802154 { - status = "okay"; -}; diff --git a/dts/arm/nordic/nrf52805.dtsi b/dts/arm/nordic/nrf52805.dtsi index 2134605c9f86..45a54f97b061 100644 --- a/dts/arm/nordic/nrf52805.dtsi +++ b/dts/arm/nordic/nrf52805.dtsi @@ -11,7 +11,7 @@ / { chosen { - zephyr,bt-hci = &bt_hci_sdc; + zephyr,bt-hci = &bt_hci_controller; zephyr,entropy = &rng; zephyr,flash-controller = &flash_controller; }; @@ -106,13 +106,12 @@ status = "okay"; ble-2mbps-supported; - bt_hci_sdc: bt_hci_sdc { - compatible = "nordic,bt-hci-sdc"; - status = "okay"; - }; + /* Note: In the nRF Connect SDK the SoftDevice Controller + * is added and set as the default Bluetooth Controller. + */ bt_hci_controller: bt_hci_controller { compatible = "zephyr,bt-hci-ll-sw-split"; - status = "disabled"; + status = "okay"; }; }; diff --git a/dts/arm/nordic/nrf52810.dtsi b/dts/arm/nordic/nrf52810.dtsi index 6e09220e78bb..217758dd1614 100644 --- a/dts/arm/nordic/nrf52810.dtsi +++ b/dts/arm/nordic/nrf52810.dtsi @@ -7,7 +7,7 @@ / { chosen { - zephyr,bt-hci = &bt_hci_sdc; + zephyr,bt-hci = &bt_hci_controller; zephyr,entropy = &rng; zephyr,flash-controller = &flash_controller; }; @@ -110,13 +110,12 @@ status = "okay"; ble-2mbps-supported; - bt_hci_sdc: bt_hci_sdc { - compatible = "nordic,bt-hci-sdc"; - status = "okay"; - }; + /* Note: In the nRF Connect SDK the SoftDevice Controller + * is added and set as the default Bluetooth Controller. + */ bt_hci_controller: bt_hci_controller { compatible = "zephyr,bt-hci-ll-sw-split"; - status = "disabled"; + status = "okay"; }; }; diff --git a/dts/arm/nordic/nrf52811.dtsi b/dts/arm/nordic/nrf52811.dtsi index 12d0a0ea4d6f..670f569c0ace 100644 --- a/dts/arm/nordic/nrf52811.dtsi +++ b/dts/arm/nordic/nrf52811.dtsi @@ -11,7 +11,7 @@ / { chosen { - zephyr,bt-hci = &bt_hci_sdc; + zephyr,bt-hci = &bt_hci_controller; zephyr,entropy = &rng; zephyr,flash-controller = &flash_controller; }; @@ -122,13 +122,12 @@ status = "disabled"; }; - bt_hci_sdc: bt_hci_sdc { - compatible = "nordic,bt-hci-sdc"; - status = "okay"; - }; + /* Note: In the nRF Connect SDK the SoftDevice Controller + * is added and set as the default Bluetooth Controller. + */ bt_hci_controller: bt_hci_controller { compatible = "zephyr,bt-hci-ll-sw-split"; - status = "disabled"; + status = "okay"; }; }; diff --git a/dts/arm/nordic/nrf52820.dtsi b/dts/arm/nordic/nrf52820.dtsi index d15fbb2ae4e3..50c8d2ba07f0 100644 --- a/dts/arm/nordic/nrf52820.dtsi +++ b/dts/arm/nordic/nrf52820.dtsi @@ -11,7 +11,7 @@ / { chosen { - zephyr,bt-hci = &bt_hci_sdc; + zephyr,bt-hci = &bt_hci_controller; zephyr,entropy = &rng; zephyr,flash-controller = &flash_controller; }; @@ -124,13 +124,12 @@ status = "disabled"; }; - bt_hci_sdc: bt_hci_sdc { - compatible = "nordic,bt-hci-sdc"; - status = "okay"; - }; + /* Note: In the nRF Connect SDK another Bluetooth controller + * is added and set as the default. + */ bt_hci_controller: bt_hci_controller { compatible = "zephyr,bt-hci-ll-sw-split"; - status = "disabled"; + status = "okay"; }; }; diff --git a/dts/arm/nordic/nrf52832.dtsi b/dts/arm/nordic/nrf52832.dtsi index eef2297c43b1..7bd62c707545 100644 --- a/dts/arm/nordic/nrf52832.dtsi +++ b/dts/arm/nordic/nrf52832.dtsi @@ -7,7 +7,7 @@ / { chosen { - zephyr,bt-hci = &bt_hci_sdc; + zephyr,bt-hci = &bt_hci_controller; zephyr,entropy = &rng; zephyr,flash-controller = &flash_controller; }; @@ -110,13 +110,12 @@ status = "okay"; ble-2mbps-supported; - bt_hci_sdc: bt_hci_sdc { - compatible = "nordic,bt-hci-sdc"; - status = "okay"; - }; + /* Note: In the nRF Connect SDK the SoftDevice Controller + * is added and set as the default Bluetooth Controller. + */ bt_hci_controller: bt_hci_controller { compatible = "zephyr,bt-hci-ll-sw-split"; - status = "disabled"; + status = "okay"; }; }; diff --git a/dts/arm/nordic/nrf52833.dtsi b/dts/arm/nordic/nrf52833.dtsi index 1b3620aa01cb..8202ddc45431 100644 --- a/dts/arm/nordic/nrf52833.dtsi +++ b/dts/arm/nordic/nrf52833.dtsi @@ -11,7 +11,7 @@ / { chosen { - zephyr,bt-hci = &bt_hci_sdc; + zephyr,bt-hci = &bt_hci_controller; zephyr,entropy = &rng; zephyr,flash-controller = &flash_controller; }; @@ -124,13 +124,12 @@ status = "disabled"; }; - bt_hci_sdc: bt_hci_sdc { - compatible = "nordic,bt-hci-sdc"; - status = "okay"; - }; + /* Note: In the nRF Connect SDK the SoftDevice Controller + * is added and set as the default Bluetooth Controller. + */ bt_hci_controller: bt_hci_controller { compatible = "zephyr,bt-hci-ll-sw-split"; - status = "disabled"; + status = "okay"; }; }; diff --git a/dts/arm/nordic/nrf52840.dtsi b/dts/arm/nordic/nrf52840.dtsi index f19383ba7e75..bcbfd926c9bb 100644 --- a/dts/arm/nordic/nrf52840.dtsi +++ b/dts/arm/nordic/nrf52840.dtsi @@ -7,7 +7,7 @@ / { chosen { - zephyr,bt-hci = &bt_hci_sdc; + zephyr,bt-hci = &bt_hci_controller; zephyr,entropy = &cryptocell; zephyr,flash-controller = &flash_controller; }; @@ -112,13 +112,12 @@ status = "disabled"; }; - bt_hci_sdc: bt_hci_sdc { - compatible = "nordic,bt-hci-sdc"; - status = "okay"; - }; + /* Note: In the nRF Connect SDK the SoftDevice Controller + * is added and set as the default Bluetooth Controller. + */ bt_hci_controller: bt_hci_controller { compatible = "zephyr,bt-hci-ll-sw-split"; - status = "disabled"; + status = "okay"; }; }; diff --git a/dts/arm/nordic/nrf5340_cpunet.dtsi b/dts/arm/nordic/nrf5340_cpunet.dtsi index be0fad16d66b..4f9164767f1a 100644 --- a/dts/arm/nordic/nrf5340_cpunet.dtsi +++ b/dts/arm/nordic/nrf5340_cpunet.dtsi @@ -9,7 +9,7 @@ / { chosen { - zephyr,bt-hci = &bt_hci_sdc; + zephyr,bt-hci = &bt_hci_controller; zephyr,entropy = &rng; zephyr,flash-controller = &flash_controller; }; @@ -102,13 +102,12 @@ status = "disabled"; }; - bt_hci_sdc: bt_hci_sdc { - compatible = "nordic,bt-hci-sdc"; - status = "okay"; - }; + /* Note: In the nRF Connect SDK the SoftDevice Controller + * is added and set as the default Bluetooth Controller. + */ bt_hci_controller: bt_hci_controller { compatible = "zephyr,bt-hci-ll-sw-split"; - status = "disabled"; + status = "okay"; }; }; diff --git a/dts/arm/nordic/nrf54h20_cpurad.dtsi b/dts/arm/nordic/nrf54h20_cpurad.dtsi index cdb13f0d8586..08cdb5c92c85 100644 --- a/dts/arm/nordic/nrf54h20_cpurad.dtsi +++ b/dts/arm/nordic/nrf54h20_cpurad.dtsi @@ -25,7 +25,7 @@ wdt011: &cpurad_wdt011 {}; / { chosen { - zephyr,bt-hci = &bt_hci_sdc; + zephyr,bt-hci = &bt_hci_controller; }; soc { @@ -165,6 +165,6 @@ wdt011: &cpurad_wdt011 {}; status = "okay"; }; -&bt_hci_sdc { +&bt_hci_controller { status = "okay"; }; diff --git a/dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi b/dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi index 88c1f43a9b8b..1eb43bdc81d7 100644 --- a/dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi +++ b/dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi @@ -15,7 +15,7 @@ nvic: &cpuapp_nvic {}; / { chosen { - zephyr,bt-hci = &bt_hci_sdc; + zephyr,bt-hci = &bt_hci_controller; zephyr,entropy = &psa_rng; }; @@ -36,7 +36,7 @@ nvic: &cpuapp_nvic {}; }; }; -&bt_hci_sdc { +&bt_hci_controller { status = "okay"; }; diff --git a/dts/vendor/nordic/nrf54h20.dtsi b/dts/vendor/nordic/nrf54h20.dtsi index ed18d023e356..3420b0a3e22d 100644 --- a/dts/vendor/nordic/nrf54h20.dtsi +++ b/dts/vendor/nordic/nrf54h20.dtsi @@ -487,10 +487,9 @@ status = "disabled"; }; - bt_hci_sdc: bt_hci_sdc { - compatible = "nordic,bt-hci-sdc"; - status = "disabled"; - }; + /* Note: In the nRF Connect SDK the SoftDevice Controller + * is added and set as the default Bluetooth Controller. + */ bt_hci_controller: bt_hci_controller { compatible = "zephyr,bt-hci-ll-sw-split"; status = "disabled"; diff --git a/dts/vendor/nordic/nrf54l20.dtsi b/dts/vendor/nordic/nrf54l20.dtsi deleted file mode 100644 index bee70effa0e8..000000000000 --- a/dts/vendor/nordic/nrf54l20.dtsi +++ /dev/null @@ -1,852 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include -#include - -/delete-node/ &sw_pwm; - -/* Domain IDs. Can be used to specify channel links in IPCT nodes. */ -#define NRF_DOMAIN_ID_APPLICATION 0 -#define NRF_DOMAIN_ID_FLPR 1 - -/ { - #address-cells = <1>; - #size-cells = <1>; - - cpus { - #address-cells = <1>; - #size-cells = <0>; - - cpuapp: cpu@0 { - compatible = "arm,cortex-m33f"; - reg = <0>; - device_type = "cpu"; - clocks = <&hfpll>; - #address-cells = <1>; - #size-cells = <1>; - - itm: itm@e0000000 { - compatible = "arm,armv8m-itm"; - reg = <0xe0000000 0x1000>; - swo-ref-frequency = ; - }; - }; - - cpuflpr: cpu@1 { - compatible = "nordic,vpr"; - reg = <1>; - device_type = "cpu"; - riscv,isa = "rv32emc"; - nordic,bus-width = <64>; - }; - }; - - clocks { - pclk: pclk { - compatible = "fixed-clock"; - #clock-cells = <0>; - clock-frequency = ; - }; - - pclk32m: pclk32m { - compatible = "fixed-clock"; - #clock-cells = <0>; - clock-frequency = ; - }; - - lfxo: lfxo { - compatible = "nordic,nrf54l-lfxo"; - #clock-cells = <0>; - clock-frequency = <32768>; - }; - - hfxo: hfxo { - compatible = "nordic,nrf54l-hfxo"; - #clock-cells = <0>; - clock-frequency = ; - startup-time-us = <1650>; - }; - - hfpll: hfpll { - compatible = "fixed-clock"; - #clock-cells = <0>; - clock-frequency = ; - }; - - aclk: aclk { - compatible = "fixed-clock"; - #clock-cells = <0>; - clock-frequency = ; - }; - }; - - soc { - #address-cells = <1>; - #size-cells = <1>; - - ficr: ficr@ffc000 { - compatible = "nordic,nrf-ficr"; - reg = <0xffc000 0x1000>; - #nordic,ficr-cells = <1>; - }; - - uicr: uicr@ffd000 { - compatible = "nordic,nrf-uicr"; - reg = <0xffd000 0x1000>; - }; - - cpuapp_sram: memory@20000000 { - compatible = "mmio-sram"; - reg = <0x20000000 DT_SIZE_K(447)>; - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x20000000 0x6fc00>; - }; - - cpuflpr_sram: memory@2006fc00 { - compatible = "mmio-sram"; - reg = <0x2006fc00 DT_SIZE_K(64)>; - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x2006fc00 0x10000>; - }; - - global_peripherals: peripheral@50000000 { - ranges = <0x0 0x50000000 0x10000000>; - #address-cells = <1>; - #size-cells = <1>; - - dppic00: dppic@42000 { - compatible = "nordic,nrf-dppic"; - reg = <0x42000 0x808>; - status = "disabled"; - }; - - ppib00: ppib@44000 { - compatible = "nordic,nrf-ppib"; - reg = <0x44000 0x1000>; - status = "disabled"; - }; - - ppib01: ppib@45000 { - compatible = "nordic,nrf-ppib"; - reg = <0x45000 0x1000>; - status = "disabled"; - }; - - cpuflpr_vpr: vpr@4c000 { - compatible = "nordic,nrf-vpr-coprocessor"; - reg = <0x4c000 0x1000>; - ranges = <0x0 0x4c000 0x1000>; - #address-cells = <1>; - #size-cells = <1>; - status = "disabled"; - enable-secure; - - cpuflpr_clic: interrupt-controller@f0000000 { - compatible = "nordic,nrf-clic"; - reg = <0xf0000000 0x143c>; - interrupt-controller; - #interrupt-cells = <2>; - #address-cells = <1>; - status = "disabled"; - }; - }; - - spi00: spi@4d000 { - /* - * This spi node can be either SPIM or SPIS, - * for the user to pick: - * compatible = "nordic,nrf-spim" or - * "nordic,nrf-spis". - */ - compatible = "nordic,nrf-spim"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0x4d000 0x1000>; - interrupts = <77 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - easydma-maxcnt-bits = <16>; - rx-delay-supported; - rx-delay = <1>; - status = "disabled"; - }; - - uart00: uart@4d000 { - compatible = "nordic,nrf-uarte"; - reg = <0x4d000 0x1000>; - interrupts = <77 NRF_DEFAULT_IRQ_PRIORITY>; - clocks = <&hfpll>; - status = "disabled"; - endtx-stoptx-supported; - frame-timeout-supported; - }; - - gpio2: gpio@50400 { - compatible = "nordic,nrf-gpio"; - gpio-controller; - reg = <0x50400 0x300>; - #gpio-cells = <2>; - ngpios = <11>; - status = "disabled"; - port = <2>; - }; - - timer00: timer@55000 { - compatible = "nordic,nrf-timer"; - status = "disabled"; - reg = <0x55000 0x1000>; - cc-num = <6>; - max-bit-width = <32>; - interrupts = <85 NRF_DEFAULT_IRQ_PRIORITY>; - clocks = <&hfpll>; - prescaler = <0>; - }; - - dppic10: dppic@82000 { - compatible = "nordic,nrf-dppic"; - reg = <0x82000 0x808>; - status = "disabled"; - }; - - ppib10: ppib@83000 { - compatible = "nordic,nrf-ppib"; - reg = <0x83000 0x1000>; - status = "disabled"; - }; - - ppib11: ppib@84000 { - compatible = "nordic,nrf-ppib"; - reg = <0x84000 0x1000>; - status = "disabled"; - }; - - timer10: timer@85000 { - compatible = "nordic,nrf-timer"; - status = "disabled"; - reg = <0x85000 0x1000>; - cc-num = <8>; - max-bit-width = <32>; - interrupts = <133 NRF_DEFAULT_IRQ_PRIORITY>; - clocks = <&hfxo>; - prescaler = <0>; - }; - - egu10: egu@87000 { - compatible = "nordic,nrf-egu"; - reg = <0x87000 0x1000>; - interrupts = <135 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - }; - - radio: radio@8a000 { - compatible = "nordic,nrf-radio"; - reg = <0x8a000 0x1000>; - interrupts = <138 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - dfe-supported; - ieee802154-supported; - ble-2mbps-supported; - ble-coded-phy-supported; - cs-supported; - - ieee802154: ieee802154 { - compatible = "nordic,nrf-ieee802154"; - status = "disabled"; - }; - - bt_hci_sdc: bt_hci_sdc { - compatible = "nordic,bt-hci-sdc"; - status = "disabled"; - }; - bt_hci_controller: bt_hci_controller { - compatible = "zephyr,bt-hci-ll-sw-split"; - status = "disabled"; - }; - }; - - dppic20: dppic@c2000 { - compatible = "nordic,nrf-dppic"; - reg = <0xc2000 0x808>; - status = "disabled"; - }; - - ppib20: ppib@c3000 { - compatible = "nordic,nrf-ppib"; - reg = <0xc3000 0x1000>; - status = "disabled"; - }; - - ppib21: ppib@c4000 { - compatible = "nordic,nrf-ppib"; - reg = <0xc4000 0x1000>; - status = "disabled"; - }; - - ppib22: ppib@c5000 { - compatible = "nordic,nrf-ppib"; - reg = <0xc5000 0x1000>; - status = "disabled"; - }; - - i2c20: i2c@c6000 { - compatible = "nordic,nrf-twim"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0xc6000 0x1000>; - interrupts = <198 NRF_DEFAULT_IRQ_PRIORITY>; - easydma-maxcnt-bits = <16>; - status = "disabled"; - zephyr,pm-device-runtime-auto; - }; - - spi20: spi@c6000 { - /* - * This spi node can be either SPIM or SPIS, - * for the user to pick: - * compatible = "nordic,nrf-spim" or - * "nordic,nrf-spis". - */ - compatible = "nordic,nrf-spim"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0xc6000 0x1000>; - interrupts = <198 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - easydma-maxcnt-bits = <16>; - rx-delay-supported; - rx-delay = <1>; - status = "disabled"; - }; - - uart20: uart@c6000 { - compatible = "nordic,nrf-uarte"; - reg = <0xc6000 0x1000>; - interrupts = <198 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - endtx-stoptx-supported; - frame-timeout-supported; - }; - - i2c21: i2c@c7000 { - compatible = "nordic,nrf-twim"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0xc7000 0x1000>; - interrupts = <199 NRF_DEFAULT_IRQ_PRIORITY>; - easydma-maxcnt-bits = <16>; - status = "disabled"; - zephyr,pm-device-runtime-auto; - }; - - spi21: spi@c7000 { - /* - * This spi node can be either SPIM or SPIS, - * for the user to pick: - * compatible = "nordic,nrf-spim" or - * "nordic,nrf-spis". - */ - compatible = "nordic,nrf-spim"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0xc7000 0x1000>; - interrupts = <199 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - easydma-maxcnt-bits = <16>; - rx-delay-supported; - rx-delay = <1>; - status = "disabled"; - }; - - uart21: uart@c7000 { - compatible = "nordic,nrf-uarte"; - reg = <0xc7000 0x1000>; - interrupts = <199 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - endtx-stoptx-supported; - frame-timeout-supported; - }; - - i2c22: i2c@c8000 { - compatible = "nordic,nrf-twim"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0xc8000 0x1000>; - interrupts = <200 NRF_DEFAULT_IRQ_PRIORITY>; - easydma-maxcnt-bits = <16>; - status = "disabled"; - zephyr,pm-device-runtime-auto; - }; - - spi22: spi@c8000 { - /* - * This spi node can be either SPIM or SPIS, - * for the user to pick: - * compatible = "nordic,nrf-spim" or - * "nordic,nrf-spis". - */ - compatible = "nordic,nrf-spim"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0xc8000 0x1000>; - interrupts = <200 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - easydma-maxcnt-bits = <16>; - rx-delay-supported; - rx-delay = <1>; - status = "disabled"; - }; - - uart22: uart@c8000 { - compatible = "nordic,nrf-uarte"; - reg = <0xc8000 0x1000>; - interrupts = <200 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - endtx-stoptx-supported; - frame-timeout-supported; - }; - - egu20: egu@c9000 { - compatible = "nordic,nrf-egu"; - reg = <0xc9000 0x1000>; - interrupts = <201 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - }; - - timer20: timer@ca000 { - compatible = "nordic,nrf-timer"; - status = "disabled"; - reg = <0xca000 0x1000>; - cc-num = <6>; - max-bit-width = <32>; - interrupts = <202 NRF_DEFAULT_IRQ_PRIORITY>; - prescaler = <0>; - }; - - timer21: timer@cb000 { - compatible = "nordic,nrf-timer"; - status = "disabled"; - reg = <0xcb000 0x1000>; - cc-num = <6>; - max-bit-width = <32>; - interrupts = <203 NRF_DEFAULT_IRQ_PRIORITY>; - prescaler = <0>; - }; - - timer22: timer@cc000 { - compatible = "nordic,nrf-timer"; - status = "disabled"; - reg = <0xcc000 0x1000>; - cc-num = <6>; - max-bit-width = <32>; - interrupts = <204 NRF_DEFAULT_IRQ_PRIORITY>; - prescaler = <0>; - }; - - timer23: timer@cd000 { - compatible = "nordic,nrf-timer"; - status = "disabled"; - reg = <0xcd000 0x1000>; - cc-num = <6>; - max-bit-width = <32>; - interrupts = <205 NRF_DEFAULT_IRQ_PRIORITY>; - prescaler = <0>; - }; - - timer24: timer@ce000 { - compatible = "nordic,nrf-timer"; - status = "disabled"; - reg = <0xce000 0x1000>; - cc-num = <6>; - max-bit-width = <32>; - interrupts = <206 NRF_DEFAULT_IRQ_PRIORITY>; - prescaler = <0>; - }; - - pdm20: pdm@d0000 { - compatible = "nordic,nrf-pdm"; - status = "disabled"; - reg = <0xd0000 0x1000>; - interrupts = <208 NRF_DEFAULT_IRQ_PRIORITY>; - }; - - pdm21: pdm@d1000 { - compatible = "nordic,nrf-pdm"; - status = "disabled"; - reg = <0xd1000 0x1000>; - interrupts = <209 NRF_DEFAULT_IRQ_PRIORITY>; - }; - - pwm20: pwm@d2000 { - compatible = "nordic,nrf-pwm"; - status = "disabled"; - reg = <0xd2000 0x1000>; - interrupts = <210 NRF_DEFAULT_IRQ_PRIORITY>; - #pwm-cells = <3>; - idleout-supported; - }; - - pwm21: pwm@d3000 { - compatible = "nordic,nrf-pwm"; - status = "disabled"; - reg = <0xd3000 0x1000>; - interrupts = <211 NRF_DEFAULT_IRQ_PRIORITY>; - #pwm-cells = <3>; - idleout-supported; - }; - - pwm22: pwm@d4000 { - compatible = "nordic,nrf-pwm"; - status = "disabled"; - reg = <0xd4000 0x1000>; - interrupts = <212 NRF_DEFAULT_IRQ_PRIORITY>; - #pwm-cells = <3>; - idleout-supported; - }; - - adc: adc@d5000 { - compatible = "nordic,nrf-saadc"; - reg = <0xd5000 0x1000>; - interrupts = <213 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - #io-channel-cells = <1>; - zephyr,pm-device-runtime-auto; - }; - - nfct: nfct@d6000 { - compatible = "nordic,nrf-nfct"; - reg = <0xd6000 0x1000>; - interrupts = <214 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - }; - - temp: temp@d7000 { - compatible = "nordic,nrf-temp"; - reg = <0xd7000 0x1000>; - interrupts = <215 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - }; - - gpio1: gpio@d8200 { - compatible = "nordic,nrf-gpio"; - gpio-controller; - reg = <0xd8200 0x300>; - #gpio-cells = <2>; - ngpios = <16>; - status = "disabled"; - port = <1>; - gpiote-instance = <&gpiote20>; - }; - - gpiote20: gpiote@da000 { - compatible = "nordic,nrf-gpiote"; - reg = <0xda000 0x1000>; - status = "disabled"; - instance = <20>; - }; - - qdec20: qdec@e0000 { - compatible = "nordic,nrf-qdec"; - reg = <0xe0000 0x1000>; - interrupts = <224 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - }; - - qdec21: qdec@e1000 { - compatible = "nordic,nrf-qdec"; - reg = <0xe1000 0x1000>; - interrupts = <225 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - }; - - grtc: grtc@e2000 { - compatible = "nordic,nrf-grtc"; - reg = <0xe2000 0x1000>; - cc-num = <12>; - clocks = <&lfxo>, <&pclk>; - clock-names = "lfclock", "hfclock"; - status = "disabled"; - }; - - tdm: tdm@e8000 { - compatible = "nordic,nrf-tdm"; - easydma-maxcnt-bits = <15>; - #address-cells = <1>; - #size-cells = <0>; - reg = <0xe8000 0x1000>; - interrupts = <232 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - clocks = <&pclk32m>; - }; - - i2c23: i2c@ed000 { - compatible = "nordic,nrf-twim"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0xed000 0x1000>; - interrupts = <237 NRF_DEFAULT_IRQ_PRIORITY>; - easydma-maxcnt-bits = <16>; - status = "disabled"; - zephyr,pm-device-runtime-auto; - }; - - spi23: spi@ed000 { - /* - * This spi node can be either SPIM or SPIS, - * for the user to pick: - * compatible = "nordic,nrf-spim" or - * "nordic,nrf-spis". - */ - compatible = "nordic,nrf-spim"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0xed000 0x1000>; - interrupts = <237 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - easydma-maxcnt-bits = <16>; - rx-delay-supported; - rx-delay = <1>; - status = "disabled"; - }; - - uart23: uart@ed000 { - compatible = "nordic,nrf-uarte"; - reg = <0xed000 0x1000>; - interrupts = <237 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - endtx-stoptx-supported; - frame-timeout-supported; - }; - - i2c24: i2c@ee000 { - compatible = "nordic,nrf-twim"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0xee000 0x1000>; - interrupts = <238 NRF_DEFAULT_IRQ_PRIORITY>; - easydma-maxcnt-bits = <16>; - status = "disabled"; - zephyr,pm-device-runtime-auto; - }; - - spi24: spi@ee000 { - /* - * This spi node can be either SPIM or SPIS, - * for the user to pick: - * compatible = "nordic,nrf-spim" or - * "nordic,nrf-spis". - */ - compatible = "nordic,nrf-spim"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0xee000 0x1000>; - interrupts = <238 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - easydma-maxcnt-bits = <16>; - rx-delay-supported; - rx-delay = <1>; - status = "disabled"; - }; - - uart24: uart@ee000 { - compatible = "nordic,nrf-uarte"; - reg = <0xee000 0x1000>; - interrupts = <238 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - endtx-stoptx-supported; - frame-timeout-supported; - }; - - dppic30: dppic@102000 { - compatible = "nordic,nrf-dppic"; - reg = <0x102000 0x808>; - status = "disabled"; - }; - - ppib30: ppib@103000 { - compatible = "nordic,nrf-ppib"; - reg = <0x103000 0x1000>; - status = "disabled"; - }; - - i2c30: i2c@104000 { - compatible = "nordic,nrf-twim"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0x104000 0x1000>; - interrupts = <260 NRF_DEFAULT_IRQ_PRIORITY>; - easydma-maxcnt-bits = <16>; - status = "disabled"; - zephyr,pm-device-runtime-auto; - }; - - spi30: spi@104000 { - /* - * This spi node can be either SPIM or SPIS, - * for the user to pick: - * compatible = "nordic,nrf-spim" or - * "nordic,nrf-spis". - */ - compatible = "nordic,nrf-spim"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0x104000 0x1000>; - interrupts = <260 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - easydma-maxcnt-bits = <16>; - rx-delay-supported; - rx-delay = <1>; - status = "disabled"; - }; - - uart30: uart@104000 { - compatible = "nordic,nrf-uarte"; - reg = <0x104000 0x1000>; - interrupts = <260 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - endtx-stoptx-supported; - frame-timeout-supported; - }; - - comp: comparator@106000 { - /* - * Use compatible "nordic,nrf-comp" to configure as COMP - * Use compatible "nordic,nrf-lpcomp" to configure as LPCOMP - */ - compatible = "nordic,nrf-comp"; - reg = <0x106000 0x1000>; - status = "disabled"; - interrupts = <262 NRF_DEFAULT_IRQ_PRIORITY>; - }; - - wdt30: watchdog@108000 { - compatible = "nordic,nrf-wdt"; - reg = <0x108000 0x620>; - interrupts = <264 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - }; - - wdt31: watchdog@109000 { - compatible = "nordic,nrf-wdt"; - reg = <0x109000 0x620>; - interrupts = <265 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - }; - - gpio0: gpio@10a000 { - compatible = "nordic,nrf-gpio"; - gpio-controller; - reg = <0x10a000 0x300>; - #gpio-cells = <2>; - ngpios = <5>; - status = "disabled"; - port = <0>; - gpiote-instance = <&gpiote30>; - }; - - gpiote30: gpiote@10c000 { - compatible = "nordic,nrf-gpiote"; - reg = <0x10c000 0x1000>; - status = "disabled"; - instance = <30>; - }; - - clock: clock@10e000 { - compatible = "nordic,nrf-clock"; - reg = <0x10e000 0x1000>; - interrupts = <270 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - }; - - power: power@10e000 { - compatible = "nordic,nrf-power"; - reg = <0x10e000 0x1000>; - ranges = <0x0 0x10e000 0x1000>; - interrupts = <270 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - #address-cells = <1>; - #size-cells = <1>; - - gpregret1: gpregret1@51c { - #address-cells = <1>; - #size-cells = <1>; - compatible = "nordic,nrf-gpregret"; - reg = <0x51c 0x1>; - status = "disabled"; - }; - - gpregret2: gpregret2@520 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "nordic,nrf-gpregret"; - reg = <0x520 0x1>; - status = "disabled"; - }; - }; - - regulators: regulator@120000 { - compatible = "nordic,nrf54l-regulators"; - reg = <0x120000 0x1000>; - status = "disabled"; - #address-cells = <1>; - #size-cells = <1>; - - vregmain: regulator@120600 { - compatible = "nordic,nrf5x-regulator"; - reg = <0x120600 0x1>; - status = "disabled"; - regulator-name = "VREGMAIN"; - regulator-initial-mode = ; - }; - }; - }; - - rram_controller: rram-controller@5004e000 { - compatible = "nordic,rram-controller"; - reg = <0x5004e000 0x1000>; - interrupts = <78 NRF_DEFAULT_IRQ_PRIORITY>; - #address-cells = <1>; - #size-cells = <1>; - - cpuapp_rram: rram@0 { - compatible = "soc-nv-flash"; - reg = <0x0 DT_SIZE_K(1972)>; - erase-block-size = <4096>; - write-block-size = <16>; - }; - - cpuflpr_rram: rram@1ed000 { - compatible = "soc-nv-flash"; - reg = <0x1ed000 DT_SIZE_K(64)>; - erase-block-size = <4096>; - write-block-size = <16>; - }; - }; - - cpuapp_ppb: cpuapp-ppb-bus { - #address-cells = <1>; - #size-cells = <1>; - - cpuapp_nvic: interrupt-controller@e000e100 { - #address-cells = <1>; - compatible = "arm,v8m-nvic"; - reg = <0xe000e100 0xc00>; - arm,num-irq-priority-bits = <3>; - interrupt-controller; - #interrupt-cells = <2>; - }; - - cpuapp_systick: timer@e000e010 { - compatible = "arm,armv8m-systick"; - reg = <0xe000e010 0x10>; - status = "disabled"; - }; - }; - }; -}; diff --git a/dts/vendor/nordic/nrf54l_05_10_15.dtsi b/dts/vendor/nordic/nrf54l_05_10_15.dtsi index 1cc8314aecca..4d15eebe8d02 100644 --- a/dts/vendor/nordic/nrf54l_05_10_15.dtsi +++ b/dts/vendor/nordic/nrf54l_05_10_15.dtsi @@ -252,11 +252,9 @@ status = "disabled"; }; - bt_hci_sdc: bt_hci_sdc { - compatible = "nordic,bt-hci-sdc"; - status = "disabled"; - }; - + /* Note: In the nRF Connect SDK the SoftDevice Controller + * is added and set as the default Bluetooth Controller. + */ bt_hci_controller: bt_hci_controller { compatible = "zephyr,bt-hci-ll-sw-split"; status = "disabled"; diff --git a/samples/bluetooth/bap_broadcast_sink/sample.yaml b/samples/bluetooth/bap_broadcast_sink/sample.yaml index 148b8b641697..5d06dee0bf89 100644 --- a/samples/bluetooth/bap_broadcast_sink/sample.yaml +++ b/samples/bluetooth/bap_broadcast_sink/sample.yaml @@ -24,7 +24,5 @@ tests: - nrf52_bsim - nrf52833dk/nrf52833 - nrf52840dongle/nrf52840 - extra_args: - - EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf - - SNIPPET="bt-ll-sw-split" + extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf tags: bluetooth diff --git a/samples/bluetooth/bap_broadcast_sink/sysbuild.cmake b/samples/bluetooth/bap_broadcast_sink/sysbuild.cmake index d5d260789ff7..2523aac8ea76 100644 --- a/samples/bluetooth/bap_broadcast_sink/sysbuild.cmake +++ b/samples/bluetooth/bap_broadcast_sink/sysbuild.cmake @@ -18,10 +18,6 @@ if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) CACHE INTERNAL "" ) - list(APPEND ${NET_APP}_SNIPPET ${SNIPPET}) - list(APPEND ${NET_APP}_SNIPPET bt-ll-sw-split) - set(${NET_APP}_SNIPPET ${${NET_APP}_SNIPPET} CACHE STRING "" FORCE) - native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) endif() diff --git a/samples/bluetooth/bap_broadcast_source/sample.yaml b/samples/bluetooth/bap_broadcast_source/sample.yaml index 5f745cd08950..5e5b01d942d0 100644 --- a/samples/bluetooth/bap_broadcast_source/sample.yaml +++ b/samples/bluetooth/bap_broadcast_source/sample.yaml @@ -36,7 +36,5 @@ tests: - nrf52_bsim - nrf52833dk/nrf52833 - nrf52840dongle/nrf52840 - extra_args: - - EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf - - SNIPPET="bt-ll-sw-split" + extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf tags: bluetooth diff --git a/samples/bluetooth/bap_broadcast_source/sysbuild.cmake b/samples/bluetooth/bap_broadcast_source/sysbuild.cmake index d5d260789ff7..2523aac8ea76 100644 --- a/samples/bluetooth/bap_broadcast_source/sysbuild.cmake +++ b/samples/bluetooth/bap_broadcast_source/sysbuild.cmake @@ -18,10 +18,6 @@ if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) CACHE INTERNAL "" ) - list(APPEND ${NET_APP}_SNIPPET ${SNIPPET}) - list(APPEND ${NET_APP}_SNIPPET bt-ll-sw-split) - set(${NET_APP}_SNIPPET ${${NET_APP}_SNIPPET} CACHE STRING "" FORCE) - native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) endif() diff --git a/samples/bluetooth/bap_unicast_client/sample.yaml b/samples/bluetooth/bap_unicast_client/sample.yaml index 44f32934ce99..7283090b8781 100644 --- a/samples/bluetooth/bap_unicast_client/sample.yaml +++ b/samples/bluetooth/bap_unicast_client/sample.yaml @@ -22,7 +22,5 @@ tests: - nrf52840dk/nrf52840 integration_platforms: - nrf52dk/nrf52832 - extra_args: - - EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf - - SNIPPET="bt-ll-sw-split" + extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf tags: bluetooth diff --git a/samples/bluetooth/bap_unicast_client/sysbuild.cmake b/samples/bluetooth/bap_unicast_client/sysbuild.cmake index d5d260789ff7..2523aac8ea76 100644 --- a/samples/bluetooth/bap_unicast_client/sysbuild.cmake +++ b/samples/bluetooth/bap_unicast_client/sysbuild.cmake @@ -18,10 +18,6 @@ if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) CACHE INTERNAL "" ) - list(APPEND ${NET_APP}_SNIPPET ${SNIPPET}) - list(APPEND ${NET_APP}_SNIPPET bt-ll-sw-split) - set(${NET_APP}_SNIPPET ${${NET_APP}_SNIPPET} CACHE STRING "" FORCE) - native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) endif() diff --git a/samples/bluetooth/bap_unicast_server/sample.yaml b/samples/bluetooth/bap_unicast_server/sample.yaml index 266ced73f66d..068f752b626b 100644 --- a/samples/bluetooth/bap_unicast_server/sample.yaml +++ b/samples/bluetooth/bap_unicast_server/sample.yaml @@ -22,7 +22,5 @@ tests: - nrf52840dk/nrf52840 integration_platforms: - nrf52dk/nrf52832 - extra_args: - - EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf - - SNIPPET="bt-ll-sw-split" + extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf tags: bluetooth diff --git a/samples/bluetooth/bap_unicast_server/sysbuild.cmake b/samples/bluetooth/bap_unicast_server/sysbuild.cmake index d5d260789ff7..2523aac8ea76 100644 --- a/samples/bluetooth/bap_unicast_server/sysbuild.cmake +++ b/samples/bluetooth/bap_unicast_server/sysbuild.cmake @@ -18,10 +18,6 @@ if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) CACHE INTERNAL "" ) - list(APPEND ${NET_APP}_SNIPPET ${SNIPPET}) - list(APPEND ${NET_APP}_SNIPPET bt-ll-sw-split) - set(${NET_APP}_SNIPPET ${${NET_APP}_SNIPPET} CACHE STRING "" FORCE) - native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) endif() diff --git a/samples/bluetooth/beacon/sample.yaml b/samples/bluetooth/beacon/sample.yaml index 00215341924f..23ffad73c796 100644 --- a/samples/bluetooth/beacon/sample.yaml +++ b/samples/bluetooth/beacon/sample.yaml @@ -20,9 +20,7 @@ tests: - ophelia4ev/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp sample.bluetooth.beacon-coex: - extra_args: - - CONF_FILE="prj-coex.conf" - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE="prj-coex.conf" harness: bluetooth platform_allow: - nrf52840dk/nrf52840 diff --git a/samples/bluetooth/cap_acceptor/sample.yaml b/samples/bluetooth/cap_acceptor/sample.yaml index 9061f44679fb..824e744eecaf 100644 --- a/samples/bluetooth/cap_acceptor/sample.yaml +++ b/samples/bluetooth/cap_acceptor/sample.yaml @@ -26,7 +26,5 @@ tests: - nrf52833dk/nrf52833 - nrf52840dk/nrf52840 - nrf52840dongle/nrf52840 - extra_args: - - EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf - - SNIPPET="bt-ll-sw-split" + extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf tags: bluetooth diff --git a/samples/bluetooth/cap_acceptor/sysbuild.cmake b/samples/bluetooth/cap_acceptor/sysbuild.cmake index d5d260789ff7..2523aac8ea76 100644 --- a/samples/bluetooth/cap_acceptor/sysbuild.cmake +++ b/samples/bluetooth/cap_acceptor/sysbuild.cmake @@ -18,10 +18,6 @@ if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) CACHE INTERNAL "" ) - list(APPEND ${NET_APP}_SNIPPET ${SNIPPET}) - list(APPEND ${NET_APP}_SNIPPET bt-ll-sw-split) - set(${NET_APP}_SNIPPET ${${NET_APP}_SNIPPET} CACHE STRING "" FORCE) - native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) endif() diff --git a/samples/bluetooth/cap_initiator/sample.yaml b/samples/bluetooth/cap_initiator/sample.yaml index e3e557f48301..b4f593c99129 100644 --- a/samples/bluetooth/cap_initiator/sample.yaml +++ b/samples/bluetooth/cap_initiator/sample.yaml @@ -26,7 +26,5 @@ tests: - nrf52833dk/nrf52833 - nrf52840dk/nrf52840 - nrf52840dongle/nrf52840 - extra_args: - - EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf - - SNIPPET="bt-ll-sw-split" + extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf tags: bluetooth diff --git a/samples/bluetooth/cap_initiator/sysbuild.cmake b/samples/bluetooth/cap_initiator/sysbuild.cmake index d5d260789ff7..2523aac8ea76 100644 --- a/samples/bluetooth/cap_initiator/sysbuild.cmake +++ b/samples/bluetooth/cap_initiator/sysbuild.cmake @@ -18,10 +18,6 @@ if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) CACHE INTERNAL "" ) - list(APPEND ${NET_APP}_SNIPPET ${SNIPPET}) - list(APPEND ${NET_APP}_SNIPPET bt-ll-sw-split) - set(${NET_APP}_SNIPPET ${${NET_APP}_SNIPPET} CACHE STRING "" FORCE) - native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) endif() diff --git a/samples/bluetooth/direction_finding_central/sample.yaml b/samples/bluetooth/direction_finding_central/sample.yaml index ffdf634c6e3e..b7a118e6cdc8 100644 --- a/samples/bluetooth/direction_finding_central/sample.yaml +++ b/samples/bluetooth/direction_finding_central/sample.yaml @@ -14,24 +14,15 @@ tests: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 - nrf5340dk/nrf5340/cpuapp - sample.bluetooth.direction_finding.central.aod_with_controller: + sample.bluetooth.direction_finding.central.aod: harness: bluetooth - extra_args: - - EXTRA_CONF_FILE="overlay-aod.conf" - - SNIPPET="bt-ll-sw-split" + extra_args: EXTRA_CONF_FILE="overlay-aod.conf" platform_allow: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 + - nrf5340dk/nrf5340/cpuapp tags: bluetooth integration_platforms: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 - sample.bluetooth.direction_finding.central.aod_host_only: - harness: bluetooth - extra_args: - - OVERLAY_CONFIG="overlay-aod.conf" - platform_allow: - - nrf5340dk/nrf5340/cpuapp - tags: bluetooth - integration_platforms: - nrf5340dk/nrf5340/cpuapp diff --git a/samples/bluetooth/direction_finding_connectionless_rx/sample.yaml b/samples/bluetooth/direction_finding_connectionless_rx/sample.yaml index c500cc80dcec..8e6097de58ae 100644 --- a/samples/bluetooth/direction_finding_connectionless_rx/sample.yaml +++ b/samples/bluetooth/direction_finding_connectionless_rx/sample.yaml @@ -12,22 +12,14 @@ tests: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 - nrf5340dk/nrf5340/cpuapp - sample.bluetooth.direction_finding_connectionless_rx.aod_with_controller: + sample.bluetooth.direction_finding_connectionless_rx.aod: harness: bluetooth - extra_args: - - EXTRA_CONF_FILE="overlay-aod.conf" - - SNIPPET="bt-ll-sw-split" + extra_args: EXTRA_CONF_FILE="overlay-aod.conf" platform_allow: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 + - nrf5340dk/nrf5340/cpuapp integration_platforms: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 - sample.bluetooth.direction_finding_connectionless_rx.aod_host_only: - harness: bluetooth - extra_args: - - OVERLAY_CONFIG="overlay-aod.conf" - platform_allow: - - nrf5340dk/nrf5340/cpuapp - integration_platforms: - nrf5340dk/nrf5340/cpuapp diff --git a/samples/bluetooth/direction_finding_connectionless_tx/sample.yaml b/samples/bluetooth/direction_finding_connectionless_tx/sample.yaml index 2a4fa93d19d5..78d21b2c95f5 100644 --- a/samples/bluetooth/direction_finding_connectionless_tx/sample.yaml +++ b/samples/bluetooth/direction_finding_connectionless_tx/sample.yaml @@ -12,22 +12,14 @@ tests: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 - nrf5340dk/nrf5340/cpuapp - sample.bluetooth.direction_finding_connectionless.aoa_with_controller: + sample.bluetooth.direction_finding_connectionless.aoa: harness: bluetooth - extra_args: - - EXTRA_CONF_FILE="overlay-aoa.conf" - - SNIPPET="bt-ll-sw-split" + extra_args: EXTRA_CONF_FILE="overlay-aoa.conf" platform_allow: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 + - nrf5340dk/nrf5340/cpuapp integration_platforms: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 - sample.bluetooth.direction_finding_connectionless.aoa_host_only: - harness: bluetooth - extra_args: - - OVERLAY_CONFIG="overlay-aoa.conf" - platform_allow: - - nrf5340dk/nrf5340/cpuapp - integration_platforms: - nrf5340dk/nrf5340/cpuapp diff --git a/samples/bluetooth/direction_finding_peripheral/sample.yaml b/samples/bluetooth/direction_finding_peripheral/sample.yaml index 01f612ad08a0..f300cb415cc5 100644 --- a/samples/bluetooth/direction_finding_peripheral/sample.yaml +++ b/samples/bluetooth/direction_finding_peripheral/sample.yaml @@ -14,24 +14,15 @@ tests: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 - nrf5340dk/nrf5340/cpuapp - sample.bluetooth.direction_finding.peripheral.aod_with_controller: + sample.bluetooth.direction_finding.peripheral.aod: harness: bluetooth - extra_args: - - EXTRA_CONF_FILE="overlay-aoa.conf" - - SNIPPET="bt-ll-sw-split" + extra_args: EXTRA_CONF_FILE="overlay-aoa.conf" platform_allow: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 + - nrf5340dk/nrf5340/cpuapp tags: bluetooth integration_platforms: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 - sample.bluetooth.direction_finding.peripheral.aod_host_only: - harness: bluetooth - extra_args: - - OVERLAY_CONFIG="overlay-aoa.conf" - platform_allow: - - nrf5340dk/nrf5340/cpuapp - tags: bluetooth - integration_platforms: - nrf5340dk/nrf5340/cpuapp diff --git a/samples/bluetooth/hci_ipc/sample.yaml b/samples/bluetooth/hci_ipc/sample.yaml index 3763478b6b33..b758b2547688 100644 --- a/samples/bluetooth/hci_ipc/sample.yaml +++ b/samples/bluetooth/hci_ipc/sample.yaml @@ -15,9 +15,7 @@ tests: sample.bluetooth.hci_ipc.iso_broadcast.bt_ll_sw_split: harness: bluetooth tags: bluetooth - extra_args: - - CONF_FILE="nrf5340_cpunet_iso_broadcast-bt_ll_sw_split.conf" - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE="nrf5340_cpunet_iso_broadcast-bt_ll_sw_split.conf" platform_allow: - nrf5340dk/nrf5340/cpunet - nrf5340_audio_dk/nrf5340/cpunet @@ -27,9 +25,7 @@ tests: sample.bluetooth.hci_ipc.iso_receive.bt_ll_sw_split: harness: bluetooth tags: bluetooth - extra_args: - - CONF_FILE="nrf5340_cpunet_iso_receive-bt_ll_sw_split.conf" - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE="nrf5340_cpunet_iso_receive-bt_ll_sw_split.conf" platform_allow: - nrf5340dk/nrf5340/cpunet - nrf5340_audio_dk/nrf5340/cpunet @@ -39,9 +35,7 @@ tests: sample.bluetooth.hci_ipc.bis.bt_ll_sw_split: harness: bluetooth tags: bluetooth - extra_args: - - CONF_FILE="nrf5340_cpunet_bis-bt_ll_sw_split.conf" - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE="nrf5340_cpunet_bis-bt_ll_sw_split.conf" platform_allow: - nrf5340dk/nrf5340/cpunet - nrf5340_audio_dk/nrf5340/cpunet @@ -51,9 +45,7 @@ tests: sample.bluetooth.hci_ipc.iso_central.bt_ll_sw_split: harness: bluetooth tags: bluetooth - extra_args: - - CONF_FILE="nrf5340_cpunet_iso_central-bt_ll_sw_split.conf" - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE="nrf5340_cpunet_iso_central-bt_ll_sw_split.conf" platform_allow: - nrf5340dk/nrf5340/cpunet - nrf5340_audio_dk/nrf5340/cpunet @@ -63,9 +55,7 @@ tests: sample.bluetooth.hci_ipc.iso_peripheral.bt_ll_sw_split: harness: bluetooth tags: bluetooth - extra_args: - - CONF_FILE="nrf5340_cpunet_iso_peripheral-bt_ll_sw_split.conf" - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE="nrf5340_cpunet_iso_peripheral-bt_ll_sw_split.conf" platform_allow: - nrf5340dk/nrf5340/cpunet - nrf5340_audio_dk/nrf5340/cpunet @@ -75,9 +65,7 @@ tests: sample.bluetooth.hci_ipc.cis.bt_ll_sw_split: harness: bluetooth tags: bluetooth - extra_args: - - CONF_FILE="nrf5340_cpunet_cis-bt_ll_sw_split.conf" - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE="nrf5340_cpunet_cis-bt_ll_sw_split.conf" platform_allow: - nrf5340dk/nrf5340/cpunet - nrf5340_audio_dk/nrf5340/cpunet @@ -87,9 +75,7 @@ tests: sample.bluetooth.hci_ipc.iso.bt_ll_sw_split: harness: bluetooth tags: bluetooth - extra_args: - - CONF_FILE="nrf5340_cpunet_iso-bt_ll_sw_split.conf" - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE="nrf5340_cpunet_iso-bt_ll_sw_split.conf" platform_allow: - nrf5340dk/nrf5340/cpunet - nrf5340_audio_dk/nrf5340/cpunet @@ -113,7 +99,6 @@ tests: extra_args: - CONF_FILE="nrf5340_cpunet_df-bt_ll_sw_split.conf" - DTC_OVERLAY_FILE="nrf5340_cpunet_df-bt_ll_sw_split.overlay" - - SNIPPET="bt-ll-sw-split" platform_allow: nrf5340dk/nrf5340/cpunet integration_platforms: - nrf5340dk/nrf5340/cpunet @@ -124,16 +109,13 @@ tests: - CONF_FILE="nrf5340_cpunet_df-bt_ll_sw_split.conf" - DTC_OVERLAY_FILE="nrf5340_cpunet_df-bt_ll_sw_split.overlay" - CONFIG_BT_CTLR_PHY_CODED=n - - SNIPPET="bt-ll-sw-split" platform_allow: nrf5340dk/nrf5340/cpunet integration_platforms: - nrf5340dk/nrf5340/cpunet sample.bluetooth.hci_ipc.mesh.bt_ll_sw_split: harness: bluetooth tags: bluetooth - extra_args: - - CONF_FILE="nrf5340_cpunet_bt_mesh-bt_ll_sw_split.conf" - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE="nrf5340_cpunet_bt_mesh-bt_ll_sw_split.conf" platform_allow: nrf5340dk/nrf5340/cpunet integration_platforms: - nrf5340dk/nrf5340/cpunet diff --git a/samples/bluetooth/hci_uart/sample.yaml b/samples/bluetooth/hci_uart/sample.yaml index 8555c65cf0df..df2b40135c67 100644 --- a/samples/bluetooth/hci_uart/sample.yaml +++ b/samples/bluetooth/hci_uart/sample.yaml @@ -24,9 +24,7 @@ tests: platform_allow: nrf52833dk/nrf52833 integration_platforms: - nrf52833dk/nrf52833 - extra_args: - - DTC_OVERLAY_FILE=./boards/nrf52833dk_nrf52833_df.overlay - - SNIPPET="bt-ll-sw-split" + extra_args: DTC_OVERLAY_FILE=./boards/nrf52833dk_nrf52833_df.overlay extra_configs: - CONFIG_BT_CTLR_DF=y tags: @@ -35,9 +33,7 @@ tests: sample.bluetooth.hci_uart.nrf5340_netcore.df: harness: bluetooth platform_allow: nrf5340dk/nrf5340/cpunet - extra_args: - - DTC_OVERLAY_FILE=./boards/nrf5340dk_nrf5340_cpunet_df.overlay - - SNIPPET="bt-ll-sw-split" + extra_args: DTC_OVERLAY_FILE=./boards/nrf5340dk_nrf5340_cpunet_df.overlay extra_configs: - CONFIG_BT_CTLR_DF=y tags: @@ -48,9 +44,7 @@ tests: platform_allow: nrf52833dk/nrf52833 integration_platforms: - nrf52833dk/nrf52833 - extra_args: - - DTC_OVERLAY_FILE=./boards/nrf52833dk_nrf52833_df.overlay - - SNIPPET="bt-ll-sw-split" + extra_args: DTC_OVERLAY_FILE=./boards/nrf52833dk_nrf52833_df.overlay extra_configs: - CONFIG_BT_CTLR_DF=y - CONFIG_BT_CTLR_DTM_HCI_DF_IQ_REPORT=y @@ -60,9 +54,7 @@ tests: sample.bluetooth.hci_uart.nrf5340_netcore.df.iq_report: harness: bluetooth platform_allow: nrf5340dk/nrf5340/cpunet - extra_args: - - DTC_OVERLAY_FILE=./boards/nrf5340dk_nrf5340_cpunet_df.overlay - - SNIPPET="bt-ll-sw-split" + extra_args: DTC_OVERLAY_FILE=./boards/nrf5340dk_nrf5340_cpunet_df.overlay extra_configs: - CONFIG_BT_CTLR_DF=y - CONFIG_BT_CTLR_DTM_HCI_DF_IQ_REPORT=y @@ -96,7 +88,6 @@ tests: extra_args: - EXTRA_CONF_FILE=overlay-all-bt_ll_sw_split.conf - DTC_OVERLAY_FILE=./boards/nrf52833dk_nrf52833_df.overlay - - SNIPPET="bt-ll-sw-split" tags: - uart - bluetooth @@ -108,7 +99,6 @@ tests: extra_args: - EXTRA_CONF_FILE=overlay-all-bt_ll_sw_split.conf - DTC_OVERLAY_FILE=./boards/nrf54l15dk_nrf54l15_cpuapp_df.overlay - - SNIPPET="bt-ll-sw-split" tags: - uart - bluetooth diff --git a/samples/bluetooth/hci_vs_scan_req/sample.yaml b/samples/bluetooth/hci_vs_scan_req/sample.yaml index 49526522d16e..245a83aa0d96 100644 --- a/samples/bluetooth/hci_vs_scan_req/sample.yaml +++ b/samples/bluetooth/hci_vs_scan_req/sample.yaml @@ -9,6 +9,4 @@ tests: - nrf52dk/nrf52832 extra_configs: - CONFIG_BT_LL_SW_SPLIT=y - extra_args: - - SNIPPET="bt-ll-sw-split" tags: bluetooth diff --git a/samples/bluetooth/iso_central/sample.yaml b/samples/bluetooth/iso_central/sample.yaml index 57254ee809ab..3a7dedd404ae 100644 --- a/samples/bluetooth/iso_central/sample.yaml +++ b/samples/bluetooth/iso_central/sample.yaml @@ -11,11 +11,11 @@ tests: sample.bluetooth.iso_central.bt_ll_sw_split: harness: bluetooth platform_allow: + - qemu_cortex_m3 + - qemu_x86 - nrf52_bsim - nrf52833dk/nrf52833 integration_platforms: - nrf52833dk/nrf52833 - extra_args: - - EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf - - SNIPPET="bt-ll-sw-split" + extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf tags: bluetooth diff --git a/samples/bluetooth/pbp_public_broadcast_sink/sample.yaml b/samples/bluetooth/pbp_public_broadcast_sink/sample.yaml index 901d40b00d4f..d7c816ee5b76 100644 --- a/samples/bluetooth/pbp_public_broadcast_sink/sample.yaml +++ b/samples/bluetooth/pbp_public_broadcast_sink/sample.yaml @@ -23,7 +23,5 @@ tests: integration_platforms: - nrf52_bsim - nrf52833dk/nrf52833 - extra_args: - - EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf - - SNIPPET="bt-ll-sw-split" + extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf tags: bluetooth diff --git a/samples/bluetooth/pbp_public_broadcast_sink/sysbuild.cmake b/samples/bluetooth/pbp_public_broadcast_sink/sysbuild.cmake index d5d260789ff7..2523aac8ea76 100644 --- a/samples/bluetooth/pbp_public_broadcast_sink/sysbuild.cmake +++ b/samples/bluetooth/pbp_public_broadcast_sink/sysbuild.cmake @@ -18,10 +18,6 @@ if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) CACHE INTERNAL "" ) - list(APPEND ${NET_APP}_SNIPPET ${SNIPPET}) - list(APPEND ${NET_APP}_SNIPPET bt-ll-sw-split) - set(${NET_APP}_SNIPPET ${${NET_APP}_SNIPPET} CACHE STRING "" FORCE) - native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) endif() diff --git a/samples/bluetooth/pbp_public_broadcast_source/sample.yaml b/samples/bluetooth/pbp_public_broadcast_source/sample.yaml index 1d2e31306e29..80c907042119 100644 --- a/samples/bluetooth/pbp_public_broadcast_source/sample.yaml +++ b/samples/bluetooth/pbp_public_broadcast_source/sample.yaml @@ -23,7 +23,5 @@ tests: integration_platforms: - nrf52_bsim - nrf52833dk/nrf52833 - extra_args: - - EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf - - SNIPPET="bt-ll-sw-split" + extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf tags: bluetooth diff --git a/samples/bluetooth/pbp_public_broadcast_source/sysbuild.cmake b/samples/bluetooth/pbp_public_broadcast_source/sysbuild.cmake index e0a7fd9d175d..d3bf7be5b6c3 100644 --- a/samples/bluetooth/pbp_public_broadcast_source/sysbuild.cmake +++ b/samples/bluetooth/pbp_public_broadcast_source/sysbuild.cmake @@ -18,10 +18,6 @@ if(NOT("${SB_CONFIG_NET_CORE_BOARD}" STREQUAL "")) CACHE INTERNAL "" ) - list(APPEND ${NET_APP}_SNIPPET ${SNIPPET}) - list(APPEND ${NET_APP}_SNIPPET bt-ll-sw-split) - set(${NET_APP}_SNIPPET ${${NET_APP}_SNIPPET} CACHE STRING "" FORCE) - native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) endif() diff --git a/snippets/bt-ll-sw-split/bt-ll-sw-split.overlay b/snippets/bt-ll-sw-split/bt-ll-sw-split.overlay index a57a0e82ba6e..04bf83ef44d4 100644 --- a/snippets/bt-ll-sw-split/bt-ll-sw-split.overlay +++ b/snippets/bt-ll-sw-split/bt-ll-sw-split.overlay @@ -2,10 +2,6 @@ status = "okay"; }; -&bt_hci_sdc { - status = "disabled"; -}; - / { chosen { zephyr,bt-hci = &bt_hci_controller; diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c index cada046f049b..b44847c05850 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c @@ -62,7 +62,7 @@ static struct { /* FIXME: This could probably use a chosen entropy device instead on relying on * the nodelabel being the same as for the old nrf rng. */ -static const struct device *const dev_entropy = DEVICE_DT_GET(DT_CHOSEN(zephyr_entropy)); +static const struct device *const dev_entropy = DEVICE_DT_GET(DT_NODELABEL(rng)); #endif /* CONFIG_ENTROPY_HAS_DRIVER */ static int init_reset(void); diff --git a/tests/bluetooth/controller/ctrl_api/testcase.yaml b/tests/bluetooth/controller/ctrl_api/testcase.yaml index 21f178bf9b2b..19bf6c9ab490 100644 --- a/tests/bluetooth/controller/ctrl_api/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_api/testcase.yaml @@ -6,5 +6,3 @@ common: tests: bluetooth.controller.ctrl_api.test: type: unit - extra_args: - - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_chmu/testcase.yaml b/tests/bluetooth/controller/ctrl_chmu/testcase.yaml index 9c3ee6264335..f7e8068d60ec 100644 --- a/tests/bluetooth/controller/ctrl_chmu/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_chmu/testcase.yaml @@ -6,5 +6,3 @@ common: tests: bluetooth.controller.ctrl_chmu.test: type: unit - extra_args: - - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_cis_create/testcase.yaml b/tests/bluetooth/controller/ctrl_cis_create/testcase.yaml index 2371d7063eb7..99612a89bc31 100644 --- a/tests/bluetooth/controller/ctrl_cis_create/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_cis_create/testcase.yaml @@ -6,5 +6,3 @@ common: tests: bluetooth.controller.ctrl_cis_create.test: type: unit - extra_args: - - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_cis_terminate/testcase.yaml b/tests/bluetooth/controller/ctrl_cis_terminate/testcase.yaml index a98229ba45f3..956172a89b20 100644 --- a/tests/bluetooth/controller/ctrl_cis_terminate/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_cis_terminate/testcase.yaml @@ -6,5 +6,3 @@ common: tests: bluetooth.controller.ctrl_cis_terminate.test: type: unit - extra_args: - - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_collision/testcase.yaml b/tests/bluetooth/controller/ctrl_collision/testcase.yaml index daa8f3bc6c3d..6086a9a4ebc8 100644 --- a/tests/bluetooth/controller/ctrl_collision/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_collision/testcase.yaml @@ -6,5 +6,3 @@ common: tests: bluetooth.controller.ctrl_collision.test: type: unit - extra_args: - - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_conn_update/testcase.yaml b/tests/bluetooth/controller/ctrl_conn_update/testcase.yaml index fc4ecb0b647d..5b0bda4b9088 100644 --- a/tests/bluetooth/controller/ctrl_conn_update/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_conn_update/testcase.yaml @@ -7,18 +7,11 @@ common: tests: bluetooth.controller.ctrl_conn_update.test: type: unit - extra_args: - - SNIPPET="bt-ll-sw-split" bluetooth.controller.ctrl_conn_update.apm_test: type: unit - extra_args: - - CONF_FILE=prj_apm.conf - - SNIPPET="bt-ll-sw-split" - + extra_args: CONF_FILE=prj_apm.conf bluetooth.controller.ctrl_conn_update.no_param_req_test: type: unit - extra_args: - - CONF_FILE=prj_no_param_req.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_no_param_req.conf diff --git a/tests/bluetooth/controller/ctrl_cte_req/testcase.yaml b/tests/bluetooth/controller/ctrl_cte_req/testcase.yaml index c6288aecc433..fd6ff51118d9 100644 --- a/tests/bluetooth/controller/ctrl_cte_req/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_cte_req/testcase.yaml @@ -6,5 +6,3 @@ common: tests: bluetooth.controller.ctrl_cte_req.test: type: unit - extra_args: - - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_data_length_update/testcase.yaml b/tests/bluetooth/controller/ctrl_data_length_update/testcase.yaml index c7d1174e12bf..9778af435b4a 100644 --- a/tests/bluetooth/controller/ctrl_data_length_update/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_data_length_update/testcase.yaml @@ -6,17 +6,11 @@ common: tests: bluetooth.controller.ctrl_data_length_update.test: type: unit - extra_args: - - SNIPPET="bt-ll-sw-split" bluetooth.controller.ctrl_data_length_update.test_nocodedphy: type: unit - extra_args: - - CONF_FILE=prj_nocoded.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_nocoded.conf bluetooth.controller.ctrl_data_length_update.test_nophy: type: unit - extra_args: - - CONF_FILE=prj_nophy.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_nophy.conf diff --git a/tests/bluetooth/controller/ctrl_encrypt/testcase.yaml b/tests/bluetooth/controller/ctrl_encrypt/testcase.yaml index 86dd5bfe4d30..d5bb2cb8b110 100644 --- a/tests/bluetooth/controller/ctrl_encrypt/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_encrypt/testcase.yaml @@ -6,5 +6,3 @@ common: tests: bluetooth.controller.ctrl_encrypt.test: type: unit - extra_args: - - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_feature_exchange/testcase.yaml b/tests/bluetooth/controller/ctrl_feature_exchange/testcase.yaml index 087e49575ff7..257542f36120 100644 --- a/tests/bluetooth/controller/ctrl_feature_exchange/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_feature_exchange/testcase.yaml @@ -6,5 +6,3 @@ common: tests: bluetooth.controller.ctrl_feature_exchange.test: type: unit - extra_args: - - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_hci/testcase.yaml b/tests/bluetooth/controller/ctrl_hci/testcase.yaml index e0735bae6962..d7f7ce7168d1 100644 --- a/tests/bluetooth/controller/ctrl_hci/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_hci/testcase.yaml @@ -6,5 +6,3 @@ common: tests: bluetooth.controller.ctrl_hci.test: type: unit - extra_args: - - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_invalid/testcase.yaml b/tests/bluetooth/controller/ctrl_invalid/testcase.yaml index cee54e6b09ed..2d1741931e37 100644 --- a/tests/bluetooth/controller/ctrl_invalid/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_invalid/testcase.yaml @@ -6,5 +6,3 @@ common: tests: bluetooth.controller.ctrl_invalid.test: type: unit - extra_args: - - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_le_ping/testcase.yaml b/tests/bluetooth/controller/ctrl_le_ping/testcase.yaml index 54178905da17..b6a77528f32d 100644 --- a/tests/bluetooth/controller/ctrl_le_ping/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_le_ping/testcase.yaml @@ -6,5 +6,3 @@ common: tests: bluetooth.controller.ctrl_le_ping.test: type: unit - extra_args: - - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_min_used_chans/testcase.yaml b/tests/bluetooth/controller/ctrl_min_used_chans/testcase.yaml index a9445cbf8c4d..0991b0cdd43c 100644 --- a/tests/bluetooth/controller/ctrl_min_used_chans/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_min_used_chans/testcase.yaml @@ -6,5 +6,3 @@ common: tests: bluetooth.controller.ctrl_min_used_chans.test: type: unit - extra_args: - - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_phy_update/testcase.yaml b/tests/bluetooth/controller/ctrl_phy_update/testcase.yaml index d5c49d587a8f..1d7da169f1d8 100644 --- a/tests/bluetooth/controller/ctrl_phy_update/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_phy_update/testcase.yaml @@ -6,10 +6,6 @@ common: tests: bluetooth.controller.ctrl_phy_update.test: type: unit - extra_args: - - SNIPPET="bt-ll-sw-split" bluetooth.controller.ctrl_phy_update.test_reduced_buf: type: unit - extra_args: - - CONF_FILE=prj_rx_cnt.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_rx_cnt.conf diff --git a/tests/bluetooth/controller/ctrl_sca_update/testcase.yaml b/tests/bluetooth/controller/ctrl_sca_update/testcase.yaml index cbc3c3faf720..cbf63aa1b575 100644 --- a/tests/bluetooth/controller/ctrl_sca_update/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_sca_update/testcase.yaml @@ -6,5 +6,3 @@ common: tests: bluetooth.controller.ctrl_sca_update.test: type: unit - extra_args: - - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_sw_privacy/testcase.yaml b/tests/bluetooth/controller/ctrl_sw_privacy/testcase.yaml index ac5dd6e957eb..778606d69549 100644 --- a/tests/bluetooth/controller/ctrl_sw_privacy/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_sw_privacy/testcase.yaml @@ -4,5 +4,3 @@ common: tests: bluetooth.ctrl_sw_privacy.test: platform_allow: nrf52_bsim - extra_args: - - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_terminate/testcase.yaml b/tests/bluetooth/controller/ctrl_terminate/testcase.yaml index 6b1409e9653e..cbe639401ea3 100644 --- a/tests/bluetooth/controller/ctrl_terminate/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_terminate/testcase.yaml @@ -6,5 +6,3 @@ common: tests: bluetooth.controller.ctrl_terminate.test: type: unit - extra_args: - - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_tx_buffer_alloc/testcase.yaml b/tests/bluetooth/controller/ctrl_tx_buffer_alloc/testcase.yaml index 363986bd3d35..614eb7fe94c0 100644 --- a/tests/bluetooth/controller/ctrl_tx_buffer_alloc/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_tx_buffer_alloc/testcase.yaml @@ -6,35 +6,23 @@ common: tests: bluetooth.controller.ctrl_tx_buffer_alloc.test_0_per_conn: type: unit - extra_args: - - SNIPPET="bt-ll-sw-split" bluetooth.controller.ctrl_tx_buffer_alloc.test_1_per_conn: type: unit - extra_args: - - CONF_FILE=prj_1.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_1.conf bluetooth.controller.ctrl_tx_buffer_alloc.test_2_per_conn: type: unit - extra_args: - - CONF_FILE=prj_2.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_2.conf bluetooth.controller.ctrl_tx_buffer_alloc.test_3_per_conn: type: unit - extra_args: - - CONF_FILE=prj_3.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_3.conf bluetooth.controller.ctrl_tx_buffer_alloc.test_max_per_conn_alloc: type: unit - extra_args: - - CONF_FILE=prj_max.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_max.conf bluetooth.controller.ctrl_tx_buffer_alloc.test_max_common_alloc: type: unit - extra_args: - - CONF_FILE=prj_max_common.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_max_common.conf diff --git a/tests/bluetooth/controller/ctrl_tx_queue/testcase.yaml b/tests/bluetooth/controller/ctrl_tx_queue/testcase.yaml index 282b620b317a..295ad891a630 100644 --- a/tests/bluetooth/controller/ctrl_tx_queue/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_tx_queue/testcase.yaml @@ -5,5 +5,3 @@ common: tests: bluetooth.ctrl_tx_queue.test: type: unit - extra_args: - - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_unsupported/testcase.yaml b/tests/bluetooth/controller/ctrl_unsupported/testcase.yaml index 48b18af93536..28aba1a752a8 100644 --- a/tests/bluetooth/controller/ctrl_unsupported/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_unsupported/testcase.yaml @@ -6,11 +6,7 @@ common: tests: bluetooth.controller.ctrl_unsupported.default.test: type: unit - extra_args: - - SNIPPET="bt-ll-sw-split" bluetooth.controller.ctrl_unsupported.test: type: unit - extra_args: - - CONF_FILE=prj_unsupported.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_unsupported.conf diff --git a/tests/bluetooth/controller/ctrl_user_ext/testcase.yaml b/tests/bluetooth/controller/ctrl_user_ext/testcase.yaml index be963df24a8a..af319a7a7191 100644 --- a/tests/bluetooth/controller/ctrl_user_ext/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_user_ext/testcase.yaml @@ -4,5 +4,3 @@ common: tests: bluetooth.ctrl_user_ext.test: platform_allow: nrf52_bsim - extra_args: - - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_version/testcase.yaml b/tests/bluetooth/controller/ctrl_version/testcase.yaml index 5df86b9bca9f..6badcbc72547 100644 --- a/tests/bluetooth/controller/ctrl_version/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_version/testcase.yaml @@ -6,5 +6,3 @@ common: tests: bluetooth.controller.ctrl_version.test: type: unit - extra_args: - - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/df/connection_cte_req/testcase.yaml b/tests/bluetooth/df/connection_cte_req/testcase.yaml index fbfe4b0d9a1a..768aba4a51f5 100644 --- a/tests/bluetooth/df/connection_cte_req/testcase.yaml +++ b/tests/bluetooth/df/connection_cte_req/testcase.yaml @@ -2,5 +2,3 @@ tests: bluetooth.df.conection_cte_req: platform_allow: nrf52_bsim tags: bluetooth - extra_args: - - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/df/connection_cte_tx_params/testcase.yaml b/tests/bluetooth/df/connection_cte_tx_params/testcase.yaml index a9986c5b0e53..38a23b0950e3 100644 --- a/tests/bluetooth/df/connection_cte_tx_params/testcase.yaml +++ b/tests/bluetooth/df/connection_cte_tx_params/testcase.yaml @@ -2,5 +2,3 @@ tests: bluetooth.df.conection_cte_tx_params: platform_allow: nrf52_bsim tags: bluetooth - extra_args: - - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/df/connectionless_cte_chains/testcase.yaml b/tests/bluetooth/df/connectionless_cte_chains/testcase.yaml index 844a7bbb524e..6aa5bb0f0c1c 100644 --- a/tests/bluetooth/df/connectionless_cte_chains/testcase.yaml +++ b/tests/bluetooth/df/connectionless_cte_chains/testcase.yaml @@ -2,5 +2,3 @@ tests: bluetooth.df.connectionless_cte_chains: platform_allow: nrf52_bsim tags: bluetooth - extra_args: - - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/df/connectionless_cte_rx/testcase.yaml b/tests/bluetooth/df/connectionless_cte_rx/testcase.yaml index c8f08a908436..f839b1910eb2 100644 --- a/tests/bluetooth/df/connectionless_cte_rx/testcase.yaml +++ b/tests/bluetooth/df/connectionless_cte_rx/testcase.yaml @@ -2,5 +2,3 @@ tests: bluetooth.df.connectionless_cte_rx: platform_allow: nrf52_bsim tags: bluetooth - extra_args: - - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/df/connectionless_cte_tx/testcase.yaml b/tests/bluetooth/df/connectionless_cte_tx/testcase.yaml index 491cc0e7e599..77d651d0cbc2 100644 --- a/tests/bluetooth/df/connectionless_cte_tx/testcase.yaml +++ b/tests/bluetooth/df/connectionless_cte_tx/testcase.yaml @@ -2,5 +2,3 @@ tests: bluetooth.df.connectionless_cte_tx: platform_allow: nrf52_bsim tags: bluetooth - extra_args: - - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/init/testcase.yaml b/tests/bluetooth/init/testcase.yaml index a5cc40cd39e7..dd44257e0128 100644 --- a/tests/bluetooth/init/testcase.yaml +++ b/tests/bluetooth/init/testcase.yaml @@ -74,9 +74,7 @@ tests: extra_args: CONF_FILE=prj_9.conf platform_allow: qemu_cortex_m3 bluetooth.init.test_ctlr: - extra_args: - - CONF_FILE=prj_ctlr.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_ctlr.conf platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -88,9 +86,7 @@ tests: - nrf51dk/nrf51822 - rv32m1_vega/openisa_rv32m1/ri5cy bluetooth.init.test_ctlr_4_0: - extra_args: - - CONF_FILE=prj_ctlr_4_0.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_ctlr_4_0.conf platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -99,9 +95,7 @@ tests: - nrf52dk/nrf52832 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_4_0_dbg: - extra_args: - - CONF_FILE=prj_ctlr_4_0_dbg.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_ctlr_4_0_dbg.conf platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -110,9 +104,7 @@ tests: - nrf52dk/nrf52832 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_tiny: - extra_args: - - CONF_FILE=prj_ctlr_tiny.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_ctlr_tiny.conf platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -124,7 +116,6 @@ tests: extra_args: - CONF_FILE=prj_ctlr_dbg.conf - DTC_OVERLAY_FILE=pa_lna.overlay - - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -135,7 +126,6 @@ tests: extra_args: - CONF_FILE=prj_ctlr_5_x_dbg.conf - DTC_OVERLAY_FILE=pa_lna.overlay - - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -147,7 +137,6 @@ tests: - CONF_FILE=prj_ctlr.conf - CONFIG_BT_CTLR_ADVANCED_FEATURES=y - CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER=y - - SNIPPET="bt-ll-sw-split" platform_allow: - nrf5340dk/nrf5340/cpunet - nrf52840dk/nrf52840 @@ -157,16 +146,13 @@ tests: bluetooth.init.test_ctlr_ticker: extra_args: - CONF_FILE=prj_ctlr_ticker.conf - - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 integration_platforms: - nrf52dk/nrf52832 bluetooth.init.test_ctlr_broadcaster: - extra_args: - - CONF_FILE=prj_ctlr_broadcaster.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_ctlr_broadcaster.conf platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -175,9 +161,7 @@ tests: integration_platforms: - nrf52dk/nrf52832 bluetooth.init.test_ctlr_peripheral: - extra_args: - - CONF_FILE=prj_ctlr_peripheral.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_ctlr_peripheral.conf platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -186,9 +170,7 @@ tests: integration_platforms: - nrf52dk/nrf52832 bluetooth.init.test_ctlr_peripheral_priv: - extra_args: - - CONF_FILE=prj_ctlr_peripheral_priv.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_ctlr_peripheral_priv.conf platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -197,9 +179,7 @@ tests: integration_platforms: - nrf52840dk/nrf52840 bluetooth.init.test_ctlr_observer: - extra_args: - - CONF_FILE=prj_ctlr_observer.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_ctlr_observer.conf platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -208,9 +188,7 @@ tests: integration_platforms: - nrf52dk/nrf52832 bluetooth.init.test_ctlr_central: - extra_args: - - CONF_FILE=prj_ctlr_central.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_ctlr_central.conf platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -220,9 +198,7 @@ tests: - nrf52dk/nrf52832 - rv32m1_vega/openisa_rv32m1/ri5cy bluetooth.init.test_ctlr_central_priv: - extra_args: - - CONF_FILE=prj_ctlr_central_priv.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_ctlr_central_priv.conf platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -232,9 +208,7 @@ tests: - nrf52dk/nrf52832 - rv32m1_vega/openisa_rv32m1/ri5cy bluetooth.init.test_ctlr_broadcaster_ext: - extra_args: - - CONF_FILE=prj_ctlr_broadcaster_ext.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_ctlr_broadcaster_ext.conf platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -243,9 +217,7 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_peripheral_ext: - extra_args: - - CONF_FILE=prj_ctlr_peripheral_ext.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_ctlr_peripheral_ext.conf platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -254,9 +226,7 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_peripheral_ext_priv: - extra_args: - - CONF_FILE=prj_ctlr_peripheral_ext_priv.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_ctlr_peripheral_ext_priv.conf platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -265,9 +235,7 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_oberver_ext: - extra_args: - - CONF_FILE=prj_ctlr_observer_ext.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_ctlr_observer_ext.conf platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -276,9 +244,7 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_central_ext: - extra_args: - - CONF_FILE=prj_ctlr_central_ext.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_ctlr_central_ext.conf platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -287,9 +253,7 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_central_ext_priv: - extra_args: - - CONF_FILE=prj_ctlr_central_ext_priv.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_ctlr_central_ext_priv.conf platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -298,9 +262,7 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_per_adv: - extra_args: - - CONF_FILE=prj_ctlr_per_adv.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_ctlr_per_adv.conf platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -309,9 +271,7 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_per_adv_no_adi: - extra_args: - - CONF_FILE=prj_ctlr_per_adv_no_adi.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_ctlr_per_adv_no_adi.conf platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -320,9 +280,7 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_per_sync: - extra_args: - - CONF_FILE=prj_ctlr_per_sync.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_ctlr_per_sync.conf platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -331,9 +289,7 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_per_sync_no_adi: - extra_args: - - CONF_FILE=prj_ctlr_per_sync_no_adi.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_ctlr_per_sync_no_adi.conf platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -342,9 +298,7 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_per_sync_no_filter: - extra_args: - - CONF_FILE=prj_ctlr_per_sync_no_filter.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_ctlr_per_sync_no_filter.conf platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -353,9 +307,7 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_peripheral_iso: - extra_args: - - CONF_FILE=prj_ctlr_peripheral_iso.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_ctlr_peripheral_iso.conf platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -364,9 +316,7 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_central_iso: - extra_args: - - CONF_FILE=prj_ctlr_central_iso.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_ctlr_central_iso.conf platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -385,9 +335,7 @@ tests: - DTC_OVERLAY_FILE=h5.overlay platform_allow: qemu_cortex_m3 bluetooth.init.test_llcp: - extra_args: - - CONF_FILE=prj_llcp.conf - - SNIPPET="bt-ll-sw-split" + extra_args: CONF_FILE=prj_llcp.conf platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -399,7 +347,6 @@ tests: extra_args: - CONF_FILE=prj_ctlr.conf - CONFIG_BT_RECV_WORKQ_BT=y - - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 bluetooth.init.test_host_6_x: From 84bd95bdea5baa9fd0ecd437cd646416750a0c1c Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Mon, 13 Oct 2025 13:14:55 +0200 Subject: [PATCH 1908/2141] Revert "[nrf noup] dts: Add Bluetooth Controller to nRF54H20" This reverts commit 275f20ec6e6d39c4b3e6411a6a5dffc5b084af04. Signed-off-by: Bjarki Arge Andreasen --- dts/arm/nordic/nrf54h20_cpurad.dtsi | 8 -------- dts/vendor/nordic/nrf54h20.dtsi | 8 -------- 2 files changed, 16 deletions(-) diff --git a/dts/arm/nordic/nrf54h20_cpurad.dtsi b/dts/arm/nordic/nrf54h20_cpurad.dtsi index 08cdb5c92c85..f7f7464f91c2 100644 --- a/dts/arm/nordic/nrf54h20_cpurad.dtsi +++ b/dts/arm/nordic/nrf54h20_cpurad.dtsi @@ -24,10 +24,6 @@ wdt011: &cpurad_wdt011 {}; /delete-node/ &s2ram; / { - chosen { - zephyr,bt-hci = &bt_hci_controller; - }; - soc { compatible = "simple-bus"; interrupt-parent = <&cpurad_nvic>; @@ -164,7 +160,3 @@ wdt011: &cpurad_wdt011 {}; &gpio_pad_group9 { status = "okay"; }; - -&bt_hci_controller { - status = "okay"; -}; diff --git a/dts/vendor/nordic/nrf54h20.dtsi b/dts/vendor/nordic/nrf54h20.dtsi index 3420b0a3e22d..e98693d1be97 100644 --- a/dts/vendor/nordic/nrf54h20.dtsi +++ b/dts/vendor/nordic/nrf54h20.dtsi @@ -486,14 +486,6 @@ compatible = "nordic,nrf-ieee802154"; status = "disabled"; }; - - /* Note: In the nRF Connect SDK the SoftDevice Controller - * is added and set as the default Bluetooth Controller. - */ - bt_hci_controller: bt_hci_controller { - compatible = "zephyr,bt-hci-ll-sw-split"; - status = "disabled"; - }; }; ccm030: ccm@3a000 { From 639a7127189751cec8761f4a122ed145da6a117c Mon Sep 17 00:00:00 2001 From: Kyle Micallef Bonnici Date: Sun, 7 Sep 2025 22:25:01 +0200 Subject: [PATCH 1909/2141] [nrf fromtree] devicetree: format files in dts/arm/nordic Applying dts-linter results for files in dts/arm/nordic Signed-off-by: Kyle Micallef Bonnici (cherry picked from commit 51d5135fd7875e3237966a08e54bffe5f6accd2a) --- dts/arm/nordic/nrf51822.dtsi | 1 - dts/arm/nordic/nrf52805.dtsi | 1 - dts/arm/nordic/nrf52810.dtsi | 2 +- dts/arm/nordic/nrf52811.dtsi | 3 +-- dts/arm/nordic/nrf52820.dtsi | 2 -- dts/arm/nordic/nrf52832.dtsi | 1 - dts/arm/nordic/nrf52833.dtsi | 1 - dts/arm/nordic/nrf52840.dtsi | 1 - dts/arm/nordic/nrf52840_qfaa.dtsi | 1 - dts/arm/nordic/nrf5340_cpuapp_peripherals.dtsi | 1 - dts/arm/nordic/nrf5340_cpunet.dtsi | 1 - dts/arm/nordic/nrf54h20_cpuapp.dtsi | 13 ++++++++++--- dts/arm/nordic/nrf54h20_cpurad.dtsi | 13 ++++++++++--- dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi | 4 +++- dts/arm/nordic/nrf54lm20a_enga_cpuapp.dtsi | 2 ++ dts/arm/nordic/nrf91.dtsi | 2 +- dts/arm/nordic/nrf91_peripherals.dtsi | 1 - dts/arm/nordic/nrf9280_cpuapp.dtsi | 6 ++++++ dts/arm/nordic/nrf9280_cpurad.dtsi | 6 ++++++ 19 files changed, 40 insertions(+), 22 deletions(-) diff --git a/dts/arm/nordic/nrf51822.dtsi b/dts/arm/nordic/nrf51822.dtsi index cbfef90faa5b..8f262909d61f 100644 --- a/dts/arm/nordic/nrf51822.dtsi +++ b/dts/arm/nordic/nrf51822.dtsi @@ -311,7 +311,6 @@ #address-cells = <1>; #size-cells = <1>; - flash0: flash@0 { compatible = "soc-nv-flash"; erase-block-size = <1024>; diff --git a/dts/arm/nordic/nrf52805.dtsi b/dts/arm/nordic/nrf52805.dtsi index 45a54f97b061..e940c7a2cdf2 100644 --- a/dts/arm/nordic/nrf52805.dtsi +++ b/dts/arm/nordic/nrf52805.dtsi @@ -320,7 +320,6 @@ #address-cells = <1>; #size-cells = <1>; - flash0: flash@0 { compatible = "soc-nv-flash"; erase-block-size = <4096>; diff --git a/dts/arm/nordic/nrf52810.dtsi b/dts/arm/nordic/nrf52810.dtsi index 217758dd1614..c1e5f8763172 100644 --- a/dts/arm/nordic/nrf52810.dtsi +++ b/dts/arm/nordic/nrf52810.dtsi @@ -180,6 +180,7 @@ #io-channel-cells = <1>; zephyr,pm-device-runtime-auto; }; + timer0: timer@40008000 { compatible = "nordic,nrf-timer"; status = "disabled"; @@ -345,7 +346,6 @@ #address-cells = <1>; #size-cells = <1>; - flash0: flash@0 { compatible = "soc-nv-flash"; erase-block-size = <4096>; diff --git a/dts/arm/nordic/nrf52811.dtsi b/dts/arm/nordic/nrf52811.dtsi index 670f569c0ace..33f6ac38747a 100644 --- a/dts/arm/nordic/nrf52811.dtsi +++ b/dts/arm/nordic/nrf52811.dtsi @@ -159,7 +159,7 @@ }; spi1: spi@40003000 { - /* cannot be used with i2c0 */ + /* cannot be used with i2c0 */ /* * This spi node can be SPI, SPIM, or SPIS, * for the user to pick: @@ -377,7 +377,6 @@ #address-cells = <1>; #size-cells = <1>; - flash0: flash@0 { compatible = "soc-nv-flash"; erase-block-size = <4096>; diff --git a/dts/arm/nordic/nrf52820.dtsi b/dts/arm/nordic/nrf52820.dtsi index 50c8d2ba07f0..1073b973c22a 100644 --- a/dts/arm/nordic/nrf52820.dtsi +++ b/dts/arm/nordic/nrf52820.dtsi @@ -9,7 +9,6 @@ #include / { - chosen { zephyr,bt-hci = &bt_hci_controller; zephyr,entropy = &rng; @@ -389,7 +388,6 @@ #address-cells = <1>; #size-cells = <1>; - flash0: flash@0 { compatible = "soc-nv-flash"; erase-block-size = <4096>; diff --git a/dts/arm/nordic/nrf52832.dtsi b/dts/arm/nordic/nrf52832.dtsi index 7bd62c707545..09a651762db6 100644 --- a/dts/arm/nordic/nrf52832.dtsi +++ b/dts/arm/nordic/nrf52832.dtsi @@ -412,7 +412,6 @@ #address-cells = <1>; #size-cells = <1>; - flash0: flash@0 { compatible = "soc-nv-flash"; erase-block-size = <4096>; diff --git a/dts/arm/nordic/nrf52833.dtsi b/dts/arm/nordic/nrf52833.dtsi index 8202ddc45431..87e6bccfb53d 100644 --- a/dts/arm/nordic/nrf52833.dtsi +++ b/dts/arm/nordic/nrf52833.dtsi @@ -434,7 +434,6 @@ #address-cells = <1>; #size-cells = <1>; - flash0: flash@0 { compatible = "soc-nv-flash"; erase-block-size = <4096>; diff --git a/dts/arm/nordic/nrf52840.dtsi b/dts/arm/nordic/nrf52840.dtsi index bcbfd926c9bb..b04b31a640dc 100644 --- a/dts/arm/nordic/nrf52840.dtsi +++ b/dts/arm/nordic/nrf52840.dtsi @@ -421,7 +421,6 @@ #address-cells = <1>; #size-cells = <1>; - flash0: flash@0 { compatible = "soc-nv-flash"; erase-block-size = <4096>; diff --git a/dts/arm/nordic/nrf52840_qfaa.dtsi b/dts/arm/nordic/nrf52840_qfaa.dtsi index 85acf5ab4685..6d549a45d1dd 100644 --- a/dts/arm/nordic/nrf52840_qfaa.dtsi +++ b/dts/arm/nordic/nrf52840_qfaa.dtsi @@ -19,7 +19,6 @@ soc { compatible = "simple-bus"; }; - }; /delete-node/ &usbd; diff --git a/dts/arm/nordic/nrf5340_cpuapp_peripherals.dtsi b/dts/arm/nordic/nrf5340_cpuapp_peripherals.dtsi index 7021b7eedeb1..ea56b3206bcc 100644 --- a/dts/arm/nordic/nrf5340_cpuapp_peripherals.dtsi +++ b/dts/arm/nordic/nrf5340_cpuapp_peripherals.dtsi @@ -536,7 +536,6 @@ flash_controller: flash-controller@39000 { #address-cells = <1>; #size-cells = <1>; - flash0: flash@0 { compatible = "soc-nv-flash"; erase-block-size = <4096>; diff --git a/dts/arm/nordic/nrf5340_cpunet.dtsi b/dts/arm/nordic/nrf5340_cpunet.dtsi index 4f9164767f1a..5010f801e0c0 100644 --- a/dts/arm/nordic/nrf5340_cpunet.dtsi +++ b/dts/arm/nordic/nrf5340_cpunet.dtsi @@ -309,7 +309,6 @@ #address-cells = <1>; #size-cells = <1>; - flash1: flash@1000000 { compatible = "soc-nv-flash"; erase-block-size = <2048>; diff --git a/dts/arm/nordic/nrf54h20_cpuapp.dtsi b/dts/arm/nordic/nrf54h20_cpuapp.dtsi index 9e790656e501..1e6eb128443d 100644 --- a/dts/arm/nordic/nrf54h20_cpuapp.dtsi +++ b/dts/arm/nordic/nrf54h20_cpuapp.dtsi @@ -7,12 +7,19 @@ #include cpu: &cpuapp {}; + systick: &cpuapp_systick {}; + nvic: &cpuapp_nvic {}; + cpuppr_vevif: &cpuppr_vevif_tx {}; + cpuflpr_vevif: &cpuflpr_vevif_tx {}; + cpusys_vevif: &cpusys_vevif_tx {}; + wdt010: &cpuapp_wdt010 {}; + wdt011: &cpuapp_wdt011 {}; /delete-node/ &cpuppr; @@ -60,15 +67,15 @@ wdt011: &cpuapp_wdt011 {}; interrupts = <109 NRF_DEFAULT_IRQ_PRIORITY>; }; -&fll16m { +&fll16m { status = "okay"; }; -&hsfll120 { +&hsfll120 { status = "okay"; }; -&lfclk { +&lfclk { status = "okay"; }; diff --git a/dts/arm/nordic/nrf54h20_cpurad.dtsi b/dts/arm/nordic/nrf54h20_cpurad.dtsi index f7f7464f91c2..378d27c3fd62 100644 --- a/dts/arm/nordic/nrf54h20_cpurad.dtsi +++ b/dts/arm/nordic/nrf54h20_cpurad.dtsi @@ -7,12 +7,19 @@ #include cpu: &cpurad {}; + systick: &cpurad_systick {}; + nvic: &cpurad_nvic {}; + cpuppr_vevif: &cpuppr_vevif_tx {}; + cpuflpr_vevif: &cpuflpr_vevif_tx {}; + cpusys_vevif: &cpusys_vevif_tx {}; + wdt010: &cpurad_wdt010 {}; + wdt011: &cpurad_wdt011 {}; /delete-node/ &cpuapp; @@ -101,15 +108,15 @@ wdt011: &cpurad_wdt011 {}; status = "okay"; }; -&fll16m { +&fll16m { status = "okay"; }; -&hsfll120 { +&hsfll120 { status = "okay"; }; -&lfclk { +&lfclk { status = "okay"; }; diff --git a/dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi b/dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi index 1eb43bdc81d7..a480edb41fdc 100644 --- a/dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi +++ b/dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi @@ -5,7 +5,9 @@ */ cpu: &cpuapp {}; + systick: &cpuapp_systick {}; + nvic: &cpuapp_nvic {}; /delete-node/ &cpuflpr; @@ -72,7 +74,7 @@ nvic: &cpuapp_nvic {}; #else interrupts = <228 NRF_DEFAULT_IRQ_PRIORITY>, #endif - <229 NRF_DEFAULT_IRQ_PRIORITY>; /* reserved for Zero Latency IRQs */ + <229 NRF_DEFAULT_IRQ_PRIORITY>; /* reserved for Zero Latency IRQs */ }; &gpiote20 { diff --git a/dts/arm/nordic/nrf54lm20a_enga_cpuapp.dtsi b/dts/arm/nordic/nrf54lm20a_enga_cpuapp.dtsi index 1fb0386650b4..93d00aa75733 100644 --- a/dts/arm/nordic/nrf54lm20a_enga_cpuapp.dtsi +++ b/dts/arm/nordic/nrf54lm20a_enga_cpuapp.dtsi @@ -7,7 +7,9 @@ #include cpu: &cpuapp {}; + systick: &cpuapp_systick {}; + nvic: &cpuapp_nvic {}; /delete-node/ &cpuflpr; diff --git a/dts/arm/nordic/nrf91.dtsi b/dts/arm/nordic/nrf91.dtsi index 7b7d48916519..31cbe7d9ea41 100644 --- a/dts/arm/nordic/nrf91.dtsi +++ b/dts/arm/nordic/nrf91.dtsi @@ -66,7 +66,7 @@ * so we give it the 'gpiote' label for use when building * code for this target. */ - gpiote: gpiote0: gpiote@5000d000 { + gpiote: gpiote0: gpiote@5000d000 { compatible = "nordic,nrf-gpiote"; reg = <0x5000d000 0x1000>; interrupts = <13 5>; diff --git a/dts/arm/nordic/nrf91_peripherals.dtsi b/dts/arm/nordic/nrf91_peripherals.dtsi index 476f8415853a..3e7e42472b9b 100644 --- a/dts/arm/nordic/nrf91_peripherals.dtsi +++ b/dts/arm/nordic/nrf91_peripherals.dtsi @@ -12,7 +12,6 @@ flash_controller: flash-controller@39000 { #address-cells = <1>; #size-cells = <1>; - flash0: flash@0 { compatible = "soc-nv-flash"; erase-block-size = <4096>; diff --git a/dts/arm/nordic/nrf9280_cpuapp.dtsi b/dts/arm/nordic/nrf9280_cpuapp.dtsi index 29edae31051d..01716a656785 100644 --- a/dts/arm/nordic/nrf9280_cpuapp.dtsi +++ b/dts/arm/nordic/nrf9280_cpuapp.dtsi @@ -7,11 +7,17 @@ #include cpu: &cpuapp {}; + systick: &cpuapp_systick {}; + nvic: &cpuapp_nvic {}; + cpuppr_vevif: &cpuppr_vevif_tx {}; + cpusys_vevif: &cpusys_vevif_tx {}; + wdt010: &cpuapp_wdt010 {}; + wdt011: &cpuapp_wdt011 {}; /delete-node/ &cpuppr; diff --git a/dts/arm/nordic/nrf9280_cpurad.dtsi b/dts/arm/nordic/nrf9280_cpurad.dtsi index 265cd6239537..9a88533507f3 100644 --- a/dts/arm/nordic/nrf9280_cpurad.dtsi +++ b/dts/arm/nordic/nrf9280_cpurad.dtsi @@ -7,11 +7,17 @@ #include cpu: &cpurad {}; + systick: &cpurad_systick {}; + nvic: &cpurad_nvic {}; + cpuppr_vevif: &cpuppr_vevif_tx {}; + cpusys_vevif: &cpusys_vevif_tx {}; + wdt010: &cpurad_wdt010 {}; + wdt011: &cpurad_wdt011 {}; /delete-node/ &cpuapp; From 66142b4328d88f74e5d3074da2e7d56b8605a1fb Mon Sep 17 00:00:00 2001 From: Sai Santhosh Malae Date: Fri, 22 Aug 2025 15:07:22 +0530 Subject: [PATCH 1910/2141] [nrf fromtree] drivers: power_domain: siwx91x: Add power domain driver for siwx91x SoC 1. Added siwx91x power domain node in siwg917.dtsi 2. Updated UART device nodes to reference the newly added power domain. 3. Implemented power domain driver to manage power domain transitions for the SoC. Signed-off-by: Sai Santhosh Malae (cherry picked from commit 295431dad598dfdec8260dac6b22bd4919117360) --- drivers/power_domain/CMakeLists.txt | 1 + drivers/power_domain/Kconfig | 1 + drivers/power_domain/Kconfig.silabs_siwx91x | 16 +++++++ .../power_domain_silabs_siwx91x.c | 42 +++++++++++++++++++ dts/arm/silabs/siwg917.dtsi | 13 ++++++ .../silabs,siwx91x-power-domain.yaml | 5 +++ 6 files changed, 78 insertions(+) create mode 100644 drivers/power_domain/Kconfig.silabs_siwx91x create mode 100644 drivers/power_domain/power_domain_silabs_siwx91x.c create mode 100644 dts/bindings/power-domain/silabs,siwx91x-power-domain.yaml diff --git a/drivers/power_domain/CMakeLists.txt b/drivers/power_domain/CMakeLists.txt index 357efe6f4ab7..3b7ba378f9e3 100644 --- a/drivers/power_domain/CMakeLists.txt +++ b/drivers/power_domain/CMakeLists.txt @@ -11,3 +11,4 @@ zephyr_library_sources_ifdef(CONFIG_POWER_DOMAIN_NRFS_GDPWR power_domain_nrfs_gd zephyr_library_sources_ifdef(CONFIG_POWER_DOMAIN_NRF_GPIO_PAD_GROUP power_domain_nrf_gpio_pad_group.c) zephyr_library_sources_ifdef(CONFIG_POWER_DOMAIN_SOC_PM_STATE power_domain_soc_state_change.c) zephyr_library_sources_ifdef(CONFIG_POWER_DOMAIN_TISCI power_domain_tisci.c) +zephyr_library_sources_ifdef(CONFIG_POWER_DOMAIN_SILABS_SIWX91X power_domain_silabs_siwx91x.c) diff --git a/drivers/power_domain/Kconfig b/drivers/power_domain/Kconfig index 7b336700dd6e..2c3592c773db 100644 --- a/drivers/power_domain/Kconfig +++ b/drivers/power_domain/Kconfig @@ -125,5 +125,6 @@ endif #POWER_DOMAIN_TISCI rsource "Kconfig.nrfs_gdpwr" rsource "Kconfig.nrf_gpio_pad_group" +rsource "Kconfig.silabs_siwx91x" endif diff --git a/drivers/power_domain/Kconfig.silabs_siwx91x b/drivers/power_domain/Kconfig.silabs_siwx91x new file mode 100644 index 000000000000..3fa95f335538 --- /dev/null +++ b/drivers/power_domain/Kconfig.silabs_siwx91x @@ -0,0 +1,16 @@ +# Copyright 2025 Silicon Laboratories Inc. +# SPDX-License-Identifier: Apache-2.0 + +config POWER_DOMAIN_SILABS_SIWX91X + bool "Silabs siwx91x power domain driver" + default y + select DEVICE_DEPS + depends on DT_HAS_SILABS_SIWX91X_POWER_DOMAIN_ENABLED + help + Driver for Silabs siwx91x power domain. + +config SIWX91X_POWER_DOMAIN_INIT_PRIORITY + int "Silabs siwx91x power domain init priority" + default 10 + help + Silabs siwx91x power domain initialization priority. diff --git a/drivers/power_domain/power_domain_silabs_siwx91x.c b/drivers/power_domain/power_domain_silabs_siwx91x.c new file mode 100644 index 000000000000..8350e8a25e15 --- /dev/null +++ b/drivers/power_domain/power_domain_silabs_siwx91x.c @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2025 Silicon Laboratories Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include + +#define DT_DRV_COMPAT silabs_siwx91x_power_domain + +static int siwx91x_pd_pm_action(const struct device *dev, enum pm_device_action action) +{ + switch (action) { + case PM_DEVICE_ACTION_RESUME: + pm_device_children_action_run(dev, PM_DEVICE_ACTION_TURN_ON, NULL); + break; + case PM_DEVICE_ACTION_SUSPEND: + pm_device_children_action_run(dev, PM_DEVICE_ACTION_TURN_OFF, NULL); + break; + case PM_DEVICE_ACTION_TURN_ON: + break; + case PM_DEVICE_ACTION_TURN_OFF: + break; + default: + return -ENOTSUP; + } + + return 0; +} + +static int siwx91x_pd_init(const struct device *dev) +{ + return pm_device_driver_init(dev, siwx91x_pd_pm_action); +} + +#define SIWX91X_PD_INIT(inst) \ + PM_DEVICE_DT_INST_DEFINE(inst, siwx91x_pd_pm_action); \ + DEVICE_DT_INST_DEFINE(inst, siwx91x_pd_init, PM_DEVICE_DT_INST_GET(inst), NULL, NULL, \ + PRE_KERNEL_1, CONFIG_SIWX91X_POWER_DOMAIN_INIT_PRIORITY, NULL); + +DT_INST_FOREACH_STATUS_OKAY(SIWX91X_PD_INIT) diff --git a/dts/arm/silabs/siwg917.dtsi b/dts/arm/silabs/siwg917.dtsi index ceb79d35152c..9cc9f358f048 100644 --- a/dts/arm/silabs/siwg917.dtsi +++ b/dts/arm/silabs/siwg917.dtsi @@ -124,6 +124,13 @@ status = "disabled"; }; + siwx91x_soc_pd: siwx91x-soc-pd { + compatible = "silabs,siwx91x-power-domain"; + #power-domain-cells = <0>; + zephyr,pm-device-runtime-auto; + status = "okay"; + }; + ulpuart: uart@24041800 { compatible = "ns16550"; reg = <0x24041800 0x1000>; @@ -131,6 +138,8 @@ reg-shift = <2>; clocks = <&clock0 SIWX91X_CLK_ULP_UART>; current-speed = <115200>; + power-domains = <&siwx91x_soc_pd>; + zephyr,pm-device-runtime-auto; status = "disabled"; }; @@ -141,6 +150,8 @@ reg-shift = <2>; clocks = <&clock0 SIWX91X_CLK_UART0>; current-speed = <115200>; + power-domains = <&siwx91x_soc_pd>; + zephyr,pm-device-runtime-auto; status = "disabled"; }; @@ -151,6 +162,8 @@ reg-shift = <2>; clocks = <&clock0 SIWX91X_CLK_UART1>; current-speed = <115200>; + power-domains = <&siwx91x_soc_pd>; + zephyr,pm-device-runtime-auto; status = "disabled"; }; diff --git a/dts/bindings/power-domain/silabs,siwx91x-power-domain.yaml b/dts/bindings/power-domain/silabs,siwx91x-power-domain.yaml new file mode 100644 index 000000000000..cd0bafa8237e --- /dev/null +++ b/dts/bindings/power-domain/silabs,siwx91x-power-domain.yaml @@ -0,0 +1,5 @@ +description: Silabs siwx91x soc power domain + +compatible: "silabs,siwx91x-power-domain" + +include: power-domain.yaml From 0187e7659f2b5e9775fa6be92f573c2be1879901 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Wed, 30 Jul 2025 15:40:11 +0200 Subject: [PATCH 1911/2141] [nrf fromtree] drivers: power_domain: introduce nrfs_swext device driver Introduce nrfx_swext device driver for NRFS SWEXT power domain device. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit 5db84c7cb799e1cf54a938cee499e8ec601f6dcd) --- drivers/power_domain/CMakeLists.txt | 1 + drivers/power_domain/Kconfig | 1 + drivers/power_domain/Kconfig.nrfs_swext | 9 + .../power_domain/power_domain_nrfs_swext.c | 200 ++++++++++++++++++ 4 files changed, 211 insertions(+) create mode 100644 drivers/power_domain/Kconfig.nrfs_swext create mode 100644 drivers/power_domain/power_domain_nrfs_swext.c diff --git a/drivers/power_domain/CMakeLists.txt b/drivers/power_domain/CMakeLists.txt index 3b7ba378f9e3..e4a7c7dbc28b 100644 --- a/drivers/power_domain/CMakeLists.txt +++ b/drivers/power_domain/CMakeLists.txt @@ -8,6 +8,7 @@ zephyr_library_sources_ifdef(CONFIG_POWER_DOMAIN_GPIO_MONITOR power_domain_gpio_ zephyr_library_sources_ifdef(CONFIG_POWER_DOMAIN_INTEL_ADSP power_domain_intel_adsp.c) zephyr_library_sources_ifdef(CONFIG_POWER_DOMAIN_NXP_SCU power_domain_nxp_scu.c) zephyr_library_sources_ifdef(CONFIG_POWER_DOMAIN_NRFS_GDPWR power_domain_nrfs_gdpwr.c) +zephyr_library_sources_ifdef(CONFIG_POWER_DOMAIN_NRFS_SWEXT power_domain_nrfs_swext.c) zephyr_library_sources_ifdef(CONFIG_POWER_DOMAIN_NRF_GPIO_PAD_GROUP power_domain_nrf_gpio_pad_group.c) zephyr_library_sources_ifdef(CONFIG_POWER_DOMAIN_SOC_PM_STATE power_domain_soc_state_change.c) zephyr_library_sources_ifdef(CONFIG_POWER_DOMAIN_TISCI power_domain_tisci.c) diff --git a/drivers/power_domain/Kconfig b/drivers/power_domain/Kconfig index 2c3592c773db..ce6fb4d42db8 100644 --- a/drivers/power_domain/Kconfig +++ b/drivers/power_domain/Kconfig @@ -124,6 +124,7 @@ config SOC_POWER_DOMAIN_INIT endif #POWER_DOMAIN_TISCI rsource "Kconfig.nrfs_gdpwr" +rsource "Kconfig.nrfs_swext" rsource "Kconfig.nrf_gpio_pad_group" rsource "Kconfig.silabs_siwx91x" diff --git a/drivers/power_domain/Kconfig.nrfs_swext b/drivers/power_domain/Kconfig.nrfs_swext new file mode 100644 index 000000000000..1a2c5d2d895e --- /dev/null +++ b/drivers/power_domain/Kconfig.nrfs_swext @@ -0,0 +1,9 @@ +# Copyright 2025 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config POWER_DOMAIN_NRFS_SWEXT + bool "NRFS SWEXT power domain driver" + depends on DT_HAS_NORDIC_NRFS_SWEXT_ENABLED + select NRFS + select NRFS_SWEXT_SERVICE_ENABLED + default y diff --git a/drivers/power_domain/power_domain_nrfs_swext.c b/drivers/power_domain/power_domain_nrfs_swext.c new file mode 100644 index 000000000000..900fe4f7a8e6 --- /dev/null +++ b/drivers/power_domain/power_domain_nrfs_swext.c @@ -0,0 +1,200 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#define DT_DRV_COMPAT nordic_nrfs_swext + +#include +#include +#include +#include + +#include +#include + +LOG_MODULE_REGISTER(nrfs_swext, CONFIG_POWER_DOMAIN_LOG_LEVEL); + +BUILD_ASSERT( + DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) == 1, + "multiple instances not supported" +); + +struct nrfs_swext_data { + struct k_sem evt_sem; + nrfs_swext_evt_type_t evt; +}; + +struct nrfs_swext_config { + uint16_t current_limit_ua; + bool enable_power_down_clamp; +}; + +static void nrfs_swext_driver_evt_handler(nrfs_swext_evt_t const *p_evt, void *context) +{ + struct nrfs_swext_data *dev_data = context; + + LOG_DBG("evt %u", (uint32_t)p_evt->type); + + if (p_evt->type == NRFS_SWEXT_EVT_OVERCURRENT) { + /* Overcurrent is an unrecoverable condition which requires hardware fix */ + LOG_ERR("overcurrent"); + k_panic(); + }; + + dev_data->evt = p_evt->type; + k_sem_give(&dev_data->evt_sem); +} + +static int nrfs_swext_driver_power_down(const struct device *dev) +{ + const struct nrfs_swext_config *dev_config = dev->config; + nrfs_err_t err; + swext_pd_clamp_t pd_clamp = dev_config->enable_power_down_clamp + ? SWEXT_PD_CLAMP_ENABLED + : SWEXT_PD_CLAMP_DISABLED; + + /* + * Power down request does not respond with an event. + * Set context to NULL, fire and forget. + */ + err = nrfs_swext_power_down(pd_clamp, NULL); + if (err != NRFS_SUCCESS) { + LOG_ERR("failed to request power down"); + return -ENODEV; + } + + return 0; +} + +static int nrfs_swext_driver_power_up(const struct device *dev) +{ + struct nrfs_swext_data *dev_data = dev->data; + const struct nrfs_swext_config *dev_config = dev->config; + nrfs_err_t err; + uint8_t load_current; + + load_current = nrfs_swext_load_current_to_raw(dev_config->current_limit_ua); + err = nrfs_swext_power_up(load_current, dev_data); + if (err != NRFS_SUCCESS) { + LOG_ERR("failed to request power up"); + return -ENODEV; + } + + (void)k_sem_take(&dev_data->evt_sem, K_FOREVER); + + if (dev_data->evt == NRFS_SWEXT_EVT_ENABLED) { + return 0; + } + + LOG_ERR("power up request rejected"); + return -EIO; +} + +#if IS_ENABLED(CONFIG_DEVICE_DEPS) && IS_ENABLED(CONFIG_PM_DEVICE_POWER_DOMAIN) +static void nrfs_swext_driver_notify_children(const struct device *dev, + enum pm_device_action action) +{ + pm_device_children_action_run(dev, action, NULL); +} +#else +static void nrfs_swext_driver_notify_children(const struct device *dev, + enum pm_device_action action) +{ + ARG_UNUSED(dev); + ARG_UNUSED(action); +} +#endif + +static int nrfs_swext_driver_suspend(const struct device *dev) +{ + int ret; + + nrfs_swext_driver_notify_children(dev, PM_DEVICE_ACTION_TURN_OFF); + + ret = nrfs_swext_driver_power_down(dev); + if (ret) { + nrfs_swext_driver_notify_children(dev, PM_DEVICE_ACTION_TURN_ON); + } + + return ret; +} + +static int nrfs_swext_driver_resume(const struct device *dev) +{ + int ret; + + ret = nrfs_swext_driver_power_up(dev); + if (ret == 0) { + nrfs_swext_driver_notify_children(dev, PM_DEVICE_ACTION_TURN_ON); + } + + return ret; +} + +static int nrfs_swext_driver_pm_action(const struct device *dev, + enum pm_device_action action) +{ + int ret; + + switch (action) { + case PM_DEVICE_ACTION_SUSPEND: + ret = nrfs_swext_driver_suspend(dev); + break; + + case PM_DEVICE_ACTION_RESUME: + ret = nrfs_swext_driver_resume(dev); + break; + + default: + ret = -ENOTSUP; + break; + }; + + return ret; +} + +static int nrfs_swext_driver_init(const struct device *dev) +{ + struct nrfs_swext_data *dev_data = dev->data; + nrfs_err_t err; + + LOG_DBG("waiting for nrfs backend connected"); + err = nrfs_backend_wait_for_connection(K_FOREVER); + if (err != NRFS_SUCCESS) { + LOG_ERR("nrfs backend not connected"); + return -ENODEV; + } + + err = nrfs_swext_init(nrfs_swext_driver_evt_handler); + if (err != NRFS_SUCCESS) { + LOG_ERR("failed to init swext service"); + return -ENODEV; + } + + k_sem_init(&dev_data->evt_sem, 0, 1); + return pm_device_driver_init(dev, nrfs_swext_driver_pm_action); +} + +PM_DEVICE_DT_INST_DEFINE(0, nrfs_swext_driver_pm_action); + +BUILD_ASSERT(DT_INST_PROP(0, max_current_ua) <= UINT16_MAX); +BUILD_ASSERT(DT_INST_PROP(0, current_limit_ua) <= DT_INST_PROP(0, max_current_ua)); + +static struct nrfs_swext_data data0; +static const struct nrfs_swext_config config0 = { + .current_limit_ua = DT_INST_PROP(0, current_limit_ua), + .enable_power_down_clamp = DT_INST_PROP(0, power_down_clamp), +}; + +DEVICE_DT_INST_DEFINE( + 0, + nrfs_swext_driver_init, + PM_DEVICE_DT_INST_GET(0), + &data0, + &config0, + POST_KERNEL, + UTIL_INC(CONFIG_NRFS_BACKEND_IPC_SERVICE_INIT_PRIO), + NULL +); From 494993f2c145c44396974a7c1d4da31aff6a06ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Mon, 29 Sep 2025 12:12:21 +0200 Subject: [PATCH 1912/2141] [nrf fromtree] drivers: power_domain: nrf_gpio_pad_group: Fix DT macro MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit DT_PROP_OR instead of DT_INST_PROP_OR was used and property from device tree was never used. Signed-off-by: Krzysztof Chruściński (cherry picked from commit 767c21a2179e151db6af5922008313f540886c4a) --- drivers/power_domain/power_domain_nrf_gpio_pad_group.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/power_domain/power_domain_nrf_gpio_pad_group.c b/drivers/power_domain/power_domain_nrf_gpio_pad_group.c index 8b4119312c10..06b40d9d5840 100644 --- a/drivers/power_domain/power_domain_nrf_gpio_pad_group.c +++ b/drivers/power_domain/power_domain_nrf_gpio_pad_group.c @@ -63,7 +63,7 @@ static int nrf_port_retain_driver_init(const struct device *dev) #define NRF_GPIO_PAD_GROUP_DEFINE(inst) \ static const struct nrf_port_retain_config _CONCAT(config, inst) = { \ .regs = (NRF_GPIO_Type *)DT_REG_ADDR(DT_INST_PARENT(inst)), \ - .retain_mask = DT_PROP_OR(inst, retain_mask, UINT32_MAX), \ + .retain_mask = DT_INST_PROP_OR(inst, retain_mask, UINT32_MAX), \ }; \ \ PM_DEVICE_DT_INST_DEFINE(inst, nrf_port_retain_driver_pm_action); \ From efc49adba74d49d1d16d14d371e958bc1f6bcdb2 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Mon, 13 Oct 2025 10:48:05 +0200 Subject: [PATCH 1913/2141] [nrf fromlist] dts: vendor: nordic: nrf54h: remove gpio-pad-groups The gpio pad groups are redundant if pin retention is handled per pin, and the quirky cross domain feature is managed by the application. Remove it entirely. Upstream PR #: 97452 Signed-off-by: Bjarki Arge Andreasen --- drivers/power_domain/CMakeLists.txt | 1 - drivers/power_domain/Kconfig | 1 - .../power_domain/Kconfig.nrf_gpio_pad_group | 7 -- .../power_domain_nrf_gpio_pad_group.c | 82 ------------------- dts/arm/nordic/nrf54h20_cpuapp.dtsi | 24 ------ dts/arm/nordic/nrf54h20_cpurad.dtsi | 24 ------ .../gpio/nordic,nrf-gpio-pad-group.yaml | 43 ---------- dts/vendor/nordic/nrf54h20.dtsi | 42 ---------- 8 files changed, 224 deletions(-) delete mode 100644 drivers/power_domain/Kconfig.nrf_gpio_pad_group delete mode 100644 drivers/power_domain/power_domain_nrf_gpio_pad_group.c delete mode 100644 dts/bindings/gpio/nordic,nrf-gpio-pad-group.yaml diff --git a/drivers/power_domain/CMakeLists.txt b/drivers/power_domain/CMakeLists.txt index e4a7c7dbc28b..2749a32d5d63 100644 --- a/drivers/power_domain/CMakeLists.txt +++ b/drivers/power_domain/CMakeLists.txt @@ -9,7 +9,6 @@ zephyr_library_sources_ifdef(CONFIG_POWER_DOMAIN_INTEL_ADSP power_domain_intel_a zephyr_library_sources_ifdef(CONFIG_POWER_DOMAIN_NXP_SCU power_domain_nxp_scu.c) zephyr_library_sources_ifdef(CONFIG_POWER_DOMAIN_NRFS_GDPWR power_domain_nrfs_gdpwr.c) zephyr_library_sources_ifdef(CONFIG_POWER_DOMAIN_NRFS_SWEXT power_domain_nrfs_swext.c) -zephyr_library_sources_ifdef(CONFIG_POWER_DOMAIN_NRF_GPIO_PAD_GROUP power_domain_nrf_gpio_pad_group.c) zephyr_library_sources_ifdef(CONFIG_POWER_DOMAIN_SOC_PM_STATE power_domain_soc_state_change.c) zephyr_library_sources_ifdef(CONFIG_POWER_DOMAIN_TISCI power_domain_tisci.c) zephyr_library_sources_ifdef(CONFIG_POWER_DOMAIN_SILABS_SIWX91X power_domain_silabs_siwx91x.c) diff --git a/drivers/power_domain/Kconfig b/drivers/power_domain/Kconfig index ce6fb4d42db8..3de9185761c0 100644 --- a/drivers/power_domain/Kconfig +++ b/drivers/power_domain/Kconfig @@ -125,7 +125,6 @@ endif #POWER_DOMAIN_TISCI rsource "Kconfig.nrfs_gdpwr" rsource "Kconfig.nrfs_swext" -rsource "Kconfig.nrf_gpio_pad_group" rsource "Kconfig.silabs_siwx91x" endif diff --git a/drivers/power_domain/Kconfig.nrf_gpio_pad_group b/drivers/power_domain/Kconfig.nrf_gpio_pad_group deleted file mode 100644 index 1b36c0cc7e08..000000000000 --- a/drivers/power_domain/Kconfig.nrf_gpio_pad_group +++ /dev/null @@ -1,7 +0,0 @@ -# Copyright 2025 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -config POWER_DOMAIN_NRF_GPIO_PAD_GROUP - bool "NRFS Global Domain Power Request driver" - depends on DT_HAS_NORDIC_NRF_GPIO_PAD_GROUP_ENABLED - default y diff --git a/drivers/power_domain/power_domain_nrf_gpio_pad_group.c b/drivers/power_domain/power_domain_nrf_gpio_pad_group.c deleted file mode 100644 index 06b40d9d5840..000000000000 --- a/drivers/power_domain/power_domain_nrf_gpio_pad_group.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#define DT_DRV_COMPAT nordic_nrf_gpio_pad_group - -#include -#include -#include -#include - -#include - -LOG_MODULE_REGISTER(nrf_gpio_pad_group, CONFIG_POWER_DOMAIN_LOG_LEVEL); - -struct nrf_port_retain_config { - NRF_GPIO_Type *regs; - uint32_t retain_mask; -}; - -static void nrf_port_retain_driver_turn_off(const struct device *dev) -{ - const struct nrf_port_retain_config *dev_config = dev->config; - - LOG_DBG("%s pads 0x%08x retain %s", dev->name, dev_config->retain_mask, "enable"); - nrf_gpio_port_retain_enable(dev_config->regs, dev_config->retain_mask); -} - -static void nrf_port_retain_driver_turn_on(const struct device *dev) -{ - const struct nrf_port_retain_config *dev_config = dev->config; - - LOG_DBG("%s pads 0x%08x retain %s", dev->name, dev_config->retain_mask, "disable"); - nrf_gpio_port_retain_disable(dev_config->regs, dev_config->retain_mask); -} - -static int nrf_port_retain_driver_pm_action(const struct device *dev, - enum pm_device_action action) -{ - switch (action) { - case PM_DEVICE_ACTION_TURN_OFF: - nrf_port_retain_driver_turn_off(dev); - break; - - case PM_DEVICE_ACTION_TURN_ON: - nrf_port_retain_driver_turn_on(dev); - break; - - default: - break; - }; - - return 0; -} - -static int nrf_port_retain_driver_init(const struct device *dev) -{ - return pm_device_driver_init(dev, nrf_port_retain_driver_pm_action); -} - -#define NRF_GPIO_PAD_GROUP_DEFINE(inst) \ - static const struct nrf_port_retain_config _CONCAT(config, inst) = { \ - .regs = (NRF_GPIO_Type *)DT_REG_ADDR(DT_INST_PARENT(inst)), \ - .retain_mask = DT_INST_PROP_OR(inst, retain_mask, UINT32_MAX), \ - }; \ - \ - PM_DEVICE_DT_INST_DEFINE(inst, nrf_port_retain_driver_pm_action); \ - \ - DEVICE_DT_INST_DEFINE( \ - inst, \ - nrf_port_retain_driver_init, \ - PM_DEVICE_DT_INST_GET(inst), \ - NULL, \ - &_CONCAT(config, inst), \ - PRE_KERNEL_1, \ - UTIL_INC(CONFIG_GPIO_INIT_PRIORITY), \ - NULL \ - ); - -DT_INST_FOREACH_STATUS_OKAY(NRF_GPIO_PAD_GROUP_DEFINE) diff --git a/dts/arm/nordic/nrf54h20_cpuapp.dtsi b/dts/arm/nordic/nrf54h20_cpuapp.dtsi index 1e6eb128443d..f3b8e4f8c08c 100644 --- a/dts/arm/nordic/nrf54h20_cpuapp.dtsi +++ b/dts/arm/nordic/nrf54h20_cpuapp.dtsi @@ -102,27 +102,3 @@ wdt011: &cpuapp_wdt011 {}; &gdpwr_slow_main { status = "okay"; }; - -&gpio_pad_group0 { - status = "okay"; -}; - -&gpio_pad_group1 { - status = "okay"; -}; - -&gpio_pad_group2 { - status = "okay"; -}; - -&gpio_pad_group6 { - status = "okay"; -}; - -&gpio_pad_group7 { - status = "okay"; -}; - -&gpio_pad_group9 { - status = "okay"; -}; diff --git a/dts/arm/nordic/nrf54h20_cpurad.dtsi b/dts/arm/nordic/nrf54h20_cpurad.dtsi index 378d27c3fd62..cc7b0a97b513 100644 --- a/dts/arm/nordic/nrf54h20_cpurad.dtsi +++ b/dts/arm/nordic/nrf54h20_cpurad.dtsi @@ -143,27 +143,3 @@ wdt011: &cpurad_wdt011 {}; &gdpwr_slow_main { status = "okay"; }; - -&gpio_pad_group0 { - status = "okay"; -}; - -&gpio_pad_group1 { - status = "okay"; -}; - -&gpio_pad_group2 { - status = "okay"; -}; - -&gpio_pad_group6 { - status = "okay"; -}; - -&gpio_pad_group7 { - status = "okay"; -}; - -&gpio_pad_group9 { - status = "okay"; -}; diff --git a/dts/bindings/gpio/nordic,nrf-gpio-pad-group.yaml b/dts/bindings/gpio/nordic,nrf-gpio-pad-group.yaml deleted file mode 100644 index 104277addd35..000000000000 --- a/dts/bindings/gpio/nordic,nrf-gpio-pad-group.yaml +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright 2025 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -description: | - Nordic nRF GPIO pad group. - - The GPIO pad group describes the pads (package - pins of the SoC) the GPIO controller manages. - - The pads may be in a different power domain than - the GPIO controller, and may require enabling - retention to preserve the GPIO configuration if - the power domain is suspended. - - The GPIO pad group is a child node of the GPIO - controller which manages the pad group, named - pad-group. The pad group's nodelabel is named - gpio_pad_group. - - Example layout: - - gpio0: gpio@938000 { - compatible = "nordic,nrf-gpio"; - - ... - - gpio_pad_group0: pad-group { - compatible = "nordic,nrf-gpio-pad-group"; - power-domains = <&gdpwr_slow_main>; - retain-mask = <0xFFF>; - }; - }; - -compatible: "nordic,nrf-gpio-pad-group" - -include: base.yaml - -properties: - retain-mask: - type: int - description: | - Mask of pins which shall be retained if pad - group's power domain is powered off. diff --git a/dts/vendor/nordic/nrf54h20.dtsi b/dts/vendor/nordic/nrf54h20.dtsi index e98693d1be97..06a7fe4d2495 100644 --- a/dts/vendor/nordic/nrf54h20.dtsi +++ b/dts/vendor/nordic/nrf54h20.dtsi @@ -908,13 +908,6 @@ ngpios = <12>; port = <0>; zephyr,pm-device-runtime-auto; - - gpio_pad_group0: pad-group { - compatible = "nordic,nrf-gpio-pad-group"; - retain-mask = <0xFFF>; - zephyr,pm-device-runtime-auto; - status = "disabled"; - }; }; gpio1: gpio@938200 { @@ -927,13 +920,6 @@ ngpios = <12>; port = <1>; zephyr,pm-device-runtime-auto; - - gpio_pad_group1: pad-group { - compatible = "nordic,nrf-gpio-pad-group"; - retain-mask = <0xFFF>; - zephyr,pm-device-runtime-auto; - status = "disabled"; - }; }; gpio2: gpio@938400 { @@ -946,13 +932,6 @@ ngpios = <12>; port = <2>; zephyr,pm-device-runtime-auto; - - gpio_pad_group2: pad-group { - compatible = "nordic,nrf-gpio-pad-group"; - retain-mask = <0xFFF>; - zephyr,pm-device-runtime-auto; - status = "disabled"; - }; }; gpio6: gpio@938c00 { @@ -964,13 +943,6 @@ ngpios = <14>; port = <6>; zephyr,pm-device-runtime-auto; - - gpio_pad_group6: pad-group { - compatible = "nordic,nrf-gpio-pad-group"; - retain-mask = <0x3FFF>; - zephyr,pm-device-runtime-auto; - status = "disabled"; - }; }; gpio7: gpio@938e00 { @@ -982,13 +954,6 @@ ngpios = <8>; port = <7>; zephyr,pm-device-runtime-auto; - - gpio_pad_group7: pad-group { - compatible = "nordic,nrf-gpio-pad-group"; - retain-mask = <0xFF>; - zephyr,pm-device-runtime-auto; - status = "disabled"; - }; }; gpio9: gpio@939200 { @@ -1001,13 +966,6 @@ ngpios = <6>; port = <9>; zephyr,pm-device-runtime-auto; - - gpio_pad_group9: pad-group { - compatible = "nordic,nrf-gpio-pad-group"; - retain-mask = <0x3F>; - zephyr,pm-device-runtime-auto; - status = "disabled"; - }; }; dppic131: dppic@981000 { From 2d087fba5465d1ab7c31e54f8d91e053621b9f79 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Mon, 13 Oct 2025 11:07:45 +0200 Subject: [PATCH 1914/2141] [nrf fromlist] drivers: pinctrl: nrf: simplify pin retention GPIO pad power domain management is not neccesary if the quirky cross domain feature is handled at the application level. Replace it with directly setting/clearing pin retention, as hardware will force power domains on automatically. Upstream PR #: 97452 Signed-off-by: Bjarki Arge Andreasen --- drivers/pinctrl/pinctrl_nrf.c | 73 +++++------------------------------ 1 file changed, 10 insertions(+), 63 deletions(-) diff --git a/drivers/pinctrl/pinctrl_nrf.c b/drivers/pinctrl/pinctrl_nrf.c index 3d59ba7998bb..465fe9961f73 100644 --- a/drivers/pinctrl/pinctrl_nrf.c +++ b/drivers/pinctrl/pinctrl_nrf.c @@ -5,7 +5,6 @@ */ #include -#include #include #include @@ -111,75 +110,23 @@ static const nrf_gpio_pin_drive_t drive_modes[NRF_DRIVE_COUNT] = { #define NRF_PSEL_TDM(reg, line) ((NRF_TDM_Type *)reg)->PSEL.line #endif -#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_gpio_pad_group) -#define GPIO_HAS_PAD_GROUP 1 -#else -#define GPIO_HAS_PAD_GROUP 0 -#endif - -#if GPIO_HAS_PAD_GROUP - -#define GPIO_PAD_GROUP_GET_OR_NULL(idx, _) \ - DEVICE_DT_GET_OR_NULL(DT_NODELABEL(_CONCAT(gpio_pad_group, idx))) - -static const struct device *const pad_groups[] = { - LISTIFY(10, GPIO_PAD_GROUP_GET_OR_NULL, (,)) -}; - -static atomic_t pad_group_masks[ARRAY_SIZE(pad_groups)]; - -static int pad_group_request_pin(uint16_t pin_number) -{ - uint8_t port_number = NRF_GET_PORT(pin_number); - uint8_t port_pin_number = NRF_GET_PORT_PIN(pin_number); - const struct device *pad_group = pad_groups[port_number]; - atomic_t *pad_group_mask = &pad_group_masks[port_number]; - - if (atomic_test_and_set_bit(pad_group_mask, port_pin_number)) { - /* already requested */ - return 0; - } - - if (pm_device_runtime_get(pad_group)) { - atomic_clear_bit(pad_group_mask, port_pin_number); - return -EIO; - } - - return 0; -} +#if NRF_GPIO_HAS_RETENTION_SETCLEAR -static int pad_group_release_pin(uint16_t pin_number) +static void port_pin_retain_set(uint16_t pin_number, bool enable) { - uint8_t port_number = NRF_GET_PORT(pin_number); - uint8_t port_pin_number = NRF_GET_PORT_PIN(pin_number); - const struct device *pad_group = pad_groups[port_number]; - atomic_t *pad_group_mask = &pad_group_masks[port_number]; - - if (!atomic_test_and_clear_bit(pad_group_mask, port_pin_number)) { - /* already released */ - return 0; - } - - if (pm_device_runtime_put(pad_group)) { - atomic_set_bit(pad_group_mask, port_pin_number); - return -EIO; + if (enable) { + nrf_gpio_pin_retain_enable(pin_number); + } else { + nrf_gpio_pin_retain_disable(pin_number); } - - return 0; } #else -static int pad_group_request_pin(uint16_t pin_number) +static void port_pin_retain_set(uint16_t pin_number, bool enable) { ARG_UNUSED(pin_number); - return 0; -} - -static int pad_group_release_pin(uint16_t pin_number) -{ - ARG_UNUSED(pin_number); - return 0; + ARG_UNUSED(enable); } #endif @@ -610,7 +557,7 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, uint32_t pin = psel; /* enable pin */ - pad_group_request_pin(pin); + port_pin_retain_set(pin, false); if (write != NO_WRITE) { nrf_gpio_pin_write(pin, write); @@ -628,7 +575,7 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, if (NRF_GET_LP(pins[i]) == NRF_LP_ENABLE) { /* disable pin and pin clock */ - pad_group_release_pin(pin); + port_pin_retain_set(pin, true); port_pin_clock_set(pin, false); } else { /* configure pin clock */ From e354c7571de49edc2877ccdcd257539d470ebcc7 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Mon, 13 Oct 2025 11:41:56 +0200 Subject: [PATCH 1915/2141] [nrf fromlist] drivers: gpio: remove pad group integration Replace the pad group integration with directly setting/clearing pin retention for output pins if required, since the pad group integration is redundant if the quirky cross domain feature is managed by the application. Upstream PR #: 97452 Signed-off-by: Bjarki Arge Andreasen --- drivers/gpio/gpio_nrfx.c | 138 +++++++++++++-------------------------- 1 file changed, 46 insertions(+), 92 deletions(-) diff --git a/drivers/gpio/gpio_nrfx.c b/drivers/gpio/gpio_nrfx.c index 6ccb378e161d..fcf0b2f8d27c 100644 --- a/drivers/gpio/gpio_nrfx.c +++ b/drivers/gpio/gpio_nrfx.c @@ -12,16 +12,9 @@ #include #include #include -#include #include -#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_gpio_pad_group) -#define GPIO_HAS_PAD_GROUP 1 -#else -#define GPIO_HAS_PAD_GROUP 0 -#endif - #define GPIOTE_PHANDLE(id) DT_INST_PHANDLE(id, gpiote_instance) #define GPIOTE_PROP(idx, prop) DT_PROP(GPIOTE(idx), prop) @@ -55,9 +48,6 @@ struct gpio_nrfx_cfg { uint32_t edge_sense; uint8_t port_num; nrfx_gpiote_t gpiote; -#if GPIO_HAS_PAD_GROUP - const struct device *pad_group; -#endif #if defined(GPIOTE_FEATURE_FLAG) uint32_t flags; #endif @@ -78,6 +68,34 @@ static bool has_gpiote(const struct gpio_nrfx_cfg *cfg) return cfg->gpiote.p_reg != NULL; } +#if NRF_GPIO_HAS_RETENTION_SETCLEAR + +static void port_retain_set(const struct gpio_nrfx_cfg *cfg, uint32_t mask) +{ + nrf_gpio_port_retain_enable(cfg->port, mask); +} + +static void port_retain_clear(const struct gpio_nrfx_cfg *cfg, uint32_t mask) +{ + nrf_gpio_port_retain_disable(cfg->port, mask); +} + +#else + +static void port_retain_set(const struct gpio_nrfx_cfg *cfg, uint32_t mask) +{ + ARG_UNUSED(cfg); + ARG_UNUSED(mask); +} + +static void port_retain_clear(const struct gpio_nrfx_cfg *cfg, uint32_t mask) +{ + ARG_UNUSED(cfg); + ARG_UNUSED(mask); +} + +#endif + static nrf_gpio_pin_pull_t get_pull(gpio_flags_t flags) { if (flags & GPIO_PULL_UP) { @@ -100,7 +118,6 @@ static int gpio_nrfx_pin_configure(const struct device *port, gpio_pin_t pin, nrfx_gpiote_pin_t abs_pin = NRF_GPIO_PIN_MAP(cfg->port_num, pin); nrf_gpio_pin_pull_t pull = get_pull(flags); nrf_gpio_pin_drive_t drive; - int pm_ret; switch (flags & (NRF_GPIO_DRIVE_MSK | GPIO_OPEN_DRAIN)) { case NRF_GPIO_DRIVE_S0S1: @@ -131,10 +148,7 @@ static int gpio_nrfx_pin_configure(const struct device *port, gpio_pin_t pin, return -EINVAL; } - ret = pm_device_runtime_get(port); - if (ret < 0) { - return ret; - } + port_retain_clear(cfg, BIT(pin)); if (flags & GPIO_OUTPUT_INIT_HIGH) { nrf_gpio_port_out_set(cfg->port, BIT(pin)); @@ -196,6 +210,8 @@ static int gpio_nrfx_pin_configure(const struct device *port, gpio_pin_t pin, err = nrfx_gpiote_output_configure(&cfg->gpiote, abs_pin, &output_config, NULL); + + port_retain_set(cfg, BIT(pin)); } else { nrfx_gpiote_input_pin_config_t input_pin_config = { .p_pull_config = &pull, @@ -223,9 +239,7 @@ static int gpio_nrfx_pin_configure(const struct device *port, gpio_pin_t pin, } end: - pm_ret = pm_device_runtime_put(port); - - return (ret != 0) ? ret : pm_ret; + return ret; } #ifdef CONFIG_GPIO_GET_CONFIG @@ -315,49 +329,37 @@ static int gpio_nrfx_port_set_masked_raw(const struct device *port, gpio_port_value_t value) { NRF_GPIO_Type *reg = get_port_cfg(port)->port; - int ret; const uint32_t set_mask = value & mask; const uint32_t clear_mask = (~set_mask) & mask; - ret = pm_device_runtime_get(port); - if (ret < 0) { - return ret; - } - + port_retain_clear(get_port_cfg(port), mask); nrf_gpio_port_out_set(reg, set_mask); nrf_gpio_port_out_clear(reg, clear_mask); - return pm_device_runtime_put(port); + port_retain_set(get_port_cfg(port), mask); + return 0; } static int gpio_nrfx_port_set_bits_raw(const struct device *port, gpio_port_pins_t mask) { NRF_GPIO_Type *reg = get_port_cfg(port)->port; - int ret; - - ret = pm_device_runtime_get(port); - if (ret < 0) { - return ret; - } + port_retain_clear(get_port_cfg(port), mask); nrf_gpio_port_out_set(reg, mask); - return pm_device_runtime_put(port); + port_retain_set(get_port_cfg(port), mask); + return 0; } static int gpio_nrfx_port_clear_bits_raw(const struct device *port, gpio_port_pins_t mask) { NRF_GPIO_Type *reg = get_port_cfg(port)->port; - int ret; - - ret = pm_device_runtime_get(port); - if (ret < 0) { - return ret; - } + port_retain_clear(get_port_cfg(port), mask); nrf_gpio_port_out_clear(reg, mask); - return pm_device_runtime_put(port); + port_retain_set(get_port_cfg(port), mask); + return 0; } static int gpio_nrfx_port_toggle_bits(const struct device *port, @@ -367,16 +369,12 @@ static int gpio_nrfx_port_toggle_bits(const struct device *port, const uint32_t value = nrf_gpio_port_out_read(reg) ^ mask; const uint32_t set_mask = value & mask; const uint32_t clear_mask = (~value) & mask; - int ret; - - ret = pm_device_runtime_get(port); - if (ret < 0) { - return ret; - } + port_retain_clear(get_port_cfg(port), mask); nrf_gpio_port_out_set(reg, set_mask); nrf_gpio_port_out_clear(reg, clear_mask); - return pm_device_runtime_put(port); + port_retain_set(get_port_cfg(port), mask); + return 0; } #ifdef CONFIG_GPIO_NRFX_INTERRUPT @@ -580,47 +578,11 @@ static void nrfx_gpio_handler(nrfx_gpiote_pin_t abs_pin, IRQ_CONNECT(DT_IRQN(node_id), DT_IRQ(node_id, priority), nrfx_isr, \ NRFX_CONCAT(nrfx_gpiote_, DT_PROP(node_id, instance), _irq_handler), 0); -static int gpio_nrfx_pm_suspend(const struct device *port) +static int gpio_nrfx_pm_hook(const struct device *port, enum pm_device_action action) { -#if GPIO_HAS_PAD_GROUP - const struct gpio_nrfx_cfg *cfg = get_port_cfg(port); - - return pm_device_runtime_put(cfg->pad_group); -#else ARG_UNUSED(port); + ARG_UNUSED(action); return 0; -#endif -} - -static int gpio_nrfx_pm_resume(const struct device *port) -{ -#if GPIO_HAS_PAD_GROUP - const struct gpio_nrfx_cfg *cfg = get_port_cfg(port); - - return pm_device_runtime_get(cfg->pad_group); -#else - ARG_UNUSED(port); - return 0; -#endif -} - -static int gpio_nrfx_pm_hook(const struct device *port, enum pm_device_action action) -{ - int ret; - - switch (action) { - case PM_DEVICE_ACTION_SUSPEND: - ret = gpio_nrfx_pm_suspend(port); - break; - case PM_DEVICE_ACTION_RESUME: - ret = gpio_nrfx_pm_resume(port); - break; - default: - ret = -ENOTSUP; - break; - } - - return ret; } static int gpio_nrfx_init(const struct device *port) @@ -687,13 +649,6 @@ static DEVICE_API(gpio, gpio_nrfx_drv_api_funcs) = { "Please enable GPIOTE instance for used GPIO port!")), \ ()) -#if GPIO_HAS_PAD_GROUP -#define GPIO_NRF_PAD_GROUP_INIT(id) \ - .pad_group = DEVICE_DT_GET(DT_INST_CHILD(id, pad_group)), -#else -#define GPIO_NRF_PAD_GROUP_INIT(id) -#endif - #define GPIO_NRF_DEVICE(id) \ GPIOTE_CHECK(id); \ static const struct gpio_nrfx_cfg gpio_nrfx_p##id##_cfg = { \ @@ -705,7 +660,6 @@ static DEVICE_API(gpio, gpio_nrfx_drv_api_funcs) = { .port_num = DT_INST_PROP(id, port), \ .edge_sense = DT_INST_PROP_OR(id, sense_edge_mask, 0), \ .gpiote = GPIOTE_INSTANCE(id), \ - GPIO_NRF_PAD_GROUP_INIT(id) \ IF_ENABLED(GPIOTE_FEATURE_FLAG, \ (.flags = \ (DT_PROP_OR(GPIOTE_PHANDLE(id), no_port_event, 0) ? \ From 87760ddf8b4ef5f76a0ebcb59d2944474afffecc Mon Sep 17 00:00:00 2001 From: Jakub Zymelka Date: Thu, 28 Aug 2025 12:04:57 +0200 Subject: [PATCH 1916/2141] [nrf fromtree] drivers comparator: nordic: Align drivers to changed analog input types External analog input types changed from `string` to `int`. Signed-off-by: Jakub Zymelka (cherry picked from commit e5ecbd2112d01bd0970ed6a3298fef9b95447ed2) --- drivers/comparator/comparator_nrf_comp.c | 131 +++++++++--------- drivers/comparator/comparator_nrf_lpcomp.c | 54 +++++--- include/zephyr/drivers/comparator/nrf_comp.h | 61 ++------ .../zephyr/drivers/comparator/nrf_lpcomp.h | 37 +---- 4 files changed, 108 insertions(+), 175 deletions(-) diff --git a/drivers/comparator/comparator_nrf_comp.c b/drivers/comparator/comparator_nrf_comp.c index 311a864303bf..6c5acdf5c080 100644 --- a/drivers/comparator/comparator_nrf_comp.c +++ b/drivers/comparator/comparator_nrf_comp.c @@ -19,8 +19,7 @@ #define SHIM_NRF_COMP_DT_INST_REFSEL_IS_AREF(inst) \ DT_INST_ENUM_HAS_VALUE(inst, refsel, aref) -#define SHIM_NRF_COMP_DT_INST_EXTREFSEL(inst) \ - _CONCAT(COMP_NRF_COMP_EXTREFSEL_, DT_INST_STRING_TOKEN(inst, extrefsel)) +#define SHIM_NRF_COMP_DT_INST_EXTREFSEL(inst) DT_INST_PROP(inst, extrefsel) #define SHIM_NRF_COMP_DT_INST_MAIN_MODE_IS_SE(inst) \ DT_INST_ENUM_HAS_VALUE(inst, main_mode, se) @@ -43,8 +42,7 @@ #define SHIM_NRF_COMP_DT_INST_ISOURCE(inst) \ _CONCAT(COMP_NRF_COMP_ISOURCE_, DT_INST_STRING_TOKEN(inst, isource)) -#define SHIM_NRF_COMP_DT_INST_PSEL(inst) \ - _CONCAT(COMP_NRF_COMP_PSEL_, DT_INST_STRING_TOKEN(inst, psel)) +#define SHIM_NRF_COMP_DT_INST_PSEL(inst) DT_INST_PROP(inst, psel) #if defined(COMP_HYST_HYST_Hyst40mV) #define NRF_COMP_HYST_ENABLED NRF_COMP_HYST_40MV @@ -73,35 +71,50 @@ BUILD_ASSERT(SHIM_NRF_COMP_DT_INST_TH_DOWN(0) < 64); BUILD_ASSERT(SHIM_NRF_COMP_DT_INST_TH_UP(0) < 64); #endif -#if NRF_COMP_HAS_AIN_AS_PIN -BUILD_ASSERT((COMP_NRF_COMP_PSEL_AIN0 == 0)); -BUILD_ASSERT((COMP_NRF_COMP_PSEL_AIN7 == 7)); -BUILD_ASSERT((COMP_NRF_COMP_EXTREFSEL_AIN0 == 0)); -BUILD_ASSERT((COMP_NRF_COMP_EXTREFSEL_AIN7 == 7)); +#if (NRF_COMP_HAS_AIN_AS_PIN) +BUILD_ASSERT(NRF_COMP_AIN0 == 0); +BUILD_ASSERT(NRF_COMP_AIN7 == 7); #else -#ifndef COMP_PSEL_PSEL_AnalogInput4 -BUILD_ASSERT(SHIM_NRF_COMP_DT_INST_PSEL(0) != COMP_NRF_COMP_PSEL_AIN4); +BUILD_ASSERT((NRF_COMP_AIN0 == NRF_COMP_INPUT_0) && + (NRF_COMP_AIN1 == NRF_COMP_INPUT_1) && + (NRF_COMP_AIN2 == NRF_COMP_INPUT_2) && + (NRF_COMP_AIN3 == NRF_COMP_INPUT_3) && +#if defined(COMP_PSEL_PSEL_AnalogInput4) + (NRF_COMP_AIN4 == NRF_COMP_INPUT_4) && #endif - -#ifndef COMP_PSEL_PSEL_AnalogInput5 -BUILD_ASSERT(SHIM_NRF_COMP_DT_INST_PSEL(0) != COMP_NRF_COMP_PSEL_AIN5); +#if defined(COMP_PSEL_PSEL_AnalogInput5) + (NRF_COMP_AIN5 == NRF_COMP_INPUT_5) && #endif - -#ifndef COMP_PSEL_PSEL_AnalogInput6 -BUILD_ASSERT(SHIM_NRF_COMP_DT_INST_PSEL(0) != COMP_NRF_COMP_PSEL_AIN6); +#if defined(COMP_PSEL_PSEL_AnalogInput6) + (NRF_COMP_AIN6 == NRF_COMP_INPUT_6) && #endif - -#ifndef COMP_PSEL_PSEL_AnalogInput7 -BUILD_ASSERT(SHIM_NRF_COMP_DT_INST_PSEL(0) != COMP_NRF_COMP_PSEL_AIN7); +#if defined(COMP_PSEL_PSEL_AnalogInput7) + (NRF_COMP_AIN7 == NRF_COMP_INPUT_7) && #endif + (NRF_COMP_AIN0 == NRF_COMP_EXT_REF_0) && + (NRF_COMP_AIN1 == NRF_COMP_EXT_REF_1) && + (NRF_COMP_AIN2 == NRF_COMP_EXT_REF_2) && + (NRF_COMP_AIN3 == NRF_COMP_EXT_REF_3) && +#if defined(COMP_EXTREFSEL_EXTREFSEL_AnalogReference4) + (NRF_COMP_AIN4 == NRF_COMP_EXT_REF_4) && #endif - -#ifndef COMP_PSEL_PSEL_VddDiv2 -BUILD_ASSERT(SHIM_NRF_COMP_DT_INST_PSEL(0) != COMP_NRF_COMP_PSEL_VDD_DIV2); +#if defined(COMP_EXTREFSEL_EXTREFSEL_AnalogReference5) + (NRF_COMP_AIN5 == NRF_COMP_EXT_REF_5) && #endif - -#ifndef COMP_PSEL_PSEL_VddhDiv5 -BUILD_ASSERT(SHIM_NRF_COMP_DT_INST_PSEL(0) != COMP_NRF_COMP_PSEL_VDDH_DIV5); +#if defined(COMP_EXTREFSEL_EXTREFSEL_AnalogReference6) + (NRF_COMP_AIN6 == NRF_COMP_EXT_REF_6) && +#endif +#if defined(COMP_EXTREFSEL_EXTREFSEL_AnalogReference7) + (NRF_COMP_AIN7 == NRF_COMP_EXT_REF_7) && +#endif +#if defined(COMP_PSEL_PSEL_VddDiv2) + (NRF_COMP_VDD_DIV2 == NRF_COMP_VDD_DIV2) && +#endif +#if defined(COMP_PSEL_PSEL_VddhDiv5) + (NRF_COMP_VDDH_DIV5 == NRF_COMP_VDDH_DIV5) && +#endif + 1, + "Definitions from nrf-comp.h do not match those from HAL"); #endif #ifndef COMP_MODE_SP_Normal @@ -122,24 +135,6 @@ BUILD_ASSERT(SHIM_NRF_COMP_DT_INST_ISOURCE(0) != COMP_NRF_COMP_ISOURCE_10UA); #endif #endif -#if SHIM_NRF_COMP_DT_INST_REFSEL_IS_AREF(0) -#ifndef COMP_EXTREFSEL_EXTREFSEL_AnalogReference4 -BUILD_ASSERT(SHIM_NRF_COMP_DT_INST_EXTREFSEL(0) != COMP_NRF_COMP_EXTREFSEL_AIN4); -#endif - -#ifndef COMP_EXTREFSEL_EXTREFSEL_AnalogReference5 -BUILD_ASSERT(SHIM_NRF_COMP_DT_INST_EXTREFSEL(0) != COMP_NRF_COMP_EXTREFSEL_AIN5); -#endif - -#ifndef COMP_EXTREFSEL_EXTREFSEL_AnalogReference6 -BUILD_ASSERT(SHIM_NRF_COMP_DT_INST_EXTREFSEL(0) != COMP_NRF_COMP_EXTREFSEL_AIN6); -#endif - -#ifndef COMP_EXTREFSEL_EXTREFSEL_AnalogReference7 -BUILD_ASSERT(SHIM_NRF_COMP_DT_INST_EXTREFSEL(0) != COMP_NRF_COMP_EXTREFSEL_AIN7); -#endif -#endif - #if SHIM_NRF_COMP_DT_INST_MAIN_MODE_IS_SE(0) #ifndef COMP_REFSEL_REFSEL_Int1V8 BUILD_ASSERT(SHIM_NRF_COMP_DT_INST_REFSEL(0) != COMP_NRF_COMP_REFSEL_INT_1V8); @@ -246,69 +241,69 @@ static int shim_nrf_comp_pm_callback(const struct device *dev, enum pm_device_ac } #if (NRF_COMP_HAS_AIN_AS_PIN) -static int shim_nrf_comp_psel_to_nrf(enum comp_nrf_comp_psel shim, +static int shim_nrf_comp_psel_to_nrf(uint8_t shim, nrf_comp_input_t *nrf) { if (shim >= ARRAY_SIZE(shim_nrf_comp_ain_map)) { return -EINVAL; } - *nrf = shim_nrf_comp_ain_map[(uint32_t)shim]; + *nrf = shim_nrf_comp_ain_map[shim]; return 0; } #else -static int shim_nrf_comp_psel_to_nrf(enum comp_nrf_comp_psel shim, +static int shim_nrf_comp_psel_to_nrf(uint8_t shim, nrf_comp_input_t *nrf) { switch (shim) { - case COMP_NRF_COMP_PSEL_AIN0: + case NRF_COMP_AIN0: *nrf = NRF_COMP_INPUT_0; break; - case COMP_NRF_COMP_PSEL_AIN1: + case NRF_COMP_AIN1: *nrf = NRF_COMP_INPUT_1; break; - case COMP_NRF_COMP_PSEL_AIN2: + case NRF_COMP_AIN2: *nrf = NRF_COMP_INPUT_2; break; - case COMP_NRF_COMP_PSEL_AIN3: + case NRF_COMP_AIN3: *nrf = NRF_COMP_INPUT_3; break; #if defined(COMP_PSEL_PSEL_AnalogInput4) - case COMP_NRF_COMP_PSEL_AIN4: + case NRF_COMP_AIN4: *nrf = NRF_COMP_INPUT_4; break; #endif #if defined(COMP_PSEL_PSEL_AnalogInput5) - case COMP_NRF_COMP_PSEL_AIN5: + case NRF_COMP_AIN5: *nrf = NRF_COMP_INPUT_5; break; #endif #if defined(COMP_PSEL_PSEL_AnalogInput6) - case COMP_NRF_COMP_PSEL_AIN6: + case NRF_COMP_AIN6: *nrf = NRF_COMP_INPUT_6; break; #endif #if defined(COMP_PSEL_PSEL_AnalogInput7) - case COMP_NRF_COMP_PSEL_AIN7: + case NRF_COMP_AIN7: *nrf = NRF_COMP_INPUT_7; break; #endif #if defined(COMP_PSEL_PSEL_VddDiv2) - case COMP_NRF_COMP_PSEL_VDD_DIV2: + case NRF_COMP_AIN_VDD_DIV2: *nrf = NRF_COMP_VDD_DIV2; break; #endif #if defined(COMP_PSEL_PSEL_VddhDiv5) - case COMP_NRF_COMP_PSEL_VDDH_DIV5: + case NRF_COMP_AIN_VDDH_DIV5: *nrf = NRF_COMP_VDDH_DIV5; break; #endif @@ -382,57 +377,57 @@ static int shim_nrf_comp_isource_to_nrf(enum comp_nrf_comp_isource shim, #endif #if (NRF_COMP_HAS_AIN_AS_PIN) -static int shim_nrf_comp_extrefsel_to_nrf(enum comp_nrf_comp_extrefsel shim, +static int shim_nrf_comp_extrefsel_to_nrf(uint8_t shim, nrf_comp_ext_ref_t *nrf) { if (shim >= ARRAY_SIZE(shim_nrf_comp_ain_map)) { return -EINVAL; } - *nrf = shim_nrf_comp_ain_map[(uint32_t)shim]; + *nrf = shim_nrf_comp_ain_map[shim]; return 0; } #else -static int shim_nrf_comp_extrefsel_to_nrf(enum comp_nrf_comp_extrefsel shim, +static int shim_nrf_comp_extrefsel_to_nrf(uint8_t shim, nrf_comp_ext_ref_t *nrf) { switch (shim) { - case COMP_NRF_COMP_EXTREFSEL_AIN0: + case NRF_COMP_AIN0: *nrf = NRF_COMP_EXT_REF_0; break; - case COMP_NRF_COMP_EXTREFSEL_AIN1: + case NRF_COMP_AIN1: *nrf = NRF_COMP_EXT_REF_1; break; - case COMP_NRF_COMP_EXTREFSEL_AIN2: + case NRF_COMP_AIN2: *nrf = NRF_COMP_EXT_REF_2; break; - case COMP_NRF_COMP_EXTREFSEL_AIN3: + case NRF_COMP_AIN3: *nrf = NRF_COMP_EXT_REF_3; break; #if defined(COMP_EXTREFSEL_EXTREFSEL_AnalogReference4) - case COMP_NRF_COMP_EXTREFSEL_AIN4: + case NRF_COMP_AIN4: *nrf = NRF_COMP_EXT_REF_4; break; #endif #if defined(COMP_EXTREFSEL_EXTREFSEL_AnalogReference5) - case COMP_NRF_COMP_EXTREFSEL_AIN5: + case NRF_COMP_AIN5: *nrf = NRF_COMP_EXT_REF_5; break; #endif #if defined(COMP_EXTREFSEL_EXTREFSEL_AnalogReference6) - case COMP_NRF_COMP_EXTREFSEL_AIN6: + case NRF_COMP_AIN6: *nrf = NRF_COMP_EXT_REF_6; break; #endif #if defined(COMP_EXTREFSEL_EXTREFSEL_AnalogReference7) - case COMP_NRF_COMP_EXTREFSEL_AIN7: + case NRF_COMP_AIN7: *nrf = NRF_COMP_EXT_REF_7; break; #endif diff --git a/drivers/comparator/comparator_nrf_lpcomp.c b/drivers/comparator/comparator_nrf_lpcomp.c index 623c7adacd42..6faba2b8669c 100644 --- a/drivers/comparator/comparator_nrf_lpcomp.c +++ b/drivers/comparator/comparator_nrf_lpcomp.c @@ -21,14 +21,12 @@ #define SHIM_NRF_LPCOMP_DT_INST_REFSEL_IS_AREF(inst) \ DT_INST_ENUM_HAS_VALUE(inst, refsel, aref) -#define SHIM_NRF_LPCOMP_DT_INST_EXTREFSEL(inst) \ - _CONCAT(COMP_NRF_LPCOMP_EXTREFSEL_, DT_INST_STRING_TOKEN(inst, extrefsel)) +#define SHIM_NRF_LPCOMP_DT_INST_EXTREFSEL(inst) DT_INST_PROP(inst, extrefsel) #define SHIM_NRF_LPCOMP_DT_INST_ENABLE_HYST(inst) \ DT_INST_PROP(inst, enable_hyst) -#define SHIM_NRF_LPCOMP_DT_INST_PSEL(inst) \ - _CONCAT(COMP_NRF_LPCOMP_PSEL_, DT_INST_STRING_TOKEN(inst, psel)) +#define SHIM_NRF_LPCOMP_DT_INST_PSEL(inst) DT_INST_PROP(inst, psel) struct shim_nrf_lpcomp_data { nrfx_lpcomp_config_t config; @@ -40,10 +38,20 @@ struct shim_nrf_lpcomp_data { }; #if (NRF_LPCOMP_HAS_AIN_AS_PIN) -BUILD_ASSERT(COMP_NRF_LPCOMP_PSEL_AIN0 == 0); -BUILD_ASSERT(COMP_NRF_LPCOMP_PSEL_AIN7 == 7); -BUILD_ASSERT(COMP_NRF_LPCOMP_EXTREFSEL_AIN0 == 0); -BUILD_ASSERT(COMP_NRF_LPCOMP_EXTREFSEL_AIN1 == 1); +BUILD_ASSERT(NRF_COMP_AIN0 == 0); +BUILD_ASSERT(NRF_COMP_AIN7 == 7); +#else +BUILD_ASSERT((NRF_COMP_AIN0 == NRF_LPCOMP_INPUT_0) && + (NRF_COMP_AIN1 == NRF_LPCOMP_INPUT_1) && + (NRF_COMP_AIN2 == NRF_LPCOMP_INPUT_2) && + (NRF_COMP_AIN3 == NRF_LPCOMP_INPUT_3) && + (NRF_COMP_AIN4 == NRF_LPCOMP_INPUT_4) && + (NRF_COMP_AIN5 == NRF_LPCOMP_INPUT_5) && + (NRF_COMP_AIN6 == NRF_LPCOMP_INPUT_6) && + (NRF_COMP_AIN7 == NRF_LPCOMP_INPUT_7) && + (NRF_COMP_AIN0 == NRF_LPCOMP_EXT_REF_REF0) && + (NRF_COMP_AIN1 == NRF_LPCOMP_EXT_REF_REF1), + "Definitions from nrf-comp.h do not match those from HAL"); #endif #if (LPCOMP_REFSEL_RESOLUTION == 8) @@ -126,50 +134,50 @@ static int shim_nrf_lpcomp_pm_callback(const struct device *dev, enum pm_device_ } #if (NRF_LPCOMP_HAS_AIN_AS_PIN) -static int shim_nrf_lpcomp_psel_to_nrf(enum comp_nrf_lpcomp_psel shim, +static int shim_nrf_lpcomp_psel_to_nrf(uint8_t shim, nrf_lpcomp_input_t *nrf) { if (shim >= ARRAY_SIZE(shim_nrf_comp_ain_map)) { return -EINVAL; } - *nrf = shim_nrf_comp_ain_map[(uint32_t)shim]; + *nrf = shim_nrf_comp_ain_map[shim]; return 0; } #else -static int shim_nrf_lpcomp_psel_to_nrf(enum comp_nrf_lpcomp_psel shim, +static int shim_nrf_lpcomp_psel_to_nrf(uint8_t shim, nrf_lpcomp_input_t *nrf) { switch (shim) { - case COMP_NRF_LPCOMP_PSEL_AIN0: + case NRF_COMP_AIN0: *nrf = NRF_LPCOMP_INPUT_0; break; - case COMP_NRF_LPCOMP_PSEL_AIN1: + case NRF_COMP_AIN1: *nrf = NRF_LPCOMP_INPUT_1; break; - case COMP_NRF_LPCOMP_PSEL_AIN2: + case NRF_COMP_AIN2: *nrf = NRF_LPCOMP_INPUT_2; break; - case COMP_NRF_LPCOMP_PSEL_AIN3: + case NRF_COMP_AIN3: *nrf = NRF_LPCOMP_INPUT_3; break; - case COMP_NRF_LPCOMP_PSEL_AIN4: + case NRF_COMP_AIN4: *nrf = NRF_LPCOMP_INPUT_4; break; - case COMP_NRF_LPCOMP_PSEL_AIN5: + case NRF_COMP_AIN5: *nrf = NRF_LPCOMP_INPUT_5; break; - case COMP_NRF_LPCOMP_PSEL_AIN6: + case NRF_COMP_AIN6: *nrf = NRF_LPCOMP_INPUT_6; break; - case COMP_NRF_LPCOMP_PSEL_AIN7: + case NRF_COMP_AIN7: *nrf = NRF_LPCOMP_INPUT_7; break; @@ -182,7 +190,7 @@ static int shim_nrf_lpcomp_psel_to_nrf(enum comp_nrf_lpcomp_psel shim, #endif #if (NRF_LPCOMP_HAS_AIN_AS_PIN) -static int shim_nrf_lpcomp_extrefsel_to_nrf(enum comp_nrf_lpcomp_extrefsel shim, +static int shim_nrf_lpcomp_extrefsel_to_nrf(uint8_t shim, nrf_lpcomp_ext_ref_t *nrf) { if (shim >= ARRAY_SIZE(shim_nrf_comp_ain_map)) { @@ -193,15 +201,15 @@ static int shim_nrf_lpcomp_extrefsel_to_nrf(enum comp_nrf_lpcomp_extrefsel shim, return 0; } #else -static int shim_nrf_lpcomp_extrefsel_to_nrf(enum comp_nrf_lpcomp_extrefsel shim, +static int shim_nrf_lpcomp_extrefsel_to_nrf(uint8_t shim, nrf_lpcomp_ext_ref_t *nrf) { switch (shim) { - case COMP_NRF_LPCOMP_EXTREFSEL_AIN0: + case NRF_COMP_AIN0: *nrf = NRF_LPCOMP_EXT_REF_REF0; break; - case COMP_NRF_LPCOMP_EXTREFSEL_AIN1: + case NRF_COMP_AIN1: *nrf = NRF_LPCOMP_EXT_REF_REF1; break; diff --git a/include/zephyr/drivers/comparator/nrf_comp.h b/include/zephyr/drivers/comparator/nrf_comp.h index 59e1cbbb3ce9..09c870f9a33c 100644 --- a/include/zephyr/drivers/comparator/nrf_comp.h +++ b/include/zephyr/drivers/comparator/nrf_comp.h @@ -7,56 +7,13 @@ #ifndef ZEPHYR_INCLUDE_DRIVERS_COMP_NRF_COMP_H_ #define ZEPHYR_INCLUDE_DRIVERS_COMP_NRF_COMP_H_ +#include #include #ifdef __cplusplus extern "C" { #endif -/** Positive input selection */ -enum comp_nrf_comp_psel { - /** AIN0 external input */ - COMP_NRF_COMP_PSEL_AIN0, - /** AIN1 external input */ - COMP_NRF_COMP_PSEL_AIN1, - /** AIN2 external input */ - COMP_NRF_COMP_PSEL_AIN2, - /** AIN3 external input */ - COMP_NRF_COMP_PSEL_AIN3, - /** AIN4 external input */ - COMP_NRF_COMP_PSEL_AIN4, - /** AIN5 external input */ - COMP_NRF_COMP_PSEL_AIN5, - /** AIN6 external input */ - COMP_NRF_COMP_PSEL_AIN6, - /** AIN7 external input */ - COMP_NRF_COMP_PSEL_AIN7, - /** VDD / 2 */ - COMP_NRF_COMP_PSEL_VDD_DIV2, - /** VDDH / 5 */ - COMP_NRF_COMP_PSEL_VDDH_DIV5, -}; - -/** External reference selection */ -enum comp_nrf_comp_extrefsel { - /** AIN0 external input */ - COMP_NRF_COMP_EXTREFSEL_AIN0, - /** AIN1 external input */ - COMP_NRF_COMP_EXTREFSEL_AIN1, - /** AIN2 external input */ - COMP_NRF_COMP_EXTREFSEL_AIN2, - /** AIN3 external input */ - COMP_NRF_COMP_EXTREFSEL_AIN3, - /** AIN4 external input */ - COMP_NRF_COMP_EXTREFSEL_AIN4, - /** AIN5 external input */ - COMP_NRF_COMP_EXTREFSEL_AIN5, - /** AIN6 external input */ - COMP_NRF_COMP_EXTREFSEL_AIN6, - /** AIN7 external input */ - COMP_NRF_COMP_EXTREFSEL_AIN7, -}; - /** Reference selection */ enum comp_nrf_comp_refsel { /** Internal 1.2V reference */ @@ -103,14 +60,14 @@ enum comp_nrf_comp_isource { * @note Hysteresis up in volts = ((th_up + 1) / 64) * ref */ struct comp_nrf_comp_se_config { - /** Positive input selection */ - enum comp_nrf_comp_psel psel; + /** Positive input selection defined by the NRF_COMP_AIN defines */ + uint8_t psel; /** Speed mode selection */ enum comp_nrf_comp_sp_mode sp_mode; /** Current source configuration */ enum comp_nrf_comp_isource isource; - /** External reference selection */ - enum comp_nrf_comp_extrefsel extrefsel; + /** External reference input selection defined by the NRF_COMP_AIN defines */ + uint8_t extrefsel; /** Reference selection */ enum comp_nrf_comp_refsel refsel; /** Hysteresis down threshold configuration */ @@ -133,14 +90,14 @@ int comp_nrf_comp_configure_se(const struct device *dev, /** Differential mode configuration structure */ struct comp_nrf_comp_diff_config { - /** Positive input selection */ - enum comp_nrf_comp_psel psel; + /** Positive input selection defined by the NRF_COMP_AIN defines */ + uint8_t psel; /** Speed mode selection */ enum comp_nrf_comp_sp_mode sp_mode; /** Current source configuration */ enum comp_nrf_comp_isource isource; - /** Negative input selection */ - enum comp_nrf_comp_extrefsel extrefsel; + /** Negative input selection defined by the NRF_COMP_AIN defines */ + uint8_t extrefsel; /** Hysteresis configuration */ bool enable_hyst; }; diff --git a/include/zephyr/drivers/comparator/nrf_lpcomp.h b/include/zephyr/drivers/comparator/nrf_lpcomp.h index e1f2343a8de8..1cae4caae330 100644 --- a/include/zephyr/drivers/comparator/nrf_lpcomp.h +++ b/include/zephyr/drivers/comparator/nrf_lpcomp.h @@ -7,40 +7,13 @@ #ifndef ZEPHYR_INCLUDE_DRIVERS_COMP_NRF_LPCOMP_H_ #define ZEPHYR_INCLUDE_DRIVERS_COMP_NRF_LPCOMP_H_ +#include #include #ifdef __cplusplus extern "C" { #endif -/** Positive input selection */ -enum comp_nrf_lpcomp_psel { - /** AIN0 external input */ - COMP_NRF_LPCOMP_PSEL_AIN0, - /** AIN1 external input */ - COMP_NRF_LPCOMP_PSEL_AIN1, - /** AIN2 external input */ - COMP_NRF_LPCOMP_PSEL_AIN2, - /** AIN3 external input */ - COMP_NRF_LPCOMP_PSEL_AIN3, - /** AIN4 external input */ - COMP_NRF_LPCOMP_PSEL_AIN4, - /** AIN5 external input */ - COMP_NRF_LPCOMP_PSEL_AIN5, - /** AIN6 external input */ - COMP_NRF_LPCOMP_PSEL_AIN6, - /** AIN7 external input */ - COMP_NRF_LPCOMP_PSEL_AIN7, -}; - -/** External reference selection */ -enum comp_nrf_lpcomp_extrefsel { - /** AIN0 external input */ - COMP_NRF_LPCOMP_EXTREFSEL_AIN0, - /** AIN1 external input */ - COMP_NRF_LPCOMP_EXTREFSEL_AIN1, -}; - /** Reference selection */ enum comp_nrf_lpcomp_refsel { /** Use (VDD * (1/8)) as reference */ @@ -83,10 +56,10 @@ enum comp_nrf_lpcomp_refsel { * @note extrefsel is only used if refsel == COMP_NRF_LPCOMP_REFSEL_AREF */ struct comp_nrf_lpcomp_config { - /** Positive input selection */ - enum comp_nrf_lpcomp_psel psel; - /** External reference selection */ - enum comp_nrf_lpcomp_extrefsel extrefsel; + /** Positive input selection defined by the NRF_COMP_AIN defines */ + uint8_t psel; + /** External reference input selection defined by the NRF_COMP_AIN defines */ + uint8_t extrefsel; /** Reference selection */ enum comp_nrf_lpcomp_refsel refsel; /** Hysteresis configuration */ From 9028c3899da2d53abca834dd1c6843a1d6aff567 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Tue, 14 Oct 2025 09:22:59 +0200 Subject: [PATCH 1917/2141] [nrf fromlist] drivers: nordic: support pin retention for AIN Devices which use AIN (COMP, LPCOMP, SAADC) don't use pinctrl to configure their pins, thus pinctrl can't manage pin retention like is done for other devices. Thus for now, add manually disabling pin retention to the drivers. In the future, we should probably use pinctrl for these inputs as well, at which point this commit can be reverted. Upstream PR #: 97452 Signed-off-by: Bjarki Arge Andreasen --- drivers/adc/adc_nrfx_saadc.c | 11 +++++++++++ drivers/comparator/comparator_nrf_comp.c | 6 ++++++ drivers/comparator/comparator_nrf_lpcomp.c | 6 ++++++ 3 files changed, 23 insertions(+) diff --git a/drivers/adc/adc_nrfx_saadc.c b/drivers/adc/adc_nrfx_saadc.c index 2c56e79f4897..32be9825d243 100644 --- a/drivers/adc/adc_nrfx_saadc.c +++ b/drivers/adc/adc_nrfx_saadc.c @@ -16,6 +16,7 @@ #include #include #include +#include LOG_MODULE_REGISTER(adc_nrfx_saadc, CONFIG_ADC_LOG_LEVEL); @@ -200,6 +201,10 @@ static int input_assign(nrf_saadc_input_t *pin_p, *pin_p = saadc_psels[channel_cfg->input_positive]; +#if NRF_GPIO_HAS_RETENTION_SETCLEAR + nrf_gpio_pin_retain_disable(saadc_psels[channel_cfg->input_positive]); +#endif + if (channel_cfg->differential) { if (channel_cfg->input_negative > ARRAY_SIZE(saadc_psels) || (IS_ENABLED(CONFIG_NRF_PLATFORM_HALTIUM) && @@ -212,6 +217,12 @@ static int input_assign(nrf_saadc_input_t *pin_p, *pin_n = channel_cfg->input_negative == NRF_SAADC_GND ? NRF_SAADC_INPUT_DISABLED : saadc_psels[channel_cfg->input_negative]; + +#if NRF_GPIO_HAS_RETENTION_SETCLEAR + if (channel_cfg->input_negative != NRF_SAADC_GND) { + nrf_gpio_pin_retain_disable(saadc_psels[channel_cfg->input_negative]); + } +#endif } else { *pin_n = NRF_SAADC_INPUT_DISABLED; } diff --git a/drivers/comparator/comparator_nrf_comp.c b/drivers/comparator/comparator_nrf_comp.c index 6c5acdf5c080..7178c51675d8 100644 --- a/drivers/comparator/comparator_nrf_comp.c +++ b/drivers/comparator/comparator_nrf_comp.c @@ -5,6 +5,7 @@ */ #include +#include #include #include @@ -249,6 +250,11 @@ static int shim_nrf_comp_psel_to_nrf(uint8_t shim, } *nrf = shim_nrf_comp_ain_map[shim]; + +#if NRF_GPIO_HAS_RETENTION_SETCLEAR + nrf_gpio_pin_retain_disable(shim_nrf_comp_ain_map[shim]); +#endif + return 0; } #else diff --git a/drivers/comparator/comparator_nrf_lpcomp.c b/drivers/comparator/comparator_nrf_lpcomp.c index 6faba2b8669c..dbd58d342360 100644 --- a/drivers/comparator/comparator_nrf_lpcomp.c +++ b/drivers/comparator/comparator_nrf_lpcomp.c @@ -5,6 +5,7 @@ */ #include +#include #include #include @@ -142,6 +143,11 @@ static int shim_nrf_lpcomp_psel_to_nrf(uint8_t shim, } *nrf = shim_nrf_comp_ain_map[shim]; + +#if NRF_GPIO_HAS_RETENTION_SETCLEAR + nrf_gpio_pin_retain_disable(shim_nrf_comp_ain_map[shim]); +#endif + return 0; } #else From c01ccc5d445348011a362116533b8c53319f2941 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Tue, 14 Oct 2025 14:37:17 +0200 Subject: [PATCH 1918/2141] [nrf fromlist] dts: drivers: nordic: nrf54h: Don't manage clocks from drivers Clocks are requested automatically by hardware on the nRF54H. Remove additional handling from device drivers, and disable the now unmanaged clocks in the devicetree. Updates: - can_nrf - counter_nrfx_timer - uart_nrfx_uarte - spi_nrfx_spim - spi_nrfx_spis Upstream PR #: 97452 Signed-off-by: Bjarki Arge Andreasen --- drivers/can/can_nrf.c | 28 +-- drivers/counter/counter_nrfx_timer.c | 64 +------ drivers/pwm/pwm_nrfx.c | 109 +----------- drivers/serial/Kconfig.nrfx | 7 - drivers/serial/uart_nrfx_uarte.c | 163 ++---------------- drivers/spi/spi_nrfx_spim.c | 108 +----------- drivers/spi/spi_nrfx_spis.c | 38 +--- dts/arm/nordic/nrf54h20_cpuapp.dtsi | 12 -- dts/arm/nordic/nrf54h20_cpurad.dtsi | 12 -- .../configs/cpuapp_hsfll.overlay | 4 + .../clock_control/configs/fll16m.overlay | 4 + .../configs/global_hsfll.overlay | 4 + .../clock_control/configs/lfclk.overlay | 4 + .../clock_control/configs/uart135.overlay | 4 + .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 21 +++ .../boards/nrf54h20dk_nrf54h20_cpuapp.conf | 1 - 16 files changed, 65 insertions(+), 518 deletions(-) create mode 100644 tests/drivers/clock_control/nrf_clock_control/boards/nrf54h20dk_nrf54h20_cpuapp.overlay diff --git a/drivers/can/can_nrf.c b/drivers/can/can_nrf.c index 8e19b5420356..38021d764b17 100644 --- a/drivers/can/can_nrf.c +++ b/drivers/can/can_nrf.c @@ -29,7 +29,6 @@ struct can_nrf_config { uint32_t mrba; uint32_t mram; const struct device *auxpll; - const struct device *hsfll; const struct pinctrl_dev_config *pcfg; void (*irq_configure)(void); uint16_t irq; @@ -133,40 +132,16 @@ static const struct can_mcan_ops can_mcan_nrf_ops = { .clear_mram = can_nrf_clear_mram, }; -static int configure_hsfll(const struct device *dev, bool on) -{ - const struct can_mcan_config *mcan_config = dev->config; - const struct can_nrf_config *config = mcan_config->custom; - struct nrf_clock_spec spec = { 0 }; - - /* If CAN is on, HSFLL frequency >= AUXPLL frequency */ - if (on) { - int ret; - - ret = clock_control_get_rate(config->auxpll, NULL, &spec.frequency); - if (ret < 0) { - return ret; - } - } - - return nrf_clock_control_request_sync(config->hsfll, &spec, K_FOREVER); -} - static int can_nrf_init(const struct device *dev) { const struct can_mcan_config *mcan_config = dev->config; const struct can_nrf_config *config = mcan_config->custom; int ret; - if (!device_is_ready(config->auxpll) || !device_is_ready(config->hsfll)) { + if (!device_is_ready(config->auxpll)) { return -ENODEV; } - ret = configure_hsfll(dev, true); - if (ret < 0) { - return ret; - } - ret = nrf_clock_control_request_sync(config->auxpll, NULL, K_FOREVER); if (ret < 0) { return ret; @@ -215,7 +190,6 @@ static int can_nrf_init(const struct device *dev) .mram = CAN_MCAN_DT_INST_MRAM_ADDR(n), \ .auxpll = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR_BY_NAME(n, auxpll)), \ .pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(n), \ - .hsfll = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR_BY_NAME(n, hsfll)), \ .irq = DT_INST_IRQN(n), \ .irq_configure = can_nrf_irq_configure##n, \ }; \ diff --git a/drivers/counter/counter_nrfx_timer.c b/drivers/counter/counter_nrfx_timer.c index 26fa49b1aeed..1a614b391c06 100644 --- a/drivers/counter/counter_nrfx_timer.c +++ b/drivers/counter/counter_nrfx_timer.c @@ -5,7 +5,6 @@ */ #include #include -#include #include #include #include @@ -35,21 +34,11 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME, LOG_LEVEL); #define MAYBE_CONST_CONFIG const #endif -#if NRF_DT_INST_ANY_IS_FAST && CONFIG_CLOCK_CONTROL -#define COUNTER_IS_FAST(idx) NRF_DT_INST_IS_FAST(idx) -#define COUNTER_ANY_FAST -#else -#define COUNTER_IS_FAST(idx) 0 -#endif - struct counter_nrfx_data { counter_top_callback_t top_cb; void *top_user_data; uint32_t guard_period; atomic_t cc_int_pending; -#ifdef COUNTER_ANY_FAST - atomic_t active; -#endif }; struct counter_nrfx_ch_data { @@ -61,10 +50,6 @@ struct counter_nrfx_config { struct counter_config_info info; struct counter_nrfx_ch_data *ch_data; NRF_TIMER_Type *timer; -#ifdef COUNTER_ANY_FAST - const struct device *clk_dev; - struct nrf_clock_spec clk_spec; -#endif LOG_INSTANCE_PTR_DECLARE(log); }; @@ -78,18 +63,6 @@ static int start(const struct device *dev) { const struct counter_nrfx_config *config = dev->config; -#ifdef COUNTER_ANY_FAST - struct counter_nrfx_data *data = dev->data; - - if (config->clk_dev && atomic_cas(&data->active, 0, 1)) { - int err; - - err = nrf_clock_control_request_sync(config->clk_dev, &config->clk_spec, K_FOREVER); - if (err < 0) { - return err; - } - } -#endif nrf_timer_task_trigger(config->timer, NRF_TIMER_TASK_START); return 0; @@ -106,19 +79,6 @@ static int stop(const struct device *dev) nrf_timer_task_trigger(config->timer, NRF_TIMER_TASK_CLEAR); #endif -#ifdef COUNTER_ANY_FAST - struct counter_nrfx_data *data = dev->data; - - if (config->clk_dev && atomic_cas(&data->active, 1, 0)) { - int err; - - err = nrf_clock_control_release(config->clk_dev, &config->clk_spec); - if (err < 0) { - return err; - } - } -#endif - return 0; } @@ -459,20 +419,6 @@ static DEVICE_API(counter, counter_nrfx_driver_api) = { .set_guard_period = set_guard_period, }; -/* Get initialization level of an instance. Instances that requires clock control - * which is using nrfs (IPC) are initialized later. - */ -#define TIMER_INIT_LEVEL(idx) \ - COND_CODE_1(COUNTER_IS_FAST(idx), (POST_KERNEL), (PRE_KERNEL_1)) - -/* Get initialization priority of an instance. Instances that requires clock control - * which is using nrfs (IPC) are initialized later. - */ -#define TIMER_INIT_PRIO(idx) \ - COND_CODE_1(COUNTER_IS_FAST(idx), \ - (UTIL_INC(CONFIG_CLOCK_CONTROL_NRF_HSFLL_GLOBAL_INIT_PRIORITY)), \ - (CONFIG_COUNTER_INIT_PRIORITY)) - /* * Device instantiation is done with node labels due to HAL API * requirements. In particular, TIMERx_MAX_SIZE values from HALs @@ -525,14 +471,6 @@ static DEVICE_API(counter, counter_nrfx_driver_api) = { }, \ .ch_data = counter##idx##_ch_data, \ .timer = (NRF_TIMER_Type *)DT_INST_REG_ADDR(idx), \ - IF_ENABLED(COUNTER_IS_FAST(idx), \ - (.clk_dev = DEVICE_DT_GET_OR_NULL(DT_CLOCKS_CTLR(DT_DRV_INST(idx))), \ - .clk_spec = { \ - .frequency = NRF_PERIPH_GET_FREQUENCY(DT_DRV_INST(idx)), \ - .accuracy = 0, \ - .precision = NRF_CLOCK_CONTROL_PRECISION_DEFAULT, \ - }, \ - )) \ LOG_INSTANCE_PTR_INIT(log, LOG_MODULE_NAME, idx) \ }; \ DEVICE_DT_INST_DEFINE(idx, \ @@ -540,7 +478,7 @@ static DEVICE_API(counter, counter_nrfx_driver_api) = { NULL, \ &counter_##idx##_data, \ &nrfx_counter_##idx##_config.info, \ - TIMER_INIT_LEVEL(idx), TIMER_INIT_PRIO(idx), \ + PRE_KERNEL_1, CONFIG_COUNTER_INIT_PRIORITY, \ &counter_nrfx_driver_api); DT_INST_FOREACH_STATUS_OKAY(COUNTER_NRFX_TIMER_DEVICE) diff --git a/drivers/pwm/pwm_nrfx.c b/drivers/pwm/pwm_nrfx.c index 8565fd1187ac..55a2b759b18b 100644 --- a/drivers/pwm/pwm_nrfx.c +++ b/drivers/pwm/pwm_nrfx.c @@ -13,7 +13,6 @@ #include #include #include -#include #include @@ -36,20 +35,6 @@ LOG_MODULE_REGISTER(pwm_nrfx, CONFIG_PWM_LOG_LEVEL); #define PWM(dev_idx) DT_NODELABEL(pwm##dev_idx) #define PWM_PROP(dev_idx, prop) DT_PROP(PWM(dev_idx), prop) #define PWM_HAS_PROP(idx, prop) DT_NODE_HAS_PROP(PWM(idx), prop) -#define PWM_NRFX_IS_FAST(idx) NRF_DT_IS_FAST(PWM(idx)) - -#if NRF_DT_INST_ANY_IS_FAST -#define PWM_NRFX_FAST_PRESENT 1 -/* If fast instances are used then system managed device PM cannot be used because - * it may call PM actions from locked context and fast PWM PM actions can only be - * called in a thread context. - */ -BUILD_ASSERT(!IS_ENABLED(CONFIG_PM_DEVICE_SYSTEM_MANAGED)); -#endif - -#if defined(PWM_NRFX_FAST_PRESENT) && CONFIG_CLOCK_CONTROL_NRF_HSFLL_GLOBAL -#define PWM_NRFX_USE_CLOCK_CONTROL 1 -#endif #define PWM_NRFX_CH_POLARITY_MASK BIT(15) #define PWM_NRFX_CH_COMPARE_MASK BIT_MASK(15) @@ -65,10 +50,6 @@ struct pwm_nrfx_config { #ifdef CONFIG_DCACHE uint32_t mem_attr; #endif -#ifdef PWM_NRFX_USE_CLOCK_CONTROL - const struct device *clk_dev; - struct nrf_clock_spec clk_spec; -#endif }; struct pwm_nrfx_data { @@ -77,27 +58,12 @@ struct pwm_nrfx_data { uint8_t pwm_needed; uint8_t prescaler; bool stop_requested; -#ifdef PWM_NRFX_USE_CLOCK_CONTROL - bool clock_requested; -#endif }; /* Ensure the pwm_needed bit mask can accommodate all available channels. */ #if (NRF_PWM_CHANNEL_COUNT > 8) #error "Current implementation supports maximum 8 channels." #endif -#ifdef PWM_NRFX_FAST_PRESENT -static bool pwm_is_fast(const struct pwm_nrfx_config *config) -{ - return config->clock_freq > MHZ(16); -} -#else -static bool pwm_is_fast(const struct pwm_nrfx_config *config) -{ - return false; -} -#endif - static uint16_t *seq_values_ptr_get(const struct device *dev) { const struct pwm_nrfx_config *config = dev->config; @@ -178,21 +144,6 @@ static int stop_pwm(const struct device *dev) */ nrfx_pwm_stop(&config->pwm, false); -#if PWM_NRFX_USE_CLOCK_CONTROL - struct pwm_nrfx_data *data = dev->data; - - if (data->clock_requested) { - int ret = nrf_clock_control_release(config->clk_dev, &config->clk_spec); - - if (ret < 0) { - LOG_ERR("Global HSFLL release failed: %d", ret); - return ret; - } - - data->clock_requested = false; - } -#endif - return 0; } @@ -232,9 +183,8 @@ static int pwm_nrfx_set_cycles(const struct device *dev, uint32_t channel, /* Constantly active (duty 100%). */ /* This value is always greater than or equal to COUNTERTOP. */ compare_value = PWM_NRFX_CH_COMPARE_MASK; - needs_pwm = pwm_is_fast(config) || - (IS_ENABLED(NRF_PWM_HAS_IDLEOUT) && - IS_ENABLED(CONFIG_PWM_NRFX_NO_GLITCH_DUTY_100)); + needs_pwm = IS_ENABLED(NRF_PWM_HAS_IDLEOUT) && + IS_ENABLED(CONFIG_PWM_NRFX_NO_GLITCH_DUTY_100); } else { /* PWM generation needed. Check if the requested period matches * the one that is currently set, or the PWM peripheral can be @@ -290,22 +240,6 @@ static int pwm_nrfx_set_cycles(const struct device *dev, uint32_t channel, * registers and drives its outputs accordingly. */ if (data->pwm_needed == 0) { - if (pwm_is_fast(config)) { -#if PWM_NRFX_USE_CLOCK_CONTROL - if (data->clock_requested) { - int ret = nrf_clock_control_release(config->clk_dev, - &config->clk_spec); - - if (ret < 0) { - LOG_ERR("Global HSFLL release failed: %d", ret); - return ret; - } - - data->clock_requested = false; - } -#endif - return 0; - } int ret = stop_pwm(dev); if (ret < 0) { @@ -332,20 +266,6 @@ static int pwm_nrfx_set_cycles(const struct device *dev, uint32_t channel, * until another playback is requested (new values will be * loaded then) or the PWM peripheral is stopped. */ -#if PWM_NRFX_USE_CLOCK_CONTROL - if (config->clk_dev && !data->clock_requested) { - int ret = nrf_clock_control_request_sync(config->clk_dev, - &config->clk_spec, - K_FOREVER); - - if (ret < 0) { - LOG_ERR("Global HSFLL request failed: %d", ret); - return ret; - } - - data->clock_requested = true; - } -#endif nrfx_pwm_simple_playback(&config->pwm, &config->seq, 1, NRFX_PWM_FLAG_NO_EVT_FINISHED); } @@ -463,21 +383,6 @@ static int pwm_nrfx_init(const struct device *dev) COND_CODE_1(PWM_HAS_PROP(idx, memory_regions), \ (DT_PROP_OR(PWM_MEM_REGION(idx), zephyr_memory_attr, 0)), (0)) -/* Fast instances depend on the global HSFLL clock controller (as they need - * to request the highest frequency from it to operate correctly), so they - * must be initialized after that controller driver, hence the default PWM - * initialization priority may be too early for them. - */ -#if defined(CONFIG_CLOCK_CONTROL_NRF_HSFLL_GLOBAL_INIT_PRIORITY) && \ - CONFIG_PWM_INIT_PRIORITY < CONFIG_CLOCK_CONTROL_NRF_HSFLL_GLOBAL_INIT_PRIORITY -#define PWM_INIT_PRIORITY(idx) \ - COND_CODE_1(PWM_NRFX_IS_FAST(idx), \ - (UTIL_INC(CONFIG_CLOCK_CONTROL_NRF_HSFLL_GLOBAL_INIT_PRIORITY)), \ - (CONFIG_PWM_INIT_PRIORITY)) -#else -#define PWM_INIT_PRIORITY(idx) CONFIG_PWM_INIT_PRIORITY -#endif - #define PWM_NRFX_DEVICE(idx) \ NRF_DT_CHECK_NODE_HAS_PINCTRL_SLEEP(PWM(idx)); \ NRF_DT_CHECK_NODE_HAS_REQUIRED_MEMORY_REGIONS(PWM(idx)); \ @@ -506,14 +411,6 @@ static int pwm_nrfx_init(const struct device *dev) (16ul * 1000ul * 1000ul)), \ IF_ENABLED(CONFIG_DCACHE, \ (.mem_attr = PWM_GET_MEM_ATTR(idx),)) \ - IF_ENABLED(PWM_NRFX_USE_CLOCK_CONTROL, \ - (.clk_dev = PWM_NRFX_IS_FAST(idx) \ - ? DEVICE_DT_GET(DT_CLOCKS_CTLR(PWM(idx))) \ - : NULL, \ - .clk_spec = { \ - .frequency = \ - NRF_PERIPH_GET_FREQUENCY(PWM(idx)), \ - },)) \ }; \ static int pwm_nrfx_init##idx(const struct device *dev) \ { \ @@ -526,7 +423,7 @@ static int pwm_nrfx_init(const struct device *dev) pwm_nrfx_init##idx, PM_DEVICE_DT_GET(PWM(idx)), \ &pwm_nrfx_##idx##_data, \ &pwm_nrfx_##idx##_config, \ - POST_KERNEL, PWM_INIT_PRIORITY(idx), \ + POST_KERNEL, CONFIG_PWM_INIT_PRIORITY, \ &pwm_nrfx_drv_api_funcs) #define COND_PWM_NRFX_DEVICE(unused, prefix, i, _) \ diff --git a/drivers/serial/Kconfig.nrfx b/drivers/serial/Kconfig.nrfx index a39f882f644a..722cc11da071 100644 --- a/drivers/serial/Kconfig.nrfx +++ b/drivers/serial/Kconfig.nrfx @@ -28,13 +28,6 @@ config UART_NRFX_UARTE imply NRFX_UARTE_CONFIG_SKIP_PSEL_CONFIG if !UART_NRFX_UARTE_LEGACY_SHIM imply NRFX_UARTE_CONFIG_SKIP_GPIO_CONFIG if !UART_NRFX_UARTE_LEGACY_SHIM -config UART_NRFX_UARTE_USE_CLOCK_CONTROL - def_bool y - depends on UART_NRFX_UARTE - depends on $(dt_nodelabel_enabled,uart120) - depends on !SOC_NRF54H20_CPUFLPR && !SOC_NRF54H20_CPUPPR - select CLOCK_CONTROL - config UART_NRFX_UARTE_NO_IRQ bool "Polling without interrupt" depends on UART_NRFX_UARTE diff --git a/drivers/serial/uart_nrfx_uarte.c b/drivers/serial/uart_nrfx_uarte.c index 00489e7d8856..08cb236b918d 100644 --- a/drivers/serial/uart_nrfx_uarte.c +++ b/drivers/serial/uart_nrfx_uarte.c @@ -23,7 +23,6 @@ #include #include #include -#include LOG_MODULE_REGISTER(uart_nrfx_uarte, CONFIG_UART_LOG_LEVEL); @@ -118,26 +117,6 @@ LOG_MODULE_REGISTER(uart_nrfx_uarte, CONFIG_UART_LOG_LEVEL); #define UARTE_ANY_LOW_POWER 1 #endif -/* Only cores with access to GDFS can control clocks and power domains, so if a fast instance is - * used by other cores, treat the UART like a normal one. This presumes cores with access to GDFS - * have requested the clocks and power domains needed by the fast instance to be ACTIVE before - * other cores use the fast instance. - */ -#if CONFIG_NRFS_GDFS_SERVICE_ENABLED -#define INSTANCE_IS_FAST(unused, prefix, idx, _) \ - UTIL_AND( \ - UTIL_AND( \ - IS_ENABLED(CONFIG_HAS_HW_NRF_UARTE##prefix##idx), \ - NRF_DT_IS_FAST(UARTE(idx)) \ - ), \ - IS_ENABLED(CONFIG_CLOCK_CONTROL) \ - ) - -#if UARTE_FOR_EACH_INSTANCE(INSTANCE_IS_FAST, (||), (0)) -#define UARTE_ANY_FAST 1 -#endif -#endif - #define INSTANCE_IS_HIGH_SPEED(unused, prefix, idx, _) \ COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(UARTE(prefix##idx)), \ ((NRF_PERIPH_GET_FREQUENCY(UARTE(prefix##idx)) > NRF_UARTE_BASE_FREQUENCY_16MHZ)), \ @@ -398,20 +377,6 @@ struct uarte_nrfx_data { !IS_ENABLED(CONFIG_PM_DEVICE) && \ (_config->flags & UARTE_CFG_FLAG_LOW_POWER)) -/** @brief Check if device has PM that works in ISR safe mode. - * - * Only fast UARTE instance does not work in that mode so check PM configuration - * flags only if there is any fast instance present. - * - * @retval true if device PM is ISR safe. - * @retval false if device PM is not ISR safe. - */ -#define IS_PM_ISR_SAFE(dev) \ - (!IS_ENABLED(UARTE_ANY_FAST) ||\ - COND_CODE_1(CONFIG_PM_DEVICE,\ - ((dev->pm_base->flags & BIT(PM_DEVICE_FLAG_ISR_SAFE))), \ - (0))) - /** * @brief Structure for UARTE configuration. */ @@ -423,10 +388,6 @@ struct uarte_nrfx_config { #ifdef CONFIG_HAS_NORDIC_DMM void *mem_reg; #endif -#ifdef UARTE_ANY_FAST - const struct device *clk_dev; - struct nrf_clock_spec clk_spec; -#endif #ifdef CONFIG_UART_USE_RUNTIME_CONFIGURE /* None-zero in case of high speed instances. Baudrate is adjusted by that ratio. */ uint32_t clock_freq; @@ -840,15 +801,6 @@ static void uarte_periph_enable(const struct device *dev) struct uarte_nrfx_data *data = dev->data; (void)data; -#ifdef UARTE_ANY_FAST - if (config->clk_dev) { - int err; - - err = nrf_clock_control_request_sync(config->clk_dev, &config->clk_spec, K_FOREVER); - (void)err; - __ASSERT_NO_MSG(err >= 0); - } -#endif (void)pinctrl_apply_state(config->pcfg, PINCTRL_STATE_DEFAULT); nrf_uarte_enable(uarte); @@ -1863,20 +1815,6 @@ static int uarte_nrfx_tx(const struct device *dev, const uint8_t *buf, } if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - if (!IS_PM_ISR_SAFE(dev) && k_is_in_isr()) { - /* If instance does not support PM from ISR device shall - * already be turned on. - */ - enum pm_device_state state; - int err; - - err = pm_device_state_get(dev, &state); - (void)err; - __ASSERT_NO_MSG(err == 0); - if (state != PM_DEVICE_STATE_ACTIVE) { - return -ENOTSUP; - } - } pm_device_runtime_get(dev); } @@ -2008,20 +1946,6 @@ static int uarte_nrfx_rx_enable(const struct device *dev, uint8_t *buf, async_rx->next_buf_len = 0; if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - if (!IS_PM_ISR_SAFE(dev) && k_is_in_isr()) { - /* If instance does not support PM from ISR device shall - * already be turned on. - */ - enum pm_device_state state; - int err; - - err = pm_device_state_get(dev, &state); - (void)err; - __ASSERT_NO_MSG(err == 0); - if (state != PM_DEVICE_STATE_ACTIVE) { - return -ENOTSUP; - } - } pm_device_runtime_get(dev); } else if (LOW_POWER_ENABLED(cfg)) { unsigned int key = irq_lock(); @@ -2085,7 +2009,7 @@ static int uarte_nrfx_rx_enable(const struct device *dev, uint8_t *buf, nrf_uarte_rx_buffer_set(uarte, buf, len); - if (IS_ENABLED(UARTE_ANY_FAST) && (cfg->flags & UARTE_CFG_FLAG_CACHEABLE)) { + if (IS_ENABLED(CONFIG_HAS_HW_NRF_UARTE120) && (cfg->flags & UARTE_CFG_FLAG_CACHEABLE)) { /* Spurious RXTO event was seen on fast instance (UARTE120) thus * RXTO interrupt is kept enabled only when RX is active. */ @@ -2580,7 +2504,7 @@ static void rxto_isr(const struct device *dev) #ifdef CONFIG_UART_NRFX_UARTE_ENHANCED_RX NRF_UARTE_Type *uarte = get_uarte_instance(dev); - if (IS_ENABLED(UARTE_ANY_FAST) && (config->flags & UARTE_CFG_FLAG_CACHEABLE)) { + if (IS_ENABLED(CONFIG_HAS_HW_NRF_UARTE120) && (config->flags & UARTE_CFG_FLAG_CACHEABLE)) { /* Spurious RXTO event was seen on fast instance (UARTE120) thus * RXTO interrupt is kept enabled only when RX is active. */ @@ -2873,22 +2797,6 @@ static void uarte_nrfx_poll_out(const struct device *dev, unsigned char c) } if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - if (!IS_PM_ISR_SAFE(dev) && k_is_in_isr()) { - /* If instance does not support PM from ISR device shall - * already be turned on. - */ - enum pm_device_state state; - int err; - - err = pm_device_state_get(dev, &state); - (void)err; - __ASSERT_NO_MSG(err == 0); - if (state != PM_DEVICE_STATE_ACTIVE) { - irq_unlock(key); - return; - } - } - if (!(data->flags & UARTE_FLAG_POLL_OUT)) { data->flags |= UARTE_FLAG_POLL_OUT; pm_device_runtime_get(dev); @@ -3214,15 +3122,6 @@ static void uarte_pm_suspend(const struct device *dev) struct uarte_nrfx_data *data = dev->data; (void)data; -#ifdef UARTE_ANY_FAST - if (cfg->clk_dev) { - int err; - - err = nrf_clock_control_release(cfg->clk_dev, &cfg->clk_spec); - (void)err; - __ASSERT_NO_MSG(err >= 0); - } -#endif #ifdef UARTE_ANY_ASYNC if (data->async) { @@ -3504,20 +3403,6 @@ static int uarte_instance_deinit(const struct device *dev) #define UARTE_GET_BAUDRATE(idx) \ UARTE_GET_BAUDRATE2(NRF_PERIPH_GET_FREQUENCY(UARTE(idx)), UARTE_PROP(idx, current_speed)) -/* Get initialization level of an instance. Instances that requires clock control - * which is using nrfs (IPC) are initialized later. - */ -#define UARTE_INIT_LEVEL(idx) \ - COND_CODE_1(INSTANCE_IS_FAST(_, /*empty*/, idx, _), (POST_KERNEL), (PRE_KERNEL_1)) - -/* Get initialization priority of an instance. Instances that requires clock control - * which is using nrfs (IPC) are initialized later. - */ -#define UARTE_INIT_PRIO(idx) \ - COND_CODE_1(INSTANCE_IS_FAST(_, /*empty*/, idx, _), \ - (UTIL_INC(CONFIG_CLOCK_CONTROL_NRF_HSFLL_GLOBAL_INIT_PRIORITY)), \ - (CONFIG_SERIAL_INIT_PRIORITY)) - /* Macro for setting nRF specific configuration structures. */ #define UARTE_NRF_CONFIG(idx) { \ .hwfc = (UARTE_PROP(idx, hw_flow_control) == \ @@ -3545,33 +3430,24 @@ static int uarte_instance_deinit(const struct device *dev) : UART_CFG_FLOW_CTRL_NONE, \ } -#define UARTE_ON_MANAGED_POWER_DOMAIN(idx) \ - UTIL_AND( \ - IS_ENABLED(CONFIG_PM_DEVICE_POWER_DOMAIN), \ - UTIL_AND( \ - DT_NODE_HAS_PROP(UARTE(idx), power_domains), \ - DT_NODE_HAS_STATUS_OKAY(DT_PHANDLE(UARTE(idx), power_domains)) \ - ) \ - ) - /* Macro determines if PM actions are interrupt safe. * - * Requesting/releasing clocks or power domains is not necessarily ISR safe (we can't - * reliably know, its out of our control). UARTE_ON_MANAGED_POWER_DOMAIN() let's us check if we - * will be requesting/releasing power domains (and clocks for now since the only case where we - * need to request power domains happens to be the same criteria). - * - * Furthermore, non-asynchronous API if RX is disabled is not ISR safe. + * Non-asynchronous API if RX is disabled is not ISR safe. * * Macro must resolve to a literal 1 or 0. */ #define UARTE_PM_ISR_SAFE(idx) \ - COND_CODE_1(UARTE_ON_MANAGED_POWER_DOMAIN(idx), \ - (0), \ - (COND_CODE_1(CONFIG_UART_##idx##_ASYNC, \ - (PM_DEVICE_ISR_SAFE), \ - (COND_CODE_1(UARTE_PROP(idx, disable_rx), \ - (PM_DEVICE_ISR_SAFE), (0)))))) \ + COND_CODE_1( \ + CONFIG_UART_##idx##_ASYNC, \ + (PM_DEVICE_ISR_SAFE), \ + ( \ + COND_CODE_1( \ + UARTE_PROP(idx, disable_rx), \ + (PM_DEVICE_ISR_SAFE), \ + (0) \ + ) \ + ) \ + ) #define UART_NRF_UARTE_DEVICE(idx) \ NRF_DT_CHECK_NODE_HAS_PINCTRL_SLEEP(UARTE(idx)); \ @@ -3642,13 +3518,6 @@ static int uarte_instance_deinit(const struct device *dev) IF_ENABLED(CONFIG_UART_##idx##_NRF_HW_ASYNC, \ (.timer = NRFX_TIMER_INSTANCE( \ CONFIG_UART_##idx##_NRF_HW_ASYNC_TIMER),)) \ - IF_ENABLED(INSTANCE_IS_FAST(_, /*empty*/, idx, _), \ - (.clk_dev = DEVICE_DT_GET_OR_NULL(DT_CLOCKS_CTLR(UARTE(idx))), \ - .clk_spec = { \ - .frequency = NRF_PERIPH_GET_FREQUENCY(UARTE(idx)),\ - .accuracy = 0, \ - .precision = NRF_CLOCK_CONTROL_PRECISION_DEFAULT,\ - },)) \ IF_ENABLED(UARTE_PINS_CROSS_DOMAIN(_, /*empty*/, idx, _), \ (.cross_domain = true, \ .default_port = \ @@ -3673,8 +3542,8 @@ static int uarte_instance_deinit(const struct device *dev) PM_DEVICE_DT_GET(UARTE(idx)), \ &uarte_##idx##_data, \ &uarte_##idx##z_config, \ - UARTE_INIT_LEVEL(idx), \ - UARTE_INIT_PRIO(idx), \ + PRE_KERNEL_1, \ + CONFIG_SERIAL_INIT_PRIORITY, \ &uart_nrfx_uarte_driver_api) #define UARTE_INT_DRIVEN(idx) \ diff --git a/drivers/spi/spi_nrfx_spim.c b/drivers/spi/spi_nrfx_spim.c index 447c0e54fba5..44451be58bc7 100644 --- a/drivers/spi/spi_nrfx_spim.c +++ b/drivers/spi/spi_nrfx_spim.c @@ -9,7 +9,6 @@ #include #include #include -#include #include #include #include @@ -55,31 +54,6 @@ LOG_MODULE_REGISTER(spi_nrfx_spim, CONFIG_SPI_LOG_LEVEL); #define SPIM_FOR_EACH_INSTANCE(f, sep, off_code, ...) \ NRFX_FOREACH_PRESENT(SPIM, f, sep, off_code, __VA_ARGS__) -/* Only CPUAPP and CPURAD can control clocks and power domains, so if a fast instance is - * used by other cores, treat the SPIM like a normal one. This presumes the CPUAPP or CPURAD - * have requested the clocks and power domains needed by the fast instance to be ACTIVE before - * other cores use the fast instance. - */ -#if CONFIG_SOC_NRF54H20_CPUAPP || CONFIG_SOC_NRF54H20_CPURAD -#define INSTANCE_IS_FAST(unused, prefix, idx, _) \ - UTIL_AND( \ - UTIL_AND( \ - IS_ENABLED(CONFIG_HAS_HW_NRF_SPIM##prefix##idx), \ - NRF_DT_IS_FAST(SPIM(idx)) \ - ), \ - IS_ENABLED(CONFIG_CLOCK_CONTROL) \ - ) - -#if SPIM_FOR_EACH_INSTANCE(INSTANCE_IS_FAST, (||), (0)) -#define SPIM_ANY_FAST 1 -/* If fast instances are used then system managed device PM cannot be used because - * it may call PM actions from locked context and fast SPIM PM actions can only be - * called from a thread context. - */ -BUILD_ASSERT(!IS_ENABLED(CONFIG_PM_DEVICE_SYSTEM_MANAGED)); -#endif -#endif - #define SPIM_PINS_CROSS_DOMAIN(unused, prefix, idx, _) \ COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(SPIM(prefix##idx)), \ (SPIM_PROP(idx, cross_domain_pins_supported)), \ @@ -117,9 +91,6 @@ struct spi_nrfx_data { uint8_t ppi_ch; uint8_t gpiote_ch; #endif -#ifdef SPIM_ANY_FAST - bool clock_requested; -#endif }; struct spi_nrfx_config { @@ -134,10 +105,6 @@ struct spi_nrfx_config { #endif uint32_t wake_pin; nrfx_gpiote_t wake_gpiote; -#ifdef SPIM_ANY_FAST - const struct device *clk_dev; - struct nrf_clock_spec clk_spec; -#endif #if SPIM_CROSS_DOMAIN_SUPPORTED bool cross_domain; int8_t default_port; @@ -147,51 +114,6 @@ struct spi_nrfx_config { static void event_handler(const nrfx_spim_evt_t *p_event, void *p_context); -static inline int request_clock(const struct device *dev) -{ -#ifdef SPIM_ANY_FAST - struct spi_nrfx_data *dev_data = dev->data; - const struct spi_nrfx_config *dev_config = dev->config; - int error; - - if (!dev_config->clk_dev) { - return 0; - } - - error = nrf_clock_control_request_sync( - dev_config->clk_dev, &dev_config->clk_spec, - K_MSEC(CONFIG_SPI_COMPLETION_TIMEOUT_TOLERANCE)); - if (error < 0) { - LOG_ERR("Failed to request clock: %d", error); - return error; - } - - dev_data->clock_requested = true; -#else - ARG_UNUSED(dev); -#endif - - return 0; -} - -static inline void release_clock(const struct device *dev) -{ -#ifdef SPIM_ANY_FAST - struct spi_nrfx_data *dev_data = dev->data; - const struct spi_nrfx_config *dev_config = dev->config; - - if (!dev_data->clock_requested) { - return; - } - - dev_data->clock_requested = false; - - nrf_clock_control_release(dev_config->clk_dev, &dev_config->clk_spec); -#else - ARG_UNUSED(dev); -#endif -} - #if SPIM_CROSS_DOMAIN_SUPPORTED static bool spim_has_cross_domain_connection(const struct spi_nrfx_config *config) { @@ -232,10 +154,6 @@ static inline void finalize_spi_transaction(const struct device *dev, bool deact nrfy_spim_disable(reg); } - if (!pm_device_runtime_is_enabled(dev)) { - release_clock(dev); - } - pm_device_runtime_put_async(dev, K_NO_WAIT); } @@ -640,10 +558,6 @@ static int transceive(const struct device *dev, error = configure(dev, spi_cfg); - if (error == 0 && !pm_device_runtime_is_enabled(dev)) { - error = request_clock(dev); - } - if (error == 0) { dev_data->busy = true; @@ -786,7 +700,7 @@ static int spim_resume(const struct device *dev) } #endif - return pm_device_runtime_is_enabled(dev) ? request_clock(dev) : 0; + return 0; } static void spim_suspend(const struct device *dev) @@ -799,10 +713,6 @@ static void spim_suspend(const struct device *dev) dev_data->initialized = false; } - if (pm_device_runtime_is_enabled(dev)) { - release_clock(dev); - } - spi_context_cs_put_all(&dev_data->ctx); #if SPIM_CROSS_DOMAIN_SUPPORTED @@ -905,14 +815,6 @@ static int spi_nrfx_deinit(const struct device *dev) ()) \ )) -/* Get initialization priority of an instance. Instances that requires clock control - * which is using nrfs (IPC) are initialized later. - */ -#define SPIM_INIT_PRIORITY(idx) \ - COND_CODE_1(INSTANCE_IS_FAST(_, /*empty*/, idx, _), \ - (UTIL_INC(CONFIG_CLOCK_CONTROL_NRF_HSFLL_GLOBAL_INIT_PRIORITY)), \ - (CONFIG_SPI_INIT_PRIORITY)) - #define SPI_NRFX_SPIM_DEFINE(idx) \ NRF_DT_CHECK_NODE_HAS_PINCTRL_SLEEP(SPIM(idx)); \ NRF_DT_CHECK_NODE_HAS_REQUIRED_MEMORY_REGIONS(SPIM(idx)); \ @@ -964,12 +866,6 @@ static int spi_nrfx_deinit(const struct device *dev) .wake_pin = NRF_DT_GPIOS_TO_PSEL_OR(SPIM(idx), wake_gpios, \ WAKE_PIN_NOT_USED), \ .wake_gpiote = WAKE_GPIOTE_INSTANCE(SPIM(idx)), \ - IF_ENABLED(SPIM_ANY_FAST, \ - (.clk_dev = DEVICE_DT_GET_OR_NULL( \ - DT_CLOCKS_CTLR(SPIM(idx))), \ - .clk_spec = { \ - .frequency = NRF_CLOCK_CONTROL_FREQUENCY_MAX, \ - },)) \ IF_ENABLED(SPIM_PINS_CROSS_DOMAIN(_, /*empty*/, idx, _), \ (.cross_domain = true, \ .default_port = \ @@ -987,7 +883,7 @@ static int spi_nrfx_deinit(const struct device *dev) PM_DEVICE_DT_GET(SPIM(idx)), \ &spi_##idx##_data, \ &spi_##idx##z_config, \ - POST_KERNEL, SPIM_INIT_PRIORITY(idx), \ + POST_KERNEL, CONFIG_SPI_INIT_PRIORITY, \ &spi_nrfx_driver_api) #define COND_NRF_SPIM_DEVICE(unused, prefix, i, _) \ diff --git a/drivers/spi/spi_nrfx_spis.c b/drivers/spi/spi_nrfx_spis.c index aa59d9abc9b2..4d1a9070c1ac 100644 --- a/drivers/spi/spi_nrfx_spis.c +++ b/drivers/spi/spi_nrfx_spis.c @@ -20,14 +20,6 @@ LOG_MODULE_REGISTER(spi_nrfx_spis, CONFIG_SPI_LOG_LEVEL); #include "spi_context.h" -#if NRF_DT_INST_ANY_IS_FAST -/* If fast instances are used then system managed device PM cannot be used because - * it may call PM actions from locked context and fast SPIM PM actions can only be - * called from a thread context. - */ -BUILD_ASSERT(!IS_ENABLED(CONFIG_PM_DEVICE_SYSTEM_MANAGED)); -#endif - /* * Current factors requiring use of DT_NODELABEL: * @@ -39,7 +31,6 @@ BUILD_ASSERT(!IS_ENABLED(CONFIG_PM_DEVICE_SYSTEM_MANAGED)); #define SPIS(idx) DT_NODELABEL(SPIS_NODE(idx)) #define SPIS_PROP(idx, prop) DT_PROP(SPIS(idx), prop) #define SPIS_HAS_PROP(idx, prop) DT_NODE_HAS_PROP(SPIS(idx), prop) -#define SPIS_IS_FAST(idx) NRF_DT_IS_FAST(SPIS(idx)) #define SPIS_PINS_CROSS_DOMAIN(unused, prefix, idx, _) \ COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(SPIS(prefix##idx)), \ @@ -551,32 +542,6 @@ static int spi_nrfx_init(const struct device *dev) return pm_device_driver_init(dev, spi_nrfx_pm_action); } -/* Macro determines PM actions interrupt safety level. - * - * Requesting/releasing SPIS device may be ISR safe, but it cannot be reliably known whether - * managing its power domain is. It is then assumed that if power domains are used, device is - * no longer ISR safe. This macro let's us check if we will be requesting/releasing - * power domains and determines PM device ISR safety value. - * - * Additionally, fast SPIS devices are not ISR safe. - */ -#define SPIS_PM_ISR_SAFE(idx) \ - COND_CODE_1( \ - UTIL_AND( \ - IS_ENABLED(CONFIG_PM_DEVICE_POWER_DOMAIN), \ - UTIL_AND( \ - DT_NODE_HAS_PROP(SPIS(idx), power_domains), \ - DT_NODE_HAS_STATUS_OKAY(DT_PHANDLE(SPIS(idx), power_domains)) \ - ) \ - ), \ - (0), \ - (COND_CODE_1( \ - SPIS_IS_FAST(idx), \ - (0), \ - (PM_DEVICE_ISR_SAFE) \ - )) \ - ) - #define SPI_NRFX_SPIS_DEFINE(idx) \ NRF_DT_CHECK_NODE_HAS_REQUIRED_MEMORY_REGIONS(SPIS(idx)); \ static void irq_connect##idx(void) \ @@ -622,8 +587,7 @@ static int spi_nrfx_init(const struct device *dev) BUILD_ASSERT(!DT_NODE_HAS_PROP(SPIS(idx), wake_gpios) || \ !(DT_GPIO_FLAGS(SPIS(idx), wake_gpios) & GPIO_ACTIVE_LOW),\ "WAKE line must be configured as active high"); \ - PM_DEVICE_DT_DEFINE(SPIS(idx), spi_nrfx_pm_action, \ - SPIS_PM_ISR_SAFE(idx)); \ + PM_DEVICE_DT_DEFINE(SPIS(idx), spi_nrfx_pm_action, PM_DEVICE_ISR_SAFE);\ SPI_DEVICE_DT_DEFINE(SPIS(idx), \ spi_nrfx_init, \ PM_DEVICE_DT_GET(SPIS(idx)), \ diff --git a/dts/arm/nordic/nrf54h20_cpuapp.dtsi b/dts/arm/nordic/nrf54h20_cpuapp.dtsi index f3b8e4f8c08c..88ace7842aa3 100644 --- a/dts/arm/nordic/nrf54h20_cpuapp.dtsi +++ b/dts/arm/nordic/nrf54h20_cpuapp.dtsi @@ -67,18 +67,6 @@ wdt011: &cpuapp_wdt011 {}; interrupts = <109 NRF_DEFAULT_IRQ_PRIORITY>; }; -&fll16m { - status = "okay"; -}; - -&hsfll120 { - status = "okay"; -}; - -&lfclk { - status = "okay"; -}; - &gdpwr { status = "okay"; }; diff --git a/dts/arm/nordic/nrf54h20_cpurad.dtsi b/dts/arm/nordic/nrf54h20_cpurad.dtsi index cc7b0a97b513..b910e42789b0 100644 --- a/dts/arm/nordic/nrf54h20_cpurad.dtsi +++ b/dts/arm/nordic/nrf54h20_cpurad.dtsi @@ -108,18 +108,6 @@ wdt011: &cpurad_wdt011 {}; status = "okay"; }; -&fll16m { - status = "okay"; -}; - -&hsfll120 { - status = "okay"; -}; - -&lfclk { - status = "okay"; -}; - &gdpwr { status = "okay"; }; diff --git a/samples/boards/nordic/clock_control/configs/cpuapp_hsfll.overlay b/samples/boards/nordic/clock_control/configs/cpuapp_hsfll.overlay index 0d46dfbda451..f2ab83533f48 100644 --- a/samples/boards/nordic/clock_control/configs/cpuapp_hsfll.overlay +++ b/samples/boards/nordic/clock_control/configs/cpuapp_hsfll.overlay @@ -9,3 +9,7 @@ sample-clock = &cpuapp_hsfll; }; }; + +&cpuapp_hsfll { + status = "okay"; +}; diff --git a/samples/boards/nordic/clock_control/configs/fll16m.overlay b/samples/boards/nordic/clock_control/configs/fll16m.overlay index e6484259ce4f..c4e24588f227 100644 --- a/samples/boards/nordic/clock_control/configs/fll16m.overlay +++ b/samples/boards/nordic/clock_control/configs/fll16m.overlay @@ -9,3 +9,7 @@ sample-clock = &fll16m; }; }; + +&fll16m { + status = "okay"; +}; diff --git a/samples/boards/nordic/clock_control/configs/global_hsfll.overlay b/samples/boards/nordic/clock_control/configs/global_hsfll.overlay index c7e67b9c4e85..ef14d521a589 100644 --- a/samples/boards/nordic/clock_control/configs/global_hsfll.overlay +++ b/samples/boards/nordic/clock_control/configs/global_hsfll.overlay @@ -9,3 +9,7 @@ sample-clock = &hsfll120; }; }; + +&hsfll120 { + status = "okay"; +}; diff --git a/samples/boards/nordic/clock_control/configs/lfclk.overlay b/samples/boards/nordic/clock_control/configs/lfclk.overlay index db48e5f7705d..4b601f56fd08 100644 --- a/samples/boards/nordic/clock_control/configs/lfclk.overlay +++ b/samples/boards/nordic/clock_control/configs/lfclk.overlay @@ -9,3 +9,7 @@ sample-clock = &lfclk; }; }; + +&lfclk { + status = "okay"; +}; diff --git a/samples/boards/nordic/clock_control/configs/uart135.overlay b/samples/boards/nordic/clock_control/configs/uart135.overlay index 547145fa91de..dfc32c3cd9f1 100644 --- a/samples/boards/nordic/clock_control/configs/uart135.overlay +++ b/samples/boards/nordic/clock_control/configs/uart135.overlay @@ -14,3 +14,7 @@ status = "okay"; memory-regions = <&cpuapp_dma_region>; }; + +&fll16m { + status = "okay"; +}; diff --git a/tests/drivers/clock_control/nrf_clock_control/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/clock_control/nrf_clock_control/boards/nrf54h20dk_nrf54h20_cpuapp.overlay new file mode 100644 index 000000000000..20fe7b305261 --- /dev/null +++ b/tests/drivers/clock_control/nrf_clock_control/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -0,0 +1,21 @@ +/* + * Copyright 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&fll16m { + status = "okay"; +}; + +&hsfll120 { + status = "okay"; +}; + +&lfclk { + status = "okay"; +}; + +&canpll { + status = "okay"; +}; diff --git a/tests/drivers/uart/uart_async_dual/boards/nrf54h20dk_nrf54h20_cpuapp.conf b/tests/drivers/uart/uart_async_dual/boards/nrf54h20dk_nrf54h20_cpuapp.conf index 6dffc1fe4e19..74cc8d7691e1 100644 --- a/tests/drivers/uart/uart_async_dual/boards/nrf54h20dk_nrf54h20_cpuapp.conf +++ b/tests/drivers/uart/uart_async_dual/boards/nrf54h20dk_nrf54h20_cpuapp.conf @@ -1,3 +1,2 @@ CONFIG_PM_DEVICE=y CONFIG_PM_DEVICE_RUNTIME=y -CONFIG_CLOCK_CONTROL=y From 7c8475ccddff3fd49f08503428e0f28c028630c9 Mon Sep 17 00:00:00 2001 From: Rubin Gerritsen Date: Tue, 16 Jul 2024 14:43:30 +0200 Subject: [PATCH 1919/2141] [nrf noup] dts: Add Bluetooth Controller to nRF54H20 The nRF54H20 supports a Bluetooth controller. The HCI driver interface has changed upstream in https://github.com/zephyrproject-rtos/zephyr/pull/72323 so now we need to add it to device tree. Signed-off-by: Rubin Gerritsen (cherry picked from commit e9a13c3d91f2ce76abcdb72c62455578fbf2257a) (cherry picked from commit 6f17dc3e1d057a260efb291a63f4d2d94cb94d6d) --- dts/arm/nordic/nrf54h20_cpurad.dtsi | 8 ++++++++ dts/vendor/nordic/nrf54h20.dtsi | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/dts/arm/nordic/nrf54h20_cpurad.dtsi b/dts/arm/nordic/nrf54h20_cpurad.dtsi index b910e42789b0..eac16a3c14f3 100644 --- a/dts/arm/nordic/nrf54h20_cpurad.dtsi +++ b/dts/arm/nordic/nrf54h20_cpurad.dtsi @@ -31,6 +31,10 @@ wdt011: &cpurad_wdt011 {}; /delete-node/ &s2ram; / { + chosen { + zephyr,bt-hci = &bt_hci_controller; + }; + soc { compatible = "simple-bus"; interrupt-parent = <&cpurad_nvic>; @@ -131,3 +135,7 @@ wdt011: &cpurad_wdt011 {}; &gdpwr_slow_main { status = "okay"; }; + +&bt_hci_controller { + status = "okay"; +}; diff --git a/dts/vendor/nordic/nrf54h20.dtsi b/dts/vendor/nordic/nrf54h20.dtsi index 06a7fe4d2495..b543373e1b35 100644 --- a/dts/vendor/nordic/nrf54h20.dtsi +++ b/dts/vendor/nordic/nrf54h20.dtsi @@ -486,6 +486,14 @@ compatible = "nordic,nrf-ieee802154"; status = "disabled"; }; + + /* Note: In the nRF Connect SDK the SoftDevice Controller + * is added and set as the default Bluetooth Controller. + */ + bt_hci_controller: bt_hci_controller { + compatible = "zephyr,bt-hci-ll-sw-split"; + status = "disabled"; + }; }; ccm030: ccm@3a000 { From 3627b4c988b2ca7a17fbb884be93def1f46f52fa Mon Sep 17 00:00:00 2001 From: Rubin Gerritsen Date: Thu, 5 Sep 2024 08:04:15 +0200 Subject: [PATCH 1920/2141] [nrf noup] dts: Select SoftDevice Controller DTS binding as default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The SoftDevice Controller is a different controller than the open source link layer with a different set of quirks. It should therefore have its own device tree binding. This commit converts the SoftDevice Controller driver to use this new DTS binding instead of reusing the existing one. This commit updates or adds additional overlays for existing samples, applications and tests that were using the open source link layer. Signed-off-by: Rubin Gerritsen Signed-off-by: Kristoffer Rist Skøien Signed-off-by: Rafał Kuźnia (cherry picked from commit 946fcec6c632424ca0a7e2ee7cc9a5df7eb1180e) (cherry picked from commit 6d216e1a427579ef6fba03c6cb0fa90d4d9e1504) --- dts/arm/nordic/nrf52805.dtsi | 11 +- dts/arm/nordic/nrf52810.dtsi | 11 +- dts/arm/nordic/nrf52811.dtsi | 11 +- dts/arm/nordic/nrf52820.dtsi | 11 +- dts/arm/nordic/nrf52832.dtsi | 11 +- dts/arm/nordic/nrf52833.dtsi | 11 +- dts/arm/nordic/nrf52840.dtsi | 11 +- dts/arm/nordic/nrf5340_cpunet.dtsi | 11 +- dts/arm/nordic/nrf54h20_cpurad.dtsi | 4 +- dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi | 4 +- dts/vendor/nordic/nrf54h20.dtsi | 7 +- dts/vendor/nordic/nrf54l20.dtsi | 852 ++++++++++++++++++ dts/vendor/nordic/nrf54l_05_10_15.dtsi | 8 +- .../bluetooth/bap_broadcast_sink/sample.yaml | 4 +- .../bap_broadcast_sink/sysbuild.cmake | 4 + .../bap_broadcast_source/sample.yaml | 4 +- .../bap_broadcast_source/sysbuild.cmake | 4 + .../bluetooth/bap_unicast_client/sample.yaml | 4 +- .../bap_unicast_client/sysbuild.cmake | 4 + .../bluetooth/bap_unicast_server/sample.yaml | 4 +- .../bap_unicast_server/sysbuild.cmake | 4 + samples/bluetooth/beacon/sample.yaml | 4 +- samples/bluetooth/cap_acceptor/sample.yaml | 4 +- samples/bluetooth/cap_acceptor/sysbuild.cmake | 4 + samples/bluetooth/cap_initiator/sample.yaml | 4 +- .../bluetooth/cap_initiator/sysbuild.cmake | 4 + .../direction_finding_central/sample.yaml | 15 +- .../sample.yaml | 14 +- .../sample.yaml | 14 +- .../direction_finding_peripheral/sample.yaml | 15 +- samples/bluetooth/hci_ipc/sample.yaml | 34 +- samples/bluetooth/hci_uart/sample.yaml | 18 +- samples/bluetooth/hci_vs_scan_req/sample.yaml | 2 + samples/bluetooth/iso_central/sample.yaml | 6 +- .../pbp_public_broadcast_sink/sample.yaml | 4 +- .../pbp_public_broadcast_sink/sysbuild.cmake | 4 + .../pbp_public_broadcast_source/sample.yaml | 4 +- .../sysbuild.cmake | 4 + .../bt-ll-sw-split/bt-ll-sw-split.overlay | 4 + .../controller/ll_sw/nordic/lll/lll.c | 2 +- .../controller/ctrl_api/testcase.yaml | 2 + .../controller/ctrl_chmu/testcase.yaml | 2 + .../controller/ctrl_cis_create/testcase.yaml | 2 + .../ctrl_cis_terminate/testcase.yaml | 2 + .../controller/ctrl_collision/testcase.yaml | 2 + .../controller/ctrl_conn_update/testcase.yaml | 11 +- .../controller/ctrl_cte_req/testcase.yaml | 2 + .../ctrl_data_length_update/testcase.yaml | 10 +- .../controller/ctrl_encrypt/testcase.yaml | 2 + .../ctrl_feature_exchange/testcase.yaml | 2 + .../controller/ctrl_hci/testcase.yaml | 2 + .../controller/ctrl_invalid/testcase.yaml | 2 + .../controller/ctrl_le_ping/testcase.yaml | 2 + .../ctrl_min_used_chans/testcase.yaml | 2 + .../controller/ctrl_phy_update/testcase.yaml | 6 +- .../controller/ctrl_sca_update/testcase.yaml | 2 + .../controller/ctrl_sw_privacy/testcase.yaml | 2 + .../controller/ctrl_terminate/testcase.yaml | 2 + .../ctrl_tx_buffer_alloc/testcase.yaml | 22 +- .../controller/ctrl_tx_queue/testcase.yaml | 2 + .../controller/ctrl_unsupported/testcase.yaml | 6 +- .../controller/ctrl_user_ext/testcase.yaml | 2 + .../controller/ctrl_version/testcase.yaml | 2 + .../df/connection_cte_req/testcase.yaml | 2 + .../df/connection_cte_tx_params/testcase.yaml | 2 + .../connectionless_cte_chains/testcase.yaml | 2 + .../df/connectionless_cte_rx/testcase.yaml | 2 + .../df/connectionless_cte_tx/testcase.yaml | 2 + tests/bluetooth/init/testcase.yaml | 101 ++- 69 files changed, 1235 insertions(+), 122 deletions(-) create mode 100644 dts/vendor/nordic/nrf54l20.dtsi diff --git a/dts/arm/nordic/nrf52805.dtsi b/dts/arm/nordic/nrf52805.dtsi index e940c7a2cdf2..b686ddcabb02 100644 --- a/dts/arm/nordic/nrf52805.dtsi +++ b/dts/arm/nordic/nrf52805.dtsi @@ -11,7 +11,7 @@ / { chosen { - zephyr,bt-hci = &bt_hci_controller; + zephyr,bt-hci = &bt_hci_sdc; zephyr,entropy = &rng; zephyr,flash-controller = &flash_controller; }; @@ -106,12 +106,13 @@ status = "okay"; ble-2mbps-supported; - /* Note: In the nRF Connect SDK the SoftDevice Controller - * is added and set as the default Bluetooth Controller. - */ + bt_hci_sdc: bt_hci_sdc { + compatible = "nordic,bt-hci-sdc"; + status = "okay"; + }; bt_hci_controller: bt_hci_controller { compatible = "zephyr,bt-hci-ll-sw-split"; - status = "okay"; + status = "disabled"; }; }; diff --git a/dts/arm/nordic/nrf52810.dtsi b/dts/arm/nordic/nrf52810.dtsi index c1e5f8763172..7f4c1a7a5f5b 100644 --- a/dts/arm/nordic/nrf52810.dtsi +++ b/dts/arm/nordic/nrf52810.dtsi @@ -7,7 +7,7 @@ / { chosen { - zephyr,bt-hci = &bt_hci_controller; + zephyr,bt-hci = &bt_hci_sdc; zephyr,entropy = &rng; zephyr,flash-controller = &flash_controller; }; @@ -110,12 +110,13 @@ status = "okay"; ble-2mbps-supported; - /* Note: In the nRF Connect SDK the SoftDevice Controller - * is added and set as the default Bluetooth Controller. - */ + bt_hci_sdc: bt_hci_sdc { + compatible = "nordic,bt-hci-sdc"; + status = "okay"; + }; bt_hci_controller: bt_hci_controller { compatible = "zephyr,bt-hci-ll-sw-split"; - status = "okay"; + status = "disabled"; }; }; diff --git a/dts/arm/nordic/nrf52811.dtsi b/dts/arm/nordic/nrf52811.dtsi index 33f6ac38747a..8431bb9c2ce6 100644 --- a/dts/arm/nordic/nrf52811.dtsi +++ b/dts/arm/nordic/nrf52811.dtsi @@ -11,7 +11,7 @@ / { chosen { - zephyr,bt-hci = &bt_hci_controller; + zephyr,bt-hci = &bt_hci_sdc; zephyr,entropy = &rng; zephyr,flash-controller = &flash_controller; }; @@ -122,12 +122,13 @@ status = "disabled"; }; - /* Note: In the nRF Connect SDK the SoftDevice Controller - * is added and set as the default Bluetooth Controller. - */ + bt_hci_sdc: bt_hci_sdc { + compatible = "nordic,bt-hci-sdc"; + status = "okay"; + }; bt_hci_controller: bt_hci_controller { compatible = "zephyr,bt-hci-ll-sw-split"; - status = "okay"; + status = "disabled"; }; }; diff --git a/dts/arm/nordic/nrf52820.dtsi b/dts/arm/nordic/nrf52820.dtsi index 1073b973c22a..85aab283bfd2 100644 --- a/dts/arm/nordic/nrf52820.dtsi +++ b/dts/arm/nordic/nrf52820.dtsi @@ -10,7 +10,7 @@ / { chosen { - zephyr,bt-hci = &bt_hci_controller; + zephyr,bt-hci = &bt_hci_sdc; zephyr,entropy = &rng; zephyr,flash-controller = &flash_controller; }; @@ -123,12 +123,13 @@ status = "disabled"; }; - /* Note: In the nRF Connect SDK another Bluetooth controller - * is added and set as the default. - */ + bt_hci_sdc: bt_hci_sdc { + compatible = "nordic,bt-hci-sdc"; + status = "okay"; + }; bt_hci_controller: bt_hci_controller { compatible = "zephyr,bt-hci-ll-sw-split"; - status = "okay"; + status = "disabled"; }; }; diff --git a/dts/arm/nordic/nrf52832.dtsi b/dts/arm/nordic/nrf52832.dtsi index 09a651762db6..776397ff14a5 100644 --- a/dts/arm/nordic/nrf52832.dtsi +++ b/dts/arm/nordic/nrf52832.dtsi @@ -7,7 +7,7 @@ / { chosen { - zephyr,bt-hci = &bt_hci_controller; + zephyr,bt-hci = &bt_hci_sdc; zephyr,entropy = &rng; zephyr,flash-controller = &flash_controller; }; @@ -110,12 +110,13 @@ status = "okay"; ble-2mbps-supported; - /* Note: In the nRF Connect SDK the SoftDevice Controller - * is added and set as the default Bluetooth Controller. - */ + bt_hci_sdc: bt_hci_sdc { + compatible = "nordic,bt-hci-sdc"; + status = "okay"; + }; bt_hci_controller: bt_hci_controller { compatible = "zephyr,bt-hci-ll-sw-split"; - status = "okay"; + status = "disabled"; }; }; diff --git a/dts/arm/nordic/nrf52833.dtsi b/dts/arm/nordic/nrf52833.dtsi index 87e6bccfb53d..647f56c5aa42 100644 --- a/dts/arm/nordic/nrf52833.dtsi +++ b/dts/arm/nordic/nrf52833.dtsi @@ -11,7 +11,7 @@ / { chosen { - zephyr,bt-hci = &bt_hci_controller; + zephyr,bt-hci = &bt_hci_sdc; zephyr,entropy = &rng; zephyr,flash-controller = &flash_controller; }; @@ -124,12 +124,13 @@ status = "disabled"; }; - /* Note: In the nRF Connect SDK the SoftDevice Controller - * is added and set as the default Bluetooth Controller. - */ + bt_hci_sdc: bt_hci_sdc { + compatible = "nordic,bt-hci-sdc"; + status = "okay"; + }; bt_hci_controller: bt_hci_controller { compatible = "zephyr,bt-hci-ll-sw-split"; - status = "okay"; + status = "disabled"; }; }; diff --git a/dts/arm/nordic/nrf52840.dtsi b/dts/arm/nordic/nrf52840.dtsi index b04b31a640dc..9d7027744bef 100644 --- a/dts/arm/nordic/nrf52840.dtsi +++ b/dts/arm/nordic/nrf52840.dtsi @@ -7,7 +7,7 @@ / { chosen { - zephyr,bt-hci = &bt_hci_controller; + zephyr,bt-hci = &bt_hci_sdc; zephyr,entropy = &cryptocell; zephyr,flash-controller = &flash_controller; }; @@ -112,12 +112,13 @@ status = "disabled"; }; - /* Note: In the nRF Connect SDK the SoftDevice Controller - * is added and set as the default Bluetooth Controller. - */ + bt_hci_sdc: bt_hci_sdc { + compatible = "nordic,bt-hci-sdc"; + status = "okay"; + }; bt_hci_controller: bt_hci_controller { compatible = "zephyr,bt-hci-ll-sw-split"; - status = "okay"; + status = "disabled"; }; }; diff --git a/dts/arm/nordic/nrf5340_cpunet.dtsi b/dts/arm/nordic/nrf5340_cpunet.dtsi index 5010f801e0c0..e80399b5770a 100644 --- a/dts/arm/nordic/nrf5340_cpunet.dtsi +++ b/dts/arm/nordic/nrf5340_cpunet.dtsi @@ -9,7 +9,7 @@ / { chosen { - zephyr,bt-hci = &bt_hci_controller; + zephyr,bt-hci = &bt_hci_sdc; zephyr,entropy = &rng; zephyr,flash-controller = &flash_controller; }; @@ -102,12 +102,13 @@ status = "disabled"; }; - /* Note: In the nRF Connect SDK the SoftDevice Controller - * is added and set as the default Bluetooth Controller. - */ + bt_hci_sdc: bt_hci_sdc { + compatible = "nordic,bt-hci-sdc"; + status = "okay"; + }; bt_hci_controller: bt_hci_controller { compatible = "zephyr,bt-hci-ll-sw-split"; - status = "okay"; + status = "disabled"; }; }; diff --git a/dts/arm/nordic/nrf54h20_cpurad.dtsi b/dts/arm/nordic/nrf54h20_cpurad.dtsi index eac16a3c14f3..2cde225beb01 100644 --- a/dts/arm/nordic/nrf54h20_cpurad.dtsi +++ b/dts/arm/nordic/nrf54h20_cpurad.dtsi @@ -32,7 +32,7 @@ wdt011: &cpurad_wdt011 {}; / { chosen { - zephyr,bt-hci = &bt_hci_controller; + zephyr,bt-hci = &bt_hci_sdc; }; soc { @@ -136,6 +136,6 @@ wdt011: &cpurad_wdt011 {}; status = "okay"; }; -&bt_hci_controller { +&bt_hci_sdc { status = "okay"; }; diff --git a/dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi b/dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi index a480edb41fdc..f4c673b1f516 100644 --- a/dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi +++ b/dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi @@ -17,7 +17,7 @@ nvic: &cpuapp_nvic {}; / { chosen { - zephyr,bt-hci = &bt_hci_controller; + zephyr,bt-hci = &bt_hci_sdc; zephyr,entropy = &psa_rng; }; @@ -38,7 +38,7 @@ nvic: &cpuapp_nvic {}; }; }; -&bt_hci_controller { +&bt_hci_sdc { status = "okay"; }; diff --git a/dts/vendor/nordic/nrf54h20.dtsi b/dts/vendor/nordic/nrf54h20.dtsi index b543373e1b35..b0d399d657cc 100644 --- a/dts/vendor/nordic/nrf54h20.dtsi +++ b/dts/vendor/nordic/nrf54h20.dtsi @@ -487,9 +487,10 @@ status = "disabled"; }; - /* Note: In the nRF Connect SDK the SoftDevice Controller - * is added and set as the default Bluetooth Controller. - */ + bt_hci_sdc: bt_hci_sdc { + compatible = "nordic,bt-hci-sdc"; + status = "disabled"; + }; bt_hci_controller: bt_hci_controller { compatible = "zephyr,bt-hci-ll-sw-split"; status = "disabled"; diff --git a/dts/vendor/nordic/nrf54l20.dtsi b/dts/vendor/nordic/nrf54l20.dtsi new file mode 100644 index 000000000000..bee70effa0e8 --- /dev/null +++ b/dts/vendor/nordic/nrf54l20.dtsi @@ -0,0 +1,852 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include + +/delete-node/ &sw_pwm; + +/* Domain IDs. Can be used to specify channel links in IPCT nodes. */ +#define NRF_DOMAIN_ID_APPLICATION 0 +#define NRF_DOMAIN_ID_FLPR 1 + +/ { + #address-cells = <1>; + #size-cells = <1>; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpuapp: cpu@0 { + compatible = "arm,cortex-m33f"; + reg = <0>; + device_type = "cpu"; + clocks = <&hfpll>; + #address-cells = <1>; + #size-cells = <1>; + + itm: itm@e0000000 { + compatible = "arm,armv8m-itm"; + reg = <0xe0000000 0x1000>; + swo-ref-frequency = ; + }; + }; + + cpuflpr: cpu@1 { + compatible = "nordic,vpr"; + reg = <1>; + device_type = "cpu"; + riscv,isa = "rv32emc"; + nordic,bus-width = <64>; + }; + }; + + clocks { + pclk: pclk { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = ; + }; + + pclk32m: pclk32m { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = ; + }; + + lfxo: lfxo { + compatible = "nordic,nrf54l-lfxo"; + #clock-cells = <0>; + clock-frequency = <32768>; + }; + + hfxo: hfxo { + compatible = "nordic,nrf54l-hfxo"; + #clock-cells = <0>; + clock-frequency = ; + startup-time-us = <1650>; + }; + + hfpll: hfpll { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = ; + }; + + aclk: aclk { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = ; + }; + }; + + soc { + #address-cells = <1>; + #size-cells = <1>; + + ficr: ficr@ffc000 { + compatible = "nordic,nrf-ficr"; + reg = <0xffc000 0x1000>; + #nordic,ficr-cells = <1>; + }; + + uicr: uicr@ffd000 { + compatible = "nordic,nrf-uicr"; + reg = <0xffd000 0x1000>; + }; + + cpuapp_sram: memory@20000000 { + compatible = "mmio-sram"; + reg = <0x20000000 DT_SIZE_K(447)>; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x20000000 0x6fc00>; + }; + + cpuflpr_sram: memory@2006fc00 { + compatible = "mmio-sram"; + reg = <0x2006fc00 DT_SIZE_K(64)>; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x2006fc00 0x10000>; + }; + + global_peripherals: peripheral@50000000 { + ranges = <0x0 0x50000000 0x10000000>; + #address-cells = <1>; + #size-cells = <1>; + + dppic00: dppic@42000 { + compatible = "nordic,nrf-dppic"; + reg = <0x42000 0x808>; + status = "disabled"; + }; + + ppib00: ppib@44000 { + compatible = "nordic,nrf-ppib"; + reg = <0x44000 0x1000>; + status = "disabled"; + }; + + ppib01: ppib@45000 { + compatible = "nordic,nrf-ppib"; + reg = <0x45000 0x1000>; + status = "disabled"; + }; + + cpuflpr_vpr: vpr@4c000 { + compatible = "nordic,nrf-vpr-coprocessor"; + reg = <0x4c000 0x1000>; + ranges = <0x0 0x4c000 0x1000>; + #address-cells = <1>; + #size-cells = <1>; + status = "disabled"; + enable-secure; + + cpuflpr_clic: interrupt-controller@f0000000 { + compatible = "nordic,nrf-clic"; + reg = <0xf0000000 0x143c>; + interrupt-controller; + #interrupt-cells = <2>; + #address-cells = <1>; + status = "disabled"; + }; + }; + + spi00: spi@4d000 { + /* + * This spi node can be either SPIM or SPIS, + * for the user to pick: + * compatible = "nordic,nrf-spim" or + * "nordic,nrf-spis". + */ + compatible = "nordic,nrf-spim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x4d000 0x1000>; + interrupts = <77 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + easydma-maxcnt-bits = <16>; + rx-delay-supported; + rx-delay = <1>; + status = "disabled"; + }; + + uart00: uart@4d000 { + compatible = "nordic,nrf-uarte"; + reg = <0x4d000 0x1000>; + interrupts = <77 NRF_DEFAULT_IRQ_PRIORITY>; + clocks = <&hfpll>; + status = "disabled"; + endtx-stoptx-supported; + frame-timeout-supported; + }; + + gpio2: gpio@50400 { + compatible = "nordic,nrf-gpio"; + gpio-controller; + reg = <0x50400 0x300>; + #gpio-cells = <2>; + ngpios = <11>; + status = "disabled"; + port = <2>; + }; + + timer00: timer@55000 { + compatible = "nordic,nrf-timer"; + status = "disabled"; + reg = <0x55000 0x1000>; + cc-num = <6>; + max-bit-width = <32>; + interrupts = <85 NRF_DEFAULT_IRQ_PRIORITY>; + clocks = <&hfpll>; + prescaler = <0>; + }; + + dppic10: dppic@82000 { + compatible = "nordic,nrf-dppic"; + reg = <0x82000 0x808>; + status = "disabled"; + }; + + ppib10: ppib@83000 { + compatible = "nordic,nrf-ppib"; + reg = <0x83000 0x1000>; + status = "disabled"; + }; + + ppib11: ppib@84000 { + compatible = "nordic,nrf-ppib"; + reg = <0x84000 0x1000>; + status = "disabled"; + }; + + timer10: timer@85000 { + compatible = "nordic,nrf-timer"; + status = "disabled"; + reg = <0x85000 0x1000>; + cc-num = <8>; + max-bit-width = <32>; + interrupts = <133 NRF_DEFAULT_IRQ_PRIORITY>; + clocks = <&hfxo>; + prescaler = <0>; + }; + + egu10: egu@87000 { + compatible = "nordic,nrf-egu"; + reg = <0x87000 0x1000>; + interrupts = <135 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + + radio: radio@8a000 { + compatible = "nordic,nrf-radio"; + reg = <0x8a000 0x1000>; + interrupts = <138 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + dfe-supported; + ieee802154-supported; + ble-2mbps-supported; + ble-coded-phy-supported; + cs-supported; + + ieee802154: ieee802154 { + compatible = "nordic,nrf-ieee802154"; + status = "disabled"; + }; + + bt_hci_sdc: bt_hci_sdc { + compatible = "nordic,bt-hci-sdc"; + status = "disabled"; + }; + bt_hci_controller: bt_hci_controller { + compatible = "zephyr,bt-hci-ll-sw-split"; + status = "disabled"; + }; + }; + + dppic20: dppic@c2000 { + compatible = "nordic,nrf-dppic"; + reg = <0xc2000 0x808>; + status = "disabled"; + }; + + ppib20: ppib@c3000 { + compatible = "nordic,nrf-ppib"; + reg = <0xc3000 0x1000>; + status = "disabled"; + }; + + ppib21: ppib@c4000 { + compatible = "nordic,nrf-ppib"; + reg = <0xc4000 0x1000>; + status = "disabled"; + }; + + ppib22: ppib@c5000 { + compatible = "nordic,nrf-ppib"; + reg = <0xc5000 0x1000>; + status = "disabled"; + }; + + i2c20: i2c@c6000 { + compatible = "nordic,nrf-twim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xc6000 0x1000>; + interrupts = <198 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <16>; + status = "disabled"; + zephyr,pm-device-runtime-auto; + }; + + spi20: spi@c6000 { + /* + * This spi node can be either SPIM or SPIS, + * for the user to pick: + * compatible = "nordic,nrf-spim" or + * "nordic,nrf-spis". + */ + compatible = "nordic,nrf-spim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xc6000 0x1000>; + interrupts = <198 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + easydma-maxcnt-bits = <16>; + rx-delay-supported; + rx-delay = <1>; + status = "disabled"; + }; + + uart20: uart@c6000 { + compatible = "nordic,nrf-uarte"; + reg = <0xc6000 0x1000>; + interrupts = <198 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + endtx-stoptx-supported; + frame-timeout-supported; + }; + + i2c21: i2c@c7000 { + compatible = "nordic,nrf-twim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xc7000 0x1000>; + interrupts = <199 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <16>; + status = "disabled"; + zephyr,pm-device-runtime-auto; + }; + + spi21: spi@c7000 { + /* + * This spi node can be either SPIM or SPIS, + * for the user to pick: + * compatible = "nordic,nrf-spim" or + * "nordic,nrf-spis". + */ + compatible = "nordic,nrf-spim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xc7000 0x1000>; + interrupts = <199 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + easydma-maxcnt-bits = <16>; + rx-delay-supported; + rx-delay = <1>; + status = "disabled"; + }; + + uart21: uart@c7000 { + compatible = "nordic,nrf-uarte"; + reg = <0xc7000 0x1000>; + interrupts = <199 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + endtx-stoptx-supported; + frame-timeout-supported; + }; + + i2c22: i2c@c8000 { + compatible = "nordic,nrf-twim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xc8000 0x1000>; + interrupts = <200 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <16>; + status = "disabled"; + zephyr,pm-device-runtime-auto; + }; + + spi22: spi@c8000 { + /* + * This spi node can be either SPIM or SPIS, + * for the user to pick: + * compatible = "nordic,nrf-spim" or + * "nordic,nrf-spis". + */ + compatible = "nordic,nrf-spim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xc8000 0x1000>; + interrupts = <200 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + easydma-maxcnt-bits = <16>; + rx-delay-supported; + rx-delay = <1>; + status = "disabled"; + }; + + uart22: uart@c8000 { + compatible = "nordic,nrf-uarte"; + reg = <0xc8000 0x1000>; + interrupts = <200 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + endtx-stoptx-supported; + frame-timeout-supported; + }; + + egu20: egu@c9000 { + compatible = "nordic,nrf-egu"; + reg = <0xc9000 0x1000>; + interrupts = <201 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + + timer20: timer@ca000 { + compatible = "nordic,nrf-timer"; + status = "disabled"; + reg = <0xca000 0x1000>; + cc-num = <6>; + max-bit-width = <32>; + interrupts = <202 NRF_DEFAULT_IRQ_PRIORITY>; + prescaler = <0>; + }; + + timer21: timer@cb000 { + compatible = "nordic,nrf-timer"; + status = "disabled"; + reg = <0xcb000 0x1000>; + cc-num = <6>; + max-bit-width = <32>; + interrupts = <203 NRF_DEFAULT_IRQ_PRIORITY>; + prescaler = <0>; + }; + + timer22: timer@cc000 { + compatible = "nordic,nrf-timer"; + status = "disabled"; + reg = <0xcc000 0x1000>; + cc-num = <6>; + max-bit-width = <32>; + interrupts = <204 NRF_DEFAULT_IRQ_PRIORITY>; + prescaler = <0>; + }; + + timer23: timer@cd000 { + compatible = "nordic,nrf-timer"; + status = "disabled"; + reg = <0xcd000 0x1000>; + cc-num = <6>; + max-bit-width = <32>; + interrupts = <205 NRF_DEFAULT_IRQ_PRIORITY>; + prescaler = <0>; + }; + + timer24: timer@ce000 { + compatible = "nordic,nrf-timer"; + status = "disabled"; + reg = <0xce000 0x1000>; + cc-num = <6>; + max-bit-width = <32>; + interrupts = <206 NRF_DEFAULT_IRQ_PRIORITY>; + prescaler = <0>; + }; + + pdm20: pdm@d0000 { + compatible = "nordic,nrf-pdm"; + status = "disabled"; + reg = <0xd0000 0x1000>; + interrupts = <208 NRF_DEFAULT_IRQ_PRIORITY>; + }; + + pdm21: pdm@d1000 { + compatible = "nordic,nrf-pdm"; + status = "disabled"; + reg = <0xd1000 0x1000>; + interrupts = <209 NRF_DEFAULT_IRQ_PRIORITY>; + }; + + pwm20: pwm@d2000 { + compatible = "nordic,nrf-pwm"; + status = "disabled"; + reg = <0xd2000 0x1000>; + interrupts = <210 NRF_DEFAULT_IRQ_PRIORITY>; + #pwm-cells = <3>; + idleout-supported; + }; + + pwm21: pwm@d3000 { + compatible = "nordic,nrf-pwm"; + status = "disabled"; + reg = <0xd3000 0x1000>; + interrupts = <211 NRF_DEFAULT_IRQ_PRIORITY>; + #pwm-cells = <3>; + idleout-supported; + }; + + pwm22: pwm@d4000 { + compatible = "nordic,nrf-pwm"; + status = "disabled"; + reg = <0xd4000 0x1000>; + interrupts = <212 NRF_DEFAULT_IRQ_PRIORITY>; + #pwm-cells = <3>; + idleout-supported; + }; + + adc: adc@d5000 { + compatible = "nordic,nrf-saadc"; + reg = <0xd5000 0x1000>; + interrupts = <213 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + #io-channel-cells = <1>; + zephyr,pm-device-runtime-auto; + }; + + nfct: nfct@d6000 { + compatible = "nordic,nrf-nfct"; + reg = <0xd6000 0x1000>; + interrupts = <214 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + + temp: temp@d7000 { + compatible = "nordic,nrf-temp"; + reg = <0xd7000 0x1000>; + interrupts = <215 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + + gpio1: gpio@d8200 { + compatible = "nordic,nrf-gpio"; + gpio-controller; + reg = <0xd8200 0x300>; + #gpio-cells = <2>; + ngpios = <16>; + status = "disabled"; + port = <1>; + gpiote-instance = <&gpiote20>; + }; + + gpiote20: gpiote@da000 { + compatible = "nordic,nrf-gpiote"; + reg = <0xda000 0x1000>; + status = "disabled"; + instance = <20>; + }; + + qdec20: qdec@e0000 { + compatible = "nordic,nrf-qdec"; + reg = <0xe0000 0x1000>; + interrupts = <224 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + + qdec21: qdec@e1000 { + compatible = "nordic,nrf-qdec"; + reg = <0xe1000 0x1000>; + interrupts = <225 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + + grtc: grtc@e2000 { + compatible = "nordic,nrf-grtc"; + reg = <0xe2000 0x1000>; + cc-num = <12>; + clocks = <&lfxo>, <&pclk>; + clock-names = "lfclock", "hfclock"; + status = "disabled"; + }; + + tdm: tdm@e8000 { + compatible = "nordic,nrf-tdm"; + easydma-maxcnt-bits = <15>; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xe8000 0x1000>; + interrupts = <232 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + clocks = <&pclk32m>; + }; + + i2c23: i2c@ed000 { + compatible = "nordic,nrf-twim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xed000 0x1000>; + interrupts = <237 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <16>; + status = "disabled"; + zephyr,pm-device-runtime-auto; + }; + + spi23: spi@ed000 { + /* + * This spi node can be either SPIM or SPIS, + * for the user to pick: + * compatible = "nordic,nrf-spim" or + * "nordic,nrf-spis". + */ + compatible = "nordic,nrf-spim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xed000 0x1000>; + interrupts = <237 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + easydma-maxcnt-bits = <16>; + rx-delay-supported; + rx-delay = <1>; + status = "disabled"; + }; + + uart23: uart@ed000 { + compatible = "nordic,nrf-uarte"; + reg = <0xed000 0x1000>; + interrupts = <237 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + endtx-stoptx-supported; + frame-timeout-supported; + }; + + i2c24: i2c@ee000 { + compatible = "nordic,nrf-twim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xee000 0x1000>; + interrupts = <238 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <16>; + status = "disabled"; + zephyr,pm-device-runtime-auto; + }; + + spi24: spi@ee000 { + /* + * This spi node can be either SPIM or SPIS, + * for the user to pick: + * compatible = "nordic,nrf-spim" or + * "nordic,nrf-spis". + */ + compatible = "nordic,nrf-spim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xee000 0x1000>; + interrupts = <238 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + easydma-maxcnt-bits = <16>; + rx-delay-supported; + rx-delay = <1>; + status = "disabled"; + }; + + uart24: uart@ee000 { + compatible = "nordic,nrf-uarte"; + reg = <0xee000 0x1000>; + interrupts = <238 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + endtx-stoptx-supported; + frame-timeout-supported; + }; + + dppic30: dppic@102000 { + compatible = "nordic,nrf-dppic"; + reg = <0x102000 0x808>; + status = "disabled"; + }; + + ppib30: ppib@103000 { + compatible = "nordic,nrf-ppib"; + reg = <0x103000 0x1000>; + status = "disabled"; + }; + + i2c30: i2c@104000 { + compatible = "nordic,nrf-twim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x104000 0x1000>; + interrupts = <260 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <16>; + status = "disabled"; + zephyr,pm-device-runtime-auto; + }; + + spi30: spi@104000 { + /* + * This spi node can be either SPIM or SPIS, + * for the user to pick: + * compatible = "nordic,nrf-spim" or + * "nordic,nrf-spis". + */ + compatible = "nordic,nrf-spim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x104000 0x1000>; + interrupts = <260 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + easydma-maxcnt-bits = <16>; + rx-delay-supported; + rx-delay = <1>; + status = "disabled"; + }; + + uart30: uart@104000 { + compatible = "nordic,nrf-uarte"; + reg = <0x104000 0x1000>; + interrupts = <260 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + endtx-stoptx-supported; + frame-timeout-supported; + }; + + comp: comparator@106000 { + /* + * Use compatible "nordic,nrf-comp" to configure as COMP + * Use compatible "nordic,nrf-lpcomp" to configure as LPCOMP + */ + compatible = "nordic,nrf-comp"; + reg = <0x106000 0x1000>; + status = "disabled"; + interrupts = <262 NRF_DEFAULT_IRQ_PRIORITY>; + }; + + wdt30: watchdog@108000 { + compatible = "nordic,nrf-wdt"; + reg = <0x108000 0x620>; + interrupts = <264 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + + wdt31: watchdog@109000 { + compatible = "nordic,nrf-wdt"; + reg = <0x109000 0x620>; + interrupts = <265 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + + gpio0: gpio@10a000 { + compatible = "nordic,nrf-gpio"; + gpio-controller; + reg = <0x10a000 0x300>; + #gpio-cells = <2>; + ngpios = <5>; + status = "disabled"; + port = <0>; + gpiote-instance = <&gpiote30>; + }; + + gpiote30: gpiote@10c000 { + compatible = "nordic,nrf-gpiote"; + reg = <0x10c000 0x1000>; + status = "disabled"; + instance = <30>; + }; + + clock: clock@10e000 { + compatible = "nordic,nrf-clock"; + reg = <0x10e000 0x1000>; + interrupts = <270 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + + power: power@10e000 { + compatible = "nordic,nrf-power"; + reg = <0x10e000 0x1000>; + ranges = <0x0 0x10e000 0x1000>; + interrupts = <270 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + #address-cells = <1>; + #size-cells = <1>; + + gpregret1: gpregret1@51c { + #address-cells = <1>; + #size-cells = <1>; + compatible = "nordic,nrf-gpregret"; + reg = <0x51c 0x1>; + status = "disabled"; + }; + + gpregret2: gpregret2@520 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "nordic,nrf-gpregret"; + reg = <0x520 0x1>; + status = "disabled"; + }; + }; + + regulators: regulator@120000 { + compatible = "nordic,nrf54l-regulators"; + reg = <0x120000 0x1000>; + status = "disabled"; + #address-cells = <1>; + #size-cells = <1>; + + vregmain: regulator@120600 { + compatible = "nordic,nrf5x-regulator"; + reg = <0x120600 0x1>; + status = "disabled"; + regulator-name = "VREGMAIN"; + regulator-initial-mode = ; + }; + }; + }; + + rram_controller: rram-controller@5004e000 { + compatible = "nordic,rram-controller"; + reg = <0x5004e000 0x1000>; + interrupts = <78 NRF_DEFAULT_IRQ_PRIORITY>; + #address-cells = <1>; + #size-cells = <1>; + + cpuapp_rram: rram@0 { + compatible = "soc-nv-flash"; + reg = <0x0 DT_SIZE_K(1972)>; + erase-block-size = <4096>; + write-block-size = <16>; + }; + + cpuflpr_rram: rram@1ed000 { + compatible = "soc-nv-flash"; + reg = <0x1ed000 DT_SIZE_K(64)>; + erase-block-size = <4096>; + write-block-size = <16>; + }; + }; + + cpuapp_ppb: cpuapp-ppb-bus { + #address-cells = <1>; + #size-cells = <1>; + + cpuapp_nvic: interrupt-controller@e000e100 { + #address-cells = <1>; + compatible = "arm,v8m-nvic"; + reg = <0xe000e100 0xc00>; + arm,num-irq-priority-bits = <3>; + interrupt-controller; + #interrupt-cells = <2>; + }; + + cpuapp_systick: timer@e000e010 { + compatible = "arm,armv8m-systick"; + reg = <0xe000e010 0x10>; + status = "disabled"; + }; + }; + }; +}; diff --git a/dts/vendor/nordic/nrf54l_05_10_15.dtsi b/dts/vendor/nordic/nrf54l_05_10_15.dtsi index 4d15eebe8d02..1cc8314aecca 100644 --- a/dts/vendor/nordic/nrf54l_05_10_15.dtsi +++ b/dts/vendor/nordic/nrf54l_05_10_15.dtsi @@ -252,9 +252,11 @@ status = "disabled"; }; - /* Note: In the nRF Connect SDK the SoftDevice Controller - * is added and set as the default Bluetooth Controller. - */ + bt_hci_sdc: bt_hci_sdc { + compatible = "nordic,bt-hci-sdc"; + status = "disabled"; + }; + bt_hci_controller: bt_hci_controller { compatible = "zephyr,bt-hci-ll-sw-split"; status = "disabled"; diff --git a/samples/bluetooth/bap_broadcast_sink/sample.yaml b/samples/bluetooth/bap_broadcast_sink/sample.yaml index 5d06dee0bf89..148b8b641697 100644 --- a/samples/bluetooth/bap_broadcast_sink/sample.yaml +++ b/samples/bluetooth/bap_broadcast_sink/sample.yaml @@ -24,5 +24,7 @@ tests: - nrf52_bsim - nrf52833dk/nrf52833 - nrf52840dongle/nrf52840 - extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf + extra_args: + - EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf + - SNIPPET="bt-ll-sw-split" tags: bluetooth diff --git a/samples/bluetooth/bap_broadcast_sink/sysbuild.cmake b/samples/bluetooth/bap_broadcast_sink/sysbuild.cmake index 2523aac8ea76..d5d260789ff7 100644 --- a/samples/bluetooth/bap_broadcast_sink/sysbuild.cmake +++ b/samples/bluetooth/bap_broadcast_sink/sysbuild.cmake @@ -18,6 +18,10 @@ if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) CACHE INTERNAL "" ) + list(APPEND ${NET_APP}_SNIPPET ${SNIPPET}) + list(APPEND ${NET_APP}_SNIPPET bt-ll-sw-split) + set(${NET_APP}_SNIPPET ${${NET_APP}_SNIPPET} CACHE STRING "" FORCE) + native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) endif() diff --git a/samples/bluetooth/bap_broadcast_source/sample.yaml b/samples/bluetooth/bap_broadcast_source/sample.yaml index 5e5b01d942d0..5f745cd08950 100644 --- a/samples/bluetooth/bap_broadcast_source/sample.yaml +++ b/samples/bluetooth/bap_broadcast_source/sample.yaml @@ -36,5 +36,7 @@ tests: - nrf52_bsim - nrf52833dk/nrf52833 - nrf52840dongle/nrf52840 - extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf + extra_args: + - EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf + - SNIPPET="bt-ll-sw-split" tags: bluetooth diff --git a/samples/bluetooth/bap_broadcast_source/sysbuild.cmake b/samples/bluetooth/bap_broadcast_source/sysbuild.cmake index 2523aac8ea76..d5d260789ff7 100644 --- a/samples/bluetooth/bap_broadcast_source/sysbuild.cmake +++ b/samples/bluetooth/bap_broadcast_source/sysbuild.cmake @@ -18,6 +18,10 @@ if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) CACHE INTERNAL "" ) + list(APPEND ${NET_APP}_SNIPPET ${SNIPPET}) + list(APPEND ${NET_APP}_SNIPPET bt-ll-sw-split) + set(${NET_APP}_SNIPPET ${${NET_APP}_SNIPPET} CACHE STRING "" FORCE) + native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) endif() diff --git a/samples/bluetooth/bap_unicast_client/sample.yaml b/samples/bluetooth/bap_unicast_client/sample.yaml index 7283090b8781..44f32934ce99 100644 --- a/samples/bluetooth/bap_unicast_client/sample.yaml +++ b/samples/bluetooth/bap_unicast_client/sample.yaml @@ -22,5 +22,7 @@ tests: - nrf52840dk/nrf52840 integration_platforms: - nrf52dk/nrf52832 - extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf + extra_args: + - EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf + - SNIPPET="bt-ll-sw-split" tags: bluetooth diff --git a/samples/bluetooth/bap_unicast_client/sysbuild.cmake b/samples/bluetooth/bap_unicast_client/sysbuild.cmake index 2523aac8ea76..d5d260789ff7 100644 --- a/samples/bluetooth/bap_unicast_client/sysbuild.cmake +++ b/samples/bluetooth/bap_unicast_client/sysbuild.cmake @@ -18,6 +18,10 @@ if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) CACHE INTERNAL "" ) + list(APPEND ${NET_APP}_SNIPPET ${SNIPPET}) + list(APPEND ${NET_APP}_SNIPPET bt-ll-sw-split) + set(${NET_APP}_SNIPPET ${${NET_APP}_SNIPPET} CACHE STRING "" FORCE) + native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) endif() diff --git a/samples/bluetooth/bap_unicast_server/sample.yaml b/samples/bluetooth/bap_unicast_server/sample.yaml index 068f752b626b..266ced73f66d 100644 --- a/samples/bluetooth/bap_unicast_server/sample.yaml +++ b/samples/bluetooth/bap_unicast_server/sample.yaml @@ -22,5 +22,7 @@ tests: - nrf52840dk/nrf52840 integration_platforms: - nrf52dk/nrf52832 - extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf + extra_args: + - EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf + - SNIPPET="bt-ll-sw-split" tags: bluetooth diff --git a/samples/bluetooth/bap_unicast_server/sysbuild.cmake b/samples/bluetooth/bap_unicast_server/sysbuild.cmake index 2523aac8ea76..d5d260789ff7 100644 --- a/samples/bluetooth/bap_unicast_server/sysbuild.cmake +++ b/samples/bluetooth/bap_unicast_server/sysbuild.cmake @@ -18,6 +18,10 @@ if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) CACHE INTERNAL "" ) + list(APPEND ${NET_APP}_SNIPPET ${SNIPPET}) + list(APPEND ${NET_APP}_SNIPPET bt-ll-sw-split) + set(${NET_APP}_SNIPPET ${${NET_APP}_SNIPPET} CACHE STRING "" FORCE) + native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) endif() diff --git a/samples/bluetooth/beacon/sample.yaml b/samples/bluetooth/beacon/sample.yaml index 23ffad73c796..00215341924f 100644 --- a/samples/bluetooth/beacon/sample.yaml +++ b/samples/bluetooth/beacon/sample.yaml @@ -20,7 +20,9 @@ tests: - ophelia4ev/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp sample.bluetooth.beacon-coex: - extra_args: CONF_FILE="prj-coex.conf" + extra_args: + - CONF_FILE="prj-coex.conf" + - SNIPPET="bt-ll-sw-split" harness: bluetooth platform_allow: - nrf52840dk/nrf52840 diff --git a/samples/bluetooth/cap_acceptor/sample.yaml b/samples/bluetooth/cap_acceptor/sample.yaml index 824e744eecaf..9061f44679fb 100644 --- a/samples/bluetooth/cap_acceptor/sample.yaml +++ b/samples/bluetooth/cap_acceptor/sample.yaml @@ -26,5 +26,7 @@ tests: - nrf52833dk/nrf52833 - nrf52840dk/nrf52840 - nrf52840dongle/nrf52840 - extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf + extra_args: + - EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf + - SNIPPET="bt-ll-sw-split" tags: bluetooth diff --git a/samples/bluetooth/cap_acceptor/sysbuild.cmake b/samples/bluetooth/cap_acceptor/sysbuild.cmake index 2523aac8ea76..d5d260789ff7 100644 --- a/samples/bluetooth/cap_acceptor/sysbuild.cmake +++ b/samples/bluetooth/cap_acceptor/sysbuild.cmake @@ -18,6 +18,10 @@ if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) CACHE INTERNAL "" ) + list(APPEND ${NET_APP}_SNIPPET ${SNIPPET}) + list(APPEND ${NET_APP}_SNIPPET bt-ll-sw-split) + set(${NET_APP}_SNIPPET ${${NET_APP}_SNIPPET} CACHE STRING "" FORCE) + native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) endif() diff --git a/samples/bluetooth/cap_initiator/sample.yaml b/samples/bluetooth/cap_initiator/sample.yaml index b4f593c99129..e3e557f48301 100644 --- a/samples/bluetooth/cap_initiator/sample.yaml +++ b/samples/bluetooth/cap_initiator/sample.yaml @@ -26,5 +26,7 @@ tests: - nrf52833dk/nrf52833 - nrf52840dk/nrf52840 - nrf52840dongle/nrf52840 - extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf + extra_args: + - EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf + - SNIPPET="bt-ll-sw-split" tags: bluetooth diff --git a/samples/bluetooth/cap_initiator/sysbuild.cmake b/samples/bluetooth/cap_initiator/sysbuild.cmake index 2523aac8ea76..d5d260789ff7 100644 --- a/samples/bluetooth/cap_initiator/sysbuild.cmake +++ b/samples/bluetooth/cap_initiator/sysbuild.cmake @@ -18,6 +18,10 @@ if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) CACHE INTERNAL "" ) + list(APPEND ${NET_APP}_SNIPPET ${SNIPPET}) + list(APPEND ${NET_APP}_SNIPPET bt-ll-sw-split) + set(${NET_APP}_SNIPPET ${${NET_APP}_SNIPPET} CACHE STRING "" FORCE) + native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) endif() diff --git a/samples/bluetooth/direction_finding_central/sample.yaml b/samples/bluetooth/direction_finding_central/sample.yaml index b7a118e6cdc8..ffdf634c6e3e 100644 --- a/samples/bluetooth/direction_finding_central/sample.yaml +++ b/samples/bluetooth/direction_finding_central/sample.yaml @@ -14,15 +14,24 @@ tests: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 - nrf5340dk/nrf5340/cpuapp - sample.bluetooth.direction_finding.central.aod: + sample.bluetooth.direction_finding.central.aod_with_controller: harness: bluetooth - extra_args: EXTRA_CONF_FILE="overlay-aod.conf" + extra_args: + - EXTRA_CONF_FILE="overlay-aod.conf" + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 - - nrf5340dk/nrf5340/cpuapp tags: bluetooth integration_platforms: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 + sample.bluetooth.direction_finding.central.aod_host_only: + harness: bluetooth + extra_args: + - OVERLAY_CONFIG="overlay-aod.conf" + platform_allow: + - nrf5340dk/nrf5340/cpuapp + tags: bluetooth + integration_platforms: - nrf5340dk/nrf5340/cpuapp diff --git a/samples/bluetooth/direction_finding_connectionless_rx/sample.yaml b/samples/bluetooth/direction_finding_connectionless_rx/sample.yaml index 8e6097de58ae..c500cc80dcec 100644 --- a/samples/bluetooth/direction_finding_connectionless_rx/sample.yaml +++ b/samples/bluetooth/direction_finding_connectionless_rx/sample.yaml @@ -12,14 +12,22 @@ tests: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 - nrf5340dk/nrf5340/cpuapp - sample.bluetooth.direction_finding_connectionless_rx.aod: + sample.bluetooth.direction_finding_connectionless_rx.aod_with_controller: harness: bluetooth - extra_args: EXTRA_CONF_FILE="overlay-aod.conf" + extra_args: + - EXTRA_CONF_FILE="overlay-aod.conf" + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 - - nrf5340dk/nrf5340/cpuapp integration_platforms: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 + sample.bluetooth.direction_finding_connectionless_rx.aod_host_only: + harness: bluetooth + extra_args: + - OVERLAY_CONFIG="overlay-aod.conf" + platform_allow: + - nrf5340dk/nrf5340/cpuapp + integration_platforms: - nrf5340dk/nrf5340/cpuapp diff --git a/samples/bluetooth/direction_finding_connectionless_tx/sample.yaml b/samples/bluetooth/direction_finding_connectionless_tx/sample.yaml index 78d21b2c95f5..2a4fa93d19d5 100644 --- a/samples/bluetooth/direction_finding_connectionless_tx/sample.yaml +++ b/samples/bluetooth/direction_finding_connectionless_tx/sample.yaml @@ -12,14 +12,22 @@ tests: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 - nrf5340dk/nrf5340/cpuapp - sample.bluetooth.direction_finding_connectionless.aoa: + sample.bluetooth.direction_finding_connectionless.aoa_with_controller: harness: bluetooth - extra_args: EXTRA_CONF_FILE="overlay-aoa.conf" + extra_args: + - EXTRA_CONF_FILE="overlay-aoa.conf" + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 - - nrf5340dk/nrf5340/cpuapp integration_platforms: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 + sample.bluetooth.direction_finding_connectionless.aoa_host_only: + harness: bluetooth + extra_args: + - OVERLAY_CONFIG="overlay-aoa.conf" + platform_allow: + - nrf5340dk/nrf5340/cpuapp + integration_platforms: - nrf5340dk/nrf5340/cpuapp diff --git a/samples/bluetooth/direction_finding_peripheral/sample.yaml b/samples/bluetooth/direction_finding_peripheral/sample.yaml index f300cb415cc5..01f612ad08a0 100644 --- a/samples/bluetooth/direction_finding_peripheral/sample.yaml +++ b/samples/bluetooth/direction_finding_peripheral/sample.yaml @@ -14,15 +14,24 @@ tests: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 - nrf5340dk/nrf5340/cpuapp - sample.bluetooth.direction_finding.peripheral.aod: + sample.bluetooth.direction_finding.peripheral.aod_with_controller: harness: bluetooth - extra_args: EXTRA_CONF_FILE="overlay-aoa.conf" + extra_args: + - EXTRA_CONF_FILE="overlay-aoa.conf" + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 - - nrf5340dk/nrf5340/cpuapp tags: bluetooth integration_platforms: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 + sample.bluetooth.direction_finding.peripheral.aod_host_only: + harness: bluetooth + extra_args: + - OVERLAY_CONFIG="overlay-aoa.conf" + platform_allow: + - nrf5340dk/nrf5340/cpuapp + tags: bluetooth + integration_platforms: - nrf5340dk/nrf5340/cpuapp diff --git a/samples/bluetooth/hci_ipc/sample.yaml b/samples/bluetooth/hci_ipc/sample.yaml index b758b2547688..3763478b6b33 100644 --- a/samples/bluetooth/hci_ipc/sample.yaml +++ b/samples/bluetooth/hci_ipc/sample.yaml @@ -15,7 +15,9 @@ tests: sample.bluetooth.hci_ipc.iso_broadcast.bt_ll_sw_split: harness: bluetooth tags: bluetooth - extra_args: CONF_FILE="nrf5340_cpunet_iso_broadcast-bt_ll_sw_split.conf" + extra_args: + - CONF_FILE="nrf5340_cpunet_iso_broadcast-bt_ll_sw_split.conf" + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf5340dk/nrf5340/cpunet - nrf5340_audio_dk/nrf5340/cpunet @@ -25,7 +27,9 @@ tests: sample.bluetooth.hci_ipc.iso_receive.bt_ll_sw_split: harness: bluetooth tags: bluetooth - extra_args: CONF_FILE="nrf5340_cpunet_iso_receive-bt_ll_sw_split.conf" + extra_args: + - CONF_FILE="nrf5340_cpunet_iso_receive-bt_ll_sw_split.conf" + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf5340dk/nrf5340/cpunet - nrf5340_audio_dk/nrf5340/cpunet @@ -35,7 +39,9 @@ tests: sample.bluetooth.hci_ipc.bis.bt_ll_sw_split: harness: bluetooth tags: bluetooth - extra_args: CONF_FILE="nrf5340_cpunet_bis-bt_ll_sw_split.conf" + extra_args: + - CONF_FILE="nrf5340_cpunet_bis-bt_ll_sw_split.conf" + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf5340dk/nrf5340/cpunet - nrf5340_audio_dk/nrf5340/cpunet @@ -45,7 +51,9 @@ tests: sample.bluetooth.hci_ipc.iso_central.bt_ll_sw_split: harness: bluetooth tags: bluetooth - extra_args: CONF_FILE="nrf5340_cpunet_iso_central-bt_ll_sw_split.conf" + extra_args: + - CONF_FILE="nrf5340_cpunet_iso_central-bt_ll_sw_split.conf" + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf5340dk/nrf5340/cpunet - nrf5340_audio_dk/nrf5340/cpunet @@ -55,7 +63,9 @@ tests: sample.bluetooth.hci_ipc.iso_peripheral.bt_ll_sw_split: harness: bluetooth tags: bluetooth - extra_args: CONF_FILE="nrf5340_cpunet_iso_peripheral-bt_ll_sw_split.conf" + extra_args: + - CONF_FILE="nrf5340_cpunet_iso_peripheral-bt_ll_sw_split.conf" + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf5340dk/nrf5340/cpunet - nrf5340_audio_dk/nrf5340/cpunet @@ -65,7 +75,9 @@ tests: sample.bluetooth.hci_ipc.cis.bt_ll_sw_split: harness: bluetooth tags: bluetooth - extra_args: CONF_FILE="nrf5340_cpunet_cis-bt_ll_sw_split.conf" + extra_args: + - CONF_FILE="nrf5340_cpunet_cis-bt_ll_sw_split.conf" + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf5340dk/nrf5340/cpunet - nrf5340_audio_dk/nrf5340/cpunet @@ -75,7 +87,9 @@ tests: sample.bluetooth.hci_ipc.iso.bt_ll_sw_split: harness: bluetooth tags: bluetooth - extra_args: CONF_FILE="nrf5340_cpunet_iso-bt_ll_sw_split.conf" + extra_args: + - CONF_FILE="nrf5340_cpunet_iso-bt_ll_sw_split.conf" + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf5340dk/nrf5340/cpunet - nrf5340_audio_dk/nrf5340/cpunet @@ -99,6 +113,7 @@ tests: extra_args: - CONF_FILE="nrf5340_cpunet_df-bt_ll_sw_split.conf" - DTC_OVERLAY_FILE="nrf5340_cpunet_df-bt_ll_sw_split.overlay" + - SNIPPET="bt-ll-sw-split" platform_allow: nrf5340dk/nrf5340/cpunet integration_platforms: - nrf5340dk/nrf5340/cpunet @@ -109,13 +124,16 @@ tests: - CONF_FILE="nrf5340_cpunet_df-bt_ll_sw_split.conf" - DTC_OVERLAY_FILE="nrf5340_cpunet_df-bt_ll_sw_split.overlay" - CONFIG_BT_CTLR_PHY_CODED=n + - SNIPPET="bt-ll-sw-split" platform_allow: nrf5340dk/nrf5340/cpunet integration_platforms: - nrf5340dk/nrf5340/cpunet sample.bluetooth.hci_ipc.mesh.bt_ll_sw_split: harness: bluetooth tags: bluetooth - extra_args: CONF_FILE="nrf5340_cpunet_bt_mesh-bt_ll_sw_split.conf" + extra_args: + - CONF_FILE="nrf5340_cpunet_bt_mesh-bt_ll_sw_split.conf" + - SNIPPET="bt-ll-sw-split" platform_allow: nrf5340dk/nrf5340/cpunet integration_platforms: - nrf5340dk/nrf5340/cpunet diff --git a/samples/bluetooth/hci_uart/sample.yaml b/samples/bluetooth/hci_uart/sample.yaml index df2b40135c67..8555c65cf0df 100644 --- a/samples/bluetooth/hci_uart/sample.yaml +++ b/samples/bluetooth/hci_uart/sample.yaml @@ -24,7 +24,9 @@ tests: platform_allow: nrf52833dk/nrf52833 integration_platforms: - nrf52833dk/nrf52833 - extra_args: DTC_OVERLAY_FILE=./boards/nrf52833dk_nrf52833_df.overlay + extra_args: + - DTC_OVERLAY_FILE=./boards/nrf52833dk_nrf52833_df.overlay + - SNIPPET="bt-ll-sw-split" extra_configs: - CONFIG_BT_CTLR_DF=y tags: @@ -33,7 +35,9 @@ tests: sample.bluetooth.hci_uart.nrf5340_netcore.df: harness: bluetooth platform_allow: nrf5340dk/nrf5340/cpunet - extra_args: DTC_OVERLAY_FILE=./boards/nrf5340dk_nrf5340_cpunet_df.overlay + extra_args: + - DTC_OVERLAY_FILE=./boards/nrf5340dk_nrf5340_cpunet_df.overlay + - SNIPPET="bt-ll-sw-split" extra_configs: - CONFIG_BT_CTLR_DF=y tags: @@ -44,7 +48,9 @@ tests: platform_allow: nrf52833dk/nrf52833 integration_platforms: - nrf52833dk/nrf52833 - extra_args: DTC_OVERLAY_FILE=./boards/nrf52833dk_nrf52833_df.overlay + extra_args: + - DTC_OVERLAY_FILE=./boards/nrf52833dk_nrf52833_df.overlay + - SNIPPET="bt-ll-sw-split" extra_configs: - CONFIG_BT_CTLR_DF=y - CONFIG_BT_CTLR_DTM_HCI_DF_IQ_REPORT=y @@ -54,7 +60,9 @@ tests: sample.bluetooth.hci_uart.nrf5340_netcore.df.iq_report: harness: bluetooth platform_allow: nrf5340dk/nrf5340/cpunet - extra_args: DTC_OVERLAY_FILE=./boards/nrf5340dk_nrf5340_cpunet_df.overlay + extra_args: + - DTC_OVERLAY_FILE=./boards/nrf5340dk_nrf5340_cpunet_df.overlay + - SNIPPET="bt-ll-sw-split" extra_configs: - CONFIG_BT_CTLR_DF=y - CONFIG_BT_CTLR_DTM_HCI_DF_IQ_REPORT=y @@ -88,6 +96,7 @@ tests: extra_args: - EXTRA_CONF_FILE=overlay-all-bt_ll_sw_split.conf - DTC_OVERLAY_FILE=./boards/nrf52833dk_nrf52833_df.overlay + - SNIPPET="bt-ll-sw-split" tags: - uart - bluetooth @@ -99,6 +108,7 @@ tests: extra_args: - EXTRA_CONF_FILE=overlay-all-bt_ll_sw_split.conf - DTC_OVERLAY_FILE=./boards/nrf54l15dk_nrf54l15_cpuapp_df.overlay + - SNIPPET="bt-ll-sw-split" tags: - uart - bluetooth diff --git a/samples/bluetooth/hci_vs_scan_req/sample.yaml b/samples/bluetooth/hci_vs_scan_req/sample.yaml index 245a83aa0d96..49526522d16e 100644 --- a/samples/bluetooth/hci_vs_scan_req/sample.yaml +++ b/samples/bluetooth/hci_vs_scan_req/sample.yaml @@ -9,4 +9,6 @@ tests: - nrf52dk/nrf52832 extra_configs: - CONFIG_BT_LL_SW_SPLIT=y + extra_args: + - SNIPPET="bt-ll-sw-split" tags: bluetooth diff --git a/samples/bluetooth/iso_central/sample.yaml b/samples/bluetooth/iso_central/sample.yaml index 3a7dedd404ae..57254ee809ab 100644 --- a/samples/bluetooth/iso_central/sample.yaml +++ b/samples/bluetooth/iso_central/sample.yaml @@ -11,11 +11,11 @@ tests: sample.bluetooth.iso_central.bt_ll_sw_split: harness: bluetooth platform_allow: - - qemu_cortex_m3 - - qemu_x86 - nrf52_bsim - nrf52833dk/nrf52833 integration_platforms: - nrf52833dk/nrf52833 - extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf + extra_args: + - EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf + - SNIPPET="bt-ll-sw-split" tags: bluetooth diff --git a/samples/bluetooth/pbp_public_broadcast_sink/sample.yaml b/samples/bluetooth/pbp_public_broadcast_sink/sample.yaml index d7c816ee5b76..901d40b00d4f 100644 --- a/samples/bluetooth/pbp_public_broadcast_sink/sample.yaml +++ b/samples/bluetooth/pbp_public_broadcast_sink/sample.yaml @@ -23,5 +23,7 @@ tests: integration_platforms: - nrf52_bsim - nrf52833dk/nrf52833 - extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf + extra_args: + - EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf + - SNIPPET="bt-ll-sw-split" tags: bluetooth diff --git a/samples/bluetooth/pbp_public_broadcast_sink/sysbuild.cmake b/samples/bluetooth/pbp_public_broadcast_sink/sysbuild.cmake index 2523aac8ea76..d5d260789ff7 100644 --- a/samples/bluetooth/pbp_public_broadcast_sink/sysbuild.cmake +++ b/samples/bluetooth/pbp_public_broadcast_sink/sysbuild.cmake @@ -18,6 +18,10 @@ if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) CACHE INTERNAL "" ) + list(APPEND ${NET_APP}_SNIPPET ${SNIPPET}) + list(APPEND ${NET_APP}_SNIPPET bt-ll-sw-split) + set(${NET_APP}_SNIPPET ${${NET_APP}_SNIPPET} CACHE STRING "" FORCE) + native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) endif() diff --git a/samples/bluetooth/pbp_public_broadcast_source/sample.yaml b/samples/bluetooth/pbp_public_broadcast_source/sample.yaml index 80c907042119..1d2e31306e29 100644 --- a/samples/bluetooth/pbp_public_broadcast_source/sample.yaml +++ b/samples/bluetooth/pbp_public_broadcast_source/sample.yaml @@ -23,5 +23,7 @@ tests: integration_platforms: - nrf52_bsim - nrf52833dk/nrf52833 - extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf + extra_args: + - EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf + - SNIPPET="bt-ll-sw-split" tags: bluetooth diff --git a/samples/bluetooth/pbp_public_broadcast_source/sysbuild.cmake b/samples/bluetooth/pbp_public_broadcast_source/sysbuild.cmake index d3bf7be5b6c3..e0a7fd9d175d 100644 --- a/samples/bluetooth/pbp_public_broadcast_source/sysbuild.cmake +++ b/samples/bluetooth/pbp_public_broadcast_source/sysbuild.cmake @@ -18,6 +18,10 @@ if(NOT("${SB_CONFIG_NET_CORE_BOARD}" STREQUAL "")) CACHE INTERNAL "" ) + list(APPEND ${NET_APP}_SNIPPET ${SNIPPET}) + list(APPEND ${NET_APP}_SNIPPET bt-ll-sw-split) + set(${NET_APP}_SNIPPET ${${NET_APP}_SNIPPET} CACHE STRING "" FORCE) + native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) endif() diff --git a/snippets/bt-ll-sw-split/bt-ll-sw-split.overlay b/snippets/bt-ll-sw-split/bt-ll-sw-split.overlay index 04bf83ef44d4..a57a0e82ba6e 100644 --- a/snippets/bt-ll-sw-split/bt-ll-sw-split.overlay +++ b/snippets/bt-ll-sw-split/bt-ll-sw-split.overlay @@ -2,6 +2,10 @@ status = "okay"; }; +&bt_hci_sdc { + status = "disabled"; +}; + / { chosen { zephyr,bt-hci = &bt_hci_controller; diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c index b44847c05850..cada046f049b 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c @@ -62,7 +62,7 @@ static struct { /* FIXME: This could probably use a chosen entropy device instead on relying on * the nodelabel being the same as for the old nrf rng. */ -static const struct device *const dev_entropy = DEVICE_DT_GET(DT_NODELABEL(rng)); +static const struct device *const dev_entropy = DEVICE_DT_GET(DT_CHOSEN(zephyr_entropy)); #endif /* CONFIG_ENTROPY_HAS_DRIVER */ static int init_reset(void); diff --git a/tests/bluetooth/controller/ctrl_api/testcase.yaml b/tests/bluetooth/controller/ctrl_api/testcase.yaml index 19bf6c9ab490..21f178bf9b2b 100644 --- a/tests/bluetooth/controller/ctrl_api/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_api/testcase.yaml @@ -6,3 +6,5 @@ common: tests: bluetooth.controller.ctrl_api.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_chmu/testcase.yaml b/tests/bluetooth/controller/ctrl_chmu/testcase.yaml index f7e8068d60ec..9c3ee6264335 100644 --- a/tests/bluetooth/controller/ctrl_chmu/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_chmu/testcase.yaml @@ -6,3 +6,5 @@ common: tests: bluetooth.controller.ctrl_chmu.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_cis_create/testcase.yaml b/tests/bluetooth/controller/ctrl_cis_create/testcase.yaml index 99612a89bc31..2371d7063eb7 100644 --- a/tests/bluetooth/controller/ctrl_cis_create/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_cis_create/testcase.yaml @@ -6,3 +6,5 @@ common: tests: bluetooth.controller.ctrl_cis_create.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_cis_terminate/testcase.yaml b/tests/bluetooth/controller/ctrl_cis_terminate/testcase.yaml index 956172a89b20..a98229ba45f3 100644 --- a/tests/bluetooth/controller/ctrl_cis_terminate/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_cis_terminate/testcase.yaml @@ -6,3 +6,5 @@ common: tests: bluetooth.controller.ctrl_cis_terminate.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_collision/testcase.yaml b/tests/bluetooth/controller/ctrl_collision/testcase.yaml index 6086a9a4ebc8..daa8f3bc6c3d 100644 --- a/tests/bluetooth/controller/ctrl_collision/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_collision/testcase.yaml @@ -6,3 +6,5 @@ common: tests: bluetooth.controller.ctrl_collision.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_conn_update/testcase.yaml b/tests/bluetooth/controller/ctrl_conn_update/testcase.yaml index 5b0bda4b9088..fc4ecb0b647d 100644 --- a/tests/bluetooth/controller/ctrl_conn_update/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_conn_update/testcase.yaml @@ -7,11 +7,18 @@ common: tests: bluetooth.controller.ctrl_conn_update.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" bluetooth.controller.ctrl_conn_update.apm_test: type: unit - extra_args: CONF_FILE=prj_apm.conf + extra_args: + - CONF_FILE=prj_apm.conf + - SNIPPET="bt-ll-sw-split" + bluetooth.controller.ctrl_conn_update.no_param_req_test: type: unit - extra_args: CONF_FILE=prj_no_param_req.conf + extra_args: + - CONF_FILE=prj_no_param_req.conf + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_cte_req/testcase.yaml b/tests/bluetooth/controller/ctrl_cte_req/testcase.yaml index fd6ff51118d9..c6288aecc433 100644 --- a/tests/bluetooth/controller/ctrl_cte_req/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_cte_req/testcase.yaml @@ -6,3 +6,5 @@ common: tests: bluetooth.controller.ctrl_cte_req.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_data_length_update/testcase.yaml b/tests/bluetooth/controller/ctrl_data_length_update/testcase.yaml index 9778af435b4a..c7d1174e12bf 100644 --- a/tests/bluetooth/controller/ctrl_data_length_update/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_data_length_update/testcase.yaml @@ -6,11 +6,17 @@ common: tests: bluetooth.controller.ctrl_data_length_update.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" bluetooth.controller.ctrl_data_length_update.test_nocodedphy: type: unit - extra_args: CONF_FILE=prj_nocoded.conf + extra_args: + - CONF_FILE=prj_nocoded.conf + - SNIPPET="bt-ll-sw-split" bluetooth.controller.ctrl_data_length_update.test_nophy: type: unit - extra_args: CONF_FILE=prj_nophy.conf + extra_args: + - CONF_FILE=prj_nophy.conf + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_encrypt/testcase.yaml b/tests/bluetooth/controller/ctrl_encrypt/testcase.yaml index d5bb2cb8b110..86dd5bfe4d30 100644 --- a/tests/bluetooth/controller/ctrl_encrypt/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_encrypt/testcase.yaml @@ -6,3 +6,5 @@ common: tests: bluetooth.controller.ctrl_encrypt.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_feature_exchange/testcase.yaml b/tests/bluetooth/controller/ctrl_feature_exchange/testcase.yaml index 257542f36120..087e49575ff7 100644 --- a/tests/bluetooth/controller/ctrl_feature_exchange/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_feature_exchange/testcase.yaml @@ -6,3 +6,5 @@ common: tests: bluetooth.controller.ctrl_feature_exchange.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_hci/testcase.yaml b/tests/bluetooth/controller/ctrl_hci/testcase.yaml index d7f7ce7168d1..e0735bae6962 100644 --- a/tests/bluetooth/controller/ctrl_hci/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_hci/testcase.yaml @@ -6,3 +6,5 @@ common: tests: bluetooth.controller.ctrl_hci.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_invalid/testcase.yaml b/tests/bluetooth/controller/ctrl_invalid/testcase.yaml index 2d1741931e37..cee54e6b09ed 100644 --- a/tests/bluetooth/controller/ctrl_invalid/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_invalid/testcase.yaml @@ -6,3 +6,5 @@ common: tests: bluetooth.controller.ctrl_invalid.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_le_ping/testcase.yaml b/tests/bluetooth/controller/ctrl_le_ping/testcase.yaml index b6a77528f32d..54178905da17 100644 --- a/tests/bluetooth/controller/ctrl_le_ping/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_le_ping/testcase.yaml @@ -6,3 +6,5 @@ common: tests: bluetooth.controller.ctrl_le_ping.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_min_used_chans/testcase.yaml b/tests/bluetooth/controller/ctrl_min_used_chans/testcase.yaml index 0991b0cdd43c..a9445cbf8c4d 100644 --- a/tests/bluetooth/controller/ctrl_min_used_chans/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_min_used_chans/testcase.yaml @@ -6,3 +6,5 @@ common: tests: bluetooth.controller.ctrl_min_used_chans.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_phy_update/testcase.yaml b/tests/bluetooth/controller/ctrl_phy_update/testcase.yaml index 1d7da169f1d8..d5c49d587a8f 100644 --- a/tests/bluetooth/controller/ctrl_phy_update/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_phy_update/testcase.yaml @@ -6,6 +6,10 @@ common: tests: bluetooth.controller.ctrl_phy_update.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" bluetooth.controller.ctrl_phy_update.test_reduced_buf: type: unit - extra_args: CONF_FILE=prj_rx_cnt.conf + extra_args: + - CONF_FILE=prj_rx_cnt.conf + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_sca_update/testcase.yaml b/tests/bluetooth/controller/ctrl_sca_update/testcase.yaml index cbf63aa1b575..cbc3c3faf720 100644 --- a/tests/bluetooth/controller/ctrl_sca_update/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_sca_update/testcase.yaml @@ -6,3 +6,5 @@ common: tests: bluetooth.controller.ctrl_sca_update.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_sw_privacy/testcase.yaml b/tests/bluetooth/controller/ctrl_sw_privacy/testcase.yaml index 778606d69549..ac5dd6e957eb 100644 --- a/tests/bluetooth/controller/ctrl_sw_privacy/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_sw_privacy/testcase.yaml @@ -4,3 +4,5 @@ common: tests: bluetooth.ctrl_sw_privacy.test: platform_allow: nrf52_bsim + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_terminate/testcase.yaml b/tests/bluetooth/controller/ctrl_terminate/testcase.yaml index cbe639401ea3..6b1409e9653e 100644 --- a/tests/bluetooth/controller/ctrl_terminate/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_terminate/testcase.yaml @@ -6,3 +6,5 @@ common: tests: bluetooth.controller.ctrl_terminate.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_tx_buffer_alloc/testcase.yaml b/tests/bluetooth/controller/ctrl_tx_buffer_alloc/testcase.yaml index 614eb7fe94c0..363986bd3d35 100644 --- a/tests/bluetooth/controller/ctrl_tx_buffer_alloc/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_tx_buffer_alloc/testcase.yaml @@ -6,23 +6,35 @@ common: tests: bluetooth.controller.ctrl_tx_buffer_alloc.test_0_per_conn: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" bluetooth.controller.ctrl_tx_buffer_alloc.test_1_per_conn: type: unit - extra_args: CONF_FILE=prj_1.conf + extra_args: + - CONF_FILE=prj_1.conf + - SNIPPET="bt-ll-sw-split" bluetooth.controller.ctrl_tx_buffer_alloc.test_2_per_conn: type: unit - extra_args: CONF_FILE=prj_2.conf + extra_args: + - CONF_FILE=prj_2.conf + - SNIPPET="bt-ll-sw-split" bluetooth.controller.ctrl_tx_buffer_alloc.test_3_per_conn: type: unit - extra_args: CONF_FILE=prj_3.conf + extra_args: + - CONF_FILE=prj_3.conf + - SNIPPET="bt-ll-sw-split" bluetooth.controller.ctrl_tx_buffer_alloc.test_max_per_conn_alloc: type: unit - extra_args: CONF_FILE=prj_max.conf + extra_args: + - CONF_FILE=prj_max.conf + - SNIPPET="bt-ll-sw-split" bluetooth.controller.ctrl_tx_buffer_alloc.test_max_common_alloc: type: unit - extra_args: CONF_FILE=prj_max_common.conf + extra_args: + - CONF_FILE=prj_max_common.conf + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_tx_queue/testcase.yaml b/tests/bluetooth/controller/ctrl_tx_queue/testcase.yaml index 295ad891a630..282b620b317a 100644 --- a/tests/bluetooth/controller/ctrl_tx_queue/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_tx_queue/testcase.yaml @@ -5,3 +5,5 @@ common: tests: bluetooth.ctrl_tx_queue.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_unsupported/testcase.yaml b/tests/bluetooth/controller/ctrl_unsupported/testcase.yaml index 28aba1a752a8..48b18af93536 100644 --- a/tests/bluetooth/controller/ctrl_unsupported/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_unsupported/testcase.yaml @@ -6,7 +6,11 @@ common: tests: bluetooth.controller.ctrl_unsupported.default.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" bluetooth.controller.ctrl_unsupported.test: type: unit - extra_args: CONF_FILE=prj_unsupported.conf + extra_args: + - CONF_FILE=prj_unsupported.conf + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_user_ext/testcase.yaml b/tests/bluetooth/controller/ctrl_user_ext/testcase.yaml index af319a7a7191..be963df24a8a 100644 --- a/tests/bluetooth/controller/ctrl_user_ext/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_user_ext/testcase.yaml @@ -4,3 +4,5 @@ common: tests: bluetooth.ctrl_user_ext.test: platform_allow: nrf52_bsim + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/controller/ctrl_version/testcase.yaml b/tests/bluetooth/controller/ctrl_version/testcase.yaml index 6badcbc72547..5df86b9bca9f 100644 --- a/tests/bluetooth/controller/ctrl_version/testcase.yaml +++ b/tests/bluetooth/controller/ctrl_version/testcase.yaml @@ -6,3 +6,5 @@ common: tests: bluetooth.controller.ctrl_version.test: type: unit + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/df/connection_cte_req/testcase.yaml b/tests/bluetooth/df/connection_cte_req/testcase.yaml index 768aba4a51f5..fbfe4b0d9a1a 100644 --- a/tests/bluetooth/df/connection_cte_req/testcase.yaml +++ b/tests/bluetooth/df/connection_cte_req/testcase.yaml @@ -2,3 +2,5 @@ tests: bluetooth.df.conection_cte_req: platform_allow: nrf52_bsim tags: bluetooth + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/df/connection_cte_tx_params/testcase.yaml b/tests/bluetooth/df/connection_cte_tx_params/testcase.yaml index 38a23b0950e3..a9986c5b0e53 100644 --- a/tests/bluetooth/df/connection_cte_tx_params/testcase.yaml +++ b/tests/bluetooth/df/connection_cte_tx_params/testcase.yaml @@ -2,3 +2,5 @@ tests: bluetooth.df.conection_cte_tx_params: platform_allow: nrf52_bsim tags: bluetooth + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/df/connectionless_cte_chains/testcase.yaml b/tests/bluetooth/df/connectionless_cte_chains/testcase.yaml index 6aa5bb0f0c1c..844a7bbb524e 100644 --- a/tests/bluetooth/df/connectionless_cte_chains/testcase.yaml +++ b/tests/bluetooth/df/connectionless_cte_chains/testcase.yaml @@ -2,3 +2,5 @@ tests: bluetooth.df.connectionless_cte_chains: platform_allow: nrf52_bsim tags: bluetooth + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/df/connectionless_cte_rx/testcase.yaml b/tests/bluetooth/df/connectionless_cte_rx/testcase.yaml index f839b1910eb2..c8f08a908436 100644 --- a/tests/bluetooth/df/connectionless_cte_rx/testcase.yaml +++ b/tests/bluetooth/df/connectionless_cte_rx/testcase.yaml @@ -2,3 +2,5 @@ tests: bluetooth.df.connectionless_cte_rx: platform_allow: nrf52_bsim tags: bluetooth + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/df/connectionless_cte_tx/testcase.yaml b/tests/bluetooth/df/connectionless_cte_tx/testcase.yaml index 77d651d0cbc2..491cc0e7e599 100644 --- a/tests/bluetooth/df/connectionless_cte_tx/testcase.yaml +++ b/tests/bluetooth/df/connectionless_cte_tx/testcase.yaml @@ -2,3 +2,5 @@ tests: bluetooth.df.connectionless_cte_tx: platform_allow: nrf52_bsim tags: bluetooth + extra_args: + - SNIPPET="bt-ll-sw-split" diff --git a/tests/bluetooth/init/testcase.yaml b/tests/bluetooth/init/testcase.yaml index dd44257e0128..a5cc40cd39e7 100644 --- a/tests/bluetooth/init/testcase.yaml +++ b/tests/bluetooth/init/testcase.yaml @@ -74,7 +74,9 @@ tests: extra_args: CONF_FILE=prj_9.conf platform_allow: qemu_cortex_m3 bluetooth.init.test_ctlr: - extra_args: CONF_FILE=prj_ctlr.conf + extra_args: + - CONF_FILE=prj_ctlr.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -86,7 +88,9 @@ tests: - nrf51dk/nrf51822 - rv32m1_vega/openisa_rv32m1/ri5cy bluetooth.init.test_ctlr_4_0: - extra_args: CONF_FILE=prj_ctlr_4_0.conf + extra_args: + - CONF_FILE=prj_ctlr_4_0.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -95,7 +99,9 @@ tests: - nrf52dk/nrf52832 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_4_0_dbg: - extra_args: CONF_FILE=prj_ctlr_4_0_dbg.conf + extra_args: + - CONF_FILE=prj_ctlr_4_0_dbg.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -104,7 +110,9 @@ tests: - nrf52dk/nrf52832 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_tiny: - extra_args: CONF_FILE=prj_ctlr_tiny.conf + extra_args: + - CONF_FILE=prj_ctlr_tiny.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -116,6 +124,7 @@ tests: extra_args: - CONF_FILE=prj_ctlr_dbg.conf - DTC_OVERLAY_FILE=pa_lna.overlay + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -126,6 +135,7 @@ tests: extra_args: - CONF_FILE=prj_ctlr_5_x_dbg.conf - DTC_OVERLAY_FILE=pa_lna.overlay + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -137,6 +147,7 @@ tests: - CONF_FILE=prj_ctlr.conf - CONFIG_BT_CTLR_ADVANCED_FEATURES=y - CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER=y + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf5340dk/nrf5340/cpunet - nrf52840dk/nrf52840 @@ -146,13 +157,16 @@ tests: bluetooth.init.test_ctlr_ticker: extra_args: - CONF_FILE=prj_ctlr_ticker.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 integration_platforms: - nrf52dk/nrf52832 bluetooth.init.test_ctlr_broadcaster: - extra_args: CONF_FILE=prj_ctlr_broadcaster.conf + extra_args: + - CONF_FILE=prj_ctlr_broadcaster.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -161,7 +175,9 @@ tests: integration_platforms: - nrf52dk/nrf52832 bluetooth.init.test_ctlr_peripheral: - extra_args: CONF_FILE=prj_ctlr_peripheral.conf + extra_args: + - CONF_FILE=prj_ctlr_peripheral.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -170,7 +186,9 @@ tests: integration_platforms: - nrf52dk/nrf52832 bluetooth.init.test_ctlr_peripheral_priv: - extra_args: CONF_FILE=prj_ctlr_peripheral_priv.conf + extra_args: + - CONF_FILE=prj_ctlr_peripheral_priv.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -179,7 +197,9 @@ tests: integration_platforms: - nrf52840dk/nrf52840 bluetooth.init.test_ctlr_observer: - extra_args: CONF_FILE=prj_ctlr_observer.conf + extra_args: + - CONF_FILE=prj_ctlr_observer.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -188,7 +208,9 @@ tests: integration_platforms: - nrf52dk/nrf52832 bluetooth.init.test_ctlr_central: - extra_args: CONF_FILE=prj_ctlr_central.conf + extra_args: + - CONF_FILE=prj_ctlr_central.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -198,7 +220,9 @@ tests: - nrf52dk/nrf52832 - rv32m1_vega/openisa_rv32m1/ri5cy bluetooth.init.test_ctlr_central_priv: - extra_args: CONF_FILE=prj_ctlr_central_priv.conf + extra_args: + - CONF_FILE=prj_ctlr_central_priv.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -208,7 +232,9 @@ tests: - nrf52dk/nrf52832 - rv32m1_vega/openisa_rv32m1/ri5cy bluetooth.init.test_ctlr_broadcaster_ext: - extra_args: CONF_FILE=prj_ctlr_broadcaster_ext.conf + extra_args: + - CONF_FILE=prj_ctlr_broadcaster_ext.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -217,7 +243,9 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_peripheral_ext: - extra_args: CONF_FILE=prj_ctlr_peripheral_ext.conf + extra_args: + - CONF_FILE=prj_ctlr_peripheral_ext.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -226,7 +254,9 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_peripheral_ext_priv: - extra_args: CONF_FILE=prj_ctlr_peripheral_ext_priv.conf + extra_args: + - CONF_FILE=prj_ctlr_peripheral_ext_priv.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -235,7 +265,9 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_oberver_ext: - extra_args: CONF_FILE=prj_ctlr_observer_ext.conf + extra_args: + - CONF_FILE=prj_ctlr_observer_ext.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -244,7 +276,9 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_central_ext: - extra_args: CONF_FILE=prj_ctlr_central_ext.conf + extra_args: + - CONF_FILE=prj_ctlr_central_ext.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -253,7 +287,9 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_central_ext_priv: - extra_args: CONF_FILE=prj_ctlr_central_ext_priv.conf + extra_args: + - CONF_FILE=prj_ctlr_central_ext_priv.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -262,7 +298,9 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_per_adv: - extra_args: CONF_FILE=prj_ctlr_per_adv.conf + extra_args: + - CONF_FILE=prj_ctlr_per_adv.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -271,7 +309,9 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_per_adv_no_adi: - extra_args: CONF_FILE=prj_ctlr_per_adv_no_adi.conf + extra_args: + - CONF_FILE=prj_ctlr_per_adv_no_adi.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -280,7 +320,9 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_per_sync: - extra_args: CONF_FILE=prj_ctlr_per_sync.conf + extra_args: + - CONF_FILE=prj_ctlr_per_sync.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -289,7 +331,9 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_per_sync_no_adi: - extra_args: CONF_FILE=prj_ctlr_per_sync_no_adi.conf + extra_args: + - CONF_FILE=prj_ctlr_per_sync_no_adi.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -298,7 +342,9 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_per_sync_no_filter: - extra_args: CONF_FILE=prj_ctlr_per_sync_no_filter.conf + extra_args: + - CONF_FILE=prj_ctlr_per_sync_no_filter.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -307,7 +353,9 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_peripheral_iso: - extra_args: CONF_FILE=prj_ctlr_peripheral_iso.conf + extra_args: + - CONF_FILE=prj_ctlr_peripheral_iso.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -316,7 +364,9 @@ tests: - nrf52840dk/nrf52840 - nrf51dk/nrf51822 bluetooth.init.test_ctlr_central_iso: - extra_args: CONF_FILE=prj_ctlr_central_iso.conf + extra_args: + - CONF_FILE=prj_ctlr_central_iso.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -335,7 +385,9 @@ tests: - DTC_OVERLAY_FILE=h5.overlay platform_allow: qemu_cortex_m3 bluetooth.init.test_llcp: - extra_args: CONF_FILE=prj_llcp.conf + extra_args: + - CONF_FILE=prj_llcp.conf + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -347,6 +399,7 @@ tests: extra_args: - CONF_FILE=prj_ctlr.conf - CONFIG_BT_RECV_WORKQ_BT=y + - SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 bluetooth.init.test_host_6_x: From 0e41517dd8a9d1163a26c78935037c031a9b328b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Ku=C5=BAnia?= Date: Wed, 19 Feb 2025 15:47:07 +0100 Subject: [PATCH 1921/2141] [nrf noup] dts: Select SoftDevice Controller on nRF54L09 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The SDC HCI controller is defined as a device tree node. A node representing the SDC controller is added and selected as the default over the open source link layer. This is consistent with other SoCs. Signed-off-by: Rafał Kuźnia (cherry picked from commit da86248f40248d863adfed61bb35019e61a5dadf) (cherry picked from commit e40f5313c37dc245a8812643924cdba02afe1252) --- .../nrf54l09pdk/nrf54l09_cpuapp_common.dtsi | 128 ++++ dts/arm/nordic/nrf54l09_enga_cpuapp.dtsi | 4 +- dts/vendor/nordic/nrf54l09.dtsi | 628 ++++++++++++++++++ 3 files changed, 758 insertions(+), 2 deletions(-) create mode 100644 boards/nordic/nrf54l09pdk/nrf54l09_cpuapp_common.dtsi create mode 100644 dts/vendor/nordic/nrf54l09.dtsi diff --git a/boards/nordic/nrf54l09pdk/nrf54l09_cpuapp_common.dtsi b/boards/nordic/nrf54l09pdk/nrf54l09_cpuapp_common.dtsi new file mode 100644 index 000000000000..e1347c35948c --- /dev/null +++ b/boards/nordic/nrf54l09pdk/nrf54l09_cpuapp_common.dtsi @@ -0,0 +1,128 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* This file is common to the secure and non-secure domain */ + +#include +#include "nrf54l09pdk_nrf54l09-common.dtsi" + +/ { + chosen { + zephyr,console = &uart20; + zephyr,shell-uart = &uart20; + zephyr,uart-mcumgr = &uart20; + zephyr,bt-mon-uart = &uart20; + zephyr,bt-c2h-uart = &uart20; + zephyr,flash-controller = &rram_controller; + zephyr,flash = &cpuapp_rram; + zephyr,bt-hci = &bt_hci_sdc; + zephyr,ieee802154 = &ieee802154; + }; +}; + +&cpuapp_sram { + status = "okay"; +}; + +&hfpll { + /* For now use 64 MHz clock for CPU and fast peripherals. */ + clock-frequency = ; +}; + +&lfxo { + load-capacitors = "internal"; + load-capacitance-femtofarad = <15500>; +}; + +&hfxo { + load-capacitors = "internal"; + load-capacitance-femtofarad = <15000>; +}; + +&grtc { + owned-channels = <0 1 2 3 4 5 6 7 8 9 10 11>; + /* Channels 7-11 reserved for Zero Latency IRQs, 3-4 for FLPR */ + child-owned-channels = <3 4 7 8 9 10 11>; + status = "okay"; +}; + +&cpuapp_rram { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x0 DT_SIZE_K(64)>; + }; + + slot0_partition: partition@10000 { + label = "image-0"; + reg = <0x10000 DT_SIZE_K(212)>; + }; + + slot0_ns_partition: partition@45000 { + label = "image-0-nonsecure"; + reg = <0x45000 DT_SIZE_K(212)>; + }; + + slot1_partition: partition@7a000 { + label = "image-1"; + reg = <0x7a000 DT_SIZE_K(212)>; + }; + + slot1_ns_partition: partition@af000 { + label = "image-1-nonsecure"; + reg = <0xaf000 DT_SIZE_K(212)>; + }; + + storage_partition: partition@e4000 { + label = "storage"; + reg = <0xe4000 DT_SIZE_K(36)>; + }; + }; +}; + +&uart20 { + status = "okay"; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + +&gpiote20 { + status = "okay"; +}; + +&gpiote30 { + status = "okay"; +}; + +&radio { + status = "okay"; +}; + +&temp { + status = "okay"; +}; + +&clock { + status = "okay"; +}; + +&bt_hci_sdc { + status = "okay"; +}; + +&ieee802154 { + status = "okay"; +}; diff --git a/dts/arm/nordic/nrf54l09_enga_cpuapp.dtsi b/dts/arm/nordic/nrf54l09_enga_cpuapp.dtsi index 1dfc5ce133c0..6c7f34d3b21e 100644 --- a/dts/arm/nordic/nrf54l09_enga_cpuapp.dtsi +++ b/dts/arm/nordic/nrf54l09_enga_cpuapp.dtsi @@ -17,7 +17,7 @@ nvic: &cpuapp_nvic {}; / { chosen { - zephyr,bt-hci = &bt_hci_controller; + zephyr,bt-hci = &bt_hci_sdc; zephyr,entropy = &prng; }; @@ -38,7 +38,7 @@ nvic: &cpuapp_nvic {}; }; }; -&bt_hci_controller { +&bt_hci_sdc { status = "okay"; }; diff --git a/dts/vendor/nordic/nrf54l09.dtsi b/dts/vendor/nordic/nrf54l09.dtsi new file mode 100644 index 000000000000..90ecc49b877c --- /dev/null +++ b/dts/vendor/nordic/nrf54l09.dtsi @@ -0,0 +1,628 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include + +/delete-node/ &sw_pwm; + +/* Domain IDs. Can be used to specify channel links in IPCT nodes. */ +#define NRF_DOMAIN_ID_APPLICATION 0 +#define NRF_DOMAIN_ID_FLPR 1 + +/ { + #address-cells = <1>; + #size-cells = <1>; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpuapp: cpu@0 { + compatible = "arm,cortex-m33f"; + reg = <0>; + device_type = "cpu"; + clocks = <&hfpll>; + #address-cells = <1>; + #size-cells = <1>; + + itm: itm@e0000000 { + compatible = "arm,armv8m-itm"; + reg = <0xe0000000 0x1000>; + swo-ref-frequency = ; + }; + }; + + cpuflpr: cpu@1 { + compatible = "nordic,vpr"; + reg = <1>; + device_type = "cpu"; + clock-frequency = ; + riscv,isa = "rv32emc"; + nordic,bus-width = <32>; + }; + }; + + clocks { + pclk: pclk { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = ; + }; + + lfxo: lfxo { + compatible = "nordic,nrf54l-lfxo"; + #clock-cells = <0>; + clock-frequency = <32768>; + }; + + hfxo: hfxo { + compatible = "nordic,nrf54l-hfxo"; + #clock-cells = <0>; + clock-frequency = ; + startup-time-us = <1650>; + }; + + hfpll: hfpll { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = ; + }; + }; + + soc { + #address-cells = <1>; + #size-cells = <1>; + + #ifdef USE_NON_SECURE_ADDRESS_MAP + /* intentionally empty because UICR is hardware fixed to Secure */ + #else + uicr: uicr@ffd000 { + compatible = "nordic,nrf-uicr"; + reg = <0xffd000 0x1000>; + }; + #endif + ficr: ficr@ffc000 { + compatible = "nordic,nrf-ficr"; + reg = <0xffc000 0x1000>; + #nordic,ficr-cells = <1>; + }; + + cpuapp_sram: memory@20000000 { + reg = <0x20000000 DT_SIZE_K(143)>; + ranges = <0x0 0x20000000 DT_SIZE_K(143)>; + compatible = "mmio-sram"; + #address-cells = <1>; + #size-cells = <1>; + }; + + cpuflpr_sram: memory@20023c00 { + compatible = "mmio-sram"; + reg = <0x20023c00 DT_SIZE_K(48)>; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x20023c00 DT_SIZE_K(48)>; + }; + + #ifdef USE_NON_SECURE_ADDRESS_MAP + global_peripherals: peripheral@40000000 { + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x40000000 0x10000000>; + #else + global_peripherals: peripheral@50000000 { + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x50000000 0x10000000>; + #endif + + dppic00: dppic@42000 { + compatible = "nordic,nrf-dppic"; + reg = <0x42000 0x808>; + status = "disabled"; + }; + + ppib00: ppib@44000 { + compatible = "nordic,nrf-ppib"; + reg = <0x44000 0x1000>; + status = "disabled"; + }; + + ppib01: ppib@45000 { + compatible = "nordic,nrf-ppib"; + reg = <0x45000 0x1000>; + status = "disabled"; + }; + + cpuflpr_vpr: vpr@4c000 { + compatible = "nordic,nrf-vpr-coprocessor"; + reg = <0x4c000 0x1000>; + ranges = <0x0 0x4c000 0x1000>; + #address-cells = <1>; + #size-cells = <1>; + status = "disabled"; + enable-secure; + + cpuflpr_clic: interrupt-controller@f0000000 { + compatible = "nordic,nrf-clic"; + reg = <0xf0000000 0x1780>; + interrupt-controller; + #interrupt-cells = <2>; + #address-cells = <1>; + status = "disabled"; + }; + }; + + timer00: timer@55000 { + compatible = "nordic,nrf-timer"; + status = "disabled"; + reg = <0x55000 0x1000>; + cc-num = <6>; + max-bit-width = <32>; + interrupts = <85 NRF_DEFAULT_IRQ_PRIORITY>; + clocks = <&hfpll>; + prescaler = <0>; + }; + + dppic10: dppic@82000 { + compatible = "nordic,nrf-dppic"; + reg = <0x82000 0x808>; + status = "disabled"; + }; + + ppib10: ppib@83000 { + compatible = "nordic,nrf-ppib"; + reg = <0x83000 0x1000>; + status = "disabled"; + }; + + ppib11: ppib@84000 { + compatible = "nordic,nrf-ppib"; + reg = <0x84000 0x1000>; + status = "disabled"; + }; + + timer10: timer@85000 { + compatible = "nordic,nrf-timer"; + status = "disabled"; + reg = <0x85000 0x1000>; + cc-num = <8>; + max-bit-width = <32>; + interrupts = <133 NRF_DEFAULT_IRQ_PRIORITY>; + clocks = <&hfxo>; + prescaler = <0>; + }; + + egu10: egu@87000 { + compatible = "nordic,nrf-egu"; + reg = <0x87000 0x1000>; + interrupts = <135 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + + radio: radio@8a000 { + compatible = "nordic,nrf-radio"; + reg = <0x8a000 0x1000>; + interrupts = <138 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + dfe-supported; + ieee802154-supported; + ble-2mbps-supported; + ble-coded-phy-supported; + cs-supported; + + ieee802154: ieee802154 { + compatible = "nordic,nrf-ieee802154"; + status = "disabled"; + }; + + bt_hci_sdc: bt_hci_sdc { + compatible = "nordic,bt-hci-sdc"; + status = "disabled"; + }; + + bt_hci_controller: bt_hci_controller { + compatible = "zephyr,bt-hci-ll-sw-split"; + status = "disabled"; + }; + }; + + dppic20: dppic@c2000 { + compatible = "nordic,nrf-dppic"; + reg = <0xc2000 0x808>; + status = "disabled"; + }; + + ppib20: ppib@c3000 { + compatible = "nordic,nrf-ppib"; + reg = <0xc3000 0x1000>; + status = "disabled"; + }; + + ppib21: ppib@c4000 { + compatible = "nordic,nrf-ppib"; + reg = <0xc4000 0x1000>; + status = "disabled"; + }; + + ppib22: ppib@c5000 { + compatible = "nordic,nrf-ppib"; + reg = <0xc5000 0x1000>; + status = "disabled"; + }; + + i2c20: i2c@c6000 { + compatible = "nordic,nrf-twim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xc6000 0x1000>; + interrupts = <198 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <16>; + status = "disabled"; + zephyr,pm-device-runtime-auto; + }; + + spi20: spi@c6000 { + /* + * This spi node can be either SPIM or SPIS, + * for the user to pick: + * compatible = "nordic,nrf-spim" or + * "nordic,nrf-spis". + */ + compatible = "nordic,nrf-spim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xc6000 0x1000>; + interrupts = <198 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + easydma-maxcnt-bits = <16>; + rx-delay-supported; + rx-delay = <1>; + status = "disabled"; + }; + + uart20: uart@c6000 { + compatible = "nordic,nrf-uarte"; + reg = <0xc6000 0x1000>; + interrupts = <198 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + endtx-stoptx-supported; + frame-timeout-supported; + }; + + i2c21: i2c@c7000 { + compatible = "nordic,nrf-twim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xc7000 0x1000>; + interrupts = <199 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <16>; + status = "disabled"; + zephyr,pm-device-runtime-auto; + }; + + spi21: spi@c7000 { + /* + * This spi node can be either SPIM or SPIS, + * for the user to pick: + * compatible = "nordic,nrf-spim" or + * "nordic,nrf-spis". + */ + compatible = "nordic,nrf-spim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xc7000 0x1000>; + interrupts = <199 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + easydma-maxcnt-bits = <16>; + rx-delay-supported; + rx-delay = <1>; + status = "disabled"; + }; + + uart21: uart@c7000 { + compatible = "nordic,nrf-uarte"; + reg = <0xc7000 0x1000>; + interrupts = <199 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + endtx-stoptx-supported; + frame-timeout-supported; + }; + + egu20: egu@c9000 { + compatible = "nordic,nrf-egu"; + reg = <0xc9000 0x1000>; + interrupts = <201 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + + timer20: timer@ca000 { + compatible = "nordic,nrf-timer"; + status = "disabled"; + reg = <0xca000 0x1000>; + cc-num = <6>; + max-bit-width = <32>; + interrupts = <202 NRF_DEFAULT_IRQ_PRIORITY>; + prescaler = <0>; + }; + + timer21: timer@cb000 { + compatible = "nordic,nrf-timer"; + status = "disabled"; + reg = <0xcb000 0x1000>; + cc-num = <6>; + max-bit-width = <32>; + interrupts = <203 NRF_DEFAULT_IRQ_PRIORITY>; + prescaler = <0>; + }; + + timer22: timer@cc000 { + compatible = "nordic,nrf-timer"; + status = "disabled"; + reg = <0xcc000 0x1000>; + cc-num = <6>; + max-bit-width = <32>; + interrupts = <204 NRF_DEFAULT_IRQ_PRIORITY>; + prescaler = <0>; + }; + + timer23: timer@cd000 { + compatible = "nordic,nrf-timer"; + status = "disabled"; + reg = <0xcd000 0x1000>; + cc-num = <6>; + max-bit-width = <32>; + interrupts = <205 NRF_DEFAULT_IRQ_PRIORITY>; + prescaler = <0>; + }; + + timer24: timer@ce000 { + compatible = "nordic,nrf-timer"; + status = "disabled"; + reg = <0xce000 0x1000>; + cc-num = <6>; + max-bit-width = <32>; + interrupts = <206 NRF_DEFAULT_IRQ_PRIORITY>; + prescaler = <0>; + }; + + adc: adc@d5000 { + compatible = "nordic,nrf-saadc"; + reg = <0xd5000 0x1000>; + interrupts = <213 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + #io-channel-cells = <1>; + zephyr,pm-device-runtime-auto; + }; + + temp: temp@d7000 { + compatible = "nordic,nrf-temp"; + reg = <0xd7000 0x1000>; + interrupts = <215 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + + gpio1: gpio@d8200 { + compatible = "nordic,nrf-gpio"; + gpio-controller; + reg = <0xd8200 0x300>; + #gpio-cells = <2>; + ngpios = <16>; + status = "disabled"; + port = <1>; + gpiote-instance = <&gpiote20>; + }; + + gpiote20: gpiote@da000 { + compatible = "nordic,nrf-gpiote"; + reg = <0xda000 0x1000>; + status = "disabled"; + instance = <20>; + }; + + grtc: grtc@e2000 { + compatible = "nordic,nrf-grtc"; + reg = <0xe2000 0x1000>; + cc-num = <12>; + clocks = <&lfxo>, <&pclk>; + clock-names = "lfclock", "hfclock"; + status = "disabled"; + }; + + dppic30: dppic@102000 { + compatible = "nordic,nrf-dppic"; + reg = <0x102000 0x808>; + status = "disabled"; + }; + + ppib30: ppib@103000 { + compatible = "nordic,nrf-ppib"; + reg = <0x103000 0x1000>; + status = "disabled"; + }; + + i2c30: i2c@104000 { + compatible = "nordic,nrf-twim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x104000 0x1000>; + interrupts = <260 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <16>; + status = "disabled"; + zephyr,pm-device-runtime-auto; + }; + + spi30: spi@104000 { + /* + * This spi node can be either SPIM or SPIS, + * for the user to pick: + * compatible = "nordic,nrf-spim" or + * "nordic,nrf-spis". + */ + compatible = "nordic,nrf-spim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x104000 0x1000>; + interrupts = <260 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + easydma-maxcnt-bits = <16>; + rx-delay-supported; + rx-delay = <1>; + status = "disabled"; + }; + + uart30: uart@104000 { + compatible = "nordic,nrf-uarte"; + reg = <0x104000 0x1000>; + interrupts = <260 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + endtx-stoptx-supported; + frame-timeout-supported; + }; + + clock: clock@10e000 { + compatible = "nordic,nrf-clock"; + reg = <0x10e000 0x1000>; + interrupts = <270 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + + power: power@10e000 { + compatible = "nordic,nrf-power"; + reg = <0x10e000 0x1000>; + ranges = <0x0 0x10e000 0x1000>; + interrupts = <270 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + #address-cells = <1>; + #size-cells = <1>; + + gpregret1: gpregret1@51c { + #address-cells = <1>; + #size-cells = <1>; + compatible = "nordic,nrf-gpregret"; + reg = <0x51c 0x1>; + status = "disabled"; + }; + + gpregret2: gpregret2@520 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "nordic,nrf-gpregret"; + reg = <0x520 0x1>; + status = "disabled"; + }; + }; + + comp: comparator@106000 { + /* + * Use compatible "nordic,nrf-comp" to configure as COMP + * Use compatible "nordic,nrf-lpcomp" to configure as LPCOMP + */ + compatible = "nordic,nrf-comp"; + reg = <0x106000 0x1000>; + status = "disabled"; + interrupts = <262 NRF_DEFAULT_IRQ_PRIORITY>; + }; + + #ifdef USE_NON_SECURE_ADDRESS_MAP + /* intentionally empty because WDT30 is hardware fixed to Secure */ + #else + wdt30: watchdog@108000 { + compatible = "nordic,nrf-wdt"; + reg = <0x108000 0x620>; + interrupts = <264 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + #endif + + wdt31: watchdog@109000 { + compatible = "nordic,nrf-wdt"; + reg = <0x109000 0x620>; + interrupts = <265 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + + gpio0: gpio@10a000 { + compatible = "nordic,nrf-gpio"; + gpio-controller; + reg = <0x10a000 0x300>; + #gpio-cells = <2>; + ngpios = <5>; + status = "disabled"; + port = <0>; + gpiote-instance = <&gpiote30>; + }; + + gpiote30: gpiote@10c000 { + compatible = "nordic,nrf-gpiote"; + reg = <0x10c000 0x1000>; + status = "disabled"; + instance = <30>; + }; + + regulators: regulator@120000 { + compatible = "nordic,nrf54l-regulators"; + reg = <0x120000 0x1000>; + status = "disabled"; + #address-cells = <1>; + #size-cells = <1>; + + vregmain: regulator@120600 { + compatible = "nordic,nrf5x-regulator"; + reg = <0x120600 0x1>; + status = "disabled"; + regulator-name = "VREGMAIN"; + regulator-initial-mode = ; + }; + }; + }; + + rram_controller: rram-controller@5004e000 { + compatible = "nordic,rram-controller"; + reg = <0x5004e000 0x1000>; + #address-cells = <1>; + #size-cells = <1>; + interrupts = <75 NRF_DEFAULT_IRQ_PRIORITY>; + + /* 952 + 60 = 1012KB */ + cpuapp_rram: rram@0 { + compatible = "soc-nv-flash"; + erase-block-size = <4096>; + write-block-size = <16>; + reg = <0x0 DT_SIZE_K(952)>; + }; + + cpuflpr_rram: rram@ee000 { + compatible = "soc-nv-flash"; + reg = <0xee000 DT_SIZE_K(60)>; + erase-block-size = <4096>; + write-block-size = <16>; + }; + }; + + cpuapp_ppb: cpuapp-ppb-bus { + #address-cells = <1>; + #size-cells = <1>; + + cpuapp_nvic: interrupt-controller@e000e100 { + #address-cells = <1>; + compatible = "arm,v8m-nvic"; + reg = <0xe000e100 0xc00>; + arm,num-irq-priority-bits = <3>; + interrupt-controller; + #interrupt-cells = <2>; + }; + + cpuapp_systick: timer@e000e010 { + compatible = "arm,armv8m-systick"; + reg = <0xe000e010 0x10>; + status = "disabled"; + }; + }; + }; +}; From 1b5c403424cf62cfa227858941705a24706b236b Mon Sep 17 00:00:00 2001 From: Zhaoxiang Jin Date: Mon, 8 Sep 2025 23:03:42 +0800 Subject: [PATCH 1922/2141] [nrf fromtree] tests: drivers: comparator: Enable nxp cmp test Enable nxp cmp test. Signed-off-by: Zhaoxiang Jin (cherry picked from commit 78b4fed3915397931eb4736de35e1d05367f006d) --- .../comparator/nxp_cmp/frdm_mcxc242.dts | 18 +++++++++++++ .../build_all/comparator/testcase.yaml | 5 ++++ .../gpio_loopback/boards/frdm_mcxc242.overlay | 25 +++++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 tests/drivers/build_all/comparator/nxp_cmp/frdm_mcxc242.dts create mode 100644 tests/drivers/comparator/gpio_loopback/boards/frdm_mcxc242.overlay diff --git a/tests/drivers/build_all/comparator/nxp_cmp/frdm_mcxc242.dts b/tests/drivers/build_all/comparator/nxp_cmp/frdm_mcxc242.dts new file mode 100644 index 000000000000..93dc828c7a03 --- /dev/null +++ b/tests/drivers/build_all/comparator/nxp_cmp/frdm_mcxc242.dts @@ -0,0 +1,18 @@ +/* + * Copyright 2025 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&cmp { + positive-mux-input = "IN0"; /* PTC6 */ + negative-mux-input = "IN7"; /* DAC */ + dac-vref-source = "VIN2"; + dac-value = <31>; + filter-count = <0x3>; + filter-period = <0xF>; + hysteresis-mode = "LEVEL2"; + enable-high-speed-mode; + invert-output; + enable-pin-out; +}; diff --git a/tests/drivers/build_all/comparator/testcase.yaml b/tests/drivers/build_all/comparator/testcase.yaml index 298dcc884107..1dda00155206 100644 --- a/tests/drivers/build_all/comparator/testcase.yaml +++ b/tests/drivers/build_all/comparator/testcase.yaml @@ -119,3 +119,8 @@ tests: - DTC_OVERLAY_FILE="mcux_acmp/mke15z7_mux_mux.dts" platform_allow: - frdm_ke15z + drivers.build_all.comparator.nxp_cmp.frdm_mcxc242: + extra_args: + - DTC_OVERLAY_FILE="nxp_cmp/frdm_mcxc242.dts" + platform_allow: + - frdm_mcxc242 diff --git a/tests/drivers/comparator/gpio_loopback/boards/frdm_mcxc242.overlay b/tests/drivers/comparator/gpio_loopback/boards/frdm_mcxc242.overlay new file mode 100644 index 000000000000..755db58ab40f --- /dev/null +++ b/tests/drivers/comparator/gpio_loopback/boards/frdm_mcxc242.overlay @@ -0,0 +1,25 @@ +/* + * Copyright 2025 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +/ { + aliases { + test-comp = &cmp; + }; + + zephyr,user { + /* PTC4 output connect to PTC6. */ + test-gpios = <&gpioc 4 GPIO_ACTIVE_HIGH>; + }; +}; + +&cmp { + positive-mux-input = "IN0"; /* PTC6, FRDM-MCXC242 J2-8 */ + negative-mux-input = "IN7"; /* DAC output => 1.65V */ + dac-vref-source = "VIN2"; + dac-value = <31>; +}; From 7aaa6ad60bd187fdc0f7a39fbf1206d4c352bbaa Mon Sep 17 00:00:00 2001 From: Jakub Zymelka Date: Thu, 28 Aug 2025 13:26:21 +0200 Subject: [PATCH 1923/2141] [nrf fromtree] tests: comparator: nordic: Align boards overlays for changed input types Align samples and tests boards overlays for changed comparator input types. Signed-off-by: Jakub Zymelka (cherry picked from commit 6d7f42936943c6d8efdab5fafd57dcb340763f65) --- .../nrf54l15dk_nrf54l15_cpuapp_comparator.overlay | 4 +++- .../boards/bl54l15_dvk_nrf54l15_cpuapp.overlay | 6 ++++-- .../boards/bl54l15u_dvk_nrf54l15_cpuapp.overlay | 6 ++++-- .../comp/boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 6 ++++-- .../comp/boards/nrf54l15dk_nrf54l15_cpuapp.overlay | 6 ++++-- .../boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 6 ++++-- tests/boards/nrf/comp/src/test.c | 14 ++++++-------- .../build_all/comparator/nrf_comp/diff.overlay | 6 ++++-- .../build_all/comparator/nrf_comp/se.overlay | 4 +++- .../build_all/comparator/nrf_comp/se_aref.overlay | 6 ++++-- .../comparator/nrf_lpcomp/ext_ref.overlay | 4 +++- .../comparator/nrf_lpcomp/int_ref.overlay | 6 ++++-- .../boards/bl54l15_dvk_nrf54l15_cpuapp.overlay | 4 +++- .../boards/bl54l15u_dvk_nrf54l15_cpuapp.overlay | 4 +++- .../boards/nrf5340dk_nrf5340_cpuapp.overlay | 4 +++- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 4 +++- .../boards/nrf54l15dk_nrf54l15_cpuapp.overlay | 4 +++- .../boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 4 +++- .../boards/bl54l15_dvk_nrf54l15_cpuapp.overlay | 4 +++- .../boards/bl54l15u_dvk_nrf54l15_cpuapp.overlay | 4 +++- .../boards/nrf5340dk_nrf5340_cpuapp.overlay | 4 +++- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 4 +++- .../boards/nrf54l15dk_nrf54l15_cpuapp.overlay | 4 +++- .../boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 4 +++- 24 files changed, 83 insertions(+), 39 deletions(-) diff --git a/samples/boards/nordic/system_off/boards/nrf54l15dk_nrf54l15_cpuapp_comparator.overlay b/samples/boards/nordic/system_off/boards/nrf54l15dk_nrf54l15_cpuapp_comparator.overlay index f0b39b456206..ce93cee141a1 100644 --- a/samples/boards/nordic/system_off/boards/nrf54l15dk_nrf54l15_cpuapp_comparator.overlay +++ b/samples/boards/nordic/system_off/boards/nrf54l15dk_nrf54l15_cpuapp_comparator.overlay @@ -1,6 +1,8 @@ +#include + &comp { compatible = "nordic,nrf-lpcomp"; - psel = "AIN4"; + psel = ; refsel = "VDD_4_8"; status = "okay"; }; diff --git a/tests/boards/nrf/comp/boards/bl54l15_dvk_nrf54l15_cpuapp.overlay b/tests/boards/nrf/comp/boards/bl54l15_dvk_nrf54l15_cpuapp.overlay index aaf1006300a5..c928e7eff243 100644 --- a/tests/boards/nrf/comp/boards/bl54l15_dvk_nrf54l15_cpuapp.overlay +++ b/tests/boards/nrf/comp/boards/bl54l15_dvk_nrf54l15_cpuapp.overlay @@ -5,6 +5,8 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include + / { aliases { test-comp = ∁ @@ -30,9 +32,9 @@ &comp { status = "okay"; - psel = "AIN4"; + psel = ; refsel = "AREF"; - extrefsel = "AIN3"; + extrefsel = ; sp-mode = "NORMAL"; th-up = <36>; th-down = <30>; diff --git a/tests/boards/nrf/comp/boards/bl54l15u_dvk_nrf54l15_cpuapp.overlay b/tests/boards/nrf/comp/boards/bl54l15u_dvk_nrf54l15_cpuapp.overlay index aaf1006300a5..c928e7eff243 100644 --- a/tests/boards/nrf/comp/boards/bl54l15u_dvk_nrf54l15_cpuapp.overlay +++ b/tests/boards/nrf/comp/boards/bl54l15u_dvk_nrf54l15_cpuapp.overlay @@ -5,6 +5,8 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include + / { aliases { test-comp = ∁ @@ -30,9 +32,9 @@ &comp { status = "okay"; - psel = "AIN4"; + psel = ; refsel = "AREF"; - extrefsel = "AIN3"; + extrefsel = ; sp-mode = "NORMAL"; th-up = <36>; th-down = <30>; diff --git a/tests/boards/nrf/comp/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/boards/nrf/comp/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index 4e9e898ea184..27008ba6760f 100644 --- a/tests/boards/nrf/comp/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/tests/boards/nrf/comp/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -4,6 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include + / { aliases { test-comp = ∁ @@ -25,9 +27,9 @@ &comp { status = "okay"; - psel = "AIN5"; + psel = ; refsel = "AREF"; - extrefsel = "AIN1"; + extrefsel = ; sp-mode = "HIGH"; th-up = <36>; th-down = <30>; diff --git a/tests/boards/nrf/comp/boards/nrf54l15dk_nrf54l15_cpuapp.overlay b/tests/boards/nrf/comp/boards/nrf54l15dk_nrf54l15_cpuapp.overlay index d6492e37c343..5695f7d90dcd 100644 --- a/tests/boards/nrf/comp/boards/nrf54l15dk_nrf54l15_cpuapp.overlay +++ b/tests/boards/nrf/comp/boards/nrf54l15dk_nrf54l15_cpuapp.overlay @@ -4,6 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include + / { aliases { test-comp = ∁ @@ -29,9 +31,9 @@ &comp { status = "okay"; - psel = "AIN4"; + psel = ; refsel = "AREF"; - extrefsel = "AIN3"; + extrefsel = ; sp-mode = "NORMAL"; th-up = <36>; th-down = <30>; diff --git a/tests/boards/nrf/comp/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/boards/nrf/comp/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay index 45cefc0815bb..94087309aee9 100644 --- a/tests/boards/nrf/comp/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ b/tests/boards/nrf/comp/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -5,6 +5,8 @@ * AIN4 (P1.06) tied to VDD */ +#include + / { aliases { test-comp = ∁ @@ -22,9 +24,9 @@ &comp { status = "okay"; - psel = "AIN4"; + psel = ; refsel = "AREF"; - extrefsel = "AIN3"; + extrefsel = ; sp-mode = "NORMAL"; th-up = <36>; th-down = <30>; diff --git a/tests/boards/nrf/comp/src/test.c b/tests/boards/nrf/comp/src/test.c index 1d1876e76faa..481760da5bd4 100644 --- a/tests/boards/nrf/comp/src/test.c +++ b/tests/boards/nrf/comp/src/test.c @@ -5,6 +5,7 @@ */ #include +#include #include #include #include @@ -13,14 +14,11 @@ static const struct device *test_dev = DEVICE_DT_GET(DT_ALIAS(test_comp)); static const struct gpio_dt_spec test_pin_1 = GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), first_gpios); static const struct gpio_dt_spec test_pin_2 = GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), second_gpios); -#define TEST_COMP_SE_PSEL_AIN _CONCAT(COMP_NRF_COMP_PSEL_AIN, \ - CONFIG_TEST_COMP_SE_PSEL_AIN_INDEX) -#define TEST_COMP_SE_EXTREFSEL_AIN _CONCAT(COMP_NRF_COMP_EXTREFSEL_AIN, \ - CONFIG_TEST_COMP_SE_EXTREFSEL_AIN_INDEX) -#define TEST_COMP_DIFF_PSEL_AIN _CONCAT(COMP_NRF_COMP_PSEL_AIN, \ - CONFIG_TEST_COMP_DIFF_PSEL_AIN_INDEX) -#define TEST_COMP_DIFF_EXTREFSEL_AIN _CONCAT(COMP_NRF_COMP_EXTREFSEL_AIN, \ - CONFIG_TEST_COMP_DIFF_EXTREFSEL_AIN_INDEX) +#define TEST_COMP_SE_PSEL_AIN _CONCAT(NRF_COMP_AIN, CONFIG_TEST_COMP_SE_PSEL_AIN_INDEX) +#define TEST_COMP_SE_EXTREFSEL_AIN _CONCAT(NRF_COMP_AIN, CONFIG_TEST_COMP_SE_EXTREFSEL_AIN_INDEX) +#define TEST_COMP_DIFF_PSEL_AIN _CONCAT(NRF_COMP_AIN, CONFIG_TEST_COMP_DIFF_PSEL_AIN_INDEX) +#define TEST_COMP_DIFF_EXTREFSEL_AIN \ + _CONCAT(NRF_COMP_AIN, CONFIG_TEST_COMP_DIFF_EXTREFSEL_AIN_INDEX) struct comp_nrf_comp_se_config comp_se_config = { .psel = TEST_COMP_SE_PSEL_AIN, diff --git a/tests/drivers/build_all/comparator/nrf_comp/diff.overlay b/tests/drivers/build_all/comparator/nrf_comp/diff.overlay index 8b8e9a02c2b1..56b4249d3c53 100644 --- a/tests/drivers/build_all/comparator/nrf_comp/diff.overlay +++ b/tests/drivers/build_all/comparator/nrf_comp/diff.overlay @@ -4,10 +4,12 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include + &comp { main-mode = "DIFF"; - psel = "AIN0"; - extrefsel = "AIN1"; + psel = ; + extrefsel = ; sp-mode = "HIGH"; isource = "DISABLED"; status = "okay"; diff --git a/tests/drivers/build_all/comparator/nrf_comp/se.overlay b/tests/drivers/build_all/comparator/nrf_comp/se.overlay index e4eb56f61a92..67798ab4bcf1 100644 --- a/tests/drivers/build_all/comparator/nrf_comp/se.overlay +++ b/tests/drivers/build_all/comparator/nrf_comp/se.overlay @@ -4,9 +4,11 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include + &comp { main-mode = "SE"; - psel = "AIN0"; + psel = ; refsel = "INT_1V2"; sp-mode = "HIGH"; th-up = <36>; diff --git a/tests/drivers/build_all/comparator/nrf_comp/se_aref.overlay b/tests/drivers/build_all/comparator/nrf_comp/se_aref.overlay index 0d36a3e40b40..04216a7ac10e 100644 --- a/tests/drivers/build_all/comparator/nrf_comp/se_aref.overlay +++ b/tests/drivers/build_all/comparator/nrf_comp/se_aref.overlay @@ -4,10 +4,12 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include + &comp { main-mode = "SE"; - psel = "AIN0"; - extrefsel = "AIN1"; + psel = ; + extrefsel = ; refsel = "AREF"; sp-mode = "HIGH"; th-up = <36>; diff --git a/tests/drivers/build_all/comparator/nrf_lpcomp/ext_ref.overlay b/tests/drivers/build_all/comparator/nrf_lpcomp/ext_ref.overlay index 95e44fbed3d6..0d990b2c3f88 100644 --- a/tests/drivers/build_all/comparator/nrf_lpcomp/ext_ref.overlay +++ b/tests/drivers/build_all/comparator/nrf_lpcomp/ext_ref.overlay @@ -4,9 +4,11 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include + &comp { compatible = "nordic,nrf-lpcomp"; - psel = "AIN0"; + psel = ; refsel = "VDD_4_8"; status = "okay"; }; diff --git a/tests/drivers/build_all/comparator/nrf_lpcomp/int_ref.overlay b/tests/drivers/build_all/comparator/nrf_lpcomp/int_ref.overlay index 7aadd8b3faee..a42ad2f13a16 100644 --- a/tests/drivers/build_all/comparator/nrf_lpcomp/int_ref.overlay +++ b/tests/drivers/build_all/comparator/nrf_lpcomp/int_ref.overlay @@ -4,10 +4,12 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include + &comp { compatible = "nordic,nrf-lpcomp"; - psel = "AIN0"; + psel = ; refsel = "AREF"; - extrefsel = "AIN1"; + extrefsel = ; status = "okay"; }; diff --git a/tests/drivers/comparator/gpio_loopback/snippets/nrf_comp/boards/bl54l15_dvk_nrf54l15_cpuapp.overlay b/tests/drivers/comparator/gpio_loopback/snippets/nrf_comp/boards/bl54l15_dvk_nrf54l15_cpuapp.overlay index ddcf8d26cadd..84d3b9f57594 100644 --- a/tests/drivers/comparator/gpio_loopback/snippets/nrf_comp/boards/bl54l15_dvk_nrf54l15_cpuapp.overlay +++ b/tests/drivers/comparator/gpio_loopback/snippets/nrf_comp/boards/bl54l15_dvk_nrf54l15_cpuapp.overlay @@ -5,9 +5,11 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include + &comp { main-mode = "SE"; - psel = "AIN4"; /* P1.11 */ + psel = ; /* P1.11 */ refsel = "INT_1V2"; sp-mode = "HIGH"; th-up = <63>; diff --git a/tests/drivers/comparator/gpio_loopback/snippets/nrf_comp/boards/bl54l15u_dvk_nrf54l15_cpuapp.overlay b/tests/drivers/comparator/gpio_loopback/snippets/nrf_comp/boards/bl54l15u_dvk_nrf54l15_cpuapp.overlay index ddcf8d26cadd..84d3b9f57594 100644 --- a/tests/drivers/comparator/gpio_loopback/snippets/nrf_comp/boards/bl54l15u_dvk_nrf54l15_cpuapp.overlay +++ b/tests/drivers/comparator/gpio_loopback/snippets/nrf_comp/boards/bl54l15u_dvk_nrf54l15_cpuapp.overlay @@ -5,9 +5,11 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include + &comp { main-mode = "SE"; - psel = "AIN4"; /* P1.11 */ + psel = ; /* P1.11 */ refsel = "INT_1V2"; sp-mode = "HIGH"; th-up = <63>; diff --git a/tests/drivers/comparator/gpio_loopback/snippets/nrf_comp/boards/nrf5340dk_nrf5340_cpuapp.overlay b/tests/drivers/comparator/gpio_loopback/snippets/nrf_comp/boards/nrf5340dk_nrf5340_cpuapp.overlay index e11bdcd3173d..68fea53e2b45 100644 --- a/tests/drivers/comparator/gpio_loopback/snippets/nrf_comp/boards/nrf5340dk_nrf5340_cpuapp.overlay +++ b/tests/drivers/comparator/gpio_loopback/snippets/nrf_comp/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -4,9 +4,11 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include + &comp { main-mode = "SE"; - psel = "AIN0"; /* P0.04 */ + psel = ; /* P0.04 */ refsel = "VDD"; sp-mode = "HIGH"; th-up = <34>; diff --git a/tests/drivers/comparator/gpio_loopback/snippets/nrf_comp/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/comparator/gpio_loopback/snippets/nrf_comp/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index f90c2051255f..5923e3ab07c8 100644 --- a/tests/drivers/comparator/gpio_loopback/snippets/nrf_comp/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/tests/drivers/comparator/gpio_loopback/snippets/nrf_comp/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -4,9 +4,11 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include + &comp { main-mode = "SE"; - psel = "AIN2"; /* P1.02 */ + psel = ; /* P1.02 */ refsel = "INT_1V2"; sp-mode = "HIGH"; th-up = <63>; diff --git a/tests/drivers/comparator/gpio_loopback/snippets/nrf_comp/boards/nrf54l15dk_nrf54l15_cpuapp.overlay b/tests/drivers/comparator/gpio_loopback/snippets/nrf_comp/boards/nrf54l15dk_nrf54l15_cpuapp.overlay index 3a7a8f0ef811..925417d48ab5 100644 --- a/tests/drivers/comparator/gpio_loopback/snippets/nrf_comp/boards/nrf54l15dk_nrf54l15_cpuapp.overlay +++ b/tests/drivers/comparator/gpio_loopback/snippets/nrf_comp/boards/nrf54l15dk_nrf54l15_cpuapp.overlay @@ -4,9 +4,11 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include + &comp { main-mode = "SE"; - psel = "AIN4"; /* P1.11 */ + psel = ; /* P1.11 */ refsel = "INT_1V2"; sp-mode = "HIGH"; th-up = <63>; diff --git a/tests/drivers/comparator/gpio_loopback/snippets/nrf_comp/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/comparator/gpio_loopback/snippets/nrf_comp/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay index 2709df531950..623bfd9c45f3 100644 --- a/tests/drivers/comparator/gpio_loopback/snippets/nrf_comp/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ b/tests/drivers/comparator/gpio_loopback/snippets/nrf_comp/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -4,9 +4,11 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include + &comp { main-mode = "SE"; - psel = "AIN1"; /* P1.31 */ + psel = ; /* P1.31 */ refsel = "INT_1V2"; sp-mode = "HIGH"; th-up = <63>; diff --git a/tests/drivers/comparator/gpio_loopback/snippets/nrf_lpcomp/boards/bl54l15_dvk_nrf54l15_cpuapp.overlay b/tests/drivers/comparator/gpio_loopback/snippets/nrf_lpcomp/boards/bl54l15_dvk_nrf54l15_cpuapp.overlay index 58e055a02406..e208b85b2ae9 100644 --- a/tests/drivers/comparator/gpio_loopback/snippets/nrf_lpcomp/boards/bl54l15_dvk_nrf54l15_cpuapp.overlay +++ b/tests/drivers/comparator/gpio_loopback/snippets/nrf_lpcomp/boards/bl54l15_dvk_nrf54l15_cpuapp.overlay @@ -5,9 +5,11 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include + &comp { compatible = "nordic,nrf-lpcomp"; - psel = "AIN4"; /* P1.11 */ + psel = ; /* P1.11 */ refsel = "VDD_4_8"; status = "okay"; }; diff --git a/tests/drivers/comparator/gpio_loopback/snippets/nrf_lpcomp/boards/bl54l15u_dvk_nrf54l15_cpuapp.overlay b/tests/drivers/comparator/gpio_loopback/snippets/nrf_lpcomp/boards/bl54l15u_dvk_nrf54l15_cpuapp.overlay index 58e055a02406..e208b85b2ae9 100644 --- a/tests/drivers/comparator/gpio_loopback/snippets/nrf_lpcomp/boards/bl54l15u_dvk_nrf54l15_cpuapp.overlay +++ b/tests/drivers/comparator/gpio_loopback/snippets/nrf_lpcomp/boards/bl54l15u_dvk_nrf54l15_cpuapp.overlay @@ -5,9 +5,11 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include + &comp { compatible = "nordic,nrf-lpcomp"; - psel = "AIN4"; /* P1.11 */ + psel = ; /* P1.11 */ refsel = "VDD_4_8"; status = "okay"; }; diff --git a/tests/drivers/comparator/gpio_loopback/snippets/nrf_lpcomp/boards/nrf5340dk_nrf5340_cpuapp.overlay b/tests/drivers/comparator/gpio_loopback/snippets/nrf_lpcomp/boards/nrf5340dk_nrf5340_cpuapp.overlay index d35a20dfc223..0c571fa21b8f 100644 --- a/tests/drivers/comparator/gpio_loopback/snippets/nrf_lpcomp/boards/nrf5340dk_nrf5340_cpuapp.overlay +++ b/tests/drivers/comparator/gpio_loopback/snippets/nrf_lpcomp/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -4,9 +4,11 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include + &comp { compatible = "nordic,nrf-lpcomp"; - psel = "AIN0"; /* P0.04 */ + psel = ; /* P0.04 */ refsel = "VDD_4_8"; status = "okay"; }; diff --git a/tests/drivers/comparator/gpio_loopback/snippets/nrf_lpcomp/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/comparator/gpio_loopback/snippets/nrf_lpcomp/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index 349cd7051f99..66306268a117 100644 --- a/tests/drivers/comparator/gpio_loopback/snippets/nrf_lpcomp/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/tests/drivers/comparator/gpio_loopback/snippets/nrf_lpcomp/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -4,9 +4,11 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include + &comp { compatible = "nordic,nrf-lpcomp"; - psel = "AIN2"; /* P1.02 */ + psel = ; /* P1.02 */ refsel = "VDD_4_8"; status = "okay"; }; diff --git a/tests/drivers/comparator/gpio_loopback/snippets/nrf_lpcomp/boards/nrf54l15dk_nrf54l15_cpuapp.overlay b/tests/drivers/comparator/gpio_loopback/snippets/nrf_lpcomp/boards/nrf54l15dk_nrf54l15_cpuapp.overlay index ebb652bdd871..e82d8b98521c 100644 --- a/tests/drivers/comparator/gpio_loopback/snippets/nrf_lpcomp/boards/nrf54l15dk_nrf54l15_cpuapp.overlay +++ b/tests/drivers/comparator/gpio_loopback/snippets/nrf_lpcomp/boards/nrf54l15dk_nrf54l15_cpuapp.overlay @@ -4,9 +4,11 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include + &comp { compatible = "nordic,nrf-lpcomp"; - psel = "AIN4"; /* P1.11 */ + psel = ; /* P1.11 */ refsel = "VDD_4_8"; status = "okay"; }; diff --git a/tests/drivers/comparator/gpio_loopback/snippets/nrf_lpcomp/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/comparator/gpio_loopback/snippets/nrf_lpcomp/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay index 0f51a9951a16..db097a9fd6fd 100644 --- a/tests/drivers/comparator/gpio_loopback/snippets/nrf_lpcomp/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ b/tests/drivers/comparator/gpio_loopback/snippets/nrf_lpcomp/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -4,9 +4,11 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include + &comp { compatible = "nordic,nrf-lpcomp"; - psel = "AIN1"; /* P1.31 */ + psel = ; /* P1.31 */ refsel = "VDD_4_8"; status = "okay"; }; From 432d2973e9be63df13d43fe0965e8cb4e78dad0f Mon Sep 17 00:00:00 2001 From: Jakub Zymelka Date: Thu, 28 Aug 2025 12:02:22 +0200 Subject: [PATCH 1924/2141] [nrf fromtree] dts: bindings: comparator: nordic: Change inputs type to int Unify external analog inputs type to be consistent in COMP, LPCOMP and SAADC nordic drivers. Signed-off-by: Jakub Zymelka (cherry picked from commit d85bdb7ee913e1106709290e2ecb1da1693fb475) --- dts/bindings/comparator/nordic,nrf-comp.yaml | 32 ++++--------------- .../comparator/nordic,nrf-lpcomp.yaml | 20 +++--------- .../zephyr/dt-bindings/comparator/nrf-comp.h | 21 ++++++++++++ 3 files changed, 31 insertions(+), 42 deletions(-) create mode 100644 include/zephyr/dt-bindings/comparator/nrf-comp.h diff --git a/dts/bindings/comparator/nordic,nrf-comp.yaml b/dts/bindings/comparator/nordic,nrf-comp.yaml index e4f6838d2049..f1405a6de2c9 100644 --- a/dts/bindings/comparator/nordic,nrf-comp.yaml +++ b/dts/bindings/comparator/nordic,nrf-comp.yaml @@ -25,7 +25,7 @@ description: | &comp { status = "okay"; main-mode = "SE"; - psel = "AIN0"; + psel = ; refsel = "INT_1V2"; sp-mode = "NORMAL"; th-up = <36>; @@ -39,7 +39,7 @@ description: | &comp { ... refsel = "AREF"; - extrefsel = "AIN1"; + extrefsel = ; ... }; @@ -49,8 +49,8 @@ description: | &comp { status = "okay"; main-mode = "DIFF"; - psel = "AIN0"; - extrefsel = "AIN1"; + psel = ; + extrefsel = ; sp-mode = "NORMAL"; enable-hyst; isource = "DISABLED"; @@ -68,30 +68,10 @@ properties: - "DIFF" psel: - type: string - enum: - - "AIN0" - - "AIN1" - - "AIN2" - - "AIN3" - - "AIN4" - - "AIN5" - - "AIN6" - - "AIN7" - - "VDD_DIV2" - - "VDDH_DIV5" + type: int extrefsel: - type: string - enum: - - "AIN0" - - "AIN1" - - "AIN2" - - "AIN3" - - "AIN4" - - "AIN5" - - "AIN6" - - "AIN7" + type: int refsel: type: string diff --git a/dts/bindings/comparator/nordic,nrf-lpcomp.yaml b/dts/bindings/comparator/nordic,nrf-lpcomp.yaml index 64a30b330d8b..4995155ed76b 100644 --- a/dts/bindings/comparator/nordic,nrf-lpcomp.yaml +++ b/dts/bindings/comparator/nordic,nrf-lpcomp.yaml @@ -21,7 +21,7 @@ description: | &comp { status = "okay"; - psel = "AIN0"; + psel = ; refsel = "VDD_4_8"; enable-hyst; }; @@ -32,7 +32,7 @@ description: | &comp { ... refsel = "AREF"; - extrefsel = "AIN1"; + extrefsel = ; ... }; @@ -42,22 +42,10 @@ include: base.yaml properties: psel: - type: string - enum: - - "AIN0" - - "AIN1" - - "AIN2" - - "AIN3" - - "AIN4" - - "AIN5" - - "AIN6" - - "AIN7" + type: int extrefsel: - type: string - enum: - - "AIN0" - - "AIN1" + type: int refsel: type: string diff --git a/include/zephyr/dt-bindings/comparator/nrf-comp.h b/include/zephyr/dt-bindings/comparator/nrf-comp.h new file mode 100644 index 000000000000..1a5407554a15 --- /dev/null +++ b/include/zephyr/dt-bindings/comparator/nrf-comp.h @@ -0,0 +1,21 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2025 Nordic Semiconductor ASA + */ + +#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_ADC_NRF_COMP_H_ +#define ZEPHYR_INCLUDE_DT_BINDINGS_ADC_NRF_COMP_H_ + +#define NRF_COMP_AIN0 0 /** AIN0 external input */ +#define NRF_COMP_AIN1 1 /** AIN1 external input */ +#define NRF_COMP_AIN2 2 /** AIN2 external input */ +#define NRF_COMP_AIN3 3 /** AIN3 external input */ +#define NRF_COMP_AIN4 4 /** AIN4 external input */ +#define NRF_COMP_AIN5 5 /** AIN5 external input */ +#define NRF_COMP_AIN6 6 /** AIN6 external input */ +#define NRF_COMP_AIN7 7 /** AIN7 external input */ +#define NRF_COMP_AIN_VDD_DIV2 8 /** VDD / 2 */ +#define NRF_COMP_AIN_VDDH_DIV5 9 /** VDDH / 5 */ + +#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_ADC_NRF_COMP_H_ */ From b2447dfb822a1f06d784e8b511f0a1c19f3bc4a9 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Mon, 20 Oct 2025 21:52:22 +0200 Subject: [PATCH 1925/2141] Revert "[nrf noup] tests: arm_irq_vector_table: remove SSF_CLIENT_SYS_INIT" This reverts commit 69ad0523f95f13d1de356c19575301ce3de4959e. Signed-off-by: Bjarki Arge Andreasen --- .../arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpuapp.conf | 1 + .../arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpurad.conf | 1 + 2 files changed, 2 insertions(+) diff --git a/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpuapp.conf b/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpuapp.conf index e12e413d9e5a..6457f0efce73 100644 --- a/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpuapp.conf +++ b/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpuapp.conf @@ -2,3 +2,4 @@ # SPDX-License-Identifier: Apache-2.0 CONFIG_POWER_DOMAIN=n +CONFIG_SSF_CLIENT_SYS_INIT=n diff --git a/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpurad.conf b/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpurad.conf index e12e413d9e5a..6457f0efce73 100644 --- a/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpurad.conf +++ b/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpurad.conf @@ -2,3 +2,4 @@ # SPDX-License-Identifier: Apache-2.0 CONFIG_POWER_DOMAIN=n +CONFIG_SSF_CLIENT_SYS_INIT=n From 1fec5522f621df814dfc57fe74fd6b58dfe76068 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Mon, 20 Oct 2025 21:52:31 +0200 Subject: [PATCH 1926/2141] Revert "[nrf fromlist] tests: arch: arm: irq vt: disable power domains (NRFS)" This reverts commit 20e985d80e3f738db978ee2c008e170fa07ddc08. Signed-off-by: Bjarki Arge Andreasen --- .../boards/nrf54h20dk_nrf54h20_cpuapp.conf | 4 -- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 49 ------------------- .../boards/nrf54h20dk_nrf54h20_cpurad.conf | 4 -- .../boards/nrf54h20dk_nrf54h20_cpurad.overlay | 48 ------------------ 4 files changed, 105 deletions(-) diff --git a/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpuapp.conf b/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpuapp.conf index 6457f0efce73..a18a3b576e39 100644 --- a/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpuapp.conf +++ b/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpuapp.conf @@ -1,5 +1 @@ -# Copyright (c) 2025 Nordic Semiconductor -# SPDX-License-Identifier: Apache-2.0 - -CONFIG_POWER_DOMAIN=n CONFIG_SSF_CLIENT_SYS_INIT=n diff --git a/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index 4fd0ecca13ea..57d4a8a5babe 100644 --- a/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -11,52 +11,3 @@ &cpusec_bellboard { status = "disabled"; }; - - -&gdpwr { - status = "disabled"; -}; - -&gdpwr_fast_active_0 { - status = "disabled"; -}; - -&gdpwr_fast_active_1 { - status = "disabled"; -}; - -&gdpwr_fast_main { - status = "disabled"; -}; - -&gdpwr_slow_active { - status = "disabled"; -}; - -&gdpwr_slow_main { - status = "disabled"; -}; - -&gpio_pad_group0 { - status = "disabled"; -}; - -&gpio_pad_group1 { - status = "disabled"; -}; - -&gpio_pad_group2 { - status = "disabled"; -}; - -&gpio_pad_group6 { - status = "disabled"; -}; - -&gpio_pad_group7 { - status = "disabled"; -}; - -&gpio_pad_group9 { - status = "disabled"; -}; diff --git a/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpurad.conf b/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpurad.conf index 6457f0efce73..a18a3b576e39 100644 --- a/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpurad.conf +++ b/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpurad.conf @@ -1,5 +1 @@ -# Copyright (c) 2025 Nordic Semiconductor -# SPDX-License-Identifier: Apache-2.0 - -CONFIG_POWER_DOMAIN=n CONFIG_SSF_CLIENT_SYS_INIT=n diff --git a/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpurad.overlay b/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpurad.overlay index b6d0ab807e99..be4b7c565d6d 100644 --- a/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpurad.overlay +++ b/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpurad.overlay @@ -11,51 +11,3 @@ &cpusec_bellboard { status = "disabled"; }; - -&gdpwr { - status = "disabled"; -}; - -&gdpwr_fast_active_0 { - status = "disabled"; -}; - -&gdpwr_fast_active_1 { - status = "disabled"; -}; - -&gdpwr_fast_main { - status = "disabled"; -}; - -&gdpwr_slow_active { - status = "disabled"; -}; - -&gdpwr_slow_main { - status = "disabled"; -}; - -&gpio_pad_group0 { - status = "disabled"; -}; - -&gpio_pad_group1 { - status = "disabled"; -}; - -&gpio_pad_group2 { - status = "disabled"; -}; - -&gpio_pad_group6 { - status = "disabled"; -}; - -&gpio_pad_group7 { - status = "disabled"; -}; - -&gpio_pad_group9 { - status = "disabled"; -}; From b8e6d7f5f14ce27df2b60d4c3b3108736d20c9d3 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Mon, 20 Oct 2025 21:52:49 +0200 Subject: [PATCH 1927/2141] Revert "[nrf noup] tests: arm_irq_vector_table: Disable starting of SSF client" This reverts commit 8c97493e725979a39138d9a13956ac2c8a5c04bf. Signed-off-by: Bjarki Arge Andreasen --- .../arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpuapp.conf | 1 - .../arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpurad.conf | 1 - 2 files changed, 2 deletions(-) delete mode 100644 tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpuapp.conf delete mode 100644 tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpurad.conf diff --git a/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpuapp.conf b/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpuapp.conf deleted file mode 100644 index a18a3b576e39..000000000000 --- a/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpuapp.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_SSF_CLIENT_SYS_INIT=n diff --git a/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpurad.conf b/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpurad.conf deleted file mode 100644 index a18a3b576e39..000000000000 --- a/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpurad.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_SSF_CLIENT_SYS_INIT=n From 49926adb4b05085d0f1bb17c78374ddafaf6d535 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Mon, 20 Oct 2025 22:01:49 +0200 Subject: [PATCH 1928/2141] [nrf fromlist] tests: arch: arm: irq_vector_table: disable POWER_DOMAIN for nRF54H20 The nRF54H20s power domains use NRFS, which uses the irq vectors used for this test suite. Disable power domains to not conflict with the test suite. Upstream PR #: 97452 Signed-off-by: Bjarki Arge Andreasen --- .../boards/nrf54h20dk_nrf54h20_cpuapp.conf | 4 ++++ .../boards/nrf54h20dk_nrf54h20_cpurad.conf | 4 ++++ 2 files changed, 8 insertions(+) create mode 100644 tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpuapp.conf create mode 100644 tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpurad.conf diff --git a/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpuapp.conf b/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpuapp.conf new file mode 100644 index 000000000000..e12e413d9e5a --- /dev/null +++ b/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpuapp.conf @@ -0,0 +1,4 @@ +# Copyright (c) 2025 Nordic Semiconductor +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_POWER_DOMAIN=n diff --git a/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpurad.conf b/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpurad.conf new file mode 100644 index 000000000000..e12e413d9e5a --- /dev/null +++ b/tests/arch/arm/arm_irq_vector_table/boards/nrf54h20dk_nrf54h20_cpurad.conf @@ -0,0 +1,4 @@ +# Copyright (c) 2025 Nordic Semiconductor +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_POWER_DOMAIN=n From fea9743c6530f89fbe510ffdf70042c279b36a23 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Mon, 20 Oct 2025 22:22:28 +0200 Subject: [PATCH 1929/2141] [nrf fromlist] tests: drivers: spi_loopback: increase latency limit for nrf54h The nrf54h20 needs a slightly increased latency limit as the latency is around 650us at 8MHz, which is right above the current limit of 648us (CONFIG_SPI_IDEAL_TRANSFER_DURATION_SCALING=12). Increase CONFIG_SPI_IDEAL_TRANSFER_DURATION_SCALING to 15 to match cpuppr_xip and match the observed latency. Upstream PR #: 97452 Signed-off-by: Bjarki Arge Andreasen --- .../spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuapp.conf | 2 +- .../spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpurad.conf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuapp.conf b/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuapp.conf index ad922ab8d26f..725924348b53 100644 --- a/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuapp.conf +++ b/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuapp.conf @@ -1 +1 @@ -CONFIG_SPI_IDEAL_TRANSFER_DURATION_SCALING=12 +CONFIG_SPI_IDEAL_TRANSFER_DURATION_SCALING=15 diff --git a/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpurad.conf b/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpurad.conf index ad922ab8d26f..725924348b53 100644 --- a/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpurad.conf +++ b/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpurad.conf @@ -1 +1 @@ -CONFIG_SPI_IDEAL_TRANSFER_DURATION_SCALING=12 +CONFIG_SPI_IDEAL_TRANSFER_DURATION_SCALING=15 From 00229ec614a628a8d19513ee693b4712323dd570 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Wed, 30 Jul 2025 15:37:26 +0200 Subject: [PATCH 1930/2141] [nrf fromtree] dts: bindings: introduce nordic,nrfs-swext Introduce nordic NRFS SWEXT power domain bindings and add it to relevant SoC devicetree files. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit cf2e80d3734274c64e5b24573d4b16ed338c220d) --- .../power-domain/nordic,nrfs-swext.yaml | 26 +++++++++++++++++++ dts/vendor/nordic/nrf54h20.dtsi | 9 +++++++ 2 files changed, 35 insertions(+) create mode 100644 dts/bindings/power-domain/nordic,nrfs-swext.yaml diff --git a/dts/bindings/power-domain/nordic,nrfs-swext.yaml b/dts/bindings/power-domain/nordic,nrfs-swext.yaml new file mode 100644 index 000000000000..a504f4d97cdd --- /dev/null +++ b/dts/bindings/power-domain/nordic,nrfs-swext.yaml @@ -0,0 +1,26 @@ +# Copyright 2025 Nordic Semiconductor +# SPDX-License-Identifier: Apache-2.0 + +description: Nordic NRFS SWEXT power domain + +compatible: "nordic,nrfs-swext" + +include: power-domain.yaml + +properties: + "#power-domain-cells": + const: 0 + + max-current-ua: + type: int + description: Maxmimum supported current in microamps. + required: true + + current-limit-ua: + type: int + description: Maxmimum allowed current in microamps. + required: true + + power-down-clamp: + type: boolean + description: Enable ground clamp on output when powered down. diff --git a/dts/vendor/nordic/nrf54h20.dtsi b/dts/vendor/nordic/nrf54h20.dtsi index b0d399d657cc..5c445b9d5c75 100644 --- a/dts/vendor/nordic/nrf54h20.dtsi +++ b/dts/vendor/nordic/nrf54h20.dtsi @@ -252,6 +252,15 @@ }; }; + swext: swext { + compatible = "nordic,nrfs-swext"; + status = "disabled"; + max-current-ua = <7500>; + current-limit-ua = <7500>; + zephyr,pm-device-runtime-auto; + #power-domain-cells = <0>; + }; + soc { #address-cells = <1>; #size-cells = <1>; From 3a3b43700d20959a4084e2e28a6d6a10da98fcd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Mon, 6 Oct 2025 15:36:10 +0200 Subject: [PATCH 1931/2141] [nrf fromtree] drivers: mspi_dw: Remove needless TXEIR check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a follow-up to commit f0f5f8cdef74c79e2f28048dd842a05a1241e5af. There is no need to check if TXE interrupt flag is set before calling tx_dummy_bytes(), as the function can handle the case when it is called even though there is no room in the TX FIFO. On the other hand, the check may be actually harmful, as it may prevent adding more items to the TX FIFO while the SSI controller is waiting until the FIFO achieves its transfer start level. Remove the check then and exit the ISR loop when no dummy bytes could be written into the TX FIFO. Signed-off-by: Andrzej Głąbek (cherry picked from commit 7ff2be07f2091b971873776d2833902d39948411) --- drivers/mspi/mspi_dw.c | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/drivers/mspi/mspi_dw.c b/drivers/mspi/mspi_dw.c index f7be2e33c9e5..518b5605785f 100644 --- a/drivers/mspi/mspi_dw.c +++ b/drivers/mspi/mspi_dw.c @@ -195,7 +195,7 @@ static void tx_data(const struct device *dev, dev_data->buf_pos = (uint8_t *)buf_pos; } -static bool tx_dummy_bytes(const struct device *dev) +static bool tx_dummy_bytes(const struct device *dev, bool *repeat) { struct mspi_dw_data *dev_data = dev->data; const struct mspi_dw_config *dev_config = dev->config; @@ -209,8 +209,17 @@ static bool tx_dummy_bytes(const struct device *dev) * FIFO to avoid overflowing it; `max_queued_dummy_bytes` accounts * that one byte that can be partially received, thus not included * in the value from the RXFLR register. + * This check also handles the case when the function is called but + * the TX FIFO is already filled up (fifo_room == 0). */ if (fifo_room <= rx_fifo_items) { + if (repeat) { + /* If no dummy bytes can be sent now, there is no point + * in repeating the loop that reads the RX FIFO. + */ + *repeat = false; + } + return false; } fifo_room -= rx_fifo_items; @@ -329,7 +338,9 @@ static void handle_fifos(const struct device *dev) finished = true; } } else { - for (;;) { + bool repeat = true; + + do { /* Always read everything from the RX FIFO, regardless * of the interrupt status. * tx_dummy_bytes() subtracts the number of items that @@ -363,19 +374,28 @@ static void handle_fifos(const struct device *dev) break; } - if (dev_data->dummy_bytes == 0 || - !(int_status & RISR_TXEIR_BIT)) { + /* If there are still some dummy bytes to transmit, + * always try to put some into the TX FIFO, no matter + * what's the TXE interrupt status - the TX FIFO may be + * filled above its threshold level (then its interrupt + * flag is not set), but below its transfer start level, + * so the controller may be waiting for more items to + * appear there. + */ + if (dev_data->dummy_bytes == 0) { break; } - if (tx_dummy_bytes(dev)) { + if (tx_dummy_bytes(dev, &repeat)) { /* All the required dummy bytes were written * to the FIFO; disable the TXE interrupt, * as it's no longer needed. */ set_imr(dev, IMR_RXFIM_BIT); } - } + + /* Repeat the loop only if any dummy bytes were sent. */ + } while (repeat); } if (finished) { @@ -1151,7 +1171,7 @@ static int start_next_packet(const struct device *dev, k_timeout_t timeout) } /* Prefill TX FIFO with any data we can */ - if (dev_data->dummy_bytes && tx_dummy_bytes(dev)) { + if (dev_data->dummy_bytes && tx_dummy_bytes(dev, NULL)) { imr = IMR_RXFIM_BIT; } else if (packet->dir == MSPI_TX && packet->num_bytes) { tx_data(dev, packet); From 61b0c13f401c8b5c792e80f422170152c2ffbaa3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B8e?= Date: Thu, 23 Oct 2025 12:55:12 +0200 Subject: [PATCH 1932/2141] Revert "[nrf fromtree] soc: nordic: uicr: Add safety flag for permanent device transition" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 5696f6b423a54390721955d6e0e63c363e02cfff. Signed-off-by: Sebastian Bøe --- scripts/ci/check_compliance.py | 2 +- soc/nordic/common/uicr/gen_uicr.py | 24 ++---------------------- 2 files changed, 3 insertions(+), 23 deletions(-) diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index ce4cbca57e4c..f9d33b5a655b 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -1354,7 +1354,7 @@ def check_no_undef_outside_kconfig(self, kconf): "GEN_UICR_APPROTECT_CORESIGHT_PROTECTED", "GEN_UICR_APPROTECT_RADIOCORE_PROTECTED", "GEN_UICR_ERASEPROTECT", - "GEN_UICR_GENERATE_PERIPHCONF", + "GEN_UICR_GENERATE_PERIPHCONF", # Used in specialized build tool, not part of main Kconfig "GEN_UICR_LOCK", "GEN_UICR_PROTECTEDMEM", "GEN_UICR_PROTECTEDMEM_SIZE_BYTES", diff --git a/soc/nordic/common/uicr/gen_uicr.py b/soc/nordic/common/uicr/gen_uicr.py index 8dbbc7fe5ce9..036ee770e12c 100644 --- a/soc/nordic/common/uicr/gen_uicr.py +++ b/soc/nordic/common/uicr/gen_uicr.py @@ -432,14 +432,6 @@ def main() -> None: type=lambda s: int(s, 0), help="Size in bytes of cpurad_its_partition (decimal or 0x-prefixed hex)", ) - parser.add_argument( - "--permit-permanently-transitioning-device-to-deployed", - action="store_true", - help=( - "Safety flag required to enable both UICR.LOCK and UICR.ERASEPROTECT together. " - "Must be explicitly provided to acknowledge permanent device state changes." - ), - ) parser.add_argument( "--lock", action="store_true", @@ -632,22 +624,10 @@ def main() -> None: uicr.SECURESTORAGE.ITS.APPLICATIONSIZE1KB = args.cpuapp_its_size // 1024 uicr.SECURESTORAGE.ITS.RADIOCORESIZE1KB = args.cpurad_its_size // 1024 - # Handle LOCK and ERASEPROTECT configuration - # Check if both are enabled together - this requires explicit acknowledgment - if ( - args.lock - and args.eraseprotect - and not args.permit_permanently_transitioning_device_to_deployed - ): - raise ScriptError( - "Enabling both --lock and --eraseprotect requires " - "--permit-permanently-transitioning-device-to-deployed to be specified. " - "This combination permanently locks the device configuration and prevents " - "ERASEALL." - ) - + # Handle LOCK configuration if args.lock: uicr.LOCK = ENABLED_VALUE + # Handle ERASEPROTECT configuration if args.eraseprotect: uicr.ERASEPROTECT = ENABLED_VALUE # Handle APPROTECT configuration From 0e6b7222d7de8b65bc055428c20d1a9daf6678f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B8e?= Date: Thu, 23 Oct 2025 12:57:16 +0200 Subject: [PATCH 1933/2141] Revert "[nrf fromtree] soc: nordic: uicr: Add support for UICR.APPROTECT" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 8fc703bea3bd64445fb6d2c357733357eed0f375. Signed-off-by: Sebastian Bøe --- scripts/ci/check_compliance.py | 3 --- soc/nordic/common/uicr/gen_uicr.py | 26 ------------------- .../common/uicr/gen_uicr/CMakeLists.txt | 15 ----------- soc/nordic/common/uicr/gen_uicr/Kconfig | 24 ----------------- 4 files changed, 68 deletions(-) diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index f9d33b5a655b..5a662d5affdf 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -1350,9 +1350,6 @@ def check_no_undef_outside_kconfig(self, kconf): "FOO_LOG_LEVEL", "FOO_SETTING_1", "FOO_SETTING_2", - "GEN_UICR_APPROTECT_APPLICATION_PROTECTED", - "GEN_UICR_APPROTECT_CORESIGHT_PROTECTED", - "GEN_UICR_APPROTECT_RADIOCORE_PROTECTED", "GEN_UICR_ERASEPROTECT", "GEN_UICR_GENERATE_PERIPHCONF", # Used in specialized build tool, not part of main Kconfig "GEN_UICR_LOCK", diff --git a/soc/nordic/common/uicr/gen_uicr.py b/soc/nordic/common/uicr/gen_uicr.py index 036ee770e12c..390d96042528 100644 --- a/soc/nordic/common/uicr/gen_uicr.py +++ b/soc/nordic/common/uicr/gen_uicr.py @@ -25,8 +25,6 @@ # Common values for representing enabled/disabled in the UICR format. ENABLED_VALUE = 0xFFFF_FFFF DISABLED_VALUE = 0xBD23_28A8 -PROTECTED_VALUE = ENABLED_VALUE # UICR_PROTECTED = UICR_ENABLED per uicr_defs.h -UNPROTECTED_VALUE = DISABLED_VALUE # Unprotected uses the default erased value KB_4 = 4096 @@ -442,21 +440,6 @@ def main() -> None: action="store_true", help="Enable UICR.ERASEPROTECT to block ERASEALL operations", ) - parser.add_argument( - "--approtect-application-protected", - action="store_true", - help="Protect application domain access port (disable debug access)", - ) - parser.add_argument( - "--approtect-radiocore-protected", - action="store_true", - help="Protect radio core access port (disable debug access)", - ) - parser.add_argument( - "--approtect-coresight-protected", - action="store_true", - help="Protect CoreSight access port (disable debug access)", - ) parser.add_argument( "--protectedmem", action="store_true", @@ -630,15 +613,6 @@ def main() -> None: # Handle ERASEPROTECT configuration if args.eraseprotect: uicr.ERASEPROTECT = ENABLED_VALUE - # Handle APPROTECT configuration - if args.approtect_application_protected: - uicr.APPROTECT.APPLICATION = PROTECTED_VALUE - - if args.approtect_radiocore_protected: - uicr.APPROTECT.RADIOCORE = PROTECTED_VALUE - - if args.approtect_coresight_protected: - uicr.APPROTECT.CORESIGHT = PROTECTED_VALUE # Handle protected memory configuration if args.protectedmem: if args.protectedmem_size_bytes % KB_4 != 0: diff --git a/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt b/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt index 290cf16a0a6f..0802d4f2f870 100644 --- a/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt +++ b/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt @@ -77,7 +77,6 @@ endif() set(lock_args) set(eraseprotect_args) -set(approtect_args) set(protectedmem_args) set(periphconf_args) set(wdtstart_args) @@ -128,19 +127,6 @@ if(CONFIG_GEN_UICR_ERASEPROTECT) list(APPEND eraseprotect_args --eraseprotect) endif() -# Handle APPROTECT configuration -if(CONFIG_GEN_UICR_APPROTECT_APPLICATION_PROTECTED) - list(APPEND approtect_args --approtect-application-protected) -endif() - -if(CONFIG_GEN_UICR_APPROTECT_RADIOCORE_PROTECTED) - list(APPEND approtect_args --approtect-radiocore-protected) -endif() - -if(CONFIG_GEN_UICR_APPROTECT_CORESIGHT_PROTECTED) - list(APPEND approtect_args --approtect-coresight-protected) -endif() - # Handle protected memory configuration if(CONFIG_GEN_UICR_PROTECTEDMEM) list(APPEND protectedmem_args --protectedmem) @@ -271,7 +257,6 @@ add_custom_command( --out-uicr-hex ${uicr_hex_file} ${lock_args} ${eraseprotect_args} - ${approtect_args} ${wdtstart_args} ${periphconf_args} ${securestorage_args} diff --git a/soc/nordic/common/uicr/gen_uicr/Kconfig b/soc/nordic/common/uicr/gen_uicr/Kconfig index 3322d5cb9cbe..f2692bb6b4ee 100644 --- a/soc/nordic/common/uicr/gen_uicr/Kconfig +++ b/soc/nordic/common/uicr/gen_uicr/Kconfig @@ -55,30 +55,6 @@ config GEN_UICR_ERASEPROTECT Note that gen_uicr.py can be used directly to create a configuration with both enabled if needed. -menu "UICR.APPROTECT - Access Port Protection" - -config GEN_UICR_APPROTECT_APPLICATION_PROTECTED - bool "Protect application domain access port" - help - When enabled, disables debug access to the application domain processor, - preventing debugger connection to application memory, registers, and debug - features. When disabled, full debug access is enabled. - -config GEN_UICR_APPROTECT_RADIOCORE_PROTECTED - bool "Protect radio core access port" - help - When enabled, disables debug access to the radio core processor, - preventing debugger connection to radio core memory, registers, and debug - features. When disabled, full debug access is enabled. - -config GEN_UICR_APPROTECT_CORESIGHT_PROTECTED - bool "Disable CoreSight subsystem" - help - When enabled will disable the coresight subsystem, preventing - system level trace features. - -endmenu - config GEN_UICR_PROTECTEDMEM bool "Enable UICR.PROTECTEDMEM" help From cabaff10b0d0d2bf1c145dc4f942ebf2ba7518e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B8e?= Date: Thu, 23 Oct 2025 12:57:40 +0200 Subject: [PATCH 1934/2141] Revert "[nrf fromtree] soc: nordic: uicr: Add support for UICR.ERASEPROTECT" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 5d60e5894897883b807921cfcc8dce1f71656bf7. Signed-off-by: Sebastian Bøe --- scripts/ci/check_compliance.py | 1 - soc/nordic/common/uicr/gen_uicr.py | 8 -------- soc/nordic/common/uicr/gen_uicr/CMakeLists.txt | 7 ------- soc/nordic/common/uicr/gen_uicr/Kconfig | 12 ------------ 4 files changed, 28 deletions(-) diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index 5a662d5affdf..45e6131c4e76 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -1350,7 +1350,6 @@ def check_no_undef_outside_kconfig(self, kconf): "FOO_LOG_LEVEL", "FOO_SETTING_1", "FOO_SETTING_2", - "GEN_UICR_ERASEPROTECT", "GEN_UICR_GENERATE_PERIPHCONF", # Used in specialized build tool, not part of main Kconfig "GEN_UICR_LOCK", "GEN_UICR_PROTECTEDMEM", diff --git a/soc/nordic/common/uicr/gen_uicr.py b/soc/nordic/common/uicr/gen_uicr.py index 390d96042528..103dec53e82b 100644 --- a/soc/nordic/common/uicr/gen_uicr.py +++ b/soc/nordic/common/uicr/gen_uicr.py @@ -435,11 +435,6 @@ def main() -> None: action="store_true", help="Enable UICR.LOCK to prevent modifications without ERASEALL", ) - parser.add_argument( - "--eraseprotect", - action="store_true", - help="Enable UICR.ERASEPROTECT to block ERASEALL operations", - ) parser.add_argument( "--protectedmem", action="store_true", @@ -610,9 +605,6 @@ def main() -> None: # Handle LOCK configuration if args.lock: uicr.LOCK = ENABLED_VALUE - # Handle ERASEPROTECT configuration - if args.eraseprotect: - uicr.ERASEPROTECT = ENABLED_VALUE # Handle protected memory configuration if args.protectedmem: if args.protectedmem_size_bytes % KB_4 != 0: diff --git a/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt b/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt index 0802d4f2f870..8df980b0743b 100644 --- a/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt +++ b/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt @@ -76,7 +76,6 @@ if(CMAKE_VERBOSE_MAKEFILE) endif() set(lock_args) -set(eraseprotect_args) set(protectedmem_args) set(periphconf_args) set(wdtstart_args) @@ -122,11 +121,6 @@ if(CONFIG_GEN_UICR_LOCK) list(APPEND lock_args --lock) endif() -# Handle ERASEPROTECT configuration -if(CONFIG_GEN_UICR_ERASEPROTECT) - list(APPEND eraseprotect_args --eraseprotect) -endif() - # Handle protected memory configuration if(CONFIG_GEN_UICR_PROTECTEDMEM) list(APPEND protectedmem_args --protectedmem) @@ -256,7 +250,6 @@ add_custom_command( --out-merged-hex ${merged_hex_file} --out-uicr-hex ${uicr_hex_file} ${lock_args} - ${eraseprotect_args} ${wdtstart_args} ${periphconf_args} ${securestorage_args} diff --git a/soc/nordic/common/uicr/gen_uicr/Kconfig b/soc/nordic/common/uicr/gen_uicr/Kconfig index f2692bb6b4ee..e64fa93bdcac 100644 --- a/soc/nordic/common/uicr/gen_uicr/Kconfig +++ b/soc/nordic/common/uicr/gen_uicr/Kconfig @@ -43,18 +43,6 @@ config GEN_UICR_LOCK This should be enabled only in production devices to prevent unauthorized modification. -config GEN_UICR_ERASEPROTECT - bool "Enable UICR.ERASEPROTECT" - depends on ! GEN_UICR_LOCK - help - When enabled, ERASEALL operations are blocked. - - This option is mutually exclusive with UICR.LOCK in Kconfig to prevent - accidental configuration where both are enabled simultaneously. If both - were enabled, the UICR would become impossible to modify in any way. - Note that gen_uicr.py can be used directly to create a configuration - with both enabled if needed. - config GEN_UICR_PROTECTEDMEM bool "Enable UICR.PROTECTEDMEM" help From dc423b9107f1338ba4b423594244dd4165c9139f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B8e?= Date: Thu, 23 Oct 2025 12:57:51 +0200 Subject: [PATCH 1935/2141] Revert "[nrf fromtree] soc: nordic: uicr: Add support for UICR.LOCK" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 4d2bcf72788fe2f237ccbc485a267e63f8f0e3cd. Signed-off-by: Sebastian Bøe --- scripts/ci/check_compliance.py | 1 - soc/nordic/common/uicr/gen_uicr.py | 8 -------- soc/nordic/common/uicr/gen_uicr/CMakeLists.txt | 7 ------- soc/nordic/common/uicr/gen_uicr/Kconfig | 11 ----------- 4 files changed, 27 deletions(-) diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index 45e6131c4e76..22038120217b 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -1351,7 +1351,6 @@ def check_no_undef_outside_kconfig(self, kconf): "FOO_SETTING_1", "FOO_SETTING_2", "GEN_UICR_GENERATE_PERIPHCONF", # Used in specialized build tool, not part of main Kconfig - "GEN_UICR_LOCK", "GEN_UICR_PROTECTEDMEM", "GEN_UICR_PROTECTEDMEM_SIZE_BYTES", "GEN_UICR_SECONDARY", diff --git a/soc/nordic/common/uicr/gen_uicr.py b/soc/nordic/common/uicr/gen_uicr.py index 103dec53e82b..0b47be4c5a4d 100644 --- a/soc/nordic/common/uicr/gen_uicr.py +++ b/soc/nordic/common/uicr/gen_uicr.py @@ -430,11 +430,6 @@ def main() -> None: type=lambda s: int(s, 0), help="Size in bytes of cpurad_its_partition (decimal or 0x-prefixed hex)", ) - parser.add_argument( - "--lock", - action="store_true", - help="Enable UICR.LOCK to prevent modifications without ERASEALL", - ) parser.add_argument( "--protectedmem", action="store_true", @@ -602,9 +597,6 @@ def main() -> None: uicr.SECURESTORAGE.ITS.APPLICATIONSIZE1KB = args.cpuapp_its_size // 1024 uicr.SECURESTORAGE.ITS.RADIOCORESIZE1KB = args.cpurad_its_size // 1024 - # Handle LOCK configuration - if args.lock: - uicr.LOCK = ENABLED_VALUE # Handle protected memory configuration if args.protectedmem: if args.protectedmem_size_bytes % KB_4 != 0: diff --git a/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt b/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt index 8df980b0743b..41ccdf454a33 100644 --- a/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt +++ b/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt @@ -75,7 +75,6 @@ endfunction() if(CMAKE_VERBOSE_MAKEFILE) endif() -set(lock_args) set(protectedmem_args) set(periphconf_args) set(wdtstart_args) @@ -116,11 +115,6 @@ if(CONFIG_GEN_UICR_SECURESTORAGE) list(APPEND securestorage_args --cpurad-its-size ${CPURAD_ITS_SIZE}) endif(CONFIG_GEN_UICR_SECURESTORAGE) -# Handle LOCK configuration -if(CONFIG_GEN_UICR_LOCK) - list(APPEND lock_args --lock) -endif() - # Handle protected memory configuration if(CONFIG_GEN_UICR_PROTECTEDMEM) list(APPEND protectedmem_args --protectedmem) @@ -249,7 +243,6 @@ add_custom_command( --uicr-address ${UICR_ADDRESS} --out-merged-hex ${merged_hex_file} --out-uicr-hex ${uicr_hex_file} - ${lock_args} ${wdtstart_args} ${periphconf_args} ${securestorage_args} diff --git a/soc/nordic/common/uicr/gen_uicr/Kconfig b/soc/nordic/common/uicr/gen_uicr/Kconfig index e64fa93bdcac..7ff7caf49f73 100644 --- a/soc/nordic/common/uicr/gen_uicr/Kconfig +++ b/soc/nordic/common/uicr/gen_uicr/Kconfig @@ -32,17 +32,6 @@ config GEN_UICR_SECURESTORAGE - At least one subpartition must be defined - Combined subpartition sizes must equal secure_storage_partition size -config GEN_UICR_LOCK - bool "Enable UICR.LOCK" - help - When enabled, locks the entire contents of the NVR0 page located in - MRAM10. This includes all values in both the UICR and the BICR (Board - Information Configuration Registers). Once locked, the UICR can only - be modified by performing an ERASEALL operation. - - This should be enabled only in production devices to prevent - unauthorized modification. - config GEN_UICR_PROTECTEDMEM bool "Enable UICR.PROTECTEDMEM" help From 73eea57b0d1db9476958a5137483c7343b9c349b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B8e?= Date: Thu, 23 Oct 2025 12:58:01 +0200 Subject: [PATCH 1936/2141] Revert "[nrf fromtree] soc: nordic: uicr: Add support for UICR.SECONDARY.PROTECTEDMEM" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 9f2450f4b736b2fdf143973fa026d5b403e11c3b. Signed-off-by: Sebastian Bøe --- scripts/ci/check_compliance.py | 2 -- soc/nordic/common/uicr/gen_uicr.py | 15 --------------- soc/nordic/common/uicr/gen_uicr/CMakeLists.txt | 5 ----- soc/nordic/common/uicr/gen_uicr/Kconfig | 16 +--------------- 4 files changed, 1 insertion(+), 37 deletions(-) diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index 22038120217b..5c648f6e115e 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -1356,8 +1356,6 @@ def check_no_undef_outside_kconfig(self, kconf): "GEN_UICR_SECONDARY", "GEN_UICR_SECONDARY_GENERATE_PERIPHCONF", "GEN_UICR_SECONDARY_PROCESSOR_VALUE", - "GEN_UICR_SECONDARY_PROTECTEDMEM", - "GEN_UICR_SECONDARY_PROTECTEDMEM_SIZE_BYTES", "GEN_UICR_SECONDARY_TRIGGER", "GEN_UICR_SECONDARY_TRIGGER_APPLICATIONLOCKUP", "GEN_UICR_SECONDARY_TRIGGER_APPLICATIONWDT0", diff --git a/soc/nordic/common/uicr/gen_uicr.py b/soc/nordic/common/uicr/gen_uicr.py index 0b47be4c5a4d..36f4dc1d44c0 100644 --- a/soc/nordic/common/uicr/gen_uicr.py +++ b/soc/nordic/common/uicr/gen_uicr.py @@ -501,12 +501,6 @@ def main() -> None: "(decimal or 0x-prefixed hex)" ), ) - parser.add_argument( - "--secondary-protectedmem-size", - default=None, - type=lambda s: int(s, 0), - help="Size in bytes of the secondary protected memory region (decimal or 0x-prefixed hex)", - ) parser.add_argument( "--secondary-periphconf-address", default=None, @@ -653,15 +647,6 @@ def main() -> None: uicr.SECONDARY.TRIGGER.ENABLE = ENABLED_VALUE uicr.SECONDARY.TRIGGER.RESETREAS = args.secondary_trigger_resetreas - # Handle secondary PROTECTEDMEM configuration - if args.secondary_protectedmem_size: - uicr.SECONDARY.PROTECTEDMEM.ENABLE = ENABLED_VALUE - if args.secondary_protectedmem_size % 4096 != 0: - raise ScriptError( - f"args.secondary_protectedmem_size was {args.secondary_protectedmem_size}, " - f"but must be divisible by 4096" - ) - uicr.SECONDARY.PROTECTEDMEM.SIZE4KB = args.secondary_protectedmem_size // 4096 # Handle secondary periphconf if provided if args.out_secondary_periphconf_hex: secondary_periphconf_combined = extract_and_combine_periphconfs( diff --git a/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt b/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt index 41ccdf454a33..d5a71e0562f4 100644 --- a/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt +++ b/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt @@ -216,11 +216,6 @@ if(CONFIG_GEN_UICR_SECONDARY) list(APPEND secondary_args --secondary-trigger-resetreas ${resetreas_value}) endif() - # Handle secondary PROTECTEDMEM configuration - if(CONFIG_GEN_UICR_SECONDARY_PROTECTEDMEM) - list(APPEND secondary_args --secondary-protectedmem-size ${CONFIG_GEN_UICR_SECONDARY_PROTECTEDMEM_SIZE_BYTES}) - endif() - if(CONFIG_GEN_UICR_SECONDARY_GENERATE_PERIPHCONF) # Compute SECONDARY_PERIPHCONF absolute address and size from this image's devicetree compute_partition_address_and_size("secondary_periphconf_partition" SECONDARY_PERIPHCONF_ADDRESS SECONDARY_PERIPHCONF_SIZE) diff --git a/soc/nordic/common/uicr/gen_uicr/Kconfig b/soc/nordic/common/uicr/gen_uicr/Kconfig index 7ff7caf49f73..716e18a26275 100644 --- a/soc/nordic/common/uicr/gen_uicr/Kconfig +++ b/soc/nordic/common/uicr/gen_uicr/Kconfig @@ -205,22 +205,8 @@ config GEN_UICR_SECONDARY_TRIGGER_RADIOCORELOCKUP help Boot secondary firmware when Radio core CPU lockup causes a reset. -endif # GEN_UICR_SECONDARY_TRIGGER - -config GEN_UICR_SECONDARY_PROTECTEDMEM - bool "Enable UICR.SECONDARY.PROTECTEDMEM" - depends on GEN_UICR_SECONDARY - help - When enabled, the UICR generator will configure the - protected memory region for the secondary firmware. -config GEN_UICR_SECONDARY_PROTECTEDMEM_SIZE_BYTES - int "Secondary protected memory size in bytes" - default 4096 - depends on GEN_UICR_SECONDARY_PROTECTEDMEM - help - Size of the secondary protected memory region in bytes. - This value must be divisible by 4096 (4 kiB). +endif # GEN_UICR_SECONDARY_TRIGGER endif # GEN_UICR_SECONDARY From 6ab9bf9357fb6c18e027fceb1b21053db998ceaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B8e?= Date: Thu, 23 Oct 2025 12:58:23 +0200 Subject: [PATCH 1937/2141] Revert "[nrf fromtree] soc: nordic: uicr: Add support for UICR.SECONDARY.TRIGGER" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 6c9b26c481d48f34073bc3dfc5c60302d359a467. Signed-off-by: Sebastian Bøe --- scripts/ci/check_compliance.py | 7 ---- soc/nordic/common/uicr/gen_uicr.py | 19 --------- .../common/uicr/gen_uicr/CMakeLists.txt | 28 ------------- soc/nordic/common/uicr/gen_uicr/Kconfig | 42 ------------------- 4 files changed, 96 deletions(-) diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index 5c648f6e115e..8f49273bf4c5 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -1356,13 +1356,6 @@ def check_no_undef_outside_kconfig(self, kconf): "GEN_UICR_SECONDARY", "GEN_UICR_SECONDARY_GENERATE_PERIPHCONF", "GEN_UICR_SECONDARY_PROCESSOR_VALUE", - "GEN_UICR_SECONDARY_TRIGGER", - "GEN_UICR_SECONDARY_TRIGGER_APPLICATIONLOCKUP", - "GEN_UICR_SECONDARY_TRIGGER_APPLICATIONWDT0", - "GEN_UICR_SECONDARY_TRIGGER_APPLICATIONWDT1", - "GEN_UICR_SECONDARY_TRIGGER_RADIOCORELOCKUP", - "GEN_UICR_SECONDARY_TRIGGER_RADIOCOREWDT0", - "GEN_UICR_SECONDARY_TRIGGER_RADIOCOREWDT1", "GEN_UICR_SECONDARY_WDTSTART", "GEN_UICR_SECONDARY_WDTSTART_CRV", "GEN_UICR_SECONDARY_WDTSTART_INSTANCE_CODE", diff --git a/soc/nordic/common/uicr/gen_uicr.py b/soc/nordic/common/uicr/gen_uicr.py index 36f4dc1d44c0..da2938bf05c9 100644 --- a/soc/nordic/common/uicr/gen_uicr.py +++ b/soc/nordic/common/uicr/gen_uicr.py @@ -487,20 +487,6 @@ def main() -> None: type=lambda s: int(s, 0), help="Processor to boot for the secondary firmware ", ) - parser.add_argument( - "--secondary-trigger", - action="store_true", - help="Enable UICR.SECONDARY.TRIGGER for automatic secondary firmware boot on reset events", - ) - parser.add_argument( - "--secondary-trigger-resetreas", - default=0, - type=lambda s: int(s, 0), - help=( - "Bitmask of reset reasons that trigger secondary firmware boot " - "(decimal or 0x-prefixed hex)" - ), - ) parser.add_argument( "--secondary-periphconf-address", default=None, @@ -642,11 +628,6 @@ def main() -> None: uicr.SECONDARY.ADDRESS = args.secondary_address uicr.SECONDARY.PROCESSOR = args.secondary_processor - # Handle secondary TRIGGER configuration - if args.secondary_trigger: - uicr.SECONDARY.TRIGGER.ENABLE = ENABLED_VALUE - uicr.SECONDARY.TRIGGER.RESETREAS = args.secondary_trigger_resetreas - # Handle secondary periphconf if provided if args.out_secondary_periphconf_hex: secondary_periphconf_combined = extract_and_combine_periphconfs( diff --git a/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt b/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt index d5a71e0562f4..39737888023a 100644 --- a/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt +++ b/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt @@ -188,34 +188,6 @@ if(CONFIG_GEN_UICR_SECONDARY) list(APPEND secondary_args --secondary-wdtstart-crv ${CONFIG_GEN_UICR_SECONDARY_WDTSTART_CRV}) endif() - # Handle secondary TRIGGER configuration - if(CONFIG_GEN_UICR_SECONDARY_TRIGGER) - list(APPEND secondary_args --secondary-trigger) - - # Compute RESETREAS bitmask from individual trigger configs - set(resetreas_value 0) - if(CONFIG_GEN_UICR_SECONDARY_TRIGGER_APPLICATIONWDT0) - math(EXPR resetreas_value "${resetreas_value} + 0x001") - endif() - if(CONFIG_GEN_UICR_SECONDARY_TRIGGER_APPLICATIONWDT1) - math(EXPR resetreas_value "${resetreas_value} + 0x002") - endif() - if(CONFIG_GEN_UICR_SECONDARY_TRIGGER_APPLICATIONLOCKUP) - math(EXPR resetreas_value "${resetreas_value} + 0x008") - endif() - if(CONFIG_GEN_UICR_SECONDARY_TRIGGER_RADIOCOREWDT0) - math(EXPR resetreas_value "${resetreas_value} + 0x020") - endif() - if(CONFIG_GEN_UICR_SECONDARY_TRIGGER_RADIOCOREWDT1) - math(EXPR resetreas_value "${resetreas_value} + 0x040") - endif() - if(CONFIG_GEN_UICR_SECONDARY_TRIGGER_RADIOCORELOCKUP) - math(EXPR resetreas_value "${resetreas_value} + 0x100") - endif() - - list(APPEND secondary_args --secondary-trigger-resetreas ${resetreas_value}) - endif() - if(CONFIG_GEN_UICR_SECONDARY_GENERATE_PERIPHCONF) # Compute SECONDARY_PERIPHCONF absolute address and size from this image's devicetree compute_partition_address_and_size("secondary_periphconf_partition" SECONDARY_PERIPHCONF_ADDRESS SECONDARY_PERIPHCONF_SIZE) diff --git a/soc/nordic/common/uicr/gen_uicr/Kconfig b/soc/nordic/common/uicr/gen_uicr/Kconfig index 716e18a26275..9b630139e641 100644 --- a/soc/nordic/common/uicr/gen_uicr/Kconfig +++ b/soc/nordic/common/uicr/gen_uicr/Kconfig @@ -166,48 +166,6 @@ config GEN_UICR_SECONDARY_PROCESSOR_VALUE default 0xBD2328A8 if GEN_UICR_SECONDARY_PROCESSOR_APPLICATION default 0x1730C77F if GEN_UICR_SECONDARY_PROCESSOR_RADIOCORE -config GEN_UICR_SECONDARY_TRIGGER - bool "Enable UICR.SECONDARY.TRIGGER" - help - When enabled, configures automatic triggers that cause IronSide SE - to boot the secondary firmware instead of the primary firmware based - on specific reset reasons. - -if GEN_UICR_SECONDARY_TRIGGER - -config GEN_UICR_SECONDARY_TRIGGER_APPLICATIONWDT0 - bool "Trigger on Application domain watchdog 0 reset" - help - Boot secondary firmware when Application domain watchdog 0 causes a reset. - -config GEN_UICR_SECONDARY_TRIGGER_APPLICATIONWDT1 - bool "Trigger on Application domain watchdog 1 reset" - help - Boot secondary firmware when Application domain watchdog 1 causes a reset. - -config GEN_UICR_SECONDARY_TRIGGER_APPLICATIONLOCKUP - bool "Trigger on Application domain CPU lockup reset" - help - Boot secondary firmware when Application domain CPU lockup causes a reset. - -config GEN_UICR_SECONDARY_TRIGGER_RADIOCOREWDT0 - bool "Trigger on Radio core watchdog 0 reset" - help - Boot secondary firmware when Radio core watchdog 0 causes a reset. - -config GEN_UICR_SECONDARY_TRIGGER_RADIOCOREWDT1 - bool "Trigger on Radio core watchdog 1 reset" - help - Boot secondary firmware when Radio core watchdog 1 causes a reset. - -config GEN_UICR_SECONDARY_TRIGGER_RADIOCORELOCKUP - bool "Trigger on Radio core CPU lockup reset" - help - Boot secondary firmware when Radio core CPU lockup causes a reset. - - -endif # GEN_UICR_SECONDARY_TRIGGER - endif # GEN_UICR_SECONDARY endmenu From 5785431f84613addc0dc1c9336a4451759e6158d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B8e?= Date: Thu, 23 Oct 2025 12:58:33 +0200 Subject: [PATCH 1938/2141] Revert "[nrf fromlist] soc: nordic: uicr: Add support for UICR.WDTSTART" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit ccefb2a9e3a6bc5541d56eb34b822df184c8cb60. Signed-off-by: Sebastian Bøe --- scripts/ci/check_compliance.py | 18 ++-- soc/nordic/common/uicr/gen_uicr.py | 42 --------- .../common/uicr/gen_uicr/CMakeLists.txt | 16 ---- soc/nordic/common/uicr/gen_uicr/Kconfig | 85 ------------------- 4 files changed, 6 insertions(+), 155 deletions(-) diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index 8f49273bf4c5..50a0ecfa087f 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -1351,18 +1351,12 @@ def check_no_undef_outside_kconfig(self, kconf): "FOO_SETTING_1", "FOO_SETTING_2", "GEN_UICR_GENERATE_PERIPHCONF", # Used in specialized build tool, not part of main Kconfig - "GEN_UICR_PROTECTEDMEM", - "GEN_UICR_PROTECTEDMEM_SIZE_BYTES", - "GEN_UICR_SECONDARY", - "GEN_UICR_SECONDARY_GENERATE_PERIPHCONF", - "GEN_UICR_SECONDARY_PROCESSOR_VALUE", - "GEN_UICR_SECONDARY_WDTSTART", - "GEN_UICR_SECONDARY_WDTSTART_CRV", - "GEN_UICR_SECONDARY_WDTSTART_INSTANCE_CODE", - "GEN_UICR_SECURESTORAGE", - "GEN_UICR_WDTSTART", - "GEN_UICR_WDTSTART_CRV", - "GEN_UICR_WDTSTART_INSTANCE_CODE", # Used in specialized build tool, not part of main Kconfig + "GEN_UICR_PROTECTEDMEM", # Used in specialized build tool, not part of main Kconfig + "GEN_UICR_PROTECTEDMEM_SIZE_BYTES", # Used in specialized build tool, not part of main Kconfig + "GEN_UICR_SECONDARY", # Used in specialized build tool, not part of main Kconfig + "GEN_UICR_SECONDARY_GENERATE_PERIPHCONF", # Used in specialized build tool, not part of main Kconfig + "GEN_UICR_SECONDARY_PROCESSOR_VALUE", # Used in specialized build tool, not part of main Kconfig + "GEN_UICR_SECURESTORAGE", # Used in specialized build tool, not part of main Kconfig "HEAP_MEM_POOL_ADD_SIZE_", # Used as an option matching prefix "HUGETLBFS", # Linux, in boards/xtensa/intel_adsp_cavs25/doc "IAR_BUFFERED_WRITE", diff --git a/soc/nordic/common/uicr/gen_uicr.py b/soc/nordic/common/uicr/gen_uicr.py index da2938bf05c9..bea0ba2a2dfa 100644 --- a/soc/nordic/common/uicr/gen_uicr.py +++ b/soc/nordic/common/uicr/gen_uicr.py @@ -440,36 +440,6 @@ def main() -> None: type=int, help="Protected memory size in bytes (must be divisible by 4096)", ) - parser.add_argument( - "--wdtstart", - action="store_true", - help="Enable watchdog timer start in UICR", - ) - parser.add_argument( - "--wdtstart-instance-code", - type=lambda s: int(s, 0), - help="Watchdog timer instance code (0xBD2328A8 for WDT0, 0x1730C77F for WDT1)", - ) - parser.add_argument( - "--wdtstart-crv", - type=int, - help="Initial Counter Reload Value (CRV) for watchdog timer (minimum: 0xF)", - ) - parser.add_argument( - "--secondary-wdtstart", - action="store_true", - help="Enable watchdog timer start in UICR.SECONDARY", - ) - parser.add_argument( - "--secondary-wdtstart-instance-code", - type=lambda s: int(s, 0), - help="Secondary watchdog timer instance code (0xBD2328A8 for WDT0, 0x1730C77F for WDT1)", - ) - parser.add_argument( - "--secondary-wdtstart-crv", - type=int, - help="Secondary initial Counter Reload Value (CRV) for watchdog timer (minimum: 0xF)", - ) parser.add_argument( "--secondary", action="store_true", @@ -587,12 +557,6 @@ def main() -> None: uicr.PROTECTEDMEM.ENABLE = ENABLED_VALUE uicr.PROTECTEDMEM.SIZE4KB = args.protectedmem_size_bytes // KB_4 - # Handle WDTSTART configuration - if args.wdtstart: - uicr.WDTSTART.ENABLE = ENABLED_VALUE - uicr.WDTSTART.CRV = args.wdtstart_crv - uicr.WDTSTART.INSTANCE = args.wdtstart_instance_code - # Process periphconf data first and configure UICR completely before creating hex objects periphconf_hex = IntelHex() secondary_periphconf_hex = IntelHex() @@ -661,12 +625,6 @@ def main() -> None: uicr.SECONDARY.PERIPHCONF.MAXCOUNT = args.secondary_periphconf_size // 8 - # Handle secondary WDTSTART configuration - if args.secondary_wdtstart: - uicr.SECONDARY.WDTSTART.ENABLE = ENABLED_VALUE - uicr.SECONDARY.WDTSTART.CRV = args.secondary_wdtstart_crv - uicr.SECONDARY.WDTSTART.INSTANCE = args.secondary_wdtstart_instance_code - # Create UICR hex object with final UICR data uicr_hex = IntelHex() uicr_hex.frombytes(bytes(uicr), offset=args.uicr_address) diff --git a/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt b/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt index 39737888023a..b64b7c0399ac 100644 --- a/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt +++ b/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt @@ -77,7 +77,6 @@ endif() set(protectedmem_args) set(periphconf_args) -set(wdtstart_args) set(periphconf_elfs) set(merged_hex_file ${APPLICATION_BINARY_DIR}/zephyr/${CONFIG_KERNEL_BIN_NAME}.hex) set(secondary_periphconf_elfs) @@ -121,13 +120,6 @@ if(CONFIG_GEN_UICR_PROTECTEDMEM) list(APPEND protectedmem_args --protectedmem-size-bytes ${CONFIG_GEN_UICR_PROTECTEDMEM_SIZE_BYTES}) endif() -# Handle WDTSTART configuration -if(CONFIG_GEN_UICR_WDTSTART) - list(APPEND wdtstart_args --wdtstart) - list(APPEND wdtstart_args --wdtstart-instance-code ${CONFIG_GEN_UICR_WDTSTART_INSTANCE_CODE}) - list(APPEND wdtstart_args --wdtstart-crv ${CONFIG_GEN_UICR_WDTSTART_CRV}) -endif() - if(CONFIG_GEN_UICR_GENERATE_PERIPHCONF) # gen_uicr.py parses all zephyr.elf files. To find these files (which # have not been built yet) we scan sibling build directories for @@ -181,13 +173,6 @@ if(CONFIG_GEN_UICR_SECONDARY) --secondary-processor ${CONFIG_GEN_UICR_SECONDARY_PROCESSOR_VALUE} ) - # Handle secondary WDTSTART configuration - if(CONFIG_GEN_UICR_SECONDARY_WDTSTART) - list(APPEND secondary_args --secondary-wdtstart) - list(APPEND secondary_args --secondary-wdtstart-instance-code ${CONFIG_GEN_UICR_SECONDARY_WDTSTART_INSTANCE_CODE}) - list(APPEND secondary_args --secondary-wdtstart-crv ${CONFIG_GEN_UICR_SECONDARY_WDTSTART_CRV}) - endif() - if(CONFIG_GEN_UICR_SECONDARY_GENERATE_PERIPHCONF) # Compute SECONDARY_PERIPHCONF absolute address and size from this image's devicetree compute_partition_address_and_size("secondary_periphconf_partition" SECONDARY_PERIPHCONF_ADDRESS SECONDARY_PERIPHCONF_SIZE) @@ -210,7 +195,6 @@ add_custom_command( --uicr-address ${UICR_ADDRESS} --out-merged-hex ${merged_hex_file} --out-uicr-hex ${uicr_hex_file} - ${wdtstart_args} ${periphconf_args} ${securestorage_args} ${protectedmem_args} diff --git a/soc/nordic/common/uicr/gen_uicr/Kconfig b/soc/nordic/common/uicr/gen_uicr/Kconfig index 9b630139e641..fe7413a9d0da 100644 --- a/soc/nordic/common/uicr/gen_uicr/Kconfig +++ b/soc/nordic/common/uicr/gen_uicr/Kconfig @@ -46,91 +46,6 @@ config GEN_UICR_PROTECTEDMEM_SIZE_BYTES Size of the protected memory region in bytes. This value must be divisible by 4096 (4 kiB). -config GEN_UICR_WDTSTART - bool "Enable UICR.WDTSTART" - help - When enabled, the UICR generator will configure the - watchdog timer to start automatically before the - application core is booted. - -choice GEN_UICR_WDTSTART_INSTANCE - prompt "Watchdog timer instance" - depends on GEN_UICR_WDTSTART - help - Select which watchdog timer instance to use. - -config GEN_UICR_WDTSTART_INSTANCE_WDT0 - bool "WDT0" - help - Use watchdog timer instance 0. - -config GEN_UICR_WDTSTART_INSTANCE_WDT1 - bool "WDT1" - help - Use watchdog timer instance 1. - -endchoice - -config GEN_UICR_WDTSTART_INSTANCE_CODE - hex - default 0xBD2328A8 if GEN_UICR_WDTSTART_INSTANCE_WDT0 - default 0x1730C77F if GEN_UICR_WDTSTART_INSTANCE_WDT1 - depends on GEN_UICR_WDTSTART - -config GEN_UICR_WDTSTART_CRV - int "Initial Counter Reload Value (CRV)" - default 65535 - range 15 4294967295 - depends on GEN_UICR_WDTSTART - help - Initial Counter Reload Value (CRV) for the watchdog timer. - This value determines the watchdog timeout period. - Must be at least 15 (0xF) to ensure proper watchdog operation. - Default value 65535 creates a 2-second timeout. - -config GEN_UICR_SECONDARY_WDTSTART - bool "Enable UICR.SECONDARY.WDTSTART" - depends on GEN_UICR_SECONDARY - help - When enabled, the UICR generator will configure the - watchdog timer to start automatically before the - secondary firmware is booted. - -choice GEN_UICR_SECONDARY_WDTSTART_INSTANCE - prompt "Secondary watchdog timer instance" - depends on GEN_UICR_SECONDARY_WDTSTART - help - Select which watchdog timer instance to use for secondary firmware. - -config GEN_UICR_SECONDARY_WDTSTART_INSTANCE_WDT0 - bool "WDT0" - help - Use watchdog timer instance 0 for secondary firmware. - -config GEN_UICR_SECONDARY_WDTSTART_INSTANCE_WDT1 - bool "WDT1" - help - Use watchdog timer instance 1 for secondary firmware. - -endchoice - -config GEN_UICR_SECONDARY_WDTSTART_INSTANCE_CODE - hex - default 0xBD2328A8 if GEN_UICR_SECONDARY_WDTSTART_INSTANCE_WDT0 - default 0x1730C77F if GEN_UICR_SECONDARY_WDTSTART_INSTANCE_WDT1 - depends on GEN_UICR_SECONDARY_WDTSTART - -config GEN_UICR_SECONDARY_WDTSTART_CRV - int "Secondary initial Counter Reload Value (CRV)" - default 65535 - range 15 4294967295 - depends on GEN_UICR_SECONDARY_WDTSTART - help - Initial Counter Reload Value (CRV) for the secondary watchdog timer. - This value determines the watchdog timeout period. - Must be at least 15 (0xF) to ensure proper watchdog operation. - Default value 65535 creates a 2-second timeout. - config GEN_UICR_SECONDARY bool "Enable UICR.SECONDARY.ENABLE" From 009778dc7ad30a79bcc64c9ddfa9d961954bfb61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B8e?= Date: Thu, 23 Oct 2025 13:01:14 +0200 Subject: [PATCH 1939/2141] [nrf fromtree] soc: nordic: uicr: Add support for UICR.WDTSTART MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add support for UICR.WDTSTART. UICR.WDTSTART configures the automatic start of a local watchdog timer before the application core is booted. This provides early system protection ensuring that the system can recover from early boot failures. Signed-off-by: Sebastian Bøe (cherry picked from commit af32ebd19868c7e8cff7e9f65e898a1d0771f653) --- scripts/ci/check_compliance.py | 18 ++-- soc/nordic/common/uicr/gen_uicr.py | 42 +++++++++ .../common/uicr/gen_uicr/CMakeLists.txt | 16 ++++ soc/nordic/common/uicr/gen_uicr/Kconfig | 87 +++++++++++++++++++ 4 files changed, 157 insertions(+), 6 deletions(-) diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index 50a0ecfa087f..f181cf8e1b39 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -1351,12 +1351,18 @@ def check_no_undef_outside_kconfig(self, kconf): "FOO_SETTING_1", "FOO_SETTING_2", "GEN_UICR_GENERATE_PERIPHCONF", # Used in specialized build tool, not part of main Kconfig - "GEN_UICR_PROTECTEDMEM", # Used in specialized build tool, not part of main Kconfig - "GEN_UICR_PROTECTEDMEM_SIZE_BYTES", # Used in specialized build tool, not part of main Kconfig - "GEN_UICR_SECONDARY", # Used in specialized build tool, not part of main Kconfig - "GEN_UICR_SECONDARY_GENERATE_PERIPHCONF", # Used in specialized build tool, not part of main Kconfig - "GEN_UICR_SECONDARY_PROCESSOR_VALUE", # Used in specialized build tool, not part of main Kconfig - "GEN_UICR_SECURESTORAGE", # Used in specialized build tool, not part of main Kconfig + "GEN_UICR_PROTECTEDMEM", + "GEN_UICR_PROTECTEDMEM_SIZE_BYTES", + "GEN_UICR_SECONDARY", + "GEN_UICR_SECONDARY_GENERATE_PERIPHCONF", + "GEN_UICR_SECONDARY_PROCESSOR_VALUE", + "GEN_UICR_SECONDARY_WDTSTART", + "GEN_UICR_SECONDARY_WDTSTART_CRV", + "GEN_UICR_SECONDARY_WDTSTART_INSTANCE_CODE", + "GEN_UICR_SECURESTORAGE", + "GEN_UICR_WDTSTART", + "GEN_UICR_WDTSTART_CRV", + "GEN_UICR_WDTSTART_INSTANCE_CODE", "HEAP_MEM_POOL_ADD_SIZE_", # Used as an option matching prefix "HUGETLBFS", # Linux, in boards/xtensa/intel_adsp_cavs25/doc "IAR_BUFFERED_WRITE", diff --git a/soc/nordic/common/uicr/gen_uicr.py b/soc/nordic/common/uicr/gen_uicr.py index bea0ba2a2dfa..da2938bf05c9 100644 --- a/soc/nordic/common/uicr/gen_uicr.py +++ b/soc/nordic/common/uicr/gen_uicr.py @@ -440,6 +440,36 @@ def main() -> None: type=int, help="Protected memory size in bytes (must be divisible by 4096)", ) + parser.add_argument( + "--wdtstart", + action="store_true", + help="Enable watchdog timer start in UICR", + ) + parser.add_argument( + "--wdtstart-instance-code", + type=lambda s: int(s, 0), + help="Watchdog timer instance code (0xBD2328A8 for WDT0, 0x1730C77F for WDT1)", + ) + parser.add_argument( + "--wdtstart-crv", + type=int, + help="Initial Counter Reload Value (CRV) for watchdog timer (minimum: 0xF)", + ) + parser.add_argument( + "--secondary-wdtstart", + action="store_true", + help="Enable watchdog timer start in UICR.SECONDARY", + ) + parser.add_argument( + "--secondary-wdtstart-instance-code", + type=lambda s: int(s, 0), + help="Secondary watchdog timer instance code (0xBD2328A8 for WDT0, 0x1730C77F for WDT1)", + ) + parser.add_argument( + "--secondary-wdtstart-crv", + type=int, + help="Secondary initial Counter Reload Value (CRV) for watchdog timer (minimum: 0xF)", + ) parser.add_argument( "--secondary", action="store_true", @@ -557,6 +587,12 @@ def main() -> None: uicr.PROTECTEDMEM.ENABLE = ENABLED_VALUE uicr.PROTECTEDMEM.SIZE4KB = args.protectedmem_size_bytes // KB_4 + # Handle WDTSTART configuration + if args.wdtstart: + uicr.WDTSTART.ENABLE = ENABLED_VALUE + uicr.WDTSTART.CRV = args.wdtstart_crv + uicr.WDTSTART.INSTANCE = args.wdtstart_instance_code + # Process periphconf data first and configure UICR completely before creating hex objects periphconf_hex = IntelHex() secondary_periphconf_hex = IntelHex() @@ -625,6 +661,12 @@ def main() -> None: uicr.SECONDARY.PERIPHCONF.MAXCOUNT = args.secondary_periphconf_size // 8 + # Handle secondary WDTSTART configuration + if args.secondary_wdtstart: + uicr.SECONDARY.WDTSTART.ENABLE = ENABLED_VALUE + uicr.SECONDARY.WDTSTART.CRV = args.secondary_wdtstart_crv + uicr.SECONDARY.WDTSTART.INSTANCE = args.secondary_wdtstart_instance_code + # Create UICR hex object with final UICR data uicr_hex = IntelHex() uicr_hex.frombytes(bytes(uicr), offset=args.uicr_address) diff --git a/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt b/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt index b64b7c0399ac..39737888023a 100644 --- a/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt +++ b/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt @@ -77,6 +77,7 @@ endif() set(protectedmem_args) set(periphconf_args) +set(wdtstart_args) set(periphconf_elfs) set(merged_hex_file ${APPLICATION_BINARY_DIR}/zephyr/${CONFIG_KERNEL_BIN_NAME}.hex) set(secondary_periphconf_elfs) @@ -120,6 +121,13 @@ if(CONFIG_GEN_UICR_PROTECTEDMEM) list(APPEND protectedmem_args --protectedmem-size-bytes ${CONFIG_GEN_UICR_PROTECTEDMEM_SIZE_BYTES}) endif() +# Handle WDTSTART configuration +if(CONFIG_GEN_UICR_WDTSTART) + list(APPEND wdtstart_args --wdtstart) + list(APPEND wdtstart_args --wdtstart-instance-code ${CONFIG_GEN_UICR_WDTSTART_INSTANCE_CODE}) + list(APPEND wdtstart_args --wdtstart-crv ${CONFIG_GEN_UICR_WDTSTART_CRV}) +endif() + if(CONFIG_GEN_UICR_GENERATE_PERIPHCONF) # gen_uicr.py parses all zephyr.elf files. To find these files (which # have not been built yet) we scan sibling build directories for @@ -173,6 +181,13 @@ if(CONFIG_GEN_UICR_SECONDARY) --secondary-processor ${CONFIG_GEN_UICR_SECONDARY_PROCESSOR_VALUE} ) + # Handle secondary WDTSTART configuration + if(CONFIG_GEN_UICR_SECONDARY_WDTSTART) + list(APPEND secondary_args --secondary-wdtstart) + list(APPEND secondary_args --secondary-wdtstart-instance-code ${CONFIG_GEN_UICR_SECONDARY_WDTSTART_INSTANCE_CODE}) + list(APPEND secondary_args --secondary-wdtstart-crv ${CONFIG_GEN_UICR_SECONDARY_WDTSTART_CRV}) + endif() + if(CONFIG_GEN_UICR_SECONDARY_GENERATE_PERIPHCONF) # Compute SECONDARY_PERIPHCONF absolute address and size from this image's devicetree compute_partition_address_and_size("secondary_periphconf_partition" SECONDARY_PERIPHCONF_ADDRESS SECONDARY_PERIPHCONF_SIZE) @@ -195,6 +210,7 @@ add_custom_command( --uicr-address ${UICR_ADDRESS} --out-merged-hex ${merged_hex_file} --out-uicr-hex ${uicr_hex_file} + ${wdtstart_args} ${periphconf_args} ${securestorage_args} ${protectedmem_args} diff --git a/soc/nordic/common/uicr/gen_uicr/Kconfig b/soc/nordic/common/uicr/gen_uicr/Kconfig index fe7413a9d0da..74e24cafbee4 100644 --- a/soc/nordic/common/uicr/gen_uicr/Kconfig +++ b/soc/nordic/common/uicr/gen_uicr/Kconfig @@ -46,6 +46,93 @@ config GEN_UICR_PROTECTEDMEM_SIZE_BYTES Size of the protected memory region in bytes. This value must be divisible by 4096 (4 kiB). +config GEN_UICR_WDTSTART + bool "Enable UICR.WDTSTART" + help + When enabled, the UICR generator will configure an application + domain watchdog timer to start automatically before the + application core is booted. + +choice GEN_UICR_WDTSTART_INSTANCE + prompt "Watchdog timer instance" + depends on GEN_UICR_WDTSTART + default GEN_UICR_WDTSTART_INSTANCE_WDT0 + help + Select which watchdog timer instance to use. + +config GEN_UICR_WDTSTART_INSTANCE_WDT0 + bool "WDT0" + help + Use watchdog timer instance 0. + +config GEN_UICR_WDTSTART_INSTANCE_WDT1 + bool "WDT1" + help + Use watchdog timer instance 1. + +endchoice + +config GEN_UICR_WDTSTART_INSTANCE_CODE + hex + default 0xBD2328A8 if GEN_UICR_WDTSTART_INSTANCE_WDT0 + default 0x1730C77F if GEN_UICR_WDTSTART_INSTANCE_WDT1 + depends on GEN_UICR_WDTSTART + +config GEN_UICR_WDTSTART_CRV + int "Initial Counter Reload Value (CRV)" + default 65535 + range 15 4294967295 + depends on GEN_UICR_WDTSTART + help + Initial Counter Reload Value (CRV) for the watchdog timer. + This value determines the watchdog timeout period. + Must be at least 15 (0xF) to ensure proper watchdog operation. + Default value 65535 creates a 2-second timeout. + +config GEN_UICR_SECONDARY_WDTSTART + bool "Enable UICR.SECONDARY.WDTSTART" + depends on GEN_UICR_SECONDARY + help + When enabled, the UICR generator will configure the + watchdog timer to start automatically before the + secondary firmware is booted. + +choice GEN_UICR_SECONDARY_WDTSTART_INSTANCE + prompt "Secondary watchdog timer instance" + depends on GEN_UICR_SECONDARY_WDTSTART + default GEN_UICR_SECONDARY_WDTSTART_INSTANCE_WDT0 + help + Select which watchdog timer instance to use for secondary firmware. + +config GEN_UICR_SECONDARY_WDTSTART_INSTANCE_WDT0 + bool "WDT0" + help + Use watchdog timer instance 0 for secondary firmware. + +config GEN_UICR_SECONDARY_WDTSTART_INSTANCE_WDT1 + bool "WDT1" + help + Use watchdog timer instance 1 for secondary firmware. + +endchoice + +config GEN_UICR_SECONDARY_WDTSTART_INSTANCE_CODE + hex + default 0xBD2328A8 if GEN_UICR_SECONDARY_WDTSTART_INSTANCE_WDT0 + default 0x1730C77F if GEN_UICR_SECONDARY_WDTSTART_INSTANCE_WDT1 + depends on GEN_UICR_SECONDARY_WDTSTART + +config GEN_UICR_SECONDARY_WDTSTART_CRV + int "Secondary initial Counter Reload Value (CRV)" + default 65535 + range 15 4294967295 + depends on GEN_UICR_SECONDARY_WDTSTART + help + Initial Counter Reload Value (CRV) for the secondary watchdog timer. + This value determines the watchdog timeout period. + Must be at least 15 (0xF) to ensure proper watchdog operation. + Default value 65535 creates a 2-second timeout. + config GEN_UICR_SECONDARY bool "Enable UICR.SECONDARY.ENABLE" From 5e1449b85648f0392755b3408fefca7ac25f0eff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B8e?= Date: Thu, 23 Oct 2025 13:03:10 +0200 Subject: [PATCH 1940/2141] [nrf fromtree] soc: nordic: uicr: Add support for UICR.SECONDARY.TRIGGER MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add support for UICR.SECONDARY.TRIGGER configuration, which enables automatic booting of secondary firmware based on specific reset reasons. This introduces Kconfig options for configuring: - UICR.SECONDARY.TRIGGER.ENABLE - Enable/disable automatic triggers - UICR.SECONDARY.TRIGGER.RESETREAS - Bitmask of reset reasons that trigger secondary firmware boot Individual Kconfig options are provided for each reset reason: - APPLICATIONWDT0/1 - Application core watchdog timeouts - APPLICATIONLOCKUP - Application core CPU lockup - RADIOCOREWDT0/1 - Radio core watchdog timeouts - RADIOCORELOCKUP - Radio core CPU lockup Signed-off-by: Sebastian Bøe (cherry picked from commit 9dc2b614d6bc21485ec90f812cf0d3512a16b23f) --- scripts/ci/check_compliance.py | 7 ++++ soc/nordic/common/uicr/gen_uicr.py | 19 +++++++++ .../common/uicr/gen_uicr/CMakeLists.txt | 28 +++++++++++++ soc/nordic/common/uicr/gen_uicr/Kconfig | 42 +++++++++++++++++++ 4 files changed, 96 insertions(+) diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index f181cf8e1b39..0b343269b32e 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -1356,6 +1356,13 @@ def check_no_undef_outside_kconfig(self, kconf): "GEN_UICR_SECONDARY", "GEN_UICR_SECONDARY_GENERATE_PERIPHCONF", "GEN_UICR_SECONDARY_PROCESSOR_VALUE", + "GEN_UICR_SECONDARY_TRIGGER", + "GEN_UICR_SECONDARY_TRIGGER_APPLICATIONLOCKUP", + "GEN_UICR_SECONDARY_TRIGGER_APPLICATIONWDT0", + "GEN_UICR_SECONDARY_TRIGGER_APPLICATIONWDT1", + "GEN_UICR_SECONDARY_TRIGGER_RADIOCORELOCKUP", + "GEN_UICR_SECONDARY_TRIGGER_RADIOCOREWDT0", + "GEN_UICR_SECONDARY_TRIGGER_RADIOCOREWDT1", "GEN_UICR_SECONDARY_WDTSTART", "GEN_UICR_SECONDARY_WDTSTART_CRV", "GEN_UICR_SECONDARY_WDTSTART_INSTANCE_CODE", diff --git a/soc/nordic/common/uicr/gen_uicr.py b/soc/nordic/common/uicr/gen_uicr.py index da2938bf05c9..36f4dc1d44c0 100644 --- a/soc/nordic/common/uicr/gen_uicr.py +++ b/soc/nordic/common/uicr/gen_uicr.py @@ -487,6 +487,20 @@ def main() -> None: type=lambda s: int(s, 0), help="Processor to boot for the secondary firmware ", ) + parser.add_argument( + "--secondary-trigger", + action="store_true", + help="Enable UICR.SECONDARY.TRIGGER for automatic secondary firmware boot on reset events", + ) + parser.add_argument( + "--secondary-trigger-resetreas", + default=0, + type=lambda s: int(s, 0), + help=( + "Bitmask of reset reasons that trigger secondary firmware boot " + "(decimal or 0x-prefixed hex)" + ), + ) parser.add_argument( "--secondary-periphconf-address", default=None, @@ -628,6 +642,11 @@ def main() -> None: uicr.SECONDARY.ADDRESS = args.secondary_address uicr.SECONDARY.PROCESSOR = args.secondary_processor + # Handle secondary TRIGGER configuration + if args.secondary_trigger: + uicr.SECONDARY.TRIGGER.ENABLE = ENABLED_VALUE + uicr.SECONDARY.TRIGGER.RESETREAS = args.secondary_trigger_resetreas + # Handle secondary periphconf if provided if args.out_secondary_periphconf_hex: secondary_periphconf_combined = extract_and_combine_periphconfs( diff --git a/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt b/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt index 39737888023a..d5a71e0562f4 100644 --- a/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt +++ b/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt @@ -188,6 +188,34 @@ if(CONFIG_GEN_UICR_SECONDARY) list(APPEND secondary_args --secondary-wdtstart-crv ${CONFIG_GEN_UICR_SECONDARY_WDTSTART_CRV}) endif() + # Handle secondary TRIGGER configuration + if(CONFIG_GEN_UICR_SECONDARY_TRIGGER) + list(APPEND secondary_args --secondary-trigger) + + # Compute RESETREAS bitmask from individual trigger configs + set(resetreas_value 0) + if(CONFIG_GEN_UICR_SECONDARY_TRIGGER_APPLICATIONWDT0) + math(EXPR resetreas_value "${resetreas_value} + 0x001") + endif() + if(CONFIG_GEN_UICR_SECONDARY_TRIGGER_APPLICATIONWDT1) + math(EXPR resetreas_value "${resetreas_value} + 0x002") + endif() + if(CONFIG_GEN_UICR_SECONDARY_TRIGGER_APPLICATIONLOCKUP) + math(EXPR resetreas_value "${resetreas_value} + 0x008") + endif() + if(CONFIG_GEN_UICR_SECONDARY_TRIGGER_RADIOCOREWDT0) + math(EXPR resetreas_value "${resetreas_value} + 0x020") + endif() + if(CONFIG_GEN_UICR_SECONDARY_TRIGGER_RADIOCOREWDT1) + math(EXPR resetreas_value "${resetreas_value} + 0x040") + endif() + if(CONFIG_GEN_UICR_SECONDARY_TRIGGER_RADIOCORELOCKUP) + math(EXPR resetreas_value "${resetreas_value} + 0x100") + endif() + + list(APPEND secondary_args --secondary-trigger-resetreas ${resetreas_value}) + endif() + if(CONFIG_GEN_UICR_SECONDARY_GENERATE_PERIPHCONF) # Compute SECONDARY_PERIPHCONF absolute address and size from this image's devicetree compute_partition_address_and_size("secondary_periphconf_partition" SECONDARY_PERIPHCONF_ADDRESS SECONDARY_PERIPHCONF_SIZE) diff --git a/soc/nordic/common/uicr/gen_uicr/Kconfig b/soc/nordic/common/uicr/gen_uicr/Kconfig index 74e24cafbee4..6d213a95887d 100644 --- a/soc/nordic/common/uicr/gen_uicr/Kconfig +++ b/soc/nordic/common/uicr/gen_uicr/Kconfig @@ -168,6 +168,48 @@ config GEN_UICR_SECONDARY_PROCESSOR_VALUE default 0xBD2328A8 if GEN_UICR_SECONDARY_PROCESSOR_APPLICATION default 0x1730C77F if GEN_UICR_SECONDARY_PROCESSOR_RADIOCORE +config GEN_UICR_SECONDARY_TRIGGER + bool "Enable UICR.SECONDARY.TRIGGER" + help + When enabled, configures automatic triggers that cause IronSide SE + to boot the secondary firmware instead of the primary firmware based + on specific reset reasons. + +if GEN_UICR_SECONDARY_TRIGGER + +config GEN_UICR_SECONDARY_TRIGGER_APPLICATIONWDT0 + bool "Trigger on Application domain watchdog 0 reset" + help + Boot secondary firmware when Application domain watchdog 0 causes a reset. + +config GEN_UICR_SECONDARY_TRIGGER_APPLICATIONWDT1 + bool "Trigger on Application domain watchdog 1 reset" + help + Boot secondary firmware when Application domain watchdog 1 causes a reset. + +config GEN_UICR_SECONDARY_TRIGGER_APPLICATIONLOCKUP + bool "Trigger on Application domain CPU lockup reset" + help + Boot secondary firmware when Application domain CPU lockup causes a reset. + +config GEN_UICR_SECONDARY_TRIGGER_RADIOCOREWDT0 + bool "Trigger on Radio core watchdog 0 reset" + help + Boot secondary firmware when Radio core watchdog 0 causes a reset. + +config GEN_UICR_SECONDARY_TRIGGER_RADIOCOREWDT1 + bool "Trigger on Radio core watchdog 1 reset" + help + Boot secondary firmware when Radio core watchdog 1 causes a reset. + +config GEN_UICR_SECONDARY_TRIGGER_RADIOCORELOCKUP + bool "Trigger on Radio core CPU lockup reset" + help + Boot secondary firmware when Radio core CPU lockup causes a reset. + + +endif # GEN_UICR_SECONDARY_TRIGGER + endif # GEN_UICR_SECONDARY endmenu From 245fde6cda3dbd04a70992059ede426e785113f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B8e?= Date: Thu, 23 Oct 2025 13:03:25 +0200 Subject: [PATCH 1941/2141] [nrf fromtree] soc: nordic: uicr: Add support for UICR.SECONDARY.PROTECTEDMEM MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add support for UICR.SECONDARY.PROTECTEDMEM configuration, which enables configuration of the protected memory region for secondary firmware. This introduces Kconfig options for configuring: - GEN_UICR_SECONDARY_PROTECTEDMEM - Enable/disable protected memory for secondary firmware - GEN_UICR_SECONDARY_PROTECTEDMEM_SIZE_BYTES - Size of the protected memory region in bytes The implementation validates that the configured size is divisible by 4096 bytes (4 KiB) as required by the hardware, and converts it to 4 KiB units when writing to UICR.SECONDARY.PROTECTEDMEM.SIZE4KB. Signed-off-by: Sebastian Bøe (cherry picked from commit c3f6b8cb34b91ae336894006596107943974e0ae) --- scripts/ci/check_compliance.py | 2 ++ soc/nordic/common/uicr/gen_uicr.py | 15 +++++++++++++++ soc/nordic/common/uicr/gen_uicr/CMakeLists.txt | 5 +++++ soc/nordic/common/uicr/gen_uicr/Kconfig | 16 +++++++++++++++- 4 files changed, 37 insertions(+), 1 deletion(-) diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index 0b343269b32e..b79af12e6c6a 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -1356,6 +1356,8 @@ def check_no_undef_outside_kconfig(self, kconf): "GEN_UICR_SECONDARY", "GEN_UICR_SECONDARY_GENERATE_PERIPHCONF", "GEN_UICR_SECONDARY_PROCESSOR_VALUE", + "GEN_UICR_SECONDARY_PROTECTEDMEM", + "GEN_UICR_SECONDARY_PROTECTEDMEM_SIZE_BYTES", "GEN_UICR_SECONDARY_TRIGGER", "GEN_UICR_SECONDARY_TRIGGER_APPLICATIONLOCKUP", "GEN_UICR_SECONDARY_TRIGGER_APPLICATIONWDT0", diff --git a/soc/nordic/common/uicr/gen_uicr.py b/soc/nordic/common/uicr/gen_uicr.py index 36f4dc1d44c0..0b47be4c5a4d 100644 --- a/soc/nordic/common/uicr/gen_uicr.py +++ b/soc/nordic/common/uicr/gen_uicr.py @@ -501,6 +501,12 @@ def main() -> None: "(decimal or 0x-prefixed hex)" ), ) + parser.add_argument( + "--secondary-protectedmem-size", + default=None, + type=lambda s: int(s, 0), + help="Size in bytes of the secondary protected memory region (decimal or 0x-prefixed hex)", + ) parser.add_argument( "--secondary-periphconf-address", default=None, @@ -647,6 +653,15 @@ def main() -> None: uicr.SECONDARY.TRIGGER.ENABLE = ENABLED_VALUE uicr.SECONDARY.TRIGGER.RESETREAS = args.secondary_trigger_resetreas + # Handle secondary PROTECTEDMEM configuration + if args.secondary_protectedmem_size: + uicr.SECONDARY.PROTECTEDMEM.ENABLE = ENABLED_VALUE + if args.secondary_protectedmem_size % 4096 != 0: + raise ScriptError( + f"args.secondary_protectedmem_size was {args.secondary_protectedmem_size}, " + f"but must be divisible by 4096" + ) + uicr.SECONDARY.PROTECTEDMEM.SIZE4KB = args.secondary_protectedmem_size // 4096 # Handle secondary periphconf if provided if args.out_secondary_periphconf_hex: secondary_periphconf_combined = extract_and_combine_periphconfs( diff --git a/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt b/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt index d5a71e0562f4..41ccdf454a33 100644 --- a/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt +++ b/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt @@ -216,6 +216,11 @@ if(CONFIG_GEN_UICR_SECONDARY) list(APPEND secondary_args --secondary-trigger-resetreas ${resetreas_value}) endif() + # Handle secondary PROTECTEDMEM configuration + if(CONFIG_GEN_UICR_SECONDARY_PROTECTEDMEM) + list(APPEND secondary_args --secondary-protectedmem-size ${CONFIG_GEN_UICR_SECONDARY_PROTECTEDMEM_SIZE_BYTES}) + endif() + if(CONFIG_GEN_UICR_SECONDARY_GENERATE_PERIPHCONF) # Compute SECONDARY_PERIPHCONF absolute address and size from this image's devicetree compute_partition_address_and_size("secondary_periphconf_partition" SECONDARY_PERIPHCONF_ADDRESS SECONDARY_PERIPHCONF_SIZE) diff --git a/soc/nordic/common/uicr/gen_uicr/Kconfig b/soc/nordic/common/uicr/gen_uicr/Kconfig index 6d213a95887d..df5616dc0442 100644 --- a/soc/nordic/common/uicr/gen_uicr/Kconfig +++ b/soc/nordic/common/uicr/gen_uicr/Kconfig @@ -207,9 +207,23 @@ config GEN_UICR_SECONDARY_TRIGGER_RADIOCORELOCKUP help Boot secondary firmware when Radio core CPU lockup causes a reset. - endif # GEN_UICR_SECONDARY_TRIGGER +config GEN_UICR_SECONDARY_PROTECTEDMEM + bool "Enable UICR.SECONDARY.PROTECTEDMEM" + depends on GEN_UICR_SECONDARY + help + When enabled, the UICR generator will configure the + protected memory region for the secondary firmware. + +config GEN_UICR_SECONDARY_PROTECTEDMEM_SIZE_BYTES + int "Secondary protected memory size in bytes" + default 4096 + depends on GEN_UICR_SECONDARY_PROTECTEDMEM + help + Size of the secondary protected memory region in bytes. + This value must be divisible by 4096 (4 kiB). + endif # GEN_UICR_SECONDARY endmenu From 1be37ce1f05035d2cababa0d7522ff456f338a4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B8e?= Date: Thu, 23 Oct 2025 13:03:36 +0200 Subject: [PATCH 1942/2141] [nrf fromtree] soc: nordic: uicr: Add support for UICR.LOCK MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add support for UICR.LOCK configuration, which locks the entire UICR configuration in NVR0 to prevent unauthorized modifications. This introduces a Kconfig option GEN_UICR_LOCK that enables locking of the UICR. Once locked, the UICR can only be modified by performing an ERASEALL operation. This is a critical security feature for production devices, typically enabled alongside UICR.APPROTECT, UICR.PROTECTEDMEM, and UICR.ERASEPROTECT to establish a complete device protection scheme. When enabled, the gen_uicr.py script sets UICR.LOCK to 0xFFFFFFFF, which configures the NVR0 page as read-only and enforces integrity checks on the UICR content. Signed-off-by: Sebastian Bøe (cherry picked from commit 1ffdf09c25dfb0082bdaccab5232823b73a15494) --- scripts/ci/check_compliance.py | 1 + soc/nordic/common/uicr/gen_uicr.py | 8 ++++++++ soc/nordic/common/uicr/gen_uicr/CMakeLists.txt | 7 +++++++ soc/nordic/common/uicr/gen_uicr/Kconfig | 11 +++++++++++ 4 files changed, 27 insertions(+) diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index b79af12e6c6a..21c72ebd2277 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -1351,6 +1351,7 @@ def check_no_undef_outside_kconfig(self, kconf): "FOO_SETTING_1", "FOO_SETTING_2", "GEN_UICR_GENERATE_PERIPHCONF", # Used in specialized build tool, not part of main Kconfig + "GEN_UICR_LOCK", "GEN_UICR_PROTECTEDMEM", "GEN_UICR_PROTECTEDMEM_SIZE_BYTES", "GEN_UICR_SECONDARY", diff --git a/soc/nordic/common/uicr/gen_uicr.py b/soc/nordic/common/uicr/gen_uicr.py index 0b47be4c5a4d..103dec53e82b 100644 --- a/soc/nordic/common/uicr/gen_uicr.py +++ b/soc/nordic/common/uicr/gen_uicr.py @@ -430,6 +430,11 @@ def main() -> None: type=lambda s: int(s, 0), help="Size in bytes of cpurad_its_partition (decimal or 0x-prefixed hex)", ) + parser.add_argument( + "--lock", + action="store_true", + help="Enable UICR.LOCK to prevent modifications without ERASEALL", + ) parser.add_argument( "--protectedmem", action="store_true", @@ -597,6 +602,9 @@ def main() -> None: uicr.SECURESTORAGE.ITS.APPLICATIONSIZE1KB = args.cpuapp_its_size // 1024 uicr.SECURESTORAGE.ITS.RADIOCORESIZE1KB = args.cpurad_its_size // 1024 + # Handle LOCK configuration + if args.lock: + uicr.LOCK = ENABLED_VALUE # Handle protected memory configuration if args.protectedmem: if args.protectedmem_size_bytes % KB_4 != 0: diff --git a/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt b/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt index 41ccdf454a33..8df980b0743b 100644 --- a/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt +++ b/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt @@ -75,6 +75,7 @@ endfunction() if(CMAKE_VERBOSE_MAKEFILE) endif() +set(lock_args) set(protectedmem_args) set(periphconf_args) set(wdtstart_args) @@ -115,6 +116,11 @@ if(CONFIG_GEN_UICR_SECURESTORAGE) list(APPEND securestorage_args --cpurad-its-size ${CPURAD_ITS_SIZE}) endif(CONFIG_GEN_UICR_SECURESTORAGE) +# Handle LOCK configuration +if(CONFIG_GEN_UICR_LOCK) + list(APPEND lock_args --lock) +endif() + # Handle protected memory configuration if(CONFIG_GEN_UICR_PROTECTEDMEM) list(APPEND protectedmem_args --protectedmem) @@ -243,6 +249,7 @@ add_custom_command( --uicr-address ${UICR_ADDRESS} --out-merged-hex ${merged_hex_file} --out-uicr-hex ${uicr_hex_file} + ${lock_args} ${wdtstart_args} ${periphconf_args} ${securestorage_args} diff --git a/soc/nordic/common/uicr/gen_uicr/Kconfig b/soc/nordic/common/uicr/gen_uicr/Kconfig index df5616dc0442..ef78927c8619 100644 --- a/soc/nordic/common/uicr/gen_uicr/Kconfig +++ b/soc/nordic/common/uicr/gen_uicr/Kconfig @@ -32,6 +32,17 @@ config GEN_UICR_SECURESTORAGE - At least one subpartition must be defined - Combined subpartition sizes must equal secure_storage_partition size +config GEN_UICR_LOCK + bool "Enable UICR.LOCK" + help + When enabled, locks the entire contents of the NVR0 page located in + MRAM10. This includes all values in both the UICR and the BICR (Board + Information Configuration Registers). Once locked, the UICR can only + be modified by performing an ERASEALL operation. + + This should be enabled only in production devices to prevent + unauthorized modification. + config GEN_UICR_PROTECTEDMEM bool "Enable UICR.PROTECTEDMEM" help From f85acf7657db0606d35a313c694350bf93ea5879 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B8e?= Date: Thu, 23 Oct 2025 13:03:47 +0200 Subject: [PATCH 1943/2141] [nrf fromtree] soc: nordic: uicr: Add support for UICR.ERASEPROTECT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add support for UICR.ERASEPROTECT configuration, which blocks ERASEALL operations to prevent bulk erasure of protected memory. This introduces a Kconfig option GEN_UICR_ERASEPROTECT that enables blocking of ERASEALL operations on NVR0, preserving UICR settings even if an attacker attempts a full-chip erase. This is a critical security feature for production devices. When enabled together with UICR.LOCK, it becomes impossible to modify the UICR in any way, establishing a permanent device protection scheme. Due to this irreversibility, it should only be enabled during the final stages of production. When enabled, the gen_uicr.py script sets UICR.ERASEPROTECT to 0xFFFFFFFF, which prevents the ERASEALL command from affecting the NVR0 page. Signed-off-by: Sebastian Bøe (cherry picked from commit e20352d80a02cbf1053932bfcd34489ba4a0f369) --- scripts/ci/check_compliance.py | 1 + soc/nordic/common/uicr/gen_uicr.py | 8 ++++++++ soc/nordic/common/uicr/gen_uicr/CMakeLists.txt | 7 +++++++ soc/nordic/common/uicr/gen_uicr/Kconfig | 12 ++++++++++++ 4 files changed, 28 insertions(+) diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index 21c72ebd2277..0baf98ba0abf 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -1350,6 +1350,7 @@ def check_no_undef_outside_kconfig(self, kconf): "FOO_LOG_LEVEL", "FOO_SETTING_1", "FOO_SETTING_2", + "GEN_UICR_ERASEPROTECT", "GEN_UICR_GENERATE_PERIPHCONF", # Used in specialized build tool, not part of main Kconfig "GEN_UICR_LOCK", "GEN_UICR_PROTECTEDMEM", diff --git a/soc/nordic/common/uicr/gen_uicr.py b/soc/nordic/common/uicr/gen_uicr.py index 103dec53e82b..390d96042528 100644 --- a/soc/nordic/common/uicr/gen_uicr.py +++ b/soc/nordic/common/uicr/gen_uicr.py @@ -435,6 +435,11 @@ def main() -> None: action="store_true", help="Enable UICR.LOCK to prevent modifications without ERASEALL", ) + parser.add_argument( + "--eraseprotect", + action="store_true", + help="Enable UICR.ERASEPROTECT to block ERASEALL operations", + ) parser.add_argument( "--protectedmem", action="store_true", @@ -605,6 +610,9 @@ def main() -> None: # Handle LOCK configuration if args.lock: uicr.LOCK = ENABLED_VALUE + # Handle ERASEPROTECT configuration + if args.eraseprotect: + uicr.ERASEPROTECT = ENABLED_VALUE # Handle protected memory configuration if args.protectedmem: if args.protectedmem_size_bytes % KB_4 != 0: diff --git a/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt b/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt index 8df980b0743b..0802d4f2f870 100644 --- a/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt +++ b/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt @@ -76,6 +76,7 @@ if(CMAKE_VERBOSE_MAKEFILE) endif() set(lock_args) +set(eraseprotect_args) set(protectedmem_args) set(periphconf_args) set(wdtstart_args) @@ -121,6 +122,11 @@ if(CONFIG_GEN_UICR_LOCK) list(APPEND lock_args --lock) endif() +# Handle ERASEPROTECT configuration +if(CONFIG_GEN_UICR_ERASEPROTECT) + list(APPEND eraseprotect_args --eraseprotect) +endif() + # Handle protected memory configuration if(CONFIG_GEN_UICR_PROTECTEDMEM) list(APPEND protectedmem_args --protectedmem) @@ -250,6 +256,7 @@ add_custom_command( --out-merged-hex ${merged_hex_file} --out-uicr-hex ${uicr_hex_file} ${lock_args} + ${eraseprotect_args} ${wdtstart_args} ${periphconf_args} ${securestorage_args} diff --git a/soc/nordic/common/uicr/gen_uicr/Kconfig b/soc/nordic/common/uicr/gen_uicr/Kconfig index ef78927c8619..39f304eb47cd 100644 --- a/soc/nordic/common/uicr/gen_uicr/Kconfig +++ b/soc/nordic/common/uicr/gen_uicr/Kconfig @@ -43,6 +43,18 @@ config GEN_UICR_LOCK This should be enabled only in production devices to prevent unauthorized modification. +config GEN_UICR_ERASEPROTECT + bool "Enable UICR.ERASEPROTECT" + depends on ! GEN_UICR_LOCK + help + When enabled, ERASEALL operations are blocked. + + This option is mutually exclusive with UICR.LOCK in Kconfig to prevent + accidental configuration where both are enabled simultaneously. If both + were enabled, the UICR would become impossible to modify in any way. + Note that gen_uicr.py can be used directly to create a configuration + with both enabled if needed. + config GEN_UICR_PROTECTEDMEM bool "Enable UICR.PROTECTEDMEM" help From 4cc690e1fa089c775ce32beb4fe9e1f4ceafaf5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B8e?= Date: Thu, 23 Oct 2025 13:04:02 +0200 Subject: [PATCH 1944/2141] [nrf fromtree] soc: nordic: uicr: Add support for UICR.APPROTECT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add support for UICR.APPROTECT configuration, which controls debugger and access-port permissions through the TAMPC peripheral. This introduces three Kconfig options that allow independent control over access port protection for different processor domains: - GEN_UICR_APPROTECT_APPLICATION_PROTECTED: Controls debug access to the application domain processor - GEN_UICR_APPROTECT_RADIOCORE_PROTECTED: Controls debug access to the radio core processor - GEN_UICR_APPROTECT_CORESIGHT_PROTECTED: Controls access to the CoreSight debug infrastructure When enabled, each option sets the corresponding UICR.APPROTECT register to PROTECTED (0xFFFFFFFF), which disables debug access for that domain. When disabled, the registers remain at their erased value (UNPROTECTED), allowing full debug access. This feature is critical for production devices where debug access must be restricted to prevent unauthorized access to sensitive code and data. Signed-off-by: Sebastian Bøe (cherry picked from commit 1438f8ae69f8869a7a99a241e50cb238b8174d11) --- scripts/ci/check_compliance.py | 3 +++ soc/nordic/common/uicr/gen_uicr.py | 26 +++++++++++++++++++ .../common/uicr/gen_uicr/CMakeLists.txt | 15 +++++++++++ soc/nordic/common/uicr/gen_uicr/Kconfig | 24 +++++++++++++++++ 4 files changed, 68 insertions(+) diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index 0baf98ba0abf..6c542272704c 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -1350,6 +1350,9 @@ def check_no_undef_outside_kconfig(self, kconf): "FOO_LOG_LEVEL", "FOO_SETTING_1", "FOO_SETTING_2", + "GEN_UICR_APPROTECT_APPLICATION_PROTECTED", + "GEN_UICR_APPROTECT_CORESIGHT_PROTECTED", + "GEN_UICR_APPROTECT_RADIOCORE_PROTECTED", "GEN_UICR_ERASEPROTECT", "GEN_UICR_GENERATE_PERIPHCONF", # Used in specialized build tool, not part of main Kconfig "GEN_UICR_LOCK", diff --git a/soc/nordic/common/uicr/gen_uicr.py b/soc/nordic/common/uicr/gen_uicr.py index 390d96042528..036ee770e12c 100644 --- a/soc/nordic/common/uicr/gen_uicr.py +++ b/soc/nordic/common/uicr/gen_uicr.py @@ -25,6 +25,8 @@ # Common values for representing enabled/disabled in the UICR format. ENABLED_VALUE = 0xFFFF_FFFF DISABLED_VALUE = 0xBD23_28A8 +PROTECTED_VALUE = ENABLED_VALUE # UICR_PROTECTED = UICR_ENABLED per uicr_defs.h +UNPROTECTED_VALUE = DISABLED_VALUE # Unprotected uses the default erased value KB_4 = 4096 @@ -440,6 +442,21 @@ def main() -> None: action="store_true", help="Enable UICR.ERASEPROTECT to block ERASEALL operations", ) + parser.add_argument( + "--approtect-application-protected", + action="store_true", + help="Protect application domain access port (disable debug access)", + ) + parser.add_argument( + "--approtect-radiocore-protected", + action="store_true", + help="Protect radio core access port (disable debug access)", + ) + parser.add_argument( + "--approtect-coresight-protected", + action="store_true", + help="Protect CoreSight access port (disable debug access)", + ) parser.add_argument( "--protectedmem", action="store_true", @@ -613,6 +630,15 @@ def main() -> None: # Handle ERASEPROTECT configuration if args.eraseprotect: uicr.ERASEPROTECT = ENABLED_VALUE + # Handle APPROTECT configuration + if args.approtect_application_protected: + uicr.APPROTECT.APPLICATION = PROTECTED_VALUE + + if args.approtect_radiocore_protected: + uicr.APPROTECT.RADIOCORE = PROTECTED_VALUE + + if args.approtect_coresight_protected: + uicr.APPROTECT.CORESIGHT = PROTECTED_VALUE # Handle protected memory configuration if args.protectedmem: if args.protectedmem_size_bytes % KB_4 != 0: diff --git a/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt b/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt index 0802d4f2f870..290cf16a0a6f 100644 --- a/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt +++ b/soc/nordic/common/uicr/gen_uicr/CMakeLists.txt @@ -77,6 +77,7 @@ endif() set(lock_args) set(eraseprotect_args) +set(approtect_args) set(protectedmem_args) set(periphconf_args) set(wdtstart_args) @@ -127,6 +128,19 @@ if(CONFIG_GEN_UICR_ERASEPROTECT) list(APPEND eraseprotect_args --eraseprotect) endif() +# Handle APPROTECT configuration +if(CONFIG_GEN_UICR_APPROTECT_APPLICATION_PROTECTED) + list(APPEND approtect_args --approtect-application-protected) +endif() + +if(CONFIG_GEN_UICR_APPROTECT_RADIOCORE_PROTECTED) + list(APPEND approtect_args --approtect-radiocore-protected) +endif() + +if(CONFIG_GEN_UICR_APPROTECT_CORESIGHT_PROTECTED) + list(APPEND approtect_args --approtect-coresight-protected) +endif() + # Handle protected memory configuration if(CONFIG_GEN_UICR_PROTECTEDMEM) list(APPEND protectedmem_args --protectedmem) @@ -257,6 +271,7 @@ add_custom_command( --out-uicr-hex ${uicr_hex_file} ${lock_args} ${eraseprotect_args} + ${approtect_args} ${wdtstart_args} ${periphconf_args} ${securestorage_args} diff --git a/soc/nordic/common/uicr/gen_uicr/Kconfig b/soc/nordic/common/uicr/gen_uicr/Kconfig index 39f304eb47cd..7f25cc839dd6 100644 --- a/soc/nordic/common/uicr/gen_uicr/Kconfig +++ b/soc/nordic/common/uicr/gen_uicr/Kconfig @@ -55,6 +55,30 @@ config GEN_UICR_ERASEPROTECT Note that gen_uicr.py can be used directly to create a configuration with both enabled if needed. +menu "UICR.APPROTECT - Access Port Protection" + +config GEN_UICR_APPROTECT_APPLICATION_PROTECTED + bool "Protect application domain access port" + help + When enabled, disables debug access to the application domain processor, + preventing debugger connection to application memory, registers, and debug + features. When disabled, full debug access is enabled. + +config GEN_UICR_APPROTECT_RADIOCORE_PROTECTED + bool "Protect radio core access port" + help + When enabled, disables debug access to the radio core processor, + preventing debugger connection to radio core memory, registers, and debug + features. When disabled, full debug access is enabled. + +config GEN_UICR_APPROTECT_CORESIGHT_PROTECTED + bool "Disable CoreSight subsystem" + help + When enabled will disable the coresight subsystem, preventing + system level trace features. + +endmenu + config GEN_UICR_PROTECTEDMEM bool "Enable UICR.PROTECTEDMEM" help From cd1a0c5d07c90b87f50e31590d506ea111a3a5c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B8e?= Date: Thu, 23 Oct 2025 13:04:16 +0200 Subject: [PATCH 1945/2141] [nrf fromtree] soc: nordic: uicr: Add safety flag for permanent device transition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add --permit-permanently-transitioning-device-to-deployed safety flag to gen_uicr.py, required when enabling both UICR.LOCK and UICR.ERASEPROTECT together. This prevents accidental permanent locking of devices since this combination makes the configuration irreversible. Signed-off-by: Sebastian Bøe (cherry picked from commit 35b89abd6120036033a2591db67d1b7921a229e4) --- scripts/ci/check_compliance.py | 2 +- soc/nordic/common/uicr/gen_uicr.py | 24 ++++++++++++++++++++++-- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index 6c542272704c..34e1535e8c59 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -1354,7 +1354,7 @@ def check_no_undef_outside_kconfig(self, kconf): "GEN_UICR_APPROTECT_CORESIGHT_PROTECTED", "GEN_UICR_APPROTECT_RADIOCORE_PROTECTED", "GEN_UICR_ERASEPROTECT", - "GEN_UICR_GENERATE_PERIPHCONF", # Used in specialized build tool, not part of main Kconfig + "GEN_UICR_GENERATE_PERIPHCONF", "GEN_UICR_LOCK", "GEN_UICR_PROTECTEDMEM", "GEN_UICR_PROTECTEDMEM_SIZE_BYTES", diff --git a/soc/nordic/common/uicr/gen_uicr.py b/soc/nordic/common/uicr/gen_uicr.py index 036ee770e12c..8dbbc7fe5ce9 100644 --- a/soc/nordic/common/uicr/gen_uicr.py +++ b/soc/nordic/common/uicr/gen_uicr.py @@ -432,6 +432,14 @@ def main() -> None: type=lambda s: int(s, 0), help="Size in bytes of cpurad_its_partition (decimal or 0x-prefixed hex)", ) + parser.add_argument( + "--permit-permanently-transitioning-device-to-deployed", + action="store_true", + help=( + "Safety flag required to enable both UICR.LOCK and UICR.ERASEPROTECT together. " + "Must be explicitly provided to acknowledge permanent device state changes." + ), + ) parser.add_argument( "--lock", action="store_true", @@ -624,10 +632,22 @@ def main() -> None: uicr.SECURESTORAGE.ITS.APPLICATIONSIZE1KB = args.cpuapp_its_size // 1024 uicr.SECURESTORAGE.ITS.RADIOCORESIZE1KB = args.cpurad_its_size // 1024 - # Handle LOCK configuration + # Handle LOCK and ERASEPROTECT configuration + # Check if both are enabled together - this requires explicit acknowledgment + if ( + args.lock + and args.eraseprotect + and not args.permit_permanently_transitioning_device_to_deployed + ): + raise ScriptError( + "Enabling both --lock and --eraseprotect requires " + "--permit-permanently-transitioning-device-to-deployed to be specified. " + "This combination permanently locks the device configuration and prevents " + "ERASEALL." + ) + if args.lock: uicr.LOCK = ENABLED_VALUE - # Handle ERASEPROTECT configuration if args.eraseprotect: uicr.ERASEPROTECT = ENABLED_VALUE # Handle APPROTECT configuration From e2fd60c4bca3cb121db3d27435a2b6425c3a1465 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B8e?= Date: Mon, 20 Oct 2025 12:14:29 +0200 Subject: [PATCH 1946/2141] [nrf fromtree] scripts: ci: check_compliance: Add missing gen_uicr UNDEF's MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add missing gen_uicr UNDEF's. Signed-off-by: Sebastian Bøe (cherry picked from commit 8e59980f01463571ecb98510928ce31a0a93db84) --- scripts/ci/check_compliance.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index 34e1535e8c59..eae915967e6b 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -1360,6 +1360,8 @@ def check_no_undef_outside_kconfig(self, kconf): "GEN_UICR_PROTECTEDMEM_SIZE_BYTES", "GEN_UICR_SECONDARY", "GEN_UICR_SECONDARY_GENERATE_PERIPHCONF", + "GEN_UICR_SECONDARY_PROCESSOR_APPLICATION", + "GEN_UICR_SECONDARY_PROCESSOR_RADIOCORE", "GEN_UICR_SECONDARY_PROCESSOR_VALUE", "GEN_UICR_SECONDARY_PROTECTEDMEM", "GEN_UICR_SECONDARY_PROTECTEDMEM_SIZE_BYTES", @@ -1373,10 +1375,14 @@ def check_no_undef_outside_kconfig(self, kconf): "GEN_UICR_SECONDARY_WDTSTART", "GEN_UICR_SECONDARY_WDTSTART_CRV", "GEN_UICR_SECONDARY_WDTSTART_INSTANCE_CODE", + "GEN_UICR_SECONDARY_WDTSTART_INSTANCE_WDT0", + "GEN_UICR_SECONDARY_WDTSTART_INSTANCE_WDT1", "GEN_UICR_SECURESTORAGE", "GEN_UICR_WDTSTART", "GEN_UICR_WDTSTART_CRV", "GEN_UICR_WDTSTART_INSTANCE_CODE", + "GEN_UICR_WDTSTART_INSTANCE_WDT0", + "GEN_UICR_WDTSTART_INSTANCE_WDT1", "HEAP_MEM_POOL_ADD_SIZE_", # Used as an option matching prefix "HUGETLBFS", # Linux, in boards/xtensa/intel_adsp_cavs25/doc "IAR_BUFFERED_WRITE", From 4c621a125a8ad38208d0e74bf2d7841a2f28fde9 Mon Sep 17 00:00:00 2001 From: Carles Cufi Date: Tue, 21 Oct 2025 14:02:53 +0200 Subject: [PATCH 1947/2141] [nrf fromtree] scripts: runners: nrf: Generalize the use of --erase-mode for all ICs Until now, for historical reasons (see f42cef9c81379b116664731f3bb5449257b3a1af and 58e0e31c7e273b12ad4895a8d441b07c7c3e807e), the use of the --erase-mode command-line switch was reserved for the nRF54L family. But in fact this can be used (instead of --erase) for any of the Nordic ICs. This patch extends the usage of this switch regardless of family. Signed-off-by: Carles Cufi (cherry picked from commit 146fd2c88ec38655d61d8fa3fc879cb47a9fd33d) --- scripts/west_commands/runners/nrf_common.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/scripts/west_commands/runners/nrf_common.py b/scripts/west_commands/runners/nrf_common.py index afa4665d8f47..e4c54732d59b 100644 --- a/scripts/west_commands/runners/nrf_common.py +++ b/scripts/west_commands/runners/nrf_common.py @@ -357,10 +357,13 @@ def program_hex(self): if not self.erase and regtool_generated_uicr: self.exec_op('erase', core=core, kind='uicr') else: + erase_mode = self._get_erase_mode(self.erase_mode) if self.erase: erase_arg = 'ERASE_ALL' + elif self.erase_mode: + erase_arg = erase_mode elif self.family == 'nrf54l': - erase_arg = self._get_erase_mode(self.erase_mode) or 'ERASE_NONE' + erase_arg = 'ERASE_NONE' else: erase_arg = 'ERASE_RANGES_TOUCHED_BY_FIRMWARE' @@ -479,10 +482,6 @@ def do_run(self, command, **kwargs): self.ensure_family() - if self.family != 'nrf54l' and self.erase_mode: - raise RuntimeError('Option --erase-mode can only be used with the ' - 'nRF54L family.') - self.ensure_output('hex') if IntelHex is None: raise RuntimeError('Python dependency intelhex was missing; ' From fcb3e3be21e1eda99b7d0a9185a6ef153e022694 Mon Sep 17 00:00:00 2001 From: Carles Cufi Date: Tue, 21 Oct 2025 19:16:59 +0200 Subject: [PATCH 1948/2141] [nrf fromtree] scripts: runners: nrfutil: Add a new --dry-run parameter In order to allow for users to invoke "west flash" without actual hardware connected but still running the logic and pregeneration of commands, specifically the json file. Signed-off-by: Carles Cufi (cherry picked from commit 0679c0571246e6b0a4f746bff7187d0cc240da9a) --- scripts/west_commands/runners/nrf_common.py | 9 ++++--- scripts/west_commands/runners/nrfutil.py | 28 ++++++++++++++------- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/scripts/west_commands/runners/nrf_common.py b/scripts/west_commands/runners/nrf_common.py index e4c54732d59b..75ad66aed99f 100644 --- a/scripts/west_commands/runners/nrf_common.py +++ b/scripts/west_commands/runners/nrf_common.py @@ -53,7 +53,7 @@ class NrfBinaryRunner(ZephyrBinaryRunner): def __init__(self, cfg, family, softreset, pinreset, dev_id, erase=False, erase_mode=None, ext_erase_mode=None, reset=True, - tool_opt=None, force=False, recover=False): + tool_opt=None, force=False, recover=False, dry_run=False): super().__init__(cfg) self.hex_ = cfg.hex_file # The old --nrf-family options takes upper-case family names @@ -67,6 +67,7 @@ def __init__(self, cfg, family, softreset, pinreset, dev_id, erase=False, self.reset = bool(reset) self.force = force self.recover = bool(recover) + self.dry_run = bool(dry_run) self.tool_opt = [] if tool_opt is not None: @@ -118,7 +119,6 @@ def do_add_parser(cls, parser): choices=['none', 'ranges', 'all'], help='Select the type of erase operation for the ' 'external non-volatile memory') - parser.set_defaults(reset=True) @classmethod @@ -139,7 +139,10 @@ def ensure_snr(self): self.dev_id = [d.lstrip("0") for d in dev_id] return if not dev_id or "*" in dev_id: - dev_id = self.get_board_snr(dev_id or "*") + if not self.dry_run: + dev_id = self.get_board_snr(dev_id or "*") + else: + dev_id = "DEVICEID" # for a dry run self.dev_id = dev_id.lstrip("0") @abc.abstractmethod diff --git a/scripts/west_commands/runners/nrfutil.py b/scripts/west_commands/runners/nrfutil.py index 0490df29ca17..9deb32e06a02 100644 --- a/scripts/west_commands/runners/nrfutil.py +++ b/scripts/west_commands/runners/nrfutil.py @@ -5,6 +5,7 @@ '''Runner for flashing with nrfutil.''' import json +import shlex import subprocess import sys from pathlib import Path @@ -18,12 +19,12 @@ class NrfUtilBinaryRunner(NrfBinaryRunner): def __init__(self, cfg, family, softreset, pinreset, dev_id, erase=False, erase_mode=None, ext_erase_mode=None, reset=True, tool_opt=None, - force=False, recover=False, - ext_mem_config_file=None): + force=False, recover=False, ext_mem_config_file=None, + dry_run=False): super().__init__(cfg, family, softreset, pinreset, dev_id, erase, erase_mode, ext_erase_mode, reset, tool_opt, force, - recover) + recover, dry_run) self.ext_mem_config_file = ext_mem_config_file @@ -55,7 +56,8 @@ def do_create(cls, cfg, args): ext_erase_mode=args.ext_erase_mode, reset=args.reset, tool_opt=args.tool_opt, force=args.force, recover=args.recover, - ext_mem_config_file=args.ext_mem_config_file) + ext_mem_config_file=args.ext_mem_config_file, + dry_run=args.dry_run) @classmethod def do_add_parser(cls, parser): @@ -63,15 +65,23 @@ def do_add_parser(cls, parser): parser.add_argument('--ext-mem-config-file', required=False, dest='ext_mem_config_file', help='path to an JSON file with external memory configuration') + parser.add_argument('--dry-run', required=False, + action='store_true', + help='''Generate all the commands without actually + executing them''') - def _exec(self, args): + def _exec(self, args, force=False): jout_all = [] cmd = ['nrfutil', '--json', 'device'] + args - self._log_cmd(cmd) - if _DRY_RUN: - return {} + escaped = ' '.join(shlex.quote(s) for s in cmd) + if _DRY_RUN or (self.dry_run): + self.logger.info(escaped) + if not force: + return {} + else: + self.logger.debug(escaped) with subprocess.Popen(cmd, stdout=subprocess.PIPE) as p: for line in iter(p.stdout.readline, b''): @@ -148,7 +158,7 @@ def _append_batch(self, op, json_file): cmd += ['--core', op['core']] if op.get('core') else [] cmd += ['--x-family', f'{self.family}'] cmd += ['--x-append-batch', f'{json_file}'] - self._exec(cmd) + self._exec(cmd, force=True) def _exec_batch(self): # Use x-append-batch to get the JSON from nrfutil itself From 37e2e04f4678268532d231896a8c5491a2d75de5 Mon Sep 17 00:00:00 2001 From: alperen sener Date: Fri, 24 Oct 2025 15:25:55 +0200 Subject: [PATCH 1949/2141] [nrf noup] tests: bluetooth: tester: Remove deprecated configs Removing the deprecated kconfigs for nrf54h20 target. Signed-off-by: alperen sener --- tests/bluetooth/tester/boards/nrf54h20dk_nrf54h20_cpuapp.conf | 1 - .../sysbuild/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.conf | 1 - 2 files changed, 2 deletions(-) diff --git a/tests/bluetooth/tester/boards/nrf54h20dk_nrf54h20_cpuapp.conf b/tests/bluetooth/tester/boards/nrf54h20dk_nrf54h20_cpuapp.conf index 51b0ef5fa8d4..0f16f6ea7b4c 100644 --- a/tests/bluetooth/tester/boards/nrf54h20dk_nrf54h20_cpuapp.conf +++ b/tests/bluetooth/tester/boards/nrf54h20dk_nrf54h20_cpuapp.conf @@ -26,6 +26,5 @@ CONFIG_UART_INTERRUPT_DRIVEN=y # Enable PSA RNG CONFIG_PSA_CRYPTO_DRIVER_OBERON=n CONFIG_PSA_SSF_CRYPTO_CLIENT=y -CONFIG_SSF_PSA_CRYPTO_SERVICE_ENABLED=y CONFIG_MBEDTLS_PSA_CRYPTO_C=y CONFIG_NRF_SECURITY=y diff --git a/tests/bluetooth/tester/sysbuild/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.conf b/tests/bluetooth/tester/sysbuild/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.conf index b7d64a9e6a08..24e3d84ecf96 100644 --- a/tests/bluetooth/tester/sysbuild/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.conf +++ b/tests/bluetooth/tester/sysbuild/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.conf @@ -35,6 +35,5 @@ CONFIG_BT_CTLR_SCAN_DATA_LEN_MAX=191 # Enable PSA RNG CONFIG_PSA_CRYPTO_DRIVER_OBERON=n CONFIG_PSA_SSF_CRYPTO_CLIENT=y -CONFIG_SSF_PSA_CRYPTO_SERVICE_ENABLED=y CONFIG_MBEDTLS_PSA_CRYPTO_C=y CONFIG_NRF_SECURITY=y From f985b2869ad9a941bb8cd9b9d442157ff86a06ee Mon Sep 17 00:00:00 2001 From: Travis Lam Date: Thu, 16 Oct 2025 12:31:32 +0200 Subject: [PATCH 1950/2141] Revert "[nrf noup] soc: nordic: nrf54l: Skip clock configuration from ns" This reverts commit 5f7678fd0f430fda8a8c6bdce86e0653bc172258. Signed-off-by: Travis Lam --- soc/nordic/nrf54l/Kconfig | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/soc/nordic/nrf54l/Kconfig b/soc/nordic/nrf54l/Kconfig index a3473c967452..114c1dc6b5a6 100644 --- a/soc/nordic/nrf54l/Kconfig +++ b/soc/nordic/nrf54l/Kconfig @@ -56,18 +56,10 @@ config SOC_NRF54LM20A_ENGA_CPUFLPR if SOC_SERIES_NRF54LX config SOC_NRF54LX_SKIP_CLOCK_CONFIG - bool - prompt "Skip clock frequency configuration in system initialization" if TRUSTED_EXECUTION_SECURE - default y if TRUSTED_EXECUTION_NONSECURE + bool "Skip clock frequency configuration in system initialization" help - With this option, the CPU clock frequency is not set during this - Zephyr image's system initialization. The CPU runs with either - the HW reset values, or with the configuration set by an image - earlier in the boot chain. - - Note that for security reasons it is not supported to configure - the clock peripheral (NRF_OSCILLATORS) from the non-secure - domain. + With this option, the CPU clock frequency is not set during system initialization. + The CPU runs with the default, hardware-selected frequency. config SOC_NRF54LX_DISABLE_FICR_TRIMCNF bool "Disable trimming of the device" From 72a9100f9b84ca2f2a7d0f7549e86f731afd6a01 Mon Sep 17 00:00:00 2001 From: Travis Lam Date: Mon, 13 Oct 2025 15:14:35 +0200 Subject: [PATCH 1951/2141] [nrf fromtree] soc: nordic: instantiate NRF_PLATFORM_LUMOS kconfig Instantiate NRF_PLATFORM_LUMOS for all nrf lumos product, Add NRF_SKIP_CLOCK_CONFIG kconfig to be a general kconfig in nordic soc Kconfig, so that it can be used by other lumos product. Signed-off-by: Travis Lam (cherry picked from commit 0042c1d29986269b8cc23162e6b7690252821867) --- .../bl54l15_dvk_nrf54l10_cpuapp_ns_defconfig | 2 +- .../bl54l15_dvk_nrf54l15_cpuapp_ns_defconfig | 2 +- .../bl54l15u_dvk_nrf54l15_cpuapp_ns_defconfig | 2 +- .../nrf54l15dk_nrf54l10_cpuapp_ns_defconfig | 2 +- .../nrf54l15dk_nrf54l15_cpuapp_ns_defconfig | 2 +- .../panb611evb_nrf54l15_cpuapp_ns_defconfig | 2 +- ...ytac_an54l15q_db_nrf54l15_cpuapp_ns_defconfig | 2 +- modules/hal_nordic/nrfx/CMakeLists.txt | 2 +- soc/nordic/Kconfig | 16 ++++++++++++++++ soc/nordic/nrf54l/Kconfig | 7 +------ 10 files changed, 25 insertions(+), 14 deletions(-) diff --git a/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp_ns_defconfig b/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp_ns_defconfig index dea04c45f20c..e62b6fe90745 100644 --- a/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp_ns_defconfig +++ b/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l10_cpuapp_ns_defconfig @@ -34,4 +34,4 @@ CONFIG_TFM_LOG_LEVEL_SILENCE=n # from the non secure application directly. This needs to be set # otherwise nrfx will try to configure them, resulting in a bus # fault. -CONFIG_SOC_NRF54LX_SKIP_CLOCK_CONFIG=y +CONFIG_NRF_SKIP_CLOCK_CONFIG=y diff --git a/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l15_cpuapp_ns_defconfig b/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l15_cpuapp_ns_defconfig index dea04c45f20c..e62b6fe90745 100644 --- a/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l15_cpuapp_ns_defconfig +++ b/boards/ezurio/bl54l15_dvk/bl54l15_dvk_nrf54l15_cpuapp_ns_defconfig @@ -34,4 +34,4 @@ CONFIG_TFM_LOG_LEVEL_SILENCE=n # from the non secure application directly. This needs to be set # otherwise nrfx will try to configure them, resulting in a bus # fault. -CONFIG_SOC_NRF54LX_SKIP_CLOCK_CONFIG=y +CONFIG_NRF_SKIP_CLOCK_CONFIG=y diff --git a/boards/ezurio/bl54l15u_dvk/bl54l15u_dvk_nrf54l15_cpuapp_ns_defconfig b/boards/ezurio/bl54l15u_dvk/bl54l15u_dvk_nrf54l15_cpuapp_ns_defconfig index dea04c45f20c..e62b6fe90745 100644 --- a/boards/ezurio/bl54l15u_dvk/bl54l15u_dvk_nrf54l15_cpuapp_ns_defconfig +++ b/boards/ezurio/bl54l15u_dvk/bl54l15u_dvk_nrf54l15_cpuapp_ns_defconfig @@ -34,4 +34,4 @@ CONFIG_TFM_LOG_LEVEL_SILENCE=n # from the non secure application directly. This needs to be set # otherwise nrfx will try to configure them, resulting in a bus # fault. -CONFIG_SOC_NRF54LX_SKIP_CLOCK_CONFIG=y +CONFIG_NRF_SKIP_CLOCK_CONFIG=y diff --git a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns_defconfig b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns_defconfig index d9f869918bfe..a0a4a0c63ac6 100644 --- a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns_defconfig +++ b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns_defconfig @@ -32,4 +32,4 @@ CONFIG_TFM_LOG_LEVEL_SILENCE=n # from the non secure application directly. This needs to be set # otherwise nrfx will try to configure them, resulting in a bus # fault. -CONFIG_SOC_NRF54LX_SKIP_CLOCK_CONFIG=y +CONFIG_NRF_SKIP_CLOCK_CONFIG=y diff --git a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp_ns_defconfig b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp_ns_defconfig index d9f869918bfe..a0a4a0c63ac6 100644 --- a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp_ns_defconfig +++ b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp_ns_defconfig @@ -32,4 +32,4 @@ CONFIG_TFM_LOG_LEVEL_SILENCE=n # from the non secure application directly. This needs to be set # otherwise nrfx will try to configure them, resulting in a bus # fault. -CONFIG_SOC_NRF54LX_SKIP_CLOCK_CONFIG=y +CONFIG_NRF_SKIP_CLOCK_CONFIG=y diff --git a/boards/panasonic/panb611evb/panb611evb_nrf54l15_cpuapp_ns_defconfig b/boards/panasonic/panb611evb/panb611evb_nrf54l15_cpuapp_ns_defconfig index 5f6e098f4528..e360981191e8 100644 --- a/boards/panasonic/panb611evb/panb611evb_nrf54l15_cpuapp_ns_defconfig +++ b/boards/panasonic/panb611evb/panb611evb_nrf54l15_cpuapp_ns_defconfig @@ -33,4 +33,4 @@ CONFIG_TFM_LOG_LEVEL_SILENCE=n # from the non secure application directly. This needs to be set # otherwise nrfx will try to configure them, resulting in a bus # fault. -CONFIG_SOC_NRF54LX_SKIP_CLOCK_CONFIG=y +CONFIG_NRF_SKIP_CLOCK_CONFIG=y diff --git a/boards/raytac/an54l15q_db/raytac_an54l15q_db_nrf54l15_cpuapp_ns_defconfig b/boards/raytac/an54l15q_db/raytac_an54l15q_db_nrf54l15_cpuapp_ns_defconfig index 866a03cd8687..0df2316b4502 100644 --- a/boards/raytac/an54l15q_db/raytac_an54l15q_db_nrf54l15_cpuapp_ns_defconfig +++ b/boards/raytac/an54l15q_db/raytac_an54l15q_db_nrf54l15_cpuapp_ns_defconfig @@ -34,4 +34,4 @@ CONFIG_TFM_LOG_LEVEL_SILENCE=n # from the non secure application directly. This needs to be set # otherwise nrfx will try to configure them, resulting in a bus # fault. -CONFIG_SOC_NRF54LX_SKIP_CLOCK_CONFIG=y +CONFIG_NRF_SKIP_CLOCK_CONFIG=y diff --git a/modules/hal_nordic/nrfx/CMakeLists.txt b/modules/hal_nordic/nrfx/CMakeLists.txt index e944f06c805b..40ef9d08fd86 100644 --- a/modules/hal_nordic/nrfx/CMakeLists.txt +++ b/modules/hal_nordic/nrfx/CMakeLists.txt @@ -190,7 +190,7 @@ if(CONFIG_SOC_NRF54L_CPUAPP_COMMON) zephyr_compile_definitions("NRF_CONFIG_CPU_FREQ_MHZ=${clock_frequency_mhz}") endif() -zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54LX_SKIP_CLOCK_CONFIG NRF_SKIP_CLOCK_CONFIGURATION) +zephyr_compile_definitions_ifdef(CONFIG_NRF_SKIP_CLOCK_CONFIG NRF_SKIP_CLOCK_CONFIGURATION) zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54LX_DISABLE_FICR_TRIMCNF NRF_DISABLE_FICR_TRIMCNF) zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54LX_SKIP_GLITCHDETECTOR_DISABLE NRF_SKIP_GLITCHDETECTOR_DISABLE) zephyr_compile_definitions_ifndef(CONFIG_SOC_NRF54L_ANOMALY_56_WORKAROUND NRF54L_CONFIGURATION_56_ENABLE=0) diff --git a/soc/nordic/Kconfig b/soc/nordic/Kconfig index d86e98e3dbc7..46efc8c2c744 100644 --- a/soc/nordic/Kconfig +++ b/soc/nordic/Kconfig @@ -197,6 +197,15 @@ config NRF_SECURE_APPROTECT_USER_HANDLING endchoice +config NRF_SKIP_CLOCK_CONFIG + bool + prompt "Skip clock frequency configuration" if TRUSTED_EXECUTION_SECURE + depends on NRF_PLATFORM_LUMOS + default y if TRUSTED_EXECUTION_NONSECURE + help + With this option, the CPU clock frequency is not set during system initialization. + The CPU runs with the default, hardware-selected frequency. + config NRF_TRACE_PORT bool "nRF TPIU" depends on !SOC_SERIES_NRF51X @@ -212,4 +221,11 @@ config NRF_PLATFORM_HALTIUM this option. This allows to easily enable common functionality on SoCs based on the Haltium platform. +config NRF_PLATFORM_LUMOS + bool + help + SoC series based on the Nordic nRF Lumos platform such as nRF54Lx + series. This allows to easily enable common functionality on + SoCs based on the Lumos platform. + endif # SOC_FAMILY_NORDIC_NRF diff --git a/soc/nordic/nrf54l/Kconfig b/soc/nordic/nrf54l/Kconfig index 114c1dc6b5a6..b211d2417cd8 100644 --- a/soc/nordic/nrf54l/Kconfig +++ b/soc/nordic/nrf54l/Kconfig @@ -8,6 +8,7 @@ config SOC_SERIES_NRF54LX select HAS_NRFX select HAS_NORDIC_DRIVERS select HAS_SEGGER_RTT if ZEPHYR_SEGGER_MODULE + select NRF_PLATFORM_LUMOS config SOC_NRF54L_CPUAPP_COMMON bool @@ -55,12 +56,6 @@ config SOC_NRF54LM20A_ENGA_CPUFLPR if SOC_SERIES_NRF54LX -config SOC_NRF54LX_SKIP_CLOCK_CONFIG - bool "Skip clock frequency configuration in system initialization" - help - With this option, the CPU clock frequency is not set during system initialization. - The CPU runs with the default, hardware-selected frequency. - config SOC_NRF54LX_DISABLE_FICR_TRIMCNF bool "Disable trimming of the device" default y if TRUSTED_EXECUTION_NONSECURE From b2d9c44fc64deec8abd3f9ab91d4140c2fd28c3a Mon Sep 17 00:00:00 2001 From: Johann Fischer Date: Wed, 24 Sep 2025 17:31:28 +0200 Subject: [PATCH 1952/2141] [nrf fromtree] drivers: udc: cleanup depends in Kconfig.dwc2 Factor out UDC_DWC2 dependency. Signed-off-by: Johann Fischer (cherry picked from commit 0018e8d6008c2ab3a717c23ea789f03c2f5301df) --- drivers/usb/udc/Kconfig.dwc2 | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/usb/udc/Kconfig.dwc2 b/drivers/usb/udc/Kconfig.dwc2 index 1bb0e99fedde..3764aa7a4e2c 100644 --- a/drivers/usb/udc/Kconfig.dwc2 +++ b/drivers/usb/udc/Kconfig.dwc2 @@ -12,23 +12,22 @@ config UDC_DWC2 help DWC2 USB device controller driver. +if UDC_DWC2 + config UDC_DWC2_DMA bool "DWC2 USB DMA support" default y - depends on UDC_DWC2 help Enable Buffer DMA if DWC2 USB controller supports Internal DMA. config UDC_DWC2_HIBERNATION bool "DWC2 USB Hibernation support" default y - depends on UDC_DWC2 help Enable Hibernation if DWC2 USB controller supports hibernation. config UDC_DWC2_PTI bool "DWC2 USB Periodic Transfer Interrupt" - depends on UDC_DWC2 help Ignore frame number when scheduling isochronous endpoints. Use this when isochronous transfers should finish only after receiving token @@ -38,24 +37,23 @@ config UDC_DWC2_PTI config UDC_DWC2_STACK_SIZE int "UDC DWC2 driver internal thread stack size" - depends on UDC_DWC2 default 512 help DWC2 driver internal thread stack size. config UDC_DWC2_THREAD_PRIORITY int "UDC DWC2 driver thread priority" - depends on UDC_DWC2 default 8 help DWC2 driver thread priority. config UDC_DWC2_USBHS_VBUS_READY_TIMEOUT int "UDC DWC2 USBHS VBUS ready event timeout in ms" - depends on UDC_DWC2 depends on NRFS_HAS_VBUS_DETECTOR_SERVICE default 0 help UDC DWC2 USBHS VBUS ready event timeout. If the VBUS is not ready and the Nordic USBHS controller is used, the udc_enable() is blocked for this amount of time. Set it to zero to wait forever. + +endif # UDC_DWC2 From c9c7f5b358ab4eb19919fc0d9b7656923cad9e0d Mon Sep 17 00:00:00 2001 From: Johann Fischer Date: Wed, 24 Sep 2025 18:44:46 +0200 Subject: [PATCH 1953/2141] [nrf fromtree] drivers: udc: allow to use timeout Kconfig option on nRF54LM20A SoC Kconfig option UDC_DWC2_USBHS_VBUS_READY_TIMEOUT depends on services exclusively available for nRF54H20, but the option can also be used for nRF54LM20A, where there are no service dependencies, and VREG can be accessed by the driver directly. Let depend the option on the SOC series, as the controller can be used by the different CPUs on the SOC. Signed-off-by: Johann Fischer (cherry picked from commit 4fe2c5bd5fe1d017783eb4b48ca752759a68ca02) --- drivers/usb/udc/Kconfig.dwc2 | 2 +- drivers/usb/udc/udc_dwc2_vendor_quirks.h | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/usb/udc/Kconfig.dwc2 b/drivers/usb/udc/Kconfig.dwc2 index 3764aa7a4e2c..16350ef568d4 100644 --- a/drivers/usb/udc/Kconfig.dwc2 +++ b/drivers/usb/udc/Kconfig.dwc2 @@ -49,7 +49,7 @@ config UDC_DWC2_THREAD_PRIORITY config UDC_DWC2_USBHS_VBUS_READY_TIMEOUT int "UDC DWC2 USBHS VBUS ready event timeout in ms" - depends on NRFS_HAS_VBUS_DETECTOR_SERVICE + depends on SOC_SERIES_NRF54HX || SOC_SERIES_NRF54LX default 0 help UDC DWC2 USBHS VBUS ready event timeout. If the VBUS is not ready diff --git a/drivers/usb/udc/udc_dwc2_vendor_quirks.h b/drivers/usb/udc/udc_dwc2_vendor_quirks.h index 330ff8d113f1..cd25f0ec9d33 100644 --- a/drivers/usb/udc/udc_dwc2_vendor_quirks.h +++ b/drivers/usb/udc/udc_dwc2_vendor_quirks.h @@ -381,6 +381,10 @@ static inline int usbhs_enable_core(const struct device *dev) k_timeout_t timeout = K_FOREVER; int err; + if (CONFIG_UDC_DWC2_USBHS_VBUS_READY_TIMEOUT) { + timeout = K_MSEC(CONFIG_UDC_DWC2_USBHS_VBUS_READY_TIMEOUT); + } + if (!k_event_wait(&usbhs_events, USBHS_VBUS_READY, false, K_NO_WAIT)) { LOG_WRN("VBUS is not ready, block udc_enable()"); if (!k_event_wait(&usbhs_events, USBHS_VBUS_READY, false, timeout)) { From 85b9aac2ba4fbc65518d2c2e41233333da415550 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Tue, 30 Sep 2025 10:12:52 +0200 Subject: [PATCH 1954/2141] [nrf fromtree] drivers: usb: udc: Fix VBUS ready timeout dependency in Kconfig.dwc2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a follow up to commit 4fe2c5bd5fe1d017783eb4b48ca752759a68ca02. The UDC_DWC2_USBHS_VBUS_READY_TIMEOUT Kconfig option should be available also for nRF92 Series SoCs (as it was previously when it depended on NRFS_HAS_VBUS_DETECTOR_SERVICE), otherwise some builds will fail for such targets. Signed-off-by: Andrzej Głąbek (cherry picked from commit 6360c7f67ce3ff5173a15389e63c7b465557a1d2) --- drivers/usb/udc/Kconfig.dwc2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/udc/Kconfig.dwc2 b/drivers/usb/udc/Kconfig.dwc2 index 16350ef568d4..ff3b169e66a5 100644 --- a/drivers/usb/udc/Kconfig.dwc2 +++ b/drivers/usb/udc/Kconfig.dwc2 @@ -49,7 +49,7 @@ config UDC_DWC2_THREAD_PRIORITY config UDC_DWC2_USBHS_VBUS_READY_TIMEOUT int "UDC DWC2 USBHS VBUS ready event timeout in ms" - depends on SOC_SERIES_NRF54HX || SOC_SERIES_NRF54LX + depends on SOC_SERIES_NRF54HX || SOC_SERIES_NRF54LX || SOC_SERIES_NRF92X default 0 help UDC DWC2 USBHS VBUS ready event timeout. If the VBUS is not ready From df375fd23413e470618c5a59342723bf7bd09c96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mo=C5=84?= Date: Fri, 26 Sep 2025 13:07:17 +0200 Subject: [PATCH 1955/2141] [nrf fromtree] drivers: udc_dwc2: Fix memory leak on subsequent bus resets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Do not queue new buffer after bus reset if there is one already queued. This fixes memory leak on each bus reset if there are no SETUP transfers received between resets. Signed-off-by: Tomasz Moń (cherry picked from commit c18042047711dc090d6a1946ff158a54113b1965) --- drivers/usb/udc/udc_dwc2.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/usb/udc/udc_dwc2.c b/drivers/usb/udc/udc_dwc2.c index 35fb78adecfa..f8b03c372147 100644 --- a/drivers/usb/udc/udc_dwc2.c +++ b/drivers/usb/udc/udc_dwc2.c @@ -434,6 +434,11 @@ static void dwc2_ensure_setup_ready(const struct device *dev) } else { struct udc_dwc2_data *const priv = udc_get_private(dev); + if (udc_ep_is_busy(udc_get_ep_cfg(dev, USB_CONTROL_EP_OUT))) { + /* There is already buffer queued */ + return; + } + /* Enable EP0 OUT only if there is no pending EP0 IN transfer * after which the stack has to enable EP0 OUT. */ From 0ec94009f55b68e294fadbe8a5630b83f2e13c36 Mon Sep 17 00:00:00 2001 From: Sylvio Alves Date: Tue, 30 Sep 2025 12:14:56 -0300 Subject: [PATCH 1956/2141] [nrf fromtree] udc_dwc2: fix off-by-one in TX FIFO unset check Fix the check in dwc2_unset_dedicated_fifo() that wrongly included the current endpoint when testing for higher FIFOs. This caused false warnings and early returns. Use ~BIT_MASK(ep_idx + 1) to only test FIFOs above the current EP. Signed-off-by: Sylvio Alves (cherry picked from commit 7c1193c81373276d41ffb8293d113a6f33649cfc) --- drivers/usb/udc/udc_dwc2.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/usb/udc/udc_dwc2.c b/drivers/usb/udc/udc_dwc2.c index f8b03c372147..d279c1ce0284 100644 --- a/drivers/usb/udc/udc_dwc2.c +++ b/drivers/usb/udc/udc_dwc2.c @@ -1586,9 +1586,11 @@ static int dwc2_unset_dedicated_fifo(const struct device *dev, *diepctl &= ~USB_DWC2_DEPCTL_TXFNUM_MASK; if (priv->dynfifosizing) { - if (priv->txf_set & ~BIT_MASK(ep_idx)) { - LOG_WRN("Some of the FIFOs higher than %u are set, %lx", - ep_idx, priv->txf_set & ~BIT_MASK(ep_idx)); + uint16_t higher_mask = ~BIT_MASK(ep_idx + 1); + + if (priv->txf_set & higher_mask) { + LOG_WRN("Some of the FIFOs higher than %u are set, %x", + ep_idx, priv->txf_set & higher_mask); return 0; } From a940f9d32d188bc81122e6bed215f64311690d08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mo=C5=84?= Date: Wed, 22 Oct 2025 09:30:07 +0200 Subject: [PATCH 1957/2141] [nrf fromtree] drivers: udc_dwc2: Fix deactivate when hibernated MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It is possible for usbd_disable() to be called when the core is hibernated. When done so, the USB stack will attempt to deactivate all the endpoints. Because the core is hibernated, register reads are really undefined. This can lead to udc_dwc2_ep_deactivate() not calling udc_dwc2_ep_disable() which will leave struct udc_ep_config busy flag set. When endpoint 0x00 busy flag is left to true, the driver won't allocate buffer to receive SETUP data which is mandatory in Buffer DMA mode. This leads to essentially dead device after reconnect, because the device will not respond to any control transfers. Solve the issue by modifying backup register value instead of real one when endpoint is deactivated while core is hibernated. Signed-off-by: Tomasz Moń (cherry picked from commit 35620e20a91efb3284716698f2fa794d02ec6b97) --- drivers/usb/udc/udc_dwc2.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/usb/udc/udc_dwc2.c b/drivers/usb/udc/udc_dwc2.c index d279c1ce0284..eb7368e1178f 100644 --- a/drivers/usb/udc/udc_dwc2.c +++ b/drivers/usb/udc/udc_dwc2.c @@ -1730,7 +1730,19 @@ static int udc_dwc2_ep_deactivate(const struct device *dev, mem_addr_t dxepctl_reg; uint32_t dxepctl; - dxepctl_reg = dwc2_get_dxepctl_reg(dev, cfg->addr); + if (priv->hibernated) { + /* If usbd_disable() is called when core is hibernated, modify + * backup registers instead of real ones. + */ + if (USB_EP_DIR_IS_OUT(cfg->addr)) { + dxepctl_reg = (mem_addr_t)&priv->backup.doepctl[ep_idx]; + } else { + dxepctl_reg = (mem_addr_t)&priv->backup.diepctl[ep_idx]; + } + } else { + dxepctl_reg = dwc2_get_dxepctl_reg(dev, cfg->addr); + } + dxepctl = sys_read32(dxepctl_reg); if (dxepctl & USB_DWC2_DEPCTL_USBACTEP) { From b2599236430afea93671862952bb762b2251938b Mon Sep 17 00:00:00 2001 From: Johann Fischer Date: Wed, 13 Aug 2025 22:47:25 +0200 Subject: [PATCH 1958/2141] [nrf fromtree] usb: device_next: fail on initialization if no HID device is registered Do not register the device when the class instance has already been initialised. Fail on initialization if no HID device is registered. Signed-off-by: Johann Fischer (cherry picked from commit c62575e7bf7a5152ed1ae2b1053658724d290462) --- subsys/usb/device_next/class/usbd_hid.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/subsys/usb/device_next/class/usbd_hid.c b/subsys/usb/device_next/class/usbd_hid.c index d978aea0d27c..212b409e9570 100644 --- a/subsys/usb/device_next/class/usbd_hid.c +++ b/subsys/usb/device_next/class/usbd_hid.c @@ -57,6 +57,7 @@ struct usbd_hid_descriptor { }; enum { + HID_DEV_CLASS_INITIALIZED, HID_DEV_CLASS_ENABLED, }; @@ -503,7 +504,14 @@ static int usbd_hid_init(struct usbd_class_data *const c_data) const struct device *dev = usbd_class_get_private(c_data); const struct hid_device_config *dcfg = dev->config; struct usbd_hid_descriptor *const desc = dcfg->desc; + struct hid_device_data *const ddata = dev->data; + + if (ddata->ops == NULL || ddata->rdesc == NULL || !ddata->rsize) { + LOG_ERR("HID device does not seem to be registered"); + return -EINVAL; + } + atomic_set_bit(&ddata->state, HID_DEV_CLASS_INITIALIZED); LOG_DBG("HID class %s init", c_data->name); if (dcfg->if_desc_data != NULL && desc->if0.iInterface == 0) { @@ -519,6 +527,10 @@ static int usbd_hid_init(struct usbd_class_data *const c_data) static void usbd_hid_shutdown(struct usbd_class_data *const c_data) { + const struct device *dev = usbd_class_get_private(c_data); + struct hid_device_data *const ddata = dev->data; + + atomic_clear_bit(&ddata->state, HID_DEV_CLASS_INITIALIZED); LOG_DBG("HID class %s shutdown", c_data->name); } @@ -628,7 +640,7 @@ static int hid_dev_register(const struct device *dev, struct hid_device_data *const ddata = dev->data; struct usbd_hid_descriptor *const desc = dcfg->desc; - if (atomic_test_bit(&ddata->state, HID_DEV_CLASS_ENABLED)) { + if (atomic_test_bit(&ddata->state, HID_DEV_CLASS_INITIALIZED)) { return -EALREADY; } From 7796de1730491c3a6ac514bec6d62931bbb5e904 Mon Sep 17 00:00:00 2001 From: Johann Fischer Date: Thu, 14 Aug 2025 22:49:30 +0200 Subject: [PATCH 1959/2141] [nrf fromtree] usb: device_next: hid: allow to set polling period at runtime Allow to set input or output report polling period at runtime. Signed-off-by: Johann Fischer (cherry picked from commit bca0ce087094948c7e59006cb1291f51462df9fa) --- include/zephyr/usb/class/usbd_hid.h | 32 +++++++++++ subsys/usb/device_next/class/Kconfig.hid | 5 ++ subsys/usb/device_next/class/usbd_hid.c | 54 +++++++++++++++++++ subsys/usb/device_next/class/usbd_hid_api.c | 22 ++++++++ .../usb/device_next/class/usbd_hid_internal.h | 2 + 5 files changed, 115 insertions(+) diff --git a/include/zephyr/usb/class/usbd_hid.h b/include/zephyr/usb/class/usbd_hid.h index 5539369d5b05..79b52dd8fd9d 100644 --- a/include/zephyr/usb/class/usbd_hid.h +++ b/include/zephyr/usb/class/usbd_hid.h @@ -212,6 +212,38 @@ int hid_device_register(const struct device *dev, int hid_device_submit_report(const struct device *dev, const uint16_t size, const uint8_t *const report); +/** + * @brief Set input report polling period + * + * Similar to devicetree property in-polling-period-us, but it allows setting + * different polling periods at runtime. + * + * @kconfig_dep{CONFIG_USBD_HID_SET_POLLING_PERIOD} + * + * @param[in] dev Pointer to HID device + * @param[in] period_us Polling period in microseconds + * + * @return 0 on success, negative errno code on failure. + * @retval -ENOTSUP If API is not enabled. + */ +int hid_device_set_in_polling(const struct device *dev, const unsigned int period_us); + +/** + * @brief Set output report polling period + * + * Similar to devicetree property out-polling-period-us, but it allows setting + * different polling periods at runtime. + * + * @kconfig_dep{CONFIG_USBD_HID_SET_POLLING_PERIOD} + * + * @param[in] dev Pointer to HID device + * @param[in] period_us Polling period in microseconds + * + * @return 0 on success, negative errno code on failure. + * @retval -ENOTSUP If API is not enabled. + */ +int hid_device_set_out_polling(const struct device *dev, const unsigned int period_us); + /** * @} */ diff --git a/subsys/usb/device_next/class/Kconfig.hid b/subsys/usb/device_next/class/Kconfig.hid index 8e3133a1dde8..a6f2980ec3ab 100644 --- a/subsys/usb/device_next/class/Kconfig.hid +++ b/subsys/usb/device_next/class/Kconfig.hid @@ -30,6 +30,11 @@ config USBD_HID_INIT_PRIORITY help HID device initialization priority +config USBD_HID_SET_POLLING_PERIOD + bool "Allow to set polling period at runtime" + help + Allow to set input or output report polling period at runtime. + module = USBD_HID module-str = usbd hid source "subsys/logging/Kconfig.template.log_config" diff --git a/subsys/usb/device_next/class/usbd_hid.c b/subsys/usb/device_next/class/usbd_hid.c index 212b409e9570..2ea3a08db763 100644 --- a/subsys/usb/device_next/class/usbd_hid.c +++ b/subsys/usb/device_next/class/usbd_hid.c @@ -632,6 +632,56 @@ static int hid_dev_submit_report(const struct device *dev, return 0; } +static inline int hid_dev_set_out_polling(const struct device *dev, + const unsigned int period_us) +{ + const struct hid_device_config *const dcfg = dev->config; + struct hid_device_data *const ddata = dev->data; + struct usbd_hid_descriptor *const desc = dcfg->desc; + + if (atomic_test_bit(&ddata->state, HID_DEV_CLASS_INITIALIZED)) { + return -EBUSY; + } + + if (USBD_SUPPORTS_HIGH_SPEED) { + if (desc->hs_out_ep.bLength == 0) { + /* This device does not have output reports. */ + return -ENOTSUP; + } + + desc->hs_out_ep.bInterval = USB_HS_INT_EP_INTERVAL(period_us); + } + + if (desc->out_ep.bLength == 0) { + /* This device does not have output reports. */ + return -ENOTSUP; + } + + desc->out_ep.bInterval = USB_FS_INT_EP_INTERVAL(period_us); + + return 0; +} + +static inline int hid_dev_set_in_polling(const struct device *dev, + const unsigned int period_us) +{ + const struct hid_device_config *const dcfg = dev->config; + struct hid_device_data *const ddata = dev->data; + struct usbd_hid_descriptor *const desc = dcfg->desc; + + if (atomic_test_bit(&ddata->state, HID_DEV_CLASS_INITIALIZED)) { + return -EBUSY; + } + + if (USBD_SUPPORTS_HIGH_SPEED) { + desc->hs_in_ep.bInterval = USB_HS_INT_EP_INTERVAL(period_us); + } + + desc->in_ep.bInterval = USB_FS_INT_EP_INTERVAL(period_us); + + return 0; +} + static int hid_dev_register(const struct device *dev, const uint8_t *const rdesc, const uint16_t rsize, const struct hid_device_ops *const ops) @@ -706,6 +756,10 @@ struct usbd_class_api usbd_hid_api = { static const struct hid_device_driver_api hid_device_api = { .submit_report = hid_dev_submit_report, .dev_register = hid_dev_register, +#if CONFIG_USBD_HID_SET_POLLING_PERIOD + .set_out_polling = hid_dev_set_out_polling, + .set_in_polling = hid_dev_set_in_polling, +#endif }; #include "usbd_hid_macros.h" diff --git a/subsys/usb/device_next/class/usbd_hid_api.c b/subsys/usb/device_next/class/usbd_hid_api.c index f2efa4e3cb1e..fd9f27a23ba9 100644 --- a/subsys/usb/device_next/class/usbd_hid_api.c +++ b/subsys/usb/device_next/class/usbd_hid_api.c @@ -34,6 +34,28 @@ int hid_device_register(const struct device *dev, return api->dev_register(dev, rdesc, rsize, ops); } +int hid_device_set_in_polling(const struct device *dev, const unsigned int period_us) +{ + const struct hid_device_driver_api *const api = dev->api; + + if (IS_ENABLED(CONFIG_USBD_HID_SET_POLLING_PERIOD)) { + return api->set_in_polling(dev, period_us); + } + + return -ENOTSUP; +} + +int hid_device_set_out_polling(const struct device *dev, const unsigned int period_us) +{ + const struct hid_device_driver_api *const api = dev->api; + + if (IS_ENABLED(CONFIG_USBD_HID_SET_POLLING_PERIOD)) { + return api->set_out_polling(dev, period_us); + } + + return -ENOTSUP; +} + /* Legacy HID API wrapper below */ struct legacy_wrapper { diff --git a/subsys/usb/device_next/class/usbd_hid_internal.h b/subsys/usb/device_next/class/usbd_hid_internal.h index d049b0c22a35..dcb747486279 100644 --- a/subsys/usb/device_next/class/usbd_hid_internal.h +++ b/subsys/usb/device_next/class/usbd_hid_internal.h @@ -20,4 +20,6 @@ struct hid_device_driver_api { int (*dev_register)(const struct device *dev, const uint8_t *const rdesc, const uint16_t rsize, const struct hid_device_ops *const ops); + int (*set_in_polling)(const struct device *dev, const unsigned int period_us); + int (*set_out_polling)(const struct device *dev, const unsigned int period_us); }; From 3c0e35c2aa12f9c0dfa3fb0c08fa93b69636f4a3 Mon Sep 17 00:00:00 2001 From: Johann Fischer Date: Thu, 14 Aug 2025 22:54:30 +0200 Subject: [PATCH 1960/2141] [nrf fromtree] samples: usb: hid-keyboard: allow to set polling period at runtime Add an example of how to set the polling period at runtime. Signed-off-by: Johann Fischer (cherry picked from commit e295a387b963533d0047efa6c92cd6595697e197) --- samples/subsys/usb/hid-keyboard/sample.yaml | 2 ++ samples/subsys/usb/hid-keyboard/src/main.c | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/samples/subsys/usb/hid-keyboard/sample.yaml b/samples/subsys/usb/hid-keyboard/sample.yaml index f53ae514f97c..2998f84807d2 100644 --- a/samples/subsys/usb/hid-keyboard/sample.yaml +++ b/samples/subsys/usb/hid-keyboard/sample.yaml @@ -33,3 +33,5 @@ tests: sample.usbd.hid-keyboard.large-out-report: extra_args: - EXTRA_DTC_OVERLAY_FILE="large_out_report.overlay" + extra_configs: + - CONFIG_USBD_HID_SET_POLLING_PERIOD=y diff --git a/samples/subsys/usb/hid-keyboard/src/main.c b/samples/subsys/usb/hid-keyboard/src/main.c index 45580c95a845..39ce8836ff6a 100644 --- a/samples/subsys/usb/hid-keyboard/src/main.c +++ b/samples/subsys/usb/hid-keyboard/src/main.c @@ -206,6 +206,18 @@ int main(void) return ret; } + if (IS_ENABLED(CONFIG_USBD_HID_SET_POLLING_PERIOD)) { + ret = hid_device_set_in_polling(hid_dev, 1000); + if (ret) { + LOG_WRN("Failed to set IN report polling period, %d", ret); + } + + ret = hid_device_set_out_polling(hid_dev, 1000); + if (ret != 0 && ret != -ENOTSUP) { + LOG_WRN("Failed to set OUT report polling period, %d", ret); + } + } + sample_usbd = sample_usbd_init_device(msg_cb); if (sample_usbd == NULL) { LOG_ERR("Failed to initialize USB device"); From 4199556ca65792c25b3193338769c1f32202e1ea Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Mon, 22 Sep 2025 14:48:09 +0200 Subject: [PATCH 1961/2141] [nrf fromtree] Bluetooth: Controller: Fix inter-operability when BT_PHY_UPDATE=n Fix inter-operability, when BT_PHY_UPDATE=n the feature bits contained 2M and Coded PHY when Advertising Extensions where enabled, and Central devices did not progress with any data packet transfers when PHY_REQ was rejected as unknown PDU. Signed-off-by: Vinayak Kariappa Chettimada (cherry picked from commit 15d3b57e903abe984e29e1920093592d8f211f60) Signed-off-by: Vinayak Kariappa Chettimada --- subsys/bluetooth/controller/include/ll_feat.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/subsys/bluetooth/controller/include/ll_feat.h b/subsys/bluetooth/controller/include/ll_feat.h index 946441720769..9e5cd3144b7a 100644 --- a/subsys/bluetooth/controller/include/ll_feat.h +++ b/subsys/bluetooth/controller/include/ll_feat.h @@ -63,11 +63,11 @@ #define LL_FEAT_BIT_EXT_SCAN 0 #endif /* !CONFIG_BT_CTLR_EXT_SCAN_FP */ -#if defined(CONFIG_BT_CTLR_PHY_2M) +#if defined(CONFIG_BT_CTLR_PHY) && defined(CONFIG_BT_CTLR_PHY_2M) #define LL_FEAT_BIT_PHY_2M BIT64(BT_LE_FEAT_BIT_PHY_2M) -#else /* !CONFIG_BT_CTLR_PHY_2M */ +#else /* !CONFIG_BT_CTLR_PHY || !CONFIG_BT_CTLR_PHY_2M */ #define LL_FEAT_BIT_PHY_2M 0 -#endif /* !CONFIG_BT_CTLR_PHY_2M */ +#endif /* !CONFIG_BT_CTLR_PHY || !CONFIG_BT_CTLR_PHY_2M */ #if defined(CONFIG_BT_CTLR_SMI_TX) #if defined(CONFIG_BT_CTLR_SMI_TX_SETTING) @@ -86,11 +86,11 @@ #define LL_FEAT_BIT_SMI_RX 0 #endif /* !CONFIG_BT_CTLR_SMI_RX */ -#if defined(CONFIG_BT_CTLR_PHY_CODED) +#if defined(CONFIG_BT_CTLR_PHY) && defined(CONFIG_BT_CTLR_PHY_CODED) #define LL_FEAT_BIT_PHY_CODED BIT64(BT_LE_FEAT_BIT_PHY_CODED) -#else /* !CONFIG_BT_CTLR_PHY_CODED */ +#else /* !CONFIG_BT_CTLR_PHY || !CONFIG_BT_CTLR_PHY_CODED */ #define LL_FEAT_BIT_PHY_CODED 0 -#endif /* !CONFIG_BT_CTLR_PHY_CODED */ +#endif /* !CONFIG_BT_CTLR_PHY || !CONFIG_BT_CTLR_PHY_CODED */ #if defined(CONFIG_BT_CTLR_ADV_EXT) #define LL_FEAT_BIT_EXT_ADV BIT64(BT_LE_FEAT_BIT_EXT_ADV) From 9d56385f43782ac04fe80852dad636f2d98cfb00 Mon Sep 17 00:00:00 2001 From: Loic Domaigne Date: Thu, 25 Sep 2025 17:26:41 +0200 Subject: [PATCH 1962/2141] [nrf fromtree] Bluetooth: Controller: fix assertion check for ptc value Fix the issue reported by Coverity CID 487708. The LL_ASSERT was performed on lll->ptc, which is a 4-bit bitfield and therefore always succeeds. Instead, the computation (lll->nse - nse) should be checked to ensure it falls within the 4-bit value range before assigning it to lll->ptc. Signed-off-by: Loic Domaigne (cherry picked from commit bfbc6365acfe3346f3f248d2953ebf9e5f9fe21a) Signed-off-by: Vinayak Kariappa Chettimada --- subsys/bluetooth/controller/ll_sw/ull_sync_iso.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/subsys/bluetooth/controller/ll_sw/ull_sync_iso.c b/subsys/bluetooth/controller/ll_sw/ull_sync_iso.c index b3737c8fc4a0..65cd09f602fd 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_sync_iso.c +++ b/subsys/bluetooth/controller/ll_sw/ull_sync_iso.c @@ -489,20 +489,22 @@ void ull_sync_iso_setup(struct ll_sync_iso_set *sync_iso, lll->irc = PDU_BIG_INFO_IRC_GET(bi); if (lll->pto) { uint8_t nse; + uint8_t ptc; nse = lll->irc * lll->bn; /* 4 bits * 3 bits, total 7 bits */ if (nse >= lll->nse) { return; } - lll->ptc = lll->nse - nse; + ptc = lll->nse - nse; /* FIXME: Do not remember why ptc is 4 bits, it should be 5 bits as ptc is a * running buffer offset related to nse. * Fix ptc and ptc_curr definitions, until then we keep an assertion check * here. */ - LL_ASSERT(lll->ptc <= BIT_MASK(4)); + LL_ASSERT(ptc <= BIT_MASK(4)); + lll->ptc = ptc; } else { lll->ptc = 0U; } From a8b5730e859920fa5e745f7add80b7faf2d0096f Mon Sep 17 00:00:00 2001 From: Ashirwad Paswan Date: Mon, 29 Sep 2025 13:16:22 +0530 Subject: [PATCH 1963/2141] [nrf fromtree] Bluetooth: Controller: Fix missing null pointer check Added a check for null pointer in ull_sync_iso.c file to avoid potential crashes. Fixes: #81997 Signed-off-by: Ashirwad Paswan (cherry picked from commit 21da2d056ddbb0627a17588b57aca92e2775c545) Signed-off-by: Vinayak Kariappa Chettimada --- subsys/bluetooth/controller/ll_sw/ull_sync_iso.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/subsys/bluetooth/controller/ll_sw/ull_sync_iso.c b/subsys/bluetooth/controller/ll_sw/ull_sync_iso.c index 65cd09f602fd..222191bde22c 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_sync_iso.c +++ b/subsys/bluetooth/controller/ll_sw/ull_sync_iso.c @@ -586,6 +586,8 @@ void ull_sync_iso_setup(struct ll_sync_iso_set *sync_iso, lll->window_size_event_us; /* Skip to first selected BIS subevent */ stream = ull_sync_iso_stream_get(lll->stream_handle[0]); + LL_ASSERT(stream); + if (lll->bis_spacing >= (lll->sub_interval * lll->nse)) { sync_iso_offset_us += (stream->bis_index - 1U) * lll->sub_interval * From a73ef8c79c7c2ac13a2bf65c25b4c6c5bcd07af8 Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Sun, 5 Oct 2025 12:58:05 +1000 Subject: [PATCH 1964/2141] [nrf fromtree] bluetooth: controller: ll_sw: nordic: constant latency req When `CONFIG_NRF_SYS_EVENT` is enabled, route constant latency requests through the reference counted API. Signed-off-by: Jordan Yates (cherry picked from commit 1f3ce818fc4bc07e3f5f51f6d47d71b4a5b6f0d3) Signed-off-by: Vinayak Kariappa Chettimada --- .../controller/ll_sw/nordic/hal/nrf5/radio/radio.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c index 90a0945f5a19..0199326ed3ce 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c @@ -10,6 +10,7 @@ #include #include +#include #include #include "util/mem.h" @@ -221,7 +222,11 @@ void radio_reset(void) RADIO_TIMING_RU_Msk; #endif /* !CONFIG_BT_CTLR_TIFS_HW */ +#if defined(CONFIG_NRF_SYS_EVENT) + (void)nrf_sys_event_request_global_constlat(); +#else /* !CONFIG_NRF_SYS_EVENT */ NRF_POWER->TASKS_CONSTLAT = 1U; +#endif /* !CONFIG_NRF_SYS_EVENT */ #endif /* CONFIG_SOC_COMPATIBLE_NRF54LX */ #if defined(HAL_RADIO_GPIO_HAVE_PA_PIN) || defined(HAL_RADIO_GPIO_HAVE_LNA_PIN) @@ -1788,7 +1793,11 @@ void radio_tmr_stop(void) #endif /* !CONFIG_BT_CTLR_TIFS_HW */ #if defined(CONFIG_SOC_COMPATIBLE_NRF54LX) +#if defined(CONFIG_NRF_SYS_EVENT) + (void)nrf_sys_event_release_global_constlat(); +#else /* !CONFIG_NRF_SYS_EVENT */ NRF_POWER->TASKS_LOWPWR = 1U; +#endif /* !CONFIG_NRF_SYS_EVENT */ #endif /* CONFIG_SOC_COMPATIBLE_NRF54LX */ } From 2e9357a7cbe6bbaf14438f5ea808b7f03143fda9 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Thu, 2 Oct 2025 15:36:40 +0200 Subject: [PATCH 1965/2141] [nrf fromtree] Bluetooth: Controller: Fix return types for ll_length ll_length_req_send and ll_length_default_set were defined to return a uint32_t, but only returned a uint8_t HCI error code and was the return value was always stored as such. Signed-off-by: Emil Gydesen (cherry picked from commit 4b9bc7d11b2e0414e3a11d0da0fb40795f7aed35) Signed-off-by: Vinayak Kariappa Chettimada --- subsys/bluetooth/controller/include/ll.h | 4 ++-- subsys/bluetooth/controller/ll_sw/ull_conn.c | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/subsys/bluetooth/controller/include/ll.h b/subsys/bluetooth/controller/include/ll.h index 378686064e15..9d08436da8c4 100644 --- a/subsys/bluetooth/controller/include/ll.h +++ b/subsys/bluetooth/controller/include/ll.h @@ -267,10 +267,10 @@ uint8_t ll_tx_pwr_lvl_set(uint8_t handle_type, uint16_t handle, uint8_t ll_apto_get(uint16_t handle, uint16_t *const apto); uint8_t ll_apto_set(uint16_t handle, uint16_t apto); -uint32_t ll_length_req_send(uint16_t handle, uint16_t tx_octets, uint16_t tx_time); +uint8_t ll_length_req_send(uint16_t handle, uint16_t tx_octets, uint16_t tx_time); void ll_length_default_get(uint16_t *const max_tx_octets, uint16_t *const max_tx_time); -uint32_t ll_length_default_set(uint16_t max_tx_octets, uint16_t max_tx_time); +uint8_t ll_length_default_set(uint16_t max_tx_octets, uint16_t max_tx_time); void ll_length_max_get(uint16_t *const max_tx_octets, uint16_t *const max_tx_time, uint16_t *const max_rx_octets, diff --git a/subsys/bluetooth/controller/ll_sw/ull_conn.c b/subsys/bluetooth/controller/ll_sw/ull_conn.c index b68eaea19589..e76b3e7147e9 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_conn.c +++ b/subsys/bluetooth/controller/ll_sw/ull_conn.c @@ -562,8 +562,7 @@ static bool ll_len_validate(uint16_t tx_octets, uint16_t tx_time) return true; } -uint32_t ll_length_req_send(uint16_t handle, uint16_t tx_octets, - uint16_t tx_time) +uint8_t ll_length_req_send(uint16_t handle, uint16_t tx_octets, uint16_t tx_time) { struct ll_conn *conn; @@ -601,7 +600,7 @@ void ll_length_default_get(uint16_t *max_tx_octets, uint16_t *max_tx_time) *max_tx_time = default_tx_time; } -uint32_t ll_length_default_set(uint16_t max_tx_octets, uint16_t max_tx_time) +uint8_t ll_length_default_set(uint16_t max_tx_octets, uint16_t max_tx_time) { if (IS_ENABLED(CONFIG_BT_CTLR_PARAM_CHECK) && !ll_len_validate(max_tx_octets, max_tx_time)) { From 6110ee4a865a9428f063b81c81ae6bcd6f5363a6 Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Sat, 27 Sep 2025 16:25:06 +0200 Subject: [PATCH 1966/2141] [nrf fromtree] Bluetooth: Controller: Fix single switch timer use in ISO Sync Fix implementation of Broadcast ISO Synchronized Receiver using single switch timer to consider minimum compare value requirement. This fix reduces latencies to setup radio receptions and fixes an assertion in lll_sync_iso when radio_tmr_start_us() is checked for latencies. Relates to commit 5dfc58cff9c3 ("Bluetooth: Controller: Fix single switch timer minimum compare value"). Signed-off-by: Vinayak Kariappa Chettimada (cherry picked from commit 8eae0bfbd09e6b288baf446dfc1bcf2d0999d3aa) Signed-off-by: Vinayak Kariappa Chettimada --- .../ll_sw/nordic/lll/lll_sync_iso.c | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync_iso.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync_iso.c index 4f4dad90754f..2083d8d7780a 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync_iso.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync_iso.c @@ -1352,22 +1352,25 @@ static void isr_rx(void *param) hcto -= addr_us_get(lll->phy); hcto -= radio_rx_ready_delay_get(lll->phy, PHY_FLAGS_S8); - overhead_us = radio_rx_chain_delay_get(lll->phy, PHY_FLAGS_S8); - overhead_us += addr_us_get(lll->phy); - overhead_us += radio_rx_ready_delay_get(lll->phy, PHY_FLAGS_S8); + /* Overhead within EVENT_IFS_US to exclude from max. jitter */ + /* Required radio ready duration, settling time */ + overhead_us = radio_rx_ready_delay_get(lll->phy, PHY_FLAGS_S8); + /* If single timer used, then consider required max. latency */ + overhead_us += HAL_RADIO_ISR_LATENCY_MAX_US; + /* Add chain delay overhead */ + overhead_us += radio_rx_chain_delay_get(lll->phy, PHY_FLAGS_S8); + /* Add base clock jitter overhead */ overhead_us += (EVENT_CLOCK_JITTER_US << 1); - LL_ASSERT(EVENT_IFS_US > overhead_us); + /* Max. available clock jitter */ jitter_max_us = (EVENT_IFS_US - overhead_us) >> 1; + /* Max. clock jitter per subevent */ jitter_max_us = (jitter_max_us * nse) / (lll->num_bis * lll->nse); - overhead_us = HAL_RADIO_TMR_START_DELAY_US; - if (jitter_max_us > overhead_us) { - jitter_max_us -= overhead_us; - } else { - jitter_max_us = 0U; - } + /* Min. clock jitter we shall use */ + jitter_max_us = MAX(jitter_max_us, (EVENT_CLOCK_JITTER_US << 1)); + /* Jitter for current subevent */ jitter_us = (EVENT_CLOCK_JITTER_US << 1) * nse; if (jitter_us > jitter_max_us) { jitter_us = jitter_max_us; From c82283cea6a07a45f650d0e16901847c23c56e1e Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Wed, 10 Sep 2025 19:40:32 +0200 Subject: [PATCH 1967/2141] [nrf fromtree] Bluetooth: Controller: Cosmetic changes to Link Layer interface Cosmetic changes to the Link Layer interface header file. Signed-off-by: Vinayak Kariappa Chettimada (cherry picked from commit 7fd5dea9ccbbf8c5eed6b433e88d55428e41ecf7) Signed-off-by: Vinayak Kariappa Chettimada --- subsys/bluetooth/controller/include/ll.h | 149 ++++++++++-------- .../controller/include/ll_settings.h | 24 +-- 2 files changed, 101 insertions(+), 72 deletions(-) diff --git a/subsys/bluetooth/controller/include/ll.h b/subsys/bluetooth/controller/include/ll.h index 9d08436da8c4..f807842e6c34 100644 --- a/subsys/bluetooth/controller/include/ll.h +++ b/subsys/bluetooth/controller/include/ll.h @@ -1,63 +1,39 @@ /* - * Copyright (c) 2016-2021 Nordic Semiconductor ASA + * Copyright (c) 2016-2025 Nordic Semiconductor ASA * Copyright (c) 2016 Vinayak Kariappa Chettimada * * SPDX-License-Identifier: Apache-2.0 */ +#if defined(CONFIG_BT_CTLR_HCI_ADV_HANDLE_MAPPING) +#define LL_ADV_HANDLE_MAPPING +#else /* !CONFIG_BT_CTLR_HCI_ADV_HANDLE_MAPPING */ +#define LL_ADV_HANDLE_MAPPING static __attribute__((always_inline)) inline +#endif /* !CONFIG_BT_CTLR_HCI_ADV_HANDLE_MAPPING */ + +/* Initialization and Reset Interfaces */ int ll_init(struct k_sem *sem_rx); int ll_deinit(void); void ll_reset(void); +/* Features Interfaces */ uint8_t ll_set_host_feature(uint8_t bit_number, uint8_t bit_value); uint64_t ll_feat_get(void); +/* Device Address Interfaces */ uint8_t ll_addr_set(uint8_t addr_type, uint8_t const *const p_bdaddr); uint8_t *ll_addr_get(uint8_t addr_type); uint8_t *ll_addr_read(uint8_t addr_type, uint8_t *const bdaddr); -#if defined(CONFIG_BT_CTLR_HCI_ADV_HANDLE_MAPPING) -uint8_t ll_adv_set_by_hci_handle_get(uint8_t hci_handle, uint8_t *handle); -uint8_t ll_adv_set_by_hci_handle_get_or_new(uint8_t hci_handle, - uint8_t *handle); -uint8_t ll_adv_set_hci_handle_get(uint8_t handle); -uint8_t ll_adv_iso_by_hci_handle_get(uint8_t hci_handle, uint8_t *handle); -uint8_t ll_adv_iso_by_hci_handle_new(uint8_t hci_handle, uint8_t *handle); -#else -static inline uint8_t ll_adv_set_by_hci_handle_get(uint8_t hci_handle, - uint8_t *handle) -{ - *handle = hci_handle; - return 0; -} - -static inline uint8_t ll_adv_set_by_hci_handle_get_or_new(uint8_t hci_handle, - uint8_t *handle) -{ - *handle = hci_handle; - return 0; -} - -static inline uint8_t ll_adv_set_hci_handle_get(uint8_t handle) -{ - return handle; -} - -static inline uint8_t ll_adv_iso_by_hci_handle_get(uint8_t hci_handle, - uint8_t *handle) -{ - *handle = hci_handle; - return 0; -} - -static inline uint8_t ll_adv_iso_by_hci_handle_new(uint8_t hci_handle, - uint8_t *handle) -{ - *handle = hci_handle; - return 0; -} -#endif +/* Advertising Handles Interfaces */ +LL_ADV_HANDLE_MAPPING uint8_t ll_adv_set_by_hci_handle_get(uint8_t hci_handle, uint8_t *handle); +LL_ADV_HANDLE_MAPPING uint8_t ll_adv_set_by_hci_handle_get_or_new(uint8_t hci_handle, + uint8_t *handle); +LL_ADV_HANDLE_MAPPING uint8_t ll_adv_set_hci_handle_get(uint8_t handle); +LL_ADV_HANDLE_MAPPING uint8_t ll_adv_iso_by_hci_handle_get(uint8_t hci_handle, uint8_t *handle); +LL_ADV_HANDLE_MAPPING uint8_t ll_adv_iso_by_hci_handle_new(uint8_t hci_handle, uint8_t *handle); +/* Advertising State Interfaces */ #if defined(CONFIG_BT_CTLR_ADV_EXT) uint8_t ll_adv_params_set(uint8_t handle, uint16_t evt_prop, uint32_t interval, uint8_t adv_type, uint8_t own_addr_type, @@ -78,6 +54,7 @@ uint8_t ll_adv_data_set(uint8_t len, uint8_t const *const p_data); uint8_t ll_adv_scan_rsp_set(uint8_t len, uint8_t const *const p_data); #endif /* !CONFIG_BT_CTLR_ADV_EXT */ +/* Extended Advertising State Interfaces */ uint8_t ll_adv_aux_random_addr_set(uint8_t handle, uint8_t const *const addr); uint8_t ll_adv_aux_ad_data_set(uint8_t handle, uint8_t op, uint8_t frag_pref, uint8_t len, uint8_t const *const data); @@ -87,12 +64,15 @@ uint16_t ll_adv_aux_max_data_length_get(void); uint8_t ll_adv_aux_set_count_get(void); uint8_t ll_adv_aux_set_remove(uint8_t handle); uint8_t ll_adv_aux_set_clear(void); + +/* Periodic Advertising State Interfaces */ uint8_t ll_adv_sync_param_set(uint8_t handle, uint16_t interval, uint16_t flags); uint8_t ll_adv_sync_ad_data_set(uint8_t handle, uint8_t op, uint8_t len, uint8_t const *const data); uint8_t ll_adv_sync_enable(uint8_t handle, uint8_t enable); +/* Advertising Enable and Disable Interfaces */ #if defined(CONFIG_BT_CTLR_ADV_EXT) || defined(CONFIG_BT_HCI_MESH_EXT) #if defined(CONFIG_BT_HCI_MESH_EXT) uint8_t ll_adv_enable(uint8_t handle, uint8_t enable, @@ -108,6 +88,7 @@ uint8_t ll_adv_enable(uint8_t enable); uint8_t ll_adv_disable_all(void); +/* Broadcast ISO State Interfaces */ uint8_t ll_big_create(uint8_t big_handle, uint8_t adv_handle, uint8_t num_bis, uint32_t sdu_interval, uint16_t max_sdu, uint16_t max_latency, uint8_t rtn, uint8_t phy, @@ -121,6 +102,7 @@ uint8_t ll_big_test_create(uint8_t big_handle, uint8_t adv_handle, uint8_t pto, uint8_t encryption, uint8_t *bcode); uint8_t ll_big_terminate(uint8_t big_handle, uint8_t reason); +/* Scanning State Interfaces */ uint8_t ll_scan_params_set(uint8_t type, uint16_t interval, uint16_t window, uint8_t own_addr_type, uint8_t filter_policy); #if defined(CONFIG_BT_CTLR_ADV_EXT) @@ -129,24 +111,30 @@ uint8_t ll_scan_enable(uint8_t enable, uint16_t duration, uint16_t period); uint8_t ll_scan_enable(uint8_t enable); #endif /* !CONFIG_BT_CTLR_ADV_EXT */ +/* Periodic Advertising Sync State Interfaces */ uint8_t ll_sync_create(uint8_t options, uint8_t sid, uint8_t adv_addr_type, uint8_t *adv_addr, uint16_t skip, uint16_t sync_timeout, uint8_t sync_cte_type); uint8_t ll_sync_create_cancel(void **rx); uint8_t ll_sync_terminate(uint16_t handle); uint8_t ll_sync_recv_enable(uint16_t handle, uint8_t enable); + +/* Periodic Advertising Sync Transfer Interfaces */ uint8_t ll_sync_transfer(uint16_t conn_handle, uint16_t service_data, uint16_t sync_handle); uint8_t ll_adv_sync_set_info_transfer(uint16_t conn_handle, uint16_t service_data, uint8_t adv_handle); uint8_t ll_past_param(uint16_t conn_handle, uint8_t mode, uint16_t skip, uint16_t timeout, uint8_t cte_type); uint8_t ll_default_past_param(uint8_t mode, uint16_t skip, uint16_t timeout, uint8_t cte_type); + +/* Broadcast ISO Sync Receiver State Interfaces */ uint8_t ll_big_sync_create(uint8_t big_handle, uint16_t sync_handle, uint8_t encryption, uint8_t *bcode, uint8_t mse, uint16_t sync_timeout, uint8_t num_bis, uint8_t *bis); uint8_t ll_big_sync_terminate(uint8_t big_handle, void **rx); +/* Connected ISO State Interfaces */ uint8_t ll_cig_parameters_open(uint8_t cig_id, uint32_t c_interval, uint32_t p_interval, uint8_t sca, uint8_t packing, uint8_t framing, @@ -172,6 +160,15 @@ uint8_t ll_cis_parameters_test_set(uint8_t cis_id, uint8_t nse, uint16_t c_pdu, uint16_t p_pdu, uint8_t c_phy, uint8_t p_phy, uint8_t c_bn, uint8_t p_bn); +uint8_t ll_cig_remove(uint8_t cig_id); +uint8_t ll_cis_create_check(uint16_t cis_handle, uint16_t acl_handle); +void ll_cis_create(uint16_t cis_handle, uint16_t acl_handle); +uint8_t ll_cis_accept(uint16_t handle); +uint8_t ll_cis_reject(uint16_t handle, uint8_t reason); +uint8_t ll_conn_iso_accept_timeout_get(uint16_t *timeout); +uint8_t ll_conn_iso_accept_timeout_set(uint16_t timeout); + +/* ISO SDU data Interfaces */ /* Must be implemented by vendor if vendor-specific data path is supported */ uint8_t ll_configure_data_path(uint8_t data_path_dir, uint8_t data_path_id, @@ -200,24 +197,19 @@ uint8_t ll_iso_read_test_counters(uint16_t handle, uint32_t *received_cnt, uint32_t *missed_cnt, uint32_t *failed_cnt); -uint8_t ll_cig_remove(uint8_t cig_id); - -uint8_t ll_cis_create_check(uint16_t cis_handle, uint16_t acl_handle); -void ll_cis_create(uint16_t cis_handle, uint16_t acl_handle); - -uint8_t ll_cis_accept(uint16_t handle); -uint8_t ll_cis_reject(uint16_t handle, uint8_t reason); - +/* Filter Accept List Interfaces */ uint8_t ll_fal_size_get(void); uint8_t ll_fal_clear(void); uint8_t ll_fal_add(bt_addr_le_t *addr); uint8_t ll_fal_remove(bt_addr_le_t *addr); +/* Privacy Accept List Interfaces */ uint8_t ll_pal_size_get(void); uint8_t ll_pal_clear(void); uint8_t ll_pal_add(const bt_addr_le_t *const addr, const uint8_t sid); uint8_t ll_pal_remove(const bt_addr_le_t *const addr, const uint8_t sid); +/* Private Resolvable Address Resolution Interfaces */ void ll_rl_id_addr_get(uint8_t rl_idx, uint8_t *id_addr_type, uint8_t *id_addr); uint8_t ll_rl_size_get(void); uint8_t ll_rl_clear(void); @@ -231,6 +223,7 @@ uint8_t ll_rl_enable(uint8_t enable); void ll_rl_timeout_set(uint16_t timeout); uint8_t ll_priv_mode_set(bt_addr_le_t *id_addr, uint8_t mode); +/* Connection State Interfaces */ #if defined(CONFIG_BT_CTLR_ADV_EXT) uint8_t ll_create_connection(uint16_t scan_interval, uint16_t scan_window, uint8_t filter_policy, uint8_t peer_addr_type, @@ -283,7 +276,7 @@ uint8_t ll_phy_req_send(uint16_t handle, uint8_t tx, uint8_t flags, uint8_t rx); uint8_t ll_set_min_used_chans(uint16_t handle, uint8_t const phys, uint8_t const min_used_chans); -/* Direction Finding */ +/* Direction Finding Interfaces */ /* Sets CTE transmission parameters for periodic advertising */ uint8_t ll_df_set_cl_cte_tx_params(uint8_t adv_handle, uint8_t cte_len, uint8_t cte_type, uint8_t cte_count, @@ -316,12 +309,21 @@ void ll_df_read_ant_inf(uint8_t *switch_sample_rates, uint8_t *max_switch_pattern_len, uint8_t *max_cte_len); -/* Downstream - Data */ +/* Path Loss Monitoring Interfaces */ +uint8_t ll_conn_set_path_loss_parameters(uint16_t handle, + uint8_t high_threshold, + uint8_t high_hysteresis, + uint8_t low_threshold, + uint8_t low_hysteresis, + uint16_t min_time_spent); +uint8_t ll_conn_set_path_loss_reporting(uint16_t handle, uint8_t enable); + +/* Downstream - ACL Data */ void *ll_tx_mem_acquire(void); void ll_tx_mem_release(void *node_tx); int ll_tx_mem_enqueue(uint16_t handle, void *node_tx); -/* Upstream - Num. Completes, Events and Data */ +/* Upstream - Num. Completes, Events, ACL and ISO Data */ uint8_t ll_rx_get(void **node_rx, uint16_t *handle); void ll_rx_dequeue(void); void ll_rx_mem_release(void **node_rx); @@ -333,9 +335,6 @@ void ll_iso_tx_mem_release(void *tx); int ll_iso_tx_mem_enqueue(uint16_t handle, void *tx, void *link); void ll_iso_link_tx_release(void *link); -uint8_t ll_conn_iso_accept_timeout_get(uint16_t *timeout); -uint8_t ll_conn_iso_accept_timeout_set(uint16_t timeout); - /* External co-operation */ void ll_timeslice_ticker_id_get(uint8_t * const instance_index, uint8_t * const ticker_id); @@ -344,11 +343,35 @@ void ll_coex_ticker_id_get(uint8_t * const instance_index, void ll_radio_state_abort(void); uint32_t ll_radio_state_is_idle(void); -uint8_t ll_conn_set_path_loss_parameters(uint16_t handle, - uint8_t high_threshold, - uint8_t high_hysteresis, - uint8_t low_threshold, - uint8_t low_hysteresis, - uint16_t min_time_spent); +/* Static inline functions */ +#if !defined(CONFIG_BT_CTLR_HCI_ADV_HANDLE_MAPPING) +LL_ADV_HANDLE_MAPPING uint8_t ll_adv_set_by_hci_handle_get(uint8_t hci_handle, uint8_t *handle) +{ + *handle = hci_handle; + return 0U; +} -uint8_t ll_conn_set_path_loss_reporting(uint16_t handle, uint8_t enable); +LL_ADV_HANDLE_MAPPING uint8_t ll_adv_set_by_hci_handle_get_or_new(uint8_t hci_handle, + uint8_t *handle) +{ + *handle = hci_handle; + return 0U; +} + +LL_ADV_HANDLE_MAPPING uint8_t ll_adv_set_hci_handle_get(uint8_t handle) +{ + return handle; +} + +LL_ADV_HANDLE_MAPPING uint8_t ll_adv_iso_by_hci_handle_get(uint8_t hci_handle, uint8_t *handle) +{ + *handle = hci_handle; + return 0U; +} + +LL_ADV_HANDLE_MAPPING uint8_t ll_adv_iso_by_hci_handle_new(uint8_t hci_handle, uint8_t *handle) +{ + *handle = hci_handle; + return 0U; +} +#endif /* !CONFIG_BT_CTLR_HCI_ADV_HANDLE_MAPPING */ diff --git a/subsys/bluetooth/controller/include/ll_settings.h b/subsys/bluetooth/controller/include/ll_settings.h index c79a4fb1537b..df3835481f3e 100644 --- a/subsys/bluetooth/controller/include/ll_settings.h +++ b/subsys/bluetooth/controller/include/ll_settings.h @@ -1,25 +1,31 @@ /* + * Copyright (c) 2025 Nordic Semiconductor ASA * Copyright (c) 2019 Oticon A/S * * SPDX-License-Identifier: Apache-2.0 */ #if defined(CONFIG_BT_CTLR_VERSION_SETTINGS) +#define LL_VERSION_SETTINGS +#else /* !CONFIG_BT_CTLR_VERSION_SETTINGS */ +#define LL_VERSION_SETTINGS static __attribute__((always_inline)) inline +#endif /* !CONFIG_BT_CTLR_VERSION_SETTINGS */ -uint16_t ll_settings_company_id(void); -uint16_t ll_settings_subversion_number(void); +/* Version Interfaces */ +LL_VERSION_SETTINGS uint16_t ll_settings_company_id(void); +LL_VERSION_SETTINGS uint16_t ll_settings_subversion_number(void); -#else +/* Stable Modulation Index Interfaces */ +bool ll_settings_smi_tx(void); -static inline uint16_t ll_settings_company_id(void) +/* Static inline functions */ +#if !defined(CONFIG_BT_CTLR_VERSION_SETTINGS) +LL_VERSION_SETTINGS uint16_t ll_settings_company_id(void) { return CONFIG_BT_CTLR_COMPANY_ID; } -static inline uint16_t ll_settings_subversion_number(void) +LL_VERSION_SETTINGS uint16_t ll_settings_subversion_number(void) { return CONFIG_BT_CTLR_SUBVERSION_NUMBER; } - -#endif /* CONFIG_BT_CTLR_VERSION_SETTINGS */ - -bool ll_settings_smi_tx(void); +#endif /* !CONFIG_BT_CTLR_VERSION_SETTINGS */ From 6593b2caf910e488d6a5411e6d0370f37c2e62f6 Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Sun, 5 Oct 2025 05:51:10 +0200 Subject: [PATCH 1968/2141] [nrf fromtree] Bluetooth: Controller: Use CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET Use CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET for nRF53 SoC conditional compilations. Signed-off-by: Vinayak Kariappa Chettimada (cherry picked from commit 1fe79a65a25d00b5e0f78118f184aaa7b5395262) Signed-off-by: Vinayak Kariappa Chettimada --- .../ll_sw/nordic/hal/nrf5/radio/radio.c | 71 ++++++++++--------- 1 file changed, 36 insertions(+), 35 deletions(-) diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c index 0199326ed3ce..dbca89da1c58 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c @@ -317,7 +317,7 @@ void radio_tx_power_set(int8_t power) value = hal_radio_tx_power_value(power); NRF_RADIO->TXPOWER = value; -#elif defined(CONFIG_SOC_COMPATIBLE_NRF53X) +#elif defined(CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET) uint32_t value; /* NOTE: TXPOWER register only accepts upto 0dBm, hence use the HAL @@ -328,12 +328,12 @@ void radio_tx_power_set(int8_t power) NRF_RADIO->TXPOWER = value; hal_radio_tx_power_high_voltage_set(power); -#else /* !CONFIG_SOC_COMPATIBLE_NRF53X && !CONFIG_SOC_COMPATIBLE_NRF54LX */ +#else /* !CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET && !CONFIG_SOC_COMPATIBLE_NRF54LX */ /* NOTE: valid value range is passed by Kconfig define. */ NRF_RADIO->TXPOWER = (uint32_t)power; -#endif /* !CONFIG_SOC_COMPATIBLE_NRF53X && !CONFIG_SOC_COMPATIBLE_NRF54LX */ +#endif /* !CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET && !CONFIG_SOC_COMPATIBLE_NRF54LX */ } void radio_tx_power_max_set(void) @@ -351,25 +351,25 @@ int8_t radio_tx_power_min_get(void) int8_t radio_tx_power_max_get(void) { -#if defined(CONFIG_SOC_COMPATIBLE_NRF53X) +#if defined(CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET) return RADIO_TXPOWER_TXPOWER_Pos3dBm; -#else /* !CONFIG_SOC_COMPATIBLE_NRF53X */ +#else /* !CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET */ return (int8_t)hal_radio_tx_power_max_get(); -#endif /* !CONFIG_SOC_COMPATIBLE_NRF53X */ +#endif /* !CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET */ } int8_t radio_tx_power_floor(int8_t power) { -#if defined(CONFIG_SOC_COMPATIBLE_NRF53X) +#if defined(CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET) /* NOTE: TXPOWER register only accepts upto 0dBm, +3dBm permitted by * use of high voltage being set for radio when TXPOWER register is set. */ if (power >= (int8_t)RADIO_TXPOWER_TXPOWER_Pos3dBm) { return RADIO_TXPOWER_TXPOWER_Pos3dBm; } -#endif /* CONFIG_SOC_COMPATIBLE_NRF53X */ +#endif /* CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET */ return (int8_t)hal_radio_tx_power_floor(power); } @@ -427,7 +427,7 @@ void radio_pkt_configure(uint8_t bits_len, uint8_t max_len, uint8_t flags) bits_s1 = RADIO_PKT_CONF_LENGTH_8BIT - bits_len; #elif defined(CONFIG_SOC_COMPATIBLE_NRF52X) || \ - defined(CONFIG_SOC_COMPATIBLE_NRF53X) || \ + defined(CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET) || \ defined(CONFIG_SOC_COMPATIBLE_NRF54LX) extra = 0U; @@ -525,7 +525,7 @@ uint32_t radio_rx_chain_delay_get(uint8_t phy, uint8_t flags) void radio_rx_enable(void) { #if !defined(CONFIG_BT_CTLR_TIFS_HW) -#if defined(CONFIG_SOC_COMPATIBLE_NRF53X) || defined(CONFIG_SOC_COMPATIBLE_NRF54LX) +#if defined(CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET) || defined(CONFIG_SOC_COMPATIBLE_NRF54LX) /* NOTE: Timer clear DPPI configuration is needed only for nRF53 * because of calls to radio_disable() and * radio_switch_complete_and_disable() inside a radio event call @@ -538,7 +538,7 @@ void radio_rx_enable(void) * radio event but when the radio event is done. */ hal_sw_switch_timer_clear_ppi_config(); -#endif /* CONFIG_SOC_COMPATIBLE_NRF53X || CONFIG_SOC_COMPATIBLE_NRF54LX */ +#endif /* CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET || CONFIG_SOC_COMPATIBLE_NRF54LX */ #endif /* !CONFIG_BT_CTLR_TIFS_HW */ nrf_radio_task_trigger(NRF_RADIO, NRF_RADIO_TASK_RXEN); @@ -547,7 +547,7 @@ void radio_rx_enable(void) void radio_tx_enable(void) { #if !defined(CONFIG_BT_CTLR_TIFS_HW) -#if defined(CONFIG_SOC_COMPATIBLE_NRF53X) || defined(CONFIG_SOC_COMPATIBLE_NRF54LX) +#if defined(CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET) || defined(CONFIG_SOC_COMPATIBLE_NRF54LX) /* NOTE: Timer clear DPPI configuration is needed only for nRF53 * because of calls to radio_disable() and * radio_switch_complete_and_disable() inside a radio event call @@ -560,7 +560,7 @@ void radio_tx_enable(void) * radio event but when the radio event is done. */ hal_sw_switch_timer_clear_ppi_config(); -#endif /* CONFIG_SOC_COMPATIBLE_NRF53X || CONFIG_SOC_COMPATIBLE_NRF54LX */ +#endif /* CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET || CONFIG_SOC_COMPATIBLE_NRF54LX */ #endif /* !CONFIG_BT_CTLR_TIFS_HW */ nrf_radio_task_trigger(NRF_RADIO, NRF_RADIO_TASK_TXEN); @@ -939,13 +939,13 @@ void sw_switch(uint8_t dir_curr, uint8_t dir_next, uint8_t phy_curr, uint8_t fla * time-stamp. */ hal_radio_end_time_capture_ppi_config(); -#if !defined(CONFIG_SOC_COMPATIBLE_NRF53X) && !defined(CONFIG_SOC_COMPATIBLE_NRF54LX) +#if !defined(CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET) && !defined(CONFIG_SOC_COMPATIBLE_NRF54LX) /* The function is not called for nRF5340 single timer configuration because * HAL_SW_SWITCH_TIMER_CLEAR_PPI is equal to HAL_RADIO_END_TIME_CAPTURE_PPI, * so channel is already enabled. */ hal_radio_nrf_ppi_channels_enable(BIT(HAL_RADIO_END_TIME_CAPTURE_PPI)); -#endif /* !CONFIG_SOC_COMPATIBLE_NRF53X && !CONFIG_SOC_COMPATIBLE_NRF54LX */ +#endif /* !CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET && !CONFIG_SOC_COMPATIBLE_NRF54LX */ #endif /* CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */ sw_tifs_toggle += 1U; @@ -1360,38 +1360,38 @@ void radio_tmr_rx_status_reset(void) void radio_tmr_tx_enable(void) { -#if defined(CONFIG_SOC_COMPATIBLE_NRF53X) || defined(CONFIG_SOC_COMPATIBLE_NRF54LX) -#else /* !CONFIG_SOC_COMPATIBLE_NRF53X && !CONFIG_SOC_COMPATIBLE_NRF54LX */ +#if defined(CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET) || defined(CONFIG_SOC_COMPATIBLE_NRF54LX) +#else /* !CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET && !CONFIG_SOC_COMPATIBLE_NRF54LX */ #if (HAL_RADIO_ENABLE_TX_ON_TICK_PPI == HAL_RADIO_ENABLE_RX_ON_TICK_PPI) hal_radio_enable_on_tick_ppi_config_and_enable(1U); #endif /* HAL_RADIO_ENABLE_TX_ON_TICK_PPI == HAL_RADIO_ENABLE_RX_ON_TICK_PPI */ -#endif /* !CONFIG_SOC_COMPATIBLE_NRF53X && !CONFIG_SOC_COMPATIBLE_NRF54LX */ +#endif /* !CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET && !CONFIG_SOC_COMPATIBLE_NRF54LX */ } void radio_tmr_rx_enable(void) { -#if defined(CONFIG_SOC_COMPATIBLE_NRF53X) || defined(CONFIG_SOC_COMPATIBLE_NRF54LX) -#else /* !CONFIG_SOC_COMPATIBLE_NRF53X && !CONFIG_SOC_COMPATIBLE_NRF54LX */ +#if defined(CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET) || defined(CONFIG_SOC_COMPATIBLE_NRF54LX) +#else /* !CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET && !CONFIG_SOC_COMPATIBLE_NRF54LX */ #if (HAL_RADIO_ENABLE_TX_ON_TICK_PPI == HAL_RADIO_ENABLE_RX_ON_TICK_PPI) hal_radio_enable_on_tick_ppi_config_and_enable(0U); #endif /* HAL_RADIO_ENABLE_TX_ON_TICK_PPI == HAL_RADIO_ENABLE_RX_ON_TICK_PPI */ -#endif /* !CONFIG_SOC_COMPATIBLE_NRF53X && !CONFIG_SOC_COMPATIBLE_NRF54LX */ +#endif /* !CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET && !CONFIG_SOC_COMPATIBLE_NRF54LX */ } void radio_tmr_tx_disable(void) { -#if defined(CONFIG_SOC_COMPATIBLE_NRF53X) || defined(CONFIG_SOC_COMPATIBLE_NRF54LX) +#if defined(CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET) || defined(CONFIG_SOC_COMPATIBLE_NRF54LX) nrf_radio_subscribe_clear(NRF_RADIO, NRF_RADIO_TASK_TXEN); -#else /* !CONFIG_SOC_COMPATIBLE_NRF53X && !CONFIG_SOC_COMPATIBLE_NRF54LX */ -#endif /* !CONFIG_SOC_COMPATIBLE_NRF53X && !CONFIG_SOC_COMPATIBLE_NRF54LX */ +#else /* !CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET && !CONFIG_SOC_COMPATIBLE_NRF54LX */ +#endif /* !CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET && !CONFIG_SOC_COMPATIBLE_NRF54LX */ } void radio_tmr_rx_disable(void) { -#if defined(CONFIG_SOC_COMPATIBLE_NRF53X) || defined(CONFIG_SOC_COMPATIBLE_NRF54LX) +#if defined(CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET) || defined(CONFIG_SOC_COMPATIBLE_NRF54LX) nrf_radio_subscribe_clear(NRF_RADIO, NRF_RADIO_TASK_RXEN); -#else /* !CONFIG_SOC_COMPATIBLE_NRF53X && !CONFIG_SOC_COMPATIBLE_NRF54LX */ -#endif /* !CONFIG_SOC_COMPATIBLE_NRF53X && !CONFIG_SOC_COMPATIBLE_NRF54LX */ +#else /* !CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET && !CONFIG_SOC_COMPATIBLE_NRF54LX */ +#endif /* !CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET && !CONFIG_SOC_COMPATIBLE_NRF54LX */ } void radio_tmr_tifs_set(uint32_t tifs) @@ -1627,7 +1627,7 @@ uint32_t radio_tmr_start_tick(uint8_t trx, uint32_t ticks_start) #if defined(CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER) last_pdu_end_us_init(latency_us); #endif /* CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */ -#if defined(CONFIG_SOC_COMPATIBLE_NRF53X) || defined(CONFIG_SOC_COMPATIBLE_NRF54LX) +#if defined(CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET) || defined(CONFIG_SOC_COMPATIBLE_NRF54LX) /* NOTE: Timer clear DPPI configuration is needed only for nRF53 * because of calls to radio_disable() and * radio_switch_complete_and_disable() inside a radio event call @@ -1640,7 +1640,7 @@ uint32_t radio_tmr_start_tick(uint8_t trx, uint32_t ticks_start) * radio event but when the radio event is done. */ hal_sw_switch_timer_clear_ppi_config(); -#endif /* CONFIG_SOC_COMPATIBLE_NRF53X || CONFIG_SOC_COMPATIBLE_NRF54LX */ +#endif /* CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET || CONFIG_SOC_COMPATIBLE_NRF54LX */ #endif /* !CONFIG_BT_CTLR_TIFS_HW */ return remainder_us; @@ -1657,7 +1657,7 @@ uint32_t radio_tmr_start_us(uint8_t trx, uint32_t start_us) */ start_us -= last_pdu_end_us; #endif /* CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */ -#if defined(CONFIG_SOC_COMPATIBLE_NRF53X) || defined(CONFIG_SOC_COMPATIBLE_NRF54LX) +#if defined(CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET) || defined(CONFIG_SOC_COMPATIBLE_NRF54LX) /* NOTE: Timer clear DPPI configuration is needed only for nRF53 * because of calls to radio_disable() and * radio_switch_complete_and_disable() inside a radio event call @@ -1670,7 +1670,7 @@ uint32_t radio_tmr_start_us(uint8_t trx, uint32_t start_us) * radio event but when the radio event is done. */ hal_sw_switch_timer_clear_ppi_config(); -#endif /* CONFIG_SOC_COMPATIBLE_NRF53X || CONFIG_SOC_COMPATIBLE_NRF54LX */ +#endif /* CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET || CONFIG_SOC_COMPATIBLE_NRF54LX */ #endif /* !CONFIG_BT_CTLR_TIFS_HW */ /* start_us could be the current count in the timer */ @@ -1876,13 +1876,14 @@ void radio_tmr_end_capture(void) * hal_sw_switch_timer_clear_ppi_config() and sw_switch(). There is no need to * configure the channel again in this function. */ -#if (!defined(CONFIG_SOC_COMPATIBLE_NRF53X) && !defined(CONFIG_SOC_COMPATIBLE_NRF54LX)) || \ - ((defined(CONFIG_SOC_COMPATIBLE_NRF53X) || defined(CONFIG_SOC_COMPATIBLE_NRF54LX)) && \ +#if (!defined(CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET) && !defined(CONFIG_SOC_COMPATIBLE_NRF54LX)) || \ + ((defined(CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET) || \ + defined(CONFIG_SOC_COMPATIBLE_NRF54LX)) && \ !defined(CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER)) hal_radio_end_time_capture_ppi_config(); hal_radio_nrf_ppi_channels_enable(BIT(HAL_RADIO_END_TIME_CAPTURE_PPI)); -#endif /* (!CONFIG_SOC_COMPATIBLE_NRF53X && !CONFIG_SOC_COMPATIBLE_NRF54LX) || - * ((CONFIG_SOC_COMPATIBLE_NRF53X || CONFIG_SOC_COMPATIBLE_NRF54LX) && +#endif /* (!CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET && !CONFIG_SOC_COMPATIBLE_NRF54LX) || + * ((CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET || CONFIG_SOC_COMPATIBLE_NRF54LX) && * !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER) */ } From 827cbdf79e1eedbdcf0912dd70e95ed57439255d Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Sat, 20 Sep 2025 06:30:37 +0200 Subject: [PATCH 1969/2141] [nrf fromtree] Bluetooth: Controller: Revert relaxed radio packet assignment deadline Reverts relaxed radio packet assignment deadline as it is too risky and can cause invalid bits be transmitted and/or cause MIC failures. Reverts commit 4dbfb22a7ea5 ("Bluetooth: Controller: Relax radio packet pointer assignment deadline"), and commit 230df7799342 ("Bluetooth: Controller: Relax radio packet pointer assignment deadline"). Signed-off-by: Vinayak Kariappa Chettimada (cherry picked from commit a5e1f59686b98a0bf6379a24b2ff145e512e770e) Signed-off-by: Vinayak Kariappa Chettimada --- .../controller/ll_sw/nordic/lll/lll_adv.c | 21 ++++++++-- .../controller/ll_sw/nordic/lll/lll_adv_aux.c | 28 ++++++++++++-- .../controller/ll_sw/nordic/lll/lll_adv_iso.c | 7 +++- .../ll_sw/nordic/lll/lll_adv_sync.c | 7 +++- .../ll_sw/nordic/lll/lll_central_iso.c | 38 ++++++++++++++++++- .../controller/ll_sw/nordic/lll/lll_conn.c | 30 +++++++++------ .../ll_sw/nordic/lll/lll_peripheral_iso.c | 35 ++++++++++++++++- .../controller/ll_sw/nordic/lll/lll_scan.c | 12 +++--- .../ll_sw/nordic/lll/lll_scan_aux.c | 21 ++++++++-- 9 files changed, 166 insertions(+), 33 deletions(-) diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv.c index 96d93b2b855b..5d1d89712619 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv.c @@ -1182,7 +1182,12 @@ static void isr_tx(void *param) radio_pkt_rx_set(node_rx->pdu); /* assert if radio packet ptr is not set and radio started rx */ - LL_ASSERT(!radio_is_ready()); + if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { + LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, + lll_prof_latency_get()); + } else { + LL_ASSERT(!radio_is_ready()); + } if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { lll_prof_cputime_capture(); @@ -1571,7 +1576,12 @@ static inline int isr_rx_pdu(struct lll_adv *lll, radio_pkt_tx_set(lll_adv_scan_rsp_curr_get(lll)); /* assert if radio packet ptr is not set and radio started tx */ - LL_ASSERT(!radio_is_ready()); + if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { + LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, + lll_prof_latency_get()); + } else { + LL_ASSERT(!radio_is_ready()); + } if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { lll_prof_cputime_capture(); @@ -1642,7 +1652,12 @@ static inline int isr_rx_pdu(struct lll_adv *lll, radio_disable(); /* assert if radio started tx */ - LL_ASSERT(!radio_is_ready()); + if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { + LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, + lll_prof_latency_get()); + } else { + LL_ASSERT(!radio_is_ready()); + } if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { lll_prof_cputime_capture(); diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_aux.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_aux.c index 731ca94ed508..c4ee5af14b1d 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_aux.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_aux.c @@ -488,7 +488,12 @@ static void isr_tx_chain(void *param) radio_pkt_tx_set(pdu); /* assert if radio packet ptr is not set and radio started rx */ - LL_ASSERT(!radio_is_ready()); + if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { + LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, + lll_prof_latency_get()); + } else { + LL_ASSERT(!radio_is_ready()); + } if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { lll_prof_cputime_capture(); @@ -602,7 +607,12 @@ static void isr_tx_rx(void *param) radio_pkt_rx_set(node_rx->pdu); /* assert if radio packet ptr is not set and radio started rx */ - LL_ASSERT(!radio_is_ready()); + if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { + LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, + lll_prof_latency_get()); + } else { + LL_ASSERT(!radio_is_ready()); + } if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { lll_prof_cputime_capture(); @@ -809,7 +819,12 @@ static inline int isr_rx_pdu(struct lll_adv_aux *lll_aux, uint8_t phy_flags_rx, radio_pkt_tx_set(sr_pdu); /* assert if radio packet ptr is not set and radio started tx */ - LL_ASSERT(!radio_is_ready()); + if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { + LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, + lll_prof_latency_get()); + } else { + LL_ASSERT(!radio_is_ready()); + } if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { lll_prof_cputime_capture(); @@ -881,7 +896,12 @@ static inline int isr_rx_pdu(struct lll_adv_aux *lll_aux, uint8_t phy_flags_rx, radio_pkt_tx_set(pdu_tx); /* assert if radio packet ptr is not set and radio started tx */ - LL_ASSERT(!radio_is_ready()); + if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { + LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, + lll_prof_latency_get()); + } else { + LL_ASSERT(!radio_is_ready()); + } if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { lll_prof_cputime_capture(); diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_iso.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_iso.c index 0b9ff8d938c2..774a10da2b30 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_iso.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_iso.c @@ -869,7 +869,12 @@ static void isr_tx_common(void *param, } /* assert if radio packet ptr is not set and radio started tx */ - LL_ASSERT(!radio_is_ready()); + if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { + LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, + lll_prof_latency_get()); + } else { + LL_ASSERT(!radio_is_ready()); + } if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { lll_prof_cputime_capture(); diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_sync.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_sync.c index e30b6d6b8d2a..7bcc0435fe53 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_sync.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_sync.c @@ -401,7 +401,12 @@ static void isr_tx(void *param) radio_pkt_tx_set(pdu); /* assert if radio packet ptr is not set and radio started rx */ - LL_ASSERT(!radio_is_ready()); + if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { + LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, + lll_prof_latency_get()); + } else { + LL_ASSERT(!radio_is_ready()); + } if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { lll_prof_cputime_capture(); diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_central_iso.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_central_iso.c index 7ae759dd2bec..fc44233f1ee8 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_central_iso.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_central_iso.c @@ -34,6 +34,7 @@ #include "lll_internal.h" #include "lll_tim_internal.h" +#include "lll_prof_internal.h" #include "ll_feat.h" @@ -466,6 +467,10 @@ static void isr_tx(void *param) struct node_rx_pdu *node_rx; uint32_t hcto; + if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { + lll_prof_latency_capture(); + } + /* Call to ensure packet/event timer accumulates the elapsed time * under single timer use. */ @@ -538,7 +543,12 @@ static void isr_tx(void *param) } /* assert if radio packet ptr is not set and radio started rx */ - LL_ASSERT(!radio_is_ready()); + if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { + LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, + lll_prof_latency_get()); + } else { + LL_ASSERT(!radio_is_ready()); + } /* +/- 2us active clock jitter, +1 us PPI to timer start compensation */ hcto = radio_tmr_tifs_base_get() + cis_lll->tifs_us + @@ -705,6 +715,10 @@ static void isr_rx(void *param) uint8_t crc_ok; uint8_t cie; + if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { + lll_prof_latency_capture(); + } + /* Read radio status and events */ trx_done = radio_is_done(); if (trx_done) { @@ -975,6 +989,10 @@ static void isr_rx(void *param) isr_prepare_subevent(param); + if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { + lll_prof_send(); + } + return; isr_rx_done: @@ -1131,6 +1149,13 @@ static void isr_prepare_subevent(void *param) radio_tmr_end_capture(); #if defined(HAL_RADIO_GPIO_HAVE_PA_PIN) + /* PA enable is overwriting packet end used in ISR profiling, hence + * back it up for later use. + */ + if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { + lll_prof_radio_end_backup(); + } + radio_gpio_pa_setup(); #if defined(CONFIG_BT_CTLR_PHY) @@ -1148,7 +1173,16 @@ static void isr_prepare_subevent(void *param) #endif /* !HAL_RADIO_GPIO_HAVE_PA_PIN */ /* assert if radio packet ptr is not set and radio started tx */ - LL_ASSERT(!radio_is_ready()); + if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { + LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, + lll_prof_latency_get()); + } else { + LL_ASSERT(!radio_is_ready()); + } + + if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { + lll_prof_cputime_capture(); + } radio_isr_set(isr_tx, param); diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_conn.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_conn.c index 1527987c02d0..a528e06c939e 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_conn.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_conn.c @@ -311,9 +311,6 @@ void lll_conn_isr_rx(void *param) struct pdu_data *pdu_data_tx; struct node_rx_pdu *node_rx; struct node_tx *tx_release; -#if defined(HAL_RADIO_GPIO_HAVE_PA_PIN) - uint32_t pa_lna_enable_us; -#endif /* HAL_RADIO_GPIO_HAVE_PA_PIN */ uint8_t is_rx_enqueue; struct lll_conn *lll; uint8_t rssi_ready; @@ -384,7 +381,12 @@ void lll_conn_isr_rx(void *param) radio_disable(); /* assert if radio started tx before being disabled */ - LL_ASSERT(!radio_is_ready()); + if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { + LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", + __func__, lll_prof_latency_get()); + } else { + LL_ASSERT(!radio_is_ready()); + } goto lll_conn_isr_rx_exit; } @@ -468,10 +470,13 @@ void lll_conn_isr_rx(void *param) } else if (!lll->role) { radio_disable(); - /* assert if radio packet ptr is not set and radio - * started tx. - */ - LL_ASSERT(!radio_is_ready()); + /* assert if radio started tx before being disabled */ + if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { + LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", + __func__, lll_prof_latency_get()); + } else { + LL_ASSERT(!radio_is_ready()); + } /* Restore state if last transmitted was empty PDU */ lll->empty = is_empty_pdu_tx_retry; @@ -507,6 +512,7 @@ void lll_conn_isr_rx(void *param) lll_conn_tx_pkt_set(lll, pdu_data_tx); #if defined(HAL_RADIO_GPIO_HAVE_PA_PIN) + uint32_t pa_lna_enable_us; #if defined(CONFIG_BT_CTLR_PROFILE_ISR) /* PA enable is overwriting packet end used in ISR profiling, hence @@ -529,10 +535,10 @@ void lll_conn_isr_rx(void *param) /* assert if radio packet ptr is not set and radio started tx */ if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { - LL_ASSERT_MSG(!radio_is_address(), "%s: Radio ISR latency: %u", __func__, + LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, lll_prof_latency_get()); } else { - LL_ASSERT(!radio_is_address()); + LL_ASSERT(!radio_is_ready()); } #if defined(CONFIG_BT_CTLR_TX_DEFER) @@ -727,10 +733,10 @@ void lll_conn_isr_tx(void *param) /* assert if radio packet ptr is not set and radio started rx */ if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { - LL_ASSERT_MSG(!radio_is_address(), "%s: Radio ISR latency: %u", __func__, + LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, lll_prof_latency_get()); } else { - LL_ASSERT(!radio_is_address()); + LL_ASSERT(!radio_is_ready()); } #if defined(CONFIG_BT_CTLR_DF_CONN_CTE_TX) diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral_iso.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral_iso.c index 5d23a12993bd..46e6aad63b7e 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral_iso.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral_iso.c @@ -34,6 +34,7 @@ #include "lll_internal.h" #include "lll_tim_internal.h" +#include "lll_prof_internal.h" #include "ll_feat.h" @@ -496,6 +497,10 @@ static void isr_rx(void *param) uint8_t crc_ok; uint8_t cie; + if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { + lll_prof_latency_capture(); + } + /* Read radio status and events */ trx_done = radio_is_done(); if (trx_done) { @@ -774,6 +779,13 @@ static void isr_rx(void *param) #if defined(HAL_RADIO_GPIO_HAVE_PA_PIN) uint32_t pa_lna_enable_us; + /* PA enable is overwriting packet end used in ISR profiling, hence + * back it up for later use. + */ + if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { + lll_prof_radio_end_backup(); + } + radio_gpio_pa_setup(); pa_lna_enable_us = radio_tmr_tifs_base_get() + cis_lll->tifs_us - @@ -788,7 +800,16 @@ static void isr_rx(void *param) #endif /* HAL_RADIO_GPIO_HAVE_PA_PIN */ /* assert if radio packet ptr is not set and radio started tx */ - LL_ASSERT(!radio_is_ready()); + if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { + LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, + lll_prof_latency_get()); + } else { + LL_ASSERT(!radio_is_ready()); + } + + if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { + lll_prof_cputime_capture(); + } /* Schedule next subevent */ if (!cie && (se_curr < cis_lll->nse)) { @@ -865,6 +886,10 @@ static void isr_rx(void *param) start_us = radio_tmr_start_us(0U, subevent_us); LL_ASSERT(start_us == (subevent_us + 1U)); #endif /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */ + + if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { + lll_prof_send(); + } } static void isr_tx(void *param) @@ -876,6 +901,10 @@ static void isr_tx(void *param) uint32_t start_us; uint32_t hcto; + if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { + lll_prof_latency_capture(); + } + /* Call to ensure packet/event timer accumulates the elapsed time * under single timer use. */ @@ -994,6 +1023,10 @@ static void isr_tx(void *param) radio_tmr_hcto_configure_abs(hcto); +#if defined(CONFIG_BT_CTLR_PROFILE_ISR) || defined(HAL_RADIO_GPIO_HAVE_PA_PIN) + radio_tmr_end_capture(); +#endif /* CONFIG_BT_CTLR_PROFILE_ISR || HAL_RADIO_GPIO_HAVE_PA_PIN */ + #if defined(HAL_RADIO_GPIO_HAVE_LNA_PIN) radio_gpio_lna_setup(); diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan.c index 79f60677be7c..f1fab4b664de 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan.c @@ -792,10 +792,10 @@ static void isr_tx(void *param) /* assert if radio packet ptr is not set and radio started rx */ if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { - LL_ASSERT_MSG(!radio_is_address(), "%s: Radio ISR latency: %u", __func__, + LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, lll_prof_latency_get()); } else { - LL_ASSERT(!radio_is_address()); + LL_ASSERT(!radio_is_ready()); } #if defined(CONFIG_BT_CTLR_PRIVACY) @@ -1217,10 +1217,10 @@ static inline int isr_rx_pdu(struct lll_scan *lll, struct pdu_adv *pdu_adv_rx, /* assert if radio packet ptr is not set and radio started tx */ if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { - LL_ASSERT_MSG(!radio_is_address(), "%s: Radio ISR latency: %u", __func__, + LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, lll_prof_latency_get()); } else { - LL_ASSERT(!radio_is_address()); + LL_ASSERT(!radio_is_ready()); } if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { @@ -1354,10 +1354,10 @@ static inline int isr_rx_pdu(struct lll_scan *lll, struct pdu_adv *pdu_adv_rx, /* assert if radio packet ptr is not set and radio started tx */ if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { - LL_ASSERT_MSG(!radio_is_address(), "%s: Radio ISR latency: %u", __func__, + LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, lll_prof_latency_get()); } else { - LL_ASSERT(!radio_is_address()); + LL_ASSERT(!radio_is_ready()); } if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan_aux.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan_aux.c index 1a8aeb536f0c..0478fbc80011 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan_aux.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan_aux.c @@ -1051,7 +1051,12 @@ static int isr_rx_pdu(struct lll_scan *lll, struct lll_scan_aux *lll_aux, radio_pkt_tx_set(pdu_tx); /* assert if radio packet ptr is not set and radio started tx */ - LL_ASSERT(!radio_is_ready()); + if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { + LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, + lll_prof_latency_get()); + } else { + LL_ASSERT(!radio_is_ready()); + } if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { lll_prof_cputime_capture(); @@ -1201,7 +1206,12 @@ static int isr_rx_pdu(struct lll_scan *lll, struct lll_scan_aux *lll_aux, radio_pkt_tx_set(pdu_tx); /* assert if radio packet ptr is not set and radio started tx */ - LL_ASSERT(!radio_is_ready()); + if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { + LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, + lll_prof_latency_get()); + } else { + LL_ASSERT(!radio_is_ready()); + } if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { lll_prof_cputime_capture(); @@ -1407,7 +1417,12 @@ static void isr_tx(struct lll_scan_aux *lll_aux, void *pdu_rx, radio_pkt_rx_set(pdu_rx); /* assert if radio packet ptr is not set and radio started rx */ - LL_ASSERT(!radio_is_ready()); + if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { + LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, + lll_prof_latency_get()); + } else { + LL_ASSERT(!radio_is_ready()); + } if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { lll_prof_cputime_capture(); From 9d5767985cdd3a6a493cb3fcf327f156a31f1cc7 Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Sat, 20 Sep 2025 06:30:37 +0200 Subject: [PATCH 1970/2141] [nrf fromtree] Bluetooth: Controller: nRF54L: Fix to improve decryption speed Fix to improve decryption speed. Decryption starts after payload reception, hence use fastest mode to decrypt PDUs. nRF54Lx only supports decryption after payload reception, this implementation was already there in the code. Signed-off-by: Vinayak Kariappa Chettimada (cherry picked from commit 9b26e967caa34537df637663d834ff56672714bd) Signed-off-by: Vinayak Kariappa Chettimada --- .../ll_sw/nordic/hal/nrf5/radio/radio.c | 77 ++++++++++++------- .../nordic/hal/nrf5/radio/radio_nrf5_dppi.h | 30 ++++---- 2 files changed, 65 insertions(+), 42 deletions(-) diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c index dbca89da1c58..218965d11bd0 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c @@ -2114,10 +2114,14 @@ static void *radio_ccm_ext_rx_pkt_set(struct ccm *cnf, uint8_t phy, uint8_t pdu_ NRF_CCM->ENABLE = CCM_ENABLE_ENABLE_Disabled; NRF_CCM->ENABLE = CCM_ENABLE_ENABLE_Enabled; - mode = (CCM_MODE_MODE_Decryption << CCM_MODE_MODE_Pos) & + /* Select the CCM decryption mode for the SoC */ +#if defined(CONFIG_SOC_COMPATIBLE_NRF54LX) + /* NOTE: Use fast decryption as rx data is decrypt after payload is received, compared to + * decrypting in parallel with radio reception of address in nRF51/nRF52/nRF53. + */ + mode = (CCM_MODE_MODE_FastDecryption << CCM_MODE_MODE_Pos) & CCM_MODE_MODE_Msk; -#if defined(CONFIG_SOC_COMPATIBLE_NRF54LX) /* Enable CCM Protocol Mode Bluetooth LE */ mode |= (CCM_MODE_PROTOCOL_Ble << CCM_MODE_PROTOCOL_Pos) & CCM_MODE_PROTOCOL_Msk; @@ -2126,21 +2130,30 @@ static void *radio_ccm_ext_rx_pkt_set(struct ccm *cnf, uint8_t phy, uint8_t pdu_ mode |= (CCM_MODE_MACLEN_M4 << CCM_MODE_MACLEN_Pos) & CCM_MODE_MACLEN_Msk; -#elif !defined(CONFIG_SOC_SERIES_NRF51X) +#elif defined(CONFIG_SOC_COMPATIBLE_NRF52X) || defined(CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET) + mode = (CCM_MODE_MODE_Decryption << CCM_MODE_MODE_Pos) & + CCM_MODE_MODE_Msk; + /* Enable CCM support for 8-bit length field PDUs. */ mode |= (CCM_MODE_LENGTH_Extended << CCM_MODE_LENGTH_Pos) & CCM_MODE_LENGTH_Msk; -#endif /* !CONFIG_SOC_SERIES_NRF51X */ + +#elif defined(CONFIG_SOC_SERIES_NRF51X) + mode = (CCM_MODE_MODE_Decryption << CCM_MODE_MODE_Pos) & + CCM_MODE_MODE_Msk; + +#else +#error "H/w accelerated decryption unsupported." +#endif /* Select CCM data rate based on current PHY in use. */ switch (phy) { default: case PHY_1M: -#if !defined(CONFIG_SOC_SERIES_NRF51X) - mode |= (CCM_MODE_DATARATE_1Mbit << - CCM_MODE_DATARATE_Pos) & +#if !defined(CONFIG_SOC_SERIES_NRF51X) && !defined(CONFIG_SOC_COMPATIBLE_NRF54LX) + mode |= (CCM_MODE_DATARATE_1Mbit << CCM_MODE_DATARATE_Pos) & CCM_MODE_DATARATE_Msk; -#endif /* !CONFIG_SOC_SERIES_NRF51X */ +#endif /* !CONFIG_SOC_SERIES_NRF51X && !CONFIG_SOC_COMPATIBLE_NRF54LX */ if (false) { @@ -2163,11 +2176,10 @@ static void *radio_ccm_ext_rx_pkt_set(struct ccm *cnf, uint8_t phy, uint8_t pdu_ break; case PHY_2M: -#if !defined(CONFIG_SOC_SERIES_NRF51X) - mode |= (CCM_MODE_DATARATE_2Mbit << - CCM_MODE_DATARATE_Pos) & +#if !defined(CONFIG_SOC_SERIES_NRF51X) && !defined(CONFIG_SOC_COMPATIBLE_NRF54LX) + mode |= (CCM_MODE_DATARATE_2Mbit << CCM_MODE_DATARATE_Pos) & CCM_MODE_DATARATE_Msk; -#endif /* !CONFIG_SOC_SERIES_NRF51X */ +#endif /* !CONFIG_SOC_SERIES_NRF51X && !CONFIG_SOC_COMPATIBLE_NRF54LX */ hal_trigger_crypt_ppi_config(); hal_radio_nrf_ppi_channels_enable(BIT(HAL_TRIGGER_CRYPT_PPI)); @@ -2177,9 +2189,10 @@ static void *radio_ccm_ext_rx_pkt_set(struct ccm *cnf, uint8_t phy, uint8_t pdu_ #if defined(CONFIG_BT_CTLR_PHY_CODED) #if defined(CONFIG_HAS_HW_NRF_RADIO_BLE_CODED) case PHY_CODED: - mode |= (CCM_MODE_DATARATE_125Kbps << - CCM_MODE_DATARATE_Pos) & +#if !defined(CONFIG_SOC_COMPATIBLE_NRF54LX) + mode |= (CCM_MODE_DATARATE_125Kbps << CCM_MODE_DATARATE_Pos) & CCM_MODE_DATARATE_Msk; +#endif /* !CONFIG_SOC_COMPATIBLE_NRF54LX */ NRF_CCM->RATEOVERRIDE = (CCM_RATEOVERRIDE_RATEOVERRIDE_500Kbps << @@ -2346,22 +2359,11 @@ static void *radio_ccm_ext_tx_pkt_set(struct ccm *cnf, uint8_t pdu_type, void *p NRF_CCM->ENABLE = CCM_ENABLE_ENABLE_Disabled; NRF_CCM->ENABLE = CCM_ENABLE_ENABLE_Enabled; + /* Select the CCM encryption mode for the SoC */ +#if defined(CONFIG_SOC_COMPATIBLE_NRF54LX) mode = (CCM_MODE_MODE_Encryption << CCM_MODE_MODE_Pos) & CCM_MODE_MODE_Msk; -#if defined(CONFIG_SOC_COMPATIBLE_NRF52X) || \ - defined(CONFIG_SOC_COMPATIBLE_NRF53X) - /* Enable CCM support for 8-bit length field PDUs. */ - mode |= (CCM_MODE_LENGTH_Extended << CCM_MODE_LENGTH_Pos) & - CCM_MODE_LENGTH_Msk; - - /* NOTE: use fastest data rate as tx data needs to be prepared before - * radio Tx on any PHY. - */ - mode |= (CCM_MODE_DATARATE_2Mbit << CCM_MODE_DATARATE_Pos) & - CCM_MODE_DATARATE_Msk; - -#elif defined(CONFIG_SOC_COMPATIBLE_NRF54LX) /* Enable CCM Protocol Mode Bluetooth LE */ mode |= (CCM_MODE_PROTOCOL_Ble << CCM_MODE_PROTOCOL_Pos) & CCM_MODE_PROTOCOL_Msk; @@ -2375,6 +2377,27 @@ static void *radio_ccm_ext_tx_pkt_set(struct ccm *cnf, uint8_t pdu_type, void *p /* Enable CCM MAC Length 4 bytes */ mode |= (CCM_MODE_MACLEN_M4 << CCM_MODE_MACLEN_Pos) & CCM_MODE_MACLEN_Msk; + +#elif defined(CONFIG_SOC_COMPATIBLE_NRF52X) || defined(CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET) + mode = (CCM_MODE_MODE_Encryption << CCM_MODE_MODE_Pos) & + CCM_MODE_MODE_Msk; + + /* Enable CCM support for 8-bit length field PDUs. */ + mode |= (CCM_MODE_LENGTH_Extended << CCM_MODE_LENGTH_Pos) & + CCM_MODE_LENGTH_Msk; + + /* NOTE: use fastest data rate as tx data needs to be prepared before + * radio Tx on any PHY. + */ + mode |= (CCM_MODE_DATARATE_2Mbit << CCM_MODE_DATARATE_Pos) & + CCM_MODE_DATARATE_Msk; + +#elif defined(CONFIG_SOC_SERIES_NRF51X) + mode = (CCM_MODE_MODE_Encryption << CCM_MODE_MODE_Pos) & + CCM_MODE_MODE_Msk; + +#else +#error "H/w accelerated encryption unsupported." #endif NRF_CCM->MODE = mode; diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_dppi.h b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_dppi.h index 11bb973994b4..3b68259c9bf6 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_dppi.h +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_dppi.h @@ -106,17 +106,17 @@ static inline void hal_event_timer_start_ppi_config(void) nrf_grtc_publish_set(NRF_GRTC, HAL_CNTR_GRTC_EVENT_COMPARE_RADIO, HAL_EVENT_TIMER_START_PPI); - /* Enable same DPPI in Peripheral domain */ - nrf_dppi_channels_enable(NRF_DPPIC20, - BIT(HAL_EVENT_TIMER_START_PPI)); + /* Setup PPIB receive publish */ + nrf_ppib_publish_set(NRF_PPIB11, HAL_PPIB_RECEIVE_EVENT_TIMER_START_PPI, + HAL_EVENT_TIMER_START_PPI); /* Setup PPIB send subscribe */ nrf_ppib_subscribe_set(NRF_PPIB21, HAL_PPIB_SEND_EVENT_TIMER_START_PPI, HAL_EVENT_TIMER_START_PPI); - /* Setup PPIB receive publish */ - nrf_ppib_publish_set(NRF_PPIB11, HAL_PPIB_RECEIVE_EVENT_TIMER_START_PPI, - HAL_EVENT_TIMER_START_PPI); + /* Enable same DPPI in Peripheral domain */ + nrf_dppi_channels_enable(NRF_DPPIC20, + BIT(HAL_EVENT_TIMER_START_PPI)); #else /* !CONFIG_BT_CTLR_NRF_GRTC */ nrf_rtc_publish_set(NRF_RTC, NRF_RTC_EVENT_COMPARE_2, HAL_EVENT_TIMER_START_PPI); @@ -148,22 +148,22 @@ static inline void hal_radio_ready_time_capture_ppi_config(void) */ static inline void hal_trigger_crypt_ppi_config(void) { +#if defined(CONFIG_SOC_COMPATIBLE_NRF54LX) + nrf_radio_publish_set(NRF_RADIO, NRF_RADIO_EVENT_PAYLOAD, HAL_TRIGGER_CRYPT_PPI); nrf_ccm_subscribe_set(NRF_CCM, NRF_CCM_TASK_START, HAL_TRIGGER_CRYPT_PPI); -#if !defined(CONFIG_SOC_COMPATIBLE_NRF54LX) - nrf_radio_publish_set(NRF_RADIO, NRF_RADIO_EVENT_ADDRESS, HAL_TRIGGER_CRYPT_PPI); + /* Setup PPIB receive publish */ + nrf_ppib_publish_set(NRF_PPIB00, HAL_PPIB_RECEIVE_TRIGGER_CRYPT_PPI, HAL_TRIGGER_CRYPT_PPI); -#else /* !CONFIG_SOC_COMPATIBLE_NRF54LX */ - nrf_radio_publish_set(NRF_RADIO, NRF_RADIO_EVENT_PAYLOAD, HAL_TRIGGER_CRYPT_PPI); + /* Setup PPIB send subscribe */ + nrf_ppib_subscribe_set(NRF_PPIB10, HAL_PPIB_SEND_TRIGGER_CRYPT_PPI, HAL_TRIGGER_CRYPT_PPI); /* Enable same DPPI in MCU domain */ nrf_dppi_channels_enable(NRF_DPPIC00, BIT(HAL_TRIGGER_CRYPT_PPI)); - /* Setup PPIB send subscribe */ - nrf_ppib_subscribe_set(NRF_PPIB10, HAL_PPIB_SEND_TRIGGER_CRYPT_PPI, HAL_TRIGGER_CRYPT_PPI); - - /* Setup PPIB receive publish */ - nrf_ppib_publish_set(NRF_PPIB00, HAL_PPIB_RECEIVE_TRIGGER_CRYPT_PPI, HAL_TRIGGER_CRYPT_PPI); +#else /* !CONFIG_SOC_COMPATIBLE_NRF54LX */ + nrf_radio_publish_set(NRF_RADIO, NRF_RADIO_EVENT_ADDRESS, HAL_TRIGGER_CRYPT_PPI); + nrf_ccm_subscribe_set(NRF_CCM, NRF_CCM_TASK_START, HAL_TRIGGER_CRYPT_PPI); #endif /* !CONFIG_SOC_COMPATIBLE_NRF54LX */ } From 2179038ef08d1a02f353124f828373e30cc50ac1 Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Wed, 22 Oct 2025 21:31:27 +0200 Subject: [PATCH 1971/2141] [nrf fromtree] Bluetooth: Controller: nRF54L: Fix PPIB interface include cond compile Fix trivial PPIB interface include conditional compile. Signed-off-by: Vinayak Kariappa Chettimada (cherry picked from commit 625f3052f59b5c9fb7f382e91f9d7860f3bb0774) Signed-off-by: Vinayak Kariappa Chettimada --- .../controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5.h b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5.h index f01f9859db4b..1b15f41c4080 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5.h +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5.h @@ -40,6 +40,7 @@ #include #include "radio_nrf5340.h" #elif defined(CONFIG_SOC_SERIES_NRF54LX) +#include #include "radio_nrf54lx.h" #elif defined(CONFIG_BOARD_NRF52_BSIM) #include "radio_sim_nrf52.h" @@ -47,6 +48,7 @@ #include #include "radio_sim_nrf5340.h" #elif defined(CONFIG_BOARD_NRF54L15BSIM_NRF54L15_CPUAPP) +#include #include "radio_sim_nrf54l.h" #else #error "Unsupported SoC." @@ -54,7 +56,6 @@ #if defined(CONFIG_BT_CTLR_NRF_GRTC) #include -#include #else /* !CONFIG_BT_CTLR_NRF_GRTC */ #include #endif /* !CONFIG_BT_CTLR_NRF_GRTC */ From 46628774e42226629ba57e225656fbb3a13ab8b7 Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Mon, 26 May 2025 16:41:01 +0200 Subject: [PATCH 1972/2141] [nrf fromtree] Bluetooth: Controller: Introduce LL_ASSERT_DBG/ERR Introduce development and fatal assertion classification in the Controller implementation. Signed-off-by: Vinayak Kariappa Chettimada (cherry picked from commit 796c0002f828bcb4911cd680650f1e102efaac0d) Signed-off-by: Vinayak Kariappa Chettimada --- subsys/bluetooth/controller/Kconfig | 12 + subsys/bluetooth/controller/hal/debug.h | 19 ++ subsys/bluetooth/controller/hci/hci.c | 44 ++-- subsys/bluetooth/controller/hci/hci_driver.c | 55 ++--- subsys/bluetooth/controller/ll_sw/isoal.c | 44 ++-- subsys/bluetooth/controller/ll_sw/lll_chan.c | 206 +++++++++--------- .../bluetooth/controller/ll_sw/lll_common.c | 2 +- .../controller/ll_sw/nordic/hal/nrf5/cntr.c | 2 +- .../controller/ll_sw/nordic/hal/nrf5/ecb.c | 2 +- .../controller/ll_sw/nordic/hal/nrf5/mayfly.c | 6 +- .../controller/ll_sw/nordic/hal/nrf5/ticker.c | 16 +- .../controller/ll_sw/nordic/lll/lll.c | 80 +++---- .../controller/ll_sw/nordic/lll/lll_adv.c | 42 ++-- .../controller/ll_sw/nordic/lll/lll_adv_aux.c | 40 ++-- .../controller/ll_sw/nordic/lll/lll_adv_iso.c | 28 +-- .../ll_sw/nordic/lll/lll_adv_sync.c | 20 +- .../controller/ll_sw/nordic/lll/lll_central.c | 8 +- .../ll_sw/nordic/lll/lll_central_iso.c | 46 ++-- .../controller/ll_sw/nordic/lll/lll_conn.c | 30 +-- .../controller/ll_sw/nordic/lll/lll_df.c | 2 +- .../ll_sw/nordic/lll/lll_peripheral.c | 8 +- .../ll_sw/nordic/lll/lll_peripheral_iso.c | 44 ++-- .../controller/ll_sw/nordic/lll/lll_scan.c | 44 ++-- .../ll_sw/nordic/lll/lll_scan_aux.c | 48 ++-- .../controller/ll_sw/nordic/lll/lll_sync.c | 30 +-- .../ll_sw/nordic/lll/lll_sync_iso.c | 56 ++--- .../controller/ll_sw/nordic/lll/lll_test.c | 8 +- subsys/bluetooth/controller/ll_sw/ull.c | 110 +++++----- subsys/bluetooth/controller/ll_sw/ull_adv.c | 86 ++++---- .../bluetooth/controller/ll_sw/ull_adv_aux.c | 59 ++--- .../bluetooth/controller/ll_sw/ull_adv_iso.c | 63 +++--- .../bluetooth/controller/ll_sw/ull_adv_sync.c | 45 ++-- .../bluetooth/controller/ll_sw/ull_central.c | 42 ++-- .../controller/ll_sw/ull_central_iso.c | 32 +-- subsys/bluetooth/controller/ll_sw/ull_conn.c | 90 ++++---- .../bluetooth/controller/ll_sw/ull_conn_iso.c | 90 ++++---- subsys/bluetooth/controller/ll_sw/ull_df.c | 6 +- .../bluetooth/controller/ll_sw/ull_filter.c | 34 +-- subsys/bluetooth/controller/ll_sw/ull_iso.c | 64 +++--- subsys/bluetooth/controller/ll_sw/ull_llcp.c | 18 +- .../bluetooth/controller/ll_sw/ull_llcp_cc.c | 24 +- .../controller/ll_sw/ull_llcp_chmu.c | 6 +- .../controller/ll_sw/ull_llcp_common.c | 44 ++-- .../controller/ll_sw/ull_llcp_conn_upd.c | 28 +-- .../bluetooth/controller/ll_sw/ull_llcp_enc.c | 26 +-- .../controller/ll_sw/ull_llcp_local.c | 14 +- .../controller/ll_sw/ull_llcp_past.c | 6 +- .../bluetooth/controller/ll_sw/ull_llcp_phy.c | 34 +-- .../controller/ll_sw/ull_llcp_remote.c | 22 +- .../controller/ll_sw/ull_peripheral.c | 24 +- .../controller/ll_sw/ull_peripheral_iso.c | 17 +- subsys/bluetooth/controller/ll_sw/ull_scan.c | 36 +-- .../bluetooth/controller/ll_sw/ull_scan_aux.c | 205 ++++++++--------- subsys/bluetooth/controller/ll_sw/ull_sched.c | 6 +- subsys/bluetooth/controller/ll_sw/ull_sync.c | 52 ++--- .../bluetooth/controller/ll_sw/ull_sync_iso.c | 51 ++--- subsys/bluetooth/controller/ticker/ticker.c | 10 +- tests/bluetooth/init/prj_ctlr.conf | 1 + tests/bluetooth/init/prj_ctlr_dbg.conf | 1 + 59 files changed, 1170 insertions(+), 1118 deletions(-) diff --git a/subsys/bluetooth/controller/Kconfig b/subsys/bluetooth/controller/Kconfig index ca1a5bbede4d..0512c23e1ed7 100644 --- a/subsys/bluetooth/controller/Kconfig +++ b/subsys/bluetooth/controller/Kconfig @@ -1190,6 +1190,18 @@ rsource "Kconfig.df" rsource "Kconfig.ll_sw_split" rsource "Kconfig.dtm" +config BT_CTLR_ASSERT_DEBUG + bool "Development asserts" + default y + help + This option enables development asserts used for code coverage. + + The Controller will continue to function without memory leak or corruption with these + assertion checks disabled. Example, run-time mis-aligned memory access etc. which do + otherwise implicitly cause CPU fault during development testing. But these type of + asserted are essentially required for debugging, code and unit test coverage during + development cycle. + config BT_CTLR_ASSERT_HANDLER bool "Application Defined Assertion Handler" help diff --git a/subsys/bluetooth/controller/hal/debug.h b/subsys/bluetooth/controller/hal/debug.h index 653aa304b070..cb193a460971 100644 --- a/subsys/bluetooth/controller/hal/debug.h +++ b/subsys/bluetooth/controller/hal/debug.h @@ -27,6 +27,25 @@ void bt_ctlr_assert_handle(char *file, uint32_t line); BT_ASSERT_MSG(cond, fmt, ##__VA_ARGS__) #endif +/* Fatal asserts. + * The Controller will otherwise misbehave causing memory leak or system-wide memory corruptions due + * to uncontrolled DMA transfers etc. + * It is not safe to disable these assertion checks. + */ +#define LL_ASSERT_ERR(cond) LL_ASSERT(cond) + +/* Development asserts. + * The Controller will continue to function without memory leak or corruption with these assertion + * checks disabled. Example, run-time mis-aligned memory access etc. which do otherwise implicitly + * cause CPU fault during development testing. But these type of asserted are essentially required + * for debugging, code and unit test coverage during development cycle. + */ +#if defined(CONFIG_BT_CTLR_ASSERT_DEBUG) +#define LL_ASSERT_DBG(cond) LL_ASSERT(cond) +#else /* !CONFIG_BT_CTLR_ASSERT_DEBUG */ +#define LL_ASSERT_DBG(cond) ARG_UNUSED((cond)) +#endif /* !CONFIG_BT_CTLR_ASSERT_DEBUG */ + #if defined(CONFIG_BT_CTLR_ASSERT_VENDOR) #define LL_ASSERT_INFO1(cond, param) \ BT_ASSERT_VND(cond, param, 0) diff --git a/subsys/bluetooth/controller/hci/hci.c b/subsys/bluetooth/controller/hci/hci.c index 683c4cadf919..eaf4667a1b85 100644 --- a/subsys/bluetooth/controller/hci/hci.c +++ b/subsys/bluetooth/controller/hci/hci.c @@ -3222,7 +3222,7 @@ static void le_df_connection_iq_report(struct node_rx_pdu *node_rx, struct net_b phy_rx = lll->phy_rx; /* Make sure the report is generated for connection on PHY UNCODED */ - LL_ASSERT(phy_rx != PHY_CODED); + LL_ASSERT_DBG(phy_rx != PHY_CODED); #else phy_rx = PHY_1M; #endif /* CONFIG_BT_CTLR_PHY */ @@ -4412,7 +4412,7 @@ static void le_cis_request(struct pdu_data *pdu_data, * event. */ node = pdu_data; - LL_ASSERT(IS_PTR_ALIGNED(node, struct node_rx_conn_iso_estab)); + LL_ASSERT_DBG(IS_PTR_ALIGNED(node, struct node_rx_conn_iso_estab)); req = node; if (!(ll_feat_get() & BIT64(BT_LE_FEAT_BIT_ISO_CHANNELS)) || @@ -4459,7 +4459,7 @@ static void le_cis_established(struct pdu_data *pdu_data, * event. */ node = pdu_data; - LL_ASSERT(IS_PTR_ALIGNED(node, struct node_rx_conn_iso_estab)); + LL_ASSERT_DBG(IS_PTR_ALIGNED(node, struct node_rx_conn_iso_estab)); est = node; sep->status = est->status; @@ -4518,7 +4518,7 @@ static void le_per_adv_sync_transfer_received(struct pdu_data *pdu_data_rx, * event. */ node = pdu_data_rx; - LL_ASSERT(IS_PTR_ALIGNED(node, struct node_rx_past_received)); + LL_ASSERT_DBG(IS_PTR_ALIGNED(node, struct node_rx_past_received)); se = node; sep->status = se->rx_sync.status; @@ -5520,7 +5520,7 @@ static void vs_le_df_connection_iq_report(struct node_rx_pdu *node_rx, struct ne phy_rx = lll->phy_rx; /* Make sure the report is generated for connection on PHY UNCODED */ - LL_ASSERT(phy_rx != PHY_CODED); + LL_ASSERT_DBG(phy_rx != PHY_CODED); #else phy_rx = PHY_1M; #endif /* CONFIG_BT_CTLR_PHY */ @@ -6300,7 +6300,7 @@ int hci_iso_handle(struct net_buf *buf, struct net_buf **evt) /* Start Fragmentation */ /* FIXME: need to ensure ISO-AL returns proper isoal_status. - * Currently there are cases where ISO-AL calls LL_ASSERT. + * Currently there are cases where ISO-AL calls LL_ASSERT_ERR. */ isoal_status_t isoal_status = isoal_tx_sdu_fragment(stream->dp->source_hdl, &sdu_frag_tx); @@ -6554,7 +6554,7 @@ static inline void le_dir_adv_report(struct pdu_adv *adv, struct net_buf *buf, return; } - LL_ASSERT(adv->type == PDU_ADV_TYPE_DIRECT_IND); + LL_ASSERT_DBG(adv->type == PDU_ADV_TYPE_DIRECT_IND); #if CONFIG_BT_CTLR_DUP_FILTER_LEN > 0 if (dup_scan && @@ -6624,7 +6624,7 @@ static inline void le_mesh_scan_report(struct pdu_adv *adv, uint32_t instant; uint8_t chan; - LL_ASSERT(adv->type == PDU_ADV_TYPE_NONCONN_IND); + LL_ASSERT_DBG(adv->type == PDU_ADV_TYPE_NONCONN_IND); /* Filter based on currently active Scan Filter */ if (sf_curr < ARRAY_SIZE(scan_filters) && @@ -7093,7 +7093,7 @@ static void ext_adv_pdu_frag(uint8_t evt_type, uint8_t phy, uint8_t sec_phy, *data_len_total -= data_len_frag; *evt_buf = bt_buf_get_rx(BT_BUF_EVT, BUF_GET_TIMEOUT); - LL_ASSERT(*evt_buf); + LL_ASSERT_ERR(*evt_buf); net_buf_frag_add(buf, *evt_buf); @@ -7630,7 +7630,7 @@ static void le_ext_adv_report(struct pdu_data *pdu_data, * event. */ evt_buf = bt_buf_get_rx(BT_BUF_EVT, BUF_GET_TIMEOUT); - LL_ASSERT(evt_buf); + LL_ASSERT_ERR(evt_buf); net_buf_frag_add(buf, evt_buf); @@ -7726,7 +7726,7 @@ static void le_per_adv_sync_established(struct pdu_data *pdu_data, * event. */ node = pdu_data; - LL_ASSERT(IS_PTR_ALIGNED(node, struct node_rx_sync)); + LL_ASSERT_DBG(IS_PTR_ALIGNED(node, struct node_rx_sync)); se = node; sep->status = se->status; @@ -8006,7 +8006,7 @@ static void le_per_adv_sync_report(struct pdu_data *pdu_data, data_status = BT_HCI_LE_ADV_EVT_TYPE_DATA_STATUS_PARTIAL; evt_buf = bt_buf_get_rx(BT_BUF_EVT, BUF_GET_TIMEOUT); - LL_ASSERT(evt_buf); + LL_ASSERT_ERR(evt_buf); net_buf_frag_add(buf, evt_buf); @@ -8062,7 +8062,7 @@ static void le_per_adv_sync_report(struct pdu_data *pdu_data, */ if (!evt_buf) { evt_buf = bt_buf_get_rx(BT_BUF_EVT, BUF_GET_TIMEOUT); - LL_ASSERT(evt_buf); + LL_ASSERT_ERR(evt_buf); net_buf_frag_add(buf, evt_buf); } @@ -8147,7 +8147,7 @@ static void le_big_sync_established(struct pdu_data *pdu, * established event. */ node = pdu; - LL_ASSERT(IS_PTR_ALIGNED(node, struct node_rx_sync_iso)); + LL_ASSERT_DBG(IS_PTR_ALIGNED(node, struct node_rx_sync_iso)); se = node; sep->status = se->status; @@ -8451,7 +8451,7 @@ static void le_conn_complete(struct pdu_data *pdu_data, uint16_t handle, * complete event. */ node = pdu_data; - LL_ASSERT(IS_PTR_ALIGNED(node, struct node_rx_cc)); + LL_ASSERT_DBG(IS_PTR_ALIGNED(node, struct node_rx_cc)); cc = node; status = cc->status; @@ -8588,7 +8588,7 @@ static void le_conn_update_complete(struct pdu_data *pdu_data, uint16_t handle, * update complete event. */ node = pdu_data; - LL_ASSERT(IS_PTR_ALIGNED(node, struct node_rx_cu)); + LL_ASSERT_DBG(IS_PTR_ALIGNED(node, struct node_rx_cu)); cu = node; sep->status = cu->status; @@ -8845,7 +8845,7 @@ static void encode_control(struct node_rx_pdu *node_rx, #elif defined(CONFIG_BT_CTLR_VS_SCAN_REQ_RX) le_vs_scan_req_received(pdu_data, node_rx, buf); #else - LL_ASSERT(0); + LL_ASSERT_DBG(0); #endif /* CONFIG_BT_CTLR_ADV_EXT */ break; #endif /* CONFIG_BT_CTLR_SCAN_REQ_NOTIFY */ @@ -8984,7 +8984,7 @@ static void encode_control(struct node_rx_pdu *node_rx, #endif /* CONFIG_BT_CTLR_USER_EVT_RANGE > 0 */ default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); return; } } @@ -9212,7 +9212,7 @@ static void encode_data_ctrl(struct node_rx_pdu *node_rx, break; default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); return; } } @@ -9243,20 +9243,20 @@ void hci_acl_encode(struct node_rx_pdu *node_rx, struct net_buf *buf) memcpy(data, pdu_data->lldata, pdu_data->len); #if defined(CONFIG_BT_HCI_ACL_FLOW_CONTROL) if (hci_hbuf_total > 0) { - LL_ASSERT((hci_hbuf_sent - hci_hbuf_acked) < + LL_ASSERT_DBG((hci_hbuf_sent - hci_hbuf_acked) < hci_hbuf_total); hci_hbuf_sent++; /* Note: This requires linear handle values starting * from 0 */ - LL_ASSERT(handle < ARRAY_SIZE(hci_hbuf_pend)); + LL_ASSERT_DBG(handle < ARRAY_SIZE(hci_hbuf_pend)); hci_hbuf_pend[handle]++; } #endif /* CONFIG_BT_HCI_ACL_FLOW_CONTROL */ break; default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } } diff --git a/subsys/bluetooth/controller/hci/hci_driver.c b/subsys/bluetooth/controller/hci/hci_driver.c index 8f3fd04d8e9e..43b2ad1ef656 100644 --- a/subsys/bluetooth/controller/hci/hci_driver.c +++ b/subsys/bluetooth/controller/hci/hci_driver.c @@ -91,21 +91,20 @@ isoal_status_t sink_sdu_alloc_hci(const struct isoal_sink *sink_ctx, const struct isoal_pdu_rx *valid_pdu, struct isoal_sdu_buffer *sdu_buffer) { + struct net_buf *buf; + ARG_UNUSED(sink_ctx); ARG_UNUSED(valid_pdu); /* TODO copy valid pdu into netbuf ? */ - struct net_buf *buf = bt_buf_get_rx(BT_BUF_ISO_IN, K_FOREVER); + buf = bt_buf_get_rx(BT_BUF_ISO_IN, K_FOREVER); + LL_ASSERT_ERR(buf); - if (buf) { - /* Increase reserved space for headers */ - net_buf_reset(buf); - net_buf_reserve(buf, BT_BUF_RESERVE + SDU_HCI_HDR_SIZE); - - sdu_buffer->dbuf = buf; - sdu_buffer->size = net_buf_tailroom(buf); - } else { - LL_ASSERT(0); - } + /* Increase reserved space for headers */ + net_buf_reset(buf); + net_buf_reserve(buf, BT_BUF_RESERVE + SDU_HCI_HDR_SIZE); + + sdu_buffer->dbuf = buf; + sdu_buffer->size = net_buf_tailroom(buf); return ISOAL_STATUS_OK; } @@ -212,11 +211,13 @@ isoal_status_t sink_sdu_write_hci(void *dbuf, const uint8_t *pdu_payload, const size_t consume_len) { + struct net_buf *buf; + ARG_UNUSED(sdu_written); - struct net_buf *buf = (struct net_buf *) dbuf; + buf = (struct net_buf *) dbuf; + LL_ASSERT_ERR(buf); - LL_ASSERT(buf); net_buf_add_mem(buf, pdu_payload, consume_len); return ISOAL_STATUS_OK; @@ -364,7 +365,7 @@ static void prio_recv_thread(void *p1, void *p2, void *p3) LOG_DBG("Num Complete: 0x%04x:%u", handle, num_cmplt); err = bt_recv_prio(dev, buf); - LL_ASSERT(err == 0); + LL_ASSERT_DBG(err == 0); k_yield(); #endif /* CONFIG_BT_CONN || CONFIG_BT_CTLR_ADV_ISO */ @@ -392,7 +393,7 @@ static void prio_recv_thread(void *p1, void *p2, void *p3) } err = bt_recv_prio(dev, buf); - LL_ASSERT(err == 0); + LL_ASSERT_DBG(err == 0); /* bt_recv_prio would not release normal evt * buf. @@ -470,7 +471,7 @@ static void node_rx_recv(const struct device *dev) #if defined(CONFIG_BT_CONN) || defined(CONFIG_BT_CTLR_ADV_ISO) struct net_buf *buf; - LL_ASSERT(node_rx == NULL); + LL_ASSERT_DBG(node_rx == NULL); buf = bt_buf_get_evt(BT_HCI_EVT_NUM_COMPLETED_PACKETS, false, K_FOREVER); @@ -482,7 +483,7 @@ static void node_rx_recv(const struct device *dev) k_yield(); #else /* !CONFIG_BT_CONN && !CONFIG_BT_CTLR_ADV_ISO */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); #endif /* !CONFIG_BT_CONN && !CONFIG_BT_CTLR_ADV_ISO */ num_cmplt = ll_rx_get((void *)&node_rx, &handle); @@ -589,7 +590,7 @@ static inline struct net_buf *encode_node(struct node_rx_pdu *node_rx, isoal_rx_pdu_recombine(dp->sink_hdl, &pckt_meta); /* TODO handle err */ - LL_ASSERT(err == ISOAL_STATUS_OK); + LL_ASSERT_ERR(err == ISOAL_STATUS_OK); } } #endif /* CONFIG_BT_CTLR_CONN_ISO */ @@ -613,13 +614,13 @@ static inline struct net_buf *encode_node(struct node_rx_pdu *node_rx, isoal_rx.pdu = (void *)node_rx->pdu; err = isoal_rx_pdu_recombine(stream->dp->sink_hdl, &isoal_rx); - LL_ASSERT(err == ISOAL_STATUS_OK || - err == ISOAL_STATUS_ERR_SDU_ALLOC); + LL_ASSERT_ERR(err == ISOAL_STATUS_OK || + err == ISOAL_STATUS_ERR_SDU_ALLOC); } #endif /* CONFIG_BT_CTLR_SYNC_ISO */ } else { - LL_ASSERT(0); + LL_ASSERT_DBG(0); } node_rx->hdr.next = NULL; @@ -630,7 +631,7 @@ static inline struct net_buf *encode_node(struct node_rx_pdu *node_rx, #endif /* CONFIG_BT_CTLR_SYNC_ISO || CONFIG_BT_CTLR_CONN_ISO */ default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } @@ -668,7 +669,7 @@ static inline struct net_buf *process_node(struct node_rx_pdu *node_rx) } break; default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } } @@ -741,7 +742,7 @@ static inline struct net_buf *process_hbuf(struct node_rx_pdu *n) case HCI_CLASS_EVT_DISCARDABLE: case HCI_CLASS_EVT_REQUIRED: default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } @@ -823,7 +824,7 @@ static void recv_thread(void *p1, void *p2, void *p3) int err; err = k_poll(events, ARRAY_SIZE(events), K_FOREVER); - LL_ASSERT(err == 0 || err == -EINTR); + LL_ASSERT_ERR(err == 0 || err == -EINTR); if (false) { @@ -835,7 +836,7 @@ static void recv_thread(void *p1, void *p2, void *p3) #if !defined(CONFIG_BT_CTLR_RX_PRIO_STACK_SIZE) } else if (events[EVENT_SEM].state == K_POLL_STATE_SEM_AVAILABLE) { err = k_sem_take(events[EVENT_SEM].sem, K_NO_WAIT); - LL_ASSERT(err == 0); + LL_ASSERT_DBG(err == 0); node_rx_recv(dev); #endif /* !CONFIG_BT_CTLR_RX_PRIO_STACK_SIZE */ @@ -1047,7 +1048,7 @@ static int hci_driver_close(const struct device *dev) /* Resetting the LL stops all roles */ err = ll_deinit(); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); #if defined(CONFIG_BT_CTLR_RX_PRIO_STACK_SIZE) /* Abort prio RX thread */ diff --git a/subsys/bluetooth/controller/ll_sw/isoal.c b/subsys/bluetooth/controller/ll_sw/isoal.c index 625edbbb63d7..9d2db83668d3 100644 --- a/subsys/bluetooth/controller/ll_sw/isoal.c +++ b/subsys/bluetooth/controller/ll_sw/isoal.c @@ -151,8 +151,8 @@ static bool isoal_get_time_diff(uint32_t time_before, uint32_t time_after, uint3 { bool valid = false; - LL_ASSERT(time_before <= ISOAL_TIME_WRAPPING_POINT_US); - LL_ASSERT(time_after <= ISOAL_TIME_WRAPPING_POINT_US); + LL_ASSERT_DBG(time_before <= ISOAL_TIME_WRAPPING_POINT_US); + LL_ASSERT_DBG(time_after <= ISOAL_TIME_WRAPPING_POINT_US); if (time_before > time_after) { if (time_before >= ISOAL_TIME_MID_POINT_US && @@ -225,13 +225,13 @@ static void isoal_sink_deallocate(isoal_sink_handle_t hdl) if (hdl < ARRAY_SIZE(isoal_global.sink_allocated)) { isoal_global.sink_allocated[hdl] = ISOAL_ALLOC_STATE_FREE; } else { - LL_ASSERT(0); + LL_ASSERT_DBG(0); } if (hdl < ARRAY_SIZE(isoal_global.sink_state)) { (void)memset(&isoal_global.sink_state[hdl], 0, sizeof(struct isoal_sink)); } else { - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } @@ -350,7 +350,7 @@ isoal_status_t isoal_sink_create( session->sdu_sync_const = group_sync_delay; } } else { - LL_ASSERT(0); + LL_ASSERT_DBG(0); } /* Remember the platform-specific callbacks */ @@ -378,7 +378,7 @@ void isoal_sink_enable(isoal_sink_handle_t hdl) /* Atomically enable */ isoal_global.sink_state[hdl].sdu_production.mode = ISOAL_PRODUCTION_MODE_ENABLED; } else { - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } @@ -392,7 +392,7 @@ void isoal_sink_disable(isoal_sink_handle_t hdl) /* Atomically disable */ isoal_global.sink_state[hdl].sdu_production.mode = ISOAL_PRODUCTION_MODE_DISABLED; } else { - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } @@ -441,7 +441,7 @@ static isoal_status_t isoal_rx_allocate_sdu(struct isoal_sink *sink, /* Nothing has been written into buffer yet */ sp->sdu_written = 0; sp->sdu_available = sdu->contents.size; - LL_ASSERT(sdu->contents.size > 0); + LL_ASSERT_ERR(sdu->contents.size > 0); /* Get seq number from session counter */ sdu->sn = session->sn; @@ -568,7 +568,7 @@ static isoal_status_t isoal_rx_buffered_emit_sdu(struct isoal_sink *sink, bool e #endif /* ISOAL_BUFFER_RX_SDUS_ENABLE */ } else { /* Unreachable */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } return err; @@ -653,7 +653,6 @@ static isoal_status_t isoal_rx_append_to_sdu(struct isoal_sink *sink, handle_error_case = (is_end_fragment && (packet_available == 0)); pdu_payload = pdu_meta->pdu->payload + offset; - LL_ASSERT(pdu_payload); /* While there is something left of the packet to consume */ err = ISOAL_STATUS_OK; @@ -880,7 +879,7 @@ static isoal_status_t isoal_rx_unframed_consume(struct isoal_sink *sink, /* Unsupported case */ err = ISOAL_STATUS_ERR_UNSPECIFIED; LOG_ERR("Invalid unframed LLID (%d)", llid); - LL_ASSERT(0); + LL_ASSERT_ERR(0); } break; @@ -1459,7 +1458,8 @@ static void isoal_source_deallocate(isoal_source_handle_t hdl) if (hdl < ARRAY_SIZE(isoal_global.source_state)) { source = &isoal_global.source_state[hdl]; } else { - LL_ASSERT(0); + LL_ASSERT_DBG(0); + return; } @@ -1477,7 +1477,7 @@ static void isoal_source_deallocate(isoal_source_handle_t hdl) if (hdl < ARRAY_SIZE(isoal_global.source_allocated)) { isoal_global.source_allocated[hdl] = ISOAL_ALLOC_STATE_FREE; } else { - LL_ASSERT(0); + LL_ASSERT_DBG(0); } (void)memset(source, 0, sizeof(struct isoal_source)); @@ -1594,7 +1594,7 @@ void isoal_source_enable(isoal_source_handle_t hdl) /* Atomically enable */ isoal_global.source_state[hdl].pdu_production.mode = ISOAL_PRODUCTION_MODE_ENABLED; } else { - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } @@ -1608,7 +1608,7 @@ void isoal_source_disable(isoal_source_handle_t hdl) /* Atomically disable */ isoal_global.source_state[hdl].pdu_production.mode = ISOAL_PRODUCTION_MODE_DISABLED; } else { - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } @@ -1770,7 +1770,7 @@ static isoal_status_t isoal_tx_allocate_pdu(struct isoal_source *source, pp->pdu_written = 0; pp->pdu_available = available_len; pp->pdu_allocated = 1U; - LL_ASSERT(available_len > 0); + LL_ASSERT_ERR(available_len > 0); pp->pdu_cnt++; } @@ -1982,7 +1982,7 @@ static isoal_status_t isoal_tx_unframed_produce(isoal_source_handle_t source_hdl packet_available = tx_sdu->size; sdu_payload = tx_sdu->dbuf; - LL_ASSERT(sdu_payload); + LL_ASSERT_DBG(sdu_payload); zero_length_sdu = (packet_available == 0 && tx_sdu->sdu_state == BT_ISO_SINGLE); @@ -2468,12 +2468,12 @@ static uint16_t isoal_tx_framed_find_correct_tx_event(const struct isoal_source time_diff_valid = isoal_get_time_diff(time_stamp_selected, actual_grp_ref_point, &time_diff); - LL_ASSERT(time_diff_valid); - LL_ASSERT(time_diff > 0); + LL_ASSERT_DBG(time_diff_valid); + LL_ASSERT_DBG(time_diff > 0); /* Time difference must be less than the maximum possible * time-offset of 24-bits. */ - LL_ASSERT(time_diff <= 0x00FFFFFF); + LL_ASSERT_DBG(time_diff <= 0x00FFFFFF); } *payload_number = next_payload_number; @@ -2514,7 +2514,7 @@ static isoal_status_t isoal_tx_framed_produce(isoal_source_handle_t source_hdl, packet_available = tx_sdu->size; sdu_payload = tx_sdu->dbuf; - LL_ASSERT(sdu_payload); + LL_ASSERT_DBG(sdu_payload); zero_length_sdu = (packet_available == 0 && tx_sdu->sdu_state == BT_ISO_SINGLE); @@ -2791,7 +2791,7 @@ static isoal_status_t isoal_tx_framed_event_prepare_handle(isoal_source_handle_t } /* Not possible to recover if allocation or emit fails here*/ - LL_ASSERT(!(err || err_alloc)); + LL_ASSERT_ERR(!(err || err_alloc)); if (pp->payload_number < last_event_payload + 1ULL) { pp->payload_number = last_event_payload + 1ULL; diff --git a/subsys/bluetooth/controller/ll_sw/lll_chan.c b/subsys/bluetooth/controller/ll_sw/lll_chan.c index 213fce38a8f5..e45134144b64 100644 --- a/subsys/bluetooth/controller/ll_sw/lll_chan.c +++ b/subsys/bluetooth/controller/ll_sw/lll_chan.c @@ -349,39 +349,39 @@ void lll_chan_sel_2_ut(void) /* Tests when ISO not supported */ /* Section 3.1 Sample Data 1 (37 used channels) */ m = lll_chan_sel_2(0U, chan_id, chan_map_1, chan_map_1_37_used); - LL_ASSERT(m == 25U); + LL_ASSERT_ERR(m == 25U); m = lll_chan_sel_2(1U, chan_id, chan_map_1, chan_map_1_37_used); - LL_ASSERT(m == 20U); + LL_ASSERT_ERR(m == 20U); m = lll_chan_sel_2(2U, chan_id, chan_map_1, chan_map_1_37_used); - LL_ASSERT(m == 6U); + LL_ASSERT_ERR(m == 6U); m = lll_chan_sel_2(3U, chan_id, chan_map_1, chan_map_1_37_used); - LL_ASSERT(m == 21U); + LL_ASSERT_ERR(m == 21U); /* Section 3.2 Sample Data 2 (9 used channels) */ m = lll_chan_sel_2(6U, chan_id, chan_map_2, chan_map_2_9_used); - LL_ASSERT(m == 23U); + LL_ASSERT_ERR(m == 23U); m = lll_chan_sel_2(7U, chan_id, chan_map_2, chan_map_2_9_used); - LL_ASSERT(m == 9U); + LL_ASSERT_ERR(m == 9U); m = lll_chan_sel_2(8U, chan_id, chan_map_2, chan_map_2_9_used); - LL_ASSERT(m == 34U); + LL_ASSERT_ERR(m == 34U); /* FIXME: Use Sample Data from Spec, if one is added. * Below is a random sample to cover implementation in this file. */ /* Section x.x Sample Data 3 (2 used channels) */ m = lll_chan_sel_2(11U, chan_id, chan_map_3, chan_map_3_2_used); - LL_ASSERT(m == 1U); + LL_ASSERT_ERR(m == 1U); m = lll_chan_sel_2(12U, chan_id, chan_map_3, chan_map_3_2_used); - LL_ASSERT(m == 2U); + LL_ASSERT_ERR(m == 2U); m = lll_chan_sel_2(13U, chan_id, chan_map_3, chan_map_3_2_used); - LL_ASSERT(m == 1U); + LL_ASSERT_ERR(m == 1U); #if defined(CONFIG_BT_CTLR_ISO) uint16_t prn_subevent_lu; @@ -393,164 +393,164 @@ void lll_chan_sel_2_ut(void) prn_s = 56857U ^ chan_id; prn_subevent_lu = prn_s; prn_subevent_se = chan_prn_subevent_se(chan_id, &prn_subevent_lu); - LL_ASSERT(prn_subevent_se == 11710U); + LL_ASSERT_ERR(prn_subevent_se == 11710U); /* BIS subevent 3, event counter 0 */ prn_subevent_se = chan_prn_subevent_se(chan_id, &prn_subevent_lu); - LL_ASSERT(prn_subevent_se == 16649U); + LL_ASSERT_ERR(prn_subevent_se == 16649U); /* BIS subevent 4, event counter 0 */ prn_subevent_se = chan_prn_subevent_se(chan_id, &prn_subevent_lu); - LL_ASSERT(prn_subevent_se == 38198U); + LL_ASSERT_ERR(prn_subevent_se == 38198U); /* Section 3.1 Sample Data 1 (37 used channels) */ /* BIS subevent 1, event counter 0 */ m = lll_chan_iso_event(0U, chan_id, chan_map_1, chan_map_1_37_used, &prn_s, &remap_idx); - LL_ASSERT((prn_s ^ chan_id) == 56857U); - LL_ASSERT(m == 25U); - LL_ASSERT(remap_idx == 25U); + LL_ASSERT_ERR((prn_s ^ chan_id) == 56857U); + LL_ASSERT_ERR(m == 25U); + LL_ASSERT_ERR(remap_idx == 25U); /* BIS subvent 2 */ m = lll_chan_iso_subevent(chan_id, chan_map_1, chan_map_1_37_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 1U); - LL_ASSERT(m == 1U); + LL_ASSERT_ERR(remap_idx == 1U); + LL_ASSERT_ERR(m == 1U); /* BIS subvent 3 */ m = lll_chan_iso_subevent(chan_id, chan_map_1, chan_map_1_37_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 16U); - LL_ASSERT(m == 16U); + LL_ASSERT_ERR(remap_idx == 16U); + LL_ASSERT_ERR(m == 16U); /* BIS subvent 4 */ m = lll_chan_iso_subevent(chan_id, chan_map_1, chan_map_1_37_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 36U); - LL_ASSERT(m == 36U); + LL_ASSERT_ERR(remap_idx == 36U); + LL_ASSERT_ERR(m == 36U); /* BIS subevent 1, event counter 1 */ m = lll_chan_iso_event(1U, chan_id, chan_map_1, chan_map_1_37_used, &prn_s, &remap_idx); - LL_ASSERT((prn_s ^ chan_id) == 1685U); - LL_ASSERT(m == 20U); - LL_ASSERT(remap_idx == 20U); + LL_ASSERT_ERR((prn_s ^ chan_id) == 1685U); + LL_ASSERT_ERR(m == 20U); + LL_ASSERT_ERR(remap_idx == 20U); /* BIS subvent 2 */ m = lll_chan_iso_subevent(chan_id, chan_map_1, chan_map_1_37_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 36U); - LL_ASSERT(m == 36U); + LL_ASSERT_ERR(remap_idx == 36U); + LL_ASSERT_ERR(m == 36U); /* BIS subvent 3 */ m = lll_chan_iso_subevent(chan_id, chan_map_1, chan_map_1_37_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 12U); - LL_ASSERT(m == 12U); + LL_ASSERT_ERR(remap_idx == 12U); + LL_ASSERT_ERR(m == 12U); /* BIS subvent 4 */ m = lll_chan_iso_subevent(chan_id, chan_map_1, chan_map_1_37_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 34U); - LL_ASSERT(m == 34U); + LL_ASSERT_ERR(remap_idx == 34U); + LL_ASSERT_ERR(m == 34U); /* BIS subevent 1, event counter 2 */ m = lll_chan_iso_event(2U, chan_id, chan_map_1, chan_map_1_37_used, &prn_s, &remap_idx); - LL_ASSERT((prn_s ^ chan_id) == 38301U); - LL_ASSERT(m == 6U); - LL_ASSERT(remap_idx == 6U); + LL_ASSERT_ERR((prn_s ^ chan_id) == 38301U); + LL_ASSERT_ERR(m == 6U); + LL_ASSERT_ERR(remap_idx == 6U); /* BIS subvent 2 */ m = lll_chan_iso_subevent(chan_id, chan_map_1, chan_map_1_37_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 18U); - LL_ASSERT(m == 18U); + LL_ASSERT_ERR(remap_idx == 18U); + LL_ASSERT_ERR(m == 18U); /* BIS subvent 3 */ m = lll_chan_iso_subevent(chan_id, chan_map_1, chan_map_1_37_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 32U); - LL_ASSERT(m == 32U); + LL_ASSERT_ERR(remap_idx == 32U); + LL_ASSERT_ERR(m == 32U); /* BIS subvent 4 */ m = lll_chan_iso_subevent(chan_id, chan_map_1, chan_map_1_37_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 21U); - LL_ASSERT(m == 21U); + LL_ASSERT_ERR(remap_idx == 21U); + LL_ASSERT_ERR(m == 21U); /* BIS subevent 1, event counter 3 */ m = lll_chan_iso_event(3U, chan_id, chan_map_1, chan_map_1_37_used, &prn_s, &remap_idx); - LL_ASSERT((prn_s ^ chan_id) == 27475U); - LL_ASSERT(m == 21U); - LL_ASSERT(remap_idx == 21U); + LL_ASSERT_ERR((prn_s ^ chan_id) == 27475U); + LL_ASSERT_ERR(m == 21U); + LL_ASSERT_ERR(remap_idx == 21U); /* BIS subvent 2 */ m = lll_chan_iso_subevent(chan_id, chan_map_1, chan_map_1_37_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 4U); - LL_ASSERT(m == 4U); + LL_ASSERT_ERR(remap_idx == 4U); + LL_ASSERT_ERR(m == 4U); /* BIS subvent 3 */ m = lll_chan_iso_subevent(chan_id, chan_map_1, chan_map_1_37_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 22U); - LL_ASSERT(m == 22U); + LL_ASSERT_ERR(remap_idx == 22U); + LL_ASSERT_ERR(m == 22U); /* BIS subvent 4 */ m = lll_chan_iso_subevent(chan_id, chan_map_1, chan_map_1_37_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 8U); - LL_ASSERT(m == 8U); + LL_ASSERT_ERR(remap_idx == 8U); + LL_ASSERT_ERR(m == 8U); /* Section 3.2 Sample Data 2 (9 used channels) */ /* BIS subevent 1, event counter 6 */ m = lll_chan_iso_event(6U, chan_id, chan_map_2, chan_map_2_9_used, &prn_s, &remap_idx); - LL_ASSERT((prn_s ^ chan_id) == 10975U); - LL_ASSERT(remap_idx == 4U); - LL_ASSERT(m == 23U); + LL_ASSERT_ERR((prn_s ^ chan_id) == 10975U); + LL_ASSERT_ERR(remap_idx == 4U); + LL_ASSERT_ERR(m == 23U); /* BIS subvent 2 */ m = lll_chan_iso_subevent(chan_id, chan_map_2, chan_map_2_9_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 7U); - LL_ASSERT(m == 35U); + LL_ASSERT_ERR(remap_idx == 7U); + LL_ASSERT_ERR(m == 35U); /* BIS subvent 3 */ m = lll_chan_iso_subevent(chan_id, chan_map_2, chan_map_2_9_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 2U); - LL_ASSERT(m == 21U); + LL_ASSERT_ERR(remap_idx == 2U); + LL_ASSERT_ERR(m == 21U); /* BIS subvent 4 */ m = lll_chan_iso_subevent(chan_id, chan_map_2, chan_map_2_9_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 8U); - LL_ASSERT(m == 36U); + LL_ASSERT_ERR(remap_idx == 8U); + LL_ASSERT_ERR(m == 36U); /* BIS subevent 1, event counter 7 */ m = lll_chan_iso_event(7U, chan_id, chan_map_2, chan_map_2_9_used, &prn_s, &remap_idx); - LL_ASSERT((prn_s ^ chan_id) == 5490U); - LL_ASSERT(remap_idx == 0U); - LL_ASSERT(m == 9U); + LL_ASSERT_ERR((prn_s ^ chan_id) == 5490U); + LL_ASSERT_ERR(remap_idx == 0U); + LL_ASSERT_ERR(m == 9U); /* BIS subvent 2 */ m = lll_chan_iso_subevent(chan_id, chan_map_2, chan_map_2_9_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 3U); - LL_ASSERT(m == 22U); + LL_ASSERT_ERR(remap_idx == 3U); + LL_ASSERT_ERR(m == 22U); /* BIS subvent 3 */ m = lll_chan_iso_subevent(chan_id, chan_map_2, chan_map_2_9_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 8U); - LL_ASSERT(m == 36U); + LL_ASSERT_ERR(remap_idx == 8U); + LL_ASSERT_ERR(m == 36U); /* BIS subvent 4 */ m = lll_chan_iso_subevent(chan_id, chan_map_2, chan_map_2_9_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 5U); - LL_ASSERT(m == 33U); + LL_ASSERT_ERR(remap_idx == 5U); + LL_ASSERT_ERR(m == 33U); /* BIS subevent 1, event counter 8 */ m = lll_chan_iso_event(8U, chan_id, chan_map_2, chan_map_2_9_used, &prn_s, &remap_idx); - LL_ASSERT((prn_s ^ chan_id) == 46970U); - LL_ASSERT(remap_idx == 6U); - LL_ASSERT(m == 34U); + LL_ASSERT_ERR((prn_s ^ chan_id) == 46970U); + LL_ASSERT_ERR(remap_idx == 6U); + LL_ASSERT_ERR(m == 34U); /* BIS subvent 2 */ m = lll_chan_iso_subevent(chan_id, chan_map_2, chan_map_2_9_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 0U); - LL_ASSERT(m == 9U); + LL_ASSERT_ERR(remap_idx == 0U); + LL_ASSERT_ERR(m == 9U); /* BIS subvent 3 */ m = lll_chan_iso_subevent(chan_id, chan_map_2, chan_map_2_9_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 5U); - LL_ASSERT(m == 33U); + LL_ASSERT_ERR(remap_idx == 5U); + LL_ASSERT_ERR(m == 33U); /* BIS subvent 4 */ m = lll_chan_iso_subevent(chan_id, chan_map_2, chan_map_2_9_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 1U); - LL_ASSERT(m == 10U); + LL_ASSERT_ERR(remap_idx == 1U); + LL_ASSERT_ERR(m == 10U); /* FIXME: Use Sample Data from Spec, if one is added. * Below is a random sample to cover implementation in this file. @@ -558,66 +558,66 @@ void lll_chan_sel_2_ut(void) /* Section x.x Sample Data 3 (2 used channels) */ /* BIS subevent 1, event counter 11 */ m = lll_chan_iso_event(11U, chan_id, chan_map_3, chan_map_3_2_used, &prn_s, &remap_idx); - LL_ASSERT((prn_s ^ chan_id) == 8628U); - LL_ASSERT(remap_idx == 0U); - LL_ASSERT(m == 1U); + LL_ASSERT_ERR((prn_s ^ chan_id) == 8628U); + LL_ASSERT_ERR(remap_idx == 0U); + LL_ASSERT_ERR(m == 1U); /* BIS subvent 2 */ m = lll_chan_iso_subevent(chan_id, chan_map_3, chan_map_3_2_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 1U); - LL_ASSERT(m == 2U); + LL_ASSERT_ERR(remap_idx == 1U); + LL_ASSERT_ERR(m == 2U); /* BIS subvent 3 */ m = lll_chan_iso_subevent(chan_id, chan_map_3, chan_map_3_2_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 0U); - LL_ASSERT(m == 1U); + LL_ASSERT_ERR(remap_idx == 0U); + LL_ASSERT_ERR(m == 1U); /* BIS subvent 4 */ m = lll_chan_iso_subevent(chan_id, chan_map_3, chan_map_3_2_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 1U); - LL_ASSERT(m == 2U); + LL_ASSERT_ERR(remap_idx == 1U); + LL_ASSERT_ERR(m == 2U); /* BIS subevent 1, event counter 12 */ m = lll_chan_iso_event(12U, chan_id, chan_map_3, chan_map_3_2_used, &prn_s, &remap_idx); - LL_ASSERT((prn_s ^ chan_id) == 34748U); - LL_ASSERT(remap_idx == 1U); - LL_ASSERT(m == 2U); + LL_ASSERT_ERR((prn_s ^ chan_id) == 34748U); + LL_ASSERT_ERR(remap_idx == 1U); + LL_ASSERT_ERR(m == 2U); /* BIS subvent 2 */ m = lll_chan_iso_subevent(chan_id, chan_map_3, chan_map_3_2_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 0U); - LL_ASSERT(m == 1U); + LL_ASSERT_ERR(remap_idx == 0U); + LL_ASSERT_ERR(m == 1U); /* BIS subvent 3 */ m = lll_chan_iso_subevent(chan_id, chan_map_3, chan_map_3_2_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 1U); - LL_ASSERT(m == 2U); + LL_ASSERT_ERR(remap_idx == 1U); + LL_ASSERT_ERR(m == 2U); /* BIS subvent 4 */ m = lll_chan_iso_subevent(chan_id, chan_map_3, chan_map_3_2_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 0U); - LL_ASSERT(m == 1U); + LL_ASSERT_ERR(remap_idx == 0U); + LL_ASSERT_ERR(m == 1U); /* BIS subevent 1, event counter 13 */ m = lll_chan_iso_event(13U, chan_id, chan_map_3, chan_map_3_2_used, &prn_s, &remap_idx); - LL_ASSERT((prn_s ^ chan_id) == 22072U); - LL_ASSERT(remap_idx == 0U); - LL_ASSERT(m == 1U); + LL_ASSERT_ERR((prn_s ^ chan_id) == 22072U); + LL_ASSERT_ERR(remap_idx == 0U); + LL_ASSERT_ERR(m == 1U); /* BIS subvent 2 */ m = lll_chan_iso_subevent(chan_id, chan_map_3, chan_map_3_2_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 1U); - LL_ASSERT(m == 2U); + LL_ASSERT_ERR(remap_idx == 1U); + LL_ASSERT_ERR(m == 2U); /* BIS subvent 3 */ m = lll_chan_iso_subevent(chan_id, chan_map_3, chan_map_3_2_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 0U); - LL_ASSERT(m == 1U); + LL_ASSERT_ERR(remap_idx == 0U); + LL_ASSERT_ERR(m == 1U); /* BIS subvent 4 */ m = lll_chan_iso_subevent(chan_id, chan_map_3, chan_map_3_2_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 1U); - LL_ASSERT(m == 2U); + LL_ASSERT_ERR(remap_idx == 1U); + LL_ASSERT_ERR(m == 2U); #endif /* CONFIG_BT_CTLR_ISO */ } diff --git a/subsys/bluetooth/controller/ll_sw/lll_common.c b/subsys/bluetooth/controller/ll_sw/lll_common.c index c6c561dbb76d..96861aa72010 100644 --- a/subsys/bluetooth/controller/ll_sw/lll_common.c +++ b/subsys/bluetooth/controller/ll_sw/lll_common.c @@ -77,7 +77,7 @@ void lll_resume(void *param) next = param; err = lll_prepare_resolve(next->is_abort_cb, next->abort_cb, next->prepare_cb, &next->prepare_param, next->is_resume, 1U); - LL_ASSERT(!err || err == -EINPROGRESS); + LL_ASSERT_ERR(!err || err == -EINPROGRESS); } #if defined(CONFIG_BT_CTLR_JIT_SCHEDULING) diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/cntr.c b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/cntr.c index eb1116c987f7..ba6487b53534 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/cntr.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/cntr.c @@ -110,7 +110,7 @@ uint32_t cntr_start(void) uint32_t cntr_stop(void) { - LL_ASSERT(_refcount); + LL_ASSERT_ERR(_refcount); if (--_refcount) { return 1; diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/ecb.c b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/ecb.c index 2398bdc44fd7..38b70c491d7d 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/ecb.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/ecb.c @@ -225,7 +225,7 @@ static void isr_ecb(const void *arg) } else { - LL_ASSERT(false); + LL_ASSERT_DBG(false); } } diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/mayfly.c b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/mayfly.c index 531cbd5b2412..73408b234544 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/mayfly.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/mayfly.c @@ -42,7 +42,7 @@ void mayfly_enable_cb(uint8_t caller_id, uint8_t callee_id, uint8_t enable) break; default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } } @@ -62,7 +62,7 @@ uint32_t mayfly_is_enabled(uint8_t caller_id, uint8_t callee_id) return irq_is_enabled(HAL_SWI_JOB_IRQ); default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } @@ -120,7 +120,7 @@ void mayfly_pend(uint8_t caller_id, uint8_t callee_id) break; default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } } diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/ticker.c b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/ticker.c index 9ebafae2e9c4..e46ba7f6f62f 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/ticker.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/ticker.c @@ -38,10 +38,10 @@ uint8_t hal_ticker_instance0_caller_id_get(uint8_t user_id) { uint8_t caller_id; - LL_ASSERT(user_id < sizeof(caller_id_lut)); + LL_ASSERT_DBG(user_id < sizeof(caller_id_lut)); caller_id = caller_id_lut[user_id]; - LL_ASSERT(caller_id != TICKER_CALL_ID_NONE); + LL_ASSERT_DBG(caller_id != TICKER_CALL_ID_NONE); return caller_id; } @@ -73,7 +73,7 @@ void hal_ticker_instance0_sched(uint8_t caller_id, uint8_t callee_id, uint8_t ch break; default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } break; @@ -96,7 +96,7 @@ void hal_ticker_instance0_sched(uint8_t caller_id, uint8_t callee_id, uint8_t ch break; default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } break; @@ -119,7 +119,7 @@ void hal_ticker_instance0_sched(uint8_t caller_id, uint8_t callee_id, uint8_t ch break; default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } break; @@ -157,7 +157,7 @@ void hal_ticker_instance0_sched(uint8_t caller_id, uint8_t callee_id, uint8_t ch break; default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } break; @@ -181,13 +181,13 @@ void hal_ticker_instance0_sched(uint8_t caller_id, uint8_t callee_id, uint8_t ch break; default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } break; default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } } diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c index cada046f049b..557e4745b032 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c @@ -461,7 +461,7 @@ void lll_disable(void *param) if (event.curr.abort_cb && event.curr.param) { event.curr.abort_cb(NULL, event.curr.param); } else { - LL_ASSERT(!param); + LL_ASSERT_ERR(!param); } } { @@ -519,12 +519,12 @@ int lll_done(void *param) /* Assert if param supplied without a pending prepare to cancel. */ next = ull_prepare_dequeue_get(); - LL_ASSERT(!param || next); + LL_ASSERT_ERR(!param || next); /* check if current LLL event is done */ if (!param) { /* Reset current event instance */ - LL_ASSERT(event.curr.abort_cb); + LL_ASSERT_ERR(event.curr.abort_cb); event.curr.abort_cb = NULL; param = event.curr.param; @@ -567,7 +567,7 @@ int lll_done(void *param) lll_done_score(param, result); extra = ull_event_done_extra_get(); - LL_ASSERT(extra); + LL_ASSERT_ERR(extra); /* Set result in done extra data - type was set by the role */ extra->result = result; @@ -575,7 +575,7 @@ int lll_done(void *param) /* Let ULL know about LLL event done */ evdone = ull_event_done(ull); - LL_ASSERT(evdone); + LL_ASSERT_ERR(evdone); return 0; } @@ -583,7 +583,7 @@ int lll_done(void *param) #if defined(CONFIG_BT_CTLR_LOW_LAT_ULL_DONE) void lll_done_ull_inc(void) { - LL_ASSERT(event.done.ull_count != event.done.lll_count); + LL_ASSERT_ERR(event.done.ull_count != event.done.lll_count); event.done.ull_count++; } #endif /* CONFIG_BT_CTLR_LOW_LAT_ULL_DONE */ @@ -623,7 +623,7 @@ void lll_abort_cb(struct lll_prepare_param *prepare_param, void *param) * currently in preparation pipeline. */ err = lll_hfclock_off(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); lll_done(param); } @@ -681,7 +681,7 @@ void lll_chan_set(uint32_t chan) } else if (chan < 40) { radio_freq_chan_set(28 + ((chan - 11) * 2U)); } else { - LL_ASSERT(0); + LL_ASSERT_DBG(0); } break; } @@ -805,7 +805,7 @@ void lll_isr_cleanup(void *param) radio_stop(); err = lll_hfclock_off(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); lll_done(NULL); } @@ -822,7 +822,7 @@ void lll_isr_early_abort(void *param) } err = lll_hfclock_off(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); lll_done(NULL); } @@ -900,7 +900,7 @@ int lll_prepare_resolve(lll_is_abort_cb_t is_abort_cb, lll_abort_cb_t abort_cb, /* Store the next prepare for deferred call */ next = ull_prepare_enqueue(is_abort_cb, abort_cb, prepare_param, prepare_cb, is_resume); - LL_ASSERT(next); + LL_ASSERT_ERR(next); #if !defined(CONFIG_BT_CTLR_LOW_LAT) if (is_resume || prepare_param->defer) { @@ -918,8 +918,8 @@ int lll_prepare_resolve(lll_is_abort_cb_t is_abort_cb, lll_abort_cb_t abort_cb, /* Start the preempt timeout */ ret = preempt_ticker_start(first, ready, next); - LL_ASSERT((ret == TICKER_STATUS_SUCCESS) || - (ret == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ret == TICKER_STATUS_SUCCESS) || + (ret == TICKER_STATUS_BUSY)); #else /* CONFIG_BT_CTLR_LOW_LAT */ next = NULL; @@ -941,7 +941,7 @@ int lll_prepare_resolve(lll_is_abort_cb_t is_abort_cb, lll_abort_cb_t abort_cb, /* check if resume requested by curr */ err = event.curr.is_abort_cb(NULL, event.curr.param, &resume_cb); - LL_ASSERT(err); + LL_ASSERT_DBG(err); if (err == -EAGAIN) { void *curr_param; @@ -954,9 +954,9 @@ int lll_prepare_resolve(lll_is_abort_cb_t is_abort_cb, lll_abort_cb_t abort_cb, next = resume_enqueue(event.curr.is_abort_cb, event.curr.abort_cb, resume_cb, curr_param); - LL_ASSERT(next); + LL_ASSERT_ERR(next); } else { - LL_ASSERT(err == -ECANCELED); + LL_ASSERT_ERR(err == -ECANCELED); } } #endif /* CONFIG_BT_CTLR_LOW_LAT */ @@ -964,7 +964,7 @@ int lll_prepare_resolve(lll_is_abort_cb_t is_abort_cb, lll_abort_cb_t abort_cb, return -EINPROGRESS; } - LL_ASSERT(!ready || &ready->prepare_param == prepare_param); + LL_ASSERT_ERR(!ready || &ready->prepare_param == prepare_param); event.curr.param = prepare_param->param; event.curr.is_abort_cb = is_abort_cb; @@ -996,8 +996,8 @@ int lll_prepare_resolve(lll_is_abort_cb_t is_abort_cb, lll_abort_cb_t abort_cb, /* Start the preempt timeout */ ret = preempt_ticker_start(next, NULL, next); - LL_ASSERT((ret == TICKER_STATUS_SUCCESS) || - (ret == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ret == TICKER_STATUS_SUCCESS) || + (ret == TICKER_STATUS_BUSY)); #endif /* !CONFIG_BT_CTLR_LOW_LAT */ return err; @@ -1012,7 +1012,7 @@ static int init_reset(void) static inline void done_inc(void) { event.done.lll_count++; - LL_ASSERT(event.done.lll_count != event.done.ull_count); + LL_ASSERT_ERR(event.done.lll_count != event.done.ull_count); } #endif /* CONFIG_BT_CTLR_LOW_LAT_ULL_DONE */ @@ -1066,7 +1066,7 @@ static void ticker_stop_op_cb(uint32_t status, void *param) { ARG_UNUSED(param); - LL_ASSERT(preempt_stop_req != preempt_stop_ack); + LL_ASSERT_ERR(preempt_stop_req != preempt_stop_ack); preempt_stop_ack = preempt_stop_req; /* We do not fail on status not being success because under scenarios @@ -1077,7 +1077,7 @@ static void ticker_stop_op_cb(uint32_t status, void *param) * safe to reset preempt_req and preempt_ack here. */ if (status == TICKER_STATUS_SUCCESS) { - LL_ASSERT(preempt_req != preempt_ack); + LL_ASSERT_ERR(preempt_req != preempt_ack); } preempt_req = preempt_ack; @@ -1086,18 +1086,18 @@ static void ticker_stop_op_cb(uint32_t status, void *param) static void ticker_start_op_cb(uint32_t status, void *param) { ARG_UNUSED(param); - LL_ASSERT(status == TICKER_STATUS_SUCCESS); + LL_ASSERT_ERR(status == TICKER_STATUS_SUCCESS); /* Increase preempt requested count before acknowledging that the * ticker start operation for the preempt timeout has been handled. */ - LL_ASSERT(preempt_req == preempt_ack); + LL_ASSERT_ERR(preempt_req == preempt_ack); preempt_req++; /* Increase preempt start ack count, to acknowledge that the ticker * start operation has been handled. */ - LL_ASSERT(preempt_start_req != preempt_start_ack); + LL_ASSERT_ERR(preempt_start_req != preempt_start_ack); preempt_start_ack = preempt_start_req; } @@ -1141,8 +1141,8 @@ static uint32_t preempt_ticker_start(struct lll_event *first, /* Stop any scheduled preempt ticker */ ret = preempt_ticker_stop(); - LL_ASSERT((ret == TICKER_STATUS_SUCCESS) || - (ret == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ret == TICKER_STATUS_SUCCESS) || + (ret == TICKER_STATUS_BUSY)); /* Schedule short preempt timeout */ first = next; @@ -1196,8 +1196,8 @@ static uint32_t preempt_ticker_stop(void) TICKER_USER_ID_LLL, TICKER_ID_LLL_PREEMPT, ticker_stop_op_cb, NULL); - LL_ASSERT((ret == TICKER_STATUS_SUCCESS) || - (ret == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ret == TICKER_STATUS_SUCCESS) || + (ret == TICKER_STATUS_BUSY)); return ret; } @@ -1210,13 +1210,13 @@ static void preempt_ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, static struct mayfly mfy = {0, 0, &link, NULL, preempt}; uint32_t ret; - LL_ASSERT(preempt_ack != preempt_req); + LL_ASSERT_ERR(preempt_ack != preempt_req); preempt_ack = preempt_req; mfy.param = param; ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } static void preempt(void *param) @@ -1287,8 +1287,8 @@ static void preempt(void *param) /* Start the preempt timeout for (short) ready event */ ret = preempt_ticker_start(ready, NULL, ready); - LL_ASSERT((ret == TICKER_STATUS_SUCCESS) || - (ret == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ret == TICKER_STATUS_SUCCESS) || + (ret == TICKER_STATUS_BUSY)); return; } @@ -1322,7 +1322,7 @@ static void preempt(void *param) return; } - LL_ASSERT(ready->prepare_param.param == param); + LL_ASSERT_ERR(ready->prepare_param.param == param); } /* Check if current event want to continue */ @@ -1345,8 +1345,8 @@ static void preempt(void *param) /* Start the preempt timeout for next ready prepare */ ret = preempt_ticker_start(ready, NULL, ready); - LL_ASSERT((ret == TICKER_STATUS_SUCCESS) || - (ret == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ret == TICKER_STATUS_SUCCESS) || + (ret == TICKER_STATUS_BUSY)); } else { /* Let preemptor LLL know about the cancelled prepare */ @@ -1416,9 +1416,9 @@ static void preempt(void *param) /* Enqueue as resume event */ iter = resume_enqueue(is_abort_cb, abort_cb, resume_cb, curr_param); - LL_ASSERT(iter); + LL_ASSERT_ERR(iter); } else { - LL_ASSERT(err == -ECANCELED); + LL_ASSERT_ERR(err == -ECANCELED); } } #else /* CONFIG_BT_CTLR_LOW_LAT */ @@ -1432,8 +1432,8 @@ static void mfy_ticker_job_idle_get(void *param) ret = ticker_job_idle_get(TICKER_INSTANCE_ID_CTLR, TICKER_USER_ID_ULL_LOW, ticker_op_job_disable, NULL); - LL_ASSERT((ret == TICKER_STATUS_SUCCESS) || - (ret == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ret == TICKER_STATUS_SUCCESS) || + (ret == TICKER_STATUS_BUSY)); } static void ticker_op_job_disable(uint32_t status, void *op_context) diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv.c index 5d1d89712619..8c7837bf9805 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv.c @@ -435,12 +435,12 @@ struct pdu_adv *lll_adv_pdu_alloc_pdu_adv(void) } err = k_sem_take(&sem_pdu_free, PDU_FREE_TIMEOUT); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); k_sem_reset(&sem_pdu_free); p = MFIFO_DEQUEUE(pdu_free); - LL_ASSERT(p); + LL_ASSERT_ERR(p); #if defined(CONFIG_BT_CTLR_ADV_PDU_LINK) PDU_ADV_NEXT_PTR(p) = NULL; @@ -681,10 +681,10 @@ void lll_adv_prepare(void *param) int err; err = lll_hfclock_on(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); err = lll_prepare(is_abort_cb, abort_cb, prepare_cb, 0, param); - LL_ASSERT(!err || err == -EINPROGRESS); + LL_ASSERT_ERR(!err || err == -EINPROGRESS); } bool lll_adv_scan_req_check(struct lll_adv *lll, struct pdu_adv *sr, @@ -836,7 +836,7 @@ static void *adv_extra_data_allocate(struct lll_adv_pdu *pdu, uint8_t last) extra_data = MFIFO_DEQUEUE_PEEK(extra_data_free); if (extra_data) { err = k_sem_take(&sem_extra_data_free, K_NO_WAIT); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); MFIFO_DEQUEUE(extra_data_free); pdu->extra_data[last] = extra_data; @@ -852,10 +852,10 @@ static void *adv_extra_data_allocate(struct lll_adv_pdu *pdu, uint8_t last) } err = k_sem_take(&sem_extra_data_free, PDU_FREE_TIMEOUT); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); extra_data = MFIFO_DEQUEUE(extra_data_free); - LL_ASSERT(extra_data); + LL_ASSERT_ERR(extra_data); pdu->extra_data[last] = (void *)extra_data; @@ -913,7 +913,7 @@ static void extra_data_free_sem_give(void) retval = mayfly_enqueue(TICKER_USER_ID_LLL, TICKER_USER_ID_ULL_HIGH, 0, &mfy); - LL_ASSERT(!retval); + LL_ASSERT_ERR(!retval); } #else /* !CONFIG_BT_CTLR_ZLI */ @@ -1062,7 +1062,7 @@ static int prepare_cb(struct lll_prepare_param *p) #endif ret = lll_prepare_done(lll); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); DEBUG_RADIO_START_A(1); @@ -1102,7 +1102,7 @@ static int is_abort_cb(void *next, void *curr, lll_prepare_cb_t *resume_cb) /* Retain HF clk */ err = lll_hfclock_on(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); return -EAGAIN; #endif /* CONFIG_BT_PERIPHERAL */ @@ -1140,7 +1140,7 @@ static void abort_cb(struct lll_prepare_param *prepare_param, void *param) * currently in preparation pipeline. */ err = lll_hfclock_off(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); lll_done(param); } @@ -1178,7 +1178,7 @@ static void isr_tx(void *param) /* setup Rx buffer */ node_rx = ull_pdu_rx_alloc_peek(1); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); radio_pkt_rx_set(node_rx->pdu); /* assert if radio packet ptr is not set and radio started rx */ @@ -1186,7 +1186,7 @@ static void isr_tx(void *param) LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, lll_prof_latency_get()); } else { - LL_ASSERT(!radio_is_ready()); + LL_ASSERT_ERR(!radio_is_ready()); } if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { @@ -1426,7 +1426,7 @@ static void isr_done(void *param) struct event_done_extra *extra; extra = ull_done_extra_type_set(EVENT_DONE_EXTRA_TYPE_ADV); - LL_ASSERT(extra); + LL_ASSERT_ERR(extra); } #endif /* CONFIG_BT_CTLR_ADV_EXT || CONFIG_BT_CTLR_JIT_SCHEDULING */ @@ -1464,7 +1464,7 @@ static void isr_abort_all(void *param) /* Abort any LLL prepare/resume enqueued in pipeline */ mfy.param = param; ret = mayfly_enqueue(TICKER_USER_ID_LLL, TICKER_USER_ID_LLL, 1U, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } #endif /* CONFIG_BT_PERIPHERAL */ @@ -1475,7 +1475,7 @@ static struct pdu_adv *chan_prepare(struct lll_adv *lll) uint8_t upd; chan = find_lsb_set(lll->chan_map_curr); - LL_ASSERT(chan); + LL_ASSERT_DBG(chan); lll->chan_map_curr &= (lll->chan_map_curr - 1); @@ -1484,7 +1484,7 @@ static struct pdu_adv *chan_prepare(struct lll_adv *lll) /* FIXME: get latest only when primary PDU without Aux PDUs */ upd = 0U; pdu = lll_adv_data_latest_get(lll, &upd); - LL_ASSERT(pdu); + LL_ASSERT_DBG(pdu); radio_pkt_tx_set(pdu); @@ -1494,7 +1494,7 @@ static struct pdu_adv *chan_prepare(struct lll_adv *lll) struct pdu_adv *scan_pdu; scan_pdu = lll_adv_scan_rsp_latest_get(lll, &upd); - LL_ASSERT(scan_pdu); + LL_ASSERT_DBG(scan_pdu); #if defined(CONFIG_BT_CTLR_PRIVACY) if (upd) { @@ -1551,7 +1551,7 @@ static inline int isr_rx_pdu(struct lll_adv *lll, #endif /* CONFIG_BT_CTLR_PRIVACY */ node_rx = ull_pdu_rx_alloc_peek(1); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); pdu_rx = (void *)node_rx->pdu; pdu_adv = lll_adv_data_curr_get(lll); @@ -1580,7 +1580,7 @@ static inline int isr_rx_pdu(struct lll_adv *lll, LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, lll_prof_latency_get()); } else { - LL_ASSERT(!radio_is_ready()); + LL_ASSERT_ERR(!radio_is_ready()); } if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { @@ -1656,7 +1656,7 @@ static inline int isr_rx_pdu(struct lll_adv *lll, LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, lll_prof_latency_get()); } else { - LL_ASSERT(!radio_is_ready()); + LL_ASSERT_ERR(!radio_is_ready()); } if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_aux.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_aux.c index c4ee5af14b1d..f4b48cabab9c 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_aux.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_aux.c @@ -104,10 +104,10 @@ void lll_adv_aux_prepare(void *param) int err; err = lll_hfclock_on(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); err = lll_prepare(lll_is_abort_cb, lll_abort_cb, prepare_cb, 0, param); - LL_ASSERT(!err || err == -EINPROGRESS); + LL_ASSERT_ERR(!err || err == -EINPROGRESS); } void lll_adv_aux_pback_prepare(void *param) @@ -143,7 +143,7 @@ static int prepare_cb(struct lll_prepare_param *p) /* FIXME: get latest only when primary PDU without Aux PDUs */ upd = 0U; sec_pdu = lll_adv_aux_data_latest_get(lll, &upd); - LL_ASSERT(sec_pdu); + LL_ASSERT_DBG(sec_pdu); #if defined(CONFIG_BT_TICKER_EXT_EXPIRE_INFO) struct ll_adv_aux_set *aux; @@ -163,14 +163,14 @@ static int prepare_cb(struct lll_prepare_param *p) /* Get reference to primary PDU */ pri_pdu = lll_adv_data_curr_get(lll_adv); - LL_ASSERT(pri_pdu->type == PDU_ADV_TYPE_EXT_IND); + LL_ASSERT_DBG(pri_pdu->type == PDU_ADV_TYPE_EXT_IND); /* Get reference to common extended header */ com_hdr = (void *)&pri_pdu->adv_ext_ind; /* Get reference to aux pointer structure */ err = aux_ptr_get(pri_pdu, &aux_ptr); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); /* Abort if no aux_ptr filled */ if (unlikely(!aux_ptr || !PDU_ADV_AUX_PTR_OFFSET_GET(aux_ptr))) { @@ -218,7 +218,7 @@ static int prepare_cb(struct lll_prepare_param *p) struct pdu_adv *scan_pdu; scan_pdu = lll_adv_scan_rsp_latest_get(lll_adv, &upd); - LL_ASSERT(scan_pdu); + LL_ASSERT_DBG(scan_pdu); radio_isr_set(isr_tx_rx, lll); radio_tmr_tifs_set(EVENT_IFS_US); @@ -340,7 +340,7 @@ static int prepare_cb(struct lll_prepare_param *p) #endif /* CONFIG_BT_CTLR_ADV_AUX_PDU_BACK2BACK */ ret = lll_prepare_done(lll); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); DEBUG_RADIO_START_A(1); @@ -411,7 +411,7 @@ static void isr_early_abort(void *param) /* Generate auxiliary radio event done */ extra = ull_done_extra_type_set(EVENT_DONE_EXTRA_TYPE_ADV_AUX); - LL_ASSERT(extra); + LL_ASSERT_ERR(extra); radio_isr_set(isr_race, param); if (!radio_is_idle()) { @@ -419,7 +419,7 @@ static void isr_early_abort(void *param) } err = lll_hfclock_off(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); lll_done(NULL); } @@ -434,7 +434,7 @@ static void isr_done(void *param) /* Generate auxiliary radio event done */ extra = ull_done_extra_type_set(EVENT_DONE_EXTRA_TYPE_ADV_AUX); - LL_ASSERT(extra); + LL_ASSERT_ERR(extra); /* Cleanup radio event and dispatch the done event */ lll_isr_cleanup(param); @@ -462,14 +462,14 @@ static void isr_tx_chain(void *param) /* Get reference to aux pointer structure */ err = aux_ptr_get(lll_aux->last_pdu, &aux_ptr); - LL_ASSERT(!err && aux_ptr); + LL_ASSERT_ERR(!err && aux_ptr); /* Use channel idx that was in aux_ptr */ lll_chan_set(aux_ptr->chan_idx); /* Get reference to the auxiliary chain PDU */ pdu = lll_adv_pdu_linked_next_get(lll_aux->last_pdu); - LL_ASSERT(pdu); + LL_ASSERT_DBG(pdu); /* Set the last used auxiliary PDU for transmission */ lll_aux->last_pdu = pdu; @@ -492,7 +492,7 @@ static void isr_tx_chain(void *param) LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, lll_prof_latency_get()); } else { - LL_ASSERT(!radio_is_ready()); + LL_ASSERT_ERR(!radio_is_ready()); } if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { @@ -557,7 +557,7 @@ static void aux_ptr_chan_idx_set(struct lll_adv_aux *lll, struct pdu_adv *pdu) /* Get reference to aux pointer structure */ err = aux_ptr_get(pdu, &aux_ptr); - LL_ASSERT(!err && aux_ptr); + LL_ASSERT_ERR(!err && aux_ptr); /* Calculate a new channel index */ aux = HDR_LLL2ULL(lll); @@ -603,7 +603,7 @@ static void isr_tx_rx(void *param) /* setup Rx buffer */ node_rx = ull_pdu_rx_alloc_peek(1); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); radio_pkt_rx_set(node_rx->pdu); /* assert if radio packet ptr is not set and radio started rx */ @@ -611,7 +611,7 @@ static void isr_tx_rx(void *param) LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, lll_prof_latency_get()); } else { - LL_ASSERT(!radio_is_ready()); + LL_ASSERT_ERR(!radio_is_ready()); } if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { @@ -764,12 +764,12 @@ static inline int isr_rx_pdu(struct lll_adv_aux *lll_aux, uint8_t phy_flags_rx, lll = lll_aux->adv; node_rx = ull_pdu_rx_alloc_peek(1); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); pdu_rx = (void *)node_rx->pdu; pdu_adv = lll_adv_data_curr_get(lll); pdu_aux = lll_adv_aux_data_latest_get(lll_aux, &upd); - LL_ASSERT(pdu_aux); + LL_ASSERT_DBG(pdu_aux); hdr = &pdu_aux->adv_ext_ind.ext_hdr; @@ -823,7 +823,7 @@ static inline int isr_rx_pdu(struct lll_adv_aux *lll_aux, uint8_t phy_flags_rx, LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, lll_prof_latency_get()); } else { - LL_ASSERT(!radio_is_ready()); + LL_ASSERT_ERR(!radio_is_ready()); } if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { @@ -900,7 +900,7 @@ static inline int isr_rx_pdu(struct lll_adv_aux *lll_aux, uint8_t phy_flags_rx, LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, lll_prof_latency_get()); } else { - LL_ASSERT(!radio_is_ready()); + LL_ASSERT_ERR(!radio_is_ready()); } if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_iso.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_iso.c index 774a10da2b30..cc26f729dfce 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_iso.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_iso.c @@ -115,7 +115,7 @@ static void prepare(void *param) int err; err = lll_hfclock_on(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); p = param; @@ -135,7 +135,7 @@ static void create_prepare_bh(void *param) /* Invoke common pipeline handling of prepare */ err = lll_prepare(lll_is_abort_cb, lll_abort_cb, create_prepare_cb, 0U, param); - LL_ASSERT(!err || err == -EINPROGRESS); + LL_ASSERT_ERR(!err || err == -EINPROGRESS); } static void prepare_bh(void *param) @@ -144,7 +144,7 @@ static void prepare_bh(void *param) /* Invoke common pipeline handling of prepare */ err = lll_prepare(lll_is_abort_cb, lll_abort_cb, prepare_cb, 0U, param); - LL_ASSERT(!err || err == -EINPROGRESS); + LL_ASSERT_ERR(!err || err == -EINPROGRESS); } static int create_prepare_cb(struct lll_prepare_param *p) @@ -269,7 +269,7 @@ static int prepare_cb_common(struct lll_prepare_param *p) stream_handle = lll->stream_handle[bis_idx]; handle = LL_BIS_ADV_HANDLE_FROM_IDX(stream_handle); stream = ull_adv_iso_lll_stream_get(stream_handle); - LL_ASSERT(stream); + LL_ASSERT_DBG(stream); do { link = memq_peek(stream->memq_tx.head, @@ -448,7 +448,7 @@ static int prepare_cb_common(struct lll_prepare_param *p) #endif /* CONFIG_BT_CTLR_XTAL_ADVANCED */ ret = lll_prepare_done(lll); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); /* Calculate ahead the next subevent channel index */ if (false) { @@ -470,7 +470,7 @@ static int prepare_cb_common(struct lll_prepare_param *p) #endif /* CONFIG_BT_CTLR_ADV_ISO_INTERLEAVED */ } else { - LL_ASSERT(false); + LL_ASSERT_DBG(false); } return 0; @@ -582,7 +582,7 @@ static void isr_tx_common(void *param, } else { bis = 0U; - LL_ASSERT(false); + LL_ASSERT_DBG(false); } if (!is_ctrl) { @@ -649,7 +649,7 @@ static void isr_tx_common(void *param, stream_handle = lll->stream_handle[bis_idx]; handle = LL_BIS_ADV_HANDLE_FROM_IDX(stream_handle); stream = ull_adv_iso_lll_stream_get(stream_handle); - LL_ASSERT(stream); + LL_ASSERT_DBG(stream); do { struct node_tx_iso *tx; @@ -727,7 +727,7 @@ static void isr_tx_common(void *param, /* FIXME: memq_peek_n function does not support indices > UINT8_MAX, * add assertion check to honor this limitation. */ - LL_ASSERT(payload_index <= UINT8_MAX); + LL_ASSERT_DBG(payload_index <= UINT8_MAX); } else { payload_index = lll->bn_curr - 1U; /* 3 bits */ } @@ -742,7 +742,7 @@ static void isr_tx_common(void *param, stream_handle = lll->stream_handle[lll->bis_curr - 1U]; stream = ull_adv_iso_lll_stream_get(stream_handle); - LL_ASSERT(stream); + LL_ASSERT_DBG(stream); link = memq_peek_n(stream->memq_tx.head, stream->memq_tx.tail, payload_index, (void **)&tx); @@ -873,7 +873,7 @@ static void isr_tx_common(void *param, LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, lll_prof_latency_get()); } else { - LL_ASSERT(!radio_is_ready()); + LL_ASSERT_ERR(!radio_is_ready()); } if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { @@ -922,7 +922,7 @@ static void isr_tx_common(void *param, #endif /* CONFIG_BT_CTLR_ADV_ISO_INTERLEAVED */ } else { - LL_ASSERT(false); + LL_ASSERT_DBG(false); } if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { @@ -1038,7 +1038,7 @@ static void isr_done_term(void *param) lll_isr_status_reset(); lll = param; - LL_ASSERT(lll->ctrl_expire); + LL_ASSERT_DBG(lll->ctrl_expire); elapsed_event = lll->latency_event + 1U; if (lll->ctrl_expire > elapsed_event) { @@ -1075,7 +1075,7 @@ static void isr_done_term(void *param) * Advertising PDU. */ rx = ull_pdu_rx_alloc(); - LL_ASSERT(rx); + LL_ASSERT_ERR(rx); rx->hdr.type = NODE_RX_TYPE_BIG_CHM_COMPLETE; rx->rx_ftr.param = lll; diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_sync.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_sync.c index 7bcc0435fe53..be8b8aa03a41 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_sync.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_sync.c @@ -86,11 +86,11 @@ void lll_adv_sync_prepare(void *param) int err; err = lll_hfclock_on(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); /* Invoke common pipeline handling of prepare */ err = lll_prepare(lll_is_abort_cb, abort_cb, prepare_cb, 0, param); - LL_ASSERT(!err || err == -EINPROGRESS); + LL_ASSERT_ERR(!err || err == -EINPROGRESS); } static int init_reset(void) @@ -176,7 +176,7 @@ static int prepare_cb(struct lll_prepare_param *p) upd = 0U; pdu = lll_adv_sync_data_latest_get(lll, NULL, &upd); - LL_ASSERT(pdu); + LL_ASSERT_DBG(pdu); #if defined(CONFIG_BT_CTLR_DF_ADV_CTE_TX) lll_df_cte_tx_enable(lll, pdu, &cte_len_us); @@ -278,7 +278,7 @@ static int prepare_cb(struct lll_prepare_param *p) #endif /* CONFIG_BT_CTLR_ADV_SYNC_PDU_BACK2BACK */ ret = lll_prepare_done(lll); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); DEBUG_RADIO_START_A(1); @@ -305,7 +305,7 @@ static void abort_cb(struct lll_prepare_param *prepare_param, void *param) * currently in preparation pipeline. */ err = lll_hfclock_off(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); /* Accumulate the latency as event is aborted while being in pipeline */ lll = prepare_param->param; @@ -336,7 +336,7 @@ static void isr_done(void *param) * the thread context. */ rx = ull_pdu_rx_alloc(); - LL_ASSERT(rx); + LL_ASSERT_ERR(rx); rx->hdr.type = NODE_RX_TYPE_SYNC_CHM_COMPLETE; rx->rx_ftr.param = lll; @@ -370,14 +370,14 @@ static void isr_tx(void *param) /* Get reference to aux pointer structure */ err = aux_ptr_get(lll_sync->last_pdu, &aux_ptr); - LL_ASSERT(!err && aux_ptr); + LL_ASSERT_ERR(!err && aux_ptr); /* Use channel idx that was in aux_ptr */ lll_chan_set(aux_ptr->chan_idx); /* Get reference to the auxiliary chain PDU */ pdu = lll_adv_pdu_linked_next_get(lll_sync->last_pdu); - LL_ASSERT(pdu); + LL_ASSERT_DBG(pdu); /* Set the last used auxiliary PDU for transmission */ lll_sync->last_pdu = pdu; @@ -405,7 +405,7 @@ static void isr_tx(void *param) LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, lll_prof_latency_get()); } else { - LL_ASSERT(!radio_is_ready()); + LL_ASSERT_ERR(!radio_is_ready()); } if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { @@ -514,7 +514,7 @@ static void aux_ptr_chan_idx_set(struct lll_adv_sync *lll, struct pdu_adv *pdu) /* Get reference to aux pointer structure */ err = aux_ptr_get(pdu, &aux_ptr); - LL_ASSERT(!err && aux_ptr); + LL_ASSERT_ERR(!err && aux_ptr); /* Calculate a new channel index */ chan_idx = lll_chan_sel_2(lll->data_chan_counter, lll->data_chan_id, diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_central.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_central.c index 4f082b4957a4..fb170046a96f 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_central.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_central.c @@ -72,12 +72,12 @@ void lll_central_prepare(void *param) int err; err = lll_hfclock_on(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); /* Invoke common pipeline handling of prepare */ err = lll_prepare(lll_conn_central_is_abort_cb, lll_conn_abort_cb, prepare_cb, 0, param); - LL_ASSERT(!err || err == -EINPROGRESS); + LL_ASSERT_ERR(!err || err == -EINPROGRESS); } static int init_reset(void) @@ -139,7 +139,7 @@ static int prepare_cb(struct lll_prepare_param *p) lll->data_chan_count); #else /* !CONFIG_BT_CTLR_CHAN_SEL_2 */ data_chan_use = 0; - LL_ASSERT(0); + LL_ASSERT_DBG(0); #endif /* !CONFIG_BT_CTLR_CHAN_SEL_2 */ } else { data_chan_use = lll_chan_sel_1(&lll->data_chan_use, @@ -266,7 +266,7 @@ static int prepare_cb(struct lll_prepare_param *p) #endif /* !CONFIG_BT_CTLR_XTAL_ADVANCED */ ret = lll_prepare_done(lll); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); DEBUG_RADIO_START_M(1); diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_central_iso.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_central_iso.c index fc44233f1ee8..3d02a092f33f 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_central_iso.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_central_iso.c @@ -97,11 +97,11 @@ void lll_central_iso_prepare(void *param) /* Initiate HF clock start up */ err = lll_hfclock_on(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); /* Invoke common pipeline handling of prepare */ err = lll_prepare(lll_is_abort_cb, abort_cb, prepare_cb, 0U, param); - LL_ASSERT(!err || err == -EINPROGRESS); + LL_ASSERT_ERR(!err || err == -EINPROGRESS); } static int init_reset(void) @@ -143,7 +143,7 @@ static int prepare_cb(struct lll_prepare_param *p) cis_lll = ull_conn_iso_lll_stream_get_by_group(cig_lll, &cis_handle_curr); } while (cis_lll && !cis_lll->active); - LL_ASSERT(cis_lll); + LL_ASSERT_DBG(cis_lll); /* Unconditionally set the prepared flag. * This flag ensures current CIG event does not pick up a new CIS becoming active when the @@ -156,7 +156,7 @@ static int prepare_cb(struct lll_prepare_param *p) /* Get reference to ACL context */ conn_lll = ull_conn_lll_get(cis_lll->acl_handle); - LL_ASSERT(conn_lll != NULL); + LL_ASSERT_DBG(conn_lll != NULL); /* Pick the event_count calculated in the ULL prepare */ cis_lll->event_count = cis_lll->event_count_prepare; @@ -395,7 +395,7 @@ static int prepare_cb(struct lll_prepare_param *p) /* Prepare is done */ ret = lll_prepare_done(cig_lll); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); DEBUG_RADIO_START_M(1); @@ -435,7 +435,7 @@ static void abort_cb(struct lll_prepare_param *prepare_param, void *param) /* Get reference to ACL context */ const struct lll_conn *conn_lll = ull_conn_lll_get(cis_lll->acl_handle); - LL_ASSERT(conn_lll != NULL); + LL_ASSERT_DBG(conn_lll != NULL); if (conn_lll->enc_rx) { radio_ccm_disable(); @@ -449,7 +449,7 @@ static void abort_cb(struct lll_prepare_param *prepare_param, void *param) * currently in preparation pipeline. */ err = lll_hfclock_off(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); /* Get reference to CIG LLL context */ cig_lll = prepare_param->param; @@ -494,13 +494,13 @@ static void isr_tx(void *param) /* Acquire rx node for reception */ node_rx = ull_iso_pdu_rx_alloc_peek(1U); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); #if defined(CONFIG_BT_CTLR_LE_ENC) /* Get reference to ACL context */ const struct lll_conn *conn_lll = ull_conn_lll_get(cis_lll->acl_handle); - LL_ASSERT(conn_lll != NULL); + LL_ASSERT_DBG(conn_lll != NULL); #endif /* CONFIG_BT_CTLR_LE_ENC */ /* PHY */ @@ -547,7 +547,7 @@ static void isr_tx(void *param) LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, lll_prof_latency_get()); } else { - LL_ASSERT(!radio_is_ready()); + LL_ASSERT_ERR(!radio_is_ready()); } /* +/- 2us active clock jitter, +1 us PPI to timer start compensation */ @@ -608,12 +608,12 @@ static void isr_tx(void *param) (cis_lll->sub_interval * se_curr); start_us = radio_tmr_start_us(1U, subevent_us); - LL_ASSERT(start_us == (subevent_us + 1U)); + LL_ASSERT_ERR(start_us == (subevent_us + 1U)); #endif /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */ /* Get reference to ACL context */ evt_conn_lll = ull_conn_lll_get(cis_lll->acl_handle); - LL_ASSERT(evt_conn_lll != NULL); + LL_ASSERT_DBG(evt_conn_lll != NULL); /* Calculate the radio channel to use for next subevent */ data_chan_id = lll_chan_id(cis_lll->access_addr); @@ -652,7 +652,7 @@ static void isr_tx(void *param) subevent_us += next_cis_lll->offset - cis_offset_first; start_us = radio_tmr_start_us(1U, subevent_us); - LL_ASSERT(start_us == (subevent_us + 1U)); + LL_ASSERT_ERR(start_us == (subevent_us + 1U)); #endif /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */ /* Event counter value, 0-15 bit of cisEventCounter */ @@ -660,7 +660,7 @@ static void isr_tx(void *param) /* Get reference to ACL context */ next_conn_lll = ull_conn_lll_get(next_cis_lll->acl_handle); - LL_ASSERT(next_conn_lll != NULL); + LL_ASSERT_DBG(next_conn_lll != NULL); /* Calculate the radio channel to use for ISO event */ data_chan_id = lll_chan_id(next_cis_lll->access_addr); @@ -772,7 +772,7 @@ static void isr_rx(void *param) /* Get reference to received PDU */ node_rx = ull_iso_pdu_rx_alloc_peek(1U); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); pdu_rx = (void *)node_rx->pdu; /* Tx ACK */ @@ -805,7 +805,7 @@ static void isr_rx(void *param) /* Get reference to ACL context */ const struct lll_conn *conn_lll = ull_conn_lll_get(cis_lll->acl_handle); - LL_ASSERT(conn_lll != NULL); + LL_ASSERT_DBG(conn_lll != NULL); /* If required, wait for CCM to finish */ @@ -813,7 +813,7 @@ static void isr_rx(void *param) uint32_t done; done = radio_ccm_is_done(); - LL_ASSERT(done); + LL_ASSERT_ERR(done); if (!radio_ccm_mic_is_valid()) { /* Record MIC invalid */ @@ -894,7 +894,7 @@ static void isr_rx(void *param) /* Get reference to ACL context */ next_conn_lll = ull_conn_lll_get(next_cis_lll->acl_handle); - LL_ASSERT(next_conn_lll != NULL); + LL_ASSERT_DBG(next_conn_lll != NULL); /* Calculate CIS channel if not already calculated */ if (se_curr < cis_lll->nse) { @@ -912,7 +912,7 @@ static void isr_rx(void *param) subevent_us += next_cis_lll->offset - cis_offset_first; start_us = radio_tmr_start_us(1U, subevent_us); - LL_ASSERT(start_us == (subevent_us + 1U)); + LL_ASSERT_ERR(start_us == (subevent_us + 1U)); #endif /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */ /* Event counter value, 0-15 bit of cisEventCounter */ @@ -1075,7 +1075,7 @@ static void isr_prepare_subevent(void *param) /* Get reference to ACL context */ const struct lll_conn *conn_lll = ull_conn_lll_get(cis_lll->acl_handle); - LL_ASSERT(conn_lll != NULL); + LL_ASSERT_DBG(conn_lll != NULL); #endif /* CONFIG_BT_CTLR_LE_ENC */ /* PHY */ @@ -1134,7 +1134,7 @@ static void isr_prepare_subevent(void *param) #if defined(CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER) start_us = radio_tmr_start_us(1U, subevent_us); - LL_ASSERT(start_us == (subevent_us + 1U)); + LL_ASSERT_ERR(start_us == (subevent_us + 1U)); #else /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */ /* Compensate for the 1 us added by radio_tmr_start_us() */ @@ -1177,7 +1177,7 @@ static void isr_prepare_subevent(void *param) LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, lll_prof_latency_get()); } else { - LL_ASSERT(!radio_is_ready()); + LL_ASSERT_ERR(!radio_is_ready()); } if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { @@ -1203,7 +1203,7 @@ static void isr_done(void *param) payload_count_flush_or_inc_on_close(cis_lll); e = ull_event_done_extra_get(); - LL_ASSERT(e); + LL_ASSERT_ERR(e); e->type = EVENT_DONE_EXTRA_TYPE_CIS; e->trx_performed_bitmask = trx_performed_bitmask; diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_conn.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_conn.c index a528e06c939e..76663641f80a 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_conn.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_conn.c @@ -189,7 +189,7 @@ int lll_conn_central_is_abort_cb(void *next, void *curr, return -EBUSY; } - LL_ASSERT(trx_busy_iteration < CENTRAL_TRX_BUSY_ITERATION_MAX); + LL_ASSERT_DBG(trx_busy_iteration < CENTRAL_TRX_BUSY_ITERATION_MAX); return -ECANCELED; } @@ -223,7 +223,7 @@ int lll_conn_peripheral_is_abort_cb(void *next, void *curr, return -EBUSY; } - LL_ASSERT(trx_busy_iteration < PERIPHERAL_TRX_BUSY_ITERATION_MAX); + LL_ASSERT_DBG(trx_busy_iteration < PERIPHERAL_TRX_BUSY_ITERATION_MAX); return -ECANCELED; } @@ -268,7 +268,7 @@ void lll_conn_abort_cb(struct lll_prepare_param *prepare_param, void *param) * currently in preparation pipeline. */ err = lll_hfclock_off(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); /* Get reference to LLL connection context */ lll = prepare_param->param; @@ -290,7 +290,7 @@ void lll_conn_abort_cb(struct lll_prepare_param *prepare_param, void *param) /* Extra done event, to check supervision timeout */ e = ull_event_done_extra_get(); - LL_ASSERT(e); + LL_ASSERT_ERR(e); e->type = EVENT_DONE_EXTRA_TYPE_CONN; e->trx_cnt = 0U; @@ -364,7 +364,7 @@ void lll_conn_isr_rx(void *param) lll = param; node_rx = ull_pdu_rx_alloc_peek(1); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); pdu_data_rx = (void *)node_rx->pdu; @@ -385,7 +385,7 @@ void lll_conn_isr_rx(void *param) LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, lll_prof_latency_get()); } else { - LL_ASSERT(!radio_is_ready()); + LL_ASSERT_ERR(!radio_is_ready()); } goto lll_conn_isr_rx_exit; @@ -475,7 +475,7 @@ void lll_conn_isr_rx(void *param) LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, lll_prof_latency_get()); } else { - LL_ASSERT(!radio_is_ready()); + LL_ASSERT_ERR(!radio_is_ready()); } /* Restore state if last transmitted was empty PDU */ @@ -538,7 +538,7 @@ void lll_conn_isr_rx(void *param) LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, lll_prof_latency_get()); } else { - LL_ASSERT(!radio_is_ready()); + LL_ASSERT_ERR(!radio_is_ready()); } #if defined(CONFIG_BT_CTLR_TX_DEFER) @@ -570,7 +570,7 @@ void lll_conn_isr_rx(void *param) is_ull_rx = 0U; if (tx_release) { - LL_ASSERT(lll->handle != 0xFFFF); + LL_ASSERT_DBG(lll->handle != 0xFFFF); ull_conn_lll_ack_enqueue(lll->handle, tx_release); @@ -736,12 +736,12 @@ void lll_conn_isr_tx(void *param) LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, lll_prof_latency_get()); } else { - LL_ASSERT(!radio_is_ready()); + LL_ASSERT_ERR(!radio_is_ready()); } #if defined(CONFIG_BT_CTLR_DF_CONN_CTE_TX) pdu_tx = get_last_tx_pdu(lll); - LL_ASSERT(pdu_tx); + LL_ASSERT_DBG(pdu_tx); if (pdu_tx->cp) { cte_len = CTE_LEN_US(pdu_tx->octet3.cte_info.time); @@ -836,7 +836,7 @@ void lll_conn_rx_pkt_set(struct lll_conn *lll) uint8_t phy; node_rx = ull_pdu_rx_alloc_peek(1); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); /* In case of ISR latencies, if packet pointer has not been set on time * then we do not want to check uninitialized length in rx buffer that @@ -1041,7 +1041,7 @@ static void isr_done(void *param) lll_isr_status_reset(); e = ull_event_done_extra_get(); - LL_ASSERT(e); + LL_ASSERT_ERR(e); e->type = EVENT_DONE_EXTRA_TYPE_CONN; e->trx_cnt = trx_cnt; @@ -1182,7 +1182,7 @@ static inline int isr_rx_pdu(struct lll_conn *lll, struct pdu_data *pdu_data_rx, FORCE_MD_CNT_SET(); } else { - LL_ASSERT(0); + LL_ASSERT_DBG(0); } if (IS_ENABLED(CONFIG_BT_CENTRAL) && !lll->role && @@ -1209,7 +1209,7 @@ static inline int isr_rx_pdu(struct lll_conn *lll, struct pdu_data *pdu_data_rx, uint32_t done; done = radio_ccm_is_done(); - LL_ASSERT(done); + LL_ASSERT_ERR(done); bool mic_failure = !radio_ccm_mic_is_valid(); diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_df.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_df.c index f4a12ef5e934..a9a575a32306 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_df.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_df.c @@ -103,7 +103,7 @@ void lll_df_cte_tx_enable(struct lll_adv_sync *lll_sync, const struct pdu_adv *p const struct lll_df_adv_cfg *df_cfg; df_cfg = lll_adv_sync_extra_data_curr_get(lll_sync); - LL_ASSERT(df_cfg); + LL_ASSERT_DBG(df_cfg); lll_df_cte_tx_configure(df_cfg->cte_type, df_cfg->cte_length, df_cfg->ant_sw_len, df_cfg->ant_ids); diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral.c index 8c3b83efd721..a25265400db8 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral.c @@ -73,7 +73,7 @@ void lll_periph_prepare(void *param) int err; err = lll_hfclock_on(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); p = param; @@ -82,7 +82,7 @@ void lll_periph_prepare(void *param) /* Invoke common pipeline handling of prepare */ err = lll_prepare(lll_conn_peripheral_is_abort_cb, lll_conn_abort_cb, prepare_cb, 0U, param); - LL_ASSERT(!err || err == -EINPROGRESS); + LL_ASSERT_ERR(!err || err == -EINPROGRESS); } static int init_reset(void) @@ -143,7 +143,7 @@ static int prepare_cb(struct lll_prepare_param *p) lll->data_chan_count); #else /* !CONFIG_BT_CTLR_CHAN_SEL_2 */ data_chan_use = 0; - LL_ASSERT(0); + LL_ASSERT_DBG(0); #endif /* !CONFIG_BT_CTLR_CHAN_SEL_2 */ } else { data_chan_use = lll_chan_sel_1(&lll->data_chan_use, @@ -355,7 +355,7 @@ static int prepare_cb(struct lll_prepare_param *p) #endif /* CONFIG_BT_CTLR_XTAL_ADVANCED */ ret = lll_prepare_done(lll); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); DEBUG_RADIO_START_S(1); diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral_iso.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral_iso.c index 46e6aad63b7e..8178be1c7d26 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral_iso.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral_iso.c @@ -100,7 +100,7 @@ void lll_peripheral_iso_prepare(void *param) /* Initiate HF clock start up */ err = lll_hfclock_on(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); p = param; @@ -108,7 +108,7 @@ void lll_peripheral_iso_prepare(void *param) /* Invoke common pipeline handling of prepare */ err = lll_prepare(lll_is_abort_cb, abort_cb, prepare_cb, 0U, param); - LL_ASSERT(!err || err == -EINPROGRESS); + LL_ASSERT_ERR(!err || err == -EINPROGRESS); } void lll_peripheral_iso_flush(uint16_t handle, struct lll_conn_iso_stream *lll) @@ -157,7 +157,7 @@ static int prepare_cb(struct lll_prepare_param *p) cis_lll = ull_conn_iso_lll_stream_sorted_get_by_group(cig_lll, &cis_handle_curr); } while (cis_lll && !cis_lll->active); - LL_ASSERT(cis_lll); + LL_ASSERT_DBG(cis_lll); /* Unconditionally set the prepared flag. * This flag ensures current CIG event does not pick up a new CIS becoming active when the @@ -170,7 +170,7 @@ static int prepare_cb(struct lll_prepare_param *p) /* Get reference to ACL context */ conn_lll = ull_conn_lll_get(cis_lll->acl_handle); - LL_ASSERT(conn_lll != NULL); + LL_ASSERT_DBG(conn_lll != NULL); /* Pick the event_count calculated in the ULL prepare */ cis_lll->event_count = cis_lll->event_count_prepare; @@ -233,7 +233,7 @@ static int prepare_cb(struct lll_prepare_param *p) lll_chan_set(data_chan_use); node_rx = ull_iso_pdu_rx_alloc_peek(1U); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); /* Encryption */ if (false) { @@ -410,7 +410,7 @@ static int prepare_cb(struct lll_prepare_param *p) /* Prepare is done */ ret = lll_prepare_done(cig_lll); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); DEBUG_RADIO_START_S(1); @@ -451,7 +451,7 @@ static void abort_cb(struct lll_prepare_param *prepare_param, void *param) /* Get reference to ACL context */ const struct lll_conn *conn_lll = ull_conn_lll_get(cis_lll->acl_handle); - LL_ASSERT(conn_lll != NULL); + LL_ASSERT_DBG(conn_lll != NULL); if (conn_lll->enc_rx) { radio_ccm_disable(); @@ -465,7 +465,7 @@ static void abort_cb(struct lll_prepare_param *prepare_param, void *param) * currently in preparation pipeline. */ err = lll_hfclock_off(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); /* Get reference to CIG LLL context */ cig_lll = prepare_param->param; @@ -578,7 +578,7 @@ static void isr_rx(void *param) /* Get reference to ACL context */ conn_lll = ull_conn_lll_get(cis_lll->acl_handle); - LL_ASSERT(conn_lll != NULL); + LL_ASSERT_DBG(conn_lll != NULL); if (crc_ok) { struct node_rx_pdu *node_rx; @@ -586,7 +586,7 @@ static void isr_rx(void *param) /* Get reference to received PDU */ node_rx = ull_iso_pdu_rx_alloc_peek(1U); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); pdu_rx = (void *)node_rx->pdu; @@ -624,7 +624,7 @@ static void isr_rx(void *param) uint32_t done; done = radio_ccm_is_done(); - LL_ASSERT(done); + LL_ASSERT_ERR(done); if (!radio_ccm_mic_is_valid()) { /* Record MIC invalid */ @@ -804,7 +804,7 @@ static void isr_rx(void *param) LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, lll_prof_latency_get()); } else { - LL_ASSERT(!radio_is_ready()); + LL_ASSERT_ERR(!radio_is_ready()); } if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { @@ -884,7 +884,7 @@ static void isr_rx(void *param) #endif /* !CONFIG_BT_CTLR_PHY */ start_us = radio_tmr_start_us(0U, subevent_us); - LL_ASSERT(start_us == (subevent_us + 1U)); + LL_ASSERT_ERR(start_us == (subevent_us + 1U)); #endif /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */ if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { @@ -916,13 +916,13 @@ static void isr_tx(void *param) cis_lll = param; node_rx = ull_iso_pdu_rx_alloc_peek(1U); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); #if defined(CONFIG_BT_CTLR_LE_ENC) /* Get reference to ACL context */ const struct lll_conn *conn_lll = ull_conn_lll_get(cis_lll->acl_handle); - LL_ASSERT(conn_lll != NULL); + LL_ASSERT_DBG(conn_lll != NULL); #endif /* CONFIG_BT_CTLR_LE_ENC */ /* PHY */ @@ -999,7 +999,7 @@ static void isr_tx(void *param) #if defined(CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER) start_us = radio_tmr_start_us(0U, subevent_us); - LL_ASSERT(start_us == (subevent_us + 1U)); + LL_ASSERT_ERR(start_us == (subevent_us + 1U)); #else /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */ /* Compensate for the 1 us added by radio_tmr_start_us() */ @@ -1091,7 +1091,7 @@ static void isr_prepare_subevent(void *param) /* Get reference to ACL context */ conn_lll = ull_conn_lll_get(cis_lll->acl_handle); - LL_ASSERT(conn_lll != NULL); + LL_ASSERT_DBG(conn_lll != NULL); /* Calculate the radio channel to use for next subevent */ @@ -1117,7 +1117,7 @@ static void isr_prepare_subevent_next_cis(void *param) /* Get reference to ACL context */ conn_lll = ull_conn_lll_get(cis_lll->acl_handle); - LL_ASSERT(conn_lll != NULL); + LL_ASSERT_DBG(conn_lll != NULL); /* Event counter value, 0-15 bit of cisEventCounter */ event_counter = cis_lll->event_count; @@ -1149,13 +1149,13 @@ static void isr_prepare_subevent_common(void *param) cis_lll = param; node_rx = ull_iso_pdu_rx_alloc_peek(1U); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); #if defined(CONFIG_BT_CTLR_LE_ENC) /* Get reference to ACL context */ const struct lll_conn *conn_lll = ull_conn_lll_get(cis_lll->acl_handle); - LL_ASSERT(conn_lll != NULL); + LL_ASSERT_DBG(conn_lll != NULL); #endif /* CONFIG_BT_CTLR_LE_ENC */ /* PHY */ @@ -1236,7 +1236,7 @@ static void isr_prepare_subevent_common(void *param) } start_us = radio_tmr_start_us(0U, subevent_us); - LL_ASSERT(!trx_performed_bitmask || (start_us == (subevent_us + 1U))); + LL_ASSERT_ERR(!trx_performed_bitmask || (start_us == (subevent_us + 1U))); /* If no anchor point sync yet, continue to capture access address * timestamp. @@ -1297,7 +1297,7 @@ static void isr_done(void *param) payload_count_rx_flush_or_txrx_inc(cis_lll); e = ull_event_done_extra_get(); - LL_ASSERT(e); + LL_ASSERT_ERR(e); e->type = EVENT_DONE_EXTRA_TYPE_CIS; e->trx_performed_bitmask = trx_performed_bitmask; diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan.c index f1fab4b664de..7ae1f8bb6de2 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan.c @@ -125,10 +125,10 @@ void lll_scan_prepare(void *param) int err; err = lll_hfclock_on(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); err = lll_prepare(is_abort_cb, abort_cb, prepare_cb, 0, param); - LL_ASSERT(!err || err == -EINPROGRESS); + LL_ASSERT_ERR(!err || err == -EINPROGRESS); } void lll_scan_isr_resume(void *param) @@ -391,7 +391,7 @@ static int common_prepare_cb(struct lll_prepare_param *p, bool is_resume) #endif /* !CONFIG_BT_CTLR_ADV_EXT */ node_rx = ull_pdu_rx_alloc_peek(1); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); radio_pkt_rx_set(node_rx->pdu); @@ -497,8 +497,8 @@ static int common_prepare_cb(struct lll_prepare_param *p, bool is_resume) ticks_at_event, lll->ticks_window, TICKER_NULL_PERIOD, TICKER_NULL_REMAINDER, TICKER_NULL_LAZY, TICKER_NULL_SLOT, ticker_stop_cb, lll, ticker_op_start_cb, (void *)__LINE__); - LL_ASSERT((ret == TICKER_STATUS_SUCCESS) || - (ret == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ret == TICKER_STATUS_SUCCESS) || + (ret == TICKER_STATUS_BUSY)); } #if defined(CONFIG_BT_CENTRAL) && defined(CONFIG_BT_CTLR_SCHED_ADVANCED) @@ -515,12 +515,12 @@ static int common_prepare_cb(struct lll_prepare_param *p, bool is_resume) retval = mayfly_enqueue(TICKER_USER_ID_LLL, TICKER_USER_ID_ULL_LOW, 1U, &mfy_after_cen_offset_get); - LL_ASSERT(!retval); + LL_ASSERT_ERR(!retval); } #endif /* CONFIG_BT_CENTRAL && CONFIG_BT_CTLR_SCHED_ADVANCED */ ret = lll_prepare_done(lll); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); DEBUG_RADIO_START_O(1); @@ -561,7 +561,7 @@ static int is_abort_cb(void *next, void *curr, lll_prepare_cb_t *resume_cb) /* Retain HF clock */ err = lll_hfclock_on(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); /* Yield to the pre-emptor, but be * resumed thereafter. @@ -629,7 +629,7 @@ static void abort_cb(struct lll_prepare_param *prepare_param, void *param) * currently in preparation pipeline. */ err = lll_hfclock_off(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); lll_done(param); } @@ -645,14 +645,14 @@ static void ticker_stop_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, mfy.param = param; ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } static void ticker_op_start_cb(uint32_t status, void *param) { ARG_UNUSED(param); - LL_ASSERT(status == TICKER_STATUS_SUCCESS); + LL_ASSERT_ERR(status == TICKER_STATUS_SUCCESS); } static void isr_rx(void *param) @@ -708,7 +708,7 @@ static void isr_rx(void *param) } node_rx = ull_pdu_rx_alloc_peek(1); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); pdu = (void *)node_rx->pdu; @@ -787,7 +787,7 @@ static void isr_tx(void *param) radio_switch_complete_and_disable(); node_rx = ull_pdu_rx_alloc_peek(1); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); radio_pkt_rx_set(node_rx->pdu); /* assert if radio packet ptr is not set and radio started rx */ @@ -795,7 +795,7 @@ static void isr_tx(void *param) LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, lll_prof_latency_get()); } else { - LL_ASSERT(!radio_is_ready()); + LL_ASSERT_ERR(!radio_is_ready()); } #if defined(CONFIG_BT_CTLR_PRIVACY) @@ -865,7 +865,7 @@ static void isr_common_done(void *param) } node_rx = ull_pdu_rx_alloc_peek(1); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); radio_pkt_rx_set(node_rx->pdu); #if defined(CONFIG_BT_CTLR_PRIVACY) @@ -1006,7 +1006,7 @@ static void isr_abort(void *param) * detected in ULL. */ extra = ull_done_extra_type_set(EVENT_DONE_EXTRA_TYPE_SCAN); - LL_ASSERT(extra); + LL_ASSERT_ERR(extra); #endif /* CONFIG_BT_CTLR_ADV_EXT */ lll_isr_cleanup(param); @@ -1084,7 +1084,7 @@ static void isr_done_cleanup(void *param) * detected in ULL. */ extra = ull_done_extra_type_set(EVENT_DONE_EXTRA_TYPE_SCAN); - LL_ASSERT(extra); + LL_ASSERT_ERR(extra); } /* Prevent scan events in pipeline from being scheduled if duration has @@ -1103,7 +1103,7 @@ static void isr_done_cleanup(void *param) lll->is_aux_sched = 0U; node_rx2 = ull_pdu_rx_alloc(); - LL_ASSERT(node_rx2); + LL_ASSERT_ERR(node_rx2); node_rx2->hdr.type = NODE_RX_TYPE_EXT_AUX_RELEASE; @@ -1126,7 +1126,7 @@ static void isr_done_cleanup(void *param) mfy.param = param; ret = mayfly_enqueue(TICKER_USER_ID_LLL, TICKER_USER_ID_LLL, 1U, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } lll_isr_cleanup(param); @@ -1220,7 +1220,7 @@ static inline int isr_rx_pdu(struct lll_scan *lll, struct pdu_adv *pdu_adv_rx, LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, lll_prof_latency_get()); } else { - LL_ASSERT(!radio_is_ready()); + LL_ASSERT_ERR(!radio_is_ready()); } if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { @@ -1357,7 +1357,7 @@ static inline int isr_rx_pdu(struct lll_scan *lll, struct pdu_adv *pdu_adv_rx, LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, lll_prof_latency_get()); } else { - LL_ASSERT(!radio_is_ready()); + LL_ASSERT_ERR(!radio_is_ready()); } if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { @@ -1567,7 +1567,7 @@ static int isr_rx_scan_report(struct lll_scan *lll, uint8_t devmatch_ok, break; default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan_aux.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan_aux.c index 0478fbc80011..6665dc7390e2 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan_aux.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan_aux.c @@ -108,10 +108,10 @@ void lll_scan_aux_prepare(void *param) int err; err = lll_hfclock_on(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); err = lll_prepare(is_abort_cb, abort_cb, prepare_cb, 0, param); - LL_ASSERT(!err || err == -EINPROGRESS); + LL_ASSERT_ERR(!err || err == -EINPROGRESS); } uint8_t lll_scan_aux_setup(struct pdu_adv *pdu, uint8_t pdu_phy, @@ -132,7 +132,7 @@ uint8_t lll_scan_aux_setup(struct pdu_adv *pdu, uint8_t pdu_phy, uint32_t pdu_us; uint8_t phy; - LL_ASSERT(pdu->type == PDU_ADV_TYPE_EXT_IND); + LL_ASSERT_DBG(pdu->type == PDU_ADV_TYPE_EXT_IND); /* Get reference to extended header */ pri_com_hdr = (void *)&pdu->adv_ext_ind; @@ -231,7 +231,7 @@ uint8_t lll_scan_aux_setup(struct pdu_adv *pdu, uint8_t pdu_phy, } node_rx = ull_pdu_rx_alloc_peek(1); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); /* Store the lll context, aux_ptr and start of PDU in footer */ ftr = &(node_rx->rx_ftr); @@ -499,7 +499,7 @@ static int prepare_cb(struct lll_prepare_param *p) RADIO_PKT_CONF_PHY(lll_aux->phy)); node_rx = ull_pdu_rx_alloc_peek(1); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); radio_pkt_rx_set(node_rx->pdu); @@ -616,12 +616,12 @@ static int prepare_cb(struct lll_prepare_param *p) ret = mayfly_enqueue(TICKER_USER_ID_LLL, TICKER_USER_ID_ULL_LOW, 1U, &mfy_after_cen_offset_get); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } #endif /* CONFIG_BT_CENTRAL && CONFIG_BT_CTLR_SCHED_ADVANCED */ ret = lll_prepare_done(lll_aux); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); DEBUG_RADIO_START_O(1); @@ -640,7 +640,7 @@ static int is_abort_cb(void *next, void *curr, lll_prepare_cb_t *resume_cb) /* Auxiliary event shall not overlap as they are not periodically * scheduled. */ - LL_ASSERT(next != curr); + LL_ASSERT_DBG(next != curr); lll = ull_scan_lll_is_valid_get(next); if (lll) { @@ -674,10 +674,10 @@ static void abort_cb(struct lll_prepare_param *prepare_param, void *param) * currently in preparation pipeline. */ err = lll_hfclock_off(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); e = ull_done_extra_type_set(EVENT_DONE_EXTRA_TYPE_SCAN_AUX); - LL_ASSERT(e); + LL_ASSERT_ERR(e); #if defined(CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS) e->lll = param; @@ -711,7 +711,7 @@ static void isr_done(void *param) * generated thereafter by HCI as incomplete. */ node_rx = ull_pdu_rx_alloc(); - LL_ASSERT(node_rx); + LL_ASSERT_ERR(node_rx); node_rx->hdr.type = NODE_RX_TYPE_EXT_AUX_RELEASE; @@ -725,7 +725,7 @@ static void isr_done(void *param) struct event_done_extra *e; e = ull_done_extra_type_set(EVENT_DONE_EXTRA_TYPE_SCAN_AUX); - LL_ASSERT(e); + LL_ASSERT_ERR(e); #if defined(CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS) e->lll = param; @@ -744,7 +744,7 @@ static void isr_done(void *param) mfy.param = scan_lll; ret = mayfly_enqueue(TICKER_USER_ID_LLL, TICKER_USER_ID_LLL, 1U, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } lll_isr_cleanup(param); @@ -905,7 +905,7 @@ static void isr_rx(struct lll_scan *lll, struct lll_scan_aux *lll_aux, struct node_rx_pdu *node_rx2; node_rx2 = ull_pdu_rx_alloc(); - LL_ASSERT(node_rx2); + LL_ASSERT_ERR(node_rx2); node_rx2->hdr.type = NODE_RX_TYPE_EXT_AUX_RELEASE; @@ -1055,7 +1055,7 @@ static int isr_rx_pdu(struct lll_scan *lll, struct lll_scan_aux *lll_aux, LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, lll_prof_latency_get()); } else { - LL_ASSERT(!radio_is_ready()); + LL_ASSERT_ERR(!radio_is_ready()); } if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { @@ -1210,7 +1210,7 @@ static int isr_rx_pdu(struct lll_scan *lll, struct lll_scan_aux *lll_aux, LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, lll_prof_latency_get()); } else { - LL_ASSERT(!radio_is_ready()); + LL_ASSERT_ERR(!radio_is_ready()); } if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { @@ -1421,7 +1421,7 @@ static void isr_tx(struct lll_scan_aux *lll_aux, void *pdu_rx, LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, lll_prof_latency_get()); } else { - LL_ASSERT(!radio_is_ready()); + LL_ASSERT_ERR(!radio_is_ready()); } if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { @@ -1484,7 +1484,7 @@ static void isr_tx_scan_req_ull_schedule(void *param) struct node_rx_pdu *node_rx; node_rx = ull_pdu_rx_alloc_peek(1); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); isr_tx(param, node_rx->pdu, isr_rx_ull_schedule, param); } @@ -1498,7 +1498,7 @@ static void isr_tx_scan_req_lll_schedule(void *param) lll = node_rx_adv->rx_ftr.param; node_rx = ull_pdu_rx_alloc_peek(1); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); isr_tx(lll->lll_aux, node_rx->pdu, isr_rx_lll_schedule, param); } @@ -1509,7 +1509,7 @@ static void isr_tx_connect_req(void *param) struct node_rx_pdu *node_rx; node_rx = ull_pdu_rx_alloc_peek(1); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); isr_tx(param, (void *)node_rx->pdu, isr_rx_connect_rsp, param); } @@ -1559,7 +1559,7 @@ static void isr_rx_connect_rsp(void *param) * release it if failed to receive AUX_CONNECT_RSP PDU. */ rx = lll_aux->node_conn_rx; - LL_ASSERT(rx); + LL_ASSERT_DBG(rx); lll_aux->node_conn_rx = NULL; #if defined(CONFIG_BT_CTLR_PRIVACY) @@ -1577,7 +1577,7 @@ static void isr_rx_connect_rsp(void *param) pdu_tx = radio_pkt_scratch_get(); node_rx = ull_pdu_rx_alloc_peek(1); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); pdu_rx = (void *)node_rx->pdu; trx_done = isr_rx_connect_rsp_check(lll, pdu_tx, pdu_rx, @@ -1660,7 +1660,7 @@ static void isr_rx_connect_rsp(void *param) /* Send message to flush Auxiliary PDU list */ node_rx = ull_pdu_rx_alloc(); - LL_ASSERT(node_rx); + LL_ASSERT_ERR(node_rx); node_rx->hdr.type = NODE_RX_TYPE_EXT_AUX_RELEASE; @@ -1713,7 +1713,7 @@ static void isr_early_abort(void *param) struct event_done_extra *e; e = ull_done_extra_type_set(EVENT_DONE_EXTRA_TYPE_SCAN_AUX); - LL_ASSERT(e); + LL_ASSERT_ERR(e); #if defined(CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS) e->lll = param; diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync.c index d549d914f591..fe5b9efdb989 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync.c @@ -101,11 +101,11 @@ void lll_sync_create_prepare(void *param) /* Request to start HF Clock */ err = lll_hfclock_on(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); /* Invoke common pipeline handling of prepare */ err = lll_prepare(is_abort_cb, abort_cb, create_prepare_cb, 0, param); - LL_ASSERT(!err || err == -EINPROGRESS); + LL_ASSERT_ERR(!err || err == -EINPROGRESS); } void lll_sync_prepare(void *param) @@ -114,11 +114,11 @@ void lll_sync_prepare(void *param) /* Request to start HF Clock */ err = lll_hfclock_on(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); /* Invoke common pipeline handling of prepare */ err = lll_prepare(is_abort_cb, abort_cb, prepare_cb, 0, param); - LL_ASSERT(err == 0 || err == -EINPROGRESS); + LL_ASSERT_ERR(err == 0 || err == -EINPROGRESS); } void lll_sync_aux_prepare_cb(struct lll_sync *lll, @@ -137,7 +137,7 @@ void lll_sync_aux_prepare_cb(struct lll_sync *lll, RADIO_PKT_CONF_PHY(lll_aux->phy)); node_rx = ull_pdu_rx_alloc_peek(1); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); radio_pkt_rx_set(node_rx->pdu); @@ -456,7 +456,7 @@ static int prepare_cb_common(struct lll_prepare_param *p, uint8_t chan_idx) lll_chan_set(chan_idx); node_rx = ull_pdu_rx_alloc_peek(1); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); radio_pkt_rx_set(node_rx->pdu); @@ -510,7 +510,7 @@ static int prepare_cb_common(struct lll_prepare_param *p, uint8_t chan_idx) #endif /* CONFIG_BT_CTLR_XTAL_ADVANCED */ ret = lll_prepare_done(lll); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); DEBUG_RADIO_START_O(1); @@ -617,7 +617,7 @@ static void abort_cb(struct lll_prepare_param *prepare_param, void *param) * currently in preparation pipeline. */ err = lll_hfclock_off(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); /* Get reference to LLL connection context */ lll = prepare_param->param; @@ -635,7 +635,7 @@ static void abort_cb(struct lll_prepare_param *prepare_param, void *param) /* Extra done event, to check sync lost */ e = ull_event_done_extra_get(); - LL_ASSERT(e); + LL_ASSERT_ERR(e); e->type = EVENT_DONE_EXTRA_TYPE_SYNC; e->trx_cnt = 0U; @@ -745,7 +745,7 @@ static void isr_aux_setup(void *param) aux_start_us -= EVENT_JITTER_US; start_us = radio_tmr_start_us(0, aux_start_us); - LL_ASSERT(start_us == (aux_start_us + 1U)); + LL_ASSERT_ERR(start_us == (aux_start_us + 1U)); /* Setup header complete timeout */ hcto = start_us; @@ -951,7 +951,7 @@ static void isr_rx_adv_sync_estab(void *param) /* TODO: Combine the early exit with above if-then-else block */ #if defined(CONFIG_BT_CTLR_DF_SCAN_CTE_RX) - LL_ASSERT(!lll->node_cte_incomplete); + LL_ASSERT_DBG(!lll->node_cte_incomplete); #endif /* CONFIG_BT_CTLR_DF_SCAN_CTE_RX */ goto isr_rx_done; @@ -1137,7 +1137,7 @@ static void isr_rx_aux_chain(void *param) * generated thereafter by HCI as incomplete. */ node_rx = ull_pdu_rx_alloc(); - LL_ASSERT(node_rx); + LL_ASSERT_ERR(node_rx); node_rx->hdr.type = NODE_RX_TYPE_EXT_AUX_RELEASE; @@ -1188,7 +1188,7 @@ static void isr_rx_done_cleanup(struct lll_sync *lll, uint8_t crc_ok, bool sync_ /* Calculate and place the drift information in done event */ e = ull_event_done_extra_get(); - LL_ASSERT(e); + LL_ASSERT_ERR(e); e->type = EVENT_DONE_EXTRA_TYPE_SYNC; e->trx_cnt = trx_cnt; @@ -1240,7 +1240,7 @@ static void isr_done(void *param) * generated thereafter by HCI as incomplete. */ node_rx = ull_pdu_rx_alloc(); - LL_ASSERT(node_rx); + LL_ASSERT_ERR(node_rx); node_rx->hdr.type = NODE_RX_TYPE_EXT_AUX_RELEASE; @@ -1325,7 +1325,7 @@ static int iq_report_create_put(struct lll_sync *lll, uint8_t rssi_ready, uint8_ if (!lll->is_cte_incomplete && is_max_cte_reached(cfg->max_cte_count, cfg->cte_count)) { iq_report = ull_df_iq_report_alloc(); - LL_ASSERT(iq_report); + LL_ASSERT_ERR(iq_report); iq_report_create(lll, rssi_ready, packet_status, cfg->slot_durations, iq_report); diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync_iso.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync_iso.c index 2083d8d7780a..d6931c9b7f59 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync_iso.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync_iso.c @@ -101,11 +101,11 @@ void lll_sync_iso_create_prepare(void *param) int err; err = lll_hfclock_on(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); err = lll_prepare(is_abort_cb, abort_cb, create_prepare_cb, 0U, param); - LL_ASSERT(err == 0 || err == -EINPROGRESS); + LL_ASSERT_ERR(err == 0 || err == -EINPROGRESS); } void lll_sync_iso_prepare(void *param) @@ -113,10 +113,10 @@ void lll_sync_iso_prepare(void *param) int err; err = lll_hfclock_on(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); err = lll_prepare(is_abort_cb, abort_cb, prepare_cb, 0U, param); - LL_ASSERT(err == 0 || err == -EINPROGRESS); + LL_ASSERT_ERR(err == 0 || err == -EINPROGRESS); } void lll_sync_iso_flush(uint8_t handle, struct lll_sync_iso *lll) @@ -288,7 +288,7 @@ static int prepare_cb_common(struct lll_prepare_param *p) #endif /* CONFIG_BT_CTLR_SYNC_ISO_INTERLEAVED */ } else { - LL_ASSERT(false); + LL_ASSERT_DBG(false); } } @@ -313,7 +313,7 @@ static int prepare_cb_common(struct lll_prepare_param *p) * setting up radio for new PDU reception. */ node_rx = ull_iso_pdu_rx_alloc_peek(1U); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); /* Encryption */ if (IS_ENABLED(CONFIG_BT_CTLR_BROADCAST_ISO_ENC) && @@ -400,7 +400,7 @@ static int prepare_cb_common(struct lll_prepare_param *p) #endif /* CONFIG_BT_CTLR_XTAL_ADVANCED */ ret = lll_prepare_done(lll); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); /* Calculate ahead the next subevent channel index */ if (false) { @@ -422,7 +422,7 @@ static int prepare_cb_common(struct lll_prepare_param *p) #endif /* CONFIG_BT_CTLR_SYNC_ISO_INTERLEAVED */ } else { - LL_ASSERT(false); + LL_ASSERT_DBG(false); } return 0; @@ -468,7 +468,7 @@ static void abort_cb(struct lll_prepare_param *prepare_param, void *param) * currently in preparation pipeline. */ err = lll_hfclock_off(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); /* Get reference to LLL connection context */ lll = prepare_param->param; @@ -486,7 +486,7 @@ static void abort_cb(struct lll_prepare_param *prepare_param, void *param) /* Extra done event, to check sync lost */ e = ull_event_done_extra_get(); - LL_ASSERT(e); + LL_ASSERT_ERR(e); e->type = EVENT_DONE_EXTRA_TYPE_SYNC_ISO; e->estab_failed = 0U; @@ -531,7 +531,7 @@ static void isr_rx_estab(void *param) * for new PDU reception. */ node_rx = ull_iso_pdu_rx_alloc_peek(1U); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); /* Get reference to received PDU and validate MIC for non-empty PDU */ pdu = (void *)node_rx->pdu; @@ -540,7 +540,7 @@ static void isr_rx_estab(void *param) uint32_t done; done = radio_ccm_is_done(); - LL_ASSERT(done); + LL_ASSERT_ERR(done); mic_failure = !radio_ccm_mic_is_valid(); if (mic_failure) { @@ -555,7 +555,7 @@ static void isr_rx_estab(void *param) /* Calculate and place the drift information in done event */ e = ull_event_done_extra_get(); - LL_ASSERT(e); + LL_ASSERT_ERR(e); e->type = EVENT_DONE_EXTRA_TYPE_SYNC_ISO_ESTAB; e->estab_failed = lll->term_reason ? 1U : 0U; @@ -659,7 +659,7 @@ static void isr_rx(void *param) } else { se_offset_us = 0U; - LL_ASSERT(false); + LL_ASSERT_DBG(false); } radio_tmr_aa_save(radio_tmr_aa_get() - se_offset_us); @@ -702,7 +702,7 @@ static void isr_rx(void *param) } node_rx = ull_iso_pdu_rx_alloc_peek(1U); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); pdu = (void *)node_rx->pdu; @@ -753,7 +753,7 @@ static void isr_rx(void *param) uint32_t done; done = radio_ccm_is_done(); - LL_ASSERT(done); + LL_ASSERT_ERR(done); mic_failure = !radio_ccm_mic_is_valid(); if (mic_failure) { @@ -850,7 +850,7 @@ static void isr_rx(void *param) * skip subevents as buffers at these high offset are unavailable. */ payload_offset = (lll->latency_event * lll->bn); - LL_ASSERT(payload_offset <= UINT8_MAX); + LL_ASSERT_ERR(payload_offset <= UINT8_MAX); /* Find the index of the (irc_curr)th bn = 1 Rx PDU * buffer. @@ -941,7 +941,7 @@ static void isr_rx(void *param) * these high offsets are unavailable. */ payload_offset = (lll->latency_event * lll->bn); - LL_ASSERT(payload_offset <= UINT8_MAX); + LL_ASSERT_ERR(payload_offset <= UINT8_MAX); /* Find the index of the (irc_curr)th bn = 1 Rx * PDU buffer. @@ -1062,7 +1062,7 @@ static void isr_rx(void *param) lll->bis_curr = sync_stream->bis_index; bis_idx = lll->bis_curr - 1U; } else { - LL_ASSERT(false); + LL_ASSERT_DBG(false); } } @@ -1261,7 +1261,7 @@ static void isr_rx(void *param) * available for setting up radio for new PDU reception. */ node_rx = ull_iso_pdu_rx_alloc_peek(1U); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); pdu = (void *)node_rx->pdu; } else { @@ -1288,7 +1288,7 @@ static void isr_rx(void *param) * available for setting up radio for new PDU reception. */ node_rx = ull_iso_pdu_rx_alloc_peek(1U); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); pdu = (void *)node_rx->pdu; } else { @@ -1331,7 +1331,7 @@ static void isr_rx(void *param) nse = 0U; hcto = 0U; - LL_ASSERT(false); + LL_ASSERT_DBG(false); } if (trx_cnt) { @@ -1361,7 +1361,7 @@ static void isr_rx(void *param) overhead_us += radio_rx_chain_delay_get(lll->phy, PHY_FLAGS_S8); /* Add base clock jitter overhead */ overhead_us += (EVENT_CLOCK_JITTER_US << 1); - LL_ASSERT(EVENT_IFS_US > overhead_us); + LL_ASSERT_DBG(EVENT_IFS_US > overhead_us); /* Max. available clock jitter */ jitter_max_us = (EVENT_IFS_US - overhead_us) >> 1; @@ -1376,13 +1376,13 @@ static void isr_rx(void *param) jitter_us = jitter_max_us; } - LL_ASSERT(hcto > jitter_us); + LL_ASSERT_DBG(hcto > jitter_us); hcto -= jitter_us; start_us = hcto; hcto = radio_tmr_start_us(0U, start_us); - LL_ASSERT(hcto == (start_us + 1U)); + LL_ASSERT_ERR(hcto == (start_us + 1U)); /* Add 8 us * subevents so far, as radio was setup to listen * 4 us early and subevents could have a 4 us drift each until @@ -1399,7 +1399,7 @@ static void isr_rx(void *param) start_us = hcto; hcto = radio_tmr_start_us(0U, start_us); - LL_ASSERT(hcto == (start_us + 1U)); + LL_ASSERT_ERR(hcto == (start_us + 1U)); hcto += ((EVENT_JITTER_US + EVENT_TICKER_RES_MARGIN_US + lll->window_widening_event_us) << 1) + @@ -1448,7 +1448,7 @@ static void isr_rx(void *param) #endif /* CONFIG_BT_CTLR_SYNC_ISO_INTERLEAVED */ } else { - LL_ASSERT(false); + LL_ASSERT_DBG(false); } if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { @@ -1546,7 +1546,7 @@ static void isr_rx_done(void *param) } e = ull_event_done_extra_get(); - LL_ASSERT(e); + LL_ASSERT_ERR(e); /* Check if BIG terminate procedure received */ if (lll->term_reason) { diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_test.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_test.c index 9715b934e5e8..c724bd08e0bb 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_test.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_test.c @@ -238,7 +238,7 @@ static void isr_rx(void *param) if (test_cte_len > 0) { /* Get free iq report node for next Rx operation. */ node_rx = ull_df_iq_report_alloc_peek(1); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); radio_df_iq_data_packet_set(node_rx->pdu, IQ_SAMPLE_TOTAL_CNT); } @@ -435,7 +435,7 @@ static uint8_t cte_rx_init(uint8_t expected_cte_len, uint8_t expected_cte_type, struct node_rx_iq_report *node_rx; node_rx = ull_df_iq_report_alloc_peek(1); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); radio_df_iq_data_packet_set(node_rx->pdu, IQ_SAMPLE_TOTAL_CNT); #else @@ -498,7 +498,7 @@ static uint8_t init(uint8_t chan, uint8_t phy, int8_t tx_power, /* Setup resources required by Radio */ err = lll_hfclock_on_wait(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); /* Reset Radio h/w */ radio_reset(); @@ -744,7 +744,7 @@ uint8_t ll_test_end(uint16_t *num_rx) /* Release resources acquired for Radio */ err = lll_hfclock_off(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); /* Stop coarse timer */ cntr_stop(); diff --git a/subsys/bluetooth/controller/ll_sw/ull.c b/subsys/bluetooth/controller/ll_sw/ull.c index bf15820ecd6d..4ff06e60fda9 100644 --- a/subsys/bluetooth/controller/ll_sw/ull.c +++ b/subsys/bluetooth/controller/ll_sw/ull.c @@ -627,7 +627,7 @@ int ll_init(struct k_sem *sem_rx) hal_ticker_instance0_caller_id_get, hal_ticker_instance0_sched, hal_ticker_instance0_trigger_set); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); /* Initialize semaphore for ticker API blocking wait */ k_sem_init(&sem_ticker_api_cb, 0, 1); @@ -816,12 +816,12 @@ void ll_reset(void) #if defined(CONFIG_BT_CTLR_ADV_ISO) /* Reset adv iso sets */ err = ull_adv_iso_reset(); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); #endif /* CONFIG_BT_CTLR_ADV_ISO */ /* Reset adv state */ err = ull_adv_reset(); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); #endif /* CONFIG_BT_BROADCASTER */ #if defined(CONFIG_BT_OBSERVER) @@ -829,43 +829,43 @@ void ll_reset(void) #if defined(CONFIG_BT_CTLR_SYNC_ISO) /* Reset sync iso sets */ err = ull_sync_iso_reset(); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); #endif /* CONFIG_BT_CTLR_SYNC_ISO */ /* Reset periodic sync sets */ err = ull_sync_reset(); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); #endif /* CONFIG_BT_CTLR_SYNC_PERIODIC */ /* Reset scan state */ err = ull_scan_reset(); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); #endif /* CONFIG_BT_OBSERVER */ #if defined(CONFIG_BT_CTLR_PERIPHERAL_ISO) err = ull_peripheral_iso_reset(); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); #endif /* CONFIG_BT_CTLR_PERIPHERAL_ISO */ #if defined(CONFIG_BT_CTLR_CENTRAL_ISO) err = ull_central_iso_reset(); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); #endif /* CONFIG_BT_CTLR_CENTRAL_ISO */ #if defined(CONFIG_BT_CTLR_CONN_ISO) err = ull_conn_iso_reset(); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); #endif /* CONFIG_BT_CTLR_CONN_ISO */ #if defined(CONFIG_BT_CTLR_ISO) err = ull_iso_reset(); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); #endif /* CONFIG_BT_CTLR_ISO */ #if defined(CONFIG_BT_CONN) /* Reset conn role */ err = ull_conn_reset(); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); MFIFO_INIT(tx_ack); #endif /* CONFIG_BT_CONN */ @@ -912,7 +912,7 @@ void ll_reset(void) retval = mayfly_enqueue(TICKER_USER_ID_THREAD, TICKER_USER_ID_LLL, 0, &mfy); - LL_ASSERT(!retval); + LL_ASSERT_ERR(!retval); #if !defined(CONFIG_BT_CTLR_ZLI) /* LLL reset must complete before returning - wait for @@ -925,7 +925,7 @@ void ll_reset(void) #if defined(CONFIG_BT_BROADCASTER) /* Finalize after adv state LLL context reset */ err = ull_adv_reset_finalize(); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); #endif /* CONFIG_BT_BROADCASTER */ /* Reset/End DTM Tx or Rx commands */ @@ -938,7 +938,7 @@ void ll_reset(void) /* Common to init and reset */ err = init_reset(); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); #if defined(CONFIG_BT_CTLR_DF) /* Direction Finding has to be reset after ull init_reset call because @@ -946,7 +946,7 @@ void ll_reset(void) * in common ull init_reset. */ err = ull_df_reset(); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); #endif #if defined(CONFIG_BT_CTLR_SET_HOST_FEATURE) @@ -1101,7 +1101,7 @@ void ll_rx_dequeue(void) link = memq_dequeue(memq_ll_rx.tail, &memq_ll_rx.head, (void **)&rx); - LL_ASSERT(link); + LL_ASSERT_DBG(link); ll_rx_link_release(link); @@ -1129,7 +1129,7 @@ void ll_rx_dequeue(void) while (rx_curr) { memq_link_t *link_free; - LL_ASSERT(loop); + LL_ASSERT_ERR(loop); loop--; link_free = rx_curr->hdr.link; @@ -1154,7 +1154,7 @@ void ll_rx_dequeue(void) struct lll_adv_aux *lll_aux; adv = ull_adv_set_get(rx->hdr.handle); - LL_ASSERT(adv); + LL_ASSERT_DBG(adv); lll_aux = adv->lll.aux; if (lll_aux) { @@ -1174,11 +1174,11 @@ void ll_rx_dequeue(void) break; } - LL_ASSERT(!lll_conn->link_tx_free); + LL_ASSERT_DBG(!lll_conn->link_tx_free); memq_link_t *memq_link = memq_deinit(&lll_conn->memq_tx.head, &lll_conn->memq_tx.tail); - LL_ASSERT(memq_link); + LL_ASSERT_DBG(memq_link); lll_conn->link_tx_free = memq_link; @@ -1223,13 +1223,13 @@ void ll_rx_dequeue(void) memq_link_t *memq_link; conn_lll = lll->conn; - LL_ASSERT(conn_lll); + LL_ASSERT_DBG(conn_lll); lll->conn = NULL; - LL_ASSERT(!conn_lll->link_tx_free); + LL_ASSERT_DBG(!conn_lll->link_tx_free); memq_link = memq_deinit(&conn_lll->memq_tx.head, &conn_lll->memq_tx.tail); - LL_ASSERT(memq_link); + LL_ASSERT_DBG(memq_link); conn_lll->link_tx_free = memq_link; conn = HDR_LLL2ULL(conn_lll); @@ -1294,7 +1294,7 @@ void ll_rx_dequeue(void) scan->is_enabled = 0U; #else /* !CONFIG_BT_CENTRAL */ } else { - LL_ASSERT(0); + LL_ASSERT_DBG(0); #endif /* !CONFIG_BT_CENTRAL */ } @@ -1416,11 +1416,11 @@ void ll_rx_dequeue(void) * code block. */ case NODE_RX_TYPE_NONE: - LL_ASSERT(rx->hdr.type != NODE_RX_TYPE_NONE); + LL_ASSERT_DBG(rx->hdr.type != NODE_RX_TYPE_NONE); break; default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } @@ -1432,11 +1432,11 @@ void ll_rx_dequeue(void) struct ll_scan_set *scan; adv = ull_adv_is_enabled_get(0); - LL_ASSERT(adv); + LL_ASSERT_DBG(adv); adv->is_enabled = 0U; scan = ull_scan_is_enabled_get(0); - LL_ASSERT(scan); + LL_ASSERT_DBG(scan); scan->is_enabled = 0U; @@ -1520,7 +1520,7 @@ void ll_rx_mem_release(void **node_rx) #endif /* CONFIG_BT_CENTRAL */ } else { - LL_ASSERT(!cc->status); + LL_ASSERT_DBG(!cc->status); } } @@ -1607,7 +1607,7 @@ void ll_rx_mem_release(void **node_rx) * code block. */ case NODE_RX_TYPE_NONE: - LL_ASSERT(rx_free->hdr.type != NODE_RX_TYPE_NONE); + LL_ASSERT_DBG(rx_free->hdr.type != NODE_RX_TYPE_NONE); ll_rx_link_quota_inc(); ll_rx_release(rx_free); break; @@ -1652,7 +1652,7 @@ void ll_rx_mem_release(void **node_rx) break; } else { - LL_ASSERT(status == BT_HCI_ERR_OP_CANCELLED_BY_HOST); + LL_ASSERT_DBG(status == BT_HCI_ERR_OP_CANCELLED_BY_HOST); /* Fall through and release sync context */ } @@ -1716,12 +1716,12 @@ void ll_rx_mem_release(void **node_rx) memq_link_t *link; conn = ll_conn_get(rx_free->hdr.handle); - LL_ASSERT(conn != NULL); + LL_ASSERT_DBG(conn != NULL); - LL_ASSERT(!conn->lll.link_tx_free); + LL_ASSERT_DBG(!conn->lll.link_tx_free); link = memq_deinit(&conn->lll.memq_tx.head, &conn->lll.memq_tx.tail); - LL_ASSERT(link); + LL_ASSERT_DBG(link); conn->lll.link_tx_free = link; ll_conn_release(conn); @@ -1735,7 +1735,7 @@ void ll_rx_mem_release(void **node_rx) case NODE_RX_TYPE_EVENT_DONE: default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } } @@ -1747,7 +1747,7 @@ void ll_rx_mem_release(void **node_rx) static void ll_rx_link_quota_update(int8_t delta) { - LL_ASSERT(delta <= 0 || mem_link_rx.quota_pdu < RX_CNT); + LL_ASSERT_DBG(delta <= 0 || mem_link_rx.quota_pdu < RX_CNT); mem_link_rx.quota_pdu += delta; } @@ -1837,7 +1837,7 @@ void ll_tx_ack_put(uint16_t handle, struct node_tx *node_tx) uint8_t idx; idx = MFIFO_ENQUEUE_GET(tx_ack, (void **)&tx); - LL_ASSERT(tx); + LL_ASSERT_ERR(tx); tx->handle = handle; tx->node = node_tx; @@ -1868,7 +1868,7 @@ void ll_radio_state_abort(void) ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } uint32_t ll_radio_state_is_idle(void) @@ -2053,7 +2053,7 @@ int ull_disable(void *lll) mfy.param = lll; ret = mayfly_enqueue(TICKER_USER_ID_THREAD, TICKER_USER_ID_LLL, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); err = k_sem_take(&sem, ULL_DISABLE_TIMEOUT); if (err != 0) { @@ -2195,7 +2195,7 @@ void ull_prepare_dequeue(uint8_t caller_id) /* Assert if we exceed iterations processing the prepare queue */ - LL_ASSERT(loop); + LL_ASSERT_ERR(loop); loop--; /* Let LLL invoke the `prepare` interface if radio not in active @@ -2210,7 +2210,7 @@ void ull_prepare_dequeue(uint8_t caller_id) mfy.param = next; ret = mayfly_enqueue(caller_id, TICKER_USER_ID_LLL, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } MFIFO_DEQUEUE(prep); @@ -2391,14 +2391,14 @@ static inline int init_reset(void) /* Acquire a link to initialize ull rx memq */ link = mem_acquire(&mem_link_rx.free); - LL_ASSERT(link); + LL_ASSERT_DBG(link); /* Initialize ull rx memq */ MEMQ_INIT(ull_rx, link); /* Acquire a link to initialize ll rx memq */ link = mem_acquire(&mem_link_rx.free); - LL_ASSERT(link); + LL_ASSERT_DBG(link); /* Initialize ll rx memq */ MEMQ_INIT(ll_rx, link); @@ -2428,29 +2428,29 @@ static void perform_lll_reset(void *param) /* Reset LLL */ err = lll_reset(); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); #if defined(CONFIG_BT_BROADCASTER) /* Reset adv state */ err = lll_adv_reset(); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); #endif /* CONFIG_BT_BROADCASTER */ #if defined(CONFIG_BT_OBSERVER) /* Reset scan state */ err = lll_scan_reset(); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); #endif /* CONFIG_BT_OBSERVER */ #if defined(CONFIG_BT_CONN) /* Reset conn role */ err = lll_conn_reset(); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); #endif /* CONFIG_BT_CONN */ #if defined(CONFIG_BT_CTLR_DF) err = lll_df_reset(); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); #endif /* CONFIG_BT_CTLR_DF */ #if !defined(CONFIG_BT_CTLR_ZLI) @@ -2611,7 +2611,7 @@ static void rx_demux(void *param) link = memq_peek(memq_ull_rx.head, memq_ull_rx.tail, (void **)&rx); if (link) { - LL_ASSERT(rx); + LL_ASSERT_DBG(rx); #if defined(CONFIG_BT_CONN) link_tx = ull_conn_ack_by_last_peek(rx->ack_last, &handle, &tx); @@ -2910,7 +2910,7 @@ static inline void rx_demux_rx(memq_link_t *link, struct node_rx_hdr *rx) (void)memq_dequeue(memq_ull_rx.tail, &memq_ull_rx.head, NULL); conn = ll_conn_get(rx->handle); - LL_ASSERT(conn != NULL); + LL_ASSERT_DBG(conn != NULL); if (ull_cp_cc_awaiting_established(conn)) { ull_cp_cc_established(conn, BT_HCI_ERR_SUCCESS); @@ -3021,7 +3021,7 @@ static inline void rx_demux_rx(memq_link_t *link, struct node_rx_hdr *rx) rx_demux_rx_proprietary(link, rx, memq_ull_rx.tail, &memq_ull_rx.head); #else - LL_ASSERT(0); + LL_ASSERT_DBG(0); #endif /* CONFIG_BT_CTLR_USER_EXT */ } break; @@ -3037,7 +3037,7 @@ static inline void rx_demux_event_done(memq_link_t *link, /* Decrement prepare reference if ULL will not resume */ ull_hdr = done->param; if (ull_hdr) { - LL_ASSERT(ull_ref_get(ull_hdr)); + LL_ASSERT_DBG(ull_ref_get(ull_hdr)); ull_ref_dec(ull_hdr); } else { /* No reference count decrement, event placed back as resume event in the pipeline. @@ -3127,14 +3127,14 @@ static inline void rx_demux_event_done(memq_link_t *link, break; default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } /* Release done */ done->extra.type = 0U; release = RXFIFO_RELEASE(done, link, done); - LL_ASSERT(release == done); + LL_ASSERT_DBG(release == done); #if defined(CONFIG_BT_CTLR_LOW_LAT_ULL_DONE) /* dequeue prepare pipeline */ @@ -3218,7 +3218,7 @@ void *ull_rxfifo_release(uint8_t s, uint8_t n, uint8_t f, uint8_t *l, uint8_t *m */ uint32_t ull_get_wrapped_time_us(uint32_t time_now_us, int32_t time_diff_us) { - LL_ASSERT(time_now_us <= ULL_TIME_WRAPPING_POINT_US); + LL_ASSERT_DBG(time_now_us <= ULL_TIME_WRAPPING_POINT_US); uint32_t result = ((uint64_t)time_now_us + ULL_TIME_SPAN_FULL_US + time_diff_us) % ((uint64_t)ULL_TIME_SPAN_FULL_US); diff --git a/subsys/bluetooth/controller/ll_sw/ull_adv.c b/subsys/bluetooth/controller/ll_sw/ull_adv.c index 18f3f24b11db..f9f1ee78afe4 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_adv.c +++ b/subsys/bluetooth/controller/ll_sw/ull_adv.c @@ -206,7 +206,7 @@ uint8_t ll_adv_set_hci_handle_get(uint8_t handle) struct ll_adv_set *adv; adv = ull_adv_set_get(handle); - LL_ASSERT(adv && adv->is_created); + LL_ASSERT_DBG(adv && adv->is_created); return adv->hci_handle; } @@ -442,8 +442,8 @@ uint8_t ll_adv_params_set(uint16_t interval, uint8_t adv_type, if (pdu->len == 0U) { adv->ad_data_backup.len = 0U; } else { - LL_ASSERT(pdu->len >= - offsetof(struct pdu_adv_adv_ind, data)); + LL_ASSERT_DBG(pdu->len >= + offsetof(struct pdu_adv_adv_ind, data)); adv->ad_data_backup.len = pdu->len - offsetof(struct pdu_adv_adv_ind, data); @@ -1970,9 +1970,9 @@ static uint32_t ticker_update_rand(struct ll_adv_set *adv, uint32_t ticks_delay_ ticks_adjust_minus, 0, 0, 0, 0, fp_op_func, adv); - LL_ASSERT((ret == TICKER_STATUS_SUCCESS) || - (ret == TICKER_STATUS_BUSY) || - (fp_op_func == NULL)); + LL_ASSERT_ERR((ret == TICKER_STATUS_SUCCESS) || + (ret == TICKER_STATUS_BUSY) || + (fp_op_func == NULL)); return random_delay; } @@ -2090,7 +2090,7 @@ void ull_adv_done(struct node_rx_event_done *done) } handle = ull_adv_handle_get(adv); - LL_ASSERT(handle < BT_CTLR_ADV_SET); + LL_ASSERT_DBG(handle < BT_CTLR_ADV_SET); rx->hdr.type = NODE_RX_TYPE_EXT_ADV_TERMINATE; rx->hdr.handle = handle; @@ -2115,8 +2115,8 @@ void ull_adv_done(struct node_rx_event_done *done) ticker_stop_ext_op_cb, adv); } - LL_ASSERT((ret == TICKER_STATUS_SUCCESS) || - (ret == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ret == TICKER_STATUS_SUCCESS) || + (ret == TICKER_STATUS_BUSY)); #endif /* CONFIG_BT_CTLR_ADV_EXT */ } #endif /* CONFIG_BT_CTLR_ADV_EXT || CONFIG_BT_CTLR_JIT_SCHEDULING */ @@ -2369,7 +2369,7 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, (lazy != TICKER_LAZY_MUST_EXPIRE)) { /* Increment prepare reference count */ ref = ull_ref_inc(&adv->ull); - LL_ASSERT(ref); + LL_ASSERT_DBG(ref); #if defined(CONFIG_BT_CTLR_ADV_EXT) && (CONFIG_BT_CTLR_ADV_AUX_SET > 0) && \ defined(CONFIG_BT_TICKER_EXT_EXPIRE_INFO) @@ -2377,7 +2377,7 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, uint32_t ticks_to_expire; uint32_t other_remainder = 0U; - LL_ASSERT(context->other_expire_info); + LL_ASSERT_DBG(context->other_expire_info); /* Adjust ticks to expire based on remainder value */ ticks_to_expire = context->other_expire_info->ticks_to_expire; @@ -2405,7 +2405,7 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, /* Kick LLL prepare */ ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); #if defined(CONFIG_BT_CTLR_JIT_SCHEDULING) || \ (defined(CONFIG_BT_CTLR_ADV_EXT) && \ @@ -2496,7 +2496,7 @@ static void ticker_update_op_cb(uint32_t status, void *param) /* Reset update requested */ ticker_update_ack = ticker_update_req; -#if defined(CONFIG_BT_PERIPHERAL) && (defined(CONFIG_BT_ASSERT) || defined(CONFIG_ASSERT)) +#if defined(CONFIG_BT_PERIPHERAL) struct ll_adv_set *adv = param; struct pdu_adv *pdu = lll_adv_data_peek(&adv->lll); bool connectable = (pdu->type == PDU_ADV_TYPE_ADV_IND) || @@ -2508,13 +2508,13 @@ static void ticker_update_op_cb(uint32_t status, void *param) 0; #endif /* CONFIG_BT_PERIPHERAL && (CONFIG_BT_ASSERT || CONFIG_ASSERT) */ - LL_ASSERT(status == TICKER_STATUS_SUCCESS || - param == ull_disable_mark_get() || + LL_ASSERT_ERR((status == TICKER_STATUS_SUCCESS) || + (param == ull_disable_mark_get()) || #if defined(CONFIG_BT_PERIPHERAL) - /* if using connectable adv and lll.conn is 0 -> a connection is underway */ - (connectable && !adv->lll.conn) || + /* if using connectable adv and lll.conn is 0 -> a connection is underway */ + (connectable && !adv->lll.conn) || #endif /* CONFIG_BT_PERIPHERAL */ - 0); + 0); } #if defined(CONFIG_BT_PERIPHERAL) @@ -2527,13 +2527,13 @@ static void ticker_stop_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, uint32_t ret; handle = ull_adv_handle_get(adv); - LL_ASSERT(handle < BT_CTLR_ADV_SET); + LL_ASSERT_DBG(handle < BT_CTLR_ADV_SET); ret = ticker_stop(TICKER_INSTANCE_ID_CTLR, TICKER_USER_ID_ULL_HIGH, TICKER_ID_ADV_BASE + handle, ticker_stop_op_cb, adv); - LL_ASSERT((ret == TICKER_STATUS_SUCCESS) || - (ret == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ret == TICKER_STATUS_SUCCESS) || + (ret == TICKER_STATUS_BUSY)); } static void ticker_stop_op_cb(uint32_t status, void *param) @@ -2560,7 +2560,7 @@ static void ticker_stop_op_cb(uint32_t status, void *param) mfy.param = param; ret = mayfly_enqueue(TICKER_USER_ID_ULL_LOW, TICKER_USER_ID_ULL_HIGH, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } static void adv_disable(void *param) @@ -2581,14 +2581,14 @@ static void adv_disable(void *param) /* Setup disabled callback to be called when ref count * returns to zero. */ - LL_ASSERT(!hdr->disabled_cb); + LL_ASSERT_ERR(!hdr->disabled_cb); hdr->disabled_param = mfy.param; hdr->disabled_cb = disabled_cb; /* Trigger LLL disable */ ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } else { /* No pending LLL events */ disabled_cb(&adv->lll); @@ -2604,11 +2604,11 @@ static void disabled_cb(void *param) adv = ((struct lll_hdr *)param)->parent; - LL_ASSERT(adv->link_cc_free); + LL_ASSERT_DBG(adv->link_cc_free); link = adv->link_cc_free; adv->link_cc_free = NULL; - LL_ASSERT(adv->node_rx_cc_free); + LL_ASSERT_DBG(adv->node_rx_cc_free); rx = adv->node_rx_cc_free; adv->node_rx_cc_free = NULL; @@ -2628,7 +2628,7 @@ static void disabled_cb(void *param) ll_rx_put(link, rx); handle = ull_adv_handle_get(adv); - LL_ASSERT(handle < BT_CTLR_ADV_SET); + LL_ASSERT_DBG(handle < BT_CTLR_ADV_SET); rx = (void *)adv->lll.node_rx_adv_term; rx->hdr.type = NODE_RX_TYPE_EXT_ADV_TERMINATE; @@ -2649,9 +2649,9 @@ static void conn_release(struct ll_adv_set *adv) struct lll_conn *lll = adv->lll.conn; memq_link_t *link; - LL_ASSERT(!lll->link_tx_free); + LL_ASSERT_DBG(!lll->link_tx_free); link = memq_deinit(&lll->memq_tx.head, &lll->memq_tx.tail); - LL_ASSERT(link); + LL_ASSERT_DBG(link); lll->link_tx_free = link; ll_conn_release(lll->hdr.parent); @@ -2702,13 +2702,13 @@ static void ticker_stop_aux_op_cb(uint32_t status, void *param) static struct mayfly mfy = {0, 0, &link, NULL, aux_disable}; uint32_t ret; - LL_ASSERT(status == TICKER_STATUS_SUCCESS); + LL_ASSERT_ERR(status == TICKER_STATUS_SUCCESS); /* Check if any pending LLL events that need to be aborted */ mfy.param = param; ret = mayfly_enqueue(TICKER_USER_ID_ULL_LOW, TICKER_USER_ID_ULL_HIGH, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } static void aux_disable(void *param) @@ -2723,7 +2723,7 @@ static void aux_disable(void *param) aux = HDR_LLL2ULL(lll_aux); hdr = &aux->ull; if (ull_ref_get(hdr)) { - LL_ASSERT(!hdr->disabled_cb); + LL_ASSERT_ERR(!hdr->disabled_cb); hdr->disabled_param = adv; hdr->disabled_cb = aux_disabled_cb; } else { @@ -2741,8 +2741,8 @@ static void aux_disabled_cb(void *param) TICKER_USER_ID_ULL_HIGH, (TICKER_ID_ADV_BASE + handle), ticker_stop_ext_op_cb, param); - LL_ASSERT((ret == TICKER_STATUS_SUCCESS) || - (ret == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ret == TICKER_STATUS_SUCCESS) || + (ret == TICKER_STATUS_BUSY)); } static void ticker_stop_ext_op_cb(uint32_t status, void *param) @@ -2762,7 +2762,7 @@ static void ticker_stop_ext_op_cb(uint32_t status, void *param) mfy.param = param; ret = mayfly_enqueue(TICKER_USER_ID_ULL_LOW, TICKER_USER_ID_ULL_HIGH, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } static void ext_disable(void *param) @@ -2783,14 +2783,14 @@ static void ext_disable(void *param) /* Setup disabled callback to be called when ref count * returns to zero. */ - LL_ASSERT(!hdr->disabled_cb); + LL_ASSERT_ERR(!hdr->disabled_cb); hdr->disabled_param = mfy.param; hdr->disabled_cb = ext_disabled_cb; /* Trigger LLL disable */ ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } else { /* No pending LLL events */ ext_disabled_cb(&adv->lll); @@ -2852,7 +2852,7 @@ static inline uint8_t disable(uint8_t handle) #endif /* CONFIG_BT_PERIPHERAL */ mark = ull_disable_mark(adv); - LL_ASSERT(mark == adv); + LL_ASSERT_DBG(mark == adv); #if defined(CONFIG_BT_PERIPHERAL) if (adv->lll.is_hdcd) { @@ -2863,7 +2863,7 @@ static inline uint8_t disable(uint8_t handle) ret = ull_ticker_status_take(ret, &ret_cb); if (ret) { mark = ull_disable_unmark(adv); - LL_ASSERT(mark == adv); + LL_ASSERT_DBG(mark == adv); return BT_HCI_ERR_CMD_DISALLOWED; } @@ -2877,16 +2877,16 @@ static inline uint8_t disable(uint8_t handle) ret = ull_ticker_status_take(ret, &ret_cb); if (ret) { mark = ull_disable_unmark(adv); - LL_ASSERT(mark == adv); + LL_ASSERT_DBG(mark == adv); return BT_HCI_ERR_CMD_DISALLOWED; } err = ull_disable(&adv->lll); - LL_ASSERT(!err || (err == -EALREADY)); + LL_ASSERT_ERR(!err || (err == -EALREADY)); mark = ull_disable_unmark(adv); - LL_ASSERT(mark == adv); + LL_ASSERT_DBG(mark == adv); #if defined(CONFIG_BT_CTLR_ADV_EXT) && (CONFIG_BT_CTLR_ADV_AUX_SET > 0) struct lll_adv_aux *lll_aux = adv->lll.aux; @@ -3043,7 +3043,7 @@ static inline uint8_t *adv_pdu_adva_get(struct pdu_adv *pdu) /* All extended PDUs have AdvA at the same offset in common header */ if (pdu->type == PDU_ADV_TYPE_EXT_IND) { - LL_ASSERT(hdr_flags.adv_addr); + LL_ASSERT_DBG(hdr_flags.adv_addr); return &com_hdr->ext_hdr_adv_data[1]; } diff --git a/subsys/bluetooth/controller/ll_sw/ull_adv_aux.c b/subsys/bluetooth/controller/ll_sw/ull_adv_aux.c index d77c004069e0..8701f3f65fa9 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_adv_aux.c +++ b/subsys/bluetooth/controller/ll_sw/ull_adv_aux.c @@ -256,7 +256,7 @@ uint8_t ll_adv_aux_ad_data_set(uint8_t handle, uint8_t op, uint8_t frag_pref, /* Get the reference to auxiliary PDU chain */ pdu_prev = lll_adv_aux_data_alloc(adv->lll.aux, &idx); - LL_ASSERT(idx == sec_idx); + LL_ASSERT_DBG(idx == sec_idx); /* Current auxiliary PDU */ pdu = pdu_prev; @@ -269,7 +269,7 @@ uint8_t ll_adv_aux_ad_data_set(uint8_t handle, uint8_t op, uint8_t frag_pref, pdu_parent = lll_adv_aux_data_alloc(adv->lll.aux, &idx); - LL_ASSERT(idx == sec_idx); + LL_ASSERT_DBG(idx == sec_idx); /* Remove/Release any previous chain PDU * allocations @@ -340,7 +340,7 @@ uint8_t ll_adv_aux_ad_data_set(uint8_t handle, uint8_t op, uint8_t frag_pref, 0U, hdr_data); ad_len_prev = hdr_data[ULL_ADV_HDR_DATA_LEN_OFFSET]; - LL_ASSERT(!err || (err == BT_HCI_ERR_PACKET_TOO_LONG)); + LL_ASSERT_DBG(!err || (err == BT_HCI_ERR_PACKET_TOO_LONG)); /* Check of max supported AD data len */ ad_len_total += ad_len_prev; @@ -363,8 +363,8 @@ uint8_t ll_adv_aux_ad_data_set(uint8_t handle, uint8_t op, uint8_t frag_pref, pdu_chain_prev = lll_adv_pdu_linked_next_get(pdu_prev); pdu_chain = lll_adv_pdu_linked_next_get(pdu); - LL_ASSERT((pdu_chain_prev && pdu_chain) || - (!pdu_chain_prev && !pdu_chain)); + LL_ASSERT_DBG((pdu_chain_prev && pdu_chain) || + (!pdu_chain_prev && !pdu_chain)); } while (pdu_chain_prev); /* No AD data overflow */ @@ -408,7 +408,7 @@ uint8_t ll_adv_aux_ad_data_set(uint8_t handle, uint8_t op, uint8_t frag_pref, ULL_ADV_PDU_HDR_FIELD_AD_DATA_APPEND, 0U, hdr_data); - LL_ASSERT((!chain_err) || (chain_err == BT_HCI_ERR_PACKET_TOO_LONG)); + LL_ASSERT_DBG((!chain_err) || (chain_err == BT_HCI_ERR_PACKET_TOO_LONG)); /* FIXME: the code has become quite complex, an alternative and simpler * implementation would be to first fill an array with all data that @@ -456,7 +456,7 @@ uint8_t ll_adv_aux_ad_data_set(uint8_t handle, uint8_t op, uint8_t frag_pref, chain_err = ull_adv_aux_pdu_set_clear(adv, pdu_prev, pdu, chain_add_fields, 0U, hdr_data); - LL_ASSERT(chain_err == 0U); + LL_ASSERT_DBG(chain_err == 0U); /* * in the next PDU we still need to add ad_len_chain bytes of data * but we do not have overflow, since we already added @@ -495,7 +495,7 @@ uint8_t ll_adv_aux_ad_data_set(uint8_t handle, uint8_t op, uint8_t frag_pref, /* Allocate new PDU */ pdu_chain = lll_adv_pdu_alloc_pdu_adv(); - LL_ASSERT(pdu_chain); + LL_ASSERT_ERR(pdu_chain); /* Populate the appended chain PDU */ pdu_chain->type = PDU_ADV_TYPE_AUX_CHAIN_IND; @@ -509,7 +509,8 @@ uint8_t ll_adv_aux_ad_data_set(uint8_t handle, uint8_t op, uint8_t frag_pref, hdr_chain = (void *)&com_hdr_chain->ext_hdr_adv_data[0]; dptr_chain = (void *)hdr_chain; - LL_ASSERT(dptr_chain); + LL_ASSERT_DBG(dptr_chain); + /* Flags */ *dptr_chain = 0U; @@ -781,7 +782,7 @@ uint8_t ll_adv_aux_sr_data_set(uint8_t handle, uint8_t op, uint8_t frag_pref, } /* Scannable advertising shall have aux context allocated */ - LL_ASSERT(lll->aux); + LL_ASSERT_DBG(lll->aux); /* Get reference to previous secondary channel PDU */ sec_pdu_prev = lll_adv_aux_data_peek(lll->aux); @@ -1046,7 +1047,7 @@ uint8_t ll_adv_aux_sr_data_set(uint8_t handle, uint8_t op, uint8_t frag_pref, err = ull_adv_aux_pdu_set_clear(adv, sr_pdu_prev, sr_pdu, hdr_add_fields, 0U, hdr_data); - LL_ASSERT(!err || (err == BT_HCI_ERR_PACKET_TOO_LONG)); + LL_ASSERT_DBG(!err || (err == BT_HCI_ERR_PACKET_TOO_LONG)); /* Get PDUs previous AD data length */ ad_len_prev = @@ -1073,8 +1074,8 @@ uint8_t ll_adv_aux_sr_data_set(uint8_t handle, uint8_t op, uint8_t frag_pref, pdu_chain_prev = lll_adv_pdu_linked_next_get(sr_pdu_prev); pdu_chain = lll_adv_pdu_linked_next_get(sr_pdu); - LL_ASSERT((pdu_chain_prev && pdu_chain) || - (!pdu_chain_prev && !pdu_chain)); + LL_ASSERT_DBG((pdu_chain_prev && pdu_chain) || + (!pdu_chain_prev && !pdu_chain)); } while (pdu_chain_prev); if (err == BT_HCI_ERR_PACKET_TOO_LONG) { @@ -1141,7 +1142,7 @@ uint8_t ll_adv_aux_sr_data_set(uint8_t handle, uint8_t op, uint8_t frag_pref, /* Allocate new PDU */ pdu_chain = lll_adv_pdu_alloc_pdu_adv(); - LL_ASSERT(pdu_chain); + LL_ASSERT_ERR(pdu_chain); /* Populate the appended chain PDU */ pdu_chain->type = PDU_ADV_TYPE_AUX_CHAIN_IND; @@ -1528,8 +1529,8 @@ uint8_t ull_adv_aux_hdr_set_clear(struct ll_adv_set *adv, lll = &adv->lll; /* Can't have both flags set here since both use 'hdr_data' param */ - LL_ASSERT(!(sec_hdr_add_fields & ULL_ADV_PDU_HDR_FIELD_ADVA) || - !(sec_hdr_add_fields & ULL_ADV_PDU_HDR_FIELD_AD_DATA)); + LL_ASSERT_DBG(!(sec_hdr_add_fields & ULL_ADV_PDU_HDR_FIELD_ADVA) || + !(sec_hdr_add_fields & ULL_ADV_PDU_HDR_FIELD_AD_DATA)); /* Get reference to previous primary PDU data */ pri_pdu_prev = lll_adv_data_peek(lll); @@ -1579,7 +1580,7 @@ uint8_t ull_adv_aux_hdr_set_clear(struct ll_adv_set *adv, if (!lll_aux) { aux = ull_adv_aux_acquire(lll); if (!aux) { - LL_ASSERT(pri_pdu != pri_pdu_prev); + LL_ASSERT_DBG(pri_pdu != pri_pdu_prev); return BT_HCI_ERR_MEM_CAPACITY_EXCEEDED; } @@ -2566,7 +2567,7 @@ void ull_adv_sync_started_stopped(struct ll_adv_aux_set *aux) struct ll_adv_sync_set *sync; uint8_t aux_handle; - LL_ASSERT(lll_sync); + LL_ASSERT_DBG(lll_sync); sync = HDR_LLL2ULL(lll_sync); aux_handle = ull_adv_aux_handle_get(aux); @@ -2760,7 +2761,7 @@ void ull_adv_aux_offset_get(struct ll_adv_set *adv) mfy.param = adv; ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_ULL_LOW, 1, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } #endif /* !CONFIG_BT_TICKER_EXT_EXPIRE_INFO */ @@ -2886,7 +2887,7 @@ void ull_adv_aux_chain_pdu_duplicate(struct pdu_adv *pdu_prev, if (!pdu_chain) { /* Get a new chain PDU */ pdu_chain = lll_adv_pdu_alloc_pdu_adv(); - LL_ASSERT(pdu_chain); + LL_ASSERT_ERR(pdu_chain); /* Copy previous chain PDU into new chain PDU */ (void)memcpy(pdu_chain, pdu_chain_prev, @@ -3240,7 +3241,7 @@ static void mfy_aux_offset_get(void *param) } success = (ret_cb == TICKER_STATUS_SUCCESS); - LL_ASSERT(success); + LL_ASSERT_ERR(success); /* FIXME: If the reference ticks change then implement the * compensation by adding the difference to the @@ -3249,9 +3250,9 @@ static void mfy_aux_offset_get(void *param) * ticker expiry that update the ticks_current. * For now assert until the fix implementation is added. */ - LL_ASSERT((ticks_current == ticks_previous) || retry--); + LL_ASSERT_ERR((ticks_current == ticks_previous) || retry--); - LL_ASSERT(id != TICKER_NULL); + LL_ASSERT_ERR(id != TICKER_NULL); } while (id != ticker_id); /* Adjust ticks to expire based on remainder value */ @@ -3326,7 +3327,7 @@ static void mfy_aux_offset_get(void *param) ticks_elapsed = ticker_ticks_diff_get(ticks_now, ticks_current); ticks_to_start = HAL_TICKER_US_TO_TICKS(EVENT_OVERHEAD_XTAL_US) - HAL_TICKER_US_TO_TICKS(EVENT_OVERHEAD_PREEMPT_MIN_US); - LL_ASSERT(ticks_elapsed < ticks_to_start); + LL_ASSERT_ERR(ticks_elapsed < ticks_to_start); } static void ticker_op_cb(uint32_t status, void *param) @@ -3358,7 +3359,7 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, /* Increment prepare reference count */ ref = ull_ref_inc(&aux->ull); - LL_ASSERT(ref); + LL_ASSERT_DBG(ref); #if defined(CONFIG_BT_TICKER_EXT_EXPIRE_INFO) #if defined(CONFIG_BT_CTLR_ADV_PERIODIC) @@ -3374,7 +3375,7 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, uint32_t ticks_to_expire; uint32_t sync_remainder_us = 0U; - LL_ASSERT(context->other_expire_info); + LL_ASSERT_DBG(context->other_expire_info); /* Reduce a tick for negative remainder and return positive remainder * value. @@ -3418,7 +3419,7 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, /* Kick LLL prepare */ ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); #if defined(CONFIG_BT_CTLR_ADV_PERIODIC) && !defined(CONFIG_BT_TICKER_EXT_EXPIRE_INFO) struct ll_adv_set *adv; @@ -3441,8 +3442,8 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, #if defined(CONFIG_BT_CTLR_ADV_PERIODIC) && defined(CONFIG_BT_TICKER_EXT_EXPIRE_INFO) static void ticker_update_op_cb(uint32_t status, void *param) { - LL_ASSERT(status == TICKER_STATUS_SUCCESS || - param == ull_disable_mark_get()); + LL_ASSERT_ERR((status == TICKER_STATUS_SUCCESS) || + (param == ull_disable_mark_get())); } #endif /* !CONFIG_BT_CTLR_ADV_PERIODIC && CONFIG_BT_TICKER_EXT_EXPIRE_INFO */ diff --git a/subsys/bluetooth/controller/ll_sw/ull_adv_iso.c b/subsys/bluetooth/controller/ll_sw/ull_adv_iso.c index f8f7cb35d64a..775baf1c63e7 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_adv_iso.c +++ b/subsys/bluetooth/controller/ll_sw/ull_adv_iso.c @@ -507,7 +507,7 @@ static uint8_t big_create(uint8_t big_handle, uint8_t adv_handle, uint8_t num_bi lll_adv_iso->max_sdu = max_sdu; res = util_saa_le32(lll_adv_iso->seed_access_addr, big_handle); - LL_ASSERT(!res); + LL_ASSERT_DBG(!res); (void)lll_csrand_get(lll_adv_iso->base_crc_init, sizeof(lll_adv_iso->base_crc_init)); @@ -604,11 +604,11 @@ static uint8_t big_create(uint8_t big_handle, uint8_t adv_handle, uint8_t num_bi /* Calculate GSK */ err = bt_crypto_h7(BIG1, bcode, igltk); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); err = bt_crypto_h6(igltk, BIG2, gltk); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); err = bt_crypto_h8(gltk, big_info->gskd, BIG3, gsk); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); /* Prepare the CCM parameters */ ccm_tx = &lll_adv_iso->ccm_tx; @@ -820,7 +820,7 @@ int ull_adv_iso_reset(void) } mark = ull_disable_mark(adv_iso); - LL_ASSERT(mark == adv_iso); + LL_ASSERT_DBG(mark == adv_iso); /* Stop event scheduling */ ret_cb = TICKER_STATUS_BUSY; @@ -830,20 +830,20 @@ int ull_adv_iso_reset(void) ret = ull_ticker_status_take(ret, &ret_cb); if (ret) { mark = ull_disable_unmark(adv_iso); - LL_ASSERT(mark == adv_iso); + LL_ASSERT_DBG(mark == adv_iso); /* Assert as there shall be a ticker instance active */ - LL_ASSERT(false); + LL_ASSERT_DBG(false); return BT_HCI_ERR_CMD_DISALLOWED; } /* Abort any events in LLL pipeline */ err = ull_disable(adv_iso_lll); - LL_ASSERT(!err || (err == -EALREADY)); + LL_ASSERT_ERR(!err || (err == -EALREADY)); mark = ull_disable_unmark(adv_iso); - LL_ASSERT(mark == adv_iso); + LL_ASSERT_DBG(mark == adv_iso); /* Reset associated streams */ while (adv_iso_lll->num_bis--) { @@ -970,7 +970,7 @@ void ull_adv_iso_offset_get(struct ll_adv_sync_set *sync) mfy.param = sync; ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_ULL_LOW, 1, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } #if defined(CONFIG_BT_TICKER_EXT_EXPIRE_INFO) @@ -1071,8 +1071,8 @@ void ull_adv_iso_done_terminate(struct node_rx_event_done *done) ret = ticker_stop(TICKER_INSTANCE_ID_CTLR, TICKER_USER_ID_ULL_HIGH, (TICKER_ID_ADV_ISO_BASE + lll->handle), ticker_stop_op_cb, adv_iso); - LL_ASSERT((ret == TICKER_STATUS_SUCCESS) || - (ret == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ret == TICKER_STATUS_SUCCESS) || + (ret == TICKER_STATUS_BUSY)); /* Invalidate the handle */ lll->handle = LLL_ADV_HANDLE_INVALID; @@ -1115,10 +1115,10 @@ void ull_adv_iso_stream_release(struct ll_adv_iso_set *adv_iso) stream_handle = lll->stream_handle[lll->num_bis]; stream = ull_adv_iso_stream_get(stream_handle); - LL_ASSERT(!stream->link_tx_free); + LL_ASSERT_DBG(!stream->link_tx_free); link = memq_deinit(&stream->memq_tx.head, &stream->memq_tx.tail); - LL_ASSERT(link); + LL_ASSERT_DBG(link); stream->link_tx_free = link; dp = stream->dp; @@ -1220,7 +1220,7 @@ static uint8_t ptc_calc(const struct lll_adv_iso *lll, uint32_t event_spacing, * running buffer offset related to nse. Fix ptc and ptc_curr definitions, * until then lets have an assert check here. */ - LL_ASSERT(ptc <= BIT_MASK(4)); + LL_ASSERT_DBG(ptc <= BIT_MASK(4)); return ptc; } @@ -1378,11 +1378,11 @@ static void adv_iso_chm_complete_commit(struct lll_adv_iso *lll_iso) adv = HDR_LLL2ULL(lll_iso->adv); err = ull_adv_sync_pdu_alloc(adv, ULL_ADV_PDU_EXTRA_DATA_ALLOC_IF_EXIST, &pdu_prev, &pdu, NULL, NULL, &ter_idx); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); /* Copy content */ err = ull_adv_sync_duplicate(pdu_prev, pdu); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); /* Get the current ACAD */ acad = ull_adv_sync_get_acad(pdu, &acad_len); @@ -1390,7 +1390,7 @@ static void adv_iso_chm_complete_commit(struct lll_adv_iso *lll_iso) lll_sync = adv->lll.sync; /* Dev assert if ACAD empty */ - LL_ASSERT(acad_len); + LL_ASSERT_DBG(acad_len); /* Find the BIGInfo */ len = acad_len; @@ -1404,12 +1404,13 @@ static void adv_iso_chm_complete_commit(struct lll_adv_iso *lll_iso) ad_len += 1U; - LL_ASSERT(ad_len <= len); + LL_ASSERT_DBG(ad_len <= len); ad += ad_len; len -= ad_len; } while (len); - LL_ASSERT(len); + + LL_ASSERT_DBG(len); /* Get reference to BIGInfo */ bi = (void *)&ad[PDU_ADV_DATA_HEADER_DATA_OFFSET]; @@ -1474,11 +1475,11 @@ static void mfy_iso_offset_get(void *param) } success = (ret_cb == TICKER_STATUS_SUCCESS); - LL_ASSERT(success); + LL_ASSERT_ERR(success); - LL_ASSERT((ticks_current == ticks_previous) || retry--); + LL_ASSERT_ERR((ticks_current == ticks_previous) || retry--); - LL_ASSERT(id != TICKER_NULL); + LL_ASSERT_ERR(id != TICKER_NULL); } while (id != ticker_id); payload_count = lll_iso->payload_count + @@ -1593,7 +1594,7 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, /* Increment prepare reference count */ ref = ull_ref_inc(&adv_iso->ull); - LL_ASSERT(ref); + LL_ASSERT_DBG(ref); /* Append timing parameters */ p.ticks_at_expire = ticks_at_expire; @@ -1606,7 +1607,7 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, /* Kick LLL prepare */ ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0, &mfy_lll_prepare); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); /* Calculate the BIG reference point of current BIG event */ remainder_us = remainder; @@ -1630,13 +1631,13 @@ static void ticker_stop_op_cb(uint32_t status, void *param) static struct mayfly mfy = {0U, 0U, &link, NULL, adv_iso_disable}; uint32_t ret; - LL_ASSERT(status == TICKER_STATUS_SUCCESS); + LL_ASSERT_ERR(status == TICKER_STATUS_SUCCESS); /* Check if any pending LLL events that need to be aborted */ mfy.param = param; ret = mayfly_enqueue(TICKER_USER_ID_ULL_LOW, TICKER_USER_ID_ULL_HIGH, 0U, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } static void adv_iso_disable(void *param) @@ -1657,14 +1658,14 @@ static void adv_iso_disable(void *param) /* Setup disabled callback to be called when ref count * returns to zero. */ - LL_ASSERT(!hdr->disabled_cb); + LL_ASSERT_ERR(!hdr->disabled_cb); hdr->disabled_param = mfy.param; hdr->disabled_cb = disabled_cb; /* Trigger LLL disable */ ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0U, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } else { /* No pending LLL events */ disabled_cb(&adv_iso->lll); @@ -1680,7 +1681,7 @@ static void disabled_cb(void *param) mfy.param = param; ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0U, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } static void tx_lll_flush(void *param) @@ -1726,7 +1727,7 @@ static void tx_lll_flush(void *param) adv_iso = HDR_LLL2ULL(lll); rx = (void *)&adv_iso->node_rx_terminate; link = rx->hdr.link; - LL_ASSERT(link); + LL_ASSERT_DBG(link); rx->hdr.link = NULL; /* Enqueue the terminate towards ULL context */ diff --git a/subsys/bluetooth/controller/ll_sw/ull_adv_sync.c b/subsys/bluetooth/controller/ll_sw/ull_adv_sync.c index 8c4d610b8874..ea1311c528e1 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_adv_sync.c +++ b/subsys/bluetooth/controller/ll_sw/ull_adv_sync.c @@ -176,7 +176,7 @@ uint8_t ll_adv_sync_param_set(uint8_t handle, uint16_t interval, uint16_t flags) lll_hdr_init(lll_sync, sync); err = util_aa_le32(lll_sync->access_addr); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); lll_sync->data_chan_id = lll_chan_id(lll_sync->access_addr); chm_last = lll_sync->chm_first; @@ -940,11 +940,11 @@ void ull_adv_sync_chm_complete(struct node_rx_pdu *rx) adv = HDR_LLL2ULL(lll_sync->adv); err = ull_adv_sync_pdu_alloc(adv, ULL_ADV_PDU_EXTRA_DATA_ALLOC_IF_EXIST, &pdu_prev, &pdu, NULL, NULL, &ter_idx); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); err = ull_adv_sync_remove_from_acad(lll_sync, pdu_prev, pdu, PDU_ADV_DATA_TYPE_CHANNEL_MAP_UPDATE_IND); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); lll_adv_sync_data_enqueue(lll_sync, ter_idx); } @@ -981,7 +981,7 @@ void ull_adv_sync_offset_get(struct ll_adv_set *adv) mfy.param = adv; ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_ULL_LOW, 1, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } #endif /* CONFIG_BT_TICKER_EXT_EXPIRE_INFO */ @@ -1013,11 +1013,12 @@ void ull_adv_sync_pdu_init(struct pdu_adv *pdu, uint8_t ext_hdr_flags, *(uint8_t *)ext_hdr = ext_hdr_flags; dptr = ext_hdr->data; - LL_ASSERT(!(ext_hdr_flags & (ULL_ADV_PDU_HDR_FIELD_ADVA | ULL_ADV_PDU_HDR_FIELD_TARGETA | + LL_ASSERT_DBG(!(ext_hdr_flags & (ULL_ADV_PDU_HDR_FIELD_ADVA | + ULL_ADV_PDU_HDR_FIELD_TARGETA | #if !defined(CONFIG_BT_CTLR_ADV_PERIODIC_ADI_SUPPORT) - ULL_ADV_PDU_HDR_FIELD_ADI | + ULL_ADV_PDU_HDR_FIELD_ADI | #endif /* CONFIG_BT_CTLR_ADV_PERIODIC_ADI_SUPPORT */ - ULL_ADV_PDU_HDR_FIELD_SYNC_INFO))); + ULL_ADV_PDU_HDR_FIELD_SYNC_INFO))); #if defined(CONFIG_BT_CTLR_ADV_SYNC_PDU_BACK2BACK) if (IS_ENABLED(CONFIG_BT_CTLR_DF_ADV_CTE_TX) && @@ -1174,8 +1175,8 @@ static void ull_adv_sync_add_to_header(struct pdu_adv *pdu, /* Push back any adv data - overflow will be returned via ad_overflow */ if (pdu->len > hdr->ext_hdr_len + 1U) { if (pdu->len > PDU_AC_EXT_PAYLOAD_SIZE_MAX - delta) { - LL_ASSERT(ad_overflow); - LL_ASSERT(overflow_len); + LL_ASSERT_DBG(ad_overflow); + LL_ASSERT_DBG(overflow_len); #if defined(CONFIG_BT_CTLR_ADV_SYNC_PDU_LINK) *overflow_len = delta - (PDU_AC_EXT_PAYLOAD_SIZE_MAX - pdu->len); memcpy(ad_overflow, @@ -1375,7 +1376,7 @@ static void ull_adv_sync_copy_pdu_header(struct pdu_adv *target_pdu, const uint8_t *source_dptr; uint8_t *target_dptr; - LL_ASSERT(target_pdu != source_pdu); + LL_ASSERT_DBG(target_pdu != source_pdu); /* Initialize PDU header */ target_pdu->type = source_pdu->type; @@ -1861,7 +1862,8 @@ static uint8_t ull_adv_sync_add_adi(struct lll_adv_sync *lll_sync, last_pdu = pdu; /* We should always have enough available overflow space to fit an ADI */ - LL_ASSERT(total_overflow_len + sizeof(struct pdu_adv_adi) <= sizeof(ad_overflow)); + LL_ASSERT_DBG((total_overflow_len + sizeof(struct pdu_adv_adi)) <= + sizeof(ad_overflow)); ull_adv_sync_add_to_header(pdu, &add_fields, &ad_overflow[total_overflow_len], &overflow_len); @@ -2054,7 +2056,7 @@ uint8_t ull_adv_sync_remove_from_acad(struct lll_adv_sync *lll_sync, ad_len += 1U; - LL_ASSERT(ad_len <= len); + LL_ASSERT_DBG(ad_len <= len); ad += ad_len; len -= ad_len; @@ -2180,7 +2182,8 @@ uint8_t ull_adv_sync_add_cteinfo(struct lll_adv_sync *lll_sync, last_pdu = pdu; /* We should always have enough available overflow space to fit CTEInfo */ - LL_ASSERT(total_overflow_len + sizeof(struct pdu_cte_info) <= sizeof(ad_overflow)); + LL_ASSERT_DBG((total_overflow_len + sizeof(struct pdu_cte_info)) <= + sizeof(ad_overflow)); ull_adv_sync_add_to_header(pdu, &add_fields, &ad_overflow[total_overflow_len], &overflow_len); @@ -2720,11 +2723,11 @@ static void mfy_sync_offset_get(void *param) } success = (ret_cb == TICKER_STATUS_SUCCESS); - LL_ASSERT(success); + LL_ASSERT_ERR(success); - LL_ASSERT((ticks_current == ticks_previous) || retry--); + LL_ASSERT_ERR((ticks_current == ticks_previous) || retry--); - LL_ASSERT(id != TICKER_NULL); + LL_ASSERT_ERR(id != TICKER_NULL); } while (id != ticker_id); /* Reduced a tick for negative remainder and return positive remainder @@ -2861,14 +2864,14 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, /* Increment prepare reference count */ ref = ull_ref_inc(&sync->ull); - LL_ASSERT(ref); + LL_ASSERT_DBG(ref); #if defined(CONFIG_BT_CTLR_ADV_ISO) && \ defined(CONFIG_BT_TICKER_EXT_EXPIRE_INFO) if (lll->iso) { struct lll_adv_iso *lll_iso = lll->iso; - LL_ASSERT(context->other_expire_info); + LL_ASSERT_DBG(context->other_expire_info); /* Check: No need for remainder in this case? */ lll_iso->ticks_sync_pdu_offset = context->other_expire_info->ticks_to_expire; @@ -2887,7 +2890,7 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, /* Kick LLL prepare */ ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); #if defined(CONFIG_BT_CTLR_ADV_ISO) && \ !defined(CONFIG_BT_TICKER_EXT_EXPIRE_INFO) @@ -2903,7 +2906,7 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, defined(CONFIG_BT_TICKER_EXT_EXPIRE_INFO) static void ticker_update_op_cb(uint32_t status, void *param) { - LL_ASSERT(status == TICKER_STATUS_SUCCESS || - param == ull_disable_mark_get()); + LL_ASSERT_ERR((status == TICKER_STATUS_SUCCESS) || + (param == ull_disable_mark_get())); } #endif /* !CONFIG_BT_CTLR_ADV_ISO && CONFIG_BT_TICKER_EXT_EXPIRE_INFO */ diff --git a/subsys/bluetooth/controller/ll_sw/ull_central.c b/subsys/bluetooth/controller/ll_sw/ull_central.c index 1771cda124bd..f4bc227cfdf5 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_central.c +++ b/subsys/bluetooth/controller/ll_sw/ull_central.c @@ -190,7 +190,7 @@ uint8_t ll_create_connection(uint16_t scan_interval, uint16_t scan_window, conn_lll = &conn->lll; err = util_aa_le32(conn_lll->access_addr); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); lll_csrand_get(conn_lll->crc_init, sizeof(conn_lll->crc_init)); @@ -519,7 +519,7 @@ uint8_t ll_connect_disable(void **rx) conn = HDR_LLL2ULL(conn_lll); node_rx = (void *)&conn->llcp_terminate.node_rx.rx; link = node_rx->hdr.link; - LL_ASSERT(link); + LL_ASSERT_DBG(link); /* free the memq link early, as caller could overwrite it */ ll_rx_link_release(link); @@ -603,7 +603,7 @@ int ull_central_reset(void) } } - LL_ASSERT(scan); + LL_ASSERT_DBG(scan); scan->is_enabled = 0U; scan->lll.conn = NULL; @@ -628,13 +628,13 @@ void ull_central_cleanup(struct node_rx_pdu *rx_free) */ scan = HDR_LLL2ULL(rx_free->rx_ftr.param); conn_lll = scan->lll.conn; - LL_ASSERT(conn_lll); + LL_ASSERT_DBG(conn_lll); scan->lll.conn = NULL; - LL_ASSERT(!conn_lll->link_tx_free); + LL_ASSERT_DBG(!conn_lll->link_tx_free); link = memq_deinit(&conn_lll->memq_tx.head, &conn_lll->memq_tx.tail); - LL_ASSERT(link); + LL_ASSERT_DBG(link); conn_lll->link_tx_free = link; conn = HDR_LLL2ULL(conn_lll); @@ -655,7 +655,7 @@ void ull_central_cleanup(struct node_rx_pdu *rx_free) ull_scan_is_enabled_get(SCAN_HANDLE_PHY_CODED); if (scan_coded && scan_coded != scan) { conn_lll = scan_coded->lll.conn; - LL_ASSERT(conn_lll); + LL_ASSERT_DBG(conn_lll); scan_coded->lll.conn = NULL; scan_coded->is_enabled = 0U; @@ -699,7 +699,7 @@ void ull_central_setup(struct node_rx_pdu *rx, struct node_rx_ftr *ftr, * complete event. */ node = pdu_tx; - LL_ASSERT(IS_PTR_ALIGNED(node, struct node_rx_cc)); + LL_ASSERT_DBG(IS_PTR_ALIGNED(node, struct node_rx_cc)); /* Populate the fields required for connection complete event */ cc = node; @@ -831,8 +831,8 @@ void ull_central_setup(struct node_rx_pdu *rx, struct node_rx_ftr *ftr, TICKER_USER_ID_ULL_HIGH, ticker_id_scan, ticks_at_stop, ticker_op_stop_scan_cb, scan); - LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) || - (ticker_status == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ticker_status == TICKER_STATUS_SUCCESS) || + (ticker_status == TICKER_STATUS_BUSY)); #if defined(CONFIG_BT_CTLR_ADV_EXT) && defined(CONFIG_BT_CTLR_PHY_CODED) /* Determine if coded PHY was also enabled, if so, reset the assigned @@ -853,8 +853,8 @@ void ull_central_setup(struct node_rx_pdu *rx, struct node_rx_ftr *ftr, ticker_id_scan, ticker_op_stop_scan_other_cb, scan_other); - LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) || - (ticker_status == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ticker_status == TICKER_STATUS_SUCCESS) || + (ticker_status == TICKER_STATUS_BUSY)); } } #endif /* CONFIG_BT_CTLR_ADV_EXT && CONFIG_BT_CTLR_PHY_CODED */ @@ -880,8 +880,8 @@ void ull_central_setup(struct node_rx_pdu *rx, struct node_rx_ftr *ftr, (conn->ull.ticks_slot + ticks_slot_overhead), ull_central_ticker_cb, conn, ticker_op_cb, (void *)__LINE__); - LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) || - (ticker_status == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ticker_status == TICKER_STATUS_SUCCESS) || + (ticker_status == TICKER_STATUS_BUSY)); #if (CONFIG_BT_CTLR_ULL_HIGH_PRIO == CONFIG_BT_CTLR_ULL_LOW_PRIO) /* enable ticker job, irrespective of disabled in this function so @@ -944,7 +944,7 @@ void ull_central_ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, /* Increment prepare reference count */ ref = ull_ref_inc(&conn->ull); - LL_ASSERT(ref); + LL_ASSERT_DBG(ref); /* Increment event counter. * @@ -972,7 +972,7 @@ void ull_central_ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, /* Kick LLL prepare */ err = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0, &mfy); - LL_ASSERT(!err); + LL_ASSERT_ERR(!err); /* De-mux remaining tx nodes from FIFO */ ull_conn_tx_demux(UINT8_MAX); @@ -1044,7 +1044,7 @@ static void ticker_op_stop_scan_other_cb(uint32_t status, void *param) ret = mayfly_enqueue(TICKER_USER_ID_ULL_LOW, TICKER_USER_ID_LLL, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } } #endif /* CONFIG_BT_CTLR_ADV_EXT && CONFIG_BT_CTLR_PHY_CODED */ @@ -1053,7 +1053,7 @@ static void ticker_op_cb(uint32_t status, void *param) { ARG_UNUSED(param); - LL_ASSERT(status == TICKER_STATUS_SUCCESS); + LL_ASSERT_ERR(status == TICKER_STATUS_SUCCESS); } static inline void conn_release(struct ll_scan_set *scan) @@ -1064,16 +1064,16 @@ static inline void conn_release(struct ll_scan_set *scan) memq_link_t *link; lll = scan->lll.conn; - LL_ASSERT(!lll->link_tx_free); + LL_ASSERT_DBG(!lll->link_tx_free); link = memq_deinit(&lll->memq_tx.head, &lll->memq_tx.tail); - LL_ASSERT(link); + LL_ASSERT_DBG(link); lll->link_tx_free = link; conn = HDR_LLL2ULL(lll); cc = (void *)&conn->llcp_terminate.node_rx.rx; link = cc->hdr.link; - LL_ASSERT(link); + LL_ASSERT_DBG(link); ll_rx_link_release(link); diff --git a/subsys/bluetooth/controller/ll_sw/ull_central_iso.c b/subsys/bluetooth/controller/ll_sw/ull_central_iso.c index c2f86c263dff..d99896a975ba 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_central_iso.c +++ b/subsys/bluetooth/controller/ll_sw/ull_central_iso.c @@ -355,7 +355,7 @@ uint8_t ll_cig_parameters_commit(uint8_t cig_id, uint16_t *handles) tx = cis->lll.tx.bn && cis->lll.tx.max_pdu; rx = cis->lll.rx.bn && cis->lll.rx.max_pdu; } else { - LL_ASSERT(cis->framed || iso_interval_us >= cig->c_sdu_interval); + LL_ASSERT_DBG(cis->framed || iso_interval_us >= cig->c_sdu_interval); tx = cig->c_sdu_interval && cis->c_max_sdu; rx = cig->p_sdu_interval && cis->p_max_sdu; @@ -463,7 +463,7 @@ uint8_t ll_cig_parameters_commit(uint8_t cig_id, uint16_t *handles) if (!cig->central.test) { #if defined(CONFIG_BT_CTLR_CONN_ISO_LOW_LATENCY_POLICY) /* TODO: Only implemented for sequential packing */ - LL_ASSERT(cig->central.packing == BT_ISO_PACKING_SEQUENTIAL); + LL_ASSERT_ERR(cig->central.packing == BT_ISO_PACKING_SEQUENTIAL); /* Use symmetric flush timeout */ cis->lll.tx.ft = DIV_ROUND_UP(total_time, iso_interval_us); @@ -494,7 +494,7 @@ uint8_t ll_cig_parameters_commit(uint8_t cig_id, uint16_t *handles) } #else - LL_ASSERT(0); + LL_ASSERT_ERR(0); #endif cis->lll.nse = DIV_ROUND_UP(se[i].total_count, cis->lll.tx.ft); } @@ -736,7 +736,7 @@ void ll_cis_create(uint16_t cis_handle, uint16_t acl_handle) /* Create access address */ err = util_aa_le32(cis->lll.access_addr); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); /* Initialize stream states */ cis->established = 0; @@ -754,7 +754,7 @@ void ll_cis_create(uint16_t cis_handle, uint16_t acl_handle) /* Initiate CIS Request Control Procedure */ if (ull_cp_cis_create(conn, cis) == BT_HCI_ERR_SUCCESS) { - LL_ASSERT(cis->group); + LL_ASSERT_DBG(cis->group); if (cis->group->state == CIG_STATE_CONFIGURABLE) { /* This CIG is now initiating an ISO connection */ @@ -859,7 +859,7 @@ uint8_t ull_central_iso_setup(uint16_t cis_handle, /* ACL connection of the new CIS */ conn = ll_conn_get(cis->lll.acl_handle); - LL_ASSERT(conn != NULL); + LL_ASSERT_DBG(conn != NULL); #if defined(CONFIG_BT_CTLR_JIT_SCHEDULING) uint16_t event_counter; @@ -980,10 +980,10 @@ int ull_central_iso_cis_offset_get(uint16_t cis_handle, struct ll_conn *conn; cis = ll_conn_iso_stream_get(cis_handle); - LL_ASSERT(cis); + LL_ASSERT_DBG(cis); conn = ll_conn_get(cis->lll.acl_handle); - LL_ASSERT(conn != NULL); + LL_ASSERT_DBG(conn != NULL); /* `ull_conn_llcp()` (caller of this function) is called before `ull_ref_inc()` hence we do * not need to use `ull_conn_event_counter()`. @@ -1032,7 +1032,7 @@ static void cig_offset_get(struct ll_conn_iso_stream *cis) mfy.param = cis; ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_ULL_LOW, 1, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } static void mfy_cig_offset_get(void *param) @@ -1055,7 +1055,7 @@ static void mfy_cig_offset_get(void *param) */ err = ull_sched_conn_iso_free_offset_get(cig->ull.ticks_slot, &ticks_to_expire); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); /* Calculate the offset for the select CIS in the CIG */ offset_min_us = HAL_TICKER_TICKS_TO_US(ticks_to_expire) + @@ -1063,7 +1063,7 @@ static void mfy_cig_offset_get(void *param) offset_min_us += cig->sync_delay - cis->sync_delay; conn = ll_conn_get(cis->lll.acl_handle); - LL_ASSERT(conn != NULL); + LL_ASSERT_DBG(conn != NULL); /* Ensure the offset is not greater than the ACL interval, considering * the minimum CIS offset requirement. @@ -1088,7 +1088,7 @@ static void cis_offset_get(struct ll_conn_iso_stream *cis) mfy.param = cis; ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_ULL_LOW, 1, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } static void mfy_cis_offset_get(void *param) @@ -1161,11 +1161,11 @@ static void mfy_cis_offset_get(void *param) } success = (ret_cb == TICKER_STATUS_SUCCESS); - LL_ASSERT(success); + LL_ASSERT_ERR(success); - LL_ASSERT((ticks_current == ticks_previous) || retry--); + LL_ASSERT_ERR((ticks_current == ticks_previous) || retry--); - LL_ASSERT(id != TICKER_NULL); + LL_ASSERT_ERR(id != TICKER_NULL); } while (id != ticker_id); /* Reduced a tick for negative remainder and return positive remainder @@ -1175,7 +1175,7 @@ static void mfy_cis_offset_get(void *param) cig_remainder_us = remainder; conn = ll_conn_get(cis->lll.acl_handle); - LL_ASSERT(conn != NULL); + LL_ASSERT_DBG(conn != NULL); /* Add a tick for negative remainder and return positive remainder * value. diff --git a/subsys/bluetooth/controller/ll_sw/ull_conn.c b/subsys/bluetooth/controller/ll_sw/ull_conn.c index e76b3e7147e9..fb6e98915d7f 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_conn.c +++ b/subsys/bluetooth/controller/ll_sw/ull_conn.c @@ -444,7 +444,7 @@ uint8_t ll_terminate_ind_send(uint16_t handle, uint8_t reason) } else if (cis->group->state == CIG_STATE_INITIATING) { conn = ll_connected_get(cis->lll.acl_handle); - LL_ASSERT(conn != NULL); + LL_ASSERT_DBG(conn != NULL); /* CIS is not yet established - try to cancel procedure */ if (ull_cp_cc_cancel(conn)) { @@ -452,7 +452,7 @@ uint8_t ll_terminate_ind_send(uint16_t handle, uint8_t reason) struct node_rx_pdu *node_terminate; node_terminate = ull_pdu_rx_alloc(); - LL_ASSERT(node_terminate); + LL_ASSERT_ERR(node_terminate); node_terminate->hdr.handle = handle; node_terminate->hdr.type = NODE_RX_TYPE_TERMINATE; @@ -900,7 +900,7 @@ void ull_conn_setup(memq_link_t *rx_link, struct node_rx_pdu *rx) /* Setup connection in ULL disabled callback, * pass the node rx as disabled callback parameter. */ - LL_ASSERT(!hdr->disabled_cb); + LL_ASSERT_ERR(!hdr->disabled_cb); hdr->disabled_param = rx; hdr->disabled_cb = conn_setup_adv_scan_disabled_cb; @@ -976,7 +976,7 @@ void ull_conn_rx(memq_link_t *link, struct node_rx_pdu **rx) int ull_conn_llcp(struct ll_conn *conn, uint32_t ticks_at_expire, uint32_t remainder, uint16_t lazy) { - LL_ASSERT(conn->lll.handle != LLL_HANDLE_INVALID); + LL_ASSERT_DBG(conn->lll.handle != LLL_HANDLE_INVALID); conn->llcp.prep.ticks_at_expire = ticks_at_expire; conn->llcp.prep.remainder = remainder; @@ -1410,9 +1410,9 @@ void ull_conn_done(struct node_rx_event_done *done) lazy, force, ticker_update_conn_op_cb, conn_ll); - LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) || - (ticker_status == TICKER_STATUS_BUSY) || - ((void *)conn_ll == ull_disable_mark_get())); + LL_ASSERT_ERR((ticker_status == TICKER_STATUS_SUCCESS) || + (ticker_status == TICKER_STATUS_BUSY) || + ((void *)conn_ll == ull_disable_mark_get())); } } @@ -1479,7 +1479,7 @@ void ull_conn_tx_lll_enqueue(struct ll_conn *conn, uint8_t count) } link = mem_acquire(&mem_link_tx.free); - LL_ASSERT(link); + LL_ASSERT_ERR(link); /* Enqueue towards LLL */ memq_enqueue(link, tx, &conn->lll.memq_tx.tail); @@ -1542,7 +1542,7 @@ void ull_conn_lll_ack_enqueue(uint16_t handle, struct node_tx *tx) uint8_t idx; idx = MFIFO_ENQUEUE_GET(conn_ack, (void **)&lll_tx); - LL_ASSERT(lll_tx); + LL_ASSERT_ERR(lll_tx); lll_tx->handle = handle; lll_tx->node = tx; @@ -1555,13 +1555,13 @@ void ull_conn_tx_ack(uint16_t handle, memq_link_t *link, struct node_tx *tx) struct pdu_data *pdu_tx; pdu_tx = (void *)tx->pdu; - LL_ASSERT(pdu_tx->len); + LL_ASSERT_DBG(pdu_tx->len); if (pdu_tx->ll_id == PDU_DATA_LLID_CTRL) { if (handle != LLL_HANDLE_INVALID) { struct ll_conn *conn = ll_conn_get(handle); - LL_ASSERT(conn != NULL); + LL_ASSERT_DBG(conn != NULL); ull_cp_tx_ack(conn, tx); } @@ -1571,7 +1571,7 @@ void ull_conn_tx_ack(uint16_t handle, memq_link_t *link, struct node_tx *tx) struct ll_conn *conn; /* Tx Node not re-used, ensure link->next is non-NULL */ - LL_ASSERT(link->next); + LL_ASSERT_DBG(link->next); /* Pass conn as-is to ull_cp_release_tx(), NULL check is done there */ conn = ll_connected_get(handle); @@ -1585,12 +1585,12 @@ void ull_conn_tx_ack(uint16_t handle, memq_link_t *link, struct node_tx *tx) return; } - LL_ASSERT(!link->next); + LL_ASSERT_DBG(!link->next); } else if (handle == LLL_HANDLE_INVALID) { pdu_tx->ll_id = PDU_DATA_LLID_RESV; } else { - LL_ASSERT(handle != LLL_HANDLE_INVALID); + LL_ASSERT_DBG(handle != LLL_HANDLE_INVALID); } ll_tx_ack_put(handle, tx); @@ -1784,29 +1784,33 @@ static void ticker_update_conn_op_cb(uint32_t status, void *param) * when disconnecting or connection update (race between ticker_update * and ticker_stop calls). */ - LL_ASSERT(status == TICKER_STATUS_SUCCESS || - param == ull_update_mark_get() || - param == ull_disable_mark_get()); + LL_ASSERT_ERR((status == TICKER_STATUS_SUCCESS) || + (param == ull_update_mark_get()) || + (param == ull_disable_mark_get())); } static void ticker_stop_conn_op_cb(uint32_t status, void *param) { void *p; - LL_ASSERT(status == TICKER_STATUS_SUCCESS); + LL_ASSERT_ERR(status == TICKER_STATUS_SUCCESS); p = ull_update_mark(param); - LL_ASSERT(p == param); + if (p != param) { + LL_ASSERT_DBG(false); + } } static void ticker_start_conn_op_cb(uint32_t status, void *param) { void *p; - LL_ASSERT(status == TICKER_STATUS_SUCCESS); + LL_ASSERT_ERR(status == TICKER_STATUS_SUCCESS); p = ull_update_unmark(param); - LL_ASSERT(p == param); + if (p != param) { + LL_ASSERT_DBG(false); + } } static void conn_setup_adv_scan_disabled_cb(void *param) @@ -1845,7 +1849,7 @@ static void conn_setup_adv_scan_disabled_cb(void *param) #endif /* CONFIG_BT_PERIPHERAL */ default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } } @@ -1856,7 +1860,7 @@ static inline void disable(uint16_t handle) int err; conn = ll_conn_get(handle); - LL_ASSERT(conn != NULL); + LL_ASSERT_DBG(conn != NULL); err = ull_ticker_stop_with_mark(TICKER_ID_CONN_BASE + handle, conn, &conn->lll); @@ -1909,9 +1913,9 @@ static void conn_cleanup_finalize(struct ll_conn *conn) TICKER_USER_ID_ULL_HIGH, TICKER_ID_CONN_BASE + lll->handle, ticker_stop_op_cb, conn); - LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) || - (ticker_status == TICKER_STATUS_BUSY) || - ((void *)conn == ull_disable_mark_get())); + LL_ASSERT_ERR((ticker_status == TICKER_STATUS_SUCCESS) || + (ticker_status == TICKER_STATUS_BUSY) || + ((void *)conn == ull_disable_mark_get())); /* Invalidate the connection context */ lll->handle = LLL_HANDLE_INVALID; @@ -1968,7 +1972,7 @@ static void tx_ull_flush(struct ll_conn *conn) memq_link_t *link; link = mem_acquire(&mem_link_tx.free); - LL_ASSERT(link); + LL_ASSERT_ERR(link); /* Enqueue towards LLL */ memq_enqueue(link, tx, &conn->lll.memq_tx.tail); @@ -1987,7 +1991,7 @@ static void ticker_stop_op_cb(uint32_t status, void *param) * when disconnecting (race with ticker_stop), say on HCI Reset. */ if (status != TICKER_STATUS_SUCCESS) { - LL_ASSERT(param == ull_disable_mark_get()); + LL_ASSERT_ERR(param == ull_disable_mark_get()); return; } @@ -1996,7 +2000,7 @@ static void ticker_stop_op_cb(uint32_t status, void *param) mfy.param = param; ret = mayfly_enqueue(TICKER_USER_ID_ULL_LOW, TICKER_USER_ID_ULL_HIGH, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } static void conn_disable(void *param) @@ -2017,14 +2021,14 @@ static void conn_disable(void *param) /* Setup disabled callback to be called when ref count * returns to zero. */ - LL_ASSERT(!hdr->disabled_cb); + LL_ASSERT_ERR(!hdr->disabled_cb); hdr->disabled_param = mfy.param; hdr->disabled_cb = disabled_cb; /* Trigger LLL disable */ ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } else { /* No pending LLL events */ disabled_cb(&conn->lll); @@ -2040,7 +2044,7 @@ static void disabled_cb(void *param) mfy.param = param; ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } static void tx_lll_flush(void *param) @@ -2066,7 +2070,7 @@ static void tx_lll_flush(void *param) struct lll_tx *tx_buf; idx = MFIFO_ENQUEUE_GET(conn_ack, (void **)&tx_buf); - LL_ASSERT(tx_buf); + LL_ASSERT_ERR(tx_buf); tx_buf->handle = LLL_HANDLE_INVALID; tx_buf->node = tx; @@ -2086,7 +2090,7 @@ static void tx_lll_flush(void *param) * populated before this mayfly function was scheduled. */ rx = (void *)&conn->llcp_terminate.node_rx; - LL_ASSERT(rx->hdr.link); + LL_ASSERT_DBG(rx->hdr.link); link = rx->hdr.link; rx->hdr.link = NULL; @@ -2239,8 +2243,8 @@ static void ull_conn_update_ticker(struct ll_conn *conn, uint32_t ticker_status = ticker_stop_abs(TICKER_INSTANCE_ID_CTLR, TICKER_USER_ID_ULL_HIGH, ticker_id_conn, ticks_at_expire, ticker_stop_conn_op_cb, (void *)conn); - LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) || - (ticker_status == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ticker_status == TICKER_STATUS_SUCCESS) || + (ticker_status == TICKER_STATUS_BUSY)); ticker_status = ticker_start( TICKER_INSTANCE_ID_CTLR, TICKER_USER_ID_ULL_HIGH, ticker_id_conn, ticks_at_expire, ticks_win_offset, HAL_TICKER_US_TO_TICKS(periodic_us), @@ -2260,8 +2264,8 @@ static void ull_conn_update_ticker(struct ll_conn *conn, ull_central_ticker_cb, #endif /* CONFIG_BT_PERIPHERAL && CONFIG_BT_CENTRAL */ conn, ticker_start_conn_op_cb, (void *)conn); - LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) || - (ticker_status == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ticker_status == TICKER_STATUS_SUCCESS) || + (ticker_status == TICKER_STATUS_BUSY)); #if (CONFIG_BT_CTLR_ULL_HIGH_PRIO == CONFIG_BT_CTLR_ULL_LOW_PRIO) /* enable ticker job, if disabled in this function */ @@ -2463,7 +2467,7 @@ void ull_conn_update_parameters(struct ll_conn *conn, uint8_t is_cu_proc, uint8_ #endif /*CONFIG_BT_CENTRAL */ default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } @@ -2825,7 +2829,7 @@ static uint32_t get_ticker_offset(uint8_t ticker_id, uint16_t *lazy) } } - LL_ASSERT(ret_cb == TICKER_STATUS_SUCCESS); + LL_ASSERT_ERR(ret_cb == TICKER_STATUS_SUCCESS); /* Reduced a tick for negative remainder and return positive remainder * value. @@ -2867,7 +2871,7 @@ static void mfy_past_sender_offset_get(void *param) if (adv_sync_handle != BT_HCI_ADV_HANDLE_INVALID) { const struct ll_adv_sync_set *adv_sync = ull_adv_sync_get(adv_sync_handle); - LL_ASSERT(adv_sync); + LL_ASSERT_DBG(adv_sync); ticker_offset_us = get_ticker_offset(TICKER_ID_ADV_SYNC_BASE + adv_sync_handle, &lazy); @@ -2879,7 +2883,7 @@ static void mfy_past_sender_offset_get(void *param) uint32_t interval_us = sync->interval * PERIODIC_INT_UNIT_US; uint32_t window_widening_event_us; - LL_ASSERT(sync); + LL_ASSERT_DBG(sync); ticker_offset_us = get_ticker_offset(TICKER_ID_SCAN_SYNC_BASE + sync_handle, &lazy); @@ -2923,7 +2927,7 @@ void ull_conn_past_sender_offset_request(struct ll_conn *conn) mfy.param = conn; ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_ULL_LOW, 1, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } #endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER */ diff --git a/subsys/bluetooth/controller/ll_sw/ull_conn_iso.c b/subsys/bluetooth/controller/ll_sw/ull_conn_iso.c index a28655218738..2ce0d8c3649b 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_conn_iso.c +++ b/subsys/bluetooth/controller/ll_sw/ull_conn_iso.c @@ -460,7 +460,7 @@ void ull_conn_iso_done(struct node_rx_event_done *done) /* Check all CISes for supervison/establishment timeout */ for (cis_idx = 0; cis_idx < cig->lll.num_cis; cis_idx++) { cis = ll_conn_iso_stream_get_by_group(cig, &handle_iter); - LL_ASSERT(cis); + LL_ASSERT_DBG(cis); if (cis->lll.active && cis->lll.handle != LLL_HANDLE_INVALID) { /* CIS was setup and is now expected to be going */ @@ -485,7 +485,7 @@ void ull_conn_iso_done(struct node_rx_event_done *done) if (!cis->event_expire) { struct ll_conn *conn = ll_conn_get(cis->lll.acl_handle); - LL_ASSERT(conn != NULL); + LL_ASSERT_DBG(conn != NULL); cis->event_expire = RADIO_CONN_EVENTS( conn->supervision_timeout * 10U * 1000U, @@ -532,7 +532,7 @@ void ull_conn_iso_done(struct node_rx_event_done *done) struct ll_conn *conn; conn = ll_connected_get(cis->lll.acl_handle); - LL_ASSERT(conn != NULL); + LL_ASSERT_DBG(conn != NULL); ticker_status = ticker_update(TICKER_INSTANCE_ID_CTLR, TICKER_USER_ID_ULL_HIGH, @@ -543,9 +543,9 @@ void ull_conn_iso_done(struct node_rx_event_done *done) ticker_update_cig_op_cb, cig); - LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) || - (ticker_status == TICKER_STATUS_BUSY) || - ((void *)conn == ull_disable_mark_get())); + LL_ASSERT_ERR((ticker_status == TICKER_STATUS_SUCCESS) || + (ticker_status == TICKER_STATUS_BUSY) || + ((void *)conn == ull_disable_mark_get())); } } @@ -569,8 +569,8 @@ void ull_conn_iso_cis_stop(struct ll_conn_iso_stream *cis, if (cis->teardown) { /* Teardown already started */ - LL_ASSERT(!cis->released_cb || !cis_released_cb || - (cis->released_cb == cis_released_cb)); + LL_ASSERT_ERR(!cis->released_cb || !cis_released_cb || + (cis->released_cb == cis_released_cb)); if (cis_released_cb) { cis->released_cb = cis_released_cb; @@ -600,15 +600,15 @@ void ull_conn_iso_cis_stop(struct ll_conn_iso_stream *cis, * continue CIS teardown from there. The disabled_cb cannot be * reserved for other use. */ - LL_ASSERT(!hdr->disabled_cb || - (hdr->disabled_cb == cis_disabled_cb)); + LL_ASSERT_ERR(!hdr->disabled_cb || + (hdr->disabled_cb == cis_disabled_cb)); hdr->disabled_param = mfy.param; hdr->disabled_cb = cis_disabled_cb; /* Trigger LLL disable */ ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } else { /* No pending LLL events */ @@ -707,7 +707,7 @@ void ull_conn_iso_ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, /* Increment CIS event counters */ for (int i = 0; i < cig->lll.num_cis; i++) { cis = ll_conn_iso_stream_get_by_group(cig, &handle_iter); - LL_ASSERT(cis); + LL_ASSERT_DBG(cis); /* New CIS may become available by creation prior to the CIG * event in which it has event_count == 0. Don't increment @@ -747,7 +747,7 @@ void ull_conn_iso_ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, /* Increment prepare reference count */ ref = ull_ref_inc(&cig->ull); - LL_ASSERT(ref); + LL_ASSERT_DBG(ref); /* Append timing parameters */ p.ticks_at_expire = ticks_at_expire; @@ -767,7 +767,7 @@ void ull_conn_iso_ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, mfy.fp = lll_peripheral_iso_prepare; #else /* !CONFIG_BT_CTLR_CENTRAL_ISO && !CONFIG_BT_CTLR_PERIPHERAL_ISO */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); return; #endif /* !CONFIG_BT_CTLR_CENTRAL_ISO && !CONFIG_BT_CTLR_PERIPHERAL_ISO */ @@ -791,7 +791,7 @@ void ull_conn_iso_ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, /* Kick LLL prepare */ err = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0, &mfy); - LL_ASSERT(!err); + LL_ASSERT_ERR(!err); /* Handle ISO Transmit Test for this CIG */ ull_conn_iso_transmit_test_cig_interval(cig->lll.handle, ticks_at_expire); @@ -1022,9 +1022,9 @@ void ull_conn_iso_start(struct ll_conn *conn, uint16_t cis_handle, /* FIXME: Handle latency due to skipped ACL events around the * instant to start CIG */ - LL_ASSERT(instant_latency == 0U); + LL_ASSERT_ERR(instant_latency == 0U); } else { - LL_ASSERT(0); + LL_ASSERT_DBG(0); return; } @@ -1032,7 +1032,7 @@ void ull_conn_iso_start(struct ll_conn *conn, uint16_t cis_handle, /* Make sure we have time to service first subevent. TODO: Improve * by skipping interval(s) and incrementing event_count. */ - LL_ASSERT(cig_offset_us > 0); + LL_ASSERT_ERR(cig_offset_us > 0); ull_hdr_init(&cig->ull); @@ -1097,8 +1097,8 @@ void ull_conn_iso_start(struct ll_conn *conn, uint16_t cis_handle, TICKER_NULL_LAZY, ticks_slot, ull_conn_iso_ticker_cb, cig, ticker_start_op_cb, NULL); - LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) || - (ticker_status == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ticker_status == TICKER_STATUS_SUCCESS) || + (ticker_status == TICKER_STATUS_BUSY)); /* Set CIG and the first CIS state as active */ cig->state = CIG_STATE_ACTIVE; @@ -1114,7 +1114,7 @@ static void cis_lazy_fill(struct ll_conn_iso_stream *cis) mfy.param = cis; ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_ULL_LOW, 1U, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } static void mfy_cis_lazy_fill(void *param) @@ -1177,11 +1177,11 @@ static void mfy_cis_lazy_fill(void *param) } success = (ret_cb == TICKER_STATUS_SUCCESS); - LL_ASSERT(success); + LL_ASSERT_ERR(success); - LL_ASSERT((ticks_current == ticks_previous) || retry--); + LL_ASSERT_ERR((ticks_current == ticks_previous) || retry--); - LL_ASSERT(id != TICKER_NULL); + LL_ASSERT_ERR(id != TICKER_NULL); } while (id != ticker_id); /* Set CIS active in already active CIG and any previous laziness in @@ -1203,7 +1203,7 @@ static void ticker_start_op_cb(uint32_t status, void *param) { ARG_UNUSED(param); - LL_ASSERT(status == TICKER_STATUS_SUCCESS); + LL_ASSERT_ERR(status == TICKER_STATUS_SUCCESS); } static void ticker_update_cig_op_cb(uint32_t status, void *param) @@ -1212,9 +1212,9 @@ static void ticker_update_cig_op_cb(uint32_t status, void *param) * when disconnecting (race between ticker_update and ticker_stop * calls). TODO: Are the race-checks needed? */ - LL_ASSERT(status == TICKER_STATUS_SUCCESS || - param == ull_update_mark_get() || - param == ull_disable_mark_get()); + LL_ASSERT_ERR((status == TICKER_STATUS_SUCCESS) || + (param == ull_update_mark_get()) || + (param == ull_disable_mark_get())); } static void cis_disabled_cb(void *param) @@ -1241,7 +1241,7 @@ static void cis_disabled_cb(void *param) num_cis = cig->lll.num_cis; for (cis_idx = 0; cis_idx < num_cis; cis_idx++) { cis = ll_conn_iso_stream_get_by_group(cig, &handle_iter); - LL_ASSERT(cis); + LL_ASSERT_DBG(cis); if (!cis->lll.active && (cis->lll.flush != LLL_CIS_FLUSH_COMPLETE)) { /* CIS is not active and did not just complete LLL flush - skip it */ @@ -1257,7 +1257,7 @@ static void cis_disabled_cb(void *param) ll_iso_stream_released_cb_t cis_released_cb; conn = ll_conn_get(cis->lll.acl_handle); - LL_ASSERT(conn != NULL); + LL_ASSERT_DBG(conn != NULL); cis_released_cb = cis->released_cb; cis->released_cb = NULL; @@ -1285,7 +1285,7 @@ static void cis_disabled_cb(void *param) cis->lll.acl_handle = LLL_HANDLE_INVALID; } else { - LL_ASSERT(0); + LL_ASSERT_DBG(0); } /* CIS is no longer active */ @@ -1313,7 +1313,7 @@ static void cis_disabled_cb(void *param) * further enqueuing of TX nodes for terminating CIS. */ node_terminate = ull_pdu_rx_alloc(); - LL_ASSERT(node_terminate); + LL_ASSERT_ERR(node_terminate); node_terminate->hdr.handle = cis->lll.handle; node_terminate->hdr.type = NODE_RX_TYPE_TERMINATE; *((uint8_t *)node_terminate->pdu) = cis->terminate_reason; @@ -1321,7 +1321,7 @@ static void cis_disabled_cb(void *param) ll_rx_put_sched(node_terminate->hdr.link, node_terminate); } else { conn = ll_conn_get(cis->lll.acl_handle); - LL_ASSERT(conn != NULL); + LL_ASSERT_DBG(conn != NULL); /* CIS was not established - complete the procedure with error */ if (ull_cp_cc_awaiting_established(conn)) { @@ -1369,8 +1369,8 @@ static void cis_disabled_cb(void *param) ticker_stop_op_cb, cig); - LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) || - (ticker_status == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ticker_status == TICKER_STATUS_SUCCESS) || + (ticker_status == TICKER_STATUS_BUSY)); } } @@ -1395,7 +1395,7 @@ static void cis_tx_lll_flush(void *param) memq_link_t *link; cis = ll_conn_iso_stream_get_by_group(cig, &handle_iter); - LL_ASSERT(cis); + LL_ASSERT_DBG(cis); lll = &cis->lll; @@ -1423,9 +1423,9 @@ static void cis_tx_lll_flush(void *param) (void **)&tx); } - LL_ASSERT(!lll->link_tx_free); + LL_ASSERT_DBG(!lll->link_tx_free); link = memq_deinit(&lll->memq_tx.head, &lll->memq_tx.tail); - LL_ASSERT(link); + LL_ASSERT_DBG(link); lll->link_tx_free = link; lll->flush = LLL_CIS_FLUSH_COMPLETE; @@ -1444,13 +1444,13 @@ static void ticker_stop_op_cb(uint32_t status, void *param) uint32_t ret; /* Assert if race between thread and ULL */ - LL_ASSERT(status == TICKER_STATUS_SUCCESS); + LL_ASSERT_ERR(status == TICKER_STATUS_SUCCESS); /* Check if any pending LLL events that need to be aborted */ mfy.param = param; ret = mayfly_enqueue(TICKER_USER_ID_ULL_LOW, TICKER_USER_ID_ULL_HIGH, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } static void cig_disable(void *param) @@ -1471,14 +1471,14 @@ static void cig_disable(void *param) /* Setup disabled callback to be called when ref count * returns to zero. */ - LL_ASSERT(!hdr->disabled_cb); + LL_ASSERT_ERR(!hdr->disabled_cb); hdr->disabled_param = mfy.param; hdr->disabled_cb = cig_disabled_cb; /* Trigger LLL disable */ ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } else { /* No pending LLL events */ cig_disabled_cb(&cig->lll); @@ -1527,7 +1527,7 @@ void ull_conn_iso_transmit_test_cig_interval(uint16_t handle, uint32_t ticks_at_ uint8_t tx_sdu_count; cig = ll_conn_iso_group_get(handle); - LL_ASSERT(cig); + LL_ASSERT_DBG(cig); handle_iter = UINT16_MAX; @@ -1540,7 +1540,7 @@ void ull_conn_iso_transmit_test_cig_interval(uint16_t handle, uint32_t ticks_at_ sdu_interval = cig->c_sdu_interval; } else { - LL_ASSERT(0); + LL_ASSERT_DBG(0); return; } @@ -1550,7 +1550,7 @@ void ull_conn_iso_transmit_test_cig_interval(uint16_t handle, uint32_t ticks_at_ /* Handle ISO Transmit Test for all active CISes in the group */ for (uint8_t i = 0; i < cig->lll.num_cis; i++) { cis = ll_conn_iso_stream_get_by_group(cig, &handle_iter); - LL_ASSERT(cis); + LL_ASSERT_DBG(cis); if (!cis->hdr.test_mode.tx.enabled || cis->lll.handle == LLL_HANDLE_INVALID) { continue; diff --git a/subsys/bluetooth/controller/ll_sw/ull_df.c b/subsys/bluetooth/controller/ll_sw/ull_df.c index ba04dac16489..ac26c11cd725 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_df.c +++ b/subsys/bluetooth/controller/ll_sw/ull_df.c @@ -451,7 +451,7 @@ uint8_t ll_df_set_cl_iq_sampling_enable(uint16_t handle, #if defined(CONFIG_BT_CTLR_DF_DEBUG_ENABLE) /* When CTE is enabled there should be no iq report allocated */ - IF_SINGLE_ADV_SYNC_SET(LL_ASSERT(iq_report_alloc_count == 0)); + IF_SINGLE_ADV_SYNC_SET(LL_ASSERT_DBG(iq_report_alloc_count == 0)); #endif /* CONFIG_BT_CTLR_DF_DEBUG_ENABLE */ /* Enable of already enabled CTE updates AoA configuration */ @@ -510,7 +510,7 @@ uint8_t ll_df_set_cl_iq_sampling_enable(uint16_t handle, * Periodic sync lost event also disables the CTE sampling. */ err = ull_sync_slot_update(sync, slot_plus_us, slot_minus_us); - LL_ASSERT(err == 0 || err == -ENOENT); + LL_ASSERT_DBG(err == 0 || err == -ENOENT); } return 0; @@ -580,7 +580,7 @@ void ull_df_iq_report_mem_release(struct node_rx_pdu *rx) void ull_iq_report_link_inc_quota(int8_t delta) { - LL_ASSERT(delta <= 0 || mem_link_iq_report_quota_pdu < (IQ_REPORT_CNT)); + LL_ASSERT_DBG(delta <= 0 || mem_link_iq_report_quota_pdu < (IQ_REPORT_CNT)); mem_link_iq_report_quota_pdu += delta; } diff --git a/subsys/bluetooth/controller/ll_sw/ull_filter.c b/subsys/bluetooth/controller/ll_sw/ull_filter.c index bff2a0633674..8466e20731e9 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_filter.c +++ b/subsys/bluetooth/controller/ll_sw/ull_filter.c @@ -277,8 +277,8 @@ uint8_t ll_fal_remove(bt_addr_le_t *addr) #if defined(CONFIG_BT_CTLR_PRIVACY) void ll_rl_id_addr_get(uint8_t rl_idx, uint8_t *id_addr_type, uint8_t *id_addr) { - LL_ASSERT(rl_idx < CONFIG_BT_CTLR_RL_SIZE); - LL_ASSERT(rl[rl_idx].taken); + LL_ASSERT_DBG(rl_idx < CONFIG_BT_CTLR_RL_SIZE); + LL_ASSERT_DBG(rl[rl_idx].taken); *id_addr_type = rl[rl_idx].id_addr_type; (void)memcpy(id_addr, rl[rl_idx].id_addr.val, BDADDR_SIZE); @@ -607,7 +607,7 @@ bool ull_filter_ull_pal_listed(const uint8_t rl_idx, uint8_t *const addr_type, return false; } - LL_ASSERT(rl[rl_idx].taken); + LL_ASSERT_DBG(rl[rl_idx].taken); if (rl[rl_idx].pal) { uint8_t pal_idx = rl[rl_idx].pal - 1; @@ -663,7 +663,7 @@ struct lll_filter *ull_filter_lll_get(bool filter) } return &rl_filter; #else - LL_ASSERT(filter); + LL_ASSERT_DBG(filter); return &fal_filter; #endif } @@ -752,7 +752,7 @@ void ull_filter_rpa_update(bool timeout) sys_memcpy_swap(irk, peer_irks[rl[i].pirk_idx], IRK_SIZE); err = bt_rpa_create(irk, &rl[i].peer_rpa); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); #if defined(CONFIG_BT_CTLR_SW_DEFERRED_PRIVACY) /* a new key was added, * invalidate the known/unknown peer RPA cache @@ -766,7 +766,7 @@ void ull_filter_rpa_update(bool timeout) bt_addr_t rpa; err = bt_rpa_create(rl[i].local_irk, &rpa); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); /* pointer read/write assumed to be atomic * so that if ISR fires the local_rpa pointer * will always point to a valid full RPA @@ -805,7 +805,7 @@ const uint8_t *ull_filter_adva_get(uint8_t rl_idx) { /* AdvA */ if (rl_idx < ARRAY_SIZE(rl) && rl[rl_idx].lirk) { - LL_ASSERT(rl[rl_idx].rpas_ready); + LL_ASSERT_DBG(rl[rl_idx].rpas_ready); return rl[rl_idx].local_rpa->val; } @@ -884,13 +884,13 @@ uint8_t ull_filter_lll_rl_idx(bool filter, uint8_t devmatch_id) uint8_t i; if (filter) { - LL_ASSERT(devmatch_id < ARRAY_SIZE(fal)); - LL_ASSERT(fal[devmatch_id].taken); + LL_ASSERT_DBG(devmatch_id < ARRAY_SIZE(fal)); + LL_ASSERT_DBG(fal[devmatch_id].taken); i = fal[devmatch_id].rl_idx; } else { - LL_ASSERT(devmatch_id < ARRAY_SIZE(rl)); + LL_ASSERT_DBG(devmatch_id < ARRAY_SIZE(rl)); i = devmatch_id; - LL_ASSERT(rl[i].taken); + LL_ASSERT_DBG(rl[i].taken); } return i; @@ -900,10 +900,10 @@ uint8_t ull_filter_lll_rl_irk_idx(uint8_t irkmatch_id) { uint8_t i; - LL_ASSERT(irkmatch_id < peer_irk_count); + LL_ASSERT_DBG(irkmatch_id < peer_irk_count); i = peer_irk_rl_ids[irkmatch_id]; - LL_ASSERT(i < CONFIG_BT_CTLR_RL_SIZE); - LL_ASSERT(rl[i].taken); + LL_ASSERT_DBG(i < CONFIG_BT_CTLR_RL_SIZE); + LL_ASSERT_DBG(rl[i].taken); return i; } @@ -914,7 +914,7 @@ bool ull_filter_lll_irk_in_fal(uint8_t rl_idx) return false; } - LL_ASSERT(rl[rl_idx].taken); + LL_ASSERT_DBG(rl[rl_idx].taken); return rl[rl_idx].fal; } @@ -938,8 +938,8 @@ bool ull_filter_lll_rl_idx_allowed(uint8_t irkmatch_ok, uint8_t rl_idx) return true; } - LL_ASSERT(rl_idx < CONFIG_BT_CTLR_RL_SIZE); - LL_ASSERT(rl[rl_idx].taken); + LL_ASSERT_DBG(rl_idx < CONFIG_BT_CTLR_RL_SIZE); + LL_ASSERT_DBG(rl[rl_idx].taken); return !rl[rl_idx].pirk || rl[rl_idx].dev; } diff --git a/subsys/bluetooth/controller/ll_sw/ull_iso.c b/subsys/bluetooth/controller/ll_sw/ull_iso.c index 31a51a8bc145..c32aaced2076 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_iso.c +++ b/subsys/bluetooth/controller/ll_sw/ull_iso.c @@ -662,7 +662,7 @@ static isoal_status_t ll_iso_test_sdu_alloc(const struct isoal_sink *sink_ctx, struct ll_conn_iso_stream *cis; cis = ll_iso_stream_connected_get(sink_ctx->session.handle); - LL_ASSERT(cis); + LL_ASSERT_DBG(cis); /* For unframed, SDU counter is the payload number */ cis->hdr.test_mode.rx.sdu_counter = @@ -675,7 +675,7 @@ static isoal_status_t ll_iso_test_sdu_alloc(const struct isoal_sink *sink_ctx, stream_handle = LL_BIS_SYNC_IDX_FROM_HANDLE(handle); sync_stream = ull_sync_iso_stream_get(stream_handle); - LL_ASSERT(sync_stream); + LL_ASSERT_DBG(sync_stream); sync_stream->test_mode->sdu_counter = (uint32_t)valid_pdu->meta->payload_number; @@ -709,7 +709,7 @@ static isoal_status_t ll_iso_test_sdu_emit(const struct isoal_sink * struct ll_conn_iso_stream *cis; cis = ll_iso_stream_connected_get(sink_ctx->session.handle); - LL_ASSERT(cis); + LL_ASSERT_DBG(cis); test_mode_rx = &cis->hdr.test_mode.rx; max_sdu = cis->c_max_sdu; @@ -721,7 +721,7 @@ static isoal_status_t ll_iso_test_sdu_emit(const struct isoal_sink * stream_handle = LL_BIS_SYNC_IDX_FROM_HANDLE(handle); sync_stream = ull_sync_iso_stream_get(stream_handle); - LL_ASSERT(sync_stream); + LL_ASSERT_DBG(sync_stream); sync_iso = ull_sync_iso_by_stream_get(stream_handle); @@ -790,7 +790,7 @@ static isoal_status_t ll_iso_test_sdu_emit(const struct isoal_sink * break; default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); return ISOAL_STATUS_ERR_SDU_EMIT; } break; @@ -1105,7 +1105,7 @@ void ll_iso_transmit_test_send_sdu(uint16_t handle, uint32_t ticks_at_expire) uint8_t rand_8; cis = ll_iso_stream_connected_get(handle); - LL_ASSERT(cis); + LL_ASSERT_DBG(cis); if (!cis->hdr.test_mode.tx.enabled) { /* Transmit Test Mode not enabled */ @@ -1130,12 +1130,12 @@ void ll_iso_transmit_test_send_sdu(uint16_t handle, uint32_t ticks_at_expire) break; case BT_HCI_ISO_TEST_MAX_SIZE_SDU: - LL_ASSERT(max_sdu > ISO_TEST_PACKET_COUNTER_SIZE); + LL_ASSERT_DBG(max_sdu > ISO_TEST_PACKET_COUNTER_SIZE); remaining_tx = max_sdu; break; default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); return; } @@ -1206,7 +1206,7 @@ void ll_iso_transmit_test_send_sdu(uint16_t handle, uint32_t ticks_at_expire) /* Send to ISOAL */ err = isoal_tx_sdu_fragment(source_handle, &sdu); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); remaining_tx -= sdu.size; @@ -1222,7 +1222,7 @@ void ll_iso_transmit_test_send_sdu(uint16_t handle, uint32_t ticks_at_expire) } else if (IS_ADV_ISO_HANDLE(handle)) { /* FIXME: Implement for broadcaster */ } else { - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } #endif /* CONFIG_BT_CTLR_CONN_ISO */ @@ -1503,7 +1503,7 @@ void ull_iso_lll_ack_enqueue(uint16_t handle, struct node_tx_iso *node_tx) ll_tx_ack_put(handle, (void *)node_tx); ll_rx_sched(); } else { - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } @@ -1538,7 +1538,7 @@ void ull_iso_lll_event_prepare(uint16_t handle, uint64_t event_count) isoal_tx_event_prepare(dp->source_hdl, event_count); } } else { - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } #endif /* CONFIG_BT_CTLR_ADV_ISO || CONFIG_BT_CTLR_CONN_ISO */ @@ -1692,7 +1692,7 @@ static void iso_rx_demux(void *param) const isoal_status_t err = isoal_rx_pdu_recombine(dp->sink_hdl, &pckt_meta); - LL_ASSERT(err == ISOAL_STATUS_OK); /* TODO handle err */ + LL_ASSERT_ERR(err == ISOAL_STATUS_OK); /* TODO handle err */ } #endif /* CONFIG_BT_CTLR_CONN_ISO || CONFIG_BT_CTLR_SYNC_ISO */ @@ -1702,7 +1702,7 @@ static void iso_rx_demux(void *param) break; default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } } @@ -1749,7 +1749,7 @@ void ll_iso_rx_dequeue(void) link = memq_dequeue(memq_ll_iso_rx.tail, &memq_ll_iso_rx.head, (void **)&rx); - LL_ASSERT(link); + LL_ASSERT_DBG(link); mem_release(link, &mem_link_iso_rx.free); @@ -1758,7 +1758,7 @@ void ll_iso_rx_dequeue(void) case NODE_RX_TYPE_ISO_PDU: break; default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } } @@ -1825,7 +1825,7 @@ static isoal_status_t ll_iso_pdu_alloc(struct isoal_pdu_buffer *pdu_buffer) /* TODO: Report overflow to HCI and remove assert * data_buf_overflow(evt, BT_OVERFLOW_LINK_ISO) */ - LL_ASSERT(0); + LL_ASSERT_ERR(0); return ISOAL_STATUS_ERR_PDU_ALLOC; } @@ -1860,9 +1860,9 @@ static isoal_status_t ll_iso_pdu_write(struct isoal_pdu_buffer *pdu_buffer, ARG_UNUSED(pdu_offset); ARG_UNUSED(consume_len); - LL_ASSERT(pdu_buffer); - LL_ASSERT(pdu_buffer->pdu); - LL_ASSERT(sdu_payload); + LL_ASSERT_DBG(pdu_buffer); + LL_ASSERT_DBG(pdu_buffer->pdu); + LL_ASSERT_DBG(sdu_payload); if ((pdu_offset + consume_len) > pdu_buffer->size) { /* Exceeded PDU buffer */ @@ -1887,7 +1887,7 @@ static isoal_status_t ll_iso_pdu_emit(struct node_tx_iso *node_tx, memq_link_t *link; link = mem_acquire(&mem_link_iso_tx.free); - LL_ASSERT(link); + LL_ASSERT_ERR(link); if (ll_iso_tx_mem_enqueue(handle, node_tx, link)) { return ISOAL_STATUS_ERR_PDU_EMIT; @@ -1947,7 +1947,7 @@ static int init_reset(void) /* Acquire a link to initialize ull rx memq */ link = mem_acquire(&mem_link_iso_rx.free); - LL_ASSERT(link); + LL_ASSERT_DBG(link); #if defined(CONFIG_BT_CTLR_ISO_VENDOR_DATA_PATH) /* Initialize ull rx memq */ @@ -1956,7 +1956,7 @@ static int init_reset(void) /* Acquire a link to initialize ll_iso_rx memq */ link = mem_acquire(&mem_link_iso_rx.free); - LL_ASSERT(link); + LL_ASSERT_DBG(link); /* Initialize ll_iso_rx memq */ MEMQ_INIT(ll_iso_rx, link); @@ -2012,7 +2012,7 @@ void ull_iso_resume_ticker_start(struct lll_event *resume_event, ticker_id = TICKER_ID_SCAN_SYNC_ISO_RESUME_BASE + group_handle; #endif /* CONFIG_BT_CTLR_SYNC_ISO */ } else { - LL_ASSERT(0); + LL_ASSERT_DBG(0); } if (role == BT_HCI_ROLE_PERIPHERAL) { @@ -2031,7 +2031,7 @@ void ull_iso_resume_ticker_start(struct lll_event *resume_event, cis = ll_conn_iso_stream_get(stream_handle); conn = ll_conn_get(cis->lll.acl_handle); - LL_ASSERT(conn != NULL); + LL_ASSERT_DBG(conn != NULL); phy = conn->lll.phy_rx; #endif /* CONFIG_BT_CTLR_CONN_ISO */ @@ -2045,7 +2045,7 @@ void ull_iso_resume_ticker_start(struct lll_event *resume_event, phy = sync_iso->lll.phy; #endif /* CONFIG_BT_CTLR_SYNC_ISO */ } else { - LL_ASSERT(0); + LL_ASSERT_DBG(0); } resume_delay_us += @@ -2058,7 +2058,7 @@ void ull_iso_resume_ticker_start(struct lll_event *resume_event, } resume_offset_us = (int32_t)(resume_timeout - resume_delay_us); - LL_ASSERT(resume_offset_us >= 0); + LL_ASSERT_DBG(resume_offset_us >= 0); /* Setup resume timeout as single-shot */ ret = ticker_start(TICKER_INSTANCE_ID_CTLR, @@ -2073,15 +2073,15 @@ void ull_iso_resume_ticker_start(struct lll_event *resume_event, ticker_resume_cb, resume_event, ticker_resume_op_cb, NULL); - LL_ASSERT((ret == TICKER_STATUS_SUCCESS) || - (ret == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ret == TICKER_STATUS_SUCCESS) || + (ret == TICKER_STATUS_BUSY)); } static void ticker_resume_op_cb(uint32_t status, void *param) { ARG_UNUSED(param); - LL_ASSERT(status == TICKER_STATUS_SUCCESS); + LL_ASSERT_ERR(status == TICKER_STATUS_SUCCESS); } static void ticker_resume_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, @@ -2094,7 +2094,7 @@ static void ticker_resume_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, uint32_t ret; ARG_UNUSED(ticks_drift); - LL_ASSERT(lazy == 0); + LL_ASSERT_DBG(lazy == 0); resume_event = param; @@ -2109,6 +2109,6 @@ static void ticker_resume_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } #endif /* CONFIG_BT_CTLR_CONN_ISO || CONFIG_BT_CTLR_SYNC_ISO */ diff --git a/subsys/bluetooth/controller/ll_sw/ull_llcp.c b/subsys/bluetooth/controller/ll_sw/ull_llcp.c index 0f9877ecc845..f23b7f388bc2 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_llcp.c +++ b/subsys/bluetooth/controller/ll_sw/ull_llcp.c @@ -109,7 +109,7 @@ static struct proc_ctx *proc_ctx_acquire(struct llcp_mem_pool *owner) void llcp_proc_ctx_release(struct proc_ctx *ctx) { /* We need to have an owner otherwise the memory allocated would leak */ - LL_ASSERT(ctx->owner); + LL_ASSERT_DBG(ctx->owner); /* Release the memory back to the owner */ mem_release(ctx, &ctx->owner->free); @@ -297,7 +297,7 @@ void llcp_tx_resume_data(struct ll_conn *conn, enum llcp_tx_q_pause_data_mask re void llcp_rx_node_retain(struct proc_ctx *ctx) { - LL_ASSERT(ctx->node_ref.rx); + LL_ASSERT_DBG(ctx->node_ref.rx); /* Only retain if not already retained */ if (ctx->node_ref.rx->hdr.type != NODE_RX_TYPE_RETAIN) { @@ -311,7 +311,7 @@ void llcp_rx_node_retain(struct proc_ctx *ctx) void llcp_rx_node_release(struct proc_ctx *ctx) { - LL_ASSERT(ctx->node_ref.rx); + LL_ASSERT_DBG(ctx->node_ref.rx); /* Only release if retained */ if (ctx->node_ref.rx->hdr.type == NODE_RX_TYPE_RETAIN) { @@ -472,7 +472,7 @@ void ull_cp_release_tx(struct ll_conn *conn, struct node_tx *tx) { #if defined(LLCP_TX_CTRL_BUF_QUEUE_ENABLE) if (conn) { - LL_ASSERT(conn->llcp.tx_buffer_alloc > 0); + LL_ASSERT_DBG(conn->llcp.tx_buffer_alloc > 0); if (conn->llcp.tx_buffer_alloc > CONFIG_BT_CTLR_LLCP_PER_CONN_TX_CTRL_BUF_NUM) { common_tx_buffer_alloc--; } @@ -511,7 +511,7 @@ int ull_cp_prt_elapse(struct ll_conn *conn, uint16_t elapsed_event, uint8_t *err struct proc_ctx *ctx; ctx = llcp_lr_peek(conn); - LL_ASSERT(ctx); + LL_ASSERT_DBG(ctx); if (ctx->proc == PROC_TERMINATE) { /* Active procedure is ACL Termination */ @@ -1026,7 +1026,7 @@ uint8_t ull_cp_conn_update(struct ll_conn *conn, uint16_t interval_min, uint16_t } #endif /* CONFIG_BT_CTLR_CONN_PARAM_REQ */ } else { - LL_ASSERT(0); /* Unknown procedure */ + LL_ASSERT_DBG(0); /* Unknown procedure */ } llcp_lr_enqueue(conn, ctx); @@ -1051,7 +1051,7 @@ uint8_t ull_cp_periodic_sync(struct ll_conn *conn, struct ll_sync_set *sync, uint8_t phy; /* Exactly one of the sync and adv_sync pointers should be non-null */ - LL_ASSERT((!adv_sync && sync) || (adv_sync && !sync)); + LL_ASSERT_DBG((!adv_sync && sync) || (adv_sync && !sync)); if (!feature_peer_periodic_sync_recv(conn)) { return BT_HCI_ERR_UNSUPP_REMOTE_FEATURE; @@ -1080,7 +1080,7 @@ uint8_t ull_cp_periodic_sync(struct ll_conn *conn, struct ll_sync_set *sync, rl_idx = ull_filter_rl_find(addr_type, sync->peer_id_addr, NULL); /* A resolved address must be present in the resolve list */ - LL_ASSERT(rl_idx < ll_rl_size_get()); + LL_ASSERT_DBG(rl_idx < ll_rl_size_get()); /* Generate RPAs if required */ ull_filter_rpa_update(false); @@ -1999,7 +1999,7 @@ void ull_cp_rx(struct ll_conn *conn, memq_link_t *link, struct node_rx_pdu *rx) */ /* Process PDU as a new remote request */ - LL_ASSERT(pdu_valid); + LL_ASSERT_DBG(pdu_valid); llcp_rr_new(conn, link, rx, true); } else { /* Local active procedure diff --git a/subsys/bluetooth/controller/ll_sw/ull_llcp_cc.c b/subsys/bluetooth/controller/ll_sw/ull_llcp_cc.c index 6e12571d88c6..e70d6e664fc9 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_llcp_cc.c +++ b/subsys/bluetooth/controller/ll_sw/ull_llcp_cc.c @@ -65,7 +65,7 @@ static void cc_ntf_established(struct ll_conn *conn, struct proc_ctx *ctx) /* Allocate ntf node */ ntf = ctx->node_ref.rx; - LL_ASSERT(ntf); + LL_ASSERT_DBG(ntf); ctx->node_ref.rx = NULL; piggy_back = (ntf->hdr.type != NODE_RX_TYPE_RETAIN); @@ -146,7 +146,7 @@ static void llcp_rp_cc_tx_rsp(struct ll_conn *conn, struct proc_ctx *ctx) /* Allocate tx node */ tx = llcp_tx_alloc(conn, ctx); - LL_ASSERT(tx); + LL_ASSERT_DBG(tx); pdu = (struct pdu_data *)tx->pdu; conn_event_count = ctx->data.cis_create.conn_event_count; @@ -201,7 +201,7 @@ static void llcp_rp_cc_tx_reject(struct ll_conn *conn, struct proc_ctx *ctx, uin /* Allocate tx node */ tx = ctx->node_ref.tx; - LL_ASSERT(tx); + LL_ASSERT_DBG(tx); ctx->node_ref.tx = NULL; pdu = (struct pdu_data *)tx->pdu; @@ -221,7 +221,7 @@ static void rp_cc_ntf_create(struct ll_conn *conn, struct proc_ctx *ctx) ntf = ctx->node_ref.rx; ctx->node_ref.rx = NULL; - LL_ASSERT(ntf); + LL_ASSERT_DBG(ntf); ntf->hdr.type = NODE_RX_TYPE_CIS_REQUEST; ntf->hdr.handle = conn->lll.handle; @@ -490,7 +490,7 @@ static void rp_cc_state_wait_rx_cis_ind(struct ll_conn *conn, struct proc_ctx *c } /* If we get to here the CIG_ID referred in req/acquire has become void/invalid */ /* This cannot happen unless the universe has started to deflate */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); case RP_CC_EVT_REJECT: /* Handle CIS creation rejection */ break; @@ -656,7 +656,7 @@ static void rp_cc_execute_fsm(struct ll_conn *conn, struct proc_ctx *ctx, uint8_ break; default: /* Unknown state */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } @@ -767,7 +767,7 @@ static void lp_cc_tx(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t opcode) /* Allocate tx node */ tx = llcp_tx_alloc(conn, ctx); - LL_ASSERT(tx); + LL_ASSERT_DBG(tx); pdu = (struct pdu_data *)tx->pdu; @@ -781,7 +781,7 @@ static void lp_cc_tx(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t opcode) break; default: /* Unknown opcode */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } @@ -929,7 +929,7 @@ static void lp_cc_st_idle(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t ev break; default: /* Unknown procedure */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } break; @@ -971,7 +971,7 @@ static void cc_prepare_cis_ind(struct ll_conn *conn, struct proc_ctx *ctx) &ctx->data.cis_create.cis_offset_max, &ctx->data.cis_create.conn_event_count, ctx->data.cis_create.aa); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); ctx->state = LP_CC_STATE_WAIT_INSTANT; ctx->rx_opcode = PDU_DATA_LLCTRL_TYPE_UNUSED; @@ -1054,7 +1054,7 @@ static void lp_cc_st_wait_rx_cis_rsp_cancel(struct ll_conn *conn, struct proc_ct case LP_CC_EVT_CIS_RSP: /* Allocate tx node */ tx = llcp_tx_alloc(conn, ctx); - LL_ASSERT(tx); + LL_ASSERT_DBG(tx); pdu = (struct pdu_data *)tx->pdu; @@ -1177,7 +1177,7 @@ static void lp_cc_execute_fsm(struct ll_conn *conn, struct proc_ctx *ctx, uint8_ break; default: /* Unknown state */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } } diff --git a/subsys/bluetooth/controller/ll_sw/ull_llcp_chmu.c b/subsys/bluetooth/controller/ll_sw/ull_llcp_chmu.c index 04b51ce79947..772aba812d15 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_llcp_chmu.c +++ b/subsys/bluetooth/controller/ll_sw/ull_llcp_chmu.c @@ -89,7 +89,7 @@ static void lp_chmu_tx(struct ll_conn *conn, struct proc_ctx *ctx) /* Allocate tx node */ tx = llcp_tx_alloc(conn, ctx); - LL_ASSERT(tx); + LL_ASSERT_DBG(tx); pdu = (struct pdu_data *)tx->pdu; @@ -180,7 +180,7 @@ static void lp_chmu_execute_fsm(struct ll_conn *conn, struct proc_ctx *ctx, uint break; default: /* Unknown state */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } @@ -293,7 +293,7 @@ static void rp_chmu_execute_fsm(struct ll_conn *conn, struct proc_ctx *ctx, uint break; default: /* Unknown state */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } diff --git a/subsys/bluetooth/controller/ll_sw/ull_llcp_common.c b/subsys/bluetooth/controller/ll_sw/ull_llcp_common.c index b0e28e124bdc..84098f1b149f 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_llcp_common.c +++ b/subsys/bluetooth/controller/ll_sw/ull_llcp_common.c @@ -159,7 +159,7 @@ static void lp_comm_tx(struct ll_conn *conn, struct proc_ctx *ctx) /* Allocate tx node */ tx = llcp_tx_alloc(conn, ctx); - LL_ASSERT(tx); + LL_ASSERT_DBG(tx); pdu = (struct pdu_data *)tx->pdu; @@ -218,7 +218,7 @@ static void lp_comm_tx(struct ll_conn *conn, struct proc_ctx *ctx) #endif /* CONFIG_BT_CTLR_SCA_UPDATE */ default: /* Unknown procedure */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } ctx->tx_opcode = pdu->llctrl.opcode; @@ -255,7 +255,7 @@ static void lp_comm_ntf_feature_exchange(struct ll_conn *conn, struct proc_ctx * break; default: /* Unexpected PDU, should not get through, so ASSERT */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } @@ -268,7 +268,7 @@ static void lp_comm_ntf_version_ind(struct ll_conn *conn, struct proc_ctx *ctx, break; default: /* Unexpected PDU, should not get through, so ASSERT */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } @@ -305,7 +305,7 @@ static void lp_comm_ntf_cte_req(struct ll_conn *conn, struct proc_ctx *ctx, stru break; default: /* Unexpected PDU, should not get through, so ASSERT */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } @@ -393,7 +393,7 @@ static void lp_comm_ntf(struct ll_conn *conn, struct proc_ctx *ctx) if (!ntf) { /* Allocate ntf node */ ntf = llcp_ntf_alloc(); - LL_ASSERT(ntf); + LL_ASSERT_DBG(ntf); piggy_back = 0U; } @@ -424,7 +424,7 @@ static void lp_comm_ntf(struct ll_conn *conn, struct proc_ctx *ctx) break; #endif /* CONFIG_BT_CTLR_SCA_UPDATE */ default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } @@ -585,7 +585,7 @@ static void lp_comm_complete(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t #endif /* CONFIG_BT_CTLR_SCA_UPDATE */ default: /* Unknown procedure */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } @@ -716,7 +716,7 @@ static void lp_comm_send_req(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t #endif /* CONFIG_BT_CTLR_SCA_UPDATE */ default: /* Unknown procedure */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } @@ -819,7 +819,7 @@ static void lp_comm_rx_decode(struct ll_conn *conn, struct proc_ctx *ctx, struct break; case PDU_DATA_LLCTRL_TYPE_TERMINATE_IND: /* No response expected */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; #if defined(CONFIG_BT_CTLR_DATA_LENGTH) case PDU_DATA_LLCTRL_TYPE_LENGTH_RSP: @@ -844,7 +844,7 @@ static void lp_comm_rx_decode(struct ll_conn *conn, struct proc_ctx *ctx, struct break; default: /* Unknown opcode */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } @@ -889,7 +889,7 @@ static void lp_comm_st_wait_ntf_avail(struct ll_conn *conn, struct proc_ctx *ctx * out of the ones handled in ull_llcp_common should end up waiting for * non-piggy-back'ed NTF */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } break; @@ -919,7 +919,7 @@ static void lp_comm_execute_fsm(struct ll_conn *conn, struct proc_ctx *ctx, uint break; default: /* Unknown state */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } @@ -1034,7 +1034,7 @@ static void rp_comm_rx_decode(struct ll_conn *conn, struct proc_ctx *ctx, struct #endif /* CONFIG_BT_CTLR_SCA_UPDATE */ default: /* Unknown opcode */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } @@ -1045,7 +1045,7 @@ static void rp_comm_tx(struct ll_conn *conn, struct proc_ctx *ctx) /* Allocate tx node */ tx = llcp_tx_alloc(conn, ctx); - LL_ASSERT(tx); + LL_ASSERT_DBG(tx); pdu = (struct pdu_data *)tx->pdu; @@ -1115,7 +1115,7 @@ static void rp_comm_tx(struct ll_conn *conn, struct proc_ctx *ctx) #endif /* CONFIG_BT_CTLR_SCA_UPDATE */ default: /* Unknown procedure */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } ctx->tx_opcode = pdu->llctrl.opcode; @@ -1147,10 +1147,10 @@ static void rp_comm_ntf(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t gene /* Allocate ntf node */ ntf = ctx->node_ref.rx; ctx->node_ref.rx = NULL; - LL_ASSERT(ntf); + LL_ASSERT_DBG(ntf); /* This should be an 'old' RX node, so put/sched when done */ - LL_ASSERT(ntf->hdr.type == NODE_RX_TYPE_RETAIN); + LL_ASSERT_DBG(ntf->hdr.type == NODE_RX_TYPE_RETAIN); /* And release memory if no NTF to be generated */ ntf->hdr.type = NODE_RX_TYPE_RELEASE; @@ -1159,7 +1159,7 @@ static void rp_comm_ntf(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t gene ntf->hdr.type = NODE_RX_TYPE_DC_PDU; ntf->hdr.handle = conn->lll.handle; pdu = (struct pdu_data *)ntf->pdu; - LL_ASSERT(ctx->proc == PROC_DATA_LENGTH_UPDATE); + LL_ASSERT_DBG(ctx->proc == PROC_DATA_LENGTH_UPDATE); llcp_ntf_encode_length_change(conn, pdu); } @@ -1291,7 +1291,7 @@ static void rp_comm_send_rsp(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t #endif /* CONFIG_BT_CTLR_SCA_UPDATE */ default: /* Unknown procedure */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } @@ -1313,7 +1313,7 @@ static void rp_comm_st_postpone_terminate(struct ll_conn *conn, struct proc_ctx { switch (evt) { case RP_COMMON_EVT_RUN: - LL_ASSERT(ctx->proc == PROC_TERMINATE); + LL_ASSERT_DBG(ctx->proc == PROC_TERMINATE); /* Note: now we terminate, mimicking legacy LLCP behaviour * A check should be added to ensure that the ack of the terminate_ind was @@ -1415,7 +1415,7 @@ static void rp_comm_execute_fsm(struct ll_conn *conn, struct proc_ctx *ctx, uint break; default: /* Unknown state */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } diff --git a/subsys/bluetooth/controller/ll_sw/ull_llcp_conn_upd.c b/subsys/bluetooth/controller/ll_sw/ull_llcp_conn_upd.c index 5fc5a261640f..d1a91c8d673d 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_llcp_conn_upd.c +++ b/subsys/bluetooth/controller/ll_sw/ull_llcp_conn_upd.c @@ -260,7 +260,7 @@ static void cu_ntf(struct ll_conn *conn, struct proc_ctx *ctx) /* Allocate ntf node */ ntf = ctx->node_ref.rx; ctx->node_ref.rx = NULL; - LL_ASSERT(ntf); + LL_ASSERT_DBG(ntf); piggy_back = (ntf->hdr.type != NODE_RX_TYPE_RETAIN); @@ -300,7 +300,7 @@ static void lp_cu_tx(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t opcode) if (!tx) { /* Allocate tx node if non pre-alloc'ed */ tx = llcp_tx_alloc(conn, ctx); - LL_ASSERT(tx); + LL_ASSERT_DBG(tx); } pdu = (struct pdu_data *)tx->pdu; @@ -323,7 +323,7 @@ static void lp_cu_tx(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t opcode) #endif /* CONFIG_BT_CENTRAL */ default: /* Unknown opcode */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } @@ -408,7 +408,7 @@ static void lp_cu_send_conn_param_req(struct ll_conn *conn, struct proc_ctx *ctx #endif /* CONFIG_BT_PERIPHERAL */ default: /* Unknown role */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } } @@ -491,7 +491,7 @@ static void lp_cu_st_idle(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t ev #endif /* CONFIG_BT_CENTRAL */ default: /* Unknown procedure */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } break; @@ -761,7 +761,7 @@ static void lp_cu_execute_fsm(struct ll_conn *conn, struct proc_ctx *ctx, uint8_ break; default: /* Unknown state */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } } @@ -815,7 +815,7 @@ static void rp_cu_tx(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t opcode) if (!tx) { /* Allocate tx node if non pre-alloc'ed */ tx = llcp_tx_alloc(conn, ctx); - LL_ASSERT(tx); + LL_ASSERT_DBG(tx); } pdu = (struct pdu_data *)tx->pdu; @@ -841,7 +841,7 @@ static void rp_cu_tx(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t opcode) break; default: /* Unknown opcode */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } @@ -869,7 +869,7 @@ static void rp_cu_conn_param_req_ntf(struct ll_conn *conn, struct proc_ctx *ctx) /* Allocate ntf node */ ntf = ctx->node_ref.rx; ctx->node_ref.rx = NULL; - LL_ASSERT(ntf); + LL_ASSERT_DBG(ntf); piggy_back = (ntf->hdr.type != NODE_RX_TYPE_RETAIN); @@ -903,7 +903,7 @@ static void rp_cu_send_conn_update_ind_finalize(struct ll_conn *conn, struct pro uint8_t evt, void *param) { /* Central role path, should not get here with !=NULL rx-node reference */ - LL_ASSERT(ctx->node_ref.rx == NULL); + LL_ASSERT_DBG(ctx->node_ref.rx == NULL); /* We pre-alloc NTF node */ ctx->node_ref.rx = llcp_ntf_alloc(); @@ -1015,7 +1015,7 @@ static void rp_cu_st_idle(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t ev break; default: /* Unknown procedure */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } break; @@ -1162,7 +1162,7 @@ static void rp_cu_state_wait_conn_param_req_reply_continue(struct ll_conn *conn, } } else { /* Unknown role */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } break; default: @@ -1313,7 +1313,7 @@ static void rp_cu_st_wait_rx_conn_update_ind(struct ll_conn *conn, struct proc_c break; default: /* Unknown role */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } default: /* Ignore other evts */ @@ -1382,7 +1382,7 @@ static void rp_cu_execute_fsm(struct ll_conn *conn, struct proc_ctx *ctx, uint8_ break; default: /* Unknown state */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } } diff --git a/subsys/bluetooth/controller/ll_sw/ull_llcp_enc.c b/subsys/bluetooth/controller/ll_sw/ull_llcp_enc.c index 392f37963ae0..13fae31f9e50 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_llcp_enc.c +++ b/subsys/bluetooth/controller/ll_sw/ull_llcp_enc.c @@ -187,7 +187,7 @@ static struct node_tx *llcp_lp_enc_tx(struct ll_conn *conn, struct proc_ctx *ctx /* Allocate tx node */ tx = llcp_tx_alloc(conn, ctx); - LL_ASSERT(tx); + LL_ASSERT_DBG(tx); pdu = (struct pdu_data *)tx->pdu; @@ -206,7 +206,7 @@ static struct node_tx *llcp_lp_enc_tx(struct ll_conn *conn, struct proc_ctx *ctx llcp_pdu_encode_pause_enc_rsp(pdu); break; default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); } ctx->tx_opcode = pdu->llctrl.opcode; @@ -228,7 +228,7 @@ static void lp_enc_ntf(struct ll_conn *conn, struct proc_ctx *ctx) /* Piggy-back on RX node */ ntf = ctx->node_ref.rx; ctx->node_ref.rx = NULL; - LL_ASSERT(ntf); + LL_ASSERT_DBG(ntf); ntf->hdr.type = NODE_RX_TYPE_DC_PDU; ntf->hdr.handle = conn->lll.handle; @@ -244,7 +244,7 @@ static void lp_enc_ntf(struct ll_conn *conn, struct proc_ctx *ctx) ntf->hdr.type = NODE_RX_TYPE_ENC_REFRESH; } else { /* Should never happen */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } else { llcp_pdu_encode_reject_ind(pdu, ctx->data.enc.error); @@ -379,7 +379,7 @@ static inline uint8_t reject_error_code(struct pdu_data *pdu) #endif /* CONFIG_BT_CTLR_EXT_REJ_IND */ } else { /* Called with an invalid PDU */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); /* Keep compiler happy */ error = BT_HCI_ERR_UNSPECIFIED; @@ -639,7 +639,7 @@ static void lp_enc_execute_fsm(struct ll_conn *conn, struct proc_ctx *ctx, uint8 break; default: /* Unknown state */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } @@ -705,7 +705,7 @@ static struct node_tx *llcp_rp_enc_tx(struct ll_conn *conn, struct proc_ctx *ctx /* Allocate tx node */ tx = llcp_tx_alloc(conn, ctx); - LL_ASSERT(tx); + LL_ASSERT_DBG(tx); pdu = (struct pdu_data *)tx->pdu; @@ -732,7 +732,7 @@ static struct node_tx *llcp_rp_enc_tx(struct ll_conn *conn, struct proc_ctx *ctx } break; default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); } ctx->tx_opcode = pdu->llctrl.opcode; @@ -755,7 +755,7 @@ static void rp_enc_ntf_ltk(struct ll_conn *conn, struct proc_ctx *ctx) /* Piggy-back on RX node */ ntf = ctx->node_ref.rx; ctx->node_ref.rx = NULL; - LL_ASSERT(ntf); + LL_ASSERT_DBG(ntf); piggy_back = (ntf->hdr.type != NODE_RX_TYPE_RETAIN); @@ -780,7 +780,7 @@ static void rp_enc_ntf(struct ll_conn *conn, struct proc_ctx *ctx) /* Piggy-back on RX node */ ntf = ctx->node_ref.rx; ctx->node_ref.rx = NULL; - LL_ASSERT(ntf); + LL_ASSERT_DBG(ntf); ntf->hdr.type = NODE_RX_TYPE_DC_PDU; ntf->hdr.handle = conn->lll.handle; @@ -795,7 +795,7 @@ static void rp_enc_ntf(struct ll_conn *conn, struct proc_ctx *ctx) ntf->hdr.type = NODE_RX_TYPE_ENC_REFRESH; } else { /* Should never happen */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } @@ -884,7 +884,7 @@ static void rp_enc_send_reject_ind(struct ll_conn *conn, struct proc_ctx *ctx, u */ } else { /* Shouldn't happen */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } } @@ -1232,7 +1232,7 @@ static void rp_enc_execute_fsm(struct ll_conn *conn, struct proc_ctx *ctx, uint8 break; default: /* Unknown state */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } diff --git a/subsys/bluetooth/controller/ll_sw/ull_llcp_local.c b/subsys/bluetooth/controller/ll_sw/ull_llcp_local.c index 8c97bcdfb5f7..812d84955aa2 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_llcp_local.c +++ b/subsys/bluetooth/controller/ll_sw/ull_llcp_local.c @@ -79,13 +79,13 @@ void llcp_lr_check_done(struct ll_conn *conn, struct proc_ctx *ctx) struct proc_ctx *ctx_header; ctx_header = llcp_lr_peek(conn); - LL_ASSERT(ctx_header == ctx); + LL_ASSERT_DBG(ctx_header == ctx); /* If we have a node rx it must not be marked RETAIN as * the memory referenced would leak */ - LL_ASSERT(ctx->node_ref.rx == NULL || - ctx->node_ref.rx->hdr.type != NODE_RX_TYPE_RETAIN); + LL_ASSERT_DBG(ctx->node_ref.rx == NULL || + ctx->node_ref.rx->hdr.type != NODE_RX_TYPE_RETAIN); lr_dequeue(conn); @@ -326,7 +326,7 @@ void llcp_lr_rx(struct ll_conn *conn, struct proc_ctx *ctx, memq_link_t *link, #endif /* CONFIG_BT_CTLR_SCA_UPDATE */ default: /* Unknown procedure */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } @@ -475,7 +475,7 @@ static void lr_act_run(struct ll_conn *conn) #endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER */ default: /* Unknown procedure */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } @@ -487,7 +487,7 @@ static void lr_act_complete(struct ll_conn *conn) struct proc_ctx *ctx; ctx = llcp_lr_peek(conn); - LL_ASSERT(ctx != NULL); + LL_ASSERT_DBG(ctx != NULL); /* Stop procedure response timeout timer */ llcp_lr_prt_stop(conn); @@ -617,7 +617,7 @@ static void lr_execute_fsm(struct ll_conn *conn, uint8_t evt, void *param) break; default: /* Unknown state */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } diff --git a/subsys/bluetooth/controller/ll_sw/ull_llcp_past.c b/subsys/bluetooth/controller/ll_sw/ull_llcp_past.c index 8b8f88147e0f..53e16b9f52ad 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_llcp_past.c +++ b/subsys/bluetooth/controller/ll_sw/ull_llcp_past.c @@ -326,7 +326,7 @@ static void rp_past_execute_fsm(struct ll_conn *conn, struct proc_ctx *ctx, uint #endif /* CONFIG_BT_CTLR_SW_DEFERRED_PRIVACY */ default: /* Unknown state */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } } @@ -400,7 +400,7 @@ static void lp_past_tx(struct ll_conn *conn, struct proc_ctx *ctx) /* Allocate tx node */ tx = llcp_tx_alloc(conn, ctx); - LL_ASSERT(tx); + LL_ASSERT_DBG(tx); pdu = (struct pdu_data *)tx->pdu; @@ -563,7 +563,7 @@ static void lp_past_execute_fsm(struct ll_conn *conn, struct proc_ctx *ctx, uint break; default: /* Unknown state */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } } diff --git a/subsys/bluetooth/controller/ll_sw/ull_llcp_phy.c b/subsys/bluetooth/controller/ll_sw/ull_llcp_phy.c index a9b48be2702f..9e8ebaf7a401 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_llcp_phy.c +++ b/subsys/bluetooth/controller/ll_sw/ull_llcp_phy.c @@ -379,7 +379,7 @@ static void lp_pu_tx(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, vo struct node_tx *tx; struct pdu_data *pdu; - LL_ASSERT(ctx->node_ref.tx); + LL_ASSERT_DBG(ctx->node_ref.tx); #if defined(CONFIG_BT_CTLR_DATA_LENGTH) if (!((ctx->tx_opcode == PDU_DATA_LLCTRL_TYPE_PHY_REQ) && @@ -390,7 +390,7 @@ static void lp_pu_tx(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, vo return; } ctx->data.pu.ntf_dle_node = llcp_ntf_alloc(); - LL_ASSERT(ctx->data.pu.ntf_dle_node); + LL_ASSERT_DBG(ctx->data.pu.ntf_dle_node); } #endif /* CONFIG_BT_CTLR_DATA_LENGTH */ @@ -417,7 +417,7 @@ static void lp_pu_tx(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, vo break; #endif /* CONFIG_BT_CENTRAL */ default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); } /* Enqueue LL Control PDU towards LLL */ @@ -435,10 +435,10 @@ static void pu_ntf(struct ll_conn *conn, struct proc_ctx *ctx) /* Piggy-back on stored RX node */ ntf = ctx->node_ref.rx; ctx->node_ref.rx = NULL; - LL_ASSERT(ntf); + LL_ASSERT_DBG(ntf); if (ctx->data.pu.ntf_pu) { - LL_ASSERT(ntf->hdr.type == NODE_RX_TYPE_RETAIN); + LL_ASSERT_DBG(ntf->hdr.type == NODE_RX_TYPE_RETAIN); ntf->hdr.type = NODE_RX_TYPE_PHY_UPDATE; ntf->hdr.handle = conn->lll.handle; pdu = (struct node_rx_pu *)ntf->pdu; @@ -476,7 +476,7 @@ static void pu_dle_ntf(struct ll_conn *conn, struct proc_ctx *ctx) /* Signal to release pre-allocated node in case there is no DLE ntf */ ntf->hdr.type = NODE_RX_TYPE_RELEASE; } else { - LL_ASSERT(ntf); + LL_ASSERT_DBG(ntf); ntf->hdr.type = NODE_RX_TYPE_DC_PDU; ntf->hdr.handle = conn->lll.handle; @@ -646,7 +646,7 @@ static void lp_pu_st_wait_tx_ack_phy_req(struct ll_conn *conn, struct proc_ctx * #endif /* CONFIG_BT_PERIPHERAL */ default: /* Unknown role */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } break; @@ -675,7 +675,7 @@ static void lp_pu_st_wait_tx_ack_phy_update_ind(struct ll_conn *conn, struct pro { switch (evt) { case LP_PU_EVT_ACK: - LL_ASSERT(conn->lll.role == BT_HCI_ROLE_CENTRAL); + LL_ASSERT_DBG(conn->lll.role == BT_HCI_ROLE_CENTRAL); if (ctx->data.pu.p_to_c_phy || ctx->data.pu.c_to_p_phy) { /* Either phys should change */ if (ctx->data.pu.c_to_p_phy) { @@ -711,7 +711,7 @@ static void lp_pu_st_wait_rx_phy_update_ind(struct ll_conn *conn, struct proc_ct { switch (evt) { case LP_PU_EVT_PHY_UPDATE_IND: - LL_ASSERT(conn->lll.role == BT_HCI_ROLE_PERIPHERAL); + LL_ASSERT_DBG(conn->lll.role == BT_HCI_ROLE_PERIPHERAL); llcp_rr_set_incompat(conn, INCOMPAT_RESERVED); llcp_pdu_decode_phy_update_ind(ctx, (struct pdu_data *)param); const uint8_t end_procedure = pu_check_update_ind(conn, ctx); @@ -867,7 +867,7 @@ static void lp_pu_execute_fsm(struct ll_conn *conn, struct proc_ctx *ctx, uint8_ #endif /* CONFIG_BT_CTLR_DATA_LENGTH */ default: /* Unknown state */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } @@ -930,7 +930,7 @@ static void rp_pu_tx(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, vo struct node_tx *tx; struct pdu_data *pdu; - LL_ASSERT(ctx->node_ref.tx); + LL_ASSERT_DBG(ctx->node_ref.tx); #if defined(CONFIG_BT_CTLR_DATA_LENGTH) if (!llcp_ntf_alloc_is_available()) { @@ -940,7 +940,7 @@ static void rp_pu_tx(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, vo } ctx->data.pu.ntf_dle_node = llcp_ntf_alloc(); - LL_ASSERT(ctx->data.pu.ntf_dle_node); + LL_ASSERT_DBG(ctx->data.pu.ntf_dle_node); #endif /* CONFIG_BT_CTLR_DATA_LENGTH */ tx = ctx->node_ref.tx; @@ -967,7 +967,7 @@ static void rp_pu_tx(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, vo break; #endif /* CONFIG_BT_CENTRAL */ default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); } /* Enqueue LL Control PDU towards LLL */ @@ -1073,7 +1073,7 @@ static void rp_pu_st_wait_rx_phy_req(struct ll_conn *conn, struct proc_ctx *ctx, #endif /* CONFIG_BT_PERIPHERAL */ default: /* Unknown role */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } break; default: @@ -1105,7 +1105,7 @@ static void rp_pu_st_wait_tx_ack_phy(struct ll_conn *conn, struct proc_ctx *ctx, if (0) { #if defined(CONFIG_BT_PERIPHERAL) } else if (ctx->state == RP_PU_STATE_WAIT_TX_ACK_PHY_RSP) { - LL_ASSERT(conn->lll.role == BT_HCI_ROLE_PERIPHERAL); + LL_ASSERT_DBG(conn->lll.role == BT_HCI_ROLE_PERIPHERAL); /* When we act as peripheral apply timing restriction */ pu_set_timing_restrict( conn, pu_select_phy_timing_restrict(conn, ctx->data.pu.tx)); @@ -1114,7 +1114,7 @@ static void rp_pu_st_wait_tx_ack_phy(struct ll_conn *conn, struct proc_ctx *ctx, #endif /* CONFIG_BT_PERIPHERAL */ #if defined(CONFIG_BT_CENTRAL) } else if (ctx->state == RP_PU_STATE_WAIT_TX_ACK_PHY_UPDATE_IND) { - LL_ASSERT(conn->lll.role == BT_HCI_ROLE_CENTRAL); + LL_ASSERT_DBG(conn->lll.role == BT_HCI_ROLE_CENTRAL); if (ctx->data.pu.c_to_p_phy || ctx->data.pu.p_to_c_phy) { /* UPDATE_IND acked, so lets await instant */ if (ctx->data.pu.c_to_p_phy) { @@ -1289,7 +1289,7 @@ static void rp_pu_execute_fsm(struct ll_conn *conn, struct proc_ctx *ctx, uint8_ #endif /* CONFIG_BT_CTLR_DATA_LENGTH */ default: /* Unknown state */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } diff --git a/subsys/bluetooth/controller/ll_sw/ull_llcp_remote.c b/subsys/bluetooth/controller/ll_sw/ull_llcp_remote.c index 185cad7911d1..3a90a9d950ba 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_llcp_remote.c +++ b/subsys/bluetooth/controller/ll_sw/ull_llcp_remote.c @@ -104,7 +104,7 @@ static bool proc_with_instant(struct proc_ctx *ctx) return 1U; default: /* Unknown procedure */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } @@ -117,12 +117,12 @@ void llcp_rr_check_done(struct ll_conn *conn, struct proc_ctx *ctx) struct proc_ctx *ctx_header; ctx_header = llcp_rr_peek(conn); - LL_ASSERT(ctx_header == ctx); + LL_ASSERT_DBG(ctx_header == ctx); /* If we have a node rx it must not be marked RETAIN as * the memory referenced would leak */ - LL_ASSERT(ctx->node_ref.rx == NULL || + LL_ASSERT_DBG(ctx->node_ref.rx == NULL || ctx->node_ref.rx->hdr.type != NODE_RX_TYPE_RETAIN); rr_dequeue(conn); @@ -319,7 +319,7 @@ void llcp_rr_rx(struct ll_conn *conn, struct proc_ctx *ctx, memq_link_t *link, #endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER */ default: /* Unknown procedure */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } @@ -459,7 +459,7 @@ static void rr_act_run(struct ll_conn *conn) #endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER */ default: /* Unknown procedure */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } @@ -475,7 +475,7 @@ static void rr_tx(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t opcode) /* Allocate tx node */ tx = llcp_tx_alloc(conn, ctx); - LL_ASSERT(tx); + LL_ASSERT_DBG(tx); pdu = (struct pdu_data *)tx->pdu; @@ -502,7 +502,7 @@ static void rr_tx(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t opcode) llcp_pdu_encode_unknown_rsp(ctx, pdu); break; default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); } ctx->tx_opcode = pdu->llctrl.opcode; @@ -515,7 +515,7 @@ static void rr_act_reject(struct ll_conn *conn) { struct proc_ctx *ctx = llcp_rr_peek(conn); - LL_ASSERT(ctx != NULL); + LL_ASSERT_DBG(ctx != NULL); if (llcp_rr_ispaused(conn) || !llcp_tx_alloc_peek(conn, ctx)) { rr_set_state(conn, RR_STATE_REJECT); @@ -531,7 +531,7 @@ static void rr_act_unsupported(struct ll_conn *conn) { struct proc_ctx *ctx = llcp_rr_peek(conn); - LL_ASSERT(ctx != NULL); + LL_ASSERT_DBG(ctx != NULL); if (llcp_rr_ispaused(conn) || !llcp_tx_alloc_peek(conn, ctx)) { rr_set_state(conn, RR_STATE_UNSUPPORTED); @@ -550,7 +550,7 @@ static void rr_act_complete(struct ll_conn *conn) rr_set_collision(conn, 0U); ctx = llcp_rr_peek(conn); - LL_ASSERT(ctx != NULL); + LL_ASSERT_DBG(ctx != NULL); /* Stop procedure response timeout timer */ llcp_rr_prt_stop(conn); @@ -777,7 +777,7 @@ static void rr_execute_fsm(struct ll_conn *conn, uint8_t evt, void *param) break; default: /* Unknown state */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } diff --git a/subsys/bluetooth/controller/ll_sw/ull_peripheral.c b/subsys/bluetooth/controller/ll_sw/ull_peripheral.c index 8032b18e9950..aa6db211ed19 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_peripheral.c +++ b/subsys/bluetooth/controller/ll_sw/ull_peripheral.c @@ -250,7 +250,7 @@ void ull_periph_setup(struct node_rx_pdu *rx, struct node_rx_ftr *ftr, * complete event. */ node = pdu_adv; - LL_ASSERT(IS_PTR_ALIGNED(node, struct node_rx_cc)); + LL_ASSERT_DBG(IS_PTR_ALIGNED(node, struct node_rx_cc)); /* Populate the fields required for connection complete event */ cc = node; @@ -334,7 +334,7 @@ void ull_periph_setup(struct node_rx_pdu *rx, struct node_rx_ftr *ftr, link = rx->hdr.link; handle = ull_adv_handle_get(adv); - LL_ASSERT(handle < BT_CTLR_ADV_SET); + LL_ASSERT_DBG(handle < BT_CTLR_ADV_SET); rx->hdr.type = NODE_RX_TYPE_EXT_ADV_TERMINATE; rx->hdr.handle = handle; @@ -494,8 +494,8 @@ void ull_periph_setup(struct node_rx_pdu *rx, struct node_rx_ftr *ftr, ticks_slot_overhead), ull_periph_ticker_cb, conn, ticker_op_cb, (void *)__LINE__); - LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) || - (ticker_status == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ticker_status == TICKER_STATUS_SUCCESS) || + (ticker_status == TICKER_STATUS_BUSY)); #if (CONFIG_BT_CTLR_ULL_HIGH_PRIO == CONFIG_BT_CTLR_ULL_LOW_PRIO) /* enable ticker job, irrespective of disabled in this function so @@ -520,8 +520,8 @@ void ull_periph_latency_cancel(struct ll_conn *conn, uint16_t handle) 0, 0, 0, 0, 1, 0, ticker_update_latency_cancel_op_cb, (void *)conn); - LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) || - (ticker_status == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ticker_status == TICKER_STATUS_SUCCESS) || + (ticker_status == TICKER_STATUS_BUSY)); } } @@ -578,7 +578,7 @@ void ull_periph_ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, /* Increment prepare reference count */ ref = ull_ref_inc(&conn->ull); - LL_ASSERT(ref); + LL_ASSERT_DBG(ref); /* Increment event counter */ conn->event_counter += (lazy + 1U); @@ -594,7 +594,7 @@ void ull_periph_ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, /* Kick LLL prepare */ err = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0, &mfy); - LL_ASSERT(!err); + LL_ASSERT_ERR(!err); /* De-mux remaining tx nodes from FIFO */ ull_conn_tx_demux(UINT8_MAX); @@ -664,15 +664,15 @@ static void invalid_release(struct ull_hdr *hdr, struct lll_conn *lll, static void ticker_op_stop_adv_cb(uint32_t status, void *param) { - LL_ASSERT(status != TICKER_STATUS_FAILURE || - param == ull_disable_mark_get()); + LL_ASSERT_ERR((status != TICKER_STATUS_FAILURE) || + (param == ull_disable_mark_get())); } static void ticker_op_cb(uint32_t status, void *param) { ARG_UNUSED(param); - LL_ASSERT(status == TICKER_STATUS_SUCCESS); + LL_ASSERT_ERR(status == TICKER_STATUS_SUCCESS); } static void ticker_update_latency_cancel_op_cb(uint32_t ticker_status, @@ -680,7 +680,7 @@ static void ticker_update_latency_cancel_op_cb(uint32_t ticker_status, { struct ll_conn *conn = param; - LL_ASSERT(ticker_status == TICKER_STATUS_SUCCESS); + LL_ASSERT_ERR(ticker_status == TICKER_STATUS_SUCCESS); conn->periph.latency_cancel = 0U; } diff --git a/subsys/bluetooth/controller/ll_sw/ull_peripheral_iso.c b/subsys/bluetooth/controller/ll_sw/ull_peripheral_iso.c index dd360c9f9eb8..21ff94e90bb6 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_peripheral_iso.c +++ b/subsys/bluetooth/controller/ll_sw/ull_peripheral_iso.c @@ -158,7 +158,7 @@ void ull_peripheral_iso_release(uint16_t cis_handle) struct ll_conn_iso_group *cig; cis = ll_conn_iso_stream_get(cis_handle); - LL_ASSERT(cis); + LL_ASSERT_DBG(cis); cig = cis->group; @@ -318,7 +318,7 @@ uint8_t ull_peripheral_iso_setup(struct pdu_data_llctrl_cis_ind *ind, } conn = ll_conn_get(cis->lll.acl_handle); - LL_ASSERT(conn != NULL); + LL_ASSERT_DBG(conn != NULL); cis_offset = sys_get_le24(ind->cis_offset); @@ -366,7 +366,7 @@ static void ticker_op_cb(uint32_t status, void *param) { ARG_UNUSED(param); - LL_ASSERT(status == TICKER_STATUS_SUCCESS); + LL_ASSERT_ERR(status == TICKER_STATUS_SUCCESS); } void ull_peripheral_iso_update_ticker(struct ll_conn_iso_group *cig, @@ -378,8 +378,8 @@ void ull_peripheral_iso_update_ticker(struct ll_conn_iso_group *cig, uint8_t ticker_id_cig = TICKER_ID_CONN_ISO_BASE + ll_conn_iso_group_handle_get(cig); uint32_t ticker_status = ticker_stop(TICKER_INSTANCE_ID_CTLR, TICKER_USER_ID_ULL_HIGH, ticker_id_cig, ticker_op_cb, NULL); - LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) || - (ticker_status == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ticker_status == TICKER_STATUS_SUCCESS) || + (ticker_status == TICKER_STATUS_BUSY)); ticker_status = ticker_start(TICKER_INSTANCE_ID_CTLR, TICKER_USER_ID_ULL_HIGH, @@ -393,8 +393,8 @@ void ull_peripheral_iso_update_ticker(struct ll_conn_iso_group *cig, ull_conn_iso_ticker_cb, cig, ticker_op_cb, NULL); - LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) || - (ticker_status == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ticker_status == TICKER_STATUS_SUCCESS) || + (ticker_status == TICKER_STATUS_BUSY)); } @@ -412,8 +412,9 @@ void ull_peripheral_iso_update_peer_sca(struct ll_conn *acl) if (!cig || !cig->lll.num_cis) { continue; } + cis = ll_conn_iso_stream_get_by_group(cig, NULL); - LL_ASSERT(cis); + LL_ASSERT_DBG(cis); uint16_t cis_handle = cis->lll.handle; diff --git a/subsys/bluetooth/controller/ll_sw/ull_scan.c b/subsys/bluetooth/controller/ll_sw/ull_scan.c index 493c2330db0b..514072643e16 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_scan.c +++ b/subsys/bluetooth/controller/ll_sw/ull_scan.c @@ -696,7 +696,7 @@ uint8_t ull_scan_disable(uint8_t handle, struct ll_scan_set *scan) * sync role. */ parent = aux->parent; - LL_ASSERT(!parent || (parent != aux_scan_lll)); + LL_ASSERT_DBG(!parent || (parent != aux_scan_lll)); } } #endif /* !CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS */ @@ -727,7 +727,7 @@ void ull_scan_done(struct node_rx_event_done *done) lll->duration_reload = 0U; handle = ull_scan_handle_get(scan); - LL_ASSERT(handle < BT_CTLR_SCAN_SET); + LL_ASSERT_DBG(handle < BT_CTLR_SCAN_SET); #if defined(CONFIG_BT_CTLR_PHY_CODED) /* Prevent duplicate terminate event if ull_scan_done get called by @@ -751,8 +751,8 @@ void ull_scan_done(struct node_rx_event_done *done) (TICKER_ID_SCAN_BASE + handle), ticker_stop_ext_op_cb, scan); - LL_ASSERT((ret == TICKER_STATUS_SUCCESS) || - (ret == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ret == TICKER_STATUS_SUCCESS) || + (ret == TICKER_STATUS_BUSY)); } void ull_scan_term_dequeue(uint8_t handle) @@ -760,7 +760,7 @@ void ull_scan_term_dequeue(uint8_t handle) struct ll_scan_set *scan; scan = ull_scan_set_get(handle); - LL_ASSERT(scan); + LL_ASSERT_DBG(scan); scan->is_enabled = 0U; @@ -773,7 +773,7 @@ void ull_scan_term_dequeue(uint8_t handle) uint8_t err; err = disable(SCAN_HANDLE_PHY_CODED); - LL_ASSERT(!err); + LL_ASSERT_ERR(!err); } } else { struct ll_scan_set *scan_1m; @@ -783,7 +783,7 @@ void ull_scan_term_dequeue(uint8_t handle) uint8_t err; err = disable(SCAN_HANDLE_1M); - LL_ASSERT(!err); + LL_ASSERT_ERR(!err); } } #endif /* CONFIG_BT_CTLR_PHY_CODED */ @@ -924,7 +924,7 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, /* Increment prepare reference count */ ref = ull_ref_inc(&scan->ull); - LL_ASSERT(ref); + LL_ASSERT_DBG(ref); /* Append timing parameters */ p.ticks_at_expire = ticks_at_expire; @@ -937,7 +937,7 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, /* Kick LLL prepare */ ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); #if defined(CONFIG_BT_CTLR_ADV_EXT) if (lll->duration_expire) { @@ -955,7 +955,7 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, scan->duration_lazy - elapsed; handle = ull_scan_handle_get(scan); - LL_ASSERT(handle < BT_CTLR_SCAN_SET); + LL_ASSERT_DBG(handle < BT_CTLR_SCAN_SET); ret = ticker_update(TICKER_INSTANCE_ID_CTLR, TICKER_USER_ID_ULL_HIGH, @@ -963,8 +963,8 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, handle), 0, 0, 0, 0, duration_lazy, 0, NULL, NULL); - LL_ASSERT((ret == TICKER_STATUS_SUCCESS) || - (ret == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ret == TICKER_STATUS_SUCCESS) || + (ret == TICKER_STATUS_BUSY)); } lll->duration_expire = 0U; @@ -973,15 +973,15 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, uint8_t handle; handle = ull_scan_handle_get(scan); - LL_ASSERT(handle < BT_CTLR_SCAN_SET); + LL_ASSERT_DBG(handle < BT_CTLR_SCAN_SET); lll->duration_expire = lll->duration_reload; ret = ticker_update(TICKER_INSTANCE_ID_CTLR, TICKER_USER_ID_ULL_HIGH, (TICKER_ID_SCAN_BASE + handle), 0, 0, 0, 0, 1, 1, NULL, NULL); - LL_ASSERT((ret == TICKER_STATUS_SUCCESS) || - (ret == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ret == TICKER_STATUS_SUCCESS) || + (ret == TICKER_STATUS_BUSY)); } #endif /* CONFIG_BT_CTLR_ADV_EXT */ @@ -1105,7 +1105,7 @@ static void ticker_stop_ext_op_cb(uint32_t status, void *param) mfy.param = param; ret = mayfly_enqueue(TICKER_USER_ID_ULL_LOW, TICKER_USER_ID_ULL_HIGH, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } static void ext_disable(void *param) @@ -1126,14 +1126,14 @@ static void ext_disable(void *param) /* Setup disabled callback to be called when ref count * returns to zero. */ - LL_ASSERT(!hdr->disabled_cb); + LL_ASSERT_ERR(!hdr->disabled_cb); hdr->disabled_param = mfy.param; hdr->disabled_cb = ext_disabled_cb; /* Trigger LLL disable */ ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } else { /* No pending LLL events */ ext_disabled_cb(&scan->lll); diff --git a/subsys/bluetooth/controller/ll_sw/ull_scan_aux.c b/subsys/bluetooth/controller/ll_sw/ull_scan_aux.c index 953575885bc5..012168b768d9 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_scan_aux.c +++ b/subsys/bluetooth/controller/ll_sw/ull_scan_aux.c @@ -215,7 +215,7 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) rx_incomplete = NULL; lll = ftr->param; - LL_ASSERT(!lll->lll_aux); + LL_ASSERT_DBG(!lll->lll_aux); scan = HDR_LLL2ULL(lll); sync = sync_create_get(scan); @@ -234,7 +234,7 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) rx_incomplete = NULL; lll = ftr->param; - LL_ASSERT(!lll->lll_aux); + LL_ASSERT_DBG(!lll->lll_aux); scan = HDR_LLL2ULL(lll); sync = sync_create_get(scan); @@ -259,7 +259,7 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) /* aux parent will be NULL for periodic sync */ lll = aux->parent; - LL_ASSERT(lll); + LL_ASSERT_DBG(lll); ticker_yield_handle = TICKER_ID_SCAN_AUX_BASE + aux_handle_get(aux); @@ -280,10 +280,10 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) * is being received before we process the node here. */ lll_aux = ftr->lll_aux; - LL_ASSERT(lll_aux); + LL_ASSERT_DBG(lll_aux); aux = HDR_LLL2ULL(lll_aux); - LL_ASSERT(lll == aux->parent); + LL_ASSERT_DBG(lll == aux->parent); ticker_yield_handle = TICKER_NULL; @@ -301,10 +301,10 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) * is being received before we process the node here. */ lll_aux = ftr->lll_aux; - LL_ASSERT(lll_aux); + LL_ASSERT_DBG(lll_aux); aux = HDR_LLL2ULL(lll_aux); - LL_ASSERT(sync_lll == aux->parent); + LL_ASSERT_DBG(sync_lll == aux->parent); ticker_yield_handle = TICKER_NULL; } @@ -340,7 +340,8 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) break; #endif /* CONFIG_BT_CTLR_PHY_CODED */ default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); + return; } @@ -375,7 +376,7 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) * passed in the node rx footer field. */ sync_lll = ftr->param; - LL_ASSERT(!sync_lll->lll_aux); + LL_ASSERT_DBG(!sync_lll->lll_aux); ull_sync = HDR_LLL2ULL(sync_lll); rx->hdr.handle = ull_sync_handle_get(ull_sync); @@ -406,7 +407,8 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) } break; default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); + return; } @@ -601,7 +603,7 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) } if (is_scan_req) { - LL_ASSERT(aux && aux->rx_last); + LL_ASSERT_DBG(aux && aux->rx_last); aux->rx_last->rx_ftr.extra = rx; aux->rx_last = rx; @@ -818,7 +820,7 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) * scheduling, or receiving a chain then it will * reuse the aux context. */ - LL_ASSERT(!lll->lll_aux || (lll->lll_aux == lll_aux)); + LL_ASSERT_DBG(!lll->lll_aux || (lll->lll_aux == lll_aux)); /* Associate Scan context with the Aux context so that * it can continue reception in LLL scheduling. @@ -841,7 +843,7 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) /* Switching to ULL scheduling to receive auxiliary PDUs */ if (!IS_ENABLED(CONFIG_BT_CTLR_SYNC_PERIODIC) || lll) { - LL_ASSERT(scan); + LL_ASSERT_DBG(scan); /* Do not ULL schedule if scan disable requested */ if (unlikely(scan->is_stop)) { @@ -857,8 +859,8 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) } else { struct ll_sync_set *sync_set; - LL_ASSERT(sync_lll && - (!sync_lll->lll_aux || sync_lll->lll_aux == lll_aux)); + LL_ASSERT_ERR(sync_lll && + (!sync_lll->lll_aux || sync_lll->lll_aux == lll_aux)); /* Do not ULL schedule if sync terminate requested */ sync_set = HDR_LLL2ULL(sync_lll); @@ -917,8 +919,8 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) ticks_aux_offset - ticks_slot_offset), NULL, NULL); - LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) || - (ticker_status == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ticker_status == TICKER_STATUS_SUCCESS) || + (ticker_status == TICKER_STATUS_BUSY)); } aux_handle = aux_handle_get(aux); @@ -933,10 +935,10 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) (aux->ull.ticks_slot + ticks_slot_overhead), ticker_cb, aux, ticker_op_cb, aux); - LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) || - (ticker_status == TICKER_STATUS_BUSY) || - ((ticker_status == TICKER_STATUS_FAILURE) && - IS_ENABLED(CONFIG_BT_TICKER_LOW_LAT))); + LL_ASSERT_ERR((ticker_status == TICKER_STATUS_SUCCESS) || + (ticker_status == TICKER_STATUS_BUSY) || + ((ticker_status == TICKER_STATUS_FAILURE) && + IS_ENABLED(CONFIG_BT_TICKER_LOW_LAT))); #if (CONFIG_BT_CTLR_ULL_HIGH_PRIO == CONFIG_BT_CTLR_ULL_LOW_PRIO) /* enable ticker job, queued ticker operation will be handled @@ -960,7 +962,7 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) * immediately since we are in sync context. */ if (!IS_ENABLED(CONFIG_BT_CTLR_SYNC_PERIODIC) || aux->rx_last) { - LL_ASSERT(scan); + LL_ASSERT_DBG(scan); /* If scan is being disabled, rx could already be * enqueued before coming here to ull_scan_aux_rx_flush. @@ -990,7 +992,7 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) } else { const struct ll_sync_set *sync_set; - LL_ASSERT(sync_lll); + LL_ASSERT_DBG(sync_lll); ll_rx_put_sched(link, rx); @@ -1000,7 +1002,7 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) } } - LL_ASSERT(aux->parent); + LL_ASSERT_DBG(aux->parent); flush_safe(aux); @@ -1028,7 +1030,7 @@ void ull_scan_aux_done(struct node_rx_event_done *done) struct ll_sync_set *sync; sync = CONTAINER_OF(done->param, struct ll_sync_set, ull); - LL_ASSERT(ull_sync_is_valid_get(sync)); + LL_ASSERT_DBG(ull_sync_is_valid_get(sync)); /* Auxiliary context will be flushed by ull_scan_aux_stop() */ if (unlikely(sync->is_stop) || !sync->lll.lll_aux) { @@ -1036,16 +1038,16 @@ void ull_scan_aux_done(struct node_rx_event_done *done) } aux = HDR_LLL2ULL(sync->lll.lll_aux); - LL_ASSERT(aux->parent); + LL_ASSERT_DBG(aux->parent); } else { struct ll_scan_set *scan; struct lll_scan *lll; lll = aux->parent; - LL_ASSERT(lll); + LL_ASSERT_DBG(lll); scan = HDR_LLL2ULL(lll); - LL_ASSERT(ull_scan_is_valid_get(scan)); + LL_ASSERT_DBG(ull_scan_is_valid_get(scan)); /* Auxiliary context will be flushed by ull_scan_aux_stop() */ if (unlikely(scan->is_stop)) { @@ -1086,7 +1088,7 @@ void *ull_scan_aux_lll_parent_get(struct lll_scan_aux *lll, struct lll_scan *lllscan; lllscan = aux->parent; - LL_ASSERT(lllscan); + LL_ASSERT_DBG(lllscan); scan = HDR_LLL2ULL(lllscan); *is_lll_scan = !!ull_scan_is_valid_get(scan); @@ -1196,7 +1198,8 @@ void ull_scan_aux_release(memq_link_t *link, struct node_rx_pdu *rx) rx->rx_ftr.extra = NULL; } else { - LL_ASSERT(0); + LL_ASSERT_DBG(0); + lll_aux = NULL; } @@ -1208,7 +1211,7 @@ void ull_scan_aux_release(memq_link_t *link, struct node_rx_pdu *rx) aux = HDR_LLL2ULL(lll_aux); lll = aux->parent; - LL_ASSERT(lll); + LL_ASSERT_DBG(lll); scan = HDR_LLL2ULL(lll); scan = ull_scan_is_valid_get(scan); @@ -1222,12 +1225,13 @@ void ull_scan_aux_release(memq_link_t *link, struct node_rx_pdu *rx) sync = HDR_LLL2ULL(sync_lll); is_stop = sync->is_stop; } else { - LL_ASSERT(0); + LL_ASSERT_DBG(0); + return; } if (!is_stop) { - LL_ASSERT(aux->parent); + LL_ASSERT_DBG(aux->parent); flush_safe(aux); @@ -1287,7 +1291,7 @@ int ull_scan_aux_stop(struct ll_scan_aux_set *aux) struct lll_scan *lll; lll = aux->parent; - LL_ASSERT(lll); + LL_ASSERT_DBG(lll); scan = HDR_LLL2ULL(lll); scan = ull_scan_is_valid_get(scan); @@ -1308,7 +1312,7 @@ int ull_scan_aux_stop(struct ll_scan_aux_set *aux) mfy.param = aux; ret = mayfly_enqueue(TICKER_USER_ID_THREAD, TICKER_USER_ID_ULL_HIGH, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); return 0; } @@ -1333,7 +1337,7 @@ static inline void aux_release(struct ll_scan_aux_set *aux) /* Clear the parent so that when scan is being disabled then this * auxiliary context shall not associate itself from being disable. */ - LL_ASSERT(aux->parent); + LL_ASSERT_DBG(aux->parent); aux->parent = NULL; mem_release(aux, &scan_aux_free); @@ -1350,7 +1354,7 @@ static void done_disabled_cb(void *param) struct ll_scan_aux_set *aux; aux = param; - LL_ASSERT(aux->parent); + LL_ASSERT_DBG(aux->parent); flush(aux); } @@ -1362,7 +1366,7 @@ static void flush_safe(void *param) uint8_t ref; aux = param; - LL_ASSERT(aux->parent); + LL_ASSERT_DBG(aux->parent); /* ref == 0 * All PDUs were scheduled from LLL and there is no pending done @@ -1382,9 +1386,9 @@ static void flush_safe(void *param) * cannot overlap, i.e. ULL reference count * shall be less than 2. */ - LL_ASSERT(ref < 2U); + LL_ASSERT_DBG(ref < 2U); - LL_ASSERT(!hdr->disabled_cb); + LL_ASSERT_ERR(!hdr->disabled_cb); hdr->disabled_param = aux; hdr->disabled_cb = done_disabled_cb; @@ -1406,7 +1410,7 @@ static void flush(void *param) * auxiliary channel PDUs. */ aux = param; - LL_ASSERT(aux->parent); + LL_ASSERT_DBG(aux->parent); rx = aux->rx_head; if (rx) { @@ -1456,7 +1460,7 @@ static void aux_sync_partial(void *param) rx = aux->rx_head; aux->rx_head = NULL; - LL_ASSERT(rx); + LL_ASSERT_DBG(rx); rx->rx_ftr.aux_sched = 1U; ll_rx_put_sched(rx->hdr.link, rx); @@ -1468,7 +1472,7 @@ static void aux_sync_incomplete(void *param) struct ll_scan_aux_set *aux; aux = param; - LL_ASSERT(aux->parent); + LL_ASSERT_DBG(aux->parent); /* ULL scheduling succeeded hence no backup node rx present, use the * extra node rx reserved for incomplete data status generation. @@ -1480,7 +1484,7 @@ static void aux_sync_incomplete(void *param) /* get reference to sync context */ lll = aux->parent; - LL_ASSERT(lll); + LL_ASSERT_DBG(lll); sync = HDR_LLL2ULL(lll); /* reset data len total */ @@ -1488,7 +1492,7 @@ static void aux_sync_incomplete(void *param) /* pick extra node rx stored in aux context */ rx = aux->rx_incomplete; - LL_ASSERT(rx); + LL_ASSERT_DBG(rx); aux->rx_incomplete = NULL; /* prepare sync report with failure */ @@ -1508,7 +1512,7 @@ static void aux_sync_incomplete(void *param) aux->rx_head = rx; } - LL_ASSERT(!ull_ref_get(&aux->ull)); + LL_ASSERT_DBG(!ull_ref_get(&aux->ull)); flush(aux); #endif /* CONFIG_BT_CTLR_SYNC_PERIODIC */ @@ -1529,7 +1533,7 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, /* Increment prepare reference count */ ref = ull_ref_inc(&aux->ull); - LL_ASSERT(ref); + LL_ASSERT_DBG(ref); /* Append timing parameters */ p.ticks_at_expire = ticks_at_expire; @@ -1542,7 +1546,7 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, /* Kick LLL prepare */ ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); DEBUG_RADIO_PREPARE_O(1); } @@ -1560,7 +1564,7 @@ static void ticker_op_cb(uint32_t status, void *param) aux = param; sync_lll = aux->parent; - LL_ASSERT(sync_lll); + LL_ASSERT_DBG(sync_lll); sync = HDR_LLL2ULL(sync_lll); sync = ull_sync_is_valid_get(sync); @@ -1581,7 +1585,7 @@ static void ticker_op_cb(uint32_t status, void *param) struct ll_scan_aux_set *aux; aux = param; - LL_ASSERT(aux->parent); + LL_ASSERT_DBG(aux->parent); mfy.fp = flush_safe; } @@ -1591,7 +1595,7 @@ static void ticker_op_cb(uint32_t status, void *param) ret = mayfly_enqueue(TICKER_USER_ID_ULL_LOW, TICKER_USER_ID_ULL_HIGH, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } #else /* CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS */ @@ -1648,7 +1652,7 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) rx_incomplete = NULL; lll = ftr->param; - LL_ASSERT(!lll->lll_aux); + LL_ASSERT_DBG(!lll->lll_aux); scan = HDR_LLL2ULL(lll); sync = sync_create_get(scan); @@ -1664,7 +1668,7 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) rx_incomplete = NULL; lll = ftr->param; - LL_ASSERT(!lll->lll_aux); + LL_ASSERT_DBG(!lll->lll_aux); scan = HDR_LLL2ULL(lll); sync = sync_create_get(scan); @@ -1686,7 +1690,7 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) /* chain parent will be NULL for periodic sync */ lll = chain->parent; - LL_ASSERT(lll); + LL_ASSERT_DBG(lll); } else if (!IS_ENABLED(CONFIG_BT_CTLR_SYNC_PERIODIC) || ull_scan_is_valid_get(HDR_LLL2ULL(ftr->param))) { @@ -1700,10 +1704,10 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) lll = ftr->param; lll_aux = lll->lll_aux; - LL_ASSERT(lll_aux); + LL_ASSERT_DBG(lll_aux); chain = CONTAINER_OF(lll_aux, struct ll_scan_aux_chain, lll); - LL_ASSERT(lll == chain->parent); + LL_ASSERT_DBG(lll == chain->parent); } else { lll = NULL; @@ -1713,10 +1717,10 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) sync_lll = ftr->param; lll_aux = sync_lll->lll_aux; - LL_ASSERT(lll_aux); + LL_ASSERT_DBG(lll_aux); chain = CONTAINER_OF(lll_aux, struct ll_scan_aux_chain, lll); - LL_ASSERT(sync_lll == chain->parent); + LL_ASSERT_DBG(sync_lll == chain->parent); } if (!IS_ENABLED(CONFIG_BT_CTLR_SYNC_PERIODIC) || lll) { @@ -1750,7 +1754,8 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) break; #endif /* CONFIG_BT_CTLR_PHY_CODED */ default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); + return; } @@ -1785,7 +1790,7 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) * passed in the node rx footer field. */ sync_lll = ftr->param; - LL_ASSERT(!sync_lll->lll_aux); + LL_ASSERT_DBG(!sync_lll->lll_aux); ull_sync = HDR_LLL2ULL(sync_lll); rx->hdr.handle = ull_sync_handle_get(ull_sync); @@ -1813,7 +1818,8 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) } break; default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); + return; } @@ -2009,7 +2015,7 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) PDU_ADV_AUX_PTR_PHY_GET(aux_ptr) == EXT_ADV_AUX_PHY_LE_CODED) || (aux_ptr->chan_idx >= CHM_USED_COUNT_MAX)) { if (is_scan_req) { - LL_ASSERT(chain && chain->rx_last); + LL_ASSERT_DBG(chain && chain->rx_last); chain->rx_last->rx_ftr.extra = rx; chain->rx_last = rx; @@ -2207,7 +2213,7 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) /* Switching to ULL scheduling to receive auxiliary PDUs */ if (!IS_ENABLED(CONFIG_BT_CTLR_SYNC_PERIODIC) || lll) { - LL_ASSERT(scan); + LL_ASSERT_DBG(scan); /* Do not ULL schedule if scan disable requested */ if (unlikely(scan->is_stop)) { @@ -2223,8 +2229,8 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) } else { struct ll_sync_set *sync_set; - LL_ASSERT(sync_lll && - (!sync_lll->lll_aux || sync_lll->lll_aux == lll_aux)); + LL_ASSERT_ERR(sync_lll && + (!sync_lll->lll_aux || sync_lll->lll_aux == lll_aux)); /* Do not ULL schedule if sync terminate requested */ sync_set = HDR_LLL2ULL(sync_lll); @@ -2278,7 +2284,7 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) * immediately since we are in sync context. */ if (!IS_ENABLED(CONFIG_BT_CTLR_SYNC_PERIODIC) || chain->rx_last) { - LL_ASSERT(scan); + LL_ASSERT_DBG(scan); /* rx could already be enqueued before coming here - * check if rx not the last in the list of received PDUs @@ -2291,12 +2297,12 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) chain->rx_last = rx; } } else { - LL_ASSERT(sync_lll); + LL_ASSERT_DBG(sync_lll); ll_rx_put_sched(link, rx); } - LL_ASSERT(chain->parent); + LL_ASSERT_DBG(chain->parent); flush_safe(chain); @@ -2318,7 +2324,7 @@ void ull_scan_aux_done(struct node_rx_event_done *done) /* Get reference to chain */ chain = CONTAINER_OF(done->extra.lll, struct ll_scan_aux_chain, lll); - LL_ASSERT(scan_aux_chain_is_valid_get(chain)); + LL_ASSERT_DBG(scan_aux_chain_is_valid_get(chain)); /* Remove chain from active list */ chain_remove_from_list(&scan_aux_set.active_chains, chain); @@ -2343,7 +2349,7 @@ void *ull_scan_aux_lll_parent_get(struct lll_scan_aux *lll, struct lll_scan *lllscan; lllscan = chain->parent; - LL_ASSERT(lllscan); + LL_ASSERT_DBG(lllscan); scan = HDR_LLL2ULL(lllscan); *is_lll_scan = !!ull_scan_is_valid_get(scan); @@ -2419,7 +2425,8 @@ void ull_scan_aux_release(memq_link_t *link, struct node_rx_pdu *rx) rx->rx_ftr.extra = NULL; } } else { - LL_ASSERT(0); + LL_ASSERT_DBG(0); + lll_aux = NULL; } @@ -2431,7 +2438,7 @@ void ull_scan_aux_release(memq_link_t *link, struct node_rx_pdu *rx) chain = CONTAINER_OF(lll_aux, struct ll_scan_aux_chain, lll); lll = chain->parent; - LL_ASSERT(lll); + LL_ASSERT_DBG(lll); scan = HDR_LLL2ULL(lll); scan = ull_scan_is_valid_get(scan); @@ -2447,7 +2454,7 @@ void ull_scan_aux_release(memq_link_t *link, struct node_rx_pdu *rx) } if (!is_stop) { - LL_ASSERT(chain->parent); + LL_ASSERT_DBG(chain->parent); /* Remove chain from active list and flush */ chain_remove_from_list(&scan_aux_set.active_chains, chain); @@ -2474,8 +2481,8 @@ static void scan_aux_stop_all_chains_for_parent(void *parent) /* Scheduled head is about to be removed - stop running ticker */ ticker_status = ticker_stop(TICKER_INSTANCE_ID_CTLR, TICKER_USER_ID_ULL_HIGH, TICKER_ID_SCAN_AUX, NULL, NULL); - LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) || - (ticker_status == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ticker_status == TICKER_STATUS_SUCCESS) || + (ticker_status == TICKER_STATUS_BUSY)); ticker_stopped = true; } @@ -2531,7 +2538,7 @@ static void scan_aux_stop_all_chains_for_parent(void *parent) mfy.param = &curr->lll; ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } } else { prev = curr; @@ -2555,7 +2562,7 @@ int ull_scan_aux_stop(void *parent) /* Stop chains in ULL execution context */ mfy.param = parent; ret = mayfly_enqueue(TICKER_USER_ID_THREAD, TICKER_USER_ID_ULL_HIGH, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); /* Wait for chains to be stopped before returning */ (void)k_sem_take(&sem_scan_aux_stop, K_FOREVER); @@ -2587,7 +2594,7 @@ static inline void aux_chain_release(struct ll_scan_aux_chain *chain) /* Clear the parent so that when scan is being disabled then this * auxiliary context shall not associate itself from being disable. */ - LL_ASSERT(chain->parent); + LL_ASSERT_DBG(chain->parent); chain->parent = NULL; mem_release(chain, &scan_aux_free); @@ -2614,7 +2621,7 @@ static void flush_safe(void *param) struct ll_scan_aux_chain *chain; chain = param; - LL_ASSERT(chain->parent); + LL_ASSERT_DBG(chain->parent); if (chain_is_in_list(scan_aux_set.flushing_chains, chain)) { /* Chain already marked for flushing */ @@ -2646,7 +2653,7 @@ static void flush(struct ll_scan_aux_chain *chain) /* Debug check that parent was assigned when allocated for reception of * auxiliary channel PDUs. */ - LL_ASSERT(chain->parent); + LL_ASSERT_DBG(chain->parent); /* Chain is being flushed now - remove from flushing_chains if present */ chain_remove_from_list(&scan_aux_set.flushing_chains, chain); @@ -2702,7 +2709,7 @@ static void flush(struct ll_scan_aux_chain *chain) sync_lll = chain->parent; sync = HDR_LLL2ULL(sync_lll); - LL_ASSERT(sync->is_stop || sync_lll->lll_aux); + LL_ASSERT_DBG(sync->is_stop || sync_lll->lll_aux); sync_lll->lll_aux = NULL; } @@ -2716,16 +2723,16 @@ static void aux_sync_incomplete(struct ll_scan_aux_chain *chain) struct node_rx_pdu *rx; struct lll_sync *lll; - LL_ASSERT(chain->parent); + LL_ASSERT_DBG(chain->parent); /* get reference to sync context */ lll = chain->parent; - LL_ASSERT(lll); + LL_ASSERT_DBG(lll); sync = HDR_LLL2ULL(lll); /* pick extra node rx stored in sync context */ rx = sync->rx_incomplete; - LL_ASSERT(rx); + LL_ASSERT_DBG(rx); sync->rx_incomplete = NULL; /* prepare sync report with failure */ @@ -2810,16 +2817,16 @@ static void chain_start_ticker(struct ll_scan_aux_chain *chain, bool replace) (chain->ticker_ticks - ticks_slot_offset), NULL, NULL); - LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) || - (ticker_status == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ticker_status == TICKER_STATUS_SUCCESS) || + (ticker_status == TICKER_STATUS_BUSY)); } #endif /* !CONFIG_BT_TICKER_SLOT_AGNOSTIC */ if (replace) { ticker_status = ticker_stop(TICKER_INSTANCE_ID_CTLR, TICKER_USER_ID_ULL_HIGH, TICKER_ID_SCAN_AUX, NULL, NULL); - LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) || - (ticker_status == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ticker_status == TICKER_STATUS_SUCCESS) || + (ticker_status == TICKER_STATUS_BUSY)); } ticker_status = ticker_start(TICKER_INSTANCE_ID_CTLR, @@ -2834,13 +2841,13 @@ static void chain_start_ticker(struct ll_scan_aux_chain *chain, bool replace) ticks_slot_overhead), ticker_cb, chain, ticker_op_cb, chain); #if defined(CONFIG_BT_TICKER_SLOT_AGNOSTIC) - LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) || - (ticker_status == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ticker_status == TICKER_STATUS_SUCCESS) || + (ticker_status == TICKER_STATUS_BUSY)); #else - LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) || - (ticker_status == TICKER_STATUS_BUSY) || - ((ticker_status == TICKER_STATUS_FAILURE) && - IS_ENABLED(CONFIG_BT_TICKER_LOW_LAT))); + LL_ASSERT_ERR((ticker_status == TICKER_STATUS_SUCCESS) || + (ticker_status == TICKER_STATUS_BUSY) || + ((ticker_status == TICKER_STATUS_FAILURE) && + IS_ENABLED(CONFIG_BT_TICKER_LOW_LAT))); #endif /* !CONFIG_BT_TICKER_SLOT_AGNOSTIC */ #if (CONFIG_BT_CTLR_ULL_HIGH_PRIO == CONFIG_BT_CTLR_ULL_LOW_PRIO) @@ -2866,10 +2873,10 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, /* Increment prepare reference count */ ref = ull_ref_inc(&scan_aux_set.ull); - LL_ASSERT(ref); + LL_ASSERT_DBG(ref); /* The chain should always be the first in the sched_chains list */ - LL_ASSERT(scan_aux_set.sched_chains == chain); + LL_ASSERT_DBG(scan_aux_set.sched_chains == chain); /* Move chain to active list */ chain_remove_from_list(&scan_aux_set.sched_chains, chain); @@ -2886,7 +2893,7 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, /* Kick LLL prepare */ ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); if (scan_aux_set.sched_chains) { /* Start ticker for next chain */ @@ -2916,7 +2923,7 @@ static void ticker_start_failed(void *param) static void ticker_op_cb(uint32_t status, void *param) { #if defined(CONFIG_BT_TICKER_SLOT_AGNOSTIC) - LL_ASSERT(status == TICKER_STATUS_SUCCESS); + LL_ASSERT_ERR(status == TICKER_STATUS_SUCCESS); #else /* !CONFIG_BT_TICKER_SLOT_AGNOSTIC */ static memq_link_t link; static struct mayfly mfy = {0, 0, &link, NULL, ticker_start_failed}; @@ -2930,7 +2937,7 @@ static void ticker_op_cb(uint32_t status, void *param) ret = mayfly_enqueue(TICKER_USER_ID_ULL_LOW, TICKER_USER_ID_ULL_HIGH, 1, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); #endif /* !CONFIG_BT_TICKER_SLOT_AGNOSTIC */ } diff --git a/subsys/bluetooth/controller/ll_sw/ull_sched.c b/subsys/bluetooth/controller/ll_sw/ull_sched.c index 116ea101d133..5309e5c1f2a5 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_sched.c +++ b/subsys/bluetooth/controller/ll_sw/ull_sched.c @@ -465,12 +465,12 @@ static uint8_t after_match_slot_get(uint8_t user_id, uint32_t ticks_slot_abs, /* Using a local variable to address the Coverity rule: * Incorrect expression (ASSERT_SIDE_EFFECT) - * Argument "ret_cb" of LL_ASSERT() has a side effect + * Argument "ret_cb" of LL_ASSERT_ERR() has a side effect * because the variable is volatile. The containing function * might work differently in a non-debug build. */ success = (ret_cb == TICKER_STATUS_SUCCESS); - LL_ASSERT(success); + LL_ASSERT_ERR(success); /* There is a possibility that tickers expire while we * iterate through the active list of tickers, start over with @@ -478,7 +478,7 @@ static uint8_t after_match_slot_get(uint8_t user_id, uint32_t ticks_slot_abs, */ if ((ticker_id_prev != TICKER_NULL) && (*ticks_anchor != ticks_anchor_prev)) { - LL_ASSERT(retry); + LL_ASSERT_ERR(retry); retry--; ticker_id = ticker_id_prev = TICKER_NULL; diff --git a/subsys/bluetooth/controller/ll_sw/ull_sync.c b/subsys/bluetooth/controller/ll_sw/ull_sync.c index 0ce9658e8d24..183e8bc72bfb 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_sync.c +++ b/subsys/bluetooth/controller/ll_sw/ull_sync.c @@ -425,8 +425,8 @@ void ull_sync_setup_from_sync_transfer(struct ll_conn *conn, uint16_t service_da (sync->ull.ticks_slot + ticks_slot_overhead), ticker_cb, sync, ticker_start_op_cb, (void *)__LINE__); - LL_ASSERT((ret == TICKER_STATUS_SUCCESS) || - (ret == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ret == TICKER_STATUS_SUCCESS) || + (ret == TICKER_STATUS_BUSY)); } #endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER */ @@ -490,7 +490,7 @@ uint8_t ll_sync_create_cancel(void **rx) if (sync->timeout_reload != 0U) { uint16_t sync_handle = ull_sync_handle_get(sync); - LL_ASSERT(sync_handle <= UINT8_MAX); + LL_ASSERT_DBG(sync_handle <= UINT8_MAX); /* Sync is not established yet, so stop sync ticker */ const int err = @@ -585,7 +585,7 @@ uint8_t ll_sync_terminate(uint16_t handle) } #if !defined(CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS) - LL_ASSERT(!aux->parent); + LL_ASSERT_DBG(!aux->parent); #endif /* !CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS */ } @@ -1153,8 +1153,8 @@ void ull_sync_setup(struct ll_scan_set *scan, uint8_t phy, (sync->ull.ticks_slot + ticks_slot_overhead), ticker_cb, sync, ticker_start_op_cb, (void *)__LINE__); - LL_ASSERT((ret == TICKER_STATUS_SUCCESS) || - (ret == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ret == TICKER_STATUS_SUCCESS) || + (ret == TICKER_STATUS_BUSY)); } void ull_sync_setup_reset(struct ll_sync_set *sync) @@ -1418,9 +1418,9 @@ void ull_sync_done(struct node_rx_event_done *done) ticks_drift_minus, 0, 0, lazy, force, ticker_update_op_cb, sync); - LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) || - (ticker_status == TICKER_STATUS_BUSY) || - ((void *)sync == ull_disable_mark_get())); + LL_ASSERT_ERR((ticker_status == TICKER_STATUS_SUCCESS) || + (ticker_status == TICKER_STATUS_BUSY) || + ((void *)sync == ull_disable_mark_get())); } } } @@ -1435,7 +1435,7 @@ void ull_sync_chm_update(uint8_t sync_handle, uint8_t *acad, uint8_t acad_len) /* Get reference to LLL context */ sync = ull_sync_set_get(sync_handle); - LL_ASSERT(sync); + LL_ASSERT_DBG(sync); lll = &sync->lll; /* Ignore if already in progress */ @@ -1612,7 +1612,7 @@ static struct ll_sync_set *ull_sync_create(uint8_t sid, uint16_t timeout, uint16 /* Make sure that the node_rx_sync_establ hasn't got anything assigned. It is used to * mark when sync establishment is in progress. */ - LL_ASSERT(!sync->node_rx_sync_estab); + LL_ASSERT_DBG(!sync->node_rx_sync_estab); sync->node_rx_sync_estab = node_rx; /* Reporting initially enabled/disabled */ @@ -1659,7 +1659,7 @@ static struct ll_sync_set *ull_sync_create(uint8_t sid, uint16_t timeout, uint16 #if defined(CONFIG_BT_CTLR_DF_SCAN_CTE_RX) ull_df_sync_cfg_init(&lll->df_cfg); - LL_ASSERT(!lll->node_cte_incomplete); + LL_ASSERT_DBG(!lll->node_cte_incomplete); #endif /* CONFIG_BT_CTLR_DF_SCAN_CTE_RX */ /* Initialise ULL and LLL headers */ @@ -1677,8 +1677,8 @@ static void sync_ticker_cleanup(struct ll_sync_set *sync, ticker_op_func stop_op /* Stop Periodic Sync Ticker */ ret = ticker_stop(TICKER_INSTANCE_ID_CTLR, TICKER_USER_ID_ULL_HIGH, TICKER_ID_SCAN_SYNC_BASE + sync_handle, stop_op_cb, (void *)sync); - LL_ASSERT((ret == TICKER_STATUS_SUCCESS) || - (ret == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ret == TICKER_STATUS_SUCCESS) || + (ret == TICKER_STATUS_BUSY)); /* Mark sync context not sync established */ sync->timeout_reload = 0U; @@ -1706,7 +1706,7 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, /* Increment prepare reference count */ ref = ull_ref_inc(&sync->ull); - LL_ASSERT(ref); + LL_ASSERT_DBG(ref); /* Append timing parameters */ p.ticks_at_expire = ticks_at_expire; @@ -1720,7 +1720,7 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, /* Kick LLL prepare */ ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0, &mfy_lll_prepare); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); DEBUG_RADIO_PREPARE_O(1); } @@ -1728,13 +1728,13 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, static void ticker_start_op_cb(uint32_t status, void *param) { ARG_UNUSED(param); - LL_ASSERT(status == TICKER_STATUS_SUCCESS); + LL_ASSERT_ERR(status == TICKER_STATUS_SUCCESS); } static void ticker_update_op_cb(uint32_t status, void *param) { - LL_ASSERT(status == TICKER_STATUS_SUCCESS || - param == ull_disable_mark_get()); + LL_ASSERT_ERR((status == TICKER_STATUS_SUCCESS) || + (param == ull_disable_mark_get())); } static void ticker_stop_sync_expire_op_cb(uint32_t status, void *param) @@ -1743,13 +1743,13 @@ static void ticker_stop_sync_expire_op_cb(uint32_t status, void *param) static memq_link_t link; static struct mayfly mfy = {0, 0, &link, NULL, sync_expire}; - LL_ASSERT(status == TICKER_STATUS_SUCCESS); + LL_ASSERT_ERR(status == TICKER_STATUS_SUCCESS); mfy.param = param; retval = mayfly_enqueue(TICKER_USER_ID_ULL_LOW, TICKER_USER_ID_ULL_HIGH, 0, &mfy); - LL_ASSERT(!retval); + LL_ASSERT_ERR(!retval); } static void sync_expire(void *param) @@ -1789,7 +1789,7 @@ static void ticker_stop_sync_lost_op_cb(uint32_t status, void *param) * sync lost scenario, do not generate the sync lost node rx from here */ if (status != TICKER_STATUS_SUCCESS) { - LL_ASSERT(param == ull_disable_mark_get()); + LL_ASSERT_DBG(param == ull_disable_mark_get()); return; } @@ -1798,7 +1798,7 @@ static void ticker_stop_sync_lost_op_cb(uint32_t status, void *param) retval = mayfly_enqueue(TICKER_USER_ID_ULL_LOW, TICKER_USER_ID_ULL_HIGH, 0, &mfy); - LL_ASSERT(!retval); + LL_ASSERT_ERR(!retval); } static void sync_lost(void *param) @@ -1900,8 +1900,8 @@ static struct pdu_cte_info *pdu_cte_info_get(struct pdu_adv *pdu) } /* Make sure there are no fields that are not allowed for AUX_SYNC_IND and AUX_CHAIN_IND */ - LL_ASSERT(!hdr->adv_addr); - LL_ASSERT(!hdr->tgt_addr); + LL_ASSERT_DBG(!hdr->adv_addr); + LL_ASSERT_DBG(!hdr->tgt_addr); return (struct pdu_cte_info *)hdr->data; } @@ -1956,7 +1956,7 @@ void ull_sync_transfer_received(struct ll_conn *conn, uint16_t service_data, conn_evt_current = ull_conn_event_counter(conn); /* LLCP should have ensured this holds */ - LL_ASSERT(sync_conn_event_count != conn_evt_current); + LL_ASSERT_DBG(sync_conn_event_count != conn_evt_current); ull_sync_setup_from_sync_transfer(conn, service_data, sync, si, conn_event_count - conn_evt_current, diff --git a/subsys/bluetooth/controller/ll_sw/ull_sync_iso.c b/subsys/bluetooth/controller/ll_sw/ull_sync_iso.c index 222191bde22c..de741adfd6d5 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_sync_iso.c +++ b/subsys/bluetooth/controller/ll_sw/ull_sync_iso.c @@ -203,9 +203,9 @@ uint8_t ll_big_sync_create(uint8_t big_handle, uint16_t sync_handle, /* Calculate GLTK */ err = bt_crypto_h7(BIG1, bcode, igltk); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); err = bt_crypto_h6(igltk, BIG2, sync_iso->gltk); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); lll->enc = 1U; } else { @@ -309,7 +309,8 @@ uint8_t ll_big_sync_terminate(uint8_t big_handle, void **rx) mfy.param = &sync_iso->lll; ret = mayfly_enqueue(TICKER_USER_ID_THREAD, TICKER_USER_ID_LLL, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); + k_sem_take(&sem, K_FOREVER); sync_iso->flush_sem = NULL; @@ -390,7 +391,7 @@ void ull_sync_iso_stream_release(struct ll_sync_iso_set *sync_iso) stream_handle = lll->stream_handle[lll->stream_count]; stream = ull_sync_iso_stream_get(stream_handle); - LL_ASSERT(stream); + LL_ASSERT_DBG(stream); dp = stream->dp; if (dp) { @@ -503,7 +504,7 @@ void ull_sync_iso_setup(struct ll_sync_iso_set *sync_iso, * Fix ptc and ptc_curr definitions, until then we keep an assertion check * here. */ - LL_ASSERT(ptc <= BIT_MASK(4)); + LL_ASSERT_DBG(ptc <= BIT_MASK(4)); lll->ptc = ptc; } else { lll->ptc = 0U; @@ -534,7 +535,7 @@ void ull_sync_iso_setup(struct ll_sync_iso_set *sync_iso, /* Calculate GSK */ err = bt_crypto_h8(sync_iso->gltk, bi->gskd, BIG3, gsk); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); /* Prepare the CCM parameters */ ccm_rx = &lll->ccm_rx; @@ -586,7 +587,7 @@ void ull_sync_iso_setup(struct ll_sync_iso_set *sync_iso, lll->window_size_event_us; /* Skip to first selected BIS subevent */ stream = ull_sync_iso_stream_get(lll->stream_handle[0]); - LL_ASSERT(stream); + LL_ASSERT_DBG(stream); if (lll->bis_spacing >= (lll->sub_interval * lll->nse)) { sync_iso_offset_us += (stream->bis_index - 1U) * @@ -709,8 +710,8 @@ void ull_sync_iso_setup(struct ll_sync_iso_set *sync_iso, (sync_iso->ull.ticks_slot + ticks_slot_overhead), ticker_cb, sync_iso, ticker_start_op_cb, (void *)__LINE__); - LL_ASSERT((ret == TICKER_STATUS_SUCCESS) || - (ret == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ret == TICKER_STATUS_SUCCESS) || + (ret == TICKER_STATUS_BUSY)); } void ull_sync_iso_estab_done(struct node_rx_event_done *done) @@ -847,9 +848,9 @@ void ull_sync_iso_done(struct node_rx_event_done *done) lazy, force, ticker_update_op_cb, sync_iso); - LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) || - (ticker_status == TICKER_STATUS_BUSY) || - ((void *)sync_iso == ull_disable_mark_get())); + LL_ASSERT_ERR((ticker_status == TICKER_STATUS_SUCCESS) || + (ticker_status == TICKER_STATUS_BUSY) || + ((void *)sync_iso == ull_disable_mark_get())); } } @@ -999,7 +1000,7 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, /* Increment prepare reference count */ ref = ull_ref_inc(&sync_iso->ull); - LL_ASSERT(ref); + LL_ASSERT_DBG(ref); /* Append timing parameters */ p.ticks_at_expire = ticks_at_expire; @@ -1012,7 +1013,7 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, /* Kick LLL prepare */ ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0U, &mfy_lll_prepare); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); DEBUG_RADIO_PREPARE_O(1); } @@ -1021,13 +1022,13 @@ static void ticker_start_op_cb(uint32_t status, void *param) { ARG_UNUSED(param); - LL_ASSERT(status == TICKER_STATUS_SUCCESS); + LL_ASSERT_ERR(status == TICKER_STATUS_SUCCESS); } static void ticker_update_op_cb(uint32_t status, void *param) { - LL_ASSERT(status == TICKER_STATUS_SUCCESS || - param == ull_disable_mark_get()); + LL_ASSERT_ERR((status == TICKER_STATUS_SUCCESS) || + (param == ull_disable_mark_get())); } static void ticker_stop_op_cb(uint32_t status, void *param) @@ -1036,13 +1037,13 @@ static void ticker_stop_op_cb(uint32_t status, void *param) static struct mayfly mfy = {0U, 0U, &link, NULL, sync_iso_disable}; uint32_t ret; - LL_ASSERT(status == TICKER_STATUS_SUCCESS); + LL_ASSERT_ERR(status == TICKER_STATUS_SUCCESS); /* Check if any pending LLL events that need to be aborted */ mfy.param = param; ret = mayfly_enqueue(TICKER_USER_ID_ULL_LOW, TICKER_USER_ID_ULL_HIGH, 0U, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } static void sync_iso_disable(void *param) @@ -1063,14 +1064,14 @@ static void sync_iso_disable(void *param) /* Setup disabled callback to be called when ref count * returns to zero. */ - LL_ASSERT(!hdr->disabled_cb); + LL_ASSERT_ERR(!hdr->disabled_cb); hdr->disabled_param = mfy.param; hdr->disabled_cb = disabled_cb; /* Trigger LLL disable */ ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0U, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } else { /* No pending LLL events */ disabled_cb(&sync_iso->lll); @@ -1107,7 +1108,7 @@ static void disabled_cb(void *param) /* Generate BIG sync lost */ rx = (void *)&sync_iso->node_rx_lost; - LL_ASSERT(rx->hdr.link); + LL_ASSERT_DBG(rx->hdr.link); link = rx->hdr.link; rx->hdr.link = NULL; @@ -1117,7 +1118,7 @@ static void disabled_cb(void *param) mfy.param = param; ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0U, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } static void stop_ticker(struct ll_sync_iso_set *sync_iso, ticker_op_func fp_op_func) @@ -1137,6 +1138,6 @@ static void stop_ticker(struct ll_sync_iso_set *sync_iso, ticker_op_func fp_op_f sync_iso_handle_to_index(handle), fp_op_func, fp_op_func ? (void *)sync_iso : NULL); - LL_ASSERT((ret == TICKER_STATUS_SUCCESS) || - (ret == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ret == TICKER_STATUS_SUCCESS) || + (ret == TICKER_STATUS_BUSY)); } diff --git a/subsys/bluetooth/controller/ticker/ticker.c b/subsys/bluetooth/controller/ticker/ticker.c index 065e9981c5f0..567301756e29 100644 --- a/subsys/bluetooth/controller/ticker/ticker.c +++ b/subsys/bluetooth/controller/ticker/ticker.c @@ -1448,7 +1448,7 @@ void ticker_worker(void *param) timeout_func = ticker->ext_data->ext_timeout_func; expire_info = ticker->ext_data->other_expire_info; if (ticker->ext_data->expire_info_id != TICKER_NULL) { - LL_ASSERT(expire_info && !expire_info->outdated); + LL_ASSERT_DBG(expire_info && !expire_info->outdated); } ext_context.context = ticker->context; @@ -2327,7 +2327,7 @@ static inline uint32_t ticker_job_op_start(struct ticker_instance *instance, #if defined(CONFIG_BT_TICKER_LOW_LAT) /* Must expire is not supported in compatibility mode */ - LL_ASSERT(start->lazy < TICKER_LAZY_MUST_EXPIRE_KEEP); + LL_ASSERT_DBG(start->lazy < TICKER_LAZY_MUST_EXPIRE_KEEP); #else #if !defined(CONFIG_BT_TICKER_SLOT_AGNOSTIC) if (start->lazy != TICKER_LAZY_MUST_EXPIRE_KEEP) { @@ -2492,7 +2492,7 @@ static uint8_t ticker_job_reschedule_in_window(struct ticker_instance *instance) } /* Ensure that resched ticker is expired */ - LL_ASSERT(ticker_resched->ticks_to_expire == 0U); + LL_ASSERT_DBG(ticker_resched->ticks_to_expire == 0U); /* Use ticker's reserved time ticks_slot, else for unreserved * tickers use the reschedule margin as ticks_slot. @@ -2500,7 +2500,7 @@ static uint8_t ticker_job_reschedule_in_window(struct ticker_instance *instance) if (ticker_resched->ticks_slot) { ticks_slot = ticker_resched->ticks_slot; } else { - LL_ASSERT(TICKER_HAS_SLOT_WINDOW(ticker_resched)); + LL_ASSERT_DBG(TICKER_HAS_SLOT_WINDOW(ticker_resched)); ticks_slot = HAL_TICKER_RESCHEDULE_MARGIN; } @@ -3181,7 +3181,7 @@ ticker_job_compare_update(struct ticker_instance *instance, uint32_t ticks_elapsed; uint32_t ticks_diff; - LL_ASSERT(i); + LL_ASSERT_ERR(i); i--; cc = instance->ticks_current; diff --git a/tests/bluetooth/init/prj_ctlr.conf b/tests/bluetooth/init/prj_ctlr.conf index b311a76b1cde..c733ef4ad3fc 100644 --- a/tests/bluetooth/init/prj_ctlr.conf +++ b/tests/bluetooth/init/prj_ctlr.conf @@ -8,6 +8,7 @@ CONFIG_BT_SMP_SC_ONLY=y CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y CONFIG_BT_GATT_CLIENT=y CONFIG_BT_CLASSIC=n +CONFIG_BT_CTLR_ASSERT_DEBUG=n CONFIG_FLASH=y CONFIG_SOC_FLASH_NRF_RADIO_SYNC_TICKER=y CONFIG_ZTEST=y diff --git a/tests/bluetooth/init/prj_ctlr_dbg.conf b/tests/bluetooth/init/prj_ctlr_dbg.conf index cc6f478b66b6..956c562c5aa0 100644 --- a/tests/bluetooth/init/prj_ctlr_dbg.conf +++ b/tests/bluetooth/init/prj_ctlr_dbg.conf @@ -31,6 +31,7 @@ CONFIG_BT_CTLR_SCAN_REQ_RSSI=y CONFIG_BT_CTLR_SCAN_INDICATION=y CONFIG_BT_CTLR_OPTIMIZE_FOR_SPEED=y CONFIG_BT_CTLR_PROFILE_ISR=y +CONFIG_BT_CTLR_ASSERT_DEBUG=y CONFIG_BT_CTLR_DEBUG_PINS=y CONFIG_BT_CTLR_TEST=y CONFIG_BT_HCI_VS=y From c513e134c11bb3ed7d274b6570d571d53975ddd5 Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Sat, 6 Sep 2025 06:40:25 +0200 Subject: [PATCH 1973/2141] [nrf fromtree] Bluetooth: Controller: Reduce assertion check code size Reduce Controller assertion check code size for ARM Cortex-M CPUs by using the undefined instruction exception. `arm-none-eabi-addr2line` commandline can be used to get the source file and line number. Signed-off-by: Vinayak Kariappa Chettimada (cherry picked from commit 5db80f0d579b2a2064f0737474c00f902b5dd0d9) Signed-off-by: Vinayak Kariappa Chettimada --- doc/connectivity/bluetooth/api/hci.txt | 8 ++-- include/zephyr/bluetooth/hci_vs.h | 4 +- subsys/bluetooth/controller/Kconfig | 15 ++++++ .../bluetooth/controller/Kconfig.ll_sw_split | 2 + subsys/bluetooth/controller/hal/debug.h | 47 ++++++++++++++++--- subsys/bluetooth/controller/hci/hci.c | 1 + 6 files changed, 65 insertions(+), 12 deletions(-) diff --git a/doc/connectivity/bluetooth/api/hci.txt b/doc/connectivity/bluetooth/api/hci.txt index 2ad17bfae5eb..a23b24e6ad0e 100644 --- a/doc/connectivity/bluetooth/api/hci.txt +++ b/doc/connectivity/bluetooth/api/hci.txt @@ -1085,14 +1085,13 @@ represents. | Event | Event Code | Event Parameters | +-------------------------------+------------+-------------------------------+ | Fatal_Error | 0xFF | Subevent_Code, | -| | | Error_Data_Type, | | | | Error_Data | +-------------------------------+------------+-------------------------------+ -The Error_Data_Type provides an information about what is the Error_Data size -and content. +The Subevent_Code provides an information about what is the Error_Data size and +content. - Error_Data_Type: Size: 1 Octet + Subevent_Code: Size: 1 Octet +--------------------+--------------------------------------+ | Value | Parameter Description | +--------------------+--------------------------------------+ @@ -1157,6 +1156,7 @@ Zephyr Fatal Error event may be generated by k_sys_fatal_error_handler. | a4 | 4 octets | General purpose register | | ip | 4 octets | Instruction pointer register | | lr | 4 octets | Link register | + | pc | 4 octets | Program counter register | | xpsr | 4 octets | Program status register | +--------------------+--------------------------------------------+ diff --git a/include/zephyr/bluetooth/hci_vs.h b/include/zephyr/bluetooth/hci_vs.h index 1170c41474a2..3943696c195b 100644 --- a/include/zephyr/bluetooth/hci_vs.h +++ b/include/zephyr/bluetooth/hci_vs.h @@ -222,8 +222,6 @@ struct bt_hci_evt_vs { uint8_t subevent; } __packed; -#define BT_HCI_EVT_VS_FATAL_ERROR 0x02 - #define BT_HCI_EVT_VS_ERROR_DATA_TYPE_STACK_FRAME 0x01 #define BT_HCI_EVT_VS_ERROR_DATA_TYPE_CTRL_ASSERT 0x02 #define BT_HCI_EVT_VS_ERROR_DATA_TYPE_TRACE 0x03 @@ -234,8 +232,10 @@ struct bt_hci_vs_fata_error_cpu_data_cortex_m { uint32_t a4; uint32_t ip; uint32_t lr; + uint32_t pc; uint32_t xpsr; } __packed; + #define BT_HCI_EVT_VS_ERROR_CPU_TYPE_CORTEX_M 0x01 struct bt_hci_vs_fatal_error_stack_frame { uint32_t reason; diff --git a/subsys/bluetooth/controller/Kconfig b/subsys/bluetooth/controller/Kconfig index 0512c23e1ed7..98107940b949 100644 --- a/subsys/bluetooth/controller/Kconfig +++ b/subsys/bluetooth/controller/Kconfig @@ -1190,6 +1190,9 @@ rsource "Kconfig.df" rsource "Kconfig.ll_sw_split" rsource "Kconfig.dtm" +config BT_CTLR_ASSERT_OPTIMIZE_FOR_SIZE_SUPPORT + bool + config BT_CTLR_ASSERT_DEBUG bool "Development asserts" default y @@ -1211,6 +1214,18 @@ config BT_CTLR_ASSERT_HANDLER and will be invoked whenever the controller code encounters an unrecoverable error. +config BT_CTLR_ASSERT_OPTIMIZE_FOR_SIZE + bool "Assertions optimized for code size" + depends on BT_CTLR_ASSERT_OPTIMIZE_FOR_SIZE_SUPPORT + default y + help + Optimize Controller assertion check for code size. + + Example, reduces assertion check code size for ARM Cortex-M CPUs by using the undefined + instruction exception. + `arm-none-eabi-addr2line` commandline can be used to get the source file and line number + from the program counter value. + config BT_CTLR_VS_SCAN_REQ_RX bool "Use scan request reporting" depends on BT_HCI_VS && !BT_CTLR_ADV_EXT diff --git a/subsys/bluetooth/controller/Kconfig.ll_sw_split b/subsys/bluetooth/controller/Kconfig.ll_sw_split index 950e9bc7e58b..e862034c2550 100644 --- a/subsys/bluetooth/controller/Kconfig.ll_sw_split +++ b/subsys/bluetooth/controller/Kconfig.ll_sw_split @@ -70,6 +70,8 @@ config BT_LLL_VENDOR_NORDIC select BT_TICKER_PREFER_START_BEFORE_STOP if BT_TICKER_SLOT_AGNOSTIC + select BT_CTLR_ASSERT_OPTIMIZE_FOR_SIZE_SUPPORT if CPU_CORTEX_M + default y help Use Nordic Lower Link Layer implementation. diff --git a/subsys/bluetooth/controller/hal/debug.h b/subsys/bluetooth/controller/hal/debug.h index cb193a460971..98e827534fe7 100644 --- a/subsys/bluetooth/controller/hal/debug.h +++ b/subsys/bluetooth/controller/hal/debug.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Nordic Semiconductor ASA + * Copyright (c) 2016-2025 Nordic Semiconductor ASA * Copyright (c) 2016 Vinayak Kariappa Chettimada * * SPDX-License-Identifier: Apache-2.0 @@ -7,25 +7,60 @@ #include "common/assert.h" -#ifdef CONFIG_BT_CTLR_ASSERT_HANDLER +#if defined(CONFIG_BT_CTLR_ASSERT_HANDLER) void bt_ctlr_assert_handle(char *file, uint32_t line); + +#if defined(CONFIG_BT_CTLR_ASSERT_OPTIMIZE_FOR_SIZE) +BUILD_ASSERT(IS_ENABLED(CONFIG_CPU_CORTEX_M)); +/* Generate assertion as undefined instruction exception. + */ +#define LL_ASSERT(x) \ + do { \ + if (unlikely(!(x))) { \ + __asm__ inline volatile (".inst 0xde00\n"); \ + } \ + } while (0) + +#else /* !CONFIG_BT_CTLR_ASSERT_OPTIMIZE_FOR_SIZE */ +/* Generate assertion with file name and line number. + * NOTE: Variable code size increase per assertion check, depends on full file name path string + * length. + */ #define LL_ASSERT(cond) \ - if (!(cond)) { \ + if (unlikely(!(cond))) { \ BT_ASSERT_PRINT(cond); \ bt_ctlr_assert_handle(__FILE__, __LINE__); \ } +#endif /* !CONFIG_BT_CTLR_ASSERT_OPTIMIZE_FOR_SIZE */ + #define LL_ASSERT_MSG(cond, fmt, ...) \ - if (!(cond)) { \ + if (unlikely(!(cond))) { \ BT_ASSERT_PRINT(cond); \ BT_ASSERT_PRINT_MSG(fmt, ##__VA_ARGS__); \ bt_ctlr_assert_handle(__FILE__, __LINE__); \ } -#else + +#else /* !CONFIG_BT_CTLR_ASSERT_HANDLER */ + +#if defined(CONFIG_BT_CTLR_ASSERT_OPTIMIZE_FOR_SIZE) +BUILD_ASSERT(IS_ENABLED(CONFIG_CPU_CORTEX_M)); +/* Generate assertion as undefined instruction exception. + */ +#define LL_ASSERT(x) \ + do { \ + if (unlikely(!(x))) { \ + __asm__ inline volatile (".inst 0xde00\n"); \ + } \ + } while (0) + +#else /* !CONFIG_BT_CTLR_ASSERT_OPTIMIZE_FOR_SIZE */ #define LL_ASSERT(cond) \ BT_ASSERT(cond) +#endif /* !CONFIG_BT_CTLR_ASSERT_OPTIMIZE_FOR_SIZE */ + #define LL_ASSERT_MSG(cond, fmt, ...) \ BT_ASSERT_MSG(cond, fmt, ##__VA_ARGS__) -#endif +#endif /* !CONFIG_BT_CTLR_ASSERT_HANDLER */ /* Fatal asserts. * The Controller will otherwise misbehave causing memory leak or system-wide memory corruptions due diff --git a/subsys/bluetooth/controller/hci/hci.c b/subsys/bluetooth/controller/hci/hci.c index eaf4667a1b85..0e8a41260ccb 100644 --- a/subsys/bluetooth/controller/hci/hci.c +++ b/subsys/bluetooth/controller/hci/hci.c @@ -5284,6 +5284,7 @@ static void vs_err_fatal_cpu_data_fill(bt_hci_vs_fatal_error_cpu_data *cpu_data, cpu_data->a4 = sys_cpu_to_le32(esf->basic.a4); cpu_data->ip = sys_cpu_to_le32(esf->basic.ip); cpu_data->lr = sys_cpu_to_le32(esf->basic.lr); + cpu_data->pc = sys_cpu_to_le32(esf->basic.pc); cpu_data->xpsr = sys_cpu_to_le32(esf->basic.xpsr); } #endif /* CONFIG_CPU_CORTEX_M */ From 9855f4e40f2faacc97f043425568d54c21318915 Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Tue, 9 Sep 2025 13:31:44 +0200 Subject: [PATCH 1974/2141] [nrf fromtree] samples: Bluetooth: hci_ipc: Enable HCI vendor-specific h/w error event Enable HCI vendor-specific h/w error event generation in samples and tests. Signed-off-by: Vinayak Kariappa Chettimada (cherry picked from commit 29cf367568d7c6f43d87b249fe6f7bb8e4341e17) Signed-off-by: Vinayak Kariappa Chettimada --- doc/releases/migration-guide-4.3.rst | 5 +- include/zephyr/bluetooth/hci_vs.h | 2 +- .../nrf5340_cpunet_bis-bt_ll_sw_split.conf | 3 +- ...nrf5340_cpunet_bt_mesh-bt_ll_sw_split.conf | 2 + .../nrf5340_cpunet_cis-bt_ll_sw_split.conf | 3 +- .../nrf5340_cpunet_df-bt_ll_sw_split.conf | 3 +- .../nrf5340_cpunet_iso-bt_ll_sw_split.conf | 3 +- ...0_cpunet_iso_broadcast-bt_ll_sw_split.conf | 2 + ...340_cpunet_iso_central-bt_ll_sw_split.conf | 2 + ..._cpunet_iso_peripheral-bt_ll_sw_split.conf | 2 + ...340_cpunet_iso_receive-bt_ll_sw_split.conf | 2 + samples/bluetooth/hci_ipc/src/main.c | 4 ++ .../hci_uart/overlay-all-bt_ll_sw_split.conf | 3 +- subsys/bluetooth/controller/hci/hci.c | 57 ++++++++++--------- 14 files changed, 60 insertions(+), 33 deletions(-) diff --git a/doc/releases/migration-guide-4.3.rst b/doc/releases/migration-guide-4.3.rst index e2e6c21b57d7..83dc5e771201 100644 --- a/doc/releases/migration-guide-4.3.rst +++ b/doc/releases/migration-guide-4.3.rst @@ -91,10 +91,13 @@ Bluetooth Bluetooth Controller ==================== -* The following Kconfig option have been renamed: +* The following have been renamed: * :kconfig:option:`CONFIG_BT_CTRL_ADV_ADI_IN_SCAN_RSP` to :kconfig:option:`CONFIG_BT_CTLR_ADV_ADI_IN_SCAN_RSP` + * :c:struct:`bt_hci_vs_fata_error_cpu_data_cortex_m` to + :c:struct:`bt_hci_vs_fatal_error_cpu_data_cortex_m` and now contains the program counter + value. .. zephyr-keep-sorted-start re(^\w) diff --git a/include/zephyr/bluetooth/hci_vs.h b/include/zephyr/bluetooth/hci_vs.h index 3943696c195b..904bcbdb2d5d 100644 --- a/include/zephyr/bluetooth/hci_vs.h +++ b/include/zephyr/bluetooth/hci_vs.h @@ -225,7 +225,7 @@ struct bt_hci_evt_vs { #define BT_HCI_EVT_VS_ERROR_DATA_TYPE_STACK_FRAME 0x01 #define BT_HCI_EVT_VS_ERROR_DATA_TYPE_CTRL_ASSERT 0x02 #define BT_HCI_EVT_VS_ERROR_DATA_TYPE_TRACE 0x03 -struct bt_hci_vs_fata_error_cpu_data_cortex_m { +struct bt_hci_vs_fatal_error_cpu_data_cortex_m { uint32_t a1; uint32_t a2; uint32_t a3; diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_bis-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_bis-bt_ll_sw_split.conf index 9e3225621842..2827eeeeab23 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_bis-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_bis-bt_ll_sw_split.conf @@ -44,8 +44,9 @@ CONFIG_BT_ISO_RX_BUF_COUNT=1 # Controller CONFIG_BT_LL_SW_SPLIT=y -CONFIG_BT_CTLR_ASSERT_HANDLER=y CONFIG_BT_CTLR_DTM_HCI=y +CONFIG_BT_CTLR_ASSERT_HANDLER=y +CONFIG_BT_HCI_VS_FATAL_ERROR=y # Rx ACL and Adv Reports CONFIG_BT_CTLR_RX_BUFFERS=9 diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_bt_mesh-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_bt_mesh-bt_ll_sw_split.conf index 89ba46ff357a..1ba04dc5dd5b 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_bt_mesh-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_bt_mesh-bt_ll_sw_split.conf @@ -12,6 +12,8 @@ CONFIG_BT_MAX_CONN=16 # Controller CONFIG_BT_LL_SW_SPLIT=y +CONFIG_BT_CTLR_ASSERT_HANDLER=y +CONFIG_BT_HCI_VS_FATAL_ERROR=y # Disable unused Bluetooth features CONFIG_BT_CTLR_DUP_FILTER_LEN=0 diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_cis-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_cis-bt_ll_sw_split.conf index 740de0cc83eb..1f652ddbeb58 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_cis-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_cis-bt_ll_sw_split.conf @@ -43,8 +43,9 @@ CONFIG_BT_ISO_RX_BUF_COUNT=1 # Controller CONFIG_BT_LL_SW_SPLIT=y -CONFIG_BT_CTLR_ASSERT_HANDLER=y CONFIG_BT_CTLR_DTM_HCI=y +CONFIG_BT_CTLR_ASSERT_HANDLER=y +CONFIG_BT_HCI_VS_FATAL_ERROR=y # Rx ACL and Adv Reports CONFIG_BT_CTLR_RX_BUFFERS=9 diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_df-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_df-bt_ll_sw_split.conf index 663751c16e65..7a6f8544986b 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_df-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_df-bt_ll_sw_split.conf @@ -29,8 +29,9 @@ CONFIG_BT_MAX_CONN=2 # Controller CONFIG_BT_LL_SW_SPLIT=y -CONFIG_BT_CTLR_ASSERT_HANDLER=y CONFIG_BT_CTLR_DTM_HCI=y +CONFIG_BT_CTLR_ASSERT_HANDLER=y +CONFIG_BT_HCI_VS_FATAL_ERROR=y # Rx ACL and Adv Reports CONFIG_BT_CTLR_RX_BUFFERS=9 diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso-bt_ll_sw_split.conf index 710530568acb..6016318536bc 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso-bt_ll_sw_split.conf @@ -53,8 +53,9 @@ CONFIG_BT_ISO_RX_BUF_COUNT=1 # Controller CONFIG_BT_LL_SW_SPLIT=y -CONFIG_BT_CTLR_ASSERT_HANDLER=y CONFIG_BT_CTLR_DTM_HCI=y +CONFIG_BT_CTLR_ASSERT_HANDLER=y +CONFIG_BT_HCI_VS_FATAL_ERROR=y # Rx ACL and Adv Reports CONFIG_BT_CTLR_RX_BUFFERS=9 diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_broadcast-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_broadcast-bt_ll_sw_split.conf index c63928dd27ca..015a0e102f71 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_broadcast-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_broadcast-bt_ll_sw_split.conf @@ -30,6 +30,8 @@ CONFIG_BT_ISO_RX_BUF_COUNT=1 # ISO Broadcast Controller CONFIG_BT_LL_SW_SPLIT=y +CONFIG_BT_CTLR_ASSERT_HANDLER=y +CONFIG_BT_HCI_VS_FATAL_ERROR=y CONFIG_BT_CTLR_ADV_PERIODIC=y CONFIG_BT_CTLR_ADV_DATA_LEN_MAX=191 CONFIG_BT_CTLR_ADV_ISO=y diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_central-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_central-bt_ll_sw_split.conf index 55e680990eed..6f84bc3d7cfe 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_central-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_central-bt_ll_sw_split.conf @@ -40,6 +40,8 @@ CONFIG_BT_ISO_RX_BUF_COUNT=1 # Controller CONFIG_BT_LL_SW_SPLIT=y +CONFIG_BT_CTLR_ASSERT_HANDLER=y +CONFIG_BT_HCI_VS_FATAL_ERROR=y CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 CONFIG_BT_CTLR_SCAN_DATA_LEN_MAX=191 diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_peripheral-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_peripheral-bt_ll_sw_split.conf index 0031111ede82..3629ee8c9176 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_peripheral-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_peripheral-bt_ll_sw_split.conf @@ -40,6 +40,8 @@ CONFIG_BT_ISO_RX_BUF_COUNT=1 # Controller CONFIG_BT_LL_SW_SPLIT=y +CONFIG_BT_CTLR_ASSERT_HANDLER=y +CONFIG_BT_HCI_VS_FATAL_ERROR=y CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 CONFIG_BT_CTLR_ADV_DATA_LEN_MAX=191 diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_receive-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_receive-bt_ll_sw_split.conf index c0922ba9f932..1b2e85e7a604 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_receive-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_receive-bt_ll_sw_split.conf @@ -22,6 +22,8 @@ CONFIG_BT_PERIPHERAL=n # ISO Receive Controller CONFIG_BT_LL_SW_SPLIT=y +CONFIG_BT_CTLR_ASSERT_HANDLER=y +CONFIG_BT_HCI_VS_FATAL_ERROR=y CONFIG_BT_CTLR_SYNC_PERIODIC=y CONFIG_BT_CTLR_SCAN_DATA_LEN_MAX=191 CONFIG_BT_CTLR_SYNC_ISO=y diff --git a/samples/bluetooth/hci_ipc/src/main.c b/samples/bluetooth/hci_ipc/src/main.c index 3641d5d98968..1dd941b58bd9 100644 --- a/samples/bluetooth/hci_ipc/src/main.c +++ b/samples/bluetooth/hci_ipc/src/main.c @@ -307,7 +307,10 @@ void bt_ctlr_assert_handle(char *file, uint32_t line) LOG_PANIC(); while (true) { + k_cpu_idle(); }; + + CODE_UNREACHABLE; } #endif /* CONFIG_BT_CTLR_ASSERT_HANDLER */ @@ -338,6 +341,7 @@ void k_sys_fatal_error_handler(unsigned int reason, const struct arch_esf *esf) LOG_PANIC(); while (true) { + k_cpu_idle(); }; CODE_UNREACHABLE; diff --git a/samples/bluetooth/hci_uart/overlay-all-bt_ll_sw_split.conf b/samples/bluetooth/hci_uart/overlay-all-bt_ll_sw_split.conf index 05fbeb7be780..e5b65559919c 100644 --- a/samples/bluetooth/hci_uart/overlay-all-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_uart/overlay-all-bt_ll_sw_split.conf @@ -28,8 +28,9 @@ CONFIG_BT_ISO_RX_BUF_COUNT=1 # Controller CONFIG_BT_LL_SW_SPLIT=y -CONFIG_BT_CTLR_ASSERT_HANDLER=y CONFIG_BT_CTLR_DTM_HCI=y +CONFIG_BT_CTLR_ASSERT_HANDLER=y +CONFIG_BT_HCI_VS_FATAL_ERROR=y # Rx ACL and Adv Reports CONFIG_BT_CTLR_RX_BUFFERS=9 diff --git a/subsys/bluetooth/controller/hci/hci.c b/subsys/bluetooth/controller/hci/hci.c index 0e8a41260ccb..81856d7c428d 100644 --- a/subsys/bluetooth/controller/hci/hci.c +++ b/subsys/bluetooth/controller/hci/hci.c @@ -5273,9 +5273,9 @@ NET_BUF_POOL_FIXED_DEFINE(vs_err_tx_pool, 1, BT_BUF_EVT_RX_SIZE, 0, NULL); * the alias is defined here. */ #if defined(CONFIG_CPU_CORTEX_M) -typedef struct bt_hci_vs_fata_error_cpu_data_cortex_m bt_hci_vs_fatal_error_cpu_data; +static struct net_buf *vs_err_evt_create(uint8_t subevt, uint8_t len); -static void vs_err_fatal_cpu_data_fill(bt_hci_vs_fatal_error_cpu_data *cpu_data, +static void vs_err_fatal_cpu_data_fill(struct bt_hci_vs_fatal_error_cpu_data_cortex_m *cpu_data, const struct arch_esf *esf) { cpu_data->a1 = sys_cpu_to_le32(esf->basic.a1); @@ -5287,7 +5287,35 @@ static void vs_err_fatal_cpu_data_fill(bt_hci_vs_fatal_error_cpu_data *cpu_data, cpu_data->pc = sys_cpu_to_le32(esf->basic.pc); cpu_data->xpsr = sys_cpu_to_le32(esf->basic.xpsr); } -#endif /* CONFIG_CPU_CORTEX_M */ + +struct net_buf *hci_vs_err_stack_frame(unsigned int reason, const struct arch_esf *esf) +{ + /* Prepare vendor specific HCI Fatal Error event */ + struct bt_hci_vs_fatal_error_stack_frame *sf; + struct bt_hci_vs_fatal_error_cpu_data_cortex_m *cpu_data; + struct net_buf *buf; + + buf = vs_err_evt_create(BT_HCI_EVT_VS_ERROR_DATA_TYPE_STACK_FRAME, + sizeof(*sf) + sizeof(*cpu_data)); + if (buf != NULL) { + sf = net_buf_add(buf, (sizeof(*sf) + sizeof(*cpu_data))); + sf->reason = sys_cpu_to_le32(reason); + sf->cpu_type = BT_HCI_EVT_VS_ERROR_CPU_TYPE_CORTEX_M; + + vs_err_fatal_cpu_data_fill((void *)sf->cpu_data, esf); + } else { + LOG_WRN("Can't create HCI Fatal Error event"); + } + + return buf; +} + +#else /* !CONFIG_CPU_CORTEX_M */ +struct net_buf *hci_vs_err_stack_frame(unsigned int reason, const struct arch_esf *esf) +{ + return NULL; +} +#endif /* !CONFIG_CPU_CORTEX_M */ static struct net_buf *vs_err_evt_create(uint8_t subevt, uint8_t len) { @@ -5311,29 +5339,6 @@ static struct net_buf *vs_err_evt_create(uint8_t subevt, uint8_t len) return buf; } -struct net_buf *hci_vs_err_stack_frame(unsigned int reason, const struct arch_esf *esf) -{ - /* Prepare vendor specific HCI Fatal Error event */ - struct bt_hci_vs_fatal_error_stack_frame *sf; - bt_hci_vs_fatal_error_cpu_data *cpu_data; - struct net_buf *buf; - - buf = vs_err_evt_create(BT_HCI_EVT_VS_ERROR_DATA_TYPE_STACK_FRAME, - sizeof(*sf) + sizeof(*cpu_data)); - if (buf != NULL) { - sf = net_buf_add(buf, (sizeof(*sf) + sizeof(*cpu_data))); - sf->reason = sys_cpu_to_le32(reason); - sf->cpu_type = BT_HCI_EVT_VS_ERROR_CPU_TYPE_CORTEX_M; - - vs_err_fatal_cpu_data_fill( - (bt_hci_vs_fatal_error_cpu_data *)sf->cpu_data, esf); - } else { - LOG_ERR("Can't create HCI Fatal Error event"); - } - - return buf; -} - static struct net_buf *hci_vs_err_trace_create(uint8_t data_type, const char *file_path, uint32_t line, uint64_t pc) From e2848c0005ab83c630f4e75d835526fe5d63cf10 Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Sat, 18 Oct 2025 07:00:43 +0200 Subject: [PATCH 1975/2141] [nrf fromtree] Bluetooth: Controller: Add code comments related to short prepare Add code comments explaining the handling of short prepare that can be enqueued out of order and present in use of FIFO for prepare pipeline. Signed-off-by: Vinayak Kariappa Chettimada (cherry picked from commit d737e285e57bae84057160a5ee94b7c566b9705e) Signed-off-by: Vinayak Kariappa Chettimada --- .../controller/ll_sw/nordic/lll/lll.c | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c index 557e4745b032..0bf5d1772f1e 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c @@ -852,16 +852,41 @@ int lll_prepare_resolve(lll_is_abort_cb_t is_abort_cb, lll_abort_cb_t abort_cb, ticks_at_preempt_next = ready->prepare_param.ticks_at_expire; diff = ticker_ticks_diff_get(ticks_at_preempt_min, ticks_at_preempt_next); + /* If the enqueued prepare is a resume or current ready prepare is shorter, then we + * should pick current ready prepare for setting up the prepare timeout. + */ if (is_resume || ((diff & BIT(HAL_TICKER_CNTR_MSBIT)) == 0U)) { ticks_at_preempt_min = ticks_at_preempt_next; if (&ready->prepare_param != prepare_param) { + /* There is a shorter prepare in the pipeline */ ready_short = ready; + } else { + /* It is the same prepare in the pipeline being enqueued. + * This can happen executing `lll_done()`. + * Hence, we should ignore it being the `first` that setup the + * preempt timeout and also it has already setup the preempt + * timeout, refer to `preempt_ticker_start()` for details. + * + * We also set the `ready` to NULL as it is the same ready, the one + * being enqueued. This help short circuit a related assertion check + * later in this function. + */ + ready = NULL; } } else { ready = NULL; idx_backup = UINT8_MAX; } + /* Loop and find any short prepare present out-of-order in the prepare pipeline. + * + * NOTE: This loop is O(n), where n is number of items in prepare pipeline present + * before a short prepare was enqueued in to the FIFO. + * Use of ordered linked list implementation has show improved lower latencies + * and less CPU use. + * TODO: Replace use of FIFO for prepare pipeline with ordered linked list + * implementation. + */ do { struct lll_event *ready_next; From 570aedec96908684249339a601bfebda392a6c1b Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Mon, 2 Jun 2025 08:47:12 +0530 Subject: [PATCH 1976/2141] [nrf fromtree] Bluetooth: Controller: nRF54Lx: Add Controller Privacy Support Add Controller Privacy support for nRF54Lx by porting to use NRF_AAR00 h/w peripheral. Signed-off-by: Vinayak Kariappa Chettimada (cherry picked from commit 6d79d52118d2bdff67ab7f8216f1d2e6e88a3338) Signed-off-by: Vinayak Kariappa Chettimada --- .../ll_sw/nordic/hal/nrf5/radio/radio.c | 110 ++++++++++++++++++ .../nordic/hal/nrf5/radio/radio_nrf54lx.h | 3 + .../nordic/hal/nrf5/radio/radio_nrf5_dppi.h | 11 ++ .../nrf5/radio/radio_nrf5_dppi_resources.h | 12 +- .../nordic/hal/nrf5/radio/radio_sim_nrf54l.h | 3 + 5 files changed, 136 insertions(+), 3 deletions(-) diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c index 218965d11bd0..7056f020bc28 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c @@ -2562,7 +2562,48 @@ void radio_ccm_disable(void) #endif /* CONFIG_BT_CTLR_LE_ENC || CONFIG_BT_CTLR_BROADCAST_ISO_ENC */ #if defined(CONFIG_BT_CTLR_PRIVACY) +#if defined(CONFIG_SOC_COMPATIBLE_NRF54LX) +struct aar_job_ptr { + void *ptr; + struct { + uint32_t length:24; + uint32_t attribute:8; + } __packed; +} __packed; + +#define AAR_JOB_PTR_ATTRIBUTE_HASH 11U +#define AAR_JOB_PTR_ATTRIBUTE_PRAND 12U +#define AAR_JOB_PTR_ATTRIBUTE_IRK 13U +#define AAR_JOB_PTR_ATTRIBUTE_INDEX 11U + +#define AAR_JOB_OUT_MAX_RESOLVED 1U + +#define AAR_IRK_SIZE 16U + +#define RADIO_PACKET_PTR_TO_PDU_OFFSET 3U + +#define BDADDR_HASH_OFFSET 0U +#define BDADDR_HASH_SIZE 3U +#define BDADDR_PRND_OFFSET 3U +#define BDADDR_PRND_SIZE 3U + +/* AAR HAL global memory referenced by the h/w peripheral and its DMA */ +static struct { + /* Index of the IRK match in the AAR job list, on successful resolution */ + uint32_t status; + + /* Input AAR job list; list of Hash, Prand, IRKs and a terminating empty job entry */ + struct aar_job_ptr in[CONFIG_BT_CTLR_RL_SIZE + 3]; + + /* Output AAR job list of one entry */ + struct aar_job_ptr out[AAR_JOB_OUT_MAX_RESOLVED]; + + /* NOTE: Refer to the AAR section in the SoC product specification for details */ +} aar_job; + +#else /* !CONFIG_SOC_COMPATIBLE_NRF54LX */ static uint8_t MALIGN(4) _aar_scratch[3]; +#endif /* !CONFIG_SOC_COMPATIBLE_NRF54LX */ void radio_ar_configure(uint32_t nirk, void *irk, uint8_t flags) { @@ -2599,10 +2640,57 @@ void radio_ar_configure(uint32_t nirk, void *irk, uint8_t flags) NRF_AAR->ENABLE = (AAR_ENABLE_ENABLE_Enabled << AAR_ENABLE_ENABLE_Pos) & AAR_ENABLE_ENABLE_Msk; + +#if defined(CONFIG_SOC_COMPATIBLE_NRF54LX) + /* Input, Resolvable Address Hash offset in the legacy or extended advertising PDU. + * Radio packet pointer offset by 3 compared to legacy AAR in nRF51/52/53 SoCs that took + * Radio packet pointer value. + */ + aar_job.in[0].ptr = (uint8_t *)addrptr + RADIO_PACKET_PTR_TO_PDU_OFFSET + + BDADDR_HASH_OFFSET; + aar_job.in[0].length = BDADDR_HASH_SIZE; + aar_job.in[0].attribute = AAR_JOB_PTR_ATTRIBUTE_HASH; + + /* Input, Resolvable Address Random offset in the legacy or extended advertising PDU. + * Radio packet pointer offset by 3 compared to legacy AAR in nRF51/52/53 SoCs that took + * Radio packet pointer, plus offset of the 24-bit random in the legacy or extended + * advertising PDU after the 24-bit Hash in the Resolvable Address. + */ + aar_job.in[1].ptr = (uint8_t *)addrptr + RADIO_PACKET_PTR_TO_PDU_OFFSET + + BDADDR_PRND_OFFSET; + aar_job.in[1].length = BDADDR_PRND_SIZE; + aar_job.in[1].attribute = AAR_JOB_PTR_ATTRIBUTE_PRAND; + + /* Input, list of IRKs used for resolution */ + for (uint32_t i = 0; i < nirk; i++) { + aar_job.in[2U + i].ptr = (void *)(((uint8_t *)irk) + (AAR_IRK_SIZE * i)); + aar_job.in[2U + i].length = AAR_IRK_SIZE; + aar_job.in[2U + i].attribute = AAR_JOB_PTR_ATTRIBUTE_IRK; + } + + /* A terminating empty job entry */ + aar_job.in[2U + nirk].ptr = 0U; + aar_job.in[2U + nirk].length = 0U; + aar_job.in[2U + nirk].attribute = 0U; + + /* Reset match index to invalid value ( >= CONFIG_BT_CTLR_RL_SIZE ) */ + aar_job.status = UINT32_MAX; + + /* Output, single job entry that populates the `status` value with match index */ + aar_job.out[0].ptr = &aar_job.status; + aar_job.out[0].length = sizeof(aar_job.status); + aar_job.out[0].attribute = AAR_JOB_PTR_ATTRIBUTE_INDEX; + + NRF_AAR->IN.PTR = (uint32_t)&aar_job.in[0]; + NRF_AAR->OUT.PTR = (uint32_t)&aar_job.out[0]; + NRF_AAR->MAXRESOLVED = AAR_JOB_OUT_MAX_RESOLVED; + +#else /* !CONFIG_SOC_COMPATIBLE_NRF54LX */ NRF_AAR->NIRK = nirk; NRF_AAR->IRKPTR = (uint32_t)irk; NRF_AAR->ADDRPTR = addrptr; NRF_AAR->SCRATCHPTR = (uint32_t)&_aar_scratch[0]; +#endif /* !CONFIG_SOC_COMPATIBLE_NRF54LX */ nrf_aar_event_clear(NRF_AAR, NRF_AAR_EVENT_END); nrf_aar_event_clear(NRF_AAR, NRF_AAR_EVENT_RESOLVED); @@ -2617,7 +2705,11 @@ void radio_ar_configure(uint32_t nirk, void *irk, uint8_t flags) uint32_t radio_ar_match_get(void) { +#if defined(CONFIG_SOC_COMPATIBLE_NRF54LX) + return aar_job.status; +#else /* !CONFIG_SOC_COMPATIBLE_NRF54LX */ return NRF_AAR->STATUS; +#endif /* !CONFIG_SOC_COMPATIBLE_NRF54LX */ } void radio_ar_status_reset(void) @@ -2660,7 +2752,25 @@ uint8_t radio_ar_resolve(const uint8_t *addr) NRF_AAR->ENABLE = (AAR_ENABLE_ENABLE_Enabled << AAR_ENABLE_ENABLE_Pos) & AAR_ENABLE_ENABLE_Msk; +#if defined(CONFIG_SOC_COMPATIBLE_NRF54LX) + /* Input, Resolvable Address Hash offset in the supplied address buffer */ + aar_job.in[0].ptr = (void *)&addr[BDADDR_HASH_OFFSET]; + + /* Input, Resolvable Address Prand offset in the supplied address buffer */ + aar_job.in[1].ptr = (void *)&addr[BDADDR_PRND_OFFSET]; + + /* Reset match index to invalid value ( >= CONFIG_BT_CTLR_RL_SIZE ) */ + aar_job.status = UINT32_MAX; + + /* NOTE: Other `aar_job` structure members are initialized in `radio_ar_configure()` */ + + NRF_AAR->IN.PTR = (uint32_t)&aar_job.in[0]; + NRF_AAR->OUT.PTR = (uint32_t)&aar_job.out[0]; + NRF_AAR->MAXRESOLVED = AAR_JOB_OUT_MAX_RESOLVED; + +#else /* !CONFIG_SOC_COMPATIBLE_NRF54LX */ NRF_AAR->ADDRPTR = (uint32_t)addr - 3; +#endif /* !CONFIG_SOC_COMPATIBLE_NRF54LX */ nrf_aar_event_clear(NRF_AAR, NRF_AAR_EVENT_END); nrf_aar_event_clear(NRF_AAR, NRF_AAR_EVENT_RESOLVED); diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf54lx.h b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf54lx.h index 047e3ea24878..3a8206d79764 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf54lx.h +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf54lx.h @@ -398,6 +398,9 @@ #define CCM_MODE_DATARATE_500Kbps CCM_MODE_DATARATE_500Kbit #define CCM_RATEOVERRIDE_RATEOVERRIDE_500Kbps CCM_RATEOVERRIDE_RATEOVERRIDE_500Kbit +/* HAL abstraction of AAR h/w */ +#define NRF_AAR NRF_AAR00 + static inline void hal_radio_reset(void) { /* TODO: Add any required setup for each radio event diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_dppi.h b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_dppi.h index 3b68259c9bf6..1085f72f0b98 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_dppi.h +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_dppi.h @@ -226,6 +226,17 @@ static inline void hal_trigger_aar_ppi_config(void) { nrf_radio_publish_set(NRF_RADIO, NRF_RADIO_EVENT_BCMATCH, HAL_TRIGGER_AAR_PPI); nrf_aar_subscribe_set(NRF_AAR, NRF_AAR_TASK_START, HAL_TRIGGER_AAR_PPI); + +#if defined(CONFIG_SOC_COMPATIBLE_NRF54LX) + /* Enable same DPPI in MCU domain */ + nrf_dppi_channels_enable(NRF_DPPIC00, BIT(HAL_TRIGGER_AAR_PPI)); + + /* Setup PPIB send subscribe */ + nrf_ppib_subscribe_set(NRF_PPIB10, HAL_PPIB_SEND_TRIGGER_AAR_PPI, HAL_TRIGGER_AAR_PPI); + + /* Setup PPIB receive publish */ + nrf_ppib_publish_set(NRF_PPIB00, HAL_PPIB_RECEIVE_TRIGGER_AAR_PPI, HAL_TRIGGER_AAR_PPI); +#endif /* CONFIG_SOC_COMPATIBLE_NRF54LX */ } #endif /* CONFIG_BT_CTLR_PRIVACY */ diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_dppi_resources.h b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_dppi_resources.h index 3c9a9e6949b3..3a49b97e7b26 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_dppi_resources.h +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_dppi_resources.h @@ -60,19 +60,25 @@ */ #if defined(CONFIG_SOC_COMPATIBLE_NRF54LX) #define HAL_TRIGGER_CRYPT_PPI 7 -#else /* CONFIG_SOC_COMPATIBLE_NRF54LX */ -#define HAL_TRIGGER_CRYPT_PPI HAL_RADIO_RECV_TIMEOUT_CANCEL_PPI -#endif /* CONFIG_SOC_COMPATIBLE_NRF54LX */ #define HAL_PPIB_SEND_TRIGGER_CRYPT_PPI \ _CONCAT(NRF_PPIB_TASK_SEND_, HAL_TRIGGER_CRYPT_PPI) #define HAL_PPIB_RECEIVE_TRIGGER_CRYPT_PPI \ _CONCAT(NRF_PPIB_EVENT_RECEIVE_, HAL_TRIGGER_CRYPT_PPI) +#else /* !CONFIG_SOC_COMPATIBLE_NRF54LX */ +#define HAL_TRIGGER_CRYPT_PPI HAL_RADIO_RECV_TIMEOUT_CANCEL_PPI +#endif /* !CONFIG_SOC_COMPATIBLE_NRF54LX */ /******************************************************************************* * Trigger automatic address resolution on Bit counter match: * wire the RADIO EVENTS_BCMATCH event to the AAR TASKS_START task. */ #define HAL_TRIGGER_AAR_PPI 6 +#if defined(CONFIG_SOC_COMPATIBLE_NRF54LX) +#define HAL_PPIB_SEND_TRIGGER_AAR_PPI \ + _CONCAT(NRF_PPIB_TASK_SEND_, HAL_TRIGGER_AAR_PPI) +#define HAL_PPIB_RECEIVE_TRIGGER_AAR_PPI \ + _CONCAT(NRF_PPIB_EVENT_RECEIVE_, HAL_TRIGGER_AAR_PPI) +#endif /* CONFIG_SOC_COMPATIBLE_NRF54LX */ #if defined(CONFIG_BT_CTLR_PHY_CODED) && \ defined(CONFIG_HAS_HW_NRF_RADIO_BLE_CODED) diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_sim_nrf54l.h b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_sim_nrf54l.h index 324f2c8edb3f..8987031db5f1 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_sim_nrf54l.h +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_sim_nrf54l.h @@ -392,6 +392,9 @@ #define CCM_MODE_DATARATE_500Kbps CCM_MODE_DATARATE_500Kbit #define CCM_RATEOVERRIDE_RATEOVERRIDE_500Kbps CCM_RATEOVERRIDE_RATEOVERRIDE_500Kbit +/* HAL abstraction of AAR h/w */ +#define NRF_AAR NRF_AAR00 + static inline void hal_radio_reset(void) { /* TODO: Add any required setup for each radio event From 3609c26d901e38000526de4a07762885f52ebc30 Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Tue, 3 Jun 2025 05:15:27 +0200 Subject: [PATCH 1977/2141] [nrf fromtree] tests: bsim: Bluetooth: Conditionally compile Controller Privacy Conditionally compile Controller Privacy testing and enable advertising test for nRF54L15bsim. Signed-off-by: Vinayak Kariappa Chettimada (cherry picked from commit 7a1e7c9fbaa061a9150210a2870b59ee151ff6bf) Signed-off-by: Vinayak Kariappa Chettimada --- .../compile.nrf54l15bsim_nrf54l15_cpuapp.sh | 3 + tests/bsim/bluetooth/ll/advx/src/main.c | 90 ++++++++++++------- .../ll/advx/tests_scripts/basic_advx.sh | 4 +- .../basic_advx_scan_aux_use_chains.sh | 4 +- .../basic_advx_ticker_expire_info.sh | 4 +- .../tests.nrf54l15bsim_nrf54l15_cpuapp.txt | 1 + 6 files changed, 68 insertions(+), 38 deletions(-) diff --git a/tests/bsim/bluetooth/compile.nrf54l15bsim_nrf54l15_cpuapp.sh b/tests/bsim/bluetooth/compile.nrf54l15bsim_nrf54l15_cpuapp.sh index 9db8bbcf8d25..75b006af80a2 100755 --- a/tests/bsim/bluetooth/compile.nrf54l15bsim_nrf54l15_cpuapp.sh +++ b/tests/bsim/bluetooth/compile.nrf54l15bsim_nrf54l15_cpuapp.sh @@ -13,6 +13,9 @@ export BOARD="${BOARD:-nrf54l15bsim/nrf54l15/cpuapp}" source ${ZEPHYR_BASE}/tests/bsim/compile.source +app=tests/bsim/bluetooth/ll/advx compile +app=tests/bsim/bluetooth/ll/advx conf_overlay=overlay-ticker_expire_info.conf compile +app=tests/bsim/bluetooth/ll/advx conf_overlay=overlay-scan_aux_use_chains.conf compile app=tests/bsim/bluetooth/ll/throughput compile app=tests/bsim/bluetooth/ll/throughput conf_overlay=overlay-no_phy_update.conf compile app=tests/bsim/bluetooth/ll/multiple_id compile diff --git a/tests/bsim/bluetooth/ll/advx/src/main.c b/tests/bsim/bluetooth/ll/advx/src/main.c index cd9f0a4cd503..ac9d99976c55 100644 --- a/tests/bsim/bluetooth/ll/advx/src/main.c +++ b/tests/bsim/bluetooth/ll/advx/src/main.c @@ -29,7 +29,11 @@ #define EVT_PROP_TXP BIT(6) #define ADV_INTERVAL 0x20 /* 20 ms advertising interval */ #define ADV_WAIT_MS 10 /* 10 ms wait loop */ +#if defined(CONFIG_BT_CTLR_PRIVACY) +#define OWN_ADDR_TYPE BT_HCI_OWN_ADDR_RPA_OR_RANDOM +#else /* !CONFIG_BT_CTLR_PRIVACY */ #define OWN_ADDR_TYPE BT_HCI_OWN_ADDR_RANDOM +#endif /* !CONFIG_BT_CTLR_PRIVACY */ #define PEER_ADDR_TYPE BT_HCI_OWN_ADDR_RANDOM #define PEER_ADDR peer_addr #define ADV_CHAN_MAP 0x07 @@ -675,28 +679,32 @@ static void test_advx_main(void) k_sleep(K_MSEC(1000)); - printk("Add to resolving list..."); - bt_addr_le_t peer_id_addr = { - .type = BT_ADDR_LE_RANDOM, - .a = { - .val = {0xc6, 0xc7, 0xc8, 0xc9, 0xc1, 0xcb} - } - }; - uint8_t pirk[16] = {0x00, }; - uint8_t lirk[16] = {0x01, }; + if (IS_ENABLED(CONFIG_BT_CTLR_PRIVACY)) { + printk("Add to resolving list..."); + bt_addr_le_t peer_id_addr = { + .type = BT_ADDR_LE_RANDOM, + .a = { + .val = {0xc6, 0xc7, 0xc8, 0xc9, 0xc1, 0xcb} + } + }; + uint8_t pirk[16] = {0xAB, 0xBA, 0xAB, 0xBA, 0xAB, 0xBA, 0xAB, 0xBA, + 0xAB, 0xBA, 0xAB, 0xBA, 0xAB, 0xBA, 0xAB, 0xBA}; + uint8_t lirk[16] = {0x12, 0x21, 0x12, 0x21, 0x12, 0x21, 0x12, 0x21, + 0x12, 0x21, 0x12, 0x21, 0x12, 0x21, 0x12, 0x21}; - err = ll_rl_add(&peer_id_addr, pirk, lirk); - if (err) { - goto exit; - } - printk("success.\n"); + err = ll_rl_add(&peer_id_addr, pirk, lirk); + if (err) { + goto exit; + } + printk("success.\n"); - printk("Enable resolving list..."); - err = ll_rl_enable(BT_HCI_ADDR_RES_ENABLE); - if (err) { - goto exit; + printk("Enable resolving list..."); + err = ll_rl_enable(BT_HCI_ADDR_RES_ENABLE); + if (err) { + goto exit; + } + printk("success.\n"); } - printk("success.\n"); printk("Enabling extended..."); err = ll_adv_enable(handle, 1, 0, 0); @@ -1716,28 +1724,46 @@ static void test_scanx_main(void) } printk("done.\n"); - printk("Add to resolving list..."); bt_addr_le_t peer_id_addr = { .type = BT_ADDR_LE_RANDOM, .a = { .val = {0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5} } }; - uint8_t pirk[16] = {0x01, }; - uint8_t lirk[16] = {0x00, }; - err = ll_rl_add(&peer_id_addr, pirk, lirk); - if (err) { - goto exit; - } - printk("success.\n"); + if (IS_ENABLED(CONFIG_BT_CTLR_PRIVACY)) { + printk("Add to resolving list..."); + bt_addr_le_t some_id_addr = { + .type = BT_ADDR_LE_RANDOM, + .a = { + .val = {0x78, 0x87, 0x78, 0x87, 0x78, 0x87} + } + }; + uint8_t pirk[16] = {0x12, 0x21, 0x12, 0x21, 0x12, 0x21, 0x12, 0x21, + 0x12, 0x21, 0x12, 0x21, 0x12, 0x21, 0x12, 0x21}; + uint8_t lirk[16] = {0xCD, 0xDC, 0xCD, 0xDC, 0xCD, 0xDC, 0xCD, 0xDC, + 0xCD, 0xDC, 0xCD, 0xDC, 0xCD, 0xDC, 0xCD, 0xDC}; + + /* some_id_addr with swapped peer IRK and local IRK */ + err = ll_rl_add(&some_id_addr, lirk, pirk); + if (err) { + goto exit; + } - printk("Enable resolving list..."); - err = ll_rl_enable(BT_HCI_ADDR_RES_ENABLE); - if (err) { - goto exit; + /* peer_id_addr with correct peer IRK and local IRK */ + err = ll_rl_add(&peer_id_addr, pirk, lirk); + if (err) { + goto exit; + } + printk("success.\n"); + + printk("Enable resolving list..."); + err = ll_rl_enable(BT_HCI_ADDR_RES_ENABLE); + if (err) { + goto exit; + } + printk("success.\n"); } - printk("success.\n"); printk("Add device to periodic advertising list..."); err = bt_le_per_adv_list_add(&peer_id_addr, per_sid); diff --git a/tests/bsim/bluetooth/ll/advx/tests_scripts/basic_advx.sh b/tests/bsim/bluetooth/ll/advx/tests_scripts/basic_advx.sh index 540611f69a37..02add45e85eb 100755 --- a/tests/bsim/bluetooth/ll/advx/tests_scripts/basic_advx.sh +++ b/tests/bsim/bluetooth/ll/advx/tests_scripts/basic_advx.sh @@ -13,10 +13,10 @@ EXECUTE_TIMEOUT=120 cd ${BSIM_OUT_PATH}/bin Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_ll_advx_prj_conf \ - -v=${verbosity_level} -s=${simulation_id} -d=0 -testid=advx + -v=${verbosity_level} -s=${simulation_id} -RealEncryption=1 -d=0 -testid=advx Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_ll_advx_prj_conf\ - -v=${verbosity_level} -s=${simulation_id} -d=1 -testid=scanx + -v=${verbosity_level} -s=${simulation_id} -RealEncryption=1 -d=1 -testid=scanx Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s=${simulation_id} \ -D=2 -sim_length=60e6 $@ diff --git a/tests/bsim/bluetooth/ll/advx/tests_scripts/basic_advx_scan_aux_use_chains.sh b/tests/bsim/bluetooth/ll/advx/tests_scripts/basic_advx_scan_aux_use_chains.sh index 0e26ae907de3..0331788a6309 100755 --- a/tests/bsim/bluetooth/ll/advx/tests_scripts/basic_advx_scan_aux_use_chains.sh +++ b/tests/bsim/bluetooth/ll/advx/tests_scripts/basic_advx_scan_aux_use_chains.sh @@ -13,10 +13,10 @@ EXECUTE_TIMEOUT=120 cd ${BSIM_OUT_PATH}/bin Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_ll_advx_prj_conf_overlay-scan_aux_use_chains_conf \ - -v=${verbosity_level} -s=${simulation_id} -d=0 -testid=advx + -v=${verbosity_level} -s=${simulation_id} -RealEncryption=1 -d=0 -testid=advx Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_ll_advx_prj_conf_overlay-scan_aux_use_chains_conf \ - -v=${verbosity_level} -s=${simulation_id} -d=1 -testid=scanx + -v=${verbosity_level} -s=${simulation_id} -RealEncryption=1 -d=1 -testid=scanx Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s=${simulation_id} \ -D=2 -sim_length=60e6 $@ diff --git a/tests/bsim/bluetooth/ll/advx/tests_scripts/basic_advx_ticker_expire_info.sh b/tests/bsim/bluetooth/ll/advx/tests_scripts/basic_advx_ticker_expire_info.sh index cabee84f0157..655732639171 100755 --- a/tests/bsim/bluetooth/ll/advx/tests_scripts/basic_advx_ticker_expire_info.sh +++ b/tests/bsim/bluetooth/ll/advx/tests_scripts/basic_advx_ticker_expire_info.sh @@ -13,10 +13,10 @@ EXECUTE_TIMEOUT=120 cd ${BSIM_OUT_PATH}/bin Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_ll_advx_prj_conf_overlay-ticker_expire_info_conf \ - -v=${verbosity_level} -s=${simulation_id} -d=0 -testid=advx + -v=${verbosity_level} -s=${simulation_id} -RealEncryption=1 -d=0 -testid=advx Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_ll_advx_prj_conf_overlay-ticker_expire_info_conf \ - -v=${verbosity_level} -s=${simulation_id} -d=1 -testid=scanx + -v=${verbosity_level} -s=${simulation_id} -RealEncryption=1 -d=1 -testid=scanx Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s=${simulation_id} \ -D=2 -sim_length=60e6 $@ diff --git a/tests/bsim/bluetooth/tests.nrf54l15bsim_nrf54l15_cpuapp.txt b/tests/bsim/bluetooth/tests.nrf54l15bsim_nrf54l15_cpuapp.txt index d5dee727d5e9..4b94f5ee29f0 100644 --- a/tests/bsim/bluetooth/tests.nrf54l15bsim_nrf54l15_cpuapp.txt +++ b/tests/bsim/bluetooth/tests.nrf54l15bsim_nrf54l15_cpuapp.txt @@ -1,5 +1,6 @@ # Search paths(s) for tests which will be run in the nrf54l15 app core # This file is used in CI to select which tests are run +tests/bsim/bluetooth/ll/advx/ tests/bsim/bluetooth/ll/throughput/ tests/bsim/bluetooth/ll/multiple_id/ tests/bsim/bluetooth/ll/bis/tests_scripts/broadcast_iso_interleaved.sh From c7dd2d31ee69d6164c40eea709366280ae20dd84 Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Mon, 2 Jun 2025 08:47:12 +0530 Subject: [PATCH 1978/2141] [nrf fromtree] Bluetooth: Controller: nRF54Lx: Enable Controller Privacy Support Enable Controller Privacy support for nRF54Lx as default. Signed-off-by: Vinayak Kariappa Chettimada (cherry picked from commit 4428c1a8683e2376286ea3b9d78cba4c2190797d) Signed-off-by: Vinayak Kariappa Chettimada --- subsys/bluetooth/controller/Kconfig.ll_sw_split | 3 +-- tests/bsim/bluetooth/compile.nrf54l15bsim_nrf54l15_cpuapp.sh | 2 ++ tests/bsim/bluetooth/tests.nrf54l15bsim_nrf54l15_cpuapp.txt | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/subsys/bluetooth/controller/Kconfig.ll_sw_split b/subsys/bluetooth/controller/Kconfig.ll_sw_split index e862034c2550..b6774d63c7c6 100644 --- a/subsys/bluetooth/controller/Kconfig.ll_sw_split +++ b/subsys/bluetooth/controller/Kconfig.ll_sw_split @@ -22,8 +22,7 @@ config BT_LLL_VENDOR_NORDIC !BT_CTLR_DATA_LENGTH_CLEAR && \ !BT_CTLR_PHY_2M_NRF select BT_CTLR_PRIVACY_SUPPORT if BT_CTLR_CRYPTO_SUPPORT && \ - !SOC_SERIES_NRF51X && \ - !SOC_COMPATIBLE_NRF54LX + !SOC_SERIES_NRF51X select BT_CTLR_CONN_PARAM_REQ_SUPPORT select BT_CTLR_EXT_REJ_IND_SUPPORT select BT_CTLR_PER_INIT_FEAT_XCHG_SUPPORT diff --git a/tests/bsim/bluetooth/compile.nrf54l15bsim_nrf54l15_cpuapp.sh b/tests/bsim/bluetooth/compile.nrf54l15bsim_nrf54l15_cpuapp.sh index 75b006af80a2..ee428e1a97ce 100755 --- a/tests/bsim/bluetooth/compile.nrf54l15bsim_nrf54l15_cpuapp.sh +++ b/tests/bsim/bluetooth/compile.nrf54l15bsim_nrf54l15_cpuapp.sh @@ -16,6 +16,8 @@ source ${ZEPHYR_BASE}/tests/bsim/compile.source app=tests/bsim/bluetooth/ll/advx compile app=tests/bsim/bluetooth/ll/advx conf_overlay=overlay-ticker_expire_info.conf compile app=tests/bsim/bluetooth/ll/advx conf_overlay=overlay-scan_aux_use_chains.conf compile +app=tests/bsim/bluetooth/ll/conn conf_file=prj_split.conf compile +app=tests/bsim/bluetooth/ll/conn conf_file=prj_split_privacy.conf compile app=tests/bsim/bluetooth/ll/throughput compile app=tests/bsim/bluetooth/ll/throughput conf_overlay=overlay-no_phy_update.conf compile app=tests/bsim/bluetooth/ll/multiple_id compile diff --git a/tests/bsim/bluetooth/tests.nrf54l15bsim_nrf54l15_cpuapp.txt b/tests/bsim/bluetooth/tests.nrf54l15bsim_nrf54l15_cpuapp.txt index 4b94f5ee29f0..d289755e9fb3 100644 --- a/tests/bsim/bluetooth/tests.nrf54l15bsim_nrf54l15_cpuapp.txt +++ b/tests/bsim/bluetooth/tests.nrf54l15bsim_nrf54l15_cpuapp.txt @@ -1,6 +1,8 @@ # Search paths(s) for tests which will be run in the nrf54l15 app core # This file is used in CI to select which tests are run tests/bsim/bluetooth/ll/advx/ +tests/bsim/bluetooth/ll/conn/tests_scripts/basic_conn_encrypted_split.sh +tests/bsim/bluetooth/ll/conn/tests_scripts/basic_conn_encrypted_split_privacy.sh tests/bsim/bluetooth/ll/throughput/ tests/bsim/bluetooth/ll/multiple_id/ tests/bsim/bluetooth/ll/bis/tests_scripts/broadcast_iso_interleaved.sh From ab347f80ca704cb332bcc3a3a85a4429d2695d3e Mon Sep 17 00:00:00 2001 From: Lars Segerlund Date: Wed, 22 Oct 2025 11:31:27 +0200 Subject: [PATCH 1979/2141] [nrf fromtree] Bluetooth: Controller: Handle overlapping CIG and ACL If the CIG and ACL overlap each other when the CIS is starting zephyr will assert on negative time, so fit this special case. Signed-off-by: Lars Segerlund (cherry picked from commit fc813d9556a4e354256981f3e43aa3d3325f37b6) Signed-off-by: Vinayak Kariappa Chettimada --- subsys/bluetooth/controller/ll_sw/ull_conn_iso.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/subsys/bluetooth/controller/ll_sw/ull_conn_iso.c b/subsys/bluetooth/controller/ll_sw/ull_conn_iso.c index 2ce0d8c3649b..30dcb8419ad7 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_conn_iso.c +++ b/subsys/bluetooth/controller/ll_sw/ull_conn_iso.c @@ -979,6 +979,17 @@ void ull_conn_iso_start(struct ll_conn *conn, uint16_t cis_handle, lost_cig_events = 1U; cis_offset = cis->offset + iso_interval_us - acl_latency_us; } + /* Correct the cis_offset to next CIG event, if the ACL and CIG overlaps. + * ACL radio event at the instant was skipped and a relative CIS offset at + * the current ACL event has been calculated. But the current ACL event + * is partially overlapping with the other of CISes (not yet established) in + * the CIG event. Hence, lets establish the CIS at the next ISO interval so + * as to have a positive CIG event offset. + */ + if (cis_offset < (cig->sync_delay - cis->sync_delay)) { + cis_offset += iso_interval_us; + lost_cig_events++; + } cis->lll.event_count_prepare += lost_cig_events; From 760c3c6ff77dc95f48f668d446e25a619d91fbe0 Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Tue, 21 Oct 2025 22:14:18 +0200 Subject: [PATCH 1980/2141] [nrf fromtree] Bluetooth: Controller: Fix use-after-release in lll_scan/lll_scan_aux Fix use-after-release in lll_scan/lll_scan_aux when using mayfly_enqueue to defer execution of the offset calculation using ull_sched_mfy_after_cen_offset_get(). Apply suggestion from @Copilot Signed-off-by: Vinayak Kariappa Chettimada (cherry picked from commit 533ef581573a84098e45fd5d0f8cf3c90df9abe9) Signed-off-by: Vinayak Kariappa Chettimada --- subsys/bluetooth/controller/ll_sw/lll_scan.h | 8 ++++++++ .../controller/ll_sw/nordic/lll/lll_scan.c | 16 +++++++++++----- .../controller/ll_sw/nordic/lll/lll_scan_aux.c | 13 ++++++++++--- 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/subsys/bluetooth/controller/ll_sw/lll_scan.h b/subsys/bluetooth/controller/ll_sw/lll_scan.h index db0f08a182e1..b9633f899383 100644 --- a/subsys/bluetooth/controller/ll_sw/lll_scan.h +++ b/subsys/bluetooth/controller/ll_sw/lll_scan.h @@ -17,6 +17,14 @@ struct lll_scan { uint8_t adv_addr[BDADDR_SIZE]; uint32_t conn_win_offset_us; uint16_t conn_timeout; + +#if defined(CONFIG_BT_CTLR_SCHED_ADVANCED) + /* Stores prepare parameters for deferred mayfly execution. + * This prevents use-after-release issues by ensuring the parameters + * remain valid until execution. + */ + struct lll_prepare_param prepare_param; +#endif /* CONFIG_BT_CTLR_SCHED_ADVANCED */ #endif /* CONFIG_BT_CENTRAL */ uint8_t state:1; diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan.c index 7ae1f8bb6de2..5cfa63b3bcf5 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan.c @@ -509,13 +509,19 @@ static int common_prepare_cb(struct lll_prepare_param *p, bool is_resume) static memq_link_t link; static struct mayfly mfy_after_cen_offset_get = { 0U, 0U, &link, NULL, ull_sched_mfy_after_cen_offset_get}; - uint32_t retval; + struct lll_prepare_param *prepare_param; - mfy_after_cen_offset_get.param = p; + /* Copy the required values to calculate the offsets */ + prepare_param = &lll->prepare_param; + prepare_param->ticks_at_expire = p->ticks_at_expire; + prepare_param->remainder = p->remainder; + prepare_param->param = lll; - retval = mayfly_enqueue(TICKER_USER_ID_LLL, TICKER_USER_ID_ULL_LOW, 1U, - &mfy_after_cen_offset_get); - LL_ASSERT_ERR(!retval); + mfy_after_cen_offset_get.param = prepare_param; + + ret = mayfly_enqueue(TICKER_USER_ID_LLL, TICKER_USER_ID_ULL_LOW, 1U, + &mfy_after_cen_offset_get); + LL_ASSERT_ERR(!ret); } #endif /* CONFIG_BT_CENTRAL && CONFIG_BT_CTLR_SCHED_ADVANCED */ diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan_aux.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan_aux.c index 6665dc7390e2..8606a7913609 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan_aux.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan_aux.c @@ -607,12 +607,19 @@ static int prepare_cb(struct lll_prepare_param *p) static memq_link_t link; static struct mayfly mfy_after_cen_offset_get = { 0U, 0U, &link, NULL, ull_sched_mfy_after_cen_offset_get}; + struct lll_prepare_param *prepare_param; - /* NOTE: LLL scan instance passed, as done when + /* Copy the required values to calculate the offsets + * + * NOTE: LLL scan instance passed, as done when * establishing legacy connections. */ - p->param = lll; - mfy_after_cen_offset_get.param = p; + prepare_param = &lll->prepare_param; + prepare_param->ticks_at_expire = p->ticks_at_expire; + prepare_param->remainder = p->remainder; + prepare_param->param = lll; + + mfy_after_cen_offset_get.param = prepare_param; ret = mayfly_enqueue(TICKER_USER_ID_LLL, TICKER_USER_ID_ULL_LOW, 1U, &mfy_after_cen_offset_get); From 159c238b9c4b71e57c29e4df58260f51134248e3 Mon Sep 17 00:00:00 2001 From: Sergey Korotkov Date: Wed, 29 Oct 2025 09:59:22 +0100 Subject: [PATCH 1981/2141] Revert "[nrf noup] dts: Select SoftDevice Controller on nRF54L09" This reverts commit 0e41517dd8a9d1163a26c78935037c031a9b328b. Signed-off-by: Sergey Korotkov --- .../nrf54l09pdk/nrf54l09_cpuapp_common.dtsi | 128 ---- dts/arm/nordic/nrf54l09_enga_cpuapp.dtsi | 4 +- dts/vendor/nordic/nrf54l09.dtsi | 628 ------------------ 3 files changed, 2 insertions(+), 758 deletions(-) delete mode 100644 boards/nordic/nrf54l09pdk/nrf54l09_cpuapp_common.dtsi delete mode 100644 dts/vendor/nordic/nrf54l09.dtsi diff --git a/boards/nordic/nrf54l09pdk/nrf54l09_cpuapp_common.dtsi b/boards/nordic/nrf54l09pdk/nrf54l09_cpuapp_common.dtsi deleted file mode 100644 index e1347c35948c..000000000000 --- a/boards/nordic/nrf54l09pdk/nrf54l09_cpuapp_common.dtsi +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/* This file is common to the secure and non-secure domain */ - -#include -#include "nrf54l09pdk_nrf54l09-common.dtsi" - -/ { - chosen { - zephyr,console = &uart20; - zephyr,shell-uart = &uart20; - zephyr,uart-mcumgr = &uart20; - zephyr,bt-mon-uart = &uart20; - zephyr,bt-c2h-uart = &uart20; - zephyr,flash-controller = &rram_controller; - zephyr,flash = &cpuapp_rram; - zephyr,bt-hci = &bt_hci_sdc; - zephyr,ieee802154 = &ieee802154; - }; -}; - -&cpuapp_sram { - status = "okay"; -}; - -&hfpll { - /* For now use 64 MHz clock for CPU and fast peripherals. */ - clock-frequency = ; -}; - -&lfxo { - load-capacitors = "internal"; - load-capacitance-femtofarad = <15500>; -}; - -&hfxo { - load-capacitors = "internal"; - load-capacitance-femtofarad = <15000>; -}; - -&grtc { - owned-channels = <0 1 2 3 4 5 6 7 8 9 10 11>; - /* Channels 7-11 reserved for Zero Latency IRQs, 3-4 for FLPR */ - child-owned-channels = <3 4 7 8 9 10 11>; - status = "okay"; -}; - -&cpuapp_rram { - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - boot_partition: partition@0 { - label = "mcuboot"; - reg = <0x0 DT_SIZE_K(64)>; - }; - - slot0_partition: partition@10000 { - label = "image-0"; - reg = <0x10000 DT_SIZE_K(212)>; - }; - - slot0_ns_partition: partition@45000 { - label = "image-0-nonsecure"; - reg = <0x45000 DT_SIZE_K(212)>; - }; - - slot1_partition: partition@7a000 { - label = "image-1"; - reg = <0x7a000 DT_SIZE_K(212)>; - }; - - slot1_ns_partition: partition@af000 { - label = "image-1-nonsecure"; - reg = <0xaf000 DT_SIZE_K(212)>; - }; - - storage_partition: partition@e4000 { - label = "storage"; - reg = <0xe4000 DT_SIZE_K(36)>; - }; - }; -}; - -&uart20 { - status = "okay"; -}; - -&gpio0 { - status = "okay"; -}; - -&gpio1 { - status = "okay"; -}; - -&gpiote20 { - status = "okay"; -}; - -&gpiote30 { - status = "okay"; -}; - -&radio { - status = "okay"; -}; - -&temp { - status = "okay"; -}; - -&clock { - status = "okay"; -}; - -&bt_hci_sdc { - status = "okay"; -}; - -&ieee802154 { - status = "okay"; -}; diff --git a/dts/arm/nordic/nrf54l09_enga_cpuapp.dtsi b/dts/arm/nordic/nrf54l09_enga_cpuapp.dtsi index 6c7f34d3b21e..1dfc5ce133c0 100644 --- a/dts/arm/nordic/nrf54l09_enga_cpuapp.dtsi +++ b/dts/arm/nordic/nrf54l09_enga_cpuapp.dtsi @@ -17,7 +17,7 @@ nvic: &cpuapp_nvic {}; / { chosen { - zephyr,bt-hci = &bt_hci_sdc; + zephyr,bt-hci = &bt_hci_controller; zephyr,entropy = &prng; }; @@ -38,7 +38,7 @@ nvic: &cpuapp_nvic {}; }; }; -&bt_hci_sdc { +&bt_hci_controller { status = "okay"; }; diff --git a/dts/vendor/nordic/nrf54l09.dtsi b/dts/vendor/nordic/nrf54l09.dtsi deleted file mode 100644 index 90ecc49b877c..000000000000 --- a/dts/vendor/nordic/nrf54l09.dtsi +++ /dev/null @@ -1,628 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include -#include - -/delete-node/ &sw_pwm; - -/* Domain IDs. Can be used to specify channel links in IPCT nodes. */ -#define NRF_DOMAIN_ID_APPLICATION 0 -#define NRF_DOMAIN_ID_FLPR 1 - -/ { - #address-cells = <1>; - #size-cells = <1>; - - cpus { - #address-cells = <1>; - #size-cells = <0>; - - cpuapp: cpu@0 { - compatible = "arm,cortex-m33f"; - reg = <0>; - device_type = "cpu"; - clocks = <&hfpll>; - #address-cells = <1>; - #size-cells = <1>; - - itm: itm@e0000000 { - compatible = "arm,armv8m-itm"; - reg = <0xe0000000 0x1000>; - swo-ref-frequency = ; - }; - }; - - cpuflpr: cpu@1 { - compatible = "nordic,vpr"; - reg = <1>; - device_type = "cpu"; - clock-frequency = ; - riscv,isa = "rv32emc"; - nordic,bus-width = <32>; - }; - }; - - clocks { - pclk: pclk { - compatible = "fixed-clock"; - #clock-cells = <0>; - clock-frequency = ; - }; - - lfxo: lfxo { - compatible = "nordic,nrf54l-lfxo"; - #clock-cells = <0>; - clock-frequency = <32768>; - }; - - hfxo: hfxo { - compatible = "nordic,nrf54l-hfxo"; - #clock-cells = <0>; - clock-frequency = ; - startup-time-us = <1650>; - }; - - hfpll: hfpll { - compatible = "fixed-clock"; - #clock-cells = <0>; - clock-frequency = ; - }; - }; - - soc { - #address-cells = <1>; - #size-cells = <1>; - - #ifdef USE_NON_SECURE_ADDRESS_MAP - /* intentionally empty because UICR is hardware fixed to Secure */ - #else - uicr: uicr@ffd000 { - compatible = "nordic,nrf-uicr"; - reg = <0xffd000 0x1000>; - }; - #endif - ficr: ficr@ffc000 { - compatible = "nordic,nrf-ficr"; - reg = <0xffc000 0x1000>; - #nordic,ficr-cells = <1>; - }; - - cpuapp_sram: memory@20000000 { - reg = <0x20000000 DT_SIZE_K(143)>; - ranges = <0x0 0x20000000 DT_SIZE_K(143)>; - compatible = "mmio-sram"; - #address-cells = <1>; - #size-cells = <1>; - }; - - cpuflpr_sram: memory@20023c00 { - compatible = "mmio-sram"; - reg = <0x20023c00 DT_SIZE_K(48)>; - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x20023c00 DT_SIZE_K(48)>; - }; - - #ifdef USE_NON_SECURE_ADDRESS_MAP - global_peripherals: peripheral@40000000 { - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x40000000 0x10000000>; - #else - global_peripherals: peripheral@50000000 { - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x50000000 0x10000000>; - #endif - - dppic00: dppic@42000 { - compatible = "nordic,nrf-dppic"; - reg = <0x42000 0x808>; - status = "disabled"; - }; - - ppib00: ppib@44000 { - compatible = "nordic,nrf-ppib"; - reg = <0x44000 0x1000>; - status = "disabled"; - }; - - ppib01: ppib@45000 { - compatible = "nordic,nrf-ppib"; - reg = <0x45000 0x1000>; - status = "disabled"; - }; - - cpuflpr_vpr: vpr@4c000 { - compatible = "nordic,nrf-vpr-coprocessor"; - reg = <0x4c000 0x1000>; - ranges = <0x0 0x4c000 0x1000>; - #address-cells = <1>; - #size-cells = <1>; - status = "disabled"; - enable-secure; - - cpuflpr_clic: interrupt-controller@f0000000 { - compatible = "nordic,nrf-clic"; - reg = <0xf0000000 0x1780>; - interrupt-controller; - #interrupt-cells = <2>; - #address-cells = <1>; - status = "disabled"; - }; - }; - - timer00: timer@55000 { - compatible = "nordic,nrf-timer"; - status = "disabled"; - reg = <0x55000 0x1000>; - cc-num = <6>; - max-bit-width = <32>; - interrupts = <85 NRF_DEFAULT_IRQ_PRIORITY>; - clocks = <&hfpll>; - prescaler = <0>; - }; - - dppic10: dppic@82000 { - compatible = "nordic,nrf-dppic"; - reg = <0x82000 0x808>; - status = "disabled"; - }; - - ppib10: ppib@83000 { - compatible = "nordic,nrf-ppib"; - reg = <0x83000 0x1000>; - status = "disabled"; - }; - - ppib11: ppib@84000 { - compatible = "nordic,nrf-ppib"; - reg = <0x84000 0x1000>; - status = "disabled"; - }; - - timer10: timer@85000 { - compatible = "nordic,nrf-timer"; - status = "disabled"; - reg = <0x85000 0x1000>; - cc-num = <8>; - max-bit-width = <32>; - interrupts = <133 NRF_DEFAULT_IRQ_PRIORITY>; - clocks = <&hfxo>; - prescaler = <0>; - }; - - egu10: egu@87000 { - compatible = "nordic,nrf-egu"; - reg = <0x87000 0x1000>; - interrupts = <135 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - }; - - radio: radio@8a000 { - compatible = "nordic,nrf-radio"; - reg = <0x8a000 0x1000>; - interrupts = <138 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - dfe-supported; - ieee802154-supported; - ble-2mbps-supported; - ble-coded-phy-supported; - cs-supported; - - ieee802154: ieee802154 { - compatible = "nordic,nrf-ieee802154"; - status = "disabled"; - }; - - bt_hci_sdc: bt_hci_sdc { - compatible = "nordic,bt-hci-sdc"; - status = "disabled"; - }; - - bt_hci_controller: bt_hci_controller { - compatible = "zephyr,bt-hci-ll-sw-split"; - status = "disabled"; - }; - }; - - dppic20: dppic@c2000 { - compatible = "nordic,nrf-dppic"; - reg = <0xc2000 0x808>; - status = "disabled"; - }; - - ppib20: ppib@c3000 { - compatible = "nordic,nrf-ppib"; - reg = <0xc3000 0x1000>; - status = "disabled"; - }; - - ppib21: ppib@c4000 { - compatible = "nordic,nrf-ppib"; - reg = <0xc4000 0x1000>; - status = "disabled"; - }; - - ppib22: ppib@c5000 { - compatible = "nordic,nrf-ppib"; - reg = <0xc5000 0x1000>; - status = "disabled"; - }; - - i2c20: i2c@c6000 { - compatible = "nordic,nrf-twim"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0xc6000 0x1000>; - interrupts = <198 NRF_DEFAULT_IRQ_PRIORITY>; - easydma-maxcnt-bits = <16>; - status = "disabled"; - zephyr,pm-device-runtime-auto; - }; - - spi20: spi@c6000 { - /* - * This spi node can be either SPIM or SPIS, - * for the user to pick: - * compatible = "nordic,nrf-spim" or - * "nordic,nrf-spis". - */ - compatible = "nordic,nrf-spim"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0xc6000 0x1000>; - interrupts = <198 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - easydma-maxcnt-bits = <16>; - rx-delay-supported; - rx-delay = <1>; - status = "disabled"; - }; - - uart20: uart@c6000 { - compatible = "nordic,nrf-uarte"; - reg = <0xc6000 0x1000>; - interrupts = <198 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - endtx-stoptx-supported; - frame-timeout-supported; - }; - - i2c21: i2c@c7000 { - compatible = "nordic,nrf-twim"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0xc7000 0x1000>; - interrupts = <199 NRF_DEFAULT_IRQ_PRIORITY>; - easydma-maxcnt-bits = <16>; - status = "disabled"; - zephyr,pm-device-runtime-auto; - }; - - spi21: spi@c7000 { - /* - * This spi node can be either SPIM or SPIS, - * for the user to pick: - * compatible = "nordic,nrf-spim" or - * "nordic,nrf-spis". - */ - compatible = "nordic,nrf-spim"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0xc7000 0x1000>; - interrupts = <199 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - easydma-maxcnt-bits = <16>; - rx-delay-supported; - rx-delay = <1>; - status = "disabled"; - }; - - uart21: uart@c7000 { - compatible = "nordic,nrf-uarte"; - reg = <0xc7000 0x1000>; - interrupts = <199 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - endtx-stoptx-supported; - frame-timeout-supported; - }; - - egu20: egu@c9000 { - compatible = "nordic,nrf-egu"; - reg = <0xc9000 0x1000>; - interrupts = <201 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - }; - - timer20: timer@ca000 { - compatible = "nordic,nrf-timer"; - status = "disabled"; - reg = <0xca000 0x1000>; - cc-num = <6>; - max-bit-width = <32>; - interrupts = <202 NRF_DEFAULT_IRQ_PRIORITY>; - prescaler = <0>; - }; - - timer21: timer@cb000 { - compatible = "nordic,nrf-timer"; - status = "disabled"; - reg = <0xcb000 0x1000>; - cc-num = <6>; - max-bit-width = <32>; - interrupts = <203 NRF_DEFAULT_IRQ_PRIORITY>; - prescaler = <0>; - }; - - timer22: timer@cc000 { - compatible = "nordic,nrf-timer"; - status = "disabled"; - reg = <0xcc000 0x1000>; - cc-num = <6>; - max-bit-width = <32>; - interrupts = <204 NRF_DEFAULT_IRQ_PRIORITY>; - prescaler = <0>; - }; - - timer23: timer@cd000 { - compatible = "nordic,nrf-timer"; - status = "disabled"; - reg = <0xcd000 0x1000>; - cc-num = <6>; - max-bit-width = <32>; - interrupts = <205 NRF_DEFAULT_IRQ_PRIORITY>; - prescaler = <0>; - }; - - timer24: timer@ce000 { - compatible = "nordic,nrf-timer"; - status = "disabled"; - reg = <0xce000 0x1000>; - cc-num = <6>; - max-bit-width = <32>; - interrupts = <206 NRF_DEFAULT_IRQ_PRIORITY>; - prescaler = <0>; - }; - - adc: adc@d5000 { - compatible = "nordic,nrf-saadc"; - reg = <0xd5000 0x1000>; - interrupts = <213 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - #io-channel-cells = <1>; - zephyr,pm-device-runtime-auto; - }; - - temp: temp@d7000 { - compatible = "nordic,nrf-temp"; - reg = <0xd7000 0x1000>; - interrupts = <215 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - }; - - gpio1: gpio@d8200 { - compatible = "nordic,nrf-gpio"; - gpio-controller; - reg = <0xd8200 0x300>; - #gpio-cells = <2>; - ngpios = <16>; - status = "disabled"; - port = <1>; - gpiote-instance = <&gpiote20>; - }; - - gpiote20: gpiote@da000 { - compatible = "nordic,nrf-gpiote"; - reg = <0xda000 0x1000>; - status = "disabled"; - instance = <20>; - }; - - grtc: grtc@e2000 { - compatible = "nordic,nrf-grtc"; - reg = <0xe2000 0x1000>; - cc-num = <12>; - clocks = <&lfxo>, <&pclk>; - clock-names = "lfclock", "hfclock"; - status = "disabled"; - }; - - dppic30: dppic@102000 { - compatible = "nordic,nrf-dppic"; - reg = <0x102000 0x808>; - status = "disabled"; - }; - - ppib30: ppib@103000 { - compatible = "nordic,nrf-ppib"; - reg = <0x103000 0x1000>; - status = "disabled"; - }; - - i2c30: i2c@104000 { - compatible = "nordic,nrf-twim"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0x104000 0x1000>; - interrupts = <260 NRF_DEFAULT_IRQ_PRIORITY>; - easydma-maxcnt-bits = <16>; - status = "disabled"; - zephyr,pm-device-runtime-auto; - }; - - spi30: spi@104000 { - /* - * This spi node can be either SPIM or SPIS, - * for the user to pick: - * compatible = "nordic,nrf-spim" or - * "nordic,nrf-spis". - */ - compatible = "nordic,nrf-spim"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0x104000 0x1000>; - interrupts = <260 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - easydma-maxcnt-bits = <16>; - rx-delay-supported; - rx-delay = <1>; - status = "disabled"; - }; - - uart30: uart@104000 { - compatible = "nordic,nrf-uarte"; - reg = <0x104000 0x1000>; - interrupts = <260 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - endtx-stoptx-supported; - frame-timeout-supported; - }; - - clock: clock@10e000 { - compatible = "nordic,nrf-clock"; - reg = <0x10e000 0x1000>; - interrupts = <270 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - }; - - power: power@10e000 { - compatible = "nordic,nrf-power"; - reg = <0x10e000 0x1000>; - ranges = <0x0 0x10e000 0x1000>; - interrupts = <270 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - #address-cells = <1>; - #size-cells = <1>; - - gpregret1: gpregret1@51c { - #address-cells = <1>; - #size-cells = <1>; - compatible = "nordic,nrf-gpregret"; - reg = <0x51c 0x1>; - status = "disabled"; - }; - - gpregret2: gpregret2@520 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "nordic,nrf-gpregret"; - reg = <0x520 0x1>; - status = "disabled"; - }; - }; - - comp: comparator@106000 { - /* - * Use compatible "nordic,nrf-comp" to configure as COMP - * Use compatible "nordic,nrf-lpcomp" to configure as LPCOMP - */ - compatible = "nordic,nrf-comp"; - reg = <0x106000 0x1000>; - status = "disabled"; - interrupts = <262 NRF_DEFAULT_IRQ_PRIORITY>; - }; - - #ifdef USE_NON_SECURE_ADDRESS_MAP - /* intentionally empty because WDT30 is hardware fixed to Secure */ - #else - wdt30: watchdog@108000 { - compatible = "nordic,nrf-wdt"; - reg = <0x108000 0x620>; - interrupts = <264 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - }; - #endif - - wdt31: watchdog@109000 { - compatible = "nordic,nrf-wdt"; - reg = <0x109000 0x620>; - interrupts = <265 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - }; - - gpio0: gpio@10a000 { - compatible = "nordic,nrf-gpio"; - gpio-controller; - reg = <0x10a000 0x300>; - #gpio-cells = <2>; - ngpios = <5>; - status = "disabled"; - port = <0>; - gpiote-instance = <&gpiote30>; - }; - - gpiote30: gpiote@10c000 { - compatible = "nordic,nrf-gpiote"; - reg = <0x10c000 0x1000>; - status = "disabled"; - instance = <30>; - }; - - regulators: regulator@120000 { - compatible = "nordic,nrf54l-regulators"; - reg = <0x120000 0x1000>; - status = "disabled"; - #address-cells = <1>; - #size-cells = <1>; - - vregmain: regulator@120600 { - compatible = "nordic,nrf5x-regulator"; - reg = <0x120600 0x1>; - status = "disabled"; - regulator-name = "VREGMAIN"; - regulator-initial-mode = ; - }; - }; - }; - - rram_controller: rram-controller@5004e000 { - compatible = "nordic,rram-controller"; - reg = <0x5004e000 0x1000>; - #address-cells = <1>; - #size-cells = <1>; - interrupts = <75 NRF_DEFAULT_IRQ_PRIORITY>; - - /* 952 + 60 = 1012KB */ - cpuapp_rram: rram@0 { - compatible = "soc-nv-flash"; - erase-block-size = <4096>; - write-block-size = <16>; - reg = <0x0 DT_SIZE_K(952)>; - }; - - cpuflpr_rram: rram@ee000 { - compatible = "soc-nv-flash"; - reg = <0xee000 DT_SIZE_K(60)>; - erase-block-size = <4096>; - write-block-size = <16>; - }; - }; - - cpuapp_ppb: cpuapp-ppb-bus { - #address-cells = <1>; - #size-cells = <1>; - - cpuapp_nvic: interrupt-controller@e000e100 { - #address-cells = <1>; - compatible = "arm,v8m-nvic"; - reg = <0xe000e100 0xc00>; - arm,num-irq-priority-bits = <3>; - interrupt-controller; - #interrupt-cells = <2>; - }; - - cpuapp_systick: timer@e000e010 { - compatible = "arm,armv8m-systick"; - reg = <0xe000e010 0x10>; - status = "disabled"; - }; - }; - }; -}; From 980495663735d03d791ff659e254dcc6a299dee0 Mon Sep 17 00:00:00 2001 From: Sergey Korotkov Date: Wed, 29 Oct 2025 09:59:38 +0100 Subject: [PATCH 1982/2141] Revert "[nrf noup] entropy: Add fake entropy nRF PRNG driver" This reverts commit 6e1d27409e8f5e84021bf339da95672f12000099. Signed-off-by: Sergey Korotkov --- dts/arm/nordic/nrf54l09_enga_cpuapp.dtsi | 142 ----------------------- 1 file changed, 142 deletions(-) delete mode 100644 dts/arm/nordic/nrf54l09_enga_cpuapp.dtsi diff --git a/dts/arm/nordic/nrf54l09_enga_cpuapp.dtsi b/dts/arm/nordic/nrf54l09_enga_cpuapp.dtsi deleted file mode 100644 index 1dfc5ce133c0..000000000000 --- a/dts/arm/nordic/nrf54l09_enga_cpuapp.dtsi +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include - -cpu: &cpuapp {}; -systick: &cpuapp_systick {}; -nvic: &cpuapp_nvic {}; - -/delete-node/ &cpuflpr; -/delete-node/ &cpuflpr_rram; -/delete-node/ &cpuflpr_sram; -/delete-node/ &cpuflpr_clic; - -/ { - chosen { - zephyr,bt-hci = &bt_hci_controller; - zephyr,entropy = &prng; - }; - - soc { - compatible = "simple-bus"; - interrupt-parent = <&cpuapp_nvic>; - ranges; - }; - - psa_rng: psa-rng { - compatible = "zephyr,psa-crypto-rng"; - status = "disabled"; - }; - - prng: prng { - compatible = "nordic,entropy-prng"; - status = "okay"; - }; -}; - -&bt_hci_controller { - status = "okay"; -}; - -&cpuflpr_vpr { - cpuapp_vevif_rx: mailbox@1 { - compatible = "nordic,nrf-vevif-event-rx"; - reg = <0x1 0x1000>; - status = "disabled"; - interrupts = <76 NRF_DEFAULT_IRQ_PRIORITY>; - #mbox-cells = <1>; - nordic,events = <1>; - nordic,events-mask = <0x00100000>; - }; - - cpuapp_vevif_tx: mailbox@0 { - compatible = "nordic,nrf-vevif-task-tx"; - reg = <0x0 0x1000>; - #mbox-cells = <1>; - nordic,tasks = <7>; - nordic,tasks-mask = <0x007f0000>; - status = "disabled"; - }; -}; - -&cpuapp_ppb { - compatible = "simple-bus"; - ranges; -}; - -&grtc { -#ifdef USE_NON_SECURE_ADDRESS_MAP - interrupts = <227 NRF_DEFAULT_IRQ_PRIORITY>, -#else - interrupts = <228 NRF_DEFAULT_IRQ_PRIORITY>, -#endif - <229 NRF_DEFAULT_IRQ_PRIORITY>; /* reserved for Zero Latency IRQs */ -}; - -&gpiote20 { -#ifdef USE_NON_SECURE_ADDRESS_MAP - interrupts = <218 NRF_DEFAULT_IRQ_PRIORITY>; -#else - interrupts = <219 NRF_DEFAULT_IRQ_PRIORITY>; -#endif -}; - -&gpiote30 { -#ifdef USE_NON_SECURE_ADDRESS_MAP - interrupts = <268 NRF_DEFAULT_IRQ_PRIORITY>; -#else - interrupts = <269 NRF_DEFAULT_IRQ_PRIORITY>; -#endif -}; - -&dppic00 { - status = "okay"; -}; - -&dppic10 { - status = "okay"; -}; - -&dppic20 { - status = "okay"; -}; - -&dppic30 { - status = "okay"; -}; - -&ppib00 { - status = "okay"; -}; - -&ppib01 { - status = "okay"; -}; - -&ppib10 { - status = "okay"; -}; - -&ppib11 { - status = "okay"; -}; - -&ppib20 { - status = "okay"; -}; - -&ppib21 { - status = "okay"; -}; - -&ppib22 { - status = "okay"; -}; - -&ppib30 { - status = "okay"; -}; From be5d7776dbb783b400dd92c6575c8f15f630b483 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dag=20Erik=20Gj=C3=B8rvad?= Date: Thu, 7 Aug 2025 12:50:50 +0200 Subject: [PATCH 1983/2141] [nrf fromtree] boards: nordic: Add initial support for nRF54LM20A/ns MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add board files for nRF54LM20A/ns. Update existing nRF54LM20A board files to support this. Signed-off-by: Dag Erik Gjørvad (cherry picked from commit de402cb465e96a879816f613bbf686c747088026) --- boards/nordic/nrf54lm20dk/Kconfig | 28 ++++++++ boards/nordic/nrf54lm20dk/Kconfig.defconfig | 9 +++ boards/nordic/nrf54lm20dk/Kconfig.nrf54lm20dk | 2 +- boards/nordic/nrf54lm20dk/board.cmake | 8 +++ boards/nordic/nrf54lm20dk/board.yml | 5 ++ .../nrf54lm20dk/nrf54lm20a_cpuapp_common.dtsi | 38 ----------- .../nrf54lm20dk_nrf54lm20a_cpuapp.dts | 1 + .../nrf54lm20dk_nrf54lm20a_cpuapp_ns.dts | 68 +++++++++++++++++++ .../nrf54lm20dk_nrf54lm20a_cpuapp_ns.yaml | 22 ++++++ ...nrf54lm20dk_nrf54lm20a_cpuapp_ns_defconfig | 45 ++++++++++++ dts/arm/nordic/nrf54lm20a_enga_cpuapp.dtsi | 4 ++ dts/vendor/nordic/nrf54lm20a.dtsi | 25 +++++++ .../nordic/nrf54lm20a_ns_partition.dtsi | 62 +++++++++++++++++ dts/vendor/nordic/nrf54lm20a_partition.dtsi | 37 ++++++++++ modules/trusted-firmware-m/Kconfig.tfm | 1 + .../nordic/nrf54lm20a_cpuapp/CMakeLists.txt | 23 +++++++ .../nordic/nrf54lm20a_cpuapp/config.cmake | 9 +++ .../nordic/nrf54lm20a_cpuapp/cpuarch.cmake | 9 +++ .../nrf54lm20a_cpuapp/ns/cpuarch_ns.cmake | 10 +++ samples/drivers/watchdog/sample.yaml | 1 + .../tfm_integration/config_build/sample.yaml | 1 + samples/tfm_integration/tfm_ipc/sample.yaml | 1 + tests/drivers/adc/adc_api/testcase.yaml | 1 + .../watchdog/wdt_basic_api/testcase.yaml | 1 + tests/subsys/settings/its/testcase.yaml | 1 + 25 files changed, 373 insertions(+), 39 deletions(-) create mode 100644 boards/nordic/nrf54lm20dk/Kconfig create mode 100644 boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp_ns.dts create mode 100644 boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp_ns.yaml create mode 100644 boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp_ns_defconfig create mode 100644 dts/vendor/nordic/nrf54lm20a_ns_partition.dtsi create mode 100644 dts/vendor/nordic/nrf54lm20a_partition.dtsi create mode 100644 modules/trusted-firmware-m/nordic/nrf54lm20a_cpuapp/CMakeLists.txt create mode 100644 modules/trusted-firmware-m/nordic/nrf54lm20a_cpuapp/config.cmake create mode 100644 modules/trusted-firmware-m/nordic/nrf54lm20a_cpuapp/cpuarch.cmake create mode 100644 modules/trusted-firmware-m/nordic/nrf54lm20a_cpuapp/ns/cpuarch_ns.cmake diff --git a/boards/nordic/nrf54lm20dk/Kconfig b/boards/nordic/nrf54lm20dk/Kconfig new file mode 100644 index 000000000000..0b1905a0d8ef --- /dev/null +++ b/boards/nordic/nrf54lm20dk/Kconfig @@ -0,0 +1,28 @@ +# Copyright (c) 2025 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +DT_NRF_MPC := $(dt_nodelabel_path,nrf_mpc) + +if BOARD_NRF54LM20DK_NRF54LM20A_CPUAPP_NS + +config NRF_TRUSTZONE_FLASH_REGION_SIZE + hex + default $(dt_node_int_prop_hex,$(DT_NRF_MPC),override-granularity) + help + This defines the flash region size from the TrustZone perspective. + It is used when configuring the TrustZone and when setting alignments + requirements for the partitions. + This abstraction allows us to configure TrustZone without depending + on peripheral-specific symbols. + +config NRF_TRUSTZONE_RAM_REGION_SIZE + hex + default $(dt_node_int_prop_hex,$(DT_NRF_MPC),override-granularity) + help + This defines the RAM region size from the TrustZone perspective. + It is used when configuring the TrustZone and when setting alignments + requirements for the partitions. + This abstraction allows us to configure TrustZone without depending + on peripheral specific symbols. + +endif # BOARD_NRF54LM20DK_NRF54LM20A_CPUAPP_NS diff --git a/boards/nordic/nrf54lm20dk/Kconfig.defconfig b/boards/nordic/nrf54lm20dk/Kconfig.defconfig index 67410cd4d653..c77e844b822c 100644 --- a/boards/nordic/nrf54lm20dk/Kconfig.defconfig +++ b/boards/nordic/nrf54lm20dk/Kconfig.defconfig @@ -7,3 +7,12 @@ config HW_STACK_PROTECTION default ARCH_HAS_STACK_PROTECTION endif # BOARD_NRF54LM20DK_NRF54LM20A_CPUAPP + +if BOARD_NRF54LM20DK_NRF54LM20A_CPUAPP_NS + +# By default, if we build for a Non-Secure version of the board, +# enable building with TF-M as the Secure Execution Environment. +config BUILD_WITH_TFM + default y + +endif # BOARD_NRF54LM20DK_NRF54LM20A_CPUAPP_NS diff --git a/boards/nordic/nrf54lm20dk/Kconfig.nrf54lm20dk b/boards/nordic/nrf54lm20dk/Kconfig.nrf54lm20dk index 83b3842211f3..b311fd9ae87e 100644 --- a/boards/nordic/nrf54lm20dk/Kconfig.nrf54lm20dk +++ b/boards/nordic/nrf54lm20dk/Kconfig.nrf54lm20dk @@ -2,5 +2,5 @@ # SPDX-License-Identifier: Apache-2.0 config BOARD_NRF54LM20DK - select SOC_NRF54LM20A_ENGA_CPUAPP if BOARD_NRF54LM20DK_NRF54LM20A_CPUAPP + select SOC_NRF54LM20A_ENGA_CPUAPP if BOARD_NRF54LM20DK_NRF54LM20A_CPUAPP || BOARD_NRF54LM20DK_NRF54LM20A_CPUAPP_NS select SOC_NRF54LM20A_ENGA_CPUFLPR if BOARD_NRF54LM20DK_NRF54LM20A_CPUFLPR diff --git a/boards/nordic/nrf54lm20dk/board.cmake b/boards/nordic/nrf54lm20dk/board.cmake index e487ecfb476f..6aaf6196d572 100644 --- a/boards/nordic/nrf54lm20dk/board.cmake +++ b/boards/nordic/nrf54lm20dk/board.cmake @@ -7,5 +7,13 @@ elseif(CONFIG_SOC_NRF54LM20A_ENGA_CPUFLPR) board_runner_args(jlink "--speed=4000") endif() +if(CONFIG_BOARD_NRF54LM20DK_NRF54LM20A_CPUAPP_NS) + set(TFM_PUBLIC_KEY_FORMAT "full") +endif() + +if(CONFIG_TFM_FLASH_MERGED_BINARY) + set_property(TARGET runners_yaml_props_target PROPERTY hex_file tfm_merged.hex) +endif() + include(${ZEPHYR_BASE}/boards/common/nrfutil.board.cmake) include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) diff --git a/boards/nordic/nrf54lm20dk/board.yml b/boards/nordic/nrf54lm20dk/board.yml index 2930f9d3dfbd..86decbf7c7cd 100644 --- a/boards/nordic/nrf54lm20dk/board.yml +++ b/boards/nordic/nrf54lm20dk/board.yml @@ -5,6 +5,8 @@ board: socs: - name: nrf54lm20a variants: + - name: ns + cpucluster: cpuapp - name: xip cpucluster: cpuflpr runners: @@ -17,6 +19,7 @@ runners: groups: - boards: - nrf54lm20dk/nrf54lm20a/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp/ns - nrf54lm20dk/nrf54lm20a/cpuflpr - nrf54lm20dk/nrf54lm20a/cpuflpr/xip '--erase': @@ -28,6 +31,7 @@ runners: groups: - boards: - nrf54lm20dk/nrf54lm20a/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp/ns - nrf54lm20dk/nrf54lm20a/cpuflpr - nrf54lm20dk/nrf54lm20a/cpuflpr/xip '--reset': @@ -39,5 +43,6 @@ runners: groups: - boards: - nrf54lm20dk/nrf54lm20a/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp/ns - nrf54lm20dk/nrf54lm20a/cpuflpr - nrf54lm20dk/nrf54lm20a/cpuflpr/xip diff --git a/boards/nordic/nrf54lm20dk/nrf54lm20a_cpuapp_common.dtsi b/boards/nordic/nrf54lm20dk/nrf54lm20a_cpuapp_common.dtsi index 18a3e79a2936..5b4599cc94e0 100644 --- a/boards/nordic/nrf54lm20dk/nrf54lm20a_cpuapp_common.dtsi +++ b/boards/nordic/nrf54lm20dk/nrf54lm20a_cpuapp_common.dtsi @@ -57,44 +57,6 @@ status = "okay"; }; -&cpuapp_rram { - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - boot_partition: partition@0 { - label = "mcuboot"; - reg = <0x0 DT_SIZE_K(64)>; - }; - - slot0_partition: partition@10000 { - label = "image-0"; - reg = <0x10000 DT_SIZE_K(449)>; - }; - - slot0_ns_partition: partition@80400 { - label = "image-0-nonsecure"; - reg = <0x80400 DT_SIZE_K(449)>; - }; - - slot1_partition: partition@f0800 { - label = "image-1"; - reg = <0xf0800 DT_SIZE_K(449)>; - }; - - slot1_ns_partition: partition@160c00 { - label = "image-1-nonsecure"; - reg = <0x160c00 DT_SIZE_K(449)>; - }; - - storage_partition: partition@1d1000 { - label = "storage"; - reg = <0x1d1000 DT_SIZE_K(36)>; - }; - }; -}; - &uart20 { status = "okay"; }; diff --git a/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp.dts b/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp.dts index 727729600c2c..0496f3ca90cf 100644 --- a/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp.dts +++ b/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp.dts @@ -7,6 +7,7 @@ /dts-v1/; #include "nrf54lm20a_cpuapp_common.dtsi" +#include / { compatible = "nordic,nrf54lm20dk_nrf54lm20a-cpuapp"; diff --git a/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp_ns.dts b/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp_ns.dts new file mode 100644 index 000000000000..04cb9d04a60c --- /dev/null +++ b/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp_ns.dts @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#define USE_NON_SECURE_ADDRESS_MAP 1 + +#include "nrf54lm20a_cpuapp_common.dtsi" + +/ { + compatible = "nordic,nrf54lm20dk_nrf54lm20a-cpuapp-ns"; + model = "Nordic nRF54LM20 DK nRF54LM20A Application MCU Non-Secure"; + + chosen { + zephyr,code-partition = &slot0_ns_partition; + zephyr,sram = &sram0_ns; + zephyr,entropy = &psa_rng; + }; + + /delete-node/ rng; + + psa_rng: psa-rng { + status = "okay"; + }; +}; + +/ { + /* + * Default SRAM planning when building for nRF54LM20A with ARM TrustZone-M support + * - Lowest 208 kB SRAM allocated to Secure image (sram0_s). + * - Upper 208 kB SRAM allocated to Non-Secure image (sram0_ns). + * + * nRF54LM20A has 512 kB of volatile memory (SRAM), but 96kB is allocated for the FLPR MCU. + * This static layout needs to be the same with the upstream TF-M layout in the + * header flash_layout.h of the relevant platform. Any updates in the layout + * needs to happen both in the flash_layout.h and in this file at the same time. + */ + reserved-memory { + #address-cells = <1>; + #size-cells = <1>; + ranges; + + sram0_s: image_s@20000000 { + /* Secure image memory */ + reg = <0x20000000 DT_SIZE_K(208)>; + }; + + sram0_ns: image_ns@20034000 { + /* Non-Secure image memory */ + reg = <0x20034000 DT_SIZE_K(208)>; + }; + }; +}; + +&bt_hci_controller { + status = "disabled"; +}; + +&uart30 { + /* Disable so that TF-M can use this UART */ + status = "disabled"; +}; + +/* Include default memory partition configuration file */ +#include diff --git a/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp_ns.yaml b/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp_ns.yaml new file mode 100644 index 000000000000..3f10201892fb --- /dev/null +++ b/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp_ns.yaml @@ -0,0 +1,22 @@ +identifier: nrf54lm20dk/nrf54lm20a/cpuapp/ns +name: nRF54lm20-DK-nRF54lm20a-Application-Non-Secure +type: mcu +arch: arm +toolchain: + - gnuarmemb + - zephyr +ram: 208 +flash: 1356 +supported: + - adc + - counter + - dmic + - gpio + - i2c + - i2s + - pwm + - spi + - usbd + - watchdog +vendor: nordic +sysbuild: true diff --git a/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp_ns_defconfig b/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp_ns_defconfig new file mode 100644 index 000000000000..d360ef89bac4 --- /dev/null +++ b/boards/nordic/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp_ns_defconfig @@ -0,0 +1,45 @@ +# Copyright (c) 2025 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +# Enable MPU +CONFIG_ARM_MPU=y +CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y + +# Enable TrustZone-M +CONFIG_ARM_TRUSTZONE_M=y + +# This Board implies building Non-Secure firmware +CONFIG_TRUSTED_EXECUTION_NONSECURE=y + +# Use devicetree code partition for TF-M +CONFIG_USE_DT_CODE_PARTITION=y + +# Enable UART driver +CONFIG_SERIAL=y + +# Enable console +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y + +# Enable GPIO +CONFIG_GPIO=y + +# Don't enable the cache in the non-secure image as it is a +# secure-only peripheral on 54l +CONFIG_CACHE_MANAGEMENT=n +CONFIG_EXTERNAL_CACHE=n + +# Start SYSCOUNTER on driver init +CONFIG_NRF_GRTC_START_SYSCOUNTER=y + +# Disable TFM BL2 since it is not supported +CONFIG_TFM_BL2=n +# Support for silence logging is not supported at the moment +# Tracked by: NCSDK-31930 +CONFIG_TFM_LOG_LEVEL_SILENCE=n + +# The oscillators are configured as secure and cannot be configured +# from the non secure application directly. This needs to be set +# otherwise nrfx will try to configure them, resulting in a bus +# fault. +CONFIG_NRF_SKIP_CLOCK_CONFIG=y diff --git a/dts/arm/nordic/nrf54lm20a_enga_cpuapp.dtsi b/dts/arm/nordic/nrf54lm20a_enga_cpuapp.dtsi index 93d00aa75733..c55f40e6fa95 100644 --- a/dts/arm/nordic/nrf54lm20a_enga_cpuapp.dtsi +++ b/dts/arm/nordic/nrf54lm20a_enga_cpuapp.dtsi @@ -71,7 +71,11 @@ nvic: &cpuapp_nvic {}; }; &grtc { +#ifdef USE_NON_SECURE_ADDRESS_MAP + interrupts = <227 NRF_DEFAULT_IRQ_PRIORITY>, +#else interrupts = <228 NRF_DEFAULT_IRQ_PRIORITY>, +#endif <229 NRF_DEFAULT_IRQ_PRIORITY>; /* reserved for Zero Latency IRQs */ }; diff --git a/dts/vendor/nordic/nrf54lm20a.dtsi b/dts/vendor/nordic/nrf54lm20a.dtsi index d9b39d4fb8eb..b4ddafac801b 100644 --- a/dts/vendor/nordic/nrf54lm20a.dtsi +++ b/dts/vendor/nordic/nrf54lm20a.dtsi @@ -96,10 +96,14 @@ #nordic,ficr-cells = <1>; }; +#ifdef USE_NON_SECURE_ADDRESS_MAP + /* intentionally empty because UICR is hardware fixed to Secure */ +#else uicr: uicr@ffd000 { compatible = "nordic,nrf-uicr"; reg = <0xffd000 0x1000>; }; +#endif cpuapp_sram: memory@20000000 { compatible = "mmio-sram"; @@ -117,11 +121,19 @@ ranges = <0x0 0x20067c00 DT_SIZE_K(96)>; }; +#ifdef USE_NON_SECURE_ADDRESS_MAP + global_peripherals: peripheral@40000000 { + reg = <0x40000000 0x10000000>; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x40000000 0x10000000>; +#else global_peripherals: peripheral@50000000 { reg = <0x50000000 0x10000000>; ranges = <0x0 0x50000000 0x10000000>; #address-cells = <1>; #size-cells = <1>; +#endif dppic00: dppic@42000 { compatible = "nordic,nrf-dppic"; @@ -753,12 +765,16 @@ interrupts = <262 NRF_DEFAULT_IRQ_PRIORITY>; }; +#ifdef USE_NON_SECURE_ADDRESS_MAP + /* intentionally empty because WDT30 is hardware fixed to Secure */ +#else wdt30: watchdog@108000 { compatible = "nordic,nrf-wdt"; reg = <0x108000 0x620>; interrupts = <264 NRF_DEFAULT_IRQ_PRIORITY>; status = "disabled"; }; +#endif wdt31: watchdog@109000 { compatible = "nordic,nrf-wdt"; @@ -857,6 +873,15 @@ }; }; + nrf_mpc: memory@50041000 { + compatible = "nordic,nrf-mpc"; + reg = <0x50041000 0x1000>; + #address-cells = <1>; + #size-cells = <1>; + override-num = <5>; + override-granularity = <4096>; + }; + cpuapp_ppb: cpuapp-ppb-bus { #address-cells = <1>; #size-cells = <1>; diff --git a/dts/vendor/nordic/nrf54lm20a_ns_partition.dtsi b/dts/vendor/nordic/nrf54lm20a_ns_partition.dtsi new file mode 100644 index 000000000000..954dd8290453 --- /dev/null +++ b/dts/vendor/nordic/nrf54lm20a_ns_partition.dtsi @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&cpuapp_rram { + /* + * Default NVM layout on NRF54LM20A Application MCU without BL2: + * This layout matches (by necessity) that in the TF-M repository: + * + * 0x0000_0000 Secure image primary (512 KB) + * 0x0008_0000 Protected Storage Area (16 KB) + * 0x0008_4000 Internal Trusted Storage Area (16 KB) + * 0x0008_8000 OTP / NV counters area (8 KB) + * 0x0008_A000 Non-secure image primary (1356 KB) + * 0x001D_DD00 Non-secure storage, used when built with NRF_NS_STORAGE=ON, + * otherwise unused (32 KB) + */ + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + /* nRF54LM20A has 2036 kB of non-volatile memory (RRAM) but the last + * 96 kB are reserved for the FLPR MCU. + * + * This static layout needs to be the same with the upstream TF-M layout in the + * header flash_layout.h of the relevant platform. Any updates in the layout + * needs to happen both in the flash_layout.h and in this file at the same time. + */ + slot0_partition: partition@0 { + label = "image-0"; + reg = <0x0000000 DT_SIZE_K(512)>; + }; + + tfm_ps_partition: partition@80000 { + label = "tfm-ps"; + reg = <0x00080000 DT_SIZE_K(16)>; + }; + + tfm_its_partition: partition@84000 { + label = "tfm-its"; + reg = <0x00084000 DT_SIZE_K(16)>; + }; + + tfm_otp_partition: partition@88000 { + label = "tfm-otp"; + reg = <0x00088000 DT_SIZE_K(8)>; + }; + + slot0_ns_partition: partition@8A000 { + label = "image-0-nonsecure"; + reg = <0x0008A000 DT_SIZE_K(1356)>; + }; + + storage_partition: partition@1DD000 { + label = "storage"; + reg = <0x001DD000 DT_SIZE_K(32)>; + }; + }; +}; diff --git a/dts/vendor/nordic/nrf54lm20a_partition.dtsi b/dts/vendor/nordic/nrf54lm20a_partition.dtsi new file mode 100644 index 000000000000..049f87139d91 --- /dev/null +++ b/dts/vendor/nordic/nrf54lm20a_partition.dtsi @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&cpuapp_rram { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + /* nRF54LM20A has 2036 kB of non-volatile memory (RRAM) but the last + * 96 kB are reserved for the FLPR MCU, so we have ~1940 kB available. + */ + + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x0 DT_SIZE_K(64)>; + }; + + slot0_partition: partition@10000 { + label = "image-0"; + reg = <0x10000 DT_SIZE_K(922)>; + }; + + slot1_partition: partition@f6800 { + label = "image-1"; + reg = <0xf6800 DT_SIZE_K(922)>; + }; + + storage_partition: partition@1dd000 { + label = "storage"; + reg = <0x1dd000 DT_SIZE_K(32)>; + }; + }; +}; diff --git a/modules/trusted-firmware-m/Kconfig.tfm b/modules/trusted-firmware-m/Kconfig.tfm index 55e08ee45e4a..36a734ad8b3e 100644 --- a/modules/trusted-firmware-m/Kconfig.tfm +++ b/modules/trusted-firmware-m/Kconfig.tfm @@ -28,6 +28,7 @@ config TFM_BOARD default "$(ZEPHYR_BASE)/modules/trusted-firmware-m/nordic/nrf5340_cpuapp" if SOC_NRF5340_CPUAPP default "$(ZEPHYR_BASE)/modules/trusted-firmware-m/nordic/nrf54l15_cpuapp" if SOC_NRF54L15_CPUAPP default "$(ZEPHYR_BASE)/modules/trusted-firmware-m/nordic/nrf54l10_cpuapp" if SOC_NRF54L10_CPUAPP + default "$(ZEPHYR_BASE)/modules/trusted-firmware-m/nordic/nrf54lm20a_cpuapp" if SOC_NRF54LM20A_ENGA_CPUAPP help The board name used for building TFM. Building with TFM requires that TFM has been ported to the given board/SoC. diff --git a/modules/trusted-firmware-m/nordic/nrf54lm20a_cpuapp/CMakeLists.txt b/modules/trusted-firmware-m/nordic/nrf54lm20a_cpuapp/CMakeLists.txt new file mode 100644 index 000000000000..c926ace19c8f --- /dev/null +++ b/modules/trusted-firmware-m/nordic/nrf54lm20a_cpuapp/CMakeLists.txt @@ -0,0 +1,23 @@ +# +# Copyright (c) 2025, Nordic Semiconductor ASA. +# +# SPDX-License-Identifier: Apache-2.0 +# + +set(NRF_BOARD_SELECTED True) + +add_subdirectory(${Trusted\ Firmware\ M_SOURCE_DIR}/platform/ext/target/nordic_nrf/common/nrf54lm20a nrf54lm20a) + +add_subdirectory(.. common) + +install(FILES ${CMAKE_CURRENT_LIST_DIR}/ns/cpuarch_ns.cmake + DESTINATION ${INSTALL_PLATFORM_NS_DIR} + RENAME cpuarch.cmake) + +install(FILES config.cmake + DESTINATION ${INSTALL_PLATFORM_NS_DIR}) + +install(DIRECTORY ${Trusted\ Firmware\ M_SOURCE_DIR}/platform/ext/target/nordic_nrf/nrf54lm20dk_nrf54lm20a_cpuapp/tests + + DESTINATION ${INSTALL_PLATFORM_NS_DIR} +) diff --git a/modules/trusted-firmware-m/nordic/nrf54lm20a_cpuapp/config.cmake b/modules/trusted-firmware-m/nordic/nrf54lm20a_cpuapp/config.cmake new file mode 100644 index 000000000000..4b1e3ab5e97c --- /dev/null +++ b/modules/trusted-firmware-m/nordic/nrf54lm20a_cpuapp/config.cmake @@ -0,0 +1,9 @@ +# +# Copyright (c) 2025, Nordic Semiconductor ASA. +# +# SPDX-License-Identifier: Apache-2.0 +# + +set(NRF_SOC_VARIANT nrf54lm20a CACHE STRING "nRF SoC Variant") + +include(${PLATFORM_PATH}/common/nrf54lm20a/config.cmake) diff --git a/modules/trusted-firmware-m/nordic/nrf54lm20a_cpuapp/cpuarch.cmake b/modules/trusted-firmware-m/nordic/nrf54lm20a_cpuapp/cpuarch.cmake new file mode 100644 index 000000000000..1766b89f9964 --- /dev/null +++ b/modules/trusted-firmware-m/nordic/nrf54lm20a_cpuapp/cpuarch.cmake @@ -0,0 +1,9 @@ +# +# Copyright (c) 2025, Nordic Semiconductor ASA. +# +# SPDX-License-Identifier: Apache-2.0 +# + +set(PLATFORM_PATH platform/ext/target/nordic_nrf) + +include(${PLATFORM_PATH}/common/nrf54lm20a/cpuarch.cmake) diff --git a/modules/trusted-firmware-m/nordic/nrf54lm20a_cpuapp/ns/cpuarch_ns.cmake b/modules/trusted-firmware-m/nordic/nrf54lm20a_cpuapp/ns/cpuarch_ns.cmake new file mode 100644 index 000000000000..cec0a5536dd3 --- /dev/null +++ b/modules/trusted-firmware-m/nordic/nrf54lm20a_cpuapp/ns/cpuarch_ns.cmake @@ -0,0 +1,10 @@ +# +# Copyright (c) 2025, Nordic Semiconductor ASA. +# +# SPDX-License-Identifier: Apache-2.0 +# + +set(PLATFORM_DIR ${CMAKE_CURRENT_LIST_DIR}) +set(PLATFORM_PATH ${CMAKE_CURRENT_LIST_DIR}) + +include(${CMAKE_CURRENT_LIST_DIR}/common/nrf54lm20a/cpuarch.cmake) diff --git a/samples/drivers/watchdog/sample.yaml b/samples/drivers/watchdog/sample.yaml index a1069108fb05..8cf1d7db91a5 100644 --- a/samples/drivers/watchdog/sample.yaml +++ b/samples/drivers/watchdog/sample.yaml @@ -26,6 +26,7 @@ tests: - panb611evb/nrf54l15/cpuapp/ns - panb611evb/nrf54l15/cpuflpr - panb611evb/nrf54l15/cpuflpr/xip + - nrf54lm20dk/nrf54lm20a/cpuapp/ns - nrf54l15dk/nrf54l15/cpuapp/ns - nrf54l15dk/nrf54l10/cpuapp/ns - bl54l15_dvk/nrf54l10/cpuapp/ns diff --git a/samples/tfm_integration/config_build/sample.yaml b/samples/tfm_integration/config_build/sample.yaml index 3c46c148f7ba..55c4e2348081 100644 --- a/samples/tfm_integration/config_build/sample.yaml +++ b/samples/tfm_integration/config_build/sample.yaml @@ -10,6 +10,7 @@ common: - nrf9160dk/nrf9160/ns - nrf54l15dk/nrf54l15/cpuapp/ns - nrf54l15dk/nrf54l10/cpuapp/ns + - nrf54lm20dk/nrf54lm20a/cpuapp/ns - bl5340_dvk/nrf5340/cpuapp/ns integration_platforms: - nrf5340dk/nrf5340/cpuapp/ns diff --git a/samples/tfm_integration/tfm_ipc/sample.yaml b/samples/tfm_integration/tfm_ipc/sample.yaml index 390efa24fb7e..154d91b23f31 100644 --- a/samples/tfm_integration/tfm_ipc/sample.yaml +++ b/samples/tfm_integration/tfm_ipc/sample.yaml @@ -35,6 +35,7 @@ tests: - mps2/an521/cpu0/ns - nrf54l15dk/nrf54l15/cpuapp/ns - nrf54l15dk/nrf54l10/cpuapp/ns + - nrf54lm20dk/nrf54lm20a/cpuapp/ns extra_configs: - CONFIG_TFM_BL2=n harness: console diff --git a/tests/drivers/adc/adc_api/testcase.yaml b/tests/drivers/adc/adc_api/testcase.yaml index cd90f5356a51..3aa5e089b830 100644 --- a/tests/drivers/adc/adc_api/testcase.yaml +++ b/tests/drivers/adc/adc_api/testcase.yaml @@ -13,6 +13,7 @@ tests: - panb611evb/nrf54l15/cpuapp/ns - nrf54l15dk/nrf54l15/cpuapp/ns - nrf54l15dk/nrf54l10/cpuapp/ns + - nrf54lm20dk/nrf54lm20a/cpuapp/ns - bl54l15_dvk/nrf54l10/cpuapp/ns - bl54l15_dvk/nrf54l15/cpuapp/ns - bl54l15u_dvk/nrf54l15/cpuapp/ns diff --git a/tests/drivers/watchdog/wdt_basic_api/testcase.yaml b/tests/drivers/watchdog/wdt_basic_api/testcase.yaml index 01b8e6d833a8..6efd3fa94e91 100644 --- a/tests/drivers/watchdog/wdt_basic_api/testcase.yaml +++ b/tests/drivers/watchdog/wdt_basic_api/testcase.yaml @@ -28,6 +28,7 @@ tests: - mimxrt700_evk/mimxrt798s/cm33_cpu1 - nrf54l15dk/nrf54l15/cpuapp/ns - nrf54l15dk/nrf54l10/cpuapp/ns + - nrf54lm20dk/nrf54lm20a/cpuapp/ns - bl54l15_dvk/nrf54l10/cpuapp/ns - bl54l15_dvk/nrf54l15/cpuapp/ns - bl54l15u_dvk/nrf54l15/cpuapp/ns diff --git a/tests/subsys/settings/its/testcase.yaml b/tests/subsys/settings/its/testcase.yaml index de11f1ef7264..c63019e63457 100644 --- a/tests/subsys/settings/its/testcase.yaml +++ b/tests/subsys/settings/its/testcase.yaml @@ -10,5 +10,6 @@ tests: - max32657evkit/max32657/ns - nrf5340dk/nrf5340/cpuapp/ns - nrf54l15dk/nrf54l15/cpuapp/ns + - nrf54lm20dk/nrf54lm20a/cpuapp/ns platform_exclude: - lpcxpresso55s69/lpc55s69/cpu0/ns From fc08ad1891263143ebcd40379fa77eba2ee37ba9 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Mon, 15 Sep 2025 20:21:35 +0530 Subject: [PATCH 1984/2141] [nrf fromtree] drivers: wifi: nrf7002: Add support for multiple virtual interfaces (VIFs) Description: The nRF7002 firmware supports two virtual interfaces (VIFs) that can operate in different modes (e.g., AP and STA). However, the existing Zephyr driver only utilizes a single VIF, preventing full multi-interface support. This commit extends the nRF7002 driver to support multiple VIFs by making the following modifications: * The driver already contains an array of vif_ctx_zep, but only the first item was being used. Now, a second Ethernet device is registered using vif_ctx_zep[1], enabling multi-VIF operation. * Introduced vif_ctx_cnt to keep track of active interfaces and manage their state effectively. * Ensured that FMAC (Firmware MAC) is initialized only once, avoiding redundant initializations when multiple VIFs are present. * The UMAC control commands previously did not associate responses with the issuing VIF. A queue is now introduced to track the originating VIF for each command and correctly route the response event to the corresponding interface. Signed-off-by: Hanan Arshad Signed-off-by: Chaitanya Tata (cherry picked from commit 1c6a00bd5dcf3e590a2982f49962918ad3bfc923) --- drivers/wifi/nrf_wifi/Kconfig.nrfwifi | 9 +++++++++ drivers/wifi/nrf_wifi/src/fmac_main.c | 27 +++++++++++++++++++++++++ drivers/wifi/nrf_wifi/src/net_if.c | 3 +-- drivers/wifi/nrf_wifi/src/wpa_supp_if.c | 5 ++++- 4 files changed, 41 insertions(+), 3 deletions(-) diff --git a/drivers/wifi/nrf_wifi/Kconfig.nrfwifi b/drivers/wifi/nrf_wifi/Kconfig.nrfwifi index 9b37c302872b..29f8c86250a3 100644 --- a/drivers/wifi/nrf_wifi/Kconfig.nrfwifi +++ b/drivers/wifi/nrf_wifi/Kconfig.nrfwifi @@ -108,6 +108,15 @@ config NRF70_AP_MODE depends on WIFI_NM_WPA_SUPPLICANT_AP default y if WIFI_USAGE_MODE_AP || WIFI_USAGE_MODE_STA_AP +config NRF70_ENABLE_DUAL_VIF + bool "Dual virtual Wi-Fi interfaces" + default y if WIFI_NM_MAX_MANAGED_INTERFACES = 2 + depends on (WIFI_NRF7002 || WIFI_NRF7001) && NET_L2_ETHERNET + help + Enable support for two virtual Wi-Fi interfaces (VIFs). + When enabled, the driver can operate two VIFs simultaneously, + allowing use cases such as one interface in AP mode and another in STA mode. + config NRF70_P2P_MODE bool "P2P support in driver" diff --git a/drivers/wifi/nrf_wifi/src/fmac_main.c b/drivers/wifi/nrf_wifi/src/fmac_main.c index 125ffd7a9a10..5932ec4f026f 100644 --- a/drivers/wifi/nrf_wifi/src/fmac_main.c +++ b/drivers/wifi/nrf_wifi/src/fmac_main.c @@ -743,9 +743,21 @@ static int nrf_wifi_drv_main_zep(const struct device *dev) struct nrf_wifi_data_config_params data_config = { 0 }; struct rx_buf_pool_params rx_buf_pools[MAX_NUM_OF_RX_QUEUES]; struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = dev->data; + static unsigned char fixed_vif_cnt; + if (fixed_vif_cnt >= MAX_NUM_VIFS) { + LOG_ERR("%s: Max number of VIFs reached", __func__); + return -ENOMEM; + } + + /* Setup the linkage between the FMAC and the VIF contexts */ vif_ctx_zep->rpu_ctx_zep = &rpu_drv_priv_zep.rpu_ctx_zep; + if (fixed_vif_cnt++ > 0) { + /* FMAC is already initialized for VIF-0 */ + return 0; + } + #ifdef CONFIG_NRF70_DATA_TX data_config.aggregation = aggregation; data_config.wmm = IS_ENABLED(CONFIG_NRF_WIFI_FEAT_WMM); @@ -979,6 +991,21 @@ ETH_NET_DEVICE_DT_INST_DEFINE(0, CONFIG_WIFI_INIT_PRIORITY, /* prio */ &wifi_offload_ops, /* api */ CONFIG_NRF_WIFI_IFACE_MTU); /*mtu */ +#ifdef CONFIG_NRF70_ENABLE_DUAL_VIF +/* Register second interface */ +ETH_NET_DEVICE_DT_INST_DEFINE(1, + nrf_wifi_drv_main_zep, /* init_fn */ + NULL, /* pm_action_cb */ + &rpu_drv_priv_zep.rpu_ctx_zep.vif_ctx_zep[1], /* data */ +#ifdef CONFIG_NRF70_STA_MODE + &wpa_supp_ops, /* cfg */ +#else /* CONFIG_NRF70_STA_MODE */ + NULL, /* cfg */ +#endif /* !CONFIG_NRF70_STA_MODE */ + CONFIG_WIFI_INIT_PRIORITY, /* prio */ + &wifi_offload_ops, /* api */ + CONFIG_NRF_WIFI_IFACE_MTU); /*mtu */ +#endif /* NRF70_ENABLE_DUAL_VIF */ #else DEVICE_DT_INST_DEFINE(0, nrf_wifi_drv_main_zep, /* init_fn */ diff --git a/drivers/wifi/nrf_wifi/src/net_if.c b/drivers/wifi/nrf_wifi/src/net_if.c index 4830d63c9d15..d1fc9195dbb2 100644 --- a/drivers/wifi/nrf_wifi/src/net_if.c +++ b/drivers/wifi/nrf_wifi/src/net_if.c @@ -824,8 +824,7 @@ int nrf_wifi_if_start_zep(const struct device *dev) } k_mutex_init(&vif_ctx_zep->vif_lock); - rpu_ctx_zep->vif_ctx_zep[vif_ctx_zep->vif_idx].if_type = - add_vif_info.iftype; + vif_ctx_zep->if_type = add_vif_info.iftype; /* Check if user has provided a valid MAC address, if not * fetch it from OTP. diff --git a/drivers/wifi/nrf_wifi/src/wpa_supp_if.c b/drivers/wifi/nrf_wifi/src/wpa_supp_if.c index 9f1fff535454..88ea9f9215b4 100644 --- a/drivers/wifi/nrf_wifi/src/wpa_supp_if.c +++ b/drivers/wifi/nrf_wifi/src/wpa_supp_if.c @@ -447,7 +447,10 @@ void *nrf_wifi_wpa_supp_dev_init(void *supp_drv_if_ctx, const char *iface_name, struct zep_wpa_supp_dev_callbk_fns *supp_callbk_fns) { struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - const struct device *device = DEVICE_DT_GET(DT_CHOSEN(zephyr_wifi)); + /* Get device for each interface */ + int if_idx = net_if_get_by_name(iface_name); + struct net_if *iface = net_if_get_by_index(if_idx); + const struct device *device = net_if_get_device(iface); if (!device) { LOG_ERR("%s: Interface %s not found", __func__, iface_name); From 65e42e7b53eab3fb62091c5d5ec04b3e3ac31c1c Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Mon, 15 Sep 2025 20:21:41 +0530 Subject: [PATCH 1985/2141] [nrf fromtree] drivers: nrf_wifi: Fix scan crash for 2nd VIF Move the VIF initialization to top to do it for both VIFs, this fixes a crash when scanning on the 2nd VIF. Signed-off-by: Chaitanya Tata (cherry picked from commit 386dcbe72c03eef92cd1d71a024f67354a47dbc2) --- drivers/wifi/nrf_wifi/src/fmac_main.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/wifi/nrf_wifi/src/fmac_main.c b/drivers/wifi/nrf_wifi/src/fmac_main.c index 5932ec4f026f..d0fa7cfba410 100644 --- a/drivers/wifi/nrf_wifi/src/fmac_main.c +++ b/drivers/wifi/nrf_wifi/src/fmac_main.c @@ -752,6 +752,14 @@ static int nrf_wifi_drv_main_zep(const struct device *dev) /* Setup the linkage between the FMAC and the VIF contexts */ vif_ctx_zep->rpu_ctx_zep = &rpu_drv_priv_zep.rpu_ctx_zep; +#ifndef CONFIG_NRF70_RADIO_TEST + k_work_init_delayable(&vif_ctx_zep->scan_timeout_work, + nrf_wifi_scan_timeout_work); + k_work_init(&vif_ctx_zep->disp_scan_res_work, + nrf_wifi_disp_scan_res_work_handler); + + vif_ctx_zep->bss_max_idle_period = USHRT_MAX; +#endif /* !CONFIG_NRF70_RADIO_TEST */ if (fixed_vif_cnt++ > 0) { /* FMAC is already initialized for VIF-0 */ @@ -835,7 +843,6 @@ static int nrf_wifi_drv_main_zep(const struct device *dev) rpu_drv_priv_zep.fmac_priv = nrf_wifi_rt_fmac_init(); #endif /* CONFIG_NRF70_RADIO_TEST */ - if (rpu_drv_priv_zep.fmac_priv == NULL) { LOG_ERR("%s: nrf_wifi_fmac_init failed", __func__); @@ -864,17 +871,10 @@ static int nrf_wifi_drv_main_zep(const struct device *dev) LOG_ERR("%s: nrf_wifi_fmac_dev_add_zep failed", __func__); goto fmac_deinit; } -#else - k_work_init_delayable(&vif_ctx_zep->scan_timeout_work, - nrf_wifi_scan_timeout_work); - k_work_init(&vif_ctx_zep->disp_scan_res_work, - nrf_wifi_disp_scan_res_work_handler); #endif /* CONFIG_NRF70_RADIO_TEST */ k_mutex_init(&rpu_drv_priv_zep.rpu_ctx_zep.rpu_lock); -#ifndef CONFIG_NRF70_RADIO_TEST - vif_ctx_zep->bss_max_idle_period = USHRT_MAX; -#endif /* !CONFIG_NRF70_RADIO_TEST */ + return 0; #ifdef CONFIG_NRF70_RADIO_TEST fmac_deinit: From ee69aaadc2820e4f5d8822935cd6241bfeab9320 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Mon, 29 Sep 2025 20:51:17 +0530 Subject: [PATCH 1986/2141] [nrf fromtree] drivers: nrf_wifi: Implement vendor stats Populate the vendor stats with nRF70 FW statistics, this is handy in debugging. Signed-off-by: Chaitanya Tata (cherry picked from commit fdd7100933811dce620108cb2e21dac78b82d542) --- drivers/wifi/nrf_wifi/inc/fmac_main.h | 9 ++++ drivers/wifi/nrf_wifi/src/net_if.c | 73 +++++++++++++++++++++++++++ 2 files changed, 82 insertions(+) diff --git a/drivers/wifi/nrf_wifi/inc/fmac_main.h b/drivers/wifi/nrf_wifi/inc/fmac_main.h index 7a863d8b614a..48d3791961e3 100644 --- a/drivers/wifi/nrf_wifi/inc/fmac_main.h +++ b/drivers/wifi/nrf_wifi/inc/fmac_main.h @@ -36,6 +36,11 @@ #define NRF70_DRIVER_VERSION "1."KERNEL_VERSION_STRING +/* Calculate compile-time maximum for vendor stats */ +#ifdef CONFIG_NET_STATISTICS_ETHERNET_VENDOR +#define MAX_VENDOR_STATS ((sizeof(struct rpu_sys_fw_stats) / sizeof(uint32_t)) + 1) +#endif /* CONFIG_NET_STATISTICS_ETHERNET_VENDOR */ + #ifndef CONFIG_NRF70_OFFLOADED_RAW_TX #ifndef CONFIG_NRF70_RADIO_TEST struct nrf_wifi_vif_ctx_zep { @@ -61,6 +66,10 @@ struct nrf_wifi_vif_ctx_zep { bool set_if_event_received; int set_if_status; #ifdef CONFIG_NET_STATISTICS_ETHERNET +#ifdef CONFIG_NET_STATISTICS_ETHERNET_VENDOR + struct net_stats_eth_vendor eth_stats_vendor_data[MAX_VENDOR_STATS]; + char vendor_key_strings[MAX_VENDOR_STATS][16]; +#endif /* CONFIG_NET_STATISTICS_ETHERNET_VENDOR */ struct net_stats_eth eth_stats; #endif /* CONFIG_NET_STATISTICS_ETHERNET */ #if defined(CONFIG_NRF70_STA_MODE) || defined(CONFIG_NRF70_RAW_DATA_RX) diff --git a/drivers/wifi/nrf_wifi/src/net_if.c b/drivers/wifi/nrf_wifi/src/net_if.c index d1fc9195dbb2..0662c6c80d09 100644 --- a/drivers/wifi/nrf_wifi/src/net_if.c +++ b/drivers/wifi/nrf_wifi/src/net_if.c @@ -1213,6 +1213,16 @@ int nrf_wifi_if_set_config_zep(const struct device *dev, struct net_stats_eth *nrf_wifi_eth_stats_get(const struct device *dev) { struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; +#ifdef CONFIG_NET_STATISTICS_ETHERNET_VENDOR + struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; + struct rpu_sys_op_stats stats; + enum nrf_wifi_status status; + size_t fw_stats_size; + size_t num_uint32; + const uint8_t *fw_stats_bytes; + size_t i; + int vendor_idx = 0; +#endif /* CONFIG_NET_STATISTICS_ETHERNET_VENDOR */ if (!dev) { LOG_ERR("%s Device not found", __func__); @@ -1225,6 +1235,69 @@ struct net_stats_eth *nrf_wifi_eth_stats_get(const struct device *dev) goto out; } +#ifdef CONFIG_NET_STATISTICS_ETHERNET_VENDOR + rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; + if (!rpu_ctx_zep || !rpu_ctx_zep->rpu_ctx) { + LOG_ERR("%s: rpu_ctx_zep or rpu_ctx is NULL", __func__); + goto out; + } + + memset(&stats, 0, sizeof(stats)); + status = nrf_wifi_sys_fmac_stats_get(rpu_ctx_zep->rpu_ctx, + RPU_STATS_TYPE_ALL, + &stats); + if (status != NRF_WIFI_STATUS_SUCCESS) { + LOG_ERR("%s: Failed to get RPU stats", __func__); + goto ret; + } + + /* Treat stats.fw as a blob and divide into uint32_t chunks */ + fw_stats_size = sizeof(stats.fw); + num_uint32 = fw_stats_size / sizeof(uint32_t); + fw_stats_bytes = (const uint8_t *)&stats.fw; + + vendor_idx = 0; + + for (i = 0; i < num_uint32 && vendor_idx < MAX_VENDOR_STATS - 1; i++) { + uint32_t val; + const char **key_ptr; + uint32_t *val_ptr; + + /* Extract uint32_t value from blob */ + memcpy(&val, fw_stats_bytes + i * sizeof(uint32_t), sizeof(uint32_t)); + + /* Create key name */ + snprintk(vif_ctx_zep->vendor_key_strings[vendor_idx], 16, "fw_%zu", i); + + /* Assign key */ + key_ptr = (const char **) + &vif_ctx_zep->eth_stats_vendor_data[vendor_idx].key; + *key_ptr = vif_ctx_zep->vendor_key_strings[vendor_idx]; + + /* Assign value */ + val_ptr = (uint32_t *) + &vif_ctx_zep->eth_stats_vendor_data[vendor_idx].value; + *val_ptr = val; + + vendor_idx++; + } + + /* Null terminator entry */ + { + const char **key_ptr = (const char **) + &vif_ctx_zep->eth_stats_vendor_data[vendor_idx].key; + uint32_t *val_ptr = (uint32_t *) + &vif_ctx_zep->eth_stats_vendor_data[vendor_idx].value; + + *key_ptr = NULL; + *val_ptr = 0; + } + + /* Point to the static vendor data */ + vif_ctx_zep->eth_stats.vendor = vif_ctx_zep->eth_stats_vendor_data; + +ret: +#endif /* CONFIG_NET_STATISTICS_ETHERNET_VENDOR */ return &vif_ctx_zep->eth_stats; out: return NULL; From 588feccd271a5b4d6faf0edf0b26a786832a6025 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Wed, 20 Aug 2025 01:45:18 +0530 Subject: [PATCH 1987/2141] [nrf fromtree] drivers: nrf_wifi: Fix NRF71 build NRF71 doesn't have direct memory access, so, disabled the rpu stats memory variant. Signed-off-by: Chaitanya Tata (cherry picked from commit 8c5a5ae1990eab14c53bbdee45af7c7ca0d6c49e) --- drivers/wifi/nrf_wifi/src/wifi_util.c | 7 +++++++ drivers/wifi/nrf_wifi/src/wifi_util.h | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/drivers/wifi/nrf_wifi/src/wifi_util.c b/drivers/wifi/nrf_wifi/src/wifi_util.c index 57bda1f4ff4f..4a8309434794 100644 --- a/drivers/wifi/nrf_wifi/src/wifi_util.c +++ b/drivers/wifi/nrf_wifi/src/wifi_util.c @@ -14,8 +14,10 @@ #include "fmac_main.h" #include "wifi_util.h" +#ifndef CONFIG_NRF71_ON_IPC #include "rpu_lmac_phy_stats.h" #include "rpu_umac_stats.h" +#endif extern struct nrf_wifi_drv_priv_zep rpu_drv_priv_zep; struct nrf_wifi_ctx_zep *ctx = &rpu_drv_priv_zep.rpu_ctx_zep; @@ -973,6 +975,7 @@ static int nrf_wifi_util_rpu_recovery_info(const struct shell *sh, } #endif /* CONFIG_NRF_WIFI_RPU_RECOVERY */ +#ifndef CONFIG_NRF71_ON_IPC static int nrf_wifi_dump_stats(const struct shell *sh, struct nrf_wifi_hal_dev_ctx *hal_dev_ctx, const char *name, @@ -1010,6 +1013,7 @@ static int nrf_wifi_dump_stats(const struct shell *sh, return ret; } + static int nrf_wifi_util_dump_rpu_stats_mem(const struct shell *sh, size_t argc, const char *argv[]) @@ -1095,6 +1099,7 @@ static int nrf_wifi_util_dump_rpu_stats_mem(const struct shell *sh, k_mutex_unlock(&ctx->rpu_lock); return ret; } +#endif /* !CONFIG_NRF71_ON_IPC */ SHELL_STATIC_SUBCMD_SET_CREATE( nrf70_util, @@ -1199,6 +1204,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE( 1, 0), #endif /* CONFIG_NRF_WIFI_RPU_RECOVERY */ +#ifndef CONFIG_NRF71_ON_IPC SHELL_CMD_ARG(rpu_stats_mem, NULL, "Display RPU stats by reading from memory " @@ -1206,6 +1212,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE( nrf_wifi_util_dump_rpu_stats_mem, 1, 1), +#endif /* !CONFIG_NRF71_ON_IPC */ SHELL_SUBCMD_SET_END); diff --git a/drivers/wifi/nrf_wifi/src/wifi_util.h b/drivers/wifi/nrf_wifi/src/wifi_util.h index 303d5feac99f..a2490a1df24c 100644 --- a/drivers/wifi/nrf_wifi/src/wifi_util.h +++ b/drivers/wifi/nrf_wifi/src/wifi_util.h @@ -14,7 +14,11 @@ #include #include #include +#ifdef CONFIG_NRF71_ON_IPC +#include +#else #include +#endif #include #include From 30478c4e61c5062932b3dd951ffd79bac32a2620 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Tue, 23 Sep 2025 21:49:41 +0530 Subject: [PATCH 1988/2141] [nrf fromtree] drivers: nrf_wifi: Use new nRF71 interface files nRF70 and nRF71 now use different interface files, fix the build. Signed-off-by: Chaitanya Tata (cherry picked from commit 91c0e15720776e60bf6e474dc3877523b0e4d33e) --- drivers/wifi/nrf_wifi/Kconfig.nrfwifi | 1 + drivers/wifi/nrf_wifi/inc/fmac_main.h | 5 ++++- drivers/wifi/nrf_wifi/src/debug_shell.c | 4 ++++ drivers/wifi/nrf_wifi/src/fmac_main.c | 17 +++++++++++------ drivers/wifi/nrf_wifi/src/fw_load.c | 8 +++++++- drivers/wifi/nrf_wifi/src/wifi_mgmt.c | 3 ++- drivers/wifi/nrf_wifi/src/wifi_util.c | 4 ++++ 7 files changed, 33 insertions(+), 9 deletions(-) diff --git a/drivers/wifi/nrf_wifi/Kconfig.nrfwifi b/drivers/wifi/nrf_wifi/Kconfig.nrfwifi index 29f8c86250a3..df4414a316e0 100644 --- a/drivers/wifi/nrf_wifi/Kconfig.nrfwifi +++ b/drivers/wifi/nrf_wifi/Kconfig.nrfwifi @@ -174,6 +174,7 @@ config NRF_WIFI_LOW_POWER config NRF70_TCP_IP_CHECKSUM_OFFLOAD bool "TCP/IP checksum offload" + depends on !NRF71_ON_IPC default y config NRF70_REG_DOMAIN diff --git a/drivers/wifi/nrf_wifi/inc/fmac_main.h b/drivers/wifi/nrf_wifi/inc/fmac_main.h index 48d3791961e3..799beff1fbaf 100644 --- a/drivers/wifi/nrf_wifi/inc/fmac_main.h +++ b/drivers/wifi/nrf_wifi/inc/fmac_main.h @@ -31,8 +31,11 @@ #else #include #endif /* !CONFIG_NRF70_RADIO_TEST */ - +#ifdef CONFIG_NRF71_ON_IPC +#include +#else #include +#endif /* CONFIG_NRF71_ON_IPC */ #define NRF70_DRIVER_VERSION "1."KERNEL_VERSION_STRING diff --git a/drivers/wifi/nrf_wifi/src/debug_shell.c b/drivers/wifi/nrf_wifi/src/debug_shell.c index 70fb77d6ed0d..b6ac79bf7724 100644 --- a/drivers/wifi/nrf_wifi/src/debug_shell.c +++ b/drivers/wifi/nrf_wifi/src/debug_shell.c @@ -9,7 +9,11 @@ */ #include #include +#ifdef NRF71_ON_IPC +#include +#else #include "host_rpu_umac_if.h" +#endif #include "fmac_main.h" extern struct nrf_wifi_drv_priv_zep rpu_drv_priv_zep; diff --git a/drivers/wifi/nrf_wifi/src/fmac_main.c b/drivers/wifi/nrf_wifi/src/fmac_main.c index d0fa7cfba410..764cab93193e 100644 --- a/drivers/wifi/nrf_wifi/src/fmac_main.c +++ b/drivers/wifi/nrf_wifi/src/fmac_main.c @@ -69,9 +69,10 @@ BUILD_ASSERT(CONFIG_NRF70_MAX_TX_AGGREGATION <= 15, "Max TX aggregation is 15"); BUILD_ASSERT(CONFIG_NRF70_RX_NUM_BUFS >= 1, "At least one RX buffer is required"); +#ifndef CONFIG_NRF71_ON_IPC BUILD_ASSERT(RPU_PKTRAM_SIZE - TOTAL_RX_SIZE >= TOTAL_TX_SIZE, "Packet RAM overflow: not enough memory for TX"); - +#endif /* CONFIG_NRF71_ON_IPC */ BUILD_ASSERT(CONFIG_NRF70_TX_MAX_DATA_SIZE >= MAX_TX_FRAME_SIZE, "TX buffer size must be at least as big as the MTU and headroom"); @@ -503,12 +504,9 @@ void reg_change_callbk_fn(void *vif_ctx, } #endif /* !CONFIG_NRF70_RADIO_TEST */ -#ifdef CONFIG_NRF71_ON_IPC -#define MAX_TX_PWR(label) DT_PROP(DT_NODELABEL(wifi), label) * 4 -#else +#ifndef CONFIG_NRF71_ON_IPC /* DTS uses 1dBm as the unit for TX power, while the RPU uses 0.25dBm */ #define MAX_TX_PWR(label) DT_PROP(DT_NODELABEL(nrf70), label) * 4 -#endif /* CONFIG_NRF71_ON_IPC */ void configure_tx_pwr_settings(struct nrf_wifi_tx_pwr_ctrl_params *tx_pwr_ctrl_params, struct nrf_wifi_tx_pwr_ceil_params *tx_pwr_ceil_params) @@ -587,6 +585,7 @@ void configure_board_dep_params(struct nrf_wifi_board_params *board_params) board_params->pcb_loss_5g_band3 = CONFIG_NRF70_PCB_LOSS_5G_BAND3; #endif /* CONFIG_NRF70_2_4G_ONLY */ } +#endif /* CONFIG_NRF71_ON_IPC */ enum nrf_wifi_status nrf_wifi_fmac_dev_add_zep(struct nrf_wifi_drv_priv_zep *drv_priv_zep) { @@ -606,7 +605,6 @@ enum nrf_wifi_status nrf_wifi_fmac_dev_add_zep(struct nrf_wifi_drv_priv_zep *drv struct nrf_wifi_tx_pwr_ctrl_params tx_pwr_ctrl_params; struct nrf_wifi_tx_pwr_ceil_params tx_pwr_ceil_params; struct nrf_wifi_board_params board_params; - unsigned int fw_ver = 0; #if defined(CONFIG_NRF70_SR_COEX_SLEEP_CTRL_GPIO_CTRL) && \ @@ -654,10 +652,12 @@ enum nrf_wifi_status nrf_wifi_fmac_dev_add_zep(struct nrf_wifi_drv_priv_zep *drv NRF_WIFI_UMAC_VER_MIN(fw_ver), NRF_WIFI_UMAC_VER_EXTRA(fw_ver)); +#ifndef CONFIG_NRF71_ON_IPC configure_tx_pwr_settings(&tx_pwr_ctrl_params, &tx_pwr_ceil_params); configure_board_dep_params(&board_params); +#endif /* CONFIG_NRF71_ON_IPC */ #if defined(CONFIG_NRF70_SR_COEX_SLEEP_CTRL_GPIO_CTRL) && \ defined(CONFIG_NRF70_SYSTEM_MODE) @@ -853,9 +853,14 @@ static int nrf_wifi_drv_main_zep(const struct device *dev) struct nrf_wifi_sys_fmac_priv *sys_fpriv = NULL; sys_fpriv = wifi_fmac_priv(rpu_drv_priv_zep.fmac_priv); +#ifdef CONFIG_NRF71_ON_IPC + /* TODO: Revisit this */ + sys_fpriv->max_ampdu_len_per_token = 8192; +#else sys_fpriv->max_ampdu_len_per_token = (RPU_PKTRAM_SIZE - (CONFIG_NRF70_RX_NUM_BUFS * CONFIG_NRF70_RX_MAX_DATA_SIZE)) / CONFIG_NRF70_MAX_TX_TOKENS; +#endif /* CONFIG_NRF71_ON_IPC */ /* Align to 4-byte */ sys_fpriv->max_ampdu_len_per_token &= ~0x3; diff --git a/drivers/wifi/nrf_wifi/src/fw_load.c b/drivers/wifi/nrf_wifi/src/fw_load.c index f09643a585a8..cce5a98372fc 100644 --- a/drivers/wifi/nrf_wifi/src/fw_load.c +++ b/drivers/wifi/nrf_wifi/src/fw_load.c @@ -17,13 +17,17 @@ LOG_MODULE_DECLARE(wifi_nrf, CONFIG_WIFI_NRF70_LOG_LEVEL); #include +#ifndef CONFIG_NRF71_ON_IPC static const char fw_patch[] = { #include }; +#endif /* CONFIG_NRF71_ON_IPC */ enum nrf_wifi_status nrf_wifi_fw_load(void *rpu_ctx) { enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; + +#ifndef CONFIG_NRF71_ON_IPC struct nrf_wifi_fmac_fw_info fw_info = { 0 }; status = nrf_wifi_fmac_fw_parse(rpu_ctx, fw_patch, sizeof(fw_patch), &fw_info); @@ -31,13 +35,15 @@ enum nrf_wifi_status nrf_wifi_fw_load(void *rpu_ctx) LOG_ERR("%s: nrf_wifi_fmac_fw_parse failed", __func__); return status; } -#ifndef CONFIG_NRF71_ON_IPC + /* Load the FW patches to the RPU */ status = nrf_wifi_fmac_fw_load(rpu_ctx, &fw_info); if (status != NRF_WIFI_STATUS_SUCCESS) { LOG_ERR("%s: nrf_wifi_fmac_fw_load failed", __func__); } +#else + status = NRF_WIFI_STATUS_SUCCESS; #endif /* !CONFIG_NRF71_ON_IPC */ return status; } diff --git a/drivers/wifi/nrf_wifi/src/wifi_mgmt.c b/drivers/wifi/nrf_wifi/src/wifi_mgmt.c index e48ae31734a7..6bb31241b295 100644 --- a/drivers/wifi/nrf_wifi/src/wifi_mgmt.c +++ b/drivers/wifi/nrf_wifi/src/wifi_mgmt.c @@ -564,8 +564,9 @@ int nrf_wifi_set_twt(const struct device *dev, twt_info.dialog_token = twt_params->dialog_token; twt_info.twt_wake_ahead_duration = twt_params->setup.twt_wake_ahead_duration; +#ifndef CONFIG_NRF71_ON_IPC twt_info.twt_req_timeout = CONFIG_NRF_WIFI_TWT_SETUP_TIMEOUT_MS; - +#endif /* CONFIG_NRF71_ON_IPC */ status = nrf_wifi_sys_fmac_twt_setup(rpu_ctx_zep->rpu_ctx, vif_ctx_zep->vif_idx, &twt_info); diff --git a/drivers/wifi/nrf_wifi/src/wifi_util.c b/drivers/wifi/nrf_wifi/src/wifi_util.c index 4a8309434794..50c9e947229b 100644 --- a/drivers/wifi/nrf_wifi/src/wifi_util.c +++ b/drivers/wifi/nrf_wifi/src/wifi_util.c @@ -8,7 +8,11 @@ * @brief NRF Wi-Fi util shell module */ #include +#ifdef NRF71_ON_IPC +#include +#else #include "host_rpu_umac_if.h" +#endif #include "common/fmac_util.h" #include "system/fmac_api.h" #include "fmac_main.h" From 4ff669a5cea4b18f4a1f66f849734c8d5adae1ca Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Mon, 13 Oct 2025 22:13:38 +0530 Subject: [PATCH 1989/2141] [nrf fromtree] drivers: nrf_wifi: Rejig band config nRF71 supports tri-band, so, to cater both nRF70 and nRF71, rejig the configuration and add a helper to convert from Kconfig to the interface structs. Signed-off-by: Chaitanya Tata (cherry picked from commit 9a13407e3edc59ddf414d90b1e1c4d79fbfb4388) --- drivers/wifi/nrf_wifi/Kconfig.nrfwifi | 31 +++++++++---------- .../nrf_wifi/off_raw_tx/src/off_raw_tx_api.c | 22 ++++++++++++- drivers/wifi/nrf_wifi/src/fmac_main.c | 22 ++++++++++++- 3 files changed, 57 insertions(+), 18 deletions(-) diff --git a/drivers/wifi/nrf_wifi/Kconfig.nrfwifi b/drivers/wifi/nrf_wifi/Kconfig.nrfwifi index df4414a316e0..2021d25580ae 100644 --- a/drivers/wifi/nrf_wifi/Kconfig.nrfwifi +++ b/drivers/wifi/nrf_wifi/Kconfig.nrfwifi @@ -665,28 +665,27 @@ config WIFI_NRF70_SCAN_TIMEOUT_S int "Scan timeout in seconds" default 30 -menu "nRF Wi-Fi operation band(s)" - visible if !NRF70_2_4G_ONLY +choice NRF_WIFI_OP_BAND + prompt "nRF Wi-Fi operation bands" + default NRF_WIFI_2G_BAND if NRF70_2_4G_ONLY + default NRF_WIFI_ALL_BAND + +config NRF_WIFI_ALL_BAND + bool "Set operation band to all supported bands" config NRF_WIFI_2G_BAND bool "Set operation band to 2.4GHz" - default y if NRF70_2_4G_ONLY config NRF_WIFI_5G_BAND bool "Set operation band to 5GHz" - depends on !NRF70_2_4G_ONLY - -config NRF_WIFI_OP_BAND - int "Options to set operation band" - default 1 if NRF_WIFI_2G_BAND - default 2 if NRF_WIFI_5G_BAND - default 3 - help - Set this option to select frequency band - 1 - 2.4GHz - 2 - 5GHz - 3 - All ( 2.4GHz and 5GHz ) -endmenu +if NRF71_ON_IPC +config NRF_WIFI_6G_BAND + bool "Set operation band to 6GHz" + +config NRF_WIFI_DUAL_BAND + bool "Set operation band to 2.4GHz and 5GHz" +endif # NRF71_ON_IPC +endchoice config NRF_WIFI_IFACE_MTU int "MTU for Wi-Fi interface" diff --git a/drivers/wifi/nrf_wifi/off_raw_tx/src/off_raw_tx_api.c b/drivers/wifi/nrf_wifi/off_raw_tx/src/off_raw_tx_api.c index 17825511787b..1e53f70c111f 100644 --- a/drivers/wifi/nrf_wifi/off_raw_tx/src/off_raw_tx_api.c +++ b/drivers/wifi/nrf_wifi/off_raw_tx/src/off_raw_tx_api.c @@ -128,6 +128,25 @@ static int bytes_from_str(uint8_t *buf, int buf_len, const char *src) } #endif /* CONFIG_WIFI_FIXED_MAC_ADDRESS_ENABLED */ +static enum op_band get_nrf_wifi_op_band(void) +{ + if (IS_ENABLED(CONFIG_NRF_WIFI_2G_BAND)) { + return BAND_24G; + } +#ifdef CONFIG_NRF71_ON_IPC + if (IS_ENABLED(CONFIG_NRF_WIFI_5G_BAND)) { + return BAND_5G; + } + if (IS_ENABLED(CONFIG_NRF_WIFI_6G_BAND)) { + return BAND_6G; + } + if (IS_ENABLED(CONFIG_NRF_WIFI_DUAL_BAND)) { + return BAND_DUAL; + } +#endif /* CONFIG_NRF71_ON_IPC */ + return BAND_ALL; +} + int nrf70_off_raw_tx_init(uint8_t *mac_addr, unsigned char *country_code) { enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; @@ -138,6 +157,7 @@ int nrf70_off_raw_tx_init(uint8_t *mac_addr, unsigned char *country_code) struct nrf_wifi_board_params board_params; unsigned int fw_ver = 0; k_spinlock_key_t key; + enum op_band op_band = get_nrf_wifi_op_band(); /* The OSAL layer needs to be initialized before any other initialization * so that other layers (like FW IF,HW IF etc) have access to OS ops @@ -202,7 +222,7 @@ int nrf70_off_raw_tx_init(uint8_t *mac_addr, unsigned char *country_code) HW_SLEEP_ENABLE, #endif /* CONFIG_NRF_WIFI_LOW_POWER */ NRF_WIFI_DEF_PHY_CALIB, - CONFIG_NRF_WIFI_OP_BAND, + op_band, IS_ENABLED(CONFIG_NRF_WIFI_BEAMFORMING), &ctrl_params, &ceil_params, diff --git a/drivers/wifi/nrf_wifi/src/fmac_main.c b/drivers/wifi/nrf_wifi/src/fmac_main.c index 764cab93193e..47ca53d5a61c 100644 --- a/drivers/wifi/nrf_wifi/src/fmac_main.c +++ b/drivers/wifi/nrf_wifi/src/fmac_main.c @@ -587,12 +587,32 @@ void configure_board_dep_params(struct nrf_wifi_board_params *board_params) } #endif /* CONFIG_NRF71_ON_IPC */ +static enum op_band get_nrf_wifi_op_band(void) +{ + if (IS_ENABLED(CONFIG_NRF_WIFI_2G_BAND)) { + return BAND_24G; + } +#ifdef CONFIG_NRF71_ON_IPC + if (IS_ENABLED(CONFIG_NRF_WIFI_5G_BAND)) { + return BAND_5G; + } + + if (IS_ENABLED(CONFIG_NRF_WIFI_6G_BAND)) { + return BAND_6G; + } + if (IS_ENABLED(CONFIG_NRF_WIFI_DUAL_BAND)) { + return BAND_DUAL; + } +#endif /* CONFIG_NRF71_ON_IPC */ + return BAND_ALL; +} + enum nrf_wifi_status nrf_wifi_fmac_dev_add_zep(struct nrf_wifi_drv_priv_zep *drv_priv_zep) { enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; void *rpu_ctx = NULL; - enum op_band op_band = CONFIG_NRF_WIFI_OP_BAND; + enum op_band op_band = get_nrf_wifi_op_band(); #ifdef CONFIG_NRF_WIFI_LOW_POWER int sleep_type = -1; From 089f6a7baebde81960e822d9b2d7b71bbd64a431 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Tue, 16 Sep 2025 00:53:05 +0530 Subject: [PATCH 1990/2141] [nrf fromtree] manifest: nrf_wifi: Pull fix for max VIF check Fixes second interface bring up failure. Signed-off-by: Chaitanya Tata (cherry picked from commit e68f50d8416e03c6afabf79ee2f7d8e0b999a38a) --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 4df2b937a46d..b84f3e46eb9e 100644 --- a/west.yml +++ b/west.yml @@ -337,7 +337,7 @@ manifest: revision: 40403f5f2805cca210d2a47c8717d89c4e816cda path: modules/bsim_hw_models/nrf_hw_models - name: nrf_wifi - revision: 5fffeab6496932abb10f9dae53ed3686967aa050 + revision: acb24fe26f479df9dba3c4bd97ea653ad3086ee7 path: modules/lib/nrf_wifi - name: open-amp revision: c30a6d8b92fcebdb797fc1a7698e8729e250f637 From 9fde3d0f401c89dad1dea65e54afae30f91679be Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Tue, 30 Sep 2025 11:33:35 +0530 Subject: [PATCH 1991/2141] [nrf noup] manifest: nrf_wifi: Pull script to parse nRF70 FW stats blob A helper script is added to the nrf_wifi repo for parsing and dumping nRF70 FW stats blob. Note: "noup" to avoid churn by pulling min/max PR. Signed-off-by: Chaitanya Tata (cherry picked from commit b71d290405f2f591e77ec264d8b8c6c8b12e6d3e) --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index b84f3e46eb9e..f48b1fa31d1f 100644 --- a/west.yml +++ b/west.yml @@ -337,7 +337,7 @@ manifest: revision: 40403f5f2805cca210d2a47c8717d89c4e816cda path: modules/bsim_hw_models/nrf_hw_models - name: nrf_wifi - revision: acb24fe26f479df9dba3c4bd97ea653ad3086ee7 + revision: b822726084f55df19aa6660dc46cf602757e8645 path: modules/lib/nrf_wifi - name: open-amp revision: c30a6d8b92fcebdb797fc1a7698e8729e250f637 From cdfeb62ee70a401c160fe4951fc9391bbc51be52 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Tue, 30 Sep 2025 20:56:48 +0530 Subject: [PATCH 1992/2141] [nrf fromtree] manifest: nrf_wifi: Pull nRF71 support Pull nRF71 OSAL support, full support is till TBD. Signed-off-by: Chaitanya Tata (cherry picked from commit 9f8bb3cda365a061d8713a8533d37e6db29f9522) --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index f48b1fa31d1f..d3df0b617955 100644 --- a/west.yml +++ b/west.yml @@ -337,7 +337,7 @@ manifest: revision: 40403f5f2805cca210d2a47c8717d89c4e816cda path: modules/bsim_hw_models/nrf_hw_models - name: nrf_wifi - revision: b822726084f55df19aa6660dc46cf602757e8645 + revision: e269670cd17fb8ccc4b7004544276bc7d9578496 path: modules/lib/nrf_wifi - name: open-amp revision: c30a6d8b92fcebdb797fc1a7698e8729e250f637 From c6dbf158a0b8c45beb78aa76412d99f60cd6467f Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Mon, 20 Oct 2025 20:29:22 +0530 Subject: [PATCH 1993/2141] [nrf fromtree] ipc: icmsg: Increase default stack size For nRF71 Wi-Fi a higher stack size is needed. Signed-off-by: Chaitanya Tata (cherry picked from commit 05899583fdcd1d2a10e0ef3ca619fe5c57367041) --- subsys/ipc/ipc_service/lib/Kconfig.icmsg | 1 + 1 file changed, 1 insertion(+) diff --git a/subsys/ipc/ipc_service/lib/Kconfig.icmsg b/subsys/ipc/ipc_service/lib/Kconfig.icmsg index 6bbc79d4fa2a..fa84c399ffb5 100644 --- a/subsys/ipc/ipc_service/lib/Kconfig.icmsg +++ b/subsys/ipc/ipc_service/lib/Kconfig.icmsg @@ -43,6 +43,7 @@ if IPC_SERVICE_BACKEND_ICMSG_WQ_ENABLE config IPC_SERVICE_BACKEND_ICMSG_WQ_STACK_SIZE int "Size of RX work queue stack" + default 5400 if NRF71_ON_IPC default 1280 help Size of stack used by work queue RX thread. This work queue is From 1b82b097aa67086d5a326049ebcb23510ddab77a Mon Sep 17 00:00:00 2001 From: Bartosz Miller Date: Mon, 20 Oct 2025 16:25:16 +0200 Subject: [PATCH 1994/2141] [nrf fromtree] tests: drivers: flash: Add test with buffer size over the bus packet limit Applicable to flash devices with MSPI controller Signed-off-by: Bartosz Miller (cherry picked from commit a8bf08bf4e2f43ab915ae35b0a4e7418f7f978a8) --- .../common/boards/mx25uw63_low_freq.overlay | 1 + .../common/boards/mx25uw63_single_io.overlay | 1 + .../mx25uw63_single_io_4B_addr_sreset.overlay | 2 +- tests/drivers/flash/common/src/main.c | 38 +++++++++++++++++++ 4 files changed, 41 insertions(+), 1 deletion(-) diff --git a/tests/drivers/flash/common/boards/mx25uw63_low_freq.overlay b/tests/drivers/flash/common/boards/mx25uw63_low_freq.overlay index 950005eaf5c2..8dacdb15ff55 100644 --- a/tests/drivers/flash/common/boards/mx25uw63_low_freq.overlay +++ b/tests/drivers/flash/common/boards/mx25uw63_low_freq.overlay @@ -7,4 +7,5 @@ &mx25uw63 { status = "okay"; mspi-max-frequency = ; + transfer-timeout = <500>; }; diff --git a/tests/drivers/flash/common/boards/mx25uw63_single_io.overlay b/tests/drivers/flash/common/boards/mx25uw63_single_io.overlay index 062020aea353..ac06662e9526 100644 --- a/tests/drivers/flash/common/boards/mx25uw63_single_io.overlay +++ b/tests/drivers/flash/common/boards/mx25uw63_single_io.overlay @@ -58,4 +58,5 @@ status = "okay"; mspi-max-frequency = ; mspi-io-mode = "MSPI_IO_MODE_SINGLE"; + transfer-timeout = <500>; }; diff --git a/tests/drivers/flash/common/boards/mx25uw63_single_io_4B_addr_sreset.overlay b/tests/drivers/flash/common/boards/mx25uw63_single_io_4B_addr_sreset.overlay index 587d68546561..09af484cc212 100644 --- a/tests/drivers/flash/common/boards/mx25uw63_single_io_4B_addr_sreset.overlay +++ b/tests/drivers/flash/common/boards/mx25uw63_single_io_4B_addr_sreset.overlay @@ -40,7 +40,6 @@ ; }; }; - }; &gpio6 { @@ -61,4 +60,5 @@ mspi-io-mode = "MSPI_IO_MODE_SINGLE"; use-4byte-addressing; initial-soft-reset; + transfer-timeout = <500>; }; diff --git a/tests/drivers/flash/common/src/main.c b/tests/drivers/flash/common/src/main.c index b629c39ebc51..df484f825e89 100644 --- a/tests/drivers/flash/common/src/main.c +++ b/tests/drivers/flash/common/src/main.c @@ -65,6 +65,11 @@ #error There is no flash device enabled or it is missing Kconfig options #endif +#if DT_NODE_HAS_PROP(DT_BUS(TEST_AREA_DEV_NODE), packet_data_limit) +#define CONTROLLER_PACKET_DATA_LIMIT DT_PROP(DT_BUS(TEST_AREA_DEV_NODE), packet_data_limit) +#define BUFFER_SIZE_OVER_PACKET_LIMIT CONTROLLER_PACKET_DATA_LIMIT + 1 +#endif + static const struct device *const flash_dev = TEST_AREA_DEVICE; static struct flash_pages_info page_info; static uint8_t __aligned(4) expected[EXPECTED_SIZE]; @@ -328,6 +333,39 @@ ZTEST(flash_driver, test_flash_erase) zassert_not_equal(expected[0], erase_value, "These values shall be different"); } +ZTEST(flash_driver, test_flash_write_read_over_the_packet_limit) +{ + +#if !defined(CONTROLLER_PACKET_DATA_LIMIT) + TC_PRINT("Given bus controller does not have 'packet_data_limit' property\n"); + ztest_test_skip(); +#else + int rc; + const uint8_t pattern = 0xA1; + static uint8_t large_data_buf[BUFFER_SIZE_OVER_PACKET_LIMIT]; + + /* Flatten area corresponding to the size of two packets */ + rc = flash_flatten(flash_dev, page_info.start_offset, 2 * CONTROLLER_PACKET_DATA_LIMIT); + zassert_equal(rc, 0, "Flash flatten failed: %d", rc); + + /* Fill flash area with buffer size over the configured packet limit */ + rc = flash_fill(flash_dev, pattern, page_info.start_offset, BUFFER_SIZE_OVER_PACKET_LIMIT); + zassert_equal(rc, 0, "Flash fill failed"); + + /* Read flash area with buffer size over the MSPI packet limit */ + rc = flash_read(flash_dev, page_info.start_offset, large_data_buf, + BUFFER_SIZE_OVER_PACKET_LIMIT); + zassert_equal(rc, 0, "Flash read failed"); + + /* Compare read data to the pre-defined pattern */ + for (int i = 0; i < BUFFER_SIZE_OVER_PACKET_LIMIT; i++) { + zassert_equal(large_data_buf[i], pattern, + "large_data_buf[%u]=%x read, does not match written pattern %x", i, + large_data_buf[i], pattern); + } +#endif +} + ZTEST(flash_driver, test_supply_gpios_control) { if (!DT_NODE_HAS_PROP(TEST_AREA_DEV_NODE, supply_gpios)) { From 58a079002583362e1997688d8863d8b7308ec27d Mon Sep 17 00:00:00 2001 From: Sergey Korotkov Date: Fri, 31 Oct 2025 12:48:07 +0100 Subject: [PATCH 1995/2141] Revert "[nrf noup] boards: nordic: Enable PSA RNG for nrf54h20" This reverts commit 1fdb6926acfe2c0da67cdafce4072aa02d4098ce. Signed-off-by: Sergey Korotkov --- .../nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 7 +------ .../nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts | 16 +++++----------- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index 532e5d2eccc0..d45f91c908bf 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -27,7 +27,7 @@ zephyr,bt-hci = &bt_hci_ipc0; nordic,802154-spinel-ipc = &ipc0; zephyr,canbus = &can120; - zephyr,entropy = &psa_rng; + zephyr,entropy = &prng; }; aliases { @@ -113,11 +113,6 @@ prng: prng { compatible = "nordic,entropy-prng"; - status = "disabled"; - }; - - psa_rng: psa-rng { - compatible = "zephyr,psa-crypto-rng"; status = "okay"; }; }; diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts index 81241af8a64e..6aa0158afab1 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts @@ -28,22 +28,16 @@ zephyr,ieee802154 = &cpurad_ieee802154; zephyr,bt-hci-ipc = &ipc0; nordic,802154-spinel-ipc = &ipc0; - zephyr,entropy = &psa_rng; + zephyr,entropy = &prng; }; - - aliases { - ipc-to-cpusys = &cpurad_cpusys_ipc; - resetinfo = &cpurad_resetinfo; - }; - prng: prng { compatible = "nordic,entropy-prng"; - status = "disabled"; + status = "okay"; }; - psa_rng: psa-rng { - compatible = "zephyr,psa-crypto-rng"; - status = "okay"; + aliases { + ipc-to-cpusys = &cpurad_cpusys_ipc; + resetinfo = &cpurad_resetinfo; }; }; From 94e6e06d26955da7a8a08426c7fefe0c6303eb6e Mon Sep 17 00:00:00 2001 From: Sergey Korotkov Date: Fri, 31 Oct 2025 12:48:36 +0100 Subject: [PATCH 1996/2141] Revert "[nrf noup] dts: arm: nordic: remove L20 dts" This reverts commit 29aa21b8ac8e738fa6854e2127833c0e1613e101. Signed-off-by: Sergey Korotkov --- dts/arm/nordic/nrf54l20_enga_cpuapp.dtsi | 125 +++++++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 dts/arm/nordic/nrf54l20_enga_cpuapp.dtsi diff --git a/dts/arm/nordic/nrf54l20_enga_cpuapp.dtsi b/dts/arm/nordic/nrf54l20_enga_cpuapp.dtsi new file mode 100644 index 000000000000..5c7e5db30014 --- /dev/null +++ b/dts/arm/nordic/nrf54l20_enga_cpuapp.dtsi @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +cpu: &cpuapp {}; +systick: &cpuapp_systick {}; +nvic: &cpuapp_nvic {}; + +/delete-node/ &cpuflpr; +/delete-node/ &cpuflpr_rram; +/delete-node/ &cpuflpr_sram; +/delete-node/ &cpuflpr_clic; + +/ { + chosen { + zephyr,entropy = &prng; + }; + + soc { + compatible = "simple-bus"; + interrupt-parent = <&cpuapp_nvic>; + ranges; + }; + + psa_rng: psa-rng { + compatible = "zephyr,psa-crypto-rng"; + status = "disabled"; + }; + + prng: prng { + compatible = "nordic,entropy-prng"; + status = "okay"; + }; +}; + +&cpuflpr_vpr { + cpuapp_vevif_rx: mailbox@1 { + compatible = "nordic,nrf-vevif-event-rx"; + reg = <0x0 0x1000>; + status = "disabled"; + interrupts = <76 NRF_DEFAULT_IRQ_PRIORITY>; + #mbox-cells = <1>; + nordic,events = <1>; + nordic,events-mask = <0x00100000>; + }; + + cpuapp_vevif_tx: mailbox@0 { + compatible = "nordic,nrf-vevif-task-tx"; + reg = <0x0 0x1000>; + #mbox-cells = <1>; + nordic,tasks = <7>; + nordic,tasks-mask = <0x007f0000>; + status = "disabled"; + }; +}; + +&cpuapp_ppb { + compatible = "simple-bus"; + ranges; +}; + +&grtc { + interrupts = <228 NRF_DEFAULT_IRQ_PRIORITY>, + <229 NRF_DEFAULT_IRQ_PRIORITY>; /* reserved for Zero Latency IRQs */ +}; + +&gpiote20 { + interrupts = <219 NRF_DEFAULT_IRQ_PRIORITY>; +}; + +&gpiote30 { + interrupts = <269 NRF_DEFAULT_IRQ_PRIORITY>; +}; + +&dppic00 { + status = "okay"; +}; + +&dppic10 { + status = "okay"; +}; + +&dppic20 { + status = "okay"; +}; + +&dppic30 { + status = "okay"; +}; + +&ppib00 { + status = "okay"; +}; + +&ppib01 { + status = "okay"; +}; + +&ppib10 { + status = "okay"; +}; + +&ppib11 { + status = "okay"; +}; + +&ppib20 { + status = "okay"; +}; + +&ppib21 { + status = "okay"; +}; + +&ppib22 { + status = "okay"; +}; + +&ppib30 { + status = "okay"; +}; From 29e9cb282c37555d0e19a7ebdf7eaf9aab428564 Mon Sep 17 00:00:00 2001 From: Sergey Korotkov Date: Fri, 31 Oct 2025 12:49:10 +0100 Subject: [PATCH 1997/2141] Revert "[nrf noup] entropy: Add fake entropy nRF PRNG driver" This reverts commit dbd3934e5f2e83e4ae84fb549c72852eadca6b16. Signed-off-by: Sergey Korotkov --- .../nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 6 - .../nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts | 5 - .../nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts | 6 - .../nrf9280pdk/nrf9280pdk_nrf9280_cpurad.dts | 5 - drivers/entropy/CMakeLists.txt | 7 - drivers/entropy/Kconfig | 1 - drivers/entropy/Kconfig.nrf_prng | 19 --- drivers/entropy/fake_entropy_nrf_prng.c | 101 -------------- dts/arm/nordic/nrf54l20_enga_cpuapp.dtsi | 125 ------------------ dts/bindings/rng/nordic,nrf-prng.yaml | 8 -- 10 files changed, 283 deletions(-) delete mode 100644 drivers/entropy/Kconfig.nrf_prng delete mode 100644 drivers/entropy/fake_entropy_nrf_prng.c delete mode 100644 dts/arm/nordic/nrf54l20_enga_cpuapp.dtsi delete mode 100644 dts/bindings/rng/nordic,nrf-prng.yaml diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index d45f91c908bf..715eedeb0e8a 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -27,7 +27,6 @@ zephyr,bt-hci = &bt_hci_ipc0; nordic,802154-spinel-ipc = &ipc0; zephyr,canbus = &can120; - zephyr,entropy = &prng; }; aliases { @@ -110,11 +109,6 @@ pwms = <&pwm130 0 PWM_MSEC(20) PWM_POLARITY_NORMAL>; }; }; - - prng: prng { - compatible = "nordic,entropy-prng"; - status = "okay"; - }; }; &cpuapp_bellboard { diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts index 6aa0158afab1..d5fea020431f 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts @@ -28,11 +28,6 @@ zephyr,ieee802154 = &cpurad_ieee802154; zephyr,bt-hci-ipc = &ipc0; nordic,802154-spinel-ipc = &ipc0; - zephyr,entropy = &prng; - }; - prng: prng { - compatible = "nordic,entropy-prng"; - status = "okay"; }; aliases { diff --git a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts index 8920d7966bbf..622fc04e96af 100644 --- a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts +++ b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts @@ -26,7 +26,6 @@ zephyr,shell-uart = &uart136; zephyr,bt-hci = &bt_hci_ipc0; nordic,802154-spinel-ipc = &ipc0; - zephyr,entropy = &prng; }; aliases { @@ -108,11 +107,6 @@ pwms = <&pwm130 0 PWM_MSEC(20) PWM_POLARITY_NORMAL>; }; }; - - prng: prng { - compatible = "nordic,entropy-prng"; - status = "okay"; - }; }; &cpuapp_ram0x_region { diff --git a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpurad.dts b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpurad.dts index d6c03bc4a514..5efa7dbd471c 100644 --- a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpurad.dts +++ b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpurad.dts @@ -28,11 +28,6 @@ zephyr,ieee802154 = &cpurad_ieee802154; zephyr,bt-hci-ipc = &ipc0; nordic,802154-spinel-ipc = &ipc0; - zephyr,entropy = &prng; - }; - prng: prng { - compatible = "nordic,entropy-prng"; - status = "okay"; }; aliases { diff --git a/drivers/entropy/CMakeLists.txt b/drivers/entropy/CMakeLists.txt index 6f6c20b7a60f..541be8478b16 100644 --- a/drivers/entropy/CMakeLists.txt +++ b/drivers/entropy/CMakeLists.txt @@ -43,11 +43,4 @@ zephyr_library_sources_ifdef(CONFIG_ENTROPY_TELINK_B91_TRNG entropy_b91_trng zephyr_library_sources_ifdef(CONFIG_ENTROPY_VIRTIO entropy_virtio.c) # zephyr-keep-sorted-stop -if (CONFIG_FAKE_ENTROPY_NRF_PRNG) - zephyr_library_sources(fake_entropy_nrf_prng.c) - - message(WARNING "\nA nRF PRNG is used, which does not produce real random bits." - "This is not secure and should therefore never be used in a product.") -endif() - zephyr_library_link_libraries_ifdef(CONFIG_BUILD_WITH_TFM tfm_api) diff --git a/drivers/entropy/Kconfig b/drivers/entropy/Kconfig index bab82a83f2ca..59b93ccf022b 100644 --- a/drivers/entropy/Kconfig +++ b/drivers/entropy/Kconfig @@ -37,7 +37,6 @@ source "drivers/entropy/Kconfig.neorv32" source "drivers/entropy/Kconfig.npcx" source "drivers/entropy/Kconfig.nrf5" source "drivers/entropy/Kconfig.nrf_cracen" -source "drivers/entropy/Kconfig.nrf_prng" source "drivers/entropy/Kconfig.nxp" source "drivers/entropy/Kconfig.psa_crypto" source "drivers/entropy/Kconfig.renesas_ra" diff --git a/drivers/entropy/Kconfig.nrf_prng b/drivers/entropy/Kconfig.nrf_prng deleted file mode 100644 index e81db4de4b15..000000000000 --- a/drivers/entropy/Kconfig.nrf_prng +++ /dev/null @@ -1,19 +0,0 @@ -# nRF fake entropy prng generator driver configuration - -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -if ENTROPY_GENERATOR - -config FAKE_ENTROPY_NRF_PRNG - bool "A fake nRF entropy driver" - default y - depends on DT_HAS_NORDIC_ENTROPY_PRNG_ENABLED - depends on (SOC_SERIES_NRF54HX || SOC_SERIES_NRF92X || SOC_SERIES_NRF54LX) - select ENTROPY_HAS_DRIVER - help - This is a super simple PRNG driver that can be used on nRF platforms that - do not have an entropy source. - This is NOT SAFE to use for cryptographic operations! - -endif diff --git a/drivers/entropy/fake_entropy_nrf_prng.c b/drivers/entropy/fake_entropy_nrf_prng.c deleted file mode 100644 index 8624c8444057..000000000000 --- a/drivers/entropy/fake_entropy_nrf_prng.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include -#include -#include -#include - -#define DT_DRV_COMPAT nordic_entropy_prng - -/* This file implements a pseudo-RNG - * https://vigna.di.unimi.it/xorshift/xoshiro128plus.c - */ - -static uint32_t s[4]; - -static inline uint32_t rotl(const uint32_t x, int k) -{ - return (x << k) | (x >> (32 - k)); -} - -static uint32_t rng_next(void) -{ - const uint32_t result = rotl(s[0] + s[3], 7) + s[0]; - - const uint32_t t = s[1] << 9; - - s[2] ^= s[0]; - s[3] ^= s[1]; - s[1] ^= s[2]; - s[0] ^= s[3]; - - s[2] ^= t; - - s[3] = rotl(s[3], 11); - - return result; -} - -static int entropy_prng_get_entropy(const struct device *dev, uint8_t *buffer, uint16_t length) -{ - ARG_UNUSED(dev); - - while (length) { - /* - * Note that only 1 thread (Zephyr thread or HW models), runs at - * a time, therefore there is no need to use random_r() - */ - uint32_t value = rng_next(); - - size_t to_copy = MIN(length, sizeof(long)); - - memcpy(buffer, &value, to_copy); - buffer += to_copy; - length -= to_copy; - } - - return 0; -} - -static int entropy_prng_get_entropy_isr(const struct device *dev, uint8_t *buf, uint16_t len, - uint32_t flags) -{ - ARG_UNUSED(flags); - - int err; - - /* - * entropy_prng_get_entropy() is also safe for ISRs - * and always produces data. - */ - err = entropy_prng_get_entropy(dev, buf, len); - if (err < 0) { - return err; - } else { - return len; - } -} - -static int entropy_prng_init(const struct device *dev) -{ - ARG_UNUSED(dev); - - /* Picked some arbitrary initial seed. */ - s[0] = 0xAF568BC0; - s[1] = 0xAC34307E; - s[2] = 0x9B7F6DD1; - s[3] = 0xD84319FC; - return 0; -} - -static const struct entropy_driver_api entropy_prng_api_funcs = { - .get_entropy = entropy_prng_get_entropy, .get_entropy_isr = entropy_prng_get_entropy_isr}; - -DEVICE_DT_INST_DEFINE(0, entropy_prng_init, NULL, NULL, NULL, PRE_KERNEL_1, - CONFIG_ENTROPY_INIT_PRIORITY, &entropy_prng_api_funcs); diff --git a/dts/arm/nordic/nrf54l20_enga_cpuapp.dtsi b/dts/arm/nordic/nrf54l20_enga_cpuapp.dtsi deleted file mode 100644 index 5c7e5db30014..000000000000 --- a/dts/arm/nordic/nrf54l20_enga_cpuapp.dtsi +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include - -cpu: &cpuapp {}; -systick: &cpuapp_systick {}; -nvic: &cpuapp_nvic {}; - -/delete-node/ &cpuflpr; -/delete-node/ &cpuflpr_rram; -/delete-node/ &cpuflpr_sram; -/delete-node/ &cpuflpr_clic; - -/ { - chosen { - zephyr,entropy = &prng; - }; - - soc { - compatible = "simple-bus"; - interrupt-parent = <&cpuapp_nvic>; - ranges; - }; - - psa_rng: psa-rng { - compatible = "zephyr,psa-crypto-rng"; - status = "disabled"; - }; - - prng: prng { - compatible = "nordic,entropy-prng"; - status = "okay"; - }; -}; - -&cpuflpr_vpr { - cpuapp_vevif_rx: mailbox@1 { - compatible = "nordic,nrf-vevif-event-rx"; - reg = <0x0 0x1000>; - status = "disabled"; - interrupts = <76 NRF_DEFAULT_IRQ_PRIORITY>; - #mbox-cells = <1>; - nordic,events = <1>; - nordic,events-mask = <0x00100000>; - }; - - cpuapp_vevif_tx: mailbox@0 { - compatible = "nordic,nrf-vevif-task-tx"; - reg = <0x0 0x1000>; - #mbox-cells = <1>; - nordic,tasks = <7>; - nordic,tasks-mask = <0x007f0000>; - status = "disabled"; - }; -}; - -&cpuapp_ppb { - compatible = "simple-bus"; - ranges; -}; - -&grtc { - interrupts = <228 NRF_DEFAULT_IRQ_PRIORITY>, - <229 NRF_DEFAULT_IRQ_PRIORITY>; /* reserved for Zero Latency IRQs */ -}; - -&gpiote20 { - interrupts = <219 NRF_DEFAULT_IRQ_PRIORITY>; -}; - -&gpiote30 { - interrupts = <269 NRF_DEFAULT_IRQ_PRIORITY>; -}; - -&dppic00 { - status = "okay"; -}; - -&dppic10 { - status = "okay"; -}; - -&dppic20 { - status = "okay"; -}; - -&dppic30 { - status = "okay"; -}; - -&ppib00 { - status = "okay"; -}; - -&ppib01 { - status = "okay"; -}; - -&ppib10 { - status = "okay"; -}; - -&ppib11 { - status = "okay"; -}; - -&ppib20 { - status = "okay"; -}; - -&ppib21 { - status = "okay"; -}; - -&ppib22 { - status = "okay"; -}; - -&ppib30 { - status = "okay"; -}; diff --git a/dts/bindings/rng/nordic,nrf-prng.yaml b/dts/bindings/rng/nordic,nrf-prng.yaml deleted file mode 100644 index 8936393a0b65..000000000000 --- a/dts/bindings/rng/nordic,nrf-prng.yaml +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - -description: This is a super simple PRNG - -compatible: "nordic,entropy-prng" - -include: base.yaml From b7a8e8371dcc3ba31c530174640c9001c29b34e7 Mon Sep 17 00:00:00 2001 From: Georgios Vasilakis Date: Thu, 5 Sep 2024 10:41:36 +0200 Subject: [PATCH 1998/2141] [nrf noup] boards: nordic: Enable PSA RNG for nrf54h20 Noup since Ironside not available upstream and it is required for PSA RNG. This enables the PSA RNG as the default Zephyr entropy provider for the nrf54h20dk cpuapp and cpurad targets. Signed-off-by: Georgios Vasilakis Signed-off-by: Sergey Korotkov --- boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 6 ++++++ boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index 715eedeb0e8a..e2d5b08cd300 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -27,6 +27,7 @@ zephyr,bt-hci = &bt_hci_ipc0; nordic,802154-spinel-ipc = &ipc0; zephyr,canbus = &can120; + zephyr,entropy = &psa_rng; }; aliases { @@ -109,6 +110,11 @@ pwms = <&pwm130 0 PWM_MSEC(20) PWM_POLARITY_NORMAL>; }; }; + + psa_rng: psa-rng { + compatible = "zephyr,psa-crypto-rng"; + status = "okay"; + }; }; &cpuapp_bellboard { diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts index d5fea020431f..4a8f5972227f 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts @@ -28,12 +28,18 @@ zephyr,ieee802154 = &cpurad_ieee802154; zephyr,bt-hci-ipc = &ipc0; nordic,802154-spinel-ipc = &ipc0; + zephyr,entropy = &psa_rng; }; aliases { ipc-to-cpusys = &cpurad_cpusys_ipc; resetinfo = &cpurad_resetinfo; }; + + psa_rng: psa-rng { + compatible = "zephyr,psa-crypto-rng"; + status = "okay"; + }; }; &cpurad_bellboard { From c1c66b9cffad1fea2d0b9d4c028f33ebe438dc3f Mon Sep 17 00:00:00 2001 From: Sergey Korotkov Date: Fri, 31 Oct 2025 13:02:15 +0100 Subject: [PATCH 1999/2141] [nrf noup] boards: nordic: Enable PSA RNG for nrf9280 Noup since Ironside not available upstream and it is required for PSA RNG. This enables the PSA RNG as the default Zephyr entropy provider for the nrf9280pdk cpuapp and cpurad targets. Signed-off-by: Sergey Korotkov --- boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts | 6 ++++++ boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpurad.dts | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts index 622fc04e96af..19dd5e208063 100644 --- a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts +++ b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts @@ -26,6 +26,7 @@ zephyr,shell-uart = &uart136; zephyr,bt-hci = &bt_hci_ipc0; nordic,802154-spinel-ipc = &ipc0; + zephyr,entropy = &psa_rng; }; aliases { @@ -107,6 +108,11 @@ pwms = <&pwm130 0 PWM_MSEC(20) PWM_POLARITY_NORMAL>; }; }; + + psa_rng: psa-rng { + compatible = "zephyr,psa-crypto-rng"; + status = "okay"; + }; }; &cpuapp_ram0x_region { diff --git a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpurad.dts b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpurad.dts index 5efa7dbd471c..91d967ea34aa 100644 --- a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpurad.dts +++ b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpurad.dts @@ -28,12 +28,18 @@ zephyr,ieee802154 = &cpurad_ieee802154; zephyr,bt-hci-ipc = &ipc0; nordic,802154-spinel-ipc = &ipc0; + zephyr,entropy = &psa_rng; }; aliases { ipc-to-cpusys = &cpurad_cpusys_ipc; resetinfo = &cpurad_resetinfo; }; + + psa_rng: psa-rng { + compatible = "zephyr,psa-crypto-rng"; + status = "okay"; + }; }; &cpuapp_cpurad_ram0x_region { From d7669eff2b94ea4805103474456ba34a5766b9b1 Mon Sep 17 00:00:00 2001 From: Tomasz Chyrowicz Date: Tue, 28 Oct 2025 18:20:13 +0100 Subject: [PATCH 2000/2141] [nrf fromtree] mgmt: Handle slot version equality If slots have equal version, but a secondary slot is the active one, the next boot will switch to the primary slot. Expose this through SMP commands by marking the primary slot as pending. Signed-off-by: Tomasz Chyrowicz (cherry picked from commit 1b50f08ee9500dbdd428b093dba5dfc1f2568d6a) --- .../mcumgr/grp/img_mgmt/src/img_mgmt_state.c | 40 ++++++++++++++++--- 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt_state.c b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt_state.c index dbb496fb3b33..0ebb722c2a90 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt_state.c +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt_state.c @@ -127,21 +127,30 @@ img_mgmt_state_flags(int query_slot) int image = query_slot / 2; /* We support max 2 images for now */ int active_slot = img_mgmt_active_slot(image); - /* In case when MCUboot is configured for DirectXIP slot may only be - * active or pending. Slot is marked pending only when version in that slot - * is higher than version of active slot. + /* In case when MCUboot is configured for FW loader/updater mode, slots + * can be either active or non-active. There is no concept of pending + * or confirmed slots. + * + * In case when MCUboot is configured for DirectXIP slot may only be + * active or pending. + * Slot is marked as pending when: + * - version in that slot is higher than version of active slot. + * - versions are equal but slot number is lower than the active slot. */ if (image == img_mgmt_active_image() && query_slot == active_slot) { flags = IMG_MGMT_STATE_F_ACTIVE; +#ifdef CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP } else { struct image_version sver; struct image_version aver; int rcs = img_mgmt_read_info(query_slot, &sver, NULL, NULL); int rca = img_mgmt_read_info(active_slot, &aver, NULL, NULL); - if (rcs == 0 && rca == 0 && img_mgmt_vercmp(&aver, &sver) < 0) { + if (rcs == 0 && rca == 0 && ((img_mgmt_vercmp(&aver, &sver) < 0) || + ((img_mgmt_vercmp(&aver, &sver) == 0) && (active_slot > query_slot)))) { flags = IMG_MGMT_STATE_F_PENDING | IMG_MGMT_STATE_F_PERMANENT; } +#endif /* CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP */ } return flags; @@ -285,18 +294,37 @@ int img_mgmt_get_next_boot_slot(int image, enum img_mgmt_next_boot_type *type) if (active_slot_state == DIRECT_XIP_BOOT_ONCE) { lt = NEXT_BOOT_TYPE_TEST; } - } else if (img_mgmt_vercmp(&aver, &over) < 0) { + } else if ((img_mgmt_vercmp(&aver, &over) < 0) || + ((img_mgmt_vercmp(&aver, &over) == 0) && (active_slot > other_slot))) { + /* Check if MCUboot will select the non-active slot during the next boot. + * The logic is as follows: + * - If both slots are valid, a slot with higher version is preferred. + * - If both slots are valid and the versions are equal, a slot with lower number + * is preferred. + */ if (other_slot_state == DIRECT_XIP_BOOT_FOREVER) { return_slot = other_slot; } else if (other_slot_state == DIRECT_XIP_BOOT_ONCE) { lt = NEXT_BOOT_TYPE_TEST; return_slot = other_slot; } + } else { + /* There is neither a preference nor a necessity to boot the other slot. + * The active slot will be used again. + */ } out: #else - if (rcs == 0 && rca == 0 && img_mgmt_vercmp(&aver, &over) < 0) { + if (rcs == 0 && rca == 0 && + ((img_mgmt_vercmp(&aver, &over) < 0) || + ((img_mgmt_vercmp(&aver, &over) == 0) && (active_slot > other_slot)))) { + /* Check if MCUboot will select the non-active slot during the next boot. + * The logic is as follows: + * - If both slots are valid, a slot with higher version is preferred. + * - If both slots are valid and the versions are equal, a slot with lower number + * is preferred. + */ return_slot = other_slot; } #endif /* defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP_WITH_REVERT) */ From 2cb93294e753dfcb513032e3c438d8f394811c93 Mon Sep 17 00:00:00 2001 From: David Jewsbury Date: Wed, 15 Oct 2025 18:15:25 +0100 Subject: [PATCH 2001/2141] [nrf fromtree] dts: nordic: Add nrf-qspi-v2 binding The nrf-qspi-v2 peripheral is similar to EXMIF on nrf54h20 but supports DMA and slave-mode. The wrapper around the SSI IP is also different with DMA features. Signed-off-by: David Jewsbury (cherry picked from commit 72dd539cbacd344fc6fdb79d82b9c8378dbe2aca) --- dts/bindings/mspi/nordic,nrf-qspi-v2.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 dts/bindings/mspi/nordic,nrf-qspi-v2.yaml diff --git a/dts/bindings/mspi/nordic,nrf-qspi-v2.yaml b/dts/bindings/mspi/nordic,nrf-qspi-v2.yaml new file mode 100644 index 000000000000..5ad8a6fd2452 --- /dev/null +++ b/dts/bindings/mspi/nordic,nrf-qspi-v2.yaml @@ -0,0 +1,8 @@ +# Copyright (c) 2025 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: Nordic QSPI v2 Interface using SSI IP + +compatible: "nordic,nrf-qspi-v2" + +include: snps,designware-ssi.yaml From 084c26905ef642371b246a1ccda762ec02187376 Mon Sep 17 00:00:00 2001 From: David Jewsbury Date: Wed, 13 Aug 2025 16:48:39 +0100 Subject: [PATCH 2002/2141] [nrf fromtree] drivers: pinctrl: nrf: add support for MSPI Support for new MSPI peripheral where there is no PSEL so pins are setup through CTRLSEL. Signed-off-by: David Jewsbury (cherry picked from commit ac94ca7894df365aa8bbfa4c640932bd8ba26cf2) --- drivers/pinctrl/pinctrl_nrf.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/pinctrl/pinctrl_nrf.c b/drivers/pinctrl/pinctrl_nrf.c index 465fe9961f73..3ad358158a80 100644 --- a/drivers/pinctrl/pinctrl_nrf.c +++ b/drivers/pinctrl/pinctrl_nrf.c @@ -499,6 +499,19 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, input = NRF_GPIO_PIN_INPUT_DISCONNECT; break; #endif /* DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_exmif) */ +#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_qspi_v2) + /* No PSEL for QSPI_V2, pins only controlled by CTRLSEL */ + case NRF_FUN_QSPI_SCK: + case NRF_FUN_QSPI_CSN: + case NRF_FUN_QSPI_IO0: + case NRF_FUN_QSPI_IO1: + case NRF_FUN_QSPI_IO2: + case NRF_FUN_QSPI_IO3: + nrf_gpio_pin_control_select(psel, NRF_GPIO_PIN_SEL_QSPI); + dir = NRF_GPIO_PIN_DIR_OUTPUT; + input = NRF_GPIO_PIN_INPUT_CONNECT; + break; +#endif /* DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_qspi_v2) */ #if defined(NRF_PSEL_TWIS) case NRF_FUN_TWIS_SCL: NRF_PSEL_TWIS(reg, SCL) = psel; From 3507b2f542edd022a4d80401b6743bff58dba81c Mon Sep 17 00:00:00 2001 From: David Jewsbury Date: Thu, 4 Sep 2025 11:36:45 +0100 Subject: [PATCH 2003/2141] [nrf fromtree] drivers: mspi: Add timeout callback to MSPI API This is a new callback option that drivers can use for when a request or xfer has timed out. E.g if an Async RX request never received anything, this callback can be used so a user can clean up their application. Signed-off-by: David Jewsbury (cherry picked from commit a322957f59e5a7bd33a129e6203ad6446d6e6813) --- doc/hardware/peripherals/mspi.rst | 10 ++++++---- include/zephyr/drivers/mspi.h | 3 +++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/doc/hardware/peripherals/mspi.rst b/doc/hardware/peripherals/mspi.rst index 176c9bf5ede3..1f01857f32cc 100644 --- a/doc/hardware/peripherals/mspi.rst +++ b/doc/hardware/peripherals/mspi.rst @@ -100,10 +100,12 @@ whether to support scatter IO and callback management. The controller can determ which user callback to trigger based on :c:enum:`mspi_bus_event_cb_mask` upon completion of each async/sync transfer if the callback had been registered using :c:func:`mspi_register_callback`. Or not to trigger any callback at all with -:c:enum:`MSPI_BUS_NO_CB` even if the callbacks are already registered. -In which case that a controller supports hardware command queue, user could take full -advantage of the hardware performance if scatter IO and callback management are supported -by the driver implementation. +:c:enum:`MSPI_BUS_NO_CB` even if the callbacks are already registered. If the implemented +driver support it, the API supports :c:enum:`MSPI_BUS_XFER_COMPLETE_CB` to signal when a +transfer finishes and :c:enum:`MSPI_BUS_TIMEOUT_CB` to signal when a transfer or request +has timed-out. In which case that a controller supports hardware command queue, user could +take full advantage of the hardware performance if scatter IO and callback management are +supported by the driver implementation. Device Tree =========== diff --git a/include/zephyr/drivers/mspi.h b/include/zephyr/drivers/mspi.h index c486f48a8ddf..b30627efad78 100644 --- a/include/zephyr/drivers/mspi.h +++ b/include/zephyr/drivers/mspi.h @@ -126,6 +126,8 @@ enum mspi_bus_event { MSPI_BUS_RESET = 0, MSPI_BUS_ERROR = 1, MSPI_BUS_XFER_COMPLETE = 2, + /** @brief When a request or xfer has timed out */ + MSPI_BUS_TIMEOUT = 3, MSPI_BUS_EVENT_MAX, }; @@ -139,6 +141,7 @@ enum mspi_bus_event_cb_mask { MSPI_BUS_RESET_CB = BIT(0), MSPI_BUS_ERROR_CB = BIT(1), MSPI_BUS_XFER_COMPLETE_CB = BIT(2), + MSPI_BUS_TIMEOUT_CB = BIT(3), }; /** From 19ff568163ed8205b4a8c6f49496c13598a268bf Mon Sep 17 00:00:00 2001 From: David Jewsbury Date: Tue, 26 Aug 2025 17:15:11 +0100 Subject: [PATCH 2004/2141] [nrf fromtree] dts: mspi: Align op-mode binding with mspi.h enum enum mspi_op_mode in mspi.h has different syntax to this binding. Aligning these will allow for cleaner code in the implmented drivers. Signed-off-by: David Jewsbury (cherry picked from commit 032ca4c894d9239ae7c2753ea4edc75c8e84ea3d) --- dts/bindings/mspi/mspi-controller.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dts/bindings/mspi/mspi-controller.yaml b/dts/bindings/mspi/mspi-controller.yaml index 6f22d0dc0bf2..dd7c99e34ece 100644 --- a/dts/bindings/mspi/mspi-controller.yaml +++ b/dts/bindings/mspi/mspi-controller.yaml @@ -22,8 +22,8 @@ properties: op-mode: type: string enum: - - "MSPI_CONTROLLER" - - "MSPI_PERIPHERAL" + - "MSPI_OP_MODE_CONTROLLER" + - "MSPI_OP_MODE_PERIPHERAL" description: | Indicate MSPI controller or peripheral mode of the controller. The controller driver may use this during initialization. From bd4eb48ac6da7d17a1cdc1fecd0331e5bd1d11d6 Mon Sep 17 00:00:00 2001 From: David Jewsbury Date: Thu, 9 Oct 2025 16:45:00 +0200 Subject: [PATCH 2005/2141] [nrf fromtree] drivers: mspi_dw: Add support for asynchronous transfers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Handling of asynchronous transfers uses the system workqueue, hence they are not available when multithreading is disabled. Also add missing dependency on multithreading in the MSPI_DW_HANDLE_FIFOS_IN_SYSTEM_WORKQUEUE Kconfig option. Signed-off-by: David Jewsbury Signed-off-by: Andrzej Głąbek (cherry picked from commit 2f1ee737b362ea697834ddf8f8a11ccb50e4659d) --- drivers/mspi/Kconfig.dw | 1 + drivers/mspi/mspi_dw.c | 238 ++++++++++++++++++++++++++++++++++++---- 2 files changed, 219 insertions(+), 20 deletions(-) diff --git a/drivers/mspi/Kconfig.dw b/drivers/mspi/Kconfig.dw index cff148c138c6..485ea6c1a420 100644 --- a/drivers/mspi/Kconfig.dw +++ b/drivers/mspi/Kconfig.dw @@ -14,6 +14,7 @@ if MSPI_DW config MSPI_DW_HANDLE_FIFOS_IN_SYSTEM_WORKQUEUE bool "Handle FIFO in system workqueue" + depends on MULTITHREADING help When the driver does not use DMA for transferring data to/from the SSI FIFOs, handling of those may take a significant amount of time. diff --git a/drivers/mspi/mspi_dw.c b/drivers/mspi/mspi_dw.c index 518b5605785f..e8c9a817095d 100644 --- a/drivers/mspi/mspi_dw.c +++ b/drivers/mspi/mspi_dw.c @@ -66,20 +66,29 @@ struct mspi_dw_data { bool suspended; #if defined(CONFIG_MULTITHREADING) + const struct device *dev; + struct k_sem finished; /* For synchronization of API calls made from different contexts. */ struct k_sem ctx_lock; /* For locking of controller configuration. */ struct k_sem cfg_lock; + + struct k_timer async_timer; + struct k_work async_timeout_work; + struct k_work async_packet_work; + + mspi_callback_handler_t cbs[MSPI_BUS_EVENT_MAX]; + struct mspi_callback_context *cb_ctxs[MSPI_BUS_EVENT_MAX]; #else volatile bool finished; bool cfg_lock; #endif + struct mspi_xfer xfer; #if defined(CONFIG_MSPI_DW_HANDLE_FIFOS_IN_SYSTEM_WORKQUEUE) struct k_work fifo_work; - const struct device *dev; uint32_t imr; #endif }; @@ -141,6 +150,100 @@ DEFINE_MM_REG_WR(xip_write_ctrl, 0x148) #include "mspi_dw_vendor_specific.h" +static int start_next_packet(const struct device *dev); +static int finalize_packet(const struct device *dev, int rc); +static int finalize_transceive(const struct device *dev, int rc); + +#if defined(CONFIG_MULTITHREADING) +/* Common function to setup callback context and call user callback */ +static void call_user_callback_with_context(const struct device *dev, + enum mspi_bus_event evt_type, + uint32_t packet_idx, + int status) +{ + struct mspi_dw_data *dev_data = dev->data; + const struct mspi_xfer_packet *packet = + &dev_data->xfer.packets[packet_idx]; + struct mspi_callback_context *cb_ctx = dev_data->cb_ctxs[evt_type]; + + if (!(packet->cb_mask & BIT(evt_type)) || + !dev_data->cbs[evt_type]) { + return; + } + + LOG_DBG("Calling user function with evt_type: %u", evt_type); + + cb_ctx->mspi_evt.evt_type = evt_type; + cb_ctx->mspi_evt.evt_data.controller = dev; + cb_ctx->mspi_evt.evt_data.dev_id = dev_data->dev_id; + cb_ctx->mspi_evt.evt_data.packet = packet; + cb_ctx->mspi_evt.evt_data.packet_idx = packet_idx; + cb_ctx->mspi_evt.evt_data.status = status; + + dev_data->cbs[evt_type](cb_ctx); +} + +static void async_timeout_timer_handler(struct k_timer *timer) +{ + struct mspi_dw_data *dev_data = + CONTAINER_OF(timer, struct mspi_dw_data, async_timer); + + /* Submit work to handle timeout in proper context */ + k_work_submit(&dev_data->async_timeout_work); +} + +static void async_timeout_work_handler(struct k_work *work) +{ + struct mspi_dw_data *dev_data = + CONTAINER_OF(work, struct mspi_dw_data, async_timeout_work); + const struct device *dev = dev_data->dev; + int rc; + + LOG_ERR("Async transfer timed out"); + + rc = finalize_packet(dev, -ETIMEDOUT); + rc = finalize_transceive(dev, rc); + + /* Call user callback with timeout error (outside of any locks) */ + call_user_callback_with_context(dev, MSPI_BUS_TIMEOUT, + dev_data->packets_done, rc); +} + +static void async_packet_work_handler(struct k_work *work) +{ + struct mspi_dw_data *dev_data = + CONTAINER_OF(work, struct mspi_dw_data, async_packet_work); + const struct device *dev = dev_data->dev; + uint32_t packet_idx = dev_data->packets_done; + int rc; + + LOG_DBG("Processing async work in thread context"); + + rc = finalize_packet(dev, 0); + if (rc >= 0) { + ++dev_data->packets_done; + if (dev_data->packets_done < dev_data->xfer.num_packet) { + LOG_DBG("Starting next packet (%d/%d)", + dev_data->packets_done + 1, + dev_data->xfer.num_packet); + + rc = start_next_packet(dev); + if (rc >= 0) { + return; + } + + ++packet_idx; + } + } + + rc = finalize_transceive(dev, rc); + call_user_callback_with_context(dev, + rc < 0 ? MSPI_BUS_ERROR + : MSPI_BUS_XFER_COMPLETE, + packet_idx, rc); +} +#endif /* defined(CONFIG_MULTITHREADING) */ + static void tx_data(const struct device *dev, const struct mspi_xfer_packet *packet) { @@ -316,6 +419,22 @@ static inline void set_imr(const struct device *dev, uint32_t imr) #endif } +static void handle_end_of_packet(struct mspi_dw_data *dev_data) + +{ +#if defined(CONFIG_MULTITHREADING) + if (dev_data->xfer.async) { + k_timer_stop(&dev_data->async_timer); + + k_work_submit(&dev_data->async_packet_work); + } else { + k_sem_give(&dev_data->finished); + } +#else + dev_data->finished = true; +#endif +} + static void handle_fifos(const struct device *dev) { struct mspi_dw_data *dev_data = dev->data; @@ -401,11 +520,8 @@ static void handle_fifos(const struct device *dev) if (finished) { set_imr(dev, 0); -#if defined(CONFIG_MULTITHREADING) - k_sem_give(&dev_data->finished); -#else - dev_data->finished = true; -#endif + handle_end_of_packet(dev_data); + } } @@ -874,6 +990,10 @@ static int api_dev_config(const struct device *dev, } dev_data->dev_id = dev_id; + +#if defined(CONFIG_MULTITHREADING) + memset(dev_data->cbs, 0, sizeof(dev_data->cbs)); +#endif } if (param_mask == MSPI_DEVICE_CONFIG_NONE && @@ -935,7 +1055,7 @@ static void tx_control_field(const struct device *dev, } while (shift); } -static int start_next_packet(const struct device *dev, k_timeout_t timeout) +static int start_next_packet(const struct device *dev) { const struct mspi_dw_config *dev_config = dev->config; struct mspi_dw_data *dev_data = dev->data; @@ -1177,13 +1297,26 @@ static int start_next_packet(const struct device *dev, k_timeout_t timeout) tx_data(dev, packet); } - /* Enable interrupts now and wait until the packet is done. */ + /* Enable interrupts now */ write_imr(dev, imr); /* Write SER to start transfer */ write_ser(dev, BIT(dev_data->dev_id->dev_idx)); #if defined(CONFIG_MULTITHREADING) + k_timeout_t timeout = K_MSEC(dev_data->xfer.timeout); + + /* For async transfer, start the timeout timer and exit. */ + if (dev_data->xfer.async) { + k_timer_start(&dev_data->async_timer, timeout, K_NO_WAIT); + + return 0; + } + + /* For sync transfer, wait until the packet is finished. */ rc = k_sem_take(&dev_data->finished, timeout); + if (rc < 0) { + rc = -ETIMEDOUT; + } #else if (!WAIT_FOR(dev_data->finished, dev_data->xfer.timeout * USEC_PER_MSEC, @@ -1193,12 +1326,22 @@ static int start_next_packet(const struct device *dev, k_timeout_t timeout) dev_data->finished = false; #endif + + return finalize_packet(dev, rc); +} + +static int finalize_packet(const struct device *dev, int rc) +{ + struct mspi_dw_data *dev_data = dev->data; + bool xip_enabled = COND_CODE_1(CONFIG_MSPI_XIP, + (dev_data->xip_enabled != 0), + (false)); + if (read_risr(dev) & RISR_RXOIR_BIT) { LOG_ERR("RX FIFO overflow occurred"); rc = -EIO; - } else if (rc < 0) { + } else if (rc == -ETIMEDOUT) { LOG_ERR("Transfer timed out"); - rc = -ETIMEDOUT; } /* Disable the controller. This will immediately halt the transfer @@ -1207,10 +1350,10 @@ static int start_next_packet(const struct device *dev, k_timeout_t timeout) if (xip_enabled) { /* If XIP is enabled, the controller must be kept enabled, * so disable it only momentarily if there's a need to halt - * a transfer that has timeout out. + * a transfer that ended up with an error. */ - if (rc == -ETIMEDOUT) { - key = irq_lock(); + if (rc < 0) { + unsigned int key = irq_lock(); write_ssienr(dev, 0); write_ssienr(dev, SSIENR_SSIC_EN_BIT); @@ -1220,13 +1363,14 @@ static int start_next_packet(const struct device *dev, k_timeout_t timeout) } else { write_ssienr(dev, 0); } + /* Clear SER */ write_ser(dev, 0); if (dev_data->dev_id->ce.port) { int rc2; - /* Do not use `rc` to not overwrite potential timeout error. */ + /* Do not use `rc` to not overwrite potential packet error. */ rc2 = gpio_pin_set_dt(&dev_data->dev_id->ce, 0); if (rc2 < 0) { LOG_ERR("Failed to deactivate CE line (%d)", rc2); @@ -1269,10 +1413,18 @@ static int _api_transceive(const struct device *dev, dev_data->xfer = *req; + /* For async, only the first packet is started here, next ones, if any, + * are started by ISR. + */ + if (req->async) { + dev_data->packets_done = 0; + return start_next_packet(dev); + } + for (dev_data->packets_done = 0; dev_data->packets_done < dev_data->xfer.num_packet; dev_data->packets_done++) { - rc = start_next_packet(dev, K_MSEC(dev_data->xfer.timeout)); + rc = start_next_packet(dev); if (rc < 0) { return rc; } @@ -1286,16 +1438,15 @@ static int api_transceive(const struct device *dev, const struct mspi_xfer *req) { struct mspi_dw_data *dev_data = dev->data; - int rc, rc2; + int rc; if (dev_id != dev_data->dev_id) { LOG_ERR("Controller is not configured for this device"); return -EINVAL; } - /* TODO: add support for asynchronous transfers */ - if (req->async) { - LOG_ERR("Asynchronous transfers are not supported"); + if (req->async && !IS_ENABLED(CONFIG_MULTITHREADING)) { + LOG_ERR("Asynchronous transfers require multithreading"); return -ENOTSUP; } @@ -1315,7 +1466,20 @@ static int api_transceive(const struct device *dev, rc = _api_transceive(dev, req); } + if (req->async && rc >= 0) { + return rc; + } + + return finalize_transceive(dev, rc); +} + +static int finalize_transceive(const struct device *dev, int rc) +{ + int rc2; + #if defined(CONFIG_MULTITHREADING) + struct mspi_dw_data *dev_data = dev->data; + k_sem_give(&dev_data->ctx_lock); #endif @@ -1328,6 +1492,33 @@ static int api_transceive(const struct device *dev, return rc; } +#if defined(CONFIG_MULTITHREADING) +static int api_register_callback(const struct device *dev, + const struct mspi_dev_id *dev_id, + const enum mspi_bus_event evt_type, + mspi_callback_handler_t cb, + struct mspi_callback_context *ctx) +{ + struct mspi_dw_data *dev_data = dev->data; + + if (dev_id != dev_data->dev_id) { + LOG_ERR("Controller is not configured for this device"); + return -EINVAL; + } + + if (evt_type != MSPI_BUS_ERROR && + evt_type != MSPI_BUS_XFER_COMPLETE && + evt_type != MSPI_BUS_TIMEOUT) { + LOG_ERR("Callback type %d not supported", evt_type); + return -ENOTSUP; + } + + dev_data->cbs[evt_type] = cb; + dev_data->cb_ctxs[evt_type] = ctx; + return 0; +} +#endif /* defined(CONFIG_MULTITHREADING) */ + #if defined(CONFIG_MSPI_TIMING) static int api_timing_config(const struct device *dev, const struct mspi_dev_id *dev_id, @@ -1570,13 +1761,17 @@ static int dev_init(const struct device *dev) #if defined(CONFIG_MULTITHREADING) struct mspi_dw_data *dev_data = dev->data; + dev_data->dev = dev; k_sem_init(&dev_data->finished, 0, 1); k_sem_init(&dev_data->cfg_lock, 1, 1); k_sem_init(&dev_data->ctx_lock, 1, 1); + + k_timer_init(&dev_data->async_timer, async_timeout_timer_handler, NULL); + k_work_init(&dev_data->async_timeout_work, async_timeout_work_handler); + k_work_init(&dev_data->async_packet_work, async_packet_work_handler); #endif #if defined(CONFIG_MSPI_DW_HANDLE_FIFOS_IN_SYSTEM_WORKQUEUE) - dev_data->dev = dev; k_work_init(&dev_data->fifo_work, fifo_work_handler); #endif @@ -1616,6 +1811,9 @@ static DEVICE_API(mspi, drv_api) = { .dev_config = api_dev_config, .get_channel_status = api_get_channel_status, .transceive = api_transceive, +#if defined(CONFIG_MULTITHREADING) + .register_callback = api_register_callback, +#endif #if defined(CONFIG_MSPI_TIMING) .timing_config = api_timing_config, #endif From f6ef86cc133ff447404130981e563fb05224d62b Mon Sep 17 00:00:00 2001 From: David Jewsbury Date: Mon, 13 Oct 2025 11:50:55 +0100 Subject: [PATCH 2006/2141] [nrf fromtree] drivers: mspi_dw: Add support for slave mode MSPI slave mode is selected through devicetree using the op-mode property. Mode selected by SSIISMST bit in the CTRLR0 register. EXMIF can only be Master (controller). Signed-off-by: David Jewsbury (cherry picked from commit a18fd950045dc6e1fe415710fd4392ead30e46da) --- drivers/mspi/mspi_dw.c | 8 ++++++-- drivers/mspi/mspi_dw.h | 1 + dts/bindings/mspi/nordic,nrf-exmif.yaml | 4 ++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/mspi/mspi_dw.c b/drivers/mspi/mspi_dw.c index e8c9a817095d..cefcb5e59568 100644 --- a/drivers/mspi/mspi_dw.c +++ b/drivers/mspi/mspi_dw.c @@ -114,6 +114,7 @@ struct mspi_dw_config { uint8_t rx_fifo_threshold; DECLARE_REG_ACCESS(); bool sw_multi_periph; + enum mspi_op_mode op_mode; }; /* Register access helpers. */ @@ -1748,6 +1749,7 @@ static int dev_pm_action_cb(const struct device *dev, static int dev_init(const struct device *dev) { + struct mspi_dw_data *dev_data = dev->data; const struct mspi_dw_config *dev_config = dev->config; const struct gpio_dt_spec *ce_gpio; int rc; @@ -1756,11 +1758,12 @@ static int dev_init(const struct device *dev) vendor_specific_init(dev); + dev_data->ctrlr0 |= FIELD_PREP(CTRLR0_SSI_IS_MST_BIT, + dev_config->op_mode == MSPI_OP_MODE_CONTROLLER); + dev_config->irq_config(); #if defined(CONFIG_MULTITHREADING) - struct mspi_dw_data *dev_data = dev->data; - dev_data->dev = dev; k_sem_init(&dev_data->finished, 0, 1); k_sem_init(&dev_data->cfg_lock, 1, 1); @@ -1885,6 +1888,7 @@ static DEVICE_API(mspi, drv_api) = { DEFINE_REG_ACCESS(inst) \ .sw_multi_periph = \ DT_INST_PROP(inst, software_multiperipheral), \ + .op_mode = DT_INST_STRING_TOKEN(inst, op_mode), \ }; \ DEVICE_DT_INST_DEFINE(inst, \ dev_init, PM_DEVICE_DT_INST_GET(inst), \ diff --git a/drivers/mspi/mspi_dw.h b/drivers/mspi/mspi_dw.h index 28e4bed016e7..894bee40d6c4 100644 --- a/drivers/mspi/mspi_dw.h +++ b/drivers/mspi/mspi_dw.h @@ -19,6 +19,7 @@ */ /* CTRLR0 - Control Register 0 */ +#define CTRLR0_SSI_IS_MST_BIT BIT(31) #define CTRLR0_SPI_FRF_MASK COND_CODE_1(SSI_VERSION_2, GENMASK(22, 21), GENMASK(23, 22)) #define CTRLR0_SPI_FRF_STANDARD 0UL #define CTRLR0_SPI_FRF_DUAL 1UL diff --git a/dts/bindings/mspi/nordic,nrf-exmif.yaml b/dts/bindings/mspi/nordic,nrf-exmif.yaml index 294254aa60ef..4e46e5d6b142 100644 --- a/dts/bindings/mspi/nordic,nrf-exmif.yaml +++ b/dts/bindings/mspi/nordic,nrf-exmif.yaml @@ -6,3 +6,7 @@ description: Nordic External Memory Interface (EXMIF) compatible: "nordic,nrf-exmif" include: snps,designware-ssi.yaml + +properties: + op-mode: + default: "MSPI_OP_MODE_CONTROLLER" From dd437b9f60121d18f51f0bed58d80081f1717903 Mon Sep 17 00:00:00 2001 From: David Jewsbury Date: Tue, 14 Oct 2025 11:05:37 +0100 Subject: [PATCH 2007/2141] [nrf fromtree] drivers: mspi: mspi_dw: Add DMA support Initial DMA support. DMA supports implementation of SSI IP but using vendor specific DMA in the wrapper. The setup of the DMA is done in mspi_dw_vendor_specific.h. Signed-off-by: David Jewsbury (cherry picked from commit d9677bbd7b54c22aa6fbaa75c67478f22e42b33f) --- doc/hardware/peripherals/mspi.rst | 1 + drivers/mspi/Kconfig | 6 + drivers/mspi/Kconfig.dw | 1 - drivers/mspi/mspi_dw.c | 227 +++++++++++++------ drivers/mspi/mspi_dw.h | 16 ++ drivers/mspi/mspi_dw_vendor_specific.h | 247 ++++++++++++++++++++- dts/bindings/mspi/snps,designware-ssi.yaml | 17 ++ 7 files changed, 439 insertions(+), 76 deletions(-) diff --git a/doc/hardware/peripherals/mspi.rst b/doc/hardware/peripherals/mspi.rst index 1f01857f32cc..b9139f1ed1a8 100644 --- a/doc/hardware/peripherals/mspi.rst +++ b/doc/hardware/peripherals/mspi.rst @@ -194,6 +194,7 @@ Related configuration options: * :kconfig:option:`CONFIG_MSPI_TIMING` * :kconfig:option:`CONFIG_MSPI_INIT_PRIORITY` * :kconfig:option:`CONFIG_MSPI_COMPLETION_TIMEOUT_TOLERANCE` +* :kconfig:option:`CONFIG_MSPI_DMA` API Reference ************* diff --git a/drivers/mspi/Kconfig b/drivers/mspi/Kconfig index 269d8d16f04a..a6442c1f70fe 100644 --- a/drivers/mspi/Kconfig +++ b/drivers/mspi/Kconfig @@ -55,6 +55,12 @@ config MSPI_TIMING Enables mspi_timing_config calls in device drivers for those controllers that need this to proper function at high frequencies. +config MSPI_DMA + bool "DMA support" + help + Enables DMA capabilities, depending on the driver and hardware it + runs on. + module = MSPI module-str = mspi source "subsys/logging/Kconfig.template.log_config" diff --git a/drivers/mspi/Kconfig.dw b/drivers/mspi/Kconfig.dw index 485ea6c1a420..71302a801fdb 100644 --- a/drivers/mspi/Kconfig.dw +++ b/drivers/mspi/Kconfig.dw @@ -7,7 +7,6 @@ config MSPI_DW default y depends on DT_HAS_SNPS_DESIGNWARE_SSI_ENABLED select PINCTRL if $(dt_compat_any_has_prop,$(DT_COMPAT_SNPS_DESIGNWARE_SSI),pinctrl-0) - imply MSPI_XIP imply MSPI_TIMING if MSPI_DW diff --git a/drivers/mspi/mspi_dw.c b/drivers/mspi/mspi_dw.c index cefcb5e59568..d4700a99261a 100644 --- a/drivers/mspi/mspi_dw.c +++ b/drivers/mspi/mspi_dw.c @@ -95,6 +95,7 @@ struct mspi_dw_data { struct mspi_dw_config { DEVICE_MMIO_ROM; + void *wrapper_regs; void (*irq_config)(void); uint32_t clock_frequency; #if defined(CONFIG_PINCTRL) @@ -112,6 +113,11 @@ struct mspi_dw_config { uint8_t max_queued_dummy_bytes; uint8_t tx_fifo_threshold; uint8_t rx_fifo_threshold; +#ifdef CONFIG_MSPI_DMA + uint8_t dma_tx_data_level; + uint8_t dma_rx_data_level; +#endif + void *vendor_specific_data; DECLARE_REG_ACCESS(); bool sw_multi_periph; enum mspi_op_mode op_mode; @@ -139,6 +145,11 @@ DEFINE_MM_REG_RD_WR(dr, 0x60) DEFINE_MM_REG_WR(rx_sample_dly, 0xf0) DEFINE_MM_REG_WR(spi_ctrlr0, 0xf4) DEFINE_MM_REG_WR(txd_drive_edge, 0xf8) +#if defined(CONFIG_MSPI_DMA) +DEFINE_MM_REG_WR(dmacr, 0x4C) +DEFINE_MM_REG_WR(dmatdlr, 0x50) +DEFINE_MM_REG_WR(dmardlr, 0x54) +#endif #if defined(CONFIG_MSPI_XIP) DEFINE_MM_REG_WR(xip_incr_inst, 0x100) @@ -541,6 +552,19 @@ static void fifo_work_handler(struct k_work *work) static void mspi_dw_isr(const struct device *dev) { +#if defined(CONFIG_MSPI_DMA) + struct mspi_dw_data *dev_data = dev->data; + + if (dev_data->xfer.xfer_mode == MSPI_DMA) { + if (vendor_specific_read_dma_irq(dev)) { + set_imr(dev, 0); + handle_end_of_packet(dev_data); + } + vendor_specific_irq_clear(dev); + return; + } +#endif + #if defined(CONFIG_MSPI_DW_HANDLE_FIFOS_IN_SYSTEM_WORKQUEUE) struct mspi_dw_data *dev_data = dev->data; int rc; @@ -1067,7 +1091,7 @@ static int start_next_packet(const struct device *dev) (false)); unsigned int key; uint32_t packet_frames; - uint32_t imr; + uint32_t imr = 0; int rc = 0; if (packet->num_bytes == 0 && @@ -1115,6 +1139,18 @@ static int start_next_packet(const struct device *dev) return -EINVAL; } +#if defined(CONFIG_MSPI_DMA) + if (dev_data->xfer.xfer_mode == MSPI_DMA) { + /* Check if the packet buffer is accessible */ + if (packet->num_bytes > 0 && + !vendor_specific_dma_accessible_check(dev, packet->data_buf)) { + LOG_ERR("Buffer not DMA accessible: ptr=0x%lx, size=%u", + (uintptr_t)packet->data_buf, packet->num_bytes); + return -EINVAL; + } + } +#endif + if (packet->dir == MSPI_TX || packet->num_bytes == 0) { imr = IMR_TXEIM_BIT; dev_data->ctrlr0 |= FIELD_PREP(CTRLR0_TMOD_MASK, @@ -1123,6 +1159,12 @@ static int start_next_packet(const struct device *dev) dev_data->xfer.tx_dummy); write_rxftlr(dev, 0); +#if defined(CONFIG_MSPI_DMA) + } else if (dev_data->xfer.xfer_mode == MSPI_DMA) { + dev_data->ctrlr0 |= FIELD_PREP(CTRLR0_TMOD_MASK, CTRLR0_TMOD_RX); + dev_data->spi_ctrlr0 |= FIELD_PREP(SPI_CTRLR0_WAIT_CYCLES_MASK, + dev_data->xfer.rx_dummy); +#endif } else { uint32_t tmod; uint8_t rx_fifo_threshold; @@ -1211,95 +1253,124 @@ static int start_next_packet(const struct device *dev) irq_unlock(key); } - dev_data->buf_pos = packet->data_buf; - dev_data->buf_end = &packet->data_buf[packet->num_bytes]; - - /* Set the TX FIFO threshold and its transmit start level. */ - if (packet->num_bytes) { - /* If there is some data to send/receive, set the threshold to - * the value configured for the driver instance and the start - * level to the maximum possible value (it will be updated later - * in tx_fifo() or tx_dummy_bytes() when TX is to be finished). - * This helps avoid a situation when the TX FIFO becomes empty - * before the transfer is complete and the SSI core finishes the - * transaction and deactivates the CE line. This could occur - * right before the data phase in enhanced SPI modes, when the - * clock stretching feature does not work yet, or in Standard - * SPI mode, where the clock stretching is not available at all. - */ - uint8_t start_level = dev_data->dummy_bytes != 0 - ? dev_config->max_queued_dummy_bytes - 1 - : dev_config->tx_fifo_depth_minus_1; +#if defined(CONFIG_MSPI_DMA) + if (dev_data->xfer.xfer_mode == MSPI_DMA) { + /* For DMA mode, set start level based on transfer length to prevent underflow */ + uint32_t total_transfer_bytes = packet->num_bytes + dev_data->xfer.addr_length + + dev_data->xfer.cmd_length; + uint32_t transfer_frames = total_transfer_bytes >> dev_data->bytes_per_frame_exp; - write_txftlr(dev, FIELD_PREP(TXFTLR_TXFTHR_MASK, start_level) | - FIELD_PREP(TXFTLR_TFT_MASK, - dev_config->tx_fifo_threshold)); + /* Use minimum of transfer length or FIFO depth, but at least 1 */ + uint8_t dma_start_level = MIN(transfer_frames - 1, + dev_config->tx_fifo_depth_minus_1); + + dma_start_level = (dma_start_level > 0 ? dma_start_level : 1); + + /* Only TXFTHR needs to be set to the minimum number of frames */ + write_txftlr(dev, FIELD_PREP(TXFTLR_TXFTHR_MASK, dma_start_level)); + write_dmatdlr(dev, FIELD_PREP(DMATDLR_DMATDL_MASK, dev_config->dma_tx_data_level)); + write_dmardlr(dev, FIELD_PREP(DMARDLR_DMARDL_MASK, dev_config->dma_rx_data_level)); + write_dmacr(dev, DMACR_TDMAE_BIT | DMACR_RDMAE_BIT); + write_imr(dev, 0); + write_ssienr(dev, SSIENR_SSIC_EN_BIT); + + vendor_specific_start_dma_xfer(dev); } else { - uint32_t total_tx_entries = 0; +#endif + /* PIO mode */ + dev_data->buf_pos = packet->data_buf; + dev_data->buf_end = &packet->data_buf[packet->num_bytes]; + /* Set the TX FIFO threshold and its transmit start level. */ + if (packet->num_bytes) { + /* If there is some data to send/receive, set the threshold to + * the value configured for the driver instance and the start + * level to the maximum possible value (it will be updated later + * in tx_fifo() or tx_dummy_bytes() when TX is to be finished). + * This helps avoid a situation when the TX FIFO becomes empty + * before the transfer is complete and the SSI core finishes the + * transaction and deactivates the CE line. This could occur + * right before the data phase in enhanced SPI modes, when the + * clock stretching feature does not work yet, or in Standard + * SPI mode, where the clock stretching is not available at all. + */ + uint8_t start_level = dev_data->dummy_bytes != 0 + ? dev_config->max_queued_dummy_bytes - 1 + : dev_config->tx_fifo_depth_minus_1; - /* It the whole transfer is to contain only the command and/or - * address, set up the transfer to start right after entries - * for those appear in the TX FIFO, and the threshold to 0, - * so that the interrupt occurs when the TX FIFO gets emptied. - */ - if (dev_data->xfer.cmd_length) { - if (dev_data->standard_spi) { - total_tx_entries += dev_data->xfer.cmd_length; - } else { - total_tx_entries += 1; + write_txftlr(dev, FIELD_PREP(TXFTLR_TXFTHR_MASK, start_level) | + FIELD_PREP(TXFTLR_TFT_MASK, + dev_config->tx_fifo_threshold)); + + } else { + uint32_t total_tx_entries = 0; + + /* It the whole transfer is to contain only the command and/or + * address, set up the transfer to start right after entries + * for those appear in the TX FIFO, and the threshold to 0, + * so that the interrupt occurs when the TX FIFO gets emptied. + */ + if (dev_data->xfer.cmd_length) { + if (dev_data->standard_spi) { + total_tx_entries += dev_data->xfer.cmd_length; + } else { + total_tx_entries += 1; + } } - } - if (dev_data->xfer.addr_length) { - if (dev_data->standard_spi) { - total_tx_entries += dev_data->xfer.addr_length; - } else { - total_tx_entries += 1; + if (dev_data->xfer.addr_length) { + if (dev_data->standard_spi) { + total_tx_entries += dev_data->xfer.addr_length; + } else { + total_tx_entries += 1; + } } + + write_txftlr(dev, FIELD_PREP(TXFTLR_TXFTHR_MASK, + total_tx_entries - 1)); } - write_txftlr(dev, FIELD_PREP(TXFTLR_TXFTHR_MASK, - total_tx_entries - 1)); - } + /* Ensure that there will be no interrupt from the controller yet. */ + write_imr(dev, 0); + /* Enable the controller. This must be done before DR is written. */ + write_ssienr(dev, SSIENR_SSIC_EN_BIT); - /* Ensure that there will be no interrupt from the controller yet. */ - write_imr(dev, 0); - /* Enable the controller. This must be done before DR is written. */ - write_ssienr(dev, SSIENR_SSIC_EN_BIT); + /* Since the FIFO depth in SSI is always at least 8, it can be safely + * assumed that the command and address fields (max. 2 and 4 bytes, + * respectively) can be written here before the TX FIFO gets filled up. + */ + if (dev_data->standard_spi) { + if (dev_data->xfer.cmd_length) { + tx_control_field(dev, packet->cmd, + dev_data->xfer.cmd_length); + } - /* Since the FIFO depth in SSI is always at least 8, it can be safely - * assumed that the command and address fields (max. 2 and 4 bytes, - * respectively) can be written here before the TX FIFO gets filled up. - */ - if (dev_data->standard_spi) { - if (dev_data->xfer.cmd_length) { - tx_control_field(dev, packet->cmd, - dev_data->xfer.cmd_length); - } + if (dev_data->xfer.addr_length) { + tx_control_field(dev, packet->address, + dev_data->xfer.addr_length); + } + } else { + if (dev_data->xfer.cmd_length) { + write_dr(dev, packet->cmd); + } - if (dev_data->xfer.addr_length) { - tx_control_field(dev, packet->address, - dev_data->xfer.addr_length); - } - } else { - if (dev_data->xfer.cmd_length) { - write_dr(dev, packet->cmd); + if (dev_data->xfer.addr_length) { + write_dr(dev, packet->address); + } } - if (dev_data->xfer.addr_length) { - write_dr(dev, packet->address); + /* Prefill TX FIFO with any data we can */ + if (dev_data->dummy_bytes && tx_dummy_bytes(dev, NULL)) { + imr = IMR_RXFIM_BIT; + } else if (packet->dir == MSPI_TX && packet->num_bytes) { + tx_data(dev, packet); } - } - /* Prefill TX FIFO with any data we can */ - if (dev_data->dummy_bytes && tx_dummy_bytes(dev, NULL)) { - imr = IMR_RXFIM_BIT; - } else if (packet->dir == MSPI_TX && packet->num_bytes) { - tx_data(dev, packet); + /* Enable interrupts now and wait until the packet is done unless async. */ + write_imr(dev, imr); +#if defined(CONFIG_MSPI_DMA) } +#endif - /* Enable interrupts now */ - write_imr(dev, imr); /* Write SER to start transfer */ write_ser(dev, BIT(dev_data->dev_id->dev_idx)); @@ -1867,9 +1938,16 @@ static DEVICE_API(mspi, drv_api) = { DT_INST_PROP_OR(inst, rx_fifo_threshold, \ 1 * RX_FIFO_DEPTH(inst) / 8 - 1) +#define MSPI_DW_DMA_DATA_LEVELS(inst) \ + .dma_tx_data_level = \ + DT_INST_PROP_OR(inst, dma_transmit_data_level, 0), \ + .dma_rx_data_level = \ + DT_INST_PROP_OR(inst, dma_receive_data_level, 0) + #define MSPI_DW_INST(inst) \ PM_DEVICE_DT_INST_DEFINE(inst, dev_pm_action_cb); \ IF_ENABLED(CONFIG_PINCTRL, (PINCTRL_DT_INST_DEFINE(inst);)) \ + VENDOR_SPECIFIC_DATA_DEFINE(inst); \ static void irq_config##inst(void) \ { \ LISTIFY(DT_INST_NUM_IRQS(inst), \ @@ -1878,6 +1956,7 @@ static DEVICE_API(mspi, drv_api) = { static struct mspi_dw_data dev##inst##_data; \ static const struct mspi_dw_config dev##inst##_config = { \ MSPI_DW_MMIO_ROM_INIT(DT_DRV_INST(inst)), \ + .wrapper_regs = (void *)DT_INST_REG_ADDR(inst), \ .irq_config = irq_config##inst, \ .clock_frequency = MSPI_DW_CLOCK_FREQUENCY(inst), \ IF_ENABLED(CONFIG_PINCTRL, \ @@ -1885,6 +1964,8 @@ static DEVICE_API(mspi, drv_api) = { IF_ENABLED(DT_INST_NODE_HAS_PROP(inst, ce_gpios), \ (MSPI_DW_CE_GPIOS(inst),)) \ MSPI_DW_FIFO_PROPS(inst), \ + IF_ENABLED(CONFIG_MSPI_DMA, (MSPI_DW_DMA_DATA_LEVELS(inst),)) \ + .vendor_specific_data = VENDOR_SPECIFIC_DATA_GET(inst), \ DEFINE_REG_ACCESS(inst) \ .sw_multi_periph = \ DT_INST_PROP(inst, software_multiperipheral), \ diff --git a/drivers/mspi/mspi_dw.h b/drivers/mspi/mspi_dw.h index 894bee40d6c4..0d015ae3db03 100644 --- a/drivers/mspi/mspi_dw.h +++ b/drivers/mspi/mspi_dw.h @@ -173,6 +173,22 @@ #define XIP_WRITE_CTRL_FRF_QUAD 2UL #define XIP_WRITE_CTRL_FRF_OCTAL 3UL +/* DMACR - DMA Control Register */ +#define DMACR_ATW_MASK GENMASK(4, 3) +#define DMACR_ATW_1 0UL +#define DMACR_ATW_2 1UL +#define DMACR_ATW_4 2UL +#define DMACR_ATW_8 3UL +#define DMACR_IDMAE_BIT BIT(2) +#define DMACR_TDMAE_BIT BIT(1) +#define DMACR_RDMAE_BIT BIT(0) + +/* DMATDLR - DMA Transmit Data Level */ +#define DMATDLR_DMATDL_MASK GENMASK(3, 0) + +/* DMARDLR - DMA Receive Data Level */ +#define DMARDLR_DMARDL_MASK GENMASK(3, 0) + /* Register access helpers. */ #define USES_AUX_REG(inst) + DT_INST_PROP(inst, aux_reg_enable) #define AUX_REG_INSTANCES (0 DT_INST_FOREACH_STATUS_OKAY(USES_AUX_REG)) diff --git a/drivers/mspi/mspi_dw_vendor_specific.h b/drivers/mspi/mspi_dw_vendor_specific.h index d32a53ac2939..0b1fcf1ca7e0 100644 --- a/drivers/mspi/mspi_dw_vendor_specific.h +++ b/drivers/mspi/mspi_dw_vendor_specific.h @@ -97,7 +97,221 @@ static inline int vendor_specific_xip_disable(const struct device *dev, } #endif /* defined(CONFIG_MSPI_XIP) */ -#else +#elif DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_qspi_v2) +#include + +static inline void vendor_specific_init(const struct device *dev) +{ + const struct mspi_dw_config *config = dev->config; + NRF_QSPI_Type *preg = (NRF_QSPI_Type *)config->wrapper_regs; + + preg->EVENTS_CORE = 0; + preg->EVENTS_DMA.DONE = 0; + + preg->INTENSET = BIT(QSPI_INTENSET_CORE_Pos) + | BIT(QSPI_INTENSET_DMADONE_Pos); +} + +static inline void vendor_specific_suspend(const struct device *dev) +{ + const struct mspi_dw_config *config = dev->config; + NRF_QSPI_Type *preg = (NRF_QSPI_Type *)config->wrapper_regs; + + preg->ENABLE = 0; +} + +static inline void vendor_specific_resume(const struct device *dev) +{ + const struct mspi_dw_config *config = dev->config; + NRF_QSPI_Type *preg = (NRF_QSPI_Type *)config->wrapper_regs; + + preg->ENABLE = 1; + +} + +static inline void vendor_specific_irq_clear(const struct device *dev) +{ + const struct mspi_dw_config *config = dev->config; + NRF_QSPI_Type *preg = (NRF_QSPI_Type *)config->wrapper_regs; + + preg->EVENTS_CORE = 0; + preg->EVENTS_DMA.DONE = 0; +} + +/* DMA support */ + +#define EVDMA_ATTR_LEN_Pos (0UL) +#define EVDMA_ATTR_LEN_Msk (0x00FFFFFFUL) + +#define EVDMA_ATTR_ATTR_Pos (24UL) +#define EVDMA_ATTR_ATTR_Msk (0x3FUL << EVDMA_ATTR_ATTR_Pos) + +#define EVDMA_ATTR_32AXI_Pos (30UL) +#define EVDMA_ATTR_32AXI_Msk (0x1UL << EVDMA_ATTR_32AXI_Pos) + +#define EVDMA_ATTR_EVENTS_Pos (31UL) +#define EVDMA_ATTR_EVENTS_Msk (0x1UL << EVDMA_ATTR_EVENTS_Pos) + +typedef enum { + EVDMA_BYTE_SWAP = 0, + EVDMA_JOBLIST = 1, + EVDMA_BUFFER_FILL = 2, + EVDMA_FIXED_ATTR = 3, + EVDMA_STATIC_ADDR = 4, + EVDMA_PLAIN_DATA_BUF_WR = 5, +} EVDMA_ATTR_Type; + +/* Setup EVDMA attribute with the following configuratrion */ +#define EVDMA_ATTRIBUTE (BIT(EVDMA_BYTE_SWAP) | BIT(EVDMA_JOBLIST) | \ + BIT(EVDMA_BUFFER_FILL) | BIT(EVDMA_FIXED_ATTR) | \ + BIT(EVDMA_STATIC_ADDR) | BIT(EVDMA_PLAIN_DATA_BUF_WR)) + +typedef struct { + uint8_t *addr; + uint32_t attr; +} EVDMA_JOB_Type; + +#define EVDMA_JOB(BUFFER, SIZE, ATTR) \ + (EVDMA_JOB_Type) { .addr = (uint8_t *)BUFFER, .attr = (ATTR << EVDMA_ATTR_ATTR_Pos | SIZE) } +#define EVDMA_NULL_JOB() \ + (EVDMA_JOB_Type) { .addr = (uint8_t *)0, .attr = 0 } +typedef struct { + EVDMA_JOB_Type *tx_job; + EVDMA_JOB_Type *rx_job; +} QSPI_TRANSFER_LIST_Type; + +/* Number of jobs needed for transmit trasaction */ +#define MAX_NUM_JOBS 5 + +/* Vendor-specific data structure for Nordic QSPI */ +typedef struct { + QSPI_TRANSFER_LIST_Type *transfer_list; + EVDMA_JOB_Type *joblist; +} nordic_qspi_vendor_data_t; + +/* Static allocation macros for vendor-specific data */ +#define VENDOR_SPECIFIC_DATA_DEFINE(inst) \ + static QSPI_TRANSFER_LIST_Type mspi_dw_##inst##_transfer_list; \ + static EVDMA_JOB_Type mspi_dw_##inst##_joblist[MAX_NUM_JOBS]; \ + static const nordic_qspi_vendor_data_t mspi_dw_##inst##_vendor_data = { \ + .transfer_list = &mspi_dw_##inst##_transfer_list, \ + .joblist = &mspi_dw_##inst##_joblist[0] \ + }; + +#define VENDOR_SPECIFIC_DATA_GET(inst) (void *)&mspi_dw_##inst##_vendor_data + +/* Temporarily hard-coded as not in MDK yet */ +#define QSPI_TMOD_OFFSET (0x490UL) +#define QSPI_TMOD_TX_AND_RX (0x0) +#define QSPI_TMOD_TX_ONLY (0x1) +#define QSPI_TMOD_RX_ONLY (0x2) +static inline void vendor_specific_start_dma_xfer(const struct device *dev) +{ + struct mspi_dw_data *dev_data = dev->data; + const struct mspi_dw_config *config = dev->config; + const struct mspi_xfer_packet *packet = + &dev_data->xfer.packets[dev_data->packets_done]; + NRF_QSPI_Type *preg = (NRF_QSPI_Type *)config->wrapper_regs; + + /* Use vendor-specific data from config - stores job and transfer lists */ + const nordic_qspi_vendor_data_t *vendor_data = (const nordic_qspi_vendor_data_t *) + config->vendor_specific_data; + + QSPI_TRANSFER_LIST_Type *transfer_list = vendor_data->transfer_list; + EVDMA_JOB_Type *joblist = vendor_data->joblist; + + int tmod = 0; + int job_idx = 0; + + /* Set up tx job pointer to the first job */ + transfer_list->tx_job = &joblist[0]; + + /* + * The Command and Address will always have a length of 4 from the DMA's + * perspective. QSPI peripheral will use length of data specified in core registers + */ + if (dev_data->xfer.cmd_length > 0) { + joblist[job_idx++] = EVDMA_JOB(&packet->cmd, 4, EVDMA_ATTRIBUTE); + } + if (dev_data->xfer.addr_length > 0) { + joblist[job_idx++] = EVDMA_JOB(&packet->address, 4, EVDMA_ATTRIBUTE); + } + + if (packet->dir == MSPI_TX) { + preg->CONFIG.RXTRANSFERLENGTH = 0; + + if (packet->num_bytes > 0) { + joblist[job_idx++] = EVDMA_JOB(packet->data_buf, packet->num_bytes, + EVDMA_ATTRIBUTE); + } + + /* Always terminate with null job */ + joblist[job_idx] = EVDMA_NULL_JOB(); + /* rx_job is always EVDMA_NULL_JOB() for transmit */ + transfer_list->rx_job = &joblist[job_idx]; + tmod = QSPI_TMOD_TX_ONLY; + } else { + preg->CONFIG.RXTRANSFERLENGTH = ((packet->num_bytes + dev_data->xfer.addr_length + + dev_data->xfer.cmd_length) >> + dev_data->bytes_per_frame_exp) - 1; + + /* If sending address or command while being configured as controller */ + if (job_idx > 0 && config->op_mode == MSPI_OP_MODE_CONTROLLER) { + tmod = QSPI_TMOD_TX_AND_RX; + + /* After command and address, setup RX job for data */ + joblist[job_idx++] = EVDMA_NULL_JOB(); + transfer_list->rx_job = &joblist[job_idx]; + joblist[job_idx++] = EVDMA_JOB(packet->data_buf, packet->num_bytes, + EVDMA_ATTRIBUTE); + joblist[job_idx] = EVDMA_NULL_JOB(); + } else { + /* Sending command or address while configured as target isn't supported */ + tmod = QSPI_TMOD_RX_ONLY; + + transfer_list->rx_job = &joblist[0]; + joblist[0] = EVDMA_JOB(packet->data_buf, packet->num_bytes, + EVDMA_ATTRIBUTE); + joblist[1] = EVDMA_NULL_JOB(); + transfer_list->tx_job = &joblist[1]; + } + } + + /* + * In slave mode, a tmod register in the wrapper also needs to be set. Currently + * the address not in MDK so this is a temporary fix. + */ + uintptr_t tmod_addr = (uintptr_t)preg + QSPI_TMOD_OFFSET; + + sys_write32(tmod, tmod_addr); + + preg->CONFIG.TXBURSTLENGTH = config->tx_fifo_depth_minus_1 + 1 + - config->dma_tx_data_level; + preg->CONFIG.RXBURSTLENGTH = config->dma_rx_data_level + 1; + preg->DMA.CONFIG.LISTPTR = (uint32_t)transfer_list; + + preg->TASKS_START = 1; +} + +static inline bool vendor_specific_dma_accessible_check(const struct device *dev, + const uint8_t *data_buf) +{ + const struct mspi_dw_config *config = dev->config; + NRF_QSPI_Type *preg = (NRF_QSPI_Type *)config->wrapper_regs; + + return nrf_dma_accessible_check(preg, data_buf); +} + +static inline bool vendor_specific_read_dma_irq(const struct device *dev) +{ + const struct mspi_dw_config *config = dev->config; + NRF_QSPI_Type *preg = (NRF_QSPI_Type *)config->wrapper_regs; + + return (bool) preg->EVENTS_DMA.DONE; +} + +#else /* Supply empty vendor specific macros for generic case */ + static inline void vendor_specific_init(const struct device *dev) { ARG_UNUSED(dev); @@ -134,4 +348,33 @@ static inline int vendor_specific_xip_disable(const struct device *dev, return 0; } -#endif /* DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_exmif) */ +#if defined(CONFIG_MSPI_DMA) +static inline void vendor_specific_start_dma_xfer(const struct device *dev) +{ + ARG_UNUSED(dev); +} + +static inline bool vendor_specific_dma_accessible_check(const struct device *dev, + const uint8_t *data_buf) { + ARG_UNUSED(dev); + ARG_UNUSED(data_buf); + + return true; +} +static inline bool vendor_specific_read_dma_irq(const struct device *dev) +{ + ARG_UNUSED(dev); + + return true; +} +#endif /* defined(CONFIG_MSPI_DMA) */ +#endif /* Empty vendor specific macros */ + +/* Empty macros for generic case - no vendor-specific data */ +#ifndef VENDOR_SPECIFIC_DATA_DEFINE +#define VENDOR_SPECIFIC_DATA_DEFINE(inst) +#endif + +#ifndef VENDOR_SPECIFIC_DATA_GET +#define VENDOR_SPECIFIC_DATA_GET(inst) (void *)NULL +#endif diff --git a/dts/bindings/mspi/snps,designware-ssi.yaml b/dts/bindings/mspi/snps,designware-ssi.yaml index 69a2947f9efb..7677325493b2 100644 --- a/dts/bindings/mspi/snps,designware-ssi.yaml +++ b/dts/bindings/mspi/snps,designware-ssi.yaml @@ -47,3 +47,20 @@ properties: description: | Number of entries in the RX FIFO above which the controller gets an RX interrupt. Maximum value is the RX FIFO depth - 1. + + dma-transmit-data-level: + type: int + description: | + When in DMA mode, the transmit data level field controls the level at which a DMA request + is made by the transmit logic. A request to transmit is generated when the number of + valid data entries in the transmit FIFO is equal to or below this field value. Lower values + mean less frequent DMA triggers with larger bursts. Higher values mean fewer, smaller bursts + (lower latency, higher overhead). Range: 0-15 + + dma-receive-data-level: + type: int + description: | + When in DMA mode, the receive data level field controls the level at which a DMA request + is made by the receive logic. A request to receive is generated when the number of + valid data entries in the receive FIFO is greater than this value. Lower values mean + more frequent DMA triggers and higher values mean larger less frequent bursts. Range: 0-15 From 93df74f37d6e31877308ebb21916b0766582be91 Mon Sep 17 00:00:00 2001 From: David Jewsbury Date: Thu, 23 Oct 2025 18:18:03 +0100 Subject: [PATCH 2008/2141] [nrf fromtree] drivers: mspi_dw: Edit core disable to after PM init There is a scenario where a Bus fault occurs as the power management isn't initialised yet and the core is attempted to be turned off via the ssienr register. This commit edits this so the core register is written to after the initialisation of the power management. Signed-off-by: David Jewsbury (cherry picked from commit 4bf6a756280be4d90edf96f1a4c088c4620be41d) --- drivers/mspi/mspi_dw.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/mspi/mspi_dw.c b/drivers/mspi/mspi_dw.c index d4700a99261a..b52e0533e3a9 100644 --- a/drivers/mspi/mspi_dw.c +++ b/drivers/mspi/mspi_dw.c @@ -1864,9 +1864,6 @@ static int dev_init(const struct device *dev) } } - /* Make sure controller is disabled. */ - write_ssienr(dev, 0); - #if defined(CONFIG_PINCTRL) if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { rc = pinctrl_apply_state(dev_config->pcfg, PINCTRL_STATE_SLEEP); @@ -1877,7 +1874,15 @@ static int dev_init(const struct device *dev) } #endif - return pm_device_driver_init(dev, dev_pm_action_cb); + rc = pm_device_driver_init(dev, dev_pm_action_cb); + if (rc < 0) { + return rc; + } + + /* Make sure controller is disabled. */ + write_ssienr(dev, 0); + + return 0; } static DEVICE_API(mspi, drv_api) = { From a9bbd349efde16d5b89d65ce369c307a422327b9 Mon Sep 17 00:00:00 2001 From: David Jewsbury Date: Thu, 23 Oct 2025 18:44:10 +0100 Subject: [PATCH 2009/2141] [nrf fromtree] drivers: mspi_dw: Add CONFIG_MSPI_DW_DDR Dual data rate isn't always supported so this config enables/disables the relevant code in the driver. Signed-off-by: David Jewsbury (cherry picked from commit 55af2824dc9ab25100f625c24d84cdbc489ecef4) --- drivers/mspi/Kconfig.dw | 9 +++++++++ drivers/mspi/mspi_dw.c | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/drivers/mspi/Kconfig.dw b/drivers/mspi/Kconfig.dw index 71302a801fdb..e967671e4723 100644 --- a/drivers/mspi/Kconfig.dw +++ b/drivers/mspi/Kconfig.dw @@ -11,6 +11,13 @@ config MSPI_DW if MSPI_DW +config MSPI_DW_DDR + bool "Dual Data-Rate (DDR) capabilities" + default y + help + Dual data rate is supported by some devices and requires specific + registers to be enabled in the IP. + config MSPI_DW_HANDLE_FIFOS_IN_SYSTEM_WORKQUEUE bool "Handle FIFO in system workqueue" depends on MULTITHREADING @@ -23,6 +30,7 @@ config MSPI_DW_HANDLE_FIFOS_IN_SYSTEM_WORKQUEUE config MSPI_DW_TXD_DIV int "Designware SSI TX Drive edge divisor" + depends on MSPI_DW_DDR default 4 help Division factor to apply to calculated BAUDR value when writing it @@ -31,6 +39,7 @@ config MSPI_DW_TXD_DIV config MSPI_DW_TXD_MUL int "Designware SSI TX Drive edge multiplier" + depends on MSPI_DW_DDR default 1 help Multiplication factor to apply to calculated BAUDR value when writing diff --git a/drivers/mspi/mspi_dw.c b/drivers/mspi/mspi_dw.c index b52e0533e3a9..4f6616a91749 100644 --- a/drivers/mspi/mspi_dw.c +++ b/drivers/mspi/mspi_dw.c @@ -937,6 +937,7 @@ static int _api_dev_config(const struct device *dev, switch (cfg->data_rate) { case MSPI_DATA_RATE_SINGLE: break; +#if defined(CONFIG_MSPI_DW_DDR) case MSPI_DATA_RATE_DUAL: dev_data->spi_ctrlr0 |= SPI_CTRLR0_INST_DDR_EN_BIT; /* Also need to set DDR_EN bit */ @@ -944,6 +945,7 @@ static int _api_dev_config(const struct device *dev, case MSPI_DATA_RATE_S_D_D: dev_data->spi_ctrlr0 |= SPI_CTRLR0_SPI_DDR_EN_BIT; break; +#endif default: LOG_ERR("Data rate %d not supported", cfg->data_rate); @@ -1238,6 +1240,7 @@ static int start_next_packet(const struct device *dev) write_spi_ctrlr0(dev, dev_data->spi_ctrlr0); write_baudr(dev, dev_data->baudr); write_rx_sample_dly(dev, dev_data->rx_sample_dly); +#if defined(CONFIG_MSPI_DW_DDR) if (dev_data->spi_ctrlr0 & (SPI_CTRLR0_SPI_DDR_EN_BIT | SPI_CTRLR0_INST_DDR_EN_BIT)) { int txd = (CONFIG_MSPI_DW_TXD_MUL * dev_data->baudr) / @@ -1247,6 +1250,7 @@ static int start_next_packet(const struct device *dev) } else { write_txd_drive_edge(dev, 0); } +#endif if (xip_enabled) { write_ssienr(dev, SSIENR_SSIC_EN_BIT); From 783262e30ded98e2600d2b824151cbfac2c6f319 Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Thu, 18 Sep 2025 16:35:03 +1000 Subject: [PATCH 2010/2141] [nrf fromtree] modem: at_shell: extract user pipe handling Extract the user pipe setup and claim/release logic so that it can be re-used by other software modules, if the AT shell is not used. Ideally the chat instance would live within the `modem_at_user_pipe.c` and be handed out by `modem_at_user_pipe_claim`, but the current chat API doesn't make this possible. Signed-off-by: Jordan Yates (cherry picked from commit c0a2928f46e962e05504981e7e4dacaca9be4114) --- doc/releases/migration-guide-4.3.rst | 5 ++ drivers/modem/CMakeLists.txt | 1 + drivers/modem/Kconfig.at_shell | 24 +++-- drivers/modem/modem_at_shell.c | 126 ++++----------------------- drivers/modem/modem_at_user_pipe.c | 124 ++++++++++++++++++++++++++ include/zephyr/modem/at/user_pipe.h | 37 ++++++++ 6 files changed, 200 insertions(+), 117 deletions(-) create mode 100644 drivers/modem/modem_at_user_pipe.c create mode 100644 include/zephyr/modem/at/user_pipe.h diff --git a/doc/releases/migration-guide-4.3.rst b/doc/releases/migration-guide-4.3.rst index 83dc5e771201..97e913c765ed 100644 --- a/doc/releases/migration-guide-4.3.rst +++ b/doc/releases/migration-guide-4.3.rst @@ -153,6 +153,11 @@ Networking .. zephyr-keep-sorted-stop +Modem +***** + +* ``CONFIG_MODEM_AT_SHELL_USER_PIPE`` has been renamed to :kconfig:option:`CONFIG_MODEM_AT_USER_PIPE`. + Display ******* diff --git a/drivers/modem/CMakeLists.txt b/drivers/modem/CMakeLists.txt index 62b84bd79294..adc6614dc7fe 100644 --- a/drivers/modem/CMakeLists.txt +++ b/drivers/modem/CMakeLists.txt @@ -36,4 +36,5 @@ if (CONFIG_MODEM_SIM7080) endif() zephyr_library_sources_ifdef(CONFIG_MODEM_CELLULAR modem_cellular.c) +zephyr_library_sources_ifdef(CONFIG_MODEM_AT_USER_PIPE modem_at_user_pipe.c) zephyr_library_sources_ifdef(CONFIG_MODEM_AT_SHELL modem_at_shell.c) diff --git a/drivers/modem/Kconfig.at_shell b/drivers/modem/Kconfig.at_shell index b2f6f42e3936..3d399e2338ce 100644 --- a/drivers/modem/Kconfig.at_shell +++ b/drivers/modem/Kconfig.at_shell @@ -1,22 +1,30 @@ # Copyright (c) 2024 Trackunit Corporation # SPDX-License-Identifier: Apache-2.0 -config MODEM_AT_SHELL - bool "AT command shell based on modem modules" - select MODEM_MODULES +config MODEM_AT_USER_PIPE + bool "Modem AT command user pipe helpers" + depends on $(dt_alias_enabled,modem) select MODEM_CHAT select MODEM_PIPE select MODEM_PIPELINK + help + Utility functions for managing access to user pipes + for arbitrary AT commands + +config MODEM_AT_USER_PIPE_IDX + int "User pipe number to use" + depends on MODEM_AT_USER_PIPE + default 0 + +config MODEM_AT_SHELL + bool "AT command shell based on modem modules" + select MODEM_MODULES + select MODEM_AT_USER_PIPE depends on !MODEM_SHELL depends on !SHELL_WILDCARD - depends on $(dt_alias_enabled,modem) if MODEM_AT_SHELL -config MODEM_AT_SHELL_USER_PIPE - int "User pipe number to use" - default 0 - config MODEM_AT_SHELL_RESPONSE_TIMEOUT_S int "Timeout waiting for response to AT command in seconds" default 5 diff --git a/drivers/modem/modem_at_shell.c b/drivers/modem/modem_at_shell.c index 5d2820d7483e..7d1930b6b04b 100644 --- a/drivers/modem/modem_at_shell.c +++ b/drivers/modem/modem_at_shell.c @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -13,17 +14,6 @@ #include LOG_MODULE_REGISTER(modem_at_shell, CONFIG_MODEM_LOG_LEVEL); -#define AT_SHELL_MODEM_NODE DT_ALIAS(modem) -#define AT_SHELL_PIPELINK_NAME _CONCAT(user_pipe_, CONFIG_MODEM_AT_SHELL_USER_PIPE) - -#define AT_SHELL_STATE_ATTACHED_BIT 0 -#define AT_SHELL_STATE_SCRIPT_RUNNING_BIT 1 - -MODEM_PIPELINK_DT_DECLARE(AT_SHELL_MODEM_NODE, AT_SHELL_PIPELINK_NAME); - -static struct modem_pipelink *at_shell_pipelink = - MODEM_PIPELINK_DT_GET(AT_SHELL_MODEM_NODE, AT_SHELL_PIPELINK_NAME); - static struct modem_chat at_shell_chat; static uint8_t at_shell_chat_receive_buf[CONFIG_MODEM_AT_SHELL_CHAT_RECEIVE_BUF_SIZE]; static uint8_t *at_shell_chat_argv_buf[2]; @@ -32,10 +22,6 @@ static struct modem_chat_script_chat at_shell_script_chat[1]; static struct modem_chat_match at_shell_script_chat_matches[2]; static uint8_t at_shell_match_buf[CONFIG_MODEM_AT_SHELL_RESPONSE_MAX_SIZE]; static const struct shell *at_shell_active_shell; -static struct k_work at_shell_open_pipe_work; -static struct k_work at_shell_attach_chat_work; -static struct k_work at_shell_release_chat_work; -static atomic_t at_shell_state; static void at_shell_print_any_match(struct modem_chat *chat, char **argv, uint16_t argc, void *user_data) @@ -74,7 +60,7 @@ static void at_shell_script_callback(struct modem_chat *chat, enum modem_chat_script_result result, void *user_data) { - atomic_clear_bit(&at_shell_state, AT_SHELL_STATE_SCRIPT_RUNNING_BIT); + modem_at_user_pipe_release(); } MODEM_CHAT_SCRIPT_DEFINE( @@ -85,83 +71,6 @@ MODEM_CHAT_SCRIPT_DEFINE( CONFIG_MODEM_AT_SHELL_RESPONSE_TIMEOUT_S ); -static void at_shell_pipe_callback(struct modem_pipe *pipe, - enum modem_pipe_event event, - void *user_data) -{ - ARG_UNUSED(user_data); - - switch (event) { - case MODEM_PIPE_EVENT_OPENED: - LOG_INF("pipe opened"); - k_work_submit(&at_shell_attach_chat_work); - break; - - default: - break; - } -} - -void at_shell_pipelink_callback(struct modem_pipelink *link, - enum modem_pipelink_event event, - void *user_data) -{ - ARG_UNUSED(user_data); - - switch (event) { - case MODEM_PIPELINK_EVENT_CONNECTED: - LOG_INF("pipe connected"); - k_work_submit(&at_shell_open_pipe_work); - break; - - case MODEM_PIPELINK_EVENT_DISCONNECTED: - LOG_INF("pipe disconnected"); - k_work_submit(&at_shell_release_chat_work); - break; - - default: - break; - } -} - -static void at_shell_open_pipe_handler(struct k_work *work) -{ - ARG_UNUSED(work); - - LOG_INF("opening pipe"); - - modem_pipe_attach(modem_pipelink_get_pipe(at_shell_pipelink), - at_shell_pipe_callback, - NULL); - - modem_pipe_open_async(modem_pipelink_get_pipe(at_shell_pipelink)); -} - -static void at_shell_attach_chat_handler(struct k_work *work) -{ - ARG_UNUSED(work); - - modem_chat_attach(&at_shell_chat, modem_pipelink_get_pipe(at_shell_pipelink)); - atomic_set_bit(&at_shell_state, AT_SHELL_STATE_ATTACHED_BIT); - LOG_INF("chat attached"); -} - -static void at_shell_release_chat_handler(struct k_work *work) -{ - ARG_UNUSED(work); - - modem_chat_release(&at_shell_chat); - atomic_clear_bit(&at_shell_state, AT_SHELL_STATE_ATTACHED_BIT); - LOG_INF("chat released"); -} - -static void at_shell_init_work(void) -{ - k_work_init(&at_shell_open_pipe_work, at_shell_open_pipe_handler); - k_work_init(&at_shell_attach_chat_work, at_shell_attach_chat_handler); - k_work_init(&at_shell_release_chat_work, at_shell_release_chat_handler); -} - static void at_shell_init_chat(void) { const struct modem_chat_config at_shell_chat_config = { @@ -204,17 +113,11 @@ static void at_shell_init_script_chat(void) CONFIG_MODEM_AT_SHELL_RESPONSE_TIMEOUT_S); } -static void at_shell_init_pipelink(void) -{ - modem_pipelink_attach(at_shell_pipelink, at_shell_pipelink_callback, NULL); -} - static int at_shell_init(void) { - at_shell_init_work(); at_shell_init_chat(); at_shell_init_script_chat(); - at_shell_init_pipelink(); + modem_at_user_pipe_init(&at_shell_chat); return 0; } @@ -228,14 +131,19 @@ static int at_shell_cmd_handler(const struct shell *sh, size_t argc, char **argv return -EINVAL; } - if (!atomic_test_bit(&at_shell_state, AT_SHELL_STATE_ATTACHED_BIT)) { - shell_error(sh, "modem is not ready"); - return -EPERM; - } - - if (atomic_test_and_set_bit(&at_shell_state, AT_SHELL_STATE_SCRIPT_RUNNING_BIT)) { - shell_error(sh, "script is already running"); - return -EBUSY; + ret = modem_at_user_pipe_claim(); + if (ret < 0) { + switch (ret) { + case -EPERM: + shell_error(sh, "modem is not ready"); + break; + case -EBUSY: + shell_error(sh, "script is already running"); + break; + default: + shell_error(sh, "unknown"); + } + return ret; } strncpy(at_shell_request_buf, argv[1], sizeof(at_shell_request_buf) - 1); @@ -260,7 +168,7 @@ static int at_shell_cmd_handler(const struct shell *sh, size_t argc, char **argv ret = modem_chat_run_script_async(&at_shell_chat, &at_shell_script); if (ret < 0) { shell_error(sh, "failed to start script"); - atomic_clear_bit(&at_shell_state, AT_SHELL_STATE_SCRIPT_RUNNING_BIT); + modem_at_user_pipe_release(); } return ret; diff --git a/drivers/modem/modem_at_user_pipe.c b/drivers/modem/modem_at_user_pipe.c new file mode 100644 index 000000000000..6fb0046f0fef --- /dev/null +++ b/drivers/modem/modem_at_user_pipe.c @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2025 Embeint Holdings Pty Ltd + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include + +#define AT_UTIL_MODEM_NODE DT_ALIAS(modem) +#define AT_UTIL_PIPELINK_NAME _CONCAT(user_pipe_, CONFIG_MODEM_AT_USER_PIPE_IDX) + +#define AT_UTIL_STATE_ATTACHED_BIT 0 +#define AT_UTIL_STATE_SCRIPT_RUNNING_BIT 1 + +MODEM_PIPELINK_DT_DECLARE(AT_UTIL_MODEM_NODE, AT_UTIL_PIPELINK_NAME); + +static struct modem_pipelink *at_util_pipelink = + MODEM_PIPELINK_DT_GET(AT_UTIL_MODEM_NODE, AT_UTIL_PIPELINK_NAME); + +static struct k_work at_util_open_pipe_work; +static struct k_work at_util_attach_chat_work; +static struct k_work at_util_release_chat_work; +static struct modem_chat *at_util_chat; +static atomic_t at_util_state; + +LOG_MODULE_REGISTER(modem_at_user_pipe, CONFIG_MODEM_LOG_LEVEL); + +static void at_util_pipe_callback(struct modem_pipe *pipe, enum modem_pipe_event event, + void *user_data) +{ + ARG_UNUSED(user_data); + + switch (event) { + case MODEM_PIPE_EVENT_OPENED: + LOG_INF("pipe opened"); + k_work_submit(&at_util_attach_chat_work); + break; + + default: + break; + } +} + +void at_util_pipelink_callback(struct modem_pipelink *link, enum modem_pipelink_event event, + void *user_data) +{ + ARG_UNUSED(user_data); + + switch (event) { + case MODEM_PIPELINK_EVENT_CONNECTED: + LOG_INF("pipe connected"); + k_work_submit(&at_util_open_pipe_work); + break; + + case MODEM_PIPELINK_EVENT_DISCONNECTED: + LOG_INF("pipe disconnected"); + k_work_submit(&at_util_release_chat_work); + break; + + default: + break; + } +} + +static void at_util_open_pipe_handler(struct k_work *work) +{ + ARG_UNUSED(work); + + LOG_INF("opening pipe"); + + modem_pipe_attach(modem_pipelink_get_pipe(at_util_pipelink), at_util_pipe_callback, NULL); + + modem_pipe_open_async(modem_pipelink_get_pipe(at_util_pipelink)); +} + +static void at_util_attach_chat_handler(struct k_work *work) +{ + ARG_UNUSED(work); + + modem_chat_attach(at_util_chat, modem_pipelink_get_pipe(at_util_pipelink)); + atomic_set_bit(&at_util_state, AT_UTIL_STATE_ATTACHED_BIT); + LOG_INF("chat attached"); +} + +static void at_util_release_chat_handler(struct k_work *work) +{ + ARG_UNUSED(work); + + modem_chat_release(at_util_chat); + atomic_clear_bit(&at_util_state, AT_UTIL_STATE_ATTACHED_BIT); + LOG_INF("chat released"); +} + +void modem_at_user_pipe_init(struct modem_chat *chat) +{ + at_util_chat = chat; + /* Initialise workers and setup callbacks */ + k_work_init(&at_util_open_pipe_work, at_util_open_pipe_handler); + k_work_init(&at_util_attach_chat_work, at_util_attach_chat_handler); + k_work_init(&at_util_release_chat_work, at_util_release_chat_handler); + modem_pipelink_attach(at_util_pipelink, at_util_pipelink_callback, NULL); +} + +int modem_at_user_pipe_claim(void) +{ + if (!atomic_test_bit(&at_util_state, AT_UTIL_STATE_ATTACHED_BIT)) { + return -EPERM; + } + + if (atomic_test_and_set_bit(&at_util_state, AT_UTIL_STATE_SCRIPT_RUNNING_BIT)) { + return -EBUSY; + } + + return 0; +} + +void modem_at_user_pipe_release(void) +{ + atomic_clear_bit(&at_util_state, AT_UTIL_STATE_SCRIPT_RUNNING_BIT); +} diff --git a/include/zephyr/modem/at/user_pipe.h b/include/zephyr/modem/at/user_pipe.h new file mode 100644 index 000000000000..9732f5131111 --- /dev/null +++ b/include/zephyr/modem/at/user_pipe.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2025 Embeint Holdings Pty Ltd + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_MODEM_AT_USER_PIPE_ +#define ZEPHYR_MODEM_AT_USER_PIPE_ + +#include + +/** + * @brief Initialise the AT command user pipe + * + * @param chat Chat instance that will be used with the user pipe + */ +void modem_at_user_pipe_init(struct modem_chat *chat); + +/** + * @brief Claim the AT command user pipe to run commands + * + * + * @retval 0 On success + * @retval -EPERM Modem is not ready + * @retval -EBUSY User pipe already claimed + */ +int modem_at_user_pipe_claim(void); + +/** + * @brief Release the AT command user pipe to other users + * + * Must be called after @ref modem_at_user_pipe_claim when pipe is no longer + * in use. + */ +void modem_at_user_pipe_release(void); + +#endif /* ZEPHYR_MODEM_AT_USER_PIPE_ */ From 38985516fa24c617ccba73d13e45eadaf2e88956 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Wed, 24 Sep 2025 16:49:54 +0300 Subject: [PATCH 2011/2141] [nrf fromtree] modem: modem_cellular: Allow PPP interface to wake up the device Allow PPP device to wake up the underlying cellular modem. Signed-off-by: Seppo Takalo (cherry picked from commit b8541c53eeafd1dc9dd17d05c09db39a20bb200a) --- drivers/modem/modem_cellular.c | 26 ++++++++++++------------- include/zephyr/modem/ppp.h | 35 ++++++++++++++++++++++++++++++---- subsys/modem/Kconfig | 1 + subsys/modem/modem_ppp.c | 17 +++++++++++++++-- 4 files changed, 60 insertions(+), 19 deletions(-) diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index 3e7b3a30eff1..23c4795a3549 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -2905,7 +2905,7 @@ MODEM_CHAT_SCRIPT_DEFINE(sqn_gm02s_periodic_chat_script, &modem_cellular_api); #define MODEM_CELLULAR_DEVICE_QUECTEL_BG9X(inst) \ - MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ + MODEM_DT_INST_PPP_DEFINE(inst, MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ \ static struct modem_cellular_data MODEM_CELLULAR_INST_NAME(data, inst) = { \ .chat_delimiter = "\r", \ @@ -2925,7 +2925,7 @@ MODEM_CHAT_SCRIPT_DEFINE(sqn_gm02s_periodic_chat_script, &quectel_bg9x_shutdown_chat_script) #define MODEM_CELLULAR_DEVICE_QUECTEL_EG25_G(inst) \ - MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ + MODEM_DT_INST_PPP_DEFINE(inst, MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ \ static struct modem_cellular_data MODEM_CELLULAR_INST_NAME(data, inst) = { \ .chat_delimiter = "\r", \ @@ -2944,7 +2944,7 @@ MODEM_CHAT_SCRIPT_DEFINE(sqn_gm02s_periodic_chat_script, &quectel_eg25_g_periodic_chat_script, NULL) #define MODEM_CELLULAR_DEVICE_QUECTEL_EG800Q(inst) \ - MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ + MODEM_DT_INST_PPP_DEFINE(inst, MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ \ static struct modem_cellular_data MODEM_CELLULAR_INST_NAME(data, inst) = { \ .chat_delimiter = "\r", \ @@ -2963,7 +2963,7 @@ MODEM_CHAT_SCRIPT_DEFINE(sqn_gm02s_periodic_chat_script, &quectel_eg800q_periodic_chat_script, NULL) #define MODEM_CELLULAR_DEVICE_SIMCOM_SIM7080(inst) \ - MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ + MODEM_DT_INST_PPP_DEFINE(inst, MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ \ static struct modem_cellular_data MODEM_CELLULAR_INST_NAME(data, inst) = { \ .chat_delimiter = "\r", \ @@ -2982,7 +2982,7 @@ MODEM_CHAT_SCRIPT_DEFINE(sqn_gm02s_periodic_chat_script, &simcom_sim7080_periodic_chat_script, NULL) #define MODEM_CELLULAR_DEVICE_SIMCOM_A76XX(inst) \ - MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ + MODEM_DT_INST_PPP_DEFINE(inst, MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ \ static struct modem_cellular_data MODEM_CELLULAR_INST_NAME(data, inst) = { \ .chat_delimiter = "\r", \ @@ -3002,7 +3002,7 @@ MODEM_CHAT_SCRIPT_DEFINE(sqn_gm02s_periodic_chat_script, &simcom_a76xx_shutdown_chat_script) #define MODEM_CELLULAR_DEVICE_U_BLOX_SARA_R4(inst) \ - MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ + MODEM_DT_INST_PPP_DEFINE(inst, MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ \ static struct modem_cellular_data MODEM_CELLULAR_INST_NAME(data, inst) = { \ .chat_delimiter = "\r", \ @@ -3021,7 +3021,7 @@ MODEM_CHAT_SCRIPT_DEFINE(sqn_gm02s_periodic_chat_script, &u_blox_sara_r4_periodic_chat_script, NULL) #define MODEM_CELLULAR_DEVICE_U_BLOX_SARA_R5(inst) \ - MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ + MODEM_DT_INST_PPP_DEFINE(inst, MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ \ static struct modem_cellular_data MODEM_CELLULAR_INST_NAME(data, inst) = { \ .chat_delimiter = "\r", \ @@ -3040,7 +3040,7 @@ MODEM_CHAT_SCRIPT_DEFINE(sqn_gm02s_periodic_chat_script, &u_blox_sara_r5_periodic_chat_script, NULL) #define MODEM_CELLULAR_DEVICE_U_BLOX_LARA_R6(inst) \ - MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ + MODEM_DT_INST_PPP_DEFINE(inst, MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ \ static struct modem_cellular_data MODEM_CELLULAR_INST_NAME(data, inst) = { \ .chat_delimiter = "\r", \ @@ -3060,7 +3060,7 @@ MODEM_CHAT_SCRIPT_DEFINE(sqn_gm02s_periodic_chat_script, NULL) #define MODEM_CELLULAR_DEVICE_SWIR_HL7800(inst) \ - MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ + MODEM_DT_INST_PPP_DEFINE(inst, MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ \ static struct modem_cellular_data MODEM_CELLULAR_INST_NAME(data, inst) = { \ .chat_delimiter = "\r", \ @@ -3079,7 +3079,7 @@ MODEM_CHAT_SCRIPT_DEFINE(sqn_gm02s_periodic_chat_script, &swir_hl7800_periodic_chat_script, NULL) #define MODEM_CELLULAR_DEVICE_TELIT_ME910G1(inst) \ - MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ + MODEM_DT_INST_PPP_DEFINE(inst, MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ \ static struct modem_cellular_data MODEM_CELLULAR_INST_NAME(data, inst) = { \ .chat_delimiter = "\r", \ @@ -3098,7 +3098,7 @@ MODEM_CHAT_SCRIPT_DEFINE(sqn_gm02s_periodic_chat_script, NULL) #define MODEM_CELLULAR_DEVICE_TELIT_ME310G1(inst) \ - MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ + MODEM_DT_INST_PPP_DEFINE(inst, MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ \ static struct modem_cellular_data MODEM_CELLULAR_INST_NAME(data, inst) = { \ .chat_delimiter = "\r", \ @@ -3117,7 +3117,7 @@ MODEM_CHAT_SCRIPT_DEFINE(sqn_gm02s_periodic_chat_script, &telit_me310g1_shutdown_chat_script) #define MODEM_CELLULAR_DEVICE_NORDIC_NRF91_SLM(inst) \ - MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 1500); \ + MODEM_DT_INST_PPP_DEFINE(inst, MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 1500); \ \ static struct modem_cellular_data MODEM_CELLULAR_INST_NAME(data, inst) = { \ .chat_delimiter = "\r\n", \ @@ -3134,7 +3134,7 @@ MODEM_CHAT_SCRIPT_DEFINE(sqn_gm02s_periodic_chat_script, &nordic_nrf91_slm_periodic_chat_script, NULL) #define MODEM_CELLULAR_DEVICE_SQN_GM02S(inst) \ - MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ + MODEM_DT_INST_PPP_DEFINE(inst, MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ \ static struct modem_cellular_data MODEM_CELLULAR_INST_NAME(data, inst) = { \ .chat_delimiter = "\r", \ diff --git a/include/zephyr/modem/ppp.h b/include/zephyr/modem/ppp.h index 2b91e51a35c9..b3dbcfdeb7fb 100644 --- a/include/zephyr/modem/ppp.h +++ b/include/zephyr/modem/ppp.h @@ -123,6 +123,10 @@ struct modem_ppp { #endif }; +struct modem_ppp_config { + const struct device *dev; +}; + /** * @endcond */ @@ -172,13 +176,17 @@ int modem_ppp_init_internal(const struct device *dev); * network device instance, and binds the modem_ppp instance to the PPP L2 * instance. * + * If underlying cellular device is given, the PPP interface will manage the + * power state of the cellular device when starting and stopping the PPP. + * + * @param _dev Cellular device instance for power management or NULL if not used * @param _name Name of the statically defined modem_ppp instance * @param _init_iface Hook for the PPP L2 network interface init function * @param _prio Initialization priority of the PPP L2 net iface * @param _mtu Max size of net_pkt data sent and received on PPP L2 net iface * @param _buf_size Size of partial PPP frame transmit and receive buffers */ -#define MODEM_PPP_DEFINE(_name, _init_iface, _prio, _mtu, _buf_size) \ +#define MODEM_DEV_PPP_DEFINE(_dev, _name, _init_iface, _prio, _mtu, _buf_size) \ extern const struct ppp_api modem_ppp_ppp_api; \ \ static uint8_t _CONCAT(_name, _receive_buf)[_buf_size]; \ @@ -189,11 +197,30 @@ int modem_ppp_init_internal(const struct device *dev); .receive_buf = _CONCAT(_name, _receive_buf), \ .transmit_buf = _CONCAT(_name, _transmit_buf), \ .buf_size = _buf_size, \ + }; \ + static const struct modem_ppp_config _CONCAT(_name, _config) = { \ + .dev = _dev, \ }; \ \ - NET_DEVICE_INIT(_CONCAT(ppp_net_dev_, _name), "modem_ppp_" # _name, \ - modem_ppp_init_internal, NULL, &_name, NULL, _prio, &modem_ppp_ppp_api, \ - PPP_L2, NET_L2_GET_CTX_TYPE(PPP_L2), _mtu) + NET_DEVICE_INIT(_CONCAT(ppp_net_dev_, _name), "modem_ppp_" #_name, \ + modem_ppp_init_internal, NULL, &_name, &_CONCAT(_name, _config), _prio, \ + &modem_ppp_ppp_api, PPP_L2, NET_L2_GET_CTX_TYPE(PPP_L2), _mtu) + +/** + * @brief Define a modem PPP module for cellular device tree instance. + * + * @see MODEM_DEV_PPP_DEFINE + */ +#define MODEM_DT_INST_PPP_DEFINE(inst, _name, _init_iface, _prio, _mtu, _buf_size) \ + MODEM_DEV_PPP_DEFINE(DEVICE_DT_INST_GET(inst), _name, _init_iface, _prio, _mtu, _buf_size) + +/** + * @brief Define a modem PPP module without a device and bind it to a network interface. + * + * @see MODEM_DEV_PPP_DEFINE + */ +#define MODEM_PPP_DEFINE(_name, _init_iface, _prio, _mtu, _buf_size) \ + MODEM_DEV_PPP_DEFINE(NULL, _name, _init_iface, _prio, _mtu, _buf_size) /** * @} diff --git a/subsys/modem/Kconfig b/subsys/modem/Kconfig index b7c3f7ba9014..087b4d79be8c 100644 --- a/subsys/modem/Kconfig +++ b/subsys/modem/Kconfig @@ -71,6 +71,7 @@ config MODEM_PPP select MODEM_PIPE select RING_BUFFER select CRC + select PM_DEVICE_RUNTIME_ASYNC if PM_DEVICE_RUNTIME if MODEM_PPP diff --git a/subsys/modem/modem_ppp.c b/subsys/modem/modem_ppp.c index 537f198251f7..9e2e2b5d71b7 100644 --- a/subsys/modem/modem_ppp.c +++ b/subsys/modem/modem_ppp.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -445,12 +446,24 @@ static void modem_ppp_ppp_api_init(struct net_if *iface) static int modem_ppp_ppp_api_start(const struct device *dev) { - return 0; + const struct modem_ppp_config *config = (const struct modem_ppp_config *)dev->config; + + if (config == NULL || config->dev == NULL) { + return 0; + } + + return pm_device_runtime_get(config->dev); } static int modem_ppp_ppp_api_stop(const struct device *dev) { - return 0; + const struct modem_ppp_config *config = (const struct modem_ppp_config *)dev->config; + + if (config == NULL || config->dev == NULL) { + return 0; + } + + return pm_device_runtime_put_async(config->dev, K_NO_WAIT); } static int modem_ppp_ppp_api_send(const struct device *dev, struct net_pkt *pkt) From 7b7ed529100a1e51953a2455dfd281b5c6c4d987 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Tue, 26 Aug 2025 15:23:51 +0300 Subject: [PATCH 2012/2141] [nrf fromtree] modem: cmux: Clean debugging a bit Full CMUX frames are way too much to fill the debug log so disable those by default. Sometimes it is enough to see the CMD and response types, without hexdump. Added also debug messages for opening and closing events. Signed-off-by: Seppo Takalo (cherry picked from commit dac7a0fe06b4e4e3c53c9a19163699d6f5455001) --- subsys/modem/Kconfig | 6 ++++++ subsys/modem/modem_cmux.c | 23 ++++++++++++++++++----- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/subsys/modem/Kconfig b/subsys/modem/Kconfig index 087b4d79be8c..9f6ce441b7d5 100644 --- a/subsys/modem/Kconfig +++ b/subsys/modem/Kconfig @@ -55,6 +55,12 @@ module = MODEM_CMUX module-str = modem_cmux source "subsys/logging/Kconfig.template.log_config" +config MODEM_CMUX_LOG_FRAMES + bool "Log CMUX frames" + depends on MODEM_CMUX_LOG_LEVEL_DBG + help + Enable logging of CMUX frames. This can produce a lot of log data. + endif config MODEM_PIPE diff --git a/subsys/modem/modem_cmux.c b/subsys/modem/modem_cmux.c index d5547e03da28..3e7a001c82ca 100644 --- a/subsys/modem/modem_cmux.c +++ b/subsys/modem/modem_cmux.c @@ -101,6 +101,7 @@ static struct modem_cmux_command *modem_cmux_command_wrap(const uint8_t *data) return (struct modem_cmux_command *)data; } +#if CONFIG_MODEM_CMUX_LOG_FRAMES static const char *modem_cmux_frame_type_to_str(enum modem_cmux_frame_types frame_type) { switch (frame_type) { @@ -131,8 +132,14 @@ static void modem_cmux_log_frame(const struct modem_cmux_frame *frame, { LOG_DBG("%s ch:%u cr:%u pf:%u type:%s dlen:%u", action, frame->dlci_address, frame->cr, frame->pf, modem_cmux_frame_type_to_str(frame->type), frame->data_len); - LOG_HEXDUMP_DBG(frame->data, hexdump_len, "data:"); + if (hexdump_len > 0) { + LOG_HEXDUMP_DBG(frame->data, hexdump_len, "data:"); + } } +#else +#define modem_cmux_log_frame(frame, action, hexdump_len) \ + do { ARG_UNUSED(frame); ARG_UNUSED(action); ARG_UNUSED(hexdump_len); } while (0) +#endif /* CONFIG_MODEM_CMUX_LOG_FRAMES */ static void modem_cmux_log_transmit_frame(const struct modem_cmux_frame *frame) { @@ -225,14 +232,12 @@ static void modem_cmux_log_transmit_command(const struct modem_cmux_command *com { LOG_DBG("ea:%u,cr:%u,type:%s", command->type.ea, command->type.cr, modem_cmux_command_type_to_str(command->type.value)); - LOG_HEXDUMP_DBG(command->value, command->length.value, "data:"); } static void modem_cmux_log_received_command(const struct modem_cmux_command *command) { LOG_DBG("ea:%u,cr:%u,type:%s", command->type.ea, command->type.cr, modem_cmux_command_type_to_str(command->type.value)); - LOG_HEXDUMP_DBG(command->value, command->length.value, "data:"); } static void modem_cmux_raise_event(struct modem_cmux *cmux, enum modem_cmux_event event) @@ -438,6 +443,7 @@ static void modem_cmux_on_cld_command(struct modem_cmux *cmux, struct modem_cmux k_work_cancel_delayable(&cmux->disconnect_work); } + LOG_DBG("CMUX disconnected"); cmux->state = MODEM_CMUX_STATE_DISCONNECTED; k_mutex_lock(&cmux->transmit_rb_lock, K_FOREVER); cmux->flow_control_on = false; @@ -455,6 +461,7 @@ static void modem_cmux_on_control_frame_ua(struct modem_cmux *cmux) return; } + LOG_DBG("CMUX connected"); cmux->state = MODEM_CMUX_STATE_CONNECTED; k_mutex_lock(&cmux->transmit_rb_lock, K_FOREVER); cmux->flow_control_on = true; @@ -534,6 +541,7 @@ static void modem_cmux_on_control_frame_sabm(struct modem_cmux *cmux) return; } + LOG_DBG("CMUX connection request received"); cmux->state = MODEM_CMUX_STATE_CONNECTED; k_mutex_lock(&cmux->transmit_rb_lock, K_FOREVER); cmux->flow_control_on = true; @@ -561,7 +569,7 @@ static void modem_cmux_on_control_frame(struct modem_cmux *cmux) break; default: - LOG_WRN("Unknown %s frame type", "control"); + LOG_WRN("Unknown %s frame type %d", "control", cmux->frame.type); break; } } @@ -586,6 +594,7 @@ static void modem_cmux_on_dlci_frame_ua(struct modem_cmux_dlci *dlci) { switch (dlci->state) { case MODEM_CMUX_DLCI_STATE_OPENING: + LOG_DBG("DLCI %u opened", dlci->dlci_address); dlci->state = MODEM_CMUX_DLCI_STATE_OPEN; modem_pipe_notify_opened(&dlci->pipe); k_work_cancel_delayable(&dlci->open_work); @@ -595,6 +604,7 @@ static void modem_cmux_on_dlci_frame_ua(struct modem_cmux_dlci *dlci) break; case MODEM_CMUX_DLCI_STATE_CLOSING: + LOG_DBG("DLCI %u closed", dlci->dlci_address); dlci->state = MODEM_CMUX_DLCI_STATE_CLOSED; modem_pipe_notify_closed(&dlci->pipe); k_work_cancel_delayable(&dlci->close_work); @@ -637,6 +647,7 @@ static void modem_cmux_on_dlci_frame_sabm(struct modem_cmux_dlci *dlci) return; } + LOG_DBG("DLCI %u SABM request accepted, DLCI opened", dlci->dlci_address); dlci->state = MODEM_CMUX_DLCI_STATE_OPEN; modem_pipe_notify_opened(&dlci->pipe); k_mutex_lock(&dlci->receive_rb_lock, K_FOREVER); @@ -655,6 +666,7 @@ static void modem_cmux_on_dlci_frame_disc(struct modem_cmux_dlci *dlci) return; } + LOG_DBG("DLCI %u disconnected", dlci->dlci_address); dlci->state = MODEM_CMUX_DLCI_STATE_CLOSED; modem_pipe_notify_closed(&dlci->pipe); } @@ -690,7 +702,8 @@ static void modem_cmux_on_dlci_frame(struct modem_cmux *cmux) break; default: - LOG_WRN("Unknown %s frame type", "DLCI"); + LOG_WRN("Unknown %s frame type (%d, DLCI %d)", "DLCI", cmux->frame.type, + cmux->frame.dlci_address); break; } } From cab5343d4fc63bb514d708f8e607ede20bbce524 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Thu, 28 Aug 2025 16:15:46 +0300 Subject: [PATCH 2013/2141] [nrf fromtree] modem: cmux: Rework the drop handling Do not read extra byte when we decide to drop a frame. Instead go directly to MODEM_CMUX_RECEIVE_STATE_SOF, so the next flag character will start a new frame. Signed-off-by: Seppo Takalo (cherry picked from commit 0025751414ef69e906d445be7269fe0ed544173e) --- include/zephyr/modem/cmux.h | 1 - subsys/modem/modem_cmux.c | 26 +++++++++++--------------- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/include/zephyr/modem/cmux.h b/include/zephyr/modem/cmux.h index 3332c40bd18e..10fe93132819 100644 --- a/include/zephyr/modem/cmux.h +++ b/include/zephyr/modem/cmux.h @@ -74,7 +74,6 @@ enum modem_cmux_receive_state { MODEM_CMUX_RECEIVE_STATE_LENGTH_CONT, MODEM_CMUX_RECEIVE_STATE_DATA, MODEM_CMUX_RECEIVE_STATE_FCS, - MODEM_CMUX_RECEIVE_STATE_DROP, MODEM_CMUX_RECEIVE_STATE_EOF, }; diff --git a/subsys/modem/modem_cmux.c b/subsys/modem/modem_cmux.c index 3e7a001c82ca..563f6a0baed6 100644 --- a/subsys/modem/modem_cmux.c +++ b/subsys/modem/modem_cmux.c @@ -13,6 +13,7 @@ LOG_MODULE_REGISTER(modem_cmux, CONFIG_MODEM_CMUX_LOG_LEVEL); #include +#define MODEM_CMUX_SOF (0xF9) #define MODEM_CMUX_FCS_POLYNOMIAL (0xE0) #define MODEM_CMUX_FCS_INIT_VALUE (0xFF) #define MODEM_CMUX_EA (0x01) @@ -282,7 +283,7 @@ static uint16_t modem_cmux_transmit_frame(struct modem_cmux *cmux, data_len = MIN(data_len, CONFIG_MODEM_CMUX_MTU); /* SOF */ - buf[0] = 0xF9; + buf[0] = MODEM_CMUX_SOF; /* DLCI Address (Max 63) */ buf[1] = 0x01 | (frame->cr << 1) | (frame->dlci_address << 2); @@ -318,7 +319,7 @@ static uint16_t modem_cmux_transmit_frame(struct modem_cmux *cmux, /* FCS and EOF will be put on the same call */ buf[0] = fcs; - buf[1] = 0xF9; + buf[1] = MODEM_CMUX_SOF; ring_buf_put(&cmux->transmit_rb, buf, 2); k_work_schedule(&cmux->transmit_work, K_NO_WAIT); return data_len; @@ -744,7 +745,7 @@ static void modem_cmux_process_received_byte(struct modem_cmux *cmux, uint8_t by switch (cmux->receive_state) { case MODEM_CMUX_RECEIVE_STATE_SOF: - if (byte == 0xF9) { + if (byte == MODEM_CMUX_SOF) { cmux->receive_state = MODEM_CMUX_RECEIVE_STATE_RESYNC; break; } @@ -756,7 +757,7 @@ static void modem_cmux_process_received_byte(struct modem_cmux *cmux, uint8_t by * Allow any number of consecutive flags (0xF9). * 0xF9 could also be a valid address field for DLCI 62. */ - if (byte == 0xF9) { + if (byte == MODEM_CMUX_SOF) { break; } @@ -813,7 +814,7 @@ static void modem_cmux_process_received_byte(struct modem_cmux *cmux, uint8_t by if (cmux->frame.data_len > CONFIG_MODEM_CMUX_MTU) { LOG_ERR("Too large frame"); - cmux->receive_state = MODEM_CMUX_RECEIVE_STATE_DROP; + modem_cmux_drop_frame(cmux); break; } @@ -838,7 +839,7 @@ static void modem_cmux_process_received_byte(struct modem_cmux *cmux, uint8_t by if (cmux->frame.data_len > CONFIG_MODEM_CMUX_MTU) { LOG_ERR("Too large frame"); - cmux->receive_state = MODEM_CMUX_RECEIVE_STATE_DROP; + modem_cmux_drop_frame(cmux); break; } @@ -846,7 +847,7 @@ static void modem_cmux_process_received_byte(struct modem_cmux *cmux, uint8_t by LOG_ERR("Indicated frame data length %u exceeds receive buffer size %u", cmux->frame.data_len, cmux->receive_buf_size); - cmux->receive_state = MODEM_CMUX_RECEIVE_STATE_DROP; + modem_cmux_drop_frame(cmux); break; } @@ -873,7 +874,7 @@ static void modem_cmux_process_received_byte(struct modem_cmux *cmux, uint8_t by if (cmux->receive_buf_len > cmux->receive_buf_size) { LOG_WRN("Receive buffer overrun (%u > %u)", cmux->receive_buf_len, cmux->receive_buf_size); - cmux->receive_state = MODEM_CMUX_RECEIVE_STATE_DROP; + modem_cmux_drop_frame(cmux); break; } @@ -890,21 +891,16 @@ static void modem_cmux_process_received_byte(struct modem_cmux *cmux, uint8_t by if (fcs != byte) { LOG_WRN("Frame FCS error"); - /* Drop frame */ - cmux->receive_state = MODEM_CMUX_RECEIVE_STATE_DROP; + modem_cmux_drop_frame(cmux); break; } cmux->receive_state = MODEM_CMUX_RECEIVE_STATE_EOF; break; - case MODEM_CMUX_RECEIVE_STATE_DROP: - modem_cmux_drop_frame(cmux); - break; - case MODEM_CMUX_RECEIVE_STATE_EOF: /* Validate byte is EOF */ - if (byte != 0xF9) { + if (byte != MODEM_CMUX_SOF) { /* Unexpected byte */ modem_cmux_drop_frame(cmux); break; From b88c52764cf90fdf3b9e1027958085fb55eb3859 Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Thu, 2 Oct 2025 14:52:25 +1000 Subject: [PATCH 2014/2141] [nrf fromtree] modem: cmux: auto calculate work buffer sizes Automatically size the CMUX work buffers based on `CONFIG_MODEM_CMUX_MTU`. This eliminates a Kconfig variable that would otherwise need to manually be kept in sync. The option to extend the size of these buffers is still provided through `CONFIG_MODEM_CMUX_WORK_BUFFER_SIZE_EXTRA`. Signed-off-by: Jordan Yates (cherry picked from commit f047a412e068ffb403a464e24f47509e057acdae) --- doc/releases/migration-guide-4.3.rst | 2 ++ drivers/modem/modem_cellular.c | 8 ++++---- include/zephyr/modem/cmux.h | 6 +++++- subsys/modem/Kconfig | 12 +++++------- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/doc/releases/migration-guide-4.3.rst b/doc/releases/migration-guide-4.3.rst index 97e913c765ed..a3aec0898c8e 100644 --- a/doc/releases/migration-guide-4.3.rst +++ b/doc/releases/migration-guide-4.3.rst @@ -157,6 +157,8 @@ Modem ***** * ``CONFIG_MODEM_AT_SHELL_USER_PIPE`` has been renamed to :kconfig:option:`CONFIG_MODEM_AT_USER_PIPE`. +* ``CONFIG_MODEM_CMUX_WORK_BUFFER_SIZE`` has been updated to :kconfig:option:`CONFIG_MODEM_CMUX_WORK_BUFFER_SIZE_EXTRA`, + which only takes the number of extra bytes desired over the default of (:kconfig:option:`CONFIG_MODEM_CMUX_MTU` + 7). Display ******* diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index 23c4795a3549..277ae390fae4 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -110,8 +110,8 @@ struct modem_cellular_data { /* CMUX */ struct modem_cmux cmux; - uint8_t cmux_receive_buf[CONFIG_MODEM_CMUX_WORK_BUFFER_SIZE]; - uint8_t cmux_transmit_buf[CONFIG_MODEM_CMUX_WORK_BUFFER_SIZE]; + uint8_t cmux_receive_buf[MODEM_CMUX_WORK_BUFFER_SIZE]; + uint8_t cmux_transmit_buf[MODEM_CMUX_WORK_BUFFER_SIZE]; struct modem_cmux_dlci dlci1; struct modem_cmux_dlci dlci2; @@ -119,9 +119,9 @@ struct modem_cellular_data { struct modem_pipe *dlci2_pipe; /* Points to dlci2_pipe or NULL. Used for shutdown script if not NULL */ struct modem_pipe *cmd_pipe; - uint8_t dlci1_receive_buf[CONFIG_MODEM_CMUX_WORK_BUFFER_SIZE]; + uint8_t dlci1_receive_buf[MODEM_CMUX_WORK_BUFFER_SIZE]; /* DLCI 2 is only used for chat scripts. */ - uint8_t dlci2_receive_buf[CONFIG_MODEM_CMUX_WORK_BUFFER_SIZE]; + uint8_t dlci2_receive_buf[MODEM_CMUX_WORK_BUFFER_SIZE]; /* Modem chat */ struct modem_chat chat; diff --git a/include/zephyr/modem/cmux.h b/include/zephyr/modem/cmux.h index 10fe93132819..913f4187d729 100644 --- a/include/zephyr/modem/cmux.h +++ b/include/zephyr/modem/cmux.h @@ -57,6 +57,10 @@ typedef void (*modem_cmux_callback)(struct modem_cmux *cmux, enum modem_cmux_eve * @cond INTERNAL_HIDDEN */ +/* Total size of the CMUX work buffers */ +#define MODEM_CMUX_WORK_BUFFER_SIZE (CONFIG_MODEM_CMUX_MTU + 7 + \ + CONFIG_MODEM_CMUX_WORK_BUFFER_SIZE_EXTRA) + enum modem_cmux_state { MODEM_CMUX_STATE_DISCONNECTED = 0, MODEM_CMUX_STATE_CONNECTING, @@ -152,7 +156,7 @@ struct modem_cmux { uint16_t receive_buf_size; uint16_t receive_buf_len; - uint8_t work_buf[CONFIG_MODEM_CMUX_WORK_BUFFER_SIZE]; + uint8_t work_buf[MODEM_CMUX_WORK_BUFFER_SIZE]; /* Transmit buffer */ struct ring_buf transmit_rb; diff --git a/subsys/modem/Kconfig b/subsys/modem/Kconfig index 9f6ce441b7d5..34114cd3893b 100644 --- a/subsys/modem/Kconfig +++ b/subsys/modem/Kconfig @@ -42,14 +42,12 @@ config MODEM_CMUX_MTU Maximum Transmission Unit (MTU) size for the CMUX module. Linux ldattach defaults to 127 bytes, 3GPP TS 27.010 to 31. -config MODEM_CMUX_WORK_BUFFER_SIZE - int "CMUX module work buffer size in bytes" - range 23 1507 - default 134 if MODEM_CMUX_DEFAULT_MTU_127 - default 38 +config MODEM_CMUX_WORK_BUFFER_SIZE_EXTRA + int "CMUX module extra work buffer size in bytes" + default 0 help - Size of the work buffer used by the CMUX module. - Recommended size is MODEM_CMUX_MTU + 7 (CMUX header size). + Extra bytes to add to the work buffers used by the CMUX module. + The default size of these buffers is MODEM_CMUX_MTU + 7 (CMUX header size). module = MODEM_CMUX module-str = modem_cmux From 1e229c2f41bdf17d3de16a4d42eb6be502953c88 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Wed, 24 Sep 2025 16:44:18 +0300 Subject: [PATCH 2015/2141] [nrf fromtree] drivers: modem: cellular: nRF91: Remove periodic chat script Remove periodic chat script as the AT+CEREG=1 notifications are already enabled. Signed-off-by: Seppo Takalo (cherry picked from commit 5fa605af172a18985d7d9ab6636d9c9db45b2a7c) --- drivers/modem/modem_cellular.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index 277ae390fae4..c0cc43a5dafa 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -2773,12 +2773,8 @@ MODEM_CHAT_SCRIPT_CMDS_DEFINE(nordic_nrf91_slm_dial_chat_script_cmds, MODEM_CHAT_SCRIPT_DEFINE(nordic_nrf91_slm_dial_chat_script, nordic_nrf91_slm_dial_chat_script_cmds, dial_abort_matches, modem_cellular_chat_callback_handler, 10); -MODEM_CHAT_SCRIPT_CMDS_DEFINE(nordic_nrf91_slm_periodic_chat_script_cmds, - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CEREG?", ok_match)); +MODEM_CHAT_SCRIPT_EMPTY_DEFINE(nordic_nrf91_slm_periodic_chat_script); -MODEM_CHAT_SCRIPT_DEFINE(nordic_nrf91_slm_periodic_chat_script, - nordic_nrf91_slm_periodic_chat_script_cmds, abort_matches, - modem_cellular_chat_callback_handler, 4); #endif #if DT_HAS_COMPAT_STATUS_OKAY(sqn_gm02s) @@ -3131,7 +3127,8 @@ MODEM_CHAT_SCRIPT_DEFINE(sqn_gm02s_periodic_chat_script, NULL, \ &nordic_nrf91_slm_init_chat_script, \ &nordic_nrf91_slm_dial_chat_script, \ - &nordic_nrf91_slm_periodic_chat_script, NULL) + &nordic_nrf91_slm_periodic_chat_script, \ + NULL) #define MODEM_CELLULAR_DEVICE_SQN_GM02S(inst) \ MODEM_DT_INST_PPP_DEFINE(inst, MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ From 891b51dedd3d27541b9dc5b7bcc08f7e55bcdc11 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Tue, 26 Aug 2025 16:31:46 +0300 Subject: [PATCH 2016/2141] [nrf fromtree] modem: cmux: Implement DM and NSC responses Implement following responses from 3GPP TS 27.010: 5.4.6.3.8 Non Supported Command Response (NSC) 5.3.3 Disconnected Mode (DM) response Close DLC when receiving DM response. Signed-off-by: Seppo Takalo (cherry picked from commit 9de7d617096c7518ae085bb3af384aae42847fae) --- subsys/modem/modem_cmux.c | 79 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 73 insertions(+), 6 deletions(-) diff --git a/subsys/modem/modem_cmux.c b/subsys/modem/modem_cmux.c index 563f6a0baed6..93665525ac7b 100644 --- a/subsys/modem/modem_cmux.c +++ b/subsys/modem/modem_cmux.c @@ -336,6 +336,7 @@ static bool modem_cmux_transmit_cmd_frame(struct modem_cmux *cmux, if (space < MODEM_CMUX_CMD_FRAME_SIZE_MAX) { k_mutex_unlock(&cmux->transmit_rb_lock); + LOG_WRN("CMD buffer overflow"); return false; } @@ -473,6 +474,41 @@ static void modem_cmux_on_control_frame_ua(struct modem_cmux *cmux) k_event_post(&cmux->event, MODEM_CMUX_EVENT_CONNECTED_BIT); } +static void modem_cmux_respond_unsupported_cmd(struct modem_cmux *cmux) +{ + struct modem_cmux_frame frame = cmux->frame; + struct modem_cmux_command *cmd; + + if (modem_cmux_wrap_command(&cmd, frame.data, frame.data_len) < 0) { + LOG_WRN("Invalid command"); + return; + } + + struct { + /* 3GPP TS 27.010: 5.4.6.3.8 Non Supported Command Response (NSC) */ + struct modem_cmux_command nsc; + struct modem_cmux_command_type value; + } nsc_cmd = { + .nsc = { + .type = { + .ea = 1, + .cr = 0, + .value = MODEM_CMUX_COMMAND_NSC, + }, + .length = { + .ea = 1, + .value = 1, + }, + }, + .value = cmd->type, + }; + + frame.data = (uint8_t *)&nsc_cmd; + frame.data_len = sizeof(nsc_cmd); + + modem_cmux_transmit_cmd_frame(cmux, &frame); +} + static void modem_cmux_on_control_frame_uih(struct modem_cmux *cmux) { struct modem_cmux_command *command; @@ -509,6 +545,7 @@ static void modem_cmux_on_control_frame_uih(struct modem_cmux *cmux) default: LOG_DBG("Unknown control command"); + modem_cmux_respond_unsupported_cmd(cmux); break; } } @@ -532,6 +569,26 @@ static void modem_cmux_connect_response_transmit(struct modem_cmux *cmux) modem_cmux_transmit_cmd_frame(cmux, &frame); } +static void modem_cmux_dm_response_transmit(struct modem_cmux *cmux) +{ + if (cmux == NULL) { + return; + } + + /* 3GPP TS 27.010: 5.3.3 Disconnected Mode (DM) response */ + struct modem_cmux_frame frame = { + .dlci_address = cmux->frame.dlci_address, + .cr = cmux->frame.cr, + .pf = 1, + .type = MODEM_CMUX_FRAME_TYPE_DM, + .data = NULL, + .data_len = 0, + }; + + LOG_DBG("Send DM response"); + modem_cmux_transmit_cmd_frame(cmux, &frame); +} + static void modem_cmux_on_control_frame_sabm(struct modem_cmux *cmux) { modem_cmux_connect_response_transmit(cmux); @@ -591,6 +648,13 @@ static struct modem_cmux_dlci *modem_cmux_find_dlci(struct modem_cmux *cmux) return NULL; } +static void modem_cmux_on_dlci_frame_dm(struct modem_cmux_dlci *dlci) +{ + dlci->state = MODEM_CMUX_DLCI_STATE_CLOSED; + modem_pipe_notify_closed(&dlci->pipe); + k_work_cancel_delayable(&dlci->close_work); +} + static void modem_cmux_on_dlci_frame_ua(struct modem_cmux_dlci *dlci) { switch (dlci->state) { @@ -606,9 +670,7 @@ static void modem_cmux_on_dlci_frame_ua(struct modem_cmux_dlci *dlci) case MODEM_CMUX_DLCI_STATE_CLOSING: LOG_DBG("DLCI %u closed", dlci->dlci_address); - dlci->state = MODEM_CMUX_DLCI_STATE_CLOSED; - modem_pipe_notify_closed(&dlci->pipe); - k_work_cancel_delayable(&dlci->close_work); + modem_cmux_on_dlci_frame_dm(dlci); break; default: @@ -617,6 +679,8 @@ static void modem_cmux_on_dlci_frame_ua(struct modem_cmux_dlci *dlci) } } + + static void modem_cmux_on_dlci_frame_uih(struct modem_cmux_dlci *dlci) { struct modem_cmux *cmux = dlci->cmux; @@ -663,7 +727,7 @@ static void modem_cmux_on_dlci_frame_disc(struct modem_cmux_dlci *dlci) modem_cmux_connect_response_transmit(cmux); if (dlci->state != MODEM_CMUX_DLCI_STATE_OPEN) { - LOG_DBG("Unexpected Disc frame"); + modem_cmux_dm_response_transmit(cmux); return; } @@ -680,8 +744,9 @@ static void modem_cmux_on_dlci_frame(struct modem_cmux *cmux) dlci = modem_cmux_find_dlci(cmux); if (dlci == NULL) { - LOG_WRN("Ignoring frame intended for unconfigured DLCI %u.", + LOG_WRN("Frame intended for unconfigured DLCI %u.", cmux->frame.dlci_address); + modem_cmux_dm_response_transmit(cmux); return; } @@ -701,7 +766,9 @@ static void modem_cmux_on_dlci_frame(struct modem_cmux *cmux) case MODEM_CMUX_FRAME_TYPE_DISC: modem_cmux_on_dlci_frame_disc(dlci); break; - + case MODEM_CMUX_FRAME_TYPE_DM: + modem_cmux_on_dlci_frame_dm(dlci); + break; default: LOG_WRN("Unknown %s frame type (%d, DLCI %d)", "DLCI", cmux->frame.type, cmux->frame.dlci_address); From ed0ba0cf9627549c62a2efca6aad94a134aecdab Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Fri, 10 Oct 2025 10:35:12 +0300 Subject: [PATCH 2017/2141] [nrf fromtree] modem: cmux: Define macros for header size Define CMUX_HEADER_SIZE macro that is 6 or 7 bytes depending on MTU. Remove the previous CMUX_FRAME_SIZE_MAX that was a bit misleading as it meant only the header size without data and was fixed to 7 bytes. Redefine new macros CMUX_FRAME_SIZE_MAX and CMUX_FRAME_SIZE_MIN which are actually frame sizes with data included. Signed-off-by: Seppo Takalo (cherry picked from commit 9d93594de99fa921086e32ad04041af1b328e873) --- include/zephyr/modem/cmux.h | 9 ++++++++- subsys/modem/modem_cmux.c | 28 +++++++++++++++------------- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/include/zephyr/modem/cmux.h b/include/zephyr/modem/cmux.h index 913f4187d729..fd9481fee035 100644 --- a/include/zephyr/modem/cmux.h +++ b/include/zephyr/modem/cmux.h @@ -57,8 +57,15 @@ typedef void (*modem_cmux_callback)(struct modem_cmux *cmux, enum modem_cmux_eve * @cond INTERNAL_HIDDEN */ +#if CONFIG_MODEM_CMUX_MTU > 127 +#define MODEM_CMUX_HEADER_SIZE 7 +#else +#define MODEM_CMUX_HEADER_SIZE 6 +#endif + + /* Total size of the CMUX work buffers */ -#define MODEM_CMUX_WORK_BUFFER_SIZE (CONFIG_MODEM_CMUX_MTU + 7 + \ +#define MODEM_CMUX_WORK_BUFFER_SIZE (CONFIG_MODEM_CMUX_MTU + MODEM_CMUX_HEADER_SIZE + \ CONFIG_MODEM_CMUX_WORK_BUFFER_SIZE_EXTRA) enum modem_cmux_state { diff --git a/subsys/modem/modem_cmux.c b/subsys/modem/modem_cmux.c index 93665525ac7b..fb0f14a84807 100644 --- a/subsys/modem/modem_cmux.c +++ b/subsys/modem/modem_cmux.c @@ -19,14 +19,18 @@ LOG_MODULE_REGISTER(modem_cmux, CONFIG_MODEM_CMUX_LOG_LEVEL); #define MODEM_CMUX_EA (0x01) #define MODEM_CMUX_CR (0x02) #define MODEM_CMUX_PF (0x10) -#define MODEM_CMUX_FRAME_SIZE_MAX (0x07) -#define MODEM_CMUX_DATA_SIZE_MIN (0x08) -#define MODEM_CMUX_DATA_FRAME_SIZE_MIN (MODEM_CMUX_FRAME_SIZE_MAX + \ - MODEM_CMUX_DATA_SIZE_MIN) +#define MODEM_CMUX_DATA_SIZE_MIN 8 +#define MODEM_CMUX_DATA_FRAME_SIZE_MIN (MODEM_CMUX_HEADER_SIZE + MODEM_CMUX_DATA_SIZE_MIN) +#define MODEM_CMUX_DATA_FRAME_SIZE_MAX (MODEM_CMUX_HEADER_SIZE + CONFIG_MODEM_CMUX_MTU) -#define MODEM_CMUX_CMD_DATA_SIZE_MAX (0x08) -#define MODEM_CMUX_CMD_FRAME_SIZE_MAX (MODEM_CMUX_FRAME_SIZE_MAX + \ - MODEM_CMUX_CMD_DATA_SIZE_MAX) +/* Biggest supported Multiplexer control commands in UIH frame + * Modem Status Command (MSC) - 5 bytes when Break is included. + * + * PN would be 10 bytes, but that is not implemented + */ +#define MODEM_CMUX_CMD_DATA_SIZE_MAX 5 +#define MODEM_CMUX_CMD_FRAME_SIZE_MAX (MODEM_CMUX_HEADER_SIZE + \ + MODEM_CMUX_CMD_DATA_SIZE_MAX) #define MODEM_CMUX_T1_TIMEOUT (K_MSEC(330)) #define MODEM_CMUX_T2_TIMEOUT (K_MSEC(660)) @@ -272,13 +276,13 @@ static void modem_cmux_bus_callback(struct modem_pipe *pipe, enum modem_pipe_eve static uint16_t modem_cmux_transmit_frame(struct modem_cmux *cmux, const struct modem_cmux_frame *frame) { - uint8_t buf[MODEM_CMUX_FRAME_SIZE_MAX]; + uint8_t buf[MODEM_CMUX_HEADER_SIZE]; uint8_t fcs; uint16_t space; uint16_t data_len; uint16_t buf_idx; - space = ring_buf_space_get(&cmux->transmit_rb) - MODEM_CMUX_FRAME_SIZE_MAX; + space = ring_buf_space_get(&cmux->transmit_rb) - MODEM_CMUX_HEADER_SIZE; data_len = MIN(space, frame->data_len); data_len = MIN(data_len, CONFIG_MODEM_CMUX_MTU); @@ -1328,11 +1332,9 @@ void modem_cmux_init(struct modem_cmux *cmux, const struct modem_cmux_config *co __ASSERT_NO_MSG(cmux != NULL); __ASSERT_NO_MSG(config != NULL); __ASSERT_NO_MSG(config->receive_buf != NULL); - __ASSERT_NO_MSG(config->receive_buf_size >= - (CONFIG_MODEM_CMUX_MTU + MODEM_CMUX_FRAME_SIZE_MAX)); + __ASSERT_NO_MSG(config->receive_buf_size >= MODEM_CMUX_DATA_FRAME_SIZE_MAX); __ASSERT_NO_MSG(config->transmit_buf != NULL); - __ASSERT_NO_MSG(config->transmit_buf_size >= - (CONFIG_MODEM_CMUX_MTU + MODEM_CMUX_FRAME_SIZE_MAX)); + __ASSERT_NO_MSG(config->transmit_buf_size >= MODEM_CMUX_DATA_FRAME_SIZE_MAX); memset(cmux, 0x00, sizeof(*cmux)); cmux->callback = config->callback; From 93bf719a5d8a1459dcd6af5f8113facfc5ee9eca Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Tue, 26 Aug 2025 09:45:31 +0300 Subject: [PATCH 2018/2141] [nrf fromtree] modem: cmux: Handle C/R bit from address field The C/R bit in the address field should be handled as explained in 5.2.1.2 in the spec (3GPP TS 127.010). To detect if the frame is a command or a response, we need to know who was the initiator of the CMUX channel. > Initiator is the station that take the initiative to initialize > the multiplexer (i.e. sends the SABM command at DLCI 0 ) See the table from given section of the specification. Also, on UIH frames 5.4.3.1 says > The frames sent by the initiating station have the C/R bit set to 1 > and those sent by the responding station have the C/R bit set to 0. NOTE: This is different than a C/R bit in the Type field. Signed-off-by: Seppo Takalo (cherry picked from commit b1942ced1a9a94b52c0cd241943972b058d2c5d0) --- include/zephyr/modem/cmux.h | 5 ++-- subsys/modem/modem_cmux.c | 32 ++++++++++++++++++------ tests/subsys/modem/modem_cmux/src/main.c | 18 +++++++++++++ 3 files changed, 46 insertions(+), 9 deletions(-) diff --git a/include/zephyr/modem/cmux.h b/include/zephyr/modem/cmux.h index fd9481fee035..17b63bdf66af 100644 --- a/include/zephyr/modem/cmux.h +++ b/include/zephyr/modem/cmux.h @@ -149,10 +149,11 @@ struct modem_cmux { /* State */ enum modem_cmux_state state; - bool flow_control_on; + bool flow_control_on : 1; + bool initiator : 1; /* Work lock */ - bool attached; + bool attached : 1; struct k_spinlock work_lock; /* Receive state*/ diff --git a/subsys/modem/modem_cmux.c b/subsys/modem/modem_cmux.c index fb0f14a84807..f304985717ac 100644 --- a/subsys/modem/modem_cmux.c +++ b/subsys/modem/modem_cmux.c @@ -463,12 +463,13 @@ static void modem_cmux_on_cld_command(struct modem_cmux *cmux, struct modem_cmux static void modem_cmux_on_control_frame_ua(struct modem_cmux *cmux) { if (cmux->state != MODEM_CMUX_STATE_CONNECTING) { - LOG_DBG("Unexpected UA frame"); + LOG_DBG("Unexpected UA frame in state %d", cmux->state); return; } LOG_DBG("CMUX connected"); cmux->state = MODEM_CMUX_STATE_CONNECTED; + cmux->initiator = true; k_mutex_lock(&cmux->transmit_rb_lock, K_FOREVER); cmux->flow_control_on = true; k_mutex_unlock(&cmux->transmit_rb_lock); @@ -595,8 +596,6 @@ static void modem_cmux_dm_response_transmit(struct modem_cmux *cmux) static void modem_cmux_on_control_frame_sabm(struct modem_cmux *cmux) { - modem_cmux_connect_response_transmit(cmux); - if ((cmux->state == MODEM_CMUX_STATE_CONNECTED) || (cmux->state == MODEM_CMUX_STATE_DISCONNECTING)) { LOG_DBG("Connect request not accepted"); @@ -604,7 +603,9 @@ static void modem_cmux_on_control_frame_sabm(struct modem_cmux *cmux) } LOG_DBG("CMUX connection request received"); + cmux->initiator = false; cmux->state = MODEM_CMUX_STATE_CONNECTED; + modem_cmux_connect_response_transmit(cmux); k_mutex_lock(&cmux->transmit_rb_lock, K_FOREVER); cmux->flow_control_on = true; k_mutex_unlock(&cmux->transmit_rb_lock); @@ -617,6 +618,11 @@ static void modem_cmux_on_control_frame(struct modem_cmux *cmux) { modem_cmux_log_received_frame(&cmux->frame); + if (cmux->state == MODEM_CMUX_STATE_CONNECTED && cmux->frame.cr == cmux->initiator) { + LOG_DBG("Received a response frame, dropping"); + return; + } + switch (cmux->frame.type) { case MODEM_CMUX_FRAME_TYPE_UA: modem_cmux_on_control_frame_ua(cmux); @@ -661,6 +667,12 @@ static void modem_cmux_on_dlci_frame_dm(struct modem_cmux_dlci *dlci) static void modem_cmux_on_dlci_frame_ua(struct modem_cmux_dlci *dlci) { + /* Drop invalid UA frames */ + if (dlci->cmux->frame.cr != dlci->cmux->initiator) { + LOG_DBG("Received a response frame, dropping"); + return; + } + switch (dlci->state) { case MODEM_CMUX_DLCI_STATE_OPENING: LOG_DBG("DLCI %u opened", dlci->dlci_address); @@ -746,6 +758,11 @@ static void modem_cmux_on_dlci_frame(struct modem_cmux *cmux) modem_cmux_log_received_frame(&cmux->frame); + if (cmux->state != MODEM_CMUX_STATE_CONNECTED) { + LOG_DBG("Unexpected DLCI frame in state %d", cmux->state); + return; + } + dlci = modem_cmux_find_dlci(cmux); if (dlci == NULL) { LOG_WRN("Frame intended for unconfigured DLCI %u.", @@ -1087,6 +1104,7 @@ static void modem_cmux_connect_handler(struct k_work *item) cmux = CONTAINER_OF(dwork, struct modem_cmux, connect_work); cmux->state = MODEM_CMUX_STATE_CONNECTING; + cmux->initiator = true; static const struct modem_cmux_frame frame = { .dlci_address = 0, @@ -1119,7 +1137,7 @@ static void modem_cmux_disconnect_handler(struct k_work *item) struct modem_cmux_frame frame = { .dlci_address = 0, - .cr = true, + .cr = cmux->initiator, .pf = false, .type = MODEM_CMUX_FRAME_TYPE_UIH, .data = data, @@ -1198,7 +1216,7 @@ static int modem_cmux_dlci_pipe_api_transmit(void *data, const uint8_t *buf, siz struct modem_cmux_frame frame = { .dlci_address = dlci->dlci_address, - .cr = true, + .cr = cmux->initiator, .pf = false, .type = MODEM_CMUX_FRAME_TYPE_UIH, .data = buf, @@ -1273,7 +1291,7 @@ static void modem_cmux_dlci_open_handler(struct k_work *item) struct modem_cmux_frame frame = { .dlci_address = dlci->dlci_address, - .cr = true, + .cr = dlci->cmux->initiator, .pf = true, .type = MODEM_CMUX_FRAME_TYPE_SABM, .data = NULL, @@ -1302,7 +1320,7 @@ static void modem_cmux_dlci_close_handler(struct k_work *item) struct modem_cmux_frame frame = { .dlci_address = dlci->dlci_address, - .cr = true, + .cr = dlci->cmux->initiator, .pf = true, .type = MODEM_CMUX_FRAME_TYPE_DISC, .data = NULL, diff --git a/tests/subsys/modem/modem_cmux/src/main.c b/tests/subsys/modem/modem_cmux/src/main.c index b1adce37cc46..30c055bc8e74 100644 --- a/tests/subsys/modem/modem_cmux/src/main.c +++ b/tests/subsys/modem/modem_cmux/src/main.c @@ -886,4 +886,22 @@ ZTEST(modem_cmux, test_modem_cmux_split_large_data) "Incorrect number of bytes transmitted %d", ret); } +ZTEST(modem_cmux, test_modem_cmux_invalid_cr) +{ + uint32_t events; + + /* We are initiator, so any CMD with CR set should be dropped */ + modem_backend_mock_put(&bus_mock, cmux_frame_control_cld_cmd, + sizeof(cmux_frame_control_cld_cmd)); + + modem_backend_mock_put(&bus_mock, cmux_frame_control_sabm_cmd, + sizeof(cmux_frame_control_sabm_cmd)); + + events = k_event_wait_all(&cmux_event, + (MODEM_CMUX_EVENT_CONNECTED | MODEM_CMUX_EVENT_DISCONNECTED), + false, K_MSEC(100)); + + zassert_false(events, "Wrong CMD should have been ignored"); +} + ZTEST_SUITE(modem_cmux, NULL, test_modem_cmux_setup, test_modem_cmux_before, NULL, NULL); From 0a10e6af4f68fa357b371e7b23e3a77fe51f7417 Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Sat, 4 Oct 2025 13:52:25 +1000 Subject: [PATCH 2019/2141] [nrf fromtree] modem: modem_ppp: optimise frame wrapping Optimise the PPP frame wrapping process by performing all work inside a single function into a contiguous buffer, instead of operating on the ring buffer one byte at a time. On a nRF54L15 (M33 @ 128 MHz) before the change: ``` Wrapping 1062 byte packet: ~4.1 ms Wrapping 1355 byte packet: ~5.0 ms ``` After the change: ``` Wrapping 1026 byte packet: ~2.4 ms Wrapping 1341 byte packet: ~3.1 ms ``` Signed-off-by: Jordan Yates (cherry picked from commit 9f1e166abd02e6e8f547b06687bdebdf058439e5) --- include/zephyr/modem/ppp.h | 21 +-- subsys/modem/modem_ppp.c | 282 ++++++++++++++++++------------------- 2 files changed, 137 insertions(+), 166 deletions(-) diff --git a/include/zephyr/modem/ppp.h b/include/zephyr/modem/ppp.h index b3dbcfdeb7fb..69b35897e2d2 100644 --- a/include/zephyr/modem/ppp.h +++ b/include/zephyr/modem/ppp.h @@ -50,27 +50,10 @@ enum modem_ppp_receive_state { }; enum modem_ppp_transmit_state { - /* Idle */ MODEM_PPP_TRANSMIT_STATE_IDLE = 0, - /* Writing header */ MODEM_PPP_TRANSMIT_STATE_SOF, - MODEM_PPP_TRANSMIT_STATE_HDR_FF, - MODEM_PPP_TRANSMIT_STATE_HDR_7D, - MODEM_PPP_TRANSMIT_STATE_HDR_23, - /* Writing protocol */ - MODEM_PPP_TRANSMIT_STATE_PROTOCOL_HIGH, - MODEM_PPP_TRANSMIT_STATE_ESCAPING_PROTOCOL_HIGH, - MODEM_PPP_TRANSMIT_STATE_PROTOCOL_LOW, - MODEM_PPP_TRANSMIT_STATE_ESCAPING_PROTOCOL_LOW, - /* Writing data */ + MODEM_PPP_TRANSMIT_STATE_PROTOCOL, MODEM_PPP_TRANSMIT_STATE_DATA, - MODEM_PPP_TRANSMIT_STATE_ESCAPING_DATA, - /* Writing FCS */ - MODEM_PPP_TRANSMIT_STATE_FCS_LOW, - MODEM_PPP_TRANSMIT_STATE_ESCAPING_FCS_LOW, - MODEM_PPP_TRANSMIT_STATE_FCS_HIGH, - MODEM_PPP_TRANSMIT_STATE_ESCAPING_FCS_HIGH, - /* Writing end of frame */ MODEM_PPP_TRANSMIT_STATE_EOF, }; @@ -100,8 +83,6 @@ struct modem_ppp { /* Packet being sent */ enum modem_ppp_transmit_state transmit_state; struct net_pkt *tx_pkt; - uint8_t tx_pkt_escaped; - uint16_t tx_pkt_protocol; uint16_t tx_pkt_fcs; /* Ring buffer used for transmitting partial PPP frame */ diff --git a/subsys/modem/modem_ppp.c b/subsys/modem/modem_ppp.c index 9e2e2b5d71b7..cd13d4ac8b1a 100644 --- a/subsys/modem/modem_ppp.c +++ b/subsys/modem/modem_ppp.c @@ -49,148 +49,134 @@ static uint16_t modem_ppp_ppp_protocol(struct net_pkt *pkt) return 0; } -static uint8_t modem_ppp_wrap_net_pkt_byte(struct modem_ppp *ppp) +static bool modem_ppp_needs_escape(uint8_t byte) { - uint8_t byte; - - switch (ppp->transmit_state) { - case MODEM_PPP_TRANSMIT_STATE_IDLE: - LOG_WRN("Invalid transmit state"); - return 0; - - /* Writing header */ - case MODEM_PPP_TRANSMIT_STATE_SOF: - ppp->transmit_state = MODEM_PPP_TRANSMIT_STATE_HDR_FF; - return MODEM_PPP_CODE_DELIMITER; - - case MODEM_PPP_TRANSMIT_STATE_HDR_FF: - net_pkt_cursor_init(ppp->tx_pkt); - ppp->tx_pkt_fcs = modem_ppp_fcs_init(0xFF); - ppp->transmit_state = MODEM_PPP_TRANSMIT_STATE_HDR_7D; - return 0xFF; - - case MODEM_PPP_TRANSMIT_STATE_HDR_7D: - ppp->tx_pkt_fcs = modem_ppp_fcs_update(ppp->tx_pkt_fcs, 0x03); - ppp->transmit_state = MODEM_PPP_TRANSMIT_STATE_HDR_23; - return MODEM_PPP_CODE_ESCAPE; - - case MODEM_PPP_TRANSMIT_STATE_HDR_23: - if (net_pkt_is_ppp(ppp->tx_pkt) == true) { - ppp->transmit_state = MODEM_PPP_TRANSMIT_STATE_DATA; - } else { - ppp->tx_pkt_protocol = modem_ppp_ppp_protocol(ppp->tx_pkt); - ppp->transmit_state = MODEM_PPP_TRANSMIT_STATE_PROTOCOL_HIGH; - } - - return 0x23; - - /* Writing protocol */ - case MODEM_PPP_TRANSMIT_STATE_PROTOCOL_HIGH: - byte = (ppp->tx_pkt_protocol >> 8) & 0xFF; - ppp->tx_pkt_fcs = modem_ppp_fcs_update(ppp->tx_pkt_fcs, byte); - - if ((byte == MODEM_PPP_CODE_DELIMITER) || (byte == MODEM_PPP_CODE_ESCAPE) || - (byte < MODEM_PPP_VALUE_ESCAPE)) { - ppp->tx_pkt_escaped = byte ^ MODEM_PPP_VALUE_ESCAPE; - ppp->transmit_state = MODEM_PPP_TRANSMIT_STATE_ESCAPING_PROTOCOL_HIGH; - return MODEM_PPP_CODE_ESCAPE; - } - - ppp->transmit_state = MODEM_PPP_TRANSMIT_STATE_PROTOCOL_LOW; - return byte; - - case MODEM_PPP_TRANSMIT_STATE_ESCAPING_PROTOCOL_HIGH: - ppp->transmit_state = MODEM_PPP_TRANSMIT_STATE_PROTOCOL_LOW; - return ppp->tx_pkt_escaped; - - case MODEM_PPP_TRANSMIT_STATE_PROTOCOL_LOW: - byte = ppp->tx_pkt_protocol & 0xFF; - ppp->tx_pkt_fcs = modem_ppp_fcs_update(ppp->tx_pkt_fcs, byte); - - if ((byte == MODEM_PPP_CODE_DELIMITER) || (byte == MODEM_PPP_CODE_ESCAPE) || - (byte < MODEM_PPP_VALUE_ESCAPE)) { - ppp->tx_pkt_escaped = byte ^ MODEM_PPP_VALUE_ESCAPE; - ppp->transmit_state = MODEM_PPP_TRANSMIT_STATE_ESCAPING_PROTOCOL_LOW; - return MODEM_PPP_CODE_ESCAPE; - } - - ppp->transmit_state = MODEM_PPP_TRANSMIT_STATE_DATA; - return byte; - - case MODEM_PPP_TRANSMIT_STATE_ESCAPING_PROTOCOL_LOW: - ppp->transmit_state = MODEM_PPP_TRANSMIT_STATE_DATA; - return ppp->tx_pkt_escaped; - - /* Writing data */ - case MODEM_PPP_TRANSMIT_STATE_DATA: - (void)net_pkt_read_u8(ppp->tx_pkt, &byte); - ppp->tx_pkt_fcs = modem_ppp_fcs_update(ppp->tx_pkt_fcs, byte); - - if ((byte == MODEM_PPP_CODE_DELIMITER) || (byte == MODEM_PPP_CODE_ESCAPE) || - (byte < MODEM_PPP_VALUE_ESCAPE)) { - ppp->tx_pkt_escaped = byte ^ MODEM_PPP_VALUE_ESCAPE; - ppp->transmit_state = MODEM_PPP_TRANSMIT_STATE_ESCAPING_DATA; - return MODEM_PPP_CODE_ESCAPE; - } + return (byte == MODEM_PPP_CODE_DELIMITER) || (byte == MODEM_PPP_CODE_ESCAPE) || + (byte < MODEM_PPP_VALUE_ESCAPE); +} - if (net_pkt_remaining_data(ppp->tx_pkt) == 0) { - ppp->transmit_state = MODEM_PPP_TRANSMIT_STATE_FCS_LOW; - } +static uint32_t modem_ppp_wrap(struct modem_ppp *ppp, uint8_t *buffer, uint32_t available) +{ + uint32_t offset = 0; + uint32_t remaining; + uint16_t protocol; + uint8_t upper; + uint8_t lower; + uint8_t byte; - return byte; + while (offset < available) { + remaining = available - offset; - case MODEM_PPP_TRANSMIT_STATE_ESCAPING_DATA: - if (net_pkt_remaining_data(ppp->tx_pkt) == 0) { - ppp->transmit_state = MODEM_PPP_TRANSMIT_STATE_FCS_LOW; - } else { + switch (ppp->transmit_state) { + case MODEM_PPP_TRANSMIT_STATE_SOF: + if (remaining < 4) { + /* Insufficient space for constant header prefix */ + goto end; + } + /* Init cursor for later phases */ + net_pkt_cursor_init(ppp->tx_pkt); + /* 3 byte common header */ + buffer[offset++] = MODEM_PPP_CODE_DELIMITER; + buffer[offset++] = 0xFF; + buffer[offset++] = MODEM_PPP_CODE_ESCAPE; + buffer[offset++] = 0x23; + /* Initialise the FCS. + * This value is always the same at this point, so use the constant value. + * Equivelent to: + * ppp->tx_pkt_fcs = modem_ppp_fcs_init(0xFF); + * ppp->tx_pkt_fcs = modem_ppp_fcs_update(ppp->tx_pkt_fcs, 0x03); + */ + ARG_UNUSED(modem_ppp_fcs_init); + ppp->tx_pkt_fcs = 0x3DE3; + /* Next state */ + if (net_pkt_is_ppp(ppp->tx_pkt)) { + ppp->transmit_state = MODEM_PPP_TRANSMIT_STATE_DATA; + } else { + ppp->transmit_state = MODEM_PPP_TRANSMIT_STATE_PROTOCOL; + } + break; + case MODEM_PPP_TRANSMIT_STATE_PROTOCOL: + /* If both protocol bytes need escaping, it could be 4 bytes */ + if (remaining < 4) { + /* Insufficient space for protocol bytes */ + goto end; + } + /* Extract protocol bytes */ + protocol = modem_ppp_ppp_protocol(ppp->tx_pkt); + upper = (protocol >> 8) & 0xFF; + lower = (protocol >> 0) & 0xFF; + /* FCS is computed without the escape/modification */ + ppp->tx_pkt_fcs = modem_ppp_fcs_update(ppp->tx_pkt_fcs, upper); + ppp->tx_pkt_fcs = modem_ppp_fcs_update(ppp->tx_pkt_fcs, lower); + /* Push protocol bytes (with required escaping) */ + if (modem_ppp_needs_escape(upper)) { + buffer[offset++] = MODEM_PPP_CODE_ESCAPE; + upper ^= MODEM_PPP_VALUE_ESCAPE; + } + buffer[offset++] = upper; + if (modem_ppp_needs_escape(lower)) { + buffer[offset++] = MODEM_PPP_CODE_ESCAPE; + lower ^= MODEM_PPP_VALUE_ESCAPE; + } + buffer[offset++] = lower; + /* Next state */ ppp->transmit_state = MODEM_PPP_TRANSMIT_STATE_DATA; + break; + case MODEM_PPP_TRANSMIT_STATE_DATA: + /* Push all data bytes into the buffer */ + while (net_pkt_remaining_data(ppp->tx_pkt) > 0) { + /* Space available, taking into account possible escapes */ + if (remaining < 2) { + goto end; + } + /* Pull next byte we're sending */ + (void)net_pkt_read_u8(ppp->tx_pkt, &byte); + /* FCS is computed without the escape/modification */ + ppp->tx_pkt_fcs = modem_ppp_fcs_update(ppp->tx_pkt_fcs, byte); + /* Push encoded bytes into buffer */ + if (modem_ppp_needs_escape(byte)) { + buffer[offset++] = MODEM_PPP_CODE_ESCAPE; + byte ^= MODEM_PPP_VALUE_ESCAPE; + remaining--; + } + buffer[offset++] = byte; + remaining--; + } + /* Data phase finished */ + ppp->transmit_state = MODEM_PPP_TRANSMIT_STATE_EOF; + break; + case MODEM_PPP_TRANSMIT_STATE_EOF: + /* If both FCS bytes need escaping, it could be 5 bytes */ + if (remaining < 5) { + /* Insufficient space for protocol bytes */ + goto end; + } + /* Push FCS (order is [lower, upper] unlike the protocol) */ + ppp->tx_pkt_fcs = modem_ppp_fcs_final(ppp->tx_pkt_fcs); + lower = (ppp->tx_pkt_fcs >> 0) & 0xFF; + upper = (ppp->tx_pkt_fcs >> 8) & 0xFF; + if (modem_ppp_needs_escape(lower)) { + buffer[offset++] = MODEM_PPP_CODE_ESCAPE; + lower ^= MODEM_PPP_VALUE_ESCAPE; + } + buffer[offset++] = lower; + if (modem_ppp_needs_escape(upper)) { + buffer[offset++] = MODEM_PPP_CODE_ESCAPE; + upper ^= MODEM_PPP_VALUE_ESCAPE; + } + buffer[offset++] = upper; + buffer[offset++] = MODEM_PPP_CODE_DELIMITER; + + /* Packet has finished */ + ppp->transmit_state = MODEM_PPP_TRANSMIT_STATE_IDLE; + goto end; + default: + LOG_DBG("Invalid transmit state (%d)", ppp->transmit_state); + goto end; } - - return ppp->tx_pkt_escaped; - - /* Writing FCS */ - case MODEM_PPP_TRANSMIT_STATE_FCS_LOW: - ppp->tx_pkt_fcs = modem_ppp_fcs_final(ppp->tx_pkt_fcs); - byte = ppp->tx_pkt_fcs & 0xFF; - - if ((byte == MODEM_PPP_CODE_DELIMITER) || (byte == MODEM_PPP_CODE_ESCAPE) || - (byte < MODEM_PPP_VALUE_ESCAPE)) { - ppp->tx_pkt_escaped = byte ^ MODEM_PPP_VALUE_ESCAPE; - ppp->transmit_state = MODEM_PPP_TRANSMIT_STATE_ESCAPING_FCS_LOW; - return MODEM_PPP_CODE_ESCAPE; - } - - ppp->transmit_state = MODEM_PPP_TRANSMIT_STATE_FCS_HIGH; - return byte; - - case MODEM_PPP_TRANSMIT_STATE_ESCAPING_FCS_LOW: - ppp->transmit_state = MODEM_PPP_TRANSMIT_STATE_FCS_HIGH; - return ppp->tx_pkt_escaped; - - case MODEM_PPP_TRANSMIT_STATE_FCS_HIGH: - byte = (ppp->tx_pkt_fcs >> 8) & 0xFF; - - if ((byte == MODEM_PPP_CODE_DELIMITER) || (byte == MODEM_PPP_CODE_ESCAPE) || - (byte < MODEM_PPP_VALUE_ESCAPE)) { - ppp->tx_pkt_escaped = byte ^ MODEM_PPP_VALUE_ESCAPE; - ppp->transmit_state = MODEM_PPP_TRANSMIT_STATE_ESCAPING_FCS_HIGH; - return MODEM_PPP_CODE_ESCAPE; - } - - ppp->transmit_state = MODEM_PPP_TRANSMIT_STATE_EOF; - return byte; - - case MODEM_PPP_TRANSMIT_STATE_ESCAPING_FCS_HIGH: - ppp->transmit_state = MODEM_PPP_TRANSMIT_STATE_EOF; - return ppp->tx_pkt_escaped; - - /* Writing end of frame */ - case MODEM_PPP_TRANSMIT_STATE_EOF: - ppp->transmit_state = MODEM_PPP_TRANSMIT_STATE_IDLE; - return MODEM_PPP_CODE_DELIMITER; } - - return 0; +end: + return offset; } static bool modem_ppp_is_byte_expected(uint8_t byte, uint8_t expected_byte) @@ -357,32 +343,36 @@ static void modem_ppp_pipe_callback(struct modem_pipe *pipe, enum modem_pipe_eve static void modem_ppp_send_handler(struct k_work *item) { struct modem_ppp *ppp = CONTAINER_OF(item, struct modem_ppp, send_work); - uint8_t byte; uint8_t *reserved; uint32_t reserved_size; + uint32_t pushed; int ret; if (ppp->tx_pkt == NULL) { ppp->tx_pkt = k_fifo_get(&ppp->tx_pkt_fifo, K_NO_WAIT); } + if (ring_buf_is_empty(&ppp->transmit_rb)) { + /* Reset to initial state to maximise contiguous claim */ + ring_buf_reset(&ppp->transmit_rb); + } + if (ppp->tx_pkt != NULL) { /* Initialize wrap */ if (ppp->transmit_state == MODEM_PPP_TRANSMIT_STATE_IDLE) { ppp->transmit_state = MODEM_PPP_TRANSMIT_STATE_SOF; } - /* Fill transmit ring buffer */ - while (ring_buf_space_get(&ppp->transmit_rb) > 0) { - byte = modem_ppp_wrap_net_pkt_byte(ppp); - - ring_buf_put(&ppp->transmit_rb, &byte, 1); + /* Claim as much space as possible */ + reserved_size = ring_buf_put_claim(&ppp->transmit_rb, &reserved, UINT32_MAX); + /* Push wrapped data into claimed buffer */ + pushed = modem_ppp_wrap(ppp, reserved, reserved_size); + /* Limit claimed data to what was actually pushed */ + ring_buf_put_finish(&ppp->transmit_rb, pushed); - if (ppp->transmit_state == MODEM_PPP_TRANSMIT_STATE_IDLE) { - net_pkt_unref(ppp->tx_pkt); - ppp->tx_pkt = k_fifo_get(&ppp->tx_pkt_fifo, K_NO_WAIT); - break; - } + if (ppp->transmit_state == MODEM_PPP_TRANSMIT_STATE_IDLE) { + net_pkt_unref(ppp->tx_pkt); + ppp->tx_pkt = k_fifo_get(&ppp->tx_pkt_fifo, K_NO_WAIT); } } From 16d5e2f85ed6efc984e4c81d83fd5ffb5aa391d1 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Fri, 10 Oct 2025 10:35:37 +0300 Subject: [PATCH 2020/2141] [nrf fromtree] modem: cmux: Combine state and event Refactor internal event bits to use state enum values and define set_state() and wait_state() so we don't need two set of variables to maintain. Signed-off-by: Seppo Takalo (cherry picked from commit 2cfd92410ead8af098ca8f772990f59a4675a999) --- subsys/modem/modem_cmux.c | 53 +++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/subsys/modem/modem_cmux.c b/subsys/modem/modem_cmux.c index f304985717ac..4573c1b8bdc5 100644 --- a/subsys/modem/modem_cmux.c +++ b/subsys/modem/modem_cmux.c @@ -101,6 +101,22 @@ static int modem_cmux_wrap_command(struct modem_cmux_command **command, const ui return 0; } +static void set_state(struct modem_cmux *cmux, enum modem_cmux_state state) +{ + cmux->state = state; + k_event_set(&cmux->event, BIT(state)); +} + +static bool wait_state(struct modem_cmux *cmux, enum modem_cmux_state state, k_timeout_t timeout) +{ + return k_event_wait(&cmux->event, BIT(state), false, timeout) == BIT(state); +} + +static bool is_connected(struct modem_cmux *cmux) +{ + return cmux->state == MODEM_CMUX_STATE_CONNECTED; +} + static struct modem_cmux_command *modem_cmux_command_wrap(const uint8_t *data) { return (struct modem_cmux_command *)data; @@ -450,14 +466,12 @@ static void modem_cmux_on_cld_command(struct modem_cmux *cmux, struct modem_cmux } LOG_DBG("CMUX disconnected"); - cmux->state = MODEM_CMUX_STATE_DISCONNECTED; + set_state(cmux, MODEM_CMUX_STATE_DISCONNECTED); k_mutex_lock(&cmux->transmit_rb_lock, K_FOREVER); cmux->flow_control_on = false; k_mutex_unlock(&cmux->transmit_rb_lock); modem_cmux_raise_event(cmux, MODEM_CMUX_EVENT_DISCONNECTED); - k_event_clear(&cmux->event, MODEM_CMUX_EVENT_CONNECTED_BIT); - k_event_post(&cmux->event, MODEM_CMUX_EVENT_DISCONNECTED_BIT); } static void modem_cmux_on_control_frame_ua(struct modem_cmux *cmux) @@ -468,15 +482,13 @@ static void modem_cmux_on_control_frame_ua(struct modem_cmux *cmux) } LOG_DBG("CMUX connected"); - cmux->state = MODEM_CMUX_STATE_CONNECTED; + set_state(cmux, MODEM_CMUX_STATE_CONNECTED); cmux->initiator = true; k_mutex_lock(&cmux->transmit_rb_lock, K_FOREVER); cmux->flow_control_on = true; k_mutex_unlock(&cmux->transmit_rb_lock); k_work_cancel_delayable(&cmux->connect_work); modem_cmux_raise_event(cmux, MODEM_CMUX_EVENT_CONNECTED); - k_event_clear(&cmux->event, MODEM_CMUX_EVENT_DISCONNECTED_BIT); - k_event_post(&cmux->event, MODEM_CMUX_EVENT_CONNECTED_BIT); } static void modem_cmux_respond_unsupported_cmd(struct modem_cmux *cmux) @@ -604,21 +616,19 @@ static void modem_cmux_on_control_frame_sabm(struct modem_cmux *cmux) LOG_DBG("CMUX connection request received"); cmux->initiator = false; - cmux->state = MODEM_CMUX_STATE_CONNECTED; + set_state(cmux, MODEM_CMUX_STATE_CONNECTED); modem_cmux_connect_response_transmit(cmux); k_mutex_lock(&cmux->transmit_rb_lock, K_FOREVER); cmux->flow_control_on = true; k_mutex_unlock(&cmux->transmit_rb_lock); modem_cmux_raise_event(cmux, MODEM_CMUX_EVENT_CONNECTED); - k_event_clear(&cmux->event, MODEM_CMUX_EVENT_DISCONNECTED_BIT); - k_event_post(&cmux->event, MODEM_CMUX_EVENT_CONNECTED_BIT); } static void modem_cmux_on_control_frame(struct modem_cmux *cmux) { modem_cmux_log_received_frame(&cmux->frame); - if (cmux->state == MODEM_CMUX_STATE_CONNECTED && cmux->frame.cr == cmux->initiator) { + if (is_connected(cmux) && cmux->frame.cr == cmux->initiator) { LOG_DBG("Received a response frame, dropping"); return; } @@ -1103,7 +1113,7 @@ static void modem_cmux_connect_handler(struct k_work *item) dwork = k_work_delayable_from_work(item); cmux = CONTAINER_OF(dwork, struct modem_cmux, connect_work); - cmux->state = MODEM_CMUX_STATE_CONNECTING; + set_state(cmux, MODEM_CMUX_STATE_CONNECTING); cmux->initiator = true; static const struct modem_cmux_frame frame = { @@ -1126,7 +1136,7 @@ static void modem_cmux_disconnect_handler(struct k_work *item) struct modem_cmux_command *command; uint8_t data[2]; - cmux->state = MODEM_CMUX_STATE_DISCONNECTING; + set_state(cmux, MODEM_CMUX_STATE_DISCONNECTING); command = modem_cmux_command_wrap(data); command->type.ea = 1; @@ -1360,7 +1370,6 @@ void modem_cmux_init(struct modem_cmux *cmux, const struct modem_cmux_config *co cmux->receive_buf = config->receive_buf; cmux->receive_buf_size = config->receive_buf_size; sys_slist_init(&cmux->dlcis); - cmux->state = MODEM_CMUX_STATE_DISCONNECTED; ring_buf_init(&cmux->transmit_rb, config->transmit_buf_size, config->transmit_buf); k_mutex_init(&cmux->transmit_rb_lock); k_work_init_delayable(&cmux->receive_work, modem_cmux_receive_handler); @@ -1368,8 +1377,7 @@ void modem_cmux_init(struct modem_cmux *cmux, const struct modem_cmux_config *co k_work_init_delayable(&cmux->connect_work, modem_cmux_connect_handler); k_work_init_delayable(&cmux->disconnect_work, modem_cmux_disconnect_handler); k_event_init(&cmux->event); - k_event_clear(&cmux->event, MODEM_CMUX_EVENT_CONNECTED_BIT); - k_event_post(&cmux->event, MODEM_CMUX_EVENT_DISCONNECTED_BIT); + set_state(cmux, MODEM_CMUX_STATE_DISCONNECTED); #if CONFIG_MODEM_STATS modem_cmux_init_buf_stats(cmux); @@ -1431,8 +1439,7 @@ int modem_cmux_connect(struct modem_cmux *cmux) return ret; } - if (k_event_wait(&cmux->event, MODEM_CMUX_EVENT_CONNECTED_BIT, false, - MODEM_CMUX_T2_TIMEOUT) == 0) { + if (!wait_state(cmux, MODEM_CMUX_STATE_CONNECTED, MODEM_CMUX_T2_TIMEOUT)) { return -EAGAIN; } @@ -1443,7 +1450,7 @@ int modem_cmux_connect_async(struct modem_cmux *cmux) { int ret = 0; - if (k_event_test(&cmux->event, MODEM_CMUX_EVENT_CONNECTED_BIT)) { + if (cmux->state != MODEM_CMUX_STATE_DISCONNECTED) { return -EALREADY; } @@ -1470,8 +1477,7 @@ int modem_cmux_disconnect(struct modem_cmux *cmux) return ret; } - if (k_event_wait(&cmux->event, MODEM_CMUX_EVENT_DISCONNECTED_BIT, false, - MODEM_CMUX_T2_TIMEOUT) == 0) { + if (!wait_state(cmux, MODEM_CMUX_STATE_DISCONNECTED, MODEM_CMUX_T2_TIMEOUT)) { return -EAGAIN; } @@ -1482,7 +1488,7 @@ int modem_cmux_disconnect_async(struct modem_cmux *cmux) { int ret = 0; - if (k_event_test(&cmux->event, MODEM_CMUX_EVENT_DISCONNECTED_BIT)) { + if (cmux->state == MODEM_CMUX_STATE_DISCONNECTED) { return -EALREADY; } @@ -1529,7 +1535,6 @@ void modem_cmux_release(struct modem_cmux *cmux) /* Unreference pipe */ cmux->pipe = NULL; - /* Reset events */ - k_event_clear(&cmux->event, MODEM_CMUX_EVENT_CONNECTED_BIT); - k_event_post(&cmux->event, MODEM_CMUX_EVENT_DISCONNECTED_BIT); + /* Reset state */ + set_state(cmux, MODEM_CMUX_STATE_DISCONNECTED); } From c209d092182b163206e2e89647e00ef93a83b85c Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Tue, 14 Oct 2025 21:04:25 +0000 Subject: [PATCH 2021/2141] [nrf fromtree] modem: cmux: Handle CLD response Instead of dropping all responses, handle the CLD. Signed-off-by: Seppo Takalo (cherry picked from commit 822a501828b48a89fa5da4149f8a85901206a2d6) --- subsys/modem/modem_cmux.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/subsys/modem/modem_cmux.c b/subsys/modem/modem_cmux.c index 4573c1b8bdc5..e668052ffb5d 100644 --- a/subsys/modem/modem_cmux.c +++ b/subsys/modem/modem_cmux.c @@ -543,6 +543,19 @@ static void modem_cmux_on_control_frame_uih(struct modem_cmux *cmux) modem_cmux_log_received_command(command); + if (!command->type.cr) { + LOG_DBG("Received response command"); + switch (command->type.value) { + case MODEM_CMUX_COMMAND_CLD: + modem_cmux_on_cld_command(cmux, command); + break; + default: + /* Responses to other commands are ignored */ + break; + } + return; + } + switch (command->type.value) { case MODEM_CMUX_COMMAND_CLD: modem_cmux_on_cld_command(cmux, command); @@ -629,8 +642,7 @@ static void modem_cmux_on_control_frame(struct modem_cmux *cmux) modem_cmux_log_received_frame(&cmux->frame); if (is_connected(cmux) && cmux->frame.cr == cmux->initiator) { - LOG_DBG("Received a response frame, dropping"); - return; + LOG_DBG("Received a response frame"); } switch (cmux->frame.type) { From 1cf39df012745ea051d995a64b36fb66aa535b38 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Thu, 25 Sep 2025 17:03:05 +0300 Subject: [PATCH 2022/2141] [nrf fromtree] modem: cmux: Send disconnect event only after responding to CLD If we immediately send disconnected event when CLD is received, we might close the UART pipe before the response is actually send. Also, shutdown_handler should not retry indefinitely. Signed-off-by: Seppo Takalo (cherry picked from commit a9bc72a22a79b80e644792c8149cc67894b24ecb) --- subsys/modem/modem_cmux.c | 31 +++++++++++++------ tests/subsys/modem/modem_cmux_pair/src/main.c | 8 +++-- 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/subsys/modem/modem_cmux.c b/subsys/modem/modem_cmux.c index e668052ffb5d..914f3348f401 100644 --- a/subsys/modem/modem_cmux.c +++ b/subsys/modem/modem_cmux.c @@ -449,6 +449,17 @@ static void modem_cmux_on_fcoff_command(struct modem_cmux *cmux) modem_cmux_acknowledge_received_frame(cmux); } +static void disconnect(struct modem_cmux *cmux) +{ + LOG_DBG("CMUX disconnected"); + k_work_cancel_delayable(&cmux->disconnect_work); + set_state(cmux, MODEM_CMUX_STATE_DISCONNECTED); + k_mutex_lock(&cmux->transmit_rb_lock, K_FOREVER); + cmux->flow_control_on = false; + k_mutex_unlock(&cmux->transmit_rb_lock); + modem_cmux_raise_event(cmux, MODEM_CMUX_EVENT_DISCONNECTED); +} + static void modem_cmux_on_cld_command(struct modem_cmux *cmux, struct modem_cmux_command *command) { if (command->type.cr) { @@ -462,16 +473,11 @@ static void modem_cmux_on_cld_command(struct modem_cmux *cmux, struct modem_cmux } if (cmux->state == MODEM_CMUX_STATE_DISCONNECTING) { - k_work_cancel_delayable(&cmux->disconnect_work); + disconnect(cmux); + } else { + set_state(cmux, MODEM_CMUX_STATE_DISCONNECTING); + k_work_schedule(&cmux->disconnect_work, MODEM_CMUX_T1_TIMEOUT); } - - LOG_DBG("CMUX disconnected"); - set_state(cmux, MODEM_CMUX_STATE_DISCONNECTED); - k_mutex_lock(&cmux->transmit_rb_lock, K_FOREVER); - cmux->flow_control_on = false; - k_mutex_unlock(&cmux->transmit_rb_lock); - - modem_cmux_raise_event(cmux, MODEM_CMUX_EVENT_DISCONNECTED); } static void modem_cmux_on_control_frame_ua(struct modem_cmux *cmux) @@ -1148,7 +1154,12 @@ static void modem_cmux_disconnect_handler(struct k_work *item) struct modem_cmux_command *command; uint8_t data[2]; - set_state(cmux, MODEM_CMUX_STATE_DISCONNECTING); + if (cmux->state == MODEM_CMUX_STATE_DISCONNECTING) { + disconnect(cmux); + } else { + set_state(cmux, MODEM_CMUX_STATE_DISCONNECTING); + k_work_schedule(&cmux->disconnect_work, MODEM_CMUX_T1_TIMEOUT); + } command = modem_cmux_command_wrap(data); command->type.ea = 1; diff --git a/tests/subsys/modem/modem_cmux_pair/src/main.c b/tests/subsys/modem/modem_cmux_pair/src/main.c index 5cc8fed4b458..1988e9d73319 100644 --- a/tests/subsys/modem/modem_cmux_pair/src/main.c +++ b/tests/subsys/modem/modem_cmux_pair/src/main.c @@ -507,9 +507,10 @@ ZTEST(modem_cmux_pair, test_modem_cmux_disconnect_connect) modem_backend_mock_reset(&bus_mock_dte); zassert_true(modem_cmux_disconnect_async(&cmux_dte) == 0, "Failed to disconnect CMUX"); - k_msleep(100); + events = k_event_wait_all(&cmux_event_dte, (EVENT_CMUX_DISCONNECTED), false, K_MSEC(660)); + zassert_true((events & EVENT_CMUX_DISCONNECTED), "Failed to disconnect CMUX"); - events = k_event_wait_all(&cmux_event_dte, (EVENT_CMUX_DISCONNECTED), false, K_MSEC(100)); + events = k_event_wait_all(&cmux_event_dce, (EVENT_CMUX_DISCONNECTED), false, K_MSEC(660)); zassert_true((events & EVENT_CMUX_DISCONNECTED), "Failed to disconnect CMUX"); /* Reconnect CMUX */ @@ -554,6 +555,9 @@ ZTEST(modem_cmux_pair, test_modem_cmux_disconnect_connect_sync) zassert_true(modem_cmux_disconnect(&cmux_dte) == 0, "Failed to disconnect CMUX"); zassert_true(modem_cmux_disconnect(&cmux_dte) == -EALREADY, "Should already be disconnected"); + + events = k_event_wait_all(&cmux_event_dce, (EVENT_CMUX_DISCONNECTED), false, K_MSEC(660)); + zassert_true((events & EVENT_CMUX_DISCONNECTED), "Failed to disconnect CMUX"); zassert_true(modem_cmux_disconnect(&cmux_dce) == -EALREADY, "Should already be disconnected"); From 996e31279fc066e90b06859bce3f03bf946eb07f Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Thu, 25 Sep 2025 16:57:27 +0300 Subject: [PATCH 2023/2141] [nrf fromtree] drivers: modem: cellular: Close down CMUX before shut down Properly close down the CMUX channel before shutting down the modem. The CMUX Close-Down command should indicate the remote end to clean up, even if we don't have shutdown script or power-key GPIO. Signed-off-by: Seppo Takalo (cherry picked from commit 72701683be80073c40b6ecd6afbf7039fb2bc6c0) --- drivers/modem/modem_cellular.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index c0cc43a5dafa..64e3614b51eb 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -83,6 +83,7 @@ enum modem_cellular_event { MODEM_CELLULAR_EVENT_SCRIPT_SUCCESS, MODEM_CELLULAR_EVENT_SCRIPT_FAILED, MODEM_CELLULAR_EVENT_CMUX_CONNECTED, + MODEM_CELLULAR_EVENT_CMUX_DISCONNECTED, MODEM_CELLULAR_EVENT_DLCI1_OPENED, MODEM_CELLULAR_EVENT_DLCI2_OPENED, MODEM_CELLULAR_EVENT_TIMEOUT, @@ -257,6 +258,8 @@ static const char *modem_cellular_event_str(enum modem_cellular_event event) return "script failed"; case MODEM_CELLULAR_EVENT_CMUX_CONNECTED: return "cmux connected"; + case MODEM_CELLULAR_EVENT_CMUX_DISCONNECTED: + return "cmux disconnected"; case MODEM_CELLULAR_EVENT_DLCI1_OPENED: return "dlci1 opened"; case MODEM_CELLULAR_EVENT_DLCI2_OPENED: @@ -1377,6 +1380,7 @@ static int modem_cellular_on_dormant_state_leave(struct modem_cellular_data *dat static int modem_cellular_on_init_power_off_state_enter(struct modem_cellular_data *data) { + modem_cmux_disconnect_async(&data->cmux); modem_cellular_start_timer(data, K_MSEC(2000)); return 0; } @@ -1388,6 +1392,9 @@ static void modem_cellular_init_power_off_event_handler(struct modem_cellular_da (const struct modem_cellular_config *)data->dev->config; switch (evt) { + case MODEM_CELLULAR_EVENT_CMUX_DISCONNECTED: + modem_cellular_stop_timer(data); + __fallthrough; case MODEM_CELLULAR_EVENT_TIMEOUT: /* Shutdown script can only be used if cmd_pipe is available, i.e. we are not in * some intermediary state without a pipe for commands available @@ -1775,7 +1782,9 @@ static void modem_cellular_cmux_handler(struct modem_cmux *cmux, enum modem_cmux case MODEM_CMUX_EVENT_CONNECTED: modem_cellular_delegate_event(data, MODEM_CELLULAR_EVENT_CMUX_CONNECTED); break; - + case MODEM_CMUX_EVENT_DISCONNECTED: + modem_cellular_delegate_event(data, MODEM_CELLULAR_EVENT_CMUX_DISCONNECTED); + break; default: break; } From 3bf8f1d6a799c3251beeed267fa85ca722e2e218 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Tue, 26 Aug 2025 15:19:54 +0300 Subject: [PATCH 2024/2141] [nrf fromtree] modem: cmux: Implement Modem Status Command Implement Modem Status Command(MSC) and a per DLC flow control by using it. Send flow control signals when our input buffer don't fit full frame anymore. Stop TX if we have received from controls on MSC. Signed-off-by: Seppo Takalo (cherry picked from commit 1f996d07b8047bbd20c1c519f60beb076fb80216) --- include/zephyr/modem/cmux.h | 4 + subsys/modem/modem_cmux.c | 194 ++++++++++++++++++- tests/subsys/modem/mock/modem_backend_mock.c | 18 +- tests/subsys/modem/mock/modem_backend_mock.h | 5 + tests/subsys/modem/modem_cmux/src/main.c | 61 ++++-- 5 files changed, 260 insertions(+), 22 deletions(-) diff --git a/include/zephyr/modem/cmux.h b/include/zephyr/modem/cmux.h index 17b63bdf66af..bf349980e2c9 100644 --- a/include/zephyr/modem/cmux.h +++ b/include/zephyr/modem/cmux.h @@ -120,6 +120,10 @@ struct modem_cmux_dlci { #if CONFIG_MODEM_STATS struct modem_stats_buffer receive_buf_stats; #endif + /* Flow control */ + bool flow_control : 1; + bool rx_full : 1; + bool msc_sent : 1; }; struct modem_cmux_frame { diff --git a/subsys/modem/modem_cmux.c b/subsys/modem/modem_cmux.c index 914f3348f401..b311ab7865d9 100644 --- a/subsys/modem/modem_cmux.c +++ b/subsys/modem/modem_cmux.c @@ -81,6 +81,29 @@ struct modem_cmux_command { uint8_t value[]; }; +struct modem_cmux_msc_signals { + uint8_t ea: 1; /**< Last octet, always 1 */ + uint8_t fc: 1; /**< Flow Control */ + uint8_t rtc: 1; /**< Ready to Communicate */ + uint8_t rtr: 1; /**< Ready to Transmit */ + uint8_t res_0: 2; /**< Reserved, set to zero */ + uint8_t ic: 1; /**< Incoming call indicator */ + uint8_t dv: 1; /**< Data Valid */ +}; +struct modem_cmux_msc_addr { + uint8_t ea: 1; /**< Last octet, always 1 */ + uint8_t pad_one: 1; /**< Set to 1 */ + uint8_t dlci_address: 6; /**< DLCI channel address */ +}; + +struct modem_cmux_command_msc { + struct modem_cmux_command command; + uint8_t value[2]; +}; + +static struct modem_cmux_dlci *modem_cmux_find_dlci(struct modem_cmux *cmux, uint8_t dlci_address); +static void modem_cmux_dlci_notify_transmit_idle(struct modem_cmux *cmux); + static int modem_cmux_wrap_command(struct modem_cmux_command **command, const uint8_t *data, uint16_t data_len) { @@ -122,6 +145,53 @@ static struct modem_cmux_command *modem_cmux_command_wrap(const uint8_t *data) return (struct modem_cmux_command *)data; } +static struct modem_cmux_msc_signals modem_cmux_msc_signals_decode(const uint8_t byte) +{ + struct modem_cmux_msc_signals signals; + + /* 3GPP TS 27.010 MSC signals octet: + * |0 |1 |2 |3 |4 |5 |6 |7 | + * |EA |FC|RTC|RTR|0 |0 |IC|DV| + */ + signals.ea = (byte & BIT(0)) ? 1 : 0; + signals.fc = (byte & BIT(1)) ? 1 : 0; + signals.rtc = (byte & BIT(2)) ? 1 : 0; + signals.rtr = (byte & BIT(3)) ? 1 : 0; + signals.ic = (byte & BIT(6)) ? 1 : 0; + signals.dv = (byte & BIT(7)) ? 1 : 0; + + return signals; +} + +static uint8_t modem_cmux_msc_signals_encode(const struct modem_cmux_msc_signals signals) +{ + return (signals.ea ? BIT(0) : 0) | (signals.fc ? BIT(1) : 0) | + (signals.rtc ? BIT(2) : 0) | (signals.rtr ? BIT(3) : 0) | + (signals.ic ? BIT(6) : 0) | (signals.dv ? BIT(7) : 0); +} + +static struct modem_cmux_msc_addr modem_cmux_msc_addr_decode(const uint8_t byte) +{ + struct modem_cmux_msc_addr addr; + + /* 3GPP TS 27.010 MSC address octet: + * |0 |1 |2 |3 |4 |5 |6 |7 | + * |EA |1 | DLCI | + */ + addr.ea = (byte & BIT(0)) ? 1 : 0; + addr.pad_one = 1; + addr.dlci_address = (byte >> 2) & 0x3F; + + return addr; +} + +static uint8_t modem_cmux_msc_addr_encode(const struct modem_cmux_msc_addr a) +{ + return (a.ea ? BIT(0) : 0) | BIT(1) | + ((a.dlci_address & 0x3F) << 2); +} + + #if CONFIG_MODEM_CMUX_LOG_FRAMES static const char *modem_cmux_frame_type_to_str(enum modem_cmux_frame_types frame_type) { @@ -426,10 +496,92 @@ static void modem_cmux_acknowledge_received_frame(struct modem_cmux *cmux) } } +static void modem_cmux_send_msc(struct modem_cmux *cmux, struct modem_cmux_dlci *dlci) +{ + if (cmux == NULL || dlci == NULL) { + return; + } + + struct modem_cmux_msc_addr addr = { + .ea = 1, + .pad_one = 1, + .dlci_address = dlci->dlci_address, + }; + struct modem_cmux_msc_signals signals = { + .ea = 1, + .fc = dlci->rx_full ? 1 : 0, + .rtc = dlci->state == MODEM_CMUX_DLCI_STATE_OPEN ? 1 : 0, + .rtr = dlci->state == MODEM_CMUX_DLCI_STATE_OPEN ? 1 : 0, + .dv = 1, + }; + struct modem_cmux_command_msc cmd = { + .command = { + .type = { + .ea = 1, + .cr = 1, + .value = MODEM_CMUX_COMMAND_MSC, + }, + .length = { + .ea = 1, + .value = sizeof(cmd.value), + }, + }, + .value[0] = modem_cmux_msc_addr_encode(addr), + .value[1] = modem_cmux_msc_signals_encode(signals), + }; + + struct modem_cmux_frame frame = { + .dlci_address = 0, + .cr = cmux->initiator, + .pf = false, + .type = MODEM_CMUX_FRAME_TYPE_UIH, + .data = (void *)&cmd, + .data_len = sizeof(cmd), + }; + + LOG_DBG("Sending MSC command for DLCI %u, FC:%d RTR: %d DV: %d", addr.dlci_address, + signals.fc, signals.rtr, signals.dv); + modem_cmux_transmit_cmd_frame(cmux, &frame); +} + static void modem_cmux_on_msc_command(struct modem_cmux *cmux, struct modem_cmux_command *command) { - if (command->type.cr) { - modem_cmux_acknowledge_received_frame(cmux); + if (!command->type.cr) { + return; + } + + modem_cmux_acknowledge_received_frame(cmux); + + uint8_t len = command->length.value; + + if (len != 2 && len != 3) { + LOG_WRN("Unexpected MSC command length %d", (int)len); + return; + } + + struct modem_cmux_msc_addr msc = modem_cmux_msc_addr_decode(command->value[0]); + struct modem_cmux_msc_signals signals = modem_cmux_msc_signals_decode(command->value[1]); + struct modem_cmux_dlci *dlci = modem_cmux_find_dlci(cmux, msc.dlci_address); + + if (dlci) { + LOG_DBG("MSC command received for DLCI %u", msc.dlci_address); + bool fc_signal = signals.fc || !signals.rtr; + + if (fc_signal != dlci->flow_control) { + if (fc_signal) { + dlci->flow_control = true; + LOG_DBG("DLCI %u flow control ON", dlci->dlci_address); + } else { + dlci->flow_control = false; + LOG_DBG("DLCI %u flow control OFF", dlci->dlci_address); + modem_pipe_notify_transmit_idle(&dlci->pipe); + } + } + /* As we have received MSC, send also our MSC */ + if (!dlci->msc_sent && dlci->state == MODEM_CMUX_DLCI_STATE_OPEN) { + dlci->msc_sent = true; + modem_cmux_send_msc(cmux, dlci); + } } } @@ -439,6 +591,7 @@ static void modem_cmux_on_fcon_command(struct modem_cmux *cmux) cmux->flow_control_on = true; k_mutex_unlock(&cmux->transmit_rb_lock); modem_cmux_acknowledge_received_frame(cmux); + modem_cmux_dlci_notify_transmit_idle(cmux); } static void modem_cmux_on_fcoff_command(struct modem_cmux *cmux) @@ -670,7 +823,7 @@ static void modem_cmux_on_control_frame(struct modem_cmux *cmux) } } -static struct modem_cmux_dlci *modem_cmux_find_dlci(struct modem_cmux *cmux) +static struct modem_cmux_dlci *modem_cmux_find_dlci(struct modem_cmux *cmux, uint8_t dlci_address) { sys_snode_t *node; struct modem_cmux_dlci *dlci; @@ -678,7 +831,7 @@ static struct modem_cmux_dlci *modem_cmux_find_dlci(struct modem_cmux *cmux) SYS_SLIST_FOR_EACH_NODE(&cmux->dlcis, node) { dlci = (struct modem_cmux_dlci *)node; - if (dlci->dlci_address == cmux->frame.dlci_address) { + if (dlci->dlci_address == dlci_address) { return dlci; } } @@ -710,6 +863,12 @@ static void modem_cmux_on_dlci_frame_ua(struct modem_cmux_dlci *dlci) k_mutex_lock(&dlci->receive_rb_lock, K_FOREVER); ring_buf_reset(&dlci->receive_rb); k_mutex_unlock(&dlci->receive_rb_lock); + if (dlci->cmux->initiator) { + modem_cmux_send_msc(dlci->cmux, dlci); + dlci->msc_sent = true; + } else { + dlci->msc_sent = false; + } break; case MODEM_CMUX_DLCI_STATE_CLOSING: @@ -742,6 +901,12 @@ static void modem_cmux_on_dlci_frame_uih(struct modem_cmux_dlci *dlci) LOG_WRN("DLCI %u receive buffer overrun (dropped %u out of %u bytes)", dlci->dlci_address, cmux->frame.data_len - written, cmux->frame.data_len); } + if (written < cmux->frame.data_len || + ring_buf_space_get(&dlci->receive_rb) < MODEM_CMUX_DATA_FRAME_SIZE_MAX) { + LOG_WRN("DLCI %u receive buffer is full", dlci->dlci_address); + dlci->rx_full = true; + modem_cmux_send_msc(cmux, dlci); + } modem_pipe_notify_receive_ready(&dlci->pipe); } @@ -758,6 +923,7 @@ static void modem_cmux_on_dlci_frame_sabm(struct modem_cmux_dlci *dlci) LOG_DBG("DLCI %u SABM request accepted, DLCI opened", dlci->dlci_address); dlci->state = MODEM_CMUX_DLCI_STATE_OPEN; + dlci->msc_sent = false; modem_pipe_notify_opened(&dlci->pipe); k_mutex_lock(&dlci->receive_rb_lock, K_FOREVER); ring_buf_reset(&dlci->receive_rb); @@ -791,7 +957,7 @@ static void modem_cmux_on_dlci_frame(struct modem_cmux *cmux) return; } - dlci = modem_cmux_find_dlci(cmux); + dlci = modem_cmux_find_dlci(cmux, cmux->frame.dlci_address); if (dlci == NULL) { LOG_WRN("Frame intended for unconfigured DLCI %u.", cmux->frame.dlci_address); @@ -1066,7 +1232,9 @@ static void modem_cmux_dlci_notify_transmit_idle(struct modem_cmux *cmux) SYS_SLIST_FOR_EACH_NODE(&cmux->dlcis, node) { dlci = (struct modem_cmux_dlci *)node; - modem_pipe_notify_transmit_idle(&dlci->pipe); + if (!dlci->flow_control) { + modem_pipe_notify_transmit_idle(&dlci->pipe); + } } } @@ -1241,6 +1409,10 @@ static int modem_cmux_dlci_pipe_api_transmit(void *data, const uint8_t *buf, siz struct modem_cmux *cmux = dlci->cmux; int ret = 0; + if (dlci->flow_control) { + return 0; + } + K_SPINLOCK(&cmux->work_lock) { if (!cmux->attached) { ret = -EPERM; @@ -1275,6 +1447,15 @@ static int modem_cmux_dlci_pipe_api_receive(void *data, uint8_t *buf, size_t siz ret = ring_buf_get(&dlci->receive_rb, buf, size); k_mutex_unlock(&dlci->receive_rb_lock); + + /* Release FC if set */ + if (dlci->rx_full && + ring_buf_space_get(&dlci->receive_rb) >= MODEM_CMUX_DATA_FRAME_SIZE_MAX) { + LOG_DBG("DLCI %u receive buffer is no longer full", dlci->dlci_address); + dlci->rx_full = false; + modem_cmux_send_msc(dlci->cmux, dlci); + } + return ret; } @@ -1321,6 +1502,7 @@ static void modem_cmux_dlci_open_handler(struct k_work *item) dlci = CONTAINER_OF(dwork, struct modem_cmux_dlci, open_work); dlci->state = MODEM_CMUX_DLCI_STATE_OPENING; + dlci->msc_sent = false; struct modem_cmux_frame frame = { .dlci_address = dlci->dlci_address, diff --git a/tests/subsys/modem/mock/modem_backend_mock.c b/tests/subsys/modem/mock/modem_backend_mock.c index 5b7b47c0eb49..49ea1927076b 100644 --- a/tests/subsys/modem/mock/modem_backend_mock.c +++ b/tests/subsys/modem/mock/modem_backend_mock.c @@ -52,12 +52,15 @@ static int modem_backend_mock_transmit(void *data, const uint8_t *buf, size_t si return ret; } - ret = ring_buf_put(&mock->tx_rb, buf, size); if (modem_backend_mock_update(mock, buf, size)) { + /* Skip ringbuffer if transaction consumes bytes */ + ret = size; modem_backend_mock_put(mock, mock->transaction->put, mock->transaction->put_size); - mock->transaction = NULL; + modem_backend_mock_prime(mock, mock->transaction->next); + } else { + ret = ring_buf_put(&mock->tx_rb, buf, size); } k_work_submit(&mock->transmit_idle_work); @@ -137,6 +140,10 @@ int modem_backend_mock_get(struct modem_backend_mock *mock, uint8_t *buf, size_t void modem_backend_mock_put(struct modem_backend_mock *mock, const uint8_t *buf, size_t size) { + if (size == 0) { + return; + } + __ASSERT(ring_buf_put(&mock->rx_rb, buf, size) == size, "Mock buffer capacity exceeded"); @@ -155,3 +162,10 @@ void modem_backend_mock_bridge(struct modem_backend_mock *mock_a, struct modem_b mock_a->bridge = mock_b; mock_b->bridge = mock_a; } + +void modem_backend_mock_wait_for_transaction(struct modem_backend_mock *mock) +{ + while (mock->transaction) { + k_msleep(1); + } +} diff --git a/tests/subsys/modem/mock/modem_backend_mock.h b/tests/subsys/modem/mock/modem_backend_mock.h index 56a5b585cb12..34b79aca552f 100644 --- a/tests/subsys/modem/mock/modem_backend_mock.h +++ b/tests/subsys/modem/mock/modem_backend_mock.h @@ -19,6 +19,9 @@ struct modem_backend_mock_transaction { /* Data which will be put in response to get data */ const uint8_t *put; size_t put_size; + + /* Next transaction in chain */ + const struct modem_backend_mock_transaction *next; }; struct modem_backend_mock { @@ -62,4 +65,6 @@ void modem_backend_mock_prime(struct modem_backend_mock *mock, void modem_backend_mock_bridge(struct modem_backend_mock *mock_a, struct modem_backend_mock *mock_b); +void modem_backend_mock_wait_for_transaction(struct modem_backend_mock *mock); + #endif /* ZEPHYR_DRIVERS_MODEM_MODEM_PIPE_MOCK */ diff --git a/tests/subsys/modem/modem_cmux/src/main.c b/tests/subsys/modem/modem_cmux/src/main.c index 30c055bc8e74..67833baabe76 100644 --- a/tests/subsys/modem/modem_cmux/src/main.c +++ b/tests/subsys/modem/modem_cmux/src/main.c @@ -117,17 +117,19 @@ static uint8_t cmux_frame_control_cld_ack[] = {0xF9, 0x03, 0xEF, 0x05, 0xC1, 0x0 static uint8_t cmux_frame_dlci1_sabm_cmd[] = {0xF9, 0x07, 0x3F, 0x01, 0xDE, 0xF9}; static uint8_t cmux_frame_dlci1_sabm_ack[] = {0xF9, 0x07, 0x73, 0x01, 0x15, 0xF9}; static uint8_t cmux_frame_dlci1_disc_cmd[] = {0xF9, 0x07, 0x53, 0x01, 0x3F, 0xF9}; +static uint8_t cmux_frame_dlci1_msc_cmd[] = {0xF9, 0x03, 0xEF, 0x09, 0xE3, + 0x05, 0x07, 0x8D, 0xFB, 0xF9}; static uint8_t cmux_frame_dlci1_ua_ack[] = {0xF9, 0x07, 0x73, 0x01, 0x15, 0xF9}; static uint8_t cmux_frame_dlci2_sabm_cmd[] = {0xF9, 0x0B, 0x3F, 0x01, 0x59, 0xF9}; static uint8_t cmux_frame_dlci2_sabm_ack[] = {0xF9, 0x0B, 0x73, 0x01, 0x92, 0xF9}; static uint8_t cmux_frame_dlci2_disc_cmd[] = {0xF9, 0x0B, 0x53, 0x01, 0xB8, 0xF9}; +static uint8_t cmux_frame_dlci2_msc_cmd[] = {0xF9, 0x03, 0xEF, 0x09, 0xE3, + 0x05, 0x0B, 0x8D, 0xFB, 0xF9}; static uint8_t cmux_frame_dlci2_ua_ack[] = {0xF9, 0x0B, 0x73, 0x01, 0x92, 0xF9}; -static uint8_t cmux_frame_control_msc_cmd[] = {0xF9, 0x01, 0xFF, 0x0B, 0xE3, - 0x07, 0x0B, 0x09, 0x01, 0x6C, 0xF9}; - -static uint8_t cmux_frame_control_msc_ack[] = {0xF9, 0x01, 0xFF, 0x0B, 0xE1, - 0x07, 0x0B, 0x09, 0x01, 0x6C, 0xF9}; - +static uint8_t cmux_frame_control_msc_cmd[] = {0xF9, 0x01, 0xEF, 0x09, 0xE3, + 0x05, 0x07, 0x01, 0x9A, 0xF9}; +static uint8_t cmux_frame_control_msc_ack[] = {0xF9, 0x01, 0xEF, 0x09, 0xE1, + 0x05, 0x07, 0x01, 0x9A, 0xF9}; static uint8_t cmux_frame_control_fcon_cmd[] = {0xF9, 0x01, 0xFF, 0x05, 0xA3, 0x01, 0x86, 0xF9}; static uint8_t cmux_frame_control_fcon_ack[] = {0xF9, 0x01, 0xFF, 0x05, 0xA1, 0x01, 0x86, 0xF9}; static uint8_t cmux_frame_control_fcoff_cmd[] = {0xF9, 0x01, 0xFF, 0x05, 0x63, 0x01, 0x86, 0xF9}; @@ -227,19 +229,31 @@ const static struct modem_backend_mock_transaction transaction_dlci2_disc = { .put_size = sizeof(cmux_frame_dlci2_ua_ack) }; +const static struct modem_backend_mock_transaction transaction_dlci1_msc = { + .get = cmux_frame_dlci1_msc_cmd, + .get_size = sizeof(cmux_frame_dlci1_msc_cmd), + .put = NULL, + .put_size = 0}; + +const static struct modem_backend_mock_transaction transaction_dlci2_msc = { + .get = cmux_frame_dlci2_msc_cmd, + .get_size = sizeof(cmux_frame_dlci2_msc_cmd), + .put = NULL, + .put_size = 0}; + const static struct modem_backend_mock_transaction transaction_dlci1_sabm = { .get = cmux_frame_dlci1_sabm_cmd, .get_size = sizeof(cmux_frame_dlci1_sabm_cmd), .put = cmux_frame_dlci1_ua_ack, - .put_size = sizeof(cmux_frame_dlci1_ua_ack) -}; + .put_size = sizeof(cmux_frame_dlci1_ua_ack), + .next = &transaction_dlci1_msc}; const static struct modem_backend_mock_transaction transaction_dlci2_sabm = { .get = cmux_frame_dlci2_sabm_cmd, .get_size = sizeof(cmux_frame_dlci2_sabm_cmd), .put = cmux_frame_dlci2_ua_ack, - .put_size = sizeof(cmux_frame_dlci2_ua_ack) -}; + .put_size = sizeof(cmux_frame_dlci2_ua_ack), + .next = &transaction_dlci2_msc}; static void test_modem_cmux_callback(struct modem_cmux *cmux, enum modem_cmux_event event, void *user_data) @@ -317,6 +331,9 @@ static void *test_modem_cmux_setup(void) events = k_event_wait(&cmux_event, EVENT_CMUX_DLCI2_OPEN, false, K_MSEC(100)); __ASSERT_NO_MSG((events & EVENT_CMUX_DLCI2_OPEN)); + /* Consume the MSC command sent after DLCI opening */ + modem_backend_mock_wait_for_transaction(&bus_mock); + return NULL; } @@ -603,8 +620,8 @@ ZTEST(modem_cmux, test_modem_cmux_dlci1_close_open) zassert_true((events & EVENT_CMUX_DLCI1_OPEN), "DLCI1 not opened as expected"); - /* Wait for potential T1 timeout */ - k_msleep(500); + modem_backend_mock_prime(&bus_mock, &transaction_dlci1_msc); + modem_backend_mock_wait_for_transaction(&bus_mock); ret = modem_backend_mock_get(&bus_mock, buffer1, sizeof(buffer1)); zassert_true(ret == 0, "Received unexpected data"); @@ -705,6 +722,9 @@ ZTEST(modem_cmux, test_modem_cmux_disconnect_connect) zassert_true((events & EVENT_CMUX_DLCI1_OPEN), "DLCI1 not opened as expected"); + modem_backend_mock_prime(&bus_mock, &transaction_dlci1_msc); + modem_backend_mock_wait_for_transaction(&bus_mock); + /* Wait for potential T1 timeout */ k_msleep(500); @@ -730,8 +750,10 @@ ZTEST(modem_cmux, test_modem_cmux_disconnect_connect) events = k_event_wait_all(&cmux_event, (EVENT_CMUX_DLCI2_OPEN), false, K_MSEC(100)); - zassert_true((events & EVENT_CMUX_DLCI2_OPEN), - "DLCI1 not opened as expected"); + zassert_true((events & EVENT_CMUX_DLCI2_OPEN), "DLCI2 not opened as expected"); + + modem_backend_mock_prime(&bus_mock, &transaction_dlci2_msc); + modem_backend_mock_wait_for_transaction(&bus_mock); /* Wait for potential T1 timeout */ k_msleep(500); @@ -746,6 +768,10 @@ ZTEST(modem_cmux, test_modem_cmux_disconnect_connect_sync) zassert_true(modem_pipe_close(dlci1_pipe, K_SECONDS(10)) == 0, "Failed to close DLCI1"); modem_backend_mock_prime(&bus_mock, &transaction_dlci2_disc); zassert_true(modem_pipe_close(dlci2_pipe, K_SECONDS(10)) == 0, "Failed to close DLCI2"); + + /* Clear any pending data before CLD transaction */ + modem_backend_mock_reset(&bus_mock); + modem_backend_mock_prime(&bus_mock, &transaction_control_cld); zassert_true(modem_cmux_disconnect(&cmux) == 0, "Failed to disconnect CMUX"); zassert_true(modem_cmux_disconnect(&cmux) == -EALREADY, @@ -759,9 +785,11 @@ ZTEST(modem_cmux, test_modem_cmux_disconnect_connect_sync) modem_backend_mock_prime(&bus_mock, &transaction_dlci1_sabm); zassert_true(modem_pipe_open(dlci1_pipe, K_SECONDS(10)) == 0, "Failed to open DLCI1 pipe"); + modem_backend_mock_wait_for_transaction(&bus_mock); modem_backend_mock_prime(&bus_mock, &transaction_dlci2_sabm); zassert_true(modem_pipe_open(dlci2_pipe, K_SECONDS(10)) == 0, "Failed to open DLCI2 pipe"); + modem_backend_mock_wait_for_transaction(&bus_mock); } ZTEST(modem_cmux, test_modem_cmux_dlci_close_open_sync) @@ -773,9 +801,11 @@ ZTEST(modem_cmux, test_modem_cmux_dlci_close_open_sync) modem_backend_mock_prime(&bus_mock, &transaction_dlci1_sabm); zassert_true(modem_pipe_open(dlci1_pipe, K_SECONDS(10)) == 0, "Failed to open DLCI1 pipe"); + modem_backend_mock_wait_for_transaction(&bus_mock); modem_backend_mock_prime(&bus_mock, &transaction_dlci2_sabm); zassert_true(modem_pipe_open(dlci2_pipe, K_SECONDS(10)) == 0, "Failed to open DLCI2 pipe"); + modem_backend_mock_wait_for_transaction(&bus_mock); } ZTEST(modem_cmux, test_modem_cmux_prevent_work_while_released) @@ -820,10 +850,13 @@ ZTEST(modem_cmux, test_modem_cmux_prevent_work_while_released) zassert_ok(modem_cmux_attach(&cmux, bus_mock_pipe)); modem_backend_mock_prime(&bus_mock, &transaction_control_sabm); zassert_ok(modem_cmux_connect(&cmux)); + modem_backend_mock_wait_for_transaction(&bus_mock); modem_backend_mock_prime(&bus_mock, &transaction_dlci1_sabm); zassert_ok(modem_pipe_open(dlci1_pipe, K_SECONDS(10))); + modem_backend_mock_wait_for_transaction(&bus_mock); modem_backend_mock_prime(&bus_mock, &transaction_dlci2_sabm); zassert_ok(modem_pipe_open(dlci2_pipe, K_SECONDS(10))); + modem_backend_mock_wait_for_transaction(&bus_mock); } ZTEST(modem_cmux, test_modem_drop_frames_with_invalid_length) From 32b88e0dc740df9928fd70ce2e7846a544fdcb25 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Wed, 24 Sep 2025 13:31:38 +0300 Subject: [PATCH 2025/2141] [nrf fromtree] drivers: modem: Extract common dts bindings Extract common DTS bindings to zephyr,cellular-modem-device.yaml as these are referred in the modem_cellular.c in the MODEM_CELLULAR_DEFINE_INSTANCE() macro. Signed-off-by: Seppo Takalo (cherry picked from commit 4040a1e2b2a65c17164b3d09d847e85591e97fe5) --- dts/bindings/modem/nordic,nrf91-slm.yaml | 6 +----- dts/bindings/modem/quectel,bg95.yaml | 2 +- dts/bindings/modem/quectel,bg9x.yaml | 5 +---- dts/bindings/modem/quectel,eg25-g.yaml | 2 +- dts/bindings/modem/quectel,eg800q.yaml | 2 +- dts/bindings/modem/simcom,a76xx.yaml | 2 +- dts/bindings/modem/simcom,sim7080.yaml | 2 +- dts/bindings/modem/sqn,gm02s.yaml | 5 +---- dts/bindings/modem/swir,hl7800.yaml | 2 +- dts/bindings/modem/telit,me310g1.yaml | 2 +- dts/bindings/modem/telit,me910g1.yaml | 2 +- dts/bindings/modem/u-blox,lara-r6.yaml | 5 +---- dts/bindings/modem/u-blox,sara-r4.yaml | 5 +---- dts/bindings/modem/u-blox,sara-r5.yaml | 9 +-------- dts/bindings/modem/wnc,m14a2a.yaml | 2 +- .../modem/zephyr,cellular-modem-device.yaml | 19 +++++++++++++++++++ 16 files changed, 34 insertions(+), 38 deletions(-) create mode 100644 dts/bindings/modem/zephyr,cellular-modem-device.yaml diff --git a/dts/bindings/modem/nordic,nrf91-slm.yaml b/dts/bindings/modem/nordic,nrf91-slm.yaml index 3f06696197d2..11bf39018696 100644 --- a/dts/bindings/modem/nordic,nrf91-slm.yaml +++ b/dts/bindings/modem/nordic,nrf91-slm.yaml @@ -2,8 +2,4 @@ description: Nordic nRF91 series running the Serial LTE Modem application compatible: "nordic,nrf91-slm" -include: uart-device.yaml - -properties: - mdm-power-gpios: - type: phandle-array +include: zephyr,cellular-modem-device.yaml diff --git a/dts/bindings/modem/quectel,bg95.yaml b/dts/bindings/modem/quectel,bg95.yaml index 9b1f6c734be4..940cd41ea27e 100644 --- a/dts/bindings/modem/quectel,bg95.yaml +++ b/dts/bindings/modem/quectel,bg95.yaml @@ -5,7 +5,7 @@ description: Quectel BG95 modem compatible: "quectel,bg95" -include: uart-device.yaml +include: zephyr,cellular-modem-device.yaml properties: mdm-power-gpios: diff --git a/dts/bindings/modem/quectel,bg9x.yaml b/dts/bindings/modem/quectel,bg9x.yaml index 836df0ba36e5..41f32d0d4c26 100644 --- a/dts/bindings/modem/quectel,bg9x.yaml +++ b/dts/bindings/modem/quectel,bg9x.yaml @@ -5,16 +5,13 @@ description: quectel BG9x modem compatible: "quectel,bg9x" -include: uart-device.yaml +include: zephyr,cellular-modem-device.yaml properties: mdm-power-gpios: type: phandle-array required: true - mdm-reset-gpios: - type: phandle-array - mdm-dtr-gpios: type: phandle-array diff --git a/dts/bindings/modem/quectel,eg25-g.yaml b/dts/bindings/modem/quectel,eg25-g.yaml index 45284ddf174b..2e688e587dea 100644 --- a/dts/bindings/modem/quectel,eg25-g.yaml +++ b/dts/bindings/modem/quectel,eg25-g.yaml @@ -2,7 +2,7 @@ description: Quectel EG25-G modem compatible: "quectel,eg25-g" -include: uart-device.yaml +include: zephyr,cellular-modem-device.yaml properties: mdm-reset-gpios: diff --git a/dts/bindings/modem/quectel,eg800q.yaml b/dts/bindings/modem/quectel,eg800q.yaml index 80c591b90350..6b86456bcc91 100644 --- a/dts/bindings/modem/quectel,eg800q.yaml +++ b/dts/bindings/modem/quectel,eg800q.yaml @@ -2,7 +2,7 @@ description: Quectel EG800Q modem compatible: "quectel,eg800q" -include: uart-device.yaml +include: zephyr,cellular-modem-device.yaml properties: mdm-power-gpios: diff --git a/dts/bindings/modem/simcom,a76xx.yaml b/dts/bindings/modem/simcom,a76xx.yaml index 586b356de474..428977b42a13 100644 --- a/dts/bindings/modem/simcom,a76xx.yaml +++ b/dts/bindings/modem/simcom,a76xx.yaml @@ -5,7 +5,7 @@ description: Simcom A76XX modem compatible: "simcom,a76xx" -include: uart-device.yaml +include: zephyr,cellular-modem-device.yaml properties: mdm-power-gpios: diff --git a/dts/bindings/modem/simcom,sim7080.yaml b/dts/bindings/modem/simcom,sim7080.yaml index 952ce6b514b6..deb5a0ec4dd6 100644 --- a/dts/bindings/modem/simcom,sim7080.yaml +++ b/dts/bindings/modem/simcom,sim7080.yaml @@ -5,7 +5,7 @@ description: Simcom Sim7080 modem compatible: "simcom,sim7080" -include: uart-device.yaml +include: zephyr,cellular-modem-device.yaml properties: mdm-power-gpios: diff --git a/dts/bindings/modem/sqn,gm02s.yaml b/dts/bindings/modem/sqn,gm02s.yaml index 584fc878e18d..4875f6dcc471 100644 --- a/dts/bindings/modem/sqn,gm02s.yaml +++ b/dts/bindings/modem/sqn,gm02s.yaml @@ -5,12 +5,9 @@ description: Sequans Monarch 2 GM02S Modem compatible: "sqn,gm02s" -include: uart-device.yaml +include: zephyr,cellular-modem-device.yaml properties: mdm-reset-gpios: type: phandle-array required: true - - mdm-wake-gpios: - type: phandle-array diff --git a/dts/bindings/modem/swir,hl7800.yaml b/dts/bindings/modem/swir,hl7800.yaml index b937031455ff..3daf4b383d38 100644 --- a/dts/bindings/modem/swir,hl7800.yaml +++ b/dts/bindings/modem/swir,hl7800.yaml @@ -8,7 +8,7 @@ description: Sierra Wireless HL7800 Modem compatible: "swir,hl7800" -include: uart-device.yaml +include: zephyr,cellular-modem-device.yaml properties: mdm-wake-gpios: diff --git a/dts/bindings/modem/telit,me310g1.yaml b/dts/bindings/modem/telit,me310g1.yaml index 2ee36fce5958..ff354dcc2951 100644 --- a/dts/bindings/modem/telit,me310g1.yaml +++ b/dts/bindings/modem/telit,me310g1.yaml @@ -2,7 +2,7 @@ description: Telit ME310G1 Modem compatible: "telit,me310g1" -include: uart-device.yaml +include: zephyr,cellular-modem-device.yaml properties: mdm-power-gpios: diff --git a/dts/bindings/modem/telit,me910g1.yaml b/dts/bindings/modem/telit,me910g1.yaml index 2599b6cd237d..5ffa10af0347 100644 --- a/dts/bindings/modem/telit,me910g1.yaml +++ b/dts/bindings/modem/telit,me910g1.yaml @@ -5,7 +5,7 @@ description: Telit ME910G1 Modem compatible: "telit,me910g1" -include: uart-device.yaml +include: zephyr,cellular-modem-device.yaml properties: mdm-power-gpios: diff --git a/dts/bindings/modem/u-blox,lara-r6.yaml b/dts/bindings/modem/u-blox,lara-r6.yaml index 89e02d86dba1..12c802391e6b 100644 --- a/dts/bindings/modem/u-blox,lara-r6.yaml +++ b/dts/bindings/modem/u-blox,lara-r6.yaml @@ -5,12 +5,9 @@ description: u-blox LARA-R6 modem compatible: "u-blox,lara-r6" -include: uart-device.yaml +include: zephyr,cellular-modem-device.yaml properties: mdm-power-gpios: type: phandle-array required: true - - mdm-reset-gpios: - type: phandle-array diff --git a/dts/bindings/modem/u-blox,sara-r4.yaml b/dts/bindings/modem/u-blox,sara-r4.yaml index f24bc57e0a74..c9ec63dc7381 100644 --- a/dts/bindings/modem/u-blox,sara-r4.yaml +++ b/dts/bindings/modem/u-blox,sara-r4.yaml @@ -5,15 +5,12 @@ description: u-blox SARA-R4 modem compatible: "u-blox,sara-r4" -include: uart-device.yaml +include: zephyr,cellular-modem-device.yaml properties: mdm-power-gpios: type: phandle-array required: true - mdm-reset-gpios: - type: phandle-array - mdm-vint-gpios: type: phandle-array diff --git a/dts/bindings/modem/u-blox,sara-r5.yaml b/dts/bindings/modem/u-blox,sara-r5.yaml index af6c3318fd07..40e846fd4eae 100644 --- a/dts/bindings/modem/u-blox,sara-r5.yaml +++ b/dts/bindings/modem/u-blox,sara-r5.yaml @@ -5,11 +5,4 @@ description: u-blox SARA-R5 modem compatible: "u-blox,sara-r5" -include: uart-device.yaml - -properties: - mdm-power-gpios: - type: phandle-array - - mdm-reset-gpios: - type: phandle-array +include: zephyr,cellular-modem-device.yaml diff --git a/dts/bindings/modem/wnc,m14a2a.yaml b/dts/bindings/modem/wnc,m14a2a.yaml index db00b6fbeb64..71f9d2775938 100644 --- a/dts/bindings/modem/wnc,m14a2a.yaml +++ b/dts/bindings/modem/wnc,m14a2a.yaml @@ -5,7 +5,7 @@ description: WNC-M14A2A LTE-M modem compatible: "wnc,m14a2a" -include: uart-device.yaml +include: zephyr,cellular-modem-device.yaml properties: mdm-boot-mode-sel-gpios: diff --git a/dts/bindings/modem/zephyr,cellular-modem-device.yaml b/dts/bindings/modem/zephyr,cellular-modem-device.yaml new file mode 100644 index 000000000000..bff39d7f9f61 --- /dev/null +++ b/dts/bindings/modem/zephyr,cellular-modem-device.yaml @@ -0,0 +1,19 @@ +# Copyright 2025 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: Common properties for Zephyr cellular modems + +include: uart-device.yaml + +properties: + mdm-power-gpios: + type: phandle-array + description: GPIO for modem power control + + mdm-reset-gpios: + type: phandle-array + description: GPIO for modem reset + + mdm-wake-gpios: + type: phandle-array + description: GPIO for modem wake From c58e47c48b5eeeec748ea4264936803bf489dc67 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Tue, 16 Sep 2025 14:58:27 +0200 Subject: [PATCH 2026/2141] [nrf fromtree] doc: release-notes-4.3: Mention the backlog support for listen() Add a note that the backlog parameter of the listen() function is now respected and the backlog support has been implemented for the TCP server. Signed-off-by: Robert Lubos (cherry picked from commit 77c348a9de34986998f062e3a0955a1bf3732e6c) --- doc/releases/release-notes-4.3.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doc/releases/release-notes-4.3.rst b/doc/releases/release-notes-4.3.rst index 6dfc304b3ef5..43b217ae205c 100644 --- a/doc/releases/release-notes-4.3.rst +++ b/doc/releases/release-notes-4.3.rst @@ -171,6 +171,13 @@ New APIs and options * :kconfig:option:`CONFIG_HAWKBIT_REBOOT_NONE` +* Networking + + * Sockets + + * :c:func:`zsock_listen` now implements the ``backlog`` parameter support. The TCP server + socket will limit the number of pending incoming connections to that value. + * Power management * :c:func:`pm_device_driver_deinit` From 857a583baef3ea97519948dd2aabd44fe06d9a10 Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Thu, 2 Oct 2025 20:33:36 +1000 Subject: [PATCH 2027/2141] [nrf fromtree] modem: optional dedicated workqueue Add the option to use a dedicated workqueue for the modem backend instead of the system workqueue. Signed-off-by: Jordan Yates (cherry picked from commit 761961fa28a536edfb72a1f60eba1078b4a5e3f3) --- doc/releases/release-notes-4.3.rst | 4 ++ subsys/modem/CMakeLists.txt | 1 + subsys/modem/Kconfig | 15 ++++++ .../modem/backends/modem_backend_uart_async.c | 11 +++-- .../backends/modem_backend_uart_async_hwfc.c | 13 ++--- .../modem/backends/modem_backend_uart_isr.c | 9 ++-- subsys/modem/modem_chat.c | 18 ++++--- subsys/modem/modem_cmux.c | 26 +++++----- subsys/modem/modem_ppp.c | 10 ++-- subsys/modem/modem_ubx.c | 4 +- subsys/modem/modem_workqueue.c | 39 +++++++++++++++ subsys/modem/modem_workqueue.h | 49 +++++++++++++++++++ 12 files changed, 159 insertions(+), 40 deletions(-) create mode 100644 subsys/modem/modem_workqueue.c create mode 100644 subsys/modem/modem_workqueue.h diff --git a/doc/releases/release-notes-4.3.rst b/doc/releases/release-notes-4.3.rst index 43b217ae205c..718e4ad3ba33 100644 --- a/doc/releases/release-notes-4.3.rst +++ b/doc/releases/release-notes-4.3.rst @@ -171,6 +171,10 @@ New APIs and options * :kconfig:option:`CONFIG_HAWKBIT_REBOOT_NONE` +* Modem + + * :kconfig:option:`CONFIG_MODEM_DEDICATED_WORKQUEUE` + * Networking * Sockets diff --git a/subsys/modem/CMakeLists.txt b/subsys/modem/CMakeLists.txt index c374bcab9cff..a1db3ab90361 100644 --- a/subsys/modem/CMakeLists.txt +++ b/subsys/modem/CMakeLists.txt @@ -5,6 +5,7 @@ if(CONFIG_MODEM_MODULES) zephyr_library() +zephyr_library_sources_ifdef(CONFIG_MODEM_DEDICATED_WORKQUEUE modem_workqueue.c) zephyr_library_sources_ifdef(CONFIG_MODEM_CHAT modem_chat.c) zephyr_library_sources_ifdef(CONFIG_MODEM_CMUX modem_cmux.c) zephyr_library_sources_ifdef(CONFIG_MODEM_PIPE modem_pipe.c) diff --git a/subsys/modem/Kconfig b/subsys/modem/Kconfig index 34114cd3893b..dfcb7ddae9a3 100644 --- a/subsys/modem/Kconfig +++ b/subsys/modem/Kconfig @@ -6,6 +6,21 @@ menuconfig MODEM_MODULES if MODEM_MODULES +config MODEM_DEDICATED_WORKQUEUE + bool "Use a dedicated workqueue for modem operations" + +if MODEM_DEDICATED_WORKQUEUE + +config MODEM_DEDICATED_WORKQUEUE_STACK_SIZE + int "Modem dedicated workqueue stack size" + default 1024 + +config MODEM_DEDICATED_WORKQUEUE_PRIORITY + int "Modem dedicated workqueue priority" + default SYSTEM_WORKQUEUE_PRIORITY + +endif # MODEM_DEDICATED_WORKQUEUE + config MODEM_CHAT bool "Modem chat module" select RING_BUFFER diff --git a/subsys/modem/backends/modem_backend_uart_async.c b/subsys/modem/backends/modem_backend_uart_async.c index d96f513d6061..9b5edc8965c5 100644 --- a/subsys/modem/backends/modem_backend_uart_async.c +++ b/subsys/modem/backends/modem_backend_uart_async.c @@ -5,6 +5,7 @@ */ #include "modem_backend_uart_async.h" +#include "../modem_workqueue.h" #include LOG_MODULE_REGISTER(modem_backend_uart_async, CONFIG_MODEM_MODULES_LOG_LEVEL); @@ -58,7 +59,7 @@ static void modem_backend_uart_async_event_handler(const struct device *dev, case UART_TX_DONE: atomic_clear_bit(&backend->async.common.state, MODEM_BACKEND_UART_ASYNC_STATE_TRANSMITTING_BIT); - k_work_submit(&backend->transmit_idle_work); + modem_work_submit(&backend->transmit_idle_work); break; case UART_TX_ABORTED: @@ -67,7 +68,7 @@ static void modem_backend_uart_async_event_handler(const struct device *dev, } atomic_clear_bit(&backend->async.common.state, MODEM_BACKEND_UART_ASYNC_STATE_TRANSMITTING_BIT); - k_work_submit(&backend->transmit_idle_work); + modem_work_submit(&backend->transmit_idle_work); break; @@ -127,7 +128,7 @@ static void modem_backend_uart_async_event_handler(const struct device *dev, } k_spin_unlock(&backend->async.receive_rb_lock, key); - k_work_schedule(&backend->receive_ready_work, K_NO_WAIT); + modem_work_schedule(&backend->receive_ready_work, K_NO_WAIT); break; case UART_RX_DISABLED: @@ -144,7 +145,7 @@ static void modem_backend_uart_async_event_handler(const struct device *dev, } if (modem_backend_uart_async_is_uart_stopped(backend)) { - k_work_submit(&backend->async.common.rx_disabled_work); + modem_work_submit(&backend->async.common.rx_disabled_work); } } @@ -254,7 +255,7 @@ static int modem_backend_uart_async_receive(void *data, uint8_t *buf, size_t siz k_spin_unlock(&backend->async.receive_rb_lock, key); if (!empty) { - k_work_schedule(&backend->receive_ready_work, K_NO_WAIT); + modem_work_schedule(&backend->receive_ready_work, K_NO_WAIT); } return (int)received; diff --git a/subsys/modem/backends/modem_backend_uart_async_hwfc.c b/subsys/modem/backends/modem_backend_uart_async_hwfc.c index 78855daa4eb3..61d307604e5c 100644 --- a/subsys/modem/backends/modem_backend_uart_async_hwfc.c +++ b/subsys/modem/backends/modem_backend_uart_async_hwfc.c @@ -5,6 +5,7 @@ */ #include "modem_backend_uart_async.h" +#include "../modem_workqueue.h" #include LOG_MODULE_REGISTER(modem_backend_uart_async_hwfc, CONFIG_MODEM_MODULES_LOG_LEVEL); @@ -136,7 +137,7 @@ static void modem_backend_uart_async_hwfc_event_handler(const struct device *dev case UART_TX_DONE: atomic_clear_bit(&backend->async.common.state, MODEM_BACKEND_UART_ASYNC_STATE_TRANSMIT_BIT); - k_work_submit(&backend->transmit_idle_work); + modem_work_submit(&backend->transmit_idle_work); break; case UART_TX_ABORTED: @@ -145,7 +146,7 @@ static void modem_backend_uart_async_hwfc_event_handler(const struct device *dev } atomic_clear_bit(&backend->async.common.state, MODEM_BACKEND_UART_ASYNC_STATE_TRANSMIT_BIT); - k_work_submit(&backend->transmit_idle_work); + modem_work_submit(&backend->transmit_idle_work); break; @@ -182,7 +183,7 @@ static void modem_backend_uart_async_hwfc_event_handler(const struct device *dev rx_buf_unref(&backend->async, evt->data.rx.buf); break; } - k_work_schedule(&backend->receive_ready_work, K_NO_WAIT); + modem_work_schedule(&backend->receive_ready_work, K_NO_WAIT); } break; @@ -191,7 +192,7 @@ static void modem_backend_uart_async_hwfc_event_handler(const struct device *dev MODEM_BACKEND_UART_ASYNC_STATE_OPEN_BIT)) { if (!atomic_test_and_set_bit(&backend->async.common.state, MODEM_BACKEND_UART_ASYNC_STATE_RECOVERY_BIT)) { - k_work_schedule(&backend->receive_ready_work, K_NO_WAIT); + modem_work_schedule(&backend->receive_ready_work, K_NO_WAIT); LOG_DBG("RX recovery started"); } } @@ -206,7 +207,7 @@ static void modem_backend_uart_async_hwfc_event_handler(const struct device *dev } if (modem_backend_uart_async_hwfc_is_uart_stopped(backend)) { - k_work_submit(&backend->async.common.rx_disabled_work); + modem_work_submit(&backend->async.common.rx_disabled_work); } } @@ -335,7 +336,7 @@ static int modem_backend_uart_async_hwfc_receive(void *data, uint8_t *buf, size_ if (backend->async.rx_event.len != 0 || k_msgq_num_used_get(&backend->async.rx_queue) != 0) { - k_work_schedule(&backend->receive_ready_work, K_NO_WAIT); + modem_work_schedule(&backend->receive_ready_work, K_NO_WAIT); } modem_backend_uart_async_hwfc_rx_recovery(backend); diff --git a/subsys/modem/backends/modem_backend_uart_isr.c b/subsys/modem/backends/modem_backend_uart_isr.c index a9266cc86657..6c6c27c2db2e 100644 --- a/subsys/modem/backends/modem_backend_uart_isr.c +++ b/subsys/modem/backends/modem_backend_uart_isr.c @@ -5,6 +5,7 @@ */ #include "modem_backend_uart_isr.h" +#include "../modem_workqueue.h" #include LOG_MODULE_REGISTER(modem_backend_uart_isr, CONFIG_MODEM_MODULES_LOG_LEVEL); @@ -54,11 +55,11 @@ static void modem_backend_uart_isr_irq_handler_receive_ready(struct modem_backen * It temporarily disables the UART RX IRQ when swapping buffers * which can cause byte loss at higher baud rates. */ - k_work_schedule(&backend->receive_ready_work, - K_MSEC(CONFIG_MODEM_BACKEND_UART_ISR_RECEIVE_IDLE_TIMEOUT_MS)); + modem_work_schedule(&backend->receive_ready_work, + K_MSEC(CONFIG_MODEM_BACKEND_UART_ISR_RECEIVE_IDLE_TIMEOUT_MS)); } else { /* The buffer is getting full. Run the work item immediately to free up space. */ - k_work_reschedule(&backend->receive_ready_work, K_NO_WAIT); + modem_work_reschedule(&backend->receive_ready_work, K_NO_WAIT); } } @@ -70,7 +71,7 @@ static void modem_backend_uart_isr_irq_handler_transmit_ready(struct modem_backe if (ring_buf_is_empty(&backend->isr.transmit_rb) == true) { uart_irq_tx_disable(backend->uart); - k_work_submit(&backend->transmit_idle_work); + modem_work_submit(&backend->transmit_idle_work); return; } diff --git a/subsys/modem/modem_chat.c b/subsys/modem/modem_chat.c index 088a2bc038dc..001be1c7e707 100644 --- a/subsys/modem/modem_chat.c +++ b/subsys/modem/modem_chat.c @@ -15,6 +15,8 @@ LOG_MODULE_REGISTER(modem_chat, CONFIG_MODEM_MODULES_LOG_LEVEL); #include +#include "modem_workqueue.h" + const struct modem_chat_match modem_chat_any_match = MODEM_CHAT_MATCH("", "", NULL); const struct modem_chat_match modem_chat_empty_matches[0]; const struct modem_chat_script_chat modem_chat_empty_script_chats[0]; @@ -127,7 +129,7 @@ static void modem_chat_set_script_send_state(struct modem_chat *chat, static void modem_chat_script_send(struct modem_chat *chat) { modem_chat_set_script_send_state(chat, MODEM_CHAT_SCRIPT_SEND_STATE_REQUEST); - k_work_submit(&chat->script_send_work); + modem_work_submit(&chat->script_send_work); } static void modem_chat_script_set_response_matches(struct modem_chat *chat) @@ -178,7 +180,7 @@ static void modem_chat_script_chat_schedule_send_timeout(struct modem_chat *chat { uint16_t timeout = modem_chat_script_chat_get_send_timeout(chat); - k_work_schedule(&chat->script_send_timeout_work, K_MSEC(timeout)); + modem_work_schedule(&chat->script_send_timeout_work, K_MSEC(timeout)); } static void modem_chat_script_next(struct modem_chat *chat, bool initial) @@ -233,7 +235,7 @@ static void modem_chat_script_start(struct modem_chat *chat, const struct modem_ /* Start timeout work if script started */ if (chat->script != NULL) { - k_work_schedule(&chat->script_timeout_work, K_SECONDS(chat->script->timeout)); + modem_work_schedule(&chat->script_timeout_work, K_SECONDS(chat->script->timeout)); } } @@ -742,7 +744,7 @@ static void modem_chat_process_handler(struct k_work *item) /* Process data */ modem_chat_process_bytes(chat); - k_work_submit(&chat->receive_work); + modem_work_submit(&chat->receive_work); } static void modem_chat_pipe_callback(struct modem_pipe *pipe, enum modem_pipe_event event, @@ -752,11 +754,11 @@ static void modem_chat_pipe_callback(struct modem_pipe *pipe, enum modem_pipe_ev switch (event) { case MODEM_PIPE_EVENT_RECEIVE_READY: - k_work_submit(&chat->receive_work); + modem_work_submit(&chat->receive_work); break; case MODEM_PIPE_EVENT_TRANSMIT_IDLE: - k_work_submit(&chat->script_send_work); + modem_work_submit(&chat->script_send_work); break; default: @@ -880,7 +882,7 @@ int modem_chat_run_script_async(struct modem_chat *chat, const struct modem_chat k_sem_reset(&chat->script_stopped_sem); chat->pending_script = script; - k_work_submit(&chat->script_run_work); + modem_work_submit(&chat->script_run_work); return 0; } @@ -903,7 +905,7 @@ int modem_chat_run_script(struct modem_chat *chat, const struct modem_chat_scrip void modem_chat_script_abort(struct modem_chat *chat) { - k_work_submit(&chat->script_abort_work); + modem_work_submit(&chat->script_abort_work); } void modem_chat_release(struct modem_chat *chat) diff --git a/subsys/modem/modem_cmux.c b/subsys/modem/modem_cmux.c index b311ab7865d9..fb0b04aa6469 100644 --- a/subsys/modem/modem_cmux.c +++ b/subsys/modem/modem_cmux.c @@ -13,6 +13,8 @@ LOG_MODULE_REGISTER(modem_cmux, CONFIG_MODEM_CMUX_LOG_LEVEL); #include +#include "modem_workqueue.h" + #define MODEM_CMUX_SOF (0xF9) #define MODEM_CMUX_FCS_POLYNOMIAL (0xE0) #define MODEM_CMUX_FCS_INIT_VALUE (0xFF) @@ -347,11 +349,11 @@ static void modem_cmux_bus_callback(struct modem_pipe *pipe, enum modem_pipe_eve switch (event) { case MODEM_PIPE_EVENT_RECEIVE_READY: - k_work_schedule(&cmux->receive_work, K_NO_WAIT); + modem_work_schedule(&cmux->receive_work, K_NO_WAIT); break; case MODEM_PIPE_EVENT_TRANSMIT_IDLE: - k_work_schedule(&cmux->transmit_work, K_NO_WAIT); + modem_work_schedule(&cmux->transmit_work, K_NO_WAIT); break; default: @@ -411,7 +413,7 @@ static uint16_t modem_cmux_transmit_frame(struct modem_cmux *cmux, buf[0] = fcs; buf[1] = MODEM_CMUX_SOF; ring_buf_put(&cmux->transmit_rb, buf, 2); - k_work_schedule(&cmux->transmit_work, K_NO_WAIT); + modem_work_schedule(&cmux->transmit_work, K_NO_WAIT); return data_len; } @@ -1222,7 +1224,7 @@ static void modem_cmux_receive_handler(struct k_work *item) } /* Reschedule received work */ - k_work_schedule(&cmux->receive_work, K_NO_WAIT); + modem_work_schedule(&cmux->receive_work, K_NO_WAIT); } static void modem_cmux_dlci_notify_transmit_idle(struct modem_cmux *cmux) @@ -1312,7 +1314,7 @@ static void modem_cmux_connect_handler(struct k_work *item) }; modem_cmux_transmit_cmd_frame(cmux, &frame); - k_work_schedule(&cmux->connect_work, MODEM_CMUX_T1_TIMEOUT); + modem_work_schedule(&cmux->connect_work, MODEM_CMUX_T1_TIMEOUT); } static void modem_cmux_disconnect_handler(struct k_work *item) @@ -1347,7 +1349,7 @@ static void modem_cmux_disconnect_handler(struct k_work *item) /* Transmit close down command */ modem_cmux_transmit_cmd_frame(cmux, &frame); - k_work_schedule(&cmux->disconnect_work, MODEM_CMUX_T1_TIMEOUT); + modem_work_schedule(&cmux->disconnect_work, MODEM_CMUX_T1_TIMEOUT); } #if CONFIG_MODEM_STATS @@ -1397,7 +1399,7 @@ static int modem_cmux_dlci_pipe_api_open(void *data) K_SPINLOCK_BREAK; } - k_work_schedule(&dlci->open_work, K_NO_WAIT); + modem_work_schedule(&dlci->open_work, K_NO_WAIT); } return ret; @@ -1476,7 +1478,7 @@ static int modem_cmux_dlci_pipe_api_close(void *data) K_SPINLOCK_BREAK; } - k_work_schedule(&dlci->close_work, K_NO_WAIT); + modem_work_schedule(&dlci->close_work, K_NO_WAIT); } return ret; @@ -1514,7 +1516,7 @@ static void modem_cmux_dlci_open_handler(struct k_work *item) }; modem_cmux_transmit_cmd_frame(dlci->cmux, &frame); - k_work_schedule(&dlci->open_work, MODEM_CMUX_T1_TIMEOUT); + modem_work_schedule(&dlci->open_work, MODEM_CMUX_T1_TIMEOUT); } static void modem_cmux_dlci_close_handler(struct k_work *item) @@ -1543,7 +1545,7 @@ static void modem_cmux_dlci_close_handler(struct k_work *item) }; modem_cmux_transmit_cmd_frame(cmux, &frame); - k_work_schedule(&dlci->close_work, MODEM_CMUX_T1_TIMEOUT); + modem_work_schedule(&dlci->close_work, MODEM_CMUX_T1_TIMEOUT); } static void modem_cmux_dlci_pipes_release(struct modem_cmux *cmux) @@ -1666,7 +1668,7 @@ int modem_cmux_connect_async(struct modem_cmux *cmux) } if (k_work_delayable_is_pending(&cmux->connect_work) == false) { - k_work_schedule(&cmux->connect_work, K_NO_WAIT); + modem_work_schedule(&cmux->connect_work, K_NO_WAIT); } } @@ -1704,7 +1706,7 @@ int modem_cmux_disconnect_async(struct modem_cmux *cmux) } if (k_work_delayable_is_pending(&cmux->disconnect_work) == false) { - k_work_schedule(&cmux->disconnect_work, K_NO_WAIT); + modem_work_schedule(&cmux->disconnect_work, K_NO_WAIT); } } diff --git a/subsys/modem/modem_ppp.c b/subsys/modem/modem_ppp.c index cd13d4ac8b1a..09b62bdaa11e 100644 --- a/subsys/modem/modem_ppp.c +++ b/subsys/modem/modem_ppp.c @@ -10,6 +10,8 @@ #include #include +#include "modem_workqueue.h" + #include LOG_MODULE_REGISTER(modem_ppp, CONFIG_MODEM_MODULES_LOG_LEVEL); @@ -327,12 +329,12 @@ static void modem_ppp_pipe_callback(struct modem_pipe *pipe, enum modem_pipe_eve switch (event) { case MODEM_PIPE_EVENT_RECEIVE_READY: - k_work_submit(&ppp->process_work); + modem_work_submit(&ppp->process_work); break; case MODEM_PIPE_EVENT_OPENED: case MODEM_PIPE_EVENT_TRANSMIT_IDLE: - k_work_submit(&ppp->send_work); + modem_work_submit(&ppp->send_work); break; default: @@ -415,7 +417,7 @@ static void modem_ppp_process_handler(struct k_work *item) modem_ppp_process_received_byte(ppp, ppp->receive_buf[i]); } - k_work_submit(&ppp->process_work); + modem_work_submit(&ppp->process_work); } static void modem_ppp_ppp_api_init(struct net_if *iface) @@ -478,7 +480,7 @@ static int modem_ppp_ppp_api_send(const struct device *dev, struct net_pkt *pkt) net_pkt_ref(pkt); k_fifo_put(&ppp->tx_pkt_fifo, pkt); - k_work_submit(&ppp->send_work); + modem_work_submit(&ppp->send_work); return 0; } diff --git a/subsys/modem/modem_ubx.c b/subsys/modem/modem_ubx.c index 22586b8444d0..89d968caf799 100644 --- a/subsys/modem/modem_ubx.c +++ b/subsys/modem/modem_ubx.c @@ -9,6 +9,8 @@ #include #include +#include "modem_workqueue.h" + #include LOG_MODULE_REGISTER(modem_ubx, CONFIG_MODEM_MODULES_LOG_LEVEL); @@ -19,7 +21,7 @@ static void modem_ubx_pipe_callback(struct modem_pipe *pipe, struct modem_ubx *ubx = (struct modem_ubx *)user_data; if (event == MODEM_PIPE_EVENT_RECEIVE_READY) { - k_work_submit(&ubx->process_work); + modem_work_submit(&ubx->process_work); } } diff --git a/subsys/modem/modem_workqueue.c b/subsys/modem/modem_workqueue.c new file mode 100644 index 000000000000..4fb5d716c5c7 --- /dev/null +++ b/subsys/modem/modem_workqueue.c @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2025 Embeint Pty Ltd + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +#include "modem_workqueue.h" + +static struct k_work_q modem_work_q; +static K_THREAD_STACK_DEFINE(modem_stack_area, CONFIG_MODEM_DEDICATED_WORKQUEUE_STACK_SIZE); + +int modem_work_submit(struct k_work *work) +{ + return k_work_submit_to_queue(&modem_work_q, work); +} + +int modem_work_schedule(struct k_work_delayable *dwork, k_timeout_t delay) +{ + return k_work_schedule_for_queue(&modem_work_q, dwork, delay); +} + +int modem_work_reschedule(struct k_work_delayable *dwork, k_timeout_t delay) +{ + return k_work_reschedule_for_queue(&modem_work_q, dwork, delay); +} + +static int modem_work_q_init(void) +{ + /* Boot the dedicated workqueue */ + k_work_queue_init(&modem_work_q); + k_work_queue_start(&modem_work_q, modem_stack_area, K_THREAD_STACK_SIZEOF(modem_stack_area), + CONFIG_MODEM_DEDICATED_WORKQUEUE_PRIORITY, NULL); + k_thread_name_set(k_work_queue_thread_get(&modem_work_q), "modem_workq"); + return 0; +} + +SYS_INIT(modem_work_q_init, POST_KERNEL, 0); diff --git a/subsys/modem/modem_workqueue.h b/subsys/modem/modem_workqueue.h new file mode 100644 index 000000000000..d906ed2e00f0 --- /dev/null +++ b/subsys/modem/modem_workqueue.h @@ -0,0 +1,49 @@ +/** @file + * @brief Modem workqueue header file. + */ + +/* + * Copyright (c) 2025 Embeint Pty Ltd + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_INCLUDE_MODEM_WORKQUEUE_H_ +#define ZEPHYR_INCLUDE_MODEM_WORKQUEUE_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef CONFIG_MODEM_DEDICATED_WORKQUEUE + +int modem_work_submit(struct k_work *work); +int modem_work_schedule(struct k_work_delayable *dwork, k_timeout_t delay); +int modem_work_reschedule(struct k_work_delayable *dwork, k_timeout_t delay); + +#else + +static inline int modem_work_submit(struct k_work *work) +{ + return k_work_submit(work); +} + +static inline int modem_work_schedule(struct k_work_delayable *dwork, k_timeout_t delay) +{ + return k_work_schedule(dwork, delay); +} + +static inline int modem_work_reschedule(struct k_work_delayable *dwork, k_timeout_t delay) +{ + return k_work_reschedule(dwork, delay); +} + +#endif /* CONFIG_MODEM_DEDICATED_WORKQUEUE */ + +#ifdef __cplusplus +} +#endif + +#endif /* ZEPHYR_INCLUDE_MODEM_WORKQUEUE_H_ */ From 78d68c1f42ea657e5f3c3e23624e25fc2fc4a20e Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Tue, 21 Oct 2025 16:55:43 +0300 Subject: [PATCH 2028/2141] [nrf fromlist] modem: cmux: Define encoding and decoding functions for commands Instead of relying non-standard compiler behavior, define encode and decode functions for all CMUX command structures. Final command is encoded into a shared buffer, because it is always copied directly to TX ringbuffer. Added also functions to validate commands. Upstream PR #: 98009 Signed-off-by: Seppo Takalo --- subsys/modem/modem_cmux.c | 314 +++++++++++++++++------ tests/subsys/modem/modem_cmux/src/main.c | 19 ++ 2 files changed, 250 insertions(+), 83 deletions(-) diff --git a/subsys/modem/modem_cmux.c b/subsys/modem/modem_cmux.c index fb0b04aa6469..3bebde19d462 100644 --- a/subsys/modem/modem_cmux.c +++ b/subsys/modem/modem_cmux.c @@ -30,7 +30,8 @@ LOG_MODULE_REGISTER(modem_cmux, CONFIG_MODEM_CMUX_LOG_LEVEL); * * PN would be 10 bytes, but that is not implemented */ -#define MODEM_CMUX_CMD_DATA_SIZE_MAX 5 +#define MODEM_CMUX_CMD_DATA_SIZE_MAX 5 /* Max size of information field of UIH frame */ +#define MODEM_CMUX_CMD_HEADER_SIZE 2 /* command type + length */ #define MODEM_CMUX_CMD_FRAME_SIZE_MAX (MODEM_CMUX_HEADER_SIZE + \ MODEM_CMUX_CMD_DATA_SIZE_MAX) @@ -80,7 +81,7 @@ struct modem_cmux_command_length { struct modem_cmux_command { struct modem_cmux_command_type type; struct modem_cmux_command_length length; - uint8_t value[]; + uint8_t value[MODEM_CMUX_CMD_DATA_SIZE_MAX - 2]; /* Subtract type and length bytes */ }; struct modem_cmux_msc_signals { @@ -98,53 +99,182 @@ struct modem_cmux_msc_addr { uint8_t dlci_address: 6; /**< DLCI channel address */ }; -struct modem_cmux_command_msc { - struct modem_cmux_command command; - uint8_t value[2]; -}; - static struct modem_cmux_dlci *modem_cmux_find_dlci(struct modem_cmux *cmux, uint8_t dlci_address); static void modem_cmux_dlci_notify_transmit_idle(struct modem_cmux *cmux); -static int modem_cmux_wrap_command(struct modem_cmux_command **command, const uint8_t *data, - uint16_t data_len) +static void set_state(struct modem_cmux *cmux, enum modem_cmux_state state) +{ + cmux->state = state; + k_event_set(&cmux->event, BIT(state)); +} + +static bool wait_state(struct modem_cmux *cmux, enum modem_cmux_state state, k_timeout_t timeout) +{ + return k_event_wait(&cmux->event, BIT(state), false, timeout) == BIT(state); +} + +static bool is_connected(struct modem_cmux *cmux) { - if ((data == NULL) || (data_len < 2)) { - return -EINVAL; + return cmux->state == MODEM_CMUX_STATE_CONNECTED; +} + +static bool modem_cmux_command_type_is_valid(const struct modem_cmux_command_type type) +{ + /* All commands are only 7 bits, so EA is always set */ + if (type.ea == 0) { + return false; + } + switch (type.value) { + case MODEM_CMUX_COMMAND_NSC: + case MODEM_CMUX_COMMAND_TEST: + case MODEM_CMUX_COMMAND_PSC: + case MODEM_CMUX_COMMAND_RLS: + case MODEM_CMUX_COMMAND_FCOFF: + case MODEM_CMUX_COMMAND_PN: + case MODEM_CMUX_COMMAND_RPN: + case MODEM_CMUX_COMMAND_FCON: + case MODEM_CMUX_COMMAND_CLD: + case MODEM_CMUX_COMMAND_SNC: + case MODEM_CMUX_COMMAND_MSC: + return true; + default: + return false; } +} - (*command) = (struct modem_cmux_command *)data; +static bool modem_cmux_command_length_is_valid(const struct modem_cmux_command_length length) +{ + /* All commands are shorter than 127 bytes, so EA is always set */ + if (length.ea == 0) { + return false; + } + if (length.value > (MODEM_CMUX_CMD_DATA_SIZE_MAX - MODEM_CMUX_CMD_HEADER_SIZE)) { + return false; + } + return true; +} - if (((*command)->length.ea == 0) || ((*command)->type.ea == 0)) { - return -EINVAL; +static bool modem_cmux_command_is_valid(const struct modem_cmux_command *command) +{ + if (!modem_cmux_command_type_is_valid(command->type)) { + return false; + } + if (!modem_cmux_command_length_is_valid(command->length)) { + return false; + } + /* Verify known value sizes as specified in 3GPP TS 27.010 + * section 5.4.6.3 Message Type and Actions + */ + switch (command->type.value) { + case MODEM_CMUX_COMMAND_PN: + return command->length.value == 8; + case MODEM_CMUX_COMMAND_TEST: + return (command->length.value > 0 && + command->length.value <= MODEM_CMUX_CMD_DATA_SIZE_MAX - 2); + case MODEM_CMUX_COMMAND_MSC: + return command->length.value == 2 || command->length.value == 3; + case MODEM_CMUX_COMMAND_NSC: + return command->length.value == 1; + case MODEM_CMUX_COMMAND_RPN: + return command->length.value == 1 || command->length.value == 8; + case MODEM_CMUX_COMMAND_RLS: + return command->length.value == 2; + case MODEM_CMUX_COMMAND_SNC: + return command->length.value == 1 || command->length.value == 3; + default: + return command->length.value == 0; } +} - if ((*command)->length.value != (data_len - 2)) { - return -EINVAL; +static struct modem_cmux_command_type modem_cmux_command_type_decode(const uint8_t byte) +{ + struct modem_cmux_command_type type = { + .ea = (byte & MODEM_CMUX_EA) ? 1 : 0, + .cr = (byte & MODEM_CMUX_CR) ? 1 : 0, + .value = (byte >> 2) & 0x3F, + }; + + if (type.ea == 0) { + return (struct modem_cmux_command_type){0}; } - return 0; + return type; } -static void set_state(struct modem_cmux *cmux, enum modem_cmux_state state) +static uint8_t modem_cmux_command_type_encode(const struct modem_cmux_command_type type) { - cmux->state = state; - k_event_set(&cmux->event, BIT(state)); + return (type.ea ? MODEM_CMUX_EA : 0) | + (type.cr ? MODEM_CMUX_CR : 0) | + ((type.value & 0x3F) << 2); } -static bool wait_state(struct modem_cmux *cmux, enum modem_cmux_state state, k_timeout_t timeout) +static struct modem_cmux_command_length modem_cmux_command_length_decode(const uint8_t byte) { - return k_event_wait(&cmux->event, BIT(state), false, timeout) == BIT(state); + struct modem_cmux_command_length length = { + .ea = (byte & MODEM_CMUX_EA) ? 1 : 0, + .value = (byte >> 1) & 0x7F, + }; + + if (length.ea == 0) { + return (struct modem_cmux_command_length){0}; + } + + return length; } -static bool is_connected(struct modem_cmux *cmux) +static uint8_t modem_cmux_command_length_encode(const struct modem_cmux_command_length length) { - return cmux->state == MODEM_CMUX_STATE_CONNECTED; + return (length.ea ? MODEM_CMUX_EA : 0) | + ((length.value & 0x7F) << 1); +} + +static struct modem_cmux_command modem_cmux_command_decode(const uint8_t *data, size_t len) +{ + if (len < 2) { + return (struct modem_cmux_command){0}; + } + + struct modem_cmux_command command = { + .type = modem_cmux_command_type_decode(data[0]), + .length = modem_cmux_command_length_decode(data[1]), + }; + + if (command.type.ea == 0 || command.length.ea == 0 || + command.length.value > MODEM_CMUX_CMD_DATA_SIZE_MAX || + (2 + command.length.value) > len) { + return (struct modem_cmux_command){0}; + } + + memcpy(&command.value[0], &data[2], command.length.value); + + return command; } -static struct modem_cmux_command *modem_cmux_command_wrap(const uint8_t *data) +/** + * @brief Encode command into a shared buffer + * + * Not a thread safe, so can only be used within a workqueue context and data + * must be copied out to a TX ringbuffer. + * + * @param command command to encode + * @param len encoded length of the command is written here + * @return pointer to encoded command buffer on success, NULL on failure + */ +static uint8_t *modem_cmux_command_encode(struct modem_cmux_command *command, uint16_t *len) { - return (struct modem_cmux_command *)data; + static uint8_t buf[MODEM_CMUX_CMD_DATA_SIZE_MAX]; + + __ASSERT_NO_MSG(len != NULL); + __ASSERT_NO_MSG(command != NULL); + __ASSERT_NO_MSG(modem_cmux_command_is_valid(command)); + + buf[0] = modem_cmux_command_type_encode(command->type); + buf[1] = modem_cmux_command_length_encode(command->length); + if (command->length.value > 0) { + memcpy(&buf[2], &command->value[0], command->length.value); + } + *len = 2 + command->length.value; + return buf; } static struct modem_cmux_msc_signals modem_cmux_msc_signals_decode(const uint8_t byte) @@ -421,7 +551,7 @@ static bool modem_cmux_transmit_cmd_frame(struct modem_cmux *cmux, const struct modem_cmux_frame *frame) { uint16_t space; - struct modem_cmux_command *command; + struct modem_cmux_command command; k_mutex_lock(&cmux->transmit_rb_lock, K_FOREVER); space = ring_buf_space_get(&cmux->transmit_rb); @@ -433,8 +563,9 @@ static bool modem_cmux_transmit_cmd_frame(struct modem_cmux *cmux, } modem_cmux_log_transmit_frame(frame); - if (modem_cmux_wrap_command(&command, frame->data, frame->data_len) == 0) { - modem_cmux_log_transmit_command(command); + command = modem_cmux_command_decode(frame->data, frame->data_len); + if (modem_cmux_command_is_valid(&command)) { + modem_cmux_log_transmit_command(&command); } modem_cmux_transmit_frame(cmux, frame); @@ -477,7 +608,7 @@ static int16_t modem_cmux_transmit_data_frame(struct modem_cmux *cmux, static void modem_cmux_acknowledge_received_frame(struct modem_cmux *cmux) { - struct modem_cmux_command *command; + struct modem_cmux_command_type command; struct modem_cmux_frame frame; uint8_t data[MODEM_CMUX_CMD_DATA_SIZE_MAX]; @@ -488,8 +619,9 @@ static void modem_cmux_acknowledge_received_frame(struct modem_cmux *cmux) memcpy(&frame, &cmux->frame, sizeof(cmux->frame)); memcpy(data, cmux->frame.data, cmux->frame.data_len); - modem_cmux_wrap_command(&command, data, cmux->frame.data_len); - command->type.cr = 0; + command = modem_cmux_command_type_decode(data[0]); + command.cr = 0; + data[0] = modem_cmux_command_type_encode(command); frame.data = data; frame.data_len = cmux->frame.data_len; @@ -516,29 +648,34 @@ static void modem_cmux_send_msc(struct modem_cmux *cmux, struct modem_cmux_dlci .rtr = dlci->state == MODEM_CMUX_DLCI_STATE_OPEN ? 1 : 0, .dv = 1, }; - struct modem_cmux_command_msc cmd = { - .command = { - .type = { - .ea = 1, - .cr = 1, - .value = MODEM_CMUX_COMMAND_MSC, - }, - .length = { - .ea = 1, - .value = sizeof(cmd.value), - }, + struct modem_cmux_command cmd = { + .type = { + .ea = 1, + .cr = 1, + .value = MODEM_CMUX_COMMAND_MSC, + }, + .length = { + .ea = 1, + .value = 2, }, .value[0] = modem_cmux_msc_addr_encode(addr), .value[1] = modem_cmux_msc_signals_encode(signals), }; + uint16_t len; + uint8_t *data = modem_cmux_command_encode(&cmd, &len); + + if (data == NULL) { + return; + } + struct modem_cmux_frame frame = { .dlci_address = 0, .cr = cmux->initiator, .pf = false, .type = MODEM_CMUX_FRAME_TYPE_UIH, - .data = (void *)&cmd, - .data_len = sizeof(cmd), + .data = data, + .data_len = len, }; LOG_DBG("Sending MSC command for DLCI %u, FC:%d RTR: %d DV: %d", addr.dlci_address, @@ -655,41 +792,44 @@ static void modem_cmux_on_control_frame_ua(struct modem_cmux *cmux) static void modem_cmux_respond_unsupported_cmd(struct modem_cmux *cmux) { struct modem_cmux_frame frame = cmux->frame; - struct modem_cmux_command *cmd; + struct modem_cmux_command cmd = modem_cmux_command_decode(frame.data, frame.data_len); - if (modem_cmux_wrap_command(&cmd, frame.data, frame.data_len) < 0) { + if (!modem_cmux_command_is_valid(&cmd)) { LOG_WRN("Invalid command"); return; } - struct { - /* 3GPP TS 27.010: 5.4.6.3.8 Non Supported Command Response (NSC) */ - struct modem_cmux_command nsc; - struct modem_cmux_command_type value; - } nsc_cmd = { - .nsc = { - .type = { - .ea = 1, - .cr = 0, - .value = MODEM_CMUX_COMMAND_NSC, - }, - .length = { - .ea = 1, - .value = 1, - }, + + /* 3GPP TS 27.010: 5.4.6.3.8 Non Supported Command Response (NSC) */ + struct modem_cmux_command nsc_cmd = { + .type = { + .ea = 1, + .cr = 0, + .value = MODEM_CMUX_COMMAND_NSC, + }, + .length = { + .ea = 1, + .value = 1, }, - .value = cmd->type, + .value[0] = modem_cmux_command_type_encode(cmd.type), }; - frame.data = (uint8_t *)&nsc_cmd; - frame.data_len = sizeof(nsc_cmd); + uint16_t len; + uint8_t *data = modem_cmux_command_encode(&nsc_cmd, &len); + + if (data == NULL) { + return; + } + + frame.data = data; + frame.data_len = len; modem_cmux_transmit_cmd_frame(cmux, &frame); } static void modem_cmux_on_control_frame_uih(struct modem_cmux *cmux) { - struct modem_cmux_command *command; + struct modem_cmux_command command; if ((cmux->state != MODEM_CMUX_STATE_CONNECTED) && (cmux->state != MODEM_CMUX_STATE_DISCONNECTING)) { @@ -697,18 +837,19 @@ static void modem_cmux_on_control_frame_uih(struct modem_cmux *cmux) return; } - if (modem_cmux_wrap_command(&command, cmux->frame.data, cmux->frame.data_len) < 0) { + command = modem_cmux_command_decode(cmux->frame.data, cmux->frame.data_len); + if (!modem_cmux_command_is_valid(&command)) { LOG_WRN("Invalid command"); return; } - modem_cmux_log_received_command(command); + modem_cmux_log_received_command(&command); - if (!command->type.cr) { + if (!command.type.cr) { LOG_DBG("Received response command"); - switch (command->type.value) { + switch (command.type.value) { case MODEM_CMUX_COMMAND_CLD: - modem_cmux_on_cld_command(cmux, command); + modem_cmux_on_cld_command(cmux, &command); break; default: /* Responses to other commands are ignored */ @@ -717,13 +858,13 @@ static void modem_cmux_on_control_frame_uih(struct modem_cmux *cmux) return; } - switch (command->type.value) { + switch (command.type.value) { case MODEM_CMUX_COMMAND_CLD: - modem_cmux_on_cld_command(cmux, command); + modem_cmux_on_cld_command(cmux, &command); break; case MODEM_CMUX_COMMAND_MSC: - modem_cmux_on_msc_command(cmux, command); + modem_cmux_on_msc_command(cmux, &command); break; case MODEM_CMUX_COMMAND_FCON: @@ -1321,8 +1462,6 @@ static void modem_cmux_disconnect_handler(struct k_work *item) { struct k_work_delayable *dwork = k_work_delayable_from_work(item); struct modem_cmux *cmux = CONTAINER_OF(dwork, struct modem_cmux, disconnect_work); - struct modem_cmux_command *command; - uint8_t data[2]; if (cmux->state == MODEM_CMUX_STATE_DISCONNECTING) { disconnect(cmux); @@ -1331,12 +1470,21 @@ static void modem_cmux_disconnect_handler(struct k_work *item) k_work_schedule(&cmux->disconnect_work, MODEM_CMUX_T1_TIMEOUT); } - command = modem_cmux_command_wrap(data); - command->type.ea = 1; - command->type.cr = 1; - command->type.value = MODEM_CMUX_COMMAND_CLD; - command->length.ea = 1; - command->length.value = 0; + struct modem_cmux_command command = { + .type.ea = 1, + .type.cr = 1, + .type.value = MODEM_CMUX_COMMAND_CLD, + .length.ea = 1, + .length.value = 0, + }; + + uint16_t len; + uint8_t *data = modem_cmux_command_encode(&command, &len); + + if (data == NULL) { + return; + } + struct modem_cmux_frame frame = { .dlci_address = 0, @@ -1344,7 +1492,7 @@ static void modem_cmux_disconnect_handler(struct k_work *item) .pf = false, .type = MODEM_CMUX_FRAME_TYPE_UIH, .data = data, - .data_len = sizeof(data), + .data_len = len, }; /* Transmit close down command */ diff --git a/tests/subsys/modem/modem_cmux/src/main.c b/tests/subsys/modem/modem_cmux/src/main.c index 67833baabe76..b40af7e0de89 100644 --- a/tests/subsys/modem/modem_cmux/src/main.c +++ b/tests/subsys/modem/modem_cmux/src/main.c @@ -937,4 +937,23 @@ ZTEST(modem_cmux, test_modem_cmux_invalid_cr) zassert_false(events, "Wrong CMD should have been ignored"); } +ZTEST(modem_cmux, test_modem_cmux_invalid_command) +{ + static uint8_t invalid_cmd[] = {0xF9, 0x03, 0xEF, 0x09, 0x00, + 0x00, 0x00, 0x00, 0xFB, 0xF9}; + uint32_t events; + + modem_backend_mock_put(&bus_mock, invalid_cmd, + sizeof(invalid_cmd)); + + events = k_event_wait_all(&cmux_event, + (MODEM_CMUX_EVENT_CONNECTED | MODEM_CMUX_EVENT_DISCONNECTED), + false, K_SECONDS(1)); + + zassert_false(events, "Wrong CMD should have been ignored"); + + /* Invalid command should not cause any response */ + zassert_equal(0, modem_backend_mock_get(&bus_mock, buffer1, sizeof(buffer1))); +} + ZTEST_SUITE(modem_cmux, NULL, test_modem_cmux_setup, test_modem_cmux_before, NULL, NULL); From 2d81801a851d21229020816f3029762a93b19083 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Thu, 23 Oct 2025 16:39:48 +0300 Subject: [PATCH 2029/2141] [nrf fromlist] drivers: modem: Implement support for DTR signal DTR signal on UART extends the power saving by allowing host to indicate the remote end that the UART is not in active state. Upstream PR #: 98145 Signed-off-by: Seppo Takalo --- drivers/modem/modem_cellular.c | 9 +++++++++ dts/bindings/modem/zephyr,cellular-modem-device.yaml | 8 ++++++++ include/zephyr/modem/backend/uart.h | 2 ++ subsys/modem/backends/modem_backend_uart.c | 1 + subsys/modem/backends/modem_backend_uart_async.c | 8 ++++++++ subsys/modem/backends/modem_backend_uart_async_hwfc.c | 8 ++++++++ 6 files changed, 36 insertions(+) diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index 64e3614b51eb..0079a07b10d6 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -185,6 +185,7 @@ struct modem_cellular_config { struct gpio_dt_spec power_gpio; struct gpio_dt_spec reset_gpio; struct gpio_dt_spec wake_gpio; + struct gpio_dt_spec dtr_gpio; uint16_t power_pulse_duration_ms; uint16_t reset_pulse_duration_ms; uint16_t startup_time_ms; @@ -2095,6 +2096,7 @@ static int modem_cellular_init(const struct device *dev) { struct modem_cellular_data *data = (struct modem_cellular_data *)dev->data; struct modem_cellular_config *config = (struct modem_cellular_config *)dev->config; + const struct gpio_dt_spec *dtr_gpio = NULL; data->dev = dev; @@ -2118,9 +2120,15 @@ static int modem_cellular_init(const struct device *dev) gpio_pin_configure_dt(&config->reset_gpio, GPIO_OUTPUT_ACTIVE); } + if (modem_cellular_gpio_is_enabled(&config->dtr_gpio)) { + gpio_pin_configure_dt(&config->dtr_gpio, GPIO_OUTPUT_INACTIVE); + dtr_gpio = &config->dtr_gpio; + } + { const struct modem_backend_uart_config uart_backend_config = { .uart = config->uart, + .dtr_gpio = dtr_gpio, .receive_buf = data->uart_backend_receive_buf, .receive_buf_size = ARRAY_SIZE(data->uart_backend_receive_buf), .transmit_buf = data->uart_backend_transmit_buf, @@ -2888,6 +2896,7 @@ MODEM_CHAT_SCRIPT_DEFINE(sqn_gm02s_periodic_chat_script, .power_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, mdm_power_gpios, {}), \ .reset_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, mdm_reset_gpios, {}), \ .wake_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, mdm_wake_gpios, {}), \ + .dtr_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, mdm_dtr_gpios, {}), \ .power_pulse_duration_ms = (power_ms), \ .reset_pulse_duration_ms = (reset_ms), \ .startup_time_ms = (startup_ms), \ diff --git a/dts/bindings/modem/zephyr,cellular-modem-device.yaml b/dts/bindings/modem/zephyr,cellular-modem-device.yaml index bff39d7f9f61..66c7fd91d092 100644 --- a/dts/bindings/modem/zephyr,cellular-modem-device.yaml +++ b/dts/bindings/modem/zephyr,cellular-modem-device.yaml @@ -17,3 +17,11 @@ properties: mdm-wake-gpios: type: phandle-array description: GPIO for modem wake + + mdm-dtr-gpios: + type: phandle-array + description: | + GPIO for modem data terminal ready. + + Asserted (logical high) when UART is active and + deasserted (logical low) when UART is inactive, powered down or in low power mode. diff --git a/include/zephyr/modem/backend/uart.h b/include/zephyr/modem/backend/uart.h index 73054b792d8e..6407af8cf6af 100644 --- a/include/zephyr/modem/backend/uart.h +++ b/include/zephyr/modem/backend/uart.h @@ -68,6 +68,7 @@ struct modem_backend_uart_async { struct modem_backend_uart { const struct device *uart; + const struct gpio_dt_spec *dtr_gpio; struct modem_pipe pipe; struct k_work_delayable receive_ready_work; struct k_work transmit_idle_work; @@ -85,6 +86,7 @@ struct modem_backend_uart { struct modem_backend_uart_config { const struct device *uart; + const struct gpio_dt_spec *dtr_gpio; /* Address must be word-aligned when CONFIG_MODEM_BACKEND_UART_ASYNC_HWFC is enabled. */ uint8_t *receive_buf; uint32_t receive_buf_size; diff --git a/subsys/modem/backends/modem_backend_uart.c b/subsys/modem/backends/modem_backend_uart.c index 82242a76c019..13a35406f182 100644 --- a/subsys/modem/backends/modem_backend_uart.c +++ b/subsys/modem/backends/modem_backend_uart.c @@ -39,6 +39,7 @@ struct modem_pipe *modem_backend_uart_init(struct modem_backend_uart *backend, memset(backend, 0x00, sizeof(*backend)); backend->uart = config->uart; + backend->dtr_gpio = config->dtr_gpio; k_work_init_delayable(&backend->receive_ready_work, modem_backend_uart_receive_ready_handler); k_work_init(&backend->transmit_idle_work, modem_backend_uart_transmit_idle_handler); diff --git a/subsys/modem/backends/modem_backend_uart_async.c b/subsys/modem/backends/modem_backend_uart_async.c index 9b5edc8965c5..1615120a4d5e 100644 --- a/subsys/modem/backends/modem_backend_uart_async.c +++ b/subsys/modem/backends/modem_backend_uart_async.c @@ -11,6 +11,7 @@ LOG_MODULE_REGISTER(modem_backend_uart_async, CONFIG_MODEM_MODULES_LOG_LEVEL); #include +#include #include enum { @@ -157,6 +158,10 @@ static int modem_backend_uart_async_open(void *data) atomic_clear(&backend->async.common.state); ring_buf_reset(&backend->async.receive_rb); + if (backend->dtr_gpio) { + gpio_pin_set_dt(backend->dtr_gpio, 1); + } + atomic_set_bit(&backend->async.common.state, MODEM_BACKEND_UART_ASYNC_STATE_RX_BUF0_USED_BIT); atomic_set_bit(&backend->async.common.state, MODEM_BACKEND_UART_ASYNC_STATE_RECEIVING_BIT); @@ -268,6 +273,9 @@ static int modem_backend_uart_async_close(void *data) atomic_clear_bit(&backend->async.common.state, MODEM_BACKEND_UART_ASYNC_STATE_OPEN_BIT); uart_tx_abort(backend->uart); uart_rx_disable(backend->uart); + if (backend->dtr_gpio) { + gpio_pin_set_dt(backend->dtr_gpio, 0); + } return 0; } diff --git a/subsys/modem/backends/modem_backend_uart_async_hwfc.c b/subsys/modem/backends/modem_backend_uart_async_hwfc.c index 61d307604e5c..3aaaad2e196c 100644 --- a/subsys/modem/backends/modem_backend_uart_async_hwfc.c +++ b/subsys/modem/backends/modem_backend_uart_async_hwfc.c @@ -11,6 +11,7 @@ LOG_MODULE_REGISTER(modem_backend_uart_async_hwfc, CONFIG_MODEM_MODULES_LOG_LEVEL); #include +#include #include struct rx_buf_t { @@ -221,6 +222,10 @@ static int modem_backend_uart_async_hwfc_open(void *data) return -ENOMEM; } + if (backend->dtr_gpio) { + gpio_pin_set_dt(backend->dtr_gpio, 1); + } + atomic_clear(&backend->async.common.state); atomic_set_bit(&backend->async.common.state, MODEM_BACKEND_UART_ASYNC_STATE_OPEN_BIT); @@ -357,6 +362,9 @@ static int modem_backend_uart_async_hwfc_close(void *data) uart_rx_disable(backend->uart); } + if (backend->dtr_gpio) { + gpio_pin_set_dt(backend->dtr_gpio, 0); + } return 0; } From 55c463e9f989d1747b3f4449b35716ca0dc5fbdc Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Tue, 14 Oct 2025 21:04:46 +0000 Subject: [PATCH 2030/2141] [nrf fromlist] modem: cmux: Implement Power Saving Control message Signal powersaving mode for the remote end using PSC command. Wakes up the remote end from powersaving mode by sending flag characters. This method is defined in 3GPP TS 27.010. Sections 5.4.6.3.2 Power Saving Control (PSC) and 5.4.7 Power Control and Wake-up Mechanisms. Essentially it is one PSC command to indicate a sleep state, and then repeated flag characters to wake up the remote end or indicate that we have been woken up. Upstream PR #: 97362 Signed-off-by: Seppo Takalo --- include/zephyr/modem/cmux.h | 5 ++ subsys/modem/Kconfig | 8 ++ subsys/modem/modem_cmux.c | 175 +++++++++++++++++++++++++++++++----- 3 files changed, 168 insertions(+), 20 deletions(-) diff --git a/include/zephyr/modem/cmux.h b/include/zephyr/modem/cmux.h index bf349980e2c9..912edb1b79ef 100644 --- a/include/zephyr/modem/cmux.h +++ b/include/zephyr/modem/cmux.h @@ -72,6 +72,10 @@ enum modem_cmux_state { MODEM_CMUX_STATE_DISCONNECTED = 0, MODEM_CMUX_STATE_CONNECTING, MODEM_CMUX_STATE_CONNECTED, + MODEM_CMUX_STATE_ENTER_POWERSAVE, + MODEM_CMUX_STATE_POWERSAVE, + MODEM_CMUX_STATE_CONFIRM_POWERSAVE, + MODEM_CMUX_STATE_WAKEUP, MODEM_CMUX_STATE_DISCONNECTING, }; @@ -187,6 +191,7 @@ struct modem_cmux { /* Synchronize actions */ struct k_event event; + k_timepoint_t t3_timepoint; /* Statistics */ #if CONFIG_MODEM_STATS diff --git a/subsys/modem/Kconfig b/subsys/modem/Kconfig index dfcb7ddae9a3..8b4a411c26f6 100644 --- a/subsys/modem/Kconfig +++ b/subsys/modem/Kconfig @@ -64,6 +64,14 @@ config MODEM_CMUX_WORK_BUFFER_SIZE_EXTRA Extra bytes to add to the work buffers used by the CMUX module. The default size of these buffers is MODEM_CMUX_MTU + 7 (CMUX header size). +config MODEM_CMUX_T3_TIMEOUT + int "CMUX T3 timeout in seconds" + range 1 255 + default 10 + help + Response Timer for wake-up procedure(T3). + Time in seconds before the link is considered dead. + module = MODEM_CMUX module-str = modem_cmux source "subsys/logging/Kconfig.template.log_config" diff --git a/subsys/modem/modem_cmux.c b/subsys/modem/modem_cmux.c index 3bebde19d462..a491195b78e9 100644 --- a/subsys/modem/modem_cmux.c +++ b/subsys/modem/modem_cmux.c @@ -37,9 +37,7 @@ LOG_MODULE_REGISTER(modem_cmux, CONFIG_MODEM_CMUX_LOG_LEVEL); #define MODEM_CMUX_T1_TIMEOUT (K_MSEC(330)) #define MODEM_CMUX_T2_TIMEOUT (K_MSEC(660)) - -#define MODEM_CMUX_EVENT_CONNECTED_BIT (BIT(0)) -#define MODEM_CMUX_EVENT_DISCONNECTED_BIT (BIT(1)) +#define MODEM_CMUX_T3_TIMEOUT (K_SECONDS(CONFIG_MODEM_CMUX_T3_TIMEOUT)) enum modem_cmux_frame_types { MODEM_CMUX_FRAME_TYPE_RR = 0x01, @@ -101,6 +99,7 @@ struct modem_cmux_msc_addr { static struct modem_cmux_dlci *modem_cmux_find_dlci(struct modem_cmux *cmux, uint8_t dlci_address); static void modem_cmux_dlci_notify_transmit_idle(struct modem_cmux *cmux); +static void modem_cmux_tx_bypass(struct modem_cmux *cmux, const uint8_t *data, size_t len); static void set_state(struct modem_cmux *cmux, enum modem_cmux_state state) { @@ -118,6 +117,22 @@ static bool is_connected(struct modem_cmux *cmux) return cmux->state == MODEM_CMUX_STATE_CONNECTED; } +static bool is_powersaving(struct modem_cmux *cmux) +{ + return cmux->state == MODEM_CMUX_STATE_POWERSAVE; +} + +static bool is_waking_up(struct modem_cmux *cmux) +{ + return cmux->state == MODEM_CMUX_STATE_WAKEUP; +} + +static bool is_transitioning_to_powersave(struct modem_cmux *cmux) +{ + return (cmux->state == MODEM_CMUX_STATE_ENTER_POWERSAVE || + cmux->state == MODEM_CMUX_STATE_CONFIRM_POWERSAVE); +} + static bool modem_cmux_command_type_is_valid(const struct modem_cmux_command_type type) { /* All commands are only 7 bits, so EA is always set */ @@ -581,7 +596,7 @@ static int16_t modem_cmux_transmit_data_frame(struct modem_cmux *cmux, k_mutex_lock(&cmux->transmit_rb_lock, K_FOREVER); - if (cmux->flow_control_on == false) { + if (cmux->flow_control_on == false || is_transitioning_to_powersave(cmux)) { k_mutex_unlock(&cmux->transmit_rb_lock); return 0; } @@ -630,6 +645,34 @@ static void modem_cmux_acknowledge_received_frame(struct modem_cmux *cmux) } } +static void modem_cmux_send_psc(struct modem_cmux *cmux) +{ + uint16_t len; + uint8_t *data = modem_cmux_command_encode(&(struct modem_cmux_command){ + .type.ea = 1, + .type.cr = 1, + .type.value = MODEM_CMUX_COMMAND_PSC, + .length.ea = 1, + .length.value = 0, + }, &len); + + if (data == NULL) { + return; + } + + struct modem_cmux_frame frame = { + .dlci_address = 0, + .cr = cmux->initiator, + .pf = true, + .type = MODEM_CMUX_FRAME_TYPE_UIH, + .data = data, + .data_len = len, + }; + + LOG_DBG("Sending PSC command"); + modem_cmux_transmit_cmd_frame(cmux, &frame); +} + static void modem_cmux_send_msc(struct modem_cmux *cmux, struct modem_cmux_dlci *dlci) { if (cmux == NULL || dlci == NULL) { @@ -827,12 +870,28 @@ static void modem_cmux_respond_unsupported_cmd(struct modem_cmux *cmux) modem_cmux_transmit_cmd_frame(cmux, &frame); } +static void modem_cmux_on_psc_command(struct modem_cmux *cmux) +{ + LOG_DBG("Received power saving command"); + k_mutex_lock(&cmux->transmit_rb_lock, K_FOREVER); + set_state(cmux, MODEM_CMUX_STATE_CONFIRM_POWERSAVE); + modem_cmux_acknowledge_received_frame(cmux); + k_mutex_unlock(&cmux->transmit_rb_lock); +} + +static void modem_cmux_on_psc_response(struct modem_cmux *cmux) +{ + LOG_DBG("Enter power saving"); + k_mutex_lock(&cmux->transmit_rb_lock, K_FOREVER); + set_state(cmux, MODEM_CMUX_STATE_POWERSAVE); + k_mutex_unlock(&cmux->transmit_rb_lock); +} + static void modem_cmux_on_control_frame_uih(struct modem_cmux *cmux) { struct modem_cmux_command command; - if ((cmux->state != MODEM_CMUX_STATE_CONNECTED) && - (cmux->state != MODEM_CMUX_STATE_DISCONNECTING)) { + if (cmux->state < MODEM_CMUX_STATE_CONNECTED) { LOG_DBG("Unexpected UIH frame"); return; } @@ -851,6 +910,9 @@ static void modem_cmux_on_control_frame_uih(struct modem_cmux *cmux) case MODEM_CMUX_COMMAND_CLD: modem_cmux_on_cld_command(cmux, &command); break; + case MODEM_CMUX_COMMAND_PSC: + modem_cmux_on_psc_response(cmux); + break; default: /* Responses to other commands are ignored */ break; @@ -875,6 +937,10 @@ static void modem_cmux_on_control_frame_uih(struct modem_cmux *cmux) modem_cmux_on_fcoff_command(cmux); break; + case MODEM_CMUX_COMMAND_PSC: + modem_cmux_on_psc_command(cmux); + break; + default: LOG_DBG("Unknown control command"); modem_cmux_respond_unsupported_cmd(cmux); @@ -1140,6 +1206,11 @@ static void modem_cmux_on_frame(struct modem_cmux *cmux) modem_cmux_advertise_receive_buf_stats(cmux); #endif + if (is_powersaving(cmux) || is_waking_up(cmux)) { + set_state(cmux, MODEM_CMUX_STATE_CONNECTED); + LOG_DBG("Exit powersave on received frame"); + } + if (cmux->frame.dlci_address == 0) { modem_cmux_on_control_frame(cmux); } else { @@ -1170,8 +1241,10 @@ static void modem_cmux_process_received_byte(struct modem_cmux *cmux, uint8_t by switch (cmux->receive_state) { case MODEM_CMUX_RECEIVE_STATE_SOF: + cmux->frame_header_len = 0; if (byte == MODEM_CMUX_SOF) { cmux->receive_state = MODEM_CMUX_RECEIVE_STATE_RESYNC; + cmux->frame_header_len++; break; } @@ -1183,6 +1256,20 @@ static void modem_cmux_process_received_byte(struct modem_cmux *cmux, uint8_t by * 0xF9 could also be a valid address field for DLCI 62. */ if (byte == MODEM_CMUX_SOF) { + /* Use "header_len" to count SOF bytes, only start transmitting + * flag bytes after receiving more than 3 flags. + * Don't reply flags if we are transitioning between modes or + * if T3 timer is still active (suppress residual flags). + */ + cmux->frame_header_len++; + if ((is_powersaving(cmux) || + (is_connected(cmux) && sys_timepoint_expired(cmux->t3_timepoint))) && + cmux->frame_header_len > 3) { + modem_cmux_tx_bypass(cmux, &(char){MODEM_CMUX_SOF}, 1); + } + if (is_waking_up(cmux)) { + k_work_reschedule(&cmux->transmit_work, K_NO_WAIT); + } break; } @@ -1351,21 +1438,15 @@ static void modem_cmux_receive_handler(struct k_work *item) int ret; /* Receive data from pipe */ - ret = modem_pipe_receive(cmux->pipe, cmux->work_buf, sizeof(cmux->work_buf)); - if (ret < 1) { - if (ret < 0) { - LOG_ERR("Pipe receiving error: %d", ret); + while ((ret = modem_pipe_receive(cmux->pipe, cmux->work_buf, sizeof(cmux->work_buf))) > 0) { + /* Process received data */ + for (int i = 0; i < ret; i++) { + modem_cmux_process_received_byte(cmux, cmux->work_buf[i]); } - return; } - - /* Process received data */ - for (int i = 0; i < ret; i++) { - modem_cmux_process_received_byte(cmux, cmux->work_buf[i]); + if (ret < 0) { + LOG_ERR("Pipe receiving error: %d", ret); } - - /* Reschedule received work */ - modem_work_schedule(&cmux->receive_work, K_NO_WAIT); } static void modem_cmux_dlci_notify_transmit_idle(struct modem_cmux *cmux) @@ -1381,6 +1462,51 @@ static void modem_cmux_dlci_notify_transmit_idle(struct modem_cmux *cmux) } } +/** Transmit bytes bypassing the CMUX buffers. + * Causes modem_cmux_transmit_handler() to be rescheduled as a result of TRANSMIT_IDLE event. + */ +static void modem_cmux_tx_bypass(struct modem_cmux *cmux, const uint8_t *data, size_t len) +{ + if (cmux == NULL) { + return; + } + + modem_pipe_transmit(cmux->pipe, data, len); +} + +static bool powersave_wait_wakeup(struct modem_cmux *cmux) +{ + static const uint8_t wakeup_pattern[] = {MODEM_CMUX_SOF, MODEM_CMUX_SOF, MODEM_CMUX_SOF, + MODEM_CMUX_SOF, MODEM_CMUX_SOF}; + int ret; + + if (is_powersaving(cmux)) { + LOG_DBG("Power saving mode, wake up first"); + set_state(cmux, MODEM_CMUX_STATE_WAKEUP); + cmux->t3_timepoint = sys_timepoint_calc(MODEM_CMUX_T3_TIMEOUT); + modem_cmux_tx_bypass(cmux, wakeup_pattern, sizeof(wakeup_pattern)); + return true; + } + + if (is_waking_up(cmux)) { + if (sys_timepoint_expired(cmux->t3_timepoint)) { + LOG_ERR("Wake up timed out, link dead"); + set_state(cmux, MODEM_CMUX_STATE_DISCONNECTED); + modem_cmux_raise_event(cmux, MODEM_CMUX_EVENT_DISCONNECTED); + return true; + } + if (cmux->receive_state != MODEM_CMUX_RECEIVE_STATE_RESYNC) { + /* Retry single flag, until remote wakes up */ + modem_cmux_tx_bypass(cmux, &(uint8_t){MODEM_CMUX_SOF}, 1); + return true; + } + set_state(cmux, MODEM_CMUX_STATE_CONNECTED); + LOG_DBG("Woke up from power saving mode"); + } + + return false; +} + static void modem_cmux_transmit_handler(struct k_work *item) { struct k_work_delayable *dwork = k_work_delayable_from_work(item); @@ -1403,6 +1529,11 @@ static void modem_cmux_transmit_handler(struct k_work *item) break; } + if (powersave_wait_wakeup(cmux)) { + k_mutex_unlock(&cmux->transmit_rb_lock); + return; + } + reserved_size = ring_buf_get_claim(&cmux->transmit_rb, &reserved, UINT32_MAX); ret = modem_pipe_transmit(cmux->pipe, reserved, reserved_size); @@ -1423,11 +1554,14 @@ static void modem_cmux_transmit_handler(struct k_work *item) } } - k_mutex_unlock(&cmux->transmit_rb_lock); - if (transmit_rb_empty) { + if (cmux->state == MODEM_CMUX_STATE_CONFIRM_POWERSAVE) { + set_state(cmux, MODEM_CMUX_STATE_POWERSAVE); + LOG_DBG("Entered power saving mode"); + } modem_cmux_dlci_notify_transmit_idle(cmux); } + k_mutex_unlock(&cmux->transmit_rb_lock); } static void modem_cmux_connect_handler(struct k_work *item) @@ -1724,6 +1858,7 @@ void modem_cmux_init(struct modem_cmux *cmux, const struct modem_cmux_config *co cmux->user_data = config->user_data; cmux->receive_buf = config->receive_buf; cmux->receive_buf_size = config->receive_buf_size; + cmux->t3_timepoint = sys_timepoint_calc(K_NO_WAIT); sys_slist_init(&cmux->dlcis); ring_buf_init(&cmux->transmit_rb, config->transmit_buf_size, config->transmit_buf); k_mutex_init(&cmux->transmit_rb_lock); From f5b6222db45d89a0e926ea4fa0bd6fd8fb110d91 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Fri, 10 Oct 2025 11:14:53 +0300 Subject: [PATCH 2031/2141] [nrf fromlist] drivers: modem: Implement runtime power management for CMUX CMUX driver can enable the support for idle-timer in devicetree and can be requested to shut down the pipe during sleep. Then UART backend put the actual device into sleep when pipe is closed. Waking up is requested by sending data to DLC pipe or by manually opening the uart_pipe. Modem may request similar wake-up by a RING interrupt which would open the same pipe. When UART is powered and pipe is not closed, CMUX wake-up procedure is automatic. Either end may initiate the wake-up. Upstream PR #: 97362 Signed-off-by: Seppo Takalo --- drivers/modem/modem_cellular.c | 31 +++--- .../modem/zephyr,cellular-modem-device.yaml | 19 ++++ include/zephyr/modem/cmux.h | 14 +++ .../modem/backends/modem_backend_uart_async.c | 13 +++ .../backends/modem_backend_uart_async_hwfc.c | 14 +++ subsys/modem/modem_cmux.c | 96 ++++++++++++++++++- 6 files changed, 171 insertions(+), 16 deletions(-) diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index 0079a07b10d6..5d381af2a821 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -17,6 +17,8 @@ #include #include #include +#include +#include #include #include @@ -191,6 +193,9 @@ struct modem_cellular_config { uint16_t startup_time_ms; uint16_t shutdown_time_ms; bool autostarts; + bool cmux_enable_runtime_power_save; + bool cmux_close_pipe_on_power_save; + k_timeout_t cmux_idle_timeout; const struct modem_chat_script *init_chat_script; const struct modem_chat_script *dial_chat_script; const struct modem_chat_script *periodic_chat_script; @@ -2102,7 +2107,6 @@ static int modem_cellular_init(const struct device *dev) k_mutex_init(&data->api_lock); k_work_init_delayable(&data->timeout_work, modem_cellular_timeout_handler); - k_work_init(&data->event_dispatch_work, modem_cellular_event_dispatch_handler); ring_buf_init(&data->event_rb, sizeof(data->event_buf), data->event_buf); @@ -2149,6 +2153,9 @@ static int modem_cellular_init(const struct device *dev) .receive_buf_size = ARRAY_SIZE(data->cmux_receive_buf), .transmit_buf = data->cmux_transmit_buf, .transmit_buf_size = ARRAY_SIZE(data->cmux_transmit_buf), + .enable_runtime_power_management = config->cmux_enable_runtime_power_save, + .close_pipe_on_power_save = config->cmux_close_pipe_on_power_save, + .idle_timeout = config->cmux_idle_timeout, }; modem_cmux_init(&data->cmux, &cmux_config); @@ -2886,11 +2893,8 @@ MODEM_CHAT_SCRIPT_DEFINE(sqn_gm02s_periodic_chat_script, /* Helper to define modem instance */ #define MODEM_CELLULAR_DEFINE_INSTANCE(inst, power_ms, reset_ms, startup_ms, shutdown_ms, start, \ - set_baudrate_script, \ - init_script, \ - dial_script, \ - periodic_script, \ - shutdown_script) \ + set_baudrate_script, init_script, dial_script, \ + periodic_script, shutdown_script) \ static const struct modem_cellular_config MODEM_CELLULAR_INST_NAME(config, inst) = { \ .uart = DEVICE_DT_GET(DT_INST_BUS(inst)), \ .power_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, mdm_power_gpios, {}), \ @@ -2899,14 +2903,19 @@ MODEM_CHAT_SCRIPT_DEFINE(sqn_gm02s_periodic_chat_script, .dtr_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, mdm_dtr_gpios, {}), \ .power_pulse_duration_ms = (power_ms), \ .reset_pulse_duration_ms = (reset_ms), \ - .startup_time_ms = (startup_ms), \ + .startup_time_ms = (startup_ms), \ .shutdown_time_ms = (shutdown_ms), \ .autostarts = DT_INST_PROP_OR(inst, autostarts, (start)), \ - .set_baudrate_chat_script = (set_baudrate_script), \ - .init_chat_script = (init_script), \ - .dial_chat_script = (dial_script), \ + .cmux_enable_runtime_power_save = \ + DT_INST_PROP_OR(inst, cmux_enable_runtime_power_save, 0), \ + .cmux_close_pipe_on_power_save = \ + DT_INST_PROP_OR(inst, cmux_close_pipe_on_power_save, 0), \ + .cmux_idle_timeout = K_MSEC(DT_INST_PROP_OR(inst, cmux_idle_timeout_ms, 0)), \ + .set_baudrate_chat_script = (set_baudrate_script), \ + .init_chat_script = (init_script), \ + .dial_chat_script = (dial_script), \ .periodic_chat_script = (periodic_script), \ - .shutdown_chat_script = (shutdown_script), \ + .shutdown_chat_script = (shutdown_script), \ .user_pipes = MODEM_CELLULAR_GET_USER_PIPES(inst), \ .user_pipes_size = ARRAY_SIZE(MODEM_CELLULAR_GET_USER_PIPES(inst)), \ }; \ diff --git a/dts/bindings/modem/zephyr,cellular-modem-device.yaml b/dts/bindings/modem/zephyr,cellular-modem-device.yaml index 66c7fd91d092..c2d2e9e00a88 100644 --- a/dts/bindings/modem/zephyr,cellular-modem-device.yaml +++ b/dts/bindings/modem/zephyr,cellular-modem-device.yaml @@ -25,3 +25,22 @@ properties: Asserted (logical high) when UART is active and deasserted (logical low) when UART is inactive, powered down or in low power mode. + + cmux-enable-runtime-power-save: + type: boolean + description: | + Enable runtime power saving using CMUX PSC commands. + This requires modem to support CMUX and PSC commands while keeping the data + connection active. + + cmux-close-pipe-on-power-save: + type: boolean + description: | + Close the modem pipe when entering power save mode. + When runtime power management is enabled, this closes the UART. + This requires modem to support waking up the UART using RING signal. + + cmux-idle-timeout-ms: + type: int + description: Time in milliseconds after which CMUX will enter power save mode. + default: 10000 diff --git a/include/zephyr/modem/cmux.h b/include/zephyr/modem/cmux.h index 912edb1b79ef..18bb6fff980d 100644 --- a/include/zephyr/modem/cmux.h +++ b/include/zephyr/modem/cmux.h @@ -159,6 +159,12 @@ struct modem_cmux { enum modem_cmux_state state; bool flow_control_on : 1; bool initiator : 1; + /** Enable runtime power management */ + bool enable_runtime_power_management; + /** Close pipe on power save */ + bool close_pipe_on_power_save; + /** Idle timeout for power save */ + k_timeout_t idle_timeout; /* Work lock */ bool attached : 1; @@ -188,10 +194,12 @@ struct modem_cmux { struct k_work_delayable transmit_work; struct k_work_delayable connect_work; struct k_work_delayable disconnect_work; + struct k_work_delayable runtime_pm_work; /* Synchronize actions */ struct k_event event; k_timepoint_t t3_timepoint; + k_timepoint_t idle_timepoint; /* Statistics */ #if CONFIG_MODEM_STATS @@ -220,6 +228,12 @@ struct modem_cmux_config { uint8_t *transmit_buf; /** Size of transmit buffer in bytes [149, ...] */ uint16_t transmit_buf_size; + /** Enable runtime power management */ + bool enable_runtime_power_management; + /** Close pipe on power save */ + bool close_pipe_on_power_save; + /** Idle timeout for power save */ + k_timeout_t idle_timeout; }; /** diff --git a/subsys/modem/backends/modem_backend_uart_async.c b/subsys/modem/backends/modem_backend_uart_async.c index 1615120a4d5e..0cfcff9e86ed 100644 --- a/subsys/modem/backends/modem_backend_uart_async.c +++ b/subsys/modem/backends/modem_backend_uart_async.c @@ -11,6 +11,7 @@ LOG_MODULE_REGISTER(modem_backend_uart_async, CONFIG_MODEM_MODULES_LOG_LEVEL); #include +#include #include #include @@ -158,6 +159,11 @@ static int modem_backend_uart_async_open(void *data) atomic_clear(&backend->async.common.state); ring_buf_reset(&backend->async.receive_rb); + ret = pm_device_runtime_get(backend->uart); + if (ret < 0) { + LOG_ERR("Failed to power on UART: %d", ret); + return ret; + } if (backend->dtr_gpio) { gpio_pin_set_dt(backend->dtr_gpio, 1); } @@ -269,6 +275,7 @@ static int modem_backend_uart_async_receive(void *data, uint8_t *buf, size_t siz static int modem_backend_uart_async_close(void *data) { struct modem_backend_uart *backend = (struct modem_backend_uart *)data; + int ret; atomic_clear_bit(&backend->async.common.state, MODEM_BACKEND_UART_ASYNC_STATE_OPEN_BIT); uart_tx_abort(backend->uart); @@ -276,6 +283,12 @@ static int modem_backend_uart_async_close(void *data) if (backend->dtr_gpio) { gpio_pin_set_dt(backend->dtr_gpio, 0); } + ret = pm_device_runtime_put_async(backend->uart, K_NO_WAIT); + if (ret < 0) { + LOG_ERR("Failed to power off UART: %d", ret); + return ret; + } + modem_pipe_notify_closed(&backend->pipe); return 0; } diff --git a/subsys/modem/backends/modem_backend_uart_async_hwfc.c b/subsys/modem/backends/modem_backend_uart_async_hwfc.c index 3aaaad2e196c..df69c40b6679 100644 --- a/subsys/modem/backends/modem_backend_uart_async_hwfc.c +++ b/subsys/modem/backends/modem_backend_uart_async_hwfc.c @@ -11,6 +11,7 @@ LOG_MODULE_REGISTER(modem_backend_uart_async_hwfc, CONFIG_MODEM_MODULES_LOG_LEVEL); #include +#include #include #include @@ -222,6 +223,11 @@ static int modem_backend_uart_async_hwfc_open(void *data) return -ENOMEM; } + ret = pm_device_runtime_get(backend->uart); + if (ret < 0) { + LOG_ERR("Failed to power on UART: %d", ret); + return ret; + } if (backend->dtr_gpio) { gpio_pin_set_dt(backend->dtr_gpio, 1); } @@ -352,6 +358,7 @@ static int modem_backend_uart_async_hwfc_receive(void *data, uint8_t *buf, size_ static int modem_backend_uart_async_hwfc_close(void *data) { struct modem_backend_uart *backend = (struct modem_backend_uart *)data; + int ret; atomic_clear_bit(&backend->async.common.state, MODEM_BACKEND_UART_ASYNC_STATE_OPEN_BIT); uart_tx_abort(backend->uart); @@ -365,6 +372,13 @@ static int modem_backend_uart_async_hwfc_close(void *data) if (backend->dtr_gpio) { gpio_pin_set_dt(backend->dtr_gpio, 0); } + ret = pm_device_runtime_put_async(backend->uart, K_NO_WAIT); + if (ret < 0) { + LOG_ERR("Failed to power off UART: %d", ret); + return ret; + } + modem_pipe_notify_closed(&backend->pipe); + return 0; } diff --git a/subsys/modem/modem_cmux.c b/subsys/modem/modem_cmux.c index a491195b78e9..94c249aaa938 100644 --- a/subsys/modem/modem_cmux.c +++ b/subsys/modem/modem_cmux.c @@ -10,6 +10,8 @@ LOG_MODULE_REGISTER(modem_cmux, CONFIG_MODEM_CMUX_LOG_LEVEL); #include #include #include +#include +#include #include @@ -100,6 +102,7 @@ struct modem_cmux_msc_addr { static struct modem_cmux_dlci *modem_cmux_find_dlci(struct modem_cmux *cmux, uint8_t dlci_address); static void modem_cmux_dlci_notify_transmit_idle(struct modem_cmux *cmux); static void modem_cmux_tx_bypass(struct modem_cmux *cmux, const uint8_t *data, size_t len); +static void runtime_pm_keepalive(struct modem_cmux *cmux); static void set_state(struct modem_cmux *cmux, enum modem_cmux_state state) { @@ -497,10 +500,17 @@ static void modem_cmux_bus_callback(struct modem_pipe *pipe, enum modem_pipe_eve modem_work_schedule(&cmux->receive_work, K_NO_WAIT); break; + case MODEM_PIPE_EVENT_OPENED: + cmux->receive_state = MODEM_CMUX_RECEIVE_STATE_SOF; + modem_work_schedule(&cmux->transmit_work, K_NO_WAIT); + break; case MODEM_PIPE_EVENT_TRANSMIT_IDLE: + /* If we keep UART open in power-save, we should avoid waking up on RX idle */ + if (!cmux->close_pipe_on_power_save && is_powersaving(cmux)) { + break; + } modem_work_schedule(&cmux->transmit_work, K_NO_WAIT); break; - default: break; } @@ -885,6 +895,10 @@ static void modem_cmux_on_psc_response(struct modem_cmux *cmux) k_mutex_lock(&cmux->transmit_rb_lock, K_FOREVER); set_state(cmux, MODEM_CMUX_STATE_POWERSAVE); k_mutex_unlock(&cmux->transmit_rb_lock); + + if (cmux->close_pipe_on_power_save) { + modem_pipe_close_async(cmux->pipe); + } } static void modem_cmux_on_control_frame_uih(struct modem_cmux *cmux) @@ -1437,6 +1451,8 @@ static void modem_cmux_receive_handler(struct k_work *item) struct modem_cmux *cmux = CONTAINER_OF(dwork, struct modem_cmux, receive_work); int ret; + runtime_pm_keepalive(cmux); + /* Receive data from pipe */ while ((ret = modem_pipe_receive(cmux->pipe, cmux->work_buf, sizeof(cmux->work_buf))) > 0) { /* Process received data */ @@ -1462,6 +1478,46 @@ static void modem_cmux_dlci_notify_transmit_idle(struct modem_cmux *cmux) } } +static void modem_cmux_runtime_pm_handler(struct k_work *item) +{ + struct k_work_delayable *dwork = k_work_delayable_from_work(item); + struct modem_cmux *cmux = CONTAINER_OF(dwork, struct modem_cmux, runtime_pm_work); + + if (!cmux->enable_runtime_power_management) { + return; + } + + bool expired = sys_timepoint_expired(cmux->idle_timepoint); + + if (!expired) { + return; + } + + if (is_connected(cmux) && expired) { + LOG_DBG("Idle timeout, entering power saving mode"); + set_state(cmux, MODEM_CMUX_STATE_ENTER_POWERSAVE); + modem_cmux_send_psc(cmux); + k_work_reschedule(&cmux->runtime_pm_work, MODEM_CMUX_T3_TIMEOUT); + return; + } + if (cmux->state == MODEM_CMUX_STATE_ENTER_POWERSAVE) { + LOG_WRN("PSC timeout, not entering power saving mode"); + set_state(cmux, MODEM_CMUX_STATE_CONNECTED); + runtime_pm_keepalive(cmux); + return; + } +} + +static void runtime_pm_keepalive(struct modem_cmux *cmux) +{ + if (cmux == NULL || !cmux->enable_runtime_power_management) { + return; + } + + cmux->idle_timepoint = sys_timepoint_calc(cmux->idle_timeout); + k_work_reschedule(&cmux->runtime_pm_work, cmux->idle_timeout); +} + /** Transmit bytes bypassing the CMUX buffers. * Causes modem_cmux_transmit_handler() to be rescheduled as a result of TRANSMIT_IDLE event. */ @@ -1483,6 +1539,17 @@ static bool powersave_wait_wakeup(struct modem_cmux *cmux) if (is_powersaving(cmux)) { LOG_DBG("Power saving mode, wake up first"); set_state(cmux, MODEM_CMUX_STATE_WAKEUP); + + if (cmux->close_pipe_on_power_save) { + ret = modem_pipe_open(cmux->pipe, K_FOREVER); + if (ret < 0) { + LOG_ERR("Failed to open pipe for wake up (%d)", ret); + set_state(cmux, MODEM_CMUX_STATE_DISCONNECTED); + modem_cmux_raise_event(cmux, MODEM_CMUX_EVENT_DISCONNECTED); + return true; + } + } + cmux->t3_timepoint = sys_timepoint_calc(MODEM_CMUX_T3_TIMEOUT); modem_cmux_tx_bypass(cmux, wakeup_pattern, sizeof(wakeup_pattern)); return true; @@ -1522,18 +1589,22 @@ static void modem_cmux_transmit_handler(struct k_work *item) modem_cmux_advertise_transmit_buf_stats(cmux); #endif + if (!is_transitioning_to_powersave(cmux)) { + runtime_pm_keepalive(cmux); + } + while (true) { transmit_rb_empty = ring_buf_is_empty(&cmux->transmit_rb); - if (transmit_rb_empty) { - break; - } - if (powersave_wait_wakeup(cmux)) { k_mutex_unlock(&cmux->transmit_rb_lock); return; } + if (transmit_rb_empty) { + break; + } + reserved_size = ring_buf_get_claim(&cmux->transmit_rb, &reserved, UINT32_MAX); ret = modem_pipe_transmit(cmux->pipe, reserved, reserved_size); @@ -1558,6 +1629,9 @@ static void modem_cmux_transmit_handler(struct k_work *item) if (cmux->state == MODEM_CMUX_STATE_CONFIRM_POWERSAVE) { set_state(cmux, MODEM_CMUX_STATE_POWERSAVE); LOG_DBG("Entered power saving mode"); + if (cmux->close_pipe_on_power_save) { + modem_pipe_close_async(cmux->pipe); + } } modem_cmux_dlci_notify_transmit_idle(cmux); } @@ -1693,6 +1767,13 @@ static int modem_cmux_dlci_pipe_api_transmit(void *data, const uint8_t *buf, siz struct modem_cmux *cmux = dlci->cmux; int ret = 0; + if (size == 0 || buf == NULL) { + /* Allow empty transmit request to wake up CMUX */ + runtime_pm_keepalive(cmux); + k_work_reschedule(&cmux->transmit_work, K_NO_WAIT); + return 0; + } + if (dlci->flow_control) { return 0; } @@ -1859,6 +1940,10 @@ void modem_cmux_init(struct modem_cmux *cmux, const struct modem_cmux_config *co cmux->receive_buf = config->receive_buf; cmux->receive_buf_size = config->receive_buf_size; cmux->t3_timepoint = sys_timepoint_calc(K_NO_WAIT); + cmux->enable_runtime_power_management = config->enable_runtime_power_management; + cmux->close_pipe_on_power_save = config->close_pipe_on_power_save; + cmux->idle_timeout = + cmux->enable_runtime_power_management ? config->idle_timeout : K_FOREVER; sys_slist_init(&cmux->dlcis); ring_buf_init(&cmux->transmit_rb, config->transmit_buf_size, config->transmit_buf); k_mutex_init(&cmux->transmit_rb_lock); @@ -1866,6 +1951,7 @@ void modem_cmux_init(struct modem_cmux *cmux, const struct modem_cmux_config *co k_work_init_delayable(&cmux->transmit_work, modem_cmux_transmit_handler); k_work_init_delayable(&cmux->connect_work, modem_cmux_connect_handler); k_work_init_delayable(&cmux->disconnect_work, modem_cmux_disconnect_handler); + k_work_init_delayable(&cmux->runtime_pm_work, modem_cmux_runtime_pm_handler); k_event_init(&cmux->event); set_state(cmux, MODEM_CMUX_STATE_DISCONNECTED); From efdf6dced1a1310715c740e7268cf5408dd44740 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Thu, 9 Oct 2025 15:47:56 +0300 Subject: [PATCH 2032/2141] [nrf fromlist] drivers: modem: cellular: Use k_pipe instead of ringbuffer Ringbuffer is not safe in ISR but k_pipe without waiting is. So use pipe for events, so that possible GPIO callbacks from ISR content can post events. Upstream PR #: 97362 Signed-off-by: Seppo Takalo --- drivers/modem/modem_cellular.c | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index 5d381af2a821..f42622840a2d 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -166,8 +166,7 @@ struct modem_cellular_data { /* Event dispatcher */ struct k_work event_dispatch_work; uint8_t event_buf[8]; - struct ring_buf event_rb; - struct k_mutex event_rb_lock; + struct k_pipe event_pipe; struct k_mutex api_lock; struct modem_cellular_event_cb cb; @@ -711,26 +710,18 @@ static void modem_cellular_event_dispatch_handler(struct k_work *item) struct modem_cellular_data *data = CONTAINER_OF(item, struct modem_cellular_data, event_dispatch_work); - uint8_t events[sizeof(data->event_buf)]; - uint8_t events_cnt; + enum modem_cellular_event event; + const size_t len = sizeof(event); - k_mutex_lock(&data->event_rb_lock, K_FOREVER); - - events_cnt = (uint8_t)ring_buf_get(&data->event_rb, events, sizeof(data->event_buf)); - - k_mutex_unlock(&data->event_rb_lock); - - for (uint8_t i = 0; i < events_cnt; i++) { - modem_cellular_event_handler(data, (enum modem_cellular_event)events[i]); + while (k_pipe_read(&data->event_pipe, (uint8_t *)&event, len, K_NO_WAIT) == len) { + modem_cellular_event_handler(data, (enum modem_cellular_event)event); } } static void modem_cellular_delegate_event(struct modem_cellular_data *data, enum modem_cellular_event evt) { - k_mutex_lock(&data->event_rb_lock, K_FOREVER); - ring_buf_put(&data->event_rb, (uint8_t *)&evt, 1); - k_mutex_unlock(&data->event_rb_lock); + k_pipe_write(&data->event_pipe, (const uint8_t *)&evt, sizeof(evt), K_NO_WAIT); k_work_submit(&data->event_dispatch_work); } @@ -2108,7 +2099,7 @@ static int modem_cellular_init(const struct device *dev) k_mutex_init(&data->api_lock); k_work_init_delayable(&data->timeout_work, modem_cellular_timeout_handler); k_work_init(&data->event_dispatch_work, modem_cellular_event_dispatch_handler); - ring_buf_init(&data->event_rb, sizeof(data->event_buf), data->event_buf); + k_pipe_init(&data->event_pipe, data->event_buf, sizeof(data->event_buf)); k_sem_init(&data->suspended_sem, 0, 1); From e596d9dda22fbf95193402788a1e12c50c43696e Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Wed, 10 Sep 2025 16:17:12 +0300 Subject: [PATCH 2033/2141] [nrf fromlist] drivers: modem: Implement support for RING indicator Use ring indicator to wake up the CMUX device from sleep. Only used for runtime power management, but same event could be used for initiating idle -> connected as well. Upstream PR #: 97362 Signed-off-by: Seppo Takalo --- drivers/modem/modem_cellular.c | 59 ++++++++++++++++++- .../modem/zephyr,cellular-modem-device.yaml | 4 ++ 2 files changed, 60 insertions(+), 3 deletions(-) diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index f42622840a2d..dfa2c719a8af 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -96,6 +96,7 @@ enum modem_cellular_event { MODEM_CELLULAR_EVENT_PPP_DEAD, MODEM_CELLULAR_EVENT_MODEM_READY, MODEM_CELLULAR_EVENT_APN_SET, + MODEM_CELLULAR_EVENT_RING, }; struct modem_cellular_event_cb { @@ -170,6 +171,9 @@ struct modem_cellular_data { struct k_mutex api_lock; struct modem_cellular_event_cb cb; + + /* Ring interrupt */ + struct gpio_callback ring_gpio_cb; }; struct modem_cellular_user_pipe { @@ -186,6 +190,7 @@ struct modem_cellular_config { struct gpio_dt_spec power_gpio; struct gpio_dt_spec reset_gpio; struct gpio_dt_spec wake_gpio; + struct gpio_dt_spec ring_gpio; struct gpio_dt_spec dtr_gpio; uint16_t power_pulse_duration_ms; uint16_t reset_pulse_duration_ms; @@ -285,6 +290,8 @@ static const char *modem_cellular_event_str(enum modem_cellular_event event) return "modem ready"; case MODEM_CELLULAR_EVENT_APN_SET: return "apn set"; + case MODEM_CELLULAR_EVENT_RING: + return "RING"; } return ""; @@ -1242,7 +1249,10 @@ static void modem_cellular_run_dial_script_event_handler(struct modem_cellular_d case MODEM_CELLULAR_EVENT_SUSPEND: modem_cellular_enter_state(data, MODEM_CELLULAR_STATE_INIT_POWER_OFF); break; - + case MODEM_CELLULAR_EVENT_RING: + LOG_INF("RING received!"); + modem_pipe_open_async(data->uart_pipe); + break; default: break; } @@ -1287,7 +1297,10 @@ static void modem_cellular_await_registered_event_handler(struct modem_cellular_ case MODEM_CELLULAR_EVENT_SUSPEND: modem_cellular_enter_state(data, MODEM_CELLULAR_STATE_INIT_POWER_OFF); break; - + case MODEM_CELLULAR_EVENT_RING: + LOG_INF("RING received!"); + modem_pipe_open_async(data->uart_pipe); + break; default: break; } @@ -1332,7 +1345,10 @@ static void modem_cellular_carrier_on_event_handler(struct modem_cellular_data * modem_ppp_release(data->ppp); modem_cellular_enter_state(data, MODEM_CELLULAR_STATE_INIT_POWER_OFF); break; - + case MODEM_CELLULAR_EVENT_RING: + LOG_INF("RING received!"); + modem_pipe_open_async(data->uart_pipe); + break; default: break; } @@ -2069,6 +2085,15 @@ static void net_mgmt_event_handler(struct net_mgmt_event_callback *cb, uint64_t } } +static void modem_cellular_ring_gpio_callback(const struct device *dev, struct gpio_callback *cb, + uint32_t pins) +{ + struct modem_cellular_data *data = + CONTAINER_OF(cb, struct modem_cellular_data, ring_gpio_cb); + + modem_cellular_delegate_event(data, MODEM_CELLULAR_EVENT_RING); +} + static void modem_cellular_init_apn(struct modem_cellular_data *data) { #ifdef CONFIG_MODEM_CELLULAR_APN @@ -2115,6 +2140,33 @@ static int modem_cellular_init(const struct device *dev) gpio_pin_configure_dt(&config->reset_gpio, GPIO_OUTPUT_ACTIVE); } + if (modem_cellular_gpio_is_enabled(&config->ring_gpio)) { + int ret; + + ret = gpio_pin_configure_dt(&config->ring_gpio, GPIO_INPUT); + if (ret < 0) { + LOG_ERR("Failed to configure ring GPIO (%d)", ret); + return ret; + } + + gpio_init_callback(&data->ring_gpio_cb, modem_cellular_ring_gpio_callback, + BIT(config->ring_gpio.pin)); + + ret = gpio_add_callback(config->ring_gpio.port, &data->ring_gpio_cb); + if (ret < 0) { + LOG_ERR("Failed to add ring GPIO callback (%d)", ret); + return ret; + } + + ret = gpio_pin_interrupt_configure_dt(&config->ring_gpio, GPIO_INT_EDGE_TO_ACTIVE); + if (ret < 0) { + LOG_ERR("Failed to configure ring GPIO interrupt (%d)", ret); + return ret; + } + + LOG_DBG("Ring GPIO interrupt configured"); + } + if (modem_cellular_gpio_is_enabled(&config->dtr_gpio)) { gpio_pin_configure_dt(&config->dtr_gpio, GPIO_OUTPUT_INACTIVE); dtr_gpio = &config->dtr_gpio; @@ -2891,6 +2943,7 @@ MODEM_CHAT_SCRIPT_DEFINE(sqn_gm02s_periodic_chat_script, .power_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, mdm_power_gpios, {}), \ .reset_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, mdm_reset_gpios, {}), \ .wake_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, mdm_wake_gpios, {}), \ + .ring_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, mdm_ring_gpios, {}), \ .dtr_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, mdm_dtr_gpios, {}), \ .power_pulse_duration_ms = (power_ms), \ .reset_pulse_duration_ms = (reset_ms), \ diff --git a/dts/bindings/modem/zephyr,cellular-modem-device.yaml b/dts/bindings/modem/zephyr,cellular-modem-device.yaml index c2d2e9e00a88..d2ab0056841b 100644 --- a/dts/bindings/modem/zephyr,cellular-modem-device.yaml +++ b/dts/bindings/modem/zephyr,cellular-modem-device.yaml @@ -18,6 +18,10 @@ properties: type: phandle-array description: GPIO for modem wake + mdm-ring-gpios: + type: phandle-array + description: GPIO for modem ring indicator + mdm-dtr-gpios: type: phandle-array description: | From 752f9d63794801f2ea2e1bc1c2c4bf4e35c65e33 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Mon, 13 Oct 2025 12:00:33 +0300 Subject: [PATCH 2034/2141] [nrf fromlist] modem: pipe: Don't return EPERM on closed pipe When working on CMUX power saving, it is typical that we end up closing the pipe before the last RX_READY event is handled from workqueue, so we end up receiving -EPERM which is not really a fatal error. Pipes recover when they are re-opened. So drop this error and return zero instead, like modem_pipe_open() and close() does. Upstream PR #: 97362 Signed-off-by: Seppo Takalo --- subsys/modem/modem_pipe.c | 4 ++-- tests/subsys/modem/modem_pipe/src/main.c | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/subsys/modem/modem_pipe.c b/subsys/modem/modem_pipe.c index bf642b3984dc..ef66b9085ea6 100644 --- a/subsys/modem/modem_pipe.c +++ b/subsys/modem/modem_pipe.c @@ -136,7 +136,7 @@ void modem_pipe_attach(struct modem_pipe *pipe, modem_pipe_api_callback callback int modem_pipe_transmit(struct modem_pipe *pipe, const uint8_t *buf, size_t size) { if (!pipe_test_events(pipe, PIPE_EVENT_OPENED_BIT)) { - return -EPERM; + return 0; } pipe_clear_events(pipe, PIPE_EVENT_TRANSMIT_IDLE_BIT); @@ -146,7 +146,7 @@ int modem_pipe_transmit(struct modem_pipe *pipe, const uint8_t *buf, size_t size int modem_pipe_receive(struct modem_pipe *pipe, uint8_t *buf, size_t size) { if (!pipe_test_events(pipe, PIPE_EVENT_OPENED_BIT)) { - return -EPERM; + return 0; } pipe_clear_events(pipe, PIPE_EVENT_RECEIVE_READY_BIT); diff --git a/tests/subsys/modem/modem_pipe/src/main.c b/tests/subsys/modem/modem_pipe/src/main.c index 3cb330550fd5..7889d111d1b9 100644 --- a/tests/subsys/modem/modem_pipe/src/main.c +++ b/tests/subsys/modem/modem_pipe/src/main.c @@ -327,6 +327,14 @@ static void test_pipe_notify_receive_ready(void) "Unexpected state %u", (uint32_t)atomic_get(&test_state)); } +static void test_pipe_receive_closed(void) +{ + /* Try to receive from a closed pipe - should return 0 */ + zassert_equal(modem_pipe_receive(test_pipe, test_buffer, test_buffer_size), 0, + "Reading from closed pipe should return 0"); + zassert_false(test_backend.receive_called, "receive should not be called on closed pipe"); +} + ZTEST(modem_pipe, test_async_open_close) { test_pipe_open(); @@ -397,5 +405,16 @@ ZTEST(modem_pipe, test_attach) test_pipe_attach_receive_not_ready_transmit_idle(); } +ZTEST(modem_pipe, test_receive_closed) +{ + test_pipe_open(); + test_reset(); + test_pipe_async_transmit(); + test_reset(); + test_pipe_close(); + /* Test reading from a closed pipe should return 0 */ + test_pipe_receive_closed(); +} + ZTEST_SUITE(modem_pipe, NULL, modem_backend_fake_setup, modem_backend_fake_before, modem_backend_fake_after, NULL); From be7aff9d1610b623dca478e5cc7c84d860966daa Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Mon, 13 Oct 2025 11:36:49 +0300 Subject: [PATCH 2035/2141] [nrf fromlist] modem: cmux: Add struct cmux_config into struct cmux Instead of copying all fields from cmux_config into run-time struct cmux, just have the configuration structure as a member. Upstream PR #: 97362 Signed-off-by: Seppo Takalo --- include/zephyr/modem/cmux.h | 63 +++++++++++++++---------------------- subsys/modem/modem_cmux.c | 59 ++++++++++++++++------------------ 2 files changed, 52 insertions(+), 70 deletions(-) diff --git a/include/zephyr/modem/cmux.h b/include/zephyr/modem/cmux.h index 18bb6fff980d..0faa8d5d4b38 100644 --- a/include/zephyr/modem/cmux.h +++ b/include/zephyr/modem/cmux.h @@ -53,6 +53,30 @@ enum modem_cmux_event { typedef void (*modem_cmux_callback)(struct modem_cmux *cmux, enum modem_cmux_event event, void *user_data); +/** + * @brief Contains CMUX instance configuration data + */ +struct modem_cmux_config { + /** Invoked when event occurs */ + modem_cmux_callback callback; + /** Free to use pointer passed to event handler when invoked */ + void *user_data; + /** Receive buffer */ + uint8_t *receive_buf; + /** Size of receive buffer in bytes [127, ...] */ + uint16_t receive_buf_size; + /** Transmit buffer */ + uint8_t *transmit_buf; + /** Size of transmit buffer in bytes [149, ...] */ + uint16_t transmit_buf_size; + /** Enable runtime power management */ + bool enable_runtime_power_management; + /** Close pipe on power save */ + bool close_pipe_on_power_save; + /** Idle timeout for power save */ + k_timeout_t idle_timeout; +}; + /** * @cond INTERNAL_HIDDEN */ @@ -148,10 +172,6 @@ struct modem_cmux { /* Bus pipe */ struct modem_pipe *pipe; - /* Event handler */ - modem_cmux_callback callback; - void *user_data; - /* DLCI channel contexts */ sys_slist_t dlcis; @@ -159,12 +179,6 @@ struct modem_cmux { enum modem_cmux_state state; bool flow_control_on : 1; bool initiator : 1; - /** Enable runtime power management */ - bool enable_runtime_power_management; - /** Close pipe on power save */ - bool close_pipe_on_power_save; - /** Idle timeout for power save */ - k_timeout_t idle_timeout; /* Work lock */ bool attached : 1; @@ -172,10 +186,6 @@ struct modem_cmux { /* Receive state*/ enum modem_cmux_receive_state receive_state; - - /* Receive buffer */ - uint8_t *receive_buf; - uint16_t receive_buf_size; uint16_t receive_buf_len; uint8_t work_buf[MODEM_CMUX_WORK_BUFFER_SIZE]; @@ -206,36 +216,13 @@ struct modem_cmux { struct modem_stats_buffer receive_buf_stats; struct modem_stats_buffer transmit_buf_stats; #endif + struct modem_cmux_config config; }; /** * @endcond */ -/** - * @brief Contains CMUX instance configuration data - */ -struct modem_cmux_config { - /** Invoked when event occurs */ - modem_cmux_callback callback; - /** Free to use pointer passed to event handler when invoked */ - void *user_data; - /** Receive buffer */ - uint8_t *receive_buf; - /** Size of receive buffer in bytes [127, ...] */ - uint16_t receive_buf_size; - /** Transmit buffer */ - uint8_t *transmit_buf; - /** Size of transmit buffer in bytes [149, ...] */ - uint16_t transmit_buf_size; - /** Enable runtime power management */ - bool enable_runtime_power_management; - /** Close pipe on power save */ - bool close_pipe_on_power_save; - /** Idle timeout for power save */ - k_timeout_t idle_timeout; -}; - /** * @brief Initialize CMUX instance * @param cmux CMUX instance diff --git a/subsys/modem/modem_cmux.c b/subsys/modem/modem_cmux.c index 94c249aaa938..1edf3feaff41 100644 --- a/subsys/modem/modem_cmux.c +++ b/subsys/modem/modem_cmux.c @@ -400,7 +400,7 @@ static uint32_t modem_cmux_get_receive_buf_length(struct modem_cmux *cmux) static uint32_t modem_cmux_get_receive_buf_size(struct modem_cmux *cmux) { - return cmux->receive_buf_size; + return cmux->config.receive_buf_size; } static uint32_t modem_cmux_get_transmit_buf_length(struct modem_cmux *cmux) @@ -483,11 +483,11 @@ static void modem_cmux_log_received_command(const struct modem_cmux_command *com static void modem_cmux_raise_event(struct modem_cmux *cmux, enum modem_cmux_event event) { - if (cmux->callback == NULL) { + if (cmux->config.callback == NULL) { return; } - cmux->callback(cmux, event, cmux->user_data); + cmux->config.callback(cmux, event, cmux->config.user_data); } static void modem_cmux_bus_callback(struct modem_pipe *pipe, enum modem_pipe_event event, @@ -506,7 +506,7 @@ static void modem_cmux_bus_callback(struct modem_pipe *pipe, enum modem_pipe_eve break; case MODEM_PIPE_EVENT_TRANSMIT_IDLE: /* If we keep UART open in power-save, we should avoid waking up on RX idle */ - if (!cmux->close_pipe_on_power_save && is_powersaving(cmux)) { + if (!cmux->config.close_pipe_on_power_save && is_powersaving(cmux)) { break; } modem_work_schedule(&cmux->transmit_work, K_NO_WAIT); @@ -896,7 +896,7 @@ static void modem_cmux_on_psc_response(struct modem_cmux *cmux) set_state(cmux, MODEM_CMUX_STATE_POWERSAVE); k_mutex_unlock(&cmux->transmit_rb_lock); - if (cmux->close_pipe_on_power_save) { + if (cmux->config.close_pipe_on_power_save) { modem_pipe_close_async(cmux->pipe); } } @@ -1244,8 +1244,8 @@ static void modem_cmux_drop_frame(struct modem_cmux *cmux) #if defined(CONFIG_MODEM_CMUX_LOG_LEVEL_DBG) struct modem_cmux_frame *frame = &cmux->frame; - frame->data = cmux->receive_buf; - modem_cmux_log_frame(frame, "dropped", MIN(frame->data_len, cmux->receive_buf_size)); + frame->data = cmux->config.receive_buf; + modem_cmux_log_frame(frame, "dropped", MIN(frame->data_len, cmux->config.receive_buf_size)); #endif } @@ -1369,9 +1369,9 @@ static void modem_cmux_process_received_byte(struct modem_cmux *cmux, uint8_t by break; } - if (cmux->frame.data_len > cmux->receive_buf_size) { + if (cmux->frame.data_len > cmux->config.receive_buf_size) { LOG_ERR("Indicated frame data length %u exceeds receive buffer size %u", - cmux->frame.data_len, cmux->receive_buf_size); + cmux->frame.data_len, cmux->config.receive_buf_size); modem_cmux_drop_frame(cmux); break; @@ -1383,8 +1383,8 @@ static void modem_cmux_process_received_byte(struct modem_cmux *cmux, uint8_t by case MODEM_CMUX_RECEIVE_STATE_DATA: /* Copy byte to data */ - if (cmux->receive_buf_len < cmux->receive_buf_size) { - cmux->receive_buf[cmux->receive_buf_len] = byte; + if (cmux->receive_buf_len < cmux->config.receive_buf_size) { + cmux->config.receive_buf[cmux->receive_buf_len] = byte; } cmux->receive_buf_len++; @@ -1397,9 +1397,9 @@ static void modem_cmux_process_received_byte(struct modem_cmux *cmux, uint8_t by break; case MODEM_CMUX_RECEIVE_STATE_FCS: - if (cmux->receive_buf_len > cmux->receive_buf_size) { - LOG_WRN("Receive buffer overrun (%u > %u)", - cmux->receive_buf_len, cmux->receive_buf_size); + if (cmux->receive_buf_len > cmux->config.receive_buf_size) { + LOG_WRN("Receive buffer overrun (%u > %u)", cmux->receive_buf_len, + cmux->config.receive_buf_size); modem_cmux_drop_frame(cmux); break; } @@ -1433,7 +1433,7 @@ static void modem_cmux_process_received_byte(struct modem_cmux *cmux, uint8_t by } /* Process frame */ - cmux->frame.data = cmux->receive_buf; + cmux->frame.data = cmux->config.receive_buf; modem_cmux_on_frame(cmux); /* Await start of next frame */ @@ -1483,7 +1483,7 @@ static void modem_cmux_runtime_pm_handler(struct k_work *item) struct k_work_delayable *dwork = k_work_delayable_from_work(item); struct modem_cmux *cmux = CONTAINER_OF(dwork, struct modem_cmux, runtime_pm_work); - if (!cmux->enable_runtime_power_management) { + if (!cmux->config.enable_runtime_power_management) { return; } @@ -1510,12 +1510,12 @@ static void modem_cmux_runtime_pm_handler(struct k_work *item) static void runtime_pm_keepalive(struct modem_cmux *cmux) { - if (cmux == NULL || !cmux->enable_runtime_power_management) { + if (cmux == NULL || !cmux->config.enable_runtime_power_management) { return; } - cmux->idle_timepoint = sys_timepoint_calc(cmux->idle_timeout); - k_work_reschedule(&cmux->runtime_pm_work, cmux->idle_timeout); + cmux->idle_timepoint = sys_timepoint_calc(cmux->config.idle_timeout); + k_work_reschedule(&cmux->runtime_pm_work, cmux->config.idle_timeout); } /** Transmit bytes bypassing the CMUX buffers. @@ -1540,7 +1540,7 @@ static bool powersave_wait_wakeup(struct modem_cmux *cmux) LOG_DBG("Power saving mode, wake up first"); set_state(cmux, MODEM_CMUX_STATE_WAKEUP); - if (cmux->close_pipe_on_power_save) { + if (cmux->config.close_pipe_on_power_save) { ret = modem_pipe_open(cmux->pipe, K_FOREVER); if (ret < 0) { LOG_ERR("Failed to open pipe for wake up (%d)", ret); @@ -1629,7 +1629,7 @@ static void modem_cmux_transmit_handler(struct k_work *item) if (cmux->state == MODEM_CMUX_STATE_CONFIRM_POWERSAVE) { set_state(cmux, MODEM_CMUX_STATE_POWERSAVE); LOG_DBG("Entered power saving mode"); - if (cmux->close_pipe_on_power_save) { + if (cmux->config.close_pipe_on_power_save) { modem_pipe_close_async(cmux->pipe); } } @@ -1934,18 +1934,13 @@ void modem_cmux_init(struct modem_cmux *cmux, const struct modem_cmux_config *co __ASSERT_NO_MSG(config->transmit_buf != NULL); __ASSERT_NO_MSG(config->transmit_buf_size >= MODEM_CMUX_DATA_FRAME_SIZE_MAX); - memset(cmux, 0x00, sizeof(*cmux)); - cmux->callback = config->callback; - cmux->user_data = config->user_data; - cmux->receive_buf = config->receive_buf; - cmux->receive_buf_size = config->receive_buf_size; - cmux->t3_timepoint = sys_timepoint_calc(K_NO_WAIT); - cmux->enable_runtime_power_management = config->enable_runtime_power_management; - cmux->close_pipe_on_power_save = config->close_pipe_on_power_save; - cmux->idle_timeout = - cmux->enable_runtime_power_management ? config->idle_timeout : K_FOREVER; + *cmux = (struct modem_cmux){ + .t3_timepoint = sys_timepoint_calc(K_NO_WAIT), + .config = *config, + }; sys_slist_init(&cmux->dlcis); - ring_buf_init(&cmux->transmit_rb, config->transmit_buf_size, config->transmit_buf); + ring_buf_init(&cmux->transmit_rb, cmux->config.transmit_buf_size, + cmux->config.transmit_buf); k_mutex_init(&cmux->transmit_rb_lock); k_work_init_delayable(&cmux->receive_work, modem_cmux_receive_handler); k_work_init_delayable(&cmux->transmit_work, modem_cmux_transmit_handler); From 7183e43f754d482c3b80512f1331d494bc327346 Mon Sep 17 00:00:00 2001 From: David Jewsbury Date: Thu, 16 Oct 2025 10:18:49 +0100 Subject: [PATCH 2036/2141] [nrf fromtree] drivers: clock_control: Add macros for AUXPLL output frequencies These represent the outputted frequencies of the AUXPLL of different settings set in the device tree set using dt-bindings in nrf-auxpll.h. This is added to remove the need for 'magic numbers' in drivers and tests. Signed-off-by: David Jewsbury (cherry picked from commit 077021070c139838771067142a7752b5c95eaf2b) --- .../drivers/clock_control/nrf_clock_control.h | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/include/zephyr/drivers/clock_control/nrf_clock_control.h b/include/zephyr/drivers/clock_control/nrf_clock_control.h index 37fc4a1f1a85..7fa4530a6a04 100644 --- a/include/zephyr/drivers/clock_control/nrf_clock_control.h +++ b/include/zephyr/drivers/clock_control/nrf_clock_control.h @@ -188,6 +188,29 @@ uint32_t z_nrf_clock_bt_ctlr_hf_get_startup_time_us(void); /* Specifies that default precision of the clock is sufficient. */ #define NRF_CLOCK_CONTROL_PRECISION_DEFAULT 0 +/* AUXPLL devicetree takes in raw register values, these are the actual frequencies outputted */ +#define CLOCK_CONTROL_NRF_AUXPLL_FREQ_OUT_MIN_HZ 80000000 +#define CLOCK_CONTROL_NRF_AUXPLL_FREQ_OUT_AUDIO_44K1_HZ 11289591 +#define CLOCK_CONTROL_NRF_AUXPLL_FREQ_OUT_USB24M_HZ 24000000 +#define CLOCK_CONTROL_NRF_AUXPLL_FREQ_OUT_AUDIO_48K_HZ 12287963 + +/* Internal helper macro to map DT property value to output frequency */ +#define _CLOCK_CONTROL_NRF_AUXPLL_MAP_FREQ(freq_val) \ + ((freq_val) == NRF_AUXPLL_FREQ_DIV_MIN ? \ + CLOCK_CONTROL_NRF_AUXPLL_FREQ_OUT_MIN_HZ : \ + (freq_val) == NRF_AUXPLL_FREQ_DIV_AUDIO_44K1 ? \ + CLOCK_CONTROL_NRF_AUXPLL_FREQ_OUT_AUDIO_44K1_HZ : \ + (freq_val) == NRF_AUXPLL_FREQ_DIV_USB24M ? \ + CLOCK_CONTROL_NRF_AUXPLL_FREQ_OUT_USB24M_HZ : \ + (freq_val) == NRF_AUXPLL_FREQ_DIV_AUDIO_48K ? \ + CLOCK_CONTROL_NRF_AUXPLL_FREQ_OUT_AUDIO_48K_HZ : 0) + +/* Public macro to get output frequency of AUXPLL */ +#define CLOCK_CONTROL_NRF_AUXPLL_GET_FREQ(node) \ + COND_CODE_1(DT_NODE_HAS_PROP(node, nordic_frequency), \ + (_CLOCK_CONTROL_NRF_AUXPLL_MAP_FREQ(DT_PROP(node, nordic_frequency))), \ + (0)) + struct nrf_clock_spec { uint32_t frequency; uint16_t accuracy : 15; From 584f333e288983088663c61b2b2a2823fefface9 Mon Sep 17 00:00:00 2001 From: David Jewsbury Date: Thu, 16 Oct 2025 10:28:05 +0100 Subject: [PATCH 2037/2141] [nrf fromtree] drivers: audio: dmic_nrfx: Update AUXPLL control with frequency macros Frequencies being for AUXPLL were register assignments and not actual frequencies. Signed-off-by: David Jewsbury (cherry picked from commit eb605628ae0970b7aa80091954c8277794ba24b6) --- drivers/audio/dmic_nrfx_pdm.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/audio/dmic_nrfx_pdm.c b/drivers/audio/dmic_nrfx_pdm.c index c2c80a7414c1..a2d630f847a9 100644 --- a/drivers/audio/dmic_nrfx_pdm.c +++ b/drivers/audio/dmic_nrfx_pdm.c @@ -24,11 +24,15 @@ LOG_MODULE_REGISTER(dmic_nrfx_pdm, CONFIG_AUDIO_DMIC_LOG_LEVEL); #define DMIC_NRFX_CLOCK_FACTOR 8192 #define DMIC_NRFX_AUDIO_CLOCK_FREQ DT_PROP_OR(NODE_AUDIOPLL, frequency, 0) #elif DT_NODE_HAS_STATUS_OKAY(NODE_AUDIO_AUXPLL) -#define DMIC_NRFX_AUDIO_CLOCK_FREQ DT_PROP(NODE_AUDIO_AUXPLL, nordic_frequency) -BUILD_ASSERT((DMIC_NRFX_AUDIO_CLOCK_FREQ == NRF_AUXPLL_FREQ_DIV_AUDIO_48K) || - (DMIC_NRFX_AUDIO_CLOCK_FREQ == NRF_AUXPLL_FREQ_DIV_AUDIO_44K1), +#define AUXPLL_FREQUENCY_SETTING DT_PROP(NODE_AUDIO_AUXPLL, nordic_frequency) +BUILD_ASSERT((AUXPLL_FREQUENCY_SETTING == NRF_AUXPLL_FREQ_DIV_AUDIO_48K) || + (AUXPLL_FREQUENCY_SETTING == NRF_AUXPLL_FREQ_DIV_AUDIO_44K1), "Unsupported Audio AUXPLL frequency selection for PDM"); + +#define DMIC_NRFX_AUDIO_CLOCK_FREQ CLOCK_CONTROL_NRF_AUXPLL_GET_FREQ(NODE_AUDIO_AUXPLL) + #define DMIC_NRFX_CLOCK_FREQ MHZ(32) + #else #define DMIC_NRFX_CLOCK_FREQ MHZ(32) #define DMIC_NRFX_CLOCK_FACTOR 4096 From 797aa72a5475812b6854a474cc11737eaf3682a4 Mon Sep 17 00:00:00 2001 From: David Jewsbury Date: Thu, 16 Oct 2025 10:29:29 +0100 Subject: [PATCH 2038/2141] [nrf fromtree] tests: drivers: Update AUXPLL test to use frequency Macros Eliminate the need for magic numbers when setting AUXPLL_FREQ_OUT Signed-off-by: David Jewsbury (cherry picked from commit 9a3a954b3497303f0942650d7c65d7c7f7390bf4) --- .../clock_control/nrf_clock_control/src/main.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/tests/drivers/clock_control/nrf_clock_control/src/main.c b/tests/drivers/clock_control/nrf_clock_control/src/main.c index 83fdc98ca193..3612373a867d 100644 --- a/tests/drivers/clock_control/nrf_clock_control/src/main.c +++ b/tests/drivers/clock_control/nrf_clock_control/src/main.c @@ -162,17 +162,10 @@ static const struct test_clk_context lfclk_test_clk_contexts[] = { #define AUXPLL_NODE DT_INST(0, AUXPLL_COMPAT) #define AUXPLL_FREQ DT_PROP(AUXPLL_NODE, nordic_frequency) -/* Gets selected AUXPLL DIV and selects the expected frequency */ -#if AUXPLL_FREQ == NRF_AUXPLL_FREQUENCY_DIV_MIN -#define AUXPLL_FREQ_OUT 80000000 -#elif AUXPLL_FREQ == NRF_AUXPLL_FREQ_DIV_AUDIO_44K1 -#define AUXPLL_FREQ_OUT 11289591 -#elif AUXPLL_FREQ == NRF_AUXPLL_FREQ_DIV_USB_24M -#define AUXPLL_FREQ_OUT 24000000 -#elif AUXPLL_FREQ == NRF_AUXPLL_FREQ_DIV_AUDIO_48K -#define AUXPLL_FREQ_OUT 12287963 -#else -/*No use case for NRF_AUXPLL_FREQ_DIV_MAX or others yet*/ + +/* Gets expected AUXPLL frequency */ +#define AUXPLL_FREQ_OUT CLOCK_CONTROL_NRF_AUXPLL_GET_FREQ(AUXPLL_NODE) +#if AUXPLL_FREQ_OUT == 0 #error "Unsupported AUXPLL frequency selection" #endif From 38a8daf69b6eb31669c1c61faccee6b88e8c713a Mon Sep 17 00:00:00 2001 From: Erdem Simsek Date: Thu, 16 Oct 2025 09:16:16 +0100 Subject: [PATCH 2039/2141] [nrf fromtree] drivers: i2s: Support audio auxpll in TDM driver Add support for audio_auxpll clock source as an alternative to audiopll in the i2s_nrf_tdm driver. This enables TDM functionality on platforms that use the auxiliary PLL for audio clocking. - Add audio_auxpll node detection and configuration - Update clock management to support both audiopll and audio_auxpll - Add build assertions for supported frequency configurations Signed-off-by: Erdem Simsek (cherry picked from commit 8338097b1d5008ec88982c42a7bd53223042b5eb) --- drivers/i2s/i2s_nrf_tdm.c | 48 +++++++++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 15 deletions(-) diff --git a/drivers/i2s/i2s_nrf_tdm.c b/drivers/i2s/i2s_nrf_tdm.c index fc823ce5055a..07c561b77503 100644 --- a/drivers/i2s/i2s_nrf_tdm.c +++ b/drivers/i2s/i2s_nrf_tdm.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -47,11 +48,13 @@ LOG_MODULE_REGISTER(tdm_nrf, CONFIG_I2S_LOG_LEVEL); #if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(audiopll)) #define NODE_ACLK DT_NODELABEL(audiopll) #define ACLK_FREQUENCY DT_PROP_OR(NODE_ACLK, frequency, 0) - -static const struct device *audiopll = DEVICE_DT_GET(NODE_ACLK); -static const struct nrf_clock_spec aclk_spec = { - .frequency = ACLK_FREQUENCY, -}; +#elif DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(audio_auxpll)) +#define NODE_AUDIO_AUXPLL DT_NODELABEL(audio_auxpll) +#define ACLK_NORDIC_FREQUENCY DT_PROP(NODE_AUDIO_AUXPLL, nordic_frequency) +BUILD_ASSERT((ACLK_NORDIC_FREQUENCY == NRF_AUXPLL_FREQ_DIV_AUDIO_48K) || + (ACLK_NORDIC_FREQUENCY == NRF_AUXPLL_FREQ_DIV_AUDIO_44K1), + "Unsupported Audio AUXPLL frequency selection for TDM"); +#define ACLK_FREQUENCY CLOCK_CONTROL_NRF_AUXPLL_GET_FREQ(NODE_AUDIO_AUXPLL) #elif DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(aclk)) #define NODE_ACLK DT_NODELABEL(aclk) #define ACLK_FREQUENCY DT_PROP_OR(NODE_ACLK, clock_frequency, 0) @@ -107,7 +110,10 @@ struct tdm_drv_cfg { }; struct tdm_drv_data { -#if CONFIG_CLOCK_CONTROL_NRF +#if CONFIG_CLOCK_CONTROL_NRFS_AUDIOPLL || DT_NODE_HAS_STATUS_OKAY(NODE_AUDIO_AUXPLL) + const struct device *audiopll; + struct nrf_clock_spec aclk_spec; +#elif CONFIG_CLOCK_CONTROL_NRF struct onoff_manager *clk_mgr; #endif struct onoff_client clk_cli; @@ -132,8 +138,10 @@ static int audio_clock_request(struct tdm_drv_data *drv_data) { #if DT_NODE_HAS_STATUS_OKAY(NODE_ACLK) && CONFIG_CLOCK_CONTROL_NRF return onoff_request(drv_data->clk_mgr, &drv_data->clk_cli); -#elif DT_NODE_HAS_STATUS_OKAY(NODE_ACLK) && CONFIG_CLOCK_CONTROL_NRFS_AUDIOPLL - return nrf_clock_control_request(audiopll, &aclk_spec, &drv_data->clk_cli); +#elif (DT_NODE_HAS_STATUS_OKAY(NODE_ACLK) && CONFIG_CLOCK_CONTROL_NRFS_AUDIOPLL) || \ + DT_NODE_HAS_STATUS_OKAY(NODE_AUDIO_AUXPLL) + return nrf_clock_control_request(drv_data->audiopll, &drv_data->aclk_spec, + &drv_data->clk_cli); #else (void)drv_data; @@ -145,10 +153,9 @@ static int audio_clock_release(struct tdm_drv_data *drv_data) { #if DT_NODE_HAS_STATUS_OKAY(NODE_ACLK) && CONFIG_CLOCK_CONTROL_NRF return onoff_release(drv_data->clk_mgr); -#elif DT_NODE_HAS_STATUS_OKAY(NODE_ACLK) && CONFIG_CLOCK_CONTROL_NRFS_AUDIOPLL - (void)drv_data; - - return nrf_clock_control_release(audiopll, &aclk_spec); +#elif (DT_NODE_HAS_STATUS_OKAY(NODE_ACLK) && CONFIG_CLOCK_CONTROL_NRFS_AUDIOPLL) || \ + DT_NODE_HAS_STATUS_OKAY(NODE_AUDIO_AUXPLL) + return nrf_clock_control_release(drv_data->audiopll, &drv_data->aclk_spec); #else (void)drv_data; @@ -1120,6 +1127,16 @@ static void clock_manager_init(const struct device *dev) subsys = CLOCK_CONTROL_NRF_SUBSYS_HFAUDIO; drv_data->clk_mgr = z_nrf_clock_control_get_onoff(subsys); __ASSERT_NO_MSG(drv_data->clk_mgr != NULL); +#elif DT_NODE_HAS_STATUS_OKAY(NODE_ACLK) && CONFIG_CLOCK_CONTROL_NRFS_AUDIOPLL + struct tdm_drv_data *drv_data = dev->data; + + drv_data->audiopll = DEVICE_DT_GET(NODE_ACLK); + drv_data->aclk_spec.frequency = ACLK_FREQUENCY; +#elif DT_NODE_HAS_STATUS_OKAY(NODE_AUDIO_AUXPLL) + struct tdm_drv_data *drv_data = dev->data; + + drv_data->audiopll = DEVICE_DT_GET(NODE_AUDIO_AUXPLL); + drv_data->aclk_spec.frequency = ACLK_FREQUENCY; #else (void)dev; #endif @@ -1194,9 +1211,10 @@ static DEVICE_API(i2s, tdm_nrf_drv_api) = { clock_manager_init(dev); \ return 0; \ } \ - BUILD_ASSERT((TDM_SCK_CLK_SRC(idx) != ACLK && TDM_MCK_CLK_SRC(idx) != ACLK) || \ - DT_NODE_HAS_STATUS_OKAY(NODE_ACLK), \ - "Clock source ACLK requires the audiopll node."); \ + BUILD_ASSERT((TDM_SCK_CLK_SRC(idx) != ACLK && TDM_MCK_CLK_SRC(idx) != ACLK) || \ + (DT_NODE_HAS_STATUS_OKAY(NODE_ACLK) || \ + DT_NODE_HAS_STATUS_OKAY(NODE_AUDIO_AUXPLL)), \ + "Clock source ACLK requires the audiopll/audio_auxpll node."); \ NRF_DT_CHECK_NODE_HAS_REQUIRED_MEMORY_REGIONS(TDM(idx)); \ DEVICE_DT_DEFINE(TDM(idx), tdm_nrf_init##idx, NULL, &tdm_nrf_data##idx, &tdm_nrf_cfg##idx, \ POST_KERNEL, CONFIG_I2S_INIT_PRIORITY, &tdm_nrf_drv_api); From cfe28be2535e685c7af69eb83cbfb13c199c1da0 Mon Sep 17 00:00:00 2001 From: Erdem Simsek Date: Mon, 20 Oct 2025 17:41:28 +0100 Subject: [PATCH 2040/2141] [nrf fromtree] tests: drivers: Trigger drop event for proper clean-up Add I2S_TRIGGER_DROP call in the error test to ensure proper cleanup after stopping the I2S device. This validates that the drop trigger is properly handled in error conditions and resources are released. Signed-off-by: Erdem Simsek (cherry picked from commit aec9da060b93d8c9e039233cc75d695d0eb8d007) --- tests/drivers/i2s/i2s_api/src/test_i2s_errors.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/drivers/i2s/i2s_api/src/test_i2s_errors.c b/tests/drivers/i2s/i2s_api/src/test_i2s_errors.c index 477292d84c26..230a71e95d4d 100644 --- a/tests/drivers/i2s/i2s_api/src/test_i2s_errors.c +++ b/tests/drivers/i2s/i2s_api/src/test_i2s_errors.c @@ -76,6 +76,9 @@ ZTEST_USER(i2s_errors, test_i2s_config_attempt_in_wrong_state) err = i2s_trigger(dev_i2s, I2S_DIR_TX, I2S_TRIGGER_STOP); zassert_equal(err, 0, "I2S_TRIGGER_STOP unexpected error: %d", err); + err = i2s_trigger(dev_i2s, I2S_DIR_TX, I2S_TRIGGER_DROP); + zassert_equal(err, 0, "I2S_TRIGGER_DROP unexpected error: %d", err); + zassert_not_equal( config_err, 0, "I2S configuration should not be possible in states other than I2S_STATE_READY"); From ffbae7abfd7bfc86f1f5eb10773a6fe234e29c15 Mon Sep 17 00:00:00 2001 From: Phuc Pham Date: Mon, 25 Aug 2025 17:57:15 +0700 Subject: [PATCH 2041/2141] [nrf fromtree] manifest: Update commit id for hal_renesas Update commit id for hal_renesas Signed-off-by: Phuc Pham Signed-off-by: Tien Nguyen (cherry picked from commit 62116a7e7435c070000f28a7392bc60519e7d66a) --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index d3df0b617955..a861e7b82842 100644 --- a/west.yml +++ b/west.yml @@ -226,7 +226,7 @@ manifest: - hal - name: hal_renesas path: modules/hal/renesas - revision: 74c9186c0a01c53e320421bd0e8b85fc266f3260 + revision: 6ff5c0662bc9ad4a126be28eab0addcb2454fe69 groups: - hal - name: hal_rpi_pico From 14c7066050b8daea6b15ff320bd344a745f80021 Mon Sep 17 00:00:00 2001 From: Khoa Tran Date: Wed, 5 Mar 2025 12:35:06 +0700 Subject: [PATCH 2042/2141] [nrf fromtree] manifest: Update revision of hal_renesas Update revision of hal_renesas to get the FSP 6.1.0 migration Signed-off-by: Khoa Tran (cherry picked from commit 620738016e268b895ed3a9a04c0726aa7b0ec16f) --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index a861e7b82842..4f7e87c0f9ce 100644 --- a/west.yml +++ b/west.yml @@ -226,7 +226,7 @@ manifest: - hal - name: hal_renesas path: modules/hal/renesas - revision: 6ff5c0662bc9ad4a126be28eab0addcb2454fe69 + revision: f0b78440ba8f0b4a07cdd657031ac9ec1cc4c126 groups: - hal - name: hal_rpi_pico From 51e388f3cccc82cb0026a22d5e9cee80da700179 Mon Sep 17 00:00:00 2001 From: Khoa Tran Date: Wed, 5 Mar 2025 12:35:06 +0700 Subject: [PATCH 2043/2141] [nrf fromtree] manifest: update revision of hal_renesas to latest Update revision of hal_renesas to get RA8T2 support Signed-off-by: Khoa Tran (cherry picked from commit ac941a398617ba4f031f5f19803fa689686bc78a) --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 4f7e87c0f9ce..044a972c6cca 100644 --- a/west.yml +++ b/west.yml @@ -226,7 +226,7 @@ manifest: - hal - name: hal_renesas path: modules/hal/renesas - revision: f0b78440ba8f0b4a07cdd657031ac9ec1cc4c126 + revision: d8ee5f18e95b9f4616a481be65e2c9ee0af1779f groups: - hal - name: hal_rpi_pico From 22d82f42d2fcfe140e4bc3a605a651585a2c1d1e Mon Sep 17 00:00:00 2001 From: Robert Robinson Date: Mon, 3 Nov 2025 13:02:39 +0000 Subject: [PATCH 2044/2141] Revert "[nrf fromtree] manifest: nrf_wifi: Pull nRF71 support" This reverts commit cdfeb62ee70a401c160fe4951fc9391bbc51be52. Signed-off-by: Robert Robinson --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 044a972c6cca..9416dc48ae0d 100644 --- a/west.yml +++ b/west.yml @@ -337,7 +337,7 @@ manifest: revision: 40403f5f2805cca210d2a47c8717d89c4e816cda path: modules/bsim_hw_models/nrf_hw_models - name: nrf_wifi - revision: e269670cd17fb8ccc4b7004544276bc7d9578496 + revision: b822726084f55df19aa6660dc46cf602757e8645 path: modules/lib/nrf_wifi - name: open-amp revision: c30a6d8b92fcebdb797fc1a7698e8729e250f637 From f987ea0e382278ca91e116dca9b6d95dc481d48d Mon Sep 17 00:00:00 2001 From: Robert Robinson Date: Mon, 3 Nov 2025 13:02:55 +0000 Subject: [PATCH 2045/2141] Revert "[nrf noup] manifest: nrf_wifi: Pull script to parse nRF70 FW stats blob" This reverts commit 9fde3d0f401c89dad1dea65e54afae30f91679be. Signed-off-by: Robert Robinson --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 9416dc48ae0d..19c87b1b4e77 100644 --- a/west.yml +++ b/west.yml @@ -337,7 +337,7 @@ manifest: revision: 40403f5f2805cca210d2a47c8717d89c4e816cda path: modules/bsim_hw_models/nrf_hw_models - name: nrf_wifi - revision: b822726084f55df19aa6660dc46cf602757e8645 + revision: acb24fe26f479df9dba3c4bd97ea653ad3086ee7 path: modules/lib/nrf_wifi - name: open-amp revision: c30a6d8b92fcebdb797fc1a7698e8729e250f637 From 5916aa8286a9f7f57caeec46dded9be72b6026a2 Mon Sep 17 00:00:00 2001 From: Fabio Baltieri Date: Wed, 24 Sep 2025 14:24:05 +0000 Subject: [PATCH 2046/2141] [nrf fromtree] west.yml: update few modules to pickup min/max define guards Update the few modules to pick up some redefinition fixes. Signed-off-by: Fabio Baltieri (cherry picked from commit 056f3b07cedf547707878067f19edb5c04e4b7f1) --- west.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/west.yml b/west.yml index 19c87b1b4e77..e507c2f15991 100644 --- a/west.yml +++ b/west.yml @@ -200,7 +200,7 @@ manifest: groups: - hal - name: hal_nordic - revision: 979a58d0829108b57f10e90b6c3fc35ab6206e4b + revision: 2c0fd06a98bb9b89ac234b75b2c217742f0df1ba path: modules/hal/nordic groups: - hal @@ -226,7 +226,7 @@ manifest: - hal - name: hal_renesas path: modules/hal/renesas - revision: d8ee5f18e95b9f4616a481be65e2c9ee0af1779f + revision: 740a944351300664ea17fb7913f0036a5263f008 groups: - hal - name: hal_rpi_pico @@ -337,7 +337,7 @@ manifest: revision: 40403f5f2805cca210d2a47c8717d89c4e816cda path: modules/bsim_hw_models/nrf_hw_models - name: nrf_wifi - revision: acb24fe26f479df9dba3c4bd97ea653ad3086ee7 + revision: 53500666a59195b44e2e5a939c111effbf23db7b path: modules/lib/nrf_wifi - name: open-amp revision: c30a6d8b92fcebdb797fc1a7698e8729e250f637 From 6718c55075bf9cb580c1288f8c398c22605b5ae8 Mon Sep 17 00:00:00 2001 From: Robert Robinson Date: Wed, 29 Oct 2025 12:01:28 +0000 Subject: [PATCH 2047/2141] [nrf fromtree] manifest: Update hal_nordic to pull file missing in mdk 8.72.4 release Update hal_nordic to pull file missing change from mdk 8.72.4 release Signed-off-by: Robert Robinson (cherry picked from commit 84dfdedc87df84caf1705d4aa1c13209b7016d9a) --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index e507c2f15991..f08cf11203a6 100644 --- a/west.yml +++ b/west.yml @@ -200,7 +200,7 @@ manifest: groups: - hal - name: hal_nordic - revision: 2c0fd06a98bb9b89ac234b75b2c217742f0df1ba + revision: 7858281d843468fe53c829995fb63f45a227387a path: modules/hal/nordic groups: - hal From 23ee39f92a3acdac07b99e41cb43771330892a89 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Tue, 30 Sep 2025 11:33:35 +0530 Subject: [PATCH 2048/2141] [nrf noup] manifest: nrf_wifi: Pull script to parse nRF70 FW stats blob A helper script is added to the nrf_wifi repo for parsing and dumping nRF70 FW stats blob. Note: "noup" to avoid churn by pulling min/max PR. Signed-off-by: Chaitanya Tata (cherry picked from commit b71d290405f2f591e77ec264d8b8c6c8b12e6d3e) (cherry picked from commit 9fde3d0f401c89dad1dea65e54afae30f91679be) --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index f08cf11203a6..01532b68b61a 100644 --- a/west.yml +++ b/west.yml @@ -337,7 +337,7 @@ manifest: revision: 40403f5f2805cca210d2a47c8717d89c4e816cda path: modules/bsim_hw_models/nrf_hw_models - name: nrf_wifi - revision: 53500666a59195b44e2e5a939c111effbf23db7b + revision: b822726084f55df19aa6660dc46cf602757e8645 path: modules/lib/nrf_wifi - name: open-amp revision: c30a6d8b92fcebdb797fc1a7698e8729e250f637 From cefb2ed86ac723218c509ef7ceae2509bb1f89f6 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Tue, 30 Sep 2025 20:56:48 +0530 Subject: [PATCH 2049/2141] [nrf fromtree] manifest: nrf_wifi: Pull nRF71 support Pull nRF71 OSAL support, full support is till TBD. Signed-off-by: Chaitanya Tata (cherry picked from commit 9f8bb3cda365a061d8713a8533d37e6db29f9522) (cherry picked from commit cdfeb62ee70a401c160fe4951fc9391bbc51be52) --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 01532b68b61a..1bff38e1c7b8 100644 --- a/west.yml +++ b/west.yml @@ -337,7 +337,7 @@ manifest: revision: 40403f5f2805cca210d2a47c8717d89c4e816cda path: modules/bsim_hw_models/nrf_hw_models - name: nrf_wifi - revision: b822726084f55df19aa6660dc46cf602757e8645 + revision: e269670cd17fb8ccc4b7004544276bc7d9578496 path: modules/lib/nrf_wifi - name: open-amp revision: c30a6d8b92fcebdb797fc1a7698e8729e250f637 From 25f7b905665e488a00e66ed1335f1b46d87b53ef Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Tue, 4 Nov 2025 12:27:59 +0100 Subject: [PATCH 2050/2141] [nrf fromlist] Bluetooth: Controller: Add BT_HCI_VS_FATAL_ERROR_SUPPORT Add BT_HCI_VS_FATAL_ERROR_SUPPORT Kconfig to allow out-of-tree Controllers to control Zephyr HCI Vendor- Specific Fatal Error event support. Upstream PR #: 98840 Signed-off-by: Vinayak Kariappa Chettimada --- subsys/bluetooth/common/Kconfig | 5 ++++- subsys/bluetooth/controller/Kconfig.ll_sw_split | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/subsys/bluetooth/common/Kconfig b/subsys/bluetooth/common/Kconfig index f4fb9ab9bc75..ae95785f8ab3 100644 --- a/subsys/bluetooth/common/Kconfig +++ b/subsys/bluetooth/common/Kconfig @@ -230,9 +230,12 @@ config BT_HCI_VS Host and/or Controller. This enables Set Version Information, Supported Commands, Supported Features vendor commands. +config BT_HCI_VS_FATAL_ERROR_SUPPORT + bool + config BT_HCI_VS_FATAL_ERROR bool "Allow vendor specific HCI event Zephyr Fatal Error" - depends on BT_HCI_VS + depends on BT_HCI_VS && BT_HCI_VS_FATAL_ERROR_SUPPORT help Enable emitting HCI Vendor-Specific events for system and Controller errors that are unrecoverable. diff --git a/subsys/bluetooth/controller/Kconfig.ll_sw_split b/subsys/bluetooth/controller/Kconfig.ll_sw_split index b6774d63c7c6..744727eb11f3 100644 --- a/subsys/bluetooth/controller/Kconfig.ll_sw_split +++ b/subsys/bluetooth/controller/Kconfig.ll_sw_split @@ -17,6 +17,7 @@ config BT_LLL_VENDOR_NORDIC select EXPERIMENTAL if !ENTROPY_HAS_DRIVER select BT_HAS_HCI_VS + select BT_HCI_VS_FATAL_ERROR_SUPPORT select BT_CTLR_CRYPTO_SUPPORT select BT_CTLR_LE_ENC_SUPPORT if BT_CTLR_CRYPTO_SUPPORT && \ !BT_CTLR_DATA_LENGTH_CLEAR && \ From 795bac46e28a8a099dafb6651bed336f3e6706c9 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Fri, 19 Sep 2025 16:57:35 +0200 Subject: [PATCH 2051/2141] [nrf fromtree] pm: bind the PM_S2RAM kconfig option to devicetree Currently it is possible to have an enabled (status="okay") "suspend-to-ram" "zephyr,power-state" in the devicetree, CONFIG_PM=y, but CONFIG_PM_S2RAM=n This means the presence and state of the "suspend-to-ram" power state in the devicetree does not match the PM_S2RAM option, despite PM_S2RAM being dependent on the devicetree state. This commit makes the devicetree the "source of truth" for whether one or more s2ram power states shall be included and supported, by enabling PM_S2RAM if any s2ram power state with status "okay" is present in the devicetree. To disable the s2ram power state, like with any other state, disable it by setting its state to "disabled". The help of the now promptless PM_S2RAM config has been updated to reflect the new meaning. It previously held cortex-m specific implementation details, these have been removed as these details are already present in the file pointed to as well (arch/arm/core/cortex_m/pm_s2ram.c line 22) Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit 4626f6b776f662702934ac85929edc35dce832b1) --- samples/boards/nordic/spis_wakeup/prj.conf | 1 - .../nordic/spis_wakeup/wakeup_trigger/prj.conf | 1 - .../boards/st/power_mgmt/suspend_to_ram/prj.conf | 1 - subsys/pm/Kconfig | 13 ++++++++----- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/samples/boards/nordic/spis_wakeup/prj.conf b/samples/boards/nordic/spis_wakeup/prj.conf index ca92fc6de6ae..c1cc933296f0 100644 --- a/samples/boards/nordic/spis_wakeup/prj.conf +++ b/samples/boards/nordic/spis_wakeup/prj.conf @@ -3,7 +3,6 @@ CONFIG_SPI_SLAVE=y CONFIG_GPIO=y CONFIG_PM=y -CONFIG_PM_S2RAM=y CONFIG_PM_S2RAM_CUSTOM_MARKING=y CONFIG_PM_DEVICE=y CONFIG_PM_DEVICE_RUNTIME=y diff --git a/samples/boards/nordic/spis_wakeup/wakeup_trigger/prj.conf b/samples/boards/nordic/spis_wakeup/wakeup_trigger/prj.conf index 1de6459a6083..9c30d5a98fd7 100644 --- a/samples/boards/nordic/spis_wakeup/wakeup_trigger/prj.conf +++ b/samples/boards/nordic/spis_wakeup/wakeup_trigger/prj.conf @@ -3,7 +3,6 @@ CONFIG_SPI_NRFX_WAKE_TIMEOUT_US=500 CONFIG_GPIO=y CONFIG_PM=y -CONFIG_PM_S2RAM=y CONFIG_PM_S2RAM_CUSTOM_MARKING=y CONFIG_PM_DEVICE=y CONFIG_PM_DEVICE_RUNTIME=y diff --git a/samples/boards/st/power_mgmt/suspend_to_ram/prj.conf b/samples/boards/st/power_mgmt/suspend_to_ram/prj.conf index b9a1cf9305e4..1f23c5a27e2c 100644 --- a/samples/boards/st/power_mgmt/suspend_to_ram/prj.conf +++ b/samples/boards/st/power_mgmt/suspend_to_ram/prj.conf @@ -2,7 +2,6 @@ CONFIG_PM=y CONFIG_PM_DEVICE=y CONFIG_PM_DEVICE_RUNTIME=y CONFIG_PM_DEVICE_SYSTEM_MANAGED=y -CONFIG_PM_S2RAM=y CONFIG_ADC=y CONFIG_ENTROPY_GENERATOR=y CONFIG_SPI=y diff --git a/subsys/pm/Kconfig b/subsys/pm/Kconfig index d1d99ac02e3a..abd424a88009 100644 --- a/subsys/pm/Kconfig +++ b/subsys/pm/Kconfig @@ -33,14 +33,17 @@ config PM_STATS help Enable System Power Management Stats. +DT_POWER_STATE_COMPAT := zephyr,power-state + config PM_S2RAM - bool "Suspend-to-RAM (S2RAM)" + bool + default y depends on ARCH_HAS_SUSPEND_TO_RAM + depends on $(dt_compat_any_has_prop,$(DT_POWER_STATE_COMPAT),power-state-name,suspend-to-ram) help - This option enables suspend-to-RAM (S2RAM). - When enabled on Cortex-M, and a 'zephyr,memory-region' compatible node with nodelabel - 'pm_s2ram' is defined in DT, _cpu_context symbol (located in arch/arm/core/cortex_m/pm_s2ram.c) - is placed in linker section given by 'zephyr,memory-region' property of aforementioned node. + This option enables the SoC specific implementations of suspend-to-ram (S2RAM) + sleep states if PM is enabled and one or more suspend-to-ram sleep states are + enabled in the devicetree. config PM_S2RAM_CUSTOM_MARKING bool "Use custom marking functions" From 53834ac432873ad6b96151864768ab3a91490e83 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Mon, 22 Sep 2025 07:28:21 +0200 Subject: [PATCH 2052/2141] [nrf fromtree] pm: refactor PM_S2RAM_CUSTOM_MARKING option to be promptless The config PM_S2RAM_CUSTOM_MARKING is not an optional config for a user to select, it is required by some soc implementations of S2RAM, in which case it must be selected by the soc. Refactor the configuration to be HAS_PM_S2RAM_CUSTOM_MARKING, and make the currently only soc which needs it select it. Then update samples which previously had to select this option for this soc. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit 1767f131aac706f978eb93bd548b7e7419a0457d) --- arch/arm/core/cortex_m/pm_s2ram.c | 4 ++-- include/zephyr/arch/common/pm_s2ram.h | 8 ++++---- samples/boards/nordic/spis_wakeup/prj.conf | 1 - .../nordic/spis_wakeup/wakeup_trigger/prj.conf | 1 - soc/nordic/nrf54h/Kconfig | 2 ++ subsys/pm/Kconfig | 15 ++++++++------- 6 files changed, 16 insertions(+), 15 deletions(-) diff --git a/arch/arm/core/cortex_m/pm_s2ram.c b/arch/arm/core/cortex_m/pm_s2ram.c index 81a4ae20a4f6..ce80c78a078a 100644 --- a/arch/arm/core/cortex_m/pm_s2ram.c +++ b/arch/arm/core/cortex_m/pm_s2ram.c @@ -28,7 +28,7 @@ __noinit #endif _cpu_context_t _cpu_context; -#ifndef CONFIG_PM_S2RAM_CUSTOM_MARKING +#ifndef CONFIG_HAS_PM_S2RAM_CUSTOM_MARKING /** * S2RAM Marker */ @@ -50,4 +50,4 @@ bool pm_s2ram_mark_check_and_clear(void) return false; } -#endif /* CONFIG_PM_S2RAM_CUSTOM_MARKING */ +#endif /* CONFIG_HAS_PM_S2RAM_CUSTOM_MARKING */ diff --git a/include/zephyr/arch/common/pm_s2ram.h b/include/zephyr/arch/common/pm_s2ram.h index 34c544c769b9..322cefe6ebb2 100644 --- a/include/zephyr/arch/common/pm_s2ram.h +++ b/include/zephyr/arch/common/pm_s2ram.h @@ -63,8 +63,8 @@ int arch_pm_s2ram_suspend(pm_s2ram_system_off_fn_t system_off); * Function is called when system state is stored to RAM, just before going to system * off. * - * Default implementation is setting a magic word in RAM. CONFIG_PM_S2RAM_CUSTOM_MARKING - * allows custom implementation. + * Default implementation is setting a magic word in RAM used if + * CONFIG_HAS_PM_S2RAM_CUSTOM_MARKING is not set. */ void pm_s2ram_mark_set(void); @@ -74,8 +74,8 @@ void pm_s2ram_mark_set(void); * Function is used to determine if resuming after suspend-to-RAM shall be performed * or standard boot code shall be executed. * - * Default implementation is checking a magic word in RAM. CONFIG_PM_S2RAM_CUSTOM_MARKING - * allows custom implementation. + * Default implementation is checking a magic word in RAM used if + * CONFIG_HAS_PM_S2RAM_CUSTOM_MARKING is not set. * * @retval true if marking is found which indicates resuming after suspend-to-RAM. * @retval false if marking is not found which indicates standard boot. diff --git a/samples/boards/nordic/spis_wakeup/prj.conf b/samples/boards/nordic/spis_wakeup/prj.conf index c1cc933296f0..e313ffeed82b 100644 --- a/samples/boards/nordic/spis_wakeup/prj.conf +++ b/samples/boards/nordic/spis_wakeup/prj.conf @@ -3,7 +3,6 @@ CONFIG_SPI_SLAVE=y CONFIG_GPIO=y CONFIG_PM=y -CONFIG_PM_S2RAM_CUSTOM_MARKING=y CONFIG_PM_DEVICE=y CONFIG_PM_DEVICE_RUNTIME=y diff --git a/samples/boards/nordic/spis_wakeup/wakeup_trigger/prj.conf b/samples/boards/nordic/spis_wakeup/wakeup_trigger/prj.conf index 9c30d5a98fd7..ad4577807f89 100644 --- a/samples/boards/nordic/spis_wakeup/wakeup_trigger/prj.conf +++ b/samples/boards/nordic/spis_wakeup/wakeup_trigger/prj.conf @@ -3,7 +3,6 @@ CONFIG_SPI_NRFX_WAKE_TIMEOUT_US=500 CONFIG_GPIO=y CONFIG_PM=y -CONFIG_PM_S2RAM_CUSTOM_MARKING=y CONFIG_PM_DEVICE=y CONFIG_PM_DEVICE_RUNTIME=y diff --git a/soc/nordic/nrf54h/Kconfig b/soc/nordic/nrf54h/Kconfig index d4c86932a2c4..9aae7f379bb8 100644 --- a/soc/nordic/nrf54h/Kconfig +++ b/soc/nordic/nrf54h/Kconfig @@ -35,6 +35,7 @@ config SOC_NRF54H20_CPUAPP_COMMON select NRFS_HAS_TEMP_SERVICE select NRFS_HAS_VBUS_DETECTOR_SERVICE select HAS_PM + select HAS_PM_S2RAM_CUSTOM_MARKING select HAS_POWEROFF config SOC_NRF54H20_CPUAPP @@ -64,6 +65,7 @@ config SOC_NRF54H20_CPURAD_COMMON select HAS_NORDIC_DMM select HAS_NORDIC_RAM_CTRL select HAS_PM + select HAS_PM_S2RAM_CUSTOM_MARKING select HAS_POWEROFF config SOC_NRF54H20_CPURAD_ENABLE diff --git a/subsys/pm/Kconfig b/subsys/pm/Kconfig index abd424a88009..676f4ef229f5 100644 --- a/subsys/pm/Kconfig +++ b/subsys/pm/Kconfig @@ -10,6 +10,14 @@ config HAS_PM This option must be selected by SoCs that provide PM hooks, that is, calls to configure low-power states. +config HAS_PM_S2RAM_CUSTOM_MARKING + bool + depends on HAS_PM + help + By default a magic word in RAM is used to mark entering suspend-to-RAM. If this + option is selected, a custom implementation of functions which handle the marking + must be provided. + config PM bool "System Power Management" depends on SYS_CLOCK_EXISTS && HAS_PM @@ -45,13 +53,6 @@ config PM_S2RAM sleep states if PM is enabled and one or more suspend-to-ram sleep states are enabled in the devicetree. -config PM_S2RAM_CUSTOM_MARKING - bool "Use custom marking functions" - depends on PM_S2RAM - help - By default a magic word in RAM is used to mark entering suspend-to-RAM. Enabling - this option allows custom implementation of functions which handle the marking. - config PM_NEED_ALL_DEVICES_IDLE bool "System Low Power Mode Needs All Devices Idle" depends on PM_DEVICE && !SMP From 134f6b25b8b9baa946f7865b5d001f0a95a441d8 Mon Sep 17 00:00:00 2001 From: Rubin Gerritsen Date: Sun, 28 Sep 2025 19:43:33 +0200 Subject: [PATCH 2053/2141] [nrf fromtree] soc: nordic: nrf54h: s2ram: Support disabled MPU This commit adds support using pm_s2ram for 54H when the MPU is disabled. This is the case for the out of tree sample `sdk-nrf/samples/nrf54h/empty_app_core`. Without this commit the linker will fail to link `z_arm_mpu_init` and `z_arm_configure_static_mpu_regions`. Signed-off-by: Rubin Gerritsen (cherry picked from commit 05b77ece23e9104aee17e6c11dff544ad0ca8783) --- soc/nordic/nrf54h/pm_s2ram.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/soc/nordic/nrf54h/pm_s2ram.c b/soc/nordic/nrf54h/pm_s2ram.c index 6916e4884727..768233b2ac8b 100644 --- a/soc/nordic/nrf54h/pm_s2ram.c +++ b/soc/nordic/nrf54h/pm_s2ram.c @@ -76,7 +76,9 @@ typedef struct { struct backup { _nvic_context_t nvic_context; +#if defined(CONFIG_MPU) _mpu_context_t mpu_context; +#endif _scb_context_t scb_context; #if defined(CONFIG_FPU) && !defined(CONFIG_FPU_SHARING) _fpu_context_t fpu_context; @@ -88,6 +90,7 @@ static __noinit struct backup backup_data; extern void z_arm_configure_static_mpu_regions(void); extern int z_arm_mpu_init(void); +#if defined(CONFIG_MPU) /* MPU registers cannot be simply copied because content of RBARx RLARx registers * depends on region which is selected by RNR register. */ @@ -130,6 +133,7 @@ static void mpu_restore(_mpu_context_t *backup) MPU->RNR = rnr; MPU->CTRL = backup->CTRL; } +#endif /* defined(CONFIG_MPU) */ static void nvic_save(_nvic_context_t *backup) { @@ -245,7 +249,9 @@ int soc_s2ram_suspend(pm_s2ram_system_off_fn_t system_off) fpu_power_down(); #endif nvic_save(&backup_data.nvic_context); +#if defined(CONFIG_MPU) mpu_save(&backup_data.mpu_context); +#endif ret = arch_pm_s2ram_suspend(system_off); /* Cache and FPU are powered down so power up is needed even if s2ram failed. */ nrf_power_up_cache(); @@ -260,7 +266,9 @@ int soc_s2ram_suspend(pm_s2ram_system_off_fn_t system_off) return ret; } +#if defined(CONFIG_MPU) mpu_restore(&backup_data.mpu_context); +#endif nvic_restore(&backup_data.nvic_context); scb_restore(&backup_data.scb_context); From cb89816c0dd67b9833d78bd55a04ff24a8edcc67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Fri, 24 Oct 2025 13:09:10 +0200 Subject: [PATCH 2054/2141] [nrf fromtree] soc: nordic: nrf54h: Disable S2RAM on cpurad MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On nrf54h20 only cpuapp supports s2ram low power cpu state. Signed-off-by: Sebastian Głąb (cherry picked from commit 6ec763474f6593ceafe70f79731247ede3721984) --- soc/nordic/nrf54h/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/soc/nordic/nrf54h/Kconfig b/soc/nordic/nrf54h/Kconfig index 9aae7f379bb8..f07a620ccdb3 100644 --- a/soc/nordic/nrf54h/Kconfig +++ b/soc/nordic/nrf54h/Kconfig @@ -65,7 +65,6 @@ config SOC_NRF54H20_CPURAD_COMMON select HAS_NORDIC_DMM select HAS_NORDIC_RAM_CTRL select HAS_PM - select HAS_PM_S2RAM_CUSTOM_MARKING select HAS_POWEROFF config SOC_NRF54H20_CPURAD_ENABLE From d016c1f323d2527770d234ec89ca4e47e4f94163 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Fri, 24 Oct 2025 11:04:38 +0200 Subject: [PATCH 2055/2141] [nrf fromtree] drivers: mspi_dw: Use uint32_t for dummy_bytes field MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since the driver allows transfer lengths up to `UINT16_MAX + 1` bytes, and additionally the `dummy_bytes` field includes bytes sent to provide wait cycles on the bus, the type of this field must be `uint32_t`, otherwise it can be overflowed for RX transfers close to the maximum. Signed-off-by: Andrzej Głąbek (cherry picked from commit 70fe96122381eebf42342fad1f72089abe9aef5c) --- drivers/mspi/mspi_dw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mspi/mspi_dw.c b/drivers/mspi/mspi_dw.c index 4f6616a91749..66bdf670c02d 100644 --- a/drivers/mspi/mspi_dw.c +++ b/drivers/mspi/mspi_dw.c @@ -59,7 +59,7 @@ struct mspi_dw_data { enum mspi_cpp_mode xip_cpp; #endif - uint16_t dummy_bytes; + uint32_t dummy_bytes; uint8_t bytes_to_discard; uint8_t bytes_per_frame_exp; bool standard_spi; @@ -317,7 +317,7 @@ static bool tx_dummy_bytes(const struct device *dev, bool *repeat) uint8_t fifo_room = dev_config->max_queued_dummy_bytes - FIELD_GET(TXFLR_TXTFL_MASK, read_txflr(dev)); uint8_t rx_fifo_items = FIELD_GET(RXFLR_RXTFL_MASK, read_rxflr(dev)); - uint16_t dummy_bytes = dev_data->dummy_bytes; + uint32_t dummy_bytes = dev_data->dummy_bytes; const uint8_t dummy_val = 0; /* Subtract the number of items that are already stored in the RX From 81edaae95618fa845f67957037fe22bc8b063a84 Mon Sep 17 00:00:00 2001 From: Rubin Gerritsen Date: Wed, 5 Nov 2025 14:16:33 +0100 Subject: [PATCH 2056/2141] [nrf noup] ci: Extend test spec for CI-ble-test We want to run CI when Nordic specific arch, soc, or board changes are done. Running CI on such changes would have prevented that https://github.com/nrfconnect/sdk-nrf/pull/25230 broke this CI plan. Signed-off-by: Rubin Gerritsen --- .github/test-spec.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/test-spec.yml b/.github/test-spec.yml index 76def875e0be..5fdf9c0ca782 100644 --- a/.github/test-spec.yml +++ b/.github/test-spec.yml @@ -86,6 +86,8 @@ - "samples/tfm_integration/**/*" "CI-ble-test": + - any: + - "arch/arm/**/*" - any: - "drivers/bluetooth/**/*" - any: @@ -97,7 +99,12 @@ - any: - "include/zephyr/bluetooth/**/*" - "!include/zephyr/bluetooth/mesh/**/*" - - "samples/bluetooth/hci_ipc/**/*" + - any: + - "boards/nordic/nrf5*" + - any: + - "soc/nordic/**/*" + - any: + - "subsys/pm/**/*" "CI-ble-samples-test": - any: From 9a54011af2dfd7b7e4b8b0b8a46f02961ad58511 Mon Sep 17 00:00:00 2001 From: Marcin Jelinski Date: Mon, 7 Jul 2025 15:39:31 +0200 Subject: [PATCH 2057/2141] [nrf fromtree] modules: nordic: select correct timer for NFCT on nRF54L Set the appropriate default NFC timer for the nRF54L series SoCs. Ref: NCSDK-31244 Signed-off-by: Marcin Jelinski (cherry picked from commit 0a9f28fdef564333e4c536dabcce1a90949dce0c) --- modules/hal_nordic/nrfx/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/hal_nordic/nrfx/Kconfig b/modules/hal_nordic/nrfx/Kconfig index 523931be649d..15ba5475436c 100644 --- a/modules/hal_nordic/nrfx/Kconfig +++ b/modules/hal_nordic/nrfx/Kconfig @@ -281,6 +281,7 @@ config NRFX_NFCT depends on $(dt_nodelabel_exists,nfct) select NRFX_TIMER4 if SOC_SERIES_NRF52X select NRFX_TIMER2 if SOC_SERIES_NRF53X + select NRFX_TIMER24 if SOC_SERIES_NRF54LX config NRFX_NVMC bool "NVMC driver" From 0d3b8d79d07d05921d67ed5b9244b243fa307f16 Mon Sep 17 00:00:00 2001 From: Carles Cufi Date: Wed, 29 Oct 2025 13:21:17 +0100 Subject: [PATCH 2058/2141] [nrf fromtree] kernel: events: Depend on multithreading Kernel events depend on multithreading being enabled, and mixing them with a non-multithreaded build gives linker failures internal to events.c. To avoid this, make events depend on multithreading. ``` libkernel.a(events.c.obj): in function `k_event_post_internal': 175: undefined reference to `z_sched_waitq_walk' events.c:183: undefined reference to `z_sched_wake_thread' events.c:191: undefined reference to `z_reschedule' libkernel.a(events.c.obj): in function `k_sched_current_thread_query': kernel.h:216: undefined reference to `z_impl_k_sched_current_thread_query' libkernel.a(events.c.obj): in function `k_event_wait_internal': events.c:312: undefined reference to `z_pend_curr' ``` Signed-off-by: Carles Cufi Signed-off-by: Piotr Kosycarz (cherry picked from commit cd8e773b325722e5d7b67427f3ebb88bd971b2f5) --- kernel/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/Kconfig b/kernel/Kconfig index bac45c64d33e..d46026508ae6 100644 --- a/kernel/Kconfig +++ b/kernel/Kconfig @@ -735,6 +735,7 @@ config NUM_MBOX_ASYNC_MSGS config EVENTS bool "Event objects" + depends on MULTITHREADING help This option enables event objects. Threads may wait on event objects for specific events, but both threads and ISRs may deliver From 164b47d3094202c9ac5b756aa2648d2ce5822680 Mon Sep 17 00:00:00 2001 From: Piotr Kosycarz Date: Thu, 6 Nov 2025 12:51:08 +0100 Subject: [PATCH 2059/2141] [nrf noup] tests: drivers: mspi: flash: disable psa_rng Not needed for this test and prevents from building with CONFIG_MULTITHREADING=n. Changes for h20 rad are similar, but needed to test cases filtering working only. Signed-off-by: Piotr Kosycarz --- .../mspi/flash/boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 4 ++++ .../mspi/flash/boards/nrf54h20dk_nrf54h20_cpurad.conf | 1 + .../mspi/flash/boards/nrf54h20dk_nrf54h20_cpurad.overlay | 5 +++++ 3 files changed, 10 insertions(+) create mode 100644 tests/drivers/mspi/flash/boards/nrf54h20dk_nrf54h20_cpurad.conf create mode 100644 tests/drivers/mspi/flash/boards/nrf54h20dk_nrf54h20_cpurad.overlay diff --git a/tests/drivers/mspi/flash/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/mspi/flash/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index 6e0d84e07cdb..2e6b6cf5eacc 100644 --- a/tests/drivers/mspi/flash/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/tests/drivers/mspi/flash/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -8,6 +8,10 @@ aliases { mspi0 = &exmif; }; + + psa_rng: psa-rng { + status = "disabled"; + }; }; &gpio6 { diff --git a/tests/drivers/mspi/flash/boards/nrf54h20dk_nrf54h20_cpurad.conf b/tests/drivers/mspi/flash/boards/nrf54h20dk_nrf54h20_cpurad.conf new file mode 100644 index 000000000000..a026df97a458 --- /dev/null +++ b/tests/drivers/mspi/flash/boards/nrf54h20dk_nrf54h20_cpurad.conf @@ -0,0 +1 @@ +CONFIG_PM=n diff --git a/tests/drivers/mspi/flash/boards/nrf54h20dk_nrf54h20_cpurad.overlay b/tests/drivers/mspi/flash/boards/nrf54h20dk_nrf54h20_cpurad.overlay new file mode 100644 index 000000000000..09b4edc100a4 --- /dev/null +++ b/tests/drivers/mspi/flash/boards/nrf54h20dk_nrf54h20_cpurad.overlay @@ -0,0 +1,5 @@ +/ { + psa_rng: psa-rng { + status = "disabled"; + }; +}; From 14c590801cd5d1dc33ad59ace513fdc404d59e13 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Mon, 3 Nov 2025 15:58:40 +0200 Subject: [PATCH 2060/2141] [nrf fromlist] drivers: modem_cellular: Update nRF91 Serial Modem PPP script nRF91 Serial Modem application does not anymore start PPP automatically. Update initialization script to request it. Upstream PR #: 98788 Signed-off-by: Seppo Takalo --- drivers/modem/modem_cellular.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index dfa2c719a8af..b99401fedca5 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -2816,6 +2816,7 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me310g1_shutdown_chat_script, #if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf91_slm) MODEM_CHAT_SCRIPT_CMDS_DEFINE(nordic_nrf91_slm_init_chat_script_cmds, MODEM_CHAT_SCRIPT_CMD_RESP_MULT("AT", allow_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CFUN=4", ok_match), MODEM_CHAT_SCRIPT_CMD_RESP("AT+CMEE=1", ok_match), MODEM_CHAT_SCRIPT_CMD_RESP("AT+CEREG=1", ok_match), MODEM_CHAT_SCRIPT_CMD_RESP("AT+CEREG?", ok_match), @@ -2833,7 +2834,7 @@ MODEM_CHAT_SCRIPT_DEFINE(nordic_nrf91_slm_init_chat_script, nordic_nrf91_slm_ini abort_matches, modem_cellular_chat_callback_handler, 10); MODEM_CHAT_SCRIPT_CMDS_DEFINE(nordic_nrf91_slm_dial_chat_script_cmds, - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CFUN=4", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT#XPPP=1", ok_match), MODEM_CHAT_SCRIPT_CMD_RESP("AT+CFUN=1", ok_match), MODEM_CHAT_SCRIPT_CMD_RESP("AT#XCMUX=2", ok_match)); From 5984d720d358eff8a1c3e2bfc97396e2d01fd54b Mon Sep 17 00:00:00 2001 From: Tomasz Chyrowicz Date: Mon, 3 Nov 2025 13:37:15 +0100 Subject: [PATCH 2061/2141] Revert "[nrf noup] mcumgr: img_mgmt: Fix check for chosen code partition" This reverts commit e6d6cc0c6ada8c69a021c5bbc13f52831c7c53a3. Signed-off-by: Tomasz Chyrowicz --- subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c index 0bbb583cde94..33f7ac408638 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c @@ -43,23 +43,6 @@ #if !defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_RAM_LOAD) -#if USE_PARTITION_MANAGER -#include - -#ifdef PM_MCUBOOT_SECONDARY_PAD_SIZE -BUILD_ASSERT(PM_MCUBOOT_PAD_SIZE == PM_MCUBOOT_SECONDARY_PAD_SIZE); -#endif - -#if CONFIG_BUILD_WITH_TFM - #define PM_ADDRESS_OFFSET (PM_MCUBOOT_PAD_SIZE + PM_TFM_SIZE) -#else - #define PM_ADDRESS_OFFSET (PM_MCUBOOT_PAD_SIZE) -#endif - -#define FIXED_PARTITION_IS_RUNNING_APP_PARTITION(label) \ - (FIXED_PARTITION_OFFSET(label) == (PM_ADDRESS - PM_ADDRESS_OFFSET)) - -#else /* ! USE_PARTITION_MANAGER */ #ifndef CONFIG_FLASH_LOAD_OFFSET #error MCUmgr requires application to be built with CONFIG_FLASH_LOAD_OFFSET set \ to be able to figure out application running slot. @@ -68,7 +51,6 @@ BUILD_ASSERT(PM_MCUBOOT_PAD_SIZE == PM_MCUBOOT_SECONDARY_PAD_SIZE); #define FIXED_PARTITION_IS_RUNNING_APP_PARTITION(label) \ (FIXED_PARTITION_OFFSET(label) <= CONFIG_FLASH_LOAD_OFFSET && \ FIXED_PARTITION_OFFSET(label) + FIXED_PARTITION_SIZE(label) > CONFIG_FLASH_LOAD_OFFSET) -#endif /* USE_PARTITION_MANAGER */ BUILD_ASSERT(sizeof(struct image_header) == IMAGE_HEADER_SIZE, "struct image_header not required size"); From a494507c25c2c6ea98d67d4c522218da958cfc58 Mon Sep 17 00:00:00 2001 From: Tomasz Chyrowicz Date: Mon, 3 Nov 2025 13:38:24 +0100 Subject: [PATCH 2062/2141] Revert "[nrf noup] mgmt: mcumgr: Fix nRF5340 network core hook" This reverts commit b856d4e37c8b229f4be6975e58f01f3cfc5f8d20. Signed-off-by: Tomasz Chyrowicz --- subsys/mgmt/mcumgr/CMakeLists.txt | 13 ++++++------- subsys/mgmt/mcumgr/Kconfig | 2 +- subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c | 15 ++++++++++++--- subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig | 8 -------- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/subsys/mgmt/mcumgr/CMakeLists.txt b/subsys/mgmt/mcumgr/CMakeLists.txt index 3bb21e16f798..ad088eca0677 100644 --- a/subsys/mgmt/mcumgr/CMakeLists.txt +++ b/subsys/mgmt/mcumgr/CMakeLists.txt @@ -17,11 +17,10 @@ add_subdirectory_ifdef(CONFIG_SMP_CLIENT smp_client) zephyr_library_link_libraries(mgmt_mcumgr) -if(CONFIG_MCUMGR_GRP_IMG_NRF5340_BOOTUTIL_HOOK) - zephyr_include_directories( - ${ZEPHYR_MCUBOOT_MODULE_DIR}/boot/bootutil/include - ${ZEPHYR_MCUBOOT_MODULE_DIR}/boot/zephyr/include - ) - - zephyr_library_sources(bootutil_hooks/nrf53_hooks.c) +if (CONFIG_BOOT_IMAGE_ACCESS_HOOKS) + zephyr_include_directories( + ${ZEPHYR_MCUBOOT_MODULE_DIR}/boot/bootutil/include + ${ZEPHYR_MCUBOOT_MODULE_DIR}/boot/zephyr/include + ) + zephyr_library_sources(bootutil_hooks/nrf53_hooks.c) endif() diff --git a/subsys/mgmt/mcumgr/Kconfig b/subsys/mgmt/mcumgr/Kconfig index c45cb7f81d6b..1c6a3a2a5162 100644 --- a/subsys/mgmt/mcumgr/Kconfig +++ b/subsys/mgmt/mcumgr/Kconfig @@ -6,7 +6,7 @@ menuconfig MCUMGR bool "mcumgr Support" depends on NET_BUF depends on ZCBOR - imply BOOT_IMAGE_ACCESS_HOOKS if SOC_NRF5340_CPUAPP && MCUMGR_GRP_IMG && MCUBOOT_NETWORK_CORE_IMAGE_NUMBER > -1 + imply BOOT_IMAGE_ACCESS_HOOKS if (SOC_NRF5340_CPUAPP_QKAA && MCUMGR_GRP_IMG) help This option enables the mcumgr management library. diff --git a/subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c b/subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c index b372ce4e4945..f1ac8a168e65 100644 --- a/subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c +++ b/subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c @@ -8,10 +8,19 @@ #include #include "bootutil/bootutil_public.h" -int boot_read_swap_state_primary_slot_hook(int image_index, struct boot_swap_state *state) +#if CONFIG_MCUBOOT_NETWORK_CORE_IMAGE_NUMBER != -1 +/* Sysbuild */ +#define NET_CORE_IMAGE CONFIG_MCUBOOT_NETWORK_CORE_IMAGE_NUMBER +#else +/* Legacy child/parent */ +#define NET_CORE_IMAGE 1 +#endif + +int boot_read_swap_state_primary_slot_hook(int image_index, + struct boot_swap_state *state) { - if (image_index == CONFIG_MCUBOOT_NETWORK_CORE_IMAGE_NUMBER) { - /* Pretend that primary slot of the network core update image is unpopulated */ + if (image_index == NET_CORE_IMAGE) { + /* Pretend that primary slot of image 1 unpopulated */ state->magic = BOOT_MAGIC_UNSET; state->swap_type = BOOT_SWAP_TYPE_NONE; state->image_num = image_index; diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig b/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig index 1e975e672556..111e8938be0e 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig @@ -245,14 +245,6 @@ config MCUMGR_GRP_IMG_QSPI_XIP_SPLIT_IMAGE sysbuild if needed. This enables selecting the correct slot when running a QSPI XIP split image application in DirectXIP mode. -config MCUMGR_GRP_IMG_NRF5340_BOOTUTIL_HOOK - bool "nRF5340 network core bootutil hook" - depends on SOC_NRF5340_CPUAPP && BOOT_IMAGE_ACCESS_HOOKS && MCUBOOT_NETWORK_CORE_IMAGE_NUMBER > -1 - default y - help - This option will enable a bootutil hook that populates the network core update image - slot with dummy data to allow for uploading a firmware update to the network core. - module = MCUMGR_GRP_IMG module-str = mcumgr_grp_img source "subsys/logging/Kconfig.template.log_config" From e321b55eecca492872f90e5a39f7657463828104 Mon Sep 17 00:00:00 2001 From: Tomasz Chyrowicz Date: Mon, 3 Nov 2025 13:39:01 +0100 Subject: [PATCH 2063/2141] Revert "[nrf noup] mgmt: mcumgr: grp: img_mgmt: Add handling for QSPI XIP" This reverts commit 0fb761832466933b322fb8030c9ec934b62aa128. Signed-off-by: Tomasz Chyrowicz --- subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig | 8 -------- subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c | 8 -------- 2 files changed, 16 deletions(-) diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig b/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig index 111e8938be0e..25979180e2c9 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig @@ -237,14 +237,6 @@ config MCUMGR_GRP_IMG_SLOT_INFO_HOOKS This will enable the slot info function hooks which can be used to add additional information to responses. -config MCUMGR_GRP_IMG_QSPI_XIP_SPLIT_IMAGE - bool "QSPI XIP Split image mode" - depends on MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP - help - This option should not be selected by users and should automatically be selected by - sysbuild if needed. This enables selecting the correct slot when running a QSPI XIP - split image application in DirectXIP mode. - module = MCUMGR_GRP_IMG module-str = mcumgr_grp_img source "subsys/logging/Kconfig.template.log_config" diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c index 33f7ac408638..a2bf006b9474 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c @@ -218,14 +218,6 @@ int img_mgmt_active_slot(int image) /* Multi image does not support DirectXIP or RAM load currently */ #if CONFIG_MCUMGR_GRP_IMG_UPDATABLE_IMAGE_NUMBER > 1 slot = (image << 1); - -#if defined(CONFIG_MCUMGR_GRP_IMG_QSPI_XIP_SPLIT_IMAGE) || \ - defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP) || \ - defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP_WITH_REVERT) - if (FIXED_PARTITION_IS_RUNNING_APP_PARTITION(slot1_partition)) { - slot += 1; - } -#endif #elif defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_RAM_LOAD) /* RAM load requires querying bootloader */ int rc; From ce93adad8c5ae914f9229f4017e9a0b4c437f159 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Tue, 8 Apr 2025 10:16:33 +0100 Subject: [PATCH 2064/2141] [nrf noup] mgmt: mcumgr: Fix nRF5340 network core hook Fixes an issue whereby just enabling hooks would enable the nrf5340 network core hook despite lacking other requirements Signed-off-by: Jamie McCrae Signed-off-by: Tomasz Chyrowicz (cherry picked from commit b856d4e37c8b229f4be6975e58f01f3cfc5f8d20) --- subsys/mgmt/mcumgr/CMakeLists.txt | 13 +++++++------ subsys/mgmt/mcumgr/Kconfig | 2 +- subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c | 15 +++------------ subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig | 8 ++++++++ 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/subsys/mgmt/mcumgr/CMakeLists.txt b/subsys/mgmt/mcumgr/CMakeLists.txt index ad088eca0677..3bb21e16f798 100644 --- a/subsys/mgmt/mcumgr/CMakeLists.txt +++ b/subsys/mgmt/mcumgr/CMakeLists.txt @@ -17,10 +17,11 @@ add_subdirectory_ifdef(CONFIG_SMP_CLIENT smp_client) zephyr_library_link_libraries(mgmt_mcumgr) -if (CONFIG_BOOT_IMAGE_ACCESS_HOOKS) - zephyr_include_directories( - ${ZEPHYR_MCUBOOT_MODULE_DIR}/boot/bootutil/include - ${ZEPHYR_MCUBOOT_MODULE_DIR}/boot/zephyr/include - ) - zephyr_library_sources(bootutil_hooks/nrf53_hooks.c) +if(CONFIG_MCUMGR_GRP_IMG_NRF5340_BOOTUTIL_HOOK) + zephyr_include_directories( + ${ZEPHYR_MCUBOOT_MODULE_DIR}/boot/bootutil/include + ${ZEPHYR_MCUBOOT_MODULE_DIR}/boot/zephyr/include + ) + + zephyr_library_sources(bootutil_hooks/nrf53_hooks.c) endif() diff --git a/subsys/mgmt/mcumgr/Kconfig b/subsys/mgmt/mcumgr/Kconfig index 1c6a3a2a5162..c45cb7f81d6b 100644 --- a/subsys/mgmt/mcumgr/Kconfig +++ b/subsys/mgmt/mcumgr/Kconfig @@ -6,7 +6,7 @@ menuconfig MCUMGR bool "mcumgr Support" depends on NET_BUF depends on ZCBOR - imply BOOT_IMAGE_ACCESS_HOOKS if (SOC_NRF5340_CPUAPP_QKAA && MCUMGR_GRP_IMG) + imply BOOT_IMAGE_ACCESS_HOOKS if SOC_NRF5340_CPUAPP && MCUMGR_GRP_IMG && MCUBOOT_NETWORK_CORE_IMAGE_NUMBER > -1 help This option enables the mcumgr management library. diff --git a/subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c b/subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c index f1ac8a168e65..b372ce4e4945 100644 --- a/subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c +++ b/subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c @@ -8,19 +8,10 @@ #include #include "bootutil/bootutil_public.h" -#if CONFIG_MCUBOOT_NETWORK_CORE_IMAGE_NUMBER != -1 -/* Sysbuild */ -#define NET_CORE_IMAGE CONFIG_MCUBOOT_NETWORK_CORE_IMAGE_NUMBER -#else -/* Legacy child/parent */ -#define NET_CORE_IMAGE 1 -#endif - -int boot_read_swap_state_primary_slot_hook(int image_index, - struct boot_swap_state *state) +int boot_read_swap_state_primary_slot_hook(int image_index, struct boot_swap_state *state) { - if (image_index == NET_CORE_IMAGE) { - /* Pretend that primary slot of image 1 unpopulated */ + if (image_index == CONFIG_MCUBOOT_NETWORK_CORE_IMAGE_NUMBER) { + /* Pretend that primary slot of the network core update image is unpopulated */ state->magic = BOOT_MAGIC_UNSET; state->swap_type = BOOT_SWAP_TYPE_NONE; state->image_num = image_index; diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig b/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig index 25979180e2c9..e64f15abd2e6 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig @@ -237,6 +237,14 @@ config MCUMGR_GRP_IMG_SLOT_INFO_HOOKS This will enable the slot info function hooks which can be used to add additional information to responses. +config MCUMGR_GRP_IMG_NRF5340_BOOTUTIL_HOOK + bool "nRF5340 network core bootutil hook" + depends on SOC_NRF5340_CPUAPP && BOOT_IMAGE_ACCESS_HOOKS && MCUBOOT_NETWORK_CORE_IMAGE_NUMBER > -1 + default y + help + This option will enable a bootutil hook that populates the network core update image + slot with dummy data to allow for uploading a firmware update to the network core. + module = MCUMGR_GRP_IMG module-str = mcumgr_grp_img source "subsys/logging/Kconfig.template.log_config" From d76fd711710157d1e93e49134fac683951b16f6a Mon Sep 17 00:00:00 2001 From: Kacper Radoszewski Date: Thu, 23 Oct 2025 10:06:44 +0200 Subject: [PATCH 2065/2141] [nrf noup] include: net: add SO_SENDCB to NCS extensions nrf-squash! [nrf noup] include: net: add NCS extensions The SO_SENDCB socket option allows to set a callback to be called when a send operation is completed by lower layers. Signed-off-by: Kacper Radoszewski --- include/zephyr/net/socket_ncs.h | 37 +++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/include/zephyr/net/socket_ncs.h b/include/zephyr/net/socket_ncs.h index 92a8447c47fb..6a77d6c41f13 100644 --- a/include/zephyr/net/socket_ncs.h +++ b/include/zephyr/net/socket_ncs.h @@ -16,6 +16,8 @@ extern "C" { #endif +#include + /* When CONFIG_NET_SOCKETS_OFFLOAD is enabled, offloaded sockets take precedence * when creating a new socket. Combine this flag with a socket type when * creating a socket, to enforce native socket creation (e. g. SOCK_STREAM | SOCK_NATIVE). @@ -116,6 +118,41 @@ extern "C" { */ #define RAI_WAIT_MORE 5 +/** sockopt: set a callback to be called when a send request is acknowledged by the network and + * the data has been acknowledged by the peer, if required by the network protocol, or until the + * timeout, given by the SO_SNDTIMEO socket option, is reached. Valid timeout values are + * 1 to 600 seconds. + * This option takes a @ref socket_ncs_sendcb structure. + * + * @note The callback is executed in an interrupt context. + * Take care to offload any processing as appropriate. + * + * @note This is only supported by the following modem firmware: + * - mfw_nrf9151-ntn + * + * This socket option cannot be used along with the @ref MSG_WAITACK send flag. + */ +#define SO_SENDCB (NET_SOCKET_NCS_BASE + 63) + +/** Parameters returned in the @ref socket_ncs_sendcb_t callback. */ +struct socket_ncs_sendcb_params { + /** Socket handle. */ + int fd; + /** Status. Can be 0 on successful send or EAGAIN on timeout. */ + int status; + /** Number of bytes that was sent. */ + size_t bytes_sent; +}; + +/** Callback type in the @ref socket_ncs_sendcb structure. */ +typedef void (*socket_ncs_sendcb_t)(const struct socket_ncs_sendcb_params *params); + +/** Option value for the @ref SO_SENDCB socket option. */ +struct socket_ncs_sendcb { + /** Callback function. */ + socket_ncs_sendcb_t callback; +}; + /* NCS specific IPPROTO_ALL level socket options */ /** IPv4 and IPv6 protocol level (pseudo-val) for nRF sockets. */ From 51911b5eafbbebdee26d8cd74ad5c75091bfb285 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Tue, 11 Nov 2025 13:04:56 +0000 Subject: [PATCH 2066/2141] Revert "[nrf noup] mgmt: mcumgr: Fix nRF5340 network core hook" This reverts commit ce93adad8c5ae914f9229f4017e9a0b4c437f159. Signed-off-by: Jamie McCrae --- subsys/mgmt/mcumgr/CMakeLists.txt | 13 ++++++------- subsys/mgmt/mcumgr/Kconfig | 2 +- subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c | 15 ++++++++++++--- subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig | 8 -------- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/subsys/mgmt/mcumgr/CMakeLists.txt b/subsys/mgmt/mcumgr/CMakeLists.txt index 3bb21e16f798..ad088eca0677 100644 --- a/subsys/mgmt/mcumgr/CMakeLists.txt +++ b/subsys/mgmt/mcumgr/CMakeLists.txt @@ -17,11 +17,10 @@ add_subdirectory_ifdef(CONFIG_SMP_CLIENT smp_client) zephyr_library_link_libraries(mgmt_mcumgr) -if(CONFIG_MCUMGR_GRP_IMG_NRF5340_BOOTUTIL_HOOK) - zephyr_include_directories( - ${ZEPHYR_MCUBOOT_MODULE_DIR}/boot/bootutil/include - ${ZEPHYR_MCUBOOT_MODULE_DIR}/boot/zephyr/include - ) - - zephyr_library_sources(bootutil_hooks/nrf53_hooks.c) +if (CONFIG_BOOT_IMAGE_ACCESS_HOOKS) + zephyr_include_directories( + ${ZEPHYR_MCUBOOT_MODULE_DIR}/boot/bootutil/include + ${ZEPHYR_MCUBOOT_MODULE_DIR}/boot/zephyr/include + ) + zephyr_library_sources(bootutil_hooks/nrf53_hooks.c) endif() diff --git a/subsys/mgmt/mcumgr/Kconfig b/subsys/mgmt/mcumgr/Kconfig index c45cb7f81d6b..1c6a3a2a5162 100644 --- a/subsys/mgmt/mcumgr/Kconfig +++ b/subsys/mgmt/mcumgr/Kconfig @@ -6,7 +6,7 @@ menuconfig MCUMGR bool "mcumgr Support" depends on NET_BUF depends on ZCBOR - imply BOOT_IMAGE_ACCESS_HOOKS if SOC_NRF5340_CPUAPP && MCUMGR_GRP_IMG && MCUBOOT_NETWORK_CORE_IMAGE_NUMBER > -1 + imply BOOT_IMAGE_ACCESS_HOOKS if (SOC_NRF5340_CPUAPP_QKAA && MCUMGR_GRP_IMG) help This option enables the mcumgr management library. diff --git a/subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c b/subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c index b372ce4e4945..f1ac8a168e65 100644 --- a/subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c +++ b/subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c @@ -8,10 +8,19 @@ #include #include "bootutil/bootutil_public.h" -int boot_read_swap_state_primary_slot_hook(int image_index, struct boot_swap_state *state) +#if CONFIG_MCUBOOT_NETWORK_CORE_IMAGE_NUMBER != -1 +/* Sysbuild */ +#define NET_CORE_IMAGE CONFIG_MCUBOOT_NETWORK_CORE_IMAGE_NUMBER +#else +/* Legacy child/parent */ +#define NET_CORE_IMAGE 1 +#endif + +int boot_read_swap_state_primary_slot_hook(int image_index, + struct boot_swap_state *state) { - if (image_index == CONFIG_MCUBOOT_NETWORK_CORE_IMAGE_NUMBER) { - /* Pretend that primary slot of the network core update image is unpopulated */ + if (image_index == NET_CORE_IMAGE) { + /* Pretend that primary slot of image 1 unpopulated */ state->magic = BOOT_MAGIC_UNSET; state->swap_type = BOOT_SWAP_TYPE_NONE; state->image_num = image_index; diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig b/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig index e64f15abd2e6..25979180e2c9 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig @@ -237,14 +237,6 @@ config MCUMGR_GRP_IMG_SLOT_INFO_HOOKS This will enable the slot info function hooks which can be used to add additional information to responses. -config MCUMGR_GRP_IMG_NRF5340_BOOTUTIL_HOOK - bool "nRF5340 network core bootutil hook" - depends on SOC_NRF5340_CPUAPP && BOOT_IMAGE_ACCESS_HOOKS && MCUBOOT_NETWORK_CORE_IMAGE_NUMBER > -1 - default y - help - This option will enable a bootutil hook that populates the network core update image - slot with dummy data to allow for uploading a firmware update to the network core. - module = MCUMGR_GRP_IMG module-str = mcumgr_grp_img source "subsys/logging/Kconfig.template.log_config" From 8c848396a0adab30f7c6a6584950e859d7b925f3 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Tue, 11 Nov 2025 13:05:00 +0000 Subject: [PATCH 2067/2141] Reapply "[nrf noup] mgmt: mcumgr: grp: img_mgmt: Add handling for QSPI XIP" This reverts commit e321b55eecca492872f90e5a39f7657463828104. Signed-off-by: Jamie McCrae --- subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig | 8 ++++++++ subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig b/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig index 25979180e2c9..111e8938be0e 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig @@ -237,6 +237,14 @@ config MCUMGR_GRP_IMG_SLOT_INFO_HOOKS This will enable the slot info function hooks which can be used to add additional information to responses. +config MCUMGR_GRP_IMG_QSPI_XIP_SPLIT_IMAGE + bool "QSPI XIP Split image mode" + depends on MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP + help + This option should not be selected by users and should automatically be selected by + sysbuild if needed. This enables selecting the correct slot when running a QSPI XIP + split image application in DirectXIP mode. + module = MCUMGR_GRP_IMG module-str = mcumgr_grp_img source "subsys/logging/Kconfig.template.log_config" diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c index a2bf006b9474..33f7ac408638 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c @@ -218,6 +218,14 @@ int img_mgmt_active_slot(int image) /* Multi image does not support DirectXIP or RAM load currently */ #if CONFIG_MCUMGR_GRP_IMG_UPDATABLE_IMAGE_NUMBER > 1 slot = (image << 1); + +#if defined(CONFIG_MCUMGR_GRP_IMG_QSPI_XIP_SPLIT_IMAGE) || \ + defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP) || \ + defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP_WITH_REVERT) + if (FIXED_PARTITION_IS_RUNNING_APP_PARTITION(slot1_partition)) { + slot += 1; + } +#endif #elif defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_RAM_LOAD) /* RAM load requires querying bootloader */ int rc; From 708853c4dbb1e786d55f9ad2a2fd4fa75e8989c9 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Tue, 11 Nov 2025 13:05:04 +0000 Subject: [PATCH 2068/2141] Reapply "[nrf noup] mgmt: mcumgr: Fix nRF5340 network core hook" This reverts commit a494507c25c2c6ea98d67d4c522218da958cfc58. Signed-off-by: Jamie McCrae --- subsys/mgmt/mcumgr/CMakeLists.txt | 13 +++++++------ subsys/mgmt/mcumgr/Kconfig | 2 +- subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c | 15 +++------------ subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig | 8 ++++++++ 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/subsys/mgmt/mcumgr/CMakeLists.txt b/subsys/mgmt/mcumgr/CMakeLists.txt index ad088eca0677..3bb21e16f798 100644 --- a/subsys/mgmt/mcumgr/CMakeLists.txt +++ b/subsys/mgmt/mcumgr/CMakeLists.txt @@ -17,10 +17,11 @@ add_subdirectory_ifdef(CONFIG_SMP_CLIENT smp_client) zephyr_library_link_libraries(mgmt_mcumgr) -if (CONFIG_BOOT_IMAGE_ACCESS_HOOKS) - zephyr_include_directories( - ${ZEPHYR_MCUBOOT_MODULE_DIR}/boot/bootutil/include - ${ZEPHYR_MCUBOOT_MODULE_DIR}/boot/zephyr/include - ) - zephyr_library_sources(bootutil_hooks/nrf53_hooks.c) +if(CONFIG_MCUMGR_GRP_IMG_NRF5340_BOOTUTIL_HOOK) + zephyr_include_directories( + ${ZEPHYR_MCUBOOT_MODULE_DIR}/boot/bootutil/include + ${ZEPHYR_MCUBOOT_MODULE_DIR}/boot/zephyr/include + ) + + zephyr_library_sources(bootutil_hooks/nrf53_hooks.c) endif() diff --git a/subsys/mgmt/mcumgr/Kconfig b/subsys/mgmt/mcumgr/Kconfig index 1c6a3a2a5162..c45cb7f81d6b 100644 --- a/subsys/mgmt/mcumgr/Kconfig +++ b/subsys/mgmt/mcumgr/Kconfig @@ -6,7 +6,7 @@ menuconfig MCUMGR bool "mcumgr Support" depends on NET_BUF depends on ZCBOR - imply BOOT_IMAGE_ACCESS_HOOKS if (SOC_NRF5340_CPUAPP_QKAA && MCUMGR_GRP_IMG) + imply BOOT_IMAGE_ACCESS_HOOKS if SOC_NRF5340_CPUAPP && MCUMGR_GRP_IMG && MCUBOOT_NETWORK_CORE_IMAGE_NUMBER > -1 help This option enables the mcumgr management library. diff --git a/subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c b/subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c index f1ac8a168e65..b372ce4e4945 100644 --- a/subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c +++ b/subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c @@ -8,19 +8,10 @@ #include #include "bootutil/bootutil_public.h" -#if CONFIG_MCUBOOT_NETWORK_CORE_IMAGE_NUMBER != -1 -/* Sysbuild */ -#define NET_CORE_IMAGE CONFIG_MCUBOOT_NETWORK_CORE_IMAGE_NUMBER -#else -/* Legacy child/parent */ -#define NET_CORE_IMAGE 1 -#endif - -int boot_read_swap_state_primary_slot_hook(int image_index, - struct boot_swap_state *state) +int boot_read_swap_state_primary_slot_hook(int image_index, struct boot_swap_state *state) { - if (image_index == NET_CORE_IMAGE) { - /* Pretend that primary slot of image 1 unpopulated */ + if (image_index == CONFIG_MCUBOOT_NETWORK_CORE_IMAGE_NUMBER) { + /* Pretend that primary slot of the network core update image is unpopulated */ state->magic = BOOT_MAGIC_UNSET; state->swap_type = BOOT_SWAP_TYPE_NONE; state->image_num = image_index; diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig b/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig index 111e8938be0e..1e975e672556 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig @@ -245,6 +245,14 @@ config MCUMGR_GRP_IMG_QSPI_XIP_SPLIT_IMAGE sysbuild if needed. This enables selecting the correct slot when running a QSPI XIP split image application in DirectXIP mode. +config MCUMGR_GRP_IMG_NRF5340_BOOTUTIL_HOOK + bool "nRF5340 network core bootutil hook" + depends on SOC_NRF5340_CPUAPP && BOOT_IMAGE_ACCESS_HOOKS && MCUBOOT_NETWORK_CORE_IMAGE_NUMBER > -1 + default y + help + This option will enable a bootutil hook that populates the network core update image + slot with dummy data to allow for uploading a firmware update to the network core. + module = MCUMGR_GRP_IMG module-str = mcumgr_grp_img source "subsys/logging/Kconfig.template.log_config" From b5cf3eaf422232176fe4eb00201c811647e8aa64 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Tue, 11 Nov 2025 13:05:08 +0000 Subject: [PATCH 2069/2141] Reapply "[nrf noup] mcumgr: img_mgmt: Fix check for chosen code partition" This reverts commit 5984d720d358eff8a1c3e2bfc97396e2d01fd54b. Signed-off-by: Jamie McCrae --- subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c index 33f7ac408638..0bbb583cde94 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c @@ -43,6 +43,23 @@ #if !defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_RAM_LOAD) +#if USE_PARTITION_MANAGER +#include + +#ifdef PM_MCUBOOT_SECONDARY_PAD_SIZE +BUILD_ASSERT(PM_MCUBOOT_PAD_SIZE == PM_MCUBOOT_SECONDARY_PAD_SIZE); +#endif + +#if CONFIG_BUILD_WITH_TFM + #define PM_ADDRESS_OFFSET (PM_MCUBOOT_PAD_SIZE + PM_TFM_SIZE) +#else + #define PM_ADDRESS_OFFSET (PM_MCUBOOT_PAD_SIZE) +#endif + +#define FIXED_PARTITION_IS_RUNNING_APP_PARTITION(label) \ + (FIXED_PARTITION_OFFSET(label) == (PM_ADDRESS - PM_ADDRESS_OFFSET)) + +#else /* ! USE_PARTITION_MANAGER */ #ifndef CONFIG_FLASH_LOAD_OFFSET #error MCUmgr requires application to be built with CONFIG_FLASH_LOAD_OFFSET set \ to be able to figure out application running slot. @@ -51,6 +68,7 @@ #define FIXED_PARTITION_IS_RUNNING_APP_PARTITION(label) \ (FIXED_PARTITION_OFFSET(label) <= CONFIG_FLASH_LOAD_OFFSET && \ FIXED_PARTITION_OFFSET(label) + FIXED_PARTITION_SIZE(label) > CONFIG_FLASH_LOAD_OFFSET) +#endif /* USE_PARTITION_MANAGER */ BUILD_ASSERT(sizeof(struct image_header) == IMAGE_HEADER_SIZE, "struct image_header not required size"); From d727dd702035c579aa46e0975aeeea530f344b2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Stasiak?= Date: Wed, 12 Nov 2025 11:54:47 +0100 Subject: [PATCH 2070/2141] [nrf fromlist] dts: nrf54lm20a: align GPIOTE IRQn to non-secure build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use different GPIOTE interrupt number when building for cpuapp/ns. Upstream PR #: 99247 Signed-off-by: Michał Stasiak --- dts/arm/nordic/nrf54lm20a_enga_cpuapp.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dts/arm/nordic/nrf54lm20a_enga_cpuapp.dtsi b/dts/arm/nordic/nrf54lm20a_enga_cpuapp.dtsi index c55f40e6fa95..8c8d006e1a18 100644 --- a/dts/arm/nordic/nrf54lm20a_enga_cpuapp.dtsi +++ b/dts/arm/nordic/nrf54lm20a_enga_cpuapp.dtsi @@ -80,11 +80,19 @@ nvic: &cpuapp_nvic {}; }; &gpiote20 { +#ifdef USE_NON_SECURE_ADDRESS_MAP + interrupts = <218 NRF_DEFAULT_IRQ_PRIORITY>; +#else interrupts = <219 NRF_DEFAULT_IRQ_PRIORITY>; +#endif }; &gpiote30 { +#ifdef USE_NON_SECURE_ADDRESS_MAP + interrupts = <268 NRF_DEFAULT_IRQ_PRIORITY>; +#else interrupts = <269 NRF_DEFAULT_IRQ_PRIORITY>; +#endif }; &dppic00 { From 2678766024d9c2a34085ed86b93a7dd69ea9e63d Mon Sep 17 00:00:00 2001 From: Tomasz Chyrowicz Date: Mon, 3 Nov 2025 13:37:15 +0100 Subject: [PATCH 2071/2141] Revert "[nrf noup] mcumgr: img_mgmt: Fix check for chosen code partition" This reverts commit e6d6cc0c6ada8c69a021c5bbc13f52831c7c53a3. Signed-off-by: Tomasz Chyrowicz --- subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c index 0bbb583cde94..33f7ac408638 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c @@ -43,23 +43,6 @@ #if !defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_RAM_LOAD) -#if USE_PARTITION_MANAGER -#include - -#ifdef PM_MCUBOOT_SECONDARY_PAD_SIZE -BUILD_ASSERT(PM_MCUBOOT_PAD_SIZE == PM_MCUBOOT_SECONDARY_PAD_SIZE); -#endif - -#if CONFIG_BUILD_WITH_TFM - #define PM_ADDRESS_OFFSET (PM_MCUBOOT_PAD_SIZE + PM_TFM_SIZE) -#else - #define PM_ADDRESS_OFFSET (PM_MCUBOOT_PAD_SIZE) -#endif - -#define FIXED_PARTITION_IS_RUNNING_APP_PARTITION(label) \ - (FIXED_PARTITION_OFFSET(label) == (PM_ADDRESS - PM_ADDRESS_OFFSET)) - -#else /* ! USE_PARTITION_MANAGER */ #ifndef CONFIG_FLASH_LOAD_OFFSET #error MCUmgr requires application to be built with CONFIG_FLASH_LOAD_OFFSET set \ to be able to figure out application running slot. @@ -68,7 +51,6 @@ BUILD_ASSERT(PM_MCUBOOT_PAD_SIZE == PM_MCUBOOT_SECONDARY_PAD_SIZE); #define FIXED_PARTITION_IS_RUNNING_APP_PARTITION(label) \ (FIXED_PARTITION_OFFSET(label) <= CONFIG_FLASH_LOAD_OFFSET && \ FIXED_PARTITION_OFFSET(label) + FIXED_PARTITION_SIZE(label) > CONFIG_FLASH_LOAD_OFFSET) -#endif /* USE_PARTITION_MANAGER */ BUILD_ASSERT(sizeof(struct image_header) == IMAGE_HEADER_SIZE, "struct image_header not required size"); From ad8adbe0821a2513994639c5b99624813c5dafbf Mon Sep 17 00:00:00 2001 From: Tomasz Chyrowicz Date: Mon, 3 Nov 2025 13:38:24 +0100 Subject: [PATCH 2072/2141] Revert "[nrf noup] mgmt: mcumgr: Fix nRF5340 network core hook" This reverts commit b856d4e37c8b229f4be6975e58f01f3cfc5f8d20. Signed-off-by: Tomasz Chyrowicz --- subsys/mgmt/mcumgr/CMakeLists.txt | 13 ++++++------- subsys/mgmt/mcumgr/Kconfig | 2 +- subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c | 15 ++++++++++++--- subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig | 8 -------- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/subsys/mgmt/mcumgr/CMakeLists.txt b/subsys/mgmt/mcumgr/CMakeLists.txt index 3bb21e16f798..ad088eca0677 100644 --- a/subsys/mgmt/mcumgr/CMakeLists.txt +++ b/subsys/mgmt/mcumgr/CMakeLists.txt @@ -17,11 +17,10 @@ add_subdirectory_ifdef(CONFIG_SMP_CLIENT smp_client) zephyr_library_link_libraries(mgmt_mcumgr) -if(CONFIG_MCUMGR_GRP_IMG_NRF5340_BOOTUTIL_HOOK) - zephyr_include_directories( - ${ZEPHYR_MCUBOOT_MODULE_DIR}/boot/bootutil/include - ${ZEPHYR_MCUBOOT_MODULE_DIR}/boot/zephyr/include - ) - - zephyr_library_sources(bootutil_hooks/nrf53_hooks.c) +if (CONFIG_BOOT_IMAGE_ACCESS_HOOKS) + zephyr_include_directories( + ${ZEPHYR_MCUBOOT_MODULE_DIR}/boot/bootutil/include + ${ZEPHYR_MCUBOOT_MODULE_DIR}/boot/zephyr/include + ) + zephyr_library_sources(bootutil_hooks/nrf53_hooks.c) endif() diff --git a/subsys/mgmt/mcumgr/Kconfig b/subsys/mgmt/mcumgr/Kconfig index c45cb7f81d6b..1c6a3a2a5162 100644 --- a/subsys/mgmt/mcumgr/Kconfig +++ b/subsys/mgmt/mcumgr/Kconfig @@ -6,7 +6,7 @@ menuconfig MCUMGR bool "mcumgr Support" depends on NET_BUF depends on ZCBOR - imply BOOT_IMAGE_ACCESS_HOOKS if SOC_NRF5340_CPUAPP && MCUMGR_GRP_IMG && MCUBOOT_NETWORK_CORE_IMAGE_NUMBER > -1 + imply BOOT_IMAGE_ACCESS_HOOKS if (SOC_NRF5340_CPUAPP_QKAA && MCUMGR_GRP_IMG) help This option enables the mcumgr management library. diff --git a/subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c b/subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c index b372ce4e4945..f1ac8a168e65 100644 --- a/subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c +++ b/subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c @@ -8,10 +8,19 @@ #include #include "bootutil/bootutil_public.h" -int boot_read_swap_state_primary_slot_hook(int image_index, struct boot_swap_state *state) +#if CONFIG_MCUBOOT_NETWORK_CORE_IMAGE_NUMBER != -1 +/* Sysbuild */ +#define NET_CORE_IMAGE CONFIG_MCUBOOT_NETWORK_CORE_IMAGE_NUMBER +#else +/* Legacy child/parent */ +#define NET_CORE_IMAGE 1 +#endif + +int boot_read_swap_state_primary_slot_hook(int image_index, + struct boot_swap_state *state) { - if (image_index == CONFIG_MCUBOOT_NETWORK_CORE_IMAGE_NUMBER) { - /* Pretend that primary slot of the network core update image is unpopulated */ + if (image_index == NET_CORE_IMAGE) { + /* Pretend that primary slot of image 1 unpopulated */ state->magic = BOOT_MAGIC_UNSET; state->swap_type = BOOT_SWAP_TYPE_NONE; state->image_num = image_index; diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig b/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig index 1e975e672556..111e8938be0e 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig @@ -245,14 +245,6 @@ config MCUMGR_GRP_IMG_QSPI_XIP_SPLIT_IMAGE sysbuild if needed. This enables selecting the correct slot when running a QSPI XIP split image application in DirectXIP mode. -config MCUMGR_GRP_IMG_NRF5340_BOOTUTIL_HOOK - bool "nRF5340 network core bootutil hook" - depends on SOC_NRF5340_CPUAPP && BOOT_IMAGE_ACCESS_HOOKS && MCUBOOT_NETWORK_CORE_IMAGE_NUMBER > -1 - default y - help - This option will enable a bootutil hook that populates the network core update image - slot with dummy data to allow for uploading a firmware update to the network core. - module = MCUMGR_GRP_IMG module-str = mcumgr_grp_img source "subsys/logging/Kconfig.template.log_config" From e037a5f8862785da3987dbd54c9c43c1497206da Mon Sep 17 00:00:00 2001 From: Tomasz Chyrowicz Date: Mon, 3 Nov 2025 13:39:01 +0100 Subject: [PATCH 2073/2141] Revert "[nrf noup] mgmt: mcumgr: grp: img_mgmt: Add handling for QSPI XIP" This reverts commit 0fb761832466933b322fb8030c9ec934b62aa128. Signed-off-by: Tomasz Chyrowicz --- subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig | 8 -------- subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c | 8 -------- 2 files changed, 16 deletions(-) diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig b/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig index 111e8938be0e..25979180e2c9 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig @@ -237,14 +237,6 @@ config MCUMGR_GRP_IMG_SLOT_INFO_HOOKS This will enable the slot info function hooks which can be used to add additional information to responses. -config MCUMGR_GRP_IMG_QSPI_XIP_SPLIT_IMAGE - bool "QSPI XIP Split image mode" - depends on MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP - help - This option should not be selected by users and should automatically be selected by - sysbuild if needed. This enables selecting the correct slot when running a QSPI XIP - split image application in DirectXIP mode. - module = MCUMGR_GRP_IMG module-str = mcumgr_grp_img source "subsys/logging/Kconfig.template.log_config" diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c index 33f7ac408638..a2bf006b9474 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c @@ -218,14 +218,6 @@ int img_mgmt_active_slot(int image) /* Multi image does not support DirectXIP or RAM load currently */ #if CONFIG_MCUMGR_GRP_IMG_UPDATABLE_IMAGE_NUMBER > 1 slot = (image << 1); - -#if defined(CONFIG_MCUMGR_GRP_IMG_QSPI_XIP_SPLIT_IMAGE) || \ - defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP) || \ - defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP_WITH_REVERT) - if (FIXED_PARTITION_IS_RUNNING_APP_PARTITION(slot1_partition)) { - slot += 1; - } -#endif #elif defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_RAM_LOAD) /* RAM load requires querying bootloader */ int rc; From 39f9f799bedb38a8216312c72fc605581b85480f Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Tue, 8 Apr 2025 10:16:33 +0100 Subject: [PATCH 2074/2141] [nrf noup] mgmt: mcumgr: Fix nRF5340 network core hook Fixes an issue whereby just enabling hooks would enable the nrf5340 network core hook despite lacking other requirements Signed-off-by: Jamie McCrae Signed-off-by: Tomasz Chyrowicz (cherry picked from commit b856d4e37c8b229f4be6975e58f01f3cfc5f8d20) --- subsys/mgmt/mcumgr/CMakeLists.txt | 13 +++++++------ subsys/mgmt/mcumgr/Kconfig | 2 +- subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c | 15 +++------------ subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig | 8 ++++++++ 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/subsys/mgmt/mcumgr/CMakeLists.txt b/subsys/mgmt/mcumgr/CMakeLists.txt index ad088eca0677..3bb21e16f798 100644 --- a/subsys/mgmt/mcumgr/CMakeLists.txt +++ b/subsys/mgmt/mcumgr/CMakeLists.txt @@ -17,10 +17,11 @@ add_subdirectory_ifdef(CONFIG_SMP_CLIENT smp_client) zephyr_library_link_libraries(mgmt_mcumgr) -if (CONFIG_BOOT_IMAGE_ACCESS_HOOKS) - zephyr_include_directories( - ${ZEPHYR_MCUBOOT_MODULE_DIR}/boot/bootutil/include - ${ZEPHYR_MCUBOOT_MODULE_DIR}/boot/zephyr/include - ) - zephyr_library_sources(bootutil_hooks/nrf53_hooks.c) +if(CONFIG_MCUMGR_GRP_IMG_NRF5340_BOOTUTIL_HOOK) + zephyr_include_directories( + ${ZEPHYR_MCUBOOT_MODULE_DIR}/boot/bootutil/include + ${ZEPHYR_MCUBOOT_MODULE_DIR}/boot/zephyr/include + ) + + zephyr_library_sources(bootutil_hooks/nrf53_hooks.c) endif() diff --git a/subsys/mgmt/mcumgr/Kconfig b/subsys/mgmt/mcumgr/Kconfig index 1c6a3a2a5162..c45cb7f81d6b 100644 --- a/subsys/mgmt/mcumgr/Kconfig +++ b/subsys/mgmt/mcumgr/Kconfig @@ -6,7 +6,7 @@ menuconfig MCUMGR bool "mcumgr Support" depends on NET_BUF depends on ZCBOR - imply BOOT_IMAGE_ACCESS_HOOKS if (SOC_NRF5340_CPUAPP_QKAA && MCUMGR_GRP_IMG) + imply BOOT_IMAGE_ACCESS_HOOKS if SOC_NRF5340_CPUAPP && MCUMGR_GRP_IMG && MCUBOOT_NETWORK_CORE_IMAGE_NUMBER > -1 help This option enables the mcumgr management library. diff --git a/subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c b/subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c index f1ac8a168e65..b372ce4e4945 100644 --- a/subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c +++ b/subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c @@ -8,19 +8,10 @@ #include #include "bootutil/bootutil_public.h" -#if CONFIG_MCUBOOT_NETWORK_CORE_IMAGE_NUMBER != -1 -/* Sysbuild */ -#define NET_CORE_IMAGE CONFIG_MCUBOOT_NETWORK_CORE_IMAGE_NUMBER -#else -/* Legacy child/parent */ -#define NET_CORE_IMAGE 1 -#endif - -int boot_read_swap_state_primary_slot_hook(int image_index, - struct boot_swap_state *state) +int boot_read_swap_state_primary_slot_hook(int image_index, struct boot_swap_state *state) { - if (image_index == NET_CORE_IMAGE) { - /* Pretend that primary slot of image 1 unpopulated */ + if (image_index == CONFIG_MCUBOOT_NETWORK_CORE_IMAGE_NUMBER) { + /* Pretend that primary slot of the network core update image is unpopulated */ state->magic = BOOT_MAGIC_UNSET; state->swap_type = BOOT_SWAP_TYPE_NONE; state->image_num = image_index; diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig b/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig index 25979180e2c9..e64f15abd2e6 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig @@ -237,6 +237,14 @@ config MCUMGR_GRP_IMG_SLOT_INFO_HOOKS This will enable the slot info function hooks which can be used to add additional information to responses. +config MCUMGR_GRP_IMG_NRF5340_BOOTUTIL_HOOK + bool "nRF5340 network core bootutil hook" + depends on SOC_NRF5340_CPUAPP && BOOT_IMAGE_ACCESS_HOOKS && MCUBOOT_NETWORK_CORE_IMAGE_NUMBER > -1 + default y + help + This option will enable a bootutil hook that populates the network core update image + slot with dummy data to allow for uploading a firmware update to the network core. + module = MCUMGR_GRP_IMG module-str = mcumgr_grp_img source "subsys/logging/Kconfig.template.log_config" From 79985b13f7b382530f13f89cc9d773a2c0443fe6 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Fri, 7 Nov 2025 14:26:46 +0200 Subject: [PATCH 2075/2141] [nrf fromlist] net: l2: ppp: Allow PPP to transtition ESTABLISH->DEAD When remote peer have closed the PPP link normally, the PPP stack on Zephyr side switches back to ESTABLISH phase to be ready for next handshake. When calling net_if_down() on the interface, it should not try to initiate LCP link termination, but instead go directly to DEAD phase. See https://datatracker.ietf.org/doc/html/rfc1661#section-3.2 Upstream PR #: 99078 Signed-off-by: Seppo Takalo --- subsys/net/l2/ppp/fsm.c | 11 +++++++++++ subsys/net/l2/ppp/lcp.c | 7 ++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/subsys/net/l2/ppp/fsm.c b/subsys/net/l2/ppp/fsm.c index 3dd280230883..e5ca056e1c03 100644 --- a/subsys/net/l2/ppp/fsm.c +++ b/subsys/net/l2/ppp/fsm.c @@ -53,6 +53,13 @@ struct net_if *ppp_fsm_iface(struct ppp_fsm *fsm) return ctx->iface; } +static bool ppp_fsm_is_dead(struct ppp_fsm *fsm) +{ + struct ppp_context *ctx = ppp_fsm_ctx(fsm); + + return ctx->phase == PPP_DEAD; +} + static void fsm_send_configure_req(struct ppp_fsm *fsm, bool retransmit) { struct net_pkt *pkt = NULL; @@ -246,6 +253,10 @@ void ppp_fsm_close(struct ppp_fsm *fsm, const uint8_t *reason) case PPP_STOPPING: ppp_change_state(fsm, PPP_CLOSING); + if (ppp_fsm_is_dead(fsm)) { + fsm->retransmits = 0; + k_work_reschedule(&fsm->timer, K_NO_WAIT); + } break; default: diff --git a/subsys/net/l2/ppp/lcp.c b/subsys/net/l2/ppp/lcp.c index a62a9e52541e..49b0b53ab7e7 100644 --- a/subsys/net/l2/ppp/lcp.c +++ b/subsys/net/l2/ppp/lcp.c @@ -163,7 +163,12 @@ static void lcp_open(struct ppp_context *ctx) static void lcp_close(struct ppp_context *ctx, const uint8_t *reason) { if (ctx->phase != PPP_DEAD) { - ppp_change_phase(ctx, PPP_TERMINATE); + if (ctx->phase == PPP_ESTABLISH) { + /* Link is not established yet, so we can go directly to DEAD */ + ppp_change_phase(ctx, PPP_DEAD); + } else { + ppp_change_phase(ctx, PPP_TERMINATE); + } } ppp_fsm_close(&ctx->lcp.fsm, reason); From 787cf2da33c6640d5781d4a595420dba71fda877 Mon Sep 17 00:00:00 2001 From: Piotr Krzyzanowski Date: Mon, 10 Nov 2025 21:19:15 +0100 Subject: [PATCH 2076/2141] [nrf fromlist] tests: drivers: i2c: i2c_nrfx_twim: add nrf54lm20a Add support for nrf54lm20a board in i2c_nrfx_twim tests Upstream PR #: 99178 Signed-off-by: Piotr Krzyzanowski --- .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 67 +++++++++++++++++++ tests/drivers/i2c/i2c_nrfx_twim/testcase.yaml | 1 + 2 files changed, 68 insertions(+) create mode 100644 tests/drivers/i2c/i2c_nrfx_twim/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay diff --git a/tests/drivers/i2c/i2c_nrfx_twim/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/tests/drivers/i2c/i2c_nrfx_twim/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay new file mode 100644 index 000000000000..1fc56cc63298 --- /dev/null +++ b/tests/drivers/i2c/i2c_nrfx_twim/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * SDA = P1.13 and P1.14 + * SCL = P1.23 and P1.24 + */ + +/ { + aliases { + i2c-controller = &i2c21; + i2c-controller-target = &i2c22; + }; +}; + +&pinctrl { + i2c21_default: i2c21_default { + group1 { + psels = , + ; + bias-pull-up; + }; + }; + + i2c21_sleep: i2c21_sleep { + group1 { + psels = , + ; + low-power-enable; + }; + }; + + i2c22_default: i2c22_default { + group1 { + psels = , + ; + bias-pull-up; + }; + }; + + i2c22_sleep: i2c22_sleep { + group1 { + psels = , + ; + low-power-enable; + }; + }; +}; + +&i2c21 { + pinctrl-0 = <&i2c21_default>; + pinctrl-1 = <&i2c21_sleep>; + pinctrl-names = "default", "sleep"; + zephyr,concat-buf-size = <256>; + status = "okay"; +}; + +&i2c22 { + compatible = "nordic,nrf-twis"; + pinctrl-0 = <&i2c22_default>; + pinctrl-1 = <&i2c22_sleep>; + pinctrl-names = "default", "sleep"; + status = "okay"; +}; diff --git a/tests/drivers/i2c/i2c_nrfx_twim/testcase.yaml b/tests/drivers/i2c/i2c_nrfx_twim/testcase.yaml index 4fa30bae7e84..42d1d98f3af8 100644 --- a/tests/drivers/i2c/i2c_nrfx_twim/testcase.yaml +++ b/tests/drivers/i2c/i2c_nrfx_twim/testcase.yaml @@ -14,6 +14,7 @@ tests: - nrf54h20dk/nrf54h20/cpuapp - nrf54h20dk/nrf54h20/cpuppr - nrf54l15dk/nrf54l15/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp integration_platforms: - nrf5340dk/nrf5340/cpuapp - nrf54l15dk/nrf54l15/cpuapp From 170d5872f3aa80e42d387364beb2a5ac2b7efb6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Stasiak?= Date: Wed, 12 Nov 2025 11:01:42 +0100 Subject: [PATCH 2077/2141] [nrf fromlist] soc: nordic: nrf54l: make SoCs select specific symbols MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As future nRF54L SoCs may differ in terms of content, general SOC_NRF54L_CPUAPP_COMMON symbol needs to cover less symbols. These will be selected by specific SoC based on support. Upstream PR #: 99239 Signed-off-by: Michał Stasiak --- soc/nordic/nrf54l/Kconfig | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/soc/nordic/nrf54l/Kconfig b/soc/nordic/nrf54l/Kconfig index b211d2417cd8..7c09a90cf83c 100644 --- a/soc/nordic/nrf54l/Kconfig +++ b/soc/nordic/nrf54l/Kconfig @@ -13,33 +13,48 @@ config SOC_SERIES_NRF54LX config SOC_NRF54L_CPUAPP_COMMON bool select ARM - select ARMV8_M_DSP select CPU_CORTEX_M33 select CPU_CORTEX_M_HAS_DWT - select CPU_HAS_ARM_MPU select CPU_HAS_ICACHE - select CPU_HAS_ARM_SAU - select CPU_HAS_FPU select HAS_HW_NRF_RADIO_IEEE802154 select HAS_POWEROFF select HAS_NORDIC_RAM_CTRL - select HAS_SWO config SOC_NRF54L05_CPUAPP select SOC_NRF54L_CPUAPP_COMMON + select ARMV8_M_DSP + select CPU_HAS_ARM_MPU + select CPU_HAS_ARM_SAU + select CPU_HAS_FPU + select HAS_SWO config SOC_NRF54L10_CPUAPP select SOC_NRF54L_CPUAPP_COMMON + select ARMV8_M_DSP + select CPU_HAS_ARM_MPU + select CPU_HAS_ARM_SAU + select CPU_HAS_FPU + select HAS_SWO config SOC_NRF54L15_CPUAPP select SOC_NRF54L_CPUAPP_COMMON select SOC_COMPATIBLE_NRF54L15 select SOC_COMPATIBLE_NRF54L15_CPUAPP + select ARMV8_M_DSP + select CPU_HAS_ARM_MPU + select CPU_HAS_ARM_SAU + select CPU_HAS_FPU + select HAS_SWO config SOC_NRF54LM20A_ENGA_CPUAPP select SOC_NRF54L_CPUAPP_COMMON select SOC_COMPATIBLE_NRF54LM20A select SOC_COMPATIBLE_NRF54LM20A_CPUAPP + select ARMV8_M_DSP + select CPU_HAS_ARM_MPU + select CPU_HAS_ARM_SAU + select CPU_HAS_FPU + select HAS_SWO config SOC_NRF54L05_CPUFLPR select RISCV_CORE_NORDIC_VPR From 6726e9b619e25b7a6b92a6f89c514949faf1fdec Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Wed, 12 Nov 2025 15:23:00 +0100 Subject: [PATCH 2078/2141] [nrf fromlist] drivers: can: nrf: use CAN_DEVICE_DT_INST_DEFINE The can_nrf.c device driver used DEVICE_DT_INST_DEFINE instead of CAN_DEVICE_DT_INST_DEFINE, which means we are missing initialization of some CAN structures, namely STATS. Update driver to use CAN_DEVICE_DT_INST_DEFINE() Upstream PR #: 99259 Signed-off-by: Bjarki Arge Andreasen --- drivers/can/can_nrf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/can/can_nrf.c b/drivers/can/can_nrf.c index 38021d764b17..fa287b301ed1 100644 --- a/drivers/can/can_nrf.c +++ b/drivers/can/can_nrf.c @@ -201,8 +201,8 @@ static int can_nrf_init(const struct device *dev) \ static struct can_mcan_data can_mcan_nrf_data##n = CAN_MCAN_DATA_INITIALIZER(NULL); \ \ - DEVICE_DT_INST_DEFINE(n, can_nrf_init, NULL, &can_mcan_nrf_data##n, \ - &can_mcan_nrf_config##n, POST_KERNEL, CONFIG_CAN_INIT_PRIORITY, \ - &can_nrf_api); + CAN_DEVICE_DT_INST_DEFINE(n, can_nrf_init, NULL, &can_mcan_nrf_data##n, \ + &can_mcan_nrf_config##n, POST_KERNEL, CONFIG_CAN_INIT_PRIORITY, \ + &can_nrf_api); DT_INST_FOREACH_STATUS_OKAY(CAN_NRF_DEFINE) From a87ca3f02e8d59b801a6ad594a61e463c3a71a4d Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Mon, 10 Nov 2025 09:14:56 +0100 Subject: [PATCH 2079/2141] [nrf fromlist] drivers: timer: nrf_grtc: Decouple clock source from CLOCK_CONTROL The GRTC timer, typically used as sys clock on newer nordic chips, is currently tightly coupled to the CLOCK_CONTROL_NRF drivers though not being dependent on it. The GRTC and its device driver is independent from CLOCK_CONTROL, its clock requirements are managed by hardware, based on its clock source selection. This commit moves the clock source selection to the GRTC driver, and removes the hard coupling to the CLOCK_CONTROL drivers. To preserve backwards compatibility, if CLOCK_CONTROL_NRF_K32SRC_RC is selected, GRTC will default to LFLPRC. Upstream PR #: 99147 Signed-off-by: Bjarki Arge Andreasen --- drivers/timer/Kconfig.nrf_grtc | 25 +++++++++++++++++++++++++ drivers/timer/nrf_grtc_timer.c | 5 +++-- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/drivers/timer/Kconfig.nrf_grtc b/drivers/timer/Kconfig.nrf_grtc index 082c15333dcb..24534ae3f95c 100644 --- a/drivers/timer/Kconfig.nrf_grtc +++ b/drivers/timer/Kconfig.nrf_grtc @@ -56,4 +56,29 @@ config NRF_GRTC_TIMER_AUTO_KEEP_ALIVE This feature prevents the SYSCOUNTER from sleeping when any core is in active state. +if NRF_GRTC_START_SYSCOUNTER + +choice NRF_GRTC_TIMER_SOURCE + prompt "nRF GRTC clock source" + # Default to LFLPRC if CLOCK_CONTROL_NRF_K32SRC_RC for backwards compatibility + default NRF_GRTC_TIMER_SOURCE_LFLPRC if CLOCK_CONTROL_NRF_K32SRC_RC + # Default to LFXO if present as this allows GRTC to run in SYSTEM OFF + default NRF_GRTC_TIMER_SOURCE_LFXO + # Default to SYSTEM_LFCLK if LFXO is not present + default NRF_GRTC_TIMER_SOURCE_SYSTEM_LFCLK + +config NRF_GRTC_TIMER_SOURCE_LFXO + bool "Use Low Frequency XO as clock source" + depends on $(dt_nodelabel_enabled,lfxo) + +config NRF_GRTC_TIMER_SOURCE_SYSTEM_LFCLK + bool "Use System Low Frequency clock as clock source" + +config NRF_GRTC_TIMER_SOURCE_LFLPRC + bool "Use Low Frequency Low Power RC as clock source" + +endchoice # NRF_GRTC_TIMER_SOURCE + +endif # NRF_GRTC_START_SYSCOUNTER + endif # NRF_GRTC_TIMER diff --git a/drivers/timer/nrf_grtc_timer.c b/drivers/timer/nrf_grtc_timer.c index b0593e3bd135..22aed43d8e47 100644 --- a/drivers/timer/nrf_grtc_timer.c +++ b/drivers/timer/nrf_grtc_timer.c @@ -477,13 +477,14 @@ static int sys_clock_driver_init(void) #endif #if defined(CONFIG_NRF_GRTC_TIMER_CLOCK_MANAGEMENT) && NRF_GRTC_HAS_CLKSEL -#if defined(CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC) +#if defined(CONFIG_NRF_GRTC_TIMER_SOURCE_LFLPRC) /* Switch to LFPRC as the low-frequency clock source. */ nrfx_grtc_clock_source_set(NRF_GRTC_CLKSEL_LFLPRC); -#elif DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lfxo)) +#elif defined(CONFIG_NRF_GRTC_TIMER_SOURCE_LFXO) /* Switch to LFXO as the low-frequency clock source. */ nrfx_grtc_clock_source_set(NRF_GRTC_CLKSEL_LFXO); #else + /* Use LFCLK as the low-frequency clock source. */ nrfx_grtc_clock_source_set(NRF_GRTC_CLKSEL_LFCLK); #endif #endif From 6b314f2dc110080b264e2afa892bae42f9fdf348 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Fri, 31 Oct 2025 17:39:30 +0100 Subject: [PATCH 2080/2141] [nrf fromlist] shell: backends: uart: implement pm_device_runtime The UART device used by the backend needs to be gotten before use, and put after. In limited cases, device drivers call pm_device_runtime_get() as part of the call to uart_rx_enable(), this is not the case for polling, nor interrupt driven API calls for most if not all drivers, nor is that expected. Implement pm_device_runtime calls in shell uart backend similar to the logging uart backend to support all uart drivers in all configurations. Upstream PR #: 98681 Signed-off-by: Bjarki Arge Andreasen --- subsys/shell/backends/shell_uart.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/subsys/shell/backends/shell_uart.c b/subsys/shell/backends/shell_uart.c index 1d19ce19a318..a65c2fb16aef 100644 --- a/subsys/shell/backends/shell_uart.c +++ b/subsys/shell/backends/shell_uart.c @@ -13,6 +13,7 @@ #include #include #include +#include #define LOG_MODULE_NAME shell_uart LOG_MODULE_REGISTER(shell_uart); @@ -290,6 +291,7 @@ static int init(const struct shell_transport *transport, void *context) { struct shell_uart_common *common = (struct shell_uart_common *)transport->ctx; + int ret; common->dev = (const struct device *)config; common->handler = evt_handler; @@ -300,6 +302,11 @@ static int init(const struct shell_transport *transport, k_fifo_init(&common->smp.buf_ready); #endif + ret = pm_device_runtime_get(common->dev); + if (ret < 0) { + return ret; + } + if (IS_ENABLED(CONFIG_SHELL_BACKEND_SERIAL_API_ASYNC)) { async_init((struct shell_uart_async *)transport->ctx); } else if (IS_ENABLED(CONFIG_SHELL_BACKEND_SERIAL_API_INTERRUPT_DRIVEN)) { @@ -331,6 +338,8 @@ static void polling_uninit(struct shell_uart_polling *sh_uart) static int uninit(const struct shell_transport *transport) { + struct shell_uart_common *common = (struct shell_uart_common *)transport->ctx; + if (IS_ENABLED(CONFIG_SHELL_BACKEND_SERIAL_API_ASYNC)) { async_uninit((struct shell_uart_async *)transport->ctx); } else if (IS_ENABLED(CONFIG_SHELL_BACKEND_SERIAL_API_INTERRUPT_DRIVEN)) { @@ -339,7 +348,7 @@ static int uninit(const struct shell_transport *transport) polling_uninit((struct shell_uart_polling *)transport->ctx); } - return 0; + return pm_device_runtime_put(common->dev); } static int enable(const struct shell_transport *transport, bool blocking_tx) From 1c47222ff422caf03e48a063c22fe3d54f7f9b3c Mon Sep 17 00:00:00 2001 From: Ryan Erickson Date: Mon, 15 Sep 2025 15:09:55 -0500 Subject: [PATCH 2081/2141] [nrf fromtree] drivers: can: tcan4x5x: Add device PM support Add support for device runtime power management. Suspending the device will place it into sleep mode, its lowest power state. All config will be lost when suspending the device. Do not allow suspending the device if it is started or has RX filters registered. The application has to reconfigure the CAN device to resume expected operation. Signed-off-by: Ryan Erickson (cherry picked from commit 631dbd98b436c659fa6956a2cacd78a7f6817fc7) --- drivers/can/can_mcan.c | 35 +++++++ drivers/can/can_tcan4x5x.c | 208 +++++++++++++++++++++++++++++-------- 2 files changed, 197 insertions(+), 46 deletions(-) diff --git a/drivers/can/can_mcan.c b/drivers/can/can_mcan.c index 3f7d771e5f4a..a69a4b2398df 100644 --- a/drivers/can/can_mcan.c +++ b/drivers/can/can_mcan.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -322,10 +323,32 @@ int can_mcan_start(const struct device *dev) } data->common.started = true; + pm_device_busy_set(dev); return err; } +static bool can_mcan_rx_filters_exist(const struct device *dev) +{ + const struct can_mcan_config *config = dev->config; + const struct can_mcan_callbacks *cbs = config->callbacks; + int i; + + for (i = 0; i < cbs->num_std; i++) { + if (cbs->std[i].function != NULL) { + return true; + } + } + + for (i = 0; i < cbs->num_ext; i++) { + if (cbs->ext[i].function != NULL) { + return true; + } + } + + return false; +} + int can_mcan_stop(const struct device *dev) { const struct can_mcan_config *config = dev->config; @@ -368,6 +391,12 @@ int can_mcan_stop(const struct device *dev) } } + k_mutex_lock(&data->lock, K_FOREVER); + if (!can_mcan_rx_filters_exist(dev)) { + pm_device_busy_clear(dev); + } + k_mutex_unlock(&data->lock); + return 0; } @@ -1184,6 +1213,8 @@ int can_mcan_add_rx_filter(const struct device *dev, can_rx_callback_t callback, filter_id = can_mcan_add_rx_filter_std(dev, callback, user_data, filter); } + pm_device_busy_set(dev); + return filter_id; } @@ -1230,6 +1261,10 @@ void can_mcan_remove_rx_filter(const struct device *dev, int filter_id) } } + if (!can_mcan_rx_filters_exist(dev) && !data->common.started) { + pm_device_busy_clear(dev); + } + k_mutex_unlock(&data->lock); } diff --git a/drivers/can/can_tcan4x5x.c b/drivers/can/can_tcan4x5x.c index 2abd0467a5ee..31f61b7dd72d 100644 --- a/drivers/can/can_tcan4x5x.c +++ b/drivers/can/can_tcan4x5x.c @@ -12,6 +12,8 @@ #include #include #include +#include +#include LOG_MODULE_REGISTER(can_tcan4x5x, CONFIG_CAN_LOG_LEVEL); @@ -100,6 +102,10 @@ LOG_MODULE_REGISTER(can_tcan4x5x, CONFIG_CAN_LOG_LEVEL); #define CAN_TCAN4X5X_MODE_CONFIG_SWE_DIS BIT(1) #define CAN_TCAN4X5X_MODE_CONFIG_TEST_MODE_CONFIG BIT(0) +#define CAN_TCAN4X5X_MODE_CONFIG_MODE_SEL_SLEEP 0 +#define CAN_TCAN4X5X_MODE_CONFIG_MODE_SEL_STANDBY 1 +#define CAN_TCAN4X5X_MODE_CONFIG_MODE_SEL_NORMAL 2 + /* Timestamp Prescaler register */ #define CAN_TCAN4X5X_TIMESTAMP_PRESCALER 0x0804 #define CAN_TCAN4X5X_TIMESTAMP_PRESCALER_MASK GENMASK(7, 0) @@ -201,6 +207,9 @@ LOG_MODULE_REGISTER(can_tcan4x5x, CONFIG_CAN_LOG_LEVEL); /* TCAN4x5x timing requirements */ #define CAN_TCAN4X5X_T_MODE_STBY_NOM_US 70 +#define CAN_TCAN4X5X_T_MODE_NOM_SLP_US 200 +#define CAN_TCAN4X5X_T_MODE_NOM_STBY_US 200 +#define CAN_TCAN4X5X_T_MODE_SLP_STBY_US 200 #define CAN_TCAN4X5X_T_WAKE_US 50 #define CAN_TCAN4X5X_T_PULSE_WIDTH_US 30 #define CAN_TCAN4X5X_T_RESET_US 1000 @@ -551,6 +560,154 @@ static int tcan4x5x_reset(const struct device *dev) return 0; } +static int tcan4x5x_set_config_mode_sel(const struct device *dev, uint8_t mode, uint32_t *reg) +{ + int err; + uint8_t current_mode; + + switch (mode) { + case CAN_TCAN4X5X_MODE_CONFIG_MODE_SEL_SLEEP: + case CAN_TCAN4X5X_MODE_CONFIG_MODE_SEL_STANDBY: + case CAN_TCAN4X5X_MODE_CONFIG_MODE_SEL_NORMAL: + break; + default: + LOG_ERR("invalid mode %u", mode); + return -EINVAL; + } + + err = tcan4x5x_read_tcan_reg(dev, CAN_TCAN4X5X_MODE_CONFIG, reg); + if (err != 0) { + LOG_ERR("failed to read configuration register (err %d)", err); + return -EIO; + } + + current_mode = FIELD_GET(CAN_TCAN4X5X_MODE_CONFIG_MODE_SEL, *reg); + LOG_DBG("current mode %u, new mode %u", current_mode, mode); + + *reg &= ~(CAN_TCAN4X5X_MODE_CONFIG_MODE_SEL); + *reg |= FIELD_PREP(CAN_TCAN4X5X_MODE_CONFIG_MODE_SEL, mode); + + err = tcan4x5x_write_tcan_reg(dev, CAN_TCAN4X5X_MODE_CONFIG, *reg); + if (err != 0) { + LOG_ERR("failed to write configuration register (err %d)", err); + return -EIO; + } + + if (current_mode == CAN_TCAN4X5X_MODE_CONFIG_MODE_SEL_STANDBY && + mode == CAN_TCAN4X5X_MODE_CONFIG_MODE_SEL_NORMAL) { + /* Wait for standby to normal mode switch */ + k_busy_wait(CAN_TCAN4X5X_T_MODE_STBY_NOM_US); + } else if (current_mode == CAN_TCAN4X5X_MODE_CONFIG_MODE_SEL_NORMAL && + mode == CAN_TCAN4X5X_MODE_CONFIG_MODE_SEL_SLEEP) { + /* Wait for normal to sleep mode switch */ + k_busy_wait(CAN_TCAN4X5X_T_MODE_NOM_SLP_US); + } else if (current_mode == CAN_TCAN4X5X_MODE_CONFIG_MODE_SEL_NORMAL && + mode == CAN_TCAN4X5X_MODE_CONFIG_MODE_SEL_STANDBY) { + /* Wait for normal to standby mode switch */ + k_busy_wait(CAN_TCAN4X5X_T_MODE_NOM_STBY_US); + } else if (current_mode == CAN_TCAN4X5X_MODE_CONFIG_MODE_SEL_SLEEP && + mode == CAN_TCAN4X5X_MODE_CONFIG_MODE_SEL_STANDBY) { + /* Wait for sleep to standby mode switch */ + k_busy_wait(CAN_TCAN4X5X_T_MODE_SLP_STBY_US); + } + + return 0; +} + +static int tcan4x5x_init_normal_mode(const struct device *dev) +{ + const struct can_mcan_config *mcan_config = dev->config; + const struct tcan4x5x_config *tcan_config = mcan_config->custom; + int err = 0; + uint32_t reg; + + /* Set TCAN4x5x mode normal */ + err = tcan4x5x_set_config_mode_sel(dev, CAN_TCAN4X5X_MODE_CONFIG_MODE_SEL_NORMAL, ®); + if (err != 0) { + return -ENODEV; + } + + /* Configure the frequency reference */ + if (tcan_config->clk_freq == MHZ(20)) { + /* 20 MHz frequency reference */ + reg &= ~(CAN_TCAN4X5X_MODE_CONFIG_CLK_REF); + } else { + /* 40 MHz frequency reference */ + reg |= CAN_TCAN4X5X_MODE_CONFIG_CLK_REF; + } + + /* Set nWKRQ voltage to VIO */ + reg |= CAN_TCAN4X5X_MODE_CONFIG_NWKRQ_VOLTAGE; + + /* Write remaining configuration to the device */ + err = tcan4x5x_write_tcan_reg(dev, CAN_TCAN4X5X_MODE_CONFIG, reg); + if (err != 0) { + LOG_ERR("failed to write configuration register (err %d)", err); + return -EIO; + } + + /* Configure Message RAM */ + err = can_mcan_configure_mram(dev, CAN_TCAN4X5X_MRAM_BASE, CAN_TCAN4X5X_MRAM_BASE); + if (err != 0) { + return -EIO; + } + + /* Initialize M_CAN */ + err = can_mcan_init(dev); + if (err != 0) { + LOG_ERR("failed to initialize mcan (err %d)", err); + return err; + } + + return err; +} + +#ifdef CONFIG_PM_DEVICE +static int tcan4x5x_pm_control(const struct device *dev, enum pm_device_action action) +{ + int err = 0; + uint32_t reg; + + switch (action) { + case PM_DEVICE_ACTION_SUSPEND: + if (pm_device_is_busy(dev)) { + LOG_DBG("Cannot suspend while device is busy"); + return -EBUSY; + } + + /* + * Enter sleep mode. + * NOTE: All RX filters are cleared when entering sleep mode. + * User must remove and re-add filters at the application layer. + */ + err = tcan4x5x_set_config_mode_sel(dev, CAN_TCAN4X5X_MODE_CONFIG_MODE_SEL_SLEEP, + ®); + return err; + case PM_DEVICE_ACTION_RESUME: + /* Wake up the device */ +#if TCAN4X5X_WAKE_GPIO_SUPPORT + LOG_DBG("Waking up TCAN4x5x via WAKE GPIO"); + err = tcan4x5x_wake(dev); + if (err != 0) { + return err; + } +#else + LOG_DBG("Waking up TCAN4x5x via reset"); + err = tcan4x5x_reset(dev); + if (err != 0) { + return err; + } +#endif + /* Enter normal mode */ + return tcan4x5x_init_normal_mode(dev); + default: + break; + } + + return -ENOTSUP; +} +#endif /* CONFIG_PM_DEVICE */ + static int tcan4x5x_init(const struct device *dev) { const struct can_mcan_config *mcan_config = dev->config; @@ -558,7 +715,6 @@ static int tcan4x5x_init(const struct device *dev) struct can_mcan_data *mcan_data = dev->data; struct tcan4x5x_data *tcan_data = mcan_data->custom; k_tid_t tid; - uint32_t reg; int err; /* Initialize int_sem to 1 to ensure any pending IRQ is serviced */ @@ -671,48 +827,7 @@ static int tcan4x5x_init(const struct device *dev) FIELD_GET(GENMASK(15, 8), info[2]), FIELD_GET(GENMASK(7, 0), info[2])); #endif /* CONFIG_CAN_LOG_LEVEL >= LOG_LEVEL_DBG */ - /* Set TCAN4x5x mode normal */ - err = tcan4x5x_read_tcan_reg(dev, CAN_TCAN4X5X_MODE_CONFIG, ®); - if (err != 0) { - LOG_ERR("failed to read configuration register (err %d)", err); - return -ENODEV; - } - - reg &= ~(CAN_TCAN4X5X_MODE_CONFIG_MODE_SEL); - reg |= FIELD_PREP(CAN_TCAN4X5X_MODE_CONFIG_MODE_SEL, 0x02); - reg |= CAN_TCAN4X5X_MODE_CONFIG_WAKE_CONFIG; - - if (tcan_config->clk_freq == MHZ(20)) { - /* 20 MHz frequency reference */ - reg &= ~(CAN_TCAN4X5X_MODE_CONFIG_CLK_REF); - } else { - /* 40 MHz frequency reference */ - reg |= CAN_TCAN4X5X_MODE_CONFIG_CLK_REF; - } - - err = tcan4x5x_write_tcan_reg(dev, CAN_TCAN4X5X_MODE_CONFIG, reg); - if (err != 0) { - LOG_ERR("failed to write configuration register (err %d)", err); - return -ENODEV; - } - - /* Wait for standby to normal mode switch */ - k_busy_wait(CAN_TCAN4X5X_T_MODE_STBY_NOM_US); - - /* Configure Message RAM */ - err = can_mcan_configure_mram(dev, CAN_TCAN4X5X_MRAM_BASE, CAN_TCAN4X5X_MRAM_BASE); - if (err != 0) { - return -EIO; - } - - /* Initialize M_CAN */ - err = can_mcan_init(dev); - if (err != 0) { - LOG_ERR("failed to initialize mcan (err %d)", err); - return err; - } - - return 0; + return tcan4x5x_init_normal_mode(dev); } static DEVICE_API(can, tcan4x5x_driver_api) = { @@ -794,8 +909,9 @@ static const struct can_mcan_ops tcan4x5x_ops = { static struct can_mcan_data can_mcan_data_##inst = \ CAN_MCAN_DATA_INITIALIZER(&tcan4x5x_data_##inst); \ \ - CAN_DEVICE_DT_INST_DEFINE(inst, tcan4x5x_init, NULL, &can_mcan_data_##inst, \ - &can_mcan_config_##inst, POST_KERNEL, CONFIG_CAN_INIT_PRIORITY, \ - &tcan4x5x_driver_api); + PM_DEVICE_DT_INST_DEFINE(inst, tcan4x5x_pm_control); \ + CAN_DEVICE_DT_INST_DEFINE(inst, tcan4x5x_init, PM_DEVICE_DT_INST_GET(inst), \ + &can_mcan_data_##inst, &can_mcan_config_##inst, POST_KERNEL, \ + CONFIG_CAN_INIT_PRIORITY, &tcan4x5x_driver_api); DT_INST_FOREACH_STATUS_OKAY(TCAN4X5X_INIT) From 03695ed17974fb0d6a0bae360d431fa4c984972f Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Thu, 6 Nov 2025 20:37:33 +0100 Subject: [PATCH 2082/2141] [nrf noup] drivers: can: mcan: implement CAN_MODE_ONE_SHOT Implement CAN_MODE_ONE_SHOT in MCAN impementation. The implementation contains a workaround for a bug in the MCAN IP which prevents an IRQ from triggering. This is a noup as the workaround is too complicated and the feature is too niche to be accepted it upstream. Signed-off-by: Bjarki Arge Andreasen --- drivers/can/Kconfig.mcan | 15 ++++ drivers/can/can_mcan.c | 114 +++++++++++++++++++++++++- include/zephyr/drivers/can/can_mcan.h | 1 + 3 files changed, 128 insertions(+), 2 deletions(-) diff --git a/drivers/can/Kconfig.mcan b/drivers/can/Kconfig.mcan index db09fc800c11..96c5f22446f6 100644 --- a/drivers/can/Kconfig.mcan +++ b/drivers/can/Kconfig.mcan @@ -7,3 +7,18 @@ config CAN_MCAN bool help Enable the Bosch M_CAN CAN IP module driver backend. + +if CAN_MCAN + +config CAN_MCAN_TXBCF_POLL_INTERVAL_MS + int "Polling interval in milliseconds of TXBCF register if DAR is enabled" + default 75 + help + When DAR (Disable Automatic Retransmission), used for CAN_MODE_ONE_SHOT, + is enabled, and a transmission fails, a bug in the MCAN IP prevents the + TCF (Transmission Cancellation Finalized) interrupt from triggering, + despite the correct bit being set in the TXBCF register. It is thus + necessary to poll TXBCF register to detect when a transmission failed if + DAR is enabled. + +endif # CAN_MCAN diff --git a/drivers/can/can_mcan.c b/drivers/can/can_mcan.c index a69a4b2398df..e82cac4f19ad 100644 --- a/drivers/can/can_mcan.c +++ b/drivers/can/can_mcan.c @@ -17,6 +17,7 @@ LOG_MODULE_REGISTER(can_mcan, CONFIG_CAN_LOG_LEVEL); #define CAN_INIT_TIMEOUT_MS 100 +#define TXBCF_TIMER_TIMEOUT K_MSEC(CONFIG_CAN_MCAN_TXBCF_POLL_INTERVAL_MS) int can_mcan_read_reg(const struct device *dev, uint16_t reg, uint32_t *val) { @@ -276,7 +277,7 @@ int can_mcan_get_capabilities(const struct device *dev, can_mode_t *cap) { ARG_UNUSED(dev); - *cap = CAN_MODE_NORMAL | CAN_MODE_LOOPBACK | CAN_MODE_LISTENONLY; + *cap = CAN_MODE_NORMAL | CAN_MODE_LOOPBACK | CAN_MODE_LISTENONLY | CAN_MODE_ONE_SHOT; if (IS_ENABLED(CONFIG_CAN_MANUAL_RECOVERY_MODE)) { *cap |= CAN_MODE_MANUAL_RECOVERY; @@ -322,12 +323,78 @@ int can_mcan_start(const struct device *dev) return err; } + uint32_t cccr; + + err = can_mcan_read_reg(dev, CAN_MCAN_CCCR, &cccr); + if (err != 0) { + return err; + } + + if (cccr & CAN_MCAN_CCCR_DAR) { + /* + * When DAR (Disable Automatic Retransmission), used for CAN_MODE_ONE_SHOT, + * is enabled, and a transmission fails, a bug in the MCAN IP prevents the + * TCF (Transmission Cancellation Finalized) interrupt from triggering, + * despite the correct bit being set in the TXBCF register. It is thus + * necessary to poll TXBCF register to detect when a transmission failed if + * DAR is enabled. + */ + k_timer_start(&data->txbcf_timer, TXBCF_TIMER_TIMEOUT, TXBCF_TIMER_TIMEOUT); + } + data->common.started = true; pm_device_busy_set(dev); return err; } +static int can_mcan_read_txbcf(const struct device *dev) +{ + const struct can_mcan_config *config = dev->config; + const struct can_mcan_callbacks *cbs = config->callbacks; + struct can_mcan_data *data = dev->data; + uint32_t txbcfs; + int err; + can_tx_callback_t tx_cb; + void *user_data; + + err = can_mcan_read_reg(dev, CAN_MCAN_TXBCF, &txbcfs); + if (err != 0) { + LOG_ERR("failed to read tx cancellation finished (err %d)", err); + return err; + } + + if (txbcfs == 0) { + return 0; + } + + for (size_t tx_idx = 0; tx_idx < cbs->num_tx; tx_idx++) { + if ((txbcfs & BIT(tx_idx)) == 0) { + continue; + } + + if (cbs->tx[tx_idx].function == NULL) { + continue; + } + + tx_cb = cbs->tx[tx_idx].function; + user_data = cbs->tx[tx_idx].user_data; + cbs->tx[tx_idx].function = NULL; + LOG_DBG("tx buffer cancellation finished (idx %u)", tx_idx); + k_sem_give(&data->tx_sem); + tx_cb(dev, -EIO, user_data); + } + + return 0; +} + +static void can_mcan_txbcf_timer_handler(struct k_timer *timer_id) +{ + const struct device *dev = k_timer_user_data_get(timer_id); + + can_mcan_read_txbcf(dev); +} + static bool can_mcan_rx_filters_exist(const struct device *dev) { const struct can_mcan_config *config = dev->config; @@ -362,6 +429,8 @@ int can_mcan_stop(const struct device *dev) return -EALREADY; } + k_timer_stop(&data->txbcf_timer); + /* CAN transmissions are automatically stopped when entering init mode */ err = can_mcan_enter_init_mode(dev, K_MSEC(CAN_INIT_TIMEOUT_MS)); if (err != 0) { @@ -402,7 +471,7 @@ int can_mcan_stop(const struct device *dev) int can_mcan_set_mode(const struct device *dev, can_mode_t mode) { - can_mode_t supported = CAN_MODE_LOOPBACK | CAN_MODE_LISTENONLY; + can_mode_t supported = CAN_MODE_LOOPBACK | CAN_MODE_LISTENONLY | CAN_MODE_ONE_SHOT; struct can_mcan_data *data = dev->data; uint32_t cccr; uint32_t test; @@ -460,6 +529,13 @@ int can_mcan_set_mode(const struct device *dev, can_mode_t mode) } #endif /* CONFIG_CAN_FD_MODE */ + if ((mode & CAN_MODE_ONE_SHOT) != 0) { + /* Disable Automatic Retransmission */ + cccr |= CAN_MCAN_CCCR_DAR; + } else { + cccr &= ~CAN_MCAN_CCCR_DAR; + } + err = can_mcan_write_reg(dev, CAN_MCAN_CCCR, cccr); if (err != 0) { goto unlock; @@ -1053,6 +1129,21 @@ int can_mcan_send(const struct device *dev, const struct can_frame *frame, k_tim } } + uint32_t cccr; + + err = can_mcan_read_reg(dev, CAN_MCAN_CCCR, &cccr); + if (err != 0) { + return err; + } + + if (cccr & CAN_MCAN_CCCR_DAR) { + /* + * TXBCR is cleared after TXBAR is set. Stop timer to ensure + * TXBCR is not read before TXBAR has been set. + */ + k_timer_stop(&data->txbcf_timer); + } + __ASSERT_NO_MSG(put_idx < cbs->num_tx); cbs->tx[put_idx].function = callback; cbs->tx[put_idx].user_data = user_data; @@ -1063,10 +1154,18 @@ int can_mcan_send(const struct device *dev, const struct can_frame *frame, k_tim goto err_unlock; } + if (cccr & CAN_MCAN_CCCR_DAR) { + k_timer_start(&data->txbcf_timer, TXBCF_TIMER_TIMEOUT, TXBCF_TIMER_TIMEOUT); + } + k_mutex_unlock(&data->tx_mtx); return 0; err_unlock: + if (cccr & CAN_MCAN_CCCR_DAR) { + k_timer_start(&data->txbcf_timer, TXBCF_TIMER_TIMEOUT, TXBCF_TIMER_TIMEOUT); + } + k_mutex_unlock(&data->tx_mtx); k_sem_give(&data->tx_sem); @@ -1424,6 +1523,8 @@ int can_mcan_init(const struct device *dev) k_mutex_init(&data->lock); k_mutex_init(&data->tx_mtx); k_sem_init(&data->tx_sem, cbs->num_tx, cbs->num_tx); + k_timer_init(&data->txbcf_timer, can_mcan_txbcf_timer_handler, NULL); + k_timer_user_data_set(&data->txbcf_timer, (void *)dev); if (config->common.phy != NULL && !device_is_ready(config->common.phy)) { LOG_ERR("CAN transceiver not ready"); @@ -1565,5 +1666,14 @@ int can_mcan_init(const struct device *dev) return err; } + /* + * Interrupt on every TX buffer cancellation finished event. + */ + reg = CAN_MCAN_TXBCIE_CFIE; + err = can_mcan_write_reg(dev, CAN_MCAN_TXBCIE, reg); + if (err != 0) { + return err; + } + return can_mcan_clear_mram(dev, 0, config->mram_size); } diff --git a/include/zephyr/drivers/can/can_mcan.h b/include/zephyr/drivers/can/can_mcan.h index 25eeb437efba..28aa899371c8 100644 --- a/include/zephyr/drivers/can/can_mcan.h +++ b/include/zephyr/drivers/can/can_mcan.h @@ -1065,6 +1065,7 @@ struct can_mcan_data { struct k_mutex lock; struct k_sem tx_sem; struct k_mutex tx_mtx; + struct k_timer txbcf_timer; void *custom; } __aligned(4); From 5ce544de9868ac2bb919b608b7b3e8d0c443f34f Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Tue, 21 Oct 2025 13:10:36 +0200 Subject: [PATCH 2083/2141] [nrf fromtree] drivers: nrf: remove handling of cross domain pins Remove the handling of cross domain pins from nrf drivers. To use cross domain in tests, force on constlat and disable power domains for the test. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit 306c3d483e932479248e9e3f0141ddc9c507ff1b) --- drivers/serial/uart_nrfx_uarte.c | 84 ------------------ drivers/spi/spi_nrfx_spim.c | 85 ------------------- drivers/spi/spi_nrfx_spis.c | 84 ------------------ dts/bindings/spi/nordic,nrf-spi-common.yaml | 10 --- dts/vendor/nordic/nrf54l_05_10_15.dtsi | 8 -- .../spi_controller_peripheral/testcase.yaml | 2 + .../uart/uart_elementary/testcase.yaml | 1 + 7 files changed, 3 insertions(+), 271 deletions(-) diff --git a/drivers/serial/uart_nrfx_uarte.c b/drivers/serial/uart_nrfx_uarte.c index 08cb236b918d..ffb090ca16f1 100644 --- a/drivers/serial/uart_nrfx_uarte.c +++ b/drivers/serial/uart_nrfx_uarte.c @@ -127,27 +127,6 @@ LOG_MODULE_REGISTER(uart_nrfx_uarte, CONFIG_UART_LOG_LEVEL); */ #define UARTE_ANY_HIGH_SPEED (UARTE_FOR_EACH_INSTANCE(INSTANCE_IS_HIGH_SPEED, (||), (0))) -#define UARTE_PINS_CROSS_DOMAIN(unused, prefix, idx, _) \ - COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(UARTE(prefix##idx)), \ - (UARTE_PROP(idx, cross_domain_pins_supported)), \ - (0)) - -#if UARTE_FOR_EACH_INSTANCE(UARTE_PINS_CROSS_DOMAIN, (||), (0)) -#include -/* Certain UARTE instances support usage of cross domain pins in form of dedicated pins on - * a port different from the default one. - */ -#define UARTE_CROSS_DOMAIN_PINS_SUPPORTED 1 -#endif - -#if UARTE_CROSS_DOMAIN_PINS_SUPPORTED && defined(CONFIG_NRF_SYS_EVENT) -#include -/* To use cross domain pins, constant latency mode needs to be applied, which is - * handled via nrf_sys_event requests. - */ -#define UARTE_CROSS_DOMAIN_PINS_HANDLE 1 -#endif - #ifdef UARTE_ANY_CACHE /* uart120 instance does not retain BAUDRATE register when ENABLE=0. When this instance * is used then baudrate must be set after enabling the peripheral and not before. @@ -415,10 +394,6 @@ struct uarte_nrfx_config { #endif uint8_t *poll_out_byte; uint8_t *poll_in_byte; -#if UARTE_CROSS_DOMAIN_PINS_SUPPORTED - bool cross_domain; - int8_t default_port; -#endif }; /* Using Macro instead of static inline function to handle NO_OPTIMIZATIONS case @@ -493,32 +468,6 @@ static void uarte_disable_locked(const struct device *dev, uint32_t dis_mask) (void)pinctrl_apply_state(config->pcfg, PINCTRL_STATE_SLEEP); } -#if UARTE_CROSS_DOMAIN_PINS_SUPPORTED -static bool uarte_has_cross_domain_connection(const struct uarte_nrfx_config *config) -{ - const struct pinctrl_dev_config *pcfg = config->pcfg; - const struct pinctrl_state *state; - int ret; - - ret = pinctrl_lookup_state(pcfg, PINCTRL_STATE_DEFAULT, &state); - if (ret < 0) { - LOG_ERR("Unable to read pin state"); - return false; - } - - for (uint8_t i = 0U; i < state->pin_cnt; i++) { - uint32_t pin = NRF_GET_PIN(state->pins[i]); - - if ((pin != NRF_PIN_DISCONNECTED) && - (nrf_gpio_pin_port_number_extract(&pin) != config->default_port)) { - return true; - } - } - - return false; -} -#endif - #if defined(UARTE_ANY_NONE_ASYNC) && !defined(CONFIG_UART_NRFX_UARTE_NO_IRQ) /** * @brief Interrupt service routine. @@ -805,20 +754,6 @@ static void uarte_periph_enable(const struct device *dev) (void)pinctrl_apply_state(config->pcfg, PINCTRL_STATE_DEFAULT); nrf_uarte_enable(uarte); -#if UARTE_CROSS_DOMAIN_PINS_SUPPORTED - if (config->cross_domain && uarte_has_cross_domain_connection(config)) { -#if UARTE_CROSS_DOMAIN_PINS_HANDLE - int err; - - err = nrf_sys_event_request_global_constlat(); - (void)err; - __ASSERT_NO_MSG(err >= 0); -#else - __ASSERT(false, "NRF_SYS_EVENT needs to be enabled to use cross domain pins.\n"); -#endif - } -#endif - #if UARTE_BAUDRATE_RETENTION_WORKAROUND if (config->flags & UARTE_CFG_FLAG_VOLATILE_BAUDRATE) { nrf_uarte_baudrate_set(uarte, @@ -3175,20 +3110,6 @@ static void uarte_pm_suspend(const struct device *dev) wait_for_tx_stopped(dev); } -#if UARTE_CROSS_DOMAIN_PINS_SUPPORTED - if (cfg->cross_domain && uarte_has_cross_domain_connection(cfg)) { -#if UARTE_CROSS_DOMAIN_PINS_HANDLE - int err; - - err = nrf_sys_event_release_global_constlat(); - (void)err; - __ASSERT_NO_MSG(err >= 0); -#else - __ASSERT(false, "NRF_SYS_EVENT needs to be enabled to use cross domain pins.\n"); -#endif - } -#endif - (void)pinctrl_apply_state(cfg->pcfg, PINCTRL_STATE_SLEEP); nrf_uarte_disable(uarte); } @@ -3518,11 +3439,6 @@ static int uarte_instance_deinit(const struct device *dev) IF_ENABLED(CONFIG_UART_##idx##_NRF_HW_ASYNC, \ (.timer = NRFX_TIMER_INSTANCE( \ CONFIG_UART_##idx##_NRF_HW_ASYNC_TIMER),)) \ - IF_ENABLED(UARTE_PINS_CROSS_DOMAIN(_, /*empty*/, idx, _), \ - (.cross_domain = true, \ - .default_port = \ - DT_PROP_OR(DT_PHANDLE(UARTE(idx), \ - default_gpio_port), port, -1),)) \ }; \ UARTE_DIRECT_ISR_DECLARE(idx) \ static int uarte_##idx##_init(const struct device *dev) \ diff --git a/drivers/spi/spi_nrfx_spim.c b/drivers/spi/spi_nrfx_spim.c index 44451be58bc7..390682260c81 100644 --- a/drivers/spi/spi_nrfx_spim.c +++ b/drivers/spi/spi_nrfx_spim.c @@ -54,28 +54,6 @@ LOG_MODULE_REGISTER(spi_nrfx_spim, CONFIG_SPI_LOG_LEVEL); #define SPIM_FOR_EACH_INSTANCE(f, sep, off_code, ...) \ NRFX_FOREACH_PRESENT(SPIM, f, sep, off_code, __VA_ARGS__) -#define SPIM_PINS_CROSS_DOMAIN(unused, prefix, idx, _) \ - COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(SPIM(prefix##idx)), \ - (SPIM_PROP(idx, cross_domain_pins_supported)), \ - (0)) - -#if NRFX_FOREACH_PRESENT(SPIM, SPIM_PINS_CROSS_DOMAIN, (||), (0)) -#include -/* Certain SPIM instances support usage of cross domain pins in form of dedicated pins on - * a port different from the default one. - */ -#define SPIM_CROSS_DOMAIN_SUPPORTED 1 -#endif - -#if SPIM_CROSS_DOMAIN_SUPPORTED && defined(CONFIG_NRF_SYS_EVENT) -#include -/* To use cross domain pins, constant latency mode needs to be applied, which is - * handled via nrf_sys_event requests. - */ -#define SPIM_CROSS_DOMAIN_PINS_HANDLE 1 -#endif - - struct spi_nrfx_data { struct spi_context ctx; const struct device *dev; @@ -105,41 +83,11 @@ struct spi_nrfx_config { #endif uint32_t wake_pin; nrfx_gpiote_t wake_gpiote; -#if SPIM_CROSS_DOMAIN_SUPPORTED - bool cross_domain; - int8_t default_port; -#endif void *mem_reg; }; static void event_handler(const nrfx_spim_evt_t *p_event, void *p_context); -#if SPIM_CROSS_DOMAIN_SUPPORTED -static bool spim_has_cross_domain_connection(const struct spi_nrfx_config *config) -{ - const struct pinctrl_dev_config *pcfg = config->pcfg; - const struct pinctrl_state *state; - int ret; - - ret = pinctrl_lookup_state(pcfg, PINCTRL_STATE_DEFAULT, &state); - if (ret < 0) { - LOG_ERR("Unable to read pin state"); - return false; - } - - for (uint8_t i = 0U; i < state->pin_cnt; i++) { - uint32_t pin = NRF_GET_PIN(state->pins[i]); - - if ((pin != NRF_PIN_DISCONNECTED) && - (nrf_gpio_pin_port_number_extract(&pin) != config->default_port)) { - return true; - } - } - - return false; -} -#endif - static inline void finalize_spi_transaction(const struct device *dev, bool deactivate_cs) { struct spi_nrfx_data *dev_data = dev->data; @@ -686,20 +634,6 @@ static int spim_resume(const struct device *dev) return -EAGAIN; } -#if SPIM_CROSS_DOMAIN_SUPPORTED - if (dev_config->cross_domain && spim_has_cross_domain_connection(dev_config)) { -#if SPIM_CROSS_DOMAIN_PINS_HANDLE - int err; - - err = nrf_sys_event_request_global_constlat(); - (void)err; - __ASSERT_NO_MSG(err >= 0); -#else - __ASSERT(false, "NRF_SYS_EVENT needs to be enabled to use cross domain pins.\n"); -#endif - } -#endif - return 0; } @@ -715,20 +649,6 @@ static void spim_suspend(const struct device *dev) spi_context_cs_put_all(&dev_data->ctx); -#if SPIM_CROSS_DOMAIN_SUPPORTED - if (dev_config->cross_domain && spim_has_cross_domain_connection(dev_config)) { -#if SPIM_CROSS_DOMAIN_PINS_HANDLE - int err; - - err = nrf_sys_event_release_global_constlat(); - (void)err; - __ASSERT_NO_MSG(err >= 0); -#else - __ASSERT(false, "NRF_SYS_EVENT needs to be enabled to use cross domain pins.\n"); -#endif - } -#endif - (void)pinctrl_apply_state(dev_config->pcfg, PINCTRL_STATE_SLEEP); } @@ -866,11 +786,6 @@ static int spi_nrfx_deinit(const struct device *dev) .wake_pin = NRF_DT_GPIOS_TO_PSEL_OR(SPIM(idx), wake_gpios, \ WAKE_PIN_NOT_USED), \ .wake_gpiote = WAKE_GPIOTE_INSTANCE(SPIM(idx)), \ - IF_ENABLED(SPIM_PINS_CROSS_DOMAIN(_, /*empty*/, idx, _), \ - (.cross_domain = true, \ - .default_port = \ - DT_PROP_OR(DT_PHANDLE(SPIM(idx), \ - default_gpio_port), port, -1),)) \ .mem_reg = DMM_DEV_TO_REG(SPIM(idx)), \ }; \ BUILD_ASSERT(!SPIM_HAS_PROP(idx, wake_gpios) || \ diff --git a/drivers/spi/spi_nrfx_spis.c b/drivers/spi/spi_nrfx_spis.c index 4d1a9070c1ac..0861ed3c2f54 100644 --- a/drivers/spi/spi_nrfx_spis.c +++ b/drivers/spi/spi_nrfx_spis.c @@ -32,27 +32,6 @@ LOG_MODULE_REGISTER(spi_nrfx_spis, CONFIG_SPI_LOG_LEVEL); #define SPIS_PROP(idx, prop) DT_PROP(SPIS(idx), prop) #define SPIS_HAS_PROP(idx, prop) DT_NODE_HAS_PROP(SPIS(idx), prop) -#define SPIS_PINS_CROSS_DOMAIN(unused, prefix, idx, _) \ - COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(SPIS(prefix##idx)), \ - (SPIS_PROP(idx, cross_domain_pins_supported)), \ - (0)) - -#if NRFX_FOREACH_PRESENT(SPIS, SPIS_PINS_CROSS_DOMAIN, (||), (0)) -#include -/* Certain SPIM instances support usage of cross domain pins in form of dedicated pins on - * a port different from the default one. - */ -#define SPIS_CROSS_DOMAIN_SUPPORTED 1 -#endif - -#if SPIS_CROSS_DOMAIN_SUPPORTED && defined(CONFIG_NRF_SYS_EVENT) -#include -/* To use cross domain pins, constant latency mode needs to be applied, which is - * handled via nrf_sys_event requests. - */ -#define SPIS_CROSS_DOMAIN_PINS_HANDLE 1 -#endif - struct spi_nrfx_data { struct spi_context ctx; const struct device *dev; @@ -72,38 +51,8 @@ struct spi_nrfx_config { const struct pinctrl_dev_config *pcfg; struct gpio_dt_spec wake_gpio; void *mem_reg; -#if SPIS_CROSS_DOMAIN_SUPPORTED - bool cross_domain; - int8_t default_port; -#endif }; -#if SPIS_CROSS_DOMAIN_SUPPORTED -static bool spis_has_cross_domain_connection(const struct spi_nrfx_config *config) -{ - const struct pinctrl_dev_config *pcfg = config->pcfg; - const struct pinctrl_state *state; - int ret; - - ret = pinctrl_lookup_state(pcfg, PINCTRL_STATE_DEFAULT, &state); - if (ret < 0) { - LOG_ERR("Unable to read pin state"); - return false; - } - - for (uint8_t i = 0U; i < state->pin_cnt; i++) { - uint32_t pin = NRF_GET_PIN(state->pins[i]); - - if ((pin != NRF_PIN_DISCONNECTED) && - (nrf_gpio_pin_port_number_extract(&pin) != config->default_port)) { - return true; - } - } - - return false; -} -#endif - static inline nrf_spis_mode_t get_nrf_spis_mode(uint16_t operation) { if (SPI_MODE_GET(operation) & SPI_MODE_CPOL) { @@ -423,20 +372,6 @@ static void spi_nrfx_suspend(const struct device *dev) nrf_spis_disable(dev_config->spis.p_reg); } -#if SPIS_CROSS_DOMAIN_SUPPORTED - if (dev_config->cross_domain && spis_has_cross_domain_connection(dev_config)) { -#if SPIS_CROSS_DOMAIN_PINS_HANDLE - int err; - - err = nrf_sys_event_release_global_constlat(); - (void)err; - __ASSERT_NO_MSG(err >= 0); -#else - __ASSERT(false, "NRF_SYS_EVENT needs to be enabled to use cross domain pins.\n"); -#endif - } -#endif - (void)pinctrl_apply_state(dev_config->pcfg, PINCTRL_STATE_SLEEP); } @@ -446,20 +381,6 @@ static void spi_nrfx_resume(const struct device *dev) (void)pinctrl_apply_state(dev_config->pcfg, PINCTRL_STATE_DEFAULT); -#if SPIS_CROSS_DOMAIN_SUPPORTED - if (dev_config->cross_domain && spis_has_cross_domain_connection(dev_config)) { -#if SPIS_CROSS_DOMAIN_PINS_HANDLE - int err; - - err = nrf_sys_event_request_global_constlat(); - (void)err; - __ASSERT_NO_MSG(err >= 0); -#else - __ASSERT(false, "NRF_SYS_EVENT needs to be enabled to use cross domain pins.\n"); -#endif - } -#endif - if (dev_config->wake_gpio.port == NULL) { nrf_spis_enable(dev_config->spis.p_reg); } @@ -578,11 +499,6 @@ static int spi_nrfx_init(const struct device *dev) .max_buf_len = BIT_MASK(SPIS_PROP(idx, easydma_maxcnt_bits)), \ .wake_gpio = GPIO_DT_SPEC_GET_OR(SPIS(idx), wake_gpios, {0}), \ .mem_reg = DMM_DEV_TO_REG(SPIS(idx)), \ - IF_ENABLED(SPIS_PINS_CROSS_DOMAIN(_, /*empty*/, idx, _), \ - (.cross_domain = true, \ - .default_port = \ - DT_PROP_OR(DT_PHANDLE(SPIS(idx), \ - default_gpio_port), port, -1),)) \ }; \ BUILD_ASSERT(!DT_NODE_HAS_PROP(SPIS(idx), wake_gpios) || \ !(DT_GPIO_FLAGS(SPIS(idx), wake_gpios) & GPIO_ACTIVE_LOW),\ diff --git a/dts/bindings/spi/nordic,nrf-spi-common.yaml b/dts/bindings/spi/nordic,nrf-spi-common.yaml index e76d785b2f42..dc81950aed3d 100644 --- a/dts/bindings/spi/nordic,nrf-spi-common.yaml +++ b/dts/bindings/spi/nordic,nrf-spi-common.yaml @@ -61,13 +61,3 @@ properties: and SPI master again keeps the line in the low state Please note that the line must be configured and properly handled on both sides for the mechanism to work correctly. - - default-gpio-port: - type: phandle - description: | - SPI default GPIO port. - - cross-domain-pins-supported: - type: boolean - description: | - SPI allows usage of cross domain pins with constant latency mode required. diff --git a/dts/vendor/nordic/nrf54l_05_10_15.dtsi b/dts/vendor/nordic/nrf54l_05_10_15.dtsi index 1cc8314aecca..5a4854440b64 100644 --- a/dts/vendor/nordic/nrf54l_05_10_15.dtsi +++ b/dts/vendor/nordic/nrf54l_05_10_15.dtsi @@ -315,8 +315,6 @@ rx-delay-supported; rx-delay = <1>; status = "disabled"; - default-gpio-port = <&gpio1>; - cross-domain-pins-supported; }; uart20: uart@c6000 { @@ -326,8 +324,6 @@ status = "disabled"; endtx-stoptx-supported; frame-timeout-supported; - default-gpio-port = <&gpio1>; - cross-domain-pins-supported; }; i2c21: i2c@c7000 { @@ -358,8 +354,6 @@ rx-delay-supported; rx-delay = <1>; status = "disabled"; - default-gpio-port = <&gpio1>; - cross-domain-pins-supported; }; uart21: uart@c7000 { @@ -369,8 +363,6 @@ status = "disabled"; endtx-stoptx-supported; frame-timeout-supported; - default-gpio-port = <&gpio1>; - cross-domain-pins-supported; }; i2c22: i2c@c8000 { diff --git a/tests/drivers/spi/spi_controller_peripheral/testcase.yaml b/tests/drivers/spi/spi_controller_peripheral/testcase.yaml index a4581e54820d..f2c10b6c716d 100644 --- a/tests/drivers/spi/spi_controller_peripheral/testcase.yaml +++ b/tests/drivers/spi/spi_controller_peripheral/testcase.yaml @@ -109,6 +109,8 @@ tests: extra_configs: - CONFIG_TESTED_SPI_MODE=0 - CONFIG_NRF_SYS_EVENT=y + - CONFIG_SOC_NRF_FORCE_CONSTLAT=y + - CONFIG_POWER_DOMAIN=n extra_args: DTC_OVERLAY_FILE="boards/nrf54l15dk_nrf54l15_cpuapp_cross_domain.overlay" platform_exclude: - nrf52840dk/nrf52840 diff --git a/tests/drivers/uart/uart_elementary/testcase.yaml b/tests/drivers/uart/uart_elementary/testcase.yaml index cd25f46c1415..b680e0f96428 100644 --- a/tests/drivers/uart/uart_elementary/testcase.yaml +++ b/tests/drivers/uart/uart_elementary/testcase.yaml @@ -100,3 +100,4 @@ tests: extra_args: DTC_OVERLAY_FILE="boards/nrf54l15dk_nrf54l15_cpuapp_cross_domain.overlay" extra_configs: - CONFIG_NRF_SYS_EVENT=y + - CONFIG_SOC_NRF_FORCE_CONSTLAT=y From 7c6f8550344b70d47aaac65f8875809dd651769d Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Fri, 14 Nov 2025 10:45:32 +0100 Subject: [PATCH 2084/2141] [nrf fromlist] drivers: clock_control nrf_lfclk: patch clock option order The clock options used within the driver are supposed to be ordered from lowest to highest power consumption, so the lowest/default option is the most power efficient. The order was reversed to make the init code of the lfclk a bit simpler, and this was accounted for in the clock option lookup function. However, the common nrf clock control request/release feature would request the lowest index, not the lowest clock option, so the lfclk would default to its highest power consumption mode. The clock option init and lookup has been refactored to be sorted from lowest to highest power consumption, and comments have been adjusted accordingly. Upstream PR #: 99382 Signed-off-by: Bjarki Arge Andreasen --- .../clock_control/clock_control_nrf_lfclk.c | 104 +++++++++--------- 1 file changed, 55 insertions(+), 49 deletions(-) diff --git a/drivers/clock_control/clock_control_nrf_lfclk.c b/drivers/clock_control/clock_control_nrf_lfclk.c index 9551fb4e6361..dbf7f66e2e25 100644 --- a/drivers/clock_control/clock_control_nrf_lfclk.c +++ b/drivers/clock_control/clock_control_nrf_lfclk.c @@ -25,38 +25,25 @@ BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) == 1, #define LFCLK_LFRC_STARTUP_TIME_US DT_INST_PROP(0, lfrc_startup_time_us) #define LFCLK_MAX_OPTS 4 -#define LFCLK_DEF_OPTS 2 #define NRFS_CLOCK_TIMEOUT K_MSEC(CONFIG_CLOCK_CONTROL_NRF_LFCLK_CLOCK_TIMEOUT_MS) #define BICR (NRF_BICR_Type *)DT_REG_ADDR(DT_NODELABEL(bicr)) -/* Clock options sorted from highest to lowest power consumption. - * - Clock synthesized from a high frequency clock +/* + * Clock options sorted from lowest to highest power consumption. If clock option + * is not available it is not included. + * - External sine or square wave + * - XTAL low precision + * - XTAL high precision * - Internal RC oscillator - * - External clock. These are inserted into the list at driver initialization. - * Set to one of the following: - * - XTAL. Low or High precision - * - External sine or square wave + * - Clock synthesized from a high frequency clock */ static struct clock_options { uint16_t accuracy : 15; uint16_t precision : 1; nrfs_clock_src_t src; -} clock_options[LFCLK_MAX_OPTS] = { - { - /* NRFS will request FLL16M use HFXO in bypass mode if SYNTH src is used */ - .accuracy = LFCLK_HFXO_ACCURACY, - .precision = 1, - .src = NRFS_CLOCK_SRC_LFCLK_SYNTH, - }, - { - .accuracy = LFCLK_LFRC_ACCURACY, - .precision = 0, - .src = NRFS_CLOCK_SRC_LFCLK_LFRC, - }, - /* Remaining options are populated on lfclk_init */ -}; +} clock_options[LFCLK_MAX_OPTS]; struct lfclk_dev_data { STRUCT_CLOCK_CONFIG(lfclk, ARRAY_SIZE(clock_options)) clk_cfg; @@ -161,7 +148,7 @@ static int lfclk_resolve_spec_to_idx(const struct device *dev, ? dev_data->max_accuracy : req_spec->accuracy; - for (int i = dev_data->clock_options_cnt - 1; i >= 0; --i) { + for (int i = 0; i < dev_data->clock_options_cnt; i++) { /* Iterate to a more power hungry and accurate clock source * If the requested accuracy is higher (lower ppm) than what * the clock source can provide. @@ -331,15 +318,17 @@ static int api_get_rate_lfclk(const struct device *dev, static int lfclk_init(const struct device *dev) { struct lfclk_dev_data *dev_data = dev->data; - nrf_bicr_lfosc_mode_t lfosc_mode; nrfs_err_t res; + int ret; + nrf_bicr_lfosc_mode_t lfosc_mode; + struct clock_options *clock_option; res = nrfs_clock_init(clock_evt_handler); if (res != NRFS_SUCCESS) { return -EIO; } - dev_data->clock_options_cnt = LFCLK_DEF_OPTS; + dev_data->clock_options_cnt = 0; lfosc_mode = nrf_bicr_lfosc_mode_get(BICR); @@ -347,8 +336,6 @@ static int lfclk_init(const struct device *dev) lfosc_mode == NRF_BICR_LFOSC_MODE_DISABLED) { dev_data->max_accuracy = LFCLK_HFXO_ACCURACY; } else { - int ret; - ret = lfosc_get_accuracy(&dev_data->max_accuracy); if (ret < 0) { LOG_ERR("LFOSC enabled with invalid accuracy"); @@ -357,34 +344,41 @@ static int lfclk_init(const struct device *dev) switch (lfosc_mode) { case NRF_BICR_LFOSC_MODE_CRYSTAL: - clock_options[LFCLK_MAX_OPTS - 1].accuracy = dev_data->max_accuracy; - clock_options[LFCLK_MAX_OPTS - 1].precision = 0; - clock_options[LFCLK_MAX_OPTS - 1].src = NRFS_CLOCK_SRC_LFCLK_XO_PIERCE; - - clock_options[LFCLK_MAX_OPTS - 2].accuracy = dev_data->max_accuracy; - clock_options[LFCLK_MAX_OPTS - 2].precision = 1; - clock_options[LFCLK_MAX_OPTS - 2].src = NRFS_CLOCK_SRC_LFCLK_XO_PIERCE_HP; - - dev_data->clock_options_cnt += 2; + clock_option = &clock_options[dev_data->clock_options_cnt]; + clock_option->accuracy = dev_data->max_accuracy; + clock_option->precision = 0; + clock_option->src = NRFS_CLOCK_SRC_LFCLK_XO_PIERCE; + dev_data->clock_options_cnt++; + + clock_option = &clock_options[dev_data->clock_options_cnt]; + clock_option->accuracy = dev_data->max_accuracy; + clock_option->precision = 1; + clock_option->src = NRFS_CLOCK_SRC_LFCLK_XO_PIERCE_HP; + dev_data->clock_options_cnt++; break; - case NRF_BICR_LFOSC_MODE_EXTSINE: - clock_options[LFCLK_MAX_OPTS - 1].accuracy = dev_data->max_accuracy; - clock_options[LFCLK_MAX_OPTS - 1].precision = 0; - clock_options[LFCLK_MAX_OPTS - 1].src = NRFS_CLOCK_SRC_LFCLK_XO_EXT_SINE; - clock_options[LFCLK_MAX_OPTS - 2].accuracy = dev_data->max_accuracy; - clock_options[LFCLK_MAX_OPTS - 2].precision = 1; - clock_options[LFCLK_MAX_OPTS - 2].src = NRFS_CLOCK_SRC_LFCLK_XO_EXT_SINE_HP; - - dev_data->clock_options_cnt += 2; + case NRF_BICR_LFOSC_MODE_EXTSINE: + clock_option = &clock_options[dev_data->clock_options_cnt]; + clock_option->accuracy = dev_data->max_accuracy; + clock_option->precision = 0; + clock_option->src = NRFS_CLOCK_SRC_LFCLK_XO_EXT_SINE; + dev_data->clock_options_cnt++; + + clock_option = &clock_options[dev_data->clock_options_cnt]; + clock_option->accuracy = dev_data->max_accuracy; + clock_option->precision = 1; + clock_option->src = NRFS_CLOCK_SRC_LFCLK_XO_EXT_SINE_HP; + dev_data->clock_options_cnt++; break; - case NRF_BICR_LFOSC_MODE_EXTSQUARE: - clock_options[LFCLK_MAX_OPTS - 2].accuracy = dev_data->max_accuracy; - clock_options[LFCLK_MAX_OPTS - 2].precision = 0; - clock_options[LFCLK_MAX_OPTS - 2].src = NRFS_CLOCK_SRC_LFCLK_XO_EXT_SQUARE; - dev_data->clock_options_cnt += 1; + case NRF_BICR_LFOSC_MODE_EXTSQUARE: + clock_option = &clock_options[dev_data->clock_options_cnt]; + clock_option->accuracy = dev_data->max_accuracy; + clock_option->precision = 0; + clock_option->src = NRFS_CLOCK_SRC_LFCLK_XO_EXT_SQUARE; + dev_data->clock_options_cnt++; break; + default: LOG_ERR("Unexpected LFOSC mode"); return -EINVAL; @@ -398,6 +392,18 @@ static int lfclk_init(const struct device *dev) } } + clock_option = &clock_options[dev_data->clock_options_cnt]; + clock_option->accuracy = LFCLK_LFRC_ACCURACY; + clock_option->precision = 0; + clock_option->src = NRFS_CLOCK_SRC_LFCLK_LFRC; + dev_data->clock_options_cnt++; + + clock_option = &clock_options[dev_data->clock_options_cnt]; + clock_option->accuracy = LFCLK_HFXO_ACCURACY; + clock_option->precision = 1; + clock_option->src = NRFS_CLOCK_SRC_LFCLK_SYNTH; + dev_data->clock_options_cnt++; + dev_data->hfxo_startup_time_us = nrf_bicr_hfxo_startup_time_us_get(BICR); if (dev_data->hfxo_startup_time_us == NRF_BICR_HFXO_STARTUP_TIME_UNCONFIGURED) { LOG_ERR("BICR HFXO startup time invalid"); From 3ff6615d2fe5916dd24b426f07a65b919a8f27f4 Mon Sep 17 00:00:00 2001 From: Markus Lassila Date: Mon, 10 Nov 2025 09:53:10 +0200 Subject: [PATCH 2085/2141] Revert "[nrf noup] modem: backend: uart: SLM optimized modem UART backend" This reverts commit 736a34fffc3d55712d36b2af2bbc54b42935087c. UART backend is implemented in Serial Modem add-on. Signed-off-by: Markus Lassila --- include/zephyr/modem/backend/uart_slm.h | 61 --- subsys/modem/backends/CMakeLists.txt | 1 - subsys/modem/backends/Kconfig | 23 - .../modem/backends/modem_backend_uart_slm.c | 514 ------------------ 4 files changed, 599 deletions(-) delete mode 100644 include/zephyr/modem/backend/uart_slm.h delete mode 100644 subsys/modem/backends/modem_backend_uart_slm.c diff --git a/include/zephyr/modem/backend/uart_slm.h b/include/zephyr/modem/backend/uart_slm.h deleted file mode 100644 index e522c6cf791e..000000000000 --- a/include/zephyr/modem/backend/uart_slm.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include -#include - -#ifndef ZEPHYR_MODEM_BACKEND_UART_SLM_ -#define ZEPHYR_MODEM_BACKEND_UART_SLM_ - -#ifdef __cplusplus -extern "C" { -#endif - -struct slm_rx_queue_event { - uint8_t *buf; - size_t len; -}; - -struct modem_backend_uart_slm { - const struct device *uart; - struct modem_pipe pipe; - struct k_work_delayable receive_ready_work; - struct k_work transmit_idle_work; - -#ifdef CONFIG_MODEM_STATS - struct modem_stats_buffer receive_buf_stats; - struct modem_stats_buffer transmit_buf_stats; -#endif - struct ring_buf transmit_rb; - struct k_work rx_disabled_work; - atomic_t state; - - struct k_mem_slab rx_slab; - struct k_msgq rx_queue; - struct slm_rx_queue_event rx_event; - struct slm_rx_queue_event rx_queue_buf[CONFIG_MODEM_BACKEND_UART_SLM_BUFFER_COUNT]; - uint32_t rx_buf_size; - uint8_t rx_buf_count; -}; - -struct modem_backend_uart_slm_config { - const struct device *uart; - uint8_t *receive_buf; /* Address must be word-aligned. */ - uint32_t receive_buf_size; - uint8_t *transmit_buf; - uint32_t transmit_buf_size; -}; - -struct modem_pipe *modem_backend_uart_slm_init(struct modem_backend_uart_slm *backend, - const struct modem_backend_uart_slm_config *config); - -#ifdef __cplusplus -} -#endif - -#endif /* ZEPHYR_MODEM_BACKEND_UART_SLM_ */ diff --git a/subsys/modem/backends/CMakeLists.txt b/subsys/modem/backends/CMakeLists.txt index 787697a84e18..e2247a8a09dd 100644 --- a/subsys/modem/backends/CMakeLists.txt +++ b/subsys/modem/backends/CMakeLists.txt @@ -10,4 +10,3 @@ if(CONFIG_MODEM_BACKEND_UART_ASYNC) zephyr_library_sources_ifdef(CONFIG_MODEM_BACKEND_UART_ASYNC_HWFC modem_backend_uart_async_hwfc.c) zephyr_library_sources_ifndef(CONFIG_MODEM_BACKEND_UART_ASYNC_HWFC modem_backend_uart_async.c) endif() -zephyr_library_sources_ifdef(CONFIG_MODEM_BACKEND_UART_SLM modem_backend_uart_slm.c) diff --git a/subsys/modem/backends/Kconfig b/subsys/modem/backends/Kconfig index 5f8d804ed35c..2ce81c6dce11 100644 --- a/subsys/modem/backends/Kconfig +++ b/subsys/modem/backends/Kconfig @@ -64,26 +64,3 @@ endif # MODEM_BACKEND_UART_ASYNC_HWFC endif # MODEM_BACKEND_UART_ASYNC endif # MODEM_BACKEND_UART - -config MODEM_BACKEND_UART_SLM - bool "SLM-optimized modem UART backend" - select MODEM_PIPE - select RING_BUFFER - depends on UART_ASYNC_API - -if MODEM_BACKEND_UART_SLM - -config MODEM_BACKEND_UART_SLM_BUFFER_COUNT - int "SLM modem UART backend buffer count" - range 2 4 - default 3 - -config MODEM_BACKEND_UART_SLM_TRANSMIT_TIMEOUT_MS - int "SLM modem UART transmit timeout in milliseconds" - default 1000 - -config MODEM_BACKEND_UART_SLM_RECEIVE_IDLE_TIMEOUT_MS - int "SLM modem UART receive idle timeout in milliseconds" - default 30 - -endif # MODEM_BACKEND_UART_SLM diff --git a/subsys/modem/backends/modem_backend_uart_slm.c b/subsys/modem/backends/modem_backend_uart_slm.c deleted file mode 100644 index f1aa1b0bb402..000000000000 --- a/subsys/modem/backends/modem_backend_uart_slm.c +++ /dev/null @@ -1,514 +0,0 @@ -/* - * Copyright (c) 2025 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include - -#include -LOG_MODULE_REGISTER(modem_backend_uart_slm, CONFIG_MODEM_MODULES_LOG_LEVEL); - -#include -#include -#include - -struct rx_buf_t { - atomic_t ref_counter; - uint8_t buf[]; -}; - -static inline struct rx_buf_t *block_start_get(struct modem_backend_uart_slm *backend, uint8_t *buf) -{ - size_t block_num; - - /* Find the correct block. */ - block_num = (((size_t)buf - sizeof(struct rx_buf_t) - (size_t)backend->rx_slab.buffer) / - backend->rx_buf_size); - - return (struct rx_buf_t *)&backend->rx_slab.buffer[block_num * backend->rx_buf_size]; -} - -static struct rx_buf_t *rx_buf_alloc(struct modem_backend_uart_slm *backend) -{ - struct rx_buf_t *buf; - - if (k_mem_slab_alloc(&backend->rx_slab, (void **)&buf, K_NO_WAIT)) { - return NULL; - } - atomic_set(&buf->ref_counter, 1); - - return buf; -} - -static void rx_buf_ref(struct modem_backend_uart_slm *backend, void *buf) -{ - atomic_inc(&(block_start_get(backend, buf)->ref_counter)); -} - -static void rx_buf_unref(struct modem_backend_uart_slm *backend, void *buf) -{ - struct rx_buf_t *uart_buf = block_start_get(backend, buf); - atomic_t ref_counter = atomic_dec(&uart_buf->ref_counter); - - if (ref_counter == 1) { - k_mem_slab_free(&backend->rx_slab, (void *)uart_buf); - } -} - -enum { - MODEM_BACKEND_UART_SLM_STATE_OPEN_BIT, - MODEM_BACKEND_UART_SLM_STATE_TRANSMIT_BIT, - MODEM_BACKEND_UART_SLM_STATE_RECOVERY_BIT, -}; - -static int modem_backend_uart_slm_rx_enable(struct modem_backend_uart_slm *backend) -{ - int ret; - struct rx_buf_t *buf = rx_buf_alloc(backend); - - if (!buf) { - return -ENOMEM; - } - - ret = uart_rx_enable(backend->uart, buf->buf, - backend->rx_buf_size - sizeof(struct rx_buf_t), - CONFIG_MODEM_BACKEND_UART_SLM_RECEIVE_IDLE_TIMEOUT_MS * 1000); - if (ret) { - rx_buf_unref(backend, buf->buf); - return ret; - } - - return 0; -} - -static void modem_backend_uart_slm_rx_recovery(struct modem_backend_uart_slm *backend) -{ - int err; - - if (!atomic_test_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_RECOVERY_BIT)) { - return; - } - - err = modem_backend_uart_slm_rx_enable(backend); - if (err) { - LOG_DBG("RX recovery failed: %d", err); - return; - } - - if (!atomic_test_and_clear_bit(&backend->state, - MODEM_BACKEND_UART_SLM_STATE_RECOVERY_BIT)) { - /* Closed during recovery. */ - uart_rx_disable(backend->uart); - } else { - LOG_DBG("RX recovery success"); - } -} - -static bool modem_backend_uart_slm_is_uart_stopped(const struct modem_backend_uart_slm *backend) -{ - if (!atomic_test_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_OPEN_BIT) && - !atomic_test_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_RECOVERY_BIT) && - !atomic_test_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_TRANSMIT_BIT)) { - return true; - } - - return false; -} - -static bool modem_backend_uart_slm_is_open(const struct modem_backend_uart_slm *backend) -{ - return atomic_test_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_OPEN_BIT); -} - -static void modem_backend_uart_slm_event_handler(const struct device *dev, struct uart_event *evt, - void *user_data) -{ - struct modem_backend_uart_slm *backend = (struct modem_backend_uart_slm *)user_data; - struct slm_rx_queue_event rx_event; - int err; - - switch (evt->type) { - case UART_TX_DONE: - ring_buf_get_finish(&backend->transmit_rb, evt->data.tx.len); - atomic_clear_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_TRANSMIT_BIT); - k_work_submit(&backend->transmit_idle_work); - break; - - case UART_TX_ABORTED: - ring_buf_get_finish(&backend->transmit_rb, evt->data.tx.len); - if (!modem_backend_uart_slm_is_open(backend)) { - /* When we are closing, send the remaining data after re-open. */ - atomic_clear_bit(&backend->state, - MODEM_BACKEND_UART_SLM_STATE_TRANSMIT_BIT); - break; - } - if (evt->data.tx.len != 0) { - /* If we were able to send some data, attempt to send the remaining - * data before releasing the transmit bit. - */ - uint8_t *buf; - size_t bytes_to_transmit = - ring_buf_get_claim(&backend->transmit_rb, &buf, - ring_buf_capacity_get(&backend->transmit_rb)); - - err = uart_tx(backend->uart, buf, bytes_to_transmit, - CONFIG_MODEM_BACKEND_UART_SLM_TRANSMIT_TIMEOUT_MS * 1000L); - if (err) { - LOG_ERR("Failed to %s %u bytes. (%d)", "start async transmit for", - bytes_to_transmit, err); - atomic_clear_bit(&backend->state, - MODEM_BACKEND_UART_SLM_STATE_TRANSMIT_BIT); - } - break; - } - - /* We were not able to send anything. Start dropping data. */ - LOG_ERR("Transmit aborted (%u bytes dropped)", - ring_buf_size_get(&backend->transmit_rb)); - atomic_clear_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_TRANSMIT_BIT); - k_work_submit(&backend->transmit_idle_work); - break; - - case UART_RX_BUF_REQUEST: - struct rx_buf_t *buf = rx_buf_alloc(backend); - - if (!buf) { - LOG_DBG("No receive buffer, disabling RX"); - break; - } - err = uart_rx_buf_rsp(backend->uart, buf->buf, - backend->rx_buf_size - sizeof(struct rx_buf_t)); - if (err) { - LOG_ERR("uart_rx_buf_rsp: %d", err); - rx_buf_unref(backend, buf->buf); - } - break; - - case UART_RX_BUF_RELEASED: - if (evt->data.rx_buf.buf) { - rx_buf_unref(backend, evt->data.rx_buf.buf); - } - break; - - case UART_RX_RDY: - if (evt->data.rx.buf) { - rx_buf_ref(backend, evt->data.rx.buf); - rx_event.buf = &evt->data.rx.buf[evt->data.rx.offset]; - rx_event.len = evt->data.rx.len; - err = k_msgq_put(&backend->rx_queue, &rx_event, K_NO_WAIT); - if (err) { - LOG_WRN("RX queue overflow: %d (dropped %u)", err, - evt->data.rx.len); - rx_buf_unref(backend, evt->data.rx.buf); - break; - } - k_work_schedule(&backend->receive_ready_work, K_NO_WAIT); - } - break; - - case UART_RX_DISABLED: - if (atomic_test_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_OPEN_BIT)) { - if (!atomic_test_and_set_bit(&backend->state, - MODEM_BACKEND_UART_SLM_STATE_RECOVERY_BIT)) { - k_work_schedule(&backend->receive_ready_work, K_NO_WAIT); - LOG_DBG("RX recovery started"); - } - } - break; - - case UART_RX_STOPPED: - LOG_WRN("Receive stopped for reasons: %u", (uint8_t)evt->data.rx_stop.reason); - break; - - default: - break; - } - - if (modem_backend_uart_slm_is_uart_stopped(backend)) { - k_work_submit(&backend->rx_disabled_work); - } -} - -static int modem_backend_uart_slm_open(void *data) -{ - struct modem_backend_uart_slm *backend = (struct modem_backend_uart_slm *)data; - struct rx_buf_t *rx_buf = rx_buf_alloc(backend); - int ret; - - if (!rx_buf) { - return -ENOMEM; - } - - atomic_clear(&backend->state); - atomic_set_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_TRANSMIT_BIT); - atomic_set_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_OPEN_BIT); - - if (!ring_buf_is_empty(&backend->transmit_rb)) { - /* Transmit was aborted due to modem_backend_uart_slm_close. - * Send the remaining data before allowing further transmits. - */ - uint8_t *tx_buf; - const uint32_t tx_buf_size = ring_buf_get_claim( - &backend->transmit_rb, &tx_buf, ring_buf_size_get(&backend->transmit_rb)); - - ret = uart_tx(backend->uart, tx_buf, tx_buf_size, - CONFIG_MODEM_BACKEND_UART_SLM_TRANSMIT_TIMEOUT_MS * 1000L); - if (ret) { - LOG_ERR("Failed to %s %u bytes. (%d)", "start async transmit for", - tx_buf_size, ret); - atomic_clear_bit(&backend->state, - MODEM_BACKEND_UART_SLM_STATE_TRANSMIT_BIT); - } - } else { - /* Previous transmit was not aborted. */ - atomic_clear_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_TRANSMIT_BIT); - } - - ret = uart_rx_enable(backend->uart, rx_buf->buf, - backend->rx_buf_size - sizeof(struct rx_buf_t), - CONFIG_MODEM_BACKEND_UART_SLM_RECEIVE_IDLE_TIMEOUT_MS * 1000L); - if (ret < 0) { - rx_buf_unref(backend, rx_buf->buf); - atomic_clear_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_OPEN_BIT); - return ret; - } - - modem_pipe_notify_opened(&backend->pipe); - return 0; -} - -#ifdef CONFIG_MODEM_STATS -static uint32_t get_transmit_buf_size(const struct modem_backend_uart_slm *backend) -{ - return ring_buf_capacity_get(&backend->transmit_rb); -} - -static uint32_t get_receive_buf_size(struct modem_backend_uart_slm *backend) -{ - return (backend->rx_buf_size - sizeof(struct rx_buf_t)) * backend->rx_buf_count; -} - -static void advertise_transmit_buf_stats(struct modem_backend_uart_slm *backend, uint32_t length) -{ - modem_stats_buffer_advertise_length(&backend->transmit_buf_stats, length); -} - -static void advertise_receive_buf_stats(struct modem_backend_uart_slm *backend, uint32_t reserved) -{ - modem_stats_buffer_advertise_length(&backend->receive_buf_stats, reserved); -} -#endif - -static int modem_backend_uart_slm_transmit(void *data, const uint8_t *buf, size_t size) -{ - struct modem_backend_uart_slm *backend = (struct modem_backend_uart_slm *)data; - bool transmitting; - uint32_t bytes_to_transmit; - int ret; - uint8_t *tx_buf; - - if (!modem_backend_uart_slm_is_open(backend)) { - return -EPERM; - } - - transmitting = - atomic_test_and_set_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_TRANSMIT_BIT); - if (transmitting) { - return 0; - } - - /* Copy buf to transmit ring buffer which is passed to UART. */ - ring_buf_reset(&backend->transmit_rb); - ring_buf_put(&backend->transmit_rb, buf, size); - bytes_to_transmit = ring_buf_get_claim(&backend->transmit_rb, &tx_buf, size); - - ret = uart_tx(backend->uart, tx_buf, bytes_to_transmit, - CONFIG_MODEM_BACKEND_UART_SLM_TRANSMIT_TIMEOUT_MS * 1000L); - -#ifdef CONFIG_MODEM_STATS - advertise_transmit_buf_stats(backend, bytes_to_transmit); -#endif - - if (ret != 0) { - LOG_ERR("Failed to %s %u bytes. (%d)", "start async transmit for", - bytes_to_transmit, ret); - atomic_clear_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_TRANSMIT_BIT); - - return ret; - } - - return (int)bytes_to_transmit; -} - -static int modem_backend_uart_slm_receive(void *data, uint8_t *buf, size_t size) -{ - struct modem_backend_uart_slm *backend = (struct modem_backend_uart_slm *)data; - size_t received = 0; - size_t copy_size = 0; - -#ifdef CONFIG_MODEM_STATS - struct slm_rx_queue_event rx_event; - size_t reserved = backend->rx_event.len; - - for (int i = 0; i < k_msgq_num_used_get(&backend->rx_queue); i++) { - if (k_msgq_peek_at(&backend->rx_queue, &rx_event, i)) { - break; - } - reserved += rx_event.len; - } - advertise_receive_buf_stats(backend, reserved); -#endif - while (size > received) { - /* Keeping track of the rx_event allows us to receive less than what the event - * indicates. - */ - if (backend->rx_event.len == 0) { - if (k_msgq_get(&backend->rx_queue, &backend->rx_event, K_NO_WAIT)) { - break; - } - } - copy_size = MIN(size - received, backend->rx_event.len); - memcpy(buf, backend->rx_event.buf, copy_size); - buf += copy_size; - received += copy_size; - backend->rx_event.buf += copy_size; - backend->rx_event.len -= copy_size; - - if (backend->rx_event.len == 0) { - rx_buf_unref(backend, backend->rx_event.buf); - } - } - - if (backend->rx_event.len != 0 || k_msgq_num_used_get(&backend->rx_queue) != 0) { - k_work_schedule(&backend->receive_ready_work, K_NO_WAIT); - } - - modem_backend_uart_slm_rx_recovery(backend); - - return (int)received; -} - -static int modem_backend_uart_slm_close(void *data) -{ - struct modem_backend_uart_slm *backend = (struct modem_backend_uart_slm *)data; - - atomic_clear_bit(&backend->state, MODEM_BACKEND_UART_SLM_STATE_OPEN_BIT); - uart_tx_abort(backend->uart); - - if (!atomic_test_and_clear_bit(&backend->state, - MODEM_BACKEND_UART_SLM_STATE_RECOVERY_BIT)) { - /* Disable the RX, if recovery is not ongoing. */ - uart_rx_disable(backend->uart); - } - - return 0; -} - -static void modem_backend_uart_slm_receive_ready_handler(struct k_work *item) -{ - struct modem_backend_uart_slm *backend = - CONTAINER_OF(k_work_delayable_from_work(item), struct modem_backend_uart_slm, - receive_ready_work); - - modem_pipe_notify_receive_ready(&backend->pipe); -} - -static void modem_backend_uart_slm_transmit_idle_handler(struct k_work *item) -{ - struct modem_backend_uart_slm *backend = - CONTAINER_OF(item, struct modem_backend_uart_slm, transmit_idle_work); - - modem_pipe_notify_transmit_idle(&backend->pipe); -} - -static void modem_backend_uart_slm_notify_closed(struct k_work *item) -{ - - struct modem_backend_uart_slm *backend = - CONTAINER_OF(item, struct modem_backend_uart_slm, rx_disabled_work); - - modem_pipe_notify_closed(&backend->pipe); -} - -#ifdef CONFIG_MODEM_STATS -static void init_stats(struct modem_backend_uart_slm *backend) -{ - char name[CONFIG_MODEM_STATS_BUFFER_NAME_SIZE]; - uint32_t receive_buf_size; - uint32_t transmit_buf_size; - - receive_buf_size = get_receive_buf_size(backend); - transmit_buf_size = get_transmit_buf_size(backend); - - snprintk(name, sizeof(name), "%s_%s", backend->uart->name, "rx"); - modem_stats_buffer_init(&backend->receive_buf_stats, name, receive_buf_size); - snprintk(name, sizeof(name), "%s_%s", backend->uart->name, "tx"); - modem_stats_buffer_init(&backend->transmit_buf_stats, name, transmit_buf_size); -} -#endif - -static const struct modem_pipe_api modem_backend_uart_slm_api = { - .open = modem_backend_uart_slm_open, - .transmit = modem_backend_uart_slm_transmit, - .receive = modem_backend_uart_slm_receive, - .close = modem_backend_uart_slm_close, -}; - -struct modem_pipe *modem_backend_uart_slm_init(struct modem_backend_uart_slm *backend, - const struct modem_backend_uart_slm_config *config) -{ - int err; - - __ASSERT_NO_MSG(config->uart != NULL); - __ASSERT_NO_MSG(config->receive_buf != NULL); - __ASSERT_NO_MSG(config->receive_buf_size > 1); - __ASSERT_NO_MSG((config->receive_buf_size % 2) == 0); - __ASSERT_NO_MSG(config->transmit_buf != NULL); - __ASSERT_NO_MSG(config->transmit_buf_size > 0); - - memset(backend, 0x00, sizeof(*backend)); - backend->uart = config->uart; - k_work_init_delayable(&backend->receive_ready_work, - modem_backend_uart_slm_receive_ready_handler); - k_work_init(&backend->transmit_idle_work, modem_backend_uart_slm_transmit_idle_handler); - k_work_init(&backend->rx_disabled_work, modem_backend_uart_slm_notify_closed); - - err = uart_callback_set(backend->uart, modem_backend_uart_slm_event_handler, backend); - if (err) { - LOG_ERR("uart_callback_set failed. (%d)", err); - return NULL; - } - - int32_t buf_size = (int32_t)config->receive_buf_size; - - backend->rx_buf_count = CONFIG_MODEM_BACKEND_UART_SLM_BUFFER_COUNT; - - /* k_mem_slab_init requires a word-aligned buffer. */ - __ASSERT((uintptr_t)config->receive_buf % sizeof(void *) == 0, - "Receive buffer is not word-aligned"); - - /* Make sure all the buffers will be aligned. */ - buf_size -= (config->receive_buf_size % (sizeof(uint32_t) * backend->rx_buf_count)); - backend->rx_buf_size = buf_size / backend->rx_buf_count; - __ASSERT_NO_MSG(backend->rx_buf_size > sizeof(struct rx_buf_t)); - - /* Initialize the RX buffers and event queue. */ - err = k_mem_slab_init(&backend->rx_slab, config->receive_buf, backend->rx_buf_size, - backend->rx_buf_count); - if (err) { - LOG_ERR("k_mem_slab_init failed. (%d)", err); - return NULL; - } - k_msgq_init(&backend->rx_queue, (char *)backend->rx_queue_buf, - sizeof(struct slm_rx_queue_event), CONFIG_MODEM_BACKEND_UART_SLM_BUFFER_COUNT); - - ring_buf_init(&backend->transmit_rb, config->transmit_buf_size, config->transmit_buf); - - modem_pipe_init(&backend->pipe, backend, &modem_backend_uart_slm_api); - -#ifdef CONFIG_MODEM_STATS - init_stats(backend); -#endif - return &backend->pipe; -} From 815fd52d4b6b81b01972801a6d424a18cbe80880 Mon Sep 17 00:00:00 2001 From: Aymen LAOUINI Date: Fri, 3 Oct 2025 15:42:39 +0300 Subject: [PATCH 2086/2141] [nrf fromtree] soc: nordic: activate uicr generation and use correct dt reg check - Activate the UICR file generation and PeriphConf for nRF92 application. - Add condition in reg dt check file to use the correct uicr node name for nRF92X. - Generation of preriphconf entries filters on device names to match the first 5 characters to nrf92 or the 6 first characters to nrf54h, this information is also used to determine the device SOC_SERIES to be either SOC_SERIES_NRF54HX or SOC_SERIES_NRF92X allowing possible extension of usage. Still in case of an unknown device of a certain family it will use existing configuration while generating periphconf entries. Signed-off-by: Aymen LAOUINI (cherry picked from commit d9861d77ff5f03e0e12832363ba3fc6fd75ffd8e) --- soc/nordic/common/uicr/Kconfig | 4 +- soc/nordic/common/uicr/Kconfig.sysbuild | 2 +- .../common/uicr/gen_periphconf_entries.py | 48 +++++++++++++++++-- soc/nordic/validate_base_addresses.c | 2 +- 4 files changed, 48 insertions(+), 8 deletions(-) diff --git a/soc/nordic/common/uicr/Kconfig b/soc/nordic/common/uicr/Kconfig index 37bdd014b7d6..9f22fbbf7269 100644 --- a/soc/nordic/common/uicr/Kconfig +++ b/soc/nordic/common/uicr/Kconfig @@ -3,7 +3,7 @@ config NRF_PERIPHCONF_SECTION bool "Populate global peripheral initialization section" - default y if SOC_NRF54H20_CPUAPP || SOC_NRF54H20_CPURAD + default y if SOC_NRF54H20_CPUAPP || SOC_NRF54H20_CPURAD || SOC_NRF9280_CPUAPP depends on LINKER_DEVNULL_SUPPORT imply LINKER_DEVNULL_MEMORY help @@ -12,7 +12,7 @@ config NRF_PERIPHCONF_SECTION config NRF_PERIPHCONF_GENERATE_ENTRIES bool "Generate PERIPHCONF entries source file" - default y if SOC_NRF54H20_CPUAPP || SOC_NRF54H20_CPURAD + default y if SOC_NRF54H20_CPUAPP || SOC_NRF54H20_CPURAD || SOC_NRF9280_CPUAPP depends on NRF_PERIPHCONF_SECTION depends on NRF_PLATFORM_HALTIUM help diff --git a/soc/nordic/common/uicr/Kconfig.sysbuild b/soc/nordic/common/uicr/Kconfig.sysbuild index eb885beaaaf7..6a9341f90994 100644 --- a/soc/nordic/common/uicr/Kconfig.sysbuild +++ b/soc/nordic/common/uicr/Kconfig.sysbuild @@ -3,7 +3,7 @@ config NRF_HALTIUM_GENERATE_UICR bool "Generate UICR file" - depends on SOC_SERIES_NRF54HX + depends on SOC_SERIES_NRF54HX || SOC_SERIES_NRF92X default y help Generate UICR HEX file. diff --git a/soc/nordic/common/uicr/gen_periphconf_entries.py b/soc/nordic/common/uicr/gen_periphconf_entries.py index 9a273dab7a59..13df5e468ded 100644 --- a/soc/nordic/common/uicr/gen_periphconf_entries.py +++ b/soc/nordic/common/uicr/gen_periphconf_entries.py @@ -54,11 +54,51 @@ def get_additional_node_kwargs(node: Node) -> dict[str, Any]: return additional_kwargs +class Family(enum.Enum): + """Families of SoCs supported by this script""" + + SERIES_NRF54HX = "nrf54h" + SERIES_NRF92X = "nrf92" + SERIES_UNKNOWN = "unknown" + + @classmethod + def family(cls, soc): + if soc.startswith("nrf54h") and len(soc) == 8: + return cls.SERIES_NRF54HX + elif soc.startswith("nrf92") and len(soc) == 7: + return cls.SERIES_NRF92X + else: + return cls.SERIES_UNKNOWN + + class Soc(enum.Enum): """Names of SoCs supported by this script""" NRF54H20 = "nrf54h20" NRF9280 = "nrf9280" + UNKNOWN = "unknown" + + @classmethod + def soc(cls, soc): + if soc.startswith("nrf54h20") and len(soc) == 8: + return cls.NRF54H20 + elif soc.startswith("nrf9280") and len(soc) == 7: + return cls.NRF9280 + else: + return cls.UNKNOWN + + +def validate_soc_choice(soc): + """Helper for argparse to validate soc parameter type""" + + if (soc.startswith("nrf54h") and soc[6:].isdigit() and len(soc) == 8) or ( + soc.startswith("nrf92") and soc[5:].isdigit() and len(soc) == 7 + ): + return soc + else: + raise argparse.ArgumentTypeError( + f"Invalid soc '{soc}'. Must start with 'nrf54h' or 'nrf92' followed by 2 digits." + ) def parse_args() -> argparse.Namespace: @@ -78,8 +118,8 @@ def parse_args() -> argparse.Namespace: ) parser.add_argument( "--soc", + type=validate_soc_choice, required=True, - choices=[soc.value for soc in Soc], help=( "SoC to generate PERIPHCONF macros for. " "Used to look up soc specific hardware information" @@ -104,7 +144,7 @@ def main() -> None: args = parse_args() dt = pickle.load(args.in_edt_pickle) processor = dt_processor_id(dt) - lookup_tables = lookup_tables_get(Soc(args.soc)) + lookup_tables = lookup_tables_get(Soc.soc(args.soc), Family.family(args.soc)) builder = PeriphconfBuilder(dt, lookup_tables) # Application local peripherals @@ -138,7 +178,7 @@ def main() -> None: args.out_periphconf_source.write(generated_source) -def lookup_tables_get(soc: Soc) -> SocLookupTables: +def lookup_tables_get(soc: Soc, family: Family) -> SocLookupTables: if soc == Soc.NRF54H20: ctrlsel_lookup = { # CAN120 @@ -438,7 +478,7 @@ def lookup_tables_get(soc: Soc) -> SocLookupTables: NrfPsel(fun=NrfFun.TPIU_DATA3, port=7, pin=7): Ctrlsel.TND, }, } - elif soc == Soc.NRF9280: + elif family == Family.SERIES_NRF92X: ctrlsel_lookup = { # PWM120 0x5F8E_4000: { diff --git a/soc/nordic/validate_base_addresses.c b/soc/nordic/validate_base_addresses.c index 4f17e32e5d5b..f8e5245b51cb 100644 --- a/soc/nordic/validate_base_addresses.c +++ b/soc/nordic/validate_base_addresses.c @@ -346,7 +346,7 @@ CHECK_DT_REG(uart134, NRF_UARTE134); CHECK_DT_REG(uart135, NRF_UARTE135); CHECK_DT_REG(uart136, NRF_UARTE136); CHECK_DT_REG(uart137, NRF_UARTE137); -#if !defined(CONFIG_SOC_SERIES_NRF54HX) +#if !defined(CONFIG_SOC_SERIES_NRF54HX) && !defined(CONFIG_SOC_SERIES_NRF92X) CHECK_DT_REG(uicr, NRF_UICR); #else CHECK_DT_REG(uicr, NRF_APPLICATION_UICR); From 859ca1353007760a0817e83b281d9e81b20db15e Mon Sep 17 00:00:00 2001 From: Aymen LAOUINI Date: Fri, 3 Oct 2025 15:41:31 +0300 Subject: [PATCH 2087/2141] [nrf fromtree] boards: nordic: add partitions to memory map for nRF9280 - nRF9280 memory_map_iron is missing periphconf_partition, added this partition to mram11 at address 0xe60a000. - Add secure_storage_partition at 0xe60c000 to memory map. This partition is devided in two: cpuapp_crypto_partition and cpuapp_its_partition, both are 4KB. Those partitions are used by gen_uicr.py script to generate the UICR file. Signed-off-by: Aymen LAOUINI (cherry picked from commit 8f0fbbe8aa8510ec02719b4c7b5c186fb82f3ca0) --- .../nrf9280pdk_nrf9280-memory_map.dtsi | 10 ++++++++ .../nrf9280pdk_nrf9280-memory_map_iron.dtsi | 23 +++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280-memory_map.dtsi b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280-memory_map.dtsi index 0127998509e8..67c70f1d38b5 100644 --- a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280-memory_map.dtsi +++ b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280-memory_map.dtsi @@ -221,4 +221,14 @@ reg = <0x680000 DT_SIZE_K(24)>; }; }; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + periphconf_partition: partition@60a000 { + reg = <0x60a000 DT_SIZE_K(8)>; + }; + }; }; diff --git a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280-memory_map_iron.dtsi b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280-memory_map_iron.dtsi index d3aea1f979ae..fba2e0fb6c2d 100644 --- a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280-memory_map_iron.dtsi +++ b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280-memory_map_iron.dtsi @@ -78,5 +78,28 @@ storage_partition: partition@600000 { reg = <0x600000 DT_SIZE_K(40)>; }; + + periphconf_partition: partition@60a000 { + reg = <0x60a000 DT_SIZE_K(8)>; + }; + + /* 0x60c000 was chosen for secure_storage_partition such that + * it resides in the beginning of MRAM11 in storage partition. + */ + secure_storage_partition: partition@60c000 { + compatible = "fixed-subpartitions"; + reg = <0x60c000 DT_SIZE_K(8)>; + ranges = <0x0 0x60c000 0x2000>; + #address-cells = <1>; + #size-cells = <1>; + + cpuapp_crypto_partition: partition@0 { + reg = <0x0 DT_SIZE_K(4)>; + }; + + cpuapp_its_partition: partition@1000 { + reg = <0x1000 DT_SIZE_K(4)>; + }; + }; }; }; From 895decea58da060a2cc786b18872b0ff2bc20bfd Mon Sep 17 00:00:00 2001 From: Aymen LAOUINI Date: Fri, 3 Oct 2025 15:42:07 +0300 Subject: [PATCH 2088/2141] [nrf fromtree] dts: nordic: update nrf9280 nodes in dtsi - Removed cpurad_uicr and cpuapp_uicr nodes and added uicr node at address 0xfff8000 for nRF9280. - Add bicr node defined in same node as uicr but at offset 800. - Add tdd_peripherals node. Signed-off-by: Aymen LAOUINI (cherry picked from commit ba420519af42516613ebb100343141699e8adbbb) --- dts/vendor/nordic/nrf9280.dtsi | 41 ++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/dts/vendor/nordic/nrf9280.dtsi b/dts/vendor/nordic/nrf9280.dtsi index 791cd7d4c663..7d887b9a2092 100644 --- a/dts/vendor/nordic/nrf9280.dtsi +++ b/dts/vendor/nordic/nrf9280.dtsi @@ -116,16 +116,17 @@ write-block-size = <16>; }; - cpuapp_uicr: uicr@fff8000 { - compatible = "nordic,nrf-uicr-v2"; - reg = <0xfff8000 DT_SIZE_K(2)>; - domain = <2>; - }; + uicr: uicr@fff8000 { + compatible = "nordic,nrf-uicr"; + reg = <0xfff8000 DT_SIZE_K(3)>; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0xfff8000 DT_SIZE_K(3)>; - cpurad_uicr: uicr@fffa000 { - compatible = "nordic,nrf-uicr-v2"; - reg = <0xfffa000 DT_SIZE_K(2)>; - domain = <3>; + bicr: bicr@800 { + compatible = "nordic,nrf-bicr"; + reg = <0x800 204>; + }; }; ficr: ficr@fffe000 { @@ -358,6 +359,28 @@ }; }; + tdd_peripherals: peripheral@bf000000 { + #address-cells = <1>; + #size-cells = <1>; + reg = <0xbf000000 0x1000000>; + ranges = <0x0 0xbf000000 0x1000000>; + + tbm: tbm@3000 { + compatible = "nordic,nrf-tbm"; + reg = <0x3000 0x408>; + status = "disabled"; + interrupts = <127 NRF_DEFAULT_IRQ_PRIORITY>; + }; + + hsfll200: clock@4000 { + compatible = "fixed-clock"; + reg = <0x4000 0x1000>; + #clock-cells = <0>; + status = "disabled"; + clock-frequency = ; + }; + }; + global_peripherals: peripheral@5f000000 { #address-cells = <1>; #size-cells = <1>; From 7451fba01412b08f0e77a008dff97c1ac05803ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Mon, 31 Mar 2025 13:41:18 +0200 Subject: [PATCH 2089/2141] [nrf fromtree] drivers: timer: nrf_grtc_timer: Optimize to reduce register access MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Speed up execution of the interrupt handler and sys_clock_set_timeout(). Sys_clock_set_timeout() can be called in two scenarios: from previous timeout expiration handler or freely. If the former case fast path can be used since CC value in the GRTC register just expired and it can be used as a reference for CCADD setting. This is only a single register write so it's much faster. In the latter a longer procedure is applied which also happens in two variants. If value which is set in CC is further in the future (e.g. K_FOREVER was set before) then CC can be safely overwritten with a new value without a risk of triggering unexpected COMPARE event. If value in CC is earlier than the new CC value (if earlier timeout was aborted) then there is a risk of COMPARE event happening while it is being overwritten. That case requires long and safer procedure of setting CC. Update hal_nordic with changes in the nrfx_grtc driver which are needed for nrf_grtc_timer changes. Signed-off-by: Krzysztof Chruściński (cherry picked from commit d6fb9384ebfbb46a3cb65213257a61651a76fd7c) --- drivers/timer/nrf_grtc_timer.c | 92 ++++++++++++++++++++++------------ 1 file changed, 61 insertions(+), 31 deletions(-) diff --git a/drivers/timer/nrf_grtc_timer.c b/drivers/timer/nrf_grtc_timer.c index 22aed43d8e47..a7d3d90ef196 100644 --- a/drivers/timer/nrf_grtc_timer.c +++ b/drivers/timer/nrf_grtc_timer.c @@ -49,10 +49,9 @@ #define COUNTER_SPAN (GRTC_SYSCOUNTERL_VALUE_Msk | ((uint64_t)GRTC_SYSCOUNTERH_VALUE_Msk << 32)) #define MAX_ABS_TICKS (COUNTER_SPAN / CYC_PER_TICK) -#define MAX_TICKS \ - (((COUNTER_SPAN / CYC_PER_TICK) > INT_MAX) ? INT_MAX : (COUNTER_SPAN / CYC_PER_TICK)) - -#define MAX_CYCLES (MAX_TICKS * CYC_PER_TICK) +/* To allow use of CCADD we need to limit max cycles to 31 bits. */ +#define MAX_REL_CYCLES BIT_MASK(31) +#define MAX_REL_TICKS (MAX_REL_CYCLES / CYC_PER_TICK) #if DT_NODE_HAS_STATUS_OKAY(LFCLK_NODE) #define LFCLK_FREQUENCY_HZ DT_PROP(LFCLK_NODE, clock_frequency) @@ -60,14 +59,21 @@ #define LFCLK_FREQUENCY_HZ CONFIG_CLOCK_CONTROL_NRF_K32SRC_FREQUENCY #endif +/* Threshold used to determine if there is a risk of unexpected GRTC COMPARE event coming + * from previous CC value. + */ +#define LATENCY_THR_TICKS 200 + #if defined(CONFIG_TEST) const int32_t z_sys_timer_irq_for_test = DT_IRQN(GRTC_NODE); #endif static void sys_clock_timeout_handler(int32_t id, uint64_t cc_val, void *p_context); -static struct k_spinlock lock; static uint64_t last_count; /* Time (SYSCOUNTER value) @last sys_clock_announce() */ +static uint64_t last_elapsed; +static uint64_t cc_value; /* Value that is expected to be in CC register. */ +static uint64_t expired_cc; /* Value that is expected to be in CC register. */ static atomic_t int_mask; static uint8_t ext_channels_allocated; static uint64_t grtc_start_value; @@ -151,16 +157,11 @@ static void sys_clock_timeout_handler(int32_t id, uint64_t cc_val, void *p_conte { ARG_UNUSED(id); ARG_UNUSED(p_context); - uint64_t dticks; - uint64_t now = counter(); - - if (unlikely(now < cc_val)) { - return; - } + uint32_t dticks; dticks = counter_sub(cc_val, last_count) / CYC_PER_TICK; - - last_count += dticks * CYC_PER_TICK; + last_count += (dticks * CYC_PER_TICK); + expired_cc = cc_val; if (!IS_ENABLED(CONFIG_TICKLESS_KERNEL)) { /* protection is not needed because we are in the GRTC interrupt @@ -169,6 +170,7 @@ static void sys_clock_timeout_handler(int32_t id, uint64_t cc_val, void *p_conte system_timeout_set_abs(last_count + CYC_PER_TICK); } + last_elapsed = 0; sys_clock_announce((int32_t)dticks); } @@ -367,6 +369,7 @@ uint64_t z_nrf_grtc_timer_startup_value_get(void) int z_nrf_grtc_wakeup_prepare(uint64_t wake_time_us) { nrfx_err_t err_code; + static struct k_spinlock lock; static uint8_t systemoff_channel; uint64_t now = counter(); nrfx_grtc_sleep_config_t sleep_cfg; @@ -429,20 +432,12 @@ int z_nrf_grtc_wakeup_prepare(uint64_t wake_time_us) uint32_t sys_clock_cycle_get_32(void) { - k_spinlock_key_t key = k_spin_lock(&lock); - uint32_t ret = (uint32_t)counter(); - - k_spin_unlock(&lock, key); - return ret; + return (uint32_t)counter(); } uint64_t sys_clock_cycle_get_64(void) { - k_spinlock_key_t key = k_spin_lock(&lock); - uint64_t ret = counter(); - - k_spin_unlock(&lock, key); - return ret; + return counter(); } uint32_t sys_clock_elapsed(void) @@ -451,7 +446,9 @@ uint32_t sys_clock_elapsed(void) return 0; } - return (uint32_t)(counter_sub(counter(), last_count) / CYC_PER_TICK); + last_elapsed = counter_sub(counter(), last_count); + + return (uint32_t)(last_elapsed / CYC_PER_TICK); } #if !defined(CONFIG_GEN_SW_ISR_TABLE) @@ -508,6 +505,10 @@ static int sys_clock_driver_init(void) last_count = (counter() / CYC_PER_TICK) * CYC_PER_TICK; grtc_start_value = last_count; + expired_cc = UINT64_MAX; + nrfx_grtc_channel_callback_set(system_clock_channel_data.channel, + sys_clock_timeout_handler, NULL); + int_mask = NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK; if (!IS_ENABLED(CONFIG_TICKLESS_KERNEL)) { system_timeout_set_relative(CYC_PER_TICK); @@ -571,18 +572,47 @@ void sys_clock_set_timeout(int32_t ticks, bool idle) return; } - ticks = (ticks == K_TICKS_FOREVER) ? MAX_TICKS : MIN(MAX_TICKS, MAX(ticks, 0)); + uint32_t ch = system_clock_channel_data.channel; - uint64_t delta_time = ticks * CYC_PER_TICK; + if ((cc_value == expired_cc) && (ticks <= MAX_REL_TICKS)) { + uint32_t cyc = ticks * CYC_PER_TICK; - uint64_t target_time = counter() + delta_time; + if (cyc == 0) { + /* GRTC will expire anyway since HW ensures that past value triggers an + * event but we need to ensure to always progress the cc_value as this + * if condition expects that cc_value will change after each call to + * set_timeout function. + */ + cyc = 1; + } - /* Rounded down target_time to the tick boundary - * (but not less than one tick after the last) + /* If it's the first timeout setting after previous expiration and timeout + * is short so fast method can be used which utilizes relative CC configuration. + */ + cc_value += cyc; + nrfx_grtc_syscounter_cc_rel_set(ch, cyc, NRFX_GRTC_CC_RELATIVE_COMPARE); + return; + } + + uint64_t cyc = (uint64_t)ticks * CYC_PER_TICK; + bool safe_setting = false; + uint64_t prev_cc_val = cc_value; + uint64_t now = last_count + last_elapsed; + + cc_value = now + cyc; + + /* In case of timeout abort it may happen that CC is being set to a value + * that later than previous CC. If previous CC value is not far in the + * future, there is a risk that COMPARE event will be triggered for that + * previous CC value. If there is such risk safe procedure must be applied + * which is more time consuming but ensures that there will be no spurious + * event. */ - target_time = MAX((target_time - last_count)/CYC_PER_TICK, 1)*CYC_PER_TICK + last_count; + if (prev_cc_val < cc_value) { + safe_setting = (int64_t)(prev_cc_val - now) < LATENCY_THR_TICKS; + } - system_timeout_set_abs(target_time); + nrfx_grtc_syscounter_cc_abs_set(ch, cc_value, safe_setting); } #if defined(CONFIG_NRF_GRTC_TIMER_APP_DEFINED_INIT) From c118168a23f9b7e646e57f9f79094bef8b2365c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Pelikan?= Date: Fri, 14 Nov 2025 14:47:48 +0100 Subject: [PATCH 2090/2141] [nrf fromtree] tests: kernel: timer: behavior: Adjustments for NRF54H20 PPR MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adjusting CONFIG_SYS_CLOCK_TICKS_PER_SEC as core is to slow too run the test with the default system clock frequency. Signed-off-by: Paweł Pelikan (cherry picked from commit fddce23e03021bfb6cac6e259c58b64ecc6b5775) --- .../timer_behavior/boards/nrf54h20dk_nrf54h20_cpuppr_xip.conf | 1 + 1 file changed, 1 insertion(+) create mode 100644 tests/kernel/timer/timer_behavior/boards/nrf54h20dk_nrf54h20_cpuppr_xip.conf diff --git a/tests/kernel/timer/timer_behavior/boards/nrf54h20dk_nrf54h20_cpuppr_xip.conf b/tests/kernel/timer/timer_behavior/boards/nrf54h20dk_nrf54h20_cpuppr_xip.conf new file mode 100644 index 000000000000..2e06babf30a7 --- /dev/null +++ b/tests/kernel/timer/timer_behavior/boards/nrf54h20dk_nrf54h20_cpuppr_xip.conf @@ -0,0 +1 @@ +CONFIG_SYS_CLOCK_TICKS_PER_SEC=3906 From 9fea1896ec0946cf65e0705ff510a2dc592d505b Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Tue, 26 Aug 2025 14:46:22 +0200 Subject: [PATCH 2091/2141] [nrf fromtree] bluetooth: host: move assigned numbers out of gap.h Move Bluetooth Assigned Numbers to own header file to separate them from core GAP functionality. Signed-off-by: Pavel Vasilyev (cherry picked from commit 8c0269e2cedc625e7910418d26f29ecb7acbba70) Signed-off-by: Pavel Vasilyev --- include/zephyr/bluetooth/assigned_numbers.h | 735 ++++++++++++++++++++ include/zephyr/bluetooth/gap.h | 677 +----------------- 2 files changed, 736 insertions(+), 676 deletions(-) create mode 100644 include/zephyr/bluetooth/assigned_numbers.h diff --git a/include/zephyr/bluetooth/assigned_numbers.h b/include/zephyr/bluetooth/assigned_numbers.h new file mode 100644 index 000000000000..de978b3cb1de --- /dev/null +++ b/include/zephyr/bluetooth/assigned_numbers.h @@ -0,0 +1,735 @@ +/** @file + * @brief Bluetooth Assigned Numbers, codes and identifiers. + */ + +/* + * Copyright (c) 2015-2025 Intel Corporation + * Copyright (c) 2017-2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_INCLUDE_BLUETOOTH_ASSIGNED_NUMBERS_H_ +#define ZEPHYR_INCLUDE_BLUETOOTH_ASSIGNED_NUMBERS_H_ + +/** + * @brief Bluetooth Assigned Numbers, codes and identifiers. + * @defgroup bt_assigned_numbers Assigned Numbers. + * @since 1.0 + * @version 1.0.0 + * @ingroup bluetooth + * @{ + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Core Specification Assigned Numbers + * @defgroup bt_assigned_numbers_core Core Specification Assigned Numbers + * @ingroup bt_assigned_numbers + * @{ + */ + +/** + * @name Appearance Numbers + * + * Last Modified on 2023-01-05 + * @{ + */ + +/** Generic Unknown */ +#define BT_APPEARANCE_UNKNOWN 0x0000 +/** Generic Phone */ +#define BT_APPEARANCE_GENERIC_PHONE 0x0040 +/** Generic Computer */ +#define BT_APPEARANCE_GENERIC_COMPUTER 0x0080 +/** Desktop Workstation */ +#define BT_APPEARANCE_COMPUTER_DESKTOP_WORKSTATION 0x0081 +/** Server-class Computer */ +#define BT_APPEARANCE_COMPUTER_SERVER_CLASS 0x0082 +/** Laptop */ +#define BT_APPEARANCE_COMPUTER_LAPTOP 0x0083 +/** Handheld PC/PDA (clamshell) */ +#define BT_APPEARANCE_COMPUTER_HANDHELD_PCPDA 0x0084 +/** Palm­size PC/PDA */ +#define BT_APPEARANCE_COMPUTER_PALMSIZE_PCPDA 0x0085 +/** Wearable computer (watch size) */ +#define BT_APPEARANCE_COMPUTER_WEARABLE_COMPUTER 0x0086 +/** Tablet */ +#define BT_APPEARANCE_COMPUTER_TABLET 0x0087 +/** Docking Station */ +#define BT_APPEARANCE_COMPUTER_DOCKING_STATION 0x0088 +/** All in One */ +#define BT_APPEARANCE_COMPUTER_ALL_IN_ONE 0x0089 +/** Blade Server */ +#define BT_APPEARANCE_COMPUTER_BLADE_SERVER 0x008A +/** Convertible */ +#define BT_APPEARANCE_COMPUTER_CONVERTIBLE 0x008B +/** Detachable */ +#define BT_APPEARANCE_COMPUTER_DETACHABLE 0x008C +/** IoT Gateway */ +#define BT_APPEARANCE_COMPUTER_IOT_GATEWAY 0x008D +/** Mini PC */ +#define BT_APPEARANCE_COMPUTER_MINI_PC 0x008E +/** Stick PC */ +#define BT_APPEARANCE_COMPUTER_STICK_PC 0x008F +/** Generic Watch */ +#define BT_APPEARANCE_GENERIC_WATCH 0x00C0 +/** Sports Watch */ +#define BT_APPEARANCE_SPORTS_WATCH 0x00C1 +/** Smartwatch */ +#define BT_APPEARANCE_SMARTWATCH 0x00C2 +/** Generic Clock */ +#define BT_APPEARANCE_GENERIC_CLOCK 0x0100 +/** Generic Display */ +#define BT_APPEARANCE_GENERIC_DISPLAY 0x0140 +/** Generic Remote Control */ +#define BT_APPEARANCE_GENERIC_REMOTE 0x0180 +/** Generic Eye-glasses */ +#define BT_APPEARANCE_GENERIC_EYEGLASSES 0x01C0 +/** Generic Tag */ +#define BT_APPEARANCE_GENERIC_TAG 0x0200 +/** Generic Keyring */ +#define BT_APPEARANCE_GENERIC_KEYRING 0x0240 +/** Generic Media Player */ +#define BT_APPEARANCE_GENERIC_MEDIA_PLAYER 0x0280 +/** Generic Barcode Scanner */ +#define BT_APPEARANCE_GENERIC_BARCODE_SCANNER 0x02C0 +/** Generic Thermometer */ +#define BT_APPEARANCE_GENERIC_THERMOMETER 0x0300 +/** Ear Thermometer */ +#define BT_APPEARANCE_THERMOMETER_EAR 0x0301 +/** Generic Heart Rate Sensor */ +#define BT_APPEARANCE_GENERIC_HEART_RATE 0x0340 +/** Heart Rate Belt */ +#define BT_APPEARANCE_HEART_RATE_BELT 0x0341 +/** Generic Blood Pressure */ +#define BT_APPEARANCE_GENERIC_BLOOD_PRESSURE 0x0380 +/** Arm Blood Pressure */ +#define BT_APPEARANCE_BLOOD_PRESSURE_ARM 0x0381 +/** Wrist Blood Pressure */ +#define BT_APPEARANCE_BLOOD_PRESSURE_WRIST 0x0382 +/** Generic Human Interface Device */ +#define BT_APPEARANCE_GENERIC_HID 0x03C0 +/** Keyboard */ +#define BT_APPEARANCE_HID_KEYBOARD 0x03C1 +/** Mouse */ +#define BT_APPEARANCE_HID_MOUSE 0x03C2 +/** Joystick */ +#define BT_APPEARANCE_HID_JOYSTICK 0x03C3 +/** Gamepad */ +#define BT_APPEARANCE_HID_GAMEPAD 0x03C4 +/** Digitizer Tablet */ +#define BT_APPEARANCE_HID_DIGITIZER_TABLET 0x03C5 +/** Card Reader */ +#define BT_APPEARANCE_HID_CARD_READER 0x03C6 +/** Digital Pen */ +#define BT_APPEARANCE_HID_DIGITAL_PEN 0x03C7 +/** Barcode Scanner */ +#define BT_APPEARANCE_HID_BARCODE_SCANNER 0x03C8 +/** Touchpad */ +#define BT_APPEARANCE_HID_TOUCHPAD 0x03C9 +/** Presentation Remote */ +#define BT_APPEARANCE_HID_PRESENTATION_REMOTE 0x03CA +/** Generic Glucose Meter */ +#define BT_APPEARANCE_GENERIC_GLUCOSE 0x0400 +/** Generic Running Walking Sensor */ +#define BT_APPEARANCE_GENERIC_WALKING 0x0440 +/** In-Shoe Running Walking Sensor */ +#define BT_APPEARANCE_WALKING_IN_SHOE 0x0441 +/** On-Shoe Running Walking Sensor */ +#define BT_APPEARANCE_WALKING_ON_SHOE 0x0442 +/** On-Hip Running Walking Sensor */ +#define BT_APPEARANCE_WALKING_ON_HIP 0x0443 +/** Generic Cycling */ +#define BT_APPEARANCE_GENERIC_CYCLING 0x0480 +/** Cycling Computer */ +#define BT_APPEARANCE_CYCLING_COMPUTER 0x0481 +/** Speed Sensor */ +#define BT_APPEARANCE_CYCLING_SPEED 0x0482 +/** Cadence Sensor */ +#define BT_APPEARANCE_CYCLING_CADENCE 0x0483 +/** Power Sensor */ +#define BT_APPEARANCE_CYCLING_POWER 0x0484 +/** Speed and Cadence Sensor */ +#define BT_APPEARANCE_CYCLING_SPEED_CADENCE 0x0485 +/** Generic Control Device */ +#define BT_APPEARANCE_GENERIC_CONTROL_DEVICE 0x04C0 +/** Switch */ +#define BT_APPEARANCE_CONTROL_SWITCH 0x04C1 +/** Multi-switch */ +#define BT_APPEARANCE_CONTROL_MULTI_SWITCH 0x04C2 +/** Button */ +#define BT_APPEARANCE_CONTROL_BUTTON 0x04C3 +/** Slider */ +#define BT_APPEARANCE_CONTROL_SLIDER 0x04C4 +/** Rotary Switch */ +#define BT_APPEARANCE_CONTROL_ROTARY_SWITCH 0x04C5 +/** Touch Panel */ +#define BT_APPEARANCE_CONTROL_TOUCH_PANEL 0x04C6 +/** Single Switch */ +#define BT_APPEARANCE_CONTROL_SINGLE_SWITCH 0x04C7 +/** Double Switch */ +#define BT_APPEARANCE_CONTROL_DOUBLE_SWITCH 0x04C8 +/** Triple Switch */ +#define BT_APPEARANCE_CONTROL_TRIPLE_SWITCH 0x04C9 +/** Battery Switch */ +#define BT_APPEARANCE_CONTROL_BATTERY_SWITCH 0x04CA +/** Energy Harvesting Switch */ +#define BT_APPEARANCE_CONTROL_ENERGY_HARVESTING_SWITCH 0x04CB +/** Push Button */ +#define BT_APPEARANCE_CONTROL_PUSH_BUTTON 0x04CC +/** Generic Network Device */ +#define BT_APPEARANCE_GENERIC_NETWORK_DEVICE 0x0500 +/** Access Point */ +#define BT_APPEARANCE_NETWORK_ACCESS_POINT 0x0501 +/** Mesh Device */ +#define BT_APPEARANCE_NETWORK_MESH_DEVICE 0x0502 +/** Mesh Network Proxy */ +#define BT_APPEARANCE_NETWORK_MESH_PROXY 0x0503 +/** Generic Sensor */ +#define BT_APPEARANCE_GENERIC_SENSOR 0x0540 +/** Motion Sensor */ +#define BT_APPEARANCE_SENSOR_MOTION 0x0541 +/** Air quality Sensor */ +#define BT_APPEARANCE_SENSOR_AIR_QUALITY 0x0542 +/** Temperature Sensor */ +#define BT_APPEARANCE_SENSOR_TEMPERATURE 0x0543 +/** Humidity Sensor */ +#define BT_APPEARANCE_SENSOR_HUMIDITY 0x0544 +/** Leak Sensor */ +#define BT_APPEARANCE_SENSOR_LEAK 0x0545 +/** Smoke Sensor */ +#define BT_APPEARANCE_SENSOR_SMOKE 0x0546 +/** Occupancy Sensor */ +#define BT_APPEARANCE_SENSOR_OCCUPANCY 0x0547 +/** Contact Sensor */ +#define BT_APPEARANCE_SENSOR_CONTACT 0x0548 +/** Carbon Monoxide Sensor */ +#define BT_APPEARANCE_SENSOR_CARBON_MONOXIDE 0x0549 +/** Carbon Dioxide Sensor */ +#define BT_APPEARANCE_SENSOR_CARBON_DIOXIDE 0x054A +/** Ambient Light Sensor */ +#define BT_APPEARANCE_SENSOR_AMBIENT_LIGHT 0x054B +/** Energy Sensor */ +#define BT_APPEARANCE_SENSOR_ENERGY 0x054C +/** Color Light Sensor */ +#define BT_APPEARANCE_SENSOR_COLOR_LIGHT 0x054D +/** Rain Sensor */ +#define BT_APPEARANCE_SENSOR_RAIN 0x054E +/** Fire Sensor */ +#define BT_APPEARANCE_SENSOR_FIRE 0x054F +/** Wind Sensor */ +#define BT_APPEARANCE_SENSOR_WIND 0x0550 +/** Proximity Sensor */ +#define BT_APPEARANCE_SENSOR_PROXIMITY 0x0551 +/** Multi-Sensor */ +#define BT_APPEARANCE_SENSOR_MULTI 0x0552 +/** Flush Mounted Sensor */ +#define BT_APPEARANCE_SENSOR_FLUSH_MOUNTED 0x0553 +/** Ceiling Mounted Sensor */ +#define BT_APPEARANCE_SENSOR_CEILING_MOUNTED 0x0554 +/** Wall Mounted Sensor */ +#define BT_APPEARANCE_SENSOR_WALL_MOUNTED 0x0555 +/** Multisensor */ +#define BT_APPEARANCE_MULTISENSOR 0x0556 +/** Energy Meter */ +#define BT_APPEARANCE_SENSOR_ENERGY_METER 0x0557 +/** Flame Detector */ +#define BT_APPEARANCE_SENSOR_FLAME_DETECTOR 0x0558 +/** Vehicle Tire Pressure Sensor */ +#define BT_APPEARANCE_SENSOR_VEHICLE_TIRE_PRESSURE 0x0559 +/** Generic Light Fixtures */ +#define BT_APPEARANCE_GENERIC_LIGHT_FIXTURES 0x0580 +/** Wall Light */ +#define BT_APPEARANCE_LIGHT_FIXTURES_WALL 0x0581 +/** Ceiling Light */ +#define BT_APPEARANCE_LIGHT_FIXTURES_CEILING 0x0582 +/** Floor Light */ +#define BT_APPEARANCE_LIGHT_FIXTURES_FLOOR 0x0583 +/** Cabinet Light */ +#define BT_APPEARANCE_LIGHT_FIXTURES_CABINET 0x0584 +/** Desk Light */ +#define BT_APPEARANCE_LIGHT_FIXTURES_DESK 0x0585 +/** Troffer Light */ +#define BT_APPEARANCE_LIGHT_FIXTURES_TROFFER 0x0586 +/** Pendant Light */ +#define BT_APPEARANCE_LIGHT_FIXTURES_PENDANT 0x0587 +/** In-ground Light */ +#define BT_APPEARANCE_LIGHT_FIXTURES_IN_GROUND 0x0588 +/** Flood Light */ +#define BT_APPEARANCE_LIGHT_FIXTURES_FLOOD 0x0589 +/** Underwater Light */ +#define BT_APPEARANCE_LIGHT_FIXTURES_UNDERWATER 0x058A +/** Bollard with Light */ +#define BT_APPEARANCE_LIGHT_FIXTURES_BOLLARD_WITH 0x058B +/** Pathway Light */ +#define BT_APPEARANCE_LIGHT_FIXTURES_PATHWAY 0x058C +/** Garden Light */ +#define BT_APPEARANCE_LIGHT_FIXTURES_GARDEN 0x058D +/** Pole-top Light */ +#define BT_APPEARANCE_LIGHT_FIXTURES_POLE_TOP 0x058E +/** Spotlight */ +#define BT_APPEARANCE_SPOT_LIGHT 0x058F +/** Linear Light */ +#define BT_APPEARANCE_LIGHT_FIXTURES_LINEAR 0x0590 +/** Street Light */ +#define BT_APPEARANCE_LIGHT_FIXTURES_STREET 0x0591 +/** Shelves Light */ +#define BT_APPEARANCE_LIGHT_FIXTURES_SHELVES 0x0592 +/** Bay Light */ +#define BT_APPEARANCE_LIGHT_FIXTURES_BAY 0x0593 +/** Emergency Exit Light */ +#define BT_APPEARANCE_LIGHT_FIXTURES_EMERGENCY_EXIT 0x0594 +/** Light Controller */ +#define BT_APPEARANCE_LIGHT_FIXTURES_CONTROLLER 0x0595 +/** Light Driver */ +#define BT_APPEARANCE_LIGHT_FIXTURES_DRIVER 0x0596 +/** Bulb */ +#define BT_APPEARANCE_LIGHT_FIXTURES_BULB 0x0597 +/** Low-bay Light */ +#define BT_APPEARANCE_LIGHT_FIXTURES_LOW_BAY 0x0598 +/** High-bay Light */ +#define BT_APPEARANCE_LIGHT_FIXTURES_HIGH_BAY 0x0599 +/** Generic Fan */ +#define BT_APPEARANCE_GENERIC_FAN 0x05C0 +/** Ceiling Fan */ +#define BT_APPEARANCE_FAN_CEILING 0x05C1 +/** Axial Fan */ +#define BT_APPEARANCE_FAN_AXIAL 0x05C2 +/** Exhaust Fan */ +#define BT_APPEARANCE_FAN_EXHAUST 0x05C3 +/** Pedestal Fan */ +#define BT_APPEARANCE_FAN_PEDESTAL 0x05C4 +/** Desk Fan */ +#define BT_APPEARANCE_FAN_DESK 0x05C5 +/** Wall Fan */ +#define BT_APPEARANCE_FAN_WALL 0x05C6 +/** Generic HVAC */ +#define BT_APPEARANCE_GENERIC_HVAC 0x0600 +/** Thermostat */ +#define BT_APPEARANCE_HVAC_THERMOSTAT 0x0601 +/** Humidifier */ +#define BT_APPEARANCE_HVAC_HUMIDIFIER 0x0602 +/** De-humidifier */ +#define BT_APPEARANCE_HVAC_DEHUMIDIFIER 0x0603 +/** Heater */ +#define BT_APPEARANCE_HVAC_HEATER 0x0604 +/** Radiator */ +#define BT_APPEARANCE_HVAC_RADIATOR 0x0605 +/** Boiler */ +#define BT_APPEARANCE_HVAC_BOILER 0x0606 +/** Heat Pump */ +#define BT_APPEARANCE_HVAC_HEAT_PUMP 0x0607 +/** Infrared Heater */ +#define BT_APPEARANCE_HVAC_INFRARED_HEATER 0x0608 +/** Radiant Panel Heater */ +#define BT_APPEARANCE_HVAC_RADIANT_PANEL_HEATER 0x0609 +/** Fan Heater */ +#define BT_APPEARANCE_HVAC_FAN_HEATER 0x060A +/** Air Curtain */ +#define BT_APPEARANCE_HVAC_AIR_CURTAIN 0x060B +/** Generic Air Conditioning */ +#define BT_APPEARANCE_GENERIC_AIR_CONDITIONING 0x0640 +/** Generic Humidifier */ +#define BT_APPEARANCE_GENERIC_HUMIDIFIER 0x0680 +/** Generic Heating */ +#define BT_APPEARANCE_GENERIC_HEATING 0x06C0 +/** Radiator */ +#define BT_APPEARANCE_HEATING_RADIATOR 0x06C1 +/** Boiler */ +#define BT_APPEARANCE_HEATING_BOILER 0x06C2 +/** Heat Pump */ +#define BT_APPEARANCE_HEATING_HEAT_PUMP 0x06C3 +/** Infrared Heater */ +#define BT_APPEARANCE_HEATING_INFRARED_HEATER 0x06C4 +/** Radiant Panel Heater */ +#define BT_APPEARANCE_HEATING_RADIANT_PANEL_HEATER 0x06C5 +/** Fan Heater */ +#define BT_APPEARANCE_HEATING_FAN_HEATER 0x06C6 +/** Air Curtain */ +#define BT_APPEARANCE_HEATING_AIR_CURTAIN 0x06C7 +/** Generic Access Control */ +#define BT_APPEARANCE_GENERIC_ACCESS_CONTROL 0x0700 +/** Access Door */ +#define BT_APPEARANCE_CONTROL_ACCESS_DOOR 0x0701 +/** Garage Door */ +#define BT_APPEARANCE_CONTROL_GARAGE_DOOR 0x0702 +/** Emergency Exit Door */ +#define BT_APPEARANCE_CONTROL_EMERGENCY_EXIT_DOOR 0x0703 +/** Access Lock */ +#define BT_APPEARANCE_CONTROL_ACCESS_LOCK 0x0704 +/** Elevator */ +#define BT_APPEARANCE_CONTROL_ELEVATOR 0x0705 +/** Window */ +#define BT_APPEARANCE_CONTROL_WINDOW 0x0706 +/** Entrance Gate */ +#define BT_APPEARANCE_CONTROL_ENTRANCE_GATE 0x0707 +/** Door Lock */ +#define BT_APPEARANCE_CONTROL_DOOR_LOCK 0x0708 +/** Locker */ +#define BT_APPEARANCE_CONTROL_LOCKER 0x0709 +/** Generic Motorized Device */ +#define BT_APPEARANCE_GENERIC_MOTORIZED_DEVICE 0x0740 +/** Motorized Gate */ +#define BT_APPEARANCE_MOTORIZED_GATE 0x0741 +/** Awning */ +#define BT_APPEARANCE_MOTORIZED_AWNING 0x0742 +/** Blinds or Shades */ +#define BT_APPEARANCE_MOTORIZED_BLINDS_OR_SHADES 0x0743 +/** Curtains */ +#define BT_APPEARANCE_MOTORIZED_CURTAINS 0x0744 +/** Screen */ +#define BT_APPEARANCE_MOTORIZED_SCREEN 0x0745 +/** Generic Power Device */ +#define BT_APPEARANCE_GENERIC_POWER_DEVICE 0x0780 +/** Power Outlet */ +#define BT_APPEARANCE_POWER_OUTLET 0x0781 +/** Power Strip */ +#define BT_APPEARANCE_POWER_STRIP 0x0782 +/** Plug */ +#define BT_APPEARANCE_POWER_PLUG 0x0783 +/** Power Supply */ +#define BT_APPEARANCE_POWER_SUPPLY 0x0784 +/** LED Driver */ +#define BT_APPEARANCE_POWER_LED_DRIVER 0x0785 +/** Fluorescent Lamp Gear */ +#define BT_APPEARANCE_POWER_FLUORESCENT_LAMP_GEAR 0x0786 +/** HID Lamp Gear */ +#define BT_APPEARANCE_POWER_HID_LAMP_GEAR 0x0787 +/** Charge Case */ +#define BT_APPEARANCE_POWER_CHARGE_CASE 0x0788 +/** Power Bank */ +#define BT_APPEARANCE_POWER_POWER_BANK 0x0789 +/** Generic Light Source */ +#define BT_APPEARANCE_GENERIC_LIGHT_SOURCE 0x07C0 +/** Incandescent Light Bulb */ +#define BT_APPEARANCE_LIGHT_SOURCE_INCANDESCENT_BULB 0x07C1 +/** LED Lamp */ +#define BT_APPEARANCE_LIGHT_SOURCE_LED_LAMP 0x07C2 +/** HID Lamp */ +#define BT_APPEARANCE_LIGHT_SOURCE_HID_LAMP 0x07C3 +/** Fluorescent Lamp */ +#define BT_APPEARANCE_LIGHT_SOURCE_FLUORESCENT_LAMP 0x07C4 +/** LED Array */ +#define BT_APPEARANCE_LIGHT_SOURCE_LED_ARRAY 0x07C5 +/** Multi-Color LED Array */ +#define BT_APPEARANCE_LIGHT_SOURCE_MULTICOLOR_LED_ARRAY 0x07C6 +/** Low voltage halogen */ +#define BT_APPEARANCE_LIGHT_SOURCE_LOW_VOLTAGE_HALOGEN 0x07C7 +/** Organic light emitting diode */ +#define BT_APPEARANCE_LIGHT_SOURCE_OLED 0x07C8 +/** Generic Window Covering */ +#define BT_APPEARANCE_GENERIC_WINDOW_COVERING 0x0800 +/** Window Shades */ +#define BT_APPEARANCE_WINDOW_SHADES 0x0801 +/** Window Blinds */ +#define BT_APPEARANCE_WINDOW_BLINDS 0x0802 +/** Window Awning */ +#define BT_APPEARANCE_WINDOW_AWNING 0x0803 +/** Window Curtain */ +#define BT_APPEARANCE_WINDOW_CURTAIN 0x0804 +/** Exterior Shutter */ +#define BT_APPEARANCE_WINDOW_EXTERIOR_SHUTTER 0x0805 +/** Exterior Screen */ +#define BT_APPEARANCE_WINDOW_EXTERIOR_SCREEN 0x0806 +/** Generic Audio Sink */ +#define BT_APPEARANCE_GENERIC_AUDIO_SINK 0x0840 +/** Standalone Speaker */ +#define BT_APPEARANCE_AUDIO_SINK_STANDALONE_SPEAKER 0x0841 +/** Soundbar */ +#define BT_APPEARANCE_AUDIO_SINK_SOUNDBAR 0x0842 +/** Bookshelf Speaker */ +#define BT_APPEARANCE_AUDIO_SINK_BOOKSHELF_SPEAKER 0x0843 +/** Standmounted Speaker */ +#define BT_APPEARANCE_AUDIO_SINK_STANDMOUNTED_SPEAKER 0x0844 +/** Speakerphone */ +#define BT_APPEARANCE_AUDIO_SINK_SPEAKERPHONE 0x0845 +/** Generic Audio Source */ +#define BT_APPEARANCE_GENERIC_AUDIO_SOURCE 0x0880 +/** Microphone */ +#define BT_APPEARANCE_AUDIO_SOURCE_MICROPHONE 0x0881 +/** Alarm */ +#define BT_APPEARANCE_AUDIO_SOURCE_ALARM 0x0882 +/** Bell */ +#define BT_APPEARANCE_AUDIO_SOURCE_BELL 0x0883 +/** Horn */ +#define BT_APPEARANCE_AUDIO_SOURCE_HORN 0x0884 +/** Broadcasting Device */ +#define BT_APPEARANCE_AUDIO_SOURCE_BROADCASTING_DEVICE 0x0885 +/** Service Desk */ +#define BT_APPEARANCE_AUDIO_SOURCE_SERVICE_DESK 0x0886 +/** Kiosk */ +#define BT_APPEARANCE_AUDIO_SOURCE_KIOSK 0x0887 +/** Broadcasting Room */ +#define BT_APPEARANCE_AUDIO_SOURCE_BROADCASTING_ROOM 0x0888 +/** Auditorium */ +#define BT_APPEARANCE_AUDIO_SOURCE_AUDITORIUM 0x0889 +/** Generic Motorized Vehicle */ +#define BT_APPEARANCE_GENERIC_MOTORIZED_VEHICLE 0x08C0 +/** Car */ +#define BT_APPEARANCE_VEHICLE_CAR 0x08C1 +/** Large Goods Vehicle */ +#define BT_APPEARANCE_VEHICLE_LARGE_GOODS 0x08C2 +/** 2-Wheeled Vehicle */ +#define BT_APPEARANCE_VEHICLE_TWO_WHEELED 0x08C3 +/** Motorbike */ +#define BT_APPEARANCE_VEHICLE_MOTORBIKE 0x08C4 +/** Scooter */ +#define BT_APPEARANCE_VEHICLE_SCOOTER 0x08C5 +/** Moped */ +#define BT_APPEARANCE_VEHICLE_MOPED 0x08C6 +/** 3-Wheeled Vehicle */ +#define BT_APPEARANCE_VEHICLE_THREE_WHEELED 0x08C7 +/** Light Vehicle */ +#define BT_APPEARANCE_VEHICLE_LIGHT 0x08C8 +/** Quad Bike */ +#define BT_APPEARANCE_VEHICLE_QUAD_BIKE 0x08C9 +/** Minibus */ +#define BT_APPEARANCE_VEHICLE_MINIBUS 0x08CA +/** Bus */ +#define BT_APPEARANCE_VEHICLE_BUS 0x08CB +/** Trolley */ +#define BT_APPEARANCE_VEHICLE_TROLLEY 0x08CC +/** Agricultural Vehicle */ +#define BT_APPEARANCE_VEHICLE_AGRICULTURAL 0x08CD +/** Camper/Caravan */ +#define BT_APPEARANCE_VEHICLE_CAMPER_OR_CARAVAN 0x08CE +/** Recreational Vehicle/Motor Home */ +#define BT_APPEARANCE_VEHICLE_RECREATIONAL 0x08CF +/** Generic Domestic Appliance */ +#define BT_APPEARANCE_GENERIC_DOMESTIC_APPLIANCE 0x0900 +/** Refrigerator */ +#define BT_APPEARANCE_APPLIANCE_REFRIGERATOR 0x0901 +/** Freezer */ +#define BT_APPEARANCE_APPLIANCE_FREEZER 0x0902 +/** Oven */ +#define BT_APPEARANCE_APPLIANCE_OVEN 0x0903 +/** Microwave */ +#define BT_APPEARANCE_APPLIANCE_MICROWAVE 0x0904 +/** Toaster */ +#define BT_APPEARANCE_APPLIANCE_TOASTER 0x0905 +/** Washing Machine */ +#define BT_APPEARANCE_APPLIANCE_WASHING_MACHINE 0x0906 +/** Dryer */ +#define BT_APPEARANCE_APPLIANCE_DRYER 0x0907 +/** Coffee maker */ +#define BT_APPEARANCE_APPLIANCE_COFFEE_MAKER 0x0908 +/** Clothes iron */ +#define BT_APPEARANCE_APPLIANCE_CLOTHES_IRON 0x0909 +/** Curling iron */ +#define BT_APPEARANCE_APPLIANCE_CURLING_IRON 0x090A +/** Hair dryer */ +#define BT_APPEARANCE_APPLIANCE_HAIR_DRYER 0x090B +/** Vacuum cleaner */ +#define BT_APPEARANCE_APPLIANCE_VACUUM_CLEANER 0x090C +/** Robotic vacuum cleaner */ +#define BT_APPEARANCE_APPLIANCE_ROBOTIC_VACUUM_CLEANER 0x090D +/** Rice cooker */ +#define BT_APPEARANCE_APPLIANCE_RICE_COOKER 0x090E +/** Clothes steamer */ +#define BT_APPEARANCE_APPLIANCE_CLOTHES_STEAMER 0x090F +/** Generic Wearable Audio Device */ +#define BT_APPEARANCE_GENERIC_WEARABLE_AUDIO_DEVICE 0x0940 +/** Earbud */ +#define BT_APPEARANCE_WEARABLE_AUDIO_DEVICE_EARBUD 0x0941 +/** Headset */ +#define BT_APPEARANCE_WEARABLE_AUDIO_DEVICE_HEADSET 0x0942 +/** Headphones */ +#define BT_APPEARANCE_WEARABLE_AUDIO_DEVICE_HEADPHONES 0x0943 +/** Neck Band */ +#define BT_APPEARANCE_WEARABLE_AUDIO_DEVICE_NECK_BAND 0x0944 +/** Generic Aircraft */ +#define BT_APPEARANCE_GENERIC_AIRCRAFT 0x0980 +/** Light Aircraft */ +#define BT_APPEARANCE_AIRCRAFT_LIGHT 0x0981 +/** Microlight */ +#define BT_APPEARANCE_AIRCRAFT_MICROLIGHT 0x0982 +/** Paraglider */ +#define BT_APPEARANCE_AIRCRAFT_PARAGLIDER 0x0983 +/** Large Passenger Aircraft */ +#define BT_APPEARANCE_AIRCRAFT_LARGE_PASSENGER 0x0984 +/** Generic AV Equipment */ +#define BT_APPEARANCE_GENERIC_AV_EQUIPMENT 0x09C0 +/** Amplifier */ +#define BT_APPEARANCE_AV_EQUIPMENT_AMPLIFIER 0x09C1 +/** Receiver */ +#define BT_APPEARANCE_AV_EQUIPMENT_RECEIVER 0x09C2 +/** Radio */ +#define BT_APPEARANCE_AV_EQUIPMENT_RADIO 0x09C3 +/** Tuner */ +#define BT_APPEARANCE_AV_EQUIPMENT_TUNER 0x09C4 +/** Turntable */ +#define BT_APPEARANCE_AV_EQUIPMENT_TURNTABLE 0x09C5 +/** CD Player */ +#define BT_APPEARANCE_AV_EQUIPMENT_CD_PLAYER 0x09C6 +/** DVD Player */ +#define BT_APPEARANCE_AV_EQUIPMENT_DVD_PLAYER 0x09C7 +/** Bluray Player */ +#define BT_APPEARANCE_AV_EQUIPMENT_BLURAY_PLAYER 0x09C8 +/** Optical Disc Player */ +#define BT_APPEARANCE_AV_EQUIPMENT_OPTICAL_DISC_PLAYER 0x09C9 +/** Set-Top Box */ +#define BT_APPEARANCE_AV_EQUIPMENT_SET_TOP_BOX 0x09CA +/** Generic Display Equipment */ +#define BT_APPEARANCE_GENERIC_DISPLAY_EQUIPMENT 0x0A00 +/** Television */ +#define BT_APPEARANCE_DISPLAY_EQUIPMENT_TELEVISION 0x0A01 +/** Monitor */ +#define BT_APPEARANCE_DISPLAY_EQUIPMENT_MONITOR 0x0A02 +/** Projector */ +#define BT_APPEARANCE_DISPLAY_EQUIPMENT_PROJECTOR 0x0A03 +/** Generic Hearing aid */ +#define BT_APPEARANCE_GENERIC_HEARING_AID 0x0A40 +/** In-ear hearing aid */ +#define BT_APPEARANCE_HEARING_AID_IN_EAR 0x0A41 +/** Behind-ear hearing aid */ +#define BT_APPEARANCE_HEARING_AID_BEHIND_EAR 0x0A42 +/** Cochlear Implant */ +#define BT_APPEARANCE_HEARING_AID_COCHLEAR_IMPLANT 0x0A43 +/** Generic Gaming */ +#define BT_APPEARANCE_GENERIC_GAMING 0x0A80 +/** Home Video Game Console */ +#define BT_APPEARANCE_HOME_VIDEO_GAME_CONSOLE 0x0A81 +/** Portable handheld console */ +#define BT_APPEARANCE_PORTABLE_HANDHELD_CONSOLE 0x0A82 +/** Generic Signage */ +#define BT_APPEARANCE_GENERIC_SIGNAGE 0x0AC0 +/** Digital Signage */ +#define BT_APPEARANCE_SIGNAGE_DIGITAL 0x0AC1 +/** Electronic Label */ +#define BT_APPEARANCE_SIGNAGE_ELECTRONIC_LABEL 0x0AC2 +/** Generic Pulse Oximeter */ +#define BT_APPEARANCE_GENERIC_PULSE_OXIMETER 0x0C40 +/** Fingertip Pulse Oximeter */ +#define BT_APPEARANCE_PULSE_OXIMETER_FINGERTIP 0x0C41 +/** Wrist Worn Pulse Oximeter */ +#define BT_APPEARANCE_PULSE_OXIMETER_WRIST 0x0C42 +/** Generic Weight Scale */ +#define BT_APPEARANCE_GENERIC_WEIGHT_SCALE 0x0C80 +/** Generic Personal Mobility Device */ +#define BT_APPEARANCE_GENERIC_PERSONAL_MOBILITY_DEVICE 0x0CC0 +/** Powered Wheelchair */ +#define BT_APPEARANCE_MOBILITY_POWERED_WHEELCHAIR 0x0CC1 +/** Mobility Scooter */ +#define BT_APPEARANCE_MOBILITY_SCOOTER 0x0CC2 +/** Continuous Glucose Monitor */ +#define BT_APPEARANCE_CONTINUOUS_GLUCOSE_MONITOR 0x0D00 +/** Generic Insulin Pump */ +#define BT_APPEARANCE_GENERIC_INSULIN_PUMP 0x0D40 +/** Insulin Pump, durable pump */ +#define BT_APPEARANCE_INSULIN_PUMP_DURABLE 0x0D41 +/** Insulin Pump, patch pump */ +#define BT_APPEARANCE_INSULIN_PUMP_PATCH 0x0D44 +/** Insulin Pen */ +#define BT_APPEARANCE_INSULIN_PEN 0x0D48 +/** Generic Medication Delivery */ +#define BT_APPEARANCE_GENERIC_MEDICATION_DELIVERY 0x0D80 +/** Generic Spirometer */ +#define BT_APPEARANCE_GENERIC_SPIROMETER 0x0DC0 +/** Handheld Spirometer */ +#define BT_APPEARANCE_SPIROMETER_HANDHELD 0x0DC1 +/** Generic Outdoor Sports Activity */ +#define BT_APPEARANCE_GENERIC_OUTDOOR_SPORTS 0x1440 +/** Location Display */ +#define BT_APPEARANCE_OUTDOOR_SPORTS_LOCATION 0x1441 +/** Location and Navigation Display */ +#define BT_APPEARANCE_OUTDOOR_SPORTS_LOCATION_AND_NAV 0x1442 +/** Location Pod */ +#define BT_APPEARANCE_OUTDOOR_SPORTS_LOCATION_POD 0x1443 +/** Location and Navigation Pod */ +#define BT_APPEARANCE_OUTDOOR_SPORTS_LOCATION_POD_AND_NAV 0x1444 + +/** @} */ /* end of @name Appearance Numbers */ + +/** + * @name Common Data Types + * @{ + */ +#define BT_DATA_FLAGS 0x01 /**< AD flags */ +#define BT_DATA_UUID16_SOME 0x02 /**< 16-bit UUID, more available */ +#define BT_DATA_UUID16_ALL 0x03 /**< 16-bit UUID, all listed */ +#define BT_DATA_UUID32_SOME 0x04 /**< 32-bit UUID, more available */ +#define BT_DATA_UUID32_ALL 0x05 /**< 32-bit UUID, all listed */ +#define BT_DATA_UUID128_SOME 0x06 /**< 128-bit UUID, more available */ +#define BT_DATA_UUID128_ALL 0x07 /**< 128-bit UUID, all listed */ +#define BT_DATA_NAME_SHORTENED 0x08 /**< Shortened name */ +#define BT_DATA_NAME_COMPLETE 0x09 /**< Complete name */ +#define BT_DATA_TX_POWER 0x0a /**< Tx Power */ +#define BT_DATA_DEVICE_CLASS 0x0d /**< Class of Device */ +#define BT_DATA_SIMPLE_PAIRING_HASH_C192 0x0e /**< Simple Pairing Hash C-192 */ +#define BT_DATA_SIMPLE_PAIRING_RAND_C192 0x0f /**< Simple Pairing Randomizer R-192 */ +#define BT_DATA_DEVICE_ID 0x10 /**< Device ID (Profile) */ +#define BT_DATA_SM_TK_VALUE 0x10 /**< Security Manager TK Value */ +#define BT_DATA_SM_OOB_FLAGS 0x11 /**< Security Manager OOB Flags */ +#define BT_DATA_PERIPHERAL_INT_RANGE 0x12 /**< Peripheral Connection Interval Range */ +#define BT_DATA_SOLICIT16 0x14 /**< Solicit UUIDs, 16-bit */ +#define BT_DATA_SOLICIT128 0x15 /**< Solicit UUIDs, 128-bit */ +#define BT_DATA_SVC_DATA16 0x16 /**< Service data, 16-bit UUID */ +#define BT_DATA_PUB_TARGET_ADDR 0x17 /**< Public Target Address */ +#define BT_DATA_RAND_TARGET_ADDR 0x18 /**< Random Target Address */ +#define BT_DATA_GAP_APPEARANCE 0x19 /**< GAP appearance */ +#define BT_DATA_ADV_INT 0x1a /**< Advertising Interval */ +#define BT_DATA_LE_BT_DEVICE_ADDRESS 0x1b /**< LE Bluetooth Device Address */ +#define BT_DATA_LE_ROLE 0x1c /**< LE Role */ +#define BT_DATA_SIMPLE_PAIRING_HASH 0x1d /**< Simple Pairing Hash C256 */ +#define BT_DATA_SIMPLE_PAIRING_RAND 0x1e /**< Simple Pairing Randomizer R256 */ +#define BT_DATA_SOLICIT32 0x1f /**< Solicit UUIDs, 32-bit */ +#define BT_DATA_SVC_DATA32 0x20 /**< Service data, 32-bit UUID */ +#define BT_DATA_SVC_DATA128 0x21 /**< Service data, 128-bit UUID */ +#define BT_DATA_LE_SC_CONFIRM_VALUE 0x22 /**< LE SC Confirmation Value */ +#define BT_DATA_LE_SC_RANDOM_VALUE 0x23 /**< LE SC Random Value */ +#define BT_DATA_URI 0x24 /**< URI */ +#define BT_DATA_INDOOR_POS 0x25 /**< Indoor Positioning */ +#define BT_DATA_TRANS_DISCOVER_DATA 0x26 /**< Transport Discovery Data */ +#define BT_DATA_LE_SUPPORTED_FEATURES 0x27 /**< LE Supported Features */ +#define BT_DATA_CHANNEL_MAP_UPDATE_IND 0x28 /**< Channel Map Update Indication */ +#define BT_DATA_MESH_PROV 0x29 /**< Mesh Provisioning PDU */ +#define BT_DATA_MESH_MESSAGE 0x2a /**< Mesh Networking PDU */ +#define BT_DATA_MESH_BEACON 0x2b /**< Mesh Beacon */ +#define BT_DATA_BIG_INFO 0x2c /**< BIGInfo */ +#define BT_DATA_BROADCAST_CODE 0x2d /**< Broadcast Code */ +#define BT_DATA_CSIS_RSI 0x2e /**< CSIS Random Set ID type */ +#define BT_DATA_ADV_INT_LONG 0x2f /**< Advertising Interval long */ +#define BT_DATA_BROADCAST_NAME 0x30 /**< Broadcast Name */ +#define BT_DATA_ENCRYPTED_AD_DATA 0x31 /**< Encrypted Advertising Data */ +#define BT_DATA_PAWR_TIMING_INFO 0x32 /**< Periodic Advertising Response Timing Info */ +#define BT_DATA_ESL 0x34 /**< Electronic Shelf Label Profile */ +#define BT_DATA_3D_INFO 0x3D /**< 3D Information Data */ + +#define BT_DATA_MANUFACTURER_DATA 0xff /**< Manufacturer Specific Data */ + +/** @} */ /* end of @name Common Data Types */ + +/** + * @name Flags data type values + * @{ + */ + +#define BT_LE_AD_LIMITED 0x01 /**< Limited Discoverable */ +#define BT_LE_AD_GENERAL 0x02 /**< General Discoverable */ +#define BT_LE_AD_NO_BREDR 0x04 /**< BR/EDR not supported */ + +/** @} */ /* end of @name Flags data type values */ +/** @} */ /* end of bt_assigned_numbers_core */ + +/** + * @name Company Identifiers (see Bluetooth Assigned Numbers) + * @{ + */ + +#define BT_COMP_ID_LF 0x05f1 /**< The Linux Foundation */ + +/** @} */ /* end of @name Company Identifiers */ + +#ifdef __cplusplus +} +#endif + +/** + * @} + */ + +#endif /* ZEPHYR_INCLUDE_BLUETOOTH_ASSIGNED_NUMBERS_H_ */ diff --git a/include/zephyr/bluetooth/gap.h b/include/zephyr/bluetooth/gap.h index a6ca5d0ebdc7..b446ad521d4c 100644 --- a/include/zephyr/bluetooth/gap.h +++ b/include/zephyr/bluetooth/gap.h @@ -11,6 +11,7 @@ #ifndef ZEPHYR_INCLUDE_BLUETOOTH_GAP_H_ #define ZEPHYR_INCLUDE_BLUETOOTH_GAP_H_ +#include #include #include @@ -34,682 +35,6 @@ extern "C" { * @} */ -/** - * @name EIR/AD data type definitions - * @{ - */ -#define BT_DATA_FLAGS 0x01 /**< AD flags */ -#define BT_DATA_UUID16_SOME 0x02 /**< 16-bit UUID, more available */ -#define BT_DATA_UUID16_ALL 0x03 /**< 16-bit UUID, all listed */ -#define BT_DATA_UUID32_SOME 0x04 /**< 32-bit UUID, more available */ -#define BT_DATA_UUID32_ALL 0x05 /**< 32-bit UUID, all listed */ -#define BT_DATA_UUID128_SOME 0x06 /**< 128-bit UUID, more available */ -#define BT_DATA_UUID128_ALL 0x07 /**< 128-bit UUID, all listed */ -#define BT_DATA_NAME_SHORTENED 0x08 /**< Shortened name */ -#define BT_DATA_NAME_COMPLETE 0x09 /**< Complete name */ -#define BT_DATA_TX_POWER 0x0a /**< Tx Power */ -#define BT_DATA_DEVICE_CLASS 0x0d /**< Class of Device */ -#define BT_DATA_SIMPLE_PAIRING_HASH_C192 0x0e /**< Simple Pairing Hash C-192 */ -#define BT_DATA_SIMPLE_PAIRING_RAND_C192 0x0f /**< Simple Pairing Randomizer R-192 */ -#define BT_DATA_DEVICE_ID 0x10 /**< Device ID (Profile) */ -#define BT_DATA_SM_TK_VALUE 0x10 /**< Security Manager TK Value */ -#define BT_DATA_SM_OOB_FLAGS 0x11 /**< Security Manager OOB Flags */ -#define BT_DATA_PERIPHERAL_INT_RANGE 0x12 /**< Peripheral Connection Interval Range */ -#define BT_DATA_SOLICIT16 0x14 /**< Solicit UUIDs, 16-bit */ -#define BT_DATA_SOLICIT128 0x15 /**< Solicit UUIDs, 128-bit */ -#define BT_DATA_SVC_DATA16 0x16 /**< Service data, 16-bit UUID */ -#define BT_DATA_PUB_TARGET_ADDR 0x17 /**< Public Target Address */ -#define BT_DATA_RAND_TARGET_ADDR 0x18 /**< Random Target Address */ -#define BT_DATA_GAP_APPEARANCE 0x19 /**< GAP appearance */ -#define BT_DATA_ADV_INT 0x1a /**< Advertising Interval */ -#define BT_DATA_LE_BT_DEVICE_ADDRESS 0x1b /**< LE Bluetooth Device Address */ -#define BT_DATA_LE_ROLE 0x1c /**< LE Role */ -#define BT_DATA_SIMPLE_PAIRING_HASH 0x1d /**< Simple Pairing Hash C256 */ -#define BT_DATA_SIMPLE_PAIRING_RAND 0x1e /**< Simple Pairing Randomizer R256 */ -#define BT_DATA_SOLICIT32 0x1f /**< Solicit UUIDs, 32-bit */ -#define BT_DATA_SVC_DATA32 0x20 /**< Service data, 32-bit UUID */ -#define BT_DATA_SVC_DATA128 0x21 /**< Service data, 128-bit UUID */ -#define BT_DATA_LE_SC_CONFIRM_VALUE 0x22 /**< LE SC Confirmation Value */ -#define BT_DATA_LE_SC_RANDOM_VALUE 0x23 /**< LE SC Random Value */ -#define BT_DATA_URI 0x24 /**< URI */ -#define BT_DATA_INDOOR_POS 0x25 /**< Indoor Positioning */ -#define BT_DATA_TRANS_DISCOVER_DATA 0x26 /**< Transport Discovery Data */ -#define BT_DATA_LE_SUPPORTED_FEATURES 0x27 /**< LE Supported Features */ -#define BT_DATA_CHANNEL_MAP_UPDATE_IND 0x28 /**< Channel Map Update Indication */ -#define BT_DATA_MESH_PROV 0x29 /**< Mesh Provisioning PDU */ -#define BT_DATA_MESH_MESSAGE 0x2a /**< Mesh Networking PDU */ -#define BT_DATA_MESH_BEACON 0x2b /**< Mesh Beacon */ -#define BT_DATA_BIG_INFO 0x2c /**< BIGInfo */ -#define BT_DATA_BROADCAST_CODE 0x2d /**< Broadcast Code */ -#define BT_DATA_CSIS_RSI 0x2e /**< CSIS Random Set ID type */ -#define BT_DATA_ADV_INT_LONG 0x2f /**< Advertising Interval long */ -#define BT_DATA_BROADCAST_NAME 0x30 /**< Broadcast Name */ -#define BT_DATA_ENCRYPTED_AD_DATA 0x31 /**< Encrypted Advertising Data */ -#define BT_DATA_PAWR_TIMING_INFO 0x32 /**< Periodic Advertising Response Timing Info */ -#define BT_DATA_ESL 0x34 /**< Electronic Shelf Label Profile */ -#define BT_DATA_3D_INFO 0x3D /**< 3D Information Data */ - -#define BT_DATA_MANUFACTURER_DATA 0xff /**< Manufacturer Specific Data */ - -#define BT_LE_AD_LIMITED 0x01 /**< Limited Discoverable */ -#define BT_LE_AD_GENERAL 0x02 /**< General Discoverable */ -#define BT_LE_AD_NO_BREDR 0x04 /**< BR/EDR not supported */ -/** - * @} - */ - -/** - * @name Appearance Values - * - * Last Modified on 2023-01-05 - * @{ - */ -/** Generic Unknown */ -#define BT_APPEARANCE_UNKNOWN 0x0000 -/** Generic Phone */ -#define BT_APPEARANCE_GENERIC_PHONE 0x0040 -/** Generic Computer */ -#define BT_APPEARANCE_GENERIC_COMPUTER 0x0080 -/** Desktop Workstation */ -#define BT_APPEARANCE_COMPUTER_DESKTOP_WORKSTATION 0x0081 -/** Server-class Computer */ -#define BT_APPEARANCE_COMPUTER_SERVER_CLASS 0x0082 -/** Laptop */ -#define BT_APPEARANCE_COMPUTER_LAPTOP 0x0083 -/** Handheld PC/PDA (clamshell) */ -#define BT_APPEARANCE_COMPUTER_HANDHELD_PCPDA 0x0084 -/** Palm­size PC/PDA */ -#define BT_APPEARANCE_COMPUTER_PALMSIZE_PCPDA 0x0085 -/** Wearable computer (watch size) */ -#define BT_APPEARANCE_COMPUTER_WEARABLE_COMPUTER 0x0086 -/** Tablet */ -#define BT_APPEARANCE_COMPUTER_TABLET 0x0087 -/** Docking Station */ -#define BT_APPEARANCE_COMPUTER_DOCKING_STATION 0x0088 -/** All in One */ -#define BT_APPEARANCE_COMPUTER_ALL_IN_ONE 0x0089 -/** Blade Server */ -#define BT_APPEARANCE_COMPUTER_BLADE_SERVER 0x008A -/** Convertible */ -#define BT_APPEARANCE_COMPUTER_CONVERTIBLE 0x008B -/** Detachable */ -#define BT_APPEARANCE_COMPUTER_DETACHABLE 0x008C -/** IoT Gateway */ -#define BT_APPEARANCE_COMPUTER_IOT_GATEWAY 0x008D -/** Mini PC */ -#define BT_APPEARANCE_COMPUTER_MINI_PC 0x008E -/** Stick PC */ -#define BT_APPEARANCE_COMPUTER_STICK_PC 0x008F -/** Generic Watch */ -#define BT_APPEARANCE_GENERIC_WATCH 0x00C0 -/** Sports Watch */ -#define BT_APPEARANCE_SPORTS_WATCH 0x00C1 -/** Smartwatch */ -#define BT_APPEARANCE_SMARTWATCH 0x00C2 -/** Generic Clock */ -#define BT_APPEARANCE_GENERIC_CLOCK 0x0100 -/** Generic Display */ -#define BT_APPEARANCE_GENERIC_DISPLAY 0x0140 -/** Generic Remote Control */ -#define BT_APPEARANCE_GENERIC_REMOTE 0x0180 -/** Generic Eye-glasses */ -#define BT_APPEARANCE_GENERIC_EYEGLASSES 0x01C0 -/** Generic Tag */ -#define BT_APPEARANCE_GENERIC_TAG 0x0200 -/** Generic Keyring */ -#define BT_APPEARANCE_GENERIC_KEYRING 0x0240 -/** Generic Media Player */ -#define BT_APPEARANCE_GENERIC_MEDIA_PLAYER 0x0280 -/** Generic Barcode Scanner */ -#define BT_APPEARANCE_GENERIC_BARCODE_SCANNER 0x02C0 -/** Generic Thermometer */ -#define BT_APPEARANCE_GENERIC_THERMOMETER 0x0300 -/** Ear Thermometer */ -#define BT_APPEARANCE_THERMOMETER_EAR 0x0301 -/** Generic Heart Rate Sensor */ -#define BT_APPEARANCE_GENERIC_HEART_RATE 0x0340 -/** Heart Rate Belt */ -#define BT_APPEARANCE_HEART_RATE_BELT 0x0341 -/** Generic Blood Pressure */ -#define BT_APPEARANCE_GENERIC_BLOOD_PRESSURE 0x0380 -/** Arm Blood Pressure */ -#define BT_APPEARANCE_BLOOD_PRESSURE_ARM 0x0381 -/** Wrist Blood Pressure */ -#define BT_APPEARANCE_BLOOD_PRESSURE_WRIST 0x0382 -/** Generic Human Interface Device */ -#define BT_APPEARANCE_GENERIC_HID 0x03C0 -/** Keyboard */ -#define BT_APPEARANCE_HID_KEYBOARD 0x03C1 -/** Mouse */ -#define BT_APPEARANCE_HID_MOUSE 0x03C2 -/** Joystick */ -#define BT_APPEARANCE_HID_JOYSTICK 0x03C3 -/** Gamepad */ -#define BT_APPEARANCE_HID_GAMEPAD 0x03C4 -/** Digitizer Tablet */ -#define BT_APPEARANCE_HID_DIGITIZER_TABLET 0x03C5 -/** Card Reader */ -#define BT_APPEARANCE_HID_CARD_READER 0x03C6 -/** Digital Pen */ -#define BT_APPEARANCE_HID_DIGITAL_PEN 0x03C7 -/** Barcode Scanner */ -#define BT_APPEARANCE_HID_BARCODE_SCANNER 0x03C8 -/** Touchpad */ -#define BT_APPEARANCE_HID_TOUCHPAD 0x03C9 -/** Presentation Remote */ -#define BT_APPEARANCE_HID_PRESENTATION_REMOTE 0x03CA -/** Generic Glucose Meter */ -#define BT_APPEARANCE_GENERIC_GLUCOSE 0x0400 -/** Generic Running Walking Sensor */ -#define BT_APPEARANCE_GENERIC_WALKING 0x0440 -/** In-Shoe Running Walking Sensor */ -#define BT_APPEARANCE_WALKING_IN_SHOE 0x0441 -/** On-Shoe Running Walking Sensor */ -#define BT_APPEARANCE_WALKING_ON_SHOE 0x0442 -/** On-Hip Running Walking Sensor */ -#define BT_APPEARANCE_WALKING_ON_HIP 0x0443 -/** Generic Cycling */ -#define BT_APPEARANCE_GENERIC_CYCLING 0x0480 -/** Cycling Computer */ -#define BT_APPEARANCE_CYCLING_COMPUTER 0x0481 -/** Speed Sensor */ -#define BT_APPEARANCE_CYCLING_SPEED 0x0482 -/** Cadence Sensor */ -#define BT_APPEARANCE_CYCLING_CADENCE 0x0483 -/** Power Sensor */ -#define BT_APPEARANCE_CYCLING_POWER 0x0484 -/** Speed and Cadence Sensor */ -#define BT_APPEARANCE_CYCLING_SPEED_CADENCE 0x0485 -/** Generic Control Device */ -#define BT_APPEARANCE_GENERIC_CONTROL_DEVICE 0x04C0 -/** Switch */ -#define BT_APPEARANCE_CONTROL_SWITCH 0x04C1 -/** Multi-switch */ -#define BT_APPEARANCE_CONTROL_MULTI_SWITCH 0x04C2 -/** Button */ -#define BT_APPEARANCE_CONTROL_BUTTON 0x04C3 -/** Slider */ -#define BT_APPEARANCE_CONTROL_SLIDER 0x04C4 -/** Rotary Switch */ -#define BT_APPEARANCE_CONTROL_ROTARY_SWITCH 0x04C5 -/** Touch Panel */ -#define BT_APPEARANCE_CONTROL_TOUCH_PANEL 0x04C6 -/** Single Switch */ -#define BT_APPEARANCE_CONTROL_SINGLE_SWITCH 0x04C7 -/** Double Switch */ -#define BT_APPEARANCE_CONTROL_DOUBLE_SWITCH 0x04C8 -/** Triple Switch */ -#define BT_APPEARANCE_CONTROL_TRIPLE_SWITCH 0x04C9 -/** Battery Switch */ -#define BT_APPEARANCE_CONTROL_BATTERY_SWITCH 0x04CA -/** Energy Harvesting Switch */ -#define BT_APPEARANCE_CONTROL_ENERGY_HARVESTING_SWITCH 0x04CB -/** Push Button */ -#define BT_APPEARANCE_CONTROL_PUSH_BUTTON 0x04CC -/** Generic Network Device */ -#define BT_APPEARANCE_GENERIC_NETWORK_DEVICE 0x0500 -/** Access Point */ -#define BT_APPEARANCE_NETWORK_ACCESS_POINT 0x0501 -/** Mesh Device */ -#define BT_APPEARANCE_NETWORK_MESH_DEVICE 0x0502 -/** Mesh Network Proxy */ -#define BT_APPEARANCE_NETWORK_MESH_PROXY 0x0503 -/** Generic Sensor */ -#define BT_APPEARANCE_GENERIC_SENSOR 0x0540 -/** Motion Sensor */ -#define BT_APPEARANCE_SENSOR_MOTION 0x0541 -/** Air quality Sensor */ -#define BT_APPEARANCE_SENSOR_AIR_QUALITY 0x0542 -/** Temperature Sensor */ -#define BT_APPEARANCE_SENSOR_TEMPERATURE 0x0543 -/** Humidity Sensor */ -#define BT_APPEARANCE_SENSOR_HUMIDITY 0x0544 -/** Leak Sensor */ -#define BT_APPEARANCE_SENSOR_LEAK 0x0545 -/** Smoke Sensor */ -#define BT_APPEARANCE_SENSOR_SMOKE 0x0546 -/** Occupancy Sensor */ -#define BT_APPEARANCE_SENSOR_OCCUPANCY 0x0547 -/** Contact Sensor */ -#define BT_APPEARANCE_SENSOR_CONTACT 0x0548 -/** Carbon Monoxide Sensor */ -#define BT_APPEARANCE_SENSOR_CARBON_MONOXIDE 0x0549 -/** Carbon Dioxide Sensor */ -#define BT_APPEARANCE_SENSOR_CARBON_DIOXIDE 0x054A -/** Ambient Light Sensor */ -#define BT_APPEARANCE_SENSOR_AMBIENT_LIGHT 0x054B -/** Energy Sensor */ -#define BT_APPEARANCE_SENSOR_ENERGY 0x054C -/** Color Light Sensor */ -#define BT_APPEARANCE_SENSOR_COLOR_LIGHT 0x054D -/** Rain Sensor */ -#define BT_APPEARANCE_SENSOR_RAIN 0x054E -/** Fire Sensor */ -#define BT_APPEARANCE_SENSOR_FIRE 0x054F -/** Wind Sensor */ -#define BT_APPEARANCE_SENSOR_WIND 0x0550 -/** Proximity Sensor */ -#define BT_APPEARANCE_SENSOR_PROXIMITY 0x0551 -/** Multi-Sensor */ -#define BT_APPEARANCE_SENSOR_MULTI 0x0552 -/** Flush Mounted Sensor */ -#define BT_APPEARANCE_SENSOR_FLUSH_MOUNTED 0x0553 -/** Ceiling Mounted Sensor */ -#define BT_APPEARANCE_SENSOR_CEILING_MOUNTED 0x0554 -/** Wall Mounted Sensor */ -#define BT_APPEARANCE_SENSOR_WALL_MOUNTED 0x0555 -/** Multisensor */ -#define BT_APPEARANCE_MULTISENSOR 0x0556 -/** Energy Meter */ -#define BT_APPEARANCE_SENSOR_ENERGY_METER 0x0557 -/** Flame Detector */ -#define BT_APPEARANCE_SENSOR_FLAME_DETECTOR 0x0558 -/** Vehicle Tire Pressure Sensor */ -#define BT_APPEARANCE_SENSOR_VEHICLE_TIRE_PRESSURE 0x0559 -/** Generic Light Fixtures */ -#define BT_APPEARANCE_GENERIC_LIGHT_FIXTURES 0x0580 -/** Wall Light */ -#define BT_APPEARANCE_LIGHT_FIXTURES_WALL 0x0581 -/** Ceiling Light */ -#define BT_APPEARANCE_LIGHT_FIXTURES_CEILING 0x0582 -/** Floor Light */ -#define BT_APPEARANCE_LIGHT_FIXTURES_FLOOR 0x0583 -/** Cabinet Light */ -#define BT_APPEARANCE_LIGHT_FIXTURES_CABINET 0x0584 -/** Desk Light */ -#define BT_APPEARANCE_LIGHT_FIXTURES_DESK 0x0585 -/** Troffer Light */ -#define BT_APPEARANCE_LIGHT_FIXTURES_TROFFER 0x0586 -/** Pendant Light */ -#define BT_APPEARANCE_LIGHT_FIXTURES_PENDANT 0x0587 -/** In-ground Light */ -#define BT_APPEARANCE_LIGHT_FIXTURES_IN_GROUND 0x0588 -/** Flood Light */ -#define BT_APPEARANCE_LIGHT_FIXTURES_FLOOD 0x0589 -/** Underwater Light */ -#define BT_APPEARANCE_LIGHT_FIXTURES_UNDERWATER 0x058A -/** Bollard with Light */ -#define BT_APPEARANCE_LIGHT_FIXTURES_BOLLARD_WITH 0x058B -/** Pathway Light */ -#define BT_APPEARANCE_LIGHT_FIXTURES_PATHWAY 0x058C -/** Garden Light */ -#define BT_APPEARANCE_LIGHT_FIXTURES_GARDEN 0x058D -/** Pole-top Light */ -#define BT_APPEARANCE_LIGHT_FIXTURES_POLE_TOP 0x058E -/** Spotlight */ -#define BT_APPEARANCE_SPOT_LIGHT 0x058F -/** Linear Light */ -#define BT_APPEARANCE_LIGHT_FIXTURES_LINEAR 0x0590 -/** Street Light */ -#define BT_APPEARANCE_LIGHT_FIXTURES_STREET 0x0591 -/** Shelves Light */ -#define BT_APPEARANCE_LIGHT_FIXTURES_SHELVES 0x0592 -/** Bay Light */ -#define BT_APPEARANCE_LIGHT_FIXTURES_BAY 0x0593 -/** Emergency Exit Light */ -#define BT_APPEARANCE_LIGHT_FIXTURES_EMERGENCY_EXIT 0x0594 -/** Light Controller */ -#define BT_APPEARANCE_LIGHT_FIXTURES_CONTROLLER 0x0595 -/** Light Driver */ -#define BT_APPEARANCE_LIGHT_FIXTURES_DRIVER 0x0596 -/** Bulb */ -#define BT_APPEARANCE_LIGHT_FIXTURES_BULB 0x0597 -/** Low-bay Light */ -#define BT_APPEARANCE_LIGHT_FIXTURES_LOW_BAY 0x0598 -/** High-bay Light */ -#define BT_APPEARANCE_LIGHT_FIXTURES_HIGH_BAY 0x0599 -/** Generic Fan */ -#define BT_APPEARANCE_GENERIC_FAN 0x05C0 -/** Ceiling Fan */ -#define BT_APPEARANCE_FAN_CEILING 0x05C1 -/** Axial Fan */ -#define BT_APPEARANCE_FAN_AXIAL 0x05C2 -/** Exhaust Fan */ -#define BT_APPEARANCE_FAN_EXHAUST 0x05C3 -/** Pedestal Fan */ -#define BT_APPEARANCE_FAN_PEDESTAL 0x05C4 -/** Desk Fan */ -#define BT_APPEARANCE_FAN_DESK 0x05C5 -/** Wall Fan */ -#define BT_APPEARANCE_FAN_WALL 0x05C6 -/** Generic HVAC */ -#define BT_APPEARANCE_GENERIC_HVAC 0x0600 -/** Thermostat */ -#define BT_APPEARANCE_HVAC_THERMOSTAT 0x0601 -/** Humidifier */ -#define BT_APPEARANCE_HVAC_HUMIDIFIER 0x0602 -/** De-humidifier */ -#define BT_APPEARANCE_HVAC_DEHUMIDIFIER 0x0603 -/** Heater */ -#define BT_APPEARANCE_HVAC_HEATER 0x0604 -/** Radiator */ -#define BT_APPEARANCE_HVAC_RADIATOR 0x0605 -/** Boiler */ -#define BT_APPEARANCE_HVAC_BOILER 0x0606 -/** Heat Pump */ -#define BT_APPEARANCE_HVAC_HEAT_PUMP 0x0607 -/** Infrared Heater */ -#define BT_APPEARANCE_HVAC_INFRARED_HEATER 0x0608 -/** Radiant Panel Heater */ -#define BT_APPEARANCE_HVAC_RADIANT_PANEL_HEATER 0x0609 -/** Fan Heater */ -#define BT_APPEARANCE_HVAC_FAN_HEATER 0x060A -/** Air Curtain */ -#define BT_APPEARANCE_HVAC_AIR_CURTAIN 0x060B -/** Generic Air Conditioning */ -#define BT_APPEARANCE_GENERIC_AIR_CONDITIONING 0x0640 -/** Generic Humidifier */ -#define BT_APPEARANCE_GENERIC_HUMIDIFIER 0x0680 -/** Generic Heating */ -#define BT_APPEARANCE_GENERIC_HEATING 0x06C0 -/** Radiator */ -#define BT_APPEARANCE_HEATING_RADIATOR 0x06C1 -/** Boiler */ -#define BT_APPEARANCE_HEATING_BOILER 0x06C2 -/** Heat Pump */ -#define BT_APPEARANCE_HEATING_HEAT_PUMP 0x06C3 -/** Infrared Heater */ -#define BT_APPEARANCE_HEATING_INFRARED_HEATER 0x06C4 -/** Radiant Panel Heater */ -#define BT_APPEARANCE_HEATING_RADIANT_PANEL_HEATER 0x06C5 -/** Fan Heater */ -#define BT_APPEARANCE_HEATING_FAN_HEATER 0x06C6 -/** Air Curtain */ -#define BT_APPEARANCE_HEATING_AIR_CURTAIN 0x06C7 -/** Generic Access Control */ -#define BT_APPEARANCE_GENERIC_ACCESS_CONTROL 0x0700 -/** Access Door */ -#define BT_APPEARANCE_CONTROL_ACCESS_DOOR 0x0701 -/** Garage Door */ -#define BT_APPEARANCE_CONTROL_GARAGE_DOOR 0x0702 -/** Emergency Exit Door */ -#define BT_APPEARANCE_CONTROL_EMERGENCY_EXIT_DOOR 0x0703 -/** Access Lock */ -#define BT_APPEARANCE_CONTROL_ACCESS_LOCK 0x0704 -/** Elevator */ -#define BT_APPEARANCE_CONTROL_ELEVATOR 0x0705 -/** Window */ -#define BT_APPEARANCE_CONTROL_WINDOW 0x0706 -/** Entrance Gate */ -#define BT_APPEARANCE_CONTROL_ENTRANCE_GATE 0x0707 -/** Door Lock */ -#define BT_APPEARANCE_CONTROL_DOOR_LOCK 0x0708 -/** Locker */ -#define BT_APPEARANCE_CONTROL_LOCKER 0x0709 -/** Generic Motorized Device */ -#define BT_APPEARANCE_GENERIC_MOTORIZED_DEVICE 0x0740 -/** Motorized Gate */ -#define BT_APPEARANCE_MOTORIZED_GATE 0x0741 -/** Awning */ -#define BT_APPEARANCE_MOTORIZED_AWNING 0x0742 -/** Blinds or Shades */ -#define BT_APPEARANCE_MOTORIZED_BLINDS_OR_SHADES 0x0743 -/** Curtains */ -#define BT_APPEARANCE_MOTORIZED_CURTAINS 0x0744 -/** Screen */ -#define BT_APPEARANCE_MOTORIZED_SCREEN 0x0745 -/** Generic Power Device */ -#define BT_APPEARANCE_GENERIC_POWER_DEVICE 0x0780 -/** Power Outlet */ -#define BT_APPEARANCE_POWER_OUTLET 0x0781 -/** Power Strip */ -#define BT_APPEARANCE_POWER_STRIP 0x0782 -/** Plug */ -#define BT_APPEARANCE_POWER_PLUG 0x0783 -/** Power Supply */ -#define BT_APPEARANCE_POWER_SUPPLY 0x0784 -/** LED Driver */ -#define BT_APPEARANCE_POWER_LED_DRIVER 0x0785 -/** Fluorescent Lamp Gear */ -#define BT_APPEARANCE_POWER_FLUORESCENT_LAMP_GEAR 0x0786 -/** HID Lamp Gear */ -#define BT_APPEARANCE_POWER_HID_LAMP_GEAR 0x0787 -/** Charge Case */ -#define BT_APPEARANCE_POWER_CHARGE_CASE 0x0788 -/** Power Bank */ -#define BT_APPEARANCE_POWER_POWER_BANK 0x0789 -/** Generic Light Source */ -#define BT_APPEARANCE_GENERIC_LIGHT_SOURCE 0x07C0 -/** Incandescent Light Bulb */ -#define BT_APPEARANCE_LIGHT_SOURCE_INCANDESCENT_BULB 0x07C1 -/** LED Lamp */ -#define BT_APPEARANCE_LIGHT_SOURCE_LED_LAMP 0x07C2 -/** HID Lamp */ -#define BT_APPEARANCE_LIGHT_SOURCE_HID_LAMP 0x07C3 -/** Fluorescent Lamp */ -#define BT_APPEARANCE_LIGHT_SOURCE_FLUORESCENT_LAMP 0x07C4 -/** LED Array */ -#define BT_APPEARANCE_LIGHT_SOURCE_LED_ARRAY 0x07C5 -/** Multi-Color LED Array */ -#define BT_APPEARANCE_LIGHT_SOURCE_MULTICOLOR_LED_ARRAY 0x07C6 -/** Low voltage halogen */ -#define BT_APPEARANCE_LIGHT_SOURCE_LOW_VOLTAGE_HALOGEN 0x07C7 -/** Organic light emitting diode */ -#define BT_APPEARANCE_LIGHT_SOURCE_OLED 0x07C8 -/** Generic Window Covering */ -#define BT_APPEARANCE_GENERIC_WINDOW_COVERING 0x0800 -/** Window Shades */ -#define BT_APPEARANCE_WINDOW_SHADES 0x0801 -/** Window Blinds */ -#define BT_APPEARANCE_WINDOW_BLINDS 0x0802 -/** Window Awning */ -#define BT_APPEARANCE_WINDOW_AWNING 0x0803 -/** Window Curtain */ -#define BT_APPEARANCE_WINDOW_CURTAIN 0x0804 -/** Exterior Shutter */ -#define BT_APPEARANCE_WINDOW_EXTERIOR_SHUTTER 0x0805 -/** Exterior Screen */ -#define BT_APPEARANCE_WINDOW_EXTERIOR_SCREEN 0x0806 -/** Generic Audio Sink */ -#define BT_APPEARANCE_GENERIC_AUDIO_SINK 0x0840 -/** Standalone Speaker */ -#define BT_APPEARANCE_AUDIO_SINK_STANDALONE_SPEAKER 0x0841 -/** Soundbar */ -#define BT_APPEARANCE_AUDIO_SINK_SOUNDBAR 0x0842 -/** Bookshelf Speaker */ -#define BT_APPEARANCE_AUDIO_SINK_BOOKSHELF_SPEAKER 0x0843 -/** Standmounted Speaker */ -#define BT_APPEARANCE_AUDIO_SINK_STANDMOUNTED_SPEAKER 0x0844 -/** Speakerphone */ -#define BT_APPEARANCE_AUDIO_SINK_SPEAKERPHONE 0x0845 -/** Generic Audio Source */ -#define BT_APPEARANCE_GENERIC_AUDIO_SOURCE 0x0880 -/** Microphone */ -#define BT_APPEARANCE_AUDIO_SOURCE_MICROPHONE 0x0881 -/** Alarm */ -#define BT_APPEARANCE_AUDIO_SOURCE_ALARM 0x0882 -/** Bell */ -#define BT_APPEARANCE_AUDIO_SOURCE_BELL 0x0883 -/** Horn */ -#define BT_APPEARANCE_AUDIO_SOURCE_HORN 0x0884 -/** Broadcasting Device */ -#define BT_APPEARANCE_AUDIO_SOURCE_BROADCASTING_DEVICE 0x0885 -/** Service Desk */ -#define BT_APPEARANCE_AUDIO_SOURCE_SERVICE_DESK 0x0886 -/** Kiosk */ -#define BT_APPEARANCE_AUDIO_SOURCE_KIOSK 0x0887 -/** Broadcasting Room */ -#define BT_APPEARANCE_AUDIO_SOURCE_BROADCASTING_ROOM 0x0888 -/** Auditorium */ -#define BT_APPEARANCE_AUDIO_SOURCE_AUDITORIUM 0x0889 -/** Generic Motorized Vehicle */ -#define BT_APPEARANCE_GENERIC_MOTORIZED_VEHICLE 0x08C0 -/** Car */ -#define BT_APPEARANCE_VEHICLE_CAR 0x08C1 -/** Large Goods Vehicle */ -#define BT_APPEARANCE_VEHICLE_LARGE_GOODS 0x08C2 -/** 2-Wheeled Vehicle */ -#define BT_APPEARANCE_VEHICLE_TWO_WHEELED 0x08C3 -/** Motorbike */ -#define BT_APPEARANCE_VEHICLE_MOTORBIKE 0x08C4 -/** Scooter */ -#define BT_APPEARANCE_VEHICLE_SCOOTER 0x08C5 -/** Moped */ -#define BT_APPEARANCE_VEHICLE_MOPED 0x08C6 -/** 3-Wheeled Vehicle */ -#define BT_APPEARANCE_VEHICLE_THREE_WHEELED 0x08C7 -/** Light Vehicle */ -#define BT_APPEARANCE_VEHICLE_LIGHT 0x08C8 -/** Quad Bike */ -#define BT_APPEARANCE_VEHICLE_QUAD_BIKE 0x08C9 -/** Minibus */ -#define BT_APPEARANCE_VEHICLE_MINIBUS 0x08CA -/** Bus */ -#define BT_APPEARANCE_VEHICLE_BUS 0x08CB -/** Trolley */ -#define BT_APPEARANCE_VEHICLE_TROLLEY 0x08CC -/** Agricultural Vehicle */ -#define BT_APPEARANCE_VEHICLE_AGRICULTURAL 0x08CD -/** Camper/Caravan */ -#define BT_APPEARANCE_VEHICLE_CAMPER_OR_CARAVAN 0x08CE -/** Recreational Vehicle/Motor Home */ -#define BT_APPEARANCE_VEHICLE_RECREATIONAL 0x08CF -/** Generic Domestic Appliance */ -#define BT_APPEARANCE_GENERIC_DOMESTIC_APPLIANCE 0x0900 -/** Refrigerator */ -#define BT_APPEARANCE_APPLIANCE_REFRIGERATOR 0x0901 -/** Freezer */ -#define BT_APPEARANCE_APPLIANCE_FREEZER 0x0902 -/** Oven */ -#define BT_APPEARANCE_APPLIANCE_OVEN 0x0903 -/** Microwave */ -#define BT_APPEARANCE_APPLIANCE_MICROWAVE 0x0904 -/** Toaster */ -#define BT_APPEARANCE_APPLIANCE_TOASTER 0x0905 -/** Washing Machine */ -#define BT_APPEARANCE_APPLIANCE_WASHING_MACHINE 0x0906 -/** Dryer */ -#define BT_APPEARANCE_APPLIANCE_DRYER 0x0907 -/** Coffee maker */ -#define BT_APPEARANCE_APPLIANCE_COFFEE_MAKER 0x0908 -/** Clothes iron */ -#define BT_APPEARANCE_APPLIANCE_CLOTHES_IRON 0x0909 -/** Curling iron */ -#define BT_APPEARANCE_APPLIANCE_CURLING_IRON 0x090A -/** Hair dryer */ -#define BT_APPEARANCE_APPLIANCE_HAIR_DRYER 0x090B -/** Vacuum cleaner */ -#define BT_APPEARANCE_APPLIANCE_VACUUM_CLEANER 0x090C -/** Robotic vacuum cleaner */ -#define BT_APPEARANCE_APPLIANCE_ROBOTIC_VACUUM_CLEANER 0x090D -/** Rice cooker */ -#define BT_APPEARANCE_APPLIANCE_RICE_COOKER 0x090E -/** Clothes steamer */ -#define BT_APPEARANCE_APPLIANCE_CLOTHES_STEAMER 0x090F -/** Generic Wearable Audio Device */ -#define BT_APPEARANCE_GENERIC_WEARABLE_AUDIO_DEVICE 0x0940 -/** Earbud */ -#define BT_APPEARANCE_WEARABLE_AUDIO_DEVICE_EARBUD 0x0941 -/** Headset */ -#define BT_APPEARANCE_WEARABLE_AUDIO_DEVICE_HEADSET 0x0942 -/** Headphones */ -#define BT_APPEARANCE_WEARABLE_AUDIO_DEVICE_HEADPHONES 0x0943 -/** Neck Band */ -#define BT_APPEARANCE_WEARABLE_AUDIO_DEVICE_NECK_BAND 0x0944 -/** Generic Aircraft */ -#define BT_APPEARANCE_GENERIC_AIRCRAFT 0x0980 -/** Light Aircraft */ -#define BT_APPEARANCE_AIRCRAFT_LIGHT 0x0981 -/** Microlight */ -#define BT_APPEARANCE_AIRCRAFT_MICROLIGHT 0x0982 -/** Paraglider */ -#define BT_APPEARANCE_AIRCRAFT_PARAGLIDER 0x0983 -/** Large Passenger Aircraft */ -#define BT_APPEARANCE_AIRCRAFT_LARGE_PASSENGER 0x0984 -/** Generic AV Equipment */ -#define BT_APPEARANCE_GENERIC_AV_EQUIPMENT 0x09C0 -/** Amplifier */ -#define BT_APPEARANCE_AV_EQUIPMENT_AMPLIFIER 0x09C1 -/** Receiver */ -#define BT_APPEARANCE_AV_EQUIPMENT_RECEIVER 0x09C2 -/** Radio */ -#define BT_APPEARANCE_AV_EQUIPMENT_RADIO 0x09C3 -/** Tuner */ -#define BT_APPEARANCE_AV_EQUIPMENT_TUNER 0x09C4 -/** Turntable */ -#define BT_APPEARANCE_AV_EQUIPMENT_TURNTABLE 0x09C5 -/** CD Player */ -#define BT_APPEARANCE_AV_EQUIPMENT_CD_PLAYER 0x09C6 -/** DVD Player */ -#define BT_APPEARANCE_AV_EQUIPMENT_DVD_PLAYER 0x09C7 -/** Bluray Player */ -#define BT_APPEARANCE_AV_EQUIPMENT_BLURAY_PLAYER 0x09C8 -/** Optical Disc Player */ -#define BT_APPEARANCE_AV_EQUIPMENT_OPTICAL_DISC_PLAYER 0x09C9 -/** Set-Top Box */ -#define BT_APPEARANCE_AV_EQUIPMENT_SET_TOP_BOX 0x09CA -/** Generic Display Equipment */ -#define BT_APPEARANCE_GENERIC_DISPLAY_EQUIPMENT 0x0A00 -/** Television */ -#define BT_APPEARANCE_DISPLAY_EQUIPMENT_TELEVISION 0x0A01 -/** Monitor */ -#define BT_APPEARANCE_DISPLAY_EQUIPMENT_MONITOR 0x0A02 -/** Projector */ -#define BT_APPEARANCE_DISPLAY_EQUIPMENT_PROJECTOR 0x0A03 -/** Generic Hearing aid */ -#define BT_APPEARANCE_GENERIC_HEARING_AID 0x0A40 -/** In-ear hearing aid */ -#define BT_APPEARANCE_HEARING_AID_IN_EAR 0x0A41 -/** Behind-ear hearing aid */ -#define BT_APPEARANCE_HEARING_AID_BEHIND_EAR 0x0A42 -/** Cochlear Implant */ -#define BT_APPEARANCE_HEARING_AID_COCHLEAR_IMPLANT 0x0A43 -/** Generic Gaming */ -#define BT_APPEARANCE_GENERIC_GAMING 0x0A80 -/** Home Video Game Console */ -#define BT_APPEARANCE_HOME_VIDEO_GAME_CONSOLE 0x0A81 -/** Portable handheld console */ -#define BT_APPEARANCE_PORTABLE_HANDHELD_CONSOLE 0x0A82 -/** Generic Signage */ -#define BT_APPEARANCE_GENERIC_SIGNAGE 0x0AC0 -/** Digital Signage */ -#define BT_APPEARANCE_SIGNAGE_DIGITAL 0x0AC1 -/** Electronic Label */ -#define BT_APPEARANCE_SIGNAGE_ELECTRONIC_LABEL 0x0AC2 -/** Generic Pulse Oximeter */ -#define BT_APPEARANCE_GENERIC_PULSE_OXIMETER 0x0C40 -/** Fingertip Pulse Oximeter */ -#define BT_APPEARANCE_PULSE_OXIMETER_FINGERTIP 0x0C41 -/** Wrist Worn Pulse Oximeter */ -#define BT_APPEARANCE_PULSE_OXIMETER_WRIST 0x0C42 -/** Generic Weight Scale */ -#define BT_APPEARANCE_GENERIC_WEIGHT_SCALE 0x0C80 -/** Generic Personal Mobility Device */ -#define BT_APPEARANCE_GENERIC_PERSONAL_MOBILITY_DEVICE 0x0CC0 -/** Powered Wheelchair */ -#define BT_APPEARANCE_MOBILITY_POWERED_WHEELCHAIR 0x0CC1 -/** Mobility Scooter */ -#define BT_APPEARANCE_MOBILITY_SCOOTER 0x0CC2 -/** Continuous Glucose Monitor */ -#define BT_APPEARANCE_CONTINUOUS_GLUCOSE_MONITOR 0x0D00 -/** Generic Insulin Pump */ -#define BT_APPEARANCE_GENERIC_INSULIN_PUMP 0x0D40 -/** Insulin Pump, durable pump */ -#define BT_APPEARANCE_INSULIN_PUMP_DURABLE 0x0D41 -/** Insulin Pump, patch pump */ -#define BT_APPEARANCE_INSULIN_PUMP_PATCH 0x0D44 -/** Insulin Pen */ -#define BT_APPEARANCE_INSULIN_PEN 0x0D48 -/** Generic Medication Delivery */ -#define BT_APPEARANCE_GENERIC_MEDICATION_DELIVERY 0x0D80 -/** Generic Spirometer */ -#define BT_APPEARANCE_GENERIC_SPIROMETER 0x0DC0 -/** Handheld Spirometer */ -#define BT_APPEARANCE_SPIROMETER_HANDHELD 0x0DC1 -/** Generic Outdoor Sports Activity */ -#define BT_APPEARANCE_GENERIC_OUTDOOR_SPORTS 0x1440 -/** Location Display */ -#define BT_APPEARANCE_OUTDOOR_SPORTS_LOCATION 0x1441 -/** Location and Navigation Display */ -#define BT_APPEARANCE_OUTDOOR_SPORTS_LOCATION_AND_NAV 0x1442 -/** Location Pod */ -#define BT_APPEARANCE_OUTDOOR_SPORTS_LOCATION_POD 0x1443 -/** Location and Navigation Pod */ -#define BT_APPEARANCE_OUTDOOR_SPORTS_LOCATION_POD_AND_NAV 0x1444 -/** - * @} - */ - /** * @name Defined GAP timers * @{ From a3309bba7d876e1433bdc12b01b00540ad4c24e0 Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Thu, 28 Aug 2025 08:34:27 +0200 Subject: [PATCH 2092/2141] [nrf fromtree] bluetooth: host: audio: move audio assigned numbers to dedicated header Move assigned number for audio from audio.h to assigned_numbers.h where all assigned numbers are located. Signed-off-by: Pavel Vasilyev (cherry picked from commit 690314040ee40286cbbb2b6fc030897c1e65cbbc) --- include/zephyr/bluetooth/assigned_numbers.h | 541 ++++++++++++++++++++ include/zephyr/bluetooth/audio/audio.h | 530 +------------------ 2 files changed, 542 insertions(+), 529 deletions(-) diff --git a/include/zephyr/bluetooth/assigned_numbers.h b/include/zephyr/bluetooth/assigned_numbers.h index de978b3cb1de..8cd5fc422c2d 100644 --- a/include/zephyr/bluetooth/assigned_numbers.h +++ b/include/zephyr/bluetooth/assigned_numbers.h @@ -21,6 +21,8 @@ * @{ */ +#include + #ifdef __cplusplus extern "C" { #endif @@ -715,6 +717,545 @@ extern "C" { /** @} */ /* end of @name Flags data type values */ /** @} */ /* end of bt_assigned_numbers_core */ +/** + * @brief Generic Audio Assigned Numbers + * @defgroup bt_assigned_numbers_audio Generic Audio Assigned Numbers + * @ingroup bt_assigned_numbers + * @{ + */ + +/** + * @brief Codec capability types + * + * Used to build and parse codec capabilities as specified in the PAC specification. + * Source is assigned numbers for Generic Audio, bluetooth.com. + */ +enum bt_audio_codec_cap_type { + /** Supported sampling frequencies */ + BT_AUDIO_CODEC_CAP_TYPE_FREQ = 0x01, + + /** Supported frame durations */ + BT_AUDIO_CODEC_CAP_TYPE_DURATION = 0x02, + + /** Supported audio channel counts */ + BT_AUDIO_CODEC_CAP_TYPE_CHAN_COUNT = 0x03, + + /** Supported octets per codec frame */ + BT_AUDIO_CODEC_CAP_TYPE_FRAME_LEN = 0x04, + + /** Supported maximum codec frames per SDU */ + BT_AUDIO_CODEC_CAP_TYPE_FRAME_COUNT = 0x05, +}; + +/** @brief Supported frequencies bitfield */ +enum bt_audio_codec_cap_freq { + /** 8 Khz sampling frequency */ + BT_AUDIO_CODEC_CAP_FREQ_8KHZ = BIT(0), + + /** 11.025 Khz sampling frequency */ + BT_AUDIO_CODEC_CAP_FREQ_11KHZ = BIT(1), + + /** 16 Khz sampling frequency */ + BT_AUDIO_CODEC_CAP_FREQ_16KHZ = BIT(2), + + /** 22.05 Khz sampling frequency */ + BT_AUDIO_CODEC_CAP_FREQ_22KHZ = BIT(3), + + /** 24 Khz sampling frequency */ + BT_AUDIO_CODEC_CAP_FREQ_24KHZ = BIT(4), + + /** 32 Khz sampling frequency */ + BT_AUDIO_CODEC_CAP_FREQ_32KHZ = BIT(5), + + /** 44.1 Khz sampling frequency */ + BT_AUDIO_CODEC_CAP_FREQ_44KHZ = BIT(6), + + /** 48 Khz sampling frequency */ + BT_AUDIO_CODEC_CAP_FREQ_48KHZ = BIT(7), + + /** 88.2 Khz sampling frequency */ + BT_AUDIO_CODEC_CAP_FREQ_88KHZ = BIT(8), + + /** 96 Khz sampling frequency */ + BT_AUDIO_CODEC_CAP_FREQ_96KHZ = BIT(9), + + /** 176.4 Khz sampling frequency */ + BT_AUDIO_CODEC_CAP_FREQ_176KHZ = BIT(10), + + /** 192 Khz sampling frequency */ + BT_AUDIO_CODEC_CAP_FREQ_192KHZ = BIT(11), + + /** 384 Khz sampling frequency */ + BT_AUDIO_CODEC_CAP_FREQ_384KHZ = BIT(12), + + /** Any frequency capability */ + BT_AUDIO_CODEC_CAP_FREQ_ANY = + (BT_AUDIO_CODEC_CAP_FREQ_8KHZ | BT_AUDIO_CODEC_CAP_FREQ_11KHZ | + BT_AUDIO_CODEC_CAP_FREQ_16KHZ | BT_AUDIO_CODEC_CAP_FREQ_22KHZ | + BT_AUDIO_CODEC_CAP_FREQ_24KHZ | BT_AUDIO_CODEC_CAP_FREQ_32KHZ | + BT_AUDIO_CODEC_CAP_FREQ_44KHZ | BT_AUDIO_CODEC_CAP_FREQ_48KHZ | + BT_AUDIO_CODEC_CAP_FREQ_88KHZ | BT_AUDIO_CODEC_CAP_FREQ_96KHZ | + BT_AUDIO_CODEC_CAP_FREQ_176KHZ | BT_AUDIO_CODEC_CAP_FREQ_192KHZ | + BT_AUDIO_CODEC_CAP_FREQ_384KHZ), +}; + +/** @brief Supported frame durations bitfield */ +enum bt_audio_codec_cap_frame_dur { + /** 7.5 msec frame duration capability */ + BT_AUDIO_CODEC_CAP_DURATION_7_5 = BIT(0), + + /** 10 msec frame duration capability */ + BT_AUDIO_CODEC_CAP_DURATION_10 = BIT(1), + + /** Any frame duration capability */ + BT_AUDIO_CODEC_CAP_DURATION_ANY = + (BT_AUDIO_CODEC_CAP_DURATION_7_5 | BT_AUDIO_CODEC_CAP_DURATION_10), + + /** + * @brief 7.5 msec preferred frame duration capability. + * + * This shall only be set if @ref BT_AUDIO_CODEC_CAP_DURATION_7_5 is also set, and if @ref + * BT_AUDIO_CODEC_CAP_DURATION_PREFER_10 is not set. + */ + BT_AUDIO_CODEC_CAP_DURATION_PREFER_7_5 = BIT(4), + + /** + * @brief 10 msec preferred frame duration capability + * + * This shall only be set if @ref BT_AUDIO_CODEC_CAP_DURATION_10 is also set, and if @ref + * BT_AUDIO_CODEC_CAP_DURATION_PREFER_7_5 is not set. + */ + BT_AUDIO_CODEC_CAP_DURATION_PREFER_10 = BIT(5), +}; + +/** Supported audio capabilities channel count bitfield */ +enum bt_audio_codec_cap_chan_count { + /** Supporting 1 channel */ + BT_AUDIO_CODEC_CAP_CHAN_COUNT_1 = BIT(0), + + /** Supporting 2 channel */ + BT_AUDIO_CODEC_CAP_CHAN_COUNT_2 = BIT(1), + + /** Supporting 3 channel */ + BT_AUDIO_CODEC_CAP_CHAN_COUNT_3 = BIT(2), + + /** Supporting 4 channel */ + BT_AUDIO_CODEC_CAP_CHAN_COUNT_4 = BIT(3), + + /** Supporting 5 channel */ + BT_AUDIO_CODEC_CAP_CHAN_COUNT_5 = BIT(4), + + /** Supporting 6 channel */ + BT_AUDIO_CODEC_CAP_CHAN_COUNT_6 = BIT(5), + + /** Supporting 7 channel */ + BT_AUDIO_CODEC_CAP_CHAN_COUNT_7 = BIT(6), + + /** Supporting 8 channel */ + BT_AUDIO_CODEC_CAP_CHAN_COUNT_8 = BIT(7), + + /** Supporting all channels */ + BT_AUDIO_CODEC_CAP_CHAN_COUNT_ANY = + (BT_AUDIO_CODEC_CAP_CHAN_COUNT_1 | BT_AUDIO_CODEC_CAP_CHAN_COUNT_2 | + BT_AUDIO_CODEC_CAP_CHAN_COUNT_3 | BT_AUDIO_CODEC_CAP_CHAN_COUNT_4 | + BT_AUDIO_CODEC_CAP_CHAN_COUNT_5 | BT_AUDIO_CODEC_CAP_CHAN_COUNT_6 | + BT_AUDIO_CODEC_CAP_CHAN_COUNT_7 | BT_AUDIO_CODEC_CAP_CHAN_COUNT_8), +}; + +/** Minimum supported channel counts */ +#define BT_AUDIO_CODEC_CAP_CHAN_COUNT_MIN 1 +/** Maximum supported channel counts */ +#define BT_AUDIO_CODEC_CAP_CHAN_COUNT_MAX 8 + +/** The minimum size of a Broadcast Name as defined by Bluetooth Assigned Numbers */ +#define BT_AUDIO_BROADCAST_NAME_LEN_MIN 4 +/** The maximum size of a Broadcast Name as defined by Bluetooth Assigned Numbers */ +#define BT_AUDIO_BROADCAST_NAME_LEN_MAX 128 + +/** + * @brief Codec configuration types + * + * Used to build and parse codec configurations as specified in the ASCS and BAP specifications. + * Source is assigned numbers for Generic Audio, bluetooth.com. + */ +enum bt_audio_codec_cfg_type { + /** Sampling frequency */ + BT_AUDIO_CODEC_CFG_FREQ = 0x01, + + /** Frame duration */ + BT_AUDIO_CODEC_CFG_DURATION = 0x02, + + /** Audio channel allocation */ + BT_AUDIO_CODEC_CFG_CHAN_ALLOC = 0x03, + + /** Octets per codec frame */ + BT_AUDIO_CODEC_CFG_FRAME_LEN = 0x04, + + /** Codec frame blocks per SDU */ + BT_AUDIO_CODEC_CFG_FRAME_BLKS_PER_SDU = 0x05, +}; + +/** Codec configuration sampling freqency */ +enum bt_audio_codec_cfg_freq { + /** 8 Khz codec sampling frequency */ + BT_AUDIO_CODEC_CFG_FREQ_8KHZ = 0x01, + + /** 11.025 Khz codec sampling frequency */ + BT_AUDIO_CODEC_CFG_FREQ_11KHZ = 0x02, + + /** 16 Khz codec sampling frequency */ + BT_AUDIO_CODEC_CFG_FREQ_16KHZ = 0x03, + + /** 22.05 Khz codec sampling frequency */ + BT_AUDIO_CODEC_CFG_FREQ_22KHZ = 0x04, + + /** 24 Khz codec sampling frequency */ + BT_AUDIO_CODEC_CFG_FREQ_24KHZ = 0x05, + + /** 32 Khz codec sampling frequency */ + BT_AUDIO_CODEC_CFG_FREQ_32KHZ = 0x06, + + /** 44.1 Khz codec sampling frequency */ + BT_AUDIO_CODEC_CFG_FREQ_44KHZ = 0x07, + + /** 48 Khz codec sampling frequency */ + BT_AUDIO_CODEC_CFG_FREQ_48KHZ = 0x08, + + /** 88.2 Khz codec sampling frequency */ + BT_AUDIO_CODEC_CFG_FREQ_88KHZ = 0x09, + + /** 96 Khz codec sampling frequency */ + BT_AUDIO_CODEC_CFG_FREQ_96KHZ = 0x0a, + + /** 176.4 Khz codec sampling frequency */ + BT_AUDIO_CODEC_CFG_FREQ_176KHZ = 0x0b, + + /** 192 Khz codec sampling frequency */ + BT_AUDIO_CODEC_CFG_FREQ_192KHZ = 0x0c, + + /** 384 Khz codec sampling frequency */ + BT_AUDIO_CODEC_CFG_FREQ_384KHZ = 0x0d, +}; + +/** Codec configuration frame duration */ +enum bt_audio_codec_cfg_frame_dur { + /** 7.5 msec Frame Duration configuration */ + BT_AUDIO_CODEC_CFG_DURATION_7_5 = 0x00, + + /** 10 msec Frame Duration configuration */ + BT_AUDIO_CODEC_CFG_DURATION_10 = 0x01, +}; + +/** + * @brief Audio Context Type for Generic Audio + * + * These values are defined by the Generic Audio Assigned Numbers, bluetooth.com + */ +enum bt_audio_context { + /** No context type */ + BT_AUDIO_CONTEXT_TYPE_NONE = 0, + /** + * Identifies audio where the use case context does not match any other defined value, + * or where the context is unknown or cannot be determined. + */ + BT_AUDIO_CONTEXT_TYPE_UNSPECIFIED = BIT(0), + /** + * Conversation between humans, for example, in telephony or video calls, including + * traditional cellular as well as VoIP and Push-to-Talk + */ + BT_AUDIO_CONTEXT_TYPE_CONVERSATIONAL = BIT(1), + /** Media, for example, music playback, radio, podcast or movie soundtrack, or tv audio */ + BT_AUDIO_CONTEXT_TYPE_MEDIA = BIT(2), + /** + * Audio associated with video gaming, for example gaming media; gaming effects; music + * and in-game voice chat between participants; or a mix of all the above + */ + BT_AUDIO_CONTEXT_TYPE_GAME = BIT(3), + /** Instructional audio, for example, in navigation, announcements, or user guidance */ + BT_AUDIO_CONTEXT_TYPE_INSTRUCTIONAL = BIT(4), + /** Man-machine communication, for example, with voice recognition or virtual assistants */ + BT_AUDIO_CONTEXT_TYPE_VOICE_ASSISTANTS = BIT(5), + /** + * Live audio, for example, from a microphone where audio is perceived both through a + * direct acoustic path and through an LE Audio Stream + */ + BT_AUDIO_CONTEXT_TYPE_LIVE = BIT(6), + /** + * Sound effects including keyboard and touch feedback; menu and user interface sounds; + * and other system sounds + */ + BT_AUDIO_CONTEXT_TYPE_SOUND_EFFECTS = BIT(7), + /** + * Notification and reminder sounds; attention-seeking audio, for example, + * in beeps signaling the arrival of a message + */ + BT_AUDIO_CONTEXT_TYPE_NOTIFICATIONS = BIT(8), + /** + * Alerts the user to an incoming call, for example, an incoming telephony or video call, + * including traditional cellular as well as VoIP and Push-to-Talk + */ + BT_AUDIO_CONTEXT_TYPE_RINGTONE = BIT(9), + /** + * Alarms and timers; immediate alerts, for example, in a critical battery alarm, + * timer expiry or alarm clock, toaster, cooker, kettle, microwave, etc. + */ + BT_AUDIO_CONTEXT_TYPE_ALERTS = BIT(10), + /** Emergency alarm Emergency sounds, for example, fire alarms or other urgent alerts */ + BT_AUDIO_CONTEXT_TYPE_EMERGENCY_ALARM = BIT(11), +}; + +/** + * Any known context. + */ +#define BT_AUDIO_CONTEXT_TYPE_ANY (BT_AUDIO_CONTEXT_TYPE_UNSPECIFIED | \ + BT_AUDIO_CONTEXT_TYPE_CONVERSATIONAL | \ + BT_AUDIO_CONTEXT_TYPE_MEDIA | \ + BT_AUDIO_CONTEXT_TYPE_GAME | \ + BT_AUDIO_CONTEXT_TYPE_INSTRUCTIONAL | \ + BT_AUDIO_CONTEXT_TYPE_VOICE_ASSISTANTS | \ + BT_AUDIO_CONTEXT_TYPE_LIVE | \ + BT_AUDIO_CONTEXT_TYPE_SOUND_EFFECTS | \ + BT_AUDIO_CONTEXT_TYPE_NOTIFICATIONS | \ + BT_AUDIO_CONTEXT_TYPE_RINGTONE | \ + BT_AUDIO_CONTEXT_TYPE_ALERTS | \ + BT_AUDIO_CONTEXT_TYPE_EMERGENCY_ALARM) + +/** + * @brief Parental rating defined by the Generic Audio assigned numbers (bluetooth.com). + * + * The numbering scheme is aligned with Annex F of EN 300 707 v1.2.1 which + * defined parental rating for viewing. + */ +enum bt_audio_parental_rating { + /** No rating */ + BT_AUDIO_PARENTAL_RATING_NO_RATING = 0x00, + /** For all ages */ + BT_AUDIO_PARENTAL_RATING_AGE_ANY = 0x01, + /** Recommended for listeners of age 5 and above */ + BT_AUDIO_PARENTAL_RATING_AGE_5_OR_ABOVE = 0x02, + /** Recommended for listeners of age 6 and above */ + BT_AUDIO_PARENTAL_RATING_AGE_6_OR_ABOVE = 0x03, + /** Recommended for listeners of age 7 and above */ + BT_AUDIO_PARENTAL_RATING_AGE_7_OR_ABOVE = 0x04, + /** Recommended for listeners of age 8 and above */ + BT_AUDIO_PARENTAL_RATING_AGE_8_OR_ABOVE = 0x05, + /** Recommended for listeners of age 9 and above */ + BT_AUDIO_PARENTAL_RATING_AGE_9_OR_ABOVE = 0x06, + /** Recommended for listeners of age 10 and above */ + BT_AUDIO_PARENTAL_RATING_AGE_10_OR_ABOVE = 0x07, + /** Recommended for listeners of age 11 and above */ + BT_AUDIO_PARENTAL_RATING_AGE_11_OR_ABOVE = 0x08, + /** Recommended for listeners of age 12 and above */ + BT_AUDIO_PARENTAL_RATING_AGE_12_OR_ABOVE = 0x09, + /** Recommended for listeners of age 13 and above */ + BT_AUDIO_PARENTAL_RATING_AGE_13_OR_ABOVE = 0x0A, + /** Recommended for listeners of age 14 and above */ + BT_AUDIO_PARENTAL_RATING_AGE_14_OR_ABOVE = 0x0B, + /** Recommended for listeners of age 15 and above */ + BT_AUDIO_PARENTAL_RATING_AGE_15_OR_ABOVE = 0x0C, + /** Recommended for listeners of age 16 and above */ + BT_AUDIO_PARENTAL_RATING_AGE_16_OR_ABOVE = 0x0D, + /** Recommended for listeners of age 17 and above */ + BT_AUDIO_PARENTAL_RATING_AGE_17_OR_ABOVE = 0x0E, + /** Recommended for listeners of age 18 and above */ + BT_AUDIO_PARENTAL_RATING_AGE_18_OR_ABOVE = 0x0F +}; + +/** @brief Audio Active State defined by the Generic Audio assigned numbers (bluetooth.com). */ +enum bt_audio_active_state { + /** No audio data is being transmitted */ + BT_AUDIO_ACTIVE_STATE_DISABLED = 0x00, + /** Audio data is being transmitted */ + BT_AUDIO_ACTIVE_STATE_ENABLED = 0x01, +}; + +/** Assisted Listening Stream defined by the Generic Audio assigned numbers (bluetooth.com). */ +enum bt_audio_assisted_listening_stream { + /** Unspecified audio enhancement */ + BT_AUDIO_ASSISTED_LISTENING_STREAM_UNSPECIFIED = 0x00, +}; + +/** + * @brief Codec metadata type IDs + * + * Metadata types defined by the Generic Audio assigned numbers (bluetooth.com). + */ +enum bt_audio_metadata_type { + /** + * @brief Preferred audio context. + * + * Bitfield of preferred audio contexts. + * + * If 0, the context type is not a preferred use case for this codec + * configuration. + * + * See the BT_AUDIO_CONTEXT_* for valid values. + */ + BT_AUDIO_METADATA_TYPE_PREF_CONTEXT = 0x01, + + /** + * @brief Streaming audio context. + * + * Bitfield of streaming audio contexts. + * + * If 0, the context type is not a preferred use case for this codec + * configuration. + * + * See the BT_AUDIO_CONTEXT_* for valid values. + */ + BT_AUDIO_METADATA_TYPE_STREAM_CONTEXT = 0x02, + + /** UTF-8 encoded title or summary of stream content */ + BT_AUDIO_METADATA_TYPE_PROGRAM_INFO = 0x03, + + /** + * @brief Language + * + * 3 octet lower case language code defined by ISO 639-3 + * Possible values can be found at https://iso639-3.sil.org/code_tables/639/data + */ + BT_AUDIO_METADATA_TYPE_LANG = 0x04, + + /** Array of 8-bit CCID values */ + BT_AUDIO_METADATA_TYPE_CCID_LIST = 0x05, + + /** + * @brief Parental rating + * + * See @ref bt_audio_parental_rating for valid values. + */ + BT_AUDIO_METADATA_TYPE_PARENTAL_RATING = 0x06, + + /** UTF-8 encoded URI for additional Program information */ + BT_AUDIO_METADATA_TYPE_PROGRAM_INFO_URI = 0x07, + + /** + * @brief Audio active state + * + * See @ref bt_audio_active_state for valid values. + */ + BT_AUDIO_METADATA_TYPE_AUDIO_STATE = 0x08, + + /** Broadcast Audio Immediate Rendering flag */ + BT_AUDIO_METADATA_TYPE_BROADCAST_IMMEDIATE = 0x09, + + /** + * @brief Assisted listening stream + * + * See @ref bt_audio_assisted_listening_stream for valid values. + */ + BT_AUDIO_METADATA_TYPE_ASSISTED_LISTENING_STREAM = 0x0A, + + /** UTF-8 encoded Broadcast name */ + BT_AUDIO_METADATA_TYPE_BROADCAST_NAME = 0x0B, + + /** Extended metadata */ + BT_AUDIO_METADATA_TYPE_EXTENDED = 0xFE, + + /** Vendor specific metadata */ + BT_AUDIO_METADATA_TYPE_VENDOR = 0xFF, +}; + +/** + * @brief Location values for BT Audio. + * + * These values are defined by the Generic Audio Assigned Numbers, bluetooth.com + */ +enum bt_audio_location { + /** Mono Audio (no specified Audio Location) */ + BT_AUDIO_LOCATION_MONO_AUDIO = 0, + /** Front Left */ + BT_AUDIO_LOCATION_FRONT_LEFT = BIT(0), + /** Front Right */ + BT_AUDIO_LOCATION_FRONT_RIGHT = BIT(1), + /** Front Center */ + BT_AUDIO_LOCATION_FRONT_CENTER = BIT(2), + /** Low Frequency Effects 1 */ + BT_AUDIO_LOCATION_LOW_FREQ_EFFECTS_1 = BIT(3), + /** Back Left */ + BT_AUDIO_LOCATION_BACK_LEFT = BIT(4), + /** Back Right */ + BT_AUDIO_LOCATION_BACK_RIGHT = BIT(5), + /** Front Left of Center */ + BT_AUDIO_LOCATION_FRONT_LEFT_OF_CENTER = BIT(6), + /** Front Right of Center */ + BT_AUDIO_LOCATION_FRONT_RIGHT_OF_CENTER = BIT(7), + /** Back Center */ + BT_AUDIO_LOCATION_BACK_CENTER = BIT(8), + /** Low Frequency Effects 2 */ + BT_AUDIO_LOCATION_LOW_FREQ_EFFECTS_2 = BIT(9), + /** Side Left */ + BT_AUDIO_LOCATION_SIDE_LEFT = BIT(10), + /** Side Right */ + BT_AUDIO_LOCATION_SIDE_RIGHT = BIT(11), + /** Top Front Left */ + BT_AUDIO_LOCATION_TOP_FRONT_LEFT = BIT(12), + /** Top Front Right */ + BT_AUDIO_LOCATION_TOP_FRONT_RIGHT = BIT(13), + /** Top Front Center */ + BT_AUDIO_LOCATION_TOP_FRONT_CENTER = BIT(14), + /** Top Center */ + BT_AUDIO_LOCATION_TOP_CENTER = BIT(15), + /** Top Back Left */ + BT_AUDIO_LOCATION_TOP_BACK_LEFT = BIT(16), + /** Top Back Right */ + BT_AUDIO_LOCATION_TOP_BACK_RIGHT = BIT(17), + /** Top Side Left */ + BT_AUDIO_LOCATION_TOP_SIDE_LEFT = BIT(18), + /** Top Side Right */ + BT_AUDIO_LOCATION_TOP_SIDE_RIGHT = BIT(19), + /** Top Back Center */ + BT_AUDIO_LOCATION_TOP_BACK_CENTER = BIT(20), + /** Bottom Front Center */ + BT_AUDIO_LOCATION_BOTTOM_FRONT_CENTER = BIT(21), + /** Bottom Front Left */ + BT_AUDIO_LOCATION_BOTTOM_FRONT_LEFT = BIT(22), + /** Bottom Front Right */ + BT_AUDIO_LOCATION_BOTTOM_FRONT_RIGHT = BIT(23), + /** Front Left Wide */ + BT_AUDIO_LOCATION_FRONT_LEFT_WIDE = BIT(24), + /** Front Right Wide */ + BT_AUDIO_LOCATION_FRONT_RIGHT_WIDE = BIT(25), + /** Left Surround */ + BT_AUDIO_LOCATION_LEFT_SURROUND = BIT(26), + /** Right Surround */ + BT_AUDIO_LOCATION_RIGHT_SURROUND = BIT(27), +}; + +/** + * Any known location. + */ +#define BT_AUDIO_LOCATION_ANY (BT_AUDIO_LOCATION_FRONT_LEFT | \ + BT_AUDIO_LOCATION_FRONT_RIGHT | \ + BT_AUDIO_LOCATION_FRONT_CENTER | \ + BT_AUDIO_LOCATION_LOW_FREQ_EFFECTS_1 | \ + BT_AUDIO_LOCATION_BACK_LEFT | \ + BT_AUDIO_LOCATION_BACK_RIGHT | \ + BT_AUDIO_LOCATION_FRONT_LEFT_OF_CENTER | \ + BT_AUDIO_LOCATION_FRONT_RIGHT_OF_CENTER | \ + BT_AUDIO_LOCATION_BACK_CENTER | \ + BT_AUDIO_LOCATION_LOW_FREQ_EFFECTS_2 | \ + BT_AUDIO_LOCATION_SIDE_LEFT | \ + BT_AUDIO_LOCATION_SIDE_RIGHT | \ + BT_AUDIO_LOCATION_TOP_FRONT_LEFT | \ + BT_AUDIO_LOCATION_TOP_FRONT_RIGHT | \ + BT_AUDIO_LOCATION_TOP_FRONT_CENTER | \ + BT_AUDIO_LOCATION_TOP_CENTER | \ + BT_AUDIO_LOCATION_TOP_BACK_LEFT | \ + BT_AUDIO_LOCATION_TOP_BACK_RIGHT | \ + BT_AUDIO_LOCATION_TOP_SIDE_LEFT | \ + BT_AUDIO_LOCATION_TOP_SIDE_RIGHT | \ + BT_AUDIO_LOCATION_TOP_BACK_CENTER | \ + BT_AUDIO_LOCATION_BOTTOM_FRONT_CENTER | \ + BT_AUDIO_LOCATION_BOTTOM_FRONT_LEFT | \ + BT_AUDIO_LOCATION_BOTTOM_FRONT_RIGHT | \ + BT_AUDIO_LOCATION_FRONT_LEFT_WIDE | \ + BT_AUDIO_LOCATION_FRONT_RIGHT_WIDE | \ + BT_AUDIO_LOCATION_LEFT_SURROUND | \ + BT_AUDIO_LOCATION_RIGHT_SURROUND) + +/** @} */ /* end of bt_assigned_numbers_audio */ + /** * @name Company Identifiers (see Bluetooth Assigned Numbers) * @{ diff --git a/include/zephyr/bluetooth/audio/audio.h b/include/zephyr/bluetooth/audio/audio.h index 230f2735e4d5..87eac9d4a203 100644 --- a/include/zephyr/bluetooth/audio/audio.h +++ b/include/zephyr/bluetooth/audio/audio.h @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -49,157 +50,10 @@ extern "C" { #define BT_AUDIO_PD_MAX 0xFFFFFFU /** Indicates that the unicast server does not have a preference for any retransmission number */ #define BT_AUDIO_RTN_PREF_NONE 0xFFU -/** The minimum size of a Broadcast Name as defined by Bluetooth Assigned Numbers */ -#define BT_AUDIO_BROADCAST_NAME_LEN_MIN 4 -/** The maximum size of a Broadcast Name as defined by Bluetooth Assigned Numbers */ -#define BT_AUDIO_BROADCAST_NAME_LEN_MAX 128 /** Size of the stream language value, e.g. "eng" */ #define BT_AUDIO_LANG_SIZE 3 -/** - * @brief Codec capability types - * - * Used to build and parse codec capabilities as specified in the PAC specification. - * Source is assigned numbers for Generic Audio, bluetooth.com. - */ -enum bt_audio_codec_cap_type { - /** Supported sampling frequencies */ - BT_AUDIO_CODEC_CAP_TYPE_FREQ = 0x01, - - /** Supported frame durations */ - BT_AUDIO_CODEC_CAP_TYPE_DURATION = 0x02, - - /** Supported audio channel counts */ - BT_AUDIO_CODEC_CAP_TYPE_CHAN_COUNT = 0x03, - - /** Supported octets per codec frame */ - BT_AUDIO_CODEC_CAP_TYPE_FRAME_LEN = 0x04, - - /** Supported maximum codec frames per SDU */ - BT_AUDIO_CODEC_CAP_TYPE_FRAME_COUNT = 0x05, -}; - -/** @brief Supported frequencies bitfield */ -enum bt_audio_codec_cap_freq { - /** 8 Khz sampling frequency */ - BT_AUDIO_CODEC_CAP_FREQ_8KHZ = BIT(0), - - /** 11.025 Khz sampling frequency */ - BT_AUDIO_CODEC_CAP_FREQ_11KHZ = BIT(1), - - /** 16 Khz sampling frequency */ - BT_AUDIO_CODEC_CAP_FREQ_16KHZ = BIT(2), - - /** 22.05 Khz sampling frequency */ - BT_AUDIO_CODEC_CAP_FREQ_22KHZ = BIT(3), - - /** 24 Khz sampling frequency */ - BT_AUDIO_CODEC_CAP_FREQ_24KHZ = BIT(4), - - /** 32 Khz sampling frequency */ - BT_AUDIO_CODEC_CAP_FREQ_32KHZ = BIT(5), - - /** 44.1 Khz sampling frequency */ - BT_AUDIO_CODEC_CAP_FREQ_44KHZ = BIT(6), - - /** 48 Khz sampling frequency */ - BT_AUDIO_CODEC_CAP_FREQ_48KHZ = BIT(7), - - /** 88.2 Khz sampling frequency */ - BT_AUDIO_CODEC_CAP_FREQ_88KHZ = BIT(8), - - /** 96 Khz sampling frequency */ - BT_AUDIO_CODEC_CAP_FREQ_96KHZ = BIT(9), - - /** 176.4 Khz sampling frequency */ - BT_AUDIO_CODEC_CAP_FREQ_176KHZ = BIT(10), - - /** 192 Khz sampling frequency */ - BT_AUDIO_CODEC_CAP_FREQ_192KHZ = BIT(11), - - /** 384 Khz sampling frequency */ - BT_AUDIO_CODEC_CAP_FREQ_384KHZ = BIT(12), - - /** Any frequency capability */ - BT_AUDIO_CODEC_CAP_FREQ_ANY = - (BT_AUDIO_CODEC_CAP_FREQ_8KHZ | BT_AUDIO_CODEC_CAP_FREQ_11KHZ | - BT_AUDIO_CODEC_CAP_FREQ_16KHZ | BT_AUDIO_CODEC_CAP_FREQ_22KHZ | - BT_AUDIO_CODEC_CAP_FREQ_24KHZ | BT_AUDIO_CODEC_CAP_FREQ_32KHZ | - BT_AUDIO_CODEC_CAP_FREQ_44KHZ | BT_AUDIO_CODEC_CAP_FREQ_48KHZ | - BT_AUDIO_CODEC_CAP_FREQ_88KHZ | BT_AUDIO_CODEC_CAP_FREQ_96KHZ | - BT_AUDIO_CODEC_CAP_FREQ_176KHZ | BT_AUDIO_CODEC_CAP_FREQ_192KHZ | - BT_AUDIO_CODEC_CAP_FREQ_384KHZ), -}; - -/** @brief Supported frame durations bitfield */ -enum bt_audio_codec_cap_frame_dur { - /** 7.5 msec frame duration capability */ - BT_AUDIO_CODEC_CAP_DURATION_7_5 = BIT(0), - - /** 10 msec frame duration capability */ - BT_AUDIO_CODEC_CAP_DURATION_10 = BIT(1), - - /** Any frame duration capability */ - BT_AUDIO_CODEC_CAP_DURATION_ANY = - (BT_AUDIO_CODEC_CAP_DURATION_7_5 | BT_AUDIO_CODEC_CAP_DURATION_10), - - /** - * @brief 7.5 msec preferred frame duration capability. - * - * This shall only be set if @ref BT_AUDIO_CODEC_CAP_DURATION_7_5 is also set, and if @ref - * BT_AUDIO_CODEC_CAP_DURATION_PREFER_10 is not set. - */ - BT_AUDIO_CODEC_CAP_DURATION_PREFER_7_5 = BIT(4), - - /** - * @brief 10 msec preferred frame duration capability - * - * This shall only be set if @ref BT_AUDIO_CODEC_CAP_DURATION_10 is also set, and if @ref - * BT_AUDIO_CODEC_CAP_DURATION_PREFER_7_5 is not set. - */ - BT_AUDIO_CODEC_CAP_DURATION_PREFER_10 = BIT(5), -}; - -/** Supported audio capabilities channel count bitfield */ -enum bt_audio_codec_cap_chan_count { - /** Supporting 1 channel */ - BT_AUDIO_CODEC_CAP_CHAN_COUNT_1 = BIT(0), - - /** Supporting 2 channel */ - BT_AUDIO_CODEC_CAP_CHAN_COUNT_2 = BIT(1), - - /** Supporting 3 channel */ - BT_AUDIO_CODEC_CAP_CHAN_COUNT_3 = BIT(2), - - /** Supporting 4 channel */ - BT_AUDIO_CODEC_CAP_CHAN_COUNT_4 = BIT(3), - - /** Supporting 5 channel */ - BT_AUDIO_CODEC_CAP_CHAN_COUNT_5 = BIT(4), - - /** Supporting 6 channel */ - BT_AUDIO_CODEC_CAP_CHAN_COUNT_6 = BIT(5), - - /** Supporting 7 channel */ - BT_AUDIO_CODEC_CAP_CHAN_COUNT_7 = BIT(6), - - /** Supporting 8 channel */ - BT_AUDIO_CODEC_CAP_CHAN_COUNT_8 = BIT(7), - - /** Supporting all channels */ - BT_AUDIO_CODEC_CAP_CHAN_COUNT_ANY = - (BT_AUDIO_CODEC_CAP_CHAN_COUNT_1 | BT_AUDIO_CODEC_CAP_CHAN_COUNT_2 | - BT_AUDIO_CODEC_CAP_CHAN_COUNT_3 | BT_AUDIO_CODEC_CAP_CHAN_COUNT_4 | - BT_AUDIO_CODEC_CAP_CHAN_COUNT_5 | BT_AUDIO_CODEC_CAP_CHAN_COUNT_6 | - BT_AUDIO_CODEC_CAP_CHAN_COUNT_7 | BT_AUDIO_CODEC_CAP_CHAN_COUNT_8), -}; - -/** Minimum supported channel counts */ -#define BT_AUDIO_CODEC_CAP_CHAN_COUNT_MIN 1 -/** Maximum supported channel counts */ -#define BT_AUDIO_CODEC_CAP_CHAN_COUNT_MAX 8 - /** * @brief Channel count support capability * @@ -221,290 +75,6 @@ struct bt_audio_codec_octets_per_codec_frame { uint16_t max; }; -/** - * @brief Codec configuration types - * - * Used to build and parse codec configurations as specified in the ASCS and BAP specifications. - * Source is assigned numbers for Generic Audio, bluetooth.com. - */ -enum bt_audio_codec_cfg_type { - /** Sampling frequency */ - BT_AUDIO_CODEC_CFG_FREQ = 0x01, - - /** Frame duration */ - BT_AUDIO_CODEC_CFG_DURATION = 0x02, - - /** Audio channel allocation */ - BT_AUDIO_CODEC_CFG_CHAN_ALLOC = 0x03, - - /** Octets per codec frame */ - BT_AUDIO_CODEC_CFG_FRAME_LEN = 0x04, - - /** Codec frame blocks per SDU */ - BT_AUDIO_CODEC_CFG_FRAME_BLKS_PER_SDU = 0x05, -}; - -/** Codec configuration sampling freqency */ -enum bt_audio_codec_cfg_freq { - /** 8 Khz codec sampling frequency */ - BT_AUDIO_CODEC_CFG_FREQ_8KHZ = 0x01, - - /** 11.025 Khz codec sampling frequency */ - BT_AUDIO_CODEC_CFG_FREQ_11KHZ = 0x02, - - /** 16 Khz codec sampling frequency */ - BT_AUDIO_CODEC_CFG_FREQ_16KHZ = 0x03, - - /** 22.05 Khz codec sampling frequency */ - BT_AUDIO_CODEC_CFG_FREQ_22KHZ = 0x04, - - /** 24 Khz codec sampling frequency */ - BT_AUDIO_CODEC_CFG_FREQ_24KHZ = 0x05, - - /** 32 Khz codec sampling frequency */ - BT_AUDIO_CODEC_CFG_FREQ_32KHZ = 0x06, - - /** 44.1 Khz codec sampling frequency */ - BT_AUDIO_CODEC_CFG_FREQ_44KHZ = 0x07, - - /** 48 Khz codec sampling frequency */ - BT_AUDIO_CODEC_CFG_FREQ_48KHZ = 0x08, - - /** 88.2 Khz codec sampling frequency */ - BT_AUDIO_CODEC_CFG_FREQ_88KHZ = 0x09, - - /** 96 Khz codec sampling frequency */ - BT_AUDIO_CODEC_CFG_FREQ_96KHZ = 0x0a, - - /** 176.4 Khz codec sampling frequency */ - BT_AUDIO_CODEC_CFG_FREQ_176KHZ = 0x0b, - - /** 192 Khz codec sampling frequency */ - BT_AUDIO_CODEC_CFG_FREQ_192KHZ = 0x0c, - - /** 384 Khz codec sampling frequency */ - BT_AUDIO_CODEC_CFG_FREQ_384KHZ = 0x0d, -}; - -/** Codec configuration frame duration */ -enum bt_audio_codec_cfg_frame_dur { - /** 7.5 msec Frame Duration configuration */ - BT_AUDIO_CODEC_CFG_DURATION_7_5 = 0x00, - - /** 10 msec Frame Duration configuration */ - BT_AUDIO_CODEC_CFG_DURATION_10 = 0x01, -}; - -/** - * @brief Audio Context Type for Generic Audio - * - * These values are defined by the Generic Audio Assigned Numbers, bluetooth.com - */ -enum bt_audio_context { - /** No context type */ - BT_AUDIO_CONTEXT_TYPE_NONE = 0, - /** - * Identifies audio where the use case context does not match any other defined value, - * or where the context is unknown or cannot be determined. - */ - BT_AUDIO_CONTEXT_TYPE_UNSPECIFIED = BIT(0), - /** - * Conversation between humans, for example, in telephony or video calls, including - * traditional cellular as well as VoIP and Push-to-Talk - */ - BT_AUDIO_CONTEXT_TYPE_CONVERSATIONAL = BIT(1), - /** Media, for example, music playback, radio, podcast or movie soundtrack, or tv audio */ - BT_AUDIO_CONTEXT_TYPE_MEDIA = BIT(2), - /** - * Audio associated with video gaming, for example gaming media; gaming effects; music - * and in-game voice chat between participants; or a mix of all the above - */ - BT_AUDIO_CONTEXT_TYPE_GAME = BIT(3), - /** Instructional audio, for example, in navigation, announcements, or user guidance */ - BT_AUDIO_CONTEXT_TYPE_INSTRUCTIONAL = BIT(4), - /** Man-machine communication, for example, with voice recognition or virtual assistants */ - BT_AUDIO_CONTEXT_TYPE_VOICE_ASSISTANTS = BIT(5), - /** - * Live audio, for example, from a microphone where audio is perceived both through a - * direct acoustic path and through an LE Audio Stream - */ - BT_AUDIO_CONTEXT_TYPE_LIVE = BIT(6), - /** - * Sound effects including keyboard and touch feedback; menu and user interface sounds; - * and other system sounds - */ - BT_AUDIO_CONTEXT_TYPE_SOUND_EFFECTS = BIT(7), - /** - * Notification and reminder sounds; attention-seeking audio, for example, - * in beeps signaling the arrival of a message - */ - BT_AUDIO_CONTEXT_TYPE_NOTIFICATIONS = BIT(8), - /** - * Alerts the user to an incoming call, for example, an incoming telephony or video call, - * including traditional cellular as well as VoIP and Push-to-Talk - */ - BT_AUDIO_CONTEXT_TYPE_RINGTONE = BIT(9), - /** - * Alarms and timers; immediate alerts, for example, in a critical battery alarm, - * timer expiry or alarm clock, toaster, cooker, kettle, microwave, etc. - */ - BT_AUDIO_CONTEXT_TYPE_ALERTS = BIT(10), - /** Emergency alarm Emergency sounds, for example, fire alarms or other urgent alerts */ - BT_AUDIO_CONTEXT_TYPE_EMERGENCY_ALARM = BIT(11), -}; - -/** - * Any known context. - */ -#define BT_AUDIO_CONTEXT_TYPE_ANY (BT_AUDIO_CONTEXT_TYPE_UNSPECIFIED | \ - BT_AUDIO_CONTEXT_TYPE_CONVERSATIONAL | \ - BT_AUDIO_CONTEXT_TYPE_MEDIA | \ - BT_AUDIO_CONTEXT_TYPE_GAME | \ - BT_AUDIO_CONTEXT_TYPE_INSTRUCTIONAL | \ - BT_AUDIO_CONTEXT_TYPE_VOICE_ASSISTANTS | \ - BT_AUDIO_CONTEXT_TYPE_LIVE | \ - BT_AUDIO_CONTEXT_TYPE_SOUND_EFFECTS | \ - BT_AUDIO_CONTEXT_TYPE_NOTIFICATIONS | \ - BT_AUDIO_CONTEXT_TYPE_RINGTONE | \ - BT_AUDIO_CONTEXT_TYPE_ALERTS | \ - BT_AUDIO_CONTEXT_TYPE_EMERGENCY_ALARM) - -/** - * @brief Parental rating defined by the Generic Audio assigned numbers (bluetooth.com). - * - * The numbering scheme is aligned with Annex F of EN 300 707 v1.2.1 which - * defined parental rating for viewing. - */ -enum bt_audio_parental_rating { - /** No rating */ - BT_AUDIO_PARENTAL_RATING_NO_RATING = 0x00, - /** For all ages */ - BT_AUDIO_PARENTAL_RATING_AGE_ANY = 0x01, - /** Recommended for listeners of age 5 and above */ - BT_AUDIO_PARENTAL_RATING_AGE_5_OR_ABOVE = 0x02, - /** Recommended for listeners of age 6 and above */ - BT_AUDIO_PARENTAL_RATING_AGE_6_OR_ABOVE = 0x03, - /** Recommended for listeners of age 7 and above */ - BT_AUDIO_PARENTAL_RATING_AGE_7_OR_ABOVE = 0x04, - /** Recommended for listeners of age 8 and above */ - BT_AUDIO_PARENTAL_RATING_AGE_8_OR_ABOVE = 0x05, - /** Recommended for listeners of age 9 and above */ - BT_AUDIO_PARENTAL_RATING_AGE_9_OR_ABOVE = 0x06, - /** Recommended for listeners of age 10 and above */ - BT_AUDIO_PARENTAL_RATING_AGE_10_OR_ABOVE = 0x07, - /** Recommended for listeners of age 11 and above */ - BT_AUDIO_PARENTAL_RATING_AGE_11_OR_ABOVE = 0x08, - /** Recommended for listeners of age 12 and above */ - BT_AUDIO_PARENTAL_RATING_AGE_12_OR_ABOVE = 0x09, - /** Recommended for listeners of age 13 and above */ - BT_AUDIO_PARENTAL_RATING_AGE_13_OR_ABOVE = 0x0A, - /** Recommended for listeners of age 14 and above */ - BT_AUDIO_PARENTAL_RATING_AGE_14_OR_ABOVE = 0x0B, - /** Recommended for listeners of age 15 and above */ - BT_AUDIO_PARENTAL_RATING_AGE_15_OR_ABOVE = 0x0C, - /** Recommended for listeners of age 16 and above */ - BT_AUDIO_PARENTAL_RATING_AGE_16_OR_ABOVE = 0x0D, - /** Recommended for listeners of age 17 and above */ - BT_AUDIO_PARENTAL_RATING_AGE_17_OR_ABOVE = 0x0E, - /** Recommended for listeners of age 18 and above */ - BT_AUDIO_PARENTAL_RATING_AGE_18_OR_ABOVE = 0x0F -}; - -/** @brief Audio Active State defined by the Generic Audio assigned numbers (bluetooth.com). */ -enum bt_audio_active_state { - /** No audio data is being transmitted */ - BT_AUDIO_ACTIVE_STATE_DISABLED = 0x00, - /** Audio data is being transmitted */ - BT_AUDIO_ACTIVE_STATE_ENABLED = 0x01, -}; - -/** Assisted Listening Stream defined by the Generic Audio assigned numbers (bluetooth.com). */ -enum bt_audio_assisted_listening_stream { - /** Unspecified audio enhancement */ - BT_AUDIO_ASSISTED_LISTENING_STREAM_UNSPECIFIED = 0x00, -}; - -/** - * @brief Codec metadata type IDs - * - * Metadata types defined by the Generic Audio assigned numbers (bluetooth.com). - */ -enum bt_audio_metadata_type { - /** - * @brief Preferred audio context. - * - * Bitfield of preferred audio contexts. - * - * If 0, the context type is not a preferred use case for this codec - * configuration. - * - * See the BT_AUDIO_CONTEXT_* for valid values. - */ - BT_AUDIO_METADATA_TYPE_PREF_CONTEXT = 0x01, - - /** - * @brief Streaming audio context. - * - * Bitfield of streaming audio contexts. - * - * If 0, the context type is not a preferred use case for this codec - * configuration. - * - * See the BT_AUDIO_CONTEXT_* for valid values. - */ - BT_AUDIO_METADATA_TYPE_STREAM_CONTEXT = 0x02, - - /** UTF-8 encoded title or summary of stream content */ - BT_AUDIO_METADATA_TYPE_PROGRAM_INFO = 0x03, - - /** - * @brief Language - * - * 3 octet lower case language code defined by ISO 639-3 - * Possible values can be found at https://iso639-3.sil.org/code_tables/639/data - */ - BT_AUDIO_METADATA_TYPE_LANG = 0x04, - - /** Array of 8-bit CCID values */ - BT_AUDIO_METADATA_TYPE_CCID_LIST = 0x05, - - /** - * @brief Parental rating - * - * See @ref bt_audio_parental_rating for valid values. - */ - BT_AUDIO_METADATA_TYPE_PARENTAL_RATING = 0x06, - - /** UTF-8 encoded URI for additional Program information */ - BT_AUDIO_METADATA_TYPE_PROGRAM_INFO_URI = 0x07, - - /** - * @brief Audio active state - * - * See @ref bt_audio_active_state for valid values. - */ - BT_AUDIO_METADATA_TYPE_AUDIO_STATE = 0x08, - - /** Broadcast Audio Immediate Rendering flag */ - BT_AUDIO_METADATA_TYPE_BROADCAST_IMMEDIATE = 0x09, - - /** - * @brief Assisted listening stream - * - * See @ref bt_audio_assisted_listening_stream for valid values. - */ - BT_AUDIO_METADATA_TYPE_ASSISTED_LISTENING_STREAM = 0x0A, - - /** UTF-8 encoded Broadcast name */ - BT_AUDIO_METADATA_TYPE_BROADCAST_NAME = 0x0B, - - /** Extended metadata */ - BT_AUDIO_METADATA_TYPE_EXTENDED = 0xFE, - - /** Vendor specific metadata */ - BT_AUDIO_METADATA_TYPE_VENDOR = 0xFF, -}; - /** * @brief Helper to check whether metadata type is known by the stack. * @@ -586,104 +156,6 @@ enum bt_audio_metadata_type { .meta = _meta, \ }) -/** - * @brief Location values for BT Audio. - * - * These values are defined by the Generic Audio Assigned Numbers, bluetooth.com - */ -enum bt_audio_location { - /** Mono Audio (no specified Audio Location) */ - BT_AUDIO_LOCATION_MONO_AUDIO = 0, - /** Front Left */ - BT_AUDIO_LOCATION_FRONT_LEFT = BIT(0), - /** Front Right */ - BT_AUDIO_LOCATION_FRONT_RIGHT = BIT(1), - /** Front Center */ - BT_AUDIO_LOCATION_FRONT_CENTER = BIT(2), - /** Low Frequency Effects 1 */ - BT_AUDIO_LOCATION_LOW_FREQ_EFFECTS_1 = BIT(3), - /** Back Left */ - BT_AUDIO_LOCATION_BACK_LEFT = BIT(4), - /** Back Right */ - BT_AUDIO_LOCATION_BACK_RIGHT = BIT(5), - /** Front Left of Center */ - BT_AUDIO_LOCATION_FRONT_LEFT_OF_CENTER = BIT(6), - /** Front Right of Center */ - BT_AUDIO_LOCATION_FRONT_RIGHT_OF_CENTER = BIT(7), - /** Back Center */ - BT_AUDIO_LOCATION_BACK_CENTER = BIT(8), - /** Low Frequency Effects 2 */ - BT_AUDIO_LOCATION_LOW_FREQ_EFFECTS_2 = BIT(9), - /** Side Left */ - BT_AUDIO_LOCATION_SIDE_LEFT = BIT(10), - /** Side Right */ - BT_AUDIO_LOCATION_SIDE_RIGHT = BIT(11), - /** Top Front Left */ - BT_AUDIO_LOCATION_TOP_FRONT_LEFT = BIT(12), - /** Top Front Right */ - BT_AUDIO_LOCATION_TOP_FRONT_RIGHT = BIT(13), - /** Top Front Center */ - BT_AUDIO_LOCATION_TOP_FRONT_CENTER = BIT(14), - /** Top Center */ - BT_AUDIO_LOCATION_TOP_CENTER = BIT(15), - /** Top Back Left */ - BT_AUDIO_LOCATION_TOP_BACK_LEFT = BIT(16), - /** Top Back Right */ - BT_AUDIO_LOCATION_TOP_BACK_RIGHT = BIT(17), - /** Top Side Left */ - BT_AUDIO_LOCATION_TOP_SIDE_LEFT = BIT(18), - /** Top Side Right */ - BT_AUDIO_LOCATION_TOP_SIDE_RIGHT = BIT(19), - /** Top Back Center */ - BT_AUDIO_LOCATION_TOP_BACK_CENTER = BIT(20), - /** Bottom Front Center */ - BT_AUDIO_LOCATION_BOTTOM_FRONT_CENTER = BIT(21), - /** Bottom Front Left */ - BT_AUDIO_LOCATION_BOTTOM_FRONT_LEFT = BIT(22), - /** Bottom Front Right */ - BT_AUDIO_LOCATION_BOTTOM_FRONT_RIGHT = BIT(23), - /** Front Left Wide */ - BT_AUDIO_LOCATION_FRONT_LEFT_WIDE = BIT(24), - /** Front Right Wide */ - BT_AUDIO_LOCATION_FRONT_RIGHT_WIDE = BIT(25), - /** Left Surround */ - BT_AUDIO_LOCATION_LEFT_SURROUND = BIT(26), - /** Right Surround */ - BT_AUDIO_LOCATION_RIGHT_SURROUND = BIT(27), -}; - -/** - * Any known location. - */ -#define BT_AUDIO_LOCATION_ANY (BT_AUDIO_LOCATION_FRONT_LEFT | \ - BT_AUDIO_LOCATION_FRONT_RIGHT | \ - BT_AUDIO_LOCATION_FRONT_CENTER | \ - BT_AUDIO_LOCATION_LOW_FREQ_EFFECTS_1 | \ - BT_AUDIO_LOCATION_BACK_LEFT | \ - BT_AUDIO_LOCATION_BACK_RIGHT | \ - BT_AUDIO_LOCATION_FRONT_LEFT_OF_CENTER | \ - BT_AUDIO_LOCATION_FRONT_RIGHT_OF_CENTER | \ - BT_AUDIO_LOCATION_BACK_CENTER | \ - BT_AUDIO_LOCATION_LOW_FREQ_EFFECTS_2 | \ - BT_AUDIO_LOCATION_SIDE_LEFT | \ - BT_AUDIO_LOCATION_SIDE_RIGHT | \ - BT_AUDIO_LOCATION_TOP_FRONT_LEFT | \ - BT_AUDIO_LOCATION_TOP_FRONT_RIGHT | \ - BT_AUDIO_LOCATION_TOP_FRONT_CENTER | \ - BT_AUDIO_LOCATION_TOP_CENTER | \ - BT_AUDIO_LOCATION_TOP_BACK_LEFT | \ - BT_AUDIO_LOCATION_TOP_BACK_RIGHT | \ - BT_AUDIO_LOCATION_TOP_SIDE_LEFT | \ - BT_AUDIO_LOCATION_TOP_SIDE_RIGHT | \ - BT_AUDIO_LOCATION_TOP_BACK_CENTER | \ - BT_AUDIO_LOCATION_BOTTOM_FRONT_CENTER | \ - BT_AUDIO_LOCATION_BOTTOM_FRONT_LEFT | \ - BT_AUDIO_LOCATION_BOTTOM_FRONT_RIGHT | \ - BT_AUDIO_LOCATION_FRONT_LEFT_WIDE | \ - BT_AUDIO_LOCATION_FRONT_RIGHT_WIDE | \ - BT_AUDIO_LOCATION_LEFT_SURROUND | \ - BT_AUDIO_LOCATION_RIGHT_SURROUND) - /** @brief Codec capability structure. */ struct bt_audio_codec_cap { /** Data path ID From 34d823974bd887675a43c9d49a2215e1052e15f9 Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Thu, 28 Aug 2025 11:42:39 +0200 Subject: [PATCH 2093/2141] [nrf fromtree] bluetooth: mesh: move mesh assigned numbers to dedicated header Move assigned number for mesh from mesh.h to assigned_numbers.h where all assigned numbers are located. Signed-off-by: Pavel Vasilyev (cherry picked from commit e88695add2acaaab24a8f518071846dadd5dba67) Signed-off-by: Pavel Vasilyev --- include/zephyr/bluetooth/assigned_numbers.h | 197 ++++++++++++++++++++ include/zephyr/bluetooth/mesh/access.h | 189 +------------------ 2 files changed, 198 insertions(+), 188 deletions(-) diff --git a/include/zephyr/bluetooth/assigned_numbers.h b/include/zephyr/bluetooth/assigned_numbers.h index 8cd5fc422c2d..44c69d16a227 100644 --- a/include/zephyr/bluetooth/assigned_numbers.h +++ b/include/zephyr/bluetooth/assigned_numbers.h @@ -717,6 +717,203 @@ extern "C" { /** @} */ /* end of @name Flags data type values */ /** @} */ /* end of bt_assigned_numbers_core */ +/** + * @brief Bluetooth Mesh Assigned Numbers + * @defgroup bt_assigned_numbers_mesh Bluetooth Mesh Assigned Numbers + * @ingroup bt_assigned_numbers + * @{ + */ + +/** + * @name Foundation Models + * @{ + */ +/** Configuration Server */ +#define BT_MESH_MODEL_ID_CFG_SRV 0x0000 +/** Configuration Client */ +#define BT_MESH_MODEL_ID_CFG_CLI 0x0001 +/** Health Server */ +#define BT_MESH_MODEL_ID_HEALTH_SRV 0x0002 +/** Health Client */ +#define BT_MESH_MODEL_ID_HEALTH_CLI 0x0003 +/** Remote Provisioning Server */ +#define BT_MESH_MODEL_ID_REMOTE_PROV_SRV 0x0004 +/** Remote Provisioning Client */ +#define BT_MESH_MODEL_ID_REMOTE_PROV_CLI 0x0005 +/** Bridge Configuration Sever */ +#define BT_MESH_MODEL_ID_BRG_CFG_SRV 0x0008 +/** Bridge Configuration Client */ +#define BT_MESH_MODEL_ID_BRG_CFG_CLI 0x0009 +/** Private Beacon Server */ +#define BT_MESH_MODEL_ID_PRIV_BEACON_SRV 0x000a +/** Private Beacon Client */ +#define BT_MESH_MODEL_ID_PRIV_BEACON_CLI 0x000b +/** SAR Configuration Server */ +#define BT_MESH_MODEL_ID_SAR_CFG_SRV 0x000e +/** SAR Configuration Client */ +#define BT_MESH_MODEL_ID_SAR_CFG_CLI 0x000f +/** Opcodes Aggregator Server */ +#define BT_MESH_MODEL_ID_OP_AGG_SRV 0x0010 +/** Opcodes Aggregator Client */ +#define BT_MESH_MODEL_ID_OP_AGG_CLI 0x0011 +/** Large Composition Data Server */ +#define BT_MESH_MODEL_ID_LARGE_COMP_DATA_SRV 0x0012 +/** Large Composition Data Client */ +#define BT_MESH_MODEL_ID_LARGE_COMP_DATA_CLI 0x0013 +/** Solicitation PDU RPL Configuration Client */ +#define BT_MESH_MODEL_ID_SOL_PDU_RPL_SRV 0x0014 +/** Solicitation PDU RPL Configuration Server */ +#define BT_MESH_MODEL_ID_SOL_PDU_RPL_CLI 0x0015 +/** Private Proxy Server */ +#define BT_MESH_MODEL_ID_ON_DEMAND_PROXY_SRV 0x000c +/** Private Proxy Client */ +#define BT_MESH_MODEL_ID_ON_DEMAND_PROXY_CLI 0x000d +/** + * @} + */ + +/** + * @name Models from the Mesh Model Specification + * @{ + */ +/** Generic OnOff Server */ +#define BT_MESH_MODEL_ID_GEN_ONOFF_SRV 0x1000 +/** Generic OnOff Client */ +#define BT_MESH_MODEL_ID_GEN_ONOFF_CLI 0x1001 +/** Generic Level Server */ +#define BT_MESH_MODEL_ID_GEN_LEVEL_SRV 0x1002 +/** Generic Level Client */ +#define BT_MESH_MODEL_ID_GEN_LEVEL_CLI 0x1003 +/** Generic Default Transition Time Server */ +#define BT_MESH_MODEL_ID_GEN_DEF_TRANS_TIME_SRV 0x1004 +/** Generic Default Transition Time Client */ +#define BT_MESH_MODEL_ID_GEN_DEF_TRANS_TIME_CLI 0x1005 +/** Generic Power OnOff Server */ +#define BT_MESH_MODEL_ID_GEN_POWER_ONOFF_SRV 0x1006 +/** Generic Power OnOff Setup Server */ +#define BT_MESH_MODEL_ID_GEN_POWER_ONOFF_SETUP_SRV 0x1007 +/** Generic Power OnOff Client */ +#define BT_MESH_MODEL_ID_GEN_POWER_ONOFF_CLI 0x1008 +/** Generic Power Level Server */ +#define BT_MESH_MODEL_ID_GEN_POWER_LEVEL_SRV 0x1009 +/** Generic Power Level Setup Server */ +#define BT_MESH_MODEL_ID_GEN_POWER_LEVEL_SETUP_SRV 0x100a +/** Generic Power Level Client */ +#define BT_MESH_MODEL_ID_GEN_POWER_LEVEL_CLI 0x100b +/** Generic Battery Server */ +#define BT_MESH_MODEL_ID_GEN_BATTERY_SRV 0x100c +/** Generic Battery Client */ +#define BT_MESH_MODEL_ID_GEN_BATTERY_CLI 0x100d +/** Generic Location Server */ +#define BT_MESH_MODEL_ID_GEN_LOCATION_SRV 0x100e +/** Generic Location Setup Server */ +#define BT_MESH_MODEL_ID_GEN_LOCATION_SETUPSRV 0x100f +/** Generic Location Client */ +#define BT_MESH_MODEL_ID_GEN_LOCATION_CLI 0x1010 +/** Generic Admin Property Server */ +#define BT_MESH_MODEL_ID_GEN_ADMIN_PROP_SRV 0x1011 +/** Generic Manufacturer Property Server */ +#define BT_MESH_MODEL_ID_GEN_MANUFACTURER_PROP_SRV 0x1012 +/** Generic User Property Server */ +#define BT_MESH_MODEL_ID_GEN_USER_PROP_SRV 0x1013 +/** Generic Client Property Server */ +#define BT_MESH_MODEL_ID_GEN_CLIENT_PROP_SRV 0x1014 +/** Generic Property Client */ +#define BT_MESH_MODEL_ID_GEN_PROP_CLI 0x1015 +/** Sensor Server */ +#define BT_MESH_MODEL_ID_SENSOR_SRV 0x1100 +/** Sensor Setup Server */ +#define BT_MESH_MODEL_ID_SENSOR_SETUP_SRV 0x1101 +/** Sensor Client */ +#define BT_MESH_MODEL_ID_SENSOR_CLI 0x1102 +/** Time Server */ +#define BT_MESH_MODEL_ID_TIME_SRV 0x1200 +/** Time Setup Server */ +#define BT_MESH_MODEL_ID_TIME_SETUP_SRV 0x1201 +/** Time Client */ +#define BT_MESH_MODEL_ID_TIME_CLI 0x1202 +/** Scene Server */ +#define BT_MESH_MODEL_ID_SCENE_SRV 0x1203 +/** Scene Setup Server */ +#define BT_MESH_MODEL_ID_SCENE_SETUP_SRV 0x1204 +/** Scene Client */ +#define BT_MESH_MODEL_ID_SCENE_CLI 0x1205 +/** Scheduler Server */ +#define BT_MESH_MODEL_ID_SCHEDULER_SRV 0x1206 +/** Scheduler Setup Server */ +#define BT_MESH_MODEL_ID_SCHEDULER_SETUP_SRV 0x1207 +/** Scheduler Client */ +#define BT_MESH_MODEL_ID_SCHEDULER_CLI 0x1208 +/** Light Lightness Server */ +#define BT_MESH_MODEL_ID_LIGHT_LIGHTNESS_SRV 0x1300 +/** Light Lightness Setup Server */ +#define BT_MESH_MODEL_ID_LIGHT_LIGHTNESS_SETUP_SRV 0x1301 +/** Light Lightness Client */ +#define BT_MESH_MODEL_ID_LIGHT_LIGHTNESS_CLI 0x1302 +/** Light CTL Server */ +#define BT_MESH_MODEL_ID_LIGHT_CTL_SRV 0x1303 +/** Light CTL Setup Server */ +#define BT_MESH_MODEL_ID_LIGHT_CTL_SETUP_SRV 0x1304 +/** Light CTL Client */ +#define BT_MESH_MODEL_ID_LIGHT_CTL_CLI 0x1305 +/** Light CTL Temperature Server */ +#define BT_MESH_MODEL_ID_LIGHT_CTL_TEMP_SRV 0x1306 +/** Light HSL Server */ +#define BT_MESH_MODEL_ID_LIGHT_HSL_SRV 0x1307 +/** Light HSL Setup Server */ +#define BT_MESH_MODEL_ID_LIGHT_HSL_SETUP_SRV 0x1308 +/** Light HSL Client */ +#define BT_MESH_MODEL_ID_LIGHT_HSL_CLI 0x1309 +/** Light HSL Hue Server */ +#define BT_MESH_MODEL_ID_LIGHT_HSL_HUE_SRV 0x130a +/** Light HSL Saturation Server */ +#define BT_MESH_MODEL_ID_LIGHT_HSL_SAT_SRV 0x130b +/** Light xyL Server */ +#define BT_MESH_MODEL_ID_LIGHT_XYL_SRV 0x130c +/** Light xyL Setup Server */ +#define BT_MESH_MODEL_ID_LIGHT_XYL_SETUP_SRV 0x130d +/** Light xyL Client */ +#define BT_MESH_MODEL_ID_LIGHT_XYL_CLI 0x130e +/** Light LC Server */ +#define BT_MESH_MODEL_ID_LIGHT_LC_SRV 0x130f +/** Light LC Setup Server */ +#define BT_MESH_MODEL_ID_LIGHT_LC_SETUPSRV 0x1310 +/** Light LC Client */ +#define BT_MESH_MODEL_ID_LIGHT_LC_CLI 0x1311 +/** + * @} + */ + +/** + * @name Models from the Mesh Binary Large Object Transfer Model Specification + * @{ + */ +/** BLOB Transfer Server */ +#define BT_MESH_MODEL_ID_BLOB_SRV 0x1400 +/** BLOB Transfer Client */ +#define BT_MESH_MODEL_ID_BLOB_CLI 0x1401 +/** + * @} + */ + +/** + * @name Models from the Mesh Device Firmware Update Model Specification + * @{ + */ +/** Firmware Update Server */ +#define BT_MESH_MODEL_ID_DFU_SRV 0x1402 +/** Firmware Update Client */ +#define BT_MESH_MODEL_ID_DFU_CLI 0x1403 +/** Firmware Distribution Server */ +#define BT_MESH_MODEL_ID_DFD_SRV 0x1404 +/** Firmware Distribution Client */ +#define BT_MESH_MODEL_ID_DFD_CLI 0x1405 +/** + * @} + */ + +/** @} */ /* end of bt_assigned_numbers_mesh */ + /** * @brief Generic Audio Assigned Numbers * @defgroup bt_assigned_numbers_audio Generic Audio Assigned Numbers diff --git a/include/zephyr/bluetooth/mesh/access.h b/include/zephyr/bluetooth/mesh/access.h index 71aa89db0ef3..06ae4f6e9f6f 100644 --- a/include/zephyr/bluetooth/mesh/access.h +++ b/include/zephyr/bluetooth/mesh/access.h @@ -12,6 +12,7 @@ #include #include +#include #include /* Internal macros used to initialize array members */ @@ -171,194 +172,6 @@ struct bt_mesh_elem { const struct bt_mesh_model * const vnd_models; }; -/** - * @name Foundation Models - * @{ - */ -/** Configuration Server */ -#define BT_MESH_MODEL_ID_CFG_SRV 0x0000 -/** Configuration Client */ -#define BT_MESH_MODEL_ID_CFG_CLI 0x0001 -/** Health Server */ -#define BT_MESH_MODEL_ID_HEALTH_SRV 0x0002 -/** Health Client */ -#define BT_MESH_MODEL_ID_HEALTH_CLI 0x0003 -/** Remote Provisioning Server */ -#define BT_MESH_MODEL_ID_REMOTE_PROV_SRV 0x0004 -/** Remote Provisioning Client */ -#define BT_MESH_MODEL_ID_REMOTE_PROV_CLI 0x0005 -/** Bridge Configuration Sever */ -#define BT_MESH_MODEL_ID_BRG_CFG_SRV 0x0008 -/** Bridge Configuration Client */ -#define BT_MESH_MODEL_ID_BRG_CFG_CLI 0x0009 -/** Private Beacon Server */ -#define BT_MESH_MODEL_ID_PRIV_BEACON_SRV 0x000a -/** Private Beacon Client */ -#define BT_MESH_MODEL_ID_PRIV_BEACON_CLI 0x000b -/** SAR Configuration Server */ -#define BT_MESH_MODEL_ID_SAR_CFG_SRV 0x000e -/** SAR Configuration Client */ -#define BT_MESH_MODEL_ID_SAR_CFG_CLI 0x000f -/** Opcodes Aggregator Server */ -#define BT_MESH_MODEL_ID_OP_AGG_SRV 0x0010 -/** Opcodes Aggregator Client */ -#define BT_MESH_MODEL_ID_OP_AGG_CLI 0x0011 -/** Large Composition Data Server */ -#define BT_MESH_MODEL_ID_LARGE_COMP_DATA_SRV 0x0012 -/** Large Composition Data Client */ -#define BT_MESH_MODEL_ID_LARGE_COMP_DATA_CLI 0x0013 -/** Solicitation PDU RPL Configuration Client */ -#define BT_MESH_MODEL_ID_SOL_PDU_RPL_SRV 0x0014 -/** Solicitation PDU RPL Configuration Server */ -#define BT_MESH_MODEL_ID_SOL_PDU_RPL_CLI 0x0015 -/** Private Proxy Server */ -#define BT_MESH_MODEL_ID_ON_DEMAND_PROXY_SRV 0x000c -/** Private Proxy Client */ -#define BT_MESH_MODEL_ID_ON_DEMAND_PROXY_CLI 0x000d -/** - * @} - */ - -/** - * @name Models from the Mesh Model Specification - * @{ - */ -/** Generic OnOff Server */ -#define BT_MESH_MODEL_ID_GEN_ONOFF_SRV 0x1000 -/** Generic OnOff Client */ -#define BT_MESH_MODEL_ID_GEN_ONOFF_CLI 0x1001 -/** Generic Level Server */ -#define BT_MESH_MODEL_ID_GEN_LEVEL_SRV 0x1002 -/** Generic Level Client */ -#define BT_MESH_MODEL_ID_GEN_LEVEL_CLI 0x1003 -/** Generic Default Transition Time Server */ -#define BT_MESH_MODEL_ID_GEN_DEF_TRANS_TIME_SRV 0x1004 -/** Generic Default Transition Time Client */ -#define BT_MESH_MODEL_ID_GEN_DEF_TRANS_TIME_CLI 0x1005 -/** Generic Power OnOff Server */ -#define BT_MESH_MODEL_ID_GEN_POWER_ONOFF_SRV 0x1006 -/** Generic Power OnOff Setup Server */ -#define BT_MESH_MODEL_ID_GEN_POWER_ONOFF_SETUP_SRV 0x1007 -/** Generic Power OnOff Client */ -#define BT_MESH_MODEL_ID_GEN_POWER_ONOFF_CLI 0x1008 -/** Generic Power Level Server */ -#define BT_MESH_MODEL_ID_GEN_POWER_LEVEL_SRV 0x1009 -/** Generic Power Level Setup Server */ -#define BT_MESH_MODEL_ID_GEN_POWER_LEVEL_SETUP_SRV 0x100a -/** Generic Power Level Client */ -#define BT_MESH_MODEL_ID_GEN_POWER_LEVEL_CLI 0x100b -/** Generic Battery Server */ -#define BT_MESH_MODEL_ID_GEN_BATTERY_SRV 0x100c -/** Generic Battery Client */ -#define BT_MESH_MODEL_ID_GEN_BATTERY_CLI 0x100d -/** Generic Location Server */ -#define BT_MESH_MODEL_ID_GEN_LOCATION_SRV 0x100e -/** Generic Location Setup Server */ -#define BT_MESH_MODEL_ID_GEN_LOCATION_SETUPSRV 0x100f -/** Generic Location Client */ -#define BT_MESH_MODEL_ID_GEN_LOCATION_CLI 0x1010 -/** Generic Admin Property Server */ -#define BT_MESH_MODEL_ID_GEN_ADMIN_PROP_SRV 0x1011 -/** Generic Manufacturer Property Server */ -#define BT_MESH_MODEL_ID_GEN_MANUFACTURER_PROP_SRV 0x1012 -/** Generic User Property Server */ -#define BT_MESH_MODEL_ID_GEN_USER_PROP_SRV 0x1013 -/** Generic Client Property Server */ -#define BT_MESH_MODEL_ID_GEN_CLIENT_PROP_SRV 0x1014 -/** Generic Property Client */ -#define BT_MESH_MODEL_ID_GEN_PROP_CLI 0x1015 -/** Sensor Server */ -#define BT_MESH_MODEL_ID_SENSOR_SRV 0x1100 -/** Sensor Setup Server */ -#define BT_MESH_MODEL_ID_SENSOR_SETUP_SRV 0x1101 -/** Sensor Client */ -#define BT_MESH_MODEL_ID_SENSOR_CLI 0x1102 -/** Time Server */ -#define BT_MESH_MODEL_ID_TIME_SRV 0x1200 -/** Time Setup Server */ -#define BT_MESH_MODEL_ID_TIME_SETUP_SRV 0x1201 -/** Time Client */ -#define BT_MESH_MODEL_ID_TIME_CLI 0x1202 -/** Scene Server */ -#define BT_MESH_MODEL_ID_SCENE_SRV 0x1203 -/** Scene Setup Server */ -#define BT_MESH_MODEL_ID_SCENE_SETUP_SRV 0x1204 -/** Scene Client */ -#define BT_MESH_MODEL_ID_SCENE_CLI 0x1205 -/** Scheduler Server */ -#define BT_MESH_MODEL_ID_SCHEDULER_SRV 0x1206 -/** Scheduler Setup Server */ -#define BT_MESH_MODEL_ID_SCHEDULER_SETUP_SRV 0x1207 -/** Scheduler Client */ -#define BT_MESH_MODEL_ID_SCHEDULER_CLI 0x1208 -/** Light Lightness Server */ -#define BT_MESH_MODEL_ID_LIGHT_LIGHTNESS_SRV 0x1300 -/** Light Lightness Setup Server */ -#define BT_MESH_MODEL_ID_LIGHT_LIGHTNESS_SETUP_SRV 0x1301 -/** Light Lightness Client */ -#define BT_MESH_MODEL_ID_LIGHT_LIGHTNESS_CLI 0x1302 -/** Light CTL Server */ -#define BT_MESH_MODEL_ID_LIGHT_CTL_SRV 0x1303 -/** Light CTL Setup Server */ -#define BT_MESH_MODEL_ID_LIGHT_CTL_SETUP_SRV 0x1304 -/** Light CTL Client */ -#define BT_MESH_MODEL_ID_LIGHT_CTL_CLI 0x1305 -/** Light CTL Temperature Server */ -#define BT_MESH_MODEL_ID_LIGHT_CTL_TEMP_SRV 0x1306 -/** Light HSL Server */ -#define BT_MESH_MODEL_ID_LIGHT_HSL_SRV 0x1307 -/** Light HSL Setup Server */ -#define BT_MESH_MODEL_ID_LIGHT_HSL_SETUP_SRV 0x1308 -/** Light HSL Client */ -#define BT_MESH_MODEL_ID_LIGHT_HSL_CLI 0x1309 -/** Light HSL Hue Server */ -#define BT_MESH_MODEL_ID_LIGHT_HSL_HUE_SRV 0x130a -/** Light HSL Saturation Server */ -#define BT_MESH_MODEL_ID_LIGHT_HSL_SAT_SRV 0x130b -/** Light xyL Server */ -#define BT_MESH_MODEL_ID_LIGHT_XYL_SRV 0x130c -/** Light xyL Setup Server */ -#define BT_MESH_MODEL_ID_LIGHT_XYL_SETUP_SRV 0x130d -/** Light xyL Client */ -#define BT_MESH_MODEL_ID_LIGHT_XYL_CLI 0x130e -/** Light LC Server */ -#define BT_MESH_MODEL_ID_LIGHT_LC_SRV 0x130f -/** Light LC Setup Server */ -#define BT_MESH_MODEL_ID_LIGHT_LC_SETUPSRV 0x1310 -/** Light LC Client */ -#define BT_MESH_MODEL_ID_LIGHT_LC_CLI 0x1311 -/** - * @} - */ - -/** - * @name Models from the Mesh Binary Large Object Transfer Model Specification - * @{ - */ -/** BLOB Transfer Server */ -#define BT_MESH_MODEL_ID_BLOB_SRV 0x1400 -/** BLOB Transfer Client */ -#define BT_MESH_MODEL_ID_BLOB_CLI 0x1401 -/** - * @} - */ - -/** - * @name Models from the Mesh Device Firmware Update Model Specification - * @{ - */ -/** Firmware Update Server */ -#define BT_MESH_MODEL_ID_DFU_SRV 0x1402 -/** Firmware Update Client */ -#define BT_MESH_MODEL_ID_DFU_CLI 0x1403 -/** Firmware Distribution Server */ -#define BT_MESH_MODEL_ID_DFD_SRV 0x1404 -/** Firmware Distribution Client */ -#define BT_MESH_MODEL_ID_DFD_CLI 0x1405 -/** - * @} - */ - /** Model opcode handler. */ struct bt_mesh_model_op { /** OpCode encoded using the BT_MESH_MODEL_OP_* macros */ From 246f487f0c8044a56143433d13bc5fc259b111d2 Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Tue, 16 Sep 2025 14:06:32 +0200 Subject: [PATCH 2094/2141] [nrf fromtree] bluetooth: host: move bt_gatt_authorization_cb_register to gatt.c This function logically belongs to gatt.c as it is GATT API. Signed-off-by: Pavel Vasilyev (cherry picked from commit 52862dc658ac257fe0af586f81dac5b379433bea) Signed-off-by: Pavel Vasilyev --- subsys/bluetooth/host/att.c | 63 +++------------------------ subsys/bluetooth/host/gatt.c | 51 ++++++++++++++++++++++ subsys/bluetooth/host/gatt_internal.h | 3 ++ 3 files changed, 59 insertions(+), 58 deletions(-) diff --git a/subsys/bluetooth/host/att.c b/subsys/bluetooth/host/att.c index 37d8856bad24..263a39c49ac9 100644 --- a/subsys/bluetooth/host/att.c +++ b/subsys/bluetooth/host/att.c @@ -143,11 +143,6 @@ static uint16_t bt_att_mtu(struct bt_att_chan *chan) return MIN(chan->chan.rx.mtu, chan->chan.tx.mtu); } -/* Descriptor of application-specific authorization callbacks that are used - * with the CONFIG_BT_GATT_AUTHORIZATION_CUSTOM Kconfig enabled. - */ -static const struct bt_gatt_authorization_cb *authorization_cb; - /* ATT connection specific data */ struct bt_att { struct bt_conn *conn; @@ -1365,20 +1360,6 @@ struct read_type_data { typedef bool (*attr_read_cb)(struct net_buf *buf, ssize_t read, void *user_data); -static bool attr_read_authorize(struct bt_conn *conn, - const struct bt_gatt_attr *attr) -{ - if (!IS_ENABLED(CONFIG_BT_GATT_AUTHORIZATION_CUSTOM)) { - return true; - } - - if (!authorization_cb || !authorization_cb->read_authorize) { - return true; - } - - return authorization_cb->read_authorize(conn, attr); -} - static bool attr_read_type_cb(struct net_buf *frag, ssize_t read, void *user_data) { @@ -1489,7 +1470,7 @@ static uint8_t read_type_cb(const struct bt_gatt_attr *attr, uint16_t handle, } /* Check the attribute authorization logic */ - if (!attr_read_authorize(conn, attr)) { + if (!bt_gatt_attr_read_authorize(conn, attr)) { data->err = BT_ATT_ERR_AUTHORIZATION; return BT_GATT_ITER_STOP; } @@ -1645,7 +1626,7 @@ static uint8_t read_cb(const struct bt_gatt_attr *attr, uint16_t handle, } /* Check the attribute authorization logic */ - if (!attr_read_authorize(conn, attr)) { + if (!bt_gatt_attr_read_authorize(conn, attr)) { data->err = BT_ATT_ERR_AUTHORIZATION; return BT_GATT_ITER_STOP; } @@ -1816,7 +1797,7 @@ static uint8_t read_vl_cb(const struct bt_gatt_attr *attr, uint16_t handle, } /* Check the attribute authorization logic */ - if (!attr_read_authorize(conn, attr)) { + if (!bt_gatt_attr_read_authorize(conn, attr)) { data->err = BT_ATT_ERR_AUTHORIZATION; return BT_GATT_ITER_STOP; } @@ -2065,20 +2046,6 @@ struct write_data { uint8_t err; }; -static bool attr_write_authorize(struct bt_conn *conn, - const struct bt_gatt_attr *attr) -{ - if (!IS_ENABLED(CONFIG_BT_GATT_AUTHORIZATION_CUSTOM)) { - return true; - } - - if (!authorization_cb || !authorization_cb->write_authorize) { - return true; - } - - return authorization_cb->write_authorize(conn, attr); -} - static uint8_t write_cb(const struct bt_gatt_attr *attr, uint16_t handle, void *user_data) { @@ -2096,7 +2063,7 @@ static uint8_t write_cb(const struct bt_gatt_attr *attr, uint16_t handle, } /* Check the attribute authorization logic */ - if (!attr_write_authorize(data->conn, attr)) { + if (!bt_gatt_attr_write_authorize(data->conn, attr)) { data->err = BT_ATT_ERR_AUTHORIZATION; return BT_GATT_ITER_STOP; } @@ -2215,7 +2182,7 @@ static uint8_t prep_write_cb(const struct bt_gatt_attr *attr, uint16_t handle, } /* Check the attribute authorization logic */ - if (!attr_write_authorize(data->conn, attr)) { + if (!bt_gatt_attr_write_authorize(data->conn, attr)) { data->err = BT_ATT_ERR_AUTHORIZATION; return BT_GATT_ITER_STOP; } @@ -4184,23 +4151,3 @@ bool bt_att_chan_opt_valid(struct bt_conn *conn, enum bt_att_chan_opt chan_opt) return true; } - -int bt_gatt_authorization_cb_register(const struct bt_gatt_authorization_cb *cb) -{ - if (!IS_ENABLED(CONFIG_BT_GATT_AUTHORIZATION_CUSTOM)) { - return -ENOSYS; - } - - if (!cb) { - authorization_cb = NULL; - return 0; - } - - if (authorization_cb) { - return -EALREADY; - } - - authorization_cb = cb; - - return 0; -} diff --git a/subsys/bluetooth/host/gatt.c b/subsys/bluetooth/host/gatt.c index 0770d6a407bb..ea1dc73e158a 100644 --- a/subsys/bluetooth/host/gatt.c +++ b/subsys/bluetooth/host/gatt.c @@ -6590,3 +6590,54 @@ void bt_gatt_req_set_mtu(struct bt_att_req *req, uint16_t mtu) * request types if needed. */ } + +/* Descriptor of application-specific authorization callbacks that are used + * with the CONFIG_BT_GATT_AUTHORIZATION_CUSTOM Kconfig enabled. + */ +static const struct bt_gatt_authorization_cb *authorization_cb; + +bool bt_gatt_attr_read_authorize(struct bt_conn *conn, const struct bt_gatt_attr *attr) +{ + if (!IS_ENABLED(CONFIG_BT_GATT_AUTHORIZATION_CUSTOM)) { + return true; + } + + if (!authorization_cb || !authorization_cb->read_authorize) { + return true; + } + + return authorization_cb->read_authorize(conn, attr); +} + +bool bt_gatt_attr_write_authorize(struct bt_conn *conn, const struct bt_gatt_attr *attr) +{ + if (!IS_ENABLED(CONFIG_BT_GATT_AUTHORIZATION_CUSTOM)) { + return true; + } + + if (!authorization_cb || !authorization_cb->write_authorize) { + return true; + } + + return authorization_cb->write_authorize(conn, attr); +} + +int bt_gatt_authorization_cb_register(const struct bt_gatt_authorization_cb *cb) +{ + if (!IS_ENABLED(CONFIG_BT_GATT_AUTHORIZATION_CUSTOM)) { + return -ENOSYS; + } + + if (!cb) { + authorization_cb = NULL; + return 0; + } + + if (authorization_cb) { + return -EALREADY; + } + + authorization_cb = cb; + + return 0; +} diff --git a/subsys/bluetooth/host/gatt_internal.h b/subsys/bluetooth/host/gatt_internal.h index 1dab30471af1..dbe3736cb0fc 100644 --- a/subsys/bluetooth/host/gatt_internal.h +++ b/subsys/bluetooth/host/gatt_internal.h @@ -68,3 +68,6 @@ struct bt_gatt_attr; /* Check attribute permission */ uint8_t bt_gatt_check_perm(struct bt_conn *conn, const struct bt_gatt_attr *attr, uint16_t mask); + +bool bt_gatt_attr_read_authorize(struct bt_conn *conn, const struct bt_gatt_attr *attr); +bool bt_gatt_attr_write_authorize(struct bt_conn *conn, const struct bt_gatt_attr *attr); From a762251d918b86b8b0318b73813434807b697d69 Mon Sep 17 00:00:00 2001 From: Szymon Janc Date: Thu, 18 Sep 2025 11:07:56 +0200 Subject: [PATCH 2095/2141] [nrf fromtree] Bluetooth: SMP: Print extra state information on timeout This gives some extra information on what could be a reason for SMP timeout. Signed-off-by: Szymon Janc (cherry picked from commit 9354e064220310b691021bc69e4fff8b531b5020) Signed-off-by: Pavel Vasilyev --- subsys/bluetooth/host/smp.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/subsys/bluetooth/host/smp.c b/subsys/bluetooth/host/smp.c index 5854612a2aff..0340f329ab55 100644 --- a/subsys/bluetooth/host/smp.c +++ b/subsys/bluetooth/host/smp.c @@ -2020,7 +2020,15 @@ static void smp_timeout(struct k_work *work) struct k_work_delayable *dwork = k_work_delayable_from_work(work); struct bt_smp *smp = CONTAINER_OF(dwork, struct bt_smp, work); - LOG_ERR("SMP Timeout"); + /* if number of flags or supported commands exceed capacity of one + * atomic variable following error log shall be extended + */ + BUILD_ASSERT(ATOMIC_BITMAP_SIZE(SMP_NUM_FLAGS) == 1); + BUILD_ASSERT(ATOMIC_BITMAP_SIZE(BT_SMP_NUM_CMDS) == 1); + + LOG_ERR("SMP Timeout (flags:0x%08x allowed_cmds:0x%08x)", + (unsigned int)atomic_get(&smp->flags[0]), + (unsigned int)atomic_get(&smp->allowed_cmds[0])); smp_pairing_complete(smp, BT_SMP_ERR_UNSPECIFIED); From c6cbeef3283b4935d53875758d609de23535b1e8 Mon Sep 17 00:00:00 2001 From: Christophe Dufaza Date: Mon, 5 May 2025 15:41:44 +0200 Subject: [PATCH 2096/2141] [nrf fromtree] Bluetooth: Host: Fix use of local variable as atomic target In bt_conn_unref(), a local variable is used as atomic target: atomic_val_t old = atomic_dec(&conn->ref); /* Prevent from accessing connection object */ bool deallocated = (atomic_get(&old) == 1); Using atomic_get() to access a non-shared local variable cannot prevent any data race on that variable, and only causes confusion. Moreover, this call to atomic_get() is incorrect: the API expects an atomic_t* argument (target), not an atomic_val_t* (value). This compiles and /works/ only because Zephyr defines both to be the same integer type, and thus: atomic_get(&old) == old. The equivalent C11 code, where _Atomic(T) and T are different types, wouldn't compile. Signed-off-by: Christophe Dufaza (cherry picked from commit 51f57da387f2635f98434377bf77fa9f7f7ad735) Signed-off-by: Pavel Vasilyev --- subsys/bluetooth/host/conn.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subsys/bluetooth/host/conn.c b/subsys/bluetooth/host/conn.c index f4d1f84c8cd7..0167c471803f 100644 --- a/subsys/bluetooth/host/conn.c +++ b/subsys/bluetooth/host/conn.c @@ -1528,8 +1528,8 @@ void bt_conn_unref(struct bt_conn *conn) conn_handle = conn->handle; old = atomic_dec(&conn->ref); - /* Prevent from accessing connection object */ - deallocated = (atomic_get(&old) == 1); + /* Whether we removed the last reference. */ + deallocated = (old == 1); IF_ENABLED(CONFIG_BT_CONN_TX, (__ASSERT(!(deallocated && k_work_is_pending(&conn->tx_complete_work)), "tx_complete_work is pending when conn is deallocated"))); From 676983296e28a507001ca678a523b342a007407a Mon Sep 17 00:00:00 2001 From: Christophe Dufaza Date: Mon, 18 Aug 2025 13:34:02 +0200 Subject: [PATCH 2097/2141] [nrf fromtree] Bluetooth: Host: Fix possible inconsistent access to connection state An assertion in bt_conn_unref() accesses the connection's state after decrementing its reference count. This is not consistent since, if we removed the last reference, the Bluetooth Host stack may reuse the connection object before the assertion is checked. Instead, retrieve the connection property tested by the assertion before decrementing the counter, as we do for other properties. Simplify the code path by returning early when we did not remove the last reference. Remind that automatic advertiser resumption is deprecated. Signed-off-by: Christophe Dufaza (cherry picked from commit c3f175825e4977e8f36848c2c11cce9d66b16c1b) Signed-off-by: Pavel Vasilyev --- subsys/bluetooth/host/conn.c | 49 +++++++++++++++++++++++++----------- 1 file changed, 34 insertions(+), 15 deletions(-) diff --git a/subsys/bluetooth/host/conn.c b/subsys/bluetooth/host/conn.c index 0167c471803f..23788f29dc42 100644 --- a/subsys/bluetooth/host/conn.c +++ b/subsys/bluetooth/host/conn.c @@ -1517,38 +1517,57 @@ void bt_conn_unref(struct bt_conn *conn) enum bt_conn_type conn_type; uint8_t conn_role; uint16_t conn_handle; + /* Used only if CONFIG_ASSERT and CONFIG_BT_CONN_TX. */ + __maybe_unused bool conn_tx_is_pending; __ASSERT(conn, "Invalid connection reference"); - /* Storing parameters of interest so we don't access the object - * after decrementing its ref-count + /* If we're removing the last reference, the connection object will be + * considered freed and possibly re-allocated by the Bluetooth Host stack + * as soon as we decrement the counter. + * To prevent inconsistencies when accessing the connection's state, + * we store its properties of interest before decrementing the ref-count, + * then unset the local pointer. */ conn_type = conn->type; conn_role = conn->role; conn_handle = conn->handle; - +#if CONFIG_BT_CONN_TX && CONFIG_ASSERT + conn_tx_is_pending = k_work_is_pending(&conn->tx_complete_work); +#endif old = atomic_dec(&conn->ref); - /* Whether we removed the last reference. */ - deallocated = (old == 1); - IF_ENABLED(CONFIG_BT_CONN_TX, - (__ASSERT(!(deallocated && k_work_is_pending(&conn->tx_complete_work)), - "tx_complete_work is pending when conn is deallocated"))); conn = NULL; LOG_DBG("handle %u ref %ld -> %ld", conn_handle, old, (old - 1)); __ASSERT(old > 0, "Conn reference counter is 0"); - /* Slot has been freed and can be taken. No guarantees are made on requests - * to claim connection object as only the first claim will be served. - */ - if (deallocated) { - k_sem_give(&pending_recycled_events); - k_work_submit(&recycled_work); + /* Whether we removed the last reference. */ + deallocated = (old == 1); + if (!deallocated) { + return; } + IF_ENABLED(CONFIG_BT_CONN_TX, + (__ASSERT(!conn_tx_is_pending, + "tx_complete_work is pending when conn is deallocated");)) + + /* Notify listeners that a slot has been freed and can be taken. + * No guarantees are made on requests to claim connection object + * as only the first claim will be served. + */ + k_sem_give(&pending_recycled_events); + k_work_submit(&recycled_work); + + /* Use the freed slot to automatically resume LE peripheral advertising. + * + * This behavior is deprecated: + * - 8cfad44: Bluetooth: Deprecate adv auto-resume + * - #72567: Bluetooth: Advertising resume functionality is broken + * - Migration guide to Zephyr v4.0.0, Automatic advertiser resumption is deprecated + */ if (IS_ENABLED(CONFIG_BT_PERIPHERAL) && conn_type == BT_CONN_TYPE_LE && - conn_role == BT_CONN_ROLE_PERIPHERAL && deallocated) { + conn_role == BT_CONN_ROLE_PERIPHERAL) { bt_le_adv_resume(); } } From 16d0c9c4e6d44d13be4fc5b2ce7156b777e83f77 Mon Sep 17 00:00:00 2001 From: Christophe Dufaza Date: Mon, 5 May 2025 16:56:59 +0200 Subject: [PATCH 2098/2141] [nrf fromtree] Bluetooth: Host: Amend recycled() callback documentation The API documentation for the recycled() callback predates [1], and still warns users to "treat this callback as an ISR", although it now runs on the system workqueue thread, as does disconnected(). "Making Bluetooth API calls" to "re-start connectable advertising or scanning" should no longer be "strongly discouraged". On the contrary, we can emphasize that this is the right event to listen for to initiate operations that will try to re-allocate a freed connection object. Mention that BT_MAX_CONN configures the size of the connection pool. Refs: - [1] efb5d83: Bluetooth: Host: Defer `conn.recycled()` to the syswq Signed-off-by: Christophe Dufaza (cherry picked from commit 60797818d57756c74cd6cbd4d8de19f6e6d7034a) Signed-off-by: Pavel Vasilyev --- include/zephyr/bluetooth/conn.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/include/zephyr/bluetooth/conn.h b/include/zephyr/bluetooth/conn.h index 6a4b7c238c89..51b8065fcdc2 100644 --- a/include/zephyr/bluetooth/conn.h +++ b/include/zephyr/bluetooth/conn.h @@ -1891,12 +1891,13 @@ struct bt_conn_cb { * This callback notifies the application that it might be able to * allocate a connection object. No guarantee, first come, first serve. * - * Use this to e.g. re-start connectable advertising or scanning. + * The maximum number of simultaneous connections is configured + * by @kconfig{CONFIG_BT_MAX_CONN}. * - * Treat this callback as an ISR, as it originates from - * @ref bt_conn_unref which is used by the BT stack. Making - * Bluetooth API calls in this context is error-prone and strongly - * discouraged. + * This is the event to listen for to start a new connection or connectable advertiser, + * both when the intention is to start it after the system is completely + * finished with an earlier connection, and when the application wants to start + * a connection for any reason but failed and is waiting for the right time to retry. */ void (*recycled)(void); From 33c275bbcf8433dd7c487286b88cdfd6b7bef1b2 Mon Sep 17 00:00:00 2001 From: Christophe Dufaza Date: Tue, 5 Aug 2025 16:54:10 +0200 Subject: [PATCH 2099/2141] [nrf fromtree] Bluetooth: Host: Amend disconnected() callback documentation The API documentation for the disconnected() callback warns that the listener can't assume that the corresponding connection object has been freed and may me available to the application. The recommendations given to still start a new connection or connectable advertiser are outdated or misleading: - "start connectable advertising": the options that "will attempt to resume the advertiser under some conditions" are deprecated since Zephyr 4.0 (BT_LE_ADV_OPT_CONNECTABLE and related) - "using k_work_submit()": assuming everything will be fine when the work is actually processed is not reliable - "increase CONFIG_BT_MAX_CONN": setting BT_MAX_CONN to N+1 when planning N simultaneous connections is a work-around that users may have gotten used to (despite its footprint), but there is no longer any reason to advise it Stop documenting creating new connections or restarting advertising from the disconnected() callback and instead recommend relying on recycled() for these use cases. Signed-off-by: Christophe Dufaza (cherry picked from commit dca154df3e520ceb955c79a3ea8ca325f3fa82b6) Signed-off-by: Pavel Vasilyev --- include/zephyr/bluetooth/conn.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/include/zephyr/bluetooth/conn.h b/include/zephyr/bluetooth/conn.h index 51b8065fcdc2..2f9b796e1ec1 100644 --- a/include/zephyr/bluetooth/conn.h +++ b/include/zephyr/bluetooth/conn.h @@ -1877,9 +1877,8 @@ struct bt_conn_cb { * start either a connectable advertiser or create a new connection * this might fail because there are no free connection objects * available. - * To avoid this issue it is recommended to either start connectable - * advertise or create a new connection using @ref k_work_submit or - * increase @kconfig{CONFIG_BT_MAX_CONN}. + * To avoid this issue, it's recommended to rely instead on @ref bt_conn_cb.recycled + * which notifies the application when a connection object has actually been freed. * * @param conn Connection object. * @param reason BT_HCI_ERR_* reason for the disconnection. From 46db59178271c3c96e4fdd9fb52ee23e8d0aaae0 Mon Sep 17 00:00:00 2001 From: Christophe Dufaza Date: Mon, 12 May 2025 15:15:44 +0200 Subject: [PATCH 2100/2141] [nrf fromtree] Bluetooth: Host: Fix some MISRA c:M23_112 warnings Fix some "All if ... else if constructs shall be terminated with an else clause" (c:M23_112) issues reported by SonarQube. Signed-off-by: Christophe Dufaza (cherry picked from commit 69cab3f6a8ac07d548541b62c49c465143f972ca) Signed-off-by: Pavel Vasilyev --- subsys/bluetooth/host/conn.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/subsys/bluetooth/host/conn.c b/subsys/bluetooth/host/conn.c index 23788f29dc42..29700ad3ee92 100644 --- a/subsys/bluetooth/host/conn.c +++ b/subsys/bluetooth/host/conn.c @@ -2308,6 +2308,10 @@ static void deferred_work(struct k_work *work) err); } #endif + } else { + /* Neither the application nor the configuration + * set LE connection parameters. + */ } atomic_set_bit(conn->flags, BT_CONN_PERIPHERAL_PARAM_UPDATE); @@ -2410,6 +2414,8 @@ struct bt_conn *bt_conn_add_sco(const bt_addr_t *peer, int link_type) } else if (link_type == BT_HCI_ESCO) { sco_conn->sco.pkt_type = (bt_dev.br.esco_pkt_type & ~EDR_ESCO_PKT_MASK); + } else { + /* Ignoring unexpected link type BT_HCI_ACL. */ } return sco_conn; From 73eaa41318dca1ddd7633e29ddb4113d5408e8cb Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Thu, 6 Feb 2025 09:44:50 +1000 Subject: [PATCH 2101/2141] [nrf fromtree] bluetooth: host: conn: handle `bt_le_create_conn_cancel` error Handle the `bt_le_create_conn_cancel` call in the deferred worker failing due to insufficient command buffers. Signed-off-by: Jordan Yates (cherry picked from commit c3221f04200a6d522d57300f377696b5053aa4b6) Signed-off-by: Pavel Vasilyev --- subsys/bluetooth/host/conn.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/subsys/bluetooth/host/conn.c b/subsys/bluetooth/host/conn.c index 29700ad3ee92..bb3cbf634d74 100644 --- a/subsys/bluetooth/host/conn.c +++ b/subsys/bluetooth/host/conn.c @@ -2268,7 +2268,10 @@ static void deferred_work(struct k_work *work) * auto connect flag if it was set, instead just cancel * connection directly */ - bt_le_create_conn_cancel(); + if (bt_le_create_conn_cancel() == -ENOBUFS) { + LOG_WRN("No buffers to cancel connection, retrying in 10 ms"); + k_work_reschedule(dwork, K_MSEC(10)); + } return; } From 3a0b6805380afe712c4682cee3b83876cae1335d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Thu, 18 Sep 2025 11:39:49 +0200 Subject: [PATCH 2102/2141] [nrf fromtree] bluetooth: mesh: access: doxygen improvements MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A few straightforward cleanups to existing documentation to improve coverage and properly hide internal macros. Signed-off-by: Benjamin Cabé (cherry picked from commit 7be280cee64cfce5d0e465d38046e8ffc053282d) Signed-off-by: Pavel Vasilyev --- include/zephyr/bluetooth/mesh/access.h | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/include/zephyr/bluetooth/mesh/access.h b/include/zephyr/bluetooth/mesh/access.h index 06ae4f6e9f6f..c2dc4df4fdac 100644 --- a/include/zephyr/bluetooth/mesh/access.h +++ b/include/zephyr/bluetooth/mesh/access.h @@ -15,6 +15,10 @@ #include #include +/** + * @cond INTERNAL_HIDDEN + */ + /* Internal macros used to initialize array members */ #define BT_MESH_KEY_UNUSED_ELT_(IDX, _) BT_MESH_KEY_UNUSED #define BT_MESH_ADDR_UNASSIGNED_ELT_(IDX, _) BT_MESH_ADDR_UNASSIGNED @@ -31,6 +35,8 @@ #define BT_MESH_MODEL_UUIDS_UNASSIGNED() #endif +/** @endcond */ + #define BT_MESH_MODEL_RUNTIME_INIT(_user_data) \ .rt = &(struct bt_mesh_model_rt_ctx){ .user_data = (_user_data) }, @@ -199,8 +205,11 @@ struct bt_mesh_model_op { struct net_buf_simple *buf); }; +/** Macro for encoding a 1-byte opcode (used by Bluetooth SIG defined models). */ #define BT_MESH_MODEL_OP_1(b0) (b0) +/** Macro for encoding a 2-byte opcode (used by Bluetooth SIG defined models). */ #define BT_MESH_MODEL_OP_2(b0, b1) (((b0) << 8) | (b1)) +/** Macro for encoding a 3-byte opcode (vendor-specific message). */ #define BT_MESH_MODEL_OP_3(b0, cid) ((((b0) << 16) | 0xc00000) | (cid)) /** Macro for encoding exact message length for fixed-length messages. */ @@ -593,13 +602,13 @@ struct bt_mesh_model_pub { * BT_MESH_MODELS_METADATA_ENTRY macro. */ struct bt_mesh_models_metadata_entry { - /* Length of the metadata */ + /** Length of the metadata */ const uint16_t len; - /* ID of the metadata */ + /** ID of the metadata */ const uint16_t id; - /* Pointer to raw data */ + /** Pointer to raw data */ const void * const data; }; From 69eac49f560e5b6a5304c7a053f839a642d0b3b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20Reierstad?= Date: Tue, 9 Sep 2025 09:59:08 +0200 Subject: [PATCH 2103/2141] [nrf fromtree] Bluetooth: Host: Add userdefined fixed l2cap chans MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds support for the user defining their own channels within the fixed L2CAP channel range. To make this possible, the `bt_l2cap_fixed_chan` struct and `BT_L2CAP_CHANNEL_DEFINE` macro needed to converted to public API. In the process of doing so, the `_destroy` parameter was removed from the `BT_L2CAP_CHANNEL_DEFINE` macro as it was never used (fixed channels will not be destroyed over the lifetime of the connection). `BT_L2CAP_CHANNEL_DEFINE` is renamed `BT_L2CAP_FIXED_CHANNEL_DEFINE` to avoid confusion The `bt_l2cap_chan_send` function is updated to be able to send data on fixed l2cap channels. Signed-off-by: Håvard Reierstad (cherry picked from commit ff17e601d0c1586fb4ac7d04bae26e2f17709297) Signed-off-by: Pavel Vasilyev --- doc/connectivity/bluetooth/api/l2cap.rst | 38 +++++++- include/zephyr/bluetooth/l2cap.h | 111 ++++++++++++++++++++--- subsys/bluetooth/host/att.c | 5 +- subsys/bluetooth/host/l2cap.c | 45 +++++++-- subsys/bluetooth/host/l2cap_internal.h | 19 ---- subsys/bluetooth/host/smp.c | 5 +- subsys/bluetooth/host/smp_null.c | 5 +- 7 files changed, 181 insertions(+), 47 deletions(-) diff --git a/doc/connectivity/bluetooth/api/l2cap.rst b/doc/connectivity/bluetooth/api/l2cap.rst index 581edda83485..157f9684be13 100644 --- a/doc/connectivity/bluetooth/api/l2cap.rst +++ b/doc/connectivity/bluetooth/api/l2cap.rst @@ -3,11 +3,45 @@ Logical Link Control and Adaptation Protocol (L2CAP) #################################################### -L2CAP layer enables connection-oriented channels which can be enable with the -configuration option: :kconfig:option:`CONFIG_BT_L2CAP_DYNAMIC_CHANNEL`. This channels +L2CAP layer enables connection-oriented channels which can be enabled with the +configuration option: :kconfig:option:`CONFIG_BT_L2CAP_DYNAMIC_CHANNEL`. These channels support segmentation and reassembly transparently, they also support credit based flow control making it suitable for data streams. +The user can also define fixed channels using the :c:macro:`BT_L2CAP_FIXED_CHANNEL_DEFINE` +macro. Fixed channels are initialized upon connection, and do not support segmentation. An example +of how to define a fixed channel is shown below. + +.. code-block:: c + + static struct bt_l2cap_chan fixed_chan[CONFIG_BT_MAX_CONN]; + + /* Callbacks are assumed to be defined prior. */ + static struct bt_l2cap_chan_ops ops = { + .recv = recv_cb, + .sent = sent_cb, + .connected = connected_cb, + .disconnected = disconnected_cb, + }; + + static int l2cap_fixed_accept(struct bt_conn *conn, struct bt_l2cap_chan **chan) + { + uint8_t conn_index = bt_conn_index(conn); + + *chan = &fixed_chan[conn_index]; + + **chan = (struct bt_l2cap_chan){ + .ops = &ops, + }; + + return 0; + } + + BT_L2CAP_FIXED_CHANNEL_DEFINE(fixed_channel) = { + .cid = 0x0010, + .accept = l2cap_fixed_accept, + }; + Channels instances are represented by the :c:struct:`bt_l2cap_chan` struct which contains the callbacks in the :c:struct:`bt_l2cap_chan_ops` struct to inform when the channel has been connected, disconnected or when the encryption has diff --git a/include/zephyr/bluetooth/l2cap.h b/include/zephyr/bluetooth/l2cap.h index 571b57e76ac9..0ffa85bc41c6 100644 --- a/include/zephyr/bluetooth/l2cap.h +++ b/include/zephyr/bluetooth/l2cap.h @@ -139,6 +139,27 @@ extern "C" { */ #define BT_L2CAP_ECRED_CHAN_MAX_PER_REQ 5 +/** + * @defgroup l2cap_cid L2CAP channel identifiers + * @ingroup bt_l2cap + * @{ + * + * @brief Standard L2CAP channel identifiers + */ + +/** @brief BR signaling channel */ +#define BT_L2CAP_CID_BR_SIG 0x0001 +/** @brief Attribute Protocol channel */ +#define BT_L2CAP_CID_ATT 0x0004 +/** @brief LE signaling channel */ +#define BT_L2CAP_CID_LE_SIG 0x0005 +/** @brief Security Manager Protocol channel */ +#define BT_L2CAP_CID_SMP 0x0006 +/** @brief BR Security Manager Protocol channel */ +#define BT_L2CAP_CID_BR_SMP 0x0007 + +/** @} */ + struct bt_l2cap_chan; /** @typedef bt_l2cap_chan_destroy_t @@ -290,6 +311,68 @@ struct bt_l2cap_le_chan { */ #define BT_L2CAP_LE_CHAN(_ch) CONTAINER_OF(_ch, struct bt_l2cap_le_chan, chan) +/** @brief Fixed L2CAP Channel structure. Should be defined using the + * @ref BT_L2CAP_FIXED_CHANNEL_DEFINE macro. + */ +struct bt_l2cap_fixed_chan { + /** @brief Channel Identifier (CID) + * + * @note Shall be in the range 0x0001 to 0x003F (Core 3.A.2.1 v6.0). The CIDs in this range + * are reserved by the stack, so the application needs to make sure that the CID is + * not already in use. Table 2.1 in Core 3.A.2.1 and @ref l2cap_cid shows the + * CIDs used by the stack. + */ + uint16_t cid; + + /** @brief Channel accept callback + * + * This callback needs to be provided by the application, and is invoked when a new + * connection has been established. If accepting the connection, the user is expected to + * allocate memory with suitable alignment for the type @ref bt_l2cap_chan for the channel, + * and update the channel reference @p chan to point to the allocated memory. The channel + * should be initialized by assigning the callbacks to the @ref bt_l2cap_chan_ops field + * as follows: + * @code + * static int accept(struct bt_conn *conn, struct bt_l2cap_chan **chan) + * { + * // Allocation of fixed_chan and definition of the ops are assumed done prior. + * *chan = &fixed_chan; + * + * **chan = (struct bt_l2cap_chan){ + * .ops = &ops, + * }; + * + * return 0; + * } + * @endcode + * The allocated context needs to be valid for the lifetime of the channel, i. e. + * freeing of the memory can be done in the @ref bt_l2cap_chan_ops.released callback. + * + * @param conn The connection that has been established. + * @param chan L2CAP channel reference. + * + * @return 0 to accept the channel connection, negative error code otherwise. + */ + int (*accept)(struct bt_conn *conn, struct bt_l2cap_chan **chan); +}; + +/** + * @brief Register a fixed L2CAP channel. + * + * Define and register a fixed L2CAP channel of type @ref bt_l2cap_fixed_chan. + * + * @note Fixed L2CAP channels are according to the Core Specification (3.A.2.1 v6.0) reserved + * for the stack, but this allows the application to define their own, for instance if there + * are memory constraints and dynamic channels are not suitable. The application needs to + * make sure that the CID for the fixed channel is not already in use. + * + * @param _name Name of the fixed L2CAP channel. The channels are sorted lexicographically, and + * will be initialized in the same order. + */ +#define BT_L2CAP_FIXED_CHANNEL_DEFINE(_name) \ + static const STRUCT_SECTION_ITERABLE(bt_l2cap_fixed_chan, \ + _CONCAT(bt_l2cap_fixed_chan, _name)) + /** L2CAP Endpoint Link Mode. Basic mode. */ #define BT_L2CAP_BR_LINK_MODE_BASIC 0x00 /** L2CAP Endpoint Link Mode. Retransmission mode. */ @@ -910,23 +993,21 @@ int bt_l2cap_chan_disconnect(struct bt_l2cap_chan *chan); /** @brief Send data to L2CAP channel * - * Send data from buffer to the channel. If credits are not available, buf will - * be queued and sent as and when credits are received from peer. - * Regarding to first input parameter, to get details see reference description - * to bt_l2cap_chan_connect() API above. + * Send data from buffer to the channel. For dynamic channels; if credits are + * not available, buf will be queued and sent as and when credits are received + * from peer. * * Network buffer fragments (ie `buf->frags`) are not supported. * - * When sending L2CAP data over an BR/EDR connection the application is sending - * L2CAP PDUs. The application is required to have reserved - * @ref BT_L2CAP_CHAN_SEND_RESERVE bytes in the buffer before sending. - * The application should use the BT_L2CAP_BUF_SIZE() helper to correctly - * size the buffers for the for the outgoing buffer pool. + * When sending L2CAP data over an BR/EDR connection or a fixed L2CAP channel, + * the application is sending L2CAP PDUs. The application is required to have + * reserved @ref BT_L2CAP_CHAN_SEND_RESERVE bytes in the buffer before sending. + * The application should use the BT_L2CAP_BUF_SIZE() helper to correctly size + * the buffers for the for the outgoing buffer pool. * - * When sending L2CAP data over an LE connection the application is sending - * L2CAP SDUs. The application shall reserve + * When sending L2CAP data over a dynamic L2CAP channel, the application is + * sending L2CAP SDUs. The application shall reserve * @ref BT_L2CAP_SDU_CHAN_SEND_RESERVE bytes in the buffer before sending. - * * The application can use the BT_L2CAP_SDU_BUF_SIZE() helper to correctly size * the buffer to account for the reserved headroom. * @@ -942,9 +1023,13 @@ int bt_l2cap_chan_disconnect(struct bt_l2cap_chan *chan); * @note Buffer ownership is transferred to the stack in case of success, in * case of an error the caller retains the ownership of the buffer. * + * @param chan The channel to send the data to. See @ref bt_l2cap_chan_connect + * for more details. + * @param buf Buffer containing the data. + * * @return 0 in case of success or negative value in case of error. * @return -EINVAL if `buf` or `chan` is NULL. - * @return -EINVAL if `chan` is not either BR/EDR or LE credit-based. + * @return -EINVAL if `chan` is not either BR/EDR or LE based. * @return -EINVAL if buffer doesn't have enough bytes reserved to fit header. * @return -EINVAL if buffer's reference counter != 1 * @return -EMSGSIZE if `buf` is larger than `chan`'s MTU. diff --git a/subsys/bluetooth/host/att.c b/subsys/bluetooth/host/att.c index 263a39c49ac9..c822de7ab4bc 100644 --- a/subsys/bluetooth/host/att.c +++ b/subsys/bluetooth/host/att.c @@ -3504,7 +3504,10 @@ static int bt_att_accept(struct bt_conn *conn, struct bt_l2cap_chan **ch) * placed as the last one to ensure that SMP channel is properly initialized before bt_att_connected * tries to send security request. */ -BT_L2CAP_CHANNEL_DEFINE(z_att_fixed_chan, BT_L2CAP_CID_ATT, bt_att_accept, NULL); +BT_L2CAP_FIXED_CHANNEL_DEFINE(z_att_fixed_chan) = { + .cid = BT_L2CAP_CID_ATT, + .accept = bt_att_accept, +}; #if defined(CONFIG_BT_EATT) static k_timeout_t credit_based_connection_delay(struct bt_conn *conn) diff --git a/subsys/bluetooth/host/l2cap.c b/subsys/bluetooth/host/l2cap.c index df5c4a8f4bc7..882ba9a037b4 100644 --- a/subsys/bluetooth/host/l2cap.c +++ b/subsys/bluetooth/host/l2cap.c @@ -50,6 +50,11 @@ LOG_MODULE_REGISTER(bt_l2cap, CONFIG_BT_L2CAP_LOG_LEVEL); #define L2CAP_LE_MAX_CREDITS (BT_BUF_ACL_RX_COUNT - 1) +#define L2CAP_LE_CID_FIXED_START 0x0001 +#define L2CAP_LE_CID_FIXED_END 0x003f +#define L2CAP_LE_CID_IS_FIXED(_cid) \ + (_cid >= L2CAP_LE_CID_FIXED_START && _cid <= L2CAP_LE_CID_FIXED_END) + #define L2CAP_LE_CID_DYN_START 0x0040 #define L2CAP_LE_CID_DYN_END 0x007f #define L2CAP_LE_CID_IS_DYN(_cid) \ @@ -425,6 +430,12 @@ void bt_l2cap_connected(struct bt_conn *conn) STRUCT_SECTION_FOREACH(bt_l2cap_fixed_chan, fchan) { struct bt_l2cap_le_chan *le_chan; + __ASSERT(L2CAP_LE_CID_IS_FIXED(fchan->cid), + "CID %u is not in the fixed channel range", fchan->cid); + + chan = bt_l2cap_le_lookup_tx_cid(conn, fchan->cid); + __ASSERT(chan == NULL, "Fixed channel with CID %u already exists", fchan->cid); + if (fchan->accept(conn, &chan) < 0) { continue; } @@ -437,7 +448,7 @@ void bt_l2cap_connected(struct bt_conn *conn) le_chan->rx.cid = fchan->cid; le_chan->tx.cid = fchan->cid; - if (!l2cap_chan_add(conn, chan, fchan->destroy)) { + if (!l2cap_chan_add(conn, chan, NULL)) { return; } @@ -2957,7 +2968,10 @@ static int l2cap_accept(struct bt_conn *conn, struct bt_l2cap_chan **chan) return -ENOMEM; } -BT_L2CAP_CHANNEL_DEFINE(le_fixed_chan, BT_L2CAP_CID_LE_SIG, l2cap_accept, NULL); +BT_L2CAP_FIXED_CHANNEL_DEFINE(le_fixed_chan) = { + .cid = BT_L2CAP_CID_LE_SIG, + .accept = l2cap_accept, +}; void bt_l2cap_init(void) { @@ -3415,6 +3429,16 @@ static int bt_l2cap_dyn_chan_send(struct bt_l2cap_le_chan *le_chan, struct net_b return 0; } +#endif /* CONFIG_BT_L2CAP_DYNAMIC_CHANNEL */ + +static void l2cap_fixed_chan_sent_cb(struct bt_conn *conn, void *user_data, int err) +{ + struct bt_l2cap_chan *chan = user_data; + + if (chan->ops->sent) { + chan->ops->sent(chan); + } +} int bt_l2cap_chan_send(struct bt_l2cap_chan *chan, struct net_buf *buf) { @@ -3442,20 +3466,21 @@ int bt_l2cap_chan_send(struct bt_l2cap_chan *chan, struct net_buf *buf) return bt_l2cap_br_chan_send_cb(chan, buf, NULL, NULL); } - /* Sending over static channels is not supported by this fn. Use - * `bt_l2cap_send_pdu()` instead. - */ - if (IS_ENABLED(CONFIG_BT_L2CAP_DYNAMIC_CHANNEL)) { - struct bt_l2cap_le_chan *le_chan = BT_L2CAP_LE_CHAN(chan); + struct bt_l2cap_le_chan *le_chan = BT_L2CAP_LE_CHAN(chan); - __ASSERT_NO_MSG(le_chan); - __ASSERT_NO_MSG(L2CAP_LE_CID_IS_DYN(le_chan->tx.cid)); + __ASSERT_NO_MSG(le_chan); +#if defined(CONFIG_BT_L2CAP_DYNAMIC_CHANNEL) + if (L2CAP_LE_CID_IS_DYN(le_chan->tx.cid)) { return bt_l2cap_dyn_chan_send(le_chan, buf); } +#endif + + if (L2CAP_LE_CID_IS_FIXED(le_chan->tx.cid)) { + return bt_l2cap_send_pdu(le_chan, buf, l2cap_fixed_chan_sent_cb, (void *)chan); + } LOG_DBG("Invalid channel type (chan %p)", chan); return -EINVAL; } -#endif /* CONFIG_BT_L2CAP_DYNAMIC_CHANNEL */ diff --git a/subsys/bluetooth/host/l2cap_internal.h b/subsys/bluetooth/host/l2cap_internal.h index 3f84b2b43d74..82d6d65434f9 100644 --- a/subsys/bluetooth/host/l2cap_internal.h +++ b/subsys/bluetooth/host/l2cap_internal.h @@ -26,12 +26,6 @@ enum l2cap_conn_list_action { BT_L2CAP_CHAN_DETACH, }; -#define BT_L2CAP_CID_BR_SIG 0x0001 -#define BT_L2CAP_CID_ATT 0x0004 -#define BT_L2CAP_CID_LE_SIG 0x0005 -#define BT_L2CAP_CID_SMP 0x0006 -#define BT_L2CAP_CID_BR_SMP 0x0007 - #define BT_L2CAP_PSM_RFCOMM 0x0003 struct bt_l2cap_hdr { @@ -164,19 +158,6 @@ struct bt_l2cap_ecred_reconf_rsp { uint16_t result; } __packed; -struct bt_l2cap_fixed_chan { - uint16_t cid; - int (*accept)(struct bt_conn *conn, struct bt_l2cap_chan **chan); - bt_l2cap_chan_destroy_t destroy; -}; - -#define BT_L2CAP_CHANNEL_DEFINE(_name, _cid, _accept, _destroy) \ - const STRUCT_SECTION_ITERABLE(bt_l2cap_fixed_chan, _name) = { \ - .cid = _cid, \ - .accept = _accept, \ - .destroy = _destroy, \ - } - /* Notify L2CAP channels of a new connection */ void bt_l2cap_connected(struct bt_conn *conn); diff --git a/subsys/bluetooth/host/smp.c b/subsys/bluetooth/host/smp.c index 0340f329ab55..4914f1ff5553 100644 --- a/subsys/bluetooth/host/smp.c +++ b/subsys/bluetooth/host/smp.c @@ -6362,7 +6362,10 @@ static int bt_smp_accept(struct bt_conn *conn, struct bt_l2cap_chan **chan) return -ENOMEM; } -BT_L2CAP_CHANNEL_DEFINE(smp_fixed_chan, BT_L2CAP_CID_SMP, bt_smp_accept, NULL); +BT_L2CAP_FIXED_CHANNEL_DEFINE(smp_fixed_chan) = { + .cid = BT_L2CAP_CID_SMP, + .accept = bt_smp_accept, +}; #if defined(CONFIG_BT_CLASSIC) BT_L2CAP_BR_CHANNEL_DEFINE(smp_br_fixed_chan, BT_L2CAP_CID_BR_SMP, bt_smp_br_accept); diff --git a/subsys/bluetooth/host/smp_null.c b/subsys/bluetooth/host/smp_null.c index 0ff20b4a16d6..92a6596860e0 100644 --- a/subsys/bluetooth/host/smp_null.c +++ b/subsys/bluetooth/host/smp_null.c @@ -102,7 +102,10 @@ static int bt_smp_accept(struct bt_conn *conn, struct bt_l2cap_chan **chan) return -ENOMEM; } -BT_L2CAP_CHANNEL_DEFINE(smp_fixed_chan, BT_L2CAP_CID_SMP, bt_smp_accept, NULL); +BT_L2CAP_FIXED_CHANNEL_DEFINE(smp_fixed_chan) = { + .cid = BT_L2CAP_CID_SMP, + .accept = bt_smp_accept, +}; int bt_smp_init(void) { From f45a47838bf426ee2e522de0e9acc10abc94f357 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Sat, 27 Sep 2025 12:04:16 +0200 Subject: [PATCH 2104/2141] [nrf fromtree] Bluetooth: Host: Add note about recycled for BT_LE_ADV_OPT_CONN When a connectable advertising set is stopped, the preallocated connection object is free by calling bt_conn_unref which triggers a call to the recycled callback. Signed-off-by: Emil Gydesen (cherry picked from commit 7d8315574f9724c478f2953e8dfeaaba6c705244) Signed-off-by: Pavel Vasilyev --- include/zephyr/bluetooth/bluetooth.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/zephyr/bluetooth/bluetooth.h b/include/zephyr/bluetooth/bluetooth.h index a769b49967fb..f22643f98035 100644 --- a/include/zephyr/bluetooth/bluetooth.h +++ b/include/zephyr/bluetooth/bluetooth.h @@ -756,6 +756,8 @@ enum bt_le_adv_opt { * * Starting connectable advertising preallocates a connection * object. If this fails, the API returns @c -ENOMEM. + * Stopping connectable advertising will free the connection object, + * and will trigger a call to @ref bt_conn_cb.recycled. * * The advertising set stops immediately after it creates a * connection. This happens automatically in the controller. From 35a2b32e971f93dc287b8d6904ca177a98bfcadf Mon Sep 17 00:00:00 2001 From: Ali Hozhabri Date: Mon, 12 May 2025 15:55:31 +0200 Subject: [PATCH 2105/2141] [nrf fromtree] drivers: bluetooth: hci: Introduce bt_spi_close to support bt_disable Introduce bt_spi_close function to support bt_disable implementation in applications. Signed-off-by: Ali Hozhabri (cherry picked from commit 9a440ec18f07b87af0351a252a744c6314d3df21) Signed-off-by: Pavel Vasilyev --- drivers/bluetooth/hci/hci_spi_st.c | 33 +++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/drivers/bluetooth/hci/hci_spi_st.c b/drivers/bluetooth/hci/hci_spi_st.c index 8f6bf72c0edb..5b0d8fc674af 100644 --- a/drivers/bluetooth/hci/hci_spi_st.c +++ b/drivers/bluetooth/hci/hci_spi_st.c @@ -515,7 +515,11 @@ static void bt_spi_rx_thread(void *p1, void *p2, void *p3) while (true) { /* Wait for interrupt pin to be active */ - k_sem_take(&sem_request, K_FOREVER); + ret = k_sem_take(&sem_request, K_FOREVER); + if (ret) { + LOG_DBG("Failed to take the semaphore. The RX thread exits."); + break; + } LOG_DBG(""); @@ -685,12 +689,39 @@ static int bt_spi_open(const struct device *dev, bt_hci_recv_t recv) return 0; } +static int bt_spi_close(const struct device *dev) +{ + struct bt_spi_data *hci = dev->data; + int ret; + + gpio_pin_interrupt_configure_dt(&irq_gpio, GPIO_INT_DISABLE); + + /* To exit the thread safely */ + k_sem_reset(&sem_request); + ret = k_thread_join(&spi_rx_thread_data, K_MSEC(100)); + if (ret) { + LOG_DBG("bt_spi_rx_thread is unable to exit"); + return ret; + } + + /* Reset the BLE controller */ + gpio_pin_set_dt(&rst_gpio, 1); + k_sleep(K_MSEC(DT_INST_PROP_OR(0, reset_assert_duration_ms, 0))); + gpio_pin_set_dt(&rst_gpio, 0); + + hci->recv = NULL; + LOG_DBG("Bluetooth disabled"); + + return 0; +} + static DEVICE_API(bt_hci, drv) = { #if defined(CONFIG_BT_BLUENRG_ACI) && !defined(CONFIG_BT_HCI_RAW) .setup = bt_spi_bluenrg_setup, #endif /* CONFIG_BT_BLUENRG_ACI && !CONFIG_BT_HCI_RAW */ .open = bt_spi_open, .send = bt_spi_send, + .close = bt_spi_close, }; static int bt_spi_init(const struct device *dev) From c82b9bcc700f3f30cfb67027ae2bea5f1a163ad4 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Thu, 2 Oct 2025 13:52:13 +0200 Subject: [PATCH 2106/2141] [nrf fromtree] Bluetooth: Host: Remove bt_le_set_auto_conn Remove the deprecated function bt_le_set_auto_conn as it has been deprecated since 4.1. Signed-off-by: Emil Gydesen (cherry picked from commit 360880b7c7f397624ae8a4413d71ae261a370c39) Signed-off-by: Pavel Vasilyev --- include/zephyr/bluetooth/conn.h | 17 ---------- subsys/bluetooth/host/conn.c | 59 --------------------------------- 2 files changed, 76 deletions(-) diff --git a/include/zephyr/bluetooth/conn.h b/include/zephyr/bluetooth/conn.h index 2f9b796e1ec1..67c3db64e92a 100644 --- a/include/zephyr/bluetooth/conn.h +++ b/include/zephyr/bluetooth/conn.h @@ -1639,23 +1639,6 @@ int bt_conn_le_create_auto(const struct bt_conn_le_create_param *create_param, */ int bt_conn_create_auto_stop(void); -/** @brief Automatically connect to remote device if it's in range. - * - * This function enables/disables automatic connection initiation. - * Every time the device loses the connection with peer, this connection - * will be re-established if connectable advertisement from peer is received. - * - * @note Auto connect is disabled during explicit scanning. - * - * @param addr Remote Bluetooth address. - * @param param If non-NULL, auto connect is enabled with the given - * parameters. If NULL, auto connect is disabled. - * - * @return Zero on success or error code otherwise. - */ -__deprecated int bt_le_set_auto_conn(const bt_addr_le_t *addr, - const struct bt_le_conn_param *param); - /** @brief Set security level for a connection. * * This function enable security (encryption) for a connection. If the device diff --git a/subsys/bluetooth/host/conn.c b/subsys/bluetooth/host/conn.c index bb3cbf634d74..766f61788457 100644 --- a/subsys/bluetooth/host/conn.c +++ b/subsys/bluetooth/host/conn.c @@ -4011,65 +4011,6 @@ int bt_conn_le_create_synced(const struct bt_le_ext_adv *adv, *ret_conn = conn; return 0; } - -#if !defined(CONFIG_BT_FILTER_ACCEPT_LIST) -int bt_le_set_auto_conn(const bt_addr_le_t *addr, - const struct bt_le_conn_param *param) -{ - struct bt_conn *conn; - - if (!atomic_test_bit(bt_dev.flags, BT_DEV_READY)) { - return -EAGAIN; - } - - if (param && !bt_le_conn_params_valid(param)) { - return -EINVAL; - } - - if (!bt_id_scan_random_addr_check()) { - return -EINVAL; - } - - /* Only default identity is supported */ - conn = bt_conn_lookup_addr_le(BT_ID_DEFAULT, addr); - if (!conn) { - conn = bt_conn_add_le(BT_ID_DEFAULT, addr); - if (!conn) { - return -ENOMEM; - } - } - - if (param) { - bt_conn_set_param_le(conn, param); - - if (!atomic_test_and_set_bit(conn->flags, - BT_CONN_AUTO_CONNECT)) { - bt_conn_ref(conn); - } - } else { - if (atomic_test_and_clear_bit(conn->flags, - BT_CONN_AUTO_CONNECT)) { - bt_conn_unref(conn); - if (conn->state == BT_CONN_SCAN_BEFORE_INITIATING) { - bt_conn_set_state(conn, BT_CONN_DISCONNECTED); - } - } - } - - int err = 0; - if (conn->state == BT_CONN_DISCONNECTED && - atomic_test_bit(bt_dev.flags, BT_DEV_READY)) { - if (param) { - bt_conn_set_state(conn, BT_CONN_SCAN_BEFORE_INITIATING); - err = bt_le_scan_user_add(BT_LE_SCAN_USER_CONN); - } - } - - bt_conn_unref(conn); - - return err; -} -#endif /* !defined(CONFIG_BT_FILTER_ACCEPT_LIST) */ #endif /* CONFIG_BT_CENTRAL */ int bt_conn_le_conn_update(struct bt_conn *conn, From 90dab1e2a2f5612ba4177c13dd1fa4a5991d5acc Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Thu, 2 Oct 2025 13:53:53 +0200 Subject: [PATCH 2107/2141] [nrf fromtree] doc: releases: Add note for bt_le_set_auto_conn Add note for removed function bt_le_set_auto_conn. Signed-off-by: Emil Gydesen (cherry picked from commit b3ef646160a207316591be87bde7dbf303fb3fee) Signed-off-by: Pavel Vasilyev --- doc/releases/release-notes-4.3.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/releases/release-notes-4.3.rst b/doc/releases/release-notes-4.3.rst index 718e4ad3ba33..dc5393b418dd 100644 --- a/doc/releases/release-notes-4.3.rst +++ b/doc/releases/release-notes-4.3.rst @@ -61,6 +61,7 @@ Removed APIs and options * The TinyCrypt library was removed as the upstream version is no longer maintained. PSA Crypto API is now the recommended cryptographic library for Zephyr. * The legacy pipe object API was removed. Use the new pipe API instead. +* ``bt_le_set_auto_conn`` Deprecated APIs and options =========================== From 6a1186acf336ed9c943c8619bb1f9f93fbfec6d9 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Thu, 2 Oct 2025 13:13:04 +0200 Subject: [PATCH 2108/2141] [nrf fromtree] Bluetooth: Remove CONFIG_BT_BUF_ACL_RX_COUNT Remove the deprecated CONFIG_BT_BUF_ACL_RX_COUNT config as it has been deprecated since 4.1 Signed-off-by: Emil Gydesen (cherry picked from commit 6c870b071ab803728f4f48ba898de19b263b33e0) Signed-off-by: Pavel Vasilyev --- include/zephyr/bluetooth/buf.h | 23 ++++++++--------------- subsys/bluetooth/common/Kconfig | 21 --------------------- 2 files changed, 8 insertions(+), 36 deletions(-) diff --git a/include/zephyr/bluetooth/buf.h b/include/zephyr/bluetooth/buf.h index a4b59dcbaa92..534c75559183 100644 --- a/include/zephyr/bluetooth/buf.h +++ b/include/zephyr/bluetooth/buf.h @@ -144,27 +144,20 @@ static inline enum bt_buf_type bt_buf_type_from_h4(uint8_t h4_type, enum bt_buf_ #define BT_BUF_ACL_RX_COUNT_MAX 65535 #if defined(CONFIG_BT_CONN) && defined(CONFIG_BT_HCI_HOST) - /* The host needs more ACL buffers than maximum ACL links. This is because of - * the way we re-assemble ACL packets into L2CAP PDUs. - * - * We keep around the first buffer (that comes from the driver) to do - * re-assembly into, and if all links are re-assembling, there will be no buffer - * available for the HCI driver to allocate from. - * - * TODO: When CONFIG_BT_BUF_ACL_RX_COUNT is removed, - * remove the MAX and only keep the 1. - */ +/* The host needs more ACL buffers than maximum ACL links. This is because of + * the way we re-assemble ACL packets into L2CAP PDUs. + * + * We keep around the first buffer (that comes from the driver) to do + * re-assembly into, and if all links are re-assembling, there will be no buffer + * available for the HCI driver to allocate from. + */ #define BT_BUF_ACL_RX_COUNT_EXTRA CONFIG_BT_BUF_ACL_RX_COUNT_EXTRA -#define BT_BUF_ACL_RX_COUNT (MAX(CONFIG_BT_BUF_ACL_RX_COUNT, 1) + BT_BUF_ACL_RX_COUNT_EXTRA) +#define BT_BUF_ACL_RX_COUNT (1 + BT_BUF_ACL_RX_COUNT_EXTRA) #else #define BT_BUF_ACL_RX_COUNT_EXTRA 0 #define BT_BUF_ACL_RX_COUNT 0 #endif /* CONFIG_BT_CONN && CONFIG_BT_HCI_HOST */ -#if defined(CONFIG_BT_BUF_ACL_RX_COUNT) && CONFIG_BT_BUF_ACL_RX_COUNT > 0 -#warning "CONFIG_BT_BUF_ACL_RX_COUNT is deprecated, see Zephyr 4.1 migration guide" -#endif /* CONFIG_BT_BUF_ACL_RX_COUNT && CONFIG_BT_BUF_ACL_RX_COUNT > 0 */ - BUILD_ASSERT(BT_BUF_ACL_RX_COUNT <= BT_BUF_ACL_RX_COUNT_MAX, "Maximum number of ACL RX buffer is 65535, reduce CONFIG_BT_BUF_ACL_RX_COUNT_EXTRA"); diff --git a/subsys/bluetooth/common/Kconfig b/subsys/bluetooth/common/Kconfig index ae95785f8ab3..9ba9cb325855 100644 --- a/subsys/bluetooth/common/Kconfig +++ b/subsys/bluetooth/common/Kconfig @@ -102,27 +102,6 @@ config BT_BUF_ACL_RX_COUNT_EXTRA connection and uses one Rx buffer across all connections to receive a fragment from the Controller. -config BT_BUF_ACL_RX_COUNT - int "[DEPRECATED] Number of incoming ACL data buffers" - default 0 - range 0 256 - help - Number or incoming ACL data buffers sent from the Controller to the - Host. - In a combined Host and Controller build the buffers are shared and - therefore Controller to Host flow control is not needed. - - In a Host only build with Controller to Host flow control enabled - the Host will inform the Controller about the maximum number of - buffers by setting this value in the Host Buffer Size command. - - When Controller to Host flow control is not enabled the Controller - can assume that the Host has infinite amount of buffers. - - For both configurations, there is an additional requirement that is - enforced by a build-time check: BT_BUF_ACL_RX_COUNT needs to be at - least one greater than BT_MAX_CONN. - config BT_BUF_EVT_RX_SIZE int "Maximum supported HCI Event buffer length" default $(UINT8_MAX) if (BT_EXT_ADV && BT_OBSERVER) || BT_PER_ADV_SYNC || BT_DF_CONNECTION_CTE_RX || BT_CLASSIC || BT_CHANNEL_SOUNDING || BT_LE_EXTENDED_FEAT_SET From 8d040c15c820754407b3c8b6c7bb9b54ddef857b Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Thu, 2 Oct 2025 13:50:29 +0200 Subject: [PATCH 2109/2141] [nrf fromtree] doc: releases: Add note about CONFIG_BT_BUF_ACL_RX_COUNT The deprecated Kconfig option has been removed. Signed-off-by: Emil Gydesen (cherry picked from commit 0a7d6bc1687c2ed1fa9333d36ae4349910f44a82) Signed-off-by: Pavel Vasilyev --- doc/releases/release-notes-4.3.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/releases/release-notes-4.3.rst b/doc/releases/release-notes-4.3.rst index dc5393b418dd..3e9b87db998e 100644 --- a/doc/releases/release-notes-4.3.rst +++ b/doc/releases/release-notes-4.3.rst @@ -62,6 +62,7 @@ Removed APIs and options PSA Crypto API is now the recommended cryptographic library for Zephyr. * The legacy pipe object API was removed. Use the new pipe API instead. * ``bt_le_set_auto_conn`` +* ``CONFIG_BT_BUF_ACL_RX_COUNT`` Deprecated APIs and options =========================== From 47bf503a652239b41c329b2e3033758d72c40443 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Wed, 8 Oct 2025 11:07:26 +0200 Subject: [PATCH 2110/2141] [nrf fromtree] Bluetooth: Host: Change WRN->DBG for not connect for TX The bt_conn_tx_processor logged connections not in the connected state as LOG_WRN, but this is a case that is handled and could occur during regular behavior. For this reason the log statement was changed to LOG_DBG, as the developer/user does not need to worry about it. Also modifies the statement to log the conn->state for debugging purposes. Signed-off-by: Emil Gydesen (cherry picked from commit d4afa1989fda9c6919f97ecbbbe17a5c0a390032) Signed-off-by: Pavel Vasilyev --- subsys/bluetooth/host/conn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/bluetooth/host/conn.c b/subsys/bluetooth/host/conn.c index 766f61788457..8af6703838d6 100644 --- a/subsys/bluetooth/host/conn.c +++ b/subsys/bluetooth/host/conn.c @@ -1068,7 +1068,7 @@ void bt_conn_tx_processor(void) LOG_DBG("processing conn %p", conn); if (conn->state != BT_CONN_CONNECTED) { - LOG_WRN("conn %p: not connected", conn); + LOG_DBG("conn %p: not connected: state %d", conn, conn->state); goto raise_and_exit; } From 6c567330e3dff77b67526924b088ec30a8945d2c Mon Sep 17 00:00:00 2001 From: Christophe Dufaza Date: Thu, 25 Sep 2025 21:39:56 +0200 Subject: [PATCH 2111/2141] [nrf fromtree] bluetooth: host: remove API for automatic advertising resumption Automatic advertising resumption is source of errors [1], and deprecated since Zephyr 4.0 [2]. Samples and tests no longer cover this feature. Deprecated public symbols include: - advertising options BT_LE_ADV_OPT_CONNECTABLE and BT_LE_ADV_OPT_ONE_TIME - advertising parameters BT_LE_ADV_CONN and BT_LE_ADV_CONN_ONE_TIME Withdrawing this API (options and parameters) makes the code paths to automatic advertiser resumption unreachable. [1] Bluetooth: Advertising resume functionality is broken #72567 [2] Bluetooth: Deprecate adv auto-resume #73395 Signed-off-by: Christophe Dufaza (cherry picked from commit 4850c0c52d94629d28a65b8b69045b75b33f1a71) Signed-off-by: Pavel Vasilyev --- include/zephyr/bluetooth/bluetooth.h | 61 +--------------------------- 1 file changed, 2 insertions(+), 59 deletions(-) diff --git a/include/zephyr/bluetooth/bluetooth.h b/include/zephyr/bluetooth/bluetooth.h index f22643f98035..09fad560674f 100644 --- a/include/zephyr/bluetooth/bluetooth.h +++ b/include/zephyr/bluetooth/bluetooth.h @@ -691,28 +691,6 @@ enum bt_le_adv_opt { /** Convenience value when no options are specified. */ BT_LE_ADV_OPT_NONE = 0, - /** - * @brief Advertise as connectable. - * - * @deprecated Use @ref BT_LE_ADV_OPT_CONN instead. - * - * Advertise as connectable. If not connectable then the type of - * advertising is determined by providing scan response data. - * The advertiser address is determined by the type of advertising - * and/or enabling privacy @kconfig{CONFIG_BT_PRIVACY}. - * - * Starting connectable advertising preallocates a connection - * object. If this fails, the API returns @c -ENOMEM. - * - * When an advertiser set results in a connection creation, the - * controller automatically disables that advertising set. - * - * If the advertising set was started with @ref bt_le_adv_start - * without @ref BT_LE_ADV_OPT_ONE_TIME, the host will attempt to - * resume the advertiser under some conditions. - */ - BT_LE_ADV_OPT_CONNECTABLE __deprecated = BIT(0), - /** * @internal * @@ -725,24 +703,6 @@ enum bt_le_adv_opt { */ _BT_LE_ADV_OPT_CONNECTABLE = BIT(0), - /** - * @brief Advertise one time. - * - * @deprecated Use @ref BT_LE_ADV_OPT_CONN instead. - * - * Don't try to resume connectable advertising after a connection. - * This option is only meaningful when used together with - * BT_LE_ADV_OPT_CONNECTABLE. If set the advertising will be stopped - * when @ref bt_le_adv_stop is called or when an incoming (peripheral) - * connection happens. If this option is not set the stack will - * take care of keeping advertising enabled even as connections - * occur. - * If Advertising directed or the advertiser was started with - * @ref bt_le_ext_adv_start then this behavior is the default behavior - * and this flag has no effect. - */ - BT_LE_ADV_OPT_ONE_TIME __deprecated = BIT(1), - /** * @internal * @@ -1165,17 +1125,6 @@ struct bt_le_per_adv_param { #define BT_LE_ADV_CONN_DIR(_peer) BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONN, 0, 0, _peer) -/** - * @deprecated This is a convenience macro for @ref - * BT_LE_ADV_OPT_CONNECTABLE, which is deprecated. Please use - * @ref BT_LE_ADV_CONN_FAST_1 or @ref BT_LE_ADV_CONN_FAST_2 - * instead. - */ -#define BT_LE_ADV_CONN \ - BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE, BT_GAP_ADV_FAST_INT_MIN_2, \ - BT_GAP_ADV_FAST_INT_MAX_2, NULL) \ - __DEPRECATED_MACRO - /** * @brief GAP recommended connectable advertising parameters user-initiated * @@ -1220,10 +1169,6 @@ struct bt_le_per_adv_param { * - Limited Discoverable Mode * - General Discoverable Mode * - * The advertising interval corresponds to what was offered as @ref BT_LE_ADV_CONN in Zephyr 3.6 and - * earlier, but unlike @ref BT_LE_ADV_CONN, the host does not automatically resume the advertiser - * after it results in a connection. - * * See Bluetooth Core Specification: * - 6.0 Vol 3, Part C, Appendix A "Timers and Constants", T_GAP(adv_fast_interval2) * - 6.0 Vol 3, Part C, Section 9.3.11 "Connection Establishment Timing parameters" @@ -1232,8 +1177,6 @@ struct bt_le_per_adv_param { BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONN, BT_GAP_ADV_FAST_INT_MIN_2, BT_GAP_ADV_FAST_INT_MAX_2, \ NULL) -#define BT_LE_ADV_CONN_ONE_TIME BT_LE_ADV_CONN_FAST_2 __DEPRECATED_MACRO - #define BT_LE_ADV_CONN_DIR_LOW_DUTY(_peer) \ BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONN | BT_LE_ADV_OPT_DIR_MODE_LOW_DUTY, \ BT_GAP_ADV_FAST_INT_MIN_2, BT_GAP_ADV_FAST_INT_MAX_2, _peer) @@ -1679,7 +1622,7 @@ typedef void bt_le_scan_cb_t(const bt_addr_le_t *addr, int8_t rssi, * The periodic advertising parameters can only be set or updated on an * extended advertisement set which is neither scannable, connectable nor * anonymous (meaning, the advertising options @ref BT_LE_ADV_OPT_SCANNABLE, - * @ref BT_LE_ADV_OPT_CONNECTABLE and @ref BT_LE_ADV_OPT_ANONYMOUS cannot be set for @p adv). + * @ref BT_LE_ADV_OPT_CONN and @ref BT_LE_ADV_OPT_ANONYMOUS cannot be set for @p adv). * * @param adv Advertising set object. * @param param Advertising parameters. @@ -1695,7 +1638,7 @@ int bt_le_per_adv_set_param(struct bt_le_ext_adv *adv, * The periodic advertisement data can only be set or updated on an * extended advertisement set which is neither scannable, connectable nor * anonymous (meaning, the advertising options @ref BT_LE_ADV_OPT_SCANNABLE, - * @ref BT_LE_ADV_OPT_CONNECTABLE and @ref BT_LE_ADV_OPT_ANONYMOUS cannot be set for @p adv). + * @ref BT_LE_ADV_OPT_CONN and @ref BT_LE_ADV_OPT_ANONYMOUS cannot be set for @p adv). * * @param adv Advertising set object. * @param ad Advertising data. From b9f8151ee2e2532f25f2f66e9e5aac04a85edf59 Mon Sep 17 00:00:00 2001 From: Christophe Dufaza Date: Thu, 25 Sep 2025 23:46:41 +0200 Subject: [PATCH 2112/2141] [nrf fromtree] bluetooth: host: remove transitional option _BT_LE_ADV_OPT_CONNECTABLE Automatic advertiser resumption is deprecated since Zephyr 4.0 [1]. To maintain the behavior during the deprecation period, internal transitional symbols were introduced to replace the deprecated ones in the implementation: - _BT_LE_ADV_OPT_CONNECTABLE: same option bit as BT_LE_ADV_OPT_CONNECTABLE (deprecated) - _BT_LE_ADV_CONN_ONE_TIME: same option bit as BT_LE_ADV_CONN_ONE_TIME (deprecated) The only option for connectable advertising is now BT_LE_ADV_OPT_CONN, whose value is _BT_LE_ADV_OPT_CONNECTABLE|_BT_LE_ADV_OPT_ONE_TIME. We can substitute BT_LE_ADV_OPT_CONN for _BT_LE_ADV_OPT_CONNECTABLE when testing if an advertising set is connectable. Note: to fix a ClangFormat warning raised by check_compliance.py, this commit also includes a formatting change next to the lines actually edited (subsys/bluetooth/host/id.c:810). [1] Bluetooth: Deprecate adv auto-resume #73395 Signed-off-by: Christophe Dufaza (cherry picked from commit e24d3b92a3a2b016d932d075fad0b2d9e1922f22) Signed-off-by: Pavel Vasilyev --- include/zephyr/bluetooth/bluetooth.h | 12 ------------ subsys/bluetooth/host/adv.c | 29 ++++++++++++---------------- subsys/bluetooth/host/id.c | 9 ++++----- 3 files changed, 16 insertions(+), 34 deletions(-) diff --git a/include/zephyr/bluetooth/bluetooth.h b/include/zephyr/bluetooth/bluetooth.h index 09fad560674f..eb4461128efa 100644 --- a/include/zephyr/bluetooth/bluetooth.h +++ b/include/zephyr/bluetooth/bluetooth.h @@ -691,18 +691,6 @@ enum bt_le_adv_opt { /** Convenience value when no options are specified. */ BT_LE_ADV_OPT_NONE = 0, - /** - * @internal - * - * Internal access to the deprecated value to maintain the - * implementation of the deprecated feature. - * - * At the end of the deprecation period, ABI will change so - * `BT_LE_ADV_OPT_CONN` is just `BIT(0)`, removing the need for this - * symbol. - */ - _BT_LE_ADV_OPT_CONNECTABLE = BIT(0), - /** * @internal * diff --git a/subsys/bluetooth/host/adv.c b/subsys/bluetooth/host/adv.c index ab86e8b8858f..16c825862310 100644 --- a/subsys/bluetooth/host/adv.c +++ b/subsys/bluetooth/host/adv.c @@ -387,9 +387,8 @@ static bool valid_adv_ext_param(const struct bt_le_adv_param *param) { if (IS_ENABLED(CONFIG_BT_EXT_ADV) && BT_DEV_FEAT_LE_EXT_ADV(bt_dev.le.features)) { - if (param->peer && - !(param->options & BT_LE_ADV_OPT_EXT_ADV) && - !(param->options & _BT_LE_ADV_OPT_CONNECTABLE)) { + if (param->peer && !(param->options & BT_LE_ADV_OPT_EXT_ADV) && + !(param->options & BT_LE_ADV_OPT_CONN)) { /* Cannot do directed non-connectable advertising * without extended advertising. */ @@ -429,7 +428,7 @@ static bool valid_adv_ext_param(const struct bt_le_adv_param *param) return false; } - if (!(param->options & _BT_LE_ADV_OPT_CONNECTABLE)) { + if (!(param->options & BT_LE_ADV_OPT_CONN)) { /* * BT Core 4.2 [Vol 2, Part E, 7.8.5] * The Advertising_Interval_Min and Advertising_Interval_Max @@ -472,7 +471,7 @@ static bool valid_adv_param(const struct bt_le_adv_param *param) return false; } - if (param->peer && !(param->options & _BT_LE_ADV_OPT_CONNECTABLE)) { + if (param->peer && !(param->options & BT_LE_ADV_OPT_CONN)) { return false; } @@ -967,7 +966,7 @@ static int adv_start_legacy(struct bt_le_ext_adv *adv, bt_addr_le_copy(&adv->target_addr, BT_ADDR_LE_ANY); } - if (param->options & _BT_LE_ADV_OPT_CONNECTABLE) { + if (param->options & BT_LE_ADV_OPT_CONN) { if (dir_adv) { if (param->options & BT_LE_ADV_OPT_DIR_MODE_LOW_DUTY) { set_param.type = BT_HCI_ADV_DIRECT_IND_LOW_DUTY; @@ -1006,8 +1005,7 @@ static int adv_start_legacy(struct bt_le_ext_adv *adv, } } - if (IS_ENABLED(CONFIG_BT_PERIPHERAL) && - (param->options & _BT_LE_ADV_OPT_CONNECTABLE)) { + if (IS_ENABLED(CONFIG_BT_PERIPHERAL) && (param->options & BT_LE_ADV_OPT_CONN)) { err = le_adv_start_add_conn(adv, &conn); if (err) { if (err == -ENOMEM && !dir_adv && @@ -1043,8 +1041,7 @@ static int adv_start_legacy(struct bt_le_ext_adv *adv, atomic_set_bit_to(adv->flags, BT_ADV_PERSIST, !dir_adv && !(param->options & _BT_LE_ADV_OPT_ONE_TIME)); - atomic_set_bit_to(adv->flags, BT_ADV_CONNECTABLE, - param->options & _BT_LE_ADV_OPT_CONNECTABLE); + atomic_set_bit_to(adv->flags, BT_ADV_CONNECTABLE, param->options & BT_LE_ADV_OPT_CONN); atomic_set_bit_to(adv->flags, BT_ADV_SCANNABLE, scannable); @@ -1152,7 +1149,7 @@ static int le_ext_adv_param_set(struct bt_le_ext_adv *adv, cp->scan_req_notify_enable = BT_HCI_LE_ADV_SCAN_REQ_ENABLE; } - if (param->options & _BT_LE_ADV_OPT_CONNECTABLE) { + if (param->options & BT_LE_ADV_OPT_CONN) { props |= BT_HCI_LE_ADV_PROP_CONN; if (!dir_adv && !(param->options & BT_LE_ADV_OPT_EXT_ADV)) { /* When using non-extended adv packets then undirected @@ -1210,8 +1207,7 @@ static int le_ext_adv_param_set(struct bt_le_ext_adv *adv, /* Flag only used by bt_le_adv_start API. */ atomic_set_bit_to(adv->flags, BT_ADV_PERSIST, false); - atomic_set_bit_to(adv->flags, BT_ADV_CONNECTABLE, - param->options & _BT_LE_ADV_OPT_CONNECTABLE); + atomic_set_bit_to(adv->flags, BT_ADV_CONNECTABLE, param->options & BT_LE_ADV_OPT_CONN); atomic_set_bit_to(adv->flags, BT_ADV_SCANNABLE, scannable); @@ -1279,8 +1275,7 @@ int bt_le_adv_start_ext(struct bt_le_ext_adv *adv, } } - if (IS_ENABLED(CONFIG_BT_PERIPHERAL) && - (param->options & _BT_LE_ADV_OPT_CONNECTABLE)) { + if (IS_ENABLED(CONFIG_BT_PERIPHERAL) && (param->options & BT_LE_ADV_OPT_CONN)) { err = le_adv_start_add_conn(adv, &conn); if (err) { if (err == -ENOMEM && !dir_adv && @@ -1434,7 +1429,7 @@ static uint32_t adv_get_options(const struct bt_le_ext_adv *adv) } if (atomic_test_bit(adv->flags, BT_ADV_CONNECTABLE)) { - options |= _BT_LE_ADV_OPT_CONNECTABLE; + options |= BT_LE_ADV_OPT_CONN; } if (atomic_test_bit(adv->flags, BT_ADV_USE_IDENTITY)) { @@ -1614,7 +1609,7 @@ int bt_le_ext_adv_update_param(struct bt_le_ext_adv *adv, /* If params for per adv has been set, do not allow setting * connectable, scanable or use legacy adv */ - if (param->options & _BT_LE_ADV_OPT_CONNECTABLE || + if (param->options & BT_LE_ADV_OPT_CONN || param->options & BT_LE_ADV_OPT_SCANNABLE || !(param->options & BT_LE_ADV_OPT_EXT_ADV) || param->options & BT_LE_ADV_OPT_ANONYMOUS) { diff --git a/subsys/bluetooth/host/id.c b/subsys/bluetooth/host/id.c index 775f08182b74..4c54460ab4df 100644 --- a/subsys/bluetooth/host/id.c +++ b/subsys/bluetooth/host/id.c @@ -803,12 +803,11 @@ bool bt_id_adv_random_addr_check(const struct bt_le_adv_param *param) * Explicitly stop it here. */ - if (!(param->options & _BT_LE_ADV_OPT_CONNECTABLE) && - (param->options & BT_LE_ADV_OPT_USE_IDENTITY)) { + if (!(param->options & BT_LE_ADV_OPT_CONN) && + (param->options & BT_LE_ADV_OPT_USE_IDENTITY)) { /* Attempt to set non-connectable NRPA */ return false; - } else if (bt_dev.id_addr[param->id].type == - BT_ADDR_LE_RANDOM && + } else if (bt_dev.id_addr[param->id].type == BT_ADDR_LE_RANDOM && param->id != BT_ID_DEFAULT) { /* Attempt to set connectable, or non-connectable with * identity different than scanner. @@ -2121,7 +2120,7 @@ int bt_id_set_adv_own_addr(struct bt_le_ext_adv *adv, uint32_t options, return 0; } - if (options & _BT_LE_ADV_OPT_CONNECTABLE) { + if (options & BT_LE_ADV_OPT_CONN) { if (dir_adv && (options & BT_LE_ADV_OPT_DIR_ADDR_RPA) && !BT_FEAT_LE_PRIVACY(bt_dev.le.features)) { return -ENOTSUP; From e09076ff80fa7345539b57503e98281a35b6edd5 Mon Sep 17 00:00:00 2001 From: Christophe Dufaza Date: Fri, 26 Sep 2025 00:37:16 +0200 Subject: [PATCH 2113/2141] [nrf fromtree] bluetooth: host: remove transitional option _BT_LE_ADV_OPT_ONE_TIME Automatic advertiser resumption is deprecated since Zephyr 4.0 [1]. To maintain the behavior during the deprecation period, internal transitional symbols were introduced to replace the deprecated ones in the implementation: - _BT_LE_ADV_OPT_CONNECTABLE: same option bit as BT_LE_ADV_OPT_CONNECTABLE (deprecated) - _BT_LE_ADV_CONN_ONE_TIME: same option bit as BT_LE_ADV_CONN_ONE_TIME (deprecated) The only option for connectable advertising is now BT_LE_ADV_OPT_CONN, whose value is _BT_LE_ADV_OPT_CONNECTABLE|_BT_LE_ADV_OPT_ONE_TIME. We can assume _BT_LE_ADV_CONN_ONE_TIME is true for connectable advertisers, and meaningless for non-connectable advertisers. [1] Bluetooth: Deprecate adv auto-resume #73395 Signed-off-by: Christophe Dufaza (cherry picked from commit 5762ff5b5860f279d7f6f1a79301d48f824bdb7c) Signed-off-by: Pavel Vasilyev --- include/zephyr/bluetooth/bluetooth.h | 8 -------- subsys/bluetooth/host/adv.c | 22 ++-------------------- 2 files changed, 2 insertions(+), 28 deletions(-) diff --git a/include/zephyr/bluetooth/bluetooth.h b/include/zephyr/bluetooth/bluetooth.h index eb4461128efa..0739733c9543 100644 --- a/include/zephyr/bluetooth/bluetooth.h +++ b/include/zephyr/bluetooth/bluetooth.h @@ -691,14 +691,6 @@ enum bt_le_adv_opt { /** Convenience value when no options are specified. */ BT_LE_ADV_OPT_NONE = 0, - /** - * @internal - * - * Internal access to the deprecated value to maintain - * the implementation of the deprecated feature. - */ - _BT_LE_ADV_OPT_ONE_TIME = BIT(1), - /** * @brief Connectable advertising * diff --git a/subsys/bluetooth/host/adv.c b/subsys/bluetooth/host/adv.c index 16c825862310..a5b8d064041b 100644 --- a/subsys/bluetooth/host/adv.c +++ b/subsys/bluetooth/host/adv.c @@ -1008,11 +1008,6 @@ static int adv_start_legacy(struct bt_le_ext_adv *adv, if (IS_ENABLED(CONFIG_BT_PERIPHERAL) && (param->options & BT_LE_ADV_OPT_CONN)) { err = le_adv_start_add_conn(adv, &conn); if (err) { - if (err == -ENOMEM && !dir_adv && - !(param->options & _BT_LE_ADV_OPT_ONE_TIME)) { - goto set_adv_state; - } - return err; } } @@ -1037,9 +1032,7 @@ static int adv_start_legacy(struct bt_le_ext_adv *adv, bt_conn_unref(conn); } -set_adv_state: - atomic_set_bit_to(adv->flags, BT_ADV_PERSIST, !dir_adv && - !(param->options & _BT_LE_ADV_OPT_ONE_TIME)); + atomic_set_bit_to(adv->flags, BT_ADV_PERSIST, false); atomic_set_bit_to(adv->flags, BT_ADV_CONNECTABLE, param->options & BT_LE_ADV_OPT_CONN); @@ -1278,11 +1271,6 @@ int bt_le_adv_start_ext(struct bt_le_ext_adv *adv, if (IS_ENABLED(CONFIG_BT_PERIPHERAL) && (param->options & BT_LE_ADV_OPT_CONN)) { err = le_adv_start_add_conn(adv, &conn); if (err) { - if (err == -ENOMEM && !dir_adv && - !(param->options & _BT_LE_ADV_OPT_ONE_TIME)) { - goto set_adv_state; - } - return err; } } @@ -1307,10 +1295,8 @@ int bt_le_adv_start_ext(struct bt_le_ext_adv *adv, bt_conn_unref(conn); } -set_adv_state: /* Flag always set to false by le_ext_adv_param_set */ - atomic_set_bit_to(adv->flags, BT_ADV_PERSIST, !dir_adv && - !(param->options & _BT_LE_ADV_OPT_ONE_TIME)); + atomic_set_bit_to(adv->flags, BT_ADV_PERSIST, false); return 0; } @@ -1424,10 +1410,6 @@ static uint32_t adv_get_options(const struct bt_le_ext_adv *adv) { uint32_t options = 0; - if (!atomic_test_bit(adv->flags, BT_ADV_PERSIST)) { - options |= _BT_LE_ADV_OPT_ONE_TIME; - } - if (atomic_test_bit(adv->flags, BT_ADV_CONNECTABLE)) { options |= BT_LE_ADV_OPT_CONN; } From 33be8ee86ea59a03d1c4ba74345e10da2ffff947 Mon Sep 17 00:00:00 2001 From: Christophe Dufaza Date: Sun, 28 Sep 2025 20:59:23 +0200 Subject: [PATCH 2114/2141] [nrf fromtree] bluetooth: host: do not use freed connection to resume advertising In bt_conn_unref(), if we remove the last reference to the connection, we notify listeners that a connection object has been freed and can be taken, then immediately reuse this freed slot to resume advertising. This behavior is source of errors, and automatic advertiser resumption is publicly deprecated since Zephyr 4.0 [1]. Options and parameters for this behavior have been removed. [1] Bluetooth: Deprecate adv auto-resume #73395 Signed-off-by: Christophe Dufaza (cherry picked from commit b3a4ff01098d63123b71ea82ac959da77e069219) Signed-off-by: Pavel Vasilyev --- subsys/bluetooth/host/conn.c | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/subsys/bluetooth/host/conn.c b/subsys/bluetooth/host/conn.c index 8af6703838d6..c91df6862928 100644 --- a/subsys/bluetooth/host/conn.c +++ b/subsys/bluetooth/host/conn.c @@ -1514,8 +1514,6 @@ void bt_conn_unref(struct bt_conn *conn) { atomic_val_t old; bool deallocated; - enum bt_conn_type conn_type; - uint8_t conn_role; uint16_t conn_handle; /* Used only if CONFIG_ASSERT and CONFIG_BT_CONN_TX. */ __maybe_unused bool conn_tx_is_pending; @@ -1529,8 +1527,6 @@ void bt_conn_unref(struct bt_conn *conn) * we store its properties of interest before decrementing the ref-count, * then unset the local pointer. */ - conn_type = conn->type; - conn_role = conn->role; conn_handle = conn->handle; #if CONFIG_BT_CONN_TX && CONFIG_ASSERT conn_tx_is_pending = k_work_is_pending(&conn->tx_complete_work); @@ -1558,18 +1554,6 @@ void bt_conn_unref(struct bt_conn *conn) */ k_sem_give(&pending_recycled_events); k_work_submit(&recycled_work); - - /* Use the freed slot to automatically resume LE peripheral advertising. - * - * This behavior is deprecated: - * - 8cfad44: Bluetooth: Deprecate adv auto-resume - * - #72567: Bluetooth: Advertising resume functionality is broken - * - Migration guide to Zephyr v4.0.0, Automatic advertiser resumption is deprecated - */ - if (IS_ENABLED(CONFIG_BT_PERIPHERAL) && conn_type == BT_CONN_TYPE_LE && - conn_role == BT_CONN_ROLE_PERIPHERAL) { - bt_le_adv_resume(); - } } uint8_t bt_conn_index(const struct bt_conn *conn) From a00b9d52e1170374b5847872a36dfd65ed6059c0 Mon Sep 17 00:00:00 2001 From: Christophe Dufaza Date: Sun, 28 Sep 2025 21:43:45 +0200 Subject: [PATCH 2115/2141] [nrf fromtree] bluetooth: host: do not resume periodic connectable advertisers Automatic advertiser resumption is publicly deprecated since Zephyr 4.0 [1]. Options and parameters for this behavior have been removed. [1] Bluetooth: Deprecate adv auto-resume #73395 Signed-off-by: Christophe Dufaza (cherry picked from commit 731e581174b509cccce16ba62668694be5f174ac) Signed-off-by: Pavel Vasilyev --- subsys/bluetooth/host/hci_core.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/subsys/bluetooth/host/hci_core.c b/subsys/bluetooth/host/hci_core.c index 33306596b2ce..2ba274cd2275 100644 --- a/subsys/bluetooth/host/hci_core.c +++ b/subsys/bluetooth/host/hci_core.c @@ -1497,15 +1497,6 @@ void bt_hci_le_enh_conn_complete(struct bt_hci_evt_le_enh_conn_complete *evt) bt_addr_copy(&conn->le.resp_addr.a, &evt->local_rpa); } - /* if the controller supports, lets advertise for another - * peripheral connection. - * check for connectable advertising state is sufficient as - * this is how this le connection complete for peripheral occurred. - */ - if (BT_LE_STATES_PER_CONN_ADV(bt_dev.le.states)) { - bt_le_adv_resume(); - } - if (IS_ENABLED(CONFIG_BT_EXT_ADV) && !BT_DEV_FEAT_LE_EXT_ADV(bt_dev.le.features)) { struct bt_le_ext_adv *adv = bt_le_adv_lookup_legacy(); From e830c97b5338d321472f9cc3c7f862291f63cb09 Mon Sep 17 00:00:00 2001 From: Christophe Dufaza Date: Sun, 28 Sep 2025 22:57:21 +0200 Subject: [PATCH 2116/2141] [nrf fromtree] bluetooth: host: do not attempt to resume terminated advertising sets Automatic advertiser resumption is publicly deprecated since Zephyr 4.0 [1]. Options and parameters for this behavior have been removed. [1] Bluetooth: Deprecate adv auto-resume #73395 Signed-off-by: Christophe Dufaza (cherry picked from commit 9b5ad2f8df485a51e55789e949428fd8d679bec6) Signed-off-by: Pavel Vasilyev --- subsys/bluetooth/host/adv.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/subsys/bluetooth/host/adv.c b/subsys/bluetooth/host/adv.c index a5b8d064041b..73d2e3d055ae 100644 --- a/subsys/bluetooth/host/adv.c +++ b/subsys/bluetooth/host/adv.c @@ -2301,13 +2301,7 @@ void bt_hci_le_adv_set_terminated(struct net_buf *buf) } if (adv == bt_dev.adv) { - if (atomic_test_bit(adv->flags, BT_ADV_PERSIST)) { -#if defined(CONFIG_BT_PERIPHERAL) - bt_le_adv_resume(); -#endif - } else { - bt_le_adv_delete_legacy(); - } + bt_le_adv_delete_legacy(); } } From 90d5d684298d5e5e22f0ac7086d87885916be7db Mon Sep 17 00:00:00 2001 From: Christophe Dufaza Date: Sun, 28 Sep 2025 23:50:05 +0200 Subject: [PATCH 2117/2141] [nrf fromtree] bluetooth: host: remove no longer used internal API bt_le_adv_resume() Automatic advertiser resumption is publicly deprecated since Zephyr 4.0 [1]. Options and parameters for this behavior have been removed, as well as all calls to bt_le_adv_resume(). Also remove adv_get_options() whose bt_le_adv_resume() is the only caller. [1] Bluetooth: Deprecate adv auto-resume #73395 Signed-off-by: Christophe Dufaza (cherry picked from commit a1dd571f11df3d7c973a3a63ef44e715a6945deb) Signed-off-by: Pavel Vasilyev --- subsys/bluetooth/host/adv.c | 83 ------------------------------------- subsys/bluetooth/host/adv.h | 2 - 2 files changed, 85 deletions(-) diff --git a/subsys/bluetooth/host/adv.c b/subsys/bluetooth/host/adv.c index 73d2e3d055ae..55614115087f 100644 --- a/subsys/bluetooth/host/adv.c +++ b/subsys/bluetooth/host/adv.c @@ -1405,89 +1405,6 @@ int bt_le_adv_stop(void) return 0; } -#if defined(CONFIG_BT_PERIPHERAL) -static uint32_t adv_get_options(const struct bt_le_ext_adv *adv) -{ - uint32_t options = 0; - - if (atomic_test_bit(adv->flags, BT_ADV_CONNECTABLE)) { - options |= BT_LE_ADV_OPT_CONN; - } - - if (atomic_test_bit(adv->flags, BT_ADV_USE_IDENTITY)) { - options |= BT_LE_ADV_OPT_USE_IDENTITY; - } - - return options; -} - -void bt_le_adv_resume(void) -{ - struct bt_le_ext_adv *adv = bt_le_adv_lookup_legacy(); - struct bt_conn *conn; - bool persist_paused = false; - int err; - - if (!adv) { - LOG_DBG("No valid legacy adv to resume"); - return; - } - - if (!(atomic_test_bit(adv->flags, BT_ADV_PERSIST) && - !atomic_test_bit(adv->flags, BT_ADV_ENABLED))) { - return; - } - - if (!atomic_test_bit(adv->flags, BT_ADV_CONNECTABLE)) { - return; - } - - err = le_adv_start_add_conn(adv, &conn); - if (err) { - LOG_ERR("Host cannot resume connectable advertising (%d)", err); - return; - } - - LOG_DBG("Resuming connectable advertising"); - - if (IS_ENABLED(CONFIG_BT_PRIVACY) && - !atomic_test_bit(adv->flags, BT_ADV_USE_IDENTITY)) { - bt_id_set_adv_private_addr(adv); - } else { - uint8_t own_addr_type; - bool dir_adv = adv_is_directed(adv); - uint32_t options = adv_get_options(adv); - - /* Always set the address. Don't assume it has not changed. */ - err = bt_id_set_adv_own_addr(adv, options, dir_adv, &own_addr_type); - if (err) { - LOG_ERR("Controller cannot resume connectable advertising (%d)", err); - return; - } - } - - err = bt_le_adv_set_enable(adv, true); - if (err) { - LOG_ERR("Controller cannot resume connectable advertising (%d)", err); - bt_conn_set_state(conn, BT_CONN_DISCONNECTED); - - /* Temporarily clear persist flag to avoid recursion in - * bt_conn_unref if the flag is still set. - */ - persist_paused = atomic_test_and_clear_bit(adv->flags, - BT_ADV_PERSIST); - } - - /* Since we don't give the application a reference to manage in - * this case, we need to release this reference here. - */ - bt_conn_unref(conn); - if (persist_paused) { - atomic_set_bit(adv->flags, BT_ADV_PERSIST); - } -} -#endif /* defined(CONFIG_BT_PERIPHERAL) */ - #if defined(CONFIG_BT_EXT_ADV) int bt_le_ext_adv_get_info(const struct bt_le_ext_adv *adv, struct bt_le_ext_adv_info *info) diff --git a/subsys/bluetooth/host/adv.h b/subsys/bluetooth/host/adv.h index 1bd15854db28..a6f7007f64b4 100644 --- a/subsys/bluetooth/host/adv.h +++ b/subsys/bluetooth/host/adv.h @@ -9,8 +9,6 @@ #include -void bt_le_adv_resume(void); - struct bt_le_ext_adv *bt_le_adv_lookup_legacy(void); void bt_le_adv_delete_legacy(void); From db9c481cb7a0d46b6601f1fb399ce9c87ff75d41 Mon Sep 17 00:00:00 2001 From: Christophe Dufaza Date: Mon, 29 Sep 2025 00:18:35 +0200 Subject: [PATCH 2118/2141] [nrf fromtree] bluetooth: host: remove useless internal flag BT_ADV_PERSIST Automatic advertiser resumption is publicly deprecated since Zephyr 4.0 [1]. Options and parameters for this behavior have been removed, and the internal bit flag BT_ADV_PERSIST is now always false. The behavior it used to configure (to keep advertising after a connection has been established as long as there are connections available) has also been removed. [1] Bluetooth: Deprecate adv auto-resume #73395 Signed-off-by: Christophe Dufaza (cherry picked from commit 60c3de272264a1f9ce03ad681de8a8b0b7d4a317) Signed-off-by: Pavel Vasilyev --- subsys/bluetooth/host/adv.c | 15 --------------- subsys/bluetooth/host/hci_core.c | 5 +---- subsys/bluetooth/host/hci_core.h | 4 ---- 3 files changed, 1 insertion(+), 23 deletions(-) diff --git a/subsys/bluetooth/host/adv.c b/subsys/bluetooth/host/adv.c index 55614115087f..9f41e1334792 100644 --- a/subsys/bluetooth/host/adv.c +++ b/subsys/bluetooth/host/adv.c @@ -1032,8 +1032,6 @@ static int adv_start_legacy(struct bt_le_ext_adv *adv, bt_conn_unref(conn); } - atomic_set_bit_to(adv->flags, BT_ADV_PERSIST, false); - atomic_set_bit_to(adv->flags, BT_ADV_CONNECTABLE, param->options & BT_LE_ADV_OPT_CONN); atomic_set_bit_to(adv->flags, BT_ADV_SCANNABLE, scannable); @@ -1197,9 +1195,6 @@ static int le_ext_adv_param_set(struct bt_le_ext_adv *adv, } } - /* Flag only used by bt_le_adv_start API. */ - atomic_set_bit_to(adv->flags, BT_ADV_PERSIST, false); - atomic_set_bit_to(adv->flags, BT_ADV_CONNECTABLE, param->options & BT_LE_ADV_OPT_CONN); atomic_set_bit_to(adv->flags, BT_ADV_SCANNABLE, scannable); @@ -1295,9 +1290,6 @@ int bt_le_adv_start_ext(struct bt_le_ext_adv *adv, bt_conn_unref(conn); } - /* Flag always set to false by le_ext_adv_param_set */ - atomic_set_bit_to(adv->flags, BT_ADV_PERSIST, false); - return 0; } @@ -1354,11 +1346,6 @@ int bt_le_adv_stop(void) (void)bt_le_lim_adv_cancel_timeout(adv); - /* Make sure advertising is not re-enabled later even if it's not - * currently enabled (i.e. BT_DEV_ADVERTISING is not set). - */ - atomic_clear_bit(adv->flags, BT_ADV_PERSIST); - if (!atomic_test_bit(adv->flags, BT_ADV_ENABLED)) { /* Legacy advertiser exists, but is not currently advertising. * This happens when keep advertising behavior is active but @@ -1614,8 +1601,6 @@ int bt_le_ext_adv_stop(struct bt_le_ext_adv *adv) (void)bt_le_lim_adv_cancel_timeout(adv); - atomic_clear_bit(adv->flags, BT_ADV_PERSIST); - if (!atomic_test_bit(adv->flags, BT_ADV_ENABLED)) { return 0; } diff --git a/subsys/bluetooth/host/hci_core.c b/subsys/bluetooth/host/hci_core.c index 2ba274cd2275..274c202d800a 100644 --- a/subsys/bluetooth/host/hci_core.c +++ b/subsys/bluetooth/host/hci_core.c @@ -1499,13 +1499,10 @@ void bt_hci_le_enh_conn_complete(struct bt_hci_evt_le_enh_conn_complete *evt) if (IS_ENABLED(CONFIG_BT_EXT_ADV) && !BT_DEV_FEAT_LE_EXT_ADV(bt_dev.le.features)) { - struct bt_le_ext_adv *adv = bt_le_adv_lookup_legacy(); /* No advertising set terminated event, must be a * legacy advertiser set. */ - if (!atomic_test_bit(adv->flags, BT_ADV_PERSIST)) { - bt_le_adv_delete_legacy(); - } + bt_le_adv_delete_legacy(); } } diff --git a/subsys/bluetooth/host/hci_core.h b/subsys/bluetooth/host/hci_core.h index bb91c3732dd5..c5a103e00dd5 100644 --- a/subsys/bluetooth/host/hci_core.h +++ b/subsys/bluetooth/host/hci_core.h @@ -140,10 +140,6 @@ enum { * the identity address instead. */ BT_ADV_USE_IDENTITY, - /* Advertiser has been configured to keep advertising after a connection - * has been established as long as there are connections available. - */ - BT_ADV_PERSIST, /* Advertiser has been temporarily disabled. */ BT_ADV_PAUSED, /* Periodic Advertising has been enabled in the controller. */ From a1d4c69081d3438a680ea33e472d66d1eacd0585 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Mon, 13 Oct 2025 09:58:00 +0200 Subject: [PATCH 2119/2141] [nrf fromtree] Bluetooth: Host: bt_iso_reset before bt_conn_cleanup_all Move the call to bt_iso_reset to before bt_conn_cleanup_all. The reason for this is that bt_conn_cleanup_all will disconnect all the ACL connections, which will put the CIS in a disconnecting state, without finalizing them. This means that if we get a num_completed_packet event between the call to bt_conn_cleanup_all and before the BT_HCI_OP_RESET request has been completed, we will trigger an assert in the hci_num_completed_packets function as the CIS still exists, but where we would already have cleaned up the pending TX without telling the controller. Moving the call to bt_iso_reset means that the CIS will have been fully terminated at this point, which will prevent the assert from happening. Since CIS depends on ACLs, this is also the logical order for resetting them. Signed-off-by: Emil Gydesen (cherry picked from commit 0ebe84cc5aed09d44303488859bda7a8535058e5) Signed-off-by: Pavel Vasilyev --- subsys/bluetooth/host/hci_core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/subsys/bluetooth/host/hci_core.c b/subsys/bluetooth/host/hci_core.c index 274c202d800a..29a7f5d30ebf 100644 --- a/subsys/bluetooth/host/hci_core.c +++ b/subsys/bluetooth/host/hci_core.c @@ -4650,6 +4650,10 @@ int bt_disable(void) bt_periodic_sync_disable(); #endif /* CONFIG_BT_PER_ADV_SYNC */ + if (IS_ENABLED(CONFIG_BT_ISO)) { + bt_iso_reset(); + } + #if defined(CONFIG_BT_CONN) if (IS_ENABLED(CONFIG_BT_SMP)) { bt_pub_key_hci_disrupted(); @@ -4704,10 +4708,6 @@ int bt_disable(void) /* If random address was set up - clear it */ bt_addr_le_copy(&bt_dev.random_addr, BT_ADDR_LE_ANY); - if (IS_ENABLED(CONFIG_BT_ISO)) { - bt_iso_reset(); - } - bt_monitor_send(BT_MONITOR_CLOSE_INDEX, NULL, 0); /* Clear BT_DEV_ENABLE here to prevent early bt_enable() calls, before disable is From e3c6bad9acb5f31084077b02352165650f1d1ebd Mon Sep 17 00:00:00 2001 From: Ludvig Jordet Date: Mon, 13 Oct 2025 16:15:20 +0200 Subject: [PATCH 2120/2141] [nrf fromtree] Bluetooth: Mesh: Provisioner closes link on failed According to MshPrt 5.4.4, The Provisioner, upon receiving the Provisioning Failed PDU, shall assume that the provisioning failed and immediately disconnect the provisioning bearer. Signed-off-by: Ludvig Jordet (cherry picked from commit 1c6f98aaf2580c3162dac75162fa3dcd6a19d073) Signed-off-by: Pavel Vasilyev --- subsys/bluetooth/mesh/provisioner.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/bluetooth/mesh/provisioner.c b/subsys/bluetooth/mesh/provisioner.c index b1df6431d068..353cde6b673a 100644 --- a/subsys/bluetooth/mesh/provisioner.c +++ b/subsys/bluetooth/mesh/provisioner.c @@ -685,7 +685,7 @@ static void prov_confirm(const uint8_t *data) static void prov_failed(const uint8_t *data) { LOG_WRN("Error: 0x%02x", data[0]); - reset_state(); + prov_link_close(PROV_BEARER_LINK_STATUS_FAIL); } static void local_input_complete(void) From 860a7e5583529963e7bc48532f9eb801396e8375 Mon Sep 17 00:00:00 2001 From: Ludvig Jordet Date: Tue, 14 Oct 2025 09:46:14 +0200 Subject: [PATCH 2121/2141] [nrf fromtree] Bluetooth: Mesh: Minor cleanup of prov link close on success Changes the link close upon success to use the `prov_link_close` helper function instead of doing it manually, as minor cleanup. Signed-off-by: Ludvig Jordet (cherry picked from commit f998357015c991cc11344d25b9147acc1502eeb9) Signed-off-by: Pavel Vasilyev --- subsys/bluetooth/mesh/provisioner.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/subsys/bluetooth/mesh/provisioner.c b/subsys/bluetooth/mesh/provisioner.c index 353cde6b673a..28372caf4554 100644 --- a/subsys/bluetooth/mesh/provisioner.c +++ b/subsys/bluetooth/mesh/provisioner.c @@ -577,10 +577,9 @@ static void prov_complete(const uint8_t *data) bt_hex(&provisionee.new_dev_key, 16), node->net_idx, node->num_elem, node->addr); - bt_mesh_prov_link.expect = PROV_NO_PDU; atomic_set_bit(bt_mesh_prov_link.flags, COMPLETE); - bt_mesh_prov_link.bearer->link_close(PROV_BEARER_LINK_STATUS_SUCCESS); + prov_link_close(PROV_BEARER_LINK_STATUS_SUCCESS); } static void prov_node_add(void) From f87a3f77473294bc1c6398b49482191e400cf254 Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Wed, 15 Oct 2025 12:49:57 +0200 Subject: [PATCH 2122/2141] [nrf fromtree] bluetooth: mesh: Fix build without settings under asan MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When Mesh is built without CONFIG_BT_SETTINGS and with CONFIG_ASAN (and CONFIG_NO_OPTIMIZATION), the call to bt_mesh_settings_set is not optimized out. Since settings.c isn’t compiled when CONFIG_BT_SETTINGS is disabled, the linker reports an undefined reference. Guard the call with !IS_ENABLED(CONFIG_BT_SETTINGS) so the call and the subsequent code is compiled out when settings are disabled. Signed-off-by: Pavel Vasilyev (cherry picked from commit a360ff7cc31333aaaf72a9bcaba2d4904bf2b782) Signed-off-by: Pavel Vasilyev --- subsys/bluetooth/mesh/app_keys.c | 4 ++++ subsys/bluetooth/mesh/brg_cfg.c | 4 ++++ subsys/bluetooth/mesh/cdb.c | 16 ++++++++++++++++ subsys/bluetooth/mesh/cfg.c | 4 ++++ subsys/bluetooth/mesh/heartbeat.c | 4 ++++ subsys/bluetooth/mesh/net.c | 16 ++++++++++++++++ subsys/bluetooth/mesh/rpl.c | 4 ++++ subsys/bluetooth/mesh/solicitation.c | 8 ++++++++ subsys/bluetooth/mesh/subnet.c | 4 ++++ subsys/bluetooth/mesh/va.c | 4 ++++ 10 files changed, 68 insertions(+) diff --git a/subsys/bluetooth/mesh/app_keys.c b/subsys/bluetooth/mesh/app_keys.c index 5afd887a8e80..f573add5a324 100644 --- a/subsys/bluetooth/mesh/app_keys.c +++ b/subsys/bluetooth/mesh/app_keys.c @@ -666,6 +666,10 @@ static int app_key_set(const char *name, size_t len_rd, uint16_t app_idx; int err; + if (!IS_ENABLED(CONFIG_BT_SETTINGS)) { + return 0; + } + if (!name) { LOG_ERR("Insufficient number of arguments"); return -ENOENT; diff --git a/subsys/bluetooth/mesh/brg_cfg.c b/subsys/bluetooth/mesh/brg_cfg.c index 58d1aada550d..d0bdaef7f05e 100644 --- a/subsys/bluetooth/mesh/brg_cfg.c +++ b/subsys/bluetooth/mesh/brg_cfg.c @@ -52,6 +52,10 @@ static int brg_en_set(const char *name, size_t len_rd, settings_read_cb read_cb, { int err; + if (!IS_ENABLED(CONFIG_BT_SETTINGS)) { + return 0; + } + if (len_rd == 0) { brg_enabled = 0; LOG_DBG("Cleared bridge enable state"); diff --git a/subsys/bluetooth/mesh/cdb.c b/subsys/bluetooth/mesh/cdb.c index 310108d7b756..dc2725a7a327 100644 --- a/subsys/bluetooth/mesh/cdb.c +++ b/subsys/bluetooth/mesh/cdb.c @@ -180,6 +180,10 @@ static int cdb_net_set(const char *name, size_t len_rd, struct net_val net; int err; + if (!IS_ENABLED(CONFIG_BT_SETTINGS)) { + return 0; + } + if (len_rd == 0) { LOG_DBG("val (null)"); return 0; @@ -219,6 +223,10 @@ static int cdb_node_set(const char *name, size_t len_rd, uint16_t addr; int err; + if (!IS_ENABLED(CONFIG_BT_SETTINGS)) { + return 0; + } + if (!name) { LOG_ERR("Insufficient number of arguments"); return -ENOENT; @@ -281,6 +289,10 @@ static int cdb_subnet_set(const char *name, size_t len_rd, uint16_t net_idx; int err; + if (!IS_ENABLED(CONFIG_BT_SETTINGS)) { + return 0; + } + if (!name) { LOG_ERR("Insufficient number of arguments"); return -ENOENT; @@ -347,6 +359,10 @@ static int cdb_app_key_set(const char *name, size_t len_rd, uint16_t app_idx; int err; + if (!IS_ENABLED(CONFIG_BT_SETTINGS)) { + return 0; + } + if (!name) { LOG_ERR("Insufficient number of arguments"); return -ENOENT; diff --git a/subsys/bluetooth/mesh/cfg.c b/subsys/bluetooth/mesh/cfg.c index 155c2e616d55..e5563b95c3c1 100644 --- a/subsys/bluetooth/mesh/cfg.c +++ b/subsys/bluetooth/mesh/cfg.c @@ -429,6 +429,10 @@ static int cfg_set(const char *name, size_t len_rd, struct cfg_val cfg; int err; + if (!IS_ENABLED(CONFIG_BT_SETTINGS)) { + return 0; + } + if (len_rd == 0) { LOG_DBG("Cleared configuration state"); return 0; diff --git a/subsys/bluetooth/mesh/heartbeat.c b/subsys/bluetooth/mesh/heartbeat.c index 133c552620f5..0ad4828279c2 100644 --- a/subsys/bluetooth/mesh/heartbeat.c +++ b/subsys/bluetooth/mesh/heartbeat.c @@ -416,6 +416,10 @@ static int hb_pub_set(const char *name, size_t len_rd, struct hb_pub_val hb_val; int err; + if (!IS_ENABLED(CONFIG_BT_SETTINGS)) { + return 0; + } + err = bt_mesh_settings_set(read_cb, cb_arg, &hb_val, sizeof(hb_val)); if (err) { LOG_ERR("Failed to set \'hb_val\'"); diff --git a/subsys/bluetooth/mesh/net.c b/subsys/bluetooth/mesh/net.c index 276728bd9a45..b2e1cc695f94 100644 --- a/subsys/bluetooth/mesh/net.c +++ b/subsys/bluetooth/mesh/net.c @@ -1005,6 +1005,10 @@ static int net_set(const char *name, size_t len_rd, settings_read_cb read_cb, struct bt_mesh_key key; int err; + if (!IS_ENABLED(CONFIG_BT_SETTINGS)) { + return 0; + } + if (len_rd == 0) { LOG_DBG("val (null)"); @@ -1042,6 +1046,10 @@ static int iv_set(const char *name, size_t len_rd, settings_read_cb read_cb, struct iv_val iv; int err; + if (!IS_ENABLED(CONFIG_BT_SETTINGS)) { + return 0; + } + if (len_rd == 0) { LOG_DBG("IV deleted"); @@ -1074,6 +1082,10 @@ static int seq_set(const char *name, size_t len_rd, settings_read_cb read_cb, struct seq_val seq; int err; + if (!IS_ENABLED(CONFIG_BT_SETTINGS)) { + return 0; + } + if (len_rd == 0) { LOG_DBG("val (null)"); @@ -1113,6 +1125,10 @@ static int dev_key_cand_set(const char *name, size_t len_rd, settings_read_cb re int err; struct bt_mesh_key key; + if (!IS_ENABLED(CONFIG_BT_SETTINGS)) { + return 0; + } + if (len_rd == 0) { LOG_DBG("val (null)"); diff --git a/subsys/bluetooth/mesh/rpl.c b/subsys/bluetooth/mesh/rpl.c index 581c94771c81..7c9317fcc94c 100644 --- a/subsys/bluetooth/mesh/rpl.c +++ b/subsys/bluetooth/mesh/rpl.c @@ -272,6 +272,10 @@ static int rpl_set(const char *name, size_t len_rd, int err; uint16_t src; + if (!IS_ENABLED(CONFIG_BT_SETTINGS)) { + return 0; + } + if (!name) { LOG_ERR("Insufficient number of arguments"); return -ENOENT; diff --git a/subsys/bluetooth/mesh/solicitation.c b/subsys/bluetooth/mesh/solicitation.c index a2872daecb03..2d863dc57dc5 100644 --- a/subsys/bluetooth/mesh/solicitation.c +++ b/subsys/bluetooth/mesh/solicitation.c @@ -120,6 +120,10 @@ static int sseq_set(const char *name, size_t len_rd, { int err; + if (!IS_ENABLED(CONFIG_BT_SETTINGS)) { + return 0; + } + err = bt_mesh_settings_set(read_cb, cb_arg, &sseq_out, sizeof(sseq_out)); if (err) { LOG_ERR("Failed to set \'sseq\'"); @@ -365,6 +369,10 @@ static int srpl_set(const char *name, size_t len_rd, } } + if (!IS_ENABLED(CONFIG_BT_SETTINGS)) { + return 0; + } + err = bt_mesh_settings_set(read_cb, cb_arg, &sseq, sizeof(sseq)); if (err) { LOG_ERR("Failed to set \'sseq\'"); diff --git a/subsys/bluetooth/mesh/subnet.c b/subsys/bluetooth/mesh/subnet.c index b17b9a497400..7f2943365976 100644 --- a/subsys/bluetooth/mesh/subnet.c +++ b/subsys/bluetooth/mesh/subnet.c @@ -971,6 +971,10 @@ static int net_key_set(const char *name, size_t len_rd, int err; uint16_t net_idx; + if (!IS_ENABLED(CONFIG_BT_SETTINGS)) { + return 0; + } + if (!name) { LOG_ERR("Insufficient number of arguments"); return -ENOENT; diff --git a/subsys/bluetooth/mesh/va.c b/subsys/bluetooth/mesh/va.c index fb81f36251cf..0b83e93e1c8d 100644 --- a/subsys/bluetooth/mesh/va.c +++ b/subsys/bluetooth/mesh/va.c @@ -219,6 +219,10 @@ static int va_set(const char *name, size_t len_rd, uint16_t index; int err; + if (!IS_ENABLED(CONFIG_BT_SETTINGS)) { + return 0; + } + if (!name) { LOG_ERR("Insufficient number of arguments"); return -ENOENT; From 0a466b40957bef9332e59778cf38642ae10587ea Mon Sep 17 00:00:00 2001 From: Ludvig Jordet Date: Wed, 15 Oct 2025 10:59:22 +0200 Subject: [PATCH 2123/2141] [nrf fromtree] Bluetooth: Mesh: Filter duplicates in brg subnets list This commit adds functionality to filter out duplicate entries in the Bridged Subnets List message. This is done by iterating through the part of the table we have already processed, to check if this is the first time we see a given key pair or not. Signed-off-by: Ludvig Jordet (cherry picked from commit cc8ac6bdee0bd58248ab877cce69475fa52ebc42) Signed-off-by: Pavel Vasilyev --- subsys/bluetooth/mesh/brg_cfg_srv.c | 64 +++++++++-------------------- 1 file changed, 19 insertions(+), 45 deletions(-) diff --git a/subsys/bluetooth/mesh/brg_cfg_srv.c b/subsys/bluetooth/mesh/brg_cfg_srv.c index d622ebf48a25..0d0bda534b66 100644 --- a/subsys/bluetooth/mesh/brg_cfg_srv.c +++ b/subsys/bluetooth/mesh/brg_cfg_srv.c @@ -145,60 +145,34 @@ static int bridged_subnets_get(const struct bt_mesh_model *model, struct bt_mesh net_buf_simple_add_le16(&msg, net_idx_filter); net_buf_simple_add_u8(&msg, start_id); - uint8_t cnt = 0; - uint16_t net_idx1, net_idx2; - for (int i = 0; i < rows; i++) { - net_idx1 = brg_tbl[i].net_idx1; - net_idx2 = brg_tbl[i].net_idx2; + uint16_t net_idx1 = brg_tbl[i].net_idx1; + uint16_t net_idx2 = brg_tbl[i].net_idx2; + bool is_first_instance; if (net_buf_simple_tailroom(&msg) < 3 + BT_MESH_MIC_SHORT) { break; } - switch (filter_net_idx.filter) { - /* Report pair of NetKeys from the table, starting from start_id. */ - case 0: - if (i >= start_id) { - key_idx_pack_pair(&msg, net_idx1, net_idx2); + is_first_instance = true; + for (int j = 0; j < i; j++) { + if (net_idx1 == brg_tbl[j].net_idx1 && net_idx2 == brg_tbl[j].net_idx2) { + is_first_instance = false; + break; } - break; - - /* Report pair of NetKeys in which (NetKeyIndex1) matches the net_idx */ - case 1: - if (net_idx1 == filter_net_idx.net_idx) { - if (cnt >= start_id) { - key_idx_pack_pair(&msg, net_idx1, net_idx2); - } - cnt++; - } - break; - - /* Report pair of NetKeys in which (NetKeyIndex2) matches the net_idx */ - case 2: - if (net_idx2 == filter_net_idx.net_idx) { - if (cnt >= start_id) { - key_idx_pack_pair(&msg, net_idx1, net_idx2); - } - cnt++; - } - break; + } - /* Report pair of NetKeys in which (NetKeyIndex1 or NetKeyIndex2) matches the - * net_idx - */ - case 3: - if (net_idx1 == filter_net_idx.net_idx || - net_idx2 == filter_net_idx.net_idx) { - if (cnt >= start_id) { - key_idx_pack_pair(&msg, net_idx1, net_idx2); - } - cnt++; + if (is_first_instance && + (filter_net_idx.filter == 0 || + (filter_net_idx.filter == 1 && net_idx1 == filter_net_idx.net_idx) || + (filter_net_idx.filter == 2 && net_idx2 == filter_net_idx.net_idx) || + (filter_net_idx.filter == 3 && (net_idx1 == filter_net_idx.net_idx || + net_idx2 == filter_net_idx.net_idx)))) { + if (start_id > 0) { + start_id--; + } else { + key_idx_pack_pair(&msg, net_idx1, net_idx2); } - break; - - default: - CODE_UNREACHABLE; } } From d9153846e3f1a9cf49f0bd3bf7e38ff7df6b35a8 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Mon, 20 Oct 2025 13:36:39 +0300 Subject: [PATCH 2124/2141] [nrf fromtree] Bluetooth: Host: Make use of common array helper macros There's a bunch of convenience macros in sys/util.h that are intended to help out with translating array indices and determining if an element is part of an array or not. Use those instead of custom code. Signed-off-by: Johan Hedberg (cherry picked from commit 0fd8af97fbeab36159c732ae09d33d987d635197) Signed-off-by: Pavel Vasilyev --- subsys/bluetooth/host/adv.c | 6 ++---- subsys/bluetooth/host/conn.c | 15 ++++++--------- subsys/bluetooth/host/scan.c | 7 +++---- 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/subsys/bluetooth/host/adv.c b/subsys/bluetooth/host/adv.c index 9f41e1334792..860fca3664c4 100644 --- a/subsys/bluetooth/host/adv.c +++ b/subsys/bluetooth/host/adv.c @@ -187,11 +187,9 @@ static struct bt_le_ext_adv adv_pool[CONFIG_BT_EXT_ADV_MAX_ADV_SET]; #if defined(CONFIG_BT_EXT_ADV) uint8_t bt_le_ext_adv_get_index(struct bt_le_ext_adv *adv) { - ptrdiff_t index = adv - adv_pool; + __ASSERT(IS_ARRAY_ELEMENT(adv_pool, adv), "Invalid bt_adv pointer"); - __ASSERT(index >= 0 && index < ARRAY_SIZE(adv_pool), - "Invalid bt_adv pointer"); - return (uint8_t)index; + return (uint8_t)ARRAY_INDEX(adv_pool, adv); } static struct bt_le_ext_adv *adv_new(void) diff --git a/subsys/bluetooth/host/conn.c b/subsys/bluetooth/host/conn.c index c91df6862928..e706fd3fb934 100644 --- a/subsys/bluetooth/host/conn.c +++ b/subsys/bluetooth/host/conn.c @@ -1563,23 +1563,20 @@ uint8_t bt_conn_index(const struct bt_conn *conn) switch (conn->type) { #if defined(CONFIG_BT_ISO) case BT_CONN_TYPE_ISO: - index = conn - iso_conns; - __ASSERT(index >= 0 && index < ARRAY_SIZE(iso_conns), - "Invalid bt_conn pointer"); + __ASSERT(IS_ARRAY_ELEMENT(iso_conns, conn), "Invalid bt_conn pointer"); + index = ARRAY_INDEX(iso_conns, conn); break; #endif #if defined(CONFIG_BT_CLASSIC) case BT_CONN_TYPE_SCO: - index = conn - sco_conns; - __ASSERT(index >= 0 && index < ARRAY_SIZE(sco_conns), - "Invalid bt_conn pointer"); + __ASSERT(IS_ARRAY_ELEMENT(sco_conns, conn), "Invalid bt_conn pointer"); + index = ARRAY_INDEX(sco_conns, conn); break; #endif default: #if defined(CONFIG_BT_CONN) - index = conn - acl_conns; - __ASSERT(index >= 0 && index < ARRAY_SIZE(acl_conns), - "Invalid bt_conn pointer"); + __ASSERT(IS_ARRAY_ELEMENT(acl_conns, conn), "Invalid bt_conn pointer"); + index = ARRAY_INDEX(acl_conns, conn); #else __ASSERT(false, "Invalid connection type %u", conn->type); #endif /* CONFIG_BT_CONN */ diff --git a/subsys/bluetooth/host/scan.c b/subsys/bluetooth/host/scan.c index b154729438a0..bffc5fd907f2 100644 --- a/subsys/bluetooth/host/scan.c +++ b/subsys/bluetooth/host/scan.c @@ -1841,11 +1841,10 @@ void bt_le_scan_cb_unregister(struct bt_le_scan_cb *cb) #if defined(CONFIG_BT_PER_ADV_SYNC) uint8_t bt_le_per_adv_sync_get_index(struct bt_le_per_adv_sync *per_adv_sync) { - ptrdiff_t index = per_adv_sync - per_adv_sync_pool; - - __ASSERT(index >= 0 && ARRAY_SIZE(per_adv_sync_pool) > index, + __ASSERT(IS_ARRAY_ELEMENT(per_adv_sync_pool, per_adv_sync), "Invalid per_adv_sync pointer"); - return (uint8_t)index; + + return (uint8_t)ARRAY_INDEX(per_adv_sync_pool, per_adv_sync); } struct bt_le_per_adv_sync *bt_le_per_adv_sync_lookup_index(uint8_t index) From 1286a6c6ad7458ad6d8eb4696b7107c530b9e776 Mon Sep 17 00:00:00 2001 From: Lingao Meng Date: Tue, 21 Oct 2025 16:29:10 +0800 Subject: [PATCH 2125/2141] [nrf fromtree] Bluetooth: Host: Fix unnecessary random address update The `bt_le_ext_adv_update_param` will set new random address when option not select `BT_LE_ADV_OPT_USE_IDENTITY`, But `bt_le_ext_adv_start` will also set random address again. This will be affect bluetooth mesh, after this change, will ensure address only change once for every advertising. Signed-off-by: Lingao Meng (cherry picked from commit f902f2ab0d24fab4a98536e422258522191132b7) Signed-off-by: Pavel Vasilyev --- subsys/bluetooth/host/adv.c | 9 +++++++-- subsys/bluetooth/host/hci_core.h | 4 ++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/subsys/bluetooth/host/adv.c b/subsys/bluetooth/host/adv.c index 860fca3664c4..1915a3ec0ee5 100644 --- a/subsys/bluetooth/host/adv.c +++ b/subsys/bluetooth/host/adv.c @@ -1203,6 +1203,9 @@ static int le_ext_adv_param_set(struct bt_le_ext_adv *adv, atomic_set_bit_to(adv->flags, BT_ADV_EXT_ADV, param->options & BT_LE_ADV_OPT_EXT_ADV); + atomic_set_bit_to(adv->flags, BT_ADV_RANDOM_ADDR_UPDATED, + own_addr_type == BT_HCI_OWN_ADDR_RANDOM); + return 0; } @@ -1557,11 +1560,13 @@ int bt_le_ext_adv_start(struct bt_le_ext_adv *adv, if (atomic_test_bit(adv->flags, BT_ADV_CONNECTABLE)) { if (IS_ENABLED(CONFIG_BT_PRIVACY) && - !atomic_test_bit(adv->flags, BT_ADV_USE_IDENTITY)) { + !atomic_test_bit(adv->flags, BT_ADV_USE_IDENTITY) && + !atomic_test_and_clear_bit(adv->flags, BT_ADV_RANDOM_ADDR_UPDATED)) { bt_id_set_adv_private_addr(adv); } } else { - if (!atomic_test_bit(adv->flags, BT_ADV_USE_IDENTITY)) { + if (!atomic_test_bit(adv->flags, BT_ADV_USE_IDENTITY) && + !atomic_test_and_clear_bit(adv->flags, BT_ADV_RANDOM_ADDR_UPDATED)) { bt_id_set_adv_private_addr(adv); } } diff --git a/subsys/bluetooth/host/hci_core.h b/subsys/bluetooth/host/hci_core.h index c5a103e00dd5..e17277ba4da2 100644 --- a/subsys/bluetooth/host/hci_core.h +++ b/subsys/bluetooth/host/hci_core.h @@ -116,6 +116,10 @@ enum { BT_ADV_PARAMS_SET, /* Advertising data has been set in the controller. */ BT_ADV_DATA_SET, + /* Advertising random address has been updated in the controller before + * enabling advertising. + */ + BT_ADV_RANDOM_ADDR_UPDATED, /* Advertising random address pending to be set in the controller. */ BT_ADV_RANDOM_ADDR_PENDING, /* The private random address of the advertiser is valid for this cycle From d6d09a7675eb9ed0443f3eeb80f78e61a2dffb6b Mon Sep 17 00:00:00 2001 From: Lingao Meng Date: Thu, 23 Oct 2025 11:27:22 +0800 Subject: [PATCH 2126/2141] [nrf fromtree] Bluetooth: Host: Fix Periodic Advertising random address update update random address when periodic adv enabled. Signed-off-by: Lingao Meng (cherry picked from commit d59cd2e368bb4e3bea78fb3fe40c7866db67f74c) Signed-off-by: Pavel Vasilyev --- subsys/bluetooth/host/adv.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/subsys/bluetooth/host/adv.c b/subsys/bluetooth/host/adv.c index 1915a3ec0ee5..37c9e030ebbb 100644 --- a/subsys/bluetooth/host/adv.c +++ b/subsys/bluetooth/host/adv.c @@ -1561,12 +1561,14 @@ int bt_le_ext_adv_start(struct bt_le_ext_adv *adv, if (atomic_test_bit(adv->flags, BT_ADV_CONNECTABLE)) { if (IS_ENABLED(CONFIG_BT_PRIVACY) && !atomic_test_bit(adv->flags, BT_ADV_USE_IDENTITY) && - !atomic_test_and_clear_bit(adv->flags, BT_ADV_RANDOM_ADDR_UPDATED)) { + (atomic_test_bit(adv->flags, BT_PER_ADV_ENABLED) || + !atomic_test_and_clear_bit(adv->flags, BT_ADV_RANDOM_ADDR_UPDATED))) { bt_id_set_adv_private_addr(adv); } } else { if (!atomic_test_bit(adv->flags, BT_ADV_USE_IDENTITY) && - !atomic_test_and_clear_bit(adv->flags, BT_ADV_RANDOM_ADDR_UPDATED)) { + (atomic_test_bit(adv->flags, BT_PER_ADV_ENABLED) || + !atomic_test_and_clear_bit(adv->flags, BT_ADV_RANDOM_ADDR_UPDATED))) { bt_id_set_adv_private_addr(adv); } } From b65385062a4546dfa2da3045f77685eb594a6192 Mon Sep 17 00:00:00 2001 From: Lingao Meng Date: Thu, 23 Oct 2025 18:51:02 +0800 Subject: [PATCH 2127/2141] [nrf fromtree] tests: bluetooth: audio: fix bsim timing move extending advertising start after periodic adv. Signed-off-by: Lingao Meng (cherry picked from commit bed07a5ebfba4eb17e445032026ac01952c01829) Signed-off-by: Pavel Vasilyev --- subsys/bluetooth/host/adv.c | 8 ++++---- tests/bsim/bluetooth/audio/src/common.c | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/subsys/bluetooth/host/adv.c b/subsys/bluetooth/host/adv.c index 37c9e030ebbb..93fe34ec6c69 100644 --- a/subsys/bluetooth/host/adv.c +++ b/subsys/bluetooth/host/adv.c @@ -1561,14 +1561,14 @@ int bt_le_ext_adv_start(struct bt_le_ext_adv *adv, if (atomic_test_bit(adv->flags, BT_ADV_CONNECTABLE)) { if (IS_ENABLED(CONFIG_BT_PRIVACY) && !atomic_test_bit(adv->flags, BT_ADV_USE_IDENTITY) && - (atomic_test_bit(adv->flags, BT_PER_ADV_ENABLED) || - !atomic_test_and_clear_bit(adv->flags, BT_ADV_RANDOM_ADDR_UPDATED))) { + (!atomic_test_and_clear_bit(adv->flags, BT_ADV_RANDOM_ADDR_UPDATED) || + atomic_test_bit(adv->flags, BT_PER_ADV_ENABLED))) { bt_id_set_adv_private_addr(adv); } } else { if (!atomic_test_bit(adv->flags, BT_ADV_USE_IDENTITY) && - (atomic_test_bit(adv->flags, BT_PER_ADV_ENABLED) || - !atomic_test_and_clear_bit(adv->flags, BT_ADV_RANDOM_ADDR_UPDATED))) { + (!atomic_test_and_clear_bit(adv->flags, BT_ADV_RANDOM_ADDR_UPDATED) || + atomic_test_bit(adv->flags, BT_PER_ADV_ENABLED))) { bt_id_set_adv_private_addr(adv); } } diff --git a/tests/bsim/bluetooth/audio/src/common.c b/tests/bsim/bluetooth/audio/src/common.c index 29e8c5cc2379..d09bcacd3797 100644 --- a/tests/bsim/bluetooth/audio/src/common.c +++ b/tests/bsim/bluetooth/audio/src/common.c @@ -264,20 +264,20 @@ void start_broadcast_adv(struct bt_le_ext_adv *adv) return; } - if (info.ext_adv_state == BT_LE_EXT_ADV_STATE_DISABLED) { - /* Start extended advertising */ - err = bt_le_ext_adv_start(adv, BT_LE_EXT_ADV_START_DEFAULT); + if (info.per_adv_state == BT_LE_PER_ADV_STATE_DISABLED) { + /* Enable Periodic Advertising */ + err = bt_le_per_adv_start(adv); if (err != 0) { - FAIL("Failed to start extended advertising: %d\n", err); + FAIL("Failed to enable periodic advertising: %d\n", err); return; } } - if (info.per_adv_state == BT_LE_PER_ADV_STATE_DISABLED) { - /* Enable Periodic Advertising */ - err = bt_le_per_adv_start(adv); + if (info.ext_adv_state == BT_LE_EXT_ADV_STATE_DISABLED) { + /* Start extended advertising */ + err = bt_le_ext_adv_start(adv, BT_LE_EXT_ADV_START_DEFAULT); if (err != 0) { - FAIL("Failed to enable periodic advertising: %d\n", err); + FAIL("Failed to start extended advertising: %d\n", err); return; } } From 5c732e0c68c1f1f546c9849dbf54a06ceb5cbdd6 Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Thu, 23 Oct 2025 15:09:30 +0200 Subject: [PATCH 2128/2141] [nrf fromtree] bluetooth: mesh: adv_ext: Fix scheduling with multiple relay adv sets When multiple relay adv sets are used, the bt_mesh_adv_send function calls bt_mesh_adv_relay_ready which should distribute relayed advertisements across all relay adv sets. Until the submitted relay adv set work is started, the ADV_FLAG_ACTIVE is not set. Therefore, next call to bt_mesh_adv_send will try to re-submit the same relay adv set work, instead of picking up another relay set which is actually free and ready to send an advertisement. This commit adds a check that checks if the adv set work is already pending to be executed. And if so, schedule_send returns false to make bt_mesh_adv_relay_ready pick next relay adv set. This shouldn't brake advertising because once adv set is done transmitting advertisment, it will pick up a next one. The ADV_FLAG_PROXY check is added to do re-submit for adv set which was used for proxy advertisement since we need to prioritize mesh messages over proxy advertisements when those are running on the same adv set. Signed-off-by: Pavel Vasilyev (cherry picked from commit 1a4f113d144b4d929614c434fad2775c917cfd28) Signed-off-by: Pavel Vasilyev --- subsys/bluetooth/mesh/adv_ext.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/subsys/bluetooth/mesh/adv_ext.c b/subsys/bluetooth/mesh/adv_ext.c index c74f0a40d99a..0cfaec39fdb7 100644 --- a/subsys/bluetooth/mesh/adv_ext.c +++ b/subsys/bluetooth/mesh/adv_ext.c @@ -416,6 +416,16 @@ static bool schedule_send(struct bt_mesh_ext_adv *ext_adv) if (!atomic_test_bit(ext_adv->flags, ADV_FLAG_PROXY)) { return false; } + } else if (k_work_is_pending(&ext_adv->work) && + !atomic_test_bit(ext_adv->flags, ADV_FLAG_PROXY)) { + /* This can happen if we try to schedule a send while a previous send is still + * pending in the work queue. There is nothing wrong with resubmitting the same + * work to the work queue, but in this case won't have a change to try a work from + * another advertising set which can be ready for sending. + * + * If, however, ADV_FLAG_PROXY is set, we want to stop the proxy advertising. + */ + return false; } bt_mesh_wq_submit(&ext_adv->work); From d85b3a4217f27bcf1b108480350d7e779bda5338 Mon Sep 17 00:00:00 2001 From: Guotao Zhang Date: Tue, 28 Oct 2025 13:05:51 +0100 Subject: [PATCH 2129/2141] [nrf fromtree] drivers: bluetooth: h4: Fix check for sufficient buffer size When alloc the evt buffer,such as the adv report, only compare the remaining data len, should aslo consider the hdr_len, because the hdr also copy to alloced buffer.if not consider the hdr, then hdr + remaining data may larger than alloced buffer, because the alloced buffer is not enough,then will assert when receive the remaining data. Signed-off-by: Guotao Zhang (cherry picked from commit ec970a635ea92a4307d30c122c2c89109f989055) Signed-off-by: Pavel Vasilyev --- drivers/bluetooth/hci/h4.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/bluetooth/hci/h4.c b/drivers/bluetooth/hci/h4.c index cfea346a946c..21be2213fb87 100644 --- a/drivers/bluetooth/hci/h4.c +++ b/drivers/bluetooth/hci/h4.c @@ -338,7 +338,7 @@ static inline void read_payload(const struct device *dev) LOG_DBG("Allocated rx.buf %p", h4->rx.buf); buf_tailroom = net_buf_tailroom(h4->rx.buf); - if (buf_tailroom < h4->rx.remaining) { + if (buf_tailroom < (h4->rx.remaining + h4->rx.hdr_len)) { LOG_ERR("Not enough space in buffer %u/%zu", h4->rx.remaining, buf_tailroom); h4->rx.discard = h4->rx.remaining; From 868ae7fe5d6903cf676fe859fbf4a623f9bdb201 Mon Sep 17 00:00:00 2001 From: Szymon Janc Date: Tue, 28 Oct 2025 14:19:13 +0100 Subject: [PATCH 2130/2141] [nrf fromtree] Bluetooth: Host: Fix crash on bt_disable() with limited advertising When limited advertising is enabled there is pending deleyable work for timing it out. If in such case struct bt_le_ext_adv is cleared by memset system will crash on next tick. Fix this by ensuring work is cancelled before clearing struct bt_le_ext_adv. Using bt_le_ext_adv_foreach() ensures that this will be correctly handled with and without extended advertising enabled. Signed-off-by: Szymon Janc (cherry picked from commit 973934c1e975ee7381c6599895f6dd7b610aee0a) Signed-off-by: Pavel Vasilyev --- subsys/bluetooth/host/adv.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/subsys/bluetooth/host/adv.c b/subsys/bluetooth/host/adv.c index 93fe34ec6c69..3a17a7192535 100644 --- a/subsys/bluetooth/host/adv.c +++ b/subsys/bluetooth/host/adv.c @@ -34,6 +34,7 @@ #include "hci_core.h" #include "id.h" #include "scan.h" +#include "adv.h" #define LOG_LEVEL CONFIG_BT_HCI_CORE_LOG_LEVEL LOG_MODULE_REGISTER(bt_adv); @@ -266,12 +267,15 @@ void bt_le_ext_adv_foreach(void (*func)(struct bt_le_ext_adv *adv, void *data), #endif /* defined(CONFIG_BT_EXT_ADV) */ } -void bt_adv_reset_adv_pool(void) +static void clear_ext_adv_instance(struct bt_le_ext_adv *adv, void *data) { -#if defined(CONFIG_BT_EXT_ADV) - (void)memset(&adv_pool, 0, sizeof(adv_pool)); -#endif /* defined(CONFIG_BT_EXT_ADV) */ + bt_le_lim_adv_cancel_timeout(adv); + memset(adv, 0, sizeof(*adv)); +} +void bt_adv_reset_adv_pool(void) +{ + bt_le_ext_adv_foreach(clear_ext_adv_instance, NULL); (void)memset(&bt_dev.adv, 0, sizeof(bt_dev.adv)); } From a8610652a70a3803482452a6bdae016d1aa06057 Mon Sep 17 00:00:00 2001 From: Szymon Janc Date: Tue, 28 Oct 2025 09:50:51 +0100 Subject: [PATCH 2131/2141] [nrf fromtree] Bluetooth: Mesh: Fix invalid write in private beacon server There is no guarantess enum will be packed so passing uint8_t as node_id to bt_mesh_subnet_priv_node_id_get() could (and likely will) result in writing past stack variable. Signed-off-by: Szymon Janc (cherry picked from commit 4571485e16ccb4bf5821df09752179b16eecccc1) Signed-off-by: Pavel Vasilyev --- subsys/bluetooth/mesh/priv_beacon_srv.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/subsys/bluetooth/mesh/priv_beacon_srv.c b/subsys/bluetooth/mesh/priv_beacon_srv.c index 8dd1ba3b1d8c..790ffe562835 100644 --- a/subsys/bluetooth/mesh/priv_beacon_srv.c +++ b/subsys/bluetooth/mesh/priv_beacon_srv.c @@ -151,13 +151,14 @@ static int handle_node_id_get(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx, struct net_buf_simple *buf) { - uint8_t node_id, status; + enum bt_mesh_feat_state node_id; uint16_t net_idx; + uint8_t status; net_idx = net_buf_simple_pull_le16(buf) & 0xfff; - status = bt_mesh_subnet_priv_node_id_get(net_idx, (enum bt_mesh_feat_state *)&node_id); - node_id_status_rsp(mod, ctx, status, net_idx, node_id); + status = bt_mesh_subnet_priv_node_id_get(net_idx, &node_id); + node_id_status_rsp(mod, ctx, status, net_idx, (uint8_t)node_id); return 0; } From a570b383a83bc03d7c63ced56fe65e6950f07e81 Mon Sep 17 00:00:00 2001 From: Zhijie Zhong Date: Tue, 28 Oct 2025 21:08:10 +0800 Subject: [PATCH 2132/2141] [nrf fromtree] Bluetooth: Host: Fix handling of adv reports when scanning for connection In some cases, the host starts scanning internally for establishing connections (BT_LE_SCAN_USER_CONN), such as host-based resolving or auto-connection. In this situation, even if the application does not start explicit scan, the host still needs to handle the advertising reports to continue the connection process. Previously, both bt_hci_le_adv_report() and bt_hci_le_adv_ext_report() will break or discard all reports when explicit scan is not active. This causes the connection to stay in SCAN_BEFORE_INITIATING and never move forward. This patch adds checking of BT_LE_SCAN_USER_CONN to allow advertising reports to be processed during connection-purpose scanning. When the scan is started explicitly by application, the behavior remains the same, only small comments are updated to describe this behavior and keep the original code style unchanged. Signed-off-by: Zhijie Zhong (cherry picked from commit 87e351f8bcda1c49bab68f02124fcbb193ae9acd) Signed-off-by: Pavel Vasilyev --- subsys/bluetooth/host/scan.c | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/subsys/bluetooth/host/scan.c b/subsys/bluetooth/host/scan.c index bffc5fd907f2..36aa492d611c 100644 --- a/subsys/bluetooth/host/scan.c +++ b/subsys/bluetooth/host/scan.c @@ -632,13 +632,14 @@ static void le_adv_recv(bt_addr_le_t *addr, struct bt_le_scan_recv_info *info, struct bt_le_scan_cb *listener, *next; struct net_buf_simple_state state; bt_addr_le_t id_addr; + bool explicit_scan = atomic_test_bit(scan_state.scan_flags, BT_LE_SCAN_USER_EXPLICIT_SCAN); + bool conn_scan = atomic_test_bit(scan_state.scan_flags, BT_LE_SCAN_USER_CONN); LOG_DBG("%s event %u, len %u, rssi %d dBm", bt_addr_le_str(addr), info->adv_type, len, info->rssi); if (!IS_ENABLED(CONFIG_BT_PRIVACY) && !IS_ENABLED(CONFIG_BT_SCAN_WITH_IDENTITY) && - atomic_test_bit(scan_state.scan_flags, BT_LE_SCAN_USER_EXPLICIT_SCAN) && - (info->adv_props & BT_HCI_LE_ADV_PROP_DIRECT)) { + explicit_scan && (info->adv_props & BT_HCI_LE_ADV_PROP_DIRECT)) { LOG_DBG("Dropped direct adv report"); return; } @@ -652,6 +653,13 @@ static void le_adv_recv(bt_addr_le_t *addr, struct bt_le_scan_recv_info *info, bt_lookup_id_addr(BT_ID_DEFAULT, addr)); } + /* For connection-purpose scanning, + * skip app callbacks but allow pending-conn check logic. + */ + if (!explicit_scan && conn_scan) { + goto check_pending_conn; + } + if (scan_dev_found_cb) { net_buf_simple_save(buf, &state); @@ -677,6 +685,7 @@ static void le_adv_recv(bt_addr_le_t *addr, struct bt_le_scan_recv_info *info, /* Clear pointer to this stack frame before returning to calling function */ info->addr = NULL; +check_pending_conn: #if defined(CONFIG_BT_CENTRAL) check_pending_conn(&id_addr, addr, info->adv_props); #endif /* CONFIG_BT_CENTRAL */ @@ -805,6 +814,8 @@ static void create_ext_adv_info(struct bt_hci_evt_le_ext_advertising_info const void bt_hci_le_adv_ext_report(struct net_buf *buf) { uint8_t num_reports = net_buf_pull_u8(buf); + bool explicit_scan = atomic_test_bit(scan_state.scan_flags, BT_LE_SCAN_USER_EXPLICIT_SCAN); + bool conn_scan = atomic_test_bit(scan_state.scan_flags, BT_LE_SCAN_USER_CONN); LOG_DBG("Adv number of reports %u", num_reports); @@ -817,19 +828,23 @@ void bt_hci_le_adv_ext_report(struct net_buf *buf) bool more_to_come; bool is_new_advertiser; - if (!atomic_test_bit(scan_state.scan_flags, BT_LE_SCAN_USER_EXPLICIT_SCAN)) { + if (!explicit_scan) { /* The application has not requested explicit scan, so it is not expecting * advertising reports. Discard, and reset the reassembler if not inactive * This is done in the loop as this flag can change between each iteration, * and it is not uncommon that scanning is disabled in the callback called - * from le_adv_recv + * from le_adv_recv. + * + * However, if scanning is running for connection purposes, + * the report shall still be processed to allow pending connections. */ - if (reassembling_advertiser.state != FRAG_ADV_INACTIVE) { reset_reassembling_advertiser(); } - break; + if (!conn_scan) { + break; + } } if (buf->len < sizeof(*evt)) { @@ -1669,18 +1684,23 @@ void bt_hci_le_adv_report(struct net_buf *buf) { uint8_t num_reports = net_buf_pull_u8(buf); struct bt_hci_evt_le_advertising_info *evt; + bool explicit_scan = atomic_test_bit(scan_state.scan_flags, BT_LE_SCAN_USER_EXPLICIT_SCAN); + bool conn_scan = atomic_test_bit(scan_state.scan_flags, BT_LE_SCAN_USER_CONN); LOG_DBG("Adv number of reports %u", num_reports); while (num_reports--) { struct bt_le_scan_recv_info adv_info; - if (!atomic_test_bit(scan_state.scan_flags, BT_LE_SCAN_USER_EXPLICIT_SCAN)) { + if (!explicit_scan && !conn_scan) { /* The application has not requested explicit scan, so it is not expecting * advertising reports. Discard. * This is done in the loop as this flag can change between each iteration, * and it is not uncommon that scanning is disabled in the callback called - * from le_adv_recv + * from le_adv_recv. + * + * However, if scanning is running for connection purposes, + * the report shall still be processed to allow pending connections. */ break; From 0cf8fe782c6f4c99ed17c152b7497ade87360dfd Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Tue, 4 Nov 2025 17:49:20 +0200 Subject: [PATCH 2133/2141] [nrf fromtree] Bluetooth: Host: Fix build error with observer-only config When building an observer-only build the check_pending_conn label would result in CI warnings/errors due to this only being a C23 feature: scan.c:692:1: error: label at end of compound statement is a C23 extension Turns out the #ifdefs are completely unnecessary, and the code can simply take advantage of IS_ENABLED(), which should get rid of the warning. Signed-off-by: Johan Hedberg (cherry picked from commit 73b6f8bd4a4bde38c8678d750793d02ae3f43c14) Signed-off-by: Pavel Vasilyev --- subsys/bluetooth/host/scan.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/subsys/bluetooth/host/scan.c b/subsys/bluetooth/host/scan.c index 36aa492d611c..8c5278f362c0 100644 --- a/subsys/bluetooth/host/scan.c +++ b/subsys/bluetooth/host/scan.c @@ -538,7 +538,6 @@ int bt_le_scan_user_remove(enum bt_le_scan_user flag) return scan_update(); } -#if defined(CONFIG_BT_CENTRAL) static void check_pending_conn(const bt_addr_le_t *id_addr, const bt_addr_le_t *addr, uint8_t adv_props) { @@ -593,7 +592,6 @@ static void check_pending_conn(const bt_addr_le_t *id_addr, LOG_WRN("Error while updating the scanner (%d)", err); } } -#endif /* CONFIG_BT_CENTRAL */ /* Convert Legacy adv report evt_type field to adv props */ static uint8_t get_adv_props_legacy(uint8_t evt_type) @@ -656,7 +654,7 @@ static void le_adv_recv(bt_addr_le_t *addr, struct bt_le_scan_recv_info *info, /* For connection-purpose scanning, * skip app callbacks but allow pending-conn check logic. */ - if (!explicit_scan && conn_scan) { + if (IS_ENABLED(CONFIG_BT_CENTRAL) && !explicit_scan && conn_scan) { goto check_pending_conn; } @@ -686,9 +684,9 @@ static void le_adv_recv(bt_addr_le_t *addr, struct bt_le_scan_recv_info *info, info->addr = NULL; check_pending_conn: -#if defined(CONFIG_BT_CENTRAL) - check_pending_conn(&id_addr, addr, info->adv_props); -#endif /* CONFIG_BT_CENTRAL */ + if (IS_ENABLED(CONFIG_BT_CENTRAL)) { + check_pending_conn(&id_addr, addr, info->adv_props); + } } #if defined(CONFIG_BT_EXT_ADV) From 5ada12030bd4a778a3e99721c6d62beaf1702bbf Mon Sep 17 00:00:00 2001 From: Aleksandar Stanoev Date: Thu, 6 Nov 2025 10:15:29 +0000 Subject: [PATCH 2134/2141] [nrf fromtree] Bluetooth: Decode Bluetooth 6.2 version number Bluetooth 6.2 has version number 0x10 and was released in November 2025. This commit ensures this version number is properly decoded. Signed-off-by: Aleksandar Stanoev (cherry picked from commit 9d06fca87ac197f0f238e7cbad4594e28d75ff6e) Signed-off-by: Pavel Vasilyev --- include/zephyr/bluetooth/hci_types.h | 1 + subsys/bluetooth/host/hci_core.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/include/zephyr/bluetooth/hci_types.h b/include/zephyr/bluetooth/hci_types.h index cd6c716c1cbe..d520a2324266 100644 --- a/include/zephyr/bluetooth/hci_types.h +++ b/include/zephyr/bluetooth/hci_types.h @@ -913,6 +913,7 @@ struct bt_hci_rp_configure_data_path { #define BT_HCI_VERSION_5_4 13 #define BT_HCI_VERSION_6_0 14 #define BT_HCI_VERSION_6_1 15 +#define BT_HCI_VERSION_6_2 16 #define BT_HCI_OP_READ_LOCAL_VERSION_INFO BT_OP(BT_OGF_INFO, 0x0001) /* 0x1001 */ struct bt_hci_rp_read_local_version_info { diff --git a/subsys/bluetooth/host/hci_core.c b/subsys/bluetooth/host/hci_core.c index 29a7f5d30ebf..d2a8d6d1202b 100644 --- a/subsys/bluetooth/host/hci_core.c +++ b/subsys/bluetooth/host/hci_core.c @@ -3963,7 +3963,7 @@ const char *bt_hci_get_ver_str(uint8_t core_version) { const char * const str[] = { "1.0b", "1.1", "1.2", "2.0", "2.1", "3.0", "4.0", "4.1", "4.2", - "5.0", "5.1", "5.2", "5.3", "5.4", "6.0", "6.1" + "5.0", "5.1", "5.2", "5.3", "5.4", "6.0", "6.1", "6.2" }; if (core_version < ARRAY_SIZE(str)) { From 7ab8719e1e874eb2dc591b94ab4320be2841ad27 Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Wed, 5 Nov 2025 12:54:42 +0100 Subject: [PATCH 2135/2141] [nrf fromtree] bluetooth: mesh: Increase BT RX Stack Size for PB-GATT Increase BT RX Thread Stack Size which is needed for successfull provisioning over PB-GATT. Output from `kernel thread stacks` shell command: ``` BT RX WQ (real size 4096): unused 1408 usage 2688 / 4096 (65 %) ``` Fixes #98521 Signed-off-by: Pavel Vasilyev (cherry picked from commit bb006dc971556ffa6dc45263d92f4632f0b280dd) Signed-off-by: Pavel Vasilyev --- subsys/bluetooth/host/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/subsys/bluetooth/host/Kconfig b/subsys/bluetooth/host/Kconfig index 2fb1b4198e39..a4cf52978cb2 100644 --- a/subsys/bluetooth/host/Kconfig +++ b/subsys/bluetooth/host/Kconfig @@ -111,6 +111,7 @@ config BT_RX_STACK_SIZE int "Size of the receiving thread stack" default 768 if BT_HCI_RAW default 3092 if BT_MESH_GATT_CLIENT + default 2800 if BT_MESH_PB_GATT default 2600 if BT_MESH default 2048 if BT_AUDIO default 1200 From 1208406958117cf1c9353e08b1048c8b79fda5a4 Mon Sep 17 00:00:00 2001 From: Omkar Kulkarni Date: Wed, 1 Oct 2025 14:39:55 +0200 Subject: [PATCH 2136/2141] [nrf fromtree] Bluetooth: Mesh: Make net msg cache netkey aware Improve the network message cache to be aware of network keys to prevent false duplicate detection across different subnets. This ensures that messages with the same source address and sequence number but from different network keys are not incorrectly identified as duplicates, as it can happen in certain cases. See ES-26350. Signed-off-by: Omkar Kulkarni (cherry picked from commit 22e37982cb8b2c89f1e6b1e7f48dd7481c471a7d) Signed-off-by: Pavel Vasilyev --- subsys/bluetooth/mesh/net.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/subsys/bluetooth/mesh/net.c b/subsys/bluetooth/mesh/net.c index b2e1cc695f94..d791ba46f9ab 100644 --- a/subsys/bluetooth/mesh/net.c +++ b/subsys/bluetooth/mesh/net.c @@ -82,7 +82,8 @@ struct iv_val { static struct { uint32_t src : 15, /* MSb of source is always 0 */ - seq : 17; + seq : 17; + uint16_t net_idx; } msg_cache[CONFIG_BT_MESH_MSG_CACHE_SIZE]; static uint16_t msg_cache_next; @@ -145,20 +146,22 @@ static bool check_dup(struct net_buf_simple *data) return false; } -static bool msg_cache_match(struct net_buf_simple *pdu) +static bool msg_cache_match(struct net_buf_simple *pdu, uint16_t net_idx) { uint16_t i; for (i = msg_cache_next; i > 0U;) { if (msg_cache[--i].src == SRC(pdu->data) && - msg_cache[i].seq == (SEQ(pdu->data) & BIT_MASK(17))) { + msg_cache[i].seq == (SEQ(pdu->data) & BIT_MASK(17)) && + msg_cache[i].net_idx == net_idx) { return true; } } for (i = ARRAY_SIZE(msg_cache); i > msg_cache_next;) { if (msg_cache[--i].src == SRC(pdu->data) && - msg_cache[i].seq == (SEQ(pdu->data) & BIT_MASK(17))) { + msg_cache[i].seq == (SEQ(pdu->data) & BIT_MASK(17)) && + msg_cache[i].net_idx == net_idx) { return true; } } @@ -171,6 +174,7 @@ static void msg_cache_add(struct bt_mesh_net_rx *rx) msg_cache_next %= ARRAY_SIZE(msg_cache); msg_cache[msg_cache_next].src = rx->ctx.addr; msg_cache[msg_cache_next].seq = rx->seq; + msg_cache[msg_cache_next].net_idx = rx->sub->net_idx; msg_cache_next++; } @@ -653,15 +657,14 @@ static bool net_decrypt(struct bt_mesh_net_rx *rx, struct net_buf_simple *in, return false; } - if (rx->net_if == BT_MESH_NET_IF_ADV && msg_cache_match(out)) { + if (rx->net_if == BT_MESH_NET_IF_ADV && msg_cache_match(out, rx->sub->net_idx)) { LOG_DBG("Duplicate found in Network Message Cache"); return false; } LOG_DBG("src 0x%04x", rx->ctx.addr); - return bt_mesh_net_decrypt(&cred->enc, out, BT_MESH_NET_IVI_RX(rx), - proxy) == 0; + return bt_mesh_net_decrypt(&cred->enc, out, BT_MESH_NET_IVI_RX(rx), proxy) == 0; } /* Relaying from advertising to the advertising bearer should only happen From 9a699b5802cbaac098cca7c0ece52f7f862504a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B8e?= Date: Mon, 17 Nov 2025 12:26:09 +0100 Subject: [PATCH 2137/2141] [nrf fromtree] soc: nordic: uicr: Move GEN_UICR options into the main Zephyr tree MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I initially added the GEN_UICR options to the gen_uicr image's Kconfig tree only to not pollute the main tree. But there is a lot of useful help text in the GEN_UICR option's Kconfig file that I would like users to be able to read/reference from the docs. To not increase the complexity of the Kconfig doc generator, we add the GEN_UICR options to the main tree and have them all be disabled for builds other than the gen_uicr image. Being in the main tree has the added benefit of being recognzied by the compliance checker. Signed-off-by: Sebastian Bøe (cherry picked from commit 70f6cf7ea0c069b9bd5d0246c8883d6349d0a1ad) --- scripts/ci/check_compliance.py | 33 ------------------- soc/nordic/common/uicr/Kconfig | 11 +++++++ .../{gen_uicr/Kconfig => Kconfig.gen_uicr} | 21 ++++++------ soc/nordic/common/uicr/gen_uicr/prj.conf | 7 +++- 4 files changed, 27 insertions(+), 45 deletions(-) rename soc/nordic/common/uicr/{gen_uicr/Kconfig => Kconfig.gen_uicr} (96%) diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index eae915967e6b..16aacd4c6a80 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -1350,39 +1350,6 @@ def check_no_undef_outside_kconfig(self, kconf): "FOO_LOG_LEVEL", "FOO_SETTING_1", "FOO_SETTING_2", - "GEN_UICR_APPROTECT_APPLICATION_PROTECTED", - "GEN_UICR_APPROTECT_CORESIGHT_PROTECTED", - "GEN_UICR_APPROTECT_RADIOCORE_PROTECTED", - "GEN_UICR_ERASEPROTECT", - "GEN_UICR_GENERATE_PERIPHCONF", - "GEN_UICR_LOCK", - "GEN_UICR_PROTECTEDMEM", - "GEN_UICR_PROTECTEDMEM_SIZE_BYTES", - "GEN_UICR_SECONDARY", - "GEN_UICR_SECONDARY_GENERATE_PERIPHCONF", - "GEN_UICR_SECONDARY_PROCESSOR_APPLICATION", - "GEN_UICR_SECONDARY_PROCESSOR_RADIOCORE", - "GEN_UICR_SECONDARY_PROCESSOR_VALUE", - "GEN_UICR_SECONDARY_PROTECTEDMEM", - "GEN_UICR_SECONDARY_PROTECTEDMEM_SIZE_BYTES", - "GEN_UICR_SECONDARY_TRIGGER", - "GEN_UICR_SECONDARY_TRIGGER_APPLICATIONLOCKUP", - "GEN_UICR_SECONDARY_TRIGGER_APPLICATIONWDT0", - "GEN_UICR_SECONDARY_TRIGGER_APPLICATIONWDT1", - "GEN_UICR_SECONDARY_TRIGGER_RADIOCORELOCKUP", - "GEN_UICR_SECONDARY_TRIGGER_RADIOCOREWDT0", - "GEN_UICR_SECONDARY_TRIGGER_RADIOCOREWDT1", - "GEN_UICR_SECONDARY_WDTSTART", - "GEN_UICR_SECONDARY_WDTSTART_CRV", - "GEN_UICR_SECONDARY_WDTSTART_INSTANCE_CODE", - "GEN_UICR_SECONDARY_WDTSTART_INSTANCE_WDT0", - "GEN_UICR_SECONDARY_WDTSTART_INSTANCE_WDT1", - "GEN_UICR_SECURESTORAGE", - "GEN_UICR_WDTSTART", - "GEN_UICR_WDTSTART_CRV", - "GEN_UICR_WDTSTART_INSTANCE_CODE", - "GEN_UICR_WDTSTART_INSTANCE_WDT0", - "GEN_UICR_WDTSTART_INSTANCE_WDT1", "HEAP_MEM_POOL_ADD_SIZE_", # Used as an option matching prefix "HUGETLBFS", # Linux, in boards/xtensa/intel_adsp_cavs25/doc "IAR_BUFFERED_WRITE", diff --git a/soc/nordic/common/uicr/Kconfig b/soc/nordic/common/uicr/Kconfig index 9f22fbbf7269..c3a69c3dbe0f 100644 --- a/soc/nordic/common/uicr/Kconfig +++ b/soc/nordic/common/uicr/Kconfig @@ -25,3 +25,14 @@ config IS_IRONSIDE_SE_SECONDARY_IMAGE This Kconfig is set by sysbuild to indicate that this image is a secondary firmware for Ironside SE. This is used by the UICR generation system to determine which PERIPHCONF partition to use. + +config IS_GEN_UICR_IMAGE + bool "UICR generator image indicator (informative only, do not change)" + help + This Kconfig is automatically set when building the gen_uicr image. + It indicates that this is the UICR generator utility image and enables + the UICR generator configuration options. + +# Source UICR generator options when building the gen_uicr image +# All options are disabled by default unless IS_GEN_UICR_IMAGE is set +rsource "Kconfig.gen_uicr" diff --git a/soc/nordic/common/uicr/gen_uicr/Kconfig b/soc/nordic/common/uicr/Kconfig.gen_uicr similarity index 96% rename from soc/nordic/common/uicr/gen_uicr/Kconfig rename to soc/nordic/common/uicr/Kconfig.gen_uicr index 7f25cc839dd6..4ee6af87eaef 100644 --- a/soc/nordic/common/uicr/gen_uicr/Kconfig +++ b/soc/nordic/common/uicr/Kconfig.gen_uicr @@ -2,6 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 menu "UICR generator options" + depends on IS_GEN_UICR_IMAGE config GEN_UICR_GENERATE_PERIPHCONF bool "Generate PERIPHCONF hex alongside UICR" @@ -11,7 +12,7 @@ config GEN_UICR_GENERATE_PERIPHCONF periphconf_partition partition. config GEN_UICR_SECURESTORAGE - bool "Enable UICR.SECURESTORAGE" + bool "UICR.SECURESTORAGE" default y depends on $(dt_nodelabel_enabled,secure_storage_partition) help @@ -33,7 +34,7 @@ config GEN_UICR_SECURESTORAGE - Combined subpartition sizes must equal secure_storage_partition size config GEN_UICR_LOCK - bool "Enable UICR.LOCK" + bool "UICR.LOCK" help When enabled, locks the entire contents of the NVR0 page located in MRAM10. This includes all values in both the UICR and the BICR (Board @@ -44,7 +45,7 @@ config GEN_UICR_LOCK unauthorized modification. config GEN_UICR_ERASEPROTECT - bool "Enable UICR.ERASEPROTECT" + bool "UICR.ERASEPROTECT" depends on ! GEN_UICR_LOCK help When enabled, ERASEALL operations are blocked. @@ -80,7 +81,7 @@ config GEN_UICR_APPROTECT_CORESIGHT_PROTECTED endmenu config GEN_UICR_PROTECTEDMEM - bool "Enable UICR.PROTECTEDMEM" + bool "UICR.PROTECTEDMEM" help When enabled, the UICR generator will configure the protected memory region. @@ -94,7 +95,7 @@ config GEN_UICR_PROTECTEDMEM_SIZE_BYTES This value must be divisible by 4096 (4 kiB). config GEN_UICR_WDTSTART - bool "Enable UICR.WDTSTART" + bool "UICR.WDTSTART" help When enabled, the UICR generator will configure an application domain watchdog timer to start automatically before the @@ -137,7 +138,7 @@ config GEN_UICR_WDTSTART_CRV Default value 65535 creates a 2-second timeout. config GEN_UICR_SECONDARY_WDTSTART - bool "Enable UICR.SECONDARY.WDTSTART" + bool "UICR.SECONDARY.WDTSTART" depends on GEN_UICR_SECONDARY help When enabled, the UICR generator will configure the @@ -181,7 +182,7 @@ config GEN_UICR_SECONDARY_WDTSTART_CRV Default value 65535 creates a 2-second timeout. config GEN_UICR_SECONDARY - bool "Enable UICR.SECONDARY.ENABLE" + bool "UICR.SECONDARY.ENABLE" if GEN_UICR_SECONDARY @@ -216,7 +217,7 @@ config GEN_UICR_SECONDARY_PROCESSOR_VALUE default 0x1730C77F if GEN_UICR_SECONDARY_PROCESSOR_RADIOCORE config GEN_UICR_SECONDARY_TRIGGER - bool "Enable UICR.SECONDARY.TRIGGER" + bool "UICR.SECONDARY.TRIGGER" help When enabled, configures automatic triggers that cause IronSide SE to boot the secondary firmware instead of the primary firmware based @@ -257,7 +258,7 @@ config GEN_UICR_SECONDARY_TRIGGER_RADIOCORELOCKUP endif # GEN_UICR_SECONDARY_TRIGGER config GEN_UICR_SECONDARY_PROTECTEDMEM - bool "Enable UICR.SECONDARY.PROTECTEDMEM" + bool "UICR.SECONDARY.PROTECTEDMEM" depends on GEN_UICR_SECONDARY help When enabled, the UICR generator will configure the @@ -274,5 +275,3 @@ config GEN_UICR_SECONDARY_PROTECTEDMEM_SIZE_BYTES endif # GEN_UICR_SECONDARY endmenu - -source "Kconfig.zephyr" diff --git a/soc/nordic/common/uicr/gen_uicr/prj.conf b/soc/nordic/common/uicr/gen_uicr/prj.conf index b2a4ba591044..e967f3a8ee98 100644 --- a/soc/nordic/common/uicr/gen_uicr/prj.conf +++ b/soc/nordic/common/uicr/gen_uicr/prj.conf @@ -1 +1,6 @@ -# nothing here +# Copyright (c) 2025 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +# Enable UICR generator options - this is automatically set when building +# the gen_uicr image and enables the UICR generator configuration menu +CONFIG_IS_GEN_UICR_IMAGE=y From e07fce57c202cf0745d40e1fac3cfd068972cb9a Mon Sep 17 00:00:00 2001 From: Robert Robinson Date: Fri, 14 Nov 2025 12:31:50 +0000 Subject: [PATCH 2138/2141] Revert "[nrf noup] tests: ram_context_for_isr: Disable KMU by default" This reverts commit 6782b3a2058632f4774fcbbe110664c7aae53cbc. Signed-off-by: Robert Robinson --- .../boards/nrf54l05dk_nrf54l05_cpuapp.conf | 6 ------ .../boards/nrf54l15dk_nrf54l10_cpuapp.conf | 6 ------ .../boards/nrf54l15dk_nrf54l15_cpuapp.conf | 6 ------ .../boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf | 6 ------ .../boards/nrf54lv10dk_nrf54lv10a_cpuapp.conf | 6 ------ 5 files changed, 30 deletions(-) delete mode 100644 tests/application_development/ram_context_for_isr/boards/nrf54l05dk_nrf54l05_cpuapp.conf delete mode 100644 tests/application_development/ram_context_for_isr/boards/nrf54l15dk_nrf54l10_cpuapp.conf delete mode 100644 tests/application_development/ram_context_for_isr/boards/nrf54l15dk_nrf54l15_cpuapp.conf delete mode 100644 tests/application_development/ram_context_for_isr/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf delete mode 100644 tests/application_development/ram_context_for_isr/boards/nrf54lv10dk_nrf54lv10a_cpuapp.conf diff --git a/tests/application_development/ram_context_for_isr/boards/nrf54l05dk_nrf54l05_cpuapp.conf b/tests/application_development/ram_context_for_isr/boards/nrf54l05dk_nrf54l05_cpuapp.conf deleted file mode 100644 index 963ba83325a4..000000000000 --- a/tests/application_development/ram_context_for_isr/boards/nrf54l05dk_nrf54l05_cpuapp.conf +++ /dev/null @@ -1,6 +0,0 @@ -# -# Copyright (c) 2025 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause -# -CONFIG_CRACEN_LIB_KMU=n diff --git a/tests/application_development/ram_context_for_isr/boards/nrf54l15dk_nrf54l10_cpuapp.conf b/tests/application_development/ram_context_for_isr/boards/nrf54l15dk_nrf54l10_cpuapp.conf deleted file mode 100644 index 963ba83325a4..000000000000 --- a/tests/application_development/ram_context_for_isr/boards/nrf54l15dk_nrf54l10_cpuapp.conf +++ /dev/null @@ -1,6 +0,0 @@ -# -# Copyright (c) 2025 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause -# -CONFIG_CRACEN_LIB_KMU=n diff --git a/tests/application_development/ram_context_for_isr/boards/nrf54l15dk_nrf54l15_cpuapp.conf b/tests/application_development/ram_context_for_isr/boards/nrf54l15dk_nrf54l15_cpuapp.conf deleted file mode 100644 index 963ba83325a4..000000000000 --- a/tests/application_development/ram_context_for_isr/boards/nrf54l15dk_nrf54l15_cpuapp.conf +++ /dev/null @@ -1,6 +0,0 @@ -# -# Copyright (c) 2025 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause -# -CONFIG_CRACEN_LIB_KMU=n diff --git a/tests/application_development/ram_context_for_isr/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf b/tests/application_development/ram_context_for_isr/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf deleted file mode 100644 index 963ba83325a4..000000000000 --- a/tests/application_development/ram_context_for_isr/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf +++ /dev/null @@ -1,6 +0,0 @@ -# -# Copyright (c) 2025 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause -# -CONFIG_CRACEN_LIB_KMU=n diff --git a/tests/application_development/ram_context_for_isr/boards/nrf54lv10dk_nrf54lv10a_cpuapp.conf b/tests/application_development/ram_context_for_isr/boards/nrf54lv10dk_nrf54lv10a_cpuapp.conf deleted file mode 100644 index 963ba83325a4..000000000000 --- a/tests/application_development/ram_context_for_isr/boards/nrf54lv10dk_nrf54lv10a_cpuapp.conf +++ /dev/null @@ -1,6 +0,0 @@ -# -# Copyright (c) 2025 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause -# -CONFIG_CRACEN_LIB_KMU=n From 0de5607892a0f68f3d1b7ca3572cb92ab01313c4 Mon Sep 17 00:00:00 2001 From: Georgios Vasilakis Date: Fri, 12 Sep 2025 12:38:25 +0200 Subject: [PATCH 2139/2141] [nrf noup] tests: ram_context_for_isr: Disable KMU by default Disable the KMU by default for all the NRF54L and NRF71 devices for this test. With the current configuration this test is incompatible with the KMU because it changes the placement of the RAM in the linker files and this collides with the KMU logic. But it also does not need the KMU so there is no need to be there. This is a noup because the configuration (and KMU support) is only placed in ncs. Reverted and reapplied noup to maintain all changes in a single commit. The KMU dependency to reserve the top RAM address is planned to be done in dts (NCSDK-31980). Hopefully when this is done this noup can be removed. Signed-off-by: Georgios Vasilakis Signed-off-by: Robert Robinson --- .../boards/nrf54l05dk_nrf54l05_cpuapp.conf | 6 ++++++ .../boards/nrf54l15dk_nrf54l10_cpuapp.conf | 6 ++++++ .../boards/nrf54l15dk_nrf54l15_cpuapp.conf | 6 ++++++ .../boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf | 6 ++++++ .../boards/nrf54lv10dk_nrf54lv10a_cpuapp.conf | 6 ++++++ .../boards/nrf7120pdk_nrf7120_cpuapp.conf | 6 ++++++ 6 files changed, 36 insertions(+) create mode 100644 tests/application_development/ram_context_for_isr/boards/nrf54l05dk_nrf54l05_cpuapp.conf create mode 100644 tests/application_development/ram_context_for_isr/boards/nrf54l15dk_nrf54l10_cpuapp.conf create mode 100644 tests/application_development/ram_context_for_isr/boards/nrf54l15dk_nrf54l15_cpuapp.conf create mode 100644 tests/application_development/ram_context_for_isr/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf create mode 100644 tests/application_development/ram_context_for_isr/boards/nrf54lv10dk_nrf54lv10a_cpuapp.conf create mode 100644 tests/application_development/ram_context_for_isr/boards/nrf7120pdk_nrf7120_cpuapp.conf diff --git a/tests/application_development/ram_context_for_isr/boards/nrf54l05dk_nrf54l05_cpuapp.conf b/tests/application_development/ram_context_for_isr/boards/nrf54l05dk_nrf54l05_cpuapp.conf new file mode 100644 index 000000000000..963ba83325a4 --- /dev/null +++ b/tests/application_development/ram_context_for_isr/boards/nrf54l05dk_nrf54l05_cpuapp.conf @@ -0,0 +1,6 @@ +# +# Copyright (c) 2025 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# +CONFIG_CRACEN_LIB_KMU=n diff --git a/tests/application_development/ram_context_for_isr/boards/nrf54l15dk_nrf54l10_cpuapp.conf b/tests/application_development/ram_context_for_isr/boards/nrf54l15dk_nrf54l10_cpuapp.conf new file mode 100644 index 000000000000..963ba83325a4 --- /dev/null +++ b/tests/application_development/ram_context_for_isr/boards/nrf54l15dk_nrf54l10_cpuapp.conf @@ -0,0 +1,6 @@ +# +# Copyright (c) 2025 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# +CONFIG_CRACEN_LIB_KMU=n diff --git a/tests/application_development/ram_context_for_isr/boards/nrf54l15dk_nrf54l15_cpuapp.conf b/tests/application_development/ram_context_for_isr/boards/nrf54l15dk_nrf54l15_cpuapp.conf new file mode 100644 index 000000000000..963ba83325a4 --- /dev/null +++ b/tests/application_development/ram_context_for_isr/boards/nrf54l15dk_nrf54l15_cpuapp.conf @@ -0,0 +1,6 @@ +# +# Copyright (c) 2025 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# +CONFIG_CRACEN_LIB_KMU=n diff --git a/tests/application_development/ram_context_for_isr/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf b/tests/application_development/ram_context_for_isr/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf new file mode 100644 index 000000000000..963ba83325a4 --- /dev/null +++ b/tests/application_development/ram_context_for_isr/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf @@ -0,0 +1,6 @@ +# +# Copyright (c) 2025 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# +CONFIG_CRACEN_LIB_KMU=n diff --git a/tests/application_development/ram_context_for_isr/boards/nrf54lv10dk_nrf54lv10a_cpuapp.conf b/tests/application_development/ram_context_for_isr/boards/nrf54lv10dk_nrf54lv10a_cpuapp.conf new file mode 100644 index 000000000000..963ba83325a4 --- /dev/null +++ b/tests/application_development/ram_context_for_isr/boards/nrf54lv10dk_nrf54lv10a_cpuapp.conf @@ -0,0 +1,6 @@ +# +# Copyright (c) 2025 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# +CONFIG_CRACEN_LIB_KMU=n diff --git a/tests/application_development/ram_context_for_isr/boards/nrf7120pdk_nrf7120_cpuapp.conf b/tests/application_development/ram_context_for_isr/boards/nrf7120pdk_nrf7120_cpuapp.conf new file mode 100644 index 000000000000..963ba83325a4 --- /dev/null +++ b/tests/application_development/ram_context_for_isr/boards/nrf7120pdk_nrf7120_cpuapp.conf @@ -0,0 +1,6 @@ +# +# Copyright (c) 2025 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# +CONFIG_CRACEN_LIB_KMU=n From f29cbf9a48a032237a3508d58a3570679d36667f Mon Sep 17 00:00:00 2001 From: Josh DeWitt Date: Thu, 13 Nov 2025 10:14:33 -0600 Subject: [PATCH 2140/2141] [nrf fromtree] soc: nordic: Gate FLASH_0 MPU region on CONFIG_XIP Only include a flash MPU region if CONFIG_XIP is set, similar to arm/core/mpu/arm_mpu_regions.c. Signed-off-by: Josh DeWitt (cherry picked from commit 0dc2e0c38f18f2ea65d03ed493dba9b1f19e5c2f) --- soc/nordic/common/nrf54hx_nrf92x_mpu_regions.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/soc/nordic/common/nrf54hx_nrf92x_mpu_regions.c b/soc/nordic/common/nrf54hx_nrf92x_mpu_regions.c index a9e8b3de7a91..14b63a6481c9 100644 --- a/soc/nordic/common/nrf54hx_nrf92x_mpu_regions.c +++ b/soc/nordic/common/nrf54hx_nrf92x_mpu_regions.c @@ -22,10 +22,12 @@ #define SOFTPERIPH_SIZE DT_REG_SIZE(DT_NODELABEL(softperiph_ram)) static struct arm_mpu_region mpu_regions[] = { +#ifdef CONFIG_XIP MPU_REGION_ENTRY("FLASH_0", CONFIG_FLASH_BASE_ADDRESS, REGION_FLASH_ATTR(CONFIG_FLASH_BASE_ADDRESS, CONFIG_FLASH_SIZE * 1024)), +#endif MPU_REGION_ENTRY("SRAM_0", CONFIG_SRAM_BASE_ADDRESS, REGION_RAM_ATTR(CONFIG_SRAM_BASE_ADDRESS, From 96358b15ab67e9b5e188b2fa822a7f587c809c60 Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Thu, 30 Oct 2025 17:22:16 +0100 Subject: [PATCH 2141/2141] [nrf fromlist] susbsys/mgmt/mcumgr/grp: add role field to parameters response Added optional `inst_role` field to MCUmgr Parameters response. Field is intended to express MCUmgr instance role on the device. Interpretation of the value is Application specific. Upstream PR #: 99592 Signed-off-by: Andrzej Puzdrowski --- subsys/mgmt/mcumgr/grp/os_mgmt/Kconfig | 11 +++++++++++ subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c | 4 ++++ 2 files changed, 15 insertions(+) diff --git a/subsys/mgmt/mcumgr/grp/os_mgmt/Kconfig b/subsys/mgmt/mcumgr/grp/os_mgmt/Kconfig index 36b727c76201..25913438db5b 100644 --- a/subsys/mgmt/mcumgr/grp/os_mgmt/Kconfig +++ b/subsys/mgmt/mcumgr/grp/os_mgmt/Kconfig @@ -166,6 +166,17 @@ config MCUMGR_GRP_OS_DATETIME_HOOK config MCUMGR_GRP_OS_MCUMGR_PARAMS bool "MCUMGR Parameters retrieval command" +config MCUMGR_GRP_OS_MCUMGR_PARAMS_ROLE + bool "MCUMGR Parameter Role in response" + depends on MCUMGR_GRP_OS_MCUMGR_PARAMS + +config MCUMGR_GRP_OS_MCUMGR_PARAMS_ROLE_VALUE + int "MCUMGR Parameter Role value" + default 0 + depends on MCUMGR_GRP_OS_MCUMGR_PARAMS_ROLE + help + Value for `inst_role` field in response to MCUmgr Parameters request. + config MCUMGR_GRP_OS_INFO bool "Support for info command" help diff --git a/subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c b/subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c index 360385a1b95c..e26f89850103 100644 --- a/subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c +++ b/subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c @@ -472,6 +472,10 @@ os_mgmt_mcumgr_params(struct smp_streamer *ctxt) zcbor_uint32_put(zse, CONFIG_MCUMGR_TRANSPORT_NETBUF_SIZE) && zcbor_tstr_put_lit(zse, "buf_count") && zcbor_uint32_put(zse, CONFIG_MCUMGR_TRANSPORT_NETBUF_COUNT); +#ifdef CONFIG_MCUMGR_GRP_OS_MCUMGR_PARAMS_ROLE + ok &= zcbor_tstr_put_lit(zse, "inst_role") && + zcbor_uint32_put(zse, CONFIG_MCUMGR_GRP_OS_MCUMGR_PARAMS_ROLE_VALUE); +#endif return ok ? MGMT_ERR_EOK : MGMT_ERR_EMSGSIZE; }